From: support Date: Thu, 17 Nov 2022 14:35:50 +0000 (+0000) Subject: Built motion from commit 3eeadcd5.|2.6.22 X-Git-Url: http://repos.xcallymotion.com/base//%22http:/www.gravatar.com/avatar/11111101111110hash%20%20%20%20%20%200%20%20%20%20%20%200/%22?a=commitdiff_plain;h=3579179b527489f7e4745de0afbb833b4612f881;p=motion2.git Built motion from commit 3eeadcd5.|2.6.22 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 8719591..0e20a3a 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-11-17T13:35:58.724Z", + "time": "2022-11-17T14:27:45.485Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index efd8776..8990862 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-11-17T13:35:58.724Z", + "time": "2022-11-17T14:27:45.485Z", "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 2a6708d..e0c183d 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 _0x1219=['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)]','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[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','sequelize','getDataValue','STRING','contactManager','motionbar','browser','bot'];(function(_0x5399a3,_0x273769){var _0x3d8d9a=function(_0x4581bc){while(--_0x4581bc){_0x5399a3['push'](_0x5399a3['shift']());}};_0x3d8d9a(++_0x273769);}(_0x1219,0x1e8));var _0x9121=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1219[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x9121('0x0'));module['exports']={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x1f21c9){return this[_0x9121('0x1')]('action');}},'action':{'type':Sequelize[_0x9121('0x2')],'allowNull':![],'validate':{'isIn':{'args':[[_0x9121('0x3'),'integration',_0x9121('0x4'),'jscripty','urlForward',_0x9121('0x5'),_0x9121('0x6'),'script']],'msg':_0x9121('0x7')}},'comment':_0x9121('0x7')},'data1':{'type':Sequelize[_0x9121('0x2')](0x1000),'comment':_0x9121('0x8')},'data2':{'type':Sequelize[_0x9121('0x2')](0x1000),'comment':_0x9121('0x9')},'data3':{'type':Sequelize['STRING'](0x1000),'comment':_0x9121('0xa')},'data4':{'type':Sequelize[_0x9121('0x2')](0x1000),'comments':_0x9121('0xb')},'data5':{'type':Sequelize[_0x9121('0x2')](0x1000),'comments':'urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]'},'data6':{'type':Sequelize['STRING'],'comments':_0x9121('0xc')},'data7':{'type':Sequelize[_0x9121('0xd')],'comments':_0x9121('0xe')}}; \ No newline at end of file +var _0x495f=['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[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','sequelize','exports','VIRTUAL','getDataValue','action','integration','motionbar'];(function(_0x59e821,_0x86c723){var _0x5333f6=function(_0x5dc2c9){while(--_0x5dc2c9){_0x59e821['push'](_0x59e821['shift']());}};_0x5333f6(++_0x86c723);}(_0x495f,0x111));var _0xf495=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0x495f[_0x32d457];return _0x338386;};'use strict';var Sequelize=require(_0xf495('0x0'));module[_0xf495('0x1')]={'name':{'type':Sequelize[_0xf495('0x2')],'get':function(_0x29cefb){return this[_0xf495('0x3')](_0xf495('0x4'));}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[['contactManager',_0xf495('0x5'),_0xf495('0x6'),_0xf495('0x7'),_0xf495('0x8'),_0xf495('0x9'),_0xf495('0xa'),_0xf495('0xb')]],'msg':_0xf495('0xc')}},'comment':_0xf495('0xc')},'data1':{'type':Sequelize[_0xf495('0xd')](0x1000),'comment':_0xf495('0xe')},'data2':{'type':Sequelize['STRING'](0x1000),'comment':'contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]'},'data3':{'type':Sequelize[_0xf495('0xd')](0x1000),'comment':_0xf495('0xf')},'data4':{'type':Sequelize['STRING'](0x1000),'comments':'browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]'},'data5':{'type':Sequelize[_0xf495('0xd')](0x1000),'comments':_0xf495('0x10')},'data6':{'type':Sequelize[_0xf495('0xd')],'comments':_0xf495('0x11')},'data7':{'type':Sequelize[_0xf495('0x12')],'comments':_0xf495('0x13')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index f62e1fd..a35d98b 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 _0xc7cc=['catch','destroy','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','reject','save','update','then','error','stack','name','send','body','Action','find','params'];(function(_0x3636e4,_0x182e40){var _0x4ec49b=function(_0x44e0e2){while(--_0x44e0e2){_0x3636e4['push'](_0x3636e4['shift']());}};_0x4ec49b(++_0x182e40);}(_0xc7cc,0xca));var _0xcc7c=function(_0x32bb05,_0x55a6de){_0x32bb05=_0x32bb05-0x0;var _0x80fc56=_0xc7cc[_0x32bb05];return _0x80fc56;};'use strict';var emlformat=require(_0xcc7c('0x0'));var rimraf=require(_0xcc7c('0x1'));var zipdir=require(_0xcc7c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcc7c('0x3'));var moment=require('moment');var BPromise=require(_0xcc7c('0x4'));var Mustache=require(_0xcc7c('0x5'));var util=require(_0xcc7c('0x6'));var path=require(_0xcc7c('0x7'));var sox=require(_0xcc7c('0x8'));var csv=require(_0xcc7c('0x9'));var ejs=require(_0xcc7c('0xa'));var fs=require('fs');var fs_extra=require(_0xcc7c('0xb'));var _=require(_0xcc7c('0xc'));var squel=require(_0xcc7c('0xd'));var crypto=require(_0xcc7c('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xcc7c('0xf'));var toCsv=require(_0xcc7c('0x9'));var querystring=require(_0xcc7c('0x10'));var Papa=require(_0xcc7c('0x11'));var Redis=require(_0xcc7c('0x12'));var authService=require(_0xcc7c('0x13'));var qs=require(_0xcc7c('0x14'));var as=require(_0xcc7c('0x15'));var hardwareService=require(_0xcc7c('0x16'));var logger=require(_0xcc7c('0x17'))('api');var utils=require('../../config/utils');var config=require(_0xcc7c('0x18'));var licenseUtil=require(_0xcc7c('0x19'));var db=require(_0xcc7c('0x1a'))['db'];function respondWithStatusCode(_0x5af00b,_0x4ebdd1){_0x4ebdd1=_0x4ebdd1||0xcc;return function(_0x572932){if(_0x572932){return _0x5af00b[_0xcc7c('0x1b')](_0x4ebdd1);}return _0x5af00b[_0xcc7c('0x1c')](_0x4ebdd1)[_0xcc7c('0x1d')]();};}function respondWithResult(_0x199338,_0x57c55a){_0x57c55a=_0x57c55a||0xc8;return function(_0x540695){if(_0x540695){return _0x199338[_0xcc7c('0x1c')](_0x57c55a)[_0xcc7c('0x1e')](_0x540695);}};}function respondWithFilteredResult(_0x539889,_0x2af2b6){return function(_0x34cce1){if(_0x34cce1){var _0x830096=typeof _0x2af2b6['offset']===_0xcc7c('0x1f')&&typeof _0x2af2b6[_0xcc7c('0x20')]==='undefined';var _0x4638b7=_0x34cce1[_0xcc7c('0x21')];var _0x3cc73c=_0x830096?0x0:_0x2af2b6[_0xcc7c('0x22')];var _0xc4076c=_0x830096?_0x34cce1[_0xcc7c('0x21')]:_0x2af2b6[_0xcc7c('0x22')]+_0x2af2b6[_0xcc7c('0x20')];var _0xdae90;if(_0xc4076c>=_0x4638b7){_0xc4076c=_0x4638b7;_0xdae90=0xc8;}else{_0xdae90=0xce;}_0x539889[_0xcc7c('0x1c')](_0xdae90);return _0x539889['set'](_0xcc7c('0x23'),_0x3cc73c+'-'+_0xc4076c+'/'+_0x4638b7)[_0xcc7c('0x1e')](_0x34cce1);}return null;};}function patchUpdates(_0x2c1f24){return function(_0x4756a9){try{jsonpatch['apply'](_0x4756a9,_0x2c1f24,!![]);}catch(_0x5bd640){return BPromise[_0xcc7c('0x24')](_0x5bd640);}return _0x4756a9[_0xcc7c('0x25')]();};}function saveUpdates(_0x284f03,_0x3f4295){return function(_0x4bc8f9){if(_0x4bc8f9){return _0x4bc8f9[_0xcc7c('0x26')](_0x284f03)[_0xcc7c('0x27')](function(_0x2d0873){return _0x2d0873;});}return null;};}function removeEntity(_0x29634c,_0x1b7168){return function(_0x3a45fc){if(_0x3a45fc){return _0x3a45fc['destroy']()[_0xcc7c('0x27')](function(){_0x29634c[_0xcc7c('0x1c')](0xcc)[_0xcc7c('0x1d')]();});}};}function handleEntityNotFound(_0x2ce584,_0x432778){return function(_0x7c1850){if(!_0x7c1850){_0x2ce584[_0xcc7c('0x1b')](0x194);}return _0x7c1850;};}function handleError(_0x254bb3,_0x262f32){_0x262f32=_0x262f32||0x1f4;return function(_0x3cb612){logger[_0xcc7c('0x28')](_0x3cb612[_0xcc7c('0x29')]);if(_0x3cb612[_0xcc7c('0x2a')]){delete _0x3cb612[_0xcc7c('0x2a')];}_0x254bb3[_0xcc7c('0x1c')](_0x262f32)[_0xcc7c('0x2b')](_0x3cb612);};}exports[_0xcc7c('0x26')]=function(_0x4b1cda,_0x29e34c){if(_0x4b1cda['body']['id']){delete _0x4b1cda[_0xcc7c('0x2c')]['id'];}return db[_0xcc7c('0x2d')][_0xcc7c('0x2e')]({'where':{'id':_0x4b1cda[_0xcc7c('0x2f')]['id']}})[_0xcc7c('0x27')](handleEntityNotFound(_0x29e34c,null))[_0xcc7c('0x27')](saveUpdates(_0x4b1cda[_0xcc7c('0x2c')],null))['then'](respondWithResult(_0x29e34c,null))[_0xcc7c('0x30')](handleError(_0x29e34c,null));};exports[_0xcc7c('0x31')]=function(_0xf5ad1c,_0x9baddb){return db[_0xcc7c('0x2d')][_0xcc7c('0x2e')]({'where':{'id':_0xf5ad1c[_0xcc7c('0x2f')]['id']}})[_0xcc7c('0x27')](handleEntityNotFound(_0x9baddb,null))[_0xcc7c('0x27')](removeEntity(_0x9baddb,null))['catch'](handleError(_0x9baddb,null));}; \ No newline at end of file +var _0xc237=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','end','error','stack','name','body','Action','params','catch','destroy','find'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc237,0x180));var _0x7c23=function(_0x35b3c4,_0xc1f277){_0x35b3c4=_0x35b3c4-0x0;var _0x403033=_0xc237[_0x35b3c4];return _0x403033;};'use strict';var emlformat=require(_0x7c23('0x0'));var rimraf=require(_0x7c23('0x1'));var zipdir=require(_0x7c23('0x2'));var jsonpatch=require(_0x7c23('0x3'));var rp=require(_0x7c23('0x4'));var moment=require('moment');var BPromise=require(_0x7c23('0x5'));var Mustache=require(_0x7c23('0x6'));var util=require(_0x7c23('0x7'));var path=require(_0x7c23('0x8'));var sox=require(_0x7c23('0x9'));var csv=require(_0x7c23('0xa'));var ejs=require(_0x7c23('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x7c23('0xc'));var crypto=require(_0x7c23('0xd'));var jsforce=require(_0x7c23('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x7c23('0xa'));var querystring=require(_0x7c23('0xf'));var Papa=require(_0x7c23('0x10'));var Redis=require(_0x7c23('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x7c23('0x12'));var hardwareService=require(_0x7c23('0x13'));var logger=require(_0x7c23('0x14'))(_0x7c23('0x15'));var utils=require(_0x7c23('0x16'));var config=require(_0x7c23('0x17'));var licenseUtil=require(_0x7c23('0x18'));var db=require(_0x7c23('0x19'))['db'];function respondWithStatusCode(_0x1eb56f,_0x50a511){_0x50a511=_0x50a511||0xcc;return function(_0x404cdb){if(_0x404cdb){return _0x1eb56f['sendStatus'](_0x50a511);}return _0x1eb56f[_0x7c23('0x1a')](_0x50a511)['end']();};}function respondWithResult(_0x55e5dc,_0x47de15){_0x47de15=_0x47de15||0xc8;return function(_0x1357f2){if(_0x1357f2){return _0x55e5dc[_0x7c23('0x1a')](_0x47de15)[_0x7c23('0x1b')](_0x1357f2);}};}function respondWithFilteredResult(_0x2900a4,_0x199806){return function(_0x33010b){if(_0x33010b){var _0xcee1da=typeof _0x199806[_0x7c23('0x1c')]==='undefined'&&typeof _0x199806[_0x7c23('0x1d')]===_0x7c23('0x1e');var _0x4b0c7a=_0x33010b[_0x7c23('0x1f')];var _0x760800=_0xcee1da?0x0:_0x199806[_0x7c23('0x1c')];var _0xbc674e=_0xcee1da?_0x33010b[_0x7c23('0x1f')]:_0x199806[_0x7c23('0x1c')]+_0x199806[_0x7c23('0x1d')];var _0x4335df;if(_0xbc674e>=_0x4b0c7a){_0xbc674e=_0x4b0c7a;_0x4335df=0xc8;}else{_0x4335df=0xce;}_0x2900a4['status'](_0x4335df);return _0x2900a4[_0x7c23('0x20')](_0x7c23('0x21'),_0x760800+'-'+_0xbc674e+'/'+_0x4b0c7a)[_0x7c23('0x1b')](_0x33010b);}return null;};}function patchUpdates(_0xf5f2e5){return function(_0x26ecdc){try{jsonpatch[_0x7c23('0x22')](_0x26ecdc,_0xf5f2e5,!![]);}catch(_0x40960d){return BPromise[_0x7c23('0x23')](_0x40960d);}return _0x26ecdc['save']();};}function saveUpdates(_0x40b545,_0x1096d2){return function(_0x35f322){if(_0x35f322){return _0x35f322[_0x7c23('0x24')](_0x40b545)[_0x7c23('0x25')](function(_0x322b1f){return _0x322b1f;});}return null;};}function removeEntity(_0x5d2e9b,_0xd3d67a){return function(_0x42beab){if(_0x42beab){return _0x42beab['destroy']()[_0x7c23('0x25')](function(){_0x5d2e9b[_0x7c23('0x1a')](0xcc)[_0x7c23('0x26')]();});}};}function handleEntityNotFound(_0x5ed43a,_0x440482){return function(_0x41381c){if(!_0x41381c){_0x5ed43a['sendStatus'](0x194);}return _0x41381c;};}function handleError(_0x3911fb,_0x51d9ab){_0x51d9ab=_0x51d9ab||0x1f4;return function(_0x36f22b){logger[_0x7c23('0x27')](_0x36f22b[_0x7c23('0x28')]);if(_0x36f22b[_0x7c23('0x29')]){delete _0x36f22b['name'];}_0x3911fb[_0x7c23('0x1a')](_0x51d9ab)['send'](_0x36f22b);};}exports[_0x7c23('0x24')]=function(_0x4f783b,_0x4965a6){if(_0x4f783b[_0x7c23('0x2a')]['id']){delete _0x4f783b[_0x7c23('0x2a')]['id'];}return db[_0x7c23('0x2b')]['find']({'where':{'id':_0x4f783b[_0x7c23('0x2c')]['id']}})['then'](handleEntityNotFound(_0x4965a6,null))['then'](saveUpdates(_0x4f783b['body'],null))[_0x7c23('0x25')](respondWithResult(_0x4965a6,null))[_0x7c23('0x2d')](handleError(_0x4965a6,null));};exports[_0x7c23('0x2e')]=function(_0x8b3567,_0x3fef5a){return db[_0x7c23('0x2b')][_0x7c23('0x2f')]({'where':{'id':_0x8b3567['params']['id']}})[_0x7c23('0x25')](handleEntityNotFound(_0x3fef5a,null))[_0x7c23('0x25')](removeEntity(_0x3fef5a,null))['catch'](handleError(_0x3fef5a,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 8da83c6..b9d5fce 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 _0xe148=['path','rimraf','../../config/environment','./action.attributes','exports','Action','tools_actions','util','../../config/logger','api','moment'];(function(_0x24790c,_0x5c3633){var _0x5a8a34=function(_0x35616e){while(--_0x35616e){_0x24790c['push'](_0x24790c['shift']());}};_0x5a8a34(++_0x5c3633);}(_0xe148,0x6a));var _0x8e14=function(_0xdaab62,_0x2728ab){_0xdaab62=_0xdaab62-0x0;var _0x13d767=_0xe148[_0xdaab62];return _0x13d767;};'use strict';var _=require('lodash');var util=require(_0x8e14('0x0'));var logger=require(_0x8e14('0x1'))(_0x8e14('0x2'));var moment=require(_0x8e14('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8e14('0x4'));var rimraf=require(_0x8e14('0x5'));var config=require(_0x8e14('0x6'));var attributes=require(_0x8e14('0x7'));module[_0x8e14('0x8')]=function(_0x48f03a,_0x202be7){return _0x48f03a['define'](_0x8e14('0x9'),attributes,{'tableName':_0x8e14('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x672e=['Action','tools_actions','lodash','../../config/logger','api','moment','bluebird','path','../../config/environment','./action.attributes','exports','define'];(function(_0x20e467,_0x1a707d){var _0x54694e=function(_0x387383){while(--_0x387383){_0x20e467['push'](_0x20e467['shift']());}};_0x54694e(++_0x1a707d);}(_0x672e,0x1e2));var _0xe672=function(_0x15b0d4,_0xe11bfb){_0x15b0d4=_0x15b0d4-0x0;var _0x5e3be7=_0x672e[_0x15b0d4];return _0x5e3be7;};'use strict';var _=require(_0xe672('0x0'));var util=require('util');var logger=require(_0xe672('0x1'))(_0xe672('0x2'));var moment=require(_0xe672('0x3'));var BPromise=require(_0xe672('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe672('0x5'));var rimraf=require('rimraf');var config=require(_0xe672('0x6'));var attributes=require(_0xe672('0x7'));module[_0xe672('0x8')]=function(_0x4d2ef9,_0x37c809){return _0x4d2ef9[_0xe672('0x9')](_0xe672('0xa'),attributes,{'tableName':_0xe672('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/action/action.rpc.js b/server/api/action/action.rpc.js index 4ed0750..e4141c3 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 _0x53ec=['error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','request','then','info','Action,\x20%s,\x20%s','request\x20sent','debug','stringify','code'];(function(_0x556927,_0x34b53f){var _0x5f1235=function(_0x4f4e44){while(--_0x4f4e44){_0x556927['push'](_0x556927['shift']());}};_0x5f1235(++_0x34b53f);}(_0x53ec,0x192));var _0xc53e=function(_0x5cc61d,_0x4fe17b){_0x5cc61d=_0x5cc61d-0x0;var _0x2e25d0=_0x53ec[_0x5cc61d];return _0x2e25d0;};'use strict';var _=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var moment=require(_0xc53e('0x2'));var BPromise=require(_0xc53e('0x3'));var rs=require(_0xc53e('0x4'));var fs=require('fs');var Redis=require(_0xc53e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc53e('0x6'));var logger=require('../../config/logger')(_0xc53e('0x7'));var config=require(_0xc53e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc53e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41a9e8,_0x2de88b,_0x5d3b28){return new BPromise(function(_0x1616ac,_0x1ac6c0){return client[_0xc53e('0xa')](_0x41a9e8,_0x5d3b28)[_0xc53e('0xb')](function(_0xd9612){logger[_0xc53e('0xc')](_0xc53e('0xd'),_0x2de88b,_0xc53e('0xe'));logger[_0xc53e('0xf')]('Action,\x20%s,\x20%s,\x20%s',_0x2de88b,'request\x20sent',JSON[_0xc53e('0x10')](_0xd9612));if(_0xd9612['error']){if(_0xd9612['error'][_0xc53e('0x11')]===0x1f4){logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0xd9612[_0xc53e('0x12')]['message']);return _0x1ac6c0(_0xd9612['error'][_0xc53e('0x13')]);}logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0xd9612[_0xc53e('0x12')][_0xc53e('0x13')]);return _0x1616ac(_0xd9612[_0xc53e('0x12')][_0xc53e('0x13')]);}else{logger[_0xc53e('0xc')](_0xc53e('0xd'),_0x2de88b,_0xc53e('0xe'));_0x1616ac(_0xd9612['result'][_0xc53e('0x13')]);}})[_0xc53e('0x14')](function(_0x535cd4){logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0x535cd4);_0x1ac6c0(_0x535cd4);});});} \ No newline at end of file +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(_0x422634,_0x49f610){var _0x17da9f=function(_0x4735de){while(--_0x4735de){_0x422634['push'](_0x422634['shift']());}};_0x17da9f(++_0x49f610);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x5a776b,_0x46f785){_0x5a776b=_0x5a776b-0x0;var _0xbbef59=_0xc4aa[_0x5a776b];return _0xbbef59;};'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 diff --git a/server/api/action/index.js b/server/api/action/index.js index 735c34d..4759649 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 _0x70a0=['/:id','isAuthenticated','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller'];(function(_0x3cf053,_0x7a9947){var _0x3b55a0=function(_0x2a99cc){while(--_0x2a99cc){_0x3cf053['push'](_0x3cf053['shift']());}};_0x3b55a0(++_0x7a9947);}(_0x70a0,0xf4));var _0x070a=function(_0x87b0ff,_0x314389){_0x87b0ff=_0x87b0ff-0x0;var _0x3bc0b2=_0x70a0[_0x87b0ff];return _0x3bc0b2;};'use strict';var multer=require(_0x070a('0x0'));var util=require(_0x070a('0x1'));var path=require(_0x070a('0x2'));var timeout=require(_0x070a('0x3'));var express=require(_0x070a('0x4'));var router=express[_0x070a('0x5')]();var fs_extra=require(_0x070a('0x6'));var auth=require(_0x070a('0x7'));var interaction=require(_0x070a('0x8'));var config=require(_0x070a('0x9'));var controller=require(_0x070a('0xa'));router['put'](_0x070a('0xb'),auth[_0x070a('0xc')](),controller[_0x070a('0xd')]);router[_0x070a('0xe')](_0x070a('0xb'),auth[_0x070a('0xc')](),controller[_0x070a('0xf')]);module[_0x070a('0x10')]=router; \ No newline at end of file +var _0x2924=['delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','put','/:id','isAuthenticated','update'];(function(_0x1fc16f,_0x5cdc65){var _0x4c475f=function(_0x9205e6){while(--_0x9205e6){_0x1fc16f['push'](_0x1fc16f['shift']());}};_0x4c475f(++_0x5cdc65);}(_0x2924,0x133));var _0x4292=function(_0x4de1c3,_0xbe77b9){_0x4de1c3=_0x4de1c3-0x0;var _0x26acfe=_0x2924[_0x4de1c3];return _0x26acfe;};'use strict';var multer=require(_0x4292('0x0'));var util=require(_0x4292('0x1'));var path=require(_0x4292('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x4292('0x3')]();var fs_extra=require(_0x4292('0x4'));var auth=require(_0x4292('0x5'));var interaction=require(_0x4292('0x6'));var config=require(_0x4292('0x7'));var controller=require(_0x4292('0x8'));router[_0x4292('0x9')](_0x4292('0xa'),auth[_0x4292('0xb')](),controller[_0x4292('0xc')]);router[_0x4292('0xd')](_0x4292('0xa'),auth['isAuthenticated'](),controller[_0x4292('0xe')]);module[_0x4292('0xf')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 3daf056..279f711 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 _0x5fd1=['STRING','TEXT','sequelize'];(function(_0x1e05c1,_0x3cffa3){var _0x15f1ca=function(_0x3a9594){while(--_0x3a9594){_0x1e05c1['push'](_0x1e05c1['shift']());}};_0x15f1ca(++_0x3cffa3);}(_0x5fd1,0x155));var _0x15fd=function(_0x577533,_0x392fd8){_0x577533=_0x577533-0x0;var _0x437cf1=_0x5fd1[_0x577533];return _0x437cf1;};'use strict';var Sequelize=require(_0x15fd('0x0'));module['exports']={'name':{'type':Sequelize[_0x15fd('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x15fd('0x1')]},'parent':{'type':Sequelize[_0x15fd('0x1')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0x15fd('0x2')]}}; \ No newline at end of file +var _0x5fd1=['STRING','TEXT','sequelize'];(function(_0x35e92e,_0x21581b){var _0x1205a8=function(_0x4325d8){while(--_0x4325d8){_0x35e92e['push'](_0x35e92e['shift']());}};_0x1205a8(++_0x21581b);}(_0x5fd1,0x155));var _0x15fd=function(_0xda3281,_0x3da7dd){_0xda3281=_0xda3281-0x0;var _0x40ada8=_0x5fd1[_0xda3281];return _0x40ada8;};'use strict';var Sequelize=require(_0x15fd('0x0'));module['exports']={'name':{'type':Sequelize[_0x15fd('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x15fd('0x1')]},'parent':{'type':Sequelize[_0x15fd('0x1')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0x15fd('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index ed69cfc..9e559f2 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 _0x4b97=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','destroy','then','get','CustomReports','UserProfileResource','sendStatus','stack','name','send','index','AnalyticCustomReport','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','type','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','left_join','right_join','cross_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','from','table','MetricId','function','format','replace','DESC','field','alias','joins','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','debug','Limited\x20Query:','toString','sequelize','SELECT','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','IS\x20NULL','select','metric','groupBy','orderBy','parse','web','fullPath','%s-%s.%s','generate','output','csv','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','startDate','info','Run\x20Query:','child_process','fork','../../files/reports','savename','countTable','COUNT(*)','QueryTypes','run','SUM(%s)','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring'];(function(_0x1db58e,_0x54d5db){var _0x35a9cd=function(_0x3fcbfc){while(--_0x3fcbfc){_0x1db58e['push'](_0x1db58e['shift']());}};_0x35a9cd(++_0x54d5db);}(_0x4b97,0x1db));var _0x74b9=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x4b97[_0x13d07a];return _0x5ee0ee;};'use strict';var emlformat=require(_0x74b9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x74b9('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x74b9('0x2'));var moment=require(_0x74b9('0x3'));var BPromise=require(_0x74b9('0x4'));var Mustache=require(_0x74b9('0x5'));var util=require(_0x74b9('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x74b9('0x7'));var ejs=require(_0x74b9('0x8'));var fs=require('fs');var fs_extra=require(_0x74b9('0x9'));var _=require('lodash');var squel=require(_0x74b9('0xa'));var crypto=require('crypto');var jsforce=require(_0x74b9('0xb'));var deskjs=require(_0x74b9('0xc'));var toCsv=require(_0x74b9('0x7'));var querystring=require(_0x74b9('0xd'));var Papa=require(_0x74b9('0xe'));var Redis=require(_0x74b9('0xf'));var authService=require(_0x74b9('0x10'));var qs=require(_0x74b9('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x74b9('0x12'));var logger=require(_0x74b9('0x13'))(_0x74b9('0x14'));var utils=require(_0x74b9('0x15'));var config=require(_0x74b9('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x74b9('0x17'))['db'];var dbH=require(_0x74b9('0x17'))['dbH'];function respondWithStatusCode(_0x5759fc,_0x49319b){_0x49319b=_0x49319b||0xcc;return function(_0x3c7456){if(_0x3c7456){return _0x5759fc['sendStatus'](_0x49319b);}return _0x5759fc[_0x74b9('0x18')](_0x49319b)[_0x74b9('0x19')]();};}function respondWithResult(_0xe7c39f,_0x339175){_0x339175=_0x339175||0xc8;return function(_0x355624){if(_0x355624){return _0xe7c39f[_0x74b9('0x18')](_0x339175)[_0x74b9('0x1a')](_0x355624);}};}function respondWithFilteredResult(_0x94437e,_0x416187){return function(_0x808dac){if(_0x808dac){var _0x5409a7=typeof _0x416187[_0x74b9('0x1b')]===_0x74b9('0x1c')&&typeof _0x416187[_0x74b9('0x1d')]===_0x74b9('0x1c');var _0x4ca6c5=_0x808dac[_0x74b9('0x1e')];var _0x443814=_0x5409a7?0x0:_0x416187[_0x74b9('0x1b')];var _0x184e97=_0x5409a7?_0x808dac[_0x74b9('0x1e')]:_0x416187[_0x74b9('0x1b')]+_0x416187[_0x74b9('0x1d')];var _0xe9982b;if(_0x184e97>=_0x4ca6c5){_0x184e97=_0x4ca6c5;_0xe9982b=0xc8;}else{_0xe9982b=0xce;}_0x94437e[_0x74b9('0x18')](_0xe9982b);return _0x94437e[_0x74b9('0x1f')](_0x74b9('0x20'),_0x443814+'-'+_0x184e97+'/'+_0x4ca6c5)[_0x74b9('0x1a')](_0x808dac);}return null;};}function patchUpdates(_0x17c45a){return function(_0x4e65ca){try{jsonpatch['apply'](_0x4e65ca,_0x17c45a,!![]);}catch(_0x471103){return BPromise[_0x74b9('0x21')](_0x471103);}return _0x4e65ca['save']();};}function saveUpdates(_0x1d14c7,_0x577f74){return function(_0x398f3a){if(_0x398f3a){return _0x398f3a[_0x74b9('0x22')](_0x1d14c7)['then'](function(_0x4ae4d6){return _0x4ae4d6;});}return null;};}function removeEntity(_0x205042,_0x3ffd63){return function(_0x27ec43){if(_0x27ec43){return _0x27ec43[_0x74b9('0x23')]()[_0x74b9('0x24')](function(){var _0x23ad63=_0x27ec43[_0x74b9('0x25')]({'plain':!![]});var _0x29dcb8=_0x74b9('0x26');return db[_0x74b9('0x27')][_0x74b9('0x23')]({'where':{'type':_0x29dcb8,'resourceId':_0x23ad63['id']}})[_0x74b9('0x24')](function(){return _0x27ec43;});})[_0x74b9('0x24')](function(){_0x205042[_0x74b9('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3fbd0e,_0x3627b9){return function(_0x58e979){if(!_0x58e979){_0x3fbd0e[_0x74b9('0x28')](0x194);}return _0x58e979;};}function handleError(_0x51264c,_0x59bc75){_0x59bc75=_0x59bc75||0x1f4;return function(_0x310a31){logger['error'](_0x310a31[_0x74b9('0x29')]);if(_0x310a31[_0x74b9('0x2a')]){delete _0x310a31[_0x74b9('0x2a')];}_0x51264c[_0x74b9('0x18')](_0x59bc75)[_0x74b9('0x2b')](_0x310a31);};}exports[_0x74b9('0x2c')]=function(_0x38cbc2,_0x342385){var _0xccb60d={},_0x13a112={},_0x30cd6e={'count':0x0,'rows':[]};var _0x3834c3=_['map'](db[_0x74b9('0x2d')][_0x74b9('0x2e')],function(_0xeee37b){return{'name':_0xeee37b[_0x74b9('0x2f')],'type':_0xeee37b['type'][_0x74b9('0x30')]};});_0x13a112[_0x74b9('0x31')]=_[_0x74b9('0x32')](_0x3834c3,_0x74b9('0x2a'));_0x13a112[_0x74b9('0x33')]=_[_0x74b9('0x34')](_0x38cbc2[_0x74b9('0x33')]);_0x13a112[_0x74b9('0x35')]=_[_0x74b9('0x36')](_0x13a112[_0x74b9('0x31')],_0x13a112[_0x74b9('0x33')]);_0xccb60d['attributes']=_[_0x74b9('0x36')](_0x13a112[_0x74b9('0x31')],qs[_0x74b9('0x37')](_0x38cbc2[_0x74b9('0x33')][_0x74b9('0x37')]));_0xccb60d[_0x74b9('0x38')]=_0xccb60d[_0x74b9('0x38')][_0x74b9('0x39')]?_0xccb60d[_0x74b9('0x38')]:_0x13a112[_0x74b9('0x31')];if(!_0x38cbc2[_0x74b9('0x33')][_0x74b9('0x3a')](_0x74b9('0x3b'))){_0xccb60d[_0x74b9('0x1d')]=qs[_0x74b9('0x1d')](_0x38cbc2['query']['limit']);_0xccb60d[_0x74b9('0x1b')]=qs[_0x74b9('0x1b')](_0x38cbc2[_0x74b9('0x33')][_0x74b9('0x1b')]);}_0xccb60d[_0x74b9('0x3c')]=qs[_0x74b9('0x3d')](_0x38cbc2[_0x74b9('0x33')]['sort']);_0xccb60d['where']=qs[_0x74b9('0x35')](_[_0x74b9('0x3e')](_0x38cbc2[_0x74b9('0x33')],_0x13a112[_0x74b9('0x35')]),_0x3834c3);if(_0x38cbc2[_0x74b9('0x33')][_0x74b9('0x3f')]){_0xccb60d[_0x74b9('0x40')]=_['merge'](_0xccb60d[_0x74b9('0x40')],{'$or':_['map'](_0x3834c3,function(_0x726347){if(_0x726347[_0x74b9('0x41')]!==_0x74b9('0x42')){var _0x5dc13f={};_0x5dc13f[_0x726347[_0x74b9('0x2a')]]={'$like':'%'+_0x38cbc2['query'][_0x74b9('0x3f')]+'%'};return _0x5dc13f;}})});}_0xccb60d=_[_0x74b9('0x43')]({},_0xccb60d,_0x38cbc2[_0x74b9('0x44')]);var _0x1345db={'where':_0xccb60d[_0x74b9('0x40')]};return db['AnalyticCustomReport']['count'](_0x1345db)[_0x74b9('0x24')](function(_0x1e21f5){_0x30cd6e[_0x74b9('0x1e')]=_0x1e21f5;if(_0x38cbc2[_0x74b9('0x33')][_0x74b9('0x45')]){_0xccb60d['include']=[{'all':!![]}];}return db['AnalyticCustomReport'][_0x74b9('0x46')](_0xccb60d);})['then'](function(_0x54dd8b){_0x30cd6e[_0x74b9('0x47')]=_0x54dd8b;return _0x30cd6e;})[_0x74b9('0x24')](respondWithFilteredResult(_0x342385,_0xccb60d))[_0x74b9('0x48')](handleError(_0x342385,null));};exports[_0x74b9('0x49')]=function(_0x44431e,_0x593f33){var _0x13d56={'raw':![],'where':{'id':_0x44431e[_0x74b9('0x4a')]['id']}},_0x3f955e={};_0x3f955e[_0x74b9('0x31')]=_[_0x74b9('0x34')](db[_0x74b9('0x2d')][_0x74b9('0x2e')]);_0x3f955e[_0x74b9('0x33')]=_[_0x74b9('0x34')](_0x44431e['query']);_0x3f955e['filters']=_['intersection'](_0x3f955e['model'],_0x3f955e[_0x74b9('0x33')]);_0x13d56['attributes']=_[_0x74b9('0x36')](_0x3f955e[_0x74b9('0x31')],qs[_0x74b9('0x37')](_0x44431e[_0x74b9('0x33')][_0x74b9('0x37')]));_0x13d56[_0x74b9('0x38')]=_0x13d56[_0x74b9('0x38')][_0x74b9('0x39')]?_0x13d56['attributes']:_0x3f955e[_0x74b9('0x31')];if(_0x44431e['query']['includeAll']){_0x13d56[_0x74b9('0x4b')]=[{'all':!![]}];}_0x13d56=_['merge']({},_0x13d56,_0x44431e[_0x74b9('0x44')]);return db[_0x74b9('0x2d')][_0x74b9('0x4c')](_0x13d56)[_0x74b9('0x24')](handleEntityNotFound(_0x593f33,null))[_0x74b9('0x24')](respondWithResult(_0x593f33,null))[_0x74b9('0x48')](handleError(_0x593f33,null));};exports[_0x74b9('0x4d')]=function(_0x183e27,_0x287488){return db[_0x74b9('0x2d')][_0x74b9('0x4d')](_0x183e27[_0x74b9('0x4e')],{})[_0x74b9('0x24')](function(_0x4b7dee){var _0x30a5fd=_0x183e27[_0x74b9('0x4f')][_0x74b9('0x25')]({'plain':!![]});if(!_0x30a5fd)throw new Error(_0x74b9('0x50'));if(_0x30a5fd['role']===_0x74b9('0x4f')){var _0x2d75c5=_0x4b7dee[_0x74b9('0x25')]({'plain':!![]});var _0x219b44='Reports';return db['UserProfileSection']['find']({'where':{'name':_0x219b44,'userProfileId':_0x30a5fd['userProfileId']},'raw':!![]})[_0x74b9('0x24')](function(_0xb35311){if(_0xb35311&&_0xb35311[_0x74b9('0x51')]===0x0){return db['UserProfileResource'][_0x74b9('0x4d')]({'name':_0x2d75c5['name'],'resourceId':_0x2d75c5['id'],'type':'CustomReports','sectionId':_0xb35311['id']},{})[_0x74b9('0x24')](function(){return _0x4b7dee;});}else{return _0x4b7dee;}})[_0x74b9('0x48')](function(_0x28321e){logger[_0x74b9('0x52')](_0x74b9('0x53'),_0x28321e);throw _0x28321e;});}return _0x4b7dee;})[_0x74b9('0x24')](respondWithResult(_0x287488,0xc9))[_0x74b9('0x48')](handleError(_0x287488,null));};exports[_0x74b9('0x22')]=function(_0x178102,_0x991228){if(_0x178102[_0x74b9('0x4e')]['id']){delete _0x178102[_0x74b9('0x4e')]['id'];}return db[_0x74b9('0x2d')]['find']({'where':{'id':_0x178102[_0x74b9('0x4a')]['id']}})[_0x74b9('0x24')](handleEntityNotFound(_0x991228,null))['then'](saveUpdates(_0x178102[_0x74b9('0x4e')],null))[_0x74b9('0x24')](respondWithResult(_0x991228,null))['catch'](handleError(_0x991228,null));};exports[_0x74b9('0x23')]=function(_0x354b5b,_0x5f27fa){return db[_0x74b9('0x2d')][_0x74b9('0x4c')]({'where':{'id':_0x354b5b[_0x74b9('0x4a')]['id']}})[_0x74b9('0x24')](handleEntityNotFound(_0x5f27fa,null))['then'](removeEntity(_0x5f27fa,null))[_0x74b9('0x48')](handleError(_0x5f27fa,null));};exports['preview']=function(_0x5d9a32,_0x177d78){var _0x28db52=0xa;var _0x133a6f=[_0x74b9('0x54'),_0x74b9('0x55'),_0x74b9('0x56'),_0x74b9('0x57')];var _0x51e027={'SUM':'SUM(%s)','COUNT':_0x74b9('0x58'),'COUNT DISTINCT':_0x74b9('0x59'),'MAX':_0x74b9('0x5a'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x74b9('0x5b'),'GROUP_CONCAT ASC':_0x74b9('0x5c'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x17f280={'SEC_TO_TIME':_0x74b9('0x5d'),'DATE':_0x74b9('0x5e'),'HOUR':_0x74b9('0x5f'),'ROUND':_0x74b9('0x60'),'UNIX_TIMESTAMP':_0x74b9('0x61')};var _0x25cb57=function(_0x17a909){return!_[_0x74b9('0x62')](['IS\x20NULL',_0x74b9('0x63'),_0x74b9('0x64'),_0x74b9('0x65')],_0x17a909);};var _0x1065b0=function(_0x4f0976){if(!_0x4f0976||!_0x4f0976[_0x74b9('0x66')][_0x74b9('0x39')]){return'';}for(var _0x16e378='(',_0x57d5eb=0x0;_0x57d5eb<_0x4f0976['rules']['length'];_0x57d5eb+=0x1){_0x57d5eb>0x0&&(_0x16e378+='\x20'+_0x4f0976[_0x74b9('0x67')]+'\x20');_0x16e378+=_0x4f0976[_0x74b9('0x66')][_0x57d5eb][_0x74b9('0x68')]?_0x1065b0(_0x4f0976[_0x74b9('0x66')][_0x57d5eb][_0x74b9('0x68')]):_0x4f0976[_0x74b9('0x66')][_0x57d5eb]['field']+'\x20'+_0x4f0976[_0x74b9('0x66')][_0x57d5eb][_0x74b9('0x69')]+(_0x25cb57(_0x4f0976[_0x74b9('0x66')][_0x57d5eb]['condition'])?'\x20'+_0x4f0976['rules'][_0x57d5eb][_0x74b9('0x6a')]:'');}return _0x16e378+')';};var _0x1f4273={'where':{'id':_0x5d9a32[_0x74b9('0x4a')]['id']}},_0x5b790f,_0x2677d2,_0x4af478,_0x56d507,_0x494992;_0x1f4273=_[_0x74b9('0x43')]({},_0x1f4273,_0x5d9a32[_0x74b9('0x44')]);return db[_0x74b9('0x2d')][_0x74b9('0x4c')](_0x1f4273)[_0x74b9('0x24')](function(_0x2669c6){if(_0x2669c6){_0x5b790f=_0x2669c6;return _0x2669c6[_0x74b9('0x6b')]();}return null;})[_0x74b9('0x24')](function(_0x54ecf3){if(_0x54ecf3){if(!_0x54ecf3[_0x74b9('0x39')]){throw new db[(_0x74b9('0x6c'))][(_0x74b9('0x6d'))](_0x74b9('0x6e'),0x193);}_0x2677d2=_0x54ecf3;return db[_0x74b9('0x6f')][_0x74b9('0x46')]({'raw':!![]});}return null;})[_0x74b9('0x24')](function(_0x557a01){if(_0x557a01){_0x4af478=_[_0x74b9('0x70')](_0x557a01,'id');var _0x276c82;var _0xa38ac5=squel['select']();_0xa38ac5[_0x74b9('0x71')](_0x5b790f[_0x74b9('0x72')]);for(var _0x272742=0x0;_0x272742<_0x2677d2['length'];_0x272742+=0x1){_0x276c82=_0x2677d2[_0x272742][_0x74b9('0x73')]?_0x4af478[_0x2677d2[_0x272742][_0x74b9('0x73')]]['metric']:_0x2677d2[_0x272742]['field'];_0x276c82=_0x2677d2[_0x272742][_0x74b9('0x74')]?_['replace'](_0x51e027[_0x2677d2[_0x272742][_0x74b9('0x74')]],'%s',_0x276c82):_0x276c82;_0x276c82=_0x2677d2[_0x272742][_0x74b9('0x75')]?_[_0x74b9('0x76')](_0x17f280[_0x2677d2[_0x272742][_0x74b9('0x75')]],'%s',_0x276c82):_0x276c82;if(_0x2677d2[_0x272742]['groupBy']){_0xa38ac5[_0x74b9('0x68')](_0x276c82);}_0x2677d2[_0x272742]['orderBy']&&_0xa38ac5['order'](_0x276c82,_0x2677d2[_0x272742]['orderBy']===_0x74b9('0x77')?![]:!![]);_0xa38ac5[_0x74b9('0x78')](_0x276c82,_0x2677d2[_0x272742][_0x74b9('0x79')]||_0x276c82);}if(_0x5b790f[_0x74b9('0x7a')]){_0x5b790f[_0x74b9('0x7a')]=JSON['parse'](_0x5b790f['joins']);for(var _0x14f3f3=0x0;_0x14f3f3<_0x5b790f[_0x74b9('0x7a')]['length'];_0x14f3f3+=0x1){if(_0x5b790f['joins'][_0x14f3f3]['type']&&_[_0x74b9('0x62')](_0x133a6f,_0x5b790f[_0x74b9('0x7a')][_0x14f3f3][_0x74b9('0x41')])&&_0x5b790f[_0x74b9('0x7a')][_0x14f3f3][_0x74b9('0x7b')]&&_0x5b790f[_0x74b9('0x7a')][_0x14f3f3][_0x74b9('0x7c')]&&_0x5b790f[_0x74b9('0x7a')][_0x14f3f3][_0x74b9('0x7d')]){_0xa38ac5[_0x5b790f[_0x74b9('0x7a')][_0x14f3f3][_0x74b9('0x41')]](_0x5b790f['joins'][_0x14f3f3][_0x74b9('0x7c')],null,util['format'](_0x74b9('0x7e'),_0x5b790f[_0x74b9('0x72')],_0x5b790f['joins'][_0x14f3f3][_0x74b9('0x7b')],_0x5b790f[_0x74b9('0x7a')][_0x14f3f3][_0x74b9('0x7c')],_0x5b790f[_0x74b9('0x7a')][_0x14f3f3]['foreignKey']));}}}if(_0x5b790f['conditions']){_0x5b790f['conditions']=JSON['parse'](_0x5b790f[_0x74b9('0x7f')]);_0xa38ac5['where'](_0x1065b0(_0x5b790f[_0x74b9('0x7f')][_0x74b9('0x68')]));}_0x494992=_0xa38ac5['clone']();_0xa38ac5['limit'](_0x28db52);_0xa38ac5['offset'](0x0);logger[_0x74b9('0x80')](_0x74b9('0x81'),_0xa38ac5[_0x74b9('0x82')]());return dbH[_0x74b9('0x83')][_0x74b9('0x33')](_0xa38ac5['toString'](),{'type':dbH[_0x74b9('0x83')]['QueryTypes'][_0x74b9('0x84')]});}})[_0x74b9('0x24')](respondWithResult(_0x177d78,null))[_0x74b9('0x48')](handleError(_0x177d78,null));};function runReport(_0x3b5b13,_0x964be7,_0x4f91db){var _0x3a576d=_0x964be7[_0x74b9('0x2a')];var _0x1ccc50=0xa;var _0x4dc2e6=[_0x74b9('0x54'),_0x74b9('0x55'),_0x74b9('0x56'),_0x74b9('0x57')];var _0x385805={'SUM':'SUM(%s)','COUNT':_0x74b9('0x58'),'COUNT DISTINCT':_0x74b9('0x59'),'MAX':_0x74b9('0x5a'),'MIN':_0x74b9('0x85'),'AVG':_0x74b9('0x86'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x74b9('0x87')};var _0x399ce7={'SEC_TO_TIME':_0x74b9('0x5d'),'DATE':_0x74b9('0x5e'),'HOUR':_0x74b9('0x5f'),'ROUND':_0x74b9('0x60'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x2141e2=function(_0x4c52ab){return!_[_0x74b9('0x62')]([_0x74b9('0x88'),_0x74b9('0x63'),_0x74b9('0x64'),'IS\x20NOT\x20EMPTY'],_0x4c52ab);};var _0x3610ac=function(_0x1d04fd){if(!_0x1d04fd||!_0x1d04fd[_0x74b9('0x66')]['length']){return'';}for(var _0x4661b5='(',_0x34beb6=0x0;_0x34beb6<_0x1d04fd[_0x74b9('0x66')][_0x74b9('0x39')];_0x34beb6+=0x1){_0x34beb6>0x0&&(_0x4661b5+='\x20'+_0x1d04fd['operator']+'\x20');_0x4661b5+=_0x1d04fd['rules'][_0x34beb6]['group']?_0x3610ac(_0x1d04fd[_0x74b9('0x66')][_0x34beb6][_0x74b9('0x68')]):_0x1d04fd[_0x74b9('0x66')][_0x34beb6][_0x74b9('0x78')]+'\x20'+_0x1d04fd[_0x74b9('0x66')][_0x34beb6][_0x74b9('0x69')]+(_0x2141e2(_0x1d04fd[_0x74b9('0x66')][_0x34beb6]['condition'])?'\x20'+_0x1d04fd['rules'][_0x34beb6][_0x74b9('0x6a')]:'');}return _0x4661b5+')';};var _0x47ac36={'where':{'id':_0x3b5b13['id']}},_0x3874fc,_0x55a5ee,_0x375848,_0x261521,_0x3f57e9;_0x47ac36=_[_0x74b9('0x43')]({},_0x47ac36,_0x4f91db);return db[_0x74b9('0x2d')][_0x74b9('0x4c')](_0x47ac36)['then'](function(_0x4f2755){if(_0x4f2755){_0x3874fc=_0x4f2755;return _0x4f2755['getFields']();}return null;})[_0x74b9('0x24')](function(_0x4e2a34){if(_0x4e2a34){if(!_0x4e2a34[_0x74b9('0x39')]){throw new db[(_0x74b9('0x6c'))]['ValidationErrorItem'](_0x74b9('0x6e'),0x193);}_0x55a5ee=_0x4e2a34;return db['AnalyticMetric'][_0x74b9('0x46')]({'raw':!![]});}return null;})[_0x74b9('0x24')](function(_0x2ffc4a){if(_0x2ffc4a){_0x375848=_[_0x74b9('0x70')](_0x2ffc4a,'id');var _0x5a0886;var _0x46c2d5=squel[_0x74b9('0x89')]();_0x46c2d5['from'](_0x3874fc[_0x74b9('0x72')]);for(var _0x5ccdce=0x0;_0x5ccdce<_0x55a5ee['length'];_0x5ccdce+=0x1){_0x5a0886=_0x55a5ee[_0x5ccdce]['MetricId']?_0x375848[_0x55a5ee[_0x5ccdce]['MetricId']][_0x74b9('0x8a')]:_0x55a5ee[_0x5ccdce]['field'];_0x5a0886=_0x55a5ee[_0x5ccdce][_0x74b9('0x74')]?_['replace'](_0x385805[_0x55a5ee[_0x5ccdce][_0x74b9('0x74')]],'%s',_0x5a0886):_0x5a0886;_0x5a0886=_0x55a5ee[_0x5ccdce][_0x74b9('0x75')]?_[_0x74b9('0x76')](_0x399ce7[_0x55a5ee[_0x5ccdce][_0x74b9('0x75')]],'%s',_0x5a0886):_0x5a0886;if(_0x55a5ee[_0x5ccdce][_0x74b9('0x8b')]){_0x46c2d5[_0x74b9('0x68')](_0x5a0886);}_0x55a5ee[_0x5ccdce][_0x74b9('0x8c')]&&_0x46c2d5['order'](_0x5a0886,_0x55a5ee[_0x5ccdce]['orderBy']==='DESC'?![]:!![]);_0x46c2d5['field'](_0x5a0886,_0x55a5ee[_0x5ccdce][_0x74b9('0x79')]||_0x5a0886);}if(_0x3874fc[_0x74b9('0x7a')]){_0x3874fc['joins']=JSON[_0x74b9('0x8d')](_0x3874fc[_0x74b9('0x7a')]);for(var _0x2e20d2=0x0;_0x2e20d2<_0x3874fc['joins'][_0x74b9('0x39')];_0x2e20d2+=0x1){if(_0x3874fc['joins'][_0x2e20d2][_0x74b9('0x41')]&&_['includes'](_0x4dc2e6,_0x3874fc[_0x74b9('0x7a')][_0x2e20d2][_0x74b9('0x41')])&&_0x3874fc[_0x74b9('0x7a')][_0x2e20d2][_0x74b9('0x7b')]&&_0x3874fc[_0x74b9('0x7a')][_0x2e20d2][_0x74b9('0x7c')]&&_0x3874fc[_0x74b9('0x7a')][_0x2e20d2][_0x74b9('0x7d')]){_0x46c2d5[_0x3874fc[_0x74b9('0x7a')][_0x2e20d2][_0x74b9('0x41')]](_0x3874fc[_0x74b9('0x7a')][_0x2e20d2][_0x74b9('0x7c')],null,util[_0x74b9('0x75')](_0x74b9('0x7e'),_0x3874fc[_0x74b9('0x72')],_0x3874fc[_0x74b9('0x7a')][_0x2e20d2][_0x74b9('0x7b')],_0x3874fc[_0x74b9('0x7a')][_0x2e20d2][_0x74b9('0x7c')],_0x3874fc['joins'][_0x2e20d2][_0x74b9('0x7d')]));}}}if(_0x3874fc['conditions']){_0x3874fc[_0x74b9('0x7f')]=JSON[_0x74b9('0x8d')](_0x3874fc['conditions']);_0x46c2d5['where'](_0x3610ac(_0x3874fc[_0x74b9('0x7f')][_0x74b9('0x68')]));}_0x3f57e9=_0x46c2d5['clone']();_0x46c2d5[_0x74b9('0x1d')](_0x1ccc50);_0x46c2d5[_0x74b9('0x1b')](0x0);return;}})['then'](function(){if(_0x964be7['output']===_0x74b9('0x8e')){return null;}var _0x4e254a=_[_0x74b9('0x43')](_0x964be7,{'name':_0x964be7[_0x74b9('0x8f')]||_0x964be7[_0x74b9('0x2a')]||_0x3874fc[_0x74b9('0x2a')],'basename':_0x3a576d,'savename':util['format'](_0x74b9('0x90'),_0x964be7[_0x74b9('0x2a')]||_0x3874fc['name'],require('randomstring')[_0x74b9('0x91')](0x4),_0x964be7[_0x74b9('0x92')]||_0x74b9('0x93')),'reportId':_0x3874fc['id'],'reportType':'custom'});return db['AnalyticExtractedReport'][_0x74b9('0x4d')](_0x4e254a,{'raw':!![]});})[_0x74b9('0x24')](function(_0x5675b1){if(_0x3874fc[_0x74b9('0x72')]===_0x74b9('0x94')){_0x3f57e9[_0x74b9('0x40')](_0x3874fc[_0x74b9('0x72')]+_0x74b9('0x95'),_0x964be7['startDate'],_0x964be7[_0x74b9('0x96')]);}else{_0x3f57e9['where'](_0x3874fc[_0x74b9('0x72')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x964be7[_0x74b9('0x97')],_0x964be7[_0x74b9('0x96')]);}if(_0x5675b1){logger[_0x74b9('0x98')](_0x74b9('0x99'),_0x3f57e9[_0x74b9('0x82')]());require(_0x74b9('0x9a'))[_0x74b9('0x9b')](path[_0x74b9('0x54')](__dirname,'../../components/export/',_0x5675b1[_0x74b9('0x92')]),[_0x5675b1['id'],_0x3f57e9[_0x74b9('0x82')](),path[_0x74b9('0x54')](__dirname,_0x74b9('0x9c'),_0x5675b1[_0x74b9('0x9d')]),_0x3a576d]);return _0x5675b1;}else{var _0x12236b=squel[_0x74b9('0x89')]();_0x12236b['from']('('+_0x3f57e9[_0x74b9('0x82')]()+')',_0x74b9('0x9e'));_0x12236b[_0x74b9('0x78')](_0x74b9('0x9f'),_0x74b9('0x1e'));_0x3f57e9['limit'](_0x964be7[_0x74b9('0x1d')]||_0x1ccc50);_0x3f57e9['offset'](_0x964be7[_0x74b9('0x1b')]||0x0);return dbH[_0x74b9('0x83')][_0x74b9('0x33')](_0x12236b[_0x74b9('0x82')](),{'type':dbH[_0x74b9('0x83')][_0x74b9('0xa0')][_0x74b9('0x84')]})[_0x74b9('0x24')](function(_0x35a2d9){if(!_0x35a2d9['length']){_0x261521=0x0;}else{_0x261521=_0x35a2d9[0x0][_0x74b9('0x1e')]||0x0;}return dbH[_0x74b9('0x83')]['query'](_0x3f57e9[_0x74b9('0x82')](),{'type':dbH['sequelize'][_0x74b9('0xa0')][_0x74b9('0x84')]});})[_0x74b9('0x24')](function(_0x3edbe2){return{'rows':_0x3edbe2||[],'count':_0x261521};});}});}exports[_0x74b9('0xa1')]=function(_0x41ef23,_0x4772e0){return runReport(_0x41ef23[_0x74b9('0x4a')],_0x41ef23[_0x74b9('0x33')],_0x41ef23[_0x74b9('0x44')])['then'](respondWithResult(_0x4772e0,null))[_0x74b9('0x48')](handleError(_0x4772e0,null));};exports['runReport']=runReport;exports['query']=function(_0x1596c0,_0x476a19){var _0x3209ef=0xa;var _0x1ab4cd=[_0x74b9('0x54'),_0x74b9('0x55'),_0x74b9('0x56'),_0x74b9('0x57')];var _0x369ca8={'SUM':_0x74b9('0xa2'),'COUNT':_0x74b9('0x58'),'COUNT DISTINCT':_0x74b9('0x59'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':_0x74b9('0x86'),'GROUP_CONCAT':_0x74b9('0x5b'),'GROUP_CONCAT ASC':_0x74b9('0x5c'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x59bb32={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x74b9('0x5e'),'HOUR':_0x74b9('0x5f'),'ROUND':_0x74b9('0x60'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x465a34=function(_0x286027){return!_[_0x74b9('0x62')](['IS\x20NULL',_0x74b9('0x63'),_0x74b9('0x64'),_0x74b9('0x65')],_0x286027);};var _0x3f1b3a=function(_0x4d199b){if(!_0x4d199b||!_0x4d199b[_0x74b9('0x66')][_0x74b9('0x39')]){return'';}for(var _0x312106='(',_0x41cdcf=0x0;_0x41cdcf<_0x4d199b[_0x74b9('0x66')]['length'];_0x41cdcf+=0x1){_0x41cdcf>0x0&&(_0x312106+='\x20'+_0x4d199b['operator']+'\x20');_0x312106+=_0x4d199b[_0x74b9('0x66')][_0x41cdcf][_0x74b9('0x68')]?_0x3f1b3a(_0x4d199b['rules'][_0x41cdcf][_0x74b9('0x68')]):_0x4d199b[_0x74b9('0x66')][_0x41cdcf]['field']+'\x20'+_0x4d199b[_0x74b9('0x66')][_0x41cdcf]['condition']+(_0x465a34(_0x4d199b['rules'][_0x41cdcf]['condition'])?'\x20'+_0x4d199b[_0x74b9('0x66')][_0x41cdcf][_0x74b9('0x6a')]:'');}return _0x312106+')';};var _0xa7aa82={'where':{'id':_0x1596c0[_0x74b9('0x4a')]['id']}},_0xe9399c,_0x9f4fe2,_0x338ba7,_0x11b565,_0x152d38;_0xa7aa82=_[_0x74b9('0x43')]({},_0xa7aa82,_0x1596c0[_0x74b9('0x44')]);return db[_0x74b9('0x2d')][_0x74b9('0x4c')](_0xa7aa82)[_0x74b9('0x24')](function(_0x3761cc){if(_0x3761cc){_0xe9399c=_0x3761cc;return _0x3761cc['getFields']();}return null;})[_0x74b9('0x24')](function(_0x3a78e6){if(_0x3a78e6){if(!_0x3a78e6[_0x74b9('0x39')]){throw new db[(_0x74b9('0x6c'))]['ValidationErrorItem'](_0x74b9('0x6e'),0x193);}_0x9f4fe2=_0x3a78e6;return db[_0x74b9('0x6f')]['findAll']({'raw':!![]});}return null;})[_0x74b9('0x24')](function(_0x4828a8){if(_0x4828a8){_0x338ba7=_[_0x74b9('0x70')](_0x4828a8,'id');var _0x111469;var _0x4f6b09=squel[_0x74b9('0x89')]();_0x4f6b09[_0x74b9('0x71')](_0xe9399c[_0x74b9('0x72')]);for(var _0x460c54=0x0;_0x460c54<_0x9f4fe2[_0x74b9('0x39')];_0x460c54+=0x1){_0x111469=_0x9f4fe2[_0x460c54]['MetricId']?_0x338ba7[_0x9f4fe2[_0x460c54][_0x74b9('0x73')]][_0x74b9('0x8a')]:_0x9f4fe2[_0x460c54]['field'];_0x111469=_0x9f4fe2[_0x460c54][_0x74b9('0x74')]?_[_0x74b9('0x76')](_0x369ca8[_0x9f4fe2[_0x460c54]['function']],'%s',_0x111469):_0x111469;_0x111469=_0x9f4fe2[_0x460c54][_0x74b9('0x75')]?_['replace'](_0x59bb32[_0x9f4fe2[_0x460c54]['format']],'%s',_0x111469):_0x111469;if(_0x9f4fe2[_0x460c54][_0x74b9('0x8b')]){_0x4f6b09[_0x74b9('0x68')](_0x111469);}_0x9f4fe2[_0x460c54][_0x74b9('0x8c')]&&_0x4f6b09[_0x74b9('0x3c')](_0x111469,_0x9f4fe2[_0x460c54][_0x74b9('0x8c')]===_0x74b9('0x77')?![]:!![]);_0x4f6b09['field'](_0x111469,_0x9f4fe2[_0x460c54][_0x74b9('0x79')]||_0x111469);}if(_0xe9399c['joins']){_0xe9399c[_0x74b9('0x7a')]=JSON[_0x74b9('0x8d')](_0xe9399c[_0x74b9('0x7a')]);for(var _0x2ceff6=0x0;_0x2ceff6<_0xe9399c[_0x74b9('0x7a')][_0x74b9('0x39')];_0x2ceff6+=0x1){if(_0xe9399c[_0x74b9('0x7a')][_0x2ceff6][_0x74b9('0x41')]&&_[_0x74b9('0x62')](_0x1ab4cd,_0xe9399c[_0x74b9('0x7a')][_0x2ceff6][_0x74b9('0x41')])&&_0xe9399c[_0x74b9('0x7a')][_0x2ceff6][_0x74b9('0x7b')]&&_0xe9399c[_0x74b9('0x7a')][_0x2ceff6][_0x74b9('0x7c')]&&_0xe9399c['joins'][_0x2ceff6][_0x74b9('0x7d')]){_0x4f6b09[_0xe9399c['joins'][_0x2ceff6][_0x74b9('0x41')]](_0xe9399c[_0x74b9('0x7a')][_0x2ceff6]['foreignTable'],null,util[_0x74b9('0x75')](_0x74b9('0x7e'),_0xe9399c[_0x74b9('0x72')],_0xe9399c[_0x74b9('0x7a')][_0x2ceff6]['parentKey'],_0xe9399c[_0x74b9('0x7a')][_0x2ceff6][_0x74b9('0x7c')],_0xe9399c[_0x74b9('0x7a')][_0x2ceff6]['foreignKey']));}}}if(_0xe9399c[_0x74b9('0x7f')]){_0xe9399c[_0x74b9('0x7f')]=JSON[_0x74b9('0x8d')](_0xe9399c[_0x74b9('0x7f')]);_0x4f6b09[_0x74b9('0x40')](_0x3f1b3a(_0xe9399c[_0x74b9('0x7f')][_0x74b9('0x68')]));}_0x152d38=_0x4f6b09['clone']();_0x4f6b09[_0x74b9('0x1d')](_0x3209ef);_0x4f6b09[_0x74b9('0x1b')](0x0);logger['debug'](_0x74b9('0x81'),_0x4f6b09[_0x74b9('0x82')]());return dbH[_0x74b9('0x83')]['query'](_0x4f6b09[_0x74b9('0x82')](),{'type':dbH[_0x74b9('0x83')]['QueryTypes']['SELECT']});}})[_0x74b9('0x24')](function(){return{'sql':_0x152d38[_0x74b9('0x82')]()};})[_0x74b9('0x24')](respondWithResult(_0x476a19,null))[_0x74b9('0x48')](handleError(_0x476a19,null));}; \ No newline at end of file +var _0x223f=['DESC','alias','joins','parse','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','parentKey','conditions','clone','debug','Limited\x20Query:','toString','sequelize','SELECT','SEC_TO_TIME(%s)','IS\x20EMPTY','IS\x20NOT\x20EMPTY','operator','field','condition','select','web','%s-%s.%s','randomstring','output','csv','custom','AnalyticExtractedReport','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','child_process','fork','../../components/export/','../../files/reports','savename','QueryTypes','run','runReport','HOUR(%s)','keyBy','eml-format','rimraf','zip-dir','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/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','get','CustomReports','UserProfileResource','sendStatus','error','stack','send','map','fieldName','key','model','name','keys','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','type','filter','options','AnalyticCustomReport','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','preview','join','left_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\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','rules','group','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','from','table','MetricId','metric','function','replace','format','groupBy','orderBy'];(function(_0x2a6580,_0x15f1fb){var _0x21489f=function(_0x1fd3c0){while(--_0x1fd3c0){_0x2a6580['push'](_0x2a6580['shift']());}};_0x21489f(++_0x15f1fb);}(_0x223f,0xd6));var _0xf223=function(_0x88e351,_0x3a1211){_0x88e351=_0x88e351-0x0;var _0x5ec895=_0x223f[_0x88e351];return _0x5ec895;};'use strict';var emlformat=require(_0xf223('0x0'));var rimraf=require(_0xf223('0x1'));var zipdir=require(_0xf223('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf223('0x3'));var moment=require(_0xf223('0x4'));var BPromise=require(_0xf223('0x5'));var Mustache=require(_0xf223('0x6'));var util=require(_0xf223('0x7'));var path=require(_0xf223('0x8'));var sox=require('sox');var csv=require(_0xf223('0x9'));var ejs=require(_0xf223('0xa'));var fs=require('fs');var fs_extra=require(_0xf223('0xb'));var _=require(_0xf223('0xc'));var squel=require(_0xf223('0xd'));var crypto=require(_0xf223('0xe'));var jsforce=require(_0xf223('0xf'));var deskjs=require(_0xf223('0x10'));var toCsv=require('to-csv');var querystring=require(_0xf223('0x11'));var Papa=require(_0xf223('0x12'));var Redis=require(_0xf223('0x13'));var authService=require(_0xf223('0x14'));var qs=require(_0xf223('0x15'));var as=require(_0xf223('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf223('0x17'))('api');var utils=require(_0xf223('0x18'));var config=require(_0xf223('0x19'));var licenseUtil=require(_0xf223('0x1a'));var db=require(_0xf223('0x1b'))['db'];var dbH=require(_0xf223('0x1b'))[_0xf223('0x1c')];function respondWithStatusCode(_0x2fff66,_0x3d00df){_0x3d00df=_0x3d00df||0xcc;return function(_0x4079c7){if(_0x4079c7){return _0x2fff66['sendStatus'](_0x3d00df);}return _0x2fff66[_0xf223('0x1d')](_0x3d00df)[_0xf223('0x1e')]();};}function respondWithResult(_0x18cb8d,_0x3a6920){_0x3a6920=_0x3a6920||0xc8;return function(_0x4cf51e){if(_0x4cf51e){return _0x18cb8d[_0xf223('0x1d')](_0x3a6920)[_0xf223('0x1f')](_0x4cf51e);}};}function respondWithFilteredResult(_0x380a97,_0x22ab3d){return function(_0x30c8e2){if(_0x30c8e2){var _0x2b64db=typeof _0x22ab3d[_0xf223('0x20')]===_0xf223('0x21')&&typeof _0x22ab3d[_0xf223('0x22')]===_0xf223('0x21');var _0x3e39b7=_0x30c8e2[_0xf223('0x23')];var _0x3bcd14=_0x2b64db?0x0:_0x22ab3d[_0xf223('0x20')];var _0x3439a6=_0x2b64db?_0x30c8e2[_0xf223('0x23')]:_0x22ab3d[_0xf223('0x20')]+_0x22ab3d[_0xf223('0x22')];var _0x6e36bb;if(_0x3439a6>=_0x3e39b7){_0x3439a6=_0x3e39b7;_0x6e36bb=0xc8;}else{_0x6e36bb=0xce;}_0x380a97[_0xf223('0x1d')](_0x6e36bb);return _0x380a97[_0xf223('0x24')](_0xf223('0x25'),_0x3bcd14+'-'+_0x3439a6+'/'+_0x3e39b7)['json'](_0x30c8e2);}return null;};}function patchUpdates(_0x37f87d){return function(_0xa09c78){try{jsonpatch[_0xf223('0x26')](_0xa09c78,_0x37f87d,!![]);}catch(_0x8ab296){return BPromise['reject'](_0x8ab296);}return _0xa09c78[_0xf223('0x27')]();};}function saveUpdates(_0x1c26b3,_0x3197eb){return function(_0xc9dd65){if(_0xc9dd65){return _0xc9dd65[_0xf223('0x28')](_0x1c26b3)[_0xf223('0x29')](function(_0x393e9f){return _0x393e9f;});}return null;};}function removeEntity(_0x58826e,_0x3a1f05){return function(_0x17a9b4){if(_0x17a9b4){return _0x17a9b4[_0xf223('0x2a')]()[_0xf223('0x29')](function(){var _0xe1c863=_0x17a9b4[_0xf223('0x2b')]({'plain':!![]});var _0x312022=_0xf223('0x2c');return db[_0xf223('0x2d')][_0xf223('0x2a')]({'where':{'type':_0x312022,'resourceId':_0xe1c863['id']}})[_0xf223('0x29')](function(){return _0x17a9b4;});})[_0xf223('0x29')](function(){_0x58826e[_0xf223('0x1d')](0xcc)[_0xf223('0x1e')]();});}};}function handleEntityNotFound(_0x177781,_0x23a7b7){return function(_0x3679e9){if(!_0x3679e9){_0x177781[_0xf223('0x2e')](0x194);}return _0x3679e9;};}function handleError(_0x24ad84,_0x169e16){_0x169e16=_0x169e16||0x1f4;return function(_0x41aaf6){logger[_0xf223('0x2f')](_0x41aaf6[_0xf223('0x30')]);if(_0x41aaf6['name']){delete _0x41aaf6['name'];}_0x24ad84['status'](_0x169e16)[_0xf223('0x31')](_0x41aaf6);};}exports['index']=function(_0x36fea8,_0x419a8b){var _0x2bfc3e={},_0x28f92a={},_0x359a97={'count':0x0,'rows':[]};var _0x1fd24f=_[_0xf223('0x32')](db['AnalyticCustomReport']['rawAttributes'],function(_0x159435){return{'name':_0x159435[_0xf223('0x33')],'type':_0x159435['type'][_0xf223('0x34')]};});_0x28f92a[_0xf223('0x35')]=_[_0xf223('0x32')](_0x1fd24f,_0xf223('0x36'));_0x28f92a['query']=_[_0xf223('0x37')](_0x36fea8['query']);_0x28f92a['filters']=_[_0xf223('0x38')](_0x28f92a[_0xf223('0x35')],_0x28f92a[_0xf223('0x39')]);_0x2bfc3e[_0xf223('0x3a')]=_[_0xf223('0x38')](_0x28f92a[_0xf223('0x35')],qs[_0xf223('0x3b')](_0x36fea8[_0xf223('0x39')][_0xf223('0x3b')]));_0x2bfc3e[_0xf223('0x3a')]=_0x2bfc3e[_0xf223('0x3a')][_0xf223('0x3c')]?_0x2bfc3e['attributes']:_0x28f92a['model'];if(!_0x36fea8[_0xf223('0x39')][_0xf223('0x3d')](_0xf223('0x3e'))){_0x2bfc3e['limit']=qs['limit'](_0x36fea8['query'][_0xf223('0x22')]);_0x2bfc3e[_0xf223('0x20')]=qs[_0xf223('0x20')](_0x36fea8['query'][_0xf223('0x20')]);}_0x2bfc3e[_0xf223('0x3f')]=qs[_0xf223('0x40')](_0x36fea8[_0xf223('0x39')][_0xf223('0x40')]);_0x2bfc3e[_0xf223('0x41')]=qs[_0xf223('0x42')](_['pick'](_0x36fea8['query'],_0x28f92a[_0xf223('0x42')]),_0x1fd24f);if(_0x36fea8[_0xf223('0x39')]['filter']){_0x2bfc3e[_0xf223('0x41')]=_[_0xf223('0x43')](_0x2bfc3e[_0xf223('0x41')],{'$or':_[_0xf223('0x32')](_0x1fd24f,function(_0x2aaec6){if(_0x2aaec6[_0xf223('0x44')]!=='VIRTUAL'){var _0x178697={};_0x178697[_0x2aaec6[_0xf223('0x36')]]={'$like':'%'+_0x36fea8[_0xf223('0x39')][_0xf223('0x45')]+'%'};return _0x178697;}})});}_0x2bfc3e=_[_0xf223('0x43')]({},_0x2bfc3e,_0x36fea8[_0xf223('0x46')]);var _0x17a2d8={'where':_0x2bfc3e[_0xf223('0x41')]};return db[_0xf223('0x47')][_0xf223('0x23')](_0x17a2d8)[_0xf223('0x29')](function(_0x1b60ab){_0x359a97[_0xf223('0x23')]=_0x1b60ab;if(_0x36fea8[_0xf223('0x39')][_0xf223('0x48')]){_0x2bfc3e[_0xf223('0x49')]=[{'all':!![]}];}return db['AnalyticCustomReport'][_0xf223('0x4a')](_0x2bfc3e);})[_0xf223('0x29')](function(_0x18ed8c){_0x359a97[_0xf223('0x4b')]=_0x18ed8c;return _0x359a97;})[_0xf223('0x29')](respondWithFilteredResult(_0x419a8b,_0x2bfc3e))[_0xf223('0x4c')](handleError(_0x419a8b,null));};exports[_0xf223('0x4d')]=function(_0x3feded,_0x2a28bb){var _0x34a78b={'raw':![],'where':{'id':_0x3feded[_0xf223('0x4e')]['id']}},_0x4bf1fb={};_0x4bf1fb[_0xf223('0x35')]=_[_0xf223('0x37')](db[_0xf223('0x47')][_0xf223('0x4f')]);_0x4bf1fb[_0xf223('0x39')]=_['keys'](_0x3feded[_0xf223('0x39')]);_0x4bf1fb[_0xf223('0x42')]=_[_0xf223('0x38')](_0x4bf1fb[_0xf223('0x35')],_0x4bf1fb[_0xf223('0x39')]);_0x34a78b['attributes']=_[_0xf223('0x38')](_0x4bf1fb[_0xf223('0x35')],qs[_0xf223('0x3b')](_0x3feded[_0xf223('0x39')][_0xf223('0x3b')]));_0x34a78b['attributes']=_0x34a78b[_0xf223('0x3a')][_0xf223('0x3c')]?_0x34a78b[_0xf223('0x3a')]:_0x4bf1fb[_0xf223('0x35')];if(_0x3feded[_0xf223('0x39')]['includeAll']){_0x34a78b[_0xf223('0x49')]=[{'all':!![]}];}_0x34a78b=_[_0xf223('0x43')]({},_0x34a78b,_0x3feded[_0xf223('0x46')]);return db[_0xf223('0x47')][_0xf223('0x50')](_0x34a78b)[_0xf223('0x29')](handleEntityNotFound(_0x2a28bb,null))[_0xf223('0x29')](respondWithResult(_0x2a28bb,null))[_0xf223('0x4c')](handleError(_0x2a28bb,null));};exports[_0xf223('0x51')]=function(_0x11a226,_0x33c5c4){return db[_0xf223('0x47')]['create'](_0x11a226['body'],{})['then'](function(_0x4767b4){var _0x1ce691=_0x11a226[_0xf223('0x52')]['get']({'plain':!![]});if(!_0x1ce691)throw new Error(_0xf223('0x53'));if(_0x1ce691[_0xf223('0x54')]===_0xf223('0x52')){var _0x34516d=_0x4767b4[_0xf223('0x2b')]({'plain':!![]});var _0x9899=_0xf223('0x55');return db[_0xf223('0x56')]['find']({'where':{'name':_0x9899,'userProfileId':_0x1ce691[_0xf223('0x57')]},'raw':!![]})[_0xf223('0x29')](function(_0x2f2e5a){if(_0x2f2e5a&&_0x2f2e5a[_0xf223('0x58')]===0x0){return db[_0xf223('0x2d')][_0xf223('0x51')]({'name':_0x34516d['name'],'resourceId':_0x34516d['id'],'type':_0xf223('0x2c'),'sectionId':_0x2f2e5a['id']},{})[_0xf223('0x29')](function(){return _0x4767b4;});}else{return _0x4767b4;}})['catch'](function(_0xfe2ef1){logger[_0xf223('0x2f')](_0xf223('0x59'),_0xfe2ef1);throw _0xfe2ef1;});}return _0x4767b4;})[_0xf223('0x29')](respondWithResult(_0x33c5c4,0xc9))[_0xf223('0x4c')](handleError(_0x33c5c4,null));};exports[_0xf223('0x28')]=function(_0x50c2c4,_0x343f9c){if(_0x50c2c4[_0xf223('0x5a')]['id']){delete _0x50c2c4[_0xf223('0x5a')]['id'];}return db['AnalyticCustomReport'][_0xf223('0x50')]({'where':{'id':_0x50c2c4['params']['id']}})[_0xf223('0x29')](handleEntityNotFound(_0x343f9c,null))[_0xf223('0x29')](saveUpdates(_0x50c2c4['body'],null))[_0xf223('0x29')](respondWithResult(_0x343f9c,null))['catch'](handleError(_0x343f9c,null));};exports['destroy']=function(_0x20712d,_0x148225){return db[_0xf223('0x47')]['find']({'where':{'id':_0x20712d[_0xf223('0x4e')]['id']}})['then'](handleEntityNotFound(_0x148225,null))[_0xf223('0x29')](removeEntity(_0x148225,null))['catch'](handleError(_0x148225,null));};exports[_0xf223('0x5b')]=function(_0x5cbb32,_0x3fb8da){var _0x9504a4=0xa;var _0x32dad0=[_0xf223('0x5c'),_0xf223('0x5d'),_0xf223('0x5e'),_0xf223('0x5f')];var _0x4b8028={'SUM':_0xf223('0x60'),'COUNT':_0xf223('0x61'),'COUNT DISTINCT':_0xf223('0x62'),'MAX':_0xf223('0x63'),'MIN':_0xf223('0x64'),'AVG':_0xf223('0x65'),'GROUP_CONCAT':_0xf223('0x66'),'GROUP_CONCAT ASC':_0xf223('0x67'),'GROUP_CONCAT DESC':_0xf223('0x68')};var _0x1b01b8={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xf223('0x69'),'HOUR':'HOUR(%s)','ROUND':_0xf223('0x6a'),'UNIX_TIMESTAMP':_0xf223('0x6b')};var _0x1f2ac2=function(_0x58b37d){return!_[_0xf223('0x6c')]([_0xf223('0x6d'),_0xf223('0x6e'),'IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0x58b37d);};var _0x1fbc7c=function(_0x358146){if(!_0x358146||!_0x358146[_0xf223('0x6f')][_0xf223('0x3c')]){return'';}for(var _0x1f2a16='(',_0x59e604=0x0;_0x59e604<_0x358146[_0xf223('0x6f')]['length'];_0x59e604+=0x1){_0x59e604>0x0&&(_0x1f2a16+='\x20'+_0x358146['operator']+'\x20');_0x1f2a16+=_0x358146[_0xf223('0x6f')][_0x59e604][_0xf223('0x70')]?_0x1fbc7c(_0x358146[_0xf223('0x6f')][_0x59e604][_0xf223('0x70')]):_0x358146['rules'][_0x59e604]['field']+'\x20'+_0x358146[_0xf223('0x6f')][_0x59e604]['condition']+(_0x1f2ac2(_0x358146['rules'][_0x59e604]['condition'])?'\x20'+_0x358146[_0xf223('0x6f')][_0x59e604][_0xf223('0x71')]:'');}return _0x1f2a16+')';};var _0x366732={'where':{'id':_0x5cbb32[_0xf223('0x4e')]['id']}},_0x151bb8,_0x856813,_0x1a7fe9,_0x11d401,_0xf0ea6a;_0x366732=_[_0xf223('0x43')]({},_0x366732,_0x5cbb32[_0xf223('0x46')]);return db['AnalyticCustomReport']['find'](_0x366732)[_0xf223('0x29')](function(_0x26baa2){if(_0x26baa2){_0x151bb8=_0x26baa2;return _0x26baa2[_0xf223('0x72')]();}return null;})[_0xf223('0x29')](function(_0x3c49f3){if(_0x3c49f3){if(!_0x3c49f3[_0xf223('0x3c')]){throw new db[(_0xf223('0x73'))][(_0xf223('0x74'))](_0xf223('0x75'),0x193);}_0x856813=_0x3c49f3;return db[_0xf223('0x76')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x46915f){if(_0x46915f){_0x1a7fe9=_['keyBy'](_0x46915f,'id');var _0x2f6ce9;var _0x1e91c2=squel['select']();_0x1e91c2[_0xf223('0x77')](_0x151bb8[_0xf223('0x78')]);for(var _0x4a1bfc=0x0;_0x4a1bfc<_0x856813['length'];_0x4a1bfc+=0x1){_0x2f6ce9=_0x856813[_0x4a1bfc]['MetricId']?_0x1a7fe9[_0x856813[_0x4a1bfc][_0xf223('0x79')]][_0xf223('0x7a')]:_0x856813[_0x4a1bfc]['field'];_0x2f6ce9=_0x856813[_0x4a1bfc][_0xf223('0x7b')]?_[_0xf223('0x7c')](_0x4b8028[_0x856813[_0x4a1bfc][_0xf223('0x7b')]],'%s',_0x2f6ce9):_0x2f6ce9;_0x2f6ce9=_0x856813[_0x4a1bfc]['format']?_[_0xf223('0x7c')](_0x1b01b8[_0x856813[_0x4a1bfc][_0xf223('0x7d')]],'%s',_0x2f6ce9):_0x2f6ce9;if(_0x856813[_0x4a1bfc][_0xf223('0x7e')]){_0x1e91c2['group'](_0x2f6ce9);}_0x856813[_0x4a1bfc][_0xf223('0x7f')]&&_0x1e91c2['order'](_0x2f6ce9,_0x856813[_0x4a1bfc][_0xf223('0x7f')]===_0xf223('0x80')?![]:!![]);_0x1e91c2['field'](_0x2f6ce9,_0x856813[_0x4a1bfc][_0xf223('0x81')]||_0x2f6ce9);}if(_0x151bb8[_0xf223('0x82')]){_0x151bb8['joins']=JSON[_0xf223('0x83')](_0x151bb8['joins']);for(var _0x37a76b=0x0;_0x37a76b<_0x151bb8[_0xf223('0x82')][_0xf223('0x3c')];_0x37a76b+=0x1){if(_0x151bb8[_0xf223('0x82')][_0x37a76b][_0xf223('0x44')]&&_[_0xf223('0x6c')](_0x32dad0,_0x151bb8['joins'][_0x37a76b]['type'])&&_0x151bb8[_0xf223('0x82')][_0x37a76b]['parentKey']&&_0x151bb8['joins'][_0x37a76b]['foreignTable']&&_0x151bb8[_0xf223('0x82')][_0x37a76b][_0xf223('0x84')]){_0x1e91c2[_0x151bb8[_0xf223('0x82')][_0x37a76b]['type']](_0x151bb8[_0xf223('0x82')][_0x37a76b][_0xf223('0x85')],null,util[_0xf223('0x7d')](_0xf223('0x86'),_0x151bb8[_0xf223('0x78')],_0x151bb8['joins'][_0x37a76b][_0xf223('0x87')],_0x151bb8['joins'][_0x37a76b][_0xf223('0x85')],_0x151bb8['joins'][_0x37a76b][_0xf223('0x84')]));}}}if(_0x151bb8[_0xf223('0x88')]){_0x151bb8[_0xf223('0x88')]=JSON[_0xf223('0x83')](_0x151bb8['conditions']);_0x1e91c2[_0xf223('0x41')](_0x1fbc7c(_0x151bb8[_0xf223('0x88')]['group']));}_0xf0ea6a=_0x1e91c2[_0xf223('0x89')]();_0x1e91c2[_0xf223('0x22')](_0x9504a4);_0x1e91c2['offset'](0x0);logger[_0xf223('0x8a')](_0xf223('0x8b'),_0x1e91c2[_0xf223('0x8c')]());return dbH['sequelize']['query'](_0x1e91c2[_0xf223('0x8c')](),{'type':dbH[_0xf223('0x8d')]['QueryTypes'][_0xf223('0x8e')]});}})[_0xf223('0x29')](respondWithResult(_0x3fb8da,null))[_0xf223('0x4c')](handleError(_0x3fb8da,null));};function runReport(_0x42959e,_0x2054e7,_0x5d0cd9){var _0x4c593e=_0x2054e7[_0xf223('0x36')];var _0x4c32a5=0xa;var _0x405ca1=[_0xf223('0x5c'),_0xf223('0x5d'),_0xf223('0x5e'),_0xf223('0x5f')];var _0x51181e={'SUM':_0xf223('0x60'),'COUNT':_0xf223('0x61'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0xf223('0x64'),'AVG':_0xf223('0x65'),'GROUP_CONCAT':_0xf223('0x66'),'GROUP_CONCAT ASC':_0xf223('0x67'),'GROUP_CONCAT DESC':_0xf223('0x68')};var _0x37ae7a={'SEC_TO_TIME':_0xf223('0x8f'),'DATE':_0xf223('0x69'),'HOUR':'HOUR(%s)','ROUND':_0xf223('0x6a'),'UNIX_TIMESTAMP':_0xf223('0x6b')};var _0x5a25d5=function(_0x3afd69){return!_[_0xf223('0x6c')](['IS\x20NULL',_0xf223('0x6e'),_0xf223('0x90'),_0xf223('0x91')],_0x3afd69);};var _0x40596a=function(_0x36eebd){if(!_0x36eebd||!_0x36eebd[_0xf223('0x6f')][_0xf223('0x3c')]){return'';}for(var _0x10d0da='(',_0x2fc469=0x0;_0x2fc469<_0x36eebd[_0xf223('0x6f')][_0xf223('0x3c')];_0x2fc469+=0x1){_0x2fc469>0x0&&(_0x10d0da+='\x20'+_0x36eebd[_0xf223('0x92')]+'\x20');_0x10d0da+=_0x36eebd['rules'][_0x2fc469]['group']?_0x40596a(_0x36eebd[_0xf223('0x6f')][_0x2fc469][_0xf223('0x70')]):_0x36eebd[_0xf223('0x6f')][_0x2fc469][_0xf223('0x93')]+'\x20'+_0x36eebd['rules'][_0x2fc469][_0xf223('0x94')]+(_0x5a25d5(_0x36eebd[_0xf223('0x6f')][_0x2fc469][_0xf223('0x94')])?'\x20'+_0x36eebd['rules'][_0x2fc469][_0xf223('0x71')]:'');}return _0x10d0da+')';};var _0x49f367={'where':{'id':_0x42959e['id']}},_0x560dda,_0x40ac3e,_0x3d4df7,_0x32c20e,_0xed80bf;_0x49f367=_[_0xf223('0x43')]({},_0x49f367,_0x5d0cd9);return db['AnalyticCustomReport'][_0xf223('0x50')](_0x49f367)['then'](function(_0x1c3679){if(_0x1c3679){_0x560dda=_0x1c3679;return _0x1c3679[_0xf223('0x72')]();}return null;})[_0xf223('0x29')](function(_0x1411ef){if(_0x1411ef){if(!_0x1411ef[_0xf223('0x3c')]){throw new db[(_0xf223('0x73'))][(_0xf223('0x74'))](_0xf223('0x75'),0x193);}_0x40ac3e=_0x1411ef;return db[_0xf223('0x76')]['findAll']({'raw':!![]});}return null;})[_0xf223('0x29')](function(_0x56ff91){if(_0x56ff91){_0x3d4df7=_['keyBy'](_0x56ff91,'id');var _0x5dcf37;var _0x1ce72b=squel[_0xf223('0x95')]();_0x1ce72b['from'](_0x560dda[_0xf223('0x78')]);for(var _0x5a0ed0=0x0;_0x5a0ed0<_0x40ac3e[_0xf223('0x3c')];_0x5a0ed0+=0x1){_0x5dcf37=_0x40ac3e[_0x5a0ed0][_0xf223('0x79')]?_0x3d4df7[_0x40ac3e[_0x5a0ed0]['MetricId']]['metric']:_0x40ac3e[_0x5a0ed0]['field'];_0x5dcf37=_0x40ac3e[_0x5a0ed0][_0xf223('0x7b')]?_['replace'](_0x51181e[_0x40ac3e[_0x5a0ed0][_0xf223('0x7b')]],'%s',_0x5dcf37):_0x5dcf37;_0x5dcf37=_0x40ac3e[_0x5a0ed0][_0xf223('0x7d')]?_[_0xf223('0x7c')](_0x37ae7a[_0x40ac3e[_0x5a0ed0][_0xf223('0x7d')]],'%s',_0x5dcf37):_0x5dcf37;if(_0x40ac3e[_0x5a0ed0][_0xf223('0x7e')]){_0x1ce72b['group'](_0x5dcf37);}_0x40ac3e[_0x5a0ed0][_0xf223('0x7f')]&&_0x1ce72b[_0xf223('0x3f')](_0x5dcf37,_0x40ac3e[_0x5a0ed0]['orderBy']===_0xf223('0x80')?![]:!![]);_0x1ce72b[_0xf223('0x93')](_0x5dcf37,_0x40ac3e[_0x5a0ed0]['alias']||_0x5dcf37);}if(_0x560dda['joins']){_0x560dda[_0xf223('0x82')]=JSON[_0xf223('0x83')](_0x560dda[_0xf223('0x82')]);for(var _0x3791ec=0x0;_0x3791ec<_0x560dda[_0xf223('0x82')][_0xf223('0x3c')];_0x3791ec+=0x1){if(_0x560dda[_0xf223('0x82')][_0x3791ec][_0xf223('0x44')]&&_[_0xf223('0x6c')](_0x405ca1,_0x560dda[_0xf223('0x82')][_0x3791ec]['type'])&&_0x560dda[_0xf223('0x82')][_0x3791ec][_0xf223('0x87')]&&_0x560dda[_0xf223('0x82')][_0x3791ec][_0xf223('0x85')]&&_0x560dda[_0xf223('0x82')][_0x3791ec][_0xf223('0x84')]){_0x1ce72b[_0x560dda['joins'][_0x3791ec][_0xf223('0x44')]](_0x560dda['joins'][_0x3791ec][_0xf223('0x85')],null,util[_0xf223('0x7d')](_0xf223('0x86'),_0x560dda['table'],_0x560dda[_0xf223('0x82')][_0x3791ec][_0xf223('0x87')],_0x560dda['joins'][_0x3791ec]['foreignTable'],_0x560dda[_0xf223('0x82')][_0x3791ec][_0xf223('0x84')]));}}}if(_0x560dda[_0xf223('0x88')]){_0x560dda[_0xf223('0x88')]=JSON['parse'](_0x560dda[_0xf223('0x88')]);_0x1ce72b[_0xf223('0x41')](_0x40596a(_0x560dda['conditions'][_0xf223('0x70')]));}_0xed80bf=_0x1ce72b[_0xf223('0x89')]();_0x1ce72b[_0xf223('0x22')](_0x4c32a5);_0x1ce72b[_0xf223('0x20')](0x0);return;}})[_0xf223('0x29')](function(){if(_0x2054e7['output']===_0xf223('0x96')){return null;}var _0x7266f9=_[_0xf223('0x43')](_0x2054e7,{'name':_0x2054e7['fullPath']||_0x2054e7['name']||_0x560dda[_0xf223('0x36')],'basename':_0x4c593e,'savename':util[_0xf223('0x7d')](_0xf223('0x97'),_0x2054e7[_0xf223('0x36')]||_0x560dda['name'],require(_0xf223('0x98'))['generate'](0x4),_0x2054e7[_0xf223('0x99')]||_0xf223('0x9a')),'reportId':_0x560dda['id'],'reportType':_0xf223('0x9b')});return db[_0xf223('0x9c')]['create'](_0x7266f9,{'raw':!![]});})[_0xf223('0x29')](function(_0xc78898){if(_0x560dda[_0xf223('0x78')]==='cdr'){_0xed80bf[_0xf223('0x41')](_0x560dda[_0xf223('0x78')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x2054e7[_0xf223('0x9d')],_0x2054e7[_0xf223('0x9e')]);}else{_0xed80bf[_0xf223('0x41')](_0x560dda['table']+_0xf223('0x9f'),_0x2054e7[_0xf223('0x9d')],_0x2054e7[_0xf223('0x9e')]);}if(_0xc78898){logger[_0xf223('0xa0')]('Run\x20Query:',_0xed80bf[_0xf223('0x8c')]());require(_0xf223('0xa1'))[_0xf223('0xa2')](path[_0xf223('0x5c')](__dirname,_0xf223('0xa3'),_0xc78898[_0xf223('0x99')]),[_0xc78898['id'],_0xed80bf[_0xf223('0x8c')](),path[_0xf223('0x5c')](__dirname,_0xf223('0xa4'),_0xc78898[_0xf223('0xa5')]),_0x4c593e]);return _0xc78898;}else{var _0x500e42=squel['select']();_0x500e42[_0xf223('0x77')]('('+_0xed80bf['toString']()+')','countTable');_0x500e42[_0xf223('0x93')]('COUNT(*)','count');_0xed80bf[_0xf223('0x22')](_0x2054e7[_0xf223('0x22')]||_0x4c32a5);_0xed80bf['offset'](_0x2054e7[_0xf223('0x20')]||0x0);return dbH[_0xf223('0x8d')][_0xf223('0x39')](_0x500e42[_0xf223('0x8c')](),{'type':dbH[_0xf223('0x8d')][_0xf223('0xa6')]['SELECT']})[_0xf223('0x29')](function(_0x2ef023){if(!_0x2ef023[_0xf223('0x3c')]){_0x32c20e=0x0;}else{_0x32c20e=_0x2ef023[0x0]['count']||0x0;}return dbH[_0xf223('0x8d')][_0xf223('0x39')](_0xed80bf[_0xf223('0x8c')](),{'type':dbH[_0xf223('0x8d')][_0xf223('0xa6')]['SELECT']});})[_0xf223('0x29')](function(_0xe92b88){return{'rows':_0xe92b88||[],'count':_0x32c20e};});}});}exports[_0xf223('0xa7')]=function(_0x3c62b3,_0x4e3adf){return runReport(_0x3c62b3[_0xf223('0x4e')],_0x3c62b3[_0xf223('0x39')],_0x3c62b3[_0xf223('0x46')])['then'](respondWithResult(_0x4e3adf,null))[_0xf223('0x4c')](handleError(_0x4e3adf,null));};exports[_0xf223('0xa8')]=runReport;exports['query']=function(_0x15ee3f,_0x372d09){var _0x36bbd6=0xa;var _0x192a5f=[_0xf223('0x5c'),'left_join','right_join',_0xf223('0x5f')];var _0x2e7ab6={'SUM':'SUM(%s)','COUNT':_0xf223('0x61'),'COUNT DISTINCT':_0xf223('0x62'),'MAX':_0xf223('0x63'),'MIN':'MIN(%s)','AVG':_0xf223('0x65'),'GROUP_CONCAT':_0xf223('0x66'),'GROUP_CONCAT ASC':_0xf223('0x67'),'GROUP_CONCAT DESC':_0xf223('0x68')};var _0x59133b={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0xf223('0xa9'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xf223('0x6b')};var _0x37ffbb=function(_0x5ca33e){return!_['includes'](['IS\x20NULL',_0xf223('0x6e'),_0xf223('0x90'),_0xf223('0x91')],_0x5ca33e);};var _0x3851f2=function(_0x3feaa2){if(!_0x3feaa2||!_0x3feaa2['rules'][_0xf223('0x3c')]){return'';}for(var _0x622c84='(',_0x26b199=0x0;_0x26b199<_0x3feaa2['rules']['length'];_0x26b199+=0x1){_0x26b199>0x0&&(_0x622c84+='\x20'+_0x3feaa2['operator']+'\x20');_0x622c84+=_0x3feaa2[_0xf223('0x6f')][_0x26b199][_0xf223('0x70')]?_0x3851f2(_0x3feaa2['rules'][_0x26b199][_0xf223('0x70')]):_0x3feaa2[_0xf223('0x6f')][_0x26b199]['field']+'\x20'+_0x3feaa2[_0xf223('0x6f')][_0x26b199]['condition']+(_0x37ffbb(_0x3feaa2[_0xf223('0x6f')][_0x26b199][_0xf223('0x94')])?'\x20'+_0x3feaa2[_0xf223('0x6f')][_0x26b199][_0xf223('0x71')]:'');}return _0x622c84+')';};var _0x43ad65={'where':{'id':_0x15ee3f['params']['id']}},_0x142d5c,_0x5b37bf,_0x3efc1a,_0x269ce4,_0x3812d9;_0x43ad65=_[_0xf223('0x43')]({},_0x43ad65,_0x15ee3f['options']);return db[_0xf223('0x47')][_0xf223('0x50')](_0x43ad65)[_0xf223('0x29')](function(_0x4cdc84){if(_0x4cdc84){_0x142d5c=_0x4cdc84;return _0x4cdc84['getFields']();}return null;})[_0xf223('0x29')](function(_0x113610){if(_0x113610){if(!_0x113610[_0xf223('0x3c')]){throw new db[(_0xf223('0x73'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x5b37bf=_0x113610;return db['AnalyticMetric'][_0xf223('0x4a')]({'raw':!![]});}return null;})['then'](function(_0x586251){if(_0x586251){_0x3efc1a=_[_0xf223('0xaa')](_0x586251,'id');var _0xfca25b;var _0x5eccdd=squel[_0xf223('0x95')]();_0x5eccdd[_0xf223('0x77')](_0x142d5c[_0xf223('0x78')]);for(var _0x3e81f0=0x0;_0x3e81f0<_0x5b37bf[_0xf223('0x3c')];_0x3e81f0+=0x1){_0xfca25b=_0x5b37bf[_0x3e81f0]['MetricId']?_0x3efc1a[_0x5b37bf[_0x3e81f0]['MetricId']]['metric']:_0x5b37bf[_0x3e81f0][_0xf223('0x93')];_0xfca25b=_0x5b37bf[_0x3e81f0][_0xf223('0x7b')]?_[_0xf223('0x7c')](_0x2e7ab6[_0x5b37bf[_0x3e81f0][_0xf223('0x7b')]],'%s',_0xfca25b):_0xfca25b;_0xfca25b=_0x5b37bf[_0x3e81f0][_0xf223('0x7d')]?_[_0xf223('0x7c')](_0x59133b[_0x5b37bf[_0x3e81f0][_0xf223('0x7d')]],'%s',_0xfca25b):_0xfca25b;if(_0x5b37bf[_0x3e81f0]['groupBy']){_0x5eccdd[_0xf223('0x70')](_0xfca25b);}_0x5b37bf[_0x3e81f0][_0xf223('0x7f')]&&_0x5eccdd[_0xf223('0x3f')](_0xfca25b,_0x5b37bf[_0x3e81f0][_0xf223('0x7f')]===_0xf223('0x80')?![]:!![]);_0x5eccdd[_0xf223('0x93')](_0xfca25b,_0x5b37bf[_0x3e81f0][_0xf223('0x81')]||_0xfca25b);}if(_0x142d5c[_0xf223('0x82')]){_0x142d5c['joins']=JSON[_0xf223('0x83')](_0x142d5c[_0xf223('0x82')]);for(var _0x15ba50=0x0;_0x15ba50<_0x142d5c[_0xf223('0x82')][_0xf223('0x3c')];_0x15ba50+=0x1){if(_0x142d5c[_0xf223('0x82')][_0x15ba50][_0xf223('0x44')]&&_['includes'](_0x192a5f,_0x142d5c[_0xf223('0x82')][_0x15ba50][_0xf223('0x44')])&&_0x142d5c[_0xf223('0x82')][_0x15ba50][_0xf223('0x87')]&&_0x142d5c['joins'][_0x15ba50][_0xf223('0x85')]&&_0x142d5c['joins'][_0x15ba50][_0xf223('0x84')]){_0x5eccdd[_0x142d5c['joins'][_0x15ba50][_0xf223('0x44')]](_0x142d5c['joins'][_0x15ba50][_0xf223('0x85')],null,util['format'](_0xf223('0x86'),_0x142d5c[_0xf223('0x78')],_0x142d5c[_0xf223('0x82')][_0x15ba50]['parentKey'],_0x142d5c[_0xf223('0x82')][_0x15ba50][_0xf223('0x85')],_0x142d5c[_0xf223('0x82')][_0x15ba50][_0xf223('0x84')]));}}}if(_0x142d5c[_0xf223('0x88')]){_0x142d5c[_0xf223('0x88')]=JSON[_0xf223('0x83')](_0x142d5c[_0xf223('0x88')]);_0x5eccdd[_0xf223('0x41')](_0x3851f2(_0x142d5c[_0xf223('0x88')][_0xf223('0x70')]));}_0x3812d9=_0x5eccdd[_0xf223('0x89')]();_0x5eccdd[_0xf223('0x22')](_0x36bbd6);_0x5eccdd[_0xf223('0x20')](0x0);logger[_0xf223('0x8a')]('Limited\x20Query:',_0x5eccdd[_0xf223('0x8c')]());return dbH[_0xf223('0x8d')]['query'](_0x5eccdd['toString'](),{'type':dbH[_0xf223('0x8d')][_0xf223('0xa6')][_0xf223('0x8e')]});}})[_0xf223('0x29')](function(){return{'sql':_0x3812d9['toString']()};})[_0xf223('0x29')](respondWithResult(_0x372d09,null))[_0xf223('0x4c')](handleError(_0x372d09,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index b8e8939..f0c8bb6 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 _0x5636=['./analyticCustomReport.attributes','define','AnalyticCustomReport','analytics_custom_reports','lodash','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x18be7e,_0x32fd6c){var _0x44139b=function(_0x219c43){while(--_0x219c43){_0x18be7e['push'](_0x18be7e['shift']());}};_0x44139b(++_0x32fd6c);}(_0x5636,0x17a));var _0x6563=function(_0x13416e,_0x5ced5b){_0x13416e=_0x13416e-0x0;var _0x4b0747=_0x5636[_0x13416e];return _0x4b0747;};'use strict';var _=require(_0x6563('0x0'));var util=require('util');var logger=require(_0x6563('0x1'))(_0x6563('0x2'));var moment=require(_0x6563('0x3'));var BPromise=require(_0x6563('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6563('0x5'));var rimraf=require(_0x6563('0x6'));var config=require('../../config/environment');var attributes=require(_0x6563('0x7'));module['exports']=function(_0x472079,_0x9b4c65){return _0x472079[_0x6563('0x8')](_0x6563('0x9'),attributes,{'tableName':_0x6563('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x28a9=['define','AnalyticCustomReport','analytics_custom_reports','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./analyticCustomReport.attributes','exports'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x28a9,0x18f));var _0x928a=function(_0x401274,_0x3490f2){_0x401274=_0x401274-0x0;var _0x195f0b=_0x28a9[_0x401274];return _0x195f0b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x928a('0x0'))(_0x928a('0x1'));var moment=require('moment');var BPromise=require(_0x928a('0x2'));var rp=require(_0x928a('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x928a('0x4'));var config=require(_0x928a('0x5'));var attributes=require(_0x928a('0x6'));module[_0x928a('0x7')]=function(_0x2ce098,_0x2d81e0){return _0x2ce098[_0x928a('0x8')](_0x928a('0x9'),attributes,{'tableName':_0x928a('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 2933714..defd7e8 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 _0xb4a6=['debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','lodash','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','AnalyticCustomReport,\x20%s,\x20%s'];(function(_0x363d1c,_0x5b5fd4){var _0x5e6ba3=function(_0x4c6988){while(--_0x4c6988){_0x363d1c['push'](_0x363d1c['shift']());}};_0x5e6ba3(++_0x5b5fd4);}(_0xb4a6,0x11f));var _0x6b4a=function(_0x5b29f7,_0x335b71){_0x5b29f7=_0x5b29f7-0x0;var _0x47d235=_0xb4a6[_0x5b29f7];return _0x47d235;};'use strict';var _=require(_0x6b4a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x6b4a('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6b4a('0x2'));var db=require(_0x6b4a('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x6b4a('0x4'))(_0x6b4a('0x5'));var config=require(_0x6b4a('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x6b4a('0x7')][_0x6b4a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x55b61b,_0x550d0f,_0x544353){return new BPromise(function(_0x43f204,_0x32d1b4){return client[_0x6b4a('0x9')](_0x55b61b,_0x544353)[_0x6b4a('0xa')](function(_0x3fb76f){logger[_0x6b4a('0xb')](_0x6b4a('0xc'),_0x550d0f,'request\x20sent');logger[_0x6b4a('0xd')](_0x6b4a('0xe'),_0x550d0f,'request\x20sent',JSON[_0x6b4a('0xf')](_0x3fb76f));if(_0x3fb76f[_0x6b4a('0x10')]){if(_0x3fb76f[_0x6b4a('0x10')]['code']===0x1f4){logger[_0x6b4a('0x10')]('AnalyticCustomReport,\x20%s,\x20%s',_0x550d0f,_0x3fb76f['error'][_0x6b4a('0x11')]);return _0x32d1b4(_0x3fb76f[_0x6b4a('0x10')][_0x6b4a('0x11')]);}logger[_0x6b4a('0x10')]('AnalyticCustomReport,\x20%s,\x20%s',_0x550d0f,_0x3fb76f[_0x6b4a('0x10')]['message']);return _0x43f204(_0x3fb76f[_0x6b4a('0x10')][_0x6b4a('0x11')]);}else{logger['info'](_0x6b4a('0xc'),_0x550d0f,_0x6b4a('0x12'));_0x43f204(_0x3fb76f[_0x6b4a('0x13')][_0x6b4a('0x11')]);}})['catch'](function(_0x4d6771){logger['error'](_0x6b4a('0xc'),_0x550d0f,_0x4d6771);_0x32d1b4(_0x4d6771);});});} \ No newline at end of file +var _0x609b=['request','then','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','error','message','info','result','catch','util','moment','randomstring','../../config/utils','rpc','../../config/environment','client','http'];(function(_0xbf1875,_0x34b144){var _0x2e598b=function(_0xd104ec){while(--_0xd104ec){_0xbf1875['push'](_0xbf1875['shift']());}};_0x2e598b(++_0x34b144);}(_0x609b,0xf4));var _0xb609=function(_0x3df17b,_0x471504){_0x3df17b=_0x3df17b-0x0;var _0x2a66cd=_0x609b[_0x3df17b];return _0x2a66cd;};'use strict';var _=require('lodash');var util=require(_0xb609('0x0'));var moment=require(_0xb609('0x1'));var BPromise=require('bluebird');var rs=require(_0xb609('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb609('0x3'));var logger=require('../../config/logger')(_0xb609('0x4'));var config=require(_0xb609('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xb609('0x6')][_0xb609('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1546ad,_0x12a9af,_0x49719a){return new BPromise(function(_0x3f0565,_0x343606){return client[_0xb609('0x8')](_0x1546ad,_0x49719a)[_0xb609('0x9')](function(_0x45f342){logger['info'](_0xb609('0xa'),_0x12a9af,_0xb609('0xb'));logger[_0xb609('0xc')]('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x12a9af,_0xb609('0xb'),JSON['stringify'](_0x45f342));if(_0x45f342[_0xb609('0xd')]){if(_0x45f342['error']['code']===0x1f4){logger[_0xb609('0xd')]('AnalyticCustomReport,\x20%s,\x20%s',_0x12a9af,_0x45f342[_0xb609('0xd')][_0xb609('0xe')]);return _0x343606(_0x45f342[_0xb609('0xd')]['message']);}logger['error'](_0xb609('0xa'),_0x12a9af,_0x45f342[_0xb609('0xd')][_0xb609('0xe')]);return _0x3f0565(_0x45f342[_0xb609('0xd')][_0xb609('0xe')]);}else{logger[_0xb609('0xf')](_0xb609('0xa'),_0x12a9af,_0xb609('0xb'));_0x3f0565(_0x45f342[_0xb609('0x10')][_0xb609('0xe')]);}})[_0xb609('0x11')](function(_0x25e834){logger['error'](_0xb609('0xa'),_0x12a9af,_0x25e834);_0x343606(_0x25e834);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index ed81f57..2eef22b 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 _0x23be=['fs-extra','../../components/auth/service','../../config/environment','./analyticCustomReport.controller','isAuthenticated','get','/:id','show','/:id/preview','preview','/:id/run','run','/:id/query','query','post','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x23be,0xd2));var _0xe23b=function(_0x48baec,_0x5e0d23){_0x48baec=_0x48baec-0x0;var _0x32cee3=_0x23be[_0x48baec];return _0x32cee3;};'use strict';var multer=require(_0xe23b('0x0'));var util=require(_0xe23b('0x1'));var path=require(_0xe23b('0x2'));var timeout=require(_0xe23b('0x3'));var express=require(_0xe23b('0x4'));var router=express[_0xe23b('0x5')]();var fs_extra=require(_0xe23b('0x6'));var auth=require(_0xe23b('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xe23b('0x8'));var controller=require(_0xe23b('0x9'));router['get']('/',auth[_0xe23b('0xa')](),controller['index']);router[_0xe23b('0xb')](_0xe23b('0xc'),auth[_0xe23b('0xa')](),controller[_0xe23b('0xd')]);router['get'](_0xe23b('0xe'),auth[_0xe23b('0xa')](),controller[_0xe23b('0xf')]);router[_0xe23b('0xb')](_0xe23b('0x10'),auth['isAuthenticated'](),controller[_0xe23b('0x11')]);router[_0xe23b('0xb')](_0xe23b('0x12'),auth['isAuthenticated'](),controller[_0xe23b('0x13')]);router[_0xe23b('0x14')]('/',auth[_0xe23b('0xa')](),controller['create']);router['put'](_0xe23b('0xc'),auth[_0xe23b('0xa')](),controller['update']);router[_0xe23b('0x15')]('/:id',auth[_0xe23b('0xa')](),controller[_0xe23b('0x16')]);module[_0xe23b('0x17')]=router; \ No newline at end of file +var _0x3690=['multer','util','path','express','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','isAuthenticated','/:id','show','get','/:id/preview','/:id/run','/:id/query','query','post','put','update','delete','destroy','exports'];(function(_0xebb86a,_0x5c67db){var _0x2bf8ca=function(_0x29b2b2){while(--_0x29b2b2){_0xebb86a['push'](_0xebb86a['shift']());}};_0x2bf8ca(++_0x5c67db);}(_0x3690,0xbd));var _0x0369=function(_0x1cddc5,_0x1e81da){_0x1cddc5=_0x1cddc5-0x0;var _0x398df2=_0x3690[_0x1cddc5];return _0x398df2;};'use strict';var multer=require(_0x0369('0x0'));var util=require(_0x0369('0x1'));var path=require(_0x0369('0x2'));var timeout=require('connect-timeout');var express=require(_0x0369('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x0369('0x4'));var config=require(_0x0369('0x5'));var controller=require(_0x0369('0x6'));router['get']('/',auth[_0x0369('0x7')](),controller['index']);router['get'](_0x0369('0x8'),auth[_0x0369('0x7')](),controller[_0x0369('0x9')]);router[_0x0369('0xa')](_0x0369('0xb'),auth[_0x0369('0x7')](),controller['preview']);router[_0x0369('0xa')](_0x0369('0xc'),auth[_0x0369('0x7')](),controller['run']);router[_0x0369('0xa')](_0x0369('0xd'),auth[_0x0369('0x7')](),controller[_0x0369('0xe')]);router[_0x0369('0xf')]('/',auth[_0x0369('0x7')](),controller['create']);router[_0x0369('0x10')](_0x0369('0x8'),auth[_0x0369('0x7')](),controller[_0x0369('0x11')]);router[_0x0369('0x12')](_0x0369('0x8'),auth['isAuthenticated'](),controller[_0x0369('0x13')]);module[_0x0369('0x14')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 53e2fc6..c9da996 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 _0x2bd8=['TEXT','sequelize','STRING'];(function(_0x2cad1d,_0x95a8c7){var _0x4a900c=function(_0x4e5a6e){while(--_0x4e5a6e){_0x2cad1d['push'](_0x2cad1d['shift']());}};_0x4a900c(++_0x95a8c7);}(_0x2bd8,0x130));var _0x82bd=function(_0x5ae1bc,_0x157d82){_0x5ae1bc=_0x5ae1bc-0x0;var _0x44fb50=_0x2bd8[_0x5ae1bc];return _0x44fb50;};'use strict';var Sequelize=require(_0x82bd('0x0'));module['exports']={'name':{'type':Sequelize[_0x82bd('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x82bd('0x1')]},'parent':{'type':Sequelize[_0x82bd('0x1')]},'table':{'type':Sequelize[_0x82bd('0x1')]},'conditions':{'type':Sequelize[_0x82bd('0x2')]},'joins':{'type':Sequelize[_0x82bd('0x2')]}}; \ No newline at end of file +var _0x7fbe=['STRING','TEXT'];(function(_0x4e4f0e,_0x1c3892){var _0x1a7219=function(_0x3821ad){while(--_0x3821ad){_0x4e4f0e['push'](_0x4e4f0e['shift']());}};_0x1a7219(++_0x1c3892);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x221a6f,_0x1674c8){_0x221a6f=_0x221a6f-0x0;var _0x3db53d=_0x7fbe[_0x221a6f];return _0x3db53d;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xe7fb('0x0')],'allowNull':![]},'description':{'type':Sequelize[_0xe7fb('0x0')]},'parent':{'type':Sequelize[_0xe7fb('0x0')]},'table':{'type':Sequelize[_0xe7fb('0x0')]},'conditions':{'type':Sequelize[_0xe7fb('0x1')]},'joins':{'type':Sequelize[_0xe7fb('0x1')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index d3ee165..fa9a800 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 _0x1cb9=['runReport','left_join','SEC_TO_TIME(%s)','IS\x20NULL','clone','debug','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','json','offset','limit','undefined','count','status','set','apply','reject','then','destroy','get','UserProfileResource','stack','name','send','map','AnalyticDefaultReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','find','catch','body','user','role','autoAssociation','create','DefaultReports','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','preview','join','right_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','replace','format','orderBy','order','DESC','joins','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','parse','Limited\x20Query:','sequelize','toString','QueryTypes','SELECT','COUNT(%s)','GROUP_CONCAT(%s)','HOUR(%s)','value','groupBy','alias','output','fullPath','%s-%s.%s','randomstring','generate','csv','default','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)'];(function(_0x1448c4,_0x8610e1){var _0x45be8d=function(_0x29c5be){while(--_0x29c5be){_0x1448c4['push'](_0x1448c4['shift']());}};_0x45be8d(++_0x8610e1);}(_0x1cb9,0x14e));var _0x91cb=function(_0x304d3f,_0x25c427){_0x304d3f=_0x304d3f-0x0;var _0x38d41a=_0x1cb9[_0x304d3f];return _0x38d41a;};'use strict';var emlformat=require(_0x91cb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x91cb('0x1'));var jsonpatch=require(_0x91cb('0x2'));var rp=require(_0x91cb('0x3'));var moment=require(_0x91cb('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x91cb('0x5'));var util=require(_0x91cb('0x6'));var path=require('path');var sox=require(_0x91cb('0x7'));var csv=require(_0x91cb('0x8'));var ejs=require(_0x91cb('0x9'));var fs=require('fs');var fs_extra=require(_0x91cb('0xa'));var _=require(_0x91cb('0xb'));var squel=require(_0x91cb('0xc'));var crypto=require('crypto');var jsforce=require(_0x91cb('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x91cb('0x8'));var querystring=require('querystring');var Papa=require(_0x91cb('0xe'));var Redis=require(_0x91cb('0xf'));var authService=require(_0x91cb('0x10'));var qs=require(_0x91cb('0x11'));var as=require(_0x91cb('0x12'));var hardwareService=require(_0x91cb('0x13'));var logger=require(_0x91cb('0x14'))(_0x91cb('0x15'));var utils=require(_0x91cb('0x16'));var config=require(_0x91cb('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x91cb('0x18'))['db'];var dbH=require(_0x91cb('0x18'))['dbH'];function respondWithStatusCode(_0x20e6e0,_0x3ea707){_0x3ea707=_0x3ea707||0xcc;return function(_0x44f2e9){if(_0x44f2e9){return _0x20e6e0[_0x91cb('0x19')](_0x3ea707);}return _0x20e6e0['status'](_0x3ea707)['end']();};}function respondWithResult(_0x4aae25,_0x3d22b7){_0x3d22b7=_0x3d22b7||0xc8;return function(_0x585470){if(_0x585470){return _0x4aae25['status'](_0x3d22b7)[_0x91cb('0x1a')](_0x585470);}};}function respondWithFilteredResult(_0xc3629e,_0x347980){return function(_0x5ea796){if(_0x5ea796){var _0x238f11=typeof _0x347980[_0x91cb('0x1b')]==='undefined'&&typeof _0x347980[_0x91cb('0x1c')]===_0x91cb('0x1d');var _0x1cd34b=_0x5ea796[_0x91cb('0x1e')];var _0x5cc1c3=_0x238f11?0x0:_0x347980[_0x91cb('0x1b')];var _0x7dcf60=_0x238f11?_0x5ea796['count']:_0x347980[_0x91cb('0x1b')]+_0x347980['limit'];var _0x55042a;if(_0x7dcf60>=_0x1cd34b){_0x7dcf60=_0x1cd34b;_0x55042a=0xc8;}else{_0x55042a=0xce;}_0xc3629e[_0x91cb('0x1f')](_0x55042a);return _0xc3629e[_0x91cb('0x20')]('Content-Range',_0x5cc1c3+'-'+_0x7dcf60+'/'+_0x1cd34b)['json'](_0x5ea796);}return null;};}function patchUpdates(_0x5b385a){return function(_0x438162){try{jsonpatch[_0x91cb('0x21')](_0x438162,_0x5b385a,!![]);}catch(_0x20aff5){return BPromise[_0x91cb('0x22')](_0x20aff5);}return _0x438162['save']();};}function saveUpdates(_0x45c4b3,_0x43881c){return function(_0x1fa837){if(_0x1fa837){return _0x1fa837['update'](_0x45c4b3)[_0x91cb('0x23')](function(_0x1a7a54){return _0x1a7a54;});}return null;};}function removeEntity(_0x2447e7,_0x422d14){return function(_0x3ca500){if(_0x3ca500){return _0x3ca500[_0x91cb('0x24')]()[_0x91cb('0x23')](function(){var _0x423c4f=_0x3ca500[_0x91cb('0x25')]({'plain':!![]});var _0x4c8438='DefaultReports';return db[_0x91cb('0x26')]['destroy']({'where':{'type':_0x4c8438,'resourceId':_0x423c4f['id']}})[_0x91cb('0x23')](function(){return _0x3ca500;});})[_0x91cb('0x23')](function(){_0x2447e7[_0x91cb('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9b26a6,_0x4f5a7b){return function(_0x4572f6){if(!_0x4572f6){_0x9b26a6[_0x91cb('0x19')](0x194);}return _0x4572f6;};}function handleError(_0x3b3ee6,_0x2fb473){_0x2fb473=_0x2fb473||0x1f4;return function(_0x468908){logger['error'](_0x468908[_0x91cb('0x27')]);if(_0x468908['name']){delete _0x468908[_0x91cb('0x28')];}_0x3b3ee6[_0x91cb('0x1f')](_0x2fb473)[_0x91cb('0x29')](_0x468908);};}exports['index']=function(_0x775c25,_0x146e1f){var _0x25bbf9={},_0x361e4c={},_0xf296bc={'count':0x0,'rows':[]};var _0x3dab18=_[_0x91cb('0x2a')](db[_0x91cb('0x2b')][_0x91cb('0x2c')],function(_0x5e6ed3){return{'name':_0x5e6ed3[_0x91cb('0x2d')],'type':_0x5e6ed3[_0x91cb('0x2e')][_0x91cb('0x2f')]};});_0x361e4c[_0x91cb('0x30')]=_[_0x91cb('0x2a')](_0x3dab18,'name');_0x361e4c[_0x91cb('0x31')]=_[_0x91cb('0x32')](_0x775c25[_0x91cb('0x31')]);_0x361e4c[_0x91cb('0x33')]=_[_0x91cb('0x34')](_0x361e4c['model'],_0x361e4c[_0x91cb('0x31')]);_0x25bbf9['attributes']=_['intersection'](_0x361e4c['model'],qs[_0x91cb('0x35')](_0x775c25['query'][_0x91cb('0x35')]));_0x25bbf9['attributes']=_0x25bbf9['attributes'][_0x91cb('0x36')]?_0x25bbf9[_0x91cb('0x37')]:_0x361e4c[_0x91cb('0x30')];if(!_0x775c25[_0x91cb('0x31')][_0x91cb('0x38')]('nolimit')){_0x25bbf9[_0x91cb('0x1c')]=qs[_0x91cb('0x1c')](_0x775c25[_0x91cb('0x31')][_0x91cb('0x1c')]);_0x25bbf9['offset']=qs['offset'](_0x775c25[_0x91cb('0x31')][_0x91cb('0x1b')]);}_0x25bbf9['order']=qs[_0x91cb('0x39')](_0x775c25[_0x91cb('0x31')]['sort']);_0x25bbf9[_0x91cb('0x3a')]=qs[_0x91cb('0x33')](_['pick'](_0x775c25[_0x91cb('0x31')],_0x361e4c['filters']),_0x3dab18);if(_0x775c25[_0x91cb('0x31')][_0x91cb('0x3b')]){_0x25bbf9[_0x91cb('0x3a')]=_[_0x91cb('0x3c')](_0x25bbf9[_0x91cb('0x3a')],{'$or':_[_0x91cb('0x2a')](_0x3dab18,function(_0x5d0e37){if(_0x5d0e37[_0x91cb('0x2e')]!==_0x91cb('0x3d')){var _0x4e5b4b={};_0x4e5b4b[_0x5d0e37[_0x91cb('0x28')]]={'$like':'%'+_0x775c25['query'][_0x91cb('0x3b')]+'%'};return _0x4e5b4b;}})});}_0x25bbf9=_[_0x91cb('0x3c')]({},_0x25bbf9,_0x775c25[_0x91cb('0x3e')]);var _0x174794={'where':_0x25bbf9['where']};return db[_0x91cb('0x2b')][_0x91cb('0x1e')](_0x174794)[_0x91cb('0x23')](function(_0x37e777){_0xf296bc[_0x91cb('0x1e')]=_0x37e777;if(_0x775c25[_0x91cb('0x31')][_0x91cb('0x3f')]){_0x25bbf9[_0x91cb('0x40')]=[{'all':!![]}];}return db[_0x91cb('0x2b')][_0x91cb('0x41')](_0x25bbf9);})['then'](function(_0x16993f){_0xf296bc['rows']=_0x16993f;return _0xf296bc;})[_0x91cb('0x23')](respondWithFilteredResult(_0x146e1f,_0x25bbf9))['catch'](handleError(_0x146e1f,null));};exports[_0x91cb('0x42')]=function(_0x52e82c,_0x138f48){var _0x477131={'raw':!![],'where':{'id':_0x52e82c[_0x91cb('0x43')]['id']}},_0xba99ce={};_0xba99ce['model']=_[_0x91cb('0x32')](db[_0x91cb('0x2b')]['rawAttributes']);_0xba99ce[_0x91cb('0x31')]=_[_0x91cb('0x32')](_0x52e82c[_0x91cb('0x31')]);_0xba99ce[_0x91cb('0x33')]=_[_0x91cb('0x34')](_0xba99ce[_0x91cb('0x30')],_0xba99ce[_0x91cb('0x31')]);_0x477131[_0x91cb('0x37')]=_[_0x91cb('0x34')](_0xba99ce['model'],qs[_0x91cb('0x35')](_0x52e82c[_0x91cb('0x31')][_0x91cb('0x35')]));_0x477131[_0x91cb('0x37')]=_0x477131[_0x91cb('0x37')][_0x91cb('0x36')]?_0x477131[_0x91cb('0x37')]:_0xba99ce[_0x91cb('0x30')];if(_0x52e82c['query'][_0x91cb('0x3f')]){_0x477131[_0x91cb('0x40')]=[{'all':!![]}];}_0x477131=_[_0x91cb('0x3c')]({},_0x477131,_0x52e82c[_0x91cb('0x3e')]);return db['AnalyticDefaultReport'][_0x91cb('0x44')](_0x477131)[_0x91cb('0x23')](handleEntityNotFound(_0x138f48,null))['then'](respondWithResult(_0x138f48,null))[_0x91cb('0x45')](handleError(_0x138f48,null));};exports['create']=function(_0x2c419b,_0x4c0acd){return db['AnalyticDefaultReport']['create'](_0x2c419b[_0x91cb('0x46')],{})[_0x91cb('0x23')](function(_0x3d62c4){var _0x2f8384=_0x2c419b[_0x91cb('0x47')]['get']({'plain':!![]});if(!_0x2f8384)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2f8384[_0x91cb('0x48')]===_0x91cb('0x47')){var _0x140994=_0x3d62c4[_0x91cb('0x25')]({'plain':!![]});var _0x57adff='Reports';return db['UserProfileSection'][_0x91cb('0x44')]({'where':{'name':_0x57adff,'userProfileId':_0x2f8384['userProfileId']},'raw':!![]})[_0x91cb('0x23')](function(_0x4aa670){if(_0x4aa670&&_0x4aa670[_0x91cb('0x49')]===0x0){return db[_0x91cb('0x26')][_0x91cb('0x4a')]({'name':_0x140994[_0x91cb('0x28')],'resourceId':_0x140994['id'],'type':_0x91cb('0x4b'),'sectionId':_0x4aa670['id']},{})[_0x91cb('0x23')](function(){return _0x3d62c4;});}else{return _0x3d62c4;}})[_0x91cb('0x45')](function(_0x30fd4e){logger[_0x91cb('0x4c')](_0x91cb('0x4d'),_0x30fd4e);throw _0x30fd4e;});}return _0x3d62c4;})[_0x91cb('0x23')](respondWithResult(_0x4c0acd,0xc9))['catch'](handleError(_0x4c0acd,null));};exports[_0x91cb('0x4e')]=function(_0x1fa45a,_0x4d7a34){if(_0x1fa45a[_0x91cb('0x46')]['id']){delete _0x1fa45a[_0x91cb('0x46')]['id'];}return db['AnalyticDefaultReport'][_0x91cb('0x44')]({'where':{'id':_0x1fa45a[_0x91cb('0x43')]['id']}})[_0x91cb('0x23')](handleEntityNotFound(_0x4d7a34,null))[_0x91cb('0x23')](saveUpdates(_0x1fa45a[_0x91cb('0x46')],null))[_0x91cb('0x23')](respondWithResult(_0x4d7a34,null))[_0x91cb('0x45')](handleError(_0x4d7a34,null));};exports[_0x91cb('0x24')]=function(_0x3320bd,_0x93ef52){return db[_0x91cb('0x2b')]['find']({'where':{'id':_0x3320bd[_0x91cb('0x43')]['id']}})['then'](handleEntityNotFound(_0x93ef52,null))[_0x91cb('0x23')](removeEntity(_0x93ef52,null))['catch'](handleError(_0x93ef52,null));};exports[_0x91cb('0x4f')]=function(_0x1b2fec,_0x1986d7){var _0x47a6cd=0xa;var _0xe49d42=[_0x91cb('0x50'),'left_join',_0x91cb('0x51'),_0x91cb('0x52')];var _0x365afd={'SUM':_0x91cb('0x53'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x91cb('0x54'),'MAX':_0x91cb('0x55'),'MIN':_0x91cb('0x56'),'AVG':_0x91cb('0x57'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x91cb('0x58'),'GROUP_CONCAT DESC':_0x91cb('0x59')};var _0x5c2c01={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x91cb('0x5a'),'HOUR':'HOUR(%s)','ROUND':_0x91cb('0x5b'),'UNIX_TIMESTAMP':_0x91cb('0x5c')};var _0x5ae0d2=function(_0x4f19c8){return!_[_0x91cb('0x5d')](['IS\x20NULL',_0x91cb('0x5e'),_0x91cb('0x5f'),_0x91cb('0x60')],_0x4f19c8);};var _0x551836=function(_0x22fea8){if(!_0x22fea8||!_0x22fea8['rules'][_0x91cb('0x36')]){return'';}for(var _0xe08233='(',_0xd7be15=0x0;_0xd7be15<_0x22fea8[_0x91cb('0x61')]['length'];_0xd7be15+=0x1){_0xd7be15>0x0&&(_0xe08233+='\x20'+_0x22fea8[_0x91cb('0x62')]+'\x20');_0xe08233+=_0x22fea8[_0x91cb('0x61')][_0xd7be15][_0x91cb('0x63')]?_0x551836(_0x22fea8[_0x91cb('0x61')][_0xd7be15][_0x91cb('0x63')]):_0x22fea8[_0x91cb('0x61')][_0xd7be15][_0x91cb('0x64')]+'\x20'+_0x22fea8[_0x91cb('0x61')][_0xd7be15][_0x91cb('0x65')]+(_0x5ae0d2(_0x22fea8[_0x91cb('0x61')][_0xd7be15][_0x91cb('0x65')])?'\x20'+_0x22fea8[_0x91cb('0x61')][_0xd7be15]['value']:'');}return _0xe08233+')';};var _0x2cf4d0={'where':{'id':_0x1b2fec[_0x91cb('0x43')]['id']}},_0x2e301a,_0x474682,_0x51ab8a,_0x21c890,_0xca33a2;_0x2cf4d0=_['merge']({},_0x2cf4d0,_0x1b2fec[_0x91cb('0x3e')]);return db['AnalyticDefaultReport'][_0x91cb('0x44')](_0x2cf4d0)[_0x91cb('0x23')](function(_0x80fcc6){if(_0x80fcc6){_0x2e301a=_0x80fcc6;return _0x80fcc6[_0x91cb('0x66')]();}return null;})['then'](function(_0x1c0b66){if(_0x1c0b66){if(!_0x1c0b66[_0x91cb('0x36')]){throw new db[(_0x91cb('0x67'))][(_0x91cb('0x68'))](_0x91cb('0x69'),0x193);}_0x474682=_0x1c0b66;return db[_0x91cb('0x6a')]['findAll']({'raw':!![]});}return null;})[_0x91cb('0x23')](function(_0x28bfe5){if(_0x28bfe5){_0x51ab8a=_[_0x91cb('0x6b')](_0x28bfe5,'id');var _0x1f0ba2;var _0x891569=squel[_0x91cb('0x6c')]();_0x891569[_0x91cb('0x6d')](_0x2e301a[_0x91cb('0x6e')]);for(var _0x43629b=0x0;_0x43629b<_0x474682[_0x91cb('0x36')];_0x43629b+=0x1){_0x1f0ba2=_0x474682[_0x43629b][_0x91cb('0x6f')]?_0x51ab8a[_0x474682[_0x43629b][_0x91cb('0x6f')]][_0x91cb('0x70')]:_0x474682[_0x43629b][_0x91cb('0x64')];_0x1f0ba2=_0x474682[_0x43629b][_0x91cb('0x71')]?_[_0x91cb('0x72')](_0x365afd[_0x474682[_0x43629b][_0x91cb('0x71')]],'%s',_0x1f0ba2):_0x1f0ba2;_0x1f0ba2=_0x474682[_0x43629b]['format']?_[_0x91cb('0x72')](_0x5c2c01[_0x474682[_0x43629b][_0x91cb('0x73')]],'%s',_0x1f0ba2):_0x1f0ba2;if(_0x474682[_0x43629b]['groupBy']){_0x891569[_0x91cb('0x63')](_0x1f0ba2);}_0x474682[_0x43629b][_0x91cb('0x74')]&&_0x891569[_0x91cb('0x75')](_0x1f0ba2,_0x474682[_0x43629b]['orderBy']===_0x91cb('0x76')?![]:!![]);_0x891569[_0x91cb('0x64')](_0x1f0ba2,_0x474682[_0x43629b]['alias']||_0x1f0ba2);}if(_0x2e301a['joins']){_0x2e301a[_0x91cb('0x77')]=JSON['parse'](_0x2e301a[_0x91cb('0x77')]);for(var _0x376f56=0x0;_0x376f56<_0x2e301a['joins'][_0x91cb('0x36')];_0x376f56+=0x1){if(_0x2e301a['joins'][_0x376f56][_0x91cb('0x2e')]&&_[_0x91cb('0x5d')](_0xe49d42,_0x2e301a['joins'][_0x376f56]['type'])&&_0x2e301a[_0x91cb('0x77')][_0x376f56][_0x91cb('0x78')]&&_0x2e301a[_0x91cb('0x77')][_0x376f56]['foreignTable']&&_0x2e301a[_0x91cb('0x77')][_0x376f56][_0x91cb('0x79')]){_0x891569[_0x2e301a[_0x91cb('0x77')][_0x376f56][_0x91cb('0x2e')]](_0x2e301a['joins'][_0x376f56][_0x91cb('0x7a')],null,util['format'](_0x91cb('0x7b'),_0x2e301a[_0x91cb('0x6e')],_0x2e301a[_0x91cb('0x77')][_0x376f56][_0x91cb('0x78')],_0x2e301a['joins'][_0x376f56]['foreignTable'],_0x2e301a[_0x91cb('0x77')][_0x376f56]['foreignKey']));}}}if(_0x2e301a[_0x91cb('0x7c')]){_0x2e301a[_0x91cb('0x7c')]=JSON[_0x91cb('0x7d')](_0x2e301a[_0x91cb('0x7c')]);_0x891569[_0x91cb('0x3a')](_0x551836(_0x2e301a[_0x91cb('0x7c')][_0x91cb('0x63')]));}_0xca33a2=_0x891569['clone']();_0x891569[_0x91cb('0x1c')](_0x47a6cd);_0x891569[_0x91cb('0x1b')](0x0);logger['debug'](_0x91cb('0x7e'),_0x891569['toString']());return dbH[_0x91cb('0x7f')][_0x91cb('0x31')](_0x891569[_0x91cb('0x80')](),{'type':dbH[_0x91cb('0x7f')][_0x91cb('0x81')][_0x91cb('0x82')]});}})[_0x91cb('0x23')](respondWithResult(_0x1986d7,null))[_0x91cb('0x45')](handleError(_0x1986d7,null));};function runReport(_0x23380a,_0x14cad8,_0x20a64f){var _0x11411d=_0x14cad8[_0x91cb('0x28')];var _0x14882d=0xa;var _0x22ba54=[_0x91cb('0x50'),'left_join',_0x91cb('0x51'),'cross_join'];var _0x1235c0={'SUM':_0x91cb('0x53'),'COUNT':_0x91cb('0x83'),'COUNT DISTINCT':_0x91cb('0x54'),'MAX':_0x91cb('0x55'),'MIN':_0x91cb('0x56'),'AVG':_0x91cb('0x57'),'GROUP_CONCAT':_0x91cb('0x84'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x91cb('0x59')};var _0xdee7f={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0x91cb('0x85'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x95f2de=function(_0x4d777a){return!_[_0x91cb('0x5d')](['IS\x20NULL',_0x91cb('0x5e'),_0x91cb('0x5f'),_0x91cb('0x60')],_0x4d777a);};var _0x443c01=function(_0x4e899c){if(!_0x4e899c||!_0x4e899c[_0x91cb('0x61')][_0x91cb('0x36')]){return'';}for(var _0x42d07b='(',_0x427afd=0x0;_0x427afd<_0x4e899c[_0x91cb('0x61')][_0x91cb('0x36')];_0x427afd+=0x1){_0x427afd>0x0&&(_0x42d07b+='\x20'+_0x4e899c[_0x91cb('0x62')]+'\x20');_0x42d07b+=_0x4e899c[_0x91cb('0x61')][_0x427afd][_0x91cb('0x63')]?_0x443c01(_0x4e899c[_0x91cb('0x61')][_0x427afd][_0x91cb('0x63')]):_0x4e899c[_0x91cb('0x61')][_0x427afd][_0x91cb('0x64')]+'\x20'+_0x4e899c[_0x91cb('0x61')][_0x427afd][_0x91cb('0x65')]+(_0x95f2de(_0x4e899c[_0x91cb('0x61')][_0x427afd][_0x91cb('0x65')])?'\x20'+_0x4e899c[_0x91cb('0x61')][_0x427afd][_0x91cb('0x86')]:'');}return _0x42d07b+')';};var _0x39b5bd={'where':{'id':_0x23380a['id']}},_0x315518,_0x3d944d,_0x43b96c,_0xe4d946,_0x32d426;_0x39b5bd=_['merge']({},_0x39b5bd,_0x20a64f);return db[_0x91cb('0x2b')][_0x91cb('0x44')](_0x39b5bd)[_0x91cb('0x23')](function(_0x1a654b){if(_0x1a654b){_0x315518=_0x1a654b;return _0x1a654b[_0x91cb('0x66')]();}return null;})[_0x91cb('0x23')](function(_0x404457){if(_0x404457){if(!_0x404457[_0x91cb('0x36')]){throw new db[(_0x91cb('0x67'))][(_0x91cb('0x68'))](_0x91cb('0x69'),0x193);}_0x3d944d=_0x404457;return db['AnalyticMetric'][_0x91cb('0x41')]({'raw':!![]});}return null;})['then'](function(_0x5689ea){if(_0x5689ea){_0x43b96c=_[_0x91cb('0x6b')](_0x5689ea,'id');var _0x265ffb;var _0x4f66f=squel[_0x91cb('0x6c')]();_0x4f66f[_0x91cb('0x6d')](_0x315518[_0x91cb('0x6e')]);for(var _0x210b46=0x0;_0x210b46<_0x3d944d[_0x91cb('0x36')];_0x210b46+=0x1){_0x265ffb=_0x3d944d[_0x210b46][_0x91cb('0x6f')]?_0x43b96c[_0x3d944d[_0x210b46][_0x91cb('0x6f')]]['metric']:_0x3d944d[_0x210b46][_0x91cb('0x64')];_0x265ffb=_0x3d944d[_0x210b46][_0x91cb('0x71')]?_['replace'](_0x1235c0[_0x3d944d[_0x210b46][_0x91cb('0x71')]],'%s',_0x265ffb):_0x265ffb;_0x265ffb=_0x3d944d[_0x210b46][_0x91cb('0x73')]?_['replace'](_0xdee7f[_0x3d944d[_0x210b46][_0x91cb('0x73')]],'%s',_0x265ffb):_0x265ffb;if(_0x3d944d[_0x210b46][_0x91cb('0x87')]){_0x4f66f[_0x91cb('0x63')](_0x265ffb);}_0x3d944d[_0x210b46][_0x91cb('0x74')]&&_0x4f66f[_0x91cb('0x75')](_0x265ffb,_0x3d944d[_0x210b46][_0x91cb('0x74')]===_0x91cb('0x76')?![]:!![]);_0x4f66f[_0x91cb('0x64')](_0x265ffb,_0x3d944d[_0x210b46][_0x91cb('0x88')]||_0x265ffb);}if(_0x315518[_0x91cb('0x77')]){_0x315518[_0x91cb('0x77')]=JSON[_0x91cb('0x7d')](_0x315518['joins']);for(var _0x5c0725=0x0;_0x5c0725<_0x315518[_0x91cb('0x77')][_0x91cb('0x36')];_0x5c0725+=0x1){if(_0x315518[_0x91cb('0x77')][_0x5c0725][_0x91cb('0x2e')]&&_[_0x91cb('0x5d')](_0x22ba54,_0x315518[_0x91cb('0x77')][_0x5c0725][_0x91cb('0x2e')])&&_0x315518['joins'][_0x5c0725][_0x91cb('0x78')]&&_0x315518['joins'][_0x5c0725][_0x91cb('0x7a')]&&_0x315518[_0x91cb('0x77')][_0x5c0725][_0x91cb('0x79')]){_0x4f66f[_0x315518[_0x91cb('0x77')][_0x5c0725][_0x91cb('0x2e')]](_0x315518['joins'][_0x5c0725][_0x91cb('0x7a')],null,util[_0x91cb('0x73')](_0x91cb('0x7b'),_0x315518[_0x91cb('0x6e')],_0x315518[_0x91cb('0x77')][_0x5c0725]['parentKey'],_0x315518[_0x91cb('0x77')][_0x5c0725][_0x91cb('0x7a')],_0x315518[_0x91cb('0x77')][_0x5c0725][_0x91cb('0x79')]));}}}if(_0x315518['conditions']){_0x315518['conditions']=JSON['parse'](_0x315518[_0x91cb('0x7c')]);_0x4f66f[_0x91cb('0x3a')](_0x443c01(_0x315518[_0x91cb('0x7c')][_0x91cb('0x63')]));}_0x32d426=_0x4f66f['clone']();_0x4f66f[_0x91cb('0x1c')](_0x14882d);_0x4f66f[_0x91cb('0x1b')](0x0);return;}})[_0x91cb('0x23')](function(){if(_0x14cad8[_0x91cb('0x89')]==='web'){return null;}var _0x4bf7c7=_[_0x91cb('0x3c')](_0x14cad8,{'name':_0x14cad8[_0x91cb('0x8a')]||_0x14cad8[_0x91cb('0x28')]||_0x315518[_0x91cb('0x28')],'basename':_0x11411d,'savename':util[_0x91cb('0x73')](_0x91cb('0x8b'),_0x14cad8[_0x91cb('0x28')]||_0x315518[_0x91cb('0x28')],require(_0x91cb('0x8c'))[_0x91cb('0x8d')](0x4),_0x14cad8[_0x91cb('0x89')]||_0x91cb('0x8e')),'reportId':_0x315518['id'],'reportType':_0x91cb('0x8f')});return db['AnalyticExtractedReport']['create'](_0x4bf7c7,{'raw':!![]});})[_0x91cb('0x23')](function(_0x48a910){if(_0x315518[_0x91cb('0x6e')]===_0x91cb('0x90')){_0x32d426[_0x91cb('0x3a')](_0x315518[_0x91cb('0x6e')]+_0x91cb('0x91'),_0x14cad8[_0x91cb('0x92')],_0x14cad8[_0x91cb('0x93')]);}else{_0x32d426[_0x91cb('0x3a')](_0x315518['table']+_0x91cb('0x94'),_0x14cad8[_0x91cb('0x92')],_0x14cad8[_0x91cb('0x93')]);}if(_0x48a910){logger[_0x91cb('0x95')](_0x91cb('0x96'),_0x32d426['toString']());require(_0x91cb('0x97'))[_0x91cb('0x98')](path[_0x91cb('0x50')](__dirname,_0x91cb('0x99'),_0x48a910[_0x91cb('0x89')]),[_0x48a910['id'],_0x32d426['toString'](),path[_0x91cb('0x50')](__dirname,_0x91cb('0x9a'),_0x48a910[_0x91cb('0x9b')]),_0x11411d]);return _0x48a910;}else{var _0x22b6d3=squel[_0x91cb('0x6c')]();_0x22b6d3[_0x91cb('0x6d')]('('+_0x32d426[_0x91cb('0x80')]()+')',_0x91cb('0x9c'));_0x22b6d3[_0x91cb('0x64')](_0x91cb('0x9d'),_0x91cb('0x1e'));_0x32d426[_0x91cb('0x1c')](_0x14cad8[_0x91cb('0x1c')]||_0x14882d);_0x32d426[_0x91cb('0x1b')](_0x14cad8[_0x91cb('0x1b')]||0x0);return dbH[_0x91cb('0x7f')][_0x91cb('0x31')](_0x22b6d3[_0x91cb('0x80')](),{'type':dbH[_0x91cb('0x7f')][_0x91cb('0x81')][_0x91cb('0x82')]})[_0x91cb('0x23')](function(_0x275c80){if(!_0x275c80[_0x91cb('0x36')]){_0xe4d946=0x0;}else{_0xe4d946=_0x275c80[0x0][_0x91cb('0x1e')]||0x0;}return dbH[_0x91cb('0x7f')]['query'](_0x32d426[_0x91cb('0x80')](),{'type':dbH[_0x91cb('0x7f')][_0x91cb('0x81')][_0x91cb('0x82')]});})[_0x91cb('0x23')](function(_0x5ca377){return{'rows':_0x5ca377||[],'count':_0xe4d946};});}});}exports['run']=function(_0x552490,_0x5174ac){return runReport(_0x552490['params'],_0x552490[_0x91cb('0x31')],_0x552490[_0x91cb('0x3e')])[_0x91cb('0x23')](respondWithResult(_0x5174ac,null))[_0x91cb('0x45')](handleError(_0x5174ac,null));};exports[_0x91cb('0x9e')]=runReport;exports[_0x91cb('0x31')]=function(_0x3462c5,_0x146346){var _0xe3d97f=0xa;var _0x3b93c3=['join',_0x91cb('0x9f'),_0x91cb('0x51'),'cross_join'];var _0x154e6a={'SUM':_0x91cb('0x53'),'COUNT':_0x91cb('0x83'),'COUNT DISTINCT':_0x91cb('0x54'),'MAX':_0x91cb('0x55'),'MIN':_0x91cb('0x56'),'AVG':_0x91cb('0x57'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x91cb('0x58'),'GROUP_CONCAT DESC':_0x91cb('0x59')};var _0x2a05af={'SEC_TO_TIME':_0x91cb('0xa0'),'DATE':_0x91cb('0x5a'),'HOUR':_0x91cb('0x85'),'ROUND':_0x91cb('0x5b'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x34c1f2=function(_0x4d82b4){return!_[_0x91cb('0x5d')]([_0x91cb('0xa1'),_0x91cb('0x5e'),_0x91cb('0x5f'),_0x91cb('0x60')],_0x4d82b4);};var _0x432099=function(_0x344c95){if(!_0x344c95||!_0x344c95[_0x91cb('0x61')][_0x91cb('0x36')]){return'';}for(var _0x570cf0='(',_0xb3a6c4=0x0;_0xb3a6c4<_0x344c95[_0x91cb('0x61')][_0x91cb('0x36')];_0xb3a6c4+=0x1){_0xb3a6c4>0x0&&(_0x570cf0+='\x20'+_0x344c95[_0x91cb('0x62')]+'\x20');_0x570cf0+=_0x344c95[_0x91cb('0x61')][_0xb3a6c4][_0x91cb('0x63')]?_0x432099(_0x344c95[_0x91cb('0x61')][_0xb3a6c4][_0x91cb('0x63')]):_0x344c95[_0x91cb('0x61')][_0xb3a6c4][_0x91cb('0x64')]+'\x20'+_0x344c95[_0x91cb('0x61')][_0xb3a6c4][_0x91cb('0x65')]+(_0x34c1f2(_0x344c95[_0x91cb('0x61')][_0xb3a6c4]['condition'])?'\x20'+_0x344c95[_0x91cb('0x61')][_0xb3a6c4]['value']:'');}return _0x570cf0+')';};var _0x39ba62={'where':{'id':_0x3462c5[_0x91cb('0x43')]['id']}},_0x2ab5a3,_0x10a9f6,_0x43ad75,_0x1382ba,_0x12da14;_0x39ba62=_[_0x91cb('0x3c')]({},_0x39ba62,_0x3462c5['options']);return db[_0x91cb('0x2b')]['find'](_0x39ba62)[_0x91cb('0x23')](function(_0x2f7387){if(_0x2f7387){_0x2ab5a3=_0x2f7387;return _0x2f7387[_0x91cb('0x66')]();}return null;})['then'](function(_0x1f2ef8){if(_0x1f2ef8){if(!_0x1f2ef8[_0x91cb('0x36')]){throw new db[(_0x91cb('0x67'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x10a9f6=_0x1f2ef8;return db['AnalyticMetric'][_0x91cb('0x41')]({'raw':!![]});}return null;})[_0x91cb('0x23')](function(_0x3ac830){if(_0x3ac830){_0x43ad75=_['keyBy'](_0x3ac830,'id');var _0x469e62;var _0x1e9441=squel[_0x91cb('0x6c')]();_0x1e9441[_0x91cb('0x6d')](_0x2ab5a3[_0x91cb('0x6e')]);for(var _0x416390=0x0;_0x416390<_0x10a9f6[_0x91cb('0x36')];_0x416390+=0x1){_0x469e62=_0x10a9f6[_0x416390][_0x91cb('0x6f')]?_0x43ad75[_0x10a9f6[_0x416390]['MetricId']][_0x91cb('0x70')]:_0x10a9f6[_0x416390][_0x91cb('0x64')];_0x469e62=_0x10a9f6[_0x416390][_0x91cb('0x71')]?_[_0x91cb('0x72')](_0x154e6a[_0x10a9f6[_0x416390]['function']],'%s',_0x469e62):_0x469e62;_0x469e62=_0x10a9f6[_0x416390][_0x91cb('0x73')]?_['replace'](_0x2a05af[_0x10a9f6[_0x416390][_0x91cb('0x73')]],'%s',_0x469e62):_0x469e62;if(_0x10a9f6[_0x416390][_0x91cb('0x87')]){_0x1e9441[_0x91cb('0x63')](_0x469e62);}_0x10a9f6[_0x416390][_0x91cb('0x74')]&&_0x1e9441[_0x91cb('0x75')](_0x469e62,_0x10a9f6[_0x416390]['orderBy']===_0x91cb('0x76')?![]:!![]);_0x1e9441['field'](_0x469e62,_0x10a9f6[_0x416390]['alias']||_0x469e62);}if(_0x2ab5a3[_0x91cb('0x77')]){_0x2ab5a3[_0x91cb('0x77')]=JSON[_0x91cb('0x7d')](_0x2ab5a3[_0x91cb('0x77')]);for(var _0x286ed7=0x0;_0x286ed7<_0x2ab5a3[_0x91cb('0x77')][_0x91cb('0x36')];_0x286ed7+=0x1){if(_0x2ab5a3[_0x91cb('0x77')][_0x286ed7]['type']&&_[_0x91cb('0x5d')](_0x3b93c3,_0x2ab5a3[_0x91cb('0x77')][_0x286ed7][_0x91cb('0x2e')])&&_0x2ab5a3['joins'][_0x286ed7]['parentKey']&&_0x2ab5a3['joins'][_0x286ed7][_0x91cb('0x7a')]&&_0x2ab5a3[_0x91cb('0x77')][_0x286ed7][_0x91cb('0x79')]){_0x1e9441[_0x2ab5a3['joins'][_0x286ed7][_0x91cb('0x2e')]](_0x2ab5a3[_0x91cb('0x77')][_0x286ed7][_0x91cb('0x7a')],null,util[_0x91cb('0x73')]('%s.%s\x20=\x20%s.%s',_0x2ab5a3[_0x91cb('0x6e')],_0x2ab5a3[_0x91cb('0x77')][_0x286ed7][_0x91cb('0x78')],_0x2ab5a3[_0x91cb('0x77')][_0x286ed7][_0x91cb('0x7a')],_0x2ab5a3[_0x91cb('0x77')][_0x286ed7]['foreignKey']));}}}if(_0x2ab5a3[_0x91cb('0x7c')]){_0x2ab5a3[_0x91cb('0x7c')]=JSON[_0x91cb('0x7d')](_0x2ab5a3[_0x91cb('0x7c')]);_0x1e9441[_0x91cb('0x3a')](_0x432099(_0x2ab5a3['conditions'][_0x91cb('0x63')]));}_0x12da14=_0x1e9441[_0x91cb('0xa2')]();_0x1e9441[_0x91cb('0x1c')](_0xe3d97f);_0x1e9441[_0x91cb('0x1b')](0x0);logger[_0x91cb('0xa3')](_0x91cb('0x7e'),_0x1e9441['toString']());return dbH[_0x91cb('0x7f')][_0x91cb('0x31')](_0x1e9441[_0x91cb('0x80')](),{'type':dbH['sequelize'][_0x91cb('0x81')]['SELECT']});}})[_0x91cb('0x23')](function(){return{'sql':_0x12da14[_0x91cb('0x80')]()};})[_0x91cb('0x23')](respondWithResult(_0x146346,null))[_0x91cb('0x45')](handleError(_0x146346,null));}; \ No newline at end of file +var _0x3f8a=['get','DefaultReports','end','error','stack','name','send','index','map','AnalyticDefaultReport','rawAttributes','type','key','keys','intersection','model','attributes','fields','query','order','sort','filters','pick','filter','merge','VIRTUAL','options','where','include','findAll','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_join','right_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','length','operator','group','field','value','getFields','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','function','replace','format','groupBy','orderBy','alias','joins','parse','parentKey','foreignTable','foreignKey','conditions','Limited\x20Query:','sequelize','toString','SELECT','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','IS\x20NULL','condition','ValidationErrorItem','metric','DESC','clone','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','default','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','countTable','COUNT(*)','QueryTypes','run','runReport','%s.%s\x20=\x20%s.%s','debug','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','offset','undefined','limit','count','set','json','apply','reject','save','update','destroy','then'];(function(_0x1361be,_0xd9f68c){var _0x1243a8=function(_0x4a3c1a){while(--_0x4a3c1a){_0x1361be['push'](_0x1361be['shift']());}};_0x1243a8(++_0xd9f68c);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x3bbd4e,_0x502b91){_0x3bbd4e=_0x3bbd4e-0x0;var _0x4dfeb8=_0x3f8a[_0x3bbd4e];return _0x4dfeb8;};'use strict';var emlformat=require(_0xa3f8('0x0'));var rimraf=require(_0xa3f8('0x1'));var zipdir=require(_0xa3f8('0x2'));var jsonpatch=require(_0xa3f8('0x3'));var rp=require('request-promise');var moment=require(_0xa3f8('0x4'));var BPromise=require(_0xa3f8('0x5'));var Mustache=require(_0xa3f8('0x6'));var util=require(_0xa3f8('0x7'));var path=require(_0xa3f8('0x8'));var sox=require(_0xa3f8('0x9'));var csv=require(_0xa3f8('0xa'));var ejs=require(_0xa3f8('0xb'));var fs=require('fs');var fs_extra=require(_0xa3f8('0xc'));var _=require(_0xa3f8('0xd'));var squel=require(_0xa3f8('0xe'));var crypto=require(_0xa3f8('0xf'));var jsforce=require(_0xa3f8('0x10'));var deskjs=require(_0xa3f8('0x11'));var toCsv=require(_0xa3f8('0xa'));var querystring=require(_0xa3f8('0x12'));var Papa=require(_0xa3f8('0x13'));var Redis=require('ioredis');var authService=require(_0xa3f8('0x14'));var qs=require(_0xa3f8('0x15'));var as=require(_0xa3f8('0x16'));var hardwareService=require(_0xa3f8('0x17'));var logger=require('../../config/logger')(_0xa3f8('0x18'));var utils=require(_0xa3f8('0x19'));var config=require(_0xa3f8('0x1a'));var licenseUtil=require(_0xa3f8('0x1b'));var db=require(_0xa3f8('0x1c'))['db'];var dbH=require(_0xa3f8('0x1c'))[_0xa3f8('0x1d')];function respondWithStatusCode(_0x63de8b,_0x324aa8){_0x324aa8=_0x324aa8||0xcc;return function(_0x36b1b8){if(_0x36b1b8){return _0x63de8b[_0xa3f8('0x1e')](_0x324aa8);}return _0x63de8b[_0xa3f8('0x1f')](_0x324aa8)['end']();};}function respondWithResult(_0x2d8f74,_0xe55848){_0xe55848=_0xe55848||0xc8;return function(_0x45014f){if(_0x45014f){return _0x2d8f74[_0xa3f8('0x1f')](_0xe55848)['json'](_0x45014f);}};}function respondWithFilteredResult(_0x39c450,_0x33b98e){return function(_0x46a8d9){if(_0x46a8d9){var _0x8cd130=typeof _0x33b98e[_0xa3f8('0x20')]===_0xa3f8('0x21')&&typeof _0x33b98e[_0xa3f8('0x22')]===_0xa3f8('0x21');var _0x2cb49f=_0x46a8d9[_0xa3f8('0x23')];var _0x54b870=_0x8cd130?0x0:_0x33b98e[_0xa3f8('0x20')];var _0x5a0e18=_0x8cd130?_0x46a8d9[_0xa3f8('0x23')]:_0x33b98e[_0xa3f8('0x20')]+_0x33b98e[_0xa3f8('0x22')];var _0x46042d;if(_0x5a0e18>=_0x2cb49f){_0x5a0e18=_0x2cb49f;_0x46042d=0xc8;}else{_0x46042d=0xce;}_0x39c450['status'](_0x46042d);return _0x39c450[_0xa3f8('0x24')]('Content-Range',_0x54b870+'-'+_0x5a0e18+'/'+_0x2cb49f)[_0xa3f8('0x25')](_0x46a8d9);}return null;};}function patchUpdates(_0x58336d){return function(_0x4066bb){try{jsonpatch[_0xa3f8('0x26')](_0x4066bb,_0x58336d,!![]);}catch(_0x353daa){return BPromise[_0xa3f8('0x27')](_0x353daa);}return _0x4066bb[_0xa3f8('0x28')]();};}function saveUpdates(_0x1e5f30,_0x187352){return function(_0x490717){if(_0x490717){return _0x490717[_0xa3f8('0x29')](_0x1e5f30)['then'](function(_0x3ce57b){return _0x3ce57b;});}return null;};}function removeEntity(_0xa5a697,_0x24985a){return function(_0x37b290){if(_0x37b290){return _0x37b290[_0xa3f8('0x2a')]()[_0xa3f8('0x2b')](function(){var _0x6e3cb4=_0x37b290[_0xa3f8('0x2c')]({'plain':!![]});var _0x1e22b8=_0xa3f8('0x2d');return db['UserProfileResource'][_0xa3f8('0x2a')]({'where':{'type':_0x1e22b8,'resourceId':_0x6e3cb4['id']}})[_0xa3f8('0x2b')](function(){return _0x37b290;});})[_0xa3f8('0x2b')](function(){_0xa5a697['status'](0xcc)[_0xa3f8('0x2e')]();});}};}function handleEntityNotFound(_0x57f6be,_0xbad6a6){return function(_0x3a3746){if(!_0x3a3746){_0x57f6be[_0xa3f8('0x1e')](0x194);}return _0x3a3746;};}function handleError(_0x4ea213,_0x458824){_0x458824=_0x458824||0x1f4;return function(_0x5e69e2){logger[_0xa3f8('0x2f')](_0x5e69e2[_0xa3f8('0x30')]);if(_0x5e69e2[_0xa3f8('0x31')]){delete _0x5e69e2[_0xa3f8('0x31')];}_0x4ea213[_0xa3f8('0x1f')](_0x458824)[_0xa3f8('0x32')](_0x5e69e2);};}exports[_0xa3f8('0x33')]=function(_0x424a3e,_0x25f9f5){var _0x290a4e={},_0x6e83b0={},_0x57c465={'count':0x0,'rows':[]};var _0x4404da=_[_0xa3f8('0x34')](db[_0xa3f8('0x35')][_0xa3f8('0x36')],function(_0x3bb4b0){return{'name':_0x3bb4b0['fieldName'],'type':_0x3bb4b0[_0xa3f8('0x37')][_0xa3f8('0x38')]};});_0x6e83b0['model']=_[_0xa3f8('0x34')](_0x4404da,_0xa3f8('0x31'));_0x6e83b0['query']=_[_0xa3f8('0x39')](_0x424a3e['query']);_0x6e83b0['filters']=_[_0xa3f8('0x3a')](_0x6e83b0[_0xa3f8('0x3b')],_0x6e83b0['query']);_0x290a4e[_0xa3f8('0x3c')]=_['intersection'](_0x6e83b0[_0xa3f8('0x3b')],qs[_0xa3f8('0x3d')](_0x424a3e[_0xa3f8('0x3e')][_0xa3f8('0x3d')]));_0x290a4e['attributes']=_0x290a4e[_0xa3f8('0x3c')]['length']?_0x290a4e[_0xa3f8('0x3c')]:_0x6e83b0['model'];if(!_0x424a3e[_0xa3f8('0x3e')]['hasOwnProperty']('nolimit')){_0x290a4e['limit']=qs[_0xa3f8('0x22')](_0x424a3e[_0xa3f8('0x3e')][_0xa3f8('0x22')]);_0x290a4e[_0xa3f8('0x20')]=qs['offset'](_0x424a3e[_0xa3f8('0x3e')][_0xa3f8('0x20')]);}_0x290a4e[_0xa3f8('0x3f')]=qs[_0xa3f8('0x40')](_0x424a3e[_0xa3f8('0x3e')][_0xa3f8('0x40')]);_0x290a4e['where']=qs[_0xa3f8('0x41')](_[_0xa3f8('0x42')](_0x424a3e[_0xa3f8('0x3e')],_0x6e83b0['filters']),_0x4404da);if(_0x424a3e[_0xa3f8('0x3e')][_0xa3f8('0x43')]){_0x290a4e['where']=_[_0xa3f8('0x44')](_0x290a4e['where'],{'$or':_[_0xa3f8('0x34')](_0x4404da,function(_0x5a077c){if(_0x5a077c[_0xa3f8('0x37')]!==_0xa3f8('0x45')){var _0x9a00e7={};_0x9a00e7[_0x5a077c[_0xa3f8('0x31')]]={'$like':'%'+_0x424a3e[_0xa3f8('0x3e')]['filter']+'%'};return _0x9a00e7;}})});}_0x290a4e=_[_0xa3f8('0x44')]({},_0x290a4e,_0x424a3e[_0xa3f8('0x46')]);var _0x4db9c5={'where':_0x290a4e[_0xa3f8('0x47')]};return db['AnalyticDefaultReport'][_0xa3f8('0x23')](_0x4db9c5)[_0xa3f8('0x2b')](function(_0x1542cc){_0x57c465[_0xa3f8('0x23')]=_0x1542cc;if(_0x424a3e[_0xa3f8('0x3e')]['includeAll']){_0x290a4e[_0xa3f8('0x48')]=[{'all':!![]}];}return db[_0xa3f8('0x35')][_0xa3f8('0x49')](_0x290a4e);})[_0xa3f8('0x2b')](function(_0x337808){_0x57c465['rows']=_0x337808;return _0x57c465;})[_0xa3f8('0x2b')](respondWithFilteredResult(_0x25f9f5,_0x290a4e))[_0xa3f8('0x4a')](handleError(_0x25f9f5,null));};exports[_0xa3f8('0x4b')]=function(_0x32e371,_0x2a124b){var _0x314dba={'raw':!![],'where':{'id':_0x32e371[_0xa3f8('0x4c')]['id']}},_0x497217={};_0x497217[_0xa3f8('0x3b')]=_[_0xa3f8('0x39')](db[_0xa3f8('0x35')][_0xa3f8('0x36')]);_0x497217[_0xa3f8('0x3e')]=_['keys'](_0x32e371['query']);_0x497217['filters']=_[_0xa3f8('0x3a')](_0x497217[_0xa3f8('0x3b')],_0x497217[_0xa3f8('0x3e')]);_0x314dba[_0xa3f8('0x3c')]=_[_0xa3f8('0x3a')](_0x497217[_0xa3f8('0x3b')],qs['fields'](_0x32e371[_0xa3f8('0x3e')][_0xa3f8('0x3d')]));_0x314dba[_0xa3f8('0x3c')]=_0x314dba[_0xa3f8('0x3c')]['length']?_0x314dba[_0xa3f8('0x3c')]:_0x497217[_0xa3f8('0x3b')];if(_0x32e371[_0xa3f8('0x3e')]['includeAll']){_0x314dba['include']=[{'all':!![]}];}_0x314dba=_['merge']({},_0x314dba,_0x32e371[_0xa3f8('0x46')]);return db[_0xa3f8('0x35')]['find'](_0x314dba)[_0xa3f8('0x2b')](handleEntityNotFound(_0x2a124b,null))[_0xa3f8('0x2b')](respondWithResult(_0x2a124b,null))[_0xa3f8('0x4a')](handleError(_0x2a124b,null));};exports[_0xa3f8('0x4d')]=function(_0x14932f,_0x3c74b5){return db[_0xa3f8('0x35')][_0xa3f8('0x4d')](_0x14932f[_0xa3f8('0x4e')],{})[_0xa3f8('0x2b')](function(_0x338554){var _0x29d8f5=_0x14932f[_0xa3f8('0x4f')][_0xa3f8('0x2c')]({'plain':!![]});if(!_0x29d8f5)throw new Error(_0xa3f8('0x50'));if(_0x29d8f5[_0xa3f8('0x51')]===_0xa3f8('0x4f')){var _0x559ae7=_0x338554['get']({'plain':!![]});var _0x1fad80=_0xa3f8('0x52');return db['UserProfileSection'][_0xa3f8('0x53')]({'where':{'name':_0x1fad80,'userProfileId':_0x29d8f5[_0xa3f8('0x54')]},'raw':!![]})[_0xa3f8('0x2b')](function(_0xaff79b){if(_0xaff79b&&_0xaff79b[_0xa3f8('0x55')]===0x0){return db[_0xa3f8('0x56')][_0xa3f8('0x4d')]({'name':_0x559ae7[_0xa3f8('0x31')],'resourceId':_0x559ae7['id'],'type':_0xa3f8('0x2d'),'sectionId':_0xaff79b['id']},{})[_0xa3f8('0x2b')](function(){return _0x338554;});}else{return _0x338554;}})[_0xa3f8('0x4a')](function(_0x3752fa){logger[_0xa3f8('0x2f')](_0xa3f8('0x57'),_0x3752fa);throw _0x3752fa;});}return _0x338554;})[_0xa3f8('0x2b')](respondWithResult(_0x3c74b5,0xc9))[_0xa3f8('0x4a')](handleError(_0x3c74b5,null));};exports['update']=function(_0x593614,_0xd0628e){if(_0x593614['body']['id']){delete _0x593614[_0xa3f8('0x4e')]['id'];}return db[_0xa3f8('0x35')][_0xa3f8('0x53')]({'where':{'id':_0x593614['params']['id']}})[_0xa3f8('0x2b')](handleEntityNotFound(_0xd0628e,null))[_0xa3f8('0x2b')](saveUpdates(_0x593614[_0xa3f8('0x4e')],null))[_0xa3f8('0x2b')](respondWithResult(_0xd0628e,null))['catch'](handleError(_0xd0628e,null));};exports[_0xa3f8('0x2a')]=function(_0x47cc0c,_0x392e1e){return db[_0xa3f8('0x35')][_0xa3f8('0x53')]({'where':{'id':_0x47cc0c['params']['id']}})['then'](handleEntityNotFound(_0x392e1e,null))[_0xa3f8('0x2b')](removeEntity(_0x392e1e,null))[_0xa3f8('0x4a')](handleError(_0x392e1e,null));};exports[_0xa3f8('0x58')]=function(_0x6ad40a,_0x48f5a6){var _0x36eac9=0xa;var _0x3478e8=[_0xa3f8('0x59'),_0xa3f8('0x5a'),_0xa3f8('0x5b'),'cross_join'];var _0x5d7877={'SUM':_0xa3f8('0x5c'),'COUNT':_0xa3f8('0x5d'),'COUNT DISTINCT':_0xa3f8('0x5e'),'MAX':_0xa3f8('0x5f'),'MIN':_0xa3f8('0x60'),'AVG':_0xa3f8('0x61'),'GROUP_CONCAT':_0xa3f8('0x62'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x521719={'SEC_TO_TIME':_0xa3f8('0x63'),'DATE':_0xa3f8('0x64'),'HOUR':_0xa3f8('0x65'),'ROUND':_0xa3f8('0x66'),'UNIX_TIMESTAMP':_0xa3f8('0x67')};var _0x27de61=function(_0x356643){return!_[_0xa3f8('0x68')](['IS\x20NULL',_0xa3f8('0x69'),_0xa3f8('0x6a'),_0xa3f8('0x6b')],_0x356643);};var _0x42e3f8=function(_0x27c5aa){if(!_0x27c5aa||!_0x27c5aa[_0xa3f8('0x6c')][_0xa3f8('0x6d')]){return'';}for(var _0x4d0404='(',_0x33ea06=0x0;_0x33ea06<_0x27c5aa[_0xa3f8('0x6c')]['length'];_0x33ea06+=0x1){_0x33ea06>0x0&&(_0x4d0404+='\x20'+_0x27c5aa[_0xa3f8('0x6e')]+'\x20');_0x4d0404+=_0x27c5aa[_0xa3f8('0x6c')][_0x33ea06][_0xa3f8('0x6f')]?_0x42e3f8(_0x27c5aa[_0xa3f8('0x6c')][_0x33ea06][_0xa3f8('0x6f')]):_0x27c5aa[_0xa3f8('0x6c')][_0x33ea06][_0xa3f8('0x70')]+'\x20'+_0x27c5aa['rules'][_0x33ea06]['condition']+(_0x27de61(_0x27c5aa[_0xa3f8('0x6c')][_0x33ea06]['condition'])?'\x20'+_0x27c5aa[_0xa3f8('0x6c')][_0x33ea06][_0xa3f8('0x71')]:'');}return _0x4d0404+')';};var _0x3ff369={'where':{'id':_0x6ad40a[_0xa3f8('0x4c')]['id']}},_0x1dba7e,_0x452e99,_0x35d4d6,_0xeca2dc,_0x14508d;_0x3ff369=_[_0xa3f8('0x44')]({},_0x3ff369,_0x6ad40a[_0xa3f8('0x46')]);return db[_0xa3f8('0x35')][_0xa3f8('0x53')](_0x3ff369)['then'](function(_0x5efdcf){if(_0x5efdcf){_0x1dba7e=_0x5efdcf;return _0x5efdcf[_0xa3f8('0x72')]();}return null;})[_0xa3f8('0x2b')](function(_0x1688ca){if(_0x1688ca){if(!_0x1688ca[_0xa3f8('0x6d')]){throw new db[(_0xa3f8('0x73'))]['ValidationErrorItem'](_0xa3f8('0x74'),0x193);}_0x452e99=_0x1688ca;return db[_0xa3f8('0x75')][_0xa3f8('0x49')]({'raw':!![]});}return null;})[_0xa3f8('0x2b')](function(_0x28d359){if(_0x28d359){_0x35d4d6=_[_0xa3f8('0x76')](_0x28d359,'id');var _0x3d45ae;var _0x3a2362=squel[_0xa3f8('0x77')]();_0x3a2362[_0xa3f8('0x78')](_0x1dba7e[_0xa3f8('0x79')]);for(var _0x5d4fe5=0x0;_0x5d4fe5<_0x452e99[_0xa3f8('0x6d')];_0x5d4fe5+=0x1){_0x3d45ae=_0x452e99[_0x5d4fe5][_0xa3f8('0x7a')]?_0x35d4d6[_0x452e99[_0x5d4fe5]['MetricId']]['metric']:_0x452e99[_0x5d4fe5][_0xa3f8('0x70')];_0x3d45ae=_0x452e99[_0x5d4fe5][_0xa3f8('0x7b')]?_[_0xa3f8('0x7c')](_0x5d7877[_0x452e99[_0x5d4fe5][_0xa3f8('0x7b')]],'%s',_0x3d45ae):_0x3d45ae;_0x3d45ae=_0x452e99[_0x5d4fe5][_0xa3f8('0x7d')]?_[_0xa3f8('0x7c')](_0x521719[_0x452e99[_0x5d4fe5][_0xa3f8('0x7d')]],'%s',_0x3d45ae):_0x3d45ae;if(_0x452e99[_0x5d4fe5][_0xa3f8('0x7e')]){_0x3a2362['group'](_0x3d45ae);}_0x452e99[_0x5d4fe5][_0xa3f8('0x7f')]&&_0x3a2362[_0xa3f8('0x3f')](_0x3d45ae,_0x452e99[_0x5d4fe5][_0xa3f8('0x7f')]==='DESC'?![]:!![]);_0x3a2362[_0xa3f8('0x70')](_0x3d45ae,_0x452e99[_0x5d4fe5][_0xa3f8('0x80')]||_0x3d45ae);}if(_0x1dba7e['joins']){_0x1dba7e[_0xa3f8('0x81')]=JSON[_0xa3f8('0x82')](_0x1dba7e[_0xa3f8('0x81')]);for(var _0x14a5b5=0x0;_0x14a5b5<_0x1dba7e[_0xa3f8('0x81')][_0xa3f8('0x6d')];_0x14a5b5+=0x1){if(_0x1dba7e[_0xa3f8('0x81')][_0x14a5b5][_0xa3f8('0x37')]&&_[_0xa3f8('0x68')](_0x3478e8,_0x1dba7e['joins'][_0x14a5b5][_0xa3f8('0x37')])&&_0x1dba7e['joins'][_0x14a5b5][_0xa3f8('0x83')]&&_0x1dba7e['joins'][_0x14a5b5][_0xa3f8('0x84')]&&_0x1dba7e[_0xa3f8('0x81')][_0x14a5b5][_0xa3f8('0x85')]){_0x3a2362[_0x1dba7e[_0xa3f8('0x81')][_0x14a5b5][_0xa3f8('0x37')]](_0x1dba7e['joins'][_0x14a5b5][_0xa3f8('0x84')],null,util[_0xa3f8('0x7d')]('%s.%s\x20=\x20%s.%s',_0x1dba7e[_0xa3f8('0x79')],_0x1dba7e[_0xa3f8('0x81')][_0x14a5b5][_0xa3f8('0x83')],_0x1dba7e[_0xa3f8('0x81')][_0x14a5b5][_0xa3f8('0x84')],_0x1dba7e[_0xa3f8('0x81')][_0x14a5b5]['foreignKey']));}}}if(_0x1dba7e[_0xa3f8('0x86')]){_0x1dba7e[_0xa3f8('0x86')]=JSON[_0xa3f8('0x82')](_0x1dba7e['conditions']);_0x3a2362[_0xa3f8('0x47')](_0x42e3f8(_0x1dba7e['conditions'][_0xa3f8('0x6f')]));}_0x14508d=_0x3a2362['clone']();_0x3a2362['limit'](_0x36eac9);_0x3a2362[_0xa3f8('0x20')](0x0);logger['debug'](_0xa3f8('0x87'),_0x3a2362['toString']());return dbH[_0xa3f8('0x88')][_0xa3f8('0x3e')](_0x3a2362[_0xa3f8('0x89')](),{'type':dbH[_0xa3f8('0x88')]['QueryTypes'][_0xa3f8('0x8a')]});}})[_0xa3f8('0x2b')](respondWithResult(_0x48f5a6,null))['catch'](handleError(_0x48f5a6,null));};function runReport(_0x3187e0,_0xd0d568,_0x3715ea){var _0x345089=_0xd0d568[_0xa3f8('0x31')];var _0x20ae51=0xa;var _0x190ce8=[_0xa3f8('0x59'),_0xa3f8('0x5a'),_0xa3f8('0x5b'),'cross_join'];var _0x7dc5ec={'SUM':_0xa3f8('0x5c'),'COUNT':_0xa3f8('0x5d'),'COUNT DISTINCT':_0xa3f8('0x5e'),'MAX':_0xa3f8('0x5f'),'MIN':_0xa3f8('0x60'),'AVG':_0xa3f8('0x61'),'GROUP_CONCAT':_0xa3f8('0x62'),'GROUP_CONCAT ASC':_0xa3f8('0x8b'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x2e2d99={'SEC_TO_TIME':_0xa3f8('0x63'),'DATE':_0xa3f8('0x64'),'HOUR':_0xa3f8('0x65'),'ROUND':_0xa3f8('0x66'),'UNIX_TIMESTAMP':_0xa3f8('0x67')};var _0x599484=function(_0x24fe62){return!_[_0xa3f8('0x68')]([_0xa3f8('0x8c'),_0xa3f8('0x69'),'IS\x20EMPTY',_0xa3f8('0x6b')],_0x24fe62);};var _0x427830=function(_0x3c5091){if(!_0x3c5091||!_0x3c5091[_0xa3f8('0x6c')][_0xa3f8('0x6d')]){return'';}for(var _0x2db7dd='(',_0x12fe03=0x0;_0x12fe03<_0x3c5091[_0xa3f8('0x6c')][_0xa3f8('0x6d')];_0x12fe03+=0x1){_0x12fe03>0x0&&(_0x2db7dd+='\x20'+_0x3c5091[_0xa3f8('0x6e')]+'\x20');_0x2db7dd+=_0x3c5091[_0xa3f8('0x6c')][_0x12fe03]['group']?_0x427830(_0x3c5091[_0xa3f8('0x6c')][_0x12fe03]['group']):_0x3c5091[_0xa3f8('0x6c')][_0x12fe03][_0xa3f8('0x70')]+'\x20'+_0x3c5091[_0xa3f8('0x6c')][_0x12fe03][_0xa3f8('0x8d')]+(_0x599484(_0x3c5091[_0xa3f8('0x6c')][_0x12fe03][_0xa3f8('0x8d')])?'\x20'+_0x3c5091[_0xa3f8('0x6c')][_0x12fe03][_0xa3f8('0x71')]:'');}return _0x2db7dd+')';};var _0x4bb7dd={'where':{'id':_0x3187e0['id']}},_0x2c6efe,_0x4f9513,_0x39bd5c,_0x52fcc3,_0x2d2883;_0x4bb7dd=_['merge']({},_0x4bb7dd,_0x3715ea);return db[_0xa3f8('0x35')][_0xa3f8('0x53')](_0x4bb7dd)[_0xa3f8('0x2b')](function(_0xe3cc6a){if(_0xe3cc6a){_0x2c6efe=_0xe3cc6a;return _0xe3cc6a['getFields']();}return null;})[_0xa3f8('0x2b')](function(_0x3d343f){if(_0x3d343f){if(!_0x3d343f[_0xa3f8('0x6d')]){throw new db[(_0xa3f8('0x73'))][(_0xa3f8('0x8e'))](_0xa3f8('0x74'),0x193);}_0x4f9513=_0x3d343f;return db['AnalyticMetric'][_0xa3f8('0x49')]({'raw':!![]});}return null;})[_0xa3f8('0x2b')](function(_0xbe1a54){if(_0xbe1a54){_0x39bd5c=_[_0xa3f8('0x76')](_0xbe1a54,'id');var _0x477b0a;var _0x565a10=squel[_0xa3f8('0x77')]();_0x565a10[_0xa3f8('0x78')](_0x2c6efe['table']);for(var _0x4494a5=0x0;_0x4494a5<_0x4f9513[_0xa3f8('0x6d')];_0x4494a5+=0x1){_0x477b0a=_0x4f9513[_0x4494a5][_0xa3f8('0x7a')]?_0x39bd5c[_0x4f9513[_0x4494a5]['MetricId']][_0xa3f8('0x8f')]:_0x4f9513[_0x4494a5][_0xa3f8('0x70')];_0x477b0a=_0x4f9513[_0x4494a5][_0xa3f8('0x7b')]?_[_0xa3f8('0x7c')](_0x7dc5ec[_0x4f9513[_0x4494a5][_0xa3f8('0x7b')]],'%s',_0x477b0a):_0x477b0a;_0x477b0a=_0x4f9513[_0x4494a5][_0xa3f8('0x7d')]?_[_0xa3f8('0x7c')](_0x2e2d99[_0x4f9513[_0x4494a5]['format']],'%s',_0x477b0a):_0x477b0a;if(_0x4f9513[_0x4494a5][_0xa3f8('0x7e')]){_0x565a10[_0xa3f8('0x6f')](_0x477b0a);}_0x4f9513[_0x4494a5]['orderBy']&&_0x565a10[_0xa3f8('0x3f')](_0x477b0a,_0x4f9513[_0x4494a5][_0xa3f8('0x7f')]===_0xa3f8('0x90')?![]:!![]);_0x565a10[_0xa3f8('0x70')](_0x477b0a,_0x4f9513[_0x4494a5][_0xa3f8('0x80')]||_0x477b0a);}if(_0x2c6efe[_0xa3f8('0x81')]){_0x2c6efe[_0xa3f8('0x81')]=JSON['parse'](_0x2c6efe[_0xa3f8('0x81')]);for(var _0x151bab=0x0;_0x151bab<_0x2c6efe[_0xa3f8('0x81')][_0xa3f8('0x6d')];_0x151bab+=0x1){if(_0x2c6efe[_0xa3f8('0x81')][_0x151bab][_0xa3f8('0x37')]&&_[_0xa3f8('0x68')](_0x190ce8,_0x2c6efe['joins'][_0x151bab][_0xa3f8('0x37')])&&_0x2c6efe[_0xa3f8('0x81')][_0x151bab][_0xa3f8('0x83')]&&_0x2c6efe[_0xa3f8('0x81')][_0x151bab]['foreignTable']&&_0x2c6efe['joins'][_0x151bab][_0xa3f8('0x85')]){_0x565a10[_0x2c6efe['joins'][_0x151bab][_0xa3f8('0x37')]](_0x2c6efe[_0xa3f8('0x81')][_0x151bab][_0xa3f8('0x84')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x2c6efe[_0xa3f8('0x79')],_0x2c6efe[_0xa3f8('0x81')][_0x151bab][_0xa3f8('0x83')],_0x2c6efe[_0xa3f8('0x81')][_0x151bab]['foreignTable'],_0x2c6efe[_0xa3f8('0x81')][_0x151bab]['foreignKey']));}}}if(_0x2c6efe[_0xa3f8('0x86')]){_0x2c6efe[_0xa3f8('0x86')]=JSON[_0xa3f8('0x82')](_0x2c6efe['conditions']);_0x565a10['where'](_0x427830(_0x2c6efe['conditions'][_0xa3f8('0x6f')]));}_0x2d2883=_0x565a10[_0xa3f8('0x91')]();_0x565a10[_0xa3f8('0x22')](_0x20ae51);_0x565a10[_0xa3f8('0x20')](0x0);return;}})[_0xa3f8('0x2b')](function(){if(_0xd0d568[_0xa3f8('0x92')]===_0xa3f8('0x93')){return null;}var _0x18890e=_['merge'](_0xd0d568,{'name':_0xd0d568[_0xa3f8('0x94')]||_0xd0d568[_0xa3f8('0x31')]||_0x2c6efe[_0xa3f8('0x31')],'basename':_0x345089,'savename':util['format'](_0xa3f8('0x95'),_0xd0d568[_0xa3f8('0x31')]||_0x2c6efe['name'],require(_0xa3f8('0x96'))[_0xa3f8('0x97')](0x4),_0xd0d568['output']||_0xa3f8('0x98')),'reportId':_0x2c6efe['id'],'reportType':_0xa3f8('0x99')});return db['AnalyticExtractedReport'][_0xa3f8('0x4d')](_0x18890e,{'raw':!![]});})[_0xa3f8('0x2b')](function(_0x21cc1d){if(_0x2c6efe['table']===_0xa3f8('0x9a')){_0x2d2883[_0xa3f8('0x47')](_0x2c6efe[_0xa3f8('0x79')]+_0xa3f8('0x9b'),_0xd0d568[_0xa3f8('0x9c')],_0xd0d568['endDate']);}else{_0x2d2883['where'](_0x2c6efe[_0xa3f8('0x79')]+_0xa3f8('0x9d'),_0xd0d568[_0xa3f8('0x9c')],_0xd0d568[_0xa3f8('0x9e')]);}if(_0x21cc1d){logger['info'](_0xa3f8('0x9f'),_0x2d2883[_0xa3f8('0x89')]());require(_0xa3f8('0xa0'))[_0xa3f8('0xa1')](path[_0xa3f8('0x59')](__dirname,_0xa3f8('0xa2'),_0x21cc1d[_0xa3f8('0x92')]),[_0x21cc1d['id'],_0x2d2883[_0xa3f8('0x89')](),path['join'](__dirname,_0xa3f8('0xa3'),_0x21cc1d['savename']),_0x345089]);return _0x21cc1d;}else{var _0xe9842=squel['select']();_0xe9842['from']('('+_0x2d2883[_0xa3f8('0x89')]()+')',_0xa3f8('0xa4'));_0xe9842[_0xa3f8('0x70')](_0xa3f8('0xa5'),_0xa3f8('0x23'));_0x2d2883['limit'](_0xd0d568['limit']||_0x20ae51);_0x2d2883[_0xa3f8('0x20')](_0xd0d568[_0xa3f8('0x20')]||0x0);return dbH[_0xa3f8('0x88')][_0xa3f8('0x3e')](_0xe9842[_0xa3f8('0x89')](),{'type':dbH[_0xa3f8('0x88')]['QueryTypes'][_0xa3f8('0x8a')]})[_0xa3f8('0x2b')](function(_0x5a4f4a){if(!_0x5a4f4a['length']){_0x52fcc3=0x0;}else{_0x52fcc3=_0x5a4f4a[0x0][_0xa3f8('0x23')]||0x0;}return dbH[_0xa3f8('0x88')]['query'](_0x2d2883[_0xa3f8('0x89')](),{'type':dbH[_0xa3f8('0x88')][_0xa3f8('0xa6')][_0xa3f8('0x8a')]});})[_0xa3f8('0x2b')](function(_0x52f592){return{'rows':_0x52f592||[],'count':_0x52fcc3};});}});}exports[_0xa3f8('0xa7')]=function(_0x59026b,_0x234636){return runReport(_0x59026b[_0xa3f8('0x4c')],_0x59026b['query'],_0x59026b['options'])[_0xa3f8('0x2b')](respondWithResult(_0x234636,null))[_0xa3f8('0x4a')](handleError(_0x234636,null));};exports[_0xa3f8('0xa8')]=runReport;exports[_0xa3f8('0x3e')]=function(_0x26ec07,_0x2c9db8){var _0x18ab67=0xa;var _0x1f21a2=[_0xa3f8('0x59'),_0xa3f8('0x5a'),_0xa3f8('0x5b'),'cross_join'];var _0x15a11c={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0xa3f8('0x5e'),'MAX':_0xa3f8('0x5f'),'MIN':_0xa3f8('0x60'),'AVG':_0xa3f8('0x61'),'GROUP_CONCAT':_0xa3f8('0x62'),'GROUP_CONCAT ASC':_0xa3f8('0x8b'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x481b70={'SEC_TO_TIME':_0xa3f8('0x63'),'DATE':_0xa3f8('0x64'),'HOUR':_0xa3f8('0x65'),'ROUND':_0xa3f8('0x66'),'UNIX_TIMESTAMP':_0xa3f8('0x67')};var _0x1f776a=function(_0x5b1527){return!_['includes']([_0xa3f8('0x8c'),_0xa3f8('0x69'),_0xa3f8('0x6a'),_0xa3f8('0x6b')],_0x5b1527);};var _0x4670cc=function(_0xfde509){if(!_0xfde509||!_0xfde509['rules']['length']){return'';}for(var _0x3d81fe='(',_0x15111a=0x0;_0x15111a<_0xfde509[_0xa3f8('0x6c')]['length'];_0x15111a+=0x1){_0x15111a>0x0&&(_0x3d81fe+='\x20'+_0xfde509[_0xa3f8('0x6e')]+'\x20');_0x3d81fe+=_0xfde509[_0xa3f8('0x6c')][_0x15111a]['group']?_0x4670cc(_0xfde509[_0xa3f8('0x6c')][_0x15111a]['group']):_0xfde509[_0xa3f8('0x6c')][_0x15111a]['field']+'\x20'+_0xfde509['rules'][_0x15111a][_0xa3f8('0x8d')]+(_0x1f776a(_0xfde509[_0xa3f8('0x6c')][_0x15111a][_0xa3f8('0x8d')])?'\x20'+_0xfde509[_0xa3f8('0x6c')][_0x15111a]['value']:'');}return _0x3d81fe+')';};var _0x2e694e={'where':{'id':_0x26ec07[_0xa3f8('0x4c')]['id']}},_0x1669be,_0x4f248f,_0x6ef1ad,_0xae3a31,_0x31d45c;_0x2e694e=_[_0xa3f8('0x44')]({},_0x2e694e,_0x26ec07[_0xa3f8('0x46')]);return db[_0xa3f8('0x35')][_0xa3f8('0x53')](_0x2e694e)[_0xa3f8('0x2b')](function(_0x529021){if(_0x529021){_0x1669be=_0x529021;return _0x529021[_0xa3f8('0x72')]();}return null;})[_0xa3f8('0x2b')](function(_0x35c498){if(_0x35c498){if(!_0x35c498[_0xa3f8('0x6d')]){throw new db[(_0xa3f8('0x73'))][(_0xa3f8('0x8e'))](_0xa3f8('0x74'),0x193);}_0x4f248f=_0x35c498;return db[_0xa3f8('0x75')]['findAll']({'raw':!![]});}return null;})[_0xa3f8('0x2b')](function(_0x286490){if(_0x286490){_0x6ef1ad=_['keyBy'](_0x286490,'id');var _0x16e98d;var _0x3be5c9=squel['select']();_0x3be5c9[_0xa3f8('0x78')](_0x1669be[_0xa3f8('0x79')]);for(var _0x5260e0=0x0;_0x5260e0<_0x4f248f[_0xa3f8('0x6d')];_0x5260e0+=0x1){_0x16e98d=_0x4f248f[_0x5260e0][_0xa3f8('0x7a')]?_0x6ef1ad[_0x4f248f[_0x5260e0]['MetricId']][_0xa3f8('0x8f')]:_0x4f248f[_0x5260e0][_0xa3f8('0x70')];_0x16e98d=_0x4f248f[_0x5260e0]['function']?_['replace'](_0x15a11c[_0x4f248f[_0x5260e0][_0xa3f8('0x7b')]],'%s',_0x16e98d):_0x16e98d;_0x16e98d=_0x4f248f[_0x5260e0][_0xa3f8('0x7d')]?_[_0xa3f8('0x7c')](_0x481b70[_0x4f248f[_0x5260e0]['format']],'%s',_0x16e98d):_0x16e98d;if(_0x4f248f[_0x5260e0]['groupBy']){_0x3be5c9[_0xa3f8('0x6f')](_0x16e98d);}_0x4f248f[_0x5260e0][_0xa3f8('0x7f')]&&_0x3be5c9['order'](_0x16e98d,_0x4f248f[_0x5260e0][_0xa3f8('0x7f')]==='DESC'?![]:!![]);_0x3be5c9[_0xa3f8('0x70')](_0x16e98d,_0x4f248f[_0x5260e0]['alias']||_0x16e98d);}if(_0x1669be[_0xa3f8('0x81')]){_0x1669be['joins']=JSON['parse'](_0x1669be[_0xa3f8('0x81')]);for(var _0x5ac693=0x0;_0x5ac693<_0x1669be[_0xa3f8('0x81')][_0xa3f8('0x6d')];_0x5ac693+=0x1){if(_0x1669be[_0xa3f8('0x81')][_0x5ac693][_0xa3f8('0x37')]&&_[_0xa3f8('0x68')](_0x1f21a2,_0x1669be[_0xa3f8('0x81')][_0x5ac693][_0xa3f8('0x37')])&&_0x1669be[_0xa3f8('0x81')][_0x5ac693][_0xa3f8('0x83')]&&_0x1669be['joins'][_0x5ac693][_0xa3f8('0x84')]&&_0x1669be[_0xa3f8('0x81')][_0x5ac693][_0xa3f8('0x85')]){_0x3be5c9[_0x1669be[_0xa3f8('0x81')][_0x5ac693][_0xa3f8('0x37')]](_0x1669be[_0xa3f8('0x81')][_0x5ac693][_0xa3f8('0x84')],null,util[_0xa3f8('0x7d')](_0xa3f8('0xa9'),_0x1669be[_0xa3f8('0x79')],_0x1669be[_0xa3f8('0x81')][_0x5ac693][_0xa3f8('0x83')],_0x1669be[_0xa3f8('0x81')][_0x5ac693]['foreignTable'],_0x1669be[_0xa3f8('0x81')][_0x5ac693][_0xa3f8('0x85')]));}}}if(_0x1669be[_0xa3f8('0x86')]){_0x1669be[_0xa3f8('0x86')]=JSON[_0xa3f8('0x82')](_0x1669be[_0xa3f8('0x86')]);_0x3be5c9['where'](_0x4670cc(_0x1669be[_0xa3f8('0x86')][_0xa3f8('0x6f')]));}_0x31d45c=_0x3be5c9[_0xa3f8('0x91')]();_0x3be5c9[_0xa3f8('0x22')](_0x18ab67);_0x3be5c9[_0xa3f8('0x20')](0x0);logger[_0xa3f8('0xaa')](_0xa3f8('0x87'),_0x3be5c9[_0xa3f8('0x89')]());return dbH[_0xa3f8('0x88')][_0xa3f8('0x3e')](_0x3be5c9[_0xa3f8('0x89')](),{'type':dbH[_0xa3f8('0x88')][_0xa3f8('0xa6')][_0xa3f8('0x8a')]});}})[_0xa3f8('0x2b')](function(){return{'sql':_0x31d45c[_0xa3f8('0x89')]()};})[_0xa3f8('0x2b')](respondWithResult(_0x2c9db8,null))[_0xa3f8('0x4a')](handleError(_0x2c9db8,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 98dd7c7..77f7e62 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 _0xeab2=['./analyticDefaultReport.attributes','exports','AnalyticDefaultReport','analytics_default_reports','lodash','util','api','bluebird','path','rimraf','../../config/environment'];(function(_0x220e95,_0x4e71f8){var _0x25034b=function(_0x3fece9){while(--_0x3fece9){_0x220e95['push'](_0x220e95['shift']());}};_0x25034b(++_0x4e71f8);}(_0xeab2,0x14e));var _0x2eab=function(_0xea6018,_0x4cf082){_0xea6018=_0xea6018-0x0;var _0x57b54d=_0xeab2[_0xea6018];return _0x57b54d;};'use strict';var _=require(_0x2eab('0x0'));var util=require(_0x2eab('0x1'));var logger=require('../../config/logger')(_0x2eab('0x2'));var moment=require('moment');var BPromise=require(_0x2eab('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2eab('0x4'));var rimraf=require(_0x2eab('0x5'));var config=require(_0x2eab('0x6'));var attributes=require(_0x2eab('0x7'));module[_0x2eab('0x8')]=function(_0xeb5016,_0x2f3111){return _0xeb5016['define'](_0x2eab('0x9'),attributes,{'tableName':_0x2eab('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd5db=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./analyticDefaultReport.attributes','define','AnalyticDefaultReport','lodash','util'];(function(_0x3578a4,_0x5c15c6){var _0x2432cf=function(_0x235840){while(--_0x235840){_0x3578a4['push'](_0x3578a4['shift']());}};_0x2432cf(++_0x5c15c6);}(_0xd5db,0xe2));var _0xbd5d=function(_0xa8883,_0x1f107f){_0xa8883=_0xa8883-0x0;var _0x479426=_0xd5db[_0xa8883];return _0x479426;};'use strict';var _=require(_0xbd5d('0x0'));var util=require(_0xbd5d('0x1'));var logger=require(_0xbd5d('0x2'))(_0xbd5d('0x3'));var moment=require('moment');var BPromise=require(_0xbd5d('0x4'));var rp=require(_0xbd5d('0x5'));var fs=require('fs');var path=require(_0xbd5d('0x6'));var rimraf=require(_0xbd5d('0x7'));var config=require(_0xbd5d('0x8'));var attributes=require(_0xbd5d('0x9'));module['exports']=function(_0x2104d5,_0x3b62ba){return _0x2104d5[_0xbd5d('0xa')](_0xbd5d('0xb'),attributes,{'tableName':'analytics_default_reports','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 03b80f3..234ba33 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 _0xf5fc=['message','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticDefaultReport,\x20%s,\x20%s'];(function(_0x33593e,_0x22ddd3){var _0x53db1a=function(_0x499ee5){while(--_0x499ee5){_0x33593e['push'](_0x33593e['shift']());}};_0x53db1a(++_0x22ddd3);}(_0xf5fc,0x1e5));var _0xcf5f=function(_0x582689,_0x20c7b4){_0x582689=_0x582689-0x0;var _0x1041ca=_0xf5fc[_0x582689];return _0x1041ca;};'use strict';var _=require('lodash');var util=require(_0xcf5f('0x0'));var moment=require(_0xcf5f('0x1'));var BPromise=require(_0xcf5f('0x2'));var rs=require(_0xcf5f('0x3'));var fs=require('fs');var Redis=require(_0xcf5f('0x4'));var db=require(_0xcf5f('0x5'))['db'];var utils=require(_0xcf5f('0x6'));var logger=require(_0xcf5f('0x7'))(_0xcf5f('0x8'));var config=require('../../config/environment');var jayson=require(_0xcf5f('0x9'));var client=jayson[_0xcf5f('0xa')][_0xcf5f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x18ed3b,_0x544235,_0x3ccf9b){return new BPromise(function(_0x3b6441,_0x423ea5){return client['request'](_0x18ed3b,_0x3ccf9b)[_0xcf5f('0xc')](function(_0x5d0523){logger[_0xcf5f('0xd')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x544235,_0xcf5f('0xe'));logger[_0xcf5f('0xf')](_0xcf5f('0x10'),_0x544235,'request\x20sent',JSON[_0xcf5f('0x11')](_0x5d0523));if(_0x5d0523[_0xcf5f('0x12')]){if(_0x5d0523[_0xcf5f('0x12')][_0xcf5f('0x13')]===0x1f4){logger['error'](_0xcf5f('0x14'),_0x544235,_0x5d0523['error'][_0xcf5f('0x15')]);return _0x423ea5(_0x5d0523['error'][_0xcf5f('0x15')]);}logger[_0xcf5f('0x12')](_0xcf5f('0x14'),_0x544235,_0x5d0523[_0xcf5f('0x12')][_0xcf5f('0x15')]);return _0x3b6441(_0x5d0523[_0xcf5f('0x12')][_0xcf5f('0x15')]);}else{logger[_0xcf5f('0xd')](_0xcf5f('0x14'),_0x544235,_0xcf5f('0xe'));_0x3b6441(_0x5d0523['result'][_0xcf5f('0x15')]);}})['catch'](function(_0x4e82bb){logger[_0xcf5f('0x12')](_0xcf5f('0x14'),_0x544235,_0x4e82bb);_0x423ea5(_0x4e82bb);});});} \ No newline at end of file +var _0x68ad=['then','info','AnalyticDefaultReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x3148b3,_0x422bfc){var _0x1ecee2=function(_0x5e3443){while(--_0x5e3443){_0x3148b3['push'](_0x3148b3['shift']());}};_0x1ecee2(++_0x422bfc);}(_0x68ad,0xb2));var _0xd68a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x68ad[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd68a('0x0'));var util=require(_0xd68a('0x1'));var moment=require(_0xd68a('0x2'));var BPromise=require(_0xd68a('0x3'));var rs=require(_0xd68a('0x4'));var fs=require('fs');var Redis=require(_0xd68a('0x5'));var db=require(_0xd68a('0x6'))['db'];var utils=require(_0xd68a('0x7'));var logger=require('../../config/logger')(_0xd68a('0x8'));var config=require(_0xd68a('0x9'));var jayson=require(_0xd68a('0xa'));var client=jayson[_0xd68a('0xb')][_0xd68a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x302cc9,_0x321748,_0x29c4fd){return new BPromise(function(_0x95fae8,_0x19a49){return client[_0xd68a('0xd')](_0x302cc9,_0x29c4fd)[_0xd68a('0xe')](function(_0x44af83){logger[_0xd68a('0xf')](_0xd68a('0x10'),_0x321748,'request\x20sent');logger[_0xd68a('0x11')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x321748,_0xd68a('0x12'),JSON[_0xd68a('0x13')](_0x44af83));if(_0x44af83['error']){if(_0x44af83[_0xd68a('0x14')][_0xd68a('0x15')]===0x1f4){logger[_0xd68a('0x14')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x321748,_0x44af83[_0xd68a('0x14')]['message']);return _0x19a49(_0x44af83[_0xd68a('0x14')][_0xd68a('0x16')]);}logger[_0xd68a('0x14')](_0xd68a('0x10'),_0x321748,_0x44af83['error'][_0xd68a('0x16')]);return _0x95fae8(_0x44af83[_0xd68a('0x14')][_0xd68a('0x16')]);}else{logger['info'](_0xd68a('0x10'),_0x321748,_0xd68a('0x12'));_0x95fae8(_0x44af83['result']['message']);}})[_0xd68a('0x17')](function(_0x5ada77){logger[_0xd68a('0x14')](_0xd68a('0x10'),_0x321748,_0x5ada77);_0x19a49(_0x5ada77);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 710b09d..38ecfe4 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 _0x2bb6=['/:id','/:id/preview','preview','/:id/run','/:id/query','query','put','update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','index'];(function(_0x178f24,_0x386ae6){var _0x28f42d=function(_0x397ea8){while(--_0x397ea8){_0x178f24['push'](_0x178f24['shift']());}};_0x28f42d(++_0x386ae6);}(_0x2bb6,0xfd));var _0x62bb=function(_0x543719,_0xea44b8){_0x543719=_0x543719-0x0;var _0x38bb38=_0x2bb6[_0x543719];return _0x38bb38;};'use strict';var multer=require(_0x62bb('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x62bb('0x1'));var express=require(_0x62bb('0x2'));var router=express[_0x62bb('0x3')]();var fs_extra=require(_0x62bb('0x4'));var auth=require(_0x62bb('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x62bb('0x6'));var controller=require(_0x62bb('0x7'));router[_0x62bb('0x8')]('/',auth[_0x62bb('0x9')](),controller[_0x62bb('0xa')]);router[_0x62bb('0x8')](_0x62bb('0xb'),auth[_0x62bb('0x9')](),controller['show']);router[_0x62bb('0x8')](_0x62bb('0xc'),auth[_0x62bb('0x9')](),controller[_0x62bb('0xd')]);router[_0x62bb('0x8')](_0x62bb('0xe'),auth[_0x62bb('0x9')](),controller['run']);router[_0x62bb('0x8')](_0x62bb('0xf'),auth['isAuthenticated'](),controller[_0x62bb('0x10')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x62bb('0x11')](_0x62bb('0xb'),auth[_0x62bb('0x9')](),controller[_0x62bb('0x12')]);router[_0x62bb('0x13')](_0x62bb('0xb'),auth['isAuthenticated'](),controller[_0x62bb('0x14')]);module[_0x62bb('0x15')]=router; \ No newline at end of file +var _0xa9ee=['/:id/preview','preview','run','/:id/query','query','post','create','put','/:id','update','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','show'];(function(_0x4c352c,_0x3f604a){var _0x2e97db=function(_0x5cab75){while(--_0x5cab75){_0x4c352c['push'](_0x4c352c['shift']());}};_0x2e97db(++_0x3f604a);}(_0xa9ee,0x1a3));var _0xea9e=function(_0x1ec656,_0x21f375){_0x1ec656=_0x1ec656-0x0;var _0x484618=_0xa9ee[_0x1ec656];return _0x484618;};'use strict';var multer=require(_0xea9e('0x0'));var util=require(_0xea9e('0x1'));var path=require(_0xea9e('0x2'));var timeout=require(_0xea9e('0x3'));var express=require(_0xea9e('0x4'));var router=express[_0xea9e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xea9e('0x6'));var interaction=require(_0xea9e('0x7'));var config=require(_0xea9e('0x8'));var controller=require(_0xea9e('0x9'));router[_0xea9e('0xa')]('/',auth[_0xea9e('0xb')](),controller['index']);router[_0xea9e('0xa')]('/:id',auth[_0xea9e('0xb')](),controller[_0xea9e('0xc')]);router[_0xea9e('0xa')](_0xea9e('0xd'),auth['isAuthenticated'](),controller[_0xea9e('0xe')]);router[_0xea9e('0xa')]('/:id/run',auth[_0xea9e('0xb')](),controller[_0xea9e('0xf')]);router[_0xea9e('0xa')](_0xea9e('0x10'),auth[_0xea9e('0xb')](),controller[_0xea9e('0x11')]);router[_0xea9e('0x12')]('/',auth[_0xea9e('0xb')](),controller[_0xea9e('0x13')]);router[_0xea9e('0x14')](_0xea9e('0x15'),auth[_0xea9e('0xb')](),controller[_0xea9e('0x16')]);router['delete'](_0xea9e('0x15'),auth[_0xea9e('0xb')](),controller[_0xea9e('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index f3174d6..b657046 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 _0x188d=['DATE','Loading','ENUM','manual','INTEGER','UNSIGNED','sequelize','exports','STRING','csv','pdf','xlsx'];(function(_0x367a41,_0x4d387b){var _0x37b497=function(_0x56297e){while(--_0x56297e){_0x367a41['push'](_0x367a41['shift']());}};_0x37b497(++_0x4d387b);}(_0x188d,0x156));var _0xd188=function(_0x4dd072,_0x515c74){_0x4dd072=_0x4dd072-0x0;var _0x45ee58=_0x188d[_0x4dd072];return _0x45ee58;};'use strict';var Sequelize=require(_0xd188('0x0'));var moment=require('moment');module[_0xd188('0x1')]={'name':{'type':Sequelize[_0xd188('0x2')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize['ENUM'](_0xd188('0x3'),_0xd188('0x4'),_0xd188('0x5')),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize[_0xd188('0x2')],'allowNull':![]},'startDate':{'type':Sequelize[_0xd188('0x6')]},'endDate':{'type':Sequelize[_0xd188('0x6')]},'status':{'type':Sequelize[_0xd188('0x2')],'defaultValue':_0xd188('0x7')},'type':{'type':Sequelize[_0xd188('0x8')](_0xd188('0x9'),'scheduled'),'allowNull':![],'defaultValue':'manual'},'reportId':{'type':Sequelize[_0xd188('0xa')](0xb)[_0xd188('0xb')]},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xcd03=['csv','pdf','xlsx','DATE','Loading','manual','UNSIGNED','sequelize','moment','exports','STRING','ENUM'];(function(_0x1d05a3,_0x125a86){var _0x48d934=function(_0x44f447){while(--_0x44f447){_0x1d05a3['push'](_0x1d05a3['shift']());}};_0x48d934(++_0x125a86);}(_0xcd03,0xaf));var _0x3cd0=function(_0x3af733,_0x5a735f){_0x3af733=_0x3af733-0x0;var _0x34481d=_0xcd03[_0x3af733];return _0x34481d;};'use strict';var Sequelize=require(_0x3cd0('0x0'));var moment=require(_0x3cd0('0x1'));module[_0x3cd0('0x2')]={'name':{'type':Sequelize[_0x3cd0('0x3')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize[_0x3cd0('0x4')](_0x3cd0('0x5'),_0x3cd0('0x6'),_0x3cd0('0x7')),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize[_0x3cd0('0x3')],'allowNull':![]},'startDate':{'type':Sequelize[_0x3cd0('0x8')]},'endDate':{'type':Sequelize[_0x3cd0('0x8')]},'status':{'type':Sequelize[_0x3cd0('0x3')],'defaultValue':_0x3cd0('0x9')},'type':{'type':Sequelize[_0x3cd0('0x4')]('manual','scheduled'),'allowNull':![],'defaultValue':_0x3cd0('0xa')},'reportId':{'type':Sequelize['INTEGER'](0xb)[_0x3cd0('0xb')]},'reportType':{'type':Sequelize[_0x3cd0('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index e5f0dc5..60780e9 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 _0x3622=['map','AnalyticExtractedReport','rawAttributes','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','download','savename','output','join','root','server/files/reports','Sequelize','ValidationError','exists','sendStatus','format','%s.%s','basename','toLowerCase','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','get','ExtractedReports','then','error','stack','name','index'];(function(_0x40847f,_0x182e6f){var _0x2f322e=function(_0x307f66){while(--_0x307f66){_0x40847f['push'](_0x40847f['shift']());}};_0x2f322e(++_0x182e6f);}(_0x3622,0x1a5));var _0x2362=function(_0x462999,_0x24d200){_0x462999=_0x462999-0x0;var _0x4b1366=_0x3622[_0x462999];return _0x4b1366;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2362('0x0'));var zipdir=require(_0x2362('0x1'));var jsonpatch=require(_0x2362('0x2'));var rp=require(_0x2362('0x3'));var moment=require(_0x2362('0x4'));var BPromise=require(_0x2362('0x5'));var Mustache=require(_0x2362('0x6'));var util=require(_0x2362('0x7'));var path=require('path');var sox=require(_0x2362('0x8'));var csv=require(_0x2362('0x9'));var ejs=require(_0x2362('0xa'));var fs=require('fs');var fs_extra=require(_0x2362('0xb'));var _=require(_0x2362('0xc'));var squel=require('squel');var crypto=require(_0x2362('0xd'));var jsforce=require(_0x2362('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x2362('0x9'));var querystring=require(_0x2362('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x2362('0x10'));var qs=require(_0x2362('0x11'));var as=require(_0x2362('0x12'));var hardwareService=require(_0x2362('0x13'));var logger=require('../../config/logger')(_0x2362('0x14'));var utils=require(_0x2362('0x15'));var config=require(_0x2362('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x2362('0x17'))['db'];function respondWithStatusCode(_0x52bcdc,_0x4b16d9){_0x4b16d9=_0x4b16d9||0xcc;return function(_0x8c1e){if(_0x8c1e){return _0x52bcdc['sendStatus'](_0x4b16d9);}return _0x52bcdc[_0x2362('0x18')](_0x4b16d9)[_0x2362('0x19')]();};}function respondWithResult(_0x10b645,_0x393c01){_0x393c01=_0x393c01||0xc8;return function(_0x4af412){if(_0x4af412){return _0x10b645[_0x2362('0x18')](_0x393c01)[_0x2362('0x1a')](_0x4af412);}};}function respondWithFilteredResult(_0x534a62,_0x5589a1){return function(_0x1fef3f){if(_0x1fef3f){var _0x3d11e5=typeof _0x5589a1[_0x2362('0x1b')]===_0x2362('0x1c')&&typeof _0x5589a1[_0x2362('0x1d')]==='undefined';var _0x928e2c=_0x1fef3f[_0x2362('0x1e')];var _0x8492e3=_0x3d11e5?0x0:_0x5589a1[_0x2362('0x1b')];var _0x2c77b5=_0x3d11e5?_0x1fef3f[_0x2362('0x1e')]:_0x5589a1[_0x2362('0x1b')]+_0x5589a1['limit'];var _0xc78809;if(_0x2c77b5>=_0x928e2c){_0x2c77b5=_0x928e2c;_0xc78809=0xc8;}else{_0xc78809=0xce;}_0x534a62[_0x2362('0x18')](_0xc78809);return _0x534a62[_0x2362('0x1f')](_0x2362('0x20'),_0x8492e3+'-'+_0x2c77b5+'/'+_0x928e2c)[_0x2362('0x1a')](_0x1fef3f);}return null;};}function patchUpdates(_0x29afc0){return function(_0x4879e0){try{jsonpatch['apply'](_0x4879e0,_0x29afc0,!![]);}catch(_0x1a6a1b){return BPromise[_0x2362('0x21')](_0x1a6a1b);}return _0x4879e0[_0x2362('0x22')]();};}function saveUpdates(_0x7b8fed,_0x1dc46f){return function(_0x11abed){if(_0x11abed){return _0x11abed[_0x2362('0x23')](_0x7b8fed)['then'](function(_0x30a3c0){return _0x30a3c0;});}return null;};}function removeEntity(_0x3a5414,_0xffd5b2){return function(_0x4f7bc2){if(_0x4f7bc2){return _0x4f7bc2[_0x2362('0x24')]()['then'](function(){var _0x513026=_0x4f7bc2[_0x2362('0x25')]({'plain':!![]});var _0x445220=_0x2362('0x26');return db['UserProfileResource'][_0x2362('0x24')]({'where':{'type':_0x445220,'resourceId':_0x513026['id']}})[_0x2362('0x27')](function(){return _0x4f7bc2;});})['then'](function(){_0x3a5414[_0x2362('0x18')](0xcc)[_0x2362('0x19')]();});}};}function handleEntityNotFound(_0x171a9f,_0x2edb98){return function(_0x2b2d85){if(!_0x2b2d85){_0x171a9f['sendStatus'](0x194);}return _0x2b2d85;};}function handleError(_0x1ff4f7,_0x5e92ad){_0x5e92ad=_0x5e92ad||0x1f4;return function(_0xdfee7f){logger[_0x2362('0x28')](_0xdfee7f[_0x2362('0x29')]);if(_0xdfee7f['name']){delete _0xdfee7f[_0x2362('0x2a')];}_0x1ff4f7[_0x2362('0x18')](_0x5e92ad)['send'](_0xdfee7f);};}exports[_0x2362('0x2b')]=function(_0x10a9b2,_0xe9be0){var _0x2765e4={},_0x8f4bbf={},_0x402039={'count':0x0,'rows':[]};var _0x13bd70=_[_0x2362('0x2c')](db[_0x2362('0x2d')][_0x2362('0x2e')],function(_0xcfa5fc){return{'name':_0xcfa5fc['fieldName'],'type':_0xcfa5fc[_0x2362('0x2f')]['key']};});_0x8f4bbf[_0x2362('0x30')]=_[_0x2362('0x2c')](_0x13bd70,_0x2362('0x2a'));_0x8f4bbf[_0x2362('0x31')]=_[_0x2362('0x32')](_0x10a9b2[_0x2362('0x31')]);_0x8f4bbf['filters']=_[_0x2362('0x33')](_0x8f4bbf[_0x2362('0x30')],_0x8f4bbf[_0x2362('0x31')]);_0x2765e4[_0x2362('0x34')]=_[_0x2362('0x33')](_0x8f4bbf['model'],qs[_0x2362('0x35')](_0x10a9b2['query']['fields']));_0x2765e4[_0x2362('0x34')]=_0x2765e4['attributes'][_0x2362('0x36')]?_0x2765e4[_0x2362('0x34')]:_0x8f4bbf[_0x2362('0x30')];if(!_0x10a9b2['query'][_0x2362('0x37')](_0x2362('0x38'))){_0x2765e4[_0x2362('0x1d')]=qs[_0x2362('0x1d')](_0x10a9b2[_0x2362('0x31')][_0x2362('0x1d')]);_0x2765e4[_0x2362('0x1b')]=qs[_0x2362('0x1b')](_0x10a9b2[_0x2362('0x31')][_0x2362('0x1b')]);}_0x2765e4[_0x2362('0x39')]=qs[_0x2362('0x3a')](_0x10a9b2[_0x2362('0x31')][_0x2362('0x3a')]);_0x2765e4[_0x2362('0x3b')]=qs['filters'](_[_0x2362('0x3c')](_0x10a9b2[_0x2362('0x31')],_0x8f4bbf[_0x2362('0x3d')]),_0x13bd70);if(_0x10a9b2[_0x2362('0x31')][_0x2362('0x3e')]){_0x2765e4[_0x2362('0x3b')]=_[_0x2362('0x3f')](_0x2765e4[_0x2362('0x3b')],{'$or':_[_0x2362('0x2c')](_0x13bd70,function(_0x2a6733){if(_0x2a6733[_0x2362('0x2f')]!==_0x2362('0x40')){var _0x4c49a4={};_0x4c49a4[_0x2a6733[_0x2362('0x2a')]]={'$like':'%'+_0x10a9b2[_0x2362('0x31')][_0x2362('0x3e')]+'%'};return _0x4c49a4;}})});}_0x2765e4=_[_0x2362('0x3f')]({},_0x2765e4,_0x10a9b2[_0x2362('0x41')]);var _0x3b78c7={'where':_0x2765e4[_0x2362('0x3b')]};return db['AnalyticExtractedReport'][_0x2362('0x1e')](_0x3b78c7)[_0x2362('0x27')](function(_0x417319){_0x402039[_0x2362('0x1e')]=_0x417319;if(_0x10a9b2[_0x2362('0x31')][_0x2362('0x42')]){_0x2765e4[_0x2362('0x43')]=[{'all':!![]}];}return db[_0x2362('0x2d')][_0x2362('0x44')](_0x2765e4);})[_0x2362('0x27')](function(_0x2b848d){_0x402039['rows']=_0x2b848d;return _0x402039;})['then'](respondWithFilteredResult(_0xe9be0,_0x2765e4))[_0x2362('0x45')](handleError(_0xe9be0,null));};exports['show']=function(_0x50b30b,_0x218871){var _0x50e4ec={'raw':!![],'where':{'id':_0x50b30b[_0x2362('0x46')]['id']}},_0x3c9f86={};_0x3c9f86[_0x2362('0x30')]=_[_0x2362('0x32')](db[_0x2362('0x2d')]['rawAttributes']);_0x3c9f86['query']=_['keys'](_0x50b30b[_0x2362('0x31')]);_0x3c9f86['filters']=_[_0x2362('0x33')](_0x3c9f86[_0x2362('0x30')],_0x3c9f86[_0x2362('0x31')]);_0x50e4ec[_0x2362('0x34')]=_[_0x2362('0x33')](_0x3c9f86[_0x2362('0x30')],qs['fields'](_0x50b30b[_0x2362('0x31')][_0x2362('0x35')]));_0x50e4ec[_0x2362('0x34')]=_0x50e4ec[_0x2362('0x34')][_0x2362('0x36')]?_0x50e4ec[_0x2362('0x34')]:_0x3c9f86[_0x2362('0x30')];if(_0x50b30b[_0x2362('0x31')][_0x2362('0x42')]){_0x50e4ec['include']=[{'all':!![]}];}_0x50e4ec=_[_0x2362('0x3f')]({},_0x50e4ec,_0x50b30b[_0x2362('0x41')]);return db[_0x2362('0x2d')]['find'](_0x50e4ec)[_0x2362('0x27')](handleEntityNotFound(_0x218871,null))[_0x2362('0x27')](respondWithResult(_0x218871,null))['catch'](handleError(_0x218871,null));};exports[_0x2362('0x47')]=function(_0x432fe9,_0x3a7c6b){return db[_0x2362('0x2d')]['create'](_0x432fe9['body'],{})[_0x2362('0x27')](function(_0xd351f9){var _0x40fcba=_0x432fe9[_0x2362('0x48')][_0x2362('0x25')]({'plain':!![]});if(!_0x40fcba)throw new Error(_0x2362('0x49'));if(_0x40fcba[_0x2362('0x4a')]===_0x2362('0x48')){var _0x2b6b2e=_0xd351f9[_0x2362('0x25')]({'plain':!![]});var _0x2a4caf=_0x2362('0x26');return db['UserProfileSection']['find']({'where':{'name':_0x2a4caf,'userProfileId':_0x40fcba[_0x2362('0x4b')]},'raw':!![]})[_0x2362('0x27')](function(_0x2135e3){if(_0x2135e3&&_0x2135e3['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x2b6b2e[_0x2362('0x2a')],'resourceId':_0x2b6b2e['id'],'type':_0x2135e3[_0x2362('0x2a')],'sectionId':_0x2135e3['id']},{})[_0x2362('0x27')](function(){return _0xd351f9;});}else{return _0xd351f9;}})['catch'](function(_0x35ba59){logger[_0x2362('0x28')](_0x2362('0x4c'),_0x35ba59);throw _0x35ba59;});}return _0xd351f9;})[_0x2362('0x27')](respondWithResult(_0x3a7c6b,0xc9))[_0x2362('0x45')](handleError(_0x3a7c6b,null));};exports[_0x2362('0x23')]=function(_0x45d3be,_0xeb0d47){if(_0x45d3be[_0x2362('0x4d')]['id']){delete _0x45d3be[_0x2362('0x4d')]['id'];}return db[_0x2362('0x2d')][_0x2362('0x4e')]({'where':{'id':_0x45d3be[_0x2362('0x46')]['id']}})[_0x2362('0x27')](handleEntityNotFound(_0xeb0d47,null))[_0x2362('0x27')](saveUpdates(_0x45d3be[_0x2362('0x4d')],null))[_0x2362('0x27')](respondWithResult(_0xeb0d47,null))[_0x2362('0x45')](handleError(_0xeb0d47,null));};exports[_0x2362('0x24')]=function(_0x449dfb,_0x3479ef){return db[_0x2362('0x2d')][_0x2362('0x4e')]({'where':{'id':_0x449dfb[_0x2362('0x46')]['id']}})['then'](handleEntityNotFound(_0x3479ef,null))[_0x2362('0x27')](removeEntity(_0x3479ef,null))[_0x2362('0x45')](handleError(_0x3479ef,null));};exports[_0x2362('0x4f')]=function(_0x1ea526,_0x493553,_0x598a3f){return db[_0x2362('0x2d')][_0x2362('0x4e')]({'where':{'id':_0x1ea526[_0x2362('0x46')]['id']},'attributes':[_0x2362('0x2a'),'basename',_0x2362('0x50'),_0x2362('0x51')],'raw':!![]})[_0x2362('0x27')](handleEntityNotFound(_0x493553,null))[_0x2362('0x27')](function(_0x20aa93){if(_0x20aa93){if(!fs['existsSync'](path[_0x2362('0x52')](config[_0x2362('0x53')],_0x2362('0x54'),_0x20aa93['savename']))){throw new db[(_0x2362('0x55'))][(_0x2362('0x56'))]('Report\x20not\x20found\x20or\x20empty');}if(_0x1ea526[_0x2362('0x31')][_0x2362('0x57')]){return _0x493553[_0x2362('0x58')](0xc8);}return _0x493553[_0x2362('0x4f')](path[_0x2362('0x52')](config[_0x2362('0x53')],_0x2362('0x54'),_0x20aa93[_0x2362('0x50')]),util[_0x2362('0x59')](_0x2362('0x5a'),_0x20aa93[_0x2362('0x5b')]||_0x20aa93[_0x2362('0x2a')],_0x20aa93[_0x2362('0x51')][_0x2362('0x5c')]()));}})[_0x2362('0x45')](handleError(_0x493553,null));}; \ No newline at end of file +var _0x1370=['basename','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','limit','undefined','count','offset','Content-Range','apply','reject','save','then','get','UserProfileResource','destroy','stack','send','index','map','AnalyticExtractedReport','rawAttributes','fieldName','type','key','model','name','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','find','catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','ExtractedReports','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','download','savename','existsSync','join','root','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','%s.%s'];(function(_0x1367db,_0x18b809){var _0x380e1d=function(_0x256e8c){while(--_0x256e8c){_0x1367db['push'](_0x1367db['shift']());}};_0x380e1d(++_0x18b809);}(_0x1370,0x1dc));var _0x0137=function(_0x1a2d1c,_0x4a1873){_0x1a2d1c=_0x1a2d1c-0x0;var _0x56eb67=_0x1370[_0x1a2d1c];return _0x56eb67;};'use strict';var emlformat=require(_0x0137('0x0'));var rimraf=require(_0x0137('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0137('0x2'));var rp=require('request-promise');var moment=require(_0x0137('0x3'));var BPromise=require(_0x0137('0x4'));var Mustache=require(_0x0137('0x5'));var util=require('util');var path=require(_0x0137('0x6'));var sox=require(_0x0137('0x7'));var csv=require(_0x0137('0x8'));var ejs=require(_0x0137('0x9'));var fs=require('fs');var fs_extra=require(_0x0137('0xa'));var _=require(_0x0137('0xb'));var squel=require(_0x0137('0xc'));var crypto=require(_0x0137('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x0137('0xe'));var toCsv=require(_0x0137('0x8'));var querystring=require('querystring');var Papa=require(_0x0137('0xf'));var Redis=require(_0x0137('0x10'));var authService=require(_0x0137('0x11'));var qs=require(_0x0137('0x12'));var as=require(_0x0137('0x13'));var hardwareService=require(_0x0137('0x14'));var logger=require(_0x0137('0x15'))(_0x0137('0x16'));var utils=require(_0x0137('0x17'));var config=require(_0x0137('0x18'));var licenseUtil=require(_0x0137('0x19'));var db=require(_0x0137('0x1a'))['db'];function respondWithStatusCode(_0x1b7635,_0x3771ba){_0x3771ba=_0x3771ba||0xcc;return function(_0x137b3d){if(_0x137b3d){return _0x1b7635[_0x0137('0x1b')](_0x3771ba);}return _0x1b7635['status'](_0x3771ba)[_0x0137('0x1c')]();};}function respondWithResult(_0x68ae70,_0x2a3264){_0x2a3264=_0x2a3264||0xc8;return function(_0x1b3d76){if(_0x1b3d76){return _0x68ae70[_0x0137('0x1d')](_0x2a3264)[_0x0137('0x1e')](_0x1b3d76);}};}function respondWithFilteredResult(_0x3f9ebb,_0x519538){return function(_0x57e51d){if(_0x57e51d){var _0x1ee3d7=typeof _0x519538['offset']==='undefined'&&typeof _0x519538[_0x0137('0x1f')]===_0x0137('0x20');var _0x49bfd3=_0x57e51d[_0x0137('0x21')];var _0x4aaf67=_0x1ee3d7?0x0:_0x519538['offset'];var _0xcba097=_0x1ee3d7?_0x57e51d[_0x0137('0x21')]:_0x519538[_0x0137('0x22')]+_0x519538[_0x0137('0x1f')];var _0x11a79a;if(_0xcba097>=_0x49bfd3){_0xcba097=_0x49bfd3;_0x11a79a=0xc8;}else{_0x11a79a=0xce;}_0x3f9ebb[_0x0137('0x1d')](_0x11a79a);return _0x3f9ebb['set'](_0x0137('0x23'),_0x4aaf67+'-'+_0xcba097+'/'+_0x49bfd3)[_0x0137('0x1e')](_0x57e51d);}return null;};}function patchUpdates(_0x36c0ef){return function(_0x8dae82){try{jsonpatch[_0x0137('0x24')](_0x8dae82,_0x36c0ef,!![]);}catch(_0xdb96a1){return BPromise[_0x0137('0x25')](_0xdb96a1);}return _0x8dae82[_0x0137('0x26')]();};}function saveUpdates(_0x4f9592,_0x4cd829){return function(_0x39f307){if(_0x39f307){return _0x39f307['update'](_0x4f9592)[_0x0137('0x27')](function(_0x4057a8){return _0x4057a8;});}return null;};}function removeEntity(_0x3865c0,_0xd5293f){return function(_0x5a67fa){if(_0x5a67fa){return _0x5a67fa['destroy']()['then'](function(){var _0x3c30f1=_0x5a67fa[_0x0137('0x28')]({'plain':!![]});var _0x466e14='ExtractedReports';return db[_0x0137('0x29')][_0x0137('0x2a')]({'where':{'type':_0x466e14,'resourceId':_0x3c30f1['id']}})['then'](function(){return _0x5a67fa;});})[_0x0137('0x27')](function(){_0x3865c0[_0x0137('0x1d')](0xcc)[_0x0137('0x1c')]();});}};}function handleEntityNotFound(_0x4cde44,_0x5d1f50){return function(_0x378af9){if(!_0x378af9){_0x4cde44[_0x0137('0x1b')](0x194);}return _0x378af9;};}function handleError(_0x1b422b,_0xc2a9e2){_0xc2a9e2=_0xc2a9e2||0x1f4;return function(_0x27df50){logger['error'](_0x27df50[_0x0137('0x2b')]);if(_0x27df50['name']){delete _0x27df50['name'];}_0x1b422b[_0x0137('0x1d')](_0xc2a9e2)[_0x0137('0x2c')](_0x27df50);};}exports[_0x0137('0x2d')]=function(_0x4bbecd,_0x119d37){var _0x504bbd={},_0x517a3a={},_0x57067f={'count':0x0,'rows':[]};var _0x35bda6=_[_0x0137('0x2e')](db[_0x0137('0x2f')][_0x0137('0x30')],function(_0x4a5239){return{'name':_0x4a5239[_0x0137('0x31')],'type':_0x4a5239[_0x0137('0x32')][_0x0137('0x33')]};});_0x517a3a[_0x0137('0x34')]=_['map'](_0x35bda6,_0x0137('0x35'));_0x517a3a['query']=_[_0x0137('0x36')](_0x4bbecd['query']);_0x517a3a[_0x0137('0x37')]=_[_0x0137('0x38')](_0x517a3a[_0x0137('0x34')],_0x517a3a[_0x0137('0x39')]);_0x504bbd[_0x0137('0x3a')]=_[_0x0137('0x38')](_0x517a3a[_0x0137('0x34')],qs[_0x0137('0x3b')](_0x4bbecd[_0x0137('0x39')]['fields']));_0x504bbd[_0x0137('0x3a')]=_0x504bbd['attributes'][_0x0137('0x3c')]?_0x504bbd['attributes']:_0x517a3a[_0x0137('0x34')];if(!_0x4bbecd[_0x0137('0x39')][_0x0137('0x3d')](_0x0137('0x3e'))){_0x504bbd['limit']=qs[_0x0137('0x1f')](_0x4bbecd[_0x0137('0x39')][_0x0137('0x1f')]);_0x504bbd[_0x0137('0x22')]=qs['offset'](_0x4bbecd[_0x0137('0x39')]['offset']);}_0x504bbd['order']=qs[_0x0137('0x3f')](_0x4bbecd[_0x0137('0x39')][_0x0137('0x3f')]);_0x504bbd[_0x0137('0x40')]=qs['filters'](_[_0x0137('0x41')](_0x4bbecd['query'],_0x517a3a[_0x0137('0x37')]),_0x35bda6);if(_0x4bbecd['query'][_0x0137('0x42')]){_0x504bbd[_0x0137('0x40')]=_[_0x0137('0x43')](_0x504bbd[_0x0137('0x40')],{'$or':_['map'](_0x35bda6,function(_0x553834){if(_0x553834[_0x0137('0x32')]!==_0x0137('0x44')){var _0x12708b={};_0x12708b[_0x553834[_0x0137('0x35')]]={'$like':'%'+_0x4bbecd['query'][_0x0137('0x42')]+'%'};return _0x12708b;}})});}_0x504bbd=_[_0x0137('0x43')]({},_0x504bbd,_0x4bbecd[_0x0137('0x45')]);var _0x461d46={'where':_0x504bbd[_0x0137('0x40')]};return db[_0x0137('0x2f')][_0x0137('0x21')](_0x461d46)['then'](function(_0x2b6f44){_0x57067f['count']=_0x2b6f44;if(_0x4bbecd[_0x0137('0x39')][_0x0137('0x46')]){_0x504bbd[_0x0137('0x47')]=[{'all':!![]}];}return db[_0x0137('0x2f')][_0x0137('0x48')](_0x504bbd);})[_0x0137('0x27')](function(_0x550aab){_0x57067f[_0x0137('0x49')]=_0x550aab;return _0x57067f;})[_0x0137('0x27')](respondWithFilteredResult(_0x119d37,_0x504bbd))['catch'](handleError(_0x119d37,null));};exports['show']=function(_0x57f8a3,_0x456487){var _0x57712c={'raw':!![],'where':{'id':_0x57f8a3[_0x0137('0x4a')]['id']}},_0x1eaf73={};_0x1eaf73['model']=_[_0x0137('0x36')](db[_0x0137('0x2f')][_0x0137('0x30')]);_0x1eaf73[_0x0137('0x39')]=_['keys'](_0x57f8a3[_0x0137('0x39')]);_0x1eaf73[_0x0137('0x37')]=_[_0x0137('0x38')](_0x1eaf73['model'],_0x1eaf73['query']);_0x57712c[_0x0137('0x3a')]=_[_0x0137('0x38')](_0x1eaf73[_0x0137('0x34')],qs[_0x0137('0x3b')](_0x57f8a3[_0x0137('0x39')]['fields']));_0x57712c[_0x0137('0x3a')]=_0x57712c[_0x0137('0x3a')]['length']?_0x57712c[_0x0137('0x3a')]:_0x1eaf73[_0x0137('0x34')];if(_0x57f8a3[_0x0137('0x39')]['includeAll']){_0x57712c[_0x0137('0x47')]=[{'all':!![]}];}_0x57712c=_['merge']({},_0x57712c,_0x57f8a3[_0x0137('0x45')]);return db[_0x0137('0x2f')][_0x0137('0x4b')](_0x57712c)[_0x0137('0x27')](handleEntityNotFound(_0x456487,null))['then'](respondWithResult(_0x456487,null))[_0x0137('0x4c')](handleError(_0x456487,null));};exports[_0x0137('0x4d')]=function(_0x161187,_0x2dc372){return db[_0x0137('0x2f')][_0x0137('0x4d')](_0x161187['body'],{})[_0x0137('0x27')](function(_0x360e85){var _0x2511d7=_0x161187['user'][_0x0137('0x28')]({'plain':!![]});if(!_0x2511d7)throw new Error(_0x0137('0x4e'));if(_0x2511d7['role']===_0x0137('0x4f')){var _0x53e4d=_0x360e85[_0x0137('0x28')]({'plain':!![]});var _0x22453f=_0x0137('0x50');return db['UserProfileSection'][_0x0137('0x4b')]({'where':{'name':_0x22453f,'userProfileId':_0x2511d7['userProfileId']},'raw':!![]})[_0x0137('0x27')](function(_0x495cf2){if(_0x495cf2&&_0x495cf2[_0x0137('0x51')]===0x0){return db[_0x0137('0x29')][_0x0137('0x4d')]({'name':_0x53e4d['name'],'resourceId':_0x53e4d['id'],'type':_0x495cf2['name'],'sectionId':_0x495cf2['id']},{})[_0x0137('0x27')](function(){return _0x360e85;});}else{return _0x360e85;}})[_0x0137('0x4c')](function(_0x33d4ce){logger[_0x0137('0x52')](_0x0137('0x53'),_0x33d4ce);throw _0x33d4ce;});}return _0x360e85;})[_0x0137('0x27')](respondWithResult(_0x2dc372,0xc9))[_0x0137('0x4c')](handleError(_0x2dc372,null));};exports['update']=function(_0x5d193a,_0x3d5b84){if(_0x5d193a[_0x0137('0x54')]['id']){delete _0x5d193a['body']['id'];}return db[_0x0137('0x2f')][_0x0137('0x4b')]({'where':{'id':_0x5d193a[_0x0137('0x4a')]['id']}})[_0x0137('0x27')](handleEntityNotFound(_0x3d5b84,null))[_0x0137('0x27')](saveUpdates(_0x5d193a[_0x0137('0x54')],null))[_0x0137('0x27')](respondWithResult(_0x3d5b84,null))[_0x0137('0x4c')](handleError(_0x3d5b84,null));};exports[_0x0137('0x2a')]=function(_0x4fb0b2,_0x111e70){return db[_0x0137('0x2f')][_0x0137('0x4b')]({'where':{'id':_0x4fb0b2['params']['id']}})['then'](handleEntityNotFound(_0x111e70,null))[_0x0137('0x27')](removeEntity(_0x111e70,null))['catch'](handleError(_0x111e70,null));};exports[_0x0137('0x55')]=function(_0x1a86c3,_0x347e6c,_0x515497){return db['AnalyticExtractedReport']['find']({'where':{'id':_0x1a86c3['params']['id']},'attributes':[_0x0137('0x35'),'basename',_0x0137('0x56'),'output'],'raw':!![]})[_0x0137('0x27')](handleEntityNotFound(_0x347e6c,null))[_0x0137('0x27')](function(_0x38b397){if(_0x38b397){if(!fs[_0x0137('0x57')](path[_0x0137('0x58')](config[_0x0137('0x59')],'server/files/reports',_0x38b397['savename']))){throw new db['Sequelize'][(_0x0137('0x5a'))](_0x0137('0x5b'));}if(_0x1a86c3[_0x0137('0x39')][_0x0137('0x5c')]){return _0x347e6c['sendStatus'](0xc8);}return _0x347e6c[_0x0137('0x55')](path[_0x0137('0x58')](config['root'],'server/files/reports',_0x38b397[_0x0137('0x56')]),util['format'](_0x0137('0x5d'),_0x38b397[_0x0137('0x5e')]||_0x38b397[_0x0137('0x35')],_0x38b397['output']['toLowerCase']()));}})[_0x0137('0x4c')](handleError(_0x347e6c,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 4fa8461..8f2fa1e 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 _0xfbfd=['AnalyticExtractedReport','analytics_extracted_reports','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./analyticExtractedReport.attributes','exports','define'];(function(_0x37b259,_0x476fe9){var _0xac9aaf=function(_0x1cee8a){while(--_0x1cee8a){_0x37b259['push'](_0x37b259['shift']());}};_0xac9aaf(++_0x476fe9);}(_0xfbfd,0x12d));var _0xdfbf=function(_0x314efa,_0x4bca01){_0x314efa=_0x314efa-0x0;var _0x4a867e=_0xfbfd[_0x314efa];return _0x4a867e;};'use strict';var _=require(_0xdfbf('0x0'));var util=require(_0xdfbf('0x1'));var logger=require(_0xdfbf('0x2'))(_0xdfbf('0x3'));var moment=require(_0xdfbf('0x4'));var BPromise=require(_0xdfbf('0x5'));var rp=require(_0xdfbf('0x6'));var fs=require('fs');var path=require(_0xdfbf('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xdfbf('0x8'));module[_0xdfbf('0x9')]=function(_0x369dc1,_0x3b391a){return _0x369dc1[_0xdfbf('0xa')](_0xdfbf('0xb'),attributes,{'tableName':_0xdfbf('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x71fb=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport','analytics_extracted_reports','lodash','util','api'];(function(_0x282999,_0x4df660){var _0x30681f=function(_0x50e926){while(--_0x50e926){_0x282999['push'](_0x282999['shift']());}};_0x30681f(++_0x4df660);}(_0x71fb,0x14d));var _0xb71f=function(_0x5bd3f1,_0x57864a){_0x5bd3f1=_0x5bd3f1-0x0;var _0x12b904=_0x71fb[_0x5bd3f1];return _0x12b904;};'use strict';var _=require(_0xb71f('0x0'));var util=require(_0xb71f('0x1'));var logger=require('../../config/logger')(_0xb71f('0x2'));var moment=require(_0xb71f('0x3'));var BPromise=require(_0xb71f('0x4'));var rp=require(_0xb71f('0x5'));var fs=require('fs');var path=require(_0xb71f('0x6'));var rimraf=require(_0xb71f('0x7'));var config=require(_0xb71f('0x8'));var attributes=require(_0xb71f('0x9'));module[_0xb71f('0xa')]=function(_0x1435a9,_0x47717f){return _0x1435a9[_0xb71f('0xb')](_0xb71f('0xc'),attributes,{'tableName':_0xb71f('0xd'),'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 1272e3e..cbdbd7a 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 _0x8148=['AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','request','info'];(function(_0x42e25e,_0x46cfd1){var _0x1ed3a6=function(_0x3558e8){while(--_0x3558e8){_0x42e25e['push'](_0x42e25e['shift']());}};_0x1ed3a6(++_0x46cfd1);}(_0x8148,0x117));var _0x8814=function(_0x6ad670,_0x43ed06){_0x6ad670=_0x6ad670-0x0;var _0x2be23e=_0x8148[_0x6ad670];return _0x2be23e;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x8814('0x0'));var rs=require(_0x8814('0x1'));var fs=require('fs');var Redis=require(_0x8814('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x8814('0x3'));var logger=require('../../config/logger')(_0x8814('0x4'));var config=require(_0x8814('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x8814('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x8bca9c,_0x557b20,_0x52c11b){return new BPromise(function(_0x1f32c8,_0x817a18){return client[_0x8814('0x7')](_0x8bca9c,_0x52c11b)['then'](function(_0x443f24){logger[_0x8814('0x8')](_0x8814('0x9'),_0x557b20,_0x8814('0xa'));logger[_0x8814('0xb')](_0x8814('0xc'),_0x557b20,_0x8814('0xa'),JSON[_0x8814('0xd')](_0x443f24));if(_0x443f24[_0x8814('0xe')]){if(_0x443f24['error']['code']===0x1f4){logger['error'](_0x8814('0x9'),_0x557b20,_0x443f24[_0x8814('0xe')][_0x8814('0xf')]);return _0x817a18(_0x443f24[_0x8814('0xe')][_0x8814('0xf')]);}logger[_0x8814('0xe')](_0x8814('0x9'),_0x557b20,_0x443f24[_0x8814('0xe')][_0x8814('0xf')]);return _0x1f32c8(_0x443f24[_0x8814('0xe')][_0x8814('0xf')]);}else{logger['info'](_0x8814('0x9'),_0x557b20,_0x8814('0xa'));_0x1f32c8(_0x443f24[_0x8814('0x10')][_0x8814('0xf')]);}})[_0x8814('0x11')](function(_0x18ed48){logger[_0x8814('0xe')](_0x8814('0x9'),_0x557b20,_0x18ed48);_0x817a18(_0x18ed48);});});} \ No newline at end of file +var _0x42ec=['AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info'];(function(_0x3cc64d,_0x51b49c){var _0x567522=function(_0x1df776){while(--_0x1df776){_0x3cc64d['push'](_0x3cc64d['shift']());}};_0x567522(++_0x51b49c);}(_0x42ec,0x1bf));var _0xc42e=function(_0x4bb29a,_0x368b43){_0x4bb29a=_0x4bb29a-0x0;var _0x20770a=_0x42ec[_0x4bb29a];return _0x20770a;};'use strict';var _=require('lodash');var util=require(_0xc42e('0x0'));var moment=require(_0xc42e('0x1'));var BPromise=require(_0xc42e('0x2'));var rs=require(_0xc42e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc42e('0x4'));var logger=require(_0xc42e('0x5'))(_0xc42e('0x6'));var config=require(_0xc42e('0x7'));var jayson=require(_0xc42e('0x8'));var client=jayson[_0xc42e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x43977a,_0x31fc77,_0x113847){return new BPromise(function(_0x5c726b,_0x3130d7){return client[_0xc42e('0xa')](_0x43977a,_0x113847)[_0xc42e('0xb')](function(_0x164298){logger[_0xc42e('0xc')](_0xc42e('0xd'),_0x31fc77,_0xc42e('0xe'));logger['debug']('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x31fc77,_0xc42e('0xe'),JSON[_0xc42e('0xf')](_0x164298));if(_0x164298[_0xc42e('0x10')]){if(_0x164298[_0xc42e('0x10')][_0xc42e('0x11')]===0x1f4){logger[_0xc42e('0x10')](_0xc42e('0xd'),_0x31fc77,_0x164298[_0xc42e('0x10')][_0xc42e('0x12')]);return _0x3130d7(_0x164298[_0xc42e('0x10')][_0xc42e('0x12')]);}logger[_0xc42e('0x10')](_0xc42e('0xd'),_0x31fc77,_0x164298[_0xc42e('0x10')][_0xc42e('0x12')]);return _0x5c726b(_0x164298['error'][_0xc42e('0x12')]);}else{logger[_0xc42e('0xc')](_0xc42e('0xd'),_0x31fc77,'request\x20sent');_0x5c726b(_0x164298[_0xc42e('0x13')][_0xc42e('0x12')]);}})['catch'](function(_0xf366cd){logger[_0xc42e('0x10')](_0xc42e('0xd'),_0x31fc77,_0xf366cd);_0x3130d7(_0xf366cd);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 591261c..cd0ef36 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 _0x58f7=['/:id/download','download','create','put','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticExtractedReport.controller','get','isAuthenticated','index','/:id','show'];(function(_0xe1a964,_0x5ec09d){var _0x3de37b=function(_0x406ffc){while(--_0x406ffc){_0xe1a964['push'](_0xe1a964['shift']());}};_0x3de37b(++_0x5ec09d);}(_0x58f7,0x183));var _0x758f=function(_0x583907,_0xd2e4b4){_0x583907=_0x583907-0x0;var _0x247526=_0x58f7[_0x583907];return _0x247526;};'use strict';var multer=require('multer');var util=require(_0x758f('0x0'));var path=require('path');var timeout=require(_0x758f('0x1'));var express=require(_0x758f('0x2'));var router=express[_0x758f('0x3')]();var fs_extra=require(_0x758f('0x4'));var auth=require(_0x758f('0x5'));var interaction=require(_0x758f('0x6'));var config=require('../../config/environment');var controller=require(_0x758f('0x7'));router[_0x758f('0x8')]('/',auth[_0x758f('0x9')](),controller[_0x758f('0xa')]);router['get'](_0x758f('0xb'),auth[_0x758f('0x9')](),controller[_0x758f('0xc')]);router[_0x758f('0x8')](_0x758f('0xd'),auth[_0x758f('0x9')](),controller[_0x758f('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x758f('0xf')]);router[_0x758f('0x10')](_0x758f('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x758f('0x11')](_0x758f('0xb'),auth['isAuthenticated'](),controller[_0x758f('0x12')]);module[_0x758f('0x13')]=router; \ No newline at end of file +var _0x4181=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','index','download','create','put'];(function(_0x59de9f,_0x32b173){var _0x2e7611=function(_0x16a092){while(--_0x16a092){_0x59de9f['push'](_0x59de9f['shift']());}};_0x2e7611(++_0x32b173);}(_0x4181,0x1df));var _0x1418=function(_0xfbf494,_0x166255){_0xfbf494=_0xfbf494-0x0;var _0x3081d0=_0x4181[_0xfbf494];return _0x3081d0;};'use strict';var multer=require(_0x1418('0x0'));var util=require(_0x1418('0x1'));var path=require(_0x1418('0x2'));var timeout=require(_0x1418('0x3'));var express=require(_0x1418('0x4'));var router=express[_0x1418('0x5')]();var fs_extra=require(_0x1418('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1418('0x7'));var controller=require(_0x1418('0x8'));router[_0x1418('0x9')]('/',auth[_0x1418('0xa')](),controller[_0x1418('0xb')]);router[_0x1418('0x9')]('/:id',auth[_0x1418('0xa')](),controller['show']);router[_0x1418('0x9')]('/:id/download',auth[_0x1418('0xa')](),controller[_0x1418('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1418('0xd')]);router[_0x1418('0xe')]('/:id',auth[_0x1418('0xa')](),controller[_0x1418('0xf')]);router[_0x1418('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x1418('0x11')]);module[_0x1418('0x12')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index cbb3948..ed79627 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 _0x517f=['STRING','BOOLEAN'];(function(_0x365bd6,_0x2513de){var _0x510c91=function(_0x4298f2){while(--_0x4298f2){_0x365bd6['push'](_0x365bd6['shift']());}};_0x510c91(++_0x2513de);}(_0x517f,0xfa));var _0xf517=function(_0x468b0f,_0x408566){_0x468b0f=_0x468b0f-0x0;var _0x3e74d9=_0x517f[_0x468b0f];return _0x3e74d9;};'use strict';var Sequelize=require('sequelize');module['exports']={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize[_0xf517('0x0')]},'format':{'type':Sequelize['STRING']},'groupBy':{'type':Sequelize[_0xf517('0x1')],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize[_0xf517('0x1')],'defaultValue':![]}}; \ No newline at end of file +var _0x55cb=['STRING','BOOLEAN','exports'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0x55cb,0x16a));var _0xb55c=function(_0x20229e,_0xa59f8a){_0x20229e=_0x20229e-0x0;var _0x317377=_0x55cb[_0x20229e];return _0x317377;};'use strict';var Sequelize=require('sequelize');module[_0xb55c('0x0')]={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize[_0xb55c('0x1')]},'function':{'type':Sequelize[_0xb55c('0x1')]},'format':{'type':Sequelize[_0xb55c('0x1')]},'groupBy':{'type':Sequelize[_0xb55c('0x2')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xb55c('0x1')]},'custom':{'type':Sequelize[_0xb55c('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 2567fc0..f0280ab 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 _0xf165=['jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','rawAttributes','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','AnalyticFieldReport','includeAll','include','findAll','catch','show','params','keys','find','create','body','bulkCreate','bulkDestroy','ids','addFields','AnalyticCustomReport','findOne','transaction','CustomReportId','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto'];(function(_0x55fd56,_0x2e8122){var _0x2f4320=function(_0x10fd4b){while(--_0x10fd4b){_0x55fd56['push'](_0x55fd56['shift']());}};_0x2f4320(++_0x2e8122);}(_0xf165,0x149));var _0x5f16=function(_0x437fb4,_0x184994){_0x437fb4=_0x437fb4-0x0;var _0x472dc7=_0xf165[_0x437fb4];return _0x472dc7;};'use strict';var emlformat=require(_0x5f16('0x0'));var rimraf=require(_0x5f16('0x1'));var zipdir=require(_0x5f16('0x2'));var jsonpatch=require(_0x5f16('0x3'));var rp=require(_0x5f16('0x4'));var moment=require(_0x5f16('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x5f16('0x6'));var util=require(_0x5f16('0x7'));var path=require(_0x5f16('0x8'));var sox=require('sox');var csv=require(_0x5f16('0x9'));var ejs=require(_0x5f16('0xa'));var fs=require('fs');var fs_extra=require(_0x5f16('0xb'));var _=require(_0x5f16('0xc'));var squel=require(_0x5f16('0xd'));var crypto=require(_0x5f16('0xe'));var jsforce=require(_0x5f16('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x5f16('0x9'));var querystring=require('querystring');var Papa=require(_0x5f16('0x10'));var Redis=require(_0x5f16('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x5f16('0x12'));var as=require(_0x5f16('0x13'));var hardwareService=require(_0x5f16('0x14'));var logger=require(_0x5f16('0x15'))(_0x5f16('0x16'));var utils=require(_0x5f16('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x5f16('0x18'));var db=require(_0x5f16('0x19'))['db'];function respondWithStatusCode(_0x3637f2,_0xdd9fb2){_0xdd9fb2=_0xdd9fb2||0xcc;return function(_0x5b96a9){if(_0x5b96a9){return _0x3637f2[_0x5f16('0x1a')](_0xdd9fb2);}return _0x3637f2[_0x5f16('0x1b')](_0xdd9fb2)['end']();};}function respondWithResult(_0xf53444,_0x2dcd53){_0x2dcd53=_0x2dcd53||0xc8;return function(_0xeb33d0){if(_0xeb33d0){return _0xf53444[_0x5f16('0x1b')](_0x2dcd53)[_0x5f16('0x1c')](_0xeb33d0);}};}function respondWithFilteredResult(_0x51f20e,_0x4c8654){return function(_0x422d85){if(_0x422d85){var _0x10a7de=typeof _0x4c8654[_0x5f16('0x1d')]===_0x5f16('0x1e')&&typeof _0x4c8654[_0x5f16('0x1f')]===_0x5f16('0x1e');var _0x472e8b=_0x422d85[_0x5f16('0x20')];var _0x927c59=_0x10a7de?0x0:_0x4c8654[_0x5f16('0x1d')];var _0x3e5ade=_0x10a7de?_0x422d85[_0x5f16('0x20')]:_0x4c8654[_0x5f16('0x1d')]+_0x4c8654[_0x5f16('0x1f')];var _0x1d7b8d;if(_0x3e5ade>=_0x472e8b){_0x3e5ade=_0x472e8b;_0x1d7b8d=0xc8;}else{_0x1d7b8d=0xce;}_0x51f20e[_0x5f16('0x1b')](_0x1d7b8d);return _0x51f20e[_0x5f16('0x21')](_0x5f16('0x22'),_0x927c59+'-'+_0x3e5ade+'/'+_0x472e8b)[_0x5f16('0x1c')](_0x422d85);}return null;};}function patchUpdates(_0xe61df6){return function(_0x1838fa){try{jsonpatch[_0x5f16('0x23')](_0x1838fa,_0xe61df6,!![]);}catch(_0x248615){return BPromise[_0x5f16('0x24')](_0x248615);}return _0x1838fa[_0x5f16('0x25')]();};}function saveUpdates(_0x16e422,_0x563a47){return function(_0x5c2a68){if(_0x5c2a68){return _0x5c2a68[_0x5f16('0x26')](_0x16e422)[_0x5f16('0x27')](function(_0x23620f){return _0x23620f;});}return null;};}function removeEntity(_0x8ffcf0,_0x34ffc9){return function(_0x165ebe){if(_0x165ebe){return _0x165ebe[_0x5f16('0x28')]()[_0x5f16('0x27')](function(){_0x8ffcf0['status'](0xcc)[_0x5f16('0x29')]();});}};}function handleEntityNotFound(_0x8a5fb,_0x2477d3){return function(_0x2bcf1d){if(!_0x2bcf1d){_0x8a5fb[_0x5f16('0x1a')](0x194);}return _0x2bcf1d;};}function handleError(_0x1a4572,_0x1e3ac1){_0x1e3ac1=_0x1e3ac1||0x1f4;return function(_0x5bb090){logger[_0x5f16('0x2a')](_0x5bb090[_0x5f16('0x2b')]);if(_0x5bb090['name']){delete _0x5bb090[_0x5f16('0x2c')];}_0x1a4572[_0x5f16('0x1b')](_0x1e3ac1)[_0x5f16('0x2d')](_0x5bb090);};}exports[_0x5f16('0x2e')]=function(_0x4f545b,_0x590545){var _0x51f7ed={},_0x365b71={},_0x2f4064={'count':0x0,'rows':[]};var _0x37dad0=_[_0x5f16('0x2f')](db['AnalyticFieldReport'][_0x5f16('0x30')],function(_0x12e6fe){return{'name':_0x12e6fe['fieldName'],'type':_0x12e6fe[_0x5f16('0x31')]['key']};});_0x365b71[_0x5f16('0x32')]=_['map'](_0x37dad0,'name');_0x365b71[_0x5f16('0x33')]=_['keys'](_0x4f545b[_0x5f16('0x33')]);_0x365b71[_0x5f16('0x34')]=_[_0x5f16('0x35')](_0x365b71[_0x5f16('0x32')],_0x365b71[_0x5f16('0x33')]);_0x51f7ed[_0x5f16('0x36')]=_[_0x5f16('0x35')](_0x365b71[_0x5f16('0x32')],qs['fields'](_0x4f545b['query'][_0x5f16('0x37')]));_0x51f7ed[_0x5f16('0x36')]=_0x51f7ed['attributes'][_0x5f16('0x38')]?_0x51f7ed['attributes']:_0x365b71[_0x5f16('0x32')];if(!_0x4f545b['query'][_0x5f16('0x39')](_0x5f16('0x3a'))){_0x51f7ed[_0x5f16('0x1f')]=qs['limit'](_0x4f545b[_0x5f16('0x33')][_0x5f16('0x1f')]);_0x51f7ed[_0x5f16('0x1d')]=qs['offset'](_0x4f545b[_0x5f16('0x33')][_0x5f16('0x1d')]);}_0x51f7ed[_0x5f16('0x3b')]=qs[_0x5f16('0x3c')](_0x4f545b['query'][_0x5f16('0x3c')]);_0x51f7ed[_0x5f16('0x3d')]=qs[_0x5f16('0x34')](_[_0x5f16('0x3e')](_0x4f545b[_0x5f16('0x33')],_0x365b71[_0x5f16('0x34')]),_0x37dad0);if(_0x4f545b[_0x5f16('0x33')]['filter']){_0x51f7ed[_0x5f16('0x3d')]=_[_0x5f16('0x3f')](_0x51f7ed[_0x5f16('0x3d')],{'$or':_['map'](_0x37dad0,function(_0xd450de){if(_0xd450de[_0x5f16('0x31')]!==_0x5f16('0x40')){var _0x1452f7={};_0x1452f7[_0xd450de[_0x5f16('0x2c')]]={'$like':'%'+_0x4f545b[_0x5f16('0x33')][_0x5f16('0x41')]+'%'};return _0x1452f7;}})});}_0x51f7ed=_[_0x5f16('0x3f')]({},_0x51f7ed,_0x4f545b[_0x5f16('0x42')]);var _0x1c1b22={'where':_0x51f7ed[_0x5f16('0x3d')]};return db[_0x5f16('0x43')][_0x5f16('0x20')](_0x1c1b22)[_0x5f16('0x27')](function(_0x50a5f3){_0x2f4064[_0x5f16('0x20')]=_0x50a5f3;if(_0x4f545b[_0x5f16('0x33')][_0x5f16('0x44')]){_0x51f7ed[_0x5f16('0x45')]=[{'all':!![]}];}return db[_0x5f16('0x43')][_0x5f16('0x46')](_0x51f7ed);})[_0x5f16('0x27')](function(_0x5865c6){_0x2f4064['rows']=_0x5865c6;return _0x2f4064;})[_0x5f16('0x27')](respondWithFilteredResult(_0x590545,_0x51f7ed))[_0x5f16('0x47')](handleError(_0x590545,null));};exports[_0x5f16('0x48')]=function(_0x350a37,_0x2e566d){var _0x562e46={'raw':![],'where':{'id':_0x350a37[_0x5f16('0x49')]['id']}},_0x347e03={};_0x347e03[_0x5f16('0x32')]=_[_0x5f16('0x4a')](db['AnalyticFieldReport']['rawAttributes']);_0x347e03[_0x5f16('0x33')]=_['keys'](_0x350a37[_0x5f16('0x33')]);_0x347e03[_0x5f16('0x34')]=_['intersection'](_0x347e03[_0x5f16('0x32')],_0x347e03[_0x5f16('0x33')]);_0x562e46[_0x5f16('0x36')]=_['intersection'](_0x347e03['model'],qs[_0x5f16('0x37')](_0x350a37[_0x5f16('0x33')][_0x5f16('0x37')]));_0x562e46[_0x5f16('0x36')]=_0x562e46[_0x5f16('0x36')][_0x5f16('0x38')]?_0x562e46[_0x5f16('0x36')]:_0x347e03[_0x5f16('0x32')];if(_0x350a37[_0x5f16('0x33')]['includeAll']){_0x562e46[_0x5f16('0x45')]=[{'all':!![]}];}_0x562e46=_[_0x5f16('0x3f')]({},_0x562e46,_0x350a37['options']);return db[_0x5f16('0x43')][_0x5f16('0x4b')](_0x562e46)[_0x5f16('0x27')](handleEntityNotFound(_0x2e566d,null))[_0x5f16('0x27')](respondWithResult(_0x2e566d,null))['catch'](handleError(_0x2e566d,null));};exports[_0x5f16('0x4c')]=function(_0x272df1,_0x15470d){return db[_0x5f16('0x43')][_0x5f16('0x4c')](_0x272df1[_0x5f16('0x4d')],{})[_0x5f16('0x27')](respondWithResult(_0x15470d,0xc9))[_0x5f16('0x47')](handleError(_0x15470d,null));};exports[_0x5f16('0x4e')]=function(_0x1956d4,_0x237f6d){return db[_0x5f16('0x43')][_0x5f16('0x4e')](_0x1956d4[_0x5f16('0x4d')],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x237f6d,0xc9))['catch'](handleError(_0x237f6d,null));};exports['update']=function(_0x2e6c07,_0x2d7c93){if(_0x2e6c07[_0x5f16('0x4d')]['id']){delete _0x2e6c07[_0x5f16('0x4d')]['id'];}return db[_0x5f16('0x43')][_0x5f16('0x4b')]({'where':{'id':_0x2e6c07['params']['id']}})['then'](handleEntityNotFound(_0x2d7c93,null))[_0x5f16('0x27')](saveUpdates(_0x2e6c07[_0x5f16('0x4d')],null))[_0x5f16('0x27')](respondWithResult(_0x2d7c93,null))[_0x5f16('0x47')](handleError(_0x2d7c93,null));};exports['destroy']=function(_0x1b75f1,_0x16ad8d){return db[_0x5f16('0x43')][_0x5f16('0x4b')]({'where':{'id':_0x1b75f1[_0x5f16('0x49')]['id']}})[_0x5f16('0x27')](handleEntityNotFound(_0x16ad8d,null))[_0x5f16('0x27')](removeEntity(_0x16ad8d,null))[_0x5f16('0x47')](handleError(_0x16ad8d,null));};exports[_0x5f16('0x4f')]=function(_0x11da5a,_0x31d74e){return db[_0x5f16('0x43')][_0x5f16('0x28')]({'where':{'id':_0x11da5a[_0x5f16('0x33')][_0x5f16('0x50')]||[]},'raw':![],'individualHooks':!![]})[_0x5f16('0x27')](respondWithResult(_0x31d74e,0xcc))[_0x5f16('0x47')](handleError(_0x31d74e,null));};exports[_0x5f16('0x51')]=function(_0x4b5314,_0x1cf2c6,_0x21e3f1){return db[_0x5f16('0x52')][_0x5f16('0x53')]({'where':{'id':_0x4b5314['params']['id']}})[_0x5f16('0x27')](handleEntityNotFound(_0x1cf2c6,null))[_0x5f16('0x27')](function(_0x49488d){if(_0x49488d){return db['sequelize'][_0x5f16('0x54')](function(_0x5f534e){return db[_0x5f16('0x43')][_0x5f16('0x28')]({'where':{'CustomReportId':_0x4b5314['params']['id']},'transaction':_0x5f534e})[_0x5f16('0x27')](function(_0x406e84){var _0x5846ec=_[_0x5f16('0x2f')](_0x4b5314[_0x5f16('0x4d')],function(_0x2848db){delete _0x2848db['id'];_0x2848db[_0x5f16('0x55')]=_0x4b5314[_0x5f16('0x49')]['id'];return _0x2848db;});return db[_0x5f16('0x43')][_0x5f16('0x4e')](_0x5846ec,{'transaction':_0x5f534e});});})[_0x5f16('0x27')](function(){return db[_0x5f16('0x43')]['findAll']({'where':{'CustomReportId':_0x4b5314[_0x5f16('0x49')]['id']}});});}})[_0x5f16('0x27')](respondWithResult(_0x1cf2c6,null))[_0x5f16('0x47')](handleError(_0x1cf2c6,null));}; \ No newline at end of file +var _0x6528=['model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','includeAll','include','AnalyticFieldReport','findAll','rows','catch','show','params','keys','options','create','bulkCreate','body','update','find','bulkDestroy','ids','AnalyticCustomReport','sequelize','CustomReportId','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','error','stack','name','map','rawAttributes','fieldName','type','key'];(function(_0x331929,_0x66d000){var _0x3e05ff=function(_0x7fc15f){while(--_0x7fc15f){_0x331929['push'](_0x331929['shift']());}};_0x3e05ff(++_0x66d000);}(_0x6528,0x1cd));var _0x8652=function(_0x4c0fc3,_0x2bcb44){_0x4c0fc3=_0x4c0fc3-0x0;var _0x10b7dd=_0x6528[_0x4c0fc3];return _0x10b7dd;};'use strict';var emlformat=require(_0x8652('0x0'));var rimraf=require(_0x8652('0x1'));var zipdir=require(_0x8652('0x2'));var jsonpatch=require(_0x8652('0x3'));var rp=require(_0x8652('0x4'));var moment=require(_0x8652('0x5'));var BPromise=require(_0x8652('0x6'));var Mustache=require(_0x8652('0x7'));var util=require(_0x8652('0x8'));var path=require(_0x8652('0x9'));var sox=require(_0x8652('0xa'));var csv=require('to-csv');var ejs=require(_0x8652('0xb'));var fs=require('fs');var fs_extra=require(_0x8652('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x8652('0xd'));var jsforce=require(_0x8652('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x8652('0xf'));var querystring=require(_0x8652('0x10'));var Papa=require(_0x8652('0x11'));var Redis=require(_0x8652('0x12'));var authService=require(_0x8652('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x8652('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8652('0x15'))(_0x8652('0x16'));var utils=require(_0x8652('0x17'));var config=require(_0x8652('0x18'));var licenseUtil=require(_0x8652('0x19'));var db=require(_0x8652('0x1a'))['db'];function respondWithStatusCode(_0x4daa4a,_0xdf3423){_0xdf3423=_0xdf3423||0xcc;return function(_0xaf5953){if(_0xaf5953){return _0x4daa4a[_0x8652('0x1b')](_0xdf3423);}return _0x4daa4a[_0x8652('0x1c')](_0xdf3423)[_0x8652('0x1d')]();};}function respondWithResult(_0x4f2b52,_0x1bb27b){_0x1bb27b=_0x1bb27b||0xc8;return function(_0x117854){if(_0x117854){return _0x4f2b52[_0x8652('0x1c')](_0x1bb27b)[_0x8652('0x1e')](_0x117854);}};}function respondWithFilteredResult(_0x295ea4,_0x23bf78){return function(_0x281527){if(_0x281527){var _0x1bba22=typeof _0x23bf78[_0x8652('0x1f')]===_0x8652('0x20')&&typeof _0x23bf78[_0x8652('0x21')]===_0x8652('0x20');var _0x5597ca=_0x281527[_0x8652('0x22')];var _0x46f9b9=_0x1bba22?0x0:_0x23bf78[_0x8652('0x1f')];var _0x2192e0=_0x1bba22?_0x281527[_0x8652('0x22')]:_0x23bf78[_0x8652('0x1f')]+_0x23bf78[_0x8652('0x21')];var _0x35e015;if(_0x2192e0>=_0x5597ca){_0x2192e0=_0x5597ca;_0x35e015=0xc8;}else{_0x35e015=0xce;}_0x295ea4[_0x8652('0x1c')](_0x35e015);return _0x295ea4['set'](_0x8652('0x23'),_0x46f9b9+'-'+_0x2192e0+'/'+_0x5597ca)[_0x8652('0x1e')](_0x281527);}return null;};}function patchUpdates(_0x36b80e){return function(_0x185369){try{jsonpatch[_0x8652('0x24')](_0x185369,_0x36b80e,!![]);}catch(_0x1a4d73){return BPromise[_0x8652('0x25')](_0x1a4d73);}return _0x185369[_0x8652('0x26')]();};}function saveUpdates(_0x4f95b9,_0xfbfbfd){return function(_0x38ac26){if(_0x38ac26){return _0x38ac26['update'](_0x4f95b9)[_0x8652('0x27')](function(_0x178b6a){return _0x178b6a;});}return null;};}function removeEntity(_0x2ab1bf,_0x29251e){return function(_0x232053){if(_0x232053){return _0x232053[_0x8652('0x28')]()['then'](function(){_0x2ab1bf['status'](0xcc)[_0x8652('0x1d')]();});}};}function handleEntityNotFound(_0x2cc8f1,_0x23470d){return function(_0x4ce6d0){if(!_0x4ce6d0){_0x2cc8f1[_0x8652('0x1b')](0x194);}return _0x4ce6d0;};}function handleError(_0x351e11,_0x3522ff){_0x3522ff=_0x3522ff||0x1f4;return function(_0x306de4){logger[_0x8652('0x29')](_0x306de4[_0x8652('0x2a')]);if(_0x306de4[_0x8652('0x2b')]){delete _0x306de4[_0x8652('0x2b')];}_0x351e11[_0x8652('0x1c')](_0x3522ff)['send'](_0x306de4);};}exports['index']=function(_0x43d7f5,_0x1420a1){var _0xd9d013={},_0x5e67a9={},_0x3facba={'count':0x0,'rows':[]};var _0x2504a8=_[_0x8652('0x2c')](db['AnalyticFieldReport'][_0x8652('0x2d')],function(_0x45d8d2){return{'name':_0x45d8d2[_0x8652('0x2e')],'type':_0x45d8d2[_0x8652('0x2f')][_0x8652('0x30')]};});_0x5e67a9[_0x8652('0x31')]=_[_0x8652('0x2c')](_0x2504a8,_0x8652('0x2b'));_0x5e67a9[_0x8652('0x32')]=_['keys'](_0x43d7f5[_0x8652('0x32')]);_0x5e67a9[_0x8652('0x33')]=_[_0x8652('0x34')](_0x5e67a9[_0x8652('0x31')],_0x5e67a9[_0x8652('0x32')]);_0xd9d013['attributes']=_[_0x8652('0x34')](_0x5e67a9[_0x8652('0x31')],qs[_0x8652('0x35')](_0x43d7f5['query'][_0x8652('0x35')]));_0xd9d013[_0x8652('0x36')]=_0xd9d013[_0x8652('0x36')][_0x8652('0x37')]?_0xd9d013[_0x8652('0x36')]:_0x5e67a9[_0x8652('0x31')];if(!_0x43d7f5[_0x8652('0x32')][_0x8652('0x38')](_0x8652('0x39'))){_0xd9d013[_0x8652('0x21')]=qs[_0x8652('0x21')](_0x43d7f5[_0x8652('0x32')][_0x8652('0x21')]);_0xd9d013[_0x8652('0x1f')]=qs[_0x8652('0x1f')](_0x43d7f5[_0x8652('0x32')][_0x8652('0x1f')]);}_0xd9d013[_0x8652('0x3a')]=qs[_0x8652('0x3b')](_0x43d7f5[_0x8652('0x32')][_0x8652('0x3b')]);_0xd9d013['where']=qs[_0x8652('0x33')](_[_0x8652('0x3c')](_0x43d7f5[_0x8652('0x32')],_0x5e67a9['filters']),_0x2504a8);if(_0x43d7f5[_0x8652('0x32')][_0x8652('0x3d')]){_0xd9d013[_0x8652('0x3e')]=_['merge'](_0xd9d013['where'],{'$or':_[_0x8652('0x2c')](_0x2504a8,function(_0x405373){if(_0x405373[_0x8652('0x2f')]!==_0x8652('0x3f')){var _0x4f65bc={};_0x4f65bc[_0x405373[_0x8652('0x2b')]]={'$like':'%'+_0x43d7f5['query'][_0x8652('0x3d')]+'%'};return _0x4f65bc;}})});}_0xd9d013=_[_0x8652('0x40')]({},_0xd9d013,_0x43d7f5['options']);var _0x3913cf={'where':_0xd9d013['where']};return db['AnalyticFieldReport'][_0x8652('0x22')](_0x3913cf)[_0x8652('0x27')](function(_0x181dc2){_0x3facba[_0x8652('0x22')]=_0x181dc2;if(_0x43d7f5[_0x8652('0x32')][_0x8652('0x41')]){_0xd9d013[_0x8652('0x42')]=[{'all':!![]}];}return db[_0x8652('0x43')][_0x8652('0x44')](_0xd9d013);})[_0x8652('0x27')](function(_0x26d26c){_0x3facba[_0x8652('0x45')]=_0x26d26c;return _0x3facba;})[_0x8652('0x27')](respondWithFilteredResult(_0x1420a1,_0xd9d013))[_0x8652('0x46')](handleError(_0x1420a1,null));};exports[_0x8652('0x47')]=function(_0x5834f4,_0x333a24){var _0x49ce41={'raw':![],'where':{'id':_0x5834f4[_0x8652('0x48')]['id']}},_0x5cf341={};_0x5cf341[_0x8652('0x31')]=_[_0x8652('0x49')](db[_0x8652('0x43')][_0x8652('0x2d')]);_0x5cf341[_0x8652('0x32')]=_[_0x8652('0x49')](_0x5834f4[_0x8652('0x32')]);_0x5cf341[_0x8652('0x33')]=_[_0x8652('0x34')](_0x5cf341[_0x8652('0x31')],_0x5cf341['query']);_0x49ce41[_0x8652('0x36')]=_[_0x8652('0x34')](_0x5cf341[_0x8652('0x31')],qs['fields'](_0x5834f4[_0x8652('0x32')][_0x8652('0x35')]));_0x49ce41[_0x8652('0x36')]=_0x49ce41[_0x8652('0x36')][_0x8652('0x37')]?_0x49ce41['attributes']:_0x5cf341[_0x8652('0x31')];if(_0x5834f4[_0x8652('0x32')][_0x8652('0x41')]){_0x49ce41['include']=[{'all':!![]}];}_0x49ce41=_['merge']({},_0x49ce41,_0x5834f4[_0x8652('0x4a')]);return db[_0x8652('0x43')]['find'](_0x49ce41)[_0x8652('0x27')](handleEntityNotFound(_0x333a24,null))['then'](respondWithResult(_0x333a24,null))['catch'](handleError(_0x333a24,null));};exports[_0x8652('0x4b')]=function(_0x3bc00c,_0x2e98c6){return db[_0x8652('0x43')]['create'](_0x3bc00c['body'],{})[_0x8652('0x27')](respondWithResult(_0x2e98c6,0xc9))[_0x8652('0x46')](handleError(_0x2e98c6,null));};exports[_0x8652('0x4c')]=function(_0x469c56,_0x175a94){return db[_0x8652('0x43')][_0x8652('0x4c')](_0x469c56[_0x8652('0x4d')],{'raw':![],'individualHooks':!![]})[_0x8652('0x27')](respondWithResult(_0x175a94,0xc9))['catch'](handleError(_0x175a94,null));};exports[_0x8652('0x4e')]=function(_0x4e33c2,_0x361afe){if(_0x4e33c2[_0x8652('0x4d')]['id']){delete _0x4e33c2['body']['id'];}return db[_0x8652('0x43')][_0x8652('0x4f')]({'where':{'id':_0x4e33c2[_0x8652('0x48')]['id']}})[_0x8652('0x27')](handleEntityNotFound(_0x361afe,null))[_0x8652('0x27')](saveUpdates(_0x4e33c2['body'],null))[_0x8652('0x27')](respondWithResult(_0x361afe,null))[_0x8652('0x46')](handleError(_0x361afe,null));};exports[_0x8652('0x28')]=function(_0x31c3c7,_0x5799b7){return db[_0x8652('0x43')][_0x8652('0x4f')]({'where':{'id':_0x31c3c7[_0x8652('0x48')]['id']}})[_0x8652('0x27')](handleEntityNotFound(_0x5799b7,null))[_0x8652('0x27')](removeEntity(_0x5799b7,null))[_0x8652('0x46')](handleError(_0x5799b7,null));};exports[_0x8652('0x50')]=function(_0x4a3378,_0x2b71d3){return db[_0x8652('0x43')][_0x8652('0x28')]({'where':{'id':_0x4a3378[_0x8652('0x32')][_0x8652('0x51')]||[]},'raw':![],'individualHooks':!![]})[_0x8652('0x27')](respondWithResult(_0x2b71d3,0xcc))['catch'](handleError(_0x2b71d3,null));};exports['addFields']=function(_0x402254,_0x33bd8e,_0x262281){return db[_0x8652('0x52')]['findOne']({'where':{'id':_0x402254['params']['id']}})[_0x8652('0x27')](handleEntityNotFound(_0x33bd8e,null))[_0x8652('0x27')](function(_0x375cbb){if(_0x375cbb){return db[_0x8652('0x53')]['transaction'](function(_0x5e437e){return db[_0x8652('0x43')][_0x8652('0x28')]({'where':{'CustomReportId':_0x402254['params']['id']},'transaction':_0x5e437e})['then'](function(_0x520ffb){var _0x1062c1=_[_0x8652('0x2c')](_0x402254[_0x8652('0x4d')],function(_0x573cbe){delete _0x573cbe['id'];_0x573cbe[_0x8652('0x54')]=_0x402254[_0x8652('0x48')]['id'];return _0x573cbe;});return db[_0x8652('0x43')][_0x8652('0x4c')](_0x1062c1,{'transaction':_0x5e437e});});})[_0x8652('0x27')](function(){return db[_0x8652('0x43')][_0x8652('0x44')]({'where':{'CustomReportId':_0x402254[_0x8652('0x48')]['id']}});});}})[_0x8652('0x27')](respondWithResult(_0x33bd8e,null))['catch'](handleError(_0x33bd8e,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 3d087de..b2e22de 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 _0x6159=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','AnalyticFieldReport','analytics_report_fields','util','../../config/logger'];(function(_0x5d37fa,_0x710d6){var _0x553a39=function(_0x526380){while(--_0x526380){_0x5d37fa['push'](_0x5d37fa['shift']());}};_0x553a39(++_0x710d6);}(_0x6159,0xca));var _0x9615=function(_0x13d0cc,_0x237b97){_0x13d0cc=_0x13d0cc-0x0;var _0x18b0bb=_0x6159[_0x13d0cc];return _0x18b0bb;};'use strict';var _=require('lodash');var util=require(_0x9615('0x0'));var logger=require(_0x9615('0x1'))(_0x9615('0x2'));var moment=require(_0x9615('0x3'));var BPromise=require(_0x9615('0x4'));var rp=require(_0x9615('0x5'));var fs=require('fs');var path=require(_0x9615('0x6'));var rimraf=require(_0x9615('0x7'));var config=require(_0x9615('0x8'));var attributes=require('./analyticFieldReport.attributes');module[_0x9615('0x9')]=function(_0x3aed80,_0xfc3e4f){return _0x3aed80['define'](_0x9615('0xa'),attributes,{'tableName':_0x9615('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x26a3=['./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','analytics_report_fields','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x10bc60,_0x589add){var _0x5de17c=function(_0x20d769){while(--_0x20d769){_0x10bc60['push'](_0x10bc60['shift']());}};_0x5de17c(++_0x589add);}(_0x26a3,0x171));var _0x326a=function(_0x51aaaa,_0x3f44c1){_0x51aaaa=_0x51aaaa-0x0;var _0x2e21ab=_0x26a3[_0x51aaaa];return _0x2e21ab;};'use strict';var _=require(_0x326a('0x0'));var util=require('util');var logger=require(_0x326a('0x1'))(_0x326a('0x2'));var moment=require(_0x326a('0x3'));var BPromise=require(_0x326a('0x4'));var rp=require(_0x326a('0x5'));var fs=require('fs');var path=require(_0x326a('0x6'));var rimraf=require(_0x326a('0x7'));var config=require(_0x326a('0x8'));var attributes=require(_0x326a('0x9'));module[_0x326a('0xa')]=function(_0xb833ec,_0x5c29f9){return _0xb833ec[_0x326a('0xb')](_0x326a('0xc'),attributes,{'tableName':_0x326a('0xd'),'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 d7af62f..658f203 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 _0x7512=['AnalyticFieldReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','info','request\x20sent','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','error'];(function(_0x3fc762,_0xad9651){var _0x1280b3=function(_0x44a4bf){while(--_0x44a4bf){_0x3fc762['push'](_0x3fc762['shift']());}};_0x1280b3(++_0xad9651);}(_0x7512,0x68));var _0x2751=function(_0x5c8827,_0x5bc5d7){_0x5c8827=_0x5c8827-0x0;var _0x50ffd5=_0x7512[_0x5c8827];return _0x50ffd5;};'use strict';var _=require(_0x2751('0x0'));var util=require(_0x2751('0x1'));var moment=require(_0x2751('0x2'));var BPromise=require('bluebird');var rs=require(_0x2751('0x3'));var fs=require('fs');var Redis=require(_0x2751('0x4'));var db=require(_0x2751('0x5'))['db'];var utils=require(_0x2751('0x6'));var logger=require('../../config/logger')(_0x2751('0x7'));var config=require('../../config/environment');var jayson=require(_0x2751('0x8'));var client=jayson[_0x2751('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x335915,_0xd84471,_0x2b584d){return new BPromise(function(_0x123fea,_0x54471c){return client[_0x2751('0xa')](_0x335915,_0x2b584d)[_0x2751('0xb')](function(_0x3a96e1){logger[_0x2751('0xc')]('AnalyticFieldReport,\x20%s,\x20%s',_0xd84471,_0x2751('0xd'));logger['debug'](_0x2751('0xe'),_0xd84471,_0x2751('0xd'),JSON['stringify'](_0x3a96e1));if(_0x3a96e1[_0x2751('0xf')]){if(_0x3a96e1[_0x2751('0xf')]['code']===0x1f4){logger['error'](_0x2751('0x10'),_0xd84471,_0x3a96e1[_0x2751('0xf')][_0x2751('0x11')]);return _0x54471c(_0x3a96e1[_0x2751('0xf')][_0x2751('0x11')]);}logger[_0x2751('0xf')]('AnalyticFieldReport,\x20%s,\x20%s',_0xd84471,_0x3a96e1['error'][_0x2751('0x11')]);return _0x123fea(_0x3a96e1['error'][_0x2751('0x11')]);}else{logger[_0x2751('0xc')](_0x2751('0x10'),_0xd84471,_0x2751('0xd'));_0x123fea(_0x3a96e1[_0x2751('0x12')][_0x2751('0x11')]);}})[_0x2751('0x13')](function(_0x54d5de){logger[_0x2751('0xf')]('AnalyticFieldReport,\x20%s,\x20%s',_0xd84471,_0x54d5de);_0x54471c(_0x54d5de);});});} \ No newline at end of file +var _0x282d=['message','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x573508,_0x1f6d7b){var _0x440e39=function(_0x3442fb){while(--_0x3442fb){_0x573508['push'](_0x573508['shift']());}};_0x440e39(++_0x1f6d7b);}(_0x282d,0x191));var _0xd282=function(_0x5b3028,_0x446c66){_0x5b3028=_0x5b3028-0x0;var _0x309076=_0x282d[_0x5b3028];return _0x309076;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd282('0x0'));var BPromise=require(_0xd282('0x1'));var rs=require(_0xd282('0x2'));var fs=require('fs');var Redis=require(_0xd282('0x3'));var db=require(_0xd282('0x4'))['db'];var utils=require(_0xd282('0x5'));var logger=require(_0xd282('0x6'))('rpc');var config=require(_0xd282('0x7'));var jayson=require(_0xd282('0x8'));var client=jayson['client'][_0xd282('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x460e84,_0xaae95c,_0xca16a4){return new BPromise(function(_0x141a43,_0x160bfd){return client[_0xd282('0xa')](_0x460e84,_0xca16a4)[_0xd282('0xb')](function(_0x1a861e){logger[_0xd282('0xc')](_0xd282('0xd'),_0xaae95c,_0xd282('0xe'));logger[_0xd282('0xf')](_0xd282('0x10'),_0xaae95c,_0xd282('0xe'),JSON[_0xd282('0x11')](_0x1a861e));if(_0x1a861e[_0xd282('0x12')]){if(_0x1a861e[_0xd282('0x12')]['code']===0x1f4){logger[_0xd282('0x12')](_0xd282('0xd'),_0xaae95c,_0x1a861e[_0xd282('0x12')][_0xd282('0x13')]);return _0x160bfd(_0x1a861e[_0xd282('0x12')]['message']);}logger[_0xd282('0x12')](_0xd282('0xd'),_0xaae95c,_0x1a861e[_0xd282('0x12')][_0xd282('0x13')]);return _0x141a43(_0x1a861e[_0xd282('0x12')][_0xd282('0x13')]);}else{logger[_0xd282('0xc')](_0xd282('0xd'),_0xaae95c,_0xd282('0xe'));_0x141a43(_0x1a861e['result'][_0xd282('0x13')]);}})[_0xd282('0x14')](function(_0x1f7a20){logger[_0xd282('0x12')]('AnalyticFieldReport,\x20%s,\x20%s',_0xaae95c,_0x1f7a20);_0x160bfd(_0x1f7a20);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index e14cbfa..d8b8aec 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(_0x17022b,_0xd36714){var _0xd620d1=function(_0x1b7b88){while(--_0x1b7b88){_0x17022b['push'](_0x17022b['shift']());}};_0xd620d1(++_0xd36714);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xa9e0[_0x2a6809];return _0x11c371;};'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(_0xeef9e1,_0xb4c1ee){var _0xadd459=function(_0x50868e){while(--_0x50868e){_0xeef9e1['push'](_0xeef9e1['shift']());}};_0xadd459(++_0xb4c1ee);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xa9e0[_0x4154a6];return _0x3b2786;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));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 ba3b0ff..fa60a85 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 _0xf9bc=['name','TEXT','exports','STRING'];(function(_0x5eaa05,_0x175dd6){var _0x571a22=function(_0x45355d){while(--_0x45355d){_0x5eaa05['push'](_0x5eaa05['shift']());}};_0x571a22(++_0x175dd6);}(_0xf9bc,0x7e));var _0xcf9b=function(_0x544bc4,_0x42bdc8){_0x544bc4=_0x544bc4-0x0;var _0x264ed5=_0xf9bc[_0x544bc4];return _0x264ed5;};'use strict';var Sequelize=require('sequelize');module[_0xcf9b('0x0')]={'name':{'type':Sequelize[_0xcf9b('0x1')],'allowNull':![],'unique':_0xcf9b('0x2')},'table':{'type':Sequelize[_0xcf9b('0x1')]},'metric':{'type':Sequelize[_0xcf9b('0x3')]},'description':{'type':Sequelize[_0xcf9b('0x1')]}}; \ No newline at end of file +var _0x76d2=['sequelize','exports','STRING','TEXT'];(function(_0x3b7b8a,_0x52c3b0){var _0x441206=function(_0x5d34d3){while(--_0x5d34d3){_0x3b7b8a['push'](_0x3b7b8a['shift']());}};_0x441206(++_0x52c3b0);}(_0x76d2,0xf8));var _0x276d=function(_0x4e220c,_0x13756b){_0x4e220c=_0x4e220c-0x0;var _0x4166bf=_0x76d2[_0x4e220c];return _0x4166bf;};'use strict';var Sequelize=require(_0x276d('0x0'));module[_0x276d('0x1')]={'name':{'type':Sequelize[_0x276d('0x2')],'allowNull':![],'unique':'name'},'table':{'type':Sequelize[_0x276d('0x2')]},'metric':{'type':Sequelize[_0x276d('0x3')]},'description':{'type':Sequelize[_0x276d('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 25180cb..d23fa21 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 _0x7da7=['model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','pick','merge','options','where','AnalyticMetric','includeAll','include','findAll','rows','catch','params','keys','length','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','moment','bluebird','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','limit','json','apply','reject','update','then','destroy','get','Metrics','UserProfileResource','end','name','send','index','map','rawAttributes','fieldName','type','key'];(function(_0x20589d,_0x55d5bf){var _0x422de9=function(_0x44cbbb){while(--_0x44cbbb){_0x20589d['push'](_0x20589d['shift']());}};_0x422de9(++_0x55d5bf);}(_0x7da7,0x10d));var _0x77da=function(_0x557f5f,_0x31d8e7){_0x557f5f=_0x557f5f-0x0;var _0x196eba=_0x7da7[_0x557f5f];return _0x196eba;};'use strict';var emlformat=require(_0x77da('0x0'));var rimraf=require(_0x77da('0x1'));var zipdir=require(_0x77da('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x77da('0x3'));var BPromise=require(_0x77da('0x4'));var Mustache=require('mustache');var util=require(_0x77da('0x5'));var path=require(_0x77da('0x6'));var sox=require('sox');var csv=require(_0x77da('0x7'));var ejs=require(_0x77da('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x77da('0x9'));var squel=require('squel');var crypto=require(_0x77da('0xa'));var jsforce=require(_0x77da('0xb'));var deskjs=require(_0x77da('0xc'));var toCsv=require(_0x77da('0x7'));var querystring=require(_0x77da('0xd'));var Papa=require('papaparse');var Redis=require(_0x77da('0xe'));var authService=require(_0x77da('0xf'));var qs=require(_0x77da('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x77da('0x11'));var logger=require(_0x77da('0x12'))(_0x77da('0x13'));var utils=require(_0x77da('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x77da('0x15'));var db=require(_0x77da('0x16'))['db'];function respondWithStatusCode(_0x2acc65,_0x5d6e2f){_0x5d6e2f=_0x5d6e2f||0xcc;return function(_0x4a7748){if(_0x4a7748){return _0x2acc65[_0x77da('0x17')](_0x5d6e2f);}return _0x2acc65[_0x77da('0x18')](_0x5d6e2f)['end']();};}function respondWithResult(_0x3b0ff2,_0x369df0){_0x369df0=_0x369df0||0xc8;return function(_0x355719){if(_0x355719){return _0x3b0ff2[_0x77da('0x18')](_0x369df0)['json'](_0x355719);}};}function respondWithFilteredResult(_0x2172d0,_0x4e130c){return function(_0x29cd7b){if(_0x29cd7b){var _0x366443=typeof _0x4e130c[_0x77da('0x19')]===_0x77da('0x1a')&&typeof _0x4e130c['limit']==='undefined';var _0x514016=_0x29cd7b['count'];var _0x103e46=_0x366443?0x0:_0x4e130c[_0x77da('0x19')];var _0x289887=_0x366443?_0x29cd7b[_0x77da('0x1b')]:_0x4e130c[_0x77da('0x19')]+_0x4e130c[_0x77da('0x1c')];var _0x1d325c;if(_0x289887>=_0x514016){_0x289887=_0x514016;_0x1d325c=0xc8;}else{_0x1d325c=0xce;}_0x2172d0[_0x77da('0x18')](_0x1d325c);return _0x2172d0['set']('Content-Range',_0x103e46+'-'+_0x289887+'/'+_0x514016)[_0x77da('0x1d')](_0x29cd7b);}return null;};}function patchUpdates(_0x4d1512){return function(_0x507979){try{jsonpatch[_0x77da('0x1e')](_0x507979,_0x4d1512,!![]);}catch(_0x304a2b){return BPromise[_0x77da('0x1f')](_0x304a2b);}return _0x507979['save']();};}function saveUpdates(_0x58270c,_0x3e6cfe){return function(_0x58f6c1){if(_0x58f6c1){return _0x58f6c1[_0x77da('0x20')](_0x58270c)[_0x77da('0x21')](function(_0xc52f0e){return _0xc52f0e;});}return null;};}function removeEntity(_0x27b6c7,_0x10399a){return function(_0x270318){if(_0x270318){return _0x270318[_0x77da('0x22')]()['then'](function(){var _0x4885ec=_0x270318[_0x77da('0x23')]({'plain':!![]});var _0x2d009f=_0x77da('0x24');return db[_0x77da('0x25')]['destroy']({'where':{'type':_0x2d009f,'resourceId':_0x4885ec['id']}})[_0x77da('0x21')](function(){return _0x270318;});})[_0x77da('0x21')](function(){_0x27b6c7[_0x77da('0x18')](0xcc)[_0x77da('0x26')]();});}};}function handleEntityNotFound(_0x446ae7,_0x5997b6){return function(_0xce24b8){if(!_0xce24b8){_0x446ae7[_0x77da('0x17')](0x194);}return _0xce24b8;};}function handleError(_0x1f2279,_0x2913f7){_0x2913f7=_0x2913f7||0x1f4;return function(_0x496ecd){logger['error'](_0x496ecd['stack']);if(_0x496ecd[_0x77da('0x27')]){delete _0x496ecd[_0x77da('0x27')];}_0x1f2279[_0x77da('0x18')](_0x2913f7)[_0x77da('0x28')](_0x496ecd);};}exports[_0x77da('0x29')]=function(_0x4eeb99,_0x350b4e){var _0x26f5a0={},_0x356bfb={},_0x1d381b={'count':0x0,'rows':[]};var _0x1e7853=_[_0x77da('0x2a')](db['AnalyticMetric'][_0x77da('0x2b')],function(_0x228851){return{'name':_0x228851[_0x77da('0x2c')],'type':_0x228851[_0x77da('0x2d')][_0x77da('0x2e')]};});_0x356bfb[_0x77da('0x2f')]=_[_0x77da('0x2a')](_0x1e7853,_0x77da('0x27'));_0x356bfb['query']=_['keys'](_0x4eeb99[_0x77da('0x30')]);_0x356bfb[_0x77da('0x31')]=_['intersection'](_0x356bfb[_0x77da('0x2f')],_0x356bfb[_0x77da('0x30')]);_0x26f5a0[_0x77da('0x32')]=_[_0x77da('0x33')](_0x356bfb[_0x77da('0x2f')],qs[_0x77da('0x34')](_0x4eeb99[_0x77da('0x30')]['fields']));_0x26f5a0[_0x77da('0x32')]=_0x26f5a0['attributes']['length']?_0x26f5a0['attributes']:_0x356bfb[_0x77da('0x2f')];if(!_0x4eeb99['query'][_0x77da('0x35')](_0x77da('0x36'))){_0x26f5a0[_0x77da('0x1c')]=qs[_0x77da('0x1c')](_0x4eeb99[_0x77da('0x30')][_0x77da('0x1c')]);_0x26f5a0[_0x77da('0x19')]=qs['offset'](_0x4eeb99[_0x77da('0x30')][_0x77da('0x19')]);}_0x26f5a0[_0x77da('0x37')]=qs[_0x77da('0x38')](_0x4eeb99[_0x77da('0x30')][_0x77da('0x38')]);_0x26f5a0['where']=qs[_0x77da('0x31')](_[_0x77da('0x39')](_0x4eeb99[_0x77da('0x30')],_0x356bfb['filters']),_0x1e7853);if(_0x4eeb99[_0x77da('0x30')]['filter']){_0x26f5a0['where']=_['merge'](_0x26f5a0['where'],{'$or':_[_0x77da('0x2a')](_0x1e7853,function(_0x1adba5){if(_0x1adba5[_0x77da('0x2d')]!=='VIRTUAL'){var _0x21d337={};_0x21d337[_0x1adba5['name']]={'$like':'%'+_0x4eeb99[_0x77da('0x30')]['filter']+'%'};return _0x21d337;}})});}_0x26f5a0=_[_0x77da('0x3a')]({},_0x26f5a0,_0x4eeb99[_0x77da('0x3b')]);var _0x290667={'where':_0x26f5a0[_0x77da('0x3c')]};return db[_0x77da('0x3d')]['count'](_0x290667)[_0x77da('0x21')](function(_0x1f48bd){_0x1d381b[_0x77da('0x1b')]=_0x1f48bd;if(_0x4eeb99[_0x77da('0x30')][_0x77da('0x3e')]){_0x26f5a0[_0x77da('0x3f')]=[{'all':!![]}];}return db['AnalyticMetric'][_0x77da('0x40')](_0x26f5a0);})[_0x77da('0x21')](function(_0x21de41){_0x1d381b[_0x77da('0x41')]=_0x21de41;return _0x1d381b;})[_0x77da('0x21')](respondWithFilteredResult(_0x350b4e,_0x26f5a0))[_0x77da('0x42')](handleError(_0x350b4e,null));};exports['show']=function(_0x10957b,_0x5abcd9){var _0x1ae806={'raw':!![],'where':{'id':_0x10957b[_0x77da('0x43')]['id']}},_0x373fb2={};_0x373fb2['model']=_[_0x77da('0x44')](db[_0x77da('0x3d')][_0x77da('0x2b')]);_0x373fb2[_0x77da('0x30')]=_[_0x77da('0x44')](_0x10957b[_0x77da('0x30')]);_0x373fb2[_0x77da('0x31')]=_[_0x77da('0x33')](_0x373fb2[_0x77da('0x2f')],_0x373fb2['query']);_0x1ae806[_0x77da('0x32')]=_[_0x77da('0x33')](_0x373fb2[_0x77da('0x2f')],qs[_0x77da('0x34')](_0x10957b[_0x77da('0x30')][_0x77da('0x34')]));_0x1ae806['attributes']=_0x1ae806['attributes'][_0x77da('0x45')]?_0x1ae806[_0x77da('0x32')]:_0x373fb2[_0x77da('0x2f')];if(_0x10957b[_0x77da('0x30')][_0x77da('0x3e')]){_0x1ae806[_0x77da('0x3f')]=[{'all':!![]}];}_0x1ae806=_['merge']({},_0x1ae806,_0x10957b[_0x77da('0x3b')]);return db[_0x77da('0x3d')][_0x77da('0x46')](_0x1ae806)[_0x77da('0x21')](handleEntityNotFound(_0x5abcd9,null))['then'](respondWithResult(_0x5abcd9,null))[_0x77da('0x42')](handleError(_0x5abcd9,null));};exports['create']=function(_0x518fd5,_0x36263b){return db[_0x77da('0x3d')][_0x77da('0x47')](_0x518fd5[_0x77da('0x48')],{})['then'](function(_0x16bf4b){var _0x1e36ee=_0x518fd5['user'][_0x77da('0x23')]({'plain':!![]});if(!_0x1e36ee)throw new Error(_0x77da('0x49'));if(_0x1e36ee['role']===_0x77da('0x4a')){var _0x3aaf5b=_0x16bf4b[_0x77da('0x23')]({'plain':!![]});var _0xef2496=_0x77da('0x24');return db[_0x77da('0x4b')][_0x77da('0x46')]({'where':{'name':_0xef2496,'userProfileId':_0x1e36ee[_0x77da('0x4c')]},'raw':!![]})[_0x77da('0x21')](function(_0x3a34a8){if(_0x3a34a8&&_0x3a34a8['autoAssociation']===0x0){return db[_0x77da('0x25')]['create']({'name':_0x3aaf5b[_0x77da('0x27')],'resourceId':_0x3aaf5b['id'],'type':_0x3a34a8[_0x77da('0x27')],'sectionId':_0x3a34a8['id']},{})[_0x77da('0x21')](function(){return _0x16bf4b;});}else{return _0x16bf4b;}})[_0x77da('0x42')](function(_0x374179){logger[_0x77da('0x4d')](_0x77da('0x4e'),_0x374179);throw _0x374179;});}return _0x16bf4b;})['then'](respondWithResult(_0x36263b,0xc9))[_0x77da('0x42')](handleError(_0x36263b,null));};exports[_0x77da('0x20')]=function(_0x1a7115,_0x353be9){if(_0x1a7115['body']['id']){delete _0x1a7115[_0x77da('0x48')]['id'];}return db[_0x77da('0x3d')][_0x77da('0x46')]({'where':{'id':_0x1a7115['params']['id']}})['then'](handleEntityNotFound(_0x353be9,null))[_0x77da('0x21')](saveUpdates(_0x1a7115[_0x77da('0x48')],null))[_0x77da('0x21')](respondWithResult(_0x353be9,null))[_0x77da('0x42')](handleError(_0x353be9,null));};exports[_0x77da('0x22')]=function(_0x528a32,_0x50437b){return db[_0x77da('0x3d')][_0x77da('0x46')]({'where':{'id':_0x528a32['params']['id']}})[_0x77da('0x21')](handleEntityNotFound(_0x50437b,null))[_0x77da('0x21')](removeEntity(_0x50437b,null))[_0x77da('0x42')](handleError(_0x50437b,null));}; \ No newline at end of file +var _0x84ab=['UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','get','Metrics','UserProfileResource','error','stack','name','map','AnalyticMetric','rawAttributes','fieldName','key','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','filter','type','VIRTUAL','includeAll','include','catch','show','params','keys','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0x84ab,0x12f));var _0xb84a=function(_0x13ff53,_0x5e1424){_0x13ff53=_0x13ff53-0x0;var _0x290228=_0x84ab[_0x13ff53];return _0x290228;};'use strict';var emlformat=require(_0xb84a('0x0'));var rimraf=require(_0xb84a('0x1'));var zipdir=require(_0xb84a('0x2'));var jsonpatch=require(_0xb84a('0x3'));var rp=require(_0xb84a('0x4'));var moment=require('moment');var BPromise=require(_0xb84a('0x5'));var Mustache=require(_0xb84a('0x6'));var util=require('util');var path=require(_0xb84a('0x7'));var sox=require(_0xb84a('0x8'));var csv=require(_0xb84a('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb84a('0xa'));var crypto=require('crypto');var jsforce=require(_0xb84a('0xb'));var deskjs=require(_0xb84a('0xc'));var toCsv=require('to-csv');var querystring=require(_0xb84a('0xd'));var Papa=require('papaparse');var Redis=require(_0xb84a('0xe'));var authService=require(_0xb84a('0xf'));var qs=require(_0xb84a('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb84a('0x11'));var utils=require(_0xb84a('0x12'));var config=require(_0xb84a('0x13'));var licenseUtil=require(_0xb84a('0x14'));var db=require(_0xb84a('0x15'))['db'];function respondWithStatusCode(_0x4d3758,_0x83444e){_0x83444e=_0x83444e||0xcc;return function(_0x4777dc){if(_0x4777dc){return _0x4d3758[_0xb84a('0x16')](_0x83444e);}return _0x4d3758[_0xb84a('0x17')](_0x83444e)[_0xb84a('0x18')]();};}function respondWithResult(_0x11dfe9,_0x12ccab){_0x12ccab=_0x12ccab||0xc8;return function(_0x475b){if(_0x475b){return _0x11dfe9[_0xb84a('0x17')](_0x12ccab)[_0xb84a('0x19')](_0x475b);}};}function respondWithFilteredResult(_0xc0b2e0,_0x1251ec){return function(_0x5716bd){if(_0x5716bd){var _0x11dd4d=typeof _0x1251ec[_0xb84a('0x1a')]===_0xb84a('0x1b')&&typeof _0x1251ec[_0xb84a('0x1c')]===_0xb84a('0x1b');var _0x1be87a=_0x5716bd[_0xb84a('0x1d')];var _0x34d82f=_0x11dd4d?0x0:_0x1251ec[_0xb84a('0x1a')];var _0x3f7437=_0x11dd4d?_0x5716bd[_0xb84a('0x1d')]:_0x1251ec[_0xb84a('0x1a')]+_0x1251ec[_0xb84a('0x1c')];var _0x200289;if(_0x3f7437>=_0x1be87a){_0x3f7437=_0x1be87a;_0x200289=0xc8;}else{_0x200289=0xce;}_0xc0b2e0['status'](_0x200289);return _0xc0b2e0[_0xb84a('0x1e')](_0xb84a('0x1f'),_0x34d82f+'-'+_0x3f7437+'/'+_0x1be87a)['json'](_0x5716bd);}return null;};}function patchUpdates(_0xac76d3){return function(_0x61ef03){try{jsonpatch[_0xb84a('0x20')](_0x61ef03,_0xac76d3,!![]);}catch(_0x19f637){return BPromise['reject'](_0x19f637);}return _0x61ef03['save']();};}function saveUpdates(_0x1466ae,_0x19097d){return function(_0x2d70fd){if(_0x2d70fd){return _0x2d70fd[_0xb84a('0x21')](_0x1466ae)[_0xb84a('0x22')](function(_0x3b8fb2){return _0x3b8fb2;});}return null;};}function removeEntity(_0x8b28cd,_0x21d0d3){return function(_0x3aa06f){if(_0x3aa06f){return _0x3aa06f[_0xb84a('0x23')]()[_0xb84a('0x22')](function(){var _0x1aab7d=_0x3aa06f[_0xb84a('0x24')]({'plain':!![]});var _0x409df0=_0xb84a('0x25');return db[_0xb84a('0x26')][_0xb84a('0x23')]({'where':{'type':_0x409df0,'resourceId':_0x1aab7d['id']}})[_0xb84a('0x22')](function(){return _0x3aa06f;});})[_0xb84a('0x22')](function(){_0x8b28cd[_0xb84a('0x17')](0xcc)[_0xb84a('0x18')]();});}};}function handleEntityNotFound(_0x1db72c,_0x2fe40d){return function(_0x35d1f7){if(!_0x35d1f7){_0x1db72c[_0xb84a('0x16')](0x194);}return _0x35d1f7;};}function handleError(_0x97d71b,_0x5349ea){_0x5349ea=_0x5349ea||0x1f4;return function(_0x582954){logger[_0xb84a('0x27')](_0x582954[_0xb84a('0x28')]);if(_0x582954['name']){delete _0x582954[_0xb84a('0x29')];}_0x97d71b[_0xb84a('0x17')](_0x5349ea)['send'](_0x582954);};}exports['index']=function(_0x28f2e7,_0x8e9319){var _0x49ba3d={},_0x251778={},_0xba1147={'count':0x0,'rows':[]};var _0x3abc22=_[_0xb84a('0x2a')](db[_0xb84a('0x2b')][_0xb84a('0x2c')],function(_0x34b212){return{'name':_0x34b212[_0xb84a('0x2d')],'type':_0x34b212['type'][_0xb84a('0x2e')]};});_0x251778['model']=_['map'](_0x3abc22,_0xb84a('0x29'));_0x251778[_0xb84a('0x2f')]=_['keys'](_0x28f2e7['query']);_0x251778[_0xb84a('0x30')]=_[_0xb84a('0x31')](_0x251778[_0xb84a('0x32')],_0x251778[_0xb84a('0x2f')]);_0x49ba3d[_0xb84a('0x33')]=_[_0xb84a('0x31')](_0x251778[_0xb84a('0x32')],qs[_0xb84a('0x34')](_0x28f2e7['query'][_0xb84a('0x34')]));_0x49ba3d[_0xb84a('0x33')]=_0x49ba3d[_0xb84a('0x33')][_0xb84a('0x35')]?_0x49ba3d[_0xb84a('0x33')]:_0x251778[_0xb84a('0x32')];if(!_0x28f2e7[_0xb84a('0x2f')]['hasOwnProperty'](_0xb84a('0x36'))){_0x49ba3d['limit']=qs[_0xb84a('0x1c')](_0x28f2e7[_0xb84a('0x2f')][_0xb84a('0x1c')]);_0x49ba3d['offset']=qs['offset'](_0x28f2e7[_0xb84a('0x2f')][_0xb84a('0x1a')]);}_0x49ba3d[_0xb84a('0x37')]=qs[_0xb84a('0x38')](_0x28f2e7[_0xb84a('0x2f')]['sort']);_0x49ba3d[_0xb84a('0x39')]=qs[_0xb84a('0x30')](_['pick'](_0x28f2e7[_0xb84a('0x2f')],_0x251778[_0xb84a('0x30')]),_0x3abc22);if(_0x28f2e7[_0xb84a('0x2f')][_0xb84a('0x3a')]){_0x49ba3d['where']=_['merge'](_0x49ba3d['where'],{'$or':_[_0xb84a('0x2a')](_0x3abc22,function(_0x11e1ac){if(_0x11e1ac[_0xb84a('0x3b')]!==_0xb84a('0x3c')){var _0x55b0b8={};_0x55b0b8[_0x11e1ac[_0xb84a('0x29')]]={'$like':'%'+_0x28f2e7['query'][_0xb84a('0x3a')]+'%'};return _0x55b0b8;}})});}_0x49ba3d=_['merge']({},_0x49ba3d,_0x28f2e7['options']);var _0x59d7a1={'where':_0x49ba3d[_0xb84a('0x39')]};return db[_0xb84a('0x2b')][_0xb84a('0x1d')](_0x59d7a1)[_0xb84a('0x22')](function(_0x5e547e){_0xba1147[_0xb84a('0x1d')]=_0x5e547e;if(_0x28f2e7[_0xb84a('0x2f')][_0xb84a('0x3d')]){_0x49ba3d[_0xb84a('0x3e')]=[{'all':!![]}];}return db['AnalyticMetric']['findAll'](_0x49ba3d);})[_0xb84a('0x22')](function(_0x1f3e04){_0xba1147['rows']=_0x1f3e04;return _0xba1147;})[_0xb84a('0x22')](respondWithFilteredResult(_0x8e9319,_0x49ba3d))[_0xb84a('0x3f')](handleError(_0x8e9319,null));};exports[_0xb84a('0x40')]=function(_0x25280a,_0x3f005b){var _0x241536={'raw':!![],'where':{'id':_0x25280a[_0xb84a('0x41')]['id']}},_0x24d700={};_0x24d700[_0xb84a('0x32')]=_[_0xb84a('0x42')](db[_0xb84a('0x2b')][_0xb84a('0x2c')]);_0x24d700[_0xb84a('0x2f')]=_[_0xb84a('0x42')](_0x25280a[_0xb84a('0x2f')]);_0x24d700['filters']=_[_0xb84a('0x31')](_0x24d700[_0xb84a('0x32')],_0x24d700[_0xb84a('0x2f')]);_0x241536[_0xb84a('0x33')]=_[_0xb84a('0x31')](_0x24d700[_0xb84a('0x32')],qs['fields'](_0x25280a[_0xb84a('0x2f')]['fields']));_0x241536[_0xb84a('0x33')]=_0x241536[_0xb84a('0x33')][_0xb84a('0x35')]?_0x241536[_0xb84a('0x33')]:_0x24d700['model'];if(_0x25280a[_0xb84a('0x2f')][_0xb84a('0x3d')]){_0x241536[_0xb84a('0x3e')]=[{'all':!![]}];}_0x241536=_['merge']({},_0x241536,_0x25280a['options']);return db[_0xb84a('0x2b')][_0xb84a('0x43')](_0x241536)[_0xb84a('0x22')](handleEntityNotFound(_0x3f005b,null))['then'](respondWithResult(_0x3f005b,null))['catch'](handleError(_0x3f005b,null));};exports['create']=function(_0x45630d,_0x384a0d){return db[_0xb84a('0x2b')][_0xb84a('0x44')](_0x45630d[_0xb84a('0x45')],{})['then'](function(_0x4b40fe){var _0x5b853a=_0x45630d['user'][_0xb84a('0x24')]({'plain':!![]});if(!_0x5b853a)throw new Error(_0xb84a('0x46'));if(_0x5b853a['role']===_0xb84a('0x47')){var _0xc8bac2=_0x4b40fe[_0xb84a('0x24')]({'plain':!![]});var _0x2f70f0=_0xb84a('0x25');return db[_0xb84a('0x48')]['find']({'where':{'name':_0x2f70f0,'userProfileId':_0x5b853a['userProfileId']},'raw':!![]})[_0xb84a('0x22')](function(_0x50172a){if(_0x50172a&&_0x50172a[_0xb84a('0x49')]===0x0){return db['UserProfileResource']['create']({'name':_0xc8bac2['name'],'resourceId':_0xc8bac2['id'],'type':_0x50172a[_0xb84a('0x29')],'sectionId':_0x50172a['id']},{})[_0xb84a('0x22')](function(){return _0x4b40fe;});}else{return _0x4b40fe;}})[_0xb84a('0x3f')](function(_0x25b6a0){logger[_0xb84a('0x27')](_0xb84a('0x4a'),_0x25b6a0);throw _0x25b6a0;});}return _0x4b40fe;})[_0xb84a('0x22')](respondWithResult(_0x384a0d,0xc9))[_0xb84a('0x3f')](handleError(_0x384a0d,null));};exports['update']=function(_0x5afdd0,_0x4c5bdf){if(_0x5afdd0[_0xb84a('0x45')]['id']){delete _0x5afdd0[_0xb84a('0x45')]['id'];}return db['AnalyticMetric'][_0xb84a('0x43')]({'where':{'id':_0x5afdd0['params']['id']}})['then'](handleEntityNotFound(_0x4c5bdf,null))['then'](saveUpdates(_0x5afdd0[_0xb84a('0x45')],null))[_0xb84a('0x22')](respondWithResult(_0x4c5bdf,null))[_0xb84a('0x3f')](handleError(_0x4c5bdf,null));};exports['destroy']=function(_0x5f757e,_0x2e98bf){return db[_0xb84a('0x2b')]['find']({'where':{'id':_0x5f757e[_0xb84a('0x41')]['id']}})['then'](handleEntityNotFound(_0x2e98bf,null))['then'](removeEntity(_0x2e98bf,null))[_0xb84a('0x3f')](handleError(_0x2e98bf,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index df6b622..a60299b 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 _0xdded=['lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./analyticMetric.attributes','exports','define','AnalyticMetric','analytics_metrics'];(function(_0x7f3667,_0x30c3f1){var _0x2c4c24=function(_0xf070f3){while(--_0xf070f3){_0x7f3667['push'](_0x7f3667['shift']());}};_0x2c4c24(++_0x30c3f1);}(_0xdded,0x17a));var _0xddde=function(_0xe40eb3,_0x49fa58){_0xe40eb3=_0xe40eb3-0x0;var _0x2432b8=_0xdded[_0xe40eb3];return _0x2432b8;};'use strict';var _=require(_0xddde('0x0'));var util=require(_0xddde('0x1'));var logger=require(_0xddde('0x2'))(_0xddde('0x3'));var moment=require(_0xddde('0x4'));var BPromise=require(_0xddde('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xddde('0x6'));var rimraf=require(_0xddde('0x7'));var config=require(_0xddde('0x8'));var attributes=require(_0xddde('0x9'));module[_0xddde('0xa')]=function(_0x39fd85,_0x3c3021){return _0x39fd85[_0xddde('0xb')](_0xddde('0xc'),attributes,{'tableName':_0xddde('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5078=['rimraf','../../config/environment','./analyticMetric.attributes','exports','define','AnalyticMetric','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x403c20,_0x4a7b99){var _0x2b271a=function(_0x106ecb){while(--_0x106ecb){_0x403c20['push'](_0x403c20['shift']());}};_0x2b271a(++_0x4a7b99);}(_0x5078,0x148));var _0x8507=function(_0x275e50,_0x1d52b8){_0x275e50=_0x275e50-0x0;var _0x1b1ab0=_0x5078[_0x275e50];return _0x1b1ab0;};'use strict';var _=require(_0x8507('0x0'));var util=require(_0x8507('0x1'));var logger=require(_0x8507('0x2'))(_0x8507('0x3'));var moment=require(_0x8507('0x4'));var BPromise=require(_0x8507('0x5'));var rp=require(_0x8507('0x6'));var fs=require('fs');var path=require(_0x8507('0x7'));var rimraf=require(_0x8507('0x8'));var config=require(_0x8507('0x9'));var attributes=require(_0x8507('0xa'));module[_0x8507('0xb')]=function(_0x37519c,_0x5a359c){return _0x37519c[_0x8507('0xc')](_0x8507('0xd'),attributes,{'tableName':'analytics_metrics','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js index c26bae1..e9aa7b4 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 _0x19d7=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','debug','request\x20sent','error','code','message','AnalyticMetric,\x20%s,\x20%s','result','catch','lodash','moment','bluebird','randomstring'];(function(_0x5793b4,_0x34ae2d){var _0x5c60e0=function(_0x48238d){while(--_0x48238d){_0x5793b4['push'](_0x5793b4['shift']());}};_0x5c60e0(++_0x34ae2d);}(_0x19d7,0x172));var _0x719d=function(_0x1a07e1,_0x4952e2){_0x1a07e1=_0x1a07e1-0x0;var _0x507817=_0x19d7[_0x1a07e1];return _0x507817;};'use strict';var _=require(_0x719d('0x0'));var util=require('util');var moment=require(_0x719d('0x1'));var BPromise=require(_0x719d('0x2'));var rs=require(_0x719d('0x3'));var fs=require('fs');var Redis=require(_0x719d('0x4'));var db=require(_0x719d('0x5'))['db'];var utils=require(_0x719d('0x6'));var logger=require('../../config/logger')(_0x719d('0x7'));var config=require(_0x719d('0x8'));var jayson=require(_0x719d('0x9'));var client=jayson[_0x719d('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x316470,_0x580b64,_0x45f3e0){return new BPromise(function(_0x367990,_0x15794c){return client[_0x719d('0xb')](_0x316470,_0x45f3e0)[_0x719d('0xc')](function(_0xadadf8){logger[_0x719d('0xd')]('AnalyticMetric,\x20%s,\x20%s',_0x580b64,'request\x20sent');logger[_0x719d('0xe')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x580b64,_0x719d('0xf'),JSON['stringify'](_0xadadf8));if(_0xadadf8[_0x719d('0x10')]){if(_0xadadf8[_0x719d('0x10')][_0x719d('0x11')]===0x1f4){logger[_0x719d('0x10')]('AnalyticMetric,\x20%s,\x20%s',_0x580b64,_0xadadf8['error'][_0x719d('0x12')]);return _0x15794c(_0xadadf8[_0x719d('0x10')][_0x719d('0x12')]);}logger[_0x719d('0x10')](_0x719d('0x13'),_0x580b64,_0xadadf8[_0x719d('0x10')][_0x719d('0x12')]);return _0x367990(_0xadadf8[_0x719d('0x10')][_0x719d('0x12')]);}else{logger[_0x719d('0xd')](_0x719d('0x13'),_0x580b64,_0x719d('0xf'));_0x367990(_0xadadf8[_0x719d('0x14')]['message']);}})[_0x719d('0x15')](function(_0xeef12e){logger[_0x719d('0x10')](_0x719d('0x13'),_0x580b64,_0xeef12e);_0x15794c(_0xeef12e);});});} \ No newline at end of file +var _0x6ec9=['code','AnalyticMetric,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','request','then','info','request\x20sent','debug','stringify','error'];(function(_0x1fd934,_0x4b6112){var _0x4ea0fb=function(_0x1f1c59){while(--_0x1f1c59){_0x1fd934['push'](_0x1fd934['shift']());}};_0x4ea0fb(++_0x4b6112);}(_0x6ec9,0x17b));var _0x96ec=function(_0x1d649a,_0x5ecbeb){_0x1d649a=_0x1d649a-0x0;var _0x1c8642=_0x6ec9[_0x1d649a];return _0x1c8642;};'use strict';var _=require(_0x96ec('0x0'));var util=require(_0x96ec('0x1'));var moment=require(_0x96ec('0x2'));var BPromise=require('bluebird');var rs=require(_0x96ec('0x3'));var fs=require('fs');var Redis=require(_0x96ec('0x4'));var db=require(_0x96ec('0x5'))['db'];var utils=require(_0x96ec('0x6'));var logger=require(_0x96ec('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x96ec('0x8'));var client=jayson[_0x96ec('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x43525f,_0x289f2c,_0x5b2d56){return new BPromise(function(_0x2e9103,_0x2e041f){return client[_0x96ec('0xa')](_0x43525f,_0x5b2d56)[_0x96ec('0xb')](function(_0xeac19f){logger[_0x96ec('0xc')]('AnalyticMetric,\x20%s,\x20%s',_0x289f2c,_0x96ec('0xd'));logger[_0x96ec('0xe')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x289f2c,_0x96ec('0xd'),JSON[_0x96ec('0xf')](_0xeac19f));if(_0xeac19f[_0x96ec('0x10')]){if(_0xeac19f[_0x96ec('0x10')][_0x96ec('0x11')]===0x1f4){logger[_0x96ec('0x10')](_0x96ec('0x12'),_0x289f2c,_0xeac19f[_0x96ec('0x10')][_0x96ec('0x13')]);return _0x2e041f(_0xeac19f[_0x96ec('0x10')]['message']);}logger['error'](_0x96ec('0x12'),_0x289f2c,_0xeac19f['error']['message']);return _0x2e9103(_0xeac19f[_0x96ec('0x10')]['message']);}else{logger[_0x96ec('0xc')](_0x96ec('0x12'),_0x289f2c,_0x96ec('0xd'));_0x2e9103(_0xeac19f[_0x96ec('0x14')][_0x96ec('0x13')]);}})[_0x96ec('0x15')](function(_0x3eed58){logger[_0x96ec('0x10')](_0x96ec('0x12'),_0x289f2c,_0x3eed58);_0x2e041f(_0x3eed58);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index c7d023f..d903d0a 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 _0xf23b=['delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticMetric.controller','get','isAuthenticated','index','show','create','put','/:id'];(function(_0x292eb9,_0x4807f8){var _0x30f4af=function(_0x3e4f41){while(--_0x3e4f41){_0x292eb9['push'](_0x292eb9['shift']());}};_0x30f4af(++_0x4807f8);}(_0xf23b,0x133));var _0xbf23=function(_0x5ff87c,_0x5b2e21){_0x5ff87c=_0x5ff87c-0x0;var _0x31611e=_0xf23b[_0x5ff87c];return _0x31611e;};'use strict';var multer=require(_0xbf23('0x0'));var util=require(_0xbf23('0x1'));var path=require(_0xbf23('0x2'));var timeout=require(_0xbf23('0x3'));var express=require(_0xbf23('0x4'));var router=express['Router']();var fs_extra=require(_0xbf23('0x5'));var auth=require(_0xbf23('0x6'));var interaction=require(_0xbf23('0x7'));var config=require('../../config/environment');var controller=require(_0xbf23('0x8'));router[_0xbf23('0x9')]('/',auth[_0xbf23('0xa')](),controller[_0xbf23('0xb')]);router[_0xbf23('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xbf23('0xc')]);router['post']('/',auth[_0xbf23('0xa')](),controller[_0xbf23('0xd')]);router[_0xbf23('0xe')](_0xbf23('0xf'),auth[_0xbf23('0xa')](),controller['update']);router[_0xbf23('0x10')](_0xbf23('0xf'),auth[_0xbf23('0xa')](),controller[_0xbf23('0x11')]);module[_0xbf23('0x12')]=router; \ No newline at end of file +var _0x9a14=['get','/:id','isAuthenticated','post','create','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x399dbd,_0x3bb9bf){var _0xcad897=function(_0x69cc77){while(--_0x69cc77){_0x399dbd['push'](_0x399dbd['shift']());}};_0xcad897(++_0x3bb9bf);}(_0x9a14,0xa8));var _0x49a1=function(_0x1bb465,_0x39d473){_0x1bb465=_0x1bb465-0x0;var _0x5201a1=_0x9a14[_0x1bb465];return _0x5201a1;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49a1('0x0'));var timeout=require(_0x49a1('0x1'));var express=require(_0x49a1('0x2'));var router=express[_0x49a1('0x3')]();var fs_extra=require(_0x49a1('0x4'));var auth=require(_0x49a1('0x5'));var interaction=require(_0x49a1('0x6'));var config=require(_0x49a1('0x7'));var controller=require('./analyticMetric.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x49a1('0x8')](_0x49a1('0x9'),auth[_0x49a1('0xa')](),controller['show']);router[_0x49a1('0xb')]('/',auth[_0x49a1('0xa')](),controller[_0x49a1('0xc')]);router['put'](_0x49a1('0x9'),auth[_0x49a1('0xa')](),controller['update']);router[_0x49a1('0xd')](_0x49a1('0x9'),auth[_0x49a1('0xa')](),controller[_0x49a1('0xe')]);module[_0x49a1('0xf')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 7e7e5af..cd625f8 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 _0xaddc=['exports','TEXT','sequelize'];(function(_0x17bfdd,_0xa9b1bc){var _0x4e50ac=function(_0x592e42){while(--_0x592e42){_0x17bfdd['push'](_0x17bfdd['shift']());}};_0x4e50ac(++_0xa9b1bc);}(_0xaddc,0x86));var _0xcadd=function(_0x414d22,_0x1fc51c){_0x414d22=_0x414d22-0x0;var _0x5d1907=_0xaddc[_0x414d22];return _0x5d1907;};'use strict';var Sequelize=require(_0xcadd('0x0'));module[_0xcadd('0x1')]={'tree':{'type':Sequelize[_0xcadd('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x1581=['sequelize','exports'];(function(_0x2d34d6,_0x397ff9){var _0x1d3d12=function(_0x558800){while(--_0x558800){_0x2d34d6['push'](_0x2d34d6['shift']());}};_0x1d3d12(++_0x397ff9);}(_0x1581,0x118));var _0x1158=function(_0x5cd7d4,_0x1e4937){_0x5cd7d4=_0x5cd7d4-0x0;var _0x133fea=_0x1581[_0x5cd7d4];return _0x133fea;};'use strict';var Sequelize=require(_0x1158('0x0'));module[_0x1158('0x1')]={'tree':{'type':Sequelize['TEXT'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index d77e4dc..24629a5 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 _0x96dd=['pick','filter','merge','where','type','VIRTUAL','includeAll','include','rows','catch','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','limit','undefined','count','Content-Range','json','reject','save','update','destroy','then','end','stack','send','index','AnalyticTreeReport','rawAttributes','fieldName','key','model','map','name','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort'];(function(_0xd336fa,_0x39d1b2){var _0x3370b1=function(_0x41c5cc){while(--_0x41c5cc){_0xd336fa['push'](_0xd336fa['shift']());}};_0x3370b1(++_0x39d1b2);}(_0x96dd,0x12d));var _0xd96d=function(_0x11bb7d,_0x28b694){_0x11bb7d=_0x11bb7d-0x0;var _0x5a95e7=_0x96dd[_0x11bb7d];return _0x5a95e7;};'use strict';var emlformat=require(_0xd96d('0x0'));var rimraf=require(_0xd96d('0x1'));var zipdir=require(_0xd96d('0x2'));var jsonpatch=require(_0xd96d('0x3'));var rp=require(_0xd96d('0x4'));var moment=require('moment');var BPromise=require(_0xd96d('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xd96d('0x6'));var csv=require('to-csv');var ejs=require(_0xd96d('0x7'));var fs=require('fs');var fs_extra=require(_0xd96d('0x8'));var _=require(_0xd96d('0x9'));var squel=require(_0xd96d('0xa'));var crypto=require(_0xd96d('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xd96d('0xc'));var toCsv=require(_0xd96d('0xd'));var querystring=require(_0xd96d('0xe'));var Papa=require('papaparse');var Redis=require(_0xd96d('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xd96d('0x10'));var hardwareService=require(_0xd96d('0x11'));var logger=require(_0xd96d('0x12'))(_0xd96d('0x13'));var utils=require(_0xd96d('0x14'));var config=require(_0xd96d('0x15'));var licenseUtil=require(_0xd96d('0x16'));var db=require(_0xd96d('0x17'))['db'];function respondWithStatusCode(_0x225cfa,_0x317e83){_0x317e83=_0x317e83||0xcc;return function(_0xcf3440){if(_0xcf3440){return _0x225cfa[_0xd96d('0x18')](_0x317e83);}return _0x225cfa[_0xd96d('0x19')](_0x317e83)['end']();};}function respondWithResult(_0x2cd497,_0x38de96){_0x38de96=_0x38de96||0xc8;return function(_0x2b71a7){if(_0x2b71a7){return _0x2cd497['status'](_0x38de96)['json'](_0x2b71a7);}};}function respondWithFilteredResult(_0x4cb33c,_0x56a246){return function(_0x40c046){if(_0x40c046){var _0x3685e4=typeof _0x56a246[_0xd96d('0x1a')]==='undefined'&&typeof _0x56a246[_0xd96d('0x1b')]===_0xd96d('0x1c');var _0x9b8ead=_0x40c046[_0xd96d('0x1d')];var _0x19e47d=_0x3685e4?0x0:_0x56a246['offset'];var _0xcb3859=_0x3685e4?_0x40c046['count']:_0x56a246['offset']+_0x56a246[_0xd96d('0x1b')];var _0x5e8637;if(_0xcb3859>=_0x9b8ead){_0xcb3859=_0x9b8ead;_0x5e8637=0xc8;}else{_0x5e8637=0xce;}_0x4cb33c[_0xd96d('0x19')](_0x5e8637);return _0x4cb33c['set'](_0xd96d('0x1e'),_0x19e47d+'-'+_0xcb3859+'/'+_0x9b8ead)[_0xd96d('0x1f')](_0x40c046);}return null;};}function patchUpdates(_0x30d083){return function(_0x5c3f7e){try{jsonpatch['apply'](_0x5c3f7e,_0x30d083,!![]);}catch(_0x34b69f){return BPromise[_0xd96d('0x20')](_0x34b69f);}return _0x5c3f7e[_0xd96d('0x21')]();};}function saveUpdates(_0x50d095,_0x5b9a0e){return function(_0x45f748){if(_0x45f748){return _0x45f748[_0xd96d('0x22')](_0x50d095)['then'](function(_0x2f0c8a){return _0x2f0c8a;});}return null;};}function removeEntity(_0x333e9b,_0x388d05){return function(_0x4daa10){if(_0x4daa10){return _0x4daa10[_0xd96d('0x23')]()[_0xd96d('0x24')](function(){_0x333e9b[_0xd96d('0x19')](0xcc)[_0xd96d('0x25')]();});}};}function handleEntityNotFound(_0x5482ae,_0x3ed903){return function(_0x538bd5){if(!_0x538bd5){_0x5482ae[_0xd96d('0x18')](0x194);}return _0x538bd5;};}function handleError(_0x339eba,_0x138202){_0x138202=_0x138202||0x1f4;return function(_0x23fd77){logger['error'](_0x23fd77[_0xd96d('0x26')]);if(_0x23fd77['name']){delete _0x23fd77['name'];}_0x339eba[_0xd96d('0x19')](_0x138202)[_0xd96d('0x27')](_0x23fd77);};}exports[_0xd96d('0x28')]=function(_0xdd0e18,_0x356691){var _0x176660={},_0x402f5f={},_0xebec8e={'count':0x0,'rows':[]};var _0x2d713d=_['map'](db[_0xd96d('0x29')][_0xd96d('0x2a')],function(_0x3652f7){return{'name':_0x3652f7[_0xd96d('0x2b')],'type':_0x3652f7['type'][_0xd96d('0x2c')]};});_0x402f5f[_0xd96d('0x2d')]=_[_0xd96d('0x2e')](_0x2d713d,_0xd96d('0x2f'));_0x402f5f[_0xd96d('0x30')]=_[_0xd96d('0x31')](_0xdd0e18['query']);_0x402f5f[_0xd96d('0x32')]=_[_0xd96d('0x33')](_0x402f5f['model'],_0x402f5f[_0xd96d('0x30')]);_0x176660['attributes']=_['intersection'](_0x402f5f['model'],qs[_0xd96d('0x34')](_0xdd0e18[_0xd96d('0x30')][_0xd96d('0x34')]));_0x176660['attributes']=_0x176660['attributes'][_0xd96d('0x35')]?_0x176660[_0xd96d('0x36')]:_0x402f5f[_0xd96d('0x2d')];if(!_0xdd0e18['query'][_0xd96d('0x37')](_0xd96d('0x38'))){_0x176660[_0xd96d('0x1b')]=qs[_0xd96d('0x1b')](_0xdd0e18['query'][_0xd96d('0x1b')]);_0x176660[_0xd96d('0x1a')]=qs[_0xd96d('0x1a')](_0xdd0e18[_0xd96d('0x30')][_0xd96d('0x1a')]);}_0x176660[_0xd96d('0x39')]=qs[_0xd96d('0x3a')](_0xdd0e18[_0xd96d('0x30')][_0xd96d('0x3a')]);_0x176660['where']=qs['filters'](_[_0xd96d('0x3b')](_0xdd0e18['query'],_0x402f5f[_0xd96d('0x32')]),_0x2d713d);if(_0xdd0e18[_0xd96d('0x30')][_0xd96d('0x3c')]){_0x176660['where']=_[_0xd96d('0x3d')](_0x176660[_0xd96d('0x3e')],{'$or':_['map'](_0x2d713d,function(_0x1f0665){if(_0x1f0665[_0xd96d('0x3f')]!==_0xd96d('0x40')){var _0xa142d5={};_0xa142d5[_0x1f0665[_0xd96d('0x2f')]]={'$like':'%'+_0xdd0e18[_0xd96d('0x30')][_0xd96d('0x3c')]+'%'};return _0xa142d5;}})});}_0x176660=_['merge']({},_0x176660,_0xdd0e18['options']);var _0x1de61f={'where':_0x176660['where']};return db['AnalyticTreeReport'][_0xd96d('0x1d')](_0x1de61f)[_0xd96d('0x24')](function(_0x48d0af){_0xebec8e['count']=_0x48d0af;if(_0xdd0e18[_0xd96d('0x30')][_0xd96d('0x41')]){_0x176660[_0xd96d('0x42')]=[{'all':!![]}];}return db[_0xd96d('0x29')]['findAll'](_0x176660);})[_0xd96d('0x24')](function(_0x4359ab){_0xebec8e[_0xd96d('0x43')]=_0x4359ab;return _0xebec8e;})['then'](respondWithFilteredResult(_0x356691,_0x176660))[_0xd96d('0x44')](handleError(_0x356691,null));};exports['show']=function(_0x212ead,_0xdc4c40){var _0x50e4ad={'raw':!![],'where':{'id':_0x212ead['params']['id']}},_0x3467d8={};_0x3467d8['model']=_[_0xd96d('0x31')](db[_0xd96d('0x29')][_0xd96d('0x2a')]);_0x3467d8[_0xd96d('0x30')]=_['keys'](_0x212ead[_0xd96d('0x30')]);_0x3467d8[_0xd96d('0x32')]=_[_0xd96d('0x33')](_0x3467d8[_0xd96d('0x2d')],_0x3467d8[_0xd96d('0x30')]);_0x50e4ad[_0xd96d('0x36')]=_[_0xd96d('0x33')](_0x3467d8[_0xd96d('0x2d')],qs[_0xd96d('0x34')](_0x212ead['query']['fields']));_0x50e4ad[_0xd96d('0x36')]=_0x50e4ad['attributes'][_0xd96d('0x35')]?_0x50e4ad[_0xd96d('0x36')]:_0x3467d8[_0xd96d('0x2d')];if(_0x212ead[_0xd96d('0x30')][_0xd96d('0x41')]){_0x50e4ad[_0xd96d('0x42')]=[{'all':!![]}];}_0x50e4ad=_[_0xd96d('0x3d')]({},_0x50e4ad,_0x212ead['options']);return db['AnalyticTreeReport'][_0xd96d('0x45')](_0x50e4ad)[_0xd96d('0x24')](handleEntityNotFound(_0xdc4c40,null))[_0xd96d('0x24')](respondWithResult(_0xdc4c40,null))['catch'](handleError(_0xdc4c40,null));};exports[_0xd96d('0x46')]=function(_0x5c9089,_0x457725){return db[_0xd96d('0x29')]['create'](_0x5c9089[_0xd96d('0x47')],{})[_0xd96d('0x24')](respondWithResult(_0x457725,0xc9))[_0xd96d('0x44')](handleError(_0x457725,null));};exports[_0xd96d('0x22')]=function(_0x37e667,_0x2c565b){if(_0x37e667[_0xd96d('0x47')]['id']){delete _0x37e667[_0xd96d('0x47')]['id'];}return db['AnalyticTreeReport'][_0xd96d('0x45')]({'where':{'id':_0x37e667['params']['id']}})[_0xd96d('0x24')](handleEntityNotFound(_0x2c565b,null))[_0xd96d('0x24')](saveUpdates(_0x37e667[_0xd96d('0x47')],null))['then'](respondWithResult(_0x2c565b,null))['catch'](handleError(_0x2c565b,null));};exports[_0xd96d('0x23')]=function(_0x3f7cbe,_0x5d28d8){return db[_0xd96d('0x29')][_0xd96d('0x45')]({'where':{'id':_0x3f7cbe['params']['id']}})[_0xd96d('0x24')](handleEntityNotFound(_0x5d28d8,null))[_0xd96d('0x24')](removeEntity(_0x5d28d8,null))[_0xd96d('0x44')](handleError(_0x5d28d8,null));}; \ No newline at end of file +var _0x2576=['findAll','rows','catch','show','length','find','create','body','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','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/environment','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','end','error','name','send','map','AnalyticTreeReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include'];(function(_0x462b76,_0x50c1dd){var _0x52f60d=function(_0x476bc8){while(--_0x476bc8){_0x462b76['push'](_0x462b76['shift']());}};_0x52f60d(++_0x50c1dd);}(_0x2576,0x171));var _0x6257=function(_0x48a010,_0x20f883){_0x48a010=_0x48a010-0x0;var _0xf78b79=_0x2576[_0x48a010];return _0xf78b79;};'use strict';var emlformat=require(_0x6257('0x0'));var rimraf=require(_0x6257('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6257('0x2'));var rp=require(_0x6257('0x3'));var moment=require(_0x6257('0x4'));var BPromise=require(_0x6257('0x5'));var Mustache=require(_0x6257('0x6'));var util=require('util');var path=require(_0x6257('0x7'));var sox=require('sox');var csv=require(_0x6257('0x8'));var ejs=require(_0x6257('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6257('0xa'));var squel=require(_0x6257('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x6257('0xc'));var toCsv=require(_0x6257('0x8'));var querystring=require(_0x6257('0xd'));var Papa=require(_0x6257('0xe'));var Redis=require(_0x6257('0xf'));var authService=require(_0x6257('0x10'));var qs=require(_0x6257('0x11'));var as=require(_0x6257('0x12'));var hardwareService=require(_0x6257('0x13'));var logger=require(_0x6257('0x14'))(_0x6257('0x15'));var utils=require('../../config/utils');var config=require(_0x6257('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x6257('0x17'))['db'];function respondWithStatusCode(_0x5ce000,_0x239867){_0x239867=_0x239867||0xcc;return function(_0x259032){if(_0x259032){return _0x5ce000[_0x6257('0x18')](_0x239867);}return _0x5ce000[_0x6257('0x19')](_0x239867)['end']();};}function respondWithResult(_0x15f44a,_0x110f7f){_0x110f7f=_0x110f7f||0xc8;return function(_0x24c2c5){if(_0x24c2c5){return _0x15f44a[_0x6257('0x19')](_0x110f7f)[_0x6257('0x1a')](_0x24c2c5);}};}function respondWithFilteredResult(_0x43ceb0,_0x3c9605){return function(_0x204d81){if(_0x204d81){var _0xa72c04=typeof _0x3c9605[_0x6257('0x1b')]==='undefined'&&typeof _0x3c9605[_0x6257('0x1c')]===_0x6257('0x1d');var _0x480615=_0x204d81['count'];var _0x301ead=_0xa72c04?0x0:_0x3c9605[_0x6257('0x1b')];var _0x26aaab=_0xa72c04?_0x204d81[_0x6257('0x1e')]:_0x3c9605[_0x6257('0x1b')]+_0x3c9605[_0x6257('0x1c')];var _0x28fd41;if(_0x26aaab>=_0x480615){_0x26aaab=_0x480615;_0x28fd41=0xc8;}else{_0x28fd41=0xce;}_0x43ceb0[_0x6257('0x19')](_0x28fd41);return _0x43ceb0[_0x6257('0x1f')](_0x6257('0x20'),_0x301ead+'-'+_0x26aaab+'/'+_0x480615)[_0x6257('0x1a')](_0x204d81);}return null;};}function patchUpdates(_0x4241e9){return function(_0x111f54){try{jsonpatch[_0x6257('0x21')](_0x111f54,_0x4241e9,!![]);}catch(_0x12c6ba){return BPromise[_0x6257('0x22')](_0x12c6ba);}return _0x111f54['save']();};}function saveUpdates(_0x39200c,_0x4fa450){return function(_0x27b5de){if(_0x27b5de){return _0x27b5de[_0x6257('0x23')](_0x39200c)[_0x6257('0x24')](function(_0x44a247){return _0x44a247;});}return null;};}function removeEntity(_0x51641d,_0x507efd){return function(_0x1ae170){if(_0x1ae170){return _0x1ae170['destroy']()['then'](function(){_0x51641d[_0x6257('0x19')](0xcc)[_0x6257('0x25')]();});}};}function handleEntityNotFound(_0x3d21ea,_0x4875e4){return function(_0x31b531){if(!_0x31b531){_0x3d21ea[_0x6257('0x18')](0x194);}return _0x31b531;};}function handleError(_0x1ac9d4,_0x51f289){_0x51f289=_0x51f289||0x1f4;return function(_0x5b1c9b){logger[_0x6257('0x26')](_0x5b1c9b['stack']);if(_0x5b1c9b[_0x6257('0x27')]){delete _0x5b1c9b[_0x6257('0x27')];}_0x1ac9d4[_0x6257('0x19')](_0x51f289)[_0x6257('0x28')](_0x5b1c9b);};}exports['index']=function(_0x2e2788,_0x39457a){var _0x4e0e1e={},_0x92975d={},_0x57a19a={'count':0x0,'rows':[]};var _0x5ac5d8=_[_0x6257('0x29')](db[_0x6257('0x2a')][_0x6257('0x2b')],function(_0x274c6c){return{'name':_0x274c6c[_0x6257('0x2c')],'type':_0x274c6c[_0x6257('0x2d')][_0x6257('0x2e')]};});_0x92975d[_0x6257('0x2f')]=_['map'](_0x5ac5d8,_0x6257('0x27'));_0x92975d[_0x6257('0x30')]=_[_0x6257('0x31')](_0x2e2788[_0x6257('0x30')]);_0x92975d[_0x6257('0x32')]=_['intersection'](_0x92975d[_0x6257('0x2f')],_0x92975d[_0x6257('0x30')]);_0x4e0e1e[_0x6257('0x33')]=_[_0x6257('0x34')](_0x92975d[_0x6257('0x2f')],qs['fields'](_0x2e2788['query'][_0x6257('0x35')]));_0x4e0e1e[_0x6257('0x33')]=_0x4e0e1e[_0x6257('0x33')]['length']?_0x4e0e1e['attributes']:_0x92975d[_0x6257('0x2f')];if(!_0x2e2788[_0x6257('0x30')]['hasOwnProperty']('nolimit')){_0x4e0e1e[_0x6257('0x1c')]=qs['limit'](_0x2e2788['query'][_0x6257('0x1c')]);_0x4e0e1e[_0x6257('0x1b')]=qs[_0x6257('0x1b')](_0x2e2788['query'][_0x6257('0x1b')]);}_0x4e0e1e['order']=qs[_0x6257('0x36')](_0x2e2788[_0x6257('0x30')]['sort']);_0x4e0e1e[_0x6257('0x37')]=qs['filters'](_[_0x6257('0x38')](_0x2e2788[_0x6257('0x30')],_0x92975d[_0x6257('0x32')]),_0x5ac5d8);if(_0x2e2788[_0x6257('0x30')]['filter']){_0x4e0e1e[_0x6257('0x37')]=_[_0x6257('0x39')](_0x4e0e1e[_0x6257('0x37')],{'$or':_[_0x6257('0x29')](_0x5ac5d8,function(_0xfaa7ac){if(_0xfaa7ac[_0x6257('0x2d')]!==_0x6257('0x3a')){var _0x38a114={};_0x38a114[_0xfaa7ac[_0x6257('0x27')]]={'$like':'%'+_0x2e2788[_0x6257('0x30')][_0x6257('0x3b')]+'%'};return _0x38a114;}})});}_0x4e0e1e=_['merge']({},_0x4e0e1e,_0x2e2788[_0x6257('0x3c')]);var _0x181a58={'where':_0x4e0e1e[_0x6257('0x37')]};return db[_0x6257('0x2a')][_0x6257('0x1e')](_0x181a58)[_0x6257('0x24')](function(_0x297b59){_0x57a19a[_0x6257('0x1e')]=_0x297b59;if(_0x2e2788[_0x6257('0x30')][_0x6257('0x3d')]){_0x4e0e1e[_0x6257('0x3e')]=[{'all':!![]}];}return db[_0x6257('0x2a')][_0x6257('0x3f')](_0x4e0e1e);})[_0x6257('0x24')](function(_0xb47984){_0x57a19a[_0x6257('0x40')]=_0xb47984;return _0x57a19a;})['then'](respondWithFilteredResult(_0x39457a,_0x4e0e1e))[_0x6257('0x41')](handleError(_0x39457a,null));};exports[_0x6257('0x42')]=function(_0x2cd909,_0x5efa82){var _0x4334d0={'raw':!![],'where':{'id':_0x2cd909['params']['id']}},_0x5e1acf={};_0x5e1acf['model']=_[_0x6257('0x31')](db[_0x6257('0x2a')][_0x6257('0x2b')]);_0x5e1acf['query']=_[_0x6257('0x31')](_0x2cd909['query']);_0x5e1acf[_0x6257('0x32')]=_[_0x6257('0x34')](_0x5e1acf['model'],_0x5e1acf[_0x6257('0x30')]);_0x4334d0['attributes']=_[_0x6257('0x34')](_0x5e1acf[_0x6257('0x2f')],qs['fields'](_0x2cd909[_0x6257('0x30')][_0x6257('0x35')]));_0x4334d0['attributes']=_0x4334d0[_0x6257('0x33')][_0x6257('0x43')]?_0x4334d0['attributes']:_0x5e1acf[_0x6257('0x2f')];if(_0x2cd909[_0x6257('0x30')][_0x6257('0x3d')]){_0x4334d0[_0x6257('0x3e')]=[{'all':!![]}];}_0x4334d0=_[_0x6257('0x39')]({},_0x4334d0,_0x2cd909[_0x6257('0x3c')]);return db[_0x6257('0x2a')][_0x6257('0x44')](_0x4334d0)['then'](handleEntityNotFound(_0x5efa82,null))[_0x6257('0x24')](respondWithResult(_0x5efa82,null))['catch'](handleError(_0x5efa82,null));};exports['create']=function(_0x52ea7d,_0x263bdc){return db[_0x6257('0x2a')][_0x6257('0x45')](_0x52ea7d[_0x6257('0x46')],{})[_0x6257('0x24')](respondWithResult(_0x263bdc,0xc9))[_0x6257('0x41')](handleError(_0x263bdc,null));};exports[_0x6257('0x23')]=function(_0x565d16,_0x2cf573){if(_0x565d16[_0x6257('0x46')]['id']){delete _0x565d16[_0x6257('0x46')]['id'];}return db[_0x6257('0x2a')][_0x6257('0x44')]({'where':{'id':_0x565d16[_0x6257('0x47')]['id']}})['then'](handleEntityNotFound(_0x2cf573,null))[_0x6257('0x24')](saveUpdates(_0x565d16[_0x6257('0x46')],null))['then'](respondWithResult(_0x2cf573,null))[_0x6257('0x41')](handleError(_0x2cf573,null));};exports['destroy']=function(_0x4bbdac,_0x333ce6){return db[_0x6257('0x2a')][_0x6257('0x44')]({'where':{'id':_0x4bbdac[_0x6257('0x47')]['id']}})['then'](handleEntityNotFound(_0x333ce6,null))[_0x6257('0x24')](removeEntity(_0x333ce6,null))[_0x6257('0x41')](handleError(_0x333ce6,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 040470f..31c4e31 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 _0x9cc7=['../../config/environment','./analyticTreeReport.attributes','exports','define','AnalyticTreeReport','analytics_report_trees','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x4caf24,_0x16b74c){var _0x5e988c=function(_0x2099c1){while(--_0x2099c1){_0x4caf24['push'](_0x4caf24['shift']());}};_0x5e988c(++_0x16b74c);}(_0x9cc7,0x68));var _0x79cc=function(_0x5d949e,_0x555707){_0x5d949e=_0x5d949e-0x0;var _0x445c1e=_0x9cc7[_0x5d949e];return _0x445c1e;};'use strict';var _=require(_0x79cc('0x0'));var util=require(_0x79cc('0x1'));var logger=require(_0x79cc('0x2'))(_0x79cc('0x3'));var moment=require(_0x79cc('0x4'));var BPromise=require(_0x79cc('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x79cc('0x6'));var rimraf=require(_0x79cc('0x7'));var config=require(_0x79cc('0x8'));var attributes=require(_0x79cc('0x9'));module[_0x79cc('0xa')]=function(_0x217bc7,_0x56f75f){return _0x217bc7[_0x79cc('0xb')](_0x79cc('0xc'),attributes,{'tableName':_0x79cc('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbbe8=['rimraf','../../config/environment','./analyticTreeReport.attributes','exports','define','analytics_report_trees','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3f3e42,_0x43128b){var _0x45c9d5=function(_0x39ccb9){while(--_0x39ccb9){_0x3f3e42['push'](_0x3f3e42['shift']());}};_0x45c9d5(++_0x43128b);}(_0xbbe8,0x158));var _0x8bbe=function(_0x338491,_0x25f9f9){_0x338491=_0x338491-0x0;var _0x4bf6fc=_0xbbe8[_0x338491];return _0x4bf6fc;};'use strict';var _=require(_0x8bbe('0x0'));var util=require(_0x8bbe('0x1'));var logger=require(_0x8bbe('0x2'))(_0x8bbe('0x3'));var moment=require(_0x8bbe('0x4'));var BPromise=require(_0x8bbe('0x5'));var rp=require(_0x8bbe('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8bbe('0x7'));var config=require(_0x8bbe('0x8'));var attributes=require(_0x8bbe('0x9'));module[_0x8bbe('0xa')]=function(_0x2475bb,_0x5c2ba0){return _0x2475bb[_0x8bbe('0xb')]('AnalyticTreeReport',attributes,{'tableName':_0x8bbe('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.rpc.js b/server/api/analyticTreeReport/analyticTreeReport.rpc.js index 51e73cf..f2e9c33 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 _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','AnalyticTreeReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x3e000d,_0x59a02d){var _0xf4b7ff=function(_0x5d4d40){while(--_0x5d4d40){_0x3e000d['push'](_0x3e000d['shift']());}};_0xf4b7ff(++_0x59a02d);}(_0x5f2f,0x73));var _0xf5f2=function(_0x5b987d,_0x24a344){_0x5b987d=_0x5b987d-0x0;var _0x282e0d=_0x5f2f[_0x5b987d];return _0x282e0d;};'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')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});} \ No newline at end of file +var _0x1261=['then','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x5aa8a4,_0x1910eb){var _0x3fb749=function(_0x1f440d){while(--_0x1f440d){_0x5aa8a4['push'](_0x5aa8a4['shift']());}};_0x3fb749(++_0x1910eb);}(_0x1261,0x144));var _0x1126=function(_0x451735,_0x391a76){_0x451735=_0x451735-0x0;var _0x41d1e2=_0x1261[_0x451735];return _0x41d1e2;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('AnalyticTreeReport,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 49561b2..bdd2418 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 _0x7507=['connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./analyticTreeReport.controller','isAuthenticated','get','/:id','show','post','create','put','update','delete','multer','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7507,0x130));var _0x7750=function(_0x1bf11a,_0x5def36){_0x1bf11a=_0x1bf11a-0x0;var _0x2fdb86=_0x7507[_0x1bf11a];return _0x2fdb86;};'use strict';var multer=require(_0x7750('0x0'));var util=require(_0x7750('0x1'));var path=require('path');var timeout=require(_0x7750('0x2'));var express=require('express');var router=express[_0x7750('0x3')]();var fs_extra=require(_0x7750('0x4'));var auth=require(_0x7750('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7750('0x6'));var controller=require(_0x7750('0x7'));router['get']('/',auth[_0x7750('0x8')](),controller['index']);router[_0x7750('0x9')](_0x7750('0xa'),auth[_0x7750('0x8')](),controller[_0x7750('0xb')]);router[_0x7750('0xc')]('/',auth[_0x7750('0x8')](),controller[_0x7750('0xd')]);router[_0x7750('0xe')]('/:id',auth[_0x7750('0x8')](),controller[_0x7750('0xf')]);router[_0x7750('0x10')](_0x7750('0xa'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x6a45=['show','post','create','update','delete','destroy','exports','multer','connect-timeout','express','fs-extra','../../components/interaction/service','get','/:id','isAuthenticated'];(function(_0x483ccd,_0x47ea21){var _0x7fd74c=function(_0x3693ed){while(--_0x3693ed){_0x483ccd['push'](_0x483ccd['shift']());}};_0x7fd74c(++_0x47ea21);}(_0x6a45,0xe8));var _0x56a4=function(_0x3aeb0e,_0x3f6d34){_0x3aeb0e=_0x3aeb0e-0x0;var _0x2e0032=_0x6a45[_0x3aeb0e];return _0x2e0032;};'use strict';var multer=require(_0x56a4('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x56a4('0x1'));var express=require(_0x56a4('0x2'));var router=express['Router']();var fs_extra=require(_0x56a4('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x56a4('0x4'));var config=require('../../config/environment');var controller=require('./analyticTreeReport.controller');router[_0x56a4('0x5')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x56a4('0x6'),auth[_0x56a4('0x7')](),controller[_0x56a4('0x8')]);router[_0x56a4('0x9')]('/',auth[_0x56a4('0x7')](),controller[_0x56a4('0xa')]);router['put']('/:id',auth[_0x56a4('0x7')](),controller[_0x56a4('0xb')]);router[_0x56a4('0xc')](_0x56a4('0x6'),auth['isAuthenticated'](),controller[_0x56a4('0xd')]);module[_0x56a4('0xe')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 73d5a37..9a4ac4d 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 _0x6921=['STRING','exports'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0x6921,0x1d1));var _0x1692=function(_0x205f95,_0x48c42e){_0x205f95=_0x205f95-0x0;var _0x212484=_0x6921[_0x205f95];return _0x212484;};'use strict';var Sequelize=require('sequelize');module[_0x1692('0x0')]={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize[_0x1692('0x1')]},'type':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xbc17=['STRING','sequelize','exports'];(function(_0x1246ba,_0x314721){var _0x4a6dfb=function(_0x4030d1){while(--_0x4030d1){_0x1246ba['push'](_0x1246ba['shift']());}};_0x4a6dfb(++_0x314721);}(_0xbc17,0x1ab));var _0x7bc1=function(_0x181c12,_0x42241d){_0x181c12=_0x181c12-0x0;var _0x219ffd=_0xbc17[_0x181c12];return _0x219ffd;};'use strict';var Sequelize=require(_0x7bc1('0x0'));module[_0x7bc1('0x1')]={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize[_0x7bc1('0x2')]},'type':{'type':Sequelize[_0x7bc1('0x2')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index dc543bd..63bed9f 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 _0xb78c=['type','key','model','keys','filters','intersection','query','attributes','fields','length','limit','order','sort','where','merge','VIRTUAL','options','includeAll','include','rows','params','find','catch','get','omit','createdAt','updatedAt','body','create','update','destroy','originalname','basename','file','filename','mimetype','download','findOne','join','root','offline-chat/','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','Content-Range','apply','reject','save','then','error','stack','name','send','index','map','Attachment','rawAttributes'];(function(_0xbc3682,_0x8401d2){var _0x403e28=function(_0x36bd9d){while(--_0x36bd9d){_0xbc3682['push'](_0xbc3682['shift']());}};_0x403e28(++_0x8401d2);}(_0xb78c,0x1d2));var _0xcb78=function(_0x6aaa69,_0x4457b5){_0x6aaa69=_0x6aaa69-0x0;var _0x25359f=_0xb78c[_0x6aaa69];return _0x25359f;};'use strict';var emlformat=require(_0xcb78('0x0'));var rimraf=require(_0xcb78('0x1'));var zipdir=require(_0xcb78('0x2'));var jsonpatch=require(_0xcb78('0x3'));var rp=require(_0xcb78('0x4'));var moment=require(_0xcb78('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xcb78('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xcb78('0x7'));var fs=require('fs');var fs_extra=require(_0xcb78('0x8'));var _=require(_0xcb78('0x9'));var squel=require('squel');var crypto=require(_0xcb78('0xa'));var jsforce=require(_0xcb78('0xb'));var deskjs=require(_0xcb78('0xc'));var toCsv=require(_0xcb78('0xd'));var querystring=require(_0xcb78('0xe'));var Papa=require(_0xcb78('0xf'));var Redis=require(_0xcb78('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xcb78('0x11'));var hardwareService=require(_0xcb78('0x12'));var logger=require(_0xcb78('0x13'))(_0xcb78('0x14'));var utils=require(_0xcb78('0x15'));var config=require(_0xcb78('0x16'));var licenseUtil=require(_0xcb78('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3b8ca5,_0x5c3449){_0x5c3449=_0x5c3449||0xcc;return function(_0x83f06b){if(_0x83f06b){return _0x3b8ca5[_0xcb78('0x18')](_0x5c3449);}return _0x3b8ca5[_0xcb78('0x19')](_0x5c3449)[_0xcb78('0x1a')]();};}function respondWithResult(_0x14c65c,_0x4342ca){_0x4342ca=_0x4342ca||0xc8;return function(_0x59495c){if(_0x59495c){return _0x14c65c[_0xcb78('0x19')](_0x4342ca)[_0xcb78('0x1b')](_0x59495c);}};}function respondWithFilteredResult(_0x474d71,_0x1d5939){return function(_0x38fb5e){if(_0x38fb5e){var _0x74896a=typeof _0x1d5939[_0xcb78('0x1c')]===_0xcb78('0x1d')&&typeof _0x1d5939['limit']===_0xcb78('0x1d');var _0x15f460=_0x38fb5e[_0xcb78('0x1e')];var _0xe567c6=_0x74896a?0x0:_0x1d5939[_0xcb78('0x1c')];var _0x28736e=_0x74896a?_0x38fb5e[_0xcb78('0x1e')]:_0x1d5939['offset']+_0x1d5939['limit'];var _0x37a03e;if(_0x28736e>=_0x15f460){_0x28736e=_0x15f460;_0x37a03e=0xc8;}else{_0x37a03e=0xce;}_0x474d71['status'](_0x37a03e);return _0x474d71['set'](_0xcb78('0x1f'),_0xe567c6+'-'+_0x28736e+'/'+_0x15f460)['json'](_0x38fb5e);}return null;};}function patchUpdates(_0x295c6d){return function(_0x4820cf){try{jsonpatch[_0xcb78('0x20')](_0x4820cf,_0x295c6d,!![]);}catch(_0x35c399){return BPromise[_0xcb78('0x21')](_0x35c399);}return _0x4820cf[_0xcb78('0x22')]();};}function saveUpdates(_0xe77c2,_0x11d2b8){return function(_0x44ad09){if(_0x44ad09){return _0x44ad09['update'](_0xe77c2)[_0xcb78('0x23')](function(_0x4332bd){return _0x4332bd;});}return null;};}function removeEntity(_0x5d9575,_0x17b2b7){return function(_0x4f5929){if(_0x4f5929){return _0x4f5929['destroy']()['then'](function(){_0x5d9575[_0xcb78('0x19')](0xcc)[_0xcb78('0x1a')]();});}};}function handleEntityNotFound(_0x5298e7,_0x534053){return function(_0x52fa36){if(!_0x52fa36){_0x5298e7[_0xcb78('0x18')](0x194);}return _0x52fa36;};}function handleError(_0x319b19,_0x32eea6){_0x32eea6=_0x32eea6||0x1f4;return function(_0x1a1739){logger[_0xcb78('0x24')](_0x1a1739[_0xcb78('0x25')]);if(_0x1a1739[_0xcb78('0x26')]){delete _0x1a1739[_0xcb78('0x26')];}_0x319b19[_0xcb78('0x19')](_0x32eea6)[_0xcb78('0x27')](_0x1a1739);};}exports[_0xcb78('0x28')]=function(_0x26e3ed,_0x330e32){var _0x1ea82f={},_0x4047f7={},_0x5a2692={'count':0x0,'rows':[]};var _0x35e74f=_[_0xcb78('0x29')](db[_0xcb78('0x2a')][_0xcb78('0x2b')],function(_0x417af6){return{'name':_0x417af6['fieldName'],'type':_0x417af6[_0xcb78('0x2c')][_0xcb78('0x2d')]};});_0x4047f7[_0xcb78('0x2e')]=_[_0xcb78('0x29')](_0x35e74f,_0xcb78('0x26'));_0x4047f7['query']=_[_0xcb78('0x2f')](_0x26e3ed['query']);_0x4047f7[_0xcb78('0x30')]=_[_0xcb78('0x31')](_0x4047f7['model'],_0x4047f7[_0xcb78('0x32')]);_0x1ea82f[_0xcb78('0x33')]=_['intersection'](_0x4047f7['model'],qs[_0xcb78('0x34')](_0x26e3ed[_0xcb78('0x32')][_0xcb78('0x34')]));_0x1ea82f[_0xcb78('0x33')]=_0x1ea82f[_0xcb78('0x33')][_0xcb78('0x35')]?_0x1ea82f[_0xcb78('0x33')]:_0x4047f7[_0xcb78('0x2e')];if(!_0x26e3ed[_0xcb78('0x32')]['hasOwnProperty']('nolimit')){_0x1ea82f[_0xcb78('0x36')]=qs[_0xcb78('0x36')](_0x26e3ed[_0xcb78('0x32')][_0xcb78('0x36')]);_0x1ea82f[_0xcb78('0x1c')]=qs[_0xcb78('0x1c')](_0x26e3ed[_0xcb78('0x32')][_0xcb78('0x1c')]);}_0x1ea82f[_0xcb78('0x37')]=qs[_0xcb78('0x38')](_0x26e3ed[_0xcb78('0x32')][_0xcb78('0x38')]);_0x1ea82f['where']=qs[_0xcb78('0x30')](_['pick'](_0x26e3ed[_0xcb78('0x32')],_0x4047f7[_0xcb78('0x30')]),_0x35e74f);if(_0x26e3ed['query']['filter']){_0x1ea82f[_0xcb78('0x39')]=_[_0xcb78('0x3a')](_0x1ea82f[_0xcb78('0x39')],{'$or':_[_0xcb78('0x29')](_0x35e74f,function(_0x3b9363){if(_0x3b9363['type']!==_0xcb78('0x3b')){var _0x22a2a9={};_0x22a2a9[_0x3b9363[_0xcb78('0x26')]]={'$like':'%'+_0x26e3ed['query']['filter']+'%'};return _0x22a2a9;}})});}_0x1ea82f=_['merge']({},_0x1ea82f,_0x26e3ed[_0xcb78('0x3c')]);var _0x32641c={'where':_0x1ea82f[_0xcb78('0x39')]};return db[_0xcb78('0x2a')][_0xcb78('0x1e')](_0x32641c)[_0xcb78('0x23')](function(_0x3eaf2f){_0x5a2692['count']=_0x3eaf2f;if(_0x26e3ed[_0xcb78('0x32')][_0xcb78('0x3d')]){_0x1ea82f[_0xcb78('0x3e')]=[{'all':!![]}];}return db[_0xcb78('0x2a')]['findAll'](_0x1ea82f);})[_0xcb78('0x23')](function(_0x284e12){_0x5a2692[_0xcb78('0x3f')]=_0x284e12;return _0x5a2692;})['then'](respondWithFilteredResult(_0x330e32,_0x1ea82f))['catch'](handleError(_0x330e32,null));};exports['show']=function(_0x9ed5f5,_0x19c4ae){var _0x3e46c7={'raw':!![],'where':{'id':_0x9ed5f5[_0xcb78('0x40')]['id']}},_0x3d1f3a={};_0x3d1f3a['model']=_['keys'](db[_0xcb78('0x2a')][_0xcb78('0x2b')]);_0x3d1f3a[_0xcb78('0x32')]=_[_0xcb78('0x2f')](_0x9ed5f5[_0xcb78('0x32')]);_0x3d1f3a['filters']=_[_0xcb78('0x31')](_0x3d1f3a['model'],_0x3d1f3a[_0xcb78('0x32')]);_0x3e46c7[_0xcb78('0x33')]=_[_0xcb78('0x31')](_0x3d1f3a[_0xcb78('0x2e')],qs[_0xcb78('0x34')](_0x9ed5f5[_0xcb78('0x32')]['fields']));_0x3e46c7[_0xcb78('0x33')]=_0x3e46c7[_0xcb78('0x33')]['length']?_0x3e46c7[_0xcb78('0x33')]:_0x3d1f3a[_0xcb78('0x2e')];if(_0x9ed5f5['query']['includeAll']){_0x3e46c7[_0xcb78('0x3e')]=[{'all':!![]}];}_0x3e46c7=_[_0xcb78('0x3a')]({},_0x3e46c7,_0x9ed5f5['options']);return db[_0xcb78('0x2a')][_0xcb78('0x41')](_0x3e46c7)[_0xcb78('0x23')](handleEntityNotFound(_0x19c4ae,null))['then'](respondWithResult(_0x19c4ae,null))[_0xcb78('0x42')](handleError(_0x19c4ae,null));};exports['clone']=function(_0x3e06f1,_0x31163e){var _0x12f818={'where':{'id':_0x3e06f1['params']['id']}},_0xb4bf4b={};_0xb4bf4b['model']=_[_0xcb78('0x2f')](db[_0xcb78('0x2a')][_0xcb78('0x2b')]);_0x12f818['attributes']=_[_0xcb78('0x31')](_0xb4bf4b[_0xcb78('0x2e')],qs[_0xcb78('0x34')](_0x3e06f1[_0xcb78('0x32')][_0xcb78('0x34')]));_0x12f818[_0xcb78('0x33')]=_0x12f818['attributes']['length']?_0x12f818[_0xcb78('0x33')]:_0xb4bf4b[_0xcb78('0x2e')];if(_0x3e06f1[_0xcb78('0x32')][_0xcb78('0x3d')]){_0x12f818['include']=[{'all':!![]}];}_0x12f818=_[_0xcb78('0x3a')]({},_0x12f818,_0x3e06f1[_0xcb78('0x3c')]);return db[_0xcb78('0x2a')][_0xcb78('0x41')](_0x12f818)[_0xcb78('0x23')](handleEntityNotFound(_0x31163e,null))[_0xcb78('0x23')](function(_0x62ea96){if(_0x62ea96){var _0x4e2930=_0x62ea96[_0xcb78('0x43')]({'plain':!![]});_0x4e2930=qs[_0xcb78('0x44')](_0x4e2930,['id',_0xcb78('0x45'),_0xcb78('0x46')]);_0x3e06f1[_0xcb78('0x47')]=_['omit'](_0x3e06f1[_0xcb78('0x47')],['id',_0xcb78('0x45'),_0xcb78('0x46')]);return db[_0xcb78('0x2a')][_0xcb78('0x48')](_['merge'](_0x4e2930,_0x3e06f1[_0xcb78('0x47')]),{'include':_0x3e06f1[_0xcb78('0x32')][_0xcb78('0x3d')]?[{'all':!![]}]:undefined});}})[_0xcb78('0x23')](respondWithResult(_0x31163e,0xc9))[_0xcb78('0x42')](handleError(_0x31163e,null));};exports[_0xcb78('0x49')]=function(_0x122c94,_0x2b6320){if(_0x122c94[_0xcb78('0x47')]['id']){delete _0x122c94[_0xcb78('0x47')]['id'];}return db['Attachment']['find']({'where':{'id':_0x122c94[_0xcb78('0x40')]['id']}})[_0xcb78('0x23')](handleEntityNotFound(_0x2b6320,null))[_0xcb78('0x23')](saveUpdates(_0x122c94[_0xcb78('0x47')],null))[_0xcb78('0x23')](respondWithResult(_0x2b6320,null))[_0xcb78('0x42')](handleError(_0x2b6320,null));};exports[_0xcb78('0x4a')]=function(_0x33aaf0,_0x3fd7a0){return db[_0xcb78('0x2a')][_0xcb78('0x41')]({'where':{'id':_0x33aaf0['params']['id']}})['then'](handleEntityNotFound(_0x3fd7a0,null))[_0xcb78('0x23')](removeEntity(_0x3fd7a0,null))[_0xcb78('0x42')](handleError(_0x3fd7a0,null));};exports['create']=function(_0x220dc7,_0x800bd3,_0x5ea001){_0x220dc7[_0xcb78('0x47')]['name']=_0x220dc7['file'][_0xcb78('0x4b')];_0x220dc7[_0xcb78('0x47')][_0xcb78('0x4c')]=_0x220dc7[_0xcb78('0x4d')][_0xcb78('0x4e')];_0x220dc7[_0xcb78('0x47')][_0xcb78('0x2c')]=_0x220dc7['file'][_0xcb78('0x4f')];return db[_0xcb78('0x2a')][_0xcb78('0x48')](_0x220dc7['body'])[_0xcb78('0x23')](respondWithResult(_0x800bd3,0xc9))['catch'](handleError(_0x800bd3,null));};exports[_0xcb78('0x50')]=function(_0x5785e4,_0x226291,_0xfcc058){return db[_0xcb78('0x2a')][_0xcb78('0x51')]({'where':{'id':_0x5785e4['params']['id']},'raw':!![]})[_0xcb78('0x23')](handleEntityNotFound(_0x226291,null))[_0xcb78('0x23')](function(_0x44e627){if(_0x44e627){var _0xd517c8=_0x44e627['ChatOfflineMessageId']!==null;var _0x35ea34=path[_0xcb78('0x52')](config[_0xcb78('0x53')],'server/files/attachments/');if(_0xd517c8){_0x35ea34=path[_0xcb78('0x52')](_0x35ea34,_0xcb78('0x54'));}var _0x2dbb21=path[_0xcb78('0x52')](_0x35ea34,_0x44e627[_0xcb78('0x4c')]);return _0x226291[_0xcb78('0x50')](_0x2dbb21);}})['catch'](handleError(_0x226291,null));}; \ No newline at end of file +var _0x980e=['rows','show','params','keys','includeAll','find','clone','merge','get','omit','updatedAt','body','createdAt','create','catch','update','basename','filename','file','mimetype','findOne','ChatOfflineMessageId','server/files/attachments/','join','offline-chat/','download','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','then','destroy','error','stack','name','map','Attachment','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','include','findAll'];(function(_0x24afd2,_0x3c22a8){var _0x383a35=function(_0x3f4a54){while(--_0x3f4a54){_0x24afd2['push'](_0x24afd2['shift']());}};_0x383a35(++_0x3c22a8);}(_0x980e,0x73));var _0xe980=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x980e[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xe980('0x0'));var rimraf=require(_0xe980('0x1'));var zipdir=require(_0xe980('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe980('0x3'));var moment=require(_0xe980('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xe980('0x5'));var util=require(_0xe980('0x6'));var path=require(_0xe980('0x7'));var sox=require(_0xe980('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe980('0x9'));var squel=require(_0xe980('0xa'));var crypto=require(_0xe980('0xb'));var jsforce=require(_0xe980('0xc'));var deskjs=require(_0xe980('0xd'));var toCsv=require('to-csv');var querystring=require(_0xe980('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe980('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xe980('0x10'));var hardwareService=require(_0xe980('0x11'));var logger=require(_0xe980('0x12'))(_0xe980('0x13'));var utils=require(_0xe980('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xe980('0x15'))['db'];function respondWithStatusCode(_0x2a21bf,_0x11468b){_0x11468b=_0x11468b||0xcc;return function(_0x45017c){if(_0x45017c){return _0x2a21bf[_0xe980('0x16')](_0x11468b);}return _0x2a21bf[_0xe980('0x17')](_0x11468b)[_0xe980('0x18')]();};}function respondWithResult(_0x342a57,_0x267332){_0x267332=_0x267332||0xc8;return function(_0x2f3e76){if(_0x2f3e76){return _0x342a57[_0xe980('0x17')](_0x267332)['json'](_0x2f3e76);}};}function respondWithFilteredResult(_0x25644f,_0x173268){return function(_0x31be0e){if(_0x31be0e){var _0x9952e8=typeof _0x173268[_0xe980('0x19')]===_0xe980('0x1a')&&typeof _0x173268[_0xe980('0x1b')]===_0xe980('0x1a');var _0x3d6453=_0x31be0e[_0xe980('0x1c')];var _0x241405=_0x9952e8?0x0:_0x173268[_0xe980('0x19')];var _0x2c25ef=_0x9952e8?_0x31be0e[_0xe980('0x1c')]:_0x173268[_0xe980('0x19')]+_0x173268[_0xe980('0x1b')];var _0x2b8769;if(_0x2c25ef>=_0x3d6453){_0x2c25ef=_0x3d6453;_0x2b8769=0xc8;}else{_0x2b8769=0xce;}_0x25644f[_0xe980('0x17')](_0x2b8769);return _0x25644f[_0xe980('0x1d')](_0xe980('0x1e'),_0x241405+'-'+_0x2c25ef+'/'+_0x3d6453)[_0xe980('0x1f')](_0x31be0e);}return null;};}function patchUpdates(_0x5e401c){return function(_0x4bd82c){try{jsonpatch[_0xe980('0x20')](_0x4bd82c,_0x5e401c,!![]);}catch(_0x37c428){return BPromise['reject'](_0x37c428);}return _0x4bd82c[_0xe980('0x21')]();};}function saveUpdates(_0x34a936,_0x1b3497){return function(_0x3dcd4d){if(_0x3dcd4d){return _0x3dcd4d['update'](_0x34a936)[_0xe980('0x22')](function(_0x1fc3a8){return _0x1fc3a8;});}return null;};}function removeEntity(_0x359e47,_0x28d50c){return function(_0x25e734){if(_0x25e734){return _0x25e734[_0xe980('0x23')]()[_0xe980('0x22')](function(){_0x359e47['status'](0xcc)[_0xe980('0x18')]();});}};}function handleEntityNotFound(_0x473c63,_0x176a1d){return function(_0x1f451e){if(!_0x1f451e){_0x473c63[_0xe980('0x16')](0x194);}return _0x1f451e;};}function handleError(_0x3bf66d,_0x11c5e6){_0x11c5e6=_0x11c5e6||0x1f4;return function(_0x57f1d4){logger[_0xe980('0x24')](_0x57f1d4[_0xe980('0x25')]);if(_0x57f1d4[_0xe980('0x26')]){delete _0x57f1d4[_0xe980('0x26')];}_0x3bf66d[_0xe980('0x17')](_0x11c5e6)['send'](_0x57f1d4);};}exports['index']=function(_0x2121eb,_0x314875){var _0x503005={},_0x493bcf={},_0x4c7fe4={'count':0x0,'rows':[]};var _0x5d63ec=_[_0xe980('0x27')](db[_0xe980('0x28')][_0xe980('0x29')],function(_0x161888){return{'name':_0x161888[_0xe980('0x2a')],'type':_0x161888[_0xe980('0x2b')][_0xe980('0x2c')]};});_0x493bcf[_0xe980('0x2d')]=_['map'](_0x5d63ec,_0xe980('0x26'));_0x493bcf['query']=_['keys'](_0x2121eb[_0xe980('0x2e')]);_0x493bcf[_0xe980('0x2f')]=_[_0xe980('0x30')](_0x493bcf[_0xe980('0x2d')],_0x493bcf[_0xe980('0x2e')]);_0x503005['attributes']=_[_0xe980('0x30')](_0x493bcf['model'],qs[_0xe980('0x31')](_0x2121eb['query']['fields']));_0x503005[_0xe980('0x32')]=_0x503005['attributes'][_0xe980('0x33')]?_0x503005[_0xe980('0x32')]:_0x493bcf['model'];if(!_0x2121eb['query'][_0xe980('0x34')](_0xe980('0x35'))){_0x503005[_0xe980('0x1b')]=qs['limit'](_0x2121eb[_0xe980('0x2e')][_0xe980('0x1b')]);_0x503005[_0xe980('0x19')]=qs[_0xe980('0x19')](_0x2121eb[_0xe980('0x2e')][_0xe980('0x19')]);}_0x503005[_0xe980('0x36')]=qs[_0xe980('0x37')](_0x2121eb[_0xe980('0x2e')]['sort']);_0x503005[_0xe980('0x38')]=qs[_0xe980('0x2f')](_[_0xe980('0x39')](_0x2121eb[_0xe980('0x2e')],_0x493bcf[_0xe980('0x2f')]),_0x5d63ec);if(_0x2121eb[_0xe980('0x2e')][_0xe980('0x3a')]){_0x503005[_0xe980('0x38')]=_['merge'](_0x503005[_0xe980('0x38')],{'$or':_[_0xe980('0x27')](_0x5d63ec,function(_0x54dcda){if(_0x54dcda[_0xe980('0x2b')]!==_0xe980('0x3b')){var _0x918653={};_0x918653[_0x54dcda[_0xe980('0x26')]]={'$like':'%'+_0x2121eb[_0xe980('0x2e')][_0xe980('0x3a')]+'%'};return _0x918653;}})});}_0x503005=_['merge']({},_0x503005,_0x2121eb[_0xe980('0x3c')]);var _0x31d178={'where':_0x503005[_0xe980('0x38')]};return db['Attachment']['count'](_0x31d178)[_0xe980('0x22')](function(_0x1d210e){_0x4c7fe4['count']=_0x1d210e;if(_0x2121eb[_0xe980('0x2e')]['includeAll']){_0x503005[_0xe980('0x3d')]=[{'all':!![]}];}return db[_0xe980('0x28')][_0xe980('0x3e')](_0x503005);})[_0xe980('0x22')](function(_0x214551){_0x4c7fe4[_0xe980('0x3f')]=_0x214551;return _0x4c7fe4;})[_0xe980('0x22')](respondWithFilteredResult(_0x314875,_0x503005))['catch'](handleError(_0x314875,null));};exports[_0xe980('0x40')]=function(_0x387bfd,_0x4ab47f){var _0x3d2631={'raw':!![],'where':{'id':_0x387bfd[_0xe980('0x41')]['id']}},_0x29e6e8={};_0x29e6e8['model']=_[_0xe980('0x42')](db['Attachment'][_0xe980('0x29')]);_0x29e6e8[_0xe980('0x2e')]=_[_0xe980('0x42')](_0x387bfd[_0xe980('0x2e')]);_0x29e6e8[_0xe980('0x2f')]=_[_0xe980('0x30')](_0x29e6e8[_0xe980('0x2d')],_0x29e6e8[_0xe980('0x2e')]);_0x3d2631[_0xe980('0x32')]=_[_0xe980('0x30')](_0x29e6e8[_0xe980('0x2d')],qs[_0xe980('0x31')](_0x387bfd[_0xe980('0x2e')]['fields']));_0x3d2631[_0xe980('0x32')]=_0x3d2631[_0xe980('0x32')][_0xe980('0x33')]?_0x3d2631[_0xe980('0x32')]:_0x29e6e8[_0xe980('0x2d')];if(_0x387bfd[_0xe980('0x2e')][_0xe980('0x43')]){_0x3d2631[_0xe980('0x3d')]=[{'all':!![]}];}_0x3d2631=_['merge']({},_0x3d2631,_0x387bfd[_0xe980('0x3c')]);return db[_0xe980('0x28')][_0xe980('0x44')](_0x3d2631)[_0xe980('0x22')](handleEntityNotFound(_0x4ab47f,null))[_0xe980('0x22')](respondWithResult(_0x4ab47f,null))['catch'](handleError(_0x4ab47f,null));};exports[_0xe980('0x45')]=function(_0x475fbc,_0x1cae80){var _0x3a0144={'where':{'id':_0x475fbc[_0xe980('0x41')]['id']}},_0x507437={};_0x507437[_0xe980('0x2d')]=_['keys'](db['Attachment'][_0xe980('0x29')]);_0x3a0144['attributes']=_[_0xe980('0x30')](_0x507437['model'],qs[_0xe980('0x31')](_0x475fbc[_0xe980('0x2e')][_0xe980('0x31')]));_0x3a0144[_0xe980('0x32')]=_0x3a0144[_0xe980('0x32')][_0xe980('0x33')]?_0x3a0144[_0xe980('0x32')]:_0x507437[_0xe980('0x2d')];if(_0x475fbc['query'][_0xe980('0x43')]){_0x3a0144[_0xe980('0x3d')]=[{'all':!![]}];}_0x3a0144=_[_0xe980('0x46')]({},_0x3a0144,_0x475fbc[_0xe980('0x3c')]);return db[_0xe980('0x28')][_0xe980('0x44')](_0x3a0144)[_0xe980('0x22')](handleEntityNotFound(_0x1cae80,null))[_0xe980('0x22')](function(_0x45d7ab){if(_0x45d7ab){var _0x2203e1=_0x45d7ab[_0xe980('0x47')]({'plain':!![]});_0x2203e1=qs[_0xe980('0x48')](_0x2203e1,['id','createdAt',_0xe980('0x49')]);_0x475fbc[_0xe980('0x4a')]=_[_0xe980('0x48')](_0x475fbc[_0xe980('0x4a')],['id',_0xe980('0x4b'),_0xe980('0x49')]);return db[_0xe980('0x28')][_0xe980('0x4c')](_[_0xe980('0x46')](_0x2203e1,_0x475fbc[_0xe980('0x4a')]),{'include':_0x475fbc['query']['includeAll']?[{'all':!![]}]:undefined});}})[_0xe980('0x22')](respondWithResult(_0x1cae80,0xc9))[_0xe980('0x4d')](handleError(_0x1cae80,null));};exports[_0xe980('0x4e')]=function(_0x26bfe3,_0xa91b7f){if(_0x26bfe3[_0xe980('0x4a')]['id']){delete _0x26bfe3[_0xe980('0x4a')]['id'];}return db[_0xe980('0x28')][_0xe980('0x44')]({'where':{'id':_0x26bfe3[_0xe980('0x41')]['id']}})[_0xe980('0x22')](handleEntityNotFound(_0xa91b7f,null))['then'](saveUpdates(_0x26bfe3['body'],null))[_0xe980('0x22')](respondWithResult(_0xa91b7f,null))['catch'](handleError(_0xa91b7f,null));};exports[_0xe980('0x23')]=function(_0x217422,_0x3f954d){return db[_0xe980('0x28')][_0xe980('0x44')]({'where':{'id':_0x217422[_0xe980('0x41')]['id']}})['then'](handleEntityNotFound(_0x3f954d,null))[_0xe980('0x22')](removeEntity(_0x3f954d,null))[_0xe980('0x4d')](handleError(_0x3f954d,null));};exports[_0xe980('0x4c')]=function(_0x54ccb2,_0x55bd1f,_0x2d101){_0x54ccb2[_0xe980('0x4a')][_0xe980('0x26')]=_0x54ccb2['file']['originalname'];_0x54ccb2[_0xe980('0x4a')][_0xe980('0x4f')]=_0x54ccb2['file'][_0xe980('0x50')];_0x54ccb2[_0xe980('0x4a')]['type']=_0x54ccb2[_0xe980('0x51')][_0xe980('0x52')];return db['Attachment'][_0xe980('0x4c')](_0x54ccb2[_0xe980('0x4a')])[_0xe980('0x22')](respondWithResult(_0x55bd1f,0xc9))[_0xe980('0x4d')](handleError(_0x55bd1f,null));};exports['download']=function(_0x205cd8,_0x2d997c,_0x2ab341){return db[_0xe980('0x28')][_0xe980('0x53')]({'where':{'id':_0x205cd8[_0xe980('0x41')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x2d997c,null))[_0xe980('0x22')](function(_0x494a0e){if(_0x494a0e){var _0x23991c=_0x494a0e[_0xe980('0x54')]!==null;var _0x1456c7=path['join'](config['root'],_0xe980('0x55'));if(_0x23991c){_0x1456c7=path[_0xe980('0x56')](_0x1456c7,_0xe980('0x57'));}var _0x10a2c7=path['join'](_0x1456c7,_0x494a0e['basename']);return _0x2d997c[_0xe980('0x58')](_0x10a2c7);}})[_0xe980('0x4d')](handleError(_0x2d997c,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 21f26aa..e80e630 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 _0x2daa=['./attachment.attributes','define','attachments','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x57fc2a,_0x14bbe5){var _0xa839b=function(_0x26572c){while(--_0x26572c){_0x57fc2a['push'](_0x57fc2a['shift']());}};_0xa839b(++_0x14bbe5);}(_0x2daa,0x66));var _0xa2da=function(_0x3792e6,_0x32bd91){_0x3792e6=_0x3792e6-0x0;var _0x441e44=_0x2daa[_0x3792e6];return _0x441e44;};'use strict';var _=require(_0xa2da('0x0'));var util=require(_0xa2da('0x1'));var logger=require(_0xa2da('0x2'))('api');var moment=require(_0xa2da('0x3'));var BPromise=require(_0xa2da('0x4'));var rp=require(_0xa2da('0x5'));var fs=require('fs');var path=require(_0xa2da('0x6'));var rimraf=require('rimraf');var config=require(_0xa2da('0x7'));var attributes=require(_0xa2da('0x8'));module['exports']=function(_0xa6b903,_0x27ebde){return _0xa6b903[_0xa2da('0x9')]('Attachment',attributes,{'tableName':_0xa2da('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8a3a=['Attachment','attachments','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','define'];(function(_0x4a9433,_0x5337cb){var _0x434947=function(_0x3ab6cd){while(--_0x3ab6cd){_0x4a9433['push'](_0x4a9433['shift']());}};_0x434947(++_0x5337cb);}(_0x8a3a,0x18e));var _0xa8a3=function(_0x2465ff,_0x203af5){_0x2465ff=_0x2465ff-0x0;var _0x39459c=_0x8a3a[_0x2465ff];return _0x39459c;};'use strict';var _=require(_0xa8a3('0x0'));var util=require(_0xa8a3('0x1'));var logger=require(_0xa8a3('0x2'))(_0xa8a3('0x3'));var moment=require(_0xa8a3('0x4'));var BPromise=require(_0xa8a3('0x5'));var rp=require(_0xa8a3('0x6'));var fs=require('fs');var path=require(_0xa8a3('0x7'));var rimraf=require('rimraf');var config=require(_0xa8a3('0x8'));var attributes=require('./attachment.attributes');module['exports']=function(_0x1718de,_0x4b04e6){return _0x1718de[_0xa8a3('0x9')](_0xa8a3('0xa'),attributes,{'tableName':_0xa8a3('0xb'),'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 2373b44..ac0f5e2 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 _0x0eec=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','error','code','message','catch','CreateAttachment','Attachment','body','options','then','lodash','bluebird','randomstring'];(function(_0x2a2ae0,_0x3697c5){var _0x312c58=function(_0x31f1ab){while(--_0x31f1ab){_0x2a2ae0['push'](_0x2a2ae0['shift']());}};_0x312c58(++_0x3697c5);}(_0x0eec,0xac));var _0xc0ee=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0eec[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xc0ee('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc0ee('0x1'));var rs=require(_0xc0ee('0x2'));var fs=require('fs');var Redis=require(_0xc0ee('0x3'));var db=require(_0xc0ee('0x4'))['db'];var utils=require(_0xc0ee('0x5'));var logger=require(_0xc0ee('0x6'))(_0xc0ee('0x7'));var config=require('../../config/environment');var jayson=require(_0xc0ee('0x8'));var client=jayson['client'][_0xc0ee('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x39022a,_0x2d364d,_0x3aaca5){return new BPromise(function(_0x38b387,_0x1d9dca){return client[_0xc0ee('0xa')](_0x39022a,_0x3aaca5)['then'](function(_0x141f4a){logger[_0xc0ee('0xb')](_0xc0ee('0xc'),_0x2d364d,_0xc0ee('0xd'));logger[_0xc0ee('0xe')](_0xc0ee('0xf'),_0x2d364d,_0xc0ee('0xd'),JSON['stringify'](_0x141f4a));if(_0x141f4a[_0xc0ee('0x10')]){if(_0x141f4a[_0xc0ee('0x10')][_0xc0ee('0x11')]===0x1f4){logger[_0xc0ee('0x10')](_0xc0ee('0xc'),_0x2d364d,_0x141f4a[_0xc0ee('0x10')][_0xc0ee('0x12')]);return _0x1d9dca(_0x141f4a[_0xc0ee('0x10')][_0xc0ee('0x12')]);}logger['error']('Attachment,\x20%s,\x20%s',_0x2d364d,_0x141f4a[_0xc0ee('0x10')][_0xc0ee('0x12')]);return _0x38b387(_0x141f4a[_0xc0ee('0x10')]['message']);}else{logger[_0xc0ee('0xb')](_0xc0ee('0xc'),_0x2d364d,_0xc0ee('0xd'));_0x38b387(_0x141f4a['result']['message']);}})[_0xc0ee('0x13')](function(_0x4dc6de){logger[_0xc0ee('0x10')](_0xc0ee('0xc'),_0x2d364d,_0x4dc6de);_0x1d9dca(_0x4dc6de);});});}exports[_0xc0ee('0x14')]=function(_0x59aad9){var _0x4e7e82=this;return new Promise(function(_0x16d050,_0x276e2e){return db[_0xc0ee('0x15')]['create'](_0x59aad9[_0xc0ee('0x16')],{'raw':_0x59aad9[_0xc0ee('0x17')]?_0x59aad9['options']['raw']===undefined?!![]:![]:!![]})[_0xc0ee('0x18')](function(_0x233333){logger['info'](_0xc0ee('0x14'),_0x59aad9);logger[_0xc0ee('0xe')](_0xc0ee('0x14'),_0x59aad9,JSON['stringify'](_0x233333));_0x16d050(_0x233333);})['catch'](function(_0x5af925){logger[_0xc0ee('0x10')](_0xc0ee('0x14'),_0x5af925['message'],_0x59aad9);_0x276e2e(_0x4e7e82[_0xc0ee('0x10')](0x1f4,_0x5af925[_0xc0ee('0x12')]));});});}; \ No newline at end of file +var _0xf109=['code','Attachment,\x20%s,\x20%s','message','result','catch','CreateAttachment','create','options','raw','stringify','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','error'];(function(_0x2dca49,_0x66a57e){var _0x3df140=function(_0x583752){while(--_0x583752){_0x2dca49['push'](_0x2dca49['shift']());}};_0x3df140(++_0x66a57e);}(_0xf109,0xce));var _0x9f10=function(_0xef8146,_0x459c34){_0xef8146=_0xef8146-0x0;var _0x5a6cb0=_0xf109[_0xef8146];return _0x5a6cb0;};'use strict';var _=require(_0x9f10('0x0'));var util=require(_0x9f10('0x1'));var moment=require(_0x9f10('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9f10('0x3'))['db'];var utils=require(_0x9f10('0x4'));var logger=require(_0x9f10('0x5'))(_0x9f10('0x6'));var config=require(_0x9f10('0x7'));var jayson=require(_0x9f10('0x8'));var client=jayson[_0x9f10('0x9')][_0x9f10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x227a29,_0x2a877e,_0x3fd82f){return new BPromise(function(_0x5c8719,_0x42a8cd){return client[_0x9f10('0xb')](_0x227a29,_0x3fd82f)[_0x9f10('0xc')](function(_0x1bde2e){logger[_0x9f10('0xd')]('Attachment,\x20%s,\x20%s',_0x2a877e,_0x9f10('0xe'));logger[_0x9f10('0xf')](_0x9f10('0x10'),_0x2a877e,'request\x20sent',JSON['stringify'](_0x1bde2e));if(_0x1bde2e[_0x9f10('0x11')]){if(_0x1bde2e[_0x9f10('0x11')][_0x9f10('0x12')]===0x1f4){logger['error'](_0x9f10('0x13'),_0x2a877e,_0x1bde2e[_0x9f10('0x11')][_0x9f10('0x14')]);return _0x42a8cd(_0x1bde2e['error'][_0x9f10('0x14')]);}logger[_0x9f10('0x11')]('Attachment,\x20%s,\x20%s',_0x2a877e,_0x1bde2e[_0x9f10('0x11')][_0x9f10('0x14')]);return _0x5c8719(_0x1bde2e['error']['message']);}else{logger[_0x9f10('0xd')](_0x9f10('0x13'),_0x2a877e,'request\x20sent');_0x5c8719(_0x1bde2e[_0x9f10('0x15')]['message']);}})[_0x9f10('0x16')](function(_0x1f68d8){logger['error'](_0x9f10('0x13'),_0x2a877e,_0x1f68d8);_0x42a8cd(_0x1f68d8);});});}exports[_0x9f10('0x17')]=function(_0x509fba){var _0x150813=this;return new Promise(function(_0x53bfbd,_0xe221d0){return db['Attachment'][_0x9f10('0x18')](_0x509fba['body'],{'raw':_0x509fba['options']?_0x509fba[_0x9f10('0x19')][_0x9f10('0x1a')]===undefined?!![]:![]:!![]})[_0x9f10('0xc')](function(_0x3a78be){logger[_0x9f10('0xd')](_0x9f10('0x17'),_0x509fba);logger[_0x9f10('0xf')]('CreateAttachment',_0x509fba,JSON[_0x9f10('0x1b')](_0x3a78be));_0x53bfbd(_0x3a78be);})['catch'](function(_0x293990){logger[_0x9f10('0x11')](_0x9f10('0x17'),_0x293990['message'],_0x509fba);_0xe221d0(_0x150813[_0x9f10('0x11')](0x1f4,_0x293990[_0x9f10('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 27d4c87..dd32ef7 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 _0x5f66=['fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/download','/:id/clone','clone','diskStorage','root','format','%s-%s','now','originalname','replace','post','single','file','create','delete','destroy','exports','util','connect-timeout','express','Router'];(function(_0x4d8dc3,_0x585fd1){var _0x9b03d9=function(_0x7a31d5){while(--_0x7a31d5){_0x4d8dc3['push'](_0x4d8dc3['shift']());}};_0x9b03d9(++_0x585fd1);}(_0x5f66,0x1a0));var _0x65f6=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0x5f66[_0x5d4607];return _0x5e4a86;};'use strict';var multer=require('multer');var util=require(_0x65f6('0x0'));var path=require('path');var timeout=require(_0x65f6('0x1'));var express=require(_0x65f6('0x2'));var router=express[_0x65f6('0x3')]();var fs_extra=require(_0x65f6('0x4'));var auth=require(_0x65f6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x65f6('0x6'));var controller=require('./attachment.controller');router[_0x65f6('0x7')]('/',auth[_0x65f6('0x8')](),controller['index']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xa')]);router[_0x65f6('0x7')](_0x65f6('0xb'),auth[_0x65f6('0x8')](),controller['download']);router['post'](_0x65f6('0xc'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xd')]);var upload=multer({'storage':multer[_0x65f6('0xe')]({'destination':function(_0x50d26d,_0x41a7fd,_0x571436){_0x571436(null,path['join'](config[_0x65f6('0xf')],'server/files/attachments/'));},'filename':function(_0x419819,_0x4862a5,_0x2f964a){_0x2f964a(null,util[_0x65f6('0x10')](_0x65f6('0x11'),Date[_0x65f6('0x12')](),_0x4862a5[_0x65f6('0x13')][_0x65f6('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x65f6('0x15')]('/',upload[_0x65f6('0x16')](_0x65f6('0x17')),controller[_0x65f6('0x18')]);router['put'](_0x65f6('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x65f6('0x19')](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x1a')]);module[_0x65f6('0x1b')]=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(_0x3d4f6d,_0x5b4e31){var _0x457798=function(_0x3db234){while(--_0x3db234){_0x3d4f6d['push'](_0x3d4f6d['shift']());}};_0x457798(++_0x5b4e31);}(_0x2032,0xd9));var _0x2203=function(_0x471029,_0xb5ea43){_0x471029=_0x471029-0x0;var _0x225d1e=_0x2032[_0x471029];return _0x225d1e;};'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 e64b8c3..8a87e7a 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 _0xb2d7=['url','Error\x20authenticate\x20%s:\x20%s','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','error','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','findOne','adSsoEnabled','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','password','salt','disabled','blocked','blockedAt','online','admin','user','agent','then','domain','blockDuration','minutes','getLicense','catch','status','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','role','signToken','json','User','passport','passport-local','Strategy','moment','activedirectory2','bluebird','util','../../config/utils','../../config/environment','activedirectory','undefined'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xb2d7,0x155));var _0x7b2d=function(_0xb833b1,_0x1c3d3f){_0xb833b1=_0xb833b1-0x0;var _0x1ab87a=_0xb2d7[_0xb833b1];return _0x1ab87a;};'use strict';var passport=require(_0x7b2d('0x0'));var LocalStrategy=require(_0x7b2d('0x1'))[_0x7b2d('0x2')];var moment=require(_0x7b2d('0x3'));var ActiveDirectory=require(_0x7b2d('0x4'));var BPromise=require(_0x7b2d('0x5'));var util=require(_0x7b2d('0x6'));var db=require('../../mysqldb')['db'];var authService=require('../../components/auth/service');var utils=require(_0x7b2d('0x7'));var config=require(_0x7b2d('0x8'));var logger=require('../../config/logger')('api');function isActiveDirectoryConfigured(_0x32abf7){var _0x25bffb=![];if(typeof _0x32abf7[_0x7b2d('0x9')]!==_0x7b2d('0xa')){_0x25bffb=_0x32abf7['activedirectory']['baseDN']&&_0x32abf7[_0x7b2d('0x9')][_0x7b2d('0xb')]&&_0x32abf7[_0x7b2d('0x9')]['domain'];}return _0x25bffb;}function adAuthenticate(_0x4ddded,_0x5f010e,_0x477ef3){return new BPromise(function(_0x575901,_0x284653){try{var _0xf8395d=new ActiveDirectory(_0x4ddded);_0xf8395d['authenticate'](_0x5f010e,_0x477ef3,function(_0x6726eb,_0x4575b4){if(_0x6726eb){logger['error'](_0x7b2d('0xc'),_0x5f010e,util[_0x7b2d('0xd')](_0x6726eb,{'showHidden':![],'depth':null}));_0x284653(_0x7b2d('0xe'));}else if(!_0x4575b4){logger[_0x7b2d('0xf')]('Error\x20authenticate\x20%s:\x20Wrong\x20credentials',_0x5f010e);_0x284653('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x575901(_0x4575b4);}});}catch(_0x3df61a){_0x284653(_0x3df61a);}});}function ActiveDirectoryAuthenticate(_0x2ccc3c,_0x527db4,_0x505823,_0x43f334){var _0x431a78,_0x46f590;if(!isActiveDirectoryConfigured(config)){logger[_0x7b2d('0xf')](_0x7b2d('0x10'),_0x527db4);return _0x43f334(null,![],{'message':_0x7b2d('0xe')});}return db[_0x7b2d('0x11')][_0x7b2d('0x12')]({'where':{'id':0x1},'attributes':[_0x7b2d('0x13'),'blockDuration'],'raw':!![]})['then'](function(_0x1c08bc){_0x431a78=_0x1c08bc;if(!_0x431a78[_0x7b2d('0x13')]){logger[_0x7b2d('0xf')](_0x7b2d('0x14'),_0x527db4);throw new Error(_0x7b2d('0xe'));}return _0x2ccc3c[_0x7b2d('0x12')]({'attributes':['id',_0x7b2d('0x15'),_0x7b2d('0x16'),_0x7b2d('0x17'),'role',_0x7b2d('0x18'),_0x7b2d('0x19'),_0x7b2d('0x1a'),_0x7b2d('0x1b')],'where':{'name':_0x527db4,'role':{'$or':[_0x7b2d('0x1c'),_0x7b2d('0x1d'),_0x7b2d('0x1e')]},'adSsoEnabled':!![]}});})[_0x7b2d('0x1f')](function(_0x480aeb){if(!_0x480aeb||_0x480aeb&&_0x480aeb['name']!==_0x527db4){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}_0x46f590=_0x480aeb;var _0x593ec1=_0x46f590[_0x7b2d('0x15')]+'@'+config[_0x7b2d('0x9')][_0x7b2d('0x20')];return adAuthenticate(config['activedirectory'],_0x593ec1,_0x505823);})['then'](function(_0x1f0247){if(_0x46f590[_0x7b2d('0x18')]){throw new Error(_0x7b2d('0xe'));}if(_0x431a78[_0x7b2d('0x21')]>0x0){if(_0x46f590[_0x7b2d('0x19')]){if(moment(_0x46f590['blockedAt'])['add'](_0x431a78[_0x7b2d('0x21')],_0x7b2d('0x22'))>moment()){throw new Error(_0x7b2d('0xe'));}return utils['clearBlockUser'](_0x46f590,0x0,![],null)[_0x7b2d('0x1f')](function(){return utils[_0x7b2d('0x23')](_0x46f590);})[_0x7b2d('0x1f')](function(){return _0x43f334(null,_0x46f590);});}else{return utils[_0x7b2d('0x23')](_0x46f590)[_0x7b2d('0x1f')](function(){return _0x43f334(null,_0x46f590);});}}else{return utils[_0x7b2d('0x23')](_0x46f590)['then'](function(){return _0x43f334(null,_0x46f590);});}})[_0x7b2d('0x24')](function(_0x35e9ec){return _0x43f334(null,![],_0x35e9ec);});}function handleError(_0x3fbbff,_0x121c8c,_0x3569d1){return _0x3fbbff[_0x7b2d('0x25')](_0x121c8c||0x1f4)['send']({'message':_0x3569d1?_0x3569d1['message']||_0x3569d1:''});}exports['login']=function(_0x4fa3dd,_0x3737f2,_0x5f2073){passport['authenticate'](_0x7b2d('0x26'),function(_0x32f0b0,_0x5d8c28,_0x556c3e){var _0x320e58=_0x32f0b0||_0x556c3e;if(_0x320e58){return handleError(_0x3737f2,0x191,_0x320e58);}if(!_0x5d8c28){return handleError(_0x3737f2,0x194,{'message':_0x7b2d('0x27')});}else{var _0x47b0ab={'payload':{'id':_0x5d8c28['id'],'role':_0x5d8c28[_0x7b2d('0x28')]},'options':{'expiresIn':0x15180}};return authService[_0x7b2d('0x29')](_0x47b0ab)['then'](function(_0xa3badd){_0x3737f2[_0x7b2d('0x2a')]({'id':_0x5d8c28['id'],'token':_0xa3badd,'statusCall':'','isAlreadyLogged':_0x5d8c28[_0x7b2d('0x1b')]});});}})(_0x4fa3dd,_0x3737f2,_0x5f2073);};passport['use'](_0x7b2d('0x26'),new LocalStrategy({'usernameField':_0x7b2d('0x15'),'passwordField':_0x7b2d('0x16')},function(_0x1a09de,_0x396202,_0x39edbf){return ActiveDirectoryAuthenticate(db[_0x7b2d('0x2b')],_0x1a09de,_0x396202,_0x39edbf);})); \ No newline at end of file +var _0x39f8=['then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','salt','disabled','online','admin','user','blocked','blockedAt','add','minutes','clearBlockUser','getLicense','catch','status','send','login','role','signToken','json','use','ad-login','User','passport-local','Strategy','moment','activedirectory2','util','../../mysqldb','../../components/auth/service','../../config/utils','../../config/logger','api','activedirectory','undefined','domain','authenticate','error','Error\x20authenticate\x20%s:\x20%s','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','findOne','adSsoEnabled','blockDuration'];(function(_0x5d8afd,_0xd7f769){var _0x336c61=function(_0x539e58){while(--_0x539e58){_0x5d8afd['push'](_0x5d8afd['shift']());}};_0x336c61(++_0xd7f769);}(_0x39f8,0x161));var _0x839f=function(_0x13dde6,_0x56edd8){_0x13dde6=_0x13dde6-0x0;var _0x39d336=_0x39f8[_0x13dde6];return _0x39d336;};'use strict';var passport=require('passport');var LocalStrategy=require(_0x839f('0x0'))[_0x839f('0x1')];var moment=require(_0x839f('0x2'));var ActiveDirectory=require(_0x839f('0x3'));var BPromise=require('bluebird');var util=require(_0x839f('0x4'));var db=require(_0x839f('0x5'))['db'];var authService=require(_0x839f('0x6'));var utils=require(_0x839f('0x7'));var config=require('../../config/environment');var logger=require(_0x839f('0x8'))(_0x839f('0x9'));function isActiveDirectoryConfigured(_0x43735b){var _0x22d131=![];if(typeof _0x43735b[_0x839f('0xa')]!==_0x839f('0xb')){_0x22d131=_0x43735b['activedirectory']['baseDN']&&_0x43735b[_0x839f('0xa')]['url']&&_0x43735b[_0x839f('0xa')][_0x839f('0xc')];}return _0x22d131;}function adAuthenticate(_0x3d9628,_0x929697,_0x44d6ed){return new BPromise(function(_0x234231,_0x1777d9){try{var _0x33daa8=new ActiveDirectory(_0x3d9628);_0x33daa8[_0x839f('0xd')](_0x929697,_0x44d6ed,function(_0x5568fa,_0x24650b){if(_0x5568fa){logger[_0x839f('0xe')](_0x839f('0xf'),_0x929697,util['inspect'](_0x5568fa,{'showHidden':![],'depth':null}));_0x1777d9(_0x839f('0x10'));}else if(!_0x24650b){logger[_0x839f('0xe')](_0x839f('0x11'),_0x929697);_0x1777d9(_0x839f('0x10'));}else{_0x234231(_0x24650b);}});}catch(_0x5b24df){_0x1777d9(_0x5b24df);}});}function ActiveDirectoryAuthenticate(_0x5bb280,_0x148a9f,_0x31345b,_0x32f0b7){var _0x571f11,_0x4dbcce;if(!isActiveDirectoryConfigured(config)){logger[_0x839f('0xe')](_0x839f('0x12'),_0x148a9f);return _0x32f0b7(null,![],{'message':_0x839f('0x10')});}return db[_0x839f('0x13')][_0x839f('0x14')]({'where':{'id':0x1},'attributes':[_0x839f('0x15'),_0x839f('0x16')],'raw':!![]})[_0x839f('0x17')](function(_0x2406f3){_0x571f11=_0x2406f3;if(!_0x571f11[_0x839f('0x15')]){logger[_0x839f('0xe')](_0x839f('0x18'),_0x148a9f);throw new Error(_0x839f('0x10'));}return _0x5bb280[_0x839f('0x14')]({'attributes':['id',_0x839f('0x19'),'password',_0x839f('0x1a'),'role',_0x839f('0x1b'),'blocked','blockedAt',_0x839f('0x1c')],'where':{'name':_0x148a9f,'role':{'$or':[_0x839f('0x1d'),_0x839f('0x1e'),'agent']},'adSsoEnabled':!![]}});})[_0x839f('0x17')](function(_0x4eb116){if(!_0x4eb116||_0x4eb116&&_0x4eb116[_0x839f('0x19')]!==_0x148a9f){throw new Error(_0x839f('0x10'));}_0x4dbcce=_0x4eb116;var _0x1bc56f=_0x4dbcce[_0x839f('0x19')]+'@'+config['activedirectory'][_0x839f('0xc')];return adAuthenticate(config['activedirectory'],_0x1bc56f,_0x31345b);})['then'](function(_0x345072){if(_0x4dbcce[_0x839f('0x1b')]){throw new Error(_0x839f('0x10'));}if(_0x571f11[_0x839f('0x16')]>0x0){if(_0x4dbcce[_0x839f('0x1f')]){if(moment(_0x4dbcce[_0x839f('0x20')])[_0x839f('0x21')](_0x571f11[_0x839f('0x16')],_0x839f('0x22'))>moment()){throw new Error(_0x839f('0x10'));}return utils[_0x839f('0x23')](_0x4dbcce,0x0,![],null)[_0x839f('0x17')](function(){return utils[_0x839f('0x24')](_0x4dbcce);})[_0x839f('0x17')](function(){return _0x32f0b7(null,_0x4dbcce);});}else{return utils['getLicense'](_0x4dbcce)['then'](function(){return _0x32f0b7(null,_0x4dbcce);});}}else{return utils[_0x839f('0x24')](_0x4dbcce)[_0x839f('0x17')](function(){return _0x32f0b7(null,_0x4dbcce);});}})[_0x839f('0x25')](function(_0xe7f43b){return _0x32f0b7(null,![],_0xe7f43b);});}function handleError(_0xf5ad4e,_0x3c87dc,_0x276cd6){return _0xf5ad4e[_0x839f('0x26')](_0x3c87dc||0x1f4)[_0x839f('0x27')]({'message':_0x276cd6?_0x276cd6['message']||_0x276cd6:''});}exports[_0x839f('0x28')]=function(_0x572247,_0x477b6e,_0x43cd72){passport[_0x839f('0xd')]('ad-login',function(_0x3c28ff,_0x2d6fe8,_0x2bede4){var _0x445951=_0x3c28ff||_0x2bede4;if(_0x445951){return handleError(_0x477b6e,0x191,_0x445951);}if(!_0x2d6fe8){return handleError(_0x477b6e,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x857d59={'payload':{'id':_0x2d6fe8['id'],'role':_0x2d6fe8[_0x839f('0x29')]},'options':{'expiresIn':0x15180}};return authService[_0x839f('0x2a')](_0x857d59)[_0x839f('0x17')](function(_0x3ff58c){_0x477b6e[_0x839f('0x2b')]({'id':_0x2d6fe8['id'],'token':_0x3ff58c,'statusCall':'','isAlreadyLogged':_0x2d6fe8[_0x839f('0x1c')]});});}})(_0x572247,_0x477b6e,_0x43cd72);};passport[_0x839f('0x2c')](_0x839f('0x2d'),new LocalStrategy({'usernameField':_0x839f('0x19'),'passwordField':'password'},function(_0x53f386,_0x12d4be,_0x27fd84){return ActiveDirectoryAuthenticate(db[_0x839f('0x2e')],_0x53f386,_0x12d4be,_0x27fd84);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index 10ce713..9222912 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 _0xc4a8=['express','Router','./authActiveDirectory.controller','post','login'];(function(_0x33ad1f,_0xfc2fc8){var _0x26ef22=function(_0x58f97c){while(--_0x58f97c){_0x33ad1f['push'](_0x33ad1f['shift']());}};_0x26ef22(++_0xfc2fc8);}(_0xc4a8,0x177));var _0x8c4a=function(_0x607518,_0xded8ab){_0x607518=_0x607518-0x0;var _0x3a9160=_0xc4a8[_0x607518];return _0x3a9160;};'use strict';var express=require(_0x8c4a('0x0'));var router=express[_0x8c4a('0x1')]();var controller=require(_0x8c4a('0x2'));router[_0x8c4a('0x3')]('/',controller[_0x8c4a('0x4')]);module['exports']=router; \ No newline at end of file +var _0x0b6d=['exports','express','Router','login'];(function(_0x1d6a82,_0x37c315){var _0x5834ac=function(_0x2402ba){while(--_0x2402ba){_0x1d6a82['push'](_0x1d6a82['shift']());}};_0x5834ac(++_0x37c315);}(_0x0b6d,0x151));var _0xd0b6=function(_0x26462c,_0xd20a35){_0x26462c=_0x26462c-0x0;var _0x509a42=_0x0b6d[_0x26462c];return _0x509a42;};'use strict';var express=require(_0xd0b6('0x0'));var router=express[_0xd0b6('0x1')]();var controller=require('./authActiveDirectory.controller');router['post']('/',controller[_0xd0b6('0x2')]);module[_0xd0b6('0x3')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index dda3d91..ceeb336 100644 --- a/server/api/authGoogle/authGoogle.controller.js +++ b/server/api/authGoogle/authGoogle.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../config/utils','login','authenticate','google','/login','email','use','secret','callbackURL','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','value','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0x13b8f3,_0x442821){var _0x1a6d06=function(_0x5126f2){while(--_0x5126f2){_0x13b8f3['push'](_0x13b8f3['shift']());}};_0x1a6d06(++_0x442821);}(_0x7a54,0x106));var _0x47a5=function(_0x337325,_0x488bcf){_0x337325=_0x337325-0x0;var _0x55756d=_0x7a54[_0x337325];return _0x55756d;};'use strict';var _=require(_0x47a5('0x0'));var passport=require(_0x47a5('0x1'));var GoogleStrategy=require(_0x47a5('0x2'))['Strategy'];var moment=require(_0x47a5('0x3'));var db=require(_0x47a5('0x4'))['db'];var config=require('../../config/environment');var utils=require(_0x47a5('0x5'));exports[_0x47a5('0x6')]=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':_0x47a5('0x9'),'scope':['profile',_0x47a5('0xa')],'session':![]});exports['callback']=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':'/login','session':![]});passport[_0x47a5('0xb')](new GoogleStrategy({'clientID':config['google']?config['google']['clientID']:'id','clientSecret':config[_0x47a5('0x8')]?config[_0x47a5('0x8')]['clientSecret']:_0x47a5('0xc'),'callbackURL':config['google']?config['google'][_0x47a5('0xd')]:''},function(_0x69e4d4,_0x2f399b,_0x250fad,_0xd612dd){var _0xd308b8,_0x1eae59;return db['Setting'][_0x47a5('0xe')]({'where':{'id':0x1},'attributes':[_0x47a5('0xf'),_0x47a5('0x10')],'raw':!![]})[_0x47a5('0x11')](function(_0x139f25){_0xd308b8=_0x139f25;return db[_0x47a5('0x12')][_0x47a5('0x13')]({'where':{'email':_[_0x47a5('0x14')](_0x250fad['emails'],_0x47a5('0x15')),'role':{'$or':[_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18')]}}});})[_0x47a5('0x11')](function(_0x574af6){_0x1eae59=_0x574af6;if(_0x1eae59){if(_0x1eae59['disabled']){return _0xd612dd(_0x47a5('0x19'));}else if(_0xd308b8['blockDuration']>0x0){if(_0x1eae59['blocked']){if(moment(_0x1eae59[_0x47a5('0x1a')])[_0x47a5('0x1b')](_0xd308b8[_0x47a5('0x10')],_0x47a5('0x1c'))>moment()){return _0xd612dd(_0x47a5('0x19'));}else{return utils[_0x47a5('0x1d')](_0x1eae59,0x0,![],null)[_0x47a5('0x11')](function(){return utils[_0x47a5('0x1e')](_0x1eae59);})[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils['getLicense'](_0x1eae59)[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils[_0x47a5('0x1e')](_0x1eae59)['then'](function(){return _0xd612dd(null,_0x1eae59);});}}return _0xd612dd(_0x47a5('0x19'));})[_0x47a5('0x1f')](function(_0x36874d){_0xd612dd(_0x36874d);});})); \ No newline at end of file +var _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(_0x35e44d,_0x34def6){var _0x35ec48=function(_0xb33742){while(--_0xb33742){_0x35e44d['push'](_0x35e44d['shift']());}};_0x35ec48(++_0x34def6);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'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 diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index ddef48b..1e4bfdb 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 _0x7b51=['login','get','/callback','callback','setTokenCookie','express','passport','Router','./authGoogle.controller','../../components/auth/service'];(function(_0x4cf334,_0x511f7d){var _0x530c3f=function(_0x5499ab){while(--_0x5499ab){_0x4cf334['push'](_0x4cf334['shift']());}};_0x530c3f(++_0x511f7d);}(_0x7b51,0x1bd));var _0x17b5=function(_0x4ac24c,_0x2791b9){_0x4ac24c=_0x4ac24c-0x0;var _0x3961b0=_0x7b51[_0x4ac24c];return _0x3961b0;};'use strict';var express=require(_0x17b5('0x0'));var passport=require(_0x17b5('0x1'));var router=express[_0x17b5('0x2')]();var controller=require(_0x17b5('0x3'));var userController=require('../user/user.controller.js');var authService=require(_0x17b5('0x4'));router['get']('/',controller[_0x17b5('0x5')]);router[_0x17b5('0x6')](_0x17b5('0x7'),controller[_0x17b5('0x8')],authService['isMiddleware'],userController[_0x17b5('0x5')],authService[_0x17b5('0x9')]);module['exports']=router; \ No newline at end of file +var _0xf6d8=['express','passport','Router','./authGoogle.controller','../../components/auth/service','get','/callback','callback','isMiddleware','login'];(function(_0x3110ab,_0x5b6a7a){var _0x24c310=function(_0x3cbbc9){while(--_0x3cbbc9){_0x3110ab['push'](_0x3110ab['shift']());}};_0x24c310(++_0x5b6a7a);}(_0xf6d8,0xb4));var _0x8f6d=function(_0x4d7f55,_0x53a87d){_0x4d7f55=_0x4d7f55-0x0;var _0x16fc1e=_0xf6d8[_0x4d7f55];return _0x16fc1e;};'use strict';var express=require(_0x8f6d('0x0'));var passport=require(_0x8f6d('0x1'));var router=express[_0x8f6d('0x2')]();var controller=require(_0x8f6d('0x3'));var userController=require('../user/user.controller.js');var authService=require(_0x8f6d('0x4'));router[_0x8f6d('0x5')]('/',controller['login']);router[_0x8f6d('0x5')](_0x8f6d('0x6'),controller[_0x8f6d('0x7')],authService[_0x8f6d('0x8')],userController[_0x8f6d('0x9')],authService['setTokenCookie']);module['exports']=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 11007d5..2c3fdda 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 _0x67ba=['jayson/promise','lodash','randomstring','moment','../../mysqldb','../../config/utils','Setting','findOne','allowedLoginAttempts','then','name','password','role','disabled','blocked','blockedAt','loginAttempts','admin','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','minutes','clearBlockUser','getLicense','catch','find','email','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','merge','format','\x22%s\x22\x20<%s>','user','request','SendMail','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','error','message','stringify','send','login','authenticate','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','forgot','body','trim','User','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','add','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','save','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','Reset\x20Email\x20sent!','reset','params','token','now','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','previousPasswords','resetPasswordExpires','status','Password\x20reset!','use','util','passport','Strategy'];(function(_0x45b9f7,_0x3f2149){var _0x2179ec=function(_0x4daf22){while(--_0x4daf22){_0x45b9f7['push'](_0x45b9f7['shift']());}};_0x2179ec(++_0x3f2149);}(_0x67ba,0xf0));var _0xa67b=function(_0x11d301,_0x1797e1){_0x11d301=_0x11d301-0x0;var _0x4e8155=_0x67ba[_0x11d301];return _0x4e8155;};'use strict';var util=require(_0xa67b('0x0'));var passport=require(_0xa67b('0x1'));var LocalStrategy=require('passport-local')[_0xa67b('0x2')];var jayson=require(_0xa67b('0x3'));var _=require(_0xa67b('0x4'));var rs=require(_0xa67b('0x5'));var moment=require(_0xa67b('0x6'));var db=require(_0xa67b('0x7'))['db'];var authService=require('../../components/auth/service');var utils=require(_0xa67b('0x8'));var client=jayson['client']['http']({'port':0x232b});function localAuthenticate(_0x1c5ccf,_0x223852,_0x53a337,_0x5e8245){var _0x1f2b65,_0x5be547;return db[_0xa67b('0x9')][_0xa67b('0xa')]({'where':{'id':0x1},'attributes':[_0xa67b('0xb'),'blockDuration'],'raw':!![]})[_0xa67b('0xc')](function(_0x3f2b8c){_0x1f2b65=_0x3f2b8c;return _0x1c5ccf[_0xa67b('0xa')]({'attributes':['id',_0xa67b('0xd'),_0xa67b('0xe'),'salt',_0xa67b('0xf'),_0xa67b('0x10'),_0xa67b('0x11'),_0xa67b('0x12'),_0xa67b('0x13')],'where':{'name':_0x223852,'role':{'$or':[_0xa67b('0x14'),'user',_0xa67b('0x15')]}}});})[_0xa67b('0xc')](function(_0x45526a){if(!_0x45526a||_0x45526a&&_0x45526a['name']!==_0x223852){throw new Error(_0xa67b('0x16'));}else{_0x5be547=_0x45526a;return _0x5be547;}})[_0xa67b('0xc')](function(){_0x5be547['authenticate'](_0x53a337,function(_0x27286a,_0x108d64){var _0x213cdf=_0x5be547[_0xa67b('0x13')]+0x1;if(_0x27286a){return _0x5e8245(_0x27286a);}else if(!_0x108d64){if(_0x5be547[_0xa67b('0x10')]){return _0x5e8245(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x1f2b65[_0xa67b('0xb')]>0x0){if(_0x5be547[_0xa67b('0x11')]){if(_0x1f2b65[_0xa67b('0x17')]>0x0){if(moment(_0x5be547['blockedAt'])['add'](_0x1f2b65[_0xa67b('0x17')],_0xa67b('0x18'))>moment()){return _0x5e8245(null,![],{'message':_0xa67b('0x16')});}else{return utils[_0xa67b('0x19')](_0x5be547,_0x213cdf,![],null)['then'](function(){return _0x5e8245(null,![],{'message':_0xa67b('0x16')});});}}else{return _0x5e8245(null,![],{'message':_0xa67b('0x16')});}}else{if(_0x213cdf>=_0x1f2b65[_0xa67b('0xb')]){return utils[_0xa67b('0x19')](_0x5be547,0x0,!![],moment())[_0xa67b('0xc')](function(){return _0x5e8245(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils['clearBlockUser'](_0x5be547,_0x213cdf,![],null)[_0xa67b('0xc')](function(){return _0x5e8245(null,![],{'message':_0xa67b('0x16')});});}}}else{return _0x5e8245(null,![],{'message':_0xa67b('0x16')});}}else{if(_0x5be547['disabled']){return _0x5e8245(null,![],{'message':_0xa67b('0x16')});}else if(_0x1f2b65['allowedLoginAttempts']>0x0){if(_0x5be547[_0xa67b('0x11')]){if(_0x1f2b65[_0xa67b('0x17')]>0x0){if(moment(_0x5be547[_0xa67b('0x12')])['add'](_0x1f2b65[_0xa67b('0x17')],_0xa67b('0x18'))>moment()){return _0x5e8245(null,![],{'message':_0xa67b('0x16')});}else{return utils['clearBlockUser'](_0x5be547,0x0,![],null)['then'](function(){return utils[_0xa67b('0x1a')](_0x5be547);})['then'](function(){return _0x5e8245(null,_0x5be547);});}}else{return _0x5e8245(null,![],{'message':_0xa67b('0x16')});}}else{return utils[_0xa67b('0x19')](_0x5be547,0x0,![],null)[_0xa67b('0xc')](function(){return utils['getLicense'](_0x5be547);})['then'](function(){return _0x5e8245(null,_0x5be547);})[_0xa67b('0x1b')](function(_0x8ba0){return _0x5e8245(null,![],_0x8ba0);});}}else{if(_0x5be547['blocked']){return _0x5e8245(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0xa67b('0x1a')](_0x5be547)[_0xa67b('0xc')](function(){return _0x5e8245(null,_0x5be547);});}}}});})['catch'](function(_0x380dca){return _0x5e8245(null,![],_0x380dca);});}function sendServiceMail(_0x196bb6){return db['MailAccount'][_0xa67b('0x1c')]({'where':{'service':!![]},'attributes':['id',_0xa67b('0xd'),_0xa67b('0x1d')],'include':[{'model':db['MailServerOut'],'as':_0xa67b('0x1e'),'include':[{'model':db[_0xa67b('0x1f')],'as':'CloudProvider'}]}]})['then'](function(_0x2e4c15){if(!_0x2e4c15){throw new Error(_0xa67b('0x20'));}var _0x234146=_0x2e4c15[_0xa67b('0x21')]();var _0x83d618={'account':_0x234146,'message':_[_0xa67b('0x22')]({'from':util[_0xa67b('0x23')](_0xa67b('0x24'),_0x2e4c15[_0xa67b('0xd')],_0x2e4c15[_0xa67b('0x1d')]||_0x2e4c15[_0xa67b('0x1e')][_0xa67b('0x25')])},_0x196bb6)};return client[_0xa67b('0x26')](_0xa67b('0x27'),_0x83d618);})[_0xa67b('0xc')](function(_0x30aa86){if(_0x30aa86['error']){throw new Error(util[_0xa67b('0x23')](_0xa67b('0x28'),_0x30aa86[_0xa67b('0x29')][_0xa67b('0x2a')]||JSON[_0xa67b('0x2b')](_0x30aa86[_0xa67b('0x29')])));}return!![];});}function handleError(_0x215e61,_0x223d99,_0x2511d4){return _0x215e61['status'](_0x223d99||0x1f4)[_0xa67b('0x2c')]({'message':_0x2511d4?_0x2511d4['message']||_0x2511d4:''});}exports[_0xa67b('0x2d')]=function(_0xc9ccd5,_0x23786b,_0x22beee){passport[_0xa67b('0x2e')](_0xa67b('0x2f'),function(_0x1b884b,_0x1d13dc,_0x4801f7){var _0x259772=_0x1b884b||_0x4801f7;if(_0x259772){return handleError(_0x23786b,0x191,_0x259772);}if(!_0x1d13dc){return handleError(_0x23786b,0x194,{'message':_0xa67b('0x30')});}else{var _0x228135={'payload':{'id':_0x1d13dc['id'],'role':_0x1d13dc[_0xa67b('0xf')]},'options':{'expiresIn':0x15180}};return authService[_0xa67b('0x31')](_0x228135)[_0xa67b('0xc')](function(_0x210537){_0x23786b[_0xa67b('0x32')]({'id':_0x1d13dc['id'],'token':_0x210537,'statusCall':'','isAlreadyLogged':_0x1d13dc[_0xa67b('0x33')]});});}})(_0xc9ccd5,_0x23786b,_0x22beee);};exports[_0xa67b('0x34')]=function(_0x404c2d,_0x1baa1d){if(!_0x404c2d[_0xa67b('0x35')][_0xa67b('0x1d')]){return handleError(_0x1baa1d,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0x5ed837=rs['generate']();_0x404c2d[_0xa67b('0x35')][_0xa67b('0x1d')]=_0x404c2d[_0xa67b('0x35')][_0xa67b('0x1d')][_0xa67b('0x36')]()['toLowerCase']();var _0x37d84c;return db[_0xa67b('0x9')]['findOne']({'where':{'id':0x1},'attributes':[_0xa67b('0xb'),_0xa67b('0x17')],'raw':!![]})[_0xa67b('0xc')](function(_0x5832c1){_0x37d84c=_0x5832c1;return db[_0xa67b('0x37')][_0xa67b('0x1c')]({'where':{'email':_0x404c2d[_0xa67b('0x35')][_0xa67b('0x1d')]}});})[_0xa67b('0xc')](function(_0x371df9){if(!_0x371df9){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0x371df9[_0xa67b('0x10')]){throw new Error(_0xa67b('0x38'));}if(_0x371df9[_0xa67b('0x11')]){if(moment(_0x371df9[_0xa67b('0x12')])[_0xa67b('0x39')](_0x37d84c['blockDuration'],_0xa67b('0x18'))>moment()){throw new Error(_0xa67b('0x3a'));}else{_0x371df9[_0xa67b('0x11')]=![];_0x371df9[_0xa67b('0x12')]=null;}}_0x371df9[_0xa67b('0x3b')]=_0x5ed837;_0x371df9['resetPasswordExpires']=Date['now']()+0x36ee80;return _0x371df9[_0xa67b('0x3c')]();})[_0xa67b('0xc')](function(){return sendServiceMail({'to':_0x404c2d[_0xa67b('0x35')][_0xa67b('0x1d')],'subject':'xCally\x20Motion\x20Password\x20Reset','text':_0xa67b('0x3d')+_0xa67b('0x3e')+_0xa67b('0x3f')+_0x404c2d[_0xa67b('0x40')][_0xa67b('0x41')]+'/reset/'+_0x5ed837+'\x0a\x0a'+_0xa67b('0x42')});})[_0xa67b('0xc')](function(){_0x1baa1d['status'](0xc8)['send']({'message':_0xa67b('0x43')});})['catch'](function(_0x1b5c28){return handleError(_0x1baa1d,0x1f4,_0x1b5c28);});};exports[_0xa67b('0x44')]=function(_0xce3aec,_0x2cc242){return db['User'][_0xa67b('0x1c')]({'where':{'resetPasswordToken':_0xce3aec[_0xa67b('0x45')][_0xa67b('0x46')],'resetPasswordExpires':{'$gt':Date[_0xa67b('0x47')]()}}})[_0xa67b('0xc')](function(_0x67292c){if(!_0x67292c){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db['Setting'][_0xa67b('0xa')]({'attributes':['id',_0xa67b('0x48'),_0xa67b('0x49'),_0xa67b('0x4a')]})[_0xa67b('0xc')](function(_0x46d63f){if(_0x46d63f[_0xa67b('0x48')])authService[_0xa67b('0x4b')](_0xce3aec['body']['password']);if(!_0x46d63f[_0xa67b('0x49')]||!_0x67292c[_0xa67b('0x4c')])return _0x67292c;authService['validatePasswordHistory'](_0xce3aec['body'][_0xa67b('0xe')],_0x67292c[_0xa67b('0x4c')],_0x46d63f[_0xa67b('0x4a')]);return _0x67292c;})[_0xa67b('0xc')](function(){_0x67292c['password']=_0xce3aec['body']['password'];_0x67292c[_0xa67b('0x3b')]=null;_0x67292c[_0xa67b('0x4d')]=null;return _0x67292c[_0xa67b('0x3c')]();});})[_0xa67b('0xc')](function(){_0x2cc242[_0xa67b('0x4e')](0xc8)['send']({'message':_0xa67b('0x4f')});})[_0xa67b('0x1b')](function(_0x367b33){return handleError(_0x2cc242,0x1f4,_0x367b33);});};passport[_0xa67b('0x50')]('local-login',new LocalStrategy({'usernameField':_0xa67b('0xd'),'passwordField':_0xa67b('0xe')},function(_0x2ed5f4,_0x1e34de,_0xe5ccf7){return localAuthenticate(db[_0xa67b('0x37')],_0x2ed5f4,_0x1e34de,_0xe5ccf7);})); \ No newline at end of file +var _0x9f33=['user','agent','name','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','add','minutes','clearBlockUser','getLicense','catch','MailAccount','email','MailServerOut','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','merge','format','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','stringify','status','send','message','authenticate','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','json','online','forgot','body','Email\x20parameter\x20is\x20missing','trim','toLowerCase','find','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','now','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','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','previousPasswords','validatePasswordHistory','User','util','passport','passport-local','Strategy','lodash','randomstring','moment','../../components/auth/service','../../config/utils','client','http','Setting','allowedLoginAttempts','blockDuration','then','findOne','password','role','disabled','blocked','blockedAt','loginAttempts','admin'];(function(_0x53a822,_0x550c4d){var _0x5e0aa1=function(_0x537f4f){while(--_0x537f4f){_0x53a822['push'](_0x53a822['shift']());}};_0x5e0aa1(++_0x550c4d);}(_0x9f33,0x135));var _0x39f3=function(_0x646603,_0x1a1119){_0x646603=_0x646603-0x0;var _0x232a83=_0x9f33[_0x646603];return _0x232a83;};'use strict';var util=require(_0x39f3('0x0'));var passport=require(_0x39f3('0x1'));var LocalStrategy=require(_0x39f3('0x2'))[_0x39f3('0x3')];var jayson=require('jayson/promise');var _=require(_0x39f3('0x4'));var rs=require(_0x39f3('0x5'));var moment=require(_0x39f3('0x6'));var db=require('../../mysqldb')['db'];var authService=require(_0x39f3('0x7'));var utils=require(_0x39f3('0x8'));var client=jayson[_0x39f3('0x9')][_0x39f3('0xa')]({'port':0x232b});function localAuthenticate(_0x11874,_0x2246c3,_0x34dca5,_0x2e8720){var _0x4308ff,_0x4e3b31;return db[_0x39f3('0xb')]['findOne']({'where':{'id':0x1},'attributes':[_0x39f3('0xc'),_0x39f3('0xd')],'raw':!![]})[_0x39f3('0xe')](function(_0x1f024d){_0x4308ff=_0x1f024d;return _0x11874[_0x39f3('0xf')]({'attributes':['id','name',_0x39f3('0x10'),'salt',_0x39f3('0x11'),_0x39f3('0x12'),_0x39f3('0x13'),_0x39f3('0x14'),_0x39f3('0x15')],'where':{'name':_0x2246c3,'role':{'$or':[_0x39f3('0x16'),_0x39f3('0x17'),_0x39f3('0x18')]}}});})['then'](function(_0x4afe8a){if(!_0x4afe8a||_0x4afe8a&&_0x4afe8a[_0x39f3('0x19')]!==_0x2246c3){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x4e3b31=_0x4afe8a;return _0x4e3b31;}})[_0x39f3('0xe')](function(){_0x4e3b31['authenticate'](_0x34dca5,function(_0x4c8723,_0x20d1ec){var _0x4139e1=_0x4e3b31[_0x39f3('0x15')]+0x1;if(_0x4c8723){return _0x2e8720(_0x4c8723);}else if(!_0x20d1ec){if(_0x4e3b31[_0x39f3('0x12')]){return _0x2e8720(null,![],{'message':_0x39f3('0x1a')});}else if(_0x4308ff['allowedLoginAttempts']>0x0){if(_0x4e3b31[_0x39f3('0x13')]){if(_0x4308ff['blockDuration']>0x0){if(moment(_0x4e3b31[_0x39f3('0x14')])[_0x39f3('0x1b')](_0x4308ff[_0x39f3('0xd')],_0x39f3('0x1c'))>moment()){return _0x2e8720(null,![],{'message':_0x39f3('0x1a')});}else{return utils[_0x39f3('0x1d')](_0x4e3b31,_0x4139e1,![],null)[_0x39f3('0xe')](function(){return _0x2e8720(null,![],{'message':_0x39f3('0x1a')});});}}else{return _0x2e8720(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x4139e1>=_0x4308ff['allowedLoginAttempts']){return utils[_0x39f3('0x1d')](_0x4e3b31,0x0,!![],moment())[_0x39f3('0xe')](function(){return _0x2e8720(null,![],{'message':_0x39f3('0x1a')});});}else{return utils['clearBlockUser'](_0x4e3b31,_0x4139e1,![],null)[_0x39f3('0xe')](function(){return _0x2e8720(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}}else{return _0x2e8720(null,![],{'message':_0x39f3('0x1a')});}}else{if(_0x4e3b31[_0x39f3('0x12')]){return _0x2e8720(null,![],{'message':_0x39f3('0x1a')});}else if(_0x4308ff[_0x39f3('0xc')]>0x0){if(_0x4e3b31[_0x39f3('0x13')]){if(_0x4308ff[_0x39f3('0xd')]>0x0){if(moment(_0x4e3b31[_0x39f3('0x14')])['add'](_0x4308ff[_0x39f3('0xd')],_0x39f3('0x1c'))>moment()){return _0x2e8720(null,![],{'message':_0x39f3('0x1a')});}else{return utils[_0x39f3('0x1d')](_0x4e3b31,0x0,![],null)[_0x39f3('0xe')](function(){return utils[_0x39f3('0x1e')](_0x4e3b31);})[_0x39f3('0xe')](function(){return _0x2e8720(null,_0x4e3b31);});}}else{return _0x2e8720(null,![],{'message':_0x39f3('0x1a')});}}else{return utils[_0x39f3('0x1d')](_0x4e3b31,0x0,![],null)[_0x39f3('0xe')](function(){return utils[_0x39f3('0x1e')](_0x4e3b31);})[_0x39f3('0xe')](function(){return _0x2e8720(null,_0x4e3b31);})[_0x39f3('0x1f')](function(_0x3ab963){return _0x2e8720(null,![],_0x3ab963);});}}else{if(_0x4e3b31['blocked']){return _0x2e8720(null,![],{'message':_0x39f3('0x1a')});}else{return utils[_0x39f3('0x1e')](_0x4e3b31)['then'](function(){return _0x2e8720(null,_0x4e3b31);});}}}});})[_0x39f3('0x1f')](function(_0x143ced){return _0x2e8720(null,![],_0x143ced);});}function sendServiceMail(_0x469159){return db[_0x39f3('0x20')]['find']({'where':{'service':!![]},'attributes':['id',_0x39f3('0x19'),_0x39f3('0x21')],'include':[{'model':db[_0x39f3('0x22')],'as':_0x39f3('0x23'),'include':[{'model':db[_0x39f3('0x24')],'as':_0x39f3('0x24')}]}]})[_0x39f3('0xe')](function(_0x164ec0){if(!_0x164ec0){throw new Error(_0x39f3('0x25'));}var _0x58ebd2=_0x164ec0[_0x39f3('0x26')]();var _0x4931cd={'account':_0x58ebd2,'message':_[_0x39f3('0x27')]({'from':util[_0x39f3('0x28')]('\x22%s\x22\x20<%s>',_0x164ec0[_0x39f3('0x19')],_0x164ec0['email']||_0x164ec0[_0x39f3('0x23')]['user'])},_0x469159)};return client[_0x39f3('0x29')](_0x39f3('0x2a'),_0x4931cd);})[_0x39f3('0xe')](function(_0x783ab7){if(_0x783ab7[_0x39f3('0x2b')]){throw new Error(util[_0x39f3('0x28')](_0x39f3('0x2c'),_0x783ab7[_0x39f3('0x2b')]['message']||JSON[_0x39f3('0x2d')](_0x783ab7[_0x39f3('0x2b')])));}return!![];});}function handleError(_0x546b39,_0x3a4ea9,_0x294a88){return _0x546b39[_0x39f3('0x2e')](_0x3a4ea9||0x1f4)[_0x39f3('0x2f')]({'message':_0x294a88?_0x294a88[_0x39f3('0x30')]||_0x294a88:''});}exports['login']=function(_0x17e8e3,_0x29cc6b,_0x3b36cd){passport[_0x39f3('0x31')](_0x39f3('0x32'),function(_0x4d27c8,_0x5c975e,_0x338cba){var _0x133938=_0x4d27c8||_0x338cba;if(_0x133938){return handleError(_0x29cc6b,0x191,_0x133938);}if(!_0x5c975e){return handleError(_0x29cc6b,0x194,{'message':_0x39f3('0x33')});}else{var _0x396b2d={'payload':{'id':_0x5c975e['id'],'role':_0x5c975e['role']},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x396b2d)[_0x39f3('0xe')](function(_0x4b2439){_0x29cc6b[_0x39f3('0x34')]({'id':_0x5c975e['id'],'token':_0x4b2439,'statusCall':'','isAlreadyLogged':_0x5c975e[_0x39f3('0x35')]});});}})(_0x17e8e3,_0x29cc6b,_0x3b36cd);};exports[_0x39f3('0x36')]=function(_0x3c3ab6,_0x1db9ee){if(!_0x3c3ab6[_0x39f3('0x37')][_0x39f3('0x21')]){return handleError(_0x1db9ee,0x1f4,{'message':_0x39f3('0x38')});}var _0x2d79ce=rs['generate']();_0x3c3ab6[_0x39f3('0x37')][_0x39f3('0x21')]=_0x3c3ab6[_0x39f3('0x37')][_0x39f3('0x21')][_0x39f3('0x39')]()[_0x39f3('0x3a')]();var _0x2baed5;return db['Setting'][_0x39f3('0xf')]({'where':{'id':0x1},'attributes':[_0x39f3('0xc'),_0x39f3('0xd')],'raw':!![]})[_0x39f3('0xe')](function(_0x8c5a1b){_0x2baed5=_0x8c5a1b;return db['User'][_0x39f3('0x3b')]({'where':{'email':_0x3c3ab6['body'][_0x39f3('0x21')]}});})[_0x39f3('0xe')](function(_0x5feb24){if(!_0x5feb24){throw new Error(_0x39f3('0x3c'));}if(_0x5feb24[_0x39f3('0x12')]){throw new Error(_0x39f3('0x3d'));}if(_0x5feb24['blocked']){if(moment(_0x5feb24[_0x39f3('0x14')])[_0x39f3('0x1b')](_0x2baed5[_0x39f3('0xd')],_0x39f3('0x1c'))>moment()){throw new Error(_0x39f3('0x3e'));}else{_0x5feb24[_0x39f3('0x13')]=![];_0x5feb24['blockedAt']=null;}}_0x5feb24[_0x39f3('0x3f')]=_0x2d79ce;_0x5feb24['resetPasswordExpires']=Date[_0x39f3('0x40')]()+0x36ee80;return _0x5feb24['save']();})[_0x39f3('0xe')](function(){return sendServiceMail({'to':_0x3c3ab6[_0x39f3('0x37')]['email'],'subject':'xCally\x20Motion\x20Password\x20Reset','text':_0x39f3('0x41')+_0x39f3('0x42')+_0x39f3('0x43')+_0x3c3ab6[_0x39f3('0x44')][_0x39f3('0x45')]+_0x39f3('0x46')+_0x2d79ce+'\x0a\x0a'+_0x39f3('0x47')});})[_0x39f3('0xe')](function(){_0x1db9ee[_0x39f3('0x2e')](0xc8)[_0x39f3('0x2f')]({'message':_0x39f3('0x48')});})['catch'](function(_0x32fa47){return handleError(_0x1db9ee,0x1f4,_0x32fa47);});};exports[_0x39f3('0x49')]=function(_0x5024a6,_0xf5cce1){return db['User']['find']({'where':{'resetPasswordToken':_0x5024a6[_0x39f3('0x4a')][_0x39f3('0x4b')],'resetPasswordExpires':{'$gt':Date['now']()}}})[_0x39f3('0xe')](function(_0xd91408){if(!_0xd91408){throw new Error(_0x39f3('0x4c'));}return db['Setting']['findOne']({'attributes':['id',_0x39f3('0x4d'),_0x39f3('0x4e'),_0x39f3('0x4f')]})[_0x39f3('0xe')](function(_0x237b13){if(_0x237b13[_0x39f3('0x4d')])authService['validatePasswordPattern'](_0x5024a6[_0x39f3('0x37')][_0x39f3('0x10')]);if(!_0x237b13[_0x39f3('0x4e')]||!_0xd91408[_0x39f3('0x50')])return _0xd91408;authService[_0x39f3('0x51')](_0x5024a6['body'][_0x39f3('0x10')],_0xd91408[_0x39f3('0x50')],_0x237b13[_0x39f3('0x4f')]);return _0xd91408;})['then'](function(){_0xd91408[_0x39f3('0x10')]=_0x5024a6[_0x39f3('0x37')][_0x39f3('0x10')];_0xd91408[_0x39f3('0x3f')]=null;_0xd91408['resetPasswordExpires']=null;return _0xd91408['save']();});})[_0x39f3('0xe')](function(){_0xf5cce1[_0x39f3('0x2e')](0xc8)[_0x39f3('0x2f')]({'message':'Password\x20reset!'});})[_0x39f3('0x1f')](function(_0x8e7be6){return handleError(_0xf5cce1,0x1f4,_0x8e7be6);});};passport['use'](_0x39f3('0x32'),new LocalStrategy({'usernameField':_0x39f3('0x19'),'passwordField':_0x39f3('0x10')},function(_0x321de0,_0x38e7ea,_0x3fd7d6){return localAuthenticate(db[_0x39f3('0x52')],_0x321de0,_0x38e7ea,_0x3fd7d6);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 776a37e..4fcb30e 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 _0x94b3=['forgot','/reset/:token','reset','express','Router','post','login'];(function(_0x2989f7,_0x52555e){var _0x1644c0=function(_0x45f074){while(--_0x45f074){_0x2989f7['push'](_0x2989f7['shift']());}};_0x1644c0(++_0x52555e);}(_0x94b3,0x96));var _0x394b=function(_0x1b2ff7,_0x12a034){_0x1b2ff7=_0x1b2ff7-0x0;var _0x31656a=_0x94b3[_0x1b2ff7];return _0x31656a;};'use strict';var express=require(_0x394b('0x0'));var router=express[_0x394b('0x1')]();var controller=require('./authLocal.controller');router[_0x394b('0x2')]('/',controller[_0x394b('0x3')]);router[_0x394b('0x2')]('/forgot',controller[_0x394b('0x4')]);router['post'](_0x394b('0x5'),controller[_0x394b('0x6')]);module['exports']=router; \ No newline at end of file +var _0x98c5=['express','./authLocal.controller','post','forgot','/reset/:token','exports'];(function(_0x3ecc0a,_0x36082c){var _0x4fc0a4=function(_0x39488e){while(--_0x39488e){_0x3ecc0a['push'](_0x3ecc0a['shift']());}};_0x4fc0a4(++_0x36082c);}(_0x98c5,0x102));var _0x598c=function(_0x65a834,_0x45d48a){_0x65a834=_0x65a834-0x0;var _0x5ca46f=_0x98c5[_0x65a834];return _0x5ca46f;};'use strict';var express=require(_0x598c('0x0'));var router=express['Router']();var controller=require(_0x598c('0x1'));router[_0x598c('0x2')]('/',controller['login']);router[_0x598c('0x2')]('/forgot',controller[_0x598c('0x3')]);router[_0x598c('0x2')](_0x598c('0x4'),controller['reset']);module[_0x598c('0x5')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index e3f8708..08db53f 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 _0xb15e=['sequelize','exports','STRING','INTEGER'];(function(_0x42f009,_0x5e27b1){var _0x22a1e0=function(_0x297993){while(--_0x297993){_0x42f009['push'](_0x42f009['shift']());}};_0x22a1e0(++_0x5e27b1);}(_0xb15e,0xe0));var _0xeb15=function(_0x372f40,_0x3c583a){_0x372f40=_0x372f40-0x0;var _0x48e535=_0xb15e[_0x372f40];return _0x48e535;};'use strict';var Sequelize=require(_0xeb15('0x0'));module[_0xeb15('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize[_0xeb15('0x2')]},'description':{'type':Sequelize[_0xeb15('0x2')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize[_0xeb15('0x3')],'defaultValue':0xa}}; \ No newline at end of file +var _0x491d=['exports','STRING','BOOLEAN','sequelize'];(function(_0x15ac8d,_0x52cce1){var _0x55e8de=function(_0x41d478){while(--_0x41d478){_0x15ac8d['push'](_0x15ac8d['shift']());}};_0x55e8de(++_0x52cce1);}(_0x491d,0x177));var _0xd491=function(_0x1bef47,_0x337f1a){_0x1bef47=_0x1bef47-0x0;var _0x4e67c8=_0x491d[_0x1bef47];return _0x4e67c8;};'use strict';var Sequelize=require(_0xd491('0x0'));module[_0xd491('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize[_0xd491('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0xd491('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize['INTEGER'],'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 a385eb5..56b6cd9 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 _0xe212=['sort','where','pick','filter','merge','options','includeAll','include','rows','catch','show','params','keys','length','create','body','find','addConditions','Condition','ids','omit','getConditions','findOne','Action','addActions','getActions','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','Automation','rawAttributes','fieldName','type','key','map','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order'];(function(_0x2f3339,_0x42167a){var _0x39a2b3=function(_0xaa9bc3){while(--_0xaa9bc3){_0x2f3339['push'](_0x2f3339['shift']());}};_0x39a2b3(++_0x42167a);}(_0xe212,0x70));var _0x2e21=function(_0x5cc8b9,_0x20e3c3){_0x5cc8b9=_0x5cc8b9-0x0;var _0x58892e=_0xe212[_0x5cc8b9];return _0x58892e;};'use strict';var emlformat=require(_0x2e21('0x0'));var rimraf=require(_0x2e21('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2e21('0x2'));var rp=require(_0x2e21('0x3'));var moment=require(_0x2e21('0x4'));var BPromise=require(_0x2e21('0x5'));var Mustache=require(_0x2e21('0x6'));var util=require(_0x2e21('0x7'));var path=require(_0x2e21('0x8'));var sox=require(_0x2e21('0x9'));var csv=require(_0x2e21('0xa'));var ejs=require(_0x2e21('0xb'));var fs=require('fs');var fs_extra=require(_0x2e21('0xc'));var _=require(_0x2e21('0xd'));var squel=require(_0x2e21('0xe'));var crypto=require(_0x2e21('0xf'));var jsforce=require(_0x2e21('0x10'));var deskjs=require(_0x2e21('0x11'));var toCsv=require(_0x2e21('0xa'));var querystring=require(_0x2e21('0x12'));var Papa=require('papaparse');var Redis=require(_0x2e21('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x2e21('0x14'));var as=require(_0x2e21('0x15'));var hardwareService=require(_0x2e21('0x16'));var logger=require(_0x2e21('0x17'))('api');var utils=require('../../config/utils');var config=require(_0x2e21('0x18'));var licenseUtil=require(_0x2e21('0x19'));var db=require(_0x2e21('0x1a'))['db'];function respondWithStatusCode(_0x4f41ac,_0x5a9675){_0x5a9675=_0x5a9675||0xcc;return function(_0x119cee){if(_0x119cee){return _0x4f41ac[_0x2e21('0x1b')](_0x5a9675);}return _0x4f41ac[_0x2e21('0x1c')](_0x5a9675)[_0x2e21('0x1d')]();};}function respondWithResult(_0x579fbe,_0x42a6e5){_0x42a6e5=_0x42a6e5||0xc8;return function(_0x2cb32b){if(_0x2cb32b){return _0x579fbe['status'](_0x42a6e5)['json'](_0x2cb32b);}};}function respondWithFilteredResult(_0x1f5ba0,_0x2b4b28){return function(_0x3f11fc){if(_0x3f11fc){var _0x5526b9=typeof _0x2b4b28[_0x2e21('0x1e')]===_0x2e21('0x1f')&&typeof _0x2b4b28[_0x2e21('0x20')]===_0x2e21('0x1f');var _0x11af2e=_0x3f11fc[_0x2e21('0x21')];var _0xa032a3=_0x5526b9?0x0:_0x2b4b28[_0x2e21('0x1e')];var _0x4ec238=_0x5526b9?_0x3f11fc[_0x2e21('0x21')]:_0x2b4b28[_0x2e21('0x1e')]+_0x2b4b28[_0x2e21('0x20')];var _0x3d59c0;if(_0x4ec238>=_0x11af2e){_0x4ec238=_0x11af2e;_0x3d59c0=0xc8;}else{_0x3d59c0=0xce;}_0x1f5ba0[_0x2e21('0x1c')](_0x3d59c0);return _0x1f5ba0[_0x2e21('0x22')](_0x2e21('0x23'),_0xa032a3+'-'+_0x4ec238+'/'+_0x11af2e)['json'](_0x3f11fc);}return null;};}function patchUpdates(_0x32ddc1){return function(_0x458735){try{jsonpatch[_0x2e21('0x24')](_0x458735,_0x32ddc1,!![]);}catch(_0x459229){return BPromise['reject'](_0x459229);}return _0x458735[_0x2e21('0x25')]();};}function saveUpdates(_0x13e71a,_0x3763bc){return function(_0x599bf4){if(_0x599bf4){return _0x599bf4[_0x2e21('0x26')](_0x13e71a)[_0x2e21('0x27')](function(_0x3a46b6){return _0x3a46b6;});}return null;};}function removeEntity(_0x2be77e,_0x10fa48){return function(_0x382625){if(_0x382625){return _0x382625[_0x2e21('0x28')]()[_0x2e21('0x27')](function(){_0x2be77e[_0x2e21('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c0e9b,_0x4d2fd8){return function(_0x2e0cfe){if(!_0x2e0cfe){_0x5c0e9b['sendStatus'](0x194);}return _0x2e0cfe;};}function handleError(_0x176f52,_0x198ecb){_0x198ecb=_0x198ecb||0x1f4;return function(_0x50dbc6){logger['error'](_0x50dbc6[_0x2e21('0x29')]);if(_0x50dbc6[_0x2e21('0x2a')]){delete _0x50dbc6[_0x2e21('0x2a')];}_0x176f52[_0x2e21('0x1c')](_0x198ecb)[_0x2e21('0x2b')](_0x50dbc6);};}exports[_0x2e21('0x2c')]=function(_0x41deea,_0x22602e){var _0xd5b09={},_0x5a3c43={},_0x5e2f99={'count':0x0,'rows':[]};var _0x503d6c=_['map'](db[_0x2e21('0x2d')][_0x2e21('0x2e')],function(_0x122189){return{'name':_0x122189[_0x2e21('0x2f')],'type':_0x122189[_0x2e21('0x30')][_0x2e21('0x31')]};});_0x5a3c43['model']=_[_0x2e21('0x32')](_0x503d6c,'name');_0x5a3c43[_0x2e21('0x33')]=_['keys'](_0x41deea[_0x2e21('0x33')]);_0x5a3c43[_0x2e21('0x34')]=_[_0x2e21('0x35')](_0x5a3c43[_0x2e21('0x36')],_0x5a3c43[_0x2e21('0x33')]);_0xd5b09[_0x2e21('0x37')]=_[_0x2e21('0x35')](_0x5a3c43[_0x2e21('0x36')],qs[_0x2e21('0x38')](_0x41deea['query'][_0x2e21('0x38')]));_0xd5b09[_0x2e21('0x37')]=_0xd5b09[_0x2e21('0x37')]['length']?_0xd5b09[_0x2e21('0x37')]:_0x5a3c43['model'];if(!_0x41deea[_0x2e21('0x33')][_0x2e21('0x39')](_0x2e21('0x3a'))){_0xd5b09['limit']=qs[_0x2e21('0x20')](_0x41deea['query'][_0x2e21('0x20')]);_0xd5b09[_0x2e21('0x1e')]=qs[_0x2e21('0x1e')](_0x41deea[_0x2e21('0x33')]['offset']);}_0xd5b09[_0x2e21('0x3b')]=qs[_0x2e21('0x3c')](_0x41deea[_0x2e21('0x33')][_0x2e21('0x3c')]);_0xd5b09[_0x2e21('0x3d')]=qs['filters'](_[_0x2e21('0x3e')](_0x41deea['query'],_0x5a3c43['filters']),_0x503d6c);if(_0x41deea['query'][_0x2e21('0x3f')]){_0xd5b09[_0x2e21('0x3d')]=_[_0x2e21('0x40')](_0xd5b09[_0x2e21('0x3d')],{'$or':_[_0x2e21('0x32')](_0x503d6c,function(_0x29c586){if(_0x29c586[_0x2e21('0x30')]!=='VIRTUAL'){var _0xc5f934={};_0xc5f934[_0x29c586[_0x2e21('0x2a')]]={'$like':'%'+_0x41deea[_0x2e21('0x33')][_0x2e21('0x3f')]+'%'};return _0xc5f934;}})});}_0xd5b09=_[_0x2e21('0x40')]({},_0xd5b09,_0x41deea[_0x2e21('0x41')]);var _0x524131={'where':_0xd5b09[_0x2e21('0x3d')]};return db[_0x2e21('0x2d')][_0x2e21('0x21')](_0x524131)['then'](function(_0x200f3b){_0x5e2f99[_0x2e21('0x21')]=_0x200f3b;if(_0x41deea['query'][_0x2e21('0x42')]){_0xd5b09[_0x2e21('0x43')]=[{'all':!![]}];}return db['Automation']['findAll'](_0xd5b09);})[_0x2e21('0x27')](function(_0x1f57dc){_0x5e2f99[_0x2e21('0x44')]=_0x1f57dc;return _0x5e2f99;})[_0x2e21('0x27')](respondWithFilteredResult(_0x22602e,_0xd5b09))[_0x2e21('0x45')](handleError(_0x22602e,null));};exports[_0x2e21('0x46')]=function(_0x4bb007,_0x184592){var _0x46aeef={'raw':![],'where':{'id':_0x4bb007[_0x2e21('0x47')]['id']}},_0x489393={};_0x489393[_0x2e21('0x36')]=_['keys'](db['Automation'][_0x2e21('0x2e')]);_0x489393[_0x2e21('0x33')]=_[_0x2e21('0x48')](_0x4bb007['query']);_0x489393['filters']=_[_0x2e21('0x35')](_0x489393[_0x2e21('0x36')],_0x489393[_0x2e21('0x33')]);_0x46aeef[_0x2e21('0x37')]=_[_0x2e21('0x35')](_0x489393[_0x2e21('0x36')],qs[_0x2e21('0x38')](_0x4bb007[_0x2e21('0x33')][_0x2e21('0x38')]));_0x46aeef['attributes']=_0x46aeef[_0x2e21('0x37')][_0x2e21('0x49')]?_0x46aeef['attributes']:_0x489393[_0x2e21('0x36')];if(_0x4bb007[_0x2e21('0x33')][_0x2e21('0x42')]){_0x46aeef[_0x2e21('0x43')]=[{'all':!![]}];}_0x46aeef=_[_0x2e21('0x40')]({},_0x46aeef,_0x4bb007[_0x2e21('0x41')]);return db[_0x2e21('0x2d')]['find'](_0x46aeef)[_0x2e21('0x27')](handleEntityNotFound(_0x184592,null))[_0x2e21('0x27')](respondWithResult(_0x184592,null))['catch'](handleError(_0x184592,null));};exports[_0x2e21('0x4a')]=function(_0x21f25c,_0x5682a4){return db[_0x2e21('0x2d')][_0x2e21('0x4a')](_0x21f25c[_0x2e21('0x4b')],{})['then'](respondWithResult(_0x5682a4,0xc9))['catch'](handleError(_0x5682a4,null));};exports[_0x2e21('0x26')]=function(_0x155c0a,_0x4bde04){if(_0x155c0a[_0x2e21('0x4b')]['id']){delete _0x155c0a[_0x2e21('0x4b')]['id'];}return db[_0x2e21('0x2d')][_0x2e21('0x4c')]({'where':{'id':_0x155c0a[_0x2e21('0x47')]['id']}})[_0x2e21('0x27')](handleEntityNotFound(_0x4bde04,null))[_0x2e21('0x27')](saveUpdates(_0x155c0a[_0x2e21('0x4b')],null))[_0x2e21('0x27')](respondWithResult(_0x4bde04,null))['catch'](handleError(_0x4bde04,null));};exports[_0x2e21('0x28')]=function(_0x1d49a,_0x3d29da){return db[_0x2e21('0x2d')][_0x2e21('0x4c')]({'where':{'id':_0x1d49a[_0x2e21('0x47')]['id']}})['then'](handleEntityNotFound(_0x3d29da,null))['then'](removeEntity(_0x3d29da,null))['catch'](handleError(_0x3d29da,null));};exports[_0x2e21('0x4d')]=function(_0x2379c9,_0x565bdd,_0x325fee){return db[_0x2e21('0x4e')][_0x2e21('0x4c')]({'where':{'id':_0x2379c9[_0x2e21('0x47')]['id']}})['then'](handleEntityNotFound(_0x565bdd,null))[_0x2e21('0x27')](function(_0x49a988){if(_0x49a988){return _0x49a988[_0x2e21('0x4d')](_0x2379c9[_0x2e21('0x4b')][_0x2e21('0x4f')],_[_0x2e21('0x50')](_0x2379c9[_0x2e21('0x4b')],[_0x2e21('0x4f'),'id'])||{});}})[_0x2e21('0x27')](respondWithResult(_0x565bdd,null))['catch'](handleError(_0x565bdd,null));};exports[_0x2e21('0x51')]=function(_0x5d2093,_0x572b64,_0x3b5696){var _0x3ec0a6={};var _0x5d4f78={};var _0x122675;var _0x4d7708;return db[_0x2e21('0x2d')][_0x2e21('0x52')]({'where':{'id':_0x5d2093[_0x2e21('0x47')]['id']}})[_0x2e21('0x27')](handleEntityNotFound(_0x572b64,null))[_0x2e21('0x27')](function(_0x4bcac0){if(_0x4bcac0){_0x122675=_0x4bcac0;_0x5d4f78['model']=_[_0x2e21('0x48')](db[_0x2e21('0x4e')]['rawAttributes']);_0x5d4f78['query']=_[_0x2e21('0x48')](_0x5d2093['query']);_0x5d4f78['filters']=_[_0x2e21('0x35')](_0x5d4f78['model'],_0x5d4f78[_0x2e21('0x33')]);_0x3ec0a6['attributes']=_[_0x2e21('0x35')](_0x5d4f78[_0x2e21('0x36')],qs[_0x2e21('0x38')](_0x5d2093[_0x2e21('0x33')]['fields']));_0x3ec0a6['attributes']=_0x3ec0a6[_0x2e21('0x37')][_0x2e21('0x49')]?_0x3ec0a6[_0x2e21('0x37')]:_0x5d4f78[_0x2e21('0x36')];_0x3ec0a6[_0x2e21('0x3b')]=qs[_0x2e21('0x3c')](_0x5d2093[_0x2e21('0x33')][_0x2e21('0x3c')]);_0x3ec0a6['where']=qs[_0x2e21('0x34')](_['pick'](_0x5d2093[_0x2e21('0x33')],_0x5d4f78[_0x2e21('0x34')]));if(_0x5d2093[_0x2e21('0x33')][_0x2e21('0x3f')]){_0x3ec0a6[_0x2e21('0x3d')]=_[_0x2e21('0x40')](_0x3ec0a6[_0x2e21('0x3d')],{'$or':_[_0x2e21('0x32')](_0x3ec0a6['attributes'],function(_0x4e51de){var _0x4a07c0={};_0x4a07c0[_0x4e51de]={'$like':'%'+_0x5d2093['query'][_0x2e21('0x3f')]+'%'};return _0x4a07c0;})});}_0x3ec0a6=_[_0x2e21('0x40')]({},_0x3ec0a6,_0x5d2093[_0x2e21('0x41')]);return _0x122675['getConditions'](_0x3ec0a6);}})['then'](function(_0x116744){if(_0x116744){_0x4d7708=_0x116744[_0x2e21('0x49')];if(!_0x5d2093[_0x2e21('0x33')][_0x2e21('0x39')](_0x2e21('0x3a'))){_0x3ec0a6[_0x2e21('0x20')]=qs[_0x2e21('0x20')](_0x5d2093[_0x2e21('0x33')][_0x2e21('0x20')]);_0x3ec0a6[_0x2e21('0x1e')]=qs['offset'](_0x5d2093[_0x2e21('0x33')]['offset']);}return _0x122675[_0x2e21('0x51')](_0x3ec0a6);}})[_0x2e21('0x27')](function(_0x46e4da){if(_0x46e4da){return _0x46e4da?{'count':_0x4d7708,'rows':_0x46e4da}:null;}})[_0x2e21('0x27')](respondWithResult(_0x572b64,null))[_0x2e21('0x45')](handleError(_0x572b64,null));};exports['addActions']=function(_0x3ad686,_0x32ddc6,_0x142718){return db[_0x2e21('0x53')]['find']({'where':{'id':_0x3ad686[_0x2e21('0x47')]['id']}})[_0x2e21('0x27')](handleEntityNotFound(_0x32ddc6,null))[_0x2e21('0x27')](function(_0x3c1019){if(_0x3c1019){return _0x3c1019[_0x2e21('0x54')](_0x3ad686[_0x2e21('0x4b')][_0x2e21('0x4f')],_[_0x2e21('0x50')](_0x3ad686['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x32ddc6,null))[_0x2e21('0x45')](handleError(_0x32ddc6,null));};exports[_0x2e21('0x55')]=function(_0x25a26b,_0xb25d0a,_0x576784){var _0x40a04a={};var _0x3f61b7={};var _0x2c348f;var _0x435087;return db[_0x2e21('0x2d')][_0x2e21('0x52')]({'where':{'id':_0x25a26b[_0x2e21('0x47')]['id']}})['then'](handleEntityNotFound(_0xb25d0a,null))[_0x2e21('0x27')](function(_0x1193db){if(_0x1193db){_0x2c348f=_0x1193db;_0x3f61b7['model']=_[_0x2e21('0x48')](db[_0x2e21('0x53')]['rawAttributes']);_0x3f61b7[_0x2e21('0x33')]=_['keys'](_0x25a26b[_0x2e21('0x33')]);_0x3f61b7['filters']=_['intersection'](_0x3f61b7['model'],_0x3f61b7[_0x2e21('0x33')]);_0x40a04a[_0x2e21('0x37')]=_['intersection'](_0x3f61b7[_0x2e21('0x36')],qs['fields'](_0x25a26b[_0x2e21('0x33')][_0x2e21('0x38')]));_0x40a04a[_0x2e21('0x37')]=_0x40a04a[_0x2e21('0x37')][_0x2e21('0x49')]?_0x40a04a[_0x2e21('0x37')]:_0x3f61b7[_0x2e21('0x36')];_0x40a04a[_0x2e21('0x3b')]=qs[_0x2e21('0x3c')](_0x25a26b['query'][_0x2e21('0x3c')]);_0x40a04a[_0x2e21('0x3d')]=qs['filters'](_[_0x2e21('0x3e')](_0x25a26b[_0x2e21('0x33')],_0x3f61b7['filters']));if(_0x25a26b['query']['filter']){_0x40a04a[_0x2e21('0x3d')]=_[_0x2e21('0x40')](_0x40a04a['where'],{'$or':_['map'](_0x40a04a['attributes'],function(_0x50d024){var _0x272d0b={};_0x272d0b[_0x50d024]={'$like':'%'+_0x25a26b[_0x2e21('0x33')][_0x2e21('0x3f')]+'%'};return _0x272d0b;})});}_0x40a04a=_[_0x2e21('0x40')]({},_0x40a04a,_0x25a26b[_0x2e21('0x41')]);return _0x2c348f[_0x2e21('0x55')](_0x40a04a);}})[_0x2e21('0x27')](function(_0x2e8520){if(_0x2e8520){_0x435087=_0x2e8520[_0x2e21('0x49')];if(!_0x25a26b[_0x2e21('0x33')][_0x2e21('0x39')]('nolimit')){_0x40a04a[_0x2e21('0x20')]=qs[_0x2e21('0x20')](_0x25a26b[_0x2e21('0x33')][_0x2e21('0x20')]);_0x40a04a[_0x2e21('0x1e')]=qs['offset'](_0x25a26b[_0x2e21('0x33')]['offset']);}return _0x2c348f[_0x2e21('0x55')](_0x40a04a);}})[_0x2e21('0x27')](function(_0x50fd74){if(_0x50fd74){return _0x50fd74?{'count':_0x435087,'rows':_0x50fd74}:null;}})[_0x2e21('0x27')](respondWithResult(_0xb25d0a,null))[_0x2e21('0x45')](handleError(_0xb25d0a,null));}; \ No newline at end of file +var _0x4040=['filter','where','merge','options','include','findAll','rows','catch','show','params','includeAll','create','body','find','addConditions','Condition','ids','omit','getConditions','addActions','Action','getActions','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','set','Content-Range','save','update','then','destroy','end','stack','name','send','Automation','rawAttributes','type','key','model','map','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filters'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4040,0x1ba));var _0x0404=function(_0x470ed3,_0x239cdd){_0x470ed3=_0x470ed3-0x0;var _0x297913=_0x4040[_0x470ed3];return _0x297913;};'use strict';var emlformat=require(_0x0404('0x0'));var rimraf=require(_0x0404('0x1'));var zipdir=require(_0x0404('0x2'));var jsonpatch=require(_0x0404('0x3'));var rp=require('request-promise');var moment=require(_0x0404('0x4'));var BPromise=require(_0x0404('0x5'));var Mustache=require(_0x0404('0x6'));var util=require(_0x0404('0x7'));var path=require(_0x0404('0x8'));var sox=require(_0x0404('0x9'));var csv=require(_0x0404('0xa'));var ejs=require(_0x0404('0xb'));var fs=require('fs');var fs_extra=require(_0x0404('0xc'));var _=require(_0x0404('0xd'));var squel=require(_0x0404('0xe'));var crypto=require(_0x0404('0xf'));var jsforce=require(_0x0404('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x0404('0xa'));var querystring=require(_0x0404('0x11'));var Papa=require(_0x0404('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x0404('0x13'));var as=require(_0x0404('0x14'));var hardwareService=require(_0x0404('0x15'));var logger=require('../../config/logger')(_0x0404('0x16'));var utils=require(_0x0404('0x17'));var config=require(_0x0404('0x18'));var licenseUtil=require(_0x0404('0x19'));var db=require(_0x0404('0x1a'))['db'];function respondWithStatusCode(_0x5bdb03,_0x5aa70f){_0x5aa70f=_0x5aa70f||0xcc;return function(_0x26bbfe){if(_0x26bbfe){return _0x5bdb03[_0x0404('0x1b')](_0x5aa70f);}return _0x5bdb03[_0x0404('0x1c')](_0x5aa70f)['end']();};}function respondWithResult(_0x59490b,_0x169896){_0x169896=_0x169896||0xc8;return function(_0x5ed89c){if(_0x5ed89c){return _0x59490b[_0x0404('0x1c')](_0x169896)[_0x0404('0x1d')](_0x5ed89c);}};}function respondWithFilteredResult(_0x18107b,_0x11b2a9){return function(_0x3cc56b){if(_0x3cc56b){var _0x116d2a=typeof _0x11b2a9['offset']===_0x0404('0x1e')&&typeof _0x11b2a9['limit']===_0x0404('0x1e');var _0x3c1bc2=_0x3cc56b[_0x0404('0x1f')];var _0x395df7=_0x116d2a?0x0:_0x11b2a9['offset'];var _0x52d37e=_0x116d2a?_0x3cc56b[_0x0404('0x1f')]:_0x11b2a9[_0x0404('0x20')]+_0x11b2a9['limit'];var _0x14ad1e;if(_0x52d37e>=_0x3c1bc2){_0x52d37e=_0x3c1bc2;_0x14ad1e=0xc8;}else{_0x14ad1e=0xce;}_0x18107b[_0x0404('0x1c')](_0x14ad1e);return _0x18107b[_0x0404('0x21')](_0x0404('0x22'),_0x395df7+'-'+_0x52d37e+'/'+_0x3c1bc2)['json'](_0x3cc56b);}return null;};}function patchUpdates(_0x3f08ab){return function(_0x3257df){try{jsonpatch['apply'](_0x3257df,_0x3f08ab,!![]);}catch(_0x22b419){return BPromise['reject'](_0x22b419);}return _0x3257df[_0x0404('0x23')]();};}function saveUpdates(_0x185fd5,_0x241a6d){return function(_0x3c0f9c){if(_0x3c0f9c){return _0x3c0f9c[_0x0404('0x24')](_0x185fd5)[_0x0404('0x25')](function(_0x5e6c26){return _0x5e6c26;});}return null;};}function removeEntity(_0x5aaaa0,_0x152b55){return function(_0x2736fd){if(_0x2736fd){return _0x2736fd[_0x0404('0x26')]()[_0x0404('0x25')](function(){_0x5aaaa0[_0x0404('0x1c')](0xcc)[_0x0404('0x27')]();});}};}function handleEntityNotFound(_0x5a45ce,_0x53f1df){return function(_0x2f3fa5){if(!_0x2f3fa5){_0x5a45ce[_0x0404('0x1b')](0x194);}return _0x2f3fa5;};}function handleError(_0xb2176c,_0x10f5df){_0x10f5df=_0x10f5df||0x1f4;return function(_0x58154d){logger['error'](_0x58154d[_0x0404('0x28')]);if(_0x58154d[_0x0404('0x29')]){delete _0x58154d[_0x0404('0x29')];}_0xb2176c[_0x0404('0x1c')](_0x10f5df)[_0x0404('0x2a')](_0x58154d);};}exports['index']=function(_0x338d71,_0x91b50f){var _0x28a3f4={},_0x260845={},_0x214d85={'count':0x0,'rows':[]};var _0x2ba933=_['map'](db[_0x0404('0x2b')][_0x0404('0x2c')],function(_0x23eaa3){return{'name':_0x23eaa3['fieldName'],'type':_0x23eaa3[_0x0404('0x2d')][_0x0404('0x2e')]};});_0x260845[_0x0404('0x2f')]=_[_0x0404('0x30')](_0x2ba933,_0x0404('0x29'));_0x260845[_0x0404('0x31')]=_[_0x0404('0x32')](_0x338d71[_0x0404('0x31')]);_0x260845['filters']=_['intersection'](_0x260845[_0x0404('0x2f')],_0x260845[_0x0404('0x31')]);_0x28a3f4[_0x0404('0x33')]=_[_0x0404('0x34')](_0x260845['model'],qs[_0x0404('0x35')](_0x338d71[_0x0404('0x31')][_0x0404('0x35')]));_0x28a3f4['attributes']=_0x28a3f4[_0x0404('0x33')][_0x0404('0x36')]?_0x28a3f4[_0x0404('0x33')]:_0x260845[_0x0404('0x2f')];if(!_0x338d71[_0x0404('0x31')][_0x0404('0x37')](_0x0404('0x38'))){_0x28a3f4[_0x0404('0x39')]=qs[_0x0404('0x39')](_0x338d71[_0x0404('0x31')][_0x0404('0x39')]);_0x28a3f4[_0x0404('0x20')]=qs[_0x0404('0x20')](_0x338d71[_0x0404('0x31')]['offset']);}_0x28a3f4[_0x0404('0x3a')]=qs[_0x0404('0x3b')](_0x338d71[_0x0404('0x31')][_0x0404('0x3b')]);_0x28a3f4['where']=qs['filters'](_[_0x0404('0x3c')](_0x338d71['query'],_0x260845[_0x0404('0x3d')]),_0x2ba933);if(_0x338d71['query'][_0x0404('0x3e')]){_0x28a3f4[_0x0404('0x3f')]=_[_0x0404('0x40')](_0x28a3f4[_0x0404('0x3f')],{'$or':_[_0x0404('0x30')](_0x2ba933,function(_0x447172){if(_0x447172[_0x0404('0x2d')]!=='VIRTUAL'){var _0x49968f={};_0x49968f[_0x447172[_0x0404('0x29')]]={'$like':'%'+_0x338d71['query'][_0x0404('0x3e')]+'%'};return _0x49968f;}})});}_0x28a3f4=_[_0x0404('0x40')]({},_0x28a3f4,_0x338d71[_0x0404('0x41')]);var _0x166590={'where':_0x28a3f4[_0x0404('0x3f')]};return db[_0x0404('0x2b')]['count'](_0x166590)[_0x0404('0x25')](function(_0x4e5c93){_0x214d85['count']=_0x4e5c93;if(_0x338d71[_0x0404('0x31')]['includeAll']){_0x28a3f4[_0x0404('0x42')]=[{'all':!![]}];}return db[_0x0404('0x2b')][_0x0404('0x43')](_0x28a3f4);})[_0x0404('0x25')](function(_0x188fda){_0x214d85[_0x0404('0x44')]=_0x188fda;return _0x214d85;})[_0x0404('0x25')](respondWithFilteredResult(_0x91b50f,_0x28a3f4))[_0x0404('0x45')](handleError(_0x91b50f,null));};exports[_0x0404('0x46')]=function(_0x52f14e,_0x5c3c91){var _0xf00f0a={'raw':![],'where':{'id':_0x52f14e[_0x0404('0x47')]['id']}},_0x3f56de={};_0x3f56de['model']=_[_0x0404('0x32')](db['Automation'][_0x0404('0x2c')]);_0x3f56de[_0x0404('0x31')]=_[_0x0404('0x32')](_0x52f14e[_0x0404('0x31')]);_0x3f56de['filters']=_[_0x0404('0x34')](_0x3f56de[_0x0404('0x2f')],_0x3f56de[_0x0404('0x31')]);_0xf00f0a['attributes']=_[_0x0404('0x34')](_0x3f56de[_0x0404('0x2f')],qs['fields'](_0x52f14e[_0x0404('0x31')]['fields']));_0xf00f0a['attributes']=_0xf00f0a[_0x0404('0x33')][_0x0404('0x36')]?_0xf00f0a[_0x0404('0x33')]:_0x3f56de[_0x0404('0x2f')];if(_0x52f14e['query'][_0x0404('0x48')]){_0xf00f0a[_0x0404('0x42')]=[{'all':!![]}];}_0xf00f0a=_[_0x0404('0x40')]({},_0xf00f0a,_0x52f14e['options']);return db[_0x0404('0x2b')]['find'](_0xf00f0a)[_0x0404('0x25')](handleEntityNotFound(_0x5c3c91,null))['then'](respondWithResult(_0x5c3c91,null))[_0x0404('0x45')](handleError(_0x5c3c91,null));};exports[_0x0404('0x49')]=function(_0x402f82,_0x407a5d){return db[_0x0404('0x2b')][_0x0404('0x49')](_0x402f82[_0x0404('0x4a')],{})[_0x0404('0x25')](respondWithResult(_0x407a5d,0xc9))['catch'](handleError(_0x407a5d,null));};exports[_0x0404('0x24')]=function(_0x3e62ba,_0x4e3b47){if(_0x3e62ba[_0x0404('0x4a')]['id']){delete _0x3e62ba['body']['id'];}return db[_0x0404('0x2b')]['find']({'where':{'id':_0x3e62ba['params']['id']}})[_0x0404('0x25')](handleEntityNotFound(_0x4e3b47,null))[_0x0404('0x25')](saveUpdates(_0x3e62ba[_0x0404('0x4a')],null))[_0x0404('0x25')](respondWithResult(_0x4e3b47,null))[_0x0404('0x45')](handleError(_0x4e3b47,null));};exports[_0x0404('0x26')]=function(_0x1c2b5e,_0x58a67e){return db[_0x0404('0x2b')][_0x0404('0x4b')]({'where':{'id':_0x1c2b5e[_0x0404('0x47')]['id']}})[_0x0404('0x25')](handleEntityNotFound(_0x58a67e,null))[_0x0404('0x25')](removeEntity(_0x58a67e,null))['catch'](handleError(_0x58a67e,null));};exports[_0x0404('0x4c')]=function(_0x46ab76,_0x57bdb3,_0x159862){return db[_0x0404('0x4d')][_0x0404('0x4b')]({'where':{'id':_0x46ab76[_0x0404('0x47')]['id']}})[_0x0404('0x25')](handleEntityNotFound(_0x57bdb3,null))['then'](function(_0x5ca9ab){if(_0x5ca9ab){return _0x5ca9ab[_0x0404('0x4c')](_0x46ab76[_0x0404('0x4a')][_0x0404('0x4e')],_[_0x0404('0x4f')](_0x46ab76[_0x0404('0x4a')],[_0x0404('0x4e'),'id'])||{});}})['then'](respondWithResult(_0x57bdb3,null))[_0x0404('0x45')](handleError(_0x57bdb3,null));};exports['getConditions']=function(_0x459cc1,_0x5051ca,_0x25f908){var _0x288eb2={};var _0x109d42={};var _0x49cad7;var _0x5246f4;return db[_0x0404('0x2b')]['findOne']({'where':{'id':_0x459cc1[_0x0404('0x47')]['id']}})[_0x0404('0x25')](handleEntityNotFound(_0x5051ca,null))[_0x0404('0x25')](function(_0x4dc68a){if(_0x4dc68a){_0x49cad7=_0x4dc68a;_0x109d42[_0x0404('0x2f')]=_[_0x0404('0x32')](db[_0x0404('0x4d')]['rawAttributes']);_0x109d42['query']=_[_0x0404('0x32')](_0x459cc1[_0x0404('0x31')]);_0x109d42[_0x0404('0x3d')]=_[_0x0404('0x34')](_0x109d42[_0x0404('0x2f')],_0x109d42[_0x0404('0x31')]);_0x288eb2['attributes']=_['intersection'](_0x109d42['model'],qs['fields'](_0x459cc1[_0x0404('0x31')]['fields']));_0x288eb2[_0x0404('0x33')]=_0x288eb2[_0x0404('0x33')]['length']?_0x288eb2[_0x0404('0x33')]:_0x109d42[_0x0404('0x2f')];_0x288eb2[_0x0404('0x3a')]=qs[_0x0404('0x3b')](_0x459cc1[_0x0404('0x31')][_0x0404('0x3b')]);_0x288eb2[_0x0404('0x3f')]=qs[_0x0404('0x3d')](_[_0x0404('0x3c')](_0x459cc1['query'],_0x109d42[_0x0404('0x3d')]));if(_0x459cc1[_0x0404('0x31')][_0x0404('0x3e')]){_0x288eb2[_0x0404('0x3f')]=_[_0x0404('0x40')](_0x288eb2[_0x0404('0x3f')],{'$or':_[_0x0404('0x30')](_0x288eb2['attributes'],function(_0x1854f3){var _0x5be71d={};_0x5be71d[_0x1854f3]={'$like':'%'+_0x459cc1[_0x0404('0x31')][_0x0404('0x3e')]+'%'};return _0x5be71d;})});}_0x288eb2=_[_0x0404('0x40')]({},_0x288eb2,_0x459cc1[_0x0404('0x41')]);return _0x49cad7[_0x0404('0x50')](_0x288eb2);}})['then'](function(_0x1c98fd){if(_0x1c98fd){_0x5246f4=_0x1c98fd[_0x0404('0x36')];if(!_0x459cc1[_0x0404('0x31')]['hasOwnProperty'](_0x0404('0x38'))){_0x288eb2['limit']=qs['limit'](_0x459cc1[_0x0404('0x31')][_0x0404('0x39')]);_0x288eb2['offset']=qs['offset'](_0x459cc1[_0x0404('0x31')][_0x0404('0x20')]);}return _0x49cad7[_0x0404('0x50')](_0x288eb2);}})['then'](function(_0x553526){if(_0x553526){return _0x553526?{'count':_0x5246f4,'rows':_0x553526}:null;}})[_0x0404('0x25')](respondWithResult(_0x5051ca,null))[_0x0404('0x45')](handleError(_0x5051ca,null));};exports[_0x0404('0x51')]=function(_0x3e6b6e,_0x1d9c8b,_0x22c9ce){return db[_0x0404('0x52')][_0x0404('0x4b')]({'where':{'id':_0x3e6b6e[_0x0404('0x47')]['id']}})[_0x0404('0x25')](handleEntityNotFound(_0x1d9c8b,null))['then'](function(_0x5d488c){if(_0x5d488c){return _0x5d488c['addActions'](_0x3e6b6e[_0x0404('0x4a')][_0x0404('0x4e')],_[_0x0404('0x4f')](_0x3e6b6e[_0x0404('0x4a')],[_0x0404('0x4e'),'id'])||{});}})['then'](respondWithResult(_0x1d9c8b,null))[_0x0404('0x45')](handleError(_0x1d9c8b,null));};exports[_0x0404('0x53')]=function(_0x1e611e,_0x4f8e9,_0x40c478){var _0xccb4b1={};var _0x153db6={};var _0x17106e;var _0x2f9b10;return db[_0x0404('0x2b')]['findOne']({'where':{'id':_0x1e611e[_0x0404('0x47')]['id']}})['then'](handleEntityNotFound(_0x4f8e9,null))[_0x0404('0x25')](function(_0x6585ea){if(_0x6585ea){_0x17106e=_0x6585ea;_0x153db6[_0x0404('0x2f')]=_['keys'](db['Action']['rawAttributes']);_0x153db6[_0x0404('0x31')]=_[_0x0404('0x32')](_0x1e611e[_0x0404('0x31')]);_0x153db6[_0x0404('0x3d')]=_['intersection'](_0x153db6[_0x0404('0x2f')],_0x153db6[_0x0404('0x31')]);_0xccb4b1['attributes']=_[_0x0404('0x34')](_0x153db6[_0x0404('0x2f')],qs['fields'](_0x1e611e[_0x0404('0x31')][_0x0404('0x35')]));_0xccb4b1[_0x0404('0x33')]=_0xccb4b1[_0x0404('0x33')][_0x0404('0x36')]?_0xccb4b1[_0x0404('0x33')]:_0x153db6['model'];_0xccb4b1[_0x0404('0x3a')]=qs['sort'](_0x1e611e[_0x0404('0x31')][_0x0404('0x3b')]);_0xccb4b1[_0x0404('0x3f')]=qs[_0x0404('0x3d')](_[_0x0404('0x3c')](_0x1e611e['query'],_0x153db6['filters']));if(_0x1e611e[_0x0404('0x31')][_0x0404('0x3e')]){_0xccb4b1[_0x0404('0x3f')]=_[_0x0404('0x40')](_0xccb4b1[_0x0404('0x3f')],{'$or':_[_0x0404('0x30')](_0xccb4b1[_0x0404('0x33')],function(_0xec98f1){var _0x5e461e={};_0x5e461e[_0xec98f1]={'$like':'%'+_0x1e611e['query'][_0x0404('0x3e')]+'%'};return _0x5e461e;})});}_0xccb4b1=_['merge']({},_0xccb4b1,_0x1e611e[_0x0404('0x41')]);return _0x17106e[_0x0404('0x53')](_0xccb4b1);}})[_0x0404('0x25')](function(_0x3629ed){if(_0x3629ed){_0x2f9b10=_0x3629ed['length'];if(!_0x1e611e[_0x0404('0x31')][_0x0404('0x37')]('nolimit')){_0xccb4b1[_0x0404('0x39')]=qs[_0x0404('0x39')](_0x1e611e[_0x0404('0x31')]['limit']);_0xccb4b1[_0x0404('0x20')]=qs['offset'](_0x1e611e[_0x0404('0x31')]['offset']);}return _0x17106e['getActions'](_0xccb4b1);}})[_0x0404('0x25')](function(_0x2ee864){if(_0x2ee864){return _0x2ee864?{'count':_0x2f9b10,'rows':_0x2ee864}:null;}})[_0x0404('0x25')](respondWithResult(_0x4f8e9,null))['catch'](handleError(_0x4f8e9,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 0082d48..2cec904 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 _0xfb2d=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./automation.attributes','exports','define','tools_automations','lodash'];(function(_0x4a9f9b,_0x5508a4){var _0xd3031=function(_0x53410d){while(--_0x53410d){_0x4a9f9b['push'](_0x4a9f9b['shift']());}};_0xd3031(++_0x5508a4);}(_0xfb2d,0xdc));var _0xdfb2=function(_0x5e3701,_0x596265){_0x5e3701=_0x5e3701-0x0;var _0x345dcf=_0xfb2d[_0x5e3701];return _0x345dcf;};'use strict';var _=require(_0xdfb2('0x0'));var util=require(_0xdfb2('0x1'));var logger=require(_0xdfb2('0x2'))(_0xdfb2('0x3'));var moment=require('moment');var BPromise=require(_0xdfb2('0x4'));var rp=require(_0xdfb2('0x5'));var fs=require('fs');var path=require(_0xdfb2('0x6'));var rimraf=require(_0xdfb2('0x7'));var config=require(_0xdfb2('0x8'));var attributes=require(_0xdfb2('0x9'));module[_0xdfb2('0xa')]=function(_0x20213a,_0x40fa91){return _0x20213a[_0xdfb2('0xb')]('Automation',attributes,{'tableName':_0xdfb2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa15d=['rimraf','../../config/environment','./automation.attributes','exports','Automation','tools_automations','util','moment','bluebird','request-promise','path'];(function(_0x691a6c,_0x2fd078){var _0x70d560=function(_0x54b2d8){while(--_0x54b2d8){_0x691a6c['push'](_0x691a6c['shift']());}};_0x70d560(++_0x2fd078);}(_0xa15d,0xf8));var _0xda15=function(_0x4a93bb,_0x495404){_0x4a93bb=_0x4a93bb-0x0;var _0x208468=_0xa15d[_0x4a93bb];return _0x208468;};'use strict';var _=require('lodash');var util=require(_0xda15('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xda15('0x1'));var BPromise=require(_0xda15('0x2'));var rp=require(_0xda15('0x3'));var fs=require('fs');var path=require(_0xda15('0x4'));var rimraf=require(_0xda15('0x5'));var config=require(_0xda15('0x6'));var attributes=require(_0xda15('0x7'));module[_0xda15('0x8')]=function(_0x42f384,_0x39d090){return _0x42f384['define'](_0xda15('0x9'),attributes,{'tableName':_0xda15('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/automation/automation.rpc.js b/server/api/automation/automation.rpc.js index ff1efb5..384c5b9 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 _0xe486=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','then','info','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','error','Automation,\x20%s,\x20%s','message','result'];(function(_0x53fa45,_0x3b9ed9){var _0x563bb2=function(_0x463a25){while(--_0x463a25){_0x53fa45['push'](_0x53fa45['shift']());}};_0x563bb2(++_0x3b9ed9);}(_0xe486,0x6a));var _0x6e48=function(_0x110e11,_0x2386fb){_0x110e11=_0x110e11-0x0;var _0x16d509=_0xe486[_0x110e11];return _0x16d509;};'use strict';var _=require(_0x6e48('0x0'));var util=require(_0x6e48('0x1'));var moment=require(_0x6e48('0x2'));var BPromise=require(_0x6e48('0x3'));var rs=require(_0x6e48('0x4'));var fs=require('fs');var Redis=require(_0x6e48('0x5'));var db=require(_0x6e48('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x6e48('0x7'));var config=require(_0x6e48('0x8'));var jayson=require(_0x6e48('0x9'));var client=jayson[_0x6e48('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1ea941,_0x2dc190,_0x23d274){return new BPromise(function(_0x1aaa9e,_0x3d392e){return client['request'](_0x1ea941,_0x23d274)[_0x6e48('0xb')](function(_0x5d1b90){logger[_0x6e48('0xc')]('Automation,\x20%s,\x20%s',_0x2dc190,_0x6e48('0xd'));logger[_0x6e48('0xe')](_0x6e48('0xf'),_0x2dc190,_0x6e48('0xd'),JSON['stringify'](_0x5d1b90));if(_0x5d1b90[_0x6e48('0x10')]){if(_0x5d1b90['error']['code']===0x1f4){logger[_0x6e48('0x10')](_0x6e48('0x11'),_0x2dc190,_0x5d1b90[_0x6e48('0x10')][_0x6e48('0x12')]);return _0x3d392e(_0x5d1b90['error'][_0x6e48('0x12')]);}logger[_0x6e48('0x10')](_0x6e48('0x11'),_0x2dc190,_0x5d1b90[_0x6e48('0x10')][_0x6e48('0x12')]);return _0x1aaa9e(_0x5d1b90[_0x6e48('0x10')][_0x6e48('0x12')]);}else{logger[_0x6e48('0xc')](_0x6e48('0x11'),_0x2dc190,'request\x20sent');_0x1aaa9e(_0x5d1b90[_0x6e48('0x13')][_0x6e48('0x12')]);}})[_0x6e48('0x14')](function(_0x2ca234){logger['error'](_0x6e48('0x11'),_0x2dc190,_0x2ca234);_0x3d392e(_0x2ca234);});});} \ No newline at end of file +var _0xc274=['../../config/logger','rpc','jayson/promise','http','then','info','Automation,\x20%s,\x20%s','request\x20sent','Automation,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x1c0814,_0xd84796){var _0x4e2bd9=function(_0x4d53cc){while(--_0x4d53cc){_0x1c0814['push'](_0x1c0814['shift']());}};_0x4e2bd9(++_0xd84796);}(_0xc274,0x151));var _0x4c27=function(_0x34d7ec,_0x5abd13){_0x34d7ec=_0x34d7ec-0x0;var _0x5cdb4e=_0xc274[_0x34d7ec];return _0x5cdb4e;};'use strict';var _=require('lodash');var util=require(_0x4c27('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4c27('0x1'));var fs=require('fs');var Redis=require(_0x4c27('0x2'));var db=require(_0x4c27('0x3'))['db'];var utils=require(_0x4c27('0x4'));var logger=require(_0x4c27('0x5'))(_0x4c27('0x6'));var config=require('../../config/environment');var jayson=require(_0x4c27('0x7'));var client=jayson['client'][_0x4c27('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x18fd2c,_0x38de2d,_0x5f5058){return new BPromise(function(_0x478a91,_0x36daa2){return client['request'](_0x18fd2c,_0x5f5058)[_0x4c27('0x9')](function(_0x2a0c76){logger[_0x4c27('0xa')](_0x4c27('0xb'),_0x38de2d,_0x4c27('0xc'));logger['debug'](_0x4c27('0xd'),_0x38de2d,_0x4c27('0xc'),JSON[_0x4c27('0xe')](_0x2a0c76));if(_0x2a0c76[_0x4c27('0xf')]){if(_0x2a0c76['error']['code']===0x1f4){logger[_0x4c27('0xf')](_0x4c27('0xb'),_0x38de2d,_0x2a0c76['error']['message']);return _0x36daa2(_0x2a0c76[_0x4c27('0xf')][_0x4c27('0x10')]);}logger[_0x4c27('0xf')]('Automation,\x20%s,\x20%s',_0x38de2d,_0x2a0c76[_0x4c27('0xf')][_0x4c27('0x10')]);return _0x478a91(_0x2a0c76[_0x4c27('0xf')]['message']);}else{logger[_0x4c27('0xa')]('Automation,\x20%s,\x20%s',_0x38de2d,'request\x20sent');_0x478a91(_0x2a0c76[_0x4c27('0x11')][_0x4c27('0x10')]);}})[_0x4c27('0x12')](function(_0x4762ad){logger['error'](_0x4c27('0xb'),_0x38de2d,_0x4762ad);_0x36daa2(_0x4762ad);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 623634e..6bc8775 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 _0x45c9=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/conditions','getConditions','/:id/actions','getActions','post','create','addConditions','addActions','put','update','delete','destroy','exports'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x45c9,0x96));var _0x945c=function(_0x396d2d,_0x2ec527){_0x396d2d=_0x396d2d-0x0;var _0x1b8d37=_0x45c9[_0x396d2d];return _0x1b8d37;};'use strict';var multer=require('multer');var util=require(_0x945c('0x0'));var path=require('path');var timeout=require(_0x945c('0x1'));var express=require(_0x945c('0x2'));var router=express[_0x945c('0x3')]();var fs_extra=require(_0x945c('0x4'));var auth=require(_0x945c('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x945c('0x6'));var controller=require('./automation.controller');router[_0x945c('0x7')]('/',auth[_0x945c('0x8')](),controller[_0x945c('0x9')]);router[_0x945c('0x7')](_0x945c('0xa'),auth[_0x945c('0x8')](),controller[_0x945c('0xb')]);router['get'](_0x945c('0xc'),auth['isAuthenticated'](),controller[_0x945c('0xd')]);router['get'](_0x945c('0xe'),auth['isAuthenticated'](),controller[_0x945c('0xf')]);router[_0x945c('0x10')]('/',auth[_0x945c('0x8')](),controller[_0x945c('0x11')]);router[_0x945c('0x10')](_0x945c('0xc'),auth[_0x945c('0x8')](),controller[_0x945c('0x12')]);router[_0x945c('0x10')](_0x945c('0xe'),auth[_0x945c('0x8')](),controller[_0x945c('0x13')]);router[_0x945c('0x14')](_0x945c('0xa'),auth['isAuthenticated'](),controller[_0x945c('0x15')]);router[_0x945c('0x16')](_0x945c('0xa'),auth[_0x945c('0x8')](),controller[_0x945c('0x17')]);module[_0x945c('0x18')]=router; \ No newline at end of file +var _0x55e0=['isAuthenticated','show','/:id/conditions','/:id/actions','getActions','post','addConditions','addActions','put','update','delete','/:id','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','get'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0x55e0,0xdc));var _0x055e=function(_0x560fc6,_0x59bd68){_0x560fc6=_0x560fc6-0x0;var _0x14d08a=_0x55e0[_0x560fc6];return _0x14d08a;};'use strict';var multer=require(_0x055e('0x0'));var util=require(_0x055e('0x1'));var path=require(_0x055e('0x2'));var timeout=require(_0x055e('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x055e('0x4'));var auth=require(_0x055e('0x5'));var interaction=require(_0x055e('0x6'));var config=require(_0x055e('0x7'));var controller=require(_0x055e('0x8'));router[_0x055e('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x055e('0x9')]('/:id',auth[_0x055e('0xa')](),controller[_0x055e('0xb')]);router[_0x055e('0x9')](_0x055e('0xc'),auth[_0x055e('0xa')](),controller['getConditions']);router[_0x055e('0x9')](_0x055e('0xd'),auth[_0x055e('0xa')](),controller[_0x055e('0xe')]);router[_0x055e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x055e('0xf')]('/:id/conditions',auth[_0x055e('0xa')](),controller[_0x055e('0x10')]);router[_0x055e('0xf')](_0x055e('0xd'),auth[_0x055e('0xa')](),controller[_0x055e('0x11')]);router[_0x055e('0x12')]('/:id',auth[_0x055e('0xa')](),controller[_0x055e('0x13')]);router[_0x055e('0x14')](_0x055e('0x15'),auth[_0x055e('0xa')](),controller['destroy']);module[_0x055e('0x16')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 6c17ac2..e523a90 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 _0x3748=['#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','ASC','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','sequelize','exports','STRING','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\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)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Between\x20Words\x20Silence'];(function(_0x92fd77,_0x5a1e8a){var _0x492476=function(_0x57f4e9){while(--_0x57f4e9){_0x92fd77['push'](_0x92fd77['shift']());}};_0x492476(++_0x5a1e8a);}(_0x3748,0x12d));var _0x8374=function(_0x519abb,_0x4d3f5b){_0x519abb=_0x519abb-0x0;var _0x48d4d6=_0x3748[_0x519abb];return _0x48d4d6;};'use strict';var Sequelize=require(_0x8374('0x0'));module[_0x8374('0x1')]={'name':{'type':Sequelize[_0x8374('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x8374('0x3')](_0x8374('0x4')),'allowNull':![],'defaultValue':_0x8374('0x4')},'description':{'type':Sequelize[_0x8374('0x2')]},'active':{'type':Sequelize[_0x8374('0x5')],'defaultValue':0x0,'comment':_0x8374('0x6')},'limitCalls':{'type':Sequelize[_0x8374('0x7')](0x4)[_0x8374('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x8374('0x9')},'dialOriginateCallerIdName':{'type':Sequelize[_0x8374('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x8374('0x7')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8374('0xa')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x8374('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0x8374('0x7')](0x5)[_0x8374('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8374('0xb')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x8374('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8374('0xc')},'dialBusyRetryFrequency':{'type':Sequelize[_0x8374('0x7')](0x5)[_0x8374('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8374('0xd')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x8374('0x7')](0x3)[_0x8374('0x8')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x8374('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0x8374('0x7')](0x3)[_0x8374('0x8')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x8374('0xe')},'dialTimezone':{'type':Sequelize[_0x8374('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x8374('0x2')],'defaultValue':_0x8374('0xf')},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x8374('0x10'),_0x8374('0x11'),'onlyIfOpen'),'defaultValue':_0x8374('0x10')},'dialAMDActive':{'type':Sequelize[_0x8374('0x5')],'defaultValue':0x0,'comment':_0x8374('0x12')},'dialAMDInitialSilence':{'type':Sequelize[_0x8374('0x7')](0x9)[_0x8374('0x8')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x8374('0x13')},'dialAMDGreeting':{'type':Sequelize[_0x8374('0x7')](0x9)[_0x8374('0x8')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x8374('0x14')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x8374('0x7')](0x9)[_0x8374('0x8')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x8374('0x15')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x8374('0x7')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x8374('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x8374('0x7')](0x9)[_0x8374('0x8')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x8374('0x16')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x8374('0x8')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x8374('0x17')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x8374('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x8374('0x18')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x8374('0x7')](0x9)[_0x8374('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x8374('0x19')},'dialOrderByScheduledAt':{'type':Sequelize[_0x8374('0x3')]('DESC',_0x8374('0x1a')),'defaultValue':_0x8374('0x1b')},'dialPrefix':{'type':Sequelize[_0x8374('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0x8374('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x8374('0x1c')},'dialCutDigit':{'type':Sequelize[_0x8374('0x7')](0x3)[_0x8374('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x8374('0x1d')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x8374('0x7')](0x3)[_0x8374('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8374('0x1e')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x8374('0x7')](0x5)[_0x8374('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8374('0x1f')},'dialDropMaxRetry':{'type':Sequelize[_0x8374('0x7')](0x3)[_0x8374('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0x8374('0x7')](0x5)[_0x8374('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8374('0x20')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x8374('0x7')](0x3)[_0x8374('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8374('0x21')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x8374('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0x8374('0x7')](0x3)[_0x8374('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x8374('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8374('0x22')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x8374('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8374('0x23')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x8374('0x7')](0x5)[_0x8374('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'}}; \ No newline at end of file +var _0x18f3=['#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','ENUM','never','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','ASC','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','exports','STRING','name','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)'];(function(_0x126f6e,_0xee248a){var _0x1df007=function(_0x1ded1f){while(--_0x1ded1f){_0x126f6e['push'](_0x126f6e['shift']());}};_0x1df007(++_0xee248a);}(_0x18f3,0x19f));var _0x318f=function(_0x243b2f,_0x30aa15){_0x243b2f=_0x243b2f-0x0;var _0xcb3c2d=_0x18f3[_0x243b2f];return _0xcb3c2d;};'use strict';var Sequelize=require('sequelize');module[_0x318f('0x0')]={'name':{'type':Sequelize[_0x318f('0x1')],'unique':_0x318f('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM']('ivr'),'allowNull':![],'defaultValue':_0x318f('0x3')},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x318f('0x4')],'defaultValue':0x0,'comment':_0x318f('0x5')},'limitCalls':{'type':Sequelize[_0x318f('0x6')](0x4)[_0x318f('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':'Max\x20200\x20calls.'},'dialOriginateCallerIdName':{'type':Sequelize[_0x318f('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x318f('0x1')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x318f('0x8')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x318f('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x318f('0x9')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x318f('0x6')](0x5)[_0x318f('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x318f('0xa')},'dialBusyMaxRetry':{'type':Sequelize[_0x318f('0x6')](0x3)[_0x318f('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x318f('0xb')},'dialBusyRetryFrequency':{'type':Sequelize[_0x318f('0x6')](0x5)[_0x318f('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x318f('0xc')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x318f('0x6')](0x3)[_0x318f('0x7')],'defaultValue':0x3,'comment':_0x318f('0xd')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x318f('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0x318f('0x6')](0x3)[_0x318f('0x7')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x318f('0xe')},'dialTimezone':{'type':Sequelize[_0x318f('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x318f('0x1')],'defaultValue':_0x318f('0xf')},'dialCheckDuplicateType':{'type':Sequelize[_0x318f('0x10')]('always',_0x318f('0x11'),'onlyIfOpen'),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x318f('0x4')],'defaultValue':0x0,'comment':_0x318f('0x12')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x318f('0x13')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0x318f('0x7')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x318f('0x14')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x318f('0x6')](0x9)[_0x318f('0x7')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x318f('0x15')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0x318f('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x318f('0x16')},'dialAMDMinWordLength':{'type':Sequelize[_0x318f('0x6')](0x9)[_0x318f('0x7')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x318f('0x17')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x318f('0x6')](0x9)[_0x318f('0x7')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x318f('0x18')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x318f('0x6')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0x318f('0x6')](0x5)[_0x318f('0x7')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x318f('0x19')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x318f('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize[_0x318f('0x10')]('DESC',_0x318f('0x1a')),'defaultValue':_0x318f('0x1b')},'dialPrefix':{'type':Sequelize[_0x318f('0x1')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x318f('0x6')](0x3)[_0x318f('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x318f('0x1c')},'dialCutDigit':{'type':Sequelize[_0x318f('0x6')](0x3)[_0x318f('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x318f('0x1d')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x318f('0x6')](0x3)[_0x318f('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x318f('0x1e')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x318f('0x6')](0x5)[_0x318f('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x318f('0x1f')},'dialDropMaxRetry':{'type':Sequelize[_0x318f('0x6')](0x3)[_0x318f('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x318f('0x20')},'dialDropRetryFrequency':{'type':Sequelize[_0x318f('0x6')](0x5)[_0x318f('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x318f('0x21')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x318f('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x318f('0x22')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x318f('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x318f('0x23')},'dialMachineMaxRetry':{'type':Sequelize[_0x318f('0x6')](0x3)[_0x318f('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x318f('0x24')},'dialMachineRetryFrequency':{'type':Sequelize[_0x318f('0x6')](0x5)[_0x318f('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x318f('0x25')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x318f('0x6')](0x3)[_0x318f('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x318f('0x26')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x318f('0x6')](0x5)[_0x318f('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 9090b52..0028ab1 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 _0x4c71=['rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','save','update','then','get','IvrCampaigns','UserProfileResource','destroy','send','index','map','Campaign','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','name','filter','options','includeAll','include','findAll','rows','catch','show','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','length','updatedAt','createdAt','autoAssociation','findOne','CampaignId','CmHopper','getHopperHistories','order','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','CmList','getLists','addLists','format','ids','omit','dialCheckDuplicateType','always','insert','fromQuery','phone','scheduledAt','ContactId','ListId','select','field','NOW()','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','cm_hopper','CampaignId\x20=\x20?','onlyIfOpen','into','CmListId','phone\x20IS\x20NOT\x20NULL','cm_hopper_additional_phones','cmHopperId','OrderBy','h.id','ci.item','ci.OrderBY','cm_contact_has_items','join','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.CampaignId=?','h.createdAt\x20=\x20?','sequelize','push','all','removeLists','getBlackLists','addBlackLists','YYYY-MM-DD\x20HH:mm:ss','spread','cm_hopper_black','removeBlackLists','eml-format'];(function(_0x3fe83b,_0x579485){var _0x5c96cf=function(_0x25a92b){while(--_0x25a92b){_0x3fe83b['push'](_0x3fe83b['shift']());}};_0x5c96cf(++_0x579485);}(_0x4c71,0x12b));var _0x14c7=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x4c71[_0x5d6456];return _0x4d66c1;};'use strict';var emlformat=require(_0x14c7('0x0'));var rimraf=require(_0x14c7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x14c7('0x2'));var rp=require(_0x14c7('0x3'));var moment=require(_0x14c7('0x4'));var BPromise=require(_0x14c7('0x5'));var Mustache=require(_0x14c7('0x6'));var util=require('util');var path=require(_0x14c7('0x7'));var sox=require(_0x14c7('0x8'));var csv=require(_0x14c7('0x9'));var ejs=require(_0x14c7('0xa'));var fs=require('fs');var fs_extra=require(_0x14c7('0xb'));var _=require('lodash');var squel=require(_0x14c7('0xc'));var crypto=require(_0x14c7('0xd'));var jsforce=require(_0x14c7('0xe'));var deskjs=require(_0x14c7('0xf'));var toCsv=require(_0x14c7('0x9'));var querystring=require('querystring');var Papa=require(_0x14c7('0x10'));var Redis=require('ioredis');var authService=require(_0x14c7('0x11'));var qs=require(_0x14c7('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x14c7('0x13'));var logger=require(_0x14c7('0x14'))(_0x14c7('0x15'));var utils=require(_0x14c7('0x16'));var config=require(_0x14c7('0x17'));var licenseUtil=require(_0x14c7('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5b3ff2,_0x2bef86){_0x2bef86=_0x2bef86||0xcc;return function(_0x651044){if(_0x651044){return _0x5b3ff2[_0x14c7('0x19')](_0x2bef86);}return _0x5b3ff2[_0x14c7('0x1a')](_0x2bef86)[_0x14c7('0x1b')]();};}function respondWithResult(_0x3e779f,_0x4b8f41){_0x4b8f41=_0x4b8f41||0xc8;return function(_0x4e9856){if(_0x4e9856){return _0x3e779f[_0x14c7('0x1a')](_0x4b8f41)[_0x14c7('0x1c')](_0x4e9856);}};}function respondWithFilteredResult(_0x5db054,_0x5bb4de){return function(_0x39c742){if(_0x39c742){var _0x2929bc=typeof _0x5bb4de[_0x14c7('0x1d')]===_0x14c7('0x1e')&&typeof _0x5bb4de[_0x14c7('0x1f')]===_0x14c7('0x1e');var _0x568e2a=_0x39c742[_0x14c7('0x20')];var _0x76ee68=_0x2929bc?0x0:_0x5bb4de[_0x14c7('0x1d')];var _0x285100=_0x2929bc?_0x39c742['count']:_0x5bb4de['offset']+_0x5bb4de[_0x14c7('0x1f')];var _0x3c6ab5;if(_0x285100>=_0x568e2a){_0x285100=_0x568e2a;_0x3c6ab5=0xc8;}else{_0x3c6ab5=0xce;}_0x5db054[_0x14c7('0x1a')](_0x3c6ab5);return _0x5db054['set'](_0x14c7('0x21'),_0x76ee68+'-'+_0x285100+'/'+_0x568e2a)[_0x14c7('0x1c')](_0x39c742);}return null;};}function patchUpdates(_0x2622b5){return function(_0x345bac){try{jsonpatch['apply'](_0x345bac,_0x2622b5,!![]);}catch(_0x5e1df1){return BPromise['reject'](_0x5e1df1);}return _0x345bac[_0x14c7('0x22')]();};}function saveUpdates(_0x4944ad,_0x5be2e5){return function(_0x39c8ee){if(_0x39c8ee){return _0x39c8ee[_0x14c7('0x23')](_0x4944ad)[_0x14c7('0x24')](function(_0x1c914b){return _0x1c914b;});}return null;};}function removeEntity(_0x24a93b,_0x4db89a){return function(_0x5d0f51){if(_0x5d0f51){return _0x5d0f51['destroy']()[_0x14c7('0x24')](function(){var _0x1f24b4=_0x5d0f51[_0x14c7('0x25')]({'plain':!![]});var _0x4209dd=_0x14c7('0x26');return db[_0x14c7('0x27')][_0x14c7('0x28')]({'where':{'type':_0x4209dd,'resourceId':_0x1f24b4['id']}})['then'](function(){return _0x5d0f51;});})[_0x14c7('0x24')](function(){_0x24a93b[_0x14c7('0x1a')](0xcc)[_0x14c7('0x1b')]();});}};}function handleEntityNotFound(_0x30a959,_0x3b4344){return function(_0x5a48e9){if(!_0x5a48e9){_0x30a959[_0x14c7('0x19')](0x194);}return _0x5a48e9;};}function handleError(_0x425328,_0xd751df){_0xd751df=_0xd751df||0x1f4;return function(_0x4af1bf){logger['error'](_0x4af1bf['stack']);if(_0x4af1bf['name']){delete _0x4af1bf['name'];}_0x425328[_0x14c7('0x1a')](_0xd751df)[_0x14c7('0x29')](_0x4af1bf);};}exports[_0x14c7('0x2a')]=function(_0x2123b8,_0x58e5e7){var _0x4f8482={},_0x5d8ab9={},_0x3e2940={'count':0x0,'rows':[]};var _0x235ee8=_[_0x14c7('0x2b')](db[_0x14c7('0x2c')][_0x14c7('0x2d')],function(_0x25e760){return{'name':_0x25e760['fieldName'],'type':_0x25e760[_0x14c7('0x2e')][_0x14c7('0x2f')]};});_0x5d8ab9[_0x14c7('0x30')]=_['map'](_0x235ee8,'name');_0x5d8ab9[_0x14c7('0x31')]=_[_0x14c7('0x32')](_0x2123b8['query']);_0x5d8ab9[_0x14c7('0x33')]=_['intersection'](_0x5d8ab9[_0x14c7('0x30')],_0x5d8ab9[_0x14c7('0x31')]);_0x4f8482[_0x14c7('0x34')]=_[_0x14c7('0x35')](_0x5d8ab9[_0x14c7('0x30')],qs['fields'](_0x2123b8[_0x14c7('0x31')][_0x14c7('0x36')]));_0x4f8482[_0x14c7('0x34')]=_0x4f8482['attributes']['length']?_0x4f8482['attributes']:_0x5d8ab9[_0x14c7('0x30')];if(!_0x2123b8['query'][_0x14c7('0x37')](_0x14c7('0x38'))){_0x4f8482[_0x14c7('0x1f')]=qs[_0x14c7('0x1f')](_0x2123b8['query'][_0x14c7('0x1f')]);_0x4f8482[_0x14c7('0x1d')]=qs[_0x14c7('0x1d')](_0x2123b8[_0x14c7('0x31')]['offset']);}_0x4f8482['order']=qs[_0x14c7('0x39')](_0x2123b8[_0x14c7('0x31')][_0x14c7('0x39')]);_0x4f8482[_0x14c7('0x3a')]=qs[_0x14c7('0x33')](_[_0x14c7('0x3b')](_0x2123b8[_0x14c7('0x31')],_0x5d8ab9['filters']),_0x235ee8);if(_0x2123b8[_0x14c7('0x31')]['filter']){_0x4f8482['where']=_[_0x14c7('0x3c')](_0x4f8482['where'],{'$or':_[_0x14c7('0x2b')](_0x235ee8,function(_0xc94e55){if(_0xc94e55[_0x14c7('0x2e')]!==_0x14c7('0x3d')){var _0x2226d2={};_0x2226d2[_0xc94e55[_0x14c7('0x3e')]]={'$like':'%'+_0x2123b8['query'][_0x14c7('0x3f')]+'%'};return _0x2226d2;}})});}_0x4f8482=_[_0x14c7('0x3c')]({},_0x4f8482,_0x2123b8[_0x14c7('0x40')]);var _0xce0c81={'where':_0x4f8482['where']};return db[_0x14c7('0x2c')][_0x14c7('0x20')](_0xce0c81)[_0x14c7('0x24')](function(_0x49e039){_0x3e2940[_0x14c7('0x20')]=_0x49e039;if(_0x2123b8[_0x14c7('0x31')][_0x14c7('0x41')]){_0x4f8482[_0x14c7('0x42')]=[{'all':!![]}];}return db['Campaign'][_0x14c7('0x43')](_0x4f8482);})['then'](function(_0x5246d6){_0x3e2940[_0x14c7('0x44')]=_0x5246d6;return _0x3e2940;})['then'](respondWithFilteredResult(_0x58e5e7,_0x4f8482))[_0x14c7('0x45')](handleError(_0x58e5e7,null));};exports[_0x14c7('0x46')]=function(_0x392d82,_0xc847c5){var _0x4761f0={'raw':![],'where':{'id':_0x392d82['params']['id']}},_0x4b88b3={};_0x4b88b3[_0x14c7('0x30')]=_[_0x14c7('0x32')](db[_0x14c7('0x2c')][_0x14c7('0x2d')]);_0x4b88b3[_0x14c7('0x31')]=_[_0x14c7('0x32')](_0x392d82[_0x14c7('0x31')]);_0x4b88b3[_0x14c7('0x33')]=_[_0x14c7('0x35')](_0x4b88b3['model'],_0x4b88b3[_0x14c7('0x31')]);_0x4761f0['attributes']=_[_0x14c7('0x35')](_0x4b88b3[_0x14c7('0x30')],qs[_0x14c7('0x36')](_0x392d82[_0x14c7('0x31')][_0x14c7('0x36')]));_0x4761f0['attributes']=_0x4761f0['attributes']['length']?_0x4761f0[_0x14c7('0x34')]:_0x4b88b3['model'];if(_0x392d82[_0x14c7('0x31')][_0x14c7('0x41')]){_0x4761f0['include']=[{'all':!![]}];}_0x4761f0=_[_0x14c7('0x3c')]({},_0x4761f0,_0x392d82[_0x14c7('0x40')]);return db[_0x14c7('0x2c')][_0x14c7('0x47')](_0x4761f0)['then'](handleEntityNotFound(_0xc847c5,null))[_0x14c7('0x24')](respondWithResult(_0xc847c5,null))[_0x14c7('0x45')](handleError(_0xc847c5,null));};exports[_0x14c7('0x48')]=function(_0x10509f,_0x3ca42c){return db[_0x14c7('0x2c')]['create'](_0x10509f[_0x14c7('0x49')],{})[_0x14c7('0x24')](function(_0x5bf965){var _0x2e3227=_0x10509f[_0x14c7('0x4a')][_0x14c7('0x25')]({'plain':!![]});if(!_0x2e3227)throw new Error(_0x14c7('0x4b'));if(_0x2e3227[_0x14c7('0x4c')]===_0x14c7('0x4a')){var _0x45b58b=_0x5bf965[_0x14c7('0x25')]({'plain':!![]});var _0x58bd01=_0x14c7('0x26');return db[_0x14c7('0x4d')][_0x14c7('0x47')]({'where':{'name':_0x58bd01,'userProfileId':_0x2e3227[_0x14c7('0x4e')]},'raw':!![]})[_0x14c7('0x24')](function(_0x5a7a0d){if(_0x5a7a0d&&_0x5a7a0d['autoAssociation']===0x0){return db[_0x14c7('0x27')]['create']({'name':_0x45b58b[_0x14c7('0x3e')],'resourceId':_0x45b58b['id'],'type':_0x5a7a0d['name'],'sectionId':_0x5a7a0d['id']},{})['then'](function(){return _0x5bf965;});}else{return _0x5bf965;}})[_0x14c7('0x45')](function(_0x4013d7){logger['error'](_0x14c7('0x4f'),_0x4013d7);throw _0x4013d7;});}return _0x5bf965;})[_0x14c7('0x24')](respondWithResult(_0x3ca42c,0xc9))[_0x14c7('0x45')](handleError(_0x3ca42c,null));};exports[_0x14c7('0x50')]=function(_0x29f55a,_0xddc16b){var _0x4edcac={'where':{'id':_0x29f55a[_0x14c7('0x51')]['id']}},_0x4e77a5={};_0x4e77a5[_0x14c7('0x30')]=_[_0x14c7('0x32')](db[_0x14c7('0x2c')]['rawAttributes']);_0x4edcac[_0x14c7('0x34')]=_[_0x14c7('0x35')](_0x4e77a5[_0x14c7('0x30')],qs[_0x14c7('0x36')](_0x29f55a['query'][_0x14c7('0x36')]));_0x4edcac['attributes']=_0x4edcac[_0x14c7('0x34')][_0x14c7('0x52')]?_0x4edcac['attributes']:_0x4e77a5['model'];if(_0x29f55a[_0x14c7('0x31')][_0x14c7('0x41')]){_0x4edcac[_0x14c7('0x42')]=[{'all':!![]}];}_0x4edcac=_[_0x14c7('0x3c')]({},_0x4edcac,_0x29f55a[_0x14c7('0x40')]);return db['Campaign'][_0x14c7('0x47')](_0x4edcac)['then'](handleEntityNotFound(_0xddc16b,null))['then'](function(_0x538cc9){if(_0x538cc9){var _0x35d996=_0x538cc9['get']({'plain':!![]});_0x35d996=qs['omit'](_0x35d996,['id','createdAt',_0x14c7('0x53')]);_0x29f55a[_0x14c7('0x49')]=_['omit'](_0x29f55a['body'],['id',_0x14c7('0x54'),_0x14c7('0x53')]);return db[_0x14c7('0x2c')][_0x14c7('0x48')](_[_0x14c7('0x3c')](_0x35d996,_0x29f55a[_0x14c7('0x49')]),{'include':_0x29f55a['query'][_0x14c7('0x41')]?[{'all':!![]}]:undefined})[_0x14c7('0x24')](function(_0x2c959a){var _0x43c3c9=_0x29f55a[_0x14c7('0x4a')][_0x14c7('0x25')]({'plain':!![]});if(!_0x43c3c9)throw new Error(_0x14c7('0x4b'));if(_0x43c3c9[_0x14c7('0x4c')]===_0x14c7('0x4a')){var _0x58d9e9=_0x2c959a[_0x14c7('0x25')]({'plain':!![]});var _0x333d23=_0x14c7('0x26');return db[_0x14c7('0x4d')][_0x14c7('0x47')]({'where':{'name':_0x333d23,'userProfileId':_0x43c3c9[_0x14c7('0x4e')]},'raw':!![]})[_0x14c7('0x24')](function(_0x4cdc3d){if(_0x4cdc3d&&_0x4cdc3d[_0x14c7('0x55')]===0x0){return db[_0x14c7('0x27')][_0x14c7('0x48')]({'name':_0x58d9e9[_0x14c7('0x3e')],'resourceId':_0x58d9e9['id'],'type':_0x4cdc3d[_0x14c7('0x3e')],'sectionId':_0x4cdc3d['id']},{})['then'](function(){return _0x2c959a;});}else{return _0x2c959a;}})[_0x14c7('0x45')](function(_0x1dc514){logger['error'](_0x14c7('0x4f'),_0x1dc514);throw _0x1dc514;});}return _0x2c959a;});}})[_0x14c7('0x24')](respondWithResult(_0xddc16b,0xc9))['catch'](handleError(_0xddc16b,null));};exports[_0x14c7('0x23')]=function(_0x84f4b1,_0x49c38b){if(_0x84f4b1['body']['id']){delete _0x84f4b1[_0x14c7('0x49')]['id'];}return db['Campaign']['find']({'where':{'id':_0x84f4b1['params']['id']}})[_0x14c7('0x24')](handleEntityNotFound(_0x49c38b,null))[_0x14c7('0x24')](saveUpdates(_0x84f4b1[_0x14c7('0x49')],null))[_0x14c7('0x24')](respondWithResult(_0x49c38b,null))[_0x14c7('0x45')](handleError(_0x49c38b,null));};exports['destroy']=function(_0x1a106d,_0x3ac90e){return db['Campaign']['find']({'where':{'id':_0x1a106d[_0x14c7('0x51')]['id']}})[_0x14c7('0x24')](handleEntityNotFound(_0x3ac90e,null))[_0x14c7('0x24')](removeEntity(_0x3ac90e,null))[_0x14c7('0x45')](handleError(_0x3ac90e,null));};exports['getHoppers']=function(_0x2b6a10,_0x557d2b,_0x12b5a5){var _0x519d57={'raw':!![],'where':{}};var _0x5c8433={};var _0x3f0406={'count':0x0,'rows':[]};return db[_0x14c7('0x2c')][_0x14c7('0x56')]({'where':{'id':_0x2b6a10['params']['id']}})[_0x14c7('0x24')](handleEntityNotFound(_0x557d2b,null))[_0x14c7('0x24')](function(_0x313d01){if(_0x313d01){_0x5c8433['model']=_[_0x14c7('0x32')](db['CmHopper']['rawAttributes']);_0x5c8433[_0x14c7('0x31')]=_[_0x14c7('0x32')](_0x2b6a10[_0x14c7('0x31')]);_0x5c8433[_0x14c7('0x33')]=_[_0x14c7('0x35')](_0x5c8433['model'],_0x5c8433[_0x14c7('0x31')]);_0x519d57[_0x14c7('0x34')]=_[_0x14c7('0x35')](_0x5c8433[_0x14c7('0x30')],qs[_0x14c7('0x36')](_0x2b6a10['query']['fields']));_0x519d57[_0x14c7('0x34')]=_0x519d57[_0x14c7('0x34')][_0x14c7('0x52')]?_0x519d57['attributes']:_0x5c8433[_0x14c7('0x30')];if(!_0x2b6a10['query']['hasOwnProperty'](_0x14c7('0x38'))){_0x519d57['limit']=qs[_0x14c7('0x1f')](_0x2b6a10[_0x14c7('0x31')][_0x14c7('0x1f')]);_0x519d57['offset']=qs[_0x14c7('0x1d')](_0x2b6a10[_0x14c7('0x31')][_0x14c7('0x1d')]);}_0x519d57['order']=qs['sort'](_0x2b6a10['query']['sort']);_0x519d57['where']=qs[_0x14c7('0x33')](_[_0x14c7('0x3b')](_0x2b6a10[_0x14c7('0x31')],_0x5c8433[_0x14c7('0x33')]));_0x519d57['where'][_0x14c7('0x57')]=_0x313d01['id'];if(_0x2b6a10[_0x14c7('0x31')][_0x14c7('0x3f')]){_0x519d57[_0x14c7('0x3a')]=_['merge'](_0x519d57['where'],{'$or':_[_0x14c7('0x2b')](_0x519d57['attributes'],function(_0x1b2b89){var _0x29d8d6={};_0x29d8d6[_0x1b2b89]={'$like':'%'+_0x2b6a10[_0x14c7('0x31')]['filter']+'%'};return _0x29d8d6;})});}_0x519d57=_[_0x14c7('0x3c')]({},_0x519d57,_0x2b6a10['options']);return db[_0x14c7('0x58')][_0x14c7('0x20')]({'where':_0x519d57['where']})[_0x14c7('0x24')](function(_0x313d0b){_0x3f0406[_0x14c7('0x20')]=_0x313d0b;if(_0x2b6a10['query'][_0x14c7('0x41')]){_0x519d57[_0x14c7('0x42')]=[{'all':!![]}];}return db[_0x14c7('0x58')][_0x14c7('0x43')](_0x519d57);})[_0x14c7('0x24')](function(_0x4dc44c){_0x3f0406[_0x14c7('0x44')]=_0x4dc44c;return _0x3f0406;});}})['then'](respondWithFilteredResult(_0x557d2b,_0x519d57))['catch'](handleError(_0x557d2b,null));};exports[_0x14c7('0x59')]=function(_0x124779,_0x3d208a,_0x24f126){var _0x390df8={'raw':!![],'where':{}};var _0x4ae646={};var _0x40d142={'count':0x0,'rows':[]};return db[_0x14c7('0x2c')][_0x14c7('0x56')]({'where':{'id':_0x124779[_0x14c7('0x51')]['id']}})['then'](handleEntityNotFound(_0x3d208a,null))[_0x14c7('0x24')](function(_0x371afe){if(_0x371afe){_0x4ae646['model']=_['keys'](db['CmHopperHistory'][_0x14c7('0x2d')]);_0x4ae646[_0x14c7('0x31')]=_[_0x14c7('0x32')](_0x124779[_0x14c7('0x31')]);_0x4ae646[_0x14c7('0x33')]=_['intersection'](_0x4ae646[_0x14c7('0x30')],_0x4ae646[_0x14c7('0x31')]);_0x390df8[_0x14c7('0x34')]=_[_0x14c7('0x35')](_0x4ae646[_0x14c7('0x30')],qs[_0x14c7('0x36')](_0x124779[_0x14c7('0x31')][_0x14c7('0x36')]));_0x390df8[_0x14c7('0x34')]=_0x390df8[_0x14c7('0x34')]['length']?_0x390df8[_0x14c7('0x34')]:_0x4ae646[_0x14c7('0x30')];if(!_0x124779['query'][_0x14c7('0x37')]('nolimit')){_0x390df8[_0x14c7('0x1f')]=qs['limit'](_0x124779[_0x14c7('0x31')][_0x14c7('0x1f')]);_0x390df8[_0x14c7('0x1d')]=qs[_0x14c7('0x1d')](_0x124779[_0x14c7('0x31')][_0x14c7('0x1d')]);}_0x390df8[_0x14c7('0x5a')]=qs[_0x14c7('0x39')](_0x124779[_0x14c7('0x31')][_0x14c7('0x39')]);_0x390df8[_0x14c7('0x3a')]=qs[_0x14c7('0x33')](_['pick'](_0x124779['query'],_0x4ae646[_0x14c7('0x33')]));_0x390df8[_0x14c7('0x3a')][_0x14c7('0x57')]=_0x371afe['id'];if(_0x124779['query']['filter']){_0x390df8[_0x14c7('0x3a')]=_[_0x14c7('0x3c')](_0x390df8[_0x14c7('0x3a')],{'$or':_[_0x14c7('0x2b')](_0x390df8[_0x14c7('0x34')],function(_0x2c957d){var _0x52c615={};_0x52c615[_0x2c957d]={'$like':'%'+_0x124779['query'][_0x14c7('0x3f')]+'%'};return _0x52c615;})});}_0x390df8=_[_0x14c7('0x3c')]({},_0x390df8,_0x124779[_0x14c7('0x40')]);return db[_0x14c7('0x5b')][_0x14c7('0x20')]({'where':_0x390df8['where']})[_0x14c7('0x24')](function(_0x8f1ec6){_0x40d142[_0x14c7('0x20')]=_0x8f1ec6;if(_0x124779[_0x14c7('0x31')][_0x14c7('0x41')]){_0x390df8[_0x14c7('0x42')]=[{'all':!![]}];}return db['CmHopperHistory']['findAll'](_0x390df8);})['then'](function(_0x49b83d){_0x40d142[_0x14c7('0x44')]=_0x49b83d;return _0x40d142;});}})['then'](respondWithFilteredResult(_0x3d208a,_0x390df8))[_0x14c7('0x45')](handleError(_0x3d208a,null));};exports[_0x14c7('0x5c')]=function(_0x32f799,_0x33af80,_0x2fba62){var _0x5c70ee={'raw':!![],'where':{}};var _0x305524={};var _0x54287a={'count':0x0,'rows':[]};return db[_0x14c7('0x2c')][_0x14c7('0x56')]({'where':{'id':_0x32f799[_0x14c7('0x51')]['id']}})[_0x14c7('0x24')](handleEntityNotFound(_0x33af80,null))['then'](function(_0x1fa139){if(_0x1fa139){_0x305524[_0x14c7('0x30')]=_[_0x14c7('0x32')](db['CmHopperFinal'][_0x14c7('0x2d')]);_0x305524['query']=_[_0x14c7('0x32')](_0x32f799[_0x14c7('0x31')]);_0x305524['filters']=_[_0x14c7('0x35')](_0x305524['model'],_0x305524['query']);_0x5c70ee[_0x14c7('0x34')]=_[_0x14c7('0x35')](_0x305524['model'],qs['fields'](_0x32f799[_0x14c7('0x31')][_0x14c7('0x36')]));_0x5c70ee[_0x14c7('0x34')]=_0x5c70ee[_0x14c7('0x34')][_0x14c7('0x52')]?_0x5c70ee[_0x14c7('0x34')]:_0x305524['model'];if(!_0x32f799[_0x14c7('0x31')]['hasOwnProperty'](_0x14c7('0x38'))){_0x5c70ee[_0x14c7('0x1f')]=qs[_0x14c7('0x1f')](_0x32f799[_0x14c7('0x31')][_0x14c7('0x1f')]);_0x5c70ee['offset']=qs['offset'](_0x32f799[_0x14c7('0x31')][_0x14c7('0x1d')]);}_0x5c70ee[_0x14c7('0x5a')]=qs[_0x14c7('0x39')](_0x32f799[_0x14c7('0x31')][_0x14c7('0x39')]);_0x5c70ee[_0x14c7('0x3a')]=qs[_0x14c7('0x33')](_[_0x14c7('0x3b')](_0x32f799[_0x14c7('0x31')],_0x305524[_0x14c7('0x33')]));_0x5c70ee[_0x14c7('0x3a')][_0x14c7('0x57')]=_0x1fa139['id'];if(_0x32f799['query'][_0x14c7('0x3f')]){_0x5c70ee[_0x14c7('0x3a')]=_[_0x14c7('0x3c')](_0x5c70ee[_0x14c7('0x3a')],{'$or':_[_0x14c7('0x2b')](_0x5c70ee['attributes'],function(_0x115285){var _0x55b5ea={};_0x55b5ea[_0x115285]={'$like':'%'+_0x32f799[_0x14c7('0x31')][_0x14c7('0x3f')]+'%'};return _0x55b5ea;})});}_0x5c70ee=_['merge']({},_0x5c70ee,_0x32f799[_0x14c7('0x40')]);return db['CmHopperFinal'][_0x14c7('0x20')]({'where':_0x5c70ee[_0x14c7('0x3a')]})['then'](function(_0x1862d1){_0x54287a[_0x14c7('0x20')]=_0x1862d1;if(_0x32f799['query'][_0x14c7('0x41')]){_0x5c70ee[_0x14c7('0x42')]=[{'all':!![]}];}return db[_0x14c7('0x5d')][_0x14c7('0x43')](_0x5c70ee);})['then'](function(_0x4e7df0){_0x54287a[_0x14c7('0x44')]=_0x4e7df0;return _0x54287a;});}})[_0x14c7('0x24')](respondWithFilteredResult(_0x33af80,_0x5c70ee))[_0x14c7('0x45')](handleError(_0x33af80,null));};exports[_0x14c7('0x5e')]=function(_0x5c3bba,_0x2d20dc,_0x1cae39){var _0x4927a1={'raw':!![],'where':{}};var _0x310348={};var _0x113efb={'count':0x0,'rows':[]};return db[_0x14c7('0x2c')][_0x14c7('0x56')]({'where':{'id':_0x5c3bba[_0x14c7('0x51')]['id']}})[_0x14c7('0x24')](handleEntityNotFound(_0x2d20dc,null))['then'](function(_0x2a3482){if(_0x2a3482){_0x310348[_0x14c7('0x30')]=_[_0x14c7('0x32')](db['CmHopperBlack'][_0x14c7('0x2d')]);_0x310348['query']=_[_0x14c7('0x32')](_0x5c3bba[_0x14c7('0x31')]);_0x310348['filters']=_[_0x14c7('0x35')](_0x310348['model'],_0x310348[_0x14c7('0x31')]);_0x4927a1['attributes']=_[_0x14c7('0x35')](_0x310348[_0x14c7('0x30')],qs[_0x14c7('0x36')](_0x5c3bba[_0x14c7('0x31')][_0x14c7('0x36')]));_0x4927a1[_0x14c7('0x34')]=_0x4927a1['attributes'][_0x14c7('0x52')]?_0x4927a1[_0x14c7('0x34')]:_0x310348[_0x14c7('0x30')];if(!_0x5c3bba[_0x14c7('0x31')][_0x14c7('0x37')]('nolimit')){_0x4927a1[_0x14c7('0x1f')]=qs['limit'](_0x5c3bba[_0x14c7('0x31')][_0x14c7('0x1f')]);_0x4927a1[_0x14c7('0x1d')]=qs[_0x14c7('0x1d')](_0x5c3bba[_0x14c7('0x31')][_0x14c7('0x1d')]);}_0x4927a1[_0x14c7('0x5a')]=qs['sort'](_0x5c3bba[_0x14c7('0x31')]['sort']);_0x4927a1[_0x14c7('0x3a')]=qs[_0x14c7('0x33')](_['pick'](_0x5c3bba[_0x14c7('0x31')],_0x310348[_0x14c7('0x33')]));_0x4927a1[_0x14c7('0x3a')][_0x14c7('0x57')]=_0x2a3482['id'];if(_0x5c3bba['query'][_0x14c7('0x3f')]){_0x4927a1[_0x14c7('0x3a')]=_[_0x14c7('0x3c')](_0x4927a1[_0x14c7('0x3a')],{'$or':_[_0x14c7('0x2b')](_0x4927a1[_0x14c7('0x34')],function(_0x49063a){var _0x1769a7={};_0x1769a7[_0x49063a]={'$like':'%'+_0x5c3bba[_0x14c7('0x31')][_0x14c7('0x3f')]+'%'};return _0x1769a7;})});}_0x4927a1=_[_0x14c7('0x3c')]({},_0x4927a1,_0x5c3bba[_0x14c7('0x40')]);return db[_0x14c7('0x5f')][_0x14c7('0x20')]({'where':_0x4927a1['where']})[_0x14c7('0x24')](function(_0x9135e7){_0x113efb[_0x14c7('0x20')]=_0x9135e7;if(_0x5c3bba[_0x14c7('0x31')][_0x14c7('0x41')]){_0x4927a1[_0x14c7('0x42')]=[{'all':!![]}];}return db[_0x14c7('0x5f')][_0x14c7('0x43')](_0x4927a1);})[_0x14c7('0x24')](function(_0x23a606){_0x113efb[_0x14c7('0x44')]=_0x23a606;return _0x113efb;});}})[_0x14c7('0x24')](respondWithFilteredResult(_0x2d20dc,_0x4927a1))[_0x14c7('0x45')](handleError(_0x2d20dc,null));};exports['getLists']=function(_0x10b8b9,_0x108f99,_0xbda98a){var _0xbddb94={};var _0x48f158={};var _0x52d998;var _0x181c1c;return db['Campaign'][_0x14c7('0x56')]({'where':{'id':_0x10b8b9['params']['id']}})[_0x14c7('0x24')](handleEntityNotFound(_0x108f99,null))[_0x14c7('0x24')](function(_0x598e82){if(_0x598e82){_0x52d998=_0x598e82;_0x48f158['model']=_[_0x14c7('0x32')](db[_0x14c7('0x60')]['rawAttributes']);_0x48f158[_0x14c7('0x31')]=_[_0x14c7('0x32')](_0x10b8b9['query']);_0x48f158[_0x14c7('0x33')]=_[_0x14c7('0x35')](_0x48f158[_0x14c7('0x30')],_0x48f158[_0x14c7('0x31')]);_0xbddb94[_0x14c7('0x34')]=_['intersection'](_0x48f158[_0x14c7('0x30')],qs[_0x14c7('0x36')](_0x10b8b9[_0x14c7('0x31')][_0x14c7('0x36')]));_0xbddb94[_0x14c7('0x34')]=_0xbddb94[_0x14c7('0x34')][_0x14c7('0x52')]?_0xbddb94[_0x14c7('0x34')]:_0x48f158[_0x14c7('0x30')];_0xbddb94[_0x14c7('0x5a')]=qs[_0x14c7('0x39')](_0x10b8b9['query'][_0x14c7('0x39')]);_0xbddb94['where']=qs[_0x14c7('0x33')](_['pick'](_0x10b8b9['query'],_0x48f158[_0x14c7('0x33')]));if(_0x10b8b9[_0x14c7('0x31')][_0x14c7('0x3f')]){_0xbddb94[_0x14c7('0x3a')]=_[_0x14c7('0x3c')](_0xbddb94[_0x14c7('0x3a')],{'$or':_['map'](_0xbddb94[_0x14c7('0x34')],function(_0x4572e8){var _0x5543f7={};_0x5543f7[_0x4572e8]={'$like':'%'+_0x10b8b9[_0x14c7('0x31')]['filter']+'%'};return _0x5543f7;})});}_0xbddb94=_['merge']({},_0xbddb94,_0x10b8b9[_0x14c7('0x40')]);return _0x52d998[_0x14c7('0x61')](_0xbddb94);}})[_0x14c7('0x24')](function(_0xcff94f){if(_0xcff94f){_0x181c1c=_0xcff94f[_0x14c7('0x52')];if(!_0x10b8b9[_0x14c7('0x31')][_0x14c7('0x37')]('nolimit')){_0xbddb94[_0x14c7('0x1f')]=qs[_0x14c7('0x1f')](_0x10b8b9[_0x14c7('0x31')][_0x14c7('0x1f')]);_0xbddb94[_0x14c7('0x1d')]=qs[_0x14c7('0x1d')](_0x10b8b9[_0x14c7('0x31')]['offset']);}return _0x52d998[_0x14c7('0x61')](_0xbddb94);}})[_0x14c7('0x24')](function(_0xca699){if(_0xca699){return _0xca699?{'count':_0x181c1c,'rows':_0xca699}:null;}})['then'](respondWithResult(_0x108f99,null))['catch'](handleError(_0x108f99,null));};exports[_0x14c7('0x62')]=function(_0x234fba,_0x46cffc,_0x538830){var _0x5a2966,_0x52aaf7;var _0x556e5f=[];var _0x543b5d=moment()[_0x14c7('0x63')]('YYYY-MM-DD\x20HH:mm:ss');return db[_0x14c7('0x2c')][_0x14c7('0x47')]({'where':{'id':_0x234fba[_0x14c7('0x51')]['id']}})['then'](handleEntityNotFound(_0x46cffc,null))[_0x14c7('0x24')](function(_0x253424){if(_0x253424){_0x52aaf7=_0x253424;return _0x253424[_0x14c7('0x62')](_0x234fba[_0x14c7('0x49')][_0x14c7('0x64')],_[_0x14c7('0x65')](_0x234fba['body'],[_0x14c7('0x64'),'id'])||{});}return null;})['spread'](function(_0x54a5c9){var _0x46826d;var _0xdda82a;_0x5a2966=_0x54a5c9||[];var _0x5b98c5=[];if(_0x54a5c9){for(var _0x21d2ce=0x0;_0x21d2ce<_0x54a5c9[_0x14c7('0x52')];_0x21d2ce+=0x1){var _0x45491f=_0x54a5c9[_0x21d2ce]['get']({'plain':!![]});_0x52aaf7[_0x14c7('0x66')]=_0x234fba['body']['dialCheckDuplicateType']?_0x234fba[_0x14c7('0x49')]['dialCheckDuplicateType']:_0x52aaf7[_0x14c7('0x66')];switch(_0x52aaf7[_0x14c7('0x66')]){case _0x14c7('0x67'):_0x46826d=squel[_0x14c7('0x68')]()['into']('cm_hopper')[_0x14c7('0x69')]([_0x14c7('0x6a'),_0x14c7('0x6b'),_0x14c7('0x6c'),_0x14c7('0x6d'),_0x14c7('0x57'),_0x14c7('0x54'),_0x14c7('0x53')],squel[_0x14c7('0x6e')]()[_0x14c7('0x6f')](_0x14c7('0x6a'),_0x14c7('0x6a'))[_0x14c7('0x6f')](_0x14c7('0x70'),_0x14c7('0x6b'))[_0x14c7('0x6f')]('id','ContactId')['field'](_0x45491f['CmListId'][_0x14c7('0x71')](),_0x14c7('0x6d'))[_0x14c7('0x6f')](_0x234fba[_0x14c7('0x51')]['id'][_0x14c7('0x71')](),_0x14c7('0x57'))[_0x14c7('0x6f')]('\x27'+_0x543b5d+'\x27',_0x14c7('0x54'))['field']('\x27'+_0x543b5d+'\x27',_0x14c7('0x53'))[_0x14c7('0x72')](_0x14c7('0x73'))[_0x14c7('0x3a')](_0x14c7('0x74'))[_0x14c7('0x3a')](_0x14c7('0x75'),_0x45491f['CmListId']['toString']())['where']('phone\x20IS\x20NOT\x20NULL')[_0x14c7('0x3a')]('phone\x20NOT\x20IN\x20(?)',squel[_0x14c7('0x6e')]()['field'](_0x14c7('0x76'))[_0x14c7('0x72')](_0x14c7('0x77'))[_0x14c7('0x3a')]('CampaignId\x20=\x20?',_0x234fba[_0x14c7('0x51')]['id']['toString']()))[_0x14c7('0x3a')](_0x14c7('0x78'),squel['select']()[_0x14c7('0x6f')](_0x14c7('0x79'))[_0x14c7('0x72')](_0x14c7('0x7a'))[_0x14c7('0x3a')](_0x14c7('0x7b'),_0x234fba['params']['id'][_0x14c7('0x71')]())))[_0x14c7('0x71')]();break;case _0x14c7('0x7c'):_0x46826d=squel[_0x14c7('0x68')]()[_0x14c7('0x7d')](_0x14c7('0x7a'))['fromQuery']([_0x14c7('0x6a'),_0x14c7('0x6b'),_0x14c7('0x6c'),_0x14c7('0x6d'),'CampaignId',_0x14c7('0x54'),_0x14c7('0x53')],squel['select']()['field'](_0x14c7('0x6a'),'phone')[_0x14c7('0x6f')](_0x14c7('0x70'),_0x14c7('0x6b'))[_0x14c7('0x6f')]('id',_0x14c7('0x6c'))[_0x14c7('0x6f')](_0x45491f[_0x14c7('0x7e')][_0x14c7('0x71')](),_0x14c7('0x6d'))[_0x14c7('0x6f')](_0x234fba[_0x14c7('0x51')]['id'][_0x14c7('0x71')](),'CampaignId')['field']('\x27'+_0x543b5d+'\x27',_0x14c7('0x54'))[_0x14c7('0x6f')]('\x27'+_0x543b5d+'\x27',_0x14c7('0x53'))[_0x14c7('0x72')]('cm_contacts')['where']('deletedAt\x20IS\x20NULL')['where'](_0x14c7('0x75'),_0x45491f[_0x14c7('0x7e')][_0x14c7('0x71')]())['where'](_0x14c7('0x7f'))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x14c7('0x6e')]()[_0x14c7('0x6f')](_0x14c7('0x79'))['from'](_0x14c7('0x7a'))[_0x14c7('0x3a')](_0x14c7('0x7b'),_0x234fba[_0x14c7('0x51')]['id'][_0x14c7('0x71')]())))['toString']();break;default:_0x46826d=squel['insert']()[_0x14c7('0x7d')]('cm_hopper')[_0x14c7('0x69')]([_0x14c7('0x6a'),_0x14c7('0x6b'),_0x14c7('0x6c'),_0x14c7('0x6d'),'CampaignId',_0x14c7('0x54'),_0x14c7('0x53')],squel['select']()[_0x14c7('0x6f')](_0x14c7('0x6a'),_0x14c7('0x6a'))[_0x14c7('0x6f')](_0x14c7('0x70'),_0x14c7('0x6b'))[_0x14c7('0x6f')]('id',_0x14c7('0x6c'))[_0x14c7('0x6f')](_0x45491f[_0x14c7('0x7e')][_0x14c7('0x71')](),_0x14c7('0x6d'))['field'](_0x234fba[_0x14c7('0x51')]['id'][_0x14c7('0x71')](),_0x14c7('0x57'))['field']('\x27'+_0x543b5d+'\x27',_0x14c7('0x54'))[_0x14c7('0x6f')]('\x27'+_0x543b5d+'\x27',_0x14c7('0x53'))[_0x14c7('0x72')](_0x14c7('0x73'))[_0x14c7('0x3a')](_0x14c7('0x74'))[_0x14c7('0x3a')](_0x14c7('0x75'),_0x45491f[_0x14c7('0x7e')][_0x14c7('0x71')]())['where'](_0x14c7('0x7f')))['toString']();}_0xdda82a=squel[_0x14c7('0x68')]()[_0x14c7('0x7d')](_0x14c7('0x80'))[_0x14c7('0x69')]([_0x14c7('0x81'),'scheduledAt',_0x14c7('0x6a'),_0x14c7('0x82'),_0x14c7('0x54'),'updatedAt'],squel[_0x14c7('0x6e')]()[_0x14c7('0x6f')](_0x14c7('0x83'),'id')['field'](_0x14c7('0x70'),_0x14c7('0x6b'))['field'](_0x14c7('0x84'),_0x14c7('0x6a'))[_0x14c7('0x6f')](_0x14c7('0x85'),_0x14c7('0x82'))[_0x14c7('0x6f')]('\x27'+_0x543b5d+'\x27',_0x14c7('0x54'))[_0x14c7('0x6f')]('\x27'+_0x543b5d+'\x27','updatedAt')[_0x14c7('0x72')](_0x14c7('0x86'),'ci')[_0x14c7('0x87')](_0x14c7('0x7a'),'h',_0x14c7('0x88'))[_0x14c7('0x3a')](_0x14c7('0x89'),_0x45491f[_0x14c7('0x7e')][_0x14c7('0x71')]())[_0x14c7('0x3a')](_0x14c7('0x8a'),_0x234fba[_0x14c7('0x51')]['id']['toString']())['where'](_0x14c7('0x8b'),_0x543b5d))[_0x14c7('0x71')]();_0x5b98c5['push'](db[_0x14c7('0x8c')][_0x14c7('0x31')](_0x46826d));_0x556e5f[_0x14c7('0x8d')](db[_0x14c7('0x8c')][_0x14c7('0x31')](_0xdda82a));}return BPromise[_0x14c7('0x8e')](_0x5b98c5);}})[_0x14c7('0x24')](function(){return BPromise['all'](_0x556e5f);})[_0x14c7('0x24')](function(){return _0x5a2966;})[_0x14c7('0x24')](respondWithResult(_0x46cffc,null))[_0x14c7('0x45')](handleError(_0x46cffc,null));};exports[_0x14c7('0x8f')]=function(_0x4c9671,_0x5e9fb9,_0x275b1d){return db['Campaign']['find']({'where':{'id':_0x4c9671['params']['id']}})[_0x14c7('0x24')](handleEntityNotFound(_0x5e9fb9,null))['then'](function(_0x7dda94){if(_0x7dda94){return _0x7dda94['removeLists'](_0x4c9671['query'][_0x14c7('0x64')]);}})['then'](function(_0x2e160e){if(_0x2e160e){return db[_0x14c7('0x58')][_0x14c7('0x28')]({'where':{'ListId':_0x4c9671[_0x14c7('0x31')][_0x14c7('0x64')],'CampaignId':_0x4c9671['params']['id']}})[_0x14c7('0x24')](function(){return _0x2e160e;});}})[_0x14c7('0x24')](respondWithStatusCode(_0x5e9fb9,null))[_0x14c7('0x45')](handleError(_0x5e9fb9,null));};exports[_0x14c7('0x90')]=function(_0x29b5c4,_0x421027,_0x5bc72d){var _0x418a0c={};var _0x2ff785={};var _0x46afc1;var _0x3ac29c;return db['Campaign'][_0x14c7('0x56')]({'where':{'id':_0x29b5c4[_0x14c7('0x51')]['id']}})[_0x14c7('0x24')](handleEntityNotFound(_0x421027,null))[_0x14c7('0x24')](function(_0xc82ff3){if(_0xc82ff3){_0x46afc1=_0xc82ff3;_0x2ff785[_0x14c7('0x30')]=_[_0x14c7('0x32')](db[_0x14c7('0x60')][_0x14c7('0x2d')]);_0x2ff785['query']=_['keys'](_0x29b5c4['query']);_0x2ff785[_0x14c7('0x33')]=_[_0x14c7('0x35')](_0x2ff785[_0x14c7('0x30')],_0x2ff785[_0x14c7('0x31')]);_0x418a0c[_0x14c7('0x34')]=_[_0x14c7('0x35')](_0x2ff785[_0x14c7('0x30')],qs[_0x14c7('0x36')](_0x29b5c4[_0x14c7('0x31')]['fields']));_0x418a0c[_0x14c7('0x34')]=_0x418a0c['attributes'][_0x14c7('0x52')]?_0x418a0c[_0x14c7('0x34')]:_0x2ff785[_0x14c7('0x30')];_0x418a0c[_0x14c7('0x5a')]=qs[_0x14c7('0x39')](_0x29b5c4[_0x14c7('0x31')][_0x14c7('0x39')]);_0x418a0c[_0x14c7('0x3a')]=qs[_0x14c7('0x33')](_[_0x14c7('0x3b')](_0x29b5c4[_0x14c7('0x31')],_0x2ff785[_0x14c7('0x33')]));if(_0x29b5c4[_0x14c7('0x31')][_0x14c7('0x3f')]){_0x418a0c[_0x14c7('0x3a')]=_[_0x14c7('0x3c')](_0x418a0c['where'],{'$or':_['map'](_0x418a0c[_0x14c7('0x34')],function(_0x2fca0b){var _0x95c0e0={};_0x95c0e0[_0x2fca0b]={'$like':'%'+_0x29b5c4[_0x14c7('0x31')]['filter']+'%'};return _0x95c0e0;})});}_0x418a0c=_['merge']({},_0x418a0c,_0x29b5c4[_0x14c7('0x40')]);return _0x46afc1['getBlackLists'](_0x418a0c);}})[_0x14c7('0x24')](function(_0x1bc482){if(_0x1bc482){_0x3ac29c=_0x1bc482['length'];if(!_0x29b5c4['query'][_0x14c7('0x37')]('nolimit')){_0x418a0c['limit']=qs[_0x14c7('0x1f')](_0x29b5c4[_0x14c7('0x31')][_0x14c7('0x1f')]);_0x418a0c['offset']=qs[_0x14c7('0x1d')](_0x29b5c4['query'][_0x14c7('0x1d')]);}return _0x46afc1[_0x14c7('0x90')](_0x418a0c);}})[_0x14c7('0x24')](function(_0x12345c){if(_0x12345c){return _0x12345c?{'count':_0x3ac29c,'rows':_0x12345c}:null;}})[_0x14c7('0x24')](respondWithResult(_0x421027,null))[_0x14c7('0x45')](handleError(_0x421027,null));};exports[_0x14c7('0x91')]=function(_0x1185d9,_0x5db086,_0x2a9e7c){var _0x37fac5,_0x5bea60;var _0x20051e=[];var _0x34a3c3=moment()[_0x14c7('0x63')](_0x14c7('0x92'));return db['Campaign'][_0x14c7('0x47')]({'where':{'id':_0x1185d9[_0x14c7('0x51')]['id']}})[_0x14c7('0x24')](handleEntityNotFound(_0x5db086,null))[_0x14c7('0x24')](function(_0x4374be){if(_0x4374be){_0x5bea60=_0x4374be;return _0x4374be[_0x14c7('0x91')](_0x1185d9['body'][_0x14c7('0x64')],_[_0x14c7('0x65')](_0x1185d9['body'],[_0x14c7('0x64'),'id'])||{});}return null;})[_0x14c7('0x93')](function(_0x1b2023){var _0x464cd2;var _0x19ed57;_0x37fac5=_0x1b2023||[];var _0x45ef01=[];if(_0x1b2023){for(var _0x259a65=0x0;_0x259a65<_0x1b2023[_0x14c7('0x52')];_0x259a65+=0x1){var _0x3cee96=_0x1b2023[_0x259a65]['get']({'plain':!![]});_0x464cd2=squel['insert']()[_0x14c7('0x7d')](_0x14c7('0x94'))[_0x14c7('0x69')]([_0x14c7('0x6a'),_0x14c7('0x6c'),_0x14c7('0x6d'),'CampaignId',_0x14c7('0x54'),_0x14c7('0x53')],squel[_0x14c7('0x6e')]()[_0x14c7('0x6f')](_0x14c7('0x6a'),'phone')[_0x14c7('0x6f')]('id','ContactId')[_0x14c7('0x6f')](_0x3cee96[_0x14c7('0x7e')][_0x14c7('0x71')](),_0x14c7('0x6d'))[_0x14c7('0x6f')](_0x1185d9[_0x14c7('0x51')]['id'][_0x14c7('0x71')](),_0x14c7('0x57'))['field']('NOW()','createdAt')[_0x14c7('0x6f')](_0x14c7('0x70'),_0x14c7('0x53'))[_0x14c7('0x72')](_0x14c7('0x73'))['where'](_0x14c7('0x74'))[_0x14c7('0x3a')](_0x14c7('0x75'),_0x3cee96[_0x14c7('0x7e')][_0x14c7('0x71')]())[_0x14c7('0x3a')](_0x14c7('0x7f')))[_0x14c7('0x71')]();_0x45ef01[_0x14c7('0x8d')](db['sequelize']['query'](_0x464cd2));}return BPromise['all'](_0x45ef01);}})[_0x14c7('0x24')](function(){return _0x37fac5;})[_0x14c7('0x24')](respondWithResult(_0x5db086,null))['catch'](handleError(_0x5db086,null));};exports['removeBlackLists']=function(_0x5c597c,_0x3ddf92,_0x103659){return db['Campaign'][_0x14c7('0x47')]({'where':{'id':_0x5c597c[_0x14c7('0x51')]['id']}})[_0x14c7('0x24')](handleEntityNotFound(_0x3ddf92,null))['then'](function(_0x4c2ff8){if(_0x4c2ff8){return _0x4c2ff8[_0x14c7('0x95')](_0x5c597c[_0x14c7('0x31')]['ids']);}})[_0x14c7('0x24')](function(_0x37906b){if(_0x37906b){return db['CmHopperBlack'][_0x14c7('0x28')]({'where':{'ListId':_0x5c597c[_0x14c7('0x31')]['ids'],'CampaignId':_0x5c597c['params']['id']}})['then'](function(){return _0x37906b;});}})[_0x14c7('0x24')](respondWithStatusCode(_0x3ddf92,null))[_0x14c7('0x45')](handleError(_0x3ddf92,null));}; \ No newline at end of file +var _0x32d3=['intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','Campaign','includeAll','include','rows','show','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','error','clone','params','length','updatedAt','omit','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getHoppers','findOne','CmHopper','findAll','getHopperHistories','CampaignId','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','format','YYYY-MM-DD\x20HH:mm:ss','ids','spread','dialCheckDuplicateType','always','insert','fromQuery','phone','scheduledAt','ContactId','ListId','createdAt','field','NOW()','CmListId','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','toString','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','cm_hopper','onlyIfOpen','CampaignId\x20=\x20?','into','cm_hopper_additional_phones','OrderBy','ci.item','ci.OrderBY','cm_contact_has_items','h.ListId\x20=\x20?','push','sequelize','removeLists','getBlackLists','addBlackLists','cm_hopper_black','all','removeBlackLists','eml-format','moment','bluebird','mustache','util','sox','ejs','fs-extra','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','set','apply','update','then','destroy','get','IvrCampaigns','UserProfileResource','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys'];(function(_0x46327a,_0x17137c){var _0x1c6834=function(_0x718d81){while(--_0x718d81){_0x46327a['push'](_0x46327a['shift']());}};_0x1c6834(++_0x17137c);}(_0x32d3,0xee));var _0x332d=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x32d3[_0x1facfa];return _0x9ec701;};'use strict';var emlformat=require(_0x332d('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x332d('0x1'));var BPromise=require(_0x332d('0x2'));var Mustache=require(_0x332d('0x3'));var util=require(_0x332d('0x4'));var path=require('path');var sox=require(_0x332d('0x5'));var csv=require('to-csv');var ejs=require(_0x332d('0x6'));var fs=require('fs');var fs_extra=require(_0x332d('0x7'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x332d('0x8'));var jsforce=require(_0x332d('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x332d('0xa'));var querystring=require('querystring');var Papa=require(_0x332d('0xb'));var Redis=require(_0x332d('0xc'));var authService=require(_0x332d('0xd'));var qs=require(_0x332d('0xe'));var as=require(_0x332d('0xf'));var hardwareService=require(_0x332d('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0x332d('0x11'));var config=require(_0x332d('0x12'));var licenseUtil=require(_0x332d('0x13'));var db=require(_0x332d('0x14'))['db'];function respondWithStatusCode(_0x40a446,_0xc71fba){_0xc71fba=_0xc71fba||0xcc;return function(_0x295245){if(_0x295245){return _0x40a446['sendStatus'](_0xc71fba);}return _0x40a446[_0x332d('0x15')](_0xc71fba)[_0x332d('0x16')]();};}function respondWithResult(_0x3db576,_0x528377){_0x528377=_0x528377||0xc8;return function(_0x38dc23){if(_0x38dc23){return _0x3db576[_0x332d('0x15')](_0x528377)[_0x332d('0x17')](_0x38dc23);}};}function respondWithFilteredResult(_0x1a4330,_0x118a6d){return function(_0x2896a9){if(_0x2896a9){var _0x5092ca=typeof _0x118a6d[_0x332d('0x18')]==='undefined'&&typeof _0x118a6d['limit']===_0x332d('0x19');var _0xbdb53d=_0x2896a9[_0x332d('0x1a')];var _0xc63cba=_0x5092ca?0x0:_0x118a6d[_0x332d('0x18')];var _0x2edae3=_0x5092ca?_0x2896a9[_0x332d('0x1a')]:_0x118a6d[_0x332d('0x18')]+_0x118a6d['limit'];var _0x5bd6f3;if(_0x2edae3>=_0xbdb53d){_0x2edae3=_0xbdb53d;_0x5bd6f3=0xc8;}else{_0x5bd6f3=0xce;}_0x1a4330[_0x332d('0x15')](_0x5bd6f3);return _0x1a4330[_0x332d('0x1b')]('Content-Range',_0xc63cba+'-'+_0x2edae3+'/'+_0xbdb53d)[_0x332d('0x17')](_0x2896a9);}return null;};}function patchUpdates(_0x46b208){return function(_0x1983e9){try{jsonpatch[_0x332d('0x1c')](_0x1983e9,_0x46b208,!![]);}catch(_0x1c589d){return BPromise['reject'](_0x1c589d);}return _0x1983e9['save']();};}function saveUpdates(_0x56aee9,_0x14fa2f){return function(_0x2dcb2c){if(_0x2dcb2c){return _0x2dcb2c[_0x332d('0x1d')](_0x56aee9)[_0x332d('0x1e')](function(_0x3f421e){return _0x3f421e;});}return null;};}function removeEntity(_0x237fa4,_0x12a398){return function(_0x3b32f0){if(_0x3b32f0){return _0x3b32f0[_0x332d('0x1f')]()[_0x332d('0x1e')](function(){var _0x5263d4=_0x3b32f0[_0x332d('0x20')]({'plain':!![]});var _0x43ce73=_0x332d('0x21');return db[_0x332d('0x22')][_0x332d('0x1f')]({'where':{'type':_0x43ce73,'resourceId':_0x5263d4['id']}})[_0x332d('0x1e')](function(){return _0x3b32f0;});})[_0x332d('0x1e')](function(){_0x237fa4[_0x332d('0x15')](0xcc)[_0x332d('0x16')]();});}};}function handleEntityNotFound(_0x46b5ab,_0x1a3163){return function(_0x599e4f){if(!_0x599e4f){_0x46b5ab['sendStatus'](0x194);}return _0x599e4f;};}function handleError(_0x46c268,_0x1a4a24){_0x1a4a24=_0x1a4a24||0x1f4;return function(_0x2cd43e){logger['error'](_0x2cd43e[_0x332d('0x23')]);if(_0x2cd43e[_0x332d('0x24')]){delete _0x2cd43e[_0x332d('0x24')];}_0x46c268[_0x332d('0x15')](_0x1a4a24)[_0x332d('0x25')](_0x2cd43e);};}exports['index']=function(_0x4367f1,_0xcdd271){var _0x3ff2a3={},_0x233362={},_0x1f53de={'count':0x0,'rows':[]};var _0x47efa1=_[_0x332d('0x26')](db['Campaign'][_0x332d('0x27')],function(_0x166be6){return{'name':_0x166be6[_0x332d('0x28')],'type':_0x166be6[_0x332d('0x29')][_0x332d('0x2a')]};});_0x233362[_0x332d('0x2b')]=_[_0x332d('0x26')](_0x47efa1,'name');_0x233362[_0x332d('0x2c')]=_[_0x332d('0x2d')](_0x4367f1['query']);_0x233362['filters']=_[_0x332d('0x2e')](_0x233362['model'],_0x233362['query']);_0x3ff2a3[_0x332d('0x2f')]=_[_0x332d('0x2e')](_0x233362[_0x332d('0x2b')],qs['fields'](_0x4367f1[_0x332d('0x2c')][_0x332d('0x30')]));_0x3ff2a3[_0x332d('0x2f')]=_0x3ff2a3[_0x332d('0x2f')]['length']?_0x3ff2a3[_0x332d('0x2f')]:_0x233362[_0x332d('0x2b')];if(!_0x4367f1[_0x332d('0x2c')][_0x332d('0x31')](_0x332d('0x32'))){_0x3ff2a3['limit']=qs[_0x332d('0x33')](_0x4367f1['query'][_0x332d('0x33')]);_0x3ff2a3[_0x332d('0x18')]=qs[_0x332d('0x18')](_0x4367f1[_0x332d('0x2c')]['offset']);}_0x3ff2a3[_0x332d('0x34')]=qs[_0x332d('0x35')](_0x4367f1[_0x332d('0x2c')][_0x332d('0x35')]);_0x3ff2a3[_0x332d('0x36')]=qs[_0x332d('0x37')](_[_0x332d('0x38')](_0x4367f1['query'],_0x233362[_0x332d('0x37')]),_0x47efa1);if(_0x4367f1[_0x332d('0x2c')][_0x332d('0x39')]){_0x3ff2a3['where']=_[_0x332d('0x3a')](_0x3ff2a3['where'],{'$or':_[_0x332d('0x26')](_0x47efa1,function(_0x33d38c){if(_0x33d38c[_0x332d('0x29')]!==_0x332d('0x3b')){var _0xb8859c={};_0xb8859c[_0x33d38c[_0x332d('0x24')]]={'$like':'%'+_0x4367f1['query'][_0x332d('0x39')]+'%'};return _0xb8859c;}})});}_0x3ff2a3=_[_0x332d('0x3a')]({},_0x3ff2a3,_0x4367f1[_0x332d('0x3c')]);var _0x36ad78={'where':_0x3ff2a3[_0x332d('0x36')]};return db[_0x332d('0x3d')][_0x332d('0x1a')](_0x36ad78)[_0x332d('0x1e')](function(_0x5e97e3){_0x1f53de[_0x332d('0x1a')]=_0x5e97e3;if(_0x4367f1[_0x332d('0x2c')][_0x332d('0x3e')]){_0x3ff2a3[_0x332d('0x3f')]=[{'all':!![]}];}return db[_0x332d('0x3d')]['findAll'](_0x3ff2a3);})[_0x332d('0x1e')](function(_0x4074e9){_0x1f53de[_0x332d('0x40')]=_0x4074e9;return _0x1f53de;})[_0x332d('0x1e')](respondWithFilteredResult(_0xcdd271,_0x3ff2a3))['catch'](handleError(_0xcdd271,null));};exports[_0x332d('0x41')]=function(_0x192c0a,_0x2df00f){var _0x23bd55={'raw':![],'where':{'id':_0x192c0a['params']['id']}},_0x3fa8fe={};_0x3fa8fe[_0x332d('0x2b')]=_[_0x332d('0x2d')](db['Campaign'][_0x332d('0x27')]);_0x3fa8fe[_0x332d('0x2c')]=_[_0x332d('0x2d')](_0x192c0a[_0x332d('0x2c')]);_0x3fa8fe[_0x332d('0x37')]=_[_0x332d('0x2e')](_0x3fa8fe[_0x332d('0x2b')],_0x3fa8fe[_0x332d('0x2c')]);_0x23bd55[_0x332d('0x2f')]=_[_0x332d('0x2e')](_0x3fa8fe[_0x332d('0x2b')],qs[_0x332d('0x30')](_0x192c0a[_0x332d('0x2c')][_0x332d('0x30')]));_0x23bd55[_0x332d('0x2f')]=_0x23bd55['attributes']['length']?_0x23bd55['attributes']:_0x3fa8fe[_0x332d('0x2b')];if(_0x192c0a['query'][_0x332d('0x3e')]){_0x23bd55[_0x332d('0x3f')]=[{'all':!![]}];}_0x23bd55=_['merge']({},_0x23bd55,_0x192c0a['options']);return db[_0x332d('0x3d')][_0x332d('0x42')](_0x23bd55)[_0x332d('0x1e')](handleEntityNotFound(_0x2df00f,null))[_0x332d('0x1e')](respondWithResult(_0x2df00f,null))[_0x332d('0x43')](handleError(_0x2df00f,null));};exports[_0x332d('0x44')]=function(_0x2770b8,_0x39c240){return db[_0x332d('0x3d')]['create'](_0x2770b8[_0x332d('0x45')],{})[_0x332d('0x1e')](function(_0x1f9cb3){var _0x350cb0=_0x2770b8['user'][_0x332d('0x20')]({'plain':!![]});if(!_0x350cb0)throw new Error(_0x332d('0x46'));if(_0x350cb0[_0x332d('0x47')]===_0x332d('0x48')){var _0x35699e=_0x1f9cb3['get']({'plain':!![]});var _0x5438f2=_0x332d('0x21');return db[_0x332d('0x49')][_0x332d('0x42')]({'where':{'name':_0x5438f2,'userProfileId':_0x350cb0['userProfileId']},'raw':!![]})['then'](function(_0x12c21f){if(_0x12c21f&&_0x12c21f[_0x332d('0x4a')]===0x0){return db['UserProfileResource'][_0x332d('0x44')]({'name':_0x35699e[_0x332d('0x24')],'resourceId':_0x35699e['id'],'type':_0x12c21f[_0x332d('0x24')],'sectionId':_0x12c21f['id']},{})[_0x332d('0x1e')](function(){return _0x1f9cb3;});}else{return _0x1f9cb3;}})[_0x332d('0x43')](function(_0x5b6a92){logger[_0x332d('0x4b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5b6a92);throw _0x5b6a92;});}return _0x1f9cb3;})['then'](respondWithResult(_0x39c240,0xc9))[_0x332d('0x43')](handleError(_0x39c240,null));};exports[_0x332d('0x4c')]=function(_0xcdc4b6,_0x17ec91){var _0x53daba={'where':{'id':_0xcdc4b6[_0x332d('0x4d')]['id']}},_0x1b8c55={};_0x1b8c55[_0x332d('0x2b')]=_[_0x332d('0x2d')](db['Campaign'][_0x332d('0x27')]);_0x53daba['attributes']=_[_0x332d('0x2e')](_0x1b8c55[_0x332d('0x2b')],qs[_0x332d('0x30')](_0xcdc4b6[_0x332d('0x2c')]['fields']));_0x53daba[_0x332d('0x2f')]=_0x53daba[_0x332d('0x2f')][_0x332d('0x4e')]?_0x53daba[_0x332d('0x2f')]:_0x1b8c55[_0x332d('0x2b')];if(_0xcdc4b6['query'][_0x332d('0x3e')]){_0x53daba[_0x332d('0x3f')]=[{'all':!![]}];}_0x53daba=_[_0x332d('0x3a')]({},_0x53daba,_0xcdc4b6[_0x332d('0x3c')]);return db[_0x332d('0x3d')][_0x332d('0x42')](_0x53daba)[_0x332d('0x1e')](handleEntityNotFound(_0x17ec91,null))[_0x332d('0x1e')](function(_0x5af047){if(_0x5af047){var _0x341bd8=_0x5af047[_0x332d('0x20')]({'plain':!![]});_0x341bd8=qs['omit'](_0x341bd8,['id','createdAt',_0x332d('0x4f')]);_0xcdc4b6[_0x332d('0x45')]=_[_0x332d('0x50')](_0xcdc4b6[_0x332d('0x45')],['id','createdAt',_0x332d('0x4f')]);return db[_0x332d('0x3d')][_0x332d('0x44')](_[_0x332d('0x3a')](_0x341bd8,_0xcdc4b6[_0x332d('0x45')]),{'include':_0xcdc4b6['query'][_0x332d('0x3e')]?[{'all':!![]}]:undefined})[_0x332d('0x1e')](function(_0x2ab79e){var _0x2ad064=_0xcdc4b6[_0x332d('0x48')]['get']({'plain':!![]});if(!_0x2ad064)throw new Error(_0x332d('0x46'));if(_0x2ad064[_0x332d('0x47')]===_0x332d('0x48')){var _0x14c073=_0x2ab79e['get']({'plain':!![]});var _0x41129a=_0x332d('0x21');return db[_0x332d('0x49')][_0x332d('0x42')]({'where':{'name':_0x41129a,'userProfileId':_0x2ad064[_0x332d('0x51')]},'raw':!![]})[_0x332d('0x1e')](function(_0x3c456a){if(_0x3c456a&&_0x3c456a['autoAssociation']===0x0){return db[_0x332d('0x22')]['create']({'name':_0x14c073[_0x332d('0x24')],'resourceId':_0x14c073['id'],'type':_0x3c456a[_0x332d('0x24')],'sectionId':_0x3c456a['id']},{})['then'](function(){return _0x2ab79e;});}else{return _0x2ab79e;}})[_0x332d('0x43')](function(_0x589544){logger[_0x332d('0x4b')](_0x332d('0x52'),_0x589544);throw _0x589544;});}return _0x2ab79e;});}})['then'](respondWithResult(_0x17ec91,0xc9))[_0x332d('0x43')](handleError(_0x17ec91,null));};exports['update']=function(_0x205b02,_0x580ac6){if(_0x205b02[_0x332d('0x45')]['id']){delete _0x205b02['body']['id'];}return db[_0x332d('0x3d')][_0x332d('0x42')]({'where':{'id':_0x205b02['params']['id']}})[_0x332d('0x1e')](handleEntityNotFound(_0x580ac6,null))[_0x332d('0x1e')](saveUpdates(_0x205b02['body'],null))[_0x332d('0x1e')](respondWithResult(_0x580ac6,null))[_0x332d('0x43')](handleError(_0x580ac6,null));};exports['destroy']=function(_0x240c54,_0x13cd68){return db['Campaign']['find']({'where':{'id':_0x240c54['params']['id']}})[_0x332d('0x1e')](handleEntityNotFound(_0x13cd68,null))[_0x332d('0x1e')](removeEntity(_0x13cd68,null))[_0x332d('0x43')](handleError(_0x13cd68,null));};exports[_0x332d('0x53')]=function(_0x4ebc83,_0x346657,_0x439c1f){var _0x5cc33e={'raw':!![],'where':{}};var _0x32167e={};var _0x162068={'count':0x0,'rows':[]};return db[_0x332d('0x3d')][_0x332d('0x54')]({'where':{'id':_0x4ebc83[_0x332d('0x4d')]['id']}})[_0x332d('0x1e')](handleEntityNotFound(_0x346657,null))[_0x332d('0x1e')](function(_0x2c2915){if(_0x2c2915){_0x32167e[_0x332d('0x2b')]=_[_0x332d('0x2d')](db[_0x332d('0x55')]['rawAttributes']);_0x32167e[_0x332d('0x2c')]=_['keys'](_0x4ebc83['query']);_0x32167e[_0x332d('0x37')]=_[_0x332d('0x2e')](_0x32167e[_0x332d('0x2b')],_0x32167e[_0x332d('0x2c')]);_0x5cc33e[_0x332d('0x2f')]=_[_0x332d('0x2e')](_0x32167e[_0x332d('0x2b')],qs['fields'](_0x4ebc83[_0x332d('0x2c')]['fields']));_0x5cc33e['attributes']=_0x5cc33e[_0x332d('0x2f')][_0x332d('0x4e')]?_0x5cc33e[_0x332d('0x2f')]:_0x32167e[_0x332d('0x2b')];if(!_0x4ebc83[_0x332d('0x2c')][_0x332d('0x31')](_0x332d('0x32'))){_0x5cc33e['limit']=qs[_0x332d('0x33')](_0x4ebc83[_0x332d('0x2c')][_0x332d('0x33')]);_0x5cc33e[_0x332d('0x18')]=qs[_0x332d('0x18')](_0x4ebc83[_0x332d('0x2c')][_0x332d('0x18')]);}_0x5cc33e[_0x332d('0x34')]=qs[_0x332d('0x35')](_0x4ebc83[_0x332d('0x2c')][_0x332d('0x35')]);_0x5cc33e[_0x332d('0x36')]=qs[_0x332d('0x37')](_[_0x332d('0x38')](_0x4ebc83['query'],_0x32167e['filters']));_0x5cc33e[_0x332d('0x36')]['CampaignId']=_0x2c2915['id'];if(_0x4ebc83['query'][_0x332d('0x39')]){_0x5cc33e[_0x332d('0x36')]=_[_0x332d('0x3a')](_0x5cc33e['where'],{'$or':_[_0x332d('0x26')](_0x5cc33e[_0x332d('0x2f')],function(_0x54ed46){var _0x472a48={};_0x472a48[_0x54ed46]={'$like':'%'+_0x4ebc83[_0x332d('0x2c')]['filter']+'%'};return _0x472a48;})});}_0x5cc33e=_[_0x332d('0x3a')]({},_0x5cc33e,_0x4ebc83[_0x332d('0x3c')]);return db[_0x332d('0x55')][_0x332d('0x1a')]({'where':_0x5cc33e[_0x332d('0x36')]})[_0x332d('0x1e')](function(_0x54d861){_0x162068[_0x332d('0x1a')]=_0x54d861;if(_0x4ebc83[_0x332d('0x2c')][_0x332d('0x3e')]){_0x5cc33e[_0x332d('0x3f')]=[{'all':!![]}];}return db[_0x332d('0x55')][_0x332d('0x56')](_0x5cc33e);})[_0x332d('0x1e')](function(_0x50d7c7){_0x162068['rows']=_0x50d7c7;return _0x162068;});}})[_0x332d('0x1e')](respondWithFilteredResult(_0x346657,_0x5cc33e))[_0x332d('0x43')](handleError(_0x346657,null));};exports[_0x332d('0x57')]=function(_0x28b42d,_0x2a14bd,_0x1594f1){var _0x8bcfea={'raw':!![],'where':{}};var _0x42464d={};var _0x41700b={'count':0x0,'rows':[]};return db[_0x332d('0x3d')][_0x332d('0x54')]({'where':{'id':_0x28b42d[_0x332d('0x4d')]['id']}})[_0x332d('0x1e')](handleEntityNotFound(_0x2a14bd,null))['then'](function(_0x5646df){if(_0x5646df){_0x42464d[_0x332d('0x2b')]=_[_0x332d('0x2d')](db['CmHopperHistory'][_0x332d('0x27')]);_0x42464d['query']=_[_0x332d('0x2d')](_0x28b42d[_0x332d('0x2c')]);_0x42464d['filters']=_[_0x332d('0x2e')](_0x42464d[_0x332d('0x2b')],_0x42464d[_0x332d('0x2c')]);_0x8bcfea['attributes']=_['intersection'](_0x42464d[_0x332d('0x2b')],qs[_0x332d('0x30')](_0x28b42d['query'][_0x332d('0x30')]));_0x8bcfea[_0x332d('0x2f')]=_0x8bcfea[_0x332d('0x2f')][_0x332d('0x4e')]?_0x8bcfea['attributes']:_0x42464d['model'];if(!_0x28b42d[_0x332d('0x2c')]['hasOwnProperty'](_0x332d('0x32'))){_0x8bcfea[_0x332d('0x33')]=qs[_0x332d('0x33')](_0x28b42d['query'][_0x332d('0x33')]);_0x8bcfea['offset']=qs['offset'](_0x28b42d[_0x332d('0x2c')][_0x332d('0x18')]);}_0x8bcfea[_0x332d('0x34')]=qs[_0x332d('0x35')](_0x28b42d[_0x332d('0x2c')][_0x332d('0x35')]);_0x8bcfea[_0x332d('0x36')]=qs[_0x332d('0x37')](_[_0x332d('0x38')](_0x28b42d[_0x332d('0x2c')],_0x42464d[_0x332d('0x37')]));_0x8bcfea['where'][_0x332d('0x58')]=_0x5646df['id'];if(_0x28b42d[_0x332d('0x2c')][_0x332d('0x39')]){_0x8bcfea[_0x332d('0x36')]=_['merge'](_0x8bcfea[_0x332d('0x36')],{'$or':_[_0x332d('0x26')](_0x8bcfea[_0x332d('0x2f')],function(_0x4c37cf){var _0x56f9a9={};_0x56f9a9[_0x4c37cf]={'$like':'%'+_0x28b42d[_0x332d('0x2c')]['filter']+'%'};return _0x56f9a9;})});}_0x8bcfea=_[_0x332d('0x3a')]({},_0x8bcfea,_0x28b42d['options']);return db[_0x332d('0x59')][_0x332d('0x1a')]({'where':_0x8bcfea[_0x332d('0x36')]})[_0x332d('0x1e')](function(_0x505e78){_0x41700b['count']=_0x505e78;if(_0x28b42d[_0x332d('0x2c')]['includeAll']){_0x8bcfea[_0x332d('0x3f')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x332d('0x56')](_0x8bcfea);})[_0x332d('0x1e')](function(_0x576836){_0x41700b[_0x332d('0x40')]=_0x576836;return _0x41700b;});}})['then'](respondWithFilteredResult(_0x2a14bd,_0x8bcfea))[_0x332d('0x43')](handleError(_0x2a14bd,null));};exports[_0x332d('0x5a')]=function(_0x416ad0,_0x18d349,_0x536dcd){var _0x2d4354={'raw':!![],'where':{}};var _0x5022e1={};var _0x486990={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x416ad0[_0x332d('0x4d')]['id']}})[_0x332d('0x1e')](handleEntityNotFound(_0x18d349,null))[_0x332d('0x1e')](function(_0x34f23){if(_0x34f23){_0x5022e1[_0x332d('0x2b')]=_[_0x332d('0x2d')](db[_0x332d('0x5b')][_0x332d('0x27')]);_0x5022e1['query']=_['keys'](_0x416ad0[_0x332d('0x2c')]);_0x5022e1[_0x332d('0x37')]=_['intersection'](_0x5022e1[_0x332d('0x2b')],_0x5022e1[_0x332d('0x2c')]);_0x2d4354['attributes']=_[_0x332d('0x2e')](_0x5022e1[_0x332d('0x2b')],qs[_0x332d('0x30')](_0x416ad0[_0x332d('0x2c')][_0x332d('0x30')]));_0x2d4354[_0x332d('0x2f')]=_0x2d4354['attributes']['length']?_0x2d4354['attributes']:_0x5022e1[_0x332d('0x2b')];if(!_0x416ad0['query']['hasOwnProperty'](_0x332d('0x32'))){_0x2d4354[_0x332d('0x33')]=qs[_0x332d('0x33')](_0x416ad0[_0x332d('0x2c')][_0x332d('0x33')]);_0x2d4354[_0x332d('0x18')]=qs[_0x332d('0x18')](_0x416ad0[_0x332d('0x2c')][_0x332d('0x18')]);}_0x2d4354[_0x332d('0x34')]=qs[_0x332d('0x35')](_0x416ad0[_0x332d('0x2c')][_0x332d('0x35')]);_0x2d4354[_0x332d('0x36')]=qs[_0x332d('0x37')](_[_0x332d('0x38')](_0x416ad0[_0x332d('0x2c')],_0x5022e1[_0x332d('0x37')]));_0x2d4354[_0x332d('0x36')]['CampaignId']=_0x34f23['id'];if(_0x416ad0['query'][_0x332d('0x39')]){_0x2d4354['where']=_[_0x332d('0x3a')](_0x2d4354[_0x332d('0x36')],{'$or':_[_0x332d('0x26')](_0x2d4354['attributes'],function(_0x14fc36){var _0x27ed1c={};_0x27ed1c[_0x14fc36]={'$like':'%'+_0x416ad0[_0x332d('0x2c')][_0x332d('0x39')]+'%'};return _0x27ed1c;})});}_0x2d4354=_[_0x332d('0x3a')]({},_0x2d4354,_0x416ad0[_0x332d('0x3c')]);return db[_0x332d('0x5b')]['count']({'where':_0x2d4354[_0x332d('0x36')]})[_0x332d('0x1e')](function(_0x2d2438){_0x486990[_0x332d('0x1a')]=_0x2d2438;if(_0x416ad0[_0x332d('0x2c')][_0x332d('0x3e')]){_0x2d4354[_0x332d('0x3f')]=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x2d4354);})[_0x332d('0x1e')](function(_0x27bb25){_0x486990[_0x332d('0x40')]=_0x27bb25;return _0x486990;});}})[_0x332d('0x1e')](respondWithFilteredResult(_0x18d349,_0x2d4354))[_0x332d('0x43')](handleError(_0x18d349,null));};exports[_0x332d('0x5c')]=function(_0x28fcea,_0x4c6246,_0x467cc8){var _0x4e61a4={'raw':!![],'where':{}};var _0x278a24={};var _0x36b7a8={'count':0x0,'rows':[]};return db[_0x332d('0x3d')][_0x332d('0x54')]({'where':{'id':_0x28fcea['params']['id']}})[_0x332d('0x1e')](handleEntityNotFound(_0x4c6246,null))[_0x332d('0x1e')](function(_0x12303d){if(_0x12303d){_0x278a24[_0x332d('0x2b')]=_[_0x332d('0x2d')](db[_0x332d('0x5d')][_0x332d('0x27')]);_0x278a24[_0x332d('0x2c')]=_[_0x332d('0x2d')](_0x28fcea[_0x332d('0x2c')]);_0x278a24[_0x332d('0x37')]=_[_0x332d('0x2e')](_0x278a24[_0x332d('0x2b')],_0x278a24[_0x332d('0x2c')]);_0x4e61a4[_0x332d('0x2f')]=_['intersection'](_0x278a24['model'],qs['fields'](_0x28fcea[_0x332d('0x2c')][_0x332d('0x30')]));_0x4e61a4['attributes']=_0x4e61a4['attributes']['length']?_0x4e61a4[_0x332d('0x2f')]:_0x278a24[_0x332d('0x2b')];if(!_0x28fcea[_0x332d('0x2c')]['hasOwnProperty'](_0x332d('0x32'))){_0x4e61a4[_0x332d('0x33')]=qs[_0x332d('0x33')](_0x28fcea[_0x332d('0x2c')][_0x332d('0x33')]);_0x4e61a4[_0x332d('0x18')]=qs[_0x332d('0x18')](_0x28fcea[_0x332d('0x2c')][_0x332d('0x18')]);}_0x4e61a4[_0x332d('0x34')]=qs[_0x332d('0x35')](_0x28fcea[_0x332d('0x2c')][_0x332d('0x35')]);_0x4e61a4[_0x332d('0x36')]=qs['filters'](_[_0x332d('0x38')](_0x28fcea['query'],_0x278a24['filters']));_0x4e61a4['where'][_0x332d('0x58')]=_0x12303d['id'];if(_0x28fcea[_0x332d('0x2c')][_0x332d('0x39')]){_0x4e61a4[_0x332d('0x36')]=_[_0x332d('0x3a')](_0x4e61a4[_0x332d('0x36')],{'$or':_[_0x332d('0x26')](_0x4e61a4['attributes'],function(_0x1bc499){var _0xe201cd={};_0xe201cd[_0x1bc499]={'$like':'%'+_0x28fcea[_0x332d('0x2c')][_0x332d('0x39')]+'%'};return _0xe201cd;})});}_0x4e61a4=_[_0x332d('0x3a')]({},_0x4e61a4,_0x28fcea[_0x332d('0x3c')]);return db[_0x332d('0x5d')][_0x332d('0x1a')]({'where':_0x4e61a4['where']})[_0x332d('0x1e')](function(_0x4baf92){_0x36b7a8['count']=_0x4baf92;if(_0x28fcea[_0x332d('0x2c')][_0x332d('0x3e')]){_0x4e61a4[_0x332d('0x3f')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x332d('0x56')](_0x4e61a4);})[_0x332d('0x1e')](function(_0x45cee5){_0x36b7a8[_0x332d('0x40')]=_0x45cee5;return _0x36b7a8;});}})['then'](respondWithFilteredResult(_0x4c6246,_0x4e61a4))[_0x332d('0x43')](handleError(_0x4c6246,null));};exports[_0x332d('0x5e')]=function(_0x5cc2cc,_0x417994,_0x26f0ca){var _0x7877ad={};var _0x31c186={};var _0x483978;var _0x377b7c;return db['Campaign'][_0x332d('0x54')]({'where':{'id':_0x5cc2cc[_0x332d('0x4d')]['id']}})[_0x332d('0x1e')](handleEntityNotFound(_0x417994,null))['then'](function(_0x39d336){if(_0x39d336){_0x483978=_0x39d336;_0x31c186[_0x332d('0x2b')]=_[_0x332d('0x2d')](db[_0x332d('0x5f')][_0x332d('0x27')]);_0x31c186[_0x332d('0x2c')]=_['keys'](_0x5cc2cc[_0x332d('0x2c')]);_0x31c186['filters']=_[_0x332d('0x2e')](_0x31c186['model'],_0x31c186[_0x332d('0x2c')]);_0x7877ad['attributes']=_[_0x332d('0x2e')](_0x31c186[_0x332d('0x2b')],qs[_0x332d('0x30')](_0x5cc2cc[_0x332d('0x2c')]['fields']));_0x7877ad['attributes']=_0x7877ad[_0x332d('0x2f')][_0x332d('0x4e')]?_0x7877ad[_0x332d('0x2f')]:_0x31c186[_0x332d('0x2b')];_0x7877ad[_0x332d('0x34')]=qs[_0x332d('0x35')](_0x5cc2cc['query'][_0x332d('0x35')]);_0x7877ad[_0x332d('0x36')]=qs[_0x332d('0x37')](_['pick'](_0x5cc2cc['query'],_0x31c186[_0x332d('0x37')]));if(_0x5cc2cc[_0x332d('0x2c')][_0x332d('0x39')]){_0x7877ad[_0x332d('0x36')]=_[_0x332d('0x3a')](_0x7877ad[_0x332d('0x36')],{'$or':_['map'](_0x7877ad[_0x332d('0x2f')],function(_0x529d70){var _0x4c7df9={};_0x4c7df9[_0x529d70]={'$like':'%'+_0x5cc2cc[_0x332d('0x2c')][_0x332d('0x39')]+'%'};return _0x4c7df9;})});}_0x7877ad=_[_0x332d('0x3a')]({},_0x7877ad,_0x5cc2cc[_0x332d('0x3c')]);return _0x483978['getLists'](_0x7877ad);}})[_0x332d('0x1e')](function(_0x201b4c){if(_0x201b4c){_0x377b7c=_0x201b4c[_0x332d('0x4e')];if(!_0x5cc2cc[_0x332d('0x2c')]['hasOwnProperty'](_0x332d('0x32'))){_0x7877ad[_0x332d('0x33')]=qs[_0x332d('0x33')](_0x5cc2cc[_0x332d('0x2c')]['limit']);_0x7877ad[_0x332d('0x18')]=qs[_0x332d('0x18')](_0x5cc2cc[_0x332d('0x2c')][_0x332d('0x18')]);}return _0x483978[_0x332d('0x5e')](_0x7877ad);}})[_0x332d('0x1e')](function(_0x370485){if(_0x370485){return _0x370485?{'count':_0x377b7c,'rows':_0x370485}:null;}})[_0x332d('0x1e')](respondWithResult(_0x417994,null))['catch'](handleError(_0x417994,null));};exports[_0x332d('0x60')]=function(_0x3fdc2f,_0x5d6cbb,_0x42ceb2){var _0x11d198,_0x1d2f9f;var _0x1d4f1e=[];var _0x1fc1af=moment()[_0x332d('0x61')](_0x332d('0x62'));return db['Campaign'][_0x332d('0x42')]({'where':{'id':_0x3fdc2f['params']['id']}})[_0x332d('0x1e')](handleEntityNotFound(_0x5d6cbb,null))[_0x332d('0x1e')](function(_0x44ce86){if(_0x44ce86){_0x1d2f9f=_0x44ce86;return _0x44ce86[_0x332d('0x60')](_0x3fdc2f['body'][_0x332d('0x63')],_[_0x332d('0x50')](_0x3fdc2f[_0x332d('0x45')],[_0x332d('0x63'),'id'])||{});}return null;})[_0x332d('0x64')](function(_0x4d7fc9){var _0x3d2c93;var _0x435cfb;_0x11d198=_0x4d7fc9||[];var _0x3f95a1=[];if(_0x4d7fc9){for(var _0x4cb026=0x0;_0x4cb026<_0x4d7fc9[_0x332d('0x4e')];_0x4cb026+=0x1){var _0x2de76a=_0x4d7fc9[_0x4cb026][_0x332d('0x20')]({'plain':!![]});_0x1d2f9f[_0x332d('0x65')]=_0x3fdc2f[_0x332d('0x45')][_0x332d('0x65')]?_0x3fdc2f[_0x332d('0x45')][_0x332d('0x65')]:_0x1d2f9f['dialCheckDuplicateType'];switch(_0x1d2f9f[_0x332d('0x65')]){case _0x332d('0x66'):_0x3d2c93=squel[_0x332d('0x67')]()['into']('cm_hopper')[_0x332d('0x68')]([_0x332d('0x69'),_0x332d('0x6a'),_0x332d('0x6b'),_0x332d('0x6c'),'CampaignId',_0x332d('0x6d'),_0x332d('0x4f')],squel['select']()[_0x332d('0x6e')](_0x332d('0x69'),_0x332d('0x69'))['field'](_0x332d('0x6f'),_0x332d('0x6a'))[_0x332d('0x6e')]('id',_0x332d('0x6b'))[_0x332d('0x6e')](_0x2de76a[_0x332d('0x70')]['toString'](),'ListId')[_0x332d('0x6e')](_0x3fdc2f[_0x332d('0x4d')]['id']['toString'](),'CampaignId')[_0x332d('0x6e')]('\x27'+_0x1fc1af+'\x27',_0x332d('0x6d'))[_0x332d('0x6e')]('\x27'+_0x1fc1af+'\x27',_0x332d('0x4f'))[_0x332d('0x71')](_0x332d('0x72'))[_0x332d('0x36')](_0x332d('0x73'))[_0x332d('0x36')](_0x332d('0x74'),_0x2de76a[_0x332d('0x70')][_0x332d('0x75')]())['where'](_0x332d('0x76'))[_0x332d('0x36')](_0x332d('0x77'),squel[_0x332d('0x78')]()[_0x332d('0x6e')](_0x332d('0x79'))['from'](_0x332d('0x7a'))[_0x332d('0x36')]('CampaignId\x20=\x20?',_0x3fdc2f[_0x332d('0x4d')]['id'][_0x332d('0x75')]()))['where'](_0x332d('0x77'),squel['select']()[_0x332d('0x6e')](_0x332d('0x7b'))[_0x332d('0x71')](_0x332d('0x7c'))['where']('CampaignId\x20=\x20?',_0x3fdc2f[_0x332d('0x4d')]['id'][_0x332d('0x75')]())))[_0x332d('0x75')]();break;case _0x332d('0x7d'):_0x3d2c93=squel[_0x332d('0x67')]()['into'](_0x332d('0x7c'))[_0x332d('0x68')]([_0x332d('0x69'),_0x332d('0x6a'),_0x332d('0x6b'),'ListId',_0x332d('0x58'),_0x332d('0x6d'),'updatedAt'],squel[_0x332d('0x78')]()[_0x332d('0x6e')](_0x332d('0x69'),_0x332d('0x69'))[_0x332d('0x6e')]('NOW()',_0x332d('0x6a'))['field']('id',_0x332d('0x6b'))['field'](_0x2de76a[_0x332d('0x70')]['toString'](),_0x332d('0x6c'))[_0x332d('0x6e')](_0x3fdc2f[_0x332d('0x4d')]['id'][_0x332d('0x75')](),'CampaignId')[_0x332d('0x6e')]('\x27'+_0x1fc1af+'\x27',_0x332d('0x6d'))[_0x332d('0x6e')]('\x27'+_0x1fc1af+'\x27',_0x332d('0x4f'))['from'](_0x332d('0x72'))[_0x332d('0x36')](_0x332d('0x73'))[_0x332d('0x36')](_0x332d('0x74'),_0x2de76a[_0x332d('0x70')][_0x332d('0x75')]())[_0x332d('0x36')]('phone\x20IS\x20NOT\x20NULL')[_0x332d('0x36')](_0x332d('0x77'),squel[_0x332d('0x78')]()[_0x332d('0x6e')]('COALESCE(phone,\x27\x27)')[_0x332d('0x71')](_0x332d('0x7c'))['where'](_0x332d('0x7e'),_0x3fdc2f[_0x332d('0x4d')]['id']['toString']())))['toString']();break;default:_0x3d2c93=squel[_0x332d('0x67')]()[_0x332d('0x7f')]('cm_hopper')[_0x332d('0x68')](['phone',_0x332d('0x6a'),_0x332d('0x6b'),_0x332d('0x6c'),_0x332d('0x58'),_0x332d('0x6d'),_0x332d('0x4f')],squel[_0x332d('0x78')]()[_0x332d('0x6e')](_0x332d('0x69'),_0x332d('0x69'))['field'](_0x332d('0x6f'),_0x332d('0x6a'))[_0x332d('0x6e')]('id','ContactId')[_0x332d('0x6e')](_0x2de76a[_0x332d('0x70')][_0x332d('0x75')](),_0x332d('0x6c'))[_0x332d('0x6e')](_0x3fdc2f['params']['id'][_0x332d('0x75')](),_0x332d('0x58'))[_0x332d('0x6e')]('\x27'+_0x1fc1af+'\x27',_0x332d('0x6d'))[_0x332d('0x6e')]('\x27'+_0x1fc1af+'\x27','updatedAt')[_0x332d('0x71')]('cm_contacts')[_0x332d('0x36')](_0x332d('0x73'))[_0x332d('0x36')](_0x332d('0x74'),_0x2de76a[_0x332d('0x70')][_0x332d('0x75')]())[_0x332d('0x36')](_0x332d('0x76')))['toString']();}_0x435cfb=squel[_0x332d('0x67')]()[_0x332d('0x7f')](_0x332d('0x80'))[_0x332d('0x68')](['cmHopperId',_0x332d('0x6a'),_0x332d('0x69'),_0x332d('0x81'),_0x332d('0x6d'),'updatedAt'],squel[_0x332d('0x78')]()['field']('h.id','id')[_0x332d('0x6e')](_0x332d('0x6f'),'scheduledAt')[_0x332d('0x6e')](_0x332d('0x82'),_0x332d('0x69'))[_0x332d('0x6e')](_0x332d('0x83'),_0x332d('0x81'))[_0x332d('0x6e')]('\x27'+_0x1fc1af+'\x27',_0x332d('0x6d'))[_0x332d('0x6e')]('\x27'+_0x1fc1af+'\x27','updatedAt')[_0x332d('0x71')](_0x332d('0x84'),'ci')['join']('cm_hopper','h','h.ContactId\x20=\x20ci.CmContactId')[_0x332d('0x36')](_0x332d('0x85'),_0x2de76a['CmListId'][_0x332d('0x75')]())[_0x332d('0x36')]('h.CampaignId=?',_0x3fdc2f[_0x332d('0x4d')]['id'][_0x332d('0x75')]())[_0x332d('0x36')]('h.createdAt\x20=\x20?',_0x1fc1af))[_0x332d('0x75')]();_0x3f95a1[_0x332d('0x86')](db[_0x332d('0x87')][_0x332d('0x2c')](_0x3d2c93));_0x1d4f1e[_0x332d('0x86')](db['sequelize'][_0x332d('0x2c')](_0x435cfb));}return BPromise['all'](_0x3f95a1);}})['then'](function(){return BPromise['all'](_0x1d4f1e);})[_0x332d('0x1e')](function(){return _0x11d198;})['then'](respondWithResult(_0x5d6cbb,null))['catch'](handleError(_0x5d6cbb,null));};exports[_0x332d('0x88')]=function(_0x309b9c,_0x3969ed,_0x263c62){return db['Campaign'][_0x332d('0x42')]({'where':{'id':_0x309b9c['params']['id']}})[_0x332d('0x1e')](handleEntityNotFound(_0x3969ed,null))[_0x332d('0x1e')](function(_0x5f1dda){if(_0x5f1dda){return _0x5f1dda[_0x332d('0x88')](_0x309b9c['query'][_0x332d('0x63')]);}})[_0x332d('0x1e')](function(_0x268c0b){if(_0x268c0b){return db[_0x332d('0x55')][_0x332d('0x1f')]({'where':{'ListId':_0x309b9c[_0x332d('0x2c')][_0x332d('0x63')],'CampaignId':_0x309b9c['params']['id']}})[_0x332d('0x1e')](function(){return _0x268c0b;});}})[_0x332d('0x1e')](respondWithStatusCode(_0x3969ed,null))[_0x332d('0x43')](handleError(_0x3969ed,null));};exports['getBlackLists']=function(_0x52d7d2,_0x1cb405,_0x536649){var _0x987568={};var _0x63f9f3={};var _0x4d36a2;var _0x30342c;return db[_0x332d('0x3d')][_0x332d('0x54')]({'where':{'id':_0x52d7d2[_0x332d('0x4d')]['id']}})[_0x332d('0x1e')](handleEntityNotFound(_0x1cb405,null))['then'](function(_0x261e3f){if(_0x261e3f){_0x4d36a2=_0x261e3f;_0x63f9f3[_0x332d('0x2b')]=_[_0x332d('0x2d')](db[_0x332d('0x5f')][_0x332d('0x27')]);_0x63f9f3[_0x332d('0x2c')]=_[_0x332d('0x2d')](_0x52d7d2[_0x332d('0x2c')]);_0x63f9f3[_0x332d('0x37')]=_[_0x332d('0x2e')](_0x63f9f3[_0x332d('0x2b')],_0x63f9f3['query']);_0x987568['attributes']=_[_0x332d('0x2e')](_0x63f9f3[_0x332d('0x2b')],qs[_0x332d('0x30')](_0x52d7d2[_0x332d('0x2c')][_0x332d('0x30')]));_0x987568[_0x332d('0x2f')]=_0x987568[_0x332d('0x2f')][_0x332d('0x4e')]?_0x987568[_0x332d('0x2f')]:_0x63f9f3[_0x332d('0x2b')];_0x987568[_0x332d('0x34')]=qs[_0x332d('0x35')](_0x52d7d2['query'][_0x332d('0x35')]);_0x987568[_0x332d('0x36')]=qs['filters'](_[_0x332d('0x38')](_0x52d7d2[_0x332d('0x2c')],_0x63f9f3[_0x332d('0x37')]));if(_0x52d7d2[_0x332d('0x2c')][_0x332d('0x39')]){_0x987568['where']=_[_0x332d('0x3a')](_0x987568[_0x332d('0x36')],{'$or':_[_0x332d('0x26')](_0x987568[_0x332d('0x2f')],function(_0x88c21){var _0x1202e6={};_0x1202e6[_0x88c21]={'$like':'%'+_0x52d7d2[_0x332d('0x2c')]['filter']+'%'};return _0x1202e6;})});}_0x987568=_['merge']({},_0x987568,_0x52d7d2['options']);return _0x4d36a2[_0x332d('0x89')](_0x987568);}})[_0x332d('0x1e')](function(_0x20f20c){if(_0x20f20c){_0x30342c=_0x20f20c[_0x332d('0x4e')];if(!_0x52d7d2[_0x332d('0x2c')]['hasOwnProperty'](_0x332d('0x32'))){_0x987568[_0x332d('0x33')]=qs[_0x332d('0x33')](_0x52d7d2[_0x332d('0x2c')][_0x332d('0x33')]);_0x987568['offset']=qs[_0x332d('0x18')](_0x52d7d2['query'][_0x332d('0x18')]);}return _0x4d36a2[_0x332d('0x89')](_0x987568);}})[_0x332d('0x1e')](function(_0x1d48f4){if(_0x1d48f4){return _0x1d48f4?{'count':_0x30342c,'rows':_0x1d48f4}:null;}})[_0x332d('0x1e')](respondWithResult(_0x1cb405,null))[_0x332d('0x43')](handleError(_0x1cb405,null));};exports[_0x332d('0x8a')]=function(_0x246027,_0x181aa9,_0x23f410){var _0xd8db80,_0x261291;var _0x45eafe=[];var _0x37bee8=moment()[_0x332d('0x61')](_0x332d('0x62'));return db[_0x332d('0x3d')][_0x332d('0x42')]({'where':{'id':_0x246027[_0x332d('0x4d')]['id']}})[_0x332d('0x1e')](handleEntityNotFound(_0x181aa9,null))[_0x332d('0x1e')](function(_0x4f4627){if(_0x4f4627){_0x261291=_0x4f4627;return _0x4f4627[_0x332d('0x8a')](_0x246027[_0x332d('0x45')][_0x332d('0x63')],_[_0x332d('0x50')](_0x246027[_0x332d('0x45')],['ids','id'])||{});}return null;})[_0x332d('0x64')](function(_0x12d53d){var _0x5b3aa0;var _0x5d2c7d;_0xd8db80=_0x12d53d||[];var _0x3259fe=[];if(_0x12d53d){for(var _0x4dadba=0x0;_0x4dadba<_0x12d53d[_0x332d('0x4e')];_0x4dadba+=0x1){var _0x3c177e=_0x12d53d[_0x4dadba]['get']({'plain':!![]});_0x5b3aa0=squel[_0x332d('0x67')]()['into'](_0x332d('0x8b'))[_0x332d('0x68')]([_0x332d('0x69'),'ContactId','ListId',_0x332d('0x58'),'createdAt',_0x332d('0x4f')],squel['select']()[_0x332d('0x6e')](_0x332d('0x69'),'phone')[_0x332d('0x6e')]('id',_0x332d('0x6b'))[_0x332d('0x6e')](_0x3c177e[_0x332d('0x70')][_0x332d('0x75')](),_0x332d('0x6c'))[_0x332d('0x6e')](_0x246027[_0x332d('0x4d')]['id'][_0x332d('0x75')](),_0x332d('0x58'))[_0x332d('0x6e')](_0x332d('0x6f'),_0x332d('0x6d'))[_0x332d('0x6e')]('NOW()','updatedAt')['from'](_0x332d('0x72'))[_0x332d('0x36')](_0x332d('0x73'))[_0x332d('0x36')]('ListId\x20=\x20?',_0x3c177e[_0x332d('0x70')][_0x332d('0x75')]())[_0x332d('0x36')]('phone\x20IS\x20NOT\x20NULL'))[_0x332d('0x75')]();_0x3259fe[_0x332d('0x86')](db[_0x332d('0x87')][_0x332d('0x2c')](_0x5b3aa0));}return BPromise[_0x332d('0x8c')](_0x3259fe);}})['then'](function(){return _0xd8db80;})[_0x332d('0x1e')](respondWithResult(_0x181aa9,null))[_0x332d('0x43')](handleError(_0x181aa9,null));};exports[_0x332d('0x8d')]=function(_0x217014,_0x3e2446,_0x1245c7){return db[_0x332d('0x3d')][_0x332d('0x42')]({'where':{'id':_0x217014[_0x332d('0x4d')]['id']}})[_0x332d('0x1e')](handleEntityNotFound(_0x3e2446,null))[_0x332d('0x1e')](function(_0x5ddc72){if(_0x5ddc72){return _0x5ddc72[_0x332d('0x8d')](_0x217014[_0x332d('0x2c')][_0x332d('0x63')]);}})[_0x332d('0x1e')](function(_0x3acc8a){if(_0x3acc8a){return db[_0x332d('0x5d')]['destroy']({'where':{'ListId':_0x217014['query']['ids'],'CampaignId':_0x217014[_0x332d('0x4d')]['id']}})['then'](function(){return _0x3acc8a;});}})['then'](respondWithStatusCode(_0x3e2446,null))[_0x332d('0x43')](handleError(_0x3e2446,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index ad16f78..2d4f7bc 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(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x1e8690,_0x5c6b4c){var _0x414bea=function(_0x6284dd){while(--_0x6284dd){_0x1e8690['push'](_0x1e8690['shift']());}};_0x414bea(++_0x5c6b4c);}(_0x7a54,0x106));var _0x47a5=function(_0xbff22d,_0x5eaf11){_0xbff22d=_0xbff22d-0x0;var _0x47a481=_0x7a54[_0xbff22d];return _0x47a481;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index ffbd6e2..f6fcfe9 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 _0x2cc1=['stringify','error','code','message','result','catch','GetCampaign','Campaign','findAll','options','where','attributes','limit','include','model','map','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','request','then','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x2cc1,0x1bd));var _0x12cc=function(_0xce2ee4,_0x3fe1e1){_0xce2ee4=_0xce2ee4-0x0;var _0x3fd000=_0x2cc1[_0xce2ee4];return _0x3fd000;};'use strict';var _=require(_0x12cc('0x0'));var util=require(_0x12cc('0x1'));var moment=require(_0x12cc('0x2'));var BPromise=require(_0x12cc('0x3'));var rs=require(_0x12cc('0x4'));var fs=require('fs');var Redis=require(_0x12cc('0x5'));var db=require(_0x12cc('0x6'))['db'];var utils=require(_0x12cc('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x12cc('0x8'));var jayson=require(_0x12cc('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3dee73,_0x132370,_0x21d042){return new BPromise(function(_0x286d82,_0x1f9d00){return client[_0x12cc('0xa')](_0x3dee73,_0x21d042)[_0x12cc('0xb')](function(_0x325d01){logger[_0x12cc('0xc')](_0x12cc('0xd'),_0x132370,_0x12cc('0xe'));logger[_0x12cc('0xf')](_0x12cc('0x10'),_0x132370,'request\x20sent',JSON[_0x12cc('0x11')](_0x325d01));if(_0x325d01['error']){if(_0x325d01[_0x12cc('0x12')][_0x12cc('0x13')]===0x1f4){logger[_0x12cc('0x12')](_0x12cc('0xd'),_0x132370,_0x325d01[_0x12cc('0x12')][_0x12cc('0x14')]);return _0x1f9d00(_0x325d01['error']['message']);}logger[_0x12cc('0x12')]('Campaign,\x20%s,\x20%s',_0x132370,_0x325d01[_0x12cc('0x12')]['message']);return _0x286d82(_0x325d01[_0x12cc('0x12')][_0x12cc('0x14')]);}else{logger[_0x12cc('0xc')](_0x12cc('0xd'),_0x132370,_0x12cc('0xe'));_0x286d82(_0x325d01[_0x12cc('0x15')]['message']);}})[_0x12cc('0x16')](function(_0x639eca){logger['error'](_0x12cc('0xd'),_0x132370,_0x639eca);_0x1f9d00(_0x639eca);});});}exports[_0x12cc('0x17')]=function(_0x1ad81f){var _0x33db40=this;return new Promise(function(_0x32d942,_0xe6f84){return db[_0x12cc('0x18')][_0x12cc('0x19')]({'raw':_0x1ad81f[_0x12cc('0x1a')]?_0x1ad81f['options']['raw']===undefined?!![]:![]:!![],'where':_0x1ad81f['options']?_0x1ad81f[_0x12cc('0x1a')][_0x12cc('0x1b')]||null:null,'attributes':_0x1ad81f[_0x12cc('0x1a')]?_0x1ad81f[_0x12cc('0x1a')][_0x12cc('0x1c')]||null:null,'limit':_0x1ad81f[_0x12cc('0x1a')]?_0x1ad81f[_0x12cc('0x1a')][_0x12cc('0x1d')]||null:null,'include':_0x1ad81f[_0x12cc('0x1a')]?_0x1ad81f['options'][_0x12cc('0x1e')]?_['map'](_0x1ad81f[_0x12cc('0x1a')][_0x12cc('0x1e')],function(_0x4814b8){return{'model':db[_0x4814b8[_0x12cc('0x1f')]],'as':_0x4814b8['as'],'attributes':_0x4814b8[_0x12cc('0x1c')],'include':_0x4814b8['include']?_['map'](_0x4814b8[_0x12cc('0x1e')],function(_0x5ab109){return{'model':db[_0x5ab109[_0x12cc('0x1f')]],'as':_0x5ab109['as'],'attributes':_0x5ab109[_0x12cc('0x1c')],'include':_0x5ab109[_0x12cc('0x1e')]?_[_0x12cc('0x20')](_0x5ab109[_0x12cc('0x1e')],function(_0x281da6){return{'model':db[_0x281da6[_0x12cc('0x1f')]],'as':_0x281da6['as'],'attributes':_0x281da6[_0x12cc('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x12cc('0xb')](function(_0x180cfe){logger[_0x12cc('0xc')](_0x12cc('0x17'),_0x1ad81f);logger[_0x12cc('0xf')](_0x12cc('0x17'),_0x1ad81f,JSON[_0x12cc('0x11')](_0x180cfe));_0x32d942(_0x180cfe);})[_0x12cc('0x16')](function(_0x5cb159){logger[_0x12cc('0x12')](_0x12cc('0x17'),_0x5cb159[_0x12cc('0x14')],_0x1ad81f);_0xe6f84(_0x33db40[_0x12cc('0x12')](0x1f4,_0x5cb159[_0x12cc('0x14')]));});});}; \ No newline at end of file +var _0x01fe=['raw','attributes','limit','include','map','model','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','request\x20sent','debug','error','code','Campaign,\x20%s,\x20%s','message','catch','GetCampaign','findAll','options'];(function(_0x544f1d,_0x2b946a){var _0xa329a7=function(_0x56324a){while(--_0x56324a){_0x544f1d['push'](_0x544f1d['shift']());}};_0xa329a7(++_0x2b946a);}(_0x01fe,0x102));var _0xe01f=function(_0x16523f,_0xf2bcf3){_0x16523f=_0x16523f-0x0;var _0x562c8c=_0x01fe[_0x16523f];return _0x562c8c;};'use strict';var _=require(_0xe01f('0x0'));var util=require('util');var moment=require(_0xe01f('0x1'));var BPromise=require(_0xe01f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe01f('0x3'))['db'];var utils=require(_0xe01f('0x4'));var logger=require(_0xe01f('0x5'))(_0xe01f('0x6'));var config=require('../../config/environment');var jayson=require(_0xe01f('0x7'));var client=jayson['client'][_0xe01f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3b754f,_0x45431b,_0x40376f){return new BPromise(function(_0x377881,_0x4d1775){return client[_0xe01f('0x9')](_0x3b754f,_0x40376f)[_0xe01f('0xa')](function(_0x47dc30){logger[_0xe01f('0xb')]('Campaign,\x20%s,\x20%s',_0x45431b,_0xe01f('0xc'));logger[_0xe01f('0xd')]('Campaign,\x20%s,\x20%s,\x20%s',_0x45431b,_0xe01f('0xc'),JSON['stringify'](_0x47dc30));if(_0x47dc30[_0xe01f('0xe')]){if(_0x47dc30[_0xe01f('0xe')][_0xe01f('0xf')]===0x1f4){logger[_0xe01f('0xe')](_0xe01f('0x10'),_0x45431b,_0x47dc30[_0xe01f('0xe')][_0xe01f('0x11')]);return _0x4d1775(_0x47dc30[_0xe01f('0xe')]['message']);}logger[_0xe01f('0xe')](_0xe01f('0x10'),_0x45431b,_0x47dc30[_0xe01f('0xe')][_0xe01f('0x11')]);return _0x377881(_0x47dc30[_0xe01f('0xe')][_0xe01f('0x11')]);}else{logger[_0xe01f('0xb')]('Campaign,\x20%s,\x20%s',_0x45431b,'request\x20sent');_0x377881(_0x47dc30['result'][_0xe01f('0x11')]);}})[_0xe01f('0x12')](function(_0x88606f){logger[_0xe01f('0xe')](_0xe01f('0x10'),_0x45431b,_0x88606f);_0x4d1775(_0x88606f);});});}exports[_0xe01f('0x13')]=function(_0x144eef){var _0x26cd4d=this;return new Promise(function(_0x9ee4b5,_0x2ddaa3){return db['Campaign'][_0xe01f('0x14')]({'raw':_0x144eef['options']?_0x144eef[_0xe01f('0x15')][_0xe01f('0x16')]===undefined?!![]:![]:!![],'where':_0x144eef[_0xe01f('0x15')]?_0x144eef[_0xe01f('0x15')]['where']||null:null,'attributes':_0x144eef[_0xe01f('0x15')]?_0x144eef[_0xe01f('0x15')][_0xe01f('0x17')]||null:null,'limit':_0x144eef[_0xe01f('0x15')]?_0x144eef[_0xe01f('0x15')][_0xe01f('0x18')]||null:null,'include':_0x144eef['options']?_0x144eef[_0xe01f('0x15')][_0xe01f('0x19')]?_[_0xe01f('0x1a')](_0x144eef[_0xe01f('0x15')][_0xe01f('0x19')],function(_0x38efcc){return{'model':db[_0x38efcc[_0xe01f('0x1b')]],'as':_0x38efcc['as'],'attributes':_0x38efcc[_0xe01f('0x17')],'include':_0x38efcc[_0xe01f('0x19')]?_['map'](_0x38efcc['include'],function(_0x3138d3){return{'model':db[_0x3138d3[_0xe01f('0x1b')]],'as':_0x3138d3['as'],'attributes':_0x3138d3[_0xe01f('0x17')],'include':_0x3138d3[_0xe01f('0x19')]?_['map'](_0x3138d3[_0xe01f('0x19')],function(_0x42b213){return{'model':db[_0x42b213['model']],'as':_0x42b213['as'],'attributes':_0x42b213[_0xe01f('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1b77c8){logger[_0xe01f('0xb')](_0xe01f('0x13'),_0x144eef);logger['debug'](_0xe01f('0x13'),_0x144eef,JSON['stringify'](_0x1b77c8));_0x9ee4b5(_0x1b77c8);})[_0xe01f('0x12')](function(_0x232ad1){logger[_0xe01f('0xe')](_0xe01f('0x13'),_0x232ad1[_0xe01f('0x11')],_0x144eef);_0x2ddaa3(_0x26cd4d[_0xe01f('0xe')](0x1f4,_0x232ad1[_0xe01f('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 5b800c6..a1466de 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 _0x9a69=['show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','/:id/lists','/:id/blacklists','getBlackLists','post','create','/:id/clone','clone','addLists','addBlackLists','update','delete','destroy','removeLists','removeBlackLists','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id'];(function(_0x59878a,_0x41a7f7){var _0x384cfe=function(_0x5a28e2){while(--_0x5a28e2){_0x59878a['push'](_0x59878a['shift']());}};_0x384cfe(++_0x41a7f7);}(_0x9a69,0x75));var _0x99a6=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x9a69[_0x2641f9];return _0x585741;};'use strict';var multer=require('multer');var util=require(_0x99a6('0x0'));var path=require(_0x99a6('0x1'));var timeout=require(_0x99a6('0x2'));var express=require(_0x99a6('0x3'));var router=express[_0x99a6('0x4')]();var fs_extra=require(_0x99a6('0x5'));var auth=require(_0x99a6('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x99a6('0x7'));var controller=require('./campaign.controller');router[_0x99a6('0x8')]('/',auth[_0x99a6('0x9')](),controller['index']);router[_0x99a6('0x8')](_0x99a6('0xa'),auth[_0x99a6('0x9')](),controller[_0x99a6('0xb')]);router['get'](_0x99a6('0xc'),auth[_0x99a6('0x9')](),controller[_0x99a6('0xd')]);router[_0x99a6('0x8')](_0x99a6('0xe'),auth[_0x99a6('0x9')](),controller['getHopperHistories']);router['get'](_0x99a6('0xf'),auth['isAuthenticated'](),controller[_0x99a6('0x10')]);router[_0x99a6('0x8')](_0x99a6('0x11'),auth[_0x99a6('0x9')](),controller['getHopperBlacks']);router[_0x99a6('0x8')](_0x99a6('0x12'),auth[_0x99a6('0x9')](),controller['getLists']);router[_0x99a6('0x8')](_0x99a6('0x13'),auth['isAuthenticated'](),controller[_0x99a6('0x14')]);router[_0x99a6('0x15')]('/',auth[_0x99a6('0x9')](),controller[_0x99a6('0x16')]);router[_0x99a6('0x15')](_0x99a6('0x17'),auth[_0x99a6('0x9')](),controller[_0x99a6('0x18')]);router['post'](_0x99a6('0x12'),auth['isAuthenticated'](),controller[_0x99a6('0x19')]);router[_0x99a6('0x15')](_0x99a6('0x13'),auth['isAuthenticated'](),controller[_0x99a6('0x1a')]);router['put']('/:id',auth[_0x99a6('0x9')](),controller[_0x99a6('0x1b')]);router[_0x99a6('0x1c')](_0x99a6('0xa'),auth[_0x99a6('0x9')](),controller[_0x99a6('0x1d')]);router[_0x99a6('0x1c')](_0x99a6('0x12'),auth['isAuthenticated'](),controller[_0x99a6('0x1e')]);router[_0x99a6('0x1c')](_0x99a6('0x13'),auth[_0x99a6('0x9')](),controller[_0x99a6('0x1f')]);module['exports']=router; \ No newline at end of file +var _0x0582=['put','update','delete','destroy','removeLists','removeBlackLists','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','create','/:id/clone','addLists','post','addBlackLists'];(function(_0x35923f,_0xf96238){var _0x1b0b02=function(_0x5249c0){while(--_0x5249c0){_0x35923f['push'](_0x35923f['shift']());}};_0x1b0b02(++_0xf96238);}(_0x0582,0x150));var _0x2058=function(_0x1a4ee9,_0x453bfa){_0x1a4ee9=_0x1a4ee9-0x0;var _0x2f8680=_0x0582[_0x1a4ee9];return _0x2f8680;};'use strict';var multer=require('multer');var util=require(_0x2058('0x0'));var path=require(_0x2058('0x1'));var timeout=require(_0x2058('0x2'));var express=require(_0x2058('0x3'));var router=express[_0x2058('0x4')]();var fs_extra=require(_0x2058('0x5'));var auth=require(_0x2058('0x6'));var interaction=require(_0x2058('0x7'));var config=require(_0x2058('0x8'));var controller=require('./campaign.controller');router['get']('/',auth[_0x2058('0x9')](),controller[_0x2058('0xa')]);router[_0x2058('0xb')](_0x2058('0xc'),auth[_0x2058('0x9')](),controller[_0x2058('0xd')]);router['get']('/:id/hoppers',auth['isAuthenticated'](),controller['getHoppers']);router[_0x2058('0xb')](_0x2058('0xe'),auth[_0x2058('0x9')](),controller[_0x2058('0xf')]);router[_0x2058('0xb')](_0x2058('0x10'),auth[_0x2058('0x9')](),controller[_0x2058('0x11')]);router[_0x2058('0xb')]('/:id/hopper_black',auth['isAuthenticated'](),controller[_0x2058('0x12')]);router['get'](_0x2058('0x13'),auth[_0x2058('0x9')](),controller[_0x2058('0x14')]);router[_0x2058('0xb')](_0x2058('0x15'),auth[_0x2058('0x9')](),controller['getBlackLists']);router['post']('/',auth[_0x2058('0x9')](),controller[_0x2058('0x16')]);router['post'](_0x2058('0x17'),auth[_0x2058('0x9')](),controller['clone']);router['post']('/:id/lists',auth['isAuthenticated'](),controller[_0x2058('0x18')]);router[_0x2058('0x19')](_0x2058('0x15'),auth['isAuthenticated'](),controller[_0x2058('0x1a')]);router[_0x2058('0x1b')](_0x2058('0xc'),auth[_0x2058('0x9')](),controller[_0x2058('0x1c')]);router[_0x2058('0x1d')]('/:id',auth['isAuthenticated'](),controller[_0x2058('0x1e')]);router[_0x2058('0x1d')]('/:id/lists',auth[_0x2058('0x9')](),controller[_0x2058('0x1f')]);router[_0x2058('0x1d')]('/:id/blacklists',auth[_0x2058('0x9')](),controller[_0x2058('0x20')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 74f2838..0fbb821 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 _0xce73=['sequelize','exports','STRING','medium','VIRTUAL','getDataValue','key'];(function(_0x3d8520,_0x24a146){var _0x4cb02a=function(_0x22c073){while(--_0x22c073){_0x3d8520['push'](_0x3d8520['shift']());}};_0x4cb02a(++_0x24a146);}(_0xce73,0x77));var _0x3ce7=function(_0x1300a5,_0x37d38d){_0x1300a5=_0x1300a5-0x0;var _0x41702c=_0xce73[_0x1300a5];return _0x41702c;};'use strict';var Sequelize=require(_0x3ce7('0x0'));module[_0x3ce7('0x1')]={'key':{'type':Sequelize[_0x3ce7('0x2')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'length':_0x3ce7('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x3ce7('0x2')]},'name':{'type':Sequelize[_0x3ce7('0x4')],'get':function(){return this[_0x3ce7('0x5')](_0x3ce7('0x6'));}}}; \ No newline at end of file +var _0xc073=['key','sequelize','exports','medium','STRING','getDataValue'];(function(_0x3c51d4,_0x36ba53){var _0x53c45f=function(_0x3d6683){while(--_0x3d6683){_0x3c51d4['push'](_0x3c51d4['shift']());}};_0x53c45f(++_0x36ba53);}(_0xc073,0xa3));var _0x3c07=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc073[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x3c07('0x0'));module[_0x3c07('0x1')]={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'length':_0x3c07('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x3c07('0x3')]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x3c07('0x4')](_0x3c07('0x5'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 2b90552..6f8707c 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 _0x492f=['query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','options','CannedAnswer','include','findAll','catch','rawAttributes','update','body','find','params','create','key','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','The\x20inserted\x20key\x20already\x20exists.','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','end','json','undefined','limit','count','offset','status','set','Content-Range','apply','save','destroy','then','get','CannedAnswers','UserProfileResource','error','stack','name','send','index','map','fieldName','type','keys'];(function(_0x575b65,_0x31abf5){var _0x22400d=function(_0x467f05){while(--_0x467f05){_0x575b65['push'](_0x575b65['shift']());}};_0x22400d(++_0x31abf5);}(_0x492f,0xd8));var _0xf492=function(_0xf42ecf,_0x25b798){_0xf42ecf=_0xf42ecf-0x0;var _0x3fa664=_0x492f[_0xf42ecf];return _0x3fa664;};'use strict';var emlformat=require(_0xf492('0x0'));var rimraf=require(_0xf492('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf492('0x2'));var rp=require(_0xf492('0x3'));var moment=require(_0xf492('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf492('0x5'));var util=require(_0xf492('0x6'));var path=require(_0xf492('0x7'));var sox=require(_0xf492('0x8'));var csv=require(_0xf492('0x9'));var ejs=require(_0xf492('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xf492('0xb'));var jsforce=require(_0xf492('0xc'));var deskjs=require(_0xf492('0xd'));var toCsv=require(_0xf492('0x9'));var querystring=require(_0xf492('0xe'));var Papa=require(_0xf492('0xf'));var Redis=require(_0xf492('0x10'));var authService=require(_0xf492('0x11'));var qs=require(_0xf492('0x12'));var as=require(_0xf492('0x13'));var hardwareService=require(_0xf492('0x14'));var logger=require(_0xf492('0x15'))(_0xf492('0x16'));var utils=require('../../config/utils');var config=require(_0xf492('0x17'));var licenseUtil=require(_0xf492('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1431ea,_0x34a7a3){_0x34a7a3=_0x34a7a3||0xcc;return function(_0x3c7d2e){if(_0x3c7d2e){return _0x1431ea[_0xf492('0x19')](_0x34a7a3);}return _0x1431ea['status'](_0x34a7a3)[_0xf492('0x1a')]();};}function respondWithResult(_0x43fcf2,_0x1d1c38){_0x1d1c38=_0x1d1c38||0xc8;return function(_0x42704e){if(_0x42704e){return _0x43fcf2['status'](_0x1d1c38)[_0xf492('0x1b')](_0x42704e);}};}function respondWithFilteredResult(_0x342e16,_0x31a9d6){return function(_0x30775b){if(_0x30775b){var _0x140bcc=typeof _0x31a9d6['offset']===_0xf492('0x1c')&&typeof _0x31a9d6[_0xf492('0x1d')]===_0xf492('0x1c');var _0x29894f=_0x30775b[_0xf492('0x1e')];var _0x406113=_0x140bcc?0x0:_0x31a9d6[_0xf492('0x1f')];var _0x3d99fb=_0x140bcc?_0x30775b[_0xf492('0x1e')]:_0x31a9d6[_0xf492('0x1f')]+_0x31a9d6[_0xf492('0x1d')];var _0x377d2b;if(_0x3d99fb>=_0x29894f){_0x3d99fb=_0x29894f;_0x377d2b=0xc8;}else{_0x377d2b=0xce;}_0x342e16[_0xf492('0x20')](_0x377d2b);return _0x342e16[_0xf492('0x21')](_0xf492('0x22'),_0x406113+'-'+_0x3d99fb+'/'+_0x29894f)[_0xf492('0x1b')](_0x30775b);}return null;};}function patchUpdates(_0xbb021b){return function(_0x1de43c){try{jsonpatch[_0xf492('0x23')](_0x1de43c,_0xbb021b,!![]);}catch(_0x22d5b0){return BPromise['reject'](_0x22d5b0);}return _0x1de43c[_0xf492('0x24')]();};}function saveUpdates(_0x3563d4,_0x4c93e1){return function(_0x4690bc){if(_0x4690bc){return _0x4690bc['update'](_0x3563d4)['then'](function(_0x1f9999){return _0x1f9999;});}return null;};}function removeEntity(_0x17a328,_0x4eae2f){return function(_0x39720a){if(_0x39720a){return _0x39720a[_0xf492('0x25')]()[_0xf492('0x26')](function(){var _0x210377=_0x39720a[_0xf492('0x27')]({'plain':!![]});var _0x20d43f=_0xf492('0x28');return db[_0xf492('0x29')][_0xf492('0x25')]({'where':{'type':_0x20d43f,'resourceId':_0x210377['id']}})[_0xf492('0x26')](function(){return _0x39720a;});})[_0xf492('0x26')](function(){_0x17a328[_0xf492('0x20')](0xcc)[_0xf492('0x1a')]();});}};}function handleEntityNotFound(_0x2d88ff,_0xaee96a){return function(_0x30cc0d){if(!_0x30cc0d){_0x2d88ff[_0xf492('0x19')](0x194);}return _0x30cc0d;};}function handleError(_0x57cf3e,_0x53c8e7){_0x53c8e7=_0x53c8e7||0x1f4;return function(_0x7f33be){logger[_0xf492('0x2a')](_0x7f33be[_0xf492('0x2b')]);if(_0x7f33be[_0xf492('0x2c')]){delete _0x7f33be[_0xf492('0x2c')];}_0x57cf3e[_0xf492('0x20')](_0x53c8e7)[_0xf492('0x2d')](_0x7f33be);};}exports[_0xf492('0x2e')]=function(_0x28a199,_0x2cc9b1){var _0x51612b={},_0x18a378={},_0x3ac292={'count':0x0,'rows':[]};var _0x4c1fa5=_[_0xf492('0x2f')](db['CannedAnswer']['rawAttributes'],function(_0x452241){return{'name':_0x452241[_0xf492('0x30')],'type':_0x452241[_0xf492('0x31')]['key']};});_0x18a378['model']=_[_0xf492('0x2f')](_0x4c1fa5,_0xf492('0x2c'));_0x18a378['query']=_[_0xf492('0x32')](_0x28a199[_0xf492('0x33')]);_0x18a378[_0xf492('0x34')]=_[_0xf492('0x35')](_0x18a378[_0xf492('0x36')],_0x18a378[_0xf492('0x33')]);_0x51612b['attributes']=_[_0xf492('0x35')](_0x18a378[_0xf492('0x36')],qs[_0xf492('0x37')](_0x28a199[_0xf492('0x33')]['fields']));_0x51612b[_0xf492('0x38')]=_0x51612b[_0xf492('0x38')][_0xf492('0x39')]?_0x51612b[_0xf492('0x38')]:_0x18a378['model'];if(!_0x28a199['query'][_0xf492('0x3a')](_0xf492('0x3b'))){_0x51612b[_0xf492('0x1d')]=qs[_0xf492('0x1d')](_0x28a199[_0xf492('0x33')][_0xf492('0x1d')]);_0x51612b['offset']=qs['offset'](_0x28a199[_0xf492('0x33')][_0xf492('0x1f')]);}_0x51612b[_0xf492('0x3c')]=qs[_0xf492('0x3d')](_0x28a199[_0xf492('0x33')][_0xf492('0x3d')]);_0x51612b[_0xf492('0x3e')]=qs['filters'](_[_0xf492('0x3f')](_0x28a199[_0xf492('0x33')],_0x18a378[_0xf492('0x34')]),_0x4c1fa5);if(_0x28a199['query']['filter']){_0x51612b[_0xf492('0x3e')]=_['merge'](_0x51612b[_0xf492('0x3e')],{'$or':[{'key':{'$like':'%'+_0x28a199['query'][_0xf492('0x40')]+'%'}},{'value':{'$like':'%'+_0x28a199['query'][_0xf492('0x40')]+'%'}}]});}_0x51612b=_['merge']({},_0x51612b,_0x28a199[_0xf492('0x41')]);var _0x379166={'where':_0x51612b['where']};return db[_0xf492('0x42')]['count'](_0x379166)[_0xf492('0x26')](function(_0x33617b){_0x3ac292[_0xf492('0x1e')]=_0x33617b;if(_0x28a199[_0xf492('0x33')]['includeAll']){_0x51612b[_0xf492('0x43')]=[{'all':!![]}];}return db[_0xf492('0x42')][_0xf492('0x44')](_0x51612b);})[_0xf492('0x26')](function(_0x24c88e){_0x3ac292['rows']=_0x24c88e;return _0x3ac292;})[_0xf492('0x26')](respondWithFilteredResult(_0x2cc9b1,_0x51612b))[_0xf492('0x45')](handleError(_0x2cc9b1,null));};exports['show']=function(_0x50bf6c,_0x4cfb6c){var _0x50a163={'raw':!![],'where':{'id':_0x50bf6c['params']['id']}},_0xdd4301={};_0xdd4301[_0xf492('0x36')]=_[_0xf492('0x32')](db[_0xf492('0x42')][_0xf492('0x46')]);_0xdd4301[_0xf492('0x33')]=_[_0xf492('0x32')](_0x50bf6c[_0xf492('0x33')]);_0xdd4301[_0xf492('0x34')]=_['intersection'](_0xdd4301['model'],_0xdd4301['query']);_0x50a163[_0xf492('0x38')]=_['intersection'](_0xdd4301[_0xf492('0x36')],qs['fields'](_0x50bf6c[_0xf492('0x33')]['fields']));_0x50a163[_0xf492('0x38')]=_0x50a163[_0xf492('0x38')]['length']?_0x50a163[_0xf492('0x38')]:_0xdd4301[_0xf492('0x36')];if(_0x50bf6c[_0xf492('0x33')]['includeAll']){_0x50a163['include']=[{'all':!![]}];}_0x50a163=_['merge']({},_0x50a163,_0x50bf6c[_0xf492('0x41')]);return db['CannedAnswer']['find'](_0x50a163)[_0xf492('0x26')](handleEntityNotFound(_0x4cfb6c,null))['then'](respondWithResult(_0x4cfb6c,null))[_0xf492('0x45')](handleError(_0x4cfb6c,null));};exports[_0xf492('0x47')]=function(_0x533b3a,_0xdff431){if(_0x533b3a[_0xf492('0x48')]['id']){delete _0x533b3a[_0xf492('0x48')]['id'];}return db[_0xf492('0x42')][_0xf492('0x49')]({'where':{'id':_0x533b3a['params']['id']}})[_0xf492('0x26')](handleEntityNotFound(_0xdff431,null))['then'](saveUpdates(_0x533b3a[_0xf492('0x48')],null))[_0xf492('0x26')](respondWithResult(_0xdff431,null))[_0xf492('0x45')](handleError(_0xdff431,null));};exports[_0xf492('0x25')]=function(_0x40c38a,_0x556c4e){return db['CannedAnswer'][_0xf492('0x49')]({'where':{'id':_0x40c38a[_0xf492('0x4a')]['id']}})['then'](handleEntityNotFound(_0x556c4e,null))[_0xf492('0x26')](removeEntity(_0x556c4e,null))[_0xf492('0x45')](handleError(_0x556c4e,null));};exports[_0xf492('0x4b')]=function(_0x349e71,_0x100021){var _0x443d0b={'key':_0x349e71[_0xf492('0x48')][_0xf492('0x4c')]};if(_0x349e71[_0xf492('0x48')][_0xf492('0x4d')]){_0x443d0b['MailAccountId']=_0x349e71[_0xf492('0x48')][_0xf492('0x4d')];}else if(_0x349e71['body']['SmsAccountId']){_0x443d0b['SmsAccountId']=_0x349e71[_0xf492('0x48')][_0xf492('0x4e')];}else if(_0x349e71[_0xf492('0x48')][_0xf492('0x4f')]){_0x443d0b[_0xf492('0x4f')]=_0x349e71[_0xf492('0x48')][_0xf492('0x4f')];}else if(_0x349e71[_0xf492('0x48')][_0xf492('0x50')]){_0x443d0b['ChatWebsiteId']=_0x349e71['body'][_0xf492('0x50')];}return db['CannedAnswer'][_0xf492('0x49')]({'where':_0x443d0b})[_0xf492('0x26')](function(_0x10a62a){if(_0x10a62a){throw new db[(_0xf492('0x51'))]['ValidationError'](_0xf492('0x52'));}return db[_0xf492('0x42')][_0xf492('0x4b')](_0x349e71['body']);})[_0xf492('0x26')](function(_0x5b131f){var _0x388d25=_0x349e71[_0xf492('0x53')]['get']({'plain':!![]});if(!_0x388d25)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x388d25[_0xf492('0x54')]===_0xf492('0x53')){var _0x89e30d=_0x5b131f[_0xf492('0x27')]({'plain':!![]});return db[_0xf492('0x55')][_0xf492('0x49')]({'where':{'name':_0xf492('0x28'),'userProfileId':_0x388d25[_0xf492('0x56')]},'raw':!![]})['then'](function(_0x3d67cf){if(_0x3d67cf&&_0x3d67cf[_0xf492('0x57')]===0x0){return db[_0xf492('0x29')][_0xf492('0x4b')]({'name':_0x89e30d['name'],'resourceId':_0x89e30d['id'],'type':_0x3d67cf[_0xf492('0x2c')],'sectionId':_0x3d67cf['id']},{})[_0xf492('0x26')](function(){return _0x5b131f;});}else{return _0x5b131f;}})['catch'](function(_0x208cbf){logger[_0xf492('0x2a')](_0xf492('0x58'),_0x208cbf);throw _0x208cbf;});}return _0x5b131f;})[_0xf492('0x26')](respondWithResult(_0x100021,0xc9))[_0xf492('0x45')](handleError(_0x100021,null));}; \ No newline at end of file +var _0xad5c=['bluebird','mustache','util','path','to-csv','crypto','desk.js','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','get','CannedAnswers','end','error','stack','name','index','map','CannedAnswer','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','nolimit','sort','where','filter','merge','options','include','findAll','rows','show','params','rawAttributes','includeAll','find','catch','update','body','create','key','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x717d04,_0xe8ef52){var _0x5c52de=function(_0x5d242d){while(--_0x5d242d){_0x717d04['push'](_0x717d04['shift']());}};_0x5c52de(++_0xe8ef52);}(_0xad5c,0xa1));var _0xcad5=function(_0x4c3f08,_0x2c22c0){_0x4c3f08=_0x4c3f08-0x0;var _0x442de5=_0xad5c[_0x4c3f08];return _0x442de5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcad5('0x0'));var zipdir=require(_0xcad5('0x1'));var jsonpatch=require(_0xcad5('0x2'));var rp=require(_0xcad5('0x3'));var moment=require(_0xcad5('0x4'));var BPromise=require(_0xcad5('0x5'));var Mustache=require(_0xcad5('0x6'));var util=require(_0xcad5('0x7'));var path=require(_0xcad5('0x8'));var sox=require('sox');var csv=require(_0xcad5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xcad5('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xcad5('0xb'));var toCsv=require(_0xcad5('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xcad5('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0xcad5('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xcad5('0xe'));var utils=require(_0xcad5('0xf'));var config=require(_0xcad5('0x10'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5bb8db,_0x5cd603){_0x5cd603=_0x5cd603||0xcc;return function(_0x53515c){if(_0x53515c){return _0x5bb8db[_0xcad5('0x11')](_0x5cd603);}return _0x5bb8db[_0xcad5('0x12')](_0x5cd603)['end']();};}function respondWithResult(_0x182d3e,_0x1a1cdb){_0x1a1cdb=_0x1a1cdb||0xc8;return function(_0x25e8a1){if(_0x25e8a1){return _0x182d3e[_0xcad5('0x12')](_0x1a1cdb)[_0xcad5('0x13')](_0x25e8a1);}};}function respondWithFilteredResult(_0x40bdc4,_0x4fe8b9){return function(_0x5e108d){if(_0x5e108d){var _0x5324f4=typeof _0x4fe8b9[_0xcad5('0x14')]===_0xcad5('0x15')&&typeof _0x4fe8b9['limit']===_0xcad5('0x15');var _0x2410a5=_0x5e108d[_0xcad5('0x16')];var _0x4d73c9=_0x5324f4?0x0:_0x4fe8b9[_0xcad5('0x14')];var _0xe042bd=_0x5324f4?_0x5e108d['count']:_0x4fe8b9[_0xcad5('0x14')]+_0x4fe8b9[_0xcad5('0x17')];var _0x468f83;if(_0xe042bd>=_0x2410a5){_0xe042bd=_0x2410a5;_0x468f83=0xc8;}else{_0x468f83=0xce;}_0x40bdc4[_0xcad5('0x12')](_0x468f83);return _0x40bdc4[_0xcad5('0x18')](_0xcad5('0x19'),_0x4d73c9+'-'+_0xe042bd+'/'+_0x2410a5)[_0xcad5('0x13')](_0x5e108d);}return null;};}function patchUpdates(_0x39fd99){return function(_0x248c52){try{jsonpatch[_0xcad5('0x1a')](_0x248c52,_0x39fd99,!![]);}catch(_0x10c6ca){return BPromise[_0xcad5('0x1b')](_0x10c6ca);}return _0x248c52[_0xcad5('0x1c')]();};}function saveUpdates(_0x396e7b,_0x24fa46){return function(_0x19df28){if(_0x19df28){return _0x19df28['update'](_0x396e7b)[_0xcad5('0x1d')](function(_0x21b43a){return _0x21b43a;});}return null;};}function removeEntity(_0x45ec02,_0x1fa985){return function(_0x20b5ca){if(_0x20b5ca){return _0x20b5ca[_0xcad5('0x1e')]()['then'](function(){var _0x124fee=_0x20b5ca[_0xcad5('0x1f')]({'plain':!![]});var _0x18e7e8=_0xcad5('0x20');return db['UserProfileResource']['destroy']({'where':{'type':_0x18e7e8,'resourceId':_0x124fee['id']}})[_0xcad5('0x1d')](function(){return _0x20b5ca;});})[_0xcad5('0x1d')](function(){_0x45ec02[_0xcad5('0x12')](0xcc)[_0xcad5('0x21')]();});}};}function handleEntityNotFound(_0x31d868,_0x1931da){return function(_0x2b4559){if(!_0x2b4559){_0x31d868[_0xcad5('0x11')](0x194);}return _0x2b4559;};}function handleError(_0x2181c2,_0x1e128b){_0x1e128b=_0x1e128b||0x1f4;return function(_0x2870fb){logger[_0xcad5('0x22')](_0x2870fb[_0xcad5('0x23')]);if(_0x2870fb[_0xcad5('0x24')]){delete _0x2870fb[_0xcad5('0x24')];}_0x2181c2[_0xcad5('0x12')](_0x1e128b)['send'](_0x2870fb);};}exports[_0xcad5('0x25')]=function(_0x3bfdea,_0x2c338e){var _0x58067e={},_0x5d31e7={},_0x5ddacc={'count':0x0,'rows':[]};var _0x20a5e2=_[_0xcad5('0x26')](db[_0xcad5('0x27')]['rawAttributes'],function(_0x3c3647){return{'name':_0x3c3647[_0xcad5('0x28')],'type':_0x3c3647[_0xcad5('0x29')]['key']};});_0x5d31e7[_0xcad5('0x2a')]=_[_0xcad5('0x26')](_0x20a5e2,_0xcad5('0x24'));_0x5d31e7[_0xcad5('0x2b')]=_[_0xcad5('0x2c')](_0x3bfdea[_0xcad5('0x2b')]);_0x5d31e7[_0xcad5('0x2d')]=_['intersection'](_0x5d31e7['model'],_0x5d31e7['query']);_0x58067e[_0xcad5('0x2e')]=_[_0xcad5('0x2f')](_0x5d31e7[_0xcad5('0x2a')],qs[_0xcad5('0x30')](_0x3bfdea[_0xcad5('0x2b')][_0xcad5('0x30')]));_0x58067e[_0xcad5('0x2e')]=_0x58067e['attributes'][_0xcad5('0x31')]?_0x58067e[_0xcad5('0x2e')]:_0x5d31e7[_0xcad5('0x2a')];if(!_0x3bfdea[_0xcad5('0x2b')]['hasOwnProperty'](_0xcad5('0x32'))){_0x58067e[_0xcad5('0x17')]=qs[_0xcad5('0x17')](_0x3bfdea['query'][_0xcad5('0x17')]);_0x58067e[_0xcad5('0x14')]=qs[_0xcad5('0x14')](_0x3bfdea[_0xcad5('0x2b')][_0xcad5('0x14')]);}_0x58067e['order']=qs['sort'](_0x3bfdea[_0xcad5('0x2b')][_0xcad5('0x33')]);_0x58067e[_0xcad5('0x34')]=qs['filters'](_['pick'](_0x3bfdea[_0xcad5('0x2b')],_0x5d31e7[_0xcad5('0x2d')]),_0x20a5e2);if(_0x3bfdea['query'][_0xcad5('0x35')]){_0x58067e[_0xcad5('0x34')]=_[_0xcad5('0x36')](_0x58067e[_0xcad5('0x34')],{'$or':[{'key':{'$like':'%'+_0x3bfdea['query'][_0xcad5('0x35')]+'%'}},{'value':{'$like':'%'+_0x3bfdea[_0xcad5('0x2b')][_0xcad5('0x35')]+'%'}}]});}_0x58067e=_[_0xcad5('0x36')]({},_0x58067e,_0x3bfdea[_0xcad5('0x37')]);var _0x326e87={'where':_0x58067e[_0xcad5('0x34')]};return db[_0xcad5('0x27')][_0xcad5('0x16')](_0x326e87)[_0xcad5('0x1d')](function(_0x19b46e){_0x5ddacc[_0xcad5('0x16')]=_0x19b46e;if(_0x3bfdea['query']['includeAll']){_0x58067e[_0xcad5('0x38')]=[{'all':!![]}];}return db['CannedAnswer'][_0xcad5('0x39')](_0x58067e);})[_0xcad5('0x1d')](function(_0x41e872){_0x5ddacc[_0xcad5('0x3a')]=_0x41e872;return _0x5ddacc;})[_0xcad5('0x1d')](respondWithFilteredResult(_0x2c338e,_0x58067e))['catch'](handleError(_0x2c338e,null));};exports[_0xcad5('0x3b')]=function(_0x348539,_0x21fbfc){var _0x315fcf={'raw':!![],'where':{'id':_0x348539[_0xcad5('0x3c')]['id']}},_0x1f6894={};_0x1f6894[_0xcad5('0x2a')]=_[_0xcad5('0x2c')](db[_0xcad5('0x27')][_0xcad5('0x3d')]);_0x1f6894['query']=_[_0xcad5('0x2c')](_0x348539['query']);_0x1f6894[_0xcad5('0x2d')]=_[_0xcad5('0x2f')](_0x1f6894['model'],_0x1f6894[_0xcad5('0x2b')]);_0x315fcf[_0xcad5('0x2e')]=_[_0xcad5('0x2f')](_0x1f6894['model'],qs['fields'](_0x348539['query'][_0xcad5('0x30')]));_0x315fcf[_0xcad5('0x2e')]=_0x315fcf[_0xcad5('0x2e')][_0xcad5('0x31')]?_0x315fcf[_0xcad5('0x2e')]:_0x1f6894[_0xcad5('0x2a')];if(_0x348539['query'][_0xcad5('0x3e')]){_0x315fcf[_0xcad5('0x38')]=[{'all':!![]}];}_0x315fcf=_[_0xcad5('0x36')]({},_0x315fcf,_0x348539[_0xcad5('0x37')]);return db[_0xcad5('0x27')][_0xcad5('0x3f')](_0x315fcf)[_0xcad5('0x1d')](handleEntityNotFound(_0x21fbfc,null))[_0xcad5('0x1d')](respondWithResult(_0x21fbfc,null))[_0xcad5('0x40')](handleError(_0x21fbfc,null));};exports[_0xcad5('0x41')]=function(_0xf537e1,_0xb5d592){if(_0xf537e1[_0xcad5('0x42')]['id']){delete _0xf537e1[_0xcad5('0x42')]['id'];}return db[_0xcad5('0x27')]['find']({'where':{'id':_0xf537e1[_0xcad5('0x3c')]['id']}})[_0xcad5('0x1d')](handleEntityNotFound(_0xb5d592,null))[_0xcad5('0x1d')](saveUpdates(_0xf537e1[_0xcad5('0x42')],null))['then'](respondWithResult(_0xb5d592,null))[_0xcad5('0x40')](handleError(_0xb5d592,null));};exports[_0xcad5('0x1e')]=function(_0x261920,_0x3e8245){return db[_0xcad5('0x27')][_0xcad5('0x3f')]({'where':{'id':_0x261920[_0xcad5('0x3c')]['id']}})[_0xcad5('0x1d')](handleEntityNotFound(_0x3e8245,null))[_0xcad5('0x1d')](removeEntity(_0x3e8245,null))[_0xcad5('0x40')](handleError(_0x3e8245,null));};exports[_0xcad5('0x43')]=function(_0x546e4a,_0x3a47dc){var _0x35f753={'key':_0x546e4a[_0xcad5('0x42')][_0xcad5('0x44')]};if(_0x546e4a['body'][_0xcad5('0x45')]){_0x35f753[_0xcad5('0x45')]=_0x546e4a[_0xcad5('0x42')][_0xcad5('0x45')];}else if(_0x546e4a[_0xcad5('0x42')][_0xcad5('0x46')]){_0x35f753[_0xcad5('0x46')]=_0x546e4a[_0xcad5('0x42')][_0xcad5('0x46')];}else if(_0x546e4a[_0xcad5('0x42')][_0xcad5('0x47')]){_0x35f753[_0xcad5('0x47')]=_0x546e4a[_0xcad5('0x42')][_0xcad5('0x47')];}else if(_0x546e4a['body']['ChatWebsiteId']){_0x35f753[_0xcad5('0x48')]=_0x546e4a['body'][_0xcad5('0x48')];}return db[_0xcad5('0x27')][_0xcad5('0x3f')]({'where':_0x35f753})['then'](function(_0x1183ad){if(_0x1183ad){throw new db[(_0xcad5('0x49'))][(_0xcad5('0x4a'))](_0xcad5('0x4b'));}return db[_0xcad5('0x27')][_0xcad5('0x43')](_0x546e4a[_0xcad5('0x42')]);})[_0xcad5('0x1d')](function(_0x422f73){var _0x156d23=_0x546e4a[_0xcad5('0x4c')][_0xcad5('0x1f')]({'plain':!![]});if(!_0x156d23)throw new Error(_0xcad5('0x4d'));if(_0x156d23[_0xcad5('0x4e')]==='user'){var _0x53f090=_0x422f73[_0xcad5('0x1f')]({'plain':!![]});return db[_0xcad5('0x4f')]['find']({'where':{'name':'CannedAnswers','userProfileId':_0x156d23[_0xcad5('0x50')]},'raw':!![]})[_0xcad5('0x1d')](function(_0x3d2019){if(_0x3d2019&&_0x3d2019[_0xcad5('0x51')]===0x0){return db[_0xcad5('0x52')][_0xcad5('0x43')]({'name':_0x53f090[_0xcad5('0x24')],'resourceId':_0x53f090['id'],'type':_0x3d2019[_0xcad5('0x24')],'sectionId':_0x3d2019['id']},{})['then'](function(){return _0x422f73;});}else{return _0x422f73;}})[_0xcad5('0x40')](function(_0x121af4){logger[_0xcad5('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x121af4);throw _0x121af4;});}return _0x422f73;})['then'](respondWithResult(_0x3a47dc,0xc9))['catch'](handleError(_0x3a47dc,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 17f238d..64dbb99 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 _0x51fc=['CannedAnswer','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cannedAnswer.attributes','exports','define'];(function(_0x1fcaf1,_0x21c3c2){var _0x55f464=function(_0x348eb3){while(--_0x348eb3){_0x1fcaf1['push'](_0x1fcaf1['shift']());}};_0x55f464(++_0x21c3c2);}(_0x51fc,0x1b4));var _0xc51f=function(_0xfedc72,_0x292f02){_0xfedc72=_0xfedc72-0x0;var _0x2c7c78=_0x51fc[_0xfedc72];return _0x2c7c78;};'use strict';var _=require(_0xc51f('0x0'));var util=require('util');var logger=require(_0xc51f('0x1'))(_0xc51f('0x2'));var moment=require(_0xc51f('0x3'));var BPromise=require(_0xc51f('0x4'));var rp=require(_0xc51f('0x5'));var fs=require('fs');var path=require(_0xc51f('0x6'));var rimraf=require(_0xc51f('0x7'));var config=require(_0xc51f('0x8'));var attributes=require(_0xc51f('0x9'));module[_0xc51f('0xa')]=function(_0x56e930,_0x22e166){return _0x56e930[_0xc51f('0xb')](_0xc51f('0xc'),attributes,{'tableName':_0xc51f('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc51f('0xe'),'collate':_0xc51f('0xf')});}; \ No newline at end of file +var _0x0901=['../../config/logger','api','moment','request-promise','path','../../config/environment','exports','define','CannedAnswer','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x19883a,_0x98963a){var _0x529e8a=function(_0x1513b8){while(--_0x1513b8){_0x19883a['push'](_0x19883a['shift']());}};_0x529e8a(++_0x98963a);}(_0x0901,0x7c));var _0x1090=function(_0x2f6654,_0x3bf51d){_0x2f6654=_0x2f6654-0x0;var _0xbb3c4=_0x0901[_0x2f6654];return _0xbb3c4;};'use strict';var _=require(_0x1090('0x0'));var util=require(_0x1090('0x1'));var logger=require(_0x1090('0x2'))(_0x1090('0x3'));var moment=require(_0x1090('0x4'));var BPromise=require('bluebird');var rp=require(_0x1090('0x5'));var fs=require('fs');var path=require(_0x1090('0x6'));var rimraf=require('rimraf');var config=require(_0x1090('0x7'));var attributes=require('./cannedAnswer.attributes');module[_0x1090('0x8')]=function(_0x18d4d7,_0x3c6d2f){return _0x18d4d7[_0x1090('0x9')](_0x1090('0xa'),attributes,{'tableName':_0x1090('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1090('0xc'),'collate':_0x1090('0xd')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index e79d929..5e255b9 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(_0x16fae4,_0x201ec8){var _0x70dd1d=function(_0x5a1918){while(--_0x5a1918){_0x16fae4['push'](_0x16fae4['shift']());}};_0x70dd1d(++_0x201ec8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'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(_0x165a92,_0x4eb3ad){var _0x1f77fe=function(_0x693ed0){while(--_0x693ed0){_0x165a92['push'](_0x165a92['shift']());}};_0x1f77fe(++_0x4eb3ad);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xa9e0[_0x47e7cb];return _0x2a8874;};'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 7e40bff..b1e1c9b 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 _0x8028=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','exports','multer','util','path'];(function(_0x5e9e54,_0x40504b){var _0x390c5e=function(_0xbf8451){while(--_0xbf8451){_0x5e9e54['push'](_0x5e9e54['shift']());}};_0x390c5e(++_0x40504b);}(_0x8028,0x18d));var _0x8802=function(_0xa281f3,_0x5bbe61){_0xa281f3=_0xa281f3-0x0;var _0x2df38c=_0x8028[_0xa281f3];return _0x2df38c;};'use strict';var multer=require(_0x8802('0x0'));var util=require(_0x8802('0x1'));var path=require(_0x8802('0x2'));var timeout=require(_0x8802('0x3'));var express=require(_0x8802('0x4'));var router=express['Router']();var fs_extra=require(_0x8802('0x5'));var auth=require(_0x8802('0x6'));var interaction=require(_0x8802('0x7'));var config=require(_0x8802('0x8'));var controller=require(_0x8802('0x9'));router[_0x8802('0xa')]('/',auth[_0x8802('0xb')](),controller[_0x8802('0xc')]);router[_0x8802('0xa')](_0x8802('0xd'),auth[_0x8802('0xb')](),controller['show']);router[_0x8802('0xe')]('/',auth[_0x8802('0xb')](),controller[_0x8802('0xf')]);router[_0x8802('0x10')](_0x8802('0xd'),auth[_0x8802('0xb')](),controller[_0x8802('0x11')]);router[_0x8802('0x12')](_0x8802('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x8802('0x13')]=router; \ No newline at end of file +var _0x5631=['./cannedAnswer.controller','get','isAuthenticated','index','/:id','show','post','put','update','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4f2ce8,_0x103851){var _0x2d5b1b=function(_0x394cd5){while(--_0x394cd5){_0x4f2ce8['push'](_0x4f2ce8['shift']());}};_0x2d5b1b(++_0x103851);}(_0x5631,0x190));var _0x1563=function(_0x4fd109,_0x33c503){_0x4fd109=_0x4fd109-0x0;var _0x30f0a6=_0x5631[_0x4fd109];return _0x30f0a6;};'use strict';var multer=require(_0x1563('0x0'));var util=require(_0x1563('0x1'));var path=require('path');var timeout=require(_0x1563('0x2'));var express=require(_0x1563('0x3'));var router=express['Router']();var fs_extra=require(_0x1563('0x4'));var auth=require(_0x1563('0x5'));var interaction=require(_0x1563('0x6'));var config=require(_0x1563('0x7'));var controller=require(_0x1563('0x8'));router[_0x1563('0x9')]('/',auth[_0x1563('0xa')](),controller[_0x1563('0xb')]);router[_0x1563('0x9')](_0x1563('0xc'),auth[_0x1563('0xa')](),controller[_0x1563('0xd')]);router[_0x1563('0xe')]('/',auth[_0x1563('0xa')](),controller['create']);router[_0x1563('0xf')](_0x1563('0xc'),auth[_0x1563('0xa')](),controller[_0x1563('0x10')]);router['delete'](_0x1563('0xc'),auth[_0x1563('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 835f167..4f3a735 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 _0xbe0f=['exports','STRING','INTEGER','sequelize'];(function(_0x1f3d50,_0xccac79){var _0x181884=function(_0x5d000b){while(--_0x5d000b){_0x1f3d50['push'](_0x1f3d50['shift']());}};_0x181884(++_0xccac79);}(_0xbe0f,0x1d3));var _0xfbe0=function(_0x55cba1,_0x45e97e){_0x55cba1=_0x55cba1-0x0;var _0x2eaee9=_0xbe0f[_0x55cba1];return _0x2eaee9;};'use strict';var Sequelize=require(_0xfbe0('0x0'));module[_0xfbe0('0x1')]={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize[_0xfbe0('0x2')]},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize[_0xfbe0('0x2')]},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xfbe0('0x2')]},'dstchannel':{'type':Sequelize[_0xfbe0('0x2')]},'lastapp':{'type':Sequelize[_0xfbe0('0x2')]},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0xfbe0('0x3')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xfbe0('0x3')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0xfbe0('0x3')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xfbe0('0x2')]},'userfield':{'type':Sequelize[_0xfbe0('0x2')]},'uniqueid':{'type':Sequelize[_0xfbe0('0x2')]},'linkedid':{'type':Sequelize[_0xfbe0('0x2')]},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize[_0xfbe0('0x2')]},'type':{'type':Sequelize[_0xfbe0('0x2')]},'tag':{'type':Sequelize[_0xfbe0('0x2')]}}; \ No newline at end of file +var _0x3b75=['DATE','1970-01-01\x2000:00:01','STRING','INTEGER','sequelize','exports'];(function(_0x2693fc,_0x7bd551){var _0x23d573=function(_0x2bb5fb){while(--_0x2bb5fb){_0x2693fc['push'](_0x2693fc['shift']());}};_0x23d573(++_0x7bd551);}(_0x3b75,0xdc));var _0x53b7=function(_0x1dd82f,_0x52acb7){_0x1dd82f=_0x1dd82f-0x0;var _0x353ca4=_0x3b75[_0x1dd82f];return _0x353ca4;};'use strict';var Sequelize=require(_0x53b7('0x0'));module[_0x53b7('0x1')]={'calldate':{'type':Sequelize[_0x53b7('0x2')],'allowNull':![],'defaultValue':_0x53b7('0x3')},'clid':{'type':Sequelize[_0x53b7('0x4')]},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize[_0x53b7('0x4')]},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x53b7('0x4')]},'dstchannel':{'type':Sequelize['STRING']},'lastapp':{'type':Sequelize[_0x53b7('0x4')]},'lastdata':{'type':Sequelize[_0x53b7('0x4')]},'duration':{'type':Sequelize[_0x53b7('0x5')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x53b7('0x5')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x53b7('0x4')]},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x53b7('0x4')]},'userfield':{'type':Sequelize[_0x53b7('0x4')]},'uniqueid':{'type':Sequelize[_0x53b7('0x4')]},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize[_0x53b7('0x4')]},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x53b7('0x4')]},'tag':{'type':Sequelize[_0x53b7('0x4')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 4c3ac01..d064c03 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 _0x46ed=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','limit','undefined','set','Content-Range','json','apply','reject','update','then','stack','name','send','index','map','Cdr','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','merge','VIRTUAL','filter','options','include','rows','catch','show','params','includeAll','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch'];(function(_0x59d89e,_0x55edf5){var _0x554e93=function(_0x3d40bc){while(--_0x3d40bc){_0x59d89e['push'](_0x59d89e['shift']());}};_0x554e93(++_0x55edf5);}(_0x46ed,0x168));var _0xd46e=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x46ed[_0x199572];return _0x13cfa3;};'use strict';var emlformat=require(_0xd46e('0x0'));var rimraf=require(_0xd46e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd46e('0x2'));var rp=require(_0xd46e('0x3'));var moment=require(_0xd46e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd46e('0x5'));var util=require(_0xd46e('0x6'));var path=require('path');var sox=require(_0xd46e('0x7'));var csv=require(_0xd46e('0x8'));var ejs=require(_0xd46e('0x9'));var fs=require('fs');var fs_extra=require(_0xd46e('0xa'));var _=require(_0xd46e('0xb'));var squel=require(_0xd46e('0xc'));var crypto=require(_0xd46e('0xd'));var jsforce=require(_0xd46e('0xe'));var deskjs=require(_0xd46e('0xf'));var toCsv=require(_0xd46e('0x8'));var querystring=require(_0xd46e('0x10'));var Papa=require('papaparse');var Redis=require(_0xd46e('0x11'));var authService=require(_0xd46e('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd46e('0x13'));var hardwareService=require(_0xd46e('0x14'));var logger=require(_0xd46e('0x15'))(_0xd46e('0x16'));var utils=require(_0xd46e('0x17'));var config=require(_0xd46e('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xd46e('0x19'))['db'];function respondWithStatusCode(_0x5bc1da,_0x48550b){_0x48550b=_0x48550b||0xcc;return function(_0xf3048c){if(_0xf3048c){return _0x5bc1da[_0xd46e('0x1a')](_0x48550b);}return _0x5bc1da['status'](_0x48550b)['end']();};}function respondWithResult(_0xacd799,_0x4688ae){_0x4688ae=_0x4688ae||0xc8;return function(_0x1e9aae){if(_0x1e9aae){return _0xacd799[_0xd46e('0x1b')](_0x4688ae)['json'](_0x1e9aae);}};}function respondWithFilteredResult(_0x3b6d25,_0x44a620){return function(_0x417402){if(_0x417402){var _0x3d72ce=typeof _0x44a620[_0xd46e('0x1c')]==='undefined'&&typeof _0x44a620[_0xd46e('0x1d')]===_0xd46e('0x1e');var _0x3583a5=_0x417402['count'];var _0x5ddd04=_0x3d72ce?0x0:_0x44a620[_0xd46e('0x1c')];var _0x1bd574=_0x3d72ce?_0x417402['count']:_0x44a620['offset']+_0x44a620[_0xd46e('0x1d')];var _0x2f2571;if(_0x1bd574>=_0x3583a5){_0x1bd574=_0x3583a5;_0x2f2571=0xc8;}else{_0x2f2571=0xce;}_0x3b6d25[_0xd46e('0x1b')](_0x2f2571);return _0x3b6d25[_0xd46e('0x1f')](_0xd46e('0x20'),_0x5ddd04+'-'+_0x1bd574+'/'+_0x3583a5)[_0xd46e('0x21')](_0x417402);}return null;};}function patchUpdates(_0x3b5fa4){return function(_0x327b7e){try{jsonpatch[_0xd46e('0x22')](_0x327b7e,_0x3b5fa4,!![]);}catch(_0x3c7e91){return BPromise[_0xd46e('0x23')](_0x3c7e91);}return _0x327b7e['save']();};}function saveUpdates(_0x259072,_0x1c83fa){return function(_0x79aa51){if(_0x79aa51){return _0x79aa51[_0xd46e('0x24')](_0x259072)[_0xd46e('0x25')](function(_0xc1af7f){return _0xc1af7f;});}return null;};}function removeEntity(_0x33c2e0,_0x8a1be){return function(_0x62dea5){if(_0x62dea5){return _0x62dea5['destroy']()[_0xd46e('0x25')](function(){_0x33c2e0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x371054,_0x2a5271){return function(_0x21135f){if(!_0x21135f){_0x371054[_0xd46e('0x1a')](0x194);}return _0x21135f;};}function handleError(_0x247b9f,_0x180851){_0x180851=_0x180851||0x1f4;return function(_0x1740d1){logger['error'](_0x1740d1[_0xd46e('0x26')]);if(_0x1740d1[_0xd46e('0x27')]){delete _0x1740d1[_0xd46e('0x27')];}_0x247b9f[_0xd46e('0x1b')](_0x180851)[_0xd46e('0x28')](_0x1740d1);};}exports[_0xd46e('0x29')]=function(_0x58aeef,_0x465d54){var _0x3a1ced={},_0x2d1afe={},_0xa716ce={'count':0x0,'rows':[]};var _0x106edc=_[_0xd46e('0x2a')](db[_0xd46e('0x2b')][_0xd46e('0x2c')],function(_0x18f060){return{'name':_0x18f060[_0xd46e('0x2d')],'type':_0x18f060[_0xd46e('0x2e')][_0xd46e('0x2f')]};});_0x2d1afe[_0xd46e('0x30')]=_['map'](_0x106edc,_0xd46e('0x27'));_0x2d1afe[_0xd46e('0x31')]=_[_0xd46e('0x32')](_0x58aeef[_0xd46e('0x31')]);_0x2d1afe['filters']=_[_0xd46e('0x33')](_0x2d1afe[_0xd46e('0x30')],_0x2d1afe['query']);_0x3a1ced[_0xd46e('0x34')]=_[_0xd46e('0x33')](_0x2d1afe['model'],qs[_0xd46e('0x35')](_0x58aeef[_0xd46e('0x31')][_0xd46e('0x35')]));_0x3a1ced['attributes']=_0x3a1ced['attributes'][_0xd46e('0x36')]?_0x3a1ced[_0xd46e('0x34')]:_0x2d1afe[_0xd46e('0x30')];if(!_0x58aeef[_0xd46e('0x31')][_0xd46e('0x37')](_0xd46e('0x38'))){_0x3a1ced[_0xd46e('0x1d')]=qs[_0xd46e('0x1d')](_0x58aeef['query'][_0xd46e('0x1d')]);_0x3a1ced[_0xd46e('0x1c')]=qs[_0xd46e('0x1c')](_0x58aeef[_0xd46e('0x31')][_0xd46e('0x1c')]);}_0x3a1ced[_0xd46e('0x39')]=qs[_0xd46e('0x3a')](_0x58aeef['query'][_0xd46e('0x3a')]);_0x3a1ced[_0xd46e('0x3b')]=qs['filters'](_[_0xd46e('0x3c')](_0x58aeef[_0xd46e('0x31')],_0x2d1afe[_0xd46e('0x3d')]),_0x106edc);if(_0x58aeef[_0xd46e('0x31')]['filter']){_0x3a1ced[_0xd46e('0x3b')]=_[_0xd46e('0x3e')](_0x3a1ced[_0xd46e('0x3b')],{'$or':_[_0xd46e('0x2a')](_0x106edc,function(_0xefe5f4){if(_0xefe5f4[_0xd46e('0x2e')]!==_0xd46e('0x3f')){var _0x411318={};_0x411318[_0xefe5f4['name']]={'$like':'%'+_0x58aeef[_0xd46e('0x31')][_0xd46e('0x40')]+'%'};return _0x411318;}})});}_0x3a1ced=_[_0xd46e('0x3e')]({},_0x3a1ced,_0x58aeef[_0xd46e('0x41')]);var _0x165ce8={'where':_0x3a1ced['where']};return db[_0xd46e('0x2b')]['count'](_0x165ce8)['then'](function(_0x4c325f){_0xa716ce['count']=_0x4c325f;if(_0x58aeef[_0xd46e('0x31')]['includeAll']){_0x3a1ced[_0xd46e('0x42')]=[{'all':!![]}];}return db[_0xd46e('0x2b')]['findAll'](_0x3a1ced);})[_0xd46e('0x25')](function(_0x4114e6){_0xa716ce[_0xd46e('0x43')]=_0x4114e6;return _0xa716ce;})[_0xd46e('0x25')](respondWithFilteredResult(_0x465d54,_0x3a1ced))[_0xd46e('0x44')](handleError(_0x465d54,null));};exports[_0xd46e('0x45')]=function(_0x39ac57,_0xe75292){var _0x3a98e4={'raw':!![],'where':{'id':_0x39ac57[_0xd46e('0x46')]['id']}},_0xec367d={};_0xec367d['model']=_['keys'](db['Cdr'][_0xd46e('0x2c')]);_0xec367d['query']=_[_0xd46e('0x32')](_0x39ac57[_0xd46e('0x31')]);_0xec367d[_0xd46e('0x3d')]=_[_0xd46e('0x33')](_0xec367d[_0xd46e('0x30')],_0xec367d[_0xd46e('0x31')]);_0x3a98e4[_0xd46e('0x34')]=_[_0xd46e('0x33')](_0xec367d['model'],qs[_0xd46e('0x35')](_0x39ac57['query'][_0xd46e('0x35')]));_0x3a98e4[_0xd46e('0x34')]=_0x3a98e4[_0xd46e('0x34')][_0xd46e('0x36')]?_0x3a98e4[_0xd46e('0x34')]:_0xec367d['model'];if(_0x39ac57[_0xd46e('0x31')][_0xd46e('0x47')]){_0x3a98e4[_0xd46e('0x42')]=[{'all':!![]}];}_0x3a98e4=_[_0xd46e('0x3e')]({},_0x3a98e4,_0x39ac57[_0xd46e('0x41')]);return db['Cdr'][_0xd46e('0x48')](_0x3a98e4)[_0xd46e('0x25')](handleEntityNotFound(_0xe75292,null))[_0xd46e('0x25')](respondWithResult(_0xe75292,null))[_0xd46e('0x44')](handleError(_0xe75292,null));};exports[_0xd46e('0x49')]=function(_0x4a0d3a,_0x341d9f){return db[_0xd46e('0x2b')][_0xd46e('0x49')](_0x4a0d3a[_0xd46e('0x4a')],{})[_0xd46e('0x25')](respondWithResult(_0x341d9f,0xc9))[_0xd46e('0x44')](handleError(_0x341d9f,null));};exports[_0xd46e('0x24')]=function(_0x440dcc,_0x5188f6){if(_0x440dcc[_0xd46e('0x4a')]['id']){delete _0x440dcc[_0xd46e('0x4a')]['id'];}return db[_0xd46e('0x2b')][_0xd46e('0x48')]({'where':{'id':_0x440dcc[_0xd46e('0x46')]['id']}})['then'](handleEntityNotFound(_0x5188f6,null))['then'](saveUpdates(_0x440dcc[_0xd46e('0x4a')],null))[_0xd46e('0x25')](respondWithResult(_0x5188f6,null))[_0xd46e('0x44')](handleError(_0x5188f6,null));};exports['destroy']=function(_0x479711,_0x2ab5d8){return db[_0xd46e('0x2b')]['find']({'where':{'id':_0x479711[_0xd46e('0x46')]['id']}})[_0xd46e('0x25')](handleEntityNotFound(_0x2ab5d8,null))[_0xd46e('0x25')](removeEntity(_0x2ab5d8,null))[_0xd46e('0x44')](handleError(_0x2ab5d8,null));};exports[_0xd46e('0x4b')]=function(_0x34d4ca,_0x80ed51){return db[_0xd46e('0x2b')]['describe']()[_0xd46e('0x25')](respondWithResult(_0x80ed51,null))[_0xd46e('0x44')](handleError(_0x80ed51,null));}; \ No newline at end of file +var _0xe5d5=['status','end','offset','limit','undefined','count','set','Content-Range','json','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','Cdr','rawAttributes','type','query','keys','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','length','find','create','body','zip-dir','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x16146e,_0x2b9e52){var _0x4c8b1b=function(_0x2dd072){while(--_0x2dd072){_0x16146e['push'](_0x16146e['shift']());}};_0x4c8b1b(++_0x2b9e52);}(_0xe5d5,0x156));var _0x5e5d=function(_0x404b87,_0x1318b0){_0x404b87=_0x404b87-0x0;var _0x59eace=_0xe5d5[_0x404b87];return _0x59eace;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x5e5d('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5e5d('0x1'));var moment=require('moment');var BPromise=require(_0x5e5d('0x2'));var Mustache=require('mustache');var util=require(_0x5e5d('0x3'));var path=require(_0x5e5d('0x4'));var sox=require(_0x5e5d('0x5'));var csv=require(_0x5e5d('0x6'));var ejs=require(_0x5e5d('0x7'));var fs=require('fs');var fs_extra=require(_0x5e5d('0x8'));var _=require(_0x5e5d('0x9'));var squel=require(_0x5e5d('0xa'));var crypto=require(_0x5e5d('0xb'));var jsforce=require(_0x5e5d('0xc'));var deskjs=require(_0x5e5d('0xd'));var toCsv=require(_0x5e5d('0x6'));var querystring=require(_0x5e5d('0xe'));var Papa=require(_0x5e5d('0xf'));var Redis=require('ioredis');var authService=require(_0x5e5d('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x5e5d('0x11'));var hardwareService=require(_0x5e5d('0x12'));var logger=require('../../config/logger')(_0x5e5d('0x13'));var utils=require(_0x5e5d('0x14'));var config=require(_0x5e5d('0x15'));var licenseUtil=require(_0x5e5d('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4ff045,_0x442aed){_0x442aed=_0x442aed||0xcc;return function(_0x1e9be5){if(_0x1e9be5){return _0x4ff045['sendStatus'](_0x442aed);}return _0x4ff045[_0x5e5d('0x17')](_0x442aed)[_0x5e5d('0x18')]();};}function respondWithResult(_0x5a4474,_0x42f1f8){_0x42f1f8=_0x42f1f8||0xc8;return function(_0x3402cf){if(_0x3402cf){return _0x5a4474['status'](_0x42f1f8)['json'](_0x3402cf);}};}function respondWithFilteredResult(_0x5bf617,_0x1a3e5c){return function(_0x3dfb7e){if(_0x3dfb7e){var _0x79e8c1=typeof _0x1a3e5c[_0x5e5d('0x19')]==='undefined'&&typeof _0x1a3e5c[_0x5e5d('0x1a')]===_0x5e5d('0x1b');var _0x39964a=_0x3dfb7e[_0x5e5d('0x1c')];var _0x46b129=_0x79e8c1?0x0:_0x1a3e5c[_0x5e5d('0x19')];var _0x3b655b=_0x79e8c1?_0x3dfb7e[_0x5e5d('0x1c')]:_0x1a3e5c['offset']+_0x1a3e5c[_0x5e5d('0x1a')];var _0x1ceea7;if(_0x3b655b>=_0x39964a){_0x3b655b=_0x39964a;_0x1ceea7=0xc8;}else{_0x1ceea7=0xce;}_0x5bf617[_0x5e5d('0x17')](_0x1ceea7);return _0x5bf617[_0x5e5d('0x1d')](_0x5e5d('0x1e'),_0x46b129+'-'+_0x3b655b+'/'+_0x39964a)[_0x5e5d('0x1f')](_0x3dfb7e);}return null;};}function patchUpdates(_0x517b89){return function(_0x186fa6){try{jsonpatch['apply'](_0x186fa6,_0x517b89,!![]);}catch(_0x968d4b){return BPromise[_0x5e5d('0x20')](_0x968d4b);}return _0x186fa6[_0x5e5d('0x21')]();};}function saveUpdates(_0x4c9973,_0xbacdcb){return function(_0x488a49){if(_0x488a49){return _0x488a49[_0x5e5d('0x22')](_0x4c9973)[_0x5e5d('0x23')](function(_0x3e8a1d){return _0x3e8a1d;});}return null;};}function removeEntity(_0x49a558,_0x49d2e5){return function(_0x271af4){if(_0x271af4){return _0x271af4[_0x5e5d('0x24')]()['then'](function(){_0x49a558['status'](0xcc)[_0x5e5d('0x18')]();});}};}function handleEntityNotFound(_0x4063d5,_0xd466f7){return function(_0x479a1a){if(!_0x479a1a){_0x4063d5[_0x5e5d('0x25')](0x194);}return _0x479a1a;};}function handleError(_0x4de26a,_0x477d54){_0x477d54=_0x477d54||0x1f4;return function(_0x4ed6e5){logger[_0x5e5d('0x26')](_0x4ed6e5[_0x5e5d('0x27')]);if(_0x4ed6e5[_0x5e5d('0x28')]){delete _0x4ed6e5[_0x5e5d('0x28')];}_0x4de26a[_0x5e5d('0x17')](_0x477d54)[_0x5e5d('0x29')](_0x4ed6e5);};}exports[_0x5e5d('0x2a')]=function(_0x56b166,_0x3e407f){var _0x29a123={},_0x3442c1={},_0x4511cd={'count':0x0,'rows':[]};var _0x1f8484=_[_0x5e5d('0x2b')](db[_0x5e5d('0x2c')][_0x5e5d('0x2d')],function(_0x4fe915){return{'name':_0x4fe915['fieldName'],'type':_0x4fe915[_0x5e5d('0x2e')]['key']};});_0x3442c1['model']=_[_0x5e5d('0x2b')](_0x1f8484,_0x5e5d('0x28'));_0x3442c1[_0x5e5d('0x2f')]=_[_0x5e5d('0x30')](_0x56b166[_0x5e5d('0x2f')]);_0x3442c1['filters']=_[_0x5e5d('0x31')](_0x3442c1[_0x5e5d('0x32')],_0x3442c1[_0x5e5d('0x2f')]);_0x29a123[_0x5e5d('0x33')]=_[_0x5e5d('0x31')](_0x3442c1[_0x5e5d('0x32')],qs[_0x5e5d('0x34')](_0x56b166['query'][_0x5e5d('0x34')]));_0x29a123[_0x5e5d('0x33')]=_0x29a123['attributes']['length']?_0x29a123[_0x5e5d('0x33')]:_0x3442c1[_0x5e5d('0x32')];if(!_0x56b166[_0x5e5d('0x2f')][_0x5e5d('0x35')](_0x5e5d('0x36'))){_0x29a123[_0x5e5d('0x1a')]=qs['limit'](_0x56b166[_0x5e5d('0x2f')]['limit']);_0x29a123[_0x5e5d('0x19')]=qs[_0x5e5d('0x19')](_0x56b166[_0x5e5d('0x2f')][_0x5e5d('0x19')]);}_0x29a123[_0x5e5d('0x37')]=qs['sort'](_0x56b166[_0x5e5d('0x2f')][_0x5e5d('0x38')]);_0x29a123['where']=qs[_0x5e5d('0x39')](_['pick'](_0x56b166[_0x5e5d('0x2f')],_0x3442c1[_0x5e5d('0x39')]),_0x1f8484);if(_0x56b166[_0x5e5d('0x2f')][_0x5e5d('0x3a')]){_0x29a123[_0x5e5d('0x3b')]=_[_0x5e5d('0x3c')](_0x29a123[_0x5e5d('0x3b')],{'$or':_[_0x5e5d('0x2b')](_0x1f8484,function(_0xa51e05){if(_0xa51e05[_0x5e5d('0x2e')]!==_0x5e5d('0x3d')){var _0x1e3106={};_0x1e3106[_0xa51e05['name']]={'$like':'%'+_0x56b166[_0x5e5d('0x2f')][_0x5e5d('0x3a')]+'%'};return _0x1e3106;}})});}_0x29a123=_[_0x5e5d('0x3c')]({},_0x29a123,_0x56b166[_0x5e5d('0x3e')]);var _0x225ad5={'where':_0x29a123[_0x5e5d('0x3b')]};return db['Cdr'][_0x5e5d('0x1c')](_0x225ad5)[_0x5e5d('0x23')](function(_0x4c2667){_0x4511cd[_0x5e5d('0x1c')]=_0x4c2667;if(_0x56b166[_0x5e5d('0x2f')][_0x5e5d('0x3f')]){_0x29a123[_0x5e5d('0x40')]=[{'all':!![]}];}return db[_0x5e5d('0x2c')][_0x5e5d('0x41')](_0x29a123);})['then'](function(_0x502aac){_0x4511cd[_0x5e5d('0x42')]=_0x502aac;return _0x4511cd;})['then'](respondWithFilteredResult(_0x3e407f,_0x29a123))[_0x5e5d('0x43')](handleError(_0x3e407f,null));};exports['show']=function(_0x53d75c,_0x2d12cd){var _0x52648c={'raw':!![],'where':{'id':_0x53d75c[_0x5e5d('0x44')]['id']}},_0x550d7a={};_0x550d7a[_0x5e5d('0x32')]=_[_0x5e5d('0x30')](db[_0x5e5d('0x2c')][_0x5e5d('0x2d')]);_0x550d7a[_0x5e5d('0x2f')]=_['keys'](_0x53d75c['query']);_0x550d7a['filters']=_[_0x5e5d('0x31')](_0x550d7a['model'],_0x550d7a[_0x5e5d('0x2f')]);_0x52648c[_0x5e5d('0x33')]=_['intersection'](_0x550d7a[_0x5e5d('0x32')],qs[_0x5e5d('0x34')](_0x53d75c['query'][_0x5e5d('0x34')]));_0x52648c[_0x5e5d('0x33')]=_0x52648c[_0x5e5d('0x33')][_0x5e5d('0x45')]?_0x52648c[_0x5e5d('0x33')]:_0x550d7a['model'];if(_0x53d75c[_0x5e5d('0x2f')][_0x5e5d('0x3f')]){_0x52648c[_0x5e5d('0x40')]=[{'all':!![]}];}_0x52648c=_[_0x5e5d('0x3c')]({},_0x52648c,_0x53d75c[_0x5e5d('0x3e')]);return db[_0x5e5d('0x2c')][_0x5e5d('0x46')](_0x52648c)[_0x5e5d('0x23')](handleEntityNotFound(_0x2d12cd,null))['then'](respondWithResult(_0x2d12cd,null))[_0x5e5d('0x43')](handleError(_0x2d12cd,null));};exports[_0x5e5d('0x47')]=function(_0x1824ec,_0x5d6369){return db[_0x5e5d('0x2c')][_0x5e5d('0x47')](_0x1824ec['body'],{})[_0x5e5d('0x23')](respondWithResult(_0x5d6369,0xc9))[_0x5e5d('0x43')](handleError(_0x5d6369,null));};exports[_0x5e5d('0x22')]=function(_0x56e0ac,_0x3df625){if(_0x56e0ac[_0x5e5d('0x48')]['id']){delete _0x56e0ac[_0x5e5d('0x48')]['id'];}return db[_0x5e5d('0x2c')][_0x5e5d('0x46')]({'where':{'id':_0x56e0ac['params']['id']}})[_0x5e5d('0x23')](handleEntityNotFound(_0x3df625,null))['then'](saveUpdates(_0x56e0ac['body'],null))[_0x5e5d('0x23')](respondWithResult(_0x3df625,null))['catch'](handleError(_0x3df625,null));};exports[_0x5e5d('0x24')]=function(_0x41c3a0,_0x5b3149){return db[_0x5e5d('0x2c')][_0x5e5d('0x46')]({'where':{'id':_0x41c3a0['params']['id']}})['then'](handleEntityNotFound(_0x5b3149,null))[_0x5e5d('0x23')](removeEntity(_0x5b3149,null))[_0x5e5d('0x43')](handleError(_0x5b3149,null));};exports['describe']=function(_0x25065c,_0x46ff94){return db[_0x5e5d('0x2c')]['describe']()[_0x5e5d('0x23')](respondWithResult(_0x46ff94,null))[_0x5e5d('0x43')](handleError(_0x46ff94,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index a2583e8..659e1c8 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(_0x13585b,_0x58d60d){var _0x39cca1=function(_0x257e12){while(--_0x257e12){_0x13585b['push'](_0x13585b['shift']());}};_0x39cca1(++_0x58d60d);}(_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':'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(_0x5cae2c,_0x2ba5c4){var _0x53441e=function(_0x22177d){while(--_0x22177d){_0x5cae2c['push'](_0x5cae2c['shift']());}};_0x53441e(++_0x2ba5c4);}(_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':'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 f935128..914a7eb 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 _0xd774=['request\x20sent','stringify','error','code','message','info','result','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','request','then','Cdr,\x20%s,\x20%s','debug'];(function(_0x419441,_0xdf5783){var _0x36739d=function(_0x4b582f){while(--_0x4b582f){_0x419441['push'](_0x419441['shift']());}};_0x36739d(++_0xdf5783);}(_0xd774,0x9f));var _0x4d77=function(_0x2f7d53,_0x293f86){_0x2f7d53=_0x2f7d53-0x0;var _0x1d1271=_0xd774[_0x2f7d53];return _0x1d1271;};'use strict';var _=require(_0x4d77('0x0'));var util=require(_0x4d77('0x1'));var moment=require(_0x4d77('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4d77('0x3'));var db=require(_0x4d77('0x4'))['db'];var utils=require(_0x4d77('0x5'));var logger=require(_0x4d77('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4d77('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2a6a83,_0x2dbf18,_0x2116b2){return new BPromise(function(_0x5bcd58,_0xec4b61){return client[_0x4d77('0x8')](_0x2a6a83,_0x2116b2)[_0x4d77('0x9')](function(_0x5a5b87){logger['info'](_0x4d77('0xa'),_0x2dbf18,'request\x20sent');logger[_0x4d77('0xb')]('Cdr,\x20%s,\x20%s,\x20%s',_0x2dbf18,_0x4d77('0xc'),JSON[_0x4d77('0xd')](_0x5a5b87));if(_0x5a5b87['error']){if(_0x5a5b87[_0x4d77('0xe')][_0x4d77('0xf')]===0x1f4){logger[_0x4d77('0xe')]('Cdr,\x20%s,\x20%s',_0x2dbf18,_0x5a5b87[_0x4d77('0xe')][_0x4d77('0x10')]);return _0xec4b61(_0x5a5b87[_0x4d77('0xe')][_0x4d77('0x10')]);}logger[_0x4d77('0xe')]('Cdr,\x20%s,\x20%s',_0x2dbf18,_0x5a5b87[_0x4d77('0xe')][_0x4d77('0x10')]);return _0x5bcd58(_0x5a5b87[_0x4d77('0xe')]['message']);}else{logger[_0x4d77('0x11')]('Cdr,\x20%s,\x20%s',_0x2dbf18,_0x4d77('0xc'));_0x5bcd58(_0x5a5b87[_0x4d77('0x12')][_0x4d77('0x10')]);}})['catch'](function(_0x2ed693){logger['error']('Cdr,\x20%s,\x20%s',_0x2dbf18,_0x2ed693);_0xec4b61(_0x2ed693);});});} \ No newline at end of file +var _0x1f4c=['error','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','Cdr,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x580647,_0x43d2c3){var _0x5f0792=function(_0x386cef){while(--_0x386cef){_0x580647['push'](_0x580647['shift']());}};_0x5f0792(++_0x43d2c3);}(_0x1f4c,0x17f));var _0xc1f4=function(_0x1787cb,_0x13a8ad){_0x1787cb=_0x1787cb-0x0;var _0x23e5d0=_0x1f4c[_0x1787cb];return _0x23e5d0;};'use strict';var _=require('lodash');var util=require(_0xc1f4('0x0'));var moment=require(_0xc1f4('0x1'));var BPromise=require(_0xc1f4('0x2'));var rs=require(_0xc1f4('0x3'));var fs=require('fs');var Redis=require(_0xc1f4('0x4'));var db=require(_0xc1f4('0x5'))['db'];var utils=require(_0xc1f4('0x6'));var logger=require(_0xc1f4('0x7'))(_0xc1f4('0x8'));var config=require(_0xc1f4('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xc1f4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2aee52,_0x3a8ec9,_0xd5580d){return new BPromise(function(_0x66939d,_0x109a50){return client[_0xc1f4('0xb')](_0x2aee52,_0xd5580d)[_0xc1f4('0xc')](function(_0x29a3e0){logger[_0xc1f4('0xd')](_0xc1f4('0xe'),_0x3a8ec9,_0xc1f4('0xf'));logger[_0xc1f4('0x10')]('Cdr,\x20%s,\x20%s,\x20%s',_0x3a8ec9,_0xc1f4('0xf'),JSON['stringify'](_0x29a3e0));if(_0x29a3e0[_0xc1f4('0x11')]){if(_0x29a3e0[_0xc1f4('0x11')]['code']===0x1f4){logger[_0xc1f4('0x11')](_0xc1f4('0xe'),_0x3a8ec9,_0x29a3e0[_0xc1f4('0x11')][_0xc1f4('0x12')]);return _0x109a50(_0x29a3e0[_0xc1f4('0x11')][_0xc1f4('0x12')]);}logger[_0xc1f4('0x11')](_0xc1f4('0xe'),_0x3a8ec9,_0x29a3e0[_0xc1f4('0x11')][_0xc1f4('0x12')]);return _0x66939d(_0x29a3e0[_0xc1f4('0x11')][_0xc1f4('0x12')]);}else{logger[_0xc1f4('0xd')](_0xc1f4('0xe'),_0x3a8ec9,'request\x20sent');_0x66939d(_0x29a3e0[_0xc1f4('0x13')][_0xc1f4('0x12')]);}})['catch'](function(_0x5de677){logger[_0xc1f4('0x11')](_0xc1f4('0xe'),_0x3a8ec9,_0x5de677);_0x109a50(_0x5de677);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index c57b3f1..fb9aba5 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(_0x36633f,_0x26e83d){var _0x480eb0=function(_0x2e4919){while(--_0x2e4919){_0x36633f['push'](_0x36633f['shift']());}};_0x480eb0(++_0x26e83d);}(_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 +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(_0x562456,_0x9ad741){var _0x46d4a9=function(_0x3e9f18){while(--_0x3e9f18){_0x562456['push'](_0x562456['shift']());}};_0x46d4a9(++_0x9ad741);}(_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 diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index 9c834b6..a12d338 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 _0xcc2d=['exports','INTEGER','STRING','TEXT','*,*,*,*','sequelize'];(function(_0x14cd07,_0x5af8ce){var _0x2ffc8b=function(_0x13280c){while(--_0x13280c){_0x14cd07['push'](_0x14cd07['shift']());}};_0x2ffc8b(++_0x5af8ce);}(_0xcc2d,0x7d));var _0xdcc2=function(_0x3d3a4c,_0x550694){_0x3d3a4c=_0x3d3a4c-0x0;var _0x5b84a0=_0xcc2d[_0x3d3a4c];return _0x5b84a0;};'use strict';var Sequelize=require(_0xdcc2('0x0'));module[_0xdcc2('0x1')]={'priority':{'type':Sequelize[_0xdcc2('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xdcc2('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xdcc2('0x4')]()},'description':{'type':Sequelize[_0xdcc2('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xdcc2('0x5')}}; \ No newline at end of file +var _0x38dc=['TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING','noop'];(function(_0x2fd970,_0x4161d9){var _0x1992a1=function(_0x5f4130){while(--_0x5f4130){_0x2fd970['push'](_0x2fd970['shift']());}};_0x1992a1(++_0x4161d9);}(_0x38dc,0xf7));var _0xc38d=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x38dc[_0x3ab51d];return _0x29a04e;};'use strict';var Sequelize=require(_0xc38d('0x0'));module[_0xc38d('0x1')]={'priority':{'type':Sequelize[_0xc38d('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xc38d('0x3')],'allowNull':![],'defaultValue':_0xc38d('0x4')},'appdata':{'type':Sequelize[_0xc38d('0x5')]()},'description':{'type':Sequelize[_0xc38d('0x3')]},'interval':{'type':Sequelize[_0xc38d('0x3')],'defaultValue':_0xc38d('0x6')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index c3fe4a1..64a30c7 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 _0xf958=['length','includeAll','include','merge','options','find','catch','update','body','destroy','eml-format','zip-dir','request-promise','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','end','json','undefined','limit','offset','Content-Range','reject','save','then','error','name','send','params','model','keys','ChatApplication','rawAttributes','query','filters','intersection','fields','attributes'];(function(_0x204ad4,_0x502841){var _0x50675f=function(_0x30ad49){while(--_0x30ad49){_0x204ad4['push'](_0x204ad4['shift']());}};_0x50675f(++_0x502841);}(_0xf958,0xe6));var _0x8f95=function(_0x44e099,_0x5474c6){_0x44e099=_0x44e099-0x0;var _0x670b3e=_0xf958[_0x44e099];return _0x670b3e;};'use strict';var emlformat=require(_0x8f95('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8f95('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8f95('0x2'));var moment=require('moment');var BPromise=require(_0x8f95('0x3'));var Mustache=require(_0x8f95('0x4'));var util=require(_0x8f95('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x8f95('0x6'));var ejs=require(_0x8f95('0x7'));var fs=require('fs');var fs_extra=require(_0x8f95('0x8'));var _=require(_0x8f95('0x9'));var squel=require('squel');var crypto=require(_0x8f95('0xa'));var jsforce=require(_0x8f95('0xb'));var deskjs=require(_0x8f95('0xc'));var toCsv=require(_0x8f95('0x6'));var querystring=require(_0x8f95('0xd'));var Papa=require('papaparse');var Redis=require(_0x8f95('0xe'));var authService=require(_0x8f95('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x8f95('0x10'));var hardwareService=require(_0x8f95('0x11'));var logger=require(_0x8f95('0x12'))('api');var utils=require(_0x8f95('0x13'));var config=require(_0x8f95('0x14'));var licenseUtil=require(_0x8f95('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x464cff,_0x158a35){_0x158a35=_0x158a35||0xcc;return function(_0x7fc65f){if(_0x7fc65f){return _0x464cff['sendStatus'](_0x158a35);}return _0x464cff[_0x8f95('0x16')](_0x158a35)[_0x8f95('0x17')]();};}function respondWithResult(_0x230d97,_0x13f9e8){_0x13f9e8=_0x13f9e8||0xc8;return function(_0x12f4d3){if(_0x12f4d3){return _0x230d97[_0x8f95('0x16')](_0x13f9e8)[_0x8f95('0x18')](_0x12f4d3);}};}function respondWithFilteredResult(_0x572747,_0x517c3e){return function(_0x4da5f0){if(_0x4da5f0){var _0x56e816=typeof _0x517c3e['offset']===_0x8f95('0x19')&&typeof _0x517c3e[_0x8f95('0x1a')]===_0x8f95('0x19');var _0x907633=_0x4da5f0['count'];var _0x5da758=_0x56e816?0x0:_0x517c3e[_0x8f95('0x1b')];var _0x17b85b=_0x56e816?_0x4da5f0['count']:_0x517c3e[_0x8f95('0x1b')]+_0x517c3e[_0x8f95('0x1a')];var _0x400849;if(_0x17b85b>=_0x907633){_0x17b85b=_0x907633;_0x400849=0xc8;}else{_0x400849=0xce;}_0x572747[_0x8f95('0x16')](_0x400849);return _0x572747['set'](_0x8f95('0x1c'),_0x5da758+'-'+_0x17b85b+'/'+_0x907633)[_0x8f95('0x18')](_0x4da5f0);}return null;};}function patchUpdates(_0x2b90bf){return function(_0x406da2){try{jsonpatch['apply'](_0x406da2,_0x2b90bf,!![]);}catch(_0x53f819){return BPromise[_0x8f95('0x1d')](_0x53f819);}return _0x406da2[_0x8f95('0x1e')]();};}function saveUpdates(_0x13e7c5,_0x1c7a29){return function(_0x166c3c){if(_0x166c3c){return _0x166c3c['update'](_0x13e7c5)[_0x8f95('0x1f')](function(_0xa3b182){return _0xa3b182;});}return null;};}function removeEntity(_0x4ea420,_0x205c3e){return function(_0x284eb7){if(_0x284eb7){return _0x284eb7['destroy']()[_0x8f95('0x1f')](function(){_0x4ea420[_0x8f95('0x16')](0xcc)[_0x8f95('0x17')]();});}};}function handleEntityNotFound(_0xb00b6f,_0x48d79f){return function(_0x2ef192){if(!_0x2ef192){_0xb00b6f['sendStatus'](0x194);}return _0x2ef192;};}function handleError(_0x4d09c4,_0x3382d8){_0x3382d8=_0x3382d8||0x1f4;return function(_0x5dabb6){logger[_0x8f95('0x20')](_0x5dabb6['stack']);if(_0x5dabb6['name']){delete _0x5dabb6[_0x8f95('0x21')];}_0x4d09c4['status'](_0x3382d8)[_0x8f95('0x22')](_0x5dabb6);};}exports['show']=function(_0x43c843,_0x3fc1d9){var _0x470bf4={'raw':!![],'where':{'id':_0x43c843[_0x8f95('0x23')]['id']}},_0x2bb4ea={};_0x2bb4ea[_0x8f95('0x24')]=_[_0x8f95('0x25')](db[_0x8f95('0x26')][_0x8f95('0x27')]);_0x2bb4ea[_0x8f95('0x28')]=_[_0x8f95('0x25')](_0x43c843['query']);_0x2bb4ea[_0x8f95('0x29')]=_[_0x8f95('0x2a')](_0x2bb4ea['model'],_0x2bb4ea['query']);_0x470bf4['attributes']=_[_0x8f95('0x2a')](_0x2bb4ea['model'],qs[_0x8f95('0x2b')](_0x43c843['query']['fields']));_0x470bf4[_0x8f95('0x2c')]=_0x470bf4[_0x8f95('0x2c')][_0x8f95('0x2d')]?_0x470bf4[_0x8f95('0x2c')]:_0x2bb4ea[_0x8f95('0x24')];if(_0x43c843[_0x8f95('0x28')][_0x8f95('0x2e')]){_0x470bf4[_0x8f95('0x2f')]=[{'all':!![]}];}_0x470bf4=_[_0x8f95('0x30')]({},_0x470bf4,_0x43c843[_0x8f95('0x31')]);return db['ChatApplication'][_0x8f95('0x32')](_0x470bf4)['then'](handleEntityNotFound(_0x3fc1d9,null))[_0x8f95('0x1f')](respondWithResult(_0x3fc1d9,null))[_0x8f95('0x33')](handleError(_0x3fc1d9,null));};exports[_0x8f95('0x34')]=function(_0x334ffe,_0x502689){if(_0x334ffe[_0x8f95('0x35')]['id']){delete _0x334ffe[_0x8f95('0x35')]['id'];}return db[_0x8f95('0x26')]['find']({'where':{'id':_0x334ffe['params']['id']}})[_0x8f95('0x1f')](handleEntityNotFound(_0x502689,null))[_0x8f95('0x1f')](saveUpdates(_0x334ffe['body'],null))[_0x8f95('0x1f')](respondWithResult(_0x502689,null))[_0x8f95('0x33')](handleError(_0x502689,null));};exports[_0x8f95('0x36')]=function(_0x21391f,_0xb4a48b){return db[_0x8f95('0x26')][_0x8f95('0x32')]({'where':{'id':_0x21391f[_0x8f95('0x23')]['id']}})[_0x8f95('0x1f')](handleEntityNotFound(_0xb4a48b,null))[_0x8f95('0x1f')](removeEntity(_0xb4a48b,null))[_0x8f95('0x33')](handleError(_0xb4a48b,null));}; \ No newline at end of file +var _0x3360=['destroy','end','stack','name','send','show','ChatApplication','rawAttributes','query','keys','filters','model','attributes','fields','length','includeAll','include','merge','options','find','catch','body','params','eml-format','rimraf','moment','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','undefined','count','offset','limit','json','apply','reject','save','update','then'];(function(_0x180b77,_0x51415a){var _0x4a00f4=function(_0x33705a){while(--_0x33705a){_0x180b77['push'](_0x180b77['shift']());}};_0x4a00f4(++_0x51415a);}(_0x3360,0x1d7));var _0x0336=function(_0x30e6e0,_0x146e93){_0x30e6e0=_0x30e6e0-0x0;var _0x54b2ed=_0x3360[_0x30e6e0];return _0x54b2ed;};'use strict';var emlformat=require(_0x0336('0x0'));var rimraf=require(_0x0336('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0336('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0336('0x3'));var path=require(_0x0336('0x4'));var sox=require(_0x0336('0x5'));var csv=require(_0x0336('0x6'));var ejs=require(_0x0336('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x0336('0x8'));var crypto=require(_0x0336('0x9'));var jsforce=require(_0x0336('0xa'));var deskjs=require(_0x0336('0xb'));var toCsv=require(_0x0336('0x6'));var querystring=require('querystring');var Papa=require(_0x0336('0xc'));var Redis=require(_0x0336('0xd'));var authService=require(_0x0336('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x0336('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0336('0x10'))(_0x0336('0x11'));var utils=require(_0x0336('0x12'));var config=require(_0x0336('0x13'));var licenseUtil=require(_0x0336('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3bf62c,_0xa90c0a){_0xa90c0a=_0xa90c0a||0xcc;return function(_0x26f444){if(_0x26f444){return _0x3bf62c[_0x0336('0x15')](_0xa90c0a);}return _0x3bf62c[_0x0336('0x16')](_0xa90c0a)['end']();};}function respondWithResult(_0x103899,_0x406614){_0x406614=_0x406614||0xc8;return function(_0x260584){if(_0x260584){return _0x103899[_0x0336('0x16')](_0x406614)['json'](_0x260584);}};}function respondWithFilteredResult(_0x188076,_0x55b910){return function(_0x2279d1){if(_0x2279d1){var _0x451c76=typeof _0x55b910['offset']==='undefined'&&typeof _0x55b910['limit']===_0x0336('0x17');var _0x15a59b=_0x2279d1[_0x0336('0x18')];var _0x2f6e9a=_0x451c76?0x0:_0x55b910[_0x0336('0x19')];var _0x5c57fc=_0x451c76?_0x2279d1[_0x0336('0x18')]:_0x55b910[_0x0336('0x19')]+_0x55b910[_0x0336('0x1a')];var _0xafcdd9;if(_0x5c57fc>=_0x15a59b){_0x5c57fc=_0x15a59b;_0xafcdd9=0xc8;}else{_0xafcdd9=0xce;}_0x188076['status'](_0xafcdd9);return _0x188076['set']('Content-Range',_0x2f6e9a+'-'+_0x5c57fc+'/'+_0x15a59b)[_0x0336('0x1b')](_0x2279d1);}return null;};}function patchUpdates(_0x1e0027){return function(_0x1f3d95){try{jsonpatch[_0x0336('0x1c')](_0x1f3d95,_0x1e0027,!![]);}catch(_0x5d9f83){return BPromise[_0x0336('0x1d')](_0x5d9f83);}return _0x1f3d95[_0x0336('0x1e')]();};}function saveUpdates(_0x41ccd3,_0x578575){return function(_0x5c9e4d){if(_0x5c9e4d){return _0x5c9e4d[_0x0336('0x1f')](_0x41ccd3)[_0x0336('0x20')](function(_0x63af92){return _0x63af92;});}return null;};}function removeEntity(_0x19de7f,_0x25ba54){return function(_0x1a2616){if(_0x1a2616){return _0x1a2616[_0x0336('0x21')]()['then'](function(){_0x19de7f[_0x0336('0x16')](0xcc)[_0x0336('0x22')]();});}};}function handleEntityNotFound(_0x3d2c31,_0xcfbd3b){return function(_0x39677a){if(!_0x39677a){_0x3d2c31[_0x0336('0x15')](0x194);}return _0x39677a;};}function handleError(_0xe9d2dd,_0x52ef7f){_0x52ef7f=_0x52ef7f||0x1f4;return function(_0x2156d0){logger['error'](_0x2156d0[_0x0336('0x23')]);if(_0x2156d0[_0x0336('0x24')]){delete _0x2156d0[_0x0336('0x24')];}_0xe9d2dd[_0x0336('0x16')](_0x52ef7f)[_0x0336('0x25')](_0x2156d0);};}exports[_0x0336('0x26')]=function(_0x331317,_0x493cd4){var _0x25d2d9={'raw':!![],'where':{'id':_0x331317['params']['id']}},_0x4714c2={};_0x4714c2['model']=_['keys'](db[_0x0336('0x27')][_0x0336('0x28')]);_0x4714c2[_0x0336('0x29')]=_[_0x0336('0x2a')](_0x331317[_0x0336('0x29')]);_0x4714c2[_0x0336('0x2b')]=_['intersection'](_0x4714c2[_0x0336('0x2c')],_0x4714c2[_0x0336('0x29')]);_0x25d2d9[_0x0336('0x2d')]=_['intersection'](_0x4714c2[_0x0336('0x2c')],qs[_0x0336('0x2e')](_0x331317[_0x0336('0x29')][_0x0336('0x2e')]));_0x25d2d9[_0x0336('0x2d')]=_0x25d2d9['attributes'][_0x0336('0x2f')]?_0x25d2d9[_0x0336('0x2d')]:_0x4714c2[_0x0336('0x2c')];if(_0x331317['query'][_0x0336('0x30')]){_0x25d2d9[_0x0336('0x31')]=[{'all':!![]}];}_0x25d2d9=_[_0x0336('0x32')]({},_0x25d2d9,_0x331317[_0x0336('0x33')]);return db['ChatApplication'][_0x0336('0x34')](_0x25d2d9)[_0x0336('0x20')](handleEntityNotFound(_0x493cd4,null))[_0x0336('0x20')](respondWithResult(_0x493cd4,null))[_0x0336('0x35')](handleError(_0x493cd4,null));};exports[_0x0336('0x1f')]=function(_0x2ef62c,_0x64c8c3){if(_0x2ef62c[_0x0336('0x36')]['id']){delete _0x2ef62c[_0x0336('0x36')]['id'];}return db[_0x0336('0x27')][_0x0336('0x34')]({'where':{'id':_0x2ef62c['params']['id']}})[_0x0336('0x20')](handleEntityNotFound(_0x64c8c3,null))[_0x0336('0x20')](saveUpdates(_0x2ef62c['body'],null))['then'](respondWithResult(_0x64c8c3,null))[_0x0336('0x35')](handleError(_0x64c8c3,null));};exports[_0x0336('0x21')]=function(_0x4c1ba8,_0x15db29){return db[_0x0336('0x27')][_0x0336('0x34')]({'where':{'id':_0x4c1ba8[_0x0336('0x37')]['id']}})['then'](handleEntityNotFound(_0x15db29,null))[_0x0336('0x20')](removeEntity(_0x15db29,null))[_0x0336('0x35')](handleError(_0x15db29,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 4e4b6a4..dd46e1f 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 _0x6921=['request-promise','rimraf','./chatApplication.attributes','exports','define','ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci','util','api','bluebird'];(function(_0x4f5542,_0x43b5be){var _0x1a756a=function(_0x33f07b){while(--_0x33f07b){_0x4f5542['push'](_0x4f5542['shift']());}};_0x1a756a(++_0x43b5be);}(_0x6921,0x1d1));var _0x1692=function(_0x571ed6,_0x45eb4e){_0x571ed6=_0x571ed6-0x0;var _0x3d7647=_0x6921[_0x571ed6];return _0x3d7647;};'use strict';var _=require('lodash');var util=require(_0x1692('0x0'));var logger=require('../../config/logger')(_0x1692('0x1'));var moment=require('moment');var BPromise=require(_0x1692('0x2'));var rp=require(_0x1692('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1692('0x4'));var config=require('../../config/environment');var attributes=require(_0x1692('0x5'));module[_0x1692('0x6')]=function(_0x15f20e,_0x14fbfe){return _0x15f20e[_0x1692('0x7')](_0x1692('0x8'),attributes,{'tableName':_0x1692('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1692('0xa'),'collate':_0x1692('0xb')});}; \ No newline at end of file +var _0x6953=['chat_applications','utf8mb4','lodash','util','bluebird','path','rimraf','../../config/environment','exports','define','ChatApplication'];(function(_0x233dc0,_0x2866ad){var _0x1fc160=function(_0x51e38b){while(--_0x51e38b){_0x233dc0['push'](_0x233dc0['shift']());}};_0x1fc160(++_0x2866ad);}(_0x6953,0x91));var _0x3695=function(_0x2df5c6,_0x259b3c){_0x2df5c6=_0x2df5c6-0x0;var _0x2fdcd2=_0x6953[_0x2df5c6];return _0x2fdcd2;};'use strict';var _=require(_0x3695('0x0'));var util=require(_0x3695('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x3695('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3695('0x3'));var rimraf=require(_0x3695('0x4'));var config=require(_0x3695('0x5'));var attributes=require('./chatApplication.attributes');module[_0x3695('0x6')]=function(_0x558026,_0x2d7d98){return _0x558026[_0x3695('0x7')](_0x3695('0x8'),attributes,{'tableName':_0x3695('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3695('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 1889eb3..5b77dca 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 _0xbfbe=['then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','http'];(function(_0x147c1b,_0x5a6cef){var _0x4b1c43=function(_0xe0bdc5){while(--_0xe0bdc5){_0x147c1b['push'](_0x147c1b['shift']());}};_0x4b1c43(++_0x5a6cef);}(_0xbfbe,0x187));var _0xebfb=function(_0x35f7d1,_0x39d318){_0x35f7d1=_0x35f7d1-0x0;var _0x53ac5f=_0xbfbe[_0x35f7d1];return _0x53ac5f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xebfb('0x0'));var BPromise=require(_0xebfb('0x1'));var rs=require(_0xebfb('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xebfb('0x3'))['db'];var utils=require(_0xebfb('0x4'));var logger=require('../../config/logger')(_0xebfb('0x5'));var config=require('../../config/environment');var jayson=require(_0xebfb('0x6'));var client=jayson['client'][_0xebfb('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x331959,_0x3de9c6,_0x55ab8d){return new BPromise(function(_0x11cc20,_0x4de8f8){return client['request'](_0x331959,_0x55ab8d)[_0xebfb('0x8')](function(_0x580777){logger[_0xebfb('0x9')](_0xebfb('0xa'),_0x3de9c6,_0xebfb('0xb'));logger[_0xebfb('0xc')](_0xebfb('0xd'),_0x3de9c6,_0xebfb('0xb'),JSON[_0xebfb('0xe')](_0x580777));if(_0x580777[_0xebfb('0xf')]){if(_0x580777['error'][_0xebfb('0x10')]===0x1f4){logger['error'](_0xebfb('0xa'),_0x3de9c6,_0x580777[_0xebfb('0xf')][_0xebfb('0x11')]);return _0x4de8f8(_0x580777[_0xebfb('0xf')][_0xebfb('0x11')]);}logger[_0xebfb('0xf')](_0xebfb('0xa'),_0x3de9c6,_0x580777[_0xebfb('0xf')]['message']);return _0x11cc20(_0x580777[_0xebfb('0xf')][_0xebfb('0x11')]);}else{logger['info'](_0xebfb('0xa'),_0x3de9c6,_0xebfb('0xb'));_0x11cc20(_0x580777[_0xebfb('0x12')][_0xebfb('0x11')]);}})['catch'](function(_0x1d6320){logger[_0xebfb('0xf')](_0xebfb('0xa'),_0x3de9c6,_0x1d6320);_0x4de8f8(_0x1d6320);});});} \ No newline at end of file +var _0xfa8c=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','then','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','lodash'];(function(_0x223c0e,_0xa23c8a){var _0x48e91c=function(_0x3339a9){while(--_0x3339a9){_0x223c0e['push'](_0x223c0e['shift']());}};_0x48e91c(++_0xa23c8a);}(_0xfa8c,0x153));var _0xcfa8=function(_0x25414b,_0x3a32b4){_0x25414b=_0x25414b-0x0;var _0x9433e=_0xfa8c[_0x25414b];return _0x9433e;};'use strict';var _=require(_0xcfa8('0x0'));var util=require('util');var moment=require(_0xcfa8('0x1'));var BPromise=require(_0xcfa8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcfa8('0x3'));var db=require(_0xcfa8('0x4'))['db'];var utils=require(_0xcfa8('0x5'));var logger=require(_0xcfa8('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xcfa8('0x7'));var client=jayson[_0xcfa8('0x8')][_0xcfa8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3f8f37,_0x3a13bf,_0x4de7cf){return new BPromise(function(_0x5dea88,_0x55985b){return client['request'](_0x3f8f37,_0x4de7cf)[_0xcfa8('0xa')](function(_0x430c25){logger['info'](_0xcfa8('0xb'),_0x3a13bf,_0xcfa8('0xc'));logger[_0xcfa8('0xd')](_0xcfa8('0xe'),_0x3a13bf,_0xcfa8('0xc'),JSON[_0xcfa8('0xf')](_0x430c25));if(_0x430c25[_0xcfa8('0x10')]){if(_0x430c25[_0xcfa8('0x10')][_0xcfa8('0x11')]===0x1f4){logger[_0xcfa8('0x10')](_0xcfa8('0xb'),_0x3a13bf,_0x430c25[_0xcfa8('0x10')][_0xcfa8('0x12')]);return _0x55985b(_0x430c25[_0xcfa8('0x10')][_0xcfa8('0x12')]);}logger[_0xcfa8('0x10')](_0xcfa8('0xb'),_0x3a13bf,_0x430c25[_0xcfa8('0x10')][_0xcfa8('0x12')]);return _0x5dea88(_0x430c25['error']['message']);}else{logger[_0xcfa8('0x13')](_0xcfa8('0xb'),_0x3a13bf,_0xcfa8('0xc'));_0x5dea88(_0x430c25['result'][_0xcfa8('0x12')]);}})['catch'](function(_0x2bbdbe){logger['error'](_0xcfa8('0xb'),_0x3a13bf,_0x2bbdbe);_0x55985b(_0x2bbdbe);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 35f7692..cfc9cc0 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 _0xf6a3=['/:id','isAuthenticated','show','update','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./chatApplication.controller','get'];(function(_0x13606d,_0x30f265){var _0x1b85b0=function(_0x285c1b){while(--_0x285c1b){_0x13606d['push'](_0x13606d['shift']());}};_0x1b85b0(++_0x30f265);}(_0xf6a3,0x1b9));var _0x3f6a=function(_0x4a7a56,_0x650d91){_0x4a7a56=_0x4a7a56-0x0;var _0x5a6dc6=_0xf6a3[_0x4a7a56];return _0x5a6dc6;};'use strict';var multer=require(_0x3f6a('0x0'));var util=require(_0x3f6a('0x1'));var path=require(_0x3f6a('0x2'));var timeout=require(_0x3f6a('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x3f6a('0x4'));var auth=require(_0x3f6a('0x5'));var interaction=require(_0x3f6a('0x6'));var config=require('../../config/environment');var controller=require(_0x3f6a('0x7'));router[_0x3f6a('0x8')](_0x3f6a('0x9'),auth[_0x3f6a('0xa')](),controller[_0x3f6a('0xb')]);router['put'](_0x3f6a('0x9'),auth[_0x3f6a('0xa')](),controller[_0x3f6a('0xc')]);router['delete'](_0x3f6a('0x9'),auth[_0x3f6a('0xa')](),controller[_0x3f6a('0xd')]);module[_0x3f6a('0xe')]=router; \ No newline at end of file +var _0xb1e5=['destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller','get','/:id','isAuthenticated','show','put','update','delete'];(function(_0x53a565,_0x39f4a4){var _0x273609=function(_0x41fad4){while(--_0x41fad4){_0x53a565['push'](_0x53a565['shift']());}};_0x273609(++_0x39f4a4);}(_0xb1e5,0x134));var _0x5b1e=function(_0xc45636,_0x1e7676){_0xc45636=_0xc45636-0x0;var _0x49bf12=_0xb1e5[_0xc45636];return _0x49bf12;};'use strict';var multer=require(_0x5b1e('0x0'));var util=require('util');var path=require(_0x5b1e('0x1'));var timeout=require('connect-timeout');var express=require(_0x5b1e('0x2'));var router=express[_0x5b1e('0x3')]();var fs_extra=require(_0x5b1e('0x4'));var auth=require(_0x5b1e('0x5'));var interaction=require(_0x5b1e('0x6'));var config=require(_0x5b1e('0x7'));var controller=require(_0x5b1e('0x8'));router[_0x5b1e('0x9')](_0x5b1e('0xa'),auth[_0x5b1e('0xb')](),controller[_0x5b1e('0xc')]);router[_0x5b1e('0xd')](_0x5b1e('0xa'),auth['isAuthenticated'](),controller[_0x5b1e('0xe')]);router[_0x5b1e('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x5b1e('0x10')]);module[_0x5b1e('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 d5ef8dc..17b68f1 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 _0xd0eb=['STRING','BOOLEAN','exports'];(function(_0x5585d7,_0x177ead){var _0x5827a0=function(_0x56e48b){while(--_0x56e48b){_0x5585d7['push'](_0x5585d7['shift']());}};_0x5827a0(++_0x177ead);}(_0xd0eb,0x15b));var _0xbd0e=function(_0x5c811c,_0x313b25){_0x5c811c=_0x5c811c-0x0;var _0x5df3af=_0xd0eb[_0x5c811c];return _0x5df3af;};'use strict';var Sequelize=require('sequelize');module[_0xbd0e('0x0')]={'name':{'type':Sequelize[_0xbd0e('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xbd0e('0x1')]},'write':{'type':Sequelize[_0xbd0e('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0x234b=['sequelize','exports','BOOLEAN'];(function(_0x5f7894,_0x1e1d60){var _0x4d7731=function(_0x4d4e67){while(--_0x4d4e67){_0x5f7894['push'](_0x5f7894['shift']());}};_0x4d7731(++_0x1e1d60);}(_0x234b,0x183));var _0xb234=function(_0x4d6657,_0x421c7c){_0x4d6657=_0x4d6657-0x0;var _0x2a157c=_0x234b[_0x4d6657];return _0x2a157c;};'use strict';var Sequelize=require(_0xb234('0x0'));module[_0xb234('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize[_0xb234('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 9785efe..2fc4f5e 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 _0xbd7b=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','socket.io-emitter','./chatGroup.socket','register','sendStatus','status','end','offset','undefined','count','limit','set','reject','save','update','destroy','then','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','nolimit','sort','where','pick','VIRTUAL','ChatGroup','includeAll','include','findAll','rows','catch','params','merge','options','find','create','body','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','ids','findOne','order','filter','hasOwnProperty','getMembers','removeMembers','addMessage','ChatGroupId','getMessages','$gte','split','format','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x1e3c16,_0x372caa){var _0x47a0c9=function(_0x47f81d){while(--_0x47f81d){_0x1e3c16['push'](_0x1e3c16['shift']());}};_0x47a0c9(++_0x372caa);}(_0xbd7b,0x1ca));var _0xbbd7=function(_0x2836ef,_0x27d12d){_0x2836ef=_0x2836ef-0x0;var _0x40b686=_0xbd7b[_0x2836ef];return _0x40b686;};'use strict';var emlformat=require(_0xbbd7('0x0'));var rimraf=require(_0xbbd7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbbd7('0x2'));var rp=require(_0xbbd7('0x3'));var moment=require('moment');var BPromise=require(_0xbbd7('0x4'));var Mustache=require(_0xbbd7('0x5'));var util=require(_0xbbd7('0x6'));var path=require('path');var sox=require(_0xbbd7('0x7'));var csv=require(_0xbbd7('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbbd7('0x9'));var _=require('lodash');var squel=require(_0xbbd7('0xa'));var crypto=require('crypto');var jsforce=require(_0xbbd7('0xb'));var deskjs=require(_0xbbd7('0xc'));var toCsv=require(_0xbbd7('0x8'));var querystring=require(_0xbbd7('0xd'));var Papa=require(_0xbbd7('0xe'));var Redis=require(_0xbbd7('0xf'));var authService=require(_0xbbd7('0x10'));var qs=require(_0xbbd7('0x11'));var as=require(_0xbbd7('0x12'));var hardwareService=require(_0xbbd7('0x13'));var logger=require(_0xbbd7('0x14'))(_0xbbd7('0x15'));var utils=require(_0xbbd7('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xbbd7('0x17'));var db=require(_0xbbd7('0x18'))['db'];config['redis']=_[_0xbbd7('0x19')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xbbd7('0x1a'))(new Redis(config['redis']));require(_0xbbd7('0x1b'))[_0xbbd7('0x1c')](socket);function respondWithStatusCode(_0x2a2267,_0x1f79ac){_0x1f79ac=_0x1f79ac||0xcc;return function(_0x1f948a){if(_0x1f948a){return _0x2a2267[_0xbbd7('0x1d')](_0x1f79ac);}return _0x2a2267[_0xbbd7('0x1e')](_0x1f79ac)[_0xbbd7('0x1f')]();};}function respondWithResult(_0x400dd3,_0x3b390f){_0x3b390f=_0x3b390f||0xc8;return function(_0x4fb2fd){if(_0x4fb2fd){return _0x400dd3[_0xbbd7('0x1e')](_0x3b390f)['json'](_0x4fb2fd);}};}function respondWithFilteredResult(_0x1c4d0f,_0x13ba42){return function(_0x56bab4){if(_0x56bab4){var _0x43078f=typeof _0x13ba42[_0xbbd7('0x20')]==='undefined'&&typeof _0x13ba42['limit']===_0xbbd7('0x21');var _0x542026=_0x56bab4['count'];var _0x3c976c=_0x43078f?0x0:_0x13ba42[_0xbbd7('0x20')];var _0x5f38f3=_0x43078f?_0x56bab4[_0xbbd7('0x22')]:_0x13ba42[_0xbbd7('0x20')]+_0x13ba42[_0xbbd7('0x23')];var _0xbf41b8;if(_0x5f38f3>=_0x542026){_0x5f38f3=_0x542026;_0xbf41b8=0xc8;}else{_0xbf41b8=0xce;}_0x1c4d0f['status'](_0xbf41b8);return _0x1c4d0f[_0xbbd7('0x24')]('Content-Range',_0x3c976c+'-'+_0x5f38f3+'/'+_0x542026)['json'](_0x56bab4);}return null;};}function patchUpdates(_0xd5d355){return function(_0x356425){try{jsonpatch['apply'](_0x356425,_0xd5d355,!![]);}catch(_0x312b23){return BPromise[_0xbbd7('0x25')](_0x312b23);}return _0x356425[_0xbbd7('0x26')]();};}function saveUpdates(_0xc222ab,_0x54eae6){return function(_0x5eb5a7){if(_0x5eb5a7){return _0x5eb5a7[_0xbbd7('0x27')](_0xc222ab)['then'](function(_0x19f8e8){return _0x19f8e8;});}return null;};}function removeEntity(_0x9e7b10,_0x178ec7){return function(_0x28ef3b){if(_0x28ef3b){return _0x28ef3b[_0xbbd7('0x28')]()[_0xbbd7('0x29')](function(){_0x9e7b10[_0xbbd7('0x1e')](0xcc)[_0xbbd7('0x1f')]();});}};}function handleEntityNotFound(_0x462c38,_0x2ab38b){return function(_0x17d138){if(!_0x17d138){_0x462c38[_0xbbd7('0x1d')](0x194);}return _0x17d138;};}function handleError(_0xd72f8e,_0x4ce5a5){_0x4ce5a5=_0x4ce5a5||0x1f4;return function(_0x44ac25){logger[_0xbbd7('0x2a')](_0x44ac25[_0xbbd7('0x2b')]);if(_0x44ac25[_0xbbd7('0x2c')]){delete _0x44ac25['name'];}_0xd72f8e[_0xbbd7('0x1e')](_0x4ce5a5)[_0xbbd7('0x2d')](_0x44ac25);};}exports['index']=function(_0x3d8a36,_0x30c65f){var _0x3661ff={},_0x31c218={},_0x87aa10={'count':0x0,'rows':[]};var _0x856675=_[_0xbbd7('0x2e')](db['ChatGroup'][_0xbbd7('0x2f')],function(_0x539b82){return{'name':_0x539b82[_0xbbd7('0x30')],'type':_0x539b82[_0xbbd7('0x31')][_0xbbd7('0x32')]};});_0x31c218[_0xbbd7('0x33')]=_[_0xbbd7('0x2e')](_0x856675,_0xbbd7('0x2c'));_0x31c218['query']=_[_0xbbd7('0x34')](_0x3d8a36[_0xbbd7('0x35')]);_0x31c218[_0xbbd7('0x36')]=_[_0xbbd7('0x37')](_0x31c218['model'],_0x31c218[_0xbbd7('0x35')]);_0x3661ff['attributes']=_[_0xbbd7('0x37')](_0x31c218[_0xbbd7('0x33')],qs[_0xbbd7('0x38')](_0x3d8a36['query']['fields']));_0x3661ff['attributes']=_0x3661ff[_0xbbd7('0x39')][_0xbbd7('0x3a')]?_0x3661ff[_0xbbd7('0x39')]:_0x31c218[_0xbbd7('0x33')];if(!_0x3d8a36['query']['hasOwnProperty'](_0xbbd7('0x3b'))){_0x3661ff['limit']=qs[_0xbbd7('0x23')](_0x3d8a36['query'][_0xbbd7('0x23')]);_0x3661ff[_0xbbd7('0x20')]=qs['offset'](_0x3d8a36['query']['offset']);}_0x3661ff['order']=qs[_0xbbd7('0x3c')](_0x3d8a36['query'][_0xbbd7('0x3c')]);_0x3661ff[_0xbbd7('0x3d')]=qs['filters'](_[_0xbbd7('0x3e')](_0x3d8a36['query'],_0x31c218[_0xbbd7('0x36')]),_0x856675);if(_0x3d8a36[_0xbbd7('0x35')]['filter']){_0x3661ff[_0xbbd7('0x3d')]=_['merge'](_0x3661ff[_0xbbd7('0x3d')],{'$or':_[_0xbbd7('0x2e')](_0x856675,function(_0x26d0b4){if(_0x26d0b4[_0xbbd7('0x31')]!==_0xbbd7('0x3f')){var _0x95a7e0={};_0x95a7e0[_0x26d0b4[_0xbbd7('0x2c')]]={'$like':'%'+_0x3d8a36['query']['filter']+'%'};return _0x95a7e0;}})});}_0x3661ff=_['merge']({},_0x3661ff,_0x3d8a36['options']);var _0x3ee162={'where':_0x3661ff[_0xbbd7('0x3d')]};return db[_0xbbd7('0x40')][_0xbbd7('0x22')](_0x3ee162)['then'](function(_0x598c37){_0x87aa10[_0xbbd7('0x22')]=_0x598c37;if(_0x3d8a36[_0xbbd7('0x35')][_0xbbd7('0x41')]){_0x3661ff[_0xbbd7('0x42')]=[{'all':!![]}];}return db[_0xbbd7('0x40')][_0xbbd7('0x43')](_0x3661ff);})['then'](function(_0x12d313){_0x87aa10[_0xbbd7('0x44')]=_0x12d313;return _0x87aa10;})[_0xbbd7('0x29')](respondWithFilteredResult(_0x30c65f,_0x3661ff))[_0xbbd7('0x45')](handleError(_0x30c65f,null));};exports['show']=function(_0x423889,_0x319f4c){var _0x165b22={'raw':!![],'where':{'id':_0x423889[_0xbbd7('0x46')]['id']}},_0x497f7d={};_0x497f7d[_0xbbd7('0x33')]=_[_0xbbd7('0x34')](db[_0xbbd7('0x40')][_0xbbd7('0x2f')]);_0x497f7d[_0xbbd7('0x35')]=_['keys'](_0x423889['query']);_0x497f7d[_0xbbd7('0x36')]=_[_0xbbd7('0x37')](_0x497f7d[_0xbbd7('0x33')],_0x497f7d[_0xbbd7('0x35')]);_0x165b22[_0xbbd7('0x39')]=_['intersection'](_0x497f7d[_0xbbd7('0x33')],qs['fields'](_0x423889[_0xbbd7('0x35')]['fields']));_0x165b22[_0xbbd7('0x39')]=_0x165b22[_0xbbd7('0x39')][_0xbbd7('0x3a')]?_0x165b22[_0xbbd7('0x39')]:_0x497f7d[_0xbbd7('0x33')];if(_0x423889[_0xbbd7('0x35')][_0xbbd7('0x41')]){_0x165b22['include']=[{'all':!![]}];}_0x165b22=_[_0xbbd7('0x47')]({},_0x165b22,_0x423889[_0xbbd7('0x48')]);return db[_0xbbd7('0x40')][_0xbbd7('0x49')](_0x165b22)[_0xbbd7('0x29')](handleEntityNotFound(_0x319f4c,null))[_0xbbd7('0x29')](respondWithResult(_0x319f4c,null))['catch'](handleError(_0x319f4c,null));};exports[_0xbbd7('0x4a')]=function(_0x3de1a1,_0x16c9b2){return db[_0xbbd7('0x40')][_0xbbd7('0x4a')](_0x3de1a1[_0xbbd7('0x4b')],{})[_0xbbd7('0x29')](respondWithResult(_0x16c9b2,0xc9))[_0xbbd7('0x45')](handleError(_0x16c9b2,null));};exports['update']=function(_0x27d21a,_0x29f931){if(_0x27d21a[_0xbbd7('0x4b')]['id']){delete _0x27d21a[_0xbbd7('0x4b')]['id'];}return db[_0xbbd7('0x40')][_0xbbd7('0x49')]({'where':{'id':_0x27d21a['params']['id']}})[_0xbbd7('0x29')](handleEntityNotFound(_0x29f931,null))[_0xbbd7('0x29')](saveUpdates(_0x27d21a[_0xbbd7('0x4b')],null))['then'](respondWithResult(_0x29f931,null))[_0xbbd7('0x45')](handleError(_0x29f931,null));};exports[_0xbbd7('0x28')]=function(_0x3dd819,_0x544ca9){return db[_0xbbd7('0x40')]['find']({'where':{'id':_0x3dd819[_0xbbd7('0x46')]['id']}})['then'](handleEntityNotFound(_0x544ca9,null))[_0xbbd7('0x29')](removeEntity(_0x544ca9,null))[_0xbbd7('0x45')](handleError(_0x544ca9,null));};exports[_0xbbd7('0x4c')]=function(_0x5aa69b,_0x32b425){return db['ChatGroup']['describe']()['then'](respondWithResult(_0x32b425,null))[_0xbbd7('0x45')](handleError(_0x32b425,null));};exports[_0xbbd7('0x4d')]=function(_0x207fe9,_0x4d8694,_0x39c12e){return db[_0xbbd7('0x4e')][_0xbbd7('0x22')]({'where':{'ChatGroupId':_0x207fe9[_0xbbd7('0x46')]['id'],'ToId':_0x207fe9[_0xbbd7('0x4f')]['id'],'read':![]}})[_0xbbd7('0x29')](function(_0x249a65){return{'id':_[_0xbbd7('0x50')](_0x207fe9['params']['id']),'count':_0x249a65};})[_0xbbd7('0x29')](respondWithResult(_0x4d8694,null))[_0xbbd7('0x45')](handleError(_0x4d8694,null));};exports[_0xbbd7('0x51')]=function(_0x4563e8,_0x18c626,_0x3efc52){return db[_0xbbd7('0x40')][_0xbbd7('0x49')]({'where':{'id':_0x4563e8[_0xbbd7('0x46')]['id']}})[_0xbbd7('0x29')](handleEntityNotFound(_0x18c626,null))[_0xbbd7('0x29')](function(_0x310b32){if(_0x310b32){return _0x310b32[_0xbbd7('0x51')](_0x4563e8[_0xbbd7('0x4b')][_0xbbd7('0x52')],_['omit'](_0x4563e8[_0xbbd7('0x4b')],[_0xbbd7('0x52'),'id'])||{});}})[_0xbbd7('0x29')](respondWithResult(_0x18c626,null))[_0xbbd7('0x45')](handleError(_0x18c626,null));};exports['getMembers']=function(_0x584f3a,_0x1a7a0f,_0x11f80a){var _0x467942={};var _0x5934c5={};var _0x28532e;var _0x8e02e8;return db[_0xbbd7('0x40')][_0xbbd7('0x53')]({'where':{'id':_0x584f3a[_0xbbd7('0x46')]['id']}})[_0xbbd7('0x29')](handleEntityNotFound(_0x1a7a0f,null))[_0xbbd7('0x29')](function(_0x13d528){if(_0x13d528){_0x28532e=_0x13d528;_0x5934c5[_0xbbd7('0x33')]=_['keys'](db['User'][_0xbbd7('0x2f')]);_0x5934c5[_0xbbd7('0x35')]=_[_0xbbd7('0x34')](_0x584f3a[_0xbbd7('0x35')]);_0x5934c5[_0xbbd7('0x36')]=_[_0xbbd7('0x37')](_0x5934c5[_0xbbd7('0x33')],_0x5934c5[_0xbbd7('0x35')]);_0x467942[_0xbbd7('0x39')]=_['intersection'](_0x5934c5[_0xbbd7('0x33')],qs[_0xbbd7('0x38')](_0x584f3a[_0xbbd7('0x35')][_0xbbd7('0x38')]));_0x467942[_0xbbd7('0x39')]=_0x467942[_0xbbd7('0x39')][_0xbbd7('0x3a')]?_0x467942[_0xbbd7('0x39')]:_0x5934c5[_0xbbd7('0x33')];_0x467942[_0xbbd7('0x54')]=qs[_0xbbd7('0x3c')](_0x584f3a[_0xbbd7('0x35')][_0xbbd7('0x3c')]);_0x467942[_0xbbd7('0x3d')]=qs[_0xbbd7('0x36')](_['pick'](_0x584f3a[_0xbbd7('0x35')],_0x5934c5['filters']));if(_0x584f3a[_0xbbd7('0x35')][_0xbbd7('0x55')]){_0x467942[_0xbbd7('0x3d')]=_['merge'](_0x467942[_0xbbd7('0x3d')],{'$or':_[_0xbbd7('0x2e')](_0x467942[_0xbbd7('0x39')],function(_0x4bc0c2){var _0x46f455={};_0x46f455[_0x4bc0c2]={'$like':'%'+_0x584f3a[_0xbbd7('0x35')][_0xbbd7('0x55')]+'%'};return _0x46f455;})});}_0x467942=_['merge']({},_0x467942,_0x584f3a['options']);return _0x28532e['getMembers'](_0x467942);}})['then'](function(_0x2949c1){if(_0x2949c1){_0x8e02e8=_0x2949c1[_0xbbd7('0x3a')];if(!_0x584f3a[_0xbbd7('0x35')][_0xbbd7('0x56')](_0xbbd7('0x3b'))){_0x467942[_0xbbd7('0x23')]=qs['limit'](_0x584f3a[_0xbbd7('0x35')][_0xbbd7('0x23')]);_0x467942['offset']=qs[_0xbbd7('0x20')](_0x584f3a[_0xbbd7('0x35')][_0xbbd7('0x20')]);}return _0x28532e[_0xbbd7('0x57')](_0x467942);}})[_0xbbd7('0x29')](function(_0x2e39af){if(_0x2e39af){return _0x2e39af?{'count':_0x8e02e8,'rows':_0x2e39af}:null;}})[_0xbbd7('0x29')](respondWithResult(_0x1a7a0f,null))[_0xbbd7('0x45')](handleError(_0x1a7a0f,null));};exports['removeMembers']=function(_0x10e997,_0x43a43a,_0x14a013){return db['ChatGroup'][_0xbbd7('0x49')]({'where':{'id':_0x10e997[_0xbbd7('0x46')]['id']}})['then'](handleEntityNotFound(_0x43a43a,null))[_0xbbd7('0x29')](function(_0x37096d){if(_0x37096d){return _0x37096d[_0xbbd7('0x58')](_0x10e997[_0xbbd7('0x35')]['ids']);}})[_0xbbd7('0x29')](respondWithStatusCode(_0x43a43a,null))[_0xbbd7('0x45')](handleError(_0x43a43a,null));};exports[_0xbbd7('0x59')]=function(_0x39a7f9,_0x542f76,_0x57cb18){if(_0x39a7f9[_0xbbd7('0x4b')]['id']){delete _0x39a7f9['body']['id'];}return db['ChatGroup'][_0xbbd7('0x49')]({'where':{'id':_0x39a7f9[_0xbbd7('0x46')]['id']}})['then'](handleEntityNotFound(_0x542f76,null))[_0xbbd7('0x29')](function(_0x3dac18){if(_0x3dac18){_0x39a7f9[_0xbbd7('0x4b')][_0xbbd7('0x5a')]=_0x3dac18['id'];return db[_0xbbd7('0x4e')][_0xbbd7('0x4a')](_0x39a7f9['body']);}})[_0xbbd7('0x29')](respondWithResult(_0x542f76,null))[_0xbbd7('0x45')](handleError(_0x542f76,null));};exports[_0xbbd7('0x5b')]=function(_0x127e81,_0x534fc3,_0xf7f54){var _0x2eb249={};var _0x5ebaaa={};var _0x205e03;var _0x142978;return db[_0xbbd7('0x40')][_0xbbd7('0x53')]({'where':{'id':_0x127e81['params']['id']}})['then'](handleEntityNotFound(_0x534fc3,null))[_0xbbd7('0x29')](function(_0x49d427){if(_0x49d427){_0x205e03=_0x49d427;_0x5ebaaa[_0xbbd7('0x33')]=_['keys'](db[_0xbbd7('0x4e')][_0xbbd7('0x2f')]);_0x5ebaaa[_0xbbd7('0x35')]=_['keys'](_0x127e81[_0xbbd7('0x35')]);_0x5ebaaa[_0xbbd7('0x36')]=_['intersection'](_0x5ebaaa[_0xbbd7('0x33')],_0x5ebaaa['query']);_0x2eb249[_0xbbd7('0x39')]=_[_0xbbd7('0x37')](_0x5ebaaa[_0xbbd7('0x33')],qs[_0xbbd7('0x38')](_0x127e81[_0xbbd7('0x35')]['fields']));_0x2eb249[_0xbbd7('0x39')]=_0x2eb249['attributes'][_0xbbd7('0x3a')]?_0x2eb249[_0xbbd7('0x39')]:_0x5ebaaa[_0xbbd7('0x33')];_0x2eb249['order']=qs[_0xbbd7('0x3c')](_0x127e81[_0xbbd7('0x35')]['sort']);_0x2eb249[_0xbbd7('0x3d')]=qs[_0xbbd7('0x36')](_['pick'](_0x127e81[_0xbbd7('0x35')],_0x5ebaaa[_0xbbd7('0x36')]));if(_0x127e81[_0xbbd7('0x35')][_0xbbd7('0x55')]){_0x2eb249['where']=_[_0xbbd7('0x47')](_0x2eb249[_0xbbd7('0x3d')],{'$or':_['map'](_0x2eb249[_0xbbd7('0x39')],function(_0x7acdff){var _0x1ba473={};_0x1ba473[_0x7acdff]={'$like':'%'+_0x127e81[_0xbbd7('0x35')][_0xbbd7('0x55')]+'%'};return _0x1ba473;})});}if(_0x127e81[_0xbbd7('0x35')][_0xbbd7('0x5c')]){var _0x1a2809=_0x127e81[_0xbbd7('0x35')][_0xbbd7('0x5c')][_0xbbd7('0x5d')](',');var _0x48796f={};_0x48796f[_0x1a2809[0x0]]={'$gte':moment(_0x1a2809[0x1])[_0xbbd7('0x5e')]('YYYY-MM-DD\x20HH:mm:ss')};_0x2eb249[_0xbbd7('0x3d')]=_[_0xbbd7('0x47')](_0x2eb249[_0xbbd7('0x3d')],_0x48796f);}_0x2eb249=_[_0xbbd7('0x47')]({},_0x2eb249,_0x127e81[_0xbbd7('0x48')]);return _0x205e03[_0xbbd7('0x5b')](_0x2eb249);}})[_0xbbd7('0x29')](function(_0x271bf5){if(_0x271bf5){_0x142978=_0x271bf5['length'];if(!_0x127e81['query']['hasOwnProperty']('nolimit')){_0x2eb249[_0xbbd7('0x23')]=qs[_0xbbd7('0x23')](_0x127e81[_0xbbd7('0x35')]['limit']);_0x2eb249['offset']=qs[_0xbbd7('0x20')](_0x127e81[_0xbbd7('0x35')]['offset']);}return _0x205e03[_0xbbd7('0x5b')](_0x2eb249);}})[_0xbbd7('0x29')](function(_0x1b8750){if(_0x1b8750){return _0x1b8750?{'count':_0x142978,'rows':_0x1b8750}:null;}})[_0xbbd7('0x29')](respondWithResult(_0x534fc3,null))[_0xbbd7('0x45')](handleError(_0x534fc3,null));}; \ No newline at end of file +var _0x75ae=['ChatInternalMessage','user','toInteger','addMembers','omit','ids','findOne','length','order','getMembers','removeMembers','addMessage','ChatGroupId','getMessages','$gte','split','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./chatGroup.socket','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','sendStatus','name','send','index','map','ChatGroup','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','catch','create','body','find','describe'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x75ae,0x1ec));var _0xe75a=function(_0x33db2f,_0x5ed0dd){_0x33db2f=_0x33db2f-0x0;var _0x4dd48a=_0x75ae[_0x33db2f];return _0x4dd48a;};'use strict';var emlformat=require(_0xe75a('0x0'));var rimraf=require(_0xe75a('0x1'));var zipdir=require(_0xe75a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe75a('0x3'));var BPromise=require(_0xe75a('0x4'));var Mustache=require(_0xe75a('0x5'));var util=require(_0xe75a('0x6'));var path=require(_0xe75a('0x7'));var sox=require('sox');var csv=require(_0xe75a('0x8'));var ejs=require(_0xe75a('0x9'));var fs=require('fs');var fs_extra=require(_0xe75a('0xa'));var _=require(_0xe75a('0xb'));var squel=require(_0xe75a('0xc'));var crypto=require(_0xe75a('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xe75a('0xe'));var toCsv=require('to-csv');var querystring=require(_0xe75a('0xf'));var Papa=require(_0xe75a('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xe75a('0x11'));var as=require(_0xe75a('0x12'));var hardwareService=require(_0xe75a('0x13'));var logger=require(_0xe75a('0x14'))(_0xe75a('0x15'));var utils=require('../../config/utils');var config=require(_0xe75a('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe75a('0x17'))['db'];config['redis']=_[_0xe75a('0x18')](config['redis'],{'host':_0xe75a('0x19'),'port':0x18eb});var socket=require(_0xe75a('0x1a'))(new Redis(config[_0xe75a('0x1b')]));require(_0xe75a('0x1c'))['register'](socket);function respondWithStatusCode(_0x5d115d,_0x424f75){_0x424f75=_0x424f75||0xcc;return function(_0x301c93){if(_0x301c93){return _0x5d115d['sendStatus'](_0x424f75);}return _0x5d115d['status'](_0x424f75)[_0xe75a('0x1d')]();};}function respondWithResult(_0x4d9923,_0x496076){_0x496076=_0x496076||0xc8;return function(_0x141ca1){if(_0x141ca1){return _0x4d9923[_0xe75a('0x1e')](_0x496076)[_0xe75a('0x1f')](_0x141ca1);}};}function respondWithFilteredResult(_0x28a913,_0x3185c7){return function(_0x86d5f0){if(_0x86d5f0){var _0x2fa9d1=typeof _0x3185c7[_0xe75a('0x20')]===_0xe75a('0x21')&&typeof _0x3185c7[_0xe75a('0x22')]===_0xe75a('0x21');var _0x304f56=_0x86d5f0[_0xe75a('0x23')];var _0x279726=_0x2fa9d1?0x0:_0x3185c7[_0xe75a('0x20')];var _0x3ca5f1=_0x2fa9d1?_0x86d5f0[_0xe75a('0x23')]:_0x3185c7[_0xe75a('0x20')]+_0x3185c7[_0xe75a('0x22')];var _0x31721d;if(_0x3ca5f1>=_0x304f56){_0x3ca5f1=_0x304f56;_0x31721d=0xc8;}else{_0x31721d=0xce;}_0x28a913[_0xe75a('0x1e')](_0x31721d);return _0x28a913[_0xe75a('0x24')](_0xe75a('0x25'),_0x279726+'-'+_0x3ca5f1+'/'+_0x304f56)[_0xe75a('0x1f')](_0x86d5f0);}return null;};}function patchUpdates(_0x35a67a){return function(_0x427f40){try{jsonpatch[_0xe75a('0x26')](_0x427f40,_0x35a67a,!![]);}catch(_0x26f335){return BPromise[_0xe75a('0x27')](_0x26f335);}return _0x427f40[_0xe75a('0x28')]();};}function saveUpdates(_0x849c7f,_0x180a6e){return function(_0x16edba){if(_0x16edba){return _0x16edba['update'](_0x849c7f)[_0xe75a('0x29')](function(_0x58294b){return _0x58294b;});}return null;};}function removeEntity(_0x5c009d,_0x5a4809){return function(_0x58bcf0){if(_0x58bcf0){return _0x58bcf0[_0xe75a('0x2a')]()[_0xe75a('0x29')](function(){_0x5c009d[_0xe75a('0x1e')](0xcc)[_0xe75a('0x1d')]();});}};}function handleEntityNotFound(_0x222119,_0x402f35){return function(_0x578ef2){if(!_0x578ef2){_0x222119[_0xe75a('0x2b')](0x194);}return _0x578ef2;};}function handleError(_0x2ff9e9,_0x2106bf){_0x2106bf=_0x2106bf||0x1f4;return function(_0x531650){logger['error'](_0x531650['stack']);if(_0x531650['name']){delete _0x531650[_0xe75a('0x2c')];}_0x2ff9e9[_0xe75a('0x1e')](_0x2106bf)[_0xe75a('0x2d')](_0x531650);};}exports[_0xe75a('0x2e')]=function(_0x1256b0,_0x4f1519){var _0x524dad={},_0x3a6417={},_0x241be2={'count':0x0,'rows':[]};var _0x46560b=_[_0xe75a('0x2f')](db[_0xe75a('0x30')][_0xe75a('0x31')],function(_0x35cc70){return{'name':_0x35cc70['fieldName'],'type':_0x35cc70[_0xe75a('0x32')][_0xe75a('0x33')]};});_0x3a6417[_0xe75a('0x34')]=_[_0xe75a('0x2f')](_0x46560b,_0xe75a('0x2c'));_0x3a6417[_0xe75a('0x35')]=_[_0xe75a('0x36')](_0x1256b0[_0xe75a('0x35')]);_0x3a6417[_0xe75a('0x37')]=_[_0xe75a('0x38')](_0x3a6417['model'],_0x3a6417['query']);_0x524dad['attributes']=_[_0xe75a('0x38')](_0x3a6417[_0xe75a('0x34')],qs['fields'](_0x1256b0[_0xe75a('0x35')][_0xe75a('0x39')]));_0x524dad[_0xe75a('0x3a')]=_0x524dad[_0xe75a('0x3a')]['length']?_0x524dad[_0xe75a('0x3a')]:_0x3a6417[_0xe75a('0x34')];if(!_0x1256b0[_0xe75a('0x35')]['hasOwnProperty'](_0xe75a('0x3b'))){_0x524dad[_0xe75a('0x22')]=qs['limit'](_0x1256b0[_0xe75a('0x35')][_0xe75a('0x22')]);_0x524dad[_0xe75a('0x20')]=qs[_0xe75a('0x20')](_0x1256b0[_0xe75a('0x35')]['offset']);}_0x524dad['order']=qs[_0xe75a('0x3c')](_0x1256b0[_0xe75a('0x35')][_0xe75a('0x3c')]);_0x524dad[_0xe75a('0x3d')]=qs[_0xe75a('0x37')](_[_0xe75a('0x3e')](_0x1256b0[_0xe75a('0x35')],_0x3a6417[_0xe75a('0x37')]),_0x46560b);if(_0x1256b0[_0xe75a('0x35')][_0xe75a('0x3f')]){_0x524dad[_0xe75a('0x3d')]=_[_0xe75a('0x40')](_0x524dad['where'],{'$or':_['map'](_0x46560b,function(_0x4c5d84){if(_0x4c5d84['type']!==_0xe75a('0x41')){var _0x6bfb33={};_0x6bfb33[_0x4c5d84['name']]={'$like':'%'+_0x1256b0[_0xe75a('0x35')][_0xe75a('0x3f')]+'%'};return _0x6bfb33;}})});}_0x524dad=_['merge']({},_0x524dad,_0x1256b0[_0xe75a('0x42')]);var _0x5a2dc7={'where':_0x524dad[_0xe75a('0x3d')]};return db['ChatGroup'][_0xe75a('0x23')](_0x5a2dc7)['then'](function(_0x4a8d89){_0x241be2['count']=_0x4a8d89;if(_0x1256b0['query'][_0xe75a('0x43')]){_0x524dad[_0xe75a('0x44')]=[{'all':!![]}];}return db[_0xe75a('0x30')][_0xe75a('0x45')](_0x524dad);})[_0xe75a('0x29')](function(_0x388e4c){_0x241be2[_0xe75a('0x46')]=_0x388e4c;return _0x241be2;})[_0xe75a('0x29')](respondWithFilteredResult(_0x4f1519,_0x524dad))['catch'](handleError(_0x4f1519,null));};exports[_0xe75a('0x47')]=function(_0x330ed1,_0x39ef7){var _0x1a4944={'raw':!![],'where':{'id':_0x330ed1[_0xe75a('0x48')]['id']}},_0x2959f1={};_0x2959f1[_0xe75a('0x34')]=_['keys'](db[_0xe75a('0x30')][_0xe75a('0x31')]);_0x2959f1[_0xe75a('0x35')]=_[_0xe75a('0x36')](_0x330ed1[_0xe75a('0x35')]);_0x2959f1['filters']=_[_0xe75a('0x38')](_0x2959f1[_0xe75a('0x34')],_0x2959f1[_0xe75a('0x35')]);_0x1a4944[_0xe75a('0x3a')]=_[_0xe75a('0x38')](_0x2959f1[_0xe75a('0x34')],qs[_0xe75a('0x39')](_0x330ed1[_0xe75a('0x35')][_0xe75a('0x39')]));_0x1a4944['attributes']=_0x1a4944[_0xe75a('0x3a')]['length']?_0x1a4944['attributes']:_0x2959f1[_0xe75a('0x34')];if(_0x330ed1[_0xe75a('0x35')][_0xe75a('0x43')]){_0x1a4944[_0xe75a('0x44')]=[{'all':!![]}];}_0x1a4944=_['merge']({},_0x1a4944,_0x330ed1['options']);return db[_0xe75a('0x30')]['find'](_0x1a4944)[_0xe75a('0x29')](handleEntityNotFound(_0x39ef7,null))[_0xe75a('0x29')](respondWithResult(_0x39ef7,null))[_0xe75a('0x49')](handleError(_0x39ef7,null));};exports[_0xe75a('0x4a')]=function(_0x2bcef3,_0x537c1d){return db[_0xe75a('0x30')]['create'](_0x2bcef3[_0xe75a('0x4b')],{})[_0xe75a('0x29')](respondWithResult(_0x537c1d,0xc9))[_0xe75a('0x49')](handleError(_0x537c1d,null));};exports['update']=function(_0x54a782,_0x9503b7){if(_0x54a782[_0xe75a('0x4b')]['id']){delete _0x54a782[_0xe75a('0x4b')]['id'];}return db[_0xe75a('0x30')][_0xe75a('0x4c')]({'where':{'id':_0x54a782[_0xe75a('0x48')]['id']}})[_0xe75a('0x29')](handleEntityNotFound(_0x9503b7,null))[_0xe75a('0x29')](saveUpdates(_0x54a782[_0xe75a('0x4b')],null))[_0xe75a('0x29')](respondWithResult(_0x9503b7,null))[_0xe75a('0x49')](handleError(_0x9503b7,null));};exports[_0xe75a('0x2a')]=function(_0x5aee81,_0xb042e5){return db[_0xe75a('0x30')][_0xe75a('0x4c')]({'where':{'id':_0x5aee81[_0xe75a('0x48')]['id']}})[_0xe75a('0x29')](handleEntityNotFound(_0xb042e5,null))[_0xe75a('0x29')](removeEntity(_0xb042e5,null))[_0xe75a('0x49')](handleError(_0xb042e5,null));};exports[_0xe75a('0x4d')]=function(_0xef98bf,_0x452c6e){return db[_0xe75a('0x30')]['describe']()[_0xe75a('0x29')](respondWithResult(_0x452c6e,null))[_0xe75a('0x49')](handleError(_0x452c6e,null));};exports['getUnread']=function(_0x438288,_0x147822,_0x56d134){return db[_0xe75a('0x4e')][_0xe75a('0x23')]({'where':{'ChatGroupId':_0x438288['params']['id'],'ToId':_0x438288[_0xe75a('0x4f')]['id'],'read':![]}})[_0xe75a('0x29')](function(_0x16d229){return{'id':_[_0xe75a('0x50')](_0x438288[_0xe75a('0x48')]['id']),'count':_0x16d229};})[_0xe75a('0x29')](respondWithResult(_0x147822,null))[_0xe75a('0x49')](handleError(_0x147822,null));};exports[_0xe75a('0x51')]=function(_0x1dd9ed,_0x48917e,_0xb5bcc5){return db[_0xe75a('0x30')][_0xe75a('0x4c')]({'where':{'id':_0x1dd9ed[_0xe75a('0x48')]['id']}})[_0xe75a('0x29')](handleEntityNotFound(_0x48917e,null))[_0xe75a('0x29')](function(_0x310d0f){if(_0x310d0f){return _0x310d0f['addMembers'](_0x1dd9ed[_0xe75a('0x4b')]['ids'],_[_0xe75a('0x52')](_0x1dd9ed[_0xe75a('0x4b')],[_0xe75a('0x53'),'id'])||{});}})[_0xe75a('0x29')](respondWithResult(_0x48917e,null))[_0xe75a('0x49')](handleError(_0x48917e,null));};exports['getMembers']=function(_0x4803dc,_0x53cdee,_0x1b0677){var _0x21d958={};var _0x302e27={};var _0x226022;var _0x1ae4f1;return db['ChatGroup'][_0xe75a('0x54')]({'where':{'id':_0x4803dc[_0xe75a('0x48')]['id']}})[_0xe75a('0x29')](handleEntityNotFound(_0x53cdee,null))['then'](function(_0x497684){if(_0x497684){_0x226022=_0x497684;_0x302e27[_0xe75a('0x34')]=_[_0xe75a('0x36')](db['User'][_0xe75a('0x31')]);_0x302e27[_0xe75a('0x35')]=_['keys'](_0x4803dc[_0xe75a('0x35')]);_0x302e27[_0xe75a('0x37')]=_[_0xe75a('0x38')](_0x302e27[_0xe75a('0x34')],_0x302e27[_0xe75a('0x35')]);_0x21d958[_0xe75a('0x3a')]=_[_0xe75a('0x38')](_0x302e27[_0xe75a('0x34')],qs[_0xe75a('0x39')](_0x4803dc['query']['fields']));_0x21d958[_0xe75a('0x3a')]=_0x21d958['attributes'][_0xe75a('0x55')]?_0x21d958[_0xe75a('0x3a')]:_0x302e27['model'];_0x21d958[_0xe75a('0x56')]=qs[_0xe75a('0x3c')](_0x4803dc[_0xe75a('0x35')]['sort']);_0x21d958[_0xe75a('0x3d')]=qs[_0xe75a('0x37')](_[_0xe75a('0x3e')](_0x4803dc[_0xe75a('0x35')],_0x302e27[_0xe75a('0x37')]));if(_0x4803dc[_0xe75a('0x35')][_0xe75a('0x3f')]){_0x21d958[_0xe75a('0x3d')]=_[_0xe75a('0x40')](_0x21d958[_0xe75a('0x3d')],{'$or':_[_0xe75a('0x2f')](_0x21d958[_0xe75a('0x3a')],function(_0x324052){var _0x2447fe={};_0x2447fe[_0x324052]={'$like':'%'+_0x4803dc[_0xe75a('0x35')][_0xe75a('0x3f')]+'%'};return _0x2447fe;})});}_0x21d958=_[_0xe75a('0x40')]({},_0x21d958,_0x4803dc[_0xe75a('0x42')]);return _0x226022[_0xe75a('0x57')](_0x21d958);}})[_0xe75a('0x29')](function(_0x1f7b3f){if(_0x1f7b3f){_0x1ae4f1=_0x1f7b3f['length'];if(!_0x4803dc[_0xe75a('0x35')]['hasOwnProperty'](_0xe75a('0x3b'))){_0x21d958[_0xe75a('0x22')]=qs[_0xe75a('0x22')](_0x4803dc[_0xe75a('0x35')][_0xe75a('0x22')]);_0x21d958[_0xe75a('0x20')]=qs[_0xe75a('0x20')](_0x4803dc['query'][_0xe75a('0x20')]);}return _0x226022[_0xe75a('0x57')](_0x21d958);}})['then'](function(_0x657200){if(_0x657200){return _0x657200?{'count':_0x1ae4f1,'rows':_0x657200}:null;}})[_0xe75a('0x29')](respondWithResult(_0x53cdee,null))[_0xe75a('0x49')](handleError(_0x53cdee,null));};exports[_0xe75a('0x58')]=function(_0xb761be,_0x4ec5b7,_0x15628b){return db[_0xe75a('0x30')]['find']({'where':{'id':_0xb761be[_0xe75a('0x48')]['id']}})[_0xe75a('0x29')](handleEntityNotFound(_0x4ec5b7,null))[_0xe75a('0x29')](function(_0x31c83f){if(_0x31c83f){return _0x31c83f['removeMembers'](_0xb761be[_0xe75a('0x35')][_0xe75a('0x53')]);}})[_0xe75a('0x29')](respondWithStatusCode(_0x4ec5b7,null))[_0xe75a('0x49')](handleError(_0x4ec5b7,null));};exports[_0xe75a('0x59')]=function(_0x1fb283,_0x1a9b95,_0x2f59d9){if(_0x1fb283['body']['id']){delete _0x1fb283[_0xe75a('0x4b')]['id'];}return db['ChatGroup'][_0xe75a('0x4c')]({'where':{'id':_0x1fb283[_0xe75a('0x48')]['id']}})['then'](handleEntityNotFound(_0x1a9b95,null))[_0xe75a('0x29')](function(_0x52b668){if(_0x52b668){_0x1fb283[_0xe75a('0x4b')][_0xe75a('0x5a')]=_0x52b668['id'];return db[_0xe75a('0x4e')][_0xe75a('0x4a')](_0x1fb283[_0xe75a('0x4b')]);}})[_0xe75a('0x29')](respondWithResult(_0x1a9b95,null))[_0xe75a('0x49')](handleError(_0x1a9b95,null));};exports[_0xe75a('0x5b')]=function(_0xbf93d9,_0x52c66b,_0x149fdf){var _0x3de410={};var _0x1cd0b6={};var _0x32097e;var _0x1fb216;return db['ChatGroup'][_0xe75a('0x54')]({'where':{'id':_0xbf93d9[_0xe75a('0x48')]['id']}})[_0xe75a('0x29')](handleEntityNotFound(_0x52c66b,null))[_0xe75a('0x29')](function(_0x3e14be){if(_0x3e14be){_0x32097e=_0x3e14be;_0x1cd0b6[_0xe75a('0x34')]=_[_0xe75a('0x36')](db[_0xe75a('0x4e')][_0xe75a('0x31')]);_0x1cd0b6[_0xe75a('0x35')]=_['keys'](_0xbf93d9[_0xe75a('0x35')]);_0x1cd0b6[_0xe75a('0x37')]=_[_0xe75a('0x38')](_0x1cd0b6[_0xe75a('0x34')],_0x1cd0b6[_0xe75a('0x35')]);_0x3de410['attributes']=_[_0xe75a('0x38')](_0x1cd0b6[_0xe75a('0x34')],qs['fields'](_0xbf93d9[_0xe75a('0x35')][_0xe75a('0x39')]));_0x3de410['attributes']=_0x3de410['attributes'][_0xe75a('0x55')]?_0x3de410[_0xe75a('0x3a')]:_0x1cd0b6[_0xe75a('0x34')];_0x3de410[_0xe75a('0x56')]=qs['sort'](_0xbf93d9[_0xe75a('0x35')][_0xe75a('0x3c')]);_0x3de410[_0xe75a('0x3d')]=qs[_0xe75a('0x37')](_[_0xe75a('0x3e')](_0xbf93d9[_0xe75a('0x35')],_0x1cd0b6[_0xe75a('0x37')]));if(_0xbf93d9['query'][_0xe75a('0x3f')]){_0x3de410[_0xe75a('0x3d')]=_[_0xe75a('0x40')](_0x3de410[_0xe75a('0x3d')],{'$or':_[_0xe75a('0x2f')](_0x3de410[_0xe75a('0x3a')],function(_0x3ffcfa){var _0x11c767={};_0x11c767[_0x3ffcfa]={'$like':'%'+_0xbf93d9[_0xe75a('0x35')][_0xe75a('0x3f')]+'%'};return _0x11c767;})});}if(_0xbf93d9[_0xe75a('0x35')][_0xe75a('0x5c')]){var _0x4e6e98=_0xbf93d9['query'][_0xe75a('0x5c')][_0xe75a('0x5d')](',');var _0x2b2e02={};_0x2b2e02[_0x4e6e98[0x0]]={'$gte':moment(_0x4e6e98[0x1])['format'](_0xe75a('0x5e'))};_0x3de410[_0xe75a('0x3d')]=_['merge'](_0x3de410[_0xe75a('0x3d')],_0x2b2e02);}_0x3de410=_['merge']({},_0x3de410,_0xbf93d9[_0xe75a('0x42')]);return _0x32097e[_0xe75a('0x5b')](_0x3de410);}})[_0xe75a('0x29')](function(_0x77cc8e){if(_0x77cc8e){_0x1fb216=_0x77cc8e[_0xe75a('0x55')];if(!_0xbf93d9[_0xe75a('0x35')]['hasOwnProperty'](_0xe75a('0x3b'))){_0x3de410[_0xe75a('0x22')]=qs[_0xe75a('0x22')](_0xbf93d9[_0xe75a('0x35')]['limit']);_0x3de410[_0xe75a('0x20')]=qs[_0xe75a('0x20')](_0xbf93d9['query'][_0xe75a('0x20')]);}return _0x32097e[_0xe75a('0x5b')](_0x3de410);}})['then'](function(_0x1d93bd){if(_0x1d93bd){return _0x1d93bd?{'count':_0x1fb216,'rows':_0x1d93bd}:null;}})[_0xe75a('0x29')](respondWithResult(_0x52c66b,null))[_0xe75a('0x49')](handleError(_0x52c66b,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 6d75079..5672914 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 _0xa842=['ChatGroup','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x24741a,_0x36a3f9){var _0x4d57ac=function(_0x3f79e2){while(--_0x3f79e2){_0x24741a['push'](_0x24741a['shift']());}};_0x4d57ac(++_0x36a3f9);}(_0xa842,0x8e));var _0x2a84=function(_0x13fcba,_0x291489){_0x13fcba=_0x13fcba-0x0;var _0x3ef008=_0xa842[_0x13fcba];return _0x3ef008;};'use strict';var EventEmitter=require(_0x2a84('0x0'));var ChatGroup=require(_0x2a84('0x1'))['db'][_0x2a84('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x2a84('0x3'),'afterDestroy':_0x2a84('0x4')};function emitEvent(_0x4c72e8){return function(_0x321cfa,_0x504f6e,_0x5ac9a2){ChatGroupEvents[_0x2a84('0x5')](_0x4c72e8+':'+_0x321cfa['id'],_0x321cfa);ChatGroupEvents['emit'](_0x4c72e8,_0x321cfa);_0x5ac9a2(null);};}for(var e in events){if(events[_0x2a84('0x6')](e)){var event=events[e];ChatGroup[_0x2a84('0x7')](e,emitEvent(event));}}module[_0x2a84('0x8')]=ChatGroupEvents; \ No newline at end of file +var _0x069e=['../../mysqldb','setMaxListeners','save','update','remove','emit','hook','exports'];(function(_0x3c2b22,_0x322f05){var _0x312cdf=function(_0x2717b7){while(--_0x2717b7){_0x3c2b22['push'](_0x3c2b22['shift']());}};_0x312cdf(++_0x322f05);}(_0x069e,0x108));var _0xe069=function(_0x4b418f,_0x3b6a96){_0x4b418f=_0x4b418f-0x0;var _0x2ed208=_0x069e[_0x4b418f];return _0x2ed208;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0xe069('0x0'))['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xe069('0x1')](0x0);var events={'afterCreate':_0xe069('0x2'),'afterUpdate':_0xe069('0x3'),'afterDestroy':_0xe069('0x4')};function emitEvent(_0x3e83dc){return function(_0x4631eb,_0x43383f,_0x2f5a5c){ChatGroupEvents[_0xe069('0x5')](_0x3e83dc+':'+_0x4631eb['id'],_0x4631eb);ChatGroupEvents[_0xe069('0x5')](_0x3e83dc,_0x4631eb);_0x2f5a5c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup[_0xe069('0x6')](e,emitEvent(event));}}module[_0xe069('0x7')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index ff24434..4dba106 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 _0x9925=['bluebird','path','rimraf','./chatGroup.attributes','exports','define','ChatGroup','chat_groups','lodash','api','moment'];(function(_0x1b814a,_0x33bf53){var _0x4abc9c=function(_0x1eb31d){while(--_0x1eb31d){_0x1b814a['push'](_0x1b814a['shift']());}};_0x4abc9c(++_0x33bf53);}(_0x9925,0x81));var _0x5992=function(_0x5bff51,_0x33fb5a){_0x5bff51=_0x5bff51-0x0;var _0x371783=_0x9925[_0x5bff51];return _0x371783;};'use strict';var _=require(_0x5992('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5992('0x1'));var moment=require(_0x5992('0x2'));var BPromise=require(_0x5992('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5992('0x4'));var rimraf=require(_0x5992('0x5'));var config=require('../../config/environment');var attributes=require(_0x5992('0x6'));module[_0x5992('0x7')]=function(_0x586ca1,_0x408472){return _0x586ca1[_0x5992('0x8')](_0x5992('0x9'),attributes,{'tableName':_0x5992('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x764f=['api','path','../../config/environment','./chatGroup.attributes','exports','define','ChatGroup','../../config/logger'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x764f,0xe7));var _0xf764=function(_0x56d1c6,_0x273a92){_0x56d1c6=_0x56d1c6-0x0;var _0x3622f0=_0x764f[_0x56d1c6];return _0x3622f0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xf764('0x0'))(_0xf764('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf764('0x2'));var rimraf=require('rimraf');var config=require(_0xf764('0x3'));var attributes=require(_0xf764('0x4'));module[_0xf764('0x5')]=function(_0x431edf,_0x356a20){return _0x431edf[_0xf764('0x6')](_0xf764('0x7'),attributes,{'tableName':'chat_groups','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.rpc.js b/server/api/chatGroup/chatGroup.rpc.js index 1f26d24..d3e3045 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 _0x861c=['info','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','error','code','ChatGroup,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','request','then'];(function(_0x441f32,_0x455368){var _0x3150e8=function(_0x12fc2b){while(--_0x12fc2b){_0x441f32['push'](_0x441f32['shift']());}};_0x3150e8(++_0x455368);}(_0x861c,0xdb));var _0xc861=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x861c[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xc861('0x0'));var util=require(_0xc861('0x1'));var moment=require(_0xc861('0x2'));var BPromise=require(_0xc861('0x3'));var rs=require(_0xc861('0x4'));var fs=require('fs');var Redis=require(_0xc861('0x5'));var db=require(_0xc861('0x6'))['db'];var utils=require(_0xc861('0x7'));var logger=require(_0xc861('0x8'))(_0xc861('0x9'));var config=require(_0xc861('0xa'));var jayson=require(_0xc861('0xb'));var client=jayson['client'][_0xc861('0xc')]({'port':0x232a});config[_0xc861('0xd')]=_[_0xc861('0xe')](config[_0xc861('0xd')],{'host':_0xc861('0xf'),'port':0x18eb});var socket=require(_0xc861('0x10'))(new Redis(config[_0xc861('0xd')]));require(_0xc861('0x11'))[_0xc861('0x12')](socket);function respondWithRpcPromise(_0x2dae1e,_0x43a775,_0x12a16e){return new BPromise(function(_0xa3d51b,_0x57382d){return client[_0xc861('0x13')](_0x2dae1e,_0x12a16e)[_0xc861('0x14')](function(_0x2092f0){logger[_0xc861('0x15')]('ChatGroup,\x20%s,\x20%s',_0x43a775,_0xc861('0x16'));logger[_0xc861('0x17')](_0xc861('0x18'),_0x43a775,_0xc861('0x16'),JSON['stringify'](_0x2092f0));if(_0x2092f0['error']){if(_0x2092f0[_0xc861('0x19')][_0xc861('0x1a')]===0x1f4){logger['error'](_0xc861('0x1b'),_0x43a775,_0x2092f0[_0xc861('0x19')]['message']);return _0x57382d(_0x2092f0[_0xc861('0x19')][_0xc861('0x1c')]);}logger[_0xc861('0x19')](_0xc861('0x1b'),_0x43a775,_0x2092f0[_0xc861('0x19')][_0xc861('0x1c')]);return _0xa3d51b(_0x2092f0['error']['message']);}else{logger[_0xc861('0x15')]('ChatGroup,\x20%s,\x20%s',_0x43a775,_0xc861('0x16'));_0xa3d51b(_0x2092f0[_0xc861('0x1d')][_0xc861('0x1c')]);}})['catch'](function(_0x293763){logger['error'](_0xc861('0x1b'),_0x43a775,_0x293763);_0x57382d(_0x293763);});});} \ No newline at end of file +var _0x5b7f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','register','request','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x214aa8,_0x4e8a53){var _0x1deb27=function(_0x22f9b9){while(--_0x22f9b9){_0x214aa8['push'](_0x214aa8['shift']());}};_0x1deb27(++_0x4e8a53);}(_0x5b7f,0x8c));var _0xf5b7=function(_0x2f7421,_0x53ce33){_0x2f7421=_0x2f7421-0x0;var _0x58299f=_0x5b7f[_0x2f7421];return _0x58299f;};'use strict';var _=require(_0xf5b7('0x0'));var util=require(_0xf5b7('0x1'));var moment=require(_0xf5b7('0x2'));var BPromise=require(_0xf5b7('0x3'));var rs=require(_0xf5b7('0x4'));var fs=require('fs');var Redis=require(_0xf5b7('0x5'));var db=require(_0xf5b7('0x6'))['db'];var utils=require(_0xf5b7('0x7'));var logger=require(_0xf5b7('0x8'))(_0xf5b7('0x9'));var config=require(_0xf5b7('0xa'));var jayson=require(_0xf5b7('0xb'));var client=jayson[_0xf5b7('0xc')][_0xf5b7('0xd')]({'port':0x232a});config[_0xf5b7('0xe')]=_[_0xf5b7('0xf')](config[_0xf5b7('0xe')],{'host':_0xf5b7('0x10'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./chatGroup.socket')[_0xf5b7('0x11')](socket);function respondWithRpcPromise(_0x15f7f8,_0x2e3315,_0x4595c1){return new BPromise(function(_0x299eba,_0x3d2a12){return client[_0xf5b7('0x12')](_0x15f7f8,_0x4595c1)[_0xf5b7('0x13')](function(_0x43da63){logger[_0xf5b7('0x14')](_0xf5b7('0x15'),_0x2e3315,_0xf5b7('0x16'));logger['debug'](_0xf5b7('0x17'),_0x2e3315,_0xf5b7('0x16'),JSON[_0xf5b7('0x18')](_0x43da63));if(_0x43da63[_0xf5b7('0x19')]){if(_0x43da63[_0xf5b7('0x19')]['code']===0x1f4){logger[_0xf5b7('0x19')]('ChatGroup,\x20%s,\x20%s',_0x2e3315,_0x43da63['error']['message']);return _0x3d2a12(_0x43da63['error'][_0xf5b7('0x1a')]);}logger[_0xf5b7('0x19')](_0xf5b7('0x15'),_0x2e3315,_0x43da63[_0xf5b7('0x19')][_0xf5b7('0x1a')]);return _0x299eba(_0x43da63['error'][_0xf5b7('0x1a')]);}else{logger[_0xf5b7('0x14')](_0xf5b7('0x15'),_0x2e3315,_0xf5b7('0x16'));_0x299eba(_0x43da63[_0xf5b7('0x1b')][_0xf5b7('0x1a')]);}})['catch'](function(_0x2d112f){logger[_0xf5b7('0x19')](_0xf5b7('0x15'),_0x2e3315,_0x2d112f);_0x3d2a12(_0x2d112f);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 1c8992f..42870b5 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 _0xc93c=['remove','update','emit','removeListener','register','length','chatGroup:','save'];(function(_0x5f063e,_0x369330){var _0x2c9bae=function(_0x50d981){while(--_0x50d981){_0x5f063e['push'](_0x5f063e['shift']());}};_0x2c9bae(++_0x369330);}(_0xc93c,0x167));var _0xcc93=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xc93c[_0x2641f9];return _0x585741;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=[_0xcc93('0x0'),_0xcc93('0x1'),_0xcc93('0x2')];function createListener(_0x30c894,_0x2f9374){return function(_0x5b4d1e){_0x2f9374[_0xcc93('0x3')](_0x30c894,_0x5b4d1e);};}function removeListener(_0x59ef0f,_0x2287f5){return function(){ChatGroupEvents[_0xcc93('0x4')](_0x59ef0f,_0x2287f5);};}exports[_0xcc93('0x5')]=function(_0x1dff23){for(var _0x23f266=0x0,_0x2c05b5=events[_0xcc93('0x6')];_0x23f266<_0x2c05b5;_0x23f266++){var _0x4e7aa6=events[_0x23f266];var _0x58731d=createListener(_0xcc93('0x7')+_0x4e7aa6,_0x1dff23);ChatGroupEvents['on'](_0x4e7aa6,_0x58731d);}}; \ No newline at end of file +var _0x4e4e=['save','update','length','chatGroup:','./chatGroup.events'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0x4e4e,0x112));var _0xe4e4=function(_0x416a6b,_0x3cb267){_0x416a6b=_0x416a6b-0x0;var _0x16d29d=_0x4e4e[_0x416a6b];return _0x16d29d;};'use strict';var ChatGroupEvents=require(_0xe4e4('0x0'));var events=[_0xe4e4('0x1'),'remove',_0xe4e4('0x2')];function createListener(_0x517e43,_0x2ec6b3){return function(_0x6ec466){_0x2ec6b3['emit'](_0x517e43,_0x6ec466);};}function removeListener(_0x82cfd1,_0x2c7f31){return function(){ChatGroupEvents['removeListener'](_0x82cfd1,_0x2c7f31);};}exports['register']=function(_0x5719a8){for(var _0x26237f=0x0,_0x4e486f=events[_0xe4e4('0x3')];_0x26237f<_0x4e486f;_0x26237f++){var _0x12be0e=events[_0x26237f];var _0x3a54a1=createListener(_0xe4e4('0x4')+_0x12be0e,_0x5719a8);ChatGroupEvents['on'](_0x12be0e,_0x3a54a1);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index c36918b..409d77e 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 _0x243a=['getMembers','/:id/messages','getMessages','post','create','/:id/members','addMembers','addMessage','put','update','delete','removeMembers','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/unread','getUnread'];(function(_0x1420bf,_0x300e45){var _0x4e2280=function(_0x494a15){while(--_0x494a15){_0x1420bf['push'](_0x1420bf['shift']());}};_0x4e2280(++_0x300e45);}(_0x243a,0x9d));var _0xa243=function(_0x1b216c,_0x544627){_0x1b216c=_0x1b216c-0x0;var _0x3d9066=_0x243a[_0x1b216c];return _0x3d9066;};'use strict';var multer=require(_0xa243('0x0'));var util=require(_0xa243('0x1'));var path=require(_0xa243('0x2'));var timeout=require('connect-timeout');var express=require(_0xa243('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xa243('0x4'));var interaction=require(_0xa243('0x5'));var config=require(_0xa243('0x6'));var controller=require(_0xa243('0x7'));router[_0xa243('0x8')]('/',auth[_0xa243('0x9')](),controller[_0xa243('0xa')]);router[_0xa243('0x8')](_0xa243('0xb'),auth[_0xa243('0x9')](),controller[_0xa243('0xc')]);router[_0xa243('0x8')](_0xa243('0xd'),auth[_0xa243('0x9')](),controller[_0xa243('0xe')]);router[_0xa243('0x8')](_0xa243('0xf'),auth[_0xa243('0x9')](),controller[_0xa243('0x10')]);router[_0xa243('0x8')]('/:id/members',auth['isAuthenticated'](),controller[_0xa243('0x11')]);router['get'](_0xa243('0x12'),auth[_0xa243('0x9')](),controller[_0xa243('0x13')]);router[_0xa243('0x14')]('/',auth[_0xa243('0x9')](),controller[_0xa243('0x15')]);router[_0xa243('0x14')](_0xa243('0x16'),auth['isAuthenticated'](),controller[_0xa243('0x17')]);router[_0xa243('0x14')](_0xa243('0x12'),auth[_0xa243('0x9')](),controller[_0xa243('0x18')]);router[_0xa243('0x19')](_0xa243('0xd'),auth[_0xa243('0x9')](),controller[_0xa243('0x1a')]);router[_0xa243('0x1b')]('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0xa243('0x1b')](_0xa243('0x16'),auth[_0xa243('0x9')](),controller[_0xa243('0x1c')]);module['exports']=router; \ No newline at end of file +var _0xb730=['update','delete','destroy','removeMembers','exports','multer','util','path','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','isAuthenticated','index','get','show','/:id/unread','getUnread','/:id/members','getMembers','/:id/messages','getMessages','post','create','addMembers','/:id'];(function(_0x21c2c8,_0x44257e){var _0x4dd745=function(_0x1b3196){while(--_0x1b3196){_0x21c2c8['push'](_0x21c2c8['shift']());}};_0x4dd745(++_0x44257e);}(_0xb730,0x18b));var _0x0b73=function(_0x4f9f08,_0x43d059){_0x4f9f08=_0x4f9f08-0x0;var _0x52b6d6=_0xb730[_0x4f9f08];return _0x52b6d6;};'use strict';var multer=require(_0x0b73('0x0'));var util=require(_0x0b73('0x1'));var path=require(_0x0b73('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x0b73('0x3'));var interaction=require(_0x0b73('0x4'));var config=require(_0x0b73('0x5'));var controller=require(_0x0b73('0x6'));router['get']('/',auth[_0x0b73('0x7')](),controller[_0x0b73('0x8')]);router[_0x0b73('0x9')]('/describe',auth[_0x0b73('0x7')](),controller['describe']);router[_0x0b73('0x9')]('/:id',auth[_0x0b73('0x7')](),controller[_0x0b73('0xa')]);router[_0x0b73('0x9')](_0x0b73('0xb'),auth['isAuthenticated'](),controller[_0x0b73('0xc')]);router[_0x0b73('0x9')](_0x0b73('0xd'),auth[_0x0b73('0x7')](),controller[_0x0b73('0xe')]);router[_0x0b73('0x9')](_0x0b73('0xf'),auth[_0x0b73('0x7')](),controller[_0x0b73('0x10')]);router[_0x0b73('0x11')]('/',auth[_0x0b73('0x7')](),controller[_0x0b73('0x12')]);router[_0x0b73('0x11')]('/:id/members',auth[_0x0b73('0x7')](),controller[_0x0b73('0x13')]);router[_0x0b73('0x11')](_0x0b73('0xf'),auth[_0x0b73('0x7')](),controller['addMessage']);router['put'](_0x0b73('0x14'),auth[_0x0b73('0x7')](),controller[_0x0b73('0x15')]);router[_0x0b73('0x16')]('/:id',auth[_0x0b73('0x7')](),controller[_0x0b73('0x17')]);router['delete'](_0x0b73('0xd'),auth[_0x0b73('0x7')](),controller[_0x0b73('0x18')]);module[_0x0b73('0x19')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 3c4f16e..5d915a3 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 _0x8e6d=['thumb','TEXT','DATE','STRING','long','out','sequelize','exports','BOOLEAN','INTEGER','ENUM','star'];(function(_0x7a8c1d,_0x2d6999){var _0x39b3e6=function(_0x590c05){while(--_0x590c05){_0x7a8c1d['push'](_0x7a8c1d['shift']());}};_0x39b3e6(++_0x2d6999);}(_0x8e6d,0x96));var _0xd8e6=function(_0x413926,_0x3f2e4e){_0x413926=_0x413926-0x0;var _0x2f41d6=_0x8e6d[_0x413926];return _0x2f41d6;};'use strict';var Sequelize=require(_0xd8e6('0x0'));module[_0xd8e6('0x1')]={'closed':{'type':Sequelize[_0xd8e6('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xd8e6('0x3')]},'ratingType':{'type':Sequelize[_0xd8e6('0x4')](_0xd8e6('0x5'),_0xd8e6('0x6')),'defaultValue':'star'},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize[_0xd8e6('0x7')]},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xd8e6('0x8')]},'disposition':{'type':Sequelize[_0xd8e6('0x9')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xd8e6('0x9')]},'note':{'type':Sequelize[_0xd8e6('0x9')]},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize[_0xd8e6('0x9')]},'osName':{'type':Sequelize[_0xd8e6('0x9')]},'osVersion':{'type':Sequelize[_0xd8e6('0x9')]},'deviceModel':{'type':Sequelize[_0xd8e6('0x9')]},'deviceVendor':{'type':Sequelize[_0xd8e6('0x9')]},'deviceType':{'type':Sequelize[_0xd8e6('0x9')]},'referer':{'type':Sequelize[_0xd8e6('0x7')]},'customerIp':{'type':Sequelize[_0xd8e6('0x9')]},'formData':{'type':Sequelize[_0xd8e6('0x7')](_0xd8e6('0xa'))},'read1stAt':{'type':Sequelize[_0xd8e6('0x8')]},'lastMsgAt':{'type':Sequelize[_0xd8e6('0x8')]},'lastMsgDirection':{'type':Sequelize[_0xd8e6('0x4')]('in',_0xd8e6('0xb')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xd8e6('0x9')]},'customerPort':{'type':Sequelize['STRING']},'vidaooSessionId':{'type':Sequelize['TEXT']},'autoreplyExecuted':{'type':Sequelize[_0xd8e6('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xd8e6('0x3')]}}; \ No newline at end of file +var _0xe6ef=['INTEGER','ENUM','star','thumb','TEXT','DATE','STRING','long','BOOLEAN'];(function(_0x727dfa,_0x2327cf){var _0x1562ad=function(_0x47cd05){while(--_0x47cd05){_0x727dfa['push'](_0x727dfa['shift']());}};_0x1562ad(++_0x2327cf);}(_0xe6ef,0x19d));var _0xfe6e=function(_0x5c9658,_0x5acc0c){_0x5c9658=_0x5c9658-0x0;var _0x5beae4=_0xe6ef[_0x5c9658];return _0x5beae4;};'use strict';var Sequelize=require('sequelize');module['exports']={'closed':{'type':Sequelize[_0xfe6e('0x0')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xfe6e('0x1')]},'ratingType':{'type':Sequelize[_0xfe6e('0x2')](_0xfe6e('0x3'),_0xfe6e('0x4')),'defaultValue':'star'},'ratingMessage':{'type':Sequelize[_0xfe6e('0x5')]},'pathTranscript':{'type':Sequelize[_0xfe6e('0x5')]},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xfe6e('0x6')]},'disposition':{'type':Sequelize[_0xfe6e('0x7')]},'secondDisposition':{'type':Sequelize[_0xfe6e('0x7')]},'thirdDisposition':{'type':Sequelize[_0xfe6e('0x7')]},'note':{'type':Sequelize[_0xfe6e('0x7')]},'browserName':{'type':Sequelize[_0xfe6e('0x7')]},'browserVersion':{'type':Sequelize[_0xfe6e('0x7')]},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize[_0xfe6e('0x7')]},'deviceModel':{'type':Sequelize[_0xfe6e('0x7')]},'deviceVendor':{'type':Sequelize[_0xfe6e('0x7')]},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize[_0xfe6e('0x7')]},'formData':{'type':Sequelize[_0xfe6e('0x5')](_0xfe6e('0x8'))},'read1stAt':{'type':Sequelize[_0xfe6e('0x6')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xfe6e('0x2')]('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xfe6e('0x7')]},'customerPort':{'type':Sequelize['STRING']},'vidaooSessionId':{'type':Sequelize[_0xfe6e('0x5')]},'autoreplyExecuted':{'type':Sequelize[_0xfe6e('0x0')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xfe6e('0x1')]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index f424061..e62d524 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 _0x5e94=['createWriteStream','renderFile','server','views','transcript-','.pdf','err','unlinkSync','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','../../components/interaction/service','../../components/parsers/qs','api','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','client','http','request','then','ChatInteraction,\x20%s,\x20%s,\x20%s','error','code','message','ChatInteraction,\x20%s,\x20%s','info','request\x20sent','result','sendStatus','status','json','undefined','count','offset','limit','update','destroy','name','send','render','contact','agent','interaction','account','map','ChatInteraction','rawAttributes','fieldName','findAll','chat','query','show','params','keys','filters','intersection','attributes','model','fields','length','includeAll','merge','options','find','catch','create','body','describe','createVidaooSession','findOne','ChatWebsite','ChatWebsiteId','vidaooApiKey','vidaooTopic','vidaooNote','user','email','isNull','follow','vidaooMetadata','metadata','Sequelize','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','out','ChatMessage','updateAttributes','CmContact','Contact','abandon','UserId','Interaction\x20already\x20assigned','closed','AbandonInteraction','attachmentUpload','file','originalname','basename','filename','mimetype','Attachment','attachmentDownload','Unauthorized','attachId','join','root','server/files/attachments/','offline-chat/','close','mailTranscript','server/files/chat/upload/','format','now','pathTranscript','User','Messages','%s%d','System','customer','Visitor','website_alias','agentAlias','agent_alias','alias','fullname','agent_fullname','[%s]\x20%s:\x20%s\x0a','createdAt','secret','appendFileSync','MailAccount','MailServerOut','Smtp','CloudProvider','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','getMessages','hasOwnProperty','nolimit','order','sort','where','ChatInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','rows','getMyMessages','pick','include','includeAgent','push','addTags','setTags','spread','color','chatInteractionTags:save','download','unix','toString','files','tmp','attachments','firstName','lastName','direction','read','Account','get','mkdirSync','Chat','disposition','customerIp','customerPort','N.A.','createReadStream'];(function(_0x11d94f,_0xb1c1b2){var _0x27c1a0=function(_0x311ffd){while(--_0x311ffd){_0x11d94f['push'](_0x11d94f['shift']());}};_0x27c1a0(++_0xb1c1b2);}(_0x5e94,0xca));var _0x45e9=function(_0x4e7d38,_0x30a6d5){_0x4e7d38=_0x4e7d38-0x0;var _0x39b524=_0x5e94[_0x4e7d38];return _0x39b524;};'use strict';var rimraf=require(_0x45e9('0x0'));var zipdir=require(_0x45e9('0x1'));var rp=require(_0x45e9('0x2'));var moment=require(_0x45e9('0x3'));var BPromise=require(_0x45e9('0x4'));var Mustache=require(_0x45e9('0x5'));var util=require(_0x45e9('0x6'));var path=require(_0x45e9('0x7'));var ejs=require(_0x45e9('0x8'));var fs=require('fs');var _=require(_0x45e9('0x9'));var Redis=require('ioredis');var interaction=require(_0x45e9('0xa'));var qs=require(_0x45e9('0xb'));var pdf=require('../../components/export/pdf');var logger=require('../../config/logger')(_0x45e9('0xc'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x45e9('0xd')]=_['defaults'](config[_0x45e9('0xd')],{'host':_0x45e9('0xe'),'port':0x18eb});var socket=require(_0x45e9('0xf'))(new Redis(config['redis']));require(_0x45e9('0x10'))[_0x45e9('0x11')](socket);var jayson=require('jayson/promise');var client=jayson[_0x45e9('0x12')]['http']({'port':0x232b});var client9004=jayson['client'][_0x45e9('0x13')]({'port':0x232c});function respondWithRpcPromise(_0x5108b9,_0x99095,_0x4de862,_0x154a7f){return new BPromise(function(_0x498606,_0xa55eeb){var _0x49cc59=_0x154a7f||client;return _0x49cc59[_0x45e9('0x14')](_0x5108b9,_0x4de862)[_0x45e9('0x15')](function(_0x1c3331){logger['info']('ChatInteraction,\x20%s,\x20%s',_0x99095,'request\x20sent');logger['debug'](_0x45e9('0x16'),_0x99095,'request\x20sent',JSON['stringify'](_0x1c3331));if(_0x1c3331['error']){if(_0x1c3331[_0x45e9('0x17')][_0x45e9('0x18')]===0x1f4){logger[_0x45e9('0x17')]('ChatInteraction,\x20%s,\x20%s',_0x99095,_0x1c3331[_0x45e9('0x17')][_0x45e9('0x19')]);return _0xa55eeb(_0x1c3331[_0x45e9('0x17')][_0x45e9('0x19')]);}logger[_0x45e9('0x17')](_0x45e9('0x1a'),_0x99095,_0x1c3331[_0x45e9('0x17')]['message']);return _0x498606(_0x1c3331['error'][_0x45e9('0x19')]);}else{logger[_0x45e9('0x1b')]('ChatInteraction,\x20%s,\x20%s',_0x99095,_0x45e9('0x1c'));_0x498606(_0x1c3331[_0x45e9('0x1d')]['message']);}})['catch'](function(_0x331309){logger[_0x45e9('0x17')]('ChatInteraction,\x20%s,\x20%s',_0x99095,_0x331309);_0xa55eeb(_0x331309);});});}function respondWithStatusCode(_0x4102b2,_0x276b63){_0x276b63=_0x276b63||0xcc;return function(_0x119be5){if(_0x119be5){return _0x4102b2[_0x45e9('0x1e')](_0x276b63);}return _0x4102b2['status'](_0x276b63)['end']();};}function respondWithResult(_0x153b43,_0x2b471c){_0x2b471c=_0x2b471c||0xc8;return function(_0x16b83a){if(_0x16b83a){return _0x153b43[_0x45e9('0x1f')](_0x2b471c)[_0x45e9('0x20')](_0x16b83a);}};}function respondWithFilteredResult(_0x64ad13,_0x184696){return function(_0x51c482){if(_0x51c482){var _0x3981ec=typeof _0x184696['offset']===_0x45e9('0x21')&&typeof _0x184696['limit']===_0x45e9('0x21');var _0x4ac4a8=_0x51c482[_0x45e9('0x22')];var _0x31cdfd=_0x3981ec?0x0:_0x184696[_0x45e9('0x23')];var _0x2acfc8=_0x3981ec?_0x51c482[_0x45e9('0x22')]:_0x184696['offset']+_0x184696[_0x45e9('0x24')];var _0x22a96e;if(_0x2acfc8>=_0x4ac4a8){_0x2acfc8=_0x4ac4a8;_0x22a96e=0xc8;}else{_0x22a96e=0xce;}_0x64ad13[_0x45e9('0x1f')](_0x22a96e);return _0x64ad13['set']('Content-Range',_0x31cdfd+'-'+_0x2acfc8+'/'+_0x4ac4a8)[_0x45e9('0x20')](_0x51c482);}return null;};}function saveUpdates(_0x22442d){return function(_0x2c7725){if(_0x2c7725){return _0x2c7725[_0x45e9('0x25')](_0x22442d)['then'](function(_0xf5064b){return _0xf5064b;});}return null;};}function removeEntity(_0xc1b793){return function(_0x3351ec){if(_0x3351ec){return _0x3351ec[_0x45e9('0x26')]()[_0x45e9('0x15')](function(){_0xc1b793[_0x45e9('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x197ec1){return function(_0x15e5c3){if(!_0x15e5c3){_0x197ec1[_0x45e9('0x1e')](0x194);}return _0x15e5c3;};}function handleError(_0x4d4875,_0x261d70){_0x261d70=_0x261d70||0x1f4;return function(_0x4cf4ab){logger[_0x45e9('0x17')](_0x4cf4ab['stack']);if(_0x4cf4ab['name']){delete _0x4cf4ab[_0x45e9('0x27')];}_0x4d4875[_0x45e9('0x1f')](_0x261d70)[_0x45e9('0x28')](_0x4cf4ab);};}function getMustacheRender(_0xe13128,_0x519e5d){return Mustache[_0x45e9('0x29')](_0xe13128,_['merge'](_0x519e5d['body'],{'contact':_0x519e5d[_0x45e9('0x2a')],'message':_0x519e5d['message'],'agent':_0x519e5d[_0x45e9('0x2b')],'interaction':_0x519e5d[_0x45e9('0x2c')],'account':_0x519e5d[_0x45e9('0x2d')]}))||'';}exports['index']=function(_0x136531,_0x160fcd){var _0xd54b06={};var _0x567bfd=_[_0x45e9('0x2e')](db[_0x45e9('0x2f')][_0x45e9('0x30')],function(_0x2dbe5b){return{'name':_0x2dbe5b[_0x45e9('0x31')],'type':_0x2dbe5b['type']['key']};});_0xd54b06=qs['getOptions'](_0x567bfd,_0x136531);return interaction[_0x45e9('0x32')](_0x45e9('0x33'),_0x136531[_0x45e9('0x34')],_0x136531['user'],_0xd54b06,_0x567bfd)[_0x45e9('0x15')](respondWithFilteredResult(_0x160fcd,_0xd54b06))['catch'](handleError(_0x160fcd,null));};exports[_0x45e9('0x35')]=function(_0x1bfba5,_0x2d55e1){var _0x43ca1f={'raw':![],'where':{'id':_0x1bfba5[_0x45e9('0x36')]['id']}},_0x26991b={};_0x26991b['model']=_[_0x45e9('0x37')](db[_0x45e9('0x2f')]['rawAttributes']);_0x26991b[_0x45e9('0x34')]=_['keys'](_0x1bfba5['query']);_0x26991b[_0x45e9('0x38')]=_[_0x45e9('0x39')](_0x26991b['model'],_0x26991b[_0x45e9('0x34')]);_0x43ca1f[_0x45e9('0x3a')]=_[_0x45e9('0x39')](_0x26991b[_0x45e9('0x3b')],qs[_0x45e9('0x3c')](_0x1bfba5['query'][_0x45e9('0x3c')]));_0x43ca1f[_0x45e9('0x3a')]=_0x43ca1f[_0x45e9('0x3a')][_0x45e9('0x3d')]?_0x43ca1f['attributes']:_0x26991b['model'];if(_0x1bfba5['query'][_0x45e9('0x3e')]){_0x43ca1f['include']=[{'all':!![]}];}_0x43ca1f=_[_0x45e9('0x3f')]({},_0x43ca1f,_0x1bfba5[_0x45e9('0x40')]);return db[_0x45e9('0x2f')][_0x45e9('0x41')](_0x43ca1f)[_0x45e9('0x15')](handleEntityNotFound(_0x2d55e1,null))[_0x45e9('0x15')](respondWithResult(_0x2d55e1,null))[_0x45e9('0x42')](handleError(_0x2d55e1,null));};exports[_0x45e9('0x43')]=function(_0x12ff4d,_0x3ebe58){return db[_0x45e9('0x2f')]['create'](_0x12ff4d[_0x45e9('0x44')],{})[_0x45e9('0x15')](respondWithResult(_0x3ebe58,0xc9))[_0x45e9('0x42')](handleError(_0x3ebe58,null));};exports['update']=function(_0x1449c3,_0x540ba1){if(_0x1449c3[_0x45e9('0x44')]['id']){delete _0x1449c3[_0x45e9('0x44')]['id'];}return db[_0x45e9('0x2f')][_0x45e9('0x41')]({'where':{'id':_0x1449c3[_0x45e9('0x36')]['id']}})[_0x45e9('0x15')](handleEntityNotFound(_0x540ba1,null))[_0x45e9('0x15')](saveUpdates(_0x1449c3['body'],null))[_0x45e9('0x15')](respondWithResult(_0x540ba1,null))[_0x45e9('0x42')](handleError(_0x540ba1,null));};exports[_0x45e9('0x26')]=function(_0x9320dc,_0x1e7e40){return db[_0x45e9('0x2f')][_0x45e9('0x41')]({'where':{'id':_0x9320dc[_0x45e9('0x36')]['id']}})[_0x45e9('0x15')](handleEntityNotFound(_0x1e7e40,null))['then'](removeEntity(_0x1e7e40,null))[_0x45e9('0x42')](handleError(_0x1e7e40,null));};exports[_0x45e9('0x45')]=function(_0x362816,_0x475a18){return db[_0x45e9('0x2f')][_0x45e9('0x45')]()[_0x45e9('0x15')](respondWithResult(_0x475a18,null))['catch'](handleError(_0x475a18,null));};exports[_0x45e9('0x46')]=function(_0xff52a4,_0x5ca18d){var _0xa26578=_0xff52a4[_0x45e9('0x36')]['id'];var _0x46687a;var _0x409864;var _0x1db80f;return db['ChatInteraction'][_0x45e9('0x47')]({'where':{'id':_0xa26578}})[_0x45e9('0x15')](function(_0x4aeea6){_0x46687a=_0x4aeea6;return db[_0x45e9('0x48')][_0x45e9('0x47')]({'where':{'id':_0x4aeea6[_0x45e9('0x49')]},'attributes':['id',_0x45e9('0x4a'),'vidaooEscalation',_0x45e9('0x4b'),_0x45e9('0x4c'),'vidaooMetadata'],'raw':!![]});})[_0x45e9('0x15')](function(_0x18d0a7){if(_0x18d0a7&&_0x18d0a7[_0x45e9('0x4a')]&&_0x18d0a7['vidaooEscalation']){_0x409864=_0x18d0a7;var _0x5e0994={'interaction':{'id':_0xa26578},'agent':{'id':_0xff52a4[_0x45e9('0x4d')]['id'],'name':_0xff52a4[_0x45e9('0x4d')][_0x45e9('0x27')],'fullname':_0xff52a4[_0x45e9('0x4d')]['fullname'],'email':_0xff52a4[_0x45e9('0x4d')][_0x45e9('0x4e')]},'contact':_0xff52a4[_0x45e9('0x44')][_0x45e9('0x2a')],'account':_0xff52a4[_0x45e9('0x44')][_0x45e9('0x2d')]};var _0x53ffc2={'rejectUnauthorized':![],'method':'POST','url':'https://api-vidaoo.xcally.com/api/v1/meetings','headers':{'X-APIKEY':_0x18d0a7[_0x45e9('0x4a')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0xff52a4[_0x45e9('0x4d')][_0x45e9('0x4e')]],'buttons':null,'topic':_0x409864['vidaooTopic'],'note':_[_0x45e9('0x4f')](_0x409864[_0x45e9('0x4c')])?null:getMustacheRender(_0x409864[_0x45e9('0x4c')],_0x5e0994),'metadata':null},'redirect':_0x45e9('0x50'),'json':!![]};try{if(!_['isNull'](_0x409864[_0x45e9('0x51')])){var _0x1efa7d=getMustacheRender(_0x409864[_0x45e9('0x51')],_0x5e0994);var _0x2f8fda=JSON['parse'](_0x1efa7d);_0x53ffc2['body'][_0x45e9('0x52')]=_0x2f8fda;}}catch(_0x1bdb7f){throw new db[(_0x45e9('0x53'))][(_0x45e9('0x54'))](_0x45e9('0x55'));}return rp(_0x53ffc2);}else{throw new db[(_0x45e9('0x53'))]['ValidationError'](_0x45e9('0x56'));}})[_0x45e9('0x15')](function(_0x555f09){_0x1db80f=_0x555f09;if(_0x1db80f['id']){var _0x56dc52={'body':_0x1db80f['join_url'],'ChatWebsiteId':_0x409864['id'],'ChatInteractionId':_0x46687a['id'],'direction':_0x45e9('0x57'),'UserId':_0xff52a4['user']['id']};return db[_0x45e9('0x58')][_0x45e9('0x43')](_0x56dc52,{});}else{throw new db[(_0x45e9('0x53'))]['ValidationError']('Unable\x20to\x20create\x20Vidaoo\x20session');}})[_0x45e9('0x15')](function(){return _0x46687a[_0x45e9('0x59')]({'vidaooSessionId':_0x1db80f['id']});})[_0x45e9('0x15')](respondWithResult(_0x5ca18d,null))[_0x45e9('0x42')](handleError(_0x5ca18d,null));};exports['customUpdate']=function(_0x59b470,_0x1c16ff){if(_0x59b470['body']['id']){delete _0x59b470[_0x45e9('0x44')]['id'];}return db['ChatInteraction'][_0x45e9('0x41')]({'where':{'id':_0x59b470[_0x45e9('0x36')]['id']},'include':[{'model':db[_0x45e9('0x5a')],'as':_0x45e9('0x5b')}]})['then'](handleEntityNotFound(_0x1c16ff,null))[_0x45e9('0x15')](saveUpdates(_0x59b470['body'],null))[_0x45e9('0x15')](respondWithResult(_0x1c16ff,null))['catch'](handleError(_0x1c16ff,null));};exports['abandon']=function(_0x1236ed,_0x229886){if(_0x1236ed[_0x45e9('0x44')]['id']){delete _0x1236ed[_0x45e9('0x44')]['id'];}return db[_0x45e9('0x2f')][_0x45e9('0x41')]({'where':{'id':_0x1236ed[_0x45e9('0x36')]['id']}})['then'](function(_0x55e975){if(!_0x55e975){logger[_0x45e9('0x17')]('abandonInteraction,\x20%s,\x20%s,\x20%s',_0x45e9('0x5c'),0x194,'entity\x20not\x20found');_0x229886['sendStatus'](0x194);}else{if(_0x55e975[_0x45e9('0x5d')]){throw new db['Sequelize'][(_0x45e9('0x54'))](_0x45e9('0x5e'));}}return _0x55e975;})['then'](function(_0x4dfeef){if(_0x4dfeef){return _0x4dfeef[_0x45e9('0x25')]({'closed':_0x1236ed['body'][_0x45e9('0x5f')],'disposition':_0x1236ed[_0x45e9('0x44')]['disposition']})[_0x45e9('0x15')](function(_0x3fa1b6){return _0x3fa1b6;});}})[_0x45e9('0x15')](function(){return respondWithRpcPromise(_0x45e9('0x60'),_0x45e9('0x5c'),_0x1236ed['body'],client9004);})[_0x45e9('0x15')](respondWithResult(_0x229886,null))[_0x45e9('0x42')](handleError(_0x229886,null));};exports[_0x45e9('0x61')]=function(_0x3ff3a5,_0x4b6ece){_0x3ff3a5[_0x45e9('0x44')][_0x45e9('0x27')]=_0x3ff3a5[_0x45e9('0x62')][_0x45e9('0x63')];_0x3ff3a5[_0x45e9('0x44')][_0x45e9('0x64')]=_0x3ff3a5[_0x45e9('0x62')][_0x45e9('0x65')];_0x3ff3a5[_0x45e9('0x44')]['type']=_0x3ff3a5[_0x45e9('0x62')][_0x45e9('0x66')];return db[_0x45e9('0x67')][_0x45e9('0x43')](_0x3ff3a5[_0x45e9('0x44')])[_0x45e9('0x15')](respondWithResult(_0x4b6ece,0xc9))['catch'](handleError(_0x4b6ece,null));};exports[_0x45e9('0x68')]=function(_0x5efa99,_0x781a2c){return db['ChatInteraction']['findOne']({'where':{'id':_0x5efa99[_0x45e9('0x36')]['id']},'raw':!![]})[_0x45e9('0x15')](handleEntityNotFound(_0x781a2c,null))[_0x45e9('0x15')](function(_0x8dfdbb){if(_0x8dfdbb){if(_0x8dfdbb[_0x45e9('0x5f')]){return _0x781a2c[_0x45e9('0x1f')](0x193)[_0x45e9('0x20')]({'status':0x193,'message':_0x45e9('0x69')});}return db[_0x45e9('0x67')][_0x45e9('0x47')]({'where':{'id':_0x5efa99[_0x45e9('0x34')][_0x45e9('0x6a')]},'raw':!![]})[_0x45e9('0x15')](handleEntityNotFound(_0x781a2c,null));}})['then'](function(_0x4fd781){if(_0x4fd781){var _0x463392=_0x4fd781['ChatOfflineMessageId']!==null;var _0x26128e=path[_0x45e9('0x6b')](config[_0x45e9('0x6c')],_0x45e9('0x6d'));if(_0x463392){_0x26128e=path[_0x45e9('0x6b')](_0x26128e,_0x45e9('0x6e'));}var _0x17f606=path[_0x45e9('0x6b')](_0x26128e,_0x4fd781[_0x45e9('0x64')]);return _0x781a2c['download'](_0x17f606);}})['catch'](handleError(_0x781a2c,null));};exports[_0x45e9('0x6f')]=function(_0x1d96af,_0x455d3f){var _0x55b160=null;var _0x5df54b=null;var _0x301f2=null;if(_0x1d96af[_0x45e9('0x44')]['id']){delete _0x1d96af[_0x45e9('0x44')]['id'];}if(_0x1d96af[_0x45e9('0x44')][_0x45e9('0x70')]){_0x301f2=path[_0x45e9('0x6b')](config[_0x45e9('0x6c')],_0x45e9('0x71'),util[_0x45e9('0x72')]('transcript-%s.txt',Date[_0x45e9('0x73')]()));_0x1d96af[_0x45e9('0x44')][_0x45e9('0x74')]=_0x301f2;}return db['ChatInteraction'][_0x45e9('0x41')]({'where':{'id':_0x1d96af[_0x45e9('0x36')]['id']},'include':[{'model':db[_0x45e9('0x58')],'as':'Messages','include':[{'model':db[_0x45e9('0x75')],'as':_0x45e9('0x75')}]}]})[_0x45e9('0x15')](handleEntityNotFound(_0x455d3f,null))[_0x45e9('0x15')](saveUpdates(_0x1d96af[_0x45e9('0x44')],null))['then'](function(_0x12fd22){if(_0x12fd22){_0x55b160=_0x12fd22;return db[_0x45e9('0x48')]['find']({'where':{'id':_0x55b160[_0x45e9('0x49')]}});}})[_0x45e9('0x15')](function(_0x47f4ba){if(_0x47f4ba){_0x5df54b=_0x47f4ba;return db['CmContact'][_0x45e9('0x41')]({'where':{'id':_0x55b160['ContactId']}});}})[_0x45e9('0x15')](function(_0x8a1dba){if(_0x8a1dba){if(_0x301f2){var _0x2d7c30=null;for(var _0x3b6975=0x1;_0x3b6975<_0x55b160['Messages'][_0x45e9('0x3d')];++_0x3b6975){_0x2d7c30=_0x55b160[_0x45e9('0x76')][_0x3b6975];var _0x53b21b=_0x2d7c30[_0x45e9('0x5d')]?util[_0x45e9('0x72')](_0x45e9('0x77'),_0x5df54b['agentAlias'],_0x2d7c30[_0x45e9('0x5d')]):_0x45e9('0x78');var _0x5149b1=_0x1d96af[_0x45e9('0x44')][_0x45e9('0x79')]||util['format']('%s%d',_0x45e9('0x7a'),_0x2d7c30['ContactId']);switch(_0x5df54b['agentIdentifier']){case _0x45e9('0x7b'):_0x53b21b=_0x2d7c30[_0x45e9('0x5d')]?util[_0x45e9('0x72')](_0x45e9('0x77'),_0x5df54b[_0x45e9('0x7c')],_0x2d7c30[_0x45e9('0x5d')]):_0x45e9('0x78');break;case _0x45e9('0x7d'):_0x53b21b=_0x2d7c30[_0x45e9('0x5d')]?_0x2d7c30[_0x45e9('0x75')][_0x45e9('0x7e')]||_0x2d7c30[_0x45e9('0x75')][_0x45e9('0x7f')]:_0x45e9('0x78');break;case _0x45e9('0x80'):_0x53b21b=_0x2d7c30[_0x45e9('0x5d')]?_0x2d7c30[_0x45e9('0x75')]['fullname']:'System';break;default:_0x53b21b=_0x2d7c30[_0x45e9('0x5d')]?util[_0x45e9('0x72')](_0x45e9('0x77'),_0x5df54b['agentAlias'],_0x2d7c30[_0x45e9('0x5d')]):'System';}var _0x780407=util[_0x45e9('0x72')](_0x45e9('0x81'),moment(_0x2d7c30[_0x45e9('0x82')])[_0x45e9('0x72')]('MM/DD/YYYY\x20HH:mm:ss'),_0x2d7c30['direction']==='in'?_0x5149b1:_0x53b21b,_0x2d7c30[_0x45e9('0x44')]);if(!_0x2d7c30[_0x45e9('0x83')]){fs[_0x45e9('0x84')](_0x301f2,_0x780407);}}return db[_0x45e9('0x85')][_0x45e9('0x47')]({'where':{'service':!![]},'include':[{'model':db[_0x45e9('0x86')],'as':_0x45e9('0x87'),'raw':!![],'include':[{'model':db[_0x45e9('0x88')],'as':_0x45e9('0x88'),'raw':!![]}]}]});}}})['then'](function(_0x450cf7){if(!_0x450cf7||!_0x450cf7['Smtp']||!_0x1d96af['body'])return _0x55b160;var _0xfd5622=_0x450cf7[_0x45e9('0x89')]();return respondWithRpcPromise(_0x45e9('0x8a'),_0x45e9('0x8b'),{'account':_0xfd5622,'message':{'from':util[_0x45e9('0x72')](_0x45e9('0x8c'),_0x450cf7[_0x45e9('0x27')],_0x450cf7[_0x45e9('0x4e')]||_0x450cf7[_0x45e9('0x87')][_0x45e9('0x4d')]),'to':_0x1d96af[_0x45e9('0x44')][_0x45e9('0x70')],'subject':_0x45e9('0x8d'),'text':util[_0x45e9('0x72')](_0x45e9('0x8e'),_0x1d96af[_0x45e9('0x44')]['mailTranscript']),'attachments':[{'path':_0x301f2}]}})[_0x45e9('0x15')](function(){return _0x55b160;})['catch'](function(_0x383e83){logger['error'](_0x383e83);});})[_0x45e9('0x15')](respondWithStatusCode(_0x455d3f,0xc8))[_0x45e9('0x42')](handleError(_0x455d3f,null));};exports['addMessage']=function(_0x4370d6,_0x208add){return db[_0x45e9('0x58')][_0x45e9('0x41')]({'where':{'id':_0x4370d6['params']['id']}})['then'](handleEntityNotFound(_0x208add,null))[_0x45e9('0x15')](function(_0x26964f){if(_0x26964f){return _0x26964f[_0x45e9('0x8f')](_0x4370d6[_0x45e9('0x44')][_0x45e9('0x90')],_['omit'](_0x4370d6[_0x45e9('0x44')],['ids','id'])||{});}})['then'](respondWithResult(_0x208add,null))[_0x45e9('0x42')](handleError(_0x208add,null));};exports[_0x45e9('0x91')]=function(_0xf7980b,_0x8af56b){var _0x323257={'raw':![],'where':{}};var _0x1e139e={};var _0x4ddcbc={'count':0x0,'rows':[]};return db[_0x45e9('0x2f')][_0x45e9('0x47')]({'where':{'id':_0xf7980b[_0x45e9('0x36')]['id']}})[_0x45e9('0x15')](handleEntityNotFound(_0x8af56b,null))[_0x45e9('0x15')](function(_0x45fb30){if(_0x45fb30){_0x1e139e['model']=_[_0x45e9('0x37')](db[_0x45e9('0x58')][_0x45e9('0x30')]);_0x1e139e[_0x45e9('0x34')]=_[_0x45e9('0x37')](_0xf7980b['query']);_0x1e139e['filters']=_[_0x45e9('0x39')](_0x1e139e[_0x45e9('0x3b')],_0x1e139e[_0x45e9('0x34')]);_0x323257['attributes']=_['intersection'](_0x1e139e[_0x45e9('0x3b')],qs[_0x45e9('0x3c')](_0xf7980b[_0x45e9('0x34')][_0x45e9('0x3c')]));_0x323257[_0x45e9('0x3a')]=_0x323257[_0x45e9('0x3a')]['length']?_0x323257[_0x45e9('0x3a')]:_0x1e139e['model'];if(!_0xf7980b[_0x45e9('0x34')][_0x45e9('0x92')](_0x45e9('0x93'))){_0x323257[_0x45e9('0x24')]=qs[_0x45e9('0x24')](_0xf7980b[_0x45e9('0x34')][_0x45e9('0x24')]);_0x323257[_0x45e9('0x23')]=qs[_0x45e9('0x23')](_0xf7980b[_0x45e9('0x34')][_0x45e9('0x23')]);}_0x323257[_0x45e9('0x94')]=qs[_0x45e9('0x95')](_0xf7980b['query']['sort']);_0x323257[_0x45e9('0x96')]=qs[_0x45e9('0x38')](_['pick'](_0xf7980b[_0x45e9('0x34')],_0x1e139e[_0x45e9('0x38')]));_0x323257[_0x45e9('0x96')][_0x45e9('0x97')]=_0x45fb30['id'];if(_0xf7980b['query']['filter']){_0x323257['where']=_[_0x45e9('0x3f')](_0x323257['where'],{'$or':_[_0x45e9('0x2e')](_0x323257[_0x45e9('0x3a')],function(_0x5c0ebc){var _0x421f6f={};_0x421f6f[_0x5c0ebc]={'$like':'%'+_0xf7980b[_0x45e9('0x34')][_0x45e9('0x98')]+'%'};return _0x421f6f;})});}if(_0xf7980b[_0x45e9('0x34')][_0x45e9('0x99')]){var _0x5894f2=_0xf7980b[_0x45e9('0x34')]['$gte'][_0x45e9('0x9a')](',');var _0x495e22={};_0x495e22[_0x5894f2[0x0]]={'$gte':moment(_0x5894f2[0x1])[_0x45e9('0x72')](_0x45e9('0x9b'))};_0x323257[_0x45e9('0x96')]=_['merge'](_0x323257[_0x45e9('0x96')],_0x495e22);}_0x323257=_[_0x45e9('0x3f')]({},_0x323257,_0xf7980b[_0x45e9('0x40')]);return db[_0x45e9('0x58')]['count']({'where':_0x323257[_0x45e9('0x96')]})[_0x45e9('0x15')](function(_0x161dd0){_0x4ddcbc[_0x45e9('0x22')]=_0x161dd0;if(_0xf7980b[_0x45e9('0x34')][_0x45e9('0x3e')]){_0x323257['include']=[{'all':!![]}];}return db[_0x45e9('0x58')]['findAll'](_0x323257);})[_0x45e9('0x15')](function(_0x542081){_0x4ddcbc[_0x45e9('0x9c')]=_0x542081;return _0x4ddcbc;});}})['then'](respondWithFilteredResult(_0x8af56b,_0x323257))[_0x45e9('0x42')](handleError(_0x8af56b,null));};exports[_0x45e9('0x9d')]=function(_0x5a37e4,_0x331fd5){var _0x446fb4={'where':{}},_0x4653ff={},_0x51c2c4={'count':0x0,'rows':[]};return db[_0x45e9('0x2f')][_0x45e9('0x47')]({'where':{'id':_0x5a37e4['params']['id']}})[_0x45e9('0x15')](handleEntityNotFound(_0x331fd5,null))[_0x45e9('0x15')](function(_0x293e23){if(_0x293e23){_0x4653ff[_0x45e9('0x3b')]=_['keys'](db[_0x45e9('0x58')][_0x45e9('0x30')]);_0x4653ff[_0x45e9('0x34')]=_[_0x45e9('0x37')](_0x5a37e4[_0x45e9('0x34')]);_0x4653ff['filters']=_[_0x45e9('0x39')](_0x4653ff[_0x45e9('0x3b')],_0x4653ff[_0x45e9('0x34')]);_0x446fb4['attributes']=_['intersection'](_0x4653ff[_0x45e9('0x3b')],qs['fields'](_0x5a37e4['query'][_0x45e9('0x3c')]));_0x446fb4['attributes']=_0x446fb4['attributes']['length']?_0x446fb4['attributes']:_0x4653ff[_0x45e9('0x3b')];if(!_0x5a37e4[_0x45e9('0x34')][_0x45e9('0x92')](_0x45e9('0x93'))){_0x446fb4[_0x45e9('0x24')]=qs['limit'](_0x5a37e4[_0x45e9('0x34')][_0x45e9('0x24')]);_0x446fb4['offset']=qs['offset'](_0x5a37e4[_0x45e9('0x34')]['offset']);}_0x446fb4[_0x45e9('0x94')]=qs[_0x45e9('0x95')](_0x5a37e4['query']['sort']);_0x446fb4[_0x45e9('0x96')]=qs['filters'](_[_0x45e9('0x9e')](_0x5a37e4[_0x45e9('0x34')],_0x4653ff['filters']));_0x446fb4[_0x45e9('0x96')][_0x45e9('0x97')]=_0x293e23['id'];if(_0x5a37e4[_0x45e9('0x34')]['filter']){_0x446fb4['where']=_[_0x45e9('0x3f')](_0x446fb4[_0x45e9('0x96')],{'$or':_['map'](_0x446fb4[_0x45e9('0x3a')],function(_0x21a1f2){var _0x1f3ad0={};_0x1f3ad0[_0x21a1f2]={'$like':'%'+_0x5a37e4[_0x45e9('0x34')][_0x45e9('0x98')]+'%'};return _0x1f3ad0;})});}_0x446fb4[_0x45e9('0x96')][_0x45e9('0x83')]=![];if(_0x5a37e4[_0x45e9('0x34')]['id']){_0x446fb4[_0x45e9('0x96')]['id']={'$gt':_0x5a37e4[_0x45e9('0x34')]['id']};}_0x446fb4=_[_0x45e9('0x3f')]({},_0x446fb4,_0x5a37e4[_0x45e9('0x40')]);return db[_0x45e9('0x58')]['count']({'where':_0x446fb4[_0x45e9('0x96')]})[_0x45e9('0x15')](function(_0x20d21d){_0x51c2c4[_0x45e9('0x22')]=_0x20d21d;_0x446fb4[_0x45e9('0x9f')]=[];if(_0x5a37e4['query'][_0x45e9('0xa0')]){_0x446fb4[_0x45e9('0x9f')][_0x45e9('0xa1')]({'model':db[_0x45e9('0x75')],'as':'User','attributes':['id',_0x45e9('0x7f'),_0x45e9('0x7e')]});}if(_0x5a37e4['query'][_0x45e9('0x3e')]){_0x446fb4[_0x45e9('0x9f')]=[{'all':!![]}];}return db[_0x45e9('0x58')][_0x45e9('0x32')](_0x446fb4);})['then'](function(_0x1ce0bc){_0x51c2c4[_0x45e9('0x9c')]=_0x1ce0bc;return _0x51c2c4;});}})[_0x45e9('0x15')](respondWithFilteredResult(_0x331fd5,_0x446fb4))[_0x45e9('0x42')](handleError(_0x331fd5,null));};exports[_0x45e9('0xa2')]=function(_0x52c39e,_0x3cb663){return db[_0x45e9('0x2f')][_0x45e9('0x41')]({'where':{'id':_0x52c39e[_0x45e9('0x36')]['id']}})[_0x45e9('0x15')](handleEntityNotFound(_0x3cb663,null))[_0x45e9('0x15')](function(_0x1dc044){if(_0x1dc044){return _0x1dc044[_0x45e9('0xa3')](_0x52c39e[_0x45e9('0x44')][_0x45e9('0x90')],_['omit'](_0x52c39e[_0x45e9('0x44')],['ids','id'])||{})[_0x45e9('0xa4')](function(){return db['Tag'][_0x45e9('0x32')]({'attributes':['id','name',_0x45e9('0xa5')],'where':{'id':_0x52c39e[_0x45e9('0x44')][_0x45e9('0x90')]}});})[_0x45e9('0x15')](function(_0x346d15){socket['emit'](_0x45e9('0xa6'),{'id':Number(_0x52c39e[_0x45e9('0x36')]['id']),'tags':_0x346d15||[]});return{'id':Number(_0x52c39e['params']['id']),'tags':_0x346d15||[]};});}})['then'](respondWithResult(_0x3cb663,null))[_0x45e9('0x42')](handleError(_0x3cb663,null));};exports['removeTags']=function(_0x2cde71,_0x490e21){return db['ChatInteraction'][_0x45e9('0x41')]({'where':{'id':_0x2cde71[_0x45e9('0x36')]['id']}})['then'](handleEntityNotFound(_0x490e21,null))[_0x45e9('0x15')](function(_0x5c92bb){if(_0x5c92bb){return _0x5c92bb['removeTags'](_0x2cde71[_0x45e9('0x34')][_0x45e9('0x90')]);}})[_0x45e9('0x15')](respondWithStatusCode(_0x490e21,null))[_0x45e9('0x42')](handleError(_0x490e21,null));};exports[_0x45e9('0xa7')]=function(_0x44a26c,_0x283ef3){var _0x3c1fd8=moment()[_0x45e9('0xa8')]()[_0x45e9('0xa9')]();var _0x49f633=path[_0x45e9('0x6b')](config[_0x45e9('0x6c')],'server',_0x45e9('0xaa'),_0x45e9('0xab'));var _0x55425f=path[_0x45e9('0x6b')](config[_0x45e9('0x6c')],'server',_0x45e9('0xaa'),_0x45e9('0xac'));var _0x5374ef=path['join'](_0x49f633,_0x3c1fd8);var _0xf26697=util['format']('transcript-%d-%s.zip',_0x44a26c[_0x45e9('0x36')]['id'],_0x3c1fd8);var _0x4a7e7b=path[_0x45e9('0x6b')](_0x49f633,_0xf26697);var _0x80a686=[];_0x80a686[_0x45e9('0xa1')]({'model':db[_0x45e9('0x75')],'as':_0x45e9('0x75'),'attributes':['id',_0x45e9('0x7f')],'raw':!![]});_0x80a686[_0x45e9('0xa1')]({'model':db['CmContact'],'as':_0x45e9('0x5b'),'attributes':['id',_0x45e9('0xad'),_0x45e9('0xae')],'raw':!![]});if(_0x44a26c[_0x45e9('0x34')][_0x45e9('0xac')]){_0x80a686[_0x45e9('0xa1')]({'model':db[_0x45e9('0x67')],'as':_0x45e9('0x67'),'raw':!![]});}var _0x59f8ad=[{'model':db[_0x45e9('0x58')],'as':_0x45e9('0x76'),'attributes':['id',_0x45e9('0x44'),_0x45e9('0x82'),_0x45e9('0xaf'),_0x45e9('0x83'),_0x45e9('0xb0')],'include':_0x80a686}];_0x59f8ad['push']({'model':db[_0x45e9('0x48')],'as':_0x45e9('0xb1'),'attributes':['id',_0x45e9('0x27')]});_0x59f8ad[_0x45e9('0xa1')]({'model':db[_0x45e9('0x75')],'as':'Owner','attributes':['id',_0x45e9('0x7f')]});return db['ChatInteraction'][_0x45e9('0x41')]({'where':{'id':_0x44a26c[_0x45e9('0x36')]['id']},'include':_0x59f8ad})[_0x45e9('0x15')](handleEntityNotFound(_0x283ef3,null))[_0x45e9('0x15')](function(_0x25c333){if(_0x25c333){var _0x5bd83e=_0x25c333[_0x45e9('0xb2')]({'plain':!![]});fs[_0x45e9('0xb3')](_0x5374ef);var _0xc914de={'channel':_0x45e9('0xb4'),'account':_0x5bd83e[_0x45e9('0xb1')][_0x45e9('0x27')],'agent':_0x5bd83e['Owner']?_0x5bd83e['Owner'][_0x45e9('0x7f')]:'N.A.','createdAt':moment(_0x5bd83e[_0x45e9('0x82')])['format'](_0x45e9('0x9b'))[_0x45e9('0xa9')](),'closedAt':_0x5bd83e[_0x45e9('0x5f')]?moment(_0x5bd83e['closedAt'])[_0x45e9('0x72')](_0x45e9('0x9b'))[_0x45e9('0xa9')]():'','disposition':_0x5bd83e[_0x45e9('0xb5')],'chatInfo':{'browser':_0x5bd83e['browserName'],'os':_0x5bd83e['osName'],'referer':_0x5bd83e['referer'],'customerIp':_0x5bd83e[_0x45e9('0xb6')],'customerPort':_0x5bd83e['customerPort']?_0x5bd83e[_0x45e9('0xb7')]:_0x45e9('0xb8')},'messages':_(_0x5bd83e['Messages'])['tail']()[_0x45e9('0x98')]({'secret':![]})[_0x45e9('0x2e')](function(_0x2f9220){if(_0x2f9220[_0x45e9('0x67')]){var _0x12568d=path['join'](_0x55425f,_0x2f9220[_0x45e9('0x67')][_0x45e9('0x64')]);if(fs['existsSync'](_0x12568d)){fs[_0x45e9('0xb9')](_0x12568d)['pipe'](fs[_0x45e9('0xba')](path[_0x45e9('0x6b')](_0x5374ef,_0x2f9220[_0x45e9('0x67')][_0x45e9('0x64')])));}}return{'date':moment(_0x2f9220['createdAt'])[_0x45e9('0x72')](_0x45e9('0x9b'))[_0x45e9('0xa9')](),'sender':_0x2f9220[_0x45e9('0xaf')]===_0x45e9('0x57')?_0x2f9220[_0x45e9('0x75')]?_0x2f9220['User'][_0x45e9('0x7f')]:_0x45e9('0x78'):_0x2f9220[_0x45e9('0x5b')][_0x45e9('0xad')]+(_0x2f9220['Contact'][_0x45e9('0xae')]?'\x20'+_0x2f9220[_0x45e9('0x5b')][_0x45e9('0xae')]:''),'body':_0x2f9220['Attachment']?_0x2f9220[_0x45e9('0x67')][_0x45e9('0x64')]:_0x2f9220[_0x45e9('0x44')],'direction':_0x2f9220[_0x45e9('0xaf')]===_0x45e9('0x57')?'A':'C','secret':_0x2f9220[_0x45e9('0x83')],'read':_0x2f9220['read'],'attachment':_0x2f9220[_0x45e9('0x67')]};})['value']()};return ejs[_0x45e9('0xbb')](path[_0x45e9('0x6b')](config[_0x45e9('0x6c')],_0x45e9('0xbc'),_0x45e9('0xbd'),'downloadInteraction.ejs'),{'interaction':_0xc914de})[_0x45e9('0x15')](function(_0x32d2e5){var _0x50467c=path[_0x45e9('0x6b')](_0x5374ef,_0x45e9('0xbe')+_0x5bd83e['id']+'-'+_0x3c1fd8+_0x45e9('0xbf'));var _0x141e88={'path':_0x50467c,'channel':_0x45e9('0xb4'),'interactionId':_0x5bd83e['id']};return pdf['createPdfFromHTML'](_0x32d2e5,_0x141e88);})['then'](function(){return new Promise(function(_0x5edfdf,_0x37b4a5){zipdir(_0x5374ef,{'saveTo':_0x4a7e7b},function(_0x16b954,_0x568887){if(_0x16b954)return _0x37b4a5(_0x16b954);return _0x5edfdf(_0x568887);});})['then'](function(){return new BPromise(function(_0x3bf014,_0xdfe08e){rimraf(_0x5374ef,function(_0x4e531c){if(_0x4e531c)_0xdfe08e(_0x4e531c);return _0x3bf014();});});})[_0x45e9('0x15')](function(){return _0x283ef3[_0x45e9('0xa7')](_0x4a7e7b,_0xf26697,function(_0x1122cd){if(_0x1122cd){logger[_0x45e9('0x17')](_0x45e9('0xc0'),_0x1122cd);}else{fs[_0x45e9('0xc1')](_0x4a7e7b);}});});});}else{return _0x283ef3[_0x45e9('0x1e')](0xc8);}})['catch'](handleError(_0x283ef3,null));}; \ No newline at end of file +var _0x9991=['../../components/parsers/qs','../../components/export/pdf','../../config/logger','../../config/environment','redis','defaults','socket.io-emitter','./chatInteraction.socket','jayson/promise','http','request','then','ChatInteraction,\x20%s,\x20%s','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','sendStatus','status','undefined','limit','count','set','json','update','end','stack','name','merge','body','contact','agent','interaction','account','index','map','rawAttributes','fieldName','type','query','catch','show','keys','ChatInteraction','filters','intersection','attributes','fields','model','options','find','create','params','destroy','createVidaooSession','findOne','ChatWebsite','ChatWebsiteId','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','user','fullname','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','follow','isNull','metadata','Sequelize','Error\x20in\x20conversion\x20vidaooMetadata','ValidationError','Error\x20in\x20Vidaoo\x20configuration','join_url','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','customUpdate','CmContact','Contact','abandonInteraction,\x20%s,\x20%s,\x20%s','UserId','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','abandon','attachmentUpload','originalname','basename','file','mimetype','Attachment','attachmentDownload','Unauthorized','attachId','ChatOfflineMessageId','join','root','offline-chat/','download','close','transcript-%s.txt','pathTranscript','User','ContactId','Messages','length','format','%s%d','agentAlias','System','agent_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','appendFileSync','MailAccount','CloudProvider','Smtp','getSmtpOptions','SendMail','sendMail','mailTranscript','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','hasOwnProperty','offset','order','sort','where','ChatInteractionId','filter','$gte','split','includeAll','include','findAll','rows','getMyMessages','nolimit','pick','secret','includeAgent','push','addTags','setTags','spread','Tag','chatInteractionTags:save','removeTags','unix','server','files','tmp','attachments','transcript-%d-%s.zip','firstName','lastName','read','Account','Owner','Chat','N.A.','YYYY-MM-DD\x20HH:mm:ss','toString','closedAt','osName','referer','customerIp','customerPort','tail','existsSync','createReadStream','createWriteStream','out','value','renderFile','views','downloadInteraction.ejs','.pdf','createPdfFromHTML','err','unlinkSync','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','ioredis'];(function(_0x164467,_0x5df59a){var _0x56529f=function(_0x4ced8f){while(--_0x4ced8f){_0x164467['push'](_0x164467['shift']());}};_0x56529f(++_0x5df59a);}(_0x9991,0xc4));var _0x1999=function(_0x5e5a1e,_0x51ce7e){_0x5e5a1e=_0x5e5a1e-0x0;var _0x48fc13=_0x9991[_0x5e5a1e];return _0x48fc13;};'use strict';var rimraf=require(_0x1999('0x0'));var zipdir=require(_0x1999('0x1'));var rp=require(_0x1999('0x2'));var moment=require(_0x1999('0x3'));var BPromise=require(_0x1999('0x4'));var Mustache=require(_0x1999('0x5'));var util=require(_0x1999('0x6'));var path=require(_0x1999('0x7'));var ejs=require(_0x1999('0x8'));var fs=require('fs');var _=require('lodash');var Redis=require(_0x1999('0x9'));var interaction=require('../../components/interaction/service');var qs=require(_0x1999('0xa'));var pdf=require(_0x1999('0xb'));var logger=require(_0x1999('0xc'))('api');var config=require(_0x1999('0xd'));var db=require('../../mysqldb')['db'];config[_0x1999('0xe')]=_[_0x1999('0xf')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x1999('0x10'))(new Redis(config[_0x1999('0xe')]));require(_0x1999('0x11'))['register'](socket);var jayson=require(_0x1999('0x12'));var client=jayson['client'][_0x1999('0x13')]({'port':0x232b});var client9004=jayson['client'][_0x1999('0x13')]({'port':0x232c});function respondWithRpcPromise(_0x11ec6f,_0x41b578,_0x508555,_0x37fe3c){return new BPromise(function(_0x55f6f3,_0x5bc788){var _0x81afe2=_0x37fe3c||client;return _0x81afe2[_0x1999('0x14')](_0x11ec6f,_0x508555)[_0x1999('0x15')](function(_0xb4c479){logger['info'](_0x1999('0x16'),_0x41b578,_0x1999('0x17'));logger['debug'](_0x1999('0x18'),_0x41b578,'request\x20sent',JSON[_0x1999('0x19')](_0xb4c479));if(_0xb4c479['error']){if(_0xb4c479['error'][_0x1999('0x1a')]===0x1f4){logger[_0x1999('0x1b')](_0x1999('0x16'),_0x41b578,_0xb4c479[_0x1999('0x1b')]['message']);return _0x5bc788(_0xb4c479[_0x1999('0x1b')][_0x1999('0x1c')]);}logger[_0x1999('0x1b')](_0x1999('0x16'),_0x41b578,_0xb4c479[_0x1999('0x1b')][_0x1999('0x1c')]);return _0x55f6f3(_0xb4c479[_0x1999('0x1b')][_0x1999('0x1c')]);}else{logger[_0x1999('0x1d')]('ChatInteraction,\x20%s,\x20%s',_0x41b578,_0x1999('0x17'));_0x55f6f3(_0xb4c479[_0x1999('0x1e')][_0x1999('0x1c')]);}})['catch'](function(_0xbb7dc0){logger[_0x1999('0x1b')]('ChatInteraction,\x20%s,\x20%s',_0x41b578,_0xbb7dc0);_0x5bc788(_0xbb7dc0);});});}function respondWithStatusCode(_0x35773d,_0x1dc0d0){_0x1dc0d0=_0x1dc0d0||0xcc;return function(_0x273019){if(_0x273019){return _0x35773d[_0x1999('0x1f')](_0x1dc0d0);}return _0x35773d[_0x1999('0x20')](_0x1dc0d0)['end']();};}function respondWithResult(_0x4d8de5,_0x365b59){_0x365b59=_0x365b59||0xc8;return function(_0x257be5){if(_0x257be5){return _0x4d8de5[_0x1999('0x20')](_0x365b59)['json'](_0x257be5);}};}function respondWithFilteredResult(_0x33d5cf,_0x209e31){return function(_0x54db26){if(_0x54db26){var _0x4f66f6=typeof _0x209e31['offset']===_0x1999('0x21')&&typeof _0x209e31[_0x1999('0x22')]===_0x1999('0x21');var _0x43a036=_0x54db26[_0x1999('0x23')];var _0x26a9d2=_0x4f66f6?0x0:_0x209e31['offset'];var _0x5db2ce=_0x4f66f6?_0x54db26['count']:_0x209e31['offset']+_0x209e31['limit'];var _0x54eada;if(_0x5db2ce>=_0x43a036){_0x5db2ce=_0x43a036;_0x54eada=0xc8;}else{_0x54eada=0xce;}_0x33d5cf[_0x1999('0x20')](_0x54eada);return _0x33d5cf[_0x1999('0x24')]('Content-Range',_0x26a9d2+'-'+_0x5db2ce+'/'+_0x43a036)[_0x1999('0x25')](_0x54db26);}return null;};}function saveUpdates(_0x4e12ec){return function(_0x6b3c77){if(_0x6b3c77){return _0x6b3c77[_0x1999('0x26')](_0x4e12ec)[_0x1999('0x15')](function(_0x4783d9){return _0x4783d9;});}return null;};}function removeEntity(_0x514751){return function(_0x13844b){if(_0x13844b){return _0x13844b['destroy']()[_0x1999('0x15')](function(){_0x514751['status'](0xcc)[_0x1999('0x27')]();});}};}function handleEntityNotFound(_0x2ebcdf){return function(_0x1b4826){if(!_0x1b4826){_0x2ebcdf['sendStatus'](0x194);}return _0x1b4826;};}function handleError(_0x28d09f,_0xb670a6){_0xb670a6=_0xb670a6||0x1f4;return function(_0x2792f9){logger[_0x1999('0x1b')](_0x2792f9[_0x1999('0x28')]);if(_0x2792f9[_0x1999('0x29')]){delete _0x2792f9[_0x1999('0x29')];}_0x28d09f[_0x1999('0x20')](_0xb670a6)['send'](_0x2792f9);};}function getMustacheRender(_0x3ccf65,_0x4e5535){return Mustache['render'](_0x3ccf65,_[_0x1999('0x2a')](_0x4e5535[_0x1999('0x2b')],{'contact':_0x4e5535[_0x1999('0x2c')],'message':_0x4e5535['message'],'agent':_0x4e5535[_0x1999('0x2d')],'interaction':_0x4e5535[_0x1999('0x2e')],'account':_0x4e5535[_0x1999('0x2f')]}))||'';}exports[_0x1999('0x30')]=function(_0x29e56c,_0x2d8c22){var _0x40d9f6={};var _0x1c4e3b=_[_0x1999('0x31')](db['ChatInteraction'][_0x1999('0x32')],function(_0x1cb7de){return{'name':_0x1cb7de[_0x1999('0x33')],'type':_0x1cb7de[_0x1999('0x34')]['key']};});_0x40d9f6=qs['getOptions'](_0x1c4e3b,_0x29e56c);return interaction['findAll']('chat',_0x29e56c[_0x1999('0x35')],_0x29e56c['user'],_0x40d9f6,_0x1c4e3b)[_0x1999('0x15')](respondWithFilteredResult(_0x2d8c22,_0x40d9f6))[_0x1999('0x36')](handleError(_0x2d8c22,null));};exports[_0x1999('0x37')]=function(_0x54986a,_0x38cfa0){var _0x2951ba={'raw':![],'where':{'id':_0x54986a['params']['id']}},_0xe8d087={};_0xe8d087['model']=_[_0x1999('0x38')](db[_0x1999('0x39')][_0x1999('0x32')]);_0xe8d087['query']=_[_0x1999('0x38')](_0x54986a['query']);_0xe8d087[_0x1999('0x3a')]=_[_0x1999('0x3b')](_0xe8d087['model'],_0xe8d087[_0x1999('0x35')]);_0x2951ba[_0x1999('0x3c')]=_[_0x1999('0x3b')](_0xe8d087['model'],qs[_0x1999('0x3d')](_0x54986a[_0x1999('0x35')][_0x1999('0x3d')]));_0x2951ba[_0x1999('0x3c')]=_0x2951ba[_0x1999('0x3c')]['length']?_0x2951ba[_0x1999('0x3c')]:_0xe8d087[_0x1999('0x3e')];if(_0x54986a[_0x1999('0x35')]['includeAll']){_0x2951ba['include']=[{'all':!![]}];}_0x2951ba=_[_0x1999('0x2a')]({},_0x2951ba,_0x54986a[_0x1999('0x3f')]);return db[_0x1999('0x39')][_0x1999('0x40')](_0x2951ba)[_0x1999('0x15')](handleEntityNotFound(_0x38cfa0,null))[_0x1999('0x15')](respondWithResult(_0x38cfa0,null))[_0x1999('0x36')](handleError(_0x38cfa0,null));};exports[_0x1999('0x41')]=function(_0x54adc4,_0x47c575){return db[_0x1999('0x39')][_0x1999('0x41')](_0x54adc4[_0x1999('0x2b')],{})[_0x1999('0x15')](respondWithResult(_0x47c575,0xc9))[_0x1999('0x36')](handleError(_0x47c575,null));};exports[_0x1999('0x26')]=function(_0x19e41d,_0x1128e0){if(_0x19e41d[_0x1999('0x2b')]['id']){delete _0x19e41d[_0x1999('0x2b')]['id'];}return db[_0x1999('0x39')][_0x1999('0x40')]({'where':{'id':_0x19e41d[_0x1999('0x42')]['id']}})['then'](handleEntityNotFound(_0x1128e0,null))[_0x1999('0x15')](saveUpdates(_0x19e41d[_0x1999('0x2b')],null))['then'](respondWithResult(_0x1128e0,null))[_0x1999('0x36')](handleError(_0x1128e0,null));};exports[_0x1999('0x43')]=function(_0x2e7c8d,_0x111cd4){return db['ChatInteraction'][_0x1999('0x40')]({'where':{'id':_0x2e7c8d[_0x1999('0x42')]['id']}})[_0x1999('0x15')](handleEntityNotFound(_0x111cd4,null))['then'](removeEntity(_0x111cd4,null))[_0x1999('0x36')](handleError(_0x111cd4,null));};exports['describe']=function(_0x389432,_0x454d92){return db['ChatInteraction']['describe']()[_0x1999('0x15')](respondWithResult(_0x454d92,null))[_0x1999('0x36')](handleError(_0x454d92,null));};exports[_0x1999('0x44')]=function(_0x1ba7c9,_0x3d90bc){var _0x513e8b=_0x1ba7c9[_0x1999('0x42')]['id'];var _0x48ed23;var _0x512414;var _0x18ead1;return db[_0x1999('0x39')][_0x1999('0x45')]({'where':{'id':_0x513e8b}})[_0x1999('0x15')](function(_0x29da28){_0x48ed23=_0x29da28;return db[_0x1999('0x46')]['findOne']({'where':{'id':_0x29da28[_0x1999('0x47')]},'attributes':['id',_0x1999('0x48'),_0x1999('0x49'),_0x1999('0x4a'),_0x1999('0x4b'),_0x1999('0x4c')],'raw':!![]});})[_0x1999('0x15')](function(_0x4f7f71){if(_0x4f7f71&&_0x4f7f71[_0x1999('0x48')]&&_0x4f7f71[_0x1999('0x49')]){_0x512414=_0x4f7f71;var _0x3e11d2={'interaction':{'id':_0x513e8b},'agent':{'id':_0x1ba7c9[_0x1999('0x4d')]['id'],'name':_0x1ba7c9[_0x1999('0x4d')][_0x1999('0x29')],'fullname':_0x1ba7c9[_0x1999('0x4d')][_0x1999('0x4e')],'email':_0x1ba7c9[_0x1999('0x4d')][_0x1999('0x4f')]},'contact':_0x1ba7c9[_0x1999('0x2b')][_0x1999('0x2c')],'account':_0x1ba7c9['body'][_0x1999('0x2f')]};var _0x5ec35f={'rejectUnauthorized':![],'method':_0x1999('0x50'),'url':_0x1999('0x51'),'headers':{'X-APIKEY':_0x4f7f71['vidaooApiKey']},'body':{'duration':null,'scheduledAt':null,'participants':[_0x1ba7c9['user'][_0x1999('0x4f')]],'buttons':null,'topic':_0x512414['vidaooTopic'],'note':_['isNull'](_0x512414[_0x1999('0x4b')])?null:getMustacheRender(_0x512414[_0x1999('0x4b')],_0x3e11d2),'metadata':null},'redirect':_0x1999('0x52'),'json':!![]};try{if(!_[_0x1999('0x53')](_0x512414[_0x1999('0x4c')])){var _0x1cd65d=getMustacheRender(_0x512414[_0x1999('0x4c')],_0x3e11d2);var _0x44ea21=JSON['parse'](_0x1cd65d);_0x5ec35f[_0x1999('0x2b')][_0x1999('0x54')]=_0x44ea21;}}catch(_0x197145){throw new db[(_0x1999('0x55'))]['ValidationError'](_0x1999('0x56'));}return rp(_0x5ec35f);}else{throw new db[(_0x1999('0x55'))][(_0x1999('0x57'))](_0x1999('0x58'));}})[_0x1999('0x15')](function(_0x43b56a){_0x18ead1=_0x43b56a;if(_0x18ead1['id']){var _0x5f1121={'body':_0x18ead1[_0x1999('0x59')],'ChatWebsiteId':_0x512414['id'],'ChatInteractionId':_0x48ed23['id'],'direction':'out','UserId':_0x1ba7c9[_0x1999('0x4d')]['id']};return db[_0x1999('0x5a')][_0x1999('0x41')](_0x5f1121,{});}else{throw new db[(_0x1999('0x55'))][(_0x1999('0x57'))](_0x1999('0x5b'));}})[_0x1999('0x15')](function(){return _0x48ed23['updateAttributes']({'vidaooSessionId':_0x18ead1['id']});})['then'](respondWithResult(_0x3d90bc,null))[_0x1999('0x36')](handleError(_0x3d90bc,null));};exports[_0x1999('0x5c')]=function(_0x35bfec,_0x4db864){if(_0x35bfec[_0x1999('0x2b')]['id']){delete _0x35bfec['body']['id'];}return db[_0x1999('0x39')][_0x1999('0x40')]({'where':{'id':_0x35bfec[_0x1999('0x42')]['id']},'include':[{'model':db[_0x1999('0x5d')],'as':_0x1999('0x5e')}]})[_0x1999('0x15')](handleEntityNotFound(_0x4db864,null))[_0x1999('0x15')](saveUpdates(_0x35bfec['body'],null))[_0x1999('0x15')](respondWithResult(_0x4db864,null))[_0x1999('0x36')](handleError(_0x4db864,null));};exports['abandon']=function(_0x1f8ccf,_0x3a8179){if(_0x1f8ccf[_0x1999('0x2b')]['id']){delete _0x1f8ccf[_0x1999('0x2b')]['id'];}return db[_0x1999('0x39')][_0x1999('0x40')]({'where':{'id':_0x1f8ccf[_0x1999('0x42')]['id']}})[_0x1999('0x15')](function(_0x450b09){if(!_0x450b09){logger['error'](_0x1999('0x5f'),'abandon',0x194,'entity\x20not\x20found');_0x3a8179[_0x1999('0x1f')](0x194);}else{if(_0x450b09[_0x1999('0x60')]){throw new db['Sequelize']['ValidationError'](_0x1999('0x61'));}}return _0x450b09;})['then'](function(_0x5ec5b7){if(_0x5ec5b7){return _0x5ec5b7['update']({'closed':_0x1f8ccf[_0x1999('0x2b')][_0x1999('0x62')],'disposition':_0x1f8ccf[_0x1999('0x2b')][_0x1999('0x63')]})[_0x1999('0x15')](function(_0x2cbf2e){return _0x2cbf2e;});}})[_0x1999('0x15')](function(){return respondWithRpcPromise(_0x1999('0x64'),_0x1999('0x65'),_0x1f8ccf[_0x1999('0x2b')],client9004);})[_0x1999('0x15')](respondWithResult(_0x3a8179,null))[_0x1999('0x36')](handleError(_0x3a8179,null));};exports[_0x1999('0x66')]=function(_0x45306f,_0x2d8c2e){_0x45306f['body'][_0x1999('0x29')]=_0x45306f['file'][_0x1999('0x67')];_0x45306f[_0x1999('0x2b')][_0x1999('0x68')]=_0x45306f['file']['filename'];_0x45306f[_0x1999('0x2b')][_0x1999('0x34')]=_0x45306f[_0x1999('0x69')][_0x1999('0x6a')];return db[_0x1999('0x6b')]['create'](_0x45306f[_0x1999('0x2b')])[_0x1999('0x15')](respondWithResult(_0x2d8c2e,0xc9))[_0x1999('0x36')](handleError(_0x2d8c2e,null));};exports[_0x1999('0x6c')]=function(_0xb58e95,_0x4af665){return db['ChatInteraction'][_0x1999('0x45')]({'where':{'id':_0xb58e95[_0x1999('0x42')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x4af665,null))[_0x1999('0x15')](function(_0x4e7373){if(_0x4e7373){if(_0x4e7373[_0x1999('0x62')]){return _0x4af665[_0x1999('0x20')](0x193)[_0x1999('0x25')]({'status':0x193,'message':_0x1999('0x6d')});}return db[_0x1999('0x6b')][_0x1999('0x45')]({'where':{'id':_0xb58e95['query'][_0x1999('0x6e')]},'raw':!![]})[_0x1999('0x15')](handleEntityNotFound(_0x4af665,null));}})[_0x1999('0x15')](function(_0x351315){if(_0x351315){var _0x438113=_0x351315[_0x1999('0x6f')]!==null;var _0x24b424=path[_0x1999('0x70')](config[_0x1999('0x71')],'server/files/attachments/');if(_0x438113){_0x24b424=path[_0x1999('0x70')](_0x24b424,_0x1999('0x72'));}var _0x586e5a=path[_0x1999('0x70')](_0x24b424,_0x351315[_0x1999('0x68')]);return _0x4af665[_0x1999('0x73')](_0x586e5a);}})[_0x1999('0x36')](handleError(_0x4af665,null));};exports[_0x1999('0x74')]=function(_0x435d33,_0x4d424){var _0x4febc6=null;var _0x1be2eb=null;var _0x46826c=null;if(_0x435d33[_0x1999('0x2b')]['id']){delete _0x435d33[_0x1999('0x2b')]['id'];}if(_0x435d33[_0x1999('0x2b')]['mailTranscript']){_0x46826c=path['join'](config[_0x1999('0x71')],'server/files/chat/upload/',util['format'](_0x1999('0x75'),Date['now']()));_0x435d33[_0x1999('0x2b')][_0x1999('0x76')]=_0x46826c;}return db[_0x1999('0x39')]['find']({'where':{'id':_0x435d33[_0x1999('0x42')]['id']},'include':[{'model':db[_0x1999('0x5a')],'as':'Messages','include':[{'model':db[_0x1999('0x77')],'as':'User'}]}]})['then'](handleEntityNotFound(_0x4d424,null))['then'](saveUpdates(_0x435d33[_0x1999('0x2b')],null))[_0x1999('0x15')](function(_0x1bd522){if(_0x1bd522){_0x4febc6=_0x1bd522;return db[_0x1999('0x46')][_0x1999('0x40')]({'where':{'id':_0x4febc6[_0x1999('0x47')]}});}})[_0x1999('0x15')](function(_0x398c21){if(_0x398c21){_0x1be2eb=_0x398c21;return db['CmContact'][_0x1999('0x40')]({'where':{'id':_0x4febc6[_0x1999('0x78')]}});}})['then'](function(_0x4dbed5){if(_0x4dbed5){if(_0x46826c){var _0x1d7a65=null;for(var _0x30a3dd=0x1;_0x30a3dd<_0x4febc6[_0x1999('0x79')][_0x1999('0x7a')];++_0x30a3dd){_0x1d7a65=_0x4febc6[_0x1999('0x79')][_0x30a3dd];var _0x1ec186=_0x1d7a65[_0x1999('0x60')]?util[_0x1999('0x7b')](_0x1999('0x7c'),_0x1be2eb[_0x1999('0x7d')],_0x1d7a65['UserId']):_0x1999('0x7e');var _0xed2458=_0x435d33['body']['customer']||util[_0x1999('0x7b')](_0x1999('0x7c'),'Visitor',_0x1d7a65[_0x1999('0x78')]);switch(_0x1be2eb['agentIdentifier']){case'website_alias':_0x1ec186=_0x1d7a65[_0x1999('0x60')]?util['format']('%s%d',_0x1be2eb[_0x1999('0x7d')],_0x1d7a65[_0x1999('0x60')]):_0x1999('0x7e');break;case _0x1999('0x7f'):_0x1ec186=_0x1d7a65[_0x1999('0x60')]?_0x1d7a65['User'][_0x1999('0x80')]||_0x1d7a65[_0x1999('0x77')][_0x1999('0x4e')]:_0x1999('0x7e');break;case _0x1999('0x81'):_0x1ec186=_0x1d7a65[_0x1999('0x60')]?_0x1d7a65['User'][_0x1999('0x4e')]:_0x1999('0x7e');break;default:_0x1ec186=_0x1d7a65['UserId']?util[_0x1999('0x7b')](_0x1999('0x7c'),_0x1be2eb[_0x1999('0x7d')],_0x1d7a65[_0x1999('0x60')]):_0x1999('0x7e');}var _0x46677a=util[_0x1999('0x7b')](_0x1999('0x82'),moment(_0x1d7a65[_0x1999('0x83')])['format'](_0x1999('0x84')),_0x1d7a65[_0x1999('0x85')]==='in'?_0xed2458:_0x1ec186,_0x1d7a65[_0x1999('0x2b')]);if(!_0x1d7a65['secret']){fs[_0x1999('0x86')](_0x46826c,_0x46677a);}}return db[_0x1999('0x87')]['findOne']({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':'Smtp','raw':!![],'include':[{'model':db[_0x1999('0x88')],'as':'CloudProvider','raw':!![]}]}]});}}})[_0x1999('0x15')](function(_0x250cb4){if(!_0x250cb4||!_0x250cb4[_0x1999('0x89')]||!_0x435d33[_0x1999('0x2b')])return _0x4febc6;var _0x2d8848=_0x250cb4[_0x1999('0x8a')]();return respondWithRpcPromise(_0x1999('0x8b'),_0x1999('0x8c'),{'account':_0x2d8848,'message':{'from':util[_0x1999('0x7b')]('\x22%s\x22\x20<%s>',_0x250cb4['name'],_0x250cb4[_0x1999('0x4f')]||_0x250cb4[_0x1999('0x89')]['user']),'to':_0x435d33[_0x1999('0x2b')][_0x1999('0x8d')],'subject':_0x1999('0x8e'),'text':util['format'](_0x1999('0x8f'),_0x435d33[_0x1999('0x2b')][_0x1999('0x8d')]),'attachments':[{'path':_0x46826c}]}})['then'](function(){return _0x4febc6;})[_0x1999('0x36')](function(_0x1b2444){logger[_0x1999('0x1b')](_0x1b2444);});})['then'](respondWithStatusCode(_0x4d424,0xc8))['catch'](handleError(_0x4d424,null));};exports['addMessage']=function(_0x1ddf15,_0xd3f0f3){return db[_0x1999('0x5a')]['find']({'where':{'id':_0x1ddf15[_0x1999('0x42')]['id']}})['then'](handleEntityNotFound(_0xd3f0f3,null))[_0x1999('0x15')](function(_0x1b0264){if(_0x1b0264){return _0x1b0264[_0x1999('0x90')](_0x1ddf15[_0x1999('0x2b')][_0x1999('0x91')],_[_0x1999('0x92')](_0x1ddf15[_0x1999('0x2b')],[_0x1999('0x91'),'id'])||{});}})[_0x1999('0x15')](respondWithResult(_0xd3f0f3,null))[_0x1999('0x36')](handleError(_0xd3f0f3,null));};exports[_0x1999('0x93')]=function(_0x188a76,_0x52e7b1){var _0x4b42a0={'raw':![],'where':{}};var _0x151c21={};var _0x5bc1da={'count':0x0,'rows':[]};return db[_0x1999('0x39')][_0x1999('0x45')]({'where':{'id':_0x188a76['params']['id']}})[_0x1999('0x15')](handleEntityNotFound(_0x52e7b1,null))['then'](function(_0x358834){if(_0x358834){_0x151c21['model']=_[_0x1999('0x38')](db[_0x1999('0x5a')][_0x1999('0x32')]);_0x151c21[_0x1999('0x35')]=_[_0x1999('0x38')](_0x188a76['query']);_0x151c21[_0x1999('0x3a')]=_['intersection'](_0x151c21['model'],_0x151c21[_0x1999('0x35')]);_0x4b42a0[_0x1999('0x3c')]=_[_0x1999('0x3b')](_0x151c21[_0x1999('0x3e')],qs[_0x1999('0x3d')](_0x188a76['query'][_0x1999('0x3d')]));_0x4b42a0['attributes']=_0x4b42a0[_0x1999('0x3c')]['length']?_0x4b42a0[_0x1999('0x3c')]:_0x151c21[_0x1999('0x3e')];if(!_0x188a76[_0x1999('0x35')][_0x1999('0x94')]('nolimit')){_0x4b42a0['limit']=qs['limit'](_0x188a76[_0x1999('0x35')][_0x1999('0x22')]);_0x4b42a0['offset']=qs['offset'](_0x188a76[_0x1999('0x35')][_0x1999('0x95')]);}_0x4b42a0[_0x1999('0x96')]=qs[_0x1999('0x97')](_0x188a76[_0x1999('0x35')][_0x1999('0x97')]);_0x4b42a0[_0x1999('0x98')]=qs[_0x1999('0x3a')](_['pick'](_0x188a76[_0x1999('0x35')],_0x151c21['filters']));_0x4b42a0[_0x1999('0x98')][_0x1999('0x99')]=_0x358834['id'];if(_0x188a76[_0x1999('0x35')]['filter']){_0x4b42a0[_0x1999('0x98')]=_[_0x1999('0x2a')](_0x4b42a0[_0x1999('0x98')],{'$or':_['map'](_0x4b42a0[_0x1999('0x3c')],function(_0x23f1ae){var _0x2b70e8={};_0x2b70e8[_0x23f1ae]={'$like':'%'+_0x188a76['query'][_0x1999('0x9a')]+'%'};return _0x2b70e8;})});}if(_0x188a76[_0x1999('0x35')][_0x1999('0x9b')]){var _0x5c5bb1=_0x188a76[_0x1999('0x35')]['$gte'][_0x1999('0x9c')](',');var _0x33160d={};_0x33160d[_0x5c5bb1[0x0]]={'$gte':moment(_0x5c5bb1[0x1])[_0x1999('0x7b')]('YYYY-MM-DD\x20HH:mm:ss')};_0x4b42a0[_0x1999('0x98')]=_[_0x1999('0x2a')](_0x4b42a0[_0x1999('0x98')],_0x33160d);}_0x4b42a0=_[_0x1999('0x2a')]({},_0x4b42a0,_0x188a76[_0x1999('0x3f')]);return db['ChatMessage'][_0x1999('0x23')]({'where':_0x4b42a0[_0x1999('0x98')]})[_0x1999('0x15')](function(_0x1a5422){_0x5bc1da[_0x1999('0x23')]=_0x1a5422;if(_0x188a76['query'][_0x1999('0x9d')]){_0x4b42a0[_0x1999('0x9e')]=[{'all':!![]}];}return db['ChatMessage'][_0x1999('0x9f')](_0x4b42a0);})['then'](function(_0x2c6216){_0x5bc1da[_0x1999('0xa0')]=_0x2c6216;return _0x5bc1da;});}})[_0x1999('0x15')](respondWithFilteredResult(_0x52e7b1,_0x4b42a0))[_0x1999('0x36')](handleError(_0x52e7b1,null));};exports[_0x1999('0xa1')]=function(_0x14d416,_0x135904){var _0x49167d={'where':{}},_0x550c23={},_0x2dc717={'count':0x0,'rows':[]};return db[_0x1999('0x39')]['findOne']({'where':{'id':_0x14d416['params']['id']}})[_0x1999('0x15')](handleEntityNotFound(_0x135904,null))[_0x1999('0x15')](function(_0x592eaf){if(_0x592eaf){_0x550c23['model']=_['keys'](db[_0x1999('0x5a')][_0x1999('0x32')]);_0x550c23[_0x1999('0x35')]=_[_0x1999('0x38')](_0x14d416[_0x1999('0x35')]);_0x550c23['filters']=_[_0x1999('0x3b')](_0x550c23[_0x1999('0x3e')],_0x550c23[_0x1999('0x35')]);_0x49167d['attributes']=_['intersection'](_0x550c23[_0x1999('0x3e')],qs[_0x1999('0x3d')](_0x14d416['query'][_0x1999('0x3d')]));_0x49167d[_0x1999('0x3c')]=_0x49167d[_0x1999('0x3c')][_0x1999('0x7a')]?_0x49167d[_0x1999('0x3c')]:_0x550c23['model'];if(!_0x14d416[_0x1999('0x35')][_0x1999('0x94')](_0x1999('0xa2'))){_0x49167d[_0x1999('0x22')]=qs[_0x1999('0x22')](_0x14d416[_0x1999('0x35')][_0x1999('0x22')]);_0x49167d[_0x1999('0x95')]=qs[_0x1999('0x95')](_0x14d416[_0x1999('0x35')][_0x1999('0x95')]);}_0x49167d[_0x1999('0x96')]=qs[_0x1999('0x97')](_0x14d416[_0x1999('0x35')]['sort']);_0x49167d['where']=qs['filters'](_[_0x1999('0xa3')](_0x14d416[_0x1999('0x35')],_0x550c23[_0x1999('0x3a')]));_0x49167d[_0x1999('0x98')][_0x1999('0x99')]=_0x592eaf['id'];if(_0x14d416[_0x1999('0x35')][_0x1999('0x9a')]){_0x49167d[_0x1999('0x98')]=_['merge'](_0x49167d[_0x1999('0x98')],{'$or':_[_0x1999('0x31')](_0x49167d['attributes'],function(_0x1a7026){var _0x15d741={};_0x15d741[_0x1a7026]={'$like':'%'+_0x14d416['query'][_0x1999('0x9a')]+'%'};return _0x15d741;})});}_0x49167d[_0x1999('0x98')][_0x1999('0xa4')]=![];if(_0x14d416[_0x1999('0x35')]['id']){_0x49167d[_0x1999('0x98')]['id']={'$gt':_0x14d416[_0x1999('0x35')]['id']};}_0x49167d=_[_0x1999('0x2a')]({},_0x49167d,_0x14d416[_0x1999('0x3f')]);return db[_0x1999('0x5a')]['count']({'where':_0x49167d[_0x1999('0x98')]})[_0x1999('0x15')](function(_0x492094){_0x2dc717[_0x1999('0x23')]=_0x492094;_0x49167d[_0x1999('0x9e')]=[];if(_0x14d416[_0x1999('0x35')][_0x1999('0xa5')]){_0x49167d[_0x1999('0x9e')][_0x1999('0xa6')]({'model':db[_0x1999('0x77')],'as':_0x1999('0x77'),'attributes':['id',_0x1999('0x4e'),_0x1999('0x80')]});}if(_0x14d416[_0x1999('0x35')][_0x1999('0x9d')]){_0x49167d[_0x1999('0x9e')]=[{'all':!![]}];}return db[_0x1999('0x5a')][_0x1999('0x9f')](_0x49167d);})[_0x1999('0x15')](function(_0x57c61a){_0x2dc717[_0x1999('0xa0')]=_0x57c61a;return _0x2dc717;});}})[_0x1999('0x15')](respondWithFilteredResult(_0x135904,_0x49167d))[_0x1999('0x36')](handleError(_0x135904,null));};exports[_0x1999('0xa7')]=function(_0x3cce77,_0x5527c6){return db[_0x1999('0x39')]['find']({'where':{'id':_0x3cce77[_0x1999('0x42')]['id']}})[_0x1999('0x15')](handleEntityNotFound(_0x5527c6,null))[_0x1999('0x15')](function(_0x3dcf3e){if(_0x3dcf3e){return _0x3dcf3e[_0x1999('0xa8')](_0x3cce77[_0x1999('0x2b')][_0x1999('0x91')],_[_0x1999('0x92')](_0x3cce77['body'],[_0x1999('0x91'),'id'])||{})[_0x1999('0xa9')](function(){return db[_0x1999('0xaa')][_0x1999('0x9f')]({'attributes':['id',_0x1999('0x29'),'color'],'where':{'id':_0x3cce77[_0x1999('0x2b')][_0x1999('0x91')]}});})[_0x1999('0x15')](function(_0x20e9d1){socket['emit'](_0x1999('0xab'),{'id':Number(_0x3cce77[_0x1999('0x42')]['id']),'tags':_0x20e9d1||[]});return{'id':Number(_0x3cce77[_0x1999('0x42')]['id']),'tags':_0x20e9d1||[]};});}})['then'](respondWithResult(_0x5527c6,null))[_0x1999('0x36')](handleError(_0x5527c6,null));};exports[_0x1999('0xac')]=function(_0x49d376,_0x589905){return db[_0x1999('0x39')][_0x1999('0x40')]({'where':{'id':_0x49d376[_0x1999('0x42')]['id']}})[_0x1999('0x15')](handleEntityNotFound(_0x589905,null))[_0x1999('0x15')](function(_0x53f681){if(_0x53f681){return _0x53f681['removeTags'](_0x49d376[_0x1999('0x35')][_0x1999('0x91')]);}})[_0x1999('0x15')](respondWithStatusCode(_0x589905,null))[_0x1999('0x36')](handleError(_0x589905,null));};exports['download']=function(_0x491c26,_0x19ca94){var _0x289c59=moment()[_0x1999('0xad')]()['toString']();var _0x540664=path[_0x1999('0x70')](config[_0x1999('0x71')],_0x1999('0xae'),_0x1999('0xaf'),_0x1999('0xb0'));var _0x5084cf=path['join'](config['root'],_0x1999('0xae'),_0x1999('0xaf'),_0x1999('0xb1'));var _0x29579e=path[_0x1999('0x70')](_0x540664,_0x289c59);var _0x1e33c4=util[_0x1999('0x7b')](_0x1999('0xb2'),_0x491c26['params']['id'],_0x289c59);var _0x386033=path[_0x1999('0x70')](_0x540664,_0x1e33c4);var _0x566856=[];_0x566856[_0x1999('0xa6')]({'model':db[_0x1999('0x77')],'as':_0x1999('0x77'),'attributes':['id',_0x1999('0x4e')],'raw':!![]});_0x566856[_0x1999('0xa6')]({'model':db[_0x1999('0x5d')],'as':_0x1999('0x5e'),'attributes':['id',_0x1999('0xb3'),_0x1999('0xb4')],'raw':!![]});if(_0x491c26['query'][_0x1999('0xb1')]){_0x566856[_0x1999('0xa6')]({'model':db['Attachment'],'as':'Attachment','raw':!![]});}var _0x3efdcb=[{'model':db[_0x1999('0x5a')],'as':_0x1999('0x79'),'attributes':['id',_0x1999('0x2b'),_0x1999('0x83'),'direction',_0x1999('0xa4'),_0x1999('0xb5')],'include':_0x566856}];_0x3efdcb[_0x1999('0xa6')]({'model':db[_0x1999('0x46')],'as':_0x1999('0xb6'),'attributes':['id',_0x1999('0x29')]});_0x3efdcb[_0x1999('0xa6')]({'model':db[_0x1999('0x77')],'as':_0x1999('0xb7'),'attributes':['id',_0x1999('0x4e')]});return db[_0x1999('0x39')][_0x1999('0x40')]({'where':{'id':_0x491c26[_0x1999('0x42')]['id']},'include':_0x3efdcb})['then'](handleEntityNotFound(_0x19ca94,null))['then'](function(_0x238416){if(_0x238416){var _0x7b170f=_0x238416['get']({'plain':!![]});fs['mkdirSync'](_0x29579e);var _0x4fd077={'channel':_0x1999('0xb8'),'account':_0x7b170f[_0x1999('0xb6')][_0x1999('0x29')],'agent':_0x7b170f['Owner']?_0x7b170f[_0x1999('0xb7')]['fullname']:_0x1999('0xb9'),'createdAt':moment(_0x7b170f[_0x1999('0x83')])[_0x1999('0x7b')](_0x1999('0xba'))[_0x1999('0xbb')](),'closedAt':_0x7b170f['closed']?moment(_0x7b170f[_0x1999('0xbc')])[_0x1999('0x7b')]('YYYY-MM-DD\x20HH:mm:ss')[_0x1999('0xbb')]():'','disposition':_0x7b170f[_0x1999('0x63')],'chatInfo':{'browser':_0x7b170f['browserName'],'os':_0x7b170f[_0x1999('0xbd')],'referer':_0x7b170f[_0x1999('0xbe')],'customerIp':_0x7b170f[_0x1999('0xbf')],'customerPort':_0x7b170f[_0x1999('0xc0')]?_0x7b170f['customerPort']:_0x1999('0xb9')},'messages':_(_0x7b170f[_0x1999('0x79')])[_0x1999('0xc1')]()[_0x1999('0x9a')]({'secret':![]})['map'](function(_0x53e62c){if(_0x53e62c['Attachment']){var _0x4b0fa8=path[_0x1999('0x70')](_0x5084cf,_0x53e62c[_0x1999('0x6b')][_0x1999('0x68')]);if(fs[_0x1999('0xc2')](_0x4b0fa8)){fs[_0x1999('0xc3')](_0x4b0fa8)['pipe'](fs[_0x1999('0xc4')](path[_0x1999('0x70')](_0x29579e,_0x53e62c[_0x1999('0x6b')]['basename'])));}}return{'date':moment(_0x53e62c[_0x1999('0x83')])[_0x1999('0x7b')](_0x1999('0xba'))[_0x1999('0xbb')](),'sender':_0x53e62c[_0x1999('0x85')]===_0x1999('0xc5')?_0x53e62c[_0x1999('0x77')]?_0x53e62c['User'][_0x1999('0x4e')]:_0x1999('0x7e'):_0x53e62c[_0x1999('0x5e')][_0x1999('0xb3')]+(_0x53e62c[_0x1999('0x5e')][_0x1999('0xb4')]?'\x20'+_0x53e62c[_0x1999('0x5e')]['lastName']:''),'body':_0x53e62c[_0x1999('0x6b')]?_0x53e62c[_0x1999('0x6b')]['basename']:_0x53e62c[_0x1999('0x2b')],'direction':_0x53e62c['direction']===_0x1999('0xc5')?'A':'C','secret':_0x53e62c[_0x1999('0xa4')],'read':_0x53e62c[_0x1999('0xb5')],'attachment':_0x53e62c[_0x1999('0x6b')]};})[_0x1999('0xc6')]()};return ejs[_0x1999('0xc7')](path[_0x1999('0x70')](config[_0x1999('0x71')],_0x1999('0xae'),_0x1999('0xc8'),_0x1999('0xc9')),{'interaction':_0x4fd077})['then'](function(_0x28c668){var _0x20b6c4=path[_0x1999('0x70')](_0x29579e,'transcript-'+_0x7b170f['id']+'-'+_0x289c59+_0x1999('0xca'));var _0x5d1172={'path':_0x20b6c4,'channel':_0x1999('0xb8'),'interactionId':_0x7b170f['id']};return pdf[_0x1999('0xcb')](_0x28c668,_0x5d1172);})['then'](function(){return new Promise(function(_0x3ea04,_0x4d64e7){zipdir(_0x29579e,{'saveTo':_0x386033},function(_0x2e5c26,_0x5c7707){if(_0x2e5c26)return _0x4d64e7(_0x2e5c26);return _0x3ea04(_0x5c7707);});})[_0x1999('0x15')](function(){return new BPromise(function(_0x33c3b7,_0x5bb82f){rimraf(_0x29579e,function(_0x56c7fa){if(_0x56c7fa)_0x5bb82f(_0x56c7fa);return _0x33c3b7();});});})[_0x1999('0x15')](function(){return _0x19ca94[_0x1999('0x73')](_0x386033,_0x1e33c4,function(_0x2a8b53){if(_0x2a8b53){logger[_0x1999('0x1b')](_0x1999('0xcc'),_0x2a8b53);}else{fs[_0x1999('0xcd')](_0x386033);}});});});}else{return _0x19ca94[_0x1999('0x1f')](0xc8);}})[_0x1999('0x36')](handleError(_0x19ca94,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 02da51a..17b65c4 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 _0x38c2=['length','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update','getUsers','then','setDataValue','Users','unreadMessages'];(function(_0x6803ca,_0x4981ac){var _0x2810db=function(_0x8a8be4){while(--_0x8a8be4){_0x6803ca['push'](_0x6803ca['shift']());}};_0x2810db(++_0x4981ac);}(_0x38c2,0xc8));var _0x238c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x38c2[_0x321bb2];return _0x9c12ed;};'use strict';var EventEmitter=require(_0x238c('0x0'));var ChatInteraction=require(_0x238c('0x1'))['db']['ChatInteraction'];var ChatMessage=require(_0x238c('0x1'))['db']['ChatMessage'];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x238c('0x2')](0x0);var events={'afterCreate':_0x238c('0x3'),'afterUpdate':_0x238c('0x4'),'afterDestroy':'remove'};function emitEvent(_0x28fb89){return function(_0x4a9cac,_0x18aa84,_0x130e63){_0x4a9cac[_0x238c('0x5')]({'attributes':['id'],'raw':!![]})[_0x238c('0x6')](function(_0x2d05f4){_0x4a9cac[_0x238c('0x7')](_0x238c('0x8'),_0x2d05f4['map'](function(_0x55ae3a){return{'id':_0x55ae3a['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0x4a9cac['id'],'direction':'in','read':![]},'raw':!![]});})[_0x238c('0x6')](function(_0x5c6826){_0x4a9cac['setDataValue'](_0x238c('0x9'),_0x5c6826[_0x238c('0xa')]);ChatInteractionEvents[_0x238c('0xb')](_0x28fb89+':'+_0x4a9cac['id'],_0x4a9cac);ChatInteractionEvents[_0x238c('0xb')](_0x28fb89,_0x4a9cac);_0x130e63(null);})['catch'](_0x130e63(null));};}for(var e in events){if(events[_0x238c('0xc')](e)){var event=events[e];ChatInteraction[_0x238c('0xd')](e,emitEvent(event));}}module[_0x238c('0xe')]=ChatInteractionEvents; \ No newline at end of file +var _0x7ebf=['ChatMessage','setMaxListeners','save','update','remove','then','map','findAll','setDataValue','unreadMessages','length','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatInteraction'];(function(_0x40cdc3,_0x76825d){var _0x5bda2b=function(_0x1fc318){while(--_0x1fc318){_0x40cdc3['push'](_0x40cdc3['shift']());}};_0x5bda2b(++_0x76825d);}(_0x7ebf,0x141));var _0xf7eb=function(_0x3a0ebd,_0x47f368){_0x3a0ebd=_0x3a0ebd-0x0;var _0x51a660=_0x7ebf[_0x3a0ebd];return _0x51a660;};'use strict';var EventEmitter=require(_0xf7eb('0x0'));var ChatInteraction=require(_0xf7eb('0x1'))['db'][_0xf7eb('0x2')];var ChatMessage=require(_0xf7eb('0x1'))['db'][_0xf7eb('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xf7eb('0x4')](0x0);var events={'afterCreate':_0xf7eb('0x5'),'afterUpdate':_0xf7eb('0x6'),'afterDestroy':_0xf7eb('0x7')};function emitEvent(_0x2e6431){return function(_0x2200e7,_0xa6e637,_0x21b200){_0x2200e7['getUsers']({'attributes':['id'],'raw':!![]})[_0xf7eb('0x8')](function(_0x385c7d){_0x2200e7['setDataValue']('Users',_0x385c7d[_0xf7eb('0x9')](function(_0x208ee8){return{'id':_0x208ee8['id']};}));return ChatMessage[_0xf7eb('0xa')]({'where':{'ChatInteractionId':_0x2200e7['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf7eb('0x8')](function(_0x4f7fda){_0x2200e7[_0xf7eb('0xb')](_0xf7eb('0xc'),_0x4f7fda[_0xf7eb('0xd')]);ChatInteractionEvents[_0xf7eb('0xe')](_0x2e6431+':'+_0x2200e7['id'],_0x2200e7);ChatInteractionEvents['emit'](_0x2e6431,_0x2200e7);_0x21b200(null);})['catch'](_0x21b200(null));};}for(var e in events){if(events[_0xf7eb('0xf')](e)){var event=events[e];ChatInteraction[_0xf7eb('0x10')](e,emitEvent(event));}}module[_0xf7eb('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 e66bcc0..af85900 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 _0xf4c9=['api','moment','bluebird','path','rimraf','./chatInteraction.attributes','exports','define','ChatInteraction','chat_interactions','changed','closed','closedAt','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x21cb7f,_0x48cd16){var _0x5a079a=function(_0x569a4f){while(--_0x569a4f){_0x21cb7f['push'](_0x21cb7f['shift']());}};_0x5a079a(++_0x48cd16);}(_0xf4c9,0x1b8));var _0x9f4c=function(_0x344a3f,_0x579a22){_0x344a3f=_0x344a3f-0x0;var _0x264712=_0xf4c9[_0x344a3f];return _0x264712;};'use strict';var _=require(_0x9f4c('0x0'));var util=require(_0x9f4c('0x1'));var logger=require('../../config/logger')(_0x9f4c('0x2'));var moment=require(_0x9f4c('0x3'));var BPromise=require(_0x9f4c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9f4c('0x5'));var rimraf=require(_0x9f4c('0x6'));var config=require('../../config/environment');var attributes=require(_0x9f4c('0x7'));module[_0x9f4c('0x8')]=function(_0xfd8c53,_0x4074f9){return _0xfd8c53[_0x9f4c('0x9')](_0x9f4c('0xa'),attributes,{'tableName':_0x9f4c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4cdf14,_0x4de745,_0x9d8656){if(_0x4cdf14[_0x9f4c('0xc')](_0x9f4c('0xd'))){_0x4cdf14[_0x9f4c('0xe')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x9d8656(null,_0x4cdf14);}},'charset':_0x9f4c('0xf'),'collate':_0x9f4c('0x10')});}; \ No newline at end of file +var _0x9ea1=['path','rimraf','../../config/environment','./chatInteraction.attributes','exports','define','ChatInteraction','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','lodash','util','api'];(function(_0x3ee869,_0x4b1e01){var _0x4169a9=function(_0x3413b0){while(--_0x3413b0){_0x3ee869['push'](_0x3ee869['shift']());}};_0x4169a9(++_0x4b1e01);}(_0x9ea1,0xa2));var _0x19ea=function(_0x1d9a76,_0x91187d){_0x1d9a76=_0x1d9a76-0x0;var _0x20dbbd=_0x9ea1[_0x1d9a76];return _0x20dbbd;};'use strict';var _=require(_0x19ea('0x0'));var util=require(_0x19ea('0x1'));var logger=require('../../config/logger')(_0x19ea('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x19ea('0x3'));var rimraf=require(_0x19ea('0x4'));var config=require(_0x19ea('0x5'));var attributes=require(_0x19ea('0x6'));module[_0x19ea('0x7')]=function(_0x1476cc,_0x1d1e29){return _0x1476cc[_0x19ea('0x8')](_0x19ea('0x9'),attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x440f46,_0x19d060,_0x398b34){if(_0x440f46[_0x19ea('0xa')](_0x19ea('0xb'))){_0x440f46[_0x19ea('0xc')]=moment()['format'](_0x19ea('0xd'));}_0x398b34(null,_0x440f46);}},'charset':_0x19ea('0xe'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 2b39b02..1f0826e 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 _0xf9c4=['jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UpdateChatInteraction','ChatInteraction','update','body','options','raw','where','attributes','limit','AddTagsToChatInteraction','find','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x1c546c,_0x5c57cb){var _0x2cc384=function(_0x4dee11){while(--_0x4dee11){_0x1c546c['push'](_0x1c546c['shift']());}};_0x2cc384(++_0x5c57cb);}(_0xf9c4,0xab));var _0x4f9c=function(_0x3d4882,_0x230d03){_0x3d4882=_0x3d4882-0x0;var _0x2fe197=_0xf9c4[_0x3d4882];return _0x2fe197;};'use strict';var _=require(_0x4f9c('0x0'));var util=require(_0x4f9c('0x1'));var moment=require(_0x4f9c('0x2'));var BPromise=require(_0x4f9c('0x3'));var rs=require(_0x4f9c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4f9c('0x5'))['db'];var utils=require(_0x4f9c('0x6'));var logger=require(_0x4f9c('0x7'))('rpc');var config=require(_0x4f9c('0x8'));var jayson=require(_0x4f9c('0x9'));var client=jayson[_0x4f9c('0xa')]['http']({'port':0x232a});config[_0x4f9c('0xb')]=_[_0x4f9c('0xc')](config['redis'],{'host':_0x4f9c('0xd'),'port':0x18eb});var socket=require(_0x4f9c('0xe'))(new Redis(config[_0x4f9c('0xb')]));require(_0x4f9c('0xf'))[_0x4f9c('0x10')](socket);function respondWithRpcPromise(_0x1109e3,_0x484278,_0x14cb1a){return new BPromise(function(_0x3256db,_0x3a81e7){return client[_0x4f9c('0x11')](_0x1109e3,_0x14cb1a)[_0x4f9c('0x12')](function(_0x345cd8){logger[_0x4f9c('0x13')](_0x4f9c('0x14'),_0x484278,_0x4f9c('0x15'));logger[_0x4f9c('0x16')](_0x4f9c('0x17'),_0x484278,_0x4f9c('0x15'),JSON[_0x4f9c('0x18')](_0x345cd8));if(_0x345cd8[_0x4f9c('0x19')]){if(_0x345cd8[_0x4f9c('0x19')]['code']===0x1f4){logger[_0x4f9c('0x19')](_0x4f9c('0x14'),_0x484278,_0x345cd8['error']['message']);return _0x3a81e7(_0x345cd8[_0x4f9c('0x19')][_0x4f9c('0x1a')]);}logger['error']('ChatInteraction,\x20%s,\x20%s',_0x484278,_0x345cd8[_0x4f9c('0x19')][_0x4f9c('0x1a')]);return _0x3256db(_0x345cd8[_0x4f9c('0x19')][_0x4f9c('0x1a')]);}else{logger[_0x4f9c('0x13')](_0x4f9c('0x14'),_0x484278,_0x4f9c('0x15'));_0x3256db(_0x345cd8[_0x4f9c('0x1b')][_0x4f9c('0x1a')]);}})[_0x4f9c('0x1c')](function(_0x46a763){logger[_0x4f9c('0x19')]('ChatInteraction,\x20%s,\x20%s',_0x484278,_0x46a763);_0x3a81e7(_0x46a763);});});}exports[_0x4f9c('0x1d')]=function(_0x4ff0f6){var _0x17730b=this;return new Promise(function(_0x23bd10,_0x24543d){return db[_0x4f9c('0x1e')][_0x4f9c('0x1f')](_0x4ff0f6[_0x4f9c('0x20')],{'raw':_0x4ff0f6[_0x4f9c('0x21')]?_0x4ff0f6['options'][_0x4f9c('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4ff0f6[_0x4f9c('0x21')]?_0x4ff0f6[_0x4f9c('0x21')][_0x4f9c('0x23')]||null:null,'attributes':_0x4ff0f6[_0x4f9c('0x21')]?_0x4ff0f6[_0x4f9c('0x21')][_0x4f9c('0x24')]||null:null,'limit':_0x4ff0f6[_0x4f9c('0x21')]?_0x4ff0f6[_0x4f9c('0x21')][_0x4f9c('0x25')]||null:null})[_0x4f9c('0x12')](function(_0x15579e){logger[_0x4f9c('0x13')](_0x4f9c('0x1d'),_0x4ff0f6);logger[_0x4f9c('0x16')](_0x4f9c('0x1d'),_0x4ff0f6,JSON['stringify'](_0x15579e));_0x23bd10(_0x15579e);})[_0x4f9c('0x1c')](function(_0x65ca4d){logger[_0x4f9c('0x19')]('UpdateChatInteraction',_0x65ca4d[_0x4f9c('0x1a')],_0x4ff0f6);_0x24543d(_0x17730b[_0x4f9c('0x19')](0x1f4,_0x65ca4d[_0x4f9c('0x1a')]));});});};exports[_0x4f9c('0x26')]=function(_0x2f310f){return new Promise(function(_0x13d8e4,_0x19fed6){return db[_0x4f9c('0x1e')][_0x4f9c('0x27')]({'where':_0x2f310f[_0x4f9c('0x21')]?_0x2f310f[_0x4f9c('0x21')][_0x4f9c('0x23')]||null:null})['then'](function(_0x28c9af){if(_0x28c9af){return _0x28c9af[_0x4f9c('0x28')](_0x2f310f[_0x4f9c('0x20')][_0x4f9c('0x29')],_[_0x4f9c('0x2a')](_0x2f310f[_0x4f9c('0x20')],[_0x4f9c('0x29'),'id'])||{});}})[_0x4f9c('0x2b')](function(_0x39431b){logger[_0x4f9c('0x13')](_0x4f9c('0x2c'),_0x2f310f);logger[_0x4f9c('0x16')](_0x4f9c('0x2c'),_0x2f310f,JSON[_0x4f9c('0x18')](_0x39431b));_0x13d8e4(_0x39431b);})['catch'](function(_0xc56ca5){logger[_0x4f9c('0x19')](_0x4f9c('0x2c'),_0xc56ca5[_0x4f9c('0x1a')],_0x2f310f);_0x19fed6(_this[_0x4f9c('0x19')](0x1f4,_0xc56ca5[_0x4f9c('0x1a')]));});});}; \ No newline at end of file +var _0x8e4d=['rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','./chatInteraction.socket','register','request','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','ChatInteraction','options','where','attributes','limit','then','UpdateChatInteraction','debug','catch','AddTagsToChatInteraction','addTags','body','omit','spread','AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8e4d,0x169));var _0xd8e4=function(_0x4fe8d8,_0x15ad31){_0x4fe8d8=_0x4fe8d8-0x0;var _0x2817e0=_0x8e4d[_0x4fe8d8];return _0x2817e0;};'use strict';var _=require(_0xd8e4('0x0'));var util=require(_0xd8e4('0x1'));var moment=require(_0xd8e4('0x2'));var BPromise=require(_0xd8e4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd8e4('0x4'));var db=require(_0xd8e4('0x5'))['db'];var utils=require(_0xd8e4('0x6'));var logger=require(_0xd8e4('0x7'))(_0xd8e4('0x8'));var config=require(_0xd8e4('0x9'));var jayson=require(_0xd8e4('0xa'));var client=jayson[_0xd8e4('0xb')]['http']({'port':0x232a});config[_0xd8e4('0xc')]=_[_0xd8e4('0xd')](config[_0xd8e4('0xc')],{'host':_0xd8e4('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd8e4('0xc')]));require(_0xd8e4('0xf'))[_0xd8e4('0x10')](socket);function respondWithRpcPromise(_0x253983,_0x64ead3,_0x5d1da4){return new BPromise(function(_0x533061,_0x21585c){return client[_0xd8e4('0x11')](_0x253983,_0x5d1da4)['then'](function(_0xde8cf1){logger[_0xd8e4('0x12')](_0xd8e4('0x13'),_0x64ead3,_0xd8e4('0x14'));logger['debug'](_0xd8e4('0x15'),_0x64ead3,'request\x20sent',JSON[_0xd8e4('0x16')](_0xde8cf1));if(_0xde8cf1[_0xd8e4('0x17')]){if(_0xde8cf1[_0xd8e4('0x17')]['code']===0x1f4){logger[_0xd8e4('0x17')]('ChatInteraction,\x20%s,\x20%s',_0x64ead3,_0xde8cf1[_0xd8e4('0x17')][_0xd8e4('0x18')]);return _0x21585c(_0xde8cf1[_0xd8e4('0x17')]['message']);}logger[_0xd8e4('0x17')](_0xd8e4('0x13'),_0x64ead3,_0xde8cf1[_0xd8e4('0x17')][_0xd8e4('0x18')]);return _0x533061(_0xde8cf1['error'][_0xd8e4('0x18')]);}else{logger[_0xd8e4('0x12')](_0xd8e4('0x13'),_0x64ead3,_0xd8e4('0x14'));_0x533061(_0xde8cf1[_0xd8e4('0x19')]['message']);}})['catch'](function(_0x29d556){logger[_0xd8e4('0x17')](_0xd8e4('0x13'),_0x64ead3,_0x29d556);_0x21585c(_0x29d556);});});}exports['UpdateChatInteraction']=function(_0x1afa39){var _0x2e72d8=this;return new Promise(function(_0x39a77a,_0x25b22e){return db[_0xd8e4('0x1a')]['update'](_0x1afa39['body'],{'raw':_0x1afa39[_0xd8e4('0x1b')]?_0x1afa39[_0xd8e4('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1afa39[_0xd8e4('0x1b')]?_0x1afa39[_0xd8e4('0x1b')][_0xd8e4('0x1c')]||null:null,'attributes':_0x1afa39[_0xd8e4('0x1b')]?_0x1afa39['options'][_0xd8e4('0x1d')]||null:null,'limit':_0x1afa39[_0xd8e4('0x1b')]?_0x1afa39[_0xd8e4('0x1b')][_0xd8e4('0x1e')]||null:null})[_0xd8e4('0x1f')](function(_0x31dd8e){logger[_0xd8e4('0x12')](_0xd8e4('0x20'),_0x1afa39);logger[_0xd8e4('0x21')](_0xd8e4('0x20'),_0x1afa39,JSON[_0xd8e4('0x16')](_0x31dd8e));_0x39a77a(_0x31dd8e);})[_0xd8e4('0x22')](function(_0x573e21){logger[_0xd8e4('0x17')](_0xd8e4('0x20'),_0x573e21[_0xd8e4('0x18')],_0x1afa39);_0x25b22e(_0x2e72d8['error'](0x1f4,_0x573e21['message']));});});};exports[_0xd8e4('0x23')]=function(_0x2efa13){return new Promise(function(_0x48b0bf,_0x26cf0d){return db[_0xd8e4('0x1a')]['find']({'where':_0x2efa13[_0xd8e4('0x1b')]?_0x2efa13[_0xd8e4('0x1b')]['where']||null:null})[_0xd8e4('0x1f')](function(_0x1e900c){if(_0x1e900c){return _0x1e900c[_0xd8e4('0x24')](_0x2efa13[_0xd8e4('0x25')]['ids'],_[_0xd8e4('0x26')](_0x2efa13[_0xd8e4('0x25')],['ids','id'])||{});}})[_0xd8e4('0x27')](function(_0x2917b0){logger[_0xd8e4('0x12')](_0xd8e4('0x28'),_0x2efa13);logger[_0xd8e4('0x21')](_0xd8e4('0x28'),_0x2efa13,JSON['stringify'](_0x2917b0));_0x48b0bf(_0x2917b0);})[_0xd8e4('0x22')](function(_0x3731aa){logger[_0xd8e4('0x17')]('AddTags',_0x3731aa['message'],_0x2efa13);_0x26cf0d(_this[_0xd8e4('0x17')](0x1f4,_0x3731aa[_0xd8e4('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 9b2f4d1..af32999 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 _0xb64d=['removeListener','length','chatInteraction:','./chatInteraction.events','remove','update','emit'];(function(_0x2576d7,_0x167624){var _0x16a08c=function(_0x19de1e){while(--_0x19de1e){_0x2576d7['push'](_0x2576d7['shift']());}};_0x16a08c(++_0x167624);}(_0xb64d,0x122));var _0xdb64=function(_0x24a5c8,_0x5a2f2f){_0x24a5c8=_0x24a5c8-0x0;var _0x475e86=_0xb64d[_0x24a5c8];return _0x475e86;};'use strict';var ChatInteractionEvents=require(_0xdb64('0x0'));var events=['save',_0xdb64('0x1'),_0xdb64('0x2')];function createListener(_0x56e140,_0x57ca6d){return function(_0x407d0c){_0x57ca6d[_0xdb64('0x3')](_0x56e140,_0x407d0c);};}function removeListener(_0x3cf6e8,_0x171af9){return function(){ChatInteractionEvents[_0xdb64('0x4')](_0x3cf6e8,_0x171af9);};}exports['register']=function(_0x41e325){for(var _0x2bdf64=0x0,_0x7d0555=events[_0xdb64('0x5')];_0x2bdf64<_0x7d0555;_0x2bdf64++){var _0x2cbd99=events[_0x2bdf64];var _0x593ee5=createListener(_0xdb64('0x6')+_0x2cbd99,_0x41e325);ChatInteractionEvents['on'](_0x2cbd99,_0x593ee5);}}; \ No newline at end of file +var _0x5934=['chatInteraction:','remove','emit','removeListener','length'];(function(_0x3f91c2,_0x1c3955){var _0x81e0ae=function(_0x103b89){while(--_0x103b89){_0x3f91c2['push'](_0x3f91c2['shift']());}};_0x81e0ae(++_0x1c3955);}(_0x5934,0xb5));var _0x4593=function(_0x4dfbb7,_0x50fbdd){_0x4dfbb7=_0x4dfbb7-0x0;var _0x46ac2c=_0x5934[_0x4dfbb7];return _0x46ac2c;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=['save',_0x4593('0x0'),'update'];function createListener(_0x46aa8f,_0x5af51e){return function(_0xe56064){_0x5af51e[_0x4593('0x1')](_0x46aa8f,_0xe56064);};}function removeListener(_0x512435,_0x2d8dea){return function(){ChatInteractionEvents[_0x4593('0x2')](_0x512435,_0x2d8dea);};}exports['register']=function(_0x1dd2ff){for(var _0x506b87=0x0,_0xb2e8a5=events[_0x4593('0x3')];_0x506b87<_0xb2e8a5;_0x506b87++){var _0x30ceed=events[_0x506b87];var _0xc7352c=createListener(_0x4593('0x4')+_0x30ceed,_0x1dd2ff);ChatInteractionEvents['on'](_0x30ceed,_0xc7352c);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index a07d1e0..ac2b644 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 _0xd723=['../../components/interaction/service','../../config/environment','./chatInteraction.controller','isAuthenticated','index','get','/describe','describe','/:id','isChatInteractionAuthorized','/:id/attachment_download','attachmentDownload','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','create','/:id/vidaoo','createVidaooSession','diskStorage','root','%s-%s','originalname','post','/:id/attachment_upload','single','file','attachmentUpload','/:id/messages','addMessage','/:id/tags','tracked','chat','chatinteraction:addtags','addTags','put','chatinteraction:update','update','/:id/custom_update','/:id/abandon','close','chatinteraction:destroy','removeTags','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x481ffc,_0x4acb82){var _0x51d09a=function(_0x2d73e0){while(--_0x2d73e0){_0x481ffc['push'](_0x481ffc['shift']());}};_0x51d09a(++_0x4acb82);}(_0xd723,0xc6));var _0x3d72=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0xd723[_0x138adb];return _0x1b27f2;};'use strict';var multer=require('multer');var util=require(_0x3d72('0x0'));var path=require(_0x3d72('0x1'));var timeout=require(_0x3d72('0x2'));var express=require(_0x3d72('0x3'));var router=express['Router']();var fs_extra=require(_0x3d72('0x4'));var auth=require(_0x3d72('0x5'));var interaction=require(_0x3d72('0x6'));var config=require(_0x3d72('0x7'));var controller=require(_0x3d72('0x8'));router['get']('/',auth[_0x3d72('0x9')](),controller[_0x3d72('0xa')]);router[_0x3d72('0xb')](_0x3d72('0xc'),auth[_0x3d72('0x9')](),controller[_0x3d72('0xd')]);router[_0x3d72('0xb')](_0x3d72('0xe'),auth[_0x3d72('0xf')](),controller['show']);router['get'](_0x3d72('0x10'),auth['isChatInteractionAuthorized'](),controller[_0x3d72('0x11')]);router[_0x3d72('0xb')]('/:id/messages',auth[_0x3d72('0x9')](),controller[_0x3d72('0x12')]);router['get'](_0x3d72('0x13'),auth[_0x3d72('0xf')](),controller[_0x3d72('0x14')]);router[_0x3d72('0xb')](_0x3d72('0x15'),auth['isAuthenticated'](),controller[_0x3d72('0x16')]);router['post']('/',auth[_0x3d72('0x9')](),controller[_0x3d72('0x17')]);router['post'](_0x3d72('0x18'),auth[_0x3d72('0x9')](),controller[_0x3d72('0x19')]);var upload=multer({'storage':multer[_0x3d72('0x1a')]({'destination':function(_0x364fe2,_0x2599c0,_0x1c2182){_0x1c2182(null,path['join'](config[_0x3d72('0x1b')],'server/files/attachments/'));},'filename':function(_0x3973d4,_0x31a14c,_0x459a71){_0x459a71(null,util['format'](_0x3d72('0x1c'),Date['now'](),_0x31a14c[_0x3d72('0x1d')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x3d72('0x1e')](_0x3d72('0x1f'),upload[_0x3d72('0x20')](_0x3d72('0x21')),controller[_0x3d72('0x22')]);router[_0x3d72('0x1e')](_0x3d72('0x23'),auth[_0x3d72('0xf')](),controller[_0x3d72('0x24')]);router[_0x3d72('0x1e')](_0x3d72('0x25'),auth[_0x3d72('0x9')](),interaction[_0x3d72('0x26')](_0x3d72('0x27'),_0x3d72('0x28')),controller[_0x3d72('0x29')]);router[_0x3d72('0x2a')](_0x3d72('0xe'),auth[_0x3d72('0x9')](),interaction[_0x3d72('0x26')](_0x3d72('0x27'),_0x3d72('0x2b')),controller[_0x3d72('0x2c')]);router[_0x3d72('0x2a')](_0x3d72('0x2d'),controller['customUpdate']);router['put'](_0x3d72('0x2e'),auth[_0x3d72('0xf')](),controller['abandon']);router[_0x3d72('0x2a')]('/:id/close',controller[_0x3d72('0x2f')]);router['delete']('/:id',auth[_0x3d72('0x9')](),interaction[_0x3d72('0x26')](_0x3d72('0x27'),_0x3d72('0x30')),controller['destroy']);router['delete'](_0x3d72('0x25'),auth['isAuthenticated'](),controller[_0x3d72('0x31')]);module[_0x3d72('0x32')]=router; \ No newline at end of file +var _0xdc28=['destroy','removeTags','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','index','describe','/:id','isChatInteractionAuthorized','show','attachmentDownload','/:id/messages','getMessages','getMyMessages','/:id/download','download','create','post','/:id/vidaoo','createVidaooSession','diskStorage','join','root','server/files/attachments/','%s-%s','now','originalname','replace','/:id/attachment_upload','single','file','addMessage','/:id/tags','chatinteraction:addtags','addTags','put','chatinteraction:update','update','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','delete','tracked','chatinteraction:destroy'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0xdc28,0x175));var _0x8dc2=function(_0x136efa,_0x5ba8e3){_0x136efa=_0x136efa-0x0;var _0x3c77dd=_0xdc28[_0x136efa];return _0x3c77dd;};'use strict';var multer=require(_0x8dc2('0x0'));var util=require(_0x8dc2('0x1'));var path=require('path');var timeout=require(_0x8dc2('0x2'));var express=require(_0x8dc2('0x3'));var router=express['Router']();var fs_extra=require(_0x8dc2('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x8dc2('0x5'));var config=require(_0x8dc2('0x6'));var controller=require(_0x8dc2('0x7'));router[_0x8dc2('0x8')]('/',auth[_0x8dc2('0x9')](),controller[_0x8dc2('0xa')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x8dc2('0xb')]);router[_0x8dc2('0x8')](_0x8dc2('0xc'),auth[_0x8dc2('0xd')](),controller[_0x8dc2('0xe')]);router[_0x8dc2('0x8')]('/:id/attachment_download',auth[_0x8dc2('0xd')](),controller[_0x8dc2('0xf')]);router[_0x8dc2('0x8')](_0x8dc2('0x10'),auth[_0x8dc2('0x9')](),controller[_0x8dc2('0x11')]);router[_0x8dc2('0x8')]('/:id/my_messages',auth[_0x8dc2('0xd')](),controller[_0x8dc2('0x12')]);router[_0x8dc2('0x8')](_0x8dc2('0x13'),auth['isAuthenticated'](),controller[_0x8dc2('0x14')]);router['post']('/',auth[_0x8dc2('0x9')](),controller[_0x8dc2('0x15')]);router[_0x8dc2('0x16')](_0x8dc2('0x17'),auth[_0x8dc2('0x9')](),controller[_0x8dc2('0x18')]);var upload=multer({'storage':multer[_0x8dc2('0x19')]({'destination':function(_0x39cd78,_0x485066,_0x18add7){_0x18add7(null,path[_0x8dc2('0x1a')](config[_0x8dc2('0x1b')],_0x8dc2('0x1c')));},'filename':function(_0x32ae44,_0x3b7ff0,_0x4ddae3){_0x4ddae3(null,util['format'](_0x8dc2('0x1d'),Date[_0x8dc2('0x1e')](),_0x3b7ff0[_0x8dc2('0x1f')][_0x8dc2('0x20')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x8dc2('0x16')](_0x8dc2('0x21'),upload[_0x8dc2('0x22')](_0x8dc2('0x23')),controller['attachmentUpload']);router[_0x8dc2('0x16')](_0x8dc2('0x10'),auth[_0x8dc2('0xd')](),controller[_0x8dc2('0x24')]);router['post'](_0x8dc2('0x25'),auth['isAuthenticated'](),interaction['tracked']('chat',_0x8dc2('0x26')),controller[_0x8dc2('0x27')]);router[_0x8dc2('0x28')](_0x8dc2('0xc'),auth['isAuthenticated'](),interaction['tracked']('chat',_0x8dc2('0x29')),controller[_0x8dc2('0x2a')]);router[_0x8dc2('0x28')](_0x8dc2('0x2b'),controller[_0x8dc2('0x2c')]);router['put'](_0x8dc2('0x2d'),auth[_0x8dc2('0xd')](),controller[_0x8dc2('0x2e')]);router[_0x8dc2('0x28')](_0x8dc2('0x2f'),controller['close']);router[_0x8dc2('0x30')](_0x8dc2('0xc'),auth[_0x8dc2('0x9')](),interaction[_0x8dc2('0x31')]('chat',_0x8dc2('0x32')),controller[_0x8dc2('0x33')]);router['delete'](_0x8dc2('0x25'),auth[_0x8dc2('0x9')](),controller[_0x8dc2('0x34')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 896973c..fc8d710 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 _0x7ad9=['INTEGER','exports','medium','BOOLEAN'];(function(_0x492a38,_0x1cfcc2){var _0x17bba0=function(_0x646374){while(--_0x646374){_0x492a38['push'](_0x492a38['shift']());}};_0x17bba0(++_0x1cfcc2);}(_0x7ad9,0x101));var _0x97ad=function(_0x4da2f9,_0x4293ba){_0x4da2f9=_0x4da2f9-0x0;var _0x2ae29d=_0x7ad9[_0x4da2f9];return _0x2ae29d;};'use strict';var Sequelize=require('sequelize');module[_0x97ad('0x0')]={'body':{'type':Sequelize['TEXT'](_0x97ad('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x97ad('0x2')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x97ad('0x3')]}}; \ No newline at end of file +var _0x36ec=['TEXT','medium','BOOLEAN','INTEGER','sequelize'];(function(_0x474f05,_0x3a9247){var _0x34ae54=function(_0x1cbb23){while(--_0x1cbb23){_0x474f05['push'](_0x474f05['shift']());}};_0x34ae54(++_0x3a9247);}(_0x36ec,0x126));var _0xc36e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x36ec[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xc36e('0x0'));module['exports']={'body':{'type':Sequelize[_0xc36e('0x1')](_0xc36e('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xc36e('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xc36e('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index a180a48..d22e4f9 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 _0x4eb8=['messages','lastMessageAt','lastMessage','format','getUsers','User','user','fullname','userpic','online','allowmessenger','showWebBar','-online','VoiceQueues','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource','agent','push','createdAt','FromId','read','all','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','end','json','offset','undefined','limit','count','apply','reject','update','then','destroy','status','stack','name','send','index','map','ChatInternalMessage','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','order','sort','where','filters','pick','filter','merge','options','include','findAll','rows','catch','show','params','length','find','create','body','describe'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4eb8,0x151));var _0x84eb=function(_0x15f972,_0x4a1fc7){_0x15f972=_0x15f972-0x0;var _0x3d916e=_0x4eb8[_0x15f972];return _0x3d916e;};'use strict';var emlformat=require(_0x84eb('0x0'));var rimraf=require(_0x84eb('0x1'));var zipdir=require(_0x84eb('0x2'));var jsonpatch=require(_0x84eb('0x3'));var rp=require('request-promise');var moment=require(_0x84eb('0x4'));var BPromise=require(_0x84eb('0x5'));var Mustache=require(_0x84eb('0x6'));var util=require('util');var path=require('path');var sox=require(_0x84eb('0x7'));var csv=require(_0x84eb('0x8'));var ejs=require(_0x84eb('0x9'));var fs=require('fs');var fs_extra=require(_0x84eb('0xa'));var _=require('lodash');var squel=require(_0x84eb('0xb'));var crypto=require(_0x84eb('0xc'));var jsforce=require(_0x84eb('0xd'));var deskjs=require(_0x84eb('0xe'));var toCsv=require(_0x84eb('0x8'));var querystring=require(_0x84eb('0xf'));var Papa=require(_0x84eb('0x10'));var Redis=require('ioredis');var authService=require(_0x84eb('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x84eb('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x84eb('0x13'))(_0x84eb('0x14'));var utils=require(_0x84eb('0x15'));var config=require(_0x84eb('0x16'));var licenseUtil=require(_0x84eb('0x17'));var db=require(_0x84eb('0x18'))['db'];config[_0x84eb('0x19')]=_[_0x84eb('0x1a')](config['redis'],{'host':_0x84eb('0x1b'),'port':0x18eb});var socket=require(_0x84eb('0x1c'))(new Redis(config[_0x84eb('0x19')]));require('./chatInternalMessage.socket')['register'](socket);function respondWithStatusCode(_0x5425cf,_0x1d1243){_0x1d1243=_0x1d1243||0xcc;return function(_0x101ff7){if(_0x101ff7){return _0x5425cf['sendStatus'](_0x1d1243);}return _0x5425cf['status'](_0x1d1243)[_0x84eb('0x1d')]();};}function respondWithResult(_0xc60087,_0x29a9fb){_0x29a9fb=_0x29a9fb||0xc8;return function(_0x1806a8){if(_0x1806a8){return _0xc60087['status'](_0x29a9fb)[_0x84eb('0x1e')](_0x1806a8);}};}function respondWithFilteredResult(_0x117a4a,_0x1aef61){return function(_0x154835){if(_0x154835){var _0x525fa3=typeof _0x1aef61[_0x84eb('0x1f')]===_0x84eb('0x20')&&typeof _0x1aef61[_0x84eb('0x21')]===_0x84eb('0x20');var _0x54ba30=_0x154835[_0x84eb('0x22')];var _0x3d1ff6=_0x525fa3?0x0:_0x1aef61['offset'];var _0x364278=_0x525fa3?_0x154835[_0x84eb('0x22')]:_0x1aef61[_0x84eb('0x1f')]+_0x1aef61[_0x84eb('0x21')];var _0x325da3;if(_0x364278>=_0x54ba30){_0x364278=_0x54ba30;_0x325da3=0xc8;}else{_0x325da3=0xce;}_0x117a4a['status'](_0x325da3);return _0x117a4a['set']('Content-Range',_0x3d1ff6+'-'+_0x364278+'/'+_0x54ba30)[_0x84eb('0x1e')](_0x154835);}return null;};}function patchUpdates(_0x2d3c02){return function(_0xc10241){try{jsonpatch[_0x84eb('0x23')](_0xc10241,_0x2d3c02,!![]);}catch(_0x14aec9){return BPromise[_0x84eb('0x24')](_0x14aec9);}return _0xc10241['save']();};}function saveUpdates(_0x4c7d78,_0x44cceb){return function(_0x3f9333){if(_0x3f9333){return _0x3f9333[_0x84eb('0x25')](_0x4c7d78)[_0x84eb('0x26')](function(_0xa0ee25){return _0xa0ee25;});}return null;};}function removeEntity(_0x53d5f9,_0x45ae67){return function(_0x1f1518){if(_0x1f1518){return _0x1f1518[_0x84eb('0x27')]()[_0x84eb('0x26')](function(){_0x53d5f9[_0x84eb('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e7b8d,_0x3700fe){return function(_0x477300){if(!_0x477300){_0x4e7b8d['sendStatus'](0x194);}return _0x477300;};}function handleError(_0x32f225,_0x1e7eed){_0x1e7eed=_0x1e7eed||0x1f4;return function(_0x5961de){logger['error'](_0x5961de[_0x84eb('0x29')]);if(_0x5961de[_0x84eb('0x2a')]){delete _0x5961de['name'];}_0x32f225[_0x84eb('0x28')](_0x1e7eed)[_0x84eb('0x2b')](_0x5961de);};}exports[_0x84eb('0x2c')]=function(_0x199873,_0x447655){var _0x31e7e7={},_0x9c0d94={},_0x2351f3={'count':0x0,'rows':[]};var _0x2e957c=_[_0x84eb('0x2d')](db[_0x84eb('0x2e')][_0x84eb('0x2f')],function(_0x180bcc){return{'name':_0x180bcc['fieldName'],'type':_0x180bcc[_0x84eb('0x30')][_0x84eb('0x31')]};});_0x9c0d94[_0x84eb('0x32')]=_[_0x84eb('0x2d')](_0x2e957c,_0x84eb('0x2a'));_0x9c0d94[_0x84eb('0x33')]=_[_0x84eb('0x34')](_0x199873[_0x84eb('0x33')]);_0x9c0d94['filters']=_[_0x84eb('0x35')](_0x9c0d94[_0x84eb('0x32')],_0x9c0d94[_0x84eb('0x33')]);_0x31e7e7[_0x84eb('0x36')]=_[_0x84eb('0x35')](_0x9c0d94['model'],qs[_0x84eb('0x37')](_0x199873['query'][_0x84eb('0x37')]));_0x31e7e7[_0x84eb('0x36')]=_0x31e7e7[_0x84eb('0x36')]['length']?_0x31e7e7[_0x84eb('0x36')]:_0x9c0d94[_0x84eb('0x32')];if(!_0x199873[_0x84eb('0x33')]['hasOwnProperty']('nolimit')){_0x31e7e7['limit']=qs[_0x84eb('0x21')](_0x199873[_0x84eb('0x33')][_0x84eb('0x21')]);_0x31e7e7[_0x84eb('0x1f')]=qs[_0x84eb('0x1f')](_0x199873[_0x84eb('0x33')]['offset']);}_0x31e7e7[_0x84eb('0x38')]=qs[_0x84eb('0x39')](_0x199873[_0x84eb('0x33')][_0x84eb('0x39')]);_0x31e7e7[_0x84eb('0x3a')]=qs[_0x84eb('0x3b')](_[_0x84eb('0x3c')](_0x199873[_0x84eb('0x33')],_0x9c0d94[_0x84eb('0x3b')]),_0x2e957c);if(_0x199873[_0x84eb('0x33')][_0x84eb('0x3d')]){_0x31e7e7[_0x84eb('0x3a')]=_['merge'](_0x31e7e7[_0x84eb('0x3a')],{'$or':_[_0x84eb('0x2d')](_0x2e957c,function(_0x264bf0){if(_0x264bf0[_0x84eb('0x30')]!=='VIRTUAL'){var _0x3191ca={};_0x3191ca[_0x264bf0[_0x84eb('0x2a')]]={'$like':'%'+_0x199873['query']['filter']+'%'};return _0x3191ca;}})});}_0x31e7e7=_[_0x84eb('0x3e')]({},_0x31e7e7,_0x199873[_0x84eb('0x3f')]);var _0x10b274={'where':_0x31e7e7[_0x84eb('0x3a')]};return db[_0x84eb('0x2e')]['count'](_0x10b274)[_0x84eb('0x26')](function(_0x33980b){_0x2351f3[_0x84eb('0x22')]=_0x33980b;if(_0x199873[_0x84eb('0x33')]['includeAll']){_0x31e7e7[_0x84eb('0x40')]=[{'all':!![]}];}return db[_0x84eb('0x2e')][_0x84eb('0x41')](_0x31e7e7);})['then'](function(_0x5f54e7){_0x2351f3[_0x84eb('0x42')]=_0x5f54e7;return _0x2351f3;})['then'](respondWithFilteredResult(_0x447655,_0x31e7e7))[_0x84eb('0x43')](handleError(_0x447655,null));};exports[_0x84eb('0x44')]=function(_0x332b1c,_0x3b01d9){var _0x174b3b={'raw':!![],'where':{'id':_0x332b1c[_0x84eb('0x45')]['id']}},_0x66193b={};_0x66193b[_0x84eb('0x32')]=_[_0x84eb('0x34')](db[_0x84eb('0x2e')][_0x84eb('0x2f')]);_0x66193b['query']=_[_0x84eb('0x34')](_0x332b1c[_0x84eb('0x33')]);_0x66193b[_0x84eb('0x3b')]=_[_0x84eb('0x35')](_0x66193b[_0x84eb('0x32')],_0x66193b[_0x84eb('0x33')]);_0x174b3b['attributes']=_[_0x84eb('0x35')](_0x66193b[_0x84eb('0x32')],qs[_0x84eb('0x37')](_0x332b1c[_0x84eb('0x33')][_0x84eb('0x37')]));_0x174b3b[_0x84eb('0x36')]=_0x174b3b[_0x84eb('0x36')][_0x84eb('0x46')]?_0x174b3b[_0x84eb('0x36')]:_0x66193b[_0x84eb('0x32')];if(_0x332b1c[_0x84eb('0x33')]['includeAll']){_0x174b3b[_0x84eb('0x40')]=[{'all':!![]}];}_0x174b3b=_['merge']({},_0x174b3b,_0x332b1c['options']);return db[_0x84eb('0x2e')][_0x84eb('0x47')](_0x174b3b)[_0x84eb('0x26')](handleEntityNotFound(_0x3b01d9,null))['then'](respondWithResult(_0x3b01d9,null))['catch'](handleError(_0x3b01d9,null));};exports['create']=function(_0x320187,_0x15259e){return db[_0x84eb('0x2e')][_0x84eb('0x48')](_0x320187[_0x84eb('0x49')],{})[_0x84eb('0x26')](respondWithResult(_0x15259e,0xc9))[_0x84eb('0x43')](handleError(_0x15259e,null));};exports[_0x84eb('0x25')]=function(_0x2cd997,_0x183e89){if(_0x2cd997['body']['id']){delete _0x2cd997[_0x84eb('0x49')]['id'];}return db[_0x84eb('0x2e')][_0x84eb('0x47')]({'where':{'id':_0x2cd997[_0x84eb('0x45')]['id']}})['then'](handleEntityNotFound(_0x183e89,null))['then'](saveUpdates(_0x2cd997[_0x84eb('0x49')],null))[_0x84eb('0x26')](respondWithResult(_0x183e89,null))[_0x84eb('0x43')](handleError(_0x183e89,null));};exports[_0x84eb('0x27')]=function(_0x2c38d6,_0x118687){return db[_0x84eb('0x2e')][_0x84eb('0x47')]({'where':{'id':_0x2c38d6[_0x84eb('0x45')]['id']}})[_0x84eb('0x26')](handleEntityNotFound(_0x118687,null))['then'](removeEntity(_0x118687,null))['catch'](handleError(_0x118687,null));};exports[_0x84eb('0x4a')]=function(_0x38b00c,_0x36f8d4){return db['ChatInternalMessage'][_0x84eb('0x4a')]()['then'](respondWithResult(_0x36f8d4,null))[_0x84eb('0x43')](handleError(_0x36f8d4,null));};function wrapUser(_0x3649ab){return function(_0x1bbbf3){var _0x4dacd8=_0x3649ab['get']({'plain':!![]});_0x4dacd8[_0x84eb('0x4b')]=[];if(_0x1bbbf3){_0x4dacd8[_0x84eb('0x4c')]=_0x1bbbf3['createdAt'];_0x4dacd8[_0x84eb('0x4d')]=_0x1bbbf3;}else{_0x4dacd8[_0x84eb('0x4c')]=moment(0x0)[_0x84eb('0x4e')]('YYYY-MM-DD\x20HH:mm:ss');_0x4dacd8[_0x84eb('0x4d')]={};}return _0x4dacd8;};}exports[_0x84eb('0x4f')]=function(_0x4bcabd,_0x2fb7d5,_0x34b81e){var _0x3425de=[];return db[_0x84eb('0x50')][_0x84eb('0x41')]({'where':{'role':['agent','admin',_0x84eb('0x51')]},'attributes':['id',_0x84eb('0x52'),_0x84eb('0x2a'),'role',_0x84eb('0x53'),'internal',_0x84eb('0x54'),'lastLoginAt',_0x84eb('0x55'),_0x84eb('0x56')],'order':qs[_0x84eb('0x39')](_0x84eb('0x57')),'include':[{'model':db['VoiceQueue'],'as':_0x84eb('0x58'),'attributes':['id',_0x84eb('0x2a'),_0x84eb('0x30')],'through':{'attributes':[]}}]})[_0x84eb('0x26')](function(_0xe9759f){if(_0xe9759f){var _0x287f55=_0x4bcabd[_0x84eb('0x51')][_0x84eb('0x59')]({'plain':!![]});if(!_0x287f55)throw new Error(_0x84eb('0x5a'));if(_0x287f55[_0x84eb('0x5b')]===_0x84eb('0x51')){return db[_0x84eb('0x5c')]['find']({'where':{'name':_0x84eb('0x5d'),'userProfileId':_0x287f55[_0x84eb('0x5e')]},'raw':!![]})[_0x84eb('0x26')](function(_0x119f5d){if(_0x119f5d){if(_0x119f5d[_0x84eb('0x5f')]===0x0){return db[_0x84eb('0x60')][_0x84eb('0x41')]({'where':{'sectionId':_0x119f5d['id']},'raw':!![]})[_0x84eb('0x26')](function(_0x22eb30){var _0x418350=[];if(_['isEmpty'](_0x22eb30)){_0x418350=_[_0x84eb('0x3d')](_0xe9759f,function(_0x40c438){if(_0x40c438[_0x84eb('0x5b')]!=='agent'){return _0x40c438;}});return _0x418350;}else{for(var _0x2ecef9=0x0;_0x2ecef9<_0xe9759f[_0x84eb('0x46')];_0x2ecef9++){var _0x3e1c63=_0xe9759f[_0x2ecef9];if(_0x3e1c63['role']===_0x84eb('0x61')){var _0x13fdfd=_[_0x84eb('0x47')](_0x22eb30,function(_0x281e65){return _0x281e65['resourceId']===_0x3e1c63['id'];});if(_0x13fdfd)_0x418350[_0x84eb('0x62')](_0x3e1c63);}else{_0x418350[_0x84eb('0x62')](_0x3e1c63);}}return _0x418350;}});}else{return _0xe9759f;}}else{var _0x3b9541=_[_0x84eb('0x3d')](_0xe9759f,function(_0x15bf7d){if(_0x15bf7d['role']!==_0x84eb('0x61')){return _0x15bf7d;}});return _0x3b9541;}});}else{return _0xe9759f;}}})[_0x84eb('0x26')](function(_0x28ce0d){var _0xc639b8=[];if(_0x28ce0d){_0x3425de=_0x28ce0d;for(var _0x17de3d=0x0;_0x17de3d<_0x28ce0d[_0x84eb('0x46')];_0x17de3d+=0x1){_0x3425de[_0x17de3d]['messages']=[];_0xc639b8[_0x84eb('0x62')](db[_0x84eb('0x2e')]['find']({'where':{'FromId':[_0x4bcabd[_0x84eb('0x51')]['id'],_0x28ce0d[_0x17de3d]['id']],'ToId':[_0x4bcabd[_0x84eb('0x51')]['id'],_0x28ce0d[_0x17de3d]['id']],'ChatGroupId':null},'attributes':['id',_0x84eb('0x63'),_0x84eb('0x64'),'ToId',_0x84eb('0x65'),_0x84eb('0x49')],'order':qs[_0x84eb('0x39')]('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})[_0x84eb('0x26')](wrapUser(_0x28ce0d[_0x17de3d])));}return BPromise[_0x84eb('0x66')](_0xc639b8);}return[];})[_0x84eb('0x26')](function(_0x552381){return{'rows':_0x552381,'count':_0x552381[_0x84eb('0x46')]};})[_0x84eb('0x26')](respondWithResult(_0x2fb7d5,null))[_0x84eb('0x43')](handleError(_0x2fb7d5,null));}; \ No newline at end of file +var _0xcfd1=['lastMessageAt','createdAt','lastMessage','format','getUsers','User','agent','user','fullname','role','userpic','internal','allowmessenger','showWebBar','-online','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','Agents','resourceId','push','FromId','ToId','read','-createdAt','all','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','register','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','update','then','error','stack','name','map','ChatInternalMessage','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','destroy','get','messages'];(function(_0x134d1d,_0x22b473){var _0x30b003=function(_0x5930dc){while(--_0x5930dc){_0x134d1d['push'](_0x134d1d['shift']());}};_0x30b003(++_0x22b473);}(_0xcfd1,0x1c2));var _0x1cfd=function(_0x24c3a1,_0x4a69e6){_0x24c3a1=_0x24c3a1-0x0;var _0x452f46=_0xcfd1[_0x24c3a1];return _0x452f46;};'use strict';var emlformat=require(_0x1cfd('0x0'));var rimraf=require(_0x1cfd('0x1'));var zipdir=require(_0x1cfd('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1cfd('0x3'));var moment=require(_0x1cfd('0x4'));var BPromise=require(_0x1cfd('0x5'));var Mustache=require('mustache');var util=require(_0x1cfd('0x6'));var path=require('path');var sox=require(_0x1cfd('0x7'));var csv=require(_0x1cfd('0x8'));var ejs=require(_0x1cfd('0x9'));var fs=require('fs');var fs_extra=require(_0x1cfd('0xa'));var _=require(_0x1cfd('0xb'));var squel=require('squel');var crypto=require(_0x1cfd('0xc'));var jsforce=require(_0x1cfd('0xd'));var deskjs=require(_0x1cfd('0xe'));var toCsv=require(_0x1cfd('0x8'));var querystring=require('querystring');var Papa=require(_0x1cfd('0xf'));var Redis=require('ioredis');var authService=require(_0x1cfd('0x10'));var qs=require(_0x1cfd('0x11'));var as=require(_0x1cfd('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x1cfd('0x13'));var utils=require(_0x1cfd('0x14'));var config=require(_0x1cfd('0x15'));var licenseUtil=require(_0x1cfd('0x16'));var db=require(_0x1cfd('0x17'))['db'];config['redis']=_[_0x1cfd('0x18')](config[_0x1cfd('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x1cfd('0x1a'))(new Redis(config['redis']));require('./chatInternalMessage.socket')[_0x1cfd('0x1b')](socket);function respondWithStatusCode(_0x9d799,_0x19677a){_0x19677a=_0x19677a||0xcc;return function(_0x4375f6){if(_0x4375f6){return _0x9d799[_0x1cfd('0x1c')](_0x19677a);}return _0x9d799[_0x1cfd('0x1d')](_0x19677a)[_0x1cfd('0x1e')]();};}function respondWithResult(_0x21da01,_0x1b4b56){_0x1b4b56=_0x1b4b56||0xc8;return function(_0x38e0cd){if(_0x38e0cd){return _0x21da01[_0x1cfd('0x1d')](_0x1b4b56)[_0x1cfd('0x1f')](_0x38e0cd);}};}function respondWithFilteredResult(_0x58289c,_0x4fec5f){return function(_0x43aa09){if(_0x43aa09){var _0x2f982e=typeof _0x4fec5f[_0x1cfd('0x20')]==='undefined'&&typeof _0x4fec5f[_0x1cfd('0x21')]==='undefined';var _0xcad212=_0x43aa09[_0x1cfd('0x22')];var _0x295657=_0x2f982e?0x0:_0x4fec5f[_0x1cfd('0x20')];var _0x1aeb40=_0x2f982e?_0x43aa09['count']:_0x4fec5f[_0x1cfd('0x20')]+_0x4fec5f[_0x1cfd('0x21')];var _0x4048ea;if(_0x1aeb40>=_0xcad212){_0x1aeb40=_0xcad212;_0x4048ea=0xc8;}else{_0x4048ea=0xce;}_0x58289c['status'](_0x4048ea);return _0x58289c[_0x1cfd('0x23')](_0x1cfd('0x24'),_0x295657+'-'+_0x1aeb40+'/'+_0xcad212)['json'](_0x43aa09);}return null;};}function patchUpdates(_0x327a9d){return function(_0x29c3f1){try{jsonpatch[_0x1cfd('0x25')](_0x29c3f1,_0x327a9d,!![]);}catch(_0x555954){return BPromise[_0x1cfd('0x26')](_0x555954);}return _0x29c3f1['save']();};}function saveUpdates(_0x1c63df,_0x2c28c4){return function(_0x4bcc0c){if(_0x4bcc0c){return _0x4bcc0c[_0x1cfd('0x27')](_0x1c63df)[_0x1cfd('0x28')](function(_0x35b7b0){return _0x35b7b0;});}return null;};}function removeEntity(_0x5de27a,_0x48ed54){return function(_0x47e8ac){if(_0x47e8ac){return _0x47e8ac['destroy']()[_0x1cfd('0x28')](function(){_0x5de27a[_0x1cfd('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x32a8b6,_0x113790){return function(_0x1871ce){if(!_0x1871ce){_0x32a8b6[_0x1cfd('0x1c')](0x194);}return _0x1871ce;};}function handleError(_0xb027b2,_0xe93611){_0xe93611=_0xe93611||0x1f4;return function(_0x2b18e0){logger[_0x1cfd('0x29')](_0x2b18e0[_0x1cfd('0x2a')]);if(_0x2b18e0['name']){delete _0x2b18e0[_0x1cfd('0x2b')];}_0xb027b2[_0x1cfd('0x1d')](_0xe93611)['send'](_0x2b18e0);};}exports['index']=function(_0x261ae5,_0x596544){var _0x314b2f={},_0x4c38ff={},_0x413df1={'count':0x0,'rows':[]};var _0x4d3bca=_[_0x1cfd('0x2c')](db[_0x1cfd('0x2d')]['rawAttributes'],function(_0x1e1ea4){return{'name':_0x1e1ea4[_0x1cfd('0x2e')],'type':_0x1e1ea4[_0x1cfd('0x2f')][_0x1cfd('0x30')]};});_0x4c38ff[_0x1cfd('0x31')]=_[_0x1cfd('0x2c')](_0x4d3bca,'name');_0x4c38ff[_0x1cfd('0x32')]=_[_0x1cfd('0x33')](_0x261ae5[_0x1cfd('0x32')]);_0x4c38ff['filters']=_[_0x1cfd('0x34')](_0x4c38ff[_0x1cfd('0x31')],_0x4c38ff[_0x1cfd('0x32')]);_0x314b2f[_0x1cfd('0x35')]=_[_0x1cfd('0x34')](_0x4c38ff[_0x1cfd('0x31')],qs[_0x1cfd('0x36')](_0x261ae5[_0x1cfd('0x32')][_0x1cfd('0x36')]));_0x314b2f[_0x1cfd('0x35')]=_0x314b2f[_0x1cfd('0x35')][_0x1cfd('0x37')]?_0x314b2f[_0x1cfd('0x35')]:_0x4c38ff[_0x1cfd('0x31')];if(!_0x261ae5[_0x1cfd('0x32')][_0x1cfd('0x38')](_0x1cfd('0x39'))){_0x314b2f['limit']=qs[_0x1cfd('0x21')](_0x261ae5[_0x1cfd('0x32')][_0x1cfd('0x21')]);_0x314b2f[_0x1cfd('0x20')]=qs['offset'](_0x261ae5[_0x1cfd('0x32')][_0x1cfd('0x20')]);}_0x314b2f[_0x1cfd('0x3a')]=qs[_0x1cfd('0x3b')](_0x261ae5['query']['sort']);_0x314b2f[_0x1cfd('0x3c')]=qs[_0x1cfd('0x3d')](_['pick'](_0x261ae5['query'],_0x4c38ff[_0x1cfd('0x3d')]),_0x4d3bca);if(_0x261ae5[_0x1cfd('0x32')][_0x1cfd('0x3e')]){_0x314b2f[_0x1cfd('0x3c')]=_[_0x1cfd('0x3f')](_0x314b2f[_0x1cfd('0x3c')],{'$or':_[_0x1cfd('0x2c')](_0x4d3bca,function(_0x28785a){if(_0x28785a['type']!==_0x1cfd('0x40')){var _0x2eccd4={};_0x2eccd4[_0x28785a[_0x1cfd('0x2b')]]={'$like':'%'+_0x261ae5['query'][_0x1cfd('0x3e')]+'%'};return _0x2eccd4;}})});}_0x314b2f=_['merge']({},_0x314b2f,_0x261ae5[_0x1cfd('0x41')]);var _0xc038e7={'where':_0x314b2f['where']};return db[_0x1cfd('0x2d')]['count'](_0xc038e7)['then'](function(_0x348ccb){_0x413df1[_0x1cfd('0x22')]=_0x348ccb;if(_0x261ae5[_0x1cfd('0x32')][_0x1cfd('0x42')]){_0x314b2f[_0x1cfd('0x43')]=[{'all':!![]}];}return db['ChatInternalMessage'][_0x1cfd('0x44')](_0x314b2f);})[_0x1cfd('0x28')](function(_0x53547d){_0x413df1[_0x1cfd('0x45')]=_0x53547d;return _0x413df1;})[_0x1cfd('0x28')](respondWithFilteredResult(_0x596544,_0x314b2f))[_0x1cfd('0x46')](handleError(_0x596544,null));};exports[_0x1cfd('0x47')]=function(_0xd682e1,_0xa86916){var _0x554001={'raw':!![],'where':{'id':_0xd682e1[_0x1cfd('0x48')]['id']}},_0xa6f7db={};_0xa6f7db[_0x1cfd('0x31')]=_[_0x1cfd('0x33')](db[_0x1cfd('0x2d')][_0x1cfd('0x49')]);_0xa6f7db[_0x1cfd('0x32')]=_['keys'](_0xd682e1['query']);_0xa6f7db['filters']=_[_0x1cfd('0x34')](_0xa6f7db[_0x1cfd('0x31')],_0xa6f7db[_0x1cfd('0x32')]);_0x554001[_0x1cfd('0x35')]=_[_0x1cfd('0x34')](_0xa6f7db[_0x1cfd('0x31')],qs['fields'](_0xd682e1[_0x1cfd('0x32')][_0x1cfd('0x36')]));_0x554001[_0x1cfd('0x35')]=_0x554001[_0x1cfd('0x35')][_0x1cfd('0x37')]?_0x554001[_0x1cfd('0x35')]:_0xa6f7db['model'];if(_0xd682e1[_0x1cfd('0x32')]['includeAll']){_0x554001[_0x1cfd('0x43')]=[{'all':!![]}];}_0x554001=_[_0x1cfd('0x3f')]({},_0x554001,_0xd682e1[_0x1cfd('0x41')]);return db['ChatInternalMessage'][_0x1cfd('0x4a')](_0x554001)[_0x1cfd('0x28')](handleEntityNotFound(_0xa86916,null))[_0x1cfd('0x28')](respondWithResult(_0xa86916,null))['catch'](handleError(_0xa86916,null));};exports['create']=function(_0x1a5eb9,_0x11ac92){return db[_0x1cfd('0x2d')][_0x1cfd('0x4b')](_0x1a5eb9[_0x1cfd('0x4c')],{})[_0x1cfd('0x28')](respondWithResult(_0x11ac92,0xc9))[_0x1cfd('0x46')](handleError(_0x11ac92,null));};exports[_0x1cfd('0x27')]=function(_0x480909,_0x321848){if(_0x480909[_0x1cfd('0x4c')]['id']){delete _0x480909[_0x1cfd('0x4c')]['id'];}return db[_0x1cfd('0x2d')][_0x1cfd('0x4a')]({'where':{'id':_0x480909['params']['id']}})[_0x1cfd('0x28')](handleEntityNotFound(_0x321848,null))[_0x1cfd('0x28')](saveUpdates(_0x480909[_0x1cfd('0x4c')],null))['then'](respondWithResult(_0x321848,null))['catch'](handleError(_0x321848,null));};exports[_0x1cfd('0x4d')]=function(_0x3c93da,_0x53c8eb){return db[_0x1cfd('0x2d')][_0x1cfd('0x4a')]({'where':{'id':_0x3c93da[_0x1cfd('0x48')]['id']}})[_0x1cfd('0x28')](handleEntityNotFound(_0x53c8eb,null))['then'](removeEntity(_0x53c8eb,null))[_0x1cfd('0x46')](handleError(_0x53c8eb,null));};exports['describe']=function(_0xb64623,_0x275c69){return db['ChatInternalMessage']['describe']()['then'](respondWithResult(_0x275c69,null))[_0x1cfd('0x46')](handleError(_0x275c69,null));};function wrapUser(_0x2486de){return function(_0x5e6008){var _0x323946=_0x2486de[_0x1cfd('0x4e')]({'plain':!![]});_0x323946[_0x1cfd('0x4f')]=[];if(_0x5e6008){_0x323946[_0x1cfd('0x50')]=_0x5e6008[_0x1cfd('0x51')];_0x323946[_0x1cfd('0x52')]=_0x5e6008;}else{_0x323946['lastMessageAt']=moment(0x0)[_0x1cfd('0x53')]('YYYY-MM-DD\x20HH:mm:ss');_0x323946[_0x1cfd('0x52')]={};}return _0x323946;};}exports[_0x1cfd('0x54')]=function(_0x54d3f4,_0x18c8c7,_0x20fdf6){var _0x5a67a5=[];return db[_0x1cfd('0x55')][_0x1cfd('0x44')]({'where':{'role':[_0x1cfd('0x56'),'admin',_0x1cfd('0x57')]},'attributes':['id',_0x1cfd('0x58'),'name',_0x1cfd('0x59'),_0x1cfd('0x5a'),_0x1cfd('0x5b'),'online','lastLoginAt',_0x1cfd('0x5c'),_0x1cfd('0x5d')],'order':qs[_0x1cfd('0x3b')](_0x1cfd('0x5e')),'include':[{'model':db[_0x1cfd('0x5f')],'as':_0x1cfd('0x60'),'attributes':['id',_0x1cfd('0x2b'),_0x1cfd('0x2f')],'through':{'attributes':[]}}]})['then'](function(_0x52cb5a){if(_0x52cb5a){var _0x51b72f=_0x54d3f4[_0x1cfd('0x57')][_0x1cfd('0x4e')]({'plain':!![]});if(!_0x51b72f)throw new Error(_0x1cfd('0x61'));if(_0x51b72f[_0x1cfd('0x59')]===_0x1cfd('0x57')){return db['UserProfileSection'][_0x1cfd('0x4a')]({'where':{'name':_0x1cfd('0x62'),'userProfileId':_0x51b72f['userProfileId']},'raw':!![]})['then'](function(_0x38415a){if(_0x38415a){if(_0x38415a['autoAssociation']===0x0){return db['UserProfileResource'][_0x1cfd('0x44')]({'where':{'sectionId':_0x38415a['id']},'raw':!![]})[_0x1cfd('0x28')](function(_0x4d137c){var _0x58b3a3=[];if(_['isEmpty'](_0x4d137c)){_0x58b3a3=_[_0x1cfd('0x3e')](_0x52cb5a,function(_0x171fc5){if(_0x171fc5['role']!==_0x1cfd('0x56')){return _0x171fc5;}});return _0x58b3a3;}else{for(var _0x3f9bd7=0x0;_0x3f9bd7<_0x52cb5a[_0x1cfd('0x37')];_0x3f9bd7++){var _0xd5b846=_0x52cb5a[_0x3f9bd7];if(_0xd5b846[_0x1cfd('0x59')]==='agent'){var _0x324993=_[_0x1cfd('0x4a')](_0x4d137c,function(_0x2c7b04){return _0x2c7b04[_0x1cfd('0x63')]===_0xd5b846['id'];});if(_0x324993)_0x58b3a3[_0x1cfd('0x64')](_0xd5b846);}else{_0x58b3a3[_0x1cfd('0x64')](_0xd5b846);}}return _0x58b3a3;}});}else{return _0x52cb5a;}}else{var _0x3f05d2=_[_0x1cfd('0x3e')](_0x52cb5a,function(_0x25c9f6){if(_0x25c9f6[_0x1cfd('0x59')]!==_0x1cfd('0x56')){return _0x25c9f6;}});return _0x3f05d2;}});}else{return _0x52cb5a;}}})['then'](function(_0x2cd8e3){var _0x3819b8=[];if(_0x2cd8e3){_0x5a67a5=_0x2cd8e3;for(var _0x1644fa=0x0;_0x1644fa<_0x2cd8e3[_0x1cfd('0x37')];_0x1644fa+=0x1){_0x5a67a5[_0x1644fa][_0x1cfd('0x4f')]=[];_0x3819b8[_0x1cfd('0x64')](db[_0x1cfd('0x2d')][_0x1cfd('0x4a')]({'where':{'FromId':[_0x54d3f4[_0x1cfd('0x57')]['id'],_0x2cd8e3[_0x1644fa]['id']],'ToId':[_0x54d3f4[_0x1cfd('0x57')]['id'],_0x2cd8e3[_0x1644fa]['id']],'ChatGroupId':null},'attributes':['id',_0x1cfd('0x51'),_0x1cfd('0x65'),_0x1cfd('0x66'),_0x1cfd('0x67'),_0x1cfd('0x4c')],'order':qs[_0x1cfd('0x3b')](_0x1cfd('0x68')),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0x2cd8e3[_0x1644fa])));}return BPromise[_0x1cfd('0x69')](_0x3819b8);}return[];})['then'](function(_0x166417){return{'rows':_0x166417,'count':_0x166417[_0x1cfd('0x37')]};})['then'](respondWithResult(_0x18c8c7,null))['catch'](handleError(_0x18c8c7,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 786f034..8bbc484 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 _0x1902=['exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x2c0be1,_0x1e88f2){var _0x3d4bd2=function(_0x2b5497){while(--_0x2b5497){_0x2c0be1['push'](_0x2c0be1['shift']());}};_0x3d4bd2(++_0x1e88f2);}(_0x1902,0x83));var _0x2190=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1902[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x2190('0x0'));var ChatInternalMessage=require(_0x2190('0x1'))['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x2190('0x2')](0x0);var events={'afterCreate':_0x2190('0x3'),'afterUpdate':_0x2190('0x4'),'afterDestroy':_0x2190('0x5')};function emitEvent(_0x40c3e5){return function(_0x320ba2,_0x3f94cb,_0x5b8d22){ChatInternalMessageEvents[_0x2190('0x6')](_0x40c3e5+':'+_0x320ba2['id'],_0x320ba2);ChatInternalMessageEvents[_0x2190('0x6')](_0x40c3e5,_0x320ba2);_0x5b8d22(null);};}for(var e in events){if(events[_0x2190('0x7')](e)){var event=events[e];ChatInternalMessage[_0x2190('0x8')](e,emitEvent(event));}}module[_0x2190('0x9')]=ChatInternalMessageEvents; \ No newline at end of file +var _0xc195=['save','update','emit','hook','exports','events','../../mysqldb','ChatInternalMessage'];(function(_0x431e0d,_0x2140c0){var _0x2f0c81=function(_0x4f148f){while(--_0x4f148f){_0x431e0d['push'](_0x431e0d['shift']());}};_0x2f0c81(++_0x2140c0);}(_0xc195,0x95));var _0x5c19=function(_0x32b30c,_0x2d5ec8){_0x32b30c=_0x32b30c-0x0;var _0xcfc212=_0xc195[_0x32b30c];return _0xcfc212;};'use strict';var EventEmitter=require(_0x5c19('0x0'));var ChatInternalMessage=require(_0x5c19('0x1'))['db'][_0x5c19('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5c19('0x3'),'afterUpdate':_0x5c19('0x4'),'afterDestroy':'remove'};function emitEvent(_0x44b265){return function(_0x475591,_0x17c4b6,_0x3243f2){ChatInternalMessageEvents[_0x5c19('0x5')](_0x44b265+':'+_0x475591['id'],_0x475591);ChatInternalMessageEvents[_0x5c19('0x5')](_0x44b265,_0x475591);_0x3243f2(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage[_0x5c19('0x6')](e,emitEvent(event));}}module[_0x5c19('0x7')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index e503a1a..149873b 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 _0xeb68=['../../config/environment','./chatInternalMessage.attributes','exports','define','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x5872e4,_0xf3b9f6){var _0x502154=function(_0x12883e){while(--_0x12883e){_0x5872e4['push'](_0x5872e4['shift']());}};_0x502154(++_0xf3b9f6);}(_0xeb68,0x1f1));var _0x8eb6=function(_0x37d3f3,_0xca010f){_0x37d3f3=_0x37d3f3-0x0;var _0x185c9c=_0xeb68[_0x37d3f3];return _0x185c9c;};'use strict';var _=require(_0x8eb6('0x0'));var util=require('util');var logger=require(_0x8eb6('0x1'))(_0x8eb6('0x2'));var moment=require('moment');var BPromise=require(_0x8eb6('0x3'));var rp=require(_0x8eb6('0x4'));var fs=require('fs');var path=require(_0x8eb6('0x5'));var rimraf=require(_0x8eb6('0x6'));var config=require(_0x8eb6('0x7'));var attributes=require(_0x8eb6('0x8'));module[_0x8eb6('0x9')]=function(_0x5a7ecd,_0x3802c8){return _0x5a7ecd[_0x8eb6('0xa')]('ChatInternalMessage',attributes,{'tableName':_0x8eb6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8eb6('0xc'),'collate':_0x8eb6('0xd')});}; \ No newline at end of file +var _0xadc4=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatInternalMessage.attributes','exports','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x5a7112,_0x1f9492){var _0x3147f7=function(_0x4d2329){while(--_0x4d2329){_0x5a7112['push'](_0x5a7112['shift']());}};_0x3147f7(++_0x1f9492);}(_0xadc4,0x195));var _0x4adc=function(_0x1b0601,_0x553222){_0x1b0601=_0x1b0601-0x0;var _0x40dbdc=_0xadc4[_0x1b0601];return _0x40dbdc;};'use strict';var _=require(_0x4adc('0x0'));var util=require(_0x4adc('0x1'));var logger=require('../../config/logger')(_0x4adc('0x2'));var moment=require(_0x4adc('0x3'));var BPromise=require(_0x4adc('0x4'));var rp=require(_0x4adc('0x5'));var fs=require('fs');var path=require(_0x4adc('0x6'));var rimraf=require(_0x4adc('0x7'));var config=require(_0x4adc('0x8'));var attributes=require(_0x4adc('0x9'));module[_0x4adc('0xa')]=function(_0x396bbe,_0x56b207){return _0x396bbe['define']('ChatInternalMessage',attributes,{'tableName':_0x4adc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4adc('0xc'),'collate':_0x4adc('0xd')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 6a6eadc..3c7ddd6 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 _0xf3a6=['socket.io-emitter','./chatInternalMessage.socket','register','request','then','ChatInternalMessage,\x20%s,\x20%s','debug','request\x20sent','error','code','message','info','result','catch','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','localhost'];(function(_0x5caf82,_0x9591f7){var _0x5cf782=function(_0x1346ee){while(--_0x1346ee){_0x5caf82['push'](_0x5caf82['shift']());}};_0x5cf782(++_0x9591f7);}(_0xf3a6,0x1e9));var _0x6f3a=function(_0x151317,_0x3e6c29){_0x151317=_0x151317-0x0;var _0x50b025=_0xf3a6[_0x151317];return _0x50b025;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6f3a('0x0'));var fs=require('fs');var Redis=require(_0x6f3a('0x1'));var db=require(_0x6f3a('0x2'))['db'];var utils=require(_0x6f3a('0x3'));var logger=require(_0x6f3a('0x4'))(_0x6f3a('0x5'));var config=require(_0x6f3a('0x6'));var jayson=require(_0x6f3a('0x7'));var client=jayson[_0x6f3a('0x8')][_0x6f3a('0x9')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x6f3a('0xa'),'port':0x18eb});var socket=require(_0x6f3a('0xb'))(new Redis(config['redis']));require(_0x6f3a('0xc'))[_0x6f3a('0xd')](socket);function respondWithRpcPromise(_0x459d00,_0x26fa07,_0x9d9097){return new BPromise(function(_0x43d4cb,_0x4f455f){return client[_0x6f3a('0xe')](_0x459d00,_0x9d9097)[_0x6f3a('0xf')](function(_0x31be2e){logger['info'](_0x6f3a('0x10'),_0x26fa07,'request\x20sent');logger[_0x6f3a('0x11')]('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x26fa07,_0x6f3a('0x12'),JSON['stringify'](_0x31be2e));if(_0x31be2e['error']){if(_0x31be2e[_0x6f3a('0x13')][_0x6f3a('0x14')]===0x1f4){logger[_0x6f3a('0x13')](_0x6f3a('0x10'),_0x26fa07,_0x31be2e[_0x6f3a('0x13')][_0x6f3a('0x15')]);return _0x4f455f(_0x31be2e[_0x6f3a('0x13')]['message']);}logger['error'](_0x6f3a('0x10'),_0x26fa07,_0x31be2e['error']['message']);return _0x43d4cb(_0x31be2e[_0x6f3a('0x13')]['message']);}else{logger[_0x6f3a('0x16')](_0x6f3a('0x10'),_0x26fa07,_0x6f3a('0x12'));_0x43d4cb(_0x31be2e[_0x6f3a('0x17')]['message']);}})[_0x6f3a('0x18')](function(_0x55372f){logger[_0x6f3a('0x13')](_0x6f3a('0x10'),_0x26fa07,_0x55372f);_0x4f455f(_0x55372f);});});} \ No newline at end of file +var _0x4891=['ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ChatInternalMessage,\x20%s,\x20%s','result','catch','lodash','util','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','register','request','then','info','request\x20sent'];(function(_0x36016f,_0x2c389d){var _0x504656=function(_0x22bb15){while(--_0x22bb15){_0x36016f['push'](_0x36016f['shift']());}};_0x504656(++_0x2c389d);}(_0x4891,0x166));var _0x1489=function(_0x4d9863,_0x4a7666){_0x4d9863=_0x4d9863-0x0;var _0x4c6e64=_0x4891[_0x4d9863];return _0x4c6e64;};'use strict';var _=require(_0x1489('0x0'));var util=require(_0x1489('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1489('0x2'));var db=require(_0x1489('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x1489('0x4'))('rpc');var config=require(_0x1489('0x5'));var jayson=require(_0x1489('0x6'));var client=jayson[_0x1489('0x7')]['http']({'port':0x232a});config[_0x1489('0x8')]=_['defaults'](config[_0x1489('0x8')],{'host':_0x1489('0x9'),'port':0x18eb});var socket=require(_0x1489('0xa'))(new Redis(config[_0x1489('0x8')]));require(_0x1489('0xb'))[_0x1489('0xc')](socket);function respondWithRpcPromise(_0x109fea,_0x48805c,_0x550283){return new BPromise(function(_0x243644,_0x423118){return client[_0x1489('0xd')](_0x109fea,_0x550283)[_0x1489('0xe')](function(_0x321df5){logger[_0x1489('0xf')]('ChatInternalMessage,\x20%s,\x20%s',_0x48805c,_0x1489('0x10'));logger['debug'](_0x1489('0x11'),_0x48805c,_0x1489('0x10'),JSON[_0x1489('0x12')](_0x321df5));if(_0x321df5[_0x1489('0x13')]){if(_0x321df5[_0x1489('0x13')][_0x1489('0x14')]===0x1f4){logger[_0x1489('0x13')]('ChatInternalMessage,\x20%s,\x20%s',_0x48805c,_0x321df5['error'][_0x1489('0x15')]);return _0x423118(_0x321df5['error'][_0x1489('0x15')]);}logger[_0x1489('0x13')]('ChatInternalMessage,\x20%s,\x20%s',_0x48805c,_0x321df5[_0x1489('0x13')][_0x1489('0x15')]);return _0x243644(_0x321df5[_0x1489('0x13')][_0x1489('0x15')]);}else{logger[_0x1489('0xf')](_0x1489('0x16'),_0x48805c,'request\x20sent');_0x243644(_0x321df5[_0x1489('0x17')][_0x1489('0x15')]);}})[_0x1489('0x18')](function(_0x597b4f){logger[_0x1489('0x13')](_0x1489('0x16'),_0x48805c,_0x597b4f);_0x423118(_0x597b4f);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 6d8692b..353de52 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 _0xf146=['update','removeListener','register','chatInternalMessage:','save','remove'];(function(_0x4bc8e9,_0x4a2988){var _0x3d1715=function(_0x562260){while(--_0x562260){_0x4bc8e9['push'](_0x4bc8e9['shift']());}};_0x3d1715(++_0x4a2988);}(_0xf146,0x16c));var _0x6f14=function(_0x16b561,_0x5a914f){_0x16b561=_0x16b561-0x0;var _0x22599f=_0xf146[_0x16b561];return _0x22599f;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=[_0x6f14('0x0'),_0x6f14('0x1'),_0x6f14('0x2')];function createListener(_0x1e58d3,_0x27fb99){return function(_0x1ed930){_0x27fb99['emit'](_0x1e58d3,_0x1ed930);};}function removeListener(_0xcb7f99,_0x308607){return function(){ChatInternalMessageEvents[_0x6f14('0x3')](_0xcb7f99,_0x308607);};}exports[_0x6f14('0x4')]=function(_0x129fb6){for(var _0x47db59=0x0,_0x45cad5=events['length'];_0x47db59<_0x45cad5;_0x47db59++){var _0x1f452b=events[_0x47db59];var _0x16dd39=createListener(_0x6f14('0x5')+_0x1f452b,_0x129fb6);ChatInternalMessageEvents['on'](_0x1f452b,_0x16dd39);}}; \ No newline at end of file +var _0x3b4d=['remove','update','emit','removeListener'];(function(_0x54845b,_0x2357db){var _0x430c18=function(_0x214e41){while(--_0x214e41){_0x54845b['push'](_0x54845b['shift']());}};_0x430c18(++_0x2357db);}(_0x3b4d,0x9c));var _0xd3b4=function(_0x442dbf,_0x117087){_0x442dbf=_0x442dbf-0x0;var _0x294658=_0x3b4d[_0x442dbf];return _0x294658;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=['save',_0xd3b4('0x0'),_0xd3b4('0x1')];function createListener(_0x120ec8,_0x345560){return function(_0x35d8c8){_0x345560[_0xd3b4('0x2')](_0x120ec8,_0x35d8c8);};}function removeListener(_0x5221a8,_0x4d4d9a){return function(){ChatInternalMessageEvents[_0xd3b4('0x3')](_0x5221a8,_0x4d4d9a);};}exports['register']=function(_0x16c0aa){for(var _0x452275=0x0,_0x2f6bb4=events['length'];_0x452275<_0x2f6bb4;_0x452275++){var _0x400c6b=events[_0x452275];var _0x477346=createListener('chatInternalMessage:'+_0x400c6b,_0x16c0aa);ChatInternalMessageEvents['on'](_0x400c6b,_0x477346);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index cf3e6b3..00be6d4 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 _0xe0d5=['getUsers','/:id','post','put','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatInternalMessage.controller','isAuthenticated','index','get','/describe','describe','/users'];(function(_0x9c61e7,_0x24bf65){var _0x3bd528=function(_0x1fb475){while(--_0x1fb475){_0x9c61e7['push'](_0x9c61e7['shift']());}};_0x3bd528(++_0x24bf65);}(_0xe0d5,0xf9));var _0x5e0d=function(_0x24b58c,_0x370e45){_0x24b58c=_0x24b58c-0x0;var _0x5b2033=_0xe0d5[_0x24b58c];return _0x5b2033;};'use strict';var multer=require(_0x5e0d('0x0'));var util=require(_0x5e0d('0x1'));var path=require(_0x5e0d('0x2'));var timeout=require('connect-timeout');var express=require(_0x5e0d('0x3'));var router=express[_0x5e0d('0x4')]();var fs_extra=require(_0x5e0d('0x5'));var auth=require(_0x5e0d('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5e0d('0x7'));var controller=require(_0x5e0d('0x8'));router['get']('/',auth[_0x5e0d('0x9')](),controller[_0x5e0d('0xa')]);router[_0x5e0d('0xb')](_0x5e0d('0xc'),auth[_0x5e0d('0x9')](),controller[_0x5e0d('0xd')]);router[_0x5e0d('0xb')](_0x5e0d('0xe'),auth[_0x5e0d('0x9')](),controller[_0x5e0d('0xf')]);router[_0x5e0d('0xb')](_0x5e0d('0x10'),auth[_0x5e0d('0x9')](),controller['show']);router[_0x5e0d('0x11')]('/',auth[_0x5e0d('0x9')](),controller['create']);router[_0x5e0d('0x12')]('/:id',controller['update']);router[_0x5e0d('0x13')](_0x5e0d('0x10'),auth[_0x5e0d('0x9')](),controller[_0x5e0d('0x14')]);module[_0x5e0d('0x15')]=router; \ No newline at end of file +var _0xfce1=['delete','util','path','Router','../../components/auth/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','/describe','describe','getUsers','create','put','/:id','update'];(function(_0x207d2f,_0x44400f){var _0x3c3498=function(_0x57fdfb){while(--_0x57fdfb){_0x207d2f['push'](_0x207d2f['shift']());}};_0x3c3498(++_0x44400f);}(_0xfce1,0xf1));var _0x1fce=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xfce1[_0x126558];return _0x1f6d14;};'use strict';var multer=require('multer');var util=require(_0x1fce('0x0'));var path=require(_0x1fce('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1fce('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x1fce('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x1fce('0x4'));var controller=require(_0x1fce('0x5'));router[_0x1fce('0x6')]('/',auth[_0x1fce('0x7')](),controller['index']);router[_0x1fce('0x6')](_0x1fce('0x8'),auth[_0x1fce('0x7')](),controller[_0x1fce('0x9')]);router[_0x1fce('0x6')]('/users',auth[_0x1fce('0x7')](),controller[_0x1fce('0xa')]);router['get']('/:id',auth[_0x1fce('0x7')](),controller['show']);router['post']('/',auth[_0x1fce('0x7')](),controller[_0x1fce('0xb')]);router[_0x1fce('0xc')](_0x1fce('0xd'),controller[_0x1fce('0xe')]);router[_0x1fce('0xf')]('/:id',auth[_0x1fce('0x7')](),controller['destroy']);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 4ddf620..b01f37f 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 _0x352e=['exports','TEXT','medium','BOOLEAN','ENUM','out','DATE','STRING','sequelize'];(function(_0x5ab5dd,_0x5929f4){var _0x6892d2=function(_0x4b5426){while(--_0x4b5426){_0x5ab5dd['push'](_0x5ab5dd['shift']());}};_0x6892d2(++_0x5929f4);}(_0x352e,0x1a6));var _0xe352=function(_0x4a34ba,_0x424416){_0x4a34ba=_0x4a34ba-0x0;var _0x14ddb8=_0x352e[_0x4a34ba];return _0x14ddb8;};'use strict';var Sequelize=require(_0xe352('0x0'));module[_0xe352('0x1')]={'body':{'type':Sequelize[_0xe352('0x2')](_0xe352('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xe352('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0xe352('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xe352('0x5')]('in',_0xe352('0x6')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0xe352('0x7')]},'providerName':{'type':Sequelize[_0xe352('0x8')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xb84e=['DATE','STRING','exports','TEXT','medium','BOOLEAN','out'];(function(_0x28f12b,_0x3d0701){var _0x2f2375=function(_0x27a6b1){while(--_0x27a6b1){_0x28f12b['push'](_0x28f12b['shift']());}};_0x2f2375(++_0x3d0701);}(_0xb84e,0xbf));var _0xeb84=function(_0x38ce4c,_0xfdbe8c){_0x38ce4c=_0x38ce4c-0x0;var _0x5d4544=_0xb84e[_0x38ce4c];return _0x5d4544;};'use strict';var Sequelize=require('sequelize');module[_0xeb84('0x0')]={'body':{'type':Sequelize[_0xeb84('0x1')](_0xeb84('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xeb84('0x3')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xeb84('0x4')),'defaultValue':_0xeb84('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0xeb84('0x5')]},'providerName':{'type':Sequelize[_0xeb84('0x6')]},'providerResponse':{'type':Sequelize[_0xeb84('0x1')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 8692162..d423c70 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 _0x1e69=['map','ChatMessage','fieldName','type','query','keys','filters','intersection','attributes','model','fields','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','length','find','create','body','update','describe','chat-interactions','accept','chat','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','ChatInteraction','isNil','read1stAt','get','interaction','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','contact','User','fullname','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','parse','ChatInteractionId','null','RejectMessage','QueryTypes','SELECT','email','rejectmessage','formData','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','http','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','stack','name','send','index'];(function(_0x587ed5,_0x28ef15){var _0x663747=function(_0x152f8b){while(--_0x152f8b){_0x587ed5['push'](_0x587ed5['shift']());}};_0x663747(++_0x28ef15);}(_0x1e69,0x158));var _0x91e6=function(_0x158be2,_0x30a49c){_0x158be2=_0x158be2-0x0;var _0x306d18=_0x1e69[_0x158be2];return _0x306d18;};'use strict';var emlformat=require(_0x91e6('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x91e6('0x1'));var rp=require(_0x91e6('0x2'));var moment=require(_0x91e6('0x3'));var BPromise=require(_0x91e6('0x4'));var Mustache=require(_0x91e6('0x5'));var util=require(_0x91e6('0x6'));var path=require(_0x91e6('0x7'));var sox=require(_0x91e6('0x8'));var csv=require('to-csv');var ejs=require(_0x91e6('0x9'));var fs=require('fs');var fs_extra=require(_0x91e6('0xa'));var _=require(_0x91e6('0xb'));var squel=require(_0x91e6('0xc'));var crypto=require(_0x91e6('0xd'));var jsforce=require(_0x91e6('0xe'));var deskjs=require(_0x91e6('0xf'));var toCsv=require('to-csv');var querystring=require(_0x91e6('0x10'));var Papa=require('papaparse');var Redis=require(_0x91e6('0x11'));var authService=require(_0x91e6('0x12'));var qs=require(_0x91e6('0x13'));var as=require(_0x91e6('0x14'));var hardwareService=require(_0x91e6('0x15'));var logger=require(_0x91e6('0x16'))(_0x91e6('0x17'));var utils=require(_0x91e6('0x18'));var config=require(_0x91e6('0x19'));var licenseUtil=require(_0x91e6('0x1a'));var db=require(_0x91e6('0x1b'))['db'];config[_0x91e6('0x1c')]=_[_0x91e6('0x1d')](config[_0x91e6('0x1c')],{'host':_0x91e6('0x1e'),'port':0x18eb});var socket=require(_0x91e6('0x1f'))(new Redis(config[_0x91e6('0x1c')]));require(_0x91e6('0x20'))[_0x91e6('0x21')](socket);var jayson=require(_0x91e6('0x22'));var client=jayson[_0x91e6('0x23')]['http']({'port':0x232c});var client9002=jayson[_0x91e6('0x23')][_0x91e6('0x24')]({'port':0x232a});function respondWithRpcPromise(_0x54db81,_0x58beee,_0x23a201,_0xa39b77){return new BPromise(function(_0x4733e1,_0x4b5604){var _0x52b06b=_0xa39b77||client;return _0x52b06b[_0x91e6('0x25')](_0x54db81,_0x23a201)[_0x91e6('0x26')](function(_0x526f51){logger[_0x91e6('0x27')](_0x91e6('0x28'),_0x58beee,_0x91e6('0x29'));logger[_0x91e6('0x2a')](_0x91e6('0x2b'),_0x58beee,_0x91e6('0x29'),JSON[_0x91e6('0x2c')](_0x526f51));if(_0x526f51[_0x91e6('0x2d')]){if(_0x526f51[_0x91e6('0x2d')]['code']===0x1f4){logger[_0x91e6('0x2d')](_0x91e6('0x28'),_0x58beee,_0x526f51['error'][_0x91e6('0x2e')]);return _0x4b5604(_0x526f51['error'][_0x91e6('0x2e')]);}logger[_0x91e6('0x2d')](_0x91e6('0x28'),_0x58beee,_0x526f51[_0x91e6('0x2d')][_0x91e6('0x2e')]);return _0x4733e1(_0x526f51[_0x91e6('0x2d')]['message']);}else{logger[_0x91e6('0x27')](_0x91e6('0x28'),_0x58beee,'request\x20sent');_0x4733e1(_0x526f51[_0x91e6('0x2f')][_0x91e6('0x2e')]);}})[_0x91e6('0x30')](function(_0x9e8932){logger[_0x91e6('0x2d')](_0x91e6('0x28'),_0x58beee,_0x9e8932);_0x4b5604(_0x9e8932);});});}function respondWithStatusCode(_0x9cfda7,_0x1e3142){_0x1e3142=_0x1e3142||0xcc;return function(_0xfce653){if(_0xfce653){return _0x9cfda7[_0x91e6('0x31')](_0x1e3142);}return _0x9cfda7[_0x91e6('0x32')](_0x1e3142)[_0x91e6('0x33')]();};}function respondWithResult(_0x1110cd,_0x58f025){_0x58f025=_0x58f025||0xc8;return function(_0x23de00){if(_0x23de00){return _0x1110cd[_0x91e6('0x32')](_0x58f025)[_0x91e6('0x34')](_0x23de00);}};}function respondWithFilteredResult(_0x3427a3,_0x562058){return function(_0x4cd38f){if(_0x4cd38f){var _0xd4405d=typeof _0x562058[_0x91e6('0x35')]===_0x91e6('0x36')&&typeof _0x562058[_0x91e6('0x37')]===_0x91e6('0x36');var _0x3f620c=_0x4cd38f[_0x91e6('0x38')];var _0x27415e=_0xd4405d?0x0:_0x562058[_0x91e6('0x35')];var _0x1ced58=_0xd4405d?_0x4cd38f[_0x91e6('0x38')]:_0x562058[_0x91e6('0x35')]+_0x562058[_0x91e6('0x37')];var _0x4cda18;if(_0x1ced58>=_0x3f620c){_0x1ced58=_0x3f620c;_0x4cda18=0xc8;}else{_0x4cda18=0xce;}_0x3427a3[_0x91e6('0x32')](_0x4cda18);return _0x3427a3[_0x91e6('0x39')](_0x91e6('0x3a'),_0x27415e+'-'+_0x1ced58+'/'+_0x3f620c)[_0x91e6('0x34')](_0x4cd38f);}return null;};}function patchUpdates(_0x29066f){return function(_0x3f4a55){try{jsonpatch[_0x91e6('0x3b')](_0x3f4a55,_0x29066f,!![]);}catch(_0xa25753){return BPromise[_0x91e6('0x3c')](_0xa25753);}return _0x3f4a55[_0x91e6('0x3d')]();};}function saveUpdates(_0x1ba84e,_0x5de434){return function(_0x212a83){if(_0x212a83){return _0x212a83['update'](_0x1ba84e)[_0x91e6('0x26')](function(_0x5f3a6e){return _0x5f3a6e;});}return null;};}function removeEntity(_0x191517,_0x33b15c){return function(_0x19aaf3){if(_0x19aaf3){return _0x19aaf3[_0x91e6('0x3e')]()[_0x91e6('0x26')](function(){_0x191517[_0x91e6('0x32')](0xcc)['end']();});}};}function handleEntityNotFound(_0x15955b,_0x41aa7e){return function(_0x5580e5){if(!_0x5580e5){_0x15955b[_0x91e6('0x31')](0x194);}return _0x5580e5;};}function handleError(_0x42451f,_0x5d4f08){_0x5d4f08=_0x5d4f08||0x1f4;return function(_0x31bbc4){logger[_0x91e6('0x2d')](_0x31bbc4[_0x91e6('0x3f')]);if(_0x31bbc4[_0x91e6('0x40')]){delete _0x31bbc4[_0x91e6('0x40')];}_0x42451f['status'](_0x5d4f08)[_0x91e6('0x41')](_0x31bbc4);};}exports[_0x91e6('0x42')]=function(_0x32c38b,_0x35d978){var _0x5287f6={},_0x29bdb0={},_0x4a544a={'count':0x0,'rows':[]};var _0x1ee774=_[_0x91e6('0x43')](db[_0x91e6('0x44')]['rawAttributes'],function(_0x22aee7){return{'name':_0x22aee7[_0x91e6('0x45')],'type':_0x22aee7[_0x91e6('0x46')]['key']};});_0x29bdb0['model']=_[_0x91e6('0x43')](_0x1ee774,_0x91e6('0x40'));_0x29bdb0[_0x91e6('0x47')]=_[_0x91e6('0x48')](_0x32c38b[_0x91e6('0x47')]);_0x29bdb0[_0x91e6('0x49')]=_[_0x91e6('0x4a')](_0x29bdb0['model'],_0x29bdb0[_0x91e6('0x47')]);_0x5287f6[_0x91e6('0x4b')]=_[_0x91e6('0x4a')](_0x29bdb0[_0x91e6('0x4c')],qs[_0x91e6('0x4d')](_0x32c38b[_0x91e6('0x47')][_0x91e6('0x4d')]));_0x5287f6[_0x91e6('0x4b')]=_0x5287f6[_0x91e6('0x4b')]['length']?_0x5287f6[_0x91e6('0x4b')]:_0x29bdb0[_0x91e6('0x4c')];if(!_0x32c38b['query']['hasOwnProperty']('nolimit')){_0x5287f6[_0x91e6('0x37')]=qs[_0x91e6('0x37')](_0x32c38b['query']['limit']);_0x5287f6[_0x91e6('0x35')]=qs['offset'](_0x32c38b[_0x91e6('0x47')][_0x91e6('0x35')]);}_0x5287f6[_0x91e6('0x4e')]=qs[_0x91e6('0x4f')](_0x32c38b[_0x91e6('0x47')][_0x91e6('0x4f')]);_0x5287f6[_0x91e6('0x50')]=qs['filters'](_['pick'](_0x32c38b[_0x91e6('0x47')],_0x29bdb0['filters']),_0x1ee774);if(_0x32c38b[_0x91e6('0x47')][_0x91e6('0x51')]){_0x5287f6['where']=_[_0x91e6('0x52')](_0x5287f6['where'],{'$or':_['map'](_0x1ee774,function(_0x30e7){if(_0x30e7[_0x91e6('0x46')]!==_0x91e6('0x53')){var _0x21a971={};_0x21a971[_0x30e7[_0x91e6('0x40')]]={'$like':'%'+_0x32c38b[_0x91e6('0x47')][_0x91e6('0x51')]+'%'};return _0x21a971;}})});}_0x5287f6=_['merge']({},_0x5287f6,_0x32c38b[_0x91e6('0x54')]);var _0x25f0c1={'where':_0x5287f6[_0x91e6('0x50')]};return db['ChatMessage'][_0x91e6('0x38')](_0x25f0c1)[_0x91e6('0x26')](function(_0x354989){_0x4a544a[_0x91e6('0x38')]=_0x354989;if(_0x32c38b[_0x91e6('0x47')][_0x91e6('0x55')]){_0x5287f6[_0x91e6('0x56')]=[{'all':!![]}];}return db['ChatMessage'][_0x91e6('0x57')](_0x5287f6);})['then'](function(_0x2ccf1c){_0x4a544a[_0x91e6('0x58')]=_0x2ccf1c;return _0x4a544a;})[_0x91e6('0x26')](respondWithFilteredResult(_0x35d978,_0x5287f6))[_0x91e6('0x30')](handleError(_0x35d978,null));};exports[_0x91e6('0x59')]=function(_0x2c9bb5,_0x895be6){var _0x25c2bc={'raw':!![],'where':{'id':_0x2c9bb5[_0x91e6('0x5a')]['id']}},_0x5a7d74={};_0x5a7d74[_0x91e6('0x4c')]=_[_0x91e6('0x48')](db[_0x91e6('0x44')]['rawAttributes']);_0x5a7d74[_0x91e6('0x47')]=_[_0x91e6('0x48')](_0x2c9bb5[_0x91e6('0x47')]);_0x5a7d74[_0x91e6('0x49')]=_[_0x91e6('0x4a')](_0x5a7d74[_0x91e6('0x4c')],_0x5a7d74[_0x91e6('0x47')]);_0x25c2bc[_0x91e6('0x4b')]=_[_0x91e6('0x4a')](_0x5a7d74['model'],qs['fields'](_0x2c9bb5[_0x91e6('0x47')][_0x91e6('0x4d')]));_0x25c2bc[_0x91e6('0x4b')]=_0x25c2bc['attributes'][_0x91e6('0x5b')]?_0x25c2bc[_0x91e6('0x4b')]:_0x5a7d74[_0x91e6('0x4c')];if(_0x2c9bb5[_0x91e6('0x47')]['includeAll']){_0x25c2bc[_0x91e6('0x56')]=[{'all':!![]}];}_0x25c2bc=_[_0x91e6('0x52')]({},_0x25c2bc,_0x2c9bb5[_0x91e6('0x54')]);return db[_0x91e6('0x44')][_0x91e6('0x5c')](_0x25c2bc)[_0x91e6('0x26')](handleEntityNotFound(_0x895be6,null))[_0x91e6('0x26')](respondWithResult(_0x895be6,null))[_0x91e6('0x30')](handleError(_0x895be6,null));};exports[_0x91e6('0x5d')]=function(_0x2f1695,_0x3dee1f){return db['ChatMessage']['create'](_0x2f1695[_0x91e6('0x5e')],{})['then'](respondWithResult(_0x3dee1f,0xc9))[_0x91e6('0x30')](handleError(_0x3dee1f,null));};exports[_0x91e6('0x5f')]=function(_0x1df99c,_0x3ff3d5){if(_0x1df99c[_0x91e6('0x5e')]['id']){delete _0x1df99c['body']['id'];}return db[_0x91e6('0x44')][_0x91e6('0x5c')]({'where':{'id':_0x1df99c[_0x91e6('0x5a')]['id']}})[_0x91e6('0x26')](handleEntityNotFound(_0x3ff3d5,null))[_0x91e6('0x26')](saveUpdates(_0x1df99c[_0x91e6('0x5e')],null))['then'](respondWithResult(_0x3ff3d5,null))[_0x91e6('0x30')](handleError(_0x3ff3d5,null));};exports['destroy']=function(_0x3141c8,_0x760def){return db[_0x91e6('0x44')][_0x91e6('0x5c')]({'where':{'id':_0x3141c8['params']['id']}})['then'](handleEntityNotFound(_0x760def,null))['then'](removeEntity(_0x760def,null))[_0x91e6('0x30')](handleError(_0x760def,null));};exports[_0x91e6('0x60')]=function(_0x12d0f8,_0x330ee5){return db['ChatMessage'][_0x91e6('0x60')]()[_0x91e6('0x26')](respondWithResult(_0x330ee5,null))[_0x91e6('0x30')](handleError(_0x330ee5,null));};var interaction_log=require(_0x91e6('0x16'))(_0x91e6('0x61'));exports[_0x91e6('0x62')]=function(_0x5c9775,_0x3aacc5,_0x68d2cc){var _0x45389c={'agent':{},'channel':_0x91e6('0x63')};if(_0x5c9775[_0x91e6('0x5e')]['id']){delete _0x5c9775['body']['id'];}_0x5c9775[_0x91e6('0x5e')]['read']=!![];_0x5c9775[_0x91e6('0x5e')][_0x91e6('0x64')]=moment()[_0x91e6('0x65')](_0x91e6('0x66'));_0x5c9775['body'][_0x91e6('0x67')]=_0x5c9775[_0x91e6('0x5e')]['UserId']||_0x5c9775[_0x91e6('0x68')]['id'];_0x45389c[_0x91e6('0x69')]['id']=_0x5c9775[_0x91e6('0x5e')]['UserId'];return db[_0x91e6('0x44')][_0x91e6('0x5c')]({'where':{'id':_0x5c9775['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3aacc5,null))[_0x91e6('0x26')](saveUpdates(_0x5c9775[_0x91e6('0x5e')],null))['then'](function(_0x33c237){if(_0x33c237){_0x45389c[_0x91e6('0x2e')]=_0x33c237['get']({'plain':!![]});return db[_0x91e6('0x6a')]['find']({'where':{'id':_0x33c237['ChatInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x3aacc5,null))[_0x91e6('0x26')](function(_0x16feb6){if(_0x16feb6){return _0x16feb6[_0x91e6('0x5f')]({'UserId':_0x5c9775[_0x91e6('0x5e')]['UserId'],'read1stAt':_[_0x91e6('0x6b')](_0x16feb6[_0x91e6('0x6c')])?moment()[_0x91e6('0x65')](_0x91e6('0x66')):undefined});}return null;})[_0x91e6('0x26')](function(_0x6b8a87){if(_0x6b8a87){_0x45389c['interaction']=_0x6b8a87[_0x91e6('0x6d')]({'plain':!![]});interaction_log[_0x91e6('0x27')]('[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x5c9775[_0x91e6('0x68')]['id'],_0x5c9775['user'][_0x91e6('0x40')],_0x5c9775[_0x91e6('0x68')]['role'],_0x45389c[_0x91e6('0x6e')]['id'],_0x5c9775['body']?JSON['stringify'](_0x5c9775[_0x91e6('0x5e')]):'null');return respondWithRpcPromise(_0x91e6('0x6f'),_0x91e6('0x70'),_0x45389c);}return null;})['then'](function(_0x35e4b7){var _0x1e2816=_0x91e6('0x71')+_0x35e4b7['message'][_0x91e6('0x72')];return db[_0x91e6('0x73')]['query'](_0x1e2816,{'type':db[_0x91e6('0x74')]['QueryTypes']['SELECT'],'raw':!![]})[_0x91e6('0x26')](function(_0x987541){return _0x987541;});})[_0x91e6('0x26')](function(_0x1f0bd4){if(_0x1f0bd4){_0x45389c[_0x91e6('0x2e')][_0x91e6('0x75')]=_0x1f0bd4[0x0];if(!_0x5c9775[_0x91e6('0x5e')][_0x91e6('0x67')])return;return db[_0x91e6('0x76')][_0x91e6('0x5c')]({'where':{'id':_0x5c9775[_0x91e6('0x5e')][_0x91e6('0x67')],'role':_0x91e6('0x69')},'attributes':['id',_0x91e6('0x40'),_0x91e6('0x77'),'email',_0x91e6('0x78')],'raw':!![]});}return null;})[_0x91e6('0x26')](function(_0x27d125){if(!_0x27d125)return null;_0x45389c[_0x91e6('0x2e')][_0x91e6('0x69')]=_0x27d125;return _0x45389c;})[_0x91e6('0x26')](function(_0x542732){if(_0x542732){if(_0x5c9775[_0x91e6('0x5e')][_0x91e6('0x79')]){_0x45389c[_0x91e6('0x2e')][_0x91e6('0x7a')]=util[_0x91e6('0x65')](_0x91e6('0x7b'),_0x5c9775['user']['name']);_0x45389c['message'][_0x91e6('0x7c')]=_0x45389c[_0x91e6('0x7c')];_0x45389c['message'][_0x91e6('0x7d')]=_0x45389c[_0x91e6('0x7c')];_0x45389c[_0x91e6('0x2e')][_0x91e6('0x7e')]=_0x91e6('0x62');return respondWithRpcPromise(_0x91e6('0x7f'),'EventManager',{'event':'acceptmessage','message':_[_0x91e6('0x52')](_0x45389c[_0x91e6('0x2e')],JSON[_0x91e6('0x80')](_0x45389c[_0x91e6('0x6e')]['formData']))},client9002)[_0x91e6('0x26')](function(){return _0x45389c;});}return _0x45389c;}return null;})[_0x91e6('0x26')](respondWithResult(_0x3aacc5,null))[_0x91e6('0x30')](handleError(_0x3aacc5,null));};var interaction_log=require(_0x91e6('0x16'))('chat-interactions');exports[_0x91e6('0x3c')]=function(_0x1011a8,_0xf2a270,_0x245867){var _0x5c704a={'agent':{},'channel':_0x91e6('0x63')};if(_0x1011a8[_0x91e6('0x5e')]['id']){delete _0x1011a8['body']['id'];}_0x1011a8[_0x91e6('0x5e')]['UserId']=_0x1011a8[_0x91e6('0x5e')][_0x91e6('0x67')]||_0x1011a8[_0x91e6('0x68')]['id'];_0x5c704a[_0x91e6('0x69')]['id']=_0x1011a8[_0x91e6('0x5e')][_0x91e6('0x67')];return db[_0x91e6('0x44')]['find']({'where':{'id':_0x1011a8[_0x91e6('0x5a')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0xf2a270,null))[_0x91e6('0x26')](function(_0x5d4a99){if(_0x5d4a99){_0x5c704a[_0x91e6('0x2e')]=_0x5d4a99['get']({'plain':!![]});return db['ChatInteraction']['find']({'where':{'id':_0x5d4a99[_0x91e6('0x81')]}});}return null;})[_0x91e6('0x26')](handleEntityNotFound(_0xf2a270,null))['then'](function(_0x366a19){if(_0x366a19){_0x5c704a[_0x91e6('0x6e')]=_0x366a19['get']({'plain':!![]});interaction_log[_0x91e6('0x27')]('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1011a8['user']['id'],_0x1011a8[_0x91e6('0x68')]['name'],_0x1011a8[_0x91e6('0x68')]['role'],_0x5c704a[_0x91e6('0x6e')]['id'],_0x1011a8['body']?JSON[_0x91e6('0x2c')](_0x1011a8[_0x91e6('0x5e')]):_0x91e6('0x82'));return respondWithRpcPromise(_0x91e6('0x83'),'rejectMessage',_0x5c704a);}return null;})[_0x91e6('0x26')](function(_0x2d2ec7){var _0x2e598e='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x2d2ec7[_0x91e6('0x2e')]['ContactId'];return db[_0x91e6('0x73')][_0x91e6('0x47')](_0x2e598e,{'type':db[_0x91e6('0x74')][_0x91e6('0x84')][_0x91e6('0x85')],'raw':!![]})['then'](function(_0x596c34){return _0x596c34;});})[_0x91e6('0x26')](function(_0x1dcd98){if(_0x1dcd98){_0x5c704a[_0x91e6('0x2e')][_0x91e6('0x75')]=_0x1dcd98[0x0];if(!_0x1011a8[_0x91e6('0x5e')][_0x91e6('0x67')])return;return db['User'][_0x91e6('0x5c')]({'where':{'id':_0x1011a8['body']['UserId'],'role':_0x91e6('0x69')},'attributes':['id','name','fullname',_0x91e6('0x86'),_0x91e6('0x78')],'raw':!![]});}return null;})[_0x91e6('0x26')](function(_0xca9353){if(!_0xca9353)return null;_0x5c704a[_0x91e6('0x2e')][_0x91e6('0x69')]=_0xca9353;return _0x5c704a;})['then'](function(_0x145035){if(_0x145035){_0x145035[_0x91e6('0x2e')][_0x91e6('0x7a')]=util[_0x91e6('0x65')](_0x91e6('0x7b'),_0x1011a8['user'][_0x91e6('0x40')]);_0x145035[_0x91e6('0x2e')][_0x91e6('0x7c')]=_0x5c704a[_0x91e6('0x7c')];_0x145035['message'][_0x91e6('0x7d')]=_0x5c704a[_0x91e6('0x7c')];_0x145035[_0x91e6('0x2e')][_0x91e6('0x7e')]='reject';respondWithRpcPromise('EventManager',_0x91e6('0x7f'),{'event':_0x91e6('0x87'),'message':_['merge'](_0x5c704a[_0x91e6('0x2e')],JSON[_0x91e6('0x80')](_0x5c704a['interaction'][_0x91e6('0x88')]))},client9002);return _0x5c704a;}return null;})[_0x91e6('0x26')](respondWithResult(_0xf2a270,null))['catch'](handleError(_0xf2a270,null));}; \ No newline at end of file +var _0x890a=['ChatMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','offset','undefined','limit','set','Content-Range','json','apply','reject','save','update','destroy','stack','name','send','index','map','ChatMessage','fieldName','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','count','include','findAll','rows','show','params','rawAttributes','includeAll','find','create','body','describe','chat-interactions','chat','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','ChatInteraction','ChatInteractionId','isNil','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','interface','channel','motionChannel','event','accept','EventManager','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','SIP/%s','rejectmessage','formData','eml-format','rimraf','zip-dir','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','request','then','info','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x229f6f,_0x22674e){var _0x9c3565=function(_0x435499){while(--_0x435499){_0x229f6f['push'](_0x229f6f['shift']());}};_0x9c3565(++_0x22674e);}(_0x890a,0xe8));var _0xa890=function(_0x391e33,_0x448af9){_0x391e33=_0x391e33-0x0;var _0x5cdf62=_0x890a[_0x391e33];return _0x5cdf62;};'use strict';var emlformat=require(_0xa890('0x0'));var rimraf=require(_0xa890('0x1'));var zipdir=require(_0xa890('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa890('0x3'));var moment=require(_0xa890('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa890('0x5'));var path=require(_0xa890('0x6'));var sox=require(_0xa890('0x7'));var csv=require(_0xa890('0x8'));var ejs=require(_0xa890('0x9'));var fs=require('fs');var fs_extra=require(_0xa890('0xa'));var _=require(_0xa890('0xb'));var squel=require('squel');var crypto=require(_0xa890('0xc'));var jsforce=require(_0xa890('0xd'));var deskjs=require(_0xa890('0xe'));var toCsv=require('to-csv');var querystring=require(_0xa890('0xf'));var Papa=require(_0xa890('0x10'));var Redis=require(_0xa890('0x11'));var authService=require(_0xa890('0x12'));var qs=require(_0xa890('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa890('0x14'))(_0xa890('0x15'));var utils=require(_0xa890('0x16'));var config=require(_0xa890('0x17'));var licenseUtil=require(_0xa890('0x18'));var db=require(_0xa890('0x19'))['db'];config[_0xa890('0x1a')]=_[_0xa890('0x1b')](config['redis'],{'host':_0xa890('0x1c'),'port':0x18eb});var socket=require(_0xa890('0x1d'))(new Redis(config[_0xa890('0x1a')]));require('./chatMessage.socket')[_0xa890('0x1e')](socket);var jayson=require(_0xa890('0x1f'));var client=jayson[_0xa890('0x20')]['http']({'port':0x232c});var client9002=jayson[_0xa890('0x20')]['http']({'port':0x232a});function respondWithRpcPromise(_0x18e69b,_0x17b383,_0x359c67,_0x260682){return new BPromise(function(_0x4c8000,_0x163c58){var _0xe965fb=_0x260682||client;return _0xe965fb[_0xa890('0x21')](_0x18e69b,_0x359c67)[_0xa890('0x22')](function(_0x48b057){logger[_0xa890('0x23')]('ChatMessage,\x20%s,\x20%s',_0x17b383,_0xa890('0x24'));logger[_0xa890('0x25')](_0xa890('0x26'),_0x17b383,'request\x20sent',JSON[_0xa890('0x27')](_0x48b057));if(_0x48b057[_0xa890('0x28')]){if(_0x48b057[_0xa890('0x28')][_0xa890('0x29')]===0x1f4){logger[_0xa890('0x28')](_0xa890('0x2a'),_0x17b383,_0x48b057[_0xa890('0x28')][_0xa890('0x2b')]);return _0x163c58(_0x48b057[_0xa890('0x28')]['message']);}logger[_0xa890('0x28')](_0xa890('0x2a'),_0x17b383,_0x48b057[_0xa890('0x28')][_0xa890('0x2b')]);return _0x4c8000(_0x48b057[_0xa890('0x28')][_0xa890('0x2b')]);}else{logger[_0xa890('0x23')](_0xa890('0x2a'),_0x17b383,_0xa890('0x24'));_0x4c8000(_0x48b057[_0xa890('0x2c')]['message']);}})[_0xa890('0x2d')](function(_0x19c466){logger[_0xa890('0x28')](_0xa890('0x2a'),_0x17b383,_0x19c466);_0x163c58(_0x19c466);});});}function respondWithStatusCode(_0xc13efe,_0x12b18c){_0x12b18c=_0x12b18c||0xcc;return function(_0xedd4c7){if(_0xedd4c7){return _0xc13efe[_0xa890('0x2e')](_0x12b18c);}return _0xc13efe[_0xa890('0x2f')](_0x12b18c)[_0xa890('0x30')]();};}function respondWithResult(_0x4baa35,_0xee9d29){_0xee9d29=_0xee9d29||0xc8;return function(_0x156c01){if(_0x156c01){return _0x4baa35[_0xa890('0x2f')](_0xee9d29)['json'](_0x156c01);}};}function respondWithFilteredResult(_0x2a1ffe,_0x5e1968){return function(_0x3e7cde){if(_0x3e7cde){var _0x219db4=typeof _0x5e1968[_0xa890('0x31')]===_0xa890('0x32')&&typeof _0x5e1968[_0xa890('0x33')]===_0xa890('0x32');var _0x3698a8=_0x3e7cde['count'];var _0x553da2=_0x219db4?0x0:_0x5e1968['offset'];var _0x8d9f48=_0x219db4?_0x3e7cde['count']:_0x5e1968[_0xa890('0x31')]+_0x5e1968[_0xa890('0x33')];var _0x307cd1;if(_0x8d9f48>=_0x3698a8){_0x8d9f48=_0x3698a8;_0x307cd1=0xc8;}else{_0x307cd1=0xce;}_0x2a1ffe[_0xa890('0x2f')](_0x307cd1);return _0x2a1ffe[_0xa890('0x34')](_0xa890('0x35'),_0x553da2+'-'+_0x8d9f48+'/'+_0x3698a8)[_0xa890('0x36')](_0x3e7cde);}return null;};}function patchUpdates(_0x2c80ee){return function(_0x5e2794){try{jsonpatch[_0xa890('0x37')](_0x5e2794,_0x2c80ee,!![]);}catch(_0x76c444){return BPromise[_0xa890('0x38')](_0x76c444);}return _0x5e2794[_0xa890('0x39')]();};}function saveUpdates(_0x765fde,_0x35628d){return function(_0x361b73){if(_0x361b73){return _0x361b73[_0xa890('0x3a')](_0x765fde)[_0xa890('0x22')](function(_0x295086){return _0x295086;});}return null;};}function removeEntity(_0x92711,_0x5b18b8){return function(_0x106f0d){if(_0x106f0d){return _0x106f0d[_0xa890('0x3b')]()['then'](function(){_0x92711['status'](0xcc)[_0xa890('0x30')]();});}};}function handleEntityNotFound(_0x471816,_0xe3eac3){return function(_0x4d1d74){if(!_0x4d1d74){_0x471816[_0xa890('0x2e')](0x194);}return _0x4d1d74;};}function handleError(_0x2969cb,_0x121b37){_0x121b37=_0x121b37||0x1f4;return function(_0x4903a8){logger[_0xa890('0x28')](_0x4903a8[_0xa890('0x3c')]);if(_0x4903a8[_0xa890('0x3d')]){delete _0x4903a8[_0xa890('0x3d')];}_0x2969cb[_0xa890('0x2f')](_0x121b37)[_0xa890('0x3e')](_0x4903a8);};}exports[_0xa890('0x3f')]=function(_0x159ef6,_0x10456d){var _0x111a51={},_0x3ab943={},_0x84d081={'count':0x0,'rows':[]};var _0x9e946f=_[_0xa890('0x40')](db[_0xa890('0x41')]['rawAttributes'],function(_0x26b526){return{'name':_0x26b526[_0xa890('0x42')],'type':_0x26b526['type']['key']};});_0x3ab943[_0xa890('0x43')]=_[_0xa890('0x40')](_0x9e946f,'name');_0x3ab943[_0xa890('0x44')]=_[_0xa890('0x45')](_0x159ef6[_0xa890('0x44')]);_0x3ab943[_0xa890('0x46')]=_['intersection'](_0x3ab943[_0xa890('0x43')],_0x3ab943['query']);_0x111a51['attributes']=_[_0xa890('0x47')](_0x3ab943[_0xa890('0x43')],qs['fields'](_0x159ef6[_0xa890('0x44')][_0xa890('0x48')]));_0x111a51[_0xa890('0x49')]=_0x111a51['attributes']['length']?_0x111a51[_0xa890('0x49')]:_0x3ab943[_0xa890('0x43')];if(!_0x159ef6['query'][_0xa890('0x4a')](_0xa890('0x4b'))){_0x111a51[_0xa890('0x33')]=qs[_0xa890('0x33')](_0x159ef6['query']['limit']);_0x111a51['offset']=qs[_0xa890('0x31')](_0x159ef6['query'][_0xa890('0x31')]);}_0x111a51[_0xa890('0x4c')]=qs[_0xa890('0x4d')](_0x159ef6[_0xa890('0x44')]['sort']);_0x111a51[_0xa890('0x4e')]=qs[_0xa890('0x46')](_[_0xa890('0x4f')](_0x159ef6[_0xa890('0x44')],_0x3ab943[_0xa890('0x46')]),_0x9e946f);if(_0x159ef6[_0xa890('0x44')][_0xa890('0x50')]){_0x111a51[_0xa890('0x4e')]=_['merge'](_0x111a51[_0xa890('0x4e')],{'$or':_[_0xa890('0x40')](_0x9e946f,function(_0x461cec){if(_0x461cec['type']!==_0xa890('0x51')){var _0x432049={};_0x432049[_0x461cec['name']]={'$like':'%'+_0x159ef6[_0xa890('0x44')]['filter']+'%'};return _0x432049;}})});}_0x111a51=_[_0xa890('0x52')]({},_0x111a51,_0x159ef6[_0xa890('0x53')]);var _0x2ab6b3={'where':_0x111a51['where']};return db['ChatMessage']['count'](_0x2ab6b3)[_0xa890('0x22')](function(_0x108bcb){_0x84d081[_0xa890('0x54')]=_0x108bcb;if(_0x159ef6[_0xa890('0x44')]['includeAll']){_0x111a51[_0xa890('0x55')]=[{'all':!![]}];}return db[_0xa890('0x41')][_0xa890('0x56')](_0x111a51);})[_0xa890('0x22')](function(_0xb3a8ee){_0x84d081[_0xa890('0x57')]=_0xb3a8ee;return _0x84d081;})[_0xa890('0x22')](respondWithFilteredResult(_0x10456d,_0x111a51))[_0xa890('0x2d')](handleError(_0x10456d,null));};exports[_0xa890('0x58')]=function(_0x4021e3,_0x3b0905){var _0x4ebec6={'raw':!![],'where':{'id':_0x4021e3[_0xa890('0x59')]['id']}},_0x3ffffa={};_0x3ffffa['model']=_[_0xa890('0x45')](db[_0xa890('0x41')][_0xa890('0x5a')]);_0x3ffffa[_0xa890('0x44')]=_[_0xa890('0x45')](_0x4021e3[_0xa890('0x44')]);_0x3ffffa['filters']=_[_0xa890('0x47')](_0x3ffffa[_0xa890('0x43')],_0x3ffffa[_0xa890('0x44')]);_0x4ebec6['attributes']=_[_0xa890('0x47')](_0x3ffffa[_0xa890('0x43')],qs[_0xa890('0x48')](_0x4021e3[_0xa890('0x44')][_0xa890('0x48')]));_0x4ebec6[_0xa890('0x49')]=_0x4ebec6[_0xa890('0x49')]['length']?_0x4ebec6[_0xa890('0x49')]:_0x3ffffa[_0xa890('0x43')];if(_0x4021e3[_0xa890('0x44')][_0xa890('0x5b')]){_0x4ebec6[_0xa890('0x55')]=[{'all':!![]}];}_0x4ebec6=_[_0xa890('0x52')]({},_0x4ebec6,_0x4021e3[_0xa890('0x53')]);return db[_0xa890('0x41')][_0xa890('0x5c')](_0x4ebec6)[_0xa890('0x22')](handleEntityNotFound(_0x3b0905,null))[_0xa890('0x22')](respondWithResult(_0x3b0905,null))[_0xa890('0x2d')](handleError(_0x3b0905,null));};exports['create']=function(_0x418406,_0x25c0ac){return db[_0xa890('0x41')][_0xa890('0x5d')](_0x418406['body'],{})[_0xa890('0x22')](respondWithResult(_0x25c0ac,0xc9))['catch'](handleError(_0x25c0ac,null));};exports['update']=function(_0x454faf,_0x2402a1){if(_0x454faf[_0xa890('0x5e')]['id']){delete _0x454faf[_0xa890('0x5e')]['id'];}return db['ChatMessage'][_0xa890('0x5c')]({'where':{'id':_0x454faf[_0xa890('0x59')]['id']}})['then'](handleEntityNotFound(_0x2402a1,null))[_0xa890('0x22')](saveUpdates(_0x454faf[_0xa890('0x5e')],null))[_0xa890('0x22')](respondWithResult(_0x2402a1,null))[_0xa890('0x2d')](handleError(_0x2402a1,null));};exports[_0xa890('0x3b')]=function(_0x4ca066,_0x43ca88){return db[_0xa890('0x41')]['find']({'where':{'id':_0x4ca066[_0xa890('0x59')]['id']}})[_0xa890('0x22')](handleEntityNotFound(_0x43ca88,null))[_0xa890('0x22')](removeEntity(_0x43ca88,null))['catch'](handleError(_0x43ca88,null));};exports[_0xa890('0x5f')]=function(_0x25a78b,_0xde87ae){return db[_0xa890('0x41')][_0xa890('0x5f')]()['then'](respondWithResult(_0xde87ae,null))[_0xa890('0x2d')](handleError(_0xde87ae,null));};var interaction_log=require(_0xa890('0x14'))(_0xa890('0x60'));exports['accept']=function(_0x3b5b70,_0x1a7984,_0x3b8933){var _0x5775a8={'agent':{},'channel':_0xa890('0x61')};if(_0x3b5b70['body']['id']){delete _0x3b5b70[_0xa890('0x5e')]['id'];}_0x3b5b70['body'][_0xa890('0x62')]=!![];_0x3b5b70[_0xa890('0x5e')]['readAt']=moment()[_0xa890('0x63')](_0xa890('0x64'));_0x3b5b70[_0xa890('0x5e')][_0xa890('0x65')]=_0x3b5b70[_0xa890('0x5e')][_0xa890('0x65')]||_0x3b5b70[_0xa890('0x66')]['id'];_0x5775a8[_0xa890('0x67')]['id']=_0x3b5b70[_0xa890('0x5e')][_0xa890('0x65')];return db[_0xa890('0x41')]['find']({'where':{'id':_0x3b5b70['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x1a7984,null))[_0xa890('0x22')](saveUpdates(_0x3b5b70[_0xa890('0x5e')],null))[_0xa890('0x22')](function(_0xde5d07){if(_0xde5d07){_0x5775a8['message']=_0xde5d07[_0xa890('0x68')]({'plain':!![]});return db[_0xa890('0x69')][_0xa890('0x5c')]({'where':{'id':_0xde5d07[_0xa890('0x6a')]}});}return null;})[_0xa890('0x22')](handleEntityNotFound(_0x1a7984,null))[_0xa890('0x22')](function(_0x1611fa){if(_0x1611fa){return _0x1611fa[_0xa890('0x3a')]({'UserId':_0x3b5b70['body'][_0xa890('0x65')],'read1stAt':_[_0xa890('0x6b')](_0x1611fa['read1stAt'])?moment()[_0xa890('0x63')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xa890('0x22')](function(_0x4b3022){if(_0x4b3022){_0x5775a8[_0xa890('0x6c')]=_0x4b3022[_0xa890('0x68')]({'plain':!![]});interaction_log['info'](_0xa890('0x6d'),_0x3b5b70['user']['id'],_0x3b5b70[_0xa890('0x66')][_0xa890('0x3d')],_0x3b5b70[_0xa890('0x66')][_0xa890('0x6e')],_0x5775a8[_0xa890('0x6c')]['id'],_0x3b5b70[_0xa890('0x5e')]?JSON[_0xa890('0x27')](_0x3b5b70[_0xa890('0x5e')]):_0xa890('0x6f'));return respondWithRpcPromise(_0xa890('0x70'),_0xa890('0x71'),_0x5775a8);}return null;})['then'](function(_0x46e83c){var _0x577a04=_0xa890('0x72')+_0x46e83c[_0xa890('0x2b')][_0xa890('0x73')];return db[_0xa890('0x74')][_0xa890('0x44')](_0x577a04,{'type':db[_0xa890('0x75')][_0xa890('0x76')][_0xa890('0x77')],'raw':!![]})[_0xa890('0x22')](function(_0x3287c9){return _0x3287c9;});})[_0xa890('0x22')](function(_0x48e82b){if(_0x48e82b){_0x5775a8[_0xa890('0x2b')][_0xa890('0x78')]=_0x48e82b[0x0];if(!_0x3b5b70[_0xa890('0x5e')][_0xa890('0x65')])return;return db[_0xa890('0x79')][_0xa890('0x5c')]({'where':{'id':_0x3b5b70[_0xa890('0x5e')][_0xa890('0x65')],'role':_0xa890('0x67')},'attributes':['id',_0xa890('0x3d'),_0xa890('0x7a'),_0xa890('0x7b'),_0xa890('0x7c')],'raw':!![]});}return null;})[_0xa890('0x22')](function(_0xdab831){if(!_0xdab831)return null;_0x5775a8[_0xa890('0x2b')][_0xa890('0x67')]=_0xdab831;return _0x5775a8;})[_0xa890('0x22')](function(_0x1280e8){if(_0x1280e8){if(_0x3b5b70[_0xa890('0x5e')][_0xa890('0x7d')]){_0x5775a8[_0xa890('0x2b')][_0xa890('0x7e')]=util[_0xa890('0x63')]('SIP/%s',_0x3b5b70[_0xa890('0x66')][_0xa890('0x3d')]);_0x5775a8[_0xa890('0x2b')]['channel']=_0x5775a8[_0xa890('0x7f')];_0x5775a8[_0xa890('0x2b')][_0xa890('0x80')]=_0x5775a8['channel'];_0x5775a8[_0xa890('0x2b')][_0xa890('0x81')]=_0xa890('0x82');return respondWithRpcPromise(_0xa890('0x83'),'EventManager',{'event':'acceptmessage','message':_[_0xa890('0x52')](_0x5775a8[_0xa890('0x2b')],JSON['parse'](_0x5775a8[_0xa890('0x6c')]['formData']))},client9002)[_0xa890('0x22')](function(){return _0x5775a8;});}return _0x5775a8;}return null;})['then'](respondWithResult(_0x1a7984,null))[_0xa890('0x2d')](handleError(_0x1a7984,null));};var interaction_log=require('../../config/logger')(_0xa890('0x60'));exports[_0xa890('0x38')]=function(_0x516681,_0x2f8131,_0x290a5d){var _0x25f1e5={'agent':{},'channel':_0xa890('0x61')};if(_0x516681[_0xa890('0x5e')]['id']){delete _0x516681['body']['id'];}_0x516681[_0xa890('0x5e')][_0xa890('0x65')]=_0x516681[_0xa890('0x5e')][_0xa890('0x65')]||_0x516681[_0xa890('0x66')]['id'];_0x25f1e5[_0xa890('0x67')]['id']=_0x516681[_0xa890('0x5e')][_0xa890('0x65')];return db[_0xa890('0x41')]['find']({'where':{'id':_0x516681['params']['id'],'UserId':null}})[_0xa890('0x22')](handleEntityNotFound(_0x2f8131,null))[_0xa890('0x22')](function(_0x2215b9){if(_0x2215b9){_0x25f1e5[_0xa890('0x2b')]=_0x2215b9['get']({'plain':!![]});return db['ChatInteraction']['find']({'where':{'id':_0x2215b9['ChatInteractionId']}});}return null;})[_0xa890('0x22')](handleEntityNotFound(_0x2f8131,null))[_0xa890('0x22')](function(_0x5bb85d){if(_0x5bb85d){_0x25f1e5[_0xa890('0x6c')]=_0x5bb85d[_0xa890('0x68')]({'plain':!![]});interaction_log[_0xa890('0x23')](_0xa890('0x84'),_0x516681['user']['id'],_0x516681[_0xa890('0x66')][_0xa890('0x3d')],_0x516681[_0xa890('0x66')][_0xa890('0x6e')],_0x25f1e5[_0xa890('0x6c')]['id'],_0x516681[_0xa890('0x5e')]?JSON[_0xa890('0x27')](_0x516681[_0xa890('0x5e')]):_0xa890('0x6f'));return respondWithRpcPromise('RejectMessage',_0xa890('0x85'),_0x25f1e5);}return null;})[_0xa890('0x22')](function(_0x83a89d){var _0x1e718d='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x83a89d['message'][_0xa890('0x73')];return db['sequelize'][_0xa890('0x44')](_0x1e718d,{'type':db[_0xa890('0x75')][_0xa890('0x76')][_0xa890('0x77')],'raw':!![]})[_0xa890('0x22')](function(_0x5a419b){return _0x5a419b;});})[_0xa890('0x22')](function(_0x271aa6){if(_0x271aa6){_0x25f1e5[_0xa890('0x2b')][_0xa890('0x78')]=_0x271aa6[0x0];if(!_0x516681[_0xa890('0x5e')][_0xa890('0x65')])return;return db[_0xa890('0x79')][_0xa890('0x5c')]({'where':{'id':_0x516681[_0xa890('0x5e')]['UserId'],'role':_0xa890('0x67')},'attributes':['id',_0xa890('0x3d'),'fullname',_0xa890('0x7b'),_0xa890('0x7c')],'raw':!![]});}return null;})[_0xa890('0x22')](function(_0x548acd){if(!_0x548acd)return null;_0x25f1e5[_0xa890('0x2b')][_0xa890('0x67')]=_0x548acd;return _0x25f1e5;})[_0xa890('0x22')](function(_0x5f55ce){if(_0x5f55ce){_0x5f55ce[_0xa890('0x2b')][_0xa890('0x7e')]=util[_0xa890('0x63')](_0xa890('0x86'),_0x516681[_0xa890('0x66')][_0xa890('0x3d')]);_0x5f55ce[_0xa890('0x2b')][_0xa890('0x7f')]=_0x25f1e5[_0xa890('0x7f')];_0x5f55ce[_0xa890('0x2b')][_0xa890('0x80')]=_0x25f1e5[_0xa890('0x7f')];_0x5f55ce['message'][_0xa890('0x81')]=_0xa890('0x38');respondWithRpcPromise(_0xa890('0x83'),'EventManager',{'event':_0xa890('0x87'),'message':_[_0xa890('0x52')](_0x25f1e5[_0xa890('0x2b')],JSON['parse'](_0x25f1e5[_0xa890('0x6c')][_0xa890('0x88')]))},client9002);return _0x25f1e5;}return null;})[_0xa890('0x22')](respondWithResult(_0x2f8131,null))[_0xa890('0x2d')](handleError(_0x2f8131,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index b0dc2b9..d929fa0 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 _0x8678=['../../mysqldb','update','remove','emit','hasOwnProperty','hook'];(function(_0x215a4c,_0x23a003){var _0xf02167=function(_0x3cda69){while(--_0x3cda69){_0x215a4c['push'](_0x215a4c['shift']());}};_0xf02167(++_0x23a003);}(_0x8678,0x6c));var _0x8867=function(_0x55ae8f,_0x15add6){_0x55ae8f=_0x55ae8f-0x0;var _0x19f5f0=_0x8678[_0x55ae8f];return _0x19f5f0;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0x8867('0x0'))['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x8867('0x1'),'afterDestroy':_0x8867('0x2')};function emitEvent(_0x25d8b3){return function(_0x1d58f7,_0x3430b1,_0x1c9dd7){ChatMessageEvents[_0x8867('0x3')](_0x25d8b3+':'+_0x1d58f7['id'],_0x1d58f7);ChatMessageEvents[_0x8867('0x3')](_0x25d8b3,_0x1d58f7);_0x1c9dd7(null);};}for(var e in events){if(events[_0x8867('0x4')](e)){var event=events[e];ChatMessage[_0x8867('0x5')](e,emitEvent(event));}}module['exports']=ChatMessageEvents; \ No newline at end of file +var _0x975f=['update','remove','emit','hasOwnProperty','hook','exports','events','ChatMessage','setMaxListeners','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x975f,0x1f0));var _0xf975=function(_0x5447aa,_0x3afc00){_0x5447aa=_0x5447aa-0x0;var _0xb21e53=_0x975f[_0x5447aa];return _0xb21e53;};'use strict';var EventEmitter=require(_0xf975('0x0'));var ChatMessage=require('../../mysqldb')['db'][_0xf975('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xf975('0x2')](0x0);var events={'afterCreate':_0xf975('0x3'),'afterUpdate':_0xf975('0x4'),'afterDestroy':_0xf975('0x5')};function emitEvent(_0x5c591e){return function(_0x1c3f94,_0x43bff3,_0x1a2390){ChatMessageEvents[_0xf975('0x6')](_0x5c591e+':'+_0x1c3f94['id'],_0x1c3f94);ChatMessageEvents[_0xf975('0x6')](_0x5c591e,_0x1c3f94);_0x1a2390(null);};}for(var e in events){if(events[_0xf975('0x7')](e)){var event=events[e];ChatMessage[_0xf975('0x8')](e,emitEvent(event));}}module[_0xf975('0x9')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 2047f5c..e34f5a0 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 _0x9b9b=['then','update','catch','error','utf8mb4','utf8mb4_unicode_ci','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatMessage.attributes','exports','define','ChatMessage','chat_messages','fti_chat_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','ChatInteraction'];(function(_0x4f637c,_0xb5e9de){var _0x307ee7=function(_0x3751d4){while(--_0x3751d4){_0x4f637c['push'](_0x4f637c['shift']());}};_0x307ee7(++_0xb5e9de);}(_0x9b9b,0x114));var _0xb9b9=function(_0x3c99ef,_0x50b107){_0x3c99ef=_0x3c99ef-0x0;var _0x17550c=_0x9b9b[_0x3c99ef];return _0x17550c;};'use strict';var _=require('lodash');var util=require(_0xb9b9('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xb9b9('0x1'));var BPromise=require(_0xb9b9('0x2'));var rp=require(_0xb9b9('0x3'));var fs=require('fs');var path=require(_0xb9b9('0x4'));var rimraf=require(_0xb9b9('0x5'));var config=require(_0xb9b9('0x6'));var attributes=require(_0xb9b9('0x7'));module[_0xb9b9('0x8')]=function(_0x79dd,_0x3d1a95){return _0x79dd[_0xb9b9('0x9')](_0xb9b9('0xa'),attributes,{'tableName':_0xb9b9('0xb'),'paranoid':![],'indexes':[{'name':_0xb9b9('0xc'),'fields':[_0xb9b9('0xd')],'type':_0xb9b9('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x485810,_0x4a645a,_0x2f6ff1){var _0x139301=_0x79dd[_0xb9b9('0xf')];var _0x47fe6d=_0x485810[_0xb9b9('0x10')]({'plain':!![]});if(_0x47fe6d[_0xb9b9('0x11')][_0xb9b9('0x12')]()==='in'||_0x47fe6d['direction'][_0xb9b9('0x12')]()===_0xb9b9('0x13')&&!_0x47fe6d[_0xb9b9('0x14')]&&!_[_0xb9b9('0x15')](_0x47fe6d[_0xb9b9('0x16')])){_0x139301[_0xb9b9('0x17')]['findOne']({'where':{'id':_0x47fe6d['ChatInteractionId']}})[_0xb9b9('0x18')](function(_0x4ef543){if(_0x4ef543){_0x4ef543[_0xb9b9('0x19')]({'lastMsgAt':_0x47fe6d['createdAt'],'lastMsgDirection':_0x47fe6d[_0xb9b9('0x11')][_0xb9b9('0x12')]()});}})[_0xb9b9('0x1a')](function(_0x29794c){console[_0xb9b9('0x1b')](_0x29794c);});}_0x2f6ff1();}},'charset':_0xb9b9('0x1c'),'collate':_0xb9b9('0x1d')});}; \ No newline at end of file +var _0x8c28=['get','toLowerCase','direction','out','secret','isNil','UserId','ChatInteraction','findOne','ChatInteractionId','then','update','createdAt','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./chatMessage.attributes','define','body','models'];(function(_0x543e9b,_0x25541){var _0x3a2c22=function(_0x265fa1){while(--_0x265fa1){_0x543e9b['push'](_0x543e9b['shift']());}};_0x3a2c22(++_0x25541);}(_0x8c28,0x198));var _0x88c2=function(_0x3d3679,_0x40cce7){_0x3d3679=_0x3d3679-0x0;var _0x4e8180=_0x8c28[_0x3d3679];return _0x4e8180;};'use strict';var _=require(_0x88c2('0x0'));var util=require(_0x88c2('0x1'));var logger=require(_0x88c2('0x2'))('api');var moment=require('moment');var BPromise=require(_0x88c2('0x3'));var rp=require(_0x88c2('0x4'));var fs=require('fs');var path=require(_0x88c2('0x5'));var rimraf=require(_0x88c2('0x6'));var config=require(_0x88c2('0x7'));var attributes=require(_0x88c2('0x8'));module['exports']=function(_0x2fe9f3,_0x81a9d2){return _0x2fe9f3[_0x88c2('0x9')]('ChatMessage',attributes,{'tableName':'chat_messages','paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':[_0x88c2('0xa')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3d22b9,_0x6b9a70,_0x39bfdc){var _0x3edafc=_0x2fe9f3[_0x88c2('0xb')];var _0x3026e7=_0x3d22b9[_0x88c2('0xc')]({'plain':!![]});if(_0x3026e7['direction'][_0x88c2('0xd')]()==='in'||_0x3026e7[_0x88c2('0xe')][_0x88c2('0xd')]()===_0x88c2('0xf')&&!_0x3026e7[_0x88c2('0x10')]&&!_[_0x88c2('0x11')](_0x3026e7[_0x88c2('0x12')])){_0x3edafc[_0x88c2('0x13')][_0x88c2('0x14')]({'where':{'id':_0x3026e7[_0x88c2('0x15')]}})[_0x88c2('0x16')](function(_0xd24b2a){if(_0xd24b2a){_0xd24b2a[_0x88c2('0x17')]({'lastMsgAt':_0x3026e7[_0x88c2('0x18')],'lastMsgDirection':_0x3026e7[_0x88c2('0xe')][_0x88c2('0xd')]()});}})[_0x88c2('0x19')](function(_0x2eb4c4){console['error'](_0x2eb4c4);});}_0x39bfdc();}},'charset':_0x88c2('0x1a'),'collate':_0x88c2('0x1b')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 821c517..a04bd32 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 _0x8cc1=['stringify','error','ChatMessage,\x20%s,\x20%s','result','message','CreateChatMessage','ChatMessage','create','body','options','raw','then','info','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./chatMessage.socket','register','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s'];(function(_0x48beab,_0x430a08){var _0x2b6ef8=function(_0x54f711){while(--_0x54f711){_0x48beab['push'](_0x48beab['shift']());}};_0x2b6ef8(++_0x430a08);}(_0x8cc1,0x14e));var _0x18cc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8cc1[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x18cc('0x0'));var moment=require('moment');var BPromise=require(_0x18cc('0x1'));var rs=require(_0x18cc('0x2'));var fs=require('fs');var Redis=require(_0x18cc('0x3'));var db=require(_0x18cc('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x18cc('0x5'))('rpc');var config=require(_0x18cc('0x6'));var jayson=require(_0x18cc('0x7'));var client=jayson[_0x18cc('0x8')][_0x18cc('0x9')]({'port':0x232a});config[_0x18cc('0xa')]=_['defaults'](config[_0x18cc('0xa')],{'host':_0x18cc('0xb'),'port':0x18eb});var socket=require(_0x18cc('0xc'))(new Redis(config[_0x18cc('0xa')]));require(_0x18cc('0xd'))[_0x18cc('0xe')](socket);function respondWithRpcPromise(_0x5f33e8,_0x202506,_0x10f97b){return new BPromise(function(_0x98611e,_0x35893d){return client['request'](_0x5f33e8,_0x10f97b)['then'](function(_0x3cfb0a){logger['info']('ChatMessage,\x20%s,\x20%s',_0x202506,_0x18cc('0xf'));logger[_0x18cc('0x10')](_0x18cc('0x11'),_0x202506,'request\x20sent',JSON[_0x18cc('0x12')](_0x3cfb0a));if(_0x3cfb0a[_0x18cc('0x13')]){if(_0x3cfb0a['error']['code']===0x1f4){logger[_0x18cc('0x13')]('ChatMessage,\x20%s,\x20%s',_0x202506,_0x3cfb0a[_0x18cc('0x13')]['message']);return _0x35893d(_0x3cfb0a[_0x18cc('0x13')]['message']);}logger[_0x18cc('0x13')](_0x18cc('0x14'),_0x202506,_0x3cfb0a[_0x18cc('0x13')]['message']);return _0x98611e(_0x3cfb0a[_0x18cc('0x13')]['message']);}else{logger['info'](_0x18cc('0x14'),_0x202506,_0x18cc('0xf'));_0x98611e(_0x3cfb0a[_0x18cc('0x15')][_0x18cc('0x16')]);}})['catch'](function(_0x230d8c){logger[_0x18cc('0x13')](_0x18cc('0x14'),_0x202506,_0x230d8c);_0x35893d(_0x230d8c);});});}exports[_0x18cc('0x17')]=function(_0x33b3a1){var _0x4a8516=this;return new Promise(function(_0x1ac742,_0x313277){return db[_0x18cc('0x18')][_0x18cc('0x19')](_0x33b3a1[_0x18cc('0x1a')],{'raw':_0x33b3a1[_0x18cc('0x1b')]?_0x33b3a1[_0x18cc('0x1b')][_0x18cc('0x1c')]===undefined?!![]:![]:!![]})[_0x18cc('0x1d')](function(_0x2ce670){logger[_0x18cc('0x1e')](_0x18cc('0x17'),_0x33b3a1);logger[_0x18cc('0x10')]('CreateChatMessage',_0x33b3a1,JSON['stringify'](_0x2ce670));_0x1ac742(_0x2ce670);})[_0x18cc('0x1f')](function(_0x48364a){logger['error'](_0x18cc('0x17'),_0x48364a[_0x18cc('0x16')],_0x33b3a1);_0x313277(_0x4a8516[_0x18cc('0x13')](0x1f4,_0x48364a[_0x18cc('0x16')]));});});}; \ No newline at end of file +var _0x3a0b=['raw','stringify','lodash','util','moment','bluebird','randomstring','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','error','ChatMessage,\x20%s,\x20%s','message','info','catch','CreateChatMessage','ChatMessage','create','body','options'];(function(_0x1da04e,_0x31024b){var _0xdd8c41=function(_0x2036f9){while(--_0x2036f9){_0x1da04e['push'](_0x1da04e['shift']());}};_0xdd8c41(++_0x31024b);}(_0x3a0b,0x7a));var _0xb3a0=function(_0x21353c,_0x2ea587){_0x21353c=_0x21353c-0x0;var _0xa99120=_0x3a0b[_0x21353c];return _0xa99120;};'use strict';var _=require(_0xb3a0('0x0'));var util=require(_0xb3a0('0x1'));var moment=require(_0xb3a0('0x2'));var BPromise=require(_0xb3a0('0x3'));var rs=require(_0xb3a0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb3a0('0x5'));var config=require(_0xb3a0('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xb3a0('0x7')][_0xb3a0('0x8')]({'port':0x232a});config[_0xb3a0('0x9')]=_[_0xb3a0('0xa')](config[_0xb3a0('0x9')],{'host':_0xb3a0('0xb'),'port':0x18eb});var socket=require(_0xb3a0('0xc'))(new Redis(config[_0xb3a0('0x9')]));require(_0xb3a0('0xd'))[_0xb3a0('0xe')](socket);function respondWithRpcPromise(_0xcb09ef,_0x6d3a62,_0x34504d){return new BPromise(function(_0x14dd6d,_0x2e8dfe){return client['request'](_0xcb09ef,_0x34504d)['then'](function(_0x504775){logger['info']('ChatMessage,\x20%s,\x20%s',_0x6d3a62,_0xb3a0('0xf'));logger[_0xb3a0('0x10')](_0xb3a0('0x11'),_0x6d3a62,_0xb3a0('0xf'),JSON['stringify'](_0x504775));if(_0x504775[_0xb3a0('0x12')]){if(_0x504775[_0xb3a0('0x12')]['code']===0x1f4){logger[_0xb3a0('0x12')](_0xb3a0('0x13'),_0x6d3a62,_0x504775['error'][_0xb3a0('0x14')]);return _0x2e8dfe(_0x504775[_0xb3a0('0x12')]['message']);}logger[_0xb3a0('0x12')](_0xb3a0('0x13'),_0x6d3a62,_0x504775[_0xb3a0('0x12')][_0xb3a0('0x14')]);return _0x14dd6d(_0x504775[_0xb3a0('0x12')]['message']);}else{logger[_0xb3a0('0x15')](_0xb3a0('0x13'),_0x6d3a62,_0xb3a0('0xf'));_0x14dd6d(_0x504775['result']['message']);}})[_0xb3a0('0x16')](function(_0x382ceb){logger[_0xb3a0('0x12')]('ChatMessage,\x20%s,\x20%s',_0x6d3a62,_0x382ceb);_0x2e8dfe(_0x382ceb);});});}exports[_0xb3a0('0x17')]=function(_0x104ed7){var _0x3dfbf0=this;return new Promise(function(_0x47e321,_0x275df0){return db[_0xb3a0('0x18')][_0xb3a0('0x19')](_0x104ed7[_0xb3a0('0x1a')],{'raw':_0x104ed7['options']?_0x104ed7[_0xb3a0('0x1b')][_0xb3a0('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x5cf36a){logger['info'](_0xb3a0('0x17'),_0x104ed7);logger[_0xb3a0('0x10')]('CreateChatMessage',_0x104ed7,JSON[_0xb3a0('0x1d')](_0x5cf36a));_0x47e321(_0x5cf36a);})[_0xb3a0('0x16')](function(_0x5d88b3){logger[_0xb3a0('0x12')](_0xb3a0('0x17'),_0x5d88b3[_0xb3a0('0x14')],_0x104ed7);_0x275df0(_0x3dfbf0[_0xb3a0('0x12')](0x1f4,_0x5d88b3[_0xb3a0('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 9ba3e68..d494f43 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 _0xc43c=['emit','removeListener','register','length','chatMessage:','./chatMessage.events','save','remove','update'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0xc43c,0x152));var _0xcc43=function(_0x2ea1dd,_0x2077a1){_0x2ea1dd=_0x2ea1dd-0x0;var _0x525827=_0xc43c[_0x2ea1dd];return _0x525827;};'use strict';var ChatMessageEvents=require(_0xcc43('0x0'));var events=[_0xcc43('0x1'),_0xcc43('0x2'),_0xcc43('0x3')];function createListener(_0x14352d,_0x275c81){return function(_0x53ef5e){_0x275c81[_0xcc43('0x4')](_0x14352d,_0x53ef5e);};}function removeListener(_0x258c7e,_0x5c21a3){return function(){ChatMessageEvents[_0xcc43('0x5')](_0x258c7e,_0x5c21a3);};}exports[_0xcc43('0x6')]=function(_0x217a5e){for(var _0x17d1a2=0x0,_0x9140b6=events[_0xcc43('0x7')];_0x17d1a2<_0x9140b6;_0x17d1a2++){var _0x298aa7=events[_0x17d1a2];var _0x3b8857=createListener(_0xcc43('0x8')+_0x298aa7,_0x217a5e);ChatMessageEvents['on'](_0x298aa7,_0x3b8857);}}; \ No newline at end of file +var _0xc5c7=['length','save','remove','update','removeListener','register'];(function(_0x2a0bc8,_0x2b4938){var _0x305879=function(_0x4d2891){while(--_0x4d2891){_0x2a0bc8['push'](_0x2a0bc8['shift']());}};_0x305879(++_0x2b4938);}(_0xc5c7,0x1cf));var _0x7c5c=function(_0x347b50,_0x2ad222){_0x347b50=_0x347b50-0x0;var _0x1495ab=_0xc5c7[_0x347b50];return _0x1495ab;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=[_0x7c5c('0x0'),_0x7c5c('0x1'),_0x7c5c('0x2')];function createListener(_0x18d013,_0x15e755){return function(_0x1932ff){_0x15e755['emit'](_0x18d013,_0x1932ff);};}function removeListener(_0xff325e,_0x2b4355){return function(){ChatMessageEvents[_0x7c5c('0x3')](_0xff325e,_0x2b4355);};}exports[_0x7c5c('0x4')]=function(_0x1dc034){for(var _0x4dd500=0x0,_0x5ec99e=events[_0x7c5c('0x5')];_0x4dd500<_0x5ec99e;_0x4dd500++){var _0x5895b5=events[_0x4dd500];var _0x402b70=createListener('chatMessage:'+_0x5895b5,_0x1dc034);ChatMessageEvents['on'](_0x5895b5,_0x402b70);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 518ac4a..e27c2fc 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 _0x5dff=['/describe','/:id','show','post','tracked','chat','chatmessage:create','create','put','accept','/:id/reject','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatMessage.controller','get','isAuthenticated'];(function(_0x436df2,_0x4f6a34){var _0x2bf124=function(_0x3333bc){while(--_0x3333bc){_0x436df2['push'](_0x436df2['shift']());}};_0x2bf124(++_0x4f6a34);}(_0x5dff,0x1a6));var _0xf5df=function(_0x26be12,_0x338b2c){_0x26be12=_0x26be12-0x0;var _0x110b3c=_0x5dff[_0x26be12];return _0x110b3c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xf5df('0x0'));var timeout=require(_0xf5df('0x1'));var express=require(_0xf5df('0x2'));var router=express[_0xf5df('0x3')]();var fs_extra=require(_0xf5df('0x4'));var auth=require(_0xf5df('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf5df('0x6'));var controller=require(_0xf5df('0x7'));router[_0xf5df('0x8')]('/',auth[_0xf5df('0x9')](),controller['index']);router[_0xf5df('0x8')](_0xf5df('0xa'),auth[_0xf5df('0x9')](),controller['describe']);router[_0xf5df('0x8')](_0xf5df('0xb'),auth['isAuthenticated'](),controller[_0xf5df('0xc')]);router[_0xf5df('0xd')]('/',auth[_0xf5df('0x9')](),interaction[_0xf5df('0xe')](_0xf5df('0xf'),_0xf5df('0x10')),controller[_0xf5df('0x11')]);router[_0xf5df('0x12')](_0xf5df('0xb'),controller['update']);router['put']('/:id/accept',auth[_0xf5df('0x9')](),controller[_0xf5df('0x13')]);router[_0xf5df('0x12')](_0xf5df('0x14'),auth[_0xf5df('0x9')](),controller['reject']);router[_0xf5df('0x15')](_0xf5df('0xb'),auth[_0xf5df('0x9')](),controller[_0xf5df('0x16')]);module[_0xf5df('0x17')]=router; \ No newline at end of file +var _0x8d9d=['connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','tracked','chat','chatmessage:create','create','put','update','/:id/accept','accept','/:id/reject','reject','destroy','multer','path'];(function(_0x199de6,_0x551e33){var _0x3fa9ba=function(_0x43a63a){while(--_0x43a63a){_0x199de6['push'](_0x199de6['shift']());}};_0x3fa9ba(++_0x551e33);}(_0x8d9d,0x1c9));var _0xd8d9=function(_0x1632fa,_0x273ab0){_0x1632fa=_0x1632fa-0x0;var _0x573d0f=_0x8d9d[_0x1632fa];return _0x573d0f;};'use strict';var multer=require(_0xd8d9('0x0'));var util=require('util');var path=require(_0xd8d9('0x1'));var timeout=require(_0xd8d9('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xd8d9('0x3'));var auth=require(_0xd8d9('0x4'));var interaction=require(_0xd8d9('0x5'));var config=require(_0xd8d9('0x6'));var controller=require(_0xd8d9('0x7'));router[_0xd8d9('0x8')]('/',auth['isAuthenticated'](),controller[_0xd8d9('0x9')]);router[_0xd8d9('0x8')](_0xd8d9('0xa'),auth[_0xd8d9('0xb')](),controller[_0xd8d9('0xc')]);router['get'](_0xd8d9('0xd'),auth['isAuthenticated'](),controller[_0xd8d9('0xe')]);router[_0xd8d9('0xf')]('/',auth[_0xd8d9('0xb')](),interaction[_0xd8d9('0x10')](_0xd8d9('0x11'),_0xd8d9('0x12')),controller[_0xd8d9('0x13')]);router[_0xd8d9('0x14')](_0xd8d9('0xd'),controller[_0xd8d9('0x15')]);router['put'](_0xd8d9('0x16'),auth['isAuthenticated'](),controller[_0xd8d9('0x17')]);router[_0xd8d9('0x14')](_0xd8d9('0x18'),auth['isAuthenticated'](),controller[_0xd8d9('0x19')]);router['delete'](_0xd8d9('0xd'),auth[_0xd8d9('0xb')](),controller[_0xd8d9('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index d0a9f8e..db59a38 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 _0xdb28=['TEXT','medium','sequelize','exports'];(function(_0x410682,_0x4823aa){var _0x53c696=function(_0x10dcc8){while(--_0x10dcc8){_0x410682['push'](_0x410682['shift']());}};_0x53c696(++_0x4823aa);}(_0xdb28,0x106));var _0x8db2=function(_0x13beab,_0x39983a){_0x13beab=_0x13beab-0x0;var _0x2d85f2=_0xdb28[_0x13beab];return _0x2d85f2;};'use strict';var Sequelize=require(_0x8db2('0x0'));module[_0x8db2('0x1')]={'body':{'type':Sequelize[_0x8db2('0x2')](_0x8db2('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x8db2('0x3')),'allowNull':![]}}; \ No newline at end of file +var _0x2032=['medium','exports','TEXT'];(function(_0x5cd23e,_0x20777b){var _0x216550=function(_0x2935bb){while(--_0x2935bb){_0x5cd23e['push'](_0x5cd23e['shift']());}};_0x216550(++_0x20777b);}(_0x2032,0xd9));var _0x2203=function(_0x2d7887,_0x31055d){_0x2d7887=_0x2d7887-0x0;var _0xd9d54a=_0x2032[_0x2d7887];return _0xd9d54a;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'body':{'type':Sequelize[_0x2203('0x1')](_0x2203('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x2203('0x2')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 60f8433..2d4b047 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','Attachment','join','server','attachments','offline-chat','basename','remove','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','ChatOfflineMessage','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0xf50820,_0x56f041){var _0x2a9b10=function(_0x33f0f4){while(--_0x33f0f4){_0xf50820['push'](_0xf50820['shift']());}};_0x2a9b10(++_0x56f041);}(_0x7a54,0x106));var _0x47a5=function(_0x56de5f,_0x31745f){_0x56de5f=_0x56de5f-0x0;var _0x38bfbd=_0x7a54[_0x56de5f];return _0x38bfbd;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file +var _0x7a54=['filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','Attachment','join','server','attachments','offline-chat','basename','remove','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','ChatOfflineMessage','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x1b5aea,_0x3f04b7){var _0x15cfc6=function(_0x204e92){while(--_0x204e92){_0x1b5aea['push'](_0x1b5aea['shift']());}};_0x15cfc6(++_0x3f04b7);}(_0x7a54,0x106));var _0x47a5=function(_0xa44c0b,_0x2056ba){_0xa44c0b=_0xa44c0b-0x0;var _0x32bc3e=_0x7a54[_0xa44c0b];return _0x32bc3e;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.events.js b/server/api/chatOfflineMessage/chatOfflineMessage.events.js index e619673..3ce1b45 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 _0xb175=['setMaxListeners','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatOfflineMessage'];(function(_0x1c8520,_0x3fc00c){var _0x3b63bd=function(_0x32d6cb){while(--_0x32d6cb){_0x1c8520['push'](_0x1c8520['shift']());}};_0x3b63bd(++_0x3fc00c);}(_0xb175,0x1a4));var _0x5b17=function(_0x263a65,_0x9a3826){_0x263a65=_0x263a65-0x0;var _0x361393=_0xb175[_0x263a65];return _0x361393;};'use strict';var EventEmitter=require(_0x5b17('0x0'));var ChatOfflineMessage=require(_0x5b17('0x1'))['db'][_0x5b17('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x5b17('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x5b17('0x4'),'afterDestroy':'remove'};function emitEvent(_0x4bec67){return function(_0x556b44,_0x496f89,_0x4e482a){ChatOfflineMessageEvents['emit'](_0x4bec67+':'+_0x556b44['id'],_0x556b44);ChatOfflineMessageEvents[_0x5b17('0x5')](_0x4bec67,_0x556b44);_0x4e482a(null);};}for(var e in events){if(events[_0x5b17('0x6')](e)){var event=events[e];ChatOfflineMessage[_0x5b17('0x7')](e,emitEvent(event));}}module[_0x5b17('0x8')]=ChatOfflineMessageEvents; \ No newline at end of file +var _0x94a1=['setMaxListeners','update','emit','hasOwnProperty','events'];(function(_0x20ca38,_0xec17bf){var _0x5ce527=function(_0x346b62){while(--_0x346b62){_0x20ca38['push'](_0x20ca38['shift']());}};_0x5ce527(++_0xec17bf);}(_0x94a1,0x10d));var _0x194a=function(_0x5a810f,_0x3deefb){_0x5a810f=_0x5a810f-0x0;var _0x2ed176=_0x94a1[_0x5a810f];return _0x2ed176;};'use strict';var EventEmitter=require(_0x194a('0x0'));var ChatOfflineMessage=require('../../mysqldb')['db']['ChatOfflineMessage'];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x194a('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x194a('0x2'),'afterDestroy':'remove'};function emitEvent(_0x4b2955){return function(_0x2b15e6,_0xd157ee,_0x3b1152){ChatOfflineMessageEvents[_0x194a('0x3')](_0x4b2955+':'+_0x2b15e6['id'],_0x2b15e6);ChatOfflineMessageEvents[_0x194a('0x3')](_0x4b2955,_0x2b15e6);_0x3b1152(null);};}for(var e in events){if(events[_0x194a('0x4')](e)){var event=events[e];ChatOfflineMessage['hook'](e,emitEvent(event));}}module['exports']=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 43ba337..02463ce 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 _0xca41=['chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','./chatOfflineMessage.attributes','exports','ChatOfflineMessage'];(function(_0x352e09,_0x37a7da){var _0x1b7094=function(_0x561074){while(--_0x561074){_0x352e09['push'](_0x352e09['shift']());}};_0x1b7094(++_0x37a7da);}(_0xca41,0x177));var _0x1ca4=function(_0x297d74,_0x5e305e){_0x297d74=_0x297d74-0x0;var _0x4af856=_0xca41[_0x297d74];return _0x4af856;};'use strict';var attributes=require(_0x1ca4('0x0'));module[_0x1ca4('0x1')]=function(_0x2f1c67){return _0x2f1c67['define'](_0x1ca4('0x2'),attributes,{'tableName':_0x1ca4('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1ca4('0x4'),'collate':_0x1ca4('0x5')});}; \ No newline at end of file +var _0x8a33=['ChatOfflineMessage','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','./chatOfflineMessage.attributes','exports','define'];(function(_0x13e724,_0x296739){var _0x334a44=function(_0x28f54e){while(--_0x28f54e){_0x13e724['push'](_0x13e724['shift']());}};_0x334a44(++_0x296739);}(_0x8a33,0x138));var _0x38a3=function(_0x1a3c9b,_0x3eb0cb){_0x1a3c9b=_0x1a3c9b-0x0;var _0x57f1d8=_0x8a33[_0x1a3c9b];return _0x57f1d8;};'use strict';var attributes=require(_0x38a3('0x0'));module[_0x38a3('0x1')]=function(_0x324ece){return _0x324ece[_0x38a3('0x2')](_0x38a3('0x3'),attributes,{'tableName':_0x38a3('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x38a3('0x5'),'collate':_0x38a3('0x6')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 4a9e48d..e48bf20 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 _0x425d=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch'];(function(_0x3874c9,_0x11f2fc){var _0x39fc85=function(_0x5dc180){while(--_0x5dc180){_0x3874c9['push'](_0x3874c9['shift']());}};_0x39fc85(++_0x11f2fc);}(_0x425d,0x1e0));var _0xd425=function(_0x29ff2f,_0x1eda73){_0x29ff2f=_0x29ff2f-0x0;var _0x2bbf9d=_0x425d[_0x29ff2f];return _0x2bbf9d;};'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});function respondWithRpcPromise(_0x1d97d9,_0x1d2ed0,_0x50b061){return new BPromise(function(_0xb6ba8e,_0x374c3d){return client[_0xd425('0xc')](_0x1d97d9,_0x50b061)[_0xd425('0xd')](function(_0x2db9da){logger[_0xd425('0xe')](_0xd425('0xf'),_0x1d2ed0,_0xd425('0x10'));logger[_0xd425('0x11')](_0xd425('0x12'),_0x1d2ed0,_0xd425('0x10'),JSON[_0xd425('0x13')](_0x2db9da));if(_0x2db9da[_0xd425('0x14')]){if(_0x2db9da[_0xd425('0x14')][_0xd425('0x15')]===0x1f4){logger[_0xd425('0x14')](_0xd425('0xf'),_0x1d2ed0,_0x2db9da[_0xd425('0x14')][_0xd425('0x16')]);return _0x374c3d(_0x2db9da[_0xd425('0x14')]['message']);}logger[_0xd425('0x14')](_0xd425('0xf'),_0x1d2ed0,_0x2db9da[_0xd425('0x14')]['message']);return _0xb6ba8e(_0x2db9da[_0xd425('0x14')][_0xd425('0x16')]);}else{logger[_0xd425('0xe')](_0xd425('0xf'),_0x1d2ed0,_0xd425('0x10'));_0xb6ba8e(_0x2db9da['result'][_0xd425('0x16')]);}})[_0xd425('0x17')](function(_0x7e267e){logger[_0xd425('0x14')]('ChatOfflineMessage,\x20%s,\x20%s',_0x1d2ed0,_0x7e267e);_0x374c3d(_0x7e267e);});});} \ No newline at end of file +var _0x2e0a=['jayson/promise','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x2e0a,0xa3));var _0xa2e0=function(_0x375cc1,_0x25c2cf){_0x375cc1=_0x375cc1-0x0;var _0x2440f6=_0x2e0a[_0x375cc1];return _0x2440f6;};'use strict';var _=require(_0xa2e0('0x0'));var util=require(_0xa2e0('0x1'));var moment=require(_0xa2e0('0x2'));var BPromise=require(_0xa2e0('0x3'));var rs=require(_0xa2e0('0x4'));var fs=require('fs');var Redis=require(_0xa2e0('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xa2e0('0x6'));var logger=require(_0xa2e0('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xa2e0('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5c54b6,_0x37f4ea,_0x21c7b6){return new BPromise(function(_0x13b222,_0x35adeb){return client['request'](_0x5c54b6,_0x21c7b6)[_0xa2e0('0x9')](function(_0xf6267){logger[_0xa2e0('0xa')](_0xa2e0('0xb'),_0x37f4ea,_0xa2e0('0xc'));logger[_0xa2e0('0xd')]('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x37f4ea,_0xa2e0('0xc'),JSON[_0xa2e0('0xe')](_0xf6267));if(_0xf6267[_0xa2e0('0xf')]){if(_0xf6267[_0xa2e0('0xf')]['code']===0x1f4){logger[_0xa2e0('0xf')]('ChatOfflineMessage,\x20%s,\x20%s',_0x37f4ea,_0xf6267['error']['message']);return _0x35adeb(_0xf6267[_0xa2e0('0xf')][_0xa2e0('0x10')]);}logger['error']('ChatOfflineMessage,\x20%s,\x20%s',_0x37f4ea,_0xf6267[_0xa2e0('0xf')]['message']);return _0x13b222(_0xf6267['error']['message']);}else{logger['info'](_0xa2e0('0xb'),_0x37f4ea,'request\x20sent');_0x13b222(_0xf6267[_0xa2e0('0x11')][_0xa2e0('0x10')]);}})[_0xa2e0('0x12')](function(_0x564f72){logger[_0xa2e0('0xf')](_0xa2e0('0xb'),_0x37f4ea,_0x564f72);_0x35adeb(_0x564f72);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index c6f7b15..c8cc636 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 _0xcd57=['put','/:id','update','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatOfflineMessage.controller','get','index','/describe','describe','isAuthenticated','show','post','create'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0xcd57,0xa0));var _0x7cd5=function(_0x367a3d,_0x452717){_0x367a3d=_0x367a3d-0x0;var _0x460539=_0xcd57[_0x367a3d];return _0x460539;};'use strict';var multer=require(_0x7cd5('0x0'));var util=require('util');var path=require(_0x7cd5('0x1'));var timeout=require('connect-timeout');var express=require(_0x7cd5('0x2'));var router=express[_0x7cd5('0x3')]();var fs_extra=require(_0x7cd5('0x4'));var auth=require(_0x7cd5('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7cd5('0x6'));var controller=require(_0x7cd5('0x7'));router[_0x7cd5('0x8')]('/',auth['isAuthenticated'](),controller[_0x7cd5('0x9')]);router[_0x7cd5('0x8')](_0x7cd5('0xa'),auth['isAuthenticated'](),controller[_0x7cd5('0xb')]);router[_0x7cd5('0x8')]('/:id',auth[_0x7cd5('0xc')](),controller[_0x7cd5('0xd')]);router[_0x7cd5('0xe')]('/',auth[_0x7cd5('0xc')](),controller[_0x7cd5('0xf')]);router[_0x7cd5('0x10')](_0x7cd5('0x11'),auth[_0x7cd5('0xc')](),controller[_0x7cd5('0x12')]);router[_0x7cd5('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x7cd5('0x14')]);module[_0x7cd5('0x15')]=router; \ No newline at end of file +var _0x1c70=['destroy','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','create','put','update','delete'];(function(_0x3e69ca,_0x44181b){var _0x328195=function(_0x333691){while(--_0x333691){_0x3e69ca['push'](_0x3e69ca['shift']());}};_0x328195(++_0x44181b);}(_0x1c70,0xbf));var _0x01c7=function(_0x1f99a0,_0x50b73d){_0x1f99a0=_0x1f99a0-0x0;var _0x1e0849=_0x1c70[_0x1f99a0];return _0x1e0849;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x01c7('0x0'));var timeout=require(_0x01c7('0x1'));var express=require('express');var router=express[_0x01c7('0x2')]();var fs_extra=require(_0x01c7('0x3'));var auth=require(_0x01c7('0x4'));var interaction=require(_0x01c7('0x5'));var config=require(_0x01c7('0x6'));var controller=require(_0x01c7('0x7'));router[_0x01c7('0x8')]('/',auth[_0x01c7('0x9')](),controller[_0x01c7('0xa')]);router[_0x01c7('0x8')](_0x01c7('0xb'),auth[_0x01c7('0x9')](),controller[_0x01c7('0xc')]);router[_0x01c7('0x8')](_0x01c7('0xd'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x01c7('0x9')](),controller[_0x01c7('0xe')]);router[_0x01c7('0xf')](_0x01c7('0xd'),auth[_0x01c7('0x9')](),controller[_0x01c7('0x10')]);router[_0x01c7('0x11')](_0x01c7('0xd'),auth['isAuthenticated'](),controller[_0x01c7('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 4344aa2..4da8d37 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 _0x93d4=['mouseOver','sequelize','ENUM'];(function(_0x4d337e,_0x2f7eed){var _0x247963=function(_0x3d6564){while(--_0x3d6564){_0x4d337e['push'](_0x4d337e['shift']());}};_0x247963(++_0x2f7eed);}(_0x93d4,0x196));var _0x493d=function(_0x40bc07,_0x5a2567){_0x40bc07=_0x40bc07-0x0;var _0x147656=_0x93d4[_0x40bc07];return _0x147656;};'use strict';var Sequelize=require(_0x493d('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x493d('0x1')](_0x493d('0x2'),'timeout'),'defaultValue':_0x493d('0x2')},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xb2cc=['exports','ENUM','mouseOver','timeout','STRING','INTEGER','sequelize'];(function(_0x780b69,_0x557b9e){var _0x4c3934=function(_0x198ea7){while(--_0x198ea7){_0x780b69['push'](_0x780b69['shift']());}};_0x4c3934(++_0x557b9e);}(_0xb2cc,0x99));var _0xcb2c=function(_0x5880d8,_0x30b0a5){_0x5880d8=_0x5880d8-0x0;var _0x88264a=_0xb2cc[_0x5880d8];return _0x88264a;};'use strict';var Sequelize=require(_0xcb2c('0x0'));module[_0xcb2c('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xcb2c('0x2')](_0xcb2c('0x3'),_0xcb2c('0x4')),'defaultValue':_0xcb2c('0x3')},'selector':{'type':Sequelize[_0xcb2c('0x5')]},'timeout':{'type':Sequelize[_0xcb2c('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 2273311..5a8c5ca 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 _0x9649=['save','then','destroy','end','error','name','show','params','model','keys','ChatProactiveAction','filters','intersection','query','attributes','fields','includeAll','options','create','update','body','find','catch','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../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'];(function(_0x3a4317,_0x28b8f6){var _0x33f6eb=function(_0x51b3ff){while(--_0x51b3ff){_0x3a4317['push'](_0x3a4317['shift']());}};_0x33f6eb(++_0x28b8f6);}(_0x9649,0x19f));var _0x9964=function(_0x2d0dad,_0x23fadd){_0x2d0dad=_0x2d0dad-0x0;var _0x1f9917=_0x9649[_0x2d0dad];return _0x1f9917;};'use strict';var emlformat=require(_0x9964('0x0'));var rimraf=require(_0x9964('0x1'));var zipdir=require(_0x9964('0x2'));var jsonpatch=require(_0x9964('0x3'));var rp=require('request-promise');var moment=require(_0x9964('0x4'));var BPromise=require(_0x9964('0x5'));var Mustache=require('mustache');var util=require(_0x9964('0x6'));var path=require('path');var sox=require(_0x9964('0x7'));var csv=require(_0x9964('0x8'));var ejs=require(_0x9964('0x9'));var fs=require('fs');var fs_extra=require(_0x9964('0xa'));var _=require(_0x9964('0xb'));var squel=require(_0x9964('0xc'));var crypto=require(_0x9964('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x9964('0xe'));var toCsv=require(_0x9964('0x8'));var querystring=require('querystring');var Papa=require(_0x9964('0xf'));var Redis=require(_0x9964('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x9964('0x11'));var hardwareService=require(_0x9964('0x12'));var logger=require(_0x9964('0x13'))(_0x9964('0x14'));var utils=require(_0x9964('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x9964('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x56a69d,_0x39c624){_0x39c624=_0x39c624||0xcc;return function(_0x547b98){if(_0x547b98){return _0x56a69d[_0x9964('0x17')](_0x39c624);}return _0x56a69d[_0x9964('0x18')](_0x39c624)['end']();};}function respondWithResult(_0x1fd4b4,_0x463dbf){_0x463dbf=_0x463dbf||0xc8;return function(_0x11dfc9){if(_0x11dfc9){return _0x1fd4b4[_0x9964('0x18')](_0x463dbf)[_0x9964('0x19')](_0x11dfc9);}};}function respondWithFilteredResult(_0x5f002e,_0x411544){return function(_0x226e78){if(_0x226e78){var _0x57b330=typeof _0x411544[_0x9964('0x1a')]===_0x9964('0x1b')&&typeof _0x411544['limit']===_0x9964('0x1b');var _0x2e7e07=_0x226e78[_0x9964('0x1c')];var _0x4c18a4=_0x57b330?0x0:_0x411544['offset'];var _0x40b3dd=_0x57b330?_0x226e78[_0x9964('0x1c')]:_0x411544['offset']+_0x411544[_0x9964('0x1d')];var _0x3f6472;if(_0x40b3dd>=_0x2e7e07){_0x40b3dd=_0x2e7e07;_0x3f6472=0xc8;}else{_0x3f6472=0xce;}_0x5f002e[_0x9964('0x18')](_0x3f6472);return _0x5f002e[_0x9964('0x1e')](_0x9964('0x1f'),_0x4c18a4+'-'+_0x40b3dd+'/'+_0x2e7e07)[_0x9964('0x19')](_0x226e78);}return null;};}function patchUpdates(_0x400bb5){return function(_0x414649){try{jsonpatch[_0x9964('0x20')](_0x414649,_0x400bb5,!![]);}catch(_0xbd5197){return BPromise['reject'](_0xbd5197);}return _0x414649[_0x9964('0x21')]();};}function saveUpdates(_0x447026,_0x4c479f){return function(_0x2b03a8){if(_0x2b03a8){return _0x2b03a8['update'](_0x447026)[_0x9964('0x22')](function(_0xdc3ba){return _0xdc3ba;});}return null;};}function removeEntity(_0x1c5e34,_0x167525){return function(_0x2d049c){if(_0x2d049c){return _0x2d049c[_0x9964('0x23')]()['then'](function(){_0x1c5e34[_0x9964('0x18')](0xcc)[_0x9964('0x24')]();});}};}function handleEntityNotFound(_0x5961e9,_0x1b05a8){return function(_0x15a14c){if(!_0x15a14c){_0x5961e9[_0x9964('0x17')](0x194);}return _0x15a14c;};}function handleError(_0x1399e0,_0x26cd95){_0x26cd95=_0x26cd95||0x1f4;return function(_0x5a5793){logger[_0x9964('0x25')](_0x5a5793['stack']);if(_0x5a5793[_0x9964('0x26')]){delete _0x5a5793['name'];}_0x1399e0[_0x9964('0x18')](_0x26cd95)['send'](_0x5a5793);};}exports[_0x9964('0x27')]=function(_0x162b83,_0x46c104){var _0x44a38f={'raw':!![],'where':{'id':_0x162b83[_0x9964('0x28')]['id']}},_0x11cdce={};_0x11cdce[_0x9964('0x29')]=_[_0x9964('0x2a')](db[_0x9964('0x2b')]['rawAttributes']);_0x11cdce['query']=_['keys'](_0x162b83['query']);_0x11cdce[_0x9964('0x2c')]=_[_0x9964('0x2d')](_0x11cdce[_0x9964('0x29')],_0x11cdce[_0x9964('0x2e')]);_0x44a38f[_0x9964('0x2f')]=_[_0x9964('0x2d')](_0x11cdce[_0x9964('0x29')],qs[_0x9964('0x30')](_0x162b83[_0x9964('0x2e')]['fields']));_0x44a38f[_0x9964('0x2f')]=_0x44a38f[_0x9964('0x2f')]['length']?_0x44a38f[_0x9964('0x2f')]:_0x11cdce[_0x9964('0x29')];if(_0x162b83[_0x9964('0x2e')][_0x9964('0x31')]){_0x44a38f['include']=[{'all':!![]}];}_0x44a38f=_['merge']({},_0x44a38f,_0x162b83[_0x9964('0x32')]);return db['ChatProactiveAction']['find'](_0x44a38f)[_0x9964('0x22')](handleEntityNotFound(_0x46c104,null))[_0x9964('0x22')](respondWithResult(_0x46c104,null))['catch'](handleError(_0x46c104,null));};exports['create']=function(_0x224407,_0x71d436){return db['ChatProactiveAction'][_0x9964('0x33')](_0x224407['body'],{})['then'](respondWithResult(_0x71d436,0xc9))['catch'](handleError(_0x71d436,null));};exports[_0x9964('0x34')]=function(_0x36626c,_0x168f41){if(_0x36626c[_0x9964('0x35')]['id']){delete _0x36626c[_0x9964('0x35')]['id'];}return db[_0x9964('0x2b')][_0x9964('0x36')]({'where':{'id':_0x36626c[_0x9964('0x28')]['id']}})[_0x9964('0x22')](handleEntityNotFound(_0x168f41,null))['then'](saveUpdates(_0x36626c[_0x9964('0x35')],null))[_0x9964('0x22')](respondWithResult(_0x168f41,null))[_0x9964('0x37')](handleError(_0x168f41,null));};exports[_0x9964('0x23')]=function(_0x4f8ccb,_0x4a1105){return db[_0x9964('0x2b')][_0x9964('0x36')]({'where':{'id':_0x4f8ccb[_0x9964('0x28')]['id']}})[_0x9964('0x22')](handleEntityNotFound(_0x4a1105,null))[_0x9964('0x22')](removeEntity(_0x4a1105,null))['catch'](handleError(_0x4a1105,null));}; \ No newline at end of file +var _0x4ab0=['undefined','limit','count','set','Content-Range','apply','reject','destroy','then','sendStatus','error','stack','name','send','params','ChatProactiveAction','rawAttributes','query','keys','filters','intersection','model','attributes','fields','length','includeAll','merge','options','find','create','catch','update','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset'];(function(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0x4ab0,0xd5));var _0x04ab=function(_0x10d58a,_0x1a2e7b){_0x10d58a=_0x10d58a-0x0;var _0x479bb4=_0x4ab0[_0x10d58a];return _0x479bb4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x04ab('0x0'));var zipdir=require(_0x04ab('0x1'));var jsonpatch=require(_0x04ab('0x2'));var rp=require(_0x04ab('0x3'));var moment=require(_0x04ab('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x04ab('0x5'));var path=require(_0x04ab('0x6'));var sox=require('sox');var csv=require(_0x04ab('0x7'));var ejs=require(_0x04ab('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x04ab('0x9'));var squel=require(_0x04ab('0xa'));var crypto=require(_0x04ab('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x04ab('0xc'));var toCsv=require(_0x04ab('0x7'));var querystring=require(_0x04ab('0xd'));var Papa=require(_0x04ab('0xe'));var Redis=require('ioredis');var authService=require(_0x04ab('0xf'));var qs=require(_0x04ab('0x10'));var as=require(_0x04ab('0x11'));var hardwareService=require(_0x04ab('0x12'));var logger=require('../../config/logger')(_0x04ab('0x13'));var utils=require(_0x04ab('0x14'));var config=require(_0x04ab('0x15'));var licenseUtil=require(_0x04ab('0x16'));var db=require(_0x04ab('0x17'))['db'];function respondWithStatusCode(_0x386d0a,_0x4a6b39){_0x4a6b39=_0x4a6b39||0xcc;return function(_0x710503){if(_0x710503){return _0x386d0a['sendStatus'](_0x4a6b39);}return _0x386d0a[_0x04ab('0x18')](_0x4a6b39)[_0x04ab('0x19')]();};}function respondWithResult(_0x2abdf8,_0x428798){_0x428798=_0x428798||0xc8;return function(_0x4f0da1){if(_0x4f0da1){return _0x2abdf8['status'](_0x428798)['json'](_0x4f0da1);}};}function respondWithFilteredResult(_0x103ca8,_0x3cee44){return function(_0x149fd2){if(_0x149fd2){var _0x2b10b0=typeof _0x3cee44[_0x04ab('0x1a')]===_0x04ab('0x1b')&&typeof _0x3cee44[_0x04ab('0x1c')]===_0x04ab('0x1b');var _0x1f3251=_0x149fd2[_0x04ab('0x1d')];var _0x5ce43c=_0x2b10b0?0x0:_0x3cee44[_0x04ab('0x1a')];var _0x83ab27=_0x2b10b0?_0x149fd2[_0x04ab('0x1d')]:_0x3cee44[_0x04ab('0x1a')]+_0x3cee44[_0x04ab('0x1c')];var _0x10669a;if(_0x83ab27>=_0x1f3251){_0x83ab27=_0x1f3251;_0x10669a=0xc8;}else{_0x10669a=0xce;}_0x103ca8[_0x04ab('0x18')](_0x10669a);return _0x103ca8[_0x04ab('0x1e')](_0x04ab('0x1f'),_0x5ce43c+'-'+_0x83ab27+'/'+_0x1f3251)['json'](_0x149fd2);}return null;};}function patchUpdates(_0x75a04e){return function(_0x4a6679){try{jsonpatch[_0x04ab('0x20')](_0x4a6679,_0x75a04e,!![]);}catch(_0x1d04c2){return BPromise[_0x04ab('0x21')](_0x1d04c2);}return _0x4a6679['save']();};}function saveUpdates(_0x15a36b,_0x1c08f4){return function(_0xf6275e){if(_0xf6275e){return _0xf6275e['update'](_0x15a36b)['then'](function(_0xc8358e){return _0xc8358e;});}return null;};}function removeEntity(_0x2f614a,_0x5885bd){return function(_0x551583){if(_0x551583){return _0x551583[_0x04ab('0x22')]()[_0x04ab('0x23')](function(){_0x2f614a[_0x04ab('0x18')](0xcc)[_0x04ab('0x19')]();});}};}function handleEntityNotFound(_0x26bb81,_0xa3838a){return function(_0x21d9b7){if(!_0x21d9b7){_0x26bb81[_0x04ab('0x24')](0x194);}return _0x21d9b7;};}function handleError(_0x222557,_0x5cf1e5){_0x5cf1e5=_0x5cf1e5||0x1f4;return function(_0x86bf80){logger[_0x04ab('0x25')](_0x86bf80[_0x04ab('0x26')]);if(_0x86bf80[_0x04ab('0x27')]){delete _0x86bf80['name'];}_0x222557['status'](_0x5cf1e5)[_0x04ab('0x28')](_0x86bf80);};}exports['show']=function(_0x404eae,_0x30db64){var _0x2e069d={'raw':!![],'where':{'id':_0x404eae[_0x04ab('0x29')]['id']}},_0x3c25fb={};_0x3c25fb['model']=_['keys'](db[_0x04ab('0x2a')][_0x04ab('0x2b')]);_0x3c25fb[_0x04ab('0x2c')]=_[_0x04ab('0x2d')](_0x404eae[_0x04ab('0x2c')]);_0x3c25fb[_0x04ab('0x2e')]=_[_0x04ab('0x2f')](_0x3c25fb[_0x04ab('0x30')],_0x3c25fb[_0x04ab('0x2c')]);_0x2e069d[_0x04ab('0x31')]=_[_0x04ab('0x2f')](_0x3c25fb[_0x04ab('0x30')],qs[_0x04ab('0x32')](_0x404eae['query'][_0x04ab('0x32')]));_0x2e069d[_0x04ab('0x31')]=_0x2e069d['attributes'][_0x04ab('0x33')]?_0x2e069d[_0x04ab('0x31')]:_0x3c25fb['model'];if(_0x404eae[_0x04ab('0x2c')][_0x04ab('0x34')]){_0x2e069d['include']=[{'all':!![]}];}_0x2e069d=_[_0x04ab('0x35')]({},_0x2e069d,_0x404eae[_0x04ab('0x36')]);return db[_0x04ab('0x2a')][_0x04ab('0x37')](_0x2e069d)[_0x04ab('0x23')](handleEntityNotFound(_0x30db64,null))[_0x04ab('0x23')](respondWithResult(_0x30db64,null))['catch'](handleError(_0x30db64,null));};exports[_0x04ab('0x38')]=function(_0x3f4d83,_0x2ad8ee){return db['ChatProactiveAction'][_0x04ab('0x38')](_0x3f4d83['body'],{})['then'](respondWithResult(_0x2ad8ee,0xc9))[_0x04ab('0x39')](handleError(_0x2ad8ee,null));};exports[_0x04ab('0x3a')]=function(_0x5569ba,_0x40995c){if(_0x5569ba['body']['id']){delete _0x5569ba[_0x04ab('0x3b')]['id'];}return db[_0x04ab('0x2a')][_0x04ab('0x37')]({'where':{'id':_0x5569ba[_0x04ab('0x29')]['id']}})[_0x04ab('0x23')](handleEntityNotFound(_0x40995c,null))[_0x04ab('0x23')](saveUpdates(_0x5569ba[_0x04ab('0x3b')],null))[_0x04ab('0x23')](respondWithResult(_0x40995c,null))[_0x04ab('0x39')](handleError(_0x40995c,null));};exports[_0x04ab('0x22')]=function(_0x2b79f8,_0x3f145){return db['ChatProactiveAction'][_0x04ab('0x37')]({'where':{'id':_0x2b79f8[_0x04ab('0x29')]['id']}})['then'](handleEntityNotFound(_0x3f145,null))['then'](removeEntity(_0x3f145,null))[_0x04ab('0x39')](handleError(_0x3f145,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index ca29a80..a6564c8 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 _0x569d=['rimraf','../../config/environment','./chatProactiveAction.attributes','exports','ChatProactiveAction','lodash','moment','bluebird','request-promise','path'];(function(_0x38854e,_0x23cbc9){var _0x3f8415=function(_0x4e493e){while(--_0x4e493e){_0x38854e['push'](_0x38854e['shift']());}};_0x3f8415(++_0x23cbc9);}(_0x569d,0x1db));var _0xd569=function(_0xa72931,_0x37d87a){_0xa72931=_0xa72931-0x0;var _0x13b2f5=_0x569d[_0xa72931];return _0x13b2f5;};'use strict';var _=require(_0xd569('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xd569('0x1'));var BPromise=require(_0xd569('0x2'));var rp=require(_0xd569('0x3'));var fs=require('fs');var path=require(_0xd569('0x4'));var rimraf=require(_0xd569('0x5'));var config=require(_0xd569('0x6'));var attributes=require(_0xd569('0x7'));module[_0xd569('0x8')]=function(_0x4814ee,_0xd2a87b){return _0x4814ee['define'](_0xd569('0x9'),attributes,{'tableName':'chat_proactive_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcfe1=['exports','define','chat_proactive_actions','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./chatProactiveAction.attributes'];(function(_0x26bafe,_0x13e506){var _0x307879=function(_0x5a1548){while(--_0x5a1548){_0x26bafe['push'](_0x26bafe['shift']());}};_0x307879(++_0x13e506);}(_0xcfe1,0xdb));var _0x1cfe=function(_0x255b87,_0x4cd7d6){_0x255b87=_0x255b87-0x0;var _0x6e624e=_0xcfe1[_0x255b87];return _0x6e624e;};'use strict';var _=require(_0x1cfe('0x0'));var util=require(_0x1cfe('0x1'));var logger=require(_0x1cfe('0x2'))('api');var moment=require(_0x1cfe('0x3'));var BPromise=require(_0x1cfe('0x4'));var rp=require(_0x1cfe('0x5'));var fs=require('fs');var path=require(_0x1cfe('0x6'));var rimraf=require('rimraf');var config=require(_0x1cfe('0x7'));var attributes=require(_0x1cfe('0x8'));module[_0x1cfe('0x9')]=function(_0x33768a,_0x5d6f59){return _0x33768a[_0x1cfe('0xa')]('ChatProactiveAction',attributes,{'tableName':_0x1cfe('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.rpc.js b/server/api/chatProactiveAction/chatProactiveAction.rpc.js index 7426787..805630c 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 _0xdb73=['stringify','error','code','message','ChatProactiveAction,\x20%s,\x20%s','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s'];(function(_0x438685,_0x4ec0c0){var _0x41cca2=function(_0x532003){while(--_0x532003){_0x438685['push'](_0x438685['shift']());}};_0x41cca2(++_0x4ec0c0);}(_0xdb73,0x100));var _0x3db7=function(_0x55de3d,_0x5a01ef){_0x55de3d=_0x55de3d-0x0;var _0x3a6e87=_0xdb73[_0x55de3d];return _0x3a6e87;};'use strict';var _=require('lodash');var util=require(_0x3db7('0x0'));var moment=require(_0x3db7('0x1'));var BPromise=require(_0x3db7('0x2'));var rs=require(_0x3db7('0x3'));var fs=require('fs');var Redis=require(_0x3db7('0x4'));var db=require(_0x3db7('0x5'))['db'];var utils=require(_0x3db7('0x6'));var logger=require(_0x3db7('0x7'))(_0x3db7('0x8'));var config=require(_0x3db7('0x9'));var jayson=require(_0x3db7('0xa'));var client=jayson[_0x3db7('0xb')][_0x3db7('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x59a6db,_0x1a2a56,_0x1514d1){return new BPromise(function(_0xeaa09,_0x3fcd4d){return client[_0x3db7('0xd')](_0x59a6db,_0x1514d1)[_0x3db7('0xe')](function(_0x2e3b96){logger[_0x3db7('0xf')]('ChatProactiveAction,\x20%s,\x20%s',_0x1a2a56,_0x3db7('0x10'));logger[_0x3db7('0x11')](_0x3db7('0x12'),_0x1a2a56,'request\x20sent',JSON[_0x3db7('0x13')](_0x2e3b96));if(_0x2e3b96[_0x3db7('0x14')]){if(_0x2e3b96[_0x3db7('0x14')][_0x3db7('0x15')]===0x1f4){logger[_0x3db7('0x14')]('ChatProactiveAction,\x20%s,\x20%s',_0x1a2a56,_0x2e3b96[_0x3db7('0x14')][_0x3db7('0x16')]);return _0x3fcd4d(_0x2e3b96[_0x3db7('0x14')][_0x3db7('0x16')]);}logger['error'](_0x3db7('0x17'),_0x1a2a56,_0x2e3b96[_0x3db7('0x14')][_0x3db7('0x16')]);return _0xeaa09(_0x2e3b96[_0x3db7('0x14')][_0x3db7('0x16')]);}else{logger[_0x3db7('0xf')](_0x3db7('0x17'),_0x1a2a56,_0x3db7('0x10'));_0xeaa09(_0x2e3b96[_0x3db7('0x18')]['message']);}})['catch'](function(_0x3b1b87){logger['error'](_0x3db7('0x17'),_0x1a2a56,_0x3b1b87);_0x3fcd4d(_0x3b1b87);});});} \ No newline at end of file +var _0x2dd9=['result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','error','code','ChatProactiveAction,\x20%s,\x20%s','message'];(function(_0x42832b,_0x5ed47f){var _0x54a0a0=function(_0x53c150){while(--_0x53c150){_0x42832b['push'](_0x42832b['shift']());}};_0x54a0a0(++_0x5ed47f);}(_0x2dd9,0xd9));var _0x92dd=function(_0x4d5812,_0x27a69c){_0x4d5812=_0x4d5812-0x0;var _0x5649ef=_0x2dd9[_0x4d5812];return _0x5649ef;};'use strict';var _=require(_0x92dd('0x0'));var util=require(_0x92dd('0x1'));var moment=require(_0x92dd('0x2'));var BPromise=require(_0x92dd('0x3'));var rs=require(_0x92dd('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x92dd('0x5'))['db'];var utils=require(_0x92dd('0x6'));var logger=require(_0x92dd('0x7'))(_0x92dd('0x8'));var config=require(_0x92dd('0x9'));var jayson=require(_0x92dd('0xa'));var client=jayson[_0x92dd('0xb')][_0x92dd('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x24c604,_0x1a5ce4,_0x34ed71){return new BPromise(function(_0x1cce7a,_0x2d5b4d){return client[_0x92dd('0xd')](_0x24c604,_0x34ed71)[_0x92dd('0xe')](function(_0x313b4c){logger[_0x92dd('0xf')]('ChatProactiveAction,\x20%s,\x20%s',_0x1a5ce4,_0x92dd('0x10'));logger[_0x92dd('0x11')](_0x92dd('0x12'),_0x1a5ce4,'request\x20sent',JSON['stringify'](_0x313b4c));if(_0x313b4c[_0x92dd('0x13')]){if(_0x313b4c[_0x92dd('0x13')][_0x92dd('0x14')]===0x1f4){logger[_0x92dd('0x13')](_0x92dd('0x15'),_0x1a5ce4,_0x313b4c[_0x92dd('0x13')]['message']);return _0x2d5b4d(_0x313b4c['error']['message']);}logger[_0x92dd('0x13')]('ChatProactiveAction,\x20%s,\x20%s',_0x1a5ce4,_0x313b4c[_0x92dd('0x13')][_0x92dd('0x16')]);return _0x1cce7a(_0x313b4c['error'][_0x92dd('0x16')]);}else{logger[_0x92dd('0xf')](_0x92dd('0x15'),_0x1a5ce4,_0x92dd('0x10'));_0x1cce7a(_0x313b4c[_0x92dd('0x17')]['message']);}})['catch'](function(_0x3013f2){logger[_0x92dd('0x13')]('ChatProactiveAction,\x20%s,\x20%s',_0x1a5ce4,_0x3013f2);_0x2d5b4d(_0x3013f2);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 934c784..f327df7 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(_0x3523cb,_0x511b5c){var _0x54efd9=function(_0x48ee79){while(--_0x48ee79){_0x3523cb['push'](_0x3523cb['shift']());}};_0x54efd9(++_0x511b5c);}(_0x31f0,0xb7));var _0x031f=function(_0x33f597,_0x1a4740){_0x33f597=_0x33f597-0x0;var _0x5af88a=_0x31f0[_0x33f597];return _0x5af88a;};'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 _0xabce=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','/:id','show','isAuthenticated','create','put'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xabce,0x103));var _0xeabc=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xabce[_0xea8947];return _0x2455e9;};'use strict';var multer=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var path=require(_0xeabc('0x2'));var timeout=require(_0xeabc('0x3'));var express=require(_0xeabc('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xeabc('0x5'));var interaction=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var controller=require('./chatProactiveAction.controller');router['get'](_0xeabc('0x8'),auth['isAuthenticated'](),controller[_0xeabc('0x9')]);router['post']('/',auth[_0xeabc('0xa')](),controller[_0xeabc('0xb')]);router[_0xeabc('0xc')]('/:id',auth[_0xeabc('0xa')](),controller[_0xeabc('0xd')]);router[_0xeabc('0xe')](_0xeabc('0x8'),auth[_0xeabc('0xa')](),controller[_0xeabc('0xf')]);module[_0xeabc('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index b0d3d26..e1327ef 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 _0x2a20=['INTEGER','rrmemory','beepall','roundrobin','name'];(function(_0x485d1,_0x3b09d4){var _0x749fff=function(_0x3fce9e){while(--_0x3fce9e){_0x485d1['push'](_0x485d1['shift']());}};_0x749fff(++_0x3b09d4);}(_0x2a20,0x1ee));var _0x02a2=function(_0x863359,_0x257cea){_0x863359=_0x863359-0x0;var _0xc3e3b8=_0x2a20[_0x863359];return _0xc3e3b8;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x02a2('0x0'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x02a2('0x1')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x02a2('0x2'),_0x02a2('0x3'),_0x02a2('0x4'))}}; \ No newline at end of file +var _0x4880=['ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING','name','INTEGER'];(function(_0x20600f,_0x2e573e){var _0x2cdbec=function(_0x2dfc5b){while(--_0x2dfc5b){_0x20600f['push'](_0x20600f['shift']());}};_0x2cdbec(++_0x2e573e);}(_0x4880,0xb8));var _0x0488=function(_0x5c9023,_0x56d6d9){_0x5c9023=_0x5c9023-0x0;var _0x56efd0=_0x4880[_0x5c9023];return _0x56efd0;};'use strict';var Sequelize=require(_0x0488('0x0'));module[_0x0488('0x1')]={'name':{'type':Sequelize[_0x0488('0x2')],'unique':_0x0488('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x0488('0x2')]},'timeout':{'type':Sequelize[_0x0488('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x0488('0x5')](_0x0488('0x6'),_0x0488('0x7'),_0x0488('0x8'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 4c871ee..c3dcfab 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 _0x0e49=['./chatQueue.socket','register','sendStatus','status','end','offset','undefined','count','set','Content-Range','update','destroy','then','get','ChatQueues','UserProfileResource','error','name','send','index','map','ChatQueue','fieldName','key','getOptions','where','include','query','findAll','rows','catch','params','keys','filters','intersection','model','attributes','length','includeAll','merge','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','autoAssociation','describe','findOne','rawAttributes','fields','nolimit','limit','order','pick','ChatQueueId','filter','User','findAndCountAll','chatPause','updatedAt','createdAt','format','SIP','Team','sort','getTeams','hasOwnProperty','addTeams','Agents','voicePause','interface','transaction','forEach','emit','userChatQueue:save','removeTeams','ids','field','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','isEmpty','removeAgents','addAgents','omit','userChatQueue:remove','getAgents','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','localhost'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0x0e49,0xdf));var _0x90e4=function(_0x358a0a,_0x4cffea){_0x358a0a=_0x358a0a-0x0;var _0x41a6ad=_0x0e49[_0x358a0a];return _0x41a6ad;};'use strict';var BPromise=require('bluebird');var util=require(_0x90e4('0x0'));var _=require(_0x90e4('0x1'));var squel=require(_0x90e4('0x2'));var Redis=require(_0x90e4('0x3'));var qs=require(_0x90e4('0x4'));var logger=require(_0x90e4('0x5'))(_0x90e4('0x6'));var config=require('../../config/environment');var db=require(_0x90e4('0x7'))['db'];config[_0x90e4('0x8')]=_[_0x90e4('0x9')](config[_0x90e4('0x8')],{'host':_0x90e4('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x90e4('0x8')]));require(_0x90e4('0xb'))[_0x90e4('0xc')](socket);function respondWithStatusCode(_0x68413c,_0x3c53bd){_0x3c53bd=_0x3c53bd||0xcc;return function(_0x437bf2){if(_0x437bf2){return _0x68413c[_0x90e4('0xd')](_0x3c53bd);}return _0x68413c[_0x90e4('0xe')](_0x3c53bd)[_0x90e4('0xf')]();};}function respondWithResult(_0x3b5070,_0xc8d954){_0xc8d954=_0xc8d954||0xc8;return function(_0xb5e50b){if(_0xb5e50b){return _0x3b5070[_0x90e4('0xe')](_0xc8d954)['json'](_0xb5e50b);}};}function respondWithFilteredResult(_0x1d6cfb,_0x2303ff){return function(_0x45d583){if(_0x45d583){var _0x3f09fb=typeof _0x2303ff[_0x90e4('0x10')]===_0x90e4('0x11')&&typeof _0x2303ff['limit']===_0x90e4('0x11');var _0x58d5d9=_0x45d583[_0x90e4('0x12')];var _0x2f88c0=_0x3f09fb?0x0:_0x2303ff[_0x90e4('0x10')];var _0xa876e7=_0x3f09fb?_0x45d583[_0x90e4('0x12')]:_0x2303ff['offset']+_0x2303ff['limit'];var _0x4c55d3;if(_0xa876e7>=_0x58d5d9){_0xa876e7=_0x58d5d9;_0x4c55d3=0xc8;}else{_0x4c55d3=0xce;}_0x1d6cfb[_0x90e4('0xe')](_0x4c55d3);return _0x1d6cfb[_0x90e4('0x13')](_0x90e4('0x14'),_0x2f88c0+'-'+_0xa876e7+'/'+_0x58d5d9)['json'](_0x45d583);}return null;};}function saveUpdates(_0x28f88c){return function(_0x354345){if(_0x354345){return _0x354345[_0x90e4('0x15')](_0x28f88c)['then'](function(_0x5b758a){return _0x5b758a;});}return null;};}function removeEntity(_0x4dedbc){return function(_0x5166e3){if(_0x5166e3){return _0x5166e3[_0x90e4('0x16')]()[_0x90e4('0x17')](function(){var _0x1ebb80=_0x5166e3[_0x90e4('0x18')]({'plain':!![]});var _0x4a731b=_0x90e4('0x19');return db[_0x90e4('0x1a')]['destroy']({'where':{'type':_0x4a731b,'resourceId':_0x1ebb80['id']}})[_0x90e4('0x17')](function(){return _0x5166e3;});})[_0x90e4('0x17')](function(){_0x4dedbc[_0x90e4('0xe')](0xcc)[_0x90e4('0xf')]();});}};}function handleEntityNotFound(_0x74fe1d){return function(_0x324893){if(!_0x324893){_0x74fe1d['sendStatus'](0x194);}return _0x324893;};}function handleError(_0x350d8f,_0x1b1f4c){_0x1b1f4c=_0x1b1f4c||0x1f4;return function(_0x4ea072){logger[_0x90e4('0x1b')](_0x4ea072['stack']);if(_0x4ea072['name']){delete _0x4ea072[_0x90e4('0x1c')];}_0x350d8f[_0x90e4('0xe')](_0x1b1f4c)[_0x90e4('0x1d')](_0x4ea072);};}exports[_0x90e4('0x1e')]=function(_0x35e72c,_0x139b5c){var _0x1d62f3={};var _0x300c9e={'count':0x0,'rows':[]};var _0x24f392=_[_0x90e4('0x1f')](db[_0x90e4('0x20')]['rawAttributes'],function(_0x39e473){return{'name':_0x39e473[_0x90e4('0x21')],'type':_0x39e473['type'][_0x90e4('0x22')]};});_0x1d62f3=qs[_0x90e4('0x23')](_0x24f392,_0x35e72c);var _0x326685={'where':_0x1d62f3[_0x90e4('0x24')]};return db[_0x90e4('0x20')][_0x90e4('0x12')](_0x326685)[_0x90e4('0x17')](function(_0x31af73){_0x300c9e[_0x90e4('0x12')]=_0x31af73;_0x1d62f3[_0x90e4('0x25')]=qs[_0x90e4('0x25')](_0x35e72c[_0x90e4('0x26')]);return db[_0x90e4('0x20')][_0x90e4('0x27')](_0x1d62f3);})[_0x90e4('0x17')](function(_0x3e1186){_0x300c9e[_0x90e4('0x28')]=_0x3e1186;return _0x300c9e;})[_0x90e4('0x17')](respondWithFilteredResult(_0x139b5c,_0x1d62f3))[_0x90e4('0x29')](handleError(_0x139b5c,null));};exports['show']=function(_0x500f01,_0x4e0d21){var _0x226bd2={'raw':!![],'where':{'id':_0x500f01[_0x90e4('0x2a')]['id']}},_0x5b5f2c={};_0x5b5f2c['model']=_['keys'](db[_0x90e4('0x20')]['rawAttributes']);_0x5b5f2c['query']=_[_0x90e4('0x2b')](_0x500f01[_0x90e4('0x26')]);_0x5b5f2c[_0x90e4('0x2c')]=_[_0x90e4('0x2d')](_0x5b5f2c[_0x90e4('0x2e')],_0x5b5f2c[_0x90e4('0x26')]);_0x226bd2[_0x90e4('0x2f')]=_[_0x90e4('0x2d')](_0x5b5f2c[_0x90e4('0x2e')],qs['fields'](_0x500f01[_0x90e4('0x26')]['fields']));_0x226bd2[_0x90e4('0x2f')]=_0x226bd2['attributes'][_0x90e4('0x30')]?_0x226bd2[_0x90e4('0x2f')]:_0x5b5f2c[_0x90e4('0x2e')];if(_0x500f01[_0x90e4('0x26')][_0x90e4('0x31')]){_0x226bd2[_0x90e4('0x25')]=[{'all':!![]}];}_0x226bd2=_[_0x90e4('0x32')]({},_0x226bd2,_0x500f01[_0x90e4('0x33')]);return db[_0x90e4('0x20')]['find'](_0x226bd2)[_0x90e4('0x17')](handleEntityNotFound(_0x4e0d21,null))[_0x90e4('0x17')](respondWithResult(_0x4e0d21,null))['catch'](handleError(_0x4e0d21,null));};exports[_0x90e4('0x34')]=function(_0x156285,_0x2f6555){return db['ChatQueue'][_0x90e4('0x34')](_0x156285[_0x90e4('0x35')],{})[_0x90e4('0x17')](function(_0x18f617){var _0x388c31=_0x156285[_0x90e4('0x36')][_0x90e4('0x18')]({'plain':!![]});if(!_0x388c31)throw new Error(_0x90e4('0x37'));if(_0x388c31['role']==='user'){var _0x4d9388=_0x18f617[_0x90e4('0x18')]({'plain':!![]});var _0x4b726f='ChatQueues';return db[_0x90e4('0x38')][_0x90e4('0x39')]({'where':{'name':_0x4b726f,'userProfileId':_0x388c31['userProfileId']},'raw':!![]})['then'](function(_0x376b5f){if(_0x376b5f&&_0x376b5f[_0x90e4('0x3a')]===0x0){return db[_0x90e4('0x1a')][_0x90e4('0x34')]({'name':_0x4d9388[_0x90e4('0x1c')],'resourceId':_0x4d9388['id'],'type':_0x376b5f[_0x90e4('0x1c')],'sectionId':_0x376b5f['id']},{})[_0x90e4('0x17')](function(){return _0x18f617;});}else{return _0x18f617;}})[_0x90e4('0x29')](function(_0xed2ece){logger[_0x90e4('0x1b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xed2ece);throw _0xed2ece;});}return _0x18f617;})[_0x90e4('0x17')](respondWithResult(_0x2f6555,0xc9))[_0x90e4('0x29')](handleError(_0x2f6555,null));};exports[_0x90e4('0x15')]=function(_0x5830ff,_0x29e52a){if(_0x5830ff[_0x90e4('0x35')]['id']){delete _0x5830ff[_0x90e4('0x35')]['id'];}return db[_0x90e4('0x20')][_0x90e4('0x39')]({'where':{'id':_0x5830ff[_0x90e4('0x2a')]['id']}})[_0x90e4('0x17')](handleEntityNotFound(_0x29e52a,null))[_0x90e4('0x17')](saveUpdates(_0x5830ff[_0x90e4('0x35')],null))['then'](respondWithResult(_0x29e52a,null))['catch'](handleError(_0x29e52a,null));};exports['destroy']=function(_0x4dc61f,_0x17f227){return db[_0x90e4('0x20')][_0x90e4('0x39')]({'where':{'id':_0x4dc61f[_0x90e4('0x2a')]['id']}})[_0x90e4('0x17')](handleEntityNotFound(_0x17f227,null))[_0x90e4('0x17')](removeEntity(_0x17f227,null))[_0x90e4('0x29')](handleError(_0x17f227,null));};exports[_0x90e4('0x3b')]=function(_0x3cf092,_0x41f87c){return db['ChatQueue'][_0x90e4('0x3b')]()[_0x90e4('0x17')](respondWithResult(_0x41f87c,null))['catch'](handleError(_0x41f87c,null));};exports['getMembers']=function(_0x3e1c46,_0x124190){var _0x45d016={'raw':!![],'where':{}},_0x27a1b3={},_0x1a7928;return db[_0x90e4('0x20')][_0x90e4('0x3c')]({'where':{'id':_0x3e1c46[_0x90e4('0x2a')]['id']}})['then'](handleEntityNotFound(_0x124190,null))[_0x90e4('0x17')](function(_0x33f9af){if(_0x33f9af){_0x1a7928=_0x33f9af[_0x90e4('0x18')]({'plain':!![]});_0x27a1b3[_0x90e4('0x2e')]=_[_0x90e4('0x2b')](db['UserChatQueue'][_0x90e4('0x3d')]);_0x27a1b3['query']=_['keys'](_0x3e1c46[_0x90e4('0x26')]);_0x27a1b3[_0x90e4('0x2c')]=_[_0x90e4('0x2d')](_0x27a1b3[_0x90e4('0x2e')],_0x27a1b3[_0x90e4('0x26')]);_0x45d016[_0x90e4('0x2f')]=_[_0x90e4('0x2d')](_0x27a1b3[_0x90e4('0x2e')],qs[_0x90e4('0x3e')](_0x3e1c46[_0x90e4('0x26')]['fields']));_0x45d016[_0x90e4('0x2f')]=_0x45d016[_0x90e4('0x2f')][_0x90e4('0x30')]?_0x45d016[_0x90e4('0x2f')]:_0x27a1b3['model'];if(!_0x3e1c46[_0x90e4('0x26')]['hasOwnProperty'](_0x90e4('0x3f'))){_0x45d016[_0x90e4('0x40')]=qs[_0x90e4('0x40')](_0x3e1c46[_0x90e4('0x26')]['limit']);_0x45d016['offset']=qs[_0x90e4('0x10')](_0x3e1c46['query'][_0x90e4('0x10')]);}_0x45d016[_0x90e4('0x41')]=qs['sort'](_0x3e1c46[_0x90e4('0x26')]['sort']);_0x45d016['where']=qs['filters'](_[_0x90e4('0x42')](_0x3e1c46['query'],_0x27a1b3['filters']));_0x45d016[_0x90e4('0x24')][_0x90e4('0x43')]=_0x33f9af['id'];if(_0x3e1c46['query'][_0x90e4('0x44')]){_0x45d016['where']=_['merge'](_0x45d016['where'],{'$or':_[_0x90e4('0x1f')](_0x45d016[_0x90e4('0x2f')],function(_0xdb3bd1){var _0xe201ad={};_0xe201ad[_0xdb3bd1]={'$like':'%'+_0x3e1c46['query'][_0x90e4('0x44')]+'%'};return _0xe201ad;})});}_0x45d016=_[_0x90e4('0x32')]({},_0x45d016,_0x3e1c46[_0x90e4('0x33')]);return db['UserChatQueue'][_0x90e4('0x27')](_0x45d016);}})[_0x90e4('0x17')](function(_0x42bc77){if(_0x42bc77){return db[_0x90e4('0x45')][_0x90e4('0x46')]({'where':{'id':_[_0x90e4('0x1f')](_0x42bc77,'UserId'),'role':'agent'},'attributes':['id',_0x90e4('0x1c'),_0x90e4('0x47'),_0x90e4('0x48'),_0x90e4('0x49')]});}})[_0x90e4('0x17')](function(_0x1f6133){if(_0x1f6133){return{'count':_0x1f6133[_0x90e4('0x12')],'rows':_['map'](_0x1f6133['rows'],function(_0x1ccc45){return{'membername':_0x1ccc45[_0x90e4('0x1c')],'UserId':_0x1ccc45['id'],'queue_name':_0x1a7928['name'],'ChatQueueId':_0x1a7928['id'],'interface':util[_0x90e4('0x4a')]('%s/%s',_0x90e4('0x4b'),_0x1ccc45[_0x90e4('0x1c')]),'penalty':0x0,'paused':_0x1ccc45[_0x90e4('0x47')],'createdAt':_0x1ccc45[_0x90e4('0x49')],'updatedAt':_0x1ccc45['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x90e4('0x17')](respondWithFilteredResult(_0x124190,_0x45d016))['catch'](handleError(_0x124190,null));};exports['getTeams']=function(_0x53aeb7,_0xb8b813){var _0x284a6a={};var _0x3d5e29={};var _0x442415;var _0x274ce6;return db['ChatQueue']['findOne']({'where':{'id':_0x53aeb7[_0x90e4('0x2a')]['id']}})[_0x90e4('0x17')](handleEntityNotFound(_0xb8b813,null))[_0x90e4('0x17')](function(_0xbd20f){if(_0xbd20f){_0x442415=_0xbd20f;_0x3d5e29[_0x90e4('0x2e')]=_[_0x90e4('0x2b')](db[_0x90e4('0x4c')]['rawAttributes']);_0x3d5e29[_0x90e4('0x26')]=_[_0x90e4('0x2b')](_0x53aeb7[_0x90e4('0x26')]);_0x3d5e29['filters']=_[_0x90e4('0x2d')](_0x3d5e29[_0x90e4('0x2e')],_0x3d5e29[_0x90e4('0x26')]);_0x284a6a[_0x90e4('0x2f')]=_['intersection'](_0x3d5e29['model'],qs['fields'](_0x53aeb7[_0x90e4('0x26')][_0x90e4('0x3e')]));_0x284a6a[_0x90e4('0x2f')]=_0x284a6a[_0x90e4('0x2f')][_0x90e4('0x30')]?_0x284a6a[_0x90e4('0x2f')]:_0x3d5e29[_0x90e4('0x2e')];_0x284a6a[_0x90e4('0x41')]=qs[_0x90e4('0x4d')](_0x53aeb7['query'][_0x90e4('0x4d')]);_0x284a6a[_0x90e4('0x24')]=qs[_0x90e4('0x2c')](_[_0x90e4('0x42')](_0x53aeb7['query'],_0x3d5e29[_0x90e4('0x2c')]));if(_0x53aeb7['query'][_0x90e4('0x44')]){_0x284a6a[_0x90e4('0x24')]=_[_0x90e4('0x32')](_0x284a6a[_0x90e4('0x24')],{'$or':_['map'](_0x284a6a[_0x90e4('0x2f')],function(_0x469bda){var _0x5d5852={};_0x5d5852[_0x469bda]={'$like':'%'+_0x53aeb7[_0x90e4('0x26')]['filter']+'%'};return _0x5d5852;})});}_0x284a6a=_[_0x90e4('0x32')]({},_0x284a6a,_0x53aeb7['options']);return _0x442415[_0x90e4('0x4e')](_0x284a6a);}})[_0x90e4('0x17')](function(_0x5ec0df){if(_0x5ec0df){_0x274ce6=_0x5ec0df[_0x90e4('0x30')];if(!_0x53aeb7[_0x90e4('0x26')][_0x90e4('0x4f')](_0x90e4('0x3f'))){_0x284a6a[_0x90e4('0x40')]=qs[_0x90e4('0x40')](_0x53aeb7['query'][_0x90e4('0x40')]);_0x284a6a[_0x90e4('0x10')]=qs['offset'](_0x53aeb7['query']['offset']);}return _0x442415[_0x90e4('0x4e')](_0x284a6a);}})[_0x90e4('0x17')](function(_0x526813){if(_0x526813){return _0x526813?{'count':_0x274ce6,'rows':_0x526813}:null;}})['then'](respondWithResult(_0xb8b813,null))['catch'](handleError(_0xb8b813,null));};exports[_0x90e4('0x50')]=function(_0x32c3ab,_0x31baf8){var _0x125d56=_0x32c3ab[_0x90e4('0x35')]['ids'];return db[_0x90e4('0x4c')][_0x90e4('0x27')]({'where':{'id':_0x125d56},'attributes':['id'],'include':[{'model':db['User'],'as':_0x90e4('0x51'),'attributes':['id','name','online',_0x90e4('0x52'),_0x90e4('0x53')],'raw':!![]}]})[_0x90e4('0x17')](function(_0x14e758){if(_0x14e758){var _0x5be148=_['flatMap'](_0x14e758,function(_0x41f8bc){var _0x52a0c6=_0x41f8bc['get']({'plain':!![]});return _0x52a0c6[_0x90e4('0x51')];});return db[_0x90e4('0x20')][_0x90e4('0x39')]({'where':{'id':_0x32c3ab[_0x90e4('0x2a')]['id']}})[_0x90e4('0x17')](function(_0x5db705){return db['sequelize'][_0x90e4('0x54')](function(_0xdc8322){return _0x5db705[_0x90e4('0x50')](_0x125d56,{'transaction':_0xdc8322})[_0x90e4('0x17')](function(){return BPromise['each'](_0x5be148,function(_0x34ac78){return db['UserChatQueue']['findOrCreate']({'where':{'UserId':_0x34ac78['id'],'ChatQueueId':_0x32c3ab[_0x90e4('0x2a')]['id']},'transaction':_0xdc8322});});})[_0x90e4('0x17')](function(){_0x5be148[_0x90e4('0x55')](function(_0x1217bb){socket[_0x90e4('0x56')](_0x90e4('0x57'),{'UserId':_0x1217bb['id'],'ChatQueueId':_0x5db705['id']});});});});});}})[_0x90e4('0x17')](respondWithStatusCode(_0x31baf8,null))['catch'](handleError(_0x31baf8,null));};exports[_0x90e4('0x58')]=function(_0x3e27b6,_0x373457){return db[_0x90e4('0x4c')][_0x90e4('0x27')]({'where':{'id':_0x3e27b6[_0x90e4('0x26')][_0x90e4('0x59')]},'attributes':['id'],'include':[{'model':db[_0x90e4('0x45')],'as':_0x90e4('0x51'),'attributes':['id'],'raw':!![]}]})[_0x90e4('0x17')](handleEntityNotFound(_0x373457,null))[_0x90e4('0x17')](function(_0x52c6ed){var _0x23a8d3=_[_0x90e4('0x1f')](_0x52c6ed,'id');var _0x5b9000=[];var _0x13fdcd=[];var _0x200690=squel['select']();_0x200690[_0x90e4('0x5a')](_0x90e4('0x5b'))[_0x90e4('0x5c')](_0x90e4('0x5d'),'tq')[_0x90e4('0x5e')](_0x90e4('0x5f'),'ut',_0x90e4('0x60'))[_0x90e4('0x24')](_0x90e4('0x61'),_0x3e27b6[_0x90e4('0x2a')]['id']);for(var _0x502316=0x0;_0x502316<_0x52c6ed[_0x90e4('0x30')];_0x502316+=0x1){let _0x5c33ad=_0x52c6ed[_0x502316];for(var _0x40dc4e=0x0;_0x40dc4e<_0x5c33ad['Agents'][_0x90e4('0x30')];_0x40dc4e+=0x1){let _0x58875f=_0x5c33ad[_0x90e4('0x51')][_0x40dc4e];var _0x1ca911=_0x200690[_0x90e4('0x62')]();_0x1ca911[_0x90e4('0x24')](_0x90e4('0x63'),_0x58875f['id']);_0x13fdcd[_0x90e4('0x64')](db[_0x90e4('0x65')][_0x90e4('0x26')](_0x1ca911[_0x90e4('0x66')](),{'type':db[_0x90e4('0x65')][_0x90e4('0x67')][_0x90e4('0x68')]})[_0x90e4('0x17')](function(_0x1190f5){if(_0x1190f5[_0x90e4('0x30')]===0x1){return _0x58875f['id'];}else{var _0x27fdd3=_[_0x90e4('0x69')](_[_0x90e4('0x1f')](_0x1190f5,_0x90e4('0x6a')),function(_0x2ab97a){return _[_0x90e4('0x6b')](_0x23a8d3,_0x2ab97a);});if(_0x27fdd3){return _0x58875f['id'];}}}));}}return BPromise[_0x90e4('0x6c')](_0x13fdcd)[_0x90e4('0x17')](function(_0x533dbb){_0x5b9000=_(_0x5b9000)[_0x90e4('0x6d')](_0x533dbb)[_0x90e4('0x6e')]()['value']();return db[_0x90e4('0x20')][_0x90e4('0x39')]({'where':{'id':_0x3e27b6[_0x90e4('0x2a')]['id']}})[_0x90e4('0x17')](function(_0x1b89b9){return db[_0x90e4('0x65')][_0x90e4('0x54')](function(_0x4c8d24){return _0x1b89b9[_0x90e4('0x58')](_0x3e27b6[_0x90e4('0x26')][_0x90e4('0x59')],{'transaction':_0x4c8d24})[_0x90e4('0x17')](function(){if(!_[_0x90e4('0x6f')](_0x5b9000)){return _0x1b89b9[_0x90e4('0x70')](_0x5b9000,{'transaction':_0x4c8d24});}})[_0x90e4('0x17')](function(){_0x5b9000[_0x90e4('0x55')](function(_0x1a6aa9){socket['emit']('userChatQueue:remove',{'UserId':_0x1a6aa9,'ChatQueueId':_0x1b89b9['id']});});});});});});})[_0x90e4('0x17')](respondWithStatusCode(_0x373457,null))[_0x90e4('0x29')](handleError(_0x373457,null));};exports[_0x90e4('0x71')]=function(_0x4258e7,_0x221585){return db[_0x90e4('0x20')][_0x90e4('0x39')]({'where':{'id':_0x4258e7[_0x90e4('0x2a')]['id']}})['then'](handleEntityNotFound(_0x221585,null))[_0x90e4('0x17')](function(_0x554ddb){if(_0x554ddb){return _0x554ddb['addAgents'](_0x4258e7[_0x90e4('0x35')][_0x90e4('0x59')],_[_0x90e4('0x72')](_0x4258e7[_0x90e4('0x35')],[_0x90e4('0x59'),'id'])||{})['spread'](function(_0x3032f1){for(var _0x31df06=0x0;_0x31df06<_0x4258e7[_0x90e4('0x35')][_0x90e4('0x59')][_0x90e4('0x30')];_0x31df06+=0x1){socket[_0x90e4('0x56')](_0x90e4('0x57'),{'UserId':Number(_0x4258e7[_0x90e4('0x35')][_0x90e4('0x59')][_0x31df06]),'ChatQueueId':Number(_0x4258e7[_0x90e4('0x2a')]['id'])});}return _0x3032f1;});}})[_0x90e4('0x17')](respondWithResult(_0x221585,null))['catch'](handleError(_0x221585,null));};exports['removeAgents']=function(_0x4ddb79,_0x50d507){return db[_0x90e4('0x20')][_0x90e4('0x39')]({'where':{'id':_0x4ddb79['params']['id']}})[_0x90e4('0x17')](handleEntityNotFound(_0x50d507,null))[_0x90e4('0x17')](function(_0x3a7d78){if(_0x3a7d78){return _0x3a7d78['removeAgents'](_0x4ddb79[_0x90e4('0x26')][_0x90e4('0x59')])[_0x90e4('0x17')](function(){if(_['isArray'](_0x4ddb79[_0x90e4('0x26')][_0x90e4('0x59')])){for(var _0x5d884b=0x0;_0x5d884b<_0x4ddb79[_0x90e4('0x26')][_0x90e4('0x59')]['length'];_0x5d884b+=0x1){socket[_0x90e4('0x56')](_0x90e4('0x73'),{'UserId':Number(_0x4ddb79[_0x90e4('0x26')][_0x90e4('0x59')][_0x5d884b]),'ChatQueueId':Number(_0x4ddb79[_0x90e4('0x2a')]['id'])});}}else{socket['emit'](_0x90e4('0x73'),{'UserId':Number(_0x4ddb79[_0x90e4('0x26')]['ids']),'ChatQueueId':Number(_0x4ddb79[_0x90e4('0x2a')]['id'])});}});}})['then'](respondWithStatusCode(_0x50d507,null))[_0x90e4('0x29')](handleError(_0x50d507,null));};exports[_0x90e4('0x74')]=function(_0xfab436,_0x1f1db5){var _0x522c39={};var _0x136dbe={};var _0x452e22;var _0x3eb789;return db[_0x90e4('0x20')]['findOne']({'where':{'id':_0xfab436['params']['id']}})['then'](handleEntityNotFound(_0x1f1db5,null))['then'](function(_0x15aa34){if(_0x15aa34){_0x452e22=_0x15aa34;_0x136dbe[_0x90e4('0x2e')]=_[_0x90e4('0x2b')](db[_0x90e4('0x45')]['rawAttributes']);_0x136dbe['query']=_[_0x90e4('0x2b')](_0xfab436['query']);_0x136dbe['filters']=_[_0x90e4('0x2d')](_0x136dbe[_0x90e4('0x2e')],_0x136dbe[_0x90e4('0x26')]);_0x522c39[_0x90e4('0x2f')]=_[_0x90e4('0x2d')](_0x136dbe[_0x90e4('0x2e')],qs[_0x90e4('0x3e')](_0xfab436[_0x90e4('0x26')][_0x90e4('0x3e')]));_0x522c39[_0x90e4('0x2f')]=_0x522c39['attributes'][_0x90e4('0x30')]?_0x522c39[_0x90e4('0x2f')]:_0x136dbe[_0x90e4('0x2e')];_0x522c39[_0x90e4('0x41')]=qs[_0x90e4('0x4d')](_0xfab436['query'][_0x90e4('0x4d')]);_0x522c39['where']=qs['filters'](_[_0x90e4('0x42')](_0xfab436[_0x90e4('0x26')],_0x136dbe['filters']));if(_0xfab436[_0x90e4('0x26')]['filter']){_0x522c39['where']=_[_0x90e4('0x32')](_0x522c39[_0x90e4('0x24')],{'$or':_[_0x90e4('0x1f')](_0x522c39['attributes'],function(_0x4fd78c){var _0x309ff2={};_0x309ff2[_0x4fd78c]={'$like':'%'+_0xfab436[_0x90e4('0x26')][_0x90e4('0x44')]+'%'};return _0x309ff2;})});}_0x522c39=_[_0x90e4('0x32')]({},_0x522c39,_0xfab436[_0x90e4('0x33')]);return _0x452e22['getAgents'](_0x522c39);}})[_0x90e4('0x17')](function(_0x1fcc9a){if(_0x1fcc9a){_0x3eb789=_0x1fcc9a[_0x90e4('0x30')];if(!_0xfab436[_0x90e4('0x26')][_0x90e4('0x4f')]('nolimit')){_0x522c39[_0x90e4('0x40')]=qs[_0x90e4('0x40')](_0xfab436['query'][_0x90e4('0x40')]);_0x522c39['offset']=qs[_0x90e4('0x10')](_0xfab436[_0x90e4('0x26')][_0x90e4('0x10')]);}return _0x452e22[_0x90e4('0x74')](_0x522c39);}})[_0x90e4('0x17')](function(_0x193742){if(_0x193742){return _0x193742?{'count':_0x3eb789,'rows':_0x193742}:null;}})[_0x90e4('0x17')](respondWithResult(_0x1f1db5,null))['catch'](handleError(_0x1f1db5,null));}; \ No newline at end of file +var _0x594b=['stack','name','send','index','map','ChatQueue','rawAttributes','type','key','getOptions','include','query','rows','catch','show','params','model','keys','attributes','intersection','fields','length','options','find','create','body','user','get','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','findOne','UserChatQueue','filters','hasOwnProperty','order','sort','where','pick','filter','merge','User','findAndCountAll','UserId','agent','chatPause','updatedAt','format','%s/%s','createdAt','getTeams','Team','nolimit','addTeams','ids','findAll','Agents','interface','flatMap','sequelize','findOrCreate','emit','userChatQueue:save','select','tq.TeamId','team_has_chat_queues','join','ut.TeamId\x20=\x20tq.TeamId','clone','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','removeTeams','removeAgents','userChatQueue:remove','addAgents','spread','isArray','getAgents','bluebird','lodash','squel','../../components/parsers/qs','api','../../config/environment','redis','defaults','localhost','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','then','destroy','ChatQueues','UserProfileResource'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x594b,0x147));var _0xb594=function(_0x523525,_0x58a8c5){_0x523525=_0x523525-0x0;var _0x3f42bb=_0x594b[_0x523525];return _0x3f42bb;};'use strict';var BPromise=require(_0xb594('0x0'));var util=require('util');var _=require(_0xb594('0x1'));var squel=require(_0xb594('0x2'));var Redis=require('ioredis');var qs=require(_0xb594('0x3'));var logger=require('../../config/logger')(_0xb594('0x4'));var config=require(_0xb594('0x5'));var db=require('../../mysqldb')['db'];config[_0xb594('0x6')]=_[_0xb594('0x7')](config['redis'],{'host':_0xb594('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb594('0x6')]));require('./chatQueue.socket')[_0xb594('0x9')](socket);function respondWithStatusCode(_0x2512fb,_0x254660){_0x254660=_0x254660||0xcc;return function(_0x9574dd){if(_0x9574dd){return _0x2512fb[_0xb594('0xa')](_0x254660);}return _0x2512fb[_0xb594('0xb')](_0x254660)[_0xb594('0xc')]();};}function respondWithResult(_0x183ae0,_0x3242a5){_0x3242a5=_0x3242a5||0xc8;return function(_0x5af4f6){if(_0x5af4f6){return _0x183ae0['status'](_0x3242a5)['json'](_0x5af4f6);}};}function respondWithFilteredResult(_0x15a7a7,_0x33d363){return function(_0x492459){if(_0x492459){var _0x43c12e=typeof _0x33d363[_0xb594('0xd')]===_0xb594('0xe')&&typeof _0x33d363[_0xb594('0xf')]==='undefined';var _0x575e1e=_0x492459[_0xb594('0x10')];var _0xcb6387=_0x43c12e?0x0:_0x33d363[_0xb594('0xd')];var _0x822e08=_0x43c12e?_0x492459[_0xb594('0x10')]:_0x33d363['offset']+_0x33d363['limit'];var _0x416611;if(_0x822e08>=_0x575e1e){_0x822e08=_0x575e1e;_0x416611=0xc8;}else{_0x416611=0xce;}_0x15a7a7[_0xb594('0xb')](_0x416611);return _0x15a7a7[_0xb594('0x11')](_0xb594('0x12'),_0xcb6387+'-'+_0x822e08+'/'+_0x575e1e)[_0xb594('0x13')](_0x492459);}return null;};}function saveUpdates(_0x18f6b0){return function(_0x4be4b1){if(_0x4be4b1){return _0x4be4b1['update'](_0x18f6b0)[_0xb594('0x14')](function(_0x4e2f70){return _0x4e2f70;});}return null;};}function removeEntity(_0x149b99){return function(_0x22acf8){if(_0x22acf8){return _0x22acf8[_0xb594('0x15')]()[_0xb594('0x14')](function(){var _0x59eef2=_0x22acf8['get']({'plain':!![]});var _0x2e299a=_0xb594('0x16');return db[_0xb594('0x17')][_0xb594('0x15')]({'where':{'type':_0x2e299a,'resourceId':_0x59eef2['id']}})[_0xb594('0x14')](function(){return _0x22acf8;});})[_0xb594('0x14')](function(){_0x149b99[_0xb594('0xb')](0xcc)['end']();});}};}function handleEntityNotFound(_0x41897f){return function(_0x47c06a){if(!_0x47c06a){_0x41897f[_0xb594('0xa')](0x194);}return _0x47c06a;};}function handleError(_0x3b8dd2,_0x5f2a5e){_0x5f2a5e=_0x5f2a5e||0x1f4;return function(_0x485293){logger['error'](_0x485293[_0xb594('0x18')]);if(_0x485293[_0xb594('0x19')]){delete _0x485293[_0xb594('0x19')];}_0x3b8dd2[_0xb594('0xb')](_0x5f2a5e)[_0xb594('0x1a')](_0x485293);};}exports[_0xb594('0x1b')]=function(_0x28a425,_0x3a8ac8){var _0x5ac4aa={};var _0x3976df={'count':0x0,'rows':[]};var _0x5a5a2b=_[_0xb594('0x1c')](db[_0xb594('0x1d')][_0xb594('0x1e')],function(_0x2291e7){return{'name':_0x2291e7['fieldName'],'type':_0x2291e7[_0xb594('0x1f')][_0xb594('0x20')]};});_0x5ac4aa=qs[_0xb594('0x21')](_0x5a5a2b,_0x28a425);var _0x58dd5d={'where':_0x5ac4aa['where']};return db[_0xb594('0x1d')]['count'](_0x58dd5d)['then'](function(_0x203403){_0x3976df[_0xb594('0x10')]=_0x203403;_0x5ac4aa[_0xb594('0x22')]=qs[_0xb594('0x22')](_0x28a425[_0xb594('0x23')]);return db[_0xb594('0x1d')]['findAll'](_0x5ac4aa);})[_0xb594('0x14')](function(_0x5e0c94){_0x3976df[_0xb594('0x24')]=_0x5e0c94;return _0x3976df;})[_0xb594('0x14')](respondWithFilteredResult(_0x3a8ac8,_0x5ac4aa))[_0xb594('0x25')](handleError(_0x3a8ac8,null));};exports[_0xb594('0x26')]=function(_0x4bdae0,_0x535766){var _0x4fbb48={'raw':!![],'where':{'id':_0x4bdae0[_0xb594('0x27')]['id']}},_0x1ef790={};_0x1ef790[_0xb594('0x28')]=_['keys'](db[_0xb594('0x1d')][_0xb594('0x1e')]);_0x1ef790[_0xb594('0x23')]=_[_0xb594('0x29')](_0x4bdae0[_0xb594('0x23')]);_0x1ef790['filters']=_['intersection'](_0x1ef790[_0xb594('0x28')],_0x1ef790['query']);_0x4fbb48[_0xb594('0x2a')]=_[_0xb594('0x2b')](_0x1ef790[_0xb594('0x28')],qs['fields'](_0x4bdae0[_0xb594('0x23')][_0xb594('0x2c')]));_0x4fbb48[_0xb594('0x2a')]=_0x4fbb48[_0xb594('0x2a')][_0xb594('0x2d')]?_0x4fbb48[_0xb594('0x2a')]:_0x1ef790[_0xb594('0x28')];if(_0x4bdae0[_0xb594('0x23')]['includeAll']){_0x4fbb48[_0xb594('0x22')]=[{'all':!![]}];}_0x4fbb48=_['merge']({},_0x4fbb48,_0x4bdae0[_0xb594('0x2e')]);return db[_0xb594('0x1d')][_0xb594('0x2f')](_0x4fbb48)[_0xb594('0x14')](handleEntityNotFound(_0x535766,null))['then'](respondWithResult(_0x535766,null))[_0xb594('0x25')](handleError(_0x535766,null));};exports[_0xb594('0x30')]=function(_0x174671,_0x4d0518){return db[_0xb594('0x1d')]['create'](_0x174671[_0xb594('0x31')],{})[_0xb594('0x14')](function(_0x2c8ccd){var _0x3ffe2e=_0x174671[_0xb594('0x32')][_0xb594('0x33')]({'plain':!![]});if(!_0x3ffe2e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3ffe2e[_0xb594('0x34')]===_0xb594('0x32')){var _0x41cf12=_0x2c8ccd['get']({'plain':!![]});var _0x3823ad=_0xb594('0x16');return db[_0xb594('0x35')]['find']({'where':{'name':_0x3823ad,'userProfileId':_0x3ffe2e[_0xb594('0x36')]},'raw':!![]})[_0xb594('0x14')](function(_0x3f09a9){if(_0x3f09a9&&_0x3f09a9[_0xb594('0x37')]===0x0){return db[_0xb594('0x17')][_0xb594('0x30')]({'name':_0x41cf12[_0xb594('0x19')],'resourceId':_0x41cf12['id'],'type':_0x3f09a9[_0xb594('0x19')],'sectionId':_0x3f09a9['id']},{})['then'](function(){return _0x2c8ccd;});}else{return _0x2c8ccd;}})[_0xb594('0x25')](function(_0x32e088){logger[_0xb594('0x38')](_0xb594('0x39'),_0x32e088);throw _0x32e088;});}return _0x2c8ccd;})[_0xb594('0x14')](respondWithResult(_0x4d0518,0xc9))['catch'](handleError(_0x4d0518,null));};exports[_0xb594('0x3a')]=function(_0x418c86,_0x50bd1d){if(_0x418c86[_0xb594('0x31')]['id']){delete _0x418c86[_0xb594('0x31')]['id'];}return db[_0xb594('0x1d')][_0xb594('0x2f')]({'where':{'id':_0x418c86['params']['id']}})['then'](handleEntityNotFound(_0x50bd1d,null))[_0xb594('0x14')](saveUpdates(_0x418c86['body'],null))[_0xb594('0x14')](respondWithResult(_0x50bd1d,null))[_0xb594('0x25')](handleError(_0x50bd1d,null));};exports[_0xb594('0x15')]=function(_0xc37ec2,_0x24f247){return db[_0xb594('0x1d')]['find']({'where':{'id':_0xc37ec2[_0xb594('0x27')]['id']}})[_0xb594('0x14')](handleEntityNotFound(_0x24f247,null))[_0xb594('0x14')](removeEntity(_0x24f247,null))[_0xb594('0x25')](handleError(_0x24f247,null));};exports[_0xb594('0x3b')]=function(_0x129393,_0x560aed){return db[_0xb594('0x1d')][_0xb594('0x3b')]()['then'](respondWithResult(_0x560aed,null))['catch'](handleError(_0x560aed,null));};exports[_0xb594('0x3c')]=function(_0x215f12,_0x5d763c){var _0x62b729={'raw':!![],'where':{}},_0x107b90={},_0x5d1c0d;return db[_0xb594('0x1d')][_0xb594('0x3d')]({'where':{'id':_0x215f12[_0xb594('0x27')]['id']}})[_0xb594('0x14')](handleEntityNotFound(_0x5d763c,null))['then'](function(_0xf37cdb){if(_0xf37cdb){_0x5d1c0d=_0xf37cdb[_0xb594('0x33')]({'plain':!![]});_0x107b90[_0xb594('0x28')]=_['keys'](db[_0xb594('0x3e')][_0xb594('0x1e')]);_0x107b90[_0xb594('0x23')]=_[_0xb594('0x29')](_0x215f12['query']);_0x107b90[_0xb594('0x3f')]=_[_0xb594('0x2b')](_0x107b90['model'],_0x107b90[_0xb594('0x23')]);_0x62b729[_0xb594('0x2a')]=_[_0xb594('0x2b')](_0x107b90['model'],qs[_0xb594('0x2c')](_0x215f12[_0xb594('0x23')][_0xb594('0x2c')]));_0x62b729[_0xb594('0x2a')]=_0x62b729[_0xb594('0x2a')][_0xb594('0x2d')]?_0x62b729[_0xb594('0x2a')]:_0x107b90[_0xb594('0x28')];if(!_0x215f12['query'][_0xb594('0x40')]('nolimit')){_0x62b729['limit']=qs[_0xb594('0xf')](_0x215f12['query'][_0xb594('0xf')]);_0x62b729[_0xb594('0xd')]=qs[_0xb594('0xd')](_0x215f12[_0xb594('0x23')][_0xb594('0xd')]);}_0x62b729[_0xb594('0x41')]=qs[_0xb594('0x42')](_0x215f12[_0xb594('0x23')][_0xb594('0x42')]);_0x62b729[_0xb594('0x43')]=qs[_0xb594('0x3f')](_[_0xb594('0x44')](_0x215f12[_0xb594('0x23')],_0x107b90[_0xb594('0x3f')]));_0x62b729[_0xb594('0x43')]['ChatQueueId']=_0xf37cdb['id'];if(_0x215f12[_0xb594('0x23')][_0xb594('0x45')]){_0x62b729[_0xb594('0x43')]=_['merge'](_0x62b729[_0xb594('0x43')],{'$or':_[_0xb594('0x1c')](_0x62b729[_0xb594('0x2a')],function(_0x3f21e3){var _0x1e768b={};_0x1e768b[_0x3f21e3]={'$like':'%'+_0x215f12['query'][_0xb594('0x45')]+'%'};return _0x1e768b;})});}_0x62b729=_[_0xb594('0x46')]({},_0x62b729,_0x215f12[_0xb594('0x2e')]);return db[_0xb594('0x3e')]['findAll'](_0x62b729);}})[_0xb594('0x14')](function(_0x45b363){if(_0x45b363){return db[_0xb594('0x47')][_0xb594('0x48')]({'where':{'id':_[_0xb594('0x1c')](_0x45b363,_0xb594('0x49')),'role':_0xb594('0x4a')},'attributes':['id',_0xb594('0x19'),_0xb594('0x4b'),_0xb594('0x4c'),'createdAt']});}})['then'](function(_0x314e7c){if(_0x314e7c){return{'count':_0x314e7c['count'],'rows':_[_0xb594('0x1c')](_0x314e7c[_0xb594('0x24')],function(_0x43f4d5){return{'membername':_0x43f4d5[_0xb594('0x19')],'UserId':_0x43f4d5['id'],'queue_name':_0x5d1c0d[_0xb594('0x19')],'ChatQueueId':_0x5d1c0d['id'],'interface':util[_0xb594('0x4d')](_0xb594('0x4e'),'SIP',_0x43f4d5[_0xb594('0x19')]),'penalty':0x0,'paused':_0x43f4d5[_0xb594('0x4b')],'createdAt':_0x43f4d5[_0xb594('0x4f')],'updatedAt':_0x43f4d5[_0xb594('0x4c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xb594('0x14')](respondWithFilteredResult(_0x5d763c,_0x62b729))[_0xb594('0x25')](handleError(_0x5d763c,null));};exports[_0xb594('0x50')]=function(_0x184d12,_0x1d4577){var _0x18017b={};var _0x4d567f={};var _0x1571f2;var _0x13a422;return db['ChatQueue'][_0xb594('0x3d')]({'where':{'id':_0x184d12[_0xb594('0x27')]['id']}})[_0xb594('0x14')](handleEntityNotFound(_0x1d4577,null))[_0xb594('0x14')](function(_0x1944c8){if(_0x1944c8){_0x1571f2=_0x1944c8;_0x4d567f[_0xb594('0x28')]=_[_0xb594('0x29')](db[_0xb594('0x51')][_0xb594('0x1e')]);_0x4d567f['query']=_[_0xb594('0x29')](_0x184d12[_0xb594('0x23')]);_0x4d567f[_0xb594('0x3f')]=_[_0xb594('0x2b')](_0x4d567f[_0xb594('0x28')],_0x4d567f[_0xb594('0x23')]);_0x18017b[_0xb594('0x2a')]=_[_0xb594('0x2b')](_0x4d567f[_0xb594('0x28')],qs[_0xb594('0x2c')](_0x184d12['query'][_0xb594('0x2c')]));_0x18017b[_0xb594('0x2a')]=_0x18017b['attributes']['length']?_0x18017b[_0xb594('0x2a')]:_0x4d567f[_0xb594('0x28')];_0x18017b['order']=qs[_0xb594('0x42')](_0x184d12[_0xb594('0x23')][_0xb594('0x42')]);_0x18017b[_0xb594('0x43')]=qs[_0xb594('0x3f')](_[_0xb594('0x44')](_0x184d12[_0xb594('0x23')],_0x4d567f[_0xb594('0x3f')]));if(_0x184d12[_0xb594('0x23')]['filter']){_0x18017b[_0xb594('0x43')]=_['merge'](_0x18017b[_0xb594('0x43')],{'$or':_[_0xb594('0x1c')](_0x18017b[_0xb594('0x2a')],function(_0x4a98b1){var _0x25a3fa={};_0x25a3fa[_0x4a98b1]={'$like':'%'+_0x184d12[_0xb594('0x23')][_0xb594('0x45')]+'%'};return _0x25a3fa;})});}_0x18017b=_[_0xb594('0x46')]({},_0x18017b,_0x184d12[_0xb594('0x2e')]);return _0x1571f2[_0xb594('0x50')](_0x18017b);}})[_0xb594('0x14')](function(_0x5bd437){if(_0x5bd437){_0x13a422=_0x5bd437['length'];if(!_0x184d12[_0xb594('0x23')]['hasOwnProperty'](_0xb594('0x52'))){_0x18017b[_0xb594('0xf')]=qs[_0xb594('0xf')](_0x184d12[_0xb594('0x23')][_0xb594('0xf')]);_0x18017b[_0xb594('0xd')]=qs[_0xb594('0xd')](_0x184d12[_0xb594('0x23')][_0xb594('0xd')]);}return _0x1571f2['getTeams'](_0x18017b);}})[_0xb594('0x14')](function(_0xd3be7b){if(_0xd3be7b){return _0xd3be7b?{'count':_0x13a422,'rows':_0xd3be7b}:null;}})[_0xb594('0x14')](respondWithResult(_0x1d4577,null))['catch'](handleError(_0x1d4577,null));};exports[_0xb594('0x53')]=function(_0x5975eb,_0xb796e6){var _0x193979=_0x5975eb[_0xb594('0x31')][_0xb594('0x54')];return db[_0xb594('0x51')][_0xb594('0x55')]({'where':{'id':_0x193979},'attributes':['id'],'include':[{'model':db['User'],'as':_0xb594('0x56'),'attributes':['id',_0xb594('0x19'),'online','voicePause',_0xb594('0x57')],'raw':!![]}]})[_0xb594('0x14')](function(_0x4acd69){if(_0x4acd69){var _0x5144ac=_[_0xb594('0x58')](_0x4acd69,function(_0x6301c6){var _0xc36974=_0x6301c6[_0xb594('0x33')]({'plain':!![]});return _0xc36974[_0xb594('0x56')];});return db[_0xb594('0x1d')][_0xb594('0x2f')]({'where':{'id':_0x5975eb[_0xb594('0x27')]['id']}})['then'](function(_0x4f8c7e){return db[_0xb594('0x59')]['transaction'](function(_0x165470){return _0x4f8c7e[_0xb594('0x53')](_0x193979,{'transaction':_0x165470})['then'](function(){return BPromise['each'](_0x5144ac,function(_0x2b3d89){return db[_0xb594('0x3e')][_0xb594('0x5a')]({'where':{'UserId':_0x2b3d89['id'],'ChatQueueId':_0x5975eb[_0xb594('0x27')]['id']},'transaction':_0x165470});});})['then'](function(){_0x5144ac['forEach'](function(_0x50dabf){socket[_0xb594('0x5b')](_0xb594('0x5c'),{'UserId':_0x50dabf['id'],'ChatQueueId':_0x4f8c7e['id']});});});});});}})[_0xb594('0x14')](respondWithStatusCode(_0xb796e6,null))['catch'](handleError(_0xb796e6,null));};exports['removeTeams']=function(_0x5bc115,_0x4642cd){return db[_0xb594('0x51')]['findAll']({'where':{'id':_0x5bc115[_0xb594('0x23')]['ids']},'attributes':['id'],'include':[{'model':db[_0xb594('0x47')],'as':_0xb594('0x56'),'attributes':['id'],'raw':!![]}]})[_0xb594('0x14')](handleEntityNotFound(_0x4642cd,null))[_0xb594('0x14')](function(_0x1bbcfa){var _0x4d697c=_[_0xb594('0x1c')](_0x1bbcfa,'id');var _0x493da3=[];var _0x3539dd=[];var _0x53e22e=squel[_0xb594('0x5d')]();_0x53e22e['field'](_0xb594('0x5e'))['from'](_0xb594('0x5f'),'tq')[_0xb594('0x60')]('user_has_teams','ut',_0xb594('0x61'))[_0xb594('0x43')]('ChatQueueId\x20=\x20?',_0x5bc115[_0xb594('0x27')]['id']);for(var _0x17ba52=0x0;_0x17ba52<_0x1bbcfa[_0xb594('0x2d')];_0x17ba52+=0x1){let _0x3e4ecc=_0x1bbcfa[_0x17ba52];for(var _0xca68c3=0x0;_0xca68c3<_0x3e4ecc[_0xb594('0x56')]['length'];_0xca68c3+=0x1){let _0xea148c=_0x3e4ecc[_0xb594('0x56')][_0xca68c3];var _0x2e7026=_0x53e22e[_0xb594('0x62')]();_0x2e7026['where']('ut.UserId\x20=\x20?',_0xea148c['id']);_0x3539dd[_0xb594('0x63')](db[_0xb594('0x59')][_0xb594('0x23')](_0x2e7026[_0xb594('0x64')](),{'type':db['sequelize'][_0xb594('0x65')][_0xb594('0x66')]})[_0xb594('0x14')](function(_0x2a939c){if(_0x2a939c[_0xb594('0x2d')]===0x1){return _0xea148c['id'];}else{var _0x2fa1de=_[_0xb594('0x67')](_['map'](_0x2a939c,_0xb594('0x68')),function(_0x19fc35){return _[_0xb594('0x69')](_0x4d697c,_0x19fc35);});if(_0x2fa1de){return _0xea148c['id'];}}}));}}return BPromise[_0xb594('0x6a')](_0x3539dd)[_0xb594('0x14')](function(_0xc95873){_0x493da3=_(_0x493da3)[_0xb594('0x6b')](_0xc95873)[_0xb594('0x6c')]()[_0xb594('0x6d')]();return db[_0xb594('0x1d')][_0xb594('0x2f')]({'where':{'id':_0x5bc115['params']['id']}})[_0xb594('0x14')](function(_0x5d56f7){return db['sequelize']['transaction'](function(_0x49aeec){return _0x5d56f7[_0xb594('0x6e')](_0x5bc115['query'][_0xb594('0x54')],{'transaction':_0x49aeec})['then'](function(){if(!_['isEmpty'](_0x493da3)){return _0x5d56f7[_0xb594('0x6f')](_0x493da3,{'transaction':_0x49aeec});}})['then'](function(){_0x493da3['forEach'](function(_0x5ede50){socket[_0xb594('0x5b')](_0xb594('0x70'),{'UserId':_0x5ede50,'ChatQueueId':_0x5d56f7['id']});});});});});});})[_0xb594('0x14')](respondWithStatusCode(_0x4642cd,null))[_0xb594('0x25')](handleError(_0x4642cd,null));};exports[_0xb594('0x71')]=function(_0x14c94f,_0x2cd560){return db[_0xb594('0x1d')][_0xb594('0x2f')]({'where':{'id':_0x14c94f[_0xb594('0x27')]['id']}})['then'](handleEntityNotFound(_0x2cd560,null))['then'](function(_0x3a6875){if(_0x3a6875){return _0x3a6875[_0xb594('0x71')](_0x14c94f[_0xb594('0x31')][_0xb594('0x54')],_['omit'](_0x14c94f['body'],[_0xb594('0x54'),'id'])||{})[_0xb594('0x72')](function(_0x4f50f3){for(var _0x551183=0x0;_0x551183<_0x14c94f['body']['ids'][_0xb594('0x2d')];_0x551183+=0x1){socket[_0xb594('0x5b')](_0xb594('0x5c'),{'UserId':Number(_0x14c94f[_0xb594('0x31')]['ids'][_0x551183]),'ChatQueueId':Number(_0x14c94f['params']['id'])});}return _0x4f50f3;});}})[_0xb594('0x14')](respondWithResult(_0x2cd560,null))['catch'](handleError(_0x2cd560,null));};exports[_0xb594('0x6f')]=function(_0x3b7c58,_0x166cc3){return db[_0xb594('0x1d')]['find']({'where':{'id':_0x3b7c58[_0xb594('0x27')]['id']}})[_0xb594('0x14')](handleEntityNotFound(_0x166cc3,null))[_0xb594('0x14')](function(_0x30855a){if(_0x30855a){return _0x30855a['removeAgents'](_0x3b7c58[_0xb594('0x23')]['ids'])[_0xb594('0x14')](function(){if(_[_0xb594('0x73')](_0x3b7c58['query'][_0xb594('0x54')])){for(var _0x3b7eca=0x0;_0x3b7eca<_0x3b7c58[_0xb594('0x23')][_0xb594('0x54')]['length'];_0x3b7eca+=0x1){socket['emit'](_0xb594('0x70'),{'UserId':Number(_0x3b7c58[_0xb594('0x23')][_0xb594('0x54')][_0x3b7eca]),'ChatQueueId':Number(_0x3b7c58[_0xb594('0x27')]['id'])});}}else{socket[_0xb594('0x5b')](_0xb594('0x70'),{'UserId':Number(_0x3b7c58[_0xb594('0x23')]['ids']),'ChatQueueId':Number(_0x3b7c58[_0xb594('0x27')]['id'])});}});}})['then'](respondWithStatusCode(_0x166cc3,null))['catch'](handleError(_0x166cc3,null));};exports[_0xb594('0x74')]=function(_0x1213c8,_0x2962cc){var _0x1ee3ee={};var _0xc0d9f={};var _0x36ef16;var _0x46a5ca;return db['ChatQueue'][_0xb594('0x3d')]({'where':{'id':_0x1213c8['params']['id']}})[_0xb594('0x14')](handleEntityNotFound(_0x2962cc,null))[_0xb594('0x14')](function(_0x432f20){if(_0x432f20){_0x36ef16=_0x432f20;_0xc0d9f['model']=_[_0xb594('0x29')](db[_0xb594('0x47')][_0xb594('0x1e')]);_0xc0d9f['query']=_[_0xb594('0x29')](_0x1213c8[_0xb594('0x23')]);_0xc0d9f[_0xb594('0x3f')]=_[_0xb594('0x2b')](_0xc0d9f[_0xb594('0x28')],_0xc0d9f[_0xb594('0x23')]);_0x1ee3ee[_0xb594('0x2a')]=_[_0xb594('0x2b')](_0xc0d9f[_0xb594('0x28')],qs[_0xb594('0x2c')](_0x1213c8['query'][_0xb594('0x2c')]));_0x1ee3ee[_0xb594('0x2a')]=_0x1ee3ee['attributes']['length']?_0x1ee3ee[_0xb594('0x2a')]:_0xc0d9f[_0xb594('0x28')];_0x1ee3ee[_0xb594('0x41')]=qs['sort'](_0x1213c8[_0xb594('0x23')][_0xb594('0x42')]);_0x1ee3ee[_0xb594('0x43')]=qs[_0xb594('0x3f')](_[_0xb594('0x44')](_0x1213c8[_0xb594('0x23')],_0xc0d9f[_0xb594('0x3f')]));if(_0x1213c8[_0xb594('0x23')][_0xb594('0x45')]){_0x1ee3ee['where']=_[_0xb594('0x46')](_0x1ee3ee['where'],{'$or':_[_0xb594('0x1c')](_0x1ee3ee['attributes'],function(_0x3b9738){var _0x42e9d7={};_0x42e9d7[_0x3b9738]={'$like':'%'+_0x1213c8['query'][_0xb594('0x45')]+'%'};return _0x42e9d7;})});}_0x1ee3ee=_[_0xb594('0x46')]({},_0x1ee3ee,_0x1213c8[_0xb594('0x2e')]);return _0x36ef16['getAgents'](_0x1ee3ee);}})[_0xb594('0x14')](function(_0x2edb1f){if(_0x2edb1f){_0x46a5ca=_0x2edb1f['length'];if(!_0x1213c8['query'][_0xb594('0x40')](_0xb594('0x52'))){_0x1ee3ee[_0xb594('0xf')]=qs[_0xb594('0xf')](_0x1213c8[_0xb594('0x23')]['limit']);_0x1ee3ee[_0xb594('0xd')]=qs[_0xb594('0xd')](_0x1213c8[_0xb594('0x23')][_0xb594('0xd')]);}return _0x36ef16[_0xb594('0x74')](_0x1ee3ee);}})[_0xb594('0x14')](function(_0x2391e6){if(_0x2391e6){return _0x2391e6?{'count':_0x46a5ca,'rows':_0x2391e6}:null;}})[_0xb594('0x14')](respondWithResult(_0x2962cc,null))[_0xb594('0x25')](handleError(_0x2962cc,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index b9f1ec2..315c9cb 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 _0x1c42=['hook','exports','../../mysqldb','ChatQueue','setMaxListeners','update','remove','emit'];(function(_0x113787,_0x11d3e7){var _0x2743bc=function(_0x5dfdd9){while(--_0x5dfdd9){_0x113787['push'](_0x113787['shift']());}};_0x2743bc(++_0x11d3e7);}(_0x1c42,0x13a));var _0x21c4=function(_0x266e74,_0x24a514){_0x266e74=_0x266e74-0x0;var _0x2f2715=_0x1c42[_0x266e74];return _0x2f2715;};'use strict';var EventEmitter=require('events');var ChatQueue=require(_0x21c4('0x0'))['db'][_0x21c4('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x21c4('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x21c4('0x3'),'afterDestroy':_0x21c4('0x4')};function emitEvent(_0x1512d2){return function(_0xd7340,_0x435179,_0x214dd4){ChatQueueEvents[_0x21c4('0x5')](_0x1512d2+':'+_0xd7340['id'],_0xd7340);ChatQueueEvents[_0x21c4('0x5')](_0x1512d2,_0xd7340);_0x214dd4(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatQueue[_0x21c4('0x6')](e,emitEvent(event));}}module[_0x21c4('0x7')]=ChatQueueEvents; \ No newline at end of file +var _0x6fd7=['update','remove','emit','hasOwnProperty','events','ChatQueue','setMaxListeners'];(function(_0x229f8d,_0x48402c){var _0x3e193c=function(_0x58009d){while(--_0x58009d){_0x229f8d['push'](_0x229f8d['shift']());}};_0x3e193c(++_0x48402c);}(_0x6fd7,0x11c));var _0x76fd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6fd7[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x76fd('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0x76fd('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x76fd('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x76fd('0x3'),'afterDestroy':_0x76fd('0x4')};function emitEvent(_0xda228d){return function(_0x481987,_0x34e6b8,_0x25446){ChatQueueEvents['emit'](_0xda228d+':'+_0x481987['id'],_0x481987);ChatQueueEvents[_0x76fd('0x5')](_0xda228d,_0x481987);_0x25446(null);};}for(var e in events){if(events[_0x76fd('0x6')](e)){var event=events[e];ChatQueue['hook'](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 4783984..9f0ad84 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 _0xaa4a=['chat_queues','lodash','util','api','bluebird','rimraf','define','ChatQueue'];(function(_0x1f7194,_0x2a64ab){var _0x4b901e=function(_0x5a31bc){while(--_0x5a31bc){_0x1f7194['push'](_0x1f7194['shift']());}};_0x4b901e(++_0x2a64ab);}(_0xaa4a,0x159));var _0xaaa4=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xaa4a[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0xaaa4('0x0'));var util=require(_0xaaa4('0x1'));var logger=require('../../config/logger')(_0xaaa4('0x2'));var moment=require('moment');var BPromise=require(_0xaaa4('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xaaa4('0x4'));var config=require('../../config/environment');var attributes=require('./chatQueue.attributes');module['exports']=function(_0x35af1c,_0x11c21c){return _0x35af1c[_0xaaa4('0x5')](_0xaaa4('0x6'),attributes,{'tableName':_0xaaa4('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf030=['api','moment','request-promise','path','rimraf','../../config/environment','ChatQueue','chat_queues','util','../../config/logger'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xf030,0xb2));var _0x0f03=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xf030[_0x4a9fb1];return _0x348672;};'use strict';var _=require('lodash');var util=require(_0x0f03('0x0'));var logger=require(_0x0f03('0x1'))(_0x0f03('0x2'));var moment=require(_0x0f03('0x3'));var BPromise=require('bluebird');var rp=require(_0x0f03('0x4'));var fs=require('fs');var path=require(_0x0f03('0x5'));var rimraf=require(_0x0f03('0x6'));var config=require(_0x0f03('0x7'));var attributes=require('./chatQueue.attributes');module['exports']=function(_0x41921d,_0x329b34){return _0x41921d['define'](_0x0f03('0x8'),attributes,{'tableName':_0x0f03('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.rpc.js b/server/api/chatQueue/chatQueue.rpc.js index d11e152..db62112 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 _0x0caf=['randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./chatQueue.socket','register','request','info','request\x20sent','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatQueue,\x20%s,\x20%s','message','result','catch','GetChatQueue','ChatQueue','findAll','options','raw','attributes','limit','include','map','model','then','debug','ShowChatQueue','find','where','bluebird'];(function(_0x49d7e9,_0x4107c2){var _0x19f840=function(_0x491c3a){while(--_0x491c3a){_0x49d7e9['push'](_0x49d7e9['shift']());}};_0x19f840(++_0x4107c2);}(_0x0caf,0x9f));var _0xf0ca=function(_0x232731,_0x498de9){_0x232731=_0x232731-0x0;var _0x508b34=_0x0caf[_0x232731];return _0x508b34;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xf0ca('0x0'));var rs=require(_0xf0ca('0x1'));var fs=require('fs');var Redis=require(_0xf0ca('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf0ca('0x3'))(_0xf0ca('0x4'));var config=require('../../config/environment');var jayson=require(_0xf0ca('0x5'));var client=jayson[_0xf0ca('0x6')][_0xf0ca('0x7')]({'port':0x232a});config['redis']=_[_0xf0ca('0x8')](config[_0xf0ca('0x9')],{'host':_0xf0ca('0xa'),'port':0x18eb});var socket=require(_0xf0ca('0xb'))(new Redis(config[_0xf0ca('0x9')]));require(_0xf0ca('0xc'))[_0xf0ca('0xd')](socket);function respondWithRpcPromise(_0x5bbec7,_0x11aa70,_0x78f205){return new BPromise(function(_0x1542b6,_0xa3f45){return client[_0xf0ca('0xe')](_0x5bbec7,_0x78f205)['then'](function(_0x49aa3d){logger[_0xf0ca('0xf')]('ChatQueue,\x20%s,\x20%s',_0x11aa70,_0xf0ca('0x10'));logger['debug'](_0xf0ca('0x11'),_0x11aa70,_0xf0ca('0x10'),JSON[_0xf0ca('0x12')](_0x49aa3d));if(_0x49aa3d[_0xf0ca('0x13')]){if(_0x49aa3d[_0xf0ca('0x13')][_0xf0ca('0x14')]===0x1f4){logger['error'](_0xf0ca('0x15'),_0x11aa70,_0x49aa3d['error']['message']);return _0xa3f45(_0x49aa3d[_0xf0ca('0x13')][_0xf0ca('0x16')]);}logger[_0xf0ca('0x13')](_0xf0ca('0x15'),_0x11aa70,_0x49aa3d[_0xf0ca('0x13')]['message']);return _0x1542b6(_0x49aa3d['error'][_0xf0ca('0x16')]);}else{logger['info']('ChatQueue,\x20%s,\x20%s',_0x11aa70,_0xf0ca('0x10'));_0x1542b6(_0x49aa3d[_0xf0ca('0x17')][_0xf0ca('0x16')]);}})[_0xf0ca('0x18')](function(_0x3a1466){logger[_0xf0ca('0x13')]('ChatQueue,\x20%s,\x20%s',_0x11aa70,_0x3a1466);_0xa3f45(_0x3a1466);});});}exports[_0xf0ca('0x19')]=function(_0x58bed2){var _0x10bd95=this;return new Promise(function(_0x1409c4,_0x50f742){return db[_0xf0ca('0x1a')][_0xf0ca('0x1b')]({'raw':_0x58bed2[_0xf0ca('0x1c')]?_0x58bed2[_0xf0ca('0x1c')][_0xf0ca('0x1d')]===undefined?!![]:![]:!![],'where':_0x58bed2[_0xf0ca('0x1c')]?_0x58bed2[_0xf0ca('0x1c')]['where']||null:null,'attributes':_0x58bed2[_0xf0ca('0x1c')]?_0x58bed2[_0xf0ca('0x1c')][_0xf0ca('0x1e')]||null:null,'limit':_0x58bed2[_0xf0ca('0x1c')]?_0x58bed2[_0xf0ca('0x1c')][_0xf0ca('0x1f')]||null:null,'include':_0x58bed2['options']?_0x58bed2['options'][_0xf0ca('0x20')]?_[_0xf0ca('0x21')](_0x58bed2[_0xf0ca('0x1c')][_0xf0ca('0x20')],function(_0x106f8e){return{'model':db[_0x106f8e[_0xf0ca('0x22')]],'as':_0x106f8e['as'],'attributes':_0x106f8e[_0xf0ca('0x1e')],'include':_0x106f8e[_0xf0ca('0x20')]?_['map'](_0x106f8e['include'],function(_0x22c0f0){return{'model':db[_0x22c0f0[_0xf0ca('0x22')]],'as':_0x22c0f0['as'],'attributes':_0x22c0f0['attributes'],'include':_0x22c0f0[_0xf0ca('0x20')]?_[_0xf0ca('0x21')](_0x22c0f0[_0xf0ca('0x20')],function(_0x2aaae9){return{'model':db[_0x2aaae9['model']],'as':_0x2aaae9['as'],'attributes':_0x2aaae9[_0xf0ca('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xf0ca('0x23')](function(_0x35b78c){logger[_0xf0ca('0xf')](_0xf0ca('0x19'),_0x58bed2);logger[_0xf0ca('0x24')](_0xf0ca('0x19'),_0x58bed2,JSON['stringify'](_0x35b78c));_0x1409c4(_0x35b78c);})[_0xf0ca('0x18')](function(_0x4ba8ac){logger[_0xf0ca('0x13')]('GetChatQueue',_0x4ba8ac[_0xf0ca('0x16')],_0x58bed2);_0x50f742(_0x10bd95[_0xf0ca('0x13')](0x1f4,_0x4ba8ac[_0xf0ca('0x16')]));});});};exports[_0xf0ca('0x25')]=function(_0x35bcd7){var _0x2c39f3=this;return new Promise(function(_0x108281,_0x3be90c){return db[_0xf0ca('0x1a')][_0xf0ca('0x26')]({'raw':_0x35bcd7[_0xf0ca('0x1c')]?_0x35bcd7[_0xf0ca('0x1c')][_0xf0ca('0x1d')]===undefined?!![]:![]:!![],'where':_0x35bcd7[_0xf0ca('0x1c')]?_0x35bcd7['options'][_0xf0ca('0x27')]||null:null,'attributes':_0x35bcd7[_0xf0ca('0x1c')]?_0x35bcd7[_0xf0ca('0x1c')][_0xf0ca('0x1e')]||null:null,'include':_0x35bcd7['options']?_0x35bcd7[_0xf0ca('0x1c')]['include']?_[_0xf0ca('0x21')](_0x35bcd7['options'][_0xf0ca('0x20')],function(_0x2c218b){return{'model':db[_0x2c218b['model']],'as':_0x2c218b['as'],'attributes':_0x2c218b[_0xf0ca('0x1e')],'include':_0x2c218b['include']?_['map'](_0x2c218b[_0xf0ca('0x20')],function(_0x459169){return{'model':db[_0x459169[_0xf0ca('0x22')]],'as':_0x459169['as'],'attributes':_0x459169[_0xf0ca('0x1e')],'include':_0x459169[_0xf0ca('0x20')]?_['map'](_0x459169[_0xf0ca('0x20')],function(_0x448969){return{'model':db[_0x448969[_0xf0ca('0x22')]],'as':_0x448969['as'],'attributes':_0x448969[_0xf0ca('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xf0ca('0x23')](function(_0x46219a){logger['info'](_0xf0ca('0x25'),_0x35bcd7);logger[_0xf0ca('0x24')](_0xf0ca('0x25'),_0x35bcd7,JSON[_0xf0ca('0x12')](_0x46219a));_0x108281(_0x46219a);})['catch'](function(_0x206df2){logger['error'](_0xf0ca('0x25'),_0x206df2[_0xf0ca('0x16')],_0x35bcd7);_0x3be90c(_0x2c39f3[_0xf0ca('0x13')](0x1f4,_0x206df2[_0xf0ca('0x16')]));});});}; \ No newline at end of file +var _0x3aa2=['error','code','message','result','GetChatQueue','findAll','options','raw','where','limit','include','attributes','map','model','debug','catch','ChatQueue','find','ShowChatQueue','lodash','util','bluebird','../../mysqldb','../../config/utils','rpc','jayson/promise','client','redis','defaults','socket.io-emitter','./chatQueue.socket','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x21b43f,_0x206e22){var _0x2d4d49=function(_0xfc013c){while(--_0xfc013c){_0x21b43f['push'](_0x21b43f['shift']());}};_0x2d4d49(++_0x206e22);}(_0x3aa2,0x13b));var _0x23aa=function(_0x5ce781,_0x736b15){_0x5ce781=_0x5ce781-0x0;var _0xa70499=_0x3aa2[_0x5ce781];return _0xa70499;};'use strict';var _=require(_0x23aa('0x0'));var util=require(_0x23aa('0x1'));var moment=require('moment');var BPromise=require(_0x23aa('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x23aa('0x3'))['db'];var utils=require(_0x23aa('0x4'));var logger=require('../../config/logger')(_0x23aa('0x5'));var config=require('../../config/environment');var jayson=require(_0x23aa('0x6'));var client=jayson[_0x23aa('0x7')]['http']({'port':0x232a});config[_0x23aa('0x8')]=_[_0x23aa('0x9')](config[_0x23aa('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x23aa('0xa'))(new Redis(config[_0x23aa('0x8')]));require(_0x23aa('0xb'))['register'](socket);function respondWithRpcPromise(_0x4b8b1a,_0xb70adc,_0x5100f4){return new BPromise(function(_0x3f9456,_0x155c20){return client[_0x23aa('0xc')](_0x4b8b1a,_0x5100f4)[_0x23aa('0xd')](function(_0x106b13){logger[_0x23aa('0xe')](_0x23aa('0xf'),_0xb70adc,'request\x20sent');logger['debug']('ChatQueue,\x20%s,\x20%s,\x20%s',_0xb70adc,_0x23aa('0x10'),JSON[_0x23aa('0x11')](_0x106b13));if(_0x106b13[_0x23aa('0x12')]){if(_0x106b13[_0x23aa('0x12')][_0x23aa('0x13')]===0x1f4){logger[_0x23aa('0x12')](_0x23aa('0xf'),_0xb70adc,_0x106b13[_0x23aa('0x12')]['message']);return _0x155c20(_0x106b13[_0x23aa('0x12')]['message']);}logger['error'](_0x23aa('0xf'),_0xb70adc,_0x106b13[_0x23aa('0x12')][_0x23aa('0x14')]);return _0x3f9456(_0x106b13[_0x23aa('0x12')][_0x23aa('0x14')]);}else{logger[_0x23aa('0xe')]('ChatQueue,\x20%s,\x20%s',_0xb70adc,_0x23aa('0x10'));_0x3f9456(_0x106b13[_0x23aa('0x15')]['message']);}})['catch'](function(_0x4d660f){logger['error'](_0x23aa('0xf'),_0xb70adc,_0x4d660f);_0x155c20(_0x4d660f);});});}exports[_0x23aa('0x16')]=function(_0x14a8a){var _0x545ac6=this;return new Promise(function(_0x2f5918,_0x140c66){return db['ChatQueue'][_0x23aa('0x17')]({'raw':_0x14a8a[_0x23aa('0x18')]?_0x14a8a[_0x23aa('0x18')][_0x23aa('0x19')]===undefined?!![]:![]:!![],'where':_0x14a8a[_0x23aa('0x18')]?_0x14a8a[_0x23aa('0x18')][_0x23aa('0x1a')]||null:null,'attributes':_0x14a8a[_0x23aa('0x18')]?_0x14a8a[_0x23aa('0x18')]['attributes']||null:null,'limit':_0x14a8a[_0x23aa('0x18')]?_0x14a8a[_0x23aa('0x18')][_0x23aa('0x1b')]||null:null,'include':_0x14a8a[_0x23aa('0x18')]?_0x14a8a['options'][_0x23aa('0x1c')]?_['map'](_0x14a8a[_0x23aa('0x18')][_0x23aa('0x1c')],function(_0x305eff){return{'model':db[_0x305eff['model']],'as':_0x305eff['as'],'attributes':_0x305eff[_0x23aa('0x1d')],'include':_0x305eff[_0x23aa('0x1c')]?_[_0x23aa('0x1e')](_0x305eff[_0x23aa('0x1c')],function(_0x593354){return{'model':db[_0x593354['model']],'as':_0x593354['as'],'attributes':_0x593354['attributes'],'include':_0x593354[_0x23aa('0x1c')]?_[_0x23aa('0x1e')](_0x593354[_0x23aa('0x1c')],function(_0x7139ef){return{'model':db[_0x7139ef[_0x23aa('0x1f')]],'as':_0x7139ef['as'],'attributes':_0x7139ef[_0x23aa('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x23aa('0xd')](function(_0x2163c0){logger[_0x23aa('0xe')](_0x23aa('0x16'),_0x14a8a);logger[_0x23aa('0x20')](_0x23aa('0x16'),_0x14a8a,JSON[_0x23aa('0x11')](_0x2163c0));_0x2f5918(_0x2163c0);})[_0x23aa('0x21')](function(_0x5a21e1){logger['error'](_0x23aa('0x16'),_0x5a21e1[_0x23aa('0x14')],_0x14a8a);_0x140c66(_0x545ac6[_0x23aa('0x12')](0x1f4,_0x5a21e1['message']));});});};exports['ShowChatQueue']=function(_0x2ea616){var _0x21fc15=this;return new Promise(function(_0x46553e,_0x52a419){return db[_0x23aa('0x22')][_0x23aa('0x23')]({'raw':_0x2ea616['options']?_0x2ea616[_0x23aa('0x18')][_0x23aa('0x19')]===undefined?!![]:![]:!![],'where':_0x2ea616['options']?_0x2ea616[_0x23aa('0x18')][_0x23aa('0x1a')]||null:null,'attributes':_0x2ea616['options']?_0x2ea616[_0x23aa('0x18')][_0x23aa('0x1d')]||null:null,'include':_0x2ea616[_0x23aa('0x18')]?_0x2ea616[_0x23aa('0x18')][_0x23aa('0x1c')]?_[_0x23aa('0x1e')](_0x2ea616[_0x23aa('0x18')]['include'],function(_0x29500e){return{'model':db[_0x29500e[_0x23aa('0x1f')]],'as':_0x29500e['as'],'attributes':_0x29500e[_0x23aa('0x1d')],'include':_0x29500e['include']?_['map'](_0x29500e[_0x23aa('0x1c')],function(_0x369dcc){return{'model':db[_0x369dcc[_0x23aa('0x1f')]],'as':_0x369dcc['as'],'attributes':_0x369dcc['attributes'],'include':_0x369dcc[_0x23aa('0x1c')]?_[_0x23aa('0x1e')](_0x369dcc[_0x23aa('0x1c')],function(_0x348aa5){return{'model':db[_0x348aa5[_0x23aa('0x1f')]],'as':_0x348aa5['as'],'attributes':_0x348aa5[_0x23aa('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x23aa('0xd')](function(_0xb231c0){logger[_0x23aa('0xe')](_0x23aa('0x24'),_0x2ea616);logger[_0x23aa('0x20')](_0x23aa('0x24'),_0x2ea616,JSON['stringify'](_0xb231c0));_0x46553e(_0xb231c0);})['catch'](function(_0x1cd967){logger['error']('ShowChatQueue',_0x1cd967[_0x23aa('0x14')],_0x2ea616);_0x52a419(_0x21fc15['error'](0x1f4,_0x1cd967[_0x23aa('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 45eadbb..7f12126 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 _0x9f62=['save','update','removeListener','register','length'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0x9f62,0x154));var _0x29f6=function(_0x2cc614,_0x576e6c){_0x2cc614=_0x2cc614-0x0;var _0x5bf33c=_0x9f62[_0x2cc614];return _0x5bf33c;};'use strict';var ChatQueueEvents=require('./chatQueue.events');var events=[_0x29f6('0x0'),'remove',_0x29f6('0x1')];function createListener(_0x254ab3,_0x548050){return function(_0x5618b7){_0x548050['emit'](_0x254ab3,_0x5618b7);};}function removeListener(_0x258ddd,_0x2f0420){return function(){ChatQueueEvents[_0x29f6('0x2')](_0x258ddd,_0x2f0420);};}exports[_0x29f6('0x3')]=function(_0x595034){for(var _0xf66137=0x0,_0x272876=events[_0x29f6('0x4')];_0xf66137<_0x272876;_0xf66137++){var _0x2ba602=events[_0xf66137];var _0x416c6c=createListener('chatQueue:'+_0x2ba602,_0x595034);ChatQueueEvents['on'](_0x2ba602,_0x416c6c);}}; \ No newline at end of file +var _0xf3cd=['remove','update','emit','register','length','chatQueue:','./chatQueue.events','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x3050b5,_0x182c6a){_0x3050b5=_0x3050b5-0x0;var _0x37cceb=_0xf3cd[_0x3050b5];return _0x37cceb;};'use strict';var ChatQueueEvents=require(_0xdf3c('0x0'));var events=[_0xdf3c('0x1'),_0xdf3c('0x2'),_0xdf3c('0x3')];function createListener(_0x1839ec,_0x433a7f){return function(_0x54db05){_0x433a7f[_0xdf3c('0x4')](_0x1839ec,_0x54db05);};}function removeListener(_0x71b446,_0x9f71cb){return function(){ChatQueueEvents['removeListener'](_0x71b446,_0x9f71cb);};}exports[_0xdf3c('0x5')]=function(_0x17d42a){for(var _0x1313d5=0x0,_0x1f0601=events[_0xdf3c('0x6')];_0x1313d5<_0x1f0601;_0x1313d5++){var _0x28edae=events[_0x1313d5];var _0x52c073=createListener(_0xdf3c('0x7')+_0x28edae,_0x17d42a);ChatQueueEvents['on'](_0x28edae,_0x52c073);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index e9e57b3..5827739 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 _0x5fc3=['update','delete','destroy','removeTeams','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','describe','/:id','show','getMembers','/:id/teams','/:id/users','post','create','addTeams','put'];(function(_0x273c39,_0x1052e6){var _0x46d6b5=function(_0x44f1fb){while(--_0x44f1fb){_0x273c39['push'](_0x273c39['shift']());}};_0x46d6b5(++_0x1052e6);}(_0x5fc3,0xa8));var _0x35fc=function(_0x57cb4f,_0x541f57){_0x57cb4f=_0x57cb4f-0x0;var _0x29bb45=_0x5fc3[_0x57cb4f];return _0x29bb45;};'use strict';var multer=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var path=require('path');var timeout=require(_0x35fc('0x2'));var express=require(_0x35fc('0x3'));var router=express[_0x35fc('0x4')]();var fs_extra=require(_0x35fc('0x5'));var auth=require(_0x35fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x35fc('0x7'));var controller=require(_0x35fc('0x8'));router[_0x35fc('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x35fc('0x9')]('/describe',auth[_0x35fc('0xa')](),controller[_0x35fc('0xb')]);router[_0x35fc('0x9')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0xd')]);router[_0x35fc('0x9')]('/:id/members',auth[_0x35fc('0xa')](),controller[_0x35fc('0xe')]);router['get'](_0x35fc('0xf'),auth[_0x35fc('0xa')](),controller['getTeams']);router[_0x35fc('0x9')](_0x35fc('0x10'),auth['isAuthenticated'](),controller['getAgents']);router[_0x35fc('0x11')]('/',auth['isAuthenticated'](),controller[_0x35fc('0x12')]);router[_0x35fc('0x11')](_0x35fc('0xf'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x13')]);router['post']('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router[_0x35fc('0x14')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x15')]);router[_0x35fc('0x16')](_0x35fc('0xc'),auth['isAuthenticated'](),controller[_0x35fc('0x17')]);router[_0x35fc('0x16')]('/:id/teams',auth[_0x35fc('0xa')](),controller[_0x35fc('0x18')]);router[_0x35fc('0x16')]('/:id/users',auth[_0x35fc('0xa')](),controller[_0x35fc('0x19')]);module[_0x35fc('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(_0x5e3ab0,_0x4cf6dc){var _0x1dece8=function(_0x110dda){while(--_0x110dda){_0x5e3ab0['push'](_0x5e3ab0['shift']());}};_0x1dece8(++_0x4cf6dc);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id',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 d3d3369..9f95e5a 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 _0x5c73=['exports','STRING','DATE','sequelize'];(function(_0x397eac,_0x15c2ef){var _0x5f0492=function(_0x2f037b){while(--_0x2f037b){_0x397eac['push'](_0x397eac['shift']());}};_0x5f0492(++_0x15c2ef);}(_0x5c73,0x12f));var _0x35c7=function(_0x5ae61c,_0x3de231){_0x5ae61c=_0x5ae61c-0x0;var _0x1e72d6=_0x5c73[_0x5ae61c];return _0x1e72d6;};'use strict';var moment=require('moment');var Sequelize=require(_0x35c7('0x0'));module[_0x35c7('0x1')]={'uniqueid':{'type':Sequelize[_0x35c7('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x35c7('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x35c7('0x3')]},'exitAt':{'type':Sequelize[_0x35c7('0x3')]},'reason':{'type':Sequelize[_0x35c7('0x2')]}}; \ No newline at end of file +var _0x455d=['DATE','exports','STRING'];(function(_0xccb95,_0x300783){var _0x382f46=function(_0x18519f){while(--_0x18519f){_0xccb95['push'](_0xccb95['shift']());}};_0x382f46(++_0x300783);}(_0x455d,0x190));var _0xd455=function(_0x45cbfd,_0x48ea7d){_0x45cbfd=_0x45cbfd-0x0;var _0x112e2e=_0x455d[_0x45cbfd];return _0x112e2e;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0xd455('0x0')]={'uniqueid':{'type':Sequelize[_0xd455('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0xd455('0x1')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xd455('0x2')]},'acceptAt':{'type':Sequelize[_0xd455('0x2')]},'exitAt':{'type':Sequelize[_0xd455('0x2')]},'reason':{'type':Sequelize[_0xd455('0x1')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index ca5f590..53bcf85 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 _0x5e0c=['squel','jsforce','desk.js','querystring','ioredis','../../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','reject','update','then','error','stack','name','map','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','ChatQueueReport','include','findAll','catch','params','includeAll','options','find','create','body','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs'];(function(_0x230ca4,_0x1cf05f){var _0x51c0ae=function(_0x39d64e){while(--_0x39d64e){_0x230ca4['push'](_0x230ca4['shift']());}};_0x51c0ae(++_0x1cf05f);}(_0x5e0c,0x19f));var _0xc5e0=function(_0x6595a7,_0x1be709){_0x6595a7=_0x6595a7-0x0;var _0x22bb82=_0x5e0c[_0x6595a7];return _0x22bb82;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc5e0('0x0'));var zipdir=require(_0xc5e0('0x1'));var jsonpatch=require(_0xc5e0('0x2'));var rp=require(_0xc5e0('0x3'));var moment=require(_0xc5e0('0x4'));var BPromise=require(_0xc5e0('0x5'));var Mustache=require('mustache');var util=require(_0xc5e0('0x6'));var path=require(_0xc5e0('0x7'));var sox=require(_0xc5e0('0x8'));var csv=require(_0xc5e0('0x9'));var ejs=require(_0xc5e0('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xc5e0('0xb'));var crypto=require('crypto');var jsforce=require(_0xc5e0('0xc'));var deskjs=require(_0xc5e0('0xd'));var toCsv=require(_0xc5e0('0x9'));var querystring=require(_0xc5e0('0xe'));var Papa=require('papaparse');var Redis=require(_0xc5e0('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xc5e0('0x10'));var as=require(_0xc5e0('0x11'));var hardwareService=require(_0xc5e0('0x12'));var logger=require(_0xc5e0('0x13'))(_0xc5e0('0x14'));var utils=require(_0xc5e0('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xc5e0('0x16'));var db=require(_0xc5e0('0x17'))['db'];function respondWithStatusCode(_0x3de61c,_0x207bb7){_0x207bb7=_0x207bb7||0xcc;return function(_0x33359f){if(_0x33359f){return _0x3de61c['sendStatus'](_0x207bb7);}return _0x3de61c[_0xc5e0('0x18')](_0x207bb7)[_0xc5e0('0x19')]();};}function respondWithResult(_0x5b2622,_0x55e389){_0x55e389=_0x55e389||0xc8;return function(_0x2fa026){if(_0x2fa026){return _0x5b2622['status'](_0x55e389)['json'](_0x2fa026);}};}function respondWithFilteredResult(_0xcf0eba,_0x163bf2){return function(_0x310537){if(_0x310537){var _0x24700e=typeof _0x163bf2[_0xc5e0('0x1a')]===_0xc5e0('0x1b')&&typeof _0x163bf2[_0xc5e0('0x1c')]===_0xc5e0('0x1b');var _0x21bb3e=_0x310537[_0xc5e0('0x1d')];var _0x217c62=_0x24700e?0x0:_0x163bf2[_0xc5e0('0x1a')];var _0x7cdb63=_0x24700e?_0x310537[_0xc5e0('0x1d')]:_0x163bf2['offset']+_0x163bf2['limit'];var _0x23e802;if(_0x7cdb63>=_0x21bb3e){_0x7cdb63=_0x21bb3e;_0x23e802=0xc8;}else{_0x23e802=0xce;}_0xcf0eba[_0xc5e0('0x18')](_0x23e802);return _0xcf0eba[_0xc5e0('0x1e')](_0xc5e0('0x1f'),_0x217c62+'-'+_0x7cdb63+'/'+_0x21bb3e)[_0xc5e0('0x20')](_0x310537);}return null;};}function patchUpdates(_0x106819){return function(_0x4a07e8){try{jsonpatch['apply'](_0x4a07e8,_0x106819,!![]);}catch(_0x499fea){return BPromise[_0xc5e0('0x21')](_0x499fea);}return _0x4a07e8['save']();};}function saveUpdates(_0x24cc05,_0x452d39){return function(_0x3b938e){if(_0x3b938e){return _0x3b938e[_0xc5e0('0x22')](_0x24cc05)[_0xc5e0('0x23')](function(_0x119bfc){return _0x119bfc;});}return null;};}function removeEntity(_0x3cb3bc,_0x48b6c6){return function(_0x10039c){if(_0x10039c){return _0x10039c['destroy']()[_0xc5e0('0x23')](function(){_0x3cb3bc[_0xc5e0('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x554452,_0x4a5541){return function(_0x30f734){if(!_0x30f734){_0x554452['sendStatus'](0x194);}return _0x30f734;};}function handleError(_0x2bec15,_0x3e960f){_0x3e960f=_0x3e960f||0x1f4;return function(_0x59b7ee){logger[_0xc5e0('0x24')](_0x59b7ee[_0xc5e0('0x25')]);if(_0x59b7ee[_0xc5e0('0x26')]){delete _0x59b7ee[_0xc5e0('0x26')];}_0x2bec15['status'](_0x3e960f)['send'](_0x59b7ee);};}exports['index']=function(_0x4b30d9,_0x4461ae){var _0x4ce3fa={},_0x478464={},_0x19f77a={'count':0x0,'rows':[]};var _0x40ec9a=_[_0xc5e0('0x27')](db['ChatQueueReport'][_0xc5e0('0x28')],function(_0x44cd97){return{'name':_0x44cd97['fieldName'],'type':_0x44cd97[_0xc5e0('0x29')][_0xc5e0('0x2a')]};});_0x478464[_0xc5e0('0x2b')]=_[_0xc5e0('0x27')](_0x40ec9a,_0xc5e0('0x26'));_0x478464[_0xc5e0('0x2c')]=_[_0xc5e0('0x2d')](_0x4b30d9[_0xc5e0('0x2c')]);_0x478464[_0xc5e0('0x2e')]=_[_0xc5e0('0x2f')](_0x478464[_0xc5e0('0x2b')],_0x478464[_0xc5e0('0x2c')]);_0x4ce3fa['attributes']=_['intersection'](_0x478464[_0xc5e0('0x2b')],qs['fields'](_0x4b30d9[_0xc5e0('0x2c')][_0xc5e0('0x30')]));_0x4ce3fa[_0xc5e0('0x31')]=_0x4ce3fa[_0xc5e0('0x31')][_0xc5e0('0x32')]?_0x4ce3fa[_0xc5e0('0x31')]:_0x478464['model'];if(!_0x4b30d9[_0xc5e0('0x2c')][_0xc5e0('0x33')](_0xc5e0('0x34'))){_0x4ce3fa[_0xc5e0('0x1c')]=qs[_0xc5e0('0x1c')](_0x4b30d9['query'][_0xc5e0('0x1c')]);_0x4ce3fa[_0xc5e0('0x1a')]=qs['offset'](_0x4b30d9[_0xc5e0('0x2c')][_0xc5e0('0x1a')]);}_0x4ce3fa[_0xc5e0('0x35')]=qs[_0xc5e0('0x36')](_0x4b30d9[_0xc5e0('0x2c')][_0xc5e0('0x36')]);_0x4ce3fa[_0xc5e0('0x37')]=qs[_0xc5e0('0x2e')](_[_0xc5e0('0x38')](_0x4b30d9[_0xc5e0('0x2c')],_0x478464[_0xc5e0('0x2e')]),_0x40ec9a);if(_0x4b30d9[_0xc5e0('0x2c')][_0xc5e0('0x39')]){_0x4ce3fa[_0xc5e0('0x37')]=_[_0xc5e0('0x3a')](_0x4ce3fa[_0xc5e0('0x37')],{'$or':_[_0xc5e0('0x27')](_0x40ec9a,function(_0x33a13e){if(_0x33a13e[_0xc5e0('0x29')]!=='VIRTUAL'){var _0x2bf630={};_0x2bf630[_0x33a13e[_0xc5e0('0x26')]]={'$like':'%'+_0x4b30d9[_0xc5e0('0x2c')][_0xc5e0('0x39')]+'%'};return _0x2bf630;}})});}_0x4ce3fa=_[_0xc5e0('0x3a')]({},_0x4ce3fa,_0x4b30d9['options']);var _0x2a9a9d={'where':_0x4ce3fa[_0xc5e0('0x37')]};return db[_0xc5e0('0x3b')][_0xc5e0('0x1d')](_0x2a9a9d)[_0xc5e0('0x23')](function(_0x3c5202){_0x19f77a['count']=_0x3c5202;if(_0x4b30d9[_0xc5e0('0x2c')]['includeAll']){_0x4ce3fa[_0xc5e0('0x3c')]=[{'all':!![]}];}return db['ChatQueueReport'][_0xc5e0('0x3d')](_0x4ce3fa);})[_0xc5e0('0x23')](function(_0x5e7fbd){_0x19f77a['rows']=_0x5e7fbd;return _0x19f77a;})[_0xc5e0('0x23')](respondWithFilteredResult(_0x4461ae,_0x4ce3fa))[_0xc5e0('0x3e')](handleError(_0x4461ae,null));};exports['show']=function(_0x4d95fd,_0x280dc7){var _0x30af63={'raw':!![],'where':{'id':_0x4d95fd[_0xc5e0('0x3f')]['id']}},_0x3a623e={};_0x3a623e[_0xc5e0('0x2b')]=_[_0xc5e0('0x2d')](db['ChatQueueReport']['rawAttributes']);_0x3a623e[_0xc5e0('0x2c')]=_['keys'](_0x4d95fd[_0xc5e0('0x2c')]);_0x3a623e['filters']=_[_0xc5e0('0x2f')](_0x3a623e[_0xc5e0('0x2b')],_0x3a623e[_0xc5e0('0x2c')]);_0x30af63[_0xc5e0('0x31')]=_[_0xc5e0('0x2f')](_0x3a623e['model'],qs[_0xc5e0('0x30')](_0x4d95fd[_0xc5e0('0x2c')][_0xc5e0('0x30')]));_0x30af63[_0xc5e0('0x31')]=_0x30af63['attributes'][_0xc5e0('0x32')]?_0x30af63[_0xc5e0('0x31')]:_0x3a623e['model'];if(_0x4d95fd[_0xc5e0('0x2c')][_0xc5e0('0x40')]){_0x30af63[_0xc5e0('0x3c')]=[{'all':!![]}];}_0x30af63=_['merge']({},_0x30af63,_0x4d95fd[_0xc5e0('0x41')]);return db['ChatQueueReport'][_0xc5e0('0x42')](_0x30af63)[_0xc5e0('0x23')](handleEntityNotFound(_0x280dc7,null))[_0xc5e0('0x23')](respondWithResult(_0x280dc7,null))[_0xc5e0('0x3e')](handleError(_0x280dc7,null));};exports[_0xc5e0('0x43')]=function(_0x41a74b,_0x913f8a){return db[_0xc5e0('0x3b')][_0xc5e0('0x43')](_0x41a74b['body'],{})[_0xc5e0('0x23')](respondWithResult(_0x913f8a,0xc9))['catch'](handleError(_0x913f8a,null));};exports[_0xc5e0('0x22')]=function(_0x10e08e,_0xbe17c8){if(_0x10e08e['body']['id']){delete _0x10e08e[_0xc5e0('0x44')]['id'];}return db[_0xc5e0('0x3b')][_0xc5e0('0x42')]({'where':{'id':_0x10e08e[_0xc5e0('0x3f')]['id']}})[_0xc5e0('0x23')](handleEntityNotFound(_0xbe17c8,null))[_0xc5e0('0x23')](saveUpdates(_0x10e08e['body'],null))[_0xc5e0('0x23')](respondWithResult(_0xbe17c8,null))[_0xc5e0('0x3e')](handleError(_0xbe17c8,null));};exports[_0xc5e0('0x45')]=function(_0x2c9bd9,_0x29df8b){return db[_0xc5e0('0x3b')]['find']({'where':{'id':_0x2c9bd9['params']['id']}})[_0xc5e0('0x23')](handleEntityNotFound(_0x29df8b,null))[_0xc5e0('0x23')](removeEntity(_0x29df8b,null))[_0xc5e0('0x3e')](handleError(_0x29df8b,null));};exports['describe']=function(_0x4de169,_0x2d65f7){return db[_0xc5e0('0x3b')][_0xc5e0('0x46')]()['then'](respondWithResult(_0x2d65f7,null))['catch'](handleError(_0x2d65f7,null));}; \ No newline at end of file +var _0xc4aa=['sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','ChatQueueReport','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','keys','rawAttributes','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x915de9,_0xabf9e5){var _0x274129=function(_0x27fd79){while(--_0x27fd79){_0x915de9['push'](_0x915de9['shift']());}};_0x274129(++_0xabf9e5);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0xc4aa[_0x53ccf2];return _0x5a2964;};'use strict';var emlformat=require(_0xac4a('0x0'));var rimraf=require(_0xac4a('0x1'));var zipdir=require(_0xac4a('0x2'));var jsonpatch=require(_0xac4a('0x3'));var rp=require(_0xac4a('0x4'));var moment=require(_0xac4a('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xac4a('0x6'));var sox=require(_0xac4a('0x7'));var csv=require(_0xac4a('0x8'));var ejs=require(_0xac4a('0x9'));var fs=require('fs');var fs_extra=require(_0xac4a('0xa'));var _=require(_0xac4a('0xb'));var squel=require(_0xac4a('0xc'));var crypto=require(_0xac4a('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xac4a('0x8'));var querystring=require(_0xac4a('0xe'));var Papa=require(_0xac4a('0xf'));var Redis=require('ioredis');var authService=require(_0xac4a('0x10'));var qs=require(_0xac4a('0x11'));var as=require(_0xac4a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xac4a('0x13'))('api');var utils=require(_0xac4a('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xac4a('0x15'));var db=require(_0xac4a('0x16'))['db'];function respondWithStatusCode(_0x24291d,_0x5e16aa){_0x5e16aa=_0x5e16aa||0xcc;return function(_0x21a79){if(_0x21a79){return _0x24291d[_0xac4a('0x17')](_0x5e16aa);}return _0x24291d[_0xac4a('0x18')](_0x5e16aa)[_0xac4a('0x19')]();};}function respondWithResult(_0x1b4313,_0x3b71c0){_0x3b71c0=_0x3b71c0||0xc8;return function(_0x34bc01){if(_0x34bc01){return _0x1b4313[_0xac4a('0x18')](_0x3b71c0)[_0xac4a('0x1a')](_0x34bc01);}};}function respondWithFilteredResult(_0x42c7fc,_0x11e101){return function(_0x26dbb8){if(_0x26dbb8){var _0x4a2119=typeof _0x11e101[_0xac4a('0x1b')]===_0xac4a('0x1c')&&typeof _0x11e101[_0xac4a('0x1d')]===_0xac4a('0x1c');var _0x3e88e3=_0x26dbb8[_0xac4a('0x1e')];var _0x28e304=_0x4a2119?0x0:_0x11e101[_0xac4a('0x1b')];var _0x546c5d=_0x4a2119?_0x26dbb8['count']:_0x11e101[_0xac4a('0x1b')]+_0x11e101[_0xac4a('0x1d')];var _0x39b691;if(_0x546c5d>=_0x3e88e3){_0x546c5d=_0x3e88e3;_0x39b691=0xc8;}else{_0x39b691=0xce;}_0x42c7fc['status'](_0x39b691);return _0x42c7fc[_0xac4a('0x1f')](_0xac4a('0x20'),_0x28e304+'-'+_0x546c5d+'/'+_0x3e88e3)[_0xac4a('0x1a')](_0x26dbb8);}return null;};}function patchUpdates(_0x3a3cdb){return function(_0x123694){try{jsonpatch[_0xac4a('0x21')](_0x123694,_0x3a3cdb,!![]);}catch(_0xe38996){return BPromise[_0xac4a('0x22')](_0xe38996);}return _0x123694['save']();};}function saveUpdates(_0x3d8f0a,_0x3204ad){return function(_0x599787){if(_0x599787){return _0x599787[_0xac4a('0x23')](_0x3d8f0a)[_0xac4a('0x24')](function(_0x3eacd3){return _0x3eacd3;});}return null;};}function removeEntity(_0x947d8e,_0x4d2d6c){return function(_0x1b7998){if(_0x1b7998){return _0x1b7998[_0xac4a('0x25')]()[_0xac4a('0x24')](function(){_0x947d8e[_0xac4a('0x18')](0xcc)[_0xac4a('0x19')]();});}};}function handleEntityNotFound(_0x2b0dc2,_0x222507){return function(_0x36054a){if(!_0x36054a){_0x2b0dc2[_0xac4a('0x17')](0x194);}return _0x36054a;};}function handleError(_0x3bc318,_0x1d0539){_0x1d0539=_0x1d0539||0x1f4;return function(_0x215a31){logger[_0xac4a('0x26')](_0x215a31[_0xac4a('0x27')]);if(_0x215a31[_0xac4a('0x28')]){delete _0x215a31[_0xac4a('0x28')];}_0x3bc318['status'](_0x1d0539)[_0xac4a('0x29')](_0x215a31);};}exports[_0xac4a('0x2a')]=function(_0x42a33c,_0x2772fe){var _0x116700={},_0x4a5a9e={},_0x47f49c={'count':0x0,'rows':[]};var _0xdb7e=_[_0xac4a('0x2b')](db[_0xac4a('0x2c')]['rawAttributes'],function(_0x4bda1f){return{'name':_0x4bda1f[_0xac4a('0x2d')],'type':_0x4bda1f[_0xac4a('0x2e')][_0xac4a('0x2f')]};});_0x4a5a9e[_0xac4a('0x30')]=_[_0xac4a('0x2b')](_0xdb7e,'name');_0x4a5a9e[_0xac4a('0x31')]=_['keys'](_0x42a33c[_0xac4a('0x31')]);_0x4a5a9e['filters']=_[_0xac4a('0x32')](_0x4a5a9e[_0xac4a('0x30')],_0x4a5a9e[_0xac4a('0x31')]);_0x116700[_0xac4a('0x33')]=_[_0xac4a('0x32')](_0x4a5a9e[_0xac4a('0x30')],qs[_0xac4a('0x34')](_0x42a33c[_0xac4a('0x31')][_0xac4a('0x34')]));_0x116700[_0xac4a('0x33')]=_0x116700[_0xac4a('0x33')][_0xac4a('0x35')]?_0x116700[_0xac4a('0x33')]:_0x4a5a9e[_0xac4a('0x30')];if(!_0x42a33c['query'][_0xac4a('0x36')](_0xac4a('0x37'))){_0x116700['limit']=qs[_0xac4a('0x1d')](_0x42a33c[_0xac4a('0x31')]['limit']);_0x116700['offset']=qs[_0xac4a('0x1b')](_0x42a33c[_0xac4a('0x31')][_0xac4a('0x1b')]);}_0x116700[_0xac4a('0x38')]=qs['sort'](_0x42a33c[_0xac4a('0x31')][_0xac4a('0x39')]);_0x116700['where']=qs[_0xac4a('0x3a')](_[_0xac4a('0x3b')](_0x42a33c[_0xac4a('0x31')],_0x4a5a9e['filters']),_0xdb7e);if(_0x42a33c[_0xac4a('0x31')][_0xac4a('0x3c')]){_0x116700[_0xac4a('0x3d')]=_['merge'](_0x116700[_0xac4a('0x3d')],{'$or':_[_0xac4a('0x2b')](_0xdb7e,function(_0x4b9faf){if(_0x4b9faf['type']!==_0xac4a('0x3e')){var _0x5e0926={};_0x5e0926[_0x4b9faf['name']]={'$like':'%'+_0x42a33c['query']['filter']+'%'};return _0x5e0926;}})});}_0x116700=_[_0xac4a('0x3f')]({},_0x116700,_0x42a33c[_0xac4a('0x40')]);var _0x37834b={'where':_0x116700[_0xac4a('0x3d')]};return db[_0xac4a('0x2c')][_0xac4a('0x1e')](_0x37834b)[_0xac4a('0x24')](function(_0x2b16f0){_0x47f49c[_0xac4a('0x1e')]=_0x2b16f0;if(_0x42a33c[_0xac4a('0x31')][_0xac4a('0x41')]){_0x116700[_0xac4a('0x42')]=[{'all':!![]}];}return db['ChatQueueReport']['findAll'](_0x116700);})['then'](function(_0x1e1cc5){_0x47f49c[_0xac4a('0x43')]=_0x1e1cc5;return _0x47f49c;})[_0xac4a('0x24')](respondWithFilteredResult(_0x2772fe,_0x116700))[_0xac4a('0x44')](handleError(_0x2772fe,null));};exports[_0xac4a('0x45')]=function(_0x411543,_0x8febf0){var _0x3441f2={'raw':!![],'where':{'id':_0x411543[_0xac4a('0x46')]['id']}},_0x3e9973={};_0x3e9973['model']=_[_0xac4a('0x47')](db[_0xac4a('0x2c')][_0xac4a('0x48')]);_0x3e9973[_0xac4a('0x31')]=_[_0xac4a('0x47')](_0x411543['query']);_0x3e9973[_0xac4a('0x3a')]=_[_0xac4a('0x32')](_0x3e9973['model'],_0x3e9973[_0xac4a('0x31')]);_0x3441f2['attributes']=_[_0xac4a('0x32')](_0x3e9973[_0xac4a('0x30')],qs[_0xac4a('0x34')](_0x411543[_0xac4a('0x31')][_0xac4a('0x34')]));_0x3441f2[_0xac4a('0x33')]=_0x3441f2[_0xac4a('0x33')][_0xac4a('0x35')]?_0x3441f2[_0xac4a('0x33')]:_0x3e9973[_0xac4a('0x30')];if(_0x411543[_0xac4a('0x31')][_0xac4a('0x41')]){_0x3441f2['include']=[{'all':!![]}];}_0x3441f2=_[_0xac4a('0x3f')]({},_0x3441f2,_0x411543[_0xac4a('0x40')]);return db[_0xac4a('0x2c')]['find'](_0x3441f2)[_0xac4a('0x24')](handleEntityNotFound(_0x8febf0,null))[_0xac4a('0x24')](respondWithResult(_0x8febf0,null))['catch'](handleError(_0x8febf0,null));};exports[_0xac4a('0x49')]=function(_0x5a7f6e,_0x244950){return db[_0xac4a('0x2c')][_0xac4a('0x49')](_0x5a7f6e['body'],{})['then'](respondWithResult(_0x244950,0xc9))[_0xac4a('0x44')](handleError(_0x244950,null));};exports['update']=function(_0x18ae96,_0x566258){if(_0x18ae96[_0xac4a('0x4a')]['id']){delete _0x18ae96['body']['id'];}return db[_0xac4a('0x2c')][_0xac4a('0x4b')]({'where':{'id':_0x18ae96[_0xac4a('0x46')]['id']}})[_0xac4a('0x24')](handleEntityNotFound(_0x566258,null))['then'](saveUpdates(_0x18ae96[_0xac4a('0x4a')],null))[_0xac4a('0x24')](respondWithResult(_0x566258,null))[_0xac4a('0x44')](handleError(_0x566258,null));};exports[_0xac4a('0x25')]=function(_0x2f30e2,_0x138876){return db[_0xac4a('0x2c')]['find']({'where':{'id':_0x2f30e2[_0xac4a('0x46')]['id']}})[_0xac4a('0x24')](handleEntityNotFound(_0x138876,null))['then'](removeEntity(_0x138876,null))[_0xac4a('0x44')](handleError(_0x138876,null));};exports[_0xac4a('0x4c')]=function(_0x26e716,_0x3ac36e){return db['ChatQueueReport'][_0xac4a('0x4c')]()[_0xac4a('0x24')](respondWithResult(_0x3ac36e,null))[_0xac4a('0x44')](handleError(_0x3ac36e,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 5ea1a45..ac1c878 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 _0xb7e7=['../../config/logger','moment','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','define','ChatQueueReport','uniqueid','lodash'];(function(_0x69cf2c,_0x209feb){var _0x5a0817=function(_0x5bec49){while(--_0x5bec49){_0x69cf2c['push'](_0x69cf2c['shift']());}};_0x5a0817(++_0x209feb);}(_0xb7e7,0x121));var _0x7b7e=function(_0x3305de,_0x16582f){_0x3305de=_0x3305de-0x0;var _0x3b5a84=_0xb7e7[_0x3305de];return _0x3b5a84;};'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 +var _0xd8b0=['define','report_chat_queue','uniqueid','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x45e2ec,_0x47d252){var _0x423716=function(_0x292a4d){while(--_0x292a4d){_0x45e2ec['push'](_0x45e2ec['shift']());}};_0x423716(++_0x47d252);}(_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('./chatQueueReport.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('ChatQueueReport',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[{'name':_0x0d8b('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 4aec81b..4bad53d 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 _0x22c9=['util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ChatQueueReport,\x20%s,\x20%s','message','result','CreateChatQueueReport','ChatQueueReport','create','body','options','raw','info','catch','UpdateChatQueueReport','update','where','limit','lodash'];(function(_0x55a668,_0x495c0f){var _0x369e87=function(_0xc897e3){while(--_0xc897e3){_0x55a668['push'](_0x55a668['shift']());}};_0x369e87(++_0x495c0f);}(_0x22c9,0x8b));var _0x922c=function(_0x88620a,_0x1bc1d5){_0x88620a=_0x88620a-0x0;var _0x28983a=_0x22c9[_0x88620a];return _0x28983a;};'use strict';var _=require(_0x922c('0x0'));var util=require(_0x922c('0x1'));var moment=require(_0x922c('0x2'));var BPromise=require(_0x922c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x922c('0x4'))['db'];var utils=require(_0x922c('0x5'));var logger=require(_0x922c('0x6'))(_0x922c('0x7'));var config=require(_0x922c('0x8'));var jayson=require(_0x922c('0x9'));var client=jayson[_0x922c('0xa')][_0x922c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x35451c,_0x1408d3,_0x395fc1){return new BPromise(function(_0xe8b783,_0x9fac83){return client[_0x922c('0xc')](_0x35451c,_0x395fc1)[_0x922c('0xd')](function(_0x5b4599){logger['info']('ChatQueueReport,\x20%s,\x20%s',_0x1408d3,'request\x20sent');logger[_0x922c('0xe')](_0x922c('0xf'),_0x1408d3,_0x922c('0x10'),JSON[_0x922c('0x11')](_0x5b4599));if(_0x5b4599[_0x922c('0x12')]){if(_0x5b4599[_0x922c('0x12')][_0x922c('0x13')]===0x1f4){logger['error'](_0x922c('0x14'),_0x1408d3,_0x5b4599[_0x922c('0x12')][_0x922c('0x15')]);return _0x9fac83(_0x5b4599['error']['message']);}logger['error']('ChatQueueReport,\x20%s,\x20%s',_0x1408d3,_0x5b4599['error'][_0x922c('0x15')]);return _0xe8b783(_0x5b4599[_0x922c('0x12')][_0x922c('0x15')]);}else{logger['info'](_0x922c('0x14'),_0x1408d3,'request\x20sent');_0xe8b783(_0x5b4599[_0x922c('0x16')][_0x922c('0x15')]);}})['catch'](function(_0x567856){logger[_0x922c('0x12')]('ChatQueueReport,\x20%s,\x20%s',_0x1408d3,_0x567856);_0x9fac83(_0x567856);});});}exports[_0x922c('0x17')]=function(_0x4efbf8){var _0x4a9e0=this;return new Promise(function(_0x50113d,_0x104a85){return db[_0x922c('0x18')][_0x922c('0x19')](_0x4efbf8[_0x922c('0x1a')],{'raw':_0x4efbf8[_0x922c('0x1b')]?_0x4efbf8[_0x922c('0x1b')][_0x922c('0x1c')]===undefined?!![]:![]:!![]})[_0x922c('0xd')](function(_0x2f076f){logger[_0x922c('0x1d')](_0x922c('0x17'),_0x4efbf8);logger['debug'](_0x922c('0x17'),_0x4efbf8,JSON[_0x922c('0x11')](_0x2f076f));_0x50113d(_0x2f076f);})[_0x922c('0x1e')](function(_0x4bdf1){logger[_0x922c('0x12')]('CreateChatQueueReport',_0x4bdf1['message'],_0x4efbf8);_0x104a85(_0x4a9e0[_0x922c('0x12')](0x1f4,_0x4bdf1[_0x922c('0x15')]));});});};exports[_0x922c('0x1f')]=function(_0x65983a){var _0x19d9c4=this;return new Promise(function(_0x991cfd,_0xa985fd){return db[_0x922c('0x18')][_0x922c('0x20')](_0x65983a[_0x922c('0x1a')],{'raw':_0x65983a[_0x922c('0x1b')]?_0x65983a['options'][_0x922c('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x65983a[_0x922c('0x1b')]?_0x65983a[_0x922c('0x1b')][_0x922c('0x21')]||null:null,'attributes':_0x65983a[_0x922c('0x1b')]?_0x65983a[_0x922c('0x1b')]['attributes']||null:null,'limit':_0x65983a['options']?_0x65983a[_0x922c('0x1b')][_0x922c('0x22')]||null:null})[_0x922c('0xd')](function(_0x412fd9){logger[_0x922c('0x1d')](_0x922c('0x1f'),_0x65983a);logger[_0x922c('0xe')](_0x922c('0x1f'),_0x65983a,JSON[_0x922c('0x11')](_0x412fd9));_0x991cfd(_0x412fd9);})[_0x922c('0x1e')](function(_0xf1cfb6){logger[_0x922c('0x12')](_0x922c('0x1f'),_0xf1cfb6[_0x922c('0x15')],_0x65983a);_0xa985fd(_0x19d9c4[_0x922c('0x12')](0x1f4,_0xf1cfb6[_0x922c('0x15')]));});});}; \ No newline at end of file +var _0x6d96=['rpc','../../config/environment','jayson/promise','client','http','request','then','ChatQueueReport,\x20%s,\x20%s','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','info','request\x20sent','result','message','catch','CreateChatQueueReport','ChatQueueReport','create','body','options','raw','update','where','limit','UpdateChatQueueReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x6d96,0x13c));var _0x66d9=function(_0x304655,_0x15b109){_0x304655=_0x304655-0x0;var _0x2fa58a=_0x6d96[_0x304655];return _0x2fa58a;};'use strict';var _=require(_0x66d9('0x0'));var util=require(_0x66d9('0x1'));var moment=require(_0x66d9('0x2'));var BPromise=require(_0x66d9('0x3'));var rs=require(_0x66d9('0x4'));var fs=require('fs');var Redis=require(_0x66d9('0x5'));var db=require(_0x66d9('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x66d9('0x7'))(_0x66d9('0x8'));var config=require(_0x66d9('0x9'));var jayson=require(_0x66d9('0xa'));var client=jayson[_0x66d9('0xb')][_0x66d9('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x6b7a0e,_0x416301,_0x56411e){return new BPromise(function(_0x3d4690,_0x470aa5){return client[_0x66d9('0xd')](_0x6b7a0e,_0x56411e)[_0x66d9('0xe')](function(_0x201f7f){logger['info'](_0x66d9('0xf'),_0x416301,'request\x20sent');logger[_0x66d9('0x10')](_0x66d9('0x11'),_0x416301,'request\x20sent',JSON[_0x66d9('0x12')](_0x201f7f));if(_0x201f7f[_0x66d9('0x13')]){if(_0x201f7f[_0x66d9('0x13')][_0x66d9('0x14')]===0x1f4){logger[_0x66d9('0x13')]('ChatQueueReport,\x20%s,\x20%s',_0x416301,_0x201f7f[_0x66d9('0x13')]['message']);return _0x470aa5(_0x201f7f[_0x66d9('0x13')]['message']);}logger[_0x66d9('0x13')](_0x66d9('0xf'),_0x416301,_0x201f7f[_0x66d9('0x13')]['message']);return _0x3d4690(_0x201f7f[_0x66d9('0x13')]['message']);}else{logger[_0x66d9('0x15')](_0x66d9('0xf'),_0x416301,_0x66d9('0x16'));_0x3d4690(_0x201f7f[_0x66d9('0x17')][_0x66d9('0x18')]);}})[_0x66d9('0x19')](function(_0x1a4db6){logger['error'](_0x66d9('0xf'),_0x416301,_0x1a4db6);_0x470aa5(_0x1a4db6);});});}exports[_0x66d9('0x1a')]=function(_0x548a59){var _0x445607=this;return new Promise(function(_0xd36d7f,_0x151e77){return db[_0x66d9('0x1b')][_0x66d9('0x1c')](_0x548a59[_0x66d9('0x1d')],{'raw':_0x548a59['options']?_0x548a59[_0x66d9('0x1e')][_0x66d9('0x1f')]===undefined?!![]:![]:!![]})[_0x66d9('0xe')](function(_0x35a58e){logger[_0x66d9('0x15')](_0x66d9('0x1a'),_0x548a59);logger['debug'](_0x66d9('0x1a'),_0x548a59,JSON[_0x66d9('0x12')](_0x35a58e));_0xd36d7f(_0x35a58e);})[_0x66d9('0x19')](function(_0x513314){logger[_0x66d9('0x13')](_0x66d9('0x1a'),_0x513314[_0x66d9('0x18')],_0x548a59);_0x151e77(_0x445607['error'](0x1f4,_0x513314[_0x66d9('0x18')]));});});};exports['UpdateChatQueueReport']=function(_0x10dd00){var _0x525435=this;return new Promise(function(_0x861cd6,_0x257967){return db[_0x66d9('0x1b')][_0x66d9('0x20')](_0x10dd00[_0x66d9('0x1d')],{'raw':_0x10dd00['options']?_0x10dd00[_0x66d9('0x1e')][_0x66d9('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x10dd00[_0x66d9('0x1e')]?_0x10dd00[_0x66d9('0x1e')][_0x66d9('0x21')]||null:null,'attributes':_0x10dd00[_0x66d9('0x1e')]?_0x10dd00[_0x66d9('0x1e')]['attributes']||null:null,'limit':_0x10dd00['options']?_0x10dd00[_0x66d9('0x1e')][_0x66d9('0x22')]||null:null})[_0x66d9('0xe')](function(_0x586f8e){logger['info'](_0x66d9('0x23'),_0x10dd00);logger[_0x66d9('0x10')](_0x66d9('0x23'),_0x10dd00,JSON['stringify'](_0x586f8e));_0x861cd6(_0x586f8e);})[_0x66d9('0x19')](function(_0x3b2edf){logger[_0x66d9('0x13')](_0x66d9('0x23'),_0x3b2edf[_0x66d9('0x18')],_0x10dd00);_0x257967(_0x525435[_0x66d9('0x13')](0x1f4,_0x3b2edf['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 4a635d3..ec0d6be 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 _0x44f6=['delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','put'];(function(_0x1f5863,_0xc4fcb0){var _0x7aee22=function(_0x28ff0c){while(--_0x28ff0c){_0x1f5863['push'](_0x1f5863['shift']());}};_0x7aee22(++_0xc4fcb0);}(_0x44f6,0x163));var _0x644f=function(_0x571c1d,_0x3b0586){_0x571c1d=_0x571c1d-0x0;var _0x33c609=_0x44f6[_0x571c1d];return _0x33c609;};'use strict';var multer=require(_0x644f('0x0'));var util=require(_0x644f('0x1'));var path=require('path');var timeout=require(_0x644f('0x2'));var express=require(_0x644f('0x3'));var router=express[_0x644f('0x4')]();var fs_extra=require(_0x644f('0x5'));var auth=require(_0x644f('0x6'));var interaction=require(_0x644f('0x7'));var config=require(_0x644f('0x8'));var controller=require(_0x644f('0x9'));router[_0x644f('0xa')]('/',auth[_0x644f('0xb')](),controller[_0x644f('0xc')]);router[_0x644f('0xa')](_0x644f('0xd'),auth[_0x644f('0xb')](),controller['describe']);router[_0x644f('0xa')](_0x644f('0xe'),auth['isAuthenticated'](),controller[_0x644f('0xf')]);router[_0x644f('0x10')]('/',auth[_0x644f('0xb')](),controller[_0x644f('0x11')]);router[_0x644f('0x12')](_0x644f('0xe'),auth['isAuthenticated'](),controller['update']);router[_0x644f('0x13')](_0x644f('0xe'),auth[_0x644f('0xb')](),controller[_0x644f('0x14')]);module[_0x644f('0x15')]=router; \ No newline at end of file +var _0x9892=['post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','index','/:id','show'];(function(_0x1e0eba,_0x15a84c){var _0x631c66=function(_0x36e68){while(--_0x36e68){_0x1e0eba['push'](_0x1e0eba['shift']());}};_0x631c66(++_0x15a84c);}(_0x9892,0xae));var _0x2989=function(_0x46b22a,_0x5bf83a){_0x46b22a=_0x46b22a-0x0;var _0x44c2e8=_0x9892[_0x46b22a];return _0x44c2e8;};'use strict';var multer=require(_0x2989('0x0'));var util=require(_0x2989('0x1'));var path=require(_0x2989('0x2'));var timeout=require(_0x2989('0x3'));var express=require(_0x2989('0x4'));var router=express[_0x2989('0x5')]();var fs_extra=require(_0x2989('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x2989('0x7'));var config=require(_0x2989('0x8'));var controller=require(_0x2989('0x9'));router[_0x2989('0xa')]('/',auth[_0x2989('0xb')](),controller[_0x2989('0xc')]);router[_0x2989('0xa')]('/describe',auth[_0x2989('0xb')](),controller['describe']);router[_0x2989('0xa')](_0x2989('0xd'),auth[_0x2989('0xb')](),controller[_0x2989('0xe')]);router[_0x2989('0xf')]('/',auth['isAuthenticated'](),controller[_0x2989('0x10')]);router[_0x2989('0x11')]('/:id',auth[_0x2989('0xb')](),controller['update']);router[_0x2989('0x12')](_0x2989('0xd'),auth[_0x2989('0xb')](),controller[_0x2989('0x13')]);module[_0x2989('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 a8037ca..5bafe5b 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 _0x4b84=['moment','sequelize','ENUM','queue','DATE'];(function(_0x4abf88,_0x4d90c9){var _0x243b3f=function(_0x40c494){while(--_0x40c494){_0x4abf88['push'](_0x4abf88['shift']());}};_0x243b3f(++_0x4d90c9);}(_0x4b84,0x1cc));var _0x44b8=function(_0x1b8b95,_0x3ea343){_0x1b8b95=_0x1b8b95-0x0;var _0x3657ae=_0x4b84[_0x1b8b95];return _0x3657ae;};'use strict';var moment=require(_0x44b8('0x0'));var Sequelize=require(_0x44b8('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x44b8('0x2')]('account','agent',_0x44b8('0x3')),'allowNull':![],'defaultValue':_0x44b8('0x3')},'transferredAt':{'type':Sequelize[_0x44b8('0x4')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0xedd9=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0x88ba56,_0x5caa1e){var _0x1c1639=function(_0x377bc2){while(--_0x377bc2){_0x88ba56['push'](_0x88ba56['shift']());}};_0x1c1639(++_0x5caa1e);}(_0xedd9,0xfc));var _0x9edd=function(_0x20da4,_0x33a01e){_0x20da4=_0x20da4-0x0;var _0x10a2ea=_0xedd9[_0x20da4];return _0x10a2ea;};'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 5f11012..644f72a 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 _0x8623=['limit','undefined','count','set','Content-Range','reject','save','update','then','error','name','send','map','ChatTransferReport','rawAttributes','type','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','keys','create','body','find','destroy','describe','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','fs-extra','squel','crypto','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','status','end','json','offset'];(function(_0x3ebbd2,_0x18293c){var _0x5cc1ba=function(_0x3ccace){while(--_0x3ccace){_0x3ebbd2['push'](_0x3ebbd2['shift']());}};_0x5cc1ba(++_0x18293c);}(_0x8623,0x14d));var _0x3862=function(_0x342c98,_0x4ef76f){_0x342c98=_0x342c98-0x0;var _0x224575=_0x8623[_0x342c98];return _0x224575;};'use strict';var emlformat=require(_0x3862('0x0'));var rimraf=require(_0x3862('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x3862('0x2'));var moment=require(_0x3862('0x3'));var BPromise=require(_0x3862('0x4'));var Mustache=require(_0x3862('0x5'));var util=require(_0x3862('0x6'));var path=require(_0x3862('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3862('0x8'));var _=require('lodash');var squel=require(_0x3862('0x9'));var crypto=require(_0x3862('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x3862('0xb'));var toCsv=require(_0x3862('0xc'));var querystring=require(_0x3862('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3862('0xe'));var qs=require(_0x3862('0xf'));var as=require(_0x3862('0x10'));var hardwareService=require(_0x3862('0x11'));var logger=require(_0x3862('0x12'))('api');var utils=require(_0x3862('0x13'));var config=require(_0x3862('0x14'));var licenseUtil=require(_0x3862('0x15'));var db=require(_0x3862('0x16'))['db'];function respondWithStatusCode(_0xade9ea,_0x10754f){_0x10754f=_0x10754f||0xcc;return function(_0x33acae){if(_0x33acae){return _0xade9ea['sendStatus'](_0x10754f);}return _0xade9ea[_0x3862('0x17')](_0x10754f)[_0x3862('0x18')]();};}function respondWithResult(_0x284ab7,_0x5b9dc1){_0x5b9dc1=_0x5b9dc1||0xc8;return function(_0x35c939){if(_0x35c939){return _0x284ab7[_0x3862('0x17')](_0x5b9dc1)[_0x3862('0x19')](_0x35c939);}};}function respondWithFilteredResult(_0x21ffe4,_0x2cbbd2){return function(_0x451b6b){if(_0x451b6b){var _0x51d13b=typeof _0x2cbbd2[_0x3862('0x1a')]==='undefined'&&typeof _0x2cbbd2[_0x3862('0x1b')]===_0x3862('0x1c');var _0x362da4=_0x451b6b['count'];var _0xcababe=_0x51d13b?0x0:_0x2cbbd2[_0x3862('0x1a')];var _0x36b569=_0x51d13b?_0x451b6b[_0x3862('0x1d')]:_0x2cbbd2['offset']+_0x2cbbd2['limit'];var _0x2e96fb;if(_0x36b569>=_0x362da4){_0x36b569=_0x362da4;_0x2e96fb=0xc8;}else{_0x2e96fb=0xce;}_0x21ffe4[_0x3862('0x17')](_0x2e96fb);return _0x21ffe4[_0x3862('0x1e')](_0x3862('0x1f'),_0xcababe+'-'+_0x36b569+'/'+_0x362da4)['json'](_0x451b6b);}return null;};}function patchUpdates(_0x12de87){return function(_0x3b1bc2){try{jsonpatch['apply'](_0x3b1bc2,_0x12de87,!![]);}catch(_0x680276){return BPromise[_0x3862('0x20')](_0x680276);}return _0x3b1bc2[_0x3862('0x21')]();};}function saveUpdates(_0x38e056,_0x8a0ce6){return function(_0x517923){if(_0x517923){return _0x517923[_0x3862('0x22')](_0x38e056)[_0x3862('0x23')](function(_0xd293aa){return _0xd293aa;});}return null;};}function removeEntity(_0x3f388b,_0x513e2c){return function(_0x482edf){if(_0x482edf){return _0x482edf['destroy']()[_0x3862('0x23')](function(){_0x3f388b[_0x3862('0x17')](0xcc)[_0x3862('0x18')]();});}};}function handleEntityNotFound(_0x305010,_0x333c4f){return function(_0x5371a0){if(!_0x5371a0){_0x305010['sendStatus'](0x194);}return _0x5371a0;};}function handleError(_0x31227f,_0x5f3a96){_0x5f3a96=_0x5f3a96||0x1f4;return function(_0x26ee90){logger[_0x3862('0x24')](_0x26ee90['stack']);if(_0x26ee90[_0x3862('0x25')]){delete _0x26ee90['name'];}_0x31227f[_0x3862('0x17')](_0x5f3a96)[_0x3862('0x26')](_0x26ee90);};}exports['index']=function(_0x182683,_0x422fac){var _0x490395={},_0x29f632={},_0xdf184={'count':0x0,'rows':[]};var _0x4922ac=_[_0x3862('0x27')](db[_0x3862('0x28')][_0x3862('0x29')],function(_0xf0de53){return{'name':_0xf0de53['fieldName'],'type':_0xf0de53[_0x3862('0x2a')]['key']};});_0x29f632['model']=_['map'](_0x4922ac,_0x3862('0x25'));_0x29f632[_0x3862('0x2b')]=_['keys'](_0x182683[_0x3862('0x2b')]);_0x29f632[_0x3862('0x2c')]=_[_0x3862('0x2d')](_0x29f632[_0x3862('0x2e')],_0x29f632['query']);_0x490395[_0x3862('0x2f')]=_[_0x3862('0x2d')](_0x29f632[_0x3862('0x2e')],qs[_0x3862('0x30')](_0x182683[_0x3862('0x2b')]['fields']));_0x490395['attributes']=_0x490395['attributes'][_0x3862('0x31')]?_0x490395['attributes']:_0x29f632[_0x3862('0x2e')];if(!_0x182683['query'][_0x3862('0x32')]('nolimit')){_0x490395[_0x3862('0x1b')]=qs[_0x3862('0x1b')](_0x182683[_0x3862('0x2b')][_0x3862('0x1b')]);_0x490395[_0x3862('0x1a')]=qs[_0x3862('0x1a')](_0x182683[_0x3862('0x2b')][_0x3862('0x1a')]);}_0x490395[_0x3862('0x33')]=qs['sort'](_0x182683[_0x3862('0x2b')][_0x3862('0x34')]);_0x490395[_0x3862('0x35')]=qs[_0x3862('0x2c')](_[_0x3862('0x36')](_0x182683[_0x3862('0x2b')],_0x29f632[_0x3862('0x2c')]),_0x4922ac);if(_0x182683[_0x3862('0x2b')]['filter']){_0x490395[_0x3862('0x35')]=_[_0x3862('0x37')](_0x490395[_0x3862('0x35')],{'$or':_[_0x3862('0x27')](_0x4922ac,function(_0x5aa5b1){if(_0x5aa5b1[_0x3862('0x2a')]!==_0x3862('0x38')){var _0x21c063={};_0x21c063[_0x5aa5b1['name']]={'$like':'%'+_0x182683[_0x3862('0x2b')][_0x3862('0x39')]+'%'};return _0x21c063;}})});}_0x490395=_[_0x3862('0x37')]({},_0x490395,_0x182683[_0x3862('0x3a')]);var _0x46e611={'where':_0x490395[_0x3862('0x35')]};return db[_0x3862('0x28')][_0x3862('0x1d')](_0x46e611)[_0x3862('0x23')](function(_0x203da7){_0xdf184[_0x3862('0x1d')]=_0x203da7;if(_0x182683['query'][_0x3862('0x3b')]){_0x490395[_0x3862('0x3c')]=[{'all':!![]}];}return db[_0x3862('0x28')][_0x3862('0x3d')](_0x490395);})['then'](function(_0x20ceb6){_0xdf184[_0x3862('0x3e')]=_0x20ceb6;return _0xdf184;})[_0x3862('0x23')](respondWithFilteredResult(_0x422fac,_0x490395))[_0x3862('0x3f')](handleError(_0x422fac,null));};exports[_0x3862('0x40')]=function(_0x295860,_0x50cfe1){var _0x4a4496={'raw':!![],'where':{'id':_0x295860[_0x3862('0x41')]['id']}},_0x1ce9c2={};_0x1ce9c2['model']=_[_0x3862('0x42')](db[_0x3862('0x28')]['rawAttributes']);_0x1ce9c2[_0x3862('0x2b')]=_[_0x3862('0x42')](_0x295860[_0x3862('0x2b')]);_0x1ce9c2[_0x3862('0x2c')]=_['intersection'](_0x1ce9c2[_0x3862('0x2e')],_0x1ce9c2['query']);_0x4a4496['attributes']=_['intersection'](_0x1ce9c2[_0x3862('0x2e')],qs['fields'](_0x295860['query'][_0x3862('0x30')]));_0x4a4496[_0x3862('0x2f')]=_0x4a4496[_0x3862('0x2f')][_0x3862('0x31')]?_0x4a4496[_0x3862('0x2f')]:_0x1ce9c2[_0x3862('0x2e')];if(_0x295860[_0x3862('0x2b')][_0x3862('0x3b')]){_0x4a4496[_0x3862('0x3c')]=[{'all':!![]}];}_0x4a4496=_[_0x3862('0x37')]({},_0x4a4496,_0x295860[_0x3862('0x3a')]);return db[_0x3862('0x28')]['find'](_0x4a4496)[_0x3862('0x23')](handleEntityNotFound(_0x50cfe1,null))[_0x3862('0x23')](respondWithResult(_0x50cfe1,null))[_0x3862('0x3f')](handleError(_0x50cfe1,null));};exports[_0x3862('0x43')]=function(_0x553f7f,_0x2292d2){return db[_0x3862('0x28')][_0x3862('0x43')](_0x553f7f[_0x3862('0x44')],{})[_0x3862('0x23')](respondWithResult(_0x2292d2,0xc9))[_0x3862('0x3f')](handleError(_0x2292d2,null));};exports[_0x3862('0x22')]=function(_0x378cd9,_0x572329){if(_0x378cd9[_0x3862('0x44')]['id']){delete _0x378cd9[_0x3862('0x44')]['id'];}return db['ChatTransferReport'][_0x3862('0x45')]({'where':{'id':_0x378cd9['params']['id']}})[_0x3862('0x23')](handleEntityNotFound(_0x572329,null))[_0x3862('0x23')](saveUpdates(_0x378cd9[_0x3862('0x44')],null))[_0x3862('0x23')](respondWithResult(_0x572329,null))[_0x3862('0x3f')](handleError(_0x572329,null));};exports[_0x3862('0x46')]=function(_0xbf4097,_0xdd49b5){return db['ChatTransferReport']['find']({'where':{'id':_0xbf4097[_0x3862('0x41')]['id']}})[_0x3862('0x23')](handleEntityNotFound(_0xdd49b5,null))['then'](removeEntity(_0xdd49b5,null))[_0x3862('0x3f')](handleError(_0xdd49b5,null));};exports['describe']=function(_0x2ea22f,_0x18e682){return db[_0x3862('0x28')][_0x3862('0x47')]()[_0x3862('0x23')](respondWithResult(_0x18e682,null))['catch'](handleError(_0x18e682,null));}; \ No newline at end of file +var _0x6d54=['fieldName','type','model','map','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','where','merge','VIRTUAL','filter','then','include','findAll','rows','catch','params','keys','includeAll','options','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','apply','save','update','destroy','error','stack','name','send','ChatTransferReport','rawAttributes'];(function(_0x341517,_0x5297d1){var _0x106eab=function(_0x3796e2){while(--_0x3796e2){_0x341517['push'](_0x341517['shift']());}};_0x106eab(++_0x5297d1);}(_0x6d54,0xab));var _0x46d5=function(_0x469100,_0x537385){_0x469100=_0x469100-0x0;var _0x26efb8=_0x6d54[_0x469100];return _0x26efb8;};'use strict';var emlformat=require(_0x46d5('0x0'));var rimraf=require(_0x46d5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x46d5('0x2'));var rp=require(_0x46d5('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x46d5('0x4'));var sox=require(_0x46d5('0x5'));var csv=require(_0x46d5('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x46d5('0x7'));var _=require(_0x46d5('0x8'));var squel=require('squel');var crypto=require(_0x46d5('0x9'));var jsforce=require(_0x46d5('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x46d5('0x6'));var querystring=require(_0x46d5('0xb'));var Papa=require(_0x46d5('0xc'));var Redis=require(_0x46d5('0xd'));var authService=require(_0x46d5('0xe'));var qs=require(_0x46d5('0xf'));var as=require(_0x46d5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x46d5('0x11'))(_0x46d5('0x12'));var utils=require(_0x46d5('0x13'));var config=require(_0x46d5('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x157599,_0x5a9fa4){_0x5a9fa4=_0x5a9fa4||0xcc;return function(_0x23b309){if(_0x23b309){return _0x157599[_0x46d5('0x15')](_0x5a9fa4);}return _0x157599[_0x46d5('0x16')](_0x5a9fa4)[_0x46d5('0x17')]();};}function respondWithResult(_0x43a577,_0x13eb69){_0x13eb69=_0x13eb69||0xc8;return function(_0x4710ec){if(_0x4710ec){return _0x43a577[_0x46d5('0x16')](_0x13eb69)[_0x46d5('0x18')](_0x4710ec);}};}function respondWithFilteredResult(_0x30eba7,_0x275dcf){return function(_0x2d190b){if(_0x2d190b){var _0x4368a6=typeof _0x275dcf[_0x46d5('0x19')]===_0x46d5('0x1a')&&typeof _0x275dcf[_0x46d5('0x1b')]===_0x46d5('0x1a');var _0xae9ec=_0x2d190b[_0x46d5('0x1c')];var _0x954bdb=_0x4368a6?0x0:_0x275dcf['offset'];var _0x1a1125=_0x4368a6?_0x2d190b[_0x46d5('0x1c')]:_0x275dcf[_0x46d5('0x19')]+_0x275dcf[_0x46d5('0x1b')];var _0xcc40f;if(_0x1a1125>=_0xae9ec){_0x1a1125=_0xae9ec;_0xcc40f=0xc8;}else{_0xcc40f=0xce;}_0x30eba7[_0x46d5('0x16')](_0xcc40f);return _0x30eba7['set']('Content-Range',_0x954bdb+'-'+_0x1a1125+'/'+_0xae9ec)[_0x46d5('0x18')](_0x2d190b);}return null;};}function patchUpdates(_0x4243df){return function(_0x1bd19e){try{jsonpatch[_0x46d5('0x1d')](_0x1bd19e,_0x4243df,!![]);}catch(_0x2282e1){return BPromise['reject'](_0x2282e1);}return _0x1bd19e[_0x46d5('0x1e')]();};}function saveUpdates(_0x2b3481,_0x44e891){return function(_0x30aaa3){if(_0x30aaa3){return _0x30aaa3[_0x46d5('0x1f')](_0x2b3481)['then'](function(_0x1456f0){return _0x1456f0;});}return null;};}function removeEntity(_0x36f9af,_0x4e1526){return function(_0x2d47b0){if(_0x2d47b0){return _0x2d47b0[_0x46d5('0x20')]()['then'](function(){_0x36f9af[_0x46d5('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x42cb85,_0x50ead4){return function(_0x2fe76f){if(!_0x2fe76f){_0x42cb85['sendStatus'](0x194);}return _0x2fe76f;};}function handleError(_0x5c506b,_0xee02de){_0xee02de=_0xee02de||0x1f4;return function(_0x5b64f1){logger[_0x46d5('0x21')](_0x5b64f1[_0x46d5('0x22')]);if(_0x5b64f1[_0x46d5('0x23')]){delete _0x5b64f1[_0x46d5('0x23')];}_0x5c506b[_0x46d5('0x16')](_0xee02de)[_0x46d5('0x24')](_0x5b64f1);};}exports['index']=function(_0x4c8a5c,_0x3720a6){var _0x38e285={},_0x5884b6={},_0x24e0e6={'count':0x0,'rows':[]};var _0x2726c1=_['map'](db[_0x46d5('0x25')][_0x46d5('0x26')],function(_0x52fc2e){return{'name':_0x52fc2e[_0x46d5('0x27')],'type':_0x52fc2e[_0x46d5('0x28')]['key']};});_0x5884b6[_0x46d5('0x29')]=_[_0x46d5('0x2a')](_0x2726c1,_0x46d5('0x23'));_0x5884b6['query']=_['keys'](_0x4c8a5c[_0x46d5('0x2b')]);_0x5884b6['filters']=_[_0x46d5('0x2c')](_0x5884b6['model'],_0x5884b6['query']);_0x38e285[_0x46d5('0x2d')]=_['intersection'](_0x5884b6[_0x46d5('0x29')],qs[_0x46d5('0x2e')](_0x4c8a5c[_0x46d5('0x2b')][_0x46d5('0x2e')]));_0x38e285['attributes']=_0x38e285[_0x46d5('0x2d')][_0x46d5('0x2f')]?_0x38e285[_0x46d5('0x2d')]:_0x5884b6[_0x46d5('0x29')];if(!_0x4c8a5c[_0x46d5('0x2b')][_0x46d5('0x30')](_0x46d5('0x31'))){_0x38e285[_0x46d5('0x1b')]=qs['limit'](_0x4c8a5c[_0x46d5('0x2b')][_0x46d5('0x1b')]);_0x38e285[_0x46d5('0x19')]=qs['offset'](_0x4c8a5c[_0x46d5('0x2b')][_0x46d5('0x19')]);}_0x38e285[_0x46d5('0x32')]=qs['sort'](_0x4c8a5c[_0x46d5('0x2b')][_0x46d5('0x33')]);_0x38e285['where']=qs[_0x46d5('0x34')](_['pick'](_0x4c8a5c[_0x46d5('0x2b')],_0x5884b6[_0x46d5('0x34')]),_0x2726c1);if(_0x4c8a5c[_0x46d5('0x2b')]['filter']){_0x38e285[_0x46d5('0x35')]=_[_0x46d5('0x36')](_0x38e285['where'],{'$or':_[_0x46d5('0x2a')](_0x2726c1,function(_0x407fb8){if(_0x407fb8[_0x46d5('0x28')]!==_0x46d5('0x37')){var _0x311aa8={};_0x311aa8[_0x407fb8[_0x46d5('0x23')]]={'$like':'%'+_0x4c8a5c['query'][_0x46d5('0x38')]+'%'};return _0x311aa8;}})});}_0x38e285=_[_0x46d5('0x36')]({},_0x38e285,_0x4c8a5c['options']);var _0x9fc212={'where':_0x38e285['where']};return db[_0x46d5('0x25')][_0x46d5('0x1c')](_0x9fc212)[_0x46d5('0x39')](function(_0x56c305){_0x24e0e6[_0x46d5('0x1c')]=_0x56c305;if(_0x4c8a5c[_0x46d5('0x2b')]['includeAll']){_0x38e285[_0x46d5('0x3a')]=[{'all':!![]}];}return db['ChatTransferReport'][_0x46d5('0x3b')](_0x38e285);})['then'](function(_0x1d7be0){_0x24e0e6[_0x46d5('0x3c')]=_0x1d7be0;return _0x24e0e6;})[_0x46d5('0x39')](respondWithFilteredResult(_0x3720a6,_0x38e285))[_0x46d5('0x3d')](handleError(_0x3720a6,null));};exports['show']=function(_0x185d73,_0x4dc285){var _0x4e70df={'raw':!![],'where':{'id':_0x185d73[_0x46d5('0x3e')]['id']}},_0x87713d={};_0x87713d[_0x46d5('0x29')]=_[_0x46d5('0x3f')](db[_0x46d5('0x25')][_0x46d5('0x26')]);_0x87713d[_0x46d5('0x2b')]=_['keys'](_0x185d73[_0x46d5('0x2b')]);_0x87713d[_0x46d5('0x34')]=_['intersection'](_0x87713d[_0x46d5('0x29')],_0x87713d[_0x46d5('0x2b')]);_0x4e70df[_0x46d5('0x2d')]=_['intersection'](_0x87713d['model'],qs[_0x46d5('0x2e')](_0x185d73['query'][_0x46d5('0x2e')]));_0x4e70df[_0x46d5('0x2d')]=_0x4e70df[_0x46d5('0x2d')][_0x46d5('0x2f')]?_0x4e70df['attributes']:_0x87713d[_0x46d5('0x29')];if(_0x185d73[_0x46d5('0x2b')][_0x46d5('0x40')]){_0x4e70df[_0x46d5('0x3a')]=[{'all':!![]}];}_0x4e70df=_[_0x46d5('0x36')]({},_0x4e70df,_0x185d73[_0x46d5('0x41')]);return db[_0x46d5('0x25')][_0x46d5('0x42')](_0x4e70df)[_0x46d5('0x39')](handleEntityNotFound(_0x4dc285,null))[_0x46d5('0x39')](respondWithResult(_0x4dc285,null))[_0x46d5('0x3d')](handleError(_0x4dc285,null));};exports[_0x46d5('0x43')]=function(_0x48d9f8,_0x1b6ba9){return db[_0x46d5('0x25')][_0x46d5('0x43')](_0x48d9f8['body'],{})[_0x46d5('0x39')](respondWithResult(_0x1b6ba9,0xc9))[_0x46d5('0x3d')](handleError(_0x1b6ba9,null));};exports[_0x46d5('0x1f')]=function(_0x4e06b3,_0x2a92e2){if(_0x4e06b3[_0x46d5('0x44')]['id']){delete _0x4e06b3[_0x46d5('0x44')]['id'];}return db[_0x46d5('0x25')][_0x46d5('0x42')]({'where':{'id':_0x4e06b3['params']['id']}})['then'](handleEntityNotFound(_0x2a92e2,null))['then'](saveUpdates(_0x4e06b3['body'],null))[_0x46d5('0x39')](respondWithResult(_0x2a92e2,null))['catch'](handleError(_0x2a92e2,null));};exports[_0x46d5('0x20')]=function(_0x3ea800,_0x3700a7){return db[_0x46d5('0x25')][_0x46d5('0x42')]({'where':{'id':_0x3ea800[_0x46d5('0x3e')]['id']}})[_0x46d5('0x39')](handleEntityNotFound(_0x3700a7,null))[_0x46d5('0x39')](removeEntity(_0x3700a7,null))[_0x46d5('0x3d')](handleError(_0x3700a7,null));};exports[_0x46d5('0x45')]=function(_0x2419f3,_0x1a0251){return db[_0x46d5('0x25')][_0x46d5('0x45')]()[_0x46d5('0x39')](respondWithResult(_0x1a0251,null))['catch'](handleError(_0x1a0251,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index df3315a..1115c9c 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 _0x8309=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','ChatTransferReport','report_chat_transfer','uniqueid','lodash'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8309,0x151));var _0x9830=function(_0xd3bdab,_0x5d784a){_0xd3bdab=_0xd3bdab-0x0;var _0x1c3178=_0x8309[_0xd3bdab];return _0x1c3178;};'use strict';var _=require(_0x9830('0x0'));var util=require(_0x9830('0x1'));var logger=require(_0x9830('0x2'))(_0x9830('0x3'));var moment=require(_0x9830('0x4'));var BPromise=require(_0x9830('0x5'));var rp=require(_0x9830('0x6'));var fs=require('fs');var path=require(_0x9830('0x7'));var rimraf=require(_0x9830('0x8'));var config=require(_0x9830('0x9'));var attributes=require('./chatTransferReport.attributes');module['exports']=function(_0x5dd9c6,_0xd15c1a){return _0x5dd9c6['define'](_0x9830('0xa'),attributes,{'tableName':_0x9830('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x9830('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x70d3=['../../config/environment','./chatTransferReport.attributes','ChatTransferReport','report_chat_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0x70d3,0x75));var _0x370d=function(_0x51bafd,_0x3e783e){_0x51bafd=_0x51bafd-0x0;var _0x12cba0=_0x70d3[_0x51bafd];return _0x12cba0;};'use strict';var _=require(_0x370d('0x0'));var util=require(_0x370d('0x1'));var logger=require(_0x370d('0x2'))(_0x370d('0x3'));var moment=require(_0x370d('0x4'));var BPromise=require(_0x370d('0x5'));var rp=require(_0x370d('0x6'));var fs=require('fs');var path=require(_0x370d('0x7'));var rimraf=require(_0x370d('0x8'));var config=require(_0x370d('0x9'));var attributes=require(_0x370d('0xa'));module['exports']=function(_0x1e78b2,_0x58340e){return _0x1e78b2['define'](_0x370d('0xb'),attributes,{'tableName':_0x370d('0xc'),'paranoid':![],'indexes':[{'name':_0x370d('0xd'),'fields':[_0x370d('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 570efc1..0e31747 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 _0x00a1=['debug','stringify','error','code','message','result','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent'];(function(_0x4bc428,_0xf56dd9){var _0x3ca37f=function(_0x39db20){while(--_0x39db20){_0x4bc428['push'](_0x4bc428['shift']());}};_0x3ca37f(++_0xf56dd9);}(_0x00a1,0xd8));var _0x100a=function(_0x48fa5d,_0x1ea61a){_0x48fa5d=_0x48fa5d-0x0;var _0x43af16=_0x00a1[_0x48fa5d];return _0x43af16;};'use strict';var _=require(_0x100a('0x0'));var util=require(_0x100a('0x1'));var moment=require(_0x100a('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x100a('0x3'));var db=require(_0x100a('0x4'))['db'];var utils=require(_0x100a('0x5'));var logger=require(_0x100a('0x6'))(_0x100a('0x7'));var config=require('../../config/environment');var jayson=require(_0x100a('0x8'));var client=jayson['client'][_0x100a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5f0412,_0xa3331f,_0x519c1a){return new BPromise(function(_0x5cd14d,_0x26be88){return client[_0x100a('0xa')](_0x5f0412,_0x519c1a)[_0x100a('0xb')](function(_0x5b47cb){logger[_0x100a('0xc')](_0x100a('0xd'),_0xa3331f,_0x100a('0xe'));logger[_0x100a('0xf')]('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0xa3331f,'request\x20sent',JSON[_0x100a('0x10')](_0x5b47cb));if(_0x5b47cb[_0x100a('0x11')]){if(_0x5b47cb[_0x100a('0x11')][_0x100a('0x12')]===0x1f4){logger[_0x100a('0x11')]('ChatTransferReport,\x20%s,\x20%s',_0xa3331f,_0x5b47cb[_0x100a('0x11')][_0x100a('0x13')]);return _0x26be88(_0x5b47cb['error']['message']);}logger[_0x100a('0x11')](_0x100a('0xd'),_0xa3331f,_0x5b47cb[_0x100a('0x11')][_0x100a('0x13')]);return _0x5cd14d(_0x5b47cb[_0x100a('0x11')]['message']);}else{logger[_0x100a('0xc')](_0x100a('0xd'),_0xa3331f,_0x100a('0xe'));_0x5cd14d(_0x5b47cb[_0x100a('0x14')][_0x100a('0x13')]);}})['catch'](function(_0x155780){logger['error'](_0x100a('0xd'),_0xa3331f,_0x155780);_0x26be88(_0x155780);});});} \ No newline at end of file +var _0xbefd=['jayson/promise','request','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','moment','ioredis','../../mysqldb','../../config/logger','../../config/environment'];(function(_0x5da63e,_0x4d3503){var _0x442aca=function(_0x6d5bca){while(--_0x6d5bca){_0x5da63e['push'](_0x5da63e['shift']());}};_0x442aca(++_0x4d3503);}(_0xbefd,0x1a3));var _0xdbef=function(_0x2ba8b4,_0x46bfcc){_0x2ba8b4=_0x2ba8b4-0x0;var _0x41d675=_0xbefd[_0x2ba8b4];return _0x41d675;};'use strict';var _=require(_0xdbef('0x0'));var util=require('util');var moment=require(_0xdbef('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdbef('0x2'));var db=require(_0xdbef('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xdbef('0x4'))('rpc');var config=require(_0xdbef('0x5'));var jayson=require(_0xdbef('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xc1d1c0,_0x4a22b2,_0x459a3c){return new BPromise(function(_0x50fd4f,_0x2a57a1){return client[_0xdbef('0x7')](_0xc1d1c0,_0x459a3c)['then'](function(_0x44d9aa){logger[_0xdbef('0x8')](_0xdbef('0x9'),_0x4a22b2,_0xdbef('0xa'));logger[_0xdbef('0xb')]('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x4a22b2,_0xdbef('0xa'),JSON[_0xdbef('0xc')](_0x44d9aa));if(_0x44d9aa[_0xdbef('0xd')]){if(_0x44d9aa['error'][_0xdbef('0xe')]===0x1f4){logger[_0xdbef('0xd')](_0xdbef('0x9'),_0x4a22b2,_0x44d9aa[_0xdbef('0xd')][_0xdbef('0xf')]);return _0x2a57a1(_0x44d9aa[_0xdbef('0xd')][_0xdbef('0xf')]);}logger[_0xdbef('0xd')](_0xdbef('0x9'),_0x4a22b2,_0x44d9aa[_0xdbef('0xd')]['message']);return _0x50fd4f(_0x44d9aa[_0xdbef('0xd')][_0xdbef('0xf')]);}else{logger['info'](_0xdbef('0x9'),_0x4a22b2,'request\x20sent');_0x50fd4f(_0x44d9aa[_0xdbef('0x10')][_0xdbef('0xf')]);}})['catch'](function(_0x5af497){logger['error'](_0xdbef('0x9'),_0x4a22b2,_0x5af497);_0x2a57a1(_0x5af497);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 96aa931..b34e627 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 _0xef40=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatTransferReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','put','update','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0x39106e,_0x586f3d){var _0x892aec=function(_0xded1b5){while(--_0xded1b5){_0x39106e['push'](_0x39106e['shift']());}};_0x892aec(++_0x586f3d);}(_0xef40,0x65));var _0x0ef4=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xef40[_0x501510];return _0x1e6ee5;};'use strict';var multer=require(_0x0ef4('0x0'));var util=require('util');var path=require(_0x0ef4('0x1'));var timeout=require(_0x0ef4('0x2'));var express=require(_0x0ef4('0x3'));var router=express[_0x0ef4('0x4')]();var fs_extra=require(_0x0ef4('0x5'));var auth=require(_0x0ef4('0x6'));var interaction=require(_0x0ef4('0x7'));var config=require('../../config/environment');var controller=require(_0x0ef4('0x8'));router['get']('/',auth[_0x0ef4('0x9')](),controller[_0x0ef4('0xa')]);router[_0x0ef4('0xb')](_0x0ef4('0xc'),auth[_0x0ef4('0x9')](),controller[_0x0ef4('0xd')]);router[_0x0ef4('0xb')](_0x0ef4('0xe'),auth[_0x0ef4('0x9')](),controller[_0x0ef4('0xf')]);router['post']('/',auth[_0x0ef4('0x9')](),controller['create']);router[_0x0ef4('0x10')](_0x0ef4('0xe'),auth[_0x0ef4('0x9')](),controller[_0x0ef4('0x11')]);router[_0x0ef4('0x12')](_0x0ef4('0xe'),auth[_0x0ef4('0x9')](),controller[_0x0ef4('0x13')]);module[_0x0ef4('0x14')]=router; \ No newline at end of file +var _0xd227=['/:id','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','index','get','/describe','isAuthenticated','describe','show','create','put'];(function(_0x17cd5c,_0x48bc4c){var _0x92496a=function(_0x31ec4e){while(--_0x31ec4e){_0x17cd5c['push'](_0x17cd5c['shift']());}};_0x92496a(++_0x48bc4c);}(_0xd227,0xf4));var _0x7d22=function(_0x2dfd0e,_0x13739e){_0x2dfd0e=_0x2dfd0e-0x0;var _0x343af6=_0xd227[_0x2dfd0e];return _0x343af6;};'use strict';var multer=require('multer');var util=require(_0x7d22('0x0'));var path=require(_0x7d22('0x1'));var timeout=require(_0x7d22('0x2'));var express=require('express');var router=express[_0x7d22('0x3')]();var fs_extra=require(_0x7d22('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x7d22('0x5'));var config=require(_0x7d22('0x6'));var controller=require(_0x7d22('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x7d22('0x8')]);router[_0x7d22('0x9')](_0x7d22('0xa'),auth[_0x7d22('0xb')](),controller[_0x7d22('0xc')]);router['get']('/:id',auth[_0x7d22('0xb')](),controller[_0x7d22('0xd')]);router['post']('/',auth[_0x7d22('0xb')](),controller[_0x7d22('0xe')]);router[_0x7d22('0xf')](_0x7d22('0x10'),auth[_0x7d22('0xb')](),controller['update']);router[_0x7d22('0x11')](_0x7d22('0x10'),auth[_0x7d22('0xb')](),controller[_0x7d22('0x12')]);module[_0x7d22('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 213c0fb..93c762c 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 _0x73dd=['Contact\x20us','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','star','thumb','stringify','input','name','getDataValue','onlineForm','parse','setDataValue','textarea','Comments','Leave\x20your\x20comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','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','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','exports','STRING','address','email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','squared','Chat','Send'];(function(_0x57baf,_0x1dff25){var _0x3c9a14=function(_0x14c79f){while(--_0x14c79f){_0x57baf['push'](_0x57baf['shift']());}};_0x3c9a14(++_0x1dff25);}(_0x73dd,0x198));var _0xd73d=function(_0x4d4c54,_0x2a3d43){_0x4d4c54=_0x4d4c54-0x0;var _0x2b6d8c=_0x73dd[_0x4d4c54];return _0x2b6d8c;};'use strict';var Sequelize=require(_0xd73d('0x0'));var rs=require(_0xd73d('0x1'));module[_0xd73d('0x2')]={'name':{'type':Sequelize[_0xd73d('0x3')],'allowNull':![]},'address':{'type':Sequelize[_0xd73d('0x3')],'allowNull':![],'unique':_0xd73d('0x4')},'description':{'type':Sequelize[_0xd73d('0x3')]},'mapKey':{'type':Sequelize[_0xd73d('0x3')],'defaultValue':'email'},'mapKeyOffline':{'type':Sequelize[_0xd73d('0x3')],'defaultValue':_0xd73d('0x5')},'key':{'type':Sequelize[_0xd73d('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0xd73d('0x6')},'customerAlias':{'type':Sequelize['STRING'],'defaultValue':'Me'},'color':{'type':Sequelize[_0xd73d('0x3')],'allowNull':![],'defaultValue':_0xd73d('0x7'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xd73d('0x3')],'allowNull':![],'defaultValue':_0xd73d('0x7'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xd73d('0x3')],'allowNull':![],'defaultValue':_0xd73d('0x8'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0xd73d('0x3')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xd73d('0x9')],'defaultValue':0xf},'remote':{'type':Sequelize[_0xd73d('0x3')]},'animation':{'type':Sequelize[_0xd73d('0xa')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xd73d('0xb')](_0xd73d('0xc'),_0xd73d('0xd')),'defaultValue':_0xd73d('0xc')},'header_online':{'type':Sequelize[_0xd73d('0x3')],'defaultValue':'We\x20are\x20here!'},'start_chat_button':{'type':Sequelize[_0xd73d('0x3')],'defaultValue':_0xd73d('0xe')},'offline_chat_button':{'type':Sequelize[_0xd73d('0x3')],'defaultValue':_0xd73d('0xf')},'header_offline':{'type':Sequelize['STRING'],'defaultValue':_0xd73d('0x10')},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xd73d('0x3')],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize[_0xd73d('0xa')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xd73d('0x11')]},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':_0xd73d('0x12')},'formSubmitSuccessMessage':{'type':Sequelize[_0xd73d('0x3')],'defaultValue':_0xd73d('0x13')},'formSubmitFailureMessage':{'type':Sequelize[_0xd73d('0x3')],'defaultValue':_0xd73d('0x14')},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':_0xd73d('0x15')},'placeholderMessage':{'type':Sequelize[_0xd73d('0x3')],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':_0xd73d('0x16')},'closingMessageButton':{'type':Sequelize[_0xd73d('0x3')],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0xd73d('0x17')},'conditionAgreement':{'type':Sequelize[_0xd73d('0xa')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xd73d('0xa')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xd73d('0xa')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xd73d('0xa')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xd73d('0x3')],'defaultValue':_0xd73d('0x18')},'ratingType':{'type':Sequelize[_0xd73d('0xb')](_0xd73d('0x19'),_0xd73d('0x1a')),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize[_0xd73d('0x9')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xd73d('0x11')],'defaultValue':function(){return JSON[_0xd73d('0x1b')]({'items':[{'type':_0xd73d('0x1c'),'variable':null,'config':{'placeholder':_0xd73d('0x1d'),'type':'text','required':!![]},'props':{'title':'name','helpText':''}},{'type':'input','props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0xd73d('0x5'),'type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xd73d('0x1e')](_0xd73d('0x1f'))?JSON[_0xd73d('0x20')](this[_0xd73d('0x1e')]('onlineForm')):{};},'set':function(_0x2dc286){return this[_0xd73d('0x21')](_0xd73d('0x1f'),JSON[_0xd73d('0x1b')](_0x2dc286));}},'offlineForm':{'type':Sequelize[_0xd73d('0x11')],'defaultValue':function(){return JSON[_0xd73d('0x1b')]({'items':[{'type':_0xd73d('0x1c'),'props':{'title':_0xd73d('0x5'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':'email'},'variable':null},{'type':_0xd73d('0x22'),'config':{'placeholder':_0xd73d('0x23')},'props':{'title':_0xd73d('0x23'),'helpText':_0xd73d('0x24')}}],'fromKey':0x0});},'get':function(){return this[_0xd73d('0x1e')]('offlineForm')?JSON[_0xd73d('0x20')](this[_0xd73d('0x1e')](_0xd73d('0x25'))):{};},'set':function(_0x22a25e){return this['setDataValue'](_0xd73d('0x25'),JSON[_0xd73d('0x1b')](_0x22a25e));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xd73d('0x26')]();}},'autoclose':{'type':Sequelize[_0xd73d('0xa')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xd73d('0xa')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xd73d('0xa')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xd73d('0x3')]},'forwardOffline':{'type':Sequelize[_0xd73d('0xa')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize[_0xd73d('0x3')],'defaultValue':_0xd73d('0x27')},'waitingMessage':{'type':Sequelize[_0xd73d('0x3')],'defaultValue':_0xd73d('0x28')},'offlineMessageSubject':{'type':Sequelize[_0xd73d('0x3')],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize[_0xd73d('0x3')],'defaultValue':_0xd73d('0x29')},'enableUnmanagedNote':{'type':Sequelize[_0xd73d('0xa')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xd73d('0x3')],'defaultValue':_0xd73d('0x2a')},'skipUnmanaged':{'type':Sequelize[_0xd73d('0x3')],'defaultValue':_0xd73d('0x17')},'sendUnmanaged':{'type':Sequelize[_0xd73d('0x3')],'defaultValue':_0xd73d('0xf')},'enableCustomerAttachment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xd73d('0x11')]},'showAgentAvatar':{'type':Sequelize[_0xd73d('0xa')],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xd73d('0x11')],'defaultValue':function(){return _0xd73d('0x2b');}},'notificationSound':{'type':Sequelize[_0xd73d('0xa')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xd73d('0xa')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xd73d('0xa')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xd73d('0x3')],'defaultValue':_0xd73d('0x2c')},'verticalAlignment':{'type':Sequelize[_0xd73d('0x9')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0xd73d('0x3')],'defaultValue':_0xd73d('0x2d')},'messagesAlignment':{'type':Sequelize[_0xd73d('0x3')],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize[_0xd73d('0x3')]},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize[_0xd73d('0xa')],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xd73d('0x3')],'allowNull':![],'defaultValue':_0xd73d('0x2e'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xd73d('0xa')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xd73d('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xd73d('0x3')],'defaultValue':_0xd73d('0x2f')},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize[_0xd73d('0x9')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xd73d('0xa')],'defaultValue':![],'comment':_0xd73d('0x30'),'set':function(_0x2ea125){if(!_0x2ea125)this[_0xd73d('0x21')](_0xd73d('0x31'),null);this[_0xd73d('0x21')](_0xd73d('0x32'),_0x2ea125);}},'vidaooEscalation':{'type':Sequelize[_0xd73d('0xa')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xd73d('0x3')]},'vidaooTopic':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xd73d('0x33')},'vidaooNote':{'type':Sequelize['STRING'],'defaultValue':function(){return _0xd73d('0x34');}},'vidaooMetadata':{'type':Sequelize[_0xd73d('0x11')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0xd73d('0xa')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x90d3=['mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','randomstring','exports','STRING','address','email','#011F6A','#ffffff','BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!','Chat','Send','Contact\x20us','INTEGER','Powered\x20by\x20xCALLY','TEXT','Form\x20properly\x20submitted','Form\x20submission\x20error','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','star','stringify','input','name','text','onlineForm','parse','setDataValue','Comments','Leave\x20your\x20comments','getDataValue','offlineForm','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','New\x20offline\x20message\x20from\x20websiteName','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','bottom_right','CHAT','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x3e9895,_0x246574){var _0x8ec2c8=function(_0x2d8e1b){while(--_0x2d8e1b){_0x3e9895['push'](_0x3e9895['shift']());}};_0x8ec2c8(++_0x246574);}(_0x90d3,0x68));var _0x390d=function(_0x21353c,_0x2ea587){_0x21353c=_0x21353c-0x0;var _0xa99120=_0x90d3[_0x21353c];return _0xa99120;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x390d('0x0'));module[_0x390d('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize[_0x390d('0x2')],'allowNull':![],'unique':_0x390d('0x3')},'description':{'type':Sequelize[_0x390d('0x2')]},'mapKey':{'type':Sequelize[_0x390d('0x2')],'defaultValue':_0x390d('0x4')},'mapKeyOffline':{'type':Sequelize[_0x390d('0x2')],'defaultValue':_0x390d('0x4')},'key':{'type':Sequelize[_0x390d('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x390d('0x2')],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize[_0x390d('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x390d('0x2')],'allowNull':![],'defaultValue':_0x390d('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x390d('0x2')],'allowNull':![],'defaultValue':_0x390d('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x390d('0x2')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x390d('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize[_0x390d('0x2')]},'animation':{'type':Sequelize[_0x390d('0x7')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x390d('0x8')](_0x390d('0x9'),_0x390d('0xa')),'defaultValue':_0x390d('0x9')},'header_online':{'type':Sequelize['STRING'],'defaultValue':_0x390d('0xb')},'start_chat_button':{'type':Sequelize[_0x390d('0x2')],'defaultValue':_0x390d('0xc')},'offline_chat_button':{'type':Sequelize[_0x390d('0x2')],'defaultValue':_0x390d('0xd')},'header_offline':{'type':Sequelize[_0x390d('0x2')],'defaultValue':_0x390d('0xe')},'download_transcript':{'type':Sequelize[_0x390d('0x7')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x390d('0xf')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':_0x390d('0x10')},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x390d('0x11')]},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize[_0x390d('0x2')],'defaultValue':_0x390d('0x12')},'formSubmitFailureMessage':{'type':Sequelize['STRING'],'defaultValue':_0x390d('0x13')},'noteTitle':{'type':Sequelize[_0x390d('0x2')],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize[_0x390d('0x2')],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize[_0x390d('0x2')],'defaultValue':_0x390d('0x14')},'closingMessageButton':{'type':Sequelize[_0x390d('0x2')],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize[_0x390d('0x2')],'defaultValue':_0x390d('0x15')},'conditionAgreement':{'type':Sequelize[_0x390d('0x7')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x390d('0x7')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x390d('0x7')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x390d('0x7')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x390d('0x2')],'defaultValue':_0x390d('0x16')},'ratingType':{'type':Sequelize['ENUM'](_0x390d('0x17'),'thumb'),'defaultValue':_0x390d('0x17')},'ratingStarsNumber':{'type':Sequelize[_0x390d('0xf')],'defaultValue':0x5},'onlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x390d('0x18')]({'items':[{'type':_0x390d('0x19'),'variable':null,'config':{'placeholder':_0x390d('0x1a'),'type':_0x390d('0x1b'),'required':!![]},'props':{'title':_0x390d('0x1a'),'helpText':''}},{'type':_0x390d('0x19'),'props':{'title':_0x390d('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x390d('0x4'),'type':_0x390d('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue'](_0x390d('0x1c'))?JSON[_0x390d('0x1d')](this['getDataValue']('onlineForm')):{};},'set':function(_0x152d37){return this[_0x390d('0x1e')]('onlineForm',JSON[_0x390d('0x18')](_0x152d37));}},'offlineForm':{'type':Sequelize[_0x390d('0x11')],'defaultValue':function(){return JSON[_0x390d('0x18')]({'items':[{'type':'input','props':{'title':_0x390d('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x390d('0x4'),'type':_0x390d('0x4')},'variable':null},{'type':'textarea','config':{'placeholder':_0x390d('0x1f')},'props':{'title':_0x390d('0x1f'),'helpText':_0x390d('0x20')}}],'fromKey':0x0});},'get':function(){return this[_0x390d('0x21')](_0x390d('0x22'))?JSON[_0x390d('0x1d')](this['getDataValue'](_0x390d('0x22'))):{};},'set':function(_0x1d32c7){return this['setDataValue']('offlineForm',JSON[_0x390d('0x18')](_0x1d32c7));}},'token':{'type':Sequelize[_0x390d('0x2')],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize[_0x390d('0x7')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x390d('0x7')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x390d('0x7')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize['STRING']},'forwardOffline':{'type':Sequelize[_0x390d('0x7')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x390d('0x2')]},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':_0x390d('0x23')},'waitingMessage':{'type':Sequelize[_0x390d('0x2')],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize[_0x390d('0x2')],'defaultValue':_0x390d('0x24')},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize[_0x390d('0x7')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':_0x390d('0x25')},'skipUnmanaged':{'type':Sequelize[_0x390d('0x2')],'defaultValue':'Skip'},'sendUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x390d('0xd')},'enableCustomerAttachment':{'type':Sequelize[_0x390d('0x7')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x390d('0x7')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x390d('0x11')]},'showAgentAvatar':{'type':Sequelize[_0x390d('0x7')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x390d('0x2')]},'notificationTemplate':{'type':Sequelize[_0x390d('0x11')],'defaultValue':function(){return _0x390d('0x26');}},'notificationSound':{'type':Sequelize[_0x390d('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x390d('0x7')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x390d('0x7')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x390d('0x2')],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x390d('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x390d('0x2')],'defaultValue':_0x390d('0x27')},'verticalAlignment':{'type':Sequelize[_0x390d('0xf')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x390d('0x2')],'defaultValue':_0x390d('0x28')},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0x390d('0x29')},'defaultTitle':{'type':Sequelize[_0x390d('0x2')]},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize[_0x390d('0x7')],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x390d('0x2')],'allowNull':![],'defaultValue':_0x390d('0x2a'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x390d('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x390d('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x390d('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x390d('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x390d('0x2')],'defaultValue':_0x390d('0x2b')},'systemAvatar':{'type':Sequelize[_0x390d('0x11')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x390d('0xf')],'comment':_0x390d('0x2c')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x390d('0x2d'),'set':function(_0xdea78a){if(!_0xdea78a)this[_0x390d('0x1e')](_0x390d('0x2e'),null);this[_0x390d('0x1e')](_0x390d('0x2f'),_0xdea78a);}},'vidaooEscalation':{'type':Sequelize[_0x390d('0x7')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x390d('0x2')]},'vidaooTopic':{'type':Sequelize[_0x390d('0x2')],'allowNull':![],'defaultValue':_0x390d('0x30')},'vidaooNote':{'type':Sequelize['STRING'],'defaultValue':function(){return _0x390d('0x31');}},'vidaooMetadata':{'type':Sequelize[_0x390d('0x11')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x390d('0x7')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x390d('0x11')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 42f24e4..6c6c7cc 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 _0xa69a=['files','CompanyId','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','readFileSync','utf8','toPairs','offlineMessageBody','ChatOfflineMessage','fromString','mimetype','server','offline-chat','basename','openNewInteraction','sequelize','transaction','Attachment','bulkCreate','MailServerOut','CloudProvider','Smtp','forwardOffline','forwardOfflineAddress','SendMail','\x22%s\x22\x20<%s>','offlineMessageSubject','MailAccountId','email','Chat','NotifyMailAccount','remove','addInteraction','omit','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','tag','getProactiveActions','virtual','custom','License','chatLicenseExceeded','server/files/chat/iframe.ejs','address','origin','3.7.0','remote','headers','connection','remoteAddress','replace','render','alignment','verticalAlignment','textColor','textButtonColor','color_button','backgroundColor','hideWhenOffline','IntervalId','addApplications','Transaction','ISOLATION_LEVELS','findAndCountAll','finally','sendStatus','getApplications','addProactiveActions','chatProactiveAction','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','Attachments','addAgents','emit','userChatWebsite:save','isArray','getAgents','mustache','path','querystring','ioredis','url','../../components/parsers/qs','../../config/logger','../../config/environment','../../errors/api','APIOutOfIntervalError','APINotFoundError','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','client','http','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','status','json','offset','limit','undefined','count','set','Content-Range','get','UserProfileResource','destroy','end','stack','name','send','Command','getSnippet','timezone','format','iftime\x20%s,%s','interval','iftime\x20%s','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','No\x20timezone','inspect','Interval','Intervals','all','some','user-agent-parser','setUA','user-agent','getResult','customerIp','cf-connecting-ip','x-forwarded-for','first','split','firstName','lastName','x-real-port','referer','browser','version','%s\x20%s','unknown','device','model','%s\x20%s\x20%s','vendor','type','index','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','key','query','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','VIRTUAL','options','includeAll','include','findAll','keys','fields','merge','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChatWebsites','UserProfileSection','find','userProfileId','autoAssociation','update','params','addDisposition','findOne','Disposition','ChatWebsiteId','rows','removeDispositions','addAnswer','getAnswers','CannedAnswer','removeAnswers','ids','addLogo','sitepic','filename','addAvatar','agentAvatar','file','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','root','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','isNil','existsSync','join','server/files/images/logos/','download','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','chat','describe','ValidationError','no\x20available\x20attributes','createdAt','difference','updatedAt','ListId','from','Sequelize','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','CmContact','Contacts','DESC','ChatApplication','spread','account','applications','orderBy','Applications','asc','contact','threadId','externalUrl','ChatInteraction','ContactId','interaction','messageId','created','autoclose','close','unmanaged','UserId','User','agent','*,*,*,*','forcedOwnership','queueId','ChatQueue','waitForTheAssignedQueue','Start','EventManager','offline'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0xa69a,0x185));var _0xaa69=function(_0x55e0ea,_0x4baa51){_0x55e0ea=_0x55e0ea-0x0;var _0x1d666a=_0xa69a[_0x55e0ea];return _0x1d666a;};'use strict';var Mustache=require(_0xaa69('0x0'));var util=require('util');var path=require(_0xaa69('0x1'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var querystring=require(_0xaa69('0x2'));var htmlToText=require('html-to-text');var Redis=require(_0xaa69('0x3'));var jayson=require('jayson/promise');var url=require(_0xaa69('0x4'));var qs=require(_0xaa69('0x5'));var logger=require(_0xaa69('0x6'))('api');var config=require(_0xaa69('0x7'));var APIOutOfIntervalError=require(_0xaa69('0x8'))[_0xaa69('0x9')];var APINotFoundError=require('../../errors/api')[_0xaa69('0xa')];var APIHandleError=require(_0xaa69('0x8'))['handleError'];var db=require(_0xaa69('0xb'))['db'];config[_0xaa69('0xc')]=_[_0xaa69('0xd')](config[_0xaa69('0xc')],{'host':_0xaa69('0xe'),'port':0x18eb});var socket=require(_0xaa69('0xf'))(new Redis(config['redis']));require(_0xaa69('0x10'))[_0xaa69('0x11')](socket);var client=jayson[_0xaa69('0x12')]['http']({'port':0x232c});var client9002=jayson[_0xaa69('0x12')][_0xaa69('0x13')]({'port':0x232a});var client9003=jayson['client']['http']({'port':0x232b});var client9001=jayson[_0xaa69('0x12')][_0xaa69('0x13')]({'port':0x2329});function respondWithRpcPromise(_0x18c0f7,_0x3bc750,_0x5538f9,_0x5567aa){return new Promise(function(_0x4871fc,_0x176bcb){var _0x5bc097=_0x5567aa||client;return _0x5bc097['request'](_0x18c0f7,_0x5538f9)[_0xaa69('0x14')](function(_0x43eb97){logger[_0xaa69('0x15')](_0xaa69('0x16'),_0x3bc750,_0xaa69('0x17'));logger[_0xaa69('0x18')](_0xaa69('0x19'),_0x3bc750,'request\x20sent',JSON[_0xaa69('0x1a')](_0x43eb97));if(_0x43eb97[_0xaa69('0x1b')]){if(_0x43eb97[_0xaa69('0x1b')]['code']===0x1f4){logger[_0xaa69('0x1b')](_0xaa69('0x16'),_0x3bc750,_0x43eb97[_0xaa69('0x1b')][_0xaa69('0x1c')]);return _0x176bcb(_0x43eb97[_0xaa69('0x1b')][_0xaa69('0x1c')]);}logger[_0xaa69('0x1b')](_0xaa69('0x16'),_0x3bc750,_0x43eb97[_0xaa69('0x1b')][_0xaa69('0x1c')]);return _0x4871fc(_0x43eb97[_0xaa69('0x1b')]['message']);}else{logger['info'](_0xaa69('0x16'),_0x3bc750,_0xaa69('0x17'));_0x4871fc(_0x43eb97[_0xaa69('0x1d')][_0xaa69('0x1c')]);}})[_0xaa69('0x1e')](function(_0x510993){logger[_0xaa69('0x1b')](_0xaa69('0x16'),_0x3bc750,_0x510993);_0x176bcb(_0x510993);});});}function respondWithStatusCode(_0x12b2e3,_0x217d5c){_0x217d5c=_0x217d5c||0xcc;return function(_0x706260){if(_0x706260){return _0x12b2e3['sendStatus'](_0x217d5c);}return _0x12b2e3[_0xaa69('0x1f')](_0x217d5c)['end']();};}function respondWithResult(_0x561a94,_0x180b71){_0x180b71=_0x180b71||0xc8;return function(_0x2e84d3){if(_0x2e84d3){return _0x561a94[_0xaa69('0x1f')](_0x180b71)[_0xaa69('0x20')](_0x2e84d3);}};}function respondWithFilteredResult(_0x4ef83b,_0x1384ae){return function(_0x37e7a1){if(_0x37e7a1){var _0x54aa13=typeof _0x1384ae[_0xaa69('0x21')]==='undefined'&&typeof _0x1384ae[_0xaa69('0x22')]===_0xaa69('0x23');var _0x5046f5=_0x37e7a1[_0xaa69('0x24')];var _0xe6c71b=_0x54aa13?0x0:_0x1384ae[_0xaa69('0x21')];var _0x2fdccf=_0x54aa13?_0x37e7a1[_0xaa69('0x24')]:_0x1384ae[_0xaa69('0x21')]+_0x1384ae['limit'];var _0x352752;if(_0x2fdccf>=_0x5046f5){_0x2fdccf=_0x5046f5;_0x352752=0xc8;}else{_0x352752=0xce;}_0x4ef83b[_0xaa69('0x1f')](_0x352752);return _0x4ef83b[_0xaa69('0x25')](_0xaa69('0x26'),_0xe6c71b+'-'+_0x2fdccf+'/'+_0x5046f5)[_0xaa69('0x20')](_0x37e7a1);}return null;};}function saveUpdates(_0x3bebf6){return function(_0x3f11e9){if(_0x3f11e9){return _0x3f11e9['update'](_0x3bebf6)[_0xaa69('0x14')](function(_0xda746a){return _0xda746a;});}return null;};}function removeEntity(_0x2456f1){return function(_0x141bc6){if(_0x141bc6){return _0x141bc6['destroy']()['then'](function(){var _0x230a5d=_0x141bc6[_0xaa69('0x27')]({'plain':!![]});var _0x589c61='ChatWebsites';return db[_0xaa69('0x28')][_0xaa69('0x29')]({'where':{'type':_0x589c61,'resourceId':_0x230a5d['id']}})[_0xaa69('0x14')](function(){return _0x141bc6;});})['then'](function(){_0x2456f1[_0xaa69('0x1f')](0xcc)[_0xaa69('0x2a')]();});}};}function handleEntityNotFound(_0x41859e){return function(_0x5a930a){if(!_0x5a930a){_0x41859e['sendStatus'](0x194);}return _0x5a930a;};}function handleError(_0x44a37a,_0x1976e8){_0x1976e8=_0x1976e8||0x1f4;return function(_0xdb3f46){logger[_0xaa69('0x1b')](_0xdb3f46[_0xaa69('0x2b')]);if(_0xdb3f46[_0xaa69('0x2c')]){delete _0xdb3f46[_0xaa69('0x2c')];}_0x44a37a[_0xaa69('0x1f')](_0x1976e8)[_0xaa69('0x2d')](_0xdb3f46);};}function iftimePromise(_0x34b3b0,_0x42f84f){return respondWithRpcPromise(_0xaa69('0x2e'),_0xaa69('0x2f'),{'command':_0x42f84f[_0xaa69('0x30')]?util[_0xaa69('0x31')](_0xaa69('0x32'),_0x34b3b0[_0xaa69('0x33')],_0x42f84f[_0xaa69('0x30')]):util[_0xaa69('0x31')](_0xaa69('0x34'),_0x34b3b0[_0xaa69('0x33')])},client9002)[_0xaa69('0x14')](function(_0x31c9ae){var _0x67fc41=_0x31c9ae&&_0x31c9ae[_0xaa69('0x35')](_0xaa69('0x36'))>=0x0?!![]:![];logger[_0xaa69('0x15')](_0xaa69('0x37'),_0x42f84f['id'],_0x34b3b0['id'],_0x34b3b0[_0xaa69('0x33')],_0x67fc41?'ONLINE':'OFFLINE',_0x42f84f[_0xaa69('0x30')]?_0x42f84f['timezone']:_0xaa69('0x38'));return _0x67fc41;})[_0xaa69('0x1e')](function(_0x129f16){logger[_0xaa69('0x1b')](_0xaa69('0x37'),_0x42f84f['id'],_0x34b3b0['id'],_0x34b3b0[_0xaa69('0x33')],util[_0xaa69('0x39')](_0x129f16,{'showHidden':![],'depth':null}),_0x42f84f['timezone']?_0x42f84f[_0xaa69('0x30')]:_0xaa69('0x38'));return![];});}function checkWebsiteIntervals(_0x2cc7ac){var _0x44d4aa=_['map'](_0x2cc7ac[_0xaa69('0x3a')][_0xaa69('0x3b')],function(_0x3d7e1b){var _0x10fa3a=_0x3d7e1b['get']({'plain':!![]});return iftimePromise(_0x10fa3a,_0x2cc7ac);});return Promise[_0xaa69('0x3c')](_0x44d4aa)[_0xaa69('0x14')](function(_0x2495df){return _[_0xaa69('0x3d')](_0x2495df);});}function createInteractionObject(_0x43204e,_0x30095f,_0x43267b,_0x3d4234){var _0x29617c=require(_0xaa69('0x3e'));var _0x5dc1e6=new _0x29617c();var _0x1ce5c0=_0x5dc1e6[_0xaa69('0x3f')](_0x43267b[_0xaa69('0x40')])[_0xaa69('0x41')]();var _0x5c9949=_0x30095f[_0xaa69('0x42')];if(_0x43267b[_0xaa69('0x43')]){_0x5c9949=_0x43267b[_0xaa69('0x43')];}else if(_0x43267b[_0xaa69('0x44')]){_0x5c9949=_[_0xaa69('0x45')](_0x43267b[_0xaa69('0x44')][_0xaa69('0x46')](','));}return{'ContactId':_0x3d4234['id'],'ChatWebsiteId':_0x43204e,'from':(_0x3d4234[_0xaa69('0x47')]||'')+'\x20'+(_0x3d4234[_0xaa69('0x48')]||''),'customerIp':_0x5c9949,'customerPort':_0x43267b['x-real-port']?_0x43267b[_0xaa69('0x49')]:null,'referer':_0x30095f[_0xaa69('0x4a')],'browserName':_0x1ce5c0[_0xaa69('0x4b')][_0xaa69('0x2c')]&&_0x1ce5c0[_0xaa69('0x4b')][_0xaa69('0x4c')]?util[_0xaa69('0x31')](_0xaa69('0x4d'),_0x1ce5c0[_0xaa69('0x4b')][_0xaa69('0x2c')],_0x1ce5c0[_0xaa69('0x4b')]['version']):'unknown','browserVersion':_0x1ce5c0[_0xaa69('0x4b')][_0xaa69('0x4c')]||_0xaa69('0x4e'),'osName':util[_0xaa69('0x31')](_0xaa69('0x4d'),_0x1ce5c0['os'][_0xaa69('0x2c')],_0x1ce5c0['os'][_0xaa69('0x4c')]),'osVersion':_0x1ce5c0['os'][_0xaa69('0x4c')],'deviceModel':_0x1ce5c0[_0xaa69('0x4f')][_0xaa69('0x50')]&&_0x1ce5c0[_0xaa69('0x4f')]['vendor']?util[_0xaa69('0x31')](_0xaa69('0x51'),_0x1ce5c0[_0xaa69('0x4f')][_0xaa69('0x50')],_0x1ce5c0[_0xaa69('0x4f')]['vendor'],_0x1ce5c0[_0xaa69('0x4f')]['type']):null,'deviceVendor':_0x1ce5c0[_0xaa69('0x4f')][_0xaa69('0x52')],'deviceType':_0x1ce5c0[_0xaa69('0x4f')][_0xaa69('0x53')],'formData':JSON[_0xaa69('0x1a')](_0x30095f)};}exports[_0xaa69('0x54')]=function(_0x350f89,_0x5bb20f){var _0x124cbd={'include':[{'model':db[_0xaa69('0x55')],'as':_0xaa69('0x56')}]},_0x15cc25={},_0x10ff10={'count':0x0,'rows':[]};var _0x49aa92=_[_0xaa69('0x57')](db[_0xaa69('0x58')][_0xaa69('0x59')],function(_0x5eb342){return{'name':_0x5eb342['fieldName'],'type':_0x5eb342[_0xaa69('0x53')][_0xaa69('0x5a')]};});_0x15cc25[_0xaa69('0x50')]=_[_0xaa69('0x57')](_0x49aa92,_0xaa69('0x2c'));_0x15cc25[_0xaa69('0x5b')]=_['keys'](_0x350f89['query']);_0x15cc25['filters']=_['intersection'](_0x15cc25[_0xaa69('0x50')],_0x15cc25[_0xaa69('0x5b')]);_0x124cbd['attributes']=_[_0xaa69('0x5c')](_0x15cc25[_0xaa69('0x50')],qs['fields'](_0x350f89[_0xaa69('0x5b')]['fields']));_0x124cbd[_0xaa69('0x5d')]=_0x124cbd[_0xaa69('0x5d')][_0xaa69('0x5e')]?_0x124cbd[_0xaa69('0x5d')]:_0x15cc25[_0xaa69('0x50')];if(!_0x350f89[_0xaa69('0x5b')][_0xaa69('0x5f')](_0xaa69('0x60'))){_0x124cbd[_0xaa69('0x22')]=qs[_0xaa69('0x22')](_0x350f89['query'][_0xaa69('0x22')]);_0x124cbd['offset']=qs[_0xaa69('0x21')](_0x350f89[_0xaa69('0x5b')][_0xaa69('0x21')]);}_0x124cbd[_0xaa69('0x61')]=qs[_0xaa69('0x62')](_0x350f89['query']['sort']);_0x124cbd[_0xaa69('0x63')]=qs['filters'](_[_0xaa69('0x64')](_0x350f89[_0xaa69('0x5b')],_0x15cc25[_0xaa69('0x65')]),_0x49aa92);if(_0x350f89[_0xaa69('0x5b')][_0xaa69('0x66')]){_0x124cbd[_0xaa69('0x63')]=_['merge'](_0x124cbd[_0xaa69('0x63')],{'$or':_['map'](_0x49aa92,function(_0x445ba1){if(_0x445ba1['type']!==_0xaa69('0x67')){var _0x38fc5e={};_0x38fc5e[_0x445ba1[_0xaa69('0x2c')]]={'$like':'%'+_0x350f89[_0xaa69('0x5b')][_0xaa69('0x66')]+'%'};return _0x38fc5e;}})});}_0x124cbd=_['merge']({},_0x124cbd,_0x350f89[_0xaa69('0x68')]);var _0x108c67={'where':_0x124cbd[_0xaa69('0x63')]};return db[_0xaa69('0x58')]['count'](_0x108c67)[_0xaa69('0x14')](function(_0x3ec5f6){_0x10ff10[_0xaa69('0x24')]=_0x3ec5f6;if(_0x350f89[_0xaa69('0x5b')][_0xaa69('0x69')]){_0x124cbd[_0xaa69('0x6a')]=[{'all':!![]}];}return db[_0xaa69('0x58')][_0xaa69('0x6b')](_0x124cbd);})[_0xaa69('0x14')](function(_0x1514d5){_0x10ff10['rows']=_0x1514d5;return _0x10ff10;})['then'](respondWithFilteredResult(_0x5bb20f,_0x124cbd))['catch'](handleError(_0x5bb20f,null));};exports['show']=function(_0x58cdf7,_0x156440){var _0x307bb7={'raw':![],'where':{'id':_0x58cdf7['params']['id']},'include':[{'model':db[_0xaa69('0x55')],'as':'mandatoryDispositionPause'}]},_0x1f1e78={};_0x1f1e78[_0xaa69('0x50')]=_[_0xaa69('0x6c')](db['ChatWebsite'][_0xaa69('0x59')]);_0x1f1e78[_0xaa69('0x5b')]=_[_0xaa69('0x6c')](_0x58cdf7['query']);_0x1f1e78[_0xaa69('0x65')]=_[_0xaa69('0x5c')](_0x1f1e78[_0xaa69('0x50')],_0x1f1e78[_0xaa69('0x5b')]);_0x307bb7[_0xaa69('0x5d')]=_[_0xaa69('0x5c')](_0x1f1e78[_0xaa69('0x50')],qs[_0xaa69('0x6d')](_0x58cdf7[_0xaa69('0x5b')][_0xaa69('0x6d')]));_0x307bb7[_0xaa69('0x5d')]=_0x307bb7['attributes']['length']?_0x307bb7[_0xaa69('0x5d')]:_0x1f1e78[_0xaa69('0x50')];if(_0x58cdf7['query'][_0xaa69('0x69')]){_0x307bb7[_0xaa69('0x6a')]=[{'all':!![]}];}_0x307bb7=_[_0xaa69('0x6e')]({},_0x307bb7,_0x58cdf7[_0xaa69('0x68')]);return db['ChatWebsite']['find'](_0x307bb7)['then'](handleEntityNotFound(_0x156440,null))['then'](respondWithResult(_0x156440,null))[_0xaa69('0x1e')](handleError(_0x156440,null));};exports[_0xaa69('0x6f')]=function(_0x1e0671,_0x293754){return db['ChatWebsite'][_0xaa69('0x6f')](_0x1e0671[_0xaa69('0x70')],{})[_0xaa69('0x14')](function(_0x43793a){var _0x4fa339=_0x1e0671[_0xaa69('0x71')]['get']({'plain':!![]});if(!_0x4fa339)throw new Error(_0xaa69('0x72'));if(_0x4fa339[_0xaa69('0x73')]===_0xaa69('0x71')){var _0x2f9523=_0x43793a[_0xaa69('0x27')]({'plain':!![]});var _0x1fcc4b=_0xaa69('0x74');return db[_0xaa69('0x75')][_0xaa69('0x76')]({'where':{'name':_0x1fcc4b,'userProfileId':_0x4fa339[_0xaa69('0x77')]},'raw':!![]})[_0xaa69('0x14')](function(_0x3f7494){if(_0x3f7494&&_0x3f7494[_0xaa69('0x78')]===0x0){return db[_0xaa69('0x28')][_0xaa69('0x6f')]({'name':_0x2f9523[_0xaa69('0x2c')],'resourceId':_0x2f9523['id'],'type':_0x3f7494[_0xaa69('0x2c')],'sectionId':_0x3f7494['id']},{})[_0xaa69('0x14')](function(){return _0x43793a;});}else{return _0x43793a;}})[_0xaa69('0x1e')](function(_0x3ac8f9){logger[_0xaa69('0x1b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3ac8f9);throw _0x3ac8f9;});}return _0x43793a;})[_0xaa69('0x14')](respondWithResult(_0x293754,0xc9))[_0xaa69('0x1e')](handleError(_0x293754,null));};exports[_0xaa69('0x79')]=function(_0x5bcdd7,_0x4ad084){if(_0x5bcdd7[_0xaa69('0x70')]['id']){delete _0x5bcdd7[_0xaa69('0x70')]['id'];}return db[_0xaa69('0x58')][_0xaa69('0x76')]({'where':{'id':_0x5bcdd7[_0xaa69('0x7a')]['id']},'include':[{'model':db[_0xaa69('0x55')],'as':_0xaa69('0x56')}]})[_0xaa69('0x14')](handleEntityNotFound(_0x4ad084,null))['then'](saveUpdates(_0x5bcdd7[_0xaa69('0x70')],null))[_0xaa69('0x14')](respondWithResult(_0x4ad084,null))[_0xaa69('0x1e')](handleError(_0x4ad084,null));};exports[_0xaa69('0x29')]=function(_0x25f803,_0x16d9e1){return db[_0xaa69('0x58')][_0xaa69('0x76')]({'where':{'id':_0x25f803[_0xaa69('0x7a')]['id']}})[_0xaa69('0x14')](handleEntityNotFound(_0x16d9e1,null))[_0xaa69('0x14')](removeEntity(_0x16d9e1,null))[_0xaa69('0x1e')](handleError(_0x16d9e1,null));};exports['describe']=function(_0x405882,_0x31a25a){return db[_0xaa69('0x58')]['describe']()['then'](respondWithResult(_0x31a25a,null))[_0xaa69('0x1e')](handleError(_0x31a25a,null));};exports[_0xaa69('0x7b')]=function(_0xcc2a88,_0x180df3){if(_0xcc2a88['body']['id']){delete _0xcc2a88[_0xaa69('0x70')]['id'];}return db[_0xaa69('0x58')][_0xaa69('0x76')]({'where':{'id':_0xcc2a88[_0xaa69('0x7a')]['id']}})[_0xaa69('0x14')](handleEntityNotFound(_0x180df3,null))['then'](function(_0x4bac6e){if(_0x4bac6e){_0xcc2a88[_0xaa69('0x70')]['ChatWebsiteId']=_0x4bac6e['id'];return db['Disposition'][_0xaa69('0x6f')](_0xcc2a88[_0xaa69('0x70')]);}})[_0xaa69('0x14')](respondWithResult(_0x180df3,null))[_0xaa69('0x1e')](handleError(_0x180df3,null));};exports['getDispositions']=function(_0x69a95c,_0x1fdd90){var _0x4febd4={'raw':![],'where':{}};var _0x5f01c7={};var _0x1827e9={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xaa69('0x7c')]({'where':{'id':_0x69a95c[_0xaa69('0x7a')]['id']}})[_0xaa69('0x14')](handleEntityNotFound(_0x1fdd90,null))[_0xaa69('0x14')](function(_0x22cf1a){if(_0x22cf1a){_0x5f01c7[_0xaa69('0x50')]=_[_0xaa69('0x6c')](db[_0xaa69('0x7d')][_0xaa69('0x59')]);_0x5f01c7[_0xaa69('0x5b')]=_['keys'](_0x69a95c[_0xaa69('0x5b')]);_0x5f01c7[_0xaa69('0x65')]=_[_0xaa69('0x5c')](_0x5f01c7['model'],_0x5f01c7[_0xaa69('0x5b')]);_0x4febd4[_0xaa69('0x5d')]=_['intersection'](_0x5f01c7[_0xaa69('0x50')],qs['fields'](_0x69a95c[_0xaa69('0x5b')]['fields']));_0x4febd4[_0xaa69('0x5d')]=_0x4febd4[_0xaa69('0x5d')][_0xaa69('0x5e')]?_0x4febd4[_0xaa69('0x5d')]:_0x5f01c7[_0xaa69('0x50')];if(!_0x69a95c[_0xaa69('0x5b')]['hasOwnProperty'](_0xaa69('0x60'))){_0x4febd4[_0xaa69('0x22')]=qs[_0xaa69('0x22')](_0x69a95c['query'][_0xaa69('0x22')]);_0x4febd4[_0xaa69('0x21')]=qs[_0xaa69('0x21')](_0x69a95c[_0xaa69('0x5b')]['offset']);}_0x4febd4[_0xaa69('0x61')]=qs[_0xaa69('0x62')](_0x69a95c['query'][_0xaa69('0x62')]);_0x4febd4[_0xaa69('0x63')]=qs[_0xaa69('0x65')](_[_0xaa69('0x64')](_0x69a95c[_0xaa69('0x5b')],_0x5f01c7[_0xaa69('0x65')]));_0x4febd4['where'][_0xaa69('0x7e')]=_0x22cf1a['id'];if(_0x69a95c[_0xaa69('0x5b')][_0xaa69('0x66')]){_0x4febd4[_0xaa69('0x63')]=_[_0xaa69('0x6e')](_0x4febd4[_0xaa69('0x63')],{'$or':_[_0xaa69('0x57')](_0x4febd4[_0xaa69('0x5d')],function(_0x33e5fc){var _0x3b686e={};_0x3b686e[_0x33e5fc]={'$like':'%'+_0x69a95c['query']['filter']+'%'};return _0x3b686e;})});}_0x4febd4=_['merge']({},_0x4febd4,_0x69a95c[_0xaa69('0x68')]);return db['Disposition'][_0xaa69('0x24')]({'where':_0x4febd4['where']})[_0xaa69('0x14')](function(_0x2f4db3){_0x1827e9[_0xaa69('0x24')]=_0x2f4db3;if(_0x69a95c[_0xaa69('0x5b')]['includeAll']){_0x4febd4['include']=[{'all':!![]}];}return db['Disposition'][_0xaa69('0x6b')](_0x4febd4);})[_0xaa69('0x14')](function(_0x41c936){_0x1827e9[_0xaa69('0x7f')]=_0x41c936;return _0x1827e9;});}})[_0xaa69('0x14')](respondWithFilteredResult(_0x1fdd90,_0x4febd4))[_0xaa69('0x1e')](handleError(_0x1fdd90,null));};exports['removeDispositions']=function(_0x1d0bc7,_0x5669f1){return db[_0xaa69('0x58')]['find']({'where':{'id':_0x1d0bc7['params']['id']}})['then'](handleEntityNotFound(_0x5669f1,null))[_0xaa69('0x14')](function(_0x1f6088){if(_0x1f6088){return _0x1f6088[_0xaa69('0x80')](_0x1d0bc7[_0xaa69('0x5b')]['ids']);}})[_0xaa69('0x14')](respondWithStatusCode(_0x5669f1,null))['catch'](handleError(_0x5669f1,null));};exports[_0xaa69('0x81')]=function(_0x1d3f70,_0x528528){if(_0x1d3f70[_0xaa69('0x70')]['id']){delete _0x1d3f70['body']['id'];}return db[_0xaa69('0x58')][_0xaa69('0x76')]({'where':{'id':_0x1d3f70['params']['id']}})['then'](handleEntityNotFound(_0x528528,null))[_0xaa69('0x14')](function(_0x40bf11){if(_0x40bf11){_0x1d3f70['body'][_0xaa69('0x7e')]=_0x40bf11['id'];return db['CannedAnswer']['create'](_0x1d3f70[_0xaa69('0x70')]);}})[_0xaa69('0x14')](respondWithResult(_0x528528,null))['catch'](handleError(_0x528528,null));};exports[_0xaa69('0x82')]=function(_0x2c0676,_0x2bac90){var _0x52b852={'raw':![],'where':{}};var _0x197e38={};var _0x2d95c7={'count':0x0,'rows':[]};return db[_0xaa69('0x58')]['findOne']({'where':{'id':_0x2c0676[_0xaa69('0x7a')]['id']}})[_0xaa69('0x14')](handleEntityNotFound(_0x2bac90,null))['then'](function(_0x34b780){if(_0x34b780){_0x197e38[_0xaa69('0x50')]=_[_0xaa69('0x6c')](db[_0xaa69('0x83')][_0xaa69('0x59')]);_0x197e38[_0xaa69('0x5b')]=_['keys'](_0x2c0676[_0xaa69('0x5b')]);_0x197e38[_0xaa69('0x65')]=_[_0xaa69('0x5c')](_0x197e38[_0xaa69('0x50')],_0x197e38[_0xaa69('0x5b')]);_0x52b852['attributes']=_[_0xaa69('0x5c')](_0x197e38[_0xaa69('0x50')],qs[_0xaa69('0x6d')](_0x2c0676[_0xaa69('0x5b')][_0xaa69('0x6d')]));_0x52b852[_0xaa69('0x5d')]=_0x52b852[_0xaa69('0x5d')][_0xaa69('0x5e')]?_0x52b852['attributes']:_0x197e38[_0xaa69('0x50')];if(!_0x2c0676[_0xaa69('0x5b')][_0xaa69('0x5f')]('nolimit')){_0x52b852[_0xaa69('0x22')]=qs[_0xaa69('0x22')](_0x2c0676['query'][_0xaa69('0x22')]);_0x52b852[_0xaa69('0x21')]=qs[_0xaa69('0x21')](_0x2c0676['query'][_0xaa69('0x21')]);}_0x52b852[_0xaa69('0x61')]=qs['sort'](_0x2c0676['query'][_0xaa69('0x62')]);_0x52b852[_0xaa69('0x63')]=qs[_0xaa69('0x65')](_['pick'](_0x2c0676[_0xaa69('0x5b')],_0x197e38['filters']));_0x52b852['where']['ChatWebsiteId']=_0x34b780['id'];if(_0x2c0676[_0xaa69('0x5b')]['filter']){_0x52b852['where']=_[_0xaa69('0x6e')](_0x52b852['where'],{'$or':_[_0xaa69('0x57')](_0x52b852['attributes'],function(_0x314a39){var _0x161128={};_0x161128[_0x314a39]={'$like':'%'+_0x2c0676['query'][_0xaa69('0x66')]+'%'};return _0x161128;})});}_0x52b852=_['merge']({},_0x52b852,_0x2c0676['options']);return db[_0xaa69('0x83')]['count']({'where':_0x52b852[_0xaa69('0x63')]})[_0xaa69('0x14')](function(_0x1e251b){_0x2d95c7[_0xaa69('0x24')]=_0x1e251b;if(_0x2c0676[_0xaa69('0x5b')][_0xaa69('0x69')]){_0x52b852['include']=[{'all':!![]}];}return db[_0xaa69('0x83')][_0xaa69('0x6b')](_0x52b852);})['then'](function(_0x2ccdbb){_0x2d95c7[_0xaa69('0x7f')]=_0x2ccdbb;return _0x2d95c7;});}})['then'](respondWithFilteredResult(_0x2bac90,_0x52b852))[_0xaa69('0x1e')](handleError(_0x2bac90,null));};exports[_0xaa69('0x84')]=function(_0x221537,_0x31a4e0){return db[_0xaa69('0x58')]['find']({'where':{'id':_0x221537[_0xaa69('0x7a')]['id']}})['then'](handleEntityNotFound(_0x31a4e0,null))[_0xaa69('0x14')](function(_0x1fb686){if(_0x1fb686){return _0x1fb686['removeAnswers'](_0x221537[_0xaa69('0x5b')][_0xaa69('0x85')]);}})['then'](respondWithStatusCode(_0x31a4e0,null))['catch'](handleError(_0x31a4e0,null));};exports[_0xaa69('0x86')]=function(_0x2fe051,_0xefad4d){_0x2fe051[_0xaa69('0x70')][_0xaa69('0x87')]=_0x2fe051['file'][_0xaa69('0x88')];return db[_0xaa69('0x58')][_0xaa69('0x76')]({'where':{'id':_0x2fe051[_0xaa69('0x7a')]['id']}})[_0xaa69('0x14')](handleEntityNotFound(_0xefad4d,null))['then'](saveUpdates(_0x2fe051[_0xaa69('0x70')],null))[_0xaa69('0x14')](respondWithResult(_0xefad4d,null))[_0xaa69('0x1e')](handleError(_0xefad4d,null));};exports[_0xaa69('0x89')]=function(_0x2eb2b7,_0x3c4587){_0x2eb2b7[_0xaa69('0x70')][_0xaa69('0x8a')]=_0x2eb2b7[_0xaa69('0x8b')][_0xaa69('0x88')];return db[_0xaa69('0x58')]['find']({'where':{'id':_0x2eb2b7[_0xaa69('0x7a')]['id']}})[_0xaa69('0x14')](handleEntityNotFound(_0x3c4587,null))[_0xaa69('0x14')](saveUpdates(_0x2eb2b7[_0xaa69('0x70')],null))['then'](respondWithResult(_0x3c4587,null))['catch'](handleError(_0x3c4587,null));};exports[_0xaa69('0x8c')]=function(_0x44f36b,_0x589549){_0x44f36b['body'][_0xaa69('0x8d')]=_0x44f36b[_0xaa69('0x8b')][_0xaa69('0x88')];return db[_0xaa69('0x58')][_0xaa69('0x76')]({'where':{'id':_0x44f36b[_0xaa69('0x7a')]['id']}})[_0xaa69('0x14')](handleEntityNotFound(_0x589549,null))['then'](saveUpdates(_0x44f36b[_0xaa69('0x70')],null))[_0xaa69('0x14')](respondWithResult(_0x589549,null))[_0xaa69('0x1e')](handleError(_0x589549,null));};exports[_0xaa69('0x8e')]=function(_0x41e3d2,_0x414970){_0x41e3d2[_0xaa69('0x70')][_0xaa69('0x8f')]=_0x41e3d2[_0xaa69('0x8b')][_0xaa69('0x88')];return db['ChatWebsite']['find']({'where':{'id':_0x41e3d2[_0xaa69('0x7a')]['id']}})['then'](handleEntityNotFound(_0x414970,null))[_0xaa69('0x14')](saveUpdates(_0x41e3d2[_0xaa69('0x70')],null))[_0xaa69('0x14')](respondWithResult(_0x414970,null))[_0xaa69('0x1e')](handleError(_0x414970,null));};exports[_0xaa69('0x90')]=function(_0x84a3de,_0x33f90d){var _0x4961e5=path['join'](config[_0xaa69('0x91')],_0xaa69('0x92'));var _0x376178={'where':{'id':_0x84a3de[_0xaa69('0x7a')]['id']},'attributes':['id',_0xaa69('0x87')],'raw':!![]};var _0x30fd00=![];return require(_0xaa69('0x93'))[_0xaa69('0x94')]()[_0xaa69('0x14')](function(_0x2fd613){if(_0x2fd613){_0x30fd00=_0x2fd613['custom'];}})[_0xaa69('0x14')](function(){return db[_0xaa69('0x58')]['find'](_0x376178);})['then'](handleEntityNotFound(_0x33f90d,null))[_0xaa69('0x14')](function(_0x47dbfa){if(_0x47dbfa){if(!_[_0xaa69('0x95')](_0x47dbfa['sitepic'])){if(fs[_0xaa69('0x96')](path[_0xaa69('0x97')](config[_0xaa69('0x91')],_0xaa69('0x98'),_0x47dbfa[_0xaa69('0x87')]))&&_0x30fd00){_0x4961e5=path[_0xaa69('0x97')](config[_0xaa69('0x91')],_0xaa69('0x98'),_0x47dbfa['sitepic']);}}return _0x33f90d[_0xaa69('0x99')](_0x4961e5);}})[_0xaa69('0x1e')](handleError(_0x33f90d,null));};exports['getAvatar']=function(_0x16c1b5,_0x59fa1b){var _0x440e43=path[_0xaa69('0x97')](config[_0xaa69('0x91')],_0xaa69('0x9a'));var _0x50270d={'where':{'id':_0x16c1b5['params']['id']},'attributes':['id',_0xaa69('0x8a')],'raw':!![]};return db[_0xaa69('0x58')][_0xaa69('0x76')](_0x50270d)[_0xaa69('0x14')](handleEntityNotFound(_0x59fa1b,null))[_0xaa69('0x14')](function(_0x518434){if(_0x518434){if(!_['isNil'](_0x518434[_0xaa69('0x8a')])){if(fs['existsSync'](path[_0xaa69('0x97')](config[_0xaa69('0x91')],_0xaa69('0x9b'),_0x518434[_0xaa69('0x8a')]))){_0x440e43=path[_0xaa69('0x97')](config[_0xaa69('0x91')],_0xaa69('0x9b'),_0x518434['agentAvatar']);}}return _0x59fa1b[_0xaa69('0x99')](_0x440e43);}})['catch'](handleError(_0x59fa1b,null));};exports['getCustomerAvatar']=function(_0x51bb2d,_0xe24618){var _0x2b1ca4=path[_0xaa69('0x97')](config[_0xaa69('0x91')],_0xaa69('0x9c'));var _0x2bc7c={'where':{'id':_0x51bb2d[_0xaa69('0x7a')]['id']},'attributes':['id',_0xaa69('0x8d'),_0xaa69('0x9d')],'raw':!![]};return db[_0xaa69('0x58')][_0xaa69('0x76')](_0x2bc7c)[_0xaa69('0x14')](handleEntityNotFound(_0xe24618,null))[_0xaa69('0x14')](function(_0x308553){if(_0x308553){if(!_[_0xaa69('0x95')](_0x308553[_0xaa69('0x8d')])){if(fs[_0xaa69('0x96')](path[_0xaa69('0x97')](config[_0xaa69('0x91')],_0xaa69('0x9b'),_0x308553[_0xaa69('0x8d')]))&&_0x308553[_0xaa69('0x9d')]){_0x2b1ca4=path['join'](config[_0xaa69('0x91')],_0xaa69('0x9b'),_0x308553[_0xaa69('0x8d')]);}}return _0xe24618[_0xaa69('0x99')](_0x2b1ca4);}})[_0xaa69('0x1e')](handleError(_0xe24618,null));};exports[_0xaa69('0x9e')]=function(_0x21dc02,_0x3ce240){var _0x1e4c35=path[_0xaa69('0x97')](config['root'],'server/files/images/avatars/system_avatar.png');var _0x14e051={'where':{'id':_0x21dc02[_0xaa69('0x7a')]['id']},'attributes':['id',_0xaa69('0x8f')],'raw':!![]};return db[_0xaa69('0x58')]['find'](_0x14e051)[_0xaa69('0x14')](handleEntityNotFound(_0x3ce240,null))[_0xaa69('0x14')](function(_0x504e71){if(_0x504e71){if(!_[_0xaa69('0x95')](_0x504e71[_0xaa69('0x8f')])){if(fs[_0xaa69('0x96')](path[_0xaa69('0x97')](config[_0xaa69('0x91')],_0xaa69('0x9b'),_0x504e71['systemAvatar']))){_0x1e4c35=path['join'](config[_0xaa69('0x91')],'server/files/images/avatars/',_0x504e71[_0xaa69('0x8f')]);}}return _0x3ce240[_0xaa69('0x99')](_0x1e4c35);}})[_0xaa69('0x1e')](handleError(_0x3ce240,null));};exports['notify']=function(_0x4601b8,_0x563366){var _0x1840e1={'body':_0x4601b8[_0xaa69('0x70')],'channel':_0xaa69('0x9f')};var _0x3ccf0d=[];var _0x1852da=[];var _0x2c64c9={};var _0x6ce5eb=![];return db['CmContact'][_0xaa69('0xa0')]()[_0xaa69('0x14')](function(_0x5511d1){if(!_0x5511d1){throw new db['Sequelize'][(_0xaa69('0xa1'))](_0xaa69('0xa2'));}_0x3ccf0d=_['difference'](_['keys'](_0x5511d1),[_0xaa69('0xa3'),'updatedAt']);_0x1852da=_[_0xaa69('0xa4')](_[_0xaa69('0x6c')](_0x5511d1),[_0xaa69('0xa3'),_0xaa69('0xa5'),'CompanyId',_0xaa69('0xa6')]);if(_0x4601b8['body']['id']){delete _0x4601b8[_0xaa69('0x70')]['id'];}if(_['isNil'](_0x4601b8[_0xaa69('0x70')][_0xaa69('0xa7')])){throw new db[(_0xaa69('0xa8'))][(_0xaa69('0xa1'))]('from\x20is\x20mandatory');}if(_[_0xaa69('0x95')](_0x4601b8[_0xaa69('0x70')][_0xaa69('0x70')])||_0x4601b8[_0xaa69('0x70')]['body']===''){throw new db[(_0xaa69('0xa8'))][(_0xaa69('0xa1'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xaa69('0x95')](_0x4601b8[_0xaa69('0x70')][_0xaa69('0xa9')])){throw new db[(_0xaa69('0xa8'))]['ValidationError'](_0xaa69('0xaa')+_0x1852da);}if(!_[_0xaa69('0xab')](_0x1852da,_0x4601b8[_0xaa69('0x70')][_0xaa69('0xa9')])){throw new db['Sequelize']['ValidationError'](_0xaa69('0xac')+_0x1852da);}_0x2c64c9[_0x4601b8[_0xaa69('0x70')][_0xaa69('0xa9')]]=_0x4601b8[_0xaa69('0x70')][_0xaa69('0xa7')];})[_0xaa69('0x14')](function(){return db['ChatWebsite'][_0xaa69('0x76')]({'where':{'id':_0x4601b8[_0xaa69('0x7a')]['id']},'include':[{'model':db[_0xaa69('0xad')],'as':_0xaa69('0xae'),'include':[{'model':db[_0xaa69('0xaf')],'as':_0xaa69('0xb0'),'where':_0x2c64c9,'limit':0x1,'order':[[_0xaa69('0xa5'),_0xaa69('0xb1')]]}]},{'model':db[_0xaa69('0xb2')],'as':'Applications'},{'model':db[_0xaa69('0x3a')],'as':_0xaa69('0x3a'),'include':[{'model':db[_0xaa69('0x3a')],'as':_0xaa69('0x3b'),'attributes':['id','interval'],'raw':!![]}]}]});})[_0xaa69('0x14')](function(_0x5602ad){if(!_0x5602ad)throw new APINotFoundError(util['format']('Chat\x20Website\x20with\x20id\x20%s\x20not\x20found',_0x4601b8[_0xaa69('0x7a')]['id']));if(!_0x5602ad['Interval']||!_0x5602ad['Interval'][_0xaa69('0x3b')])return[_0x5602ad,!![]];return[_0x5602ad,checkWebsiteIntervals(_0x5602ad)];})[_0xaa69('0xb3')](function(_0x181cde,_0x28aaf4){if(!_0x28aaf4)throw new APIOutOfIntervalError();if(!_0x181cde[_0xaa69('0xae')])return;_0x1840e1[_0xaa69('0xb4')]=_0x181cde;_0x1840e1['list']=_0x181cde[_0xaa69('0xae')];_0x1840e1[_0xaa69('0xb5')]=_[_0xaa69('0xb6')](_0x181cde[_0xaa69('0xb7')],['priority'],[_0xaa69('0xb8')]);if(_0x1840e1[_0xaa69('0xb4')][_0xaa69('0xb7')]){delete _0x1840e1['account'][_0xaa69('0xb7')];}if(_0x1840e1[_0xaa69('0xb4')][_0xaa69('0xae')]&&_0x1840e1[_0xaa69('0xb4')]['List'][_0xaa69('0xb0')][_0xaa69('0x5e')]){return _0x1840e1[_0xaa69('0xb4')]['List']['Contacts'][0x0];}var _0x51f10d=_[_0xaa69('0xd')](_0x4601b8[_0xaa69('0x70')],{'firstName':_0x4601b8[_0xaa69('0x70')][_0xaa69('0xa7')],'ListId':_0x181cde[_0xaa69('0xa6')]});_0x51f10d[_0x4601b8[_0xaa69('0x70')][_0xaa69('0xa9')]]=_0x4601b8['body'][_0xaa69('0xa7')];return db['CmContact'][_0xaa69('0x6f')](_0x51f10d,{'fields':_0x3ccf0d,'raw':!![]});})[_0xaa69('0x14')](function(_0x577de3){_0x1840e1[_0xaa69('0xb9')]=_0x577de3;var _0x56c704=createInteractionObject(_0x4601b8['params']['id'],_0x4601b8[_0xaa69('0x70')],_0x4601b8['headers'],_0x577de3);var _0x5f4a2d={'ChatWebsiteId':_0x4601b8['params']['id'],'closed':![]};if(_0x4601b8[_0xaa69('0x70')]['threadId']){_0x5f4a2d['threadId']=_0x4601b8[_0xaa69('0x70')]['threadId'];return db['ChatInteraction']['find']({'where':_0x5f4a2d})[_0xaa69('0x14')](function(_0x5b1e3a){if(_0x5b1e3a){_0x6ce5eb=!![];return _0x5b1e3a;}_0x56c704[_0xaa69('0xba')]=_0x4601b8['body'][_0xaa69('0xba')];_0x56c704['externalUrl']=_0x4601b8['body'][_0xaa69('0xbb')];return db[_0xaa69('0xbc')][_0xaa69('0x6f')](_0x56c704);});}_0x5f4a2d[_0xaa69('0xbd')]=_0x577de3['id'];if(_0x4601b8[_0xaa69('0x70')]['interaction']&&_0x4601b8[_0xaa69('0x70')]['interaction']['id']){_0x5f4a2d['id']=_0x4601b8[_0xaa69('0x70')][_0xaa69('0xbe')]['id'];return db['ChatInteraction']['find']({'where':_0x5f4a2d})[_0xaa69('0x14')](function(_0x1d4b6e){if(_0x1d4b6e){_0x6ce5eb=!![];return _0x1d4b6e;}return db['ChatInteraction']['create'](_0x56c704);});}return db[_0xaa69('0xbc')][_0xaa69('0x6f')](_0x56c704);})[_0xaa69('0x14')](function(_0x5f07f9){if(!_0x6ce5eb)return _0x5f07f9;var _0x2b64d4={'from':(_0x1840e1[_0xaa69('0xb9')][_0xaa69('0x47')]||'')+'\x20'+(_0x1840e1[_0xaa69('0xb9')]['lastName']||'')};if(_0x4601b8[_0xaa69('0x70')][_0xaa69('0xba')]&&_0x4601b8[_0xaa69('0x70')][_0xaa69('0xbf')]&&_0x4601b8[_0xaa69('0x70')][_0xaa69('0xba')]!=_0x4601b8[_0xaa69('0x70')][_0xaa69('0xbf')]){_0x2b64d4[_0xaa69('0xba')]=_0x4601b8[_0xaa69('0x70')]['messageId'];}return _0x5f07f9['update'](_0x2b64d4);})[_0xaa69('0x14')](function(_0x507115){_0x1840e1['interaction']=_0x507115[_0xaa69('0x27')]({'plain':!![]});_0x1840e1[_0xaa69('0xbe')][_0xaa69('0xc0')]=!_0x6ce5eb;if(_0x1840e1[_0xaa69('0xbe')][_0xaa69('0xc0')]){if(_0x1840e1[_0xaa69('0xb4')][_0xaa69('0xc1')]){_0x1840e1[_0xaa69('0xb5')]['push']({'id':0x0,'priority':_0x1840e1['applications']['length']+0x1,'app':_0xaa69('0xc2'),'appdata':_0xaa69('0xc3'),'interval':'*,*,*,*'});}}return db['ChatMessage'][_0xaa69('0x6f')]({'body':_0x4601b8[_0xaa69('0x70')][_0xaa69('0x70')],'ChatWebsiteId':_0x4601b8['params']['id'],'ChatInteractionId':_0x507115['id'],'direction':'in','ContactId':_0x1840e1[_0xaa69('0xb9')]['id'],'AttachmentId':_0x4601b8[_0xaa69('0x70')]['AttachmentId']});})[_0xaa69('0x14')](function(_0x2e6d42){_0x1840e1[_0xaa69('0x1c')]=_0x2e6d42;if(!_0x1840e1['interaction'][_0xaa69('0xc4')]){return;}return db[_0xaa69('0xc5')][_0xaa69('0x76')]({'attributes':['id',_0xaa69('0x2c')],'where':{'id':_0x1840e1[_0xaa69('0xbe')][_0xaa69('0xc4')]}});})['then'](function(_0x3cd27f){if(_0x3cd27f){_0x1840e1[_0xaa69('0xb5')]['unshift']({'id':0x0,'priority':0x0,'app':_0xaa69('0xc6'),'appdata':_0x3cd27f['name']+','+(_0x1840e1[_0xaa69('0xb4')]['waitForTheAssignedAgent']||0xa),'interval':_0xaa69('0xc7')});_0x1840e1[_0xaa69('0xc8')]=!![];}if(!_0x1840e1['interaction'][_0xaa69('0xc9')]){return;}return db[_0xaa69('0xca')][_0xaa69('0x76')]({'attributes':['id',_0xaa69('0x2c')],'where':{'id':_0x1840e1['interaction'][_0xaa69('0xc9')]}});})[_0xaa69('0x14')](function(_0x3237f3){if(_0x3237f3){_0x1840e1[_0xaa69('0xb5')]['unshift']({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x3237f3[_0xaa69('0x2c')]+','+(_0x1840e1['account'][_0xaa69('0xcb')]||0x12c),'interval':_0xaa69('0xc7')});}return respondWithRpcPromise(_0xaa69('0xcc'),'startRouting',_0x1840e1);})[_0xaa69('0x14')](function(_0x1369ce){respondWithRpcPromise(_0xaa69('0xcd'),_0xaa69('0xcd'),{'event':'notify','message':_0x1369ce},client9002);return _0x1369ce;})[_0xaa69('0x14')](respondWithResult(_0x563366,null))[_0xaa69('0x1e')](APIHandleError(_0x563366));};exports[_0xaa69('0xce')]=function(_0x1b2c3a,_0x1dc5e9){var _0x577e8c,_0x325db1,_0xeea9fd;var _0x39c3a4=[];var _0x50b163={};var _0x28ba39=_0x1b2c3a[_0xaa69('0xcf')]||[];var _0xee0e2=[];var _0x4358e0;return db[_0xaa69('0xaf')][_0xaa69('0xa0')]()['then'](function(_0x33bb9f){if(!_0x33bb9f){throw new db[(_0xaa69('0xa8'))][(_0xaa69('0xa1'))](_0xaa69('0xa2'));}_0x39c3a4=_['difference'](_[_0xaa69('0x6c')](_0x33bb9f),[_0xaa69('0xa3'),_0xaa69('0xa5'),_0xaa69('0xd0'),'ListId']);if(_0x1b2c3a['body']['id']){delete _0x1b2c3a[_0xaa69('0x70')]['id'];}if(_[_0xaa69('0x95')](_0x1b2c3a[_0xaa69('0x70')]['from'])){throw _0x1dc5e9[_0xaa69('0x1f')](0x1f4)[_0xaa69('0x2d')](new db[(_0xaa69('0xa8'))]['ValidationError']('from\x20is\x20mandatory'));}if(_[_0xaa69('0x95')](_0x1b2c3a['body'][_0xaa69('0x70')])||_0x1b2c3a[_0xaa69('0x70')][_0xaa69('0x70')]===''){throw _0x1dc5e9[_0xaa69('0x1f')](0x1f4)[_0xaa69('0x2d')](new db[(_0xaa69('0xa8'))]['ValidationError'](_0xaa69('0xd1')));}if(_[_0xaa69('0x95')](_0x1b2c3a['body']['mapKeyOffline'])){throw _0x1dc5e9[_0xaa69('0x1f')](0x1f4)[_0xaa69('0x2d')](new db[(_0xaa69('0xa8'))][(_0xaa69('0xa1'))](_0xaa69('0xd2')+_0x39c3a4));}if(!_[_0xaa69('0xab')](_0x39c3a4,_0x1b2c3a[_0xaa69('0x70')][_0xaa69('0xd3')])){throw _0x1dc5e9['status'](0x1f4)[_0xaa69('0x2d')](new db['Sequelize']['ValidationError'](_0xaa69('0xd4')+_0x39c3a4));}_0x50b163[_0x1b2c3a[_0xaa69('0x70')][_0xaa69('0xd3')]]=_0x1b2c3a['body'][_0xaa69('0xa7')];})[_0xaa69('0x14')](function(){return db[_0xaa69('0x58')][_0xaa69('0x76')]({'where':{'id':_0x1b2c3a[_0xaa69('0x7a')]['id']},'include':[{'model':db[_0xaa69('0xad')],'as':_0xaa69('0xae')},{'model':db[_0xaa69('0xd5')],'as':_0xaa69('0xd5')}]});})[_0xaa69('0x14')](handleEntityNotFound(_0x1dc5e9,null))[_0xaa69('0x14')](function(_0xf2c606){if(_0xf2c606&&_0xf2c606[_0xaa69('0xae')]){_0x325db1=_0xf2c606;var _0x1dd736=_[_0xaa69('0xd')](_0x1b2c3a['body'],{'firstName':_0x1b2c3a[_0xaa69('0x70')][_0xaa69('0xa7')],'phone':_0x1b2c3a[_0xaa69('0x70')][_0xaa69('0xa7')],'ListId':_0xf2c606[_0xaa69('0xa6')]});_0x1dd736[_0x1b2c3a[_0xaa69('0x70')][_0xaa69('0xd3')]]=_0x1b2c3a[_0xaa69('0x70')][_0xaa69('0xa7')];return db[_0xaa69('0xaf')][_0xaa69('0xd6')]({'where':_0x50b163,'defaults':_0x1dd736});}})[_0xaa69('0xb3')](function(_0x3c588f){if(_0x3c588f){_0xeea9fd=_0x3c588f;var _0x43b851=fs[_0xaa69('0xd7')](path[_0xaa69('0x97')](config[_0xaa69('0x91')],'server/files/templates/chatOfflineMessage.ejs'),_0xaa69('0xd8'));var _0x5e9312=ejs['render'](_0x43b851,{'body':_[_0xaa69('0xd9')](_0x1b2c3a[_0xaa69('0x70')]['body']),'bodyTitle':_0x325db1[_0xaa69('0xda')]});return db[_0xaa69('0xdb')][_0xaa69('0x6f')]({'body':_0x5e9312,'plainBody':htmlToText[_0xaa69('0xdc')](_0x5e9312),'ContactId':_0x3c588f['id'],'ChatWebsiteId':_0x325db1['id']});}})['then'](function(_0x5dc5d2){_0x4358e0=_0x5dc5d2;if(_0x28ba39[_0xaa69('0x5e')]){var _0x32e83f=_0x28ba39[_0xaa69('0x57')](function(_0x2a74bc){return{'name':_0x2a74bc['originalname'],'basename':_0x2a74bc[_0xaa69('0x88')],'type':_0x2a74bc[_0xaa69('0xdd')],'ChatOfflineMessageId':_0x5dc5d2['id']};});_0xee0e2=_0x32e83f[_0xaa69('0x57')](_0x4f8241=>{var _0x2c9e39={'filename':_0x4f8241[_0xaa69('0x2c')],'path':path[_0xaa69('0x97')](config[_0xaa69('0x91')],_0xaa69('0xde'),_0xaa69('0xcf'),'attachments',_0xaa69('0xdf'),_0x4f8241[_0xaa69('0xe0')])};return _0x2c9e39;});if(!_0x325db1[_0xaa69('0xe1')]){return db[_0xaa69('0xe2')][_0xaa69('0xe3')](function(_0x4def54){return db[_0xaa69('0xe4')][_0xaa69('0xe5')](_0x32e83f,{'transaction':_0x4def54});});}}})['then'](function(){if(_0x4358e0){_0x577e8c=_0x4358e0;return db[_0xaa69('0xd5')][_0xaa69('0x7c')]({'where':{'service':!![]},'include':[{'model':db[_0xaa69('0xe6')],'as':'Smtp','raw':!![],'include':[{'model':db[_0xaa69('0xe7')],'as':'CloudProvider','raw':!![]}]}]});}})[_0xaa69('0x14')](function(_0x35ef0e){if(_0x35ef0e&&_0x35ef0e[_0xaa69('0xe8')]&&_0x325db1[_0xaa69('0xe9')]&&_0x325db1[_0xaa69('0xea')]){var _0x411d84=_0x35ef0e['getSmtpOptions']();return respondWithRpcPromise(_0xaa69('0xeb'),'sendMail',{'account':_0x411d84,'message':{'from':util[_0xaa69('0x31')](_0xaa69('0xec'),_0x35ef0e[_0xaa69('0x2c')],_0x35ef0e['email']||_0x35ef0e[_0xaa69('0xe8')]['user']),'to':_0x325db1[_0xaa69('0xea')],'subject':_0x325db1[_0xaa69('0xed')],'html':_0x577e8c[_0xaa69('0x70')],'attachments':_0xee0e2}},client9003)[_0xaa69('0x14')](function(){return _0x577e8c;})[_0xaa69('0x1e')](function(_0x12b639){logger['error'](_0x12b639);});}})['then'](function(){if(_0x325db1&&_0x325db1[_0xaa69('0xe1')]&&_0x325db1[_0xaa69('0xee')]){var _0x1fd8f2=[];if(_0x28ba39[_0xaa69('0x5e')]){_0x1fd8f2=_0x28ba39[_0xaa69('0x57')](function(_0x36d853){return{'name':_0x36d853['originalname'],'basename':_0x36d853[_0xaa69('0x88')],'type':_0x36d853[_0xaa69('0xdd')],'ChatOfflineMessageId':_0x4358e0['id']};});}var _0x2f9e7c;if(!_[_0xaa69('0x95')](_0x325db1['subjectOffline'])){var _0x1fd75c=_['map'](_0x1b2c3a[_0xaa69('0x70')],function(_0x91662a){return _0x91662a;});var _0x24b99c=_['toPairsIn'](_0x1fd75c)[0x0];var _0x2a561c=_['mapValues'](_0x24b99c,function(_0x49f37f){return _0x49f37f;});_0x2f9e7c=_0x2a561c[0x1][_0x325db1['subjectOffline']];}var _0x471641={'from':_0xeea9fd[_0xaa69('0xef')],'firstName':_0xeea9fd[_0xaa69('0x47')],'lastName':_0xeea9fd[_0xaa69('0x48')],'mapKey':_0xaa69('0xef'),'message':{'from':_0xeea9fd['email'],'to':_0x325db1[_0xaa69('0xd5')][_0xaa69('0xef')],'cc':'','subject':_[_0xaa69('0x95')](_0x2f9e7c)?_0x325db1['offlineMessageSubject']:_0x2f9e7c,'messageId':'','sentAt':new Date(),'attach':_0x1fd8f2['length'],'attachments':_0x1fd8f2,'originChannel':_0xaa69('0xf0'),'ChatWebsiteId':_0x325db1['id'],'ChatOfflineMessageId':_0x577e8c['id'],'originTo':_0x325db1['MailAccount'][_0xaa69('0xef')]},'body':_0x577e8c[_0xaa69('0x70')]};var _0x3288ce={'account':{'id':_0x325db1[_0xaa69('0xee')]},'body':_0x471641,'log':'NotifyMailAccount'};return respondWithRpcPromise(_0xaa69('0xf1'),'notifyMail',_0x3288ce,client9001)[_0xaa69('0x14')](function(){return _0x577e8c;})[_0xaa69('0x1e')](function(_0xfe3a2f){logger['error'](_0xfe3a2f);});}return;})['then'](function(){if(_0x577e8c){return _0x577e8c;}})[_0xaa69('0x14')](respondWithResult(_0x1dc5e9,null))[_0xaa69('0x1e')](function(){for(var _0x2b951a of _0x28ba39){var _0x3f7b98=path['join'](config['root'],'server','files','attachments',_0xaa69('0xdf'),_0x2b951a[_0xaa69('0x88')]);fs_extra[_0xaa69('0xf2')](_0x3f7b98)[_0xaa69('0x1e')](function(_0x23e408){logger[_0xaa69('0x1b')]('Could\x20not\x20remove\x20attachment\x20file',_0x3f7b98,_0x23e408);});}});};exports[_0xaa69('0xf3')]=function(_0x4a3b91,_0xd2c3f8){return db[_0xaa69('0xbc')][_0xaa69('0x76')]({'where':{'id':_0x4a3b91['params']['id']}})[_0xaa69('0x14')](handleEntityNotFound(_0xd2c3f8,null))[_0xaa69('0x14')](function(_0x4dfad8){if(_0x4dfad8){return _0x4dfad8[_0xaa69('0xf3')](_0x4a3b91[_0xaa69('0x70')]['ids'],_[_0xaa69('0xf4')](_0x4a3b91[_0xaa69('0x70')],[_0xaa69('0x85'),'id'])||{});}})['then'](respondWithResult(_0xd2c3f8,null))[_0xaa69('0x1e')](handleError(_0xd2c3f8,null));};exports[_0xaa69('0xf5')]=function(_0x17785f,_0xd1f972){var _0xab1ec6={'raw':![],'where':{}};var _0x5a019a={};var _0x7b81c0={'count':0x0,'rows':[]};return db[_0xaa69('0x58')][_0xaa69('0x7c')]({'where':{'id':_0x17785f['params']['id']}})[_0xaa69('0x14')](handleEntityNotFound(_0xd1f972,null))[_0xaa69('0x14')](function(_0xd7b846){if(_0xd7b846){_0x5a019a[_0xaa69('0x50')]=_[_0xaa69('0x6c')](db[_0xaa69('0xbc')][_0xaa69('0x59')]);_0x5a019a[_0xaa69('0x5b')]=_[_0xaa69('0x6c')](_0x17785f[_0xaa69('0x5b')]);_0x5a019a[_0xaa69('0x65')]=_[_0xaa69('0x5c')](_0x5a019a[_0xaa69('0x50')],_0x5a019a['query']);_0xab1ec6[_0xaa69('0x5d')]=_[_0xaa69('0x5c')](_0x5a019a['model'],qs[_0xaa69('0x6d')](_0x17785f[_0xaa69('0x5b')][_0xaa69('0x6d')]));_0xab1ec6[_0xaa69('0x5d')]=_0xab1ec6['attributes'][_0xaa69('0x5e')]?_0xab1ec6[_0xaa69('0x5d')]:_0x5a019a['model'];if(!_0x17785f[_0xaa69('0x5b')]['hasOwnProperty'](_0xaa69('0x60'))){_0xab1ec6[_0xaa69('0x22')]=qs[_0xaa69('0x22')](_0x17785f[_0xaa69('0x5b')][_0xaa69('0x22')]);_0xab1ec6[_0xaa69('0x21')]=qs['offset'](_0x17785f[_0xaa69('0x5b')][_0xaa69('0x21')]);}_0xab1ec6['order']=qs[_0xaa69('0x62')](_0x17785f[_0xaa69('0x5b')][_0xaa69('0x62')]);_0xab1ec6['where']=qs[_0xaa69('0x65')](_['pick'](_0x17785f[_0xaa69('0x5b')],_0x5a019a[_0xaa69('0x65')]));_0xab1ec6[_0xaa69('0x63')][_0xaa69('0x7e')]=_0xd7b846['id'];if(_0x17785f[_0xaa69('0x5b')][_0xaa69('0x66')]){_0xab1ec6[_0xaa69('0x63')]=_[_0xaa69('0x6e')](_0xab1ec6[_0xaa69('0x63')],{'$or':_[_0xaa69('0x57')](_0xab1ec6[_0xaa69('0x5d')],function(_0x48f81c){var _0x5956bf={};_0x5956bf[_0x48f81c]={'$like':'%'+_0x17785f[_0xaa69('0x5b')][_0xaa69('0x66')]+'%'};return _0x5956bf;})});}_0xab1ec6=_[_0xaa69('0x6e')]({},_0xab1ec6,_0x17785f[_0xaa69('0x68')]);return db[_0xaa69('0xbc')][_0xaa69('0x24')]({'where':_0xab1ec6[_0xaa69('0x63')]})[_0xaa69('0x14')](function(_0x41ac6d){_0x7b81c0[_0xaa69('0x24')]=_0x41ac6d;if(_0x17785f['query'][_0xaa69('0x69')]){_0xab1ec6[_0xaa69('0x6a')]=[{'model':db[_0xaa69('0xaf')],'as':_0xaa69('0xf6'),'required':![]},{'model':db[_0xaa69('0xc5')],'as':_0xaa69('0xf7'),'attributes':[_0xaa69('0x2c'),_0xaa69('0xf8'),_0xaa69('0xf9')],'required':![]},{'model':db[_0xaa69('0xfa')],'as':_0xaa69('0xfb'),'attributes':['id',_0xaa69('0x2c'),_0xaa69('0xfc')],'where':_0x17785f['query'][_0xaa69('0xfd')]?{'id':_0x17785f[_0xaa69('0x5b')][_0xaa69('0xfd')]}:undefined,'required':_0x17785f['query'][_0xaa69('0xfd')]?!![]:![]}];}return db[_0xaa69('0xbc')][_0xaa69('0x6b')](_0xab1ec6);})['then'](function(_0x3d04f3){_0x7b81c0[_0xaa69('0x7f')]=_0x3d04f3;return _0x7b81c0;});}})[_0xaa69('0x14')](respondWithFilteredResult(_0xd1f972,_0xab1ec6))[_0xaa69('0x1e')](handleError(_0xd1f972,null));};exports[_0xaa69('0x2f')]=function(_0x4b5bb7,_0x5c60e1){var _0x29c844=0x0;var _0x86deed=0x0;var _0x50c977=![];var _0x54c30d;var _0x49c081;return db[_0xaa69('0x58')][_0xaa69('0x76')]({'where':{'id':_0x4b5bb7[_0xaa69('0x7a')]['id']},'include':[{'model':db[_0xaa69('0x3a')],'as':'Interval','include':[{'model':db[_0xaa69('0x3a')],'as':_0xaa69('0x3b'),'attributes':['id','interval']}]}]})[_0xaa69('0x14')](handleEntityNotFound(_0x5c60e1,null))['then'](function(_0x563265){if(_0x563265){_0x54c30d=_0x563265;return _0x563265[_0xaa69('0xfe')]({'raw':!![]});}})['then'](function(_0x1ec96c){if(_0x54c30d){if(_0x1ec96c){_0x49c081=_0x1ec96c;}}return require(_0xaa69('0x93'))[_0xaa69('0x94')]();})[_0xaa69('0x14')](function(_0x1bf73a){if(_0x1bf73a){_0x86deed=_0x1bf73a[_0xaa69('0xff')];_0x50c977=_0x1bf73a[_0xaa69('0x100')];}})['then'](function(){return db[_0xaa69('0xbc')][_0xaa69('0x24')]({'where':{'closed':![]}});})[_0xaa69('0x14')](function(_0x555ac4){_0x29c844=_0x555ac4;if(_0x86deed&&_0x555ac4>_0x86deed){return db[_0xaa69('0x101')][_0xaa69('0x7c')]({'where':{'id':0x1}})[_0xaa69('0x14')](function(_0x4ebbb0){if(_0x4ebbb0){_0x4ebbb0['increment'](_0xaa69('0x102'));}});}})[_0xaa69('0x14')](function(){if(!_0x54c30d[_0xaa69('0x3a')]||!_0x54c30d[_0xaa69('0x3a')]['Intervals'])return!![];return checkWebsiteIntervals(_0x54c30d);})[_0xaa69('0x14')](function(_0x13cd49){var _0x2ea919=fs['readFileSync'](path[_0xaa69('0x97')](config[_0xaa69('0x91')],_0xaa69('0x103')),_0xaa69('0xd8'));var _0x49ff82=new url['URL'](_0x54c30d[_0xaa69('0x104')])[_0xaa69('0x105')];var _0x2356c5=_0xaa69('0x106');var _0x27cb21=![];var _0x1f83b5={'chatVersion':_0x2356c5,'chatWebsiteAddressOrigin':_0x49ff82,'remote':_0x54c30d[_0xaa69('0x107')],'query':querystring[_0xaa69('0x1a')](_[_0xaa69('0x6e')](_0x54c30d[_0xaa69('0x27')]({'plain':!![]}),{'customerIp':_0x4b5bb7['headers'][_0xaa69('0x44')]||_0x4b5bb7[_0xaa69('0x108')]['x-real-ip']||_0x4b5bb7[_0xaa69('0x109')][_0xaa69('0x10a')]||_0x4b5bb7['ip'],'referer':_0x4b5bb7[_0xaa69('0x108')][_0xaa69('0x4a')],'openedInteractions':_0x29c844,'maxInteractions':_0x86deed,'virtual':_0x50c977[_0xaa69('0xff')],'online':_0x13cd49,'custom':_0x50c977}))[_0xaa69('0x10b')](/'/g,'\x5c\x27')};_0x5c60e1[_0xaa69('0x2d')](ejs['render'](Mustache[_0xaa69('0x10c')](_0x2ea919,_0x1f83b5),{'proactiveActions':_0x49c081,'alignment':_0x54c30d[_0xaa69('0x10d')],'verticalAlignment':_0x54c30d[_0xaa69('0x10e')],'div_color':_0x54c30d[_0xaa69('0xfc')],'labelText':_0x54c30d['labelText'],'text_color':_0x54c30d[_0xaa69('0x10f')],'text_button_color':_0x54c30d[_0xaa69('0x110')],'button_color':_0x54c30d[_0xaa69('0x111')],'background_color':_0x54c30d[_0xaa69('0x112')],'hideWhenOffline':_0x54c30d[_0xaa69('0x113')],'intervalId':_0x54c30d[_0xaa69('0x114')],'isDevelopment':_0x27cb21,'chatVersion':_0x2356c5}));})[_0xaa69('0x1e')](handleError(_0x5c60e1,null));};exports[_0xaa69('0x115')]=function(_0x6fab6c,_0x2d1f8a){var _0x236f21=_0x6fab6c[_0xaa69('0x7a')]['id'];var _0x32ee10=_0x6fab6c[_0xaa69('0x70')];var _0x245882=0xc8;var _0x4267f1=null;return db[_0xaa69('0xe2')][_0xaa69('0xe3')]({'isolationLevel':db[_0xaa69('0xe2')][_0xaa69('0x116')][_0xaa69('0x117')]['READ_COMMITTED']},function(_0x5266d1){return db['ChatWebsite'][_0xaa69('0x7c')]({'where':{'id':_0x236f21},'transaction':_0x5266d1})['then'](function(_0x277da6){if(_0x277da6){return db[_0xaa69('0xb2')][_0xaa69('0x29')]({'where':{'ChatWebsiteId':_0x236f21},'transaction':_0x5266d1})[_0xaa69('0x14')](function(){var _0x166686=_[_0xaa69('0x57')](_0x32ee10,function(_0x1f1541){_0x1f1541[_0xaa69('0x7e')]=_0x236f21;return _0x1f1541;});return db[_0xaa69('0xb2')][_0xaa69('0xe5')](_0x166686,{'transaction':_0x5266d1});});}else{_0x245882=0x194;_0x4267f1=[];}});})[_0xaa69('0x14')](function(){if(_0x245882!==0x194){return db[_0xaa69('0xb2')][_0xaa69('0x118')]({'where':{'ChatWebsiteId':_0x236f21},'order':'priority'})[_0xaa69('0x14')](function(_0x33a934){_0x4267f1=_0x33a934;});}})[_0xaa69('0x1e')](function(_0x80450c){_0x245882=0x1f4;logger[_0xaa69('0x1b')](_0x80450c[_0xaa69('0x2b')]);if(_0x80450c[_0xaa69('0x2c')]){delete _0x80450c[_0xaa69('0x2c')];}_0x4267f1=_0x80450c;})[_0xaa69('0x119')](function(){if(_0x4267f1===null){_0x2d1f8a[_0xaa69('0x11a')](_0x245882);}else{if(_0x245882===0x1f4){_0x2d1f8a[_0xaa69('0x1f')](_0x245882)[_0xaa69('0x2d')](_0x4267f1);}else{_0x2d1f8a[_0xaa69('0x1f')](_0x245882)[_0xaa69('0x20')](_0x4267f1);}}});};exports['getApplications']=function(_0x3dad6d,_0x4e8cb8){var _0x258549={};var _0x16acf3={};var _0x2d2a0f;var _0x11ab0e;return db[_0xaa69('0x58')]['findOne']({'where':{'id':_0x3dad6d['params']['id']}})['then'](handleEntityNotFound(_0x4e8cb8,null))['then'](function(_0x34e53a){if(_0x34e53a){_0x2d2a0f=_0x34e53a;_0x16acf3['model']=_[_0xaa69('0x6c')](db['ChatApplication'][_0xaa69('0x59')]);_0x16acf3[_0xaa69('0x5b')]=_[_0xaa69('0x6c')](_0x3dad6d['query']);_0x16acf3[_0xaa69('0x65')]=_[_0xaa69('0x5c')](_0x16acf3['model'],_0x16acf3[_0xaa69('0x5b')]);_0x258549[_0xaa69('0x5d')]=_[_0xaa69('0x5c')](_0x16acf3['model'],qs['fields'](_0x3dad6d[_0xaa69('0x5b')][_0xaa69('0x6d')]));_0x258549[_0xaa69('0x5d')]=_0x258549['attributes'][_0xaa69('0x5e')]?_0x258549['attributes']:_0x16acf3[_0xaa69('0x50')];_0x258549[_0xaa69('0x61')]=qs[_0xaa69('0x62')](_0x3dad6d[_0xaa69('0x5b')]['sort']);_0x258549[_0xaa69('0x63')]=qs[_0xaa69('0x65')](_[_0xaa69('0x64')](_0x3dad6d['query'],_0x16acf3[_0xaa69('0x65')]));if(_0x3dad6d[_0xaa69('0x5b')][_0xaa69('0x66')]){_0x258549[_0xaa69('0x63')]=_['merge'](_0x258549[_0xaa69('0x63')],{'$or':_[_0xaa69('0x57')](_0x258549['attributes'],function(_0x2e8b43){var _0x383572={};_0x383572[_0x2e8b43]={'$like':'%'+_0x3dad6d['query']['filter']+'%'};return _0x383572;})});}_0x258549=_[_0xaa69('0x6e')]({},_0x258549,_0x3dad6d[_0xaa69('0x68')]);return _0x2d2a0f[_0xaa69('0x11b')](_0x258549);}})['then'](function(_0x7549f8){if(_0x7549f8){_0x11ab0e=_0x7549f8[_0xaa69('0x5e')];if(!_0x3dad6d['query']['hasOwnProperty'](_0xaa69('0x60'))){_0x258549[_0xaa69('0x22')]=qs[_0xaa69('0x22')](_0x3dad6d[_0xaa69('0x5b')][_0xaa69('0x22')]);_0x258549[_0xaa69('0x21')]=qs[_0xaa69('0x21')](_0x3dad6d['query'][_0xaa69('0x21')]);}return _0x2d2a0f[_0xaa69('0x11b')](_0x258549);}})['then'](function(_0x22305c){if(_0x22305c){return _0x22305c?{'count':_0x11ab0e,'rows':_0x22305c}:null;}})[_0xaa69('0x14')](respondWithResult(_0x4e8cb8,null))['catch'](handleError(_0x4e8cb8,null));};exports[_0xaa69('0x11c')]=function(_0xf8c773,_0x57d63e){return db[_0xaa69('0x11d')]['find']({'where':{'id':_0xf8c773['params']['id']}})[_0xaa69('0x14')](handleEntityNotFound(_0x57d63e,null))[_0xaa69('0x14')](function(_0x3d1bad){if(_0x3d1bad){return _0x3d1bad[_0xaa69('0x11c')](_0xf8c773[_0xaa69('0x70')][_0xaa69('0x85')],_[_0xaa69('0xf4')](_0xf8c773[_0xaa69('0x70')],['ids','id'])||{});}})['then'](respondWithResult(_0x57d63e,null))['catch'](handleError(_0x57d63e,null));};exports['getProactiveActions']=function(_0x374f76,_0x711c39){var _0x1eb133={};var _0x51cf6e={};var _0x215bb4;var _0x3e5720;return db[_0xaa69('0x58')][_0xaa69('0x7c')]({'where':{'id':_0x374f76[_0xaa69('0x7a')]['id']}})['then'](handleEntityNotFound(_0x711c39,null))[_0xaa69('0x14')](function(_0x3c2a3e){if(_0x3c2a3e){_0x215bb4=_0x3c2a3e;_0x51cf6e[_0xaa69('0x50')]=_[_0xaa69('0x6c')](db['ChatProactiveAction'][_0xaa69('0x59')]);_0x51cf6e[_0xaa69('0x5b')]=_[_0xaa69('0x6c')](_0x374f76[_0xaa69('0x5b')]);_0x51cf6e[_0xaa69('0x65')]=_[_0xaa69('0x5c')](_0x51cf6e['model'],_0x51cf6e[_0xaa69('0x5b')]);_0x1eb133[_0xaa69('0x5d')]=_[_0xaa69('0x5c')](_0x51cf6e['model'],qs[_0xaa69('0x6d')](_0x374f76[_0xaa69('0x5b')][_0xaa69('0x6d')]));_0x1eb133['attributes']=_0x1eb133[_0xaa69('0x5d')][_0xaa69('0x5e')]?_0x1eb133[_0xaa69('0x5d')]:_0x51cf6e[_0xaa69('0x50')];_0x1eb133[_0xaa69('0x61')]=qs['sort'](_0x374f76['query'][_0xaa69('0x62')]);_0x1eb133[_0xaa69('0x63')]=qs[_0xaa69('0x65')](_[_0xaa69('0x64')](_0x374f76[_0xaa69('0x5b')],_0x51cf6e['filters']));if(_0x374f76['query']['filter']){_0x1eb133['where']=_[_0xaa69('0x6e')](_0x1eb133['where'],{'$or':_[_0xaa69('0x57')](_0x1eb133[_0xaa69('0x5d')],function(_0x33aa6a){var _0x18f20a={};_0x18f20a[_0x33aa6a]={'$like':'%'+_0x374f76[_0xaa69('0x5b')]['filter']+'%'};return _0x18f20a;})});}_0x1eb133=_[_0xaa69('0x6e')]({},_0x1eb133,_0x374f76[_0xaa69('0x68')]);return _0x215bb4[_0xaa69('0xfe')](_0x1eb133);}})['then'](function(_0x4cff3c){if(_0x4cff3c){_0x3e5720=_0x4cff3c[_0xaa69('0x5e')];if(!_0x374f76[_0xaa69('0x5b')]['hasOwnProperty'](_0xaa69('0x60'))){_0x1eb133['limit']=qs[_0xaa69('0x22')](_0x374f76[_0xaa69('0x5b')][_0xaa69('0x22')]);_0x1eb133['offset']=qs[_0xaa69('0x21')](_0x374f76[_0xaa69('0x5b')][_0xaa69('0x21')]);}return _0x215bb4[_0xaa69('0xfe')](_0x1eb133);}})[_0xaa69('0x14')](function(_0x58bd99){if(_0x58bd99){return _0x58bd99?{'count':_0x3e5720,'rows':_0x58bd99}:null;}})[_0xaa69('0x14')](respondWithResult(_0x711c39,null))[_0xaa69('0x1e')](handleError(_0x711c39,null));};exports['getFields']=function(_0x259aaa,_0x16adeb){var _0x27abd6=_0x259aaa[_0xaa69('0x5b')]['online']===_0xaa69('0x11e')?_0xaa69('0x11f'):_0xaa69('0x120');return db['ChatWebsite'][_0xaa69('0x76')]({'attributes':['id',_0x27abd6],'where':{'id':_0x259aaa[_0xaa69('0x7a')]['id']}})['then'](handleEntityNotFound(_0x16adeb,null))[_0xaa69('0x14')](function(_0xc49f5e){if(_0xc49f5e){var _0x22781f=_0xc49f5e[_0x27abd6];var _0x2980f0=_0x22781f&&_0x22781f[_0xaa69('0x121')]?_0x22781f[_0xaa69('0x121')]:[];_0x16adeb['send']({'fromKey':_[_0xaa69('0x95')](_0x22781f[_0xaa69('0x122')])?undefined:_0x22781f[_0xaa69('0x122')],'count':_0x2980f0[_0xaa69('0x5e')],'rows':_0x2980f0});}})[_0xaa69('0x1e')](handleError(_0x16adeb,null));};exports[_0xaa69('0x123')]=function(_0x16a0fe,_0x10d79a){var _0x4a6d8f={'raw':![],'where':{}};var _0x254b88={};var _0x58c940={'count':0x0,'rows':[]};return db[_0xaa69('0x58')]['findOne']({'where':{'id':_0x16a0fe[_0xaa69('0x7a')]['id']}})['then'](handleEntityNotFound(_0x10d79a,null))['then'](function(_0x50c604){if(_0x50c604){_0x254b88[_0xaa69('0x50')]=_[_0xaa69('0x6c')](db[_0xaa69('0xdb')][_0xaa69('0x59')]);_0x254b88[_0xaa69('0x5b')]=_[_0xaa69('0x6c')](_0x16a0fe['query']);_0x254b88['filters']=_[_0xaa69('0x5c')](_0x254b88[_0xaa69('0x50')],_0x254b88[_0xaa69('0x5b')]);_0x4a6d8f[_0xaa69('0x5d')]=_[_0xaa69('0x5c')](_0x254b88['model'],qs[_0xaa69('0x6d')](_0x16a0fe[_0xaa69('0x5b')][_0xaa69('0x6d')]));_0x4a6d8f[_0xaa69('0x5d')]=_0x4a6d8f[_0xaa69('0x5d')][_0xaa69('0x5e')]?_0x4a6d8f[_0xaa69('0x5d')]:_0x254b88['model'];if(!_0x16a0fe['query'][_0xaa69('0x5f')](_0xaa69('0x60'))){_0x4a6d8f['limit']=qs[_0xaa69('0x22')](_0x16a0fe[_0xaa69('0x5b')][_0xaa69('0x22')]);_0x4a6d8f['offset']=qs[_0xaa69('0x21')](_0x16a0fe[_0xaa69('0x5b')][_0xaa69('0x21')]);}_0x4a6d8f['order']=qs[_0xaa69('0x62')](_0x16a0fe[_0xaa69('0x5b')][_0xaa69('0x62')]);_0x4a6d8f[_0xaa69('0x63')]=qs[_0xaa69('0x65')](_[_0xaa69('0x64')](_0x16a0fe[_0xaa69('0x5b')],_0x254b88['filters']));_0x4a6d8f[_0xaa69('0x63')][_0xaa69('0x7e')]=_0x50c604['id'];if(_0x16a0fe[_0xaa69('0x5b')]['filter']){_0x4a6d8f[_0xaa69('0x63')]=_[_0xaa69('0x6e')](_0x4a6d8f[_0xaa69('0x63')],{'$or':_[_0xaa69('0x57')](_0x4a6d8f['attributes'],function(_0x170c4b){var _0x4541ef={};_0x4541ef[_0x170c4b]={'$like':'%'+_0x16a0fe[_0xaa69('0x5b')][_0xaa69('0x66')]+'%'};return _0x4541ef;})});}_0x4a6d8f=_['merge']({},_0x4a6d8f,_0x16a0fe['options']);return db[_0xaa69('0xdb')][_0xaa69('0x24')]({'where':_0x4a6d8f[_0xaa69('0x63')]})[_0xaa69('0x14')](function(_0x2ee674){_0x58c940[_0xaa69('0x24')]=_0x2ee674;if(_0x16a0fe['query']['includeAll']){_0x4a6d8f[_0xaa69('0x6a')]=[{'all':!![]}];}else{_0x4a6d8f[_0xaa69('0x6a')]=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0xaa69('0xe4')],'as':_0xaa69('0x124'),'required':![]}];}return db[_0xaa69('0xdb')][_0xaa69('0x6b')](_0x4a6d8f);})[_0xaa69('0x14')](function(_0x512691){_0x58c940[_0xaa69('0x7f')]=_0x512691;return _0x58c940;});}})[_0xaa69('0x14')](respondWithFilteredResult(_0x10d79a,_0x4a6d8f))['catch'](handleError(_0x10d79a,null));};exports[_0xaa69('0x125')]=function(_0x1336e9,_0x47a5e5){return db[_0xaa69('0x58')]['find']({'where':{'id':_0x1336e9['params']['id']}})[_0xaa69('0x14')](handleEntityNotFound(_0x47a5e5,null))['then'](function(_0x19537b){if(_0x19537b){return _0x19537b['addAgents'](_0x1336e9['body'][_0xaa69('0x85')],_[_0xaa69('0xf4')](_0x1336e9[_0xaa69('0x70')],[_0xaa69('0x85'),'id'])||{})[_0xaa69('0xb3')](function(_0x1ba7f7){for(var _0x134218=0x0;_0x134218<_0x1336e9[_0xaa69('0x70')][_0xaa69('0x85')][_0xaa69('0x5e')];_0x134218+=0x1){socket[_0xaa69('0x126')](_0xaa69('0x127'),{'UserId':Number(_0x1336e9[_0xaa69('0x70')][_0xaa69('0x85')][_0x134218]),'ChatWebsiteId':Number(_0x1336e9['params']['id'])});}return _0x1ba7f7;});}})[_0xaa69('0x14')](respondWithResult(_0x47a5e5,null))[_0xaa69('0x1e')](handleError(_0x47a5e5,null));};exports['removeAgents']=function(_0x18165c,_0x3d3b98){return db['ChatWebsite'][_0xaa69('0x76')]({'where':{'id':_0x18165c[_0xaa69('0x7a')]['id']}})[_0xaa69('0x14')](handleEntityNotFound(_0x3d3b98,null))[_0xaa69('0x14')](function(_0x58dd93){if(_0x58dd93){return _0x58dd93['removeAgents'](_0x18165c[_0xaa69('0x5b')][_0xaa69('0x85')])[_0xaa69('0x14')](function(){if(_[_0xaa69('0x128')](_0x18165c['query'][_0xaa69('0x85')])){for(var _0x50162d=0x0;_0x50162d<_0x18165c[_0xaa69('0x5b')]['ids'][_0xaa69('0x5e')];_0x50162d+=0x1){socket[_0xaa69('0x126')]('userChatWebsite:remove',{'UserId':Number(_0x18165c[_0xaa69('0x5b')][_0xaa69('0x85')][_0x50162d]),'ChatWebsiteId':Number(_0x18165c[_0xaa69('0x7a')]['id'])});}}else{socket['emit']('userChatWebsite:remove',{'UserId':Number(_0x18165c[_0xaa69('0x5b')]['ids']),'ChatWebsiteId':Number(_0x18165c['params']['id'])});}});}})[_0xaa69('0x14')](respondWithStatusCode(_0x3d3b98,null))[_0xaa69('0x1e')](handleError(_0x3d3b98,null));};exports[_0xaa69('0x129')]=function(_0x4f5bc2,_0x1dceab){var _0x43c8cf={};var _0x54914={};var _0x17b314;var _0x485d8b;return db[_0xaa69('0x58')][_0xaa69('0x7c')]({'where':{'id':_0x4f5bc2['params']['id']}})[_0xaa69('0x14')](handleEntityNotFound(_0x1dceab,null))[_0xaa69('0x14')](function(_0x4c5804){if(_0x4c5804){_0x17b314=_0x4c5804;_0x54914['model']=_['keys'](db[_0xaa69('0xc5')][_0xaa69('0x59')]);_0x54914[_0xaa69('0x5b')]=_[_0xaa69('0x6c')](_0x4f5bc2[_0xaa69('0x5b')]);_0x54914[_0xaa69('0x65')]=_['intersection'](_0x54914[_0xaa69('0x50')],_0x54914['query']);_0x43c8cf[_0xaa69('0x5d')]=_[_0xaa69('0x5c')](_0x54914['model'],qs[_0xaa69('0x6d')](_0x4f5bc2[_0xaa69('0x5b')]['fields']));_0x43c8cf[_0xaa69('0x5d')]=_0x43c8cf[_0xaa69('0x5d')]['length']?_0x43c8cf[_0xaa69('0x5d')]:_0x54914['model'];_0x43c8cf[_0xaa69('0x61')]=qs[_0xaa69('0x62')](_0x4f5bc2['query']['sort']);_0x43c8cf['where']=qs[_0xaa69('0x65')](_[_0xaa69('0x64')](_0x4f5bc2[_0xaa69('0x5b')],_0x54914[_0xaa69('0x65')]));if(_0x4f5bc2[_0xaa69('0x5b')][_0xaa69('0x66')]){_0x43c8cf[_0xaa69('0x63')]=_['merge'](_0x43c8cf['where'],{'$or':_[_0xaa69('0x57')](_0x43c8cf[_0xaa69('0x5d')],function(_0x4c6889){var _0x5e25e6={};_0x5e25e6[_0x4c6889]={'$like':'%'+_0x4f5bc2['query'][_0xaa69('0x66')]+'%'};return _0x5e25e6;})});}_0x43c8cf=_[_0xaa69('0x6e')]({},_0x43c8cf,_0x4f5bc2['options']);return _0x17b314[_0xaa69('0x129')](_0x43c8cf);}})[_0xaa69('0x14')](function(_0x30ae51){if(_0x30ae51){_0x485d8b=_0x30ae51[_0xaa69('0x5e')];if(!_0x4f5bc2['query'][_0xaa69('0x5f')](_0xaa69('0x60'))){_0x43c8cf[_0xaa69('0x22')]=qs['limit'](_0x4f5bc2[_0xaa69('0x5b')]['limit']);_0x43c8cf[_0xaa69('0x21')]=qs[_0xaa69('0x21')](_0x4f5bc2['query'][_0xaa69('0x21')]);}return _0x17b314[_0xaa69('0x129')](_0x43c8cf);}})[_0xaa69('0x14')](function(_0x521d11){if(_0x521d11){return _0x521d11?{'count':_0x485d8b,'rows':_0x521d11}:null;}})[_0xaa69('0x14')](respondWithResult(_0x1dceab,null))[_0xaa69('0x1e')](handleError(_0x1dceab,null));}; \ No newline at end of file +var _0xa9e0=['getAgents','mustache','util','path','lodash','html-to-text','ioredis','jayson/promise','url','../../components/parsers/qs','api','../../config/environment','../../errors/api','APINotFoundError','handleError','../../mysqldb','redis','defaults','register','client','http','request','info','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatWebsite,\x20%s,\x20%s','message','result','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','update','then','destroy','get','ChatWebsites','UserProfileResource','end','stack','name','setUA','user-agent','getResult','cf-connecting-ip','x-forwarded-for','split','firstName','x-real-port','referer','browser','version','format','unknown','%s\x20%s','device','model','vendor','%s\x20%s\x20%s','type','index','Pause','map','ChatWebsite','rawAttributes','fieldName','key','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','VIRTUAL','merge','options','includeAll','catch','params','mandatoryDispositionPause','include','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','Disposition','getDispositions','findOne','pick','findAll','removeDispositions','ids','addAnswer','ChatWebsiteId','CannedAnswer','getAnswers','removeAnswers','sitepic','file','filename','addAvatar','agentAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','root','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','custom','existsSync','join','server/files/images/logos/','download','server/files/images/avatars/default_avatar.png','isNil','server/files/images/avatars/','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','from','From\x20is\x20mandatory','mapKey','MapKey\x20is\x20mandatory','isEmpty','CmContact','createdAt','updatedAt','ListId','includes','Invalid\x20MapKey\x20parameter.\x20Allowed\x20values:\x20','CmList','List','Contacts','DESC','Applications','Interval','Intervals','interval','Chat\x20Website\x20with\x20id\x20%s\x20not\x20found','timezone','ifTime','account','list','applications','orderBy','priority','asc','threadId','ChatInteraction','externalUrl','interaction','contact','lastName','messageId','created','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','ChatQueue','queueId','queue','waitForTheAssignedQueue','Start','EventManager','offline','files','ValidationError','no\x20available\x20attributes','difference','CompanyId','send','Sequelize','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','spread','readFileSync','utf8','render','toPairs','offlineMessageBody','ChatOfflineMessage','originalname','mimetype','server','attachments','offline-chat','basename','openNewInteraction','sequelize','transaction','bulkCreate','MailServerOut','Smtp','CloudProvider','forwardOffline','forwardOfflineAddress','getSmtpOptions','SendMail','\x22%s\x22\x20<%s>','offlineMessageSubject','MailAccountId','subjectOffline','toPairsIn','mapValues','email','Chat','NotifyMailAccount','remove','addInteraction','omit','Contact','fullname','internal','Tags','color','tag','getSnippet','virtual','increment','chatLicenseExceeded','URL','address','origin','remote','headers','connection','remoteAddress','replace','alignment','labelText','textColor','backgroundColor','IntervalId','Transaction','ISOLATION_LEVELS','ChatApplication','findAndCountAll','finally','getApplications','addProactiveActions','getProactiveActions','ChatProactiveAction','getFields','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','Attachment','addAgents','emit','removeAgents','isArray','userChatWebsite:remove'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xa9e0,0x123));var _0x0a9e=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0xa9e0[_0x32d457];return _0x338386;};'use strict';var Mustache=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0a9e('0x3'));var querystring=require('querystring');var htmlToText=require(_0x0a9e('0x4'));var Redis=require(_0x0a9e('0x5'));var jayson=require(_0x0a9e('0x6'));var url=require(_0x0a9e('0x7'));var qs=require(_0x0a9e('0x8'));var logger=require('../../config/logger')(_0x0a9e('0x9'));var config=require(_0x0a9e('0xa'));var APIBadRequestError=require(_0x0a9e('0xb'))['APIBadRequestError'];var APINotFoundError=require('../../errors/api')[_0x0a9e('0xc')];var APIOutOfIntervalError=require('../../errors/api')['APIOutOfIntervalError'];var APIHandleError=require(_0x0a9e('0xb'))[_0x0a9e('0xd')];var db=require(_0x0a9e('0xe'))['db'];config[_0x0a9e('0xf')]=_[_0x0a9e('0x10')](config[_0x0a9e('0xf')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./chatWebsite.socket')[_0x0a9e('0x11')](socket);var client=jayson[_0x0a9e('0x12')][_0x0a9e('0x13')]({'port':0x232c});var client9002=jayson[_0x0a9e('0x12')][_0x0a9e('0x13')]({'port':0x232a});var client9003=jayson[_0x0a9e('0x12')]['http']({'port':0x232b});var client9001=jayson[_0x0a9e('0x12')][_0x0a9e('0x13')]({'port':0x2329});function respondWithRpcPromise(_0x2b4227,_0x281129,_0x44dcfd,_0x4d5611){return new Promise(function(_0x52a03d,_0x22dccb){var _0x5d0880=_0x4d5611||client;return _0x5d0880[_0x0a9e('0x14')](_0x2b4227,_0x44dcfd)['then'](function(_0x16033c){logger[_0x0a9e('0x15')]('ChatWebsite,\x20%s,\x20%s',_0x281129,_0x0a9e('0x16'));logger['debug'](_0x0a9e('0x17'),_0x281129,_0x0a9e('0x16'),JSON[_0x0a9e('0x18')](_0x16033c));if(_0x16033c[_0x0a9e('0x19')]){if(_0x16033c[_0x0a9e('0x19')][_0x0a9e('0x1a')]===0x1f4){logger[_0x0a9e('0x19')](_0x0a9e('0x1b'),_0x281129,_0x16033c[_0x0a9e('0x19')][_0x0a9e('0x1c')]);return _0x22dccb(_0x16033c[_0x0a9e('0x19')][_0x0a9e('0x1c')]);}logger['error'](_0x0a9e('0x1b'),_0x281129,_0x16033c[_0x0a9e('0x19')]['message']);return _0x52a03d(_0x16033c[_0x0a9e('0x19')]['message']);}else{logger['info'](_0x0a9e('0x1b'),_0x281129,_0x0a9e('0x16'));_0x52a03d(_0x16033c[_0x0a9e('0x1d')][_0x0a9e('0x1c')]);}})['catch'](function(_0xfb6e48){logger[_0x0a9e('0x19')](_0x0a9e('0x1b'),_0x281129,_0xfb6e48);_0x22dccb(_0xfb6e48);});});}function respondWithStatusCode(_0x4d00e6,_0x370d86){_0x370d86=_0x370d86||0xcc;return function(_0x42ac8f){if(_0x42ac8f){return _0x4d00e6[_0x0a9e('0x1e')](_0x370d86);}return _0x4d00e6['status'](_0x370d86)['end']();};}function respondWithResult(_0x197ec0,_0x3a8e58){_0x3a8e58=_0x3a8e58||0xc8;return function(_0x40c424){if(_0x40c424){return _0x197ec0[_0x0a9e('0x1f')](_0x3a8e58)['json'](_0x40c424);}};}function respondWithFilteredResult(_0x384319,_0x479bc4){return function(_0x45a1e7){if(_0x45a1e7){var _0x5bfb33=typeof _0x479bc4[_0x0a9e('0x20')]===_0x0a9e('0x21')&&typeof _0x479bc4[_0x0a9e('0x22')]===_0x0a9e('0x21');var _0x140511=_0x45a1e7[_0x0a9e('0x23')];var _0x11c3b6=_0x5bfb33?0x0:_0x479bc4[_0x0a9e('0x20')];var _0x5a101a=_0x5bfb33?_0x45a1e7[_0x0a9e('0x23')]:_0x479bc4[_0x0a9e('0x20')]+_0x479bc4[_0x0a9e('0x22')];var _0x2ec755;if(_0x5a101a>=_0x140511){_0x5a101a=_0x140511;_0x2ec755=0xc8;}else{_0x2ec755=0xce;}_0x384319['status'](_0x2ec755);return _0x384319[_0x0a9e('0x24')](_0x0a9e('0x25'),_0x11c3b6+'-'+_0x5a101a+'/'+_0x140511)[_0x0a9e('0x26')](_0x45a1e7);}return null;};}function saveUpdates(_0x824a4f){return function(_0x58b06f){if(_0x58b06f){return _0x58b06f[_0x0a9e('0x27')](_0x824a4f)[_0x0a9e('0x28')](function(_0x2e8759){return _0x2e8759;});}return null;};}function removeEntity(_0x1dbde2){return function(_0x540530){if(_0x540530){return _0x540530[_0x0a9e('0x29')]()['then'](function(){var _0x2407f9=_0x540530[_0x0a9e('0x2a')]({'plain':!![]});var _0x1122db=_0x0a9e('0x2b');return db[_0x0a9e('0x2c')]['destroy']({'where':{'type':_0x1122db,'resourceId':_0x2407f9['id']}})[_0x0a9e('0x28')](function(){return _0x540530;});})[_0x0a9e('0x28')](function(){_0x1dbde2[_0x0a9e('0x1f')](0xcc)[_0x0a9e('0x2d')]();});}};}function handleEntityNotFound(_0x2b45ea){return function(_0x409319){if(!_0x409319){_0x2b45ea[_0x0a9e('0x1e')](0x194);}return _0x409319;};}function handleError(_0x39e565,_0x5583a4){_0x5583a4=_0x5583a4||0x1f4;return function(_0x44295a){logger['error'](_0x44295a[_0x0a9e('0x2e')]);if(_0x44295a[_0x0a9e('0x2f')]){delete _0x44295a[_0x0a9e('0x2f')];}_0x39e565[_0x0a9e('0x1f')](_0x5583a4)['send'](_0x44295a);};}function createInteractionObject(_0x191e91,_0xd1836d,_0x1fa90d,_0x15de0e){var _0x4853b1=require('user-agent-parser');var _0x1e8694=new _0x4853b1();var _0x5640eb=_0x1e8694[_0x0a9e('0x30')](_0x1fa90d[_0x0a9e('0x31')])[_0x0a9e('0x32')]();var _0x1ef87a=_0xd1836d['customerIp'];if(_0x1fa90d[_0x0a9e('0x33')]){_0x1ef87a=_0x1fa90d[_0x0a9e('0x33')];}else if(_0x1fa90d[_0x0a9e('0x34')]){_0x1ef87a=_['first'](_0x1fa90d[_0x0a9e('0x34')][_0x0a9e('0x35')](','));}return{'ContactId':_0x15de0e['id'],'ChatWebsiteId':_0x191e91,'from':(_0x15de0e[_0x0a9e('0x36')]||'')+'\x20'+(_0x15de0e['lastName']||''),'customerIp':_0x1ef87a,'customerPort':_0x1fa90d['x-real-port']?_0x1fa90d[_0x0a9e('0x37')]:null,'referer':_0xd1836d[_0x0a9e('0x38')],'browserName':_0x5640eb['browser'][_0x0a9e('0x2f')]&&_0x5640eb[_0x0a9e('0x39')][_0x0a9e('0x3a')]?util[_0x0a9e('0x3b')]('%s\x20%s',_0x5640eb['browser'][_0x0a9e('0x2f')],_0x5640eb[_0x0a9e('0x39')]['version']):_0x0a9e('0x3c'),'browserVersion':_0x5640eb[_0x0a9e('0x39')][_0x0a9e('0x3a')]||'unknown','osName':util[_0x0a9e('0x3b')](_0x0a9e('0x3d'),_0x5640eb['os'][_0x0a9e('0x2f')],_0x5640eb['os'][_0x0a9e('0x3a')]),'osVersion':_0x5640eb['os'][_0x0a9e('0x3a')],'deviceModel':_0x5640eb[_0x0a9e('0x3e')][_0x0a9e('0x3f')]&&_0x5640eb[_0x0a9e('0x3e')][_0x0a9e('0x40')]?util[_0x0a9e('0x3b')](_0x0a9e('0x41'),_0x5640eb[_0x0a9e('0x3e')][_0x0a9e('0x3f')],_0x5640eb[_0x0a9e('0x3e')][_0x0a9e('0x40')],_0x5640eb['device']['type']):null,'deviceVendor':_0x5640eb[_0x0a9e('0x3e')][_0x0a9e('0x40')],'deviceType':_0x5640eb[_0x0a9e('0x3e')][_0x0a9e('0x42')],'formData':JSON[_0x0a9e('0x18')](_0xd1836d)};}exports[_0x0a9e('0x43')]=function(_0x10b040,_0x445e25){var _0x432fcc={'include':[{'model':db[_0x0a9e('0x44')],'as':'mandatoryDispositionPause'}]},_0x25c6e6={},_0x2c2cb0={'count':0x0,'rows':[]};var _0x117c99=_[_0x0a9e('0x45')](db[_0x0a9e('0x46')][_0x0a9e('0x47')],function(_0x2e8caf){return{'name':_0x2e8caf[_0x0a9e('0x48')],'type':_0x2e8caf[_0x0a9e('0x42')][_0x0a9e('0x49')]};});_0x25c6e6['model']=_[_0x0a9e('0x45')](_0x117c99,'name');_0x25c6e6[_0x0a9e('0x4a')]=_[_0x0a9e('0x4b')](_0x10b040[_0x0a9e('0x4a')]);_0x25c6e6['filters']=_[_0x0a9e('0x4c')](_0x25c6e6[_0x0a9e('0x3f')],_0x25c6e6[_0x0a9e('0x4a')]);_0x432fcc[_0x0a9e('0x4d')]=_[_0x0a9e('0x4c')](_0x25c6e6[_0x0a9e('0x3f')],qs[_0x0a9e('0x4e')](_0x10b040['query'][_0x0a9e('0x4e')]));_0x432fcc[_0x0a9e('0x4d')]=_0x432fcc[_0x0a9e('0x4d')][_0x0a9e('0x4f')]?_0x432fcc[_0x0a9e('0x4d')]:_0x25c6e6[_0x0a9e('0x3f')];if(!_0x10b040[_0x0a9e('0x4a')][_0x0a9e('0x50')](_0x0a9e('0x51'))){_0x432fcc['limit']=qs[_0x0a9e('0x22')](_0x10b040[_0x0a9e('0x4a')]['limit']);_0x432fcc['offset']=qs['offset'](_0x10b040[_0x0a9e('0x4a')][_0x0a9e('0x20')]);}_0x432fcc[_0x0a9e('0x52')]=qs[_0x0a9e('0x53')](_0x10b040[_0x0a9e('0x4a')][_0x0a9e('0x53')]);_0x432fcc[_0x0a9e('0x54')]=qs[_0x0a9e('0x55')](_['pick'](_0x10b040['query'],_0x25c6e6['filters']),_0x117c99);if(_0x10b040[_0x0a9e('0x4a')][_0x0a9e('0x56')]){_0x432fcc[_0x0a9e('0x54')]=_['merge'](_0x432fcc[_0x0a9e('0x54')],{'$or':_[_0x0a9e('0x45')](_0x117c99,function(_0x53d113){if(_0x53d113['type']!==_0x0a9e('0x57')){var _0x59c6ff={};_0x59c6ff[_0x53d113[_0x0a9e('0x2f')]]={'$like':'%'+_0x10b040['query'][_0x0a9e('0x56')]+'%'};return _0x59c6ff;}})});}_0x432fcc=_[_0x0a9e('0x58')]({},_0x432fcc,_0x10b040[_0x0a9e('0x59')]);var _0x53613a={'where':_0x432fcc[_0x0a9e('0x54')]};return db[_0x0a9e('0x46')]['count'](_0x53613a)['then'](function(_0x128aa6){_0x2c2cb0[_0x0a9e('0x23')]=_0x128aa6;if(_0x10b040['query'][_0x0a9e('0x5a')]){_0x432fcc['include']=[{'all':!![]}];}return db[_0x0a9e('0x46')]['findAll'](_0x432fcc);})[_0x0a9e('0x28')](function(_0x4a6deb){_0x2c2cb0['rows']=_0x4a6deb;return _0x2c2cb0;})['then'](respondWithFilteredResult(_0x445e25,_0x432fcc))[_0x0a9e('0x5b')](handleError(_0x445e25,null));};exports['show']=function(_0x2f7092,_0x65432){var _0x3cfd00={'raw':![],'where':{'id':_0x2f7092[_0x0a9e('0x5c')]['id']},'include':[{'model':db[_0x0a9e('0x44')],'as':_0x0a9e('0x5d')}]},_0x19b4df={};_0x19b4df[_0x0a9e('0x3f')]=_['keys'](db[_0x0a9e('0x46')][_0x0a9e('0x47')]);_0x19b4df[_0x0a9e('0x4a')]=_[_0x0a9e('0x4b')](_0x2f7092[_0x0a9e('0x4a')]);_0x19b4df[_0x0a9e('0x55')]=_['intersection'](_0x19b4df[_0x0a9e('0x3f')],_0x19b4df[_0x0a9e('0x4a')]);_0x3cfd00['attributes']=_[_0x0a9e('0x4c')](_0x19b4df['model'],qs[_0x0a9e('0x4e')](_0x2f7092['query']['fields']));_0x3cfd00['attributes']=_0x3cfd00[_0x0a9e('0x4d')]['length']?_0x3cfd00[_0x0a9e('0x4d')]:_0x19b4df[_0x0a9e('0x3f')];if(_0x2f7092[_0x0a9e('0x4a')][_0x0a9e('0x5a')]){_0x3cfd00[_0x0a9e('0x5e')]=[{'all':!![]}];}_0x3cfd00=_[_0x0a9e('0x58')]({},_0x3cfd00,_0x2f7092['options']);return db[_0x0a9e('0x46')]['find'](_0x3cfd00)[_0x0a9e('0x28')](handleEntityNotFound(_0x65432,null))[_0x0a9e('0x28')](respondWithResult(_0x65432,null))[_0x0a9e('0x5b')](handleError(_0x65432,null));};exports['create']=function(_0x453360,_0x156f1c){return db[_0x0a9e('0x46')][_0x0a9e('0x5f')](_0x453360['body'],{})[_0x0a9e('0x28')](function(_0xe05a5a){var _0x54327c=_0x453360[_0x0a9e('0x60')][_0x0a9e('0x2a')]({'plain':!![]});if(!_0x54327c)throw new Error(_0x0a9e('0x61'));if(_0x54327c[_0x0a9e('0x62')]===_0x0a9e('0x60')){var _0x4d4a35=_0xe05a5a[_0x0a9e('0x2a')]({'plain':!![]});var _0x2937e0=_0x0a9e('0x2b');return db['UserProfileSection'][_0x0a9e('0x63')]({'where':{'name':_0x2937e0,'userProfileId':_0x54327c['userProfileId']},'raw':!![]})['then'](function(_0x242745){if(_0x242745&&_0x242745[_0x0a9e('0x64')]===0x0){return db[_0x0a9e('0x2c')][_0x0a9e('0x5f')]({'name':_0x4d4a35[_0x0a9e('0x2f')],'resourceId':_0x4d4a35['id'],'type':_0x242745[_0x0a9e('0x2f')],'sectionId':_0x242745['id']},{})[_0x0a9e('0x28')](function(){return _0xe05a5a;});}else{return _0xe05a5a;}})[_0x0a9e('0x5b')](function(_0x2d7205){logger[_0x0a9e('0x19')](_0x0a9e('0x65'),_0x2d7205);throw _0x2d7205;});}return _0xe05a5a;})[_0x0a9e('0x28')](respondWithResult(_0x156f1c,0xc9))[_0x0a9e('0x5b')](handleError(_0x156f1c,null));};exports[_0x0a9e('0x27')]=function(_0x320898,_0x412a72){if(_0x320898[_0x0a9e('0x66')]['id']){delete _0x320898[_0x0a9e('0x66')]['id'];}return db['ChatWebsite'][_0x0a9e('0x63')]({'where':{'id':_0x320898[_0x0a9e('0x5c')]['id']},'include':[{'model':db[_0x0a9e('0x44')],'as':'mandatoryDispositionPause'}]})[_0x0a9e('0x28')](handleEntityNotFound(_0x412a72,null))[_0x0a9e('0x28')](saveUpdates(_0x320898['body'],null))[_0x0a9e('0x28')](respondWithResult(_0x412a72,null))[_0x0a9e('0x5b')](handleError(_0x412a72,null));};exports[_0x0a9e('0x29')]=function(_0x427946,_0x13b5c0){return db['ChatWebsite']['find']({'where':{'id':_0x427946['params']['id']}})[_0x0a9e('0x28')](handleEntityNotFound(_0x13b5c0,null))[_0x0a9e('0x28')](removeEntity(_0x13b5c0,null))[_0x0a9e('0x5b')](handleError(_0x13b5c0,null));};exports[_0x0a9e('0x67')]=function(_0x6abd03,_0x380ab3){return db[_0x0a9e('0x46')][_0x0a9e('0x67')]()['then'](respondWithResult(_0x380ab3,null))[_0x0a9e('0x5b')](handleError(_0x380ab3,null));};exports[_0x0a9e('0x68')]=function(_0x12ccdb,_0x4a4fc7){if(_0x12ccdb[_0x0a9e('0x66')]['id']){delete _0x12ccdb['body']['id'];}return db[_0x0a9e('0x46')][_0x0a9e('0x63')]({'where':{'id':_0x12ccdb['params']['id']}})[_0x0a9e('0x28')](handleEntityNotFound(_0x4a4fc7,null))[_0x0a9e('0x28')](function(_0x2cc7a7){if(_0x2cc7a7){_0x12ccdb[_0x0a9e('0x66')]['ChatWebsiteId']=_0x2cc7a7['id'];return db[_0x0a9e('0x69')][_0x0a9e('0x5f')](_0x12ccdb[_0x0a9e('0x66')]);}})[_0x0a9e('0x28')](respondWithResult(_0x4a4fc7,null))['catch'](handleError(_0x4a4fc7,null));};exports[_0x0a9e('0x6a')]=function(_0x3d91db,_0x2d5506){var _0x361b21={'raw':![],'where':{}};var _0x4abc8f={};var _0x290d43={'count':0x0,'rows':[]};return db[_0x0a9e('0x46')][_0x0a9e('0x6b')]({'where':{'id':_0x3d91db[_0x0a9e('0x5c')]['id']}})[_0x0a9e('0x28')](handleEntityNotFound(_0x2d5506,null))[_0x0a9e('0x28')](function(_0x40fc56){if(_0x40fc56){_0x4abc8f[_0x0a9e('0x3f')]=_[_0x0a9e('0x4b')](db[_0x0a9e('0x69')][_0x0a9e('0x47')]);_0x4abc8f[_0x0a9e('0x4a')]=_[_0x0a9e('0x4b')](_0x3d91db[_0x0a9e('0x4a')]);_0x4abc8f['filters']=_[_0x0a9e('0x4c')](_0x4abc8f[_0x0a9e('0x3f')],_0x4abc8f[_0x0a9e('0x4a')]);_0x361b21['attributes']=_[_0x0a9e('0x4c')](_0x4abc8f[_0x0a9e('0x3f')],qs[_0x0a9e('0x4e')](_0x3d91db[_0x0a9e('0x4a')]['fields']));_0x361b21['attributes']=_0x361b21[_0x0a9e('0x4d')][_0x0a9e('0x4f')]?_0x361b21['attributes']:_0x4abc8f[_0x0a9e('0x3f')];if(!_0x3d91db['query'][_0x0a9e('0x50')](_0x0a9e('0x51'))){_0x361b21['limit']=qs[_0x0a9e('0x22')](_0x3d91db[_0x0a9e('0x4a')][_0x0a9e('0x22')]);_0x361b21[_0x0a9e('0x20')]=qs[_0x0a9e('0x20')](_0x3d91db[_0x0a9e('0x4a')][_0x0a9e('0x20')]);}_0x361b21['order']=qs[_0x0a9e('0x53')](_0x3d91db[_0x0a9e('0x4a')][_0x0a9e('0x53')]);_0x361b21[_0x0a9e('0x54')]=qs['filters'](_[_0x0a9e('0x6c')](_0x3d91db[_0x0a9e('0x4a')],_0x4abc8f['filters']));_0x361b21[_0x0a9e('0x54')]['ChatWebsiteId']=_0x40fc56['id'];if(_0x3d91db[_0x0a9e('0x4a')][_0x0a9e('0x56')]){_0x361b21[_0x0a9e('0x54')]=_[_0x0a9e('0x58')](_0x361b21['where'],{'$or':_['map'](_0x361b21[_0x0a9e('0x4d')],function(_0x2b9c01){var _0x94dcf5={};_0x94dcf5[_0x2b9c01]={'$like':'%'+_0x3d91db['query'][_0x0a9e('0x56')]+'%'};return _0x94dcf5;})});}_0x361b21=_[_0x0a9e('0x58')]({},_0x361b21,_0x3d91db['options']);return db['Disposition'][_0x0a9e('0x23')]({'where':_0x361b21['where']})['then'](function(_0x4dc6b3){_0x290d43[_0x0a9e('0x23')]=_0x4dc6b3;if(_0x3d91db[_0x0a9e('0x4a')][_0x0a9e('0x5a')]){_0x361b21[_0x0a9e('0x5e')]=[{'all':!![]}];}return db[_0x0a9e('0x69')][_0x0a9e('0x6d')](_0x361b21);})['then'](function(_0x5fd5db){_0x290d43['rows']=_0x5fd5db;return _0x290d43;});}})[_0x0a9e('0x28')](respondWithFilteredResult(_0x2d5506,_0x361b21))[_0x0a9e('0x5b')](handleError(_0x2d5506,null));};exports[_0x0a9e('0x6e')]=function(_0x4566b0,_0x50f8d7){return db[_0x0a9e('0x46')][_0x0a9e('0x63')]({'where':{'id':_0x4566b0[_0x0a9e('0x5c')]['id']}})['then'](handleEntityNotFound(_0x50f8d7,null))[_0x0a9e('0x28')](function(_0x21e592){if(_0x21e592){return _0x21e592[_0x0a9e('0x6e')](_0x4566b0[_0x0a9e('0x4a')][_0x0a9e('0x6f')]);}})[_0x0a9e('0x28')](respondWithStatusCode(_0x50f8d7,null))[_0x0a9e('0x5b')](handleError(_0x50f8d7,null));};exports[_0x0a9e('0x70')]=function(_0x509efe,_0x2645d6){if(_0x509efe[_0x0a9e('0x66')]['id']){delete _0x509efe['body']['id'];}return db[_0x0a9e('0x46')][_0x0a9e('0x63')]({'where':{'id':_0x509efe[_0x0a9e('0x5c')]['id']}})['then'](handleEntityNotFound(_0x2645d6,null))[_0x0a9e('0x28')](function(_0x52ec10){if(_0x52ec10){_0x509efe[_0x0a9e('0x66')][_0x0a9e('0x71')]=_0x52ec10['id'];return db[_0x0a9e('0x72')][_0x0a9e('0x5f')](_0x509efe[_0x0a9e('0x66')]);}})[_0x0a9e('0x28')](respondWithResult(_0x2645d6,null))[_0x0a9e('0x5b')](handleError(_0x2645d6,null));};exports[_0x0a9e('0x73')]=function(_0x501050,_0x329d88){var _0x31d25a={'raw':![],'where':{}};var _0x17f692={};var _0x30ef6e={'count':0x0,'rows':[]};return db[_0x0a9e('0x46')][_0x0a9e('0x6b')]({'where':{'id':_0x501050[_0x0a9e('0x5c')]['id']}})[_0x0a9e('0x28')](handleEntityNotFound(_0x329d88,null))[_0x0a9e('0x28')](function(_0x31af8c){if(_0x31af8c){_0x17f692[_0x0a9e('0x3f')]=_[_0x0a9e('0x4b')](db[_0x0a9e('0x72')]['rawAttributes']);_0x17f692[_0x0a9e('0x4a')]=_[_0x0a9e('0x4b')](_0x501050[_0x0a9e('0x4a')]);_0x17f692[_0x0a9e('0x55')]=_[_0x0a9e('0x4c')](_0x17f692['model'],_0x17f692[_0x0a9e('0x4a')]);_0x31d25a[_0x0a9e('0x4d')]=_['intersection'](_0x17f692[_0x0a9e('0x3f')],qs['fields'](_0x501050[_0x0a9e('0x4a')][_0x0a9e('0x4e')]));_0x31d25a[_0x0a9e('0x4d')]=_0x31d25a[_0x0a9e('0x4d')]['length']?_0x31d25a[_0x0a9e('0x4d')]:_0x17f692['model'];if(!_0x501050[_0x0a9e('0x4a')][_0x0a9e('0x50')]('nolimit')){_0x31d25a[_0x0a9e('0x22')]=qs[_0x0a9e('0x22')](_0x501050[_0x0a9e('0x4a')]['limit']);_0x31d25a['offset']=qs[_0x0a9e('0x20')](_0x501050[_0x0a9e('0x4a')][_0x0a9e('0x20')]);}_0x31d25a[_0x0a9e('0x52')]=qs[_0x0a9e('0x53')](_0x501050[_0x0a9e('0x4a')][_0x0a9e('0x53')]);_0x31d25a[_0x0a9e('0x54')]=qs[_0x0a9e('0x55')](_['pick'](_0x501050[_0x0a9e('0x4a')],_0x17f692['filters']));_0x31d25a[_0x0a9e('0x54')][_0x0a9e('0x71')]=_0x31af8c['id'];if(_0x501050[_0x0a9e('0x4a')][_0x0a9e('0x56')]){_0x31d25a[_0x0a9e('0x54')]=_['merge'](_0x31d25a[_0x0a9e('0x54')],{'$or':_[_0x0a9e('0x45')](_0x31d25a[_0x0a9e('0x4d')],function(_0x2aa5f2){var _0x2263f1={};_0x2263f1[_0x2aa5f2]={'$like':'%'+_0x501050['query']['filter']+'%'};return _0x2263f1;})});}_0x31d25a=_[_0x0a9e('0x58')]({},_0x31d25a,_0x501050['options']);return db[_0x0a9e('0x72')][_0x0a9e('0x23')]({'where':_0x31d25a[_0x0a9e('0x54')]})[_0x0a9e('0x28')](function(_0x2ad54b){_0x30ef6e[_0x0a9e('0x23')]=_0x2ad54b;if(_0x501050['query']['includeAll']){_0x31d25a[_0x0a9e('0x5e')]=[{'all':!![]}];}return db['CannedAnswer'][_0x0a9e('0x6d')](_0x31d25a);})['then'](function(_0x427ccc){_0x30ef6e['rows']=_0x427ccc;return _0x30ef6e;});}})['then'](respondWithFilteredResult(_0x329d88,_0x31d25a))[_0x0a9e('0x5b')](handleError(_0x329d88,null));};exports[_0x0a9e('0x74')]=function(_0x5e9b0b,_0x170af6){return db[_0x0a9e('0x46')][_0x0a9e('0x63')]({'where':{'id':_0x5e9b0b[_0x0a9e('0x5c')]['id']}})[_0x0a9e('0x28')](handleEntityNotFound(_0x170af6,null))['then'](function(_0x5505f4){if(_0x5505f4){return _0x5505f4[_0x0a9e('0x74')](_0x5e9b0b[_0x0a9e('0x4a')][_0x0a9e('0x6f')]);}})[_0x0a9e('0x28')](respondWithStatusCode(_0x170af6,null))[_0x0a9e('0x5b')](handleError(_0x170af6,null));};exports['addLogo']=function(_0x45b03c,_0xadce3d){_0x45b03c['body'][_0x0a9e('0x75')]=_0x45b03c[_0x0a9e('0x76')][_0x0a9e('0x77')];return db[_0x0a9e('0x46')][_0x0a9e('0x63')]({'where':{'id':_0x45b03c[_0x0a9e('0x5c')]['id']}})[_0x0a9e('0x28')](handleEntityNotFound(_0xadce3d,null))[_0x0a9e('0x28')](saveUpdates(_0x45b03c[_0x0a9e('0x66')],null))[_0x0a9e('0x28')](respondWithResult(_0xadce3d,null))['catch'](handleError(_0xadce3d,null));};exports[_0x0a9e('0x78')]=function(_0x301047,_0x2ada60){_0x301047[_0x0a9e('0x66')][_0x0a9e('0x79')]=_0x301047['file']['filename'];return db[_0x0a9e('0x46')][_0x0a9e('0x63')]({'where':{'id':_0x301047[_0x0a9e('0x5c')]['id']}})[_0x0a9e('0x28')](handleEntityNotFound(_0x2ada60,null))[_0x0a9e('0x28')](saveUpdates(_0x301047['body'],null))[_0x0a9e('0x28')](respondWithResult(_0x2ada60,null))[_0x0a9e('0x5b')](handleError(_0x2ada60,null));};exports[_0x0a9e('0x7a')]=function(_0x52b661,_0x318fc3){_0x52b661['body'][_0x0a9e('0x7b')]=_0x52b661['file'][_0x0a9e('0x77')];return db[_0x0a9e('0x46')][_0x0a9e('0x63')]({'where':{'id':_0x52b661['params']['id']}})[_0x0a9e('0x28')](handleEntityNotFound(_0x318fc3,null))['then'](saveUpdates(_0x52b661[_0x0a9e('0x66')],null))[_0x0a9e('0x28')](respondWithResult(_0x318fc3,null))[_0x0a9e('0x5b')](handleError(_0x318fc3,null));};exports[_0x0a9e('0x7c')]=function(_0x3a5836,_0x1bee04){_0x3a5836[_0x0a9e('0x66')][_0x0a9e('0x7d')]=_0x3a5836[_0x0a9e('0x76')][_0x0a9e('0x77')];return db[_0x0a9e('0x46')][_0x0a9e('0x63')]({'where':{'id':_0x3a5836[_0x0a9e('0x5c')]['id']}})[_0x0a9e('0x28')](handleEntityNotFound(_0x1bee04,null))[_0x0a9e('0x28')](saveUpdates(_0x3a5836[_0x0a9e('0x66')],null))['then'](respondWithResult(_0x1bee04,null))['catch'](handleError(_0x1bee04,null));};exports[_0x0a9e('0x7e')]=function(_0x5c4be0,_0x1d999b){var _0x3428c9=path['join'](config[_0x0a9e('0x7f')],_0x0a9e('0x80'));var _0x387bbe={'where':{'id':_0x5c4be0[_0x0a9e('0x5c')]['id']},'attributes':['id','sitepic'],'raw':!![]};var _0x148fd9=![];return require(_0x0a9e('0x81'))[_0x0a9e('0x82')]()[_0x0a9e('0x28')](function(_0x5d0e1f){if(_0x5d0e1f){_0x148fd9=_0x5d0e1f[_0x0a9e('0x83')];}})[_0x0a9e('0x28')](function(){return db[_0x0a9e('0x46')]['find'](_0x387bbe);})[_0x0a9e('0x28')](handleEntityNotFound(_0x1d999b,null))[_0x0a9e('0x28')](function(_0x17b29d){if(_0x17b29d){if(!_['isNil'](_0x17b29d[_0x0a9e('0x75')])){if(fs[_0x0a9e('0x84')](path[_0x0a9e('0x85')](config[_0x0a9e('0x7f')],_0x0a9e('0x86'),_0x17b29d['sitepic']))&&_0x148fd9){_0x3428c9=path[_0x0a9e('0x85')](config[_0x0a9e('0x7f')],'server/files/images/logos/',_0x17b29d[_0x0a9e('0x75')]);}}return _0x1d999b[_0x0a9e('0x87')](_0x3428c9);}})[_0x0a9e('0x5b')](handleError(_0x1d999b,null));};exports['getAvatar']=function(_0x5c3b6f,_0x523d08){var _0x1015aa=path[_0x0a9e('0x85')](config['root'],_0x0a9e('0x88'));var _0x1f78b4={'where':{'id':_0x5c3b6f[_0x0a9e('0x5c')]['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db[_0x0a9e('0x46')][_0x0a9e('0x63')](_0x1f78b4)[_0x0a9e('0x28')](handleEntityNotFound(_0x523d08,null))[_0x0a9e('0x28')](function(_0x46956b){if(_0x46956b){if(!_[_0x0a9e('0x89')](_0x46956b[_0x0a9e('0x79')])){if(fs[_0x0a9e('0x84')](path[_0x0a9e('0x85')](config['root'],_0x0a9e('0x8a'),_0x46956b['agentAvatar']))){_0x1015aa=path[_0x0a9e('0x85')](config[_0x0a9e('0x7f')],_0x0a9e('0x8a'),_0x46956b[_0x0a9e('0x79')]);}}return _0x523d08[_0x0a9e('0x87')](_0x1015aa);}})[_0x0a9e('0x5b')](handleError(_0x523d08,null));};exports['getCustomerAvatar']=function(_0x1a0314,_0x33da81){var _0xe25eb5=path[_0x0a9e('0x85')](config['root'],_0x0a9e('0x8b'));var _0x3c9135={'where':{'id':_0x1a0314[_0x0a9e('0x5c')]['id']},'attributes':['id',_0x0a9e('0x7b'),_0x0a9e('0x8c')],'raw':!![]};return db[_0x0a9e('0x46')][_0x0a9e('0x63')](_0x3c9135)[_0x0a9e('0x28')](handleEntityNotFound(_0x33da81,null))[_0x0a9e('0x28')](function(_0x3539b7){if(_0x3539b7){if(!_['isNil'](_0x3539b7[_0x0a9e('0x7b')])){if(fs[_0x0a9e('0x84')](path[_0x0a9e('0x85')](config[_0x0a9e('0x7f')],_0x0a9e('0x8a'),_0x3539b7[_0x0a9e('0x7b')]))&&_0x3539b7[_0x0a9e('0x8c')]){_0xe25eb5=path[_0x0a9e('0x85')](config['root'],_0x0a9e('0x8a'),_0x3539b7[_0x0a9e('0x7b')]);}}return _0x33da81[_0x0a9e('0x87')](_0xe25eb5);}})['catch'](handleError(_0x33da81,null));};exports[_0x0a9e('0x8d')]=function(_0x41e446,_0xb0af1e){var _0x97d5b5=path[_0x0a9e('0x85')](config[_0x0a9e('0x7f')],_0x0a9e('0x8e'));var _0x336a19={'where':{'id':_0x41e446[_0x0a9e('0x5c')]['id']},'attributes':['id',_0x0a9e('0x7d')],'raw':!![]};return db['ChatWebsite'][_0x0a9e('0x63')](_0x336a19)[_0x0a9e('0x28')](handleEntityNotFound(_0xb0af1e,null))[_0x0a9e('0x28')](function(_0x3db98f){if(_0x3db98f){if(!_[_0x0a9e('0x89')](_0x3db98f[_0x0a9e('0x7d')])){if(fs['existsSync'](path[_0x0a9e('0x85')](config['root'],'server/files/images/avatars/',_0x3db98f['systemAvatar']))){_0x97d5b5=path[_0x0a9e('0x85')](config[_0x0a9e('0x7f')],_0x0a9e('0x8a'),_0x3db98f[_0x0a9e('0x7d')]);}}return _0xb0af1e['download'](_0x97d5b5);}})[_0x0a9e('0x5b')](handleError(_0xb0af1e,null));};exports[_0x0a9e('0x8f')]=function(_0x3ddbc7,_0x1fdb10){var _0x2c8d1d={'body':_0x3ddbc7['body'],'channel':'chat'};var _0x9484c8=[];var _0x33bcb2=[];var _0x2a293f={};var _0x5e85d0=![];if(_0x3ddbc7[_0x0a9e('0x66')]['id']){delete _0x3ddbc7[_0x0a9e('0x66')]['id'];}if(_[_0x0a9e('0x89')](_0x3ddbc7['body'][_0x0a9e('0x90')])){throw new APIBadRequestError(_0x0a9e('0x91'));}if(_[_0x0a9e('0x89')](_0x3ddbc7['body'][_0x0a9e('0x92')])){throw new APIBadRequestError(_0x0a9e('0x93'));}if(_[_0x0a9e('0x94')](_0x3ddbc7['body']['body'])){throw new APIBadRequestError('Body\x20is\x20mandatory');}return db[_0x0a9e('0x95')][_0x0a9e('0x67')]()[_0x0a9e('0x28')](function(_0x26931c){if(!_0x26931c){throw new Error('No\x20available\x20attributes');}_0x9484c8=Object[_0x0a9e('0x4b')](_0x26931c)['filter'](function(_0x3b4af9){return![_0x0a9e('0x96'),_0x0a9e('0x97')]['includes'](_0x3b4af9);});_0x33bcb2=Object[_0x0a9e('0x4b')](_0x26931c)[_0x0a9e('0x56')](function(_0xb8a476){return!['createdAt',_0x0a9e('0x97'),'CompanyId',_0x0a9e('0x98')]['includes'](_0xb8a476);});if(!_[_0x0a9e('0x99')](_0x33bcb2,_0x3ddbc7['body'][_0x0a9e('0x92')])){throw new APIBadRequestError(_0x0a9e('0x9a')+_0x33bcb2[_0x0a9e('0x85')](',\x20'));}_0x2a293f[_0x3ddbc7[_0x0a9e('0x66')][_0x0a9e('0x92')]]=_0x3ddbc7[_0x0a9e('0x66')][_0x0a9e('0x90')];})['then'](function(){return db[_0x0a9e('0x46')][_0x0a9e('0x63')]({'where':{'id':_0x3ddbc7['params']['id']},'include':[{'model':db[_0x0a9e('0x9b')],'as':_0x0a9e('0x9c'),'include':[{'model':db['CmContact'],'as':_0x0a9e('0x9d'),'where':_0x2a293f,'limit':0x1,'order':[[_0x0a9e('0x97'),_0x0a9e('0x9e')]]}]},{'model':db['ChatApplication'],'as':_0x0a9e('0x9f')},{'model':db[_0x0a9e('0xa0')],'as':_0x0a9e('0xa0'),'include':[{'model':db[_0x0a9e('0xa0')],'as':_0x0a9e('0xa1'),'attributes':['id',_0x0a9e('0xa2')],'raw':!![]}]}]});})[_0x0a9e('0x28')](function(_0x74d9b8){if(!_0x74d9b8){throw new APINotFoundError(util[_0x0a9e('0x3b')](_0x0a9e('0xa3'),_0x3ddbc7['params']['id']));}var _0x1799d8=_0x74d9b8['Interval'];if(_0x1799d8){var _0x3c9854=_0x74d9b8[_0x0a9e('0xa4')]||undefined;return _0x1799d8[_0x0a9e('0xa5')](_0x3c9854)[_0x0a9e('0x28')](function(_0x5d577b){if(!_0x5d577b){throw new APIOutOfIntervalError();}return _0x74d9b8;});}else{return _0x74d9b8;}})[_0x0a9e('0x28')](function(_0x5691ac){if(!_0x5691ac[_0x0a9e('0x9c')]){return;}_0x2c8d1d[_0x0a9e('0xa6')]=_0x5691ac;_0x2c8d1d[_0x0a9e('0xa7')]=_0x5691ac['List'];_0x2c8d1d[_0x0a9e('0xa8')]=_[_0x0a9e('0xa9')](_0x5691ac[_0x0a9e('0x9f')],[_0x0a9e('0xaa')],[_0x0a9e('0xab')]);if(_0x2c8d1d[_0x0a9e('0xa6')][_0x0a9e('0x9f')]){delete _0x2c8d1d['account'][_0x0a9e('0x9f')];}if(_0x2c8d1d[_0x0a9e('0xa6')][_0x0a9e('0x9c')]&&_0x2c8d1d[_0x0a9e('0xa6')][_0x0a9e('0x9c')][_0x0a9e('0x9d')][_0x0a9e('0x4f')]){return _0x2c8d1d['account']['List'][_0x0a9e('0x9d')][0x0];}var _0x3f507c=_[_0x0a9e('0x10')](_0x3ddbc7[_0x0a9e('0x66')],{'firstName':_0x3ddbc7[_0x0a9e('0x66')][_0x0a9e('0x90')],'ListId':_0x5691ac[_0x0a9e('0x98')]});_0x3f507c[_0x3ddbc7['body'][_0x0a9e('0x92')]]=_0x3ddbc7[_0x0a9e('0x66')][_0x0a9e('0x90')];return db[_0x0a9e('0x95')][_0x0a9e('0x5f')](_0x3f507c,{'fields':_0x9484c8,'raw':!![]});})[_0x0a9e('0x28')](function(_0x16be7e){_0x2c8d1d['contact']=_0x16be7e;var _0x311288=createInteractionObject(_0x3ddbc7[_0x0a9e('0x5c')]['id'],_0x3ddbc7[_0x0a9e('0x66')],_0x3ddbc7['headers'],_0x16be7e);var _0x2b8ad4={'ChatWebsiteId':_0x3ddbc7[_0x0a9e('0x5c')]['id'],'closed':![]};if(_0x3ddbc7[_0x0a9e('0x66')][_0x0a9e('0xac')]){_0x2b8ad4['threadId']=_0x3ddbc7[_0x0a9e('0x66')][_0x0a9e('0xac')];return db[_0x0a9e('0xad')][_0x0a9e('0x63')]({'where':_0x2b8ad4})[_0x0a9e('0x28')](function(_0x20c130){if(_0x20c130){_0x5e85d0=!![];return _0x20c130;}_0x311288[_0x0a9e('0xac')]=_0x3ddbc7[_0x0a9e('0x66')]['threadId'];_0x311288[_0x0a9e('0xae')]=_0x3ddbc7[_0x0a9e('0x66')][_0x0a9e('0xae')];return db[_0x0a9e('0xad')]['create'](_0x311288);});}_0x2b8ad4['ContactId']=_0x16be7e['id'];if(_0x3ddbc7[_0x0a9e('0x66')][_0x0a9e('0xaf')]&&_0x3ddbc7[_0x0a9e('0x66')]['interaction']['id']){_0x2b8ad4['id']=_0x3ddbc7[_0x0a9e('0x66')][_0x0a9e('0xaf')]['id'];return db['ChatInteraction'][_0x0a9e('0x63')]({'where':_0x2b8ad4})['then'](function(_0x35cc2a){if(_0x35cc2a){_0x5e85d0=!![];return _0x35cc2a;}return db['ChatInteraction']['create'](_0x311288);});}return db['ChatInteraction'][_0x0a9e('0x5f')](_0x311288);})[_0x0a9e('0x28')](function(_0x19f800){if(!_0x5e85d0){return _0x19f800;}var _0x20007e={'from':(_0x2c8d1d[_0x0a9e('0xb0')][_0x0a9e('0x36')]||'')+'\x20'+(_0x2c8d1d['contact'][_0x0a9e('0xb1')]||'')};if(_0x3ddbc7[_0x0a9e('0x66')][_0x0a9e('0xac')]&&_0x3ddbc7[_0x0a9e('0x66')][_0x0a9e('0xb2')]&&_0x3ddbc7[_0x0a9e('0x66')][_0x0a9e('0xac')]!=_0x3ddbc7['body']['messageId']){_0x20007e[_0x0a9e('0xac')]=_0x3ddbc7['body'][_0x0a9e('0xb2')];}return _0x19f800[_0x0a9e('0x27')](_0x20007e);})[_0x0a9e('0x28')](function(_0xa3695f){_0x2c8d1d[_0x0a9e('0xaf')]=_0xa3695f[_0x0a9e('0x2a')]({'plain':!![]});_0x2c8d1d['interaction'][_0x0a9e('0xb3')]=!_0x5e85d0;if(_0x2c8d1d['interaction']['created']){if(_0x2c8d1d[_0x0a9e('0xa6')]['autoclose']){_0x2c8d1d[_0x0a9e('0xa8')]['push']({'id':0x0,'priority':_0x2c8d1d['applications'][_0x0a9e('0x4f')]+0x1,'app':'close','appdata':_0x0a9e('0xb4'),'interval':_0x0a9e('0xb5')});}}return db[_0x0a9e('0xb6')]['create']({'body':_0x3ddbc7[_0x0a9e('0x66')][_0x0a9e('0x66')],'ChatWebsiteId':_0x3ddbc7[_0x0a9e('0x5c')]['id'],'ChatInteractionId':_0xa3695f['id'],'direction':'in','ContactId':_0x2c8d1d['contact']['id'],'AttachmentId':_0x3ddbc7['body'][_0x0a9e('0xb7')]});})[_0x0a9e('0x28')](function(_0x89d2cb){_0x2c8d1d[_0x0a9e('0x1c')]=_0x89d2cb;if(!_0x2c8d1d[_0x0a9e('0xaf')][_0x0a9e('0xb8')]){return;}return db[_0x0a9e('0xb9')][_0x0a9e('0x63')]({'attributes':['id',_0x0a9e('0x2f')],'where':{'id':_0x2c8d1d[_0x0a9e('0xaf')]['UserId']}});})['then'](function(_0x558171){if(_0x558171){_0x2c8d1d[_0x0a9e('0xa8')][_0x0a9e('0xba')]({'id':0x0,'priority':0x0,'app':_0x0a9e('0xbb'),'appdata':_0x558171[_0x0a9e('0x2f')]+','+(_0x2c8d1d[_0x0a9e('0xa6')][_0x0a9e('0xbc')]||0xa),'interval':_0x0a9e('0xb5')});_0x2c8d1d[_0x0a9e('0xbd')]=!![];}if(!_0x2c8d1d['interaction']['queueId']){return;}return db[_0x0a9e('0xbe')][_0x0a9e('0x63')]({'attributes':['id','name'],'where':{'id':_0x2c8d1d[_0x0a9e('0xaf')][_0x0a9e('0xbf')]}});})[_0x0a9e('0x28')](function(_0x19e024){if(_0x19e024){_0x2c8d1d[_0x0a9e('0xa8')][_0x0a9e('0xba')]({'id':0x0,'priority':0x1,'app':_0x0a9e('0xc0'),'appdata':_0x19e024[_0x0a9e('0x2f')]+','+(_0x2c8d1d[_0x0a9e('0xa6')][_0x0a9e('0xc1')]||0x12c),'interval':_0x0a9e('0xb5')});}return respondWithRpcPromise(_0x0a9e('0xc2'),'startRouting',_0x2c8d1d);})[_0x0a9e('0x28')](function(_0x261ef8){respondWithRpcPromise(_0x0a9e('0xc3'),_0x0a9e('0xc3'),{'event':_0x0a9e('0x8f'),'message':_0x261ef8},client9002);return _0x261ef8;})[_0x0a9e('0x28')](respondWithResult(_0x1fdb10,null))[_0x0a9e('0x5b')](APIHandleError(_0x1fdb10));};exports[_0x0a9e('0xc4')]=function(_0x3a9c0f,_0x3f1959){var _0x6b048e,_0x3ba472,_0x4e6eb9;var _0x572a72=[];var _0x3e5182={};var _0x401207=_0x3a9c0f[_0x0a9e('0xc5')]||[];var _0x1ee9d3=[];var _0x33359a;return db[_0x0a9e('0x95')][_0x0a9e('0x67')]()['then'](function(_0x26a204){if(!_0x26a204){throw new db['Sequelize'][(_0x0a9e('0xc6'))](_0x0a9e('0xc7'));}_0x572a72=_[_0x0a9e('0xc8')](_[_0x0a9e('0x4b')](_0x26a204),[_0x0a9e('0x96'),_0x0a9e('0x97'),_0x0a9e('0xc9'),_0x0a9e('0x98')]);if(_0x3a9c0f[_0x0a9e('0x66')]['id']){delete _0x3a9c0f[_0x0a9e('0x66')]['id'];}if(_[_0x0a9e('0x89')](_0x3a9c0f[_0x0a9e('0x66')][_0x0a9e('0x90')])){throw _0x3f1959[_0x0a9e('0x1f')](0x1f4)[_0x0a9e('0xca')](new db[(_0x0a9e('0xcb'))]['ValidationError']('from\x20is\x20mandatory'));}if(_[_0x0a9e('0x89')](_0x3a9c0f[_0x0a9e('0x66')]['body'])||_0x3a9c0f['body'][_0x0a9e('0x66')]===''){throw _0x3f1959[_0x0a9e('0x1f')](0x1f4)[_0x0a9e('0xca')](new db['Sequelize'][(_0x0a9e('0xc6'))]('body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x0a9e('0x89')](_0x3a9c0f['body'][_0x0a9e('0xcc')])){throw _0x3f1959['status'](0x1f4)[_0x0a9e('0xca')](new db[(_0x0a9e('0xcb'))][(_0x0a9e('0xc6'))]('mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x572a72));}if(!_[_0x0a9e('0x99')](_0x572a72,_0x3a9c0f['body']['mapKeyOffline'])){throw _0x3f1959[_0x0a9e('0x1f')](0x1f4)[_0x0a9e('0xca')](new db[(_0x0a9e('0xcb'))][(_0x0a9e('0xc6'))](_0x0a9e('0xcd')+_0x572a72));}_0x3e5182[_0x3a9c0f[_0x0a9e('0x66')][_0x0a9e('0xcc')]]=_0x3a9c0f[_0x0a9e('0x66')][_0x0a9e('0x90')];})[_0x0a9e('0x28')](function(){return db[_0x0a9e('0x46')][_0x0a9e('0x63')]({'where':{'id':_0x3a9c0f[_0x0a9e('0x5c')]['id']},'include':[{'model':db[_0x0a9e('0x9b')],'as':_0x0a9e('0x9c')},{'model':db[_0x0a9e('0xce')],'as':_0x0a9e('0xce')}]});})[_0x0a9e('0x28')](handleEntityNotFound(_0x3f1959,null))[_0x0a9e('0x28')](function(_0x51a987){if(_0x51a987&&_0x51a987[_0x0a9e('0x9c')]){_0x3ba472=_0x51a987;var _0xf780f5=_[_0x0a9e('0x10')](_0x3a9c0f[_0x0a9e('0x66')],{'firstName':_0x3a9c0f['body']['from'],'phone':_0x3a9c0f['body'][_0x0a9e('0x90')],'ListId':_0x51a987['ListId']});_0xf780f5[_0x3a9c0f[_0x0a9e('0x66')][_0x0a9e('0xcc')]]=_0x3a9c0f[_0x0a9e('0x66')][_0x0a9e('0x90')];return db[_0x0a9e('0x95')][_0x0a9e('0xcf')]({'where':_0x3e5182,'defaults':_0xf780f5});}})[_0x0a9e('0xd0')](function(_0x1cc73e){if(_0x1cc73e){_0x4e6eb9=_0x1cc73e;var _0x2154d8=fs[_0x0a9e('0xd1')](path['join'](config[_0x0a9e('0x7f')],'server/files/templates/chatOfflineMessage.ejs'),_0x0a9e('0xd2'));var _0x586d2f=ejs[_0x0a9e('0xd3')](_0x2154d8,{'body':_[_0x0a9e('0xd4')](_0x3a9c0f[_0x0a9e('0x66')]['body']),'bodyTitle':_0x3ba472[_0x0a9e('0xd5')]});return db[_0x0a9e('0xd6')]['create']({'body':_0x586d2f,'plainBody':htmlToText['fromString'](_0x586d2f),'ContactId':_0x1cc73e['id'],'ChatWebsiteId':_0x3ba472['id']});}})[_0x0a9e('0x28')](function(_0x41e19e){_0x33359a=_0x41e19e;if(_0x401207[_0x0a9e('0x4f')]){var _0x5e2939=_0x401207['map'](function(_0x4869c1){return{'name':_0x4869c1[_0x0a9e('0xd7')],'basename':_0x4869c1[_0x0a9e('0x77')],'type':_0x4869c1[_0x0a9e('0xd8')],'ChatOfflineMessageId':_0x41e19e['id']};});_0x1ee9d3=_0x5e2939[_0x0a9e('0x45')](_0x3d4349=>{var _0x23e6b5={'filename':_0x3d4349[_0x0a9e('0x2f')],'path':path[_0x0a9e('0x85')](config[_0x0a9e('0x7f')],_0x0a9e('0xd9'),_0x0a9e('0xc5'),_0x0a9e('0xda'),_0x0a9e('0xdb'),_0x3d4349[_0x0a9e('0xdc')])};return _0x23e6b5;});if(!_0x3ba472[_0x0a9e('0xdd')]){return db[_0x0a9e('0xde')][_0x0a9e('0xdf')](function(_0x320367){return db['Attachment'][_0x0a9e('0xe0')](_0x5e2939,{'transaction':_0x320367});});}}})[_0x0a9e('0x28')](function(){if(_0x33359a){_0x6b048e=_0x33359a;return db[_0x0a9e('0xce')][_0x0a9e('0x6b')]({'where':{'service':!![]},'include':[{'model':db[_0x0a9e('0xe1')],'as':_0x0a9e('0xe2'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x0a9e('0xe3'),'raw':!![]}]}]});}})[_0x0a9e('0x28')](function(_0x3a14d7){if(_0x3a14d7&&_0x3a14d7[_0x0a9e('0xe2')]&&_0x3ba472[_0x0a9e('0xe4')]&&_0x3ba472[_0x0a9e('0xe5')]){var _0x103ad9=_0x3a14d7[_0x0a9e('0xe6')]();return respondWithRpcPromise(_0x0a9e('0xe7'),'sendMail',{'account':_0x103ad9,'message':{'from':util['format'](_0x0a9e('0xe8'),_0x3a14d7[_0x0a9e('0x2f')],_0x3a14d7['email']||_0x3a14d7[_0x0a9e('0xe2')][_0x0a9e('0x60')]),'to':_0x3ba472['forwardOfflineAddress'],'subject':_0x3ba472[_0x0a9e('0xe9')],'html':_0x6b048e['body'],'attachments':_0x1ee9d3}},client9003)[_0x0a9e('0x28')](function(){return _0x6b048e;})[_0x0a9e('0x5b')](function(_0x58c53c){logger[_0x0a9e('0x19')](_0x58c53c);});}})[_0x0a9e('0x28')](function(){if(_0x3ba472&&_0x3ba472['openNewInteraction']&&_0x3ba472[_0x0a9e('0xea')]){var _0x44e01f=[];if(_0x401207['length']){_0x44e01f=_0x401207[_0x0a9e('0x45')](function(_0x237994){return{'name':_0x237994[_0x0a9e('0xd7')],'basename':_0x237994[_0x0a9e('0x77')],'type':_0x237994[_0x0a9e('0xd8')],'ChatOfflineMessageId':_0x33359a['id']};});}var _0x17a0d5;if(!_['isNil'](_0x3ba472[_0x0a9e('0xeb')])){var _0x36dc4f=_['map'](_0x3a9c0f[_0x0a9e('0x66')],function(_0x2bbb3f){return _0x2bbb3f;});var _0x22c390=_[_0x0a9e('0xec')](_0x36dc4f)[0x0];var _0x3fae71=_[_0x0a9e('0xed')](_0x22c390,function(_0x368a12){return _0x368a12;});_0x17a0d5=_0x3fae71[0x1][_0x3ba472['subjectOffline']];}var _0x49e1b8={'from':_0x4e6eb9['email'],'firstName':_0x4e6eb9['firstName'],'lastName':_0x4e6eb9['lastName'],'mapKey':_0x0a9e('0xee'),'message':{'from':_0x4e6eb9[_0x0a9e('0xee')],'to':_0x3ba472['MailAccount']['email'],'cc':'','subject':_[_0x0a9e('0x89')](_0x17a0d5)?_0x3ba472['offlineMessageSubject']:_0x17a0d5,'messageId':'','sentAt':new Date(),'attach':_0x44e01f[_0x0a9e('0x4f')],'attachments':_0x44e01f,'originChannel':_0x0a9e('0xef'),'ChatWebsiteId':_0x3ba472['id'],'ChatOfflineMessageId':_0x6b048e['id'],'originTo':_0x3ba472[_0x0a9e('0xce')][_0x0a9e('0xee')]},'body':_0x6b048e[_0x0a9e('0x66')]};var _0x14a683={'account':{'id':_0x3ba472['MailAccountId']},'body':_0x49e1b8,'log':_0x0a9e('0xf0')};return respondWithRpcPromise(_0x0a9e('0xf0'),'notifyMail',_0x14a683,client9001)[_0x0a9e('0x28')](function(){return _0x6b048e;})[_0x0a9e('0x5b')](function(_0x2e0e9b){logger[_0x0a9e('0x19')](_0x2e0e9b);});}return;})[_0x0a9e('0x28')](function(){if(_0x6b048e){return _0x6b048e;}})[_0x0a9e('0x28')](respondWithResult(_0x3f1959,null))[_0x0a9e('0x5b')](function(){for(var _0x4a36df of _0x401207){var _0x331216=path['join'](config[_0x0a9e('0x7f')],_0x0a9e('0xd9'),'files',_0x0a9e('0xda'),_0x0a9e('0xdb'),_0x4a36df['filename']);fs_extra[_0x0a9e('0xf1')](_0x331216)['catch'](function(_0x4552b5){logger[_0x0a9e('0x19')]('Could\x20not\x20remove\x20attachment\x20file',_0x331216,_0x4552b5);});}});};exports[_0x0a9e('0xf2')]=function(_0x4a9682,_0x1d046c){return db[_0x0a9e('0xad')][_0x0a9e('0x63')]({'where':{'id':_0x4a9682[_0x0a9e('0x5c')]['id']}})[_0x0a9e('0x28')](handleEntityNotFound(_0x1d046c,null))[_0x0a9e('0x28')](function(_0xa45906){if(_0xa45906){return _0xa45906['addInteraction'](_0x4a9682[_0x0a9e('0x66')][_0x0a9e('0x6f')],_[_0x0a9e('0xf3')](_0x4a9682[_0x0a9e('0x66')],[_0x0a9e('0x6f'),'id'])||{});}})['then'](respondWithResult(_0x1d046c,null))[_0x0a9e('0x5b')](handleError(_0x1d046c,null));};exports['getInteractions']=function(_0x5d1159,_0x3a459c){var _0x58efc5={'raw':![],'where':{}};var _0x43cb0={};var _0x255ed6={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x0a9e('0x6b')]({'where':{'id':_0x5d1159[_0x0a9e('0x5c')]['id']}})[_0x0a9e('0x28')](handleEntityNotFound(_0x3a459c,null))[_0x0a9e('0x28')](function(_0x2e1adc){if(_0x2e1adc){_0x43cb0[_0x0a9e('0x3f')]=_[_0x0a9e('0x4b')](db[_0x0a9e('0xad')][_0x0a9e('0x47')]);_0x43cb0['query']=_[_0x0a9e('0x4b')](_0x5d1159[_0x0a9e('0x4a')]);_0x43cb0[_0x0a9e('0x55')]=_[_0x0a9e('0x4c')](_0x43cb0['model'],_0x43cb0[_0x0a9e('0x4a')]);_0x58efc5[_0x0a9e('0x4d')]=_[_0x0a9e('0x4c')](_0x43cb0['model'],qs[_0x0a9e('0x4e')](_0x5d1159[_0x0a9e('0x4a')][_0x0a9e('0x4e')]));_0x58efc5['attributes']=_0x58efc5[_0x0a9e('0x4d')]['length']?_0x58efc5[_0x0a9e('0x4d')]:_0x43cb0[_0x0a9e('0x3f')];if(!_0x5d1159[_0x0a9e('0x4a')][_0x0a9e('0x50')](_0x0a9e('0x51'))){_0x58efc5[_0x0a9e('0x22')]=qs[_0x0a9e('0x22')](_0x5d1159['query'][_0x0a9e('0x22')]);_0x58efc5[_0x0a9e('0x20')]=qs[_0x0a9e('0x20')](_0x5d1159[_0x0a9e('0x4a')][_0x0a9e('0x20')]);}_0x58efc5[_0x0a9e('0x52')]=qs[_0x0a9e('0x53')](_0x5d1159[_0x0a9e('0x4a')][_0x0a9e('0x53')]);_0x58efc5[_0x0a9e('0x54')]=qs[_0x0a9e('0x55')](_[_0x0a9e('0x6c')](_0x5d1159[_0x0a9e('0x4a')],_0x43cb0[_0x0a9e('0x55')]));_0x58efc5[_0x0a9e('0x54')][_0x0a9e('0x71')]=_0x2e1adc['id'];if(_0x5d1159[_0x0a9e('0x4a')][_0x0a9e('0x56')]){_0x58efc5[_0x0a9e('0x54')]=_[_0x0a9e('0x58')](_0x58efc5[_0x0a9e('0x54')],{'$or':_[_0x0a9e('0x45')](_0x58efc5[_0x0a9e('0x4d')],function(_0x58ebb0){var _0x86cb95={};_0x86cb95[_0x58ebb0]={'$like':'%'+_0x5d1159[_0x0a9e('0x4a')][_0x0a9e('0x56')]+'%'};return _0x86cb95;})});}_0x58efc5=_['merge']({},_0x58efc5,_0x5d1159[_0x0a9e('0x59')]);return db['ChatInteraction'][_0x0a9e('0x23')]({'where':_0x58efc5[_0x0a9e('0x54')]})[_0x0a9e('0x28')](function(_0x39c4da){_0x255ed6[_0x0a9e('0x23')]=_0x39c4da;if(_0x5d1159[_0x0a9e('0x4a')][_0x0a9e('0x5a')]){_0x58efc5[_0x0a9e('0x5e')]=[{'model':db['CmContact'],'as':_0x0a9e('0xf4'),'required':![]},{'model':db[_0x0a9e('0xb9')],'as':'Owner','attributes':[_0x0a9e('0x2f'),_0x0a9e('0xf5'),_0x0a9e('0xf6')],'required':![]},{'model':db['Tag'],'as':_0x0a9e('0xf7'),'attributes':['id',_0x0a9e('0x2f'),_0x0a9e('0xf8')],'where':_0x5d1159[_0x0a9e('0x4a')]['tag']?{'id':_0x5d1159[_0x0a9e('0x4a')][_0x0a9e('0xf9')]}:undefined,'required':_0x5d1159[_0x0a9e('0x4a')][_0x0a9e('0xf9')]?!![]:![]}];}return db[_0x0a9e('0xad')]['findAll'](_0x58efc5);})[_0x0a9e('0x28')](function(_0x3fc431){_0x255ed6['rows']=_0x3fc431;return _0x255ed6;});}})[_0x0a9e('0x28')](respondWithFilteredResult(_0x3a459c,_0x58efc5))[_0x0a9e('0x5b')](handleError(_0x3a459c,null));};exports[_0x0a9e('0xfa')]=function(_0x54246a,_0x557ef8){var _0x45ef37=0x0;var _0x36d905=0x0;var _0x271485=![];var _0x283bbb;var _0x23a073;return db[_0x0a9e('0x46')][_0x0a9e('0x63')]({'where':{'id':_0x54246a[_0x0a9e('0x5c')]['id']},'include':[{'model':db['Interval'],'as':'Interval','include':[{'model':db[_0x0a9e('0xa0')],'as':'Intervals','attributes':['id',_0x0a9e('0xa2')]}]}]})[_0x0a9e('0x28')](handleEntityNotFound(_0x557ef8,null))[_0x0a9e('0x28')](function(_0x413f0f){if(_0x413f0f){_0x283bbb=_0x413f0f;return _0x413f0f['getProactiveActions']({'raw':!![]});}})[_0x0a9e('0x28')](function(_0x43c1d1){if(_0x283bbb){if(_0x43c1d1){_0x23a073=_0x43c1d1;}}return require('../../config/license/util')[_0x0a9e('0x82')]();})['then'](function(_0x2e1de7){if(_0x2e1de7){_0x36d905=_0x2e1de7[_0x0a9e('0xfb')];_0x271485=_0x2e1de7[_0x0a9e('0x83')];}})[_0x0a9e('0x28')](function(){return db[_0x0a9e('0xad')][_0x0a9e('0x23')]({'where':{'closed':![]}});})['then'](function(_0x16d50b){_0x45ef37=_0x16d50b;if(_0x36d905&&_0x16d50b>_0x36d905){return db['License'][_0x0a9e('0x6b')]({'where':{'id':0x1}})[_0x0a9e('0x28')](function(_0x4229e6){if(_0x4229e6){_0x4229e6[_0x0a9e('0xfc')](_0x0a9e('0xfd'));}});}})[_0x0a9e('0x28')](function(){var _0x2d7d76=_0x283bbb['Interval'];var _0x37d9b9=_0x283bbb[_0x0a9e('0xa4')]||undefined;return _0x2d7d76[_0x0a9e('0xa5')](_0x37d9b9);})[_0x0a9e('0x28')](function(_0x132d6d){var _0x534f61=fs[_0x0a9e('0xd1')](path[_0x0a9e('0x85')](config['root'],'server/files/chat/iframe.ejs'),_0x0a9e('0xd2'));var _0x11b33b=new url[(_0x0a9e('0xfe'))](_0x283bbb[_0x0a9e('0xff')])[_0x0a9e('0x100')];var _0x1f1f36='3.7.0';var _0x1e31c2=![];var _0x13782b={'chatVersion':_0x1f1f36,'chatWebsiteAddressOrigin':_0x11b33b,'remote':_0x283bbb[_0x0a9e('0x101')],'query':querystring['stringify'](_[_0x0a9e('0x58')](_0x283bbb[_0x0a9e('0x2a')]({'plain':!![]}),{'customerIp':_0x54246a[_0x0a9e('0x102')][_0x0a9e('0x34')]||_0x54246a['headers']['x-real-ip']||_0x54246a[_0x0a9e('0x103')][_0x0a9e('0x104')]||_0x54246a['ip'],'referer':_0x54246a[_0x0a9e('0x102')][_0x0a9e('0x38')],'openedInteractions':_0x45ef37,'maxInteractions':_0x36d905,'virtual':_0x271485[_0x0a9e('0xfb')],'online':_0x132d6d,'custom':_0x271485}))[_0x0a9e('0x105')](/'/g,'\x5c\x27')};_0x557ef8[_0x0a9e('0xca')](ejs[_0x0a9e('0xd3')](Mustache['render'](_0x534f61,_0x13782b),{'proactiveActions':_0x23a073,'alignment':_0x283bbb[_0x0a9e('0x106')],'verticalAlignment':_0x283bbb['verticalAlignment'],'div_color':_0x283bbb[_0x0a9e('0xf8')],'labelText':_0x283bbb[_0x0a9e('0x107')],'text_color':_0x283bbb[_0x0a9e('0x108')],'text_button_color':_0x283bbb['textButtonColor'],'button_color':_0x283bbb['color_button'],'background_color':_0x283bbb[_0x0a9e('0x109')],'hideWhenOffline':_0x283bbb['hideWhenOffline'],'intervalId':_0x283bbb[_0x0a9e('0x10a')],'isDevelopment':_0x1e31c2,'chatVersion':_0x1f1f36}));})['catch'](handleError(_0x557ef8,null));};exports['addApplications']=function(_0x229d20,_0x2a17d0){var _0x452b04=_0x229d20[_0x0a9e('0x5c')]['id'];var _0x1f0776=_0x229d20[_0x0a9e('0x66')];var _0x2f64ef=0xc8;var _0x36287b=null;return db[_0x0a9e('0xde')][_0x0a9e('0xdf')]({'isolationLevel':db[_0x0a9e('0xde')][_0x0a9e('0x10b')][_0x0a9e('0x10c')]['READ_COMMITTED']},function(_0x58f251){return db[_0x0a9e('0x46')]['findOne']({'where':{'id':_0x452b04},'transaction':_0x58f251})[_0x0a9e('0x28')](function(_0x1db652){if(_0x1db652){return db[_0x0a9e('0x10d')]['destroy']({'where':{'ChatWebsiteId':_0x452b04},'transaction':_0x58f251})['then'](function(){var _0x428009=_[_0x0a9e('0x45')](_0x1f0776,function(_0x2c316b){_0x2c316b[_0x0a9e('0x71')]=_0x452b04;return _0x2c316b;});return db[_0x0a9e('0x10d')][_0x0a9e('0xe0')](_0x428009,{'transaction':_0x58f251});});}else{_0x2f64ef=0x194;_0x36287b=[];}});})[_0x0a9e('0x28')](function(){if(_0x2f64ef!==0x194){return db['ChatApplication'][_0x0a9e('0x10e')]({'where':{'ChatWebsiteId':_0x452b04},'order':'priority'})[_0x0a9e('0x28')](function(_0xb76c50){_0x36287b=_0xb76c50;});}})['catch'](function(_0x1fe77c){_0x2f64ef=0x1f4;logger[_0x0a9e('0x19')](_0x1fe77c[_0x0a9e('0x2e')]);if(_0x1fe77c[_0x0a9e('0x2f')]){delete _0x1fe77c[_0x0a9e('0x2f')];}_0x36287b=_0x1fe77c;})[_0x0a9e('0x10f')](function(){if(_0x36287b===null){_0x2a17d0['sendStatus'](_0x2f64ef);}else{if(_0x2f64ef===0x1f4){_0x2a17d0[_0x0a9e('0x1f')](_0x2f64ef)[_0x0a9e('0xca')](_0x36287b);}else{_0x2a17d0[_0x0a9e('0x1f')](_0x2f64ef)['json'](_0x36287b);}}});};exports[_0x0a9e('0x110')]=function(_0x934f69,_0x24dc3f){var _0x525928={};var _0x459173={};var _0x3607c6;var _0x37257e;return db[_0x0a9e('0x46')][_0x0a9e('0x6b')]({'where':{'id':_0x934f69[_0x0a9e('0x5c')]['id']}})['then'](handleEntityNotFound(_0x24dc3f,null))['then'](function(_0x36bf7d){if(_0x36bf7d){_0x3607c6=_0x36bf7d;_0x459173[_0x0a9e('0x3f')]=_['keys'](db[_0x0a9e('0x10d')][_0x0a9e('0x47')]);_0x459173[_0x0a9e('0x4a')]=_[_0x0a9e('0x4b')](_0x934f69[_0x0a9e('0x4a')]);_0x459173[_0x0a9e('0x55')]=_['intersection'](_0x459173[_0x0a9e('0x3f')],_0x459173[_0x0a9e('0x4a')]);_0x525928[_0x0a9e('0x4d')]=_['intersection'](_0x459173[_0x0a9e('0x3f')],qs[_0x0a9e('0x4e')](_0x934f69[_0x0a9e('0x4a')][_0x0a9e('0x4e')]));_0x525928['attributes']=_0x525928['attributes'][_0x0a9e('0x4f')]?_0x525928[_0x0a9e('0x4d')]:_0x459173[_0x0a9e('0x3f')];_0x525928['order']=qs[_0x0a9e('0x53')](_0x934f69[_0x0a9e('0x4a')][_0x0a9e('0x53')]);_0x525928[_0x0a9e('0x54')]=qs[_0x0a9e('0x55')](_[_0x0a9e('0x6c')](_0x934f69[_0x0a9e('0x4a')],_0x459173[_0x0a9e('0x55')]));if(_0x934f69['query']['filter']){_0x525928[_0x0a9e('0x54')]=_[_0x0a9e('0x58')](_0x525928['where'],{'$or':_[_0x0a9e('0x45')](_0x525928['attributes'],function(_0x1f80cb){var _0xfb2f3a={};_0xfb2f3a[_0x1f80cb]={'$like':'%'+_0x934f69['query'][_0x0a9e('0x56')]+'%'};return _0xfb2f3a;})});}_0x525928=_[_0x0a9e('0x58')]({},_0x525928,_0x934f69['options']);return _0x3607c6[_0x0a9e('0x110')](_0x525928);}})[_0x0a9e('0x28')](function(_0x6933ab){if(_0x6933ab){_0x37257e=_0x6933ab[_0x0a9e('0x4f')];if(!_0x934f69[_0x0a9e('0x4a')][_0x0a9e('0x50')](_0x0a9e('0x51'))){_0x525928['limit']=qs[_0x0a9e('0x22')](_0x934f69[_0x0a9e('0x4a')][_0x0a9e('0x22')]);_0x525928[_0x0a9e('0x20')]=qs[_0x0a9e('0x20')](_0x934f69[_0x0a9e('0x4a')][_0x0a9e('0x20')]);}return _0x3607c6['getApplications'](_0x525928);}})['then'](function(_0x435688){if(_0x435688){return _0x435688?{'count':_0x37257e,'rows':_0x435688}:null;}})[_0x0a9e('0x28')](respondWithResult(_0x24dc3f,null))[_0x0a9e('0x5b')](handleError(_0x24dc3f,null));};exports['addProactiveActions']=function(_0x5cf1ba,_0xf7ddca){return db['chatProactiveAction'][_0x0a9e('0x63')]({'where':{'id':_0x5cf1ba[_0x0a9e('0x5c')]['id']}})[_0x0a9e('0x28')](handleEntityNotFound(_0xf7ddca,null))[_0x0a9e('0x28')](function(_0x20f4cb){if(_0x20f4cb){return _0x20f4cb[_0x0a9e('0x111')](_0x5cf1ba[_0x0a9e('0x66')][_0x0a9e('0x6f')],_[_0x0a9e('0xf3')](_0x5cf1ba['body'],['ids','id'])||{});}})[_0x0a9e('0x28')](respondWithResult(_0xf7ddca,null))['catch'](handleError(_0xf7ddca,null));};exports[_0x0a9e('0x112')]=function(_0x14ff88,_0xb44070){var _0x3b684b={};var _0x4ad6fc={};var _0xaa43da;var _0x2ee2fc;return db[_0x0a9e('0x46')]['findOne']({'where':{'id':_0x14ff88[_0x0a9e('0x5c')]['id']}})[_0x0a9e('0x28')](handleEntityNotFound(_0xb44070,null))[_0x0a9e('0x28')](function(_0x5c09d6){if(_0x5c09d6){_0xaa43da=_0x5c09d6;_0x4ad6fc[_0x0a9e('0x3f')]=_[_0x0a9e('0x4b')](db[_0x0a9e('0x113')][_0x0a9e('0x47')]);_0x4ad6fc[_0x0a9e('0x4a')]=_[_0x0a9e('0x4b')](_0x14ff88['query']);_0x4ad6fc['filters']=_[_0x0a9e('0x4c')](_0x4ad6fc[_0x0a9e('0x3f')],_0x4ad6fc[_0x0a9e('0x4a')]);_0x3b684b['attributes']=_['intersection'](_0x4ad6fc[_0x0a9e('0x3f')],qs[_0x0a9e('0x4e')](_0x14ff88[_0x0a9e('0x4a')]['fields']));_0x3b684b['attributes']=_0x3b684b[_0x0a9e('0x4d')][_0x0a9e('0x4f')]?_0x3b684b[_0x0a9e('0x4d')]:_0x4ad6fc[_0x0a9e('0x3f')];_0x3b684b[_0x0a9e('0x52')]=qs['sort'](_0x14ff88[_0x0a9e('0x4a')]['sort']);_0x3b684b[_0x0a9e('0x54')]=qs[_0x0a9e('0x55')](_['pick'](_0x14ff88[_0x0a9e('0x4a')],_0x4ad6fc['filters']));if(_0x14ff88[_0x0a9e('0x4a')][_0x0a9e('0x56')]){_0x3b684b[_0x0a9e('0x54')]=_[_0x0a9e('0x58')](_0x3b684b[_0x0a9e('0x54')],{'$or':_['map'](_0x3b684b[_0x0a9e('0x4d')],function(_0x2ef5c8){var _0x226d6f={};_0x226d6f[_0x2ef5c8]={'$like':'%'+_0x14ff88['query'][_0x0a9e('0x56')]+'%'};return _0x226d6f;})});}_0x3b684b=_['merge']({},_0x3b684b,_0x14ff88[_0x0a9e('0x59')]);return _0xaa43da[_0x0a9e('0x112')](_0x3b684b);}})[_0x0a9e('0x28')](function(_0x498d4e){if(_0x498d4e){_0x2ee2fc=_0x498d4e[_0x0a9e('0x4f')];if(!_0x14ff88[_0x0a9e('0x4a')][_0x0a9e('0x50')](_0x0a9e('0x51'))){_0x3b684b[_0x0a9e('0x22')]=qs[_0x0a9e('0x22')](_0x14ff88['query'][_0x0a9e('0x22')]);_0x3b684b[_0x0a9e('0x20')]=qs[_0x0a9e('0x20')](_0x14ff88[_0x0a9e('0x4a')][_0x0a9e('0x20')]);}return _0xaa43da[_0x0a9e('0x112')](_0x3b684b);}})[_0x0a9e('0x28')](function(_0x3e43ea){if(_0x3e43ea){return _0x3e43ea?{'count':_0x2ee2fc,'rows':_0x3e43ea}:null;}})['then'](respondWithResult(_0xb44070,null))[_0x0a9e('0x5b')](handleError(_0xb44070,null));};exports[_0x0a9e('0x114')]=function(_0x3813ac,_0x40948d){var _0x55a300=_0x3813ac[_0x0a9e('0x4a')]['online']===_0x0a9e('0x115')?_0x0a9e('0x116'):_0x0a9e('0x117');return db['ChatWebsite'][_0x0a9e('0x63')]({'attributes':['id',_0x55a300],'where':{'id':_0x3813ac[_0x0a9e('0x5c')]['id']}})[_0x0a9e('0x28')](handleEntityNotFound(_0x40948d,null))[_0x0a9e('0x28')](function(_0x53e0fc){if(_0x53e0fc){var _0x110b3a=_0x53e0fc[_0x55a300];var _0x319a78=_0x110b3a&&_0x110b3a[_0x0a9e('0x118')]?_0x110b3a[_0x0a9e('0x118')]:[];_0x40948d[_0x0a9e('0xca')]({'fromKey':_[_0x0a9e('0x89')](_0x110b3a[_0x0a9e('0x119')])?undefined:_0x110b3a['fromKey'],'count':_0x319a78[_0x0a9e('0x4f')],'rows':_0x319a78});}})[_0x0a9e('0x5b')](handleError(_0x40948d,null));};exports[_0x0a9e('0x11a')]=function(_0xa42055,_0x52cdf4){var _0x1b6dde={'raw':![],'where':{}};var _0x4bd161={};var _0x2b8f51={'count':0x0,'rows':[]};return db[_0x0a9e('0x46')][_0x0a9e('0x6b')]({'where':{'id':_0xa42055[_0x0a9e('0x5c')]['id']}})[_0x0a9e('0x28')](handleEntityNotFound(_0x52cdf4,null))[_0x0a9e('0x28')](function(_0x2eaeeb){if(_0x2eaeeb){_0x4bd161['model']=_[_0x0a9e('0x4b')](db['ChatOfflineMessage'][_0x0a9e('0x47')]);_0x4bd161[_0x0a9e('0x4a')]=_['keys'](_0xa42055[_0x0a9e('0x4a')]);_0x4bd161[_0x0a9e('0x55')]=_[_0x0a9e('0x4c')](_0x4bd161[_0x0a9e('0x3f')],_0x4bd161['query']);_0x1b6dde[_0x0a9e('0x4d')]=_[_0x0a9e('0x4c')](_0x4bd161['model'],qs[_0x0a9e('0x4e')](_0xa42055['query']['fields']));_0x1b6dde['attributes']=_0x1b6dde[_0x0a9e('0x4d')][_0x0a9e('0x4f')]?_0x1b6dde['attributes']:_0x4bd161[_0x0a9e('0x3f')];if(!_0xa42055[_0x0a9e('0x4a')]['hasOwnProperty'](_0x0a9e('0x51'))){_0x1b6dde[_0x0a9e('0x22')]=qs[_0x0a9e('0x22')](_0xa42055[_0x0a9e('0x4a')][_0x0a9e('0x22')]);_0x1b6dde[_0x0a9e('0x20')]=qs[_0x0a9e('0x20')](_0xa42055['query'][_0x0a9e('0x20')]);}_0x1b6dde['order']=qs[_0x0a9e('0x53')](_0xa42055[_0x0a9e('0x4a')][_0x0a9e('0x53')]);_0x1b6dde[_0x0a9e('0x54')]=qs[_0x0a9e('0x55')](_[_0x0a9e('0x6c')](_0xa42055['query'],_0x4bd161[_0x0a9e('0x55')]));_0x1b6dde[_0x0a9e('0x54')][_0x0a9e('0x71')]=_0x2eaeeb['id'];if(_0xa42055['query'][_0x0a9e('0x56')]){_0x1b6dde[_0x0a9e('0x54')]=_[_0x0a9e('0x58')](_0x1b6dde[_0x0a9e('0x54')],{'$or':_[_0x0a9e('0x45')](_0x1b6dde[_0x0a9e('0x4d')],function(_0x3bc55c){var _0x1f1b80={};_0x1f1b80[_0x3bc55c]={'$like':'%'+_0xa42055[_0x0a9e('0x4a')][_0x0a9e('0x56')]+'%'};return _0x1f1b80;})});}_0x1b6dde=_[_0x0a9e('0x58')]({},_0x1b6dde,_0xa42055[_0x0a9e('0x59')]);return db[_0x0a9e('0xd6')][_0x0a9e('0x23')]({'where':_0x1b6dde[_0x0a9e('0x54')]})[_0x0a9e('0x28')](function(_0x515f8f){_0x2b8f51[_0x0a9e('0x23')]=_0x515f8f;if(_0xa42055[_0x0a9e('0x4a')][_0x0a9e('0x5a')]){_0x1b6dde['include']=[{'all':!![]}];}else{_0x1b6dde[_0x0a9e('0x5e')]=[{'model':db[_0x0a9e('0x95')],'as':_0x0a9e('0xf4'),'required':![]},{'model':db[_0x0a9e('0x11b')],'as':'Attachments','required':![]}];}return db[_0x0a9e('0xd6')][_0x0a9e('0x6d')](_0x1b6dde);})[_0x0a9e('0x28')](function(_0x409232){_0x2b8f51['rows']=_0x409232;return _0x2b8f51;});}})[_0x0a9e('0x28')](respondWithFilteredResult(_0x52cdf4,_0x1b6dde))[_0x0a9e('0x5b')](handleError(_0x52cdf4,null));};exports[_0x0a9e('0x11c')]=function(_0x1da167,_0x58a46f){return db['ChatWebsite'][_0x0a9e('0x63')]({'where':{'id':_0x1da167[_0x0a9e('0x5c')]['id']}})[_0x0a9e('0x28')](handleEntityNotFound(_0x58a46f,null))[_0x0a9e('0x28')](function(_0x8c1ac4){if(_0x8c1ac4){return _0x8c1ac4[_0x0a9e('0x11c')](_0x1da167[_0x0a9e('0x66')][_0x0a9e('0x6f')],_[_0x0a9e('0xf3')](_0x1da167[_0x0a9e('0x66')],[_0x0a9e('0x6f'),'id'])||{})[_0x0a9e('0xd0')](function(_0x347629){for(var _0x30c231=0x0;_0x30c231<_0x1da167['body'][_0x0a9e('0x6f')][_0x0a9e('0x4f')];_0x30c231+=0x1){socket[_0x0a9e('0x11d')]('userChatWebsite:save',{'UserId':Number(_0x1da167['body'][_0x0a9e('0x6f')][_0x30c231]),'ChatWebsiteId':Number(_0x1da167['params']['id'])});}return _0x347629;});}})[_0x0a9e('0x28')](respondWithResult(_0x58a46f,null))[_0x0a9e('0x5b')](handleError(_0x58a46f,null));};exports[_0x0a9e('0x11e')]=function(_0x12a7e,_0x56caca){return db['ChatWebsite'][_0x0a9e('0x63')]({'where':{'id':_0x12a7e[_0x0a9e('0x5c')]['id']}})[_0x0a9e('0x28')](handleEntityNotFound(_0x56caca,null))[_0x0a9e('0x28')](function(_0x557115){if(_0x557115){return _0x557115[_0x0a9e('0x11e')](_0x12a7e[_0x0a9e('0x4a')][_0x0a9e('0x6f')])[_0x0a9e('0x28')](function(){if(_[_0x0a9e('0x11f')](_0x12a7e['query']['ids'])){for(var _0x35b0e6=0x0;_0x35b0e6<_0x12a7e[_0x0a9e('0x4a')][_0x0a9e('0x6f')][_0x0a9e('0x4f')];_0x35b0e6+=0x1){socket[_0x0a9e('0x11d')](_0x0a9e('0x120'),{'UserId':Number(_0x12a7e[_0x0a9e('0x4a')]['ids'][_0x35b0e6]),'ChatWebsiteId':Number(_0x12a7e[_0x0a9e('0x5c')]['id'])});}}else{socket[_0x0a9e('0x11d')](_0x0a9e('0x120'),{'UserId':Number(_0x12a7e['query']['ids']),'ChatWebsiteId':Number(_0x12a7e['params']['id'])});}});}})[_0x0a9e('0x28')](respondWithStatusCode(_0x56caca,null))[_0x0a9e('0x5b')](handleError(_0x56caca,null));};exports['getAgents']=function(_0x419d9e,_0x257b65){var _0x42d776={};var _0x583347={};var _0x571931;var _0x18010e;return db[_0x0a9e('0x46')][_0x0a9e('0x6b')]({'where':{'id':_0x419d9e[_0x0a9e('0x5c')]['id']}})['then'](handleEntityNotFound(_0x257b65,null))[_0x0a9e('0x28')](function(_0x5ccb5a){if(_0x5ccb5a){_0x571931=_0x5ccb5a;_0x583347['model']=_[_0x0a9e('0x4b')](db['User'][_0x0a9e('0x47')]);_0x583347[_0x0a9e('0x4a')]=_[_0x0a9e('0x4b')](_0x419d9e['query']);_0x583347[_0x0a9e('0x55')]=_[_0x0a9e('0x4c')](_0x583347[_0x0a9e('0x3f')],_0x583347['query']);_0x42d776['attributes']=_[_0x0a9e('0x4c')](_0x583347[_0x0a9e('0x3f')],qs[_0x0a9e('0x4e')](_0x419d9e[_0x0a9e('0x4a')][_0x0a9e('0x4e')]));_0x42d776[_0x0a9e('0x4d')]=_0x42d776['attributes']['length']?_0x42d776[_0x0a9e('0x4d')]:_0x583347[_0x0a9e('0x3f')];_0x42d776['order']=qs['sort'](_0x419d9e['query']['sort']);_0x42d776['where']=qs['filters'](_[_0x0a9e('0x6c')](_0x419d9e['query'],_0x583347[_0x0a9e('0x55')]));if(_0x419d9e[_0x0a9e('0x4a')][_0x0a9e('0x56')]){_0x42d776[_0x0a9e('0x54')]=_[_0x0a9e('0x58')](_0x42d776[_0x0a9e('0x54')],{'$or':_[_0x0a9e('0x45')](_0x42d776['attributes'],function(_0x2866e7){var _0x13e8bd={};_0x13e8bd[_0x2866e7]={'$like':'%'+_0x419d9e[_0x0a9e('0x4a')][_0x0a9e('0x56')]+'%'};return _0x13e8bd;})});}_0x42d776=_[_0x0a9e('0x58')]({},_0x42d776,_0x419d9e[_0x0a9e('0x59')]);return _0x571931[_0x0a9e('0x121')](_0x42d776);}})[_0x0a9e('0x28')](function(_0x1911d0){if(_0x1911d0){_0x18010e=_0x1911d0[_0x0a9e('0x4f')];if(!_0x419d9e[_0x0a9e('0x4a')]['hasOwnProperty'](_0x0a9e('0x51'))){_0x42d776[_0x0a9e('0x22')]=qs['limit'](_0x419d9e[_0x0a9e('0x4a')]['limit']);_0x42d776[_0x0a9e('0x20')]=qs[_0x0a9e('0x20')](_0x419d9e['query']['offset']);}return _0x571931[_0x0a9e('0x121')](_0x42d776);}})['then'](function(_0x176612){if(_0x176612){return _0x176612?{'count':_0x18010e,'rows':_0x176612}:null;}})[_0x0a9e('0x28')](respondWithResult(_0x257b65,null))[_0x0a9e('0x5b')](handleError(_0x257b65,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 35aa9d8..fdef41a 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 _0xbf4e=['events','../../mysqldb','ChatWebsite','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports'];(function(_0xc80f43,_0x5621ea){var _0x226f94=function(_0x2a3771){while(--_0x2a3771){_0xc80f43['push'](_0xc80f43['shift']());}};_0x226f94(++_0x5621ea);}(_0xbf4e,0x172));var _0xebf4=function(_0x442e81,_0x321fa7){_0x442e81=_0x442e81-0x0;var _0x32aa9d=_0xbf4e[_0x442e81];return _0x32aa9d;};'use strict';var EventEmitter=require(_0xebf4('0x0'));var ChatWebsite=require(_0xebf4('0x1'))['db'][_0xebf4('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xebf4('0x3')](0x0);var events={'afterCreate':_0xebf4('0x4'),'afterUpdate':_0xebf4('0x5'),'afterDestroy':'remove'};function emitEvent(_0x41cb2c){return function(_0x5d2ad5,_0x59cc54,_0x15328a){ChatWebsiteEvents[_0xebf4('0x6')](_0x41cb2c+':'+_0x5d2ad5['id'],_0x5d2ad5);ChatWebsiteEvents['emit'](_0x41cb2c,_0x5d2ad5);_0x15328a(null);};}for(var e in events){if(events[_0xebf4('0x7')](e)){var event=events[e];ChatWebsite[_0xebf4('0x8')](e,emitEvent(event));}}module[_0xebf4('0x9')]=ChatWebsiteEvents; \ No newline at end of file +var _0xe14f=['hasOwnProperty','hook','exports','events','../../mysqldb','ChatWebsite','setMaxListeners','save','update','remove','emit'];(function(_0x37ba32,_0x10bc80){var _0x23ad43=function(_0x5b61bd){while(--_0x5b61bd){_0x37ba32['push'](_0x37ba32['shift']());}};_0x23ad43(++_0x10bc80);}(_0xe14f,0xea));var _0xfe14=function(_0x23b940,_0x2b824b){_0x23b940=_0x23b940-0x0;var _0x2b264e=_0xe14f[_0x23b940];return _0x2b264e;};'use strict';var EventEmitter=require(_0xfe14('0x0'));var ChatWebsite=require(_0xfe14('0x1'))['db'][_0xfe14('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xfe14('0x3')](0x0);var events={'afterCreate':_0xfe14('0x4'),'afterUpdate':_0xfe14('0x5'),'afterDestroy':_0xfe14('0x6')};function emitEvent(_0x3afd97){return function(_0x2b7784,_0x4b7546,_0x576d90){ChatWebsiteEvents[_0xfe14('0x7')](_0x3afd97+':'+_0x2b7784['id'],_0x2b7784);ChatWebsiteEvents['emit'](_0x3afd97,_0x2b7784);_0x576d90(null);};}for(var e in events){if(events[_0xfe14('0x8')](e)){var event=events[e];ChatWebsite[_0xfe14('0x9')](e,emitEvent(event));}}module[_0xfe14('0xa')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 7990ebb..35bd4d7 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 _0x3564=['./chatWebsite.attributes','define','ChatWebsite','chat_websites','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x42576c,_0x443519){var _0xf01e6d=function(_0x21aa48){while(--_0x21aa48){_0x42576c['push'](_0x42576c['shift']());}};_0xf01e6d(++_0x443519);}(_0x3564,0x108));var _0x4356=function(_0x30efb0,_0xa15dc){_0x30efb0=_0x30efb0-0x0;var _0xc2813f=_0x3564[_0x30efb0];return _0xc2813f;};'use strict';var _=require(_0x4356('0x0'));var util=require(_0x4356('0x1'));var logger=require(_0x4356('0x2'))(_0x4356('0x3'));var moment=require('moment');var BPromise=require(_0x4356('0x4'));var rp=require(_0x4356('0x5'));var fs=require('fs');var path=require(_0x4356('0x6'));var rimraf=require(_0x4356('0x7'));var config=require(_0x4356('0x8'));var attributes=require(_0x4356('0x9'));module['exports']=function(_0x251d3d,_0x5eaa69){return _0x251d3d[_0x4356('0xa')](_0x4356('0xb'),attributes,{'tableName':_0x4356('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaffb=['lodash','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./chatWebsite.attributes','exports','define','chat_websites'];(function(_0x44fef1,_0x132cf4){var _0x3c3a04=function(_0x175a90){while(--_0x175a90){_0x44fef1['push'](_0x44fef1['shift']());}};_0x3c3a04(++_0x132cf4);}(_0xaffb,0xa5));var _0xbaff=function(_0x509c83,_0x511882){_0x509c83=_0x509c83-0x0;var _0x534626=_0xaffb[_0x509c83];return _0x534626;};'use strict';var _=require(_0xbaff('0x0'));var util=require('util');var logger=require(_0xbaff('0x1'))(_0xbaff('0x2'));var moment=require('moment');var BPromise=require(_0xbaff('0x3'));var rp=require(_0xbaff('0x4'));var fs=require('fs');var path=require(_0xbaff('0x5'));var rimraf=require('rimraf');var config=require(_0xbaff('0x6'));var attributes=require(_0xbaff('0x7'));module[_0xbaff('0x8')]=function(_0x23354a,_0x6bf3c3){return _0x23354a[_0xbaff('0x9')]('ChatWebsite',attributes,{'tableName':_0xbaff('0xa'),'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 91b1c1e..c5e6ff9 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 _0x4677=['redis','defaults','localhost','socket.io-emitter','register','request','then','info','ChatWebsite,\x20%s,\x20%s','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http'];(function(_0x4a8418,_0x39078a){var _0x390174=function(_0x173ea6){while(--_0x173ea6){_0x4a8418['push'](_0x4a8418['shift']());}};_0x390174(++_0x39078a);}(_0x4677,0x65));var _0x7467=function(_0x17f905,_0x3d3481){_0x17f905=_0x17f905-0x0;var _0xb0a745=_0x4677[_0x17f905];return _0xb0a745;};'use strict';var _=require(_0x7467('0x0'));var util=require(_0x7467('0x1'));var moment=require(_0x7467('0x2'));var BPromise=require(_0x7467('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7467('0x4'));var db=require(_0x7467('0x5'))['db'];var utils=require(_0x7467('0x6'));var logger=require(_0x7467('0x7'))(_0x7467('0x8'));var config=require('../../config/environment');var jayson=require(_0x7467('0x9'));var client=jayson['client'][_0x7467('0xa')]({'port':0x232a});config[_0x7467('0xb')]=_[_0x7467('0xc')](config['redis'],{'host':_0x7467('0xd'),'port':0x18eb});var socket=require(_0x7467('0xe'))(new Redis(config[_0x7467('0xb')]));require('./chatWebsite.socket')[_0x7467('0xf')](socket);function respondWithRpcPromise(_0x497a3e,_0x1e4240,_0x1114c8){return new BPromise(function(_0x2ac635,_0x3c52c1){return client[_0x7467('0x10')](_0x497a3e,_0x1114c8)[_0x7467('0x11')](function(_0x441c57){logger[_0x7467('0x12')](_0x7467('0x13'),_0x1e4240,'request\x20sent');logger[_0x7467('0x14')](_0x7467('0x15'),_0x1e4240,_0x7467('0x16'),JSON[_0x7467('0x17')](_0x441c57));if(_0x441c57[_0x7467('0x18')]){if(_0x441c57[_0x7467('0x18')][_0x7467('0x19')]===0x1f4){logger[_0x7467('0x18')]('ChatWebsite,\x20%s,\x20%s',_0x1e4240,_0x441c57[_0x7467('0x18')][_0x7467('0x1a')]);return _0x3c52c1(_0x441c57['error']['message']);}logger[_0x7467('0x18')](_0x7467('0x13'),_0x1e4240,_0x441c57[_0x7467('0x18')]['message']);return _0x2ac635(_0x441c57[_0x7467('0x18')][_0x7467('0x1a')]);}else{logger[_0x7467('0x12')](_0x7467('0x13'),_0x1e4240,'request\x20sent');_0x2ac635(_0x441c57[_0x7467('0x1b')][_0x7467('0x1a')]);}})['catch'](function(_0x56bfc9){logger[_0x7467('0x18')](_0x7467('0x13'),_0x1e4240,_0x56bfc9);_0x3c52c1(_0x56bfc9);});});} \ No newline at end of file +var _0x0cfb=['rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils'];(function(_0x3cb962,_0x39edfe){var _0x548c28=function(_0x2ccfb6){while(--_0x2ccfb6){_0x3cb962['push'](_0x3cb962['shift']());}};_0x548c28(++_0x39edfe);}(_0x0cfb,0x123));var _0xb0cf=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x0cfb[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xb0cf('0x0'));var util=require(_0xb0cf('0x1'));var moment=require(_0xb0cf('0x2'));var BPromise=require('bluebird');var rs=require(_0xb0cf('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb0cf('0x4'))['db'];var utils=require(_0xb0cf('0x5'));var logger=require('../../config/logger')(_0xb0cf('0x6'));var config=require(_0xb0cf('0x7'));var jayson=require(_0xb0cf('0x8'));var client=jayson[_0xb0cf('0x9')][_0xb0cf('0xa')]({'port':0x232a});config[_0xb0cf('0xb')]=_[_0xb0cf('0xc')](config[_0xb0cf('0xb')],{'host':_0xb0cf('0xd'),'port':0x18eb});var socket=require(_0xb0cf('0xe'))(new Redis(config[_0xb0cf('0xb')]));require(_0xb0cf('0xf'))[_0xb0cf('0x10')](socket);function respondWithRpcPromise(_0xd0a71d,_0x5e7d46,_0x9b1d76){return new BPromise(function(_0xa99eb0,_0x109534){return client[_0xb0cf('0x11')](_0xd0a71d,_0x9b1d76)[_0xb0cf('0x12')](function(_0x57fd11){logger[_0xb0cf('0x13')](_0xb0cf('0x14'),_0x5e7d46,_0xb0cf('0x15'));logger['debug']('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x5e7d46,_0xb0cf('0x15'),JSON[_0xb0cf('0x16')](_0x57fd11));if(_0x57fd11[_0xb0cf('0x17')]){if(_0x57fd11['error']['code']===0x1f4){logger[_0xb0cf('0x17')]('ChatWebsite,\x20%s,\x20%s',_0x5e7d46,_0x57fd11['error']['message']);return _0x109534(_0x57fd11[_0xb0cf('0x17')]['message']);}logger[_0xb0cf('0x17')](_0xb0cf('0x14'),_0x5e7d46,_0x57fd11[_0xb0cf('0x17')][_0xb0cf('0x18')]);return _0xa99eb0(_0x57fd11['error'][_0xb0cf('0x18')]);}else{logger[_0xb0cf('0x13')]('ChatWebsite,\x20%s,\x20%s',_0x5e7d46,_0xb0cf('0x15'));_0xa99eb0(_0x57fd11[_0xb0cf('0x19')][_0xb0cf('0x18')]);}})[_0xb0cf('0x1a')](function(_0x5dceeb){logger['error'](_0xb0cf('0x14'),_0x5e7d46,_0x5dceeb);_0x109534(_0x5dceeb);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 6f910c0..c5c1b33 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 _0x15b4=['emit','removeListener','register','length','chatWebsite:','./chatWebsite.events','save','update'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x15b4,0x85));var _0x415b=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0x15b4[_0x1928c9];return _0x51b5fb;};'use strict';var ChatWebsiteEvents=require(_0x415b('0x0'));var events=[_0x415b('0x1'),'remove',_0x415b('0x2')];function createListener(_0x5c6aad,_0x5d873c){return function(_0x55e115){_0x5d873c[_0x415b('0x3')](_0x5c6aad,_0x55e115);};}function removeListener(_0x47efca,_0x46f410){return function(){ChatWebsiteEvents[_0x415b('0x4')](_0x47efca,_0x46f410);};}exports[_0x415b('0x5')]=function(_0x1750ec){for(var _0x4726f2=0x0,_0x152e88=events[_0x415b('0x6')];_0x4726f2<_0x152e88;_0x4726f2++){var _0x29145f=events[_0x4726f2];var _0x2a33cf=createListener(_0x415b('0x7')+_0x29145f,_0x1750ec);ChatWebsiteEvents['on'](_0x29145f,_0x2a33cf);}}; \ No newline at end of file +var _0xa25c=['update','emit','length','chatWebsite:','save','remove'];(function(_0x46990f,_0x49e763){var _0x46009a=function(_0x462e13){while(--_0x462e13){_0x46990f['push'](_0x46990f['shift']());}};_0x46009a(++_0x49e763);}(_0xa25c,0x12a));var _0xca25=function(_0x120c7a,_0x553651){_0x120c7a=_0x120c7a-0x0;var _0x402568=_0xa25c[_0x120c7a];return _0x402568;};'use strict';var ChatWebsiteEvents=require('./chatWebsite.events');var events=[_0xca25('0x0'),_0xca25('0x1'),_0xca25('0x2')];function createListener(_0x1350c7,_0x5694e5){return function(_0x3b3f5c){_0x5694e5[_0xca25('0x3')](_0x1350c7,_0x3b3f5c);};}function removeListener(_0x3f5f97,_0x84fb54){return function(){ChatWebsiteEvents['removeListener'](_0x3f5f97,_0x84fb54);};}exports['register']=function(_0x508dc1){for(var _0x2031c6=0x0,_0x1f8b63=events[_0xca25('0x4')];_0x2031c6<_0x1f8b63;_0x2031c6++){var _0x2773c6=events[_0x2031c6];var _0x4dc78e=createListener(_0xca25('0x5')+_0x2773c6,_0x508dc1);ChatWebsiteEvents['on'](_0x2773c6,_0x4dc78e);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index c95b77a..bda225a 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 _0x6c45=['getAgents','create','post','addDisposition','addAnswer','diskStorage','join','root','server/files/images/logos/','format','%s-%s','originalname','/:id/logo','single','addLogo','file','addAvatar','server/files/images/avatars/','now','/:id/notify','notify','server/files','attachments','offline-chat','ensureDir','replace','extname','/:id/offline','any','offline','addAgents','put','update','delete','removeDispositions','removeAnswers','removeAgents','exports','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','/:id/offline_messages','getOfflineMessages','/:id/users'];(function(_0x47f89d,_0x2039df){var _0x1d512a=function(_0x354026){while(--_0x354026){_0x47f89d['push'](_0x47f89d['shift']());}};_0x1d512a(++_0x2039df);}(_0x6c45,0x18e));var _0x56c4=function(_0xc2fd8c,_0x1f2ad7){_0xc2fd8c=_0xc2fd8c-0x0;var _0x247749=_0x6c45[_0xc2fd8c];return _0x247749;};'use strict';var multer=require('multer');var util=require(_0x56c4('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x56c4('0x1'));var router=express['Router']();var fs_extra=require(_0x56c4('0x2'));var auth=require(_0x56c4('0x3'));var interaction=require(_0x56c4('0x4'));var config=require(_0x56c4('0x5'));var controller=require(_0x56c4('0x6'));router[_0x56c4('0x7')]('/',auth[_0x56c4('0x8')](),controller[_0x56c4('0x9')]);router['get'](_0x56c4('0xa'),auth[_0x56c4('0x8')](),controller[_0x56c4('0xb')]);router['get'](_0x56c4('0xc'),auth[_0x56c4('0x8')](),controller[_0x56c4('0xd')]);router['get'](_0x56c4('0xe'),auth[_0x56c4('0x8')](),controller['getDispositions']);router[_0x56c4('0x7')](_0x56c4('0xf'),auth[_0x56c4('0x8')](),controller[_0x56c4('0x10')]);router[_0x56c4('0x7')]('/:id/logo',controller[_0x56c4('0x11')]);router['get'](_0x56c4('0x12'),controller[_0x56c4('0x13')]);router[_0x56c4('0x7')](_0x56c4('0x14'),controller[_0x56c4('0x15')]);router['get'](_0x56c4('0x16'),controller[_0x56c4('0x17')]);router[_0x56c4('0x7')](_0x56c4('0x18'),auth[_0x56c4('0x8')](),controller[_0x56c4('0x19')]);router[_0x56c4('0x7')]('/:id/snippet',controller['getSnippet']);router[_0x56c4('0x7')](_0x56c4('0x1a'),auth[_0x56c4('0x8')](),controller[_0x56c4('0x1b')]);router[_0x56c4('0x7')](_0x56c4('0x1c'),auth[_0x56c4('0x8')](),controller[_0x56c4('0x1d')]);router['get'](_0x56c4('0x1e'),controller['getFields']);router[_0x56c4('0x7')](_0x56c4('0x1f'),auth[_0x56c4('0x8')](),controller[_0x56c4('0x20')]);router[_0x56c4('0x7')](_0x56c4('0x21'),auth['isAuthenticated'](),controller[_0x56c4('0x22')]);router['post']('/',auth['isAuthenticated'](),controller[_0x56c4('0x23')]);router[_0x56c4('0x24')](_0x56c4('0xe'),auth[_0x56c4('0x8')](),controller[_0x56c4('0x25')]);router['post']('/:id/canned_answers',auth[_0x56c4('0x8')](),controller[_0x56c4('0x26')]);var upload=multer({'storage':multer[_0x56c4('0x27')]({'destination':function(_0x380411,_0xb0e60f,_0x2bc67b){_0x2bc67b(null,path[_0x56c4('0x28')](config[_0x56c4('0x29')],_0x56c4('0x2a')));},'filename':function(_0x2c9645,_0x112132,_0x4efa6f){_0x4efa6f(null,util[_0x56c4('0x2b')](_0x56c4('0x2c'),Date['now'](),_0x112132[_0x56c4('0x2d')]));}})});router[_0x56c4('0x24')](_0x56c4('0x2e'),upload[_0x56c4('0x2f')]('file'),controller[_0x56c4('0x30')]);var upload=multer({'storage':multer[_0x56c4('0x27')]({'destination':function(_0x95061c,_0x5b2fbf,_0x14eb1b){_0x14eb1b(null,path[_0x56c4('0x28')](config[_0x56c4('0x29')],'server/files/images/avatars/'));},'filename':function(_0x5bc982,_0x5532a6,_0x27e7db){_0x27e7db(null,util[_0x56c4('0x2b')](_0x56c4('0x2c'),Date['now'](),_0x5532a6[_0x56c4('0x2d')]));}})});router[_0x56c4('0x24')]('/:id/avatar',upload[_0x56c4('0x2f')](_0x56c4('0x31')),controller[_0x56c4('0x32')]);var upload=multer({'storage':multer[_0x56c4('0x27')]({'destination':function(_0x270aab,_0x331f73,_0x1a68f2){_0x1a68f2(null,path[_0x56c4('0x28')](config[_0x56c4('0x29')],_0x56c4('0x33')));},'filename':function(_0x104d9d,_0x57786c,_0x28e480){_0x28e480(null,util[_0x56c4('0x2b')](_0x56c4('0x2c'),Date['now'](),_0x57786c[_0x56c4('0x2d')]));}})});router[_0x56c4('0x24')](_0x56c4('0x14'),upload['single']('file'),controller['addCustomerAvatar']);var upload=multer({'storage':multer[_0x56c4('0x27')]({'destination':function(_0x3c9bc0,_0x9156fa,_0x451fef){_0x451fef(null,path['join'](config[_0x56c4('0x29')],_0x56c4('0x33')));},'filename':function(_0x3abf1f,_0x347aa2,_0x2a0990){_0x2a0990(null,util[_0x56c4('0x2b')]('%s-%s',Date[_0x56c4('0x34')](),_0x347aa2['originalname']));}})});router[_0x56c4('0x24')](_0x56c4('0x16'),upload[_0x56c4('0x2f')](_0x56c4('0x31')),controller['addSystemAvatar']);router[_0x56c4('0x24')](_0x56c4('0x35'),controller[_0x56c4('0x36')]);const offlineUploadMulter=multer({'storage':multer['diskStorage']({'destination':function(_0x4e008a,_0x2fe075,_0x46b343){const _0x1ecd91=path[_0x56c4('0x28')](config[_0x56c4('0x29')],_0x56c4('0x37'),_0x56c4('0x38'),_0x56c4('0x39'));fs_extra[_0x56c4('0x3a')](_0x1ecd91,function(){_0x46b343(null,_0x1ecd91);});},'filename':function(_0x12c010,_0x1d2de7,_0x58a07e){const _0x1621c6=_0x1d2de7['originalname'][_0x56c4('0x3b')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x37c406=path[_0x56c4('0x3c')](_0x1621c6);const _0x27f63b=Date['now']()+'-'+_0x1621c6[_0x56c4('0x3b')](_0x37c406,'')+_0x37c406;_0x58a07e(null,_0x27f63b);}})});router[_0x56c4('0x24')](_0x56c4('0x3d'),offlineUploadMulter[_0x56c4('0x3e')](),controller[_0x56c4('0x3f')]);router[_0x56c4('0x24')](_0x56c4('0x18'),auth[_0x56c4('0x8')](),controller['addInteraction']);router[_0x56c4('0x24')](_0x56c4('0x1a'),auth[_0x56c4('0x8')](),controller['addApplications']);router['post'](_0x56c4('0x1c'),auth[_0x56c4('0x8')](),controller['addProactiveActions']);router[_0x56c4('0x24')]('/:id/users',auth[_0x56c4('0x8')](),controller[_0x56c4('0x40')]);router[_0x56c4('0x41')](_0x56c4('0xc'),auth[_0x56c4('0x8')](),controller[_0x56c4('0x42')]);router['delete'](_0x56c4('0xc'),auth['isAuthenticated'](),controller['destroy']);router[_0x56c4('0x43')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x56c4('0x44')]);router[_0x56c4('0x43')](_0x56c4('0xf'),auth[_0x56c4('0x8')](),controller[_0x56c4('0x45')]);router[_0x56c4('0x43')](_0x56c4('0x21'),auth[_0x56c4('0x8')](),controller[_0x56c4('0x46')]);module[_0x56c4('0x47')]=router; \ No newline at end of file +var _0x450e=['getAnswers','/:id/logo','getLogo','getAvatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','getInteractions','getSnippet','getApplications','/:id/proactive_actions','/:id/fields','/:id/offline_messages','getOfflineMessages','/:id/users','post','create','/:id/dispositions','addDisposition','addAnswer','join','root','format','%s-%s','originalname','single','file','addLogo','diskStorage','now','/:id/avatar','addAvatar','server/files/images/avatars/','/:id/customer_avatar','addCustomerAvatar','addSystemAvatar','/:id/notify','offline-chat','ensureDir','replace','extname','/:id/offline','/:id/interactions','/:id/applications','addApplications','addProactiveActions','addAgents','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./chatWebsite.controller','isAuthenticated','index','get','/describe','/:id','getDispositions','/:id/canned_answers'];(function(_0x52b49b,_0x337b45){var _0x579974=function(_0x71899e){while(--_0x71899e){_0x52b49b['push'](_0x52b49b['shift']());}};_0x579974(++_0x337b45);}(_0x450e,0x194));var _0xe450=function(_0x4ebfbb,_0x3ff78e){_0x4ebfbb=_0x4ebfbb-0x0;var _0x2aec79=_0x450e[_0x4ebfbb];return _0x2aec79;};'use strict';var multer=require(_0xe450('0x0'));var util=require(_0xe450('0x1'));var path=require(_0xe450('0x2'));var timeout=require(_0xe450('0x3'));var express=require(_0xe450('0x4'));var router=express[_0xe450('0x5')]();var fs_extra=require(_0xe450('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xe450('0x7'));var config=require('../../config/environment');var controller=require(_0xe450('0x8'));router['get']('/',auth[_0xe450('0x9')](),controller[_0xe450('0xa')]);router[_0xe450('0xb')](_0xe450('0xc'),auth[_0xe450('0x9')](),controller['describe']);router[_0xe450('0xb')](_0xe450('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xe450('0xb')]('/:id/dispositions',auth[_0xe450('0x9')](),controller[_0xe450('0xe')]);router[_0xe450('0xb')](_0xe450('0xf'),auth[_0xe450('0x9')](),controller[_0xe450('0x10')]);router[_0xe450('0xb')](_0xe450('0x11'),controller[_0xe450('0x12')]);router[_0xe450('0xb')]('/:id/avatar',controller[_0xe450('0x13')]);router[_0xe450('0xb')]('/:id/customer_avatar',controller[_0xe450('0x14')]);router[_0xe450('0xb')](_0xe450('0x15'),controller[_0xe450('0x16')]);router[_0xe450('0xb')]('/:id/interactions',auth[_0xe450('0x9')](),controller[_0xe450('0x17')]);router['get']('/:id/snippet',controller[_0xe450('0x18')]);router[_0xe450('0xb')]('/:id/applications',auth['isAuthenticated'](),controller[_0xe450('0x19')]);router[_0xe450('0xb')](_0xe450('0x1a'),auth[_0xe450('0x9')](),controller['getProactiveActions']);router['get'](_0xe450('0x1b'),controller['getFields']);router['get'](_0xe450('0x1c'),auth[_0xe450('0x9')](),controller[_0xe450('0x1d')]);router[_0xe450('0xb')](_0xe450('0x1e'),auth['isAuthenticated'](),controller['getAgents']);router[_0xe450('0x1f')]('/',auth[_0xe450('0x9')](),controller[_0xe450('0x20')]);router['post'](_0xe450('0x21'),auth['isAuthenticated'](),controller[_0xe450('0x22')]);router[_0xe450('0x1f')]('/:id/canned_answers',auth[_0xe450('0x9')](),controller[_0xe450('0x23')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x714d8b,_0x12ad4a,_0x435e00){_0x435e00(null,path[_0xe450('0x24')](config[_0xe450('0x25')],'server/files/images/logos/'));},'filename':function(_0x48583a,_0x7309e7,_0x28abe0){_0x28abe0(null,util[_0xe450('0x26')](_0xe450('0x27'),Date['now'](),_0x7309e7[_0xe450('0x28')]));}})});router[_0xe450('0x1f')](_0xe450('0x11'),upload[_0xe450('0x29')](_0xe450('0x2a')),controller[_0xe450('0x2b')]);var upload=multer({'storage':multer[_0xe450('0x2c')]({'destination':function(_0x40613b,_0x55f5a7,_0x1fa75a){_0x1fa75a(null,path['join'](config['root'],'server/files/images/avatars/'));},'filename':function(_0x4c4f81,_0x137cd2,_0x4dee86){_0x4dee86(null,util[_0xe450('0x26')]('%s-%s',Date[_0xe450('0x2d')](),_0x137cd2[_0xe450('0x28')]));}})});router[_0xe450('0x1f')](_0xe450('0x2e'),upload[_0xe450('0x29')](_0xe450('0x2a')),controller[_0xe450('0x2f')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x46c5cb,_0x5968ae,_0x12fc63){_0x12fc63(null,path[_0xe450('0x24')](config[_0xe450('0x25')],_0xe450('0x30')));},'filename':function(_0x30bce0,_0x8fed00,_0x4f17e3){_0x4f17e3(null,util[_0xe450('0x26')](_0xe450('0x27'),Date['now'](),_0x8fed00['originalname']));}})});router[_0xe450('0x1f')](_0xe450('0x31'),upload['single'](_0xe450('0x2a')),controller[_0xe450('0x32')]);var upload=multer({'storage':multer[_0xe450('0x2c')]({'destination':function(_0x3d96aa,_0x495035,_0x493128){_0x493128(null,path[_0xe450('0x24')](config[_0xe450('0x25')],_0xe450('0x30')));},'filename':function(_0x24c73f,_0x348ecf,_0x54ba68){_0x54ba68(null,util[_0xe450('0x26')](_0xe450('0x27'),Date['now'](),_0x348ecf['originalname']));}})});router[_0xe450('0x1f')](_0xe450('0x15'),upload['single']('file'),controller[_0xe450('0x33')]);router[_0xe450('0x1f')](_0xe450('0x34'),controller['notify']);const offlineUploadMulter=multer({'storage':multer['diskStorage']({'destination':function(_0x368025,_0x1ee9cc,_0x256f50){const _0xfb0ce4=path[_0xe450('0x24')](config[_0xe450('0x25')],'server/files','attachments',_0xe450('0x35'));fs_extra[_0xe450('0x36')](_0xfb0ce4,function(){_0x256f50(null,_0xfb0ce4);});},'filename':function(_0x3cc074,_0x2f87d9,_0x4d5cab){const _0x5a4912=_0x2f87d9['originalname'][_0xe450('0x37')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x41fdd4=path[_0xe450('0x38')](_0x5a4912);const _0x4e0c5c=Date['now']()+'-'+_0x5a4912[_0xe450('0x37')](_0x41fdd4,'')+_0x41fdd4;_0x4d5cab(null,_0x4e0c5c);}})});router['post'](_0xe450('0x39'),offlineUploadMulter['any'](),controller['offline']);router[_0xe450('0x1f')](_0xe450('0x3a'),auth['isAuthenticated'](),controller['addInteraction']);router[_0xe450('0x1f')](_0xe450('0x3b'),auth['isAuthenticated'](),controller[_0xe450('0x3c')]);router['post'](_0xe450('0x1a'),auth['isAuthenticated'](),controller[_0xe450('0x3d')]);router[_0xe450('0x1f')](_0xe450('0x1e'),auth[_0xe450('0x9')](),controller[_0xe450('0x3e')]);router[_0xe450('0x3f')](_0xe450('0xd'),auth[_0xe450('0x9')](),controller[_0xe450('0x40')]);router[_0xe450('0x41')](_0xe450('0xd'),auth[_0xe450('0x9')](),controller[_0xe450('0x42')]);router['delete'](_0xe450('0x21'),auth[_0xe450('0x9')](),controller[_0xe450('0x43')]);router[_0xe450('0x41')](_0xe450('0xf'),auth[_0xe450('0x9')](),controller[_0xe450('0x44')]);router['delete'](_0xe450('0x1e'),auth[_0xe450('0x9')](),controller[_0xe450('0x45')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index f8461e1..89aeb71 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 _0x6e1d=['app','/client-logs','use','isAuthenticated','exports','beaver-logger/server','../components/auth/service','../config/environment','Router','env','production'];(function(_0x189897,_0x581133){var _0x3fac4c=function(_0x25c64a){while(--_0x25c64a){_0x189897['push'](_0x189897['shift']());}};_0x3fac4c(++_0x581133);}(_0x6e1d,0x9f));var _0xd6e1=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0x6e1d[_0xc6be3a];return _0x56a310;};var beaverLogger=require(_0xd6e1('0x0'));var express=require('express');var auth=require(_0xd6e1('0x1'));var config=require(_0xd6e1('0x2'));var router=express[_0xd6e1('0x3')]();var isProduction=config[_0xd6e1('0x4')]===_0xd6e1('0x5')||![];function clientSideLogs(_0x1f71e5,_0x5e65d1,_0x434fd5){var _0x31eaa1=_0x1f71e5[_0xd6e1('0x6')]['get']('client-side-logger');if(!_0x31eaa1){throw new Error('Client-Side\x20logger\x20not\x20found!');}return beaverLogger['expressEndpoint']({'uri':_0xd6e1('0x7'),'logger':_0x31eaa1,'enableCors':!isProduction})(_0x1f71e5,_0x5e65d1,_0x434fd5);}router[_0xd6e1('0x8')](auth[_0xd6e1('0x9')](),clientSideLogs);module[_0xd6e1('0xa')]=router; \ No newline at end of file +var _0xe929=['beaver-logger/server','Router','env','production','app','client-side-logger','Client-Side\x20logger\x20not\x20found!','expressEndpoint','/client-logs','use','isAuthenticated','exports'];(function(_0x359cfb,_0x1040ba){var _0x3eef3b=function(_0x3bde59){while(--_0x3bde59){_0x359cfb['push'](_0x359cfb['shift']());}};_0x3eef3b(++_0x1040ba);}(_0xe929,0x78));var _0x9e92=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xe929[_0x521929];return _0x632436;};var beaverLogger=require(_0x9e92('0x0'));var express=require('express');var auth=require('../components/auth/service');var config=require('../config/environment');var router=express[_0x9e92('0x1')]();var isProduction=config[_0x9e92('0x2')]===_0x9e92('0x3')||![];function clientSideLogs(_0x3200d0,_0x3763da,_0x516798){var _0x12c5ee=_0x3200d0[_0x9e92('0x4')]['get'](_0x9e92('0x5'));if(!_0x12c5ee){throw new Error(_0x9e92('0x6'));}return beaverLogger[_0x9e92('0x7')]({'uri':_0x9e92('0x8'),'logger':_0x12c5ee,'enableCors':!isProduction})(_0x3200d0,_0x3763da,_0x516798);}router[_0x9e92('0x9')](auth[_0x9e92('0xa')](),clientSideLogs);module[_0x9e92('0xb')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 96beadd..84d64dc 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 _0x5cfa=['Google','MicrosoftAzure','Outlook365','Dynamics365','MicrosoftAzure\x20=>\x20tenant','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','exports','STRING','ENUM'];(function(_0x1e4489,_0x3a9682){var _0x314f61=function(_0x510030){while(--_0x510030){_0x1e4489['push'](_0x1e4489['shift']());}};_0x314f61(++_0x3a9682);}(_0x5cfa,0x8b));var _0xa5cf=function(_0x515452,_0x1142ca){_0x515452=_0x515452-0x0;var _0x6a2d7d=_0x5cfa[_0x515452];return _0x6a2d7d;};'use strict';var Sequelize=require(_0xa5cf('0x0'));module[_0xa5cf('0x1')]={'name':{'type':Sequelize[_0xa5cf('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xa5cf('0x3')]('AmazonAWS',_0xa5cf('0x4'),_0xa5cf('0x5')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0xa5cf('0x3')](_0xa5cf('0x6'),_0xa5cf('0x7'))},'data1':{'type':Sequelize[_0xa5cf('0x2')],'comment':'MicrosoftAzure\x20=>\x20client_id'},'data2':{'type':Sequelize[_0xa5cf('0x2')],'comment':_0xa5cf('0x8')},'data3':{'type':Sequelize['STRING'],'comment':'MicrosoftAzure\x20=>\x20client_secret'},'data4':{'type':Sequelize[_0xa5cf('0x2')],'comment':'MicrosoftAzure\x20=>\x20redirect_uri'},'data5':{'type':Sequelize[_0xa5cf('0x9')],'comment':_0xa5cf('0xa')},'data6':{'type':Sequelize[_0xa5cf('0x9')],'comment':_0xa5cf('0xb')},'data7':{'type':Sequelize[_0xa5cf('0x9')],'comment':_0xa5cf('0xc')}}; \ No newline at end of file +var _0x8416=['ENUM','AmazonAWS','MicrosoftAzure','Outlook365','Dynamics365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','exports','STRING'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8416,0xdd));var _0x6841=function(_0x5c2e65,_0x20e630){_0x5c2e65=_0x5c2e65-0x0;var _0x445359=_0x8416[_0x5c2e65];return _0x445359;};'use strict';var Sequelize=require(_0x6841('0x0'));module[_0x6841('0x1')]={'name':{'type':Sequelize[_0x6841('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x6841('0x3')](_0x6841('0x4'),'Google',_0x6841('0x5')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x6841('0x3')](_0x6841('0x6'),_0x6841('0x7'))},'data1':{'type':Sequelize[_0x6841('0x2')],'comment':_0x6841('0x8')},'data2':{'type':Sequelize[_0x6841('0x2')],'comment':_0x6841('0x9')},'data3':{'type':Sequelize[_0x6841('0x2')],'comment':_0x6841('0xa')},'data4':{'type':Sequelize[_0x6841('0x2')],'comment':_0x6841('0xb')},'data5':{'type':Sequelize[_0x6841('0xc')],'comment':_0x6841('0xd')},'data6':{'type':Sequelize['TEXT'],'comment':_0x6841('0xe')},'data7':{'type':Sequelize[_0x6841('0xc')],'comment':_0x6841('0xf')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index fb6162c..d6c749f 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 _0x38cb=['key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','service','MicrosoftAzure','data3','catch','show','params','find','body','Name\x20parameter\x20not\x20specified','includes','join','create','encryptString','destroy','findOne','oauth2MicrosoftCallback','error','state','Invalid\x20state\x20parameter','parse','from','base64','toString','ascii','isValidIdToken','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','code','data5','access_token','data6','refresh_token','microsoftAuthorization:success','microsoftAuthorization:error','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','lodash','ioredis','../../components/parsers/qs','../../config/environment','../../config/logger','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','offset','limit','undefined','count','Content-Range','update','then','stack','name','send','padEnd','index','map','CloudProvider','rawAttributes','fieldName','type'];(function(_0x211bc3,_0x5860c8){var _0x34c9a2=function(_0x4bfa37){while(--_0x4bfa37){_0x211bc3['push'](_0x211bc3['shift']());}};_0x34c9a2(++_0x5860c8);}(_0x38cb,0x18c));var _0xb38c=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0x38cb[_0x4709c0];return _0x13348b;};'use strict';var _=require(_0xb38c('0x0'));var Redis=require(_0xb38c('0x1'));var qs=require(_0xb38c('0x2'));var encryptor=require('../../components/encryptor');var config=require(_0xb38c('0x3'));var logger=require(_0xb38c('0x4'))('api');var db=require('../../mysqldb')['db'];var oauth=require('./cloudProvider.oauth');config[_0xb38c('0x5')]=_[_0xb38c('0x6')](config[_0xb38c('0x5')],{'host':_0xb38c('0x7'),'port':0x18eb});var socket=require(_0xb38c('0x8'))(new Redis(config[_0xb38c('0x5')]));var redis=new Redis(config[_0xb38c('0x5')]);function respondWithStatusCode(_0x551d31,_0x5be430){_0x5be430=_0x5be430||0xcc;return function(_0x1fe9b2){if(_0x1fe9b2){return _0x551d31[_0xb38c('0x9')](_0x5be430);}return _0x551d31[_0xb38c('0xa')](_0x5be430)[_0xb38c('0xb')]();};}function respondWithResult(_0x1436ab,_0x26cc8b){_0x26cc8b=_0x26cc8b||0xc8;return function(_0x53da9b){if(_0x53da9b){return _0x1436ab[_0xb38c('0xa')](_0x26cc8b)['json'](_0x53da9b);}};}function respondWithFilteredResult(_0x399fec,_0x21600a){return function(_0x28d7a7){if(_0x28d7a7){var _0x37d61f=typeof _0x21600a[_0xb38c('0xc')]==='undefined'&&typeof _0x21600a[_0xb38c('0xd')]===_0xb38c('0xe');var _0x9f7b56=_0x28d7a7['count'];var _0x434195=_0x37d61f?0x0:_0x21600a['offset'];var _0x228b7d=_0x37d61f?_0x28d7a7[_0xb38c('0xf')]:_0x21600a[_0xb38c('0xc')]+_0x21600a['limit'];var _0x503a21;if(_0x228b7d>=_0x9f7b56){_0x228b7d=_0x9f7b56;_0x503a21=0xc8;}else{_0x503a21=0xce;}_0x399fec[_0xb38c('0xa')](_0x503a21);return _0x399fec['set'](_0xb38c('0x10'),_0x434195+'-'+_0x228b7d+'/'+_0x9f7b56)['json'](_0x28d7a7);}return null;};}function saveUpdates(_0x124cd8){return function(_0x112223){if(_0x112223){return _0x112223[_0xb38c('0x11')](_0x124cd8)[_0xb38c('0x12')](function(_0x33b994){return _0x33b994;});}return null;};}function removeEntity(_0x4c6c9c){return function(_0xdf116){if(_0xdf116){return _0xdf116['destroy']()[_0xb38c('0x12')](function(){_0x4c6c9c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c9cc4){return function(_0x236752){if(!_0x236752){_0x3c9cc4['sendStatus'](0x194);}return _0x236752;};}function handleError(_0x214122,_0x24c39e){_0x24c39e=_0x24c39e||0x1f4;return function(_0x4c8196){logger['error'](_0x4c8196[_0xb38c('0x13')]);if(_0x4c8196[_0xb38c('0x14')]){delete _0x4c8196[_0xb38c('0x14')];}_0x214122[_0xb38c('0xa')](_0x24c39e)[_0xb38c('0x15')](_0x4c8196);};}function maskClientSecret(_0x4809bf){return _[_0xb38c('0x16')](_0x4809bf['slice'](0x0,0x3),0x14,'*');}exports[_0xb38c('0x17')]=function(_0x40e430,_0x539f10){var _0x210a63={},_0xfdec87={},_0x4f0e31={'count':0x0,'rows':[]};var _0x28078c=_[_0xb38c('0x18')](db[_0xb38c('0x19')][_0xb38c('0x1a')],function(_0x2caa48){return{'name':_0x2caa48[_0xb38c('0x1b')],'type':_0x2caa48[_0xb38c('0x1c')][_0xb38c('0x1d')]};});_0xfdec87[_0xb38c('0x1e')]=_[_0xb38c('0x18')](_0x28078c,_0xb38c('0x14'));_0xfdec87[_0xb38c('0x1f')]=_[_0xb38c('0x20')](_0x40e430[_0xb38c('0x1f')]);_0xfdec87['filters']=_[_0xb38c('0x21')](_0xfdec87['model'],_0xfdec87[_0xb38c('0x1f')]);_0x210a63[_0xb38c('0x22')]=_['intersection'](_0xfdec87['model'],qs[_0xb38c('0x23')](_0x40e430[_0xb38c('0x1f')][_0xb38c('0x23')]));_0x210a63['attributes']=_0x210a63['attributes']['length']?_0x210a63[_0xb38c('0x22')]:_0xfdec87[_0xb38c('0x1e')];if(!_0x40e430[_0xb38c('0x1f')][_0xb38c('0x24')](_0xb38c('0x25'))){_0x210a63[_0xb38c('0xd')]=qs[_0xb38c('0xd')](_0x40e430[_0xb38c('0x1f')]['limit']);_0x210a63[_0xb38c('0xc')]=qs['offset'](_0x40e430[_0xb38c('0x1f')][_0xb38c('0xc')]);}_0x210a63[_0xb38c('0x26')]=qs['sort'](_0x40e430[_0xb38c('0x1f')]['sort']);_0x210a63[_0xb38c('0x27')]=qs[_0xb38c('0x28')](_[_0xb38c('0x29')](_0x40e430[_0xb38c('0x1f')],_0xfdec87[_0xb38c('0x28')]),_0x28078c);if(_0x40e430[_0xb38c('0x1f')][_0xb38c('0x2a')]){_0x210a63[_0xb38c('0x27')]=_[_0xb38c('0x2b')](_0x210a63[_0xb38c('0x27')],{'$or':_['map'](_0x28078c,function(_0x3baee1){if(_0x3baee1[_0xb38c('0x1c')]!==_0xb38c('0x2c')){var _0x5a74a1={};_0x5a74a1[_0x3baee1[_0xb38c('0x14')]]={'$like':'%'+_0x40e430[_0xb38c('0x1f')][_0xb38c('0x2a')]+'%'};return _0x5a74a1;}})});}_0x210a63=_[_0xb38c('0x2b')]({},_0x210a63,_0x40e430[_0xb38c('0x2d')]);var _0x22f808={'where':_0x210a63[_0xb38c('0x27')]};return db[_0xb38c('0x19')]['count'](_0x22f808)[_0xb38c('0x12')](function(_0x186db6){_0x4f0e31[_0xb38c('0xf')]=_0x186db6;if(_0x40e430['query'][_0xb38c('0x2e')]){_0x210a63[_0xb38c('0x2f')]=[{'all':!![]}];}return db['CloudProvider'][_0xb38c('0x30')](_0x210a63);})[_0xb38c('0x12')](function(_0x1c01c6){_0x4f0e31['rows']=_[_0xb38c('0x18')](_0x1c01c6,function(_0x252c3c){if(_0x252c3c[_0xb38c('0x31')]===_0xb38c('0x32')){var _0x5d2080=encryptor['decryptString'](_0x252c3c[_0xb38c('0x33')]);_0x252c3c[_0xb38c('0x33')]=maskClientSecret(_0x5d2080);}return _0x252c3c;});return _0x4f0e31;})[_0xb38c('0x12')](respondWithFilteredResult(_0x539f10,_0x210a63))[_0xb38c('0x34')](handleError(_0x539f10,null));};exports[_0xb38c('0x35')]=function(_0x501cb4,_0x4d018c){var _0x2b0fa8={'raw':!![],'where':{'id':_0x501cb4[_0xb38c('0x36')]['id']}},_0x2d1162={};_0x2d1162[_0xb38c('0x1e')]=_[_0xb38c('0x20')](db[_0xb38c('0x19')][_0xb38c('0x1a')]);_0x2d1162['query']=_[_0xb38c('0x20')](_0x501cb4[_0xb38c('0x1f')]);_0x2d1162['filters']=_[_0xb38c('0x21')](_0x2d1162['model'],_0x2d1162[_0xb38c('0x1f')]);_0x2b0fa8[_0xb38c('0x22')]=_[_0xb38c('0x21')](_0x2d1162[_0xb38c('0x1e')],qs['fields'](_0x501cb4[_0xb38c('0x1f')][_0xb38c('0x23')]));_0x2b0fa8[_0xb38c('0x22')]=_0x2b0fa8[_0xb38c('0x22')]['length']?_0x2b0fa8[_0xb38c('0x22')]:_0x2d1162[_0xb38c('0x1e')];if(_0x501cb4[_0xb38c('0x1f')]['includeAll']){_0x2b0fa8[_0xb38c('0x2f')]=[{'all':!![]}];}_0x2b0fa8=_[_0xb38c('0x2b')]({},_0x2b0fa8,_0x501cb4[_0xb38c('0x2d')]);return db[_0xb38c('0x19')][_0xb38c('0x37')](_0x2b0fa8)[_0xb38c('0x12')](handleEntityNotFound(_0x4d018c,null))['then'](function(_0x5a0127){if(_0x5a0127[_0xb38c('0x31')]===_0xb38c('0x32')){var _0x316934=encryptor['decryptString'](_0x5a0127[_0xb38c('0x33')]);_0x5a0127[_0xb38c('0x33')]=maskClientSecret(_0x316934);}return _0x5a0127;})[_0xb38c('0x12')](respondWithResult(_0x4d018c,null))['catch'](handleError(_0x4d018c,null));};exports['create']=function(_0x573edc,_0x47ae50){if(!_0x573edc[_0xb38c('0x38')][_0xb38c('0x14')])throw new Error(_0xb38c('0x39'));if(!_0x573edc['body'][_0xb38c('0x31')])throw new Error('Service\x20parameter\x20not\x20specified');var _0x3f75b5=db[_0xb38c('0x19')][_0xb38c('0x1a')]['service']['values'];if(!_0x3f75b5[_0xb38c('0x3a')](_0x573edc['body']['service']))throw new Error('Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20'+_0x3f75b5[_0xb38c('0x3b')](',\x20'));if(_0x573edc['body']['service']==='MicrosoftAzure'&&_0x573edc[_0xb38c('0x38')]['data3']){_0x573edc[_0xb38c('0x38')]['data3']=encryptor['encryptString'](_0x573edc['body'][_0xb38c('0x33')]);}return db[_0xb38c('0x19')][_0xb38c('0x3c')](_0x573edc[_0xb38c('0x38')],{})['then'](respondWithResult(_0x47ae50,0xc9))[_0xb38c('0x34')](handleError(_0x47ae50,null));};exports[_0xb38c('0x11')]=function(_0x54d500,_0x2e0069){if(_0x54d500[_0xb38c('0x38')]['id']){delete _0x54d500[_0xb38c('0x38')]['id'];}return db[_0xb38c('0x19')][_0xb38c('0x37')]({'where':{'id':_0x54d500[_0xb38c('0x36')]['id']}})[_0xb38c('0x12')](handleEntityNotFound(_0x2e0069,null))[_0xb38c('0x12')](function(_0x44adf5){if(_0x44adf5[_0xb38c('0x31')]===_0xb38c('0x32')&&_0x54d500['body']['data3']){_0x54d500['body'][_0xb38c('0x33')]=encryptor[_0xb38c('0x3d')](_0x54d500[_0xb38c('0x38')][_0xb38c('0x33')]);}return _0x44adf5;})[_0xb38c('0x12')](saveUpdates(_0x54d500['body'],null))['then'](respondWithResult(_0x2e0069,null))[_0xb38c('0x34')](handleError(_0x2e0069,null));};exports[_0xb38c('0x3e')]=function(_0x1cb17e,_0x2157b4){return db[_0xb38c('0x19')][_0xb38c('0x37')]({'where':{'id':_0x1cb17e[_0xb38c('0x36')]['id']}})[_0xb38c('0x12')](handleEntityNotFound(_0x2157b4,null))[_0xb38c('0x12')](removeEntity(_0x2157b4,null))['catch'](handleError(_0x2157b4,null));};exports['oauth2MicrosoftAuthorize']=function(_0x348485,_0x4f9d46){return db[_0xb38c('0x19')][_0xb38c('0x3f')]({'where':{'id':_0x348485[_0xb38c('0x36')]['id']},'raw':!![]})[_0xb38c('0x12')](function(_0x37b560){if(!_0x37b560)return _0x4f9d46['sendStatus'](0x194);return{'url':oauth['generateMicrosoftAuthorizationUrl'](_0x37b560,_0x348485['user']['id'])};})[_0xb38c('0x12')](respondWithResult(_0x4f9d46,null))[_0xb38c('0x34')](handleError(_0x4f9d46,null));};exports[_0xb38c('0x40')]=function(_0x23422d,_0x11497f){var _0x5beadb=_0x23422d[_0xb38c('0x38')];var _0xecf870;var _0xc3f8f1;if(_0x5beadb[_0xb38c('0x41')])throw _0x5beadb;redis['get'](_0x5beadb[_0xb38c('0x42')])[_0xb38c('0x12')](function(_0x1981b6){if(!_0x1981b6)throw new Error(_0xb38c('0x43'));_0xecf870=JSON[_0xb38c('0x44')](_0x1981b6);var _0x2a788f=Buffer[_0xb38c('0x45')](_0x5beadb[_0xb38c('0x42')],_0xb38c('0x46'))[_0xb38c('0x47')](_0xb38c('0x48'));_0xc3f8f1=JSON['parse'](_0x2a788f);if(!oauth[_0xb38c('0x49')](_0x5beadb[_0xb38c('0x4a')],_0xecf870[_0xb38c('0x4b')]))throw new Error(_0xb38c('0x4c'));redis['del'](_0x5beadb[_0xb38c('0x42')]);return oauth['getOauth2MicrosoftAccessToken'](_0x5beadb[_0xb38c('0x4d')],_0xecf870);})[_0xb38c('0x12')](function(_0x22c95b){_0xecf870[_0xb38c('0x4e')]=_0x22c95b[_0xb38c('0x4f')];_0xecf870[_0xb38c('0x50')]=_0x22c95b[_0xb38c('0x51')];return db[_0xb38c('0x19')][_0xb38c('0x11')]({'data5':_0xecf870[_0xb38c('0x4e')],'data6':_0xecf870['data6']},{'where':{'id':_0xecf870['id']}});})['then'](function(){oauth['startRefreshInterval'](_0xecf870);socket['emit'](_0xb38c('0x52'),{'id':_0xc3f8f1['id']});return;})[_0xb38c('0x12')](respondWithStatusCode(_0x11497f,null))[_0xb38c('0x34')](function(_0x476fed){if(_0xc3f8f1){socket['emit'](_0xb38c('0x53'),{'id':_0xc3f8f1['id']});}if(!_0xecf870){logger[_0xb38c('0x41')]('Invalid\x20authentication\x20state\x20parameter',_0x476fed);return _0x11497f[_0xb38c('0xa')](0x1f4)[_0xb38c('0x15')](_0x476fed['message']);}logger[_0xb38c('0x41')](_0xb38c('0x54'),_0xecf870['id'],JSON['stringify'](_0x476fed));});}; \ No newline at end of file +var _0x86b7=['refresh_token','startRefreshInterval','emit','microsoftAuthorization:success','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','send','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','lodash','ioredis','../../components/parsers/qs','../../components/encryptor','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','json','offset','undefined','count','set','update','then','destroy','error','stack','name','padEnd','slice','index','CloudProvider','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','service','MicrosoftAzure','decryptString','data3','catch','show','params','include','find','create','body','Service\x20parameter\x20not\x20specified','values','includes','join','encryptString','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','user','oauth2MicrosoftCallback','state','Invalid\x20state\x20parameter','parse','from','base64','ascii','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','getOauth2MicrosoftAccessToken','code','data5','access_token','data6'];(function(_0x2cc77e,_0x229fbf){var _0x2332fa=function(_0xbd19f){while(--_0xbd19f){_0x2cc77e['push'](_0x2cc77e['shift']());}};_0x2332fa(++_0x229fbf);}(_0x86b7,0x139));var _0x786b=function(_0x3f1085,_0x2c3424){_0x3f1085=_0x3f1085-0x0;var _0x49bc8b=_0x86b7[_0x3f1085];return _0x49bc8b;};'use strict';var _=require(_0x786b('0x0'));var Redis=require(_0x786b('0x1'));var qs=require(_0x786b('0x2'));var encryptor=require(_0x786b('0x3'));var config=require('../../config/environment');var logger=require(_0x786b('0x4'))(_0x786b('0x5'));var db=require(_0x786b('0x6'))['db'];var oauth=require('./cloudProvider.oauth');config[_0x786b('0x7')]=_[_0x786b('0x8')](config[_0x786b('0x7')],{'host':_0x786b('0x9'),'port':0x18eb});var socket=require(_0x786b('0xa'))(new Redis(config[_0x786b('0x7')]));var redis=new Redis(config[_0x786b('0x7')]);function respondWithStatusCode(_0x1d960b,_0x4f5935){_0x4f5935=_0x4f5935||0xcc;return function(_0x35d61a){if(_0x35d61a){return _0x1d960b[_0x786b('0xb')](_0x4f5935);}return _0x1d960b[_0x786b('0xc')](_0x4f5935)[_0x786b('0xd')]();};}function respondWithResult(_0xaaea94,_0x34a961){_0x34a961=_0x34a961||0xc8;return function(_0x5612ef){if(_0x5612ef){return _0xaaea94[_0x786b('0xc')](_0x34a961)[_0x786b('0xe')](_0x5612ef);}};}function respondWithFilteredResult(_0x275f18,_0x13ef1d){return function(_0x1039ec){if(_0x1039ec){var _0x480f03=typeof _0x13ef1d[_0x786b('0xf')]===_0x786b('0x10')&&typeof _0x13ef1d['limit']==='undefined';var _0x5b430e=_0x1039ec[_0x786b('0x11')];var _0x5dfc49=_0x480f03?0x0:_0x13ef1d[_0x786b('0xf')];var _0x5b93b6=_0x480f03?_0x1039ec[_0x786b('0x11')]:_0x13ef1d[_0x786b('0xf')]+_0x13ef1d['limit'];var _0x341591;if(_0x5b93b6>=_0x5b430e){_0x5b93b6=_0x5b430e;_0x341591=0xc8;}else{_0x341591=0xce;}_0x275f18[_0x786b('0xc')](_0x341591);return _0x275f18[_0x786b('0x12')]('Content-Range',_0x5dfc49+'-'+_0x5b93b6+'/'+_0x5b430e)[_0x786b('0xe')](_0x1039ec);}return null;};}function saveUpdates(_0x35052f){return function(_0x2053e1){if(_0x2053e1){return _0x2053e1[_0x786b('0x13')](_0x35052f)[_0x786b('0x14')](function(_0x4aa4e1){return _0x4aa4e1;});}return null;};}function removeEntity(_0x1c1968){return function(_0x37cd2e){if(_0x37cd2e){return _0x37cd2e[_0x786b('0x15')]()[_0x786b('0x14')](function(){_0x1c1968['status'](0xcc)[_0x786b('0xd')]();});}};}function handleEntityNotFound(_0x439f3f){return function(_0x4e8424){if(!_0x4e8424){_0x439f3f[_0x786b('0xb')](0x194);}return _0x4e8424;};}function handleError(_0x475003,_0x31e2c3){_0x31e2c3=_0x31e2c3||0x1f4;return function(_0x60c554){logger[_0x786b('0x16')](_0x60c554[_0x786b('0x17')]);if(_0x60c554[_0x786b('0x18')]){delete _0x60c554['name'];}_0x475003[_0x786b('0xc')](_0x31e2c3)['send'](_0x60c554);};}function maskClientSecret(_0x4c4a76){return _[_0x786b('0x19')](_0x4c4a76[_0x786b('0x1a')](0x0,0x3),0x14,'*');}exports[_0x786b('0x1b')]=function(_0x2f1533,_0x32f7ad){var _0x2aa4c5={},_0x1cd287={},_0xee751a={'count':0x0,'rows':[]};var _0x31a861=_['map'](db[_0x786b('0x1c')][_0x786b('0x1d')],function(_0x317e49){return{'name':_0x317e49[_0x786b('0x1e')],'type':_0x317e49[_0x786b('0x1f')][_0x786b('0x20')]};});_0x1cd287[_0x786b('0x21')]=_[_0x786b('0x22')](_0x31a861,_0x786b('0x18'));_0x1cd287[_0x786b('0x23')]=_[_0x786b('0x24')](_0x2f1533[_0x786b('0x23')]);_0x1cd287['filters']=_[_0x786b('0x25')](_0x1cd287[_0x786b('0x21')],_0x1cd287[_0x786b('0x23')]);_0x2aa4c5['attributes']=_[_0x786b('0x25')](_0x1cd287[_0x786b('0x21')],qs[_0x786b('0x26')](_0x2f1533['query'][_0x786b('0x26')]));_0x2aa4c5[_0x786b('0x27')]=_0x2aa4c5['attributes'][_0x786b('0x28')]?_0x2aa4c5[_0x786b('0x27')]:_0x1cd287[_0x786b('0x21')];if(!_0x2f1533['query'][_0x786b('0x29')](_0x786b('0x2a'))){_0x2aa4c5['limit']=qs[_0x786b('0x2b')](_0x2f1533[_0x786b('0x23')]['limit']);_0x2aa4c5[_0x786b('0xf')]=qs['offset'](_0x2f1533[_0x786b('0x23')][_0x786b('0xf')]);}_0x2aa4c5[_0x786b('0x2c')]=qs[_0x786b('0x2d')](_0x2f1533['query'][_0x786b('0x2d')]);_0x2aa4c5[_0x786b('0x2e')]=qs[_0x786b('0x2f')](_[_0x786b('0x30')](_0x2f1533['query'],_0x1cd287[_0x786b('0x2f')]),_0x31a861);if(_0x2f1533[_0x786b('0x23')][_0x786b('0x31')]){_0x2aa4c5[_0x786b('0x2e')]=_[_0x786b('0x32')](_0x2aa4c5['where'],{'$or':_[_0x786b('0x22')](_0x31a861,function(_0x323458){if(_0x323458[_0x786b('0x1f')]!==_0x786b('0x33')){var _0x4e6a82={};_0x4e6a82[_0x323458[_0x786b('0x18')]]={'$like':'%'+_0x2f1533[_0x786b('0x23')][_0x786b('0x31')]+'%'};return _0x4e6a82;}})});}_0x2aa4c5=_['merge']({},_0x2aa4c5,_0x2f1533[_0x786b('0x34')]);var _0x38288f={'where':_0x2aa4c5[_0x786b('0x2e')]};return db['CloudProvider']['count'](_0x38288f)['then'](function(_0x59ee8e){_0xee751a[_0x786b('0x11')]=_0x59ee8e;if(_0x2f1533['query'][_0x786b('0x35')]){_0x2aa4c5['include']=[{'all':!![]}];}return db[_0x786b('0x1c')][_0x786b('0x36')](_0x2aa4c5);})[_0x786b('0x14')](function(_0x438cb3){_0xee751a[_0x786b('0x37')]=_[_0x786b('0x22')](_0x438cb3,function(_0x35a1e8){if(_0x35a1e8[_0x786b('0x38')]===_0x786b('0x39')){var _0xbfb93a=encryptor[_0x786b('0x3a')](_0x35a1e8['data3']);_0x35a1e8[_0x786b('0x3b')]=maskClientSecret(_0xbfb93a);}return _0x35a1e8;});return _0xee751a;})[_0x786b('0x14')](respondWithFilteredResult(_0x32f7ad,_0x2aa4c5))[_0x786b('0x3c')](handleError(_0x32f7ad,null));};exports[_0x786b('0x3d')]=function(_0x3c7a1a,_0x313d4a){var _0x5b6297={'raw':!![],'where':{'id':_0x3c7a1a[_0x786b('0x3e')]['id']}},_0x9a5cff={};_0x9a5cff[_0x786b('0x21')]=_['keys'](db[_0x786b('0x1c')][_0x786b('0x1d')]);_0x9a5cff[_0x786b('0x23')]=_[_0x786b('0x24')](_0x3c7a1a[_0x786b('0x23')]);_0x9a5cff['filters']=_[_0x786b('0x25')](_0x9a5cff['model'],_0x9a5cff[_0x786b('0x23')]);_0x5b6297[_0x786b('0x27')]=_[_0x786b('0x25')](_0x9a5cff[_0x786b('0x21')],qs[_0x786b('0x26')](_0x3c7a1a[_0x786b('0x23')]['fields']));_0x5b6297['attributes']=_0x5b6297[_0x786b('0x27')]['length']?_0x5b6297[_0x786b('0x27')]:_0x9a5cff[_0x786b('0x21')];if(_0x3c7a1a['query'][_0x786b('0x35')]){_0x5b6297[_0x786b('0x3f')]=[{'all':!![]}];}_0x5b6297=_[_0x786b('0x32')]({},_0x5b6297,_0x3c7a1a[_0x786b('0x34')]);return db[_0x786b('0x1c')][_0x786b('0x40')](_0x5b6297)[_0x786b('0x14')](handleEntityNotFound(_0x313d4a,null))['then'](function(_0x3c43ba){if(_0x3c43ba['service']===_0x786b('0x39')){var _0x5ecba7=encryptor[_0x786b('0x3a')](_0x3c43ba[_0x786b('0x3b')]);_0x3c43ba[_0x786b('0x3b')]=maskClientSecret(_0x5ecba7);}return _0x3c43ba;})[_0x786b('0x14')](respondWithResult(_0x313d4a,null))['catch'](handleError(_0x313d4a,null));};exports[_0x786b('0x41')]=function(_0x5566ac,_0x5e1beb){if(!_0x5566ac[_0x786b('0x42')][_0x786b('0x18')])throw new Error('Name\x20parameter\x20not\x20specified');if(!_0x5566ac[_0x786b('0x42')][_0x786b('0x38')])throw new Error(_0x786b('0x43'));var _0x49be70=db['CloudProvider']['rawAttributes'][_0x786b('0x38')][_0x786b('0x44')];if(!_0x49be70[_0x786b('0x45')](_0x5566ac[_0x786b('0x42')][_0x786b('0x38')]))throw new Error('Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20'+_0x49be70[_0x786b('0x46')](',\x20'));if(_0x5566ac[_0x786b('0x42')][_0x786b('0x38')]===_0x786b('0x39')&&_0x5566ac[_0x786b('0x42')][_0x786b('0x3b')]){_0x5566ac[_0x786b('0x42')][_0x786b('0x3b')]=encryptor[_0x786b('0x47')](_0x5566ac[_0x786b('0x42')][_0x786b('0x3b')]);}return db['CloudProvider']['create'](_0x5566ac[_0x786b('0x42')],{})[_0x786b('0x14')](respondWithResult(_0x5e1beb,0xc9))[_0x786b('0x3c')](handleError(_0x5e1beb,null));};exports['update']=function(_0x257974,_0xde8281){if(_0x257974[_0x786b('0x42')]['id']){delete _0x257974[_0x786b('0x42')]['id'];}return db['CloudProvider']['find']({'where':{'id':_0x257974['params']['id']}})['then'](handleEntityNotFound(_0xde8281,null))['then'](function(_0x6d0720){if(_0x6d0720[_0x786b('0x38')]===_0x786b('0x39')&&_0x257974[_0x786b('0x42')][_0x786b('0x3b')]){_0x257974[_0x786b('0x42')]['data3']=encryptor[_0x786b('0x47')](_0x257974[_0x786b('0x42')]['data3']);}return _0x6d0720;})[_0x786b('0x14')](saveUpdates(_0x257974[_0x786b('0x42')],null))['then'](respondWithResult(_0xde8281,null))[_0x786b('0x3c')](handleError(_0xde8281,null));};exports[_0x786b('0x15')]=function(_0x461c6f,_0x3e534e){return db[_0x786b('0x1c')][_0x786b('0x40')]({'where':{'id':_0x461c6f['params']['id']}})[_0x786b('0x14')](handleEntityNotFound(_0x3e534e,null))[_0x786b('0x14')](removeEntity(_0x3e534e,null))[_0x786b('0x3c')](handleError(_0x3e534e,null));};exports[_0x786b('0x48')]=function(_0x43d306,_0x13c10c){return db[_0x786b('0x1c')][_0x786b('0x49')]({'where':{'id':_0x43d306['params']['id']},'raw':!![]})[_0x786b('0x14')](function(_0x42e51c){if(!_0x42e51c)return _0x13c10c[_0x786b('0xb')](0x194);return{'url':oauth[_0x786b('0x4a')](_0x42e51c,_0x43d306[_0x786b('0x4b')]['id'])};})[_0x786b('0x14')](respondWithResult(_0x13c10c,null))[_0x786b('0x3c')](handleError(_0x13c10c,null));};exports[_0x786b('0x4c')]=function(_0x3fdd4f,_0x229bb3){var _0xb493e8=_0x3fdd4f['body'];var _0x25fce4;var _0x22b9f8;if(_0xb493e8[_0x786b('0x16')])throw _0xb493e8;redis['get'](_0xb493e8[_0x786b('0x4d')])['then'](function(_0x254ff8){if(!_0x254ff8)throw new Error(_0x786b('0x4e'));_0x25fce4=JSON[_0x786b('0x4f')](_0x254ff8);var _0x229138=Buffer[_0x786b('0x50')](_0xb493e8[_0x786b('0x4d')],_0x786b('0x51'))['toString'](_0x786b('0x52'));_0x22b9f8=JSON[_0x786b('0x4f')](_0x229138);if(!oauth['isValidIdToken'](_0xb493e8[_0x786b('0x53')],_0x25fce4[_0x786b('0x54')]))throw new Error(_0x786b('0x55'));redis['del'](_0xb493e8['state']);return oauth[_0x786b('0x56')](_0xb493e8[_0x786b('0x57')],_0x25fce4);})['then'](function(_0x4c7ba2){_0x25fce4[_0x786b('0x58')]=_0x4c7ba2[_0x786b('0x59')];_0x25fce4[_0x786b('0x5a')]=_0x4c7ba2[_0x786b('0x5b')];return db[_0x786b('0x1c')][_0x786b('0x13')]({'data5':_0x25fce4[_0x786b('0x58')],'data6':_0x25fce4['data6']},{'where':{'id':_0x25fce4['id']}});})[_0x786b('0x14')](function(){oauth[_0x786b('0x5c')](_0x25fce4);socket[_0x786b('0x5d')](_0x786b('0x5e'),{'id':_0x22b9f8['id']});return;})[_0x786b('0x14')](respondWithStatusCode(_0x229bb3,null))[_0x786b('0x3c')](function(_0x45cf48){if(_0x22b9f8){socket['emit'](_0x786b('0x5f'),{'id':_0x22b9f8['id']});}if(!_0x25fce4){logger[_0x786b('0x16')](_0x786b('0x60'),_0x45cf48);return _0x229bb3['status'](0x1f4)[_0x786b('0x61')](_0x45cf48[_0x786b('0x62')]);}logger[_0x786b('0x16')](_0x786b('0x63'),_0x25fce4['id'],JSON[_0x786b('0x64')](_0x45cf48));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index a1237cc..1bd7232 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 _0x463f=['exports','define','cloud_providers','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./cloudProvider.attributes'];(function(_0x51b019,_0x13ccf6){var _0x3bc0f2=function(_0x145261){while(--_0x145261){_0x51b019['push'](_0x51b019['shift']());}};_0x3bc0f2(++_0x13ccf6);}(_0x463f,0x1e4));var _0xf463=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x463f[_0x178e48];return _0x440d7e;};'use strict';var _=require(_0xf463('0x0'));var util=require(_0xf463('0x1'));var logger=require(_0xf463('0x2'))(_0xf463('0x3'));var moment=require(_0xf463('0x4'));var BPromise=require(_0xf463('0x5'));var rp=require(_0xf463('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf463('0x7'));var config=require(_0xf463('0x8'));var attributes=require(_0xf463('0x9'));module[_0xf463('0xa')]=function(_0x49be3a,_0x433bd5){return _0x49be3a[_0xf463('0xb')]('CloudProvider',attributes,{'tableName':_0xf463('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x375c=['define','CloudProvider','cloud_providers','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./cloudProvider.attributes','exports'];(function(_0x273ccb,_0x3af838){var _0x42a6c0=function(_0x10efa1){while(--_0x10efa1){_0x273ccb['push'](_0x273ccb['shift']());}};_0x42a6c0(++_0x3af838);}(_0x375c,0x1a3));var _0xc375=function(_0xea24cc,_0x410f40){_0xea24cc=_0xea24cc-0x0;var _0x5c8b26=_0x375c[_0xea24cc];return _0x5c8b26;};'use strict';var _=require(_0xc375('0x0'));var util=require(_0xc375('0x1'));var logger=require(_0xc375('0x2'))(_0xc375('0x3'));var moment=require('moment');var BPromise=require(_0xc375('0x4'));var rp=require(_0xc375('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc375('0x6'));var config=require(_0xc375('0x7'));var attributes=require(_0xc375('0x8'));module[_0xc375('0x9')]=function(_0x20f640,_0x30e1ed){return _0x20f640[_0xc375('0xa')](_0xc375('0xb'),attributes,{'tableName':_0xc375('0xc'),'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 dfec910..a9b6241 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 _0x44a8=['all','catch','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','crypto','jsonwebtoken','moment','ioredis','../../components/encryptor','../../config/environment','api','../../config/schedule/cloud-provider','redis','defaults','openid','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','Outlook365','replace','{TENANT_ID}','data2','code','id_token','stringify','toString','base64','randomBytes','hex','client_id','response_type','join','redirect_uri','data4','response_mode','form_post','state','nonce','prompt','login','key','value','oauth2Claims','oauth2/','payload','iss','aud','audience','unix','exp','resolve','CloudProvider','findOne','then','data1','decryptString','data5','data6','refresh_token','update','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','intervals','bind'];(function(_0x16d022,_0x21e4ef){var _0x1e0b42=function(_0x3b5ed6){while(--_0x3b5ed6){_0x16d022['push'](_0x16d022['shift']());}};_0x1e0b42(++_0x21e4ef);}(_0x44a8,0x98));var _0x844a=function(_0xed7d14,_0x2a22f4){_0xed7d14=_0xed7d14-0x0;var _0x11edee=_0x44a8[_0xed7d14];return _0x11edee;};'use strict';var _=require('lodash');var crypto=require(_0x844a('0x0'));var jwt=require(_0x844a('0x1'));var moment=require(_0x844a('0x2'));var Redis=require(_0x844a('0x3'));var rp=require('request-promise');var util=require('util');var encryptor=require(_0x844a('0x4'));var config=require(_0x844a('0x5'));var logger=require('../../config/logger')(_0x844a('0x6'));var schedule=require(_0x844a('0x7'));var db=require('../../mysqldb')['db'];config[_0x844a('0x8')]=_[_0x844a('0x9')](config[_0x844a('0x8')],{'host':'localhost','port':0x18eb});var redis=new Redis(config[_0x844a('0x8')]);var MICROSOFT_AUTH_URL='https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0';var AZURE_AUTH_SCOPES={'Outlook365':[_0x844a('0xa'),'profile',_0x844a('0xb'),_0x844a('0xc'),_0x844a('0xd'),_0x844a('0xe'),_0x844a('0xf')],'Dynamics365':[_0x844a('0xa'),_0x844a('0xc')]};var MICROSOFT_AUTH_ENDPOINT='/authorize';var MICROSOFT_TOKEN_ENDPOINT=_0x844a('0x10');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x1f9128){var _0x5f0711=_[_0x844a('0x11')](AZURE_AUTH_SCOPES[_0x1f9128[_0x844a('0x12')]]);if(_0x1f9128['type']===_0x844a('0x13'))_0x5f0711[_0x844a('0x14')](_0x1f9128[_0x844a('0x15')]+_0x844a('0x16'));return _0x5f0711['join']('\x20');}function getAccessTokenScope(_0x45392e){if(_0x45392e[_0x844a('0x12')]===_0x844a('0x17'))return'https://outlook.office365.com/IMAP.AccessAsUser.All';if(_0x45392e[_0x844a('0x12')]===_0x844a('0x13'))return _0x45392e[_0x844a('0x15')]+'/.default';}function generateMicrosoftAuthorizationUrl(_0x59102f,_0x22d910){var _0x6caffa=MICROSOFT_AUTH_URL[_0x844a('0x18')](_0x844a('0x19'),_0x59102f[_0x844a('0x1a')]);var _0x57d2d8=[_0x844a('0x1b'),_0x844a('0x1c')];var _0x58633f=Buffer['from'](JSON[_0x844a('0x1d')]({'id':_0x22d910}))[_0x844a('0x1e')](_0x844a('0x1f'));var _0x221ac0=crypto[_0x844a('0x20')](0x10)[_0x844a('0x1e')](_0x844a('0x21'));var _0x4aaf29=getAuthorizationScopes(_0x59102f);var _0x292cea=[{'key':_0x844a('0x22'),'value':_0x59102f['data1']},{'key':_0x844a('0x23'),'value':encodeURIComponent(_0x57d2d8[_0x844a('0x24')]('\x20'))},{'key':_0x844a('0x25'),'value':_0x59102f[_0x844a('0x26')]},{'key':_0x844a('0x27'),'value':_0x844a('0x28')},{'key':'scope','value':encodeURIComponent(_0x4aaf29)},{'key':_0x844a('0x29'),'value':_0x58633f},{'key':_0x844a('0x2a'),'value':_0x221ac0},{'key':_0x844a('0x2b'),'value':_0x844a('0x2c')}];var _0x17b8f2=_0x6caffa+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x844a('0x11')](_0x292cea,function(_0x509665){return _0x509665[_0x844a('0x2d')]+'='+_0x509665[_0x844a('0x2e')];})[_0x844a('0x24')]('&');_0x59102f[_0x844a('0x2f')]={'issuer':_0x6caffa[_0x844a('0x18')](_0x844a('0x30'),''),'audience':_0x59102f['data1'],'state':_0x58633f,'nonce':_0x221ac0};redis['set'](_0x58633f,JSON['stringify'](_0x59102f));return _0x17b8f2;}function isValidIdToken(_0x4bccde,_0x1e8aae){try{var _0x43bc2d=jwt['decode'](_0x4bccde,{'complete':!![]});var _0x5db755=_0x43bc2d[_0x844a('0x31')];if(_0x5db755[_0x844a('0x32')]!==_0x1e8aae['issuer'])return![];if(_0x5db755[_0x844a('0x33')]!==_0x1e8aae[_0x844a('0x34')])return![];if(_0x5db755['nonce']!==_0x1e8aae[_0x844a('0x2a')])return![];if(moment()['isAfter'](moment[_0x844a('0x35')](_0x5db755[_0x844a('0x36')])))return![];return!![];}catch(_0x462ab5){throw _0x462ab5;}}function refreshOauth2MicrosoftAccessToken(_0x35f8c8){return Promise[_0x844a('0x37')]()['then'](function(){if(_0x35f8c8['data3'])return _0x35f8c8;return db[_0x844a('0x38')][_0x844a('0x39')]({'where':{'id':_0x35f8c8['id']},'raw':!![]});})[_0x844a('0x3a')](function(_0x103adb){var _0x5c9da4={'grant_type':'refresh_token','refresh_token':_0x103adb['data6'],'scope':getAccessTokenScope(_0x103adb),'redirect_uri':_0x103adb[_0x844a('0x26')],'client_id':_0x103adb[_0x844a('0x3b')],'client_secret':encryptor[_0x844a('0x3c')](_0x103adb['data3'])};var _0x555a5a={'method':'POST','uri':MICROSOFT_AUTH_URL[_0x844a('0x18')](_0x844a('0x19'),_0x103adb[_0x844a('0x1a')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x5c9da4,'json':!![]};return rp(_0x555a5a);})['then'](function(_0x7324e1){_0x35f8c8[_0x844a('0x3d')]=_0x7324e1['access_token'];_0x35f8c8[_0x844a('0x3e')]=_0x7324e1[_0x844a('0x3f')];return db[_0x844a('0x38')][_0x844a('0x40')]({'data5':_0x35f8c8[_0x844a('0x3d')],'data6':_0x35f8c8['data6']},{'where':{'id':_0x35f8c8['id']}});})[_0x844a('0x3a')](function(){return _0x35f8c8;})['catch'](function(_0x20553a){logger[_0x844a('0x41')](_0x844a('0x42'),_0x35f8c8['id'],_0x20553a);});}function getOauth2MicrosoftAccessToken(_0x56256b,_0x45b390){var _0x1a41e7={'grant_type':_0x844a('0x43'),'code':_0x56256b,'scope':getAccessTokenScope(_0x45b390),'redirect_uri':_0x45b390[_0x844a('0x26')],'client_id':_0x45b390[_0x844a('0x3b')],'client_secret':encryptor[_0x844a('0x3c')](_0x45b390['data3'])};var _0xc6bded={'method':'POST','uri':MICROSOFT_AUTH_URL[_0x844a('0x18')](_0x844a('0x19'),_0x45b390[_0x844a('0x1a')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x1a41e7,'json':!![]};return rp(_0xc6bded);}function startRefreshInterval(_0x598c76){var _0x3ed07d=schedule[_0x844a('0x44')];if(_0x3ed07d[_0x598c76['id']])clearInterval(_0x3ed07d[_0x598c76['id']]);_0x3ed07d[_0x598c76['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x844a('0x45')](this,{'id':_0x598c76['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x844a('0x44')]=_0x3ed07d;}function startAllRefreshIntervals(){return db[_0x844a('0x38')]['findAll']({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x844a('0x3a')](function(_0x59ae09){var _0x2d6e32=_0x59ae09[_0x844a('0x11')](function(_0x349d9c){return refreshOauth2MicrosoftAccessToken(_0x349d9c)[_0x844a('0x3a')](function(_0x547d8f){startRefreshInterval(_0x547d8f);});});return Promise[_0x844a('0x46')](_0x2d6e32);})[_0x844a('0x47')](function(_0x1a0971){var _0x59405d=_0x1a0971?util['inspect'](_0x1a0971,{'showHidden':![],'depth':null}):'';logger[_0x844a('0x41')](_0x844a('0x48'),_0x59405d);});}module[_0x844a('0x49')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0x1789=['jsonwebtoken','ioredis','request-promise','util','../../components/encryptor','../../config/environment','../../config/logger','api','../../mysqldb','redis','defaults','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','profile','email','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','/authorize','/token','map','type','Dynamics365','data7','/.default','Outlook365','{TENANT_ID}','data2','code','id_token','from','stringify','toString','base64','randomBytes','client_id','data1','response_type','join','redirect_uri','data4','form_post','state','prompt','login','key','value','oauth2Claims','oauth2/','set','decode','payload','iss','issuer','aud','audience','nonce','isAfter','unix','exp','resolve','data3','CloudProvider','then','data6','POST','access_token','refresh_token','update','data5','catch','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','decryptString','replace','intervals','bind','findAll','all','inspect','exports'];(function(_0x182ded,_0x5e0182){var _0x4d1f14=function(_0x4f6456){while(--_0x4f6456){_0x182ded['push'](_0x182ded['shift']());}};_0x4d1f14(++_0x5e0182);}(_0x1789,0x1ec));var _0x9178=function(_0x2ed88f,_0x5bc5ae){_0x2ed88f=_0x2ed88f-0x0;var _0x17ca96=_0x1789[_0x2ed88f];return _0x17ca96;};'use strict';var _=require('lodash');var crypto=require('crypto');var jwt=require(_0x9178('0x0'));var moment=require('moment');var Redis=require(_0x9178('0x1'));var rp=require(_0x9178('0x2'));var util=require(_0x9178('0x3'));var encryptor=require(_0x9178('0x4'));var config=require(_0x9178('0x5'));var logger=require(_0x9178('0x6'))(_0x9178('0x7'));var schedule=require('../../config/schedule/cloud-provider');var db=require(_0x9178('0x8'))['db'];config[_0x9178('0x9')]=_[_0x9178('0xa')](config[_0x9178('0x9')],{'host':_0x9178('0xb'),'port':0x18eb});var redis=new Redis(config[_0x9178('0x9')]);var MICROSOFT_AUTH_URL=_0x9178('0xc');var AZURE_AUTH_SCOPES={'Outlook365':[_0x9178('0xd'),_0x9178('0xe'),_0x9178('0xf'),_0x9178('0x10'),_0x9178('0x11'),'https://outlook.office.com/POP.AccessAsUser.All',_0x9178('0x12')],'Dynamics365':[_0x9178('0xd'),'offline_access']};var MICROSOFT_AUTH_ENDPOINT=_0x9178('0x13');var MICROSOFT_TOKEN_ENDPOINT=_0x9178('0x14');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x1aa2fd){var _0x324802=_[_0x9178('0x15')](AZURE_AUTH_SCOPES[_0x1aa2fd[_0x9178('0x16')]]);if(_0x1aa2fd[_0x9178('0x16')]===_0x9178('0x17'))_0x324802['push'](_0x1aa2fd[_0x9178('0x18')]+_0x9178('0x19'));return _0x324802['join']('\x20');}function getAccessTokenScope(_0x2e8850){if(_0x2e8850[_0x9178('0x16')]===_0x9178('0x1a'))return _0x9178('0x11');if(_0x2e8850[_0x9178('0x16')]===_0x9178('0x17'))return _0x2e8850['data7']+_0x9178('0x19');}function generateMicrosoftAuthorizationUrl(_0x5a62ec,_0x5001ac){var _0x88a071=MICROSOFT_AUTH_URL['replace'](_0x9178('0x1b'),_0x5a62ec[_0x9178('0x1c')]);var _0x29435c=[_0x9178('0x1d'),_0x9178('0x1e')];var _0x284d0e=Buffer[_0x9178('0x1f')](JSON[_0x9178('0x20')]({'id':_0x5001ac}))[_0x9178('0x21')](_0x9178('0x22'));var _0x315658=crypto[_0x9178('0x23')](0x10)[_0x9178('0x21')]('hex');var _0xcf23c2=getAuthorizationScopes(_0x5a62ec);var _0x134857=[{'key':_0x9178('0x24'),'value':_0x5a62ec[_0x9178('0x25')]},{'key':_0x9178('0x26'),'value':encodeURIComponent(_0x29435c[_0x9178('0x27')]('\x20'))},{'key':_0x9178('0x28'),'value':_0x5a62ec[_0x9178('0x29')]},{'key':'response_mode','value':_0x9178('0x2a')},{'key':'scope','value':encodeURIComponent(_0xcf23c2)},{'key':_0x9178('0x2b'),'value':_0x284d0e},{'key':'nonce','value':_0x315658},{'key':_0x9178('0x2c'),'value':_0x9178('0x2d')}];var _0x3377e2=_0x88a071+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x9178('0x15')](_0x134857,function(_0x3395ca){return _0x3395ca[_0x9178('0x2e')]+'='+_0x3395ca[_0x9178('0x2f')];})[_0x9178('0x27')]('&');_0x5a62ec[_0x9178('0x30')]={'issuer':_0x88a071['replace'](_0x9178('0x31'),''),'audience':_0x5a62ec['data1'],'state':_0x284d0e,'nonce':_0x315658};redis[_0x9178('0x32')](_0x284d0e,JSON[_0x9178('0x20')](_0x5a62ec));return _0x3377e2;}function isValidIdToken(_0x42a757,_0x5b6ba4){try{var _0x124e72=jwt[_0x9178('0x33')](_0x42a757,{'complete':!![]});var _0x2c49d2=_0x124e72[_0x9178('0x34')];if(_0x2c49d2[_0x9178('0x35')]!==_0x5b6ba4[_0x9178('0x36')])return![];if(_0x2c49d2[_0x9178('0x37')]!==_0x5b6ba4[_0x9178('0x38')])return![];if(_0x2c49d2[_0x9178('0x39')]!==_0x5b6ba4[_0x9178('0x39')])return![];if(moment()[_0x9178('0x3a')](moment[_0x9178('0x3b')](_0x2c49d2[_0x9178('0x3c')])))return![];return!![];}catch(_0x3b5042){throw _0x3b5042;}}function refreshOauth2MicrosoftAccessToken(_0x281673){return Promise[_0x9178('0x3d')]()['then'](function(){if(_0x281673[_0x9178('0x3e')])return _0x281673;return db[_0x9178('0x3f')]['findOne']({'where':{'id':_0x281673['id']},'raw':!![]});})[_0x9178('0x40')](function(_0x16007d){var _0x41347f={'grant_type':'refresh_token','refresh_token':_0x16007d[_0x9178('0x41')],'scope':getAccessTokenScope(_0x16007d),'redirect_uri':_0x16007d['data4'],'client_id':_0x16007d[_0x9178('0x25')],'client_secret':encryptor['decryptString'](_0x16007d['data3'])};var _0x260b7a={'method':_0x9178('0x42'),'uri':MICROSOFT_AUTH_URL['replace'](_0x9178('0x1b'),_0x16007d['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x41347f,'json':!![]};return rp(_0x260b7a);})['then'](function(_0x5561f3){_0x281673['data5']=_0x5561f3[_0x9178('0x43')];_0x281673[_0x9178('0x41')]=_0x5561f3[_0x9178('0x44')];return db['CloudProvider'][_0x9178('0x45')]({'data5':_0x281673[_0x9178('0x46')],'data6':_0x281673['data6']},{'where':{'id':_0x281673['id']}});})[_0x9178('0x40')](function(){return _0x281673;})[_0x9178('0x47')](function(_0xa51cf3){logger[_0x9178('0x48')](_0x9178('0x49'),_0x281673['id'],_0xa51cf3);});}function getOauth2MicrosoftAccessToken(_0x2c682c,_0x17e543){var _0x26abd9={'grant_type':'authorization_code','code':_0x2c682c,'scope':getAccessTokenScope(_0x17e543),'redirect_uri':_0x17e543[_0x9178('0x29')],'client_id':_0x17e543[_0x9178('0x25')],'client_secret':encryptor[_0x9178('0x4a')](_0x17e543[_0x9178('0x3e')])};var _0x2ed339={'method':'POST','uri':MICROSOFT_AUTH_URL[_0x9178('0x4b')](_0x9178('0x1b'),_0x17e543[_0x9178('0x1c')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x26abd9,'json':!![]};return rp(_0x2ed339);}function startRefreshInterval(_0x1e8455){var _0x37d0ac=schedule[_0x9178('0x4c')];if(_0x37d0ac[_0x1e8455['id']])clearInterval(_0x37d0ac[_0x1e8455['id']]);_0x37d0ac[_0x1e8455['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x9178('0x4d')](this,{'id':_0x1e8455['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule['intervals']=_0x37d0ac;}function startAllRefreshIntervals(){return db[_0x9178('0x3f')][_0x9178('0x4e')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x9178('0x40')](function(_0x50fb95){var _0x2b8e46=_0x50fb95[_0x9178('0x15')](function(_0x28afdb){return refreshOauth2MicrosoftAccessToken(_0x28afdb)[_0x9178('0x40')](function(_0x82ec46){startRefreshInterval(_0x82ec46);});});return Promise[_0x9178('0x4f')](_0x2b8e46);})[_0x9178('0x47')](function(_0x311f74){var _0x271a11=_0x311f74?util[_0x9178('0x50')](_0x311f74,{'showHidden':![],'depth':null}):'';logger['error']('[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s',_0x271a11);});}module[_0x9178('0x51')]={'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 692d196..37c6409 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 _0x9148=['../../config/utils','../../config/logger','rpc','../../config/environment','client','request','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x292021,_0x34e836){var _0x45abaf=function(_0x551c5c){while(--_0x551c5c){_0x292021['push'](_0x292021['shift']());}};_0x45abaf(++_0x34e836);}(_0x9148,0x10d));var _0x8914=function(_0x983796,_0x161e8a){_0x983796=_0x983796-0x0;var _0x3c9fd7=_0x9148[_0x983796];return _0x3c9fd7;};'use strict';var _=require(_0x8914('0x0'));var util=require(_0x8914('0x1'));var moment=require(_0x8914('0x2'));var BPromise=require(_0x8914('0x3'));var rs=require(_0x8914('0x4'));var fs=require('fs');var Redis=require(_0x8914('0x5'));var db=require(_0x8914('0x6'))['db'];var utils=require(_0x8914('0x7'));var logger=require(_0x8914('0x8'))(_0x8914('0x9'));var config=require(_0x8914('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x8914('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1cd146,_0x58e892,_0x1b0445){return new BPromise(function(_0x15aff5,_0x1e2d12){return client[_0x8914('0xc')](_0x1cd146,_0x1b0445)['then'](function(_0x2e7aac){logger[_0x8914('0xd')](_0x8914('0xe'),_0x58e892,_0x8914('0xf'));logger[_0x8914('0x10')]('CloudProvider,\x20%s,\x20%s,\x20%s',_0x58e892,_0x8914('0xf'),JSON[_0x8914('0x11')](_0x2e7aac));if(_0x2e7aac['error']){if(_0x2e7aac['error'][_0x8914('0x12')]===0x1f4){logger[_0x8914('0x13')](_0x8914('0xe'),_0x58e892,_0x2e7aac[_0x8914('0x13')][_0x8914('0x14')]);return _0x1e2d12(_0x2e7aac[_0x8914('0x13')]['message']);}logger[_0x8914('0x13')](_0x8914('0xe'),_0x58e892,_0x2e7aac['error'][_0x8914('0x14')]);return _0x15aff5(_0x2e7aac[_0x8914('0x13')][_0x8914('0x14')]);}else{logger[_0x8914('0xd')](_0x8914('0xe'),_0x58e892,_0x8914('0xf'));_0x15aff5(_0x2e7aac[_0x8914('0x15')][_0x8914('0x14')]);}})[_0x8914('0x16')](function(_0x4ca130){logger[_0x8914('0x13')](_0x8914('0xe'),_0x58e892,_0x4ca130);_0x1e2d12(_0x4ca130);});});} \ No newline at end of file +var _0x288a=['jayson/promise','http','request','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment'];(function(_0x2b073d,_0x336089){var _0x3d99c2=function(_0x49d90){while(--_0x49d90){_0x2b073d['push'](_0x2b073d['shift']());}};_0x3d99c2(++_0x336089);}(_0x288a,0x188));var _0xa288=function(_0x3bc431,_0x4dda88){_0x3bc431=_0x3bc431-0x0;var _0x14a200=_0x288a[_0x3bc431];return _0x14a200;};'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']('CloudProvider,\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);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 6b488ff..eac6c57 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(_0x2e3482,_0x1d786a){var _0xcf762=function(_0x15224a){while(--_0x15224a){_0x2e3482['push'](_0x2e3482['shift']());}};_0xcf762(++_0x1d786a);}(_0xdb28,0x106));var _0x8db2=function(_0x3a1606,_0x537e83){_0x3a1606=_0x3a1606-0x0;var _0x3d31e9=_0xdb28[_0x3a1606];return _0x3d31e9;};'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 _0xadb5=['put','update','delete','destroy','/:id/oauth2/microsoft/authorize/','/oauth2/microsoft/callback','oauth2MicrosoftCallback','exports','Router','./cloudProvider.controller','get','isAuthenticated','/:id','post','create'];(function(_0x39cc01,_0x4163f5){var _0x131c09=function(_0x112538){while(--_0x112538){_0x39cc01['push'](_0x39cc01['shift']());}};_0x131c09(++_0x4163f5);}(_0xadb5,0xad));var _0x5adb=function(_0x10a518,_0x59bdbb){_0x10a518=_0x10a518-0x0;var _0x23f223=_0xadb5[_0x10a518];return _0x23f223;};'use strict';var express=require('express');var router=express[_0x5adb('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x5adb('0x1'));router[_0x5adb('0x2')]('/',auth[_0x5adb('0x3')](),controller['index']);router[_0x5adb('0x2')](_0x5adb('0x4'),auth[_0x5adb('0x3')](),controller['show']);router[_0x5adb('0x5')]('/',auth[_0x5adb('0x3')](),controller[_0x5adb('0x6')]);router[_0x5adb('0x7')](_0x5adb('0x4'),auth[_0x5adb('0x3')](),controller[_0x5adb('0x8')]);router[_0x5adb('0x9')](_0x5adb('0x4'),auth[_0x5adb('0x3')](),controller[_0x5adb('0xa')]);router[_0x5adb('0x2')](_0x5adb('0xb'),auth[_0x5adb('0x3')](),controller['oauth2MicrosoftAuthorize']);router['post'](_0x5adb('0xc'),controller[_0x5adb('0xd')]);module[_0x5adb('0xe')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 90a0768..0c4cb8e 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 _0x0d0b=['sequelize','exports','name','STRING'];(function(_0x31cb5f,_0x2df766){var _0x586042=function(_0x53c807){while(--_0x53c807){_0x31cb5f['push'](_0x31cb5f['shift']());}};_0x586042(++_0x2df766);}(_0x0d0b,0x88));var _0xb0d0=function(_0xd2fbd8,_0x536037){_0xd2fbd8=_0xd2fbd8-0x0;var _0x441169=_0x0d0b[_0xd2fbd8];return _0x441169;};'use strict';var Sequelize=require(_0xb0d0('0x0'));module[_0xb0d0('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xb0d0('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize['STRING']},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xb0d0('0x3')]},'fax':{'type':Sequelize[_0xb0d0('0x3')]},'type':{'type':Sequelize[_0xb0d0('0x3')]},'street':{'type':Sequelize[_0xb0d0('0x3')]},'postalCode':{'type':Sequelize[_0xb0d0('0x3')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0xb0d0('0x3')]},'email':{'type':Sequelize[_0xb0d0('0x3')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xb0d0('0x3')]},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize[_0xb0d0('0x3')]},'sCity':{'type':Sequelize[_0xb0d0('0x3')]},'sCountry':{'type':Sequelize[_0xb0d0('0x3')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9033=['name','sequelize','STRING'];(function(_0x41d656,_0x299008){var _0x28025b=function(_0x171d15){while(--_0x171d15){_0x41d656['push'](_0x41d656['shift']());}};_0x28025b(++_0x299008);}(_0x9033,0xf7));var _0x3903=function(_0x31cd64,_0x2315f2){_0x31cd64=_0x31cd64-0x0;var _0x1e2106=_0x9033[_0x31cd64];return _0x1e2106;};'use strict';var Sequelize=require(_0x3903('0x0'));module['exports']={'name':{'type':Sequelize[_0x3903('0x1')],'unique':_0x3903('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x3903('0x1')]},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x3903('0x1')]},'fax':{'type':Sequelize[_0x3903('0x1')]},'type':{'type':Sequelize[_0x3903('0x1')]},'street':{'type':Sequelize[_0x3903('0x1')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x3903('0x1')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize[_0x3903('0x1')]},'sPostalCode':{'type':Sequelize[_0x3903('0x1')]},'sCity':{'type':Sequelize[_0x3903('0x1')]},'sCountry':{'type':Sequelize[_0x3903('0x1')]},'description':{'type':Sequelize[_0x3903('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 7513d12..f47bedc 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 _0x0508=['send','describe','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','map','filter','merge','options','includeAll','include','CmCompany','findAll','rows','catch','show','params','rawAttributes','find','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','error','body','addContacts','CmContact','ids','getContacts','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','Companies','destroy','end','stack','name'];(function(_0x50d9a2,_0x511ece){var _0x23b6a6=function(_0x4a6ac8){while(--_0x4a6ac8){_0x50d9a2['push'](_0x50d9a2['shift']());}};_0x23b6a6(++_0x511ece);}(_0x0508,0xd4));var _0x8050=function(_0x585e47,_0x3233b3){_0x585e47=_0x585e47-0x0;var _0x3ff439=_0x0508[_0x585e47];return _0x3ff439;};'use strict';var emlformat=require(_0x8050('0x0'));var rimraf=require(_0x8050('0x1'));var zipdir=require(_0x8050('0x2'));var jsonpatch=require(_0x8050('0x3'));var rp=require(_0x8050('0x4'));var moment=require('moment');var BPromise=require(_0x8050('0x5'));var Mustache=require(_0x8050('0x6'));var util=require(_0x8050('0x7'));var path=require('path');var sox=require(_0x8050('0x8'));var csv=require(_0x8050('0x9'));var ejs=require(_0x8050('0xa'));var fs=require('fs');var fs_extra=require(_0x8050('0xb'));var _=require(_0x8050('0xc'));var squel=require('squel');var crypto=require(_0x8050('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x8050('0xe'));var toCsv=require(_0x8050('0x9'));var querystring=require(_0x8050('0xf'));var Papa=require(_0x8050('0x10'));var Redis=require(_0x8050('0x11'));var authService=require(_0x8050('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8050('0x13'));var logger=require(_0x8050('0x14'))(_0x8050('0x15'));var utils=require(_0x8050('0x16'));var config=require(_0x8050('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x8050('0x18'))['db'];function respondWithStatusCode(_0x1a85bd,_0x204cee){_0x204cee=_0x204cee||0xcc;return function(_0x2e36e4){if(_0x2e36e4){return _0x1a85bd[_0x8050('0x19')](_0x204cee);}return _0x1a85bd[_0x8050('0x1a')](_0x204cee)['end']();};}function respondWithResult(_0x10de73,_0x11d020){_0x11d020=_0x11d020||0xc8;return function(_0x297a7c){if(_0x297a7c){return _0x10de73['status'](_0x11d020)[_0x8050('0x1b')](_0x297a7c);}};}function respondWithFilteredResult(_0x2e7a7b,_0x1d7321){return function(_0x5968d9){if(_0x5968d9){var _0x2b6406=typeof _0x1d7321[_0x8050('0x1c')]==='undefined'&&typeof _0x1d7321[_0x8050('0x1d')]===_0x8050('0x1e');var _0x26c07a=_0x5968d9[_0x8050('0x1f')];var _0x11b6a6=_0x2b6406?0x0:_0x1d7321[_0x8050('0x1c')];var _0x5575ba=_0x2b6406?_0x5968d9[_0x8050('0x1f')]:_0x1d7321['offset']+_0x1d7321['limit'];var _0x3b2f0c;if(_0x5575ba>=_0x26c07a){_0x5575ba=_0x26c07a;_0x3b2f0c=0xc8;}else{_0x3b2f0c=0xce;}_0x2e7a7b[_0x8050('0x1a')](_0x3b2f0c);return _0x2e7a7b[_0x8050('0x20')](_0x8050('0x21'),_0x11b6a6+'-'+_0x5575ba+'/'+_0x26c07a)['json'](_0x5968d9);}return null;};}function patchUpdates(_0x1bf8db){return function(_0x40c9a8){try{jsonpatch['apply'](_0x40c9a8,_0x1bf8db,!![]);}catch(_0x523123){return BPromise[_0x8050('0x22')](_0x523123);}return _0x40c9a8[_0x8050('0x23')]();};}function saveUpdates(_0x2b4a8b,_0x556277){return function(_0x193985){if(_0x193985){return _0x193985[_0x8050('0x24')](_0x2b4a8b)[_0x8050('0x25')](function(_0x218ed8){return _0x218ed8;});}return null;};}function removeEntity(_0x221e8f,_0x4af529){return function(_0x307c0c){if(_0x307c0c){return _0x307c0c['destroy']()[_0x8050('0x25')](function(){var _0x447ac1=_0x307c0c['get']({'plain':!![]});var _0x3c8afb=_0x8050('0x26');return db['UserProfileResource'][_0x8050('0x27')]({'where':{'type':_0x3c8afb,'resourceId':_0x447ac1['id']}})['then'](function(){return _0x307c0c;});})['then'](function(){_0x221e8f[_0x8050('0x1a')](0xcc)[_0x8050('0x28')]();});}};}function handleEntityNotFound(_0xda9fac,_0x59c36d){return function(_0xe736ed){if(!_0xe736ed){_0xda9fac[_0x8050('0x19')](0x194);}return _0xe736ed;};}function handleError(_0x5dd17e,_0x45712b){_0x45712b=_0x45712b||0x1f4;return function(_0x1652ab){logger['error'](_0x1652ab[_0x8050('0x29')]);if(_0x1652ab['name']){delete _0x1652ab[_0x8050('0x2a')];}_0x5dd17e[_0x8050('0x1a')](_0x45712b)[_0x8050('0x2b')](_0x1652ab);};}exports['index']=function(_0x37ad85,_0x6550c2){var _0xe4e9f5={},_0x3b196e={},_0x58b0ee={'count':0x0,'rows':[]};return db['CmCompany'][_0x8050('0x2c')]()[_0x8050('0x25')](function(_0x468278){_0x3b196e[_0x8050('0x2d')]=_[_0x8050('0x2e')](_0x468278);_0x3b196e[_0x8050('0x2f')]=_[_0x8050('0x2e')](_0x37ad85[_0x8050('0x2f')]);_0x3b196e[_0x8050('0x30')]=_[_0x8050('0x31')](_0x3b196e['model'],_0x3b196e['query']);_0xe4e9f5[_0x8050('0x32')]=_['intersection'](_0x3b196e[_0x8050('0x2d')],qs[_0x8050('0x33')](_0x37ad85[_0x8050('0x2f')][_0x8050('0x33')]));_0xe4e9f5[_0x8050('0x32')]=_0xe4e9f5[_0x8050('0x32')][_0x8050('0x34')]?_0xe4e9f5[_0x8050('0x32')]:_0x3b196e[_0x8050('0x2d')];if(!_0x37ad85['query'][_0x8050('0x35')]('nolimit')){_0xe4e9f5['limit']=qs[_0x8050('0x1d')](_0x37ad85[_0x8050('0x2f')][_0x8050('0x1d')]);_0xe4e9f5[_0x8050('0x1c')]=qs[_0x8050('0x1c')](_0x37ad85[_0x8050('0x2f')][_0x8050('0x1c')]);}_0xe4e9f5[_0x8050('0x36')]=qs[_0x8050('0x37')](_0x37ad85[_0x8050('0x2f')][_0x8050('0x37')]);_0xe4e9f5[_0x8050('0x38')]=qs['filters'](_['pick'](_0x37ad85['query'],_0x3b196e[_0x8050('0x30')]),_0x468278);if(_0x37ad85[_0x8050('0x2f')]['filter']){_0xe4e9f5[_0x8050('0x38')]=_['merge'](_0xe4e9f5[_0x8050('0x38')],{'$or':_[_0x8050('0x39')](_0xe4e9f5[_0x8050('0x32')],function(_0x140504){var _0x43f273={};_0x43f273[_0x140504]={'$like':'%'+_0x37ad85[_0x8050('0x2f')][_0x8050('0x3a')]+'%'};return _0x43f273;})});}_0xe4e9f5=_[_0x8050('0x3b')]({},_0xe4e9f5,_0x37ad85[_0x8050('0x3c')]);var _0x5e25bf={'where':_0xe4e9f5[_0x8050('0x38')]};return db['CmCompany'][_0x8050('0x1f')](_0x5e25bf)['then'](function(_0x566338){_0x58b0ee[_0x8050('0x1f')]=_0x566338;if(_0x37ad85[_0x8050('0x2f')][_0x8050('0x3d')]){_0xe4e9f5[_0x8050('0x3e')]=[{'all':!![]}];}return db[_0x8050('0x3f')][_0x8050('0x40')](_0xe4e9f5);})[_0x8050('0x25')](function(_0x517bfc){_0x58b0ee[_0x8050('0x41')]=_0x517bfc;return _0x58b0ee;})[_0x8050('0x25')](respondWithFilteredResult(_0x6550c2,_0xe4e9f5))['catch'](handleError(_0x6550c2,null));})[_0x8050('0x42')](handleError(_0x6550c2,null));};exports[_0x8050('0x43')]=function(_0x48101e,_0x558326){var _0xbef5d5={'raw':![],'where':{'id':_0x48101e[_0x8050('0x44')]['id']}},_0x55db3c={};_0x55db3c[_0x8050('0x2d')]=_[_0x8050('0x2e')](db[_0x8050('0x3f')][_0x8050('0x45')]);_0x55db3c[_0x8050('0x2f')]=_[_0x8050('0x2e')](_0x48101e[_0x8050('0x2f')]);_0x55db3c[_0x8050('0x30')]=_['intersection'](_0x55db3c[_0x8050('0x2d')],_0x55db3c[_0x8050('0x2f')]);_0xbef5d5['attributes']=_[_0x8050('0x31')](_0x55db3c[_0x8050('0x2d')],qs[_0x8050('0x33')](_0x48101e[_0x8050('0x2f')][_0x8050('0x33')]));_0xbef5d5['attributes']=_0xbef5d5[_0x8050('0x32')][_0x8050('0x34')]?_0xbef5d5['attributes']:_0x55db3c[_0x8050('0x2d')];if(_0x48101e[_0x8050('0x2f')][_0x8050('0x3d')]){_0xbef5d5[_0x8050('0x3e')]=[{'all':!![]}];}_0xbef5d5=_['merge']({},_0xbef5d5,_0x48101e[_0x8050('0x3c')]);return db[_0x8050('0x3f')][_0x8050('0x46')](_0xbef5d5)['then'](handleEntityNotFound(_0x558326,null))['then'](respondWithResult(_0x558326,null))[_0x8050('0x42')](handleError(_0x558326,null));};exports[_0x8050('0x47')]=function(_0x11d7b0,_0x3cd10b){return db[_0x8050('0x3f')][_0x8050('0x47')](_0x11d7b0['body'],{})[_0x8050('0x25')](function(_0x130824){var _0x24b670=_0x11d7b0['user'][_0x8050('0x48')]({'plain':!![]});if(!_0x24b670)throw new Error(_0x8050('0x49'));if(_0x24b670[_0x8050('0x4a')]==='user'){var _0x352493=_0x130824[_0x8050('0x48')]({'plain':!![]});var _0x115916=_0x8050('0x26');return db[_0x8050('0x4b')][_0x8050('0x46')]({'where':{'name':_0x115916,'userProfileId':_0x24b670['userProfileId']},'raw':!![]})[_0x8050('0x25')](function(_0x53f351){if(_0x53f351&&_0x53f351[_0x8050('0x4c')]===0x0){return db[_0x8050('0x4d')][_0x8050('0x47')]({'name':_0x352493[_0x8050('0x2a')],'resourceId':_0x352493['id'],'type':_0x53f351['name'],'sectionId':_0x53f351['id']},{})[_0x8050('0x25')](function(){return _0x130824;});}else{return _0x130824;}})[_0x8050('0x42')](function(_0x30983a){logger[_0x8050('0x4e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x30983a);throw _0x30983a;});}return _0x130824;})[_0x8050('0x25')](respondWithResult(_0x3cd10b,0xc9))[_0x8050('0x42')](handleError(_0x3cd10b,null));};exports['update']=function(_0xebb455,_0x3f6f5c){if(_0xebb455['body']['id']){delete _0xebb455[_0x8050('0x4f')]['id'];}return db['CmCompany'][_0x8050('0x46')]({'where':{'id':_0xebb455[_0x8050('0x44')]['id']}})['then'](handleEntityNotFound(_0x3f6f5c,null))[_0x8050('0x25')](saveUpdates(_0xebb455[_0x8050('0x4f')],null))[_0x8050('0x25')](respondWithResult(_0x3f6f5c,null))[_0x8050('0x42')](handleError(_0x3f6f5c,null));};exports[_0x8050('0x27')]=function(_0x15ad85,_0x124273){return db['CmCompany'][_0x8050('0x46')]({'where':{'id':_0x15ad85[_0x8050('0x44')]['id']}})['then'](handleEntityNotFound(_0x124273,null))['then'](removeEntity(_0x124273,null))['catch'](handleError(_0x124273,null));};exports['describe']=function(_0x381c0e,_0x5ec541){return db['CmCompany'][_0x8050('0x2c')]()[_0x8050('0x25')](respondWithResult(_0x5ec541,null))[_0x8050('0x42')](handleError(_0x5ec541,null));};exports[_0x8050('0x50')]=function(_0x1f5b14,_0x562e2b,_0x4e7a11){return db[_0x8050('0x51')][_0x8050('0x46')]({'where':{'id':_0x1f5b14[_0x8050('0x44')]['id']}})[_0x8050('0x25')](handleEntityNotFound(_0x562e2b,null))['then'](function(_0xdcf8d7){if(_0xdcf8d7){return _0xdcf8d7[_0x8050('0x50')](_0x1f5b14[_0x8050('0x4f')][_0x8050('0x52')],_['omit'](_0x1f5b14[_0x8050('0x4f')],[_0x8050('0x52'),'id'])||{});}})[_0x8050('0x25')](respondWithResult(_0x562e2b,null))['catch'](handleError(_0x562e2b,null));};exports[_0x8050('0x53')]=function(_0x4ec83d,_0x27e2dd,_0x1a6693){var _0x5f4a8c={};var _0xdf41fe={};var _0x588058;var _0x160317;return db[_0x8050('0x3f')][_0x8050('0x54')]({'where':{'id':_0x4ec83d['params']['id']}})[_0x8050('0x25')](handleEntityNotFound(_0x27e2dd,null))['then'](function(_0x1e9642){if(_0x1e9642){_0x588058=_0x1e9642;_0xdf41fe[_0x8050('0x2d')]=_['keys'](db[_0x8050('0x51')]['rawAttributes']);_0xdf41fe[_0x8050('0x2f')]=_[_0x8050('0x2e')](_0x4ec83d[_0x8050('0x2f')]);_0xdf41fe[_0x8050('0x30')]=_[_0x8050('0x31')](_0xdf41fe[_0x8050('0x2d')],_0xdf41fe[_0x8050('0x2f')]);_0x5f4a8c[_0x8050('0x32')]=_[_0x8050('0x31')](_0xdf41fe[_0x8050('0x2d')],qs[_0x8050('0x33')](_0x4ec83d[_0x8050('0x2f')][_0x8050('0x33')]));_0x5f4a8c['attributes']=_0x5f4a8c[_0x8050('0x32')][_0x8050('0x34')]?_0x5f4a8c[_0x8050('0x32')]:_0xdf41fe['model'];_0x5f4a8c[_0x8050('0x36')]=qs['sort'](_0x4ec83d[_0x8050('0x2f')][_0x8050('0x37')]);_0x5f4a8c[_0x8050('0x38')]=qs[_0x8050('0x30')](_['pick'](_0x4ec83d[_0x8050('0x2f')],_0xdf41fe[_0x8050('0x30')]));if(_0x4ec83d[_0x8050('0x2f')]['filter']){_0x5f4a8c[_0x8050('0x38')]=_[_0x8050('0x3b')](_0x5f4a8c[_0x8050('0x38')],{'$or':_[_0x8050('0x39')](_0x5f4a8c[_0x8050('0x32')],function(_0x2bb4dd){var _0x5091a1={};_0x5091a1[_0x2bb4dd]={'$like':'%'+_0x4ec83d[_0x8050('0x2f')][_0x8050('0x3a')]+'%'};return _0x5091a1;})});}_0x5f4a8c=_[_0x8050('0x3b')]({},_0x5f4a8c,_0x4ec83d[_0x8050('0x3c')]);return _0x588058[_0x8050('0x53')](_0x5f4a8c);}})[_0x8050('0x25')](function(_0x491e60){if(_0x491e60){_0x160317=_0x491e60[_0x8050('0x34')];if(!_0x4ec83d[_0x8050('0x2f')][_0x8050('0x35')]('nolimit')){_0x5f4a8c[_0x8050('0x1d')]=qs['limit'](_0x4ec83d[_0x8050('0x2f')]['limit']);_0x5f4a8c['offset']=qs['offset'](_0x4ec83d[_0x8050('0x2f')][_0x8050('0x1c')]);}return _0x588058['getContacts'](_0x5f4a8c);}})[_0x8050('0x25')](function(_0x1c0e5a){if(_0x1c0e5a){return _0x1c0e5a?{'count':_0x160317,'rows':_0x1c0e5a}:null;}})[_0x8050('0x25')](respondWithResult(_0x27e2dd,null))[_0x8050('0x42')](handleError(_0x27e2dd,null));}; \ No newline at end of file +var _0x878c=['get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Companies','UserProfileSection','userProfileId','UserProfileResource','destroy','addContacts','CmContact','omit','ids','getContacts','findOne','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','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','index','CmCompany','describe','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','map','options','includeAll','include','findAll','rows','catch','params','rawAttributes','length','find','create','body'];(function(_0x315d69,_0x1a9224){var _0x599dca=function(_0x51feeb){while(--_0x51feeb){_0x315d69['push'](_0x315d69['shift']());}};_0x599dca(++_0x1a9224);}(_0x878c,0x11a));var _0xc878=function(_0x1168e6,_0x4580fc){_0x1168e6=_0x1168e6-0x0;var _0x27c4c2=_0x878c[_0x1168e6];return _0x27c4c2;};'use strict';var emlformat=require(_0xc878('0x0'));var rimraf=require(_0xc878('0x1'));var zipdir=require(_0xc878('0x2'));var jsonpatch=require(_0xc878('0x3'));var rp=require(_0xc878('0x4'));var moment=require(_0xc878('0x5'));var BPromise=require(_0xc878('0x6'));var Mustache=require(_0xc878('0x7'));var util=require('util');var path=require(_0xc878('0x8'));var sox=require('sox');var csv=require(_0xc878('0x9'));var ejs=require(_0xc878('0xa'));var fs=require('fs');var fs_extra=require(_0xc878('0xb'));var _=require(_0xc878('0xc'));var squel=require(_0xc878('0xd'));var crypto=require(_0xc878('0xe'));var jsforce=require(_0xc878('0xf'));var deskjs=require(_0xc878('0x10'));var toCsv=require(_0xc878('0x9'));var querystring=require(_0xc878('0x11'));var Papa=require('papaparse');var Redis=require(_0xc878('0x12'));var authService=require(_0xc878('0x13'));var qs=require(_0xc878('0x14'));var as=require(_0xc878('0x15'));var hardwareService=require(_0xc878('0x16'));var logger=require(_0xc878('0x17'))(_0xc878('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc878('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x46dcde,_0x9b5234){_0x9b5234=_0x9b5234||0xcc;return function(_0x243814){if(_0x243814){return _0x46dcde['sendStatus'](_0x9b5234);}return _0x46dcde[_0xc878('0x1a')](_0x9b5234)[_0xc878('0x1b')]();};}function respondWithResult(_0x25e601,_0x2ae75c){_0x2ae75c=_0x2ae75c||0xc8;return function(_0x419c8d){if(_0x419c8d){return _0x25e601[_0xc878('0x1a')](_0x2ae75c)[_0xc878('0x1c')](_0x419c8d);}};}function respondWithFilteredResult(_0x4f34dc,_0x113d2f){return function(_0x3a0c54){if(_0x3a0c54){var _0x5b891d=typeof _0x113d2f[_0xc878('0x1d')]===_0xc878('0x1e')&&typeof _0x113d2f[_0xc878('0x1f')]===_0xc878('0x1e');var _0x7609ba=_0x3a0c54[_0xc878('0x20')];var _0x115c58=_0x5b891d?0x0:_0x113d2f[_0xc878('0x1d')];var _0x52cdee=_0x5b891d?_0x3a0c54[_0xc878('0x20')]:_0x113d2f[_0xc878('0x1d')]+_0x113d2f[_0xc878('0x1f')];var _0x40afd0;if(_0x52cdee>=_0x7609ba){_0x52cdee=_0x7609ba;_0x40afd0=0xc8;}else{_0x40afd0=0xce;}_0x4f34dc[_0xc878('0x1a')](_0x40afd0);return _0x4f34dc[_0xc878('0x21')](_0xc878('0x22'),_0x115c58+'-'+_0x52cdee+'/'+_0x7609ba)[_0xc878('0x1c')](_0x3a0c54);}return null;};}function patchUpdates(_0x577359){return function(_0x5386b0){try{jsonpatch[_0xc878('0x23')](_0x5386b0,_0x577359,!![]);}catch(_0x1888ec){return BPromise[_0xc878('0x24')](_0x1888ec);}return _0x5386b0[_0xc878('0x25')]();};}function saveUpdates(_0x4196a7,_0x3df6c4){return function(_0x365058){if(_0x365058){return _0x365058[_0xc878('0x26')](_0x4196a7)[_0xc878('0x27')](function(_0x4e5d98){return _0x4e5d98;});}return null;};}function removeEntity(_0x2c26d7,_0x14cbfb){return function(_0x98e36e){if(_0x98e36e){return _0x98e36e['destroy']()[_0xc878('0x27')](function(){var _0x3d015d=_0x98e36e['get']({'plain':!![]});var _0x2ac7ab='Companies';return db['UserProfileResource']['destroy']({'where':{'type':_0x2ac7ab,'resourceId':_0x3d015d['id']}})[_0xc878('0x27')](function(){return _0x98e36e;});})[_0xc878('0x27')](function(){_0x2c26d7[_0xc878('0x1a')](0xcc)[_0xc878('0x1b')]();});}};}function handleEntityNotFound(_0xace4d9,_0x53cee1){return function(_0x3a830a){if(!_0x3a830a){_0xace4d9[_0xc878('0x28')](0x194);}return _0x3a830a;};}function handleError(_0x460bef,_0xabb6e2){_0xabb6e2=_0xabb6e2||0x1f4;return function(_0x3584db){logger[_0xc878('0x29')](_0x3584db[_0xc878('0x2a')]);if(_0x3584db[_0xc878('0x2b')]){delete _0x3584db[_0xc878('0x2b')];}_0x460bef[_0xc878('0x1a')](_0xabb6e2)['send'](_0x3584db);};}exports[_0xc878('0x2c')]=function(_0xf60bcc,_0xe3e19c){var _0x5843b3={},_0x4c21fb={},_0x248b05={'count':0x0,'rows':[]};return db[_0xc878('0x2d')][_0xc878('0x2e')]()[_0xc878('0x27')](function(_0x8a58b4){_0x4c21fb[_0xc878('0x2f')]=_[_0xc878('0x30')](_0x8a58b4);_0x4c21fb[_0xc878('0x31')]=_[_0xc878('0x30')](_0xf60bcc['query']);_0x4c21fb[_0xc878('0x32')]=_[_0xc878('0x33')](_0x4c21fb[_0xc878('0x2f')],_0x4c21fb['query']);_0x5843b3[_0xc878('0x34')]=_['intersection'](_0x4c21fb['model'],qs[_0xc878('0x35')](_0xf60bcc[_0xc878('0x31')][_0xc878('0x35')]));_0x5843b3['attributes']=_0x5843b3[_0xc878('0x34')]['length']?_0x5843b3['attributes']:_0x4c21fb[_0xc878('0x2f')];if(!_0xf60bcc[_0xc878('0x31')][_0xc878('0x36')]('nolimit')){_0x5843b3[_0xc878('0x1f')]=qs['limit'](_0xf60bcc[_0xc878('0x31')][_0xc878('0x1f')]);_0x5843b3['offset']=qs[_0xc878('0x1d')](_0xf60bcc[_0xc878('0x31')][_0xc878('0x1d')]);}_0x5843b3[_0xc878('0x37')]=qs[_0xc878('0x38')](_0xf60bcc[_0xc878('0x31')][_0xc878('0x38')]);_0x5843b3[_0xc878('0x39')]=qs[_0xc878('0x32')](_[_0xc878('0x3a')](_0xf60bcc[_0xc878('0x31')],_0x4c21fb[_0xc878('0x32')]),_0x8a58b4);if(_0xf60bcc[_0xc878('0x31')][_0xc878('0x3b')]){_0x5843b3['where']=_[_0xc878('0x3c')](_0x5843b3[_0xc878('0x39')],{'$or':_[_0xc878('0x3d')](_0x5843b3[_0xc878('0x34')],function(_0x49e3d3){var _0x16d49d={};_0x16d49d[_0x49e3d3]={'$like':'%'+_0xf60bcc[_0xc878('0x31')]['filter']+'%'};return _0x16d49d;})});}_0x5843b3=_[_0xc878('0x3c')]({},_0x5843b3,_0xf60bcc[_0xc878('0x3e')]);var _0x233b0a={'where':_0x5843b3[_0xc878('0x39')]};return db[_0xc878('0x2d')][_0xc878('0x20')](_0x233b0a)[_0xc878('0x27')](function(_0x578dad){_0x248b05['count']=_0x578dad;if(_0xf60bcc[_0xc878('0x31')][_0xc878('0x3f')]){_0x5843b3[_0xc878('0x40')]=[{'all':!![]}];}return db[_0xc878('0x2d')][_0xc878('0x41')](_0x5843b3);})['then'](function(_0x5eb89c){_0x248b05[_0xc878('0x42')]=_0x5eb89c;return _0x248b05;})[_0xc878('0x27')](respondWithFilteredResult(_0xe3e19c,_0x5843b3))['catch'](handleError(_0xe3e19c,null));})[_0xc878('0x43')](handleError(_0xe3e19c,null));};exports['show']=function(_0x3dd40e,_0x3c1aaa){var _0x319750={'raw':![],'where':{'id':_0x3dd40e[_0xc878('0x44')]['id']}},_0xd29016={};_0xd29016[_0xc878('0x2f')]=_[_0xc878('0x30')](db[_0xc878('0x2d')][_0xc878('0x45')]);_0xd29016[_0xc878('0x31')]=_[_0xc878('0x30')](_0x3dd40e['query']);_0xd29016[_0xc878('0x32')]=_[_0xc878('0x33')](_0xd29016['model'],_0xd29016['query']);_0x319750[_0xc878('0x34')]=_[_0xc878('0x33')](_0xd29016[_0xc878('0x2f')],qs[_0xc878('0x35')](_0x3dd40e[_0xc878('0x31')][_0xc878('0x35')]));_0x319750['attributes']=_0x319750[_0xc878('0x34')][_0xc878('0x46')]?_0x319750[_0xc878('0x34')]:_0xd29016[_0xc878('0x2f')];if(_0x3dd40e['query']['includeAll']){_0x319750[_0xc878('0x40')]=[{'all':!![]}];}_0x319750=_[_0xc878('0x3c')]({},_0x319750,_0x3dd40e[_0xc878('0x3e')]);return db[_0xc878('0x2d')][_0xc878('0x47')](_0x319750)['then'](handleEntityNotFound(_0x3c1aaa,null))['then'](respondWithResult(_0x3c1aaa,null))[_0xc878('0x43')](handleError(_0x3c1aaa,null));};exports[_0xc878('0x48')]=function(_0x113de2,_0x500c0a){return db[_0xc878('0x2d')][_0xc878('0x48')](_0x113de2[_0xc878('0x49')],{})[_0xc878('0x27')](function(_0x467ddc){var _0x1052b8=_0x113de2['user'][_0xc878('0x4a')]({'plain':!![]});if(!_0x1052b8)throw new Error(_0xc878('0x4b'));if(_0x1052b8[_0xc878('0x4c')]===_0xc878('0x4d')){var _0x3cbde0=_0x467ddc['get']({'plain':!![]});var _0x5a37b9=_0xc878('0x4e');return db[_0xc878('0x4f')][_0xc878('0x47')]({'where':{'name':_0x5a37b9,'userProfileId':_0x1052b8[_0xc878('0x50')]},'raw':!![]})[_0xc878('0x27')](function(_0x52e4c4){if(_0x52e4c4&&_0x52e4c4['autoAssociation']===0x0){return db[_0xc878('0x51')]['create']({'name':_0x3cbde0[_0xc878('0x2b')],'resourceId':_0x3cbde0['id'],'type':_0x52e4c4[_0xc878('0x2b')],'sectionId':_0x52e4c4['id']},{})['then'](function(){return _0x467ddc;});}else{return _0x467ddc;}})[_0xc878('0x43')](function(_0x1dded0){logger[_0xc878('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1dded0);throw _0x1dded0;});}return _0x467ddc;})[_0xc878('0x27')](respondWithResult(_0x500c0a,0xc9))['catch'](handleError(_0x500c0a,null));};exports['update']=function(_0x3b9a08,_0xd3b72d){if(_0x3b9a08[_0xc878('0x49')]['id']){delete _0x3b9a08[_0xc878('0x49')]['id'];}return db[_0xc878('0x2d')]['find']({'where':{'id':_0x3b9a08[_0xc878('0x44')]['id']}})[_0xc878('0x27')](handleEntityNotFound(_0xd3b72d,null))[_0xc878('0x27')](saveUpdates(_0x3b9a08[_0xc878('0x49')],null))[_0xc878('0x27')](respondWithResult(_0xd3b72d,null))['catch'](handleError(_0xd3b72d,null));};exports[_0xc878('0x52')]=function(_0x37a3f6,_0x16a9ab){return db[_0xc878('0x2d')][_0xc878('0x47')]({'where':{'id':_0x37a3f6[_0xc878('0x44')]['id']}})[_0xc878('0x27')](handleEntityNotFound(_0x16a9ab,null))[_0xc878('0x27')](removeEntity(_0x16a9ab,null))[_0xc878('0x43')](handleError(_0x16a9ab,null));};exports['describe']=function(_0x45aba2,_0x36bc9a){return db[_0xc878('0x2d')][_0xc878('0x2e')]()[_0xc878('0x27')](respondWithResult(_0x36bc9a,null))['catch'](handleError(_0x36bc9a,null));};exports[_0xc878('0x53')]=function(_0x394175,_0x47d34e,_0x1deaac){return db[_0xc878('0x54')][_0xc878('0x47')]({'where':{'id':_0x394175[_0xc878('0x44')]['id']}})[_0xc878('0x27')](handleEntityNotFound(_0x47d34e,null))[_0xc878('0x27')](function(_0x3a9941){if(_0x3a9941){return _0x3a9941['addContacts'](_0x394175[_0xc878('0x49')]['ids'],_[_0xc878('0x55')](_0x394175[_0xc878('0x49')],[_0xc878('0x56'),'id'])||{});}})[_0xc878('0x27')](respondWithResult(_0x47d34e,null))['catch'](handleError(_0x47d34e,null));};exports[_0xc878('0x57')]=function(_0x33b85d,_0x4d9baf,_0x8abd2a){var _0x422404={};var _0x44e69f={};var _0x3120fb;var _0x37feb5;return db[_0xc878('0x2d')][_0xc878('0x58')]({'where':{'id':_0x33b85d[_0xc878('0x44')]['id']}})[_0xc878('0x27')](handleEntityNotFound(_0x4d9baf,null))[_0xc878('0x27')](function(_0x121f68){if(_0x121f68){_0x3120fb=_0x121f68;_0x44e69f[_0xc878('0x2f')]=_[_0xc878('0x30')](db['CmContact'][_0xc878('0x45')]);_0x44e69f[_0xc878('0x31')]=_['keys'](_0x33b85d[_0xc878('0x31')]);_0x44e69f[_0xc878('0x32')]=_[_0xc878('0x33')](_0x44e69f[_0xc878('0x2f')],_0x44e69f[_0xc878('0x31')]);_0x422404[_0xc878('0x34')]=_[_0xc878('0x33')](_0x44e69f['model'],qs[_0xc878('0x35')](_0x33b85d['query'][_0xc878('0x35')]));_0x422404[_0xc878('0x34')]=_0x422404['attributes'][_0xc878('0x46')]?_0x422404['attributes']:_0x44e69f[_0xc878('0x2f')];_0x422404['order']=qs[_0xc878('0x38')](_0x33b85d[_0xc878('0x31')][_0xc878('0x38')]);_0x422404[_0xc878('0x39')]=qs[_0xc878('0x32')](_['pick'](_0x33b85d[_0xc878('0x31')],_0x44e69f[_0xc878('0x32')]));if(_0x33b85d[_0xc878('0x31')][_0xc878('0x3b')]){_0x422404[_0xc878('0x39')]=_[_0xc878('0x3c')](_0x422404['where'],{'$or':_[_0xc878('0x3d')](_0x422404[_0xc878('0x34')],function(_0x1a9210){var _0x3c3481={};_0x3c3481[_0x1a9210]={'$like':'%'+_0x33b85d[_0xc878('0x31')][_0xc878('0x3b')]+'%'};return _0x3c3481;})});}_0x422404=_[_0xc878('0x3c')]({},_0x422404,_0x33b85d['options']);return _0x3120fb[_0xc878('0x57')](_0x422404);}})[_0xc878('0x27')](function(_0x7f17ab){if(_0x7f17ab){_0x37feb5=_0x7f17ab[_0xc878('0x46')];if(!_0x33b85d['query']['hasOwnProperty']('nolimit')){_0x422404[_0xc878('0x1f')]=qs[_0xc878('0x1f')](_0x33b85d[_0xc878('0x31')][_0xc878('0x1f')]);_0x422404['offset']=qs[_0xc878('0x1d')](_0x33b85d[_0xc878('0x31')][_0xc878('0x1d')]);}return _0x3120fb[_0xc878('0x57')](_0x422404);}})['then'](function(_0x579e68){if(_0x579e68){return _0x579e68?{'count':_0x37feb5,'rows':_0x579e68}:null;}})[_0xc878('0x27')](respondWithResult(_0x4d9baf,null))[_0xc878('0x43')](handleError(_0x4d9baf,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 8049272..ecb3507 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 _0x420e=['CmCompany','cm_companies','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./cmCompany.attributes','exports','define'];(function(_0x1503fe,_0x23730f){var _0x35e8f6=function(_0x446df4){while(--_0x446df4){_0x1503fe['push'](_0x1503fe['shift']());}};_0x35e8f6(++_0x23730f);}(_0x420e,0xe2));var _0xe420=function(_0x58868a,_0x385638){_0x58868a=_0x58868a-0x0;var _0x3ce24d=_0x420e[_0x58868a];return _0x3ce24d;};'use strict';var _=require(_0xe420('0x0'));var util=require(_0xe420('0x1'));var logger=require(_0xe420('0x2'))(_0xe420('0x3'));var moment=require(_0xe420('0x4'));var BPromise=require(_0xe420('0x5'));var rp=require(_0xe420('0x6'));var fs=require('fs');var path=require(_0xe420('0x7'));var rimraf=require('rimraf');var config=require(_0xe420('0x8'));var attributes=require(_0xe420('0x9'));module[_0xe420('0xa')]=function(_0x2e3303,_0x2b0ab1){return _0x2e3303[_0xe420('0xb')](_0xe420('0xc'),attributes,{'tableName':_0xe420('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb115=['util','../../config/logger','api','moment','bluebird','./cmCompany.attributes','exports','define','CmCompany','lodash'];(function(_0x5103a4,_0x4b7f5c){var _0x4f99e0=function(_0x1fb571){while(--_0x1fb571){_0x5103a4['push'](_0x5103a4['shift']());}};_0x4f99e0(++_0x4b7f5c);}(_0xb115,0xd1));var _0x5b11=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xb115[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0x5b11('0x0'));var util=require(_0x5b11('0x1'));var logger=require(_0x5b11('0x2'))(_0x5b11('0x3'));var moment=require(_0x5b11('0x4'));var BPromise=require(_0x5b11('0x5'));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(_0x5b11('0x6'));module[_0x5b11('0x7')]=function(_0x1abda5,_0x333a96){return _0x1abda5[_0x5b11('0x8')](_0x5b11('0x9'),attributes,{'tableName':'cm_companies','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.rpc.js b/server/api/cmCompany/cmCompany.rpc.js index b29b677..0d3b7d1 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 _0x10e9=['then','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','http','request'];(function(_0xada87a,_0x16223c){var _0x7ad44c=function(_0x341535){while(--_0x341535){_0xada87a['push'](_0xada87a['shift']());}};_0x7ad44c(++_0x16223c);}(_0x10e9,0x19b));var _0x910e=function(_0x28cbc5,_0x326e44){_0x28cbc5=_0x28cbc5-0x0;var _0x310541=_0x10e9[_0x28cbc5];return _0x310541;};'use strict';var _=require(_0x910e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x910e('0x1'));var fs=require('fs');var Redis=require(_0x910e('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x910e('0x3'));var logger=require(_0x910e('0x4'))(_0x910e('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x910e('0x6')][_0x910e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x43130b,_0x250ffb,_0x32eae8){return new BPromise(function(_0x5a6097,_0xe05dd2){return client[_0x910e('0x8')](_0x43130b,_0x32eae8)[_0x910e('0x9')](function(_0x4f18f3){logger['info'](_0x910e('0xa'),_0x250ffb,_0x910e('0xb'));logger[_0x910e('0xc')](_0x910e('0xd'),_0x250ffb,'request\x20sent',JSON[_0x910e('0xe')](_0x4f18f3));if(_0x4f18f3[_0x910e('0xf')]){if(_0x4f18f3[_0x910e('0xf')][_0x910e('0x10')]===0x1f4){logger[_0x910e('0xf')](_0x910e('0xa'),_0x250ffb,_0x4f18f3[_0x910e('0xf')][_0x910e('0x11')]);return _0xe05dd2(_0x4f18f3[_0x910e('0xf')][_0x910e('0x11')]);}logger[_0x910e('0xf')]('CmCompany,\x20%s,\x20%s',_0x250ffb,_0x4f18f3['error'][_0x910e('0x11')]);return _0x5a6097(_0x4f18f3['error'][_0x910e('0x11')]);}else{logger['info']('CmCompany,\x20%s,\x20%s',_0x250ffb,'request\x20sent');_0x5a6097(_0x4f18f3[_0x910e('0x12')]['message']);}})[_0x910e('0x13')](function(_0x371a23){logger['error'](_0x910e('0xa'),_0x250ffb,_0x371a23);_0xe05dd2(_0x371a23);});});} \ No newline at end of file +var _0xc422=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x487b09,_0x349b11){var _0x28830b=function(_0x51705f){while(--_0x51705f){_0x487b09['push'](_0x487b09['shift']());}};_0x28830b(++_0x349b11);}(_0xc422,0xb1));var _0x2c42=function(_0x3f4b81,_0x3fd592){_0x3f4b81=_0x3f4b81-0x0;var _0x480fc6=_0xc422[_0x3f4b81];return _0x480fc6;};'use strict';var _=require(_0x2c42('0x0'));var util=require(_0x2c42('0x1'));var moment=require(_0x2c42('0x2'));var BPromise=require(_0x2c42('0x3'));var rs=require(_0x2c42('0x4'));var fs=require('fs');var Redis=require(_0x2c42('0x5'));var db=require(_0x2c42('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2c42('0x7'));var config=require(_0x2c42('0x8'));var jayson=require(_0x2c42('0x9'));var client=jayson[_0x2c42('0xa')][_0x2c42('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xba9e76,_0x60ee77,_0x4caf83){return new BPromise(function(_0x4fbcc0,_0x3ba866){return client[_0x2c42('0xc')](_0xba9e76,_0x4caf83)[_0x2c42('0xd')](function(_0x41d9c8){logger[_0x2c42('0xe')](_0x2c42('0xf'),_0x60ee77,_0x2c42('0x10'));logger['debug'](_0x2c42('0x11'),_0x60ee77,_0x2c42('0x10'),JSON[_0x2c42('0x12')](_0x41d9c8));if(_0x41d9c8['error']){if(_0x41d9c8[_0x2c42('0x13')][_0x2c42('0x14')]===0x1f4){logger[_0x2c42('0x13')](_0x2c42('0xf'),_0x60ee77,_0x41d9c8['error'][_0x2c42('0x15')]);return _0x3ba866(_0x41d9c8[_0x2c42('0x13')][_0x2c42('0x15')]);}logger['error'](_0x2c42('0xf'),_0x60ee77,_0x41d9c8[_0x2c42('0x13')][_0x2c42('0x15')]);return _0x4fbcc0(_0x41d9c8[_0x2c42('0x13')]['message']);}else{logger[_0x2c42('0xe')]('CmCompany,\x20%s,\x20%s',_0x60ee77,_0x2c42('0x10'));_0x4fbcc0(_0x41d9c8['result'][_0x2c42('0x15')]);}})[_0x2c42('0x16')](function(_0x3d8c46){logger[_0x2c42('0x13')](_0x2c42('0xf'),_0x60ee77,_0x3d8c46);_0x3ba866(_0x3d8c46);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index f150ec4..0ecbe94 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 _0x0069=['/:id/contacts','getContacts','post','addContacts','put','update','delete','destroy','multer','util','express','fs-extra','../../components/interaction/service','get','index','/describe','isAuthenticated','describe','/:id','show'];(function(_0x531b72,_0xfff46b){var _0x5375c4=function(_0x4a21e3){while(--_0x4a21e3){_0x531b72['push'](_0x531b72['shift']());}};_0x5375c4(++_0xfff46b);}(_0x0069,0x15c));var _0x9006=function(_0xdf5462,_0x66522a){_0xdf5462=_0xdf5462-0x0;var _0x12bcb0=_0x0069[_0xdf5462];return _0x12bcb0;};'use strict';var multer=require(_0x9006('0x0'));var util=require(_0x9006('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x9006('0x2'));var router=express['Router']();var fs_extra=require(_0x9006('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x9006('0x4'));var config=require('../../config/environment');var controller=require('./cmCompany.controller');router[_0x9006('0x5')]('/',auth['isAuthenticated'](),controller[_0x9006('0x6')]);router['get'](_0x9006('0x7'),auth[_0x9006('0x8')](),controller[_0x9006('0x9')]);router[_0x9006('0x5')](_0x9006('0xa'),auth[_0x9006('0x8')](),controller[_0x9006('0xb')]);router[_0x9006('0x5')](_0x9006('0xc'),auth[_0x9006('0x8')](),controller[_0x9006('0xd')]);router[_0x9006('0xe')]('/',auth[_0x9006('0x8')](),controller['create']);router[_0x9006('0xe')](_0x9006('0xc'),auth['isAuthenticated'](),controller[_0x9006('0xf')]);router[_0x9006('0x10')](_0x9006('0xa'),auth[_0x9006('0x8')](),controller[_0x9006('0x11')]);router[_0x9006('0x12')]('/:id',auth[_0x9006('0x8')](),controller[_0x9006('0x13')]);module['exports']=router; \ No newline at end of file +var _0xdc73=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','/:id/contacts','getContacts','post','put','delete','destroy','exports','util','path'];(function(_0x46ee3c,_0x1c08f0){var _0x530a97=function(_0x194bba){while(--_0x194bba){_0x46ee3c['push'](_0x46ee3c['shift']());}};_0x530a97(++_0x1c08f0);}(_0xdc73,0x19c));var _0x3dc7=function(_0x482923,_0x4df687){_0x482923=_0x482923-0x0;var _0x13474e=_0xdc73[_0x482923];return _0x13474e;};'use strict';var multer=require('multer');var util=require(_0x3dc7('0x0'));var path=require(_0x3dc7('0x1'));var timeout=require(_0x3dc7('0x2'));var express=require(_0x3dc7('0x3'));var router=express[_0x3dc7('0x4')]();var fs_extra=require(_0x3dc7('0x5'));var auth=require(_0x3dc7('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x3dc7('0x7'));var controller=require('./cmCompany.controller');router[_0x3dc7('0x8')]('/',auth[_0x3dc7('0x9')](),controller['index']);router['get']('/describe',auth[_0x3dc7('0x9')](),controller['describe']);router[_0x3dc7('0x8')](_0x3dc7('0xa'),auth[_0x3dc7('0x9')](),controller['show']);router[_0x3dc7('0x8')](_0x3dc7('0xb'),auth['isAuthenticated'](),controller[_0x3dc7('0xc')]);router[_0x3dc7('0xd')]('/',auth[_0x3dc7('0x9')](),controller['create']);router['post'](_0x3dc7('0xb'),auth[_0x3dc7('0x9')](),controller['addContacts']);router[_0x3dc7('0xe')]('/:id',auth[_0x3dc7('0x9')](),controller['update']);router[_0x3dc7('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x3dc7('0x10')]);module[_0x3dc7('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 72a286b..0c0b099 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 _0xa9a3=['STRING','NOW','INTEGER','lodash','sequelize'];(function(_0x7bb32b,_0x2293aa){var _0x59c1c8=function(_0x114041){while(--_0x114041){_0x7bb32b['push'](_0x7bb32b['shift']());}};_0x59c1c8(++_0x2293aa);}(_0xa9a3,0x71));var _0x3a9a=function(_0x290fa6,_0x16d017){_0x290fa6=_0x290fa6-0x0;var _0x47f1f3=_0xa9a3[_0x290fa6];return _0x47f1f3;};'use strict';var _=require(_0x3a9a('0x0'));var Sequelize=require(_0x3a9a('0x1'));module['exports']={'firstName':{'type':Sequelize[_0x3a9a('0x2')],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x3a9a('0x2')]},'city':{'type':Sequelize[_0x3a9a('0x2')]},'country':{'type':Sequelize[_0x3a9a('0x2')]},'dateOfBirth':{'type':Sequelize[_0x3a9a('0x2')]},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x3a9a('0x2')]},'email':{'type':Sequelize[_0x3a9a('0x2')]},'url':{'type':Sequelize[_0x3a9a('0x2')]},'facebook':{'type':Sequelize[_0x3a9a('0x2')]},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize[_0x3a9a('0x2')]},'skype':{'type':Sequelize[_0x3a9a('0x2')]},'teams':{'type':Sequelize[_0x3a9a('0x2')]},'viber':{'type':Sequelize[_0x3a9a('0x2')]},'line':{'type':Sequelize[_0x3a9a('0x2')]},'wechat':{'type':Sequelize[_0x3a9a('0x2')]},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize['INTEGER']},'AdditionalPhones':{'type':Sequelize[_0x3a9a('0x2')]},'priority':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':Sequelize[_0x3a9a('0x3')]},'dialTimezone':{'type':Sequelize[_0x3a9a('0x2')]},'utcOffset':{'type':Sequelize[_0x3a9a('0x4')]}}; \ No newline at end of file +var _0x3a98=['exports','STRING','INTEGER','DATE','lodash','sequelize'];(function(_0x48918f,_0xc04b98){var _0x4a62dd=function(_0x55c146){while(--_0x55c146){_0x48918f['push'](_0x48918f['shift']());}};_0x4a62dd(++_0xc04b98);}(_0x3a98,0xa6));var _0x83a9=function(_0x539fb2,_0x5b6718){_0x539fb2=_0x539fb2-0x0;var _0x4d583d=_0x3a98[_0x539fb2];return _0x4d583d;};'use strict';var _=require(_0x83a9('0x0'));var Sequelize=require(_0x83a9('0x1'));module[_0x83a9('0x2')]={'firstName':{'type':Sequelize[_0x83a9('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0x83a9('0x3')]},'street':{'type':Sequelize[_0x83a9('0x3')]},'postalCode':{'type':Sequelize[_0x83a9('0x3')]},'city':{'type':Sequelize[_0x83a9('0x3')]},'country':{'type':Sequelize[_0x83a9('0x3')]},'dateOfBirth':{'type':Sequelize[_0x83a9('0x3')]},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize[_0x83a9('0x3')]},'mobile':{'type':Sequelize[_0x83a9('0x3')]},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x83a9('0x3')]},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize[_0x83a9('0x3')]},'twitter':{'type':Sequelize[_0x83a9('0x3')]},'skype':{'type':Sequelize[_0x83a9('0x3')]},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize[_0x83a9('0x3')]},'line':{'type':Sequelize[_0x83a9('0x3')]},'wechat':{'type':Sequelize[_0x83a9('0x3')]},'telegram':{'type':Sequelize[_0x83a9('0x3')]},'UserId':{'type':Sequelize[_0x83a9('0x4')]},'AdditionalPhones':{'type':Sequelize[_0x83a9('0x3')]},'priority':{'type':Sequelize[_0x83a9('0x4')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x83a9('0x5')],'defaultValue':Sequelize['NOW']},'dialTimezone':{'type':Sequelize['STRING']},'utcOffset':{'type':Sequelize[_0x83a9('0x4')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index e309f84..05f9969 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 _0xb14c=['order','sort','pick','filter','options','nolimit','setTags','ids','ContactItemType','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','PHONE','CmHopperAdditionalPhone','item','`ItemType`.OrderBy','ItemType.OrderBy','ItemType','getAdditionalPhones','fromContactId','CmContactId','toContactId','rescheduleAdditionalPhones','getHoppers','ContactId','include','rows','includeAll','getJscriptySessions','JscriptySessionReport','uploadCsv','No\x20ListId\x20specified','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','binding_keys','split','Incorrect\x20binding\x20parameters\x20passed!','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','file','filename','chmodSync','0777','child_process','fork','../../components/import/cm/csv','pid','upload','createReadStream','parse','meta','import','User','binding','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','agent','getJourney','mail','sms','openchannel','fax','whatsapp','voice','-createdAt','resolve','includes','channel','Invalid\x20channel','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','uniqueid','source','starttime','endtime','duration','note','createdAt','userDisposition','userSecondDisposition','UserId','fullname','alias','DESC','startCase','chat','Account','closed','closedAt','disposition','thirdDisposition','key','Owner','customerIp','customerPort','deviceModel','osName','ratingMessage','ratingType','ratingValue','subject','externalUrl','threadId','findAndCountAll','flatten','reverse','moment','bluebird','path','squel','papaparse','ioredis','../../components/contacts','../../components/parsers/qs','api','../../config/environment/shared','redis','localhost','socket.io-emitter','register','json','undefined','count','offset','limit','set','update','then','destroy','status','end','error','name','index','getOptions','findAll','query','catch','find','describe','CmContact','tags','keys','length','startsWith','cf_','columnName','displayName','custom','type','values','info','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','forEach','hasOwnProperty','merge','body','from','get','isArray','join','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','CmContactHasItem','CmHopperFinal','CmHopperHistory','ReportAgentPreview','VoiceCallReport','ChatQueueReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','WhatsappInteraction','WhatsappQueueReport','dialTimezone','isNil','timezones','utcOffset','additionalPhones','bulkCreate','each','duplicates','where','$or','ListId','spread','push','contact','all','show','Tags','color','tag','Phones','sequelize','literal','CmCustomField','map','format','$and','omit','pickBy','cf_%d','isEmpty','setFields','id\x20=\x20?','params','text','phone','getTags','findOne','model','Tag','rawAttributes','filters','intersection','fields','attributes'];(function(_0x6bfb1a,_0x59e024){var _0x7e6759=function(_0x126273){while(--_0x126273){_0x6bfb1a['push'](_0x6bfb1a['shift']());}};_0x7e6759(++_0x59e024);}(_0xb14c,0x169));var _0xcb14=function(_0x3b5587,_0x22a6f4){_0x3b5587=_0x3b5587-0x0;var _0x3fbb62=_0xb14c[_0x3b5587];return _0x3fbb62;};'use strict';var moment=require(_0xcb14('0x0'));var BPromise=require(_0xcb14('0x1'));var util=require('util');var path=require(_0xcb14('0x2'));var fs=require('fs');var _=require('lodash');var squel=require(_0xcb14('0x3'));var Papa=require(_0xcb14('0x4'));var Redis=require(_0xcb14('0x5'));var contacts=require(_0xcb14('0x6'));var qs=require(_0xcb14('0x7'));var logger=require('../../config/logger')(_0xcb14('0x8'));var config=require('../../config/environment');var shared=require(_0xcb14('0x9'));var db=require('../../mysqldb')['db'];config[_0xcb14('0xa')]=_['defaults'](config['redis'],{'host':_0xcb14('0xb'),'port':0x18eb});var socket=require(_0xcb14('0xc'))(new Redis(config[_0xcb14('0xa')]));require('./cmContact.socket')[_0xcb14('0xd')](socket);function respondWithResult(_0x3cc647,_0x35346e){_0x35346e=_0x35346e||0xc8;return function(_0x19c5a2){if(_0x19c5a2){return _0x3cc647['status'](_0x35346e)[_0xcb14('0xe')](_0x19c5a2);}};}function respondWithFilteredResult(_0x59868e,_0x20b65f){return function(_0x20a7e6){if(_0x20a7e6){var _0x342cec=typeof _0x20b65f['offset']===_0xcb14('0xf')&&typeof _0x20b65f['limit']==='undefined';var _0x29af5c=_0x20a7e6['count'];var _0x4eca71=_0x342cec?0x0:_0x20b65f['offset'];var _0x103a7b=_0x342cec?_0x20a7e6[_0xcb14('0x10')]:_0x20b65f[_0xcb14('0x11')]+_0x20b65f[_0xcb14('0x12')];var _0x188a9a;if(_0x103a7b>=_0x29af5c){_0x103a7b=_0x29af5c;_0x188a9a=0xc8;}else{_0x188a9a=0xce;}_0x59868e['status'](_0x188a9a);return _0x59868e[_0xcb14('0x13')]('Content-Range',_0x4eca71+'-'+_0x103a7b+'/'+_0x29af5c)['json'](_0x20a7e6);}return null;};}function saveUpdates(_0x4c93fc){return function(_0x64c2a0){if(_0x64c2a0){return _0x64c2a0[_0xcb14('0x14')](_0x4c93fc)[_0xcb14('0x15')](function(_0x4b04e2){return _0x4b04e2;});}return null;};}function removeEntity(_0x5761f2){return function(_0x37a3c9){if(_0x37a3c9){return _0x37a3c9[_0xcb14('0x16')]()[_0xcb14('0x15')](function(){_0x5761f2[_0xcb14('0x17')](0xcc)[_0xcb14('0x18')]();});}};}function handleEntityNotFound(_0x4b9c02){return function(_0x2a5914){if(!_0x2a5914){_0x4b9c02['sendStatus'](0x194);}return _0x2a5914;};}function handleError(_0x44f144,_0x3d6475){_0x3d6475=_0x3d6475||0x1f4;return function(_0xce57b8){logger[_0xcb14('0x19')](_0xce57b8['stack']);if(_0xce57b8[_0xcb14('0x1a')]){delete _0xce57b8[_0xcb14('0x1a')];}_0x44f144[_0xcb14('0x17')](_0x3d6475)['send'](_0xce57b8);};}exports[_0xcb14('0x1b')]=function(_0xa030c6,_0x5e51fc){var _0x3abd12={};return contacts['describe']()[_0xcb14('0x15')](function(_0x4089fe){_0x3abd12=qs[_0xcb14('0x1c')](_0x4089fe,_0xa030c6);return contacts[_0xcb14('0x1d')](_0xa030c6[_0xcb14('0x1e')],_0xa030c6['user'],_0x3abd12,_0x4089fe);})[_0xcb14('0x15')](respondWithFilteredResult(_0x5e51fc,_0x3abd12))[_0xcb14('0x1f')](handleError(_0x5e51fc,null));};exports[_0xcb14('0x16')]=function(_0x17d0f6,_0x11480f){return db['CmContact'][_0xcb14('0x20')]({'where':{'id':_0x17d0f6['params']['id']}})[_0xcb14('0x15')](handleEntityNotFound(_0x11480f,null))['then'](removeEntity(_0x11480f,null))['catch'](handleError(_0x11480f,null));};exports[_0xcb14('0x21')]=function(_0x22674e,_0x4a2c56){return db[_0xcb14('0x22')][_0xcb14('0x21')]()['then'](function(_0x3b67fc){delete _0x3b67fc[_0xcb14('0x23')];for(var _0x234f53=0x0;_0x234f530x0){return new Promise(function(_0x5def0f){var _0x5cdc58=[];for(var _0x16b291=0x0;_0x16b291<_0x46b882[_0xcb14('0x25')];_0x16b291++){_0x5cdc58[_0xcb14('0x5b')](insertAdditionalPhones(_0x46b882[_0x16b291][_0xcb14('0x5c')],_0x46b882[_0x16b291]['additionalPhones']));}Promise[_0xcb14('0x5d')](_0x5cdc58)['then'](function(){_0x5def0f(0x1);});})[_0xcb14('0x15')](function(){return{'success':_0x3be1fe,'failure':_0xcddd21,'duplicates':_0x36c6da};});}else{return{'success':_0x3be1fe,'failure':_0xcddd21,'duplicates':_0x36c6da};}}})[_0xcb14('0x15')](respondWithResult(_0xae1f93,0xc9))[_0xcb14('0x1f')](handleError(_0xae1f93,null));};exports[_0xcb14('0x5e')]=function(_0x19889f,_0x54378f){var _0x599371;return db[_0xcb14('0x22')][_0xcb14('0x21')]()[_0xcb14('0x15')](function(_0x1c14bc){return db[_0xcb14('0x22')][_0xcb14('0x20')]({'where':{'id':_0x19889f['params']['id']},'include':[{'model':db['Tag'],'as':_0xcb14('0x5f'),'attributes':['id',_0xcb14('0x1a'),_0xcb14('0x60')],'required':_0x19889f[_0xcb14('0x1e')][_0xcb14('0x61')]?!![]:![]},{'model':db[_0xcb14('0x43')],'as':_0xcb14('0x62'),'where':{'CmContactId':_0x19889f['params']['id']},'required':![],'include':[{'model':db['ContactItemType'],'as':'ItemType'}]}],'order':[db[_0xcb14('0x63')][_0xcb14('0x64')]('Phones.OrderBy')],'attributes':_[_0xcb14('0x24')](_0x1c14bc)});})[_0xcb14('0x15')](function(_0x1d4a3e){if(!_['isNil'](_0x1d4a3e)){_0x599371=_0x1d4a3e[_0xcb14('0x34')]({'plain':!![]});var _0x4162bd={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x1d4a3e&&_0x1d4a3e[_0xcb14('0x59')]){if(_0x1d4a3e[_0xcb14('0x59')]){_0x4162bd[_0xcb14('0x57')]['$and'][_0xcb14('0x5b')]({'ListId':{'$ne':_0x1d4a3e['ListId']}});}}return db[_0xcb14('0x65')][_0xcb14('0x1d')](_0x4162bd);}})[_0xcb14('0x15')](function(_0x426577){if(!_[_0xcb14('0x50')](_0x426577)){return _['omit'](_0x599371,_[_0xcb14('0x66')](_0x426577,function(_0x549c79){return util[_0xcb14('0x67')]('cf_%d',_0x549c79['id']);}));}})[_0xcb14('0x15')](handleEntityNotFound(_0x54378f,null))[_0xcb14('0x15')](respondWithResult(_0x54378f,null))['catch'](handleError(_0x54378f,null));};exports[_0xcb14('0x14')]=function(_0x297d5c,_0x4baa0a){var _0x2dd925;if(_0x297d5c[_0xcb14('0x32')]['id']){delete _0x297d5c[_0xcb14('0x32')]['id'];}if(!_[_0xcb14('0x50')](_0x297d5c[_0xcb14('0x32')][_0xcb14('0x4f')])){var _0x4304e9=_0x297d5c['body'][_0xcb14('0x4f')];if(!_[_0xcb14('0x50')](shared[_0xcb14('0x51')][_0x4304e9]))_0x297d5c[_0xcb14('0x32')][_0xcb14('0x52')]=shared['timezones'][_0x4304e9][_0xcb14('0x52')];}return db['CmContact'][_0xcb14('0x20')]({'where':{'id':_0x297d5c['params']['id']}})[_0xcb14('0x15')](handleEntityNotFound(_0x4baa0a,null))['then'](saveUpdates(_0x297d5c[_0xcb14('0x32')],null))[_0xcb14('0x15')](function(_0x3da003){_0x2dd925=_0x3da003;var _0x2d0e36={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x3da003&&_0x3da003[_0xcb14('0x59')]){if(_0x3da003['ListId']){_0x2d0e36['where'][_0xcb14('0x68')][_0xcb14('0x5b')]({'ListId':{'$ne':_0x3da003[_0xcb14('0x59')]}});}}return db[_0xcb14('0x65')][_0xcb14('0x1d')](_0x2d0e36);})[_0xcb14('0x15')](function(_0x273802){if(_0x273802){return _[_0xcb14('0x69')](_[_0xcb14('0x6a')](_0x297d5c[_0xcb14('0x32')],function(_0x2d3fb1,_0xec5f00){return _[_0xcb14('0x26')](_0xec5f00,_0xcb14('0x27'));}),_[_0xcb14('0x66')](_0x273802,function(_0x29a235){return util[_0xcb14('0x67')](_0xcb14('0x6b'),_0x29a235['id']);}));}})[_0xcb14('0x15')](function(_0x10acbc){if(_0x10acbc&&!_[_0xcb14('0x6c')](_0x10acbc)){var _0x338bca=squel[_0xcb14('0x14')]()['table']('cm_contacts')[_0xcb14('0x6d')](_0x10acbc)[_0xcb14('0x57')](_0xcb14('0x6e'),_0x297d5c[_0xcb14('0x6f')]['id'])['toParam']();return db[_0xcb14('0x63')][_0xcb14('0x1e')](_0x338bca[_0xcb14('0x70')],{'replacements':_0x338bca[_0xcb14('0x2c')]});}})[_0xcb14('0x15')](function(){if(_0x297d5c['body'][_0xcb14('0x71')]&&_0x2dd925){return db[_0xcb14('0x38')][_0xcb14('0x14')]({'phone':_0x297d5c['body']['phone'],'OrderBy':0x0},{'where':{'ContactId':_0x2dd925['id']}});}})[_0xcb14('0x15')](function(){return _0x2dd925;})[_0xcb14('0x15')](respondWithResult(_0x4baa0a,null))[_0xcb14('0x1f')](handleError(_0x4baa0a,null));};exports[_0xcb14('0x72')]=function(_0x2839bd,_0x51661b){var _0x9d7790={};var _0x54aa0e={};var _0x269983;var _0x18282e;return db['CmContact'][_0xcb14('0x73')]({'where':{'id':_0x2839bd[_0xcb14('0x6f')]['id']}})[_0xcb14('0x15')](handleEntityNotFound(_0x51661b,null))[_0xcb14('0x15')](function(_0x41e89e){if(_0x41e89e){_0x269983=_0x41e89e;_0x54aa0e[_0xcb14('0x74')]=_[_0xcb14('0x24')](db[_0xcb14('0x75')][_0xcb14('0x76')]);_0x54aa0e[_0xcb14('0x1e')]=_['keys'](_0x2839bd['query']);_0x54aa0e[_0xcb14('0x77')]=_['intersection'](_0x54aa0e['model'],_0x54aa0e['query']);_0x9d7790['attributes']=_[_0xcb14('0x78')](_0x54aa0e[_0xcb14('0x74')],qs[_0xcb14('0x79')](_0x2839bd[_0xcb14('0x1e')][_0xcb14('0x79')]));_0x9d7790[_0xcb14('0x7a')]=_0x9d7790[_0xcb14('0x7a')][_0xcb14('0x25')]?_0x9d7790[_0xcb14('0x7a')]:_0x54aa0e[_0xcb14('0x74')];_0x9d7790[_0xcb14('0x7b')]=qs[_0xcb14('0x7c')](_0x2839bd[_0xcb14('0x1e')][_0xcb14('0x7c')]);_0x9d7790[_0xcb14('0x57')]=qs[_0xcb14('0x77')](_[_0xcb14('0x7d')](_0x2839bd[_0xcb14('0x1e')],_0x54aa0e[_0xcb14('0x77')]));if(_0x2839bd[_0xcb14('0x1e')]['filter']){_0x9d7790[_0xcb14('0x57')]=_[_0xcb14('0x31')](_0x9d7790[_0xcb14('0x57')],{'$or':_[_0xcb14('0x66')](_0x9d7790[_0xcb14('0x7a')],function(_0x5649f4){var _0x296901={};_0x296901[_0x5649f4]={'$like':'%'+_0x2839bd[_0xcb14('0x1e')][_0xcb14('0x7e')]+'%'};return _0x296901;})});}_0x9d7790=_[_0xcb14('0x31')]({},_0x9d7790,_0x2839bd[_0xcb14('0x7f')]);return _0x269983[_0xcb14('0x72')](_0x9d7790);}})['then'](function(_0x3fa48d){if(_0x3fa48d){_0x18282e=_0x3fa48d[_0xcb14('0x25')];if(!_0x2839bd['query'][_0xcb14('0x30')](_0xcb14('0x80'))){_0x9d7790[_0xcb14('0x12')]=qs['limit'](_0x2839bd[_0xcb14('0x1e')][_0xcb14('0x12')]);_0x9d7790[_0xcb14('0x11')]=qs[_0xcb14('0x11')](_0x2839bd[_0xcb14('0x1e')][_0xcb14('0x11')]);}return _0x269983['getTags'](_0x9d7790);}})[_0xcb14('0x15')](function(_0x1be216){if(_0x1be216){return _0x1be216?{'count':_0x18282e,'rows':_0x1be216}:null;}})[_0xcb14('0x15')](respondWithResult(_0x51661b,null))[_0xcb14('0x1f')](handleError(_0x51661b,null));};exports[_0xcb14('0x81')]=function(_0x2cf31d,_0x5c7867){if(_0x2cf31d[_0xcb14('0x32')]['id']){delete _0x2cf31d[_0xcb14('0x32')]['id'];}return db[_0xcb14('0x22')][_0xcb14('0x73')]({'where':{'id':_0x2cf31d['params']['id']}})[_0xcb14('0x15')](handleEntityNotFound(_0x5c7867,null))[_0xcb14('0x15')](function(_0x13b48f){if(_0x13b48f){return _0x13b48f[_0xcb14('0x81')](_0x2cf31d['body'][_0xcb14('0x82')]||[]);}return null;})[_0xcb14('0x15')](respondWithResult(_0x5c7867,null))[_0xcb14('0x1f')](handleError(_0x5c7867,null));};exports['setAdditionalPhones']=function(_0x20184f,_0xd21a5f){var _0x38389a=[];_0x38389a['push'](addAdditionalPhones(_0x20184f[_0xcb14('0x32')]));Promise[_0xcb14('0x5d')](_0x38389a)[_0xcb14('0x15')](function(){_0x38389a=[];_0x38389a[_0xcb14('0x5b')](deleteCmHopperPhones(_0x20184f[_0xcb14('0x32')]['id']));_0x38389a[_0xcb14('0x5b')](addCmHopperPhones(_0x20184f[_0xcb14('0x32')]['id']));Promise[_0xcb14('0x5d')](_0x38389a)[_0xcb14('0x15')](function(){return[0x1];})[_0xcb14('0x15')](respondWithResult(_0xd21a5f,null));});};function addAdditionalPhones(_0x1ebc9c){var _0x4f1fa0;return new Promise(function(_0x162dde){return db[_0xcb14('0x43')]['destroy']({'where':{'CmContactId':_0x1ebc9c['id']}})['then'](function(){db[_0xcb14('0x83')]['findAll']({'raw':!![],'attributes':['id',_0xcb14('0x84')]})[_0xcb14('0x15')](function(_0x372ef2){var _0x279512=[];for(var _0x546ca6=0x0;_0x546ca6<_0x1ebc9c[_0xcb14('0x85')][_0xcb14('0x25')];_0x546ca6++){var _0x181790=_0x1ebc9c[_0xcb14('0x86')]?_[_0xcb14('0x50')](_0x1ebc9c['item_types'][_0x546ca6])?'':_0x1ebc9c['item_types'][_0x546ca6]:_0x1ebc9c[_0xcb14('0x85')][_0x546ca6][_0xcb14('0x87')]?_0x1ebc9c[_0xcb14('0x85')][_0x546ca6][_0xcb14('0x87')]:'';var _0x5b3208=_[_0xcb14('0x50')](_0x1ebc9c['items'][_0x546ca6][_0xcb14('0x88')])?'':_0x1ebc9c[_0xcb14('0x85')][_0x546ca6][_0xcb14('0x88')];var _0x1ebd4e=_0x181790+':'+_0x1ebc9c[_0xcb14('0x85')][_0x546ca6][_0xcb14('0x71')]+'§'+_0x5b3208;if(_[_0xcb14('0x50')](_0x4f1fa0))_0x4f1fa0=_0x1ebd4e;else _0x4f1fa0+=';'+_0x1ebd4e;var _0x12e9af=null;var _0x112fcd=null;if(_0x1ebc9c['item_types']){if(!_[_0xcb14('0x50')](_0x1ebc9c[_0xcb14('0x86')][_0x546ca6])){_0x112fcd=_[_0xcb14('0x20')](_0x372ef2,function(_0xaa0ce1){return _0xaa0ce1['id']===_0x1ebc9c[_0xcb14('0x86')][_0x546ca6];});if(!_[_0xcb14('0x50')](_0x112fcd)){_0x12e9af=_0x112fcd[_0xcb14('0x84')];}}}else{if(!_[_0xcb14('0x50')](_0x1ebc9c[_0xcb14('0x85')][_0x546ca6])){_0x112fcd=_[_0xcb14('0x20')](_0x372ef2,function(_0x26e624){return _0x26e624['id']===_0x1ebc9c['items'][_0x546ca6][_0xcb14('0x87')];});if(!_[_0xcb14('0x50')](_0x112fcd)){_0x12e9af=_0x546ca6;}}}if(_[_0xcb14('0x50')](_0x12e9af)){_0x12e9af=0x64;}_0x279512['push'](addAdditionalPhone(_0x1ebc9c['id'],_0x1ebc9c[_0xcb14('0x85')][_0x546ca6][_0xcb14('0x71')],_0x1ebc9c['item_types']?_[_0xcb14('0x50')](_0x1ebc9c[_0xcb14('0x86')][_0x546ca6])?null:_0x1ebc9c[_0xcb14('0x86')][_0x546ca6]:_0x1ebc9c[_0xcb14('0x85')][_0x546ca6][_0xcb14('0x87')]?_0x1ebc9c[_0xcb14('0x85')][_0x546ca6][_0xcb14('0x87')]:null,_0x12e9af,_0x5b3208));}Promise[_0xcb14('0x5d')](_0x279512)['then'](function(){db['CmContact']['update']({'AdditionalPhones':_0x4f1fa0},{'where':{'id':_0x1ebc9c['id']}})[_0xcb14('0x15')](function(){_0x162dde(0x1);});});});});});}function addAdditionalPhone(_0x5b3ba0,_0xc05fb8,_0x4b20a0,_0x38a3f6,_0x4ac143){return db[_0xcb14('0x43')][_0xcb14('0x20')]({'where':{'CmContactId':_0x5b3ba0,'item':_0xc05fb8}})[_0xcb14('0x15')](function(_0x547726){if(_0x547726)logger['info'](_0xcb14('0x89'),_0x547726);else{db['CmContactHasItem'][_0xcb14('0x3c')]({'CmContactId':_0x5b3ba0,'item':_0xc05fb8,'ItemTypeId':_0x4b20a0,'OrderBy':_0x38a3f6,'ItemClass':_0xcb14('0x8a'),'description':_0x4ac143});}});}function deleteCmHopperPhones(_0x33f5ea){return new Promise(function(_0x5d893e){return db[_0xcb14('0x38')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x33f5ea}})[_0xcb14('0x15')](function(_0x2a2789){db[_0xcb14('0x8b')][_0xcb14('0x16')]({'where':{'CmHopperId':{'$in':_['map'](_0x2a2789,'id')}}});})[_0xcb14('0x15')](function(){_0x5d893e(0x1);});});}function addCmHopperPhones(_0x2ce033){return new Promise(function(_0x43dc42){return db['CmHopper']['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x2ce033}})['then'](function(_0x235abb){var _0x461511=[];_[_0xcb14('0x66')](_0x235abb,function(_0x399852){_0x461511['push'](createCmHopperPhone(_0x2ce033,_0x399852['id']));});Promise[_0xcb14('0x5d')](_0x461511)[_0xcb14('0x15')](function(){_0x43dc42(0x1);});});});}function createCmHopperPhone(_0x18f5f7,_0x2d3eda){return new Promise(function(_0x56d8a3){db[_0xcb14('0x43')][_0xcb14('0x1d')]({'raw':!![],'attributes':[_0xcb14('0x8c'),_0xcb14('0x84')],'where':{'CmContactId':_0x18f5f7,'ItemClass':'PHONE'},'include':[{'model':db[_0xcb14('0x83')],'attributes':['OrderBy'],'as':'ItemType'}],'order':[_0xcb14('0x84'),db[_0xcb14('0x63')][_0xcb14('0x64')](_0xcb14('0x8d'))]})[_0xcb14('0x15')](function(_0x2750c4){var _0xc65ba7=0x1;var _0x4ccf86=_[_0xcb14('0x66')](_0x2750c4,function(_0x45f290){_0x45f290['CmHopperId']=_0x2d3eda;_0x45f290['phone']=_0x45f290['item'];_0x45f290[_0xcb14('0x84')]=_0xc65ba7;delete _0x45f290[_0xcb14('0x8e')];_0xc65ba7=_0xc65ba7+0x1;return _0x45f290;});return db[_0xcb14('0x8b')][_0xcb14('0x54')](_0x4ccf86,{});})['then'](function(){_0x56d8a3(0x1);});});}function insertAdditionalPhones(_0x3cbc96,_0x50ec17){return new Promise(function(_0x135ea1){var _0x44fb4f=[];for(var _0x3beac4=0x0;_0x3beac4<_0x50ec17[_0xcb14('0x25')];_0x3beac4++){var _0x44cbb4=_0x50ec17[_0x3beac4];_0x44fb4f[_0xcb14('0x5b')](parseContactItemType(_0x44cbb4));}Promise['all'](_0x44fb4f)[_0xcb14('0x15')](function(){var _0x35855c={'id':_0x3cbc96['id'],'items':_0x50ec17};return addAdditionalPhones(_0x35855c)[_0xcb14('0x15')](function(){return addCmHopperPhones(_0x3cbc96['id']);});})[_0xcb14('0x15')](function(){_0x135ea1(_0x3cbc96);});});}function parseContactItemType(_0x4d66f3){return new Promise(function(_0x1ee5ea){if(_0x4d66f3[_0xcb14('0x30')](_0xcb14('0x87'))){_0x1ee5ea(_0x4d66f3);}else{return db[_0xcb14('0x83')][_0xcb14('0x20')]({'where':{'name':_0x4d66f3[_0xcb14('0x8f')]}})[_0xcb14('0x15')](function(_0x4f9474){if(_[_0xcb14('0x50')](_0x4f9474))_0x4d66f3[_0xcb14('0x87')]=null;else _0x4d66f3[_0xcb14('0x87')]=_0x4f9474['id'];_0x1ee5ea(_0x4d66f3);});}});}exports[_0xcb14('0x90')]=function(_0x5c7a26,_0x516a2d){return db[_0xcb14('0x43')][_0xcb14('0x1d')]({'raw':!![],'where':{'CmContactId':_0x5c7a26[_0xcb14('0x6f')]['id'],'ItemClass':_0xcb14('0x8a')},'include':[{'model':db['ContactItemType'],'as':_0xcb14('0x8f')}],'order':[[_0xcb14('0x84')],[db[_0xcb14('0x63')]['literal'](_0xcb14('0x8d'))]]})[_0xcb14('0x15')](function(_0x2e25ad){return _0x2e25ad;})[_0xcb14('0x15')](respondWithResult(_0x516a2d,null))['catch'](handleError(_0x516a2d,null));};exports['duplicateAdditionalPhones']=function(_0x101400,_0x14ae1c){return db['CmContactHasItem']['findAll']({'raw':!![],'where':{'CmContactId':_0x101400[_0xcb14('0x32')][_0xcb14('0x91')]}})[_0xcb14('0x15')](function(_0x23f7dd){var _0x1d71b8=_['map'](_0x23f7dd,function(_0x3cceb9){_0x3cceb9[_0xcb14('0x92')]=_0x101400['body'][_0xcb14('0x93')];return _0x3cceb9;});return db[_0xcb14('0x43')][_0xcb14('0x54')](_0x1d71b8,{});})[_0xcb14('0x15')](function(){return addCmHopperPhones(_0x101400[_0xcb14('0x32')][_0xcb14('0x93')]);})[_0xcb14('0x15')](function(){return['ok'];})[_0xcb14('0x15')](respondWithResult(_0x14ae1c,null))[_0xcb14('0x1f')](handleError(_0x14ae1c,null));};exports[_0xcb14('0x94')]=function(_0x73249b,_0x2ec8a9){var _0x111903=[];_0x111903['push'](createCmHopperPhone(_0x73249b[_0xcb14('0x32')]['id'],_0x73249b[_0xcb14('0x32')]['hopperId']));Promise[_0xcb14('0x5d')](_0x111903)['then'](function(){return[0x1];})[_0xcb14('0x15')](respondWithResult(_0x2ec8a9,null));};exports[_0xcb14('0x95')]=function(_0x34ead4,_0x416902){var _0x1fae65={'raw':![],'where':{}};var _0x2d1a81={};var _0x8aa111={'count':0x0,'rows':[]};return db[_0xcb14('0x22')][_0xcb14('0x73')]({'where':{'id':_0x34ead4[_0xcb14('0x6f')]['id']}})['then'](handleEntityNotFound(_0x416902,null))[_0xcb14('0x15')](function(_0x598fa5){if(_0x598fa5){_0x2d1a81['model']=_[_0xcb14('0x24')](db[_0xcb14('0x38')]['rawAttributes']);_0x2d1a81[_0xcb14('0x1e')]=_[_0xcb14('0x24')](_0x34ead4[_0xcb14('0x1e')]);_0x2d1a81['filters']=_[_0xcb14('0x78')](_0x2d1a81[_0xcb14('0x74')],_0x2d1a81[_0xcb14('0x1e')]);_0x1fae65[_0xcb14('0x7a')]=_[_0xcb14('0x78')](_0x2d1a81[_0xcb14('0x74')],qs[_0xcb14('0x79')](_0x34ead4['query'][_0xcb14('0x79')]));_0x1fae65[_0xcb14('0x7a')]=_0x1fae65[_0xcb14('0x7a')]['length']?_0x1fae65[_0xcb14('0x7a')]:_0x2d1a81[_0xcb14('0x74')];if(!_0x34ead4[_0xcb14('0x1e')][_0xcb14('0x30')](_0xcb14('0x80'))){_0x1fae65['limit']=qs[_0xcb14('0x12')](_0x34ead4[_0xcb14('0x1e')]['limit']);_0x1fae65[_0xcb14('0x11')]=qs[_0xcb14('0x11')](_0x34ead4[_0xcb14('0x1e')][_0xcb14('0x11')]);}_0x1fae65[_0xcb14('0x7b')]=qs[_0xcb14('0x7c')](_0x34ead4['query']['sort']);_0x1fae65[_0xcb14('0x57')]=qs[_0xcb14('0x77')](_[_0xcb14('0x7d')](_0x34ead4['query'],_0x2d1a81[_0xcb14('0x77')]));_0x1fae65[_0xcb14('0x57')][_0xcb14('0x96')]=_0x598fa5['id'];if(_0x34ead4[_0xcb14('0x1e')][_0xcb14('0x7e')]){_0x1fae65[_0xcb14('0x57')]=_[_0xcb14('0x31')](_0x1fae65[_0xcb14('0x57')],{'$or':_[_0xcb14('0x66')](_0x1fae65[_0xcb14('0x7a')],function(_0xa181a7){var _0x282484={};_0x282484[_0xa181a7]={'$like':'%'+_0x34ead4[_0xcb14('0x1e')][_0xcb14('0x7e')]+'%'};return _0x282484;})});}_0x1fae65=_[_0xcb14('0x31')]({},_0x1fae65,_0x34ead4[_0xcb14('0x7f')]);return db['CmHopper'][_0xcb14('0x10')]({'where':_0x1fae65[_0xcb14('0x57')]})[_0xcb14('0x15')](function(_0x3f7f25){_0x8aa111[_0xcb14('0x10')]=_0x3f7f25;if(_0x34ead4[_0xcb14('0x1e')]['includeAll']){_0x1fae65[_0xcb14('0x97')]=[{'all':!![]}];}return db[_0xcb14('0x38')]['findAll'](_0x1fae65);})[_0xcb14('0x15')](function(_0x425bd7){_0x8aa111[_0xcb14('0x98')]=_0x425bd7;return _0x8aa111;});}})[_0xcb14('0x15')](respondWithFilteredResult(_0x416902,_0x1fae65))[_0xcb14('0x1f')](handleError(_0x416902,null));};exports['getHopperHistories']=function(_0x5ca391,_0x57e3e1){var _0x592a88={'raw':!![],'where':{}};var _0xf52aca={};var _0x366396={'count':0x0,'rows':[]};return db['CmContact'][_0xcb14('0x73')]({'where':{'id':_0x5ca391[_0xcb14('0x6f')]['id']}})[_0xcb14('0x15')](handleEntityNotFound(_0x57e3e1,null))[_0xcb14('0x15')](function(_0x12ac17){if(_0x12ac17){_0xf52aca[_0xcb14('0x74')]=_[_0xcb14('0x24')](db[_0xcb14('0x45')]['rawAttributes']);_0xf52aca[_0xcb14('0x1e')]=_[_0xcb14('0x24')](_0x5ca391['query']);_0xf52aca[_0xcb14('0x77')]=_[_0xcb14('0x78')](_0xf52aca['model'],_0xf52aca[_0xcb14('0x1e')]);_0x592a88[_0xcb14('0x7a')]=_[_0xcb14('0x78')](_0xf52aca[_0xcb14('0x74')],qs['fields'](_0x5ca391[_0xcb14('0x1e')][_0xcb14('0x79')]));_0x592a88['attributes']=_0x592a88[_0xcb14('0x7a')]['length']?_0x592a88[_0xcb14('0x7a')]:_0xf52aca[_0xcb14('0x74')];if(!_0x5ca391[_0xcb14('0x1e')][_0xcb14('0x30')](_0xcb14('0x80'))){_0x592a88[_0xcb14('0x12')]=qs[_0xcb14('0x12')](_0x5ca391[_0xcb14('0x1e')][_0xcb14('0x12')]);_0x592a88[_0xcb14('0x11')]=qs[_0xcb14('0x11')](_0x5ca391[_0xcb14('0x1e')]['offset']);}_0x592a88['order']=qs[_0xcb14('0x7c')](_0x5ca391[_0xcb14('0x1e')][_0xcb14('0x7c')]);_0x592a88[_0xcb14('0x57')]=qs[_0xcb14('0x77')](_[_0xcb14('0x7d')](_0x5ca391[_0xcb14('0x1e')],_0xf52aca[_0xcb14('0x77')]));_0x592a88[_0xcb14('0x57')]['ContactId']=_0x12ac17['id'];if(_0x5ca391['query'][_0xcb14('0x7e')]){_0x592a88[_0xcb14('0x57')]=_[_0xcb14('0x31')](_0x592a88[_0xcb14('0x57')],{'$or':_['map'](_0x592a88[_0xcb14('0x7a')],function(_0x43ab80){var _0x521490={};_0x521490[_0x43ab80]={'$like':'%'+_0x5ca391['query'][_0xcb14('0x7e')]+'%'};return _0x521490;})});}_0x592a88=_[_0xcb14('0x31')]({},_0x592a88,_0x5ca391[_0xcb14('0x7f')]);return db[_0xcb14('0x45')][_0xcb14('0x10')]({'where':_0x592a88[_0xcb14('0x57')]})[_0xcb14('0x15')](function(_0x55edc5){_0x366396[_0xcb14('0x10')]=_0x55edc5;if(_0x5ca391[_0xcb14('0x1e')][_0xcb14('0x99')]){_0x592a88['include']=[{'all':!![]}];}return db[_0xcb14('0x45')][_0xcb14('0x1d')](_0x592a88);})[_0xcb14('0x15')](function(_0x3fc733){_0x366396[_0xcb14('0x98')]=_0x3fc733;return _0x366396;});}})[_0xcb14('0x15')](respondWithFilteredResult(_0x57e3e1,_0x592a88))[_0xcb14('0x1f')](handleError(_0x57e3e1,null));};exports['getHopperFinals']=function(_0x5ba9d5,_0x314596){var _0x2eefe3={'raw':!![],'where':{}};var _0x1200c2={};var _0x22d068={'count':0x0,'rows':[]};return db['CmContact']['findOne']({'where':{'id':_0x5ba9d5['params']['id']}})[_0xcb14('0x15')](handleEntityNotFound(_0x314596,null))[_0xcb14('0x15')](function(_0x2bf0b3){if(_0x2bf0b3){_0x1200c2['model']=_[_0xcb14('0x24')](db[_0xcb14('0x44')]['rawAttributes']);_0x1200c2[_0xcb14('0x1e')]=_[_0xcb14('0x24')](_0x5ba9d5[_0xcb14('0x1e')]);_0x1200c2['filters']=_[_0xcb14('0x78')](_0x1200c2[_0xcb14('0x74')],_0x1200c2[_0xcb14('0x1e')]);_0x2eefe3[_0xcb14('0x7a')]=_[_0xcb14('0x78')](_0x1200c2[_0xcb14('0x74')],qs[_0xcb14('0x79')](_0x5ba9d5['query'][_0xcb14('0x79')]));_0x2eefe3[_0xcb14('0x7a')]=_0x2eefe3[_0xcb14('0x7a')]['length']?_0x2eefe3[_0xcb14('0x7a')]:_0x1200c2[_0xcb14('0x74')];if(!_0x5ba9d5[_0xcb14('0x1e')][_0xcb14('0x30')](_0xcb14('0x80'))){_0x2eefe3[_0xcb14('0x12')]=qs[_0xcb14('0x12')](_0x5ba9d5[_0xcb14('0x1e')][_0xcb14('0x12')]);_0x2eefe3[_0xcb14('0x11')]=qs[_0xcb14('0x11')](_0x5ba9d5['query']['offset']);}_0x2eefe3[_0xcb14('0x7b')]=qs[_0xcb14('0x7c')](_0x5ba9d5[_0xcb14('0x1e')][_0xcb14('0x7c')]);_0x2eefe3[_0xcb14('0x57')]=qs[_0xcb14('0x77')](_[_0xcb14('0x7d')](_0x5ba9d5[_0xcb14('0x1e')],_0x1200c2[_0xcb14('0x77')]));_0x2eefe3[_0xcb14('0x57')][_0xcb14('0x96')]=_0x2bf0b3['id'];if(_0x5ba9d5[_0xcb14('0x1e')][_0xcb14('0x7e')]){_0x2eefe3[_0xcb14('0x57')]=_[_0xcb14('0x31')](_0x2eefe3[_0xcb14('0x57')],{'$or':_[_0xcb14('0x66')](_0x2eefe3['attributes'],function(_0x147589){var _0x2eff23={};_0x2eff23[_0x147589]={'$like':'%'+_0x5ba9d5[_0xcb14('0x1e')][_0xcb14('0x7e')]+'%'};return _0x2eff23;})});}_0x2eefe3=_[_0xcb14('0x31')]({},_0x2eefe3,_0x5ba9d5[_0xcb14('0x7f')]);return db['CmHopperFinal'][_0xcb14('0x10')]({'where':_0x2eefe3[_0xcb14('0x57')]})[_0xcb14('0x15')](function(_0x3b7ef5){_0x22d068['count']=_0x3b7ef5;if(_0x5ba9d5[_0xcb14('0x1e')][_0xcb14('0x99')]){_0x2eefe3[_0xcb14('0x97')]=[{'all':!![]}];}return db[_0xcb14('0x44')][_0xcb14('0x1d')](_0x2eefe3);})[_0xcb14('0x15')](function(_0x117a5a){_0x22d068['rows']=_0x117a5a;return _0x22d068;});}})[_0xcb14('0x15')](respondWithFilteredResult(_0x314596,_0x2eefe3))['catch'](handleError(_0x314596,null));};exports[_0xcb14('0x9a')]=function(_0x1893cf,_0x409b94){var _0x17c934={'raw':!![],'where':{}};var _0xb55a47={};var _0x37ce37={'count':0x0,'rows':[]};return db[_0xcb14('0x22')][_0xcb14('0x73')]({'where':{'id':_0x1893cf[_0xcb14('0x6f')]['id']}})[_0xcb14('0x15')](handleEntityNotFound(_0x409b94,null))[_0xcb14('0x15')](function(_0x3f0f4d){if(_0x3f0f4d){_0xb55a47[_0xcb14('0x74')]=_[_0xcb14('0x24')](db[_0xcb14('0x9b')][_0xcb14('0x76')]);_0xb55a47['query']=_['keys'](_0x1893cf['query']);_0xb55a47[_0xcb14('0x77')]=_[_0xcb14('0x78')](_0xb55a47['model'],_0xb55a47[_0xcb14('0x1e')]);_0x17c934[_0xcb14('0x7a')]=_[_0xcb14('0x78')](_0xb55a47[_0xcb14('0x74')],qs['fields'](_0x1893cf[_0xcb14('0x1e')][_0xcb14('0x79')]));_0x17c934['attributes']=_0x17c934[_0xcb14('0x7a')][_0xcb14('0x25')]?_0x17c934['attributes']:_0xb55a47[_0xcb14('0x74')];if(!_0x1893cf[_0xcb14('0x1e')]['hasOwnProperty'](_0xcb14('0x80'))){_0x17c934[_0xcb14('0x12')]=qs[_0xcb14('0x12')](_0x1893cf[_0xcb14('0x1e')][_0xcb14('0x12')]);_0x17c934[_0xcb14('0x11')]=qs[_0xcb14('0x11')](_0x1893cf['query']['offset']);}_0x17c934[_0xcb14('0x7b')]=qs[_0xcb14('0x7c')](_0x1893cf[_0xcb14('0x1e')]['sort']);_0x17c934['where']=qs[_0xcb14('0x77')](_[_0xcb14('0x7d')](_0x1893cf[_0xcb14('0x1e')],_0xb55a47[_0xcb14('0x77')]));_0x17c934['where'][_0xcb14('0x96')]=_0x3f0f4d['id'];if(_0x1893cf[_0xcb14('0x1e')][_0xcb14('0x7e')]){_0x17c934[_0xcb14('0x57')]=_[_0xcb14('0x31')](_0x17c934[_0xcb14('0x57')],{'$or':_[_0xcb14('0x66')](_0x17c934[_0xcb14('0x7a')],function(_0x2e0e16){var _0x365db5={};_0x365db5[_0x2e0e16]={'$like':'%'+_0x1893cf[_0xcb14('0x1e')][_0xcb14('0x7e')]+'%'};return _0x365db5;})});}_0x17c934=_[_0xcb14('0x31')]({},_0x17c934,_0x1893cf[_0xcb14('0x7f')]);return db['JscriptySessionReport']['count']({'where':_0x17c934['where']})['then'](function(_0x5a038e){_0x37ce37[_0xcb14('0x10')]=_0x5a038e;if(_0x1893cf['query'][_0xcb14('0x99')]){_0x17c934[_0xcb14('0x97')]=[{'all':!![]}];}return db[_0xcb14('0x9b')][_0xcb14('0x1d')](_0x17c934);})[_0xcb14('0x15')](function(_0x44be73){_0x37ce37[_0xcb14('0x98')]=_0x44be73;return _0x37ce37;});}})[_0xcb14('0x15')](respondWithFilteredResult(_0x409b94,_0x17c934))[_0xcb14('0x1f')](handleError(_0x409b94,null));};exports[_0xcb14('0x9c')]=function(_0x13ee82,_0x13d9cb){try{if(!_0x13ee82[_0xcb14('0x32')]['ListId']){throw new Error(_0xcb14('0x9d'));}if(!_0x13ee82['body']['binding_keys']){throw new Error(_0xcb14('0x9e'));}if(!_0x13ee82['body'][_0xcb14('0x9f')]){throw new Error(_0xcb14('0xa0'));}if(!_0x13ee82['body'][_0xcb14('0xa1')]){throw new Error(_0xcb14('0xa2'));}var _0x5cf5ac=_0x13ee82[_0xcb14('0x32')][_0xcb14('0xa3')][_0xcb14('0xa4')](',');var _0x5dca52=_0x13ee82['body'][_0xcb14('0x9f')][_0xcb14('0xa4')](',');if(!_0x5cf5ac[_0xcb14('0x25')]||!_0x5dca52[_0xcb14('0x25')]||_0x5cf5ac[_0xcb14('0x25')]!==_0x5dca52[_0xcb14('0x25')]){throw new Error(_0xcb14('0xa5'));}_0x13ee82[_0xcb14('0x32')][_0xcb14('0x79')]=_['zipObject'](_0x5cf5ac,_0x5dca52);if(!_0x13ee82['body'][_0xcb14('0x79')]['phone']){throw new Error(_0xcb14('0xa6'));}if(!_0x13ee82[_0xcb14('0x32')][_0xcb14('0x79')][_0xcb14('0xa7')]){throw new Error(_0xcb14('0xa8'));}var _0x298425=path['join'](config[_0xcb14('0xa9')],'server/files/tmp',_0x13ee82[_0xcb14('0xaa')][_0xcb14('0xab')]);fs[_0xcb14('0xac')](_0x298425,parseInt(_0xcb14('0xad'),0x8));var _0x24a2c8=require(_0xcb14('0xae'))[_0xcb14('0xaf')](path[_0xcb14('0x36')](__dirname,_0xcb14('0xb0')),[_0x298425,_0x13ee82[_0xcb14('0x32')]['binding_keys'],_0x13ee82[_0xcb14('0x32')][_0xcb14('0x9f')],_0x13ee82['body']['ListId'],_0x13ee82[_0xcb14('0x32')]['CompanyId'],_0x13ee82[_0xcb14('0x32')][_0xcb14('0x56')],_0x13ee82[_0xcb14('0x32')][_0xcb14('0xa1')]]);return _0x13d9cb[_0xcb14('0x17')](0xc8)[_0xcb14('0xe')]({'message':'File\x20uploaded\x20correctly!','pid':_0x24a2c8[_0xcb14('0xb1')]});}catch(_0x1ab7dc){return _0x13d9cb[_0xcb14('0x17')](0x1f4)['send'](_0x1ab7dc);}};exports[_0xcb14('0xb2')]=function(_0x34b53f,_0x517f7b){var _0x189cd3=fs[_0xcb14('0xb3')](_0x34b53f['file'][_0xcb14('0x2')]);Papa[_0xcb14('0xb4')](_0x189cd3,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x265aa6){return _0x517f7b[_0xcb14('0x17')](0xc8)[_0xcb14('0xe')]({'file':_0x34b53f[_0xcb14('0xaa')],'fields':_0x265aa6[_0xcb14('0xb5')][_0xcb14('0x79')]});}});};exports[_0xcb14('0xb6')]=function(_0xabbdd4,_0x46896d){return db[_0xcb14('0xb7')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':'agent'}})[_0xcb14('0x15')](function(_0x3b3df2){var _0x7597f5=![];if(!_0xabbdd4[_0xcb14('0x32')][_0xcb14('0x59')]){throw new Error(_0xcb14('0x9d'));}if(!_0xabbdd4['body']['binding']['phone']){throw new Error('No\x20phone\x20column\x20specified');}if(!_0xabbdd4[_0xcb14('0x32')][_0xcb14('0xb8')][_0xcb14('0xa7')]){throw new Error(_0xcb14('0xa8'));}if(!_0xabbdd4['body'][_0xcb14('0xa1')]){throw new Error(_0xcb14('0xa2'));}var _0x4bb9b0=require(_0xcb14('0xae'))[_0xcb14('0xaf')](path[_0xcb14('0x36')](__dirname,_0xcb14('0xb9')),[_0xabbdd4[_0xcb14('0x6f')]['id'],JSON[_0xcb14('0xba')](_0xabbdd4[_0xcb14('0x32')]),JSON[_0xcb14('0xba')](_0x3b3df2)]);_0x4bb9b0['on'](_0xcb14('0xbb'),function(){_0x7597f5=!![];return _0x46896d['status'](0xc8)['json']({'message':_0xcb14('0xbc'),'pid':_0x4bb9b0[_0xcb14('0xb1')]});});_0x4bb9b0['on'](_0xcb14('0xbd'),function(_0x5acd8b){if(_0x5acd8b&&!_0x7597f5){return _0x46896d[_0xcb14('0x17')](0x1f4)[_0xcb14('0xe')]({'message':_0xcb14('0xbe'),'pid':_0x4bb9b0['pid']});}});})[_0xcb14('0x1f')](handleError(_0x46896d,null));};exports['importUpdates']=function(_0x4ba916,_0x45c538){return db[_0xcb14('0xb7')][_0xcb14('0x1d')]({'raw':!![],'attributes':['id'],'where':{'role':_0xcb14('0xbf')}})[_0xcb14('0x15')](function(_0x16c9b5){var _0x6ea736=![];if(!_0x4ba916[_0xcb14('0x32')]['ListId']){throw new Error(_0xcb14('0x9d'));}if(!_0x4ba916[_0xcb14('0x32')][_0xcb14('0xb8')]['phone']){throw new Error(_0xcb14('0xa6'));}if(!_0x4ba916[_0xcb14('0x32')]['binding'][_0xcb14('0xa7')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x4ba916[_0xcb14('0x32')][_0xcb14('0xa1')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x52d415=require(_0xcb14('0xae'))[_0xcb14('0xaf')](path[_0xcb14('0x36')](__dirname,'../../components/import/cm/csvUpdates'),[_0x4ba916[_0xcb14('0x6f')]['id'],JSON[_0xcb14('0xba')](_0x4ba916[_0xcb14('0x32')]),JSON[_0xcb14('0xba')](_0x16c9b5)]);_0x52d415['on'](_0xcb14('0xbb'),function(){_0x6ea736=!![];return _0x45c538[_0xcb14('0x17')](0xc8)[_0xcb14('0xe')]({'message':'start\x20child\x20process\x20correctly!','pid':_0x52d415[_0xcb14('0xb1')]});});_0x52d415['on'](_0xcb14('0xbd'),function(_0xcb539a){if(_0xcb539a&&!_0x6ea736){return _0x45c538[_0xcb14('0x17')](0x1f4)[_0xcb14('0xe')]({'message':_0xcb14('0xbe'),'pid':_0x52d415[_0xcb14('0xb1')]});}});})[_0xcb14('0x1f')](handleError(_0x45c538,null));};exports[_0xcb14('0xc0')]=function(_0x305ce4,_0x2edfa2){var _0x22b40c=[_0xcb14('0xc1'),'chat',_0xcb14('0xc2'),_0xcb14('0xc3'),_0xcb14('0xc4'),_0xcb14('0xc5'),_0xcb14('0xc6')];var _0xdadcaf={'offset':0x0,'order':qs['sort'](_0xcb14('0xc7'))},_0x43e364={'count':0x0,'rows':[]};Promise[_0xcb14('0xc8')]()[_0xcb14('0x15')](function(){if(_0x305ce4[_0xcb14('0x1e')]['channel']){if(!_[_0xcb14('0xc9')](_0x22b40c,_0x305ce4[_0xcb14('0x1e')][_0xcb14('0xca')]['toLowerCase']())){throw new Error(_0xcb14('0xcb'));}_0x22b40c=[_0x305ce4[_0xcb14('0x1e')][_0xcb14('0xca')]['toLowerCase']()];}if(_0x305ce4[_0xcb14('0x1e')][_0xcb14('0xcc')]){try{var _0x4096b6=JSON[_0xcb14('0xb4')](_0x305ce4[_0xcb14('0x1e')][_0xcb14('0xcc')]);if(!moment(_0x4096b6[_0xcb14('0x33')])[_0xcb14('0xcd')]()){throw new Error(_0xcb14('0xce'));}if(!moment(_0x4096b6['to'])['isValid']()){throw new Error('Invalid\x20date\x20for\x20range\x20to\x20filter');}}catch(_0x513870){throw new Error('Invalid\x20createdAt\x20filter');}}if(!_0x305ce4[_0xcb14('0x1e')]['hasOwnProperty'](_0xcb14('0x80'))){_0xdadcaf['limit']=qs[_0xcb14('0x12')](_0x305ce4[_0xcb14('0x1e')][_0xcb14('0x12')]||0xa);_0xdadcaf[_0xcb14('0x11')]=qs[_0xcb14('0x11')](_0x305ce4[_0xcb14('0x1e')][_0xcb14('0x11')]);}var _0x351a79=_0x22b40c[_0xcb14('0x66')](function(_0x9e90dd){if(_0x9e90dd===_0xcb14('0xc6')){var _0x88ede6={'attributes':['id',_0xcb14('0xcf'),_0xcb14('0x2b'),_0xcb14('0xd0'),'destination','callerid',_0xcb14('0xd1'),_0xcb14('0xd2'),_0xcb14('0xd3'),_0xcb14('0xd4'),_0xcb14('0xd5'),_0xcb14('0xd6'),_0xcb14('0xd7'),'userThirdDisposition',_0xcb14('0xd8')],'where':{'ContactId':_0x305ce4[_0xcb14('0x6f')]['id']},'include':[{'model':db[_0xcb14('0xb7')],'as':'User','attributes':['id','name',_0xcb14('0xd9'),_0xcb14('0xda')]}],'order':[[_0xcb14('0xd5'),_0xcb14('0xdb')]]};if(_0x305ce4['query'][_0xcb14('0xcc')]){_0x88ede6[_0xcb14('0x57')][_0xcb14('0xd5')]={'$gte':_0x4096b6['from'],'$lte':_0x4096b6['to']};}return db[_0xcb14('0x47')]['findAndCountAll'](_0x88ede6)['then'](function(_0x2ee62d){_0x43e364[_0xcb14('0x10')]+=_0x2ee62d[_0xcb14('0x10')];return _['map'](_0x2ee62d[_0xcb14('0x98')],function(_0x517fba){var _0x56aa37=_0x517fba['get']({'plain':!![]});_0x56aa37[_0xcb14('0xca')]=_0x9e90dd;if(_0x56aa37[_0xcb14('0xb7')]){_0x56aa37[_0xcb14('0xb7')]={'id':_0x56aa37[_0xcb14('0xb7')]['id'],'name':_0x56aa37[_0xcb14('0xb7')][_0xcb14('0x1a')],'fullname':_0x56aa37[_0xcb14('0xb7')][_0xcb14('0xd9')],'alias':_0x56aa37[_0xcb14('0xb7')][_0xcb14('0xda')]};}return _0x56aa37;});});}else{var _0x2ddb4d=_[_0xcb14('0xdc')](_0x9e90dd)+(_0x9e90dd===_0xcb14('0xdd')?'Website':_0xcb14('0xde'));var _0x410f3c={'attributes':['id',_0xcb14('0xdf'),_0xcb14('0xe0'),_0xcb14('0xd5'),_0xcb14('0xd4'),_0xcb14('0xe1'),'secondDisposition',_0xcb14('0xe2'),_0xcb14('0xd8'),_0x2ddb4d+'Id'],'where':{'ContactId':_0x305ce4['params']['id']},'include':[{'model':db[_0x2ddb4d],'as':_0xcb14('0xde'),'attributes':['id',_0xcb14('0x1a'),_0xcb14('0xe3')]},{'model':db[_0xcb14('0xb7')],'as':_0xcb14('0xe4'),'attributes':['id',_0xcb14('0x1a'),_0xcb14('0xd9')]},{'model':db['Tag'],'as':_0xcb14('0x5f'),'attributes':['id','name',_0xcb14('0x60')],'through':{'attributes':[]}}],'order':[[_0xcb14('0xd5'),_0xcb14('0xdb')]]};if(_0x305ce4['query']['range']){_0x410f3c[_0xcb14('0x57')][_0xcb14('0xd5')]={'$gte':_0x4096b6[_0xcb14('0x33')],'$lte':_0x4096b6['to']};}switch(_0x9e90dd){case'chat':_0x410f3c['attributes'][_0xcb14('0x5b')]('browserName',_0xcb14('0xe5'),_0xcb14('0xe6'),_0xcb14('0xe7'),_0xcb14('0xe8'),_0xcb14('0xe9'),_0xcb14('0xea'),_0xcb14('0xeb'),'referer');break;case _0xcb14('0xc1'):_0x410f3c[_0xcb14('0x7a')]['push'](_0xcb14('0xec'),'substatus');break;case _0xcb14('0xc3'):_0x410f3c[_0xcb14('0x7a')][_0xcb14('0x5b')](_0xcb14('0xed'),_0xcb14('0xee'));break;}return db[_['startCase'](_0x9e90dd)+'Interaction'][_0xcb14('0xef')](_0x410f3c)['then'](function(_0x29f82c){_0x43e364[_0xcb14('0x10')]+=_0x29f82c[_0xcb14('0x10')];return _['map'](_0x29f82c[_0xcb14('0x98')],function(_0xfceb6b){var _0x317ae3=_0xfceb6b[_0xcb14('0x34')]({'plain':!![]});_0x317ae3[_0xcb14('0xca')]=_0x9e90dd;if(_0x317ae3[_0xcb14('0xe4')]){_0x317ae3[_0xcb14('0xe4')]={'id':_0x317ae3['Owner']['id'],'name':_0x317ae3[_0xcb14('0xe4')][_0xcb14('0x1a')],'fullname':_0x317ae3[_0xcb14('0xe4')][_0xcb14('0xd9')]};}return _0x317ae3;});});}});return Promise[_0xcb14('0x5d')](_0x351a79);})[_0xcb14('0x15')](function(_0x4e92d0){return _(_0x4e92d0)[_0xcb14('0xf0')]()['sortBy'](_0xcb14('0xd5'))[_0xcb14('0xf1')]()['value']();})['then'](function(_0x4b9e6e){_0x43e364[_0xcb14('0x98')]=_0xdadcaf['limit']?_0x4b9e6e['slice'](_0xdadcaf[_0xcb14('0x11')],_0xdadcaf['offset']+_0xdadcaf['limit']):_0x4b9e6e;return _0x43e364;})[_0xcb14('0x15')](respondWithFilteredResult(_0x2edfa2,_0xdadcaf))[_0xcb14('0x1f')](handleError(_0x2edfa2,null));}; \ No newline at end of file +var _0xb640=['attributes','fields','order','sort','filters','pick','map','options','getTags','nolimit','setTags','ids','CmContactHasItem','OrderBy','items','item_types','description','ItemTypeId','PHONE','sequelize','`ItemType`.OrderBy','CmHopperId','ItemType.OrderBy','CmHopperAdditionalPhone','getAdditionalPhones','duplicateAdditionalPhones','CmContactId','toContactId','hopperId','getHoppers','ContactId','filter','includeAll','include','getHopperHistories','CmHopperHistory','rawAttributes','rows','getHopperFinals','getJscriptySessions','JscriptySessionReport','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','server/files/tmp','file','filename','chmodSync','0777','child_process','fork','../../components/import/cm/csv','CompanyId','File\x20uploaded\x20correctly!','send','path','parse','json','meta','import','agent','binding','../../components/import/cm/csv2','message','start\x20child\x20process\x20correctly!','pid','exit','error\x20child\x20process','importUpdates','User','No\x20firstName\x20column\x20specified','stringify','getJourney','mail','chat','openchannel','fax','whatsapp','voice','-createdAt','resolve','channel','toLowerCase','Invalid\x20channel','range','Invalid\x20date\x20for\x20range\x20from\x20filter','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','source','destination','callerid','starttime','endtime','duration','note','userSecondDisposition','userThirdDisposition','UserId','createdAt','DESC','findAndCountAll','fullname','Website','Account','closed','closedAt','key','Owner','browserName','customerIp','deviceModel','ratingMessage','ratingValue','referer','substatus','externalUrl','threadId','startCase','Interaction','flatten','sortBy','reverse','value','slice','moment','bluebird','util','squel','ioredis','../../components/contacts','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/environment/shared','redis','defaults','localhost','socket.io-emitter','./cmContact.socket','register','status','undefined','limit','offset','count','then','destroy','end','sendStatus','stack','name','index','describe','user','catch','CmContact','params','keys','length','startsWith','columnName','displayName','query','analytics','CmCustomField','findAll','cf_','alias','custom','type','values','info','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','forEach','hasOwnProperty','merge','body','from','get','mergeWith','isArray','tags','join','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','ChatInteraction','update','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmHopperFinal','ReportAgentPreview','VoiceCallReport','ChatQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','WhatsappInteraction','WhatsappQueueReport','create','isNil','dialTimezone','timezones','additionalPhones','bulkCreate','each','duplicates','where','$or','push','findOrCreate','spread','all','find','Tag','Tags','color','Phones','ContactItemType','ItemType','literal','Phones.OrderBy','ListId','$and','omit','format','cf_%d','utcOffset','pickBy','table','setFields','toParam','phone','findOne','intersection','model'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb640,0x184));var _0x0b64=function(_0x47fa8c,_0x214d2a){_0x47fa8c=_0x47fa8c-0x0;var _0x574620=_0xb640[_0x47fa8c];return _0x574620;};'use strict';var moment=require(_0x0b64('0x0'));var BPromise=require(_0x0b64('0x1'));var util=require(_0x0b64('0x2'));var path=require('path');var fs=require('fs');var _=require('lodash');var squel=require(_0x0b64('0x3'));var Papa=require('papaparse');var Redis=require(_0x0b64('0x4'));var contacts=require(_0x0b64('0x5'));var qs=require(_0x0b64('0x6'));var logger=require(_0x0b64('0x7'))(_0x0b64('0x8'));var config=require(_0x0b64('0x9'));var shared=require(_0x0b64('0xa'));var db=require('../../mysqldb')['db'];config[_0x0b64('0xb')]=_[_0x0b64('0xc')](config['redis'],{'host':_0x0b64('0xd'),'port':0x18eb});var socket=require(_0x0b64('0xe'))(new Redis(config[_0x0b64('0xb')]));require(_0x0b64('0xf'))[_0x0b64('0x10')](socket);function respondWithResult(_0x6f5afa,_0x273301){_0x273301=_0x273301||0xc8;return function(_0x29b79a){if(_0x29b79a){return _0x6f5afa[_0x0b64('0x11')](_0x273301)['json'](_0x29b79a);}};}function respondWithFilteredResult(_0x1302e6,_0x210ec7){return function(_0xfb3e7d){if(_0xfb3e7d){var _0x1ff1a6=typeof _0x210ec7['offset']===_0x0b64('0x12')&&typeof _0x210ec7[_0x0b64('0x13')]===_0x0b64('0x12');var _0x29e15f=_0xfb3e7d['count'];var _0x3baffc=_0x1ff1a6?0x0:_0x210ec7[_0x0b64('0x14')];var _0x2f41cd=_0x1ff1a6?_0xfb3e7d[_0x0b64('0x15')]:_0x210ec7[_0x0b64('0x14')]+_0x210ec7['limit'];var _0x695e7a;if(_0x2f41cd>=_0x29e15f){_0x2f41cd=_0x29e15f;_0x695e7a=0xc8;}else{_0x695e7a=0xce;}_0x1302e6[_0x0b64('0x11')](_0x695e7a);return _0x1302e6['set']('Content-Range',_0x3baffc+'-'+_0x2f41cd+'/'+_0x29e15f)['json'](_0xfb3e7d);}return null;};}function saveUpdates(_0x2dcc9f){return function(_0x43ad02){if(_0x43ad02){return _0x43ad02['update'](_0x2dcc9f)[_0x0b64('0x16')](function(_0x20cc17){return _0x20cc17;});}return null;};}function removeEntity(_0x125a0d){return function(_0x38067e){if(_0x38067e){return _0x38067e[_0x0b64('0x17')]()[_0x0b64('0x16')](function(){_0x125a0d[_0x0b64('0x11')](0xcc)[_0x0b64('0x18')]();});}};}function handleEntityNotFound(_0x585ea8){return function(_0x617d1e){if(!_0x617d1e){_0x585ea8[_0x0b64('0x19')](0x194);}return _0x617d1e;};}function handleError(_0x17d3f5,_0x374a99){_0x374a99=_0x374a99||0x1f4;return function(_0x20c448){logger['error'](_0x20c448[_0x0b64('0x1a')]);if(_0x20c448[_0x0b64('0x1b')]){delete _0x20c448[_0x0b64('0x1b')];}_0x17d3f5[_0x0b64('0x11')](_0x374a99)['send'](_0x20c448);};}exports[_0x0b64('0x1c')]=function(_0x802ffd,_0x375010){var _0x21fa71={};return contacts[_0x0b64('0x1d')]()[_0x0b64('0x16')](function(_0x1e8a3a){_0x21fa71=qs['getOptions'](_0x1e8a3a,_0x802ffd);return contacts['findAll'](_0x802ffd['query'],_0x802ffd[_0x0b64('0x1e')],_0x21fa71,_0x1e8a3a);})[_0x0b64('0x16')](respondWithFilteredResult(_0x375010,_0x21fa71))[_0x0b64('0x1f')](handleError(_0x375010,null));};exports['destroy']=function(_0x217cb7,_0x4b8f18){return db[_0x0b64('0x20')]['find']({'where':{'id':_0x217cb7[_0x0b64('0x21')]['id']}})['then'](handleEntityNotFound(_0x4b8f18,null))[_0x0b64('0x16')](removeEntity(_0x4b8f18,null))['catch'](handleError(_0x4b8f18,null));};exports[_0x0b64('0x1d')]=function(_0x5a3231,_0x4c7c11){return db[_0x0b64('0x20')][_0x0b64('0x1d')]()[_0x0b64('0x16')](function(_0x228d0d){delete _0x228d0d['tags'];for(var _0x54a8e7=0x0;_0x54a8e70x0){return new Promise(function(_0x11881e){var _0x43fc4b=[];for(var _0x363356=0x0;_0x363356<_0x3120f3[_0x0b64('0x23')];_0x363356++){_0x43fc4b['push'](insertAdditionalPhones(_0x3120f3[_0x363356]['contact'],_0x3120f3[_0x363356][_0x0b64('0x59')]));}Promise[_0x0b64('0x62')](_0x43fc4b)[_0x0b64('0x16')](function(){_0x11881e(0x1);});})[_0x0b64('0x16')](function(){return{'success':_0xcf4998,'failure':_0x24a995,'duplicates':_0x3f730a};});}else{return{'success':_0xcf4998,'failure':_0x24a995,'duplicates':_0x3f730a};}}})[_0x0b64('0x16')](respondWithResult(_0x3772a9,0xc9))[_0x0b64('0x1f')](handleError(_0x3772a9,null));};exports['show']=function(_0x12c4b5,_0x5167f8){var _0x3e7544;return db[_0x0b64('0x20')][_0x0b64('0x1d')]()[_0x0b64('0x16')](function(_0x367ea0){return db[_0x0b64('0x20')][_0x0b64('0x63')]({'where':{'id':_0x12c4b5[_0x0b64('0x21')]['id']},'include':[{'model':db[_0x0b64('0x64')],'as':_0x0b64('0x65'),'attributes':['id',_0x0b64('0x1b'),_0x0b64('0x66')],'required':_0x12c4b5[_0x0b64('0x27')]['tag']?!![]:![]},{'model':db['CmContactHasItem'],'as':_0x0b64('0x67'),'where':{'CmContactId':_0x12c4b5['params']['id']},'required':![],'include':[{'model':db[_0x0b64('0x68')],'as':_0x0b64('0x69')}]}],'order':[db['sequelize'][_0x0b64('0x6a')](_0x0b64('0x6b'))],'attributes':_[_0x0b64('0x22')](_0x367ea0)});})[_0x0b64('0x16')](function(_0x2ba52f){if(!_[_0x0b64('0x56')](_0x2ba52f)){_0x3e7544=_0x2ba52f['get']({'plain':!![]});var _0x7aa8f={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x2ba52f&&_0x2ba52f['ListId']){if(_0x2ba52f[_0x0b64('0x6c')]){_0x7aa8f['where'][_0x0b64('0x6d')][_0x0b64('0x5f')]({'ListId':{'$ne':_0x2ba52f[_0x0b64('0x6c')]}});}}return db[_0x0b64('0x29')][_0x0b64('0x2a')](_0x7aa8f);}})[_0x0b64('0x16')](function(_0x489eb5){if(!_['isNil'](_0x489eb5)){return _[_0x0b64('0x6e')](_0x3e7544,_['map'](_0x489eb5,function(_0x5043b5){return util[_0x0b64('0x6f')](_0x0b64('0x70'),_0x5043b5['id']);}));}})['then'](handleEntityNotFound(_0x5167f8,null))['then'](respondWithResult(_0x5167f8,null))[_0x0b64('0x1f')](handleError(_0x5167f8,null));};exports[_0x0b64('0x42')]=function(_0x46e2f6,_0x4583e5){var _0x13b789;if(_0x46e2f6[_0x0b64('0x35')]['id']){delete _0x46e2f6[_0x0b64('0x35')]['id'];}if(!_['isNil'](_0x46e2f6['body'][_0x0b64('0x57')])){var _0x38f3ca=_0x46e2f6[_0x0b64('0x35')][_0x0b64('0x57')];if(!_[_0x0b64('0x56')](shared['timezones'][_0x38f3ca]))_0x46e2f6[_0x0b64('0x35')][_0x0b64('0x71')]=shared[_0x0b64('0x58')][_0x38f3ca][_0x0b64('0x71')];}return db[_0x0b64('0x20')][_0x0b64('0x63')]({'where':{'id':_0x46e2f6[_0x0b64('0x21')]['id']}})[_0x0b64('0x16')](handleEntityNotFound(_0x4583e5,null))[_0x0b64('0x16')](saveUpdates(_0x46e2f6[_0x0b64('0x35')],null))['then'](function(_0x3eb2bf){_0x13b789=_0x3eb2bf;var _0x5add41={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x3eb2bf&&_0x3eb2bf[_0x0b64('0x6c')]){if(_0x3eb2bf[_0x0b64('0x6c')]){_0x5add41[_0x0b64('0x5d')]['$and'][_0x0b64('0x5f')]({'ListId':{'$ne':_0x3eb2bf[_0x0b64('0x6c')]}});}}return db[_0x0b64('0x29')][_0x0b64('0x2a')](_0x5add41);})[_0x0b64('0x16')](function(_0x1a97c1){if(_0x1a97c1){return _[_0x0b64('0x6e')](_[_0x0b64('0x72')](_0x46e2f6[_0x0b64('0x35')],function(_0x5531ba,_0x48127a){return _[_0x0b64('0x24')](_0x48127a,_0x0b64('0x2b'));}),_['map'](_0x1a97c1,function(_0x2e8255){return util[_0x0b64('0x6f')](_0x0b64('0x70'),_0x2e8255['id']);}));}})[_0x0b64('0x16')](function(_0x9c2d46){if(_0x9c2d46&&!_['isEmpty'](_0x9c2d46)){var _0x104773=squel[_0x0b64('0x42')]()[_0x0b64('0x73')]('cm_contacts')[_0x0b64('0x74')](_0x9c2d46)['where']('id\x20=\x20?',_0x46e2f6[_0x0b64('0x21')]['id'])[_0x0b64('0x75')]();return db['sequelize'][_0x0b64('0x27')](_0x104773['text'],{'replacements':_0x104773[_0x0b64('0x2f')]});}})[_0x0b64('0x16')](function(){if(_0x46e2f6[_0x0b64('0x35')][_0x0b64('0x76')]&&_0x13b789){return db[_0x0b64('0x3d')][_0x0b64('0x42')]({'phone':_0x46e2f6[_0x0b64('0x35')][_0x0b64('0x76')],'OrderBy':0x0},{'where':{'ContactId':_0x13b789['id']}});}})[_0x0b64('0x16')](function(){return _0x13b789;})[_0x0b64('0x16')](respondWithResult(_0x4583e5,null))[_0x0b64('0x1f')](handleError(_0x4583e5,null));};exports['getTags']=function(_0x129474,_0x14a65b){var _0x169697={};var _0x1124d3={};var _0x5d421a;var _0x5dcce1;return db[_0x0b64('0x20')][_0x0b64('0x77')]({'where':{'id':_0x129474[_0x0b64('0x21')]['id']}})['then'](handleEntityNotFound(_0x14a65b,null))[_0x0b64('0x16')](function(_0x4635a1){if(_0x4635a1){_0x5d421a=_0x4635a1;_0x1124d3['model']=_[_0x0b64('0x22')](db[_0x0b64('0x64')]['rawAttributes']);_0x1124d3[_0x0b64('0x27')]=_[_0x0b64('0x22')](_0x129474[_0x0b64('0x27')]);_0x1124d3['filters']=_[_0x0b64('0x78')](_0x1124d3[_0x0b64('0x79')],_0x1124d3['query']);_0x169697[_0x0b64('0x7a')]=_[_0x0b64('0x78')](_0x1124d3[_0x0b64('0x79')],qs[_0x0b64('0x7b')](_0x129474['query']['fields']));_0x169697[_0x0b64('0x7a')]=_0x169697['attributes'][_0x0b64('0x23')]?_0x169697[_0x0b64('0x7a')]:_0x1124d3[_0x0b64('0x79')];_0x169697[_0x0b64('0x7c')]=qs[_0x0b64('0x7d')](_0x129474['query'][_0x0b64('0x7d')]);_0x169697['where']=qs[_0x0b64('0x7e')](_[_0x0b64('0x7f')](_0x129474[_0x0b64('0x27')],_0x1124d3[_0x0b64('0x7e')]));if(_0x129474[_0x0b64('0x27')]['filter']){_0x169697[_0x0b64('0x5d')]=_['merge'](_0x169697['where'],{'$or':_[_0x0b64('0x80')](_0x169697[_0x0b64('0x7a')],function(_0x31f143){var _0x27108a={};_0x27108a[_0x31f143]={'$like':'%'+_0x129474[_0x0b64('0x27')]['filter']+'%'};return _0x27108a;})});}_0x169697=_[_0x0b64('0x34')]({},_0x169697,_0x129474[_0x0b64('0x81')]);return _0x5d421a[_0x0b64('0x82')](_0x169697);}})[_0x0b64('0x16')](function(_0x2cdcd1){if(_0x2cdcd1){_0x5dcce1=_0x2cdcd1[_0x0b64('0x23')];if(!_0x129474['query'][_0x0b64('0x33')](_0x0b64('0x83'))){_0x169697[_0x0b64('0x13')]=qs[_0x0b64('0x13')](_0x129474[_0x0b64('0x27')][_0x0b64('0x13')]);_0x169697['offset']=qs[_0x0b64('0x14')](_0x129474['query'][_0x0b64('0x14')]);}return _0x5d421a[_0x0b64('0x82')](_0x169697);}})[_0x0b64('0x16')](function(_0x32669e){if(_0x32669e){return _0x32669e?{'count':_0x5dcce1,'rows':_0x32669e}:null;}})[_0x0b64('0x16')](respondWithResult(_0x14a65b,null))[_0x0b64('0x1f')](handleError(_0x14a65b,null));};exports[_0x0b64('0x84')]=function(_0x429c18,_0x452719){if(_0x429c18[_0x0b64('0x35')]['id']){delete _0x429c18[_0x0b64('0x35')]['id'];}return db['CmContact'][_0x0b64('0x77')]({'where':{'id':_0x429c18[_0x0b64('0x21')]['id']}})['then'](handleEntityNotFound(_0x452719,null))[_0x0b64('0x16')](function(_0x329c89){if(_0x329c89){return _0x329c89[_0x0b64('0x84')](_0x429c18[_0x0b64('0x35')][_0x0b64('0x85')]||[]);}return null;})[_0x0b64('0x16')](respondWithResult(_0x452719,null))['catch'](handleError(_0x452719,null));};exports['setAdditionalPhones']=function(_0xb5a774,_0x3277f0){var _0x4ce86b=[];_0x4ce86b[_0x0b64('0x5f')](addAdditionalPhones(_0xb5a774[_0x0b64('0x35')]));Promise[_0x0b64('0x62')](_0x4ce86b)[_0x0b64('0x16')](function(){_0x4ce86b=[];_0x4ce86b[_0x0b64('0x5f')](deleteCmHopperPhones(_0xb5a774[_0x0b64('0x35')]['id']));_0x4ce86b[_0x0b64('0x5f')](addCmHopperPhones(_0xb5a774[_0x0b64('0x35')]['id']));Promise['all'](_0x4ce86b)[_0x0b64('0x16')](function(){return[0x1];})['then'](respondWithResult(_0x3277f0,null));});};function addAdditionalPhones(_0x198840){var _0x75ac0;return new Promise(function(_0x5ef8b8){return db[_0x0b64('0x86')][_0x0b64('0x17')]({'where':{'CmContactId':_0x198840['id']}})[_0x0b64('0x16')](function(){db[_0x0b64('0x68')][_0x0b64('0x2a')]({'raw':!![],'attributes':['id',_0x0b64('0x87')]})['then'](function(_0x178082){var _0x297a2d=[];for(var _0x1fcb88=0x0;_0x1fcb88<_0x198840[_0x0b64('0x88')]['length'];_0x1fcb88++){var _0x4f94bc=_0x198840[_0x0b64('0x89')]?_['isNil'](_0x198840[_0x0b64('0x89')][_0x1fcb88])?'':_0x198840['item_types'][_0x1fcb88]:_0x198840[_0x0b64('0x88')][_0x1fcb88]['ItemTypeId']?_0x198840[_0x0b64('0x88')][_0x1fcb88]['ItemTypeId']:'';var _0x43f160=_[_0x0b64('0x56')](_0x198840['items'][_0x1fcb88]['description'])?'':_0x198840[_0x0b64('0x88')][_0x1fcb88][_0x0b64('0x8a')];var _0x5e7c55=_0x4f94bc+':'+_0x198840['items'][_0x1fcb88]['phone']+'§'+_0x43f160;if(_[_0x0b64('0x56')](_0x75ac0))_0x75ac0=_0x5e7c55;else _0x75ac0+=';'+_0x5e7c55;var _0x4ba5da=null;var _0x12bef6=null;if(_0x198840[_0x0b64('0x89')]){if(!_[_0x0b64('0x56')](_0x198840['item_types'][_0x1fcb88])){_0x12bef6=_[_0x0b64('0x63')](_0x178082,function(_0x504d4b){return _0x504d4b['id']===_0x198840[_0x0b64('0x89')][_0x1fcb88];});if(!_['isNil'](_0x12bef6)){_0x4ba5da=_0x12bef6[_0x0b64('0x87')];}}}else{if(!_[_0x0b64('0x56')](_0x198840[_0x0b64('0x88')][_0x1fcb88])){_0x12bef6=_[_0x0b64('0x63')](_0x178082,function(_0x34dc53){return _0x34dc53['id']===_0x198840[_0x0b64('0x88')][_0x1fcb88][_0x0b64('0x8b')];});if(!_[_0x0b64('0x56')](_0x12bef6)){_0x4ba5da=_0x1fcb88;}}}if(_[_0x0b64('0x56')](_0x4ba5da)){_0x4ba5da=0x64;}_0x297a2d[_0x0b64('0x5f')](addAdditionalPhone(_0x198840['id'],_0x198840[_0x0b64('0x88')][_0x1fcb88]['phone'],_0x198840[_0x0b64('0x89')]?_[_0x0b64('0x56')](_0x198840[_0x0b64('0x89')][_0x1fcb88])?null:_0x198840[_0x0b64('0x89')][_0x1fcb88]:_0x198840[_0x0b64('0x88')][_0x1fcb88][_0x0b64('0x8b')]?_0x198840[_0x0b64('0x88')][_0x1fcb88][_0x0b64('0x8b')]:null,_0x4ba5da,_0x43f160));}Promise['all'](_0x297a2d)['then'](function(){db[_0x0b64('0x20')][_0x0b64('0x42')]({'AdditionalPhones':_0x75ac0},{'where':{'id':_0x198840['id']}})[_0x0b64('0x16')](function(){_0x5ef8b8(0x1);});});});});});}function addAdditionalPhone(_0x4216fe,_0x285512,_0x31d6a6,_0x530124,_0x204fc2){return db[_0x0b64('0x86')][_0x0b64('0x63')]({'where':{'CmContactId':_0x4216fe,'item':_0x285512}})[_0x0b64('0x16')](function(_0x127852){if(_0x127852)logger[_0x0b64('0x30')]('contact\x20phone\x20exists',_0x127852);else{db[_0x0b64('0x86')][_0x0b64('0x55')]({'CmContactId':_0x4216fe,'item':_0x285512,'ItemTypeId':_0x31d6a6,'OrderBy':_0x530124,'ItemClass':_0x0b64('0x8c'),'description':_0x204fc2});}});}function deleteCmHopperPhones(_0x3c015a){return new Promise(function(_0x1c6f8a){return db[_0x0b64('0x3d')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x3c015a}})[_0x0b64('0x16')](function(_0x336998){db['CmHopperAdditionalPhone'][_0x0b64('0x17')]({'where':{'CmHopperId':{'$in':_[_0x0b64('0x80')](_0x336998,'id')}}});})['then'](function(){_0x1c6f8a(0x1);});});}function addCmHopperPhones(_0x3099bf){return new Promise(function(_0x4f10be){return db[_0x0b64('0x3d')][_0x0b64('0x2a')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x3099bf}})[_0x0b64('0x16')](function(_0x2c35a1){var _0xf5d093=[];_[_0x0b64('0x80')](_0x2c35a1,function(_0x1b39ff){_0xf5d093[_0x0b64('0x5f')](createCmHopperPhone(_0x3099bf,_0x1b39ff['id']));});Promise[_0x0b64('0x62')](_0xf5d093)['then'](function(){_0x4f10be(0x1);});});});}function createCmHopperPhone(_0x37c3b8,_0xf019de){return new Promise(function(_0x5a458e){db[_0x0b64('0x86')][_0x0b64('0x2a')]({'raw':!![],'attributes':['item',_0x0b64('0x87')],'where':{'CmContactId':_0x37c3b8,'ItemClass':_0x0b64('0x8c')},'include':[{'model':db[_0x0b64('0x68')],'attributes':[_0x0b64('0x87')],'as':_0x0b64('0x69')}],'order':[_0x0b64('0x87'),db[_0x0b64('0x8d')]['literal'](_0x0b64('0x8e'))]})[_0x0b64('0x16')](function(_0xcfc7d){var _0x403fba=0x1;var _0x290114=_[_0x0b64('0x80')](_0xcfc7d,function(_0x2d945c){_0x2d945c[_0x0b64('0x8f')]=_0xf019de;_0x2d945c[_0x0b64('0x76')]=_0x2d945c['item'];_0x2d945c[_0x0b64('0x87')]=_0x403fba;delete _0x2d945c[_0x0b64('0x90')];_0x403fba=_0x403fba+0x1;return _0x2d945c;});return db[_0x0b64('0x91')][_0x0b64('0x5a')](_0x290114,{});})['then'](function(){_0x5a458e(0x1);});});}function insertAdditionalPhones(_0x5d1036,_0x251bb3){return new Promise(function(_0x341d37){var _0x510d6c=[];for(var _0x2f8f0d=0x0;_0x2f8f0d<_0x251bb3[_0x0b64('0x23')];_0x2f8f0d++){var _0x1f63da=_0x251bb3[_0x2f8f0d];_0x510d6c[_0x0b64('0x5f')](parseContactItemType(_0x1f63da));}Promise['all'](_0x510d6c)[_0x0b64('0x16')](function(){var _0xa9b737={'id':_0x5d1036['id'],'items':_0x251bb3};return addAdditionalPhones(_0xa9b737)[_0x0b64('0x16')](function(){return addCmHopperPhones(_0x5d1036['id']);});})[_0x0b64('0x16')](function(){_0x341d37(_0x5d1036);});});}function parseContactItemType(_0x2722fd){return new Promise(function(_0x435edb){if(_0x2722fd['hasOwnProperty'](_0x0b64('0x8b'))){_0x435edb(_0x2722fd);}else{return db[_0x0b64('0x68')][_0x0b64('0x63')]({'where':{'name':_0x2722fd[_0x0b64('0x69')]}})[_0x0b64('0x16')](function(_0x533aa0){if(_[_0x0b64('0x56')](_0x533aa0))_0x2722fd[_0x0b64('0x8b')]=null;else _0x2722fd[_0x0b64('0x8b')]=_0x533aa0['id'];_0x435edb(_0x2722fd);});}});}exports[_0x0b64('0x92')]=function(_0x185059,_0x2b95e0){return db[_0x0b64('0x86')][_0x0b64('0x2a')]({'raw':!![],'where':{'CmContactId':_0x185059[_0x0b64('0x21')]['id'],'ItemClass':_0x0b64('0x8c')},'include':[{'model':db['ContactItemType'],'as':'ItemType'}],'order':[[_0x0b64('0x87')],[db[_0x0b64('0x8d')][_0x0b64('0x6a')](_0x0b64('0x8e'))]]})[_0x0b64('0x16')](function(_0x1910ba){return _0x1910ba;})['then'](respondWithResult(_0x2b95e0,null))['catch'](handleError(_0x2b95e0,null));};exports[_0x0b64('0x93')]=function(_0x1f9d43,_0x3412c1){return db['CmContactHasItem']['findAll']({'raw':!![],'where':{'CmContactId':_0x1f9d43[_0x0b64('0x35')]['fromContactId']}})[_0x0b64('0x16')](function(_0x3654c1){var _0x14756f=_['map'](_0x3654c1,function(_0x587050){_0x587050[_0x0b64('0x94')]=_0x1f9d43[_0x0b64('0x35')][_0x0b64('0x95')];return _0x587050;});return db['CmContactHasItem'][_0x0b64('0x5a')](_0x14756f,{});})[_0x0b64('0x16')](function(){return addCmHopperPhones(_0x1f9d43[_0x0b64('0x35')][_0x0b64('0x95')]);})[_0x0b64('0x16')](function(){return['ok'];})[_0x0b64('0x16')](respondWithResult(_0x3412c1,null))['catch'](handleError(_0x3412c1,null));};exports['rescheduleAdditionalPhones']=function(_0x43d4aa,_0x17b9e5){var _0x4390d2=[];_0x4390d2[_0x0b64('0x5f')](createCmHopperPhone(_0x43d4aa[_0x0b64('0x35')]['id'],_0x43d4aa['body'][_0x0b64('0x96')]));Promise[_0x0b64('0x62')](_0x4390d2)[_0x0b64('0x16')](function(){return[0x1];})['then'](respondWithResult(_0x17b9e5,null));};exports[_0x0b64('0x97')]=function(_0x29a820,_0x2736bf){var _0x283971={'raw':![],'where':{}};var _0x57cf1f={};var _0x545d13={'count':0x0,'rows':[]};return db[_0x0b64('0x20')][_0x0b64('0x77')]({'where':{'id':_0x29a820['params']['id']}})[_0x0b64('0x16')](handleEntityNotFound(_0x2736bf,null))[_0x0b64('0x16')](function(_0x57500c){if(_0x57500c){_0x57cf1f[_0x0b64('0x79')]=_[_0x0b64('0x22')](db[_0x0b64('0x3d')]['rawAttributes']);_0x57cf1f[_0x0b64('0x27')]=_['keys'](_0x29a820[_0x0b64('0x27')]);_0x57cf1f['filters']=_[_0x0b64('0x78')](_0x57cf1f[_0x0b64('0x79')],_0x57cf1f[_0x0b64('0x27')]);_0x283971[_0x0b64('0x7a')]=_[_0x0b64('0x78')](_0x57cf1f[_0x0b64('0x79')],qs[_0x0b64('0x7b')](_0x29a820[_0x0b64('0x27')][_0x0b64('0x7b')]));_0x283971[_0x0b64('0x7a')]=_0x283971[_0x0b64('0x7a')][_0x0b64('0x23')]?_0x283971['attributes']:_0x57cf1f[_0x0b64('0x79')];if(!_0x29a820[_0x0b64('0x27')][_0x0b64('0x33')](_0x0b64('0x83'))){_0x283971['limit']=qs['limit'](_0x29a820[_0x0b64('0x27')][_0x0b64('0x13')]);_0x283971[_0x0b64('0x14')]=qs[_0x0b64('0x14')](_0x29a820[_0x0b64('0x27')][_0x0b64('0x14')]);}_0x283971[_0x0b64('0x7c')]=qs[_0x0b64('0x7d')](_0x29a820[_0x0b64('0x27')]['sort']);_0x283971['where']=qs[_0x0b64('0x7e')](_['pick'](_0x29a820[_0x0b64('0x27')],_0x57cf1f[_0x0b64('0x7e')]));_0x283971[_0x0b64('0x5d')][_0x0b64('0x98')]=_0x57500c['id'];if(_0x29a820[_0x0b64('0x27')][_0x0b64('0x99')]){_0x283971[_0x0b64('0x5d')]=_[_0x0b64('0x34')](_0x283971[_0x0b64('0x5d')],{'$or':_[_0x0b64('0x80')](_0x283971[_0x0b64('0x7a')],function(_0xe79fd6){var _0x1efcc9={};_0x1efcc9[_0xe79fd6]={'$like':'%'+_0x29a820[_0x0b64('0x27')][_0x0b64('0x99')]+'%'};return _0x1efcc9;})});}_0x283971=_[_0x0b64('0x34')]({},_0x283971,_0x29a820[_0x0b64('0x81')]);return db[_0x0b64('0x3d')]['count']({'where':_0x283971[_0x0b64('0x5d')]})['then'](function(_0x1f7014){_0x545d13[_0x0b64('0x15')]=_0x1f7014;if(_0x29a820[_0x0b64('0x27')][_0x0b64('0x9a')]){_0x283971[_0x0b64('0x9b')]=[{'all':!![]}];}return db[_0x0b64('0x3d')]['findAll'](_0x283971);})[_0x0b64('0x16')](function(_0x29280a){_0x545d13['rows']=_0x29280a;return _0x545d13;});}})[_0x0b64('0x16')](respondWithFilteredResult(_0x2736bf,_0x283971))[_0x0b64('0x1f')](handleError(_0x2736bf,null));};exports[_0x0b64('0x9c')]=function(_0x19bba5,_0x5f2005){var _0x32afe3={'raw':!![],'where':{}};var _0x44fced={};var _0x368f1d={'count':0x0,'rows':[]};return db['CmContact'][_0x0b64('0x77')]({'where':{'id':_0x19bba5[_0x0b64('0x21')]['id']}})['then'](handleEntityNotFound(_0x5f2005,null))[_0x0b64('0x16')](function(_0x16abfe){if(_0x16abfe){_0x44fced[_0x0b64('0x79')]=_[_0x0b64('0x22')](db[_0x0b64('0x9d')][_0x0b64('0x9e')]);_0x44fced[_0x0b64('0x27')]=_[_0x0b64('0x22')](_0x19bba5[_0x0b64('0x27')]);_0x44fced[_0x0b64('0x7e')]=_[_0x0b64('0x78')](_0x44fced[_0x0b64('0x79')],_0x44fced[_0x0b64('0x27')]);_0x32afe3[_0x0b64('0x7a')]=_[_0x0b64('0x78')](_0x44fced[_0x0b64('0x79')],qs[_0x0b64('0x7b')](_0x19bba5[_0x0b64('0x27')][_0x0b64('0x7b')]));_0x32afe3[_0x0b64('0x7a')]=_0x32afe3['attributes']['length']?_0x32afe3['attributes']:_0x44fced['model'];if(!_0x19bba5[_0x0b64('0x27')][_0x0b64('0x33')]('nolimit')){_0x32afe3['limit']=qs['limit'](_0x19bba5[_0x0b64('0x27')][_0x0b64('0x13')]);_0x32afe3[_0x0b64('0x14')]=qs[_0x0b64('0x14')](_0x19bba5[_0x0b64('0x27')][_0x0b64('0x14')]);}_0x32afe3[_0x0b64('0x7c')]=qs[_0x0b64('0x7d')](_0x19bba5[_0x0b64('0x27')][_0x0b64('0x7d')]);_0x32afe3[_0x0b64('0x5d')]=qs[_0x0b64('0x7e')](_[_0x0b64('0x7f')](_0x19bba5[_0x0b64('0x27')],_0x44fced[_0x0b64('0x7e')]));_0x32afe3[_0x0b64('0x5d')]['ContactId']=_0x16abfe['id'];if(_0x19bba5[_0x0b64('0x27')][_0x0b64('0x99')]){_0x32afe3[_0x0b64('0x5d')]=_[_0x0b64('0x34')](_0x32afe3[_0x0b64('0x5d')],{'$or':_[_0x0b64('0x80')](_0x32afe3[_0x0b64('0x7a')],function(_0x3e0b7f){var _0x4235a0={};_0x4235a0[_0x3e0b7f]={'$like':'%'+_0x19bba5[_0x0b64('0x27')][_0x0b64('0x99')]+'%'};return _0x4235a0;})});}_0x32afe3=_['merge']({},_0x32afe3,_0x19bba5[_0x0b64('0x81')]);return db[_0x0b64('0x9d')][_0x0b64('0x15')]({'where':_0x32afe3[_0x0b64('0x5d')]})[_0x0b64('0x16')](function(_0x48d0f9){_0x368f1d[_0x0b64('0x15')]=_0x48d0f9;if(_0x19bba5[_0x0b64('0x27')]['includeAll']){_0x32afe3[_0x0b64('0x9b')]=[{'all':!![]}];}return db['CmHopperHistory']['findAll'](_0x32afe3);})[_0x0b64('0x16')](function(_0x36f8a4){_0x368f1d[_0x0b64('0x9f')]=_0x36f8a4;return _0x368f1d;});}})[_0x0b64('0x16')](respondWithFilteredResult(_0x5f2005,_0x32afe3))[_0x0b64('0x1f')](handleError(_0x5f2005,null));};exports[_0x0b64('0xa0')]=function(_0x273510,_0x2e72b4){var _0x40487d={'raw':!![],'where':{}};var _0x26c325={};var _0x57918d={'count':0x0,'rows':[]};return db['CmContact']['findOne']({'where':{'id':_0x273510[_0x0b64('0x21')]['id']}})[_0x0b64('0x16')](handleEntityNotFound(_0x2e72b4,null))[_0x0b64('0x16')](function(_0xf07438){if(_0xf07438){_0x26c325[_0x0b64('0x79')]=_[_0x0b64('0x22')](db[_0x0b64('0x4c')]['rawAttributes']);_0x26c325['query']=_[_0x0b64('0x22')](_0x273510[_0x0b64('0x27')]);_0x26c325[_0x0b64('0x7e')]=_['intersection'](_0x26c325[_0x0b64('0x79')],_0x26c325[_0x0b64('0x27')]);_0x40487d[_0x0b64('0x7a')]=_[_0x0b64('0x78')](_0x26c325['model'],qs['fields'](_0x273510['query'][_0x0b64('0x7b')]));_0x40487d[_0x0b64('0x7a')]=_0x40487d[_0x0b64('0x7a')][_0x0b64('0x23')]?_0x40487d[_0x0b64('0x7a')]:_0x26c325[_0x0b64('0x79')];if(!_0x273510['query'][_0x0b64('0x33')]('nolimit')){_0x40487d[_0x0b64('0x13')]=qs[_0x0b64('0x13')](_0x273510[_0x0b64('0x27')][_0x0b64('0x13')]);_0x40487d[_0x0b64('0x14')]=qs[_0x0b64('0x14')](_0x273510[_0x0b64('0x27')][_0x0b64('0x14')]);}_0x40487d[_0x0b64('0x7c')]=qs[_0x0b64('0x7d')](_0x273510[_0x0b64('0x27')][_0x0b64('0x7d')]);_0x40487d[_0x0b64('0x5d')]=qs[_0x0b64('0x7e')](_[_0x0b64('0x7f')](_0x273510[_0x0b64('0x27')],_0x26c325[_0x0b64('0x7e')]));_0x40487d[_0x0b64('0x5d')][_0x0b64('0x98')]=_0xf07438['id'];if(_0x273510[_0x0b64('0x27')]['filter']){_0x40487d[_0x0b64('0x5d')]=_[_0x0b64('0x34')](_0x40487d['where'],{'$or':_[_0x0b64('0x80')](_0x40487d[_0x0b64('0x7a')],function(_0x534330){var _0xe9ea71={};_0xe9ea71[_0x534330]={'$like':'%'+_0x273510[_0x0b64('0x27')][_0x0b64('0x99')]+'%'};return _0xe9ea71;})});}_0x40487d=_[_0x0b64('0x34')]({},_0x40487d,_0x273510[_0x0b64('0x81')]);return db[_0x0b64('0x4c')][_0x0b64('0x15')]({'where':_0x40487d[_0x0b64('0x5d')]})[_0x0b64('0x16')](function(_0x2db24a){_0x57918d['count']=_0x2db24a;if(_0x273510['query']['includeAll']){_0x40487d[_0x0b64('0x9b')]=[{'all':!![]}];}return db[_0x0b64('0x4c')][_0x0b64('0x2a')](_0x40487d);})[_0x0b64('0x16')](function(_0x478736){_0x57918d[_0x0b64('0x9f')]=_0x478736;return _0x57918d;});}})[_0x0b64('0x16')](respondWithFilteredResult(_0x2e72b4,_0x40487d))[_0x0b64('0x1f')](handleError(_0x2e72b4,null));};exports[_0x0b64('0xa1')]=function(_0x1d8f40,_0x33cdbf){var _0x1c1735={'raw':!![],'where':{}};var _0x407d7e={};var _0x503a4b={'count':0x0,'rows':[]};return db[_0x0b64('0x20')]['findOne']({'where':{'id':_0x1d8f40[_0x0b64('0x21')]['id']}})[_0x0b64('0x16')](handleEntityNotFound(_0x33cdbf,null))[_0x0b64('0x16')](function(_0x2b5bd9){if(_0x2b5bd9){_0x407d7e[_0x0b64('0x79')]=_[_0x0b64('0x22')](db[_0x0b64('0xa2')]['rawAttributes']);_0x407d7e[_0x0b64('0x27')]=_['keys'](_0x1d8f40['query']);_0x407d7e['filters']=_[_0x0b64('0x78')](_0x407d7e[_0x0b64('0x79')],_0x407d7e['query']);_0x1c1735[_0x0b64('0x7a')]=_[_0x0b64('0x78')](_0x407d7e[_0x0b64('0x79')],qs[_0x0b64('0x7b')](_0x1d8f40[_0x0b64('0x27')][_0x0b64('0x7b')]));_0x1c1735['attributes']=_0x1c1735['attributes'][_0x0b64('0x23')]?_0x1c1735[_0x0b64('0x7a')]:_0x407d7e[_0x0b64('0x79')];if(!_0x1d8f40[_0x0b64('0x27')][_0x0b64('0x33')]('nolimit')){_0x1c1735[_0x0b64('0x13')]=qs[_0x0b64('0x13')](_0x1d8f40[_0x0b64('0x27')][_0x0b64('0x13')]);_0x1c1735[_0x0b64('0x14')]=qs[_0x0b64('0x14')](_0x1d8f40[_0x0b64('0x27')][_0x0b64('0x14')]);}_0x1c1735['order']=qs[_0x0b64('0x7d')](_0x1d8f40[_0x0b64('0x27')][_0x0b64('0x7d')]);_0x1c1735['where']=qs['filters'](_[_0x0b64('0x7f')](_0x1d8f40[_0x0b64('0x27')],_0x407d7e['filters']));_0x1c1735[_0x0b64('0x5d')][_0x0b64('0x98')]=_0x2b5bd9['id'];if(_0x1d8f40[_0x0b64('0x27')]['filter']){_0x1c1735['where']=_[_0x0b64('0x34')](_0x1c1735[_0x0b64('0x5d')],{'$or':_[_0x0b64('0x80')](_0x1c1735[_0x0b64('0x7a')],function(_0xde043b){var _0x345bc3={};_0x345bc3[_0xde043b]={'$like':'%'+_0x1d8f40[_0x0b64('0x27')][_0x0b64('0x99')]+'%'};return _0x345bc3;})});}_0x1c1735=_['merge']({},_0x1c1735,_0x1d8f40[_0x0b64('0x81')]);return db[_0x0b64('0xa2')][_0x0b64('0x15')]({'where':_0x1c1735[_0x0b64('0x5d')]})[_0x0b64('0x16')](function(_0x302671){_0x503a4b['count']=_0x302671;if(_0x1d8f40[_0x0b64('0x27')][_0x0b64('0x9a')]){_0x1c1735[_0x0b64('0x9b')]=[{'all':!![]}];}return db['JscriptySessionReport']['findAll'](_0x1c1735);})[_0x0b64('0x16')](function(_0x42fc5a){_0x503a4b[_0x0b64('0x9f')]=_0x42fc5a;return _0x503a4b;});}})[_0x0b64('0x16')](respondWithFilteredResult(_0x33cdbf,_0x1c1735))[_0x0b64('0x1f')](handleError(_0x33cdbf,null));};exports['uploadCsv']=function(_0x4e5c8a,_0x233736){try{if(!_0x4e5c8a[_0x0b64('0x35')][_0x0b64('0x6c')]){throw new Error(_0x0b64('0xa3'));}if(!_0x4e5c8a['body'][_0x0b64('0xa4')]){throw new Error(_0x0b64('0xa5'));}if(!_0x4e5c8a[_0x0b64('0x35')][_0x0b64('0xa6')]){throw new Error('No\x20association\x20values\x20specified!');}if(!_0x4e5c8a['body'][_0x0b64('0xa7')]){throw new Error(_0x0b64('0xa8'));}var _0x6162eb=_0x4e5c8a[_0x0b64('0x35')]['binding_keys'][_0x0b64('0xa9')](',');var _0x35e278=_0x4e5c8a[_0x0b64('0x35')]['binding_values']['split'](',');if(!_0x6162eb[_0x0b64('0x23')]||!_0x35e278[_0x0b64('0x23')]||_0x6162eb['length']!==_0x35e278[_0x0b64('0x23')]){throw new Error(_0x0b64('0xaa'));}_0x4e5c8a[_0x0b64('0x35')][_0x0b64('0x7b')]=_[_0x0b64('0xab')](_0x6162eb,_0x35e278);if(!_0x4e5c8a['body'][_0x0b64('0x7b')][_0x0b64('0x76')]){throw new Error(_0x0b64('0xac'));}if(!_0x4e5c8a[_0x0b64('0x35')][_0x0b64('0x7b')][_0x0b64('0xad')]){throw new Error('No\x20firstName\x20column\x20specified');}var _0x586557=path[_0x0b64('0x3b')](config['root'],_0x0b64('0xae'),_0x4e5c8a[_0x0b64('0xaf')][_0x0b64('0xb0')]);fs[_0x0b64('0xb1')](_0x586557,parseInt(_0x0b64('0xb2'),0x8));var _0x4dc69d=require(_0x0b64('0xb3'))[_0x0b64('0xb4')](path[_0x0b64('0x3b')](__dirname,_0x0b64('0xb5')),[_0x586557,_0x4e5c8a['body'][_0x0b64('0xa4')],_0x4e5c8a['body']['binding_values'],_0x4e5c8a[_0x0b64('0x35')][_0x0b64('0x6c')],_0x4e5c8a[_0x0b64('0x35')][_0x0b64('0xb6')],_0x4e5c8a[_0x0b64('0x35')][_0x0b64('0x5c')],_0x4e5c8a['body'][_0x0b64('0xa7')]]);return _0x233736[_0x0b64('0x11')](0xc8)['json']({'message':_0x0b64('0xb7'),'pid':_0x4dc69d['pid']});}catch(_0x519819){return _0x233736[_0x0b64('0x11')](0x1f4)[_0x0b64('0xb8')](_0x519819);}};exports['upload']=function(_0x54af9f,_0x4f2ced){var _0x273e1f=fs['createReadStream'](_0x54af9f[_0x0b64('0xaf')][_0x0b64('0xb9')]);Papa[_0x0b64('0xba')](_0x273e1f,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x989962){return _0x4f2ced['status'](0xc8)[_0x0b64('0xbb')]({'file':_0x54af9f[_0x0b64('0xaf')],'fields':_0x989962[_0x0b64('0xbc')][_0x0b64('0x7b')]});}});};exports[_0x0b64('0xbd')]=function(_0x40bc19,_0x3dd0e7){return db['User'][_0x0b64('0x2a')]({'raw':!![],'attributes':['id'],'where':{'role':_0x0b64('0xbe')}})['then'](function(_0xd9ec95){var _0x22090f=![];if(!_0x40bc19[_0x0b64('0x35')][_0x0b64('0x6c')]){throw new Error(_0x0b64('0xa3'));}if(!_0x40bc19[_0x0b64('0x35')][_0x0b64('0xbf')][_0x0b64('0x76')]){throw new Error(_0x0b64('0xac'));}if(!_0x40bc19[_0x0b64('0x35')][_0x0b64('0xbf')]['firstName']){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x40bc19[_0x0b64('0x35')][_0x0b64('0xa7')]){throw new Error(_0x0b64('0xa8'));}var _0x2032ff=require('child_process')[_0x0b64('0xb4')](path[_0x0b64('0x3b')](__dirname,_0x0b64('0xc0')),[_0x40bc19[_0x0b64('0x21')]['id'],JSON['stringify'](_0x40bc19[_0x0b64('0x35')]),JSON['stringify'](_0xd9ec95)]);_0x2032ff['on'](_0x0b64('0xc1'),function(){_0x22090f=!![];return _0x3dd0e7[_0x0b64('0x11')](0xc8)[_0x0b64('0xbb')]({'message':_0x0b64('0xc2'),'pid':_0x2032ff[_0x0b64('0xc3')]});});_0x2032ff['on'](_0x0b64('0xc4'),function(_0x247c54){if(_0x247c54&&!_0x22090f){return _0x3dd0e7['status'](0x1f4)['json']({'message':_0x0b64('0xc5'),'pid':_0x2032ff[_0x0b64('0xc3')]});}});})['catch'](handleError(_0x3dd0e7,null));};exports[_0x0b64('0xc6')]=function(_0x5b3afd,_0x2e5ffe){return db[_0x0b64('0xc7')][_0x0b64('0x2a')]({'raw':!![],'attributes':['id'],'where':{'role':_0x0b64('0xbe')}})[_0x0b64('0x16')](function(_0x22ba42){var _0x44bbe4=![];if(!_0x5b3afd[_0x0b64('0x35')][_0x0b64('0x6c')]){throw new Error(_0x0b64('0xa3'));}if(!_0x5b3afd[_0x0b64('0x35')][_0x0b64('0xbf')][_0x0b64('0x76')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x5b3afd['body'][_0x0b64('0xbf')]['firstName']){throw new Error(_0x0b64('0xc8'));}if(!_0x5b3afd['body'][_0x0b64('0xa7')]){throw new Error(_0x0b64('0xa8'));}var _0x3570dd=require('child_process')[_0x0b64('0xb4')](path['join'](__dirname,'../../components/import/cm/csvUpdates'),[_0x5b3afd[_0x0b64('0x21')]['id'],JSON[_0x0b64('0xc9')](_0x5b3afd['body']),JSON[_0x0b64('0xc9')](_0x22ba42)]);_0x3570dd['on'](_0x0b64('0xc1'),function(){_0x44bbe4=!![];return _0x2e5ffe['status'](0xc8)['json']({'message':_0x0b64('0xc2'),'pid':_0x3570dd[_0x0b64('0xc3')]});});_0x3570dd['on'](_0x0b64('0xc4'),function(_0x5910a9){if(_0x5910a9&&!_0x44bbe4){return _0x2e5ffe[_0x0b64('0x11')](0x1f4)['json']({'message':_0x0b64('0xc5'),'pid':_0x3570dd[_0x0b64('0xc3')]});}});})[_0x0b64('0x1f')](handleError(_0x2e5ffe,null));};exports[_0x0b64('0xca')]=function(_0x231487,_0x2e1359){var _0x51a67c=[_0x0b64('0xcb'),_0x0b64('0xcc'),'sms',_0x0b64('0xcd'),_0x0b64('0xce'),_0x0b64('0xcf'),_0x0b64('0xd0')];var _0x521318={'offset':0x0,'order':qs[_0x0b64('0x7d')](_0x0b64('0xd1'))},_0x79c44f={'count':0x0,'rows':[]};Promise[_0x0b64('0xd2')]()[_0x0b64('0x16')](function(){if(_0x231487['query']['channel']){if(!_['includes'](_0x51a67c,_0x231487[_0x0b64('0x27')][_0x0b64('0xd3')][_0x0b64('0xd4')]())){throw new Error(_0x0b64('0xd5'));}_0x51a67c=[_0x231487[_0x0b64('0x27')][_0x0b64('0xd3')][_0x0b64('0xd4')]()];}if(_0x231487['query'][_0x0b64('0xd6')]){try{var _0x212cd5=JSON[_0x0b64('0xba')](_0x231487[_0x0b64('0x27')]['range']);if(!moment(_0x212cd5[_0x0b64('0x36')])['isValid']()){throw new Error(_0x0b64('0xd7'));}if(!moment(_0x212cd5['to'])[_0x0b64('0xd8')]()){throw new Error(_0x0b64('0xd9'));}}catch(_0xedbd6c){throw new Error(_0x0b64('0xda'));}}if(!_0x231487[_0x0b64('0x27')][_0x0b64('0x33')](_0x0b64('0x83'))){_0x521318[_0x0b64('0x13')]=qs[_0x0b64('0x13')](_0x231487[_0x0b64('0x27')]['limit']||0xa);_0x521318[_0x0b64('0x14')]=qs[_0x0b64('0x14')](_0x231487['query'][_0x0b64('0x14')]);}var _0x2c08fd=_0x51a67c[_0x0b64('0x80')](function(_0x39e664){if(_0x39e664===_0x0b64('0xd0')){var _0x571f5e={'attributes':['id','uniqueid',_0x0b64('0x2e'),_0x0b64('0xdb'),_0x0b64('0xdc'),_0x0b64('0xdd'),_0x0b64('0xde'),_0x0b64('0xdf'),_0x0b64('0xe0'),_0x0b64('0xe1'),'createdAt','userDisposition',_0x0b64('0xe2'),_0x0b64('0xe3'),_0x0b64('0xe4')],'where':{'ContactId':_0x231487[_0x0b64('0x21')]['id']},'include':[{'model':db[_0x0b64('0xc7')],'as':'User','attributes':['id',_0x0b64('0x1b'),'fullname',_0x0b64('0x2c')]}],'order':[[_0x0b64('0xe5'),_0x0b64('0xe6')]]};if(_0x231487[_0x0b64('0x27')][_0x0b64('0xd6')]){_0x571f5e[_0x0b64('0x5d')][_0x0b64('0xe5')]={'$gte':_0x212cd5[_0x0b64('0x36')],'$lte':_0x212cd5['to']};}return db[_0x0b64('0x4e')][_0x0b64('0xe7')](_0x571f5e)[_0x0b64('0x16')](function(_0x1479cb){_0x79c44f[_0x0b64('0x15')]+=_0x1479cb['count'];return _[_0x0b64('0x80')](_0x1479cb[_0x0b64('0x9f')],function(_0x1b0610){var _0x50a07f=_0x1b0610[_0x0b64('0x37')]({'plain':!![]});_0x50a07f[_0x0b64('0xd3')]=_0x39e664;if(_0x50a07f[_0x0b64('0xc7')]){_0x50a07f[_0x0b64('0xc7')]={'id':_0x50a07f['User']['id'],'name':_0x50a07f[_0x0b64('0xc7')][_0x0b64('0x1b')],'fullname':_0x50a07f[_0x0b64('0xc7')][_0x0b64('0xe8')],'alias':_0x50a07f[_0x0b64('0xc7')]['alias']};}return _0x50a07f;});});}else{var _0x44ad55=_['startCase'](_0x39e664)+(_0x39e664==='chat'?_0x0b64('0xe9'):_0x0b64('0xea'));var _0x2f201c={'attributes':['id',_0x0b64('0xeb'),_0x0b64('0xec'),'createdAt','note','disposition','secondDisposition','thirdDisposition',_0x0b64('0xe4'),_0x44ad55+'Id'],'where':{'ContactId':_0x231487[_0x0b64('0x21')]['id']},'include':[{'model':db[_0x44ad55],'as':_0x0b64('0xea'),'attributes':['id','name',_0x0b64('0xed')]},{'model':db[_0x0b64('0xc7')],'as':_0x0b64('0xee'),'attributes':['id','name','fullname']},{'model':db[_0x0b64('0x64')],'as':_0x0b64('0x65'),'attributes':['id','name',_0x0b64('0x66')],'through':{'attributes':[]}}],'order':[['createdAt',_0x0b64('0xe6')]]};if(_0x231487['query']['range']){_0x2f201c[_0x0b64('0x5d')][_0x0b64('0xe5')]={'$gte':_0x212cd5['from'],'$lte':_0x212cd5['to']};}switch(_0x39e664){case _0x0b64('0xcc'):_0x2f201c[_0x0b64('0x7a')][_0x0b64('0x5f')](_0x0b64('0xef'),_0x0b64('0xf0'),'customerPort',_0x0b64('0xf1'),'osName',_0x0b64('0xf2'),'ratingType',_0x0b64('0xf3'),_0x0b64('0xf4'));break;case'mail':_0x2f201c[_0x0b64('0x7a')]['push']('subject',_0x0b64('0xf5'));break;case _0x0b64('0xcd'):_0x2f201c[_0x0b64('0x7a')]['push'](_0x0b64('0xf6'),_0x0b64('0xf7'));break;}return db[_[_0x0b64('0xf8')](_0x39e664)+_0x0b64('0xf9')]['findAndCountAll'](_0x2f201c)[_0x0b64('0x16')](function(_0x14b495){_0x79c44f[_0x0b64('0x15')]+=_0x14b495[_0x0b64('0x15')];return _[_0x0b64('0x80')](_0x14b495['rows'],function(_0x176d85){var _0x2eaa81=_0x176d85['get']({'plain':!![]});_0x2eaa81[_0x0b64('0xd3')]=_0x39e664;if(_0x2eaa81[_0x0b64('0xee')]){_0x2eaa81[_0x0b64('0xee')]={'id':_0x2eaa81['Owner']['id'],'name':_0x2eaa81[_0x0b64('0xee')][_0x0b64('0x1b')],'fullname':_0x2eaa81[_0x0b64('0xee')][_0x0b64('0xe8')]};}return _0x2eaa81;});});}});return Promise[_0x0b64('0x62')](_0x2c08fd);})['then'](function(_0x7d3f8a){return _(_0x7d3f8a)[_0x0b64('0xfa')]()[_0x0b64('0xfb')](_0x0b64('0xe5'))[_0x0b64('0xfc')]()[_0x0b64('0xfd')]();})['then'](function(_0x4c5935){_0x79c44f[_0x0b64('0x9f')]=_0x521318['limit']?_0x4c5935[_0x0b64('0xfe')](_0x521318[_0x0b64('0x14')],_0x521318[_0x0b64('0x14')]+_0x521318['limit']):_0x4c5935;return _0x79c44f;})[_0x0b64('0x16')](respondWithFilteredResult(_0x2e1359,_0x521318))[_0x0b64('0x1f')](handleError(_0x2e1359,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index 2e6b275..a9a9c6e 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 _0x3c20=['events','../../mysqldb','CmContact','setMaxListeners','save','update','remove','hasOwnProperty'];(function(_0x35d4bc,_0x30a81c){var _0x472c90=function(_0x37a3c4){while(--_0x37a3c4){_0x35d4bc['push'](_0x35d4bc['shift']());}};_0x472c90(++_0x30a81c);}(_0x3c20,0x180));var _0x03c2=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0x3c20[_0x9df060];return _0x338dfe;};'use strict';var EventEmitter=require(_0x03c2('0x0'));var CmContact=require(_0x03c2('0x1'))['db'][_0x03c2('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents[_0x03c2('0x3')](0x0);var events={'afterCreate':_0x03c2('0x4'),'afterUpdate':_0x03c2('0x5'),'afterDestroy':_0x03c2('0x6')};function emitEvent(_0x1927c6){return function(_0x3709b5,_0x22b651,_0x379edc){CmContactEvents['emit'](_0x1927c6+':'+_0x3709b5['id'],_0x3709b5);CmContactEvents['emit'](_0x1927c6,_0x3709b5);_0x379edc(null);};}for(var e in events){if(events[_0x03c2('0x7')](e)){var event=events[e];CmContact['hook'](e,emitEvent(event));}}module['exports']=CmContactEvents; \ No newline at end of file +var _0xed13=['../../mysqldb','CmContact','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x3d63f6,_0x8cd7e4){var _0x2ac67b=function(_0x4dd921){while(--_0x4dd921){_0x3d63f6['push'](_0x3d63f6['shift']());}};_0x2ac67b(++_0x8cd7e4);}(_0xed13,0x198));var _0x3ed1=function(_0x2a418f,_0x39b19c){_0x2a418f=_0x2a418f-0x0;var _0x5ebd7e=_0xed13[_0x2a418f];return _0x5ebd7e;};'use strict';var EventEmitter=require('events');var CmContact=require(_0x3ed1('0x0'))['db'][_0x3ed1('0x1')];var CmContactEvents=new EventEmitter();CmContactEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3ed1('0x2'),'afterUpdate':_0x3ed1('0x3'),'afterDestroy':_0x3ed1('0x4')};function emitEvent(_0x41b17a){return function(_0x4cc3c2,_0x308b47,_0x472fbe){CmContactEvents['emit'](_0x41b17a+':'+_0x4cc3c2['id'],_0x4cc3c2);CmContactEvents[_0x3ed1('0x5')](_0x41b17a,_0x4cc3c2);_0x472fbe(null);};}for(var e in events){if(events[_0x3ed1('0x6')](e)){var event=events[e];CmContact[_0x3ed1('0x7')](e,emitEvent(event));}}module['exports']=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index 2aa9c2e..934436d 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 _0xf323=['minutes','format','YYYY-MM-DD\x20HH:mm:ss','ret','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','create','priority','callbackUniqueid','catch','CmHopper','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopperFinal','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','ListId','add','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','findAll','outbound','CmList','Lists','get','dialCheckDuplicateType','always','onlyIfOpen','BlackLists','length','CmHopperBlack','Campaign','cmContact,\x20%s,\x20%s','message','List\x20not\x20found','isEmpty','VoiceQueueId','push','all','info','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','../../config/environment/shared','define','CmContact','cm_contacts','phone','fti_cm_contacts','firstName','lastName','mobile','fax','email','FULLTEXT','utf8mb4_unicode_ci','models','error','cmContact','afterCreate','inspect','scheduledat','isNil','VoiceQueue','findOne','then','dialTimezone','timezones','utcOffset'];(function(_0x314ad7,_0x24ba44){var _0x1d381e=function(_0x5887b9){while(--_0x5887b9){_0x314ad7['push'](_0x314ad7['shift']());}};_0x1d381e(++_0x24ba44);}(_0xf323,0x1a0));var _0x3f32=function(_0x68bb19,_0x309790){_0x68bb19=_0x68bb19-0x0;var _0x1af158=_0xf323[_0x68bb19];return _0x1af158;};'use strict';var _=require(_0x3f32('0x0'));var util=require(_0x3f32('0x1'));var logger=require(_0x3f32('0x2'))(_0x3f32('0x3'));var moment=require('moment');var BPromise=require(_0x3f32('0x4'));var rp=require(_0x3f32('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3f32('0x6'));var config=require(_0x3f32('0x7'));var shared=require(_0x3f32('0x8'));var attributes=require('./cmContact.attributes');module['exports']=function(_0xe5160c,_0x9b4677){return _0xe5160c[_0x3f32('0x9')](_0x3f32('0xa'),attributes,{'tableName':_0x3f32('0xb'),'paranoid':!![],'indexes':[{'name':_0x3f32('0xc'),'fields':[_0x3f32('0xc')]},{'name':_0x3f32('0xd'),'fields':[_0x3f32('0xe'),_0x3f32('0xf'),'phone',_0x3f32('0x10'),_0x3f32('0x11'),_0x3f32('0x12')],'type':_0x3f32('0x13')}],'timestamps':!![],'charset':'utf8mb4','collate':_0x3f32('0x14'),'hooks':{'afterCreate':function(_0x36d0ca,_0x132e3c,_0x583808){var _0x590b5a=_0xe5160c[_0x3f32('0x15')];var _0x4908b4=_0x36d0ca['get']({'plain':!![]});function _0x286375(){return function(_0x4fcb46){logger[_0x3f32('0x16')](_0x3f32('0x17'),_0x3f32('0x18'),util[_0x3f32('0x19')](_0x4fcb46,{'showHidden':![],'depth':null}));};}function _0x849dd3(_0x7a44bc,_0x25d9b9){var _0x137929=_0x25d9b9[_0x3f32('0x1a')]?_0x25d9b9[_0x3f32('0x1a')]:moment()['format']('YYYY-MM-DD\x20HH:mm:ss');return new BPromise(function(_0x18028f,_0x18307b){if(_[_0x3f32('0x1b')](_0x25d9b9['dialTimezone'])){_0x18028f({'ret':_0x137929});}else{_0x590b5a[_0x3f32('0x1c')][_0x3f32('0x1d')]({'where':{'id':_0x7a44bc['id']}})[_0x3f32('0x1e')](function(_0x1fbd54){if(!_[_0x3f32('0x1b')](_0x1fbd54)){var _0x29026f=_0x1fbd54[_0x3f32('0x1f')];if(!_[_0x3f32('0x1b')](_0x29026f)){var _0x44d18e=shared[_0x3f32('0x20')];var _0x24e7d8=_0x44d18e[_0x29026f];var _0x8dd8b9=_0x44d18e[_0x25d9b9[_0x3f32('0x1f')]];if(!_[_0x3f32('0x1b')](_0x24e7d8)&&!_[_0x3f32('0x1b')](_0x8dd8b9)){var _0x112856=_0x24e7d8[_0x3f32('0x21')]-_0x8dd8b9[_0x3f32('0x21')];_0x137929=_0x25d9b9[_0x3f32('0x1a')]?_0x25d9b9['scheduledat']:moment();var _0x44d646=moment(_0x137929)['add'](_0x112856,_0x3f32('0x22'));_0x18028f({'ret':_0x44d646[_0x3f32('0x23')](_0x3f32('0x24'))});}else _0x18028f({'ret':_0x137929});}else _0x18028f({'ret':_0x137929});}else{_0x18028f({'ret':_0x137929});}});}});return 0xa;}var _0x143752=function(_0x1162ae){return new BPromise(function(_0x4de353,_0x1a3028){_0x849dd3(_0x1162ae,_0x4908b4)[_0x3f32('0x1e')](function(_0x3ce0cf){_0x4908b4['scheduledat']=_0x3ce0cf[_0x3f32('0x25')];_0x590b5a['CmHopper'][_0x3f32('0x1d')]({'where':{'phone':_0x4908b4[_0x3f32('0xc')],'VoiceQueueId':_0x1162ae['id']}})[_0x3f32('0x1e')](function(_0x4a6d64){if(!_[_0x3f32('0x1b')](_0x4a6d64)){throw new Error(_0x3f32('0x26')+_0x4908b4[_0x3f32('0xc')]+_0x3f32('0x27')+_0x1162ae['id']);}return _0x590b5a['CmHopper'][_0x3f32('0x28')]({'phone':_0x4908b4[_0x3f32('0xc')],'ContactId':_0x4908b4['id'],'ListId':_0x4908b4['ListId'],'priority':_0x4908b4[_0x3f32('0x29')]?_0x4908b4[_0x3f32('0x29')]:0x2,'scheduledat':_0x4908b4['scheduledat']?_0x4908b4[_0x3f32('0x1a')]:moment()[_0x3f32('0x23')](_0x3f32('0x24')),'callback':_0x4908b4[_0x3f32('0x2a')]?!![]:![],'callbackuniqueid':_0x4908b4[_0x3f32('0x2a')]?_0x4908b4[_0x3f32('0x2a')]:undefined,'callbackat':_0x4908b4[_0x3f32('0x2a')]?moment()[_0x3f32('0x23')](_0x3f32('0x24')):undefined,'VoiceQueueId':_0x1162ae['id']});})[_0x3f32('0x2b')](function(_0x2edfd4){_0x1a3028(_0x2edfd4);});});});};var _0x41a7ae=function(_0x2293db){return new BPromise(function(_0x13cb54,_0x5eb102){_0x849dd3(_0x2293db,_0x4908b4)[_0x3f32('0x1e')](function(_0x8ca1b2){_0x4908b4[_0x3f32('0x1a')]=_0x8ca1b2['ret'];_0x590b5a[_0x3f32('0x2c')]['findOne']({'where':{'phone':_0x4908b4['phone'],'VoiceQueueId':_0x2293db['id']}})[_0x3f32('0x1e')](function(_0x5d1e70){if(!_[_0x3f32('0x1b')](_0x5d1e70)){throw new Error('cmContact,\x20afterCreate\x20'+_0x4908b4[_0x3f32('0xc')]+_0x3f32('0x2d')+_0x2293db['id']);}return _0x590b5a[_0x3f32('0x2e')][_0x3f32('0x1d')]({'where':{'calleridnum':_0x4908b4[_0x3f32('0xc')],'VoiceQueueId':_0x2293db['id']}});})[_0x3f32('0x1e')](function(_0x44cfb6){if(!_[_0x3f32('0x1b')](_0x44cfb6)){throw new Error(_0x3f32('0x2f')+_0x4908b4[_0x3f32('0xc')]+_0x3f32('0x30')+_0x2293db['id']);}return _0x590b5a[_0x3f32('0x2c')][_0x3f32('0x28')]({'phone':_0x4908b4['phone'],'ContactId':_0x4908b4['id'],'ListId':_0x4908b4[_0x3f32('0x31')],'priority':_0x4908b4[_0x3f32('0x29')]?_0x4908b4['priority']:0x2,'scheduledat':_0x4908b4['scheduledat']?_0x4908b4[_0x3f32('0x1a')]:moment()[_0x3f32('0x23')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x4908b4['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x4908b4[_0x3f32('0x2a')]?_0x4908b4[_0x3f32('0x2a')]:undefined,'callbackat':_0x4908b4[_0x3f32('0x2a')]?moment()[_0x3f32('0x23')](_0x3f32('0x24')):undefined,'VoiceQueueId':_0x2293db['id']});})[_0x3f32('0x2b')](function(_0x504741){_0x5eb102(_0x504741);});});});};function _0x51a3fd(){return function(_0x1c516c){logger[_0x3f32('0x16')](_0x3f32('0x17'),_0x3f32('0x18'),util[_0x3f32('0x19')](_0x1c516c,{'showHidden':![],'depth':null}));};}function _0x2f7086(_0xe8a38a,_0x3bece8){var _0x300d64=_0x3bece8[_0x3f32('0x1a')]?_0x3bece8[_0x3f32('0x1a')]:moment()[_0x3f32('0x23')](_0x3f32('0x24'));return new BPromise(function(_0x1e9f4a,_0x134375){if(_[_0x3f32('0x1b')](_0x3bece8[_0x3f32('0x1f')])){_0x1e9f4a({'ret':_0x300d64});}else{_0x590b5a['Campaign']['findOne']({'where':{'id':_0xe8a38a['id']}})['then'](function(_0x3d7ee1){if(!_[_0x3f32('0x1b')](_0x3d7ee1)){var _0x36b53a=_0x3d7ee1['dialTimezone'];if(!_['isNil'](_0x36b53a)){var _0x22ac52=shared[_0x3f32('0x20')];var _0x2b163e=_0x22ac52[_0x36b53a];var _0x32266c=_0x22ac52[_0x3bece8['dialTimezone']];if(!_[_0x3f32('0x1b')](_0x2b163e)&&!_[_0x3f32('0x1b')](_0x32266c)){var _0x40d898=_0x2b163e['utcOffset']-_0x32266c[_0x3f32('0x21')];_0x300d64=_0x3bece8['scheduledat']?_0x3bece8[_0x3f32('0x1a')]:moment();var _0x560c42=moment(_0x300d64)[_0x3f32('0x32')](_0x40d898,_0x3f32('0x22'));_0x1e9f4a({'ret':_0x560c42[_0x3f32('0x23')]('YYYY-MM-DD\x20HH:mm:ss')});}else _0x1e9f4a({'ret':_0x300d64});}else _0x1e9f4a({'ret':_0x300d64});}else{_0x1e9f4a({'ret':_0x300d64});}});}});return 0xa;}var _0x5d89da=function(_0x46685a){return new BPromise(function(_0x47bdc9,_0x324aa4){_0x2f7086(_0x46685a,_0x4908b4)[_0x3f32('0x1e')](function(_0x1149eb){_0x4908b4[_0x3f32('0x1a')]=_0x1149eb[_0x3f32('0x25')];_0x590b5a[_0x3f32('0x2c')][_0x3f32('0x1d')]({'where':{'phone':_0x4908b4[_0x3f32('0xc')],'CampaignId':_0x46685a['id']}})[_0x3f32('0x1e')](function(_0x41a082){if(!_[_0x3f32('0x1b')](_0x41a082)){throw new Error(_0x3f32('0x26')+_0x4908b4[_0x3f32('0xc')]+_0x3f32('0x33')+_0x46685a['id']);}return _0x590b5a[_0x3f32('0x2c')][_0x3f32('0x28')]({'phone':_0x4908b4[_0x3f32('0xc')],'ContactId':_0x4908b4['id'],'ListId':_0x4908b4[_0x3f32('0x31')],'priority':_0x4908b4['priority']?_0x4908b4[_0x3f32('0x29')]:0x2,'scheduledat':_0x4908b4[_0x3f32('0x1a')]?_0x4908b4['scheduledat']:moment()['format'](_0x3f32('0x24')),'callback':_0x4908b4[_0x3f32('0x2a')]?!![]:![],'callbackuniqueid':_0x4908b4['callbackUniqueid']?_0x4908b4[_0x3f32('0x2a')]:undefined,'callbackat':_0x4908b4[_0x3f32('0x2a')]?moment()['format'](_0x3f32('0x24')):undefined,'CampaignId':_0x46685a['id']});})[_0x3f32('0x2b')](function(_0x9d2aac){_0x324aa4(_0x9d2aac);});});});};var _0x474625=function(_0x561d83){return new BPromise(function(_0x41fb10,_0x271c01){_0x2f7086(_0x561d83,_0x4908b4)[_0x3f32('0x1e')](function(_0x328532){_0x4908b4[_0x3f32('0x1a')]=_0x328532[_0x3f32('0x25')];_0x590b5a['CmHopper'][_0x3f32('0x1d')]({'where':{'phone':_0x4908b4['phone'],'CampaignId':_0x561d83['id']}})[_0x3f32('0x1e')](function(_0x301372){if(!_['isNil'](_0x301372)){throw new Error(_0x3f32('0x26')+_0x4908b4[_0x3f32('0xc')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20'+_0x561d83['id']);}return _0x590b5a['CmHopperFinal']['findOne']({'where':{'calleridnum':_0x4908b4['phone'],'CampaignId':_0x561d83['id']}});})[_0x3f32('0x1e')](function(_0x5837e9){if(!_[_0x3f32('0x1b')](_0x5837e9)){throw new Error(_0x3f32('0x2f')+_0x4908b4['phone']+_0x3f32('0x34')+_0x561d83['id']);}return _0x590b5a['CmHopper'][_0x3f32('0x28')]({'phone':_0x4908b4[_0x3f32('0xc')],'ContactId':_0x4908b4['id'],'ListId':_0x4908b4['ListId'],'priority':_0x4908b4[_0x3f32('0x29')]?_0x4908b4['priority']:0x2,'scheduledat':_0x4908b4[_0x3f32('0x1a')]?_0x4908b4[_0x3f32('0x1a')]:moment()['format'](_0x3f32('0x24')),'callback':_0x4908b4['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x4908b4[_0x3f32('0x2a')]?_0x4908b4[_0x3f32('0x2a')]:undefined,'callbackat':_0x4908b4[_0x3f32('0x2a')]?moment()[_0x3f32('0x23')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x561d83['id']});})[_0x3f32('0x2b')](function(_0x2f70b3){_0x271c01(_0x2f70b3);});});});};if(_0x4908b4[_0x3f32('0x31')]){_0x590b5a[_0x3f32('0x1c')][_0x3f32('0x35')]({'where':{'type':_0x3f32('0x36')},'attributes':['id','dialCheckDuplicateType',_0x3f32('0x1f')],'include':[{'model':_0x590b5a[_0x3f32('0x37')],'as':_0x3f32('0x38'),'where':{'id':_0x4908b4[_0x3f32('0x31')]}}]})['then'](function(_0x2c7a6c){if(_0x2c7a6c){var _0x397e40=[];for(var _0x53b305=0x0,_0x5741fb;_0x53b305<_0x2c7a6c['length'];_0x53b305+=0x1){_0x5741fb=_0x2c7a6c[_0x53b305][_0x3f32('0x39')]({'plain':!![]});switch(_0x5741fb[_0x3f32('0x3a')]){case _0x3f32('0x3b'):_0x41a7ae(_0x5741fb)[_0x3f32('0x2b')](_0x286375());break;case _0x3f32('0x3c'):_0x143752(_0x5741fb)[_0x3f32('0x2b')](_0x286375());break;default:_0x2f7086(_0x5741fb,_0x4908b4)[_0x3f32('0x1e')](function(_0x159a21){_0x4908b4[_0x3f32('0x1a')]=_0x159a21[_0x3f32('0x25')];_0x590b5a[_0x3f32('0x2c')][_0x3f32('0x28')]({'phone':_0x4908b4[_0x3f32('0xc')],'ContactId':_0x4908b4['id'],'ListId':_0x4908b4[_0x3f32('0x31')],'scheduledat':_0x4908b4[_0x3f32('0x1a')]?_0x4908b4['scheduledat']:moment()[_0x3f32('0x23')](_0x3f32('0x24')),'priority':_0x4908b4['priority']?_0x4908b4[_0x3f32('0x29')]:0x2,'callback':_0x4908b4[_0x3f32('0x2a')]?!![]:![],'callbackuniqueid':_0x4908b4[_0x3f32('0x2a')]?_0x4908b4[_0x3f32('0x2a')]:undefined,'callbackat':_0x4908b4[_0x3f32('0x2a')]?moment()[_0x3f32('0x23')](_0x3f32('0x24')):undefined,'VoiceQueueId':_0x5741fb['id']})['catch'](_0x286375());});}}}})['then'](function(){return _0x590b5a[_0x3f32('0x1c')]['findAll']({'where':{'type':_0x3f32('0x36')},'attributes':['id'],'include':[{'model':_0x590b5a[_0x3f32('0x37')],'as':_0x3f32('0x3d'),'where':{'id':_0x4908b4[_0x3f32('0x31')]}}]})[_0x3f32('0x1e')](function(_0x410286){if(_0x410286){var _0x42d80f=[];for(var _0xd88185=0x0,_0x5067c2;_0xd88185<_0x410286[_0x3f32('0x3e')];_0xd88185+=0x1){_0x5067c2=_0x410286[_0xd88185][_0x3f32('0x39')]({'plain':!![]});_0x590b5a[_0x3f32('0x3f')][_0x3f32('0x28')]({'phone':_0x4908b4[_0x3f32('0xc')],'ContactId':_0x4908b4['id'],'ListId':_0x4908b4[_0x3f32('0x31')],'VoiceQueueId':_0x5067c2['id']})[_0x3f32('0x2b')](function(_0xa5920f){logger['error']('cmContact,\x20%s,\x20%s',_0x3f32('0x18'),_0xa5920f['message']);});}}});})[_0x3f32('0x1e')](function(){return _0x590b5a[_0x3f32('0x40')][_0x3f32('0x35')]({'attributes':['id','dialCheckDuplicateType',_0x3f32('0x1f')],'include':[{'model':_0x590b5a[_0x3f32('0x37')],'as':'Lists','where':{'id':_0x4908b4['ListId']}}]})[_0x3f32('0x1e')](function(_0xad7326){if(_0xad7326){var _0x1af8c6=[];for(var _0x100eae=0x0,_0x1bf1f9;_0x100eae<_0xad7326[_0x3f32('0x3e')];_0x100eae+=0x1){_0x1bf1f9=_0xad7326[_0x100eae]['get']({'plain':!![]});switch(_0x1bf1f9[_0x3f32('0x3a')]){case _0x3f32('0x3b'):_0x474625(_0x1bf1f9)['catch'](_0x51a3fd());break;case _0x3f32('0x3c'):_0x5d89da(_0x1bf1f9)[_0x3f32('0x2b')](_0x51a3fd());break;default:_0x590b5a[_0x3f32('0x2c')]['create']({'phone':_0x4908b4[_0x3f32('0xc')],'ContactId':_0x4908b4['id'],'ListId':_0x4908b4[_0x3f32('0x31')],'scheduledat':_0x4908b4['scheduledat']?_0x4908b4[_0x3f32('0x1a')]:moment()[_0x3f32('0x23')](_0x3f32('0x24')),'priority':_0x4908b4[_0x3f32('0x29')]?_0x4908b4[_0x3f32('0x29')]:0x2,'callback':_0x4908b4[_0x3f32('0x2a')]?!![]:![],'callbackuniqueid':_0x4908b4[_0x3f32('0x2a')]?_0x4908b4['callbackUniqueid']:undefined,'callbackat':_0x4908b4[_0x3f32('0x2a')]?moment()[_0x3f32('0x23')](_0x3f32('0x24')):undefined,'CampaignId':_0x1bf1f9['id']})['catch'](_0x51a3fd());}}}});})['then'](function(){return _0x590b5a[_0x3f32('0x40')][_0x3f32('0x35')]({'attributes':['id'],'include':[{'model':_0x590b5a['CmList'],'as':_0x3f32('0x3d'),'where':{'id':_0x4908b4[_0x3f32('0x31')]}}]})[_0x3f32('0x1e')](function(_0x38b8e7){if(_0x38b8e7){var _0x3297a6=[];for(var _0x4f6e2e=0x0,_0x39649a;_0x4f6e2e<_0x38b8e7[_0x3f32('0x3e')];_0x4f6e2e+=0x1){_0x39649a=_0x38b8e7[_0x4f6e2e]['get']({'plain':!![]});_0x590b5a[_0x3f32('0x3f')][_0x3f32('0x28')]({'phone':_0x4908b4[_0x3f32('0xc')],'ContactId':_0x4908b4['id'],'ListId':_0x4908b4[_0x3f32('0x31')],'CampaignId':_0x39649a['id']})[_0x3f32('0x2b')](function(_0x17bb97){logger[_0x3f32('0x16')](_0x3f32('0x41'),'afterCreate',_0x17bb97[_0x3f32('0x42')]);});}}});})['then'](function(){_0x583808();})[_0x3f32('0x2b')](function(_0x1d2a7b){logger[_0x3f32('0x16')](_0x3f32('0x41'),_0x3f32('0x18'),_0x1d2a7b[_0x3f32('0x42')]);_0x583808(_0x1d2a7b);});}else{_0x583808(new Error(_0x3f32('0x43')));}},'afterDestroy':function(_0x5f3fb0,_0x2911c5,_0x1a05c6){var _0x3894cf=_0xe5160c['models'];var _0x3878d4=_0x5f3fb0[_0x3f32('0x39')]({'plain':!![]});return _0x3894cf['CmHopper'][_0x3f32('0x35')]({'raw':!![],'where':{'ListId':_0x3878d4[_0x3f32('0x31')],'ContactId':_0x3878d4['id']}})[_0x3f32('0x1e')](function(_0x492f09){if(!_[_0x3f32('0x44')](_0x492f09)){var _0x1cb20f=[];for(var _0x34d5ab=0x0;_0x34d5ab<_0x492f09[_0x3f32('0x3e')];_0x34d5ab+=0x1){var _0x23b90e=_0x3894cf['CmHopper']['destroy']({'where':{'ListId':_0x492f09[_0x34d5ab]['ListId'],'ContactId':_0x492f09[_0x34d5ab]['ContactId'],'VoiceQueueId':_0x492f09[_0x34d5ab][_0x3f32('0x45')],'CampaignId':_0x492f09[_0x34d5ab]['CampaignId']}});_0x1cb20f[_0x3f32('0x46')](_0x23b90e);}return BPromise[_0x3f32('0x47')](_0x1cb20f);}})[_0x3f32('0x1e')](function(_0x14ce6e){logger[_0x3f32('0x48')](_0x3f32('0x49'),util['inspect'](_0x14ce6e,{'showHidden':![],'depth':null}));_0x1a05c6();})[_0x3f32('0x2b')](function(_0x47d218){logger[_0x3f32('0x16')](_0x3f32('0x4a'),util[_0x3f32('0x19')](_0x47d218,{'showHidden':![],'depth':null}));_0x1a05c6(_0x47d218);});}}});}; \ No newline at end of file +var _0xf68d=['\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','outbound','Lists','length','dialCheckDuplicateType','always','findAll','BlackLists','CmHopperBlack','cmContact,\x20%s,\x20%s','CmList','onlyIfOpen','message','error','List\x20not\x20found','isEmpty','ContactId','VoiceQueueId','push','all','info','[CmContact][afterDestroy][Succesfull]','inspect','[CmContact][afterDestroy][Error]','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','../../config/environment/shared','./cmContact.attributes','exports','define','cm_contacts','phone','firstName','lastName','mobile','fax','email','FULLTEXT','utf8mb4_unicode_ci','models','get','cmContact','afterCreate','format','YYYY-MM-DD\x20HH:mm:ss','dialTimezone','VoiceQueue','findOne','then','isNil','timezones','utcOffset','scheduledat','add','minutes','ret','CmHopper','create','ListId','priority','callbackUniqueid','catch','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopperFinal','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','Campaign','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20'];(function(_0x2154ec,_0x1ff139){var _0x1d672f=function(_0x45a25c){while(--_0x45a25c){_0x2154ec['push'](_0x2154ec['shift']());}};_0x1d672f(++_0x1ff139);}(_0xf68d,0x199));var _0xdf68=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0xf68d[_0x543084];return _0x306a57;};'use strict';var _=require(_0xdf68('0x0'));var util=require(_0xdf68('0x1'));var logger=require(_0xdf68('0x2'))('api');var moment=require(_0xdf68('0x3'));var BPromise=require(_0xdf68('0x4'));var rp=require(_0xdf68('0x5'));var fs=require('fs');var path=require(_0xdf68('0x6'));var rimraf=require(_0xdf68('0x7'));var config=require(_0xdf68('0x8'));var shared=require(_0xdf68('0x9'));var attributes=require(_0xdf68('0xa'));module[_0xdf68('0xb')]=function(_0x1005a9,_0x34d926){return _0x1005a9[_0xdf68('0xc')]('CmContact',attributes,{'tableName':_0xdf68('0xd'),'paranoid':!![],'indexes':[{'name':_0xdf68('0xe'),'fields':[_0xdf68('0xe')]},{'name':'fti_cm_contacts','fields':[_0xdf68('0xf'),_0xdf68('0x10'),_0xdf68('0xe'),_0xdf68('0x11'),_0xdf68('0x12'),_0xdf68('0x13')],'type':_0xdf68('0x14')}],'timestamps':!![],'charset':'utf8mb4','collate':_0xdf68('0x15'),'hooks':{'afterCreate':function(_0x47f372,_0x218640,_0x5ade50){var _0x572f36=_0x1005a9[_0xdf68('0x16')];var _0x37a1a0=_0x47f372[_0xdf68('0x17')]({'plain':!![]});function _0x388e50(){return function(_0x54b5e1){logger['error'](_0xdf68('0x18'),_0xdf68('0x19'),util['inspect'](_0x54b5e1,{'showHidden':![],'depth':null}));};}function _0x374f2f(_0x3a05ad,_0x4eaee0){var _0x11a2a5=_0x4eaee0['scheduledat']?_0x4eaee0['scheduledat']:moment()[_0xdf68('0x1a')](_0xdf68('0x1b'));return new BPromise(function(_0x16f247,_0x11844b){if(_['isNil'](_0x4eaee0[_0xdf68('0x1c')])){_0x16f247({'ret':_0x11a2a5});}else{_0x572f36[_0xdf68('0x1d')][_0xdf68('0x1e')]({'where':{'id':_0x3a05ad['id']}})[_0xdf68('0x1f')](function(_0x5e25a5){if(!_['isNil'](_0x5e25a5)){var _0x5c75b8=_0x5e25a5[_0xdf68('0x1c')];if(!_[_0xdf68('0x20')](_0x5c75b8)){var _0x2aceb9=shared[_0xdf68('0x21')];var _0x6ebdc8=_0x2aceb9[_0x5c75b8];var _0x1d2025=_0x2aceb9[_0x4eaee0[_0xdf68('0x1c')]];if(!_[_0xdf68('0x20')](_0x6ebdc8)&&!_[_0xdf68('0x20')](_0x1d2025)){var _0x5b182f=_0x6ebdc8[_0xdf68('0x22')]-_0x1d2025[_0xdf68('0x22')];_0x11a2a5=_0x4eaee0[_0xdf68('0x23')]?_0x4eaee0['scheduledat']:moment();var _0x12c0f8=moment(_0x11a2a5)[_0xdf68('0x24')](_0x5b182f,_0xdf68('0x25'));_0x16f247({'ret':_0x12c0f8[_0xdf68('0x1a')]('YYYY-MM-DD\x20HH:mm:ss')});}else _0x16f247({'ret':_0x11a2a5});}else _0x16f247({'ret':_0x11a2a5});}else{_0x16f247({'ret':_0x11a2a5});}});}});return 0xa;}var _0x34a4f6=function(_0x1f7411){return new BPromise(function(_0x58ee4d,_0x348c49){_0x374f2f(_0x1f7411,_0x37a1a0)[_0xdf68('0x1f')](function(_0x238100){_0x37a1a0[_0xdf68('0x23')]=_0x238100[_0xdf68('0x26')];_0x572f36[_0xdf68('0x27')][_0xdf68('0x1e')]({'where':{'phone':_0x37a1a0[_0xdf68('0xe')],'VoiceQueueId':_0x1f7411['id']}})[_0xdf68('0x1f')](function(_0x4924b9){if(!_[_0xdf68('0x20')](_0x4924b9)){throw new Error('cmContact,\x20afterCreate\x20'+_0x37a1a0[_0xdf68('0xe')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20'+_0x1f7411['id']);}return _0x572f36[_0xdf68('0x27')][_0xdf68('0x28')]({'phone':_0x37a1a0[_0xdf68('0xe')],'ContactId':_0x37a1a0['id'],'ListId':_0x37a1a0[_0xdf68('0x29')],'priority':_0x37a1a0[_0xdf68('0x2a')]?_0x37a1a0[_0xdf68('0x2a')]:0x2,'scheduledat':_0x37a1a0[_0xdf68('0x23')]?_0x37a1a0[_0xdf68('0x23')]:moment()[_0xdf68('0x1a')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x37a1a0[_0xdf68('0x2b')]?!![]:![],'callbackuniqueid':_0x37a1a0[_0xdf68('0x2b')]?_0x37a1a0[_0xdf68('0x2b')]:undefined,'callbackat':_0x37a1a0[_0xdf68('0x2b')]?moment()[_0xdf68('0x1a')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x1f7411['id']});})[_0xdf68('0x2c')](function(_0x15ffdb){_0x348c49(_0x15ffdb);});});});};var _0x1206d8=function(_0x5b5385){return new BPromise(function(_0x2c49c0,_0x4cb483){_0x374f2f(_0x5b5385,_0x37a1a0)[_0xdf68('0x1f')](function(_0x58091b){_0x37a1a0[_0xdf68('0x23')]=_0x58091b[_0xdf68('0x26')];_0x572f36['CmHopper']['findOne']({'where':{'phone':_0x37a1a0[_0xdf68('0xe')],'VoiceQueueId':_0x5b5385['id']}})[_0xdf68('0x1f')](function(_0x273126){if(!_['isNil'](_0x273126)){throw new Error(_0xdf68('0x2d')+_0x37a1a0[_0xdf68('0xe')]+_0xdf68('0x2e')+_0x5b5385['id']);}return _0x572f36[_0xdf68('0x2f')][_0xdf68('0x1e')]({'where':{'calleridnum':_0x37a1a0[_0xdf68('0xe')],'VoiceQueueId':_0x5b5385['id']}});})['then'](function(_0x4e9ddf){if(!_['isNil'](_0x4e9ddf)){throw new Error(_0xdf68('0x30')+_0x37a1a0[_0xdf68('0xe')]+_0xdf68('0x31')+_0x5b5385['id']);}return _0x572f36[_0xdf68('0x27')][_0xdf68('0x28')]({'phone':_0x37a1a0[_0xdf68('0xe')],'ContactId':_0x37a1a0['id'],'ListId':_0x37a1a0[_0xdf68('0x29')],'priority':_0x37a1a0[_0xdf68('0x2a')]?_0x37a1a0[_0xdf68('0x2a')]:0x2,'scheduledat':_0x37a1a0[_0xdf68('0x23')]?_0x37a1a0[_0xdf68('0x23')]:moment()[_0xdf68('0x1a')](_0xdf68('0x1b')),'callback':_0x37a1a0[_0xdf68('0x2b')]?!![]:![],'callbackuniqueid':_0x37a1a0['callbackUniqueid']?_0x37a1a0[_0xdf68('0x2b')]:undefined,'callbackat':_0x37a1a0[_0xdf68('0x2b')]?moment()['format'](_0xdf68('0x1b')):undefined,'VoiceQueueId':_0x5b5385['id']});})['catch'](function(_0x5a6129){_0x4cb483(_0x5a6129);});});});};function _0xc458cd(){return function(_0x53a6dc){logger['error']('cmContact',_0xdf68('0x19'),util['inspect'](_0x53a6dc,{'showHidden':![],'depth':null}));};}function _0x260cc4(_0x7f557d,_0x3bf9de){var _0x3d7735=_0x3bf9de['scheduledat']?_0x3bf9de[_0xdf68('0x23')]:moment()[_0xdf68('0x1a')](_0xdf68('0x1b'));return new BPromise(function(_0x1e3310,_0x2400b1){if(_[_0xdf68('0x20')](_0x3bf9de[_0xdf68('0x1c')])){_0x1e3310({'ret':_0x3d7735});}else{_0x572f36[_0xdf68('0x32')][_0xdf68('0x1e')]({'where':{'id':_0x7f557d['id']}})[_0xdf68('0x1f')](function(_0x470a6a){if(!_[_0xdf68('0x20')](_0x470a6a)){var _0x1415b4=_0x470a6a[_0xdf68('0x1c')];if(!_[_0xdf68('0x20')](_0x1415b4)){var _0x50787d=shared[_0xdf68('0x21')];var _0x2a4976=_0x50787d[_0x1415b4];var _0x132cd1=_0x50787d[_0x3bf9de[_0xdf68('0x1c')]];if(!_['isNil'](_0x2a4976)&&!_[_0xdf68('0x20')](_0x132cd1)){var _0x3a0777=_0x2a4976['utcOffset']-_0x132cd1['utcOffset'];_0x3d7735=_0x3bf9de[_0xdf68('0x23')]?_0x3bf9de[_0xdf68('0x23')]:moment();var _0x39edf8=moment(_0x3d7735)[_0xdf68('0x24')](_0x3a0777,'minutes');_0x1e3310({'ret':_0x39edf8[_0xdf68('0x1a')](_0xdf68('0x1b'))});}else _0x1e3310({'ret':_0x3d7735});}else _0x1e3310({'ret':_0x3d7735});}else{_0x1e3310({'ret':_0x3d7735});}});}});return 0xa;}var _0x251caf=function(_0x3573b9){return new BPromise(function(_0x3c1984,_0x3bd85e){_0x260cc4(_0x3573b9,_0x37a1a0)['then'](function(_0x476e56){_0x37a1a0[_0xdf68('0x23')]=_0x476e56[_0xdf68('0x26')];_0x572f36[_0xdf68('0x27')][_0xdf68('0x1e')]({'where':{'phone':_0x37a1a0[_0xdf68('0xe')],'CampaignId':_0x3573b9['id']}})[_0xdf68('0x1f')](function(_0x33884f){if(!_[_0xdf68('0x20')](_0x33884f)){throw new Error(_0xdf68('0x2d')+_0x37a1a0[_0xdf68('0xe')]+_0xdf68('0x33')+_0x3573b9['id']);}return _0x572f36[_0xdf68('0x27')][_0xdf68('0x28')]({'phone':_0x37a1a0[_0xdf68('0xe')],'ContactId':_0x37a1a0['id'],'ListId':_0x37a1a0[_0xdf68('0x29')],'priority':_0x37a1a0[_0xdf68('0x2a')]?_0x37a1a0[_0xdf68('0x2a')]:0x2,'scheduledat':_0x37a1a0['scheduledat']?_0x37a1a0[_0xdf68('0x23')]:moment()['format'](_0xdf68('0x1b')),'callback':_0x37a1a0[_0xdf68('0x2b')]?!![]:![],'callbackuniqueid':_0x37a1a0[_0xdf68('0x2b')]?_0x37a1a0[_0xdf68('0x2b')]:undefined,'callbackat':_0x37a1a0[_0xdf68('0x2b')]?moment()[_0xdf68('0x1a')](_0xdf68('0x1b')):undefined,'CampaignId':_0x3573b9['id']});})['catch'](function(_0x332469){_0x3bd85e(_0x332469);});});});};var _0x1d21f0=function(_0x57dbac){return new BPromise(function(_0x18fcd6,_0x4e2ac4){_0x260cc4(_0x57dbac,_0x37a1a0)[_0xdf68('0x1f')](function(_0x33cd25){_0x37a1a0['scheduledat']=_0x33cd25['ret'];_0x572f36[_0xdf68('0x27')][_0xdf68('0x1e')]({'where':{'phone':_0x37a1a0['phone'],'CampaignId':_0x57dbac['id']}})[_0xdf68('0x1f')](function(_0x208609){if(!_[_0xdf68('0x20')](_0x208609)){throw new Error(_0xdf68('0x2d')+_0x37a1a0[_0xdf68('0xe')]+_0xdf68('0x34')+_0x57dbac['id']);}return _0x572f36[_0xdf68('0x2f')][_0xdf68('0x1e')]({'where':{'calleridnum':_0x37a1a0[_0xdf68('0xe')],'CampaignId':_0x57dbac['id']}});})[_0xdf68('0x1f')](function(_0x2a6180){if(!_[_0xdf68('0x20')](_0x2a6180)){throw new Error(_0xdf68('0x30')+_0x37a1a0[_0xdf68('0xe')]+_0xdf68('0x35')+_0x57dbac['id']);}return _0x572f36[_0xdf68('0x27')]['create']({'phone':_0x37a1a0[_0xdf68('0xe')],'ContactId':_0x37a1a0['id'],'ListId':_0x37a1a0['ListId'],'priority':_0x37a1a0[_0xdf68('0x2a')]?_0x37a1a0[_0xdf68('0x2a')]:0x2,'scheduledat':_0x37a1a0[_0xdf68('0x23')]?_0x37a1a0[_0xdf68('0x23')]:moment()['format'](_0xdf68('0x1b')),'callback':_0x37a1a0[_0xdf68('0x2b')]?!![]:![],'callbackuniqueid':_0x37a1a0[_0xdf68('0x2b')]?_0x37a1a0[_0xdf68('0x2b')]:undefined,'callbackat':_0x37a1a0[_0xdf68('0x2b')]?moment()[_0xdf68('0x1a')](_0xdf68('0x1b')):undefined,'CampaignId':_0x57dbac['id']});})[_0xdf68('0x2c')](function(_0x4904d7){_0x4e2ac4(_0x4904d7);});});});};if(_0x37a1a0[_0xdf68('0x29')]){_0x572f36[_0xdf68('0x1d')]['findAll']({'where':{'type':_0xdf68('0x36')},'attributes':['id','dialCheckDuplicateType',_0xdf68('0x1c')],'include':[{'model':_0x572f36['CmList'],'as':_0xdf68('0x37'),'where':{'id':_0x37a1a0['ListId']}}]})['then'](function(_0xe6f103){if(_0xe6f103){var _0xe1994e=[];for(var _0x68c213=0x0,_0xa4e4c8;_0x68c213<_0xe6f103[_0xdf68('0x38')];_0x68c213+=0x1){_0xa4e4c8=_0xe6f103[_0x68c213]['get']({'plain':!![]});switch(_0xa4e4c8[_0xdf68('0x39')]){case _0xdf68('0x3a'):_0x1206d8(_0xa4e4c8)['catch'](_0x388e50());break;case'onlyIfOpen':_0x34a4f6(_0xa4e4c8)['catch'](_0x388e50());break;default:_0x260cc4(_0xa4e4c8,_0x37a1a0)['then'](function(_0x1cceec){_0x37a1a0[_0xdf68('0x23')]=_0x1cceec[_0xdf68('0x26')];_0x572f36[_0xdf68('0x27')]['create']({'phone':_0x37a1a0[_0xdf68('0xe')],'ContactId':_0x37a1a0['id'],'ListId':_0x37a1a0[_0xdf68('0x29')],'scheduledat':_0x37a1a0['scheduledat']?_0x37a1a0[_0xdf68('0x23')]:moment()['format'](_0xdf68('0x1b')),'priority':_0x37a1a0[_0xdf68('0x2a')]?_0x37a1a0[_0xdf68('0x2a')]:0x2,'callback':_0x37a1a0[_0xdf68('0x2b')]?!![]:![],'callbackuniqueid':_0x37a1a0[_0xdf68('0x2b')]?_0x37a1a0[_0xdf68('0x2b')]:undefined,'callbackat':_0x37a1a0[_0xdf68('0x2b')]?moment()['format'](_0xdf68('0x1b')):undefined,'VoiceQueueId':_0xa4e4c8['id']})[_0xdf68('0x2c')](_0x388e50());});}}}})[_0xdf68('0x1f')](function(){return _0x572f36[_0xdf68('0x1d')][_0xdf68('0x3b')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':_0x572f36['CmList'],'as':_0xdf68('0x3c'),'where':{'id':_0x37a1a0['ListId']}}]})['then'](function(_0x1a217c){if(_0x1a217c){var _0x41c69e=[];for(var _0x524e6c=0x0,_0x4796a5;_0x524e6c<_0x1a217c['length'];_0x524e6c+=0x1){_0x4796a5=_0x1a217c[_0x524e6c]['get']({'plain':!![]});_0x572f36[_0xdf68('0x3d')][_0xdf68('0x28')]({'phone':_0x37a1a0['phone'],'ContactId':_0x37a1a0['id'],'ListId':_0x37a1a0[_0xdf68('0x29')],'VoiceQueueId':_0x4796a5['id']})[_0xdf68('0x2c')](function(_0x1f91b7){logger['error'](_0xdf68('0x3e'),_0xdf68('0x19'),_0x1f91b7['message']);});}}});})[_0xdf68('0x1f')](function(){return _0x572f36['Campaign'][_0xdf68('0x3b')]({'attributes':['id','dialCheckDuplicateType','dialTimezone'],'include':[{'model':_0x572f36[_0xdf68('0x3f')],'as':_0xdf68('0x37'),'where':{'id':_0x37a1a0[_0xdf68('0x29')]}}]})[_0xdf68('0x1f')](function(_0x59f9ea){if(_0x59f9ea){var _0x3dfc59=[];for(var _0x5b4e0f=0x0,_0x44f883;_0x5b4e0f<_0x59f9ea['length'];_0x5b4e0f+=0x1){_0x44f883=_0x59f9ea[_0x5b4e0f][_0xdf68('0x17')]({'plain':!![]});switch(_0x44f883[_0xdf68('0x39')]){case'always':_0x1d21f0(_0x44f883)['catch'](_0xc458cd());break;case _0xdf68('0x40'):_0x251caf(_0x44f883)[_0xdf68('0x2c')](_0xc458cd());break;default:_0x572f36[_0xdf68('0x27')]['create']({'phone':_0x37a1a0['phone'],'ContactId':_0x37a1a0['id'],'ListId':_0x37a1a0[_0xdf68('0x29')],'scheduledat':_0x37a1a0[_0xdf68('0x23')]?_0x37a1a0[_0xdf68('0x23')]:moment()['format'](_0xdf68('0x1b')),'priority':_0x37a1a0[_0xdf68('0x2a')]?_0x37a1a0[_0xdf68('0x2a')]:0x2,'callback':_0x37a1a0['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x37a1a0[_0xdf68('0x2b')]?_0x37a1a0['callbackUniqueid']:undefined,'callbackat':_0x37a1a0['callbackUniqueid']?moment()[_0xdf68('0x1a')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x44f883['id']})[_0xdf68('0x2c')](_0xc458cd());}}}});})[_0xdf68('0x1f')](function(){return _0x572f36['Campaign']['findAll']({'attributes':['id'],'include':[{'model':_0x572f36[_0xdf68('0x3f')],'as':_0xdf68('0x3c'),'where':{'id':_0x37a1a0['ListId']}}]})[_0xdf68('0x1f')](function(_0xd78c36){if(_0xd78c36){var _0x5aa90f=[];for(var _0x1600e1=0x0,_0x5ab177;_0x1600e1<_0xd78c36[_0xdf68('0x38')];_0x1600e1+=0x1){_0x5ab177=_0xd78c36[_0x1600e1][_0xdf68('0x17')]({'plain':!![]});_0x572f36[_0xdf68('0x3d')][_0xdf68('0x28')]({'phone':_0x37a1a0['phone'],'ContactId':_0x37a1a0['id'],'ListId':_0x37a1a0[_0xdf68('0x29')],'CampaignId':_0x5ab177['id']})[_0xdf68('0x2c')](function(_0x2c12e4){logger['error'](_0xdf68('0x3e'),_0xdf68('0x19'),_0x2c12e4[_0xdf68('0x41')]);});}}});})['then'](function(){_0x5ade50();})[_0xdf68('0x2c')](function(_0xcdcf37){logger[_0xdf68('0x42')](_0xdf68('0x3e'),_0xdf68('0x19'),_0xcdcf37[_0xdf68('0x41')]);_0x5ade50(_0xcdcf37);});}else{_0x5ade50(new Error(_0xdf68('0x43')));}},'afterDestroy':function(_0x2c46f5,_0x4cb0de,_0x4e6439){var _0x127b51=_0x1005a9[_0xdf68('0x16')];var _0x22c781=_0x2c46f5[_0xdf68('0x17')]({'plain':!![]});return _0x127b51[_0xdf68('0x27')]['findAll']({'raw':!![],'where':{'ListId':_0x22c781[_0xdf68('0x29')],'ContactId':_0x22c781['id']}})[_0xdf68('0x1f')](function(_0x2fb77c){if(!_[_0xdf68('0x44')](_0x2fb77c)){var _0x423862=[];for(var _0x1a52c7=0x0;_0x1a52c7<_0x2fb77c[_0xdf68('0x38')];_0x1a52c7+=0x1){var _0x2874ef=_0x127b51[_0xdf68('0x27')]['destroy']({'where':{'ListId':_0x2fb77c[_0x1a52c7]['ListId'],'ContactId':_0x2fb77c[_0x1a52c7][_0xdf68('0x45')],'VoiceQueueId':_0x2fb77c[_0x1a52c7][_0xdf68('0x46')],'CampaignId':_0x2fb77c[_0x1a52c7]['CampaignId']}});_0x423862[_0xdf68('0x47')](_0x2874ef);}return BPromise[_0xdf68('0x48')](_0x423862);}})[_0xdf68('0x1f')](function(_0x1fd69c){logger[_0xdf68('0x49')](_0xdf68('0x4a'),util[_0xdf68('0x4b')](_0x1fd69c,{'showHidden':![],'depth':null}));_0x4e6439();})[_0xdf68('0x2c')](function(_0x35fb76){logger[_0xdf68('0x42')](_0xdf68('0x4c'),util['inspect'](_0x35fb76,{'showHidden':![],'depth':null}));_0x4e6439(_0x35fb76);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index bf96a21..646135d 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(_0x39eada,_0x389d21){var _0x148bf1=function(_0x16be0d){while(--_0x16be0d){_0x39eada['push'](_0x39eada['shift']());}};_0x148bf1(++_0x389d21);}(_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 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(_0x3ce63f,_0xad9272){var _0x37c8c6=function(_0x2b7b44){while(--_0x2b7b44){_0x3ce63f['push'](_0x3ce63f['shift']());}};_0x37c8c6(++_0xad9272);}(_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['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 2872613..7a9b578 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 _0xa739=['PHONE','exports','STRING','INTEGER'];(function(_0x16ee61,_0x1b877f){var _0x45e9fb=function(_0x5ab72b){while(--_0x5ab72b){_0x16ee61['push'](_0x16ee61['shift']());}};_0x45e9fb(++_0x1b877f);}(_0xa739,0x1e1));var _0x9a73=function(_0x18f11f,_0x285f7b){_0x18f11f=_0x18f11f-0x0;var _0x25b1ab=_0xa739[_0x18f11f];return _0x25b1ab;};'use strict';var Sequelize=require('sequelize');module[_0x9a73('0x0')]={'CmContactId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'item':{'type':Sequelize[_0x9a73('0x1')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x9a73('0x2')],'defaultValue':null},'ItemClass':{'type':Sequelize['STRING'],'defaultValue':_0x9a73('0x3')},'OrderBy':{'type':Sequelize[_0x9a73('0x2')],'defaultValue':null},'description':{'type':Sequelize[_0x9a73('0x1')],'defaultValue':null}}; \ No newline at end of file +var _0x3df4=['INTEGER','STRING','PHONE'];(function(_0x2dfd0e,_0x13739e){var _0x343af6=function(_0x206e2f){while(--_0x206e2f){_0x2dfd0e['push'](_0x2dfd0e['shift']());}};_0x343af6(++_0x13739e);}(_0x3df4,0x102));var _0x43df=function(_0x74d8,_0x43a04c){_0x74d8=_0x74d8-0x0;var _0x317d00=_0x3df4[_0x74d8];return _0x317d00;};'use strict';var Sequelize=require('sequelize');module['exports']={'CmContactId':{'type':Sequelize[_0x43df('0x0')],'primaryKey':!![]},'item':{'type':Sequelize[_0x43df('0x1')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x43df('0x0')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x43df('0x1')],'defaultValue':_0x43df('0x2')},'OrderBy':{'type':Sequelize[_0x43df('0x0')],'defaultValue':null},'description':{'type':Sequelize[_0x43df('0x1')],'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 8a09c48..c76afb7 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 _0xd4e6=['crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','destroy','get','UserProfileResource','end','error','name','send','index','CmContactHasItem','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','options','includeAll','include','findAll','rows','rawAttributes','merge','find','catch','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CmContactHasItems','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','fast-json-patch','sox','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x230ad1,_0x487a68){var _0x540956=function(_0x3081d0){while(--_0x3081d0){_0x230ad1['push'](_0x230ad1['shift']());}};_0x540956(++_0x487a68);}(_0xd4e6,0x94));var _0x6d4e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xd4e6[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require(_0x6d4e('0x0'));var rimraf=require(_0x6d4e('0x1'));var zipdir=require(_0x6d4e('0x2'));var jsonpatch=require(_0x6d4e('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x6d4e('0x4'));var csv=require(_0x6d4e('0x5'));var ejs=require(_0x6d4e('0x6'));var fs=require('fs');var fs_extra=require(_0x6d4e('0x7'));var _=require(_0x6d4e('0x8'));var squel=require(_0x6d4e('0x9'));var crypto=require(_0x6d4e('0xa'));var jsforce=require(_0x6d4e('0xb'));var deskjs=require(_0x6d4e('0xc'));var toCsv=require(_0x6d4e('0x5'));var querystring=require(_0x6d4e('0xd'));var Papa=require(_0x6d4e('0xe'));var Redis=require(_0x6d4e('0xf'));var authService=require(_0x6d4e('0x10'));var qs=require(_0x6d4e('0x11'));var as=require(_0x6d4e('0x12'));var hardwareService=require(_0x6d4e('0x13'));var logger=require(_0x6d4e('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x6d4e('0x15'));var licenseUtil=require(_0x6d4e('0x16'));var db=require(_0x6d4e('0x17'))['db'];function respondWithStatusCode(_0x2397ca,_0x5e855a){_0x5e855a=_0x5e855a||0xcc;return function(_0x2c1493){if(_0x2c1493){return _0x2397ca[_0x6d4e('0x18')](_0x5e855a);}return _0x2397ca[_0x6d4e('0x19')](_0x5e855a)['end']();};}function respondWithResult(_0x1a646d,_0x1cc782){_0x1cc782=_0x1cc782||0xc8;return function(_0x21a1b6){if(_0x21a1b6){return _0x1a646d[_0x6d4e('0x19')](_0x1cc782)[_0x6d4e('0x1a')](_0x21a1b6);}};}function respondWithFilteredResult(_0xb8b79d,_0x55fedf){return function(_0x641698){if(_0x641698){var _0x9748ed=typeof _0x55fedf[_0x6d4e('0x1b')]===_0x6d4e('0x1c')&&typeof _0x55fedf[_0x6d4e('0x1d')]===_0x6d4e('0x1c');var _0x307fa4=_0x641698[_0x6d4e('0x1e')];var _0x3c5d07=_0x9748ed?0x0:_0x55fedf[_0x6d4e('0x1b')];var _0x214586=_0x9748ed?_0x641698[_0x6d4e('0x1e')]:_0x55fedf[_0x6d4e('0x1b')]+_0x55fedf['limit'];var _0x2ff6f0;if(_0x214586>=_0x307fa4){_0x214586=_0x307fa4;_0x2ff6f0=0xc8;}else{_0x2ff6f0=0xce;}_0xb8b79d[_0x6d4e('0x19')](_0x2ff6f0);return _0xb8b79d['set'](_0x6d4e('0x1f'),_0x3c5d07+'-'+_0x214586+'/'+_0x307fa4)['json'](_0x641698);}return null;};}function patchUpdates(_0x4d38a9){return function(_0x4ee128){try{jsonpatch['apply'](_0x4ee128,_0x4d38a9,!![]);}catch(_0x350be0){return BPromise[_0x6d4e('0x20')](_0x350be0);}return _0x4ee128[_0x6d4e('0x21')]();};}function saveUpdates(_0xc7852a,_0x584e43){return function(_0x4462da){if(_0x4462da){return _0x4462da[_0x6d4e('0x22')](_0xc7852a)[_0x6d4e('0x23')](function(_0x309dcc){return _0x309dcc;});}return null;};}function removeEntity(_0x1d6a7b,_0x2683eb){return function(_0x2f8465){if(_0x2f8465){return _0x2f8465[_0x6d4e('0x24')]()['then'](function(){var _0x2c87d9=_0x2f8465[_0x6d4e('0x25')]({'plain':!![]});var _0x280f20='CmContactHasItems';return db[_0x6d4e('0x26')]['destroy']({'where':{'type':_0x280f20,'resourceId':_0x2c87d9['id']}})[_0x6d4e('0x23')](function(){return _0x2f8465;});})[_0x6d4e('0x23')](function(){_0x1d6a7b[_0x6d4e('0x19')](0xcc)[_0x6d4e('0x27')]();});}};}function handleEntityNotFound(_0x1116bb,_0x1231e7){return function(_0x26f429){if(!_0x26f429){_0x1116bb[_0x6d4e('0x18')](0x194);}return _0x26f429;};}function handleError(_0x182d76,_0x1c797e){_0x1c797e=_0x1c797e||0x1f4;return function(_0x4bc443){logger[_0x6d4e('0x28')](_0x4bc443['stack']);if(_0x4bc443['name']){delete _0x4bc443[_0x6d4e('0x29')];}_0x182d76['status'](_0x1c797e)[_0x6d4e('0x2a')](_0x4bc443);};}exports[_0x6d4e('0x2b')]=function(_0xfa882e,_0x52fbed){var _0x41743b={},_0x18b5ea={},_0x59b274={'count':0x0,'rows':[]};var _0x547fa0=_['map'](db[_0x6d4e('0x2c')]['rawAttributes'],function(_0x231ee4){return{'name':_0x231ee4['fieldName'],'type':_0x231ee4[_0x6d4e('0x2d')]['key']};});_0x18b5ea[_0x6d4e('0x2e')]=_[_0x6d4e('0x2f')](_0x547fa0,_0x6d4e('0x29'));_0x18b5ea[_0x6d4e('0x30')]=_[_0x6d4e('0x31')](_0xfa882e[_0x6d4e('0x30')]);_0x18b5ea[_0x6d4e('0x32')]=_[_0x6d4e('0x33')](_0x18b5ea[_0x6d4e('0x2e')],_0x18b5ea[_0x6d4e('0x30')]);_0x41743b[_0x6d4e('0x34')]=_[_0x6d4e('0x33')](_0x18b5ea[_0x6d4e('0x2e')],qs[_0x6d4e('0x35')](_0xfa882e[_0x6d4e('0x30')]['fields']));_0x41743b[_0x6d4e('0x34')]=_0x41743b[_0x6d4e('0x34')][_0x6d4e('0x36')]?_0x41743b['attributes']:_0x18b5ea[_0x6d4e('0x2e')];if(!_0xfa882e[_0x6d4e('0x30')][_0x6d4e('0x37')]('nolimit')){_0x41743b[_0x6d4e('0x1d')]=qs['limit'](_0xfa882e['query']['limit']);_0x41743b[_0x6d4e('0x1b')]=qs['offset'](_0xfa882e[_0x6d4e('0x30')][_0x6d4e('0x1b')]);}_0x41743b['order']=qs[_0x6d4e('0x38')](_0xfa882e[_0x6d4e('0x30')][_0x6d4e('0x38')]);_0x41743b[_0x6d4e('0x39')]=qs['filters'](_[_0x6d4e('0x3a')](_0xfa882e['query'],_0x18b5ea[_0x6d4e('0x32')]),_0x547fa0);if(_0xfa882e['query'][_0x6d4e('0x3b')]){_0x41743b[_0x6d4e('0x39')]=_['merge'](_0x41743b[_0x6d4e('0x39')],{'$or':_[_0x6d4e('0x2f')](_0x547fa0,function(_0x44adb2){if(_0x44adb2[_0x6d4e('0x2d')]!=='VIRTUAL'){var _0xfea985={};_0xfea985[_0x44adb2[_0x6d4e('0x29')]]={'$like':'%'+_0xfa882e[_0x6d4e('0x30')][_0x6d4e('0x3b')]+'%'};return _0xfea985;}})});}_0x41743b=_['merge']({},_0x41743b,_0xfa882e[_0x6d4e('0x3c')]);var _0x35aa65={'where':_0x41743b[_0x6d4e('0x39')]};return db['CmContactHasItem'][_0x6d4e('0x1e')](_0x35aa65)['then'](function(_0x5bdc45){_0x59b274['count']=_0x5bdc45;if(_0xfa882e[_0x6d4e('0x30')][_0x6d4e('0x3d')]){_0x41743b[_0x6d4e('0x3e')]=[{'all':!![]}];}return db[_0x6d4e('0x2c')][_0x6d4e('0x3f')](_0x41743b);})[_0x6d4e('0x23')](function(_0x2ea140){_0x59b274[_0x6d4e('0x40')]=_0x2ea140;return _0x59b274;})[_0x6d4e('0x23')](respondWithFilteredResult(_0x52fbed,_0x41743b))['catch'](handleError(_0x52fbed,null));};exports['show']=function(_0x5d9676,_0x15e6fc){var _0x1846c3={'raw':!![],'where':{'id':_0x5d9676['params']['id']}},_0x521200={};_0x521200[_0x6d4e('0x2e')]=_[_0x6d4e('0x31')](db[_0x6d4e('0x2c')][_0x6d4e('0x41')]);_0x521200[_0x6d4e('0x30')]=_[_0x6d4e('0x31')](_0x5d9676['query']);_0x521200['filters']=_[_0x6d4e('0x33')](_0x521200[_0x6d4e('0x2e')],_0x521200['query']);_0x1846c3[_0x6d4e('0x34')]=_[_0x6d4e('0x33')](_0x521200['model'],qs[_0x6d4e('0x35')](_0x5d9676['query'][_0x6d4e('0x35')]));_0x1846c3[_0x6d4e('0x34')]=_0x1846c3['attributes'][_0x6d4e('0x36')]?_0x1846c3[_0x6d4e('0x34')]:_0x521200['model'];if(_0x5d9676[_0x6d4e('0x30')][_0x6d4e('0x3d')]){_0x1846c3[_0x6d4e('0x3e')]=[{'all':!![]}];}_0x1846c3=_[_0x6d4e('0x42')]({},_0x1846c3,_0x5d9676[_0x6d4e('0x3c')]);return db['CmContactHasItem'][_0x6d4e('0x43')](_0x1846c3)['then'](handleEntityNotFound(_0x15e6fc,null))[_0x6d4e('0x23')](respondWithResult(_0x15e6fc,null))[_0x6d4e('0x44')](handleError(_0x15e6fc,null));};exports['create']=function(_0x2f5b56,_0x4d245e){return db[_0x6d4e('0x2c')]['create'](_0x2f5b56[_0x6d4e('0x45')],{})['then'](function(_0x161eed){var _0x5e1961=_0x2f5b56[_0x6d4e('0x46')][_0x6d4e('0x25')]({'plain':!![]});if(!_0x5e1961)throw new Error(_0x6d4e('0x47'));if(_0x5e1961[_0x6d4e('0x48')]==='user'){var _0x5d8a6f=_0x161eed[_0x6d4e('0x25')]({'plain':!![]});var _0x1d2e16=_0x6d4e('0x49');return db[_0x6d4e('0x4a')]['find']({'where':{'name':_0x1d2e16,'userProfileId':_0x5e1961[_0x6d4e('0x4b')]},'raw':!![]})[_0x6d4e('0x23')](function(_0x2a577a){if(_0x2a577a&&_0x2a577a[_0x6d4e('0x4c')]===0x0){return db[_0x6d4e('0x26')]['create']({'name':_0x5d8a6f['name'],'resourceId':_0x5d8a6f['id'],'type':_0x2a577a[_0x6d4e('0x29')],'sectionId':_0x2a577a['id']},{})[_0x6d4e('0x23')](function(){return _0x161eed;});}else{return _0x161eed;}})[_0x6d4e('0x44')](function(_0x50fa65){logger[_0x6d4e('0x28')](_0x6d4e('0x4d'),_0x50fa65);throw _0x50fa65;});}return _0x161eed;})['then'](respondWithResult(_0x4d245e,0xc9))[_0x6d4e('0x44')](handleError(_0x4d245e,null));};exports[_0x6d4e('0x22')]=function(_0x5b9269,_0x222282){if(_0x5b9269[_0x6d4e('0x45')]['id']){delete _0x5b9269[_0x6d4e('0x45')]['id'];}return db['CmContactHasItem'][_0x6d4e('0x43')]({'where':{'id':_0x5b9269[_0x6d4e('0x4e')]['id']}})[_0x6d4e('0x23')](handleEntityNotFound(_0x222282,null))[_0x6d4e('0x23')](saveUpdates(_0x5b9269[_0x6d4e('0x45')],null))[_0x6d4e('0x23')](respondWithResult(_0x222282,null))[_0x6d4e('0x44')](handleError(_0x222282,null));};exports['destroy']=function(_0x4203b9,_0x43df31){return db['CmContactHasItem'][_0x6d4e('0x43')]({'where':{'id':_0x4203b9[_0x6d4e('0x4e')]['id']}})[_0x6d4e('0x23')](handleEntityNotFound(_0x43df31,null))[_0x6d4e('0x23')](removeEntity(_0x43df31,null))[_0x6d4e('0x44')](handleError(_0x43df31,null));}; \ No newline at end of file +var _0x8a11=['attributes','fields','hasOwnProperty','order','sort','pick','where','merge','VIRTUAL','filter','CmContactHasItem','findAll','rows','show','length','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','update','destroy','then','get','CmContactHasItems','UserProfileResource','error','stack','name','send','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0x8a11,0x163));var _0x18a1=function(_0x9729d7,_0x1b79a8){_0x9729d7=_0x9729d7-0x0;var _0x3c4ac6=_0x8a11[_0x9729d7];return _0x3c4ac6;};'use strict';var emlformat=require(_0x18a1('0x0'));var rimraf=require(_0x18a1('0x1'));var zipdir=require(_0x18a1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x18a1('0x3'));var moment=require('moment');var BPromise=require(_0x18a1('0x4'));var Mustache=require(_0x18a1('0x5'));var util=require('util');var path=require(_0x18a1('0x6'));var sox=require(_0x18a1('0x7'));var csv=require(_0x18a1('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x18a1('0x9'));var _=require(_0x18a1('0xa'));var squel=require(_0x18a1('0xb'));var crypto=require(_0x18a1('0xc'));var jsforce=require(_0x18a1('0xd'));var deskjs=require(_0x18a1('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x18a1('0xf'));var Redis=require(_0x18a1('0x10'));var authService=require(_0x18a1('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x18a1('0x12'));var hardwareService=require(_0x18a1('0x13'));var logger=require(_0x18a1('0x14'))(_0x18a1('0x15'));var utils=require(_0x18a1('0x16'));var config=require(_0x18a1('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x18a1('0x18'))['db'];function respondWithStatusCode(_0x503830,_0x37ada9){_0x37ada9=_0x37ada9||0xcc;return function(_0x3dde6a){if(_0x3dde6a){return _0x503830[_0x18a1('0x19')](_0x37ada9);}return _0x503830[_0x18a1('0x1a')](_0x37ada9)[_0x18a1('0x1b')]();};}function respondWithResult(_0x1172a8,_0x1c8085){_0x1c8085=_0x1c8085||0xc8;return function(_0x4ff4ba){if(_0x4ff4ba){return _0x1172a8[_0x18a1('0x1a')](_0x1c8085)[_0x18a1('0x1c')](_0x4ff4ba);}};}function respondWithFilteredResult(_0x2efc02,_0x4bddb4){return function(_0x8f3b69){if(_0x8f3b69){var _0x553e89=typeof _0x4bddb4[_0x18a1('0x1d')]===_0x18a1('0x1e')&&typeof _0x4bddb4[_0x18a1('0x1f')]===_0x18a1('0x1e');var _0x340615=_0x8f3b69[_0x18a1('0x20')];var _0x541b56=_0x553e89?0x0:_0x4bddb4[_0x18a1('0x1d')];var _0x80fd2f=_0x553e89?_0x8f3b69[_0x18a1('0x20')]:_0x4bddb4[_0x18a1('0x1d')]+_0x4bddb4[_0x18a1('0x1f')];var _0x2179f5;if(_0x80fd2f>=_0x340615){_0x80fd2f=_0x340615;_0x2179f5=0xc8;}else{_0x2179f5=0xce;}_0x2efc02[_0x18a1('0x1a')](_0x2179f5);return _0x2efc02[_0x18a1('0x21')]('Content-Range',_0x541b56+'-'+_0x80fd2f+'/'+_0x340615)[_0x18a1('0x1c')](_0x8f3b69);}return null;};}function patchUpdates(_0xc9e5d8){return function(_0x5b6550){try{jsonpatch['apply'](_0x5b6550,_0xc9e5d8,!![]);}catch(_0x46cb2b){return BPromise[_0x18a1('0x22')](_0x46cb2b);}return _0x5b6550[_0x18a1('0x23')]();};}function saveUpdates(_0x52529b,_0x5a666c){return function(_0x56344e){if(_0x56344e){return _0x56344e[_0x18a1('0x24')](_0x52529b)['then'](function(_0x5e429a){return _0x5e429a;});}return null;};}function removeEntity(_0x11726d,_0x1cdb0c){return function(_0x5f38c4){if(_0x5f38c4){return _0x5f38c4[_0x18a1('0x25')]()[_0x18a1('0x26')](function(){var _0x14488c=_0x5f38c4[_0x18a1('0x27')]({'plain':!![]});var _0x189100=_0x18a1('0x28');return db[_0x18a1('0x29')][_0x18a1('0x25')]({'where':{'type':_0x189100,'resourceId':_0x14488c['id']}})[_0x18a1('0x26')](function(){return _0x5f38c4;});})[_0x18a1('0x26')](function(){_0x11726d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a59b9,_0x24899c){return function(_0x434748){if(!_0x434748){_0x4a59b9[_0x18a1('0x19')](0x194);}return _0x434748;};}function handleError(_0x7274e4,_0x5287f2){_0x5287f2=_0x5287f2||0x1f4;return function(_0x102cbe){logger[_0x18a1('0x2a')](_0x102cbe[_0x18a1('0x2b')]);if(_0x102cbe[_0x18a1('0x2c')]){delete _0x102cbe[_0x18a1('0x2c')];}_0x7274e4[_0x18a1('0x1a')](_0x5287f2)[_0x18a1('0x2d')](_0x102cbe);};}exports['index']=function(_0x1d6a66,_0x421f04){var _0x11baf5={},_0x1ecfba={},_0x4829ec={'count':0x0,'rows':[]};var _0xe0cd04=_[_0x18a1('0x2e')](db['CmContactHasItem'][_0x18a1('0x2f')],function(_0x149de1){return{'name':_0x149de1[_0x18a1('0x30')],'type':_0x149de1[_0x18a1('0x31')]['key']};});_0x1ecfba[_0x18a1('0x32')]=_['map'](_0xe0cd04,_0x18a1('0x2c'));_0x1ecfba[_0x18a1('0x33')]=_[_0x18a1('0x34')](_0x1d6a66[_0x18a1('0x33')]);_0x1ecfba[_0x18a1('0x35')]=_[_0x18a1('0x36')](_0x1ecfba[_0x18a1('0x32')],_0x1ecfba[_0x18a1('0x33')]);_0x11baf5[_0x18a1('0x37')]=_['intersection'](_0x1ecfba[_0x18a1('0x32')],qs[_0x18a1('0x38')](_0x1d6a66[_0x18a1('0x33')][_0x18a1('0x38')]));_0x11baf5[_0x18a1('0x37')]=_0x11baf5['attributes']['length']?_0x11baf5[_0x18a1('0x37')]:_0x1ecfba[_0x18a1('0x32')];if(!_0x1d6a66[_0x18a1('0x33')][_0x18a1('0x39')]('nolimit')){_0x11baf5[_0x18a1('0x1f')]=qs[_0x18a1('0x1f')](_0x1d6a66['query'][_0x18a1('0x1f')]);_0x11baf5[_0x18a1('0x1d')]=qs['offset'](_0x1d6a66[_0x18a1('0x33')][_0x18a1('0x1d')]);}_0x11baf5[_0x18a1('0x3a')]=qs['sort'](_0x1d6a66['query'][_0x18a1('0x3b')]);_0x11baf5['where']=qs[_0x18a1('0x35')](_[_0x18a1('0x3c')](_0x1d6a66['query'],_0x1ecfba[_0x18a1('0x35')]),_0xe0cd04);if(_0x1d6a66[_0x18a1('0x33')]['filter']){_0x11baf5[_0x18a1('0x3d')]=_[_0x18a1('0x3e')](_0x11baf5[_0x18a1('0x3d')],{'$or':_[_0x18a1('0x2e')](_0xe0cd04,function(_0x4e36cc){if(_0x4e36cc[_0x18a1('0x31')]!==_0x18a1('0x3f')){var _0x4bc1a8={};_0x4bc1a8[_0x4e36cc[_0x18a1('0x2c')]]={'$like':'%'+_0x1d6a66[_0x18a1('0x33')][_0x18a1('0x40')]+'%'};return _0x4bc1a8;}})});}_0x11baf5=_['merge']({},_0x11baf5,_0x1d6a66['options']);var _0x17ce0b={'where':_0x11baf5[_0x18a1('0x3d')]};return db[_0x18a1('0x41')][_0x18a1('0x20')](_0x17ce0b)[_0x18a1('0x26')](function(_0x1f0b57){_0x4829ec['count']=_0x1f0b57;if(_0x1d6a66['query']['includeAll']){_0x11baf5['include']=[{'all':!![]}];}return db['CmContactHasItem'][_0x18a1('0x42')](_0x11baf5);})[_0x18a1('0x26')](function(_0xce5adf){_0x4829ec[_0x18a1('0x43')]=_0xce5adf;return _0x4829ec;})[_0x18a1('0x26')](respondWithFilteredResult(_0x421f04,_0x11baf5))['catch'](handleError(_0x421f04,null));};exports[_0x18a1('0x44')]=function(_0x2c80bd,_0x3bf032){var _0x139aeb={'raw':!![],'where':{'id':_0x2c80bd['params']['id']}},_0x196e7b={};_0x196e7b['model']=_[_0x18a1('0x34')](db[_0x18a1('0x41')]['rawAttributes']);_0x196e7b[_0x18a1('0x33')]=_[_0x18a1('0x34')](_0x2c80bd[_0x18a1('0x33')]);_0x196e7b['filters']=_['intersection'](_0x196e7b['model'],_0x196e7b[_0x18a1('0x33')]);_0x139aeb[_0x18a1('0x37')]=_['intersection'](_0x196e7b[_0x18a1('0x32')],qs[_0x18a1('0x38')](_0x2c80bd[_0x18a1('0x33')]['fields']));_0x139aeb[_0x18a1('0x37')]=_0x139aeb[_0x18a1('0x37')][_0x18a1('0x45')]?_0x139aeb[_0x18a1('0x37')]:_0x196e7b[_0x18a1('0x32')];if(_0x2c80bd[_0x18a1('0x33')][_0x18a1('0x46')]){_0x139aeb['include']=[{'all':!![]}];}_0x139aeb=_['merge']({},_0x139aeb,_0x2c80bd['options']);return db[_0x18a1('0x41')][_0x18a1('0x47')](_0x139aeb)[_0x18a1('0x26')](handleEntityNotFound(_0x3bf032,null))[_0x18a1('0x26')](respondWithResult(_0x3bf032,null))['catch'](handleError(_0x3bf032,null));};exports[_0x18a1('0x48')]=function(_0x56ff3e,_0x1a8c83){return db[_0x18a1('0x41')][_0x18a1('0x48')](_0x56ff3e[_0x18a1('0x49')],{})['then'](function(_0x5c8762){var _0x4ac0cb=_0x56ff3e[_0x18a1('0x4a')][_0x18a1('0x27')]({'plain':!![]});if(!_0x4ac0cb)throw new Error(_0x18a1('0x4b'));if(_0x4ac0cb[_0x18a1('0x4c')]===_0x18a1('0x4a')){var _0x3e53ec=_0x5c8762[_0x18a1('0x27')]({'plain':!![]});var _0x6cabf1='CmContactHasItems';return db[_0x18a1('0x4d')][_0x18a1('0x47')]({'where':{'name':_0x6cabf1,'userProfileId':_0x4ac0cb['userProfileId']},'raw':!![]})[_0x18a1('0x26')](function(_0x51a415){if(_0x51a415&&_0x51a415[_0x18a1('0x4e')]===0x0){return db[_0x18a1('0x29')][_0x18a1('0x48')]({'name':_0x3e53ec[_0x18a1('0x2c')],'resourceId':_0x3e53ec['id'],'type':_0x51a415[_0x18a1('0x2c')],'sectionId':_0x51a415['id']},{})['then'](function(){return _0x5c8762;});}else{return _0x5c8762;}})[_0x18a1('0x4f')](function(_0x5cc9b6){logger[_0x18a1('0x2a')](_0x18a1('0x50'),_0x5cc9b6);throw _0x5cc9b6;});}return _0x5c8762;})[_0x18a1('0x26')](respondWithResult(_0x1a8c83,0xc9))[_0x18a1('0x4f')](handleError(_0x1a8c83,null));};exports[_0x18a1('0x24')]=function(_0x3280c9,_0x14e1a6){if(_0x3280c9[_0x18a1('0x49')]['id']){delete _0x3280c9['body']['id'];}return db[_0x18a1('0x41')][_0x18a1('0x47')]({'where':{'id':_0x3280c9[_0x18a1('0x51')]['id']}})[_0x18a1('0x26')](handleEntityNotFound(_0x14e1a6,null))[_0x18a1('0x26')](saveUpdates(_0x3280c9['body'],null))['then'](respondWithResult(_0x14e1a6,null))[_0x18a1('0x4f')](handleError(_0x14e1a6,null));};exports['destroy']=function(_0xb05bc2,_0x10eca2){return db[_0x18a1('0x41')][_0x18a1('0x47')]({'where':{'id':_0xb05bc2[_0x18a1('0x51')]['id']}})[_0x18a1('0x26')](handleEntityNotFound(_0x10eca2,null))[_0x18a1('0x26')](removeEntity(_0x10eca2,null))['catch'](handleError(_0x10eca2,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index d8493fa..981a345 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 _0x7e27=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./cmContactHasItem.attributes','define','lodash'];(function(_0x3a3d74,_0x501d5a){var _0x89f623=function(_0x39c50e){while(--_0x39c50e){_0x3a3d74['push'](_0x3a3d74['shift']());}};_0x89f623(++_0x501d5a);}(_0x7e27,0x1f3));var _0x77e2=function(_0x4d6d69,_0x192c35){_0x4d6d69=_0x4d6d69-0x0;var _0xcaf914=_0x7e27[_0x4d6d69];return _0xcaf914;};'use strict';var _=require(_0x77e2('0x0'));var util=require('util');var logger=require(_0x77e2('0x1'))(_0x77e2('0x2'));var moment=require(_0x77e2('0x3'));var BPromise=require('bluebird');var rp=require(_0x77e2('0x4'));var fs=require('fs');var path=require(_0x77e2('0x5'));var rimraf=require(_0x77e2('0x6'));var config=require(_0x77e2('0x7'));var attributes=require(_0x77e2('0x8'));module['exports']=function(_0x4b2558,_0x21d8e4){return _0x4b2558[_0x77e2('0x9')]('CmContactHasItem',attributes,{'tableName':'cm_contact_has_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x958a=['rimraf','../../config/environment','define','CmContactHasItem','cm_contact_has_items','lodash','util','moment','bluebird','request-promise','path'];(function(_0x3008ba,_0x31eb74){var _0x213537=function(_0x1210c1){while(--_0x1210c1){_0x3008ba['push'](_0x3008ba['shift']());}};_0x213537(++_0x31eb74);}(_0x958a,0x144));var _0xa958=function(_0x1d9dc1,_0x52bdaa){_0x1d9dc1=_0x1d9dc1-0x0;var _0x42f69c=_0x958a[_0x1d9dc1];return _0x42f69c;};'use strict';var _=require(_0xa958('0x0'));var util=require(_0xa958('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xa958('0x2'));var BPromise=require(_0xa958('0x3'));var rp=require(_0xa958('0x4'));var fs=require('fs');var path=require(_0xa958('0x5'));var rimraf=require(_0xa958('0x6'));var config=require(_0xa958('0x7'));var attributes=require('./cmContactHasItem.attributes');module['exports']=function(_0x4f0403,_0x492c28){return _0x4f0403[_0xa958('0x8')](_0xa958('0x9'),attributes,{'tableName':_0xa958('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.rpc.js b/server/api/cmContactHasItem/cmContactHasItem.rpc.js index 1d7383a..2664d1e 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 _0x1bfb=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../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','code','message','catch','util','randomstring'];(function(_0x250c3d,_0x4d6a6e){var _0x5de2ec=function(_0x55dc28){while(--_0x55dc28){_0x250c3d['push'](_0x250c3d['shift']());}};_0x5de2ec(++_0x4d6a6e);}(_0x1bfb,0xe4));var _0xb1bf=function(_0x54d49e,_0x5d9911){_0x54d49e=_0x54d49e-0x0;var _0x4af0f1=_0x1bfb[_0x54d49e];return _0x4af0f1;};'use strict';var _=require('lodash');var util=require(_0xb1bf('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb1bf('0x1'));var fs=require('fs');var Redis=require(_0xb1bf('0x2'));var db=require(_0xb1bf('0x3'))['db'];var utils=require(_0xb1bf('0x4'));var logger=require(_0xb1bf('0x5'))(_0xb1bf('0x6'));var config=require(_0xb1bf('0x7'));var jayson=require(_0xb1bf('0x8'));var client=jayson[_0xb1bf('0x9')][_0xb1bf('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x10548f,_0x4d131f,_0x1d625e){return new BPromise(function(_0x36d16f,_0x378709){return client[_0xb1bf('0xb')](_0x10548f,_0x1d625e)[_0xb1bf('0xc')](function(_0x235a76){logger[_0xb1bf('0xd')](_0xb1bf('0xe'),_0x4d131f,_0xb1bf('0xf'));logger[_0xb1bf('0x10')](_0xb1bf('0x11'),_0x4d131f,_0xb1bf('0xf'),JSON[_0xb1bf('0x12')](_0x235a76));if(_0x235a76[_0xb1bf('0x13')]){if(_0x235a76[_0xb1bf('0x13')][_0xb1bf('0x14')]===0x1f4){logger[_0xb1bf('0x13')](_0xb1bf('0xe'),_0x4d131f,_0x235a76[_0xb1bf('0x13')][_0xb1bf('0x15')]);return _0x378709(_0x235a76['error'][_0xb1bf('0x15')]);}logger['error']('CmContactHasItem,\x20%s,\x20%s',_0x4d131f,_0x235a76[_0xb1bf('0x13')][_0xb1bf('0x15')]);return _0x36d16f(_0x235a76[_0xb1bf('0x13')][_0xb1bf('0x15')]);}else{logger[_0xb1bf('0xd')](_0xb1bf('0xe'),_0x4d131f,'request\x20sent');_0x36d16f(_0x235a76['result']['message']);}})[_0xb1bf('0x16')](function(_0x2df1e4){logger[_0xb1bf('0x13')](_0xb1bf('0xe'),_0x4d131f,_0x2df1e4);_0x378709(_0x2df1e4);});});} \ No newline at end of file +var _0x6301=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','code','CmContactHasItem,\x20%s,\x20%s','message','error','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x5b02f2,_0x50c550){var _0x2e6c85=function(_0x2f23bc){while(--_0x2f23bc){_0x5b02f2['push'](_0x5b02f2['shift']());}};_0x2e6c85(++_0x50c550);}(_0x6301,0x1aa));var _0x1630=function(_0x1c8567,_0x5180c6){_0x1c8567=_0x1c8567-0x0;var _0x5309fd=_0x6301[_0x1c8567];return _0x5309fd;};'use strict';var _=require(_0x1630('0x0'));var util=require(_0x1630('0x1'));var moment=require(_0x1630('0x2'));var BPromise=require('bluebird');var rs=require(_0x1630('0x3'));var fs=require('fs');var Redis=require(_0x1630('0x4'));var db=require(_0x1630('0x5'))['db'];var utils=require(_0x1630('0x6'));var logger=require(_0x1630('0x7'))(_0x1630('0x8'));var config=require(_0x1630('0x9'));var jayson=require(_0x1630('0xa'));var client=jayson[_0x1630('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x534d9e,_0x33f879,_0x57bcab){return new BPromise(function(_0x5c7ac1,_0x31f831){return client[_0x1630('0xc')](_0x534d9e,_0x57bcab)[_0x1630('0xd')](function(_0x487662){logger[_0x1630('0xe')]('CmContactHasItem,\x20%s,\x20%s',_0x33f879,_0x1630('0xf'));logger[_0x1630('0x10')](_0x1630('0x11'),_0x33f879,'request\x20sent',JSON[_0x1630('0x12')](_0x487662));if(_0x487662['error']){if(_0x487662['error'][_0x1630('0x13')]===0x1f4){logger['error'](_0x1630('0x14'),_0x33f879,_0x487662['error'][_0x1630('0x15')]);return _0x31f831(_0x487662[_0x1630('0x16')][_0x1630('0x15')]);}logger[_0x1630('0x16')](_0x1630('0x14'),_0x33f879,_0x487662[_0x1630('0x16')][_0x1630('0x15')]);return _0x5c7ac1(_0x487662[_0x1630('0x16')]['message']);}else{logger[_0x1630('0xe')]('CmContactHasItem,\x20%s,\x20%s',_0x33f879,'request\x20sent');_0x5c7ac1(_0x487662['result'][_0x1630('0x15')]);}})[_0x1630('0x17')](function(_0x2cbcd2){logger[_0x1630('0x16')](_0x1630('0x14'),_0x33f879,_0x2cbcd2);_0x31f831(_0x2cbcd2);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index fe26477..9e0453e 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 _0xb08f=['/:id','isAuthenticated','show','create','put','update','delete','destroy','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller','index','get'];(function(_0x26faab,_0x3a15be){var _0x18bac1=function(_0x2ce4d9){while(--_0x2ce4d9){_0x26faab['push'](_0x26faab['shift']());}};_0x18bac1(++_0x3a15be);}(_0xb08f,0x125));var _0xfb08=function(_0x2cfb16,_0x2300f9){_0x2cfb16=_0x2cfb16-0x0;var _0x410157=_0xb08f[_0x2cfb16];return _0x410157;};'use strict';var multer=require('multer');var util=require(_0xfb08('0x0'));var path=require(_0xfb08('0x1'));var timeout=require(_0xfb08('0x2'));var express=require(_0xfb08('0x3'));var router=express['Router']();var fs_extra=require(_0xfb08('0x4'));var auth=require(_0xfb08('0x5'));var interaction=require(_0xfb08('0x6'));var config=require(_0xfb08('0x7'));var controller=require(_0xfb08('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xfb08('0x9')]);router[_0xfb08('0xa')](_0xfb08('0xb'),auth[_0xfb08('0xc')](),controller[_0xfb08('0xd')]);router['post']('/',auth[_0xfb08('0xc')](),controller[_0xfb08('0xe')]);router[_0xfb08('0xf')](_0xfb08('0xb'),auth[_0xfb08('0xc')](),controller[_0xfb08('0x10')]);router[_0xfb08('0x11')](_0xfb08('0xb'),auth['isAuthenticated'](),controller[_0xfb08('0x12')]);module['exports']=router; \ No newline at end of file +var _0x65b0=['/:id','post','create','put','update','delete','destroy','exports','util','path','express','Router','../../components/interaction/service','./cmContactHasItem.controller','get','isAuthenticated','index'];(function(_0x3410a9,_0x8ab806){var _0x95512b=function(_0x5e45b6){while(--_0x5e45b6){_0x3410a9['push'](_0x3410a9['shift']());}};_0x95512b(++_0x8ab806);}(_0x65b0,0x18f));var _0x065b=function(_0x2ad5cb,_0x450f8c){_0x2ad5cb=_0x2ad5cb-0x0;var _0x68afbc=_0x65b0[_0x2ad5cb];return _0x68afbc;};'use strict';var multer=require('multer');var util=require(_0x065b('0x0'));var path=require(_0x065b('0x1'));var timeout=require('connect-timeout');var express=require(_0x065b('0x2'));var router=express[_0x065b('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x065b('0x4'));var config=require('../../config/environment');var controller=require(_0x065b('0x5'));router[_0x065b('0x6')]('/',auth[_0x065b('0x7')](),controller[_0x065b('0x8')]);router['get'](_0x065b('0x9'),auth[_0x065b('0x7')](),controller['show']);router[_0x065b('0xa')]('/',auth['isAuthenticated'](),controller[_0x065b('0xb')]);router[_0x065b('0xc')](_0x065b('0x9'),auth[_0x065b('0x7')](),controller[_0x065b('0xd')]);router[_0x065b('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x065b('0xf')]);module[_0x065b('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 4d6f644..d1b9d19 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 _0xeba3=['STRING','TEXT','long','select','parse','values','isArray','setDataValue','stringify','BOOLEAN','ENUM','voice','lodash','VIRTUAL','alias','name'];(function(_0x213a5f,_0x49165a){var _0x309a56=function(_0x2447c3){while(--_0x2447c3){_0x213a5f['push'](_0x213a5f['shift']());}};_0x309a56(++_0x49165a);}(_0xeba3,0xfc));var _0x3eba=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xeba3[_0x297fd3];return _0x2af381;};'use strict';var Sequelize=require('sequelize');var _=require(_0x3eba('0x0'));module['exports']={'name':{'type':Sequelize[_0x3eba('0x1')],'get':function(_0x2b8f1e){return this['getDataValue'](_0x3eba('0x2'));}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0xf1276e){this['setDataValue'](_0x3eba('0x2'),_0xf1276e?_0xf1276e:this['getDataValue'](_0x3eba('0x3')));}},'type':{'type':Sequelize[_0x3eba('0x4')],'allowNull':![]},'values':{'type':Sequelize[_0x3eba('0x5')](_0x3eba('0x6')),'get':function(){if(this['getDataValue']('type')===_0x3eba('0x7')){return JSON[_0x3eba('0x8')](this['getDataValue'](_0x3eba('0x9')));}else{return this['getDataValue'](_0x3eba('0x9'));}},'set':function(_0x339ff7){if(Array[_0x3eba('0xa')](_0x339ff7)){this[_0x3eba('0xb')]('values',JSON[_0x3eba('0xc')](_0x339ff7));}else{this[_0x3eba('0xb')](_0x3eba('0x9'),_0x339ff7);}}},'required':{'type':Sequelize[_0x3eba('0xd')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x3eba('0xd')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x3eba('0xe')](_0x3eba('0xf'))}}; \ No newline at end of file +var _0xa5fa=['type','parse','values','isArray','stringify','BOOLEAN','voice','exports','getDataValue','alias','STRING','setDataValue','long'];(function(_0x29411b,_0x29fe3d){var _0x14afde=function(_0x28c831){while(--_0x28c831){_0x29411b['push'](_0x29411b['shift']());}};_0x14afde(++_0x29fe3d);}(_0xa5fa,0x10b));var _0xaa5f=function(_0x3124f8,_0x1a8b23){_0x3124f8=_0x3124f8-0x0;var _0x5bab5f=_0xa5fa[_0x3124f8];return _0x5bab5f;};'use strict';var Sequelize=require('sequelize');var _=require('lodash');module[_0xaa5f('0x0')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x341e83){return this[_0xaa5f('0x1')](_0xaa5f('0x2'));}},'alias':{'type':Sequelize[_0xaa5f('0x3')],'allowNull':![],'set':function(_0x2ecfe9){this[_0xaa5f('0x4')]('alias',_0x2ecfe9?_0x2ecfe9:this[_0xaa5f('0x1')]('name'));}},'type':{'type':Sequelize[_0xaa5f('0x3')],'allowNull':![]},'values':{'type':Sequelize['TEXT'](_0xaa5f('0x5')),'get':function(){if(this[_0xaa5f('0x1')](_0xaa5f('0x6'))==='select'){return JSON[_0xaa5f('0x7')](this[_0xaa5f('0x1')](_0xaa5f('0x8')));}else{return this[_0xaa5f('0x1')](_0xaa5f('0x8'));}},'set':function(_0x2f850b){if(Array[_0xaa5f('0x9')](_0x2f850b)){this[_0xaa5f('0x4')]('values',JSON[_0xaa5f('0xa')](_0x2f850b));}else{this['setDataValue'](_0xaa5f('0x8'),_0x2f850b);}}},'required':{'type':Sequelize[_0xaa5f('0xb')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xaa5f('0xb')],'defaultValue':![]},'actionType':{'type':Sequelize['ENUM'](_0xaa5f('0xc'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 934fdbd..37ae609 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 _0xe34e=['../../mysqldb','status','end','json','offset','limit','undefined','set','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','CmCustomField','count','rows','catch','show','params','includeAll','options','find','body','create','sequelize','transaction','Sequelize','TEXT','text','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','format','cf_%d','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment'];(function(_0x509f3f,_0xe29188){var _0x94a860=function(_0x1ae2e4){while(--_0x1ae2e4){_0x509f3f['push'](_0x509f3f['shift']());}};_0x94a860(++_0xe29188);}(_0xe34e,0x1db));var _0xee34=function(_0x1c45ad,_0xc9352c){_0x1c45ad=_0x1c45ad-0x0;var _0x3b20f8=_0xe34e[_0x1c45ad];return _0x3b20f8;};'use strict';var emlformat=require(_0xee34('0x0'));var rimraf=require(_0xee34('0x1'));var zipdir=require(_0xee34('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xee34('0x3'));var moment=require(_0xee34('0x4'));var BPromise=require(_0xee34('0x5'));var Mustache=require('mustache');var util=require(_0xee34('0x6'));var path=require(_0xee34('0x7'));var sox=require(_0xee34('0x8'));var csv=require(_0xee34('0x9'));var ejs=require(_0xee34('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xee34('0xb'));var squel=require(_0xee34('0xc'));var crypto=require(_0xee34('0xd'));var jsforce=require(_0xee34('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xee34('0x9'));var querystring=require(_0xee34('0xf'));var Papa=require('papaparse');var Redis=require(_0xee34('0x10'));var authService=require(_0xee34('0x11'));var qs=require(_0xee34('0x12'));var as=require(_0xee34('0x13'));var hardwareService=require(_0xee34('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xee34('0x15'));var config=require(_0xee34('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xee34('0x17'))['db'];function respondWithStatusCode(_0x45a895,_0x2c4498){_0x2c4498=_0x2c4498||0xcc;return function(_0x53d5a4){if(_0x53d5a4){return _0x45a895['sendStatus'](_0x2c4498);}return _0x45a895[_0xee34('0x18')](_0x2c4498)[_0xee34('0x19')]();};}function respondWithResult(_0x151ad9,_0x57f6a0){_0x57f6a0=_0x57f6a0||0xc8;return function(_0x175440){if(_0x175440){return _0x151ad9[_0xee34('0x18')](_0x57f6a0)[_0xee34('0x1a')](_0x175440);}};}function respondWithFilteredResult(_0x68540b,_0x534608){return function(_0x209fb6){if(_0x209fb6){var _0x1671d2=typeof _0x534608[_0xee34('0x1b')]==='undefined'&&typeof _0x534608[_0xee34('0x1c')]===_0xee34('0x1d');var _0x5d6dab=_0x209fb6['count'];var _0x425d1c=_0x1671d2?0x0:_0x534608[_0xee34('0x1b')];var _0x3434dc=_0x1671d2?_0x209fb6['count']:_0x534608[_0xee34('0x1b')]+_0x534608['limit'];var _0x1ceac5;if(_0x3434dc>=_0x5d6dab){_0x3434dc=_0x5d6dab;_0x1ceac5=0xc8;}else{_0x1ceac5=0xce;}_0x68540b[_0xee34('0x18')](_0x1ceac5);return _0x68540b[_0xee34('0x1e')]('Content-Range',_0x425d1c+'-'+_0x3434dc+'/'+_0x5d6dab)[_0xee34('0x1a')](_0x209fb6);}return null;};}function patchUpdates(_0x5032cc){return function(_0x3d307c){try{jsonpatch['apply'](_0x3d307c,_0x5032cc,!![]);}catch(_0x30103a){return BPromise['reject'](_0x30103a);}return _0x3d307c[_0xee34('0x1f')]();};}function saveUpdates(_0x3185f9,_0x341312){return function(_0x504fcc){if(_0x504fcc){return _0x504fcc[_0xee34('0x20')](_0x3185f9)[_0xee34('0x21')](function(_0x466a7e){return _0x466a7e;});}return null;};}function removeEntity(_0x35ee50,_0x41054c){return function(_0x38a19a){if(_0x38a19a){return _0x38a19a[_0xee34('0x22')]()[_0xee34('0x21')](function(){_0x35ee50[_0xee34('0x18')](0xcc)[_0xee34('0x19')]();});}};}function handleEntityNotFound(_0x29c322,_0x472b7e){return function(_0x413cb4){if(!_0x413cb4){_0x29c322['sendStatus'](0x194);}return _0x413cb4;};}function handleError(_0x43ceba,_0x10f017){_0x10f017=_0x10f017||0x1f4;return function(_0x34d041){logger['error'](_0x34d041[_0xee34('0x23')]);if(_0x34d041['name']){delete _0x34d041[_0xee34('0x24')];}_0x43ceba[_0xee34('0x18')](_0x10f017)[_0xee34('0x25')](_0x34d041);};}exports[_0xee34('0x26')]=function(_0x468d39,_0x3ae89){var _0x2854e9={},_0xbc40bd={},_0xb8b5c1={'count':0x0,'rows':[]};var _0x1c9ce9=_[_0xee34('0x27')](db['CmCustomField'][_0xee34('0x28')],function(_0x53205d){return{'name':_0x53205d[_0xee34('0x29')],'type':_0x53205d[_0xee34('0x2a')]['key']};});_0xbc40bd[_0xee34('0x2b')]=_['differenceBy'](_['map'](_0x1c9ce9,_0xee34('0x24')),[_0xee34('0x24')]);_0xbc40bd[_0xee34('0x2c')]=_[_0xee34('0x2d')](_0x468d39[_0xee34('0x2c')]);_0xbc40bd[_0xee34('0x2e')]=_['intersection'](_0xbc40bd['model'],_0xbc40bd[_0xee34('0x2c')]);_0x2854e9[_0xee34('0x2f')]=_[_0xee34('0x30')](_0xbc40bd[_0xee34('0x2b')],qs[_0xee34('0x31')](_0x468d39[_0xee34('0x2c')][_0xee34('0x31')]));_0x2854e9[_0xee34('0x2f')]=_0x2854e9[_0xee34('0x2f')][_0xee34('0x32')]?_0x2854e9[_0xee34('0x2f')]:_0xbc40bd[_0xee34('0x2b')];if(!_0x468d39[_0xee34('0x2c')][_0xee34('0x33')](_0xee34('0x34'))){_0x2854e9[_0xee34('0x1c')]=qs['limit'](_0x468d39[_0xee34('0x2c')][_0xee34('0x1c')]);_0x2854e9['offset']=qs[_0xee34('0x1b')](_0x468d39['query'][_0xee34('0x1b')]);}_0x2854e9[_0xee34('0x35')]=qs[_0xee34('0x36')](_0x468d39[_0xee34('0x2c')]['sort']);_0x2854e9[_0xee34('0x37')]=qs[_0xee34('0x2e')](_[_0xee34('0x38')](_0x468d39[_0xee34('0x2c')],_0xbc40bd[_0xee34('0x2e')]),_0x1c9ce9);if(_0x468d39[_0xee34('0x2c')][_0xee34('0x39')]){_0x2854e9[_0xee34('0x37')]=_['merge'](_0x2854e9[_0xee34('0x37')],{'$or':_[_0xee34('0x27')](_0x1c9ce9,function(_0x4c0096){if(_0x4c0096[_0xee34('0x2a')]!==_0xee34('0x3a')){var _0x13d442={};_0x13d442[_0x4c0096['name']]={'$like':'%'+_0x468d39[_0xee34('0x2c')][_0xee34('0x39')]+'%'};return _0x13d442;}})});}_0x2854e9=_[_0xee34('0x3b')]({},_0x2854e9,_0x468d39['options']);var _0x1f25de={'where':_0x2854e9[_0xee34('0x37')]};return db[_0xee34('0x3c')][_0xee34('0x3d')](_0x1f25de)[_0xee34('0x21')](function(_0x30b26d){_0xb8b5c1[_0xee34('0x3d')]=_0x30b26d;if(_0x468d39[_0xee34('0x2c')]['includeAll']){_0x2854e9['include']=[{'all':!![]}];}return db[_0xee34('0x3c')]['findAll'](_0x2854e9);})[_0xee34('0x21')](function(_0x18c73b){_0xb8b5c1[_0xee34('0x3e')]=_0x18c73b;return _0xb8b5c1;})['then'](respondWithFilteredResult(_0x3ae89,_0x2854e9))[_0xee34('0x3f')](handleError(_0x3ae89,null));};exports[_0xee34('0x40')]=function(_0xa6ab12,_0x275693){var _0x5ada40={'raw':!![],'where':{'id':_0xa6ab12[_0xee34('0x41')]['id']}},_0x2bdb2b={};_0x2bdb2b[_0xee34('0x2b')]=_[_0xee34('0x2d')](db[_0xee34('0x3c')][_0xee34('0x28')]);_0x2bdb2b[_0xee34('0x2c')]=_['keys'](_0xa6ab12['query']);_0x2bdb2b[_0xee34('0x2e')]=_[_0xee34('0x30')](_0x2bdb2b[_0xee34('0x2b')],_0x2bdb2b[_0xee34('0x2c')]);_0x5ada40[_0xee34('0x2f')]=_['intersection'](_0x2bdb2b[_0xee34('0x2b')],qs['fields'](_0xa6ab12[_0xee34('0x2c')][_0xee34('0x31')]));_0x5ada40['attributes']=_0x5ada40[_0xee34('0x2f')]['length']?_0x5ada40['attributes']:_0x2bdb2b[_0xee34('0x2b')];if(_0xa6ab12[_0xee34('0x2c')][_0xee34('0x42')]){_0x5ada40['include']=[{'all':!![]}];}_0x5ada40=_[_0xee34('0x3b')]({},_0x5ada40,_0xa6ab12[_0xee34('0x43')]);return db['CmCustomField'][_0xee34('0x44')](_0x5ada40)['then'](handleEntityNotFound(_0x275693,null))[_0xee34('0x21')](respondWithResult(_0x275693,null))[_0xee34('0x3f')](handleError(_0x275693,null));};exports['update']=function(_0x4d507b,_0x5f01f5){if(_0x4d507b[_0xee34('0x45')]['id']){delete _0x4d507b[_0xee34('0x45')]['id'];}return db[_0xee34('0x3c')][_0xee34('0x44')]({'where':{'id':_0x4d507b[_0xee34('0x41')]['id']}})[_0xee34('0x21')](handleEntityNotFound(_0x5f01f5,null))[_0xee34('0x21')](saveUpdates(_0x4d507b['body'],null))[_0xee34('0x21')](respondWithResult(_0x5f01f5,null))['catch'](handleError(_0x5f01f5,null));};exports['destroy']=function(_0x139e8d,_0x58a842){return db['CmCustomField'][_0xee34('0x44')]({'where':{'id':_0x139e8d['params']['id']}})[_0xee34('0x21')](handleEntityNotFound(_0x58a842,null))[_0xee34('0x21')](removeEntity(_0x58a842,null))[_0xee34('0x3f')](handleError(_0x58a842,null));};exports[_0xee34('0x46')]=function(_0x522f73,_0x2ca6ff){var _0x267d36;return db[_0xee34('0x47')][_0xee34('0x48')](function(_0x3eb693){return db['CmCustomField']['create'](_0x522f73[_0xee34('0x45')],{'transaction':_0x3eb693})['then'](function(_0x49107f){_0x267d36=_0x49107f;var _0x18c4e4={'type':db[_0xee34('0x49')][_0xee34('0x4a')],'transaction':_0x3eb693};switch(_0x522f73[_0xee34('0x45')]['type']){case _0xee34('0x4b'):_0x18c4e4[_0xee34('0x2a')]=db[_0xee34('0x49')][_0xee34('0x4a')];break;case'number':_0x18c4e4[_0xee34('0x2a')]=db[_0xee34('0x49')]['INTEGER'];break;case'switch':_0x18c4e4['type']=db['Sequelize'][_0xee34('0x4c')];_0x18c4e4[_0xee34('0x4d')]=![];break;default:}return db[_0xee34('0x47')][_0xee34('0x4e')][_0xee34('0x4f')](_0xee34('0x50'),util[_0xee34('0x51')](_0xee34('0x52'),_0x267d36['id']),_0x18c4e4);})[_0xee34('0x21')](function(){return _0x267d36;});})['then'](respondWithResult(_0x2ca6ff,0xc9))['catch'](handleError(_0x2ca6ff,null));}; \ No newline at end of file +var _0xc7f4=['VIRTUAL','options','includeAll','include','catch','show','params','find','body','create','sequelize','transaction','Sequelize','TEXT','text','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','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','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','Content-Range','save','then','error','stack','name','map','CmCustomField','rawAttributes','fieldName','type','key','model','differenceBy','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','filter','where','merge'];(function(_0xfc4e4c,_0x17ff55){var _0x3dd89e=function(_0x5dd51d){while(--_0x5dd51d){_0xfc4e4c['push'](_0xfc4e4c['shift']());}};_0x3dd89e(++_0x17ff55);}(_0xc7f4,0x10e));var _0x4c7f=function(_0x252765,_0x101135){_0x252765=_0x252765-0x0;var _0x138e2a=_0xc7f4[_0x252765];return _0x138e2a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4c7f('0x0'));var jsonpatch=require(_0x4c7f('0x1'));var rp=require(_0x4c7f('0x2'));var moment=require('moment');var BPromise=require(_0x4c7f('0x3'));var Mustache=require(_0x4c7f('0x4'));var util=require('util');var path=require('path');var sox=require(_0x4c7f('0x5'));var csv=require(_0x4c7f('0x6'));var ejs=require(_0x4c7f('0x7'));var fs=require('fs');var fs_extra=require(_0x4c7f('0x8'));var _=require('lodash');var squel=require(_0x4c7f('0x9'));var crypto=require(_0x4c7f('0xa'));var jsforce=require(_0x4c7f('0xb'));var deskjs=require(_0x4c7f('0xc'));var toCsv=require(_0x4c7f('0x6'));var querystring=require(_0x4c7f('0xd'));var Papa=require(_0x4c7f('0xe'));var Redis=require(_0x4c7f('0xf'));var authService=require(_0x4c7f('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x4c7f('0x11'));var hardwareService=require(_0x4c7f('0x12'));var logger=require(_0x4c7f('0x13'))(_0x4c7f('0x14'));var utils=require(_0x4c7f('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x4c7f('0x16'));var db=require(_0x4c7f('0x17'))['db'];function respondWithStatusCode(_0x39a4ee,_0xe441af){_0xe441af=_0xe441af||0xcc;return function(_0x53aa68){if(_0x53aa68){return _0x39a4ee[_0x4c7f('0x18')](_0xe441af);}return _0x39a4ee[_0x4c7f('0x19')](_0xe441af)[_0x4c7f('0x1a')]();};}function respondWithResult(_0x5ca578,_0x5cf1d8){_0x5cf1d8=_0x5cf1d8||0xc8;return function(_0x1c20a4){if(_0x1c20a4){return _0x5ca578[_0x4c7f('0x19')](_0x5cf1d8)[_0x4c7f('0x1b')](_0x1c20a4);}};}function respondWithFilteredResult(_0x44287f,_0x119784){return function(_0x2cf3d2){if(_0x2cf3d2){var _0x5abbdb=typeof _0x119784['offset']==='undefined'&&typeof _0x119784['limit']===_0x4c7f('0x1c');var _0xe9ce2d=_0x2cf3d2[_0x4c7f('0x1d')];var _0x481061=_0x5abbdb?0x0:_0x119784[_0x4c7f('0x1e')];var _0x353436=_0x5abbdb?_0x2cf3d2[_0x4c7f('0x1d')]:_0x119784[_0x4c7f('0x1e')]+_0x119784[_0x4c7f('0x1f')];var _0x3bb719;if(_0x353436>=_0xe9ce2d){_0x353436=_0xe9ce2d;_0x3bb719=0xc8;}else{_0x3bb719=0xce;}_0x44287f[_0x4c7f('0x19')](_0x3bb719);return _0x44287f['set'](_0x4c7f('0x20'),_0x481061+'-'+_0x353436+'/'+_0xe9ce2d)[_0x4c7f('0x1b')](_0x2cf3d2);}return null;};}function patchUpdates(_0x5d5965){return function(_0x52058a){try{jsonpatch['apply'](_0x52058a,_0x5d5965,!![]);}catch(_0x61fb58){return BPromise['reject'](_0x61fb58);}return _0x52058a[_0x4c7f('0x21')]();};}function saveUpdates(_0x3bb6f4,_0x13c458){return function(_0x4de074){if(_0x4de074){return _0x4de074['update'](_0x3bb6f4)[_0x4c7f('0x22')](function(_0xe41f0b){return _0xe41f0b;});}return null;};}function removeEntity(_0x242ebf,_0x53dd7e){return function(_0x2ed65d){if(_0x2ed65d){return _0x2ed65d['destroy']()[_0x4c7f('0x22')](function(){_0x242ebf['status'](0xcc)[_0x4c7f('0x1a')]();});}};}function handleEntityNotFound(_0x2608a9,_0x4a5a66){return function(_0x1b07b2){if(!_0x1b07b2){_0x2608a9[_0x4c7f('0x18')](0x194);}return _0x1b07b2;};}function handleError(_0x26ce0f,_0x544fdd){_0x544fdd=_0x544fdd||0x1f4;return function(_0x1172e8){logger[_0x4c7f('0x23')](_0x1172e8[_0x4c7f('0x24')]);if(_0x1172e8[_0x4c7f('0x25')]){delete _0x1172e8[_0x4c7f('0x25')];}_0x26ce0f[_0x4c7f('0x19')](_0x544fdd)['send'](_0x1172e8);};}exports['index']=function(_0x31f5c7,_0x4974fd){var _0x3c4090={},_0x316e2e={},_0x2a5727={'count':0x0,'rows':[]};var _0x1bb76a=_[_0x4c7f('0x26')](db[_0x4c7f('0x27')][_0x4c7f('0x28')],function(_0x1b267e){return{'name':_0x1b267e[_0x4c7f('0x29')],'type':_0x1b267e[_0x4c7f('0x2a')][_0x4c7f('0x2b')]};});_0x316e2e[_0x4c7f('0x2c')]=_[_0x4c7f('0x2d')](_[_0x4c7f('0x26')](_0x1bb76a,'name'),[_0x4c7f('0x25')]);_0x316e2e['query']=_[_0x4c7f('0x2e')](_0x31f5c7[_0x4c7f('0x2f')]);_0x316e2e[_0x4c7f('0x30')]=_[_0x4c7f('0x31')](_0x316e2e['model'],_0x316e2e['query']);_0x3c4090['attributes']=_[_0x4c7f('0x31')](_0x316e2e['model'],qs[_0x4c7f('0x32')](_0x31f5c7['query'][_0x4c7f('0x32')]));_0x3c4090[_0x4c7f('0x33')]=_0x3c4090[_0x4c7f('0x33')]['length']?_0x3c4090[_0x4c7f('0x33')]:_0x316e2e[_0x4c7f('0x2c')];if(!_0x31f5c7[_0x4c7f('0x2f')][_0x4c7f('0x34')](_0x4c7f('0x35'))){_0x3c4090['limit']=qs[_0x4c7f('0x1f')](_0x31f5c7[_0x4c7f('0x2f')][_0x4c7f('0x1f')]);_0x3c4090[_0x4c7f('0x1e')]=qs[_0x4c7f('0x1e')](_0x31f5c7['query']['offset']);}_0x3c4090['order']=qs[_0x4c7f('0x36')](_0x31f5c7[_0x4c7f('0x2f')]['sort']);_0x3c4090['where']=qs[_0x4c7f('0x30')](_['pick'](_0x31f5c7[_0x4c7f('0x2f')],_0x316e2e['filters']),_0x1bb76a);if(_0x31f5c7[_0x4c7f('0x2f')][_0x4c7f('0x37')]){_0x3c4090[_0x4c7f('0x38')]=_[_0x4c7f('0x39')](_0x3c4090[_0x4c7f('0x38')],{'$or':_['map'](_0x1bb76a,function(_0x320fb1){if(_0x320fb1[_0x4c7f('0x2a')]!==_0x4c7f('0x3a')){var _0x31693a={};_0x31693a[_0x320fb1[_0x4c7f('0x25')]]={'$like':'%'+_0x31f5c7[_0x4c7f('0x2f')]['filter']+'%'};return _0x31693a;}})});}_0x3c4090=_[_0x4c7f('0x39')]({},_0x3c4090,_0x31f5c7[_0x4c7f('0x3b')]);var _0x2bc547={'where':_0x3c4090[_0x4c7f('0x38')]};return db[_0x4c7f('0x27')][_0x4c7f('0x1d')](_0x2bc547)[_0x4c7f('0x22')](function(_0x5e180c){_0x2a5727[_0x4c7f('0x1d')]=_0x5e180c;if(_0x31f5c7['query'][_0x4c7f('0x3c')]){_0x3c4090[_0x4c7f('0x3d')]=[{'all':!![]}];}return db[_0x4c7f('0x27')]['findAll'](_0x3c4090);})[_0x4c7f('0x22')](function(_0x49d23b){_0x2a5727['rows']=_0x49d23b;return _0x2a5727;})['then'](respondWithFilteredResult(_0x4974fd,_0x3c4090))[_0x4c7f('0x3e')](handleError(_0x4974fd,null));};exports[_0x4c7f('0x3f')]=function(_0x1d7535,_0x42bb5e){var _0x11837c={'raw':!![],'where':{'id':_0x1d7535[_0x4c7f('0x40')]['id']}},_0x2cade6={};_0x2cade6[_0x4c7f('0x2c')]=_[_0x4c7f('0x2e')](db[_0x4c7f('0x27')][_0x4c7f('0x28')]);_0x2cade6[_0x4c7f('0x2f')]=_[_0x4c7f('0x2e')](_0x1d7535[_0x4c7f('0x2f')]);_0x2cade6[_0x4c7f('0x30')]=_[_0x4c7f('0x31')](_0x2cade6[_0x4c7f('0x2c')],_0x2cade6[_0x4c7f('0x2f')]);_0x11837c[_0x4c7f('0x33')]=_[_0x4c7f('0x31')](_0x2cade6[_0x4c7f('0x2c')],qs[_0x4c7f('0x32')](_0x1d7535[_0x4c7f('0x2f')][_0x4c7f('0x32')]));_0x11837c['attributes']=_0x11837c['attributes']['length']?_0x11837c[_0x4c7f('0x33')]:_0x2cade6[_0x4c7f('0x2c')];if(_0x1d7535[_0x4c7f('0x2f')][_0x4c7f('0x3c')]){_0x11837c[_0x4c7f('0x3d')]=[{'all':!![]}];}_0x11837c=_['merge']({},_0x11837c,_0x1d7535[_0x4c7f('0x3b')]);return db[_0x4c7f('0x27')][_0x4c7f('0x41')](_0x11837c)[_0x4c7f('0x22')](handleEntityNotFound(_0x42bb5e,null))[_0x4c7f('0x22')](respondWithResult(_0x42bb5e,null))['catch'](handleError(_0x42bb5e,null));};exports['update']=function(_0x404cf5,_0x50ca38){if(_0x404cf5[_0x4c7f('0x42')]['id']){delete _0x404cf5[_0x4c7f('0x42')]['id'];}return db[_0x4c7f('0x27')][_0x4c7f('0x41')]({'where':{'id':_0x404cf5['params']['id']}})['then'](handleEntityNotFound(_0x50ca38,null))[_0x4c7f('0x22')](saveUpdates(_0x404cf5[_0x4c7f('0x42')],null))[_0x4c7f('0x22')](respondWithResult(_0x50ca38,null))[_0x4c7f('0x3e')](handleError(_0x50ca38,null));};exports['destroy']=function(_0x43831e,_0xbe6ead){return db[_0x4c7f('0x27')][_0x4c7f('0x41')]({'where':{'id':_0x43831e[_0x4c7f('0x40')]['id']}})[_0x4c7f('0x22')](handleEntityNotFound(_0xbe6ead,null))[_0x4c7f('0x22')](removeEntity(_0xbe6ead,null))[_0x4c7f('0x3e')](handleError(_0xbe6ead,null));};exports[_0x4c7f('0x43')]=function(_0x234cda,_0x45e55a){var _0x4187c2;return db[_0x4c7f('0x44')][_0x4c7f('0x45')](function(_0x349888){return db['CmCustomField'][_0x4c7f('0x43')](_0x234cda['body'],{'transaction':_0x349888})[_0x4c7f('0x22')](function(_0x3c9556){_0x4187c2=_0x3c9556;var _0x6253cd={'type':db[_0x4c7f('0x46')][_0x4c7f('0x47')],'transaction':_0x349888};switch(_0x234cda['body']['type']){case _0x4c7f('0x48'):_0x6253cd[_0x4c7f('0x2a')]=db[_0x4c7f('0x46')][_0x4c7f('0x47')];break;case _0x4c7f('0x49'):_0x6253cd['type']=db[_0x4c7f('0x46')][_0x4c7f('0x4a')];break;case _0x4c7f('0x4b'):_0x6253cd['type']=db[_0x4c7f('0x46')][_0x4c7f('0x4c')];_0x6253cd[_0x4c7f('0x4d')]=![];break;default:}return db[_0x4c7f('0x44')][_0x4c7f('0x4e')][_0x4c7f('0x4f')](_0x4c7f('0x50'),util[_0x4c7f('0x51')]('cf_%d',_0x4187c2['id']),_0x6253cd);})['then'](function(){return _0x4187c2;});})[_0x4c7f('0x22')](respondWithResult(_0x45e55a,0xc9))[_0x4c7f('0x3e')](handleError(_0x45e55a,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index e51bb85..cac4cfa 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 _0xec13=['./cmCustomField.attributes','exports','define','CmCustomField','cm_custom_fields','util','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x425cad,_0x1da6b4){var _0xd7fffb=function(_0x218e89){while(--_0x218e89){_0x425cad['push'](_0x425cad['shift']());}};_0xd7fffb(++_0x1da6b4);}(_0xec13,0x71));var _0x3ec1=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xec13[_0x46aff0];return _0x9d78cf;};'use strict';var _=require('lodash');var util=require(_0x3ec1('0x0'));var logger=require('../../config/logger')(_0x3ec1('0x1'));var moment=require(_0x3ec1('0x2'));var BPromise=require(_0x3ec1('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3ec1('0x4'));var rimraf=require(_0x3ec1('0x5'));var config=require(_0x3ec1('0x6'));var attributes=require(_0x3ec1('0x7'));module[_0x3ec1('0x8')]=function(_0x15c1dc,_0xd008cb){return _0x15c1dc[_0x3ec1('0x9')](_0x3ec1('0xa'),attributes,{'tableName':_0x3ec1('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3183=['CmCustomField','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmCustomField.attributes','exports','define'];(function(_0x2fc48a,_0x3210a0){var _0x5b0f59=function(_0x183685){while(--_0x183685){_0x2fc48a['push'](_0x2fc48a['shift']());}};_0x5b0f59(++_0x3210a0);}(_0x3183,0x1e2));var _0x3318=function(_0xbec8e6,_0x2841b5){_0xbec8e6=_0xbec8e6-0x0;var _0x4aa6f2=_0x3183[_0xbec8e6];return _0x4aa6f2;};'use strict';var _=require(_0x3318('0x0'));var util=require(_0x3318('0x1'));var logger=require('../../config/logger')(_0x3318('0x2'));var moment=require(_0x3318('0x3'));var BPromise=require(_0x3318('0x4'));var rp=require(_0x3318('0x5'));var fs=require('fs');var path=require(_0x3318('0x6'));var rimraf=require(_0x3318('0x7'));var config=require(_0x3318('0x8'));var attributes=require(_0x3318('0x9'));module[_0x3318('0xa')]=function(_0x18e36e,_0x5c5715){return _0x18e36e[_0x3318('0xb')](_0x3318('0xc'),attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.rpc.js b/server/api/cmCustomField/cmCustomField.rpc.js index b66bf63..6192f1d 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 _0x7365=['stringify','error','code','message','info','result','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s'];(function(_0x112cd4,_0xfb1a97){var _0x54de6c=function(_0x5787dd){while(--_0x5787dd){_0x112cd4['push'](_0x112cd4['shift']());}};_0x54de6c(++_0xfb1a97);}(_0x7365,0x1d4));var _0x5736=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0x7365[_0x3054be];return _0x3df150;};'use strict';var _=require(_0x5736('0x0'));var util=require(_0x5736('0x1'));var moment=require(_0x5736('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5736('0x3'));var db=require(_0x5736('0x4'))['db'];var utils=require(_0x5736('0x5'));var logger=require(_0x5736('0x6'))('rpc');var config=require(_0x5736('0x7'));var jayson=require(_0x5736('0x8'));var client=jayson[_0x5736('0x9')][_0x5736('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3c1731,_0x192b0e,_0xff6cf5){return new BPromise(function(_0x4b3c33,_0x5c0fd7){return client[_0x5736('0xb')](_0x3c1731,_0xff6cf5)['then'](function(_0x1a76e8){logger['info'](_0x5736('0xc'),_0x192b0e,_0x5736('0xd'));logger[_0x5736('0xe')](_0x5736('0xf'),_0x192b0e,_0x5736('0xd'),JSON[_0x5736('0x10')](_0x1a76e8));if(_0x1a76e8[_0x5736('0x11')]){if(_0x1a76e8[_0x5736('0x11')][_0x5736('0x12')]===0x1f4){logger[_0x5736('0x11')]('CmCustomField,\x20%s,\x20%s',_0x192b0e,_0x1a76e8[_0x5736('0x11')][_0x5736('0x13')]);return _0x5c0fd7(_0x1a76e8[_0x5736('0x11')][_0x5736('0x13')]);}logger['error'](_0x5736('0xc'),_0x192b0e,_0x1a76e8[_0x5736('0x11')][_0x5736('0x13')]);return _0x4b3c33(_0x1a76e8[_0x5736('0x11')][_0x5736('0x13')]);}else{logger[_0x5736('0x14')](_0x5736('0xc'),_0x192b0e,_0x5736('0xd'));_0x4b3c33(_0x1a76e8[_0x5736('0x15')][_0x5736('0x13')]);}})['catch'](function(_0x1f6d29){logger[_0x5736('0x11')](_0x5736('0xc'),_0x192b0e,_0x1f6d29);_0x5c0fd7(_0x1f6d29);});});} \ No newline at end of file +var _0x5e6e=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','CmCustomField,\x20%s,\x20%s','debug','CmCustomField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','moment','bluebird'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x5e6e,0x74));var _0xe5e6=function(_0x39d1c2,_0x170148){_0x39d1c2=_0x39d1c2-0x0;var _0x369078=_0x5e6e[_0x39d1c2];return _0x369078;};'use strict';var _=require(_0xe5e6('0x0'));var util=require(_0xe5e6('0x1'));var moment=require(_0xe5e6('0x2'));var BPromise=require(_0xe5e6('0x3'));var rs=require(_0xe5e6('0x4'));var fs=require('fs');var Redis=require(_0xe5e6('0x5'));var db=require(_0xe5e6('0x6'))['db'];var utils=require(_0xe5e6('0x7'));var logger=require('../../config/logger')(_0xe5e6('0x8'));var config=require(_0xe5e6('0x9'));var jayson=require(_0xe5e6('0xa'));var client=jayson[_0xe5e6('0xb')][_0xe5e6('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4f65ba,_0xe4fce8,_0x27873c){return new BPromise(function(_0x1a0b92,_0x38d98c){return client[_0xe5e6('0xd')](_0x4f65ba,_0x27873c)[_0xe5e6('0xe')](function(_0x5ee22b){logger['info'](_0xe5e6('0xf'),_0xe4fce8,'request\x20sent');logger[_0xe5e6('0x10')](_0xe5e6('0x11'),_0xe4fce8,_0xe5e6('0x12'),JSON[_0xe5e6('0x13')](_0x5ee22b));if(_0x5ee22b['error']){if(_0x5ee22b[_0xe5e6('0x14')][_0xe5e6('0x15')]===0x1f4){logger[_0xe5e6('0x14')](_0xe5e6('0xf'),_0xe4fce8,_0x5ee22b[_0xe5e6('0x14')][_0xe5e6('0x16')]);return _0x38d98c(_0x5ee22b['error'][_0xe5e6('0x16')]);}logger[_0xe5e6('0x14')](_0xe5e6('0xf'),_0xe4fce8,_0x5ee22b['error'][_0xe5e6('0x16')]);return _0x1a0b92(_0x5ee22b[_0xe5e6('0x14')][_0xe5e6('0x16')]);}else{logger['info'](_0xe5e6('0xf'),_0xe4fce8,_0xe5e6('0x12'));_0x1a0b92(_0x5ee22b[_0xe5e6('0x17')]['message']);}})['catch'](function(_0x58beb0){logger[_0xe5e6('0x14')]('CmCustomField,\x20%s,\x20%s',_0xe4fce8,_0x58beb0);_0x38d98c(_0x58beb0);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 1a9661c..33aa39d 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 _0xae24=['../../components/interaction/service','./cmCustomField.controller','get','isAuthenticated','index','/:id','post','put','update','delete','exports','multer','path','express','Router'];(function(_0x57bf3e,_0x3857bf){var _0x4cdb06=function(_0x2850bb){while(--_0x2850bb){_0x57bf3e['push'](_0x57bf3e['shift']());}};_0x4cdb06(++_0x3857bf);}(_0xae24,0x182));var _0x4ae2=function(_0x5baff4,_0x51ed05){_0x5baff4=_0x5baff4-0x0;var _0x3d325b=_0xae24[_0x5baff4];return _0x3d325b;};'use strict';var multer=require(_0x4ae2('0x0'));var util=require('util');var path=require(_0x4ae2('0x1'));var timeout=require('connect-timeout');var express=require(_0x4ae2('0x2'));var router=express[_0x4ae2('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4ae2('0x4'));var config=require('../../config/environment');var controller=require(_0x4ae2('0x5'));router[_0x4ae2('0x6')]('/',auth[_0x4ae2('0x7')](),controller[_0x4ae2('0x8')]);router[_0x4ae2('0x6')](_0x4ae2('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x4ae2('0xa')]('/',auth['isAuthenticated'](),controller['create']);router[_0x4ae2('0xb')](_0x4ae2('0x9'),auth['isAuthenticated'](),controller[_0x4ae2('0xc')]);router[_0x4ae2('0xd')](_0x4ae2('0x9'),auth[_0x4ae2('0x7')](),controller['destroy']);module[_0x4ae2('0xe')]=router; \ No newline at end of file +var _0x5aa1=['destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','/:id','show','post','put','update'];(function(_0x2ff55a,_0x2900b3){var _0x107366=function(_0x301b5d){while(--_0x301b5d){_0x2ff55a['push'](_0x2ff55a['shift']());}};_0x107366(++_0x2900b3);}(_0x5aa1,0x158));var _0x15aa=function(_0x1a4b26,_0xbbc926){_0x1a4b26=_0x1a4b26-0x0;var _0x497306=_0x5aa1[_0x1a4b26];return _0x497306;};'use strict';var multer=require(_0x15aa('0x0'));var util=require(_0x15aa('0x1'));var path=require(_0x15aa('0x2'));var timeout=require(_0x15aa('0x3'));var express=require(_0x15aa('0x4'));var router=express['Router']();var fs_extra=require(_0x15aa('0x5'));var auth=require(_0x15aa('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x15aa('0x7'));var controller=require(_0x15aa('0x8'));router[_0x15aa('0x9')]('/',auth[_0x15aa('0xa')](),controller['index']);router[_0x15aa('0x9')](_0x15aa('0xb'),auth['isAuthenticated'](),controller[_0x15aa('0xc')]);router[_0x15aa('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x15aa('0xe')](_0x15aa('0xb'),auth[_0x15aa('0xa')](),controller[_0x15aa('0xf')]);router['delete'](_0x15aa('0xb'),auth[_0x15aa('0xa')](),controller[_0x15aa('0x10')]);module[_0x15aa('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 865e1db..9b00db2 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 _0xdfd4=['contactListQueue','moment','sequelize','exports','STRING','BOOLEAN','DATE','YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED'];(function(_0x32de8c,_0x52968c){var _0x3b1f3d=function(_0x2646b3){while(--_0x2646b3){_0x32de8c['push'](_0x32de8c['shift']());}};_0x3b1f3d(++_0x52968c);}(_0xdfd4,0x169));var _0x4dfd=function(_0x32fb5a,_0x565a38){_0x32fb5a=_0x32fb5a-0x0;var _0x2f212c=_0xdfd4[_0x32fb5a];return _0x2f212c;};'use strict';var moment=require(_0x4dfd('0x0'));var Sequelize=require(_0x4dfd('0x1'));module[_0x4dfd('0x2')]={'phone':{'type':Sequelize[_0x4dfd('0x3')],'allowNull':![]},'active':{'type':Sequelize[_0x4dfd('0x4')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x4dfd('0x5')],'defaultValue':moment()['format'](_0x4dfd('0x6'))},'countbusyretry':{'type':Sequelize[_0x4dfd('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x4dfd('0x7')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x4dfd('0x7')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x4dfd('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x4dfd('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x4dfd('0x5')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x4dfd('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x4dfd('0x4')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x4dfd('0x7')],'unique':_0x4dfd('0x9')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x4dfd('0x9')},'UserId':{'type':Sequelize[_0x4dfd('0x7')]},'VoiceQueueId':{'type':Sequelize[_0x4dfd('0x7')],'unique':_0x4dfd('0x9')},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize[_0x4dfd('0x7')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x4dfd('0x7')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x4dfd('0x7')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x4dfd('0x7')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x4dfd('0x7')],'defaultValue':0x0},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']},'recallmeNotifiedDate':{'type':Sequelize[_0x4dfd('0x5')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0xc2bd=['sequelize','exports','BOOLEAN','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','STRING','UNSIGNED','contactListQueue','moment'];(function(_0x24693e,_0x2ba888){var _0x53e672=function(_0x5f6cff){while(--_0x5f6cff){_0x24693e['push'](_0x24693e['shift']());}};_0x53e672(++_0x2ba888);}(_0xc2bd,0xf1));var _0xdc2b=function(_0xf6d425,_0x2c23b8){_0xf6d425=_0xf6d425-0x0;var _0x20531d=_0xc2bd[_0xf6d425];return _0x20531d;};'use strict';var moment=require(_0xdc2b('0x0'));var Sequelize=require(_0xdc2b('0x1'));module[_0xdc2b('0x2')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize[_0xdc2b('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xdc2b('0x4')],'defaultValue':moment()[_0xdc2b('0x5')](_0xdc2b('0x6'))},'countbusyretry':{'type':Sequelize[_0xdc2b('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xdc2b('0x7')],'defaultValue':0x0},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xdc2b('0x8')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xdc2b('0x4')]},'priority':{'type':Sequelize[_0xdc2b('0x7')](0x2)[_0xdc2b('0x9')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xdc2b('0x7')],'unique':_0xdc2b('0xa')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0xdc2b('0xa')},'UserId':{'type':Sequelize[_0xdc2b('0x7')]},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize[_0xdc2b('0x7')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xdc2b('0x7')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xdc2b('0x7')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xdc2b('0x7')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0xdc2b('0x7')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xdc2b('0x8')]},'recallmeNotifiedDate':{'type':Sequelize[_0xdc2b('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 7c97518..c912276 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 _0xd67b=['format','YYYY-MM-DD\x20HH:mm:ss','phone','queue','CmContact','ContactId','firstName','lastName','isNil','calleridname','finally','getPreview','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize','transaction','value','direction','prev','hopperIds','priority','ASC','scheduledAt','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','isEmpty','findOne','scheduledat','recallme','LOCK','UPDATE','Contact','CmCompany','Company','CmList','dialActive','Queue','getVoiceQueues','outbound','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','getOpenContacts','entity\x20not\x20found','getTimezones','timezones','lodash','../../config/logger','api','../../config/environment','json','offset','undefined','limit','count','status','set','Content-Range','update','then','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','concat','$and','$or','$gt','$gte','$lte','$eq','$not','$between','$in','$notIn','$notLike','$iLike','$notILike','$like','$overlap','$any','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','type','options','CmHopper','includeAll','findAll','catch','show','include','create','body','params','describe','destroy','find','VoiceQueueId','VoiceQueue','Campaign','omit','dataValues','createdAt','updatedAt','state','statedesc','user','UserId','deletedat'];(function(_0xc00da6,_0x549d82){var _0x5d953b=function(_0x419a16){while(--_0x419a16){_0xc00da6['push'](_0xc00da6['shift']());}};_0x5d953b(++_0x549d82);}(_0xd67b,0x133));var _0xbd67=function(_0x3dee5a,_0x50fefe){_0x3dee5a=_0x3dee5a-0x0;var _0x2d9997=_0xd67b[_0x3dee5a];return _0x2d9997;};'use strict';var moment=require('moment');var _=require(_0xbd67('0x0'));var qs=require('../../components/parsers/qs');var logger=require(_0xbd67('0x1'))(_0xbd67('0x2'));var shared=require(_0xbd67('0x3'));var db=require('../../mysqldb')['db'];function respondWithResult(_0x40e384,_0x50da5a){_0x50da5a=_0x50da5a||0xc8;return function(_0x1bf96){if(_0x1bf96){return _0x40e384['status'](_0x50da5a)[_0xbd67('0x4')](_0x1bf96);}};}function respondWithFilteredResult(_0xa5c384,_0x2ad142){return function(_0x27b016){if(_0x27b016){var _0x1860c9=typeof _0x2ad142[_0xbd67('0x5')]===_0xbd67('0x6')&&typeof _0x2ad142[_0xbd67('0x7')]===_0xbd67('0x6');var _0x461231=_0x27b016[_0xbd67('0x8')];var _0x3a7f43=_0x1860c9?0x0:_0x2ad142[_0xbd67('0x5')];var _0x52b981=_0x1860c9?_0x27b016['count']:_0x2ad142[_0xbd67('0x5')]+_0x2ad142['limit'];var _0x388d95;if(_0x52b981>=_0x461231){_0x52b981=_0x461231;_0x388d95=0xc8;}else{_0x388d95=0xce;}_0xa5c384[_0xbd67('0x9')](_0x388d95);return _0xa5c384[_0xbd67('0xa')](_0xbd67('0xb'),_0x3a7f43+'-'+_0x52b981+'/'+_0x461231)[_0xbd67('0x4')](_0x27b016);}return null;};}function saveUpdates(_0xb05237,_0x3621ad){return function(_0x32bd81){if(_0x32bd81){return _0x32bd81[_0xbd67('0xc')](_0xb05237)[_0xbd67('0xd')](function(_0x4c078c){return _0x4c078c;});}return null;};}function handleEntityNotFound(_0xbe923c,_0x46d881){return function(_0x2a5efd){if(!_0x2a5efd){_0xbe923c[_0xbd67('0xe')](0x194);}return _0x2a5efd;};}function handleError(_0x84bdf1,_0x23b626){_0x23b626=_0x23b626||0x1f4;return function(_0x44c025){logger[_0xbd67('0xf')](_0x44c025[_0xbd67('0x10')]);if(_0x44c025[_0xbd67('0x11')]){delete _0x44c025['name'];}_0x84bdf1['status'](_0x23b626)[_0xbd67('0x12')](_0x44c025);};}exports[_0xbd67('0x13')]=function(_0xff31b,_0x47d066){var _0x3c0d33={},_0x2e0e21={},_0x357ff2={'count':0x0,'rows':[]};var _0x4b764f=_[_0xbd67('0x14')](db['CmHopper'][_0xbd67('0x15')],function(_0x4609b7){return{'name':_0x4609b7[_0xbd67('0x16')],'type':_0x4609b7['type'][_0xbd67('0x17')]};});_0x2e0e21[_0xbd67('0x18')]=_[_0xbd67('0x14')](_0x4b764f,_0xbd67('0x11'));_0x2e0e21[_0xbd67('0x19')]=_[_0xbd67('0x1a')](_0xff31b['query']);_0x2e0e21[_0xbd67('0x1b')]=_[_0xbd67('0x1c')](_0x2e0e21[_0xbd67('0x18')],_0x2e0e21[_0xbd67('0x19')]);_0x2e0e21[_0xbd67('0x1b')]=_[_0xbd67('0x1d')](_0x2e0e21[_0xbd67('0x1b')],[_0xbd67('0x1e'),_0xbd67('0x1f'),_0xbd67('0x20'),_0xbd67('0x21'),'$lt',_0xbd67('0x22'),'$ne',_0xbd67('0x23'),_0xbd67('0x24'),_0xbd67('0x25'),'$notBetween',_0xbd67('0x26'),_0xbd67('0x27'),'$like',_0xbd67('0x28'),_0xbd67('0x29'),_0xbd67('0x2a'),_0xbd67('0x2b'),_0xbd67('0x2c'),'$contains','$contained',_0xbd67('0x2d')]);_0x3c0d33[_0xbd67('0x2e')]=_[_0xbd67('0x1c')](_0x2e0e21[_0xbd67('0x18')],qs[_0xbd67('0x2f')](_0xff31b[_0xbd67('0x19')][_0xbd67('0x2f')]));_0x3c0d33[_0xbd67('0x2e')]=_0x3c0d33[_0xbd67('0x2e')][_0xbd67('0x30')]?_0x3c0d33['attributes']:_0x2e0e21['model'];if(!_0xff31b[_0xbd67('0x19')][_0xbd67('0x31')](_0xbd67('0x32'))){_0x3c0d33['limit']=qs[_0xbd67('0x7')](_0xff31b[_0xbd67('0x19')][_0xbd67('0x7')]);_0x3c0d33[_0xbd67('0x5')]=qs['offset'](_0xff31b['query']['offset']);}_0x3c0d33[_0xbd67('0x33')]=qs[_0xbd67('0x34')](_0xff31b[_0xbd67('0x19')]['sort']);_0x3c0d33['where']=qs[_0xbd67('0x1b')](_[_0xbd67('0x35')](_0xff31b[_0xbd67('0x19')],_0x2e0e21[_0xbd67('0x1b')]),_0x4b764f);if(_0xff31b[_0xbd67('0x19')][_0xbd67('0x36')]){_0x3c0d33['where']=_[_0xbd67('0x37')](_0x3c0d33[_0xbd67('0x38')],{'$or':_[_0xbd67('0x14')](_0x4b764f,function(_0x553e40){if(_0x553e40[_0xbd67('0x39')]!=='VIRTUAL'){var _0x3993e9={};_0x3993e9[_0x553e40[_0xbd67('0x11')]]={'$like':'%'+_0xff31b['query'][_0xbd67('0x36')]+'%'};return _0x3993e9;}})});}_0x3c0d33=_[_0xbd67('0x37')]({},_0x3c0d33,_0xff31b[_0xbd67('0x3a')]);var _0x31f689={'where':_0x3c0d33[_0xbd67('0x38')]};return db[_0xbd67('0x3b')]['count'](_0x31f689)[_0xbd67('0xd')](function(_0x151848){_0x357ff2[_0xbd67('0x8')]=_0x151848;if(_0xff31b[_0xbd67('0x19')][_0xbd67('0x3c')]){_0x3c0d33['include']=[{'all':!![]}];}return db['CmHopper'][_0xbd67('0x3d')](_0x3c0d33);})[_0xbd67('0xd')](function(_0x32fc09){_0x357ff2['rows']=_0x32fc09;return _0x357ff2;})[_0xbd67('0xd')](respondWithFilteredResult(_0x47d066,_0x3c0d33))[_0xbd67('0x3e')](handleError(_0x47d066,null));};exports[_0xbd67('0x3f')]=function(_0x194c1f,_0x51a4fe){var _0x577986={'raw':!![],'where':{'id':_0x194c1f['params']['id']}},_0x53cbee={};_0x53cbee['model']=_[_0xbd67('0x1a')](db['CmHopper']['rawAttributes']);_0x53cbee['query']=_[_0xbd67('0x1a')](_0x194c1f[_0xbd67('0x19')]);_0x53cbee[_0xbd67('0x1b')]=_[_0xbd67('0x1c')](_0x53cbee['model'],_0x53cbee[_0xbd67('0x19')]);_0x577986[_0xbd67('0x2e')]=_[_0xbd67('0x1c')](_0x53cbee[_0xbd67('0x18')],qs[_0xbd67('0x2f')](_0x194c1f[_0xbd67('0x19')][_0xbd67('0x2f')]));_0x577986['attributes']=_0x577986[_0xbd67('0x2e')]['length']?_0x577986[_0xbd67('0x2e')]:_0x53cbee[_0xbd67('0x18')];if(_0x194c1f[_0xbd67('0x19')][_0xbd67('0x3c')]){_0x577986[_0xbd67('0x40')]=[{'all':!![]}];}_0x577986=_[_0xbd67('0x37')]({},_0x577986,_0x194c1f[_0xbd67('0x3a')]);return db[_0xbd67('0x3b')]['find'](_0x577986)[_0xbd67('0xd')](handleEntityNotFound(_0x51a4fe,null))[_0xbd67('0xd')](respondWithResult(_0x51a4fe,null))['catch'](handleError(_0x51a4fe,null));};exports[_0xbd67('0x41')]=function(_0x3870c9,_0x20cdb7){return db['CmHopper']['create'](_0x3870c9[_0xbd67('0x42')],{})[_0xbd67('0xd')](respondWithResult(_0x20cdb7,0xc9))[_0xbd67('0x3e')](handleError(_0x20cdb7,null));};exports['update']=function(_0x31fbd5,_0x345508){if(_0x31fbd5['body']['id']){delete _0x31fbd5['body']['id'];}return db['CmHopper']['find']({'where':{'id':_0x31fbd5[_0xbd67('0x43')]['id']}})[_0xbd67('0xd')](handleEntityNotFound(_0x345508,null))[_0xbd67('0xd')](saveUpdates(_0x31fbd5[_0xbd67('0x42')],null))[_0xbd67('0xd')](respondWithResult(_0x345508,null))['catch'](handleError(_0x345508,null));};exports[_0xbd67('0x44')]=function(_0x171d86,_0x584aa8){return db[_0xbd67('0x3b')][_0xbd67('0x44')]()[_0xbd67('0xd')](respondWithResult(_0x584aa8,null))[_0xbd67('0x3e')](handleError(_0x584aa8,null));};exports[_0xbd67('0x45')]=function(_0x5ea5cc,_0x29662b){var _0x5ae43b;var _0xe476dc=_0x5ea5cc[_0xbd67('0x43')]['id'];return db['CmHopper'][_0xbd67('0x46')]({'where':{'id':_0x5ea5cc[_0xbd67('0x43')]['id']}})[_0xbd67('0xd')](handleEntityNotFound(_0x29662b,null))['then'](function(_0x41c539){if(_0x41c539){return _0x41c539[_0xbd67('0x45')]()[_0xbd67('0xd')](function(_0x79f8ba){return _0x79f8ba;});}})[_0xbd67('0xd')](function(_0x15f2f0){_0x5ae43b=_0x15f2f0;if(_0x15f2f0){if(_0x15f2f0[_0xbd67('0x47')]||_0x15f2f0['CampaignId']){return db[_0x15f2f0['VoiceQueueId']?_0xbd67('0x48'):_0xbd67('0x49')][_0xbd67('0x46')]({'where':{'id':_0x15f2f0[_0xbd67('0x47')]?_0x15f2f0[_0xbd67('0x47')]:_0x15f2f0['CampaignId']},'attributes':['id','name'],'raw':!![]});}}})[_0xbd67('0xd')](function(_0x2d3ff3){var _0x1d1ea2={};if(_0x2d3ff3){_[_0xbd67('0x37')](_0x1d1ea2,_[_0xbd67('0x4a')](_0x5ae43b[_0xbd67('0x4b')],[_0xbd67('0x4c'),_0xbd67('0x4d'),'id']));_0x1d1ea2[_0xbd67('0x4e')]=0x15;_0x1d1ea2[_0xbd67('0x4f')]='deleted';_0x1d1ea2['campaign']=_0x2d3ff3[_0xbd67('0x11')];_0x1d1ea2['membername']=_0x5ea5cc[_0xbd67('0x50')][_0xbd67('0x11')];_0x1d1ea2[_0xbd67('0x51')]=_0x5ea5cc[_0xbd67('0x50')]['id'];_0x1d1ea2['deleted']=!![];_0x1d1ea2[_0xbd67('0x52')]=moment()[_0xbd67('0x53')](_0xbd67('0x54'));_0x1d1ea2['calleridnum']=_0x5ae43b[_0xbd67('0x55')];_0x1d1ea2['campaigntype']=_0x5ae43b[_0xbd67('0x47')]?_0xbd67('0x56'):'ivr';return db[_0xbd67('0x57')][_0xbd67('0x46')]({'where':{'id':_0x1d1ea2[_0xbd67('0x58')]},'attributes':[_0xbd67('0x59'),_0xbd67('0x5a')]})[_0xbd67('0xd')](function(_0x434cd8){if(!_[_0xbd67('0x5b')](_0x29662b)&&!_[_0xbd67('0x5b')](_0x434cd8[_0xbd67('0x59')])){_0x1d1ea2[_0xbd67('0x5c')]=_0x434cd8[_0xbd67('0x59')];if(!_[_0xbd67('0x5b')](_0x434cd8[_0xbd67('0x5a')])){_0x1d1ea2[_0xbd67('0x5c')]+='\x20'+_0x434cd8[_0xbd67('0x5a')];}}})[_0xbd67('0x5d')](function(){return db['CmHopperFinal']['create'](_0x1d1ea2);});}})[_0xbd67('0xd')](function(_0x2afce6){return db['CmHopperAdditionalPhone'][_0xbd67('0x45')]({'where':{'CmHopperId':_0xe476dc}});})[_0xbd67('0xd')](function(){return _0x29662b[_0xbd67('0x9')](0xcc)['end']();})[_0xbd67('0x3e')](handleError(_0x29662b,null));};exports[_0xbd67('0x5e')]=function(_0xf3dec5,_0x1053ee){var _0x205465=[];return db[_0xbd67('0x57')]['describe']()[_0xbd67('0xd')](function(_0x5f1828){_0x205465=_[_0xbd67('0x1a')](_0x5f1828);return _0xf3dec5[_0xbd67('0x50')]['getVoiceQueues']({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0xbd67('0x5f')},'attributes':['id',_0xbd67('0x60'),_0xbd67('0x61')],'raw':!![]});})[_0xbd67('0xd')](function(_0x143ffa){if(_0x143ffa&&_0x143ffa['length']){return db[_0xbd67('0x62')][_0xbd67('0x63')](function(_0x24d822){var _0x33d702={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xbd67('0x53')](_0xbd67('0x54'))},'VoiceQueueId':{'$in':_[_0xbd67('0x14')](_0x143ffa,'id')},'$or':[{'UserId':null},{'UserId':_0xf3dec5[_0xbd67('0x50')]['id']}]};var _0x16c8bb={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x143ffa)[_0xbd67('0x36')]([_0xbd67('0x61'),0x0])['map']('id')[_0xbd67('0x64')]()},'$or':[{'UserId':null},{'UserId':_0xf3dec5[_0xbd67('0x50')]['id']}]};var _0x4c36a5={'$or':[_0x33d702,_0x16c8bb]};var _0x258be7=[];if(_0xf3dec5[_0xbd67('0x42')][_0xbd67('0x65')]&&_0xf3dec5['body']['direction']===_0xbd67('0x66')){if(!_['isEmpty'](_0xf3dec5[_0xbd67('0x42')][_0xbd67('0x67')])){_0x4c36a5['id']={'$in':_0xf3dec5['body'][_0xbd67('0x67')]};}_0x258be7=[[_0xbd67('0x68'),_0xbd67('0x69')],[_0xbd67('0x6a'),_0x143ffa[0x0]['dialOrderByScheduledAt']===_0xbd67('0x69')?_0xbd67('0x6b'):'ASC'],db[_0xbd67('0x62')][_0xbd67('0x6c')](_0xbd67('0x6d')),['id','DESC']];}else{if(!_[_0xbd67('0x6e')](_0xf3dec5[_0xbd67('0x42')][_0xbd67('0x67')])){_0x4c36a5['id']={'$notIn':_0xf3dec5[_0xbd67('0x42')]['hopperIds']};}_0x258be7=[[_0xbd67('0x68'),_0xbd67('0x6b')],[_0xbd67('0x6a'),_0x143ffa[0x0]['dialOrderByScheduledAt']],db[_0xbd67('0x62')]['literal']('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id',_0xbd67('0x69')]];}return db[_0xbd67('0x3b')][_0xbd67('0x6f')]({'attributes':['id',_0xbd67('0x70'),_0xbd67('0x55'),_0xbd67('0x71')],'where':_0x4c36a5,'order':_0x258be7,'transaction':_0x24d822,'lock':_0x24d822[_0xbd67('0x72')][_0xbd67('0x73')],'include':[{'model':db[_0xbd67('0x57')],'as':_0xbd67('0x74'),'attributes':_0x205465,'include':[{'model':db[_0xbd67('0x75')],'as':_0xbd67('0x76'),'attributes':['id',_0xbd67('0x11')]}]},{'model':db[_0xbd67('0x77')],'as':'List','attributes':['id',_0xbd67('0x11')]},{'model':db['VoiceQueue'],'as':'Queue','attributes':['id',_0xbd67('0x11'),_0xbd67('0x78')]}]})[_0xbd67('0xd')](function(_0x26e872){if(_0x26e872){return _0x26e872[_0xbd67('0xc')]({'UserId':_0xf3dec5[_0xbd67('0x50')]['id']},{'transaction':_0x24d822});}});});}})['then'](handleEntityNotFound(_0x1053ee,null))[_0xbd67('0xd')](respondWithResult(_0x1053ee,null))['catch'](handleError(_0x1053ee,null));};exports['getPreviewRecall']=function(_0x5068cc,_0x210802,_0x52c44a){var _0x2cc861=[];var _0x41ff24=_0x5068cc[_0xbd67('0x43')]['id'];var _0x3934fa=_0x5068cc['user']['id'];return db[_0xbd67('0x57')][_0xbd67('0x44')]()[_0xbd67('0xd')](function(_0x4e55fe){_0x2cc861=_['keys'](_0x4e55fe);return db[_0xbd67('0x62')][_0xbd67('0x63')](function(_0x2e0791){const _0x4e37fa={'id':_0x41ff24};return db[_0xbd67('0x3b')][_0xbd67('0x6f')]({'attributes':['id','scheduledat',_0xbd67('0x71')],'where':_0x4e37fa,'transaction':_0x2e0791,'lock':_0x2e0791[_0xbd67('0x72')][_0xbd67('0x73')],'include':[{'model':db[_0xbd67('0x57')],'as':_0xbd67('0x74'),'attributes':_0x2cc861,'include':[{'model':db[_0xbd67('0x75')],'as':_0xbd67('0x76'),'attributes':['id',_0xbd67('0x11')]}]},{'model':db['CmList'],'as':'List','attributes':['id',_0xbd67('0x11')]},{'model':db[_0xbd67('0x48')],'as':_0xbd67('0x79'),'attributes':['id',_0xbd67('0x11'),'dialActive']}]})[_0xbd67('0xd')](function(_0x2b7f1d){if(_0x2b7f1d){return _0x2b7f1d[_0xbd67('0xc')]({'UserId':_0x3934fa},{'transaction':_0x2e0791});}});});})['then'](handleEntityNotFound(_0x210802,null))['then'](respondWithResult(_0x210802,null))[_0xbd67('0x3e')](handleError(_0x210802,null));};exports['getOpenContacts']=function(_0x5a3811,_0x3dd30a){return _0x5a3811[_0xbd67('0x50')][_0xbd67('0x7a')]({'where':{'type':_0xbd67('0x7b'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})[_0xbd67('0xd')](function(_0x2f785b){if(_0x2f785b&&_0x2f785b[_0xbd67('0x30')]){return db[_0xbd67('0x3b')][_0xbd67('0x8')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xbd67('0x53')](_0xbd67('0x54'))},'VoiceQueueId':{'$in':_[_0xbd67('0x14')](_0x2f785b,'id')},'$or':[{'UserId':null},{'UserId':_0x5a3811[_0xbd67('0x50')]['id']}]}});}return 0x0;})[_0xbd67('0xd')](function(_0x84b0e2){if(!_[_0xbd67('0x5b')](_0x84b0e2)&&_[_0xbd67('0x7c')](_0x84b0e2)){return _0x3dd30a['status'](0xc8)[_0xbd67('0x4')]({'contacts':_0x84b0e2});}else{logger['error'](_0xbd67('0x7d'),_0xbd67('0x7e'),0x194,_0xbd67('0x7f'));_0x3dd30a[_0xbd67('0xe')](0x194);}})[_0xbd67('0x3e')](handleError(_0x3dd30a,null));};exports[_0xbd67('0x80')]=function(_0x4dda6c,_0x5e01c2){var _0x606263=shared[_0xbd67('0x81')];var _0x159fa=[];_['map'](_0x606263,function(_0x13f2af){_0x159fa['push']({'id':_0x13f2af['name'],'name':_0x13f2af['name'],'utcOffset':_0x13f2af['utcOffset']});});return _0x5e01c2[_0xbd67('0x9')](0xc8)['json']({'tz':_0x159fa});};exports['getTimezone']=function(_0x3c98e1,_0x38abc1){var _0x2e06ce=shared[_0xbd67('0x81')];var _0x22646d={};if(!_[_0xbd67('0x5b')](_0x2e06ce[_0x3c98e1[_0xbd67('0x42')]['id']]))_0x22646d=_0x2e06ce[_0x3c98e1[_0xbd67('0x42')]['id']];return _0x38abc1[_0xbd67('0x9')](0xc8)[_0xbd67('0x4')](_0x22646d);}; \ No newline at end of file +var _0x8a28=['set','Content-Range','update','then','error','stack','name','send','index','map','CmHopper','fieldName','model','query','keys','filters','intersection','concat','$or','$gt','$lte','$ne','$not','$between','$notBetween','$in','$like','$iLike','$notILike','$contains','$contained','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','describe','destroy','VoiceQueueId','CampaignId','omit','dataValues','updatedAt','statedesc','deleted','campaign','membername','user','UserId','format','YYYY-MM-DD\x20HH:mm:ss','phone','campaigntype','ivr','CmContact','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','CmHopperAdditionalPhone','end','outbound','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize','transaction','value','direction','prev','hopperIds','priority','ASC','scheduledAt','literal','DESC','scheduledat','LOCK','UPDATE','Contact','CmCompany','Company','CmList','List','VoiceQueue','dialActive','getPreviewRecall','findOne','recallme','Queue','getOpenContacts','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','push','utcOffset','getTimezone','timezones','moment','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','status','json','undefined','limit','count','offset'];(function(_0x3c5784,_0x2597ad){var _0x5a6dc1=function(_0x16cbd6){while(--_0x16cbd6){_0x3c5784['push'](_0x3c5784['shift']());}};_0x5a6dc1(++_0x2597ad);}(_0x8a28,0xfd));var _0x88a2=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x8a28[_0x5ddb1c];return _0x354adc;};'use strict';var moment=require(_0x88a2('0x0'));var _=require(_0x88a2('0x1'));var qs=require(_0x88a2('0x2'));var logger=require(_0x88a2('0x3'))(_0x88a2('0x4'));var shared=require(_0x88a2('0x5'));var db=require(_0x88a2('0x6'))['db'];function respondWithResult(_0x3fc89d,_0x5d5b92){_0x5d5b92=_0x5d5b92||0xc8;return function(_0x2f482e){if(_0x2f482e){return _0x3fc89d[_0x88a2('0x7')](_0x5d5b92)[_0x88a2('0x8')](_0x2f482e);}};}function respondWithFilteredResult(_0x438e32,_0x29ce92){return function(_0x5cb591){if(_0x5cb591){var _0x1629ea=typeof _0x29ce92['offset']===_0x88a2('0x9')&&typeof _0x29ce92[_0x88a2('0xa')]===_0x88a2('0x9');var _0xdbb322=_0x5cb591[_0x88a2('0xb')];var _0x2d0fce=_0x1629ea?0x0:_0x29ce92[_0x88a2('0xc')];var _0x306a59=_0x1629ea?_0x5cb591[_0x88a2('0xb')]:_0x29ce92['offset']+_0x29ce92['limit'];var _0x854332;if(_0x306a59>=_0xdbb322){_0x306a59=_0xdbb322;_0x854332=0xc8;}else{_0x854332=0xce;}_0x438e32[_0x88a2('0x7')](_0x854332);return _0x438e32[_0x88a2('0xd')](_0x88a2('0xe'),_0x2d0fce+'-'+_0x306a59+'/'+_0xdbb322)[_0x88a2('0x8')](_0x5cb591);}return null;};}function saveUpdates(_0x4887fc,_0x210a52){return function(_0x1a4056){if(_0x1a4056){return _0x1a4056[_0x88a2('0xf')](_0x4887fc)[_0x88a2('0x10')](function(_0x5093c0){return _0x5093c0;});}return null;};}function handleEntityNotFound(_0x923706,_0x407ef0){return function(_0x3b83ce){if(!_0x3b83ce){_0x923706['sendStatus'](0x194);}return _0x3b83ce;};}function handleError(_0x34f19e,_0x207b12){_0x207b12=_0x207b12||0x1f4;return function(_0x462b7b){logger[_0x88a2('0x11')](_0x462b7b[_0x88a2('0x12')]);if(_0x462b7b[_0x88a2('0x13')]){delete _0x462b7b[_0x88a2('0x13')];}_0x34f19e[_0x88a2('0x7')](_0x207b12)[_0x88a2('0x14')](_0x462b7b);};}exports[_0x88a2('0x15')]=function(_0x235b75,_0x3c030e){var _0x188f6a={},_0x29dc1b={},_0x34d34a={'count':0x0,'rows':[]};var _0x162b5f=_[_0x88a2('0x16')](db[_0x88a2('0x17')]['rawAttributes'],function(_0x190aac){return{'name':_0x190aac[_0x88a2('0x18')],'type':_0x190aac['type']['key']};});_0x29dc1b[_0x88a2('0x19')]=_[_0x88a2('0x16')](_0x162b5f,_0x88a2('0x13'));_0x29dc1b[_0x88a2('0x1a')]=_[_0x88a2('0x1b')](_0x235b75['query']);_0x29dc1b[_0x88a2('0x1c')]=_[_0x88a2('0x1d')](_0x29dc1b[_0x88a2('0x19')],_0x29dc1b[_0x88a2('0x1a')]);_0x29dc1b['filters']=_[_0x88a2('0x1e')](_0x29dc1b['filters'],['$and',_0x88a2('0x1f'),_0x88a2('0x20'),'$gte','$lt',_0x88a2('0x21'),_0x88a2('0x22'),'$eq',_0x88a2('0x23'),_0x88a2('0x24'),_0x88a2('0x25'),_0x88a2('0x26'),'$notIn',_0x88a2('0x27'),'$notLike',_0x88a2('0x28'),_0x88a2('0x29'),_0x88a2('0x27'),'$overlap',_0x88a2('0x2a'),_0x88a2('0x2b'),'$any']);_0x188f6a[_0x88a2('0x2c')]=_[_0x88a2('0x1d')](_0x29dc1b['model'],qs['fields'](_0x235b75[_0x88a2('0x1a')][_0x88a2('0x2d')]));_0x188f6a[_0x88a2('0x2c')]=_0x188f6a[_0x88a2('0x2c')][_0x88a2('0x2e')]?_0x188f6a[_0x88a2('0x2c')]:_0x29dc1b['model'];if(!_0x235b75[_0x88a2('0x1a')][_0x88a2('0x2f')](_0x88a2('0x30'))){_0x188f6a[_0x88a2('0xa')]=qs[_0x88a2('0xa')](_0x235b75[_0x88a2('0x1a')][_0x88a2('0xa')]);_0x188f6a[_0x88a2('0xc')]=qs[_0x88a2('0xc')](_0x235b75[_0x88a2('0x1a')]['offset']);}_0x188f6a['order']=qs[_0x88a2('0x31')](_0x235b75[_0x88a2('0x1a')][_0x88a2('0x31')]);_0x188f6a['where']=qs[_0x88a2('0x1c')](_[_0x88a2('0x32')](_0x235b75['query'],_0x29dc1b[_0x88a2('0x1c')]),_0x162b5f);if(_0x235b75[_0x88a2('0x1a')][_0x88a2('0x33')]){_0x188f6a['where']=_['merge'](_0x188f6a[_0x88a2('0x34')],{'$or':_[_0x88a2('0x16')](_0x162b5f,function(_0x4cb19f){if(_0x4cb19f[_0x88a2('0x35')]!==_0x88a2('0x36')){var _0x327a80={};_0x327a80[_0x4cb19f[_0x88a2('0x13')]]={'$like':'%'+_0x235b75[_0x88a2('0x1a')][_0x88a2('0x33')]+'%'};return _0x327a80;}})});}_0x188f6a=_[_0x88a2('0x37')]({},_0x188f6a,_0x235b75[_0x88a2('0x38')]);var _0x4fdacc={'where':_0x188f6a[_0x88a2('0x34')]};return db[_0x88a2('0x17')]['count'](_0x4fdacc)[_0x88a2('0x10')](function(_0x38cc76){_0x34d34a[_0x88a2('0xb')]=_0x38cc76;if(_0x235b75[_0x88a2('0x1a')][_0x88a2('0x39')]){_0x188f6a[_0x88a2('0x3a')]=[{'all':!![]}];}return db[_0x88a2('0x17')][_0x88a2('0x3b')](_0x188f6a);})[_0x88a2('0x10')](function(_0x1fa0c6){_0x34d34a[_0x88a2('0x3c')]=_0x1fa0c6;return _0x34d34a;})[_0x88a2('0x10')](respondWithFilteredResult(_0x3c030e,_0x188f6a))[_0x88a2('0x3d')](handleError(_0x3c030e,null));};exports[_0x88a2('0x3e')]=function(_0x42b8f7,_0xb21338){var _0x1496d9={'raw':!![],'where':{'id':_0x42b8f7[_0x88a2('0x3f')]['id']}},_0x23cdc2={};_0x23cdc2[_0x88a2('0x19')]=_[_0x88a2('0x1b')](db[_0x88a2('0x17')][_0x88a2('0x40')]);_0x23cdc2[_0x88a2('0x1a')]=_[_0x88a2('0x1b')](_0x42b8f7['query']);_0x23cdc2['filters']=_[_0x88a2('0x1d')](_0x23cdc2[_0x88a2('0x19')],_0x23cdc2['query']);_0x1496d9[_0x88a2('0x2c')]=_[_0x88a2('0x1d')](_0x23cdc2[_0x88a2('0x19')],qs[_0x88a2('0x2d')](_0x42b8f7[_0x88a2('0x1a')][_0x88a2('0x2d')]));_0x1496d9['attributes']=_0x1496d9[_0x88a2('0x2c')][_0x88a2('0x2e')]?_0x1496d9[_0x88a2('0x2c')]:_0x23cdc2['model'];if(_0x42b8f7[_0x88a2('0x1a')][_0x88a2('0x39')]){_0x1496d9[_0x88a2('0x3a')]=[{'all':!![]}];}_0x1496d9=_[_0x88a2('0x37')]({},_0x1496d9,_0x42b8f7['options']);return db[_0x88a2('0x17')][_0x88a2('0x41')](_0x1496d9)[_0x88a2('0x10')](handleEntityNotFound(_0xb21338,null))[_0x88a2('0x10')](respondWithResult(_0xb21338,null))[_0x88a2('0x3d')](handleError(_0xb21338,null));};exports[_0x88a2('0x42')]=function(_0x682411,_0x363475){return db[_0x88a2('0x17')][_0x88a2('0x42')](_0x682411[_0x88a2('0x43')],{})[_0x88a2('0x10')](respondWithResult(_0x363475,0xc9))[_0x88a2('0x3d')](handleError(_0x363475,null));};exports[_0x88a2('0xf')]=function(_0xe8d957,_0x9ef5ac){if(_0xe8d957[_0x88a2('0x43')]['id']){delete _0xe8d957[_0x88a2('0x43')]['id'];}return db[_0x88a2('0x17')][_0x88a2('0x41')]({'where':{'id':_0xe8d957['params']['id']}})[_0x88a2('0x10')](handleEntityNotFound(_0x9ef5ac,null))['then'](saveUpdates(_0xe8d957[_0x88a2('0x43')],null))['then'](respondWithResult(_0x9ef5ac,null))[_0x88a2('0x3d')](handleError(_0x9ef5ac,null));};exports[_0x88a2('0x44')]=function(_0x1c5e6b,_0x37319d){return db[_0x88a2('0x17')][_0x88a2('0x44')]()[_0x88a2('0x10')](respondWithResult(_0x37319d,null))[_0x88a2('0x3d')](handleError(_0x37319d,null));};exports['destroy']=function(_0x1d773c,_0x1cc256){var _0x5b1f66;var _0x341e08=_0x1d773c['params']['id'];return db[_0x88a2('0x17')]['find']({'where':{'id':_0x1d773c[_0x88a2('0x3f')]['id']}})[_0x88a2('0x10')](handleEntityNotFound(_0x1cc256,null))[_0x88a2('0x10')](function(_0x18dae2){if(_0x18dae2){return _0x18dae2[_0x88a2('0x45')]()[_0x88a2('0x10')](function(_0x39bffe){return _0x39bffe;});}})[_0x88a2('0x10')](function(_0x2cf43b){_0x5b1f66=_0x2cf43b;if(_0x2cf43b){if(_0x2cf43b[_0x88a2('0x46')]||_0x2cf43b[_0x88a2('0x47')]){return db[_0x2cf43b[_0x88a2('0x46')]?'VoiceQueue':'Campaign'][_0x88a2('0x41')]({'where':{'id':_0x2cf43b[_0x88a2('0x46')]?_0x2cf43b[_0x88a2('0x46')]:_0x2cf43b[_0x88a2('0x47')]},'attributes':['id',_0x88a2('0x13')],'raw':!![]});}}})['then'](function(_0x2bc03d){var _0x4793ee={};if(_0x2bc03d){_['merge'](_0x4793ee,_[_0x88a2('0x48')](_0x5b1f66[_0x88a2('0x49')],['createdAt',_0x88a2('0x4a'),'id']));_0x4793ee['state']=0x15;_0x4793ee[_0x88a2('0x4b')]=_0x88a2('0x4c');_0x4793ee[_0x88a2('0x4d')]=_0x2bc03d[_0x88a2('0x13')];_0x4793ee[_0x88a2('0x4e')]=_0x1d773c[_0x88a2('0x4f')]['name'];_0x4793ee[_0x88a2('0x50')]=_0x1d773c[_0x88a2('0x4f')]['id'];_0x4793ee[_0x88a2('0x4c')]=!![];_0x4793ee['deletedat']=moment()[_0x88a2('0x51')](_0x88a2('0x52'));_0x4793ee['calleridnum']=_0x5b1f66[_0x88a2('0x53')];_0x4793ee[_0x88a2('0x54')]=_0x5b1f66['VoiceQueueId']?'queue':_0x88a2('0x55');return db[_0x88a2('0x56')]['find']({'where':{'id':_0x4793ee[_0x88a2('0x57')]},'attributes':[_0x88a2('0x58'),_0x88a2('0x59')]})[_0x88a2('0x10')](function(_0xa62fec){if(!_[_0x88a2('0x5a')](_0x1cc256)&&!_[_0x88a2('0x5a')](_0xa62fec['firstName'])){_0x4793ee[_0x88a2('0x5b')]=_0xa62fec[_0x88a2('0x58')];if(!_[_0x88a2('0x5a')](_0xa62fec['lastName'])){_0x4793ee['calleridname']+='\x20'+_0xa62fec['lastName'];}}})[_0x88a2('0x5c')](function(){return db[_0x88a2('0x5d')][_0x88a2('0x42')](_0x4793ee);});}})['then'](function(_0x3aba26){return db[_0x88a2('0x5e')][_0x88a2('0x45')]({'where':{'CmHopperId':_0x341e08}});})[_0x88a2('0x10')](function(){return _0x1cc256[_0x88a2('0x7')](0xcc)[_0x88a2('0x5f')]();})['catch'](handleError(_0x1cc256,null));};exports['getPreview']=function(_0x29371a,_0x5599d1){var _0x4d4411=[];return db[_0x88a2('0x56')][_0x88a2('0x44')]()[_0x88a2('0x10')](function(_0x291f1f){_0x4d4411=_[_0x88a2('0x1b')](_0x291f1f);return _0x29371a['user']['getVoiceQueues']({'where':{'type':_0x88a2('0x60'),'dialActive':!![],'dialMethod':_0x88a2('0x61')},'attributes':['id',_0x88a2('0x62'),_0x88a2('0x63')],'raw':!![]});})[_0x88a2('0x10')](function(_0xb99aaa){if(_0xb99aaa&&_0xb99aaa[_0x88a2('0x2e')]){return db[_0x88a2('0x64')][_0x88a2('0x65')](function(_0x485489){var _0x541172={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x88a2('0x51')](_0x88a2('0x52'))},'VoiceQueueId':{'$in':_['map'](_0xb99aaa,'id')},'$or':[{'UserId':null},{'UserId':_0x29371a['user']['id']}]};var _0x5e538c={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0xb99aaa)[_0x88a2('0x33')]([_0x88a2('0x63'),0x0])[_0x88a2('0x16')]('id')[_0x88a2('0x66')]()},'$or':[{'UserId':null},{'UserId':_0x29371a['user']['id']}]};var _0x203e60={'$or':[_0x541172,_0x5e538c]};var _0x3b76bf=[];if(_0x29371a[_0x88a2('0x43')][_0x88a2('0x67')]&&_0x29371a[_0x88a2('0x43')][_0x88a2('0x67')]===_0x88a2('0x68')){if(!_['isEmpty'](_0x29371a['body'][_0x88a2('0x69')])){_0x203e60['id']={'$in':_0x29371a['body']['hopperIds']};}_0x3b76bf=[[_0x88a2('0x6a'),_0x88a2('0x6b')],[_0x88a2('0x6c'),_0xb99aaa[0x0][_0x88a2('0x62')]===_0x88a2('0x6b')?'DESC':_0x88a2('0x6b')],db['sequelize'][_0x88a2('0x6d')]('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id',_0x88a2('0x6e')]];}else{if(!_['isEmpty'](_0x29371a[_0x88a2('0x43')][_0x88a2('0x69')])){_0x203e60['id']={'$notIn':_0x29371a[_0x88a2('0x43')][_0x88a2('0x69')]};}_0x3b76bf=[[_0x88a2('0x6a'),_0x88a2('0x6e')],[_0x88a2('0x6c'),_0xb99aaa[0x0][_0x88a2('0x62')]],db[_0x88a2('0x64')][_0x88a2('0x6d')]('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id',_0x88a2('0x6b')]];}return db[_0x88a2('0x17')]['findOne']({'attributes':['id',_0x88a2('0x6f'),'phone','recallme'],'where':_0x203e60,'order':_0x3b76bf,'transaction':_0x485489,'lock':_0x485489[_0x88a2('0x70')][_0x88a2('0x71')],'include':[{'model':db[_0x88a2('0x56')],'as':_0x88a2('0x72'),'attributes':_0x4d4411,'include':[{'model':db[_0x88a2('0x73')],'as':_0x88a2('0x74'),'attributes':['id','name']}]},{'model':db[_0x88a2('0x75')],'as':_0x88a2('0x76'),'attributes':['id',_0x88a2('0x13')]},{'model':db[_0x88a2('0x77')],'as':'Queue','attributes':['id','name',_0x88a2('0x78')]}]})[_0x88a2('0x10')](function(_0x585409){if(_0x585409){return _0x585409[_0x88a2('0xf')]({'UserId':_0x29371a[_0x88a2('0x4f')]['id']},{'transaction':_0x485489});}});});}})[_0x88a2('0x10')](handleEntityNotFound(_0x5599d1,null))[_0x88a2('0x10')](respondWithResult(_0x5599d1,null))['catch'](handleError(_0x5599d1,null));};exports[_0x88a2('0x79')]=function(_0x14c831,_0x1db40c,_0x1350b2){var _0x54b65d=[];var _0x3c8f98=_0x14c831['params']['id'];var _0x149f0e=_0x14c831[_0x88a2('0x4f')]['id'];return db[_0x88a2('0x56')]['describe']()[_0x88a2('0x10')](function(_0x381ea4){_0x54b65d=_['keys'](_0x381ea4);return db[_0x88a2('0x64')][_0x88a2('0x65')](function(_0x1bf412){const _0xf9f243={'id':_0x3c8f98};return db[_0x88a2('0x17')][_0x88a2('0x7a')]({'attributes':['id',_0x88a2('0x6f'),_0x88a2('0x7b')],'where':_0xf9f243,'transaction':_0x1bf412,'lock':_0x1bf412['LOCK'][_0x88a2('0x71')],'include':[{'model':db[_0x88a2('0x56')],'as':_0x88a2('0x72'),'attributes':_0x54b65d,'include':[{'model':db[_0x88a2('0x73')],'as':'Company','attributes':['id',_0x88a2('0x13')]}]},{'model':db[_0x88a2('0x75')],'as':_0x88a2('0x76'),'attributes':['id',_0x88a2('0x13')]},{'model':db[_0x88a2('0x77')],'as':_0x88a2('0x7c'),'attributes':['id',_0x88a2('0x13'),_0x88a2('0x78')]}]})[_0x88a2('0x10')](function(_0xcb1375){if(_0xcb1375){return _0xcb1375['update']({'UserId':_0x149f0e},{'transaction':_0x1bf412});}});});})[_0x88a2('0x10')](handleEntityNotFound(_0x1db40c,null))[_0x88a2('0x10')](respondWithResult(_0x1db40c,null))[_0x88a2('0x3d')](handleError(_0x1db40c,null));};exports[_0x88a2('0x7d')]=function(_0x9d26d1,_0xc3c2f2){return _0x9d26d1[_0x88a2('0x4f')]['getVoiceQueues']({'where':{'type':_0x88a2('0x60'),'dialActive':!![],'dialMethod':_0x88a2('0x61')},'attributes':['id'],'raw':!![]})['then'](function(_0x1f1824){if(_0x1f1824&&_0x1f1824[_0x88a2('0x2e')]){return db['CmHopper'][_0x88a2('0xb')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x88a2('0x51')](_0x88a2('0x52'))},'VoiceQueueId':{'$in':_[_0x88a2('0x16')](_0x1f1824,'id')},'$or':[{'UserId':null},{'UserId':_0x9d26d1[_0x88a2('0x4f')]['id']}]}});}return 0x0;})['then'](function(_0x5abf8c){if(!_['isNil'](_0x5abf8c)&&_[_0x88a2('0x7e')](_0x5abf8c)){return _0xc3c2f2[_0x88a2('0x7')](0xc8)[_0x88a2('0x8')]({'contacts':_0x5abf8c});}else{logger[_0x88a2('0x11')](_0x88a2('0x7f'),_0x88a2('0x7d'),0x194,_0x88a2('0x80'));_0xc3c2f2['sendStatus'](0x194);}})[_0x88a2('0x3d')](handleError(_0xc3c2f2,null));};exports['getTimezones']=function(_0x912355,_0x5abbd9){var _0x1430ef=shared['timezones'];var _0x526b5a=[];_[_0x88a2('0x16')](_0x1430ef,function(_0x4d9afd){_0x526b5a[_0x88a2('0x81')]({'id':_0x4d9afd['name'],'name':_0x4d9afd[_0x88a2('0x13')],'utcOffset':_0x4d9afd[_0x88a2('0x82')]});});return _0x5abbd9[_0x88a2('0x7')](0xc8)['json']({'tz':_0x526b5a});};exports[_0x88a2('0x83')]=function(_0x4612b5,_0x5212aa){var _0x392317=shared[_0x88a2('0x84')];var _0x24c54a={};if(!_[_0x88a2('0x5a')](_0x392317[_0x4612b5['body']['id']]))_0x24c54a=_0x392317[_0x4612b5[_0x88a2('0x43')]['id']];return _0x5212aa[_0x88a2('0x7')](0xc8)['json'](_0x24c54a);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 0b0c744..a066d02 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 _0x2bd8=['CmHopper','cm_hopper','scheduledat','phone','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./cmHopper.attributes','exports','define'];(function(_0x4d0806,_0x106216){var _0xe56cec=function(_0x4977c1){while(--_0x4977c1){_0x4d0806['push'](_0x4d0806['shift']());}};_0xe56cec(++_0x106216);}(_0x2bd8,0x130));var _0x82bd=function(_0x48dc3d,_0x2b1822){_0x48dc3d=_0x48dc3d-0x0;var _0x296f66=_0x2bd8[_0x48dc3d];return _0x296f66;};'use strict';var _=require(_0x82bd('0x0'));var util=require('util');var logger=require(_0x82bd('0x1'))(_0x82bd('0x2'));var moment=require(_0x82bd('0x3'));var BPromise=require(_0x82bd('0x4'));var rp=require(_0x82bd('0x5'));var fs=require('fs');var path=require(_0x82bd('0x6'));var rimraf=require(_0x82bd('0x7'));var config=require('../../config/environment');var attributes=require(_0x82bd('0x8'));module[_0x82bd('0x9')]=function(_0x3bf810,_0x5ceb60){return _0x3bf810[_0x82bd('0xa')](_0x82bd('0xb'),attributes,{'tableName':_0x82bd('0xc'),'paranoid':![],'indexes':[{'name':_0x82bd('0xd'),'fields':['scheduledat']},{'name':_0x82bd('0xe'),'fields':['phone']},{'name':'priority','fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file +var _0x01d9=['define','CmHopper','cm_hopper','scheduledat','phone','priority','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes','exports'];(function(_0x4c8812,_0xa9d102){var _0x42d129=function(_0x139047){while(--_0x139047){_0x4c8812['push'](_0x4c8812['shift']());}};_0x42d129(++_0xa9d102);}(_0x01d9,0x6c));var _0x901d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x01d9[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x901d('0x0'));var util=require(_0x901d('0x1'));var logger=require(_0x901d('0x2'))(_0x901d('0x3'));var moment=require('moment');var BPromise=require(_0x901d('0x4'));var rp=require(_0x901d('0x5'));var fs=require('fs');var path=require(_0x901d('0x6'));var rimraf=require(_0x901d('0x7'));var config=require(_0x901d('0x8'));var attributes=require(_0x901d('0x9'));module[_0x901d('0xa')]=function(_0x4e7842,_0x1e5d7d){return _0x4e7842[_0x901d('0xb')](_0x901d('0xc'),attributes,{'tableName':_0x901d('0xd'),'paranoid':![],'indexes':[{'name':_0x901d('0xe'),'fields':[_0x901d('0xe')]},{'name':_0x901d('0xf'),'fields':[_0x901d('0xf')]},{'name':_0x901d('0x10'),'fields':[_0x901d('0x10')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index c10cba4..0575786 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 _0x8da1=['User','Agent','name','voicePause','push','includes','length','dataValues','ContactId','MoveContactManagedDialer','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','destroy','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','contactsRescheduled','GetContactRecallMe','UserId','UPDATE','all','GetCmHopperPreview','GetContactByPhone','phone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','interval','availableAgentsIds','\x20MINUTE','List','moment','bluebird','../../mysqldb','../../config/logger','rpc','GetCmHopper','findAll','raw','options','attributes','limit','include','map','model','then','debug','stringify','catch','message','error','ShowCmHopper','CmHopper','find','where','info','CreateCmHopper','create','UpdateCmHopper','update','body','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','GetContactDialer','CmContact','describe','sequelize','transaction','order','keys'];(function(_0x5e38bc,_0x15c819){var _0xd5d4f6=function(_0x3b183e){while(--_0x3b183e){_0x5e38bc['push'](_0x5e38bc['shift']());}};_0xd5d4f6(++_0x15c819);}(_0x8da1,0x1a6));var _0x18da=function(_0x55054d,_0x35adc6){_0x55054d=_0x55054d-0x0;var _0x5324fa=_0x8da1[_0x55054d];return _0x5324fa;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x18da('0x0'));var BPromise=require(_0x18da('0x1'));var db=require(_0x18da('0x2'))['db'];var logger=require(_0x18da('0x3'))(_0x18da('0x4'));exports[_0x18da('0x5')]=function(_0xf4689c){var _0x4a70ae=this;return new Promise(function(_0x2d95ac,_0x3a092f){return db['CmHopper'][_0x18da('0x6')]({'raw':_0xf4689c['options']?_0xf4689c['options'][_0x18da('0x7')]===undefined?!![]:![]:!![],'where':_0xf4689c[_0x18da('0x8')]?_0xf4689c['options']['where']||null:null,'attributes':_0xf4689c[_0x18da('0x8')]?_0xf4689c['options'][_0x18da('0x9')]||null:null,'limit':_0xf4689c[_0x18da('0x8')]?_0xf4689c['options'][_0x18da('0xa')]||null:null,'include':_0xf4689c[_0x18da('0x8')]?_0xf4689c[_0x18da('0x8')][_0x18da('0xb')]?_['map'](_0xf4689c[_0x18da('0x8')][_0x18da('0xb')],function(_0x599d4a){return{'model':db[_0x599d4a['model']],'as':_0x599d4a['as'],'attributes':_0x599d4a[_0x18da('0x9')],'include':_0x599d4a[_0x18da('0xb')]?_[_0x18da('0xc')](_0x599d4a[_0x18da('0xb')],function(_0x4d6cb6){return{'model':db[_0x4d6cb6[_0x18da('0xd')]],'as':_0x4d6cb6['as'],'attributes':_0x4d6cb6[_0x18da('0x9')],'include':_0x4d6cb6['include']?_['map'](_0x4d6cb6['include'],function(_0x1c42c8){return{'model':db[_0x1c42c8[_0x18da('0xd')]],'as':_0x1c42c8['as'],'attributes':_0x1c42c8[_0x18da('0x9')]};}):[]};}):[]};}):[]:[]})[_0x18da('0xe')](function(_0x2d57d7){logger['info']('GetCmHopper',_0xf4689c);logger[_0x18da('0xf')](_0x18da('0x5'),_0xf4689c,JSON[_0x18da('0x10')](_0x2d57d7));_0x2d95ac(_0x2d57d7);})[_0x18da('0x11')](function(_0xeceffc){logger['error'](_0x18da('0x5'),_0xeceffc[_0x18da('0x12')],_0xf4689c);_0x3a092f(_0x4a70ae[_0x18da('0x13')](0x1f4,_0xeceffc[_0x18da('0x12')]));});});};exports[_0x18da('0x14')]=function(_0x5ee2d4){var _0x1ac007=this;return new Promise(function(_0x2697f5,_0x1ad984){return db[_0x18da('0x15')][_0x18da('0x16')]({'raw':_0x5ee2d4[_0x18da('0x8')]?_0x5ee2d4[_0x18da('0x8')][_0x18da('0x7')]===undefined?!![]:![]:!![],'where':_0x5ee2d4[_0x18da('0x8')]?_0x5ee2d4['options'][_0x18da('0x17')]||null:null,'attributes':_0x5ee2d4[_0x18da('0x8')]?_0x5ee2d4['options'][_0x18da('0x9')]||null:null,'include':_0x5ee2d4[_0x18da('0x8')]?_0x5ee2d4[_0x18da('0x8')][_0x18da('0xb')]?_['map'](_0x5ee2d4[_0x18da('0x8')][_0x18da('0xb')],function(_0x1ce018){return{'model':db[_0x1ce018['model']],'as':_0x1ce018['as'],'attributes':_0x1ce018['attributes'],'include':_0x1ce018['include']?_[_0x18da('0xc')](_0x1ce018['include'],function(_0x4373df){return{'model':db[_0x4373df[_0x18da('0xd')]],'as':_0x4373df['as'],'attributes':_0x4373df[_0x18da('0x9')],'include':_0x4373df[_0x18da('0xb')]?_[_0x18da('0xc')](_0x4373df[_0x18da('0xb')],function(_0x1aba7a){return{'model':db[_0x1aba7a['model']],'as':_0x1aba7a['as'],'attributes':_0x1aba7a[_0x18da('0x9')]};}):[]};}):[]};}):[]:[]})[_0x18da('0xe')](function(_0x317a49){logger[_0x18da('0x18')](_0x18da('0x14'),_0x5ee2d4);logger[_0x18da('0xf')]('ShowCmHopper',_0x5ee2d4,JSON[_0x18da('0x10')](_0x317a49));_0x2697f5(_0x317a49);})[_0x18da('0x11')](function(_0x1cf0b0){logger[_0x18da('0x13')](_0x18da('0x14'),_0x1cf0b0[_0x18da('0x12')],_0x5ee2d4);_0x1ad984(_0x1ac007[_0x18da('0x13')](0x1f4,_0x1cf0b0[_0x18da('0x12')]));});});};exports[_0x18da('0x19')]=function(_0x248ce8){var _0x59a5fd=this;return new Promise(function(_0x1f0e57,_0x9d1deb){return db[_0x18da('0x15')][_0x18da('0x1a')](_0x248ce8['body'],{'raw':_0x248ce8[_0x18da('0x8')]?_0x248ce8['options'][_0x18da('0x7')]===undefined?!![]:![]:!![]})[_0x18da('0xe')](function(_0x600009){logger[_0x18da('0x18')](_0x18da('0x19'),_0x248ce8);logger[_0x18da('0xf')](_0x18da('0x19'),_0x248ce8,JSON['stringify'](_0x600009));_0x1f0e57(_0x600009);})[_0x18da('0x11')](function(_0x5336f9){logger[_0x18da('0x13')](_0x18da('0x19'),_0x5336f9[_0x18da('0x12')],_0x248ce8);_0x9d1deb(_0x59a5fd[_0x18da('0x13')](0x1f4,_0x5336f9[_0x18da('0x12')]));});});};exports[_0x18da('0x1b')]=function(_0x4c730b){var _0x542a3d=this;return new Promise(function(_0xbb25dd,_0x4da79e){return db[_0x18da('0x15')][_0x18da('0x1c')](_0x4c730b[_0x18da('0x1d')],{'raw':_0x4c730b['options']?_0x4c730b[_0x18da('0x8')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4c730b['options']?_0x4c730b[_0x18da('0x8')][_0x18da('0x17')]||null:null,'attributes':_0x4c730b[_0x18da('0x8')]?_0x4c730b[_0x18da('0x8')][_0x18da('0x9')]||null:null,'limit':_0x4c730b[_0x18da('0x8')]?_0x4c730b['options']['limit']||null:null})[_0x18da('0xe')](function(_0xa1f612){logger[_0x18da('0x18')](_0x18da('0x1b'),_0x4c730b);logger[_0x18da('0x18')](_0x18da('0x1e'),JSON['stringify'](_0x4c730b['options'][_0x18da('0x17')]),_0x4c730b['body'][_0x18da('0x1f')]);logger[_0x18da('0xf')](_0x18da('0x1b'),_0x4c730b,JSON[_0x18da('0x10')](_0xa1f612));_0xbb25dd(_0xa1f612);})[_0x18da('0x11')](function(_0x3521e2){logger[_0x18da('0x13')]('UpdateCmHopper',_0x3521e2[_0x18da('0x12')],_0x4c730b);_0x4da79e(_0x542a3d[_0x18da('0x13')](0x1f4,_0x3521e2[_0x18da('0x12')]));});});};exports[_0x18da('0x20')]=function(_0x1eedb6){var _0x59d7a1=this;return new Promise(function(_0x35a2d1,_0x2aa777){return db['CmHopper']['destroy']({'where':_0x1eedb6[_0x18da('0x8')]?_0x1eedb6[_0x18da('0x8')][_0x18da('0x17')]||null:null})[_0x18da('0xe')](function(_0x2f7797){logger[_0x18da('0x18')](_0x18da('0x20'),_0x1eedb6);logger[_0x18da('0xf')]('DestroyCmHopper',_0x1eedb6,JSON[_0x18da('0x10')](_0x2f7797));_0x35a2d1(_0x2f7797);})['catch'](function(_0x557dfe){logger[_0x18da('0x13')](_0x18da('0x20'),_0x557dfe[_0x18da('0x12')],_0x1eedb6);_0x2aa777(_0x59d7a1[_0x18da('0x13')](0x1f4,_0x557dfe[_0x18da('0x12')]));});});};exports[_0x18da('0x21')]=function(_0x6048ff){var _0x597c95=this;return new Promise(function(_0x1ae05d,_0x2afdb6){return db[_0x18da('0x22')][_0x18da('0x23')]()[_0x18da('0xe')](function(_0x45687){return db[_0x18da('0x24')][_0x18da('0x25')](function(_0x886dbb){return db[_0x18da('0x15')]['findAll']({'where':_0x6048ff[_0x18da('0x8')]?_0x6048ff['options'][_0x18da('0x17')]||null:null,'attributes':_0x6048ff['options']?_0x6048ff[_0x18da('0x8')]['attributes']||null:null,'limit':_0x6048ff[_0x18da('0x8')]?_0x6048ff[_0x18da('0x8')][_0x18da('0xa')]||null:null,'order':_0x6048ff[_0x18da('0x8')]?_0x6048ff[_0x18da('0x8')][_0x18da('0x26')]||null:null,'transaction':_0x886dbb,'lock':_0x886dbb['LOCK']['UPDATE'],'include':[{'model':db['CmContact'],'as':'Contact','attributes':_[_0x18da('0x27')](_0x45687)},{'model':db[_0x18da('0x28')],'as':_0x18da('0x29'),'attributes':['id',_0x18da('0x2a'),_0x18da('0x2b')]}]})['then'](function(_0x44960f){var _0x5b98ff=[];var _0x463943=[];for(var _0x2d0a5c=0x0;_0x2d0a5c<_0x44960f['length'];_0x2d0a5c+=0x1){var _0x536bd4=_0x44960f[_0x2d0a5c]['UserId'];if(_0x536bd4===null){_0x5b98ff[_0x18da('0x2c')](_0x44960f[_0x2d0a5c][_0x18da('0x1c')](_0x6048ff[_0x18da('0x1d')],{'transaction':_0x886dbb}));}else if(!_0x463943[_0x18da('0x2d')](_0x536bd4)){_0x463943[_0x18da('0x2c')](_0x536bd4);_0x5b98ff[_0x18da('0x2c')](_0x44960f[_0x2d0a5c]['update'](_0x6048ff['body'],{'transaction':_0x886dbb}));}}return BPromise['all'](_0x5b98ff);});})[_0x18da('0xe')](function(_0x387c0c){logger[_0x18da('0x18')]('GetContactDialer',_0x6048ff);if(_0x387c0c[_0x18da('0x2e')]>0x0){logger['info']('GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]',_0x387c0c[0x0][_0x18da('0x2f')]['id'],_0x387c0c[0x0][_0x18da('0x2f')][_0x18da('0x30')],_0x387c0c[0x0]['dataValues'][_0x18da('0x1f')]);}logger[_0x18da('0xf')]('GetContactDialer',_0x6048ff,JSON['stringify'](_0x387c0c));_0x1ae05d(_0x387c0c);})[_0x18da('0x11')](function(_0x9e0805){logger[_0x18da('0x13')](_0x18da('0x21'),_0x9e0805[_0x18da('0x12')],_0x6048ff);_0x2afdb6(_0x597c95[_0x18da('0x13')](0x1f4,_0x9e0805[_0x18da('0x12')]));});});});};exports[_0x18da('0x31')]=function(_0x4a90f3){var _0x92846c=this;return new Promise(function(_0x2c771c,_0x5e594d){return db[_0x18da('0x24')][_0x18da('0x25')](function(_0x322349){return db[_0x18da('0x32')][_0x18da('0x1a')](_0x4a90f3[_0x18da('0x1d')],{'raw':_0x4a90f3[_0x18da('0x8')]?_0x4a90f3[_0x18da('0x8')][_0x18da('0x7')]===undefined?!![]:![]:!![],'transaction':_0x322349})[_0x18da('0xe')](function(){logger['info'](_0x18da('0x33'),JSON['stringify'](_0x4a90f3[_0x18da('0x8')][_0x18da('0x17')]),_0x4a90f3[_0x18da('0x8')]['where'][_0x18da('0x1f')]);return db[_0x18da('0x15')][_0x18da('0x34')]({'where':_0x4a90f3[_0x18da('0x8')]?_0x4a90f3['options'][_0x18da('0x17')]||null:null,'transaction':_0x322349});});})['then'](function(_0x402514){logger[_0x18da('0x18')](_0x18da('0x31'),_0x4a90f3);logger[_0x18da('0xf')](_0x18da('0x31'),_0x4a90f3,JSON[_0x18da('0x10')](_0x402514));_0x2c771c(_0x402514);})[_0x18da('0x11')](function(_0x1b7915){logger[_0x18da('0x13')](_0x18da('0x31'),_0x1b7915['message'],_0x4a90f3);_0x5e594d(_0x92846c[_0x18da('0x13')](0x1f4,_0x1b7915[_0x18da('0x12')]));});});};exports[_0x18da('0x35')]=function(_0x13934c){var _0x40f66c=this;return new Promise(function(_0x3780a9,_0x4ad8f8){return db['CmHopper']['findAll']({'raw':_0x13934c[_0x18da('0x8')]?_0x13934c[_0x18da('0x8')]['raw']===undefined?!![]:![]:!![],'where':_0x13934c[_0x18da('0x8')]?_0x13934c[_0x18da('0x8')][_0x18da('0x17')]||null:null,'attributes':[[db[_0x18da('0x24')]['fn'](_0x18da('0x36'),db[_0x18da('0x24')]['fn']('IF',db[_0x18da('0x24')][_0x18da('0x37')](_0x18da('0x38')+util[_0x18da('0x39')](_0x18da('0x3a'),moment()[_0x18da('0x39')](_0x18da('0x3b')))+'\x20,\x201,\x20null'))),_0x18da('0x3c')]]})['then'](function(_0x3c5419){logger[_0x18da('0x18')](_0x18da('0x35'),_0x13934c);logger[_0x18da('0xf')](_0x18da('0x35'),_0x13934c,JSON[_0x18da('0x10')](_0x3c5419));_0x3780a9(_0x3c5419);})[_0x18da('0x11')](function(_0xf9715f){logger[_0x18da('0x13')](_0x18da('0x35'),_0xf9715f[_0x18da('0x12')],_0x13934c);_0x4ad8f8(_0x40f66c[_0x18da('0x13')](0x1f4,_0xf9715f[_0x18da('0x12')]));});});};exports[_0x18da('0x3d')]=function(_0x28da71){var _0x4604c2=this;return new Promise(function(_0x439466,_0x406330){return db[_0x18da('0x22')][_0x18da('0x23')]()[_0x18da('0xe')](function(){return db[_0x18da('0x24')][_0x18da('0x25')](function(_0x322c80){return db[_0x18da('0x15')]['findAll']({'where':_0x28da71['options']?_0x28da71['options'][_0x18da('0x17')]||null:null,'attributes':_0x28da71[_0x18da('0x8')]?_0x28da71[_0x18da('0x8')]['attributes']||null:null,'limit':0x1,'order':_0x28da71[_0x18da('0x8')]?_0x28da71[_0x18da('0x8')]['order']||null:null,'group':db[_0x18da('0x15')][_0x18da('0x3e')],'transaction':_0x322c80,'lock':_0x322c80['LOCK'][_0x18da('0x3f')],'include':_0x28da71[_0x18da('0x8')]?_0x28da71[_0x18da('0x8')]['include']?_[_0x18da('0xc')](_0x28da71[_0x18da('0x8')][_0x18da('0xb')],function(_0x3ba4a7){return{'model':db[_0x3ba4a7[_0x18da('0xd')]],'as':_0x3ba4a7['as'],'attributes':_0x3ba4a7[_0x18da('0x9')],'include':_0x3ba4a7[_0x18da('0xb')]?_[_0x18da('0xc')](_0x3ba4a7['include'],function(_0x4aaef8){return{'model':db[_0x4aaef8[_0x18da('0xd')]],'as':_0x4aaef8['as'],'attributes':_0x4aaef8[_0x18da('0x9')],'include':_0x4aaef8[_0x18da('0xb')]?_['map'](_0x4aaef8[_0x18da('0xb')],function(_0xb68cb3){return{'model':db[_0xb68cb3[_0x18da('0xd')]],'as':_0xb68cb3['as'],'attributes':_0xb68cb3['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x493d93){var _0x449d96=[];for(var _0x4a7e99=0x0;_0x4a7e99<_0x493d93['length'];_0x4a7e99+=0x1){_0x449d96[_0x18da('0x2c')](_0x493d93[_0x4a7e99][_0x18da('0x1c')](_0x28da71[_0x18da('0x1d')],{'transaction':_0x322c80}));}return BPromise[_0x18da('0x40')](_0x449d96);});})['then'](function(_0x3bd8b1){logger[_0x18da('0x18')](_0x18da('0x3d'),_0x28da71);logger['debug'](_0x18da('0x3d'),_0x28da71,JSON[_0x18da('0x10')](_0x3bd8b1));_0x439466(_0x3bd8b1);})[_0x18da('0x11')](function(_0x2919e6){logger['error']('GetContactRecallMe',_0x2919e6[_0x18da('0x12')],_0x28da71);_0x406330(_0x4604c2[_0x18da('0x13')](0x1f4,_0x2919e6[_0x18da('0x12')]));});});});};exports[_0x18da('0x41')]=function(_0xa0275e){var _0x11c5cd=this;return new Promise(function(_0x47151c,_0x47db4d){db[_0x18da('0x22')][_0x18da('0x23')]()[_0x18da('0xe')](function(_0x4b4113){return db['CmHopper'][_0x18da('0x6')]({'raw':_0xa0275e[_0x18da('0x8')]?_0xa0275e[_0x18da('0x8')][_0x18da('0x7')]===undefined?!![]:![]:!![],'where':_0xa0275e[_0x18da('0x8')]?_0xa0275e[_0x18da('0x8')][_0x18da('0x17')]||null:null,'attributes':_0xa0275e[_0x18da('0x8')]?_0xa0275e[_0x18da('0x8')][_0x18da('0x9')]||null:null,'limit':_0xa0275e[_0x18da('0x8')]?_0xa0275e[_0x18da('0x8')][_0x18da('0xa')]||null:null,'include':_0xa0275e[_0x18da('0x8')]?_0xa0275e[_0x18da('0x8')][_0x18da('0xb')]?_[_0x18da('0xc')](_0xa0275e[_0x18da('0x8')][_0x18da('0xb')],function(_0x37c145){return{'model':db[_0x37c145['model']],'as':_0x37c145['as'],'attributes':_0x37c145['as']==='Contact'?_['keys'](_0x4b4113):_0x37c145[_0x18da('0x9')],'include':_0x37c145[_0x18da('0xb')]?_['map'](_0x37c145[_0x18da('0xb')],function(_0x1d5b0c){return{'model':db[_0x1d5b0c['model']],'as':_0x1d5b0c['as'],'attributes':_0x1d5b0c[_0x18da('0x9')],'include':_0x1d5b0c[_0x18da('0xb')]?_[_0x18da('0xc')](_0x1d5b0c['include'],function(_0x231526){return{'model':db[_0x231526[_0x18da('0xd')]],'as':_0x231526['as'],'attributes':_0x231526[_0x18da('0x9')]};}):[]};}):[]};}):[]:[]})[_0x18da('0xe')](function(_0x16071b){logger[_0x18da('0x18')](_0x18da('0x5'),_0xa0275e);logger[_0x18da('0xf')](_0x18da('0x5'),_0xa0275e,JSON['stringify'](_0x16071b));_0x47151c(_0x16071b);})['catch'](function(_0x594f56){logger['error'](_0x18da('0x5'),_0x594f56[_0x18da('0x12')],_0xa0275e);_0x47db4d(_0x11c5cd[_0x18da('0x13')](0x1f4,_0x594f56[_0x18da('0x12')]));});});});};exports[_0x18da('0x42')]=function(_0x20744c){var _0x39f35f=this;return new Promise(function(_0x1b5545,_0x3b6bf2){return db[_0x18da('0x22')]['findOne']({'raw':!![],'where':{'phone':_0x20744c['options'][_0x18da('0x17')][_0x18da('0x43')]},'attributes':['id',_0x18da('0x44')],'order':[['id',_0x18da('0x45')]]})['then'](function(_0x26188c){logger[_0x18da('0x18')](_0x18da('0x46'),_0x20744c);logger['debug']('getContactByPhone',_0x20744c,JSON['stringify'](_0x26188c));_0x1b5545(_0x26188c);})[_0x18da('0x11')](function(_0x199769){logger[_0x18da('0x13')]('getContactByPhone',_0x199769[_0x18da('0x12')],_0x20744c);_0x3b6bf2(_0x39f35f[_0x18da('0x13')](0x1f4,_0x199769['message']));});});};exports[_0x18da('0x47')]=function(_0x17346d){var _0x24b3f7=this;return new Promise(function(_0x495a07,_0x557cf1){return db[_0x18da('0x24')][_0x18da('0x25')](function(_0x12ca0c){var _0x5a8dff=_0x17346d['options']&&_0x17346d[_0x18da('0x8')][_0x18da('0x17')]?_0x17346d[_0x18da('0x8')][_0x18da('0x17')]:{};return db[_0x18da('0x15')]['update'](_0x17346d['body'],{'where':_0x5a8dff,'transaction':_0x12ca0c})[_0x18da('0xe')](function(_0x3527b1){logger[_0x18da('0x18')](_0x18da('0x47'),_0x17346d);logger[_0x18da('0xf')](_0x18da('0x47'),_0x17346d,JSON['stringify'](_0x3527b1));_0x495a07(_0x3527b1);})[_0x18da('0x11')](function(_0x39780a){logger[_0x18da('0x13')]('ResetActiveCalls',_0x39780a['message'],_0x17346d);_0x557cf1(_0x24b3f7[_0x18da('0x13')](0x1f4,_0x39780a[_0x18da('0x12')]));});});});};exports[_0x18da('0x48')]=function(_0x22d449){var _0x15a67f=this;var _0x469901=_0x22d449[_0x18da('0x1d')][_0x18da('0x17')]['voiceQueueIds'];var _0x375f8e=_0x22d449[_0x18da('0x1d')][_0x18da('0x17')][_0x18da('0x49')];var _0x4acb6e=_0x22d449['body'][_0x18da('0x17')][_0x18da('0x4a')];return new Promise(function(_0x3a799b,_0x4921cc){return db[_0x18da('0x15')]['findAll']({'where':{'voiceQueueId':{'$in':_0x469901},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0x18da('0x24')][_0x18da('0x37')]('NOW()\x20+\x20INTERVAL\x20'+_0x375f8e+_0x18da('0x4b')),'$gt':db[_0x18da('0x24')][_0x18da('0x37')]('NOW()')}},'UserId':{'$in':_0x4acb6e}},'include':[{'model':db[_0x18da('0x22')],'as':'Contact'},{'model':db[_0x18da('0x28')],'as':'Agent','attributes':['id',_0x18da('0x2a'),_0x18da('0x2b')]},{'model':db['CmList'],'as':_0x18da('0x4c')}]})[_0x18da('0xe')](function(_0x50c4d6){if(_0x50c4d6[_0x18da('0x2e')]>0x0){return db[_0x18da('0x24')][_0x18da('0x25')](function(_0x2fd0f0){return db[_0x18da('0x15')][_0x18da('0x1c')]({'recallmeNotifiedDate':db['sequelize'][_0x18da('0x37')]('NOW()')},{'where':{'id':{'$in':_[_0x18da('0xc')](_0x50c4d6,'id')}},'transaction':_0x2fd0f0})['then'](function(){_0x3a799b(_0x50c4d6);})['catch'](function(_0x2c58f7){logger[_0x18da('0x13')](_0x18da('0x48'),_0x2c58f7[_0x18da('0x12')],_0x22d449);_0x4921cc(_0x15a67f[_0x18da('0x13')](0x1f4,_0x2c58f7[_0x18da('0x12')]));});})[_0x18da('0x11')](function(_0x1558d4){logger[_0x18da('0x13')](_0x18da('0x48'),_0x1558d4[_0x18da('0x12')],_0x22d449);_0x4921cc(_0x15a67f[_0x18da('0x13')](0x1f4,_0x1558d4[_0x18da('0x12')]));});}else{_0x3a799b(_0x50c4d6);}});});}; \ No newline at end of file +var _0x1bf0=['catch','error','message','ShowCmHopper','stringify','CreateCmHopper','create','then','UpdateCmHopper','update','body','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','sequelize','transaction','limit','order','LOCK','UPDATE','User','Agent','voicePause','length','UserId','includes','push','all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','MoveContactManagedDialer','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','contactsRescheduled','GetContactRecallMe','GetCmHopperPreview','Contact','keys','GetContactByPhone','findOne','phone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','interval','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','NOW()','CmList','List','moment','bluebird','../../mysqldb','../../config/logger','rpc','CmHopper','findAll','raw','options','where','map','include','model','attributes','info','GetCmHopper','debug'];(function(_0xf54c17,_0x76e3e7){var _0xe8844f=function(_0x1fcd11){while(--_0x1fcd11){_0xf54c17['push'](_0xf54c17['shift']());}};_0xe8844f(++_0x76e3e7);}(_0x1bf0,0x8f));var _0x01bf=function(_0x50cbc8,_0x427241){_0x50cbc8=_0x50cbc8-0x0;var _0x13e466=_0x1bf0[_0x50cbc8];return _0x13e466;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x01bf('0x0'));var BPromise=require(_0x01bf('0x1'));var db=require(_0x01bf('0x2'))['db'];var logger=require(_0x01bf('0x3'))(_0x01bf('0x4'));exports['GetCmHopper']=function(_0x32829a){var _0x5d11bb=this;return new Promise(function(_0x55b767,_0x39b2d5){return db[_0x01bf('0x5')][_0x01bf('0x6')]({'raw':_0x32829a['options']?_0x32829a['options'][_0x01bf('0x7')]===undefined?!![]:![]:!![],'where':_0x32829a[_0x01bf('0x8')]?_0x32829a['options'][_0x01bf('0x9')]||null:null,'attributes':_0x32829a[_0x01bf('0x8')]?_0x32829a[_0x01bf('0x8')]['attributes']||null:null,'limit':_0x32829a[_0x01bf('0x8')]?_0x32829a[_0x01bf('0x8')]['limit']||null:null,'include':_0x32829a[_0x01bf('0x8')]?_0x32829a[_0x01bf('0x8')]['include']?_[_0x01bf('0xa')](_0x32829a[_0x01bf('0x8')][_0x01bf('0xb')],function(_0x3f71fc){return{'model':db[_0x3f71fc['model']],'as':_0x3f71fc['as'],'attributes':_0x3f71fc['attributes'],'include':_0x3f71fc[_0x01bf('0xb')]?_['map'](_0x3f71fc[_0x01bf('0xb')],function(_0x1cad69){return{'model':db[_0x1cad69[_0x01bf('0xc')]],'as':_0x1cad69['as'],'attributes':_0x1cad69['attributes'],'include':_0x1cad69[_0x01bf('0xb')]?_['map'](_0x1cad69[_0x01bf('0xb')],function(_0x4dc6ce){return{'model':db[_0x4dc6ce[_0x01bf('0xc')]],'as':_0x4dc6ce['as'],'attributes':_0x4dc6ce[_0x01bf('0xd')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x504210){logger[_0x01bf('0xe')](_0x01bf('0xf'),_0x32829a);logger[_0x01bf('0x10')](_0x01bf('0xf'),_0x32829a,JSON['stringify'](_0x504210));_0x55b767(_0x504210);})[_0x01bf('0x11')](function(_0x19ef49){logger[_0x01bf('0x12')]('GetCmHopper',_0x19ef49[_0x01bf('0x13')],_0x32829a);_0x39b2d5(_0x5d11bb[_0x01bf('0x12')](0x1f4,_0x19ef49[_0x01bf('0x13')]));});});};exports[_0x01bf('0x14')]=function(_0x4f5a8f){var _0xef1a3=this;return new Promise(function(_0x203cb7,_0x4b12c6){return db['CmHopper']['find']({'raw':_0x4f5a8f[_0x01bf('0x8')]?_0x4f5a8f[_0x01bf('0x8')][_0x01bf('0x7')]===undefined?!![]:![]:!![],'where':_0x4f5a8f[_0x01bf('0x8')]?_0x4f5a8f[_0x01bf('0x8')][_0x01bf('0x9')]||null:null,'attributes':_0x4f5a8f[_0x01bf('0x8')]?_0x4f5a8f[_0x01bf('0x8')]['attributes']||null:null,'include':_0x4f5a8f[_0x01bf('0x8')]?_0x4f5a8f[_0x01bf('0x8')][_0x01bf('0xb')]?_[_0x01bf('0xa')](_0x4f5a8f['options'][_0x01bf('0xb')],function(_0x12cbd9){return{'model':db[_0x12cbd9['model']],'as':_0x12cbd9['as'],'attributes':_0x12cbd9[_0x01bf('0xd')],'include':_0x12cbd9['include']?_[_0x01bf('0xa')](_0x12cbd9[_0x01bf('0xb')],function(_0x112bd6){return{'model':db[_0x112bd6[_0x01bf('0xc')]],'as':_0x112bd6['as'],'attributes':_0x112bd6['attributes'],'include':_0x112bd6['include']?_[_0x01bf('0xa')](_0x112bd6[_0x01bf('0xb')],function(_0x4694c3){return{'model':db[_0x4694c3['model']],'as':_0x4694c3['as'],'attributes':_0x4694c3[_0x01bf('0xd')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x550976){logger['info'](_0x01bf('0x14'),_0x4f5a8f);logger['debug'](_0x01bf('0x14'),_0x4f5a8f,JSON[_0x01bf('0x15')](_0x550976));_0x203cb7(_0x550976);})[_0x01bf('0x11')](function(_0x5a4187){logger[_0x01bf('0x12')]('ShowCmHopper',_0x5a4187[_0x01bf('0x13')],_0x4f5a8f);_0x4b12c6(_0xef1a3[_0x01bf('0x12')](0x1f4,_0x5a4187[_0x01bf('0x13')]));});});};exports[_0x01bf('0x16')]=function(_0x57137d){var _0x2912e9=this;return new Promise(function(_0x15e747,_0x345b25){return db[_0x01bf('0x5')][_0x01bf('0x17')](_0x57137d['body'],{'raw':_0x57137d['options']?_0x57137d['options'][_0x01bf('0x7')]===undefined?!![]:![]:!![]})[_0x01bf('0x18')](function(_0x3118cd){logger[_0x01bf('0xe')](_0x01bf('0x16'),_0x57137d);logger[_0x01bf('0x10')](_0x01bf('0x16'),_0x57137d,JSON['stringify'](_0x3118cd));_0x15e747(_0x3118cd);})[_0x01bf('0x11')](function(_0x2487e4){logger[_0x01bf('0x12')](_0x01bf('0x16'),_0x2487e4[_0x01bf('0x13')],_0x57137d);_0x345b25(_0x2912e9[_0x01bf('0x12')](0x1f4,_0x2487e4[_0x01bf('0x13')]));});});};exports[_0x01bf('0x19')]=function(_0x2d301e){var _0x30eaf2=this;return new Promise(function(_0x2f1e3f,_0xc8d5c3){return db[_0x01bf('0x5')][_0x01bf('0x1a')](_0x2d301e[_0x01bf('0x1b')],{'raw':_0x2d301e[_0x01bf('0x8')]?_0x2d301e['options'][_0x01bf('0x7')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2d301e[_0x01bf('0x8')]?_0x2d301e[_0x01bf('0x8')]['where']||null:null,'attributes':_0x2d301e['options']?_0x2d301e[_0x01bf('0x8')]['attributes']||null:null,'limit':_0x2d301e['options']?_0x2d301e[_0x01bf('0x8')]['limit']||null:null})[_0x01bf('0x18')](function(_0x14f07f){logger[_0x01bf('0xe')]('UpdateCmHopper',_0x2d301e);logger[_0x01bf('0xe')](_0x01bf('0x1c'),JSON[_0x01bf('0x15')](_0x2d301e[_0x01bf('0x8')]['where']),_0x2d301e[_0x01bf('0x1b')][_0x01bf('0x1d')]);logger[_0x01bf('0x10')](_0x01bf('0x19'),_0x2d301e,JSON[_0x01bf('0x15')](_0x14f07f));_0x2f1e3f(_0x14f07f);})['catch'](function(_0xa02f51){logger[_0x01bf('0x12')](_0x01bf('0x19'),_0xa02f51['message'],_0x2d301e);_0xc8d5c3(_0x30eaf2['error'](0x1f4,_0xa02f51[_0x01bf('0x13')]));});});};exports[_0x01bf('0x1e')]=function(_0x18d41d){var _0x3686b9=this;return new Promise(function(_0x259a41,_0x235e90){return db[_0x01bf('0x5')][_0x01bf('0x1f')]({'where':_0x18d41d[_0x01bf('0x8')]?_0x18d41d[_0x01bf('0x8')]['where']||null:null})[_0x01bf('0x18')](function(_0x17e37f){logger['info']('DestroyCmHopper',_0x18d41d);logger[_0x01bf('0x10')]('DestroyCmHopper',_0x18d41d,JSON[_0x01bf('0x15')](_0x17e37f));_0x259a41(_0x17e37f);})[_0x01bf('0x11')](function(_0x305519){logger[_0x01bf('0x12')](_0x01bf('0x1e'),_0x305519[_0x01bf('0x13')],_0x18d41d);_0x235e90(_0x3686b9[_0x01bf('0x12')](0x1f4,_0x305519['message']));});});};exports[_0x01bf('0x20')]=function(_0x40ee21){var _0x3390d6=this;return new Promise(function(_0x2a6436,_0x53aa40){return db[_0x01bf('0x21')][_0x01bf('0x22')]()[_0x01bf('0x18')](function(_0xc7a6c4){return db[_0x01bf('0x23')][_0x01bf('0x24')](function(_0x3e29c8){return db['CmHopper'][_0x01bf('0x6')]({'where':_0x40ee21[_0x01bf('0x8')]?_0x40ee21[_0x01bf('0x8')][_0x01bf('0x9')]||null:null,'attributes':_0x40ee21['options']?_0x40ee21[_0x01bf('0x8')]['attributes']||null:null,'limit':_0x40ee21['options']?_0x40ee21[_0x01bf('0x8')][_0x01bf('0x25')]||null:null,'order':_0x40ee21[_0x01bf('0x8')]?_0x40ee21[_0x01bf('0x8')][_0x01bf('0x26')]||null:null,'transaction':_0x3e29c8,'lock':_0x3e29c8[_0x01bf('0x27')][_0x01bf('0x28')],'include':[{'model':db[_0x01bf('0x21')],'as':'Contact','attributes':_['keys'](_0xc7a6c4)},{'model':db[_0x01bf('0x29')],'as':_0x01bf('0x2a'),'attributes':['id','name',_0x01bf('0x2b')]}]})[_0x01bf('0x18')](function(_0x284875){var _0x2198d4=[];var _0x57c9b3=[];for(var _0x333879=0x0;_0x333879<_0x284875[_0x01bf('0x2c')];_0x333879+=0x1){var _0xb3baf3=_0x284875[_0x333879][_0x01bf('0x2d')];if(_0xb3baf3===null){_0x2198d4['push'](_0x284875[_0x333879]['update'](_0x40ee21[_0x01bf('0x1b')],{'transaction':_0x3e29c8}));}else if(!_0x57c9b3[_0x01bf('0x2e')](_0xb3baf3)){_0x57c9b3['push'](_0xb3baf3);_0x2198d4[_0x01bf('0x2f')](_0x284875[_0x333879][_0x01bf('0x1a')](_0x40ee21['body'],{'transaction':_0x3e29c8}));}}return BPromise[_0x01bf('0x30')](_0x2198d4);});})[_0x01bf('0x18')](function(_0x1e02ec){logger['info'](_0x01bf('0x20'),_0x40ee21);if(_0x1e02ec[_0x01bf('0x2c')]>0x0){logger[_0x01bf('0xe')](_0x01bf('0x31'),_0x1e02ec[0x0]['dataValues']['id'],_0x1e02ec[0x0][_0x01bf('0x32')][_0x01bf('0x33')],_0x1e02ec[0x0][_0x01bf('0x32')][_0x01bf('0x1d')]);}logger[_0x01bf('0x10')](_0x01bf('0x20'),_0x40ee21,JSON['stringify'](_0x1e02ec));_0x2a6436(_0x1e02ec);})[_0x01bf('0x11')](function(_0x327492){logger[_0x01bf('0x12')]('GetContactDialer',_0x327492[_0x01bf('0x13')],_0x40ee21);_0x53aa40(_0x3390d6[_0x01bf('0x12')](0x1f4,_0x327492['message']));});});});};exports[_0x01bf('0x34')]=function(_0x3bdb04){var _0x1a1b16=this;return new Promise(function(_0x827be0,_0xbc571f){return db['sequelize']['transaction'](function(_0x5684e1){return db[_0x01bf('0x35')][_0x01bf('0x17')](_0x3bdb04[_0x01bf('0x1b')],{'raw':_0x3bdb04[_0x01bf('0x8')]?_0x3bdb04[_0x01bf('0x8')]['raw']===undefined?!![]:![]:!![],'transaction':_0x5684e1})[_0x01bf('0x18')](function(){logger[_0x01bf('0xe')](_0x01bf('0x36'),JSON[_0x01bf('0x15')](_0x3bdb04[_0x01bf('0x8')][_0x01bf('0x9')]),_0x3bdb04[_0x01bf('0x8')]['where'][_0x01bf('0x1d')]);return db['CmHopper'][_0x01bf('0x1f')]({'where':_0x3bdb04[_0x01bf('0x8')]?_0x3bdb04['options']['where']||null:null,'transaction':_0x5684e1});});})[_0x01bf('0x18')](function(_0x2725ac){logger[_0x01bf('0xe')]('MoveContactManagedDialer',_0x3bdb04);logger['debug'](_0x01bf('0x34'),_0x3bdb04,JSON['stringify'](_0x2725ac));_0x827be0(_0x2725ac);})['catch'](function(_0x57fe97){logger[_0x01bf('0x12')]('MoveContactManagedDialer',_0x57fe97[_0x01bf('0x13')],_0x3bdb04);_0xbc571f(_0x1a1b16[_0x01bf('0x12')](0x1f4,_0x57fe97['message']));});});};exports[_0x01bf('0x37')]=function(_0x300847){var _0x1dca4a=this;return new Promise(function(_0x4a2db8,_0x411519){return db[_0x01bf('0x5')][_0x01bf('0x6')]({'raw':_0x300847[_0x01bf('0x8')]?_0x300847[_0x01bf('0x8')][_0x01bf('0x7')]===undefined?!![]:![]:!![],'where':_0x300847[_0x01bf('0x8')]?_0x300847[_0x01bf('0x8')]['where']||null:null,'attributes':[[db[_0x01bf('0x23')]['fn'](_0x01bf('0x38'),db[_0x01bf('0x23')]['fn']('IF',db[_0x01bf('0x23')][_0x01bf('0x39')](_0x01bf('0x3a')+util[_0x01bf('0x3b')](_0x01bf('0x3c'),moment()[_0x01bf('0x3b')](_0x01bf('0x3d')))+'\x20,\x201,\x20null'))),_0x01bf('0x3e')]]})[_0x01bf('0x18')](function(_0x285149){logger['info'](_0x01bf('0x37'),_0x300847);logger[_0x01bf('0x10')](_0x01bf('0x37'),_0x300847,JSON[_0x01bf('0x15')](_0x285149));_0x4a2db8(_0x285149);})[_0x01bf('0x11')](function(_0x59a275){logger['error']('CountReScheduled',_0x59a275['message'],_0x300847);_0x411519(_0x1dca4a['error'](0x1f4,_0x59a275[_0x01bf('0x13')]));});});};exports[_0x01bf('0x3f')]=function(_0x489f43){var _0x21aa05=this;return new Promise(function(_0x36ea85,_0x23716c){return db['CmContact'][_0x01bf('0x22')]()[_0x01bf('0x18')](function(){return db[_0x01bf('0x23')]['transaction'](function(_0xfa8bee){return db['CmHopper'][_0x01bf('0x6')]({'where':_0x489f43[_0x01bf('0x8')]?_0x489f43[_0x01bf('0x8')]['where']||null:null,'attributes':_0x489f43['options']?_0x489f43[_0x01bf('0x8')][_0x01bf('0xd')]||null:null,'limit':0x1,'order':_0x489f43[_0x01bf('0x8')]?_0x489f43[_0x01bf('0x8')][_0x01bf('0x26')]||null:null,'group':db[_0x01bf('0x5')][_0x01bf('0x2d')],'transaction':_0xfa8bee,'lock':_0xfa8bee[_0x01bf('0x27')][_0x01bf('0x28')],'include':_0x489f43[_0x01bf('0x8')]?_0x489f43[_0x01bf('0x8')]['include']?_[_0x01bf('0xa')](_0x489f43[_0x01bf('0x8')][_0x01bf('0xb')],function(_0x470804){return{'model':db[_0x470804[_0x01bf('0xc')]],'as':_0x470804['as'],'attributes':_0x470804['attributes'],'include':_0x470804[_0x01bf('0xb')]?_[_0x01bf('0xa')](_0x470804['include'],function(_0x2d174c){return{'model':db[_0x2d174c['model']],'as':_0x2d174c['as'],'attributes':_0x2d174c[_0x01bf('0xd')],'include':_0x2d174c[_0x01bf('0xb')]?_[_0x01bf('0xa')](_0x2d174c[_0x01bf('0xb')],function(_0x1b7533){return{'model':db[_0x1b7533[_0x01bf('0xc')]],'as':_0x1b7533['as'],'attributes':_0x1b7533[_0x01bf('0xd')]};}):[]};}):[]};}):[]:[]})[_0x01bf('0x18')](function(_0x3470d1){var _0x5124fa=[];for(var _0x4fe679=0x0;_0x4fe679<_0x3470d1['length'];_0x4fe679+=0x1){_0x5124fa[_0x01bf('0x2f')](_0x3470d1[_0x4fe679][_0x01bf('0x1a')](_0x489f43[_0x01bf('0x1b')],{'transaction':_0xfa8bee}));}return BPromise[_0x01bf('0x30')](_0x5124fa);});})['then'](function(_0x1ccb16){logger[_0x01bf('0xe')](_0x01bf('0x3f'),_0x489f43);logger[_0x01bf('0x10')](_0x01bf('0x3f'),_0x489f43,JSON[_0x01bf('0x15')](_0x1ccb16));_0x36ea85(_0x1ccb16);})[_0x01bf('0x11')](function(_0x1104b0){logger[_0x01bf('0x12')](_0x01bf('0x3f'),_0x1104b0[_0x01bf('0x13')],_0x489f43);_0x23716c(_0x21aa05['error'](0x1f4,_0x1104b0['message']));});});});};exports[_0x01bf('0x40')]=function(_0x148b3b){var _0x252dbb=this;return new Promise(function(_0x309d6b,_0x2688a3){db[_0x01bf('0x21')][_0x01bf('0x22')]()['then'](function(_0x1c61d6){return db['CmHopper'][_0x01bf('0x6')]({'raw':_0x148b3b[_0x01bf('0x8')]?_0x148b3b['options'][_0x01bf('0x7')]===undefined?!![]:![]:!![],'where':_0x148b3b[_0x01bf('0x8')]?_0x148b3b['options'][_0x01bf('0x9')]||null:null,'attributes':_0x148b3b[_0x01bf('0x8')]?_0x148b3b[_0x01bf('0x8')]['attributes']||null:null,'limit':_0x148b3b[_0x01bf('0x8')]?_0x148b3b[_0x01bf('0x8')][_0x01bf('0x25')]||null:null,'include':_0x148b3b[_0x01bf('0x8')]?_0x148b3b['options'][_0x01bf('0xb')]?_['map'](_0x148b3b[_0x01bf('0x8')][_0x01bf('0xb')],function(_0x330a6e){return{'model':db[_0x330a6e[_0x01bf('0xc')]],'as':_0x330a6e['as'],'attributes':_0x330a6e['as']===_0x01bf('0x41')?_[_0x01bf('0x42')](_0x1c61d6):_0x330a6e[_0x01bf('0xd')],'include':_0x330a6e[_0x01bf('0xb')]?_[_0x01bf('0xa')](_0x330a6e[_0x01bf('0xb')],function(_0x1a9c9c){return{'model':db[_0x1a9c9c['model']],'as':_0x1a9c9c['as'],'attributes':_0x1a9c9c[_0x01bf('0xd')],'include':_0x1a9c9c[_0x01bf('0xb')]?_[_0x01bf('0xa')](_0x1a9c9c[_0x01bf('0xb')],function(_0x5a4d38){return{'model':db[_0x5a4d38[_0x01bf('0xc')]],'as':_0x5a4d38['as'],'attributes':_0x5a4d38[_0x01bf('0xd')]};}):[]};}):[]};}):[]:[]})[_0x01bf('0x18')](function(_0x32f745){logger[_0x01bf('0xe')]('GetCmHopper',_0x148b3b);logger[_0x01bf('0x10')](_0x01bf('0xf'),_0x148b3b,JSON['stringify'](_0x32f745));_0x309d6b(_0x32f745);})['catch'](function(_0x129d40){logger[_0x01bf('0x12')](_0x01bf('0xf'),_0x129d40[_0x01bf('0x13')],_0x148b3b);_0x2688a3(_0x252dbb['error'](0x1f4,_0x129d40[_0x01bf('0x13')]));});});});};exports[_0x01bf('0x43')]=function(_0x4e373a){var _0x408324=this;return new Promise(function(_0x512001,_0x49e2d2){return db[_0x01bf('0x21')][_0x01bf('0x44')]({'raw':!![],'where':{'phone':_0x4e373a[_0x01bf('0x8')][_0x01bf('0x9')][_0x01bf('0x45')]},'attributes':['id','dialTimezone'],'order':[['id',_0x01bf('0x46')]]})[_0x01bf('0x18')](function(_0x7d71ed){logger['info'](_0x01bf('0x47'),_0x4e373a);logger[_0x01bf('0x10')](_0x01bf('0x47'),_0x4e373a,JSON[_0x01bf('0x15')](_0x7d71ed));_0x512001(_0x7d71ed);})[_0x01bf('0x11')](function(_0x28d7d0){logger['error'](_0x01bf('0x47'),_0x28d7d0[_0x01bf('0x13')],_0x4e373a);_0x49e2d2(_0x408324[_0x01bf('0x12')](0x1f4,_0x28d7d0[_0x01bf('0x13')]));});});};exports[_0x01bf('0x48')]=function(_0x331b2a){var _0x5d4abf=this;return new Promise(function(_0x5c6c54,_0x5b17d5){return db[_0x01bf('0x23')][_0x01bf('0x24')](function(_0x401c85){var _0x4e31c6=_0x331b2a[_0x01bf('0x8')]&&_0x331b2a[_0x01bf('0x8')][_0x01bf('0x9')]?_0x331b2a[_0x01bf('0x8')][_0x01bf('0x9')]:{};return db[_0x01bf('0x5')]['update'](_0x331b2a[_0x01bf('0x1b')],{'where':_0x4e31c6,'transaction':_0x401c85})['then'](function(_0xd27695){logger[_0x01bf('0xe')](_0x01bf('0x48'),_0x331b2a);logger['debug'](_0x01bf('0x48'),_0x331b2a,JSON[_0x01bf('0x15')](_0xd27695));_0x5c6c54(_0xd27695);})['catch'](function(_0x1bc474){logger[_0x01bf('0x12')](_0x01bf('0x48'),_0x1bc474[_0x01bf('0x13')],_0x331b2a);_0x5b17d5(_0x5d4abf[_0x01bf('0x12')](0x1f4,_0x1bc474[_0x01bf('0x13')]));});});});};exports[_0x01bf('0x49')]=function(_0x29d04f){var _0x112fdc=this;var _0x629d45=_0x29d04f[_0x01bf('0x1b')][_0x01bf('0x9')]['voiceQueueIds'];var _0x17625f=_0x29d04f[_0x01bf('0x1b')][_0x01bf('0x9')][_0x01bf('0x4a')];var _0x406cb2=_0x29d04f[_0x01bf('0x1b')]['where'][_0x01bf('0x4b')];return new Promise(function(_0x231eee,_0x4b3688){return db[_0x01bf('0x5')][_0x01bf('0x6')]({'where':{'voiceQueueId':{'$in':_0x629d45},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0x01bf('0x23')]['literal'](_0x01bf('0x4c')+_0x17625f+'\x20MINUTE'),'$gt':db[_0x01bf('0x23')]['literal'](_0x01bf('0x4d'))}},'UserId':{'$in':_0x406cb2}},'include':[{'model':db['CmContact'],'as':_0x01bf('0x41')},{'model':db[_0x01bf('0x29')],'as':_0x01bf('0x2a'),'attributes':['id','name','voicePause']},{'model':db[_0x01bf('0x4e')],'as':_0x01bf('0x4f')}]})[_0x01bf('0x18')](function(_0x3d01b1){if(_0x3d01b1[_0x01bf('0x2c')]>0x0){return db[_0x01bf('0x23')]['transaction'](function(_0x553052){return db[_0x01bf('0x5')]['update']({'recallmeNotifiedDate':db[_0x01bf('0x23')][_0x01bf('0x39')](_0x01bf('0x4d'))},{'where':{'id':{'$in':_[_0x01bf('0xa')](_0x3d01b1,'id')}},'transaction':_0x553052})[_0x01bf('0x18')](function(){_0x231eee(_0x3d01b1);})[_0x01bf('0x11')](function(_0xffc0b0){logger['error'](_0x01bf('0x49'),_0xffc0b0['message'],_0x29d04f);_0x4b3688(_0x112fdc[_0x01bf('0x12')](0x1f4,_0xffc0b0['message']));});})['catch'](function(_0x563796){logger['error'](_0x01bf('0x49'),_0x563796[_0x01bf('0x13')],_0x29d04f);_0x4b3688(_0x112fdc[_0x01bf('0x12')](0x1f4,_0x563796['message']));});}else{_0x231eee(_0x3d01b1);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index c3c3502..86657a2 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 _0x1f4b=['/:id','update','delete','destroy','express','Router','get','isAuthenticated','index','/describe','describe','/opencontacts','getOpenContacts','/timezones','getTimezones','show','/:id/previewrecall','getPreviewRecall','post','create','/preview','getPreview','put'];(function(_0x4602f6,_0x203344){var _0x2de7fe=function(_0x312360){while(--_0x312360){_0x4602f6['push'](_0x4602f6['shift']());}};_0x2de7fe(++_0x203344);}(_0x1f4b,0x18b));var _0xb1f4=function(_0x50e117,_0x21aa13){_0x50e117=_0x50e117-0x0;var _0x44bd14=_0x1f4b[_0x50e117];return _0x44bd14;};'use strict';var express=require(_0xb1f4('0x0'));var router=express[_0xb1f4('0x1')]();var auth=require('../../components/auth/service');var controller=require('./cmHopper.controller');router[_0xb1f4('0x2')]('/',auth[_0xb1f4('0x3')](),controller[_0xb1f4('0x4')]);router['get'](_0xb1f4('0x5'),auth['isAuthenticated'](),controller[_0xb1f4('0x6')]);router[_0xb1f4('0x2')](_0xb1f4('0x7'),auth[_0xb1f4('0x3')](),controller[_0xb1f4('0x8')]);router[_0xb1f4('0x2')](_0xb1f4('0x9'),auth['isAuthenticated'](),controller[_0xb1f4('0xa')]);router['get']('/:id',auth[_0xb1f4('0x3')](),controller[_0xb1f4('0xb')]);router[_0xb1f4('0x2')](_0xb1f4('0xc'),auth['isAuthenticated'](),controller[_0xb1f4('0xd')]);router[_0xb1f4('0xe')]('/',auth[_0xb1f4('0x3')](),controller[_0xb1f4('0xf')]);router['post'](_0xb1f4('0x10'),auth['isAuthenticated'](),controller[_0xb1f4('0x11')]);router[_0xb1f4('0xe')]('/timezone',auth['isAuthenticated'](),controller['getTimezone']);router[_0xb1f4('0x12')](_0xb1f4('0x13'),auth[_0xb1f4('0x3')](),controller[_0xb1f4('0x14')]);router[_0xb1f4('0x15')](_0xb1f4('0x13'),auth[_0xb1f4('0x3')](),controller[_0xb1f4('0x16')]);module['exports']=router; \ No newline at end of file +var _0x400f=['Router','../../components/auth/service','./cmHopper.controller','get','/describe','describe','/opencontacts','isAuthenticated','/timezones','getTimezones','/:id','/:id/previewrecall','getPreviewRecall','post','create','/preview','getPreview','/timezone','getTimezone','update','delete','destroy','exports','express'];(function(_0x41c180,_0xb61130){var _0x530899=function(_0x1dac19){while(--_0x1dac19){_0x41c180['push'](_0x41c180['shift']());}};_0x530899(++_0xb61130);}(_0x400f,0x197));var _0xf400=function(_0x5c4813,_0x1990a5){_0x5c4813=_0x5c4813-0x0;var _0x22fa96=_0x400f[_0x5c4813];return _0x22fa96;};'use strict';var express=require(_0xf400('0x0'));var router=express[_0xf400('0x1')]();var auth=require(_0xf400('0x2'));var controller=require(_0xf400('0x3'));router[_0xf400('0x4')]('/',auth['isAuthenticated'](),controller['index']);router[_0xf400('0x4')](_0xf400('0x5'),auth['isAuthenticated'](),controller[_0xf400('0x6')]);router[_0xf400('0x4')](_0xf400('0x7'),auth[_0xf400('0x8')](),controller['getOpenContacts']);router[_0xf400('0x4')](_0xf400('0x9'),auth[_0xf400('0x8')](),controller[_0xf400('0xa')]);router['get'](_0xf400('0xb'),auth[_0xf400('0x8')](),controller['show']);router['get'](_0xf400('0xc'),auth[_0xf400('0x8')](),controller[_0xf400('0xd')]);router[_0xf400('0xe')]('/',auth[_0xf400('0x8')](),controller[_0xf400('0xf')]);router[_0xf400('0xe')](_0xf400('0x10'),auth[_0xf400('0x8')](),controller[_0xf400('0x11')]);router['post'](_0xf400('0x12'),auth['isAuthenticated'](),controller[_0xf400('0x13')]);router['put'](_0xf400('0xb'),auth[_0xf400('0x8')](),controller[_0xf400('0x14')]);router[_0xf400('0x15')](_0xf400('0xb'),auth[_0xf400('0x8')](),controller[_0xf400('0x16')]);module[_0xf400('0x17')]=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index cefca2e..b974e0d 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 _0xd470=['sequelize','exports','INTEGER','DATE','YYYY-MM-DD\x20HH:mm:ss','moment'];(function(_0x3b5105,_0x31ebd9){var _0x17220c=function(_0x3195b9){while(--_0x3195b9){_0x3b5105['push'](_0x3b5105['shift']());}};_0x17220c(++_0x31ebd9);}(_0xd470,0x143));var _0x0d47=function(_0x11ad38,_0x575383){_0x11ad38=_0x11ad38-0x0;var _0x3878e9=_0xd470[_0x11ad38];return _0x3878e9;};'use strict';var moment=require(_0x0d47('0x0'));var Sequelize=require(_0x0d47('0x1'));module[_0x0d47('0x2')]={'CmHopperId':{'type':Sequelize[_0x0d47('0x3')]},'phone':{'type':Sequelize['STRING'],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x0d47('0x3')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x0d47('0x4')],'defaultValue':moment()['format'](_0x0d47('0x5'))},'countbusyretry':{'type':Sequelize[_0x0d47('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x0d47('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x0d47('0x3')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x0d47('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x0d47('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x0d47('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x0d47('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x265b=['DATE','format','YYYY-MM-DD\x20HH:mm:ss','moment','exports','INTEGER','STRING'];(function(_0x52c574,_0x4a2363){var _0x443112=function(_0x397077){while(--_0x397077){_0x52c574['push'](_0x52c574['shift']());}};_0x443112(++_0x4a2363);}(_0x265b,0x1f4));var _0xb265=function(_0x2361d1,_0x45da47){_0x2361d1=_0x2361d1-0x0;var _0x455a08=_0x265b[_0x2361d1];return _0x455a08;};'use strict';var moment=require(_0xb265('0x0'));var Sequelize=require('sequelize');module[_0xb265('0x1')]={'CmHopperId':{'type':Sequelize[_0xb265('0x2')]},'phone':{'type':Sequelize[_0xb265('0x3')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0xb265('0x2')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0xb265('0x4')],'defaultValue':moment()[_0xb265('0x5')](_0xb265('0x6'))},'countbusyretry':{'type':Sequelize[_0xb265('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xb265('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xb265('0x2')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xb265('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xb265('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xb265('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 c16cd08..c9e0647 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 _0x7c3a=['sendStatus','stack','name','send','index','map','CmHopperAdditionalPhone','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','catch','show','params','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CmHopperAdditionalPhones','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','status','end','json','offset','limit','count','Content-Range','apply','reject','save','then','get','UserProfileResource','destroy'];(function(_0x347f0c,_0x2ebd47){var _0x3b38ef=function(_0x109e9e){while(--_0x109e9e){_0x347f0c['push'](_0x347f0c['shift']());}};_0x3b38ef(++_0x2ebd47);}(_0x7c3a,0x79));var _0xa7c3=function(_0x413b4d,_0xa3459c){_0x413b4d=_0x413b4d-0x0;var _0x8b810a=_0x7c3a[_0x413b4d];return _0x8b810a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa7c3('0x0'));var rp=require(_0xa7c3('0x1'));var moment=require(_0xa7c3('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xa7c3('0x3'));var util=require(_0xa7c3('0x4'));var path=require(_0xa7c3('0x5'));var sox=require(_0xa7c3('0x6'));var csv=require(_0xa7c3('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xa7c3('0x8'));var crypto=require(_0xa7c3('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xa7c3('0xa'));var toCsv=require(_0xa7c3('0x7'));var querystring=require('querystring');var Papa=require(_0xa7c3('0xb'));var Redis=require(_0xa7c3('0xc'));var authService=require('../../components/auth/service');var qs=require(_0xa7c3('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa7c3('0xe'));var logger=require(_0xa7c3('0xf'))(_0xa7c3('0x10'));var utils=require(_0xa7c3('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0xa7c3('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x57f62a,_0x3ec90e){_0x3ec90e=_0x3ec90e||0xcc;return function(_0x7154fe){if(_0x7154fe){return _0x57f62a['sendStatus'](_0x3ec90e);}return _0x57f62a[_0xa7c3('0x13')](_0x3ec90e)[_0xa7c3('0x14')]();};}function respondWithResult(_0x1d768e,_0x9f612f){_0x9f612f=_0x9f612f||0xc8;return function(_0x2b408d){if(_0x2b408d){return _0x1d768e[_0xa7c3('0x13')](_0x9f612f)[_0xa7c3('0x15')](_0x2b408d);}};}function respondWithFilteredResult(_0x1cf9b8,_0x5646fc){return function(_0x4658f3){if(_0x4658f3){var _0x112637=typeof _0x5646fc[_0xa7c3('0x16')]==='undefined'&&typeof _0x5646fc[_0xa7c3('0x17')]==='undefined';var _0x12781a=_0x4658f3[_0xa7c3('0x18')];var _0x4d2e6b=_0x112637?0x0:_0x5646fc['offset'];var _0xfaa70f=_0x112637?_0x4658f3[_0xa7c3('0x18')]:_0x5646fc['offset']+_0x5646fc[_0xa7c3('0x17')];var _0x3e7389;if(_0xfaa70f>=_0x12781a){_0xfaa70f=_0x12781a;_0x3e7389=0xc8;}else{_0x3e7389=0xce;}_0x1cf9b8['status'](_0x3e7389);return _0x1cf9b8['set'](_0xa7c3('0x19'),_0x4d2e6b+'-'+_0xfaa70f+'/'+_0x12781a)['json'](_0x4658f3);}return null;};}function patchUpdates(_0x27779e){return function(_0x210d29){try{jsonpatch[_0xa7c3('0x1a')](_0x210d29,_0x27779e,!![]);}catch(_0x15e3db){return BPromise[_0xa7c3('0x1b')](_0x15e3db);}return _0x210d29[_0xa7c3('0x1c')]();};}function saveUpdates(_0x55f810,_0x33d2b6){return function(_0x15c61f){if(_0x15c61f){return _0x15c61f['update'](_0x55f810)[_0xa7c3('0x1d')](function(_0x120c63){return _0x120c63;});}return null;};}function removeEntity(_0x4c6c9a,_0x3b1ed){return function(_0x5e3958){if(_0x5e3958){return _0x5e3958['destroy']()[_0xa7c3('0x1d')](function(){var _0x21a306=_0x5e3958[_0xa7c3('0x1e')]({'plain':!![]});var _0x52c7d4='CmHopperAdditionalPhones';return db[_0xa7c3('0x1f')][_0xa7c3('0x20')]({'where':{'type':_0x52c7d4,'resourceId':_0x21a306['id']}})[_0xa7c3('0x1d')](function(){return _0x5e3958;});})[_0xa7c3('0x1d')](function(){_0x4c6c9a[_0xa7c3('0x13')](0xcc)[_0xa7c3('0x14')]();});}};}function handleEntityNotFound(_0x266c67,_0x6139a9){return function(_0x5008b9){if(!_0x5008b9){_0x266c67[_0xa7c3('0x21')](0x194);}return _0x5008b9;};}function handleError(_0x4d4685,_0x4cacca){_0x4cacca=_0x4cacca||0x1f4;return function(_0x2f7264){logger['error'](_0x2f7264[_0xa7c3('0x22')]);if(_0x2f7264[_0xa7c3('0x23')]){delete _0x2f7264[_0xa7c3('0x23')];}_0x4d4685['status'](_0x4cacca)[_0xa7c3('0x24')](_0x2f7264);};}exports[_0xa7c3('0x25')]=function(_0x4e233a,_0x9e1ccd){var _0x3015e8={},_0x58c851={},_0x15b12b={'count':0x0,'rows':[]};var _0x3d1134=_[_0xa7c3('0x26')](db[_0xa7c3('0x27')][_0xa7c3('0x28')],function(_0x4d550b){return{'name':_0x4d550b[_0xa7c3('0x29')],'type':_0x4d550b[_0xa7c3('0x2a')][_0xa7c3('0x2b')]};});_0x58c851[_0xa7c3('0x2c')]=_[_0xa7c3('0x26')](_0x3d1134,_0xa7c3('0x23'));_0x58c851[_0xa7c3('0x2d')]=_[_0xa7c3('0x2e')](_0x4e233a[_0xa7c3('0x2d')]);_0x58c851['filters']=_[_0xa7c3('0x2f')](_0x58c851[_0xa7c3('0x2c')],_0x58c851[_0xa7c3('0x2d')]);_0x3015e8[_0xa7c3('0x30')]=_[_0xa7c3('0x2f')](_0x58c851[_0xa7c3('0x2c')],qs[_0xa7c3('0x31')](_0x4e233a[_0xa7c3('0x2d')][_0xa7c3('0x31')]));_0x3015e8[_0xa7c3('0x30')]=_0x3015e8[_0xa7c3('0x30')][_0xa7c3('0x32')]?_0x3015e8[_0xa7c3('0x30')]:_0x58c851[_0xa7c3('0x2c')];if(!_0x4e233a[_0xa7c3('0x2d')]['hasOwnProperty'](_0xa7c3('0x33'))){_0x3015e8[_0xa7c3('0x17')]=qs['limit'](_0x4e233a['query']['limit']);_0x3015e8[_0xa7c3('0x16')]=qs[_0xa7c3('0x16')](_0x4e233a['query'][_0xa7c3('0x16')]);}_0x3015e8[_0xa7c3('0x34')]=qs[_0xa7c3('0x35')](_0x4e233a[_0xa7c3('0x2d')][_0xa7c3('0x35')]);_0x3015e8[_0xa7c3('0x36')]=qs['filters'](_[_0xa7c3('0x37')](_0x4e233a[_0xa7c3('0x2d')],_0x58c851[_0xa7c3('0x38')]),_0x3d1134);if(_0x4e233a[_0xa7c3('0x2d')][_0xa7c3('0x39')]){_0x3015e8[_0xa7c3('0x36')]=_[_0xa7c3('0x3a')](_0x3015e8[_0xa7c3('0x36')],{'$or':_[_0xa7c3('0x26')](_0x3d1134,function(_0x29cd87){if(_0x29cd87[_0xa7c3('0x2a')]!==_0xa7c3('0x3b')){var _0x29f074={};_0x29f074[_0x29cd87[_0xa7c3('0x23')]]={'$like':'%'+_0x4e233a[_0xa7c3('0x2d')]['filter']+'%'};return _0x29f074;}})});}_0x3015e8=_[_0xa7c3('0x3a')]({},_0x3015e8,_0x4e233a['options']);var _0xd5e9e8={'where':_0x3015e8[_0xa7c3('0x36')]};return db[_0xa7c3('0x27')][_0xa7c3('0x18')](_0xd5e9e8)[_0xa7c3('0x1d')](function(_0x52b4d2){_0x15b12b[_0xa7c3('0x18')]=_0x52b4d2;if(_0x4e233a[_0xa7c3('0x2d')]['includeAll']){_0x3015e8['include']=[{'all':!![]}];}return db[_0xa7c3('0x27')]['findAll'](_0x3015e8);})[_0xa7c3('0x1d')](function(_0x460a5e){_0x15b12b['rows']=_0x460a5e;return _0x15b12b;})[_0xa7c3('0x1d')](respondWithFilteredResult(_0x9e1ccd,_0x3015e8))[_0xa7c3('0x3c')](handleError(_0x9e1ccd,null));};exports[_0xa7c3('0x3d')]=function(_0x43227d,_0x318449){var _0x4099f2={'raw':!![],'where':{'id':_0x43227d[_0xa7c3('0x3e')]['id']}},_0xfb8697={};_0xfb8697[_0xa7c3('0x2c')]=_[_0xa7c3('0x2e')](db[_0xa7c3('0x27')]['rawAttributes']);_0xfb8697[_0xa7c3('0x2d')]=_[_0xa7c3('0x2e')](_0x43227d[_0xa7c3('0x2d')]);_0xfb8697[_0xa7c3('0x38')]=_[_0xa7c3('0x2f')](_0xfb8697[_0xa7c3('0x2c')],_0xfb8697[_0xa7c3('0x2d')]);_0x4099f2[_0xa7c3('0x30')]=_[_0xa7c3('0x2f')](_0xfb8697[_0xa7c3('0x2c')],qs[_0xa7c3('0x31')](_0x43227d['query'][_0xa7c3('0x31')]));_0x4099f2[_0xa7c3('0x30')]=_0x4099f2[_0xa7c3('0x30')][_0xa7c3('0x32')]?_0x4099f2[_0xa7c3('0x30')]:_0xfb8697[_0xa7c3('0x2c')];if(_0x43227d['query']['includeAll']){_0x4099f2[_0xa7c3('0x3f')]=[{'all':!![]}];}_0x4099f2=_[_0xa7c3('0x3a')]({},_0x4099f2,_0x43227d[_0xa7c3('0x40')]);return db['CmHopperAdditionalPhone'][_0xa7c3('0x41')](_0x4099f2)['then'](handleEntityNotFound(_0x318449,null))[_0xa7c3('0x1d')](respondWithResult(_0x318449,null))[_0xa7c3('0x3c')](handleError(_0x318449,null));};exports[_0xa7c3('0x42')]=function(_0x4acfa8,_0x27207b){return db[_0xa7c3('0x27')][_0xa7c3('0x42')](_0x4acfa8[_0xa7c3('0x43')],{})[_0xa7c3('0x1d')](function(_0x475cce){var _0x371d3e=_0x4acfa8[_0xa7c3('0x44')][_0xa7c3('0x1e')]({'plain':!![]});if(!_0x371d3e)throw new Error(_0xa7c3('0x45'));if(_0x371d3e[_0xa7c3('0x46')]===_0xa7c3('0x44')){var _0x33f5d9=_0x475cce[_0xa7c3('0x1e')]({'plain':!![]});var _0xdbf1f1=_0xa7c3('0x47');return db[_0xa7c3('0x48')][_0xa7c3('0x41')]({'where':{'name':_0xdbf1f1,'userProfileId':_0x371d3e['userProfileId']},'raw':!![]})[_0xa7c3('0x1d')](function(_0x346250){if(_0x346250&&_0x346250[_0xa7c3('0x49')]===0x0){return db[_0xa7c3('0x1f')][_0xa7c3('0x42')]({'name':_0x33f5d9[_0xa7c3('0x23')],'resourceId':_0x33f5d9['id'],'type':_0x346250[_0xa7c3('0x23')],'sectionId':_0x346250['id']},{})[_0xa7c3('0x1d')](function(){return _0x475cce;});}else{return _0x475cce;}})[_0xa7c3('0x3c')](function(_0x4297ff){logger[_0xa7c3('0x4a')](_0xa7c3('0x4b'),_0x4297ff);throw _0x4297ff;});}return _0x475cce;})[_0xa7c3('0x1d')](respondWithResult(_0x27207b,0xc9))[_0xa7c3('0x3c')](handleError(_0x27207b,null));};exports[_0xa7c3('0x4c')]=function(_0x12e862,_0x5e199a){if(_0x12e862[_0xa7c3('0x43')]['id']){delete _0x12e862['body']['id'];}return db[_0xa7c3('0x27')][_0xa7c3('0x41')]({'where':{'id':_0x12e862[_0xa7c3('0x3e')]['id']}})['then'](handleEntityNotFound(_0x5e199a,null))[_0xa7c3('0x1d')](saveUpdates(_0x12e862['body'],null))[_0xa7c3('0x1d')](respondWithResult(_0x5e199a,null))[_0xa7c3('0x3c')](handleError(_0x5e199a,null));};exports[_0xa7c3('0x20')]=function(_0x1404d9,_0x239465){return db[_0xa7c3('0x27')][_0xa7c3('0x41')]({'where':{'id':_0x1404d9[_0xa7c3('0x3e')]['id']}})[_0xa7c3('0x1d')](handleEntityNotFound(_0x239465,null))[_0xa7c3('0x1d')](removeEntity(_0x239465,null))[_0xa7c3('0x3c')](handleError(_0x239465,null));}; \ No newline at end of file +var _0xb127=['find','create','body','user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','apply','save','update','get','CmHopperAdditionalPhones','UserProfileResource','destroy','error','stack','name','send','index','map','CmHopperAdditionalPhone','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','then','include','findAll','rows','catch','keys','includeAll'];(function(_0x5a5f1d,_0x3359d8){var _0x597cf4=function(_0x5456d2){while(--_0x5456d2){_0x5a5f1d['push'](_0x5a5f1d['shift']());}};_0x597cf4(++_0x3359d8);}(_0xb127,0x19e));var _0x7b12=function(_0x20ad33,_0xf8c753){_0x20ad33=_0x20ad33-0x0;var _0x362c55=_0xb127[_0x20ad33];return _0x362c55;};'use strict';var emlformat=require(_0x7b12('0x0'));var rimraf=require(_0x7b12('0x1'));var zipdir=require(_0x7b12('0x2'));var jsonpatch=require(_0x7b12('0x3'));var rp=require(_0x7b12('0x4'));var moment=require('moment');var BPromise=require(_0x7b12('0x5'));var Mustache=require('mustache');var util=require(_0x7b12('0x6'));var path=require(_0x7b12('0x7'));var sox=require('sox');var csv=require(_0x7b12('0x8'));var ejs=require(_0x7b12('0x9'));var fs=require('fs');var fs_extra=require(_0x7b12('0xa'));var _=require(_0x7b12('0xb'));var squel=require(_0x7b12('0xc'));var crypto=require(_0x7b12('0xd'));var jsforce=require(_0x7b12('0xe'));var deskjs=require(_0x7b12('0xf'));var toCsv=require(_0x7b12('0x8'));var querystring=require(_0x7b12('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x7b12('0x11'));var hardwareService=require(_0x7b12('0x12'));var logger=require(_0x7b12('0x13'))(_0x7b12('0x14'));var utils=require('../../config/utils');var config=require(_0x7b12('0x15'));var licenseUtil=require(_0x7b12('0x16'));var db=require(_0x7b12('0x17'))['db'];function respondWithStatusCode(_0x4b24e1,_0x31aeae){_0x31aeae=_0x31aeae||0xcc;return function(_0x160db2){if(_0x160db2){return _0x4b24e1[_0x7b12('0x18')](_0x31aeae);}return _0x4b24e1[_0x7b12('0x19')](_0x31aeae)[_0x7b12('0x1a')]();};}function respondWithResult(_0x55b3d8,_0x557636){_0x557636=_0x557636||0xc8;return function(_0x96ff80){if(_0x96ff80){return _0x55b3d8[_0x7b12('0x19')](_0x557636)[_0x7b12('0x1b')](_0x96ff80);}};}function respondWithFilteredResult(_0x3a0b5d,_0x122f0f){return function(_0x3ffdea){if(_0x3ffdea){var _0x20cc05=typeof _0x122f0f[_0x7b12('0x1c')]===_0x7b12('0x1d')&&typeof _0x122f0f[_0x7b12('0x1e')]==='undefined';var _0x593f4e=_0x3ffdea[_0x7b12('0x1f')];var _0x53979f=_0x20cc05?0x0:_0x122f0f['offset'];var _0x41a086=_0x20cc05?_0x3ffdea['count']:_0x122f0f['offset']+_0x122f0f[_0x7b12('0x1e')];var _0x1d1737;if(_0x41a086>=_0x593f4e){_0x41a086=_0x593f4e;_0x1d1737=0xc8;}else{_0x1d1737=0xce;}_0x3a0b5d['status'](_0x1d1737);return _0x3a0b5d['set']('Content-Range',_0x53979f+'-'+_0x41a086+'/'+_0x593f4e)[_0x7b12('0x1b')](_0x3ffdea);}return null;};}function patchUpdates(_0x50ec75){return function(_0x30d96f){try{jsonpatch[_0x7b12('0x20')](_0x30d96f,_0x50ec75,!![]);}catch(_0x295492){return BPromise['reject'](_0x295492);}return _0x30d96f[_0x7b12('0x21')]();};}function saveUpdates(_0x1c4636,_0x2388b5){return function(_0x2fdcb6){if(_0x2fdcb6){return _0x2fdcb6[_0x7b12('0x22')](_0x1c4636)['then'](function(_0x32bded){return _0x32bded;});}return null;};}function removeEntity(_0x5f2e71,_0x408872){return function(_0x19b18a){if(_0x19b18a){return _0x19b18a['destroy']()['then'](function(){var _0x31b6c2=_0x19b18a[_0x7b12('0x23')]({'plain':!![]});var _0x1b182c=_0x7b12('0x24');return db[_0x7b12('0x25')][_0x7b12('0x26')]({'where':{'type':_0x1b182c,'resourceId':_0x31b6c2['id']}})['then'](function(){return _0x19b18a;});})['then'](function(){_0x5f2e71[_0x7b12('0x19')](0xcc)[_0x7b12('0x1a')]();});}};}function handleEntityNotFound(_0x368961,_0x1237bd){return function(_0x1badfe){if(!_0x1badfe){_0x368961[_0x7b12('0x18')](0x194);}return _0x1badfe;};}function handleError(_0x1f2c58,_0x3a3cc9){_0x3a3cc9=_0x3a3cc9||0x1f4;return function(_0x31d44a){logger[_0x7b12('0x27')](_0x31d44a[_0x7b12('0x28')]);if(_0x31d44a['name']){delete _0x31d44a[_0x7b12('0x29')];}_0x1f2c58[_0x7b12('0x19')](_0x3a3cc9)[_0x7b12('0x2a')](_0x31d44a);};}exports[_0x7b12('0x2b')]=function(_0x45e0c3,_0x178155){var _0x1964d1={},_0x51094e={},_0x50241c={'count':0x0,'rows':[]};var _0x11e302=_[_0x7b12('0x2c')](db[_0x7b12('0x2d')][_0x7b12('0x2e')],function(_0x22bed3){return{'name':_0x22bed3[_0x7b12('0x2f')],'type':_0x22bed3[_0x7b12('0x30')][_0x7b12('0x31')]};});_0x51094e[_0x7b12('0x32')]=_['map'](_0x11e302,_0x7b12('0x29'));_0x51094e[_0x7b12('0x33')]=_['keys'](_0x45e0c3[_0x7b12('0x33')]);_0x51094e[_0x7b12('0x34')]=_[_0x7b12('0x35')](_0x51094e[_0x7b12('0x32')],_0x51094e[_0x7b12('0x33')]);_0x1964d1[_0x7b12('0x36')]=_[_0x7b12('0x35')](_0x51094e[_0x7b12('0x32')],qs[_0x7b12('0x37')](_0x45e0c3[_0x7b12('0x33')][_0x7b12('0x37')]));_0x1964d1[_0x7b12('0x36')]=_0x1964d1[_0x7b12('0x36')][_0x7b12('0x38')]?_0x1964d1[_0x7b12('0x36')]:_0x51094e[_0x7b12('0x32')];if(!_0x45e0c3[_0x7b12('0x33')]['hasOwnProperty']('nolimit')){_0x1964d1[_0x7b12('0x1e')]=qs[_0x7b12('0x1e')](_0x45e0c3['query']['limit']);_0x1964d1[_0x7b12('0x1c')]=qs['offset'](_0x45e0c3[_0x7b12('0x33')][_0x7b12('0x1c')]);}_0x1964d1[_0x7b12('0x39')]=qs[_0x7b12('0x3a')](_0x45e0c3[_0x7b12('0x33')][_0x7b12('0x3a')]);_0x1964d1[_0x7b12('0x3b')]=qs[_0x7b12('0x34')](_[_0x7b12('0x3c')](_0x45e0c3[_0x7b12('0x33')],_0x51094e[_0x7b12('0x34')]),_0x11e302);if(_0x45e0c3[_0x7b12('0x33')][_0x7b12('0x3d')]){_0x1964d1[_0x7b12('0x3b')]=_[_0x7b12('0x3e')](_0x1964d1['where'],{'$or':_['map'](_0x11e302,function(_0x2cceb6){if(_0x2cceb6['type']!==_0x7b12('0x3f')){var _0x300332={};_0x300332[_0x2cceb6[_0x7b12('0x29')]]={'$like':'%'+_0x45e0c3[_0x7b12('0x33')]['filter']+'%'};return _0x300332;}})});}_0x1964d1=_['merge']({},_0x1964d1,_0x45e0c3[_0x7b12('0x40')]);var _0x165f57={'where':_0x1964d1[_0x7b12('0x3b')]};return db['CmHopperAdditionalPhone'][_0x7b12('0x1f')](_0x165f57)[_0x7b12('0x41')](function(_0xf79122){_0x50241c['count']=_0xf79122;if(_0x45e0c3[_0x7b12('0x33')]['includeAll']){_0x1964d1[_0x7b12('0x42')]=[{'all':!![]}];}return db[_0x7b12('0x2d')][_0x7b12('0x43')](_0x1964d1);})[_0x7b12('0x41')](function(_0x1b38fb){_0x50241c[_0x7b12('0x44')]=_0x1b38fb;return _0x50241c;})['then'](respondWithFilteredResult(_0x178155,_0x1964d1))[_0x7b12('0x45')](handleError(_0x178155,null));};exports['show']=function(_0x59af71,_0x5e2739){var _0x787371={'raw':!![],'where':{'id':_0x59af71['params']['id']}},_0x3c9a55={};_0x3c9a55['model']=_['keys'](db[_0x7b12('0x2d')][_0x7b12('0x2e')]);_0x3c9a55['query']=_[_0x7b12('0x46')](_0x59af71[_0x7b12('0x33')]);_0x3c9a55[_0x7b12('0x34')]=_[_0x7b12('0x35')](_0x3c9a55[_0x7b12('0x32')],_0x3c9a55[_0x7b12('0x33')]);_0x787371[_0x7b12('0x36')]=_['intersection'](_0x3c9a55[_0x7b12('0x32')],qs[_0x7b12('0x37')](_0x59af71[_0x7b12('0x33')][_0x7b12('0x37')]));_0x787371[_0x7b12('0x36')]=_0x787371[_0x7b12('0x36')]['length']?_0x787371[_0x7b12('0x36')]:_0x3c9a55['model'];if(_0x59af71[_0x7b12('0x33')][_0x7b12('0x47')]){_0x787371[_0x7b12('0x42')]=[{'all':!![]}];}_0x787371=_[_0x7b12('0x3e')]({},_0x787371,_0x59af71[_0x7b12('0x40')]);return db['CmHopperAdditionalPhone'][_0x7b12('0x48')](_0x787371)[_0x7b12('0x41')](handleEntityNotFound(_0x5e2739,null))['then'](respondWithResult(_0x5e2739,null))['catch'](handleError(_0x5e2739,null));};exports[_0x7b12('0x49')]=function(_0x398255,_0x5a2185){return db[_0x7b12('0x2d')][_0x7b12('0x49')](_0x398255[_0x7b12('0x4a')],{})[_0x7b12('0x41')](function(_0x5ea439){var _0x593478=_0x398255[_0x7b12('0x4b')][_0x7b12('0x23')]({'plain':!![]});if(!_0x593478)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x593478[_0x7b12('0x4c')]===_0x7b12('0x4b')){var _0x4cf9e3=_0x5ea439[_0x7b12('0x23')]({'plain':!![]});var _0x151050=_0x7b12('0x24');return db['UserProfileSection']['find']({'where':{'name':_0x151050,'userProfileId':_0x593478[_0x7b12('0x4d')]},'raw':!![]})[_0x7b12('0x41')](function(_0xe139e){if(_0xe139e&&_0xe139e[_0x7b12('0x4e')]===0x0){return db[_0x7b12('0x25')][_0x7b12('0x49')]({'name':_0x4cf9e3[_0x7b12('0x29')],'resourceId':_0x4cf9e3['id'],'type':_0xe139e[_0x7b12('0x29')],'sectionId':_0xe139e['id']},{})[_0x7b12('0x41')](function(){return _0x5ea439;});}else{return _0x5ea439;}})[_0x7b12('0x45')](function(_0xdd20a1){logger[_0x7b12('0x27')](_0x7b12('0x4f'),_0xdd20a1);throw _0xdd20a1;});}return _0x5ea439;})['then'](respondWithResult(_0x5a2185,0xc9))[_0x7b12('0x45')](handleError(_0x5a2185,null));};exports['update']=function(_0x4cea5b,_0x5539dd){if(_0x4cea5b[_0x7b12('0x4a')]['id']){delete _0x4cea5b[_0x7b12('0x4a')]['id'];}return db[_0x7b12('0x2d')]['find']({'where':{'id':_0x4cea5b[_0x7b12('0x50')]['id']}})[_0x7b12('0x41')](handleEntityNotFound(_0x5539dd,null))[_0x7b12('0x41')](saveUpdates(_0x4cea5b[_0x7b12('0x4a')],null))[_0x7b12('0x41')](respondWithResult(_0x5539dd,null))[_0x7b12('0x45')](handleError(_0x5539dd,null));};exports[_0x7b12('0x26')]=function(_0x58846b,_0x31657f){return db['CmHopperAdditionalPhone'][_0x7b12('0x48')]({'where':{'id':_0x58846b[_0x7b12('0x50')]['id']}})[_0x7b12('0x41')](handleEntityNotFound(_0x31657f,null))['then'](removeEntity(_0x31657f,null))[_0x7b12('0x45')](handleError(_0x31657f,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index 4448333..cabb9c6 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 _0x585e=['path','rimraf','./cmHopperAdditionalPhone.attributes','exports','define','CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash','util','bluebird'];(function(_0x58f77e,_0x15c937){var _0x2d5d9c=function(_0x505b5e){while(--_0x505b5e){_0x58f77e['push'](_0x58f77e['shift']());}};_0x2d5d9c(++_0x15c937);}(_0x585e,0x151));var _0xe585=function(_0x214747,_0x7cb088){_0x214747=_0x214747-0x0;var _0x800374=_0x585e[_0x214747];return _0x800374;};'use strict';var _=require(_0xe585('0x0'));var util=require(_0xe585('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xe585('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe585('0x3'));var rimraf=require(_0xe585('0x4'));var config=require('../../config/environment');var attributes=require(_0xe585('0x5'));module[_0xe585('0x6')]=function(_0x363ea8,_0x1cf4ac){return _0x363ea8[_0xe585('0x7')](_0xe585('0x8'),attributes,{'tableName':_0xe585('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7eed=['moment','request-promise','path','rimraf','../../config/environment','exports','define','CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash','util','../../config/logger','api'];(function(_0x34dd6e,_0x44ff16){var _0x3d2171=function(_0x4f1d4d){while(--_0x4f1d4d){_0x34dd6e['push'](_0x34dd6e['shift']());}};_0x3d2171(++_0x44ff16);}(_0x7eed,0xcc));var _0xd7ee=function(_0x49e77b,_0x59ced7){_0x49e77b=_0x49e77b-0x0;var _0x58b978=_0x7eed[_0x49e77b];return _0x58b978;};'use strict';var _=require(_0xd7ee('0x0'));var util=require(_0xd7ee('0x1'));var logger=require(_0xd7ee('0x2'))(_0xd7ee('0x3'));var moment=require(_0xd7ee('0x4'));var BPromise=require('bluebird');var rp=require(_0xd7ee('0x5'));var fs=require('fs');var path=require(_0xd7ee('0x6'));var rimraf=require(_0xd7ee('0x7'));var config=require(_0xd7ee('0x8'));var attributes=require('./cmHopperAdditionalPhone.attributes');module[_0xd7ee('0x9')]=function(_0x347d92,_0x3e286f){return _0x347d92[_0xd7ee('0xa')](_0xd7ee('0xb'),attributes,{'tableName':_0xd7ee('0xc'),'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 0dde357..00ff2b8 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 _0x0a8e=['then','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','VerifyAdditionalPhones','CmHopper','body','ContactId','ListId','VoiceQueueId','OrderBy','ASC','countbusyretry','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','entity','dialGlobalMaxRetry','CmHopperAdditionalPhone','findOne','countnoanswerretry','duration','waitTime','isNil','scheduledat','minutes','add','createdAt','updatedAt','sequelize','transaction','update','phone','activateAdditionalPhone','IncrementPreviewCounters','util','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http','request'];(function(_0x49fb23,_0x5340d4){var _0x4ef27b=function(_0xe79ef4){while(--_0xe79ef4){_0x49fb23['push'](_0x49fb23['shift']());}};_0x4ef27b(++_0x5340d4);}(_0x0a8e,0x170));var _0xe0a8=function(_0x648314,_0x23ad99){_0x648314=_0x648314-0x0;var _0x3e7623=_0x0a8e[_0x648314];return _0x3e7623;};'use strict';var _=require('lodash');var util=require(_0xe0a8('0x0'));var moment=require(_0xe0a8('0x1'));var BPromise=require('bluebird');var rs=require(_0xe0a8('0x2'));var fs=require('fs');var Redis=require(_0xe0a8('0x3'));var db=require(_0xe0a8('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe0a8('0x5'));var config=require(_0xe0a8('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xe0a8('0x7')][_0xe0a8('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1e708a,_0x4634f3,_0x227179){return new BPromise(function(_0x1066b9,_0x446097){return client[_0xe0a8('0x9')](_0x1e708a,_0x227179)[_0xe0a8('0xa')](function(_0x5e52d7){logger['info'](_0xe0a8('0xb'),_0x4634f3,_0xe0a8('0xc'));logger[_0xe0a8('0xd')]('CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s',_0x4634f3,_0xe0a8('0xc'),JSON[_0xe0a8('0xe')](_0x5e52d7));if(_0x5e52d7[_0xe0a8('0xf')]){if(_0x5e52d7[_0xe0a8('0xf')][_0xe0a8('0x10')]===0x1f4){logger[_0xe0a8('0xf')](_0xe0a8('0xb'),_0x4634f3,_0x5e52d7[_0xe0a8('0xf')][_0xe0a8('0x11')]);return _0x446097(_0x5e52d7['error']['message']);}logger[_0xe0a8('0xf')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x4634f3,_0x5e52d7[_0xe0a8('0xf')][_0xe0a8('0x11')]);return _0x1066b9(_0x5e52d7[_0xe0a8('0xf')][_0xe0a8('0x11')]);}else{logger[_0xe0a8('0x12')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x4634f3,_0xe0a8('0xc'));_0x1066b9(_0x5e52d7['result']['message']);}})[_0xe0a8('0x13')](function(_0x1e5611){logger[_0xe0a8('0xf')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x4634f3,_0x1e5611);_0x446097(_0x1e5611);});});}exports[_0xe0a8('0x14')]=function(_0x5b073c){var _0x4c395=this;return new Promise(function(_0x3868d8,_0x4a06bd){return db[_0xe0a8('0x15')]['findOne']({'raw':!![],'where':{'ContactId':_0x5b073c[_0xe0a8('0x16')][_0xe0a8('0x17')],'ListId':_0x5b073c['body'][_0xe0a8('0x18')],'VoiceQueueId':_0x5b073c[_0xe0a8('0x16')]['VoiceQueueId']===undefined?null:_0x5b073c[_0xe0a8('0x16')][_0xe0a8('0x19')],'CampaignId':_0x5b073c['body']['CampaignId']===undefined?null:_0x5b073c[_0xe0a8('0x16')]['CampaignId']}})[_0xe0a8('0xa')](function(_0x8c7cc6){if(_0x8c7cc6!=null){return db['CmHopperAdditionalPhone']['findOne']({'raw':!![],'where':{'CmHopperId':_0x8c7cc6['id'],'OrderBy':{'$gt':_0x8c7cc6[_0xe0a8('0x1a')]}},'order':[[_0xe0a8('0x1a'),_0xe0a8('0x1b')]]})[_0xe0a8('0xa')](function(_0x5f3498){var _0xf57613=0x0;if(_0x5f3498){if(_0x5f3498[_0xe0a8('0x1c')]+_0x5f3498[_0xe0a8('0x1d')]+_0x5f3498['countnoanswerretry']+_0x5f3498[_0xe0a8('0x1e')]+_0x5f3498[_0xe0a8('0x1f')]+_0x5f3498[_0xe0a8('0x20')]+_0x5f3498[_0xe0a8('0x21')]+_0x5f3498[_0xe0a8('0x22')]<_0x5b073c[_0xe0a8('0x23')][_0xe0a8('0x24')])_0xf57613=0x1;_0x3868d8({'additional':_0xf57613});}else{return db[_0xe0a8('0x25')][_0xe0a8('0x26')]({'raw':!![],'where':{'CmHopperId':_0x8c7cc6['id']},'order':[[_0xe0a8('0x1a'),'ASC']]})[_0xe0a8('0xa')](function(_0x564fe6){var _0x42e12d=0x0;if(_0x564fe6){if(_0x564fe6[_0xe0a8('0x1c')]+_0x564fe6[_0xe0a8('0x1d')]+_0x564fe6[_0xe0a8('0x27')]+_0x564fe6[_0xe0a8('0x1e')]+_0x564fe6[_0xe0a8('0x1f')]+_0x564fe6[_0xe0a8('0x20')]+_0x564fe6[_0xe0a8('0x21')]+_0x564fe6['countagentrejectretry']<_0x5b073c[_0xe0a8('0x23')][_0xe0a8('0x24')])_0x42e12d=0x1;_0x3868d8({'additional':_0x42e12d});}else{_0x3868d8({'additional':0x0});}})[_0xe0a8('0x13')](function(_0xb7eb94){logger['error']('VerifyAdditionalPhones',_0xb7eb94[_0xe0a8('0x11')]);_0x4a06bd(_0x4c395[_0xe0a8('0xf')](0x1f4,_0xb7eb94[_0xe0a8('0x11')]));});}})[_0xe0a8('0x13')](function(_0x59a66f){logger[_0xe0a8('0xf')](_0xe0a8('0x14'),_0x59a66f['message']);_0x4a06bd(_0x4c395[_0xe0a8('0xf')](0x1f4,_0x59a66f[_0xe0a8('0x11')]));});}else _0x3868d8({'additional':0x0});});});};exports['SwapAdditionalPhones']=function(_0x1b3a9a){var _0x78981c=this;return new Promise(function(_0x446962,_0x2ac4dc){return db[_0xe0a8('0x15')][_0xe0a8('0x26')]({'raw':!![],'where':{'ContactId':_0x1b3a9a[_0xe0a8('0x16')][_0xe0a8('0x17')],'ListId':_0x1b3a9a['body'][_0xe0a8('0x18')],'VoiceQueueId':_0x1b3a9a[_0xe0a8('0x16')][_0xe0a8('0x19')]===undefined?null:_0x1b3a9a['body'][_0xe0a8('0x19')],'CampaignId':_0x1b3a9a[_0xe0a8('0x16')]['CampaignId']===undefined?null:_0x1b3a9a[_0xe0a8('0x16')]['CampaignId']}})[_0xe0a8('0xa')](function(_0x338ef2){if(_0x338ef2!=null){return db[_0xe0a8('0x25')][_0xe0a8('0x26')]({'raw':!![],'where':{'CmHopperId':_0x338ef2['id'],'OrderBy':{'$gte':_0x338ef2[_0xe0a8('0x1a')]}},'order':[[_0xe0a8('0x1a'),_0xe0a8('0x1b')]]})[_0xe0a8('0xa')](function(_0x26df31){if(_0x26df31)return activateAdditionalPhone(_0x338ef2,_0x1b3a9a[_0xe0a8('0x16')],_0x26df31,_0x1b3a9a[_0xe0a8('0x28')],_0x1b3a9a[_0xe0a8('0x29')])[_0xe0a8('0xa')](function(_0x138b37){_0x446962(_0x138b37);});else{return db[_0xe0a8('0x25')][_0xe0a8('0x26')]({'raw':!![],'where':{'CmHopperId':_0x338ef2['id']},'order':[[_0xe0a8('0x1a'),_0xe0a8('0x1b')]]})[_0xe0a8('0xa')](function(_0x393637){if(_0x393637)return activateAdditionalPhone(_0x338ef2,_0x1b3a9a[_0xe0a8('0x16')],_0x393637,_0x1b3a9a[_0xe0a8('0x28')],_0x1b3a9a['waitTime'])[_0xe0a8('0xa')](function(_0xa44812){_0x446962(_0xa44812);});else{_0x446962({'id':_0x338ef2['id'],'phone':''});}})['catch'](function(_0xe8c40b){logger['error'](_0xe0a8('0x14'),_0xe8c40b[_0xe0a8('0x11')]);_0x2ac4dc(_0x78981c[_0xe0a8('0xf')](0x1f4,_0xe8c40b[_0xe0a8('0x11')]));});}})[_0xe0a8('0x13')](function(_0x13ccbf){logger[_0xe0a8('0xf')]('VerifyAdditionalPhones',_0x13ccbf[_0xe0a8('0x11')]);_0x2ac4dc(_0x78981c[_0xe0a8('0xf')](0x1f4,_0x13ccbf[_0xe0a8('0x11')]));});}else _0x446962(0x1);});});};function activateAdditionalPhone(_0x1d9e50,_0x369557,_0x277402,_0x7b300b,_0x557a84){return new Promise(function(_0x1f880c,_0x3090dc){var _0x32dade;if(_[_0xe0a8('0x2a')](_0x277402[_0xe0a8('0x2b')])){_0x277402[_0xe0a8('0x2b')]=moment();}if(moment()>moment(_0x277402[_0xe0a8('0x2b')])){_0x32dade=moment()['add'](_0x557a84||0x3,_0xe0a8('0x2c'));}else{if(_0x277402['OrderBy']==0x0){_0x32dade=moment(_0x277402[_0xe0a8('0x2b')]);}else{_0x32dade=moment()[_0xe0a8('0x2d')](_0x557a84||0x3,'minutes');}}if(_[_0xe0a8('0x2a')](_0x32dade)){_0x32dade=moment()[_0xe0a8('0x2d')](_0x557a84||0x3,'minutes');}var _0x5086ee={'phone':_0x1d9e50['phone'],'active':0x0,'OrderBy':_['isNil'](_0x1d9e50[_0xe0a8('0x1a')])?0x0:_0x1d9e50[_0xe0a8('0x1a')],'scheduledat':moment()[_0xe0a8('0x2d')](_0x7b300b||0x1,_0xe0a8('0x2c')),'countbusyretry':_0x369557['countbusyretry'],'countcongestionretry':_0x369557[_0xe0a8('0x1d')],'countnoanswerretry':_0x369557['countnoanswerretry'],'countnosuchnumberretry':_0x369557[_0xe0a8('0x1e')],'countdropretry':_0x369557[_0xe0a8('0x1f')],'countabandonedretry':_0x369557[_0xe0a8('0x20')],'countmachineretry':_0x369557[_0xe0a8('0x21')],'countagentrejectretry':_0x369557['countagentrejectretry'],'createdAt':_0x369557[_0xe0a8('0x2e')],'updatedAt':_0x369557[_0xe0a8('0x2f')]};var _0x9b8c43={'CmHopperId':_0x1d9e50['id'],'phone':_0x277402['phone'],'active':0x0,'OrderBy':_[_0xe0a8('0x2a')](_0x277402['OrderBy'])?0x0:_0x277402[_0xe0a8('0x1a')],'scheduledat':_0x32dade,'countbusyretry':_0x277402[_0xe0a8('0x1c')],'countcongestionretry':_0x277402['countcongestionretry'],'countnoanswerretry':_0x277402['countnoanswerretry'],'countnosuchnumberretry':_0x277402[_0xe0a8('0x1e')],'countdropretry':_0x277402[_0xe0a8('0x1f')],'countabandonedretry':_0x277402[_0xe0a8('0x20')],'countmachineretry':_0x277402['countmachineretry'],'countagentrejectretry':_0x277402['countagentrejectretry'],'createdAt':_0x277402[_0xe0a8('0x2e')],'updatedAt':_0x277402['updatedAt']};return db[_0xe0a8('0x30')][_0xe0a8('0x31')](function(_0x3aedfc){return db[_0xe0a8('0x25')]['update'](_0x5086ee,{'where':{'id':_0x277402['id']}},{'transaction':_0x3aedfc})['then'](function(){return db[_0xe0a8('0x15')][_0xe0a8('0x32')](_0x9b8c43,{'where':{'id':_0x1d9e50['id']}},{'transaction':_0x3aedfc});});})[_0xe0a8('0xa')](function(_0x52a6dd){_0x1f880c({'id':_0x1d9e50['id'],'phone':_0x277402[_0xe0a8('0x33')]});})[_0xe0a8('0x13')](function(_0x51e9dd){logger['error'](_0xe0a8('0x34'),_0x51e9dd['message']);_0x3090dc({'error':_0x51e9dd[_0xe0a8('0x11')]});});});}exports[_0xe0a8('0x35')]=function(_0x4fa997){var _0x65f554=this;return new Promise(function(_0x538af5,_0xf6152e){return db[_0xe0a8('0x15')][_0xe0a8('0x32')](_0x4fa997[_0xe0a8('0x16')]['field'],{'where':{'id':_0x4fa997[_0xe0a8('0x16')]['id']}})['then'](function(_0x3d0cf3){_0x538af5(_0x3d0cf3);})[_0xe0a8('0x13')](function(_0x3627c1){logger[_0xe0a8('0xf')](_0xe0a8('0x35'),_0x3627c1[_0xe0a8('0x11')]);_0xf6152e(_0x65f554['error'](0x1f4,_0x3627c1['message']));});});}; \ No newline at end of file +var _0x972c=['countabandonedretry','countmachineretry','countagentrejectretry','entity','dialGlobalMaxRetry','countnoanswerretry','countnosuchnumberretry','catch','SwapAdditionalPhones','CmHopper','duration','waitTime','isNil','scheduledat','add','minutes','phone','updatedAt','createdAt','sequelize','transaction','update','IncrementPreviewCounters','field','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','http','request','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','message','result','VerifyAdditionalPhones','findOne','body','ContactId','ListId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','ASC','countbusyretry','countcongestionretry','countdropretry'];(function(_0x29df5d,_0x4dbd4f){var _0x10d79c=function(_0x11b77f){while(--_0x11b77f){_0x29df5d['push'](_0x29df5d['shift']());}};_0x10d79c(++_0x4dbd4f);}(_0x972c,0x8c));var _0xc972=function(_0x4adcd6,_0x82da4c){_0x4adcd6=_0x4adcd6-0x0;var _0x267d62=_0x972c[_0x4adcd6];return _0x267d62;};'use strict';var _=require(_0xc972('0x0'));var util=require(_0xc972('0x1'));var moment=require(_0xc972('0x2'));var BPromise=require(_0xc972('0x3'));var rs=require(_0xc972('0x4'));var fs=require('fs');var Redis=require(_0xc972('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc972('0x6'));var logger=require(_0xc972('0x7'))(_0xc972('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xc972('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x518144,_0x3437df,_0x1cc62d){return new BPromise(function(_0x9b2f0,_0x43271c){return client[_0xc972('0xa')](_0x518144,_0x1cc62d)[_0xc972('0xb')](function(_0x5b8481){logger[_0xc972('0xc')](_0xc972('0xd'),_0x3437df,_0xc972('0xe'));logger[_0xc972('0xf')](_0xc972('0x10'),_0x3437df,_0xc972('0xe'),JSON[_0xc972('0x11')](_0x5b8481));if(_0x5b8481[_0xc972('0x12')]){if(_0x5b8481[_0xc972('0x12')]['code']===0x1f4){logger['error']('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x3437df,_0x5b8481[_0xc972('0x12')][_0xc972('0x13')]);return _0x43271c(_0x5b8481['error'][_0xc972('0x13')]);}logger['error'](_0xc972('0xd'),_0x3437df,_0x5b8481[_0xc972('0x12')]['message']);return _0x9b2f0(_0x5b8481[_0xc972('0x12')][_0xc972('0x13')]);}else{logger[_0xc972('0xc')](_0xc972('0xd'),_0x3437df,_0xc972('0xe'));_0x9b2f0(_0x5b8481[_0xc972('0x14')][_0xc972('0x13')]);}})['catch'](function(_0x56ed75){logger['error'](_0xc972('0xd'),_0x3437df,_0x56ed75);_0x43271c(_0x56ed75);});});}exports[_0xc972('0x15')]=function(_0x1eb608){var _0x5af5c7=this;return new Promise(function(_0x19d6c5,_0x15d129){return db['CmHopper'][_0xc972('0x16')]({'raw':!![],'where':{'ContactId':_0x1eb608[_0xc972('0x17')][_0xc972('0x18')],'ListId':_0x1eb608[_0xc972('0x17')][_0xc972('0x19')],'VoiceQueueId':_0x1eb608[_0xc972('0x17')][_0xc972('0x1a')]===undefined?null:_0x1eb608['body']['VoiceQueueId'],'CampaignId':_0x1eb608[_0xc972('0x17')][_0xc972('0x1b')]===undefined?null:_0x1eb608[_0xc972('0x17')][_0xc972('0x1b')]}})[_0xc972('0xb')](function(_0x5c88b0){if(_0x5c88b0!=null){return db[_0xc972('0x1c')][_0xc972('0x16')]({'raw':!![],'where':{'CmHopperId':_0x5c88b0['id'],'OrderBy':{'$gt':_0x5c88b0['OrderBy']}},'order':[[_0xc972('0x1d'),_0xc972('0x1e')]]})[_0xc972('0xb')](function(_0x334f5d){var _0x30c3e9=0x0;if(_0x334f5d){if(_0x334f5d[_0xc972('0x1f')]+_0x334f5d[_0xc972('0x20')]+_0x334f5d['countnoanswerretry']+_0x334f5d['countnosuchnumberretry']+_0x334f5d[_0xc972('0x21')]+_0x334f5d[_0xc972('0x22')]+_0x334f5d[_0xc972('0x23')]+_0x334f5d[_0xc972('0x24')]<_0x1eb608[_0xc972('0x25')][_0xc972('0x26')])_0x30c3e9=0x1;_0x19d6c5({'additional':_0x30c3e9});}else{return db[_0xc972('0x1c')][_0xc972('0x16')]({'raw':!![],'where':{'CmHopperId':_0x5c88b0['id']},'order':[['OrderBy',_0xc972('0x1e')]]})[_0xc972('0xb')](function(_0x3575a0){var _0x41ffa0=0x0;if(_0x3575a0){if(_0x3575a0[_0xc972('0x1f')]+_0x3575a0['countcongestionretry']+_0x3575a0[_0xc972('0x27')]+_0x3575a0[_0xc972('0x28')]+_0x3575a0[_0xc972('0x21')]+_0x3575a0[_0xc972('0x22')]+_0x3575a0['countmachineretry']+_0x3575a0[_0xc972('0x24')]<_0x1eb608[_0xc972('0x25')][_0xc972('0x26')])_0x41ffa0=0x1;_0x19d6c5({'additional':_0x41ffa0});}else{_0x19d6c5({'additional':0x0});}})[_0xc972('0x29')](function(_0x3b9397){logger[_0xc972('0x12')](_0xc972('0x15'),_0x3b9397['message']);_0x15d129(_0x5af5c7[_0xc972('0x12')](0x1f4,_0x3b9397['message']));});}})[_0xc972('0x29')](function(_0x3d8b54){logger[_0xc972('0x12')](_0xc972('0x15'),_0x3d8b54[_0xc972('0x13')]);_0x15d129(_0x5af5c7['error'](0x1f4,_0x3d8b54[_0xc972('0x13')]));});}else _0x19d6c5({'additional':0x0});});});};exports[_0xc972('0x2a')]=function(_0x30caf9){var _0x3d431b=this;return new Promise(function(_0xb79a3b,_0x375fe2){return db[_0xc972('0x2b')][_0xc972('0x16')]({'raw':!![],'where':{'ContactId':_0x30caf9[_0xc972('0x17')][_0xc972('0x18')],'ListId':_0x30caf9[_0xc972('0x17')][_0xc972('0x19')],'VoiceQueueId':_0x30caf9[_0xc972('0x17')][_0xc972('0x1a')]===undefined?null:_0x30caf9[_0xc972('0x17')]['VoiceQueueId'],'CampaignId':_0x30caf9[_0xc972('0x17')]['CampaignId']===undefined?null:_0x30caf9[_0xc972('0x17')]['CampaignId']}})[_0xc972('0xb')](function(_0x5f208f){if(_0x5f208f!=null){return db[_0xc972('0x1c')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x5f208f['id'],'OrderBy':{'$gte':_0x5f208f[_0xc972('0x1d')]}},'order':[[_0xc972('0x1d'),_0xc972('0x1e')]]})['then'](function(_0x51dff3){if(_0x51dff3)return activateAdditionalPhone(_0x5f208f,_0x30caf9[_0xc972('0x17')],_0x51dff3,_0x30caf9[_0xc972('0x2c')],_0x30caf9[_0xc972('0x2d')])[_0xc972('0xb')](function(_0x28db1e){_0xb79a3b(_0x28db1e);});else{return db['CmHopperAdditionalPhone']['findOne']({'raw':!![],'where':{'CmHopperId':_0x5f208f['id']},'order':[[_0xc972('0x1d'),'ASC']]})[_0xc972('0xb')](function(_0x6ac75d){if(_0x6ac75d)return activateAdditionalPhone(_0x5f208f,_0x30caf9[_0xc972('0x17')],_0x6ac75d,_0x30caf9[_0xc972('0x2c')],_0x30caf9[_0xc972('0x2d')])[_0xc972('0xb')](function(_0x58f38e){_0xb79a3b(_0x58f38e);});else{_0xb79a3b({'id':_0x5f208f['id'],'phone':''});}})[_0xc972('0x29')](function(_0x344e62){logger['error'](_0xc972('0x15'),_0x344e62[_0xc972('0x13')]);_0x375fe2(_0x3d431b['error'](0x1f4,_0x344e62['message']));});}})['catch'](function(_0x5eda06){logger[_0xc972('0x12')](_0xc972('0x15'),_0x5eda06['message']);_0x375fe2(_0x3d431b[_0xc972('0x12')](0x1f4,_0x5eda06['message']));});}else _0xb79a3b(0x1);});});};function activateAdditionalPhone(_0x1e3375,_0xe9a686,_0x41ba3a,_0x334d59,_0x23a19e){return new Promise(function(_0x476e34,_0x5482d9){var _0x1d478d;if(_[_0xc972('0x2e')](_0x41ba3a[_0xc972('0x2f')])){_0x41ba3a[_0xc972('0x2f')]=moment();}if(moment()>moment(_0x41ba3a[_0xc972('0x2f')])){_0x1d478d=moment()[_0xc972('0x30')](_0x23a19e||0x3,_0xc972('0x31'));}else{if(_0x41ba3a[_0xc972('0x1d')]==0x0){_0x1d478d=moment(_0x41ba3a[_0xc972('0x2f')]);}else{_0x1d478d=moment()['add'](_0x23a19e||0x3,_0xc972('0x31'));}}if(_[_0xc972('0x2e')](_0x1d478d)){_0x1d478d=moment()[_0xc972('0x30')](_0x23a19e||0x3,'minutes');}var _0x4e257f={'phone':_0x1e3375[_0xc972('0x32')],'active':0x0,'OrderBy':_[_0xc972('0x2e')](_0x1e3375[_0xc972('0x1d')])?0x0:_0x1e3375[_0xc972('0x1d')],'scheduledat':moment()[_0xc972('0x30')](_0x334d59||0x1,_0xc972('0x31')),'countbusyretry':_0xe9a686[_0xc972('0x1f')],'countcongestionretry':_0xe9a686[_0xc972('0x20')],'countnoanswerretry':_0xe9a686[_0xc972('0x27')],'countnosuchnumberretry':_0xe9a686[_0xc972('0x28')],'countdropretry':_0xe9a686['countdropretry'],'countabandonedretry':_0xe9a686['countabandonedretry'],'countmachineretry':_0xe9a686['countmachineretry'],'countagentrejectretry':_0xe9a686[_0xc972('0x24')],'createdAt':_0xe9a686['createdAt'],'updatedAt':_0xe9a686[_0xc972('0x33')]};var _0x21abac={'CmHopperId':_0x1e3375['id'],'phone':_0x41ba3a[_0xc972('0x32')],'active':0x0,'OrderBy':_[_0xc972('0x2e')](_0x41ba3a['OrderBy'])?0x0:_0x41ba3a[_0xc972('0x1d')],'scheduledat':_0x1d478d,'countbusyretry':_0x41ba3a[_0xc972('0x1f')],'countcongestionretry':_0x41ba3a[_0xc972('0x20')],'countnoanswerretry':_0x41ba3a['countnoanswerretry'],'countnosuchnumberretry':_0x41ba3a['countnosuchnumberretry'],'countdropretry':_0x41ba3a[_0xc972('0x21')],'countabandonedretry':_0x41ba3a['countabandonedretry'],'countmachineretry':_0x41ba3a[_0xc972('0x23')],'countagentrejectretry':_0x41ba3a[_0xc972('0x24')],'createdAt':_0x41ba3a[_0xc972('0x34')],'updatedAt':_0x41ba3a['updatedAt']};return db[_0xc972('0x35')][_0xc972('0x36')](function(_0x4efa83){return db['CmHopperAdditionalPhone'][_0xc972('0x37')](_0x4e257f,{'where':{'id':_0x41ba3a['id']}},{'transaction':_0x4efa83})[_0xc972('0xb')](function(){return db[_0xc972('0x2b')]['update'](_0x21abac,{'where':{'id':_0x1e3375['id']}},{'transaction':_0x4efa83});});})[_0xc972('0xb')](function(_0x3f03c9){_0x476e34({'id':_0x1e3375['id'],'phone':_0x41ba3a['phone']});})[_0xc972('0x29')](function(_0x227c87){logger[_0xc972('0x12')]('activateAdditionalPhone',_0x227c87['message']);_0x5482d9({'error':_0x227c87[_0xc972('0x13')]});});});}exports[_0xc972('0x38')]=function(_0x3970da){var _0x5191a0=this;return new Promise(function(_0x7fa372,_0x3132d9){return db[_0xc972('0x2b')]['update'](_0x3970da[_0xc972('0x17')][_0xc972('0x39')],{'where':{'id':_0x3970da[_0xc972('0x17')]['id']}})[_0xc972('0xb')](function(_0x36c5ba){_0x7fa372(_0x36c5ba);})['catch'](function(_0x1a81c2){logger['error'](_0xc972('0x38'),_0x1a81c2[_0xc972('0x13')]);_0x3132d9(_0x5191a0['error'](0x1f4,_0x1a81c2[_0xc972('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index f356ed5..6070ebe 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 _0xea5b=['path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmHopperAdditionalPhone.controller','isAuthenticated','index','get','/:id','show','post','create','put','destroy','multer','util'];(function(_0x3f6565,_0x12a8bb){var _0x4abd23=function(_0x56dce7){while(--_0x56dce7){_0x3f6565['push'](_0x3f6565['shift']());}};_0x4abd23(++_0x12a8bb);}(_0xea5b,0x152));var _0xbea5=function(_0x4792c8,_0x5158a1){_0x4792c8=_0x4792c8-0x0;var _0x35edb1=_0xea5b[_0x4792c8];return _0x35edb1;};'use strict';var multer=require(_0xbea5('0x0'));var util=require(_0xbea5('0x1'));var path=require(_0xbea5('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xbea5('0x3')]();var fs_extra=require(_0xbea5('0x4'));var auth=require(_0xbea5('0x5'));var interaction=require(_0xbea5('0x6'));var config=require('../../config/environment');var controller=require(_0xbea5('0x7'));router['get']('/',auth[_0xbea5('0x8')](),controller[_0xbea5('0x9')]);router[_0xbea5('0xa')](_0xbea5('0xb'),auth[_0xbea5('0x8')](),controller[_0xbea5('0xc')]);router[_0xbea5('0xd')]('/',auth[_0xbea5('0x8')](),controller[_0xbea5('0xe')]);router[_0xbea5('0xf')](_0xbea5('0xb'),auth[_0xbea5('0x8')](),controller['update']);router['delete'](_0xbea5('0xb'),auth[_0xbea5('0x8')](),controller[_0xbea5('0x10')]);module['exports']=router; \ No newline at end of file +var _0x048e=['destroy','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','show','post','create','put','/:id','update','delete'];(function(_0x45fcb7,_0x124683){var _0x51c2bf=function(_0x236201){while(--_0x236201){_0x45fcb7['push'](_0x45fcb7['shift']());}};_0x51c2bf(++_0x124683);}(_0x048e,0x1aa));var _0xe048=function(_0x157f1c,_0x329bdb){_0x157f1c=_0x157f1c-0x0;var _0x552cd8=_0x048e[_0x157f1c];return _0x552cd8;};'use strict';var multer=require(_0xe048('0x0'));var util=require('util');var path=require(_0xe048('0x1'));var timeout=require(_0xe048('0x2'));var express=require(_0xe048('0x3'));var router=express[_0xe048('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xe048('0x5'));var interaction=require(_0xe048('0x6'));var config=require('../../config/environment');var controller=require('./cmHopperAdditionalPhone.controller');router[_0xe048('0x7')]('/',auth[_0xe048('0x8')](),controller['index']);router[_0xe048('0x7')]('/:id',auth[_0xe048('0x8')](),controller[_0xe048('0x9')]);router[_0xe048('0xa')]('/',auth[_0xe048('0x8')](),controller[_0xe048('0xb')]);router[_0xe048('0xc')](_0xe048('0xd'),auth[_0xe048('0x8')](),controller[_0xe048('0xe')]);router[_0xe048('0xf')](_0xe048('0xd'),auth[_0xe048('0x8')](),controller[_0xe048('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index eec32a1..7ceaf97 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 _0xbb05=['exports','INTEGER','contactListQueue','moment','sequelize'];(function(_0xde9059,_0x750aab){var _0x23197d=function(_0x457724){while(--_0x457724){_0xde9059['push'](_0xde9059['shift']());}};_0x23197d(++_0x750aab);}(_0xbb05,0x1b6));var _0x5bb0=function(_0x409c73,_0x212a0e){_0x409c73=_0x409c73-0x0;var _0xe74c18=_0xbb05[_0x409c73];return _0xe74c18;};'use strict';var moment=require(_0x5bb0('0x0'));var Sequelize=require(_0x5bb0('0x1'));module[_0x5bb0('0x2')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize[_0x5bb0('0x3')],'unique':_0x5bb0('0x4')},'ListId':{'type':Sequelize[_0x5bb0('0x3')],'unique':'contactListQueue'},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0x5bb0('0x4')}}; \ No newline at end of file +var _0xdd0c=['STRING','contactListQueue','INTEGER','moment','sequelize','exports'];(function(_0x19046c,_0x2494b5){var _0x469c79=function(_0x59cd03){while(--_0x59cd03){_0x19046c['push'](_0x19046c['shift']());}};_0x469c79(++_0x2494b5);}(_0xdd0c,0x1ad));var _0xcdd0=function(_0x54dd38,_0x1d4189){_0x54dd38=_0x54dd38-0x0;var _0x4ecfe1=_0xdd0c[_0x54dd38];return _0x4ecfe1;};'use strict';var moment=require(_0xcdd0('0x0'));var Sequelize=require(_0xcdd0('0x1'));module[_0xcdd0('0x2')]={'phone':{'type':Sequelize[_0xcdd0('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0xcdd0('0x4')},'ListId':{'type':Sequelize[_0xcdd0('0x5')],'unique':_0xcdd0('0x4')},'VoiceQueueId':{'type':Sequelize[_0xcdd0('0x5')],'unique':_0xcdd0('0x4')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index bac5b7c..6a6caa4 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 _0xee86=['send','map','CmHopperBlack','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','rawAttributes','keys','includeAll','find','update','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','then','destroy','name'];(function(_0x397034,_0x3497fa){var _0x33c2a8=function(_0x92efe6){while(--_0x92efe6){_0x397034['push'](_0x397034['shift']());}};_0x33c2a8(++_0x3497fa);}(_0xee86,0x1eb));var _0x6ee8=function(_0x24f31b,_0x44b8f3){_0x24f31b=_0x24f31b-0x0;var _0x488401=_0xee86[_0x24f31b];return _0x488401;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6ee8('0x0'));var zipdir=require(_0x6ee8('0x1'));var jsonpatch=require(_0x6ee8('0x2'));var rp=require(_0x6ee8('0x3'));var moment=require(_0x6ee8('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6ee8('0x5'));var util=require(_0x6ee8('0x6'));var path=require(_0x6ee8('0x7'));var sox=require(_0x6ee8('0x8'));var csv=require(_0x6ee8('0x9'));var ejs=require(_0x6ee8('0xa'));var fs=require('fs');var fs_extra=require(_0x6ee8('0xb'));var _=require(_0x6ee8('0xc'));var squel=require(_0x6ee8('0xd'));var crypto=require(_0x6ee8('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6ee8('0x9'));var querystring=require(_0x6ee8('0xf'));var Papa=require(_0x6ee8('0x10'));var Redis=require(_0x6ee8('0x11'));var authService=require(_0x6ee8('0x12'));var qs=require(_0x6ee8('0x13'));var as=require(_0x6ee8('0x14'));var hardwareService=require(_0x6ee8('0x15'));var logger=require(_0x6ee8('0x16'))(_0x6ee8('0x17'));var utils=require(_0x6ee8('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x6ee8('0x19'))['db'];function respondWithStatusCode(_0x1273e6,_0x2637be){_0x2637be=_0x2637be||0xcc;return function(_0x174d90){if(_0x174d90){return _0x1273e6[_0x6ee8('0x1a')](_0x2637be);}return _0x1273e6[_0x6ee8('0x1b')](_0x2637be)[_0x6ee8('0x1c')]();};}function respondWithResult(_0x67f261,_0xfbf15c){_0xfbf15c=_0xfbf15c||0xc8;return function(_0x13367f){if(_0x13367f){return _0x67f261[_0x6ee8('0x1b')](_0xfbf15c)[_0x6ee8('0x1d')](_0x13367f);}};}function respondWithFilteredResult(_0x240a4f,_0x4512ba){return function(_0xb6ac66){if(_0xb6ac66){var _0x4dfa08=typeof _0x4512ba[_0x6ee8('0x1e')]===_0x6ee8('0x1f')&&typeof _0x4512ba[_0x6ee8('0x20')]===_0x6ee8('0x1f');var _0x424641=_0xb6ac66[_0x6ee8('0x21')];var _0x2a7a38=_0x4dfa08?0x0:_0x4512ba[_0x6ee8('0x1e')];var _0x4d8e5d=_0x4dfa08?_0xb6ac66[_0x6ee8('0x21')]:_0x4512ba[_0x6ee8('0x1e')]+_0x4512ba[_0x6ee8('0x20')];var _0x300901;if(_0x4d8e5d>=_0x424641){_0x4d8e5d=_0x424641;_0x300901=0xc8;}else{_0x300901=0xce;}_0x240a4f['status'](_0x300901);return _0x240a4f[_0x6ee8('0x22')]('Content-Range',_0x2a7a38+'-'+_0x4d8e5d+'/'+_0x424641)[_0x6ee8('0x1d')](_0xb6ac66);}return null;};}function patchUpdates(_0x712508){return function(_0x207bae){try{jsonpatch[_0x6ee8('0x23')](_0x207bae,_0x712508,!![]);}catch(_0x2df821){return BPromise[_0x6ee8('0x24')](_0x2df821);}return _0x207bae[_0x6ee8('0x25')]();};}function saveUpdates(_0x300973,_0x4613f4){return function(_0x101dba){if(_0x101dba){return _0x101dba['update'](_0x300973)[_0x6ee8('0x26')](function(_0x524ccb){return _0x524ccb;});}return null;};}function removeEntity(_0x4c0f78,_0x38cd64){return function(_0xa8c586){if(_0xa8c586){return _0xa8c586[_0x6ee8('0x27')]()['then'](function(){_0x4c0f78[_0x6ee8('0x1b')](0xcc)[_0x6ee8('0x1c')]();});}};}function handleEntityNotFound(_0x4cec63,_0x2590ec){return function(_0x53f828){if(!_0x53f828){_0x4cec63[_0x6ee8('0x1a')](0x194);}return _0x53f828;};}function handleError(_0x2d0f21,_0x4a69ca){_0x4a69ca=_0x4a69ca||0x1f4;return function(_0x11125a){logger['error'](_0x11125a['stack']);if(_0x11125a[_0x6ee8('0x28')]){delete _0x11125a[_0x6ee8('0x28')];}_0x2d0f21[_0x6ee8('0x1b')](_0x4a69ca)[_0x6ee8('0x29')](_0x11125a);};}exports['index']=function(_0x58389d,_0x76d4ed){var _0x54933e={},_0x3044eb={},_0x226c1f={'count':0x0,'rows':[]};var _0x34a2c3=_[_0x6ee8('0x2a')](db[_0x6ee8('0x2b')]['rawAttributes'],function(_0x26420f){return{'name':_0x26420f[_0x6ee8('0x2c')],'type':_0x26420f[_0x6ee8('0x2d')][_0x6ee8('0x2e')]};});_0x3044eb['model']=_[_0x6ee8('0x2a')](_0x34a2c3,'name');_0x3044eb[_0x6ee8('0x2f')]=_['keys'](_0x58389d[_0x6ee8('0x2f')]);_0x3044eb[_0x6ee8('0x30')]=_[_0x6ee8('0x31')](_0x3044eb[_0x6ee8('0x32')],_0x3044eb[_0x6ee8('0x2f')]);_0x54933e[_0x6ee8('0x33')]=_[_0x6ee8('0x31')](_0x3044eb[_0x6ee8('0x32')],qs[_0x6ee8('0x34')](_0x58389d[_0x6ee8('0x2f')]['fields']));_0x54933e[_0x6ee8('0x33')]=_0x54933e[_0x6ee8('0x33')][_0x6ee8('0x35')]?_0x54933e[_0x6ee8('0x33')]:_0x3044eb[_0x6ee8('0x32')];if(!_0x58389d[_0x6ee8('0x2f')][_0x6ee8('0x36')](_0x6ee8('0x37'))){_0x54933e[_0x6ee8('0x20')]=qs[_0x6ee8('0x20')](_0x58389d[_0x6ee8('0x2f')][_0x6ee8('0x20')]);_0x54933e[_0x6ee8('0x1e')]=qs[_0x6ee8('0x1e')](_0x58389d[_0x6ee8('0x2f')][_0x6ee8('0x1e')]);}_0x54933e['order']=qs[_0x6ee8('0x38')](_0x58389d['query'][_0x6ee8('0x38')]);_0x54933e[_0x6ee8('0x39')]=qs['filters'](_[_0x6ee8('0x3a')](_0x58389d[_0x6ee8('0x2f')],_0x3044eb[_0x6ee8('0x30')]),_0x34a2c3);if(_0x58389d[_0x6ee8('0x2f')]['filter']){_0x54933e[_0x6ee8('0x39')]=_[_0x6ee8('0x3b')](_0x54933e[_0x6ee8('0x39')],{'$or':_['map'](_0x34a2c3,function(_0x5b4697){if(_0x5b4697['type']!==_0x6ee8('0x3c')){var _0x477044={};_0x477044[_0x5b4697[_0x6ee8('0x28')]]={'$like':'%'+_0x58389d[_0x6ee8('0x2f')][_0x6ee8('0x3d')]+'%'};return _0x477044;}})});}_0x54933e=_[_0x6ee8('0x3b')]({},_0x54933e,_0x58389d[_0x6ee8('0x3e')]);var _0x164f69={'where':_0x54933e[_0x6ee8('0x39')]};return db[_0x6ee8('0x2b')][_0x6ee8('0x21')](_0x164f69)[_0x6ee8('0x26')](function(_0x33e2f4){_0x226c1f[_0x6ee8('0x21')]=_0x33e2f4;if(_0x58389d['query']['includeAll']){_0x54933e[_0x6ee8('0x3f')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x6ee8('0x40')](_0x54933e);})[_0x6ee8('0x26')](function(_0x17b57b){_0x226c1f[_0x6ee8('0x41')]=_0x17b57b;return _0x226c1f;})[_0x6ee8('0x26')](respondWithFilteredResult(_0x76d4ed,_0x54933e))[_0x6ee8('0x42')](handleError(_0x76d4ed,null));};exports[_0x6ee8('0x43')]=function(_0x21ad68,_0xa0eda4){var _0xc15259={'raw':!![],'where':{'id':_0x21ad68[_0x6ee8('0x44')]['id']}},_0x319282={};_0x319282[_0x6ee8('0x32')]=_['keys'](db[_0x6ee8('0x2b')][_0x6ee8('0x45')]);_0x319282[_0x6ee8('0x2f')]=_[_0x6ee8('0x46')](_0x21ad68[_0x6ee8('0x2f')]);_0x319282['filters']=_['intersection'](_0x319282[_0x6ee8('0x32')],_0x319282[_0x6ee8('0x2f')]);_0xc15259[_0x6ee8('0x33')]=_[_0x6ee8('0x31')](_0x319282[_0x6ee8('0x32')],qs[_0x6ee8('0x34')](_0x21ad68[_0x6ee8('0x2f')]['fields']));_0xc15259[_0x6ee8('0x33')]=_0xc15259[_0x6ee8('0x33')][_0x6ee8('0x35')]?_0xc15259[_0x6ee8('0x33')]:_0x319282[_0x6ee8('0x32')];if(_0x21ad68[_0x6ee8('0x2f')][_0x6ee8('0x47')]){_0xc15259[_0x6ee8('0x3f')]=[{'all':!![]}];}_0xc15259=_['merge']({},_0xc15259,_0x21ad68[_0x6ee8('0x3e')]);return db[_0x6ee8('0x2b')][_0x6ee8('0x48')](_0xc15259)[_0x6ee8('0x26')](handleEntityNotFound(_0xa0eda4,null))[_0x6ee8('0x26')](respondWithResult(_0xa0eda4,null))[_0x6ee8('0x42')](handleError(_0xa0eda4,null));};exports[_0x6ee8('0x49')]=function(_0x5c37ef,_0x5a12b2){if(_0x5c37ef[_0x6ee8('0x4a')]['id']){delete _0x5c37ef[_0x6ee8('0x4a')]['id'];}return db['CmHopperBlack'][_0x6ee8('0x48')]({'where':{'id':_0x5c37ef[_0x6ee8('0x44')]['id']}})[_0x6ee8('0x26')](handleEntityNotFound(_0x5a12b2,null))[_0x6ee8('0x26')](saveUpdates(_0x5c37ef[_0x6ee8('0x4a')],null))[_0x6ee8('0x26')](respondWithResult(_0x5a12b2,null))[_0x6ee8('0x42')](handleError(_0x5a12b2,null));};exports['destroy']=function(_0x5022a8,_0x135bb8){return db[_0x6ee8('0x2b')][_0x6ee8('0x48')]({'where':{'id':_0x5022a8[_0x6ee8('0x44')]['id']}})[_0x6ee8('0x26')](handleEntityNotFound(_0x135bb8,null))[_0x6ee8('0x26')](removeEntity(_0x135bb8,null))['catch'](handleError(_0x135bb8,null));};exports[_0x6ee8('0x4b')]=function(_0x559a56,_0x3f2422){return db['CmHopperBlack'][_0x6ee8('0x4b')]()[_0x6ee8('0x26')](respondWithResult(_0x3f2422,null))[_0x6ee8('0x42')](handleError(_0x3f2422,null));}; \ No newline at end of file +var _0x4d60=['ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','destroy','error','stack','name','send','map','rawAttributes','fieldName','key','query','keys','filters','model','attributes','fields','length','nolimit','sort','where','filter','merge','type','VIRTUAL','options','CmHopperBlack','then','includeAll','include','findAll','rows','catch','intersection','find','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4d60,0x7d));var _0x04d6=function(_0x38e370,_0x2f9d10){_0x38e370=_0x38e370-0x0;var _0x53a265=_0x4d60[_0x38e370];return _0x53a265;};'use strict';var emlformat=require(_0x04d6('0x0'));var rimraf=require(_0x04d6('0x1'));var zipdir=require(_0x04d6('0x2'));var jsonpatch=require(_0x04d6('0x3'));var rp=require(_0x04d6('0x4'));var moment=require('moment');var BPromise=require(_0x04d6('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x04d6('0x6'));var sox=require('sox');var csv=require(_0x04d6('0x7'));var ejs=require(_0x04d6('0x8'));var fs=require('fs');var fs_extra=require(_0x04d6('0x9'));var _=require(_0x04d6('0xa'));var squel=require(_0x04d6('0xb'));var crypto=require(_0x04d6('0xc'));var jsforce=require(_0x04d6('0xd'));var deskjs=require(_0x04d6('0xe'));var toCsv=require(_0x04d6('0x7'));var querystring=require(_0x04d6('0xf'));var Papa=require(_0x04d6('0x10'));var Redis=require(_0x04d6('0x11'));var authService=require(_0x04d6('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x04d6('0x13'));var hardwareService=require(_0x04d6('0x14'));var logger=require(_0x04d6('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1bc085,_0x2cb375){_0x2cb375=_0x2cb375||0xcc;return function(_0x376f0b){if(_0x376f0b){return _0x1bc085[_0x04d6('0x16')](_0x2cb375);}return _0x1bc085[_0x04d6('0x17')](_0x2cb375)[_0x04d6('0x18')]();};}function respondWithResult(_0x589733,_0x3c734e){_0x3c734e=_0x3c734e||0xc8;return function(_0x53c6be){if(_0x53c6be){return _0x589733[_0x04d6('0x17')](_0x3c734e)['json'](_0x53c6be);}};}function respondWithFilteredResult(_0x316025,_0x189d20){return function(_0x608194){if(_0x608194){var _0x46900e=typeof _0x189d20[_0x04d6('0x19')]===_0x04d6('0x1a')&&typeof _0x189d20[_0x04d6('0x1b')]===_0x04d6('0x1a');var _0x503ffd=_0x608194[_0x04d6('0x1c')];var _0x1382f5=_0x46900e?0x0:_0x189d20[_0x04d6('0x19')];var _0x2dd1d5=_0x46900e?_0x608194[_0x04d6('0x1c')]:_0x189d20[_0x04d6('0x19')]+_0x189d20[_0x04d6('0x1b')];var _0x28bb2b;if(_0x2dd1d5>=_0x503ffd){_0x2dd1d5=_0x503ffd;_0x28bb2b=0xc8;}else{_0x28bb2b=0xce;}_0x316025[_0x04d6('0x17')](_0x28bb2b);return _0x316025[_0x04d6('0x1d')](_0x04d6('0x1e'),_0x1382f5+'-'+_0x2dd1d5+'/'+_0x503ffd)[_0x04d6('0x1f')](_0x608194);}return null;};}function patchUpdates(_0x2b662c){return function(_0x12948f){try{jsonpatch['apply'](_0x12948f,_0x2b662c,!![]);}catch(_0x1567cb){return BPromise[_0x04d6('0x20')](_0x1567cb);}return _0x12948f[_0x04d6('0x21')]();};}function saveUpdates(_0x2787c5,_0x5e109b){return function(_0x37535d){if(_0x37535d){return _0x37535d[_0x04d6('0x22')](_0x2787c5)['then'](function(_0x48946e){return _0x48946e;});}return null;};}function removeEntity(_0x112690,_0x443d18){return function(_0x2d0b3b){if(_0x2d0b3b){return _0x2d0b3b[_0x04d6('0x23')]()['then'](function(){_0x112690[_0x04d6('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x40fc52,_0x5b0d8b){return function(_0xca4aa8){if(!_0xca4aa8){_0x40fc52[_0x04d6('0x16')](0x194);}return _0xca4aa8;};}function handleError(_0x46ed9b,_0x12bebc){_0x12bebc=_0x12bebc||0x1f4;return function(_0x59fa29){logger[_0x04d6('0x24')](_0x59fa29[_0x04d6('0x25')]);if(_0x59fa29[_0x04d6('0x26')]){delete _0x59fa29[_0x04d6('0x26')];}_0x46ed9b[_0x04d6('0x17')](_0x12bebc)[_0x04d6('0x27')](_0x59fa29);};}exports['index']=function(_0x262a23,_0x52d868){var _0x268282={},_0x3a8550={},_0x8fe1d0={'count':0x0,'rows':[]};var _0x57162e=_[_0x04d6('0x28')](db['CmHopperBlack'][_0x04d6('0x29')],function(_0x3117d7){return{'name':_0x3117d7[_0x04d6('0x2a')],'type':_0x3117d7['type'][_0x04d6('0x2b')]};});_0x3a8550['model']=_[_0x04d6('0x28')](_0x57162e,_0x04d6('0x26'));_0x3a8550[_0x04d6('0x2c')]=_[_0x04d6('0x2d')](_0x262a23[_0x04d6('0x2c')]);_0x3a8550[_0x04d6('0x2e')]=_['intersection'](_0x3a8550[_0x04d6('0x2f')],_0x3a8550['query']);_0x268282[_0x04d6('0x30')]=_['intersection'](_0x3a8550[_0x04d6('0x2f')],qs[_0x04d6('0x31')](_0x262a23[_0x04d6('0x2c')][_0x04d6('0x31')]));_0x268282['attributes']=_0x268282[_0x04d6('0x30')][_0x04d6('0x32')]?_0x268282[_0x04d6('0x30')]:_0x3a8550[_0x04d6('0x2f')];if(!_0x262a23[_0x04d6('0x2c')]['hasOwnProperty'](_0x04d6('0x33'))){_0x268282[_0x04d6('0x1b')]=qs[_0x04d6('0x1b')](_0x262a23['query'][_0x04d6('0x1b')]);_0x268282[_0x04d6('0x19')]=qs['offset'](_0x262a23[_0x04d6('0x2c')][_0x04d6('0x19')]);}_0x268282['order']=qs[_0x04d6('0x34')](_0x262a23[_0x04d6('0x2c')][_0x04d6('0x34')]);_0x268282[_0x04d6('0x35')]=qs[_0x04d6('0x2e')](_['pick'](_0x262a23['query'],_0x3a8550[_0x04d6('0x2e')]),_0x57162e);if(_0x262a23[_0x04d6('0x2c')][_0x04d6('0x36')]){_0x268282['where']=_[_0x04d6('0x37')](_0x268282[_0x04d6('0x35')],{'$or':_[_0x04d6('0x28')](_0x57162e,function(_0x4fd562){if(_0x4fd562[_0x04d6('0x38')]!==_0x04d6('0x39')){var _0x1e9661={};_0x1e9661[_0x4fd562[_0x04d6('0x26')]]={'$like':'%'+_0x262a23[_0x04d6('0x2c')][_0x04d6('0x36')]+'%'};return _0x1e9661;}})});}_0x268282=_[_0x04d6('0x37')]({},_0x268282,_0x262a23[_0x04d6('0x3a')]);var _0x22ee3b={'where':_0x268282[_0x04d6('0x35')]};return db[_0x04d6('0x3b')]['count'](_0x22ee3b)[_0x04d6('0x3c')](function(_0x17b8e3){_0x8fe1d0[_0x04d6('0x1c')]=_0x17b8e3;if(_0x262a23[_0x04d6('0x2c')][_0x04d6('0x3d')]){_0x268282[_0x04d6('0x3e')]=[{'all':!![]}];}return db[_0x04d6('0x3b')][_0x04d6('0x3f')](_0x268282);})[_0x04d6('0x3c')](function(_0x424284){_0x8fe1d0[_0x04d6('0x40')]=_0x424284;return _0x8fe1d0;})[_0x04d6('0x3c')](respondWithFilteredResult(_0x52d868,_0x268282))[_0x04d6('0x41')](handleError(_0x52d868,null));};exports['show']=function(_0x47664b,_0x100943){var _0x2e6e90={'raw':!![],'where':{'id':_0x47664b['params']['id']}},_0xc1e72e={};_0xc1e72e[_0x04d6('0x2f')]=_['keys'](db[_0x04d6('0x3b')]['rawAttributes']);_0xc1e72e[_0x04d6('0x2c')]=_['keys'](_0x47664b[_0x04d6('0x2c')]);_0xc1e72e[_0x04d6('0x2e')]=_[_0x04d6('0x42')](_0xc1e72e[_0x04d6('0x2f')],_0xc1e72e[_0x04d6('0x2c')]);_0x2e6e90['attributes']=_[_0x04d6('0x42')](_0xc1e72e[_0x04d6('0x2f')],qs['fields'](_0x47664b[_0x04d6('0x2c')]['fields']));_0x2e6e90[_0x04d6('0x30')]=_0x2e6e90['attributes'][_0x04d6('0x32')]?_0x2e6e90['attributes']:_0xc1e72e[_0x04d6('0x2f')];if(_0x47664b[_0x04d6('0x2c')][_0x04d6('0x3d')]){_0x2e6e90[_0x04d6('0x3e')]=[{'all':!![]}];}_0x2e6e90=_[_0x04d6('0x37')]({},_0x2e6e90,_0x47664b[_0x04d6('0x3a')]);return db[_0x04d6('0x3b')][_0x04d6('0x43')](_0x2e6e90)['then'](handleEntityNotFound(_0x100943,null))[_0x04d6('0x3c')](respondWithResult(_0x100943,null))[_0x04d6('0x41')](handleError(_0x100943,null));};exports['update']=function(_0x160b68,_0x490098){if(_0x160b68[_0x04d6('0x44')]['id']){delete _0x160b68[_0x04d6('0x44')]['id'];}return db[_0x04d6('0x3b')][_0x04d6('0x43')]({'where':{'id':_0x160b68[_0x04d6('0x45')]['id']}})[_0x04d6('0x3c')](handleEntityNotFound(_0x490098,null))[_0x04d6('0x3c')](saveUpdates(_0x160b68['body'],null))[_0x04d6('0x3c')](respondWithResult(_0x490098,null))['catch'](handleError(_0x490098,null));};exports['destroy']=function(_0x2d5ae8,_0x3892c){return db['CmHopperBlack']['find']({'where':{'id':_0x2d5ae8['params']['id']}})['then'](handleEntityNotFound(_0x3892c,null))['then'](removeEntity(_0x3892c,null))['catch'](handleError(_0x3892c,null));};exports['describe']=function(_0x26472a,_0xc1daf3){return db[_0x04d6('0x3b')][_0x04d6('0x46')]()[_0x04d6('0x3c')](respondWithResult(_0xc1daf3,null))[_0x04d6('0x41')](handleError(_0xc1daf3,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 182f2e0..d67cc7c 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 _0xc179=['exports','define','CmHopperBlack','lodash','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./cmHopperBlack.attributes'];(function(_0x370cb1,_0x2ddedd){var _0x20998c=function(_0x42f95a){while(--_0x42f95a){_0x370cb1['push'](_0x370cb1['shift']());}};_0x20998c(++_0x2ddedd);}(_0xc179,0x158));var _0x9c17=function(_0x18a16d,_0x199976){_0x18a16d=_0x18a16d-0x0;var _0x21cf0c=_0xc179[_0x18a16d];return _0x21cf0c;};'use strict';var _=require(_0x9c17('0x0'));var util=require('util');var logger=require(_0x9c17('0x1'))(_0x9c17('0x2'));var moment=require(_0x9c17('0x3'));var BPromise=require(_0x9c17('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x9c17('0x5'));var config=require(_0x9c17('0x6'));var attributes=require(_0x9c17('0x7'));module[_0x9c17('0x8')]=function(_0x5e5a6a,_0x539409){return _0x5e5a6a[_0x9c17('0x9')](_0x9c17('0xa'),attributes,{'tableName':'cm_hopper_black','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8899=['bluebird','path','rimraf','../../config/environment','./cmHopperBlack.attributes','exports','define','CmHopperBlack','cm_hopper_black','lodash','util','moment'];(function(_0xfaa291,_0x33534f){var _0x8ad402=function(_0x45d5e8){while(--_0x45d5e8){_0xfaa291['push'](_0xfaa291['shift']());}};_0x8ad402(++_0x33534f);}(_0x8899,0x129));var _0x9889=function(_0x25f67c,_0x45c809){_0x25f67c=_0x25f67c-0x0;var _0x9e68f7=_0x8899[_0x25f67c];return _0x9e68f7;};'use strict';var _=require(_0x9889('0x0'));var util=require(_0x9889('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x9889('0x2'));var BPromise=require(_0x9889('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9889('0x4'));var rimraf=require(_0x9889('0x5'));var config=require(_0x9889('0x6'));var attributes=require(_0x9889('0x7'));module[_0x9889('0x8')]=function(_0x4e1149,_0x15ec02){return _0x4e1149[_0x9889('0x9')](_0x9889('0xa'),attributes,{'tableName':_0x9889('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 6d1ce88..01cf031 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 _0x406a=['catch','GetCmHopperBlack','CmHopperBlack','options','raw','attributes','limit','include','map','model','then','stringify','UpdateCmHopperBlack','update','body','where','DestroyCmHopperBlack','destroy','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','info','CmHopperBlack,\x20%s,\x20%s','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result'];(function(_0x574c3b,_0x56c826){var _0x24ea08=function(_0x466fa4){while(--_0x466fa4){_0x574c3b['push'](_0x574c3b['shift']());}};_0x24ea08(++_0x56c826);}(_0x406a,0x1b4));var _0xa406=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0x406a[_0x4ff09b];return _0x3f5c2e;};'use strict';var _=require(_0xa406('0x0'));var util=require('util');var moment=require(_0xa406('0x1'));var BPromise=require(_0xa406('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa406('0x3'));var db=require(_0xa406('0x4'))['db'];var utils=require(_0xa406('0x5'));var logger=require('../../config/logger')(_0xa406('0x6'));var config=require('../../config/environment');var jayson=require(_0xa406('0x7'));var client=jayson[_0xa406('0x8')][_0xa406('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x23834c,_0x427a74,_0x22af06){return new BPromise(function(_0x22a527,_0x2e6aa7){return client[_0xa406('0xa')](_0x23834c,_0x22af06)['then'](function(_0x572cdd){logger[_0xa406('0xb')](_0xa406('0xc'),_0x427a74,'request\x20sent');logger[_0xa406('0xd')](_0xa406('0xe'),_0x427a74,_0xa406('0xf'),JSON['stringify'](_0x572cdd));if(_0x572cdd['error']){if(_0x572cdd[_0xa406('0x10')][_0xa406('0x11')]===0x1f4){logger[_0xa406('0x10')](_0xa406('0xc'),_0x427a74,_0x572cdd[_0xa406('0x10')]['message']);return _0x2e6aa7(_0x572cdd[_0xa406('0x10')][_0xa406('0x12')]);}logger[_0xa406('0x10')](_0xa406('0xc'),_0x427a74,_0x572cdd[_0xa406('0x10')]['message']);return _0x22a527(_0x572cdd[_0xa406('0x10')][_0xa406('0x12')]);}else{logger['info'](_0xa406('0xc'),_0x427a74,_0xa406('0xf'));_0x22a527(_0x572cdd[_0xa406('0x13')][_0xa406('0x12')]);}})[_0xa406('0x14')](function(_0x7e9e0){logger[_0xa406('0x10')](_0xa406('0xc'),_0x427a74,_0x7e9e0);_0x2e6aa7(_0x7e9e0);});});}exports[_0xa406('0x15')]=function(_0x59b7f9){var _0x58ecc4=this;return new Promise(function(_0x2ff721,_0x232776){return db[_0xa406('0x16')]['findAll']({'raw':_0x59b7f9[_0xa406('0x17')]?_0x59b7f9[_0xa406('0x17')][_0xa406('0x18')]===undefined?!![]:![]:!![],'where':_0x59b7f9[_0xa406('0x17')]?_0x59b7f9['options']['where']||null:null,'attributes':_0x59b7f9[_0xa406('0x17')]?_0x59b7f9[_0xa406('0x17')][_0xa406('0x19')]||null:null,'limit':_0x59b7f9[_0xa406('0x17')]?_0x59b7f9[_0xa406('0x17')][_0xa406('0x1a')]||null:null,'include':_0x59b7f9[_0xa406('0x17')]?_0x59b7f9['options'][_0xa406('0x1b')]?_[_0xa406('0x1c')](_0x59b7f9[_0xa406('0x17')][_0xa406('0x1b')],function(_0x170db3){return{'model':db[_0x170db3['model']],'as':_0x170db3['as'],'attributes':_0x170db3[_0xa406('0x19')],'include':_0x170db3[_0xa406('0x1b')]?_[_0xa406('0x1c')](_0x170db3[_0xa406('0x1b')],function(_0x2cb54e){return{'model':db[_0x2cb54e[_0xa406('0x1d')]],'as':_0x2cb54e['as'],'attributes':_0x2cb54e[_0xa406('0x19')],'include':_0x2cb54e[_0xa406('0x1b')]?_[_0xa406('0x1c')](_0x2cb54e['include'],function(_0x258299){return{'model':db[_0x258299[_0xa406('0x1d')]],'as':_0x258299['as'],'attributes':_0x258299[_0xa406('0x19')]};}):[]};}):[]};}):[]:[]})[_0xa406('0x1e')](function(_0x362420){logger[_0xa406('0xb')](_0xa406('0x15'),_0x59b7f9);logger[_0xa406('0xd')]('GetCmHopperBlack',_0x59b7f9,JSON[_0xa406('0x1f')](_0x362420));_0x2ff721(_0x362420);})[_0xa406('0x14')](function(_0x5447b8){logger['error'](_0xa406('0x15'),_0x5447b8[_0xa406('0x12')],_0x59b7f9);_0x232776(_0x58ecc4[_0xa406('0x10')](0x1f4,_0x5447b8['message']));});});};exports[_0xa406('0x20')]=function(_0x27411e){var _0x589d55=this;return new Promise(function(_0x398363,_0x4fcb4f){return db['CmHopperBlack'][_0xa406('0x21')](_0x27411e[_0xa406('0x22')],{'raw':_0x27411e[_0xa406('0x17')]?_0x27411e[_0xa406('0x17')][_0xa406('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x27411e['options']?_0x27411e[_0xa406('0x17')][_0xa406('0x23')]||null:null,'attributes':_0x27411e[_0xa406('0x17')]?_0x27411e[_0xa406('0x17')][_0xa406('0x19')]||null:null,'limit':_0x27411e['options']?_0x27411e[_0xa406('0x17')][_0xa406('0x1a')]||null:null})[_0xa406('0x1e')](function(_0x45852f){logger['info'](_0xa406('0x20'),_0x27411e);logger[_0xa406('0xd')](_0xa406('0x20'),_0x27411e,JSON['stringify'](_0x45852f));_0x398363(_0x45852f);})[_0xa406('0x14')](function(_0x455d2d){logger[_0xa406('0x10')](_0xa406('0x20'),_0x455d2d[_0xa406('0x12')],_0x27411e);_0x4fcb4f(_0x589d55[_0xa406('0x10')](0x1f4,_0x455d2d['message']));});});};exports[_0xa406('0x24')]=function(_0x468ae7){var _0x5ca7b8=this;return new Promise(function(_0x5f29f5,_0xe6b57){return db[_0xa406('0x16')][_0xa406('0x25')]({'where':_0x468ae7[_0xa406('0x17')]?_0x468ae7['options'][_0xa406('0x23')]||null:null})[_0xa406('0x1e')](function(_0x27db0c){logger[_0xa406('0xb')]('DestroyCmHopperBlack',_0x468ae7);logger[_0xa406('0xd')]('DestroyCmHopperBlack',_0x468ae7,JSON[_0xa406('0x1f')](_0x27db0c));_0x5f29f5(_0x27db0c);})['catch'](function(_0x4a275c){logger[_0xa406('0x10')](_0xa406('0x24'),_0x4a275c[_0xa406('0x12')],_0x468ae7);_0xe6b57(_0x5ca7b8[_0xa406('0x10')](0x1f4,_0x4a275c[_0xa406('0x12')]));});});}; \ No newline at end of file +var _0x3d98=['result','catch','GetCmHopperBlack','CmHopperBlack','findAll','options','raw','limit','map','model','include','attributes','then','update','body','where','UpdateCmHopperBlack','debug','DestroyCmHopperBlack','destroy','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','client','http','request','info','CmHopperBlack,\x20%s,\x20%s','CmHopperBlack,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x3d98,0xf8));var _0x83d9=function(_0x2b309e,_0xb5625a){_0x2b309e=_0x2b309e-0x0;var _0x569be2=_0x3d98[_0x2b309e];return _0x569be2;};'use strict';var _=require('lodash');var util=require(_0x83d9('0x0'));var moment=require(_0x83d9('0x1'));var BPromise=require(_0x83d9('0x2'));var rs=require(_0x83d9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x83d9('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x83d9('0x5'))(_0x83d9('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x83d9('0x7')][_0x83d9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x32e667,_0x51127d,_0x2d7629){return new BPromise(function(_0x1b5014,_0x1b9c6f){return client[_0x83d9('0x9')](_0x32e667,_0x2d7629)['then'](function(_0x5d9ca6){logger[_0x83d9('0xa')](_0x83d9('0xb'),_0x51127d,'request\x20sent');logger['debug'](_0x83d9('0xc'),_0x51127d,_0x83d9('0xd'),JSON[_0x83d9('0xe')](_0x5d9ca6));if(_0x5d9ca6[_0x83d9('0xf')]){if(_0x5d9ca6[_0x83d9('0xf')][_0x83d9('0x10')]===0x1f4){logger[_0x83d9('0xf')](_0x83d9('0xb'),_0x51127d,_0x5d9ca6[_0x83d9('0xf')][_0x83d9('0x11')]);return _0x1b9c6f(_0x5d9ca6['error'][_0x83d9('0x11')]);}logger['error']('CmHopperBlack,\x20%s,\x20%s',_0x51127d,_0x5d9ca6[_0x83d9('0xf')][_0x83d9('0x11')]);return _0x1b5014(_0x5d9ca6[_0x83d9('0xf')][_0x83d9('0x11')]);}else{logger['info'](_0x83d9('0xb'),_0x51127d,'request\x20sent');_0x1b5014(_0x5d9ca6[_0x83d9('0x12')][_0x83d9('0x11')]);}})[_0x83d9('0x13')](function(_0x490fc2){logger['error'](_0x83d9('0xb'),_0x51127d,_0x490fc2);_0x1b9c6f(_0x490fc2);});});}exports[_0x83d9('0x14')]=function(_0x5d2b0a){var _0xe5f857=this;return new Promise(function(_0xca61aa,_0x1e0faf){return db[_0x83d9('0x15')][_0x83d9('0x16')]({'raw':_0x5d2b0a['options']?_0x5d2b0a[_0x83d9('0x17')][_0x83d9('0x18')]===undefined?!![]:![]:!![],'where':_0x5d2b0a[_0x83d9('0x17')]?_0x5d2b0a[_0x83d9('0x17')]['where']||null:null,'attributes':_0x5d2b0a[_0x83d9('0x17')]?_0x5d2b0a[_0x83d9('0x17')]['attributes']||null:null,'limit':_0x5d2b0a['options']?_0x5d2b0a['options'][_0x83d9('0x19')]||null:null,'include':_0x5d2b0a[_0x83d9('0x17')]?_0x5d2b0a[_0x83d9('0x17')]['include']?_[_0x83d9('0x1a')](_0x5d2b0a[_0x83d9('0x17')]['include'],function(_0x5371fc){return{'model':db[_0x5371fc[_0x83d9('0x1b')]],'as':_0x5371fc['as'],'attributes':_0x5371fc['attributes'],'include':_0x5371fc[_0x83d9('0x1c')]?_[_0x83d9('0x1a')](_0x5371fc[_0x83d9('0x1c')],function(_0x195942){return{'model':db[_0x195942['model']],'as':_0x195942['as'],'attributes':_0x195942[_0x83d9('0x1d')],'include':_0x195942[_0x83d9('0x1c')]?_[_0x83d9('0x1a')](_0x195942[_0x83d9('0x1c')],function(_0xc826ea){return{'model':db[_0xc826ea[_0x83d9('0x1b')]],'as':_0xc826ea['as'],'attributes':_0xc826ea[_0x83d9('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x83d9('0x1e')](function(_0x588051){logger[_0x83d9('0xa')](_0x83d9('0x14'),_0x5d2b0a);logger['debug'](_0x83d9('0x14'),_0x5d2b0a,JSON[_0x83d9('0xe')](_0x588051));_0xca61aa(_0x588051);})['catch'](function(_0x617ae4){logger[_0x83d9('0xf')](_0x83d9('0x14'),_0x617ae4[_0x83d9('0x11')],_0x5d2b0a);_0x1e0faf(_0xe5f857[_0x83d9('0xf')](0x1f4,_0x617ae4['message']));});});};exports['UpdateCmHopperBlack']=function(_0x31af31){var _0x3e5ec4=this;return new Promise(function(_0x5a8961,_0x24adc5){return db[_0x83d9('0x15')][_0x83d9('0x1f')](_0x31af31[_0x83d9('0x20')],{'raw':_0x31af31[_0x83d9('0x17')]?_0x31af31['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x31af31[_0x83d9('0x17')]?_0x31af31['options'][_0x83d9('0x21')]||null:null,'attributes':_0x31af31[_0x83d9('0x17')]?_0x31af31[_0x83d9('0x17')][_0x83d9('0x1d')]||null:null,'limit':_0x31af31[_0x83d9('0x17')]?_0x31af31['options'][_0x83d9('0x19')]||null:null})[_0x83d9('0x1e')](function(_0x50eb23){logger[_0x83d9('0xa')](_0x83d9('0x22'),_0x31af31);logger[_0x83d9('0x23')]('UpdateCmHopperBlack',_0x31af31,JSON[_0x83d9('0xe')](_0x50eb23));_0x5a8961(_0x50eb23);})[_0x83d9('0x13')](function(_0x50e650){logger[_0x83d9('0xf')](_0x83d9('0x22'),_0x50e650[_0x83d9('0x11')],_0x31af31);_0x24adc5(_0x3e5ec4[_0x83d9('0xf')](0x1f4,_0x50e650['message']));});});};exports[_0x83d9('0x24')]=function(_0x1d840a){var _0x22803e=this;return new Promise(function(_0xeb5ad7,_0x3ee4d6){return db['CmHopperBlack'][_0x83d9('0x25')]({'where':_0x1d840a[_0x83d9('0x17')]?_0x1d840a[_0x83d9('0x17')]['where']||null:null})[_0x83d9('0x1e')](function(_0x44a21c){logger['info'](_0x83d9('0x24'),_0x1d840a);logger[_0x83d9('0x23')](_0x83d9('0x24'),_0x1d840a,JSON[_0x83d9('0xe')](_0x44a21c));_0xeb5ad7(_0x44a21c);})[_0x83d9('0x13')](function(_0x1f9fb8){logger[_0x83d9('0xf')]('DestroyCmHopperBlack',_0x1f9fb8[_0x83d9('0x11')],_0x1d840a);_0x3ee4d6(_0x22803e[_0x83d9('0xf')](0x1f4,_0x1f9fb8[_0x83d9('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 1782d27..077d1a4 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 _0xf61e=['/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','index','isAuthenticated','describe','show','put'];(function(_0x20a350,_0x20a6b4){var _0x2be446=function(_0x22b6dc){while(--_0x22b6dc){_0x20a350['push'](_0x20a350['shift']());}};_0x2be446(++_0x20a6b4);}(_0xf61e,0x191));var _0xef61=function(_0x3e6d54,_0x572b76){_0x3e6d54=_0x3e6d54-0x0;var _0x59a2b9=_0xf61e[_0x3e6d54];return _0x59a2b9;};'use strict';var multer=require(_0xef61('0x0'));var util=require(_0xef61('0x1'));var path=require(_0xef61('0x2'));var timeout=require(_0xef61('0x3'));var express=require(_0xef61('0x4'));var router=express[_0xef61('0x5')]();var fs_extra=require(_0xef61('0x6'));var auth=require(_0xef61('0x7'));var interaction=require(_0xef61('0x8'));var config=require(_0xef61('0x9'));var controller=require(_0xef61('0xa'));router[_0xef61('0xb')]('/',auth['isAuthenticated'](),controller[_0xef61('0xc')]);router[_0xef61('0xb')]('/describe',auth[_0xef61('0xd')](),controller[_0xef61('0xe')]);router[_0xef61('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xef61('0xf')]);router[_0xef61('0x10')](_0xef61('0x11'),auth[_0xef61('0xd')](),controller[_0xef61('0x12')]);router[_0xef61('0x13')](_0xef61('0x11'),auth[_0xef61('0xd')](),controller[_0xef61('0x14')]);module[_0xef61('0x15')]=router; \ No newline at end of file +var _0xfb65=['put','update','destroy','exports','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','/describe','isAuthenticated','describe','/:id','show'];(function(_0x3fba58,_0x273bde){var _0x329f81=function(_0x528f38){while(--_0x528f38){_0x3fba58['push'](_0x3fba58['shift']());}};_0x329f81(++_0x273bde);}(_0xfb65,0x82));var _0x5fb6=function(_0x46a509,_0x44fa7d){_0x46a509=_0x46a509-0x0;var _0x23832f=_0xfb65[_0x46a509];return _0x23832f;};'use strict';var multer=require('multer');var util=require(_0x5fb6('0x0'));var path=require(_0x5fb6('0x1'));var timeout=require('connect-timeout');var express=require(_0x5fb6('0x2'));var router=express['Router']();var fs_extra=require(_0x5fb6('0x3'));var auth=require(_0x5fb6('0x4'));var interaction=require(_0x5fb6('0x5'));var config=require(_0x5fb6('0x6'));var controller=require(_0x5fb6('0x7'));router[_0x5fb6('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x5fb6('0x8')](_0x5fb6('0x9'),auth[_0x5fb6('0xa')](),controller[_0x5fb6('0xb')]);router['get'](_0x5fb6('0xc'),auth[_0x5fb6('0xa')](),controller[_0x5fb6('0xd')]);router[_0x5fb6('0xe')]('/:id',auth[_0x5fb6('0xa')](),controller[_0x5fb6('0xf')]);router['delete'](_0x5fb6('0xc'),auth[_0x5fb6('0xa')](),controller[_0x5fb6('0x10')]);module[_0x5fb6('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 12a1cf1..890906d 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 _0xdc78=['setDataValue','followuptime','diff','seconds','BOOLEAN','moment','exports','STRING','DATE','INTEGER','getDataValue','endtime'];(function(_0x22a4cc,_0x5731e4){var _0x27bb2f=function(_0x282372){while(--_0x282372){_0x22a4cc['push'](_0x22a4cc['shift']());}};_0x27bb2f(++_0x5731e4);}(_0xdc78,0x119));var _0x8dc7=function(_0x33154d,_0x854047){_0x33154d=_0x33154d-0x0;var _0x3b2f03=_0xdc78[_0x33154d];return _0x3b2f03;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x8dc7('0x0'));module[_0x8dc7('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x8dc7('0x2')]},'scheduledat':{'type':Sequelize[_0x8dc7('0x3')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x8dc7('0x4')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x8dc7('0x4')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x8dc7('0x4')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x8dc7('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x8dc7('0x2')]},'starttime':{'type':Sequelize[_0x8dc7('0x3')]},'responsetime':{'type':Sequelize[_0x8dc7('0x3')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x8dc7('0x3')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x8dc7('0x4')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x8dc7('0x4')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x8dc7('0x4')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x8dc7('0x4')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x8dc7('0x2')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x8dc7('0x2')]},'membername':{'type':Sequelize[_0x8dc7('0x2')]},'reason':{'type':Sequelize[_0x8dc7('0x2')]},'disposition':{'type':Sequelize[_0x8dc7('0x2')]},'secondDisposition':{'type':Sequelize[_0x8dc7('0x2')]},'thirdDisposition':{'type':Sequelize[_0x8dc7('0x2')]},'dispositionat':{'type':Sequelize[_0x8dc7('0x3')],'set':function(_0x139c7c){var _0x4d7f1b=this[_0x8dc7('0x5')](_0x8dc7('0x6'));if(_0x4d7f1b&&_0x139c7c){this[_0x8dc7('0x7')](_0x8dc7('0x8'),moment(_0x139c7c)[_0x8dc7('0x9')](moment(_0x4d7f1b),_0x8dc7('0xa')));}}},'amd':{'type':Sequelize[_0x8dc7('0xb')],'defaultValue':![]},'fax':{'type':Sequelize[_0x8dc7('0xb')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x8dc7('0xb')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x8dc7('0xb')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x8dc7('0x3')]},'callback':{'type':Sequelize[_0x8dc7('0xb')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x8dc7('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x8dc7('0x3')]},'deleted':{'type':Sequelize[_0x8dc7('0x2')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x8dc7('0x3')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x8dc7('0x4')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x8dc7('0x4')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x8dc7('0x4')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x8dc7('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x289f=['sequelize','moment','exports','INTEGER','DATE','STRING','getDataValue','endtime','setDataValue','followuptime','diff','seconds','BOOLEAN'];(function(_0x4d1761,_0x2d9fa4){var _0x502cfb=function(_0x23f0e6){while(--_0x23f0e6){_0x4d1761['push'](_0x4d1761['shift']());}};_0x502cfb(++_0x2d9fa4);}(_0x289f,0x9c));var _0xf289=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0x289f[_0x5f3f88];return _0xd08119;};'use strict';var Sequelize=require(_0xf289('0x0'));var moment=require(_0xf289('0x1'));module[_0xf289('0x2')]={'state':{'type':Sequelize[_0xf289('0x3')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0xf289('0x4')]},'countbusyretry':{'type':Sequelize[_0xf289('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xf289('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xf289('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xf289('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xf289('0x5')]},'originatecalleridnum':{'type':Sequelize[_0xf289('0x5')]},'originatecalleridname':{'type':Sequelize[_0xf289('0x5')]},'calleridnum':{'type':Sequelize[_0xf289('0x5')]},'calleridname':{'type':Sequelize[_0xf289('0x5')]},'starttime':{'type':Sequelize[_0xf289('0x4')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xf289('0x4')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0xf289('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xf289('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xf289('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xf289('0x5')]},'campaign':{'type':Sequelize[_0xf289('0x5')]},'campaigntype':{'type':Sequelize[_0xf289('0x5')]},'membername':{'type':Sequelize[_0xf289('0x5')]},'reason':{'type':Sequelize[_0xf289('0x5')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xf289('0x5')]},'thirdDisposition':{'type':Sequelize[_0xf289('0x5')]},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x49b8df){var _0x5cd80e=this[_0xf289('0x6')](_0xf289('0x7'));if(_0x5cd80e&&_0x49b8df){this[_0xf289('0x8')](_0xf289('0x9'),moment(_0x49b8df)[_0xf289('0xa')](moment(_0x5cd80e),_0xf289('0xb')));}}},'amd':{'type':Sequelize[_0xf289('0xc')],'defaultValue':![]},'fax':{'type':Sequelize[_0xf289('0xc')],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xf289('0xc')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize[_0xf289('0xc')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xf289('0x5')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xf289('0x4')]},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize[_0xf289('0x4')]},'recallme':{'type':Sequelize[_0xf289('0xc')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xf289('0x4')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xf289('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index 8baf555..5869fa2 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 _0x687b=['filter','VIRTUAL','options','include','findAll','rows','show','length','includeAll','merge','find','catch','describe','body','uniqueid','params','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2019,\x201,\x20null','moveContactsQueueCampaignHopperFinal','into','fromQuery','phone','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','from','VoiceQueueId\x20=\x20?','toString','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','select','cm_hopper_final','state\x20=\x204','group','Campaign','cm_hopper','CampaignId','CampaignId\x20=\x20?','state\x20=\x20?','calleridnum','checkContactHopper','CmHopper','findOne','eml-format','rimraf','zip-dir','fast-json-patch','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','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','save','update','then','destroy','end','error','stack','name','send','index','map','CmHopperFinal','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where'];(function(_0x35485a,_0x91cdd4){var _0x5148e6=function(_0x27ed1d){while(--_0x27ed1d){_0x35485a['push'](_0x35485a['shift']());}};_0x5148e6(++_0x91cdd4);}(_0x687b,0x14a));var _0xb687=function(_0x27dfe7,_0x3acd6f){_0x27dfe7=_0x27dfe7-0x0;var _0x9d647c=_0x687b[_0x27dfe7];return _0x9d647c;};'use strict';var emlformat=require(_0xb687('0x0'));var rimraf=require(_0xb687('0x1'));var zipdir=require(_0xb687('0x2'));var jsonpatch=require(_0xb687('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xb687('0x4'));var Mustache=require(_0xb687('0x5'));var util=require(_0xb687('0x6'));var path=require(_0xb687('0x7'));var sox=require(_0xb687('0x8'));var csv=require(_0xb687('0x9'));var ejs=require(_0xb687('0xa'));var fs=require('fs');var fs_extra=require(_0xb687('0xb'));var _=require(_0xb687('0xc'));var squel=require(_0xb687('0xd'));var crypto=require('crypto');var jsforce=require(_0xb687('0xe'));var deskjs=require(_0xb687('0xf'));var toCsv=require('to-csv');var querystring=require(_0xb687('0x10'));var Papa=require(_0xb687('0x11'));var Redis=require(_0xb687('0x12'));var authService=require(_0xb687('0x13'));var qs=require(_0xb687('0x14'));var as=require(_0xb687('0x15'));var hardwareService=require(_0xb687('0x16'));var logger=require(_0xb687('0x17'))(_0xb687('0x18'));var utils=require('../../config/utils');var config=require(_0xb687('0x19'));var licenseUtil=require(_0xb687('0x1a'));var db=require(_0xb687('0x1b'))['db'];function respondWithStatusCode(_0x12a0be,_0x4f9c19){_0x4f9c19=_0x4f9c19||0xcc;return function(_0x4c97ed){if(_0x4c97ed){return _0x12a0be[_0xb687('0x1c')](_0x4f9c19);}return _0x12a0be[_0xb687('0x1d')](_0x4f9c19)['end']();};}function respondWithResult(_0x108fd0,_0x2f1ac0){_0x2f1ac0=_0x2f1ac0||0xc8;return function(_0x1f1f35){if(_0x1f1f35){return _0x108fd0[_0xb687('0x1d')](_0x2f1ac0)[_0xb687('0x1e')](_0x1f1f35);}};}function respondWithFilteredResult(_0x3ab914,_0x30622f){return function(_0x141375){if(_0x141375){var _0x263085=typeof _0x30622f[_0xb687('0x1f')]===_0xb687('0x20')&&typeof _0x30622f[_0xb687('0x21')]==='undefined';var _0x214b06=_0x141375[_0xb687('0x22')];var _0x30d370=_0x263085?0x0:_0x30622f['offset'];var _0x48958d=_0x263085?_0x141375[_0xb687('0x22')]:_0x30622f[_0xb687('0x1f')]+_0x30622f[_0xb687('0x21')];var _0x4b593b;if(_0x48958d>=_0x214b06){_0x48958d=_0x214b06;_0x4b593b=0xc8;}else{_0x4b593b=0xce;}_0x3ab914[_0xb687('0x1d')](_0x4b593b);return _0x3ab914['set'](_0xb687('0x23'),_0x30d370+'-'+_0x48958d+'/'+_0x214b06)[_0xb687('0x1e')](_0x141375);}return null;};}function patchUpdates(_0x170dc0){return function(_0x44bd0b){try{jsonpatch['apply'](_0x44bd0b,_0x170dc0,!![]);}catch(_0x3a73d5){return BPromise['reject'](_0x3a73d5);}return _0x44bd0b[_0xb687('0x24')]();};}function saveUpdates(_0x90e892,_0x274241){return function(_0x546fde){if(_0x546fde){return _0x546fde[_0xb687('0x25')](_0x90e892)[_0xb687('0x26')](function(_0xa95e91){return _0xa95e91;});}return null;};}function removeEntity(_0x16cdcb,_0xbf6c58){return function(_0x38866c){if(_0x38866c){return _0x38866c[_0xb687('0x27')]()[_0xb687('0x26')](function(){_0x16cdcb['status'](0xcc)[_0xb687('0x28')]();});}};}function handleEntityNotFound(_0x129347,_0x1c1585){return function(_0x1a0261){if(!_0x1a0261){_0x129347[_0xb687('0x1c')](0x194);}return _0x1a0261;};}function handleError(_0x4136c9,_0x17ff2b){_0x17ff2b=_0x17ff2b||0x1f4;return function(_0x3cb2f2){logger[_0xb687('0x29')](_0x3cb2f2[_0xb687('0x2a')]);if(_0x3cb2f2['name']){delete _0x3cb2f2[_0xb687('0x2b')];}_0x4136c9[_0xb687('0x1d')](_0x17ff2b)[_0xb687('0x2c')](_0x3cb2f2);};}exports[_0xb687('0x2d')]=function(_0x2e5c8d,_0x173c58){var _0x4e9a06={},_0x28b69a={},_0x5143af={'count':0x0,'rows':[]};var _0x360429=_[_0xb687('0x2e')](db[_0xb687('0x2f')][_0xb687('0x30')],function(_0x1ad3ef){return{'name':_0x1ad3ef[_0xb687('0x31')],'type':_0x1ad3ef[_0xb687('0x32')]['key']};});_0x28b69a[_0xb687('0x33')]=_[_0xb687('0x2e')](_0x360429,_0xb687('0x2b'));_0x28b69a[_0xb687('0x34')]=_[_0xb687('0x35')](_0x2e5c8d[_0xb687('0x34')]);_0x28b69a[_0xb687('0x36')]=_[_0xb687('0x37')](_0x28b69a[_0xb687('0x33')],_0x28b69a[_0xb687('0x34')]);_0x4e9a06[_0xb687('0x38')]=_['intersection'](_0x28b69a['model'],qs[_0xb687('0x39')](_0x2e5c8d[_0xb687('0x34')][_0xb687('0x39')]));_0x4e9a06[_0xb687('0x38')]=_0x4e9a06['attributes']['length']?_0x4e9a06[_0xb687('0x38')]:_0x28b69a[_0xb687('0x33')];if(!_0x2e5c8d['query'][_0xb687('0x3a')](_0xb687('0x3b'))){_0x4e9a06['limit']=qs[_0xb687('0x21')](_0x2e5c8d['query'][_0xb687('0x21')]);_0x4e9a06[_0xb687('0x1f')]=qs[_0xb687('0x1f')](_0x2e5c8d[_0xb687('0x34')][_0xb687('0x1f')]);}_0x4e9a06[_0xb687('0x3c')]=qs['sort'](_0x2e5c8d[_0xb687('0x34')][_0xb687('0x3d')]);_0x4e9a06[_0xb687('0x3e')]=qs[_0xb687('0x36')](_['pick'](_0x2e5c8d[_0xb687('0x34')],_0x28b69a[_0xb687('0x36')]),_0x360429);if(_0x2e5c8d[_0xb687('0x34')][_0xb687('0x3f')]){_0x4e9a06[_0xb687('0x3e')]=_['merge'](_0x4e9a06[_0xb687('0x3e')],{'$or':_[_0xb687('0x2e')](_0x360429,function(_0x24c013){if(_0x24c013[_0xb687('0x32')]!==_0xb687('0x40')){var _0x29cf09={};_0x29cf09[_0x24c013['name']]={'$like':'%'+_0x2e5c8d['query'][_0xb687('0x3f')]+'%'};return _0x29cf09;}})});}_0x4e9a06=_['merge']({},_0x4e9a06,_0x2e5c8d[_0xb687('0x41')]);var _0x2f4550={'where':_0x4e9a06['where']};return db[_0xb687('0x2f')][_0xb687('0x22')](_0x2f4550)['then'](function(_0x394b56){_0x5143af[_0xb687('0x22')]=_0x394b56;if(_0x2e5c8d[_0xb687('0x34')]['includeAll']){_0x4e9a06[_0xb687('0x42')]=[{'all':!![]}];}return db[_0xb687('0x2f')][_0xb687('0x43')](_0x4e9a06);})[_0xb687('0x26')](function(_0x140388){_0x5143af[_0xb687('0x44')]=_0x140388;return _0x5143af;})[_0xb687('0x26')](respondWithFilteredResult(_0x173c58,_0x4e9a06))['catch'](handleError(_0x173c58,null));};exports[_0xb687('0x45')]=function(_0x4cf6ad,_0x50fdb7){var _0xa3a9e0={'raw':!![],'where':{'id':_0x4cf6ad['params']['id']}},_0x430364={};_0x430364[_0xb687('0x33')]=_['keys'](db[_0xb687('0x2f')][_0xb687('0x30')]);_0x430364['query']=_[_0xb687('0x35')](_0x4cf6ad[_0xb687('0x34')]);_0x430364['filters']=_[_0xb687('0x37')](_0x430364[_0xb687('0x33')],_0x430364[_0xb687('0x34')]);_0xa3a9e0[_0xb687('0x38')]=_[_0xb687('0x37')](_0x430364[_0xb687('0x33')],qs[_0xb687('0x39')](_0x4cf6ad[_0xb687('0x34')][_0xb687('0x39')]));_0xa3a9e0[_0xb687('0x38')]=_0xa3a9e0[_0xb687('0x38')][_0xb687('0x46')]?_0xa3a9e0['attributes']:_0x430364[_0xb687('0x33')];if(_0x4cf6ad['query'][_0xb687('0x47')]){_0xa3a9e0[_0xb687('0x42')]=[{'all':!![]}];}_0xa3a9e0=_[_0xb687('0x48')]({},_0xa3a9e0,_0x4cf6ad[_0xb687('0x41')]);return db[_0xb687('0x2f')][_0xb687('0x49')](_0xa3a9e0)['then'](handleEntityNotFound(_0x50fdb7,null))['then'](respondWithResult(_0x50fdb7,null))[_0xb687('0x4a')](handleError(_0x50fdb7,null));};exports[_0xb687('0x4b')]=function(_0x40558a,_0x4f3069){return db['CmHopperFinal'][_0xb687('0x4b')]()[_0xb687('0x26')](respondWithResult(_0x4f3069,null))[_0xb687('0x4a')](handleError(_0x4f3069,null));};exports[_0xb687('0x25')]=function(_0x535c00,_0x33a0b0){if(_0x535c00[_0xb687('0x4c')][_0xb687('0x4d')]){delete _0x535c00[_0xb687('0x4c')]['uniqueid'];}return db['CmHopperFinal'][_0xb687('0x49')]({'where':{'uniqueid':_0x535c00[_0xb687('0x4e')]['id']}})[_0xb687('0x26')](handleEntityNotFound(_0x33a0b0,null))['then'](saveUpdates(_0x535c00['body'],null))[_0xb687('0x26')](respondWithResult(_0x33a0b0,null))[_0xb687('0x4a')](handleError(_0x33a0b0,null));};exports[_0xb687('0x4f')]=function(_0x22e618,_0x34205d,_0x1fb31a){return db[_0xb687('0x2f')][_0xb687('0x43')]({'raw':![],'where':{'VoiceQueueId':_0x22e618['params']['id']},'attributes':[[db[_0xb687('0x50')]['fn'](_0xb687('0x51'),db[_0xb687('0x50')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x200,\x201,\x20null'))),'noSuchContacts'],[db[_0xb687('0x50')]['fn'](_0xb687('0x51'),db[_0xb687('0x50')]['fn']('IF',db[_0xb687('0x50')][_0xb687('0x52')](_0xb687('0x53')))),_0xb687('0x54')],[db[_0xb687('0x50')]['fn'](_0xb687('0x51'),db[_0xb687('0x50')]['fn']('IF',db[_0xb687('0x50')][_0xb687('0x52')](_0xb687('0x55')))),_0xb687('0x56')],[db[_0xb687('0x50')]['fn'](_0xb687('0x51'),db[_0xb687('0x50')]['fn']('IF',db['sequelize']['literal'](_0xb687('0x57')))),_0xb687('0x58')],[db[_0xb687('0x50')]['fn'](_0xb687('0x51'),db['sequelize']['fn']('IF',db[_0xb687('0x50')][_0xb687('0x52')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0xb687('0x59')],[db['sequelize']['fn'](_0xb687('0x51'),db[_0xb687('0x50')]['fn']('IF',db['sequelize']['literal'](_0xb687('0x5a')))),_0xb687('0x5b')],[db['sequelize']['fn'](_0xb687('0x51'),db[_0xb687('0x50')]['fn']('IF',db[_0xb687('0x50')]['literal'](_0xb687('0x5c')))),'reCallContacts'],[db[_0xb687('0x50')]['fn'](_0xb687('0x51'),db[_0xb687('0x50')]['fn']('IF',db[_0xb687('0x50')][_0xb687('0x52')]('`state`\x20=\x2019,\x201,\x20null'))),'answeringMachine']]})[_0xb687('0x26')](handleEntityNotFound(_0x34205d,null))['then'](respondWithResult(_0x34205d,null))['catch'](handleError(_0x34205d,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0x5d266c,_0x1cc507,_0x1db4ca){return db[_0xb687('0x2f')][_0xb687('0x43')]({'raw':![],'where':{'CampaignId':_0x5d266c[_0xb687('0x4e')]['id']},'attributes':[[db[_0xb687('0x50')]['fn'](_0xb687('0x51'),db[_0xb687('0x50')]['fn']('IF',db[_0xb687('0x50')][_0xb687('0x52')](_0xb687('0x5d')))),'noSuchContacts'],[db['sequelize']['fn'](_0xb687('0x51'),db['sequelize']['fn']('IF',db[_0xb687('0x50')][_0xb687('0x52')](_0xb687('0x53')))),_0xb687('0x54')],[db[_0xb687('0x50')]['fn']('COUNT',db[_0xb687('0x50')]['fn']('IF',db['sequelize'][_0xb687('0x52')](_0xb687('0x55')))),_0xb687('0x56')],[db[_0xb687('0x50')]['fn'](_0xb687('0x51'),db[_0xb687('0x50')]['fn']('IF',db[_0xb687('0x50')]['literal'](_0xb687('0x57')))),_0xb687('0x58')],[db[_0xb687('0x50')]['fn'](_0xb687('0x51'),db[_0xb687('0x50')]['fn']('IF',db['sequelize'][_0xb687('0x52')](_0xb687('0x5e')))),_0xb687('0x59')],[db[_0xb687('0x50')]['fn'](_0xb687('0x51'),db[_0xb687('0x50')]['fn']('IF',db[_0xb687('0x50')][_0xb687('0x52')](_0xb687('0x5a')))),_0xb687('0x5b')],[db[_0xb687('0x50')]['fn']('COUNT',db[_0xb687('0x50')]['fn']('IF',db[_0xb687('0x50')][_0xb687('0x52')](_0xb687('0x5c')))),'reCallContacts'],[db[_0xb687('0x50')]['fn'](_0xb687('0x51'),db['sequelize']['fn']('IF',db[_0xb687('0x50')][_0xb687('0x52')](_0xb687('0x5f')))),'answeringMachine']]})[_0xb687('0x26')](handleEntityNotFound(_0x1cc507,null))[_0xb687('0x26')](respondWithResult(_0x1cc507,null))['catch'](handleError(_0x1cc507,null));};exports[_0xb687('0x60')]=function(_0x5449c4,_0x2c2add,_0x431cc5){return db['VoiceQueue'][_0xb687('0x49')]({'where':{'id':_0x5449c4[_0xb687('0x4e')]['id']}})['then'](handleEntityNotFound(_0x2c2add,null))[_0xb687('0x26')](function(_0x1736ef){var _0x52285e;if(_0x1736ef){_0x52285e=squel['insert']()[_0xb687('0x61')]('cm_hopper')[_0xb687('0x62')]([_0xb687('0x63'),_0xb687('0x64'),_0xb687('0x65'),_0xb687('0x66'),_0xb687('0x67'),_0xb687('0x68'),_0xb687('0x69')],squel['select']()[_0xb687('0x6a')](_0xb687('0x6b'),_0xb687('0x63'))[_0xb687('0x6a')](_0xb687('0x6c'),_0xb687('0x64'))['field'](_0xb687('0x6d'),_0xb687('0x65'))['field'](_0xb687('0x6e'),_0xb687('0x66'))[_0xb687('0x6a')](_0xb687('0x6f'),'VoiceQueueId')[_0xb687('0x6a')]('NOW()','createdAt')[_0xb687('0x6a')]('NOW()','updatedAt')[_0xb687('0x70')]('cm_hopper_final')[_0xb687('0x3e')](_0xb687('0x71'),_0x5449c4['params']['id'][_0xb687('0x72')]())[_0xb687('0x3e')]('state\x20=\x20?',_0x5449c4[_0xb687('0x4c')][_0xb687('0x73')][_0xb687('0x72')]())[_0xb687('0x3e')](_0xb687('0x74'))[_0xb687('0x3e')](_0xb687('0x75'),squel[_0xb687('0x76')]()[_0xb687('0x6a')](_0xb687('0x63'))[_0xb687('0x70')]('cm_hopper')[_0xb687('0x3e')]('VoiceQueueId\x20=\x20?',_0x5449c4['params']['id'][_0xb687('0x72')]()))[_0xb687('0x3e')](_0xb687('0x75'),squel[_0xb687('0x76')]()[_0xb687('0x6a')]('calleridnum')['from'](_0xb687('0x77'))[_0xb687('0x3e')](_0xb687('0x71'),_0x5449c4[_0xb687('0x4e')]['id']['toString']())[_0xb687('0x3e')](_0xb687('0x78')))[_0xb687('0x79')](_0xb687('0x65')))[_0xb687('0x72')]();return db[_0xb687('0x50')][_0xb687('0x34')](_0x52285e);}return[];})[_0xb687('0x26')](respondWithResult(_0x2c2add,null))[_0xb687('0x4a')](handleError(_0x2c2add,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x25f5c3,_0x33d1fc,_0x207953){return db[_0xb687('0x7a')][_0xb687('0x49')]({'where':{'id':_0x25f5c3['params']['id']}})[_0xb687('0x26')](handleEntityNotFound(_0x33d1fc,null))[_0xb687('0x26')](function(_0x48bbee){var _0x19ac6d;if(_0x48bbee){_0x19ac6d=squel['insert']()[_0xb687('0x61')](_0xb687('0x7b'))['fromQuery']([_0xb687('0x63'),_0xb687('0x64'),'ContactId',_0xb687('0x66'),_0xb687('0x7c'),_0xb687('0x68'),_0xb687('0x69')],squel[_0xb687('0x76')]()[_0xb687('0x6a')]('ANY_VALUE(calleridnum)',_0xb687('0x63'))[_0xb687('0x6a')](_0xb687('0x6c'),_0xb687('0x64'))[_0xb687('0x6a')](_0xb687('0x6d'),_0xb687('0x65'))[_0xb687('0x6a')](_0xb687('0x6e'),_0xb687('0x66'))[_0xb687('0x6a')]('ANY_VALUE(CampaignId)',_0xb687('0x7c'))['field'](_0xb687('0x6c'),_0xb687('0x68'))['field']('NOW()',_0xb687('0x69'))[_0xb687('0x70')](_0xb687('0x77'))[_0xb687('0x3e')](_0xb687('0x7d'),_0x25f5c3[_0xb687('0x4e')]['id'][_0xb687('0x72')]())[_0xb687('0x3e')](_0xb687('0x7e'),_0x25f5c3[_0xb687('0x4c')][_0xb687('0x73')][_0xb687('0x72')]())[_0xb687('0x3e')](_0xb687('0x74'))[_0xb687('0x3e')](_0xb687('0x75'),squel['select']()['field'](_0xb687('0x63'))['from']('cm_hopper')[_0xb687('0x3e')](_0xb687('0x7d'),_0x25f5c3['params']['id'][_0xb687('0x72')]()))[_0xb687('0x3e')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0xb687('0x76')]()[_0xb687('0x6a')](_0xb687('0x7f'))[_0xb687('0x70')](_0xb687('0x77'))[_0xb687('0x3e')](_0xb687('0x7d'),_0x25f5c3[_0xb687('0x4e')]['id'][_0xb687('0x72')]())['where'](_0xb687('0x78')))[_0xb687('0x79')]('ContactId'))[_0xb687('0x72')]();return db['sequelize'][_0xb687('0x34')](_0x19ac6d);}return[];})[_0xb687('0x26')](respondWithResult(_0x33d1fc,null))['catch'](handleError(_0x33d1fc,null));};exports[_0xb687('0x80')]=function(_0x20e46a,_0x1c389f,_0x45d0ab){return db[_0xb687('0x81')][_0xb687('0x82')]({'where':{'VoiceQueueId':_0x20e46a[_0xb687('0x4c')]['VoiceQueueId'],'CampaignId':_0x20e46a['body'][_0xb687('0x7c')],'ContactId':_0x20e46a['body'][_0xb687('0x65')]}})[_0xb687('0x26')](handleEntityNotFound(_0x1c389f,null))[_0xb687('0x26')](function(_0x312529){if(_0x312529){return _0x312529;}return null;})['then'](respondWithResult(_0x1c389f,null))[_0xb687('0x4a')](handleError(_0x1c389f,null));}; \ No newline at end of file +var _0xe2fe=['calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','cm_hopper','select','calleridnum','state\x20=\x204','group','scheduledAt','CampaignId','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','checkContactHopper','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','api','../../mysqldb','sendStatus','status','offset','limit','count','set','Content-Range','json','reject','save','update','then','destroy','end','name','send','index','map','CmHopperFinal','rawAttributes','type','key','keys','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','catch','show','find','body','uniqueid','params','countContactsQueueCampaignHopperFinal','findAll','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','fromQuery','phone','ContactId','ListId','VoiceQueueId','updatedAt','field','ANY_VALUE(calleridnum)','NOW()','createdAt','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state'];(function(_0x3dd1d6,_0x208fb8){var _0x13f57e=function(_0x3aa764){while(--_0x3aa764){_0x3dd1d6['push'](_0x3dd1d6['shift']());}};_0x13f57e(++_0x208fb8);}(_0xe2fe,0x86));var _0xee2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe2fe[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0xee2f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xee2f('0x1'));var rp=require('request-promise');var moment=require(_0xee2f('0x2'));var BPromise=require(_0xee2f('0x3'));var Mustache=require(_0xee2f('0x4'));var util=require(_0xee2f('0x5'));var path=require(_0xee2f('0x6'));var sox=require('sox');var csv=require(_0xee2f('0x7'));var ejs=require(_0xee2f('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xee2f('0x9'));var squel=require(_0xee2f('0xa'));var crypto=require('crypto');var jsforce=require(_0xee2f('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xee2f('0x7'));var querystring=require(_0xee2f('0xc'));var Papa=require('papaparse');var Redis=require(_0xee2f('0xd'));var authService=require(_0xee2f('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xee2f('0xf'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xee2f('0x10'))['db'];function respondWithStatusCode(_0x346dbc,_0xa13e7b){_0xa13e7b=_0xa13e7b||0xcc;return function(_0x100449){if(_0x100449){return _0x346dbc[_0xee2f('0x11')](_0xa13e7b);}return _0x346dbc[_0xee2f('0x12')](_0xa13e7b)['end']();};}function respondWithResult(_0x3861e6,_0x531c3a){_0x531c3a=_0x531c3a||0xc8;return function(_0x36db10){if(_0x36db10){return _0x3861e6[_0xee2f('0x12')](_0x531c3a)['json'](_0x36db10);}};}function respondWithFilteredResult(_0x445ba8,_0x145241){return function(_0x28b614){if(_0x28b614){var _0x1bbf7d=typeof _0x145241[_0xee2f('0x13')]==='undefined'&&typeof _0x145241[_0xee2f('0x14')]==='undefined';var _0x17d288=_0x28b614[_0xee2f('0x15')];var _0x502eb6=_0x1bbf7d?0x0:_0x145241['offset'];var _0x40b5bc=_0x1bbf7d?_0x28b614['count']:_0x145241[_0xee2f('0x13')]+_0x145241[_0xee2f('0x14')];var _0x28549d;if(_0x40b5bc>=_0x17d288){_0x40b5bc=_0x17d288;_0x28549d=0xc8;}else{_0x28549d=0xce;}_0x445ba8['status'](_0x28549d);return _0x445ba8[_0xee2f('0x16')](_0xee2f('0x17'),_0x502eb6+'-'+_0x40b5bc+'/'+_0x17d288)[_0xee2f('0x18')](_0x28b614);}return null;};}function patchUpdates(_0x21fdf4){return function(_0x3d892d){try{jsonpatch['apply'](_0x3d892d,_0x21fdf4,!![]);}catch(_0x5e73ad){return BPromise[_0xee2f('0x19')](_0x5e73ad);}return _0x3d892d[_0xee2f('0x1a')]();};}function saveUpdates(_0x1ea808,_0x203b2f){return function(_0x472e3b){if(_0x472e3b){return _0x472e3b[_0xee2f('0x1b')](_0x1ea808)[_0xee2f('0x1c')](function(_0x4d68d3){return _0x4d68d3;});}return null;};}function removeEntity(_0x250399,_0x2c47c5){return function(_0x15ceda){if(_0x15ceda){return _0x15ceda[_0xee2f('0x1d')]()[_0xee2f('0x1c')](function(){_0x250399[_0xee2f('0x12')](0xcc)[_0xee2f('0x1e')]();});}};}function handleEntityNotFound(_0x13013f,_0x382174){return function(_0x1e394f){if(!_0x1e394f){_0x13013f[_0xee2f('0x11')](0x194);}return _0x1e394f;};}function handleError(_0x168adc,_0x1c8454){_0x1c8454=_0x1c8454||0x1f4;return function(_0x45c4a0){logger['error'](_0x45c4a0['stack']);if(_0x45c4a0['name']){delete _0x45c4a0[_0xee2f('0x1f')];}_0x168adc[_0xee2f('0x12')](_0x1c8454)[_0xee2f('0x20')](_0x45c4a0);};}exports[_0xee2f('0x21')]=function(_0x892a4e,_0x3737fd){var _0x4d8398={},_0x3d3806={},_0x52e1fa={'count':0x0,'rows':[]};var _0x235697=_[_0xee2f('0x22')](db[_0xee2f('0x23')][_0xee2f('0x24')],function(_0x3ddbe3){return{'name':_0x3ddbe3['fieldName'],'type':_0x3ddbe3[_0xee2f('0x25')][_0xee2f('0x26')]};});_0x3d3806['model']=_['map'](_0x235697,_0xee2f('0x1f'));_0x3d3806['query']=_[_0xee2f('0x27')](_0x892a4e[_0xee2f('0x28')]);_0x3d3806['filters']=_[_0xee2f('0x29')](_0x3d3806['model'],_0x3d3806['query']);_0x4d8398['attributes']=_[_0xee2f('0x29')](_0x3d3806[_0xee2f('0x2a')],qs['fields'](_0x892a4e[_0xee2f('0x28')][_0xee2f('0x2b')]));_0x4d8398[_0xee2f('0x2c')]=_0x4d8398[_0xee2f('0x2c')][_0xee2f('0x2d')]?_0x4d8398['attributes']:_0x3d3806[_0xee2f('0x2a')];if(!_0x892a4e['query'][_0xee2f('0x2e')](_0xee2f('0x2f'))){_0x4d8398[_0xee2f('0x14')]=qs['limit'](_0x892a4e[_0xee2f('0x28')]['limit']);_0x4d8398[_0xee2f('0x13')]=qs['offset'](_0x892a4e[_0xee2f('0x28')][_0xee2f('0x13')]);}_0x4d8398[_0xee2f('0x30')]=qs[_0xee2f('0x31')](_0x892a4e[_0xee2f('0x28')][_0xee2f('0x31')]);_0x4d8398[_0xee2f('0x32')]=qs[_0xee2f('0x33')](_[_0xee2f('0x34')](_0x892a4e[_0xee2f('0x28')],_0x3d3806[_0xee2f('0x33')]),_0x235697);if(_0x892a4e['query'][_0xee2f('0x35')]){_0x4d8398['where']=_[_0xee2f('0x36')](_0x4d8398[_0xee2f('0x32')],{'$or':_[_0xee2f('0x22')](_0x235697,function(_0x2cbb89){if(_0x2cbb89[_0xee2f('0x25')]!==_0xee2f('0x37')){var _0x694950={};_0x694950[_0x2cbb89[_0xee2f('0x1f')]]={'$like':'%'+_0x892a4e['query']['filter']+'%'};return _0x694950;}})});}_0x4d8398=_['merge']({},_0x4d8398,_0x892a4e[_0xee2f('0x38')]);var _0x5483ae={'where':_0x4d8398[_0xee2f('0x32')]};return db['CmHopperFinal']['count'](_0x5483ae)['then'](function(_0x58e361){_0x52e1fa[_0xee2f('0x15')]=_0x58e361;if(_0x892a4e[_0xee2f('0x28')][_0xee2f('0x39')]){_0x4d8398[_0xee2f('0x3a')]=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x4d8398);})[_0xee2f('0x1c')](function(_0x5e12b7){_0x52e1fa['rows']=_0x5e12b7;return _0x52e1fa;})[_0xee2f('0x1c')](respondWithFilteredResult(_0x3737fd,_0x4d8398))[_0xee2f('0x3b')](handleError(_0x3737fd,null));};exports[_0xee2f('0x3c')]=function(_0x54130b,_0x3bc173){var _0x27c447={'raw':!![],'where':{'id':_0x54130b['params']['id']}},_0x19bd4d={};_0x19bd4d['model']=_[_0xee2f('0x27')](db[_0xee2f('0x23')][_0xee2f('0x24')]);_0x19bd4d[_0xee2f('0x28')]=_['keys'](_0x54130b[_0xee2f('0x28')]);_0x19bd4d[_0xee2f('0x33')]=_[_0xee2f('0x29')](_0x19bd4d[_0xee2f('0x2a')],_0x19bd4d[_0xee2f('0x28')]);_0x27c447[_0xee2f('0x2c')]=_[_0xee2f('0x29')](_0x19bd4d[_0xee2f('0x2a')],qs[_0xee2f('0x2b')](_0x54130b[_0xee2f('0x28')]['fields']));_0x27c447['attributes']=_0x27c447['attributes']['length']?_0x27c447[_0xee2f('0x2c')]:_0x19bd4d[_0xee2f('0x2a')];if(_0x54130b[_0xee2f('0x28')][_0xee2f('0x39')]){_0x27c447[_0xee2f('0x3a')]=[{'all':!![]}];}_0x27c447=_['merge']({},_0x27c447,_0x54130b[_0xee2f('0x38')]);return db[_0xee2f('0x23')][_0xee2f('0x3d')](_0x27c447)[_0xee2f('0x1c')](handleEntityNotFound(_0x3bc173,null))['then'](respondWithResult(_0x3bc173,null))['catch'](handleError(_0x3bc173,null));};exports['describe']=function(_0x1609f0,_0x54cc44){return db['CmHopperFinal']['describe']()['then'](respondWithResult(_0x54cc44,null))[_0xee2f('0x3b')](handleError(_0x54cc44,null));};exports[_0xee2f('0x1b')]=function(_0x32da72,_0x584383){if(_0x32da72[_0xee2f('0x3e')]['uniqueid']){delete _0x32da72[_0xee2f('0x3e')][_0xee2f('0x3f')];}return db[_0xee2f('0x23')][_0xee2f('0x3d')]({'where':{'uniqueid':_0x32da72[_0xee2f('0x40')]['id']}})['then'](handleEntityNotFound(_0x584383,null))['then'](saveUpdates(_0x32da72[_0xee2f('0x3e')],null))['then'](respondWithResult(_0x584383,null))[_0xee2f('0x3b')](handleError(_0x584383,null));};exports[_0xee2f('0x41')]=function(_0x1928f8,_0x88e683,_0x4fb3a0){return db['CmHopperFinal'][_0xee2f('0x42')]({'raw':![],'where':{'VoiceQueueId':_0x1928f8[_0xee2f('0x40')]['id']},'attributes':[[db[_0xee2f('0x43')]['fn'](_0xee2f('0x44'),db[_0xee2f('0x43')]['fn']('IF',db[_0xee2f('0x43')][_0xee2f('0x45')](_0xee2f('0x46')))),_0xee2f('0x47')],[db[_0xee2f('0x43')]['fn'](_0xee2f('0x44'),db[_0xee2f('0x43')]['fn']('IF',db['sequelize'][_0xee2f('0x45')](_0xee2f('0x48')))),_0xee2f('0x49')],[db[_0xee2f('0x43')]['fn']('COUNT',db[_0xee2f('0x43')]['fn']('IF',db[_0xee2f('0x43')][_0xee2f('0x45')](_0xee2f('0x4a')))),_0xee2f('0x4b')],[db['sequelize']['fn'](_0xee2f('0x44'),db['sequelize']['fn']('IF',db['sequelize'][_0xee2f('0x45')](_0xee2f('0x4c')))),_0xee2f('0x4d')],[db[_0xee2f('0x43')]['fn'](_0xee2f('0x44'),db[_0xee2f('0x43')]['fn']('IF',db[_0xee2f('0x43')]['literal'](_0xee2f('0x4e')))),_0xee2f('0x4f')],[db[_0xee2f('0x43')]['fn'](_0xee2f('0x44'),db[_0xee2f('0x43')]['fn']('IF',db[_0xee2f('0x43')][_0xee2f('0x45')](_0xee2f('0x50')))),_0xee2f('0x51')],[db['sequelize']['fn'](_0xee2f('0x44'),db['sequelize']['fn']('IF',db[_0xee2f('0x43')][_0xee2f('0x45')](_0xee2f('0x52')))),_0xee2f('0x53')],[db[_0xee2f('0x43')]['fn']('COUNT',db[_0xee2f('0x43')]['fn']('IF',db[_0xee2f('0x43')][_0xee2f('0x45')](_0xee2f('0x54')))),'answeringMachine']]})['then'](handleEntityNotFound(_0x88e683,null))['then'](respondWithResult(_0x88e683,null))['catch'](handleError(_0x88e683,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0x8f90e6,_0x511e54,_0x2891ed){return db[_0xee2f('0x23')][_0xee2f('0x42')]({'raw':![],'where':{'CampaignId':_0x8f90e6[_0xee2f('0x40')]['id']},'attributes':[[db[_0xee2f('0x43')]['fn'](_0xee2f('0x44'),db['sequelize']['fn']('IF',db['sequelize'][_0xee2f('0x45')]('`state`\x20=\x200,\x201,\x20null'))),_0xee2f('0x47')],[db['sequelize']['fn'](_0xee2f('0x44'),db['sequelize']['fn']('IF',db[_0xee2f('0x43')][_0xee2f('0x45')](_0xee2f('0x48')))),'noAnswerContacts'],[db[_0xee2f('0x43')]['fn'](_0xee2f('0x44'),db[_0xee2f('0x43')]['fn']('IF',db[_0xee2f('0x43')][_0xee2f('0x45')](_0xee2f('0x4a')))),_0xee2f('0x4b')],[db['sequelize']['fn'](_0xee2f('0x44'),db[_0xee2f('0x43')]['fn']('IF',db[_0xee2f('0x43')][_0xee2f('0x45')](_0xee2f('0x4c')))),_0xee2f('0x4d')],[db[_0xee2f('0x43')]['fn'](_0xee2f('0x44'),db[_0xee2f('0x43')]['fn']('IF',db[_0xee2f('0x43')][_0xee2f('0x45')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0xee2f('0x4f')],[db[_0xee2f('0x43')]['fn']('COUNT',db[_0xee2f('0x43')]['fn']('IF',db['sequelize'][_0xee2f('0x45')]('`state`\x20=\x2011\x20,\x201,\x20null'))),'abandonedContacts'],[db[_0xee2f('0x43')]['fn'](_0xee2f('0x44'),db[_0xee2f('0x43')]['fn']('IF',db[_0xee2f('0x43')][_0xee2f('0x45')]('`state`\x20=\x2022,\x201,\x20null'))),_0xee2f('0x53')],[db[_0xee2f('0x43')]['fn'](_0xee2f('0x44'),db['sequelize']['fn']('IF',db[_0xee2f('0x43')][_0xee2f('0x45')]('`state`\x20=\x2019,\x201,\x20null'))),_0xee2f('0x55')]]})[_0xee2f('0x1c')](handleEntityNotFound(_0x511e54,null))[_0xee2f('0x1c')](respondWithResult(_0x511e54,null))[_0xee2f('0x3b')](handleError(_0x511e54,null));};exports[_0xee2f('0x56')]=function(_0x2adcc6,_0x43b883,_0x97edb2){return db[_0xee2f('0x57')]['find']({'where':{'id':_0x2adcc6['params']['id']}})['then'](handleEntityNotFound(_0x43b883,null))[_0xee2f('0x1c')](function(_0x19ce25){var _0x4288eb;if(_0x19ce25){_0x4288eb=squel[_0xee2f('0x58')]()[_0xee2f('0x59')]('cm_hopper')[_0xee2f('0x5a')]([_0xee2f('0x5b'),'scheduledAt',_0xee2f('0x5c'),_0xee2f('0x5d'),_0xee2f('0x5e'),'createdAt',_0xee2f('0x5f')],squel['select']()[_0xee2f('0x60')](_0xee2f('0x61'),'phone')[_0xee2f('0x60')](_0xee2f('0x62'),'scheduledAt')['field']('ANY_VALUE(ContactId)',_0xee2f('0x5c'))['field']('ANY_VALUE(ListId)',_0xee2f('0x5d'))[_0xee2f('0x60')]('ANY_VALUE(VoiceQueueId)',_0xee2f('0x5e'))['field'](_0xee2f('0x62'),_0xee2f('0x63'))[_0xee2f('0x60')](_0xee2f('0x62'),_0xee2f('0x5f'))[_0xee2f('0x64')](_0xee2f('0x65'))['where'](_0xee2f('0x66'),_0x2adcc6[_0xee2f('0x40')]['id'][_0xee2f('0x67')]())[_0xee2f('0x32')](_0xee2f('0x68'),_0x2adcc6['body'][_0xee2f('0x69')][_0xee2f('0x67')]())[_0xee2f('0x32')](_0xee2f('0x6a'))[_0xee2f('0x32')](_0xee2f('0x6b'),squel['select']()['field'](_0xee2f('0x5b'))[_0xee2f('0x64')](_0xee2f('0x6c'))[_0xee2f('0x32')](_0xee2f('0x66'),_0x2adcc6[_0xee2f('0x40')]['id'][_0xee2f('0x67')]()))['where']('calleridnum\x20NOT\x20IN\x20(?)',squel[_0xee2f('0x6d')]()[_0xee2f('0x60')](_0xee2f('0x6e'))[_0xee2f('0x64')](_0xee2f('0x65'))[_0xee2f('0x32')](_0xee2f('0x66'),_0x2adcc6[_0xee2f('0x40')]['id'][_0xee2f('0x67')]())[_0xee2f('0x32')](_0xee2f('0x6f')))[_0xee2f('0x70')]('ContactId'))['toString']();return db[_0xee2f('0x43')]['query'](_0x4288eb);}return[];})['then'](respondWithResult(_0x43b883,null))['catch'](handleError(_0x43b883,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x2ea31f,_0x277507,_0x500459){return db['Campaign'][_0xee2f('0x3d')]({'where':{'id':_0x2ea31f[_0xee2f('0x40')]['id']}})[_0xee2f('0x1c')](handleEntityNotFound(_0x277507,null))['then'](function(_0x4aeae5){var _0x2b6f0f;if(_0x4aeae5){_0x2b6f0f=squel[_0xee2f('0x58')]()[_0xee2f('0x59')]('cm_hopper')[_0xee2f('0x5a')](['phone',_0xee2f('0x71'),'ContactId',_0xee2f('0x5d'),_0xee2f('0x72'),_0xee2f('0x63'),'updatedAt'],squel['select']()[_0xee2f('0x60')](_0xee2f('0x61'),_0xee2f('0x5b'))['field'](_0xee2f('0x62'),_0xee2f('0x71'))[_0xee2f('0x60')](_0xee2f('0x73'),_0xee2f('0x5c'))[_0xee2f('0x60')](_0xee2f('0x74'),_0xee2f('0x5d'))[_0xee2f('0x60')](_0xee2f('0x75'),_0xee2f('0x72'))[_0xee2f('0x60')](_0xee2f('0x62'),_0xee2f('0x63'))['field'](_0xee2f('0x62'),_0xee2f('0x5f'))[_0xee2f('0x64')](_0xee2f('0x65'))[_0xee2f('0x32')](_0xee2f('0x76'),_0x2ea31f[_0xee2f('0x40')]['id'][_0xee2f('0x67')]())[_0xee2f('0x32')](_0xee2f('0x68'),_0x2ea31f[_0xee2f('0x3e')]['state'][_0xee2f('0x67')]())[_0xee2f('0x32')](_0xee2f('0x6a'))[_0xee2f('0x32')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0xee2f('0x6d')]()[_0xee2f('0x60')](_0xee2f('0x5b'))['from']('cm_hopper')[_0xee2f('0x32')]('CampaignId\x20=\x20?',_0x2ea31f['params']['id']['toString']()))[_0xee2f('0x32')](_0xee2f('0x6b'),squel[_0xee2f('0x6d')]()[_0xee2f('0x60')]('calleridnum')[_0xee2f('0x64')](_0xee2f('0x65'))[_0xee2f('0x32')]('CampaignId\x20=\x20?',_0x2ea31f[_0xee2f('0x40')]['id']['toString']())[_0xee2f('0x32')]('state\x20=\x204'))['group'](_0xee2f('0x5c')))['toString']();return db[_0xee2f('0x43')]['query'](_0x2b6f0f);}return[];})['then'](respondWithResult(_0x277507,null))[_0xee2f('0x3b')](handleError(_0x277507,null));};exports[_0xee2f('0x77')]=function(_0x4fed80,_0x2685ed,_0x34f882){return db['CmHopper']['findOne']({'where':{'VoiceQueueId':_0x4fed80[_0xee2f('0x3e')][_0xee2f('0x5e')],'CampaignId':_0x4fed80['body'][_0xee2f('0x72')],'ContactId':_0x4fed80[_0xee2f('0x3e')][_0xee2f('0x5c')]}})[_0xee2f('0x1c')](handleEntityNotFound(_0x2685ed,null))[_0xee2f('0x1c')](function(_0x4f20e9){if(_0x4f20e9){return _0x4f20e9;}return null;})['then'](respondWithResult(_0x2685ed,null))['catch'](handleError(_0x2685ed,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index a40c507..2c8e9f1 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 _0xea5c=['request-promise','path','rimraf','../../config/environment','exports','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','util','moment','bluebird'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0xea5c,0x1a9));var _0xcea5=function(_0x506224,_0x36df34){_0x506224=_0x506224-0x0;var _0x2e3e65=_0xea5c[_0x506224];return _0x2e3e65;};'use strict';var _=require(_0xcea5('0x0'));var util=require(_0xcea5('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xcea5('0x2'));var BPromise=require(_0xcea5('0x3'));var rp=require(_0xcea5('0x4'));var fs=require('fs');var path=require(_0xcea5('0x5'));var rimraf=require(_0xcea5('0x6'));var config=require(_0xcea5('0x7'));var attributes=require('./cmHopperFinal.attributes');module[_0xcea5('0x8')]=function(_0x291083,_0x1533d5){return _0x291083['define'](_0xcea5('0x9'),attributes,{'tableName':_0xcea5('0xa'),'paranoid':![],'indexes':[{'name':_0xcea5('0xb'),'fields':['calleridnum']},{'name':'uniqueid','fields':[_0xcea5('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x49d6=['bluebird','rimraf','./cmHopperFinal.attributes','exports','define','cm_hopper_final','calleridnum','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x5d4000,_0x4209b7){var _0xc41b07=function(_0x2ae10e){while(--_0x2ae10e){_0x5d4000['push'](_0x5d4000['shift']());}};_0xc41b07(++_0x4209b7);}(_0x49d6,0x1c2));var _0x649d=function(_0x4b4bd3,_0x5d9048){_0x4b4bd3=_0x4b4bd3-0x0;var _0x55a967=_0x49d6[_0x4b4bd3];return _0x55a967;};'use strict';var _=require(_0x649d('0x0'));var util=require(_0x649d('0x1'));var logger=require(_0x649d('0x2'))(_0x649d('0x3'));var moment=require(_0x649d('0x4'));var BPromise=require(_0x649d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x649d('0x6'));var config=require('../../config/environment');var attributes=require(_0x649d('0x7'));module[_0x649d('0x8')]=function(_0x17d472,_0x3ed7d8){return _0x17d472[_0x649d('0x9')]('CmHopperFinal',attributes,{'tableName':_0x649d('0xa'),'paranoid':![],'indexes':[{'name':'calleridnum','fields':[_0x649d('0xb')]},{'name':_0x649d('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index f8ab415..46a7215 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.rpc.js +++ b/server/api/cmHopperFinal/cmHopperFinal.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['../../config/environment','jayson/promise','http','info','CmHopperFinal,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CmHopperFinal','create','body','options','raw','CreateCmHopperFinal','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x45af57,_0xc5cf57){var _0x52ab35=function(_0x1399cc){while(--_0x1399cc){_0x45af57['push'](_0x45af57['shift']());}};_0x52ab35(++_0xc5cf57);}(_0x7a54,0x106));var _0x47a5=function(_0x4c22f8,_0x3a360e){_0x4c22f8=_0x4c22f8-0x0;var _0x3bcff9=_0x7a54[_0x4c22f8];return _0x3bcff9;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateCmHopperFinal']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateCmHopperFinal',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _0x7a54=['../../config/environment','jayson/promise','http','info','CmHopperFinal,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CmHopperFinal','create','body','options','raw','CreateCmHopperFinal','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x5138a0,_0x475498){var _0x2eeee1=function(_0x942f90){while(--_0x942f90){_0x5138a0['push'](_0x5138a0['shift']());}};_0x2eeee1(++_0x475498);}(_0x7a54,0x106));var _0x47a5=function(_0x41629a,_0x581f02){_0x41629a=_0x41629a-0x0;var _0x3cc27e=_0x7a54[_0x41629a];return _0x3cc27e;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateCmHopperFinal']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateCmHopperFinal',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index 0308b57..31cb797 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 _0x3140=['get','index','/describe','isAuthenticated','describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','post','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','update','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller'];(function(_0x43578b,_0x447db9){var _0x43103f=function(_0x5c734d){while(--_0x5c734d){_0x43578b['push'](_0x43578b['shift']());}};_0x43103f(++_0x447db9);}(_0x3140,0xee));var _0x0314=function(_0xa39b2b,_0x8c128c){_0xa39b2b=_0xa39b2b-0x0;var _0x54d7f3=_0x3140[_0xa39b2b];return _0x54d7f3;};'use strict';var multer=require(_0x0314('0x0'));var util=require(_0x0314('0x1'));var path=require(_0x0314('0x2'));var timeout=require('connect-timeout');var express=require(_0x0314('0x3'));var router=express[_0x0314('0x4')]();var fs_extra=require(_0x0314('0x5'));var auth=require(_0x0314('0x6'));var interaction=require(_0x0314('0x7'));var config=require(_0x0314('0x8'));var controller=require(_0x0314('0x9'));router[_0x0314('0xa')]('/',auth['isAuthenticated'](),controller[_0x0314('0xb')]);router[_0x0314('0xa')](_0x0314('0xc'),auth[_0x0314('0xd')](),controller[_0x0314('0xe')]);router['get'](_0x0314('0xf'),auth['isAuthenticated'](),controller[_0x0314('0x10')]);router[_0x0314('0xa')](_0x0314('0x11'),auth['isAuthenticated'](),controller[_0x0314('0x12')]);router[_0x0314('0xa')](_0x0314('0x13'),auth[_0x0314('0xd')](),controller[_0x0314('0x14')]);router['post'](_0x0314('0x15'),auth[_0x0314('0xd')](),controller[_0x0314('0x16')]);router[_0x0314('0x17')](_0x0314('0x18'),auth[_0x0314('0xd')](),controller[_0x0314('0x19')]);router['post'](_0x0314('0x1a'),auth[_0x0314('0xd')](),controller[_0x0314('0x1b')]);router[_0x0314('0x1c')](_0x0314('0xf'),auth[_0x0314('0xd')](),controller[_0x0314('0x1d')]);module[_0x0314('0x1e')]=router; \ No newline at end of file +var _0x07cb=['/voice/campaign/moveContacts/:id','checkContactHopper','put','update','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','index','/describe','isAuthenticated','describe','/:id','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','moveContactsQueueCampaignHopperFinal','post'];(function(_0x3722b3,_0x18a764){var _0x4614ae=function(_0x522c8e){while(--_0x522c8e){_0x3722b3['push'](_0x3722b3['shift']());}};_0x4614ae(++_0x18a764);}(_0x07cb,0x149));var _0xb07c=function(_0xe455e7,_0x29fb65){_0xe455e7=_0xe455e7-0x0;var _0xfc683e=_0x07cb[_0xe455e7];return _0xfc683e;};'use strict';var multer=require(_0xb07c('0x0'));var util=require(_0xb07c('0x1'));var path=require('path');var timeout=require(_0xb07c('0x2'));var express=require(_0xb07c('0x3'));var router=express[_0xb07c('0x4')]();var fs_extra=require(_0xb07c('0x5'));var auth=require(_0xb07c('0x6'));var interaction=require(_0xb07c('0x7'));var config=require(_0xb07c('0x8'));var controller=require(_0xb07c('0x9'));router[_0xb07c('0xa')]('/',auth['isAuthenticated'](),controller[_0xb07c('0xb')]);router['get'](_0xb07c('0xc'),auth[_0xb07c('0xd')](),controller[_0xb07c('0xe')]);router['get'](_0xb07c('0xf'),auth[_0xb07c('0xd')](),controller['show']);router[_0xb07c('0xa')](_0xb07c('0x10'),auth[_0xb07c('0xd')](),controller[_0xb07c('0x11')]);router[_0xb07c('0xa')](_0xb07c('0x12'),auth[_0xb07c('0xd')](),controller[_0xb07c('0x13')]);router['post']('/voice/queue/moveContacts/:id',auth[_0xb07c('0xd')](),controller[_0xb07c('0x14')]);router[_0xb07c('0x15')](_0xb07c('0x16'),auth[_0xb07c('0xd')](),controller['moveContactsIvrCampaignHopperFinal']);router[_0xb07c('0x15')]('/checkContactHopper',auth[_0xb07c('0xd')](),controller[_0xb07c('0x17')]);router[_0xb07c('0x18')]('/:id',auth[_0xb07c('0xd')](),controller[_0xb07c('0x19')]);module[_0xb07c('0x1a')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 984c1d5..4b6f526 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 _0xbbbc=['INTEGER','STRING','DATE','BOOLEAN','sequelize','exports'];(function(_0x4a0fbb,_0x37b9e4){var _0x4da2bf=function(_0x4a57b5){while(--_0x4a57b5){_0x4a0fbb['push'](_0x4a0fbb['shift']());}};_0x4da2bf(++_0x37b9e4);}(_0xbbbc,0xac));var _0xcbbb=function(_0x337293,_0x2a571d){_0x337293=_0x337293-0x0;var _0x2f7075=_0xbbbc[_0x337293];return _0x2f7075;};'use strict';var Sequelize=require(_0xcbbb('0x0'));module[_0xcbbb('0x1')]={'state':{'type':Sequelize[_0xcbbb('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xcbbb('0x3')]},'scheduledat':{'type':Sequelize[_0xcbbb('0x4')]},'countbusyretry':{'type':Sequelize[_0xcbbb('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xcbbb('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xcbbb('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xcbbb('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0xcbbb('0x3')]},'originatecalleridname':{'type':Sequelize[_0xcbbb('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0xcbbb('0x4')]},'answertime':{'type':Sequelize[_0xcbbb('0x4')]},'droptime':{'type':Sequelize[_0xcbbb('0x4')]},'endtime':{'type':Sequelize[_0xcbbb('0x4')]},'ringtime':{'type':Sequelize[_0xcbbb('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xcbbb('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xcbbb('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xcbbb('0x3')]},'campaign':{'type':Sequelize[_0xcbbb('0x3')]},'campaigntype':{'type':Sequelize[_0xcbbb('0x3')]},'membername':{'type':Sequelize[_0xcbbb('0x3')]},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize[_0xcbbb('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0xcbbb('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0xcbbb('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xcbbb('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize[_0xcbbb('0x4')]},'edited':{'type':Sequelize[_0xcbbb('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xcbbb('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xcbbb('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xcbbb('0x3')]}}; \ No newline at end of file +var _0xe76b=['INTEGER','STRING','DATE','BOOLEAN','exports'];(function(_0x3439b4,_0x3689e1){var _0x2ce10b=function(_0x5a567e){while(--_0x5a567e){_0x3439b4['push'](_0x3439b4['shift']());}};_0x2ce10b(++_0x3689e1);}(_0xe76b,0x72));var _0xbe76=function(_0x4b3f3e,_0x47dfcc){_0x4b3f3e=_0x4b3f3e-0x0;var _0x921fc3=_0xe76b[_0x4b3f3e];return _0x921fc3;};'use strict';var Sequelize=require('sequelize');module[_0xbe76('0x0')]={'state':{'type':Sequelize[_0xbe76('0x1')](0x2)},'statedesc':{'type':Sequelize[_0xbe76('0x2')]},'scheduledat':{'type':Sequelize[_0xbe76('0x3')]},'countbusyretry':{'type':Sequelize[_0xbe76('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xbe76('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xbe76('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xbe76('0x2')]},'originatecalleridnum':{'type':Sequelize[_0xbe76('0x2')]},'originatecalleridname':{'type':Sequelize[_0xbe76('0x2')]},'calleridnum':{'type':Sequelize[_0xbe76('0x2')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0xbe76('0x3')]},'answertime':{'type':Sequelize[_0xbe76('0x3')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xbe76('0x3')]},'ringtime':{'type':Sequelize[_0xbe76('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xbe76('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xbe76('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xbe76('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0xbe76('0x2')]},'campaigntype':{'type':Sequelize[_0xbe76('0x2')]},'membername':{'type':Sequelize[_0xbe76('0x2')]},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0xbe76('0x4')],'defaultValue':![]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0xbe76('0x3')]},'recallme':{'type':Sequelize[_0xbe76('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize[_0xbe76('0x3')]},'edited':{'type':Sequelize[_0xbe76('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xbe76('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xbe76('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xbe76('0x1')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xbe76('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index c8619fa..9c69084 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 _0x08b4=['describe','body','uniqueid','rimraf','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','filters','intersection','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','CmHopperHistory','includeAll','include','findAll','rows','catch','show','params','keys','attributes','find','create'];(function(_0x58fba0,_0x23e2b8){var _0x7d3c15=function(_0x2ef1d4){while(--_0x2ef1d4){_0x58fba0['push'](_0x58fba0['shift']());}};_0x7d3c15(++_0x23e2b8);}(_0x08b4,0x137));var _0x408b=function(_0x1fd437,_0x2c0b47){_0x1fd437=_0x1fd437-0x0;var _0x40d9e6=_0x08b4[_0x1fd437];return _0x40d9e6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x408b('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x408b('0x1'));var rp=require(_0x408b('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x408b('0x3'));var util=require(_0x408b('0x4'));var path=require(_0x408b('0x5'));var sox=require(_0x408b('0x6'));var csv=require(_0x408b('0x7'));var ejs=require(_0x408b('0x8'));var fs=require('fs');var fs_extra=require(_0x408b('0x9'));var _=require(_0x408b('0xa'));var squel=require(_0x408b('0xb'));var crypto=require(_0x408b('0xc'));var jsforce=require(_0x408b('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x408b('0x7'));var querystring=require(_0x408b('0xe'));var Papa=require('papaparse');var Redis=require(_0x408b('0xf'));var authService=require(_0x408b('0x10'));var qs=require(_0x408b('0x11'));var as=require(_0x408b('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x408b('0x13'))(_0x408b('0x14'));var utils=require(_0x408b('0x15'));var config=require(_0x408b('0x16'));var licenseUtil=require(_0x408b('0x17'));var db=require(_0x408b('0x18'))['db'];function respondWithStatusCode(_0x3b49d0,_0x5e7e0c){_0x5e7e0c=_0x5e7e0c||0xcc;return function(_0x16aa82){if(_0x16aa82){return _0x3b49d0[_0x408b('0x19')](_0x5e7e0c);}return _0x3b49d0[_0x408b('0x1a')](_0x5e7e0c)[_0x408b('0x1b')]();};}function respondWithResult(_0x449d0b,_0x3102f8){_0x3102f8=_0x3102f8||0xc8;return function(_0x861929){if(_0x861929){return _0x449d0b[_0x408b('0x1a')](_0x3102f8)['json'](_0x861929);}};}function respondWithFilteredResult(_0x1cfedb,_0x3074d3){return function(_0x283ff8){if(_0x283ff8){var _0xf95305=typeof _0x3074d3[_0x408b('0x1c')]===_0x408b('0x1d')&&typeof _0x3074d3[_0x408b('0x1e')]==='undefined';var _0x179e58=_0x283ff8[_0x408b('0x1f')];var _0x30faad=_0xf95305?0x0:_0x3074d3[_0x408b('0x1c')];var _0x1c76d0=_0xf95305?_0x283ff8['count']:_0x3074d3[_0x408b('0x1c')]+_0x3074d3[_0x408b('0x1e')];var _0x1200fe;if(_0x1c76d0>=_0x179e58){_0x1c76d0=_0x179e58;_0x1200fe=0xc8;}else{_0x1200fe=0xce;}_0x1cfedb[_0x408b('0x1a')](_0x1200fe);return _0x1cfedb['set'](_0x408b('0x20'),_0x30faad+'-'+_0x1c76d0+'/'+_0x179e58)[_0x408b('0x21')](_0x283ff8);}return null;};}function patchUpdates(_0x4f216c){return function(_0x3ab504){try{jsonpatch['apply'](_0x3ab504,_0x4f216c,!![]);}catch(_0x47b33c){return BPromise[_0x408b('0x22')](_0x47b33c);}return _0x3ab504[_0x408b('0x23')]();};}function saveUpdates(_0x2f5141,_0x2f56c6){return function(_0x5d77c5){if(_0x5d77c5){return _0x5d77c5[_0x408b('0x24')](_0x2f5141)[_0x408b('0x25')](function(_0x2e0752){return _0x2e0752;});}return null;};}function removeEntity(_0x5925c7,_0x561ed8){return function(_0x248c74){if(_0x248c74){return _0x248c74[_0x408b('0x26')]()[_0x408b('0x25')](function(){_0x5925c7[_0x408b('0x1a')](0xcc)[_0x408b('0x1b')]();});}};}function handleEntityNotFound(_0x1aa7e8,_0xa71c4b){return function(_0x53c645){if(!_0x53c645){_0x1aa7e8[_0x408b('0x19')](0x194);}return _0x53c645;};}function handleError(_0x2c1b1b,_0x31ca23){_0x31ca23=_0x31ca23||0x1f4;return function(_0x817904){logger[_0x408b('0x27')](_0x817904[_0x408b('0x28')]);if(_0x817904[_0x408b('0x29')]){delete _0x817904[_0x408b('0x29')];}_0x2c1b1b[_0x408b('0x1a')](_0x31ca23)[_0x408b('0x2a')](_0x817904);};}exports[_0x408b('0x2b')]=function(_0x34812d,_0x281686){var _0x1855ef={},_0x285e3b={},_0x35aea0={'count':0x0,'rows':[]};var _0x297193=_[_0x408b('0x2c')](db['CmHopperHistory'][_0x408b('0x2d')],function(_0x329f80){return{'name':_0x329f80[_0x408b('0x2e')],'type':_0x329f80[_0x408b('0x2f')]['key']};});_0x285e3b[_0x408b('0x30')]=_['map'](_0x297193,_0x408b('0x29'));_0x285e3b['query']=_['keys'](_0x34812d[_0x408b('0x31')]);_0x285e3b[_0x408b('0x32')]=_['intersection'](_0x285e3b[_0x408b('0x30')],_0x285e3b[_0x408b('0x31')]);_0x1855ef['attributes']=_[_0x408b('0x33')](_0x285e3b[_0x408b('0x30')],qs[_0x408b('0x34')](_0x34812d[_0x408b('0x31')]['fields']));_0x1855ef['attributes']=_0x1855ef['attributes'][_0x408b('0x35')]?_0x1855ef['attributes']:_0x285e3b[_0x408b('0x30')];if(!_0x34812d[_0x408b('0x31')]['hasOwnProperty']('nolimit')){_0x1855ef['limit']=qs[_0x408b('0x1e')](_0x34812d[_0x408b('0x31')][_0x408b('0x1e')]);_0x1855ef['offset']=qs['offset'](_0x34812d['query'][_0x408b('0x1c')]);}_0x1855ef[_0x408b('0x36')]=qs[_0x408b('0x37')](_0x34812d[_0x408b('0x31')][_0x408b('0x37')]);_0x1855ef[_0x408b('0x38')]=qs['filters'](_[_0x408b('0x39')](_0x34812d[_0x408b('0x31')],_0x285e3b['filters']),_0x297193);if(_0x34812d[_0x408b('0x31')][_0x408b('0x3a')]){_0x1855ef[_0x408b('0x38')]=_[_0x408b('0x3b')](_0x1855ef['where'],{'$or':_['map'](_0x297193,function(_0x44b29b){if(_0x44b29b[_0x408b('0x2f')]!==_0x408b('0x3c')){var _0x1db213={};_0x1db213[_0x44b29b['name']]={'$like':'%'+_0x34812d[_0x408b('0x31')][_0x408b('0x3a')]+'%'};return _0x1db213;}})});}_0x1855ef=_['merge']({},_0x1855ef,_0x34812d[_0x408b('0x3d')]);var _0x15643b={'where':_0x1855ef[_0x408b('0x38')]};return db[_0x408b('0x3e')][_0x408b('0x1f')](_0x15643b)[_0x408b('0x25')](function(_0x84fd5c){_0x35aea0[_0x408b('0x1f')]=_0x84fd5c;if(_0x34812d['query'][_0x408b('0x3f')]){_0x1855ef[_0x408b('0x40')]=[{'all':!![]}];}return db[_0x408b('0x3e')][_0x408b('0x41')](_0x1855ef);})[_0x408b('0x25')](function(_0x22d225){_0x35aea0[_0x408b('0x42')]=_0x22d225;return _0x35aea0;})[_0x408b('0x25')](respondWithFilteredResult(_0x281686,_0x1855ef))[_0x408b('0x43')](handleError(_0x281686,null));};exports[_0x408b('0x44')]=function(_0x52d22c,_0x3f885c){var _0x2a5443={'raw':!![],'where':{'id':_0x52d22c[_0x408b('0x45')]['id']}},_0x552943={};_0x552943['model']=_[_0x408b('0x46')](db['CmHopperHistory'][_0x408b('0x2d')]);_0x552943['query']=_['keys'](_0x52d22c['query']);_0x552943[_0x408b('0x32')]=_[_0x408b('0x33')](_0x552943['model'],_0x552943[_0x408b('0x31')]);_0x2a5443['attributes']=_[_0x408b('0x33')](_0x552943[_0x408b('0x30')],qs['fields'](_0x52d22c['query'][_0x408b('0x34')]));_0x2a5443['attributes']=_0x2a5443[_0x408b('0x47')][_0x408b('0x35')]?_0x2a5443[_0x408b('0x47')]:_0x552943[_0x408b('0x30')];if(_0x52d22c['query']['includeAll']){_0x2a5443[_0x408b('0x40')]=[{'all':!![]}];}_0x2a5443=_[_0x408b('0x3b')]({},_0x2a5443,_0x52d22c[_0x408b('0x3d')]);return db[_0x408b('0x3e')][_0x408b('0x48')](_0x2a5443)[_0x408b('0x25')](handleEntityNotFound(_0x3f885c,null))[_0x408b('0x25')](respondWithResult(_0x3f885c,null))['catch'](handleError(_0x3f885c,null));};exports[_0x408b('0x49')]=function(_0x2a08e0,_0x179e4f){return db['CmHopperHistory'][_0x408b('0x49')](_0x2a08e0['body'],{})[_0x408b('0x25')](respondWithResult(_0x179e4f,0xc9))['catch'](handleError(_0x179e4f,null));};exports[_0x408b('0x4a')]=function(_0x257a73,_0x2c7ee2){return db[_0x408b('0x3e')][_0x408b('0x4a')]()[_0x408b('0x25')](respondWithResult(_0x2c7ee2,null))[_0x408b('0x43')](handleError(_0x2c7ee2,null));};exports[_0x408b('0x24')]=function(_0x1c0ffa,_0x49f350){if(_0x1c0ffa[_0x408b('0x4b')][_0x408b('0x4c')]){delete _0x1c0ffa['body'][_0x408b('0x4c')];}return db[_0x408b('0x3e')]['find']({'where':{'uniqueid':_0x1c0ffa[_0x408b('0x45')]['id']}})[_0x408b('0x25')](handleEntityNotFound(_0x49f350,null))[_0x408b('0x25')](saveUpdates(_0x1c0ffa[_0x408b('0x4b')],null))[_0x408b('0x25')](respondWithResult(_0x49f350,null))['catch'](handleError(_0x49f350,null));}; \ No newline at end of file +var _0xb50d=['show','params','includeAll','find','catch','create','body','uniqueid','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','status','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','include','CmHopperHistory','findAll','rows'];(function(_0x593948,_0x190869){var _0x4e2792=function(_0x4e2d9f){while(--_0x4e2d9f){_0x593948['push'](_0x593948['shift']());}};_0x4e2792(++_0x190869);}(_0xb50d,0xf5));var _0xdb50=function(_0x390a10,_0x2066fb){_0x390a10=_0x390a10-0x0;var _0x3a5c9a=_0xb50d[_0x390a10];return _0x3a5c9a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xdb50('0x0'));var jsonpatch=require(_0xdb50('0x1'));var rp=require('request-promise');var moment=require(_0xdb50('0x2'));var BPromise=require(_0xdb50('0x3'));var Mustache=require(_0xdb50('0x4'));var util=require(_0xdb50('0x5'));var path=require(_0xdb50('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xdb50('0x7'));var fs=require('fs');var fs_extra=require(_0xdb50('0x8'));var _=require(_0xdb50('0x9'));var squel=require(_0xdb50('0xa'));var crypto=require(_0xdb50('0xb'));var jsforce=require(_0xdb50('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xdb50('0xd'));var querystring=require(_0xdb50('0xe'));var Papa=require(_0xdb50('0xf'));var Redis=require(_0xdb50('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xdb50('0x11'));var as=require(_0xdb50('0x12'));var hardwareService=require(_0xdb50('0x13'));var logger=require(_0xdb50('0x14'))(_0xdb50('0x15'));var utils=require(_0xdb50('0x16'));var config=require(_0xdb50('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xdb50('0x18'))['db'];function respondWithStatusCode(_0x596a55,_0x3ebb35){_0x3ebb35=_0x3ebb35||0xcc;return function(_0x1562a4){if(_0x1562a4){return _0x596a55[_0xdb50('0x19')](_0x3ebb35);}return _0x596a55['status'](_0x3ebb35)[_0xdb50('0x1a')]();};}function respondWithResult(_0x16d3df,_0x300721){_0x300721=_0x300721||0xc8;return function(_0x36255b){if(_0x36255b){return _0x16d3df['status'](_0x300721)[_0xdb50('0x1b')](_0x36255b);}};}function respondWithFilteredResult(_0x1208d2,_0x121994){return function(_0x36309f){if(_0x36309f){var _0x39c721=typeof _0x121994[_0xdb50('0x1c')]==='undefined'&&typeof _0x121994[_0xdb50('0x1d')]===_0xdb50('0x1e');var _0x4cb978=_0x36309f['count'];var _0x44cab0=_0x39c721?0x0:_0x121994[_0xdb50('0x1c')];var _0x4498cc=_0x39c721?_0x36309f[_0xdb50('0x1f')]:_0x121994['offset']+_0x121994['limit'];var _0x66a8b9;if(_0x4498cc>=_0x4cb978){_0x4498cc=_0x4cb978;_0x66a8b9=0xc8;}else{_0x66a8b9=0xce;}_0x1208d2['status'](_0x66a8b9);return _0x1208d2[_0xdb50('0x20')](_0xdb50('0x21'),_0x44cab0+'-'+_0x4498cc+'/'+_0x4cb978)['json'](_0x36309f);}return null;};}function patchUpdates(_0xfe3b37){return function(_0x959138){try{jsonpatch[_0xdb50('0x22')](_0x959138,_0xfe3b37,!![]);}catch(_0x1f46f7){return BPromise[_0xdb50('0x23')](_0x1f46f7);}return _0x959138['save']();};}function saveUpdates(_0x7fe381,_0x32d012){return function(_0x3abfc2){if(_0x3abfc2){return _0x3abfc2[_0xdb50('0x24')](_0x7fe381)[_0xdb50('0x25')](function(_0x1c1b1d){return _0x1c1b1d;});}return null;};}function removeEntity(_0x1c0e9a,_0x5afc0a){return function(_0x46e4a3){if(_0x46e4a3){return _0x46e4a3[_0xdb50('0x26')]()[_0xdb50('0x25')](function(){_0x1c0e9a[_0xdb50('0x27')](0xcc)[_0xdb50('0x1a')]();});}};}function handleEntityNotFound(_0x54dd8a,_0x560a2f){return function(_0x557610){if(!_0x557610){_0x54dd8a[_0xdb50('0x19')](0x194);}return _0x557610;};}function handleError(_0xc99019,_0x42a3d1){_0x42a3d1=_0x42a3d1||0x1f4;return function(_0x2a56e2){logger['error'](_0x2a56e2[_0xdb50('0x28')]);if(_0x2a56e2[_0xdb50('0x29')]){delete _0x2a56e2[_0xdb50('0x29')];}_0xc99019[_0xdb50('0x27')](_0x42a3d1)[_0xdb50('0x2a')](_0x2a56e2);};}exports[_0xdb50('0x2b')]=function(_0x21bb49,_0xe72375){var _0x5ca71b={},_0x57d094={},_0x57c4c7={'count':0x0,'rows':[]};var _0x5d9c29=_[_0xdb50('0x2c')](db['CmHopperHistory'][_0xdb50('0x2d')],function(_0x52ed49){return{'name':_0x52ed49[_0xdb50('0x2e')],'type':_0x52ed49['type'][_0xdb50('0x2f')]};});_0x57d094[_0xdb50('0x30')]=_[_0xdb50('0x2c')](_0x5d9c29,_0xdb50('0x29'));_0x57d094[_0xdb50('0x31')]=_[_0xdb50('0x32')](_0x21bb49['query']);_0x57d094['filters']=_[_0xdb50('0x33')](_0x57d094['model'],_0x57d094[_0xdb50('0x31')]);_0x5ca71b['attributes']=_[_0xdb50('0x33')](_0x57d094['model'],qs[_0xdb50('0x34')](_0x21bb49['query'][_0xdb50('0x34')]));_0x5ca71b[_0xdb50('0x35')]=_0x5ca71b[_0xdb50('0x35')][_0xdb50('0x36')]?_0x5ca71b[_0xdb50('0x35')]:_0x57d094[_0xdb50('0x30')];if(!_0x21bb49['query'][_0xdb50('0x37')](_0xdb50('0x38'))){_0x5ca71b[_0xdb50('0x1d')]=qs['limit'](_0x21bb49['query'][_0xdb50('0x1d')]);_0x5ca71b[_0xdb50('0x1c')]=qs[_0xdb50('0x1c')](_0x21bb49[_0xdb50('0x31')][_0xdb50('0x1c')]);}_0x5ca71b[_0xdb50('0x39')]=qs[_0xdb50('0x3a')](_0x21bb49['query'][_0xdb50('0x3a')]);_0x5ca71b[_0xdb50('0x3b')]=qs[_0xdb50('0x3c')](_[_0xdb50('0x3d')](_0x21bb49[_0xdb50('0x31')],_0x57d094[_0xdb50('0x3c')]),_0x5d9c29);if(_0x21bb49['query'][_0xdb50('0x3e')]){_0x5ca71b[_0xdb50('0x3b')]=_[_0xdb50('0x3f')](_0x5ca71b[_0xdb50('0x3b')],{'$or':_[_0xdb50('0x2c')](_0x5d9c29,function(_0x2d40ba){if(_0x2d40ba[_0xdb50('0x40')]!==_0xdb50('0x41')){var _0x450600={};_0x450600[_0x2d40ba['name']]={'$like':'%'+_0x21bb49['query'][_0xdb50('0x3e')]+'%'};return _0x450600;}})});}_0x5ca71b=_[_0xdb50('0x3f')]({},_0x5ca71b,_0x21bb49[_0xdb50('0x42')]);var _0x1665f3={'where':_0x5ca71b[_0xdb50('0x3b')]};return db['CmHopperHistory'][_0xdb50('0x1f')](_0x1665f3)[_0xdb50('0x25')](function(_0x341ec0){_0x57c4c7[_0xdb50('0x1f')]=_0x341ec0;if(_0x21bb49['query']['includeAll']){_0x5ca71b[_0xdb50('0x43')]=[{'all':!![]}];}return db[_0xdb50('0x44')][_0xdb50('0x45')](_0x5ca71b);})[_0xdb50('0x25')](function(_0x6a3e8c){_0x57c4c7[_0xdb50('0x46')]=_0x6a3e8c;return _0x57c4c7;})['then'](respondWithFilteredResult(_0xe72375,_0x5ca71b))['catch'](handleError(_0xe72375,null));};exports[_0xdb50('0x47')]=function(_0x5a2776,_0x66ceda){var _0x526eb6={'raw':!![],'where':{'id':_0x5a2776[_0xdb50('0x48')]['id']}},_0xe15bd8={};_0xe15bd8['model']=_[_0xdb50('0x32')](db[_0xdb50('0x44')][_0xdb50('0x2d')]);_0xe15bd8[_0xdb50('0x31')]=_[_0xdb50('0x32')](_0x5a2776[_0xdb50('0x31')]);_0xe15bd8[_0xdb50('0x3c')]=_[_0xdb50('0x33')](_0xe15bd8['model'],_0xe15bd8[_0xdb50('0x31')]);_0x526eb6['attributes']=_[_0xdb50('0x33')](_0xe15bd8[_0xdb50('0x30')],qs[_0xdb50('0x34')](_0x5a2776['query'][_0xdb50('0x34')]));_0x526eb6[_0xdb50('0x35')]=_0x526eb6[_0xdb50('0x35')]['length']?_0x526eb6['attributes']:_0xe15bd8[_0xdb50('0x30')];if(_0x5a2776[_0xdb50('0x31')][_0xdb50('0x49')]){_0x526eb6[_0xdb50('0x43')]=[{'all':!![]}];}_0x526eb6=_[_0xdb50('0x3f')]({},_0x526eb6,_0x5a2776[_0xdb50('0x42')]);return db[_0xdb50('0x44')][_0xdb50('0x4a')](_0x526eb6)[_0xdb50('0x25')](handleEntityNotFound(_0x66ceda,null))['then'](respondWithResult(_0x66ceda,null))[_0xdb50('0x4b')](handleError(_0x66ceda,null));};exports[_0xdb50('0x4c')]=function(_0x504776,_0xd2962d){return db[_0xdb50('0x44')]['create'](_0x504776[_0xdb50('0x4d')],{})[_0xdb50('0x25')](respondWithResult(_0xd2962d,0xc9))[_0xdb50('0x4b')](handleError(_0xd2962d,null));};exports['describe']=function(_0x21ae7f,_0x5701b6){return db['CmHopperHistory']['describe']()['then'](respondWithResult(_0x5701b6,null))[_0xdb50('0x4b')](handleError(_0x5701b6,null));};exports['update']=function(_0x2b01ec,_0x3c60be){if(_0x2b01ec['body'][_0xdb50('0x4e')]){delete _0x2b01ec['body']['uniqueid'];}return db['CmHopperHistory'][_0xdb50('0x4a')]({'where':{'uniqueid':_0x2b01ec[_0xdb50('0x48')]['id']}})['then'](handleEntityNotFound(_0x3c60be,null))['then'](saveUpdates(_0x2b01ec[_0xdb50('0x4d')],null))['then'](respondWithResult(_0x3c60be,null))[_0xdb50('0x4b')](handleError(_0x3c60be,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 89f9a82..d2a6053 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 _0xaaee=['lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','./cmHopperHistory.attributes','exports','define','CmHopperHistory','endtime','uniqueid'];(function(_0x39ac58,_0x54e86d){var _0x33a67f=function(_0x3cd1c5){while(--_0x3cd1c5){_0x39ac58['push'](_0x39ac58['shift']());}};_0x33a67f(++_0x54e86d);}(_0xaaee,0xa9));var _0xeaae=function(_0x36d28a,_0x5c28d6){_0x36d28a=_0x36d28a-0x0;var _0x501621=_0xaaee[_0x36d28a];return _0x501621;};'use strict';var _=require(_0xeaae('0x0'));var util=require('util');var logger=require(_0xeaae('0x1'))(_0xeaae('0x2'));var moment=require('moment');var BPromise=require(_0xeaae('0x3'));var rp=require(_0xeaae('0x4'));var fs=require('fs');var path=require(_0xeaae('0x5'));var rimraf=require(_0xeaae('0x6'));var config=require('../../config/environment');var attributes=require(_0xeaae('0x7'));module[_0xeaae('0x8')]=function(_0x213422,_0x45c104){return _0x213422[_0xeaae('0x9')](_0xeaae('0xa'),attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':_0xeaae('0xb'),'fields':[_0xeaae('0xb')]},{'name':_0xeaae('0xc'),'fields':[_0xeaae('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb458=['define','CmHopperHistory','cm_hopper_history','uniqueid','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./cmHopperHistory.attributes'];(function(_0x23e2ed,_0x40980b){var _0x46645a=function(_0x1c2146){while(--_0x1c2146){_0x23e2ed['push'](_0x23e2ed['shift']());}};_0x46645a(++_0x40980b);}(_0xb458,0x94));var _0x8b45=function(_0x40936a,_0x54a96f){_0x40936a=_0x40936a-0x0;var _0x4b432b=_0xb458[_0x40936a];return _0x4b432b;};'use strict';var _=require(_0x8b45('0x0'));var util=require(_0x8b45('0x1'));var logger=require(_0x8b45('0x2'))('api');var moment=require('moment');var BPromise=require(_0x8b45('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8b45('0x4'));var rimraf=require(_0x8b45('0x5'));var config=require(_0x8b45('0x6'));var attributes=require(_0x8b45('0x7'));module['exports']=function(_0xfe8757,_0xd23b88){return _0xfe8757[_0x8b45('0x8')](_0x8b45('0x9'),attributes,{'tableName':_0x8b45('0xa'),'paranoid':![],'indexes':[{'name':'endtime','fields':['endtime']},{'name':_0x8b45('0xb'),'fields':[_0x8b45('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index d1b0138..a69fa07 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 _0xabd8=['`state`\x20=\x2010,\x201,\x20null','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','AVG','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','GetCampaignHopperHistory','ivrTotalCallsDays','ivrAnswerCallsDay','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CmHopperHistory','create','body','raw','then','CreateCmHopperHistory','AvgHandleTime','findAll','options','where','COUNT','col','predictiveIntervalTotalCalls','sequelize','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls'];(function(_0x2230ce,_0x438514){var _0x137bbf=function(_0xf58ad9){while(--_0xf58ad9){_0x2230ce['push'](_0x2230ce['shift']());}};_0x137bbf(++_0x438514);}(_0xabd8,0x142));var _0x8abd=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0xabd8[_0x1caf6a];return _0x1bf493;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x8abd('0x0'));var rs=require(_0x8abd('0x1'));var fs=require('fs');var Redis=require(_0x8abd('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x8abd('0x3'));var logger=require(_0x8abd('0x4'))(_0x8abd('0x5'));var config=require(_0x8abd('0x6'));var jayson=require(_0x8abd('0x7'));var client=jayson[_0x8abd('0x8')][_0x8abd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x7e8824,_0x38ff7d,_0x399d52){return new BPromise(function(_0x14c8c5,_0x7c4bd0){return client[_0x8abd('0xa')](_0x7e8824,_0x399d52)['then'](function(_0x30d682){logger[_0x8abd('0xb')](_0x8abd('0xc'),_0x38ff7d,_0x8abd('0xd'));logger[_0x8abd('0xe')](_0x8abd('0xf'),_0x38ff7d,_0x8abd('0xd'),JSON[_0x8abd('0x10')](_0x30d682));if(_0x30d682[_0x8abd('0x11')]){if(_0x30d682[_0x8abd('0x11')]['code']===0x1f4){logger[_0x8abd('0x11')](_0x8abd('0xc'),_0x38ff7d,_0x30d682[_0x8abd('0x11')]['message']);return _0x7c4bd0(_0x30d682[_0x8abd('0x11')][_0x8abd('0x12')]);}logger[_0x8abd('0x11')](_0x8abd('0xc'),_0x38ff7d,_0x30d682[_0x8abd('0x11')][_0x8abd('0x12')]);return _0x14c8c5(_0x30d682[_0x8abd('0x11')][_0x8abd('0x12')]);}else{logger['info'](_0x8abd('0xc'),_0x38ff7d,_0x8abd('0xd'));_0x14c8c5(_0x30d682[_0x8abd('0x13')][_0x8abd('0x12')]);}})[_0x8abd('0x14')](function(_0x29b1e1){logger[_0x8abd('0x11')](_0x8abd('0xc'),_0x38ff7d,_0x29b1e1);_0x7c4bd0(_0x29b1e1);});});}exports['CreateCmHopperHistory']=function(_0x207cb6){var _0x33c36a=this;return new Promise(function(_0x10e9f8,_0x252f9d){return db[_0x8abd('0x15')][_0x8abd('0x16')](_0x207cb6[_0x8abd('0x17')],{'raw':_0x207cb6['options']?_0x207cb6['options'][_0x8abd('0x18')]===undefined?!![]:![]:!![]})[_0x8abd('0x19')](function(_0x13166c){logger['info'](_0x8abd('0x1a'),_0x207cb6);logger[_0x8abd('0xe')]('CreateCmHopperHistory',_0x207cb6,JSON[_0x8abd('0x10')](_0x13166c));_0x10e9f8(_0x13166c);})[_0x8abd('0x14')](function(_0x2af494){logger[_0x8abd('0x11')]('CreateCmHopperHistory',_0x2af494[_0x8abd('0x12')],_0x207cb6);_0x252f9d(_0x33c36a[_0x8abd('0x11')](0x1f4,_0x2af494[_0x8abd('0x12')]));});});};exports[_0x8abd('0x1b')]=function(_0x597aec){var _0x4fd66a=this;return new Promise(function(_0x2d0894,_0x26a041){return db[_0x8abd('0x15')][_0x8abd('0x1c')]({'raw':_0x597aec['options']?_0x597aec[_0x8abd('0x1d')][_0x8abd('0x18')]===undefined?!![]:![]:!![],'where':_0x597aec['options']?_0x597aec[_0x8abd('0x1d')][_0x8abd('0x1e')]||null:null,'attributes':[[db['sequelize']['fn'](_0x8abd('0x1f'),db['sequelize'][_0x8abd('0x20')]('id')),_0x8abd('0x21')],[db[_0x8abd('0x22')]['fn'](_0x8abd('0x1f'),db[_0x8abd('0x22')]['fn']('IF',db[_0x8abd('0x22')][_0x8abd('0x23')](_0x8abd('0x24')))),_0x8abd('0x25')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x8abd('0x22')][_0x8abd('0x23')](_0x8abd('0x26')))),'predictiveIntervalDroppedCallsTimeout'],[db[_0x8abd('0x22')]['fn'](_0x8abd('0x1f'),db['sequelize']['fn']('IF',db[_0x8abd('0x22')]['literal'](_0x8abd('0x27')))),_0x8abd('0x28')],[db['sequelize']['fn']('AVG',db[_0x8abd('0x22')]['fn']('IF',db[_0x8abd('0x22')]['literal'](_0x8abd('0x29')))),_0x8abd('0x2a')],[db[_0x8abd('0x22')]['fn'](_0x8abd('0x2b'),db['sequelize']['fn']('IF',db[_0x8abd('0x22')]['literal']('`state`\x20=\x204,\x20`talktime`,\x20null'))),_0x8abd('0x2c')]]})[_0x8abd('0x19')](function(_0xb3cf2b){logger['info']('AvgHandleTime',_0x597aec);logger['debug'](_0x8abd('0x1b'),_0x597aec,JSON['stringify'](_0xb3cf2b));_0x2d0894(_0xb3cf2b);})[_0x8abd('0x14')](function(_0x5caeab){logger[_0x8abd('0x11')](_0x8abd('0x1b'),_0x5caeab[_0x8abd('0x12')],_0x597aec);_0x26a041(_0x4fd66a['error'](0x1f4,_0x5caeab[_0x8abd('0x12')]));});});};exports[_0x8abd('0x2d')]=function(_0x14969e){var _0x591607=this;return new Promise(function(_0x21f607,_0x16b7b8){return db['CmHopperHistory']['findAll']({'raw':_0x14969e[_0x8abd('0x1d')]?_0x14969e[_0x8abd('0x1d')][_0x8abd('0x18')]===undefined?!![]:![]:!![],'where':_0x14969e['options']?_0x14969e[_0x8abd('0x1d')][_0x8abd('0x1e')]||null:null,'attributes':[[_0x8abd('0x2e'),_0x8abd('0x2f')],[db[_0x8abd('0x22')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x8abd('0x22')]['literal'](_0x8abd('0x30')))),_0x8abd('0x31')],[db[_0x8abd('0x22')]['fn'](_0x8abd('0x1f'),db[_0x8abd('0x22')]['fn']('IF',db[_0x8abd('0x22')]['literal'](_0x8abd('0x32')))),_0x8abd('0x33')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0x8abd('0x23')](_0x8abd('0x24')))),_0x8abd('0x34')],[db[_0x8abd('0x22')]['fn'](_0x8abd('0x1f'),db['sequelize']['fn']('IF',db[_0x8abd('0x22')]['literal']('`state`\x20=\x205,\x201,\x20null'))),'outboundBusyCallsDay'],[db[_0x8abd('0x22')]['fn'](_0x8abd('0x1f'),db[_0x8abd('0x22')]['fn']('IF',db[_0x8abd('0x22')][_0x8abd('0x23')]('`state`\x20=\x208,\x201,\x20null'))),_0x8abd('0x35')],[db[_0x8abd('0x22')]['fn'](_0x8abd('0x1f'),db[_0x8abd('0x22')]['fn']('IF',db['sequelize']['literal'](_0x8abd('0x36')))),_0x8abd('0x37')],[db['sequelize']['fn'](_0x8abd('0x1f'),db[_0x8abd('0x22')]['fn']('IF',db[_0x8abd('0x22')][_0x8abd('0x23')](_0x8abd('0x38')))),_0x8abd('0x39')],[db['sequelize']['fn']('COUNT',db[_0x8abd('0x22')]['fn']('IF',db[_0x8abd('0x22')]['literal'](_0x8abd('0x3a')))),_0x8abd('0x3b')],[db[_0x8abd('0x22')]['fn'](_0x8abd('0x1f'),db[_0x8abd('0x22')]['fn']('IF',db[_0x8abd('0x22')][_0x8abd('0x23')](_0x8abd('0x3c')))),_0x8abd('0x3d')],[db['sequelize']['fn'](_0x8abd('0x1f'),db[_0x8abd('0x22')]['fn']('IF',db[_0x8abd('0x22')]['literal'](_0x8abd('0x3e')))),_0x8abd('0x3f')],[db[_0x8abd('0x22')]['fn'](_0x8abd('0x1f'),db['sequelize']['fn']('IF',db[_0x8abd('0x22')][_0x8abd('0x23')](_0x8abd('0x40')))),_0x8abd('0x41')],[db[_0x8abd('0x22')]['fn'](_0x8abd('0x1f'),db[_0x8abd('0x22')]['fn']('IF',db[_0x8abd('0x22')][_0x8abd('0x23')](_0x8abd('0x42')))),_0x8abd('0x43')],[db['sequelize']['fn'](_0x8abd('0x1f'),db[_0x8abd('0x22')]['fn']('IF',db[_0x8abd('0x22')][_0x8abd('0x23')](_0x8abd('0x44')))),'outboundRejectCallsDay'],[db[_0x8abd('0x22')]['fn'](_0x8abd('0x1f'),db['sequelize']['fn']('IF',db[_0x8abd('0x22')][_0x8abd('0x23')]('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),'outboundReCallsDay']],'group':[_0x8abd('0x2e')]})[_0x8abd('0x19')](function(_0x341c54){logger['info'](_0x8abd('0x2d'),_0x14969e);logger[_0x8abd('0xe')](_0x8abd('0x2d'),_0x14969e,JSON[_0x8abd('0x10')](_0x341c54));_0x21f607(_0x341c54);})[_0x8abd('0x14')](function(_0x2e6cd4){logger[_0x8abd('0x11')]('GetVoiceQueueHopperHistory',_0x2e6cd4[_0x8abd('0x12')],_0x14969e);_0x16b7b8(_0x591607['error'](0x1f4,_0x2e6cd4[_0x8abd('0x12')]));});});};exports[_0x8abd('0x45')]=function(_0x54d0ce){var _0x483425=this;return new Promise(function(_0x2833b3,_0x3634e9){return db[_0x8abd('0x15')][_0x8abd('0x1c')]({'raw':_0x54d0ce[_0x8abd('0x1d')]?_0x54d0ce[_0x8abd('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x54d0ce[_0x8abd('0x1d')]?_0x54d0ce[_0x8abd('0x1d')]['where']||null:null,'attributes':[[_0x8abd('0x2e'),'name'],[db[_0x8abd('0x22')]['fn'](_0x8abd('0x1f'),db[_0x8abd('0x22')][_0x8abd('0x20')]('id')),_0x8abd('0x46')],[db[_0x8abd('0x22')]['fn'](_0x8abd('0x1f'),db[_0x8abd('0x22')]['fn']('IF',db[_0x8abd('0x22')][_0x8abd('0x23')](_0x8abd('0x24')))),_0x8abd('0x47')]],'group':[_0x8abd('0x2e')]})[_0x8abd('0x19')](function(_0x5c9c61){logger[_0x8abd('0xb')](_0x8abd('0x45'),_0x54d0ce);logger[_0x8abd('0xe')](_0x8abd('0x45'),_0x54d0ce,JSON[_0x8abd('0x10')](_0x5c9c61));_0x2833b3(_0x5c9c61);})[_0x8abd('0x14')](function(_0x5db613){logger[_0x8abd('0x11')](_0x8abd('0x45'),_0x5db613[_0x8abd('0x12')],_0x54d0ce);_0x3634e9(_0x483425[_0x8abd('0x11')](0x1f4,_0x5db613[_0x8abd('0x12')]));});});}; \ No newline at end of file +var _0x48b2=['`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','AvgHandleTime','GetVoiceQueueHopperHistory','campaign','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','name','ivrTotalCallsDays','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','http','request','then','CmHopperHistory,\x20%s,\x20%s','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','CreateCmHopperHistory','CmHopperHistory','body','options','info','findAll','where','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime'];(function(_0x345640,_0x36a3f1){var _0x349423=function(_0x180e72){while(--_0x180e72){_0x345640['push'](_0x345640['shift']());}};_0x349423(++_0x36a3f1);}(_0x48b2,0x176));var _0x248b=function(_0x514d12,_0x573315){_0x514d12=_0x514d12-0x0;var _0x35db14=_0x48b2[_0x514d12];return _0x35db14;};'use strict';var _=require(_0x248b('0x0'));var util=require(_0x248b('0x1'));var moment=require(_0x248b('0x2'));var BPromise=require(_0x248b('0x3'));var rs=require(_0x248b('0x4'));var fs=require('fs');var Redis=require(_0x248b('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x248b('0x6'));var logger=require('../../config/logger')(_0x248b('0x7'));var config=require(_0x248b('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x248b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5189bb,_0x14fc46,_0x109fd7){return new BPromise(function(_0xa580ff,_0x376960){return client[_0x248b('0xa')](_0x5189bb,_0x109fd7)[_0x248b('0xb')](function(_0x5be12f){logger['info'](_0x248b('0xc'),_0x14fc46,'request\x20sent');logger[_0x248b('0xd')](_0x248b('0xe'),_0x14fc46,'request\x20sent',JSON[_0x248b('0xf')](_0x5be12f));if(_0x5be12f[_0x248b('0x10')]){if(_0x5be12f['error'][_0x248b('0x11')]===0x1f4){logger[_0x248b('0x10')](_0x248b('0xc'),_0x14fc46,_0x5be12f['error']['message']);return _0x376960(_0x5be12f[_0x248b('0x10')][_0x248b('0x12')]);}logger[_0x248b('0x10')](_0x248b('0xc'),_0x14fc46,_0x5be12f[_0x248b('0x10')][_0x248b('0x12')]);return _0xa580ff(_0x5be12f[_0x248b('0x10')]['message']);}else{logger['info'](_0x248b('0xc'),_0x14fc46,_0x248b('0x13'));_0xa580ff(_0x5be12f['result'][_0x248b('0x12')]);}})[_0x248b('0x14')](function(_0x304dba){logger[_0x248b('0x10')]('CmHopperHistory,\x20%s,\x20%s',_0x14fc46,_0x304dba);_0x376960(_0x304dba);});});}exports[_0x248b('0x15')]=function(_0x146300){var _0xaa8232=this;return new Promise(function(_0x3bb21f,_0x4de01a){return db[_0x248b('0x16')]['create'](_0x146300[_0x248b('0x17')],{'raw':_0x146300[_0x248b('0x18')]?_0x146300[_0x248b('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x248b('0xb')](function(_0x40a6b7){logger[_0x248b('0x19')](_0x248b('0x15'),_0x146300);logger[_0x248b('0xd')](_0x248b('0x15'),_0x146300,JSON['stringify'](_0x40a6b7));_0x3bb21f(_0x40a6b7);})[_0x248b('0x14')](function(_0x1cb2a7){logger[_0x248b('0x10')]('CreateCmHopperHistory',_0x1cb2a7[_0x248b('0x12')],_0x146300);_0x4de01a(_0xaa8232[_0x248b('0x10')](0x1f4,_0x1cb2a7['message']));});});};exports['AvgHandleTime']=function(_0x20123f){var _0x25ad0d=this;return new Promise(function(_0x2657e3,_0x4980b4){return db[_0x248b('0x16')][_0x248b('0x1a')]({'raw':_0x20123f[_0x248b('0x18')]?_0x20123f['options']['raw']===undefined?!![]:![]:!![],'where':_0x20123f['options']?_0x20123f['options'][_0x248b('0x1b')]||null:null,'attributes':[[db[_0x248b('0x1c')]['fn'](_0x248b('0x1d'),db['sequelize'][_0x248b('0x1e')]('id')),_0x248b('0x1f')],[db[_0x248b('0x1c')]['fn']('COUNT',db[_0x248b('0x1c')]['fn']('IF',db['sequelize'][_0x248b('0x20')](_0x248b('0x21')))),'predictiveIntervalAnsweredCalls'],[db[_0x248b('0x1c')]['fn'](_0x248b('0x1d'),db['sequelize']['fn']('IF',db[_0x248b('0x1c')]['literal'](_0x248b('0x22')))),_0x248b('0x23')],[db[_0x248b('0x1c')]['fn'](_0x248b('0x1d'),db[_0x248b('0x1c')]['fn']('IF',db[_0x248b('0x1c')][_0x248b('0x20')]('`state`\x20=\x2011,\x201,\x20null'))),_0x248b('0x24')],[db[_0x248b('0x1c')]['fn'](_0x248b('0x25'),db[_0x248b('0x1c')]['fn']('IF',db[_0x248b('0x1c')][_0x248b('0x20')](_0x248b('0x26')))),_0x248b('0x27')],[db[_0x248b('0x1c')]['fn']('AVG',db[_0x248b('0x1c')]['fn']('IF',db[_0x248b('0x1c')][_0x248b('0x20')](_0x248b('0x28')))),_0x248b('0x29')]]})[_0x248b('0xb')](function(_0x127c7c){logger[_0x248b('0x19')]('AvgHandleTime',_0x20123f);logger[_0x248b('0xd')](_0x248b('0x2a'),_0x20123f,JSON[_0x248b('0xf')](_0x127c7c));_0x2657e3(_0x127c7c);})['catch'](function(_0x24e99e){logger['error'](_0x248b('0x2a'),_0x24e99e[_0x248b('0x12')],_0x20123f);_0x4980b4(_0x25ad0d[_0x248b('0x10')](0x1f4,_0x24e99e[_0x248b('0x12')]));});});};exports[_0x248b('0x2b')]=function(_0xe2e7e1){var _0x274036=this;return new Promise(function(_0x28b074,_0x536e3a){return db[_0x248b('0x16')][_0x248b('0x1a')]({'raw':_0xe2e7e1[_0x248b('0x18')]?_0xe2e7e1['options']['raw']===undefined?!![]:![]:!![],'where':_0xe2e7e1['options']?_0xe2e7e1['options']['where']||null:null,'attributes':[[_0x248b('0x2c'),'name'],[db[_0x248b('0x1c')]['fn'](_0x248b('0x1d'),db[_0x248b('0x1c')]['fn']('IF',db[_0x248b('0x1c')][_0x248b('0x20')](_0x248b('0x2d')))),_0x248b('0x2e')],[db[_0x248b('0x1c')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x248b('0x1c')][_0x248b('0x20')](_0x248b('0x2f')))),_0x248b('0x30')],[db[_0x248b('0x1c')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x248b('0x1c')][_0x248b('0x20')](_0x248b('0x21')))),'outboundAnswerCallsDay'],[db['sequelize']['fn'](_0x248b('0x1d'),db[_0x248b('0x1c')]['fn']('IF',db['sequelize'][_0x248b('0x20')]('`state`\x20=\x205,\x201,\x20null'))),_0x248b('0x31')],[db['sequelize']['fn']('COUNT',db[_0x248b('0x1c')]['fn']('IF',db[_0x248b('0x1c')][_0x248b('0x20')]('`state`\x20=\x208,\x201,\x20null'))),_0x248b('0x32')],[db[_0x248b('0x1c')]['fn'](_0x248b('0x1d'),db[_0x248b('0x1c')]['fn']('IF',db[_0x248b('0x1c')]['literal'](_0x248b('0x33')))),'outboundDropCallsDayTimeout'],[db[_0x248b('0x1c')]['fn'](_0x248b('0x1d'),db[_0x248b('0x1c')]['fn']('IF',db[_0x248b('0x1c')][_0x248b('0x20')](_0x248b('0x34')))),_0x248b('0x35')],[db[_0x248b('0x1c')]['fn'](_0x248b('0x1d'),db[_0x248b('0x1c')]['fn']('IF',db['sequelize'][_0x248b('0x20')](_0x248b('0x36')))),_0x248b('0x37')],[db[_0x248b('0x1c')]['fn'](_0x248b('0x1d'),db[_0x248b('0x1c')]['fn']('IF',db['sequelize'][_0x248b('0x20')](_0x248b('0x38')))),_0x248b('0x39')],[db[_0x248b('0x1c')]['fn'](_0x248b('0x1d'),db['sequelize']['fn']('IF',db[_0x248b('0x1c')]['literal'](_0x248b('0x3a')))),_0x248b('0x3b')],[db[_0x248b('0x1c')]['fn'](_0x248b('0x1d'),db[_0x248b('0x1c')]['fn']('IF',db['sequelize'][_0x248b('0x20')]('`state`\x20=\x2018,\x201,\x20null'))),_0x248b('0x3c')],[db[_0x248b('0x1c')]['fn']('COUNT',db[_0x248b('0x1c')]['fn']('IF',db['sequelize'][_0x248b('0x20')](_0x248b('0x3d')))),_0x248b('0x3e')],[db[_0x248b('0x1c')]['fn'](_0x248b('0x1d'),db[_0x248b('0x1c')]['fn']('IF',db[_0x248b('0x1c')]['literal'](_0x248b('0x3f')))),_0x248b('0x3c')],[db[_0x248b('0x1c')]['fn']('COUNT',db[_0x248b('0x1c')]['fn']('IF',db[_0x248b('0x1c')][_0x248b('0x20')](_0x248b('0x40')))),_0x248b('0x41')]],'group':[_0x248b('0x2c')]})[_0x248b('0xb')](function(_0x39c0b5){logger[_0x248b('0x19')](_0x248b('0x2b'),_0xe2e7e1);logger['debug'](_0x248b('0x2b'),_0xe2e7e1,JSON[_0x248b('0xf')](_0x39c0b5));_0x28b074(_0x39c0b5);})[_0x248b('0x14')](function(_0x4adba8){logger['error'](_0x248b('0x2b'),_0x4adba8[_0x248b('0x12')],_0xe2e7e1);_0x536e3a(_0x274036[_0x248b('0x10')](0x1f4,_0x4adba8[_0x248b('0x12')]));});});};exports[_0x248b('0x42')]=function(_0x297128){var _0x5cab1b=this;return new Promise(function(_0x2c00a2,_0x57a5b){return db[_0x248b('0x16')][_0x248b('0x1a')]({'raw':_0x297128['options']?_0x297128[_0x248b('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x297128['options']?_0x297128[_0x248b('0x18')][_0x248b('0x1b')]||null:null,'attributes':[['campaign',_0x248b('0x43')],[db[_0x248b('0x1c')]['fn'](_0x248b('0x1d'),db['sequelize'][_0x248b('0x1e')]('id')),_0x248b('0x44')],[db[_0x248b('0x1c')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x248b('0x1c')]['literal']('`state`\x20=\x204,\x201,\x20null'))),'ivrAnswerCallsDay']],'group':[_0x248b('0x2c')]})[_0x248b('0xb')](function(_0x8a3d5a){logger[_0x248b('0x19')](_0x248b('0x42'),_0x297128);logger[_0x248b('0xd')](_0x248b('0x42'),_0x297128,JSON[_0x248b('0xf')](_0x8a3d5a));_0x2c00a2(_0x8a3d5a);})[_0x248b('0x14')](function(_0x5a19ad){logger[_0x248b('0x10')](_0x248b('0x42'),_0x5a19ad[_0x248b('0x12')],_0x297128);_0x57a5b(_0x5cab1b[_0x248b('0x10')](0x1f4,_0x5a19ad['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 1baf95a..2f6fc03 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 _0x0ac4=['/describe','isAuthenticated','describe','show','post','create','put','update','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmHopperHistory.controller','get','index'];(function(_0x513441,_0x20bfba){var _0x5a49c8=function(_0x2cc7d9){while(--_0x2cc7d9){_0x513441['push'](_0x513441['shift']());}};_0x5a49c8(++_0x20bfba);}(_0x0ac4,0x1ac));var _0x40ac=function(_0x30033a,_0x5ce4a6){_0x30033a=_0x30033a-0x0;var _0x5e3518=_0x0ac4[_0x30033a];return _0x5e3518;};'use strict';var multer=require(_0x40ac('0x0'));var util=require(_0x40ac('0x1'));var path=require(_0x40ac('0x2'));var timeout=require(_0x40ac('0x3'));var express=require(_0x40ac('0x4'));var router=express[_0x40ac('0x5')]();var fs_extra=require(_0x40ac('0x6'));var auth=require(_0x40ac('0x7'));var interaction=require(_0x40ac('0x8'));var config=require('../../config/environment');var controller=require(_0x40ac('0x9'));router[_0x40ac('0xa')]('/',auth['isAuthenticated'](),controller[_0x40ac('0xb')]);router[_0x40ac('0xa')](_0x40ac('0xc'),auth[_0x40ac('0xd')](),controller[_0x40ac('0xe')]);router[_0x40ac('0xa')]('/:id',auth[_0x40ac('0xd')](),controller[_0x40ac('0xf')]);router[_0x40ac('0x10')]('/',auth[_0x40ac('0xd')](),controller[_0x40ac('0x11')]);router[_0x40ac('0x12')]('/:id',auth[_0x40ac('0xd')](),controller[_0x40ac('0x13')]);module['exports']=router; \ No newline at end of file +var _0x181f=['exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./cmHopperHistory.controller','get','isAuthenticated','/describe','describe','post','create','put'];(function(_0x8b7225,_0x256c14){var _0x24e36b=function(_0x5d3b8d){while(--_0x5d3b8d){_0x8b7225['push'](_0x8b7225['shift']());}};_0x24e36b(++_0x256c14);}(_0x181f,0xf1));var _0xf181=function(_0x41b7b8,_0x11082e){_0x41b7b8=_0x41b7b8-0x0;var _0x57a0f2=_0x181f[_0x41b7b8];return _0x57a0f2;};'use strict';var multer=require('multer');var util=require(_0xf181('0x0'));var path=require(_0xf181('0x1'));var timeout=require(_0xf181('0x2'));var express=require(_0xf181('0x3'));var router=express[_0xf181('0x4')]();var fs_extra=require(_0xf181('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xf181('0x6'));var config=require('../../config/environment');var controller=require(_0xf181('0x7'));router[_0xf181('0x8')]('/',auth[_0xf181('0x9')](),controller['index']);router[_0xf181('0x8')](_0xf181('0xa'),auth[_0xf181('0x9')](),controller[_0xf181('0xb')]);router[_0xf181('0x8')]('/:id',auth[_0xf181('0x9')](),controller['show']);router[_0xf181('0xc')]('/',auth[_0xf181('0x9')](),controller[_0xf181('0xd')]);router[_0xf181('0xe')]('/:id',auth['isAuthenticated'](),controller['update']);module[_0xf181('0xf')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 7720332..44f822e 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 _0x7a08=['STRING','sequelize','exports'];(function(_0x1047aa,_0x20f2bf){var _0x50ef63=function(_0x4d316d){while(--_0x4d316d){_0x1047aa['push'](_0x1047aa['shift']());}};_0x50ef63(++_0x20f2bf);}(_0x7a08,0x11e));var _0x87a0=function(_0x29e35f,_0x4859ef){_0x29e35f=_0x29e35f-0x0;var _0x266b74=_0x7a08[_0x29e35f];return _0x266b74;};'use strict';var Sequelize=require(_0x87a0('0x0'));module[_0x87a0('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x87a0('0x2')]},'dialPrefix':{'type':Sequelize[_0x87a0('0x2')]}}; \ No newline at end of file +var _0xb4e6=['sequelize','exports','STRING','name'];(function(_0xee615b,_0x51fd57){var _0x5d635c=function(_0x39ea3c){while(--_0x39ea3c){_0xee615b['push'](_0xee615b['shift']());}};_0x5d635c(++_0x51fd57);}(_0xb4e6,0xd8));var _0x6b4e=function(_0x1bb58c,_0x2c8a4d){_0x1bb58c=_0x1bb58c-0x0;var _0x277586=_0xb4e6[_0x1bb58c];return _0x277586;};'use strict';var Sequelize=require(_0x6b4e('0x0'));module[_0x6b4e('0x1')]={'name':{'type':Sequelize[_0x6b4e('0x2')],'unique':_0x6b4e('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x6b4e('0x2')]},'dialPrefix':{'type':Sequelize[_0x6b4e('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index a4db6dc..ec1c640 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 _0x590b=['query','attributes','fields','nolimit','limit','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','length','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Lists','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','describe','Disposition','getDispositions','findOne','hasOwnProperty','order','sort','pick','ListId','removeDispositions','addContacts','tags','isArray','join','push','omit','success','dataValues','errors','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','CmContact','format','raw','ContactItemType','OrderBy','cm_contacts','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','field','c.cf_','alias','from','cm_contact_has_items','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','additionalPhone_','description','description_additionalPhone_','toString','isEmpty','now','writeFileSync','attachment;\x20filename=','list_%d_%s.csv','setHeader','Content-type','text/csv','download','sequelize','text','Sequelize','number','INTEGER','switch','defaultValue','queryInterface','cf_%s','getCustomFields','findAndCountAll','addAgents','spread','ids','userCmList:save','removeAgents','userCmList:remove','emit','User','getAgents','info','eml-format','request-promise','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./cmList.socket','register','sendStatus','status','end','json','offset','undefined','count','set','apply','reject','destroy','then','get','error','stack','name','send','index','map','CmList','rawAttributes','fieldName','type','key','keys','filters','intersection','model'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0x590b,0x197));var _0xb590=function(_0x3ebe6b,_0x50bbf7){_0x3ebe6b=_0x3ebe6b-0x0;var _0x334cfc=_0x590b[_0x3ebe6b];return _0x334cfc;};'use strict';var emlformat=require(_0xb590('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb590('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xb590('0x2'));var fs=require('fs');var fs_extra=require(_0xb590('0x3'));var _=require(_0xb590('0x4'));var squel=require(_0xb590('0x5'));var crypto=require('crypto');var jsforce=require(_0xb590('0x6'));var deskjs=require(_0xb590('0x7'));var toCsv=require(_0xb590('0x8'));var querystring=require('querystring');var Papa=require(_0xb590('0x9'));var Redis=require(_0xb590('0xa'));var authService=require(_0xb590('0xb'));var qs=require(_0xb590('0xc'));var as=require(_0xb590('0xd'));var hardwareService=require(_0xb590('0xe'));var logger=require('../../config/logger')(_0xb590('0xf'));var utils=require(_0xb590('0x10'));var config=require(_0xb590('0x11'));var licenseUtil=require(_0xb590('0x12'));var db=require('../../mysqldb')['db'];var csv_results;config[_0xb590('0x13')]=_['defaults'](config['redis'],{'host':_0xb590('0x14'),'port':0x18eb});var socket=require(_0xb590('0x15'))(new Redis(config['redis']));require(_0xb590('0x16'))[_0xb590('0x17')](socket);function respondWithStatusCode(_0x99e6b6,_0x5403ba){_0x5403ba=_0x5403ba||0xcc;return function(_0x371742){if(_0x371742){return _0x99e6b6[_0xb590('0x18')](_0x5403ba);}return _0x99e6b6[_0xb590('0x19')](_0x5403ba)[_0xb590('0x1a')]();};}function respondWithResult(_0x227a39,_0x58a109){_0x58a109=_0x58a109||0xc8;return function(_0x24cbc7){if(_0x24cbc7){return _0x227a39[_0xb590('0x19')](_0x58a109)[_0xb590('0x1b')](_0x24cbc7);}};}function respondWithFilteredResult(_0x20c8c9,_0x28551a){return function(_0x91b8f3){if(_0x91b8f3){var _0x21afb0=typeof _0x28551a[_0xb590('0x1c')]===_0xb590('0x1d')&&typeof _0x28551a['limit']===_0xb590('0x1d');var _0x301dc=_0x91b8f3[_0xb590('0x1e')];var _0x387759=_0x21afb0?0x0:_0x28551a[_0xb590('0x1c')];var _0x52927e=_0x21afb0?_0x91b8f3[_0xb590('0x1e')]:_0x28551a[_0xb590('0x1c')]+_0x28551a['limit'];var _0x6c2ef0;if(_0x52927e>=_0x301dc){_0x52927e=_0x301dc;_0x6c2ef0=0xc8;}else{_0x6c2ef0=0xce;}_0x20c8c9[_0xb590('0x19')](_0x6c2ef0);return _0x20c8c9[_0xb590('0x1f')]('Content-Range',_0x387759+'-'+_0x52927e+'/'+_0x301dc)[_0xb590('0x1b')](_0x91b8f3);}return null;};}function patchUpdates(_0x4dbf14){return function(_0x1655c0){try{jsonpatch[_0xb590('0x20')](_0x1655c0,_0x4dbf14,!![]);}catch(_0x1673e5){return BPromise[_0xb590('0x21')](_0x1673e5);}return _0x1655c0['save']();};}function saveUpdates(_0x57a903,_0x373e6f){return function(_0x2d4ba8){if(_0x2d4ba8){return _0x2d4ba8['update'](_0x57a903)['then'](function(_0x2e0d3c){return _0x2e0d3c;});}return null;};}function removeEntity(_0x2fe084,_0xe6b6aa){return function(_0x357a6a){if(_0x357a6a){return _0x357a6a[_0xb590('0x22')]()[_0xb590('0x23')](function(){var _0x3aba59=_0x357a6a[_0xb590('0x24')]({'plain':!![]});var _0x148cb7='Lists';return db['UserProfileResource'][_0xb590('0x22')]({'where':{'type':_0x148cb7,'resourceId':_0x3aba59['id']}})['then'](function(){return _0x357a6a;});})['then'](function(){_0x2fe084['status'](0xcc)[_0xb590('0x1a')]();});}};}function handleEntityNotFound(_0x14305d,_0x4acca5){return function(_0x310b98){if(!_0x310b98){_0x14305d['sendStatus'](0x194);}return _0x310b98;};}function handleError(_0x20cf95,_0x248205){_0x248205=_0x248205||0x1f4;return function(_0x4dc109){logger[_0xb590('0x25')](_0x4dc109[_0xb590('0x26')]);if(_0x4dc109[_0xb590('0x27')]){delete _0x4dc109[_0xb590('0x27')];}_0x20cf95['status'](_0x248205)[_0xb590('0x28')](_0x4dc109);};}exports[_0xb590('0x29')]=function(_0xa29314,_0x405ae1){var _0x49742f={},_0x15e9b={},_0xb67cb9={'count':0x0,'rows':[]};var _0x4252f1=_[_0xb590('0x2a')](db[_0xb590('0x2b')][_0xb590('0x2c')],function(_0x4078ac){return{'name':_0x4078ac[_0xb590('0x2d')],'type':_0x4078ac[_0xb590('0x2e')][_0xb590('0x2f')]};});_0x15e9b['model']=_['map'](_0x4252f1,'name');_0x15e9b['query']=_[_0xb590('0x30')](_0xa29314['query']);_0x15e9b[_0xb590('0x31')]=_[_0xb590('0x32')](_0x15e9b[_0xb590('0x33')],_0x15e9b[_0xb590('0x34')]);_0x49742f[_0xb590('0x35')]=_[_0xb590('0x32')](_0x15e9b['model'],qs[_0xb590('0x36')](_0xa29314[_0xb590('0x34')][_0xb590('0x36')]));_0x49742f[_0xb590('0x35')]=_0x49742f[_0xb590('0x35')]['length']?_0x49742f[_0xb590('0x35')]:_0x15e9b[_0xb590('0x33')];if(!_0xa29314[_0xb590('0x34')]['hasOwnProperty'](_0xb590('0x37'))){_0x49742f[_0xb590('0x38')]=qs[_0xb590('0x38')](_0xa29314[_0xb590('0x34')][_0xb590('0x38')]);_0x49742f['offset']=qs['offset'](_0xa29314[_0xb590('0x34')][_0xb590('0x1c')]);}_0x49742f['order']=qs['sort'](_0xa29314[_0xb590('0x34')]['sort']);_0x49742f[_0xb590('0x39')]=qs[_0xb590('0x31')](_['pick'](_0xa29314[_0xb590('0x34')],_0x15e9b[_0xb590('0x31')]),_0x4252f1);if(_0xa29314['query'][_0xb590('0x3a')]){_0x49742f[_0xb590('0x39')]=_[_0xb590('0x3b')](_0x49742f[_0xb590('0x39')],{'$or':_[_0xb590('0x2a')](_0x4252f1,function(_0x476cc3){if(_0x476cc3[_0xb590('0x2e')]!==_0xb590('0x3c')){var _0x54b037={};_0x54b037[_0x476cc3[_0xb590('0x27')]]={'$like':'%'+_0xa29314[_0xb590('0x34')][_0xb590('0x3a')]+'%'};return _0x54b037;}})});}_0x49742f=_['merge']({},_0x49742f,_0xa29314[_0xb590('0x3d')]);var _0x1f9de3={'where':_0x49742f[_0xb590('0x39')]};return db[_0xb590('0x2b')]['count'](_0x1f9de3)[_0xb590('0x23')](function(_0x3aac02){_0xb67cb9[_0xb590('0x1e')]=_0x3aac02;if(_0xa29314[_0xb590('0x34')][_0xb590('0x3e')]){_0x49742f[_0xb590('0x3f')]=[{'all':!![]}];}return db['CmList'][_0xb590('0x40')](_0x49742f);})['then'](function(_0x34d61a){_0xb67cb9[_0xb590('0x41')]=_0x34d61a;return _0xb67cb9;})[_0xb590('0x23')](respondWithFilteredResult(_0x405ae1,_0x49742f))[_0xb590('0x42')](handleError(_0x405ae1,null));};exports['show']=function(_0x25c0bb,_0x27a1bf){var _0x3f57f6={'raw':![],'where':{'id':_0x25c0bb[_0xb590('0x43')]['id']}},_0x3da7cc={};_0x3da7cc[_0xb590('0x33')]=_[_0xb590('0x30')](db[_0xb590('0x2b')][_0xb590('0x2c')]);_0x3da7cc['query']=_[_0xb590('0x30')](_0x25c0bb['query']);_0x3da7cc[_0xb590('0x31')]=_[_0xb590('0x32')](_0x3da7cc[_0xb590('0x33')],_0x3da7cc['query']);_0x3f57f6[_0xb590('0x35')]=_[_0xb590('0x32')](_0x3da7cc[_0xb590('0x33')],qs[_0xb590('0x36')](_0x25c0bb[_0xb590('0x34')][_0xb590('0x36')]));_0x3f57f6[_0xb590('0x35')]=_0x3f57f6['attributes'][_0xb590('0x44')]?_0x3f57f6[_0xb590('0x35')]:_0x3da7cc['model'];if(_0x25c0bb[_0xb590('0x34')]['includeAll']){_0x3f57f6[_0xb590('0x3f')]=[{'all':!![]}];}_0x3f57f6=_['merge']({},_0x3f57f6,_0x25c0bb[_0xb590('0x3d')]);return db['CmList']['find'](_0x3f57f6)[_0xb590('0x23')](handleEntityNotFound(_0x27a1bf,null))[_0xb590('0x23')](respondWithResult(_0x27a1bf,null))['catch'](handleError(_0x27a1bf,null));};exports[_0xb590('0x45')]=function(_0x5dd346,_0x532052){return db[_0xb590('0x2b')][_0xb590('0x45')](_0x5dd346['body'],{})[_0xb590('0x23')](function(_0x180276){var _0x3030a5=_0x5dd346[_0xb590('0x46')][_0xb590('0x24')]({'plain':!![]});if(!_0x3030a5)throw new Error(_0xb590('0x47'));if(_0x3030a5['role']===_0xb590('0x46')){var _0x11bf74=_0x180276[_0xb590('0x24')]({'plain':!![]});var _0x454c7c=_0xb590('0x48');return db[_0xb590('0x49')]['find']({'where':{'name':_0x454c7c,'userProfileId':_0x3030a5[_0xb590('0x4a')]},'raw':!![]})['then'](function(_0x5a247a){if(_0x5a247a&&_0x5a247a[_0xb590('0x4b')]===0x0){return db[_0xb590('0x4c')]['create']({'name':_0x11bf74[_0xb590('0x27')],'resourceId':_0x11bf74['id'],'type':_0x5a247a['name'],'sectionId':_0x5a247a['id']},{})['then'](function(){return _0x180276;});}else{return _0x180276;}})[_0xb590('0x42')](function(_0xbe2e84){logger[_0xb590('0x25')](_0xb590('0x4d'),_0xbe2e84);throw _0xbe2e84;});}return _0x180276;})[_0xb590('0x23')](respondWithResult(_0x532052,0xc9))[_0xb590('0x42')](handleError(_0x532052,null));};exports['update']=function(_0x4a317a,_0x10ed00){if(_0x4a317a[_0xb590('0x4e')]['id']){delete _0x4a317a[_0xb590('0x4e')]['id'];}return db[_0xb590('0x2b')][_0xb590('0x4f')]({'where':{'id':_0x4a317a[_0xb590('0x43')]['id']}})['then'](handleEntityNotFound(_0x10ed00,null))[_0xb590('0x23')](saveUpdates(_0x4a317a['body'],null))[_0xb590('0x23')](respondWithResult(_0x10ed00,null))['catch'](handleError(_0x10ed00,null));};exports[_0xb590('0x22')]=function(_0x2cbd95,_0x52f09c){return db[_0xb590('0x2b')][_0xb590('0x4f')]({'where':{'id':_0x2cbd95[_0xb590('0x43')]['id']}})[_0xb590('0x23')](handleEntityNotFound(_0x52f09c,null))[_0xb590('0x23')](removeEntity(_0x52f09c,null))[_0xb590('0x42')](handleError(_0x52f09c,null));};exports[_0xb590('0x50')]=function(_0x183e5d,_0xdee515){return db['CmList'][_0xb590('0x50')]()[_0xb590('0x23')](respondWithResult(_0xdee515,null))[_0xb590('0x42')](handleError(_0xdee515,null));};exports['addDisposition']=function(_0x48aaa1,_0x34ce25,_0x1fa1ab){if(_0x48aaa1['body']['id']){delete _0x48aaa1[_0xb590('0x4e')]['id'];}return db[_0xb590('0x2b')][_0xb590('0x4f')]({'where':{'id':_0x48aaa1[_0xb590('0x43')]['id']}})['then'](handleEntityNotFound(_0x34ce25,null))[_0xb590('0x23')](function(_0x575bdb){if(_0x575bdb){_0x48aaa1['body']['ListId']=_0x575bdb['id'];return db[_0xb590('0x51')][_0xb590('0x45')](_0x48aaa1[_0xb590('0x4e')]);}})[_0xb590('0x23')](respondWithResult(_0x34ce25,null))[_0xb590('0x42')](handleError(_0x34ce25,null));};exports[_0xb590('0x52')]=function(_0x3cdb41,_0x29bc16,_0x3411d3){var _0x32a81f={'raw':![],'where':{}};var _0x336ec4={};var _0x37a1c8={'count':0x0,'rows':[]};return db[_0xb590('0x2b')][_0xb590('0x53')]({'where':{'id':_0x3cdb41[_0xb590('0x43')]['id']}})[_0xb590('0x23')](handleEntityNotFound(_0x29bc16,null))[_0xb590('0x23')](function(_0x15f98a){if(_0x15f98a){_0x336ec4[_0xb590('0x33')]=_[_0xb590('0x30')](db['Disposition'][_0xb590('0x2c')]);_0x336ec4[_0xb590('0x34')]=_['keys'](_0x3cdb41['query']);_0x336ec4[_0xb590('0x31')]=_['intersection'](_0x336ec4[_0xb590('0x33')],_0x336ec4[_0xb590('0x34')]);_0x32a81f[_0xb590('0x35')]=_[_0xb590('0x32')](_0x336ec4[_0xb590('0x33')],qs[_0xb590('0x36')](_0x3cdb41[_0xb590('0x34')]['fields']));_0x32a81f[_0xb590('0x35')]=_0x32a81f['attributes'][_0xb590('0x44')]?_0x32a81f[_0xb590('0x35')]:_0x336ec4[_0xb590('0x33')];if(!_0x3cdb41[_0xb590('0x34')][_0xb590('0x54')](_0xb590('0x37'))){_0x32a81f[_0xb590('0x38')]=qs[_0xb590('0x38')](_0x3cdb41[_0xb590('0x34')][_0xb590('0x38')]);_0x32a81f[_0xb590('0x1c')]=qs[_0xb590('0x1c')](_0x3cdb41[_0xb590('0x34')][_0xb590('0x1c')]);}_0x32a81f[_0xb590('0x55')]=qs[_0xb590('0x56')](_0x3cdb41[_0xb590('0x34')][_0xb590('0x56')]);_0x32a81f['where']=qs[_0xb590('0x31')](_[_0xb590('0x57')](_0x3cdb41[_0xb590('0x34')],_0x336ec4[_0xb590('0x31')]));_0x32a81f[_0xb590('0x39')][_0xb590('0x58')]=_0x15f98a['id'];if(_0x3cdb41[_0xb590('0x34')][_0xb590('0x3a')]){_0x32a81f[_0xb590('0x39')]=_[_0xb590('0x3b')](_0x32a81f[_0xb590('0x39')],{'$or':_[_0xb590('0x2a')](_0x32a81f[_0xb590('0x35')],function(_0x47c176){var _0x48856a={};_0x48856a[_0x47c176]={'$like':'%'+_0x3cdb41[_0xb590('0x34')][_0xb590('0x3a')]+'%'};return _0x48856a;})});}_0x32a81f=_[_0xb590('0x3b')]({},_0x32a81f,_0x3cdb41[_0xb590('0x3d')]);return db[_0xb590('0x51')]['count']({'where':_0x32a81f[_0xb590('0x39')]})[_0xb590('0x23')](function(_0x201468){_0x37a1c8['count']=_0x201468;if(_0x3cdb41[_0xb590('0x34')][_0xb590('0x3e')]){_0x32a81f[_0xb590('0x3f')]=[{'all':!![]}];}return db[_0xb590('0x51')]['findAll'](_0x32a81f);})[_0xb590('0x23')](function(_0x2e0628){_0x37a1c8['rows']=_0x2e0628;return _0x37a1c8;});}})[_0xb590('0x23')](respondWithFilteredResult(_0x29bc16,_0x32a81f))[_0xb590('0x42')](handleError(_0x29bc16,null));};exports[_0xb590('0x59')]=function(_0x2c425e,_0xdbdab9,_0x5edd41){return db['CmList'][_0xb590('0x4f')]({'where':{'id':_0x2c425e[_0xb590('0x43')]['id']}})[_0xb590('0x23')](handleEntityNotFound(_0xdbdab9,null))[_0xb590('0x23')](function(_0x545a83){if(_0x545a83){return _0x545a83[_0xb590('0x59')](_0x2c425e['query']['ids']);}})[_0xb590('0x23')](respondWithStatusCode(_0xdbdab9,null))['catch'](handleError(_0xdbdab9,null));};exports[_0xb590('0x5a')]=function(_0x541fd9,_0x54408c,_0x2b15b2){return db[_0xb590('0x2b')][_0xb590('0x4f')]({'where':{'id':_0x541fd9['params']['id']}})[_0xb590('0x23')](handleEntityNotFound(_0x54408c,null))[_0xb590('0x23')](function(_0x1875e2){if(_0x1875e2){var _0x3d06d9=[];var _0x23c8fe={'success':[],'errors':[]};return db['CmContact']['describe']()['then'](function(_0x4a179e){if(_0x541fd9[_0xb590('0x4e')][_0xb590('0x5b')]&&_[_0xb590('0x5c')](_0x541fd9[_0xb590('0x4e')]['tags'])){if(_0x541fd9[_0xb590('0x4e')][_0xb590('0x5b')][_0xb590('0x44')]){_0x541fd9[_0xb590('0x4e')][_0xb590('0x5b')]=_0x541fd9[_0xb590('0x4e')][_0xb590('0x5b')][_0xb590('0x5d')](';')+';';}else{_0x541fd9[_0xb590('0x4e')][_0xb590('0x5b')]=null;}}else{_0x541fd9[_0xb590('0x4e')]['tags']=null;}if(_0x541fd9[_0xb590('0x4e')]&&_['isArray'](_0x541fd9[_0xb590('0x4e')])){for(var _0x114d5b=0x0;_0x114d5b<_0x541fd9[_0xb590('0x4e')][_0xb590('0x44')];_0x114d5b+=0x1){_0x541fd9[_0xb590('0x4e')][_0x114d5b][_0xb590('0x58')]=_0x541fd9['params']['id'];_0x3d06d9[_0xb590('0x5e')](_0x541fd9[_0xb590('0x4e')][_0x114d5b]);}return BPromise['each'](_0x3d06d9,function(_0x243c37){return db['CmContact']['create'](_[_0xb590('0x5f')](_0x243c37,['ids','id'])||{},{'fields':_[_0xb590('0x30')](_0x4a179e),'raw':!![]})[_0xb590('0x23')](function(_0xc64742){_0x23c8fe[_0xb590('0x60')]['push'](_0xc64742[_0xb590('0x61')]);})[_0xb590('0x42')](function(_0x301243){_0x23c8fe[_0xb590('0x62')][_0xb590('0x5e')]({'data':_0x243c37,'error':_0x301243[_0xb590('0x63')]});});})[_0xb590('0x23')](function(_0x2316e5){return _0x23c8fe;})['catch'](function(_0x17e242){return _0x17e242;});}else{_0x54408c[_0xb590('0x19')](0x190)[_0xb590('0x1b')]({'message':_0xb590('0x64')});}});}})['then'](respondWithResult(_0x54408c,null))[_0xb590('0x42')](handleError(_0x54408c,null));};exports[_0xb590('0x65')]=function(_0x17ca3e,_0x413593,_0x5b4abf){var _0x50f924;return db[_0xb590('0x2b')]['find']({'where':{'id':_0x17ca3e[_0xb590('0x43')]['id']},'include':[{'model':db[_0xb590('0x66')],'as':_0xb590('0x67')}]})[_0xb590('0x23')](handleEntityNotFound(_0x413593,null))[_0xb590('0x23')](function(_0x253970){if(_0x253970){_0x50f924=_0x253970;return db[_0xb590('0x68')]['rawAttributes'];}})[_0xb590('0x23')](function(_0x19769a){if(_0x19769a){var _0x1fd089={};var _0x1ca98a={};_0x1ca98a['model']=_['concat'](_['keys'](_0x19769a),_[_0xb590('0x2a')](_0x50f924['CustomFields'],function(_0x56c9f5){return util[_0xb590('0x69')]('cf_%d',_0x56c9f5['id']);}));_0x1ca98a[_0xb590('0x34')]=_[_0xb590('0x30')](_0x17ca3e['query']);_0x1ca98a[_0xb590('0x31')]=_['intersection'](_0x1ca98a['model'],_0x1ca98a[_0xb590('0x34')]);_0x1fd089['attributes']=_[_0xb590('0x32')](_0x1ca98a['model'],qs[_0xb590('0x36')](_0x17ca3e[_0xb590('0x34')][_0xb590('0x36')]));_0x1fd089[_0xb590('0x35')]=_0x1fd089[_0xb590('0x35')][_0xb590('0x44')]?_0x1fd089[_0xb590('0x35')]:_0x1ca98a[_0xb590('0x33')];if(!_0x17ca3e[_0xb590('0x34')][_0xb590('0x54')](_0xb590('0x37'))){_0x1fd089[_0xb590('0x38')]=qs[_0xb590('0x38')](_0x17ca3e[_0xb590('0x34')][_0xb590('0x38')]);_0x1fd089[_0xb590('0x1c')]=qs[_0xb590('0x1c')](_0x17ca3e['query'][_0xb590('0x1c')]);}_0x1fd089[_0xb590('0x55')]=qs[_0xb590('0x56')](_0x17ca3e['query'][_0xb590('0x56')]);_0x1fd089['where']=qs[_0xb590('0x31')](_[_0xb590('0x57')](_0x17ca3e[_0xb590('0x34')],_0x1ca98a[_0xb590('0x31')]));_0x1fd089[_0xb590('0x6a')]=!![];if(_0x17ca3e['query'][_0xb590('0x3a')]){_0x1fd089[_0xb590('0x39')]=_[_0xb590('0x3b')](_0x1fd089['where'],{'$or':_[_0xb590('0x2a')](_0x1fd089[_0xb590('0x35')],function(_0x2fb065){var _0xa4ce2b={};_0xa4ce2b[_0x2fb065]={'$like':'%'+_0x17ca3e[_0xb590('0x34')][_0xb590('0x3a')]+'%'};return _0xa4ce2b;})});}_0x1fd089=_[_0xb590('0x3b')]({},_0x1fd089,_0x17ca3e[_0xb590('0x3d')]);return _0x50f924[_0xb590('0x65')](_0x1fd089);}})[_0xb590('0x23')](respondWithResult(_0x413593,null))['catch'](handleError(_0x413593,null));};exports['getContactsCsv']=function(_0x411653,_0x4e8b9c,_0x28a86e){var _0x3a1e55;var _0x430a84;var _0x41f2a5;var _0x5b03b4=_0x411653['params']['id'];csv_results=[];return db[_0xb590('0x6b')][_0xb590('0x40')]({'attributes':['id',_0xb590('0x27')],'raw':!![],'order':[_0xb590('0x6c')]})[_0xb590('0x23')](function(_0x3fb3f4){_0x3a1e55=_0x3fb3f4;var _0x25ae3c=_[_0xb590('0x30')](db[_0xb590('0x68')][_0xb590('0x2c')]);return db['CmCustomField'][_0xb590('0x40')]({'raw':!![],'attributes':['id','alias']})[_0xb590('0x23')](function(_0x4539cf){_0x430a84=_0x4539cf;var _0x43bc78=squel['select']()[_0xb590('0x36')](_0x25ae3c)['from'](_0xb590('0x6d'),'c')[_0xb590('0x39')](_0xb590('0x6e'),_0x5b03b4)[_0xb590('0x39')](_0xb590('0x6f'))['distinct']();for(var _0x91459f=0x0;_0x91459f<_0x430a84[_0xb590('0x44')];_0x91459f++){_0x43bc78[_0xb590('0x70')](_0xb590('0x71')+_0x430a84[_0x91459f]['id'],'customField_'+_0x430a84[_0x91459f][_0xb590('0x72')]);}for(var _0x91459f=0x0;_0x91459f<_0x3a1e55[_0xb590('0x44')];_0x91459f++){_0x43bc78['field'](squel['select']()['field']('item')[_0xb590('0x73')](_0xb590('0x74'))['where'](_0xb590('0x75'),_0x3a1e55[_0x91459f]['id'])[_0xb590('0x39')](_0xb590('0x76')),_0xb590('0x77')+_0x3a1e55[_0x91459f][_0xb590('0x27')]);_0x43bc78[_0xb590('0x70')](squel['select']()[_0xb590('0x70')](_0xb590('0x78'))[_0xb590('0x73')](_0xb590('0x74'))[_0xb590('0x39')](_0xb590('0x75'),_0x3a1e55[_0x91459f]['id'])[_0xb590('0x39')](_0xb590('0x76')),_0xb590('0x79')+_0x3a1e55[_0x91459f][_0xb590('0x27')]);}var _0x9dfad7=[];_0x9dfad7[_0xb590('0x5e')](_0x43bc78[_0xb590('0x7a')]());BPromise['each'](_0x9dfad7,handleQuery)[_0xb590('0x23')](function(_0x25443b){handleQuery(_0x43bc78['toString']());var _0x1d0eda=csv_results[0x0];if(!_[_0xb590('0x7b')](_0x1d0eda)){var _0x59010f=toCsv(_0x1d0eda);var _0x5e2ad0=Date[_0xb590('0x7c')]();fs[_0xb590('0x7d')](util[_0xb590('0x69')]('/tmp/list_%d_%s.csv',_0x5b03b4,_0x5e2ad0),_0x59010f);_0x4e8b9c['setHeader']('Content-disposition',_0xb590('0x7e')+util['format'](_0xb590('0x7f'),_0x5b03b4,_0x5e2ad0));_0x4e8b9c[_0xb590('0x80')](_0xb590('0x81'),_0xb590('0x82'));return _0x4e8b9c[_0xb590('0x83')](util[_0xb590('0x69')]('/tmp/list_%d_%s.csv',_0x5b03b4,_0x5e2ad0));}else{return _0x4e8b9c[_0xb590('0x18')](0xcc);}});});});};exports['addCustomField']=function(_0x2cd65c,_0x316b54,_0x4da281){var _0x7475ff;delete _0x2cd65c[_0xb590('0x4e')]['id'];return db['CmList']['findOne']({'where':{'id':_0x2cd65c[_0xb590('0x43')]['id']}})[_0xb590('0x23')](handleEntityNotFound(_0x316b54,null))[_0xb590('0x23')](function(_0x271f1b){if(_0x271f1b){return db[_0xb590('0x84')]['transaction'](function(_0x4e90bf){return db[_0xb590('0x66')][_0xb590('0x45')](_0x2cd65c[_0xb590('0x4e')],{'transaction':_0x4e90bf})[_0xb590('0x23')](function(_0x2e9e50){_0x7475ff=_0x2e9e50;return _0x271f1b['addCustomFields'](_0x2e9e50,{'transaction':_0x4e90bf});})[_0xb590('0x23')](function(){var _0x1ac895={'type':db['Sequelize']['TEXT'],'transaction':_0x4e90bf};switch(_0x2cd65c['body'][_0xb590('0x2e')]){case _0xb590('0x85'):_0x1ac895[_0xb590('0x2e')]=db[_0xb590('0x86')]['TEXT'];break;case _0xb590('0x87'):_0x1ac895[_0xb590('0x2e')]=db['Sequelize'][_0xb590('0x88')];break;case _0xb590('0x89'):_0x1ac895[_0xb590('0x2e')]=db['Sequelize']['BOOLEAN'];_0x1ac895[_0xb590('0x8a')]=![];break;default:}return db['sequelize'][_0xb590('0x8b')]['addColumn'](_0xb590('0x6d'),util[_0xb590('0x69')](_0xb590('0x8c'),_0x7475ff['id']),_0x1ac895);})[_0xb590('0x23')](function(){return _0x7475ff;});});}})['then'](respondWithResult(_0x316b54,null))[_0xb590('0x42')](handleError(_0x316b54,null));};exports[_0xb590('0x8d')]=function(_0x2cd514,_0x15263f,_0x44a956){var _0x4263ce={};var _0x28830f={};var _0x174886;var _0x32b718;return db[_0xb590('0x2b')][_0xb590('0x53')]({'where':{'id':_0x2cd514['params']['id']}})[_0xb590('0x23')](handleEntityNotFound(_0x15263f,null))[_0xb590('0x23')](function(_0x4e1c8b){if(_0x4e1c8b){_0x174886=_0x4e1c8b;_0x28830f[_0xb590('0x33')]=_[_0xb590('0x30')](db['CmCustomField'][_0xb590('0x2c')]);_0x28830f[_0xb590('0x34')]=_['keys'](_0x2cd514['query']);_0x28830f['filters']=_[_0xb590('0x32')](_0x28830f[_0xb590('0x33')],_0x28830f[_0xb590('0x34')]);_0x4263ce[_0xb590('0x35')]=_[_0xb590('0x32')](_0x28830f[_0xb590('0x33')],qs[_0xb590('0x36')](_0x2cd514[_0xb590('0x34')][_0xb590('0x36')]));_0x4263ce[_0xb590('0x35')]=_0x4263ce['attributes'][_0xb590('0x44')]?_0x4263ce[_0xb590('0x35')]:_0x28830f[_0xb590('0x33')];_0x4263ce[_0xb590('0x55')]=qs[_0xb590('0x56')](_0x2cd514[_0xb590('0x34')][_0xb590('0x56')]);_0x4263ce[_0xb590('0x39')]=qs['filters'](_[_0xb590('0x57')](_0x2cd514[_0xb590('0x34')],_0x28830f[_0xb590('0x31')]));_0x4263ce['where']=_[_0xb590('0x3b')](_0x4263ce[_0xb590('0x39')],{'$or':[{'ListId':_0x4e1c8b['id']},{'ListId':null}]});if(_0x2cd514[_0xb590('0x34')][_0xb590('0x3a')]){_0x4263ce[_0xb590('0x39')]=_[_0xb590('0x3b')](_0x4263ce[_0xb590('0x39')],{'$or':_[_0xb590('0x2a')](_0x4263ce['attributes'],function(_0x35899e){var _0x41d51c={};_0x41d51c[_0x35899e]={'$like':'%'+_0x2cd514['query'][_0xb590('0x3a')]+'%'};return _0x41d51c;})});}_0x4263ce=_[_0xb590('0x3b')]({},_0x4263ce,_0x2cd514['options']);return db['CmCustomField']['findAndCountAll'](_0x4263ce);}})[_0xb590('0x23')](respondWithResult(_0x15263f,null))['catch'](handleError(_0x15263f,null));};exports['getGlobalCustomFields']=function(_0x5e8cd2,_0x18e226){return db[_0xb590('0x66')][_0xb590('0x8e')]({'where':{'ListId':null}})[_0xb590('0x23')](handleEntityNotFound(_0x18e226,null))['then'](function(_0x47fcde){return _0x47fcde;})['then'](respondWithResult(_0x18e226,null))[_0xb590('0x42')](handleError(_0x18e226,null));};exports[_0xb590('0x8f')]=function(_0x90e4ad,_0x44272b,_0x4c2362){return db[_0xb590('0x2b')]['find']({'where':{'id':_0x90e4ad['params']['id']}})[_0xb590('0x23')](handleEntityNotFound(_0x44272b,null))[_0xb590('0x23')](function(_0x46d1c7){if(_0x46d1c7){return _0x46d1c7['addAgents'](_0x90e4ad[_0xb590('0x4e')]['ids'],_[_0xb590('0x5f')](_0x90e4ad[_0xb590('0x4e')],['ids','id'])||{})[_0xb590('0x90')](function(_0x39dac2){for(var _0x145562=0x0;_0x145562<_0x90e4ad[_0xb590('0x4e')][_0xb590('0x91')][_0xb590('0x44')];_0x145562+=0x1){socket['emit'](_0xb590('0x92'),{'UserId':Number(_0x90e4ad['body']['ids'][_0x145562]),'CmListId':Number(_0x90e4ad['params']['id'])});}return _0x39dac2;});}})[_0xb590('0x23')](respondWithResult(_0x44272b,null))['catch'](handleError(_0x44272b,null));};exports[_0xb590('0x93')]=function(_0x20ca4a,_0x11d405,_0x47a034){return db['CmList']['find']({'where':{'id':_0x20ca4a[_0xb590('0x43')]['id']}})[_0xb590('0x23')](handleEntityNotFound(_0x11d405,null))[_0xb590('0x23')](function(_0x35be7d){if(_0x35be7d){return _0x35be7d[_0xb590('0x93')](_0x20ca4a[_0xb590('0x34')][_0xb590('0x91')])[_0xb590('0x23')](function(){if(_['isArray'](_0x20ca4a[_0xb590('0x34')]['ids'])){for(var _0x3d4f85=0x0;_0x3d4f85<_0x20ca4a[_0xb590('0x34')][_0xb590('0x91')]['length'];_0x3d4f85+=0x1){socket['emit'](_0xb590('0x94'),{'UserId':Number(_0x20ca4a[_0xb590('0x34')][_0xb590('0x91')][_0x3d4f85]),'CmListId':Number(_0x20ca4a['params']['id'])});}}else{socket[_0xb590('0x95')]('userCmList:remove',{'UserId':Number(_0x20ca4a['query'][_0xb590('0x91')]),'CmListId':Number(_0x20ca4a[_0xb590('0x43')]['id'])});}});}})['then'](respondWithStatusCode(_0x11d405,null))[_0xb590('0x42')](handleError(_0x11d405,null));};exports['getAgents']=function(_0x4d7496,_0xfb5e52,_0x61924e){var _0x3e5786={};var _0x1d958c={};var _0x59bb98;var _0x19d962;return db['CmList'][_0xb590('0x53')]({'where':{'id':_0x4d7496[_0xb590('0x43')]['id']}})[_0xb590('0x23')](handleEntityNotFound(_0xfb5e52,null))['then'](function(_0x3c914c){if(_0x3c914c){_0x59bb98=_0x3c914c;_0x1d958c[_0xb590('0x33')]=_[_0xb590('0x30')](db[_0xb590('0x96')][_0xb590('0x2c')]);_0x1d958c[_0xb590('0x34')]=_[_0xb590('0x30')](_0x4d7496[_0xb590('0x34')]);_0x1d958c[_0xb590('0x31')]=_['intersection'](_0x1d958c[_0xb590('0x33')],_0x1d958c['query']);_0x3e5786[_0xb590('0x35')]=_['intersection'](_0x1d958c[_0xb590('0x33')],qs[_0xb590('0x36')](_0x4d7496['query'][_0xb590('0x36')]));_0x3e5786[_0xb590('0x35')]=_0x3e5786[_0xb590('0x35')][_0xb590('0x44')]?_0x3e5786[_0xb590('0x35')]:_0x1d958c[_0xb590('0x33')];_0x3e5786[_0xb590('0x55')]=qs['sort'](_0x4d7496[_0xb590('0x34')][_0xb590('0x56')]);_0x3e5786[_0xb590('0x39')]=qs['filters'](_[_0xb590('0x57')](_0x4d7496[_0xb590('0x34')],_0x1d958c[_0xb590('0x31')]));if(_0x4d7496[_0xb590('0x34')][_0xb590('0x3a')]){_0x3e5786[_0xb590('0x39')]=_['merge'](_0x3e5786[_0xb590('0x39')],{'$or':_['map'](_0x3e5786[_0xb590('0x35')],function(_0x2c4cb7){var _0x62f343={};_0x62f343[_0x2c4cb7]={'$like':'%'+_0x4d7496[_0xb590('0x34')][_0xb590('0x3a')]+'%'};return _0x62f343;})});}_0x3e5786=_[_0xb590('0x3b')]({},_0x3e5786,_0x4d7496['options']);return _0x59bb98['getAgents'](_0x3e5786);}})['then'](function(_0x460707){if(_0x460707){_0x19d962=_0x460707['length'];if(!_0x4d7496['query'][_0xb590('0x54')]('nolimit')){_0x3e5786[_0xb590('0x38')]=qs[_0xb590('0x38')](_0x4d7496[_0xb590('0x34')][_0xb590('0x38')]);_0x3e5786['offset']=qs['offset'](_0x4d7496[_0xb590('0x34')][_0xb590('0x1c')]);}return _0x59bb98[_0xb590('0x97')](_0x3e5786);}})['then'](function(_0xefca5f){if(_0xefca5f){return _0xefca5f?{'count':_0x19d962,'rows':_0xefca5f}:null;}})[_0xb590('0x23')](respondWithResult(_0xfb5e52,null))['catch'](handleError(_0xfb5e52,null));};function handleQuery(_0x55d26b){logger[_0xb590('0x98')](_0x55d26b);return db['sequelize'][_0xb590('0x34')](_0x55d26b)[_0xb590('0x90')](function(_0x547e8b){csv_results[_0xb590('0x5e')](_0x547e8b);})[_0xb590('0x42')](function(_0x32b3ec){logger[_0xb590('0x25')](_0x32b3ec['message']);});} \ No newline at end of file +var _0x51cb=['getGlobalCustomFields','findAndCountAll','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','User','getAgents','info','eml-format','rimraf','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','defaults','socket.io-emitter','redis','./cmList.socket','status','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','then','get','Lists','UserProfileResource','end','sendStatus','error','stack','name','send','index','map','CmList','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','filter','merge','options','include','findAll','show','params','find','catch','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ListId','Disposition','hasOwnProperty','pick','includeAll','removeDispositions','ids','addContacts','tags','join','isArray','each','omit','success','push','dataValues','Malformed\x20request\x20syntax','getContacts','CmCustomField','CmContact','concat','CustomFields','format','raw','getContactsCsv','OrderBy','alias','select','cm_contacts','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','distinct','field','c.cf_','customField_','item','from','cm_contact_has_items','CmContactId\x20=\x20c.id','additionalPhone_','description','ItemTypeId\x20=\x20?','description_additionalPhone_','toString','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Content-type','text/csv','download','addCustomField','findOne','sequelize','addCustomFields','Sequelize','TEXT','text','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cf_%s','getCustomFields'];(function(_0x1e58c9,_0x43075e){var _0x22dc89=function(_0x48179d){while(--_0x48179d){_0x1e58c9['push'](_0x1e58c9['shift']());}};_0x22dc89(++_0x43075e);}(_0x51cb,0x159));var _0xb51c=function(_0x5073dd,_0x54a03a){_0x5073dd=_0x5073dd-0x0;var _0x53b35f=_0x51cb[_0x5073dd];return _0x53b35f;};'use strict';var emlformat=require(_0xb51c('0x0'));var rimraf=require(_0xb51c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb51c('0x2'));var moment=require('moment');var BPromise=require(_0xb51c('0x3'));var Mustache=require(_0xb51c('0x4'));var util=require('util');var path=require(_0xb51c('0x5'));var sox=require(_0xb51c('0x6'));var csv=require(_0xb51c('0x7'));var ejs=require(_0xb51c('0x8'));var fs=require('fs');var fs_extra=require(_0xb51c('0x9'));var _=require(_0xb51c('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xb51c('0xb'));var deskjs=require(_0xb51c('0xc'));var toCsv=require(_0xb51c('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb51c('0xd'));var authService=require(_0xb51c('0xe'));var qs=require(_0xb51c('0xf'));var as=require(_0xb51c('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb51c('0x11'))(_0xb51c('0x12'));var utils=require(_0xb51c('0x13'));var config=require(_0xb51c('0x14'));var licenseUtil=require(_0xb51c('0x15'));var db=require('../../mysqldb')['db'];var csv_results;config['redis']=_[_0xb51c('0x16')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xb51c('0x17'))(new Redis(config[_0xb51c('0x18')]));require(_0xb51c('0x19'))['register'](socket);function respondWithStatusCode(_0x5db8f5,_0xc0a634){_0xc0a634=_0xc0a634||0xcc;return function(_0x43bcac){if(_0x43bcac){return _0x5db8f5['sendStatus'](_0xc0a634);}return _0x5db8f5['status'](_0xc0a634)['end']();};}function respondWithResult(_0x2a2c99,_0x8c9865){_0x8c9865=_0x8c9865||0xc8;return function(_0x1e72d9){if(_0x1e72d9){return _0x2a2c99[_0xb51c('0x1a')](_0x8c9865)[_0xb51c('0x1b')](_0x1e72d9);}};}function respondWithFilteredResult(_0x872d54,_0x351129){return function(_0x410f9b){if(_0x410f9b){var _0x3aad88=typeof _0x351129[_0xb51c('0x1c')]===_0xb51c('0x1d')&&typeof _0x351129[_0xb51c('0x1e')]===_0xb51c('0x1d');var _0x2d4402=_0x410f9b['count'];var _0x108ab5=_0x3aad88?0x0:_0x351129['offset'];var _0x2588bf=_0x3aad88?_0x410f9b[_0xb51c('0x1f')]:_0x351129[_0xb51c('0x1c')]+_0x351129[_0xb51c('0x1e')];var _0x2c809c;if(_0x2588bf>=_0x2d4402){_0x2588bf=_0x2d4402;_0x2c809c=0xc8;}else{_0x2c809c=0xce;}_0x872d54[_0xb51c('0x1a')](_0x2c809c);return _0x872d54[_0xb51c('0x20')]('Content-Range',_0x108ab5+'-'+_0x2588bf+'/'+_0x2d4402)['json'](_0x410f9b);}return null;};}function patchUpdates(_0x331cc0){return function(_0x596928){try{jsonpatch[_0xb51c('0x21')](_0x596928,_0x331cc0,!![]);}catch(_0x5dea5c){return BPromise[_0xb51c('0x22')](_0x5dea5c);}return _0x596928[_0xb51c('0x23')]();};}function saveUpdates(_0xf0c5ee,_0x211ff2){return function(_0x1ff723){if(_0x1ff723){return _0x1ff723[_0xb51c('0x24')](_0xf0c5ee)['then'](function(_0x2b221e){return _0x2b221e;});}return null;};}function removeEntity(_0x579751,_0x1027e2){return function(_0x1a2880){if(_0x1a2880){return _0x1a2880[_0xb51c('0x25')]()[_0xb51c('0x26')](function(){var _0x384103=_0x1a2880[_0xb51c('0x27')]({'plain':!![]});var _0x48d35e=_0xb51c('0x28');return db[_0xb51c('0x29')]['destroy']({'where':{'type':_0x48d35e,'resourceId':_0x384103['id']}})[_0xb51c('0x26')](function(){return _0x1a2880;});})['then'](function(){_0x579751[_0xb51c('0x1a')](0xcc)[_0xb51c('0x2a')]();});}};}function handleEntityNotFound(_0x4eb1ed,_0x578946){return function(_0x3e2677){if(!_0x3e2677){_0x4eb1ed[_0xb51c('0x2b')](0x194);}return _0x3e2677;};}function handleError(_0x5d60ab,_0x28bb09){_0x28bb09=_0x28bb09||0x1f4;return function(_0x2e692e){logger[_0xb51c('0x2c')](_0x2e692e[_0xb51c('0x2d')]);if(_0x2e692e[_0xb51c('0x2e')]){delete _0x2e692e[_0xb51c('0x2e')];}_0x5d60ab[_0xb51c('0x1a')](_0x28bb09)[_0xb51c('0x2f')](_0x2e692e);};}exports[_0xb51c('0x30')]=function(_0x4151ae,_0x51f5c9){var _0x324d14={},_0x366100={},_0x1b3175={'count':0x0,'rows':[]};var _0xee3728=_[_0xb51c('0x31')](db[_0xb51c('0x32')][_0xb51c('0x33')],function(_0x369b9f){return{'name':_0x369b9f[_0xb51c('0x34')],'type':_0x369b9f[_0xb51c('0x35')][_0xb51c('0x36')]};});_0x366100['model']=_[_0xb51c('0x31')](_0xee3728,_0xb51c('0x2e'));_0x366100[_0xb51c('0x37')]=_[_0xb51c('0x38')](_0x4151ae[_0xb51c('0x37')]);_0x366100[_0xb51c('0x39')]=_[_0xb51c('0x3a')](_0x366100[_0xb51c('0x3b')],_0x366100['query']);_0x324d14['attributes']=_[_0xb51c('0x3a')](_0x366100[_0xb51c('0x3b')],qs[_0xb51c('0x3c')](_0x4151ae[_0xb51c('0x37')][_0xb51c('0x3c')]));_0x324d14[_0xb51c('0x3d')]=_0x324d14[_0xb51c('0x3d')][_0xb51c('0x3e')]?_0x324d14[_0xb51c('0x3d')]:_0x366100[_0xb51c('0x3b')];if(!_0x4151ae[_0xb51c('0x37')]['hasOwnProperty'](_0xb51c('0x3f'))){_0x324d14[_0xb51c('0x1e')]=qs[_0xb51c('0x1e')](_0x4151ae[_0xb51c('0x37')][_0xb51c('0x1e')]);_0x324d14['offset']=qs[_0xb51c('0x1c')](_0x4151ae['query'][_0xb51c('0x1c')]);}_0x324d14[_0xb51c('0x40')]=qs[_0xb51c('0x41')](_0x4151ae[_0xb51c('0x37')][_0xb51c('0x41')]);_0x324d14[_0xb51c('0x42')]=qs['filters'](_['pick'](_0x4151ae[_0xb51c('0x37')],_0x366100[_0xb51c('0x39')]),_0xee3728);if(_0x4151ae['query'][_0xb51c('0x43')]){_0x324d14[_0xb51c('0x42')]=_[_0xb51c('0x44')](_0x324d14['where'],{'$or':_[_0xb51c('0x31')](_0xee3728,function(_0x2839ba){if(_0x2839ba['type']!=='VIRTUAL'){var _0x4f8177={};_0x4f8177[_0x2839ba[_0xb51c('0x2e')]]={'$like':'%'+_0x4151ae[_0xb51c('0x37')][_0xb51c('0x43')]+'%'};return _0x4f8177;}})});}_0x324d14=_[_0xb51c('0x44')]({},_0x324d14,_0x4151ae[_0xb51c('0x45')]);var _0x1fb098={'where':_0x324d14[_0xb51c('0x42')]};return db[_0xb51c('0x32')][_0xb51c('0x1f')](_0x1fb098)[_0xb51c('0x26')](function(_0x1f9681){_0x1b3175['count']=_0x1f9681;if(_0x4151ae[_0xb51c('0x37')]['includeAll']){_0x324d14[_0xb51c('0x46')]=[{'all':!![]}];}return db[_0xb51c('0x32')][_0xb51c('0x47')](_0x324d14);})[_0xb51c('0x26')](function(_0x10b0e1){_0x1b3175['rows']=_0x10b0e1;return _0x1b3175;})['then'](respondWithFilteredResult(_0x51f5c9,_0x324d14))['catch'](handleError(_0x51f5c9,null));};exports[_0xb51c('0x48')]=function(_0x202cbc,_0xa85f0f){var _0x1fa5ba={'raw':![],'where':{'id':_0x202cbc[_0xb51c('0x49')]['id']}},_0x50346e={};_0x50346e[_0xb51c('0x3b')]=_[_0xb51c('0x38')](db['CmList'][_0xb51c('0x33')]);_0x50346e[_0xb51c('0x37')]=_[_0xb51c('0x38')](_0x202cbc[_0xb51c('0x37')]);_0x50346e['filters']=_['intersection'](_0x50346e['model'],_0x50346e['query']);_0x1fa5ba['attributes']=_[_0xb51c('0x3a')](_0x50346e[_0xb51c('0x3b')],qs['fields'](_0x202cbc[_0xb51c('0x37')][_0xb51c('0x3c')]));_0x1fa5ba[_0xb51c('0x3d')]=_0x1fa5ba[_0xb51c('0x3d')][_0xb51c('0x3e')]?_0x1fa5ba['attributes']:_0x50346e['model'];if(_0x202cbc['query']['includeAll']){_0x1fa5ba[_0xb51c('0x46')]=[{'all':!![]}];}_0x1fa5ba=_[_0xb51c('0x44')]({},_0x1fa5ba,_0x202cbc[_0xb51c('0x45')]);return db[_0xb51c('0x32')][_0xb51c('0x4a')](_0x1fa5ba)['then'](handleEntityNotFound(_0xa85f0f,null))[_0xb51c('0x26')](respondWithResult(_0xa85f0f,null))[_0xb51c('0x4b')](handleError(_0xa85f0f,null));};exports[_0xb51c('0x4c')]=function(_0x58c382,_0x51e57c){return db[_0xb51c('0x32')][_0xb51c('0x4c')](_0x58c382[_0xb51c('0x4d')],{})[_0xb51c('0x26')](function(_0x38f690){var _0x159cc1=_0x58c382[_0xb51c('0x4e')]['get']({'plain':!![]});if(!_0x159cc1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x159cc1[_0xb51c('0x4f')]===_0xb51c('0x4e')){var _0x5ca17b=_0x38f690['get']({'plain':!![]});var _0x5482ae=_0xb51c('0x28');return db[_0xb51c('0x50')][_0xb51c('0x4a')]({'where':{'name':_0x5482ae,'userProfileId':_0x159cc1[_0xb51c('0x51')]},'raw':!![]})[_0xb51c('0x26')](function(_0x2b1c85){if(_0x2b1c85&&_0x2b1c85[_0xb51c('0x52')]===0x0){return db['UserProfileResource'][_0xb51c('0x4c')]({'name':_0x5ca17b['name'],'resourceId':_0x5ca17b['id'],'type':_0x2b1c85[_0xb51c('0x2e')],'sectionId':_0x2b1c85['id']},{})['then'](function(){return _0x38f690;});}else{return _0x38f690;}})[_0xb51c('0x4b')](function(_0x3a1b23){logger[_0xb51c('0x2c')](_0xb51c('0x53'),_0x3a1b23);throw _0x3a1b23;});}return _0x38f690;})['then'](respondWithResult(_0x51e57c,0xc9))['catch'](handleError(_0x51e57c,null));};exports[_0xb51c('0x24')]=function(_0x17817a,_0x244109){if(_0x17817a[_0xb51c('0x4d')]['id']){delete _0x17817a['body']['id'];}return db[_0xb51c('0x32')][_0xb51c('0x4a')]({'where':{'id':_0x17817a[_0xb51c('0x49')]['id']}})[_0xb51c('0x26')](handleEntityNotFound(_0x244109,null))['then'](saveUpdates(_0x17817a[_0xb51c('0x4d')],null))[_0xb51c('0x26')](respondWithResult(_0x244109,null))[_0xb51c('0x4b')](handleError(_0x244109,null));};exports[_0xb51c('0x25')]=function(_0x26aa8d,_0x37ae97){return db[_0xb51c('0x32')][_0xb51c('0x4a')]({'where':{'id':_0x26aa8d['params']['id']}})[_0xb51c('0x26')](handleEntityNotFound(_0x37ae97,null))[_0xb51c('0x26')](removeEntity(_0x37ae97,null))[_0xb51c('0x4b')](handleError(_0x37ae97,null));};exports[_0xb51c('0x54')]=function(_0x55a579,_0x972c02){return db[_0xb51c('0x32')][_0xb51c('0x54')]()['then'](respondWithResult(_0x972c02,null))[_0xb51c('0x4b')](handleError(_0x972c02,null));};exports[_0xb51c('0x55')]=function(_0x169421,_0x4ea0eb,_0x2d4e2d){if(_0x169421[_0xb51c('0x4d')]['id']){delete _0x169421[_0xb51c('0x4d')]['id'];}return db['CmList'][_0xb51c('0x4a')]({'where':{'id':_0x169421[_0xb51c('0x49')]['id']}})[_0xb51c('0x26')](handleEntityNotFound(_0x4ea0eb,null))[_0xb51c('0x26')](function(_0x4fceac){if(_0x4fceac){_0x169421['body'][_0xb51c('0x56')]=_0x4fceac['id'];return db[_0xb51c('0x57')][_0xb51c('0x4c')](_0x169421[_0xb51c('0x4d')]);}})[_0xb51c('0x26')](respondWithResult(_0x4ea0eb,null))[_0xb51c('0x4b')](handleError(_0x4ea0eb,null));};exports['getDispositions']=function(_0x4f7a48,_0xb21d43,_0x4844fd){var _0x117fc3={'raw':![],'where':{}};var _0xd1d103={};var _0x12d61c={'count':0x0,'rows':[]};return db[_0xb51c('0x32')]['findOne']({'where':{'id':_0x4f7a48[_0xb51c('0x49')]['id']}})[_0xb51c('0x26')](handleEntityNotFound(_0xb21d43,null))[_0xb51c('0x26')](function(_0x50559d){if(_0x50559d){_0xd1d103[_0xb51c('0x3b')]=_['keys'](db['Disposition'][_0xb51c('0x33')]);_0xd1d103[_0xb51c('0x37')]=_['keys'](_0x4f7a48[_0xb51c('0x37')]);_0xd1d103[_0xb51c('0x39')]=_[_0xb51c('0x3a')](_0xd1d103[_0xb51c('0x3b')],_0xd1d103[_0xb51c('0x37')]);_0x117fc3[_0xb51c('0x3d')]=_['intersection'](_0xd1d103['model'],qs[_0xb51c('0x3c')](_0x4f7a48['query'][_0xb51c('0x3c')]));_0x117fc3[_0xb51c('0x3d')]=_0x117fc3[_0xb51c('0x3d')][_0xb51c('0x3e')]?_0x117fc3['attributes']:_0xd1d103[_0xb51c('0x3b')];if(!_0x4f7a48[_0xb51c('0x37')][_0xb51c('0x58')]('nolimit')){_0x117fc3[_0xb51c('0x1e')]=qs[_0xb51c('0x1e')](_0x4f7a48[_0xb51c('0x37')]['limit']);_0x117fc3['offset']=qs['offset'](_0x4f7a48[_0xb51c('0x37')][_0xb51c('0x1c')]);}_0x117fc3[_0xb51c('0x40')]=qs[_0xb51c('0x41')](_0x4f7a48[_0xb51c('0x37')]['sort']);_0x117fc3['where']=qs[_0xb51c('0x39')](_[_0xb51c('0x59')](_0x4f7a48[_0xb51c('0x37')],_0xd1d103[_0xb51c('0x39')]));_0x117fc3[_0xb51c('0x42')][_0xb51c('0x56')]=_0x50559d['id'];if(_0x4f7a48[_0xb51c('0x37')]['filter']){_0x117fc3[_0xb51c('0x42')]=_[_0xb51c('0x44')](_0x117fc3['where'],{'$or':_[_0xb51c('0x31')](_0x117fc3[_0xb51c('0x3d')],function(_0x54254f){var _0x5a3f0a={};_0x5a3f0a[_0x54254f]={'$like':'%'+_0x4f7a48[_0xb51c('0x37')][_0xb51c('0x43')]+'%'};return _0x5a3f0a;})});}_0x117fc3=_[_0xb51c('0x44')]({},_0x117fc3,_0x4f7a48[_0xb51c('0x45')]);return db[_0xb51c('0x57')]['count']({'where':_0x117fc3[_0xb51c('0x42')]})[_0xb51c('0x26')](function(_0xf62983){_0x12d61c['count']=_0xf62983;if(_0x4f7a48[_0xb51c('0x37')][_0xb51c('0x5a')]){_0x117fc3[_0xb51c('0x46')]=[{'all':!![]}];}return db[_0xb51c('0x57')][_0xb51c('0x47')](_0x117fc3);})['then'](function(_0xd576e8){_0x12d61c['rows']=_0xd576e8;return _0x12d61c;});}})[_0xb51c('0x26')](respondWithFilteredResult(_0xb21d43,_0x117fc3))[_0xb51c('0x4b')](handleError(_0xb21d43,null));};exports[_0xb51c('0x5b')]=function(_0x48c821,_0x4447fe,_0x593c31){return db['CmList']['find']({'where':{'id':_0x48c821[_0xb51c('0x49')]['id']}})[_0xb51c('0x26')](handleEntityNotFound(_0x4447fe,null))[_0xb51c('0x26')](function(_0x4b566b){if(_0x4b566b){return _0x4b566b['removeDispositions'](_0x48c821['query'][_0xb51c('0x5c')]);}})[_0xb51c('0x26')](respondWithStatusCode(_0x4447fe,null))[_0xb51c('0x4b')](handleError(_0x4447fe,null));};exports[_0xb51c('0x5d')]=function(_0x3d6aa6,_0x3e7dbb,_0x4ed97a){return db[_0xb51c('0x32')][_0xb51c('0x4a')]({'where':{'id':_0x3d6aa6[_0xb51c('0x49')]['id']}})[_0xb51c('0x26')](handleEntityNotFound(_0x3e7dbb,null))[_0xb51c('0x26')](function(_0x3047d0){if(_0x3047d0){var _0x26f9c6=[];var _0x231a53={'success':[],'errors':[]};return db['CmContact'][_0xb51c('0x54')]()[_0xb51c('0x26')](function(_0x4bff4f){if(_0x3d6aa6[_0xb51c('0x4d')][_0xb51c('0x5e')]&&_['isArray'](_0x3d6aa6['body'][_0xb51c('0x5e')])){if(_0x3d6aa6[_0xb51c('0x4d')][_0xb51c('0x5e')][_0xb51c('0x3e')]){_0x3d6aa6[_0xb51c('0x4d')]['tags']=_0x3d6aa6[_0xb51c('0x4d')][_0xb51c('0x5e')][_0xb51c('0x5f')](';')+';';}else{_0x3d6aa6[_0xb51c('0x4d')]['tags']=null;}}else{_0x3d6aa6['body'][_0xb51c('0x5e')]=null;}if(_0x3d6aa6[_0xb51c('0x4d')]&&_[_0xb51c('0x60')](_0x3d6aa6[_0xb51c('0x4d')])){for(var _0x23076b=0x0;_0x23076b<_0x3d6aa6[_0xb51c('0x4d')]['length'];_0x23076b+=0x1){_0x3d6aa6[_0xb51c('0x4d')][_0x23076b][_0xb51c('0x56')]=_0x3d6aa6[_0xb51c('0x49')]['id'];_0x26f9c6['push'](_0x3d6aa6[_0xb51c('0x4d')][_0x23076b]);}return BPromise[_0xb51c('0x61')](_0x26f9c6,function(_0x78baea){return db['CmContact'][_0xb51c('0x4c')](_[_0xb51c('0x62')](_0x78baea,[_0xb51c('0x5c'),'id'])||{},{'fields':_[_0xb51c('0x38')](_0x4bff4f),'raw':!![]})[_0xb51c('0x26')](function(_0x6b5c55){_0x231a53[_0xb51c('0x63')][_0xb51c('0x64')](_0x6b5c55[_0xb51c('0x65')]);})['catch'](function(_0x527bfc){_0x231a53['errors'][_0xb51c('0x64')]({'data':_0x78baea,'error':_0x527bfc['message']});});})[_0xb51c('0x26')](function(_0x337d86){return _0x231a53;})[_0xb51c('0x4b')](function(_0x381fcd){return _0x381fcd;});}else{_0x3e7dbb[_0xb51c('0x1a')](0x190)[_0xb51c('0x1b')]({'message':_0xb51c('0x66')});}});}})[_0xb51c('0x26')](respondWithResult(_0x3e7dbb,null))[_0xb51c('0x4b')](handleError(_0x3e7dbb,null));};exports[_0xb51c('0x67')]=function(_0x34304b,_0xcf61ad,_0x209d15){var _0xbfffda;return db['CmList'][_0xb51c('0x4a')]({'where':{'id':_0x34304b[_0xb51c('0x49')]['id']},'include':[{'model':db[_0xb51c('0x68')],'as':'CustomFields'}]})[_0xb51c('0x26')](handleEntityNotFound(_0xcf61ad,null))['then'](function(_0x3e6479){if(_0x3e6479){_0xbfffda=_0x3e6479;return db[_0xb51c('0x69')][_0xb51c('0x33')];}})['then'](function(_0x2f4418){if(_0x2f4418){var _0x35ceab={};var _0x1d155c={};_0x1d155c[_0xb51c('0x3b')]=_[_0xb51c('0x6a')](_[_0xb51c('0x38')](_0x2f4418),_[_0xb51c('0x31')](_0xbfffda[_0xb51c('0x6b')],function(_0x652e7a){return util[_0xb51c('0x6c')]('cf_%d',_0x652e7a['id']);}));_0x1d155c[_0xb51c('0x37')]=_[_0xb51c('0x38')](_0x34304b['query']);_0x1d155c[_0xb51c('0x39')]=_['intersection'](_0x1d155c['model'],_0x1d155c[_0xb51c('0x37')]);_0x35ceab[_0xb51c('0x3d')]=_['intersection'](_0x1d155c[_0xb51c('0x3b')],qs[_0xb51c('0x3c')](_0x34304b[_0xb51c('0x37')]['fields']));_0x35ceab[_0xb51c('0x3d')]=_0x35ceab[_0xb51c('0x3d')]['length']?_0x35ceab[_0xb51c('0x3d')]:_0x1d155c[_0xb51c('0x3b')];if(!_0x34304b[_0xb51c('0x37')][_0xb51c('0x58')](_0xb51c('0x3f'))){_0x35ceab[_0xb51c('0x1e')]=qs[_0xb51c('0x1e')](_0x34304b[_0xb51c('0x37')][_0xb51c('0x1e')]);_0x35ceab['offset']=qs[_0xb51c('0x1c')](_0x34304b[_0xb51c('0x37')]['offset']);}_0x35ceab[_0xb51c('0x40')]=qs['sort'](_0x34304b[_0xb51c('0x37')][_0xb51c('0x41')]);_0x35ceab[_0xb51c('0x42')]=qs['filters'](_[_0xb51c('0x59')](_0x34304b['query'],_0x1d155c[_0xb51c('0x39')]));_0x35ceab[_0xb51c('0x6d')]=!![];if(_0x34304b[_0xb51c('0x37')][_0xb51c('0x43')]){_0x35ceab[_0xb51c('0x42')]=_[_0xb51c('0x44')](_0x35ceab['where'],{'$or':_[_0xb51c('0x31')](_0x35ceab[_0xb51c('0x3d')],function(_0x2f71eb){var _0x475fc6={};_0x475fc6[_0x2f71eb]={'$like':'%'+_0x34304b['query'][_0xb51c('0x43')]+'%'};return _0x475fc6;})});}_0x35ceab=_['merge']({},_0x35ceab,_0x34304b[_0xb51c('0x45')]);return _0xbfffda[_0xb51c('0x67')](_0x35ceab);}})[_0xb51c('0x26')](respondWithResult(_0xcf61ad,null))[_0xb51c('0x4b')](handleError(_0xcf61ad,null));};exports[_0xb51c('0x6e')]=function(_0x555f35,_0x277bda,_0x1461e6){var _0x46fb76;var _0x8106c1;var _0x5257cc;var _0x56da43=_0x555f35[_0xb51c('0x49')]['id'];csv_results=[];return db['ContactItemType']['findAll']({'attributes':['id','name'],'raw':!![],'order':[_0xb51c('0x6f')]})[_0xb51c('0x26')](function(_0x39a4a7){_0x46fb76=_0x39a4a7;var _0x476e8b=_[_0xb51c('0x38')](db[_0xb51c('0x69')][_0xb51c('0x33')]);return db[_0xb51c('0x68')][_0xb51c('0x47')]({'raw':!![],'attributes':['id',_0xb51c('0x70')]})[_0xb51c('0x26')](function(_0x50d3cb){_0x8106c1=_0x50d3cb;var _0x1fd4ed=squel[_0xb51c('0x71')]()[_0xb51c('0x3c')](_0x476e8b)['from'](_0xb51c('0x72'),'c')['where'](_0xb51c('0x73'),_0x56da43)['where'](_0xb51c('0x74'))[_0xb51c('0x75')]();for(var _0x5d2925=0x0;_0x5d2925<_0x8106c1[_0xb51c('0x3e')];_0x5d2925++){_0x1fd4ed[_0xb51c('0x76')](_0xb51c('0x77')+_0x8106c1[_0x5d2925]['id'],_0xb51c('0x78')+_0x8106c1[_0x5d2925][_0xb51c('0x70')]);}for(var _0x5d2925=0x0;_0x5d2925<_0x46fb76['length'];_0x5d2925++){_0x1fd4ed[_0xb51c('0x76')](squel[_0xb51c('0x71')]()['field'](_0xb51c('0x79'))[_0xb51c('0x7a')](_0xb51c('0x7b'))[_0xb51c('0x42')]('ItemTypeId\x20=\x20?',_0x46fb76[_0x5d2925]['id'])[_0xb51c('0x42')](_0xb51c('0x7c')),_0xb51c('0x7d')+_0x46fb76[_0x5d2925][_0xb51c('0x2e')]);_0x1fd4ed[_0xb51c('0x76')](squel[_0xb51c('0x71')]()[_0xb51c('0x76')](_0xb51c('0x7e'))[_0xb51c('0x7a')](_0xb51c('0x7b'))['where'](_0xb51c('0x7f'),_0x46fb76[_0x5d2925]['id'])[_0xb51c('0x42')](_0xb51c('0x7c')),_0xb51c('0x80')+_0x46fb76[_0x5d2925][_0xb51c('0x2e')]);}var _0x2f1156=[];_0x2f1156['push'](_0x1fd4ed[_0xb51c('0x81')]());BPromise[_0xb51c('0x61')](_0x2f1156,handleQuery)[_0xb51c('0x26')](function(_0x4d0dea){handleQuery(_0x1fd4ed[_0xb51c('0x81')]());var _0x4d044b=csv_results[0x0];if(!_[_0xb51c('0x82')](_0x4d044b)){var _0x2b284a=toCsv(_0x4d044b);var _0xb544e7=Date[_0xb51c('0x83')]();fs[_0xb51c('0x84')](util[_0xb51c('0x6c')](_0xb51c('0x85'),_0x56da43,_0xb544e7),_0x2b284a);_0x277bda[_0xb51c('0x86')](_0xb51c('0x87'),_0xb51c('0x88')+util[_0xb51c('0x6c')]('list_%d_%s.csv',_0x56da43,_0xb544e7));_0x277bda['setHeader'](_0xb51c('0x89'),_0xb51c('0x8a'));return _0x277bda[_0xb51c('0x8b')](util[_0xb51c('0x6c')](_0xb51c('0x85'),_0x56da43,_0xb544e7));}else{return _0x277bda['sendStatus'](0xcc);}});});});};exports[_0xb51c('0x8c')]=function(_0x9559ff,_0x57bf4f,_0x3bd9a8){var _0x79c720;delete _0x9559ff[_0xb51c('0x4d')]['id'];return db['CmList'][_0xb51c('0x8d')]({'where':{'id':_0x9559ff[_0xb51c('0x49')]['id']}})[_0xb51c('0x26')](handleEntityNotFound(_0x57bf4f,null))[_0xb51c('0x26')](function(_0xee483c){if(_0xee483c){return db[_0xb51c('0x8e')]['transaction'](function(_0x5d678e){return db['CmCustomField']['create'](_0x9559ff[_0xb51c('0x4d')],{'transaction':_0x5d678e})[_0xb51c('0x26')](function(_0x43c5d6){_0x79c720=_0x43c5d6;return _0xee483c[_0xb51c('0x8f')](_0x43c5d6,{'transaction':_0x5d678e});})[_0xb51c('0x26')](function(){var _0x296b1b={'type':db[_0xb51c('0x90')][_0xb51c('0x91')],'transaction':_0x5d678e};switch(_0x9559ff[_0xb51c('0x4d')]['type']){case _0xb51c('0x92'):_0x296b1b[_0xb51c('0x35')]=db['Sequelize'][_0xb51c('0x91')];break;case _0xb51c('0x93'):_0x296b1b[_0xb51c('0x35')]=db[_0xb51c('0x90')][_0xb51c('0x94')];break;case _0xb51c('0x95'):_0x296b1b['type']=db['Sequelize'][_0xb51c('0x96')];_0x296b1b[_0xb51c('0x97')]=![];break;default:}return db['sequelize'][_0xb51c('0x98')][_0xb51c('0x99')](_0xb51c('0x72'),util['format'](_0xb51c('0x9a'),_0x79c720['id']),_0x296b1b);})['then'](function(){return _0x79c720;});});}})[_0xb51c('0x26')](respondWithResult(_0x57bf4f,null))[_0xb51c('0x4b')](handleError(_0x57bf4f,null));};exports[_0xb51c('0x9b')]=function(_0x258e1f,_0x35a174,_0x2985d0){var _0x16390f={};var _0x4a2c15={};var _0x4c8067;var _0x362793;return db[_0xb51c('0x32')][_0xb51c('0x8d')]({'where':{'id':_0x258e1f[_0xb51c('0x49')]['id']}})[_0xb51c('0x26')](handleEntityNotFound(_0x35a174,null))['then'](function(_0x5bcc2a){if(_0x5bcc2a){_0x4c8067=_0x5bcc2a;_0x4a2c15[_0xb51c('0x3b')]=_[_0xb51c('0x38')](db[_0xb51c('0x68')]['rawAttributes']);_0x4a2c15[_0xb51c('0x37')]=_[_0xb51c('0x38')](_0x258e1f[_0xb51c('0x37')]);_0x4a2c15[_0xb51c('0x39')]=_[_0xb51c('0x3a')](_0x4a2c15[_0xb51c('0x3b')],_0x4a2c15[_0xb51c('0x37')]);_0x16390f[_0xb51c('0x3d')]=_['intersection'](_0x4a2c15[_0xb51c('0x3b')],qs['fields'](_0x258e1f['query'][_0xb51c('0x3c')]));_0x16390f[_0xb51c('0x3d')]=_0x16390f[_0xb51c('0x3d')][_0xb51c('0x3e')]?_0x16390f['attributes']:_0x4a2c15[_0xb51c('0x3b')];_0x16390f[_0xb51c('0x40')]=qs[_0xb51c('0x41')](_0x258e1f[_0xb51c('0x37')][_0xb51c('0x41')]);_0x16390f['where']=qs[_0xb51c('0x39')](_[_0xb51c('0x59')](_0x258e1f[_0xb51c('0x37')],_0x4a2c15['filters']));_0x16390f[_0xb51c('0x42')]=_[_0xb51c('0x44')](_0x16390f[_0xb51c('0x42')],{'$or':[{'ListId':_0x5bcc2a['id']},{'ListId':null}]});if(_0x258e1f['query'][_0xb51c('0x43')]){_0x16390f[_0xb51c('0x42')]=_[_0xb51c('0x44')](_0x16390f[_0xb51c('0x42')],{'$or':_[_0xb51c('0x31')](_0x16390f[_0xb51c('0x3d')],function(_0xfd7ec3){var _0x3485be={};_0x3485be[_0xfd7ec3]={'$like':'%'+_0x258e1f[_0xb51c('0x37')]['filter']+'%'};return _0x3485be;})});}_0x16390f=_[_0xb51c('0x44')]({},_0x16390f,_0x258e1f[_0xb51c('0x45')]);return db[_0xb51c('0x68')]['findAndCountAll'](_0x16390f);}})[_0xb51c('0x26')](respondWithResult(_0x35a174,null))[_0xb51c('0x4b')](handleError(_0x35a174,null));};exports[_0xb51c('0x9c')]=function(_0x358909,_0x5f07e7){return db['CmCustomField'][_0xb51c('0x9d')]({'where':{'ListId':null}})[_0xb51c('0x26')](handleEntityNotFound(_0x5f07e7,null))[_0xb51c('0x26')](function(_0x3b0e2f){return _0x3b0e2f;})['then'](respondWithResult(_0x5f07e7,null))[_0xb51c('0x4b')](handleError(_0x5f07e7,null));};exports['addAgents']=function(_0x5ef41c,_0x47adc0,_0x40a319){return db[_0xb51c('0x32')][_0xb51c('0x4a')]({'where':{'id':_0x5ef41c[_0xb51c('0x49')]['id']}})[_0xb51c('0x26')](handleEntityNotFound(_0x47adc0,null))[_0xb51c('0x26')](function(_0x32cbcf){if(_0x32cbcf){return _0x32cbcf[_0xb51c('0x9e')](_0x5ef41c[_0xb51c('0x4d')][_0xb51c('0x5c')],_[_0xb51c('0x62')](_0x5ef41c[_0xb51c('0x4d')],[_0xb51c('0x5c'),'id'])||{})[_0xb51c('0x9f')](function(_0x300498){for(var _0x477c3b=0x0;_0x477c3b<_0x5ef41c[_0xb51c('0x4d')][_0xb51c('0x5c')][_0xb51c('0x3e')];_0x477c3b+=0x1){socket[_0xb51c('0xa0')](_0xb51c('0xa1'),{'UserId':Number(_0x5ef41c['body'][_0xb51c('0x5c')][_0x477c3b]),'CmListId':Number(_0x5ef41c['params']['id'])});}return _0x300498;});}})['then'](respondWithResult(_0x47adc0,null))[_0xb51c('0x4b')](handleError(_0x47adc0,null));};exports[_0xb51c('0xa2')]=function(_0xe06f05,_0x4ec244,_0x4e2d5c){return db[_0xb51c('0x32')][_0xb51c('0x4a')]({'where':{'id':_0xe06f05['params']['id']}})[_0xb51c('0x26')](handleEntityNotFound(_0x4ec244,null))['then'](function(_0x311416){if(_0x311416){return _0x311416[_0xb51c('0xa2')](_0xe06f05[_0xb51c('0x37')][_0xb51c('0x5c')])[_0xb51c('0x26')](function(){if(_['isArray'](_0xe06f05[_0xb51c('0x37')][_0xb51c('0x5c')])){for(var _0x21aeb5=0x0;_0x21aeb5<_0xe06f05[_0xb51c('0x37')][_0xb51c('0x5c')]['length'];_0x21aeb5+=0x1){socket[_0xb51c('0xa0')](_0xb51c('0xa3'),{'UserId':Number(_0xe06f05[_0xb51c('0x37')][_0xb51c('0x5c')][_0x21aeb5]),'CmListId':Number(_0xe06f05[_0xb51c('0x49')]['id'])});}}else{socket['emit']('userCmList:remove',{'UserId':Number(_0xe06f05[_0xb51c('0x37')][_0xb51c('0x5c')]),'CmListId':Number(_0xe06f05[_0xb51c('0x49')]['id'])});}});}})[_0xb51c('0x26')](respondWithStatusCode(_0x4ec244,null))['catch'](handleError(_0x4ec244,null));};exports['getAgents']=function(_0x4cb21b,_0x53b5ed,_0x57e2d5){var _0x42a85d={};var _0x325d3c={};var _0x4c7dcb;var _0x15a767;return db['CmList']['findOne']({'where':{'id':_0x4cb21b['params']['id']}})[_0xb51c('0x26')](handleEntityNotFound(_0x53b5ed,null))['then'](function(_0x446c1b){if(_0x446c1b){_0x4c7dcb=_0x446c1b;_0x325d3c[_0xb51c('0x3b')]=_[_0xb51c('0x38')](db[_0xb51c('0xa4')]['rawAttributes']);_0x325d3c[_0xb51c('0x37')]=_[_0xb51c('0x38')](_0x4cb21b[_0xb51c('0x37')]);_0x325d3c[_0xb51c('0x39')]=_[_0xb51c('0x3a')](_0x325d3c['model'],_0x325d3c[_0xb51c('0x37')]);_0x42a85d['attributes']=_['intersection'](_0x325d3c[_0xb51c('0x3b')],qs['fields'](_0x4cb21b[_0xb51c('0x37')][_0xb51c('0x3c')]));_0x42a85d[_0xb51c('0x3d')]=_0x42a85d[_0xb51c('0x3d')][_0xb51c('0x3e')]?_0x42a85d[_0xb51c('0x3d')]:_0x325d3c[_0xb51c('0x3b')];_0x42a85d['order']=qs['sort'](_0x4cb21b[_0xb51c('0x37')]['sort']);_0x42a85d[_0xb51c('0x42')]=qs[_0xb51c('0x39')](_[_0xb51c('0x59')](_0x4cb21b[_0xb51c('0x37')],_0x325d3c[_0xb51c('0x39')]));if(_0x4cb21b[_0xb51c('0x37')][_0xb51c('0x43')]){_0x42a85d[_0xb51c('0x42')]=_['merge'](_0x42a85d['where'],{'$or':_['map'](_0x42a85d[_0xb51c('0x3d')],function(_0xb454d2){var _0x5dfd53={};_0x5dfd53[_0xb454d2]={'$like':'%'+_0x4cb21b['query'][_0xb51c('0x43')]+'%'};return _0x5dfd53;})});}_0x42a85d=_[_0xb51c('0x44')]({},_0x42a85d,_0x4cb21b['options']);return _0x4c7dcb[_0xb51c('0xa5')](_0x42a85d);}})[_0xb51c('0x26')](function(_0x22af08){if(_0x22af08){_0x15a767=_0x22af08[_0xb51c('0x3e')];if(!_0x4cb21b[_0xb51c('0x37')][_0xb51c('0x58')](_0xb51c('0x3f'))){_0x42a85d[_0xb51c('0x1e')]=qs[_0xb51c('0x1e')](_0x4cb21b[_0xb51c('0x37')][_0xb51c('0x1e')]);_0x42a85d[_0xb51c('0x1c')]=qs['offset'](_0x4cb21b[_0xb51c('0x37')][_0xb51c('0x1c')]);}return _0x4c7dcb[_0xb51c('0xa5')](_0x42a85d);}})[_0xb51c('0x26')](function(_0x3ee458){if(_0x3ee458){return _0x3ee458?{'count':_0x15a767,'rows':_0x3ee458}:null;}})['then'](respondWithResult(_0x53b5ed,null))[_0xb51c('0x4b')](handleError(_0x53b5ed,null));};function handleQuery(_0x5ec208){logger[_0xb51c('0xa6')](_0x5ec208);return db[_0xb51c('0x8e')][_0xb51c('0x37')](_0x5ec208)['spread'](function(_0x30fcfa){csv_results[_0xb51c('0x64')](_0x30fcfa);})[_0xb51c('0x4b')](function(_0x4e8af1){logger['error'](_0x4e8af1['message']);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index d825d6d..f886796 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 _0x5fc3=['events','../../mysqldb','setMaxListeners','save','update','remove','emit','hook'];(function(_0x139a3c,_0x4fc883){var _0x2b375b=function(_0x525dbf){while(--_0x525dbf){_0x139a3c['push'](_0x139a3c['shift']());}};_0x2b375b(++_0x4fc883);}(_0x5fc3,0xa8));var _0x35fc=function(_0x13c70c,_0x546b34){_0x13c70c=_0x13c70c-0x0;var _0x50f0f2=_0x5fc3[_0x13c70c];return _0x50f0f2;};'use strict';var EventEmitter=require(_0x35fc('0x0'));var CmList=require(_0x35fc('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents[_0x35fc('0x2')](0x0);var events={'afterCreate':_0x35fc('0x3'),'afterUpdate':_0x35fc('0x4'),'afterDestroy':_0x35fc('0x5')};function emitEvent(_0xb4f9ce){return function(_0x5e75e6,_0x2d1404,_0x1d5fec){CmListEvents[_0x35fc('0x6')](_0xb4f9ce+':'+_0x5e75e6['id'],_0x5e75e6);CmListEvents['emit'](_0xb4f9ce,_0x5e75e6);_0x1d5fec(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0x35fc('0x7')](e,emitEvent(event));}}module['exports']=CmListEvents; \ No newline at end of file +var _0x814b=['update','emit','hook','exports','events','../../mysqldb','CmList','setMaxListeners','save'];(function(_0x2fcf18,_0x10009a){var _0x4c68cc=function(_0x444002){while(--_0x444002){_0x2fcf18['push'](_0x2fcf18['shift']());}};_0x4c68cc(++_0x10009a);}(_0x814b,0x1a2));var _0xb814=function(_0x3b0999,_0x3c9835){_0x3b0999=_0x3b0999-0x0;var _0x585226=_0x814b[_0x3b0999];return _0x585226;};'use strict';var EventEmitter=require(_0xb814('0x0'));var CmList=require(_0xb814('0x1'))['db'][_0xb814('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0xb814('0x3')](0x0);var events={'afterCreate':_0xb814('0x4'),'afterUpdate':_0xb814('0x5'),'afterDestroy':'remove'};function emitEvent(_0x38c21a){return function(_0x3e1e9,_0x258866,_0x4237bc){CmListEvents[_0xb814('0x6')](_0x38c21a+':'+_0x3e1e9['id'],_0x3e1e9);CmListEvents[_0xb814('0x6')](_0x38c21a,_0x3e1e9);_0x4237bc(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0xb814('0x7')](e,emitEvent(event));}}module[_0xb814('0x8')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 7741fff..07de2d1 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 _0xda55=['util','moment','bluebird','request-promise','path','rimraf','./cmList.attributes','define','CmList','cm_lists','lodash'];(function(_0x2694ea,_0x582868){var _0x4bed8d=function(_0x29d087){while(--_0x29d087){_0x2694ea['push'](_0x2694ea['shift']());}};_0x4bed8d(++_0x582868);}(_0xda55,0x6d));var _0x5da5=function(_0x132d12,_0x2c9799){_0x132d12=_0x132d12-0x0;var _0x1c3163=_0xda55[_0x132d12];return _0x1c3163;};'use strict';var _=require(_0x5da5('0x0'));var util=require(_0x5da5('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x5da5('0x2'));var BPromise=require(_0x5da5('0x3'));var rp=require(_0x5da5('0x4'));var fs=require('fs');var path=require(_0x5da5('0x5'));var rimraf=require(_0x5da5('0x6'));var config=require('../../config/environment');var attributes=require(_0x5da5('0x7'));module['exports']=function(_0x356a37,_0x58e7b3){return _0x356a37[_0x5da5('0x8')](_0x5da5('0x9'),attributes,{'tableName':_0x5da5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x750a=['path','rimraf','../../config/environment','./cmList.attributes','exports','define','CmList','cm_lists','util','moment','bluebird','request-promise'];(function(_0x3fa529,_0x3c341e){var _0x350134=function(_0x47368e){while(--_0x47368e){_0x3fa529['push'](_0x3fa529['shift']());}};_0x350134(++_0x3c341e);}(_0x750a,0x140));var _0xa750=function(_0x4cd9b2,_0xbb0bc9){_0x4cd9b2=_0x4cd9b2-0x0;var _0x193cc6=_0x750a[_0x4cd9b2];return _0x193cc6;};'use strict';var _=require('lodash');var util=require(_0xa750('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xa750('0x1'));var BPromise=require(_0xa750('0x2'));var rp=require(_0xa750('0x3'));var fs=require('fs');var path=require(_0xa750('0x4'));var rimraf=require(_0xa750('0x5'));var config=require(_0xa750('0x6'));var attributes=require(_0xa750('0x7'));module[_0xa750('0x8')]=function(_0x10b4d9,_0x2497df){return _0x10b4d9[_0xa750('0x9')](_0xa750('0xa'),attributes,{'tableName':_0xa750('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index 7aa80e9..4e1da38 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 _0xb5d8=['CmList,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','defaults','localhost','socket.io-emitter','redis','./cmList.socket','register','request','then','info','CmList,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x2d6531,_0x332115){var _0x190256=function(_0x3be478){while(--_0x3be478){_0x2d6531['push'](_0x2d6531['shift']());}};_0x190256(++_0x332115);}(_0xb5d8,0x11d));var _0x8b5d=function(_0x3e7773,_0x912cca){_0x3e7773=_0x3e7773-0x0;var _0x511dd4=_0xb5d8[_0x3e7773];return _0x511dd4;};'use strict';var _=require(_0x8b5d('0x0'));var util=require(_0x8b5d('0x1'));var moment=require(_0x8b5d('0x2'));var BPromise=require(_0x8b5d('0x3'));var rs=require(_0x8b5d('0x4'));var fs=require('fs');var Redis=require(_0x8b5d('0x5'));var db=require(_0x8b5d('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x8b5d('0x7'))(_0x8b5d('0x8'));var config=require(_0x8b5d('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8b5d('0xa')]({'port':0x232a});config['redis']=_[_0x8b5d('0xb')](config['redis'],{'host':_0x8b5d('0xc'),'port':0x18eb});var socket=require(_0x8b5d('0xd'))(new Redis(config[_0x8b5d('0xe')]));require(_0x8b5d('0xf'))[_0x8b5d('0x10')](socket);function respondWithRpcPromise(_0x720e7f,_0x482e0d,_0x2c0d57){return new BPromise(function(_0x4f3f2c,_0x38aae4){return client[_0x8b5d('0x11')](_0x720e7f,_0x2c0d57)[_0x8b5d('0x12')](function(_0x5f98a8){logger[_0x8b5d('0x13')](_0x8b5d('0x14'),_0x482e0d,_0x8b5d('0x15'));logger[_0x8b5d('0x16')](_0x8b5d('0x17'),_0x482e0d,_0x8b5d('0x15'),JSON[_0x8b5d('0x18')](_0x5f98a8));if(_0x5f98a8['error']){if(_0x5f98a8[_0x8b5d('0x19')]['code']===0x1f4){logger['error'](_0x8b5d('0x14'),_0x482e0d,_0x5f98a8[_0x8b5d('0x19')]['message']);return _0x38aae4(_0x5f98a8[_0x8b5d('0x19')]['message']);}logger[_0x8b5d('0x19')](_0x8b5d('0x14'),_0x482e0d,_0x5f98a8[_0x8b5d('0x19')][_0x8b5d('0x1a')]);return _0x4f3f2c(_0x5f98a8[_0x8b5d('0x19')][_0x8b5d('0x1a')]);}else{logger['info'](_0x8b5d('0x14'),_0x482e0d,_0x8b5d('0x15'));_0x4f3f2c(_0x5f98a8[_0x8b5d('0x1b')][_0x8b5d('0x1a')]);}})['catch'](function(_0x2c6a6c){logger[_0x8b5d('0x19')](_0x8b5d('0x14'),_0x482e0d,_0x2c6a6c);_0x38aae4(_0x2c6a6c);});});} \ No newline at end of file +var _0xd25d=['socket.io-emitter','./cmList.socket','register','request','then','CmList,\x20%s,\x20%s','debug','CmList,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost'];(function(_0x576266,_0x4002b0){var _0x18234f=function(_0x4e9ad5){while(--_0x4e9ad5){_0x576266['push'](_0x576266['shift']());}};_0x18234f(++_0x4002b0);}(_0xd25d,0xda));var _0xdd25=function(_0x25fdf0,_0x565434){_0x25fdf0=_0x25fdf0-0x0;var _0x17f051=_0xd25d[_0x25fdf0];return _0x17f051;};'use strict';var _=require(_0xdd25('0x0'));var util=require(_0xdd25('0x1'));var moment=require(_0xdd25('0x2'));var BPromise=require(_0xdd25('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdd25('0x4'))['db'];var utils=require(_0xdd25('0x5'));var logger=require(_0xdd25('0x6'))(_0xdd25('0x7'));var config=require(_0xdd25('0x8'));var jayson=require(_0xdd25('0x9'));var client=jayson[_0xdd25('0xa')][_0xdd25('0xb')]({'port':0x232a});config[_0xdd25('0xc')]=_['defaults'](config[_0xdd25('0xc')],{'host':_0xdd25('0xd'),'port':0x18eb});var socket=require(_0xdd25('0xe'))(new Redis(config[_0xdd25('0xc')]));require(_0xdd25('0xf'))[_0xdd25('0x10')](socket);function respondWithRpcPromise(_0x4d84d5,_0x3c4978,_0x2b0779){return new BPromise(function(_0x1ca109,_0x526aab){return client[_0xdd25('0x11')](_0x4d84d5,_0x2b0779)[_0xdd25('0x12')](function(_0x4dbd07){logger['info'](_0xdd25('0x13'),_0x3c4978,'request\x20sent');logger[_0xdd25('0x14')](_0xdd25('0x15'),_0x3c4978,_0xdd25('0x16'),JSON['stringify'](_0x4dbd07));if(_0x4dbd07[_0xdd25('0x17')]){if(_0x4dbd07[_0xdd25('0x17')][_0xdd25('0x18')]===0x1f4){logger[_0xdd25('0x17')](_0xdd25('0x13'),_0x3c4978,_0x4dbd07[_0xdd25('0x17')]['message']);return _0x526aab(_0x4dbd07[_0xdd25('0x17')]['message']);}logger['error'](_0xdd25('0x13'),_0x3c4978,_0x4dbd07['error'][_0xdd25('0x19')]);return _0x1ca109(_0x4dbd07[_0xdd25('0x17')][_0xdd25('0x19')]);}else{logger[_0xdd25('0x1a')](_0xdd25('0x13'),_0x3c4978,_0xdd25('0x16'));_0x1ca109(_0x4dbd07[_0xdd25('0x1b')][_0xdd25('0x19')]);}})[_0xdd25('0x1c')](function(_0x1fa73e){logger[_0xdd25('0x17')](_0xdd25('0x13'),_0x3c4978,_0x1fa73e);_0x526aab(_0x1fa73e);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 81cb4d8..354d987 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 _0x1805=['remove','update','emit','removeListener','register','length','save'];(function(_0x3bad10,_0x5a34c4){var _0x247499=function(_0x266683){while(--_0x266683){_0x3bad10['push'](_0x3bad10['shift']());}};_0x247499(++_0x5a34c4);}(_0x1805,0x1bf));var _0x5180=function(_0x346b35,_0x26fce9){_0x346b35=_0x346b35-0x0;var _0x80a306=_0x1805[_0x346b35];return _0x80a306;};'use strict';var CmListEvents=require('./cmList.events');var events=[_0x5180('0x0'),_0x5180('0x1'),_0x5180('0x2')];function createListener(_0x4a2651,_0x25c095){return function(_0x12d90d){_0x25c095[_0x5180('0x3')](_0x4a2651,_0x12d90d);};}function removeListener(_0x660b99,_0x2fa8d7){return function(){CmListEvents[_0x5180('0x4')](_0x660b99,_0x2fa8d7);};}exports[_0x5180('0x5')]=function(_0x37ffd7){for(var _0x2338b9=0x0,_0x4b0de6=events[_0x5180('0x6')];_0x2338b9<_0x4b0de6;_0x2338b9++){var _0x221e50=events[_0x2338b9];var _0x391a55=createListener('cmList:'+_0x221e50,_0x37ffd7);CmListEvents['on'](_0x221e50,_0x391a55);}}; \ No newline at end of file +var _0x2331=['./cmList.events','removeListener','length','cmList:'];(function(_0x4852a6,_0x1a9e0d){var _0x4375d9=function(_0x42c9f9){while(--_0x42c9f9){_0x4852a6['push'](_0x4852a6['shift']());}};_0x4375d9(++_0x1a9e0d);}(_0x2331,0xd0));var _0x1233=function(_0x13137e,_0x29c0f3){_0x13137e=_0x13137e-0x0;var _0x346261=_0x2331[_0x13137e];return _0x346261;};'use strict';var CmListEvents=require(_0x1233('0x0'));var events=['save','remove','update'];function createListener(_0x4cf6fd,_0x344f1d){return function(_0x21b1f){_0x344f1d['emit'](_0x4cf6fd,_0x21b1f);};}function removeListener(_0x2ff758,_0x42d971){return function(){CmListEvents[_0x1233('0x1')](_0x2ff758,_0x42d971);};}exports['register']=function(_0x31757a){for(var _0x3f0d3f=0x0,_0x274638=events[_0x1233('0x2')];_0x3f0d3f<_0x274638;_0x3f0d3f++){var _0x5d3606=events[_0x3f0d3f];var _0x326734=createListener(_0x1233('0x3')+_0x5d3606,_0x31757a);CmListEvents['on'](_0x5d3606,_0x326734);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 9021ad9..c7d3206 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 _0x851e=['../../config/environment','get','isAuthenticated','index','/describe','describe','getGlobalCustomFields','/:id','show','/:id/dispositions','getDispositions','/:id/contacts','/:id/fields','getCustomFields','/:id/users','post','create','addCustomField','addAgents','put','update','destroy','delete','removeDispositions','removeAgents','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x851e,0x1e8));var _0xe851=function(_0x5ea451,_0x133637){_0x5ea451=_0x5ea451-0x0;var _0x37a06a=_0x851e[_0x5ea451];return _0x37a06a;};'use strict';var multer=require(_0xe851('0x0'));var util=require(_0xe851('0x1'));var path=require(_0xe851('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe851('0x3')]();var fs_extra=require(_0xe851('0x4'));var auth=require(_0xe851('0x5'));var interaction=require(_0xe851('0x6'));var config=require(_0xe851('0x7'));var controller=require('./cmList.controller');router[_0xe851('0x8')]('/',auth[_0xe851('0x9')](),controller[_0xe851('0xa')]);router[_0xe851('0x8')](_0xe851('0xb'),auth['isAuthenticated'](),controller[_0xe851('0xc')]);router['get']('/global_fields',auth[_0xe851('0x9')](),controller[_0xe851('0xd')]);router[_0xe851('0x8')](_0xe851('0xe'),auth['isAuthenticated'](),controller[_0xe851('0xf')]);router[_0xe851('0x8')](_0xe851('0x10'),auth['isAuthenticated'](),controller[_0xe851('0x11')]);router['get'](_0xe851('0x12'),auth[_0xe851('0x9')](),controller['getContacts']);router[_0xe851('0x8')]('/:id/contacts/csv',auth[_0xe851('0x9')](),controller['getContactsCsv']);router[_0xe851('0x8')](_0xe851('0x13'),auth['isAuthenticated'](),controller[_0xe851('0x14')]);router[_0xe851('0x8')](_0xe851('0x15'),auth['isAuthenticated'](),controller['getAgents']);router[_0xe851('0x16')]('/',auth[_0xe851('0x9')](),controller[_0xe851('0x17')]);router[_0xe851('0x16')](_0xe851('0x10'),auth[_0xe851('0x9')](),controller['addDisposition']);router[_0xe851('0x16')]('/:id/contacts',auth[_0xe851('0x9')](),controller['addContacts']);router[_0xe851('0x16')]('/:id/fields',auth[_0xe851('0x9')](),controller[_0xe851('0x18')]);router[_0xe851('0x16')](_0xe851('0x15'),auth[_0xe851('0x9')](),controller[_0xe851('0x19')]);router[_0xe851('0x1a')](_0xe851('0xe'),auth['isAuthenticated'](),controller[_0xe851('0x1b')]);router['delete'](_0xe851('0xe'),auth['isAuthenticated'](),controller[_0xe851('0x1c')]);router[_0xe851('0x1d')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xe851('0x1e')]);router[_0xe851('0x1d')](_0xe851('0x15'),auth[_0xe851('0x9')](),controller[_0xe851('0x1f')]);module[_0xe851('0x20')]=router; \ No newline at end of file +var _0x9fd4=['index','get','/describe','describe','/global_fields','getGlobalCustomFields','show','/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','create','post','addDisposition','addCustomField','addAgents','put','/:id','update','delete','removeDispositions','exports','util','connect-timeout','express','../../components/auth/service','./cmList.controller','isAuthenticated'];(function(_0x13b02f,_0x462a53){var _0x12e9a6=function(_0x187d57){while(--_0x187d57){_0x13b02f['push'](_0x13b02f['shift']());}};_0x12e9a6(++_0x462a53);}(_0x9fd4,0xe8));var _0x49fd=function(_0x59aedf,_0x1e5baa){_0x59aedf=_0x59aedf-0x0;var _0x465a37=_0x9fd4[_0x59aedf];return _0x465a37;};'use strict';var multer=require('multer');var util=require(_0x49fd('0x0'));var path=require('path');var timeout=require(_0x49fd('0x1'));var express=require(_0x49fd('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x49fd('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x49fd('0x4'));router['get']('/',auth[_0x49fd('0x5')](),controller[_0x49fd('0x6')]);router[_0x49fd('0x7')](_0x49fd('0x8'),auth[_0x49fd('0x5')](),controller[_0x49fd('0x9')]);router[_0x49fd('0x7')](_0x49fd('0xa'),auth[_0x49fd('0x5')](),controller[_0x49fd('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x49fd('0xc')]);router[_0x49fd('0x7')](_0x49fd('0xd'),auth[_0x49fd('0x5')](),controller[_0x49fd('0xe')]);router['get'](_0x49fd('0xf'),auth[_0x49fd('0x5')](),controller[_0x49fd('0x10')]);router[_0x49fd('0x7')](_0x49fd('0x11'),auth[_0x49fd('0x5')](),controller[_0x49fd('0x12')]);router[_0x49fd('0x7')](_0x49fd('0x13'),auth['isAuthenticated'](),controller[_0x49fd('0x14')]);router[_0x49fd('0x7')](_0x49fd('0x15'),auth[_0x49fd('0x5')](),controller[_0x49fd('0x16')]);router['post']('/',auth[_0x49fd('0x5')](),controller[_0x49fd('0x17')]);router[_0x49fd('0x18')]('/:id/dispositions',auth[_0x49fd('0x5')](),controller[_0x49fd('0x19')]);router['post'](_0x49fd('0xf'),auth[_0x49fd('0x5')](),controller['addContacts']);router['post'](_0x49fd('0x13'),auth[_0x49fd('0x5')](),controller[_0x49fd('0x1a')]);router['post'](_0x49fd('0x15'),auth[_0x49fd('0x5')](),controller[_0x49fd('0x1b')]);router[_0x49fd('0x1c')](_0x49fd('0x1d'),auth[_0x49fd('0x5')](),controller[_0x49fd('0x1e')]);router[_0x49fd('0x1f')](_0x49fd('0x1d'),auth[_0x49fd('0x5')](),controller['destroy']);router['delete']('/:id/dispositions',auth['isAuthenticated'](),controller[_0x49fd('0x20')]);router[_0x49fd('0x1f')]('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module[_0x49fd('0x21')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 59a39b7..195f643 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 _0xaafe=['field','STRING','sequelize','exports','VIRTUAL','getDataValue'];(function(_0x4b4923,_0x4bbc9e){var _0x2f531c=function(_0x13420d){while(--_0x13420d){_0x4b4923['push'](_0x4b4923['shift']());}};_0x2f531c(++_0x4bbc9e);}(_0xaafe,0x128));var _0xeaaf=function(_0x49d65a,_0x2f6113){_0x49d65a=_0x49d65a-0x0;var _0x551ea3=_0xaafe[_0x49d65a];return _0x551ea3;};'use strict';var Sequelize=require(_0xeaaf('0x0'));module[_0xeaaf('0x1')]={'name':{'type':Sequelize[_0xeaaf('0x2')],'get':function(_0xb1ec19){return this[_0xeaaf('0x3')](_0xeaaf('0x4'));}},'field':{'type':Sequelize[_0xeaaf('0x5')],'allowNull':![]},'operator':{'type':Sequelize[_0xeaaf('0x5')],'allowNull':![]},'value':{'type':Sequelize[_0xeaaf('0x5')],'allowNull':![]}}; \ No newline at end of file +var _0xf3ae=['STRING','sequelize','exports','VIRTUAL','getDataValue','field'];(function(_0x186376,_0x5d988a){var _0x2dbdd9=function(_0x96908e){while(--_0x96908e){_0x186376['push'](_0x186376['shift']());}};_0x2dbdd9(++_0x5d988a);}(_0xf3ae,0xc7));var _0xef3a=function(_0x1dc3e7,_0x5f57ef){_0x1dc3e7=_0x1dc3e7-0x0;var _0x1ce12e=_0xf3ae[_0x1dc3e7];return _0x1ce12e;};'use strict';var Sequelize=require(_0xef3a('0x0'));module[_0xef3a('0x1')]={'name':{'type':Sequelize[_0xef3a('0x2')],'get':function(_0x13d55b){return this[_0xef3a('0x3')](_0xef3a('0x4'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0xef3a('0x5')],'allowNull':![]},'value':{'type':Sequelize[_0xef3a('0x5')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 0ccf1d7..ccaa727 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(_0x170906,_0x4a4e3d){var _0x49cf8a=function(_0x21e37c){while(--_0x21e37c){_0x170906['push'](_0x170906['shift']());}};_0x49cf8a(++_0x4a4e3d);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){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(_0x580fd9,_0x386a47){var _0x510424=function(_0x2c3634){while(--_0x2c3634){_0x580fd9['push'](_0x580fd9['shift']());}};_0x510424(++_0x386a47);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'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 e0851a8..2461029 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 _0x1893=['exports','define','Condition','tools_conditions','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./condition.attributes'];(function(_0x327337,_0x1ff93e){var _0x537f46=function(_0x1659fd){while(--_0x1659fd){_0x327337['push'](_0x327337['shift']());}};_0x537f46(++_0x1ff93e);}(_0x1893,0x162));var _0x3189=function(_0x2b84d5,_0x428914){_0x2b84d5=_0x2b84d5-0x0;var _0x51452a=_0x1893[_0x2b84d5];return _0x51452a;};'use strict';var _=require('lodash');var util=require(_0x3189('0x0'));var logger=require(_0x3189('0x1'))(_0x3189('0x2'));var moment=require(_0x3189('0x3'));var BPromise=require(_0x3189('0x4'));var rp=require(_0x3189('0x5'));var fs=require('fs');var path=require(_0x3189('0x6'));var rimraf=require(_0x3189('0x7'));var config=require(_0x3189('0x8'));var attributes=require(_0x3189('0x9'));module[_0x3189('0xa')]=function(_0x6aa79f,_0x130ebc){return _0x6aa79f[_0x3189('0xb')](_0x3189('0xc'),attributes,{'tableName':_0x3189('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9381=['util','../../config/logger','moment','request-promise','path','../../config/environment','./condition.attributes','exports','define','Condition','tools_conditions','lodash'];(function(_0x3a9c68,_0x3487b5){var _0x3f3e2f=function(_0x43d732){while(--_0x43d732){_0x3a9c68['push'](_0x3a9c68['shift']());}};_0x3f3e2f(++_0x3487b5);}(_0x9381,0x197));var _0x1938=function(_0xd22d95,_0xc59f8f){_0xd22d95=_0xd22d95-0x0;var _0x15d7a3=_0x9381[_0xd22d95];return _0x15d7a3;};'use strict';var _=require(_0x1938('0x0'));var util=require(_0x1938('0x1'));var logger=require(_0x1938('0x2'))('api');var moment=require(_0x1938('0x3'));var BPromise=require('bluebird');var rp=require(_0x1938('0x4'));var fs=require('fs');var path=require(_0x1938('0x5'));var rimraf=require('rimraf');var config=require(_0x1938('0x6'));var attributes=require(_0x1938('0x7'));module[_0x1938('0x8')]=function(_0x50fbb6,_0x569c70){return _0x50fbb6[_0x1938('0x9')](_0x1938('0xa'),attributes,{'tableName':_0x1938('0xb'),'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 eb482d9..d957c05 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 _0xb377=['util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','Condition,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash'];(function(_0x43105b,_0x3b30ed){var _0x3bb65c=function(_0x2cda76){while(--_0x2cda76){_0x43105b['push'](_0x43105b['shift']());}};_0x3bb65c(++_0x3b30ed);}(_0xb377,0x175));var _0x7b37=function(_0x2d1b62,_0x3fdb3c){_0x2d1b62=_0x2d1b62-0x0;var _0x156526=_0xb377[_0x2d1b62];return _0x156526;};'use strict';var _=require(_0x7b37('0x0'));var util=require(_0x7b37('0x1'));var moment=require(_0x7b37('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7b37('0x3'));var db=require(_0x7b37('0x4'))['db'];var utils=require(_0x7b37('0x5'));var logger=require(_0x7b37('0x6'))(_0x7b37('0x7'));var config=require(_0x7b37('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x7b37('0x9')][_0x7b37('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x274ef9,_0x50623,_0x5f401b){return new BPromise(function(_0x143d13,_0x19d9d9){return client[_0x7b37('0xb')](_0x274ef9,_0x5f401b)['then'](function(_0x504934){logger[_0x7b37('0xc')](_0x7b37('0xd'),_0x50623,_0x7b37('0xe'));logger[_0x7b37('0xf')]('Condition,\x20%s,\x20%s,\x20%s',_0x50623,'request\x20sent',JSON[_0x7b37('0x10')](_0x504934));if(_0x504934[_0x7b37('0x11')]){if(_0x504934['error'][_0x7b37('0x12')]===0x1f4){logger['error'](_0x7b37('0xd'),_0x50623,_0x504934[_0x7b37('0x11')][_0x7b37('0x13')]);return _0x19d9d9(_0x504934[_0x7b37('0x11')][_0x7b37('0x13')]);}logger[_0x7b37('0x11')]('Condition,\x20%s,\x20%s',_0x50623,_0x504934[_0x7b37('0x11')]['message']);return _0x143d13(_0x504934['error'][_0x7b37('0x13')]);}else{logger[_0x7b37('0xc')]('Condition,\x20%s,\x20%s',_0x50623,_0x7b37('0xe'));_0x143d13(_0x504934[_0x7b37('0x14')][_0x7b37('0x13')]);}})[_0x7b37('0x15')](function(_0x2eeb42){logger[_0x7b37('0x11')](_0x7b37('0xd'),_0x50623,_0x2eeb42);_0x19d9d9(_0x2eeb42);});});} \ No newline at end of file +var _0x5013=['result','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','error','message'];(function(_0x3eff41,_0xcf456e){var _0x4857f5=function(_0xb0c6cf){while(--_0xb0c6cf){_0x3eff41['push'](_0x3eff41['shift']());}};_0x4857f5(++_0xcf456e);}(_0x5013,0x1ce));var _0x3501=function(_0x480bc8,_0x1fac40){_0x480bc8=_0x480bc8-0x0;var _0x28c245=_0x5013[_0x480bc8];return _0x28c245;};'use strict';var _=require(_0x3501('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3501('0x1'));var fs=require('fs');var Redis=require(_0x3501('0x2'));var db=require(_0x3501('0x3'))['db'];var utils=require(_0x3501('0x4'));var logger=require(_0x3501('0x5'))(_0x3501('0x6'));var config=require('../../config/environment');var jayson=require(_0x3501('0x7'));var client=jayson[_0x3501('0x8')][_0x3501('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x191f7f,_0x192ec5,_0x2e9eb8){return new BPromise(function(_0x4a72d1,_0x1ca5c9){return client['request'](_0x191f7f,_0x2e9eb8)[_0x3501('0xa')](function(_0x1952ee){logger[_0x3501('0xb')](_0x3501('0xc'),_0x192ec5,_0x3501('0xd'));logger[_0x3501('0xe')](_0x3501('0xf'),_0x192ec5,'request\x20sent',JSON['stringify'](_0x1952ee));if(_0x1952ee[_0x3501('0x10')]){if(_0x1952ee[_0x3501('0x10')]['code']===0x1f4){logger[_0x3501('0x10')]('Condition,\x20%s,\x20%s',_0x192ec5,_0x1952ee[_0x3501('0x10')][_0x3501('0x11')]);return _0x1ca5c9(_0x1952ee[_0x3501('0x10')][_0x3501('0x11')]);}logger['error'](_0x3501('0xc'),_0x192ec5,_0x1952ee[_0x3501('0x10')][_0x3501('0x11')]);return _0x4a72d1(_0x1952ee[_0x3501('0x10')]['message']);}else{logger[_0x3501('0xb')](_0x3501('0xc'),_0x192ec5,_0x3501('0xd'));_0x4a72d1(_0x1952ee[_0x3501('0x12')]['message']);}})[_0x3501('0x13')](function(_0x33fc3f){logger[_0x3501('0x10')](_0x3501('0xc'),_0x192ec5,_0x33fc3f);_0x1ca5c9(_0x33fc3f);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index e9a2919..360abcf 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 _0xf8c8=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','put','/:id','isAuthenticated','update','destroy','multer','util'];(function(_0x4b5bab,_0x1d73d4){var _0x5abd6b=function(_0x1256d6){while(--_0x1256d6){_0x4b5bab['push'](_0x4b5bab['shift']());}};_0x5abd6b(++_0x1d73d4);}(_0xf8c8,0x139));var _0x8f8c=function(_0x110641,_0x29cfc9){_0x110641=_0x110641-0x0;var _0x4ed844=_0xf8c8[_0x110641];return _0x4ed844;};'use strict';var multer=require(_0x8f8c('0x0'));var util=require(_0x8f8c('0x1'));var path=require(_0x8f8c('0x2'));var timeout=require('connect-timeout');var express=require(_0x8f8c('0x3'));var router=express[_0x8f8c('0x4')]();var fs_extra=require(_0x8f8c('0x5'));var auth=require(_0x8f8c('0x6'));var interaction=require(_0x8f8c('0x7'));var config=require(_0x8f8c('0x8'));var controller=require(_0x8f8c('0x9'));router[_0x8f8c('0xa')](_0x8f8c('0xb'),auth[_0x8f8c('0xc')](),controller[_0x8f8c('0xd')]);router['delete']('/:id',auth[_0x8f8c('0xc')](),controller[_0x8f8c('0xe')]);module['exports']=router; \ No newline at end of file +var _0xa4c2=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','put','/:id','update','delete','destroy','exports'];(function(_0x596bc4,_0x33d414){var _0x313f66=function(_0x4dc569){while(--_0x4dc569){_0x596bc4['push'](_0x596bc4['shift']());}};_0x313f66(++_0x33d414);}(_0xa4c2,0x186));var _0x2a4c=function(_0x382cf7,_0xdc1a0c){_0x382cf7=_0x382cf7-0x0;var _0x5bab32=_0xa4c2[_0x382cf7];return _0x5bab32;};'use strict';var multer=require('multer');var util=require(_0x2a4c('0x0'));var path=require(_0x2a4c('0x1'));var timeout=require(_0x2a4c('0x2'));var express=require(_0x2a4c('0x3'));var router=express['Router']();var fs_extra=require(_0x2a4c('0x4'));var auth=require(_0x2a4c('0x5'));var interaction=require(_0x2a4c('0x6'));var config=require(_0x2a4c('0x7'));var controller=require(_0x2a4c('0x8'));router[_0x2a4c('0x9')](_0x2a4c('0xa'),auth['isAuthenticated'](),controller[_0x2a4c('0xb')]);router[_0x2a4c('0xc')](_0x2a4c('0xa'),auth['isAuthenticated'](),controller[_0x2a4c('0xd')]);module[_0x2a4c('0xe')]=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index 1f2bace..1e13878 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 _0x7110=['INTEGER','sequelize','exports','name'];(function(_0x3b354c,_0x3d6013){var _0x575416=function(_0x1c04a){while(--_0x1c04a){_0x3b354c['push'](_0x3b354c['shift']());}};_0x575416(++_0x3d6013);}(_0x7110,0x149));var _0x0711=function(_0x2bd47e,_0x3b629c){_0x2bd47e=_0x2bd47e-0x0;var _0x1d2404=_0x7110[_0x2bd47e];return _0x1d2404;};'use strict';var Sequelize=require(_0x0711('0x0'));module[_0x0711('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x0711('0x2')},'OrderBy':{'type':Sequelize[_0x0711('0x3')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0x8d57=['STRING','name','INTEGER','sequelize','exports'];(function(_0x1e190c,_0x1cf5f4){var _0x4cc74a=function(_0x960b2d){while(--_0x960b2d){_0x1e190c['push'](_0x1e190c['shift']());}};_0x4cc74a(++_0x1cf5f4);}(_0x8d57,0x1de));var _0x78d5=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x8d57[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x78d5('0x0'));module[_0x78d5('0x1')]={'name':{'type':Sequelize[_0x78d5('0x2')],'allowNull':![],'unique':_0x78d5('0x3')},'OrderBy':{'type':Sequelize[_0x78d5('0x4')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index 3e9ab11..61f76d4 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 _0x63a5=['end','json','undefined','limit','offset','count','set','Content-Range','reject','save','update','then','destroy','get','ContactItemTypes','UserProfileResource','error','stack','name','send','index','map','ContactItemType','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','filter','merge','options','includeAll','rows','catch','show','params','keys','rawAttributes','include','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','CmContactHasItem','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','ejs','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x63a5,0x18e));var _0x563a=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0x63a5[_0x32f7d7];return _0x133d09;};'use strict';var emlformat=require(_0x563a('0x0'));var rimraf=require(_0x563a('0x1'));var zipdir=require(_0x563a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x563a('0x3'));var moment=require('moment');var BPromise=require(_0x563a('0x4'));var Mustache=require(_0x563a('0x5'));var util=require(_0x563a('0x6'));var path=require(_0x563a('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x563a('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x563a('0x9'));var squel=require(_0x563a('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x563a('0xb'));var toCsv=require(_0x563a('0xc'));var querystring=require(_0x563a('0xd'));var Papa=require(_0x563a('0xe'));var Redis=require(_0x563a('0xf'));var authService=require(_0x563a('0x10'));var qs=require(_0x563a('0x11'));var as=require(_0x563a('0x12'));var hardwareService=require(_0x563a('0x13'));var logger=require(_0x563a('0x14'))(_0x563a('0x15'));var utils=require(_0x563a('0x16'));var config=require(_0x563a('0x17'));var licenseUtil=require(_0x563a('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x61d5b2,_0x214f42){_0x214f42=_0x214f42||0xcc;return function(_0x10de2e){if(_0x10de2e){return _0x61d5b2[_0x563a('0x19')](_0x214f42);}return _0x61d5b2[_0x563a('0x1a')](_0x214f42)[_0x563a('0x1b')]();};}function respondWithResult(_0x50396b,_0x2cf052){_0x2cf052=_0x2cf052||0xc8;return function(_0x3045ac){if(_0x3045ac){return _0x50396b[_0x563a('0x1a')](_0x2cf052)[_0x563a('0x1c')](_0x3045ac);}};}function respondWithFilteredResult(_0x5a2980,_0x504cb7){return function(_0x414535){if(_0x414535){var _0x2ad667=typeof _0x504cb7['offset']===_0x563a('0x1d')&&typeof _0x504cb7[_0x563a('0x1e')]===_0x563a('0x1d');var _0x9c2f77=_0x414535['count'];var _0x598693=_0x2ad667?0x0:_0x504cb7[_0x563a('0x1f')];var _0x422aaf=_0x2ad667?_0x414535[_0x563a('0x20')]:_0x504cb7['offset']+_0x504cb7['limit'];var _0x52b99a;if(_0x422aaf>=_0x9c2f77){_0x422aaf=_0x9c2f77;_0x52b99a=0xc8;}else{_0x52b99a=0xce;}_0x5a2980['status'](_0x52b99a);return _0x5a2980[_0x563a('0x21')](_0x563a('0x22'),_0x598693+'-'+_0x422aaf+'/'+_0x9c2f77)[_0x563a('0x1c')](_0x414535);}return null;};}function patchUpdates(_0x43b7a8){return function(_0x562fce){try{jsonpatch['apply'](_0x562fce,_0x43b7a8,!![]);}catch(_0x3930f0){return BPromise[_0x563a('0x23')](_0x3930f0);}return _0x562fce[_0x563a('0x24')]();};}function saveUpdates(_0x2beccb,_0x1bf502){return function(_0x2dc7e2){if(_0x2dc7e2){return _0x2dc7e2[_0x563a('0x25')](_0x2beccb)[_0x563a('0x26')](function(_0x506491){return _0x506491;});}return null;};}function removeEntity(_0xd59ba8,_0x5422f6){return function(_0x44e2c1){if(_0x44e2c1){return _0x44e2c1[_0x563a('0x27')]()[_0x563a('0x26')](function(){var _0x1250e6=_0x44e2c1[_0x563a('0x28')]({'plain':!![]});var _0x1682ee=_0x563a('0x29');return db[_0x563a('0x2a')]['destroy']({'where':{'type':_0x1682ee,'resourceId':_0x1250e6['id']}})[_0x563a('0x26')](function(){return _0x44e2c1;});})[_0x563a('0x26')](function(){_0xd59ba8[_0x563a('0x1a')](0xcc)[_0x563a('0x1b')]();});}};}function handleEntityNotFound(_0xce8165,_0x1898f9){return function(_0x1afdff){if(!_0x1afdff){_0xce8165[_0x563a('0x19')](0x194);}return _0x1afdff;};}function handleError(_0x249db8,_0x8f3429){_0x8f3429=_0x8f3429||0x1f4;return function(_0x1a69d5){logger[_0x563a('0x2b')](_0x1a69d5[_0x563a('0x2c')]);if(_0x1a69d5[_0x563a('0x2d')]){delete _0x1a69d5['name'];}_0x249db8[_0x563a('0x1a')](_0x8f3429)[_0x563a('0x2e')](_0x1a69d5);};}exports[_0x563a('0x2f')]=function(_0x4aaa3d,_0x1e8d43){var _0x2e5c4b={},_0x3a59cb={},_0x28a8f6={'count':0x0,'rows':[]};var _0x166f89=_[_0x563a('0x30')](db[_0x563a('0x31')]['rawAttributes'],function(_0x2418ae){return{'name':_0x2418ae[_0x563a('0x32')],'type':_0x2418ae[_0x563a('0x33')][_0x563a('0x34')]};});_0x3a59cb[_0x563a('0x35')]=_['map'](_0x166f89,'name');_0x3a59cb['query']=_['keys'](_0x4aaa3d[_0x563a('0x36')]);_0x3a59cb[_0x563a('0x37')]=_[_0x563a('0x38')](_0x3a59cb[_0x563a('0x35')],_0x3a59cb[_0x563a('0x36')]);_0x2e5c4b[_0x563a('0x39')]=_['intersection'](_0x3a59cb['model'],qs[_0x563a('0x3a')](_0x4aaa3d[_0x563a('0x36')][_0x563a('0x3a')]));_0x2e5c4b[_0x563a('0x39')]=_0x2e5c4b[_0x563a('0x39')][_0x563a('0x3b')]?_0x2e5c4b[_0x563a('0x39')]:_0x3a59cb[_0x563a('0x35')];if(!_0x4aaa3d[_0x563a('0x36')][_0x563a('0x3c')](_0x563a('0x3d'))){_0x2e5c4b[_0x563a('0x1e')]=qs[_0x563a('0x1e')](_0x4aaa3d[_0x563a('0x36')][_0x563a('0x1e')]);_0x2e5c4b[_0x563a('0x1f')]=qs['offset'](_0x4aaa3d[_0x563a('0x36')][_0x563a('0x1f')]);}_0x2e5c4b[_0x563a('0x3e')]=qs['sort'](_0x4aaa3d[_0x563a('0x36')]['sort']);_0x2e5c4b[_0x563a('0x3f')]=qs[_0x563a('0x37')](_['pick'](_0x4aaa3d['query'],_0x3a59cb[_0x563a('0x37')]),_0x166f89);if(_0x4aaa3d['query'][_0x563a('0x40')]){_0x2e5c4b[_0x563a('0x3f')]=_[_0x563a('0x41')](_0x2e5c4b[_0x563a('0x3f')],{'$or':_['map'](_0x166f89,function(_0x47d37a){if(_0x47d37a[_0x563a('0x33')]!=='VIRTUAL'){var _0x46d471={};_0x46d471[_0x47d37a[_0x563a('0x2d')]]={'$like':'%'+_0x4aaa3d[_0x563a('0x36')][_0x563a('0x40')]+'%'};return _0x46d471;}})});}_0x2e5c4b=_[_0x563a('0x41')]({},_0x2e5c4b,_0x4aaa3d[_0x563a('0x42')]);var _0x4bf555={'where':_0x2e5c4b[_0x563a('0x3f')]};return db['ContactItemType'][_0x563a('0x20')](_0x4bf555)['then'](function(_0x20c142){_0x28a8f6[_0x563a('0x20')]=_0x20c142;if(_0x4aaa3d[_0x563a('0x36')][_0x563a('0x43')]){_0x2e5c4b['include']=[{'all':!![]}];}return db['ContactItemType']['findAll'](_0x2e5c4b);})[_0x563a('0x26')](function(_0x1255da){_0x28a8f6[_0x563a('0x44')]=_0x1255da;return _0x28a8f6;})[_0x563a('0x26')](respondWithFilteredResult(_0x1e8d43,_0x2e5c4b))[_0x563a('0x45')](handleError(_0x1e8d43,null));};exports[_0x563a('0x46')]=function(_0x29a1c0,_0x2ca0f4){var _0x19c2cc={'raw':!![],'where':{'id':_0x29a1c0[_0x563a('0x47')]['id']}},_0x433353={};_0x433353[_0x563a('0x35')]=_[_0x563a('0x48')](db[_0x563a('0x31')][_0x563a('0x49')]);_0x433353[_0x563a('0x36')]=_[_0x563a('0x48')](_0x29a1c0[_0x563a('0x36')]);_0x433353[_0x563a('0x37')]=_['intersection'](_0x433353['model'],_0x433353[_0x563a('0x36')]);_0x19c2cc[_0x563a('0x39')]=_[_0x563a('0x38')](_0x433353[_0x563a('0x35')],qs[_0x563a('0x3a')](_0x29a1c0[_0x563a('0x36')][_0x563a('0x3a')]));_0x19c2cc[_0x563a('0x39')]=_0x19c2cc['attributes']['length']?_0x19c2cc[_0x563a('0x39')]:_0x433353[_0x563a('0x35')];if(_0x29a1c0[_0x563a('0x36')][_0x563a('0x43')]){_0x19c2cc[_0x563a('0x4a')]=[{'all':!![]}];}_0x19c2cc=_[_0x563a('0x41')]({},_0x19c2cc,_0x29a1c0[_0x563a('0x42')]);return db[_0x563a('0x31')]['find'](_0x19c2cc)[_0x563a('0x26')](handleEntityNotFound(_0x2ca0f4,null))[_0x563a('0x26')](respondWithResult(_0x2ca0f4,null))['catch'](handleError(_0x2ca0f4,null));};exports[_0x563a('0x4b')]=function(_0x5a063a,_0x3ea787){return db[_0x563a('0x31')][_0x563a('0x4b')](_0x5a063a['body'],{})[_0x563a('0x26')](function(_0x23efcf){var _0xb1dbc8=_0x5a063a[_0x563a('0x4c')][_0x563a('0x28')]({'plain':!![]});if(!_0xb1dbc8)throw new Error(_0x563a('0x4d'));if(_0xb1dbc8[_0x563a('0x4e')]===_0x563a('0x4c')){var _0x277d54=_0x23efcf[_0x563a('0x28')]({'plain':!![]});var _0x3c98d5=_0x563a('0x29');return db[_0x563a('0x4f')]['find']({'where':{'name':_0x3c98d5,'userProfileId':_0xb1dbc8['userProfileId']},'raw':!![]})[_0x563a('0x26')](function(_0xaae9fd){if(_0xaae9fd&&_0xaae9fd[_0x563a('0x50')]===0x0){return db['UserProfileResource']['create']({'name':_0x277d54[_0x563a('0x2d')],'resourceId':_0x277d54['id'],'type':_0xaae9fd[_0x563a('0x2d')],'sectionId':_0xaae9fd['id']},{})['then'](function(){return _0x23efcf;});}else{return _0x23efcf;}})['catch'](function(_0x51e142){logger[_0x563a('0x2b')](_0x563a('0x51'),_0x51e142);throw _0x51e142;});}return _0x23efcf;})[_0x563a('0x26')](respondWithResult(_0x3ea787,0xc9))[_0x563a('0x45')](handleError(_0x3ea787,null));};exports[_0x563a('0x25')]=function(_0x2805eb,_0x4dd257){if(_0x2805eb['body']['id']){delete _0x2805eb[_0x563a('0x52')]['id'];}return db['ContactItemType'][_0x563a('0x53')]({'where':{'id':_0x2805eb[_0x563a('0x47')]['id']}})[_0x563a('0x26')](handleEntityNotFound(_0x4dd257,null))[_0x563a('0x26')](saveUpdates(_0x2805eb[_0x563a('0x52')],null))[_0x563a('0x26')](respondWithResult(_0x4dd257,null))[_0x563a('0x45')](handleError(_0x4dd257,null));};exports['destroy']=function(_0x22cc91,_0x227372){return db['ContactItemType'][_0x563a('0x53')]({'where':{'id':_0x22cc91[_0x563a('0x47')]['id']}})[_0x563a('0x26')](handleEntityNotFound(_0x227372,null))[_0x563a('0x26')](db[_0x563a('0x54')][_0x563a('0x25')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x22cc91[_0x563a('0x47')]['id']}}))[_0x563a('0x26')](removeEntity(_0x227372,null))[_0x563a('0x45')](handleError(_0x227372,null));}; \ No newline at end of file +var _0xf4f4=['json','apply','reject','save','update','then','get','ContactItemTypes','UserProfileResource','destroy','end','sendStatus','name','send','index','map','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','ContactItemType','includeAll','show','include','find','catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','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','status','offset','undefined','limit','count','set','Content-Range'];(function(_0x31b08c,_0x17c4f9){var _0x6ca169=function(_0x13c86d){while(--_0x13c86d){_0x31b08c['push'](_0x31b08c['shift']());}};_0x6ca169(++_0x17c4f9);}(_0xf4f4,0xe3));var _0x4f4f=function(_0x3e81d0,_0x6e0c2b){_0x3e81d0=_0x3e81d0-0x0;var _0x3e77ed=_0xf4f4[_0x3e81d0];return _0x3e77ed;};'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'];function respondWithStatusCode(_0x1b54b0,_0x282031){_0x282031=_0x282031||0xcc;return function(_0x1d7575){if(_0x1d7575){return _0x1b54b0['sendStatus'](_0x282031);}return _0x1b54b0[_0x4f4f('0x1b')](_0x282031)['end']();};}function respondWithResult(_0x216ba8,_0xe7c2d5){_0xe7c2d5=_0xe7c2d5||0xc8;return function(_0x3e16e9){if(_0x3e16e9){return _0x216ba8[_0x4f4f('0x1b')](_0xe7c2d5)['json'](_0x3e16e9);}};}function respondWithFilteredResult(_0x19f2fd,_0x4c68f4){return function(_0x47ab66){if(_0x47ab66){var _0x58de77=typeof _0x4c68f4[_0x4f4f('0x1c')]===_0x4f4f('0x1d')&&typeof _0x4c68f4[_0x4f4f('0x1e')]===_0x4f4f('0x1d');var _0x2d5e5d=_0x47ab66[_0x4f4f('0x1f')];var _0x1245c4=_0x58de77?0x0:_0x4c68f4[_0x4f4f('0x1c')];var _0x929a0b=_0x58de77?_0x47ab66[_0x4f4f('0x1f')]:_0x4c68f4[_0x4f4f('0x1c')]+_0x4c68f4[_0x4f4f('0x1e')];var _0x499277;if(_0x929a0b>=_0x2d5e5d){_0x929a0b=_0x2d5e5d;_0x499277=0xc8;}else{_0x499277=0xce;}_0x19f2fd[_0x4f4f('0x1b')](_0x499277);return _0x19f2fd[_0x4f4f('0x20')](_0x4f4f('0x21'),_0x1245c4+'-'+_0x929a0b+'/'+_0x2d5e5d)[_0x4f4f('0x22')](_0x47ab66);}return null;};}function patchUpdates(_0x302a79){return function(_0x460b4d){try{jsonpatch[_0x4f4f('0x23')](_0x460b4d,_0x302a79,!![]);}catch(_0x3e33d5){return BPromise[_0x4f4f('0x24')](_0x3e33d5);}return _0x460b4d[_0x4f4f('0x25')]();};}function saveUpdates(_0x469a1d,_0x17832f){return function(_0x17984d){if(_0x17984d){return _0x17984d[_0x4f4f('0x26')](_0x469a1d)['then'](function(_0x4f7261){return _0x4f7261;});}return null;};}function removeEntity(_0x525529,_0x272125){return function(_0x43e661){if(_0x43e661){return _0x43e661['destroy']()[_0x4f4f('0x27')](function(){var _0x15859c=_0x43e661[_0x4f4f('0x28')]({'plain':!![]});var _0x2ec92a=_0x4f4f('0x29');return db[_0x4f4f('0x2a')][_0x4f4f('0x2b')]({'where':{'type':_0x2ec92a,'resourceId':_0x15859c['id']}})['then'](function(){return _0x43e661;});})[_0x4f4f('0x27')](function(){_0x525529[_0x4f4f('0x1b')](0xcc)[_0x4f4f('0x2c')]();});}};}function handleEntityNotFound(_0x15c79c,_0x18e864){return function(_0x4ad33d){if(!_0x4ad33d){_0x15c79c[_0x4f4f('0x2d')](0x194);}return _0x4ad33d;};}function handleError(_0xaf3de1,_0x7180f8){_0x7180f8=_0x7180f8||0x1f4;return function(_0x5deda9){logger['error'](_0x5deda9['stack']);if(_0x5deda9[_0x4f4f('0x2e')]){delete _0x5deda9['name'];}_0xaf3de1[_0x4f4f('0x1b')](_0x7180f8)[_0x4f4f('0x2f')](_0x5deda9);};}exports[_0x4f4f('0x30')]=function(_0x5eb7c9,_0x460546){var _0x1b6f53={},_0x5dd5a3={},_0x413b71={'count':0x0,'rows':[]};var _0x1a551a=_[_0x4f4f('0x31')](db['ContactItemType'][_0x4f4f('0x32')],function(_0x343c75){return{'name':_0x343c75['fieldName'],'type':_0x343c75['type'][_0x4f4f('0x33')]};});_0x5dd5a3[_0x4f4f('0x34')]=_[_0x4f4f('0x31')](_0x1a551a,_0x4f4f('0x2e'));_0x5dd5a3[_0x4f4f('0x35')]=_[_0x4f4f('0x36')](_0x5eb7c9[_0x4f4f('0x35')]);_0x5dd5a3[_0x4f4f('0x37')]=_[_0x4f4f('0x38')](_0x5dd5a3[_0x4f4f('0x34')],_0x5dd5a3['query']);_0x1b6f53['attributes']=_[_0x4f4f('0x38')](_0x5dd5a3['model'],qs[_0x4f4f('0x39')](_0x5eb7c9[_0x4f4f('0x35')][_0x4f4f('0x39')]));_0x1b6f53[_0x4f4f('0x3a')]=_0x1b6f53[_0x4f4f('0x3a')][_0x4f4f('0x3b')]?_0x1b6f53[_0x4f4f('0x3a')]:_0x5dd5a3[_0x4f4f('0x34')];if(!_0x5eb7c9[_0x4f4f('0x35')][_0x4f4f('0x3c')](_0x4f4f('0x3d'))){_0x1b6f53[_0x4f4f('0x1e')]=qs['limit'](_0x5eb7c9[_0x4f4f('0x35')][_0x4f4f('0x1e')]);_0x1b6f53[_0x4f4f('0x1c')]=qs[_0x4f4f('0x1c')](_0x5eb7c9[_0x4f4f('0x35')][_0x4f4f('0x1c')]);}_0x1b6f53[_0x4f4f('0x3e')]=qs[_0x4f4f('0x3f')](_0x5eb7c9[_0x4f4f('0x35')]['sort']);_0x1b6f53[_0x4f4f('0x40')]=qs[_0x4f4f('0x37')](_[_0x4f4f('0x41')](_0x5eb7c9['query'],_0x5dd5a3['filters']),_0x1a551a);if(_0x5eb7c9[_0x4f4f('0x35')][_0x4f4f('0x42')]){_0x1b6f53[_0x4f4f('0x40')]=_[_0x4f4f('0x43')](_0x1b6f53[_0x4f4f('0x40')],{'$or':_[_0x4f4f('0x31')](_0x1a551a,function(_0x1c012d){if(_0x1c012d[_0x4f4f('0x44')]!==_0x4f4f('0x45')){var _0x455aa0={};_0x455aa0[_0x1c012d[_0x4f4f('0x2e')]]={'$like':'%'+_0x5eb7c9[_0x4f4f('0x35')]['filter']+'%'};return _0x455aa0;}})});}_0x1b6f53=_[_0x4f4f('0x43')]({},_0x1b6f53,_0x5eb7c9[_0x4f4f('0x46')]);var _0x306ee7={'where':_0x1b6f53[_0x4f4f('0x40')]};return db[_0x4f4f('0x47')]['count'](_0x306ee7)['then'](function(_0x134710){_0x413b71[_0x4f4f('0x1f')]=_0x134710;if(_0x5eb7c9[_0x4f4f('0x35')][_0x4f4f('0x48')]){_0x1b6f53['include']=[{'all':!![]}];}return db[_0x4f4f('0x47')]['findAll'](_0x1b6f53);})[_0x4f4f('0x27')](function(_0x5a7c94){_0x413b71['rows']=_0x5a7c94;return _0x413b71;})[_0x4f4f('0x27')](respondWithFilteredResult(_0x460546,_0x1b6f53))['catch'](handleError(_0x460546,null));};exports[_0x4f4f('0x49')]=function(_0x2af7a7,_0x5e1c20){var _0x220df1={'raw':!![],'where':{'id':_0x2af7a7['params']['id']}},_0x2d8ff6={};_0x2d8ff6[_0x4f4f('0x34')]=_[_0x4f4f('0x36')](db[_0x4f4f('0x47')][_0x4f4f('0x32')]);_0x2d8ff6[_0x4f4f('0x35')]=_[_0x4f4f('0x36')](_0x2af7a7[_0x4f4f('0x35')]);_0x2d8ff6[_0x4f4f('0x37')]=_[_0x4f4f('0x38')](_0x2d8ff6[_0x4f4f('0x34')],_0x2d8ff6[_0x4f4f('0x35')]);_0x220df1[_0x4f4f('0x3a')]=_[_0x4f4f('0x38')](_0x2d8ff6[_0x4f4f('0x34')],qs[_0x4f4f('0x39')](_0x2af7a7['query'][_0x4f4f('0x39')]));_0x220df1['attributes']=_0x220df1['attributes'][_0x4f4f('0x3b')]?_0x220df1[_0x4f4f('0x3a')]:_0x2d8ff6['model'];if(_0x2af7a7[_0x4f4f('0x35')][_0x4f4f('0x48')]){_0x220df1[_0x4f4f('0x4a')]=[{'all':!![]}];}_0x220df1=_[_0x4f4f('0x43')]({},_0x220df1,_0x2af7a7[_0x4f4f('0x46')]);return db['ContactItemType'][_0x4f4f('0x4b')](_0x220df1)[_0x4f4f('0x27')](handleEntityNotFound(_0x5e1c20,null))[_0x4f4f('0x27')](respondWithResult(_0x5e1c20,null))[_0x4f4f('0x4c')](handleError(_0x5e1c20,null));};exports[_0x4f4f('0x4d')]=function(_0x433787,_0x29314b){return db[_0x4f4f('0x47')][_0x4f4f('0x4d')](_0x433787['body'],{})[_0x4f4f('0x27')](function(_0xd3b763){var _0x4b33a5=_0x433787['user']['get']({'plain':!![]});if(!_0x4b33a5)throw new Error(_0x4f4f('0x4e'));if(_0x4b33a5[_0x4f4f('0x4f')]===_0x4f4f('0x50')){var _0x5c5077=_0xd3b763[_0x4f4f('0x28')]({'plain':!![]});var _0x5db92e=_0x4f4f('0x29');return db[_0x4f4f('0x51')][_0x4f4f('0x4b')]({'where':{'name':_0x5db92e,'userProfileId':_0x4b33a5[_0x4f4f('0x52')]},'raw':!![]})[_0x4f4f('0x27')](function(_0x1d0867){if(_0x1d0867&&_0x1d0867[_0x4f4f('0x53')]===0x0){return db[_0x4f4f('0x2a')][_0x4f4f('0x4d')]({'name':_0x5c5077['name'],'resourceId':_0x5c5077['id'],'type':_0x1d0867['name'],'sectionId':_0x1d0867['id']},{})[_0x4f4f('0x27')](function(){return _0xd3b763;});}else{return _0xd3b763;}})[_0x4f4f('0x4c')](function(_0x4c04eb){logger['error'](_0x4f4f('0x54'),_0x4c04eb);throw _0x4c04eb;});}return _0xd3b763;})[_0x4f4f('0x27')](respondWithResult(_0x29314b,0xc9))[_0x4f4f('0x4c')](handleError(_0x29314b,null));};exports['update']=function(_0x4a7622,_0x27c7fc){if(_0x4a7622[_0x4f4f('0x55')]['id']){delete _0x4a7622[_0x4f4f('0x55')]['id'];}return db[_0x4f4f('0x47')][_0x4f4f('0x4b')]({'where':{'id':_0x4a7622[_0x4f4f('0x56')]['id']}})[_0x4f4f('0x27')](handleEntityNotFound(_0x27c7fc,null))[_0x4f4f('0x27')](saveUpdates(_0x4a7622[_0x4f4f('0x55')],null))[_0x4f4f('0x27')](respondWithResult(_0x27c7fc,null))[_0x4f4f('0x4c')](handleError(_0x27c7fc,null));};exports['destroy']=function(_0x585c06,_0x376aea){return db[_0x4f4f('0x47')][_0x4f4f('0x4b')]({'where':{'id':_0x585c06[_0x4f4f('0x56')]['id']}})['then'](handleEntityNotFound(_0x376aea,null))[_0x4f4f('0x27')](db['CmContactHasItem'][_0x4f4f('0x26')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x585c06[_0x4f4f('0x56')]['id']}}))[_0x4f4f('0x27')](removeEntity(_0x376aea,null))['catch'](handleError(_0x376aea,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index eb984bf..d6f42aa 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 _0x1a40=['path','rimraf','../../config/environment','tools_contact_item_types','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x316c42,_0x3391f0){var _0x2b38f7=function(_0x38d2cf){while(--_0x38d2cf){_0x316c42['push'](_0x316c42['shift']());}};_0x2b38f7(++_0x3391f0);}(_0x1a40,0x1ee));var _0x01a4=function(_0x466f01,_0x30e16e){_0x466f01=_0x466f01-0x0;var _0x17253d=_0x1a40[_0x466f01];return _0x17253d;};'use strict';var _=require(_0x01a4('0x0'));var util=require(_0x01a4('0x1'));var logger=require(_0x01a4('0x2'))(_0x01a4('0x3'));var moment=require(_0x01a4('0x4'));var BPromise=require(_0x01a4('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x01a4('0x6'));var rimraf=require(_0x01a4('0x7'));var config=require(_0x01a4('0x8'));var attributes=require('./contactItemType.attributes');module['exports']=function(_0xbbcffb,_0x33759a){return _0xbbcffb['define']('ContactItemType',attributes,{'tableName':_0x01a4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x10dc=['./contactItemType.attributes','exports','tools_contact_item_types','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment'];(function(_0xb42d97,_0x25ad2b){var _0x6bb565=function(_0x5c5e48){while(--_0x5c5e48){_0xb42d97['push'](_0xb42d97['shift']());}};_0x6bb565(++_0x25ad2b);}(_0x10dc,0x1f2));var _0xc10d=function(_0x17e315,_0x361db6){_0x17e315=_0x17e315-0x0;var _0x3e7afb=_0x10dc[_0x17e315];return _0x3e7afb;};'use strict';var _=require(_0xc10d('0x0'));var util=require(_0xc10d('0x1'));var logger=require(_0xc10d('0x2'))(_0xc10d('0x3'));var moment=require(_0xc10d('0x4'));var BPromise=require(_0xc10d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc10d('0x6'));var rimraf=require('rimraf');var config=require(_0xc10d('0x7'));var attributes=require(_0xc10d('0x8'));module[_0xc10d('0x9')]=function(_0x41800f,_0x5caa22){return _0x41800f['define']('ContactItemType',attributes,{'tableName':_0xc10d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.rpc.js b/server/api/contactItemType/contactItemType.rpc.js index 07663b5..0c63da9 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 _0xe84b=['http','request','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe84b,0x1ab));var _0xbe84=function(_0x5990f9,_0x2c21df){_0x5990f9=_0x5990f9-0x0;var _0x89a579=_0xe84b[_0x5990f9];return _0x89a579;};'use strict';var _=require(_0xbe84('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xbe84('0x1'));var rs=require(_0xbe84('0x2'));var fs=require('fs');var Redis=require(_0xbe84('0x3'));var db=require(_0xbe84('0x4'))['db'];var utils=require(_0xbe84('0x5'));var logger=require(_0xbe84('0x6'))('rpc');var config=require(_0xbe84('0x7'));var jayson=require(_0xbe84('0x8'));var client=jayson[_0xbe84('0x9')][_0xbe84('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2f6a27,_0x2d747b,_0x2775e3){return new BPromise(function(_0x1f9736,_0x54df33){return client[_0xbe84('0xb')](_0x2f6a27,_0x2775e3)['then'](function(_0x3ae5c9){logger['info'](_0xbe84('0xc'),_0x2d747b,_0xbe84('0xd'));logger[_0xbe84('0xe')](_0xbe84('0xf'),_0x2d747b,'request\x20sent',JSON[_0xbe84('0x10')](_0x3ae5c9));if(_0x3ae5c9['error']){if(_0x3ae5c9[_0xbe84('0x11')][_0xbe84('0x12')]===0x1f4){logger[_0xbe84('0x11')](_0xbe84('0xc'),_0x2d747b,_0x3ae5c9[_0xbe84('0x11')][_0xbe84('0x13')]);return _0x54df33(_0x3ae5c9['error']['message']);}logger[_0xbe84('0x11')](_0xbe84('0xc'),_0x2d747b,_0x3ae5c9['error']['message']);return _0x1f9736(_0x3ae5c9[_0xbe84('0x11')][_0xbe84('0x13')]);}else{logger[_0xbe84('0x14')]('ContactItemType,\x20%s,\x20%s',_0x2d747b,_0xbe84('0xd'));_0x1f9736(_0x3ae5c9[_0xbe84('0x15')][_0xbe84('0x13')]);}})[_0xbe84('0x16')](function(_0x3b03d4){logger['error'](_0xbe84('0xc'),_0x2d747b,_0x3b03d4);_0x54df33(_0x3b03d4);});});} \ No newline at end of file +var _0xc2e9=['util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','info','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0xc2e9,0xce));var _0x9c2e=function(_0x2db400,_0xa167c8){_0x2db400=_0x2db400-0x0;var _0x4074a6=_0xc2e9[_0x2db400];return _0x4074a6;};'use strict';var _=require(_0x9c2e('0x0'));var util=require(_0x9c2e('0x1'));var moment=require(_0x9c2e('0x2'));var BPromise=require(_0x9c2e('0x3'));var rs=require(_0x9c2e('0x4'));var fs=require('fs');var Redis=require(_0x9c2e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x9c2e('0x6'));var logger=require(_0x9c2e('0x7'))('rpc');var config=require(_0x9c2e('0x8'));var jayson=require(_0x9c2e('0x9'));var client=jayson[_0x9c2e('0xa')][_0x9c2e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3b3425,_0x4ae4d9,_0x19d0c3){return new BPromise(function(_0x1ef014,_0xc7f2c5){return client['request'](_0x3b3425,_0x19d0c3)['then'](function(_0xe4e95c){logger[_0x9c2e('0xc')](_0x9c2e('0xd'),_0x4ae4d9,_0x9c2e('0xe'));logger[_0x9c2e('0xf')](_0x9c2e('0x10'),_0x4ae4d9,_0x9c2e('0xe'),JSON[_0x9c2e('0x11')](_0xe4e95c));if(_0xe4e95c[_0x9c2e('0x12')]){if(_0xe4e95c[_0x9c2e('0x12')][_0x9c2e('0x13')]===0x1f4){logger['error']('ContactItemType,\x20%s,\x20%s',_0x4ae4d9,_0xe4e95c[_0x9c2e('0x12')][_0x9c2e('0x14')]);return _0xc7f2c5(_0xe4e95c[_0x9c2e('0x12')]['message']);}logger[_0x9c2e('0x12')](_0x9c2e('0xd'),_0x4ae4d9,_0xe4e95c[_0x9c2e('0x12')]['message']);return _0x1ef014(_0xe4e95c[_0x9c2e('0x12')][_0x9c2e('0x14')]);}else{logger['info'](_0x9c2e('0xd'),_0x4ae4d9,_0x9c2e('0xe'));_0x1ef014(_0xe4e95c[_0x9c2e('0x15')][_0x9c2e('0x14')]);}})[_0x9c2e('0x16')](function(_0x9a64ca){logger[_0x9c2e('0x12')](_0x9c2e('0xd'),_0x4ae4d9,_0x9a64ca);_0xc7f2c5(_0x9a64ca);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index 01d09d0..50d8fa5 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 _0x8af4=['../../components/auth/service','../../components/interaction/service','../../config/environment','./contactItemType.controller','get','isAuthenticated','/:id','show','post','update','destroy','exports','multer','path','connect-timeout','express','fs-extra'];(function(_0x213612,_0x531a54){var _0x52f2db=function(_0x137cff){while(--_0x137cff){_0x213612['push'](_0x213612['shift']());}};_0x52f2db(++_0x531a54);}(_0x8af4,0xe9));var _0x48af=function(_0x3b8363,_0x17bc8){_0x3b8363=_0x3b8363-0x0;var _0x4d8289=_0x8af4[_0x3b8363];return _0x4d8289;};'use strict';var multer=require(_0x48af('0x0'));var util=require('util');var path=require(_0x48af('0x1'));var timeout=require(_0x48af('0x2'));var express=require(_0x48af('0x3'));var router=express['Router']();var fs_extra=require(_0x48af('0x4'));var auth=require(_0x48af('0x5'));var interaction=require(_0x48af('0x6'));var config=require(_0x48af('0x7'));var controller=require(_0x48af('0x8'));router[_0x48af('0x9')]('/',auth[_0x48af('0xa')](),controller['index']);router['get'](_0x48af('0xb'),auth['isAuthenticated'](),controller[_0x48af('0xc')]);router[_0x48af('0xd')]('/',auth[_0x48af('0xa')](),controller['create']);router['put'](_0x48af('0xb'),auth[_0x48af('0xa')](),controller[_0x48af('0xe')]);router['delete'](_0x48af('0xb'),auth[_0x48af('0xa')](),controller[_0x48af('0xf')]);module[_0x48af('0x10')]=router; \ No newline at end of file +var _0x14a1=['create','update','delete','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post'];(function(_0x14cc92,_0x350557){var _0x2c1883=function(_0x5f3b11){while(--_0x5f3b11){_0x14cc92['push'](_0x14cc92['shift']());}};_0x2c1883(++_0x350557);}(_0x14a1,0x17e));var _0x114a=function(_0x336667,_0x5b0005){_0x336667=_0x336667-0x0;var _0x6fe29c=_0x14a1[_0x336667];return _0x6fe29c;};'use strict';var multer=require(_0x114a('0x0'));var util=require('util');var path=require(_0x114a('0x1'));var timeout=require(_0x114a('0x2'));var express=require('express');var router=express[_0x114a('0x3')]();var fs_extra=require(_0x114a('0x4'));var auth=require(_0x114a('0x5'));var interaction=require(_0x114a('0x6'));var config=require(_0x114a('0x7'));var controller=require('./contactItemType.controller');router[_0x114a('0x8')]('/',auth[_0x114a('0x9')](),controller[_0x114a('0xa')]);router['get'](_0x114a('0xb'),auth['isAuthenticated'](),controller[_0x114a('0xc')]);router[_0x114a('0xd')]('/',auth[_0x114a('0x9')](),controller[_0x114a('0xe')]);router['put'](_0x114a('0xb'),auth[_0x114a('0x9')](),controller[_0x114a('0xf')]);router[_0x114a('0x10')]('/:id',auth[_0x114a('0x9')](),controller['destroy']);module[_0x114a('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 5c5405a..d3dc64a 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 _0xb10b=['name','sequelize','STRING'];(function(_0x46e7eb,_0x5ef44b){var _0x30fa82=function(_0x42a952){while(--_0x42a952){_0x46e7eb['push'](_0x46e7eb['shift']());}};_0x30fa82(++_0x5ef44b);}(_0xb10b,0x12a));var _0xbb10=function(_0x1ea015,_0x5e416a){_0x1ea015=_0x1ea015-0x0;var _0x5ed37f=_0xb10b[_0x1ea015];return _0x5ed37f;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'name':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![],'unique':_0xbb10('0x2')},'description':{'type':Sequelize[_0xbb10('0x1')]}}; \ No newline at end of file +var _0x757a=['exports','STRING'];(function(_0x2e82c0,_0x2f0a17){var _0xeea72c=function(_0x5093d9){while(--_0x5093d9){_0x2e82c0['push'](_0x2e82c0['shift']());}};_0xeea72c(++_0x2f0a17);}(_0x757a,0xde));var _0xa757=function(_0x76fb8d,_0x29d8d6){_0x76fb8d=_0x76fb8d-0x0;var _0x4a8d84=_0x757a[_0x76fb8d];return _0x4a8d84;};'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/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 4e9ca17..093378e 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 _0xd44c=['mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','end','status','json','offset','limit','count','set','Content-Range','apply','reject','save','update','then','get','CustomDashboards','UserProfileResource','stack','name','send','map','Dashboard','rawAttributes','fieldName','key','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','model','keys','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','length','omit','body','createdAt','updatedAt','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','iframe','attrUrl','attrs','value','https://','clock','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','DashboardId','DashboardItem','getItems','findOne','pick','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird'];(function(_0x4e0a1d,_0x2b977e){var _0x152a30=function(_0x3de8fa){while(--_0x3de8fa){_0x4e0a1d['push'](_0x4e0a1d['shift']());}};_0x152a30(++_0x2b977e);}(_0xd44c,0xfc));var _0xcd44=function(_0x33bc64,_0x4d1e92){_0x33bc64=_0x33bc64-0x0;var _0x3fdd34=_0xd44c[_0x33bc64];return _0x3fdd34;};'use strict';var emlformat=require(_0xcd44('0x0'));var rimraf=require(_0xcd44('0x1'));var zipdir=require(_0xcd44('0x2'));var jsonpatch=require(_0xcd44('0x3'));var rp=require('request-promise');var moment=require(_0xcd44('0x4'));var BPromise=require(_0xcd44('0x5'));var Mustache=require(_0xcd44('0x6'));var util=require(_0xcd44('0x7'));var path=require(_0xcd44('0x8'));var sox=require(_0xcd44('0x9'));var csv=require('to-csv');var ejs=require(_0xcd44('0xa'));var fs=require('fs');var fs_extra=require(_0xcd44('0xb'));var _=require(_0xcd44('0xc'));var squel=require(_0xcd44('0xd'));var crypto=require(_0xcd44('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xcd44('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xcd44('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xcd44('0x11'));var as=require(_0xcd44('0x12'));var hardwareService=require(_0xcd44('0x13'));var logger=require(_0xcd44('0x14'))(_0xcd44('0x15'));var utils=require(_0xcd44('0x16'));var config=require(_0xcd44('0x17'));var licenseUtil=require(_0xcd44('0x18'));var db=require(_0xcd44('0x19'))['db'];config[_0xcd44('0x1a')]=_[_0xcd44('0x1b')](config[_0xcd44('0x1a')],{'host':_0xcd44('0x1c'),'port':0x18eb});var socket=require(_0xcd44('0x1d'))(new Redis(config[_0xcd44('0x1a')]));require('./dashboard.socket')[_0xcd44('0x1e')](socket);function respondWithStatusCode(_0x5c75fe,_0x547159){_0x547159=_0x547159||0xcc;return function(_0x4740cd){if(_0x4740cd){return _0x5c75fe[_0xcd44('0x1f')](_0x547159);}return _0x5c75fe['status'](_0x547159)[_0xcd44('0x20')]();};}function respondWithResult(_0x3bd15d,_0x1dd159){_0x1dd159=_0x1dd159||0xc8;return function(_0x439273){if(_0x439273){return _0x3bd15d[_0xcd44('0x21')](_0x1dd159)[_0xcd44('0x22')](_0x439273);}};}function respondWithFilteredResult(_0x1e8c6c,_0x493dfd){return function(_0x103f18){if(_0x103f18){var _0x50fa10=typeof _0x493dfd[_0xcd44('0x23')]==='undefined'&&typeof _0x493dfd[_0xcd44('0x24')]==='undefined';var _0x54170b=_0x103f18['count'];var _0x4e552a=_0x50fa10?0x0:_0x493dfd[_0xcd44('0x23')];var _0x498e9a=_0x50fa10?_0x103f18[_0xcd44('0x25')]:_0x493dfd['offset']+_0x493dfd[_0xcd44('0x24')];var _0x3fb3b9;if(_0x498e9a>=_0x54170b){_0x498e9a=_0x54170b;_0x3fb3b9=0xc8;}else{_0x3fb3b9=0xce;}_0x1e8c6c[_0xcd44('0x21')](_0x3fb3b9);return _0x1e8c6c[_0xcd44('0x26')](_0xcd44('0x27'),_0x4e552a+'-'+_0x498e9a+'/'+_0x54170b)[_0xcd44('0x22')](_0x103f18);}return null;};}function patchUpdates(_0x49e4c8){return function(_0x29c11a){try{jsonpatch[_0xcd44('0x28')](_0x29c11a,_0x49e4c8,!![]);}catch(_0x605be1){return BPromise[_0xcd44('0x29')](_0x605be1);}return _0x29c11a[_0xcd44('0x2a')]();};}function saveUpdates(_0x3de621,_0x1b5fba){return function(_0x4f8c18){if(_0x4f8c18){return _0x4f8c18[_0xcd44('0x2b')](_0x3de621)['then'](function(_0x4f4c06){return _0x4f4c06;});}return null;};}function removeEntity(_0x166aae,_0x46f53f){return function(_0x30b0de){if(_0x30b0de){return _0x30b0de['destroy']()[_0xcd44('0x2c')](function(){var _0x536ea5=_0x30b0de[_0xcd44('0x2d')]({'plain':!![]});var _0x54724c=_0xcd44('0x2e');return db[_0xcd44('0x2f')]['destroy']({'where':{'type':_0x54724c,'resourceId':_0x536ea5['id']}})[_0xcd44('0x2c')](function(){return _0x30b0de;});})[_0xcd44('0x2c')](function(){_0x166aae['status'](0xcc)[_0xcd44('0x20')]();});}};}function handleEntityNotFound(_0x44b71a,_0x21aa03){return function(_0x54fe28){if(!_0x54fe28){_0x44b71a[_0xcd44('0x1f')](0x194);}return _0x54fe28;};}function handleError(_0x4b4c0f,_0x12b511){_0x12b511=_0x12b511||0x1f4;return function(_0x43555d){logger['error'](_0x43555d[_0xcd44('0x30')]);if(_0x43555d[_0xcd44('0x31')]){delete _0x43555d[_0xcd44('0x31')];}_0x4b4c0f[_0xcd44('0x21')](_0x12b511)[_0xcd44('0x32')](_0x43555d);};}exports['index']=function(_0x1a218e,_0xb112f5){var _0x47edd9={},_0x2c5196={},_0x297ad6={'count':0x0,'rows':[]};var _0x4cf76e=_[_0xcd44('0x33')](db[_0xcd44('0x34')][_0xcd44('0x35')],function(_0x3d7a26){return{'name':_0x3d7a26[_0xcd44('0x36')],'type':_0x3d7a26['type'][_0xcd44('0x37')]};});_0x2c5196['model']=_[_0xcd44('0x33')](_0x4cf76e,_0xcd44('0x31'));_0x2c5196[_0xcd44('0x38')]=_['keys'](_0x1a218e[_0xcd44('0x38')]);_0x2c5196['filters']=_[_0xcd44('0x39')](_0x2c5196['model'],_0x2c5196[_0xcd44('0x38')]);_0x47edd9[_0xcd44('0x3a')]=_['intersection'](_0x2c5196['model'],qs['fields'](_0x1a218e[_0xcd44('0x38')][_0xcd44('0x3b')]));_0x47edd9[_0xcd44('0x3a')]=_0x47edd9[_0xcd44('0x3a')]['length']?_0x47edd9[_0xcd44('0x3a')]:_0x2c5196['model'];if(!_0x1a218e[_0xcd44('0x38')][_0xcd44('0x3c')](_0xcd44('0x3d'))){_0x47edd9[_0xcd44('0x24')]=qs[_0xcd44('0x24')](_0x1a218e[_0xcd44('0x38')][_0xcd44('0x24')]);_0x47edd9['offset']=qs['offset'](_0x1a218e['query'][_0xcd44('0x23')]);}_0x47edd9[_0xcd44('0x3e')]=qs[_0xcd44('0x3f')](_0x1a218e[_0xcd44('0x38')][_0xcd44('0x3f')]);_0x47edd9[_0xcd44('0x40')]=qs['filters'](_['pick'](_0x1a218e['query'],_0x2c5196[_0xcd44('0x41')]),_0x4cf76e);if(_0x1a218e[_0xcd44('0x38')]['filter']){_0x47edd9[_0xcd44('0x40')]=_[_0xcd44('0x42')](_0x47edd9[_0xcd44('0x40')],{'$or':_[_0xcd44('0x33')](_0x4cf76e,function(_0x26a016){if(_0x26a016[_0xcd44('0x43')]!==_0xcd44('0x44')){var _0x2d109b={};_0x2d109b[_0x26a016[_0xcd44('0x31')]]={'$like':'%'+_0x1a218e[_0xcd44('0x38')]['filter']+'%'};return _0x2d109b;}})});}_0x47edd9=_[_0xcd44('0x42')]({},_0x47edd9,_0x1a218e[_0xcd44('0x45')]);var _0x26e767={'where':_0x47edd9['where']};return db[_0xcd44('0x34')][_0xcd44('0x25')](_0x26e767)[_0xcd44('0x2c')](function(_0x356d07){_0x297ad6[_0xcd44('0x25')]=_0x356d07;if(_0x1a218e[_0xcd44('0x38')][_0xcd44('0x46')]){_0x47edd9[_0xcd44('0x47')]=[{'all':!![]}];}return db[_0xcd44('0x34')][_0xcd44('0x48')](_0x47edd9);})[_0xcd44('0x2c')](function(_0x2828f8){_0x297ad6[_0xcd44('0x49')]=_0x2828f8;return _0x297ad6;})['then'](respondWithFilteredResult(_0xb112f5,_0x47edd9))[_0xcd44('0x4a')](handleError(_0xb112f5,null));};exports['show']=function(_0x17b7f8,_0x39ecb3){var _0x4f230a={'raw':![],'where':{'id':_0x17b7f8[_0xcd44('0x4b')]['id']}},_0x315d2c={};_0x315d2c[_0xcd44('0x4c')]=_[_0xcd44('0x4d')](db['Dashboard']['rawAttributes']);_0x315d2c['query']=_[_0xcd44('0x4d')](_0x17b7f8[_0xcd44('0x38')]);_0x315d2c[_0xcd44('0x41')]=_[_0xcd44('0x39')](_0x315d2c[_0xcd44('0x4c')],_0x315d2c[_0xcd44('0x38')]);_0x4f230a['attributes']=_[_0xcd44('0x39')](_0x315d2c[_0xcd44('0x4c')],qs[_0xcd44('0x3b')](_0x17b7f8[_0xcd44('0x38')]['fields']));_0x4f230a['attributes']=_0x4f230a[_0xcd44('0x3a')]['length']?_0x4f230a[_0xcd44('0x3a')]:_0x315d2c[_0xcd44('0x4c')];if(_0x17b7f8[_0xcd44('0x38')][_0xcd44('0x46')]){_0x4f230a['include']=[{'all':!![]}];}_0x4f230a=_[_0xcd44('0x42')]({},_0x4f230a,_0x17b7f8['options']);return db[_0xcd44('0x34')][_0xcd44('0x4e')](_0x4f230a)[_0xcd44('0x2c')](handleEntityNotFound(_0x39ecb3,null))[_0xcd44('0x2c')](respondWithResult(_0x39ecb3,null))[_0xcd44('0x4a')](handleError(_0x39ecb3,null));};exports[_0xcd44('0x4f')]=function(_0x51c02e,_0x1f1848){return db[_0xcd44('0x34')][_0xcd44('0x4f')](_0x51c02e['body'],{})['then'](function(_0x1c0ec5){var _0x37a3ac=_0x51c02e[_0xcd44('0x50')][_0xcd44('0x2d')]({'plain':!![]});if(!_0x37a3ac)throw new Error(_0xcd44('0x51'));if(_0x37a3ac[_0xcd44('0x52')]===_0xcd44('0x50')){var _0x2d5ad5=_0x1c0ec5[_0xcd44('0x2d')]({'plain':!![]});var _0x297dfa=_0xcd44('0x2e');return db[_0xcd44('0x53')]['find']({'where':{'name':_0x297dfa,'userProfileId':_0x37a3ac[_0xcd44('0x54')]},'raw':!![]})['then'](function(_0x2eb33d){if(_0x2eb33d&&_0x2eb33d[_0xcd44('0x55')]===0x0){return db[_0xcd44('0x2f')][_0xcd44('0x4f')]({'name':_0x2d5ad5[_0xcd44('0x31')],'resourceId':_0x2d5ad5['id'],'type':_0x2eb33d[_0xcd44('0x31')],'sectionId':_0x2eb33d['id']},{})[_0xcd44('0x2c')](function(){return _0x1c0ec5;});}else{return _0x1c0ec5;}})[_0xcd44('0x4a')](function(_0xa1d78a){logger[_0xcd44('0x56')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xa1d78a);throw _0xa1d78a;});}return _0x1c0ec5;})[_0xcd44('0x2c')](respondWithResult(_0x1f1848,0xc9))[_0xcd44('0x4a')](handleError(_0x1f1848,null));};exports['clone']=function(_0x3d4ba8,_0x52f8f0){var _0x5bf03a={'where':{'id':_0x3d4ba8['params']['id']}},_0x1a3dea={};_0x1a3dea[_0xcd44('0x4c')]=_[_0xcd44('0x4d')](db[_0xcd44('0x34')]['rawAttributes']);_0x5bf03a[_0xcd44('0x3a')]=_[_0xcd44('0x39')](_0x1a3dea[_0xcd44('0x4c')],qs[_0xcd44('0x3b')](_0x3d4ba8['query'][_0xcd44('0x3b')]));_0x5bf03a[_0xcd44('0x3a')]=_0x5bf03a[_0xcd44('0x3a')][_0xcd44('0x57')]?_0x5bf03a[_0xcd44('0x3a')]:_0x1a3dea[_0xcd44('0x4c')];if(_0x3d4ba8[_0xcd44('0x38')][_0xcd44('0x46')]){_0x5bf03a[_0xcd44('0x47')]=[{'all':!![]}];}_0x5bf03a=_[_0xcd44('0x42')]({},_0x5bf03a,_0x3d4ba8[_0xcd44('0x45')]);return db[_0xcd44('0x34')][_0xcd44('0x4e')](_0x5bf03a)[_0xcd44('0x2c')](handleEntityNotFound(_0x52f8f0,null))['then'](function(_0x2fd590){if(_0x2fd590){var _0x1faefd=_0x2fd590[_0xcd44('0x2d')]({'plain':!![]});_0x1faefd=qs[_0xcd44('0x58')](_0x1faefd,['id','createdAt','updatedAt']);_0x3d4ba8[_0xcd44('0x59')]=_[_0xcd44('0x58')](_0x3d4ba8[_0xcd44('0x59')],['id',_0xcd44('0x5a'),_0xcd44('0x5b')]);return db['Dashboard'][_0xcd44('0x4f')](_[_0xcd44('0x42')](_0x1faefd,_0x3d4ba8['body']),{'include':_0x3d4ba8[_0xcd44('0x38')]['includeAll']?[{'all':!![]}]:undefined})[_0xcd44('0x2c')](function(_0x1f0c42){var _0x293f10=_0x3d4ba8[_0xcd44('0x50')][_0xcd44('0x2d')]({'plain':!![]});if(!_0x293f10)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x293f10[_0xcd44('0x52')]===_0xcd44('0x50')){var _0x4dcda7=_0x1f0c42[_0xcd44('0x2d')]({'plain':!![]});var _0x5c4812=_0xcd44('0x2e');return db[_0xcd44('0x53')][_0xcd44('0x4e')]({'where':{'name':_0x5c4812,'userProfileId':_0x293f10['userProfileId']},'raw':!![]})[_0xcd44('0x2c')](function(_0x292b15){if(_0x292b15&&_0x292b15[_0xcd44('0x55')]===0x0){return db[_0xcd44('0x2f')][_0xcd44('0x4f')]({'name':_0x4dcda7[_0xcd44('0x31')],'resourceId':_0x4dcda7['id'],'type':_0x292b15[_0xcd44('0x31')],'sectionId':_0x292b15['id']},{})[_0xcd44('0x2c')](function(){return _0x1f0c42;});}else{return _0x1f0c42;}})[_0xcd44('0x4a')](function(_0x5a05f2){logger[_0xcd44('0x56')](_0xcd44('0x5c'),_0x5a05f2);throw _0x5a05f2;});}return _0x1f0c42;});}})[_0xcd44('0x2c')](respondWithResult(_0x52f8f0,0xc9))[_0xcd44('0x4a')](handleError(_0x52f8f0,null));};exports[_0xcd44('0x2b')]=function(_0x17049a,_0x25c2d9){if(_0x17049a[_0xcd44('0x59')]['id']){delete _0x17049a[_0xcd44('0x59')]['id'];}return db[_0xcd44('0x34')][_0xcd44('0x4e')]({'where':{'id':_0x17049a[_0xcd44('0x4b')]['id']}})['then'](handleEntityNotFound(_0x25c2d9,null))[_0xcd44('0x2c')](saveUpdates(_0x17049a[_0xcd44('0x59')],null))[_0xcd44('0x2c')](respondWithResult(_0x25c2d9,null))[_0xcd44('0x4a')](handleError(_0x25c2d9,null));};exports[_0xcd44('0x5d')]=function(_0x25ba9c,_0x5f3d8b){return db[_0xcd44('0x34')][_0xcd44('0x4e')]({'where':{'id':_0x25ba9c[_0xcd44('0x4b')]['id']}})[_0xcd44('0x2c')](handleEntityNotFound(_0x5f3d8b,null))['then'](removeEntity(_0x5f3d8b,null))[_0xcd44('0x4a')](handleError(_0x5f3d8b,null));};function widgetAttributes(_0x46d639){try{switch(_0x46d639[_0xcd44('0x43')]){case _0xcd44('0x5e'):return[{'name':'attrUrl','value':_0x46d639[_0xcd44('0x5f')]||(_0x46d639[_0xcd44('0x60')]&&_0x46d639[_0xcd44('0x60')][0x0]?_0x46d639['attrs'][0x0][_0xcd44('0x61')]:undefined)||_0xcd44('0x62')}];case'custom':return[{'name':'attrPath','value':_0x46d639['attrPath']||(_0x46d639[_0xcd44('0x60')]&&_0x46d639['attrs'][0x0]?_0x46d639[_0xcd44('0x60')][0x0]['value']:undefined)||''}];case _0xcd44('0x63'):return[{'name':'attrHourFormat','value':_0x46d639['attrHourFormat']||(_0x46d639[_0xcd44('0x60')]&&_0x46d639[_0xcd44('0x60')][0x0]?_0x46d639[_0xcd44('0x60')][0x0][_0xcd44('0x61')]:undefined)||_0xcd44('0x64')},{'name':_0xcd44('0x65'),'value':_0x46d639['attrTimezone']||(_0x46d639[_0xcd44('0x60')]&&_0x46d639[_0xcd44('0x60')][0x1]?_0x46d639[_0xcd44('0x60')][0x1]['value']:undefined)||_0xcd44('0x66')},{'name':'attrFontSize','value':_0x46d639[_0xcd44('0x67')]||(_0x46d639[_0xcd44('0x60')]&&_0x46d639[_0xcd44('0x60')][0x2]?_0x46d639[_0xcd44('0x60')][0x2][_0xcd44('0x61')]:undefined)||0xc}];case _0xcd44('0x68'):return[{'name':'attrMetric','value':_0x46d639['attrMetric']||(_0x46d639[_0xcd44('0x60')]&&_0x46d639[_0xcd44('0x60')][0x0]?_0x46d639[_0xcd44('0x60')][0x0][_0xcd44('0x61')]:undefined)||_0xcd44('0x69')},{'name':_0xcd44('0x6a'),'value':_0x46d639[_0xcd44('0x6a')]||(_0x46d639[_0xcd44('0x60')]&&_0x46d639['attrs'][0x1]?_0x46d639[_0xcd44('0x60')][0x1][_0xcd44('0x61')]:undefined)||[]},{'name':_0xcd44('0x67'),'value':_0x46d639[_0xcd44('0x67')]||(_0x46d639[_0xcd44('0x60')]&&_0x46d639[_0xcd44('0x60')][0x2]?_0x46d639[_0xcd44('0x60')][0x2][_0xcd44('0x61')]:undefined)||0x14},{'name':_0xcd44('0x6b'),'value':_0x46d639[_0xcd44('0x6b')]||(_0x46d639[_0xcd44('0x60')]&&_0x46d639['attrs'][0x3]?_0x46d639[_0xcd44('0x60')][0x3][_0xcd44('0x61')]:undefined)||_0xcd44('0x6c')},{'name':_0xcd44('0x6d'),'value':_0x46d639[_0xcd44('0x6d')]||(_0x46d639[_0xcd44('0x60')]&&_0x46d639['attrs'][0x4]?_0x46d639[_0xcd44('0x60')][0x4][_0xcd44('0x61')]:undefined)||''},{'name':_0xcd44('0x6e'),'value':_0x46d639['attrFaxAccounts']||(_0x46d639[_0xcd44('0x60')]&&_0x46d639['attrs'][0x5]?_0x46d639[_0xcd44('0x60')][0x5][_0xcd44('0x61')]:undefined)||''},{'name':_0xcd44('0x6f'),'value':_0x46d639[_0xcd44('0x6f')]||(_0x46d639['attrs']&&_0x46d639[_0xcd44('0x60')][0x6]?_0x46d639['attrs'][0x6][_0xcd44('0x61')]:undefined)||''},{'name':_0xcd44('0x70'),'value':_0x46d639[_0xcd44('0x70')]||(_0x46d639['attrs']&&_0x46d639['attrs'][0x7]?_0x46d639['attrs'][0x7][_0xcd44('0x61')]:undefined)||''},{'name':_0xcd44('0x71'),'value':_0x46d639['attrWhatsappAccounts']||(_0x46d639[_0xcd44('0x60')]&&_0x46d639[_0xcd44('0x60')][0x8]?_0x46d639[_0xcd44('0x60')][0x8][_0xcd44('0x61')]:undefined)||''},{'name':_0xcd44('0x72'),'value':_0x46d639[_0xcd44('0x72')]||(_0x46d639['attrs']&&_0x46d639[_0xcd44('0x60')][0x9]?_0x46d639[_0xcd44('0x60')][0x9][_0xcd44('0x61')]:undefined)||''}];case'multibar-chart':case _0xcd44('0x73'):return[{'name':_0xcd44('0x74'),'value':_0x46d639['attrSerie1']||(_0x46d639[_0xcd44('0x60')]&&_0x46d639[_0xcd44('0x60')][0x0]?_0x46d639[_0xcd44('0x60')][0x0][_0xcd44('0x61')]:undefined)||_0xcd44('0x69')},{'name':'attrSerie2','value':_0x46d639[_0xcd44('0x75')]||(_0x46d639[_0xcd44('0x60')]&&_0x46d639[_0xcd44('0x60')][0x1]?_0x46d639[_0xcd44('0x60')][0x1][_0xcd44('0x61')]:undefined)||null},{'name':_0xcd44('0x76'),'value':_0x46d639[_0xcd44('0x76')]||(_0x46d639['attrs']&&_0x46d639['attrs'][0x2]?_0x46d639[_0xcd44('0x60')][0x2][_0xcd44('0x61')]:undefined)||null},{'name':_0xcd44('0x6a'),'value':_0x46d639[_0xcd44('0x6a')]||(_0x46d639[_0xcd44('0x60')]&&_0x46d639[_0xcd44('0x60')][0x3]?_0x46d639[_0xcd44('0x60')][0x3][_0xcd44('0x61')]:undefined)||[]},{'name':_0xcd44('0x6b'),'value':_0x46d639['attrChannel']||(_0x46d639[_0xcd44('0x60')]&&_0x46d639[_0xcd44('0x60')][0x4]?_0x46d639['attrs'][0x4][_0xcd44('0x61')]:undefined)||'voice'},{'name':'attrEmailAccounts','value':_0x46d639[_0xcd44('0x6d')]||(_0x46d639[_0xcd44('0x60')]&&_0x46d639[_0xcd44('0x60')][0x5]?_0x46d639[_0xcd44('0x60')][0x5][_0xcd44('0x61')]:undefined)||''},{'name':_0xcd44('0x6e'),'value':_0x46d639[_0xcd44('0x6e')]||(_0x46d639[_0xcd44('0x60')]&&_0x46d639[_0xcd44('0x60')][0x6]?_0x46d639[_0xcd44('0x60')][0x6][_0xcd44('0x61')]:undefined)||''},{'name':_0xcd44('0x6f'),'value':_0x46d639[_0xcd44('0x6f')]||(_0x46d639[_0xcd44('0x60')]&&_0x46d639[_0xcd44('0x60')][0x7]?_0x46d639[_0xcd44('0x60')][0x7][_0xcd44('0x61')]:undefined)||''},{'name':_0xcd44('0x70'),'value':_0x46d639[_0xcd44('0x70')]||(_0x46d639[_0xcd44('0x60')]&&_0x46d639[_0xcd44('0x60')][0x8]?_0x46d639[_0xcd44('0x60')][0x8][_0xcd44('0x61')]:undefined)||''},{'name':_0xcd44('0x71'),'value':_0x46d639[_0xcd44('0x71')]||(_0x46d639['attrs']&&_0x46d639[_0xcd44('0x60')][0x9]?_0x46d639[_0xcd44('0x60')][0x9][_0xcd44('0x61')]:undefined)||''},{'name':'attrChatWebsites','value':_0x46d639['attrChatWebsites']||(_0x46d639[_0xcd44('0x60')]&&_0x46d639['attrs'][0xa]?_0x46d639[_0xcd44('0x60')][0xa][_0xcd44('0x61')]:undefined)||''}];case _0xcd44('0x77'):return[{'name':_0xcd44('0x78'),'type':_0x46d639[_0xcd44('0x79')]||(_0x46d639[_0xcd44('0x60')]&&_0x46d639[_0xcd44('0x60')][0x0]?_0x46d639[_0xcd44('0x60')][0x0]['type']:undefined)||null,'value':_0x46d639[_0xcd44('0x78')]||(_0x46d639[_0xcd44('0x60')]&&_0x46d639[_0xcd44('0x60')][0x0]?_0x46d639[_0xcd44('0x60')][0x0]['value']:undefined)||null},{'name':_0xcd44('0x7a'),'value':_0x46d639[_0xcd44('0x7a')]||(_0x46d639[_0xcd44('0x60')]&&_0x46d639['attrs'][0x1]?_0x46d639[_0xcd44('0x60')][0x1][_0xcd44('0x61')]:undefined)||0x0}];default:return[];}}catch(_0x3777d0){logger[_0xcd44('0x56')](_0xcd44('0x7b'),JSON['stringify'](_0x3777d0));return[];}}exports['addItem']=function(_0x30d0e2,_0x2a9402,_0x8c1b48){if(_0x30d0e2[_0xcd44('0x59')]['id']){delete _0x30d0e2['body']['id'];}return db[_0xcd44('0x34')][_0xcd44('0x4e')]({'where':{'id':_0x30d0e2[_0xcd44('0x4b')]['id']}})[_0xcd44('0x2c')](handleEntityNotFound(_0x2a9402,null))[_0xcd44('0x2c')](function(_0x5e0f8b){if(_0x5e0f8b){_0x30d0e2[_0xcd44('0x59')][_0xcd44('0x7c')]=_0x5e0f8b['id'];_0x30d0e2[_0xcd44('0x59')][_0xcd44('0x60')]=widgetAttributes(_0x30d0e2[_0xcd44('0x59')]);return db[_0xcd44('0x7d')][_0xcd44('0x4f')](_0x30d0e2[_0xcd44('0x59')]);}})[_0xcd44('0x2c')](respondWithResult(_0x2a9402,null))[_0xcd44('0x4a')](handleError(_0x2a9402,null));};exports[_0xcd44('0x7e')]=function(_0x5f2a57,_0x3a993f,_0x3e65b8){var _0x22317a={};var _0x4964a2={};var _0x341cff;var _0x247d30;return db['Dashboard'][_0xcd44('0x7f')]({'where':{'id':_0x5f2a57['params']['id']}})['then'](handleEntityNotFound(_0x3a993f,null))['then'](function(_0x356437){if(_0x356437){_0x341cff=_0x356437;_0x4964a2[_0xcd44('0x4c')]=_['keys'](db['DashboardItem'][_0xcd44('0x35')]);_0x4964a2['query']=_[_0xcd44('0x4d')](_0x5f2a57['query']);_0x4964a2['filters']=_[_0xcd44('0x39')](_0x4964a2[_0xcd44('0x4c')],_0x4964a2[_0xcd44('0x38')]);_0x22317a['attributes']=_['intersection'](_0x4964a2[_0xcd44('0x4c')],qs[_0xcd44('0x3b')](_0x5f2a57[_0xcd44('0x38')][_0xcd44('0x3b')]));_0x22317a[_0xcd44('0x3a')]=_0x22317a[_0xcd44('0x3a')][_0xcd44('0x57')]?_0x22317a[_0xcd44('0x3a')]:_0x4964a2[_0xcd44('0x4c')];_0x22317a['order']=qs[_0xcd44('0x3f')](_0x5f2a57[_0xcd44('0x38')][_0xcd44('0x3f')]);_0x22317a[_0xcd44('0x40')]=qs[_0xcd44('0x41')](_[_0xcd44('0x80')](_0x5f2a57[_0xcd44('0x38')],_0x4964a2[_0xcd44('0x41')]));if(_0x5f2a57[_0xcd44('0x38')]['filter']){_0x22317a['where']=_[_0xcd44('0x42')](_0x22317a[_0xcd44('0x40')],{'$or':_[_0xcd44('0x33')](_0x22317a[_0xcd44('0x3a')],function(_0x1b1fe5){var _0x3b8d54={};_0x3b8d54[_0x1b1fe5]={'$like':'%'+_0x5f2a57[_0xcd44('0x38')]['filter']+'%'};return _0x3b8d54;})});}_0x22317a=_[_0xcd44('0x42')]({},_0x22317a,_0x5f2a57[_0xcd44('0x45')]);return _0x341cff['getItems'](_0x22317a);}})[_0xcd44('0x2c')](function(_0x1e4f0b){if(_0x1e4f0b){_0x247d30=_0x1e4f0b[_0xcd44('0x57')];if(!_0x5f2a57[_0xcd44('0x38')][_0xcd44('0x3c')](_0xcd44('0x3d'))){_0x22317a[_0xcd44('0x24')]=qs['limit'](_0x5f2a57[_0xcd44('0x38')][_0xcd44('0x24')]);_0x22317a[_0xcd44('0x23')]=qs[_0xcd44('0x23')](_0x5f2a57[_0xcd44('0x38')][_0xcd44('0x23')]);}return _0x341cff[_0xcd44('0x7e')](_0x22317a);}})[_0xcd44('0x2c')](function(_0x2023c2){if(_0x2023c2){return _0x2023c2?{'count':_0x247d30,'rows':_0x2023c2}:null;}})['then'](respondWithResult(_0x3a993f,null))[_0xcd44('0x4a')](handleError(_0x3a993f,null));}; \ No newline at end of file +var _0x6dee=['fieldName','model','keys','query','filters','attributes','intersection','fields','length','sort','where','pick','merge','type','VIRTUAL','filter','options','Dashboard','includeAll','findAll','rows','catch','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','include','omit','createdAt','updatedAt','role','CustomDashboards','iframe','attrs','value','https://','attrPath','attrHourFormat','HH:mm:ss','attrFontSize','counter','attrMetric','total','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrVoiceQueues','attrChannel','web-report','attrReport','attrRefresh','stringify','DashboardId','DashboardItem','getItems','findOne','order','hasOwnProperty','eml-format','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','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./dashboard.socket','sendStatus','status','undefined','limit','count','offset','set','Content-Range','json','apply','reject','update','then','destroy','get','UserProfileResource','end','error','stack','name','index','map','rawAttributes'];(function(_0x4d82ea,_0x4d459f){var _0x257f4a=function(_0x424c4f){while(--_0x424c4f){_0x4d82ea['push'](_0x4d82ea['shift']());}};_0x257f4a(++_0x4d459f);}(_0x6dee,0x14a));var _0xe6de=function(_0x332887,_0x4a9530){_0x332887=_0x332887-0x0;var _0x1cc068=_0x6dee[_0x332887];return _0x1cc068;};'use strict';var emlformat=require(_0xe6de('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xe6de('0x1'));var rp=require('request-promise');var moment=require(_0xe6de('0x2'));var BPromise=require(_0xe6de('0x3'));var Mustache=require(_0xe6de('0x4'));var util=require(_0xe6de('0x5'));var path=require(_0xe6de('0x6'));var sox=require(_0xe6de('0x7'));var csv=require(_0xe6de('0x8'));var ejs=require(_0xe6de('0x9'));var fs=require('fs');var fs_extra=require(_0xe6de('0xa'));var _=require(_0xe6de('0xb'));var squel=require(_0xe6de('0xc'));var crypto=require(_0xe6de('0xd'));var jsforce=require(_0xe6de('0xe'));var deskjs=require(_0xe6de('0xf'));var toCsv=require(_0xe6de('0x8'));var querystring=require(_0xe6de('0x10'));var Papa=require('papaparse');var Redis=require(_0xe6de('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xe6de('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe6de('0x13'));var logger=require(_0xe6de('0x14'))(_0xe6de('0x15'));var utils=require(_0xe6de('0x16'));var config=require(_0xe6de('0x17'));var licenseUtil=require(_0xe6de('0x18'));var db=require(_0xe6de('0x19'))['db'];config['redis']=_[_0xe6de('0x1a')](config[_0xe6de('0x1b')],{'host':_0xe6de('0x1c'),'port':0x18eb});var socket=require(_0xe6de('0x1d'))(new Redis(config[_0xe6de('0x1b')]));require(_0xe6de('0x1e'))['register'](socket);function respondWithStatusCode(_0x59d2a7,_0x34ceb5){_0x34ceb5=_0x34ceb5||0xcc;return function(_0x22098f){if(_0x22098f){return _0x59d2a7[_0xe6de('0x1f')](_0x34ceb5);}return _0x59d2a7[_0xe6de('0x20')](_0x34ceb5)['end']();};}function respondWithResult(_0x845ac4,_0x2aed2c){_0x2aed2c=_0x2aed2c||0xc8;return function(_0x23f1a3){if(_0x23f1a3){return _0x845ac4['status'](_0x2aed2c)['json'](_0x23f1a3);}};}function respondWithFilteredResult(_0x1c6785,_0x2d63b8){return function(_0x13b8c0){if(_0x13b8c0){var _0x5112de=typeof _0x2d63b8['offset']===_0xe6de('0x21')&&typeof _0x2d63b8[_0xe6de('0x22')]===_0xe6de('0x21');var _0x5dbbcb=_0x13b8c0[_0xe6de('0x23')];var _0x177806=_0x5112de?0x0:_0x2d63b8[_0xe6de('0x24')];var _0x2db8f3=_0x5112de?_0x13b8c0['count']:_0x2d63b8[_0xe6de('0x24')]+_0x2d63b8['limit'];var _0x41b4ca;if(_0x2db8f3>=_0x5dbbcb){_0x2db8f3=_0x5dbbcb;_0x41b4ca=0xc8;}else{_0x41b4ca=0xce;}_0x1c6785[_0xe6de('0x20')](_0x41b4ca);return _0x1c6785[_0xe6de('0x25')](_0xe6de('0x26'),_0x177806+'-'+_0x2db8f3+'/'+_0x5dbbcb)[_0xe6de('0x27')](_0x13b8c0);}return null;};}function patchUpdates(_0x189c5d){return function(_0x468a52){try{jsonpatch[_0xe6de('0x28')](_0x468a52,_0x189c5d,!![]);}catch(_0x195d70){return BPromise[_0xe6de('0x29')](_0x195d70);}return _0x468a52['save']();};}function saveUpdates(_0x188cfb,_0x1ce27e){return function(_0x3f64eb){if(_0x3f64eb){return _0x3f64eb[_0xe6de('0x2a')](_0x188cfb)[_0xe6de('0x2b')](function(_0x4e6b14){return _0x4e6b14;});}return null;};}function removeEntity(_0x35e530,_0x368089){return function(_0xef1cd6){if(_0xef1cd6){return _0xef1cd6[_0xe6de('0x2c')]()['then'](function(){var _0x4be4ae=_0xef1cd6[_0xe6de('0x2d')]({'plain':!![]});var _0x4afdd0='CustomDashboards';return db[_0xe6de('0x2e')][_0xe6de('0x2c')]({'where':{'type':_0x4afdd0,'resourceId':_0x4be4ae['id']}})[_0xe6de('0x2b')](function(){return _0xef1cd6;});})[_0xe6de('0x2b')](function(){_0x35e530[_0xe6de('0x20')](0xcc)[_0xe6de('0x2f')]();});}};}function handleEntityNotFound(_0x1bbad4,_0x114bb1){return function(_0x3c9278){if(!_0x3c9278){_0x1bbad4[_0xe6de('0x1f')](0x194);}return _0x3c9278;};}function handleError(_0x36d096,_0x3a5952){_0x3a5952=_0x3a5952||0x1f4;return function(_0x95afba){logger[_0xe6de('0x30')](_0x95afba[_0xe6de('0x31')]);if(_0x95afba[_0xe6de('0x32')]){delete _0x95afba[_0xe6de('0x32')];}_0x36d096[_0xe6de('0x20')](_0x3a5952)['send'](_0x95afba);};}exports[_0xe6de('0x33')]=function(_0x2f2588,_0x3042e7){var _0x431b1b={},_0x1ca46e={},_0x50d6fa={'count':0x0,'rows':[]};var _0x1d5a7=_[_0xe6de('0x34')](db['Dashboard'][_0xe6de('0x35')],function(_0xc666f2){return{'name':_0xc666f2[_0xe6de('0x36')],'type':_0xc666f2['type']['key']};});_0x1ca46e[_0xe6de('0x37')]=_['map'](_0x1d5a7,'name');_0x1ca46e['query']=_[_0xe6de('0x38')](_0x2f2588[_0xe6de('0x39')]);_0x1ca46e[_0xe6de('0x3a')]=_['intersection'](_0x1ca46e[_0xe6de('0x37')],_0x1ca46e[_0xe6de('0x39')]);_0x431b1b[_0xe6de('0x3b')]=_[_0xe6de('0x3c')](_0x1ca46e['model'],qs[_0xe6de('0x3d')](_0x2f2588['query'][_0xe6de('0x3d')]));_0x431b1b['attributes']=_0x431b1b['attributes'][_0xe6de('0x3e')]?_0x431b1b['attributes']:_0x1ca46e[_0xe6de('0x37')];if(!_0x2f2588[_0xe6de('0x39')]['hasOwnProperty']('nolimit')){_0x431b1b[_0xe6de('0x22')]=qs['limit'](_0x2f2588[_0xe6de('0x39')][_0xe6de('0x22')]);_0x431b1b[_0xe6de('0x24')]=qs['offset'](_0x2f2588[_0xe6de('0x39')][_0xe6de('0x24')]);}_0x431b1b['order']=qs[_0xe6de('0x3f')](_0x2f2588[_0xe6de('0x39')]['sort']);_0x431b1b[_0xe6de('0x40')]=qs['filters'](_[_0xe6de('0x41')](_0x2f2588[_0xe6de('0x39')],_0x1ca46e['filters']),_0x1d5a7);if(_0x2f2588[_0xe6de('0x39')]['filter']){_0x431b1b[_0xe6de('0x40')]=_[_0xe6de('0x42')](_0x431b1b[_0xe6de('0x40')],{'$or':_[_0xe6de('0x34')](_0x1d5a7,function(_0x4bbfb8){if(_0x4bbfb8[_0xe6de('0x43')]!==_0xe6de('0x44')){var _0x46ea38={};_0x46ea38[_0x4bbfb8['name']]={'$like':'%'+_0x2f2588[_0xe6de('0x39')][_0xe6de('0x45')]+'%'};return _0x46ea38;}})});}_0x431b1b=_['merge']({},_0x431b1b,_0x2f2588[_0xe6de('0x46')]);var _0x29dcec={'where':_0x431b1b[_0xe6de('0x40')]};return db[_0xe6de('0x47')][_0xe6de('0x23')](_0x29dcec)[_0xe6de('0x2b')](function(_0xba16c3){_0x50d6fa[_0xe6de('0x23')]=_0xba16c3;if(_0x2f2588[_0xe6de('0x39')][_0xe6de('0x48')]){_0x431b1b['include']=[{'all':!![]}];}return db[_0xe6de('0x47')][_0xe6de('0x49')](_0x431b1b);})[_0xe6de('0x2b')](function(_0x1b8135){_0x50d6fa[_0xe6de('0x4a')]=_0x1b8135;return _0x50d6fa;})[_0xe6de('0x2b')](respondWithFilteredResult(_0x3042e7,_0x431b1b))[_0xe6de('0x4b')](handleError(_0x3042e7,null));};exports['show']=function(_0x13f20e,_0x73be44){var _0x5702da={'raw':![],'where':{'id':_0x13f20e[_0xe6de('0x4c')]['id']}},_0xd4b501={};_0xd4b501[_0xe6de('0x37')]=_[_0xe6de('0x38')](db[_0xe6de('0x47')][_0xe6de('0x35')]);_0xd4b501['query']=_[_0xe6de('0x38')](_0x13f20e[_0xe6de('0x39')]);_0xd4b501[_0xe6de('0x3a')]=_[_0xe6de('0x3c')](_0xd4b501[_0xe6de('0x37')],_0xd4b501[_0xe6de('0x39')]);_0x5702da['attributes']=_[_0xe6de('0x3c')](_0xd4b501[_0xe6de('0x37')],qs['fields'](_0x13f20e[_0xe6de('0x39')][_0xe6de('0x3d')]));_0x5702da['attributes']=_0x5702da[_0xe6de('0x3b')][_0xe6de('0x3e')]?_0x5702da[_0xe6de('0x3b')]:_0xd4b501['model'];if(_0x13f20e['query'][_0xe6de('0x48')]){_0x5702da['include']=[{'all':!![]}];}_0x5702da=_[_0xe6de('0x42')]({},_0x5702da,_0x13f20e[_0xe6de('0x46')]);return db[_0xe6de('0x47')][_0xe6de('0x4d')](_0x5702da)[_0xe6de('0x2b')](handleEntityNotFound(_0x73be44,null))[_0xe6de('0x2b')](respondWithResult(_0x73be44,null))[_0xe6de('0x4b')](handleError(_0x73be44,null));};exports[_0xe6de('0x4e')]=function(_0x1ff6d6,_0x3d7c80){return db[_0xe6de('0x47')]['create'](_0x1ff6d6[_0xe6de('0x4f')],{})[_0xe6de('0x2b')](function(_0x57f521){var _0x2f23bb=_0x1ff6d6[_0xe6de('0x50')][_0xe6de('0x2d')]({'plain':!![]});if(!_0x2f23bb)throw new Error(_0xe6de('0x51'));if(_0x2f23bb['role']==='user'){var _0x393de9=_0x57f521[_0xe6de('0x2d')]({'plain':!![]});var _0x1bd0cc='CustomDashboards';return db[_0xe6de('0x52')][_0xe6de('0x4d')]({'where':{'name':_0x1bd0cc,'userProfileId':_0x2f23bb[_0xe6de('0x53')]},'raw':!![]})[_0xe6de('0x2b')](function(_0x235758){if(_0x235758&&_0x235758[_0xe6de('0x54')]===0x0){return db[_0xe6de('0x2e')]['create']({'name':_0x393de9[_0xe6de('0x32')],'resourceId':_0x393de9['id'],'type':_0x235758['name'],'sectionId':_0x235758['id']},{})[_0xe6de('0x2b')](function(){return _0x57f521;});}else{return _0x57f521;}})[_0xe6de('0x4b')](function(_0x3b4816){logger[_0xe6de('0x30')](_0xe6de('0x55'),_0x3b4816);throw _0x3b4816;});}return _0x57f521;})[_0xe6de('0x2b')](respondWithResult(_0x3d7c80,0xc9))[_0xe6de('0x4b')](handleError(_0x3d7c80,null));};exports[_0xe6de('0x56')]=function(_0x579718,_0x104427){var _0xfe5100={'where':{'id':_0x579718[_0xe6de('0x4c')]['id']}},_0x30d981={};_0x30d981['model']=_[_0xe6de('0x38')](db[_0xe6de('0x47')]['rawAttributes']);_0xfe5100[_0xe6de('0x3b')]=_[_0xe6de('0x3c')](_0x30d981[_0xe6de('0x37')],qs[_0xe6de('0x3d')](_0x579718[_0xe6de('0x39')][_0xe6de('0x3d')]));_0xfe5100['attributes']=_0xfe5100[_0xe6de('0x3b')]['length']?_0xfe5100[_0xe6de('0x3b')]:_0x30d981[_0xe6de('0x37')];if(_0x579718[_0xe6de('0x39')]['includeAll']){_0xfe5100[_0xe6de('0x57')]=[{'all':!![]}];}_0xfe5100=_[_0xe6de('0x42')]({},_0xfe5100,_0x579718[_0xe6de('0x46')]);return db['Dashboard'][_0xe6de('0x4d')](_0xfe5100)[_0xe6de('0x2b')](handleEntityNotFound(_0x104427,null))[_0xe6de('0x2b')](function(_0x5f2a08){if(_0x5f2a08){var _0x1d54e8=_0x5f2a08[_0xe6de('0x2d')]({'plain':!![]});_0x1d54e8=qs[_0xe6de('0x58')](_0x1d54e8,['id',_0xe6de('0x59'),_0xe6de('0x5a')]);_0x579718[_0xe6de('0x4f')]=_[_0xe6de('0x58')](_0x579718[_0xe6de('0x4f')],['id',_0xe6de('0x59'),_0xe6de('0x5a')]);return db['Dashboard']['create'](_[_0xe6de('0x42')](_0x1d54e8,_0x579718[_0xe6de('0x4f')]),{'include':_0x579718['query']['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x212836){var _0x437104=_0x579718[_0xe6de('0x50')][_0xe6de('0x2d')]({'plain':!![]});if(!_0x437104)throw new Error(_0xe6de('0x51'));if(_0x437104[_0xe6de('0x5b')]===_0xe6de('0x50')){var _0x58698d=_0x212836[_0xe6de('0x2d')]({'plain':!![]});var _0xa6b8a3=_0xe6de('0x5c');return db[_0xe6de('0x52')]['find']({'where':{'name':_0xa6b8a3,'userProfileId':_0x437104['userProfileId']},'raw':!![]})[_0xe6de('0x2b')](function(_0x28a932){if(_0x28a932&&_0x28a932[_0xe6de('0x54')]===0x0){return db[_0xe6de('0x2e')][_0xe6de('0x4e')]({'name':_0x58698d[_0xe6de('0x32')],'resourceId':_0x58698d['id'],'type':_0x28a932[_0xe6de('0x32')],'sectionId':_0x28a932['id']},{})['then'](function(){return _0x212836;});}else{return _0x212836;}})[_0xe6de('0x4b')](function(_0x58eed3){logger[_0xe6de('0x30')](_0xe6de('0x55'),_0x58eed3);throw _0x58eed3;});}return _0x212836;});}})['then'](respondWithResult(_0x104427,0xc9))['catch'](handleError(_0x104427,null));};exports[_0xe6de('0x2a')]=function(_0x3b28db,_0x145476){if(_0x3b28db['body']['id']){delete _0x3b28db['body']['id'];}return db[_0xe6de('0x47')][_0xe6de('0x4d')]({'where':{'id':_0x3b28db['params']['id']}})[_0xe6de('0x2b')](handleEntityNotFound(_0x145476,null))[_0xe6de('0x2b')](saveUpdates(_0x3b28db['body'],null))[_0xe6de('0x2b')](respondWithResult(_0x145476,null))['catch'](handleError(_0x145476,null));};exports['destroy']=function(_0x1dfca9,_0x12c7cd){return db['Dashboard'][_0xe6de('0x4d')]({'where':{'id':_0x1dfca9[_0xe6de('0x4c')]['id']}})[_0xe6de('0x2b')](handleEntityNotFound(_0x12c7cd,null))[_0xe6de('0x2b')](removeEntity(_0x12c7cd,null))[_0xe6de('0x4b')](handleError(_0x12c7cd,null));};function widgetAttributes(_0x4ebdfe){try{switch(_0x4ebdfe[_0xe6de('0x43')]){case _0xe6de('0x5d'):return[{'name':'attrUrl','value':_0x4ebdfe['attrUrl']||(_0x4ebdfe[_0xe6de('0x5e')]&&_0x4ebdfe[_0xe6de('0x5e')][0x0]?_0x4ebdfe['attrs'][0x0][_0xe6de('0x5f')]:undefined)||_0xe6de('0x60')}];case'custom':return[{'name':_0xe6de('0x61'),'value':_0x4ebdfe[_0xe6de('0x61')]||(_0x4ebdfe[_0xe6de('0x5e')]&&_0x4ebdfe['attrs'][0x0]?_0x4ebdfe['attrs'][0x0][_0xe6de('0x5f')]:undefined)||''}];case'clock':return[{'name':'attrHourFormat','value':_0x4ebdfe[_0xe6de('0x62')]||(_0x4ebdfe['attrs']&&_0x4ebdfe[_0xe6de('0x5e')][0x0]?_0x4ebdfe['attrs'][0x0][_0xe6de('0x5f')]:undefined)||_0xe6de('0x63')},{'name':'attrTimezone','value':_0x4ebdfe['attrTimezone']||(_0x4ebdfe[_0xe6de('0x5e')]&&_0x4ebdfe[_0xe6de('0x5e')][0x1]?_0x4ebdfe['attrs'][0x1][_0xe6de('0x5f')]:undefined)||'0.00'},{'name':_0xe6de('0x64'),'value':_0x4ebdfe[_0xe6de('0x64')]||(_0x4ebdfe['attrs']&&_0x4ebdfe['attrs'][0x2]?_0x4ebdfe[_0xe6de('0x5e')][0x2]['value']:undefined)||0xc}];case _0xe6de('0x65'):return[{'name':'attrMetric','value':_0x4ebdfe[_0xe6de('0x66')]||(_0x4ebdfe[_0xe6de('0x5e')]&&_0x4ebdfe[_0xe6de('0x5e')][0x0]?_0x4ebdfe[_0xe6de('0x5e')][0x0]['value']:undefined)||_0xe6de('0x67')},{'name':'attrVoiceQueues','value':_0x4ebdfe['attrVoiceQueues']||(_0x4ebdfe[_0xe6de('0x5e')]&&_0x4ebdfe[_0xe6de('0x5e')][0x1]?_0x4ebdfe[_0xe6de('0x5e')][0x1][_0xe6de('0x5f')]:undefined)||[]},{'name':_0xe6de('0x64'),'value':_0x4ebdfe[_0xe6de('0x64')]||(_0x4ebdfe[_0xe6de('0x5e')]&&_0x4ebdfe['attrs'][0x2]?_0x4ebdfe[_0xe6de('0x5e')][0x2][_0xe6de('0x5f')]:undefined)||0x14},{'name':'attrChannel','value':_0x4ebdfe['attrChannel']||(_0x4ebdfe[_0xe6de('0x5e')]&&_0x4ebdfe[_0xe6de('0x5e')][0x3]?_0x4ebdfe[_0xe6de('0x5e')][0x3][_0xe6de('0x5f')]:undefined)||_0xe6de('0x68')},{'name':_0xe6de('0x69'),'value':_0x4ebdfe['attrEmailAccounts']||(_0x4ebdfe[_0xe6de('0x5e')]&&_0x4ebdfe[_0xe6de('0x5e')][0x4]?_0x4ebdfe[_0xe6de('0x5e')][0x4][_0xe6de('0x5f')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x4ebdfe[_0xe6de('0x6a')]||(_0x4ebdfe[_0xe6de('0x5e')]&&_0x4ebdfe[_0xe6de('0x5e')][0x5]?_0x4ebdfe[_0xe6de('0x5e')][0x5]['value']:undefined)||''},{'name':_0xe6de('0x6b'),'value':_0x4ebdfe['attrSmsAccounts']||(_0x4ebdfe['attrs']&&_0x4ebdfe[_0xe6de('0x5e')][0x6]?_0x4ebdfe['attrs'][0x6][_0xe6de('0x5f')]:undefined)||''},{'name':_0xe6de('0x6c'),'value':_0x4ebdfe[_0xe6de('0x6c')]||(_0x4ebdfe[_0xe6de('0x5e')]&&_0x4ebdfe[_0xe6de('0x5e')][0x7]?_0x4ebdfe['attrs'][0x7][_0xe6de('0x5f')]:undefined)||''},{'name':_0xe6de('0x6d'),'value':_0x4ebdfe[_0xe6de('0x6d')]||(_0x4ebdfe[_0xe6de('0x5e')]&&_0x4ebdfe[_0xe6de('0x5e')][0x8]?_0x4ebdfe[_0xe6de('0x5e')][0x8][_0xe6de('0x5f')]:undefined)||''},{'name':_0xe6de('0x6e'),'value':_0x4ebdfe[_0xe6de('0x6e')]||(_0x4ebdfe['attrs']&&_0x4ebdfe[_0xe6de('0x5e')][0x9]?_0x4ebdfe[_0xe6de('0x5e')][0x9][_0xe6de('0x5f')]:undefined)||''}];case _0xe6de('0x6f'):case _0xe6de('0x70'):return[{'name':_0xe6de('0x71'),'value':_0x4ebdfe[_0xe6de('0x71')]||(_0x4ebdfe['attrs']&&_0x4ebdfe[_0xe6de('0x5e')][0x0]?_0x4ebdfe[_0xe6de('0x5e')][0x0][_0xe6de('0x5f')]:undefined)||_0xe6de('0x67')},{'name':_0xe6de('0x72'),'value':_0x4ebdfe[_0xe6de('0x72')]||(_0x4ebdfe[_0xe6de('0x5e')]&&_0x4ebdfe[_0xe6de('0x5e')][0x1]?_0x4ebdfe[_0xe6de('0x5e')][0x1][_0xe6de('0x5f')]:undefined)||null},{'name':_0xe6de('0x73'),'value':_0x4ebdfe[_0xe6de('0x73')]||(_0x4ebdfe['attrs']&&_0x4ebdfe['attrs'][0x2]?_0x4ebdfe[_0xe6de('0x5e')][0x2][_0xe6de('0x5f')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x4ebdfe[_0xe6de('0x74')]||(_0x4ebdfe[_0xe6de('0x5e')]&&_0x4ebdfe['attrs'][0x3]?_0x4ebdfe[_0xe6de('0x5e')][0x3][_0xe6de('0x5f')]:undefined)||[]},{'name':_0xe6de('0x75'),'value':_0x4ebdfe[_0xe6de('0x75')]||(_0x4ebdfe[_0xe6de('0x5e')]&&_0x4ebdfe[_0xe6de('0x5e')][0x4]?_0x4ebdfe[_0xe6de('0x5e')][0x4][_0xe6de('0x5f')]:undefined)||_0xe6de('0x68')},{'name':_0xe6de('0x69'),'value':_0x4ebdfe[_0xe6de('0x69')]||(_0x4ebdfe['attrs']&&_0x4ebdfe['attrs'][0x5]?_0x4ebdfe[_0xe6de('0x5e')][0x5][_0xe6de('0x5f')]:undefined)||''},{'name':_0xe6de('0x6a'),'value':_0x4ebdfe['attrFaxAccounts']||(_0x4ebdfe['attrs']&&_0x4ebdfe[_0xe6de('0x5e')][0x6]?_0x4ebdfe[_0xe6de('0x5e')][0x6][_0xe6de('0x5f')]:undefined)||''},{'name':_0xe6de('0x6b'),'value':_0x4ebdfe[_0xe6de('0x6b')]||(_0x4ebdfe['attrs']&&_0x4ebdfe[_0xe6de('0x5e')][0x7]?_0x4ebdfe[_0xe6de('0x5e')][0x7][_0xe6de('0x5f')]:undefined)||''},{'name':_0xe6de('0x6c'),'value':_0x4ebdfe[_0xe6de('0x6c')]||(_0x4ebdfe[_0xe6de('0x5e')]&&_0x4ebdfe[_0xe6de('0x5e')][0x8]?_0x4ebdfe[_0xe6de('0x5e')][0x8]['value']:undefined)||''},{'name':_0xe6de('0x6d'),'value':_0x4ebdfe[_0xe6de('0x6d')]||(_0x4ebdfe[_0xe6de('0x5e')]&&_0x4ebdfe[_0xe6de('0x5e')][0x9]?_0x4ebdfe['attrs'][0x9]['value']:undefined)||''},{'name':_0xe6de('0x6e'),'value':_0x4ebdfe[_0xe6de('0x6e')]||(_0x4ebdfe[_0xe6de('0x5e')]&&_0x4ebdfe['attrs'][0xa]?_0x4ebdfe[_0xe6de('0x5e')][0xa][_0xe6de('0x5f')]:undefined)||''}];case _0xe6de('0x76'):return[{'name':_0xe6de('0x77'),'type':_0x4ebdfe['reportType']||(_0x4ebdfe[_0xe6de('0x5e')]&&_0x4ebdfe[_0xe6de('0x5e')][0x0]?_0x4ebdfe[_0xe6de('0x5e')][0x0]['type']:undefined)||null,'value':_0x4ebdfe[_0xe6de('0x77')]||(_0x4ebdfe['attrs']&&_0x4ebdfe['attrs'][0x0]?_0x4ebdfe[_0xe6de('0x5e')][0x0]['value']:undefined)||null},{'name':_0xe6de('0x78'),'value':_0x4ebdfe[_0xe6de('0x78')]||(_0x4ebdfe[_0xe6de('0x5e')]&&_0x4ebdfe[_0xe6de('0x5e')][0x1]?_0x4ebdfe[_0xe6de('0x5e')][0x1][_0xe6de('0x5f')]:undefined)||0x0}];default:return[];}}catch(_0x2a19a6){logger[_0xe6de('0x30')]('widgetAttributes:\x20%s',JSON[_0xe6de('0x79')](_0x2a19a6));return[];}}exports['addItem']=function(_0x2d26da,_0x14b210,_0x42fcf7){if(_0x2d26da[_0xe6de('0x4f')]['id']){delete _0x2d26da['body']['id'];}return db['Dashboard'][_0xe6de('0x4d')]({'where':{'id':_0x2d26da['params']['id']}})[_0xe6de('0x2b')](handleEntityNotFound(_0x14b210,null))[_0xe6de('0x2b')](function(_0x56ba17){if(_0x56ba17){_0x2d26da[_0xe6de('0x4f')][_0xe6de('0x7a')]=_0x56ba17['id'];_0x2d26da['body'][_0xe6de('0x5e')]=widgetAttributes(_0x2d26da['body']);return db[_0xe6de('0x7b')][_0xe6de('0x4e')](_0x2d26da[_0xe6de('0x4f')]);}})[_0xe6de('0x2b')](respondWithResult(_0x14b210,null))[_0xe6de('0x4b')](handleError(_0x14b210,null));};exports[_0xe6de('0x7c')]=function(_0x5d2a0b,_0x5edd41,_0x28a5d0){var _0x2d254b={};var _0x335b01={};var _0x42de9c;var _0x51f14c;return db[_0xe6de('0x47')][_0xe6de('0x7d')]({'where':{'id':_0x5d2a0b[_0xe6de('0x4c')]['id']}})[_0xe6de('0x2b')](handleEntityNotFound(_0x5edd41,null))[_0xe6de('0x2b')](function(_0x23124b){if(_0x23124b){_0x42de9c=_0x23124b;_0x335b01[_0xe6de('0x37')]=_['keys'](db[_0xe6de('0x7b')][_0xe6de('0x35')]);_0x335b01[_0xe6de('0x39')]=_['keys'](_0x5d2a0b[_0xe6de('0x39')]);_0x335b01['filters']=_[_0xe6de('0x3c')](_0x335b01[_0xe6de('0x37')],_0x335b01[_0xe6de('0x39')]);_0x2d254b[_0xe6de('0x3b')]=_[_0xe6de('0x3c')](_0x335b01[_0xe6de('0x37')],qs[_0xe6de('0x3d')](_0x5d2a0b[_0xe6de('0x39')][_0xe6de('0x3d')]));_0x2d254b[_0xe6de('0x3b')]=_0x2d254b['attributes'][_0xe6de('0x3e')]?_0x2d254b['attributes']:_0x335b01[_0xe6de('0x37')];_0x2d254b[_0xe6de('0x7e')]=qs[_0xe6de('0x3f')](_0x5d2a0b['query']['sort']);_0x2d254b[_0xe6de('0x40')]=qs[_0xe6de('0x3a')](_[_0xe6de('0x41')](_0x5d2a0b['query'],_0x335b01[_0xe6de('0x3a')]));if(_0x5d2a0b[_0xe6de('0x39')][_0xe6de('0x45')]){_0x2d254b[_0xe6de('0x40')]=_[_0xe6de('0x42')](_0x2d254b[_0xe6de('0x40')],{'$or':_[_0xe6de('0x34')](_0x2d254b[_0xe6de('0x3b')],function(_0x4cb89a){var _0x55ab86={};_0x55ab86[_0x4cb89a]={'$like':'%'+_0x5d2a0b[_0xe6de('0x39')][_0xe6de('0x45')]+'%'};return _0x55ab86;})});}_0x2d254b=_[_0xe6de('0x42')]({},_0x2d254b,_0x5d2a0b[_0xe6de('0x46')]);return _0x42de9c['getItems'](_0x2d254b);}})[_0xe6de('0x2b')](function(_0x1caedc){if(_0x1caedc){_0x51f14c=_0x1caedc[_0xe6de('0x3e')];if(!_0x5d2a0b[_0xe6de('0x39')][_0xe6de('0x7f')]('nolimit')){_0x2d254b[_0xe6de('0x22')]=qs[_0xe6de('0x22')](_0x5d2a0b[_0xe6de('0x39')][_0xe6de('0x22')]);_0x2d254b[_0xe6de('0x24')]=qs[_0xe6de('0x24')](_0x5d2a0b[_0xe6de('0x39')][_0xe6de('0x24')]);}return _0x42de9c[_0xe6de('0x7c')](_0x2d254b);}})['then'](function(_0x59cc2d){if(_0x59cc2d){return _0x59cc2d?{'count':_0x51f14c,'rows':_0x59cc2d}:null;}})[_0xe6de('0x2b')](respondWithResult(_0x5edd41,null))['catch'](handleError(_0x5edd41,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index dac8f17..3a4f600 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 _0x9cdb=['hasOwnProperty','exports','events','../../mysqldb','setMaxListeners','save','update','emit'];(function(_0x516068,_0x59c10b){var _0x31cebc=function(_0x225d74){while(--_0x225d74){_0x516068['push'](_0x516068['shift']());}};_0x31cebc(++_0x59c10b);}(_0x9cdb,0x142));var _0xb9cd=function(_0x5804ae,_0x5240b6){_0x5804ae=_0x5804ae-0x0;var _0x1b2882=_0x9cdb[_0x5804ae];return _0x1b2882;};'use strict';var EventEmitter=require(_0xb9cd('0x0'));var Dashboard=require(_0xb9cd('0x1'))['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0xb9cd('0x2')](0x0);var events={'afterCreate':_0xb9cd('0x3'),'afterUpdate':_0xb9cd('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5bfa8c){return function(_0x4d870e,_0x3c8b9d,_0x2817f5){DashboardEvents['emit'](_0x5bfa8c+':'+_0x4d870e['id'],_0x4d870e);DashboardEvents[_0xb9cd('0x5')](_0x5bfa8c,_0x4d870e);_0x2817f5(null);};}for(var e in events){if(events[_0xb9cd('0x6')](e)){var event=events[e];Dashboard['hook'](e,emitEvent(event));}}module[_0xb9cd('0x7')]=DashboardEvents; \ No newline at end of file +var _0xe6c5=['emit','hasOwnProperty','hook','exports','events','setMaxListeners','save','update','remove'];(function(_0x443214,_0x921a26){var _0x1a2f50=function(_0x330062){while(--_0x330062){_0x443214['push'](_0x443214['shift']());}};_0x1a2f50(++_0x921a26);}(_0xe6c5,0x67));var _0x5e6c=function(_0x3788ad,_0x2bfb37){_0x3788ad=_0x3788ad-0x0;var _0x2fb6a5=_0xe6c5[_0x3788ad];return _0x2fb6a5;};'use strict';var EventEmitter=require(_0x5e6c('0x0'));var Dashboard=require('../../mysqldb')['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0x5e6c('0x1')](0x0);var events={'afterCreate':_0x5e6c('0x2'),'afterUpdate':_0x5e6c('0x3'),'afterDestroy':_0x5e6c('0x4')};function emitEvent(_0x56e3e3){return function(_0x29480c,_0x243866,_0x2e4a67){DashboardEvents[_0x5e6c('0x5')](_0x56e3e3+':'+_0x29480c['id'],_0x29480c);DashboardEvents['emit'](_0x56e3e3,_0x29480c);_0x2e4a67(null);};}for(var e in events){if(events[_0x5e6c('0x6')](e)){var event=events[e];Dashboard[_0x5e6c('0x7')](e,emitEvent(event));}}module[_0x5e6c('0x8')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index f5f98b0..0bd6fc9 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 _0x3467=['dashboards','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./dashboard.attributes','define','Dashboard'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x3467,0x15d));var _0x7346=function(_0x340e09,_0x314c6e){_0x340e09=_0x340e09-0x0;var _0x4acdbc=_0x3467[_0x340e09];return _0x4acdbc;};'use strict';var _=require(_0x7346('0x0'));var util=require(_0x7346('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x7346('0x2'));var BPromise=require(_0x7346('0x3'));var rp=require(_0x7346('0x4'));var fs=require('fs');var path=require(_0x7346('0x5'));var rimraf=require(_0x7346('0x6'));var config=require(_0x7346('0x7'));var attributes=require(_0x7346('0x8'));module['exports']=function(_0x3f9e48,_0x1140ac){return _0x3f9e48[_0x7346('0x9')](_0x7346('0xa'),attributes,{'tableName':_0x7346('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbdeb=['api','bluebird','request-promise','path','rimraf','exports','define','util'];(function(_0x26337b,_0x2b51bb){var _0x15aaa3=function(_0x154b85){while(--_0x154b85){_0x26337b['push'](_0x26337b['shift']());}};_0x15aaa3(++_0x2b51bb);}(_0xbdeb,0x6f));var _0xbbde=function(_0x52b993,_0x13ef76){_0x52b993=_0x52b993-0x0;var _0x1ac4ff=_0xbdeb[_0x52b993];return _0x1ac4ff;};'use strict';var _=require('lodash');var util=require(_0xbbde('0x0'));var logger=require('../../config/logger')(_0xbbde('0x1'));var moment=require('moment');var BPromise=require(_0xbbde('0x2'));var rp=require(_0xbbde('0x3'));var fs=require('fs');var path=require(_0xbbde('0x4'));var rimraf=require(_0xbbde('0x5'));var config=require('../../config/environment');var attributes=require('./dashboard.attributes');module[_0xbbde('0x6')]=function(_0x1d4042,_0x278651){return _0x1d4042[_0xbbde('0x7')]('Dashboard',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 d6c03f4..90db63f 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 _0xa06c=['rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0xa06c,0x19d));var _0xca06=function(_0x5eef93,_0x5c49e9){_0x5eef93=_0x5eef93-0x0;var _0x3a7591=_0xa06c[_0x5eef93];return _0x3a7591;};'use strict';var _=require(_0xca06('0x0'));var util=require(_0xca06('0x1'));var moment=require('moment');var BPromise=require(_0xca06('0x2'));var rs=require(_0xca06('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xca06('0x4'))['db'];var utils=require(_0xca06('0x5'));var logger=require(_0xca06('0x6'))(_0xca06('0x7'));var config=require(_0xca06('0x8'));var jayson=require(_0xca06('0x9'));var client=jayson[_0xca06('0xa')][_0xca06('0xb')]({'port':0x232a});config[_0xca06('0xc')]=_[_0xca06('0xd')](config[_0xca06('0xc')],{'host':_0xca06('0xe'),'port':0x18eb});var socket=require(_0xca06('0xf'))(new Redis(config[_0xca06('0xc')]));require(_0xca06('0x10'))[_0xca06('0x11')](socket);function respondWithRpcPromise(_0x519689,_0x3b74f1,_0x3ee26a){return new BPromise(function(_0x117730,_0x283a4d){return client['request'](_0x519689,_0x3ee26a)[_0xca06('0x12')](function(_0x59a701){logger[_0xca06('0x13')](_0xca06('0x14'),_0x3b74f1,_0xca06('0x15'));logger[_0xca06('0x16')](_0xca06('0x17'),_0x3b74f1,_0xca06('0x15'),JSON['stringify'](_0x59a701));if(_0x59a701[_0xca06('0x18')]){if(_0x59a701[_0xca06('0x18')][_0xca06('0x19')]===0x1f4){logger['error'](_0xca06('0x14'),_0x3b74f1,_0x59a701[_0xca06('0x18')][_0xca06('0x1a')]);return _0x283a4d(_0x59a701['error'][_0xca06('0x1a')]);}logger[_0xca06('0x18')]('Dashboard,\x20%s,\x20%s',_0x3b74f1,_0x59a701['error']['message']);return _0x117730(_0x59a701['error'][_0xca06('0x1a')]);}else{logger[_0xca06('0x13')](_0xca06('0x14'),_0x3b74f1,_0xca06('0x15'));_0x117730(_0x59a701['result'][_0xca06('0x1a')]);}})[_0xca06('0x1b')](function(_0x5ab445){logger[_0xca06('0x18')](_0xca06('0x14'),_0x3b74f1,_0x5ab445);_0x283a4d(_0x5ab445);});});} \ No newline at end of file +var _0x2824=['socket.io-emitter','register','request','then','info','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Dashboard,\x20%s,\x20%s','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','redis','defaults','localhost'];(function(_0x289fad,_0x43e23e){var _0x54a48a=function(_0x413d2a){while(--_0x413d2a){_0x289fad['push'](_0x289fad['shift']());}};_0x54a48a(++_0x43e23e);}(_0x2824,0xef));var _0x4282=function(_0x132b38,_0x2f5509){_0x132b38=_0x132b38-0x0;var _0x12a5b0=_0x2824[_0x132b38];return _0x12a5b0;};'use strict';var _=require('lodash');var util=require(_0x4282('0x0'));var moment=require(_0x4282('0x1'));var BPromise=require(_0x4282('0x2'));var rs=require(_0x4282('0x3'));var fs=require('fs');var Redis=require(_0x4282('0x4'));var db=require(_0x4282('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4282('0x6'))('rpc');var config=require(_0x4282('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x4282('0x8')][_0x4282('0x9')]({'port':0x232a});config[_0x4282('0xa')]=_[_0x4282('0xb')](config[_0x4282('0xa')],{'host':_0x4282('0xc'),'port':0x18eb});var socket=require(_0x4282('0xd'))(new Redis(config[_0x4282('0xa')]));require('./dashboard.socket')[_0x4282('0xe')](socket);function respondWithRpcPromise(_0x4ac1b5,_0xf36f18,_0x3e8802){return new BPromise(function(_0x2d8708,_0x6a61da){return client[_0x4282('0xf')](_0x4ac1b5,_0x3e8802)[_0x4282('0x10')](function(_0x5c5d52){logger[_0x4282('0x11')]('Dashboard,\x20%s,\x20%s',_0xf36f18,_0x4282('0x12'));logger[_0x4282('0x13')](_0x4282('0x14'),_0xf36f18,'request\x20sent',JSON[_0x4282('0x15')](_0x5c5d52));if(_0x5c5d52[_0x4282('0x16')]){if(_0x5c5d52[_0x4282('0x16')][_0x4282('0x17')]===0x1f4){logger[_0x4282('0x16')]('Dashboard,\x20%s,\x20%s',_0xf36f18,_0x5c5d52[_0x4282('0x16')][_0x4282('0x18')]);return _0x6a61da(_0x5c5d52[_0x4282('0x16')]['message']);}logger['error'](_0x4282('0x19'),_0xf36f18,_0x5c5d52['error'][_0x4282('0x18')]);return _0x2d8708(_0x5c5d52[_0x4282('0x16')][_0x4282('0x18')]);}else{logger[_0x4282('0x11')]('Dashboard,\x20%s,\x20%s',_0xf36f18,'request\x20sent');_0x2d8708(_0x5c5d52[_0x4282('0x1a')][_0x4282('0x18')]);}})[_0x4282('0x1b')](function(_0x2da700){logger[_0x4282('0x16')](_0x4282('0x19'),_0xf36f18,_0x2da700);_0x6a61da(_0x2da700);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 8e700a9..5613bba 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 _0xaee7=['dashboard:','save','remove','emit','removeListener','register'];(function(_0x3ff4a3,_0xa5bfa6){var _0x38676f=function(_0x3ab2b1){while(--_0x3ab2b1){_0x3ff4a3['push'](_0x3ff4a3['shift']());}};_0x38676f(++_0xa5bfa6);}(_0xaee7,0xc7));var _0x7aee=function(_0x57b662,_0xba41aa){_0x57b662=_0x57b662-0x0;var _0x293519=_0xaee7[_0x57b662];return _0x293519;};'use strict';var DashboardEvents=require('./dashboard.events');var events=[_0x7aee('0x0'),_0x7aee('0x1'),'update'];function createListener(_0x2c22c1,_0xc26e9b){return function(_0x494d38){_0xc26e9b[_0x7aee('0x2')](_0x2c22c1,_0x494d38);};}function removeListener(_0x5e50e2,_0x5827cd){return function(){DashboardEvents[_0x7aee('0x3')](_0x5e50e2,_0x5827cd);};}exports[_0x7aee('0x4')]=function(_0xe0aa84){for(var _0x1582cf=0x0,_0x24ffbb=events['length'];_0x1582cf<_0x24ffbb;_0x1582cf++){var _0x19b6af=events[_0x1582cf];var _0x4de597=createListener(_0x7aee('0x5')+_0x19b6af,_0xe0aa84);DashboardEvents['on'](_0x19b6af,_0x4de597);}}; \ No newline at end of file +var _0x3c6d=['./dashboard.events','save','remove','update','removeListener'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x3c6d,0x163));var _0xd3c6=function(_0x1c4042,_0xcf59a7){_0x1c4042=_0x1c4042-0x0;var _0x56c253=_0x3c6d[_0x1c4042];return _0x56c253;};'use strict';var DashboardEvents=require(_0xd3c6('0x0'));var events=[_0xd3c6('0x1'),_0xd3c6('0x2'),_0xd3c6('0x3')];function createListener(_0x17b649,_0x4a14e6){return function(_0x1cbfbe){_0x4a14e6['emit'](_0x17b649,_0x1cbfbe);};}function removeListener(_0x44d6db,_0x389600){return function(){DashboardEvents[_0xd3c6('0x4')](_0x44d6db,_0x389600);};}exports['register']=function(_0x14ba15){for(var _0x12a799=0x0,_0x19c050=events['length'];_0x12a799<_0x19c050;_0x12a799++){var _0x43e9a3=events[_0x12a799];var _0x3a0de3=createListener('dashboard:'+_0x43e9a3,_0x14ba15);DashboardEvents['on'](_0x43e9a3,_0x3a0de3);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index a095837..2aeb812 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 _0xb250=['/:id/clone','clone','put','/:id','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./dashboard.controller','isAuthenticated','index','get','show','/:id/items','post'];(function(_0x5319cd,_0x4c2245){var _0x3c9825=function(_0x106960){while(--_0x106960){_0x5319cd['push'](_0x5319cd['shift']());}};_0x3c9825(++_0x4c2245);}(_0xb250,0x7a));var _0x0b25=function(_0x22d715,_0x481f78){_0x22d715=_0x22d715-0x0;var _0x15dfc2=_0xb250[_0x22d715];return _0x15dfc2;};'use strict';var multer=require(_0x0b25('0x0'));var util=require(_0x0b25('0x1'));var path=require(_0x0b25('0x2'));var timeout=require(_0x0b25('0x3'));var express=require(_0x0b25('0x4'));var router=express[_0x0b25('0x5')]();var fs_extra=require(_0x0b25('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x0b25('0x7'));var config=require(_0x0b25('0x8'));var controller=require(_0x0b25('0x9'));router['get']('/',auth[_0x0b25('0xa')](),controller[_0x0b25('0xb')]);router[_0x0b25('0xc')]('/:id',auth[_0x0b25('0xa')](),controller[_0x0b25('0xd')]);router[_0x0b25('0xc')](_0x0b25('0xe'),auth['isAuthenticated'](),controller['getItems']);router['post']('/',auth[_0x0b25('0xa')](),controller['create']);router[_0x0b25('0xf')](_0x0b25('0x10'),auth[_0x0b25('0xa')](),controller[_0x0b25('0x11')]);router[_0x0b25('0xf')](_0x0b25('0xe'),auth[_0x0b25('0xa')](),controller['addItem']);router[_0x0b25('0x12')](_0x0b25('0x13'),auth['isAuthenticated'](),controller[_0x0b25('0x14')]);router[_0x0b25('0x15')](_0x0b25('0x13'),auth[_0x0b25('0xa')](),controller['destroy']);module[_0x0b25('0x16')]=router; \ No newline at end of file +var _0xaf27=['multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/:id','show','/:id/items','getItems','post','create','/:id/clone','clone','addItem','update','delete'];(function(_0x53fbfb,_0x5a6957){var _0x59955a=function(_0x576765){while(--_0x576765){_0x53fbfb['push'](_0x53fbfb['shift']());}};_0x59955a(++_0x5a6957);}(_0xaf27,0x11e));var _0x7af2=function(_0xa3fadc,_0xd1e16){_0xa3fadc=_0xa3fadc-0x0;var _0x23ecb8=_0xaf27[_0xa3fadc];return _0x23ecb8;};'use strict';var multer=require(_0x7af2('0x0'));var util=require(_0x7af2('0x1'));var path=require('path');var timeout=require(_0x7af2('0x2'));var express=require(_0x7af2('0x3'));var router=express[_0x7af2('0x4')]();var fs_extra=require(_0x7af2('0x5'));var auth=require(_0x7af2('0x6'));var interaction=require(_0x7af2('0x7'));var config=require('../../config/environment');var controller=require('./dashboard.controller');router['get']('/',auth[_0x7af2('0x8')](),controller[_0x7af2('0x9')]);router[_0x7af2('0xa')](_0x7af2('0xb'),auth['isAuthenticated'](),controller[_0x7af2('0xc')]);router[_0x7af2('0xa')](_0x7af2('0xd'),auth[_0x7af2('0x8')](),controller[_0x7af2('0xe')]);router[_0x7af2('0xf')]('/',auth['isAuthenticated'](),controller[_0x7af2('0x10')]);router[_0x7af2('0xf')](_0x7af2('0x11'),auth[_0x7af2('0x8')](),controller[_0x7af2('0x12')]);router[_0x7af2('0xf')]('/:id/items',auth[_0x7af2('0x8')](),controller[_0x7af2('0x13')]);router['put']('/:id',auth[_0x7af2('0x8')](),controller[_0x7af2('0x14')]);router[_0x7af2('0x15')]('/:id',auth[_0x7af2('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 0ee6b6c..acd30fd 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 _0x7a54=['lodash','STRING','long','parse','getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff','sequelize','squel'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0x7a54,0x106));var _0x47a5=function(_0x142225,_0x44af63){_0x142225=_0x142225-0x0;var _0x4c4465=_0x7a54[_0x142225];return _0x4c4465;};'use strict';var Sequelize=require(_0x47a5('0x0'));var squel=require(_0x47a5('0x1'));var _=require(_0x47a5('0x2'));module['exports']={'title':{'type':Sequelize[_0x47a5('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x47a5('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT'](_0x47a5('0x4')),'get':function(){try{return JSON[_0x47a5('0x5')](this[_0x47a5('0x6')](_0x47a5('0x7')));}catch(_0xfdf934){return[];}},'set':function(_0x545a97){try{this[_0x47a5('0x8')]('attrs',JSON[_0x47a5('0x9')](_0x545a97));}catch(_0x30e405){this['setDataValue'](_0x47a5('0x7'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x47a5('0xa')]},'col':{'type':Sequelize[_0x47a5('0xa')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x47a5('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x47a5('0x3')]},'titleFontSize':{'type':Sequelize[_0x47a5('0xa')],'defaultValue':0xc}}; \ No newline at end of file +var _0xfdbd=['sequelize','squel','lodash','exports','STRING','TEXT','long','parse','attrs','setDataValue','INTEGER','#ffffff'];(function(_0x23ec06,_0x561142){var _0x2831d4=function(_0x3802bc){while(--_0x3802bc){_0x23ec06['push'](_0x23ec06['shift']());}};_0x2831d4(++_0x561142);}(_0xfdbd,0xf0));var _0xdfdb=function(_0xdae8e6,_0x34854a){_0xdae8e6=_0xdae8e6-0x0;var _0x24c7a7=_0xfdbd[_0xdae8e6];return _0x24c7a7;};'use strict';var Sequelize=require(_0xdfdb('0x0'));var squel=require(_0xdfdb('0x1'));var _=require(_0xdfdb('0x2'));module[_0xdfdb('0x3')]={'title':{'type':Sequelize[_0xdfdb('0x4')],'allowNull':![]},'type':{'type':Sequelize[_0xdfdb('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0xdfdb('0x5')](_0xdfdb('0x6')),'get':function(){try{return JSON[_0xdfdb('0x7')](this['getDataValue'](_0xdfdb('0x8')));}catch(_0x4a4a3f){return[];}},'set':function(_0x453ef6){try{this[_0xdfdb('0x9')]('attrs',JSON['stringify'](_0x453ef6));}catch(_0x590b5d){this[_0xdfdb('0x9')](_0xdfdb('0x8'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize[_0xdfdb('0xa')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xdfdb('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xdfdb('0xa')]},'col':{'type':Sequelize[_0xdfdb('0xa')]},'background':{'type':Sequelize[_0xdfdb('0x4')],'allowNull':![],'defaultValue':_0xdfdb('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xdfdb('0x4')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xdfdb('0x4')]},'titleFontSize':{'type':Sequelize[_0xdfdb('0xa')],'defaultValue':0xc}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index d781dc4..b8337be 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 _0xd072=['fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','end','json','undefined','limit','offset','count','Content-Range','apply','reject','save','update','destroy','then','error','name','send','show','params','keys','query','filters','intersection','attributes','model','fields','includeAll','include','DashboardItem','find','catch','iframe','attrUrl','attrs','value','https://','attrPath','clock','attrHourFormat','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrFaxAccounts','attrReport','reportType','type','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','eml-format','rimraf','zip-dir'];(function(_0x4d4e8b,_0x471d96){var _0x1c847c=function(_0x350c14){while(--_0x350c14){_0x4d4e8b['push'](_0x4d4e8b['shift']());}};_0x1c847c(++_0x471d96);}(_0xd072,0x132));var _0x2d07=function(_0x2a66fc,_0x3cec1d){_0x2a66fc=_0x2a66fc-0x0;var _0x35351b=_0xd072[_0x2a66fc];return _0x35351b;};'use strict';var emlformat=require(_0x2d07('0x0'));var rimraf=require(_0x2d07('0x1'));var zipdir=require(_0x2d07('0x2'));var jsonpatch=require(_0x2d07('0x3'));var rp=require(_0x2d07('0x4'));var moment=require(_0x2d07('0x5'));var BPromise=require(_0x2d07('0x6'));var Mustache=require('mustache');var util=require(_0x2d07('0x7'));var path=require(_0x2d07('0x8'));var sox=require(_0x2d07('0x9'));var csv=require(_0x2d07('0xa'));var ejs=require(_0x2d07('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2d07('0xc'));var squel=require(_0x2d07('0xd'));var crypto=require(_0x2d07('0xe'));var jsforce=require(_0x2d07('0xf'));var deskjs=require(_0x2d07('0x10'));var toCsv=require(_0x2d07('0xa'));var querystring=require(_0x2d07('0x11'));var Papa=require('papaparse');var Redis=require(_0x2d07('0x12'));var authService=require(_0x2d07('0x13'));var qs=require(_0x2d07('0x14'));var as=require(_0x2d07('0x15'));var hardwareService=require(_0x2d07('0x16'));var logger=require(_0x2d07('0x17'))(_0x2d07('0x18'));var utils=require(_0x2d07('0x19'));var config=require(_0x2d07('0x1a'));var licenseUtil=require(_0x2d07('0x1b'));var db=require(_0x2d07('0x1c'))['db'];config[_0x2d07('0x1d')]=_[_0x2d07('0x1e')](config[_0x2d07('0x1d')],{'host':_0x2d07('0x1f'),'port':0x18eb});var socket=require(_0x2d07('0x20'))(new Redis(config[_0x2d07('0x1d')]));require(_0x2d07('0x21'))[_0x2d07('0x22')](socket);function respondWithStatusCode(_0x3fbab2,_0x28cbb3){_0x28cbb3=_0x28cbb3||0xcc;return function(_0x17eb30){if(_0x17eb30){return _0x3fbab2[_0x2d07('0x23')](_0x28cbb3);}return _0x3fbab2[_0x2d07('0x24')](_0x28cbb3)[_0x2d07('0x25')]();};}function respondWithResult(_0x540be1,_0x1ff801){_0x1ff801=_0x1ff801||0xc8;return function(_0xa7d218){if(_0xa7d218){return _0x540be1[_0x2d07('0x24')](_0x1ff801)[_0x2d07('0x26')](_0xa7d218);}};}function respondWithFilteredResult(_0x2b8884,_0x378dd0){return function(_0x1e5b8e){if(_0x1e5b8e){var _0x28e87a=typeof _0x378dd0['offset']===_0x2d07('0x27')&&typeof _0x378dd0[_0x2d07('0x28')]===_0x2d07('0x27');var _0x1ac32e=_0x1e5b8e['count'];var _0x112ac3=_0x28e87a?0x0:_0x378dd0[_0x2d07('0x29')];var _0xd0c5f8=_0x28e87a?_0x1e5b8e[_0x2d07('0x2a')]:_0x378dd0[_0x2d07('0x29')]+_0x378dd0[_0x2d07('0x28')];var _0x185fb9;if(_0xd0c5f8>=_0x1ac32e){_0xd0c5f8=_0x1ac32e;_0x185fb9=0xc8;}else{_0x185fb9=0xce;}_0x2b8884[_0x2d07('0x24')](_0x185fb9);return _0x2b8884['set'](_0x2d07('0x2b'),_0x112ac3+'-'+_0xd0c5f8+'/'+_0x1ac32e)[_0x2d07('0x26')](_0x1e5b8e);}return null;};}function patchUpdates(_0x3b3f3a){return function(_0x55f580){try{jsonpatch[_0x2d07('0x2c')](_0x55f580,_0x3b3f3a,!![]);}catch(_0x515eac){return BPromise[_0x2d07('0x2d')](_0x515eac);}return _0x55f580[_0x2d07('0x2e')]();};}function saveUpdates(_0x19b898,_0x56b5fe){return function(_0x282156){if(_0x282156){return _0x282156[_0x2d07('0x2f')](_0x19b898)['then'](function(_0x43bd94){return _0x43bd94;});}return null;};}function removeEntity(_0x4b78f0,_0x1f0f2a){return function(_0x302dec){if(_0x302dec){return _0x302dec[_0x2d07('0x30')]()[_0x2d07('0x31')](function(){_0x4b78f0['status'](0xcc)[_0x2d07('0x25')]();});}};}function handleEntityNotFound(_0x713c5d,_0x3c990f){return function(_0x59efa8){if(!_0x59efa8){_0x713c5d[_0x2d07('0x23')](0x194);}return _0x59efa8;};}function handleError(_0x550fc5,_0x550344){_0x550344=_0x550344||0x1f4;return function(_0x16c5ed){logger[_0x2d07('0x32')](_0x16c5ed['stack']);if(_0x16c5ed[_0x2d07('0x33')]){delete _0x16c5ed['name'];}_0x550fc5['status'](_0x550344)[_0x2d07('0x34')](_0x16c5ed);};}exports[_0x2d07('0x35')]=function(_0x5ecb9a,_0x113080){var _0x578c04={'raw':![],'where':{'id':_0x5ecb9a[_0x2d07('0x36')]['id']}},_0x34794b={};_0x34794b['model']=_[_0x2d07('0x37')](db['DashboardItem']['rawAttributes']);_0x34794b[_0x2d07('0x38')]=_['keys'](_0x5ecb9a[_0x2d07('0x38')]);_0x34794b[_0x2d07('0x39')]=_[_0x2d07('0x3a')](_0x34794b['model'],_0x34794b['query']);_0x578c04[_0x2d07('0x3b')]=_[_0x2d07('0x3a')](_0x34794b[_0x2d07('0x3c')],qs[_0x2d07('0x3d')](_0x5ecb9a['query']['fields']));_0x578c04['attributes']=_0x578c04[_0x2d07('0x3b')]['length']?_0x578c04[_0x2d07('0x3b')]:_0x34794b[_0x2d07('0x3c')];if(_0x5ecb9a[_0x2d07('0x38')][_0x2d07('0x3e')]){_0x578c04[_0x2d07('0x3f')]=[{'all':!![]}];}_0x578c04=_['merge']({},_0x578c04,_0x5ecb9a['options']);return db[_0x2d07('0x40')][_0x2d07('0x41')](_0x578c04)[_0x2d07('0x31')](handleEntityNotFound(_0x113080,null))[_0x2d07('0x31')](respondWithResult(_0x113080,null))['catch'](handleError(_0x113080,null));};exports[_0x2d07('0x30')]=function(_0xe93c46,_0x3ea4d2){return db[_0x2d07('0x40')]['find']({'where':{'id':_0xe93c46['params']['id']}})[_0x2d07('0x31')](handleEntityNotFound(_0x3ea4d2,null))[_0x2d07('0x31')](removeEntity(_0x3ea4d2,null))[_0x2d07('0x42')](handleError(_0x3ea4d2,null));};function widgetAttributes(_0x48d598){try{switch(_0x48d598['type']){case _0x2d07('0x43'):return[{'name':_0x2d07('0x44'),'value':_0x48d598[_0x2d07('0x44')]||(_0x48d598[_0x2d07('0x45')]&&_0x48d598[_0x2d07('0x45')][0x0]?_0x48d598['attrs'][0x0][_0x2d07('0x46')]:undefined)||_0x2d07('0x47')}];case'custom':return[{'name':_0x2d07('0x48'),'value':_0x48d598['attrPath']||(_0x48d598[_0x2d07('0x45')]&&_0x48d598[_0x2d07('0x45')][0x0]?_0x48d598[_0x2d07('0x45')][0x0][_0x2d07('0x46')]:undefined)||''}];case _0x2d07('0x49'):return[{'name':_0x2d07('0x4a'),'value':_0x48d598['attrHourFormat']||(_0x48d598[_0x2d07('0x45')]&&_0x48d598[_0x2d07('0x45')][0x0]?_0x48d598[_0x2d07('0x45')][0x0][_0x2d07('0x46')]:undefined)||'HH:mm:ss'},{'name':_0x2d07('0x4b'),'value':_0x48d598[_0x2d07('0x4b')]||(_0x48d598[_0x2d07('0x45')]&&_0x48d598[_0x2d07('0x45')][0x1]?_0x48d598[_0x2d07('0x45')][0x1]['value']:undefined)||_0x2d07('0x4c')},{'name':_0x2d07('0x4d'),'value':_0x48d598[_0x2d07('0x4d')]||(_0x48d598[_0x2d07('0x45')]&&_0x48d598[_0x2d07('0x45')][0x2]?_0x48d598[_0x2d07('0x45')][0x2][_0x2d07('0x46')]:undefined)||0xc}];case _0x2d07('0x4e'):return[{'name':_0x2d07('0x4f'),'value':_0x48d598[_0x2d07('0x4f')]||(_0x48d598[_0x2d07('0x45')]&&_0x48d598[_0x2d07('0x45')][0x0]?_0x48d598[_0x2d07('0x45')][0x0]['value']:undefined)||_0x2d07('0x50')},{'name':_0x2d07('0x51'),'value':_0x48d598['attrVoiceQueues']||(_0x48d598[_0x2d07('0x45')]&&_0x48d598[_0x2d07('0x45')][0x1]?_0x48d598[_0x2d07('0x45')][0x1]['value']:undefined)||[]},{'name':'attrFontSize','value':_0x48d598[_0x2d07('0x4d')]||(_0x48d598[_0x2d07('0x45')]&&_0x48d598[_0x2d07('0x45')][0x2]?_0x48d598['attrs'][0x2][_0x2d07('0x46')]:undefined)||0x14},{'name':_0x2d07('0x52'),'value':_0x48d598['attrChannel']||(_0x48d598[_0x2d07('0x45')]&&_0x48d598[_0x2d07('0x45')][0x3]?_0x48d598[_0x2d07('0x45')][0x3][_0x2d07('0x46')]:undefined)||_0x2d07('0x53')},{'name':_0x2d07('0x54'),'value':_0x48d598['attrEmailAccounts']||(_0x48d598[_0x2d07('0x45')]&&_0x48d598[_0x2d07('0x45')][0x4]?_0x48d598['attrs'][0x4][_0x2d07('0x46')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x48d598['attrFaxAccounts']||(_0x48d598[_0x2d07('0x45')]&&_0x48d598[_0x2d07('0x45')][0x5]?_0x48d598['attrs'][0x5]['value']:undefined)||''},{'name':_0x2d07('0x55'),'value':_0x48d598['attrSmsAccounts']||(_0x48d598[_0x2d07('0x45')]&&_0x48d598['attrs'][0x6]?_0x48d598[_0x2d07('0x45')][0x6][_0x2d07('0x46')]:undefined)||''},{'name':_0x2d07('0x56'),'value':_0x48d598[_0x2d07('0x56')]||(_0x48d598[_0x2d07('0x45')]&&_0x48d598[_0x2d07('0x45')][0x7]?_0x48d598[_0x2d07('0x45')][0x7][_0x2d07('0x46')]:undefined)||''},{'name':_0x2d07('0x57'),'value':_0x48d598[_0x2d07('0x57')]||(_0x48d598[_0x2d07('0x45')]&&_0x48d598[_0x2d07('0x45')][0x8]?_0x48d598[_0x2d07('0x45')][0x8][_0x2d07('0x46')]:undefined)||''},{'name':_0x2d07('0x58'),'value':_0x48d598[_0x2d07('0x58')]||(_0x48d598[_0x2d07('0x45')]&&_0x48d598[_0x2d07('0x45')][0x9]?_0x48d598[_0x2d07('0x45')][0x9][_0x2d07('0x46')]:undefined)||''}];case _0x2d07('0x59'):case _0x2d07('0x5a'):return[{'name':_0x2d07('0x5b'),'value':_0x48d598[_0x2d07('0x5b')]||(_0x48d598[_0x2d07('0x45')]&&_0x48d598['attrs'][0x0]?_0x48d598[_0x2d07('0x45')][0x0]['value']:undefined)||_0x2d07('0x50')},{'name':'attrSerie2','value':_0x48d598[_0x2d07('0x5c')]||(_0x48d598[_0x2d07('0x45')]&&_0x48d598[_0x2d07('0x45')][0x1]?_0x48d598[_0x2d07('0x45')][0x1][_0x2d07('0x46')]:undefined)||null},{'name':_0x2d07('0x5d'),'value':_0x48d598[_0x2d07('0x5d')]||(_0x48d598[_0x2d07('0x45')]&&_0x48d598['attrs'][0x2]?_0x48d598['attrs'][0x2]['value']:undefined)||null},{'name':_0x2d07('0x51'),'value':_0x48d598[_0x2d07('0x51')]||(_0x48d598[_0x2d07('0x45')]&&_0x48d598[_0x2d07('0x45')][0x3]?_0x48d598[_0x2d07('0x45')][0x3][_0x2d07('0x46')]:undefined)||[]},{'name':'attrChannel','value':_0x48d598['attrChannel']||(_0x48d598['attrs']&&_0x48d598[_0x2d07('0x45')][0x4]?_0x48d598[_0x2d07('0x45')][0x4][_0x2d07('0x46')]:undefined)||_0x2d07('0x53')},{'name':_0x2d07('0x54'),'value':_0x48d598[_0x2d07('0x54')]||(_0x48d598[_0x2d07('0x45')]&&_0x48d598[_0x2d07('0x45')][0x5]?_0x48d598[_0x2d07('0x45')][0x5][_0x2d07('0x46')]:undefined)||''},{'name':_0x2d07('0x5e'),'value':_0x48d598[_0x2d07('0x5e')]||(_0x48d598[_0x2d07('0x45')]&&_0x48d598[_0x2d07('0x45')][0x6]?_0x48d598[_0x2d07('0x45')][0x6][_0x2d07('0x46')]:undefined)||''},{'name':_0x2d07('0x55'),'value':_0x48d598[_0x2d07('0x55')]||(_0x48d598[_0x2d07('0x45')]&&_0x48d598[_0x2d07('0x45')][0x7]?_0x48d598[_0x2d07('0x45')][0x7][_0x2d07('0x46')]:undefined)||''},{'name':_0x2d07('0x56'),'value':_0x48d598[_0x2d07('0x56')]||(_0x48d598[_0x2d07('0x45')]&&_0x48d598[_0x2d07('0x45')][0x8]?_0x48d598['attrs'][0x8]['value']:undefined)||''},{'name':_0x2d07('0x57'),'value':_0x48d598[_0x2d07('0x57')]||(_0x48d598['attrs']&&_0x48d598[_0x2d07('0x45')][0x9]?_0x48d598[_0x2d07('0x45')][0x9][_0x2d07('0x46')]:undefined)||''},{'name':_0x2d07('0x58'),'value':_0x48d598[_0x2d07('0x58')]||(_0x48d598['attrs']&&_0x48d598[_0x2d07('0x45')][0xa]?_0x48d598[_0x2d07('0x45')][0xa][_0x2d07('0x46')]:undefined)||''}];case'web-report':return[{'name':_0x2d07('0x5f'),'type':_0x48d598[_0x2d07('0x60')]||(_0x48d598['attrs']&&_0x48d598[_0x2d07('0x45')][0x0]?_0x48d598[_0x2d07('0x45')][0x0][_0x2d07('0x61')]:undefined)||null,'value':_0x48d598[_0x2d07('0x5f')]||(_0x48d598[_0x2d07('0x45')]&&_0x48d598[_0x2d07('0x45')][0x0]?_0x48d598[_0x2d07('0x45')][0x0]['value']:undefined)||null},{'name':_0x2d07('0x62'),'value':_0x48d598[_0x2d07('0x62')]||(_0x48d598[_0x2d07('0x45')]&&_0x48d598[_0x2d07('0x45')][0x1]?_0x48d598['attrs'][0x1][_0x2d07('0x46')]:undefined)||0x0}];default:return[];}}catch(_0x3d5338){logger[_0x2d07('0x32')](_0x2d07('0x63'),JSON[_0x2d07('0x64')](_0x3d5338));return[];}}exports[_0x2d07('0x65')]=function(_0x3c2eb7,_0x3d36f7){if(_0x3c2eb7[_0x2d07('0x66')]){_0x3c2eb7[_0x2d07('0x66')][_0x2d07('0x45')]=widgetAttributes(_0x3c2eb7[_0x2d07('0x66')]);}return db[_0x2d07('0x40')][_0x2d07('0x65')](_0x3c2eb7[_0x2d07('0x66')],{})[_0x2d07('0x31')](respondWithResult(_0x3d36f7,0xc9))[_0x2d07('0x42')](handleError(_0x3d36f7,null));};exports['update']=function(_0x4eac25,_0x29e9e2){if(_0x4eac25[_0x2d07('0x66')]['id']){delete _0x4eac25[_0x2d07('0x66')]['id'];}_0x4eac25[_0x2d07('0x66')][_0x2d07('0x45')]=widgetAttributes(_0x4eac25['body']);return db['DashboardItem']['find']({'where':{'id':_0x4eac25[_0x2d07('0x36')]['id']}})[_0x2d07('0x31')](handleEntityNotFound(_0x29e9e2,null))['then'](saveUpdates(_0x4eac25[_0x2d07('0x66')],null))['then'](respondWithResult(_0x29e9e2,null))[_0x2d07('0x42')](handleError(_0x29e9e2,null));}; \ No newline at end of file +var _0x1d7e=['attrMetric','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','pie-chart','attrSerie1','total','attrSerie2','attrSerie3','attrChatWebsites','web-report','attrReport','reportType','attrRefresh','error','widgetAttributes:\x20%s','stringify','create','body','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./dashboardItem.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','show','params','model','keys','DashboardItem','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','merge','options','find','catch','type','iframe','attrUrl','attrs','value','https://','attrPath','clock','attrHourFormat','attrTimezone','0.00','attrFontSize','counter'];(function(_0x3a1f7c,_0x5a1208){var _0x4e505a=function(_0xb23336){while(--_0xb23336){_0x3a1f7c['push'](_0x3a1f7c['shift']());}};_0x4e505a(++_0x5a1208);}(_0x1d7e,0x7d));var _0xe1d7=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x1d7e[_0x3ab9ee];return _0x82ee88;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe1d7('0x0'));var zipdir=require(_0xe1d7('0x1'));var jsonpatch=require(_0xe1d7('0x2'));var rp=require('request-promise');var moment=require(_0xe1d7('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xe1d7('0x4'));var util=require(_0xe1d7('0x5'));var path=require(_0xe1d7('0x6'));var sox=require(_0xe1d7('0x7'));var csv=require(_0xe1d7('0x8'));var ejs=require(_0xe1d7('0x9'));var fs=require('fs');var fs_extra=require(_0xe1d7('0xa'));var _=require(_0xe1d7('0xb'));var squel=require(_0xe1d7('0xc'));var crypto=require(_0xe1d7('0xd'));var jsforce=require(_0xe1d7('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xe1d7('0x8'));var querystring=require(_0xe1d7('0xf'));var Papa=require('papaparse');var Redis=require(_0xe1d7('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xe1d7('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe1d7('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xe1d7('0x13'));var config=require(_0xe1d7('0x14'));var licenseUtil=require(_0xe1d7('0x15'));var db=require(_0xe1d7('0x16'))['db'];config[_0xe1d7('0x17')]=_[_0xe1d7('0x18')](config[_0xe1d7('0x17')],{'host':_0xe1d7('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe1d7('0x17')]));require(_0xe1d7('0x1a'))[_0xe1d7('0x1b')](socket);function respondWithStatusCode(_0x3d3d8d,_0x193a0e){_0x193a0e=_0x193a0e||0xcc;return function(_0x2d017a){if(_0x2d017a){return _0x3d3d8d[_0xe1d7('0x1c')](_0x193a0e);}return _0x3d3d8d['status'](_0x193a0e)[_0xe1d7('0x1d')]();};}function respondWithResult(_0x328898,_0x419cf3){_0x419cf3=_0x419cf3||0xc8;return function(_0x56e1c6){if(_0x56e1c6){return _0x328898[_0xe1d7('0x1e')](_0x419cf3)[_0xe1d7('0x1f')](_0x56e1c6);}};}function respondWithFilteredResult(_0x800c15,_0x1f82ce){return function(_0x1dc61f){if(_0x1dc61f){var _0x446ce6=typeof _0x1f82ce[_0xe1d7('0x20')]===_0xe1d7('0x21')&&typeof _0x1f82ce[_0xe1d7('0x22')]===_0xe1d7('0x21');var _0x2035e7=_0x1dc61f[_0xe1d7('0x23')];var _0x4d8c7d=_0x446ce6?0x0:_0x1f82ce[_0xe1d7('0x20')];var _0x17317e=_0x446ce6?_0x1dc61f[_0xe1d7('0x23')]:_0x1f82ce[_0xe1d7('0x20')]+_0x1f82ce[_0xe1d7('0x22')];var _0x5f2053;if(_0x17317e>=_0x2035e7){_0x17317e=_0x2035e7;_0x5f2053=0xc8;}else{_0x5f2053=0xce;}_0x800c15[_0xe1d7('0x1e')](_0x5f2053);return _0x800c15[_0xe1d7('0x24')](_0xe1d7('0x25'),_0x4d8c7d+'-'+_0x17317e+'/'+_0x2035e7)[_0xe1d7('0x1f')](_0x1dc61f);}return null;};}function patchUpdates(_0x33ac20){return function(_0x48ae1f){try{jsonpatch[_0xe1d7('0x26')](_0x48ae1f,_0x33ac20,!![]);}catch(_0x370c92){return BPromise[_0xe1d7('0x27')](_0x370c92);}return _0x48ae1f[_0xe1d7('0x28')]();};}function saveUpdates(_0x25e3c9,_0x38fc1b){return function(_0x3568ce){if(_0x3568ce){return _0x3568ce[_0xe1d7('0x29')](_0x25e3c9)[_0xe1d7('0x2a')](function(_0x2e47f7){return _0x2e47f7;});}return null;};}function removeEntity(_0x55446d,_0x672bed){return function(_0x7c1923){if(_0x7c1923){return _0x7c1923[_0xe1d7('0x2b')]()['then'](function(){_0x55446d[_0xe1d7('0x1e')](0xcc)[_0xe1d7('0x1d')]();});}};}function handleEntityNotFound(_0x19c671,_0x303523){return function(_0x471c82){if(!_0x471c82){_0x19c671[_0xe1d7('0x1c')](0x194);}return _0x471c82;};}function handleError(_0x95f28c,_0x55f7dd){_0x55f7dd=_0x55f7dd||0x1f4;return function(_0x3e8ca3){logger['error'](_0x3e8ca3[_0xe1d7('0x2c')]);if(_0x3e8ca3[_0xe1d7('0x2d')]){delete _0x3e8ca3['name'];}_0x95f28c['status'](_0x55f7dd)[_0xe1d7('0x2e')](_0x3e8ca3);};}exports[_0xe1d7('0x2f')]=function(_0x34eea8,_0x329506){var _0x2786d0={'raw':![],'where':{'id':_0x34eea8[_0xe1d7('0x30')]['id']}},_0x5bf10c={};_0x5bf10c[_0xe1d7('0x31')]=_[_0xe1d7('0x32')](db[_0xe1d7('0x33')][_0xe1d7('0x34')]);_0x5bf10c['query']=_[_0xe1d7('0x32')](_0x34eea8[_0xe1d7('0x35')]);_0x5bf10c[_0xe1d7('0x36')]=_[_0xe1d7('0x37')](_0x5bf10c[_0xe1d7('0x31')],_0x5bf10c[_0xe1d7('0x35')]);_0x2786d0[_0xe1d7('0x38')]=_[_0xe1d7('0x37')](_0x5bf10c['model'],qs[_0xe1d7('0x39')](_0x34eea8[_0xe1d7('0x35')][_0xe1d7('0x39')]));_0x2786d0['attributes']=_0x2786d0[_0xe1d7('0x38')][_0xe1d7('0x3a')]?_0x2786d0[_0xe1d7('0x38')]:_0x5bf10c[_0xe1d7('0x31')];if(_0x34eea8[_0xe1d7('0x35')][_0xe1d7('0x3b')]){_0x2786d0['include']=[{'all':!![]}];}_0x2786d0=_[_0xe1d7('0x3c')]({},_0x2786d0,_0x34eea8[_0xe1d7('0x3d')]);return db[_0xe1d7('0x33')][_0xe1d7('0x3e')](_0x2786d0)[_0xe1d7('0x2a')](handleEntityNotFound(_0x329506,null))[_0xe1d7('0x2a')](respondWithResult(_0x329506,null))['catch'](handleError(_0x329506,null));};exports[_0xe1d7('0x2b')]=function(_0x228f2c,_0x36f1d6){return db['DashboardItem'][_0xe1d7('0x3e')]({'where':{'id':_0x228f2c[_0xe1d7('0x30')]['id']}})[_0xe1d7('0x2a')](handleEntityNotFound(_0x36f1d6,null))['then'](removeEntity(_0x36f1d6,null))[_0xe1d7('0x3f')](handleError(_0x36f1d6,null));};function widgetAttributes(_0x594f4a){try{switch(_0x594f4a[_0xe1d7('0x40')]){case _0xe1d7('0x41'):return[{'name':'attrUrl','value':_0x594f4a[_0xe1d7('0x42')]||(_0x594f4a[_0xe1d7('0x43')]&&_0x594f4a[_0xe1d7('0x43')][0x0]?_0x594f4a['attrs'][0x0][_0xe1d7('0x44')]:undefined)||_0xe1d7('0x45')}];case'custom':return[{'name':_0xe1d7('0x46'),'value':_0x594f4a['attrPath']||(_0x594f4a[_0xe1d7('0x43')]&&_0x594f4a['attrs'][0x0]?_0x594f4a[_0xe1d7('0x43')][0x0][_0xe1d7('0x44')]:undefined)||''}];case _0xe1d7('0x47'):return[{'name':_0xe1d7('0x48'),'value':_0x594f4a[_0xe1d7('0x48')]||(_0x594f4a[_0xe1d7('0x43')]&&_0x594f4a[_0xe1d7('0x43')][0x0]?_0x594f4a[_0xe1d7('0x43')][0x0][_0xe1d7('0x44')]:undefined)||'HH:mm:ss'},{'name':_0xe1d7('0x49'),'value':_0x594f4a['attrTimezone']||(_0x594f4a[_0xe1d7('0x43')]&&_0x594f4a[_0xe1d7('0x43')][0x1]?_0x594f4a[_0xe1d7('0x43')][0x1][_0xe1d7('0x44')]:undefined)||_0xe1d7('0x4a')},{'name':_0xe1d7('0x4b'),'value':_0x594f4a[_0xe1d7('0x4b')]||(_0x594f4a['attrs']&&_0x594f4a[_0xe1d7('0x43')][0x2]?_0x594f4a[_0xe1d7('0x43')][0x2][_0xe1d7('0x44')]:undefined)||0xc}];case _0xe1d7('0x4c'):return[{'name':_0xe1d7('0x4d'),'value':_0x594f4a[_0xe1d7('0x4d')]||(_0x594f4a['attrs']&&_0x594f4a[_0xe1d7('0x43')][0x0]?_0x594f4a[_0xe1d7('0x43')][0x0][_0xe1d7('0x44')]:undefined)||'total'},{'name':_0xe1d7('0x4e'),'value':_0x594f4a[_0xe1d7('0x4e')]||(_0x594f4a[_0xe1d7('0x43')]&&_0x594f4a[_0xe1d7('0x43')][0x1]?_0x594f4a[_0xe1d7('0x43')][0x1]['value']:undefined)||[]},{'name':_0xe1d7('0x4b'),'value':_0x594f4a[_0xe1d7('0x4b')]||(_0x594f4a[_0xe1d7('0x43')]&&_0x594f4a[_0xe1d7('0x43')][0x2]?_0x594f4a[_0xe1d7('0x43')][0x2][_0xe1d7('0x44')]:undefined)||0x14},{'name':_0xe1d7('0x4f'),'value':_0x594f4a[_0xe1d7('0x4f')]||(_0x594f4a[_0xe1d7('0x43')]&&_0x594f4a[_0xe1d7('0x43')][0x3]?_0x594f4a['attrs'][0x3][_0xe1d7('0x44')]:undefined)||_0xe1d7('0x50')},{'name':_0xe1d7('0x51'),'value':_0x594f4a['attrEmailAccounts']||(_0x594f4a['attrs']&&_0x594f4a[_0xe1d7('0x43')][0x4]?_0x594f4a[_0xe1d7('0x43')][0x4][_0xe1d7('0x44')]:undefined)||''},{'name':_0xe1d7('0x52'),'value':_0x594f4a[_0xe1d7('0x52')]||(_0x594f4a['attrs']&&_0x594f4a[_0xe1d7('0x43')][0x5]?_0x594f4a['attrs'][0x5][_0xe1d7('0x44')]:undefined)||''},{'name':_0xe1d7('0x53'),'value':_0x594f4a[_0xe1d7('0x53')]||(_0x594f4a[_0xe1d7('0x43')]&&_0x594f4a[_0xe1d7('0x43')][0x6]?_0x594f4a['attrs'][0x6][_0xe1d7('0x44')]:undefined)||''},{'name':_0xe1d7('0x54'),'value':_0x594f4a[_0xe1d7('0x54')]||(_0x594f4a['attrs']&&_0x594f4a[_0xe1d7('0x43')][0x7]?_0x594f4a[_0xe1d7('0x43')][0x7][_0xe1d7('0x44')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x594f4a[_0xe1d7('0x55')]||(_0x594f4a['attrs']&&_0x594f4a[_0xe1d7('0x43')][0x8]?_0x594f4a[_0xe1d7('0x43')][0x8][_0xe1d7('0x44')]:undefined)||''},{'name':'attrChatWebsites','value':_0x594f4a['attrChatWebsites']||(_0x594f4a[_0xe1d7('0x43')]&&_0x594f4a[_0xe1d7('0x43')][0x9]?_0x594f4a[_0xe1d7('0x43')][0x9][_0xe1d7('0x44')]:undefined)||''}];case'multibar-chart':case _0xe1d7('0x56'):return[{'name':_0xe1d7('0x57'),'value':_0x594f4a[_0xe1d7('0x57')]||(_0x594f4a[_0xe1d7('0x43')]&&_0x594f4a['attrs'][0x0]?_0x594f4a[_0xe1d7('0x43')][0x0][_0xe1d7('0x44')]:undefined)||_0xe1d7('0x58')},{'name':_0xe1d7('0x59'),'value':_0x594f4a[_0xe1d7('0x59')]||(_0x594f4a['attrs']&&_0x594f4a[_0xe1d7('0x43')][0x1]?_0x594f4a[_0xe1d7('0x43')][0x1][_0xe1d7('0x44')]:undefined)||null},{'name':_0xe1d7('0x5a'),'value':_0x594f4a['attrSerie3']||(_0x594f4a[_0xe1d7('0x43')]&&_0x594f4a['attrs'][0x2]?_0x594f4a[_0xe1d7('0x43')][0x2][_0xe1d7('0x44')]:undefined)||null},{'name':_0xe1d7('0x4e'),'value':_0x594f4a[_0xe1d7('0x4e')]||(_0x594f4a['attrs']&&_0x594f4a[_0xe1d7('0x43')][0x3]?_0x594f4a[_0xe1d7('0x43')][0x3]['value']:undefined)||[]},{'name':_0xe1d7('0x4f'),'value':_0x594f4a[_0xe1d7('0x4f')]||(_0x594f4a[_0xe1d7('0x43')]&&_0x594f4a[_0xe1d7('0x43')][0x4]?_0x594f4a[_0xe1d7('0x43')][0x4][_0xe1d7('0x44')]:undefined)||_0xe1d7('0x50')},{'name':_0xe1d7('0x51'),'value':_0x594f4a[_0xe1d7('0x51')]||(_0x594f4a[_0xe1d7('0x43')]&&_0x594f4a['attrs'][0x5]?_0x594f4a['attrs'][0x5]['value']:undefined)||''},{'name':_0xe1d7('0x52'),'value':_0x594f4a[_0xe1d7('0x52')]||(_0x594f4a[_0xe1d7('0x43')]&&_0x594f4a['attrs'][0x6]?_0x594f4a['attrs'][0x6][_0xe1d7('0x44')]:undefined)||''},{'name':_0xe1d7('0x53'),'value':_0x594f4a['attrSmsAccounts']||(_0x594f4a['attrs']&&_0x594f4a[_0xe1d7('0x43')][0x7]?_0x594f4a[_0xe1d7('0x43')][0x7][_0xe1d7('0x44')]:undefined)||''},{'name':_0xe1d7('0x54'),'value':_0x594f4a[_0xe1d7('0x54')]||(_0x594f4a[_0xe1d7('0x43')]&&_0x594f4a['attrs'][0x8]?_0x594f4a['attrs'][0x8][_0xe1d7('0x44')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x594f4a[_0xe1d7('0x55')]||(_0x594f4a['attrs']&&_0x594f4a['attrs'][0x9]?_0x594f4a[_0xe1d7('0x43')][0x9]['value']:undefined)||''},{'name':_0xe1d7('0x5b'),'value':_0x594f4a['attrChatWebsites']||(_0x594f4a[_0xe1d7('0x43')]&&_0x594f4a[_0xe1d7('0x43')][0xa]?_0x594f4a[_0xe1d7('0x43')][0xa][_0xe1d7('0x44')]:undefined)||''}];case _0xe1d7('0x5c'):return[{'name':_0xe1d7('0x5d'),'type':_0x594f4a[_0xe1d7('0x5e')]||(_0x594f4a[_0xe1d7('0x43')]&&_0x594f4a['attrs'][0x0]?_0x594f4a[_0xe1d7('0x43')][0x0][_0xe1d7('0x40')]:undefined)||null,'value':_0x594f4a[_0xe1d7('0x5d')]||(_0x594f4a[_0xe1d7('0x43')]&&_0x594f4a['attrs'][0x0]?_0x594f4a[_0xe1d7('0x43')][0x0][_0xe1d7('0x44')]:undefined)||null},{'name':'attrRefresh','value':_0x594f4a[_0xe1d7('0x5f')]||(_0x594f4a['attrs']&&_0x594f4a[_0xe1d7('0x43')][0x1]?_0x594f4a['attrs'][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x23c97c){logger[_0xe1d7('0x60')](_0xe1d7('0x61'),JSON[_0xe1d7('0x62')](_0x23c97c));return[];}}exports[_0xe1d7('0x63')]=function(_0x184902,_0x524871){if(_0x184902[_0xe1d7('0x64')]){_0x184902[_0xe1d7('0x64')]['attrs']=widgetAttributes(_0x184902[_0xe1d7('0x64')]);}return db[_0xe1d7('0x33')]['create'](_0x184902[_0xe1d7('0x64')],{})[_0xe1d7('0x2a')](respondWithResult(_0x524871,0xc9))[_0xe1d7('0x3f')](handleError(_0x524871,null));};exports[_0xe1d7('0x29')]=function(_0x4e1d73,_0x13084e){if(_0x4e1d73[_0xe1d7('0x64')]['id']){delete _0x4e1d73[_0xe1d7('0x64')]['id'];}_0x4e1d73[_0xe1d7('0x64')][_0xe1d7('0x43')]=widgetAttributes(_0x4e1d73[_0xe1d7('0x64')]);return db[_0xe1d7('0x33')]['find']({'where':{'id':_0x4e1d73[_0xe1d7('0x30')]['id']}})[_0xe1d7('0x2a')](handleEntityNotFound(_0x13084e,null))[_0xe1d7('0x2a')](saveUpdates(_0x4e1d73[_0xe1d7('0x64')],null))[_0xe1d7('0x2a')](respondWithResult(_0x13084e,null))[_0xe1d7('0x3f')](handleError(_0x13084e,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index b0c91f6..76a5c6a 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 _0x7db2=['DashboardItem','setMaxListeners','save','update','remove','emit','hook','events','../../mysqldb'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x7db2,0x181));var _0x27db=function(_0x340c7c,_0x33400f){_0x340c7c=_0x340c7c-0x0;var _0x22f0ed=_0x7db2[_0x340c7c];return _0x22f0ed;};'use strict';var EventEmitter=require(_0x27db('0x0'));var DashboardItem=require(_0x27db('0x1'))['db'][_0x27db('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x27db('0x3')](0x0);var events={'afterCreate':_0x27db('0x4'),'afterUpdate':_0x27db('0x5'),'afterDestroy':_0x27db('0x6')};function emitEvent(_0x98f7e2){return function(_0x4f4f9f,_0xa81fbb,_0x385159){DashboardItemEvents[_0x27db('0x7')](_0x98f7e2+':'+_0x4f4f9f['id'],_0x4f4f9f);DashboardItemEvents[_0x27db('0x7')](_0x98f7e2,_0x4f4f9f);_0x385159(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem[_0x27db('0x8')](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file +var _0x1a50=['exports','events','../../mysqldb','DashboardItem','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x5671cd,_0x35c55d){var _0x507cd6=function(_0x303587){while(--_0x303587){_0x5671cd['push'](_0x5671cd['shift']());}};_0x507cd6(++_0x35c55d);}(_0x1a50,0x1eb));var _0x01a5=function(_0x8c318b,_0x309481){_0x8c318b=_0x8c318b-0x0;var _0x3c000a=_0x1a50[_0x8c318b];return _0x3c000a;};'use strict';var EventEmitter=require(_0x01a5('0x0'));var DashboardItem=require(_0x01a5('0x1'))['db'][_0x01a5('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x01a5('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x01a5('0x4'),'afterDestroy':_0x01a5('0x5')};function emitEvent(_0x251950){return function(_0x35736f,_0x2597de,_0x2fd333){DashboardItemEvents[_0x01a5('0x6')](_0x251950+':'+_0x35736f['id'],_0x35736f);DashboardItemEvents[_0x01a5('0x6')](_0x251950,_0x35736f);_0x2fd333(null);};}for(var e in events){if(events[_0x01a5('0x7')](e)){var event=events[e];DashboardItem[_0x01a5('0x8')](e,emitEvent(event));}}module[_0x01a5('0x9')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 428e002..9f66381 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 _0x3d2a=['moment','path','rimraf','../../config/environment','./dashboardItem.attributes','exports','DashboardItem','dashboard_items','../../config/logger','api'];(function(_0x5af654,_0x3da2de){var _0x4b4800=function(_0x1933ab){while(--_0x1933ab){_0x5af654['push'](_0x5af654['shift']());}};_0x4b4800(++_0x3da2de);}(_0x3d2a,0x1d4));var _0xa3d2=function(_0x4ed06c,_0x57c579){_0x4ed06c=_0x4ed06c-0x0;var _0x8d80b0=_0x3d2a[_0x4ed06c];return _0x8d80b0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa3d2('0x0'))(_0xa3d2('0x1'));var moment=require(_0xa3d2('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa3d2('0x3'));var rimraf=require(_0xa3d2('0x4'));var config=require(_0xa3d2('0x5'));var attributes=require(_0xa3d2('0x6'));module[_0xa3d2('0x7')]=function(_0x3de50d,_0x17ec0d){return _0x3de50d['define'](_0xa3d2('0x8'),attributes,{'tableName':_0xa3d2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2d19=['./dashboardItem.attributes','exports','define','DashboardItem','dashboard_items','lodash','../../config/logger','api','moment','request-promise','path','../../config/environment'];(function(_0x1f8f22,_0x56552b){var _0x48d097=function(_0xf17ba){while(--_0xf17ba){_0x1f8f22['push'](_0x1f8f22['shift']());}};_0x48d097(++_0x56552b);}(_0x2d19,0x1b5));var _0x92d1=function(_0x48c2ae,_0x4cea90){_0x48c2ae=_0x48c2ae-0x0;var _0x8f7531=_0x2d19[_0x48c2ae];return _0x8f7531;};'use strict';var _=require(_0x92d1('0x0'));var util=require('util');var logger=require(_0x92d1('0x1'))(_0x92d1('0x2'));var moment=require(_0x92d1('0x3'));var BPromise=require('bluebird');var rp=require(_0x92d1('0x4'));var fs=require('fs');var path=require(_0x92d1('0x5'));var rimraf=require('rimraf');var config=require(_0x92d1('0x6'));var attributes=require(_0x92d1('0x7'));module[_0x92d1('0x8')]=function(_0x4e7929,_0x3cc294){return _0x4e7929[_0x92d1('0x9')](_0x92d1('0xa'),attributes,{'tableName':_0x92d1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.rpc.js b/server/api/dashboardItem/dashboardItem.rpc.js index b8a1578..348b624 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 _0x98bd=['lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','socket.io-emitter','./dashboardItem.socket','register','request','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch'];(function(_0x3130b5,_0x23faf7){var _0xa6d8a3=function(_0x175be7){while(--_0x175be7){_0x3130b5['push'](_0x3130b5['shift']());}};_0xa6d8a3(++_0x23faf7);}(_0x98bd,0xf3));var _0xd98b=function(_0x332456,_0xe92667){_0x332456=_0x332456-0x0;var _0x3efd6d=_0x98bd[_0x332456];return _0x3efd6d;};'use strict';var _=require(_0xd98b('0x0'));var util=require('util');var moment=require(_0xd98b('0x1'));var BPromise=require('bluebird');var rs=require(_0xd98b('0x2'));var fs=require('fs');var Redis=require(_0xd98b('0x3'));var db=require(_0xd98b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd98b('0x5'))(_0xd98b('0x6'));var config=require(_0xd98b('0x7'));var jayson=require(_0xd98b('0x8'));var client=jayson['client'][_0xd98b('0x9')]({'port':0x232a});config['redis']=_[_0xd98b('0xa')](config[_0xd98b('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xd98b('0xc'))(new Redis(config[_0xd98b('0xb')]));require(_0xd98b('0xd'))[_0xd98b('0xe')](socket);function respondWithRpcPromise(_0x4628ab,_0x1f5c8b,_0x188817){return new BPromise(function(_0x2c08b2,_0x330956){return client[_0xd98b('0xf')](_0x4628ab,_0x188817)[_0xd98b('0x10')](function(_0x2dd228){logger[_0xd98b('0x11')](_0xd98b('0x12'),_0x1f5c8b,_0xd98b('0x13'));logger[_0xd98b('0x14')](_0xd98b('0x15'),_0x1f5c8b,_0xd98b('0x13'),JSON[_0xd98b('0x16')](_0x2dd228));if(_0x2dd228[_0xd98b('0x17')]){if(_0x2dd228[_0xd98b('0x17')][_0xd98b('0x18')]===0x1f4){logger[_0xd98b('0x17')](_0xd98b('0x12'),_0x1f5c8b,_0x2dd228[_0xd98b('0x17')]['message']);return _0x330956(_0x2dd228['error'][_0xd98b('0x19')]);}logger[_0xd98b('0x17')](_0xd98b('0x12'),_0x1f5c8b,_0x2dd228[_0xd98b('0x17')][_0xd98b('0x19')]);return _0x2c08b2(_0x2dd228[_0xd98b('0x17')]['message']);}else{logger[_0xd98b('0x11')](_0xd98b('0x12'),_0x1f5c8b,_0xd98b('0x13'));_0x2c08b2(_0x2dd228['result'][_0xd98b('0x19')]);}})[_0xd98b('0x1a')](function(_0x48c4b2){logger[_0xd98b('0x17')]('DashboardItem,\x20%s,\x20%s',_0x1f5c8b,_0x48c4b2);_0x330956(_0x48c4b2);});});} \ No newline at end of file +var _0x53ee=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','then','DashboardItem,\x20%s,\x20%s','debug','DashboardItem,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','lodash','util'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x53ee,0x1b8));var _0xe53e=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0x53ee[_0x17b6e3];return _0x3906f3;};'use strict';var _=require(_0xe53e('0x0'));var util=require(_0xe53e('0x1'));var moment=require(_0xe53e('0x2'));var BPromise=require(_0xe53e('0x3'));var rs=require(_0xe53e('0x4'));var fs=require('fs');var Redis=require(_0xe53e('0x5'));var db=require(_0xe53e('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xe53e('0x7'));var jayson=require(_0xe53e('0x8'));var client=jayson[_0xe53e('0x9')][_0xe53e('0xa')]({'port':0x232a});config['redis']=_[_0xe53e('0xb')](config['redis'],{'host':_0xe53e('0xc'),'port':0x18eb});var socket=require(_0xe53e('0xd'))(new Redis(config[_0xe53e('0xe')]));require('./dashboardItem.socket')['register'](socket);function respondWithRpcPromise(_0x56b2a0,_0x5ba1a6,_0x2ea65e){return new BPromise(function(_0xa5fb2d,_0x872dab){return client['request'](_0x56b2a0,_0x2ea65e)[_0xe53e('0xf')](function(_0x99d968){logger['info'](_0xe53e('0x10'),_0x5ba1a6,'request\x20sent');logger[_0xe53e('0x11')](_0xe53e('0x12'),_0x5ba1a6,_0xe53e('0x13'),JSON['stringify'](_0x99d968));if(_0x99d968[_0xe53e('0x14')]){if(_0x99d968[_0xe53e('0x14')][_0xe53e('0x15')]===0x1f4){logger[_0xe53e('0x14')](_0xe53e('0x10'),_0x5ba1a6,_0x99d968[_0xe53e('0x14')][_0xe53e('0x16')]);return _0x872dab(_0x99d968[_0xe53e('0x14')]['message']);}logger[_0xe53e('0x14')](_0xe53e('0x10'),_0x5ba1a6,_0x99d968[_0xe53e('0x14')][_0xe53e('0x16')]);return _0xa5fb2d(_0x99d968[_0xe53e('0x14')]['message']);}else{logger[_0xe53e('0x17')](_0xe53e('0x10'),_0x5ba1a6,_0xe53e('0x13'));_0xa5fb2d(_0x99d968[_0xe53e('0x18')]['message']);}})[_0xe53e('0x19')](function(_0x58035e){logger[_0xe53e('0x14')](_0xe53e('0x10'),_0x5ba1a6,_0x58035e);_0x872dab(_0x58035e);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 819df13..995b2ab 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 _0xe35b=['emit','removeListener','register','length','dashboardItem:','./dashboardItem.events','save','remove','update'];(function(_0x25c7ef,_0x2b82f3){var _0x4091e2=function(_0x3de986){while(--_0x3de986){_0x25c7ef['push'](_0x25c7ef['shift']());}};_0x4091e2(++_0x2b82f3);}(_0xe35b,0x95));var _0xbe35=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0xe35b[_0x3ff085];return _0x2b68c3;};'use strict';var DashboardItemEvents=require(_0xbe35('0x0'));var events=[_0xbe35('0x1'),_0xbe35('0x2'),_0xbe35('0x3')];function createListener(_0x319d6d,_0x49778c){return function(_0x2d7b42){_0x49778c[_0xbe35('0x4')](_0x319d6d,_0x2d7b42);};}function removeListener(_0x19f2ef,_0x1edc26){return function(){DashboardItemEvents[_0xbe35('0x5')](_0x19f2ef,_0x1edc26);};}exports[_0xbe35('0x6')]=function(_0x33762d){for(var _0x49a340=0x0,_0x147bc2=events[_0xbe35('0x7')];_0x49a340<_0x147bc2;_0x49a340++){var _0x3f2a55=events[_0x49a340];var _0x1cc636=createListener(_0xbe35('0x8')+_0x3f2a55,_0x33762d);DashboardItemEvents['on'](_0x3f2a55,_0x1cc636);}}; \ No newline at end of file +var _0xa12c=['removeListener','register','dashboardItem:','./dashboardItem.events','save','remove','update','emit'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xa12c,0xc3));var _0xca12=function(_0xd18935,_0x27358a){_0xd18935=_0xd18935-0x0;var _0x5ac0a9=_0xa12c[_0xd18935];return _0x5ac0a9;};'use strict';var DashboardItemEvents=require(_0xca12('0x0'));var events=[_0xca12('0x1'),_0xca12('0x2'),_0xca12('0x3')];function createListener(_0x207887,_0x54d005){return function(_0x3a4849){_0x54d005[_0xca12('0x4')](_0x207887,_0x3a4849);};}function removeListener(_0x4976d1,_0x24b012){return function(){DashboardItemEvents[_0xca12('0x5')](_0x4976d1,_0x24b012);};}exports[_0xca12('0x6')]=function(_0x11bbb4){for(var _0x257b6a=0x0,_0x4470aa=events['length'];_0x257b6a<_0x4470aa;_0x257b6a++){var _0x1977a4=events[_0x257b6a];var _0xc3b94c=createListener(_0xca12('0x7')+_0x1977a4,_0x11bbb4);DashboardItemEvents['on'](_0x1977a4,_0xc3b94c);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 32894ab..d1d31d0 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 _0x6035=['fs-extra','../../components/auth/service','../../config/environment','./dashboardItem.controller','get','/:id','show','post','isAuthenticated','create','update','delete','exports','multer','util','path','express','Router'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6035,0x151));var _0x5603=function(_0x5cf1c9,_0x5aaff1){_0x5cf1c9=_0x5cf1c9-0x0;var _0xc9ca52=_0x6035[_0x5cf1c9];return _0xc9ca52;};'use strict';var multer=require(_0x5603('0x0'));var util=require(_0x5603('0x1'));var path=require(_0x5603('0x2'));var timeout=require('connect-timeout');var express=require(_0x5603('0x3'));var router=express[_0x5603('0x4')]();var fs_extra=require(_0x5603('0x5'));var auth=require(_0x5603('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5603('0x7'));var controller=require(_0x5603('0x8'));router[_0x5603('0x9')](_0x5603('0xa'),auth['isAuthenticated'](),controller[_0x5603('0xb')]);router[_0x5603('0xc')]('/',auth[_0x5603('0xd')](),controller[_0x5603('0xe')]);router['put'](_0x5603('0xa'),auth[_0x5603('0xd')](),controller[_0x5603('0xf')]);router[_0x5603('0x10')]('/:id',auth[_0x5603('0xd')](),controller['destroy']);module[_0x5603('0x11')]=router; \ No newline at end of file +var _0x62b4=['/:id','delete','destroy','exports','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','post','put'];(function(_0x54d96a,_0x1ea8e8){var _0x591570=function(_0x401b69){while(--_0x401b69){_0x54d96a['push'](_0x54d96a['shift']());}};_0x591570(++_0x1ea8e8);}(_0x62b4,0xf4));var _0x462b=function(_0x70a8a5,_0x35a384){_0x70a8a5=_0x70a8a5-0x0;var _0x2b563b=_0x62b4[_0x70a8a5];return _0x2b563b;};'use strict';var multer=require('multer');var util=require(_0x462b('0x0'));var path=require(_0x462b('0x1'));var timeout=require('connect-timeout');var express=require(_0x462b('0x2'));var router=express['Router']();var fs_extra=require(_0x462b('0x3'));var auth=require(_0x462b('0x4'));var interaction=require(_0x462b('0x5'));var config=require(_0x462b('0x6'));var controller=require('./dashboardItem.controller');router[_0x462b('0x7')]('/:id',auth[_0x462b('0x8')](),controller[_0x462b('0x9')]);router[_0x462b('0xa')]('/',auth['isAuthenticated'](),controller['create']);router[_0x462b('0xb')](_0x462b('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x462b('0xd')](_0x462b('0xc'),auth[_0x462b('0x8')](),controller[_0x462b('0xe')]);module[_0x462b('0xf')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 2dfa879..db8355d 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 _0xcba9=['third','first','sequelize','STRING','ENUM','second'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0xcba9,0x1b8));var _0x9cba=function(_0x566622,_0x399507){_0x566622=_0x566622-0x0;var _0x1851dd=_0xcba9[_0x566622];return _0x1851dd;};'use strict';var Sequelize=require(_0x9cba('0x0'));module['exports']={'name':{'type':Sequelize[_0x9cba('0x1')],'allowNull':![]},'level':{'type':Sequelize[_0x9cba('0x2')]('first',_0x9cba('0x3'),_0x9cba('0x4')),'allowNull':![],'defaultValue':_0x9cba('0x5')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6c81=['STRING','ENUM','first','second','third','sequelize','exports'];(function(_0x16d171,_0x1af4f3){var _0x188de6=function(_0x2cbc1c){while(--_0x2cbc1c){_0x16d171['push'](_0x16d171['shift']());}};_0x188de6(++_0x1af4f3);}(_0x6c81,0xec));var _0x16c8=function(_0x5e7b6c,_0x4916d0){_0x5e7b6c=_0x5e7b6c-0x0;var _0x3afdbd=_0x6c81[_0x5e7b6c];return _0x3afdbd;};'use strict';var Sequelize=require(_0x16c8('0x0'));module[_0x16c8('0x1')]={'name':{'type':Sequelize[_0x16c8('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0x16c8('0x3')](_0x16c8('0x4'),_0x16c8('0x5'),_0x16c8('0x6')),'allowNull':![],'defaultValue':_0x16c8('0x4')},'description':{'type':Sequelize[_0x16c8('0x2')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 73764f8..494a0fd 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 _0x9bb8=['show','keys','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','end','error','stack','name','send','index','Disposition','rawAttributes','fieldName','type','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','catch'];(function(_0x2e0f3a,_0x1da125){var _0x31c337=function(_0x250be4){while(--_0x250be4){_0x2e0f3a['push'](_0x2e0f3a['shift']());}};_0x31c337(++_0x1da125);}(_0x9bb8,0x1ae));var _0x89bb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9bb8[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x89bb('0x0'));var rimraf=require(_0x89bb('0x1'));var zipdir=require(_0x89bb('0x2'));var jsonpatch=require(_0x89bb('0x3'));var rp=require(_0x89bb('0x4'));var moment=require(_0x89bb('0x5'));var BPromise=require(_0x89bb('0x6'));var Mustache=require(_0x89bb('0x7'));var util=require(_0x89bb('0x8'));var path=require(_0x89bb('0x9'));var sox=require(_0x89bb('0xa'));var csv=require(_0x89bb('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x89bb('0xc'));var _=require(_0x89bb('0xd'));var squel=require(_0x89bb('0xe'));var crypto=require(_0x89bb('0xf'));var jsforce=require(_0x89bb('0x10'));var deskjs=require(_0x89bb('0x11'));var toCsv=require('to-csv');var querystring=require(_0x89bb('0x12'));var Papa=require(_0x89bb('0x13'));var Redis=require('ioredis');var authService=require(_0x89bb('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x89bb('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x89bb('0x16'))('api');var utils=require(_0x89bb('0x17'));var config=require(_0x89bb('0x18'));var licenseUtil=require(_0x89bb('0x19'));var db=require(_0x89bb('0x1a'))['db'];function respondWithStatusCode(_0x49c4ed,_0x4be9b){_0x4be9b=_0x4be9b||0xcc;return function(_0x145c52){if(_0x145c52){return _0x49c4ed[_0x89bb('0x1b')](_0x4be9b);}return _0x49c4ed[_0x89bb('0x1c')](_0x4be9b)['end']();};}function respondWithResult(_0x5c2de2,_0xa4b4ff){_0xa4b4ff=_0xa4b4ff||0xc8;return function(_0x2de474){if(_0x2de474){return _0x5c2de2[_0x89bb('0x1c')](_0xa4b4ff)[_0x89bb('0x1d')](_0x2de474);}};}function respondWithFilteredResult(_0x46be86,_0x38cb28){return function(_0x55561d){if(_0x55561d){var _0x8b96d=typeof _0x38cb28[_0x89bb('0x1e')]==='undefined'&&typeof _0x38cb28[_0x89bb('0x1f')]===_0x89bb('0x20');var _0x1ff3b5=_0x55561d[_0x89bb('0x21')];var _0x310e3d=_0x8b96d?0x0:_0x38cb28['offset'];var _0x1693cc=_0x8b96d?_0x55561d[_0x89bb('0x21')]:_0x38cb28[_0x89bb('0x1e')]+_0x38cb28[_0x89bb('0x1f')];var _0x6dd873;if(_0x1693cc>=_0x1ff3b5){_0x1693cc=_0x1ff3b5;_0x6dd873=0xc8;}else{_0x6dd873=0xce;}_0x46be86[_0x89bb('0x1c')](_0x6dd873);return _0x46be86[_0x89bb('0x22')](_0x89bb('0x23'),_0x310e3d+'-'+_0x1693cc+'/'+_0x1ff3b5)[_0x89bb('0x1d')](_0x55561d);}return null;};}function patchUpdates(_0x26041d){return function(_0x5b2e17){try{jsonpatch[_0x89bb('0x24')](_0x5b2e17,_0x26041d,!![]);}catch(_0x3b8dc4){return BPromise[_0x89bb('0x25')](_0x3b8dc4);}return _0x5b2e17[_0x89bb('0x26')]();};}function saveUpdates(_0x276eb6,_0x25859e){return function(_0x4f2f49){if(_0x4f2f49){return _0x4f2f49[_0x89bb('0x27')](_0x276eb6)[_0x89bb('0x28')](function(_0x3e6f3d){return _0x3e6f3d;});}return null;};}function removeEntity(_0x2151a8,_0x3c173b){return function(_0x7fec2c){if(_0x7fec2c){return _0x7fec2c[_0x89bb('0x29')]()[_0x89bb('0x28')](function(){var _0x1f1c43=_0x7fec2c[_0x89bb('0x2a')]({'plain':!![]});var _0x4c25f6='Dispositions';return db[_0x89bb('0x2b')][_0x89bb('0x29')]({'where':{'type':_0x4c25f6,'resourceId':_0x1f1c43['id']}})[_0x89bb('0x28')](function(){return _0x7fec2c;});})[_0x89bb('0x28')](function(){_0x2151a8[_0x89bb('0x1c')](0xcc)[_0x89bb('0x2c')]();});}};}function handleEntityNotFound(_0x5082af,_0x8ef56d){return function(_0x34b852){if(!_0x34b852){_0x5082af[_0x89bb('0x1b')](0x194);}return _0x34b852;};}function handleError(_0x372103,_0x26403f){_0x26403f=_0x26403f||0x1f4;return function(_0x4fc489){logger[_0x89bb('0x2d')](_0x4fc489[_0x89bb('0x2e')]);if(_0x4fc489[_0x89bb('0x2f')]){delete _0x4fc489['name'];}_0x372103[_0x89bb('0x1c')](_0x26403f)[_0x89bb('0x30')](_0x4fc489);};}exports[_0x89bb('0x31')]=function(_0x1f2a2e,_0x56284d){var _0x40c0d2={},_0x577515={},_0x7f9529={'count':0x0,'rows':[]};var _0x3b9a13=_['map'](db[_0x89bb('0x32')][_0x89bb('0x33')],function(_0x1e71b6){return{'name':_0x1e71b6[_0x89bb('0x34')],'type':_0x1e71b6[_0x89bb('0x35')]['key']};});_0x577515[_0x89bb('0x36')]=_[_0x89bb('0x37')](_0x3b9a13,_0x89bb('0x2f'));_0x577515[_0x89bb('0x38')]=_['keys'](_0x1f2a2e[_0x89bb('0x38')]);_0x577515[_0x89bb('0x39')]=_[_0x89bb('0x3a')](_0x577515['model'],_0x577515[_0x89bb('0x38')]);_0x40c0d2[_0x89bb('0x3b')]=_[_0x89bb('0x3a')](_0x577515[_0x89bb('0x36')],qs[_0x89bb('0x3c')](_0x1f2a2e[_0x89bb('0x38')][_0x89bb('0x3c')]));_0x40c0d2[_0x89bb('0x3b')]=_0x40c0d2[_0x89bb('0x3b')][_0x89bb('0x3d')]?_0x40c0d2[_0x89bb('0x3b')]:_0x577515['model'];if(!_0x1f2a2e[_0x89bb('0x38')][_0x89bb('0x3e')]('nolimit')){_0x40c0d2[_0x89bb('0x1f')]=qs[_0x89bb('0x1f')](_0x1f2a2e['query']['limit']);_0x40c0d2['offset']=qs[_0x89bb('0x1e')](_0x1f2a2e['query']['offset']);}_0x40c0d2['order']=qs[_0x89bb('0x3f')](_0x1f2a2e[_0x89bb('0x38')][_0x89bb('0x3f')]);_0x40c0d2['where']=qs[_0x89bb('0x39')](_[_0x89bb('0x40')](_0x1f2a2e[_0x89bb('0x38')],_0x577515[_0x89bb('0x39')]),_0x3b9a13);if(_0x1f2a2e[_0x89bb('0x38')][_0x89bb('0x41')]){_0x40c0d2['where']=_[_0x89bb('0x42')](_0x40c0d2[_0x89bb('0x43')],{'$or':_['map'](_0x3b9a13,function(_0x3c358b){if(_0x3c358b[_0x89bb('0x35')]!==_0x89bb('0x44')){var _0x45e47c={};_0x45e47c[_0x3c358b[_0x89bb('0x2f')]]={'$like':'%'+_0x1f2a2e[_0x89bb('0x38')][_0x89bb('0x41')]+'%'};return _0x45e47c;}})});}_0x40c0d2=_[_0x89bb('0x42')]({},_0x40c0d2,_0x1f2a2e[_0x89bb('0x45')]);var _0x5be8c0={'where':_0x40c0d2['where']};return db[_0x89bb('0x32')][_0x89bb('0x21')](_0x5be8c0)[_0x89bb('0x28')](function(_0x114f98){_0x7f9529[_0x89bb('0x21')]=_0x114f98;if(_0x1f2a2e['query'][_0x89bb('0x46')]){_0x40c0d2[_0x89bb('0x47')]=[{'all':!![]}];}return db[_0x89bb('0x32')][_0x89bb('0x48')](_0x40c0d2);})[_0x89bb('0x28')](function(_0x4a51c0){_0x7f9529['rows']=_0x4a51c0;return _0x7f9529;})[_0x89bb('0x28')](respondWithFilteredResult(_0x56284d,_0x40c0d2))[_0x89bb('0x49')](handleError(_0x56284d,null));};exports[_0x89bb('0x4a')]=function(_0x2c8bc5,_0x278efa){var _0x3b53c4={'raw':!![],'where':{'id':_0x2c8bc5['params']['id']}},_0x609bec={};_0x609bec[_0x89bb('0x36')]=_['keys'](db[_0x89bb('0x32')][_0x89bb('0x33')]);_0x609bec[_0x89bb('0x38')]=_[_0x89bb('0x4b')](_0x2c8bc5[_0x89bb('0x38')]);_0x609bec[_0x89bb('0x39')]=_[_0x89bb('0x3a')](_0x609bec[_0x89bb('0x36')],_0x609bec[_0x89bb('0x38')]);_0x3b53c4['attributes']=_[_0x89bb('0x3a')](_0x609bec[_0x89bb('0x36')],qs[_0x89bb('0x3c')](_0x2c8bc5[_0x89bb('0x38')]['fields']));_0x3b53c4['attributes']=_0x3b53c4[_0x89bb('0x3b')]['length']?_0x3b53c4[_0x89bb('0x3b')]:_0x609bec[_0x89bb('0x36')];if(_0x2c8bc5[_0x89bb('0x38')][_0x89bb('0x46')]){_0x3b53c4['include']=[{'all':!![]}];}_0x3b53c4=_[_0x89bb('0x42')]({},_0x3b53c4,_0x2c8bc5[_0x89bb('0x45')]);return db[_0x89bb('0x32')][_0x89bb('0x4c')](_0x3b53c4)[_0x89bb('0x28')](handleEntityNotFound(_0x278efa,null))[_0x89bb('0x28')](respondWithResult(_0x278efa,null))[_0x89bb('0x49')](handleError(_0x278efa,null));};exports[_0x89bb('0x4d')]=function(_0x31bf4f,_0x5c52e7){return db[_0x89bb('0x32')][_0x89bb('0x4d')](_0x31bf4f[_0x89bb('0x4e')],{})['then'](function(_0x277f7c){var _0x3a95b1=_0x31bf4f['user'][_0x89bb('0x2a')]({'plain':!![]});if(!_0x3a95b1)throw new Error(_0x89bb('0x4f'));if(_0x3a95b1[_0x89bb('0x50')]===_0x89bb('0x51')){var _0x40732b=_0x277f7c[_0x89bb('0x2a')]({'plain':!![]});var _0x2d5a66='Dispositions';return db['UserProfileSection'][_0x89bb('0x4c')]({'where':{'name':_0x2d5a66,'userProfileId':_0x3a95b1[_0x89bb('0x52')]},'raw':!![]})['then'](function(_0x11075f){if(_0x11075f&&_0x11075f['autoAssociation']===0x0){return db[_0x89bb('0x2b')]['create']({'name':_0x40732b['name'],'resourceId':_0x40732b['id'],'type':_0x11075f[_0x89bb('0x2f')],'sectionId':_0x11075f['id']},{})[_0x89bb('0x28')](function(){return _0x277f7c;});}else{return _0x277f7c;}})['catch'](function(_0x81ec0f){logger[_0x89bb('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x81ec0f);throw _0x81ec0f;});}return _0x277f7c;})['then'](respondWithResult(_0x5c52e7,0xc9))[_0x89bb('0x49')](handleError(_0x5c52e7,null));};exports[_0x89bb('0x27')]=function(_0x2887ca,_0x543b5d){if(_0x2887ca['body']['id']){delete _0x2887ca[_0x89bb('0x4e')]['id'];}return db[_0x89bb('0x32')][_0x89bb('0x4c')]({'where':{'id':_0x2887ca[_0x89bb('0x53')]['id']}})[_0x89bb('0x28')](handleEntityNotFound(_0x543b5d,null))[_0x89bb('0x28')](saveUpdates(_0x2887ca[_0x89bb('0x4e')],null))[_0x89bb('0x28')](respondWithResult(_0x543b5d,null))['catch'](handleError(_0x543b5d,null));};exports[_0x89bb('0x29')]=function(_0x4e3866,_0x548304){return db[_0x89bb('0x32')][_0x89bb('0x4c')]({'where':{'id':_0x4e3866[_0x89bb('0x53')]['id']}})[_0x89bb('0x28')](handleEntityNotFound(_0x548304,null))['then'](removeEntity(_0x548304,null))['catch'](handleError(_0x548304,null));}; \ No newline at end of file +var _0xeeda=['params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','apply','reject','save','update','then','destroy','get','Dispositions','UserProfileResource','error','stack','name','send','index','map','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','VIRTUAL','options','Disposition','includeAll','include','rows','catch','show','rawAttributes','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0x30cd7e,_0x4db10a){var _0x462a02=function(_0x157d81){while(--_0x157d81){_0x30cd7e['push'](_0x30cd7e['shift']());}};_0x462a02(++_0x4db10a);}(_0xeeda,0x1be));var _0xaeed=function(_0xa81468,_0x2986eb){_0xa81468=_0xa81468-0x0;var _0x30383b=_0xeeda[_0xa81468];return _0x30383b;};'use strict';var emlformat=require(_0xaeed('0x0'));var rimraf=require(_0xaeed('0x1'));var zipdir=require(_0xaeed('0x2'));var jsonpatch=require(_0xaeed('0x3'));var rp=require(_0xaeed('0x4'));var moment=require(_0xaeed('0x5'));var BPromise=require(_0xaeed('0x6'));var Mustache=require(_0xaeed('0x7'));var util=require(_0xaeed('0x8'));var path=require(_0xaeed('0x9'));var sox=require(_0xaeed('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xaeed('0xb'));var _=require(_0xaeed('0xc'));var squel=require(_0xaeed('0xd'));var crypto=require(_0xaeed('0xe'));var jsforce=require(_0xaeed('0xf'));var deskjs=require(_0xaeed('0x10'));var toCsv=require(_0xaeed('0x11'));var querystring=require(_0xaeed('0x12'));var Papa=require(_0xaeed('0x13'));var Redis=require(_0xaeed('0x14'));var authService=require(_0xaeed('0x15'));var qs=require(_0xaeed('0x16'));var as=require(_0xaeed('0x17'));var hardwareService=require(_0xaeed('0x18'));var logger=require(_0xaeed('0x19'))(_0xaeed('0x1a'));var utils=require(_0xaeed('0x1b'));var config=require('../../config/environment');var licenseUtil=require(_0xaeed('0x1c'));var db=require(_0xaeed('0x1d'))['db'];function respondWithStatusCode(_0x5716a2,_0x4d9a67){_0x4d9a67=_0x4d9a67||0xcc;return function(_0x49e7a4){if(_0x49e7a4){return _0x5716a2[_0xaeed('0x1e')](_0x4d9a67);}return _0x5716a2[_0xaeed('0x1f')](_0x4d9a67)[_0xaeed('0x20')]();};}function respondWithResult(_0x4d3712,_0x4130e5){_0x4130e5=_0x4130e5||0xc8;return function(_0xcb1ecb){if(_0xcb1ecb){return _0x4d3712['status'](_0x4130e5)[_0xaeed('0x21')](_0xcb1ecb);}};}function respondWithFilteredResult(_0x178831,_0x72cdbe){return function(_0x4e649b){if(_0x4e649b){var _0x391ff6=typeof _0x72cdbe['offset']===_0xaeed('0x22')&&typeof _0x72cdbe[_0xaeed('0x23')]===_0xaeed('0x22');var _0x53aae7=_0x4e649b[_0xaeed('0x24')];var _0x54380=_0x391ff6?0x0:_0x72cdbe['offset'];var _0x38e512=_0x391ff6?_0x4e649b[_0xaeed('0x24')]:_0x72cdbe[_0xaeed('0x25')]+_0x72cdbe['limit'];var _0x3ceb5e;if(_0x38e512>=_0x53aae7){_0x38e512=_0x53aae7;_0x3ceb5e=0xc8;}else{_0x3ceb5e=0xce;}_0x178831['status'](_0x3ceb5e);return _0x178831['set']('Content-Range',_0x54380+'-'+_0x38e512+'/'+_0x53aae7)[_0xaeed('0x21')](_0x4e649b);}return null;};}function patchUpdates(_0x62e353){return function(_0x48c9a9){try{jsonpatch[_0xaeed('0x26')](_0x48c9a9,_0x62e353,!![]);}catch(_0x511475){return BPromise[_0xaeed('0x27')](_0x511475);}return _0x48c9a9[_0xaeed('0x28')]();};}function saveUpdates(_0x45e48b,_0x1a5481){return function(_0x23517a){if(_0x23517a){return _0x23517a[_0xaeed('0x29')](_0x45e48b)[_0xaeed('0x2a')](function(_0x128c0f){return _0x128c0f;});}return null;};}function removeEntity(_0x514561,_0x368ce5){return function(_0x3fb569){if(_0x3fb569){return _0x3fb569[_0xaeed('0x2b')]()[_0xaeed('0x2a')](function(){var _0x3833e7=_0x3fb569[_0xaeed('0x2c')]({'plain':!![]});var _0x13bf50=_0xaeed('0x2d');return db[_0xaeed('0x2e')]['destroy']({'where':{'type':_0x13bf50,'resourceId':_0x3833e7['id']}})[_0xaeed('0x2a')](function(){return _0x3fb569;});})['then'](function(){_0x514561[_0xaeed('0x1f')](0xcc)[_0xaeed('0x20')]();});}};}function handleEntityNotFound(_0x596af9,_0x3c8d46){return function(_0x3c377a){if(!_0x3c377a){_0x596af9[_0xaeed('0x1e')](0x194);}return _0x3c377a;};}function handleError(_0x912604,_0x45bbf7){_0x45bbf7=_0x45bbf7||0x1f4;return function(_0x45455f){logger[_0xaeed('0x2f')](_0x45455f[_0xaeed('0x30')]);if(_0x45455f['name']){delete _0x45455f[_0xaeed('0x31')];}_0x912604[_0xaeed('0x1f')](_0x45bbf7)[_0xaeed('0x32')](_0x45455f);};}exports[_0xaeed('0x33')]=function(_0x369114,_0x4b41c1){var _0x1801ef={},_0x5507b4={},_0x1ec23b={'count':0x0,'rows':[]};var _0x13d7ec=_[_0xaeed('0x34')](db['Disposition']['rawAttributes'],function(_0x505751){return{'name':_0x505751['fieldName'],'type':_0x505751[_0xaeed('0x35')][_0xaeed('0x36')]};});_0x5507b4[_0xaeed('0x37')]=_[_0xaeed('0x34')](_0x13d7ec,_0xaeed('0x31'));_0x5507b4[_0xaeed('0x38')]=_[_0xaeed('0x39')](_0x369114[_0xaeed('0x38')]);_0x5507b4['filters']=_[_0xaeed('0x3a')](_0x5507b4[_0xaeed('0x37')],_0x5507b4[_0xaeed('0x38')]);_0x1801ef[_0xaeed('0x3b')]=_[_0xaeed('0x3a')](_0x5507b4[_0xaeed('0x37')],qs[_0xaeed('0x3c')](_0x369114['query'][_0xaeed('0x3c')]));_0x1801ef['attributes']=_0x1801ef['attributes'][_0xaeed('0x3d')]?_0x1801ef[_0xaeed('0x3b')]:_0x5507b4[_0xaeed('0x37')];if(!_0x369114['query'][_0xaeed('0x3e')](_0xaeed('0x3f'))){_0x1801ef[_0xaeed('0x23')]=qs[_0xaeed('0x23')](_0x369114[_0xaeed('0x38')]['limit']);_0x1801ef[_0xaeed('0x25')]=qs[_0xaeed('0x25')](_0x369114[_0xaeed('0x38')][_0xaeed('0x25')]);}_0x1801ef[_0xaeed('0x40')]=qs[_0xaeed('0x41')](_0x369114['query'][_0xaeed('0x41')]);_0x1801ef['where']=qs[_0xaeed('0x42')](_['pick'](_0x369114[_0xaeed('0x38')],_0x5507b4['filters']),_0x13d7ec);if(_0x369114['query'][_0xaeed('0x43')]){_0x1801ef[_0xaeed('0x44')]=_['merge'](_0x1801ef[_0xaeed('0x44')],{'$or':_[_0xaeed('0x34')](_0x13d7ec,function(_0x5d8364){if(_0x5d8364['type']!==_0xaeed('0x45')){var _0x3c2aa3={};_0x3c2aa3[_0x5d8364[_0xaeed('0x31')]]={'$like':'%'+_0x369114[_0xaeed('0x38')]['filter']+'%'};return _0x3c2aa3;}})});}_0x1801ef=_['merge']({},_0x1801ef,_0x369114[_0xaeed('0x46')]);var _0x306ab2={'where':_0x1801ef[_0xaeed('0x44')]};return db[_0xaeed('0x47')][_0xaeed('0x24')](_0x306ab2)[_0xaeed('0x2a')](function(_0x567624){_0x1ec23b[_0xaeed('0x24')]=_0x567624;if(_0x369114[_0xaeed('0x38')][_0xaeed('0x48')]){_0x1801ef[_0xaeed('0x49')]=[{'all':!![]}];}return db[_0xaeed('0x47')]['findAll'](_0x1801ef);})[_0xaeed('0x2a')](function(_0x5ca00a){_0x1ec23b[_0xaeed('0x4a')]=_0x5ca00a;return _0x1ec23b;})['then'](respondWithFilteredResult(_0x4b41c1,_0x1801ef))[_0xaeed('0x4b')](handleError(_0x4b41c1,null));};exports[_0xaeed('0x4c')]=function(_0x4ce5db,_0x3861da){var _0x324424={'raw':!![],'where':{'id':_0x4ce5db['params']['id']}},_0x5a1f87={};_0x5a1f87[_0xaeed('0x37')]=_['keys'](db[_0xaeed('0x47')][_0xaeed('0x4d')]);_0x5a1f87[_0xaeed('0x38')]=_[_0xaeed('0x39')](_0x4ce5db[_0xaeed('0x38')]);_0x5a1f87['filters']=_[_0xaeed('0x3a')](_0x5a1f87[_0xaeed('0x37')],_0x5a1f87['query']);_0x324424['attributes']=_['intersection'](_0x5a1f87[_0xaeed('0x37')],qs[_0xaeed('0x3c')](_0x4ce5db[_0xaeed('0x38')][_0xaeed('0x3c')]));_0x324424['attributes']=_0x324424['attributes'][_0xaeed('0x3d')]?_0x324424[_0xaeed('0x3b')]:_0x5a1f87[_0xaeed('0x37')];if(_0x4ce5db[_0xaeed('0x38')][_0xaeed('0x48')]){_0x324424[_0xaeed('0x49')]=[{'all':!![]}];}_0x324424=_[_0xaeed('0x4e')]({},_0x324424,_0x4ce5db[_0xaeed('0x46')]);return db[_0xaeed('0x47')][_0xaeed('0x4f')](_0x324424)[_0xaeed('0x2a')](handleEntityNotFound(_0x3861da,null))[_0xaeed('0x2a')](respondWithResult(_0x3861da,null))[_0xaeed('0x4b')](handleError(_0x3861da,null));};exports[_0xaeed('0x50')]=function(_0x254bef,_0xb9c251){return db[_0xaeed('0x47')][_0xaeed('0x50')](_0x254bef[_0xaeed('0x51')],{})[_0xaeed('0x2a')](function(_0x14aed9){var _0x504e94=_0x254bef[_0xaeed('0x52')][_0xaeed('0x2c')]({'plain':!![]});if(!_0x504e94)throw new Error(_0xaeed('0x53'));if(_0x504e94['role']===_0xaeed('0x52')){var _0x4fd05b=_0x14aed9['get']({'plain':!![]});var _0x5d11c5='Dispositions';return db[_0xaeed('0x54')][_0xaeed('0x4f')]({'where':{'name':_0x5d11c5,'userProfileId':_0x504e94[_0xaeed('0x55')]},'raw':!![]})[_0xaeed('0x2a')](function(_0x1242df){if(_0x1242df&&_0x1242df[_0xaeed('0x56')]===0x0){return db[_0xaeed('0x2e')][_0xaeed('0x50')]({'name':_0x4fd05b[_0xaeed('0x31')],'resourceId':_0x4fd05b['id'],'type':_0x1242df[_0xaeed('0x31')],'sectionId':_0x1242df['id']},{})[_0xaeed('0x2a')](function(){return _0x14aed9;});}else{return _0x14aed9;}})[_0xaeed('0x4b')](function(_0x8576ae){logger[_0xaeed('0x2f')](_0xaeed('0x57'),_0x8576ae);throw _0x8576ae;});}return _0x14aed9;})[_0xaeed('0x2a')](respondWithResult(_0xb9c251,0xc9))[_0xaeed('0x4b')](handleError(_0xb9c251,null));};exports['update']=function(_0x4fcb8d,_0x33ece9){if(_0x4fcb8d[_0xaeed('0x51')]['id']){delete _0x4fcb8d[_0xaeed('0x51')]['id'];}return db[_0xaeed('0x47')][_0xaeed('0x4f')]({'where':{'id':_0x4fcb8d[_0xaeed('0x58')]['id']}})[_0xaeed('0x2a')](handleEntityNotFound(_0x33ece9,null))['then'](saveUpdates(_0x4fcb8d[_0xaeed('0x51')],null))['then'](respondWithResult(_0x33ece9,null))[_0xaeed('0x4b')](handleError(_0x33ece9,null));};exports[_0xaeed('0x2b')]=function(_0x59d244,_0x4a9b77){return db['Disposition']['find']({'where':{'id':_0x59d244['params']['id']}})[_0xaeed('0x2a')](handleEntityNotFound(_0x4a9b77,null))['then'](removeEntity(_0x4a9b77,null))[_0xaeed('0x4b')](handleError(_0x4a9b77,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 2292f42..a689714 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 _0xc617=['../../config/environment','exports','define','Disposition','tools_dispositions','name_voice','name','ListId','name_chat','ChatWebsiteId','name_mail','MailAccountId','name_sms','SmsAccountId','FaxAccountId','OpenchannelAccountId','WhatsappAccountId','util','../../config/logger','api','moment','bluebird','path'];(function(_0x602f67,_0xce5a83){var _0x373ecd=function(_0x2d6e2c){while(--_0x2d6e2c){_0x602f67['push'](_0x602f67['shift']());}};_0x373ecd(++_0xce5a83);}(_0xc617,0x1af));var _0x7c61=function(_0x1654f5,_0x5e1214){_0x1654f5=_0x1654f5-0x0;var _0x37cd7d=_0xc617[_0x1654f5];return _0x37cd7d;};'use strict';var _=require('lodash');var util=require(_0x7c61('0x0'));var logger=require(_0x7c61('0x1'))(_0x7c61('0x2'));var moment=require(_0x7c61('0x3'));var BPromise=require(_0x7c61('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7c61('0x5'));var rimraf=require('rimraf');var config=require(_0x7c61('0x6'));var attributes=require('./disposition.attributes');module[_0x7c61('0x7')]=function(_0x451997,_0x19fedd){return _0x451997[_0x7c61('0x8')](_0x7c61('0x9'),attributes,{'tableName':_0x7c61('0xa'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x7c61('0xb'),'fields':[_0x7c61('0xc'),_0x7c61('0xd')]},{'unique':!![],'name':_0x7c61('0xe'),'fields':['name',_0x7c61('0xf')]},{'unique':!![],'name':_0x7c61('0x10'),'fields':[_0x7c61('0xc'),_0x7c61('0x11')]},{'unique':!![],'name':_0x7c61('0x12'),'fields':[_0x7c61('0xc'),_0x7c61('0x13')]},{'unique':!![],'name':'name_fax','fields':[_0x7c61('0xc'),_0x7c61('0x14')]},{'unique':!![],'name':'name_openchannel','fields':[_0x7c61('0xc'),_0x7c61('0x15')]},{'unique':!![],'name':'name_whatsapp','fields':[_0x7c61('0xc'),_0x7c61('0x16')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2114=['name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','WhatsappAccountId','lodash','util','moment','bluebird','request-promise','rimraf','../../config/environment','./disposition.attributes','exports','define','Disposition','tools_dispositions','name_chat','name','ChatWebsiteId','name_mail','SmsAccountId'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x2114,0x1bd));var _0x4211=function(_0x35e92e,_0x21581b){_0x35e92e=_0x35e92e-0x0;var _0x1205a8=_0x2114[_0x35e92e];return _0x1205a8;};'use strict';var _=require(_0x4211('0x0'));var util=require(_0x4211('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x4211('0x2'));var BPromise=require(_0x4211('0x3'));var rp=require(_0x4211('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4211('0x5'));var config=require(_0x4211('0x6'));var attributes=require(_0x4211('0x7'));module[_0x4211('0x8')]=function(_0x4d07f4,_0x3a45b7){return _0x4d07f4[_0x4211('0x9')](_0x4211('0xa'),attributes,{'tableName':_0x4211('0xb'),'paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':['name','ListId']},{'unique':!![],'name':_0x4211('0xc'),'fields':[_0x4211('0xd'),_0x4211('0xe')]},{'unique':!![],'name':_0x4211('0xf'),'fields':[_0x4211('0xd'),'MailAccountId']},{'unique':!![],'name':'name_sms','fields':[_0x4211('0xd'),_0x4211('0x10')]},{'unique':!![],'name':_0x4211('0x11'),'fields':[_0x4211('0xd'),_0x4211('0x12')]},{'unique':!![],'name':_0x4211('0x13'),'fields':[_0x4211('0xd'),_0x4211('0x14')]},{'unique':!![],'name':'name_whatsapp','fields':[_0x4211('0xd'),_0x4211('0x15')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 593291f..1998431 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(_0x196eec,_0x1fc56f){var _0x3fe42f=function(_0x30c5d3){while(--_0x30c5d3){_0x196eec['push'](_0x196eec['shift']());}};_0x3fe42f(++_0x1fc56f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'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(_0x8333f8,_0x23afe0){var _0xaa6fe0=function(_0x21a154){while(--_0x21a154){_0x8333f8['push'](_0x8333f8['shift']());}};_0xaa6fe0(++_0x23afe0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xa9e0[_0x1c546c];return _0x2cc384;};'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 bf629b0..5c183c1 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 _0x6429=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','path','connect-timeout','express'];(function(_0xe9f7cf,_0xb6f32b){var _0x1230c8=function(_0x441a3a){while(--_0x441a3a){_0xe9f7cf['push'](_0xe9f7cf['shift']());}};_0x1230c8(++_0xb6f32b);}(_0x6429,0x82));var _0x9642=function(_0x47bbd5,_0xfab6bc){_0x47bbd5=_0x47bbd5-0x0;var _0xea2a13=_0x6429[_0x47bbd5];return _0xea2a13;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9642('0x0'));var timeout=require(_0x9642('0x1'));var express=require(_0x9642('0x2'));var router=express['Router']();var fs_extra=require(_0x9642('0x3'));var auth=require(_0x9642('0x4'));var interaction=require(_0x9642('0x5'));var config=require(_0x9642('0x6'));var controller=require(_0x9642('0x7'));router[_0x9642('0x8')]('/',auth['isAuthenticated'](),controller[_0x9642('0x9')]);router['get'](_0x9642('0xa'),auth[_0x9642('0xb')](),controller[_0x9642('0xc')]);router[_0x9642('0xd')]('/',auth[_0x9642('0xb')](),controller[_0x9642('0xe')]);router[_0x9642('0xf')]('/:id',auth[_0x9642('0xb')](),controller[_0x9642('0x10')]);router[_0x9642('0x11')](_0x9642('0xa'),auth[_0x9642('0xb')](),controller[_0x9642('0x12')]);module['exports']=router; \ No newline at end of file +var _0xfb3f=['../../components/interaction/service','../../config/environment','./disposition.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x1d50f2,_0x3c3ec6){var _0x3769b8=function(_0x50926a){while(--_0x50926a){_0x1d50f2['push'](_0x1d50f2['shift']());}};_0x3769b8(++_0x3c3ec6);}(_0xfb3f,0xe9));var _0xffb3=function(_0x231c70,_0x3a6518){_0x231c70=_0x231c70-0x0;var _0x245dcf=_0xfb3f[_0x231c70];return _0x245dcf;};'use strict';var multer=require('multer');var util=require(_0xffb3('0x0'));var path=require(_0xffb3('0x1'));var timeout=require(_0xffb3('0x2'));var express=require(_0xffb3('0x3'));var router=express[_0xffb3('0x4')]();var fs_extra=require(_0xffb3('0x5'));var auth=require(_0xffb3('0x6'));var interaction=require(_0xffb3('0x7'));var config=require(_0xffb3('0x8'));var controller=require(_0xffb3('0x9'));router[_0xffb3('0xa')]('/',auth[_0xffb3('0xb')](),controller[_0xffb3('0xc')]);router[_0xffb3('0xa')](_0xffb3('0xd'),auth['isAuthenticated'](),controller[_0xffb3('0xe')]);router[_0xffb3('0xf')]('/',auth['isAuthenticated'](),controller[_0xffb3('0x10')]);router['put'](_0xffb3('0xd'),auth[_0xffb3('0xb')](),controller[_0xffb3('0x11')]);router[_0xffb3('0x12')]('/:id',auth[_0xffb3('0xb')](),controller[_0xffb3('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index bd12cf7..c65d8b2 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 _0x5a5a=['BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','2400','4800','9600','12000','14400','7200','v17,v27,v29','INTEGER','IAX','DADHI','KHOMP','SIP','TEXT'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x5a5a,0x1d1));var _0xa5a5=function(_0x4c6186,_0x17c7a9){_0x4c6186=_0x4c6186-0x0;var _0x446cf6=_0x5a5a[_0x4c6186];return _0x446cf6;};'use strict';var Sequelize=require('sequelize');module[_0xa5a5('0x0')]={'name':{'type':Sequelize[_0xa5a5('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xa5a5('0x1')]},'ecm':{'type':Sequelize[_0xa5a5('0x2')](_0xa5a5('0x3'),'no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize[_0xa5a5('0x1')],'defaultValue':_0xa5a5('0x4')},'localstationid':{'type':Sequelize[_0xa5a5('0x1')],'unique':'localstationid'},'minrate':{'type':Sequelize['ENUM'](_0xa5a5('0x5'),_0xa5a5('0x6'),'7200',_0xa5a5('0x7'),_0xa5a5('0x8'),_0xa5a5('0x9')),'defaultValue':_0xa5a5('0x6')},'maxrate':{'type':Sequelize[_0xa5a5('0x2')]('2400',_0xa5a5('0x6'),_0xa5a5('0xa'),_0xa5a5('0x7'),_0xa5a5('0x8'),_0xa5a5('0x9')),'defaultValue':_0xa5a5('0x9')},'modem':{'type':Sequelize[_0xa5a5('0x1')],'defaultValue':_0xa5a5('0xb')},'gateway':{'type':Sequelize[_0xa5a5('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xa5a5('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xa5a5('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xa5a5('0x2')]('SIP',_0xa5a5('0xd'),_0xa5a5('0xe'),_0xa5a5('0xf')),'defaultValue':_0xa5a5('0x10')},'key':{'type':Sequelize[_0xa5a5('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xa5a5('0x11')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xa5a5('0x12')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xa5a5('0x12')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xa5a5('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xa5a5('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xa5a5('0x12')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xa5a5('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xa5a5('0x12')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xa5a5('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0xa5a5('0x13')},'mandatoryDisposition':{'type':Sequelize[_0xa5a5('0x12')],'defaultValue':![],'comment':_0xa5a5('0x14'),'set':function(_0x184652){if(!_0x184652)this[_0xa5a5('0x15')](_0xa5a5('0x16'),null);this[_0xa5a5('0x15')]('mandatoryDisposition',_0x184652);}}}; \ No newline at end of file +var _0xd101=['KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','2400','4800','7200','9600','12000','14400','INTEGER','SIP','DADHI'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xd101,0xc1));var _0x1d10=function(_0x58ee90,_0x63a4f8){_0x58ee90=_0x58ee90-0x0;var _0x5769e9=_0xd101[_0x58ee90];return _0x5769e9;};'use strict';var Sequelize=require(_0x1d10('0x0'));module['exports']={'name':{'type':Sequelize[_0x1d10('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x1d10('0x1')]},'ecm':{'type':Sequelize[_0x1d10('0x2')](_0x1d10('0x3'),'no'),'defaultValue':_0x1d10('0x3')},'headerinfo':{'type':Sequelize[_0x1d10('0x1')],'defaultValue':_0x1d10('0x4')},'localstationid':{'type':Sequelize[_0x1d10('0x1')],'unique':'localstationid'},'minrate':{'type':Sequelize[_0x1d10('0x2')](_0x1d10('0x5'),_0x1d10('0x6'),_0x1d10('0x7'),_0x1d10('0x8'),_0x1d10('0x9'),_0x1d10('0xa')),'defaultValue':_0x1d10('0x6')},'maxrate':{'type':Sequelize[_0x1d10('0x2')](_0x1d10('0x5'),_0x1d10('0x6'),_0x1d10('0x7'),_0x1d10('0x8'),_0x1d10('0x9'),_0x1d10('0xa')),'defaultValue':_0x1d10('0xa')},'modem':{'type':Sequelize[_0x1d10('0x1')],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize[_0x1d10('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x1d10('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x1d10('0xb')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x1d10('0x2')](_0x1d10('0xc'),'IAX',_0x1d10('0xd'),_0x1d10('0xe')),'defaultValue':_0x1d10('0xc')},'key':{'type':Sequelize[_0x1d10('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x1d10('0xf')],'defaultValue':function(){return _0x1d10('0x10');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x1d10('0x11')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x1d10('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x1d10('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x1d10('0x11')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x1d10('0x11')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x1d10('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x1d10('0xb')],'allowNull':!![],'defaultValue':null,'comment':_0x1d10('0x12')},'mandatoryDisposition':{'type':Sequelize[_0x1d10('0x11')],'defaultValue':![],'comment':_0x1d10('0x13'),'set':function(_0x4528a6){if(!_0x4528a6)this['setDataValue'](_0x1d10('0x14'),null);this[_0x1d10('0x15')](_0x1d10('0x16'),_0x4528a6);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 7dff83c..7f59b52 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 _0xc95c=['model','hasOwnProperty','sort','where','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','Pause','intersection','include','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','nolimit','order','pick','filter','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','addInteraction','omit','getInteractions','FaxInteraction','User','fullname','internal','Tags','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','findAndCountAll','priority','finally','json','getApplications','context','from-voip-provider','exten','app','description','Fax\x20Extension','appdata','push','Answer','CDR(type)=inbound-fax','ecm','localstationid','faxdetect','headerinfo','minrate','t38timeout','FAXOPT(','Set','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','VoiceExtension','updateAccountApplications','tech','createdAt','updatedAt','TrunkId','ListId','findById','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','CmContact','DESC','attachments','join','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','Contacts','filename','Messages','spread','out','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','jayson/promise','http','client','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','offset','limit','undefined','count','Content-Range','apply','reject','update','destroy','FaxAccounts','end','stack','name','send','index','mandatoryDispositionPause','map','FaxAccount','rawAttributes','fieldName','key','query','keys','filters','fields','attributes','length'];(function(_0x49624b,_0x485583){var _0x3e96b7=function(_0x51811e){while(--_0x51811e){_0x49624b['push'](_0x49624b['shift']());}};_0x3e96b7(++_0x485583);}(_0xc95c,0x7e));var _0xcc95=function(_0x397123,_0x38d7a0){_0x397123=_0x397123-0x0;var _0x461f95=_0xc95c[_0x397123];return _0x461f95;};'use strict';var emlformat=require(_0xcc95('0x0'));var rimraf=require(_0xcc95('0x1'));var zipdir=require(_0xcc95('0x2'));var jsonpatch=require(_0xcc95('0x3'));var rp=require(_0xcc95('0x4'));var moment=require(_0xcc95('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xcc95('0x6'));var path=require(_0xcc95('0x7'));var sox=require(_0xcc95('0x8'));var csv=require(_0xcc95('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcc95('0xa'));var _=require(_0xcc95('0xb'));var squel=require(_0xcc95('0xc'));var crypto=require(_0xcc95('0xd'));var jsforce=require(_0xcc95('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xcc95('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xcc95('0xf'));var authService=require(_0xcc95('0x10'));var qs=require(_0xcc95('0x11'));var as=require(_0xcc95('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xcc95('0x13'));var utils=require(_0xcc95('0x14'));var config=require(_0xcc95('0x15'));var licenseUtil=require(_0xcc95('0x16'));var db=require(_0xcc95('0x17'))['db'];config[_0xcc95('0x18')]=_[_0xcc95('0x19')](config['redis'],{'host':_0xcc95('0x1a'),'port':0x18eb});var socket=require(_0xcc95('0x1b'))(new Redis(config['redis']));require(_0xcc95('0x1c'))[_0xcc95('0x1d')](socket);var jayson=require(_0xcc95('0x1e'));var client=jayson['client'][_0xcc95('0x1f')]({'port':0x232c});var client9002=jayson[_0xcc95('0x20')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5bc840,_0x2c8daf,_0x1ffffc,_0x5b9da1){return new BPromise(function(_0x5c15c4,_0x593ea2){var _0xd99421=_0x5b9da1||client;return _0xd99421[_0xcc95('0x21')](_0x5bc840,_0x1ffffc)[_0xcc95('0x22')](function(_0x215594){logger[_0xcc95('0x23')](_0xcc95('0x24'),_0x2c8daf,_0xcc95('0x25'));logger[_0xcc95('0x26')](_0xcc95('0x27'),_0x2c8daf,'request\x20sent',JSON[_0xcc95('0x28')](_0x215594));if(_0x215594['error']){if(_0x215594[_0xcc95('0x29')][_0xcc95('0x2a')]===0x1f4){logger[_0xcc95('0x29')](_0xcc95('0x24'),_0x2c8daf,_0x215594['error'][_0xcc95('0x2b')]);return _0x593ea2(_0x215594['error'][_0xcc95('0x2b')]);}logger[_0xcc95('0x29')](_0xcc95('0x24'),_0x2c8daf,_0x215594[_0xcc95('0x29')][_0xcc95('0x2b')]);return _0x5c15c4(_0x215594[_0xcc95('0x29')][_0xcc95('0x2b')]);}else{logger[_0xcc95('0x23')](_0xcc95('0x24'),_0x2c8daf,_0xcc95('0x25'));_0x5c15c4(_0x215594[_0xcc95('0x2c')][_0xcc95('0x2b')]);}})['catch'](function(_0x291d1f){logger[_0xcc95('0x29')](_0xcc95('0x24'),_0x2c8daf,_0x291d1f);_0x593ea2(_0x291d1f);});});}function respondWithStatusCode(_0x14f645,_0x52f998){_0x52f998=_0x52f998||0xcc;return function(_0x586702){if(_0x586702){return _0x14f645[_0xcc95('0x2d')](_0x52f998);}return _0x14f645[_0xcc95('0x2e')](_0x52f998)['end']();};}function respondWithResult(_0x12a218,_0x3180a5){_0x3180a5=_0x3180a5||0xc8;return function(_0x282410){if(_0x282410){return _0x12a218[_0xcc95('0x2e')](_0x3180a5)['json'](_0x282410);}};}function respondWithFilteredResult(_0x43acf2,_0x325a31){return function(_0x45bcf0){if(_0x45bcf0){var _0x56f2bb=typeof _0x325a31[_0xcc95('0x2f')]==='undefined'&&typeof _0x325a31[_0xcc95('0x30')]===_0xcc95('0x31');var _0x364612=_0x45bcf0[_0xcc95('0x32')];var _0x1a13e8=_0x56f2bb?0x0:_0x325a31[_0xcc95('0x2f')];var _0x1c0fa9=_0x56f2bb?_0x45bcf0[_0xcc95('0x32')]:_0x325a31[_0xcc95('0x2f')]+_0x325a31[_0xcc95('0x30')];var _0x1e75f3;if(_0x1c0fa9>=_0x364612){_0x1c0fa9=_0x364612;_0x1e75f3=0xc8;}else{_0x1e75f3=0xce;}_0x43acf2[_0xcc95('0x2e')](_0x1e75f3);return _0x43acf2['set'](_0xcc95('0x33'),_0x1a13e8+'-'+_0x1c0fa9+'/'+_0x364612)['json'](_0x45bcf0);}return null;};}function patchUpdates(_0x3fe5f0){return function(_0x2abbe2){try{jsonpatch[_0xcc95('0x34')](_0x2abbe2,_0x3fe5f0,!![]);}catch(_0x2c5a0c){return BPromise[_0xcc95('0x35')](_0x2c5a0c);}return _0x2abbe2['save']();};}function saveUpdates(_0xe932f,_0x187805){return function(_0x43be3a){if(_0x43be3a){return _0x43be3a[_0xcc95('0x36')](_0xe932f)[_0xcc95('0x22')](function(_0x8eec5d){return _0x8eec5d;});}return null;};}function removeEntity(_0x373397,_0x2b57d2){return function(_0x429816){if(_0x429816){return _0x429816[_0xcc95('0x37')]()[_0xcc95('0x22')](function(){var _0x129ad2=_0x429816['get']({'plain':!![]});var _0x7049de=_0xcc95('0x38');return db['UserProfileResource'][_0xcc95('0x37')]({'where':{'type':_0x7049de,'resourceId':_0x129ad2['id']}})[_0xcc95('0x22')](function(){return _0x429816;});})['then'](function(){_0x373397[_0xcc95('0x2e')](0xcc)[_0xcc95('0x39')]();});}};}function handleEntityNotFound(_0x1929ea,_0x8339a4){return function(_0x148deb){if(!_0x148deb){_0x1929ea[_0xcc95('0x2d')](0x194);}return _0x148deb;};}function handleError(_0xf8b827,_0x271def){_0x271def=_0x271def||0x1f4;return function(_0x207ff8){logger[_0xcc95('0x29')](_0x207ff8[_0xcc95('0x3a')]);if(_0x207ff8['name']){delete _0x207ff8[_0xcc95('0x3b')];}_0xf8b827['status'](_0x271def)[_0xcc95('0x3c')](_0x207ff8);};}exports[_0xcc95('0x3d')]=function(_0x530080,_0x43f1bc){var _0x23a258={'include':[{'model':db['Pause'],'as':_0xcc95('0x3e')}]},_0x32001c={},_0x31e1c6={'count':0x0,'rows':[]};var _0x4c5bdf=_[_0xcc95('0x3f')](db[_0xcc95('0x40')][_0xcc95('0x41')],function(_0x7dba19){return{'name':_0x7dba19[_0xcc95('0x42')],'type':_0x7dba19['type'][_0xcc95('0x43')]};});_0x32001c['model']=_[_0xcc95('0x3f')](_0x4c5bdf,_0xcc95('0x3b'));_0x32001c[_0xcc95('0x44')]=_[_0xcc95('0x45')](_0x530080[_0xcc95('0x44')]);_0x32001c[_0xcc95('0x46')]=_['intersection'](_0x32001c['model'],_0x32001c[_0xcc95('0x44')]);_0x23a258['attributes']=_['intersection'](_0x32001c['model'],qs[_0xcc95('0x47')](_0x530080[_0xcc95('0x44')]['fields']));_0x23a258['attributes']=_0x23a258[_0xcc95('0x48')][_0xcc95('0x49')]?_0x23a258[_0xcc95('0x48')]:_0x32001c[_0xcc95('0x4a')];if(!_0x530080[_0xcc95('0x44')][_0xcc95('0x4b')]('nolimit')){_0x23a258[_0xcc95('0x30')]=qs['limit'](_0x530080[_0xcc95('0x44')][_0xcc95('0x30')]);_0x23a258[_0xcc95('0x2f')]=qs[_0xcc95('0x2f')](_0x530080[_0xcc95('0x44')]['offset']);}_0x23a258['order']=qs[_0xcc95('0x4c')](_0x530080[_0xcc95('0x44')][_0xcc95('0x4c')]);_0x23a258[_0xcc95('0x4d')]=qs[_0xcc95('0x46')](_['pick'](_0x530080[_0xcc95('0x44')],_0x32001c['filters']),_0x4c5bdf);if(_0x530080['query']['filter']){_0x23a258[_0xcc95('0x4d')]=_[_0xcc95('0x4e')](_0x23a258[_0xcc95('0x4d')],{'$or':_[_0xcc95('0x3f')](_0x4c5bdf,function(_0x7c3a0a){if(_0x7c3a0a[_0xcc95('0x4f')]!==_0xcc95('0x50')){var _0x2abc60={};_0x2abc60[_0x7c3a0a[_0xcc95('0x3b')]]={'$like':'%'+_0x530080[_0xcc95('0x44')]['filter']+'%'};return _0x2abc60;}})});}_0x23a258=_[_0xcc95('0x4e')]({},_0x23a258,_0x530080[_0xcc95('0x51')]);var _0x59ddea={'where':_0x23a258[_0xcc95('0x4d')]};return db[_0xcc95('0x40')][_0xcc95('0x32')](_0x59ddea)[_0xcc95('0x22')](function(_0x501f6f){_0x31e1c6[_0xcc95('0x32')]=_0x501f6f;if(_0x530080[_0xcc95('0x44')][_0xcc95('0x52')]){_0x23a258['include']=[{'all':!![]}];}return db['FaxAccount'][_0xcc95('0x53')](_0x23a258);})[_0xcc95('0x22')](function(_0x52c3bd){_0x31e1c6[_0xcc95('0x54')]=_0x52c3bd;return _0x31e1c6;})[_0xcc95('0x22')](respondWithFilteredResult(_0x43f1bc,_0x23a258))[_0xcc95('0x55')](handleError(_0x43f1bc,null));};exports[_0xcc95('0x56')]=function(_0x3eb1a7,_0x5176de){var _0x567896={'raw':![],'where':{'id':_0x3eb1a7[_0xcc95('0x57')]['id']},'include':[{'model':db[_0xcc95('0x58')],'as':_0xcc95('0x3e')}]},_0x28e95b={};_0x28e95b['model']=_[_0xcc95('0x45')](db[_0xcc95('0x40')][_0xcc95('0x41')]);_0x28e95b['query']=_['keys'](_0x3eb1a7[_0xcc95('0x44')]);_0x28e95b[_0xcc95('0x46')]=_['intersection'](_0x28e95b['model'],_0x28e95b[_0xcc95('0x44')]);_0x567896['attributes']=_[_0xcc95('0x59')](_0x28e95b[_0xcc95('0x4a')],qs[_0xcc95('0x47')](_0x3eb1a7[_0xcc95('0x44')][_0xcc95('0x47')]));_0x567896[_0xcc95('0x48')]=_0x567896['attributes'][_0xcc95('0x49')]?_0x567896[_0xcc95('0x48')]:_0x28e95b[_0xcc95('0x4a')];if(_0x3eb1a7[_0xcc95('0x44')][_0xcc95('0x52')]){_0x567896[_0xcc95('0x5a')]=[{'all':!![]}];}_0x567896=_[_0xcc95('0x4e')]({},_0x567896,_0x3eb1a7['options']);return db[_0xcc95('0x40')]['find'](_0x567896)['then'](handleEntityNotFound(_0x5176de,null))['then'](respondWithResult(_0x5176de,null))['catch'](handleError(_0x5176de,null));};exports[_0xcc95('0x5b')]=function(_0x34293f,_0xc82535){return db[_0xcc95('0x40')][_0xcc95('0x5b')](_0x34293f[_0xcc95('0x5c')],{})[_0xcc95('0x22')](function(_0x33c6ff){var _0x10919=_0x34293f[_0xcc95('0x5d')][_0xcc95('0x5e')]({'plain':!![]});if(!_0x10919)throw new Error(_0xcc95('0x5f'));if(_0x10919[_0xcc95('0x60')]===_0xcc95('0x5d')){var _0x470a9d=_0x33c6ff[_0xcc95('0x5e')]({'plain':!![]});var _0x158278=_0xcc95('0x38');return db[_0xcc95('0x61')][_0xcc95('0x62')]({'where':{'name':_0x158278,'userProfileId':_0x10919['userProfileId']},'raw':!![]})['then'](function(_0x45c1a7){if(_0x45c1a7&&_0x45c1a7[_0xcc95('0x63')]===0x0){return db['UserProfileResource'][_0xcc95('0x5b')]({'name':_0x470a9d['name'],'resourceId':_0x470a9d['id'],'type':_0x45c1a7[_0xcc95('0x3b')],'sectionId':_0x45c1a7['id']},{})[_0xcc95('0x22')](function(){return _0x33c6ff;});}else{return _0x33c6ff;}})[_0xcc95('0x55')](function(_0x59d106){logger[_0xcc95('0x29')](_0xcc95('0x64'),_0x59d106);throw _0x59d106;});}return _0x33c6ff;})[_0xcc95('0x22')](respondWithResult(_0xc82535,0xc9))[_0xcc95('0x55')](handleError(_0xc82535,null));};exports[_0xcc95('0x36')]=function(_0x5cd9d7,_0x4c3c27){if(_0x5cd9d7[_0xcc95('0x5c')]['id']){delete _0x5cd9d7[_0xcc95('0x5c')]['id'];}return db['FaxAccount'][_0xcc95('0x62')]({'where':{'id':_0x5cd9d7[_0xcc95('0x57')]['id']},'include':[{'model':db[_0xcc95('0x58')],'as':_0xcc95('0x3e')}]})[_0xcc95('0x22')](handleEntityNotFound(_0x4c3c27,null))['then'](saveUpdates(_0x5cd9d7[_0xcc95('0x5c')],null))[_0xcc95('0x22')](respondWithResult(_0x4c3c27,null))[_0xcc95('0x55')](handleError(_0x4c3c27,null));};exports[_0xcc95('0x37')]=function(_0x17da58,_0x28bb24){return db[_0xcc95('0x40')][_0xcc95('0x62')]({'where':{'id':_0x17da58[_0xcc95('0x57')]['id']}})[_0xcc95('0x22')](handleEntityNotFound(_0x28bb24,null))[_0xcc95('0x22')](removeEntity(_0x28bb24,null))['catch'](handleError(_0x28bb24,null));};exports[_0xcc95('0x65')]=function(_0x107792,_0x452fb8){return db[_0xcc95('0x40')][_0xcc95('0x65')]()[_0xcc95('0x22')](respondWithResult(_0x452fb8,null))[_0xcc95('0x55')](handleError(_0x452fb8,null));};exports[_0xcc95('0x66')]=function(_0xbfe61f,_0xa974d4,_0x32b171){if(_0xbfe61f[_0xcc95('0x5c')]['id']){delete _0xbfe61f[_0xcc95('0x5c')]['id'];}return db[_0xcc95('0x40')][_0xcc95('0x62')]({'where':{'id':_0xbfe61f[_0xcc95('0x57')]['id']}})[_0xcc95('0x22')](handleEntityNotFound(_0xa974d4,null))[_0xcc95('0x22')](function(_0x671e03){if(_0x671e03){_0xbfe61f[_0xcc95('0x5c')][_0xcc95('0x67')]=_0x671e03['id'];return db[_0xcc95('0x68')][_0xcc95('0x5b')](_0xbfe61f[_0xcc95('0x5c')]);}})[_0xcc95('0x22')](respondWithResult(_0xa974d4,null))[_0xcc95('0x55')](handleError(_0xa974d4,null));};exports[_0xcc95('0x69')]=function(_0x4b6371,_0x72b9ce,_0x294168){var _0x1031be={'raw':![],'where':{}};var _0x4efd16={};var _0x1573c4={'count':0x0,'rows':[]};return db[_0xcc95('0x40')][_0xcc95('0x6a')]({'where':{'id':_0x4b6371[_0xcc95('0x57')]['id']}})[_0xcc95('0x22')](handleEntityNotFound(_0x72b9ce,null))[_0xcc95('0x22')](function(_0x3ae588){if(_0x3ae588){_0x4efd16[_0xcc95('0x4a')]=_[_0xcc95('0x45')](db[_0xcc95('0x68')][_0xcc95('0x41')]);_0x4efd16[_0xcc95('0x44')]=_[_0xcc95('0x45')](_0x4b6371['query']);_0x4efd16[_0xcc95('0x46')]=_[_0xcc95('0x59')](_0x4efd16['model'],_0x4efd16[_0xcc95('0x44')]);_0x1031be[_0xcc95('0x48')]=_[_0xcc95('0x59')](_0x4efd16[_0xcc95('0x4a')],qs[_0xcc95('0x47')](_0x4b6371[_0xcc95('0x44')][_0xcc95('0x47')]));_0x1031be[_0xcc95('0x48')]=_0x1031be[_0xcc95('0x48')][_0xcc95('0x49')]?_0x1031be[_0xcc95('0x48')]:_0x4efd16['model'];if(!_0x4b6371[_0xcc95('0x44')][_0xcc95('0x4b')](_0xcc95('0x6b'))){_0x1031be[_0xcc95('0x30')]=qs[_0xcc95('0x30')](_0x4b6371[_0xcc95('0x44')]['limit']);_0x1031be[_0xcc95('0x2f')]=qs[_0xcc95('0x2f')](_0x4b6371[_0xcc95('0x44')]['offset']);}_0x1031be[_0xcc95('0x6c')]=qs[_0xcc95('0x4c')](_0x4b6371[_0xcc95('0x44')][_0xcc95('0x4c')]);_0x1031be[_0xcc95('0x4d')]=qs[_0xcc95('0x46')](_[_0xcc95('0x6d')](_0x4b6371[_0xcc95('0x44')],_0x4efd16['filters']));_0x1031be[_0xcc95('0x4d')][_0xcc95('0x67')]=_0x3ae588['id'];if(_0x4b6371[_0xcc95('0x44')]['filter']){_0x1031be[_0xcc95('0x4d')]=_['merge'](_0x1031be[_0xcc95('0x4d')],{'$or':_[_0xcc95('0x3f')](_0x1031be[_0xcc95('0x48')],function(_0x5b41d3){var _0x2d2ca5={};_0x2d2ca5[_0x5b41d3]={'$like':'%'+_0x4b6371[_0xcc95('0x44')][_0xcc95('0x6e')]+'%'};return _0x2d2ca5;})});}_0x1031be=_['merge']({},_0x1031be,_0x4b6371[_0xcc95('0x51')]);return db['Disposition'][_0xcc95('0x32')]({'where':_0x1031be[_0xcc95('0x4d')]})[_0xcc95('0x22')](function(_0x2bfe9b){_0x1573c4['count']=_0x2bfe9b;if(_0x4b6371['query']['includeAll']){_0x1031be[_0xcc95('0x5a')]=[{'all':!![]}];}return db[_0xcc95('0x68')][_0xcc95('0x53')](_0x1031be);})[_0xcc95('0x22')](function(_0x484518){_0x1573c4['rows']=_0x484518;return _0x1573c4;});}})[_0xcc95('0x22')](respondWithFilteredResult(_0x72b9ce,_0x1031be))[_0xcc95('0x55')](handleError(_0x72b9ce,null));};exports['removeDispositions']=function(_0x439b46,_0x33e14b,_0x5cc823){return db['FaxAccount'][_0xcc95('0x62')]({'where':{'id':_0x439b46[_0xcc95('0x57')]['id']}})[_0xcc95('0x22')](handleEntityNotFound(_0x33e14b,null))[_0xcc95('0x22')](function(_0x20511b){if(_0x20511b){return _0x20511b[_0xcc95('0x6f')](_0x439b46[_0xcc95('0x44')][_0xcc95('0x70')]);}})[_0xcc95('0x22')](respondWithStatusCode(_0x33e14b,null))['catch'](handleError(_0x33e14b,null));};exports[_0xcc95('0x71')]=function(_0x211acf,_0x2f4bc3,_0x25e18e){if(_0x211acf[_0xcc95('0x5c')]['id']){delete _0x211acf['body']['id'];}return db[_0xcc95('0x40')][_0xcc95('0x62')]({'where':{'id':_0x211acf[_0xcc95('0x57')]['id']}})[_0xcc95('0x22')](handleEntityNotFound(_0x2f4bc3,null))['then'](function(_0x4df443){if(_0x4df443){_0x211acf[_0xcc95('0x5c')][_0xcc95('0x67')]=_0x4df443['id'];return db['CannedAnswer'][_0xcc95('0x5b')](_0x211acf[_0xcc95('0x5c')]);}})['then'](respondWithResult(_0x2f4bc3,null))['catch'](handleError(_0x2f4bc3,null));};exports[_0xcc95('0x72')]=function(_0x4fafbf,_0x569b0a,_0x1557a7){var _0x151896={'raw':![],'where':{}};var _0xa88222={};var _0x1b5b46={'count':0x0,'rows':[]};return db[_0xcc95('0x40')][_0xcc95('0x6a')]({'where':{'id':_0x4fafbf[_0xcc95('0x57')]['id']}})[_0xcc95('0x22')](handleEntityNotFound(_0x569b0a,null))['then'](function(_0x3e5485){if(_0x3e5485){_0xa88222['model']=_[_0xcc95('0x45')](db[_0xcc95('0x73')][_0xcc95('0x41')]);_0xa88222[_0xcc95('0x44')]=_[_0xcc95('0x45')](_0x4fafbf[_0xcc95('0x44')]);_0xa88222[_0xcc95('0x46')]=_[_0xcc95('0x59')](_0xa88222[_0xcc95('0x4a')],_0xa88222[_0xcc95('0x44')]);_0x151896[_0xcc95('0x48')]=_[_0xcc95('0x59')](_0xa88222['model'],qs[_0xcc95('0x47')](_0x4fafbf[_0xcc95('0x44')][_0xcc95('0x47')]));_0x151896[_0xcc95('0x48')]=_0x151896[_0xcc95('0x48')][_0xcc95('0x49')]?_0x151896[_0xcc95('0x48')]:_0xa88222[_0xcc95('0x4a')];if(!_0x4fafbf[_0xcc95('0x44')][_0xcc95('0x4b')](_0xcc95('0x6b'))){_0x151896[_0xcc95('0x30')]=qs[_0xcc95('0x30')](_0x4fafbf[_0xcc95('0x44')]['limit']);_0x151896[_0xcc95('0x2f')]=qs[_0xcc95('0x2f')](_0x4fafbf['query']['offset']);}_0x151896[_0xcc95('0x6c')]=qs['sort'](_0x4fafbf[_0xcc95('0x44')][_0xcc95('0x4c')]);_0x151896[_0xcc95('0x4d')]=qs[_0xcc95('0x46')](_[_0xcc95('0x6d')](_0x4fafbf[_0xcc95('0x44')],_0xa88222[_0xcc95('0x46')]));_0x151896[_0xcc95('0x4d')][_0xcc95('0x67')]=_0x3e5485['id'];if(_0x4fafbf['query'][_0xcc95('0x6e')]){_0x151896[_0xcc95('0x4d')]=_[_0xcc95('0x4e')](_0x151896[_0xcc95('0x4d')],{'$or':_[_0xcc95('0x3f')](_0x151896[_0xcc95('0x48')],function(_0xae4dbe){var _0x17c72d={};_0x17c72d[_0xae4dbe]={'$like':'%'+_0x4fafbf['query'][_0xcc95('0x6e')]+'%'};return _0x17c72d;})});}_0x151896=_[_0xcc95('0x4e')]({},_0x151896,_0x4fafbf[_0xcc95('0x51')]);return db[_0xcc95('0x73')][_0xcc95('0x32')]({'where':_0x151896[_0xcc95('0x4d')]})[_0xcc95('0x22')](function(_0x13694a){_0x1b5b46[_0xcc95('0x32')]=_0x13694a;if(_0x4fafbf['query'][_0xcc95('0x52')]){_0x151896[_0xcc95('0x5a')]=[{'all':!![]}];}return db[_0xcc95('0x73')][_0xcc95('0x53')](_0x151896);})[_0xcc95('0x22')](function(_0x15a7ed){_0x1b5b46[_0xcc95('0x54')]=_0x15a7ed;return _0x1b5b46;});}})[_0xcc95('0x22')](respondWithFilteredResult(_0x569b0a,_0x151896))['catch'](handleError(_0x569b0a,null));};exports['removeAnswers']=function(_0x1ce4e7,_0x387152,_0x24ceda){return db[_0xcc95('0x40')][_0xcc95('0x62')]({'where':{'id':_0x1ce4e7['params']['id']}})[_0xcc95('0x22')](handleEntityNotFound(_0x387152,null))[_0xcc95('0x22')](function(_0x596ec7){if(_0x596ec7){return _0x596ec7['removeAnswers'](_0x1ce4e7[_0xcc95('0x44')][_0xcc95('0x70')]);}})[_0xcc95('0x22')](respondWithStatusCode(_0x387152,null))[_0xcc95('0x55')](handleError(_0x387152,null));};exports[_0xcc95('0x74')]=function(_0x465772,_0x79e0f3,_0x2ec3ea){return db['FaxInteraction']['find']({'where':{'id':_0x465772[_0xcc95('0x57')]['id']}})['then'](handleEntityNotFound(_0x79e0f3,null))['then'](function(_0xe303f4){if(_0xe303f4){return _0xe303f4['addInteraction'](_0x465772['body'][_0xcc95('0x70')],_[_0xcc95('0x75')](_0x465772[_0xcc95('0x5c')],['ids','id'])||{});}})[_0xcc95('0x22')](respondWithResult(_0x79e0f3,null))[_0xcc95('0x55')](handleError(_0x79e0f3,null));};exports[_0xcc95('0x76')]=function(_0x57cd0b,_0x1aaef8,_0x18b932){var _0xcd202a={'raw':![],'where':{}};var _0x524d40={};var _0x47d615={'count':0x0,'rows':[]};return db[_0xcc95('0x40')]['findOne']({'where':{'id':_0x57cd0b[_0xcc95('0x57')]['id']}})['then'](handleEntityNotFound(_0x1aaef8,null))[_0xcc95('0x22')](function(_0x17a918){if(_0x17a918){_0x524d40[_0xcc95('0x4a')]=_[_0xcc95('0x45')](db[_0xcc95('0x77')]['rawAttributes']);_0x524d40['query']=_[_0xcc95('0x45')](_0x57cd0b[_0xcc95('0x44')]);_0x524d40[_0xcc95('0x46')]=_[_0xcc95('0x59')](_0x524d40['model'],_0x524d40[_0xcc95('0x44')]);_0xcd202a[_0xcc95('0x48')]=_[_0xcc95('0x59')](_0x524d40['model'],qs[_0xcc95('0x47')](_0x57cd0b[_0xcc95('0x44')][_0xcc95('0x47')]));_0xcd202a[_0xcc95('0x48')]=_0xcd202a[_0xcc95('0x48')][_0xcc95('0x49')]?_0xcd202a[_0xcc95('0x48')]:_0x524d40[_0xcc95('0x4a')];if(!_0x57cd0b[_0xcc95('0x44')]['hasOwnProperty']('nolimit')){_0xcd202a[_0xcc95('0x30')]=qs['limit'](_0x57cd0b[_0xcc95('0x44')][_0xcc95('0x30')]);_0xcd202a['offset']=qs['offset'](_0x57cd0b[_0xcc95('0x44')][_0xcc95('0x2f')]);}_0xcd202a[_0xcc95('0x6c')]=qs[_0xcc95('0x4c')](_0x57cd0b['query']['sort']);_0xcd202a['where']=qs[_0xcc95('0x46')](_[_0xcc95('0x6d')](_0x57cd0b[_0xcc95('0x44')],_0x524d40['filters']));_0xcd202a['where'][_0xcc95('0x67')]=_0x17a918['id'];if(_0x57cd0b[_0xcc95('0x44')][_0xcc95('0x6e')]){_0xcd202a[_0xcc95('0x4d')]=_[_0xcc95('0x4e')](_0xcd202a['where'],{'$or':_[_0xcc95('0x3f')](_0xcd202a[_0xcc95('0x48')],function(_0x4bb263){var _0x31b2d8={};_0x31b2d8[_0x4bb263]={'$like':'%'+_0x57cd0b[_0xcc95('0x44')][_0xcc95('0x6e')]+'%'};return _0x31b2d8;})});}_0xcd202a=_[_0xcc95('0x4e')]({},_0xcd202a,_0x57cd0b[_0xcc95('0x51')]);return db[_0xcc95('0x77')]['count']({'where':_0xcd202a[_0xcc95('0x4d')]})['then'](function(_0x2d060a){_0x47d615[_0xcc95('0x32')]=_0x2d060a;if(_0x57cd0b[_0xcc95('0x44')][_0xcc95('0x52')]){_0xcd202a[_0xcc95('0x5a')]=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0xcc95('0x78')],'as':'Owner','attributes':[_0xcc95('0x3b'),_0xcc95('0x79'),_0xcc95('0x7a')],'required':![]},{'model':db['Tag'],'as':_0xcc95('0x7b'),'attributes':['id','name','color'],'where':_0x57cd0b[_0xcc95('0x44')][_0xcc95('0x7c')]?{'id':_0x57cd0b[_0xcc95('0x44')][_0xcc95('0x7c')]}:undefined,'required':_0x57cd0b[_0xcc95('0x44')][_0xcc95('0x7c')]?!![]:![]}];}return db[_0xcc95('0x77')][_0xcc95('0x53')](_0xcd202a);})[_0xcc95('0x22')](function(_0x5834b0){_0x47d615['rows']=_0x5834b0;return _0x47d615;});}})[_0xcc95('0x22')](respondWithFilteredResult(_0x1aaef8,_0xcd202a))['catch'](handleError(_0x1aaef8,null));};exports[_0xcc95('0x7d')]=function(_0x525665,_0x2eecc5){var _0xe25a1c=_0x525665['params']['id'];var _0x4aebcc=_0x525665[_0xcc95('0x5c')];var _0x42568c=0xc8;var _0xf91c45=null;return db[_0xcc95('0x7e')][_0xcc95('0x7f')]({'isolationLevel':db[_0xcc95('0x7e')][_0xcc95('0x80')][_0xcc95('0x81')][_0xcc95('0x82')]},function(_0x1e1c78){return db[_0xcc95('0x40')][_0xcc95('0x6a')]({'where':{'id':_0xe25a1c},'transaction':_0x1e1c78})[_0xcc95('0x22')](function(_0x2730d7){if(_0x2730d7){return db[_0xcc95('0x83')][_0xcc95('0x37')]({'where':{'FaxAccountId':_0xe25a1c},'transaction':_0x1e1c78})[_0xcc95('0x22')](function(){var _0x1bdd6c=_['map'](_0x4aebcc,function(_0x119151){_0x119151['FaxAccountId']=_0xe25a1c;return _0x119151;});return db[_0xcc95('0x83')][_0xcc95('0x84')](_0x1bdd6c,{'transaction':_0x1e1c78});});}else{_0x42568c=0x194;_0xf91c45=[];}});})[_0xcc95('0x22')](function(){if(_0x42568c!==0x194){return db[_0xcc95('0x83')][_0xcc95('0x85')]({'where':{'FaxAccountId':_0xe25a1c},'order':_0xcc95('0x86')})[_0xcc95('0x22')](function(_0x35d92c){_0xf91c45=_0x35d92c;});}})[_0xcc95('0x55')](function(_0x278da1){_0x42568c=0x1f4;logger['error'](_0x278da1[_0xcc95('0x3a')]);if(_0x278da1[_0xcc95('0x3b')]){delete _0x278da1[_0xcc95('0x3b')];}_0xf91c45=_0x278da1;})[_0xcc95('0x87')](function(){if(_0xf91c45===null){_0x2eecc5[_0xcc95('0x2d')](_0x42568c);}else{if(_0x42568c===0x1f4){_0x2eecc5[_0xcc95('0x2e')](_0x42568c)['send'](_0xf91c45);}else{_0x2eecc5[_0xcc95('0x2e')](_0x42568c)[_0xcc95('0x88')](_0xf91c45);}}});};exports[_0xcc95('0x89')]=function(_0x58d0ee,_0x514428,_0x2df54e){var _0x5562d5={};var _0x2b3004={};var _0x550fc7;var _0x45e00f;return db[_0xcc95('0x40')]['findOne']({'where':{'id':_0x58d0ee[_0xcc95('0x57')]['id']}})[_0xcc95('0x22')](handleEntityNotFound(_0x514428,null))[_0xcc95('0x22')](function(_0xea9183){if(_0xea9183){_0x550fc7=_0xea9183;_0x2b3004[_0xcc95('0x4a')]=_[_0xcc95('0x45')](db[_0xcc95('0x83')][_0xcc95('0x41')]);_0x2b3004[_0xcc95('0x44')]=_['keys'](_0x58d0ee[_0xcc95('0x44')]);_0x2b3004[_0xcc95('0x46')]=_[_0xcc95('0x59')](_0x2b3004[_0xcc95('0x4a')],_0x2b3004[_0xcc95('0x44')]);_0x5562d5[_0xcc95('0x48')]=_[_0xcc95('0x59')](_0x2b3004['model'],qs[_0xcc95('0x47')](_0x58d0ee['query'][_0xcc95('0x47')]));_0x5562d5[_0xcc95('0x48')]=_0x5562d5['attributes'][_0xcc95('0x49')]?_0x5562d5['attributes']:_0x2b3004[_0xcc95('0x4a')];_0x5562d5[_0xcc95('0x6c')]=qs['sort'](_0x58d0ee['query']['sort']);_0x5562d5[_0xcc95('0x4d')]=qs[_0xcc95('0x46')](_[_0xcc95('0x6d')](_0x58d0ee['query'],_0x2b3004[_0xcc95('0x46')]));if(_0x58d0ee[_0xcc95('0x44')][_0xcc95('0x6e')]){_0x5562d5[_0xcc95('0x4d')]=_[_0xcc95('0x4e')](_0x5562d5[_0xcc95('0x4d')],{'$or':_['map'](_0x5562d5['attributes'],function(_0x2a5a22){var _0x15065d={};_0x15065d[_0x2a5a22]={'$like':'%'+_0x58d0ee['query']['filter']+'%'};return _0x15065d;})});}_0x5562d5=_[_0xcc95('0x4e')]({},_0x5562d5,_0x58d0ee[_0xcc95('0x51')]);return _0x550fc7[_0xcc95('0x89')](_0x5562d5);}})[_0xcc95('0x22')](function(_0x5c7645){if(_0x5c7645){_0x45e00f=_0x5c7645['length'];if(!_0x58d0ee[_0xcc95('0x44')][_0xcc95('0x4b')](_0xcc95('0x6b'))){_0x5562d5[_0xcc95('0x30')]=qs['limit'](_0x58d0ee['query'][_0xcc95('0x30')]);_0x5562d5[_0xcc95('0x2f')]=qs[_0xcc95('0x2f')](_0x58d0ee[_0xcc95('0x44')][_0xcc95('0x2f')]);}return _0x550fc7['getApplications'](_0x5562d5);}})[_0xcc95('0x22')](function(_0x23b15d){if(_0x23b15d){return _0x23b15d?{'count':_0x45e00f,'rows':_0x23b15d}:null;}})[_0xcc95('0x22')](respondWithResult(_0x514428,null))[_0xcc95('0x55')](handleError(_0x514428,null));};function Extension(_0x59e57d,_0x268a69,_0x5813fd,_0x5d9e55){this[_0xcc95('0x8a')]=_0xcc95('0x8b');this[_0xcc95('0x8c')]=_0x59e57d['localstationid'];this[_0xcc95('0x8d')]=_0x5d9e55;this['type']='system';this[_0xcc95('0x8e')]=_0xcc95('0x8f');this[_0xcc95('0x67')]=_0x59e57d['id'];this[_0xcc95('0x86')]=_0x268a69;this[_0xcc95('0x90')]=_0x5813fd;}function createExtensionsReciveFax(_0x4ed875){var _0x580a2a=0x1;var _0x467031=[];_0x467031[_0xcc95('0x91')](new Extension(_0x4ed875,_0x580a2a,'',_0xcc95('0x92')));_0x580a2a+=0x1;_0x467031[_0xcc95('0x91')](new Extension(_0x4ed875,_0x580a2a,_0xcc95('0x93'),'Set'));_0x580a2a+=0x1;for(var _0xe74ab8 in _0x4ed875){if(_0x4ed875[_0xcc95('0x4b')](_0xe74ab8)&&(_0xe74ab8===_0xcc95('0x94')||_0xe74ab8===_0xcc95('0x95')||_0xe74ab8==='gateway'||_0xe74ab8===_0xcc95('0x96')||_0xe74ab8===_0xcc95('0x97')||_0xe74ab8==='maxrate'||_0xe74ab8===_0xcc95('0x98')||_0xe74ab8==='modem'||_0xe74ab8===_0xcc95('0x99'))){_0x467031[_0xcc95('0x91')](new Extension(_0x4ed875,_0x580a2a,_0xcc95('0x9a')+_0xe74ab8+')='+_0x4ed875[_0xe74ab8],_0xcc95('0x9b')));_0x580a2a+=0x1;}}_0x467031[_0xcc95('0x91')](new Extension(_0x4ed875,_0x580a2a,'6',_0xcc95('0x9c')));_0x580a2a+=0x1;_0x467031[_0xcc95('0x91')](new Extension(_0x4ed875,_0x580a2a,_0xcc95('0x9d'),'ReceiveFax'));_0x580a2a=0x0;return _0x467031;}exports['addAccountApplications']=function(_0x5c0d73,_0x5fc40c,_0x2b84ba){var _0x352d52;return db['sequelize'][_0xcc95('0x7f')](function(_0x340555){return db['FaxAccount'][_0xcc95('0x5b')](_0x5c0d73[_0xcc95('0x5c')],{'transaction':_0x340555})['then'](function(_0x470fab){_0x352d52=_0x470fab[_0xcc95('0x5e')]({'plain':!![]});return db[_0xcc95('0x9e')][_0xcc95('0x84')](createExtensionsReciveFax(_0x352d52),{'transaction':_0x340555});});})['then'](function(){return _0x352d52;})[_0xcc95('0x22')](respondWithResult(_0x5fc40c,null))[_0xcc95('0x55')](handleError(_0x5fc40c,null));};exports[_0xcc95('0x9f')]=function(_0x1d90ad,_0x290de9,_0xfe1e35){var _0x3418e3;return db[_0xcc95('0x7e')][_0xcc95('0x7f')](function(_0x44aca8){return db[_0xcc95('0x40')][_0xcc95('0x36')](_0x1d90ad[_0xcc95('0x5c')],{'where':{'id':_0x1d90ad[_0xcc95('0x5c')]['id']},'transaction':_0x44aca8})[_0xcc95('0x22')](function(_0x217007){return db['VoiceExtension']['destroy']({'where':{'FaxAccountId':_0x1d90ad['body']['id']},'transaction':_0x44aca8})[_0xcc95('0x22')](function(_0x14aa26){return db[_0xcc95('0x9e')][_0xcc95('0x84')](createExtensionsReciveFax(_[_0xcc95('0x75')](_0x1d90ad[_0xcc95('0x5c')],[_0xcc95('0xa0'),_0xcc95('0x43'),_0xcc95('0xa1'),_0xcc95('0xa2'),_0xcc95('0xa3'),_0xcc95('0xa4')])),{'transaction':_0x44aca8});});});})[_0xcc95('0x22')](function(){return db[_0xcc95('0x40')][_0xcc95('0xa5')](_0x1d90ad[_0xcc95('0x5c')]['id']);})[_0xcc95('0x22')](respondWithResult(_0x290de9,null))[_0xcc95('0x55')](handleError(_0x290de9,null));};exports[_0xcc95('0xa6')]=function(_0x2d9f8a,_0x17583e,_0x20c6ee){var _0x11bf5f={'raw':!![],'where':{}};var _0x4803ff={};var _0x301024={'count':0x0,'rows':[]};return db[_0xcc95('0x40')][_0xcc95('0x6a')]({'where':{'id':_0x2d9f8a[_0xcc95('0x57')]['id']}})['then'](handleEntityNotFound(_0x17583e,null))['then'](function(_0x41b947){if(_0x41b947){_0x4803ff['model']=_[_0xcc95('0x45')](db[_0xcc95('0xa7')][_0xcc95('0x41')]);_0x4803ff[_0xcc95('0x44')]=_[_0xcc95('0x45')](_0x2d9f8a[_0xcc95('0x44')]);_0x4803ff[_0xcc95('0x46')]=_[_0xcc95('0x59')](_0x4803ff[_0xcc95('0x4a')],_0x4803ff[_0xcc95('0x44')]);_0x11bf5f[_0xcc95('0x48')]=_[_0xcc95('0x59')](_0x4803ff[_0xcc95('0x4a')],qs['fields'](_0x2d9f8a[_0xcc95('0x44')][_0xcc95('0x47')]));_0x11bf5f['attributes']=_0x11bf5f[_0xcc95('0x48')][_0xcc95('0x49')]?_0x11bf5f['attributes']:_0x4803ff[_0xcc95('0x4a')];if(!_0x2d9f8a[_0xcc95('0x44')][_0xcc95('0x4b')](_0xcc95('0x6b'))){_0x11bf5f[_0xcc95('0x30')]=qs[_0xcc95('0x30')](_0x2d9f8a['query'][_0xcc95('0x30')]);_0x11bf5f[_0xcc95('0x2f')]=qs[_0xcc95('0x2f')](_0x2d9f8a[_0xcc95('0x44')][_0xcc95('0x2f')]);}_0x11bf5f[_0xcc95('0x6c')]=qs[_0xcc95('0x4c')](_0x2d9f8a[_0xcc95('0x44')][_0xcc95('0x4c')]);_0x11bf5f[_0xcc95('0x4d')]=qs[_0xcc95('0x46')](_[_0xcc95('0x6d')](_0x2d9f8a[_0xcc95('0x44')],_0x4803ff[_0xcc95('0x46')]));_0x11bf5f[_0xcc95('0x4d')][_0xcc95('0x67')]=_0x41b947['id'];if(_0x2d9f8a[_0xcc95('0x44')][_0xcc95('0x6e')]){_0x11bf5f[_0xcc95('0x4d')]=_[_0xcc95('0x4e')](_0x11bf5f[_0xcc95('0x4d')],{'$or':_[_0xcc95('0x3f')](_0x11bf5f[_0xcc95('0x48')],function(_0x599320){var _0x1e66b5={};_0x1e66b5[_0x599320]={'$like':'%'+_0x2d9f8a['query']['filter']+'%'};return _0x1e66b5;})});}if(_0x2d9f8a[_0xcc95('0x44')][_0xcc95('0xa8')]){var _0x1947ce=_0x2d9f8a['query']['$gte'][_0xcc95('0xa9')](',');var _0x32cedc={};_0x32cedc[_0x1947ce[0x0]]={'$gte':moment(_0x1947ce[0x1])[_0xcc95('0xaa')](_0xcc95('0xab'))};_0x11bf5f['where']=_[_0xcc95('0x4e')](_0x11bf5f[_0xcc95('0x4d')],_0x32cedc);}_0x11bf5f=_[_0xcc95('0x4e')]({},_0x11bf5f,_0x2d9f8a[_0xcc95('0x51')]);return db[_0xcc95('0xa7')][_0xcc95('0x32')]({'where':_0x11bf5f[_0xcc95('0x4d')]})[_0xcc95('0x22')](function(_0x22d106){_0x301024[_0xcc95('0x32')]=_0x22d106;if(_0x2d9f8a['query'][_0xcc95('0x52')]){_0x11bf5f[_0xcc95('0x5a')]=[{'all':!![]}];}return db[_0xcc95('0xa7')][_0xcc95('0x53')](_0x11bf5f);})[_0xcc95('0x22')](function(_0x21e25e){_0x301024[_0xcc95('0x54')]=_0x21e25e;return _0x301024;});}})['then'](respondWithFilteredResult(_0x17583e,_0x11bf5f))[_0xcc95('0x55')](handleError(_0x17583e,null));};exports[_0xcc95('0x3c')]=function(_0x534e93,_0x4c404d,_0x77e8bd){var _0x4228bf,_0x5bba04={},_0x4dd9e0;if(_0x534e93['body']['to']){_0x4dd9e0=_0x534e93['body']['to'][0x0];}return db[_0xcc95('0x40')][_0xcc95('0x62')]({'where':{'id':_0x534e93[_0xcc95('0x57')]['id']},'include':[{'model':db[_0xcc95('0xac')],'as':_0xcc95('0xad'),'include':[{'model':db[_0xcc95('0xae')],'as':'Contacts','where':{'fax':_0x4dd9e0},'limit':0x1,'order':[[_0xcc95('0xa2'),_0xcc95('0xaf')]]}]}]})[_0xcc95('0x22')](handleEntityNotFound(_0x4c404d,null))[_0xcc95('0x22')](function(_0x12066b){_0x4228bf=_0x12066b;if(_0x534e93[_0xcc95('0x5c')][_0xcc95('0xb0')]&&_0x534e93[_0xcc95('0x5c')][_0xcc95('0xb0')]['length']){for(var _0x1d489a=0x0;_0x1d489a<_0x534e93[_0xcc95('0x5c')][_0xcc95('0xb0')][_0xcc95('0x49')];_0x1d489a+=0x1){_0x534e93[_0xcc95('0x5c')][_0xcc95('0xb0')][_0x1d489a]={'filename':_0x534e93[_0xcc95('0x5c')][_0xcc95('0xb0')][_0x1d489a]['name'],'id':_0x534e93[_0xcc95('0x5c')][_0xcc95('0xb0')][_0x1d489a]['id'],'path':path[_0xcc95('0xb1')](config['root'],_0xcc95('0xb2'),_0x534e93['body'][_0xcc95('0xb0')][_0x1d489a][_0xcc95('0xb3')])};}}return respondWithRpcPromise(_0xcc95('0xb4'),_0xcc95('0xb4'),{'FaxAccountId':_[_0xcc95('0xb5')](_0x534e93['params']['id'])?undefined:_0x534e93[_0xcc95('0x57')]['id'],'path':_['isNil'](_0x534e93[_0xcc95('0x5c')][_0xcc95('0xb0')][0x0][_0xcc95('0x7')])?undefined:_0x534e93[_0xcc95('0x5c')][_0xcc95('0xb0')][0x0][_0xcc95('0x7')],'fax':_[_0xcc95('0xb5')](_0x534e93[_0xcc95('0x5c')]['to'][0x0])?undefined:_0x534e93[_0xcc95('0x5c')]['to'][0x0]},client9002);})[_0xcc95('0x22')](function(){if(_0x4228bf){if(_[_0xcc95('0xb5')](_0x534e93['body'][_0xcc95('0xb6')])){_0x534e93[_0xcc95('0x5c')][_0xcc95('0xb6')]=util[_0xcc95('0xaa')](_0xcc95('0xb7'),_0x4228bf[_0xcc95('0x3b')],_0x4228bf[_0xcc95('0xb8')]);}if(_0x4228bf['List']){if(_0x4228bf[_0xcc95('0xad')][_0xcc95('0xb9')][_0xcc95('0x49')]){return _0x4228bf[_0xcc95('0xad')]['Contacts'][0x0];}else{return db['CmContact'][_0xcc95('0x5b')](_[_0xcc95('0x19')](_0x534e93[_0xcc95('0x5c')],{'firstName':_0x534e93['body']['to'][0x0],'phone':_0x534e93[_0xcc95('0x5c')]['to'][0x0],'fax':_0x534e93['body']['to'][0x0],'ListId':_0x4228bf[_0xcc95('0xa4')]}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error('Send\x20Fax\x20failed');}})[_0xcc95('0x22')](function(_0x3f431f){if(_0x3f431f){return db['FaxInteraction'][_0xcc95('0x62')]({'where':{'ContactId':_0x3f431f['id'],'closed':![],'FaxAccountId':_0x4228bf['id']}})[_0xcc95('0x22')](function(_0x175920){if(_0x175920){return[_0x175920,![]];}return db[_0xcc95('0x77')][_0xcc95('0x5b')]({'UserId':_0x534e93[_0xcc95('0x5d')]['id'],'ContactId':_0x3f431f['id'],'FaxAccountId':_0x4228bf['id'],'fax':_0x534e93[_0xcc95('0x5c')]['to'][0x0],'firstMsgDirection':'out','Messages':[_[_0xcc95('0x4e')](_0x534e93[_0xcc95('0x5c')],{'read':![],'body':_0x534e93[_0xcc95('0x5c')][_0xcc95('0xb0')][0x0][_0xcc95('0xba')],'FaxAccountId':_0x4228bf['id'],'UserId':_0x534e93['user']['id'],'ContactId':_0x3f431f['id'],'AttachmentId':_0x534e93['body'][_0xcc95('0xb0')][0x0]['id']})]},{'include':[{'model':db[_0xcc95('0xa7')],'as':_0xcc95('0xbb')}]})[_0xcc95('0x22')](function(_0xa613a9){return[_0xa613a9,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0xcc95('0xbc')](function(_0x4d3ade,_0x504177){if(_0x504177){return _0x4d3ade;}return db[_0xcc95('0xa7')][_0xcc95('0x5b')]({'direction':_0xcc95('0xbd'),'read':![],'body':_0x534e93[_0xcc95('0x5c')]['attachments'][0x0][_0xcc95('0xba')],'FaxAccountId':_0x4228bf['id'],'FaxInteractionId':_0x4d3ade['id'],'UserId':_0x534e93['user']['id'],'ContactId':_0x4d3ade[_0xcc95('0xbe')],'AttachmentId':_0x534e93[_0xcc95('0x5c')][_0xcc95('0xb0')][0x0]['id']})[_0xcc95('0x22')](function(_0xa95500){_0x4d3ade['dataValues'][_0xcc95('0xbb')]=[];_0x4d3ade[_0xcc95('0xbf')]['Messages'][_0xcc95('0x91')](_0xa95500[_0xcc95('0xbf')]);return _0x4d3ade;});})[_0xcc95('0x22')](function(_0x40caf1){respondWithRpcPromise(_0xcc95('0xc0'),_0xcc95('0xc0'),{'FaxAccountId':_[_0xcc95('0xb5')](_0x534e93['params']['id'])?undefined:_0x534e93[_0xcc95('0x57')]['id'],'path':_[_0xcc95('0xb5')](_0x534e93['body'][_0xcc95('0xb0')][0x0][_0xcc95('0x7')])?undefined:_0x534e93[_0xcc95('0x5c')][_0xcc95('0xb0')][0x0]['path'],'fax':_[_0xcc95('0xb5')](_0x534e93['body']['to'][0x0])?undefined:_0x534e93['body']['to'][0x0],'AttachmentId':_0x534e93[_0xcc95('0x5c')][_0xcc95('0xb0')][0x0]['id']},client9002)[_0xcc95('0x22')](function(_0x282b0f){logger[_0xcc95('0x23')]('SendFaxRpc,\x20%s',_0x282b0f);})['catch'](function(_0x1f8133){logger[_0xcc95('0x23')](_0xcc95('0xc1'),_0x1f8133);});return _0x40caf1;})[_0xcc95('0x22')](respondWithResult(_0x4c404d,null))['catch'](handleError(_0x4c404d,null));};exports[_0xcc95('0xc2')]=function(_0x1aa085,_0x3b2c86,_0x42c08e){return db['FaxAccount'][_0xcc95('0x62')]({'where':{'id':_0x1aa085[_0xcc95('0x57')]['id']}})[_0xcc95('0x22')](handleEntityNotFound(_0x3b2c86,null))[_0xcc95('0x22')](function(_0x1ecd11){if(_0x1ecd11){return _0x1ecd11['addAgents'](_0x1aa085[_0xcc95('0x5c')][_0xcc95('0x70')],_['omit'](_0x1aa085['body'],[_0xcc95('0x70'),'id'])||{})['spread'](function(_0x38ef84){for(var _0x1f7ba8=0x0;_0x1f7ba8<_0x1aa085[_0xcc95('0x5c')][_0xcc95('0x70')][_0xcc95('0x49')];_0x1f7ba8+=0x1){socket[_0xcc95('0xc3')]('userFaxAccount:save',{'UserId':Number(_0x1aa085['body']['ids'][_0x1f7ba8]),'FaxAccountId':Number(_0x1aa085[_0xcc95('0x57')]['id'])});}return _0x38ef84;});}})[_0xcc95('0x22')](respondWithResult(_0x3b2c86,null))['catch'](handleError(_0x3b2c86,null));};exports[_0xcc95('0xc4')]=function(_0x1089b7,_0x1dd7be,_0x117dc1){return db[_0xcc95('0x40')][_0xcc95('0x62')]({'where':{'id':_0x1089b7[_0xcc95('0x57')]['id']}})[_0xcc95('0x22')](handleEntityNotFound(_0x1dd7be,null))[_0xcc95('0x22')](function(_0x2ae894){if(_0x2ae894){return _0x2ae894[_0xcc95('0xc4')](_0x1089b7[_0xcc95('0x44')]['ids'])[_0xcc95('0x22')](function(){if(_[_0xcc95('0xc5')](_0x1089b7['query'][_0xcc95('0x70')])){for(var _0x121bb2=0x0;_0x121bb2<_0x1089b7[_0xcc95('0x44')]['ids'][_0xcc95('0x49')];_0x121bb2+=0x1){socket[_0xcc95('0xc3')](_0xcc95('0xc6'),{'UserId':Number(_0x1089b7[_0xcc95('0x44')][_0xcc95('0x70')][_0x121bb2]),'FaxAccountId':Number(_0x1089b7[_0xcc95('0x57')]['id'])});}}else{socket[_0xcc95('0xc3')](_0xcc95('0xc6'),{'UserId':Number(_0x1089b7['query'][_0xcc95('0x70')]),'FaxAccountId':Number(_0x1089b7['params']['id'])});}});}})[_0xcc95('0x22')](respondWithStatusCode(_0x1dd7be,null))[_0xcc95('0x55')](handleError(_0x1dd7be,null));};exports[_0xcc95('0xc7')]=function(_0x5b5bf5,_0x390152,_0x24d621){var _0x82df04={};var _0xbb4e81={};var _0x33a892;var _0x15bd62;return db[_0xcc95('0x40')][_0xcc95('0x6a')]({'where':{'id':_0x5b5bf5[_0xcc95('0x57')]['id']}})[_0xcc95('0x22')](handleEntityNotFound(_0x390152,null))[_0xcc95('0x22')](function(_0x39f3d8){if(_0x39f3d8){_0x33a892=_0x39f3d8;_0xbb4e81[_0xcc95('0x4a')]=_[_0xcc95('0x45')](db[_0xcc95('0x78')][_0xcc95('0x41')]);_0xbb4e81[_0xcc95('0x44')]=_[_0xcc95('0x45')](_0x5b5bf5[_0xcc95('0x44')]);_0xbb4e81[_0xcc95('0x46')]=_[_0xcc95('0x59')](_0xbb4e81['model'],_0xbb4e81[_0xcc95('0x44')]);_0x82df04[_0xcc95('0x48')]=_['intersection'](_0xbb4e81['model'],qs[_0xcc95('0x47')](_0x5b5bf5['query'][_0xcc95('0x47')]));_0x82df04[_0xcc95('0x48')]=_0x82df04[_0xcc95('0x48')]['length']?_0x82df04[_0xcc95('0x48')]:_0xbb4e81[_0xcc95('0x4a')];_0x82df04[_0xcc95('0x6c')]=qs['sort'](_0x5b5bf5[_0xcc95('0x44')]['sort']);_0x82df04[_0xcc95('0x4d')]=qs['filters'](_[_0xcc95('0x6d')](_0x5b5bf5[_0xcc95('0x44')],_0xbb4e81[_0xcc95('0x46')]));if(_0x5b5bf5[_0xcc95('0x44')][_0xcc95('0x6e')]){_0x82df04['where']=_[_0xcc95('0x4e')](_0x82df04['where'],{'$or':_[_0xcc95('0x3f')](_0x82df04[_0xcc95('0x48')],function(_0x3d7f6c){var _0x1dd905={};_0x1dd905[_0x3d7f6c]={'$like':'%'+_0x5b5bf5[_0xcc95('0x44')][_0xcc95('0x6e')]+'%'};return _0x1dd905;})});}_0x82df04=_[_0xcc95('0x4e')]({},_0x82df04,_0x5b5bf5[_0xcc95('0x51')]);return _0x33a892['getAgents'](_0x82df04);}})[_0xcc95('0x22')](function(_0x542a24){if(_0x542a24){_0x15bd62=_0x542a24[_0xcc95('0x49')];if(!_0x5b5bf5[_0xcc95('0x44')][_0xcc95('0x4b')]('nolimit')){_0x82df04[_0xcc95('0x30')]=qs[_0xcc95('0x30')](_0x5b5bf5[_0xcc95('0x44')]['limit']);_0x82df04[_0xcc95('0x2f')]=qs['offset'](_0x5b5bf5[_0xcc95('0x44')]['offset']);}return _0x33a892[_0xcc95('0xc7')](_0x82df04);}})[_0xcc95('0x22')](function(_0x1b982f){if(_0x1b982f){return _0x1b982f?{'count':_0x15bd62,'rows':_0x1b982f}:null;}})[_0xcc95('0x22')](respondWithResult(_0x390152,null))[_0xcc95('0x55')](handleError(_0x390152,null));}; \ No newline at end of file +var _0x43e6=['findOne','hasOwnProperty','includeAll','removeDispositions','ids','CannedAnswer','removeAnswers','addInteraction','omit','getInteractions','FaxInteraction','User','Owner','internal','Tags','color','tag','addApplications','sequelize','Transaction','READ_COMMITTED','FaxApplication','findAndCountAll','finally','getApplications','context','exten','localstationid','app','system','Fax\x20Extension','priority','appdata','CDR(type)=inbound-fax','Set','gateway','headerinfo','maxrate','minrate','t38timeout','FAXOPT(','push','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','addAccountApplications','transaction','VoiceExtension','bulkCreate','updateAccountApplications','createdAt','updatedAt','TrunkId','findById','getMessages','FaxMessage','$gte','split','CmList','List','DESC','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','Contacts','CmContact','defaults','List\x20not\x20found','Send\x20Fax\x20failed','filename','Messages','Contact\x20not\x20found','spread','out','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','redis','localhost','./faxAccount.socket','register','client','http','then','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','status','end','json','undefined','offset','count','limit','set','Content-Range','reject','save','update','destroy','FaxAccounts','sendStatus','stack','name','send','mandatoryDispositionPause','FaxAccount','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','findAll','rows','show','params','Pause','keys','length','include','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','FaxAccountId','Disposition','getDispositions'];(function(_0x17f543,_0x420152){var _0x4a1345=function(_0xb05876){while(--_0xb05876){_0x17f543['push'](_0x17f543['shift']());}};_0x4a1345(++_0x420152);}(_0x43e6,0x11b));var _0x643e=function(_0x1f8619,_0x279f35){_0x1f8619=_0x1f8619-0x0;var _0x19ea04=_0x43e6[_0x1f8619];return _0x19ea04;};'use strict';var emlformat=require(_0x643e('0x0'));var rimraf=require(_0x643e('0x1'));var zipdir=require(_0x643e('0x2'));var jsonpatch=require(_0x643e('0x3'));var rp=require(_0x643e('0x4'));var moment=require(_0x643e('0x5'));var BPromise=require(_0x643e('0x6'));var Mustache=require(_0x643e('0x7'));var util=require(_0x643e('0x8'));var path=require(_0x643e('0x9'));var sox=require(_0x643e('0xa'));var csv=require(_0x643e('0xb'));var ejs=require(_0x643e('0xc'));var fs=require('fs');var fs_extra=require(_0x643e('0xd'));var _=require(_0x643e('0xe'));var squel=require(_0x643e('0xf'));var crypto=require(_0x643e('0x10'));var jsforce=require(_0x643e('0x11'));var deskjs=require('desk.js');var toCsv=require(_0x643e('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x643e('0x12'));var authService=require(_0x643e('0x13'));var qs=require(_0x643e('0x14'));var as=require(_0x643e('0x15'));var hardwareService=require(_0x643e('0x16'));var logger=require(_0x643e('0x17'))(_0x643e('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x643e('0x19'));var db=require('../../mysqldb')['db'];config[_0x643e('0x1a')]=_['defaults'](config['redis'],{'host':_0x643e('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x643e('0x1a')]));require(_0x643e('0x1c'))[_0x643e('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson[_0x643e('0x1e')][_0x643e('0x1f')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x516290,_0x100280,_0x507fac,_0x29eb70){return new BPromise(function(_0x5a2ae5,_0x2c391c){var _0x167a73=_0x29eb70||client;return _0x167a73['request'](_0x516290,_0x507fac)[_0x643e('0x20')](function(_0x2eaf94){logger['info'](_0x643e('0x21'),_0x100280,_0x643e('0x22'));logger[_0x643e('0x23')](_0x643e('0x24'),_0x100280,_0x643e('0x22'),JSON[_0x643e('0x25')](_0x2eaf94));if(_0x2eaf94[_0x643e('0x26')]){if(_0x2eaf94[_0x643e('0x26')]['code']===0x1f4){logger[_0x643e('0x26')]('FaxAccount,\x20%s,\x20%s',_0x100280,_0x2eaf94[_0x643e('0x26')][_0x643e('0x27')]);return _0x2c391c(_0x2eaf94[_0x643e('0x26')][_0x643e('0x27')]);}logger[_0x643e('0x26')]('FaxAccount,\x20%s,\x20%s',_0x100280,_0x2eaf94[_0x643e('0x26')]['message']);return _0x5a2ae5(_0x2eaf94[_0x643e('0x26')][_0x643e('0x27')]);}else{logger[_0x643e('0x28')](_0x643e('0x21'),_0x100280,_0x643e('0x22'));_0x5a2ae5(_0x2eaf94[_0x643e('0x29')]['message']);}})[_0x643e('0x2a')](function(_0x207763){logger[_0x643e('0x26')]('FaxAccount,\x20%s,\x20%s',_0x100280,_0x207763);_0x2c391c(_0x207763);});});}function respondWithStatusCode(_0x5e2fc1,_0x4aef73){_0x4aef73=_0x4aef73||0xcc;return function(_0x362f5d){if(_0x362f5d){return _0x5e2fc1['sendStatus'](_0x4aef73);}return _0x5e2fc1[_0x643e('0x2b')](_0x4aef73)[_0x643e('0x2c')]();};}function respondWithResult(_0xdb0892,_0x1ee11c){_0x1ee11c=_0x1ee11c||0xc8;return function(_0x1956c4){if(_0x1956c4){return _0xdb0892['status'](_0x1ee11c)[_0x643e('0x2d')](_0x1956c4);}};}function respondWithFilteredResult(_0x3b0326,_0xbea1e3){return function(_0x55783b){if(_0x55783b){var _0x55a9b2=typeof _0xbea1e3['offset']==='undefined'&&typeof _0xbea1e3['limit']===_0x643e('0x2e');var _0x219dd9=_0x55783b['count'];var _0x30dac8=_0x55a9b2?0x0:_0xbea1e3[_0x643e('0x2f')];var _0x59f219=_0x55a9b2?_0x55783b[_0x643e('0x30')]:_0xbea1e3[_0x643e('0x2f')]+_0xbea1e3[_0x643e('0x31')];var _0x3305a0;if(_0x59f219>=_0x219dd9){_0x59f219=_0x219dd9;_0x3305a0=0xc8;}else{_0x3305a0=0xce;}_0x3b0326['status'](_0x3305a0);return _0x3b0326[_0x643e('0x32')](_0x643e('0x33'),_0x30dac8+'-'+_0x59f219+'/'+_0x219dd9)['json'](_0x55783b);}return null;};}function patchUpdates(_0x44260b){return function(_0x3bc5e8){try{jsonpatch['apply'](_0x3bc5e8,_0x44260b,!![]);}catch(_0x592a04){return BPromise[_0x643e('0x34')](_0x592a04);}return _0x3bc5e8[_0x643e('0x35')]();};}function saveUpdates(_0x22be8f,_0x1ad47e){return function(_0x2f4a1d){if(_0x2f4a1d){return _0x2f4a1d[_0x643e('0x36')](_0x22be8f)[_0x643e('0x20')](function(_0x52c291){return _0x52c291;});}return null;};}function removeEntity(_0x48c05c,_0x3e63ab){return function(_0x5ba131){if(_0x5ba131){return _0x5ba131[_0x643e('0x37')]()[_0x643e('0x20')](function(){var _0x3e09d4=_0x5ba131['get']({'plain':!![]});var _0xd49852=_0x643e('0x38');return db['UserProfileResource'][_0x643e('0x37')]({'where':{'type':_0xd49852,'resourceId':_0x3e09d4['id']}})[_0x643e('0x20')](function(){return _0x5ba131;});})['then'](function(){_0x48c05c[_0x643e('0x2b')](0xcc)[_0x643e('0x2c')]();});}};}function handleEntityNotFound(_0x5f2946,_0x35e920){return function(_0x2a5c99){if(!_0x2a5c99){_0x5f2946[_0x643e('0x39')](0x194);}return _0x2a5c99;};}function handleError(_0x47e3e0,_0x3f836f){_0x3f836f=_0x3f836f||0x1f4;return function(_0x437b9b){logger['error'](_0x437b9b[_0x643e('0x3a')]);if(_0x437b9b[_0x643e('0x3b')]){delete _0x437b9b[_0x643e('0x3b')];}_0x47e3e0['status'](_0x3f836f)[_0x643e('0x3c')](_0x437b9b);};}exports['index']=function(_0x578898,_0x35cf35){var _0x101743={'include':[{'model':db['Pause'],'as':_0x643e('0x3d')}]},_0x358581={},_0x353962={'count':0x0,'rows':[]};var _0x1daede=_['map'](db[_0x643e('0x3e')][_0x643e('0x3f')],function(_0x3a4478){return{'name':_0x3a4478[_0x643e('0x40')],'type':_0x3a4478[_0x643e('0x41')][_0x643e('0x42')]};});_0x358581[_0x643e('0x43')]=_[_0x643e('0x44')](_0x1daede,_0x643e('0x3b'));_0x358581[_0x643e('0x45')]=_['keys'](_0x578898[_0x643e('0x45')]);_0x358581[_0x643e('0x46')]=_[_0x643e('0x47')](_0x358581[_0x643e('0x43')],_0x358581['query']);_0x101743[_0x643e('0x48')]=_[_0x643e('0x47')](_0x358581[_0x643e('0x43')],qs[_0x643e('0x49')](_0x578898[_0x643e('0x45')][_0x643e('0x49')]));_0x101743[_0x643e('0x48')]=_0x101743[_0x643e('0x48')]['length']?_0x101743[_0x643e('0x48')]:_0x358581['model'];if(!_0x578898['query']['hasOwnProperty'](_0x643e('0x4a'))){_0x101743[_0x643e('0x31')]=qs[_0x643e('0x31')](_0x578898[_0x643e('0x45')][_0x643e('0x31')]);_0x101743['offset']=qs['offset'](_0x578898['query'][_0x643e('0x2f')]);}_0x101743[_0x643e('0x4b')]=qs['sort'](_0x578898[_0x643e('0x45')][_0x643e('0x4c')]);_0x101743[_0x643e('0x4d')]=qs[_0x643e('0x46')](_[_0x643e('0x4e')](_0x578898['query'],_0x358581[_0x643e('0x46')]),_0x1daede);if(_0x578898[_0x643e('0x45')][_0x643e('0x4f')]){_0x101743[_0x643e('0x4d')]=_[_0x643e('0x50')](_0x101743[_0x643e('0x4d')],{'$or':_[_0x643e('0x44')](_0x1daede,function(_0x236a06){if(_0x236a06[_0x643e('0x41')]!=='VIRTUAL'){var _0x55d9f9={};_0x55d9f9[_0x236a06[_0x643e('0x3b')]]={'$like':'%'+_0x578898[_0x643e('0x45')][_0x643e('0x4f')]+'%'};return _0x55d9f9;}})});}_0x101743=_['merge']({},_0x101743,_0x578898['options']);var _0x1889fb={'where':_0x101743[_0x643e('0x4d')]};return db[_0x643e('0x3e')][_0x643e('0x30')](_0x1889fb)['then'](function(_0x142688){_0x353962['count']=_0x142688;if(_0x578898[_0x643e('0x45')]['includeAll']){_0x101743['include']=[{'all':!![]}];}return db['FaxAccount'][_0x643e('0x51')](_0x101743);})['then'](function(_0x1d3978){_0x353962[_0x643e('0x52')]=_0x1d3978;return _0x353962;})[_0x643e('0x20')](respondWithFilteredResult(_0x35cf35,_0x101743))[_0x643e('0x2a')](handleError(_0x35cf35,null));};exports[_0x643e('0x53')]=function(_0x3bee44,_0x236868){var _0x3960e9={'raw':![],'where':{'id':_0x3bee44[_0x643e('0x54')]['id']},'include':[{'model':db[_0x643e('0x55')],'as':'mandatoryDispositionPause'}]},_0x4a6eaa={};_0x4a6eaa[_0x643e('0x43')]=_[_0x643e('0x56')](db['FaxAccount'][_0x643e('0x3f')]);_0x4a6eaa[_0x643e('0x45')]=_['keys'](_0x3bee44[_0x643e('0x45')]);_0x4a6eaa[_0x643e('0x46')]=_[_0x643e('0x47')](_0x4a6eaa[_0x643e('0x43')],_0x4a6eaa[_0x643e('0x45')]);_0x3960e9[_0x643e('0x48')]=_['intersection'](_0x4a6eaa[_0x643e('0x43')],qs['fields'](_0x3bee44[_0x643e('0x45')]['fields']));_0x3960e9[_0x643e('0x48')]=_0x3960e9[_0x643e('0x48')][_0x643e('0x57')]?_0x3960e9[_0x643e('0x48')]:_0x4a6eaa['model'];if(_0x3bee44[_0x643e('0x45')]['includeAll']){_0x3960e9[_0x643e('0x58')]=[{'all':!![]}];}_0x3960e9=_[_0x643e('0x50')]({},_0x3960e9,_0x3bee44[_0x643e('0x59')]);return db[_0x643e('0x3e')][_0x643e('0x5a')](_0x3960e9)[_0x643e('0x20')](handleEntityNotFound(_0x236868,null))[_0x643e('0x20')](respondWithResult(_0x236868,null))['catch'](handleError(_0x236868,null));};exports[_0x643e('0x5b')]=function(_0x1d1b3c,_0x46e5b5){return db['FaxAccount']['create'](_0x1d1b3c[_0x643e('0x5c')],{})[_0x643e('0x20')](function(_0x2f0102){var _0x28d407=_0x1d1b3c[_0x643e('0x5d')][_0x643e('0x5e')]({'plain':!![]});if(!_0x28d407)throw new Error(_0x643e('0x5f'));if(_0x28d407[_0x643e('0x60')]===_0x643e('0x5d')){var _0x430ae0=_0x2f0102['get']({'plain':!![]});var _0x34fa7d='FaxAccounts';return db['UserProfileSection'][_0x643e('0x5a')]({'where':{'name':_0x34fa7d,'userProfileId':_0x28d407[_0x643e('0x61')]},'raw':!![]})[_0x643e('0x20')](function(_0x3b454e){if(_0x3b454e&&_0x3b454e['autoAssociation']===0x0){return db[_0x643e('0x62')][_0x643e('0x5b')]({'name':_0x430ae0['name'],'resourceId':_0x430ae0['id'],'type':_0x3b454e[_0x643e('0x3b')],'sectionId':_0x3b454e['id']},{})[_0x643e('0x20')](function(){return _0x2f0102;});}else{return _0x2f0102;}})[_0x643e('0x2a')](function(_0x4a7c17){logger[_0x643e('0x26')](_0x643e('0x63'),_0x4a7c17);throw _0x4a7c17;});}return _0x2f0102;})[_0x643e('0x20')](respondWithResult(_0x46e5b5,0xc9))[_0x643e('0x2a')](handleError(_0x46e5b5,null));};exports[_0x643e('0x36')]=function(_0x457d2a,_0x21386a){if(_0x457d2a['body']['id']){delete _0x457d2a[_0x643e('0x5c')]['id'];}return db[_0x643e('0x3e')][_0x643e('0x5a')]({'where':{'id':_0x457d2a[_0x643e('0x54')]['id']},'include':[{'model':db[_0x643e('0x55')],'as':'mandatoryDispositionPause'}]})[_0x643e('0x20')](handleEntityNotFound(_0x21386a,null))[_0x643e('0x20')](saveUpdates(_0x457d2a[_0x643e('0x5c')],null))[_0x643e('0x20')](respondWithResult(_0x21386a,null))[_0x643e('0x2a')](handleError(_0x21386a,null));};exports['destroy']=function(_0x56926b,_0x1d42f6){return db[_0x643e('0x3e')][_0x643e('0x5a')]({'where':{'id':_0x56926b[_0x643e('0x54')]['id']}})[_0x643e('0x20')](handleEntityNotFound(_0x1d42f6,null))[_0x643e('0x20')](removeEntity(_0x1d42f6,null))[_0x643e('0x2a')](handleError(_0x1d42f6,null));};exports[_0x643e('0x64')]=function(_0x3bb462,_0x46d3f3){return db[_0x643e('0x3e')][_0x643e('0x64')]()[_0x643e('0x20')](respondWithResult(_0x46d3f3,null))['catch'](handleError(_0x46d3f3,null));};exports[_0x643e('0x65')]=function(_0x5d07a9,_0x339301,_0x3eeee1){if(_0x5d07a9[_0x643e('0x5c')]['id']){delete _0x5d07a9[_0x643e('0x5c')]['id'];}return db[_0x643e('0x3e')][_0x643e('0x5a')]({'where':{'id':_0x5d07a9[_0x643e('0x54')]['id']}})[_0x643e('0x20')](handleEntityNotFound(_0x339301,null))[_0x643e('0x20')](function(_0x2e4ece){if(_0x2e4ece){_0x5d07a9[_0x643e('0x5c')][_0x643e('0x66')]=_0x2e4ece['id'];return db[_0x643e('0x67')]['create'](_0x5d07a9[_0x643e('0x5c')]);}})['then'](respondWithResult(_0x339301,null))[_0x643e('0x2a')](handleError(_0x339301,null));};exports[_0x643e('0x68')]=function(_0x37313e,_0x5cfade,_0x3b5f92){var _0x242be3={'raw':![],'where':{}};var _0x2524f9={};var _0x3d05fb={'count':0x0,'rows':[]};return db['FaxAccount'][_0x643e('0x69')]({'where':{'id':_0x37313e[_0x643e('0x54')]['id']}})[_0x643e('0x20')](handleEntityNotFound(_0x5cfade,null))[_0x643e('0x20')](function(_0x981201){if(_0x981201){_0x2524f9[_0x643e('0x43')]=_[_0x643e('0x56')](db[_0x643e('0x67')][_0x643e('0x3f')]);_0x2524f9[_0x643e('0x45')]=_[_0x643e('0x56')](_0x37313e[_0x643e('0x45')]);_0x2524f9[_0x643e('0x46')]=_['intersection'](_0x2524f9['model'],_0x2524f9['query']);_0x242be3[_0x643e('0x48')]=_[_0x643e('0x47')](_0x2524f9[_0x643e('0x43')],qs[_0x643e('0x49')](_0x37313e[_0x643e('0x45')]['fields']));_0x242be3['attributes']=_0x242be3[_0x643e('0x48')][_0x643e('0x57')]?_0x242be3['attributes']:_0x2524f9[_0x643e('0x43')];if(!_0x37313e[_0x643e('0x45')][_0x643e('0x6a')]('nolimit')){_0x242be3[_0x643e('0x31')]=qs[_0x643e('0x31')](_0x37313e[_0x643e('0x45')][_0x643e('0x31')]);_0x242be3[_0x643e('0x2f')]=qs['offset'](_0x37313e[_0x643e('0x45')][_0x643e('0x2f')]);}_0x242be3['order']=qs[_0x643e('0x4c')](_0x37313e[_0x643e('0x45')][_0x643e('0x4c')]);_0x242be3[_0x643e('0x4d')]=qs[_0x643e('0x46')](_[_0x643e('0x4e')](_0x37313e[_0x643e('0x45')],_0x2524f9[_0x643e('0x46')]));_0x242be3[_0x643e('0x4d')][_0x643e('0x66')]=_0x981201['id'];if(_0x37313e['query'][_0x643e('0x4f')]){_0x242be3[_0x643e('0x4d')]=_[_0x643e('0x50')](_0x242be3[_0x643e('0x4d')],{'$or':_[_0x643e('0x44')](_0x242be3['attributes'],function(_0x313f93){var _0x503079={};_0x503079[_0x313f93]={'$like':'%'+_0x37313e[_0x643e('0x45')]['filter']+'%'};return _0x503079;})});}_0x242be3=_[_0x643e('0x50')]({},_0x242be3,_0x37313e[_0x643e('0x59')]);return db[_0x643e('0x67')][_0x643e('0x30')]({'where':_0x242be3[_0x643e('0x4d')]})[_0x643e('0x20')](function(_0x1a9096){_0x3d05fb[_0x643e('0x30')]=_0x1a9096;if(_0x37313e[_0x643e('0x45')][_0x643e('0x6b')]){_0x242be3[_0x643e('0x58')]=[{'all':!![]}];}return db[_0x643e('0x67')]['findAll'](_0x242be3);})['then'](function(_0x1a1e3c){_0x3d05fb[_0x643e('0x52')]=_0x1a1e3c;return _0x3d05fb;});}})[_0x643e('0x20')](respondWithFilteredResult(_0x5cfade,_0x242be3))[_0x643e('0x2a')](handleError(_0x5cfade,null));};exports[_0x643e('0x6c')]=function(_0x2ec7f6,_0x24749f,_0x4a8de5){return db[_0x643e('0x3e')][_0x643e('0x5a')]({'where':{'id':_0x2ec7f6['params']['id']}})[_0x643e('0x20')](handleEntityNotFound(_0x24749f,null))['then'](function(_0x5e619){if(_0x5e619){return _0x5e619['removeDispositions'](_0x2ec7f6[_0x643e('0x45')][_0x643e('0x6d')]);}})[_0x643e('0x20')](respondWithStatusCode(_0x24749f,null))[_0x643e('0x2a')](handleError(_0x24749f,null));};exports['addAnswer']=function(_0x56cf96,_0x5a2cec,_0x4ffe02){if(_0x56cf96[_0x643e('0x5c')]['id']){delete _0x56cf96['body']['id'];}return db[_0x643e('0x3e')][_0x643e('0x5a')]({'where':{'id':_0x56cf96[_0x643e('0x54')]['id']}})[_0x643e('0x20')](handleEntityNotFound(_0x5a2cec,null))[_0x643e('0x20')](function(_0x5671b5){if(_0x5671b5){_0x56cf96[_0x643e('0x5c')][_0x643e('0x66')]=_0x5671b5['id'];return db[_0x643e('0x6e')][_0x643e('0x5b')](_0x56cf96['body']);}})[_0x643e('0x20')](respondWithResult(_0x5a2cec,null))[_0x643e('0x2a')](handleError(_0x5a2cec,null));};exports['getAnswers']=function(_0x241d77,_0x4f05ec,_0x425242){var _0x32db6c={'raw':![],'where':{}};var _0xdd0335={};var _0x1fc5f8={'count':0x0,'rows':[]};return db[_0x643e('0x3e')][_0x643e('0x69')]({'where':{'id':_0x241d77[_0x643e('0x54')]['id']}})[_0x643e('0x20')](handleEntityNotFound(_0x4f05ec,null))['then'](function(_0x35ba04){if(_0x35ba04){_0xdd0335['model']=_[_0x643e('0x56')](db[_0x643e('0x6e')][_0x643e('0x3f')]);_0xdd0335[_0x643e('0x45')]=_[_0x643e('0x56')](_0x241d77[_0x643e('0x45')]);_0xdd0335['filters']=_['intersection'](_0xdd0335['model'],_0xdd0335[_0x643e('0x45')]);_0x32db6c[_0x643e('0x48')]=_[_0x643e('0x47')](_0xdd0335[_0x643e('0x43')],qs[_0x643e('0x49')](_0x241d77[_0x643e('0x45')][_0x643e('0x49')]));_0x32db6c['attributes']=_0x32db6c['attributes'][_0x643e('0x57')]?_0x32db6c[_0x643e('0x48')]:_0xdd0335['model'];if(!_0x241d77[_0x643e('0x45')]['hasOwnProperty']('nolimit')){_0x32db6c[_0x643e('0x31')]=qs[_0x643e('0x31')](_0x241d77['query'][_0x643e('0x31')]);_0x32db6c[_0x643e('0x2f')]=qs[_0x643e('0x2f')](_0x241d77['query'][_0x643e('0x2f')]);}_0x32db6c[_0x643e('0x4b')]=qs[_0x643e('0x4c')](_0x241d77['query'][_0x643e('0x4c')]);_0x32db6c[_0x643e('0x4d')]=qs[_0x643e('0x46')](_[_0x643e('0x4e')](_0x241d77[_0x643e('0x45')],_0xdd0335[_0x643e('0x46')]));_0x32db6c['where'][_0x643e('0x66')]=_0x35ba04['id'];if(_0x241d77[_0x643e('0x45')][_0x643e('0x4f')]){_0x32db6c[_0x643e('0x4d')]=_[_0x643e('0x50')](_0x32db6c[_0x643e('0x4d')],{'$or':_['map'](_0x32db6c[_0x643e('0x48')],function(_0x365399){var _0x13d321={};_0x13d321[_0x365399]={'$like':'%'+_0x241d77[_0x643e('0x45')]['filter']+'%'};return _0x13d321;})});}_0x32db6c=_['merge']({},_0x32db6c,_0x241d77[_0x643e('0x59')]);return db[_0x643e('0x6e')][_0x643e('0x30')]({'where':_0x32db6c[_0x643e('0x4d')]})[_0x643e('0x20')](function(_0x399aac){_0x1fc5f8[_0x643e('0x30')]=_0x399aac;if(_0x241d77['query'][_0x643e('0x6b')]){_0x32db6c['include']=[{'all':!![]}];}return db['CannedAnswer'][_0x643e('0x51')](_0x32db6c);})[_0x643e('0x20')](function(_0x1c7017){_0x1fc5f8[_0x643e('0x52')]=_0x1c7017;return _0x1fc5f8;});}})[_0x643e('0x20')](respondWithFilteredResult(_0x4f05ec,_0x32db6c))[_0x643e('0x2a')](handleError(_0x4f05ec,null));};exports[_0x643e('0x6f')]=function(_0x5a785a,_0x15c742,_0x263c64){return db[_0x643e('0x3e')]['find']({'where':{'id':_0x5a785a[_0x643e('0x54')]['id']}})[_0x643e('0x20')](handleEntityNotFound(_0x15c742,null))['then'](function(_0xb717f3){if(_0xb717f3){return _0xb717f3[_0x643e('0x6f')](_0x5a785a[_0x643e('0x45')][_0x643e('0x6d')]);}})['then'](respondWithStatusCode(_0x15c742,null))[_0x643e('0x2a')](handleError(_0x15c742,null));};exports[_0x643e('0x70')]=function(_0x1cd7d3,_0x23f7c3,_0x35b877){return db['FaxInteraction'][_0x643e('0x5a')]({'where':{'id':_0x1cd7d3['params']['id']}})[_0x643e('0x20')](handleEntityNotFound(_0x23f7c3,null))['then'](function(_0x1ee96b){if(_0x1ee96b){return _0x1ee96b[_0x643e('0x70')](_0x1cd7d3[_0x643e('0x5c')][_0x643e('0x6d')],_[_0x643e('0x71')](_0x1cd7d3[_0x643e('0x5c')],[_0x643e('0x6d'),'id'])||{});}})[_0x643e('0x20')](respondWithResult(_0x23f7c3,null))[_0x643e('0x2a')](handleError(_0x23f7c3,null));};exports[_0x643e('0x72')]=function(_0x156d45,_0x6dd980,_0x462bca){var _0x3cf6e2={'raw':![],'where':{}};var _0x307db5={};var _0x1fc4ec={'count':0x0,'rows':[]};return db[_0x643e('0x3e')][_0x643e('0x69')]({'where':{'id':_0x156d45[_0x643e('0x54')]['id']}})['then'](handleEntityNotFound(_0x6dd980,null))[_0x643e('0x20')](function(_0x1aa879){if(_0x1aa879){_0x307db5[_0x643e('0x43')]=_['keys'](db[_0x643e('0x73')][_0x643e('0x3f')]);_0x307db5[_0x643e('0x45')]=_['keys'](_0x156d45[_0x643e('0x45')]);_0x307db5[_0x643e('0x46')]=_['intersection'](_0x307db5['model'],_0x307db5[_0x643e('0x45')]);_0x3cf6e2[_0x643e('0x48')]=_[_0x643e('0x47')](_0x307db5['model'],qs[_0x643e('0x49')](_0x156d45[_0x643e('0x45')][_0x643e('0x49')]));_0x3cf6e2['attributes']=_0x3cf6e2[_0x643e('0x48')][_0x643e('0x57')]?_0x3cf6e2[_0x643e('0x48')]:_0x307db5[_0x643e('0x43')];if(!_0x156d45[_0x643e('0x45')]['hasOwnProperty'](_0x643e('0x4a'))){_0x3cf6e2[_0x643e('0x31')]=qs['limit'](_0x156d45[_0x643e('0x45')][_0x643e('0x31')]);_0x3cf6e2[_0x643e('0x2f')]=qs['offset'](_0x156d45[_0x643e('0x45')][_0x643e('0x2f')]);}_0x3cf6e2[_0x643e('0x4b')]=qs['sort'](_0x156d45[_0x643e('0x45')][_0x643e('0x4c')]);_0x3cf6e2['where']=qs[_0x643e('0x46')](_[_0x643e('0x4e')](_0x156d45['query'],_0x307db5[_0x643e('0x46')]));_0x3cf6e2[_0x643e('0x4d')][_0x643e('0x66')]=_0x1aa879['id'];if(_0x156d45[_0x643e('0x45')][_0x643e('0x4f')]){_0x3cf6e2[_0x643e('0x4d')]=_[_0x643e('0x50')](_0x3cf6e2[_0x643e('0x4d')],{'$or':_[_0x643e('0x44')](_0x3cf6e2[_0x643e('0x48')],function(_0x5ae4a0){var _0x33ee36={};_0x33ee36[_0x5ae4a0]={'$like':'%'+_0x156d45[_0x643e('0x45')][_0x643e('0x4f')]+'%'};return _0x33ee36;})});}_0x3cf6e2=_['merge']({},_0x3cf6e2,_0x156d45[_0x643e('0x59')]);return db['FaxInteraction'][_0x643e('0x30')]({'where':_0x3cf6e2[_0x643e('0x4d')]})[_0x643e('0x20')](function(_0x26bd0a){_0x1fc4ec[_0x643e('0x30')]=_0x26bd0a;if(_0x156d45[_0x643e('0x45')][_0x643e('0x6b')]){_0x3cf6e2[_0x643e('0x58')]=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0x643e('0x74')],'as':_0x643e('0x75'),'attributes':['name','fullname',_0x643e('0x76')],'required':![]},{'model':db['Tag'],'as':_0x643e('0x77'),'attributes':['id',_0x643e('0x3b'),_0x643e('0x78')],'where':_0x156d45[_0x643e('0x45')][_0x643e('0x79')]?{'id':_0x156d45[_0x643e('0x45')][_0x643e('0x79')]}:undefined,'required':_0x156d45[_0x643e('0x45')][_0x643e('0x79')]?!![]:![]}];}return db['FaxInteraction']['findAll'](_0x3cf6e2);})['then'](function(_0x31f1f7){_0x1fc4ec['rows']=_0x31f1f7;return _0x1fc4ec;});}})[_0x643e('0x20')](respondWithFilteredResult(_0x6dd980,_0x3cf6e2))[_0x643e('0x2a')](handleError(_0x6dd980,null));};exports[_0x643e('0x7a')]=function(_0x12f508,_0x16fb99){var _0x55fc04=_0x12f508['params']['id'];var _0x5b8763=_0x12f508[_0x643e('0x5c')];var _0x45e0f9=0xc8;var _0x1c917d=null;return db[_0x643e('0x7b')]['transaction']({'isolationLevel':db[_0x643e('0x7b')][_0x643e('0x7c')]['ISOLATION_LEVELS'][_0x643e('0x7d')]},function(_0x6a25e){return db['FaxAccount'][_0x643e('0x69')]({'where':{'id':_0x55fc04},'transaction':_0x6a25e})[_0x643e('0x20')](function(_0xdd48f3){if(_0xdd48f3){return db[_0x643e('0x7e')][_0x643e('0x37')]({'where':{'FaxAccountId':_0x55fc04},'transaction':_0x6a25e})[_0x643e('0x20')](function(){var _0x329778=_[_0x643e('0x44')](_0x5b8763,function(_0x5ed74f){_0x5ed74f[_0x643e('0x66')]=_0x55fc04;return _0x5ed74f;});return db[_0x643e('0x7e')]['bulkCreate'](_0x329778,{'transaction':_0x6a25e});});}else{_0x45e0f9=0x194;_0x1c917d=[];}});})[_0x643e('0x20')](function(){if(_0x45e0f9!==0x194){return db[_0x643e('0x7e')][_0x643e('0x7f')]({'where':{'FaxAccountId':_0x55fc04},'order':'priority'})[_0x643e('0x20')](function(_0x102f02){_0x1c917d=_0x102f02;});}})['catch'](function(_0x23a3f2){_0x45e0f9=0x1f4;logger[_0x643e('0x26')](_0x23a3f2[_0x643e('0x3a')]);if(_0x23a3f2['name']){delete _0x23a3f2['name'];}_0x1c917d=_0x23a3f2;})[_0x643e('0x80')](function(){if(_0x1c917d===null){_0x16fb99['sendStatus'](_0x45e0f9);}else{if(_0x45e0f9===0x1f4){_0x16fb99[_0x643e('0x2b')](_0x45e0f9)['send'](_0x1c917d);}else{_0x16fb99[_0x643e('0x2b')](_0x45e0f9)[_0x643e('0x2d')](_0x1c917d);}}});};exports[_0x643e('0x81')]=function(_0x5d477e,_0x411de2,_0x4d38a2){var _0x4a104a={};var _0x209135={};var _0x3a8919;var _0x3dd661;return db[_0x643e('0x3e')][_0x643e('0x69')]({'where':{'id':_0x5d477e[_0x643e('0x54')]['id']}})[_0x643e('0x20')](handleEntityNotFound(_0x411de2,null))[_0x643e('0x20')](function(_0x27b70a){if(_0x27b70a){_0x3a8919=_0x27b70a;_0x209135[_0x643e('0x43')]=_[_0x643e('0x56')](db[_0x643e('0x7e')]['rawAttributes']);_0x209135[_0x643e('0x45')]=_[_0x643e('0x56')](_0x5d477e[_0x643e('0x45')]);_0x209135[_0x643e('0x46')]=_[_0x643e('0x47')](_0x209135[_0x643e('0x43')],_0x209135[_0x643e('0x45')]);_0x4a104a['attributes']=_[_0x643e('0x47')](_0x209135[_0x643e('0x43')],qs[_0x643e('0x49')](_0x5d477e['query'][_0x643e('0x49')]));_0x4a104a[_0x643e('0x48')]=_0x4a104a['attributes'][_0x643e('0x57')]?_0x4a104a[_0x643e('0x48')]:_0x209135[_0x643e('0x43')];_0x4a104a[_0x643e('0x4b')]=qs[_0x643e('0x4c')](_0x5d477e[_0x643e('0x45')][_0x643e('0x4c')]);_0x4a104a[_0x643e('0x4d')]=qs[_0x643e('0x46')](_['pick'](_0x5d477e[_0x643e('0x45')],_0x209135[_0x643e('0x46')]));if(_0x5d477e[_0x643e('0x45')][_0x643e('0x4f')]){_0x4a104a[_0x643e('0x4d')]=_['merge'](_0x4a104a[_0x643e('0x4d')],{'$or':_[_0x643e('0x44')](_0x4a104a[_0x643e('0x48')],function(_0x2777da){var _0x326361={};_0x326361[_0x2777da]={'$like':'%'+_0x5d477e['query']['filter']+'%'};return _0x326361;})});}_0x4a104a=_['merge']({},_0x4a104a,_0x5d477e[_0x643e('0x59')]);return _0x3a8919[_0x643e('0x81')](_0x4a104a);}})['then'](function(_0x53211e){if(_0x53211e){_0x3dd661=_0x53211e[_0x643e('0x57')];if(!_0x5d477e[_0x643e('0x45')]['hasOwnProperty'](_0x643e('0x4a'))){_0x4a104a[_0x643e('0x31')]=qs['limit'](_0x5d477e[_0x643e('0x45')][_0x643e('0x31')]);_0x4a104a[_0x643e('0x2f')]=qs[_0x643e('0x2f')](_0x5d477e[_0x643e('0x45')][_0x643e('0x2f')]);}return _0x3a8919[_0x643e('0x81')](_0x4a104a);}})[_0x643e('0x20')](function(_0x1be3f2){if(_0x1be3f2){return _0x1be3f2?{'count':_0x3dd661,'rows':_0x1be3f2}:null;}})[_0x643e('0x20')](respondWithResult(_0x411de2,null))['catch'](handleError(_0x411de2,null));};function Extension(_0xc06932,_0x41b9d9,_0x48dc63,_0x146606){this[_0x643e('0x82')]='from-voip-provider';this[_0x643e('0x83')]=_0xc06932[_0x643e('0x84')];this[_0x643e('0x85')]=_0x146606;this[_0x643e('0x41')]=_0x643e('0x86');this['description']=_0x643e('0x87');this['FaxAccountId']=_0xc06932['id'];this[_0x643e('0x88')]=_0x41b9d9;this[_0x643e('0x89')]=_0x48dc63;}function createExtensionsReciveFax(_0x209f40){var _0x45343f=0x1;var _0xc83034=[];_0xc83034['push'](new Extension(_0x209f40,_0x45343f,'','Answer'));_0x45343f+=0x1;_0xc83034['push'](new Extension(_0x209f40,_0x45343f,_0x643e('0x8a'),_0x643e('0x8b')));_0x45343f+=0x1;for(var _0x3ccca6 in _0x209f40){if(_0x209f40[_0x643e('0x6a')](_0x3ccca6)&&(_0x3ccca6==='ecm'||_0x3ccca6===_0x643e('0x84')||_0x3ccca6===_0x643e('0x8c')||_0x3ccca6==='faxdetect'||_0x3ccca6===_0x643e('0x8d')||_0x3ccca6===_0x643e('0x8e')||_0x3ccca6===_0x643e('0x8f')||_0x3ccca6==='modem'||_0x3ccca6===_0x643e('0x90'))){_0xc83034['push'](new Extension(_0x209f40,_0x45343f,_0x643e('0x91')+_0x3ccca6+')='+_0x209f40[_0x3ccca6],_0x643e('0x8b')));_0x45343f+=0x1;}}_0xc83034[_0x643e('0x92')](new Extension(_0x209f40,_0x45343f,'6',_0x643e('0x93')));_0x45343f+=0x1;_0xc83034[_0x643e('0x92')](new Extension(_0x209f40,_0x45343f,_0x643e('0x94'),'ReceiveFax'));_0x45343f=0x0;return _0xc83034;}exports[_0x643e('0x95')]=function(_0x543d20,_0x3eef36,_0x7224c3){var _0x4a5b12;return db[_0x643e('0x7b')][_0x643e('0x96')](function(_0x261a7d){return db[_0x643e('0x3e')][_0x643e('0x5b')](_0x543d20[_0x643e('0x5c')],{'transaction':_0x261a7d})[_0x643e('0x20')](function(_0x41f9b6){_0x4a5b12=_0x41f9b6['get']({'plain':!![]});return db[_0x643e('0x97')][_0x643e('0x98')](createExtensionsReciveFax(_0x4a5b12),{'transaction':_0x261a7d});});})[_0x643e('0x20')](function(){return _0x4a5b12;})[_0x643e('0x20')](respondWithResult(_0x3eef36,null))['catch'](handleError(_0x3eef36,null));};exports[_0x643e('0x99')]=function(_0x58077c,_0xf36406,_0x3db451){var _0x74b048;return db[_0x643e('0x7b')][_0x643e('0x96')](function(_0x4ab6d5){return db['FaxAccount']['update'](_0x58077c[_0x643e('0x5c')],{'where':{'id':_0x58077c['body']['id']},'transaction':_0x4ab6d5})['then'](function(_0x55b7c9){return db[_0x643e('0x97')]['destroy']({'where':{'FaxAccountId':_0x58077c[_0x643e('0x5c')]['id']},'transaction':_0x4ab6d5})[_0x643e('0x20')](function(_0x4571cf){return db[_0x643e('0x97')][_0x643e('0x98')](createExtensionsReciveFax(_[_0x643e('0x71')](_0x58077c[_0x643e('0x5c')],['tech',_0x643e('0x42'),_0x643e('0x9a'),_0x643e('0x9b'),_0x643e('0x9c'),'ListId'])),{'transaction':_0x4ab6d5});});});})[_0x643e('0x20')](function(){return db[_0x643e('0x3e')][_0x643e('0x9d')](_0x58077c['body']['id']);})['then'](respondWithResult(_0xf36406,null))[_0x643e('0x2a')](handleError(_0xf36406,null));};exports[_0x643e('0x9e')]=function(_0x4a7b9d,_0xa1ae6c,_0x468aaa){var _0x4c5e97={'raw':!![],'where':{}};var _0x48dc03={};var _0x34a3e9={'count':0x0,'rows':[]};return db[_0x643e('0x3e')][_0x643e('0x69')]({'where':{'id':_0x4a7b9d[_0x643e('0x54')]['id']}})[_0x643e('0x20')](handleEntityNotFound(_0xa1ae6c,null))[_0x643e('0x20')](function(_0xbf53e8){if(_0xbf53e8){_0x48dc03[_0x643e('0x43')]=_[_0x643e('0x56')](db[_0x643e('0x9f')][_0x643e('0x3f')]);_0x48dc03[_0x643e('0x45')]=_['keys'](_0x4a7b9d[_0x643e('0x45')]);_0x48dc03[_0x643e('0x46')]=_['intersection'](_0x48dc03['model'],_0x48dc03[_0x643e('0x45')]);_0x4c5e97[_0x643e('0x48')]=_[_0x643e('0x47')](_0x48dc03[_0x643e('0x43')],qs[_0x643e('0x49')](_0x4a7b9d['query'][_0x643e('0x49')]));_0x4c5e97['attributes']=_0x4c5e97['attributes']['length']?_0x4c5e97[_0x643e('0x48')]:_0x48dc03[_0x643e('0x43')];if(!_0x4a7b9d[_0x643e('0x45')]['hasOwnProperty']('nolimit')){_0x4c5e97[_0x643e('0x31')]=qs[_0x643e('0x31')](_0x4a7b9d[_0x643e('0x45')]['limit']);_0x4c5e97[_0x643e('0x2f')]=qs['offset'](_0x4a7b9d[_0x643e('0x45')][_0x643e('0x2f')]);}_0x4c5e97['order']=qs[_0x643e('0x4c')](_0x4a7b9d[_0x643e('0x45')][_0x643e('0x4c')]);_0x4c5e97[_0x643e('0x4d')]=qs[_0x643e('0x46')](_['pick'](_0x4a7b9d['query'],_0x48dc03[_0x643e('0x46')]));_0x4c5e97[_0x643e('0x4d')][_0x643e('0x66')]=_0xbf53e8['id'];if(_0x4a7b9d[_0x643e('0x45')][_0x643e('0x4f')]){_0x4c5e97[_0x643e('0x4d')]=_[_0x643e('0x50')](_0x4c5e97[_0x643e('0x4d')],{'$or':_[_0x643e('0x44')](_0x4c5e97[_0x643e('0x48')],function(_0x36ce8b){var _0x50ed88={};_0x50ed88[_0x36ce8b]={'$like':'%'+_0x4a7b9d[_0x643e('0x45')][_0x643e('0x4f')]+'%'};return _0x50ed88;})});}if(_0x4a7b9d[_0x643e('0x45')]['$gte']){var _0x426992=_0x4a7b9d['query'][_0x643e('0xa0')][_0x643e('0xa1')](',');var _0x5ec240={};_0x5ec240[_0x426992[0x0]]={'$gte':moment(_0x426992[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x4c5e97[_0x643e('0x4d')]=_['merge'](_0x4c5e97[_0x643e('0x4d')],_0x5ec240);}_0x4c5e97=_[_0x643e('0x50')]({},_0x4c5e97,_0x4a7b9d[_0x643e('0x59')]);return db[_0x643e('0x9f')]['count']({'where':_0x4c5e97[_0x643e('0x4d')]})[_0x643e('0x20')](function(_0x368e1d){_0x34a3e9['count']=_0x368e1d;if(_0x4a7b9d[_0x643e('0x45')][_0x643e('0x6b')]){_0x4c5e97[_0x643e('0x58')]=[{'all':!![]}];}return db[_0x643e('0x9f')]['findAll'](_0x4c5e97);})[_0x643e('0x20')](function(_0x4f04f3){_0x34a3e9[_0x643e('0x52')]=_0x4f04f3;return _0x34a3e9;});}})['then'](respondWithFilteredResult(_0xa1ae6c,_0x4c5e97))['catch'](handleError(_0xa1ae6c,null));};exports[_0x643e('0x3c')]=function(_0xb4c43e,_0x1f1d1c,_0x435879){var _0x360fce,_0x2cea70={},_0x2cdb73;if(_0xb4c43e[_0x643e('0x5c')]['to']){_0x2cdb73=_0xb4c43e['body']['to'][0x0];}return db['FaxAccount'][_0x643e('0x5a')]({'where':{'id':_0xb4c43e['params']['id']},'include':[{'model':db[_0x643e('0xa2')],'as':_0x643e('0xa3'),'include':[{'model':db['CmContact'],'as':'Contacts','where':{'fax':_0x2cdb73},'limit':0x1,'order':[[_0x643e('0x9b'),_0x643e('0xa4')]]}]}]})[_0x643e('0x20')](handleEntityNotFound(_0x1f1d1c,null))[_0x643e('0x20')](function(_0x316f19){_0x360fce=_0x316f19;if(_0xb4c43e[_0x643e('0x5c')][_0x643e('0xa5')]&&_0xb4c43e[_0x643e('0x5c')][_0x643e('0xa5')][_0x643e('0x57')]){for(var _0x4acb67=0x0;_0x4acb67<_0xb4c43e[_0x643e('0x5c')][_0x643e('0xa5')][_0x643e('0x57')];_0x4acb67+=0x1){_0xb4c43e[_0x643e('0x5c')][_0x643e('0xa5')][_0x4acb67]={'filename':_0xb4c43e[_0x643e('0x5c')][_0x643e('0xa5')][_0x4acb67][_0x643e('0x3b')],'id':_0xb4c43e[_0x643e('0x5c')]['attachments'][_0x4acb67]['id'],'path':path[_0x643e('0xa6')](config[_0x643e('0xa7')],_0x643e('0xa8'),_0xb4c43e[_0x643e('0x5c')][_0x643e('0xa5')][_0x4acb67][_0x643e('0xa9')])};}}return respondWithRpcPromise(_0x643e('0xaa'),_0x643e('0xaa'),{'FaxAccountId':_['isNil'](_0xb4c43e[_0x643e('0x54')]['id'])?undefined:_0xb4c43e['params']['id'],'path':_[_0x643e('0xab')](_0xb4c43e['body']['attachments'][0x0][_0x643e('0x9')])?undefined:_0xb4c43e[_0x643e('0x5c')][_0x643e('0xa5')][0x0]['path'],'fax':_[_0x643e('0xab')](_0xb4c43e[_0x643e('0x5c')]['to'][0x0])?undefined:_0xb4c43e[_0x643e('0x5c')]['to'][0x0]},client9002);})[_0x643e('0x20')](function(){if(_0x360fce){if(_[_0x643e('0xab')](_0xb4c43e[_0x643e('0x5c')][_0x643e('0xac')])){_0xb4c43e['body'][_0x643e('0xac')]=util['format'](_0x643e('0xad'),_0x360fce[_0x643e('0x3b')],_0x360fce[_0x643e('0xae')]);}if(_0x360fce[_0x643e('0xa3')]){if(_0x360fce[_0x643e('0xa3')][_0x643e('0xaf')]['length']){return _0x360fce[_0x643e('0xa3')]['Contacts'][0x0];}else{return db[_0x643e('0xb0')][_0x643e('0x5b')](_[_0x643e('0xb1')](_0xb4c43e[_0x643e('0x5c')],{'firstName':_0xb4c43e[_0x643e('0x5c')]['to'][0x0],'phone':_0xb4c43e[_0x643e('0x5c')]['to'][0x0],'fax':_0xb4c43e['body']['to'][0x0],'ListId':_0x360fce['ListId']}));}}else{throw new Error(_0x643e('0xb2'));}}else{throw new Error(_0x643e('0xb3'));}})['then'](function(_0x631a63){if(_0x631a63){return db['FaxInteraction'][_0x643e('0x5a')]({'where':{'ContactId':_0x631a63['id'],'closed':![],'FaxAccountId':_0x360fce['id']}})[_0x643e('0x20')](function(_0x5a07bb){if(_0x5a07bb){return[_0x5a07bb,![]];}return db[_0x643e('0x73')]['create']({'UserId':_0xb4c43e['user']['id'],'ContactId':_0x631a63['id'],'FaxAccountId':_0x360fce['id'],'fax':_0xb4c43e['body']['to'][0x0],'firstMsgDirection':'out','Messages':[_[_0x643e('0x50')](_0xb4c43e['body'],{'read':![],'body':_0xb4c43e['body'][_0x643e('0xa5')][0x0][_0x643e('0xb4')],'FaxAccountId':_0x360fce['id'],'UserId':_0xb4c43e['user']['id'],'ContactId':_0x631a63['id'],'AttachmentId':_0xb4c43e[_0x643e('0x5c')][_0x643e('0xa5')][0x0]['id']})]},{'include':[{'model':db[_0x643e('0x9f')],'as':_0x643e('0xb5')}]})[_0x643e('0x20')](function(_0x5f9746){return[_0x5f9746,!![]];});});}else{throw new Error(_0x643e('0xb6'));}})[_0x643e('0xb7')](function(_0x4e2ea6,_0x38d6fc){if(_0x38d6fc){return _0x4e2ea6;}return db[_0x643e('0x9f')]['create']({'direction':_0x643e('0xb8'),'read':![],'body':_0xb4c43e[_0x643e('0x5c')][_0x643e('0xa5')][0x0]['filename'],'FaxAccountId':_0x360fce['id'],'FaxInteractionId':_0x4e2ea6['id'],'UserId':_0xb4c43e[_0x643e('0x5d')]['id'],'ContactId':_0x4e2ea6['ContactId'],'AttachmentId':_0xb4c43e['body'][_0x643e('0xa5')][0x0]['id']})[_0x643e('0x20')](function(_0x4f878f){_0x4e2ea6[_0x643e('0xb9')][_0x643e('0xb5')]=[];_0x4e2ea6[_0x643e('0xb9')][_0x643e('0xb5')][_0x643e('0x92')](_0x4f878f[_0x643e('0xb9')]);return _0x4e2ea6;});})[_0x643e('0x20')](function(_0x54332d){respondWithRpcPromise(_0x643e('0xba'),_0x643e('0xba'),{'FaxAccountId':_[_0x643e('0xab')](_0xb4c43e[_0x643e('0x54')]['id'])?undefined:_0xb4c43e[_0x643e('0x54')]['id'],'path':_[_0x643e('0xab')](_0xb4c43e['body'][_0x643e('0xa5')][0x0][_0x643e('0x9')])?undefined:_0xb4c43e['body'][_0x643e('0xa5')][0x0][_0x643e('0x9')],'fax':_['isNil'](_0xb4c43e[_0x643e('0x5c')]['to'][0x0])?undefined:_0xb4c43e['body']['to'][0x0],'AttachmentId':_0xb4c43e[_0x643e('0x5c')]['attachments'][0x0]['id']},client9002)[_0x643e('0x20')](function(_0x250966){logger['info'](_0x643e('0xbb'),_0x250966);})[_0x643e('0x2a')](function(_0x54418e){logger[_0x643e('0x28')](_0x643e('0xbb'),_0x54418e);});return _0x54332d;})[_0x643e('0x20')](respondWithResult(_0x1f1d1c,null))[_0x643e('0x2a')](handleError(_0x1f1d1c,null));};exports['addAgents']=function(_0x4c0316,_0x591bd4,_0x2f1875){return db[_0x643e('0x3e')]['find']({'where':{'id':_0x4c0316['params']['id']}})[_0x643e('0x20')](handleEntityNotFound(_0x591bd4,null))[_0x643e('0x20')](function(_0x2d5975){if(_0x2d5975){return _0x2d5975[_0x643e('0xbc')](_0x4c0316['body'][_0x643e('0x6d')],_['omit'](_0x4c0316[_0x643e('0x5c')],[_0x643e('0x6d'),'id'])||{})['spread'](function(_0x5fd04a){for(var _0x3f87ef=0x0;_0x3f87ef<_0x4c0316[_0x643e('0x5c')]['ids'][_0x643e('0x57')];_0x3f87ef+=0x1){socket[_0x643e('0xbd')]('userFaxAccount:save',{'UserId':Number(_0x4c0316[_0x643e('0x5c')][_0x643e('0x6d')][_0x3f87ef]),'FaxAccountId':Number(_0x4c0316[_0x643e('0x54')]['id'])});}return _0x5fd04a;});}})[_0x643e('0x20')](respondWithResult(_0x591bd4,null))['catch'](handleError(_0x591bd4,null));};exports[_0x643e('0xbe')]=function(_0x25ad01,_0x383f54,_0x1d2211){return db['FaxAccount'][_0x643e('0x5a')]({'where':{'id':_0x25ad01[_0x643e('0x54')]['id']}})['then'](handleEntityNotFound(_0x383f54,null))[_0x643e('0x20')](function(_0x268686){if(_0x268686){return _0x268686['removeAgents'](_0x25ad01[_0x643e('0x45')]['ids'])[_0x643e('0x20')](function(){if(_[_0x643e('0xbf')](_0x25ad01[_0x643e('0x45')][_0x643e('0x6d')])){for(var _0x57a879=0x0;_0x57a879<_0x25ad01[_0x643e('0x45')][_0x643e('0x6d')]['length'];_0x57a879+=0x1){socket['emit'](_0x643e('0xc0'),{'UserId':Number(_0x25ad01[_0x643e('0x45')]['ids'][_0x57a879]),'FaxAccountId':Number(_0x25ad01[_0x643e('0x54')]['id'])});}}else{socket['emit']('userFaxAccount:remove',{'UserId':Number(_0x25ad01[_0x643e('0x45')]['ids']),'FaxAccountId':Number(_0x25ad01['params']['id'])});}});}})[_0x643e('0x20')](respondWithStatusCode(_0x383f54,null))['catch'](handleError(_0x383f54,null));};exports[_0x643e('0xc1')]=function(_0x2127c5,_0x2b64d5,_0x227a12){var _0x120a17={};var _0xecc5ff={};var _0xc6fb11;var _0x16b82f;return db[_0x643e('0x3e')][_0x643e('0x69')]({'where':{'id':_0x2127c5[_0x643e('0x54')]['id']}})[_0x643e('0x20')](handleEntityNotFound(_0x2b64d5,null))['then'](function(_0x267843){if(_0x267843){_0xc6fb11=_0x267843;_0xecc5ff[_0x643e('0x43')]=_[_0x643e('0x56')](db[_0x643e('0x74')][_0x643e('0x3f')]);_0xecc5ff['query']=_[_0x643e('0x56')](_0x2127c5[_0x643e('0x45')]);_0xecc5ff[_0x643e('0x46')]=_[_0x643e('0x47')](_0xecc5ff[_0x643e('0x43')],_0xecc5ff[_0x643e('0x45')]);_0x120a17['attributes']=_[_0x643e('0x47')](_0xecc5ff[_0x643e('0x43')],qs[_0x643e('0x49')](_0x2127c5[_0x643e('0x45')][_0x643e('0x49')]));_0x120a17[_0x643e('0x48')]=_0x120a17[_0x643e('0x48')][_0x643e('0x57')]?_0x120a17['attributes']:_0xecc5ff[_0x643e('0x43')];_0x120a17['order']=qs[_0x643e('0x4c')](_0x2127c5[_0x643e('0x45')][_0x643e('0x4c')]);_0x120a17[_0x643e('0x4d')]=qs[_0x643e('0x46')](_[_0x643e('0x4e')](_0x2127c5[_0x643e('0x45')],_0xecc5ff[_0x643e('0x46')]));if(_0x2127c5[_0x643e('0x45')][_0x643e('0x4f')]){_0x120a17[_0x643e('0x4d')]=_[_0x643e('0x50')](_0x120a17[_0x643e('0x4d')],{'$or':_['map'](_0x120a17[_0x643e('0x48')],function(_0x5561f2){var _0x2afd53={};_0x2afd53[_0x5561f2]={'$like':'%'+_0x2127c5[_0x643e('0x45')][_0x643e('0x4f')]+'%'};return _0x2afd53;})});}_0x120a17=_['merge']({},_0x120a17,_0x2127c5[_0x643e('0x59')]);return _0xc6fb11[_0x643e('0xc1')](_0x120a17);}})['then'](function(_0x44a847){if(_0x44a847){_0x16b82f=_0x44a847[_0x643e('0x57')];if(!_0x2127c5[_0x643e('0x45')][_0x643e('0x6a')](_0x643e('0x4a'))){_0x120a17[_0x643e('0x31')]=qs[_0x643e('0x31')](_0x2127c5[_0x643e('0x45')][_0x643e('0x31')]);_0x120a17[_0x643e('0x2f')]=qs[_0x643e('0x2f')](_0x2127c5[_0x643e('0x45')][_0x643e('0x2f')]);}return _0xc6fb11['getAgents'](_0x120a17);}})[_0x643e('0x20')](function(_0x1805c3){if(_0x1805c3){return _0x1805c3?{'count':_0x16b82f,'rows':_0x1805c3}:null;}})[_0x643e('0x20')](respondWithResult(_0x2b64d5,null))[_0x643e('0x2a')](handleError(_0x2b64d5,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index ba8f097..132772d 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 _0xfcae=['setMaxListeners','save','remove','emit','hasOwnProperty','exports','events','../../mysqldb','FaxAccount'];(function(_0x53cf3f,_0xcc80ba){var _0x75be60=function(_0x23b904){while(--_0x23b904){_0x53cf3f['push'](_0x53cf3f['shift']());}};_0x75be60(++_0xcc80ba);}(_0xfcae,0x141));var _0xefca=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xfcae[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require(_0xefca('0x0'));var FaxAccount=require(_0xefca('0x1'))['db'][_0xefca('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xefca('0x3')](0x0);var events={'afterCreate':_0xefca('0x4'),'afterUpdate':'update','afterDestroy':_0xefca('0x5')};function emitEvent(_0x2bced9){return function(_0x56a065,_0x1d56a0,_0x56a02a){FaxAccountEvents[_0xefca('0x6')](_0x2bced9+':'+_0x56a065['id'],_0x56a065);FaxAccountEvents[_0xefca('0x6')](_0x2bced9,_0x56a065);_0x56a02a(null);};}for(var e in events){if(events[_0xefca('0x7')](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module[_0xefca('0x8')]=FaxAccountEvents; \ No newline at end of file +var _0x8c11=['hasOwnProperty','hook','exports','events','../../mysqldb','FaxAccount','setMaxListeners','save','update','remove','emit'];(function(_0x111adf,_0x1a3d56){var _0x244df9=function(_0xaac73e){while(--_0xaac73e){_0x111adf['push'](_0x111adf['shift']());}};_0x244df9(++_0x1a3d56);}(_0x8c11,0xf5));var _0x18c1=function(_0x3c6ecc,_0x1808a0){_0x3c6ecc=_0x3c6ecc-0x0;var _0x52343f=_0x8c11[_0x3c6ecc];return _0x52343f;};'use strict';var EventEmitter=require(_0x18c1('0x0'));var FaxAccount=require(_0x18c1('0x1'))['db'][_0x18c1('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x18c1('0x3')](0x0);var events={'afterCreate':_0x18c1('0x4'),'afterUpdate':_0x18c1('0x5'),'afterDestroy':_0x18c1('0x6')};function emitEvent(_0x479693){return function(_0x4751bd,_0x1acac7,_0x85ef4e){FaxAccountEvents[_0x18c1('0x7')](_0x479693+':'+_0x4751bd['id'],_0x4751bd);FaxAccountEvents[_0x18c1('0x7')](_0x479693,_0x4751bd);_0x85ef4e(null);};}for(var e in events){if(events[_0x18c1('0x8')](e)){var event=events[e];FaxAccount[_0x18c1('0x9')](e,emitEvent(event));}}module[_0x18c1('0xa')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 2fe68c9..85dda44 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 _0xc510=['exports','define','FaxAccount','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','./faxAccount.attributes'];(function(_0x1ca761,_0x341ed6){var _0x25104e=function(_0x46e734){while(--_0x46e734){_0x1ca761['push'](_0x1ca761['shift']());}};_0x25104e(++_0x341ed6);}(_0xc510,0x92));var _0x0c51=function(_0x2007cf,_0x42a0c1){_0x2007cf=_0x2007cf-0x0;var _0x60255c=_0xc510[_0x2007cf];return _0x60255c;};'use strict';var _=require(_0x0c51('0x0'));var util=require(_0x0c51('0x1'));var logger=require(_0x0c51('0x2'))('api');var moment=require(_0x0c51('0x3'));var BPromise=require(_0x0c51('0x4'));var rp=require(_0x0c51('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0c51('0x6'));var config=require('../../config/environment');var attributes=require(_0x0c51('0x7'));module[_0x0c51('0x8')]=function(_0x954e40,_0x1d5046){return _0x954e40[_0x0c51('0x9')](_0x0c51('0xa'),attributes,{'tableName':'fax_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc2d0=['bluebird','request-promise','path','rimraf','../../config/environment','exports','FaxAccount','../../config/logger','api','moment'];(function(_0x3f70bb,_0x329d02){var _0x865b97=function(_0x21374b){while(--_0x21374b){_0x3f70bb['push'](_0x3f70bb['shift']());}};_0x865b97(++_0x329d02);}(_0xc2d0,0x16f));var _0x0c2d=function(_0x2a100e,_0x263ba5){_0x2a100e=_0x2a100e-0x0;var _0x517ac8=_0xc2d0[_0x2a100e];return _0x517ac8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0c2d('0x0'))(_0x0c2d('0x1'));var moment=require(_0x0c2d('0x2'));var BPromise=require(_0x0c2d('0x3'));var rp=require(_0x0c2d('0x4'));var fs=require('fs');var path=require(_0x0c2d('0x5'));var rimraf=require(_0x0c2d('0x6'));var config=require(_0x0c2d('0x7'));var attributes=require('./faxAccount.attributes');module[_0x0c2d('0x8')]=function(_0x6b64f3,_0x4773aa){return _0x6b64f3['define'](_0x0c2d('0x9'),attributes,{'tableName':'fax_accounts','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 e42031d..11396d3 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 _0x789b=['createdAt','isNil','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','find','account','CmList','List','FaxApplication','Applications','get','applications','orderBy','priority','asc','Contacts','ListId','create','contact','FaxInteraction','Contact\x20not\x20found','autoclose','push','length','close','unmanaged','*,*,*,*','created','FaxMessage','ContactId','AttachmentId','UserId','User','name','interaction','unshift','agent','waitForTheAssignedAgent','queueId','queue','startRouting','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','then','info','request\x20sent','debug','stringify','error','code','FaxAccount,\x20%s,\x20%s','message','result','catch','FaxAccount','raw','options','where','attributes','limit','include','model','map','GetFaxAccount','NotifyFaxAccount','body','fax','CmContact','describe','Sequelize','difference','keys','updatedAt'];(function(_0x10fba7,_0x1f8952){var _0x360391=function(_0x4cc690){while(--_0x4cc690){_0x10fba7['push'](_0x10fba7['shift']());}};_0x360391(++_0x1f8952);}(_0x789b,0x148));var _0xb789=function(_0x4be6e0,_0x465a9a){_0x4be6e0=_0x4be6e0-0x0;var _0x42a1eb=_0x789b[_0x4be6e0];return _0x42a1eb;};'use strict';var _=require(_0xb789('0x0'));var util=require(_0xb789('0x1'));var moment=require('moment');var BPromise=require(_0xb789('0x2'));var rs=require(_0xb789('0x3'));var fs=require('fs');var Redis=require(_0xb789('0x4'));var db=require(_0xb789('0x5'))['db'];var utils=require(_0xb789('0x6'));var logger=require(_0xb789('0x7'))('rpc');var config=require(_0xb789('0x8'));var jayson=require(_0xb789('0x9'));var client=jayson[_0xb789('0xa')][_0xb789('0xb')]({'port':0x232c});config[_0xb789('0xc')]=_[_0xb789('0xd')](config[_0xb789('0xc')],{'host':_0xb789('0xe'),'port':0x18eb});var socket=require(_0xb789('0xf'))(new Redis(config[_0xb789('0xc')]));require(_0xb789('0x10'))[_0xb789('0x11')](socket);function respondWithRpcPromise(_0x4769cc,_0xaf2aa1,_0x175b61){return new BPromise(function(_0xed4768,_0xdb2259){return client['request'](_0x4769cc,_0x175b61)[_0xb789('0x12')](function(_0x1b855b){logger[_0xb789('0x13')]('FaxAccount,\x20%s,\x20%s',_0xaf2aa1,_0xb789('0x14'));logger[_0xb789('0x15')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0xaf2aa1,_0xb789('0x14'),JSON[_0xb789('0x16')](_0x1b855b));if(_0x1b855b['error']){if(_0x1b855b[_0xb789('0x17')][_0xb789('0x18')]===0x1f4){logger[_0xb789('0x17')](_0xb789('0x19'),_0xaf2aa1,_0x1b855b['error']['message']);return _0xdb2259(_0x1b855b['error'][_0xb789('0x1a')]);}logger[_0xb789('0x17')]('FaxAccount,\x20%s,\x20%s',_0xaf2aa1,_0x1b855b['error'][_0xb789('0x1a')]);return _0xed4768(_0x1b855b['error']['message']);}else{logger[_0xb789('0x13')]('FaxAccount,\x20%s,\x20%s',_0xaf2aa1,'request\x20sent');_0xed4768(_0x1b855b[_0xb789('0x1b')]['message']);}})[_0xb789('0x1c')](function(_0x45a130){logger['error'](_0xb789('0x19'),_0xaf2aa1,_0x45a130);_0xdb2259(_0x45a130);});});}exports['GetFaxAccount']=function(_0x4c7cf3){var _0x301571=this;return new Promise(function(_0x4cbbcc,_0x57d133){return db[_0xb789('0x1d')]['findAll']({'raw':_0x4c7cf3['options']?_0x4c7cf3['options'][_0xb789('0x1e')]===undefined?!![]:![]:!![],'where':_0x4c7cf3['options']?_0x4c7cf3[_0xb789('0x1f')][_0xb789('0x20')]||null:null,'attributes':_0x4c7cf3['options']?_0x4c7cf3['options'][_0xb789('0x21')]||null:null,'limit':_0x4c7cf3[_0xb789('0x1f')]?_0x4c7cf3[_0xb789('0x1f')][_0xb789('0x22')]||null:null,'include':_0x4c7cf3[_0xb789('0x1f')]?_0x4c7cf3[_0xb789('0x1f')]['include']?_['map'](_0x4c7cf3[_0xb789('0x1f')][_0xb789('0x23')],function(_0x33878d){return{'model':db[_0x33878d[_0xb789('0x24')]],'as':_0x33878d['as'],'attributes':_0x33878d[_0xb789('0x21')],'include':_0x33878d[_0xb789('0x23')]?_[_0xb789('0x25')](_0x33878d[_0xb789('0x23')],function(_0x4cd292){return{'model':db[_0x4cd292[_0xb789('0x24')]],'as':_0x4cd292['as'],'attributes':_0x4cd292[_0xb789('0x21')],'include':_0x4cd292[_0xb789('0x23')]?_['map'](_0x4cd292[_0xb789('0x23')],function(_0x47b4cf){return{'model':db[_0x47b4cf[_0xb789('0x24')]],'as':_0x47b4cf['as'],'attributes':_0x47b4cf[_0xb789('0x21')]};}):[]};}):[]};}):[]:[]})[_0xb789('0x12')](function(_0x35c53d){logger[_0xb789('0x13')]('GetFaxAccount',_0x4c7cf3);logger['debug'](_0xb789('0x26'),_0x4c7cf3,JSON[_0xb789('0x16')](_0x35c53d));_0x4cbbcc(_0x35c53d);})[_0xb789('0x1c')](function(_0x546a16){logger[_0xb789('0x17')](_0xb789('0x26'),_0x546a16['message'],_0x4c7cf3);_0x57d133(_0x301571[_0xb789('0x17')](0x1f4,_0x546a16[_0xb789('0x1a')]));});});};exports[_0xb789('0x27')]=function(_0x4def36,_0x145b81,_0x2fc3d9){var _0x303e2a=this;return new Promise(function(_0x1ee027,_0x37364c){var _0x1f439a={'body':_0x4def36[_0xb789('0x28')],'channel':_0xb789('0x29')};var _0x5f27a7=[];var _0x5ee33a=[];var _0x1856ef={};return db[_0xb789('0x2a')][_0xb789('0x2b')]()[_0xb789('0x12')](function(_0x13f883){if(!_0x13f883){throw new db[(_0xb789('0x2c'))]['ValidationError']('no\x20available\x20attributes');}_0x5f27a7=_[_0xb789('0x2d')](_[_0xb789('0x2e')](_0x13f883),['createdAt',_0xb789('0x2f')]);_0x5ee33a=_[_0xb789('0x2d')](_[_0xb789('0x2e')](_0x13f883),[_0xb789('0x30'),_0xb789('0x2f'),'CompanyId','ListId']);if(_0x4def36['body']['id']){delete _0x4def36['body']['id'];}if(_[_0xb789('0x31')](_0x4def36[_0xb789('0x28')]['from'])){throw new db[(_0xb789('0x2c'))][(_0xb789('0x32'))](_0xb789('0x33'));}if(_[_0xb789('0x31')](_0x4def36[_0xb789('0x28')]['body'])||_0x4def36[_0xb789('0x28')][_0xb789('0x28')]===''){throw new db[(_0xb789('0x2c'))][(_0xb789('0x32'))](_0xb789('0x34'));}if(_[_0xb789('0x31')](_0x4def36[_0xb789('0x28')]['mapKey'])){throw new db[(_0xb789('0x2c'))][(_0xb789('0x32'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5ee33a);}if(!_[_0xb789('0x35')](_0x5ee33a,_0x4def36[_0xb789('0x28')][_0xb789('0x36')])){throw new db[(_0xb789('0x2c'))][(_0xb789('0x32'))](_0xb789('0x37')+_0x5ee33a);}_0x1856ef[_0x4def36[_0xb789('0x28')]['mapKey']]=_0x4def36[_0xb789('0x28')][_0xb789('0x38')];})[_0xb789('0x12')](function(){return db[_0xb789('0x1d')][_0xb789('0x39')]({'where':{'id':_0x4def36[_0xb789('0x3a')]['id']},'include':[{'model':db[_0xb789('0x3b')],'as':_0xb789('0x3c'),'include':[{'model':db[_0xb789('0x2a')],'as':'Contacts','where':_0x1856ef,'limit':0x1,'order':[[_0xb789('0x2f'),'DESC']]}]},{'model':db[_0xb789('0x3d')],'as':_0xb789('0x3e')}]});})[_0xb789('0x12')](function(_0xd7fdc3){if(_0xd7fdc3&&_0xd7fdc3[_0xb789('0x3c')]){var _0x55898a=_0xd7fdc3[_0xb789('0x3f')]({'plain':!![]});_0x1f439a['account']=_0x55898a;_0x1f439a[_0xb789('0x40')]=_0x55898a['Applications'];_0x1f439a['list']=_0x55898a[_0xb789('0x3c')];_0x1f439a[_0xb789('0x40')]=_[_0xb789('0x41')](_0x1f439a[_0xb789('0x40')],[_0xb789('0x42')],[_0xb789('0x43')]);if(_0x1f439a['account'][_0xb789('0x3e')]){delete _0x1f439a[_0xb789('0x3a')][_0xb789('0x3e')];}if(_0x1f439a[_0xb789('0x3a')][_0xb789('0x3c')]&&_0x1f439a[_0xb789('0x3a')][_0xb789('0x3c')]['Contacts']['length']){return _0x1f439a['account'][_0xb789('0x3c')][_0xb789('0x44')][0x0];}var _0x55cc06=_['defaults'](_0x4def36[_0xb789('0x28')],{'firstName':_0x4def36[_0xb789('0x28')][_0xb789('0x38')],'ListId':_0x55898a[_0xb789('0x45')]});_0x55cc06[_0x4def36['body'][_0xb789('0x36')]]=_0x4def36[_0xb789('0x28')][_0xb789('0x38')];return db[_0xb789('0x2a')][_0xb789('0x46')](_0x55cc06,{'fields':_0x5f27a7,'raw':!![]});}})[_0xb789('0x12')](function(_0x5296f3){_0x1f439a[_0xb789('0x47')]=_0x5296f3;if(_0x5296f3){var _0x1f116={'ContactId':_0x5296f3['id'],'FaxAccountId':_0x4def36[_0xb789('0x3a')]['id'],'fax':_0x5296f3[_0xb789('0x29')]};return db[_0xb789('0x48')][_0xb789('0x39')]({'where':{'ContactId':_0x5296f3['id'],'closed':![],'FaxAccountId':_0x4def36['account']['id']}})['then'](function(_0x5021fb){if(_0x5021fb){return[_0x5021fb,![]];}return db[_0xb789('0x48')][_0xb789('0x46')](_0x1f116)[_0xb789('0x12')](function(_0x507314){return[_0x507314,!![]];});});}else{throw new Error(_0xb789('0x49'));}})['spread'](function(_0x52e8cf,_0x2d7d3c){var _0x540862=_0x52e8cf[_0xb789('0x3f')]({'plain':!![]});if(_0x2d7d3c){if(_0x1f439a['account'][_0xb789('0x4a')]){_0x1f439a[_0xb789('0x40')][_0xb789('0x4b')]({'id':0x0,'priority':_0x1f439a[_0xb789('0x40')][_0xb789('0x4c')]+0x1,'app':_0xb789('0x4d'),'appdata':_0xb789('0x4e'),'interval':_0xb789('0x4f')});}_0x540862[_0xb789('0x50')]=!![];}else{_0x540862[_0xb789('0x50')]=![];}_0x1f439a['interaction']=_0x540862;return db[_0xb789('0x51')]['create']({'body':_0x4def36['body'][_0xb789('0x28')],'FaxAccountId':_0x4def36['account']['id'],'FaxInteractionId':_0x52e8cf['id'],'direction':'in','ContactId':_0x52e8cf[_0xb789('0x52')],'AttachmentId':_0x4def36[_0xb789('0x28')][_0xb789('0x53')]});})[_0xb789('0x12')](function(_0x5058d8){_0x1f439a[_0xb789('0x1a')]=_0x5058d8;if(!_0x1f439a['interaction'][_0xb789('0x54')])return;return db[_0xb789('0x55')][_0xb789('0x39')]({'attributes':['id',_0xb789('0x56')],'where':{'id':_0x1f439a[_0xb789('0x57')]['UserId']}});})[_0xb789('0x12')](function(_0x4fc92a){if(_0x4fc92a){_0x1f439a[_0xb789('0x40')][_0xb789('0x58')]({'id':0x0,'priority':0x0,'app':_0xb789('0x59'),'appdata':_0x4fc92a[_0xb789('0x56')]+','+(_0x1f439a[_0xb789('0x3a')][_0xb789('0x5a')]||0xa),'interval':_0xb789('0x4f')});}if(!_0x1f439a[_0xb789('0x57')][_0xb789('0x5b')])return;return db['FaxQueue']['find']({'attributes':['id',_0xb789('0x56')],'where':{'id':_0x1f439a['interaction'][_0xb789('0x5b')]}});})[_0xb789('0x12')](function(_0x143f9e){if(_0x143f9e){_0x1f439a[_0xb789('0x40')]['unshift']({'id':0x0,'priority':0x1,'app':_0xb789('0x5c'),'appdata':_0x143f9e['name']+','+(_0x1f439a[_0xb789('0x3a')]['waitForTheAssignedQueue']||0x12c),'interval':_0xb789('0x4f')});}return respondWithRpcPromise('Start',_0xb789('0x5d'),_0x1f439a);})[_0xb789('0x12')](function(_0x3ca0f9){_0x1ee027(_0x3ca0f9);})[_0xb789('0x1c')](function(_0x26d12b){_0x37364c(_0x303e2a[_0xb789('0x17')](0x1f4,_0x26d12b[_0xb789('0x1a')]));});});}; \ No newline at end of file +var _0x5238=['Applications','get','applications','list','orderBy','priority','asc','Contacts','length','ListId','create','FaxInteraction','Contact\x20not\x20found','spread','autoclose','push','close','unmanaged','*,*,*,*','created','interaction','FaxMessage','ContactId','AttachmentId','UserId','name','unshift','agent','queueId','FaxQueue','waitForTheAssignedQueue','Start','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','./faxAccount.socket','request','then','info','FaxAccount,\x20%s,\x20%s','debug','stringify','error','message','request\x20sent','result','catch','GetFaxAccount','FaxAccount','options','limit','include','map','model','NotifyFaxAccount','body','Sequelize','ValidationError','no\x20available\x20attributes','difference','keys','updatedAt','createdAt','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','List','CmContact','DESC','FaxApplication'];(function(_0x46d0c9,_0x526bfa){var _0x174506=function(_0x654bc6){while(--_0x654bc6){_0x46d0c9['push'](_0x46d0c9['shift']());}};_0x174506(++_0x526bfa);}(_0x5238,0xcc));var _0x8523=function(_0x4d3828,_0x21064b){_0x4d3828=_0x4d3828-0x0;var _0x27684d=_0x5238[_0x4d3828];return _0x27684d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8523('0x0'));var BPromise=require(_0x8523('0x1'));var rs=require(_0x8523('0x2'));var fs=require('fs');var Redis=require(_0x8523('0x3'));var db=require(_0x8523('0x4'))['db'];var utils=require(_0x8523('0x5'));var logger=require(_0x8523('0x6'))(_0x8523('0x7'));var config=require('../../config/environment');var jayson=require(_0x8523('0x8'));var client=jayson[_0x8523('0x9')][_0x8523('0xa')]({'port':0x232c});config[_0x8523('0xb')]=_[_0x8523('0xc')](config[_0x8523('0xb')],{'host':_0x8523('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x8523('0xe'))['register'](socket);function respondWithRpcPromise(_0x203b39,_0x1b9fcc,_0x5b8a51){return new BPromise(function(_0x4a7d33,_0x140457){return client[_0x8523('0xf')](_0x203b39,_0x5b8a51)[_0x8523('0x10')](function(_0x561284){logger[_0x8523('0x11')](_0x8523('0x12'),_0x1b9fcc,'request\x20sent');logger[_0x8523('0x13')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x1b9fcc,'request\x20sent',JSON[_0x8523('0x14')](_0x561284));if(_0x561284[_0x8523('0x15')]){if(_0x561284[_0x8523('0x15')]['code']===0x1f4){logger[_0x8523('0x15')](_0x8523('0x12'),_0x1b9fcc,_0x561284[_0x8523('0x15')][_0x8523('0x16')]);return _0x140457(_0x561284['error'][_0x8523('0x16')]);}logger[_0x8523('0x15')](_0x8523('0x12'),_0x1b9fcc,_0x561284['error']['message']);return _0x4a7d33(_0x561284['error']['message']);}else{logger[_0x8523('0x11')](_0x8523('0x12'),_0x1b9fcc,_0x8523('0x17'));_0x4a7d33(_0x561284[_0x8523('0x18')][_0x8523('0x16')]);}})[_0x8523('0x19')](function(_0x904f76){logger[_0x8523('0x15')]('FaxAccount,\x20%s,\x20%s',_0x1b9fcc,_0x904f76);_0x140457(_0x904f76);});});}exports[_0x8523('0x1a')]=function(_0xdfc206){var _0xaaceb2=this;return new Promise(function(_0x4b248f,_0x21f92d){return db[_0x8523('0x1b')]['findAll']({'raw':_0xdfc206[_0x8523('0x1c')]?_0xdfc206[_0x8523('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0xdfc206[_0x8523('0x1c')]?_0xdfc206['options']['where']||null:null,'attributes':_0xdfc206['options']?_0xdfc206[_0x8523('0x1c')]['attributes']||null:null,'limit':_0xdfc206[_0x8523('0x1c')]?_0xdfc206[_0x8523('0x1c')][_0x8523('0x1d')]||null:null,'include':_0xdfc206['options']?_0xdfc206[_0x8523('0x1c')][_0x8523('0x1e')]?_[_0x8523('0x1f')](_0xdfc206[_0x8523('0x1c')][_0x8523('0x1e')],function(_0x3c880a){return{'model':db[_0x3c880a['model']],'as':_0x3c880a['as'],'attributes':_0x3c880a['attributes'],'include':_0x3c880a[_0x8523('0x1e')]?_[_0x8523('0x1f')](_0x3c880a[_0x8523('0x1e')],function(_0x5e5192){return{'model':db[_0x5e5192['model']],'as':_0x5e5192['as'],'attributes':_0x5e5192['attributes'],'include':_0x5e5192[_0x8523('0x1e')]?_[_0x8523('0x1f')](_0x5e5192[_0x8523('0x1e')],function(_0x54324b){return{'model':db[_0x54324b[_0x8523('0x20')]],'as':_0x54324b['as'],'attributes':_0x54324b['attributes']};}):[]};}):[]};}):[]:[]})[_0x8523('0x10')](function(_0x3bde5e){logger['info'](_0x8523('0x1a'),_0xdfc206);logger[_0x8523('0x13')]('GetFaxAccount',_0xdfc206,JSON[_0x8523('0x14')](_0x3bde5e));_0x4b248f(_0x3bde5e);})['catch'](function(_0x5ba549){logger[_0x8523('0x15')](_0x8523('0x1a'),_0x5ba549[_0x8523('0x16')],_0xdfc206);_0x21f92d(_0xaaceb2[_0x8523('0x15')](0x1f4,_0x5ba549[_0x8523('0x16')]));});});};exports[_0x8523('0x21')]=function(_0x19f6c4,_0x236c51,_0x124768){var _0x5a3069=this;return new Promise(function(_0x1ce95c,_0x543d83){var _0x2fea2a={'body':_0x19f6c4[_0x8523('0x22')],'channel':'fax'};var _0x54c556=[];var _0xe59cf1=[];var _0x2eaf6d={};return db['CmContact']['describe']()['then'](function(_0x2ac063){if(!_0x2ac063){throw new db[(_0x8523('0x23'))][(_0x8523('0x24'))](_0x8523('0x25'));}_0x54c556=_[_0x8523('0x26')](_[_0x8523('0x27')](_0x2ac063),['createdAt',_0x8523('0x28')]);_0xe59cf1=_[_0x8523('0x26')](_[_0x8523('0x27')](_0x2ac063),[_0x8523('0x29'),_0x8523('0x28'),'CompanyId','ListId']);if(_0x19f6c4[_0x8523('0x22')]['id']){delete _0x19f6c4[_0x8523('0x22')]['id'];}if(_[_0x8523('0x2a')](_0x19f6c4[_0x8523('0x22')][_0x8523('0x2b')])){throw new db[(_0x8523('0x23'))][(_0x8523('0x24'))](_0x8523('0x2c'));}if(_[_0x8523('0x2a')](_0x19f6c4[_0x8523('0x22')]['body'])||_0x19f6c4[_0x8523('0x22')][_0x8523('0x22')]===''){throw new db[(_0x8523('0x23'))][(_0x8523('0x24'))](_0x8523('0x2d'));}if(_[_0x8523('0x2a')](_0x19f6c4[_0x8523('0x22')]['mapKey'])){throw new db[(_0x8523('0x23'))][(_0x8523('0x24'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0xe59cf1);}if(!_['includes'](_0xe59cf1,_0x19f6c4['body'][_0x8523('0x2e')])){throw new db[(_0x8523('0x23'))][(_0x8523('0x24'))](_0x8523('0x2f')+_0xe59cf1);}_0x2eaf6d[_0x19f6c4['body'][_0x8523('0x2e')]]=_0x19f6c4[_0x8523('0x22')][_0x8523('0x2b')];})['then'](function(){return db['FaxAccount'][_0x8523('0x30')]({'where':{'id':_0x19f6c4[_0x8523('0x31')]['id']},'include':[{'model':db['CmList'],'as':_0x8523('0x32'),'include':[{'model':db[_0x8523('0x33')],'as':'Contacts','where':_0x2eaf6d,'limit':0x1,'order':[[_0x8523('0x28'),_0x8523('0x34')]]}]},{'model':db[_0x8523('0x35')],'as':_0x8523('0x36')}]});})[_0x8523('0x10')](function(_0x35263e){if(_0x35263e&&_0x35263e[_0x8523('0x32')]){var _0x1c4c05=_0x35263e[_0x8523('0x37')]({'plain':!![]});_0x2fea2a[_0x8523('0x31')]=_0x1c4c05;_0x2fea2a[_0x8523('0x38')]=_0x1c4c05[_0x8523('0x36')];_0x2fea2a[_0x8523('0x39')]=_0x1c4c05['List'];_0x2fea2a[_0x8523('0x38')]=_[_0x8523('0x3a')](_0x2fea2a[_0x8523('0x38')],[_0x8523('0x3b')],[_0x8523('0x3c')]);if(_0x2fea2a[_0x8523('0x31')][_0x8523('0x36')]){delete _0x2fea2a['account']['Applications'];}if(_0x2fea2a['account'][_0x8523('0x32')]&&_0x2fea2a[_0x8523('0x31')][_0x8523('0x32')][_0x8523('0x3d')][_0x8523('0x3e')]){return _0x2fea2a['account']['List']['Contacts'][0x0];}var _0x1ae647=_['defaults'](_0x19f6c4[_0x8523('0x22')],{'firstName':_0x19f6c4[_0x8523('0x22')][_0x8523('0x2b')],'ListId':_0x1c4c05[_0x8523('0x3f')]});_0x1ae647[_0x19f6c4[_0x8523('0x22')]['mapKey']]=_0x19f6c4[_0x8523('0x22')]['from'];return db[_0x8523('0x33')][_0x8523('0x40')](_0x1ae647,{'fields':_0x54c556,'raw':!![]});}})[_0x8523('0x10')](function(_0x5a33d4){_0x2fea2a['contact']=_0x5a33d4;if(_0x5a33d4){var _0x102541={'ContactId':_0x5a33d4['id'],'FaxAccountId':_0x19f6c4[_0x8523('0x31')]['id'],'fax':_0x5a33d4['fax']};return db[_0x8523('0x41')][_0x8523('0x30')]({'where':{'ContactId':_0x5a33d4['id'],'closed':![],'FaxAccountId':_0x19f6c4[_0x8523('0x31')]['id']}})[_0x8523('0x10')](function(_0xedd652){if(_0xedd652){return[_0xedd652,![]];}return db['FaxInteraction'][_0x8523('0x40')](_0x102541)['then'](function(_0xe94756){return[_0xe94756,!![]];});});}else{throw new Error(_0x8523('0x42'));}})[_0x8523('0x43')](function(_0x533ac6,_0x322e61){var _0x3515f8=_0x533ac6[_0x8523('0x37')]({'plain':!![]});if(_0x322e61){if(_0x2fea2a['account'][_0x8523('0x44')]){_0x2fea2a[_0x8523('0x38')][_0x8523('0x45')]({'id':0x0,'priority':_0x2fea2a[_0x8523('0x38')][_0x8523('0x3e')]+0x1,'app':_0x8523('0x46'),'appdata':_0x8523('0x47'),'interval':_0x8523('0x48')});}_0x3515f8[_0x8523('0x49')]=!![];}else{_0x3515f8['created']=![];}_0x2fea2a[_0x8523('0x4a')]=_0x3515f8;return db[_0x8523('0x4b')]['create']({'body':_0x19f6c4['body'][_0x8523('0x22')],'FaxAccountId':_0x19f6c4[_0x8523('0x31')]['id'],'FaxInteractionId':_0x533ac6['id'],'direction':'in','ContactId':_0x533ac6[_0x8523('0x4c')],'AttachmentId':_0x19f6c4['body'][_0x8523('0x4d')]});})[_0x8523('0x10')](function(_0x4e424b){_0x2fea2a[_0x8523('0x16')]=_0x4e424b;if(!_0x2fea2a[_0x8523('0x4a')][_0x8523('0x4e')])return;return db['User'][_0x8523('0x30')]({'attributes':['id',_0x8523('0x4f')],'where':{'id':_0x2fea2a[_0x8523('0x4a')][_0x8523('0x4e')]}});})[_0x8523('0x10')](function(_0x357ecb){if(_0x357ecb){_0x2fea2a['applications'][_0x8523('0x50')]({'id':0x0,'priority':0x0,'app':_0x8523('0x51'),'appdata':_0x357ecb[_0x8523('0x4f')]+','+(_0x2fea2a[_0x8523('0x31')]['waitForTheAssignedAgent']||0xa),'interval':_0x8523('0x48')});}if(!_0x2fea2a[_0x8523('0x4a')][_0x8523('0x52')])return;return db[_0x8523('0x53')][_0x8523('0x30')]({'attributes':['id','name'],'where':{'id':_0x2fea2a[_0x8523('0x4a')][_0x8523('0x52')]}});})[_0x8523('0x10')](function(_0x127489){if(_0x127489){_0x2fea2a[_0x8523('0x38')]['unshift']({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x127489['name']+','+(_0x2fea2a[_0x8523('0x31')][_0x8523('0x54')]||0x12c),'interval':_0x8523('0x48')});}return respondWithRpcPromise(_0x8523('0x55'),'startRouting',_0x2fea2a);})[_0x8523('0x10')](function(_0x9c4695){_0x1ce95c(_0x9c4695);})[_0x8523('0x19')](function(_0x1249c6){_0x543d83(_0x5a3069[_0x8523('0x15')](0x1f4,_0x1249c6[_0x8523('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 3563235..52aac62 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 _0xf93a=['register','faxAccount:','./faxAccount.events','save','update','emit'];(function(_0x25680f,_0x49646a){var _0x135948=function(_0x4b6ebe){while(--_0x4b6ebe){_0x25680f['push'](_0x25680f['shift']());}};_0x135948(++_0x49646a);}(_0xf93a,0xf2));var _0xaf93=function(_0x11e285,_0x15d5f2){_0x11e285=_0x11e285-0x0;var _0x441f7b=_0xf93a[_0x11e285];return _0x441f7b;};'use strict';var FaxAccountEvents=require(_0xaf93('0x0'));var events=[_0xaf93('0x1'),'remove',_0xaf93('0x2')];function createListener(_0x2d944d,_0x316ece){return function(_0x2c1162){_0x316ece[_0xaf93('0x3')](_0x2d944d,_0x2c1162);};}function removeListener(_0x5c665d,_0x376008){return function(){FaxAccountEvents['removeListener'](_0x5c665d,_0x376008);};}exports[_0xaf93('0x4')]=function(_0x262755){for(var _0xc66037=0x0,_0x575893=events['length'];_0xc66037<_0x575893;_0xc66037++){var _0xb03321=events[_0xc66037];var _0x758705=createListener(_0xaf93('0x5')+_0xb03321,_0x262755);FaxAccountEvents['on'](_0xb03321,_0x758705);}}; \ No newline at end of file +var _0xc11e=['update','emit','removeListener','register','./faxAccount.events','save','remove'];(function(_0x1da848,_0x1b5d1e){var _0x196efe=function(_0x47c82b){while(--_0x47c82b){_0x1da848['push'](_0x1da848['shift']());}};_0x196efe(++_0x1b5d1e);}(_0xc11e,0x1e7));var _0xec11=function(_0x24dce9,_0x392609){_0x24dce9=_0x24dce9-0x0;var _0x3c7dcd=_0xc11e[_0x24dce9];return _0x3c7dcd;};'use strict';var FaxAccountEvents=require(_0xec11('0x0'));var events=[_0xec11('0x1'),_0xec11('0x2'),_0xec11('0x3')];function createListener(_0x52f30e,_0x358f12){return function(_0x3a0c05){_0x358f12[_0xec11('0x4')](_0x52f30e,_0x3a0c05);};}function removeListener(_0x45dd98,_0x3af641){return function(){FaxAccountEvents[_0xec11('0x5')](_0x45dd98,_0x3af641);};}exports[_0xec11('0x6')]=function(_0x142080){for(var _0x3c6979=0x0,_0x18d26c=events['length'];_0x3c6979<_0x18d26c;_0x3c6979++){var _0x29eb0c=events[_0x3c6979];var _0x8d27d1=createListener('faxAccount:'+_0x29eb0c,_0x142080);FaxAccountEvents['on'](_0x29eb0c,_0x8d27d1);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 8fb5f17..00fd3b3 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 _0x7ffe=['getAnswers','/:id/interactions','/:id/applications','getApplications','/:id/messages','getMessages','getAgents','post','create','addDisposition','addAnswer','addApplications','/addaccountapplications','addAccountApplications','updateAccountApplications','/:id/send','send','/:id/users','update','delete','/:id/dispositions','removeDispositions','removeAnswers','removeAgents','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/canned_answers'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7ffe,0x96));var _0xe7ff=function(_0x75afc,_0x247d78){_0x75afc=_0x75afc-0x0;var _0x4189db=_0x7ffe[_0x75afc];return _0x4189db;};'use strict';var multer=require(_0xe7ff('0x0'));var util=require(_0xe7ff('0x1'));var path=require(_0xe7ff('0x2'));var timeout=require(_0xe7ff('0x3'));var express=require(_0xe7ff('0x4'));var router=express[_0xe7ff('0x5')]();var fs_extra=require(_0xe7ff('0x6'));var auth=require(_0xe7ff('0x7'));var interaction=require(_0xe7ff('0x8'));var config=require(_0xe7ff('0x9'));var controller=require(_0xe7ff('0xa'));router[_0xe7ff('0xb')]('/',auth[_0xe7ff('0xc')](),controller[_0xe7ff('0xd')]);router[_0xe7ff('0xb')](_0xe7ff('0xe'),auth['isAuthenticated'](),controller['describe']);router['get'](_0xe7ff('0xf'),auth[_0xe7ff('0xc')](),controller[_0xe7ff('0x10')]);router['get']('/:id/dispositions',auth['isAuthenticated'](),controller['getDispositions']);router[_0xe7ff('0xb')](_0xe7ff('0x11'),auth[_0xe7ff('0xc')](),controller[_0xe7ff('0x12')]);router[_0xe7ff('0xb')](_0xe7ff('0x13'),auth[_0xe7ff('0xc')](),controller['getInteractions']);router[_0xe7ff('0xb')](_0xe7ff('0x14'),auth[_0xe7ff('0xc')](),controller[_0xe7ff('0x15')]);router[_0xe7ff('0xb')](_0xe7ff('0x16'),auth['isAuthenticated'](),controller[_0xe7ff('0x17')]);router['get']('/:id/users',auth[_0xe7ff('0xc')](),controller[_0xe7ff('0x18')]);router[_0xe7ff('0x19')]('/',auth[_0xe7ff('0xc')](),controller[_0xe7ff('0x1a')]);router[_0xe7ff('0x19')]('/:id/dispositions',auth[_0xe7ff('0xc')](),controller[_0xe7ff('0x1b')]);router[_0xe7ff('0x19')](_0xe7ff('0x11'),auth[_0xe7ff('0xc')](),controller[_0xe7ff('0x1c')]);router[_0xe7ff('0x19')](_0xe7ff('0x13'),auth[_0xe7ff('0xc')](),controller['addInteraction']);router[_0xe7ff('0x19')](_0xe7ff('0x14'),auth[_0xe7ff('0xc')](),controller[_0xe7ff('0x1d')]);router[_0xe7ff('0x19')](_0xe7ff('0x1e'),auth[_0xe7ff('0xc')](),controller[_0xe7ff('0x1f')]);router['post']('/updateaccountapplications',auth[_0xe7ff('0xc')](),controller[_0xe7ff('0x20')]);router[_0xe7ff('0x19')](_0xe7ff('0x21'),auth[_0xe7ff('0xc')](),controller[_0xe7ff('0x22')]);router[_0xe7ff('0x19')](_0xe7ff('0x23'),auth['isAuthenticated'](),controller['addAgents']);router['put']('/:id',auth[_0xe7ff('0xc')](),controller[_0xe7ff('0x24')]);router[_0xe7ff('0x25')](_0xe7ff('0xf'),auth[_0xe7ff('0xc')](),controller['destroy']);router[_0xe7ff('0x25')](_0xe7ff('0x26'),auth['isAuthenticated'](),controller[_0xe7ff('0x27')]);router[_0xe7ff('0x25')]('/:id/canned_answers',auth[_0xe7ff('0xc')](),controller[_0xe7ff('0x28')]);router[_0xe7ff('0x25')]('/:id/users',auth[_0xe7ff('0xc')](),controller[_0xe7ff('0x29')]);module['exports']=router; \ No newline at end of file +var _0x9d00=['/:id/canned_answers','getAnswers','/:id/interactions','getInteractions','/:id/applications','getApplications','getMessages','getAgents','create','post','/:id/dispositions','addDisposition','addAnswer','addApplications','/addaccountapplications','addAccountApplications','/:id/send','send','addAgents','put','/:id','destroy','delete','removeDispositions','removeAnswers','/:id/users','removeAgents','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./faxAccount.controller','get','isAuthenticated','index','describe','getDispositions'];(function(_0x58847b,_0x1ec00c){var _0x2541af=function(_0x16feae){while(--_0x16feae){_0x58847b['push'](_0x58847b['shift']());}};_0x2541af(++_0x1ec00c);}(_0x9d00,0x1ea));var _0x09d0=function(_0x44f605,_0x2d9569){_0x44f605=_0x44f605-0x0;var _0x285189=_0x9d00[_0x44f605];return _0x285189;};'use strict';var multer=require(_0x09d0('0x0'));var util=require(_0x09d0('0x1'));var path=require(_0x09d0('0x2'));var timeout=require(_0x09d0('0x3'));var express=require(_0x09d0('0x4'));var router=express['Router']();var fs_extra=require(_0x09d0('0x5'));var auth=require(_0x09d0('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x09d0('0x7'));var controller=require(_0x09d0('0x8'));router[_0x09d0('0x9')]('/',auth[_0x09d0('0xa')](),controller[_0x09d0('0xb')]);router[_0x09d0('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x09d0('0xc')]);router[_0x09d0('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x09d0('0x9')]('/:id/dispositions',auth[_0x09d0('0xa')](),controller[_0x09d0('0xd')]);router[_0x09d0('0x9')](_0x09d0('0xe'),auth[_0x09d0('0xa')](),controller[_0x09d0('0xf')]);router[_0x09d0('0x9')](_0x09d0('0x10'),auth[_0x09d0('0xa')](),controller[_0x09d0('0x11')]);router[_0x09d0('0x9')](_0x09d0('0x12'),auth[_0x09d0('0xa')](),controller[_0x09d0('0x13')]);router[_0x09d0('0x9')]('/:id/messages',auth[_0x09d0('0xa')](),controller[_0x09d0('0x14')]);router[_0x09d0('0x9')]('/:id/users',auth[_0x09d0('0xa')](),controller[_0x09d0('0x15')]);router['post']('/',auth[_0x09d0('0xa')](),controller[_0x09d0('0x16')]);router[_0x09d0('0x17')](_0x09d0('0x18'),auth['isAuthenticated'](),controller[_0x09d0('0x19')]);router['post']('/:id/canned_answers',auth[_0x09d0('0xa')](),controller[_0x09d0('0x1a')]);router[_0x09d0('0x17')](_0x09d0('0x10'),auth[_0x09d0('0xa')](),controller['addInteraction']);router[_0x09d0('0x17')](_0x09d0('0x12'),auth[_0x09d0('0xa')](),controller[_0x09d0('0x1b')]);router['post'](_0x09d0('0x1c'),auth[_0x09d0('0xa')](),controller[_0x09d0('0x1d')]);router['post']('/updateaccountapplications',auth[_0x09d0('0xa')](),controller['updateAccountApplications']);router[_0x09d0('0x17')](_0x09d0('0x1e'),auth[_0x09d0('0xa')](),controller[_0x09d0('0x1f')]);router['post']('/:id/users',auth[_0x09d0('0xa')](),controller[_0x09d0('0x20')]);router[_0x09d0('0x21')](_0x09d0('0x22'),auth[_0x09d0('0xa')](),controller['update']);router['delete'](_0x09d0('0x22'),auth[_0x09d0('0xa')](),controller[_0x09d0('0x23')]);router[_0x09d0('0x24')](_0x09d0('0x18'),auth[_0x09d0('0xa')](),controller[_0x09d0('0x25')]);router[_0x09d0('0x24')](_0x09d0('0xe'),auth[_0x09d0('0xa')](),controller[_0x09d0('0x26')]);router[_0x09d0('0x24')](_0x09d0('0x27'),auth[_0x09d0('0xa')](),controller[_0x09d0('0x28')]);module[_0x09d0('0x29')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index f174938..12b4b82 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 _0x8e14=['*,*,*,*','sequelize','STRING','noop','TEXT'];(function(_0x525fc5,_0x2e5ee5){var _0x50a902=function(_0x18553b){while(--_0x18553b){_0x525fc5['push'](_0x525fc5['shift']());}};_0x50a902(++_0x2e5ee5);}(_0x8e14,0xce));var _0x48e1=function(_0x4ab835,_0x2b711a){_0x4ab835=_0x4ab835-0x0;var _0x4138fc=_0x8e14[_0x4ab835];return _0x4138fc;};'use strict';var Sequelize=require(_0x48e1('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x48e1('0x1')],'allowNull':![],'defaultValue':_0x48e1('0x2')},'appdata':{'type':Sequelize[_0x48e1('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x48e1('0x4')}}; \ No newline at end of file +var _0x5b28=['TEXT','sequelize','exports','STRING'];(function(_0x2d6c22,_0x45cde2){var _0x2998fd=function(_0x3266c6){while(--_0x3266c6){_0x2d6c22['push'](_0x2d6c22['shift']());}};_0x2998fd(++_0x45cde2);}(_0x5b28,0x119));var _0x85b2=function(_0x50e5f3,_0x28ac93){_0x50e5f3=_0x50e5f3-0x0;var _0x55cb11=_0x5b28[_0x50e5f3];return _0x55cb11;};'use strict';var Sequelize=require(_0x85b2('0x0'));module[_0x85b2('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x85b2('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x85b2('0x3')]()},'description':{'type':Sequelize[_0x85b2('0x2')]},'interval':{'type':Sequelize[_0x85b2('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 4851aee..d1ab72d 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 _0x9951=['error','stack','name','send','map','FaxApplication','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','type','VIRTUAL','filter','merge','options','include','findAll','catch','show','params','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy'];(function(_0x388bf9,_0x5769e4){var _0x2956df=function(_0x489041){while(--_0x489041){_0x388bf9['push'](_0x388bf9['shift']());}};_0x2956df(++_0x5769e4);}(_0x9951,0x190));var _0x1995=function(_0x4f64aa,_0x33a12a){_0x4f64aa=_0x4f64aa-0x0;var _0x43640e=_0x9951[_0x4f64aa];return _0x43640e;};'use strict';var emlformat=require(_0x1995('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1995('0x1'));var jsonpatch=require(_0x1995('0x2'));var rp=require(_0x1995('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1995('0x4'));var path=require(_0x1995('0x5'));var sox=require(_0x1995('0x6'));var csv=require(_0x1995('0x7'));var ejs=require(_0x1995('0x8'));var fs=require('fs');var fs_extra=require(_0x1995('0x9'));var _=require(_0x1995('0xa'));var squel=require(_0x1995('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x1995('0xc'));var toCsv=require(_0x1995('0x7'));var querystring=require(_0x1995('0xd'));var Papa=require(_0x1995('0xe'));var Redis=require(_0x1995('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x1995('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x1995('0x11'))(_0x1995('0x12'));var utils=require(_0x1995('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x1995('0x14'));var db=require(_0x1995('0x15'))['db'];function respondWithStatusCode(_0x1c787d,_0x263e28){_0x263e28=_0x263e28||0xcc;return function(_0x5e93f3){if(_0x5e93f3){return _0x1c787d[_0x1995('0x16')](_0x263e28);}return _0x1c787d[_0x1995('0x17')](_0x263e28)[_0x1995('0x18')]();};}function respondWithResult(_0x5a387e,_0x5aad67){_0x5aad67=_0x5aad67||0xc8;return function(_0x1d3be9){if(_0x1d3be9){return _0x5a387e['status'](_0x5aad67)[_0x1995('0x19')](_0x1d3be9);}};}function respondWithFilteredResult(_0x3b191d,_0x41e8e3){return function(_0x36c437){if(_0x36c437){var _0xce736b=typeof _0x41e8e3['offset']===_0x1995('0x1a')&&typeof _0x41e8e3[_0x1995('0x1b')]===_0x1995('0x1a');var _0x3c108c=_0x36c437[_0x1995('0x1c')];var _0x2305aa=_0xce736b?0x0:_0x41e8e3[_0x1995('0x1d')];var _0x4a33ab=_0xce736b?_0x36c437[_0x1995('0x1c')]:_0x41e8e3['offset']+_0x41e8e3['limit'];var _0x14119a;if(_0x4a33ab>=_0x3c108c){_0x4a33ab=_0x3c108c;_0x14119a=0xc8;}else{_0x14119a=0xce;}_0x3b191d[_0x1995('0x17')](_0x14119a);return _0x3b191d[_0x1995('0x1e')](_0x1995('0x1f'),_0x2305aa+'-'+_0x4a33ab+'/'+_0x3c108c)['json'](_0x36c437);}return null;};}function patchUpdates(_0x216e5e){return function(_0x178a05){try{jsonpatch[_0x1995('0x20')](_0x178a05,_0x216e5e,!![]);}catch(_0x75193c){return BPromise[_0x1995('0x21')](_0x75193c);}return _0x178a05[_0x1995('0x22')]();};}function saveUpdates(_0x200a6b,_0x745a83){return function(_0x5a88d0){if(_0x5a88d0){return _0x5a88d0[_0x1995('0x23')](_0x200a6b)[_0x1995('0x24')](function(_0x3d5575){return _0x3d5575;});}return null;};}function removeEntity(_0x1b0da6,_0x4b3d34){return function(_0x215109){if(_0x215109){return _0x215109[_0x1995('0x25')]()[_0x1995('0x24')](function(){_0x1b0da6['status'](0xcc)[_0x1995('0x18')]();});}};}function handleEntityNotFound(_0x33de0c,_0x4545aa){return function(_0xca4ba8){if(!_0xca4ba8){_0x33de0c[_0x1995('0x16')](0x194);}return _0xca4ba8;};}function handleError(_0x34f69a,_0x440c60){_0x440c60=_0x440c60||0x1f4;return function(_0x18c527){logger[_0x1995('0x26')](_0x18c527[_0x1995('0x27')]);if(_0x18c527[_0x1995('0x28')]){delete _0x18c527[_0x1995('0x28')];}_0x34f69a['status'](_0x440c60)[_0x1995('0x29')](_0x18c527);};}exports['index']=function(_0x44d6cb,_0x149d2e){var _0x1a06ce={},_0x28d5f5={},_0x5881a2={'count':0x0,'rows':[]};var _0x132c6c=_[_0x1995('0x2a')](db[_0x1995('0x2b')][_0x1995('0x2c')],function(_0x5e1a16){return{'name':_0x5e1a16[_0x1995('0x2d')],'type':_0x5e1a16['type'][_0x1995('0x2e')]};});_0x28d5f5[_0x1995('0x2f')]=_[_0x1995('0x2a')](_0x132c6c,_0x1995('0x28'));_0x28d5f5[_0x1995('0x30')]=_[_0x1995('0x31')](_0x44d6cb[_0x1995('0x30')]);_0x28d5f5[_0x1995('0x32')]=_[_0x1995('0x33')](_0x28d5f5[_0x1995('0x2f')],_0x28d5f5[_0x1995('0x30')]);_0x1a06ce[_0x1995('0x34')]=_['intersection'](_0x28d5f5[_0x1995('0x2f')],qs[_0x1995('0x35')](_0x44d6cb[_0x1995('0x30')][_0x1995('0x35')]));_0x1a06ce[_0x1995('0x34')]=_0x1a06ce['attributes'][_0x1995('0x36')]?_0x1a06ce[_0x1995('0x34')]:_0x28d5f5[_0x1995('0x2f')];if(!_0x44d6cb[_0x1995('0x30')]['hasOwnProperty'](_0x1995('0x37'))){_0x1a06ce[_0x1995('0x1b')]=qs[_0x1995('0x1b')](_0x44d6cb[_0x1995('0x30')]['limit']);_0x1a06ce[_0x1995('0x1d')]=qs[_0x1995('0x1d')](_0x44d6cb['query']['offset']);}_0x1a06ce[_0x1995('0x38')]=qs[_0x1995('0x39')](_0x44d6cb[_0x1995('0x30')]['sort']);_0x1a06ce[_0x1995('0x3a')]=qs[_0x1995('0x32')](_[_0x1995('0x3b')](_0x44d6cb['query'],_0x28d5f5[_0x1995('0x32')]),_0x132c6c);if(_0x44d6cb[_0x1995('0x30')]['filter']){_0x1a06ce['where']=_['merge'](_0x1a06ce[_0x1995('0x3a')],{'$or':_['map'](_0x132c6c,function(_0x40b278){if(_0x40b278[_0x1995('0x3c')]!==_0x1995('0x3d')){var _0xf54a53={};_0xf54a53[_0x40b278[_0x1995('0x28')]]={'$like':'%'+_0x44d6cb[_0x1995('0x30')][_0x1995('0x3e')]+'%'};return _0xf54a53;}})});}_0x1a06ce=_[_0x1995('0x3f')]({},_0x1a06ce,_0x44d6cb[_0x1995('0x40')]);var _0xb0e675={'where':_0x1a06ce[_0x1995('0x3a')]};return db['FaxApplication'][_0x1995('0x1c')](_0xb0e675)[_0x1995('0x24')](function(_0x528a51){_0x5881a2['count']=_0x528a51;if(_0x44d6cb[_0x1995('0x30')]['includeAll']){_0x1a06ce[_0x1995('0x41')]=[{'all':!![]}];}return db[_0x1995('0x2b')][_0x1995('0x42')](_0x1a06ce);})[_0x1995('0x24')](function(_0x524595){_0x5881a2['rows']=_0x524595;return _0x5881a2;})['then'](respondWithFilteredResult(_0x149d2e,_0x1a06ce))[_0x1995('0x43')](handleError(_0x149d2e,null));};exports[_0x1995('0x44')]=function(_0x537a9b,_0x4b4981){var _0x2fb609={'raw':!![],'where':{'id':_0x537a9b[_0x1995('0x45')]['id']}},_0x57705c={};_0x57705c['model']=_[_0x1995('0x31')](db[_0x1995('0x2b')][_0x1995('0x2c')]);_0x57705c[_0x1995('0x30')]=_['keys'](_0x537a9b['query']);_0x57705c[_0x1995('0x32')]=_[_0x1995('0x33')](_0x57705c[_0x1995('0x2f')],_0x57705c['query']);_0x2fb609[_0x1995('0x34')]=_[_0x1995('0x33')](_0x57705c['model'],qs[_0x1995('0x35')](_0x537a9b['query'][_0x1995('0x35')]));_0x2fb609[_0x1995('0x34')]=_0x2fb609[_0x1995('0x34')]['length']?_0x2fb609['attributes']:_0x57705c['model'];if(_0x537a9b['query']['includeAll']){_0x2fb609[_0x1995('0x41')]=[{'all':!![]}];}_0x2fb609=_[_0x1995('0x3f')]({},_0x2fb609,_0x537a9b[_0x1995('0x40')]);return db[_0x1995('0x2b')][_0x1995('0x46')](_0x2fb609)['then'](handleEntityNotFound(_0x4b4981,null))['then'](respondWithResult(_0x4b4981,null))[_0x1995('0x43')](handleError(_0x4b4981,null));};exports[_0x1995('0x47')]=function(_0x531ad8,_0x31aa1c){return db['FaxApplication'][_0x1995('0x47')](_0x531ad8['body'],{})[_0x1995('0x24')](respondWithResult(_0x31aa1c,0xc9))[_0x1995('0x43')](handleError(_0x31aa1c,null));};exports[_0x1995('0x23')]=function(_0x51157c,_0x419746){if(_0x51157c[_0x1995('0x48')]['id']){delete _0x51157c[_0x1995('0x48')]['id'];}return db[_0x1995('0x2b')][_0x1995('0x46')]({'where':{'id':_0x51157c['params']['id']}})[_0x1995('0x24')](handleEntityNotFound(_0x419746,null))[_0x1995('0x24')](saveUpdates(_0x51157c['body'],null))['then'](respondWithResult(_0x419746,null))['catch'](handleError(_0x419746,null));};exports[_0x1995('0x25')]=function(_0x2625a4,_0x209de7){return db[_0x1995('0x2b')][_0x1995('0x46')]({'where':{'id':_0x2625a4[_0x1995('0x45')]['id']}})['then'](handleEntityNotFound(_0x209de7,null))[_0x1995('0x24')](removeEntity(_0x209de7,null))['catch'](handleError(_0x209de7,null));}; \ No newline at end of file +var _0x3759=['fieldName','type','key','model','name','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','include','findAll','rows','catch','show','length','includeAll','find','create','body','params','destroy','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','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','end','sendStatus','error','stack','index','map','FaxApplication'];(function(_0x5b1063,_0x4ab728){var _0x2d31af=function(_0xc2fa16){while(--_0xc2fa16){_0x5b1063['push'](_0x5b1063['shift']());}};_0x2d31af(++_0x4ab728);}(_0x3759,0x10e));var _0x9375=function(_0x5571ef,_0xd22668){_0x5571ef=_0x5571ef-0x0;var _0x2d3eb2=_0x3759[_0x5571ef];return _0x2d3eb2;};'use strict';var emlformat=require(_0x9375('0x0'));var rimraf=require(_0x9375('0x1'));var zipdir=require(_0x9375('0x2'));var jsonpatch=require(_0x9375('0x3'));var rp=require('request-promise');var moment=require(_0x9375('0x4'));var BPromise=require(_0x9375('0x5'));var Mustache=require(_0x9375('0x6'));var util=require(_0x9375('0x7'));var path=require(_0x9375('0x8'));var sox=require(_0x9375('0x9'));var csv=require(_0x9375('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9375('0xb'));var _=require(_0x9375('0xc'));var squel=require(_0x9375('0xd'));var crypto=require(_0x9375('0xe'));var jsforce=require(_0x9375('0xf'));var deskjs=require(_0x9375('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x9375('0x11'));var authService=require(_0x9375('0x12'));var qs=require(_0x9375('0x13'));var as=require(_0x9375('0x14'));var hardwareService=require(_0x9375('0x15'));var logger=require(_0x9375('0x16'))('api');var utils=require(_0x9375('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x9375('0x18'));var db=require(_0x9375('0x19'))['db'];function respondWithStatusCode(_0x163c9c,_0x5bdebe){_0x5bdebe=_0x5bdebe||0xcc;return function(_0x4153cc){if(_0x4153cc){return _0x163c9c['sendStatus'](_0x5bdebe);}return _0x163c9c[_0x9375('0x1a')](_0x5bdebe)['end']();};}function respondWithResult(_0x163e0e,_0x447b52){_0x447b52=_0x447b52||0xc8;return function(_0x1ec9d4){if(_0x1ec9d4){return _0x163e0e['status'](_0x447b52)['json'](_0x1ec9d4);}};}function respondWithFilteredResult(_0x4d1ef0,_0x146fc2){return function(_0x56e86d){if(_0x56e86d){var _0x2e6f2c=typeof _0x146fc2[_0x9375('0x1b')]===_0x9375('0x1c')&&typeof _0x146fc2[_0x9375('0x1d')]==='undefined';var _0x3c051f=_0x56e86d[_0x9375('0x1e')];var _0x3636e4=_0x2e6f2c?0x0:_0x146fc2[_0x9375('0x1b')];var _0x504540=_0x2e6f2c?_0x56e86d[_0x9375('0x1e')]:_0x146fc2[_0x9375('0x1b')]+_0x146fc2[_0x9375('0x1d')];var _0x3fd281;if(_0x504540>=_0x3c051f){_0x504540=_0x3c051f;_0x3fd281=0xc8;}else{_0x3fd281=0xce;}_0x4d1ef0[_0x9375('0x1a')](_0x3fd281);return _0x4d1ef0[_0x9375('0x1f')](_0x9375('0x20'),_0x3636e4+'-'+_0x504540+'/'+_0x3c051f)[_0x9375('0x21')](_0x56e86d);}return null;};}function patchUpdates(_0x25b1c7){return function(_0x1787d4){try{jsonpatch[_0x9375('0x22')](_0x1787d4,_0x25b1c7,!![]);}catch(_0x1da652){return BPromise[_0x9375('0x23')](_0x1da652);}return _0x1787d4[_0x9375('0x24')]();};}function saveUpdates(_0x25587b,_0xdd265e){return function(_0x1287ca){if(_0x1287ca){return _0x1287ca[_0x9375('0x25')](_0x25587b)['then'](function(_0x5907b1){return _0x5907b1;});}return null;};}function removeEntity(_0x3552bf,_0x1eeaee){return function(_0x2899b9){if(_0x2899b9){return _0x2899b9['destroy']()[_0x9375('0x26')](function(){_0x3552bf[_0x9375('0x1a')](0xcc)[_0x9375('0x27')]();});}};}function handleEntityNotFound(_0x5d8bbe,_0x1860c1){return function(_0x39ef8f){if(!_0x39ef8f){_0x5d8bbe[_0x9375('0x28')](0x194);}return _0x39ef8f;};}function handleError(_0x53b684,_0x581dd6){_0x581dd6=_0x581dd6||0x1f4;return function(_0x5de12e){logger[_0x9375('0x29')](_0x5de12e[_0x9375('0x2a')]);if(_0x5de12e['name']){delete _0x5de12e['name'];}_0x53b684['status'](_0x581dd6)['send'](_0x5de12e);};}exports[_0x9375('0x2b')]=function(_0x5cfcff,_0x85b33f){var _0x4dee28={},_0x5b86cf={},_0x2232ca={'count':0x0,'rows':[]};var _0x5cacc2=_[_0x9375('0x2c')](db[_0x9375('0x2d')]['rawAttributes'],function(_0x57a212){return{'name':_0x57a212[_0x9375('0x2e')],'type':_0x57a212[_0x9375('0x2f')][_0x9375('0x30')]};});_0x5b86cf[_0x9375('0x31')]=_['map'](_0x5cacc2,_0x9375('0x32'));_0x5b86cf[_0x9375('0x33')]=_[_0x9375('0x34')](_0x5cfcff[_0x9375('0x33')]);_0x5b86cf[_0x9375('0x35')]=_['intersection'](_0x5b86cf['model'],_0x5b86cf['query']);_0x4dee28[_0x9375('0x36')]=_[_0x9375('0x37')](_0x5b86cf[_0x9375('0x31')],qs['fields'](_0x5cfcff['query'][_0x9375('0x38')]));_0x4dee28[_0x9375('0x36')]=_0x4dee28[_0x9375('0x36')]['length']?_0x4dee28[_0x9375('0x36')]:_0x5b86cf['model'];if(!_0x5cfcff[_0x9375('0x33')][_0x9375('0x39')](_0x9375('0x3a'))){_0x4dee28[_0x9375('0x1d')]=qs[_0x9375('0x1d')](_0x5cfcff[_0x9375('0x33')]['limit']);_0x4dee28[_0x9375('0x1b')]=qs['offset'](_0x5cfcff[_0x9375('0x33')]['offset']);}_0x4dee28[_0x9375('0x3b')]=qs['sort'](_0x5cfcff[_0x9375('0x33')][_0x9375('0x3c')]);_0x4dee28['where']=qs['filters'](_[_0x9375('0x3d')](_0x5cfcff['query'],_0x5b86cf[_0x9375('0x35')]),_0x5cacc2);if(_0x5cfcff[_0x9375('0x33')]['filter']){_0x4dee28[_0x9375('0x3e')]=_[_0x9375('0x3f')](_0x4dee28[_0x9375('0x3e')],{'$or':_[_0x9375('0x2c')](_0x5cacc2,function(_0x37642c){if(_0x37642c[_0x9375('0x2f')]!==_0x9375('0x40')){var _0x5577b1={};_0x5577b1[_0x37642c['name']]={'$like':'%'+_0x5cfcff[_0x9375('0x33')][_0x9375('0x41')]+'%'};return _0x5577b1;}})});}_0x4dee28=_[_0x9375('0x3f')]({},_0x4dee28,_0x5cfcff[_0x9375('0x42')]);var _0xe32db5={'where':_0x4dee28['where']};return db['FaxApplication'][_0x9375('0x1e')](_0xe32db5)[_0x9375('0x26')](function(_0x50bba7){_0x2232ca[_0x9375('0x1e')]=_0x50bba7;if(_0x5cfcff[_0x9375('0x33')]['includeAll']){_0x4dee28[_0x9375('0x43')]=[{'all':!![]}];}return db[_0x9375('0x2d')][_0x9375('0x44')](_0x4dee28);})[_0x9375('0x26')](function(_0x3b9f99){_0x2232ca[_0x9375('0x45')]=_0x3b9f99;return _0x2232ca;})[_0x9375('0x26')](respondWithFilteredResult(_0x85b33f,_0x4dee28))[_0x9375('0x46')](handleError(_0x85b33f,null));};exports[_0x9375('0x47')]=function(_0x7b59d2,_0x95c38a){var _0x140055={'raw':!![],'where':{'id':_0x7b59d2['params']['id']}},_0x33fbd7={};_0x33fbd7[_0x9375('0x31')]=_['keys'](db[_0x9375('0x2d')]['rawAttributes']);_0x33fbd7[_0x9375('0x33')]=_[_0x9375('0x34')](_0x7b59d2[_0x9375('0x33')]);_0x33fbd7['filters']=_[_0x9375('0x37')](_0x33fbd7[_0x9375('0x31')],_0x33fbd7['query']);_0x140055['attributes']=_['intersection'](_0x33fbd7[_0x9375('0x31')],qs['fields'](_0x7b59d2[_0x9375('0x33')][_0x9375('0x38')]));_0x140055[_0x9375('0x36')]=_0x140055[_0x9375('0x36')][_0x9375('0x48')]?_0x140055[_0x9375('0x36')]:_0x33fbd7['model'];if(_0x7b59d2[_0x9375('0x33')][_0x9375('0x49')]){_0x140055[_0x9375('0x43')]=[{'all':!![]}];}_0x140055=_['merge']({},_0x140055,_0x7b59d2[_0x9375('0x42')]);return db['FaxApplication'][_0x9375('0x4a')](_0x140055)[_0x9375('0x26')](handleEntityNotFound(_0x95c38a,null))[_0x9375('0x26')](respondWithResult(_0x95c38a,null))[_0x9375('0x46')](handleError(_0x95c38a,null));};exports['create']=function(_0x51b662,_0x4bec72){return db[_0x9375('0x2d')][_0x9375('0x4b')](_0x51b662[_0x9375('0x4c')],{})[_0x9375('0x26')](respondWithResult(_0x4bec72,0xc9))[_0x9375('0x46')](handleError(_0x4bec72,null));};exports[_0x9375('0x25')]=function(_0x2a7313,_0x1a6fd7){if(_0x2a7313['body']['id']){delete _0x2a7313[_0x9375('0x4c')]['id'];}return db['FaxApplication'][_0x9375('0x4a')]({'where':{'id':_0x2a7313[_0x9375('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1a6fd7,null))['then'](saveUpdates(_0x2a7313[_0x9375('0x4c')],null))[_0x9375('0x26')](respondWithResult(_0x1a6fd7,null))[_0x9375('0x46')](handleError(_0x1a6fd7,null));};exports[_0x9375('0x4e')]=function(_0x5f0d85,_0x2702bf){return db[_0x9375('0x2d')][_0x9375('0x4a')]({'where':{'id':_0x5f0d85[_0x9375('0x4d')]['id']}})[_0x9375('0x26')](handleEntityNotFound(_0x2702bf,null))['then'](removeEntity(_0x2702bf,null))[_0x9375('0x46')](handleError(_0x2702bf,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 21c8c7c..5929623 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 _0x3667=['fax_applications','utf8mb4','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./faxApplication.attributes','exports','define','FaxApplication'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x3667,0x161));var _0x7366=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3667[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x7366('0x0'));var logger=require(_0x7366('0x1'))('api');var moment=require(_0x7366('0x2'));var BPromise=require(_0x7366('0x3'));var rp=require(_0x7366('0x4'));var fs=require('fs');var path=require(_0x7366('0x5'));var rimraf=require('rimraf');var config=require(_0x7366('0x6'));var attributes=require(_0x7366('0x7'));module[_0x7366('0x8')]=function(_0x64c61e,_0x1ed803){return _0x64c61e[_0x7366('0x9')](_0x7366('0xa'),attributes,{'tableName':_0x7366('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7366('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xf3e2=['./faxApplication.attributes','exports','define','FaxApplication','fax_applications','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment'];(function(_0xa7bbd0,_0x28c3f9){var _0x5e059c=function(_0x29eec2){while(--_0x29eec2){_0xa7bbd0['push'](_0xa7bbd0['shift']());}};_0x5e059c(++_0x28c3f9);}(_0xf3e2,0xc8));var _0x2f3e=function(_0x299f5c,_0x5738dd){_0x299f5c=_0x299f5c-0x0;var _0x5da026=_0xf3e2[_0x299f5c];return _0x5da026;};'use strict';var _=require(_0x2f3e('0x0'));var util=require(_0x2f3e('0x1'));var logger=require(_0x2f3e('0x2'))(_0x2f3e('0x3'));var moment=require(_0x2f3e('0x4'));var BPromise=require(_0x2f3e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x2f3e('0x6'));var config=require(_0x2f3e('0x7'));var attributes=require(_0x2f3e('0x8'));module[_0x2f3e('0x9')]=function(_0x575f92,_0x4c5db4){return _0x575f92[_0x2f3e('0xa')](_0x2f3e('0xb'),attributes,{'tableName':_0x2f3e('0xc'),'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 0b1b360..0358a1d 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 _0x885f=['catch','UpdateFaxApplication','FaxApplication','update','body','options','attributes','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x46f92a,_0x24ea6d){var _0x429b37=function(_0x148c4d){while(--_0x148c4d){_0x46f92a['push'](_0x46f92a['shift']());}};_0x429b37(++_0x24ea6d);}(_0x885f,0x18d));var _0xf885=function(_0x5ce6e7,_0x485dd3){_0x5ce6e7=_0x5ce6e7-0x0;var _0x2248dc=_0x885f[_0x5ce6e7];return _0x2248dc;};'use strict';var _=require('lodash');var util=require(_0xf885('0x0'));var moment=require(_0xf885('0x1'));var BPromise=require(_0xf885('0x2'));var rs=require(_0xf885('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf885('0x4'))['db'];var utils=require(_0xf885('0x5'));var logger=require(_0xf885('0x6'))(_0xf885('0x7'));var config=require(_0xf885('0x8'));var jayson=require(_0xf885('0x9'));var client=jayson[_0xf885('0xa')][_0xf885('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x26804d,_0x5dffd7,_0x3a398f){return new BPromise(function(_0x55af57,_0x3b312f){return client['request'](_0x26804d,_0x3a398f)[_0xf885('0xc')](function(_0x5007dc){logger[_0xf885('0xd')](_0xf885('0xe'),_0x5dffd7,_0xf885('0xf'));logger[_0xf885('0x10')](_0xf885('0x11'),_0x5dffd7,_0xf885('0xf'),JSON[_0xf885('0x12')](_0x5007dc));if(_0x5007dc[_0xf885('0x13')]){if(_0x5007dc[_0xf885('0x13')][_0xf885('0x14')]===0x1f4){logger[_0xf885('0x13')](_0xf885('0xe'),_0x5dffd7,_0x5007dc[_0xf885('0x13')][_0xf885('0x15')]);return _0x3b312f(_0x5007dc['error'][_0xf885('0x15')]);}logger[_0xf885('0x13')]('FaxApplication,\x20%s,\x20%s',_0x5dffd7,_0x5007dc[_0xf885('0x13')]['message']);return _0x55af57(_0x5007dc[_0xf885('0x13')][_0xf885('0x15')]);}else{logger[_0xf885('0xd')](_0xf885('0xe'),_0x5dffd7,_0xf885('0xf'));_0x55af57(_0x5007dc[_0xf885('0x16')][_0xf885('0x15')]);}})[_0xf885('0x17')](function(_0x30570b){logger[_0xf885('0x13')](_0xf885('0xe'),_0x5dffd7,_0x30570b);_0x3b312f(_0x30570b);});});}exports[_0xf885('0x18')]=function(_0x180914){var _0x1b94ca=this;return new Promise(function(_0x18413a,_0x43f652){return db[_0xf885('0x19')][_0xf885('0x1a')](_0x180914[_0xf885('0x1b')],{'raw':_0x180914[_0xf885('0x1c')]?_0x180914['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x180914[_0xf885('0x1c')]?_0x180914['options']['where']||null:null,'attributes':_0x180914[_0xf885('0x1c')]?_0x180914[_0xf885('0x1c')][_0xf885('0x1d')]||null:null,'limit':_0x180914['options']?_0x180914[_0xf885('0x1c')]['limit']||null:null})[_0xf885('0xc')](function(_0xd24401){logger[_0xf885('0xd')](_0xf885('0x18'),_0x180914);logger[_0xf885('0x10')](_0xf885('0x18'),_0x180914,JSON[_0xf885('0x12')](_0xd24401));_0x18413a(_0xd24401);})[_0xf885('0x17')](function(_0x5620cc){logger[_0xf885('0x13')](_0xf885('0x18'),_0x5620cc['message'],_0x180914);_0x43f652(_0x1b94ca[_0xf885('0x13')](0x1f4,_0x5620cc[_0xf885('0x15')]));});});}; \ No newline at end of file +var _0xc6e9=['FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','error','code','message','catch','UpdateFaxApplication','update','options','raw','where','attributes','limit','stringify','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info'];(function(_0x121f35,_0x5900cd){var _0x365177=function(_0x5a9952){while(--_0x5a9952){_0x121f35['push'](_0x121f35['shift']());}};_0x365177(++_0x5900cd);}(_0xc6e9,0x67));var _0x9c6e=function(_0x50bb38,_0x488c5f){_0x50bb38=_0x50bb38-0x0;var _0x54f944=_0xc6e9[_0x50bb38];return _0x54f944;};'use strict';var _=require(_0x9c6e('0x0'));var util=require(_0x9c6e('0x1'));var moment=require('moment');var BPromise=require(_0x9c6e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9c6e('0x3'));var db=require(_0x9c6e('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9c6e('0x5'))(_0x9c6e('0x6'));var config=require(_0x9c6e('0x7'));var jayson=require(_0x9c6e('0x8'));var client=jayson[_0x9c6e('0x9')][_0x9c6e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xbccefe,_0x53b598,_0x24889d){return new BPromise(function(_0xad0f,_0xc5d011){return client['request'](_0xbccefe,_0x24889d)[_0x9c6e('0xb')](function(_0x4bf74c){logger[_0x9c6e('0xc')](_0x9c6e('0xd'),_0x53b598,_0x9c6e('0xe'));logger[_0x9c6e('0xf')](_0x9c6e('0x10'),_0x53b598,_0x9c6e('0xe'),JSON['stringify'](_0x4bf74c));if(_0x4bf74c['error']){if(_0x4bf74c[_0x9c6e('0x11')][_0x9c6e('0x12')]===0x1f4){logger[_0x9c6e('0x11')](_0x9c6e('0xd'),_0x53b598,_0x4bf74c[_0x9c6e('0x11')][_0x9c6e('0x13')]);return _0xc5d011(_0x4bf74c['error'][_0x9c6e('0x13')]);}logger[_0x9c6e('0x11')](_0x9c6e('0xd'),_0x53b598,_0x4bf74c[_0x9c6e('0x11')][_0x9c6e('0x13')]);return _0xad0f(_0x4bf74c[_0x9c6e('0x11')][_0x9c6e('0x13')]);}else{logger[_0x9c6e('0xc')](_0x9c6e('0xd'),_0x53b598,_0x9c6e('0xe'));_0xad0f(_0x4bf74c['result'][_0x9c6e('0x13')]);}})[_0x9c6e('0x14')](function(_0x1bf9f2){logger[_0x9c6e('0x11')](_0x9c6e('0xd'),_0x53b598,_0x1bf9f2);_0xc5d011(_0x1bf9f2);});});}exports[_0x9c6e('0x15')]=function(_0x1f033a){var _0x9ac62f=this;return new Promise(function(_0x3cc8e4,_0x5cd7e4){return db['FaxApplication'][_0x9c6e('0x16')](_0x1f033a['body'],{'raw':_0x1f033a[_0x9c6e('0x17')]?_0x1f033a[_0x9c6e('0x17')][_0x9c6e('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1f033a[_0x9c6e('0x17')]?_0x1f033a[_0x9c6e('0x17')][_0x9c6e('0x19')]||null:null,'attributes':_0x1f033a[_0x9c6e('0x17')]?_0x1f033a['options'][_0x9c6e('0x1a')]||null:null,'limit':_0x1f033a[_0x9c6e('0x17')]?_0x1f033a[_0x9c6e('0x17')][_0x9c6e('0x1b')]||null:null})[_0x9c6e('0xb')](function(_0x40dc40){logger[_0x9c6e('0xc')]('UpdateFaxApplication',_0x1f033a);logger['debug'](_0x9c6e('0x15'),_0x1f033a,JSON[_0x9c6e('0x1c')](_0x40dc40));_0x3cc8e4(_0x40dc40);})[_0x9c6e('0x14')](function(_0x37ae9f){logger['error'](_0x9c6e('0x15'),_0x37ae9f[_0x9c6e('0x13')],_0x1f033a);_0x5cd7e4(_0x9ac62f[_0x9c6e('0x11')](0x1f4,_0x37ae9f['message']));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 4b6cc0c..746b0f8 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 _0xdd4f=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','create','put','delete','destroy','exports','multer','express'];(function(_0x511f01,_0x32ca2c){var _0x37fc90=function(_0x1c6487){while(--_0x1c6487){_0x511f01['push'](_0x511f01['shift']());}};_0x37fc90(++_0x32ca2c);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x52382b,_0x469771){_0x52382b=_0x52382b-0x0;var _0x47f436=_0xdd4f[_0x52382b];return _0x47f436;};'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('./faxApplication.controller');router[_0xfdd4('0x6')]('/',auth[_0xfdd4('0x7')](),controller[_0xfdd4('0x8')]);router[_0xfdd4('0x6')](_0xfdd4('0x9'),auth['isAuthenticated'](),controller[_0xfdd4('0xa')]);router['post']('/',auth[_0xfdd4('0x7')](),controller[_0xfdd4('0xb')]);router[_0xfdd4('0xc')]('/:id',auth[_0xfdd4('0x7')](),controller['update']);router[_0xfdd4('0xd')](_0xfdd4('0x9'),auth[_0xfdd4('0x7')](),controller[_0xfdd4('0xe')]);module[_0xfdd4('0xf')]=router; \ No newline at end of file +var _0xb62e=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','isAuthenticated','index','get','show','post','/:id','update','delete','destroy','exports','multer','util'];(function(_0x1b8992,_0x1ddeba){var _0x3c0165=function(_0x5d860e){while(--_0x5d860e){_0x1b8992['push'](_0x1b8992['shift']());}};_0x3c0165(++_0x1ddeba);}(_0xb62e,0x1de));var _0xeb62=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xb62e[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require(_0xeb62('0x0'));var util=require(_0xeb62('0x1'));var path=require(_0xeb62('0x2'));var timeout=require(_0xeb62('0x3'));var express=require('express');var router=express[_0xeb62('0x4')]();var fs_extra=require(_0xeb62('0x5'));var auth=require(_0xeb62('0x6'));var interaction=require(_0xeb62('0x7'));var config=require(_0xeb62('0x8'));var controller=require(_0xeb62('0x9'));router['get']('/',auth[_0xeb62('0xa')](),controller[_0xeb62('0xb')]);router[_0xeb62('0xc')]('/:id',auth[_0xeb62('0xa')](),controller[_0xeb62('0xd')]);router[_0xeb62('0xe')]('/',auth[_0xeb62('0xa')](),controller['create']);router['put'](_0xeb62('0xf'),auth[_0xeb62('0xa')](),controller[_0xeb62('0x10')]);router[_0xeb62('0x11')](_0xeb62('0xf'),auth[_0xeb62('0xa')](),controller[_0xeb62('0x12')]);module[_0xeb62('0x13')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index fd522fd..978174a 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 _0x01d9=['STRING','ENUM','out','INTEGER','sequelize','exports','BOOLEAN','DATE'];(function(_0xbec8e6,_0x2841b5){var _0x4aa6f2=function(_0x583a0a){while(--_0x583a0a){_0xbec8e6['push'](_0xbec8e6['shift']());}};_0x4aa6f2(++_0x2841b5);}(_0x01d9,0x6c));var _0x901d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x01d9[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x901d('0x0'));module[_0x901d('0x1')]={'closed':{'type':Sequelize[_0x901d('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x901d('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x901d('0x4')]},'thirdDisposition':{'type':Sequelize[_0x901d('0x4')]},'note':{'type':Sequelize[_0x901d('0x4')]},'read1stAt':{'type':Sequelize[_0x901d('0x3')]},'fax':{'type':Sequelize[_0x901d('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x901d('0x5')]('in',_0x901d('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x901d('0x5')]('in',_0x901d('0x6')),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0x901d('0x7')]}}; \ No newline at end of file +var _0x4b17=['STRING','ENUM','out','DATE','INTEGER','sequelize','BOOLEAN'];(function(_0x12704a,_0x51c538){var _0x46e6ee=function(_0x5e8bc6){while(--_0x5e8bc6){_0x12704a['push'](_0x12704a['shift']());}};_0x46e6ee(++_0x51c538);}(_0x4b17,0x10f));var _0x74b1=function(_0x44b7d6,_0x4a3f3f){_0x44b7d6=_0x44b7d6-0x0;var _0x5346f0=_0x4b17[_0x44b7d6];return _0x5346f0;};'use strict';var Sequelize=require(_0x74b1('0x0'));module['exports']={'closed':{'type':Sequelize[_0x74b1('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x74b1('0x2')]},'secondDisposition':{'type':Sequelize[_0x74b1('0x2')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x74b1('0x2')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize[_0x74b1('0x3')]('in',_0x74b1('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x74b1('0x5')]},'lastMsgDirection':{'type':Sequelize[_0x74b1('0x3')]('in',_0x74b1('0x4')),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0x74b1('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index 7d63ad4..3cafa0d 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 _0xbf95=['Tag','color','emit','faxInteractionTags:save','removeTags','download','unix','toString','join','root','files','tmp','attachments','transcript-%d-%s.zip','Attachment','Messages','mkdirSync','basename','existsSync','pipe','createWriteStream','resolve','log','err','unlinkSync','moment','util','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','../../mysqldb','redis','defaults','socket.io-emitter','./faxInteraction.socket','status','json','undefined','limit','count','offset','Content-Range','then','destroy','end','sendStatus','stack','name','send','index','map','FaxInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','fax','user','catch','show','params','model','query','intersection','attributes','fields','include','merge','find','create','body','update','describe','addMessage','ids','omit','findOne','keys','FaxMessage','filters','hasOwnProperty','order','sort','FaxInteractionId','filter','where','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','options','rows','addTags','setTags','spread'];(function(_0x332d5c,_0x4a2336){var _0x47448d=function(_0x4a00f6){while(--_0x4a00f6){_0x332d5c['push'](_0x332d5c['shift']());}};_0x47448d(++_0x4a2336);}(_0xbf95,0x7d));var _0x5bf9=function(_0x53d7a3,_0x4f8cbe){_0x53d7a3=_0x53d7a3-0x0;var _0x4469cc=_0xbf95[_0x53d7a3];return _0x4469cc;};'use strict';var rimraf=require('rimraf');var zipdir=require('zip-dir');var moment=require(_0x5bf9('0x0'));var BPromise=require('bluebird');var util=require(_0x5bf9('0x1'));var path=require(_0x5bf9('0x2'));var fs=require('fs');var _=require(_0x5bf9('0x3'));var Redis=require(_0x5bf9('0x4'));var interaction=require(_0x5bf9('0x5'));var qs=require(_0x5bf9('0x6'));var logger=require(_0x5bf9('0x7'))('api');var config=require('../../config/environment');var db=require(_0x5bf9('0x8'))['db'];config[_0x5bf9('0x9')]=_[_0x5bf9('0xa')](config[_0x5bf9('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x5bf9('0xb'))(new Redis(config[_0x5bf9('0x9')]));require(_0x5bf9('0xc'))['register'](socket);function respondWithStatusCode(_0x40a691,_0x14cf34){_0x14cf34=_0x14cf34||0xcc;return function(_0x1a65eb){if(_0x1a65eb){return _0x40a691['sendStatus'](_0x14cf34);}return _0x40a691['status'](_0x14cf34)['end']();};}function respondWithResult(_0x23f722,_0x3d02e1){_0x3d02e1=_0x3d02e1||0xc8;return function(_0x4fd696){if(_0x4fd696){return _0x23f722[_0x5bf9('0xd')](_0x3d02e1)[_0x5bf9('0xe')](_0x4fd696);}};}function respondWithFilteredResult(_0x99f4b1,_0x5b1a10){return function(_0x15f6ce){if(_0x15f6ce){var _0x40ec8=typeof _0x5b1a10['offset']===_0x5bf9('0xf')&&typeof _0x5b1a10[_0x5bf9('0x10')]==='undefined';var _0x17b39b=_0x15f6ce[_0x5bf9('0x11')];var _0x34c041=_0x40ec8?0x0:_0x5b1a10[_0x5bf9('0x12')];var _0x4ad275=_0x40ec8?_0x15f6ce[_0x5bf9('0x11')]:_0x5b1a10['offset']+_0x5b1a10[_0x5bf9('0x10')];var _0x2f725f;if(_0x4ad275>=_0x17b39b){_0x4ad275=_0x17b39b;_0x2f725f=0xc8;}else{_0x2f725f=0xce;}_0x99f4b1['status'](_0x2f725f);return _0x99f4b1['set'](_0x5bf9('0x13'),_0x34c041+'-'+_0x4ad275+'/'+_0x17b39b)[_0x5bf9('0xe')](_0x15f6ce);}return null;};}function saveUpdates(_0x48f19b){return function(_0x4983e6){if(_0x4983e6){return _0x4983e6['update'](_0x48f19b)[_0x5bf9('0x14')](function(_0x13445b){return _0x13445b;});}return null;};}function removeEntity(_0x11109c){return function(_0x398910){if(_0x398910){return _0x398910[_0x5bf9('0x15')]()[_0x5bf9('0x14')](function(){_0x11109c[_0x5bf9('0xd')](0xcc)[_0x5bf9('0x16')]();});}};}function handleEntityNotFound(_0x24ae4c){return function(_0x49e705){if(!_0x49e705){_0x24ae4c[_0x5bf9('0x17')](0x194);}return _0x49e705;};}function handleError(_0x5c129f,_0x17b3b6){_0x17b3b6=_0x17b3b6||0x1f4;return function(_0x543a18){logger['error'](_0x543a18[_0x5bf9('0x18')]);if(_0x543a18[_0x5bf9('0x19')]){delete _0x543a18[_0x5bf9('0x19')];}_0x5c129f[_0x5bf9('0xd')](_0x17b3b6)[_0x5bf9('0x1a')](_0x543a18);};}exports[_0x5bf9('0x1b')]=function(_0x496bdc,_0xaba355){var _0x4b3d17={};var _0x327641=_[_0x5bf9('0x1c')](db[_0x5bf9('0x1d')][_0x5bf9('0x1e')],function(_0x1cb7ff){return{'name':_0x1cb7ff[_0x5bf9('0x1f')],'type':_0x1cb7ff[_0x5bf9('0x20')][_0x5bf9('0x21')]};});_0x4b3d17=qs[_0x5bf9('0x22')](_0x327641,_0x496bdc);return interaction[_0x5bf9('0x23')](_0x5bf9('0x24'),_0x496bdc['query'],_0x496bdc[_0x5bf9('0x25')],_0x4b3d17,_0x327641)[_0x5bf9('0x14')](respondWithFilteredResult(_0xaba355,_0x4b3d17))[_0x5bf9('0x26')](handleError(_0xaba355,null));};exports[_0x5bf9('0x27')]=function(_0x2661b0,_0x389cb3){var _0x44dffe={'raw':![],'where':{'id':_0x2661b0[_0x5bf9('0x28')]['id']}},_0x4e8542={};_0x4e8542[_0x5bf9('0x29')]=_['keys'](db[_0x5bf9('0x1d')]['rawAttributes']);_0x4e8542[_0x5bf9('0x2a')]=_['keys'](_0x2661b0[_0x5bf9('0x2a')]);_0x4e8542['filters']=_[_0x5bf9('0x2b')](_0x4e8542[_0x5bf9('0x29')],_0x4e8542['query']);_0x44dffe[_0x5bf9('0x2c')]=_[_0x5bf9('0x2b')](_0x4e8542[_0x5bf9('0x29')],qs[_0x5bf9('0x2d')](_0x2661b0[_0x5bf9('0x2a')]['fields']));_0x44dffe[_0x5bf9('0x2c')]=_0x44dffe[_0x5bf9('0x2c')]['length']?_0x44dffe[_0x5bf9('0x2c')]:_0x4e8542['model'];if(_0x2661b0['query']['includeAll']){_0x44dffe[_0x5bf9('0x2e')]=[{'all':!![]}];}_0x44dffe=_[_0x5bf9('0x2f')]({},_0x44dffe,_0x2661b0['options']);return db[_0x5bf9('0x1d')][_0x5bf9('0x30')](_0x44dffe)[_0x5bf9('0x14')](handleEntityNotFound(_0x389cb3,null))[_0x5bf9('0x14')](respondWithResult(_0x389cb3,null))['catch'](handleError(_0x389cb3,null));};exports[_0x5bf9('0x31')]=function(_0x454f85,_0x16465e){return db[_0x5bf9('0x1d')][_0x5bf9('0x31')](_0x454f85[_0x5bf9('0x32')],{})['then'](respondWithResult(_0x16465e,0xc9))[_0x5bf9('0x26')](handleError(_0x16465e,null));};exports[_0x5bf9('0x33')]=function(_0x275e06,_0x5a8862){if(_0x275e06[_0x5bf9('0x32')]['id']){delete _0x275e06['body']['id'];}return db[_0x5bf9('0x1d')][_0x5bf9('0x30')]({'where':{'id':_0x275e06[_0x5bf9('0x28')]['id']}})[_0x5bf9('0x14')](handleEntityNotFound(_0x5a8862,null))[_0x5bf9('0x14')](saveUpdates(_0x275e06[_0x5bf9('0x32')],null))[_0x5bf9('0x14')](respondWithResult(_0x5a8862,null))[_0x5bf9('0x26')](handleError(_0x5a8862,null));};exports[_0x5bf9('0x15')]=function(_0x92567,_0xade8f5){return db['FaxInteraction'][_0x5bf9('0x30')]({'where':{'id':_0x92567[_0x5bf9('0x28')]['id']}})[_0x5bf9('0x14')](handleEntityNotFound(_0xade8f5,null))[_0x5bf9('0x14')](removeEntity(_0xade8f5,null))[_0x5bf9('0x26')](handleError(_0xade8f5,null));};exports[_0x5bf9('0x34')]=function(_0x5c17f1,_0x555861){return db[_0x5bf9('0x1d')][_0x5bf9('0x34')]()[_0x5bf9('0x14')](respondWithResult(_0x555861,null))[_0x5bf9('0x26')](handleError(_0x555861,null));};exports[_0x5bf9('0x35')]=function(_0xc3dd8a,_0x1f839e){return db['FaxMessage'][_0x5bf9('0x30')]({'where':{'id':_0xc3dd8a[_0x5bf9('0x28')]['id']}})[_0x5bf9('0x14')](handleEntityNotFound(_0x1f839e,null))[_0x5bf9('0x14')](function(_0x3292f0){if(_0x3292f0){return _0x3292f0['addMessage'](_0xc3dd8a[_0x5bf9('0x32')][_0x5bf9('0x36')],_[_0x5bf9('0x37')](_0xc3dd8a[_0x5bf9('0x32')],[_0x5bf9('0x36'),'id'])||{});}})[_0x5bf9('0x14')](respondWithResult(_0x1f839e,null))[_0x5bf9('0x26')](handleError(_0x1f839e,null));};exports['getMessages']=function(_0x314ff4,_0x26c6f2){var _0x3f1c25={'raw':![],'where':{}};var _0x5b8bfb={};var _0x114575={'count':0x0,'rows':[]};return db[_0x5bf9('0x1d')][_0x5bf9('0x38')]({'where':{'id':_0x314ff4[_0x5bf9('0x28')]['id']}})[_0x5bf9('0x14')](handleEntityNotFound(_0x26c6f2,null))[_0x5bf9('0x14')](function(_0x3b8dd6){if(_0x3b8dd6){_0x5b8bfb['model']=_[_0x5bf9('0x39')](db[_0x5bf9('0x3a')][_0x5bf9('0x1e')]);_0x5b8bfb[_0x5bf9('0x2a')]=_['keys'](_0x314ff4[_0x5bf9('0x2a')]);_0x5b8bfb[_0x5bf9('0x3b')]=_['intersection'](_0x5b8bfb['model'],_0x5b8bfb[_0x5bf9('0x2a')]);_0x3f1c25['attributes']=_[_0x5bf9('0x2b')](_0x5b8bfb[_0x5bf9('0x29')],qs[_0x5bf9('0x2d')](_0x314ff4[_0x5bf9('0x2a')][_0x5bf9('0x2d')]));_0x3f1c25[_0x5bf9('0x2c')]=_0x3f1c25['attributes']['length']?_0x3f1c25[_0x5bf9('0x2c')]:_0x5b8bfb['model'];if(!_0x314ff4[_0x5bf9('0x2a')][_0x5bf9('0x3c')]('nolimit')){_0x3f1c25[_0x5bf9('0x10')]=qs[_0x5bf9('0x10')](_0x314ff4[_0x5bf9('0x2a')][_0x5bf9('0x10')]);_0x3f1c25[_0x5bf9('0x12')]=qs[_0x5bf9('0x12')](_0x314ff4[_0x5bf9('0x2a')][_0x5bf9('0x12')]);}_0x3f1c25[_0x5bf9('0x3d')]=qs[_0x5bf9('0x3e')](_0x314ff4[_0x5bf9('0x2a')][_0x5bf9('0x3e')]);_0x3f1c25['where']=qs['filters'](_['pick'](_0x314ff4[_0x5bf9('0x2a')],_0x5b8bfb[_0x5bf9('0x3b')]));_0x3f1c25['where'][_0x5bf9('0x3f')]=_0x3b8dd6['id'];if(_0x314ff4[_0x5bf9('0x2a')][_0x5bf9('0x40')]){_0x3f1c25[_0x5bf9('0x41')]=_[_0x5bf9('0x2f')](_0x3f1c25[_0x5bf9('0x41')],{'$or':_[_0x5bf9('0x1c')](_0x3f1c25['attributes'],function(_0x418217){var _0x3ab5c0={};_0x3ab5c0[_0x418217]={'$like':'%'+_0x314ff4[_0x5bf9('0x2a')][_0x5bf9('0x40')]+'%'};return _0x3ab5c0;})});}if(_0x314ff4[_0x5bf9('0x2a')][_0x5bf9('0x42')]){var _0x1afecc=_0x314ff4[_0x5bf9('0x2a')][_0x5bf9('0x42')][_0x5bf9('0x43')](',');var _0xc27533={};_0xc27533[_0x1afecc[0x0]]={'$gte':moment(_0x1afecc[0x1])[_0x5bf9('0x44')](_0x5bf9('0x45'))};_0x3f1c25[_0x5bf9('0x41')]=_[_0x5bf9('0x2f')](_0x3f1c25[_0x5bf9('0x41')],_0xc27533);}_0x3f1c25=_['merge']({},_0x3f1c25,_0x314ff4[_0x5bf9('0x46')]);return db[_0x5bf9('0x3a')][_0x5bf9('0x11')]({'where':_0x3f1c25[_0x5bf9('0x41')]})['then'](function(_0x5e11ff){_0x114575[_0x5bf9('0x11')]=_0x5e11ff;if(_0x314ff4[_0x5bf9('0x2a')]['includeAll']){_0x3f1c25[_0x5bf9('0x2e')]=[{'all':!![]}];}return db[_0x5bf9('0x3a')]['findAll'](_0x3f1c25);})['then'](function(_0x2119d2){_0x114575[_0x5bf9('0x47')]=_0x2119d2;return _0x114575;});}})[_0x5bf9('0x14')](respondWithFilteredResult(_0x26c6f2,_0x3f1c25))['catch'](handleError(_0x26c6f2,null));};exports[_0x5bf9('0x48')]=function(_0x15ab07,_0x2a9ab5){return db[_0x5bf9('0x1d')]['find']({'where':{'id':_0x15ab07[_0x5bf9('0x28')]['id']}})[_0x5bf9('0x14')](handleEntityNotFound(_0x2a9ab5,null))['then'](function(_0x2d57cb){if(_0x2d57cb){return _0x2d57cb[_0x5bf9('0x49')](_0x15ab07['body'][_0x5bf9('0x36')],_['omit'](_0x15ab07[_0x5bf9('0x32')],['ids','id'])||{})[_0x5bf9('0x4a')](function(){return db[_0x5bf9('0x4b')][_0x5bf9('0x23')]({'attributes':['id',_0x5bf9('0x19'),_0x5bf9('0x4c')],'where':{'id':_0x15ab07[_0x5bf9('0x32')][_0x5bf9('0x36')]}});})['then'](function(_0x3b05b9){socket[_0x5bf9('0x4d')](_0x5bf9('0x4e'),{'id':Number(_0x15ab07[_0x5bf9('0x28')]['id']),'tags':_0x3b05b9||[]});return{'id':Number(_0x15ab07[_0x5bf9('0x28')]['id']),'tags':_0x3b05b9||[]};});}})[_0x5bf9('0x14')](respondWithResult(_0x2a9ab5,null))[_0x5bf9('0x26')](handleError(_0x2a9ab5,null));};exports[_0x5bf9('0x4f')]=function(_0x1f0f8e,_0x2dad92){return db[_0x5bf9('0x1d')][_0x5bf9('0x30')]({'where':{'id':_0x1f0f8e[_0x5bf9('0x28')]['id']}})[_0x5bf9('0x14')](handleEntityNotFound(_0x2dad92,null))[_0x5bf9('0x14')](function(_0x9b9d26){if(_0x9b9d26){return _0x9b9d26[_0x5bf9('0x4f')](_0x1f0f8e['query'][_0x5bf9('0x36')]);}})['then'](respondWithStatusCode(_0x2dad92,null))['catch'](handleError(_0x2dad92,null));};exports[_0x5bf9('0x50')]=function(_0x4f4437,_0x41a6ff){var _0x5b6483=moment()[_0x5bf9('0x51')]()[_0x5bf9('0x52')]();var _0x1876cd=path[_0x5bf9('0x53')](config[_0x5bf9('0x54')],'server',_0x5bf9('0x55'),_0x5bf9('0x56'));var _0x201f98=path[_0x5bf9('0x53')](config['root'],'server',_0x5bf9('0x55'),_0x5bf9('0x57'));var _0x1ec259=path[_0x5bf9('0x53')](_0x1876cd,_0x5b6483);var _0x52d662=util['format'](_0x5bf9('0x58'),_0x4f4437['params']['id'],_0x5b6483);var _0x2e20ad=path['join'](_0x1876cd,_0x52d662);var _0x17d437=[];_0x17d437['push']({'model':db[_0x5bf9('0x59')],'as':'Attachment','raw':!![]});var _0x245c1d=[{'model':db[_0x5bf9('0x3a')],'as':_0x5bf9('0x5a'),'attributes':['id',_0x5bf9('0x32'),'createdAt'],'include':_0x17d437}];return db[_0x5bf9('0x1d')][_0x5bf9('0x30')]({'where':{'id':_0x4f4437[_0x5bf9('0x28')]['id']},'include':_0x245c1d})[_0x5bf9('0x14')](handleEntityNotFound(_0x41a6ff,null))[_0x5bf9('0x14')](function(_0x56029c){if(_0x56029c&&_0x56029c[_0x5bf9('0x5a')]){var _0x5c1371=_0x56029c['get']({'plain':!![]});fs[_0x5bf9('0x5b')](_0x1ec259);for(var _0x436f73=0x0;_0x436f73<_0x5c1371[_0x5bf9('0x5a')]['length'];_0x436f73++){var _0x3e5579=_0x5c1371[_0x5bf9('0x5a')][_0x436f73][_0x5bf9('0x59')];if(_0x3e5579){var _0x435397=path[_0x5bf9('0x53')](_0x201f98,_0x3e5579[_0x5bf9('0x5c')]);if(fs[_0x5bf9('0x5d')](_0x435397)){fs['createReadStream'](_0x435397)[_0x5bf9('0x5e')](fs[_0x5bf9('0x5f')](path[_0x5bf9('0x53')](_0x1ec259,_0x3e5579[_0x5bf9('0x5c')])));}}}return BPromise[_0x5bf9('0x60')]()[_0x5bf9('0x14')](function(){return new BPromise(function(_0x3556c3,_0x2b8df7){zipdir(_0x1ec259,{'saveTo':_0x2e20ad},function(_0x2b36e6,_0xfce1fa){if(_0x2b36e6)return _0x2b8df7(_0x2b36e6);return _0x3556c3(_0xfce1fa);});})[_0x5bf9('0x14')](function(){return new BPromise(function(_0x1f38bd,_0x117f2f){rimraf(_0x1ec259,function(_0x37a4ef){if(_0x37a4ef)_0x117f2f(_0x37a4ef);return _0x1f38bd();});});})[_0x5bf9('0x14')](function(){return _0x41a6ff['download'](_0x2e20ad,_0x52d662,function(_0x54f16d){if(_0x54f16d){console[_0x5bf9('0x61')](_0x5bf9('0x62'),_0x54f16d);}else{fs[_0x5bf9('0x63')](_0x2e20ad);}});});});}else{return _0x41a6ff[_0x5bf9('0x17')](0xc8);}})['catch'](handleError(_0x41a6ff,null));}; \ No newline at end of file +var _0x351f=['sort','where','FaxInteractionId','filter','merge','map','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','setTags','spread','Tag','color','faxInteractionTags:save','download','toString','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','push','Attachment','Messages','createdAt','get','mkdirSync','basename','createReadStream','pipe','createWriteStream','resolve','log','err','unlinkSync','rimraf','zip-dir','bluebird','util','path','lodash','../../components/interaction/service','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','json','offset','undefined','count','Content-Range','update','then','destroy','end','error','stack','name','send','index','FaxInteraction','rawAttributes','type','key','getOptions','findAll','fax','query','user','catch','show','params','model','keys','filters','intersection','fields','attributes','includeAll','include','options','create','body','find','describe','FaxMessage','ids','omit','getMessages','findOne','length','hasOwnProperty','limit','order'];(function(_0x15f258,_0xa128b6){var _0x3decc4=function(_0x1ef7a4){while(--_0x1ef7a4){_0x15f258['push'](_0x15f258['shift']());}};_0x3decc4(++_0xa128b6);}(_0x351f,0x1cf));var _0xf351=function(_0x180834,_0x890002){_0x180834=_0x180834-0x0;var _0x19f860=_0x351f[_0x180834];return _0x19f860;};'use strict';var rimraf=require(_0xf351('0x0'));var zipdir=require(_0xf351('0x1'));var moment=require('moment');var BPromise=require(_0xf351('0x2'));var util=require(_0xf351('0x3'));var path=require(_0xf351('0x4'));var fs=require('fs');var _=require(_0xf351('0x5'));var Redis=require('ioredis');var interaction=require(_0xf351('0x6'));var qs=require(_0xf351('0x7'));var logger=require(_0xf351('0x8'))('api');var config=require(_0xf351('0x9'));var db=require(_0xf351('0xa'))['db'];config[_0xf351('0xb')]=_[_0xf351('0xc')](config[_0xf351('0xb')],{'host':_0xf351('0xd'),'port':0x18eb});var socket=require(_0xf351('0xe'))(new Redis(config['redis']));require(_0xf351('0xf'))[_0xf351('0x10')](socket);function respondWithStatusCode(_0x4be565,_0x1113d7){_0x1113d7=_0x1113d7||0xcc;return function(_0x5353fd){if(_0x5353fd){return _0x4be565[_0xf351('0x11')](_0x1113d7);}return _0x4be565[_0xf351('0x12')](_0x1113d7)['end']();};}function respondWithResult(_0x2637f6,_0x1a6423){_0x1a6423=_0x1a6423||0xc8;return function(_0x4c029d){if(_0x4c029d){return _0x2637f6[_0xf351('0x12')](_0x1a6423)[_0xf351('0x13')](_0x4c029d);}};}function respondWithFilteredResult(_0x3460d1,_0x210aef){return function(_0x43f542){if(_0x43f542){var _0x520d2f=typeof _0x210aef[_0xf351('0x14')]===_0xf351('0x15')&&typeof _0x210aef['limit']===_0xf351('0x15');var _0x57e2f8=_0x43f542[_0xf351('0x16')];var _0x54f003=_0x520d2f?0x0:_0x210aef['offset'];var _0x17b479=_0x520d2f?_0x43f542[_0xf351('0x16')]:_0x210aef[_0xf351('0x14')]+_0x210aef['limit'];var _0x219ada;if(_0x17b479>=_0x57e2f8){_0x17b479=_0x57e2f8;_0x219ada=0xc8;}else{_0x219ada=0xce;}_0x3460d1[_0xf351('0x12')](_0x219ada);return _0x3460d1['set'](_0xf351('0x17'),_0x54f003+'-'+_0x17b479+'/'+_0x57e2f8)['json'](_0x43f542);}return null;};}function saveUpdates(_0x470495){return function(_0x491f6f){if(_0x491f6f){return _0x491f6f[_0xf351('0x18')](_0x470495)[_0xf351('0x19')](function(_0x20c669){return _0x20c669;});}return null;};}function removeEntity(_0x2c8641){return function(_0x359094){if(_0x359094){return _0x359094[_0xf351('0x1a')]()[_0xf351('0x19')](function(){_0x2c8641['status'](0xcc)[_0xf351('0x1b')]();});}};}function handleEntityNotFound(_0x963955){return function(_0x4a42f8){if(!_0x4a42f8){_0x963955['sendStatus'](0x194);}return _0x4a42f8;};}function handleError(_0x4d0e2c,_0x21ec32){_0x21ec32=_0x21ec32||0x1f4;return function(_0x291963){logger[_0xf351('0x1c')](_0x291963[_0xf351('0x1d')]);if(_0x291963[_0xf351('0x1e')]){delete _0x291963[_0xf351('0x1e')];}_0x4d0e2c['status'](_0x21ec32)[_0xf351('0x1f')](_0x291963);};}exports[_0xf351('0x20')]=function(_0x4b2fa5,_0x432f12){var _0x339f7b={};var _0x20f16b=_['map'](db[_0xf351('0x21')][_0xf351('0x22')],function(_0x3e59c6){return{'name':_0x3e59c6['fieldName'],'type':_0x3e59c6[_0xf351('0x23')][_0xf351('0x24')]};});_0x339f7b=qs[_0xf351('0x25')](_0x20f16b,_0x4b2fa5);return interaction[_0xf351('0x26')](_0xf351('0x27'),_0x4b2fa5[_0xf351('0x28')],_0x4b2fa5[_0xf351('0x29')],_0x339f7b,_0x20f16b)[_0xf351('0x19')](respondWithFilteredResult(_0x432f12,_0x339f7b))[_0xf351('0x2a')](handleError(_0x432f12,null));};exports[_0xf351('0x2b')]=function(_0x5f3879,_0x226624){var _0x4933a1={'raw':![],'where':{'id':_0x5f3879[_0xf351('0x2c')]['id']}},_0x5e10e1={};_0x5e10e1[_0xf351('0x2d')]=_[_0xf351('0x2e')](db[_0xf351('0x21')][_0xf351('0x22')]);_0x5e10e1['query']=_['keys'](_0x5f3879['query']);_0x5e10e1[_0xf351('0x2f')]=_[_0xf351('0x30')](_0x5e10e1[_0xf351('0x2d')],_0x5e10e1[_0xf351('0x28')]);_0x4933a1['attributes']=_[_0xf351('0x30')](_0x5e10e1[_0xf351('0x2d')],qs[_0xf351('0x31')](_0x5f3879['query'][_0xf351('0x31')]));_0x4933a1[_0xf351('0x32')]=_0x4933a1[_0xf351('0x32')]['length']?_0x4933a1['attributes']:_0x5e10e1[_0xf351('0x2d')];if(_0x5f3879[_0xf351('0x28')][_0xf351('0x33')]){_0x4933a1[_0xf351('0x34')]=[{'all':!![]}];}_0x4933a1=_['merge']({},_0x4933a1,_0x5f3879[_0xf351('0x35')]);return db[_0xf351('0x21')]['find'](_0x4933a1)[_0xf351('0x19')](handleEntityNotFound(_0x226624,null))[_0xf351('0x19')](respondWithResult(_0x226624,null))[_0xf351('0x2a')](handleError(_0x226624,null));};exports[_0xf351('0x36')]=function(_0x407911,_0x13c804){return db[_0xf351('0x21')][_0xf351('0x36')](_0x407911['body'],{})[_0xf351('0x19')](respondWithResult(_0x13c804,0xc9))[_0xf351('0x2a')](handleError(_0x13c804,null));};exports[_0xf351('0x18')]=function(_0x5ebef0,_0x21bcc1){if(_0x5ebef0[_0xf351('0x37')]['id']){delete _0x5ebef0[_0xf351('0x37')]['id'];}return db[_0xf351('0x21')][_0xf351('0x38')]({'where':{'id':_0x5ebef0[_0xf351('0x2c')]['id']}})[_0xf351('0x19')](handleEntityNotFound(_0x21bcc1,null))[_0xf351('0x19')](saveUpdates(_0x5ebef0[_0xf351('0x37')],null))['then'](respondWithResult(_0x21bcc1,null))['catch'](handleError(_0x21bcc1,null));};exports[_0xf351('0x1a')]=function(_0x2c7749,_0x345627){return db[_0xf351('0x21')][_0xf351('0x38')]({'where':{'id':_0x2c7749[_0xf351('0x2c')]['id']}})[_0xf351('0x19')](handleEntityNotFound(_0x345627,null))[_0xf351('0x19')](removeEntity(_0x345627,null))[_0xf351('0x2a')](handleError(_0x345627,null));};exports[_0xf351('0x39')]=function(_0x57fe12,_0x5dae4e){return db[_0xf351('0x21')][_0xf351('0x39')]()[_0xf351('0x19')](respondWithResult(_0x5dae4e,null))[_0xf351('0x2a')](handleError(_0x5dae4e,null));};exports['addMessage']=function(_0x467993,_0x27329d){return db[_0xf351('0x3a')][_0xf351('0x38')]({'where':{'id':_0x467993[_0xf351('0x2c')]['id']}})[_0xf351('0x19')](handleEntityNotFound(_0x27329d,null))[_0xf351('0x19')](function(_0x56ce65){if(_0x56ce65){return _0x56ce65['addMessage'](_0x467993['body'][_0xf351('0x3b')],_[_0xf351('0x3c')](_0x467993[_0xf351('0x37')],[_0xf351('0x3b'),'id'])||{});}})[_0xf351('0x19')](respondWithResult(_0x27329d,null))[_0xf351('0x2a')](handleError(_0x27329d,null));};exports[_0xf351('0x3d')]=function(_0x43aea6,_0x82008d){var _0x324564={'raw':![],'where':{}};var _0x10bdd2={};var _0x4c30ab={'count':0x0,'rows':[]};return db[_0xf351('0x21')][_0xf351('0x3e')]({'where':{'id':_0x43aea6['params']['id']}})[_0xf351('0x19')](handleEntityNotFound(_0x82008d,null))[_0xf351('0x19')](function(_0x10999c){if(_0x10999c){_0x10bdd2[_0xf351('0x2d')]=_['keys'](db['FaxMessage'][_0xf351('0x22')]);_0x10bdd2[_0xf351('0x28')]=_[_0xf351('0x2e')](_0x43aea6['query']);_0x10bdd2['filters']=_[_0xf351('0x30')](_0x10bdd2['model'],_0x10bdd2[_0xf351('0x28')]);_0x324564[_0xf351('0x32')]=_[_0xf351('0x30')](_0x10bdd2[_0xf351('0x2d')],qs[_0xf351('0x31')](_0x43aea6[_0xf351('0x28')][_0xf351('0x31')]));_0x324564[_0xf351('0x32')]=_0x324564['attributes'][_0xf351('0x3f')]?_0x324564['attributes']:_0x10bdd2[_0xf351('0x2d')];if(!_0x43aea6[_0xf351('0x28')][_0xf351('0x40')]('nolimit')){_0x324564[_0xf351('0x41')]=qs[_0xf351('0x41')](_0x43aea6[_0xf351('0x28')][_0xf351('0x41')]);_0x324564[_0xf351('0x14')]=qs[_0xf351('0x14')](_0x43aea6[_0xf351('0x28')][_0xf351('0x14')]);}_0x324564[_0xf351('0x42')]=qs[_0xf351('0x43')](_0x43aea6[_0xf351('0x28')]['sort']);_0x324564[_0xf351('0x44')]=qs[_0xf351('0x2f')](_['pick'](_0x43aea6['query'],_0x10bdd2[_0xf351('0x2f')]));_0x324564[_0xf351('0x44')][_0xf351('0x45')]=_0x10999c['id'];if(_0x43aea6[_0xf351('0x28')][_0xf351('0x46')]){_0x324564[_0xf351('0x44')]=_[_0xf351('0x47')](_0x324564[_0xf351('0x44')],{'$or':_[_0xf351('0x48')](_0x324564[_0xf351('0x32')],function(_0x40e7dd){var _0x8f54fa={};_0x8f54fa[_0x40e7dd]={'$like':'%'+_0x43aea6[_0xf351('0x28')][_0xf351('0x46')]+'%'};return _0x8f54fa;})});}if(_0x43aea6[_0xf351('0x28')][_0xf351('0x49')]){var _0x301b68=_0x43aea6[_0xf351('0x28')][_0xf351('0x49')][_0xf351('0x4a')](',');var _0x5da68d={};_0x5da68d[_0x301b68[0x0]]={'$gte':moment(_0x301b68[0x1])[_0xf351('0x4b')](_0xf351('0x4c'))};_0x324564[_0xf351('0x44')]=_[_0xf351('0x47')](_0x324564[_0xf351('0x44')],_0x5da68d);}_0x324564=_['merge']({},_0x324564,_0x43aea6['options']);return db[_0xf351('0x3a')]['count']({'where':_0x324564['where']})[_0xf351('0x19')](function(_0x54df7a){_0x4c30ab['count']=_0x54df7a;if(_0x43aea6[_0xf351('0x28')]['includeAll']){_0x324564['include']=[{'all':!![]}];}return db['FaxMessage'][_0xf351('0x26')](_0x324564);})[_0xf351('0x19')](function(_0x455e2c){_0x4c30ab[_0xf351('0x4d')]=_0x455e2c;return _0x4c30ab;});}})[_0xf351('0x19')](respondWithFilteredResult(_0x82008d,_0x324564))[_0xf351('0x2a')](handleError(_0x82008d,null));};exports['addTags']=function(_0x1ad52c,_0x4778bc){return db[_0xf351('0x21')][_0xf351('0x38')]({'where':{'id':_0x1ad52c[_0xf351('0x2c')]['id']}})['then'](handleEntityNotFound(_0x4778bc,null))['then'](function(_0x149f9d){if(_0x149f9d){return _0x149f9d[_0xf351('0x4e')](_0x1ad52c[_0xf351('0x37')][_0xf351('0x3b')],_[_0xf351('0x3c')](_0x1ad52c[_0xf351('0x37')],['ids','id'])||{})[_0xf351('0x4f')](function(){return db[_0xf351('0x50')][_0xf351('0x26')]({'attributes':['id','name',_0xf351('0x51')],'where':{'id':_0x1ad52c[_0xf351('0x37')]['ids']}});})[_0xf351('0x19')](function(_0x19cae1){socket['emit'](_0xf351('0x52'),{'id':Number(_0x1ad52c[_0xf351('0x2c')]['id']),'tags':_0x19cae1||[]});return{'id':Number(_0x1ad52c[_0xf351('0x2c')]['id']),'tags':_0x19cae1||[]};});}})['then'](respondWithResult(_0x4778bc,null))[_0xf351('0x2a')](handleError(_0x4778bc,null));};exports['removeTags']=function(_0x54ec0f,_0x452c90){return db[_0xf351('0x21')][_0xf351('0x38')]({'where':{'id':_0x54ec0f['params']['id']}})[_0xf351('0x19')](handleEntityNotFound(_0x452c90,null))[_0xf351('0x19')](function(_0xa898eb){if(_0xa898eb){return _0xa898eb['removeTags'](_0x54ec0f['query']['ids']);}})[_0xf351('0x19')](respondWithStatusCode(_0x452c90,null))['catch'](handleError(_0x452c90,null));};exports[_0xf351('0x53')]=function(_0x3288a5,_0x44d861){var _0xae4d61=moment()['unix']()[_0xf351('0x54')]();var _0xa102f1=path[_0xf351('0x55')](config[_0xf351('0x56')],_0xf351('0x57'),_0xf351('0x58'),_0xf351('0x59'));var _0x38f9a3=path['join'](config[_0xf351('0x56')],_0xf351('0x57'),_0xf351('0x58'),_0xf351('0x5a'));var _0x37c36c=path[_0xf351('0x55')](_0xa102f1,_0xae4d61);var _0xcf53b3=util['format'](_0xf351('0x5b'),_0x3288a5['params']['id'],_0xae4d61);var _0x66e673=path[_0xf351('0x55')](_0xa102f1,_0xcf53b3);var _0x126b56=[];_0x126b56[_0xf351('0x5c')]({'model':db[_0xf351('0x5d')],'as':_0xf351('0x5d'),'raw':!![]});var _0x246e1b=[{'model':db[_0xf351('0x3a')],'as':_0xf351('0x5e'),'attributes':['id','body',_0xf351('0x5f')],'include':_0x126b56}];return db['FaxInteraction'][_0xf351('0x38')]({'where':{'id':_0x3288a5[_0xf351('0x2c')]['id']},'include':_0x246e1b})[_0xf351('0x19')](handleEntityNotFound(_0x44d861,null))[_0xf351('0x19')](function(_0x22d43e){if(_0x22d43e&&_0x22d43e['Messages']){var _0x1bd8df=_0x22d43e[_0xf351('0x60')]({'plain':!![]});fs[_0xf351('0x61')](_0x37c36c);for(var _0x3e31b8=0x0;_0x3e31b8<_0x1bd8df['Messages'][_0xf351('0x3f')];_0x3e31b8++){var _0x3341db=_0x1bd8df[_0xf351('0x5e')][_0x3e31b8][_0xf351('0x5d')];if(_0x3341db){var _0x17170e=path[_0xf351('0x55')](_0x38f9a3,_0x3341db[_0xf351('0x62')]);if(fs['existsSync'](_0x17170e)){fs[_0xf351('0x63')](_0x17170e)[_0xf351('0x64')](fs[_0xf351('0x65')](path[_0xf351('0x55')](_0x37c36c,_0x3341db[_0xf351('0x62')])));}}}return BPromise[_0xf351('0x66')]()['then'](function(){return new BPromise(function(_0x29cc73,_0x18aaa2){zipdir(_0x37c36c,{'saveTo':_0x66e673},function(_0x113749,_0x588528){if(_0x113749)return _0x18aaa2(_0x113749);return _0x29cc73(_0x588528);});})[_0xf351('0x19')](function(){return new BPromise(function(_0x34916c,_0x17e26c){rimraf(_0x37c36c,function(_0x12986a){if(_0x12986a)_0x17e26c(_0x12986a);return _0x34916c();});});})[_0xf351('0x19')](function(){return _0x44d861[_0xf351('0x53')](_0x66e673,_0xcf53b3,function(_0xb1e84d){if(_0xb1e84d){console[_0xf351('0x67')](_0xf351('0x68'),_0xb1e84d);}else{fs[_0xf351('0x69')](_0x66e673);}});});});}else{return _0x44d861[_0xf351('0x11')](0xc8);}})[_0xf351('0x2a')](handleError(_0x44d861,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 650c0c7..a8c576b 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 _0xf3d8=['save','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','hasOwnProperty','hook','exports','FaxInteraction','../../mysqldb','FaxMessage','setMaxListeners'];(function(_0x43700f,_0x84dfb0){var _0x24f17f=function(_0x4db2da){while(--_0x4db2da){_0x43700f['push'](_0x43700f['shift']());}};_0x24f17f(++_0x84dfb0);}(_0xf3d8,0x1e9));var _0x8f3d=function(_0x810e4d,_0x909ef4){_0x810e4d=_0x810e4d-0x0;var _0x13f01c=_0xf3d8[_0x810e4d];return _0x13f01c;};'use strict';var EventEmitter=require('events');var FaxInteraction=require('../../mysqldb')['db'][_0x8f3d('0x0')];var FaxMessage=require(_0x8f3d('0x1'))['db'][_0x8f3d('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x8f3d('0x3')](0x0);var events={'afterCreate':_0x8f3d('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x5d1d48){return function(_0x3d9a4f,_0x38bb36,_0x380689){_0x3d9a4f[_0x8f3d('0x5')]({'attributes':['id'],'raw':!![]})[_0x8f3d('0x6')](function(_0x374d3e){_0x3d9a4f[_0x8f3d('0x7')](_0x8f3d('0x8'),_0x374d3e[_0x8f3d('0x9')](function(_0x1d8b34){return{'id':_0x1d8b34['id']};}));return FaxMessage[_0x8f3d('0xa')]({'where':{'FaxInteractionId':_0x3d9a4f['id'],'direction':'in','read':![]},'raw':!![]});})[_0x8f3d('0x6')](function(_0x5a62ea){_0x3d9a4f[_0x8f3d('0x7')](_0x8f3d('0xb'),_0x5a62ea[_0x8f3d('0xc')]);FaxInteractionEvents[_0x8f3d('0xd')](_0x5d1d48+':'+_0x3d9a4f['id'],_0x3d9a4f);FaxInteractionEvents[_0x8f3d('0xd')](_0x5d1d48,_0x3d9a4f);_0x380689(null);})['catch'](_0x380689(null));};}for(var e in events){if(events[_0x8f3d('0xe')](e)){var event=events[e];FaxInteraction[_0x8f3d('0xf')](e,emitEvent(event));}}module[_0x8f3d('0x10')]=FaxInteractionEvents; \ No newline at end of file +var _0x3c0c=['setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','FaxMessage'];(function(_0x5e2461,_0x535010){var _0x28ba4f=function(_0x57bb27){while(--_0x57bb27){_0x5e2461['push'](_0x5e2461['shift']());}};_0x28ba4f(++_0x535010);}(_0x3c0c,0xf4));var _0xc3c0=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x3c0c[_0x1facfa];return _0x9ec701;};'use strict';var EventEmitter=require(_0xc3c0('0x0'));var FaxInteraction=require(_0xc3c0('0x1'))['db']['FaxInteraction'];var FaxMessage=require(_0xc3c0('0x1'))['db'][_0xc3c0('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xc3c0('0x3')](0x0);var events={'afterCreate':_0xc3c0('0x4'),'afterUpdate':_0xc3c0('0x5'),'afterDestroy':_0xc3c0('0x6')};function emitEvent(_0x148f33){return function(_0x17954c,_0x170da5,_0x1e86e0){_0x17954c[_0xc3c0('0x7')]({'attributes':['id'],'raw':!![]})[_0xc3c0('0x8')](function(_0x4b376b){_0x17954c[_0xc3c0('0x9')](_0xc3c0('0xa'),_0x4b376b[_0xc3c0('0xb')](function(_0x219759){return{'id':_0x219759['id']};}));return FaxMessage[_0xc3c0('0xc')]({'where':{'FaxInteractionId':_0x17954c['id'],'direction':'in','read':![]},'raw':!![]});})[_0xc3c0('0x8')](function(_0x42781e){_0x17954c[_0xc3c0('0x9')](_0xc3c0('0xd'),_0x42781e['length']);FaxInteractionEvents[_0xc3c0('0xe')](_0x148f33+':'+_0x17954c['id'],_0x17954c);FaxInteractionEvents[_0xc3c0('0xe')](_0x148f33,_0x17954c);_0x1e86e0(null);})[_0xc3c0('0xf')](_0x1e86e0(null));};}for(var e in events){if(events[_0xc3c0('0x10')](e)){var event=events[e];FaxInteraction[_0xc3c0('0x11')](e,emitEvent(event));}}module[_0xc3c0('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 d2ff8e0..fb2dd30 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 _0x91ed=['request-promise','path','../../config/environment','exports','FaxInteraction','fax_interactions','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','../../config/logger','api','bluebird'];(function(_0x42c7ed,_0x25d73d){var _0x478d3b=function(_0x1d77d8){while(--_0x1d77d8){_0x42c7ed['push'](_0x42c7ed['shift']());}};_0x478d3b(++_0x25d73d);}(_0x91ed,0x99));var _0xd91e=function(_0x819464,_0x46fc91){_0x819464=_0x819464-0x0;var _0x49dcc0=_0x91ed[_0x819464];return _0x49dcc0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd91e('0x0'))(_0xd91e('0x1'));var moment=require('moment');var BPromise=require(_0xd91e('0x2'));var rp=require(_0xd91e('0x3'));var fs=require('fs');var path=require(_0xd91e('0x4'));var rimraf=require('rimraf');var config=require(_0xd91e('0x5'));var attributes=require('./faxInteraction.attributes');module[_0xd91e('0x6')]=function(_0x35c75f,_0x334ed1){return _0x35c75f['define'](_0xd91e('0x7'),attributes,{'tableName':_0xd91e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2586bb,_0x426214,_0x33d9d1){if(_0x2586bb[_0xd91e('0x9')]('closed')){_0x2586bb[_0xd91e('0xa')]=moment()[_0xd91e('0xb')](_0xd91e('0xc'));}_0x33d9d1(null,_0x2586bb);}}});}; \ No newline at end of file +var _0xeda7=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxInteraction.attributes','exports','define','FaxInteraction','fax_interactions','closed','YYYY-MM-DD\x20HH:mm:ss','lodash','util'];(function(_0x5bc88d,_0x535dff){var _0x396c0f=function(_0x1f2a78){while(--_0x1f2a78){_0x5bc88d['push'](_0x5bc88d['shift']());}};_0x396c0f(++_0x535dff);}(_0xeda7,0x196));var _0x7eda=function(_0x474bc0,_0x26989c){_0x474bc0=_0x474bc0-0x0;var _0x4b24cf=_0xeda7[_0x474bc0];return _0x4b24cf;};'use strict';var _=require(_0x7eda('0x0'));var util=require(_0x7eda('0x1'));var logger=require(_0x7eda('0x2'))(_0x7eda('0x3'));var moment=require(_0x7eda('0x4'));var BPromise=require(_0x7eda('0x5'));var rp=require(_0x7eda('0x6'));var fs=require('fs');var path=require(_0x7eda('0x7'));var rimraf=require(_0x7eda('0x8'));var config=require(_0x7eda('0x9'));var attributes=require(_0x7eda('0xa'));module[_0x7eda('0xb')]=function(_0x6ee7be,_0x328430){return _0x6ee7be[_0x7eda('0xc')](_0x7eda('0xd'),attributes,{'tableName':_0x7eda('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2bc200,_0x11576a,_0xbaadd4){if(_0x2bc200['changed'](_0x7eda('0xf'))){_0x2bc200['closedAt']=moment()['format'](_0x7eda('0x10'));}_0xbaadd4(null,_0x2bc200);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index b0c467b..8e59d15 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 _0x8c2d=['register','request','then','FaxInteraction,\x20%s,\x20%s','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','FaxInteraction','update','body','options','raw','where','info','UpdateFaxInteraction','AddTagsToFaxInteraction','find','addTags','omit','ids','spread','AddTags','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./faxInteraction.socket'];(function(_0x4e30ba,_0x5932a1){var _0x1c8ac4=function(_0xe79df7){while(--_0xe79df7){_0x4e30ba['push'](_0x4e30ba['shift']());}};_0x1c8ac4(++_0x5932a1);}(_0x8c2d,0x16b));var _0xd8c2=function(_0x5d115e,_0x35ce96){_0x5d115e=_0x5d115e-0x0;var _0x420939=_0x8c2d[_0x5d115e];return _0x420939;};'use strict';var _=require('lodash');var util=require(_0xd8c2('0x0'));var moment=require(_0xd8c2('0x1'));var BPromise=require(_0xd8c2('0x2'));var rs=require(_0xd8c2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd8c2('0x4'))['db'];var utils=require(_0xd8c2('0x5'));var logger=require(_0xd8c2('0x6'))(_0xd8c2('0x7'));var config=require(_0xd8c2('0x8'));var jayson=require(_0xd8c2('0x9'));var client=jayson[_0xd8c2('0xa')][_0xd8c2('0xb')]({'port':0x232a});config[_0xd8c2('0xc')]=_['defaults'](config[_0xd8c2('0xc')],{'host':_0xd8c2('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xd8c2('0xe'))[_0xd8c2('0xf')](socket);function respondWithRpcPromise(_0x112c72,_0x7755e9,_0x4bbd3a){return new BPromise(function(_0x523ac0,_0x15d8df){return client[_0xd8c2('0x10')](_0x112c72,_0x4bbd3a)[_0xd8c2('0x11')](function(_0x39fbeb){logger['info'](_0xd8c2('0x12'),_0x7755e9,'request\x20sent');logger[_0xd8c2('0x13')](_0xd8c2('0x14'),_0x7755e9,_0xd8c2('0x15'),JSON[_0xd8c2('0x16')](_0x39fbeb));if(_0x39fbeb[_0xd8c2('0x17')]){if(_0x39fbeb[_0xd8c2('0x17')][_0xd8c2('0x18')]===0x1f4){logger[_0xd8c2('0x17')](_0xd8c2('0x12'),_0x7755e9,_0x39fbeb['error']['message']);return _0x15d8df(_0x39fbeb[_0xd8c2('0x17')]['message']);}logger[_0xd8c2('0x17')](_0xd8c2('0x12'),_0x7755e9,_0x39fbeb['error']['message']);return _0x523ac0(_0x39fbeb[_0xd8c2('0x17')][_0xd8c2('0x19')]);}else{logger['info'](_0xd8c2('0x12'),_0x7755e9,_0xd8c2('0x15'));_0x523ac0(_0x39fbeb['result'][_0xd8c2('0x19')]);}})[_0xd8c2('0x1a')](function(_0x268bd6){logger[_0xd8c2('0x17')](_0xd8c2('0x12'),_0x7755e9,_0x268bd6);_0x15d8df(_0x268bd6);});});}exports['UpdateFaxInteraction']=function(_0x230b4b){var _0x5328ce=this;return new Promise(function(_0x369342,_0x3800fa){return db[_0xd8c2('0x1b')][_0xd8c2('0x1c')](_0x230b4b[_0xd8c2('0x1d')],{'raw':_0x230b4b[_0xd8c2('0x1e')]?_0x230b4b[_0xd8c2('0x1e')][_0xd8c2('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x230b4b[_0xd8c2('0x1e')]?_0x230b4b[_0xd8c2('0x1e')][_0xd8c2('0x20')]||null:null,'attributes':_0x230b4b['options']?_0x230b4b['options']['attributes']||null:null,'limit':_0x230b4b[_0xd8c2('0x1e')]?_0x230b4b[_0xd8c2('0x1e')]['limit']||null:null})[_0xd8c2('0x11')](function(_0x2f93f9){logger[_0xd8c2('0x21')](_0xd8c2('0x22'),_0x230b4b);logger[_0xd8c2('0x13')]('UpdateFaxInteraction',_0x230b4b,JSON[_0xd8c2('0x16')](_0x2f93f9));_0x369342(_0x2f93f9);})[_0xd8c2('0x1a')](function(_0x78e9a){logger[_0xd8c2('0x17')]('UpdateFaxInteraction',_0x78e9a[_0xd8c2('0x19')],_0x230b4b);_0x3800fa(_0x5328ce[_0xd8c2('0x17')](0x1f4,_0x78e9a[_0xd8c2('0x19')]));});});};exports[_0xd8c2('0x23')]=function(_0x2a90f7){return new Promise(function(_0x57ed81,_0x260685){return db[_0xd8c2('0x1b')][_0xd8c2('0x24')]({'where':_0x2a90f7[_0xd8c2('0x1e')]?_0x2a90f7[_0xd8c2('0x1e')][_0xd8c2('0x20')]||null:null})['then'](function(_0x1613af){if(_0x1613af){return _0x1613af[_0xd8c2('0x25')](_0x2a90f7[_0xd8c2('0x1d')]['ids'],_[_0xd8c2('0x26')](_0x2a90f7['body'],[_0xd8c2('0x27'),'id'])||{});}})[_0xd8c2('0x28')](function(_0xdbc42a){logger[_0xd8c2('0x21')](_0xd8c2('0x29'),_0x2a90f7);logger[_0xd8c2('0x13')](_0xd8c2('0x29'),_0x2a90f7,JSON[_0xd8c2('0x16')](_0xdbc42a));_0x57ed81(_0xdbc42a);})['catch'](function(_0x2ae9c6){logger[_0xd8c2('0x17')](_0xd8c2('0x29'),_0x2ae9c6[_0xd8c2('0x19')],_0x2a90f7);_0x260685(_this['error'](0x1f4,_0x2ae9c6[_0xd8c2('0x19')]));});});}; \ No newline at end of file +var _0xd7ea=['FaxInteraction,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','UpdateFaxInteraction','FaxInteraction','update','body','options','raw','where','limit','stringify','AddTagsToFaxInteraction','find','addTags','ids','omit','spread','AddTags','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','request','then','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x57cbe5,_0x4cdeb4){var _0x8129a2=function(_0x27a2ba){while(--_0x27a2ba){_0x57cbe5['push'](_0x57cbe5['shift']());}};_0x8129a2(++_0x4cdeb4);}(_0xd7ea,0x13d));var _0xad7e=function(_0x53e9a6,_0x12377b){_0x53e9a6=_0x53e9a6-0x0;var _0x5703a2=_0xd7ea[_0x53e9a6];return _0x5703a2;};'use strict';var _=require(_0xad7e('0x0'));var util=require('util');var moment=require(_0xad7e('0x1'));var BPromise=require(_0xad7e('0x2'));var rs=require(_0xad7e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xad7e('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xad7e('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xad7e('0x6'));var client=jayson[_0xad7e('0x7')]['http']({'port':0x232a});config[_0xad7e('0x8')]=_[_0xad7e('0x9')](config[_0xad7e('0x8')],{'host':_0xad7e('0xa'),'port':0x18eb});var socket=require(_0xad7e('0xb'))(new Redis(config['redis']));require(_0xad7e('0xc'))[_0xad7e('0xd')](socket);function respondWithRpcPromise(_0x33a6e6,_0x276b28,_0x377646){return new BPromise(function(_0x1ec104,_0x1d76af){return client[_0xad7e('0xe')](_0x33a6e6,_0x377646)[_0xad7e('0xf')](function(_0x33ea61){logger['info'](_0xad7e('0x10'),_0x276b28,_0xad7e('0x11'));logger[_0xad7e('0x12')](_0xad7e('0x13'),_0x276b28,_0xad7e('0x11'),JSON['stringify'](_0x33ea61));if(_0x33ea61['error']){if(_0x33ea61[_0xad7e('0x14')][_0xad7e('0x15')]===0x1f4){logger[_0xad7e('0x14')](_0xad7e('0x10'),_0x276b28,_0x33ea61[_0xad7e('0x14')]['message']);return _0x1d76af(_0x33ea61[_0xad7e('0x14')][_0xad7e('0x16')]);}logger['error'](_0xad7e('0x10'),_0x276b28,_0x33ea61[_0xad7e('0x14')][_0xad7e('0x16')]);return _0x1ec104(_0x33ea61[_0xad7e('0x14')][_0xad7e('0x16')]);}else{logger[_0xad7e('0x17')]('FaxInteraction,\x20%s,\x20%s',_0x276b28,_0xad7e('0x11'));_0x1ec104(_0x33ea61[_0xad7e('0x18')]['message']);}})[_0xad7e('0x19')](function(_0x484308){logger[_0xad7e('0x14')](_0xad7e('0x10'),_0x276b28,_0x484308);_0x1d76af(_0x484308);});});}exports[_0xad7e('0x1a')]=function(_0x5de89e){var _0x42f591=this;return new Promise(function(_0x4a2caf,_0x336d6d){return db[_0xad7e('0x1b')][_0xad7e('0x1c')](_0x5de89e[_0xad7e('0x1d')],{'raw':_0x5de89e[_0xad7e('0x1e')]?_0x5de89e['options'][_0xad7e('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5de89e['options']?_0x5de89e[_0xad7e('0x1e')][_0xad7e('0x20')]||null:null,'attributes':_0x5de89e[_0xad7e('0x1e')]?_0x5de89e[_0xad7e('0x1e')]['attributes']||null:null,'limit':_0x5de89e[_0xad7e('0x1e')]?_0x5de89e[_0xad7e('0x1e')][_0xad7e('0x21')]||null:null})['then'](function(_0xdf0e1d){logger[_0xad7e('0x17')](_0xad7e('0x1a'),_0x5de89e);logger['debug'](_0xad7e('0x1a'),_0x5de89e,JSON[_0xad7e('0x22')](_0xdf0e1d));_0x4a2caf(_0xdf0e1d);})[_0xad7e('0x19')](function(_0x15b65d){logger[_0xad7e('0x14')](_0xad7e('0x1a'),_0x15b65d['message'],_0x5de89e);_0x336d6d(_0x42f591[_0xad7e('0x14')](0x1f4,_0x15b65d[_0xad7e('0x16')]));});});};exports[_0xad7e('0x23')]=function(_0x8bdbb7){return new Promise(function(_0x54e83e,_0x4800f2){return db['FaxInteraction'][_0xad7e('0x24')]({'where':_0x8bdbb7[_0xad7e('0x1e')]?_0x8bdbb7[_0xad7e('0x1e')][_0xad7e('0x20')]||null:null})[_0xad7e('0xf')](function(_0x479ffc){if(_0x479ffc){return _0x479ffc[_0xad7e('0x25')](_0x8bdbb7[_0xad7e('0x1d')][_0xad7e('0x26')],_[_0xad7e('0x27')](_0x8bdbb7[_0xad7e('0x1d')],[_0xad7e('0x26'),'id'])||{});}})[_0xad7e('0x28')](function(_0x47a623){logger[_0xad7e('0x17')]('AddTags',_0x8bdbb7);logger[_0xad7e('0x12')](_0xad7e('0x29'),_0x8bdbb7,JSON[_0xad7e('0x22')](_0x47a623));_0x54e83e(_0x47a623);})[_0xad7e('0x19')](function(_0x3a040f){logger[_0xad7e('0x14')](_0xad7e('0x29'),_0x3a040f['message'],_0x8bdbb7);_0x4800f2(_this[_0xad7e('0x14')](0x1f4,_0x3a040f['message']));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index e5a7e84..5dc8904 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 _0x2ea6=['register','length','remove','update','removeListener'];(function(_0x58d3c8,_0x3b9d60){var _0x22c92a=function(_0x5dbef3){while(--_0x5dbef3){_0x58d3c8['push'](_0x58d3c8['shift']());}};_0x22c92a(++_0x3b9d60);}(_0x2ea6,0xe8));var _0x62ea=function(_0x3d73ba,_0x356e23){_0x3d73ba=_0x3d73ba-0x0;var _0x47e406=_0x2ea6[_0x3d73ba];return _0x47e406;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=['save',_0x62ea('0x0'),_0x62ea('0x1')];function createListener(_0xb2ce67,_0x4b60d4){return function(_0x445971){_0x4b60d4['emit'](_0xb2ce67,_0x445971);};}function removeListener(_0x1476aa,_0x13b739){return function(){FaxInteractionEvents[_0x62ea('0x2')](_0x1476aa,_0x13b739);};}exports[_0x62ea('0x3')]=function(_0x345328){for(var _0x5e4ee0=0x0,_0x1e47f7=events[_0x62ea('0x4')];_0x5e4ee0<_0x1e47f7;_0x5e4ee0++){var _0x119a40=events[_0x5e4ee0];var _0x4680a5=createListener('faxInteraction:'+_0x119a40,_0x345328);FaxInteractionEvents['on'](_0x119a40,_0x4680a5);}}; \ No newline at end of file +var _0x5afc=['emit','removeListener','register','length','faxInteraction:','./faxInteraction.events','remove'];(function(_0x150aa7,_0x2d811f){var _0x20f4c3=function(_0x4ef83f){while(--_0x4ef83f){_0x150aa7['push'](_0x150aa7['shift']());}};_0x20f4c3(++_0x2d811f);}(_0x5afc,0xf3));var _0xc5af=function(_0x4dcdcb,_0x48ed21){_0x4dcdcb=_0x4dcdcb-0x0;var _0x2f21ac=_0x5afc[_0x4dcdcb];return _0x2f21ac;};'use strict';var FaxInteractionEvents=require(_0xc5af('0x0'));var events=['save',_0xc5af('0x1'),'update'];function createListener(_0x313639,_0x2c3090){return function(_0x592666){_0x2c3090[_0xc5af('0x2')](_0x313639,_0x592666);};}function removeListener(_0x11aa9d,_0x199ae2){return function(){FaxInteractionEvents[_0xc5af('0x3')](_0x11aa9d,_0x199ae2);};}exports[_0xc5af('0x4')]=function(_0x376e6e){for(var _0x4b9e7f=0x0,_0x487568=events[_0xc5af('0x5')];_0x4b9e7f<_0x487568;_0x4b9e7f++){var _0x54e97f=events[_0x4b9e7f];var _0x4906b7=createListener(_0xc5af('0x6')+_0x54e97f,_0x376e6e);FaxInteractionEvents['on'](_0x54e97f,_0x4906b7);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 3d055d9..4936722 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 _0x7408=['/:id/messages','getMessages','/:id/download','post','/:id/tags','tracked','fax','faxinteraction:addtags','addTags','faxinteraction:update','update','delete','destroy','removeTags','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','show'];(function(_0x5d82d9,_0x3d7694){var _0x3dfd86=function(_0x53735e){while(--_0x53735e){_0x5d82d9['push'](_0x5d82d9['shift']());}};_0x3dfd86(++_0x3d7694);}(_0x7408,0x107));var _0x8740=function(_0x5a5395,_0x5361f6){_0x5a5395=_0x5a5395-0x0;var _0x4da43d=_0x7408[_0x5a5395];return _0x4da43d;};'use strict';var multer=require(_0x8740('0x0'));var util=require(_0x8740('0x1'));var path=require(_0x8740('0x2'));var timeout=require(_0x8740('0x3'));var express=require('express');var router=express[_0x8740('0x4')]();var fs_extra=require(_0x8740('0x5'));var auth=require(_0x8740('0x6'));var interaction=require(_0x8740('0x7'));var config=require(_0x8740('0x8'));var controller=require('./faxInteraction.controller');router['get']('/',auth[_0x8740('0x9')](),controller[_0x8740('0xa')]);router[_0x8740('0xb')](_0x8740('0xc'),auth['isAuthenticated'](),controller[_0x8740('0xd')]);router[_0x8740('0xb')](_0x8740('0xe'),auth[_0x8740('0x9')](),controller[_0x8740('0xf')]);router[_0x8740('0xb')](_0x8740('0x10'),auth['isAuthenticated'](),controller[_0x8740('0x11')]);router[_0x8740('0xb')](_0x8740('0x12'),auth[_0x8740('0x9')](),controller['download']);router[_0x8740('0x13')]('/',auth[_0x8740('0x9')](),controller['create']);router[_0x8740('0x13')](_0x8740('0x10'),auth[_0x8740('0x9')](),controller['addMessage']);router['post'](_0x8740('0x14'),auth[_0x8740('0x9')](),interaction[_0x8740('0x15')](_0x8740('0x16'),_0x8740('0x17')),controller[_0x8740('0x18')]);router['put'](_0x8740('0xe'),auth[_0x8740('0x9')](),interaction[_0x8740('0x15')]('fax',_0x8740('0x19')),controller[_0x8740('0x1a')]);router[_0x8740('0x1b')]('/:id',auth[_0x8740('0x9')](),interaction[_0x8740('0x15')]('fax','faxinteraction:destroy'),controller[_0x8740('0x1c')]);router[_0x8740('0x1b')]('/:id/tags',auth['isAuthenticated'](),controller[_0x8740('0x1d')]);module[_0x8740('0x1e')]=router; \ No newline at end of file +var _0xd2c3=['removeTags','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','addMessage','/:id/tags','tracked','faxinteraction:addtags','faxinteraction:update','delete','fax','faxinteraction:destroy','destroy'];(function(_0x3848ff,_0x2fe360){var _0x55991a=function(_0x6aea3f){while(--_0x6aea3f){_0x3848ff['push'](_0x3848ff['shift']());}};_0x55991a(++_0x2fe360);}(_0xd2c3,0x1c2));var _0x3d2c=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xd2c3[_0x5d6456];return _0x4d66c1;};'use strict';var multer=require(_0x3d2c('0x0'));var util=require(_0x3d2c('0x1'));var path=require(_0x3d2c('0x2'));var timeout=require('connect-timeout');var express=require(_0x3d2c('0x3'));var router=express[_0x3d2c('0x4')]();var fs_extra=require(_0x3d2c('0x5'));var auth=require(_0x3d2c('0x6'));var interaction=require(_0x3d2c('0x7'));var config=require('../../config/environment');var controller=require(_0x3d2c('0x8'));router[_0x3d2c('0x9')]('/',auth[_0x3d2c('0xa')](),controller[_0x3d2c('0xb')]);router[_0x3d2c('0x9')](_0x3d2c('0xc'),auth[_0x3d2c('0xa')](),controller[_0x3d2c('0xd')]);router[_0x3d2c('0x9')](_0x3d2c('0xe'),auth['isAuthenticated'](),controller[_0x3d2c('0xf')]);router[_0x3d2c('0x9')](_0x3d2c('0x10'),auth[_0x3d2c('0xa')](),controller[_0x3d2c('0x11')]);router[_0x3d2c('0x9')](_0x3d2c('0x12'),auth[_0x3d2c('0xa')](),controller[_0x3d2c('0x13')]);router[_0x3d2c('0x14')]('/',auth[_0x3d2c('0xa')](),controller['create']);router[_0x3d2c('0x14')](_0x3d2c('0x10'),auth[_0x3d2c('0xa')](),controller[_0x3d2c('0x15')]);router[_0x3d2c('0x14')](_0x3d2c('0x16'),auth[_0x3d2c('0xa')](),interaction[_0x3d2c('0x17')]('fax',_0x3d2c('0x18')),controller['addTags']);router['put'](_0x3d2c('0xe'),auth[_0x3d2c('0xa')](),interaction[_0x3d2c('0x17')]('fax',_0x3d2c('0x19')),controller['update']);router[_0x3d2c('0x1a')](_0x3d2c('0xe'),auth[_0x3d2c('0xa')](),interaction[_0x3d2c('0x17')](_0x3d2c('0x1b'),_0x3d2c('0x1c')),controller[_0x3d2c('0x1d')]);router[_0x3d2c('0x1a')](_0x3d2c('0x16'),auth[_0x3d2c('0xa')](),controller[_0x3d2c('0x1e')]);module[_0x3d2c('0x1f')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index c135f22..d388f30 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 _0xc576=['sequelize','exports','TEXT','medium','BOOLEAN','out','DATE'];(function(_0x4ea58a,_0x461b60){var _0xafa738=function(_0x2a9452){while(--_0x2a9452){_0x4ea58a['push'](_0x4ea58a['shift']());}};_0xafa738(++_0x461b60);}(_0xc576,0x1ea));var _0x6c57=function(_0x50cd41,_0x4874a7){_0x50cd41=_0x50cd41-0x0;var _0x399475=_0xc576[_0x50cd41];return _0x399475;};'use strict';var Sequelize=require(_0x6c57('0x0'));module[_0x6c57('0x1')]={'body':{'type':Sequelize[_0x6c57('0x2')](_0x6c57('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x6c57('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0x6c57('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize[_0x6c57('0x6')]}}; \ No newline at end of file +var _0xbec5=['medium','BOOLEAN','ENUM','out','DATE','sequelize','exports'];(function(_0x230457,_0x17efa8){var _0x3118d8=function(_0x2fa43d){while(--_0x2fa43d){_0x230457['push'](_0x230457['shift']());}};_0x3118d8(++_0x17efa8);}(_0xbec5,0xe5));var _0x5bec=function(_0x550e29,_0x4047f){_0x550e29=_0x550e29-0x0;var _0x3515b6=_0xbec5[_0x550e29];return _0x3515b6;};'use strict';var Sequelize=require(_0x5bec('0x0'));module[_0x5bec('0x1')]={'body':{'type':Sequelize['TEXT'](_0x5bec('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x5bec('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x5bec('0x4')]('in',_0x5bec('0x5')),'defaultValue':_0x5bec('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize[_0x5bec('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 0e85b97..7107ac9 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 _0xa380=['interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','QueryTypes','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','accept','EventManager','fax','FaxInteractionId','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','sequelize','Sequelize','SELECT','contact','CmContact','findOne','SendFax','/var/opt/motion2/server/files/attachments/%s','basename','AttachmentId','download','join','root','files','attachments','Attachment','eml-format','rimraf','zip-dir','request-promise','moment','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','http','client','request','then','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','error','code','FaxMessage,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','FaxMessage','includeAll','include','findAll','rows','length','options','find','body','params','describe','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','FaxInteraction','isNil','read1stAt'];(function(_0x19d32d,_0x546ee2){var _0x675353=function(_0x588aba){while(--_0x588aba){_0x19d32d['push'](_0x19d32d['shift']());}};_0x675353(++_0x546ee2);}(_0xa380,0x1db));var _0x0a38=function(_0x216e59,_0x2f28ff){_0x216e59=_0x216e59-0x0;var _0x62ea80=_0xa380[_0x216e59];return _0x62ea80;};'use strict';var emlformat=require(_0x0a38('0x0'));var rimraf=require(_0x0a38('0x1'));var zipdir=require(_0x0a38('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0a38('0x3'));var moment=require(_0x0a38('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0a38('0x5'));var path=require(_0x0a38('0x6'));var sox=require('sox');var csv=require(_0x0a38('0x7'));var ejs=require(_0x0a38('0x8'));var fs=require('fs');var fs_extra=require(_0x0a38('0x9'));var _=require(_0x0a38('0xa'));var squel=require('squel');var crypto=require(_0x0a38('0xb'));var jsforce=require(_0x0a38('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x0a38('0x7'));var querystring=require(_0x0a38('0xd'));var Papa=require(_0x0a38('0xe'));var Redis=require('ioredis');var authService=require(_0x0a38('0xf'));var qs=require(_0x0a38('0x10'));var as=require(_0x0a38('0x11'));var hardwareService=require(_0x0a38('0x12'));var logger=require(_0x0a38('0x13'))(_0x0a38('0x14'));var utils=require(_0x0a38('0x15'));var config=require(_0x0a38('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x0a38('0x17'))['db'];config[_0x0a38('0x18')]=_[_0x0a38('0x19')](config[_0x0a38('0x18')],{'host':_0x0a38('0x1a'),'port':0x18eb});var socket=require(_0x0a38('0x1b'))(new Redis(config['redis']));require('./faxMessage.socket')[_0x0a38('0x1c')](socket);var jayson=require(_0x0a38('0x1d'));var client=jayson['client'][_0x0a38('0x1e')]({'port':0x232c});var client9002=jayson[_0x0a38('0x1f')][_0x0a38('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x2919bc,_0x12dee3,_0x3a40d5,_0xf27d08){return new BPromise(function(_0x236fb3,_0x11e36c){var _0x160d10=_0xf27d08||client;return _0x160d10[_0x0a38('0x20')](_0x2919bc,_0x3a40d5)[_0x0a38('0x21')](function(_0x3449d4){logger['info']('FaxMessage,\x20%s,\x20%s',_0x12dee3,_0x0a38('0x22'));logger['debug'](_0x0a38('0x23'),_0x12dee3,_0x0a38('0x22'),JSON['stringify'](_0x3449d4));if(_0x3449d4[_0x0a38('0x24')]){if(_0x3449d4['error'][_0x0a38('0x25')]===0x1f4){logger[_0x0a38('0x24')](_0x0a38('0x26'),_0x12dee3,_0x3449d4[_0x0a38('0x24')]['message']);return _0x11e36c(_0x3449d4['error'][_0x0a38('0x27')]);}logger['error'](_0x0a38('0x26'),_0x12dee3,_0x3449d4['error'][_0x0a38('0x27')]);return _0x236fb3(_0x3449d4['error'][_0x0a38('0x27')]);}else{logger[_0x0a38('0x28')](_0x0a38('0x26'),_0x12dee3,'request\x20sent');_0x236fb3(_0x3449d4[_0x0a38('0x29')][_0x0a38('0x27')]);}})[_0x0a38('0x2a')](function(_0x6c4efe){logger[_0x0a38('0x24')](_0x0a38('0x26'),_0x12dee3,_0x6c4efe);_0x11e36c(_0x6c4efe);});});}function respondWithStatusCode(_0x5698fd,_0x1ab365){_0x1ab365=_0x1ab365||0xcc;return function(_0x424aa1){if(_0x424aa1){return _0x5698fd[_0x0a38('0x2b')](_0x1ab365);}return _0x5698fd[_0x0a38('0x2c')](_0x1ab365)[_0x0a38('0x2d')]();};}function respondWithResult(_0x3b68e7,_0x2e8c35){_0x2e8c35=_0x2e8c35||0xc8;return function(_0x44246c){if(_0x44246c){return _0x3b68e7[_0x0a38('0x2c')](_0x2e8c35)[_0x0a38('0x2e')](_0x44246c);}};}function respondWithFilteredResult(_0x2e23ef,_0x35e732){return function(_0x2f162c){if(_0x2f162c){var _0x536d4f=typeof _0x35e732[_0x0a38('0x2f')]===_0x0a38('0x30')&&typeof _0x35e732[_0x0a38('0x31')]==='undefined';var _0x2e8e56=_0x2f162c[_0x0a38('0x32')];var _0x32e344=_0x536d4f?0x0:_0x35e732[_0x0a38('0x2f')];var _0x3ca2f4=_0x536d4f?_0x2f162c[_0x0a38('0x32')]:_0x35e732[_0x0a38('0x2f')]+_0x35e732[_0x0a38('0x31')];var _0x98612f;if(_0x3ca2f4>=_0x2e8e56){_0x3ca2f4=_0x2e8e56;_0x98612f=0xc8;}else{_0x98612f=0xce;}_0x2e23ef[_0x0a38('0x2c')](_0x98612f);return _0x2e23ef[_0x0a38('0x33')](_0x0a38('0x34'),_0x32e344+'-'+_0x3ca2f4+'/'+_0x2e8e56)[_0x0a38('0x2e')](_0x2f162c);}return null;};}function patchUpdates(_0x218c5c){return function(_0x5139d9){try{jsonpatch[_0x0a38('0x35')](_0x5139d9,_0x218c5c,!![]);}catch(_0x79c4bb){return BPromise[_0x0a38('0x36')](_0x79c4bb);}return _0x5139d9[_0x0a38('0x37')]();};}function saveUpdates(_0x1e991c,_0x5e09c2){return function(_0x32fe76){if(_0x32fe76){return _0x32fe76[_0x0a38('0x38')](_0x1e991c)['then'](function(_0x2f20a7){return _0x2f20a7;});}return null;};}function removeEntity(_0xf040eb,_0x325027){return function(_0x58d76c){if(_0x58d76c){return _0x58d76c[_0x0a38('0x39')]()[_0x0a38('0x21')](function(){_0xf040eb[_0x0a38('0x2c')](0xcc)[_0x0a38('0x2d')]();});}};}function handleEntityNotFound(_0x5619d1,_0x53d36b){return function(_0x24f45f){if(!_0x24f45f){_0x5619d1[_0x0a38('0x2b')](0x194);}return _0x24f45f;};}function handleError(_0x553c18,_0x851b21){_0x851b21=_0x851b21||0x1f4;return function(_0x359118){logger[_0x0a38('0x24')](_0x359118[_0x0a38('0x3a')]);if(_0x359118[_0x0a38('0x3b')]){delete _0x359118[_0x0a38('0x3b')];}_0x553c18[_0x0a38('0x2c')](_0x851b21)[_0x0a38('0x3c')](_0x359118);};}exports[_0x0a38('0x3d')]=function(_0x33ad8b,_0x1d3ffe){var _0x27cc60={},_0x48b550={},_0x47d070={'count':0x0,'rows':[]};var _0x2efefd=_[_0x0a38('0x3e')](db['FaxMessage'][_0x0a38('0x3f')],function(_0x58daae){return{'name':_0x58daae[_0x0a38('0x40')],'type':_0x58daae[_0x0a38('0x41')][_0x0a38('0x42')]};});_0x48b550[_0x0a38('0x43')]=_[_0x0a38('0x3e')](_0x2efefd,_0x0a38('0x3b'));_0x48b550[_0x0a38('0x44')]=_[_0x0a38('0x45')](_0x33ad8b['query']);_0x48b550[_0x0a38('0x46')]=_[_0x0a38('0x47')](_0x48b550[_0x0a38('0x43')],_0x48b550['query']);_0x27cc60[_0x0a38('0x48')]=_['intersection'](_0x48b550[_0x0a38('0x43')],qs[_0x0a38('0x49')](_0x33ad8b[_0x0a38('0x44')][_0x0a38('0x49')]));_0x27cc60[_0x0a38('0x48')]=_0x27cc60[_0x0a38('0x48')]['length']?_0x27cc60[_0x0a38('0x48')]:_0x48b550[_0x0a38('0x43')];if(!_0x33ad8b['query'][_0x0a38('0x4a')](_0x0a38('0x4b'))){_0x27cc60[_0x0a38('0x31')]=qs['limit'](_0x33ad8b['query'][_0x0a38('0x31')]);_0x27cc60[_0x0a38('0x2f')]=qs[_0x0a38('0x2f')](_0x33ad8b['query'][_0x0a38('0x2f')]);}_0x27cc60[_0x0a38('0x4c')]=qs[_0x0a38('0x4d')](_0x33ad8b[_0x0a38('0x44')][_0x0a38('0x4d')]);_0x27cc60[_0x0a38('0x4e')]=qs[_0x0a38('0x46')](_[_0x0a38('0x4f')](_0x33ad8b[_0x0a38('0x44')],_0x48b550['filters']),_0x2efefd);if(_0x33ad8b[_0x0a38('0x44')][_0x0a38('0x50')]){_0x27cc60[_0x0a38('0x4e')]=_[_0x0a38('0x51')](_0x27cc60['where'],{'$or':_[_0x0a38('0x3e')](_0x2efefd,function(_0x133f61){if(_0x133f61[_0x0a38('0x41')]!==_0x0a38('0x52')){var _0x2532ee={};_0x2532ee[_0x133f61[_0x0a38('0x3b')]]={'$like':'%'+_0x33ad8b[_0x0a38('0x44')]['filter']+'%'};return _0x2532ee;}})});}_0x27cc60=_['merge']({},_0x27cc60,_0x33ad8b['options']);var _0x58d955={'where':_0x27cc60[_0x0a38('0x4e')]};return db[_0x0a38('0x53')][_0x0a38('0x32')](_0x58d955)['then'](function(_0x4f059e){_0x47d070[_0x0a38('0x32')]=_0x4f059e;if(_0x33ad8b[_0x0a38('0x44')][_0x0a38('0x54')]){_0x27cc60[_0x0a38('0x55')]=[{'all':!![]}];}return db['FaxMessage'][_0x0a38('0x56')](_0x27cc60);})[_0x0a38('0x21')](function(_0x5668aa){_0x47d070[_0x0a38('0x57')]=_0x5668aa;return _0x47d070;})[_0x0a38('0x21')](respondWithFilteredResult(_0x1d3ffe,_0x27cc60))[_0x0a38('0x2a')](handleError(_0x1d3ffe,null));};exports['show']=function(_0x2a9593,_0x5352d5){var _0x1507e2={'raw':!![],'where':{'id':_0x2a9593['params']['id']}},_0x31c619={};_0x31c619['model']=_[_0x0a38('0x45')](db[_0x0a38('0x53')][_0x0a38('0x3f')]);_0x31c619[_0x0a38('0x44')]=_[_0x0a38('0x45')](_0x2a9593['query']);_0x31c619[_0x0a38('0x46')]=_['intersection'](_0x31c619[_0x0a38('0x43')],_0x31c619['query']);_0x1507e2[_0x0a38('0x48')]=_[_0x0a38('0x47')](_0x31c619['model'],qs[_0x0a38('0x49')](_0x2a9593['query'][_0x0a38('0x49')]));_0x1507e2[_0x0a38('0x48')]=_0x1507e2['attributes'][_0x0a38('0x58')]?_0x1507e2['attributes']:_0x31c619[_0x0a38('0x43')];if(_0x2a9593[_0x0a38('0x44')][_0x0a38('0x54')]){_0x1507e2[_0x0a38('0x55')]=[{'all':!![]}];}_0x1507e2=_[_0x0a38('0x51')]({},_0x1507e2,_0x2a9593[_0x0a38('0x59')]);return db[_0x0a38('0x53')][_0x0a38('0x5a')](_0x1507e2)[_0x0a38('0x21')](handleEntityNotFound(_0x5352d5,null))[_0x0a38('0x21')](respondWithResult(_0x5352d5,null))[_0x0a38('0x2a')](handleError(_0x5352d5,null));};exports[_0x0a38('0x38')]=function(_0x40f0a4,_0x19025c){if(_0x40f0a4[_0x0a38('0x5b')]['id']){delete _0x40f0a4[_0x0a38('0x5b')]['id'];}return db[_0x0a38('0x53')][_0x0a38('0x5a')]({'where':{'id':_0x40f0a4[_0x0a38('0x5c')]['id']}})[_0x0a38('0x21')](handleEntityNotFound(_0x19025c,null))['then'](saveUpdates(_0x40f0a4[_0x0a38('0x5b')],null))['then'](respondWithResult(_0x19025c,null))[_0x0a38('0x2a')](handleError(_0x19025c,null));};exports[_0x0a38('0x39')]=function(_0x2e2a69,_0x43febb){return db[_0x0a38('0x53')][_0x0a38('0x5a')]({'where':{'id':_0x2e2a69['params']['id']}})[_0x0a38('0x21')](handleEntityNotFound(_0x43febb,null))[_0x0a38('0x21')](removeEntity(_0x43febb,null))['catch'](handleError(_0x43febb,null));};exports[_0x0a38('0x5d')]=function(_0x32f5fd,_0x19f202){return db[_0x0a38('0x53')][_0x0a38('0x5d')]()['then'](respondWithResult(_0x19f202,null))[_0x0a38('0x2a')](handleError(_0x19f202,null));};var interaction_log=require(_0x0a38('0x13'))('fax-interactions');exports['accept']=function(_0x1e5cf8,_0x5d8e79,_0x1abe18){var _0xe02598={'agent':{},'channel':'fax'};if(_0x1e5cf8['body']['id']){delete _0x1e5cf8[_0x0a38('0x5b')]['id'];}_0x1e5cf8[_0x0a38('0x5b')][_0x0a38('0x5e')]=!![];_0x1e5cf8[_0x0a38('0x5b')][_0x0a38('0x5f')]=moment()[_0x0a38('0x60')](_0x0a38('0x61'));_0x1e5cf8['body']['UserId']=_0x1e5cf8[_0x0a38('0x5b')][_0x0a38('0x62')]||_0x1e5cf8[_0x0a38('0x63')]['id'];_0xe02598[_0x0a38('0x64')]['id']=_0x1e5cf8[_0x0a38('0x5b')][_0x0a38('0x62')];return db[_0x0a38('0x53')][_0x0a38('0x5a')]({'where':{'id':_0x1e5cf8[_0x0a38('0x5c')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x5d8e79,null))[_0x0a38('0x21')](saveUpdates(_0x1e5cf8[_0x0a38('0x5b')],null))['then'](function(_0x42706c){if(_0x42706c){_0xe02598['message']=_0x42706c[_0x0a38('0x65')]({'plain':!![]});return db[_0x0a38('0x66')][_0x0a38('0x5a')]({'where':{'id':_0x42706c['FaxInteractionId']}});}return null;})[_0x0a38('0x21')](handleEntityNotFound(_0x5d8e79,null))['then'](function(_0x4ad569){if(_0x4ad569){return _0x4ad569['update']({'UserId':_0x1e5cf8[_0x0a38('0x5b')][_0x0a38('0x62')],'read1stAt':_[_0x0a38('0x67')](_0x4ad569[_0x0a38('0x68')])?moment()[_0x0a38('0x60')](_0x0a38('0x61')):undefined});}return null;})[_0x0a38('0x21')](function(_0x26e4c7){if(_0x26e4c7){_0xe02598[_0x0a38('0x69')]=_0x26e4c7[_0x0a38('0x65')]({'plain':!![]});interaction_log[_0x0a38('0x28')](_0x0a38('0x6a'),_0x1e5cf8[_0x0a38('0x63')]['id'],_0x1e5cf8[_0x0a38('0x63')][_0x0a38('0x3b')],_0x1e5cf8['user'][_0x0a38('0x6b')],_0xe02598[_0x0a38('0x69')]['id'],_0x1e5cf8['body']?JSON[_0x0a38('0x6c')](_0x1e5cf8['body']):_0x0a38('0x6d'));return respondWithRpcPromise(_0x0a38('0x6e'),'acceptMessage',_0xe02598);}return null;})[_0x0a38('0x21')](function(_0x13bbf4){var _0x1b0603=_0x0a38('0x6f')+_0x13bbf4[_0x0a38('0x27')][_0x0a38('0x70')];return db['sequelize'][_0x0a38('0x44')](_0x1b0603,{'type':db['Sequelize'][_0x0a38('0x71')]['SELECT'],'raw':!![]})[_0x0a38('0x21')](function(_0x3c540b){return _0x3c540b;});})[_0x0a38('0x21')](function(_0x525fac){if(_0x525fac){_0xe02598[_0x0a38('0x27')]['contact']=_0x525fac[0x0];if(!_0x1e5cf8[_0x0a38('0x5b')]['UserId'])return;return db['User']['find']({'where':{'id':_0x1e5cf8['body'][_0x0a38('0x62')],'role':_0x0a38('0x64')},'attributes':['id',_0x0a38('0x3b'),_0x0a38('0x72'),_0x0a38('0x73'),_0x0a38('0x74')],'raw':!![]});}return null;})[_0x0a38('0x21')](function(_0x5ebac2){if(!_0x5ebac2)return null;_0xe02598[_0x0a38('0x27')][_0x0a38('0x64')]=_0x5ebac2;return _0xe02598;})[_0x0a38('0x21')](function(_0x28734e){if(_0x28734e){if(_0x1e5cf8[_0x0a38('0x5b')][_0x0a38('0x75')]){_0xe02598[_0x0a38('0x27')][_0x0a38('0x76')]=util[_0x0a38('0x60')](_0x0a38('0x77'),_0x1e5cf8[_0x0a38('0x63')][_0x0a38('0x3b')]);_0xe02598['message'][_0x0a38('0x78')]=_0xe02598['channel'];_0xe02598['message'][_0x0a38('0x79')]=_0xe02598[_0x0a38('0x78')];_0xe02598[_0x0a38('0x27')][_0x0a38('0x7a')]=_0x0a38('0x7b');return respondWithRpcPromise(_0x0a38('0x7c'),_0x0a38('0x7c'),{'event':'acceptmessage','message':_0xe02598[_0x0a38('0x27')]},client9002)[_0x0a38('0x21')](function(){return _0xe02598;});}return _0xe02598;}return null;})[_0x0a38('0x21')](respondWithResult(_0x5d8e79,null))[_0x0a38('0x2a')](handleError(_0x5d8e79,null));};var interaction_log=require(_0x0a38('0x13'))('fax-interactions');exports['reject']=function(_0x1630bd,_0x176251,_0x1b8a0c){var _0x4053ad={'agent':{},'channel':_0x0a38('0x7d')};if(_0x1630bd['body']['id']){delete _0x1630bd[_0x0a38('0x5b')]['id'];}_0x1630bd['body']['UserId']=_0x1630bd[_0x0a38('0x5b')][_0x0a38('0x62')]||_0x1630bd[_0x0a38('0x63')]['id'];_0x4053ad[_0x0a38('0x64')]['id']=_0x1630bd[_0x0a38('0x5b')]['UserId'];return db[_0x0a38('0x53')][_0x0a38('0x5a')]({'where':{'id':_0x1630bd[_0x0a38('0x5c')]['id'],'UserId':null}})[_0x0a38('0x21')](handleEntityNotFound(_0x176251,null))[_0x0a38('0x21')](function(_0x310128){if(_0x310128){_0x4053ad[_0x0a38('0x27')]=_0x310128[_0x0a38('0x65')]({'plain':!![]});return db[_0x0a38('0x66')][_0x0a38('0x5a')]({'where':{'id':_0x310128[_0x0a38('0x7e')]}});}return null;})[_0x0a38('0x21')](handleEntityNotFound(_0x176251,null))[_0x0a38('0x21')](function(_0x4cd386){if(_0x4cd386){_0x4053ad[_0x0a38('0x69')]=_0x4cd386[_0x0a38('0x65')]({'plain':!![]});interaction_log[_0x0a38('0x28')](_0x0a38('0x7f'),_0x1630bd[_0x0a38('0x63')]['id'],_0x1630bd['user'][_0x0a38('0x3b')],_0x1630bd[_0x0a38('0x63')][_0x0a38('0x6b')],_0x4053ad['interaction']['id'],_0x1630bd['body']?JSON['stringify'](_0x1630bd[_0x0a38('0x5b')]):_0x0a38('0x6d'));return respondWithRpcPromise(_0x0a38('0x80'),'rejectMessage',_0x4053ad);}return null;})[_0x0a38('0x21')](function(_0x3b6363){var _0x26d5e5=_0x0a38('0x6f')+_0x3b6363['message']['ContactId'];return db[_0x0a38('0x81')][_0x0a38('0x44')](_0x26d5e5,{'type':db[_0x0a38('0x82')]['QueryTypes'][_0x0a38('0x83')],'raw':!![]})['then'](function(_0x2c7769){return _0x2c7769;});})[_0x0a38('0x21')](function(_0x56725e){if(_0x56725e){_0x4053ad[_0x0a38('0x27')][_0x0a38('0x84')]=_0x56725e[0x0];if(!_0x1630bd[_0x0a38('0x5b')]['UserId'])return;return db['User'][_0x0a38('0x5a')]({'where':{'id':_0x1630bd[_0x0a38('0x5b')][_0x0a38('0x62')],'role':_0x0a38('0x64')},'attributes':['id',_0x0a38('0x3b'),_0x0a38('0x72'),_0x0a38('0x73'),'internal'],'raw':!![]});}return null;})[_0x0a38('0x21')](function(_0x1a7fae){if(!_0x1a7fae)return null;_0x4053ad[_0x0a38('0x27')][_0x0a38('0x64')]=_0x1a7fae;return _0x4053ad;})[_0x0a38('0x21')](function(_0x15fa0c){if(_0x15fa0c){_0x15fa0c['message']['interface']=util[_0x0a38('0x60')](_0x0a38('0x77'),_0x1630bd[_0x0a38('0x63')]['name']);_0x15fa0c[_0x0a38('0x27')][_0x0a38('0x78')]=_0x4053ad[_0x0a38('0x78')];_0x15fa0c[_0x0a38('0x27')][_0x0a38('0x79')]=_0x4053ad[_0x0a38('0x78')];_0x15fa0c[_0x0a38('0x27')][_0x0a38('0x7a')]=_0x0a38('0x36');respondWithRpcPromise('EventManager',_0x0a38('0x7c'),{'event':'rejectmessage','message':_0x15fa0c[_0x0a38('0x27')]},client9002);return _0x4053ad;}return null;})[_0x0a38('0x21')](respondWithResult(_0x176251,null))[_0x0a38('0x2a')](handleError(_0x176251,null));};exports['create']=function(_0x40c68e,_0x13550d){var _0x35a132;return db['FaxMessage']['create'](_0x40c68e[_0x0a38('0x5b')],{})[_0x0a38('0x21')](function(_0x3a6118){_0x35a132=_0x3a6118;return db[_0x0a38('0x85')][_0x0a38('0x86')]({'where':{'id':_0x35a132[_0x0a38('0x70')]}});})[_0x0a38('0x21')](function(_0x58f3e4){if(_[_0x0a38('0x67')](_0x58f3e4)){return;}else{_0x35a132[_0x0a38('0x7d')]=_0x58f3e4[_0x0a38('0x7d')];return db['Attachment'][_0x0a38('0x86')]({'where':{'id':_0x35a132['AttachmentId']}});}})[_0x0a38('0x21')](function(_0x4b6f6c){return respondWithRpcPromise(_0x0a38('0x87'),_0x0a38('0x87'),{'FaxAccountId':_['isNil'](_0x40c68e[_0x0a38('0x5b')])?undefined:_0x40c68e['body']['FaxAccountId'],'path':_[_0x0a38('0x67')](_0x4b6f6c)?undefined:util['format'](_0x0a38('0x88'),_0x4b6f6c[_0x0a38('0x89')]),'fax':_[_0x0a38('0x67')](_0x35a132[_0x0a38('0x7d')])?undefined:_0x35a132['fax'],'AttachmentId':_0x35a132[_0x0a38('0x8a')]},client9002);})[_0x0a38('0x21')](respondWithResult(_0x13550d,0xc9))['catch'](handleError(_0x13550d,null));};exports[_0x0a38('0x8b')]=function(_0x47298d,_0x577080){var _0xf4877e=path[_0x0a38('0x8c')](config[_0x0a38('0x8d')],'server',_0x0a38('0x8e'),_0x0a38('0x8f'));return db[_0x0a38('0x53')][_0x0a38('0x5a')]({'where':{'id':_0x47298d[_0x0a38('0x5c')]['id']},'include':[{'model':db[_0x0a38('0x90')],'as':_0x0a38('0x90')}]})[_0x0a38('0x21')](handleEntityNotFound(_0x577080,null))[_0x0a38('0x21')](function(_0x17d096){if(_0x17d096){return _0x577080[_0x0a38('0x8b')](path['join'](_0xf4877e,_0x17d096[_0x0a38('0x90')][_0x0a38('0x89')]));}})[_0x0a38('0x2a')](handleError(_0x577080,null));}; \ No newline at end of file +var _0x91c6=['name','FaxMessage','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','show','keys','rawAttributes','catch','find','params','body','describe','fax-interactions','accept','fax','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','get','FaxInteractionId','isNil','format','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','contact','User','internal','manual','interface','SIP/%s','channel','EventManager','acceptmessage','agent','FaxInteraction','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','rejectMessage','ContactId','fullname','motionChannel','create','CmContact','findOne','Attachment','AttachmentId','SendFax','/var/opt/motion2/server/files/attachments/%s','download','server','files','attachments','join','basename','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','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','info','FaxMessage,\x20%s,\x20%s','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','json','offset','undefined','count','limit','set','apply','reject','save','update','destroy','end','stack'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x91c6,0x17e));var _0x691c=function(_0x3b6895,_0x3f604a){_0x3b6895=_0x3b6895-0x0;var _0xb17f55=_0x91c6[_0x3b6895];return _0xb17f55;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x691c('0x0'));var zipdir=require(_0x691c('0x1'));var jsonpatch=require(_0x691c('0x2'));var rp=require(_0x691c('0x3'));var moment=require(_0x691c('0x4'));var BPromise=require(_0x691c('0x5'));var Mustache=require(_0x691c('0x6'));var util=require(_0x691c('0x7'));var path=require(_0x691c('0x8'));var sox=require(_0x691c('0x9'));var csv=require(_0x691c('0xa'));var ejs=require(_0x691c('0xb'));var fs=require('fs');var fs_extra=require(_0x691c('0xc'));var _=require(_0x691c('0xd'));var squel=require(_0x691c('0xe'));var crypto=require(_0x691c('0xf'));var jsforce=require(_0x691c('0x10'));var deskjs=require(_0x691c('0x11'));var toCsv=require(_0x691c('0xa'));var querystring=require(_0x691c('0x12'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x691c('0x13'));var qs=require(_0x691c('0x14'));var as=require(_0x691c('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x691c('0x16'))(_0x691c('0x17'));var utils=require(_0x691c('0x18'));var config=require(_0x691c('0x19'));var licenseUtil=require(_0x691c('0x1a'));var db=require(_0x691c('0x1b'))['db'];config[_0x691c('0x1c')]=_[_0x691c('0x1d')](config['redis'],{'host':_0x691c('0x1e'),'port':0x18eb});var socket=require(_0x691c('0x1f'))(new Redis(config[_0x691c('0x1c')]));require('./faxMessage.socket')[_0x691c('0x20')](socket);var jayson=require(_0x691c('0x21'));var client=jayson[_0x691c('0x22')][_0x691c('0x23')]({'port':0x232c});var client9002=jayson['client'][_0x691c('0x23')]({'port':0x232a});function respondWithRpcPromise(_0x3ff94c,_0x45b642,_0x1338a4,_0x119867){return new BPromise(function(_0x1db0fd,_0x50f2fe){var _0x53f409=_0x119867||client;return _0x53f409[_0x691c('0x24')](_0x3ff94c,_0x1338a4)[_0x691c('0x25')](function(_0x2ad1ff){logger[_0x691c('0x26')](_0x691c('0x27'),_0x45b642,'request\x20sent');logger[_0x691c('0x28')](_0x691c('0x29'),_0x45b642,'request\x20sent',JSON[_0x691c('0x2a')](_0x2ad1ff));if(_0x2ad1ff['error']){if(_0x2ad1ff[_0x691c('0x2b')][_0x691c('0x2c')]===0x1f4){logger['error']('FaxMessage,\x20%s,\x20%s',_0x45b642,_0x2ad1ff[_0x691c('0x2b')][_0x691c('0x2d')]);return _0x50f2fe(_0x2ad1ff[_0x691c('0x2b')][_0x691c('0x2d')]);}logger['error']('FaxMessage,\x20%s,\x20%s',_0x45b642,_0x2ad1ff[_0x691c('0x2b')][_0x691c('0x2d')]);return _0x1db0fd(_0x2ad1ff[_0x691c('0x2b')][_0x691c('0x2d')]);}else{logger['info'](_0x691c('0x27'),_0x45b642,'request\x20sent');_0x1db0fd(_0x2ad1ff[_0x691c('0x2e')]['message']);}})['catch'](function(_0x1bf6ac){logger[_0x691c('0x2b')]('FaxMessage,\x20%s,\x20%s',_0x45b642,_0x1bf6ac);_0x50f2fe(_0x1bf6ac);});});}function respondWithStatusCode(_0x5ce810,_0x1b6675){_0x1b6675=_0x1b6675||0xcc;return function(_0x37e342){if(_0x37e342){return _0x5ce810[_0x691c('0x2f')](_0x1b6675);}return _0x5ce810[_0x691c('0x30')](_0x1b6675)['end']();};}function respondWithResult(_0x1cfd97,_0x11dd7e){_0x11dd7e=_0x11dd7e||0xc8;return function(_0x232500){if(_0x232500){return _0x1cfd97['status'](_0x11dd7e)[_0x691c('0x31')](_0x232500);}};}function respondWithFilteredResult(_0x1ba65b,_0x1e698b){return function(_0x19018c){if(_0x19018c){var _0x1efd2a=typeof _0x1e698b[_0x691c('0x32')]===_0x691c('0x33')&&typeof _0x1e698b['limit']===_0x691c('0x33');var _0x1df28b=_0x19018c[_0x691c('0x34')];var _0x48aba5=_0x1efd2a?0x0:_0x1e698b['offset'];var _0x4fc347=_0x1efd2a?_0x19018c[_0x691c('0x34')]:_0x1e698b[_0x691c('0x32')]+_0x1e698b[_0x691c('0x35')];var _0x5e314c;if(_0x4fc347>=_0x1df28b){_0x4fc347=_0x1df28b;_0x5e314c=0xc8;}else{_0x5e314c=0xce;}_0x1ba65b[_0x691c('0x30')](_0x5e314c);return _0x1ba65b[_0x691c('0x36')]('Content-Range',_0x48aba5+'-'+_0x4fc347+'/'+_0x1df28b)[_0x691c('0x31')](_0x19018c);}return null;};}function patchUpdates(_0x31782a){return function(_0x437211){try{jsonpatch[_0x691c('0x37')](_0x437211,_0x31782a,!![]);}catch(_0x2921a4){return BPromise[_0x691c('0x38')](_0x2921a4);}return _0x437211[_0x691c('0x39')]();};}function saveUpdates(_0x45c429,_0x50b683){return function(_0x5f2453){if(_0x5f2453){return _0x5f2453[_0x691c('0x3a')](_0x45c429)[_0x691c('0x25')](function(_0x1a65c8){return _0x1a65c8;});}return null;};}function removeEntity(_0x146f1a,_0x56ac75){return function(_0x3878eb){if(_0x3878eb){return _0x3878eb[_0x691c('0x3b')]()['then'](function(){_0x146f1a[_0x691c('0x30')](0xcc)[_0x691c('0x3c')]();});}};}function handleEntityNotFound(_0x53c925,_0x4b99c5){return function(_0x2f77d1){if(!_0x2f77d1){_0x53c925[_0x691c('0x2f')](0x194);}return _0x2f77d1;};}function handleError(_0x579947,_0x40c87d){_0x40c87d=_0x40c87d||0x1f4;return function(_0x134795){logger['error'](_0x134795[_0x691c('0x3d')]);if(_0x134795['name']){delete _0x134795[_0x691c('0x3e')];}_0x579947[_0x691c('0x30')](_0x40c87d)['send'](_0x134795);};}exports['index']=function(_0x2bead9,_0x23b651){var _0x5b5a4b={},_0x3d45e7={},_0x3bda0f={'count':0x0,'rows':[]};var _0x461bdc=_['map'](db[_0x691c('0x3f')]['rawAttributes'],function(_0x21b141){return{'name':_0x21b141[_0x691c('0x40')],'type':_0x21b141[_0x691c('0x41')][_0x691c('0x42')]};});_0x3d45e7[_0x691c('0x43')]=_['map'](_0x461bdc,_0x691c('0x3e'));_0x3d45e7[_0x691c('0x44')]=_['keys'](_0x2bead9[_0x691c('0x44')]);_0x3d45e7[_0x691c('0x45')]=_[_0x691c('0x46')](_0x3d45e7[_0x691c('0x43')],_0x3d45e7['query']);_0x5b5a4b[_0x691c('0x47')]=_['intersection'](_0x3d45e7[_0x691c('0x43')],qs[_0x691c('0x48')](_0x2bead9[_0x691c('0x44')][_0x691c('0x48')]));_0x5b5a4b[_0x691c('0x47')]=_0x5b5a4b[_0x691c('0x47')][_0x691c('0x49')]?_0x5b5a4b[_0x691c('0x47')]:_0x3d45e7[_0x691c('0x43')];if(!_0x2bead9[_0x691c('0x44')][_0x691c('0x4a')](_0x691c('0x4b'))){_0x5b5a4b[_0x691c('0x35')]=qs[_0x691c('0x35')](_0x2bead9['query']['limit']);_0x5b5a4b['offset']=qs['offset'](_0x2bead9['query'][_0x691c('0x32')]);}_0x5b5a4b[_0x691c('0x4c')]=qs['sort'](_0x2bead9[_0x691c('0x44')][_0x691c('0x4d')]);_0x5b5a4b[_0x691c('0x4e')]=qs[_0x691c('0x45')](_['pick'](_0x2bead9['query'],_0x3d45e7['filters']),_0x461bdc);if(_0x2bead9[_0x691c('0x44')][_0x691c('0x4f')]){_0x5b5a4b['where']=_[_0x691c('0x50')](_0x5b5a4b[_0x691c('0x4e')],{'$or':_[_0x691c('0x51')](_0x461bdc,function(_0xb36f5d){if(_0xb36f5d[_0x691c('0x41')]!==_0x691c('0x52')){var _0x409d0b={};_0x409d0b[_0xb36f5d['name']]={'$like':'%'+_0x2bead9['query'][_0x691c('0x4f')]+'%'};return _0x409d0b;}})});}_0x5b5a4b=_[_0x691c('0x50')]({},_0x5b5a4b,_0x2bead9[_0x691c('0x53')]);var _0x1aa4f8={'where':_0x5b5a4b['where']};return db[_0x691c('0x3f')]['count'](_0x1aa4f8)[_0x691c('0x25')](function(_0x3e27d3){_0x3bda0f[_0x691c('0x34')]=_0x3e27d3;if(_0x2bead9[_0x691c('0x44')][_0x691c('0x54')]){_0x5b5a4b[_0x691c('0x55')]=[{'all':!![]}];}return db[_0x691c('0x3f')][_0x691c('0x56')](_0x5b5a4b);})[_0x691c('0x25')](function(_0x56dc83){_0x3bda0f[_0x691c('0x57')]=_0x56dc83;return _0x3bda0f;})[_0x691c('0x25')](respondWithFilteredResult(_0x23b651,_0x5b5a4b))['catch'](handleError(_0x23b651,null));};exports[_0x691c('0x58')]=function(_0x1d28fb,_0x316801){var _0x505038={'raw':!![],'where':{'id':_0x1d28fb['params']['id']}},_0x54143f={};_0x54143f[_0x691c('0x43')]=_[_0x691c('0x59')](db[_0x691c('0x3f')][_0x691c('0x5a')]);_0x54143f[_0x691c('0x44')]=_[_0x691c('0x59')](_0x1d28fb[_0x691c('0x44')]);_0x54143f[_0x691c('0x45')]=_['intersection'](_0x54143f[_0x691c('0x43')],_0x54143f[_0x691c('0x44')]);_0x505038[_0x691c('0x47')]=_[_0x691c('0x46')](_0x54143f[_0x691c('0x43')],qs[_0x691c('0x48')](_0x1d28fb['query'][_0x691c('0x48')]));_0x505038[_0x691c('0x47')]=_0x505038['attributes'][_0x691c('0x49')]?_0x505038[_0x691c('0x47')]:_0x54143f[_0x691c('0x43')];if(_0x1d28fb[_0x691c('0x44')][_0x691c('0x54')]){_0x505038['include']=[{'all':!![]}];}_0x505038=_[_0x691c('0x50')]({},_0x505038,_0x1d28fb[_0x691c('0x53')]);return db[_0x691c('0x3f')]['find'](_0x505038)['then'](handleEntityNotFound(_0x316801,null))[_0x691c('0x25')](respondWithResult(_0x316801,null))[_0x691c('0x5b')](handleError(_0x316801,null));};exports[_0x691c('0x3a')]=function(_0x37a13d,_0x3cd96b){if(_0x37a13d['body']['id']){delete _0x37a13d['body']['id'];}return db[_0x691c('0x3f')][_0x691c('0x5c')]({'where':{'id':_0x37a13d[_0x691c('0x5d')]['id']}})[_0x691c('0x25')](handleEntityNotFound(_0x3cd96b,null))['then'](saveUpdates(_0x37a13d[_0x691c('0x5e')],null))[_0x691c('0x25')](respondWithResult(_0x3cd96b,null))['catch'](handleError(_0x3cd96b,null));};exports[_0x691c('0x3b')]=function(_0x465375,_0x5ca99a){return db[_0x691c('0x3f')][_0x691c('0x5c')]({'where':{'id':_0x465375['params']['id']}})[_0x691c('0x25')](handleEntityNotFound(_0x5ca99a,null))[_0x691c('0x25')](removeEntity(_0x5ca99a,null))[_0x691c('0x5b')](handleError(_0x5ca99a,null));};exports[_0x691c('0x5f')]=function(_0x111155,_0x1c2a75){return db[_0x691c('0x3f')]['describe']()['then'](respondWithResult(_0x1c2a75,null))['catch'](handleError(_0x1c2a75,null));};var interaction_log=require(_0x691c('0x16'))(_0x691c('0x60'));exports[_0x691c('0x61')]=function(_0x4f810f,_0x311046,_0x5ea653){var _0x3ffe79={'agent':{},'channel':_0x691c('0x62')};if(_0x4f810f[_0x691c('0x5e')]['id']){delete _0x4f810f['body']['id'];}_0x4f810f[_0x691c('0x5e')][_0x691c('0x63')]=!![];_0x4f810f['body'][_0x691c('0x64')]=moment()['format'](_0x691c('0x65'));_0x4f810f[_0x691c('0x5e')][_0x691c('0x66')]=_0x4f810f[_0x691c('0x5e')]['UserId']||_0x4f810f['user']['id'];_0x3ffe79['agent']['id']=_0x4f810f[_0x691c('0x5e')][_0x691c('0x66')];return db[_0x691c('0x3f')]['find']({'where':{'id':_0x4f810f['params']['id'],'UserId':null}})[_0x691c('0x25')](handleEntityNotFound(_0x311046,null))[_0x691c('0x25')](saveUpdates(_0x4f810f['body'],null))[_0x691c('0x25')](function(_0xd0be55){if(_0xd0be55){_0x3ffe79[_0x691c('0x2d')]=_0xd0be55[_0x691c('0x67')]({'plain':!![]});return db['FaxInteraction'][_0x691c('0x5c')]({'where':{'id':_0xd0be55[_0x691c('0x68')]}});}return null;})[_0x691c('0x25')](handleEntityNotFound(_0x311046,null))['then'](function(_0x562283){if(_0x562283){return _0x562283[_0x691c('0x3a')]({'UserId':_0x4f810f[_0x691c('0x5e')][_0x691c('0x66')],'read1stAt':_[_0x691c('0x69')](_0x562283['read1stAt'])?moment()[_0x691c('0x6a')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x691c('0x25')](function(_0x4685f2){if(_0x4685f2){_0x3ffe79[_0x691c('0x6b')]=_0x4685f2['get']({'plain':!![]});interaction_log[_0x691c('0x26')](_0x691c('0x6c'),_0x4f810f[_0x691c('0x6d')]['id'],_0x4f810f[_0x691c('0x6d')][_0x691c('0x3e')],_0x4f810f[_0x691c('0x6d')]['role'],_0x3ffe79[_0x691c('0x6b')]['id'],_0x4f810f['body']?JSON[_0x691c('0x2a')](_0x4f810f[_0x691c('0x5e')]):'null');return respondWithRpcPromise(_0x691c('0x6e'),_0x691c('0x6f'),_0x3ffe79);}return null;})['then'](function(_0x133530){var _0x49578a=_0x691c('0x70')+_0x133530['message']['ContactId'];return db[_0x691c('0x71')][_0x691c('0x44')](_0x49578a,{'type':db[_0x691c('0x72')][_0x691c('0x73')][_0x691c('0x74')],'raw':!![]})[_0x691c('0x25')](function(_0x4dbbc5){return _0x4dbbc5;});})['then'](function(_0x29a5c5){if(_0x29a5c5){_0x3ffe79['message'][_0x691c('0x75')]=_0x29a5c5[0x0];if(!_0x4f810f[_0x691c('0x5e')][_0x691c('0x66')])return;return db[_0x691c('0x76')][_0x691c('0x5c')]({'where':{'id':_0x4f810f['body'][_0x691c('0x66')],'role':'agent'},'attributes':['id',_0x691c('0x3e'),'fullname','email',_0x691c('0x77')],'raw':!![]});}return null;})[_0x691c('0x25')](function(_0x264d46){if(!_0x264d46)return null;_0x3ffe79[_0x691c('0x2d')]['agent']=_0x264d46;return _0x3ffe79;})[_0x691c('0x25')](function(_0x5eb89a){if(_0x5eb89a){if(_0x4f810f[_0x691c('0x5e')][_0x691c('0x78')]){_0x3ffe79[_0x691c('0x2d')][_0x691c('0x79')]=util[_0x691c('0x6a')](_0x691c('0x7a'),_0x4f810f[_0x691c('0x6d')][_0x691c('0x3e')]);_0x3ffe79[_0x691c('0x2d')]['channel']=_0x3ffe79['channel'];_0x3ffe79[_0x691c('0x2d')]['motionChannel']=_0x3ffe79[_0x691c('0x7b')];_0x3ffe79[_0x691c('0x2d')]['event']=_0x691c('0x61');return respondWithRpcPromise(_0x691c('0x7c'),_0x691c('0x7c'),{'event':_0x691c('0x7d'),'message':_0x3ffe79[_0x691c('0x2d')]},client9002)[_0x691c('0x25')](function(){return _0x3ffe79;});}return _0x3ffe79;}return null;})[_0x691c('0x25')](respondWithResult(_0x311046,null))[_0x691c('0x5b')](handleError(_0x311046,null));};var interaction_log=require(_0x691c('0x16'))(_0x691c('0x60'));exports[_0x691c('0x38')]=function(_0x289eef,_0x13756f,_0x296ac0){var _0x4a0178={'agent':{},'channel':_0x691c('0x62')};if(_0x289eef['body']['id']){delete _0x289eef[_0x691c('0x5e')]['id'];}_0x289eef[_0x691c('0x5e')][_0x691c('0x66')]=_0x289eef[_0x691c('0x5e')]['UserId']||_0x289eef['user']['id'];_0x4a0178[_0x691c('0x7e')]['id']=_0x289eef[_0x691c('0x5e')]['UserId'];return db[_0x691c('0x3f')][_0x691c('0x5c')]({'where':{'id':_0x289eef['params']['id'],'UserId':null}})[_0x691c('0x25')](handleEntityNotFound(_0x13756f,null))['then'](function(_0x39024d){if(_0x39024d){_0x4a0178[_0x691c('0x2d')]=_0x39024d[_0x691c('0x67')]({'plain':!![]});return db[_0x691c('0x7f')]['find']({'where':{'id':_0x39024d[_0x691c('0x68')]}});}return null;})[_0x691c('0x25')](handleEntityNotFound(_0x13756f,null))['then'](function(_0x361fe6){if(_0x361fe6){_0x4a0178[_0x691c('0x6b')]=_0x361fe6[_0x691c('0x67')]({'plain':!![]});interaction_log[_0x691c('0x26')](_0x691c('0x80'),_0x289eef['user']['id'],_0x289eef[_0x691c('0x6d')][_0x691c('0x3e')],_0x289eef['user'][_0x691c('0x81')],_0x4a0178[_0x691c('0x6b')]['id'],_0x289eef[_0x691c('0x5e')]?JSON[_0x691c('0x2a')](_0x289eef[_0x691c('0x5e')]):_0x691c('0x82'));return respondWithRpcPromise('RejectMessage',_0x691c('0x83'),_0x4a0178);}return null;})[_0x691c('0x25')](function(_0x2d3191){var _0x59ba65='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x2d3191[_0x691c('0x2d')][_0x691c('0x84')];return db[_0x691c('0x71')][_0x691c('0x44')](_0x59ba65,{'type':db[_0x691c('0x72')][_0x691c('0x73')][_0x691c('0x74')],'raw':!![]})['then'](function(_0x30b2b8){return _0x30b2b8;});})[_0x691c('0x25')](function(_0x45fcfb){if(_0x45fcfb){_0x4a0178['message'][_0x691c('0x75')]=_0x45fcfb[0x0];if(!_0x289eef[_0x691c('0x5e')][_0x691c('0x66')])return;return db[_0x691c('0x76')][_0x691c('0x5c')]({'where':{'id':_0x289eef[_0x691c('0x5e')][_0x691c('0x66')],'role':'agent'},'attributes':['id',_0x691c('0x3e'),_0x691c('0x85'),'email',_0x691c('0x77')],'raw':!![]});}return null;})[_0x691c('0x25')](function(_0x548a5f){if(!_0x548a5f)return null;_0x4a0178['message'][_0x691c('0x7e')]=_0x548a5f;return _0x4a0178;})[_0x691c('0x25')](function(_0x2a8713){if(_0x2a8713){_0x2a8713[_0x691c('0x2d')][_0x691c('0x79')]=util[_0x691c('0x6a')](_0x691c('0x7a'),_0x289eef[_0x691c('0x6d')]['name']);_0x2a8713[_0x691c('0x2d')]['channel']=_0x4a0178[_0x691c('0x7b')];_0x2a8713[_0x691c('0x2d')][_0x691c('0x86')]=_0x4a0178[_0x691c('0x7b')];_0x2a8713[_0x691c('0x2d')]['event']=_0x691c('0x38');respondWithRpcPromise(_0x691c('0x7c'),_0x691c('0x7c'),{'event':'rejectmessage','message':_0x2a8713[_0x691c('0x2d')]},client9002);return _0x4a0178;}return null;})['then'](respondWithResult(_0x13756f,null))[_0x691c('0x5b')](handleError(_0x13756f,null));};exports[_0x691c('0x87')]=function(_0x103830,_0x550eab){var _0x3348ef;return db[_0x691c('0x3f')][_0x691c('0x87')](_0x103830[_0x691c('0x5e')],{})[_0x691c('0x25')](function(_0x29e512){_0x3348ef=_0x29e512;return db[_0x691c('0x88')][_0x691c('0x89')]({'where':{'id':_0x3348ef['ContactId']}});})[_0x691c('0x25')](function(_0x1ca1d0){if(_[_0x691c('0x69')](_0x1ca1d0)){return;}else{_0x3348ef[_0x691c('0x62')]=_0x1ca1d0[_0x691c('0x62')];return db[_0x691c('0x8a')][_0x691c('0x89')]({'where':{'id':_0x3348ef[_0x691c('0x8b')]}});}})[_0x691c('0x25')](function(_0x112a36){return respondWithRpcPromise(_0x691c('0x8c'),'SendFax',{'FaxAccountId':_[_0x691c('0x69')](_0x103830[_0x691c('0x5e')])?undefined:_0x103830['body']['FaxAccountId'],'path':_[_0x691c('0x69')](_0x112a36)?undefined:util[_0x691c('0x6a')](_0x691c('0x8d'),_0x112a36['basename']),'fax':_[_0x691c('0x69')](_0x3348ef['fax'])?undefined:_0x3348ef[_0x691c('0x62')],'AttachmentId':_0x3348ef['AttachmentId']},client9002);})[_0x691c('0x25')](respondWithResult(_0x550eab,0xc9))['catch'](handleError(_0x550eab,null));};exports[_0x691c('0x8e')]=function(_0x40989a,_0x223064){var _0x16ebcc=path['join'](config['root'],_0x691c('0x8f'),_0x691c('0x90'),_0x691c('0x91'));return db[_0x691c('0x3f')]['find']({'where':{'id':_0x40989a[_0x691c('0x5d')]['id']},'include':[{'model':db[_0x691c('0x8a')],'as':'Attachment'}]})['then'](handleEntityNotFound(_0x223064,null))[_0x691c('0x25')](function(_0x399a3b){if(_0x399a3b){return _0x223064[_0x691c('0x8e')](path[_0x691c('0x92')](_0x16ebcc,_0x399a3b[_0x691c('0x8a')][_0x691c('0x93')]));}})['catch'](handleError(_0x223064,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index ed2804f..6b4e87b 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 _0x7d37=['FaxMessage','save','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x563f30,_0x5c3d99){var _0x15c1d5=function(_0x15869a){while(--_0x15869a){_0x563f30['push'](_0x563f30['shift']());}};_0x15c1d5(++_0x5c3d99);}(_0x7d37,0x1db));var _0x77d3=function(_0x56bc84,_0x4591e4){_0x56bc84=_0x56bc84-0x0;var _0x28562d=_0x7d37[_0x56bc84];return _0x28562d;};'use strict';var EventEmitter=require(_0x77d3('0x0'));var FaxMessage=require(_0x77d3('0x1'))['db'][_0x77d3('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x77d3('0x3'),'afterUpdate':_0x77d3('0x4'),'afterDestroy':_0x77d3('0x5')};function emitEvent(_0x52c909){return function(_0x293f20,_0x2ae533,_0x59773d){FaxMessageEvents[_0x77d3('0x6')](_0x52c909+':'+_0x293f20['id'],_0x293f20);FaxMessageEvents['emit'](_0x52c909,_0x293f20);_0x59773d(null);};}for(var e in events){if(events[_0x77d3('0x7')](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module[_0x77d3('0x8')]=FaxMessageEvents; \ No newline at end of file +var _0x27eb=['exports','events','../../mysqldb','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x1f3560,_0x262bb7){var _0x37b2f3=function(_0x29c572){while(--_0x29c572){_0x1f3560['push'](_0x1f3560['shift']());}};_0x37b2f3(++_0x262bb7);}(_0x27eb,0xd0));var _0xb27e=function(_0x548aea,_0x24ed9b){_0x548aea=_0x548aea-0x0;var _0x4f504d=_0x27eb[_0x548aea];return _0x4f504d;};'use strict';var EventEmitter=require(_0xb27e('0x0'));var FaxMessage=require(_0xb27e('0x1'))['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb27e('0x2'),'afterUpdate':_0xb27e('0x3'),'afterDestroy':_0xb27e('0x4')};function emitEvent(_0x5c9b37){return function(_0x2ed7d7,_0x1d82eb,_0x2aab8e){FaxMessageEvents[_0xb27e('0x5')](_0x5c9b37+':'+_0x2ed7d7['id'],_0x2ed7d7);FaxMessageEvents['emit'](_0x5c9b37,_0x2ed7d7);_0x2aab8e(null);};}for(var e in events){if(events[_0xb27e('0x6')](e)){var event=events[e];FaxMessage[_0xb27e('0x7')](e,emitEvent(event));}}module[_0xb27e('0x8')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index e8aa51c..fded9ac 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 _0x85a6=['FaxInteractionId','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxMessage.attributes','exports','define','FaxMessage','fax_messages','fti_fax_messages','body','FULLTEXT','get','direction','toLowerCase','out','secret','isNil','UserId','FaxInteraction','findOne'];(function(_0x845041,_0x1c2043){var _0x2f8542=function(_0x4098af){while(--_0x4098af){_0x845041['push'](_0x845041['shift']());}};_0x2f8542(++_0x1c2043);}(_0x85a6,0x17e));var _0x685a=function(_0x2bab91,_0x21116a){_0x2bab91=_0x2bab91-0x0;var _0xd939ea=_0x85a6[_0x2bab91];return _0xd939ea;};'use strict';var _=require(_0x685a('0x0'));var util=require(_0x685a('0x1'));var logger=require('../../config/logger')(_0x685a('0x2'));var moment=require(_0x685a('0x3'));var BPromise=require(_0x685a('0x4'));var rp=require(_0x685a('0x5'));var fs=require('fs');var path=require(_0x685a('0x6'));var rimraf=require(_0x685a('0x7'));var config=require(_0x685a('0x8'));var attributes=require(_0x685a('0x9'));module[_0x685a('0xa')]=function(_0x4fb20a,_0x55c1f2){return _0x4fb20a[_0x685a('0xb')](_0x685a('0xc'),attributes,{'tableName':_0x685a('0xd'),'paranoid':![],'indexes':[{'name':_0x685a('0xe'),'fields':[_0x685a('0xf')],'type':_0x685a('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2396fa,_0x466efa,_0x5432a6){var _0x5c1e80=_0x4fb20a['models'];var _0x2faf35=_0x2396fa[_0x685a('0x11')]({'plain':!![]});if(_0x2faf35[_0x685a('0x12')]['toLowerCase']()==='in'||_0x2faf35[_0x685a('0x12')][_0x685a('0x13')]()===_0x685a('0x14')&&!_0x2faf35[_0x685a('0x15')]&&!_[_0x685a('0x16')](_0x2faf35[_0x685a('0x17')])){_0x5c1e80[_0x685a('0x18')][_0x685a('0x19')]({'where':{'id':_0x2faf35[_0x685a('0x1a')]}})[_0x685a('0x1b')](function(_0x556afc){if(_0x556afc){_0x556afc[_0x685a('0x1c')]({'lastMsgAt':_0x2faf35[_0x685a('0x1d')],'lastMsgDirection':_0x2faf35[_0x685a('0x12')][_0x685a('0x13')]()});}})[_0x685a('0x1e')](function(_0x47803b){console[_0x685a('0x1f')](_0x47803b);});}_0x5432a6();}},'charset':_0x685a('0x20'),'collate':_0x685a('0x21')});}; \ No newline at end of file +var _0xa925=['FaxInteraction','findOne','FaxInteractionId','then','update','catch','error','utf8mb4','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxMessage.attributes','exports','FaxMessage','fti_fax_messages','body','get','direction','toLowerCase','out','secret','isNil','UserId'];(function(_0x1fc356,_0x5de529){var _0x4b5c33=function(_0x44b215){while(--_0x44b215){_0x1fc356['push'](_0x1fc356['shift']());}};_0x4b5c33(++_0x5de529);}(_0xa925,0x158));var _0x5a92=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xa925[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x5a92('0x0'));var util=require('util');var logger=require(_0x5a92('0x1'))('api');var moment=require(_0x5a92('0x2'));var BPromise=require(_0x5a92('0x3'));var rp=require(_0x5a92('0x4'));var fs=require('fs');var path=require(_0x5a92('0x5'));var rimraf=require(_0x5a92('0x6'));var config=require(_0x5a92('0x7'));var attributes=require(_0x5a92('0x8'));module[_0x5a92('0x9')]=function(_0x43d738,_0x4682e7){return _0x43d738['define'](_0x5a92('0xa'),attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':_0x5a92('0xb'),'fields':[_0x5a92('0xc')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3d50e1,_0x5419d2,_0x433147){var _0xf916e2=_0x43d738['models'];var _0x28343c=_0x3d50e1[_0x5a92('0xd')]({'plain':!![]});if(_0x28343c[_0x5a92('0xe')][_0x5a92('0xf')]()==='in'||_0x28343c[_0x5a92('0xe')][_0x5a92('0xf')]()===_0x5a92('0x10')&&!_0x28343c[_0x5a92('0x11')]&&!_[_0x5a92('0x12')](_0x28343c[_0x5a92('0x13')])){_0xf916e2[_0x5a92('0x14')][_0x5a92('0x15')]({'where':{'id':_0x28343c[_0x5a92('0x16')]}})[_0x5a92('0x17')](function(_0x2bfee6){if(_0x2bfee6){_0x2bfee6[_0x5a92('0x18')]({'lastMsgAt':_0x28343c['createdAt'],'lastMsgDirection':_0x28343c[_0x5a92('0xe')][_0x5a92('0xf')]()});}})[_0x5a92('0x19')](function(_0x5e798d){console[_0x5a92('0x1a')](_0x5e798d);});}_0x433147();}},'charset':_0x5a92('0x1b'),'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 bc3897f..e3fe43a 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 _0x6f0d=['../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','./faxMessage.socket','register','request','then','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateFaxMessage','FaxMessage','body','options','raw','UpdateFaxMessage','update','attributes','limit','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x44454f,_0x4bfbe8){var _0x475150=function(_0x1cde13){while(--_0x1cde13){_0x44454f['push'](_0x44454f['shift']());}};_0x475150(++_0x4bfbe8);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x23ae05,_0x26148e){_0x23ae05=_0x23ae05-0x0;var _0x2ff6d1=_0x6f0d[_0x23ae05];return _0x2ff6d1;};'use strict';var _=require('lodash');var util=require(_0xd6f0('0x0'));var moment=require(_0xd6f0('0x1'));var BPromise=require(_0xd6f0('0x2'));var rs=require(_0xd6f0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd6f0('0x4'))['db'];var utils=require(_0xd6f0('0x5'));var logger=require(_0xd6f0('0x6'))(_0xd6f0('0x7'));var config=require(_0xd6f0('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd6f0('0x9')]['http']({'port':0x232a});config[_0xd6f0('0xa')]=_[_0xd6f0('0xb')](config[_0xd6f0('0xa')],{'host':_0xd6f0('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xd6f0('0xd'))[_0xd6f0('0xe')](socket);function respondWithRpcPromise(_0x2854cd,_0x382a2e,_0x225dcf){return new BPromise(function(_0x4db64a,_0x136eee){return client[_0xd6f0('0xf')](_0x2854cd,_0x225dcf)[_0xd6f0('0x10')](function(_0x44bba6){logger['info'](_0xd6f0('0x11'),_0x382a2e,_0xd6f0('0x12'));logger[_0xd6f0('0x13')](_0xd6f0('0x14'),_0x382a2e,_0xd6f0('0x12'),JSON[_0xd6f0('0x15')](_0x44bba6));if(_0x44bba6[_0xd6f0('0x16')]){if(_0x44bba6[_0xd6f0('0x16')][_0xd6f0('0x17')]===0x1f4){logger['error'](_0xd6f0('0x11'),_0x382a2e,_0x44bba6[_0xd6f0('0x16')]['message']);return _0x136eee(_0x44bba6[_0xd6f0('0x16')]['message']);}logger[_0xd6f0('0x16')](_0xd6f0('0x11'),_0x382a2e,_0x44bba6[_0xd6f0('0x16')][_0xd6f0('0x18')]);return _0x4db64a(_0x44bba6[_0xd6f0('0x16')][_0xd6f0('0x18')]);}else{logger[_0xd6f0('0x19')](_0xd6f0('0x11'),_0x382a2e,_0xd6f0('0x12'));_0x4db64a(_0x44bba6[_0xd6f0('0x1a')][_0xd6f0('0x18')]);}})[_0xd6f0('0x1b')](function(_0x327231){logger[_0xd6f0('0x16')](_0xd6f0('0x11'),_0x382a2e,_0x327231);_0x136eee(_0x327231);});});}exports[_0xd6f0('0x1c')]=function(_0x5cd367){var _0x48ac38=this;return new Promise(function(_0x3939aa,_0x264104){return db[_0xd6f0('0x1d')]['create'](_0x5cd367[_0xd6f0('0x1e')],{'raw':_0x5cd367[_0xd6f0('0x1f')]?_0x5cd367['options'][_0xd6f0('0x20')]===undefined?!![]:![]:!![]})['then'](function(_0x1ee584){logger[_0xd6f0('0x19')]('CreateFaxMessage',_0x5cd367);logger[_0xd6f0('0x13')](_0xd6f0('0x1c'),_0x5cd367,JSON['stringify'](_0x1ee584));_0x3939aa(_0x1ee584);})[_0xd6f0('0x1b')](function(_0x402070){logger[_0xd6f0('0x16')]('CreateFaxMessage',_0x402070[_0xd6f0('0x18')],_0x5cd367);_0x264104(_0x48ac38[_0xd6f0('0x16')](0x1f4,_0x402070['message']));});});};exports[_0xd6f0('0x21')]=function(_0x551be8){var _0x2042d5=this;return new Promise(function(_0x3fb5c3,_0x1630dc){return db[_0xd6f0('0x1d')][_0xd6f0('0x22')](_0x551be8[_0xd6f0('0x1e')],{'raw':_0x551be8[_0xd6f0('0x1f')]?_0x551be8[_0xd6f0('0x1f')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x551be8[_0xd6f0('0x1f')]?_0x551be8[_0xd6f0('0x1f')]['where']||null:null,'attributes':_0x551be8[_0xd6f0('0x1f')]?_0x551be8[_0xd6f0('0x1f')][_0xd6f0('0x23')]||null:null,'limit':_0x551be8[_0xd6f0('0x1f')]?_0x551be8[_0xd6f0('0x1f')][_0xd6f0('0x24')]||null:null})[_0xd6f0('0x10')](function(_0x3151f8){logger[_0xd6f0('0x19')](_0xd6f0('0x21'),_0x551be8);logger[_0xd6f0('0x13')](_0xd6f0('0x21'),_0x551be8,JSON[_0xd6f0('0x15')](_0x3151f8));_0x3fb5c3(_0x3151f8);})[_0xd6f0('0x1b')](function(_0xbdd223){logger[_0xd6f0('0x16')](_0xd6f0('0x21'),_0xbdd223[_0xd6f0('0x18')],_0x551be8);_0x1630dc(_0x2042d5[_0xd6f0('0x16')](0x1f4,_0xbdd223[_0xd6f0('0x18')]));});});}; \ No newline at end of file +var _0x9f62=['util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','request','info','request\x20sent','stringify','error','code','FaxMessage,\x20%s,\x20%s','message','result','CreateFaxMessage','FaxMessage','body','raw','then','debug','catch','UpdateFaxMessage','update','options','where','attributes','limit'];(function(_0xc95a63,_0x5f1313){var _0x302d4b=function(_0x1d84e1){while(--_0x1d84e1){_0xc95a63['push'](_0xc95a63['shift']());}};_0x302d4b(++_0x5f1313);}(_0x9f62,0x154));var _0x29f6=function(_0x260257,_0x7d43){_0x260257=_0x260257-0x0;var _0x113848=_0x9f62[_0x260257];return _0x113848;};'use strict';var _=require('lodash');var util=require(_0x29f6('0x0'));var moment=require('moment');var BPromise=require(_0x29f6('0x1'));var rs=require(_0x29f6('0x2'));var fs=require('fs');var Redis=require(_0x29f6('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x29f6('0x4'))(_0x29f6('0x5'));var config=require(_0x29f6('0x6'));var jayson=require(_0x29f6('0x7'));var client=jayson['client'][_0x29f6('0x8')]({'port':0x232a});config[_0x29f6('0x9')]=_[_0x29f6('0xa')](config[_0x29f6('0x9')],{'host':_0x29f6('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./faxMessage.socket')['register'](socket);function respondWithRpcPromise(_0xe25841,_0x44db16,_0x4fb455){return new BPromise(function(_0x5a0724,_0x29b3f5){return client[_0x29f6('0xc')](_0xe25841,_0x4fb455)['then'](function(_0x17b69c){logger[_0x29f6('0xd')]('FaxMessage,\x20%s,\x20%s',_0x44db16,'request\x20sent');logger['debug']('FaxMessage,\x20%s,\x20%s,\x20%s',_0x44db16,_0x29f6('0xe'),JSON[_0x29f6('0xf')](_0x17b69c));if(_0x17b69c[_0x29f6('0x10')]){if(_0x17b69c[_0x29f6('0x10')][_0x29f6('0x11')]===0x1f4){logger[_0x29f6('0x10')](_0x29f6('0x12'),_0x44db16,_0x17b69c[_0x29f6('0x10')][_0x29f6('0x13')]);return _0x29b3f5(_0x17b69c[_0x29f6('0x10')][_0x29f6('0x13')]);}logger[_0x29f6('0x10')](_0x29f6('0x12'),_0x44db16,_0x17b69c[_0x29f6('0x10')][_0x29f6('0x13')]);return _0x5a0724(_0x17b69c[_0x29f6('0x10')][_0x29f6('0x13')]);}else{logger['info']('FaxMessage,\x20%s,\x20%s',_0x44db16,_0x29f6('0xe'));_0x5a0724(_0x17b69c[_0x29f6('0x14')][_0x29f6('0x13')]);}})['catch'](function(_0xcb90){logger[_0x29f6('0x10')]('FaxMessage,\x20%s,\x20%s',_0x44db16,_0xcb90);_0x29b3f5(_0xcb90);});});}exports[_0x29f6('0x15')]=function(_0x3e81af){var _0x42a8fa=this;return new Promise(function(_0x41b9f0,_0xb6e7a9){return db[_0x29f6('0x16')]['create'](_0x3e81af[_0x29f6('0x17')],{'raw':_0x3e81af['options']?_0x3e81af['options'][_0x29f6('0x18')]===undefined?!![]:![]:!![]})[_0x29f6('0x19')](function(_0x39c6b3){logger[_0x29f6('0xd')]('CreateFaxMessage',_0x3e81af);logger[_0x29f6('0x1a')]('CreateFaxMessage',_0x3e81af,JSON[_0x29f6('0xf')](_0x39c6b3));_0x41b9f0(_0x39c6b3);})[_0x29f6('0x1b')](function(_0x4200cc){logger[_0x29f6('0x10')]('CreateFaxMessage',_0x4200cc[_0x29f6('0x13')],_0x3e81af);_0xb6e7a9(_0x42a8fa[_0x29f6('0x10')](0x1f4,_0x4200cc['message']));});});};exports[_0x29f6('0x1c')]=function(_0x45f792){var _0x2519ac=this;return new Promise(function(_0x342038,_0x84ccb7){return db[_0x29f6('0x16')][_0x29f6('0x1d')](_0x45f792['body'],{'raw':_0x45f792[_0x29f6('0x1e')]?_0x45f792[_0x29f6('0x1e')][_0x29f6('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x45f792[_0x29f6('0x1e')]?_0x45f792[_0x29f6('0x1e')][_0x29f6('0x1f')]||null:null,'attributes':_0x45f792[_0x29f6('0x1e')]?_0x45f792[_0x29f6('0x1e')][_0x29f6('0x20')]||null:null,'limit':_0x45f792[_0x29f6('0x1e')]?_0x45f792[_0x29f6('0x1e')][_0x29f6('0x21')]||null:null})[_0x29f6('0x19')](function(_0x304c28){logger[_0x29f6('0xd')](_0x29f6('0x1c'),_0x45f792);logger[_0x29f6('0x1a')]('UpdateFaxMessage',_0x45f792,JSON['stringify'](_0x304c28));_0x342038(_0x304c28);})[_0x29f6('0x1b')](function(_0x489897){logger[_0x29f6('0x10')](_0x29f6('0x1c'),_0x489897[_0x29f6('0x13')],_0x45f792);_0x84ccb7(_0x2519ac[_0x29f6('0x10')](0x1f4,_0x489897['message']));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index f2c1d1e..77aff34 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 _0xc74f=['update','emit','removeListener','register','length','faxMessage:','save','remove'];(function(_0x42bb6d,_0x412255){var _0x1db89b=function(_0x5da43a){while(--_0x5da43a){_0x42bb6d['push'](_0x42bb6d['shift']());}};_0x1db89b(++_0x412255);}(_0xc74f,0xc6));var _0xfc74=function(_0x59f231,_0x2e802){_0x59f231=_0x59f231-0x0;var _0x3afe98=_0xc74f[_0x59f231];return _0x3afe98;};'use strict';var FaxMessageEvents=require('./faxMessage.events');var events=[_0xfc74('0x0'),_0xfc74('0x1'),_0xfc74('0x2')];function createListener(_0x69ef22,_0xced0ff){return function(_0x56c287){_0xced0ff[_0xfc74('0x3')](_0x69ef22,_0x56c287);};}function removeListener(_0x1dd214,_0xf53782){return function(){FaxMessageEvents[_0xfc74('0x4')](_0x1dd214,_0xf53782);};}exports[_0xfc74('0x5')]=function(_0x475e0e){for(var _0x2ab8e9=0x0,_0x5e1d11=events[_0xfc74('0x6')];_0x2ab8e9<_0x5e1d11;_0x2ab8e9++){var _0x437b61=events[_0x2ab8e9];var _0x484293=createListener(_0xfc74('0x7')+_0x437b61,_0x475e0e);FaxMessageEvents['on'](_0x437b61,_0x484293);}}; \ No newline at end of file +var _0xae6e=['emit','length','faxMessage:','./faxMessage.events','save','remove','update'];(function(_0x3bb4b1,_0x304955){var _0x484a33=function(_0xc15388){while(--_0xc15388){_0x3bb4b1['push'](_0x3bb4b1['shift']());}};_0x484a33(++_0x304955);}(_0xae6e,0x10d));var _0xeae6=function(_0x1bdd78,_0x3e6859){_0x1bdd78=_0x1bdd78-0x0;var _0x23799f=_0xae6e[_0x1bdd78];return _0x23799f;};'use strict';var FaxMessageEvents=require(_0xeae6('0x0'));var events=[_0xeae6('0x1'),_0xeae6('0x2'),_0xeae6('0x3')];function createListener(_0x57ad8f,_0x40c80f){return function(_0x6bb3e5){_0x40c80f[_0xeae6('0x4')](_0x57ad8f,_0x6bb3e5);};}function removeListener(_0x3a1f50,_0x3dff80){return function(){FaxMessageEvents['removeListener'](_0x3a1f50,_0x3dff80);};}exports['register']=function(_0x3bc279){for(var _0x55bc40=0x0,_0x35fb1c=events[_0xeae6('0x5')];_0x55bc40<_0x35fb1c;_0x55bc40++){var _0x209cad=events[_0x55bc40];var _0x4fb1c7=createListener(_0xeae6('0x6')+_0x209cad,_0x3bc279);FaxMessageEvents['on'](_0x209cad,_0x4fb1c7);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 319541e..d83af42 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 _0x4ea3=['isAuthenticated','index','/describe','/:id','/:id/download','post','tracked','faxmessage:create','create','put','update','/:id/accept','accept','reject','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','./faxMessage.controller','get'];(function(_0x3adbc4,_0x15d61a){var _0x189096=function(_0x1a16a5){while(--_0x1a16a5){_0x3adbc4['push'](_0x3adbc4['shift']());}};_0x189096(++_0x15d61a);}(_0x4ea3,0x70));var _0x34ea=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x4ea3[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0x34ea('0x0'));var util=require(_0x34ea('0x1'));var path=require(_0x34ea('0x2'));var timeout=require(_0x34ea('0x3'));var express=require('express');var router=express[_0x34ea('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x34ea('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x34ea('0x6'));router[_0x34ea('0x7')]('/',auth[_0x34ea('0x8')](),controller[_0x34ea('0x9')]);router[_0x34ea('0x7')](_0x34ea('0xa'),auth[_0x34ea('0x8')](),controller['describe']);router[_0x34ea('0x7')](_0x34ea('0xb'),auth[_0x34ea('0x8')](),controller['show']);router[_0x34ea('0x7')](_0x34ea('0xc'),auth['isAuthenticated'](),controller['download']);router[_0x34ea('0xd')]('/',auth[_0x34ea('0x8')](),interaction[_0x34ea('0xe')]('fax',_0x34ea('0xf')),controller[_0x34ea('0x10')]);router[_0x34ea('0x11')](_0x34ea('0xb'),auth[_0x34ea('0x8')](),controller[_0x34ea('0x12')]);router[_0x34ea('0x11')](_0x34ea('0x13'),auth[_0x34ea('0x8')](),controller[_0x34ea('0x14')]);router[_0x34ea('0x11')]('/:id/reject',auth[_0x34ea('0x8')](),controller[_0x34ea('0x15')]);router[_0x34ea('0x16')](_0x34ea('0xb'),auth[_0x34ea('0x8')](),controller['destroy']);module[_0x34ea('0x17')]=router; \ No newline at end of file +var _0xe706=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download','post','faxmessage:create','create','put','update','/:id/accept','/:id/reject','delete','destroy','multer','util','path','express','Router'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xe706,0xa3));var _0x6e70=function(_0xb4411,_0x5d04ac){_0xb4411=_0xb4411-0x0;var _0x481db4=_0xe706[_0xb4411];return _0x481db4;};'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('0xa')](_0x6e70('0x11'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x12')]);router[_0x6e70('0x13')]('/',auth[_0x6e70('0xb')](),interaction['tracked']('fax',_0x6e70('0x14')),controller[_0x6e70('0x15')]);router[_0x6e70('0x16')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x17')]);router[_0x6e70('0x16')](_0x6e70('0x18'),auth['isAuthenticated'](),controller['accept']);router['put'](_0x6e70('0x19'),auth['isAuthenticated'](),controller['reject']);router[_0x6e70('0x1a')](_0x6e70('0xf'),auth['isAuthenticated'](),controller[_0x6e70('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 79999d4..38c294a 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 _0x2ad1=['rrmemory','beepall','roundrobin','sequelize','exports','STRING','name','INTEGER','ENUM'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2ad1,0x17d));var _0x12ad=function(_0x31a665,_0x5dc2d8){_0x31a665=_0x31a665-0x0;var _0x4b8239=_0x2ad1[_0x31a665];return _0x4b8239;};'use strict';var Sequelize=require(_0x12ad('0x0'));module[_0x12ad('0x1')]={'name':{'type':Sequelize[_0x12ad('0x2')],'unique':_0x12ad('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x12ad('0x2')]},'timeout':{'type':Sequelize[_0x12ad('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x12ad('0x5')](_0x12ad('0x6'),_0x12ad('0x7'),_0x12ad('0x8')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x12ad('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd70e=['name','STRING','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize'];(function(_0x13e902,_0x161176){var _0x64f89e=function(_0x206b40){while(--_0x206b40){_0x13e902['push'](_0x13e902['shift']());}};_0x64f89e(++_0x161176);}(_0xd70e,0x157));var _0xed70=function(_0x595151,_0x1f1f72){_0x595151=_0x595151-0x0;var _0x5776df=_0xd70e[_0x595151];return _0x5776df;};'use strict';var Sequelize=require(_0xed70('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xed70('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xed70('0x2')]},'timeout':{'type':Sequelize[_0xed70('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xed70('0x4')](_0xed70('0x5'),_0xed70('0x6'),_0xed70('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize['INTEGER'],'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 5ae55c3..035a8aa 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 _0x741c=['sort','pick','filters','FaxQueueId','UserFaxQueue','User','findAndCountAll','UserId','agent','faxPause','updatedAt','format','%s/%s','SIP','Team','filter','options','getTeams','ids','online','voicePause','flatMap','Agents','transaction','each','forEach','emit','userFaxQueue:save','removeTeams','select','field','from','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','QueryTypes','SELECT','every','TeamId','includes','compact','value','isEmpty','removeAgents','userFaxQueue:remove','addAgents','spread','isArray','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/environment','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','sendStatus','status','json','undefined','limit','count','offset','set','update','then','destroy','get','FaxQueues','UserProfileResource','end','error','stack','name','send','index','map','FaxQueue','rawAttributes','key','getOptions','where','include','query','findAll','rows','catch','model','keys','intersection','attributes','fields','length','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','hasOwnProperty','nolimit','order'];(function(_0x29771f,_0x1189ae){var _0x279baf=function(_0xd66325){while(--_0xd66325){_0x29771f['push'](_0x29771f['shift']());}};_0x279baf(++_0x1189ae);}(_0x741c,0x196));var _0xc741=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x741c[_0x42cae2];return _0x5f256f;};'use strict';var BPromise=require(_0xc741('0x0'));var util=require(_0xc741('0x1'));var _=require(_0xc741('0x2'));var squel=require(_0xc741('0x3'));var Redis=require(_0xc741('0x4'));var qs=require(_0xc741('0x5'));var logger=require('../../config/logger')('api');var config=require(_0xc741('0x6'));var db=require('../../mysqldb')['db'];config[_0xc741('0x7')]=_[_0xc741('0x8')](config[_0xc741('0x7')],{'host':_0xc741('0x9'),'port':0x18eb});var socket=require(_0xc741('0xa'))(new Redis(config[_0xc741('0x7')]));require(_0xc741('0xb'))['register'](socket);function respondWithStatusCode(_0x1ad6d9,_0x1f53bf){_0x1f53bf=_0x1f53bf||0xcc;return function(_0x47e0c0){if(_0x47e0c0){return _0x1ad6d9[_0xc741('0xc')](_0x1f53bf);}return _0x1ad6d9['status'](_0x1f53bf)['end']();};}function respondWithResult(_0x286e7d,_0x264cb9){_0x264cb9=_0x264cb9||0xc8;return function(_0x40639b){if(_0x40639b){return _0x286e7d[_0xc741('0xd')](_0x264cb9)[_0xc741('0xe')](_0x40639b);}};}function respondWithFilteredResult(_0x29920b,_0x312684){return function(_0x506b51){if(_0x506b51){var _0x4c8ef0=typeof _0x312684['offset']===_0xc741('0xf')&&typeof _0x312684[_0xc741('0x10')]===_0xc741('0xf');var _0x17e34d=_0x506b51[_0xc741('0x11')];var _0x584b08=_0x4c8ef0?0x0:_0x312684[_0xc741('0x12')];var _0x3d2f62=_0x4c8ef0?_0x506b51['count']:_0x312684[_0xc741('0x12')]+_0x312684[_0xc741('0x10')];var _0xd92df7;if(_0x3d2f62>=_0x17e34d){_0x3d2f62=_0x17e34d;_0xd92df7=0xc8;}else{_0xd92df7=0xce;}_0x29920b[_0xc741('0xd')](_0xd92df7);return _0x29920b[_0xc741('0x13')]('Content-Range',_0x584b08+'-'+_0x3d2f62+'/'+_0x17e34d)['json'](_0x506b51);}return null;};}function saveUpdates(_0x341f54){return function(_0x4fed6b){if(_0x4fed6b){return _0x4fed6b[_0xc741('0x14')](_0x341f54)[_0xc741('0x15')](function(_0x575184){return _0x575184;});}return null;};}function removeEntity(_0x552ecf){return function(_0xebabc8){if(_0xebabc8){return _0xebabc8[_0xc741('0x16')]()[_0xc741('0x15')](function(){var _0x498a5f=_0xebabc8[_0xc741('0x17')]({'plain':!![]});var _0x7ff09a=_0xc741('0x18');return db[_0xc741('0x19')][_0xc741('0x16')]({'where':{'type':_0x7ff09a,'resourceId':_0x498a5f['id']}})[_0xc741('0x15')](function(){return _0xebabc8;});})[_0xc741('0x15')](function(){_0x552ecf[_0xc741('0xd')](0xcc)[_0xc741('0x1a')]();});}};}function handleEntityNotFound(_0x5668d5){return function(_0x26bf01){if(!_0x26bf01){_0x5668d5['sendStatus'](0x194);}return _0x26bf01;};}function handleError(_0x212c67,_0x4b5b31){_0x4b5b31=_0x4b5b31||0x1f4;return function(_0xd498b){logger[_0xc741('0x1b')](_0xd498b[_0xc741('0x1c')]);if(_0xd498b['name']){delete _0xd498b[_0xc741('0x1d')];}_0x212c67['status'](_0x4b5b31)[_0xc741('0x1e')](_0xd498b);};}exports[_0xc741('0x1f')]=function(_0x3a2d64,_0x58af82){var _0x53bdad={};var _0x4ac9e3={'count':0x0,'rows':[]};var _0x178a57=_[_0xc741('0x20')](db[_0xc741('0x21')][_0xc741('0x22')],function(_0x1f8723){return{'name':_0x1f8723['fieldName'],'type':_0x1f8723['type'][_0xc741('0x23')]};});_0x53bdad=qs[_0xc741('0x24')](_0x178a57,_0x3a2d64);var _0x102408={'where':_0x53bdad[_0xc741('0x25')]};return db[_0xc741('0x21')][_0xc741('0x11')](_0x102408)['then'](function(_0x353729){_0x4ac9e3[_0xc741('0x11')]=_0x353729;_0x53bdad['include']=qs[_0xc741('0x26')](_0x3a2d64[_0xc741('0x27')]);return db[_0xc741('0x21')][_0xc741('0x28')](_0x53bdad);})[_0xc741('0x15')](function(_0x3bb9b1){_0x4ac9e3[_0xc741('0x29')]=_0x3bb9b1;return _0x4ac9e3;})[_0xc741('0x15')](respondWithFilteredResult(_0x58af82,_0x53bdad))[_0xc741('0x2a')](handleError(_0x58af82,null));};exports['show']=function(_0x3094de,_0x51a4c4){var _0xbf2274={'raw':!![],'where':{'id':_0x3094de['params']['id']}},_0x520f80={};_0x520f80[_0xc741('0x2b')]=_[_0xc741('0x2c')](db[_0xc741('0x21')]['rawAttributes']);_0x520f80[_0xc741('0x27')]=_[_0xc741('0x2c')](_0x3094de[_0xc741('0x27')]);_0x520f80['filters']=_[_0xc741('0x2d')](_0x520f80[_0xc741('0x2b')],_0x520f80[_0xc741('0x27')]);_0xbf2274[_0xc741('0x2e')]=_[_0xc741('0x2d')](_0x520f80[_0xc741('0x2b')],qs[_0xc741('0x2f')](_0x3094de['query']['fields']));_0xbf2274[_0xc741('0x2e')]=_0xbf2274[_0xc741('0x2e')][_0xc741('0x30')]?_0xbf2274[_0xc741('0x2e')]:_0x520f80[_0xc741('0x2b')];if(_0x3094de[_0xc741('0x27')]['includeAll']){_0xbf2274[_0xc741('0x26')]=[{'all':!![]}];}_0xbf2274=_[_0xc741('0x31')]({},_0xbf2274,_0x3094de['options']);return db[_0xc741('0x21')][_0xc741('0x32')](_0xbf2274)[_0xc741('0x15')](handleEntityNotFound(_0x51a4c4,null))['then'](respondWithResult(_0x51a4c4,null))[_0xc741('0x2a')](handleError(_0x51a4c4,null));};exports[_0xc741('0x33')]=function(_0x85e752,_0x39e9fb){return db[_0xc741('0x21')][_0xc741('0x33')](_0x85e752[_0xc741('0x34')],{})['then'](function(_0x179105){var _0xafe7e7=_0x85e752[_0xc741('0x35')][_0xc741('0x17')]({'plain':!![]});if(!_0xafe7e7)throw new Error(_0xc741('0x36'));if(_0xafe7e7[_0xc741('0x37')]===_0xc741('0x35')){var _0x207fcc=_0x179105['get']({'plain':!![]});var _0x3467b9=_0xc741('0x18');return db[_0xc741('0x38')][_0xc741('0x32')]({'where':{'name':_0x3467b9,'userProfileId':_0xafe7e7['userProfileId']},'raw':!![]})[_0xc741('0x15')](function(_0x51ba7a){if(_0x51ba7a&&_0x51ba7a[_0xc741('0x39')]===0x0){return db[_0xc741('0x19')][_0xc741('0x33')]({'name':_0x207fcc['name'],'resourceId':_0x207fcc['id'],'type':_0x51ba7a['name'],'sectionId':_0x51ba7a['id']},{})[_0xc741('0x15')](function(){return _0x179105;});}else{return _0x179105;}})[_0xc741('0x2a')](function(_0x38087f){logger[_0xc741('0x1b')](_0xc741('0x3a'),_0x38087f);throw _0x38087f;});}return _0x179105;})[_0xc741('0x15')](respondWithResult(_0x39e9fb,0xc9))[_0xc741('0x2a')](handleError(_0x39e9fb,null));};exports[_0xc741('0x14')]=function(_0x149a5e,_0x2542aa){if(_0x149a5e[_0xc741('0x34')]['id']){delete _0x149a5e[_0xc741('0x34')]['id'];}return db[_0xc741('0x21')][_0xc741('0x32')]({'where':{'id':_0x149a5e[_0xc741('0x3b')]['id']}})[_0xc741('0x15')](handleEntityNotFound(_0x2542aa,null))[_0xc741('0x15')](saveUpdates(_0x149a5e['body'],null))[_0xc741('0x15')](respondWithResult(_0x2542aa,null))['catch'](handleError(_0x2542aa,null));};exports[_0xc741('0x16')]=function(_0x59bab2,_0x3ce7b4){return db[_0xc741('0x21')]['find']({'where':{'id':_0x59bab2[_0xc741('0x3b')]['id']}})[_0xc741('0x15')](handleEntityNotFound(_0x3ce7b4,null))['then'](removeEntity(_0x3ce7b4,null))[_0xc741('0x2a')](handleError(_0x3ce7b4,null));};exports[_0xc741('0x3c')]=function(_0x3eb832,_0x249b8e){return db[_0xc741('0x21')][_0xc741('0x3c')]()[_0xc741('0x15')](respondWithResult(_0x249b8e,null))['catch'](handleError(_0x249b8e,null));};exports[_0xc741('0x3d')]=function(_0x4ce649,_0x47ac55){var _0x61bfc7={'raw':!![],'where':{}},_0x47db64={},_0x113c1e;return db[_0xc741('0x21')][_0xc741('0x3e')]({'where':{'id':_0x4ce649[_0xc741('0x3b')]['id']}})[_0xc741('0x15')](handleEntityNotFound(_0x47ac55,null))[_0xc741('0x15')](function(_0x46c7c8){if(_0x46c7c8){_0x113c1e=_0x46c7c8[_0xc741('0x17')]({'plain':!![]});_0x47db64[_0xc741('0x2b')]=_['keys'](db['UserFaxQueue'][_0xc741('0x22')]);_0x47db64[_0xc741('0x27')]=_[_0xc741('0x2c')](_0x4ce649[_0xc741('0x27')]);_0x47db64['filters']=_[_0xc741('0x2d')](_0x47db64['model'],_0x47db64[_0xc741('0x27')]);_0x61bfc7[_0xc741('0x2e')]=_[_0xc741('0x2d')](_0x47db64[_0xc741('0x2b')],qs[_0xc741('0x2f')](_0x4ce649[_0xc741('0x27')][_0xc741('0x2f')]));_0x61bfc7[_0xc741('0x2e')]=_0x61bfc7[_0xc741('0x2e')][_0xc741('0x30')]?_0x61bfc7[_0xc741('0x2e')]:_0x47db64[_0xc741('0x2b')];if(!_0x4ce649['query'][_0xc741('0x3f')](_0xc741('0x40'))){_0x61bfc7[_0xc741('0x10')]=qs['limit'](_0x4ce649[_0xc741('0x27')][_0xc741('0x10')]);_0x61bfc7[_0xc741('0x12')]=qs[_0xc741('0x12')](_0x4ce649['query'][_0xc741('0x12')]);}_0x61bfc7[_0xc741('0x41')]=qs[_0xc741('0x42')](_0x4ce649[_0xc741('0x27')]['sort']);_0x61bfc7[_0xc741('0x25')]=qs['filters'](_[_0xc741('0x43')](_0x4ce649[_0xc741('0x27')],_0x47db64[_0xc741('0x44')]));_0x61bfc7[_0xc741('0x25')][_0xc741('0x45')]=_0x46c7c8['id'];if(_0x4ce649[_0xc741('0x27')]['filter']){_0x61bfc7[_0xc741('0x25')]=_['merge'](_0x61bfc7[_0xc741('0x25')],{'$or':_[_0xc741('0x20')](_0x61bfc7[_0xc741('0x2e')],function(_0x1d15f9){var _0x168076={};_0x168076[_0x1d15f9]={'$like':'%'+_0x4ce649['query']['filter']+'%'};return _0x168076;})});}_0x61bfc7=_[_0xc741('0x31')]({},_0x61bfc7,_0x4ce649['options']);return db[_0xc741('0x46')][_0xc741('0x28')](_0x61bfc7);}})[_0xc741('0x15')](function(_0x168232){if(_0x168232){return db[_0xc741('0x47')][_0xc741('0x48')]({'where':{'id':_[_0xc741('0x20')](_0x168232,_0xc741('0x49')),'role':_0xc741('0x4a')},'attributes':['id',_0xc741('0x1d'),_0xc741('0x4b'),_0xc741('0x4c'),'createdAt']});}})['then'](function(_0x193a21){if(_0x193a21){return{'count':_0x193a21[_0xc741('0x11')],'rows':_[_0xc741('0x20')](_0x193a21['rows'],function(_0x53b2db){return{'membername':_0x53b2db[_0xc741('0x1d')],'UserId':_0x53b2db['id'],'queue_name':_0x113c1e['name'],'FaxQueueId':_0x113c1e['id'],'interface':util[_0xc741('0x4d')](_0xc741('0x4e'),_0xc741('0x4f'),_0x53b2db[_0xc741('0x1d')]),'penalty':0x0,'paused':_0x53b2db[_0xc741('0x4b')],'createdAt':_0x53b2db['createdAt'],'updatedAt':_0x53b2db['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xc741('0x15')](respondWithFilteredResult(_0x47ac55,_0x61bfc7))[_0xc741('0x2a')](handleError(_0x47ac55,null));};exports['getTeams']=function(_0xffe066,_0x27d8e2){var _0x42e3e0={};var _0x278944={};var _0x4504c8;var _0x523324;return db['FaxQueue'][_0xc741('0x3e')]({'where':{'id':_0xffe066['params']['id']}})[_0xc741('0x15')](handleEntityNotFound(_0x27d8e2,null))[_0xc741('0x15')](function(_0x553284){if(_0x553284){_0x4504c8=_0x553284;_0x278944[_0xc741('0x2b')]=_[_0xc741('0x2c')](db[_0xc741('0x50')][_0xc741('0x22')]);_0x278944[_0xc741('0x27')]=_[_0xc741('0x2c')](_0xffe066[_0xc741('0x27')]);_0x278944['filters']=_[_0xc741('0x2d')](_0x278944[_0xc741('0x2b')],_0x278944['query']);_0x42e3e0[_0xc741('0x2e')]=_[_0xc741('0x2d')](_0x278944[_0xc741('0x2b')],qs['fields'](_0xffe066[_0xc741('0x27')][_0xc741('0x2f')]));_0x42e3e0['attributes']=_0x42e3e0[_0xc741('0x2e')][_0xc741('0x30')]?_0x42e3e0[_0xc741('0x2e')]:_0x278944[_0xc741('0x2b')];_0x42e3e0['order']=qs['sort'](_0xffe066[_0xc741('0x27')]['sort']);_0x42e3e0[_0xc741('0x25')]=qs[_0xc741('0x44')](_[_0xc741('0x43')](_0xffe066[_0xc741('0x27')],_0x278944[_0xc741('0x44')]));if(_0xffe066[_0xc741('0x27')]['filter']){_0x42e3e0[_0xc741('0x25')]=_['merge'](_0x42e3e0[_0xc741('0x25')],{'$or':_[_0xc741('0x20')](_0x42e3e0[_0xc741('0x2e')],function(_0x73a732){var _0x57ed58={};_0x57ed58[_0x73a732]={'$like':'%'+_0xffe066[_0xc741('0x27')][_0xc741('0x51')]+'%'};return _0x57ed58;})});}_0x42e3e0=_[_0xc741('0x31')]({},_0x42e3e0,_0xffe066[_0xc741('0x52')]);return _0x4504c8[_0xc741('0x53')](_0x42e3e0);}})[_0xc741('0x15')](function(_0x2e64a1){if(_0x2e64a1){_0x523324=_0x2e64a1[_0xc741('0x30')];if(!_0xffe066[_0xc741('0x27')]['hasOwnProperty']('nolimit')){_0x42e3e0[_0xc741('0x10')]=qs[_0xc741('0x10')](_0xffe066[_0xc741('0x27')][_0xc741('0x10')]);_0x42e3e0['offset']=qs[_0xc741('0x12')](_0xffe066[_0xc741('0x27')][_0xc741('0x12')]);}return _0x4504c8[_0xc741('0x53')](_0x42e3e0);}})[_0xc741('0x15')](function(_0x2cc7b0){if(_0x2cc7b0){return _0x2cc7b0?{'count':_0x523324,'rows':_0x2cc7b0}:null;}})[_0xc741('0x15')](respondWithResult(_0x27d8e2,null))[_0xc741('0x2a')](handleError(_0x27d8e2,null));};exports['addTeams']=function(_0x3f51ab,_0x5db0e8){var _0x549976=_0x3f51ab[_0xc741('0x34')][_0xc741('0x54')];return db['Team'][_0xc741('0x28')]({'where':{'id':_0x549976},'attributes':['id'],'include':[{'model':db[_0xc741('0x47')],'as':'Agents','attributes':['id','name',_0xc741('0x55'),_0xc741('0x56'),'interface'],'raw':!![]}]})[_0xc741('0x15')](function(_0x1419dd){if(_0x1419dd){var _0x35a0ef=_[_0xc741('0x57')](_0x1419dd,function(_0x3945f1){var _0x3fa7e3=_0x3945f1[_0xc741('0x17')]({'plain':!![]});return _0x3fa7e3[_0xc741('0x58')];});return db['FaxQueue'][_0xc741('0x32')]({'where':{'id':_0x3f51ab[_0xc741('0x3b')]['id']}})[_0xc741('0x15')](function(_0x1c63ab){return db['sequelize'][_0xc741('0x59')](function(_0x904c8d){return _0x1c63ab['addTeams'](_0x549976,{'transaction':_0x904c8d})[_0xc741('0x15')](function(){return BPromise[_0xc741('0x5a')](_0x35a0ef,function(_0xac6b3a){return db[_0xc741('0x46')]['findOrCreate']({'where':{'UserId':_0xac6b3a['id'],'FaxQueueId':_0x3f51ab['params']['id']},'transaction':_0x904c8d});});})['then'](function(){_0x35a0ef[_0xc741('0x5b')](function(_0x1413e3){socket[_0xc741('0x5c')](_0xc741('0x5d'),{'UserId':_0x1413e3['id'],'FaxQueueId':_0x1c63ab['id']});});});});});}})['then'](respondWithStatusCode(_0x5db0e8,null))[_0xc741('0x2a')](handleError(_0x5db0e8,null));};exports[_0xc741('0x5e')]=function(_0x4f79b3,_0x4f9256){return db[_0xc741('0x50')][_0xc741('0x28')]({'where':{'id':_0x4f79b3[_0xc741('0x27')]['ids']},'attributes':['id'],'include':[{'model':db[_0xc741('0x47')],'as':_0xc741('0x58'),'attributes':['id'],'raw':!![]}]})[_0xc741('0x15')](handleEntityNotFound(_0x4f9256,null))['then'](function(_0x4a3c3a){var _0x58b414=_[_0xc741('0x20')](_0x4a3c3a,'id');var _0x3eb05f=[];var _0x598499=[];var _0x4983a1=squel[_0xc741('0x5f')]();_0x4983a1[_0xc741('0x60')]('tq.TeamId')[_0xc741('0x61')]('team_has_fax_queues','tq')['join']('user_has_teams','ut',_0xc741('0x62'))[_0xc741('0x25')](_0xc741('0x63'),_0x4f79b3[_0xc741('0x3b')]['id']);for(var _0x59822a=0x0;_0x59822a<_0x4a3c3a[_0xc741('0x30')];_0x59822a+=0x1){let _0x575f7c=_0x4a3c3a[_0x59822a];for(var _0x499b6d=0x0;_0x499b6d<_0x575f7c['Agents']['length'];_0x499b6d+=0x1){let _0x17024b=_0x575f7c[_0xc741('0x58')][_0x499b6d];var _0x4bb1df=_0x4983a1[_0xc741('0x64')]();_0x4bb1df[_0xc741('0x25')](_0xc741('0x65'),_0x17024b['id']);_0x598499[_0xc741('0x66')](db[_0xc741('0x67')][_0xc741('0x27')](_0x4bb1df['toString'](),{'type':db[_0xc741('0x67')][_0xc741('0x68')][_0xc741('0x69')]})[_0xc741('0x15')](function(_0x31dfca){if(_0x31dfca[_0xc741('0x30')]===0x1){return _0x17024b['id'];}else{var _0x3e254b=_[_0xc741('0x6a')](_[_0xc741('0x20')](_0x31dfca,_0xc741('0x6b')),function(_0x39d72a){return _[_0xc741('0x6c')](_0x58b414,_0x39d72a);});if(_0x3e254b){return _0x17024b['id'];}}}));}}return BPromise['all'](_0x598499)['then'](function(_0x47e71d){_0x3eb05f=_(_0x3eb05f)['union'](_0x47e71d)[_0xc741('0x6d')]()[_0xc741('0x6e')]();return db[_0xc741('0x21')][_0xc741('0x32')]({'where':{'id':_0x4f79b3[_0xc741('0x3b')]['id']}})[_0xc741('0x15')](function(_0x2b695e){return db[_0xc741('0x67')][_0xc741('0x59')](function(_0x686ae4){return _0x2b695e[_0xc741('0x5e')](_0x4f79b3[_0xc741('0x27')][_0xc741('0x54')],{'transaction':_0x686ae4})['then'](function(){if(!_[_0xc741('0x6f')](_0x3eb05f)){return _0x2b695e[_0xc741('0x70')](_0x3eb05f,{'transaction':_0x686ae4});}})[_0xc741('0x15')](function(){_0x3eb05f[_0xc741('0x5b')](function(_0x320b7e){socket[_0xc741('0x5c')](_0xc741('0x71'),{'UserId':_0x320b7e,'FaxQueueId':_0x2b695e['id']});});});});});});})[_0xc741('0x15')](respondWithStatusCode(_0x4f9256,null))[_0xc741('0x2a')](handleError(_0x4f9256,null));};exports[_0xc741('0x72')]=function(_0x1b095e,_0x26ccbb){return db['FaxQueue'][_0xc741('0x32')]({'where':{'id':_0x1b095e[_0xc741('0x3b')]['id']}})[_0xc741('0x15')](handleEntityNotFound(_0x26ccbb,null))['then'](function(_0x135b9c){if(_0x135b9c){return _0x135b9c[_0xc741('0x72')](_0x1b095e['body'][_0xc741('0x54')],_['omit'](_0x1b095e[_0xc741('0x34')],[_0xc741('0x54'),'id'])||{})[_0xc741('0x73')](function(_0x56a716){for(var _0xbc6f18=0x0;_0xbc6f18<_0x1b095e[_0xc741('0x34')]['ids']['length'];_0xbc6f18+=0x1){socket[_0xc741('0x5c')](_0xc741('0x5d'),{'UserId':Number(_0x1b095e[_0xc741('0x34')][_0xc741('0x54')][_0xbc6f18]),'FaxQueueId':Number(_0x1b095e['params']['id'])});}return _0x56a716;});}})[_0xc741('0x15')](respondWithResult(_0x26ccbb,null))[_0xc741('0x2a')](handleError(_0x26ccbb,null));};exports[_0xc741('0x70')]=function(_0x50e4b3,_0x2862c2){return db[_0xc741('0x21')][_0xc741('0x32')]({'where':{'id':_0x50e4b3['params']['id']}})[_0xc741('0x15')](handleEntityNotFound(_0x2862c2,null))[_0xc741('0x15')](function(_0x466b7e){if(_0x466b7e){return _0x466b7e[_0xc741('0x70')](_0x50e4b3[_0xc741('0x27')][_0xc741('0x54')])['then'](function(){if(_[_0xc741('0x74')](_0x50e4b3[_0xc741('0x27')]['ids'])){for(var _0x4c1a69=0x0;_0x4c1a69<_0x50e4b3[_0xc741('0x27')][_0xc741('0x54')]['length'];_0x4c1a69+=0x1){socket[_0xc741('0x5c')](_0xc741('0x71'),{'UserId':Number(_0x50e4b3[_0xc741('0x27')][_0xc741('0x54')][_0x4c1a69]),'FaxQueueId':Number(_0x50e4b3[_0xc741('0x3b')]['id'])});}}else{socket[_0xc741('0x5c')](_0xc741('0x71'),{'UserId':Number(_0x50e4b3[_0xc741('0x27')][_0xc741('0x54')]),'FaxQueueId':Number(_0x50e4b3[_0xc741('0x3b')]['id'])});}});}})[_0xc741('0x15')](respondWithStatusCode(_0x2862c2,null))['catch'](handleError(_0x2862c2,null));};exports['getAgents']=function(_0x2274fb,_0x1e6cb8){var _0x1660dc={};var _0x54afc8={};var _0x185518;var _0x5b75a6;return db[_0xc741('0x21')][_0xc741('0x3e')]({'where':{'id':_0x2274fb['params']['id']}})['then'](handleEntityNotFound(_0x1e6cb8,null))[_0xc741('0x15')](function(_0x4c15af){if(_0x4c15af){_0x185518=_0x4c15af;_0x54afc8[_0xc741('0x2b')]=_[_0xc741('0x2c')](db[_0xc741('0x47')][_0xc741('0x22')]);_0x54afc8[_0xc741('0x27')]=_[_0xc741('0x2c')](_0x2274fb[_0xc741('0x27')]);_0x54afc8[_0xc741('0x44')]=_['intersection'](_0x54afc8[_0xc741('0x2b')],_0x54afc8['query']);_0x1660dc[_0xc741('0x2e')]=_[_0xc741('0x2d')](_0x54afc8[_0xc741('0x2b')],qs[_0xc741('0x2f')](_0x2274fb[_0xc741('0x27')][_0xc741('0x2f')]));_0x1660dc[_0xc741('0x2e')]=_0x1660dc[_0xc741('0x2e')][_0xc741('0x30')]?_0x1660dc['attributes']:_0x54afc8[_0xc741('0x2b')];_0x1660dc[_0xc741('0x41')]=qs[_0xc741('0x42')](_0x2274fb['query'][_0xc741('0x42')]);_0x1660dc[_0xc741('0x25')]=qs['filters'](_[_0xc741('0x43')](_0x2274fb['query'],_0x54afc8[_0xc741('0x44')]));if(_0x2274fb['query'][_0xc741('0x51')]){_0x1660dc[_0xc741('0x25')]=_[_0xc741('0x31')](_0x1660dc[_0xc741('0x25')],{'$or':_[_0xc741('0x20')](_0x1660dc['attributes'],function(_0xe3f850){var _0xc2dca3={};_0xc2dca3[_0xe3f850]={'$like':'%'+_0x2274fb[_0xc741('0x27')][_0xc741('0x51')]+'%'};return _0xc2dca3;})});}_0x1660dc=_['merge']({},_0x1660dc,_0x2274fb[_0xc741('0x52')]);return _0x185518[_0xc741('0x75')](_0x1660dc);}})[_0xc741('0x15')](function(_0x3c466e){if(_0x3c466e){_0x5b75a6=_0x3c466e[_0xc741('0x30')];if(!_0x2274fb[_0xc741('0x27')][_0xc741('0x3f')](_0xc741('0x40'))){_0x1660dc['limit']=qs[_0xc741('0x10')](_0x2274fb[_0xc741('0x27')][_0xc741('0x10')]);_0x1660dc['offset']=qs[_0xc741('0x12')](_0x2274fb[_0xc741('0x27')][_0xc741('0x12')]);}return _0x185518[_0xc741('0x75')](_0x1660dc);}})[_0xc741('0x15')](function(_0x5be24d){if(_0x5be24d){return _0x5be24d?{'count':_0x5b75a6,'rows':_0x5be24d}:null;}})[_0xc741('0x15')](respondWithResult(_0x1e6cb8,null))[_0xc741('0x2a')](handleError(_0x1e6cb8,null));}; \ No newline at end of file +var _0x1a61=['every','TeamId','all','union','compact','value','isEmpty','removeAgents','forEach','userFaxQueue:remove','addAgents','omit','spread','getAgents','bluebird','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','json','offset','undefined','count','status','set','Content-Range','update','then','destroy','get','FaxQueues','UserProfileResource','end','name','send','index','map','FaxQueue','rawAttributes','fieldName','type','key','getOptions','where','include','query','findAll','show','model','keys','intersection','attributes','fields','length','includeAll','merge','options','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','UserFaxQueue','filters','hasOwnProperty','limit','sort','pick','FaxQueueId','filter','User','findAndCountAll','agent','faxPause','createdAt','rows','format','SIP','updatedAt','getTeams','findOne','Team','order','nolimit','ids','flatMap','Agents','sequelize','transaction','findOrCreate','emit','userFaxQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_fax_queues','join','user_has_teams','FaxQueueId\x20=\x20?','clone','push','QueryTypes','SELECT'];(function(_0x5d8af8,_0x25d888){var _0x531705=function(_0x17a466){while(--_0x17a466){_0x5d8af8['push'](_0x5d8af8['shift']());}};_0x531705(++_0x25d888);}(_0x1a61,0x1e6));var _0x11a6=function(_0x197965,_0x38acbf){_0x197965=_0x197965-0x0;var _0x7222c6=_0x1a61[_0x197965];return _0x7222c6;};'use strict';var BPromise=require(_0x11a6('0x0'));var util=require('util');var _=require(_0x11a6('0x1'));var squel=require('squel');var Redis=require(_0x11a6('0x2'));var qs=require(_0x11a6('0x3'));var logger=require(_0x11a6('0x4'))(_0x11a6('0x5'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x11a6('0x6')]=_[_0x11a6('0x7')](config['redis'],{'host':_0x11a6('0x8'),'port':0x18eb});var socket=require(_0x11a6('0x9'))(new Redis(config[_0x11a6('0x6')]));require(_0x11a6('0xa'))[_0x11a6('0xb')](socket);function respondWithStatusCode(_0x33b9b4,_0x2b8dd4){_0x2b8dd4=_0x2b8dd4||0xcc;return function(_0x1dbfcc){if(_0x1dbfcc){return _0x33b9b4[_0x11a6('0xc')](_0x2b8dd4);}return _0x33b9b4['status'](_0x2b8dd4)['end']();};}function respondWithResult(_0x522315,_0xf7f73d){_0xf7f73d=_0xf7f73d||0xc8;return function(_0x3cf410){if(_0x3cf410){return _0x522315['status'](_0xf7f73d)[_0x11a6('0xd')](_0x3cf410);}};}function respondWithFilteredResult(_0x91835f,_0x172908){return function(_0x16486f){if(_0x16486f){var _0x12c976=typeof _0x172908[_0x11a6('0xe')]==='undefined'&&typeof _0x172908['limit']===_0x11a6('0xf');var _0x318253=_0x16486f['count'];var _0x1d3123=_0x12c976?0x0:_0x172908[_0x11a6('0xe')];var _0x5158ea=_0x12c976?_0x16486f[_0x11a6('0x10')]:_0x172908[_0x11a6('0xe')]+_0x172908['limit'];var _0x345c70;if(_0x5158ea>=_0x318253){_0x5158ea=_0x318253;_0x345c70=0xc8;}else{_0x345c70=0xce;}_0x91835f[_0x11a6('0x11')](_0x345c70);return _0x91835f[_0x11a6('0x12')](_0x11a6('0x13'),_0x1d3123+'-'+_0x5158ea+'/'+_0x318253)['json'](_0x16486f);}return null;};}function saveUpdates(_0x3d6457){return function(_0x458af3){if(_0x458af3){return _0x458af3[_0x11a6('0x14')](_0x3d6457)[_0x11a6('0x15')](function(_0x1a9d43){return _0x1a9d43;});}return null;};}function removeEntity(_0x1e3cdd){return function(_0x2449bf){if(_0x2449bf){return _0x2449bf[_0x11a6('0x16')]()[_0x11a6('0x15')](function(){var _0x152160=_0x2449bf[_0x11a6('0x17')]({'plain':!![]});var _0x3681b2=_0x11a6('0x18');return db[_0x11a6('0x19')]['destroy']({'where':{'type':_0x3681b2,'resourceId':_0x152160['id']}})[_0x11a6('0x15')](function(){return _0x2449bf;});})[_0x11a6('0x15')](function(){_0x1e3cdd[_0x11a6('0x11')](0xcc)[_0x11a6('0x1a')]();});}};}function handleEntityNotFound(_0x4e37f8){return function(_0x540516){if(!_0x540516){_0x4e37f8[_0x11a6('0xc')](0x194);}return _0x540516;};}function handleError(_0x521f50,_0x707dd2){_0x707dd2=_0x707dd2||0x1f4;return function(_0x4c42ec){logger['error'](_0x4c42ec['stack']);if(_0x4c42ec['name']){delete _0x4c42ec[_0x11a6('0x1b')];}_0x521f50['status'](_0x707dd2)[_0x11a6('0x1c')](_0x4c42ec);};}exports[_0x11a6('0x1d')]=function(_0x5dbc63,_0x5281d7){var _0x2ffd7f={};var _0x144cc5={'count':0x0,'rows':[]};var _0x34e230=_[_0x11a6('0x1e')](db[_0x11a6('0x1f')][_0x11a6('0x20')],function(_0x40e3b4){return{'name':_0x40e3b4[_0x11a6('0x21')],'type':_0x40e3b4[_0x11a6('0x22')][_0x11a6('0x23')]};});_0x2ffd7f=qs[_0x11a6('0x24')](_0x34e230,_0x5dbc63);var _0x2cdccb={'where':_0x2ffd7f[_0x11a6('0x25')]};return db[_0x11a6('0x1f')][_0x11a6('0x10')](_0x2cdccb)[_0x11a6('0x15')](function(_0x1ddbb2){_0x144cc5[_0x11a6('0x10')]=_0x1ddbb2;_0x2ffd7f[_0x11a6('0x26')]=qs[_0x11a6('0x26')](_0x5dbc63[_0x11a6('0x27')]);return db[_0x11a6('0x1f')][_0x11a6('0x28')](_0x2ffd7f);})[_0x11a6('0x15')](function(_0x3827e3){_0x144cc5['rows']=_0x3827e3;return _0x144cc5;})[_0x11a6('0x15')](respondWithFilteredResult(_0x5281d7,_0x2ffd7f))['catch'](handleError(_0x5281d7,null));};exports[_0x11a6('0x29')]=function(_0x459bde,_0x10f481){var _0x210f2f={'raw':!![],'where':{'id':_0x459bde['params']['id']}},_0x224b62={};_0x224b62[_0x11a6('0x2a')]=_[_0x11a6('0x2b')](db['FaxQueue']['rawAttributes']);_0x224b62['query']=_[_0x11a6('0x2b')](_0x459bde[_0x11a6('0x27')]);_0x224b62['filters']=_[_0x11a6('0x2c')](_0x224b62[_0x11a6('0x2a')],_0x224b62[_0x11a6('0x27')]);_0x210f2f[_0x11a6('0x2d')]=_[_0x11a6('0x2c')](_0x224b62['model'],qs[_0x11a6('0x2e')](_0x459bde[_0x11a6('0x27')][_0x11a6('0x2e')]));_0x210f2f[_0x11a6('0x2d')]=_0x210f2f[_0x11a6('0x2d')][_0x11a6('0x2f')]?_0x210f2f[_0x11a6('0x2d')]:_0x224b62[_0x11a6('0x2a')];if(_0x459bde[_0x11a6('0x27')][_0x11a6('0x30')]){_0x210f2f[_0x11a6('0x26')]=[{'all':!![]}];}_0x210f2f=_[_0x11a6('0x31')]({},_0x210f2f,_0x459bde[_0x11a6('0x32')]);return db['FaxQueue'][_0x11a6('0x33')](_0x210f2f)[_0x11a6('0x15')](handleEntityNotFound(_0x10f481,null))[_0x11a6('0x15')](respondWithResult(_0x10f481,null))[_0x11a6('0x34')](handleError(_0x10f481,null));};exports[_0x11a6('0x35')]=function(_0x461932,_0x3017d4){return db[_0x11a6('0x1f')][_0x11a6('0x35')](_0x461932['body'],{})[_0x11a6('0x15')](function(_0x194b00){var _0x5f38c1=_0x461932[_0x11a6('0x36')][_0x11a6('0x17')]({'plain':!![]});if(!_0x5f38c1)throw new Error(_0x11a6('0x37'));if(_0x5f38c1['role']===_0x11a6('0x36')){var _0x97e288=_0x194b00['get']({'plain':!![]});var _0x5dbdda=_0x11a6('0x18');return db['UserProfileSection'][_0x11a6('0x33')]({'where':{'name':_0x5dbdda,'userProfileId':_0x5f38c1[_0x11a6('0x38')]},'raw':!![]})['then'](function(_0x275aa0){if(_0x275aa0&&_0x275aa0['autoAssociation']===0x0){return db[_0x11a6('0x19')][_0x11a6('0x35')]({'name':_0x97e288['name'],'resourceId':_0x97e288['id'],'type':_0x275aa0[_0x11a6('0x1b')],'sectionId':_0x275aa0['id']},{})[_0x11a6('0x15')](function(){return _0x194b00;});}else{return _0x194b00;}})[_0x11a6('0x34')](function(_0xd769e4){logger[_0x11a6('0x39')](_0x11a6('0x3a'),_0xd769e4);throw _0xd769e4;});}return _0x194b00;})[_0x11a6('0x15')](respondWithResult(_0x3017d4,0xc9))['catch'](handleError(_0x3017d4,null));};exports[_0x11a6('0x14')]=function(_0x382182,_0x5f44c1){if(_0x382182[_0x11a6('0x3b')]['id']){delete _0x382182[_0x11a6('0x3b')]['id'];}return db['FaxQueue'][_0x11a6('0x33')]({'where':{'id':_0x382182[_0x11a6('0x3c')]['id']}})[_0x11a6('0x15')](handleEntityNotFound(_0x5f44c1,null))['then'](saveUpdates(_0x382182['body'],null))['then'](respondWithResult(_0x5f44c1,null))['catch'](handleError(_0x5f44c1,null));};exports[_0x11a6('0x16')]=function(_0x49d793,_0x37f804){return db[_0x11a6('0x1f')]['find']({'where':{'id':_0x49d793['params']['id']}})['then'](handleEntityNotFound(_0x37f804,null))[_0x11a6('0x15')](removeEntity(_0x37f804,null))[_0x11a6('0x34')](handleError(_0x37f804,null));};exports['describe']=function(_0x421f34,_0x523a0b){return db[_0x11a6('0x1f')]['describe']()[_0x11a6('0x15')](respondWithResult(_0x523a0b,null))[_0x11a6('0x34')](handleError(_0x523a0b,null));};exports['getMembers']=function(_0x40043f,_0x47c6a2){var _0xea018f={'raw':!![],'where':{}},_0x199e60={},_0x2a0ebc;return db[_0x11a6('0x1f')]['findOne']({'where':{'id':_0x40043f[_0x11a6('0x3c')]['id']}})[_0x11a6('0x15')](handleEntityNotFound(_0x47c6a2,null))[_0x11a6('0x15')](function(_0x22fe68){if(_0x22fe68){_0x2a0ebc=_0x22fe68[_0x11a6('0x17')]({'plain':!![]});_0x199e60[_0x11a6('0x2a')]=_['keys'](db[_0x11a6('0x3d')][_0x11a6('0x20')]);_0x199e60[_0x11a6('0x27')]=_['keys'](_0x40043f[_0x11a6('0x27')]);_0x199e60[_0x11a6('0x3e')]=_[_0x11a6('0x2c')](_0x199e60[_0x11a6('0x2a')],_0x199e60[_0x11a6('0x27')]);_0xea018f[_0x11a6('0x2d')]=_[_0x11a6('0x2c')](_0x199e60[_0x11a6('0x2a')],qs[_0x11a6('0x2e')](_0x40043f[_0x11a6('0x27')][_0x11a6('0x2e')]));_0xea018f[_0x11a6('0x2d')]=_0xea018f[_0x11a6('0x2d')][_0x11a6('0x2f')]?_0xea018f[_0x11a6('0x2d')]:_0x199e60[_0x11a6('0x2a')];if(!_0x40043f[_0x11a6('0x27')][_0x11a6('0x3f')]('nolimit')){_0xea018f[_0x11a6('0x40')]=qs['limit'](_0x40043f[_0x11a6('0x27')]['limit']);_0xea018f[_0x11a6('0xe')]=qs[_0x11a6('0xe')](_0x40043f[_0x11a6('0x27')][_0x11a6('0xe')]);}_0xea018f['order']=qs[_0x11a6('0x41')](_0x40043f[_0x11a6('0x27')]['sort']);_0xea018f[_0x11a6('0x25')]=qs[_0x11a6('0x3e')](_[_0x11a6('0x42')](_0x40043f[_0x11a6('0x27')],_0x199e60[_0x11a6('0x3e')]));_0xea018f['where'][_0x11a6('0x43')]=_0x22fe68['id'];if(_0x40043f[_0x11a6('0x27')][_0x11a6('0x44')]){_0xea018f[_0x11a6('0x25')]=_[_0x11a6('0x31')](_0xea018f['where'],{'$or':_[_0x11a6('0x1e')](_0xea018f[_0x11a6('0x2d')],function(_0x3ee886){var _0x439705={};_0x439705[_0x3ee886]={'$like':'%'+_0x40043f[_0x11a6('0x27')][_0x11a6('0x44')]+'%'};return _0x439705;})});}_0xea018f=_['merge']({},_0xea018f,_0x40043f[_0x11a6('0x32')]);return db[_0x11a6('0x3d')][_0x11a6('0x28')](_0xea018f);}})[_0x11a6('0x15')](function(_0x11f8a8){if(_0x11f8a8){return db[_0x11a6('0x45')][_0x11a6('0x46')]({'where':{'id':_[_0x11a6('0x1e')](_0x11f8a8,'UserId'),'role':_0x11a6('0x47')},'attributes':['id',_0x11a6('0x1b'),_0x11a6('0x48'),'updatedAt',_0x11a6('0x49')]});}})[_0x11a6('0x15')](function(_0x17852d){if(_0x17852d){return{'count':_0x17852d['count'],'rows':_[_0x11a6('0x1e')](_0x17852d[_0x11a6('0x4a')],function(_0x4535fb){return{'membername':_0x4535fb[_0x11a6('0x1b')],'UserId':_0x4535fb['id'],'queue_name':_0x2a0ebc[_0x11a6('0x1b')],'FaxQueueId':_0x2a0ebc['id'],'interface':util[_0x11a6('0x4b')]('%s/%s',_0x11a6('0x4c'),_0x4535fb[_0x11a6('0x1b')]),'penalty':0x0,'paused':_0x4535fb[_0x11a6('0x48')],'createdAt':_0x4535fb['createdAt'],'updatedAt':_0x4535fb[_0x11a6('0x4d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x11a6('0x15')](respondWithFilteredResult(_0x47c6a2,_0xea018f))[_0x11a6('0x34')](handleError(_0x47c6a2,null));};exports[_0x11a6('0x4e')]=function(_0x3caf2a,_0x55b76d){var _0x3cc318={};var _0x128a3d={};var _0x15a09c;var _0x10b050;return db[_0x11a6('0x1f')][_0x11a6('0x4f')]({'where':{'id':_0x3caf2a[_0x11a6('0x3c')]['id']}})[_0x11a6('0x15')](handleEntityNotFound(_0x55b76d,null))[_0x11a6('0x15')](function(_0x546630){if(_0x546630){_0x15a09c=_0x546630;_0x128a3d[_0x11a6('0x2a')]=_[_0x11a6('0x2b')](db[_0x11a6('0x50')][_0x11a6('0x20')]);_0x128a3d[_0x11a6('0x27')]=_[_0x11a6('0x2b')](_0x3caf2a[_0x11a6('0x27')]);_0x128a3d[_0x11a6('0x3e')]=_[_0x11a6('0x2c')](_0x128a3d[_0x11a6('0x2a')],_0x128a3d[_0x11a6('0x27')]);_0x3cc318[_0x11a6('0x2d')]=_['intersection'](_0x128a3d[_0x11a6('0x2a')],qs[_0x11a6('0x2e')](_0x3caf2a[_0x11a6('0x27')]['fields']));_0x3cc318[_0x11a6('0x2d')]=_0x3cc318[_0x11a6('0x2d')]['length']?_0x3cc318['attributes']:_0x128a3d['model'];_0x3cc318[_0x11a6('0x51')]=qs[_0x11a6('0x41')](_0x3caf2a[_0x11a6('0x27')][_0x11a6('0x41')]);_0x3cc318[_0x11a6('0x25')]=qs[_0x11a6('0x3e')](_[_0x11a6('0x42')](_0x3caf2a[_0x11a6('0x27')],_0x128a3d[_0x11a6('0x3e')]));if(_0x3caf2a[_0x11a6('0x27')]['filter']){_0x3cc318[_0x11a6('0x25')]=_[_0x11a6('0x31')](_0x3cc318[_0x11a6('0x25')],{'$or':_['map'](_0x3cc318[_0x11a6('0x2d')],function(_0x8e137f){var _0x2b43f4={};_0x2b43f4[_0x8e137f]={'$like':'%'+_0x3caf2a[_0x11a6('0x27')][_0x11a6('0x44')]+'%'};return _0x2b43f4;})});}_0x3cc318=_[_0x11a6('0x31')]({},_0x3cc318,_0x3caf2a[_0x11a6('0x32')]);return _0x15a09c[_0x11a6('0x4e')](_0x3cc318);}})[_0x11a6('0x15')](function(_0x58a438){if(_0x58a438){_0x10b050=_0x58a438[_0x11a6('0x2f')];if(!_0x3caf2a[_0x11a6('0x27')]['hasOwnProperty'](_0x11a6('0x52'))){_0x3cc318[_0x11a6('0x40')]=qs[_0x11a6('0x40')](_0x3caf2a[_0x11a6('0x27')][_0x11a6('0x40')]);_0x3cc318['offset']=qs[_0x11a6('0xe')](_0x3caf2a[_0x11a6('0x27')][_0x11a6('0xe')]);}return _0x15a09c[_0x11a6('0x4e')](_0x3cc318);}})[_0x11a6('0x15')](function(_0x4a8c4b){if(_0x4a8c4b){return _0x4a8c4b?{'count':_0x10b050,'rows':_0x4a8c4b}:null;}})[_0x11a6('0x15')](respondWithResult(_0x55b76d,null))['catch'](handleError(_0x55b76d,null));};exports['addTeams']=function(_0xbb6665,_0x3aadee){var _0x5c77f2=_0xbb6665[_0x11a6('0x3b')][_0x11a6('0x53')];return db[_0x11a6('0x50')][_0x11a6('0x28')]({'where':{'id':_0x5c77f2},'attributes':['id'],'include':[{'model':db[_0x11a6('0x45')],'as':'Agents','attributes':['id',_0x11a6('0x1b'),'online','voicePause','interface'],'raw':!![]}]})['then'](function(_0x3191f6){if(_0x3191f6){var _0x1eb3a1=_[_0x11a6('0x54')](_0x3191f6,function(_0x1429e2){var _0x3d0b30=_0x1429e2['get']({'plain':!![]});return _0x3d0b30[_0x11a6('0x55')];});return db[_0x11a6('0x1f')]['find']({'where':{'id':_0xbb6665[_0x11a6('0x3c')]['id']}})['then'](function(_0x21ddd5){return db[_0x11a6('0x56')][_0x11a6('0x57')](function(_0x877ff9){return _0x21ddd5['addTeams'](_0x5c77f2,{'transaction':_0x877ff9})[_0x11a6('0x15')](function(){return BPromise['each'](_0x1eb3a1,function(_0x3e6eaf){return db[_0x11a6('0x3d')][_0x11a6('0x58')]({'where':{'UserId':_0x3e6eaf['id'],'FaxQueueId':_0xbb6665[_0x11a6('0x3c')]['id']},'transaction':_0x877ff9});});})[_0x11a6('0x15')](function(){_0x1eb3a1['forEach'](function(_0xa36a6f){socket[_0x11a6('0x59')](_0x11a6('0x5a'),{'UserId':_0xa36a6f['id'],'FaxQueueId':_0x21ddd5['id']});});});});});}})[_0x11a6('0x15')](respondWithStatusCode(_0x3aadee,null))[_0x11a6('0x34')](handleError(_0x3aadee,null));};exports[_0x11a6('0x5b')]=function(_0x370faf,_0xe1990f){return db[_0x11a6('0x50')][_0x11a6('0x28')]({'where':{'id':_0x370faf['query'][_0x11a6('0x53')]},'attributes':['id'],'include':[{'model':db[_0x11a6('0x45')],'as':_0x11a6('0x55'),'attributes':['id'],'raw':!![]}]})[_0x11a6('0x15')](handleEntityNotFound(_0xe1990f,null))['then'](function(_0x32fe09){var _0x425160=_[_0x11a6('0x1e')](_0x32fe09,'id');var _0x5251dc=[];var _0xa187f=[];var _0x39fbfc=squel[_0x11a6('0x5c')]();_0x39fbfc[_0x11a6('0x5d')](_0x11a6('0x5e'))[_0x11a6('0x5f')](_0x11a6('0x60'),'tq')[_0x11a6('0x61')](_0x11a6('0x62'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x11a6('0x63'),_0x370faf[_0x11a6('0x3c')]['id']);for(var _0x188bdc=0x0;_0x188bdc<_0x32fe09[_0x11a6('0x2f')];_0x188bdc+=0x1){let _0x2e829a=_0x32fe09[_0x188bdc];for(var _0x20a3f4=0x0;_0x20a3f4<_0x2e829a[_0x11a6('0x55')][_0x11a6('0x2f')];_0x20a3f4+=0x1){let _0x2d2c57=_0x2e829a[_0x11a6('0x55')][_0x20a3f4];var _0x5bacc0=_0x39fbfc[_0x11a6('0x64')]();_0x5bacc0[_0x11a6('0x25')]('ut.UserId\x20=\x20?',_0x2d2c57['id']);_0xa187f[_0x11a6('0x65')](db['sequelize'][_0x11a6('0x27')](_0x5bacc0['toString'](),{'type':db['sequelize'][_0x11a6('0x66')][_0x11a6('0x67')]})[_0x11a6('0x15')](function(_0x4408bd){if(_0x4408bd[_0x11a6('0x2f')]===0x1){return _0x2d2c57['id'];}else{var _0x669583=_[_0x11a6('0x68')](_[_0x11a6('0x1e')](_0x4408bd,_0x11a6('0x69')),function(_0x31faa5){return _['includes'](_0x425160,_0x31faa5);});if(_0x669583){return _0x2d2c57['id'];}}}));}}return BPromise[_0x11a6('0x6a')](_0xa187f)[_0x11a6('0x15')](function(_0x4d01b7){_0x5251dc=_(_0x5251dc)[_0x11a6('0x6b')](_0x4d01b7)[_0x11a6('0x6c')]()[_0x11a6('0x6d')]();return db[_0x11a6('0x1f')][_0x11a6('0x33')]({'where':{'id':_0x370faf[_0x11a6('0x3c')]['id']}})['then'](function(_0x1c71f0){return db[_0x11a6('0x56')]['transaction'](function(_0x3ef395){return _0x1c71f0[_0x11a6('0x5b')](_0x370faf[_0x11a6('0x27')]['ids'],{'transaction':_0x3ef395})[_0x11a6('0x15')](function(){if(!_[_0x11a6('0x6e')](_0x5251dc)){return _0x1c71f0[_0x11a6('0x6f')](_0x5251dc,{'transaction':_0x3ef395});}})[_0x11a6('0x15')](function(){_0x5251dc[_0x11a6('0x70')](function(_0x1ee011){socket[_0x11a6('0x59')](_0x11a6('0x71'),{'UserId':_0x1ee011,'FaxQueueId':_0x1c71f0['id']});});});});});});})['then'](respondWithStatusCode(_0xe1990f,null))['catch'](handleError(_0xe1990f,null));};exports[_0x11a6('0x72')]=function(_0x2fa6d8,_0x21384e){return db[_0x11a6('0x1f')][_0x11a6('0x33')]({'where':{'id':_0x2fa6d8['params']['id']}})[_0x11a6('0x15')](handleEntityNotFound(_0x21384e,null))[_0x11a6('0x15')](function(_0x3e2ab0){if(_0x3e2ab0){return _0x3e2ab0[_0x11a6('0x72')](_0x2fa6d8[_0x11a6('0x3b')]['ids'],_[_0x11a6('0x73')](_0x2fa6d8[_0x11a6('0x3b')],[_0x11a6('0x53'),'id'])||{})[_0x11a6('0x74')](function(_0x448248){for(var _0x9d49bb=0x0;_0x9d49bb<_0x2fa6d8[_0x11a6('0x3b')][_0x11a6('0x53')]['length'];_0x9d49bb+=0x1){socket[_0x11a6('0x59')](_0x11a6('0x5a'),{'UserId':Number(_0x2fa6d8[_0x11a6('0x3b')][_0x11a6('0x53')][_0x9d49bb]),'FaxQueueId':Number(_0x2fa6d8['params']['id'])});}return _0x448248;});}})[_0x11a6('0x15')](respondWithResult(_0x21384e,null))[_0x11a6('0x34')](handleError(_0x21384e,null));};exports[_0x11a6('0x6f')]=function(_0x2a20e4,_0x5b19be){return db['FaxQueue'][_0x11a6('0x33')]({'where':{'id':_0x2a20e4[_0x11a6('0x3c')]['id']}})[_0x11a6('0x15')](handleEntityNotFound(_0x5b19be,null))['then'](function(_0x2461e3){if(_0x2461e3){return _0x2461e3['removeAgents'](_0x2a20e4[_0x11a6('0x27')][_0x11a6('0x53')])[_0x11a6('0x15')](function(){if(_['isArray'](_0x2a20e4[_0x11a6('0x27')][_0x11a6('0x53')])){for(var _0x2568fd=0x0;_0x2568fd<_0x2a20e4['query']['ids'][_0x11a6('0x2f')];_0x2568fd+=0x1){socket[_0x11a6('0x59')]('userFaxQueue:remove',{'UserId':Number(_0x2a20e4[_0x11a6('0x27')][_0x11a6('0x53')][_0x2568fd]),'FaxQueueId':Number(_0x2a20e4[_0x11a6('0x3c')]['id'])});}}else{socket[_0x11a6('0x59')](_0x11a6('0x71'),{'UserId':Number(_0x2a20e4['query'][_0x11a6('0x53')]),'FaxQueueId':Number(_0x2a20e4[_0x11a6('0x3c')]['id'])});}});}})[_0x11a6('0x15')](respondWithStatusCode(_0x5b19be,null))[_0x11a6('0x34')](handleError(_0x5b19be,null));};exports[_0x11a6('0x75')]=function(_0x4593cc,_0x1b5e41){var _0x2df6b9={};var _0x4a0255={};var _0x41c118;var _0x4528a8;return db['FaxQueue'][_0x11a6('0x4f')]({'where':{'id':_0x4593cc[_0x11a6('0x3c')]['id']}})[_0x11a6('0x15')](handleEntityNotFound(_0x1b5e41,null))[_0x11a6('0x15')](function(_0x1c3539){if(_0x1c3539){_0x41c118=_0x1c3539;_0x4a0255[_0x11a6('0x2a')]=_[_0x11a6('0x2b')](db['User'][_0x11a6('0x20')]);_0x4a0255['query']=_['keys'](_0x4593cc[_0x11a6('0x27')]);_0x4a0255[_0x11a6('0x3e')]=_[_0x11a6('0x2c')](_0x4a0255[_0x11a6('0x2a')],_0x4a0255[_0x11a6('0x27')]);_0x2df6b9['attributes']=_[_0x11a6('0x2c')](_0x4a0255[_0x11a6('0x2a')],qs[_0x11a6('0x2e')](_0x4593cc[_0x11a6('0x27')][_0x11a6('0x2e')]));_0x2df6b9[_0x11a6('0x2d')]=_0x2df6b9['attributes'][_0x11a6('0x2f')]?_0x2df6b9[_0x11a6('0x2d')]:_0x4a0255['model'];_0x2df6b9[_0x11a6('0x51')]=qs[_0x11a6('0x41')](_0x4593cc[_0x11a6('0x27')][_0x11a6('0x41')]);_0x2df6b9[_0x11a6('0x25')]=qs['filters'](_[_0x11a6('0x42')](_0x4593cc[_0x11a6('0x27')],_0x4a0255[_0x11a6('0x3e')]));if(_0x4593cc[_0x11a6('0x27')][_0x11a6('0x44')]){_0x2df6b9[_0x11a6('0x25')]=_[_0x11a6('0x31')](_0x2df6b9[_0x11a6('0x25')],{'$or':_[_0x11a6('0x1e')](_0x2df6b9[_0x11a6('0x2d')],function(_0x4e3793){var _0x53720a={};_0x53720a[_0x4e3793]={'$like':'%'+_0x4593cc[_0x11a6('0x27')][_0x11a6('0x44')]+'%'};return _0x53720a;})});}_0x2df6b9=_['merge']({},_0x2df6b9,_0x4593cc['options']);return _0x41c118[_0x11a6('0x75')](_0x2df6b9);}})[_0x11a6('0x15')](function(_0x229822){if(_0x229822){_0x4528a8=_0x229822['length'];if(!_0x4593cc[_0x11a6('0x27')][_0x11a6('0x3f')](_0x11a6('0x52'))){_0x2df6b9['limit']=qs[_0x11a6('0x40')](_0x4593cc[_0x11a6('0x27')][_0x11a6('0x40')]);_0x2df6b9[_0x11a6('0xe')]=qs[_0x11a6('0xe')](_0x4593cc[_0x11a6('0x27')][_0x11a6('0xe')]);}return _0x41c118[_0x11a6('0x75')](_0x2df6b9);}})[_0x11a6('0x15')](function(_0x314440){if(_0x314440){return _0x314440?{'count':_0x4528a8,'rows':_0x314440}:null;}})[_0x11a6('0x15')](respondWithResult(_0x1b5e41,null))[_0x11a6('0x34')](handleError(_0x1b5e41,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 51ad471..9042354 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 _0xdbbc=['hasOwnProperty','hook','exports','../../mysqldb','FaxQueue','setMaxListeners','save','remove','emit'];(function(_0x50b2ea,_0x52c92d){var _0x10f77f=function(_0x4d2bdd){while(--_0x4d2bdd){_0x50b2ea['push'](_0x50b2ea['shift']());}};_0x10f77f(++_0x52c92d);}(_0xdbbc,0xdb));var _0xcdbb=function(_0x371485,_0x589744){_0x371485=_0x371485-0x0;var _0x3f6b22=_0xdbbc[_0x371485];return _0x3f6b22;};'use strict';var EventEmitter=require('events');var FaxQueue=require(_0xcdbb('0x0'))['db'][_0xcdbb('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xcdbb('0x2')](0x0);var events={'afterCreate':_0xcdbb('0x3'),'afterUpdate':'update','afterDestroy':_0xcdbb('0x4')};function emitEvent(_0x157eb9){return function(_0x52660d,_0x480e10,_0x2cfbea){FaxQueueEvents['emit'](_0x157eb9+':'+_0x52660d['id'],_0x52660d);FaxQueueEvents[_0xcdbb('0x5')](_0x157eb9,_0x52660d);_0x2cfbea(null);};}for(var e in events){if(events[_0xcdbb('0x6')](e)){var event=events[e];FaxQueue[_0xcdbb('0x7')](e,emitEvent(event));}}module[_0xcdbb('0x8')]=FaxQueueEvents; \ No newline at end of file +var _0xccce=['../../mysqldb','setMaxListeners','remove','emit','hasOwnProperty','hook','events'];(function(_0x119629,_0x246787){var _0x49a771=function(_0x23624c){while(--_0x23624c){_0x119629['push'](_0x119629['shift']());}};_0x49a771(++_0x246787);}(_0xccce,0x102));var _0xeccc=function(_0x306245,_0x327741){_0x306245=_0x306245-0x0;var _0x3a57ef=_0xccce[_0x306245];return _0x3a57ef;};'use strict';var EventEmitter=require(_0xeccc('0x0'));var FaxQueue=require(_0xeccc('0x1'))['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xeccc('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xeccc('0x3')};function emitEvent(_0x21f177){return function(_0x56b3a0,_0x10610a,_0x5c7794){FaxQueueEvents[_0xeccc('0x4')](_0x21f177+':'+_0x56b3a0['id'],_0x56b3a0);FaxQueueEvents[_0xeccc('0x4')](_0x21f177,_0x56b3a0);_0x5c7794(null);};}for(var e in events){if(events[_0xeccc('0x5')](e)){var event=events[e];FaxQueue[_0xeccc('0x6')](e,emitEvent(event));}}module['exports']=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index e23881c..5591830 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 _0x7b1d=['path','rimraf','../../config/environment','./faxQueue.attributes','exports','define','fax_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x27cbc0,_0x273895){var _0xad34bb=function(_0x1ad09b){while(--_0x1ad09b){_0x27cbc0['push'](_0x27cbc0['shift']());}};_0xad34bb(++_0x273895);}(_0x7b1d,0x13b));var _0xd7b1=function(_0x170113,_0x534d73){_0x170113=_0x170113-0x0;var _0x56036e=_0x7b1d[_0x170113];return _0x56036e;};'use strict';var _=require(_0xd7b1('0x0'));var util=require(_0xd7b1('0x1'));var logger=require(_0xd7b1('0x2'))(_0xd7b1('0x3'));var moment=require(_0xd7b1('0x4'));var BPromise=require(_0xd7b1('0x5'));var rp=require(_0xd7b1('0x6'));var fs=require('fs');var path=require(_0xd7b1('0x7'));var rimraf=require(_0xd7b1('0x8'));var config=require(_0xd7b1('0x9'));var attributes=require(_0xd7b1('0xa'));module[_0xd7b1('0xb')]=function(_0x1187a7,_0x2f8cae){return _0x1187a7[_0xd7b1('0xc')]('FaxQueue',attributes,{'tableName':_0xd7b1('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4283=['bluebird','request-promise','../../config/environment','./faxQueue.attributes','exports','define','FaxQueue','fax_queues','lodash','util','api'];(function(_0x37720c,_0xe6ca8e){var _0x44be92=function(_0x1c8583){while(--_0x1c8583){_0x37720c['push'](_0x37720c['shift']());}};_0x44be92(++_0xe6ca8e);}(_0x4283,0xd9));var _0x3428=function(_0x443ff3,_0xd4b12f){_0x443ff3=_0x443ff3-0x0;var _0xb6f175=_0x4283[_0x443ff3];return _0xb6f175;};'use strict';var _=require(_0x3428('0x0'));var util=require(_0x3428('0x1'));var logger=require('../../config/logger')(_0x3428('0x2'));var moment=require('moment');var BPromise=require(_0x3428('0x3'));var rp=require(_0x3428('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3428('0x5'));var attributes=require(_0x3428('0x6'));module[_0x3428('0x7')]=function(_0x343faf,_0x27f13b){return _0x343faf[_0x3428('0x8')](_0x3428('0x9'),attributes,{'tableName':_0x3428('0xa'),'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 c15e533..4f2c331 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 _0xae91=['message','result','catch','FaxQueue','findAll','options','raw','where','attributes','limit','include','model','map','then','GetFaxQueue','ShowFaxQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x5a6495,_0x1e3a18){var _0x57b2f0=function(_0x18b006){while(--_0x18b006){_0x5a6495['push'](_0x5a6495['shift']());}};_0x57b2f0(++_0x1e3a18);}(_0xae91,0x1d4));var _0x1ae9=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xae91[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x1ae9('0x0'));var util=require(_0x1ae9('0x1'));var moment=require(_0x1ae9('0x2'));var BPromise=require(_0x1ae9('0x3'));var rs=require(_0x1ae9('0x4'));var fs=require('fs');var Redis=require(_0x1ae9('0x5'));var db=require(_0x1ae9('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x1ae9('0x7'))(_0x1ae9('0x8'));var config=require('../../config/environment');var jayson=require(_0x1ae9('0x9'));var client=jayson['client'][_0x1ae9('0xa')]({'port':0x232a});config[_0x1ae9('0xb')]=_[_0x1ae9('0xc')](config['redis'],{'host':_0x1ae9('0xd'),'port':0x18eb});var socket=require(_0x1ae9('0xe'))(new Redis(config[_0x1ae9('0xb')]));require(_0x1ae9('0xf'))['register'](socket);function respondWithRpcPromise(_0x30dcdc,_0x1c88be,_0x231eeb){return new BPromise(function(_0x15f320,_0x562c2d){return client['request'](_0x30dcdc,_0x231eeb)['then'](function(_0x387e9d){logger[_0x1ae9('0x10')](_0x1ae9('0x11'),_0x1c88be,_0x1ae9('0x12'));logger[_0x1ae9('0x13')](_0x1ae9('0x14'),_0x1c88be,'request\x20sent',JSON[_0x1ae9('0x15')](_0x387e9d));if(_0x387e9d[_0x1ae9('0x16')]){if(_0x387e9d[_0x1ae9('0x16')][_0x1ae9('0x17')]===0x1f4){logger['error'](_0x1ae9('0x11'),_0x1c88be,_0x387e9d[_0x1ae9('0x16')][_0x1ae9('0x18')]);return _0x562c2d(_0x387e9d[_0x1ae9('0x16')][_0x1ae9('0x18')]);}logger[_0x1ae9('0x16')](_0x1ae9('0x11'),_0x1c88be,_0x387e9d[_0x1ae9('0x16')]['message']);return _0x15f320(_0x387e9d['error'][_0x1ae9('0x18')]);}else{logger['info']('FaxQueue,\x20%s,\x20%s',_0x1c88be,'request\x20sent');_0x15f320(_0x387e9d[_0x1ae9('0x19')]['message']);}})[_0x1ae9('0x1a')](function(_0x130959){logger[_0x1ae9('0x16')]('FaxQueue,\x20%s,\x20%s',_0x1c88be,_0x130959);_0x562c2d(_0x130959);});});}exports['GetFaxQueue']=function(_0x477569){var _0x276509=this;return new Promise(function(_0x483505,_0x30d117){return db[_0x1ae9('0x1b')][_0x1ae9('0x1c')]({'raw':_0x477569[_0x1ae9('0x1d')]?_0x477569['options'][_0x1ae9('0x1e')]===undefined?!![]:![]:!![],'where':_0x477569[_0x1ae9('0x1d')]?_0x477569[_0x1ae9('0x1d')][_0x1ae9('0x1f')]||null:null,'attributes':_0x477569[_0x1ae9('0x1d')]?_0x477569[_0x1ae9('0x1d')][_0x1ae9('0x20')]||null:null,'limit':_0x477569['options']?_0x477569[_0x1ae9('0x1d')][_0x1ae9('0x21')]||null:null,'include':_0x477569['options']?_0x477569['options'][_0x1ae9('0x22')]?_['map'](_0x477569['options'][_0x1ae9('0x22')],function(_0x6e180b){return{'model':db[_0x6e180b[_0x1ae9('0x23')]],'as':_0x6e180b['as'],'attributes':_0x6e180b[_0x1ae9('0x20')],'include':_0x6e180b['include']?_[_0x1ae9('0x24')](_0x6e180b['include'],function(_0x4222df){return{'model':db[_0x4222df[_0x1ae9('0x23')]],'as':_0x4222df['as'],'attributes':_0x4222df[_0x1ae9('0x20')],'include':_0x4222df[_0x1ae9('0x22')]?_['map'](_0x4222df[_0x1ae9('0x22')],function(_0x4668e2){return{'model':db[_0x4668e2[_0x1ae9('0x23')]],'as':_0x4668e2['as'],'attributes':_0x4668e2[_0x1ae9('0x20')]};}):[]};}):[]};}):[]:[]})[_0x1ae9('0x25')](function(_0x3bb796){logger['info']('GetFaxQueue',_0x477569);logger['debug'](_0x1ae9('0x26'),_0x477569,JSON[_0x1ae9('0x15')](_0x3bb796));_0x483505(_0x3bb796);})['catch'](function(_0x508752){logger[_0x1ae9('0x16')]('GetFaxQueue',_0x508752[_0x1ae9('0x18')],_0x477569);_0x30d117(_0x276509['error'](0x1f4,_0x508752[_0x1ae9('0x18')]));});});};exports[_0x1ae9('0x27')]=function(_0x18ece3){var _0x1d89fd=this;return new Promise(function(_0x38c985,_0x23d3c1){return db[_0x1ae9('0x1b')][_0x1ae9('0x28')]({'raw':_0x18ece3['options']?_0x18ece3[_0x1ae9('0x1d')][_0x1ae9('0x1e')]===undefined?!![]:![]:!![],'where':_0x18ece3['options']?_0x18ece3[_0x1ae9('0x1d')][_0x1ae9('0x1f')]||null:null,'attributes':_0x18ece3[_0x1ae9('0x1d')]?_0x18ece3[_0x1ae9('0x1d')][_0x1ae9('0x20')]||null:null,'include':_0x18ece3[_0x1ae9('0x1d')]?_0x18ece3[_0x1ae9('0x1d')][_0x1ae9('0x22')]?_[_0x1ae9('0x24')](_0x18ece3[_0x1ae9('0x1d')]['include'],function(_0x7e078d){return{'model':db[_0x7e078d[_0x1ae9('0x23')]],'as':_0x7e078d['as'],'attributes':_0x7e078d[_0x1ae9('0x20')],'include':_0x7e078d[_0x1ae9('0x22')]?_[_0x1ae9('0x24')](_0x7e078d[_0x1ae9('0x22')],function(_0x68aaf0){return{'model':db[_0x68aaf0[_0x1ae9('0x23')]],'as':_0x68aaf0['as'],'attributes':_0x68aaf0['attributes'],'include':_0x68aaf0['include']?_['map'](_0x68aaf0[_0x1ae9('0x22')],function(_0x37361e){return{'model':db[_0x37361e['model']],'as':_0x37361e['as'],'attributes':_0x37361e[_0x1ae9('0x20')]};}):[]};}):[]};}):[]:[]})[_0x1ae9('0x25')](function(_0x230a66){logger[_0x1ae9('0x10')](_0x1ae9('0x27'),_0x18ece3);logger[_0x1ae9('0x13')]('ShowFaxQueue',_0x18ece3,JSON[_0x1ae9('0x15')](_0x230a66));_0x38c985(_0x230a66);})[_0x1ae9('0x1a')](function(_0x5585){logger[_0x1ae9('0x16')]('ShowFaxQueue',_0x5585[_0x1ae9('0x18')],_0x18ece3);_0x23d3c1(_0x1d89fd['error'](0x1f4,_0x5585[_0x1ae9('0x18')]));});});}; \ No newline at end of file +var _0x6947=['socket.io-emitter','./faxQueue.socket','register','then','info','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','FaxQueue,\x20%s,\x20%s','message','result','catch','GetFaxQueue','FaxQueue','findAll','raw','options','attributes','limit','include','model','map','ShowFaxQueue','find','lodash','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost'];(function(_0x1e6017,_0x4ff459){var _0x2cba56=function(_0x5ec96c){while(--_0x5ec96c){_0x1e6017['push'](_0x1e6017['shift']());}};_0x2cba56(++_0x4ff459);}(_0x6947,0x1b1));var _0x7694=function(_0x84efc1,_0x5509f0){_0x84efc1=_0x84efc1-0x0;var _0x34a7d0=_0x6947[_0x84efc1];return _0x34a7d0;};'use strict';var _=require(_0x7694('0x0'));var util=require('util');var moment=require(_0x7694('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7694('0x2'))['db'];var utils=require(_0x7694('0x3'));var logger=require(_0x7694('0x4'))(_0x7694('0x5'));var config=require(_0x7694('0x6'));var jayson=require(_0x7694('0x7'));var client=jayson['client']['http']({'port':0x232a});config[_0x7694('0x8')]=_[_0x7694('0x9')](config[_0x7694('0x8')],{'host':_0x7694('0xa'),'port':0x18eb});var socket=require(_0x7694('0xb'))(new Redis(config['redis']));require(_0x7694('0xc'))[_0x7694('0xd')](socket);function respondWithRpcPromise(_0x4a7f36,_0x2ccfc4,_0x23996e){return new BPromise(function(_0x4e26f2,_0x4207ce){return client['request'](_0x4a7f36,_0x23996e)[_0x7694('0xe')](function(_0x258028){logger[_0x7694('0xf')]('FaxQueue,\x20%s,\x20%s',_0x2ccfc4,_0x7694('0x10'));logger[_0x7694('0x11')](_0x7694('0x12'),_0x2ccfc4,_0x7694('0x10'),JSON[_0x7694('0x13')](_0x258028));if(_0x258028[_0x7694('0x14')]){if(_0x258028['error']['code']===0x1f4){logger[_0x7694('0x14')](_0x7694('0x15'),_0x2ccfc4,_0x258028[_0x7694('0x14')][_0x7694('0x16')]);return _0x4207ce(_0x258028[_0x7694('0x14')]['message']);}logger['error']('FaxQueue,\x20%s,\x20%s',_0x2ccfc4,_0x258028[_0x7694('0x14')]['message']);return _0x4e26f2(_0x258028[_0x7694('0x14')][_0x7694('0x16')]);}else{logger[_0x7694('0xf')](_0x7694('0x15'),_0x2ccfc4,'request\x20sent');_0x4e26f2(_0x258028[_0x7694('0x17')][_0x7694('0x16')]);}})[_0x7694('0x18')](function(_0x1d2e68){logger[_0x7694('0x14')]('FaxQueue,\x20%s,\x20%s',_0x2ccfc4,_0x1d2e68);_0x4207ce(_0x1d2e68);});});}exports[_0x7694('0x19')]=function(_0x8f962c){var _0x4d7669=this;return new Promise(function(_0x55d425,_0x3865fd){return db[_0x7694('0x1a')][_0x7694('0x1b')]({'raw':_0x8f962c['options']?_0x8f962c['options'][_0x7694('0x1c')]===undefined?!![]:![]:!![],'where':_0x8f962c[_0x7694('0x1d')]?_0x8f962c[_0x7694('0x1d')]['where']||null:null,'attributes':_0x8f962c[_0x7694('0x1d')]?_0x8f962c[_0x7694('0x1d')][_0x7694('0x1e')]||null:null,'limit':_0x8f962c['options']?_0x8f962c[_0x7694('0x1d')][_0x7694('0x1f')]||null:null,'include':_0x8f962c['options']?_0x8f962c['options']['include']?_['map'](_0x8f962c[_0x7694('0x1d')][_0x7694('0x20')],function(_0x176c92){return{'model':db[_0x176c92[_0x7694('0x21')]],'as':_0x176c92['as'],'attributes':_0x176c92[_0x7694('0x1e')],'include':_0x176c92['include']?_[_0x7694('0x22')](_0x176c92['include'],function(_0x497ace){return{'model':db[_0x497ace[_0x7694('0x21')]],'as':_0x497ace['as'],'attributes':_0x497ace[_0x7694('0x1e')],'include':_0x497ace[_0x7694('0x20')]?_[_0x7694('0x22')](_0x497ace[_0x7694('0x20')],function(_0x223c3a){return{'model':db[_0x223c3a['model']],'as':_0x223c3a['as'],'attributes':_0x223c3a[_0x7694('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x7694('0xe')](function(_0x5bcbd7){logger['info'](_0x7694('0x19'),_0x8f962c);logger['debug'](_0x7694('0x19'),_0x8f962c,JSON[_0x7694('0x13')](_0x5bcbd7));_0x55d425(_0x5bcbd7);})['catch'](function(_0x3d15ac){logger['error'](_0x7694('0x19'),_0x3d15ac[_0x7694('0x16')],_0x8f962c);_0x3865fd(_0x4d7669[_0x7694('0x14')](0x1f4,_0x3d15ac[_0x7694('0x16')]));});});};exports[_0x7694('0x23')]=function(_0xc8bf35){var _0x32dcba=this;return new Promise(function(_0x38a309,_0x449e2a){return db['FaxQueue'][_0x7694('0x24')]({'raw':_0xc8bf35['options']?_0xc8bf35[_0x7694('0x1d')][_0x7694('0x1c')]===undefined?!![]:![]:!![],'where':_0xc8bf35[_0x7694('0x1d')]?_0xc8bf35[_0x7694('0x1d')]['where']||null:null,'attributes':_0xc8bf35[_0x7694('0x1d')]?_0xc8bf35[_0x7694('0x1d')][_0x7694('0x1e')]||null:null,'include':_0xc8bf35['options']?_0xc8bf35['options'][_0x7694('0x20')]?_[_0x7694('0x22')](_0xc8bf35[_0x7694('0x1d')][_0x7694('0x20')],function(_0xae2331){return{'model':db[_0xae2331[_0x7694('0x21')]],'as':_0xae2331['as'],'attributes':_0xae2331[_0x7694('0x1e')],'include':_0xae2331[_0x7694('0x20')]?_['map'](_0xae2331[_0x7694('0x20')],function(_0x4fbc33){return{'model':db[_0x4fbc33[_0x7694('0x21')]],'as':_0x4fbc33['as'],'attributes':_0x4fbc33[_0x7694('0x1e')],'include':_0x4fbc33[_0x7694('0x20')]?_[_0x7694('0x22')](_0x4fbc33[_0x7694('0x20')],function(_0x23fc4b){return{'model':db[_0x23fc4b[_0x7694('0x21')]],'as':_0x23fc4b['as'],'attributes':_0x23fc4b[_0x7694('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x7694('0xe')](function(_0x3832ed){logger[_0x7694('0xf')](_0x7694('0x23'),_0xc8bf35);logger[_0x7694('0x11')](_0x7694('0x23'),_0xc8bf35,JSON[_0x7694('0x13')](_0x3832ed));_0x38a309(_0x3832ed);})[_0x7694('0x18')](function(_0x37747d){logger[_0x7694('0x14')]('ShowFaxQueue',_0x37747d[_0x7694('0x16')],_0xc8bf35);_0x449e2a(_0x32dcba[_0x7694('0x14')](0x1f4,_0x37747d['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 5720910..06af386 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 _0x2e1a=['emit','removeListener','register','length','remove','update'];(function(_0x24f2f7,_0xa2cc0d){var _0xce745f=function(_0x24fbaf){while(--_0x24fbaf){_0x24f2f7['push'](_0x24f2f7['shift']());}};_0xce745f(++_0xa2cc0d);}(_0x2e1a,0xd6));var _0xa2e1=function(_0x1f7413,_0x3388c3){_0x1f7413=_0x1f7413-0x0;var _0x2d2775=_0x2e1a[_0x1f7413];return _0x2d2775;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=['save',_0xa2e1('0x0'),_0xa2e1('0x1')];function createListener(_0x54c3f9,_0xdbff44){return function(_0x3567a2){_0xdbff44[_0xa2e1('0x2')](_0x54c3f9,_0x3567a2);};}function removeListener(_0x242e1b,_0x29ffd9){return function(){FaxQueueEvents[_0xa2e1('0x3')](_0x242e1b,_0x29ffd9);};}exports[_0xa2e1('0x4')]=function(_0x4d534c){for(var _0x4428a9=0x0,_0x12d688=events[_0xa2e1('0x5')];_0x4428a9<_0x12d688;_0x4428a9++){var _0x24549a=events[_0x4428a9];var _0x225eae=createListener('faxQueue:'+_0x24549a,_0x4d534c);FaxQueueEvents['on'](_0x24549a,_0x225eae);}}; \ No newline at end of file +var _0x6bcd=['save','remove','emit','removeListener','register','length','faxQueue:'];(function(_0x4365be,_0x216cf8){var _0x243a6f=function(_0x1749e5){while(--_0x1749e5){_0x4365be['push'](_0x4365be['shift']());}};_0x243a6f(++_0x216cf8);}(_0x6bcd,0x111));var _0xd6bc=function(_0x1c09db,_0x120059){_0x1c09db=_0x1c09db-0x0;var _0xfa1a2c=_0x6bcd[_0x1c09db];return _0xfa1a2c;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=[_0xd6bc('0x0'),_0xd6bc('0x1'),'update'];function createListener(_0x2e875d,_0x2d50f1){return function(_0xcc3ae5){_0x2d50f1[_0xd6bc('0x2')](_0x2e875d,_0xcc3ae5);};}function removeListener(_0xbecdfe,_0xf22d4c){return function(){FaxQueueEvents[_0xd6bc('0x3')](_0xbecdfe,_0xf22d4c);};}exports[_0xd6bc('0x4')]=function(_0x1bb6a6){for(var _0x4f4eb1=0x0,_0x24f1ed=events[_0xd6bc('0x5')];_0x4f4eb1<_0x24f1ed;_0x4f4eb1++){var _0x18de97=events[_0x4f4eb1];var _0x1c59ab=createListener(_0xd6bc('0x6')+_0x18de97,_0x1bb6a6);FaxQueueEvents['on'](_0x18de97,_0x1c59ab);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index e3d4a85..822f828 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 _0x0e4b=['delete','destroy','removeAgents','exports','multer','util','path','express','../../config/environment','./faxQueue.controller','isAuthenticated','index','get','/describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','create','addTeams','post','put','update'];(function(_0x1f8e92,_0x292466){var _0x1c4377=function(_0x36f06f){while(--_0x36f06f){_0x1f8e92['push'](_0x1f8e92['shift']());}};_0x1c4377(++_0x292466);}(_0x0e4b,0xdc));var _0xb0e4=function(_0x5e8bbf,_0x27f32a){_0x5e8bbf=_0x5e8bbf-0x0;var _0x5f4441=_0x0e4b[_0x5e8bbf];return _0x5f4441;};'use strict';var multer=require(_0xb0e4('0x0'));var util=require(_0xb0e4('0x1'));var path=require(_0xb0e4('0x2'));var timeout=require('connect-timeout');var express=require(_0xb0e4('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb0e4('0x4'));var controller=require(_0xb0e4('0x5'));router['get']('/',auth[_0xb0e4('0x6')](),controller[_0xb0e4('0x7')]);router[_0xb0e4('0x8')](_0xb0e4('0x9'),auth[_0xb0e4('0x6')](),controller['describe']);router['get'](_0xb0e4('0xa'),auth[_0xb0e4('0x6')](),controller[_0xb0e4('0xb')]);router[_0xb0e4('0x8')](_0xb0e4('0xc'),auth[_0xb0e4('0x6')](),controller[_0xb0e4('0xd')]);router[_0xb0e4('0x8')](_0xb0e4('0xe'),auth[_0xb0e4('0x6')](),controller[_0xb0e4('0xf')]);router[_0xb0e4('0x8')](_0xb0e4('0x10'),auth[_0xb0e4('0x6')](),controller[_0xb0e4('0x11')]);router['post']('/',auth[_0xb0e4('0x6')](),controller[_0xb0e4('0x12')]);router['post'](_0xb0e4('0xe'),auth[_0xb0e4('0x6')](),controller[_0xb0e4('0x13')]);router[_0xb0e4('0x14')](_0xb0e4('0x10'),auth['isAuthenticated'](),controller['addAgents']);router[_0xb0e4('0x15')](_0xb0e4('0xa'),auth['isAuthenticated'](),controller[_0xb0e4('0x16')]);router[_0xb0e4('0x17')](_0xb0e4('0xa'),auth[_0xb0e4('0x6')](),controller[_0xb0e4('0x18')]);router[_0xb0e4('0x17')]('/:id/teams',auth['isAuthenticated'](),controller['removeTeams']);router[_0xb0e4('0x17')](_0xb0e4('0x10'),auth[_0xb0e4('0x6')](),controller[_0xb0e4('0x19')]);module[_0xb0e4('0x1a')]=router; \ No newline at end of file +var _0xde46=['path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','update','delete','removeTeams','removeAgents','exports','multer','util'];(function(_0x5cc4bc,_0x38e8d5){var _0x1632eb=function(_0x4cb73a){while(--_0x4cb73a){_0x5cc4bc['push'](_0x5cc4bc['shift']());}};_0x1632eb(++_0x38e8d5);}(_0xde46,0x14e));var _0x6de4=function(_0x104331,_0x36438f){_0x104331=_0x104331-0x0;var _0x15d356=_0xde46[_0x104331];return _0x15d356;};'use strict';var multer=require(_0x6de4('0x0'));var util=require(_0x6de4('0x1'));var path=require(_0x6de4('0x2'));var timeout=require(_0x6de4('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x6de4('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x6de4('0x5'));var config=require(_0x6de4('0x6'));var controller=require(_0x6de4('0x7'));router[_0x6de4('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x6de4('0x8')]('/describe',auth[_0x6de4('0x9')](),controller[_0x6de4('0xa')]);router['get'](_0x6de4('0xb'),auth[_0x6de4('0x9')](),controller[_0x6de4('0xc')]);router[_0x6de4('0x8')](_0x6de4('0xd'),auth[_0x6de4('0x9')](),controller[_0x6de4('0xe')]);router[_0x6de4('0x8')](_0x6de4('0xf'),auth[_0x6de4('0x9')](),controller[_0x6de4('0x10')]);router['get'](_0x6de4('0x11'),auth[_0x6de4('0x9')](),controller[_0x6de4('0x12')]);router[_0x6de4('0x13')]('/',auth[_0x6de4('0x9')](),controller[_0x6de4('0x14')]);router[_0x6de4('0x13')](_0x6de4('0xf'),auth['isAuthenticated'](),controller[_0x6de4('0x15')]);router['post'](_0x6de4('0x11'),auth[_0x6de4('0x9')](),controller[_0x6de4('0x16')]);router['put'](_0x6de4('0xb'),auth[_0x6de4('0x9')](),controller[_0x6de4('0x17')]);router[_0x6de4('0x18')]('/:id',auth[_0x6de4('0x9')](),controller['destroy']);router['delete'](_0x6de4('0xf'),auth[_0x6de4('0x9')](),controller[_0x6de4('0x19')]);router[_0x6de4('0x18')](_0x6de4('0x11'),auth[_0x6de4('0x9')](),controller[_0x6de4('0x1a')]);module[_0x6de4('0x1b')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index a39d0bf..9e41332 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 _0x591c=['STRING','DATE','moment','sequelize','exports'];(function(_0x218904,_0x1181f4){var _0x280217=function(_0x4fcab3){while(--_0x4fcab3){_0x218904['push'](_0x218904['shift']());}};_0x280217(++_0x1181f4);}(_0x591c,0x8e));var _0xc591=function(_0x126b90,_0x3a44bb){_0x126b90=_0x126b90-0x0;var _0x789c78=_0x591c[_0x126b90];return _0x789c78;};'use strict';var moment=require(_0xc591('0x0'));var Sequelize=require(_0xc591('0x1'));module[_0xc591('0x2')]={'uniqueid':{'type':Sequelize[_0xc591('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xc591('0x3')]},'joinAt':{'type':Sequelize[_0xc591('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xc591('0x4')]},'exitAt':{'type':Sequelize[_0xc591('0x4')]},'reason':{'type':Sequelize[_0xc591('0x3')]}}; \ No newline at end of file +var _0x0782=['STRING','DATE','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0782,0x7e));var _0x2078=function(_0x18afca,_0x4219d9){_0x18afca=_0x18afca-0x0;var _0x11603f=_0x0782[_0x18afca];return _0x11603f;};'use strict';var moment=require('moment');var Sequelize=require(_0x2078('0x0'));module[_0x2078('0x1')]={'uniqueid':{'type':Sequelize[_0x2078('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x2078('0x2')]},'joinAt':{'type':Sequelize[_0x2078('0x3')]},'leaveAt':{'type':Sequelize[_0x2078('0x3')]},'acceptAt':{'type':Sequelize[_0x2078('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x2078('0x2')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index a7b4dfc..e8e2c38 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 _0xdeb7=['reject','save','update','destroy','then','error','stack','name','send','index','map','FaxQueueReport','fieldName','type','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','merge','options','findAll','rows','show','params','includeAll','include','find','catch','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply'];(function(_0x12f219,_0x35a87e){var _0x3981c8=function(_0x58656d){while(--_0x58656d){_0x12f219['push'](_0x12f219['shift']());}};_0x3981c8(++_0x35a87e);}(_0xdeb7,0x77));var _0x7deb=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xdeb7[_0x2641f9];return _0x585741;};'use strict';var emlformat=require(_0x7deb('0x0'));var rimraf=require(_0x7deb('0x1'));var zipdir=require(_0x7deb('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7deb('0x3'));var moment=require(_0x7deb('0x4'));var BPromise=require(_0x7deb('0x5'));var Mustache=require(_0x7deb('0x6'));var util=require(_0x7deb('0x7'));var path=require('path');var sox=require(_0x7deb('0x8'));var csv=require(_0x7deb('0x9'));var ejs=require(_0x7deb('0xa'));var fs=require('fs');var fs_extra=require(_0x7deb('0xb'));var _=require(_0x7deb('0xc'));var squel=require(_0x7deb('0xd'));var crypto=require('crypto');var jsforce=require(_0x7deb('0xe'));var deskjs=require(_0x7deb('0xf'));var toCsv=require(_0x7deb('0x9'));var querystring=require(_0x7deb('0x10'));var Papa=require('papaparse');var Redis=require(_0x7deb('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x7deb('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7deb('0x13'))(_0x7deb('0x14'));var utils=require(_0x7deb('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x7deb('0x16'));var db=require(_0x7deb('0x17'))['db'];function respondWithStatusCode(_0x39784a,_0x156f81){_0x156f81=_0x156f81||0xcc;return function(_0x57f507){if(_0x57f507){return _0x39784a[_0x7deb('0x18')](_0x156f81);}return _0x39784a[_0x7deb('0x19')](_0x156f81)[_0x7deb('0x1a')]();};}function respondWithResult(_0x290f7a,_0xdf8efb){_0xdf8efb=_0xdf8efb||0xc8;return function(_0x2b784f){if(_0x2b784f){return _0x290f7a[_0x7deb('0x19')](_0xdf8efb)[_0x7deb('0x1b')](_0x2b784f);}};}function respondWithFilteredResult(_0x18957d,_0x405ae6){return function(_0x470e07){if(_0x470e07){var _0x4764e3=typeof _0x405ae6[_0x7deb('0x1c')]===_0x7deb('0x1d')&&typeof _0x405ae6[_0x7deb('0x1e')]==='undefined';var _0x13831c=_0x470e07['count'];var _0x2241a3=_0x4764e3?0x0:_0x405ae6[_0x7deb('0x1c')];var _0x5439ac=_0x4764e3?_0x470e07[_0x7deb('0x1f')]:_0x405ae6[_0x7deb('0x1c')]+_0x405ae6[_0x7deb('0x1e')];var _0x2670a2;if(_0x5439ac>=_0x13831c){_0x5439ac=_0x13831c;_0x2670a2=0xc8;}else{_0x2670a2=0xce;}_0x18957d[_0x7deb('0x19')](_0x2670a2);return _0x18957d[_0x7deb('0x20')](_0x7deb('0x21'),_0x2241a3+'-'+_0x5439ac+'/'+_0x13831c)[_0x7deb('0x1b')](_0x470e07);}return null;};}function patchUpdates(_0x27a448){return function(_0x4e4f8f){try{jsonpatch[_0x7deb('0x22')](_0x4e4f8f,_0x27a448,!![]);}catch(_0x262a0d){return BPromise[_0x7deb('0x23')](_0x262a0d);}return _0x4e4f8f[_0x7deb('0x24')]();};}function saveUpdates(_0x21e061,_0x2f88ca){return function(_0x31dd30){if(_0x31dd30){return _0x31dd30[_0x7deb('0x25')](_0x21e061)['then'](function(_0x3151d6){return _0x3151d6;});}return null;};}function removeEntity(_0x2f1e42,_0x2cb976){return function(_0x529e23){if(_0x529e23){return _0x529e23[_0x7deb('0x26')]()[_0x7deb('0x27')](function(){_0x2f1e42[_0x7deb('0x19')](0xcc)[_0x7deb('0x1a')]();});}};}function handleEntityNotFound(_0x5e2258,_0x26ab14){return function(_0x28023c){if(!_0x28023c){_0x5e2258[_0x7deb('0x18')](0x194);}return _0x28023c;};}function handleError(_0x3e9607,_0x4972ca){_0x4972ca=_0x4972ca||0x1f4;return function(_0x1e9806){logger[_0x7deb('0x28')](_0x1e9806[_0x7deb('0x29')]);if(_0x1e9806[_0x7deb('0x2a')]){delete _0x1e9806[_0x7deb('0x2a')];}_0x3e9607[_0x7deb('0x19')](_0x4972ca)[_0x7deb('0x2b')](_0x1e9806);};}exports[_0x7deb('0x2c')]=function(_0x14ec6f,_0x495ae4){var _0x7e4af3={},_0x50ce4b={},_0x1ce28d={'count':0x0,'rows':[]};var _0x480d7c=_[_0x7deb('0x2d')](db[_0x7deb('0x2e')]['rawAttributes'],function(_0x513bae){return{'name':_0x513bae[_0x7deb('0x2f')],'type':_0x513bae[_0x7deb('0x30')]['key']};});_0x50ce4b['model']=_[_0x7deb('0x2d')](_0x480d7c,_0x7deb('0x2a'));_0x50ce4b[_0x7deb('0x31')]=_[_0x7deb('0x32')](_0x14ec6f[_0x7deb('0x31')]);_0x50ce4b[_0x7deb('0x33')]=_[_0x7deb('0x34')](_0x50ce4b[_0x7deb('0x35')],_0x50ce4b[_0x7deb('0x31')]);_0x7e4af3['attributes']=_[_0x7deb('0x34')](_0x50ce4b['model'],qs[_0x7deb('0x36')](_0x14ec6f[_0x7deb('0x31')][_0x7deb('0x36')]));_0x7e4af3[_0x7deb('0x37')]=_0x7e4af3[_0x7deb('0x37')][_0x7deb('0x38')]?_0x7e4af3[_0x7deb('0x37')]:_0x50ce4b[_0x7deb('0x35')];if(!_0x14ec6f[_0x7deb('0x31')][_0x7deb('0x39')]('nolimit')){_0x7e4af3[_0x7deb('0x1e')]=qs[_0x7deb('0x1e')](_0x14ec6f['query']['limit']);_0x7e4af3['offset']=qs[_0x7deb('0x1c')](_0x14ec6f['query'][_0x7deb('0x1c')]);}_0x7e4af3[_0x7deb('0x3a')]=qs[_0x7deb('0x3b')](_0x14ec6f[_0x7deb('0x31')]['sort']);_0x7e4af3['where']=qs['filters'](_[_0x7deb('0x3c')](_0x14ec6f[_0x7deb('0x31')],_0x50ce4b[_0x7deb('0x33')]),_0x480d7c);if(_0x14ec6f[_0x7deb('0x31')][_0x7deb('0x3d')]){_0x7e4af3[_0x7deb('0x3e')]=_['merge'](_0x7e4af3['where'],{'$or':_[_0x7deb('0x2d')](_0x480d7c,function(_0x73e74b){if(_0x73e74b['type']!==_0x7deb('0x3f')){var _0x50a4b7={};_0x50a4b7[_0x73e74b[_0x7deb('0x2a')]]={'$like':'%'+_0x14ec6f[_0x7deb('0x31')][_0x7deb('0x3d')]+'%'};return _0x50a4b7;}})});}_0x7e4af3=_[_0x7deb('0x40')]({},_0x7e4af3,_0x14ec6f[_0x7deb('0x41')]);var _0x15452d={'where':_0x7e4af3['where']};return db[_0x7deb('0x2e')][_0x7deb('0x1f')](_0x15452d)[_0x7deb('0x27')](function(_0x3dfc1e){_0x1ce28d['count']=_0x3dfc1e;if(_0x14ec6f[_0x7deb('0x31')]['includeAll']){_0x7e4af3['include']=[{'all':!![]}];}return db['FaxQueueReport'][_0x7deb('0x42')](_0x7e4af3);})[_0x7deb('0x27')](function(_0x5c7351){_0x1ce28d[_0x7deb('0x43')]=_0x5c7351;return _0x1ce28d;})[_0x7deb('0x27')](respondWithFilteredResult(_0x495ae4,_0x7e4af3))['catch'](handleError(_0x495ae4,null));};exports[_0x7deb('0x44')]=function(_0x5d2cb3,_0x5036e0){var _0x3e1612={'raw':!![],'where':{'id':_0x5d2cb3[_0x7deb('0x45')]['id']}},_0x2dbd49={};_0x2dbd49[_0x7deb('0x35')]=_[_0x7deb('0x32')](db[_0x7deb('0x2e')]['rawAttributes']);_0x2dbd49[_0x7deb('0x31')]=_[_0x7deb('0x32')](_0x5d2cb3[_0x7deb('0x31')]);_0x2dbd49[_0x7deb('0x33')]=_[_0x7deb('0x34')](_0x2dbd49[_0x7deb('0x35')],_0x2dbd49[_0x7deb('0x31')]);_0x3e1612['attributes']=_[_0x7deb('0x34')](_0x2dbd49[_0x7deb('0x35')],qs[_0x7deb('0x36')](_0x5d2cb3[_0x7deb('0x31')][_0x7deb('0x36')]));_0x3e1612[_0x7deb('0x37')]=_0x3e1612['attributes']['length']?_0x3e1612[_0x7deb('0x37')]:_0x2dbd49[_0x7deb('0x35')];if(_0x5d2cb3[_0x7deb('0x31')][_0x7deb('0x46')]){_0x3e1612[_0x7deb('0x47')]=[{'all':!![]}];}_0x3e1612=_[_0x7deb('0x40')]({},_0x3e1612,_0x5d2cb3[_0x7deb('0x41')]);return db['FaxQueueReport'][_0x7deb('0x48')](_0x3e1612)[_0x7deb('0x27')](handleEntityNotFound(_0x5036e0,null))[_0x7deb('0x27')](respondWithResult(_0x5036e0,null))[_0x7deb('0x49')](handleError(_0x5036e0,null));};exports[_0x7deb('0x4a')]=function(_0x3aa735,_0x12e14d){return db[_0x7deb('0x2e')]['create'](_0x3aa735[_0x7deb('0x4b')],{})['then'](respondWithResult(_0x12e14d,0xc9))[_0x7deb('0x49')](handleError(_0x12e14d,null));};exports['update']=function(_0x4edd73,_0x5c9790){if(_0x4edd73[_0x7deb('0x4b')]['id']){delete _0x4edd73['body']['id'];}return db[_0x7deb('0x2e')]['find']({'where':{'id':_0x4edd73[_0x7deb('0x45')]['id']}})[_0x7deb('0x27')](handleEntityNotFound(_0x5c9790,null))[_0x7deb('0x27')](saveUpdates(_0x4edd73[_0x7deb('0x4b')],null))[_0x7deb('0x27')](respondWithResult(_0x5c9790,null))[_0x7deb('0x49')](handleError(_0x5c9790,null));};exports[_0x7deb('0x26')]=function(_0x487548,_0x2ea119){return db[_0x7deb('0x2e')]['find']({'where':{'id':_0x487548['params']['id']}})['then'](handleEntityNotFound(_0x2ea119,null))[_0x7deb('0x27')](removeEntity(_0x2ea119,null))[_0x7deb('0x49')](handleError(_0x2ea119,null));};exports['describe']=function(_0x10bef4,_0x2c3af2){return db[_0x7deb('0x2e')][_0x7deb('0x4c')]()[_0x7deb('0x27')](respondWithResult(_0x2c3af2,null))[_0x7deb('0x49')](handleError(_0x2c3af2,null));}; \ No newline at end of file +var _0x0eec=['limit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','count','offset','json','apply','reject','update','destroy','then','end','stack','name','index','map','FaxQueueReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty'];(function(_0xd6fcb5,_0x526523){var _0x278ac7=function(_0x3a9512){while(--_0x3a9512){_0xd6fcb5['push'](_0xd6fcb5['shift']());}};_0x278ac7(++_0x526523);}(_0x0eec,0xac));var _0xc0ee=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0eec[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0xc0ee('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc0ee('0x1'));var rp=require(_0xc0ee('0x2'));var moment=require(_0xc0ee('0x3'));var BPromise=require(_0xc0ee('0x4'));var Mustache=require(_0xc0ee('0x5'));var util=require(_0xc0ee('0x6'));var path=require(_0xc0ee('0x7'));var sox=require('sox');var csv=require(_0xc0ee('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc0ee('0x9'));var _=require(_0xc0ee('0xa'));var squel=require(_0xc0ee('0xb'));var crypto=require(_0xc0ee('0xc'));var jsforce=require(_0xc0ee('0xd'));var deskjs=require(_0xc0ee('0xe'));var toCsv=require(_0xc0ee('0x8'));var querystring=require('querystring');var Papa=require(_0xc0ee('0xf'));var Redis=require(_0xc0ee('0x10'));var authService=require(_0xc0ee('0x11'));var qs=require(_0xc0ee('0x12'));var as=require(_0xc0ee('0x13'));var hardwareService=require(_0xc0ee('0x14'));var logger=require(_0xc0ee('0x15'))('api');var utils=require(_0xc0ee('0x16'));var config=require(_0xc0ee('0x17'));var licenseUtil=require(_0xc0ee('0x18'));var db=require(_0xc0ee('0x19'))['db'];function respondWithStatusCode(_0x22d46b,_0x2d4e3c){_0x2d4e3c=_0x2d4e3c||0xcc;return function(_0x454f5d){if(_0x454f5d){return _0x22d46b[_0xc0ee('0x1a')](_0x2d4e3c);}return _0x22d46b[_0xc0ee('0x1b')](_0x2d4e3c)['end']();};}function respondWithResult(_0x51ae2e,_0x1f3ad9){_0x1f3ad9=_0x1f3ad9||0xc8;return function(_0x325193){if(_0x325193){return _0x51ae2e[_0xc0ee('0x1b')](_0x1f3ad9)['json'](_0x325193);}};}function respondWithFilteredResult(_0x170bf9,_0x30c324){return function(_0x448448){if(_0x448448){var _0x58e1f0=typeof _0x30c324['offset']===_0xc0ee('0x1c')&&typeof _0x30c324['limit']===_0xc0ee('0x1c');var _0x20195b=_0x448448[_0xc0ee('0x1d')];var _0x59aad9=_0x58e1f0?0x0:_0x30c324['offset'];var _0x16d050=_0x58e1f0?_0x448448[_0xc0ee('0x1d')]:_0x30c324[_0xc0ee('0x1e')]+_0x30c324['limit'];var _0x390ee4;if(_0x16d050>=_0x20195b){_0x16d050=_0x20195b;_0x390ee4=0xc8;}else{_0x390ee4=0xce;}_0x170bf9[_0xc0ee('0x1b')](_0x390ee4);return _0x170bf9['set']('Content-Range',_0x59aad9+'-'+_0x16d050+'/'+_0x20195b)[_0xc0ee('0x1f')](_0x448448);}return null;};}function patchUpdates(_0x233333){return function(_0x4dd8c9){try{jsonpatch[_0xc0ee('0x20')](_0x4dd8c9,_0x233333,!![]);}catch(_0x30a00c){return BPromise[_0xc0ee('0x21')](_0x30a00c);}return _0x4dd8c9['save']();};}function saveUpdates(_0x49be2a,_0x5af925){return function(_0x7ec74){if(_0x7ec74){return _0x7ec74[_0xc0ee('0x22')](_0x49be2a)['then'](function(_0x2c3d95){return _0x2c3d95;});}return null;};}function removeEntity(_0x453490,_0x20b657){return function(_0x11b6a4){if(_0x11b6a4){return _0x11b6a4[_0xc0ee('0x23')]()[_0xc0ee('0x24')](function(){_0x453490[_0xc0ee('0x1b')](0xcc)[_0xc0ee('0x25')]();});}};}function handleEntityNotFound(_0x38abc9,_0x6d1087){return function(_0x2b0584){if(!_0x2b0584){_0x38abc9[_0xc0ee('0x1a')](0x194);}return _0x2b0584;};}function handleError(_0x168ab5,_0x30582e){_0x30582e=_0x30582e||0x1f4;return function(_0x4288e1){logger['error'](_0x4288e1[_0xc0ee('0x26')]);if(_0x4288e1[_0xc0ee('0x27')]){delete _0x4288e1['name'];}_0x168ab5[_0xc0ee('0x1b')](_0x30582e)['send'](_0x4288e1);};}exports[_0xc0ee('0x28')]=function(_0x410fb2,_0x44b511){var _0x1d3594={},_0x46ca29={},_0x369764={'count':0x0,'rows':[]};var _0x24a67a=_[_0xc0ee('0x29')](db[_0xc0ee('0x2a')][_0xc0ee('0x2b')],function(_0x394777){return{'name':_0x394777[_0xc0ee('0x2c')],'type':_0x394777[_0xc0ee('0x2d')][_0xc0ee('0x2e')]};});_0x46ca29['model']=_['map'](_0x24a67a,_0xc0ee('0x27'));_0x46ca29[_0xc0ee('0x2f')]=_[_0xc0ee('0x30')](_0x410fb2[_0xc0ee('0x2f')]);_0x46ca29[_0xc0ee('0x31')]=_[_0xc0ee('0x32')](_0x46ca29[_0xc0ee('0x33')],_0x46ca29[_0xc0ee('0x2f')]);_0x1d3594[_0xc0ee('0x34')]=_[_0xc0ee('0x32')](_0x46ca29[_0xc0ee('0x33')],qs['fields'](_0x410fb2[_0xc0ee('0x2f')][_0xc0ee('0x35')]));_0x1d3594[_0xc0ee('0x34')]=_0x1d3594[_0xc0ee('0x34')][_0xc0ee('0x36')]?_0x1d3594['attributes']:_0x46ca29[_0xc0ee('0x33')];if(!_0x410fb2[_0xc0ee('0x2f')][_0xc0ee('0x37')]('nolimit')){_0x1d3594[_0xc0ee('0x38')]=qs[_0xc0ee('0x38')](_0x410fb2[_0xc0ee('0x2f')][_0xc0ee('0x38')]);_0x1d3594['offset']=qs[_0xc0ee('0x1e')](_0x410fb2['query'][_0xc0ee('0x1e')]);}_0x1d3594[_0xc0ee('0x39')]=qs[_0xc0ee('0x3a')](_0x410fb2[_0xc0ee('0x2f')][_0xc0ee('0x3a')]);_0x1d3594[_0xc0ee('0x3b')]=qs[_0xc0ee('0x31')](_[_0xc0ee('0x3c')](_0x410fb2[_0xc0ee('0x2f')],_0x46ca29[_0xc0ee('0x31')]),_0x24a67a);if(_0x410fb2[_0xc0ee('0x2f')]['filter']){_0x1d3594[_0xc0ee('0x3b')]=_[_0xc0ee('0x3d')](_0x1d3594[_0xc0ee('0x3b')],{'$or':_[_0xc0ee('0x29')](_0x24a67a,function(_0x1cb120){if(_0x1cb120[_0xc0ee('0x2d')]!==_0xc0ee('0x3e')){var _0x2d7b9e={};_0x2d7b9e[_0x1cb120['name']]={'$like':'%'+_0x410fb2['query'][_0xc0ee('0x3f')]+'%'};return _0x2d7b9e;}})});}_0x1d3594=_['merge']({},_0x1d3594,_0x410fb2[_0xc0ee('0x40')]);var _0xf46dc5={'where':_0x1d3594['where']};return db[_0xc0ee('0x2a')]['count'](_0xf46dc5)[_0xc0ee('0x24')](function(_0x4f385a){_0x369764['count']=_0x4f385a;if(_0x410fb2['query'][_0xc0ee('0x41')]){_0x1d3594[_0xc0ee('0x42')]=[{'all':!![]}];}return db[_0xc0ee('0x2a')][_0xc0ee('0x43')](_0x1d3594);})['then'](function(_0x3c0c7b){_0x369764[_0xc0ee('0x44')]=_0x3c0c7b;return _0x369764;})[_0xc0ee('0x24')](respondWithFilteredResult(_0x44b511,_0x1d3594))[_0xc0ee('0x45')](handleError(_0x44b511,null));};exports[_0xc0ee('0x46')]=function(_0x5c2111,_0x388c7b){var _0x264a41={'raw':!![],'where':{'id':_0x5c2111[_0xc0ee('0x47')]['id']}},_0x5577aa={};_0x5577aa['model']=_[_0xc0ee('0x30')](db[_0xc0ee('0x2a')]['rawAttributes']);_0x5577aa[_0xc0ee('0x2f')]=_[_0xc0ee('0x30')](_0x5c2111['query']);_0x5577aa[_0xc0ee('0x31')]=_[_0xc0ee('0x32')](_0x5577aa['model'],_0x5577aa[_0xc0ee('0x2f')]);_0x264a41[_0xc0ee('0x34')]=_[_0xc0ee('0x32')](_0x5577aa[_0xc0ee('0x33')],qs[_0xc0ee('0x35')](_0x5c2111['query']['fields']));_0x264a41[_0xc0ee('0x34')]=_0x264a41[_0xc0ee('0x34')][_0xc0ee('0x36')]?_0x264a41[_0xc0ee('0x34')]:_0x5577aa['model'];if(_0x5c2111['query'][_0xc0ee('0x41')]){_0x264a41[_0xc0ee('0x42')]=[{'all':!![]}];}_0x264a41=_[_0xc0ee('0x3d')]({},_0x264a41,_0x5c2111['options']);return db['FaxQueueReport'][_0xc0ee('0x48')](_0x264a41)[_0xc0ee('0x24')](handleEntityNotFound(_0x388c7b,null))[_0xc0ee('0x24')](respondWithResult(_0x388c7b,null))['catch'](handleError(_0x388c7b,null));};exports[_0xc0ee('0x49')]=function(_0x3d6a10,_0x5e5f5e){return db[_0xc0ee('0x2a')][_0xc0ee('0x49')](_0x3d6a10[_0xc0ee('0x4a')],{})[_0xc0ee('0x24')](respondWithResult(_0x5e5f5e,0xc9))['catch'](handleError(_0x5e5f5e,null));};exports['update']=function(_0x22c742,_0x5ca93b){if(_0x22c742['body']['id']){delete _0x22c742['body']['id'];}return db[_0xc0ee('0x2a')]['find']({'where':{'id':_0x22c742[_0xc0ee('0x47')]['id']}})[_0xc0ee('0x24')](handleEntityNotFound(_0x5ca93b,null))[_0xc0ee('0x24')](saveUpdates(_0x22c742['body'],null))[_0xc0ee('0x24')](respondWithResult(_0x5ca93b,null))['catch'](handleError(_0x5ca93b,null));};exports[_0xc0ee('0x23')]=function(_0x4b2fcc,_0x3bb5ae){return db[_0xc0ee('0x2a')][_0xc0ee('0x48')]({'where':{'id':_0x4b2fcc[_0xc0ee('0x47')]['id']}})[_0xc0ee('0x24')](handleEntityNotFound(_0x3bb5ae,null))[_0xc0ee('0x24')](removeEntity(_0x3bb5ae,null))['catch'](handleError(_0x3bb5ae,null));};exports['describe']=function(_0x6e6b2c,_0x497ed9){return db[_0xc0ee('0x2a')][_0xc0ee('0x4b')]()[_0xc0ee('0x24')](respondWithResult(_0x497ed9,null))[_0xc0ee('0x45')](handleError(_0x497ed9,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index b065d62..ca30dfd 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 _0x4975=['path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','FaxQueueReport','report_fax_queue','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x428072,_0xa5916d){var _0x1677f8=function(_0x2eee88){while(--_0x2eee88){_0x428072['push'](_0x428072['shift']());}};_0x1677f8(++_0xa5916d);}(_0x4975,0x86));var _0x5497=function(_0x2c468b,_0x3217f6){_0x2c468b=_0x2c468b-0x0;var _0x138324=_0x4975[_0x2c468b];return _0x138324;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var logger=require(_0x5497('0x1'))(_0x5497('0x2'));var moment=require(_0x5497('0x3'));var BPromise=require(_0x5497('0x4'));var rp=require(_0x5497('0x5'));var fs=require('fs');var path=require(_0x5497('0x6'));var rimraf=require(_0x5497('0x7'));var config=require(_0x5497('0x8'));var attributes=require(_0x5497('0x9'));module[_0x5497('0xa')]=function(_0x539a27,_0x37e48d){return _0x539a27['define'](_0x5497('0xb'),attributes,{'tableName':_0x5497('0xc'),'paranoid':![],'indexes':[{'name':_0x5497('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x4975=['path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','FaxQueueReport','report_fax_queue','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x20de28,_0x401cfe){var _0x1d1092=function(_0x49c086){while(--_0x49c086){_0x20de28['push'](_0x20de28['shift']());}};_0x1d1092(++_0x401cfe);}(_0x4975,0x86));var _0x5497=function(_0xb80124,_0x2a857d){_0xb80124=_0xb80124-0x0;var _0x20dc51=_0x4975[_0xb80124];return _0x20dc51;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var logger=require(_0x5497('0x1'))(_0x5497('0x2'));var moment=require(_0x5497('0x3'));var BPromise=require(_0x5497('0x4'));var rp=require(_0x5497('0x5'));var fs=require('fs');var path=require(_0x5497('0x6'));var rimraf=require(_0x5497('0x7'));var config=require(_0x5497('0x8'));var attributes=require(_0x5497('0x9'));module[_0x5497('0xa')]=function(_0x539a27,_0x37e48d){return _0x539a27['define'](_0x5497('0xb'),attributes,{'tableName':_0x5497('0xc'),'paranoid':![],'indexes':[{'name':_0x5497('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index dac3a11..d8efefd 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 _0x9f8c=['code','error','message','result','catch','CreateFaxQueueReport','create','body','options','raw','then','UpdateFaxQueueReport','FaxQueueReport','where','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','http','request','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x1b3564,_0x16c919){var _0x504069=function(_0x9322b6){while(--_0x9322b6){_0x1b3564['push'](_0x1b3564['shift']());}};_0x504069(++_0x16c919);}(_0x9f8c,0x14f));var _0xc9f8=function(_0x301c12,_0x562d75){_0x301c12=_0x301c12-0x0;var _0x3f48d2=_0x9f8c[_0x301c12];return _0x3f48d2;};'use strict';var _=require(_0xc9f8('0x0'));var util=require(_0xc9f8('0x1'));var moment=require(_0xc9f8('0x2'));var BPromise=require(_0xc9f8('0x3'));var rs=require(_0xc9f8('0x4'));var fs=require('fs');var Redis=require(_0xc9f8('0x5'));var db=require(_0xc9f8('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xc9f8('0x7'));var jayson=require(_0xc9f8('0x8'));var client=jayson['client'][_0xc9f8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x437b2a,_0x1cce89,_0x3513c8){return new BPromise(function(_0x55a102,_0x1c85f3){return client[_0xc9f8('0xa')](_0x437b2a,_0x3513c8)['then'](function(_0x1b96a4){logger[_0xc9f8('0xb')](_0xc9f8('0xc'),_0x1cce89,_0xc9f8('0xd'));logger[_0xc9f8('0xe')](_0xc9f8('0xf'),_0x1cce89,_0xc9f8('0xd'),JSON[_0xc9f8('0x10')](_0x1b96a4));if(_0x1b96a4['error']){if(_0x1b96a4['error'][_0xc9f8('0x11')]===0x1f4){logger[_0xc9f8('0x12')](_0xc9f8('0xc'),_0x1cce89,_0x1b96a4[_0xc9f8('0x12')]['message']);return _0x1c85f3(_0x1b96a4[_0xc9f8('0x12')][_0xc9f8('0x13')]);}logger[_0xc9f8('0x12')](_0xc9f8('0xc'),_0x1cce89,_0x1b96a4[_0xc9f8('0x12')][_0xc9f8('0x13')]);return _0x55a102(_0x1b96a4['error'][_0xc9f8('0x13')]);}else{logger['info'](_0xc9f8('0xc'),_0x1cce89,_0xc9f8('0xd'));_0x55a102(_0x1b96a4[_0xc9f8('0x14')][_0xc9f8('0x13')]);}})[_0xc9f8('0x15')](function(_0x2b5ed6){logger[_0xc9f8('0x12')]('FaxQueueReport,\x20%s,\x20%s',_0x1cce89,_0x2b5ed6);_0x1c85f3(_0x2b5ed6);});});}exports[_0xc9f8('0x16')]=function(_0x15484a){var _0x483242=this;return new Promise(function(_0x1a07f7,_0x1288bb){return db['FaxQueueReport'][_0xc9f8('0x17')](_0x15484a[_0xc9f8('0x18')],{'raw':_0x15484a[_0xc9f8('0x19')]?_0x15484a[_0xc9f8('0x19')][_0xc9f8('0x1a')]===undefined?!![]:![]:!![]})[_0xc9f8('0x1b')](function(_0xfcd666){logger[_0xc9f8('0xb')]('CreateFaxQueueReport',_0x15484a);logger[_0xc9f8('0xe')]('CreateFaxQueueReport',_0x15484a,JSON[_0xc9f8('0x10')](_0xfcd666));_0x1a07f7(_0xfcd666);})[_0xc9f8('0x15')](function(_0x198528){logger[_0xc9f8('0x12')]('CreateFaxQueueReport',_0x198528[_0xc9f8('0x13')],_0x15484a);_0x1288bb(_0x483242[_0xc9f8('0x12')](0x1f4,_0x198528[_0xc9f8('0x13')]));});});};exports[_0xc9f8('0x1c')]=function(_0x311f11){var _0x35e187=this;return new Promise(function(_0xb8d0a2,_0x2fd341){return db[_0xc9f8('0x1d')]['update'](_0x311f11[_0xc9f8('0x18')],{'raw':_0x311f11[_0xc9f8('0x19')]?_0x311f11[_0xc9f8('0x19')][_0xc9f8('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x311f11[_0xc9f8('0x19')]?_0x311f11['options'][_0xc9f8('0x1e')]||null:null,'attributes':_0x311f11[_0xc9f8('0x19')]?_0x311f11[_0xc9f8('0x19')][_0xc9f8('0x1f')]||null:null,'limit':_0x311f11['options']?_0x311f11[_0xc9f8('0x19')]['limit']||null:null})['then'](function(_0x3ff5c5){logger[_0xc9f8('0xb')]('UpdateFaxQueueReport',_0x311f11);logger[_0xc9f8('0xe')](_0xc9f8('0x1c'),_0x311f11,JSON[_0xc9f8('0x10')](_0x3ff5c5));_0xb8d0a2(_0x3ff5c5);})['catch'](function(_0x221d51){logger[_0xc9f8('0x12')](_0xc9f8('0x1c'),_0x221d51[_0xc9f8('0x13')],_0x311f11);_0x2fd341(_0x35e187[_0xc9f8('0x12')](0x1f4,_0x221d51['message']));});});}; \ No newline at end of file +var _0xf3af=['where','attributes','limit','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','info','FaxQueueReport,\x20%s,\x20%s','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','FaxQueueReport','create','body','options','raw','CreateFaxQueueReport','catch','UpdateFaxQueueReport','update'];(function(_0x319894,_0x2e8abf){var _0x925e0c=function(_0x373349){while(--_0x373349){_0x319894['push'](_0x319894['shift']());}};_0x925e0c(++_0x2e8abf);}(_0xf3af,0x1d1));var _0xff3a=function(_0x14d7df,_0x3fe7aa){_0x14d7df=_0x14d7df-0x0;var _0x91dede=_0xf3af[_0x14d7df];return _0x91dede;};'use strict';var _=require(_0xff3a('0x0'));var util=require(_0xff3a('0x1'));var moment=require('moment');var BPromise=require(_0xff3a('0x2'));var rs=require(_0xff3a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xff3a('0x4'))['db'];var utils=require(_0xff3a('0x5'));var logger=require('../../config/logger')(_0xff3a('0x6'));var config=require('../../config/environment');var jayson=require(_0xff3a('0x7'));var client=jayson[_0xff3a('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xd24d92,_0x4d521a,_0x42738f){return new BPromise(function(_0x352aca,_0x2e2f5b){return client[_0xff3a('0x9')](_0xd24d92,_0x42738f)[_0xff3a('0xa')](function(_0x554c62){logger[_0xff3a('0xb')](_0xff3a('0xc'),_0x4d521a,'request\x20sent');logger[_0xff3a('0xd')](_0xff3a('0xe'),_0x4d521a,_0xff3a('0xf'),JSON[_0xff3a('0x10')](_0x554c62));if(_0x554c62[_0xff3a('0x11')]){if(_0x554c62[_0xff3a('0x11')][_0xff3a('0x12')]===0x1f4){logger[_0xff3a('0x11')]('FaxQueueReport,\x20%s,\x20%s',_0x4d521a,_0x554c62[_0xff3a('0x11')][_0xff3a('0x13')]);return _0x2e2f5b(_0x554c62[_0xff3a('0x11')]['message']);}logger['error'](_0xff3a('0xc'),_0x4d521a,_0x554c62['error']['message']);return _0x352aca(_0x554c62[_0xff3a('0x11')][_0xff3a('0x13')]);}else{logger[_0xff3a('0xb')](_0xff3a('0xc'),_0x4d521a,'request\x20sent');_0x352aca(_0x554c62[_0xff3a('0x14')][_0xff3a('0x13')]);}})['catch'](function(_0x510fc3){logger[_0xff3a('0x11')](_0xff3a('0xc'),_0x4d521a,_0x510fc3);_0x2e2f5b(_0x510fc3);});});}exports['CreateFaxQueueReport']=function(_0x2d61ba){var _0x24d35d=this;return new Promise(function(_0x401c68,_0x43f65a){return db[_0xff3a('0x15')][_0xff3a('0x16')](_0x2d61ba[_0xff3a('0x17')],{'raw':_0x2d61ba[_0xff3a('0x18')]?_0x2d61ba['options'][_0xff3a('0x19')]===undefined?!![]:![]:!![]})[_0xff3a('0xa')](function(_0x50fb2f){logger[_0xff3a('0xb')](_0xff3a('0x1a'),_0x2d61ba);logger[_0xff3a('0xd')]('CreateFaxQueueReport',_0x2d61ba,JSON[_0xff3a('0x10')](_0x50fb2f));_0x401c68(_0x50fb2f);})[_0xff3a('0x1b')](function(_0x3baa6d){logger[_0xff3a('0x11')](_0xff3a('0x1a'),_0x3baa6d[_0xff3a('0x13')],_0x2d61ba);_0x43f65a(_0x24d35d[_0xff3a('0x11')](0x1f4,_0x3baa6d[_0xff3a('0x13')]));});});};exports[_0xff3a('0x1c')]=function(_0x22623a){var _0xee0bf5=this;return new Promise(function(_0x2dbc8c,_0x43ce1c){return db[_0xff3a('0x15')][_0xff3a('0x1d')](_0x22623a[_0xff3a('0x17')],{'raw':_0x22623a[_0xff3a('0x18')]?_0x22623a[_0xff3a('0x18')][_0xff3a('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x22623a[_0xff3a('0x18')]?_0x22623a['options'][_0xff3a('0x1e')]||null:null,'attributes':_0x22623a[_0xff3a('0x18')]?_0x22623a['options'][_0xff3a('0x1f')]||null:null,'limit':_0x22623a[_0xff3a('0x18')]?_0x22623a[_0xff3a('0x18')][_0xff3a('0x20')]||null:null})[_0xff3a('0xa')](function(_0x372ef5){logger[_0xff3a('0xb')](_0xff3a('0x1c'),_0x22623a);logger[_0xff3a('0xd')](_0xff3a('0x1c'),_0x22623a,JSON[_0xff3a('0x10')](_0x372ef5));_0x2dbc8c(_0x372ef5);})[_0xff3a('0x1b')](function(_0x306f97){logger[_0xff3a('0x11')](_0xff3a('0x1c'),_0x306f97[_0xff3a('0x13')],_0x22623a);_0x43ce1c(_0xee0bf5[_0xff3a('0x11')](0x1f4,_0x306f97['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index ba5d2cb..3383f01 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 _0x42fe=['create','update','delete','destroy','exports','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show'];(function(_0x454e6d,_0x1e1f38){var _0x4bc294=function(_0x2c803a){while(--_0x2c803a){_0x454e6d['push'](_0x454e6d['shift']());}};_0x4bc294(++_0x1e1f38);}(_0x42fe,0xe2));var _0xe42f=function(_0x4aa285,_0x1fe00d){_0x4aa285=_0x4aa285-0x0;var _0x2777ee=_0x42fe[_0x4aa285];return _0x2777ee;};'use strict';var multer=require(_0xe42f('0x0'));var util=require(_0xe42f('0x1'));var path=require('path');var timeout=require(_0xe42f('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xe42f('0x3'));var auth=require(_0xe42f('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xe42f('0x5'));var controller=require('./faxQueueReport.controller');router[_0xe42f('0x6')]('/',auth[_0xe42f('0x7')](),controller['index']);router[_0xe42f('0x6')](_0xe42f('0x8'),auth[_0xe42f('0x7')](),controller[_0xe42f('0x9')]);router['get'](_0xe42f('0xa'),auth[_0xe42f('0x7')](),controller[_0xe42f('0xb')]);router['post']('/',auth[_0xe42f('0x7')](),controller[_0xe42f('0xc')]);router['put'](_0xe42f('0xa'),auth[_0xe42f('0x7')](),controller[_0xe42f('0xd')]);router[_0xe42f('0xe')](_0xe42f('0xa'),auth['isAuthenticated'](),controller[_0xe42f('0xf')]);module[_0xe42f('0x10')]=router; \ No newline at end of file +var _0x5a67=['describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','index'];(function(_0x17f548,_0x56c1f0){var _0x52656b=function(_0x37cd6a){while(--_0x37cd6a){_0x17f548['push'](_0x17f548['shift']());}};_0x52656b(++_0x56c1f0);}(_0x5a67,0xd0));var _0x75a6=function(_0x297eea,_0x5060be){_0x297eea=_0x297eea-0x0;var _0x1c42d2=_0x5a67[_0x297eea];return _0x1c42d2;};'use strict';var multer=require(_0x75a6('0x0'));var util=require(_0x75a6('0x1'));var path=require('path');var timeout=require(_0x75a6('0x2'));var express=require(_0x75a6('0x3'));var router=express[_0x75a6('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x75a6('0x5'));var interaction=require(_0x75a6('0x6'));var config=require(_0x75a6('0x7'));var controller=require(_0x75a6('0x8'));router[_0x75a6('0x9')]('/',auth[_0x75a6('0xa')](),controller[_0x75a6('0xb')]);router[_0x75a6('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x75a6('0xc')]);router[_0x75a6('0x9')](_0x75a6('0xd'),auth[_0x75a6('0xa')](),controller[_0x75a6('0xe')]);router[_0x75a6('0xf')]('/',auth[_0x75a6('0xa')](),controller[_0x75a6('0x10')]);router[_0x75a6('0x11')](_0x75a6('0xd'),auth['isAuthenticated'](),controller[_0x75a6('0x12')]);router[_0x75a6('0x13')](_0x75a6('0xd'),auth[_0x75a6('0xa')](),controller[_0x75a6('0x14')]);module[_0x75a6('0x15')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 2d20bce..431f922 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 _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x31711a,_0x10590e){var _0x3b407f=function(_0x2f552c){while(--_0x2f552c){_0x31711a['push'](_0x31711a['shift']());}};_0x3b407f(++_0x10590e);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa9e0[_0xbca1b1];return _0x4e1686;};'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 _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x29cdf9,_0xd79358){var _0x4dbd82=function(_0xbeed28){while(--_0xbeed28){_0x29cdf9['push'](_0x29cdf9['shift']());}};_0x4dbd82(++_0xd79358);}(_0x00bb,0x1d8));var _0xb00b=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x00bb[_0x501510];return _0x1e6ee5;};'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 diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 48c6b93..8048d07 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 _0xa291=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','update','then','error','stack','name','index','map','rawAttributes','fieldName','key','keys','query','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','sort','merge','where','type','filter','options','include','FaxTransferReport','findAll','rows','catch','params','create','body','find','destroy','describe','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch'];(function(_0x1854d2,_0x5b25a9){var _0x2d4854=function(_0xe8e570){while(--_0xe8e570){_0x1854d2['push'](_0x1854d2['shift']());}};_0x2d4854(++_0x5b25a9);}(_0xa291,0x146));var _0x1a29=function(_0xae1a83,_0x1980d4){_0xae1a83=_0xae1a83-0x0;var _0xdb9da8=_0xa291[_0xae1a83];return _0xdb9da8;};'use strict';var emlformat=require(_0x1a29('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1a29('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1a29('0x2'));var moment=require(_0x1a29('0x3'));var BPromise=require(_0x1a29('0x4'));var Mustache=require(_0x1a29('0x5'));var util=require(_0x1a29('0x6'));var path=require(_0x1a29('0x7'));var sox=require(_0x1a29('0x8'));var csv=require(_0x1a29('0x9'));var ejs=require(_0x1a29('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1a29('0xb'));var squel=require(_0x1a29('0xc'));var crypto=require('crypto');var jsforce=require(_0x1a29('0xd'));var deskjs=require(_0x1a29('0xe'));var toCsv=require('to-csv');var querystring=require(_0x1a29('0xf'));var Papa=require(_0x1a29('0x10'));var Redis=require('ioredis');var authService=require(_0x1a29('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x1a29('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1a29('0x13'))(_0x1a29('0x14'));var utils=require(_0x1a29('0x15'));var config=require(_0x1a29('0x16'));var licenseUtil=require(_0x1a29('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x28c337,_0x3e69ce){_0x3e69ce=_0x3e69ce||0xcc;return function(_0x3c5156){if(_0x3c5156){return _0x28c337[_0x1a29('0x18')](_0x3e69ce);}return _0x28c337['status'](_0x3e69ce)[_0x1a29('0x19')]();};}function respondWithResult(_0xbc24dc,_0x21c71c){_0x21c71c=_0x21c71c||0xc8;return function(_0x31a2f4){if(_0x31a2f4){return _0xbc24dc[_0x1a29('0x1a')](_0x21c71c)[_0x1a29('0x1b')](_0x31a2f4);}};}function respondWithFilteredResult(_0x207ce8,_0x34bb77){return function(_0x518269){if(_0x518269){var _0xd31521=typeof _0x34bb77[_0x1a29('0x1c')]===_0x1a29('0x1d')&&typeof _0x34bb77[_0x1a29('0x1e')]===_0x1a29('0x1d');var _0x3bb634=_0x518269[_0x1a29('0x1f')];var _0x18181c=_0xd31521?0x0:_0x34bb77['offset'];var _0x2a474c=_0xd31521?_0x518269[_0x1a29('0x1f')]:_0x34bb77['offset']+_0x34bb77['limit'];var _0x1bdb88;if(_0x2a474c>=_0x3bb634){_0x2a474c=_0x3bb634;_0x1bdb88=0xc8;}else{_0x1bdb88=0xce;}_0x207ce8[_0x1a29('0x1a')](_0x1bdb88);return _0x207ce8[_0x1a29('0x20')]('Content-Range',_0x18181c+'-'+_0x2a474c+'/'+_0x3bb634)[_0x1a29('0x1b')](_0x518269);}return null;};}function patchUpdates(_0x2c5dec){return function(_0x3fffeb){try{jsonpatch['apply'](_0x3fffeb,_0x2c5dec,!![]);}catch(_0x13ce06){return BPromise['reject'](_0x13ce06);}return _0x3fffeb['save']();};}function saveUpdates(_0x21a4ce,_0x1b7ea8){return function(_0x3aeb38){if(_0x3aeb38){return _0x3aeb38[_0x1a29('0x21')](_0x21a4ce)[_0x1a29('0x22')](function(_0x2e400f){return _0x2e400f;});}return null;};}function removeEntity(_0x27fa89,_0x391c02){return function(_0x20c00d){if(_0x20c00d){return _0x20c00d['destroy']()[_0x1a29('0x22')](function(){_0x27fa89[_0x1a29('0x1a')](0xcc)[_0x1a29('0x19')]();});}};}function handleEntityNotFound(_0x442d80,_0x367cfe){return function(_0x1cadd5){if(!_0x1cadd5){_0x442d80['sendStatus'](0x194);}return _0x1cadd5;};}function handleError(_0x41bf2d,_0x412f14){_0x412f14=_0x412f14||0x1f4;return function(_0x3f3c25){logger[_0x1a29('0x23')](_0x3f3c25[_0x1a29('0x24')]);if(_0x3f3c25[_0x1a29('0x25')]){delete _0x3f3c25[_0x1a29('0x25')];}_0x41bf2d[_0x1a29('0x1a')](_0x412f14)['send'](_0x3f3c25);};}exports[_0x1a29('0x26')]=function(_0x1c0c79,_0x395416){var _0x22ae29={},_0x3ce6ac={},_0x264b28={'count':0x0,'rows':[]};var _0x265a88=_[_0x1a29('0x27')](db['FaxTransferReport'][_0x1a29('0x28')],function(_0x2ce6bd){return{'name':_0x2ce6bd[_0x1a29('0x29')],'type':_0x2ce6bd['type'][_0x1a29('0x2a')]};});_0x3ce6ac['model']=_['map'](_0x265a88,'name');_0x3ce6ac['query']=_[_0x1a29('0x2b')](_0x1c0c79[_0x1a29('0x2c')]);_0x3ce6ac[_0x1a29('0x2d')]=_[_0x1a29('0x2e')](_0x3ce6ac['model'],_0x3ce6ac[_0x1a29('0x2c')]);_0x22ae29[_0x1a29('0x2f')]=_[_0x1a29('0x2e')](_0x3ce6ac[_0x1a29('0x30')],qs[_0x1a29('0x31')](_0x1c0c79[_0x1a29('0x2c')]['fields']));_0x22ae29['attributes']=_0x22ae29[_0x1a29('0x2f')]['length']?_0x22ae29[_0x1a29('0x2f')]:_0x3ce6ac[_0x1a29('0x30')];if(!_0x1c0c79['query'][_0x1a29('0x32')](_0x1a29('0x33'))){_0x22ae29['limit']=qs['limit'](_0x1c0c79[_0x1a29('0x2c')][_0x1a29('0x1e')]);_0x22ae29[_0x1a29('0x1c')]=qs[_0x1a29('0x1c')](_0x1c0c79['query'][_0x1a29('0x1c')]);}_0x22ae29['order']=qs[_0x1a29('0x34')](_0x1c0c79[_0x1a29('0x2c')]['sort']);_0x22ae29['where']=qs['filters'](_['pick'](_0x1c0c79[_0x1a29('0x2c')],_0x3ce6ac['filters']),_0x265a88);if(_0x1c0c79[_0x1a29('0x2c')]['filter']){_0x22ae29['where']=_[_0x1a29('0x35')](_0x22ae29[_0x1a29('0x36')],{'$or':_[_0x1a29('0x27')](_0x265a88,function(_0x171ce5){if(_0x171ce5[_0x1a29('0x37')]!=='VIRTUAL'){var _0x552d7f={};_0x552d7f[_0x171ce5[_0x1a29('0x25')]]={'$like':'%'+_0x1c0c79[_0x1a29('0x2c')][_0x1a29('0x38')]+'%'};return _0x552d7f;}})});}_0x22ae29=_[_0x1a29('0x35')]({},_0x22ae29,_0x1c0c79[_0x1a29('0x39')]);var _0x2c0299={'where':_0x22ae29[_0x1a29('0x36')]};return db['FaxTransferReport']['count'](_0x2c0299)[_0x1a29('0x22')](function(_0x542cec){_0x264b28[_0x1a29('0x1f')]=_0x542cec;if(_0x1c0c79[_0x1a29('0x2c')]['includeAll']){_0x22ae29[_0x1a29('0x3a')]=[{'all':!![]}];}return db[_0x1a29('0x3b')][_0x1a29('0x3c')](_0x22ae29);})[_0x1a29('0x22')](function(_0x31542f){_0x264b28[_0x1a29('0x3d')]=_0x31542f;return _0x264b28;})[_0x1a29('0x22')](respondWithFilteredResult(_0x395416,_0x22ae29))[_0x1a29('0x3e')](handleError(_0x395416,null));};exports['show']=function(_0x5a215f,_0x1c0e86){var _0x4312fa={'raw':!![],'where':{'id':_0x5a215f[_0x1a29('0x3f')]['id']}},_0x1426bd={};_0x1426bd[_0x1a29('0x30')]=_[_0x1a29('0x2b')](db['FaxTransferReport']['rawAttributes']);_0x1426bd[_0x1a29('0x2c')]=_[_0x1a29('0x2b')](_0x5a215f['query']);_0x1426bd[_0x1a29('0x2d')]=_[_0x1a29('0x2e')](_0x1426bd[_0x1a29('0x30')],_0x1426bd[_0x1a29('0x2c')]);_0x4312fa[_0x1a29('0x2f')]=_[_0x1a29('0x2e')](_0x1426bd[_0x1a29('0x30')],qs[_0x1a29('0x31')](_0x5a215f['query']['fields']));_0x4312fa[_0x1a29('0x2f')]=_0x4312fa[_0x1a29('0x2f')]['length']?_0x4312fa[_0x1a29('0x2f')]:_0x1426bd['model'];if(_0x5a215f[_0x1a29('0x2c')]['includeAll']){_0x4312fa[_0x1a29('0x3a')]=[{'all':!![]}];}_0x4312fa=_[_0x1a29('0x35')]({},_0x4312fa,_0x5a215f[_0x1a29('0x39')]);return db[_0x1a29('0x3b')]['find'](_0x4312fa)[_0x1a29('0x22')](handleEntityNotFound(_0x1c0e86,null))[_0x1a29('0x22')](respondWithResult(_0x1c0e86,null))[_0x1a29('0x3e')](handleError(_0x1c0e86,null));};exports[_0x1a29('0x40')]=function(_0x4407c2,_0x577509){return db[_0x1a29('0x3b')]['create'](_0x4407c2[_0x1a29('0x41')],{})[_0x1a29('0x22')](respondWithResult(_0x577509,0xc9))[_0x1a29('0x3e')](handleError(_0x577509,null));};exports['update']=function(_0x27a64e,_0x3f39fb){if(_0x27a64e[_0x1a29('0x41')]['id']){delete _0x27a64e['body']['id'];}return db['FaxTransferReport'][_0x1a29('0x42')]({'where':{'id':_0x27a64e[_0x1a29('0x3f')]['id']}})[_0x1a29('0x22')](handleEntityNotFound(_0x3f39fb,null))[_0x1a29('0x22')](saveUpdates(_0x27a64e[_0x1a29('0x41')],null))[_0x1a29('0x22')](respondWithResult(_0x3f39fb,null))[_0x1a29('0x3e')](handleError(_0x3f39fb,null));};exports[_0x1a29('0x43')]=function(_0x1a071d,_0xd4b26){return db[_0x1a29('0x3b')][_0x1a29('0x42')]({'where':{'id':_0x1a071d[_0x1a29('0x3f')]['id']}})[_0x1a29('0x22')](handleEntityNotFound(_0xd4b26,null))[_0x1a29('0x22')](removeEntity(_0xd4b26,null))['catch'](handleError(_0xd4b26,null));};exports[_0x1a29('0x44')]=function(_0x4ffa67,_0x2c2ac7){return db[_0x1a29('0x3b')][_0x1a29('0x44')]()[_0x1a29('0x22')](respondWithResult(_0x2c2ac7,null))[_0x1a29('0x3e')](handleError(_0x2c2ac7,null));}; \ No newline at end of file +var _0x765d=['length','attributes','hasOwnProperty','order','where','filters','pick','type','VIRTUAL','filter','merge','includeAll','include','findAll','rows','catch','show','params','create','body','find','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','end','error','name','send','index','map','FaxTransferReport','rawAttributes','fieldName','key','model','query','keys','intersection','fields'];(function(_0x17ba4c,_0x21ae82){var _0xca88ae=function(_0xe37d7){while(--_0xe37d7){_0x17ba4c['push'](_0x17ba4c['shift']());}};_0xca88ae(++_0x21ae82);}(_0x765d,0xfb));var _0xd765=function(_0x53fc7a,_0x3cdca7){_0x53fc7a=_0x53fc7a-0x0;var _0x1f1c38=_0x765d[_0x53fc7a];return _0x1f1c38;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd765('0x0'));var zipdir=require(_0xd765('0x1'));var jsonpatch=require(_0xd765('0x2'));var rp=require(_0xd765('0x3'));var moment=require(_0xd765('0x4'));var BPromise=require(_0xd765('0x5'));var Mustache=require(_0xd765('0x6'));var util=require('util');var path=require(_0xd765('0x7'));var sox=require(_0xd765('0x8'));var csv=require(_0xd765('0x9'));var ejs=require(_0xd765('0xa'));var fs=require('fs');var fs_extra=require(_0xd765('0xb'));var _=require(_0xd765('0xc'));var squel=require('squel');var crypto=require(_0xd765('0xd'));var jsforce=require(_0xd765('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xd765('0x9'));var querystring=require(_0xd765('0xf'));var Papa=require(_0xd765('0x10'));var Redis=require(_0xd765('0x11'));var authService=require(_0xd765('0x12'));var qs=require(_0xd765('0x13'));var as=require(_0xd765('0x14'));var hardwareService=require(_0xd765('0x15'));var logger=require(_0xd765('0x16'))('api');var utils=require(_0xd765('0x17'));var config=require(_0xd765('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1f0606,_0x349c04){_0x349c04=_0x349c04||0xcc;return function(_0xc49745){if(_0xc49745){return _0x1f0606[_0xd765('0x19')](_0x349c04);}return _0x1f0606[_0xd765('0x1a')](_0x349c04)['end']();};}function respondWithResult(_0x56b4ee,_0x5ca77a){_0x5ca77a=_0x5ca77a||0xc8;return function(_0x2bd815){if(_0x2bd815){return _0x56b4ee['status'](_0x5ca77a)[_0xd765('0x1b')](_0x2bd815);}};}function respondWithFilteredResult(_0x462c46,_0xbecb45){return function(_0x55a530){if(_0x55a530){var _0x4246ce=typeof _0xbecb45[_0xd765('0x1c')]===_0xd765('0x1d')&&typeof _0xbecb45[_0xd765('0x1e')]==='undefined';var _0x23e0a5=_0x55a530[_0xd765('0x1f')];var _0x276a9b=_0x4246ce?0x0:_0xbecb45['offset'];var _0x5e0fd0=_0x4246ce?_0x55a530[_0xd765('0x1f')]:_0xbecb45[_0xd765('0x1c')]+_0xbecb45[_0xd765('0x1e')];var _0x28b938;if(_0x5e0fd0>=_0x23e0a5){_0x5e0fd0=_0x23e0a5;_0x28b938=0xc8;}else{_0x28b938=0xce;}_0x462c46[_0xd765('0x1a')](_0x28b938);return _0x462c46[_0xd765('0x20')](_0xd765('0x21'),_0x276a9b+'-'+_0x5e0fd0+'/'+_0x23e0a5)[_0xd765('0x1b')](_0x55a530);}return null;};}function patchUpdates(_0x1e5349){return function(_0x33498){try{jsonpatch[_0xd765('0x22')](_0x33498,_0x1e5349,!![]);}catch(_0x1dc6e3){return BPromise[_0xd765('0x23')](_0x1dc6e3);}return _0x33498[_0xd765('0x24')]();};}function saveUpdates(_0x40aa12,_0x36b0e7){return function(_0x8d4d5c){if(_0x8d4d5c){return _0x8d4d5c['update'](_0x40aa12)[_0xd765('0x25')](function(_0x3c41c8){return _0x3c41c8;});}return null;};}function removeEntity(_0x776bb2,_0x6d9836){return function(_0x357c8b){if(_0x357c8b){return _0x357c8b['destroy']()[_0xd765('0x25')](function(){_0x776bb2['status'](0xcc)[_0xd765('0x26')]();});}};}function handleEntityNotFound(_0x2fdb5f,_0x16b4b0){return function(_0x353f90){if(!_0x353f90){_0x2fdb5f['sendStatus'](0x194);}return _0x353f90;};}function handleError(_0x34ea34,_0x55700a){_0x55700a=_0x55700a||0x1f4;return function(_0x35cd5a){logger[_0xd765('0x27')](_0x35cd5a['stack']);if(_0x35cd5a[_0xd765('0x28')]){delete _0x35cd5a[_0xd765('0x28')];}_0x34ea34[_0xd765('0x1a')](_0x55700a)[_0xd765('0x29')](_0x35cd5a);};}exports[_0xd765('0x2a')]=function(_0x598191,_0x2c9ed1){var _0x4763fb={},_0x588b7d={},_0x24fbf8={'count':0x0,'rows':[]};var _0x19d967=_[_0xd765('0x2b')](db[_0xd765('0x2c')][_0xd765('0x2d')],function(_0x2ed608){return{'name':_0x2ed608[_0xd765('0x2e')],'type':_0x2ed608['type'][_0xd765('0x2f')]};});_0x588b7d[_0xd765('0x30')]=_[_0xd765('0x2b')](_0x19d967,'name');_0x588b7d[_0xd765('0x31')]=_[_0xd765('0x32')](_0x598191[_0xd765('0x31')]);_0x588b7d['filters']=_[_0xd765('0x33')](_0x588b7d[_0xd765('0x30')],_0x588b7d[_0xd765('0x31')]);_0x4763fb['attributes']=_['intersection'](_0x588b7d[_0xd765('0x30')],qs['fields'](_0x598191[_0xd765('0x31')][_0xd765('0x34')]));_0x4763fb['attributes']=_0x4763fb['attributes'][_0xd765('0x35')]?_0x4763fb[_0xd765('0x36')]:_0x588b7d['model'];if(!_0x598191[_0xd765('0x31')][_0xd765('0x37')]('nolimit')){_0x4763fb['limit']=qs[_0xd765('0x1e')](_0x598191[_0xd765('0x31')][_0xd765('0x1e')]);_0x4763fb[_0xd765('0x1c')]=qs[_0xd765('0x1c')](_0x598191[_0xd765('0x31')][_0xd765('0x1c')]);}_0x4763fb[_0xd765('0x38')]=qs['sort'](_0x598191[_0xd765('0x31')]['sort']);_0x4763fb[_0xd765('0x39')]=qs[_0xd765('0x3a')](_[_0xd765('0x3b')](_0x598191[_0xd765('0x31')],_0x588b7d['filters']),_0x19d967);if(_0x598191[_0xd765('0x31')]['filter']){_0x4763fb[_0xd765('0x39')]=_['merge'](_0x4763fb[_0xd765('0x39')],{'$or':_[_0xd765('0x2b')](_0x19d967,function(_0x12ccbf){if(_0x12ccbf[_0xd765('0x3c')]!==_0xd765('0x3d')){var _0x24fa28={};_0x24fa28[_0x12ccbf['name']]={'$like':'%'+_0x598191[_0xd765('0x31')][_0xd765('0x3e')]+'%'};return _0x24fa28;}})});}_0x4763fb=_[_0xd765('0x3f')]({},_0x4763fb,_0x598191['options']);var _0x5f306c={'where':_0x4763fb[_0xd765('0x39')]};return db['FaxTransferReport']['count'](_0x5f306c)[_0xd765('0x25')](function(_0x1b8887){_0x24fbf8[_0xd765('0x1f')]=_0x1b8887;if(_0x598191[_0xd765('0x31')][_0xd765('0x40')]){_0x4763fb[_0xd765('0x41')]=[{'all':!![]}];}return db['FaxTransferReport'][_0xd765('0x42')](_0x4763fb);})[_0xd765('0x25')](function(_0x1a3bad){_0x24fbf8[_0xd765('0x43')]=_0x1a3bad;return _0x24fbf8;})[_0xd765('0x25')](respondWithFilteredResult(_0x2c9ed1,_0x4763fb))[_0xd765('0x44')](handleError(_0x2c9ed1,null));};exports[_0xd765('0x45')]=function(_0x3319f5,_0x506e0b){var _0x11a9ce={'raw':!![],'where':{'id':_0x3319f5[_0xd765('0x46')]['id']}},_0x44372c={};_0x44372c[_0xd765('0x30')]=_[_0xd765('0x32')](db[_0xd765('0x2c')][_0xd765('0x2d')]);_0x44372c[_0xd765('0x31')]=_[_0xd765('0x32')](_0x3319f5[_0xd765('0x31')]);_0x44372c[_0xd765('0x3a')]=_[_0xd765('0x33')](_0x44372c[_0xd765('0x30')],_0x44372c['query']);_0x11a9ce[_0xd765('0x36')]=_[_0xd765('0x33')](_0x44372c[_0xd765('0x30')],qs[_0xd765('0x34')](_0x3319f5['query'][_0xd765('0x34')]));_0x11a9ce[_0xd765('0x36')]=_0x11a9ce[_0xd765('0x36')][_0xd765('0x35')]?_0x11a9ce[_0xd765('0x36')]:_0x44372c['model'];if(_0x3319f5['query'][_0xd765('0x40')]){_0x11a9ce[_0xd765('0x41')]=[{'all':!![]}];}_0x11a9ce=_[_0xd765('0x3f')]({},_0x11a9ce,_0x3319f5['options']);return db['FaxTransferReport']['find'](_0x11a9ce)[_0xd765('0x25')](handleEntityNotFound(_0x506e0b,null))[_0xd765('0x25')](respondWithResult(_0x506e0b,null))['catch'](handleError(_0x506e0b,null));};exports[_0xd765('0x47')]=function(_0xa977c6,_0xc3a07c){return db[_0xd765('0x2c')][_0xd765('0x47')](_0xa977c6['body'],{})[_0xd765('0x25')](respondWithResult(_0xc3a07c,0xc9))[_0xd765('0x44')](handleError(_0xc3a07c,null));};exports['update']=function(_0x24c078,_0x2737f4){if(_0x24c078[_0xd765('0x48')]['id']){delete _0x24c078[_0xd765('0x48')]['id'];}return db['FaxTransferReport'][_0xd765('0x49')]({'where':{'id':_0x24c078[_0xd765('0x46')]['id']}})[_0xd765('0x25')](handleEntityNotFound(_0x2737f4,null))['then'](saveUpdates(_0x24c078[_0xd765('0x48')],null))[_0xd765('0x25')](respondWithResult(_0x2737f4,null))['catch'](handleError(_0x2737f4,null));};exports[_0xd765('0x4a')]=function(_0x30a669,_0x1637c7){return db['FaxTransferReport'][_0xd765('0x49')]({'where':{'id':_0x30a669[_0xd765('0x46')]['id']}})['then'](handleEntityNotFound(_0x1637c7,null))[_0xd765('0x25')](removeEntity(_0x1637c7,null))['catch'](handleError(_0x1637c7,null));};exports[_0xd765('0x4b')]=function(_0x2d46d9,_0x3248a5){return db[_0xd765('0x2c')][_0xd765('0x4b')]()['then'](respondWithResult(_0x3248a5,null))['catch'](handleError(_0x3248a5,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 4381a18..7462c39 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 _0x793b=['FaxTransferReport','report_fax_transfer','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','path','./faxTransferReport.attributes','exports','define'];(function(_0x148c1d,_0x537052){var _0xed1bda=function(_0x182118){while(--_0x182118){_0x148c1d['push'](_0x148c1d['shift']());}};_0xed1bda(++_0x537052);}(_0x793b,0x189));var _0xb793=function(_0x4f3bc5,_0x24272b){_0x4f3bc5=_0x4f3bc5-0x0;var _0x4df763=_0x793b[_0x4f3bc5];return _0x4df763;};'use strict';var _=require(_0xb793('0x0'));var util=require(_0xb793('0x1'));var logger=require(_0xb793('0x2'))(_0xb793('0x3'));var moment=require(_0xb793('0x4'));var BPromise=require('bluebird');var rp=require(_0xb793('0x5'));var fs=require('fs');var path=require(_0xb793('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb793('0x7'));module[_0xb793('0x8')]=function(_0x322b07,_0x2b1f19){return _0x322b07[_0xb793('0x9')](_0xb793('0xa'),attributes,{'tableName':_0xb793('0xb'),'paranoid':![],'indexes':[{'name':_0xb793('0xc'),'fields':[_0xb793('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5080=['FaxTransferReport','report_fax_transfer','uniqueid','lodash','util','../../config/logger','moment','rimraf','./faxTransferReport.attributes','exports','define'];(function(_0x14a355,_0x33251b){var _0x53f527=function(_0x57380b){while(--_0x57380b){_0x14a355['push'](_0x14a355['shift']());}};_0x53f527(++_0x33251b);}(_0x5080,0x158));var _0x0508=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x5080[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0x0508('0x0'));var util=require(_0x0508('0x1'));var logger=require(_0x0508('0x2'))('api');var moment=require(_0x0508('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0508('0x4'));var config=require('../../config/environment');var attributes=require(_0x0508('0x5'));module[_0x0508('0x6')]=function(_0xfe62a7,_0x2d1597){return _0xfe62a7[_0x0508('0x7')](_0x0508('0x8'),attributes,{'tableName':_0x0508('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0508('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 49fc3c2..5058074 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 _0x6840=['request\x20sent','error','code','message','info','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','request','FaxTransferReport,\x20%s,\x20%s'];(function(_0x235133,_0x3407b2){var _0x152df7=function(_0x28e85e){while(--_0x28e85e){_0x235133['push'](_0x235133['shift']());}};_0x152df7(++_0x3407b2);}(_0x6840,0x1a4));var _0x0684=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x6840[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0x0684('0x0'));var util=require(_0x0684('0x1'));var moment=require(_0x0684('0x2'));var BPromise=require(_0x0684('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0684('0x4'));var db=require(_0x0684('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0684('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0684('0x7'));var client=jayson[_0x0684('0x8')][_0x0684('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x87215f,_0x8a46cb,_0x5737fe){return new BPromise(function(_0x5ae938,_0xcfaa99){return client[_0x0684('0xa')](_0x87215f,_0x5737fe)['then'](function(_0x20ac0b){logger['info'](_0x0684('0xb'),_0x8a46cb,_0x0684('0xc'));logger['debug']('FaxTransferReport,\x20%s,\x20%s,\x20%s',_0x8a46cb,_0x0684('0xc'),JSON['stringify'](_0x20ac0b));if(_0x20ac0b[_0x0684('0xd')]){if(_0x20ac0b[_0x0684('0xd')][_0x0684('0xe')]===0x1f4){logger['error'](_0x0684('0xb'),_0x8a46cb,_0x20ac0b['error'][_0x0684('0xf')]);return _0xcfaa99(_0x20ac0b[_0x0684('0xd')][_0x0684('0xf')]);}logger[_0x0684('0xd')]('FaxTransferReport,\x20%s,\x20%s',_0x8a46cb,_0x20ac0b[_0x0684('0xd')]['message']);return _0x5ae938(_0x20ac0b[_0x0684('0xd')][_0x0684('0xf')]);}else{logger[_0x0684('0x10')](_0x0684('0xb'),_0x8a46cb,_0x0684('0xc'));_0x5ae938(_0x20ac0b['result'][_0x0684('0xf')]);}})[_0x0684('0x11')](function(_0x5c9407){logger[_0x0684('0xd')](_0x0684('0xb'),_0x8a46cb,_0x5c9407);_0xcfaa99(_0x5c9407);});});} \ No newline at end of file +var _0x25b9=['jayson/promise','client','http','request','then','info','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxTransferReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment'];(function(_0x2aaaa7,_0x334d32){var _0x15f57d=function(_0x415dfa){while(--_0x415dfa){_0x2aaaa7['push'](_0x2aaaa7['shift']());}};_0x15f57d(++_0x334d32);}(_0x25b9,0x70));var _0x925b=function(_0x683a2b,_0x6edd4d){_0x683a2b=_0x683a2b-0x0;var _0x4a7e93=_0x25b9[_0x683a2b];return _0x4a7e93;};'use strict';var _=require(_0x925b('0x0'));var util=require(_0x925b('0x1'));var moment=require(_0x925b('0x2'));var BPromise=require(_0x925b('0x3'));var rs=require(_0x925b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x925b('0x5'))['db'];var utils=require(_0x925b('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x925b('0x7'));var jayson=require(_0x925b('0x8'));var client=jayson[_0x925b('0x9')][_0x925b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4c5085,_0x1e937d,_0x1e3751){return new BPromise(function(_0x306d27,_0x4e3b4c){return client[_0x925b('0xb')](_0x4c5085,_0x1e3751)[_0x925b('0xc')](function(_0x1aed20){logger[_0x925b('0xd')]('FaxTransferReport,\x20%s,\x20%s',_0x1e937d,_0x925b('0xe'));logger[_0x925b('0xf')](_0x925b('0x10'),_0x1e937d,_0x925b('0xe'),JSON[_0x925b('0x11')](_0x1aed20));if(_0x1aed20['error']){if(_0x1aed20[_0x925b('0x12')][_0x925b('0x13')]===0x1f4){logger[_0x925b('0x12')](_0x925b('0x14'),_0x1e937d,_0x1aed20[_0x925b('0x12')][_0x925b('0x15')]);return _0x4e3b4c(_0x1aed20[_0x925b('0x12')][_0x925b('0x15')]);}logger['error']('FaxTransferReport,\x20%s,\x20%s',_0x1e937d,_0x1aed20[_0x925b('0x12')][_0x925b('0x15')]);return _0x306d27(_0x1aed20[_0x925b('0x12')][_0x925b('0x15')]);}else{logger['info']('FaxTransferReport,\x20%s,\x20%s',_0x1e937d,'request\x20sent');_0x306d27(_0x1aed20[_0x925b('0x16')][_0x925b('0x15')]);}})[_0x925b('0x17')](function(_0x1def8d){logger[_0x925b('0x12')](_0x925b('0x14'),_0x1e937d,_0x1def8d);_0x4e3b4c(_0x1def8d);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index adccb16..40eafe1 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 _0x1b5c=['get','isAuthenticated','index','describe','/:id','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./faxTransferReport.controller'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x1b5c,0x1af));var _0xc1b5=function(_0x3e44fa,_0x75ed2a){_0x3e44fa=_0x3e44fa-0x0;var _0x2a0aba=_0x1b5c[_0x3e44fa];return _0x2a0aba;};'use strict';var multer=require(_0xc1b5('0x0'));var util=require(_0xc1b5('0x1'));var path=require(_0xc1b5('0x2'));var timeout=require(_0xc1b5('0x3'));var express=require(_0xc1b5('0x4'));var router=express[_0xc1b5('0x5')]();var fs_extra=require(_0xc1b5('0x6'));var auth=require(_0xc1b5('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xc1b5('0x8'));var controller=require(_0xc1b5('0x9'));router[_0xc1b5('0xa')]('/',auth[_0xc1b5('0xb')](),controller[_0xc1b5('0xc')]);router[_0xc1b5('0xa')]('/describe',auth[_0xc1b5('0xb')](),controller[_0xc1b5('0xd')]);router[_0xc1b5('0xa')](_0xc1b5('0xe'),auth[_0xc1b5('0xb')](),controller['show']);router[_0xc1b5('0xf')]('/',auth[_0xc1b5('0xb')](),controller[_0xc1b5('0x10')]);router[_0xc1b5('0x11')](_0xc1b5('0xe'),auth[_0xc1b5('0xb')](),controller[_0xc1b5('0x12')]);router['delete'](_0xc1b5('0xe'),auth['isAuthenticated'](),controller[_0xc1b5('0x13')]);module[_0xc1b5('0x14')]=router; \ No newline at end of file +var _0x413b=['create','put','update','delete','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/describe','/:id','isAuthenticated','show','post'];(function(_0x2fbedc,_0x25d163){var _0x56b33e=function(_0x2bfc82){while(--_0x2bfc82){_0x2fbedc['push'](_0x2fbedc['shift']());}};_0x56b33e(++_0x25d163);}(_0x413b,0x6a));var _0xb413=function(_0x259d6b,_0x2efc49){_0x259d6b=_0x259d6b-0x0;var _0x5e3636=_0x413b[_0x259d6b];return _0x5e3636;};'use strict';var multer=require(_0xb413('0x0'));var util=require('util');var path=require(_0xb413('0x1'));var timeout=require('connect-timeout');var express=require(_0xb413('0x2'));var router=express[_0xb413('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xb413('0x4'));var interaction=require(_0xb413('0x5'));var config=require(_0xb413('0x6'));var controller=require('./faxTransferReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xb413('0x7')]);router[_0xb413('0x8')](_0xb413('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0xb413('0x8')](_0xb413('0xa'),auth[_0xb413('0xb')](),controller[_0xb413('0xc')]);router[_0xb413('0xd')]('/',auth[_0xb413('0xb')](),controller[_0xb413('0xe')]);router[_0xb413('0xf')]('/:id',auth[_0xb413('0xb')](),controller[_0xb413('0x10')]);router[_0xb413('0x11')](_0xb413('0xa'),auth[_0xb413('0xb')](),controller[_0xb413('0x12')]);module[_0xb413('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 9bf1a64..7290952 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 _0x919c=['/:id/configurations','/:id/fields','getFields','post','create','put','update','delete','/:id','destroy','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','index','show'];(function(_0x33737d,_0x54e3ef){var _0x5a9921=function(_0x381922){while(--_0x381922){_0x33737d['push'](_0x33737d['shift']());}};_0x5a9921(++_0x54e3ef);}(_0x919c,0x108));var _0xc919=function(_0x12c676,_0x5d7019){_0x12c676=_0x12c676-0x0;var _0x4f7ee9=_0x919c[_0x12c676];return _0x4f7ee9;};'use strict';var multer=require('multer');var util=require(_0xc919('0x0'));var path=require(_0xc919('0x1'));var timeout=require('connect-timeout');var express=require(_0xc919('0x2'));var router=express[_0xc919('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xc919('0x4'));var interaction=require(_0xc919('0x5'));var config=require(_0xc919('0x6'));var controller=require(_0xc919('0x7'));router[_0xc919('0x8')]('/',auth[_0xc919('0x9')](),controller[_0xc919('0xa')]);router[_0xc919('0x8')]('/:id',auth[_0xc919('0x9')](),controller[_0xc919('0xb')]);router[_0xc919('0x8')](_0xc919('0xc'),auth[_0xc919('0x9')](),controller['getConfigurations']);router[_0xc919('0x8')](_0xc919('0xd'),auth[_0xc919('0x9')](),controller[_0xc919('0xe')]);router[_0xc919('0xf')]('/',auth[_0xc919('0x9')](),controller[_0xc919('0x10')]);router[_0xc919('0xf')](_0xc919('0xc'),auth[_0xc919('0x9')](),controller['addConfiguration']);router[_0xc919('0x11')]('/:id',auth[_0xc919('0x9')](),controller[_0xc919('0x12')]);router[_0xc919('0x13')](_0xc919('0x14'),auth['isAuthenticated'](),controller[_0xc919('0x15')]);module[_0xc919('0x16')]=router; \ No newline at end of file +var _0x1f93=['/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./intDeskAccount.controller','get','isAuthenticated'];(function(_0x194992,_0x1e6005){var _0x3bc551=function(_0x36001f){while(--_0x36001f){_0x194992['push'](_0x194992['shift']());}};_0x3bc551(++_0x1e6005);}(_0x1f93,0x113));var _0x31f9=function(_0x525dc3,_0x1aa345){_0x525dc3=_0x525dc3-0x0;var _0xd56458=_0x1f93[_0x525dc3];return _0xd56458;};'use strict';var multer=require(_0x31f9('0x0'));var util=require(_0x31f9('0x1'));var path=require(_0x31f9('0x2'));var timeout=require(_0x31f9('0x3'));var express=require(_0x31f9('0x4'));var router=express[_0x31f9('0x5')]();var fs_extra=require(_0x31f9('0x6'));var auth=require(_0x31f9('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x31f9('0x8'));router[_0x31f9('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x31f9('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x31f9('0x9')]('/:id/configurations',auth[_0x31f9('0xa')](),controller['getConfigurations']);router['get'](_0x31f9('0xb'),auth[_0x31f9('0xa')](),controller[_0x31f9('0xc')]);router[_0x31f9('0xd')]('/',auth[_0x31f9('0xa')](),controller[_0x31f9('0xe')]);router['post'](_0x31f9('0xf'),auth['isAuthenticated'](),controller[_0x31f9('0x10')]);router[_0x31f9('0x11')](_0x31f9('0x12'),auth[_0x31f9('0xa')](),controller[_0x31f9('0x13')]);router['delete'](_0x31f9('0x12'),auth[_0x31f9('0xa')](),controller[_0x31f9('0x14')]);module[_0x31f9('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 37b44a6..a36d0e6 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 _0x9805=['sequelize','exports','STRING','ENUM','basic'];(function(_0xf50820,_0x56f041){var _0x2a9b10=function(_0x33f0f4){while(--_0x33f0f4){_0xf50820['push'](_0xf50820['shift']());}};_0x2a9b10(++_0x56f041);}(_0x9805,0x8c));var _0x5980=function(_0x21b2e5,_0x57ed16){_0x21b2e5=_0x21b2e5-0x0;var _0x1d456b=_0x9805[_0x21b2e5];return _0x1d456b;};'use strict';var Sequelize=require(_0x5980('0x0'));module[_0x5980('0x1')]={'name':{'type':Sequelize[_0x5980('0x2')]},'description':{'type':Sequelize[_0x5980('0x2')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x5980('0x2')]},'authType':{'type':Sequelize[_0x5980('0x3')](_0x5980('0x4')),'defaultValue':_0x5980('0x4')},'password':{'type':Sequelize[_0x5980('0x2')]},'consumerKey':{'type':Sequelize[_0x5980('0x2')]},'consumerSecret':{'type':Sequelize[_0x5980('0x2')]},'token':{'type':Sequelize[_0x5980('0x2')]},'tokenSecret':{'type':Sequelize[_0x5980('0x2')]},'serverUrl':{'type':Sequelize[_0x5980('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x5980('0x3')]('integrationTab','newTab'),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0xa92e=['STRING','ENUM','basic','integrationTab','newTab','sequelize'];(function(_0x18f64a,_0x1c8248){var _0x44687f=function(_0x1234ad){while(--_0x1234ad){_0x18f64a['push'](_0x18f64a['shift']());}};_0x44687f(++_0x1c8248);}(_0xa92e,0xbf));var _0xea92=function(_0x10702d,_0x329cf3){_0x10702d=_0x10702d-0x0;var _0x3587d7=_0xa92e[_0x10702d];return _0x3587d7;};'use strict';var Sequelize=require(_0xea92('0x0'));module['exports']={'name':{'type':Sequelize[_0xea92('0x1')]},'description':{'type':Sequelize[_0xea92('0x1')]},'username':{'type':Sequelize[_0xea92('0x1')]},'remoteUri':{'type':Sequelize[_0xea92('0x1')]},'authType':{'type':Sequelize[_0xea92('0x2')]('basic'),'defaultValue':_0xea92('0x3')},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize[_0xea92('0x1')]},'consumerSecret':{'type':Sequelize[_0xea92('0x1')]},'token':{'type':Sequelize[_0xea92('0x1')]},'tokenSecret':{'type':Sequelize[_0xea92('0x1')]},'serverUrl':{'type':Sequelize[_0xea92('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xea92('0x2')](_0xea92('0x4'),_0xea92('0x5')),'defaultValue':_0xea92('0x4')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 3249364..2b16e1b 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 _0x6f97=['label','test','statusCode','error','stringify','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','offset','undefined','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','end','name','send','map','DeskAccount','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','filter','merge','where','VIRTUAL','rows','catch','show','params','rawAttributes','includeAll','include','options','find','create','body','getConfigurations','findOne','DeskConfiguration','pick','hasOwnProperty','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','DeskField','getFields','priority','authType','username','consumerSecret','tokenSecret','remoteUri','slice','substring','lastIndexOf','format','%s/custom_fields','application/json','basic','headers','Basic\x20%s','base64','entries','active'];(function(_0x446175,_0x1d1b93){var _0x265a8c=function(_0x2258ca){while(--_0x2258ca){_0x446175['push'](_0x446175['shift']());}};_0x265a8c(++_0x1d1b93);}(_0x6f97,0x72));var _0x76f9=function(_0x1d4e21,_0x4e8096){_0x1d4e21=_0x1d4e21-0x0;var _0x178fef=_0x6f97[_0x1d4e21];return _0x178fef;};'use strict';var emlformat=require(_0x76f9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x76f9('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x76f9('0x2'));var moment=require(_0x76f9('0x3'));var BPromise=require(_0x76f9('0x4'));var Mustache=require(_0x76f9('0x5'));var util=require(_0x76f9('0x6'));var path=require(_0x76f9('0x7'));var sox=require(_0x76f9('0x8'));var csv=require(_0x76f9('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x76f9('0xa'));var squel=require(_0x76f9('0xb'));var crypto=require(_0x76f9('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x76f9('0xd'));var toCsv=require(_0x76f9('0x9'));var querystring=require(_0x76f9('0xe'));var Papa=require('papaparse');var Redis=require(_0x76f9('0xf'));var authService=require(_0x76f9('0x10'));var qs=require(_0x76f9('0x11'));var as=require(_0x76f9('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x76f9('0x13'))('api');var utils=require(_0x76f9('0x14'));var config=require(_0x76f9('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x76f9('0x16'))['db'];var integrations=require(_0x76f9('0x17'));function respondWithStatusCode(_0x5be558,_0x3288d3){_0x3288d3=_0x3288d3||0xcc;return function(_0x4ed985){if(_0x4ed985){return _0x5be558[_0x76f9('0x18')](_0x3288d3);}return _0x5be558[_0x76f9('0x19')](_0x3288d3)['end']();};}function respondWithResult(_0x5f3acb,_0x456ff5){_0x456ff5=_0x456ff5||0xc8;return function(_0x380535){if(_0x380535){return _0x5f3acb[_0x76f9('0x19')](_0x456ff5)['json'](_0x380535);}};}function respondWithFilteredResult(_0x562c43,_0x48eda3){return function(_0x35496e){if(_0x35496e){var _0x9c59fc=typeof _0x48eda3[_0x76f9('0x1a')]==='undefined'&&typeof _0x48eda3['limit']===_0x76f9('0x1b');var _0x213c8a=_0x35496e['count'];var _0x5e61d7=_0x9c59fc?0x0:_0x48eda3[_0x76f9('0x1a')];var _0x2ce426=_0x9c59fc?_0x35496e['count']:_0x48eda3['offset']+_0x48eda3[_0x76f9('0x1c')];var _0x4329f2;if(_0x2ce426>=_0x213c8a){_0x2ce426=_0x213c8a;_0x4329f2=0xc8;}else{_0x4329f2=0xce;}_0x562c43[_0x76f9('0x19')](_0x4329f2);return _0x562c43[_0x76f9('0x1d')](_0x76f9('0x1e'),_0x5e61d7+'-'+_0x2ce426+'/'+_0x213c8a)[_0x76f9('0x1f')](_0x35496e);}return null;};}function patchUpdates(_0x378e0c){return function(_0x3a74c6){try{jsonpatch[_0x76f9('0x20')](_0x3a74c6,_0x378e0c,!![]);}catch(_0x5232df){return BPromise[_0x76f9('0x21')](_0x5232df);}return _0x3a74c6[_0x76f9('0x22')]();};}function saveUpdates(_0x1a87ba,_0x1ea28e){return function(_0x107be7){if(_0x107be7){return _0x107be7[_0x76f9('0x23')](_0x1a87ba)[_0x76f9('0x24')](function(_0x182f65){return _0x182f65;});}return null;};}function removeEntity(_0x5762d0,_0x11ac3d){return function(_0x1b570e){if(_0x1b570e){return _0x1b570e[_0x76f9('0x25')]()[_0x76f9('0x24')](function(){_0x5762d0['status'](0xcc)[_0x76f9('0x26')]();});}};}function handleEntityNotFound(_0x857b6f,_0x5927a3){return function(_0x49e71f){if(!_0x49e71f){_0x857b6f[_0x76f9('0x18')](0x194);}return _0x49e71f;};}function handleError(_0x5ed3f2,_0x2c0d5c){_0x2c0d5c=_0x2c0d5c||0x1f4;return function(_0xc68a3b){logger['error'](_0xc68a3b['stack']);if(_0xc68a3b[_0x76f9('0x27')]){delete _0xc68a3b[_0x76f9('0x27')];}_0x5ed3f2['status'](_0x2c0d5c)[_0x76f9('0x28')](_0xc68a3b);};}exports['index']=function(_0x28e2d7,_0x3a52cd){var _0x59eba1={},_0x28ebb1={},_0x160633={'count':0x0,'rows':[]};var _0x8e7ee3=_[_0x76f9('0x29')](db[_0x76f9('0x2a')]['rawAttributes'],function(_0x2dce06){return{'name':_0x2dce06[_0x76f9('0x2b')],'type':_0x2dce06[_0x76f9('0x2c')][_0x76f9('0x2d')]};});_0x28ebb1[_0x76f9('0x2e')]=_[_0x76f9('0x29')](_0x8e7ee3,_0x76f9('0x27'));_0x28ebb1[_0x76f9('0x2f')]=_[_0x76f9('0x30')](_0x28e2d7[_0x76f9('0x2f')]);_0x28ebb1[_0x76f9('0x31')]=_[_0x76f9('0x32')](_0x28ebb1[_0x76f9('0x2e')],_0x28ebb1['query']);_0x59eba1[_0x76f9('0x33')]=_[_0x76f9('0x32')](_0x28ebb1['model'],qs[_0x76f9('0x34')](_0x28e2d7[_0x76f9('0x2f')][_0x76f9('0x34')]));_0x59eba1[_0x76f9('0x33')]=_0x59eba1[_0x76f9('0x33')][_0x76f9('0x35')]?_0x59eba1['attributes']:_0x28ebb1['model'];if(!_0x28e2d7['query']['hasOwnProperty']('nolimit')){_0x59eba1['limit']=qs[_0x76f9('0x1c')](_0x28e2d7[_0x76f9('0x2f')][_0x76f9('0x1c')]);_0x59eba1[_0x76f9('0x1a')]=qs[_0x76f9('0x1a')](_0x28e2d7['query'][_0x76f9('0x1a')]);}_0x59eba1[_0x76f9('0x36')]=qs[_0x76f9('0x37')](_0x28e2d7[_0x76f9('0x2f')]['sort']);_0x59eba1['where']=qs[_0x76f9('0x31')](_['pick'](_0x28e2d7[_0x76f9('0x2f')],_0x28ebb1[_0x76f9('0x31')]),_0x8e7ee3);if(_0x28e2d7['query'][_0x76f9('0x38')]){_0x59eba1['where']=_[_0x76f9('0x39')](_0x59eba1[_0x76f9('0x3a')],{'$or':_[_0x76f9('0x29')](_0x8e7ee3,function(_0x199a48){if(_0x199a48[_0x76f9('0x2c')]!==_0x76f9('0x3b')){var _0x303626={};_0x303626[_0x199a48[_0x76f9('0x27')]]={'$like':'%'+_0x28e2d7[_0x76f9('0x2f')][_0x76f9('0x38')]+'%'};return _0x303626;}})});}_0x59eba1=_[_0x76f9('0x39')]({},_0x59eba1,_0x28e2d7['options']);var _0x5ba97f={'where':_0x59eba1[_0x76f9('0x3a')]};return db[_0x76f9('0x2a')]['count'](_0x5ba97f)[_0x76f9('0x24')](function(_0x2b3e09){_0x160633['count']=_0x2b3e09;if(_0x28e2d7[_0x76f9('0x2f')]['includeAll']){_0x59eba1['include']=[{'all':!![]}];}return db['DeskAccount']['findAll'](_0x59eba1);})[_0x76f9('0x24')](function(_0x4ce29b){_0x160633[_0x76f9('0x3c')]=_0x4ce29b;return _0x160633;})[_0x76f9('0x24')](respondWithFilteredResult(_0x3a52cd,_0x59eba1))[_0x76f9('0x3d')](handleError(_0x3a52cd,null));};exports[_0x76f9('0x3e')]=function(_0x3b1414,_0x2f537e){var _0xfeb4e4={'raw':![],'where':{'id':_0x3b1414[_0x76f9('0x3f')]['id']}},_0x2be3ab={};_0x2be3ab[_0x76f9('0x2e')]=_[_0x76f9('0x30')](db['DeskAccount'][_0x76f9('0x40')]);_0x2be3ab[_0x76f9('0x2f')]=_[_0x76f9('0x30')](_0x3b1414[_0x76f9('0x2f')]);_0x2be3ab['filters']=_[_0x76f9('0x32')](_0x2be3ab[_0x76f9('0x2e')],_0x2be3ab[_0x76f9('0x2f')]);_0xfeb4e4[_0x76f9('0x33')]=_[_0x76f9('0x32')](_0x2be3ab[_0x76f9('0x2e')],qs[_0x76f9('0x34')](_0x3b1414[_0x76f9('0x2f')]['fields']));_0xfeb4e4[_0x76f9('0x33')]=_0xfeb4e4[_0x76f9('0x33')]['length']?_0xfeb4e4[_0x76f9('0x33')]:_0x2be3ab[_0x76f9('0x2e')];if(_0x3b1414[_0x76f9('0x2f')][_0x76f9('0x41')]){_0xfeb4e4[_0x76f9('0x42')]=[{'all':!![]}];}_0xfeb4e4=_[_0x76f9('0x39')]({},_0xfeb4e4,_0x3b1414[_0x76f9('0x43')]);return db['DeskAccount'][_0x76f9('0x44')](_0xfeb4e4)['then'](handleEntityNotFound(_0x2f537e,null))[_0x76f9('0x24')](respondWithResult(_0x2f537e,null))[_0x76f9('0x3d')](handleError(_0x2f537e,null));};exports[_0x76f9('0x45')]=function(_0x214855,_0xa99fff){return db['DeskAccount']['create'](_0x214855['body'],{})[_0x76f9('0x24')](respondWithResult(_0xa99fff,0xc9))[_0x76f9('0x3d')](handleError(_0xa99fff,null));};exports[_0x76f9('0x23')]=function(_0x24c672,_0x4c260c){if(_0x24c672[_0x76f9('0x46')]['id']){delete _0x24c672['body']['id'];}return db[_0x76f9('0x2a')][_0x76f9('0x44')]({'where':{'id':_0x24c672[_0x76f9('0x3f')]['id']}})[_0x76f9('0x24')](handleEntityNotFound(_0x4c260c,null))[_0x76f9('0x24')](saveUpdates(_0x24c672['body'],null))[_0x76f9('0x24')](respondWithResult(_0x4c260c,null))['catch'](handleError(_0x4c260c,null));};exports['destroy']=function(_0x1c348a,_0x127e40){return db['DeskAccount'][_0x76f9('0x44')]({'where':{'id':_0x1c348a[_0x76f9('0x3f')]['id']}})['then'](handleEntityNotFound(_0x127e40,null))['then'](removeEntity(_0x127e40,null))['catch'](handleError(_0x127e40,null));};exports[_0x76f9('0x47')]=function(_0x58da6b,_0x1b467e,_0x16bff6){var _0x364cf2={};var _0x1b4db6={};var _0x56eb6;var _0x564a58;return db['DeskAccount'][_0x76f9('0x48')]({'where':{'id':_0x58da6b[_0x76f9('0x3f')]['id']}})[_0x76f9('0x24')](handleEntityNotFound(_0x1b467e,null))[_0x76f9('0x24')](function(_0x5dfd87){if(_0x5dfd87){_0x56eb6=_0x5dfd87;_0x1b4db6[_0x76f9('0x2e')]=_[_0x76f9('0x30')](db[_0x76f9('0x49')][_0x76f9('0x40')]);_0x1b4db6[_0x76f9('0x2f')]=_[_0x76f9('0x30')](_0x58da6b[_0x76f9('0x2f')]);_0x1b4db6[_0x76f9('0x31')]=_['intersection'](_0x1b4db6[_0x76f9('0x2e')],_0x1b4db6[_0x76f9('0x2f')]);_0x364cf2['attributes']=_[_0x76f9('0x32')](_0x1b4db6['model'],qs[_0x76f9('0x34')](_0x58da6b[_0x76f9('0x2f')][_0x76f9('0x34')]));_0x364cf2[_0x76f9('0x33')]=_0x364cf2[_0x76f9('0x33')][_0x76f9('0x35')]?_0x364cf2[_0x76f9('0x33')]:_0x1b4db6[_0x76f9('0x2e')];_0x364cf2[_0x76f9('0x36')]=qs[_0x76f9('0x37')](_0x58da6b[_0x76f9('0x2f')]['sort']);_0x364cf2[_0x76f9('0x3a')]=qs[_0x76f9('0x31')](_[_0x76f9('0x4a')](_0x58da6b[_0x76f9('0x2f')],_0x1b4db6[_0x76f9('0x31')]));if(_0x58da6b['query'][_0x76f9('0x38')]){_0x364cf2[_0x76f9('0x3a')]=_['merge'](_0x364cf2[_0x76f9('0x3a')],{'$or':_['map'](_0x364cf2['attributes'],function(_0x4cb679){var _0x514aac={};_0x514aac[_0x4cb679]={'$like':'%'+_0x58da6b['query'][_0x76f9('0x38')]+'%'};return _0x514aac;})});}_0x364cf2=_[_0x76f9('0x39')]({},_0x364cf2,_0x58da6b['options']);return _0x56eb6[_0x76f9('0x47')](_0x364cf2);}})[_0x76f9('0x24')](function(_0x4b1e51){if(_0x4b1e51){_0x564a58=_0x4b1e51['length'];if(!_0x58da6b['query'][_0x76f9('0x4b')](_0x76f9('0x4c'))){_0x364cf2[_0x76f9('0x1c')]=qs[_0x76f9('0x1c')](_0x58da6b['query'][_0x76f9('0x1c')]);_0x364cf2[_0x76f9('0x1a')]=qs[_0x76f9('0x1a')](_0x58da6b[_0x76f9('0x2f')][_0x76f9('0x1a')]);}return _0x56eb6['getConfigurations'](_0x364cf2);}})[_0x76f9('0x24')](function(_0x4b6959){if(_0x4b6959){return _0x4b6959?{'count':_0x564a58,'rows':_0x4b6959}:null;}})[_0x76f9('0x24')](respondWithResult(_0x1b467e,null))['catch'](handleError(_0x1b467e,null));};exports[_0x76f9('0x4d')]=function(_0xa39dea,_0x1eba3d,_0xf06774){if(_0xa39dea[_0x76f9('0x46')]['id']){delete _0xa39dea[_0x76f9('0x46')]['id'];}return db[_0x76f9('0x2a')][_0x76f9('0x48')]({'where':{'id':_0xa39dea[_0x76f9('0x3f')]['id']}})['then'](handleEntityNotFound(_0x1eba3d,null))[_0x76f9('0x24')](function(_0x193929){if(_0x193929){_0xa39dea[_0x76f9('0x46')][_0x76f9('0x4e')]=_0x193929['id'];_0xa39dea[_0x76f9('0x46')][_0x76f9('0x4f')]=integrations[_0x76f9('0x50')](_0xa39dea['body'][_0x76f9('0x51')],_0xa39dea['body']['type']);_0xa39dea['body'][_0x76f9('0x52')]=integrations[_0x76f9('0x53')](_0xa39dea[_0x76f9('0x46')]['channel'],_0xa39dea[_0x76f9('0x46')]['type']);return db[_0x76f9('0x49')][_0x76f9('0x45')](_0xa39dea['body'],{'include':[{'model':db[_0x76f9('0x54')],'as':_0x76f9('0x4f')},{'model':db['DeskField'],'as':_0x76f9('0x52')}]});}return null;})[_0x76f9('0x24')](respondWithResult(_0x1eba3d,null))[_0x76f9('0x3d')](handleError(_0x1eba3d,null));};exports[_0x76f9('0x55')]=function(_0xe78468,_0x19e357,_0x376044){var _0x4e8845=[{'name':_0x76f9('0x56'),'label':_0x76f9('0x56'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x33abca='';return db[_0x76f9('0x2a')][_0x76f9('0x48')]({'where':{'id':_0xe78468[_0x76f9('0x3f')]['id']},'attributes':['id','remoteUri',_0x76f9('0x57'),_0x76f9('0x58'),'password','consumerKey',_0x76f9('0x59'),'token',_0x76f9('0x5a')]})[_0x76f9('0x24')](handleEntityNotFound(_0x19e357,null))[_0x76f9('0x24')](function(_0x574f4f){if(_0x574f4f){_0x33abca=_0x574f4f[_0x76f9('0x5b')];var _0x458609=_0x33abca[_0x76f9('0x5c')](-0x1);if(_0x458609==='/'){_0x33abca=_0x33abca[_0x76f9('0x5d')](0x0,_0x33abca[_0x76f9('0x5e')](_0x458609));}var _0xd32aff={'method':'GET','uri':util[_0x76f9('0x5f')](_0x76f9('0x60'),_0x33abca),'headers':{'Content-Type':_0x76f9('0x61'),'Accept':_0x76f9('0x61')},'json':!![]};if(_0x574f4f[_0x76f9('0x57')]===_0x76f9('0x62')){_0xd32aff[_0x76f9('0x63')]['Authorization']=util[_0x76f9('0x5f')](_0x76f9('0x64'),new Buffer(util[_0x76f9('0x5f')]('%s:%s',_0x574f4f['username'],_0x574f4f['password']))['toString'](_0x76f9('0x65')));}return rp(_0xd32aff)[_0x76f9('0x24')](function(_0x59efa8){return _0x4e8845['concat'](_[_0x76f9('0x29')](_0x59efa8['_embedded'][_0x76f9('0x66')],function(_0x17dbf9){return{'id':_0x17dbf9['name'],'name':_0x17dbf9['name'],'type':_0x17dbf9[_0x76f9('0x2c')],'active':_0x17dbf9[_0x76f9('0x67')],'label':_0x17dbf9[_0x76f9('0x68')],'custom':!![]};}));});}})[_0x76f9('0x24')](function(_0x4c5e56){return{'count':_0x4c5e56['length'],'rows':_0x4c5e56};})[_0x76f9('0x24')](respondWithResult(_0x19e357,null))['catch'](function(_0x2c40fa){var _0x211292=_0xe78468[_0x76f9('0x2f')][_0x76f9('0x69')]?0x1f4:_0x2c40fa[_0x76f9('0x6a')]||0x1f4;logger[_0x76f9('0x6b')]('getFields,\x20%s,\x20%s,\x20%s',_0x76f9('0x55'),_0x211292,JSON[_0x76f9('0x6c')](_0x2c40fa));delete _0x2c40fa['name'];if(_0x211292===0x191){_0x211292=0x190;}_0x19e357[_0x76f9('0x19')](_0x211292)[_0x76f9('0x28')](_0xe78468[_0x76f9('0x2f')][_0x76f9('0x69')]?{'message':'Wrong\x20credentials','statusCode':_0x2c40fa[_0x76f9('0x6a')]}:_0x2c40fa);});}; \ No newline at end of file +var _0x4c32=['GET','format','application/json','basic','Authorization','Basic\x20%s','base64','concat','_embedded','entries','active','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','to-csv','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','DeskAccount','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','includeAll','rows','show','params','options','catch','body','find','getConfigurations','order','nolimit','AccountId','Subjects','getSubjects','channel','getDescriptions','DeskField','getFields','priority','findOne','authType','username','password','consumerKey','consumerSecret','token','remoteUri','lastIndexOf'];(function(_0x496a16,_0x5c761b){var _0x316c4e=function(_0x952917){while(--_0x952917){_0x496a16['push'](_0x496a16['shift']());}};_0x316c4e(++_0x5c761b);}(_0x4c32,0x161));var _0x24c3=function(_0x50aa2e,_0xfbd6f0){_0x50aa2e=_0x50aa2e-0x0;var _0x5e07f0=_0x4c32[_0x50aa2e];return _0x5e07f0;};'use strict';var emlformat=require(_0x24c3('0x0'));var rimraf=require(_0x24c3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x24c3('0x2'));var rp=require(_0x24c3('0x3'));var moment=require(_0x24c3('0x4'));var BPromise=require(_0x24c3('0x5'));var Mustache=require(_0x24c3('0x6'));var util=require(_0x24c3('0x7'));var path=require(_0x24c3('0x8'));var sox=require(_0x24c3('0x9'));var csv=require('to-csv');var ejs=require(_0x24c3('0xa'));var fs=require('fs');var fs_extra=require(_0x24c3('0xb'));var _=require(_0x24c3('0xc'));var squel=require('squel');var crypto=require(_0x24c3('0xd'));var jsforce=require(_0x24c3('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x24c3('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x24c3('0x10'));var authService=require(_0x24c3('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x24c3('0x12'));var hardwareService=require(_0x24c3('0x13'));var logger=require(_0x24c3('0x14'))(_0x24c3('0x15'));var utils=require('../../config/utils');var config=require(_0x24c3('0x16'));var licenseUtil=require(_0x24c3('0x17'));var db=require(_0x24c3('0x18'))['db'];var integrations=require(_0x24c3('0x19'));function respondWithStatusCode(_0x24e34a,_0x2793d2){_0x2793d2=_0x2793d2||0xcc;return function(_0x53763e){if(_0x53763e){return _0x24e34a[_0x24c3('0x1a')](_0x2793d2);}return _0x24e34a['status'](_0x2793d2)[_0x24c3('0x1b')]();};}function respondWithResult(_0x25e727,_0x4f3e53){_0x4f3e53=_0x4f3e53||0xc8;return function(_0xbd7906){if(_0xbd7906){return _0x25e727[_0x24c3('0x1c')](_0x4f3e53)[_0x24c3('0x1d')](_0xbd7906);}};}function respondWithFilteredResult(_0x640fb6,_0x583a54){return function(_0x4be8dc){if(_0x4be8dc){var _0x54ffa6=typeof _0x583a54[_0x24c3('0x1e')]===_0x24c3('0x1f')&&typeof _0x583a54[_0x24c3('0x20')]===_0x24c3('0x1f');var _0x11942c=_0x4be8dc[_0x24c3('0x21')];var _0x58747c=_0x54ffa6?0x0:_0x583a54[_0x24c3('0x1e')];var _0x4ee41b=_0x54ffa6?_0x4be8dc[_0x24c3('0x21')]:_0x583a54[_0x24c3('0x1e')]+_0x583a54[_0x24c3('0x20')];var _0x27123d;if(_0x4ee41b>=_0x11942c){_0x4ee41b=_0x11942c;_0x27123d=0xc8;}else{_0x27123d=0xce;}_0x640fb6['status'](_0x27123d);return _0x640fb6[_0x24c3('0x22')](_0x24c3('0x23'),_0x58747c+'-'+_0x4ee41b+'/'+_0x11942c)['json'](_0x4be8dc);}return null;};}function patchUpdates(_0x4021c6){return function(_0x238858){try{jsonpatch[_0x24c3('0x24')](_0x238858,_0x4021c6,!![]);}catch(_0x11168e){return BPromise[_0x24c3('0x25')](_0x11168e);}return _0x238858[_0x24c3('0x26')]();};}function saveUpdates(_0x22c14b,_0x47a691){return function(_0x329664){if(_0x329664){return _0x329664[_0x24c3('0x27')](_0x22c14b)['then'](function(_0x21c96a){return _0x21c96a;});}return null;};}function removeEntity(_0x286206,_0x38eb01){return function(_0x12b8aa){if(_0x12b8aa){return _0x12b8aa[_0x24c3('0x28')]()[_0x24c3('0x29')](function(){_0x286206[_0x24c3('0x1c')](0xcc)[_0x24c3('0x1b')]();});}};}function handleEntityNotFound(_0x94087f,_0x2024b6){return function(_0x150a64){if(!_0x150a64){_0x94087f['sendStatus'](0x194);}return _0x150a64;};}function handleError(_0x8d37cd,_0x43ded5){_0x43ded5=_0x43ded5||0x1f4;return function(_0x251fba){logger[_0x24c3('0x2a')](_0x251fba[_0x24c3('0x2b')]);if(_0x251fba[_0x24c3('0x2c')]){delete _0x251fba[_0x24c3('0x2c')];}_0x8d37cd[_0x24c3('0x1c')](_0x43ded5)[_0x24c3('0x2d')](_0x251fba);};}exports[_0x24c3('0x2e')]=function(_0x3a3c29,_0x276465){var _0x98f1fd={},_0x1fe7ed={},_0x8529f8={'count':0x0,'rows':[]};var _0xede262=_[_0x24c3('0x2f')](db[_0x24c3('0x30')][_0x24c3('0x31')],function(_0x38f004){return{'name':_0x38f004[_0x24c3('0x32')],'type':_0x38f004[_0x24c3('0x33')][_0x24c3('0x34')]};});_0x1fe7ed[_0x24c3('0x35')]=_[_0x24c3('0x2f')](_0xede262,'name');_0x1fe7ed[_0x24c3('0x36')]=_['keys'](_0x3a3c29[_0x24c3('0x36')]);_0x1fe7ed[_0x24c3('0x37')]=_[_0x24c3('0x38')](_0x1fe7ed[_0x24c3('0x35')],_0x1fe7ed[_0x24c3('0x36')]);_0x98f1fd[_0x24c3('0x39')]=_[_0x24c3('0x38')](_0x1fe7ed[_0x24c3('0x35')],qs['fields'](_0x3a3c29[_0x24c3('0x36')][_0x24c3('0x3a')]));_0x98f1fd['attributes']=_0x98f1fd['attributes'][_0x24c3('0x3b')]?_0x98f1fd[_0x24c3('0x39')]:_0x1fe7ed[_0x24c3('0x35')];if(!_0x3a3c29[_0x24c3('0x36')][_0x24c3('0x3c')]('nolimit')){_0x98f1fd['limit']=qs[_0x24c3('0x20')](_0x3a3c29[_0x24c3('0x36')][_0x24c3('0x20')]);_0x98f1fd[_0x24c3('0x1e')]=qs['offset'](_0x3a3c29[_0x24c3('0x36')]['offset']);}_0x98f1fd['order']=qs[_0x24c3('0x3d')](_0x3a3c29['query']['sort']);_0x98f1fd[_0x24c3('0x3e')]=qs['filters'](_[_0x24c3('0x3f')](_0x3a3c29[_0x24c3('0x36')],_0x1fe7ed[_0x24c3('0x37')]),_0xede262);if(_0x3a3c29[_0x24c3('0x36')][_0x24c3('0x40')]){_0x98f1fd['where']=_[_0x24c3('0x41')](_0x98f1fd[_0x24c3('0x3e')],{'$or':_[_0x24c3('0x2f')](_0xede262,function(_0x42f41c){if(_0x42f41c['type']!==_0x24c3('0x42')){var _0xe5dd5b={};_0xe5dd5b[_0x42f41c[_0x24c3('0x2c')]]={'$like':'%'+_0x3a3c29['query'][_0x24c3('0x40')]+'%'};return _0xe5dd5b;}})});}_0x98f1fd=_[_0x24c3('0x41')]({},_0x98f1fd,_0x3a3c29['options']);var _0x4f5c3a={'where':_0x98f1fd[_0x24c3('0x3e')]};return db[_0x24c3('0x30')][_0x24c3('0x21')](_0x4f5c3a)[_0x24c3('0x29')](function(_0x47f693){_0x8529f8[_0x24c3('0x21')]=_0x47f693;if(_0x3a3c29[_0x24c3('0x36')][_0x24c3('0x43')]){_0x98f1fd['include']=[{'all':!![]}];}return db[_0x24c3('0x30')]['findAll'](_0x98f1fd);})[_0x24c3('0x29')](function(_0x2f90cd){_0x8529f8[_0x24c3('0x44')]=_0x2f90cd;return _0x8529f8;})[_0x24c3('0x29')](respondWithFilteredResult(_0x276465,_0x98f1fd))['catch'](handleError(_0x276465,null));};exports[_0x24c3('0x45')]=function(_0x24080b,_0x5e4339){var _0x4e3c14={'raw':![],'where':{'id':_0x24080b[_0x24c3('0x46')]['id']}},_0x4d592e={};_0x4d592e[_0x24c3('0x35')]=_['keys'](db[_0x24c3('0x30')][_0x24c3('0x31')]);_0x4d592e[_0x24c3('0x36')]=_['keys'](_0x24080b['query']);_0x4d592e[_0x24c3('0x37')]=_[_0x24c3('0x38')](_0x4d592e[_0x24c3('0x35')],_0x4d592e[_0x24c3('0x36')]);_0x4e3c14['attributes']=_[_0x24c3('0x38')](_0x4d592e[_0x24c3('0x35')],qs[_0x24c3('0x3a')](_0x24080b[_0x24c3('0x36')][_0x24c3('0x3a')]));_0x4e3c14['attributes']=_0x4e3c14['attributes']['length']?_0x4e3c14[_0x24c3('0x39')]:_0x4d592e[_0x24c3('0x35')];if(_0x24080b[_0x24c3('0x36')][_0x24c3('0x43')]){_0x4e3c14['include']=[{'all':!![]}];}_0x4e3c14=_[_0x24c3('0x41')]({},_0x4e3c14,_0x24080b[_0x24c3('0x47')]);return db[_0x24c3('0x30')]['find'](_0x4e3c14)[_0x24c3('0x29')](handleEntityNotFound(_0x5e4339,null))['then'](respondWithResult(_0x5e4339,null))[_0x24c3('0x48')](handleError(_0x5e4339,null));};exports['create']=function(_0x1396d4,_0x52479e){return db[_0x24c3('0x30')]['create'](_0x1396d4[_0x24c3('0x49')],{})[_0x24c3('0x29')](respondWithResult(_0x52479e,0xc9))[_0x24c3('0x48')](handleError(_0x52479e,null));};exports['update']=function(_0x31e47c,_0x10467f){if(_0x31e47c[_0x24c3('0x49')]['id']){delete _0x31e47c[_0x24c3('0x49')]['id'];}return db[_0x24c3('0x30')][_0x24c3('0x4a')]({'where':{'id':_0x31e47c[_0x24c3('0x46')]['id']}})['then'](handleEntityNotFound(_0x10467f,null))[_0x24c3('0x29')](saveUpdates(_0x31e47c[_0x24c3('0x49')],null))['then'](respondWithResult(_0x10467f,null))[_0x24c3('0x48')](handleError(_0x10467f,null));};exports[_0x24c3('0x28')]=function(_0x345ee8,_0x3d8d0d){return db[_0x24c3('0x30')][_0x24c3('0x4a')]({'where':{'id':_0x345ee8[_0x24c3('0x46')]['id']}})[_0x24c3('0x29')](handleEntityNotFound(_0x3d8d0d,null))[_0x24c3('0x29')](removeEntity(_0x3d8d0d,null))['catch'](handleError(_0x3d8d0d,null));};exports[_0x24c3('0x4b')]=function(_0x20440e,_0x363e3c,_0x442913){var _0x8ef699={};var _0x1197e2={};var _0x29e407;var _0x3fc3a5;return db[_0x24c3('0x30')]['findOne']({'where':{'id':_0x20440e[_0x24c3('0x46')]['id']}})[_0x24c3('0x29')](handleEntityNotFound(_0x363e3c,null))[_0x24c3('0x29')](function(_0x5d7a90){if(_0x5d7a90){_0x29e407=_0x5d7a90;_0x1197e2[_0x24c3('0x35')]=_['keys'](db['DeskConfiguration'][_0x24c3('0x31')]);_0x1197e2[_0x24c3('0x36')]=_['keys'](_0x20440e['query']);_0x1197e2['filters']=_['intersection'](_0x1197e2[_0x24c3('0x35')],_0x1197e2[_0x24c3('0x36')]);_0x8ef699[_0x24c3('0x39')]=_[_0x24c3('0x38')](_0x1197e2[_0x24c3('0x35')],qs['fields'](_0x20440e[_0x24c3('0x36')][_0x24c3('0x3a')]));_0x8ef699[_0x24c3('0x39')]=_0x8ef699['attributes'][_0x24c3('0x3b')]?_0x8ef699[_0x24c3('0x39')]:_0x1197e2['model'];_0x8ef699[_0x24c3('0x4c')]=qs['sort'](_0x20440e[_0x24c3('0x36')][_0x24c3('0x3d')]);_0x8ef699[_0x24c3('0x3e')]=qs[_0x24c3('0x37')](_[_0x24c3('0x3f')](_0x20440e[_0x24c3('0x36')],_0x1197e2['filters']));if(_0x20440e['query'][_0x24c3('0x40')]){_0x8ef699[_0x24c3('0x3e')]=_[_0x24c3('0x41')](_0x8ef699['where'],{'$or':_[_0x24c3('0x2f')](_0x8ef699[_0x24c3('0x39')],function(_0x4953a1){var _0x29b8af={};_0x29b8af[_0x4953a1]={'$like':'%'+_0x20440e[_0x24c3('0x36')]['filter']+'%'};return _0x29b8af;})});}_0x8ef699=_[_0x24c3('0x41')]({},_0x8ef699,_0x20440e[_0x24c3('0x47')]);return _0x29e407[_0x24c3('0x4b')](_0x8ef699);}})[_0x24c3('0x29')](function(_0x1dbf9f){if(_0x1dbf9f){_0x3fc3a5=_0x1dbf9f[_0x24c3('0x3b')];if(!_0x20440e[_0x24c3('0x36')][_0x24c3('0x3c')](_0x24c3('0x4d'))){_0x8ef699[_0x24c3('0x20')]=qs[_0x24c3('0x20')](_0x20440e[_0x24c3('0x36')][_0x24c3('0x20')]);_0x8ef699[_0x24c3('0x1e')]=qs[_0x24c3('0x1e')](_0x20440e[_0x24c3('0x36')]['offset']);}return _0x29e407['getConfigurations'](_0x8ef699);}})[_0x24c3('0x29')](function(_0x44fb2a){if(_0x44fb2a){return _0x44fb2a?{'count':_0x3fc3a5,'rows':_0x44fb2a}:null;}})[_0x24c3('0x29')](respondWithResult(_0x363e3c,null))[_0x24c3('0x48')](handleError(_0x363e3c,null));};exports['addConfiguration']=function(_0x1799bc,_0x591e4b,_0xeeec33){if(_0x1799bc[_0x24c3('0x49')]['id']){delete _0x1799bc[_0x24c3('0x49')]['id'];}return db[_0x24c3('0x30')]['findOne']({'where':{'id':_0x1799bc['params']['id']}})[_0x24c3('0x29')](handleEntityNotFound(_0x591e4b,null))[_0x24c3('0x29')](function(_0x560f04){if(_0x560f04){_0x1799bc[_0x24c3('0x49')][_0x24c3('0x4e')]=_0x560f04['id'];_0x1799bc['body'][_0x24c3('0x4f')]=integrations[_0x24c3('0x50')](_0x1799bc[_0x24c3('0x49')][_0x24c3('0x51')],_0x1799bc[_0x24c3('0x49')][_0x24c3('0x33')]);_0x1799bc[_0x24c3('0x49')]['Descriptions']=integrations[_0x24c3('0x52')](_0x1799bc[_0x24c3('0x49')][_0x24c3('0x51')],_0x1799bc[_0x24c3('0x49')]['type']);return db['DeskConfiguration']['create'](_0x1799bc[_0x24c3('0x49')],{'include':[{'model':db[_0x24c3('0x53')],'as':_0x24c3('0x4f')},{'model':db[_0x24c3('0x53')],'as':'Descriptions'}]});}return null;})[_0x24c3('0x29')](respondWithResult(_0x591e4b,null))['catch'](handleError(_0x591e4b,null));};exports[_0x24c3('0x54')]=function(_0x39219a,_0x32f9c8,_0x6649d3){var _0x577727=[{'name':_0x24c3('0x55'),'label':_0x24c3('0x55'),'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 _0x353665='';return db[_0x24c3('0x30')][_0x24c3('0x56')]({'where':{'id':_0x39219a[_0x24c3('0x46')]['id']},'attributes':['id','remoteUri',_0x24c3('0x57'),_0x24c3('0x58'),_0x24c3('0x59'),_0x24c3('0x5a'),_0x24c3('0x5b'),_0x24c3('0x5c'),'tokenSecret']})[_0x24c3('0x29')](handleEntityNotFound(_0x32f9c8,null))[_0x24c3('0x29')](function(_0x5596c9){if(_0x5596c9){_0x353665=_0x5596c9[_0x24c3('0x5d')];var _0xccf17d=_0x353665['slice'](-0x1);if(_0xccf17d==='/'){_0x353665=_0x353665['substring'](0x0,_0x353665[_0x24c3('0x5e')](_0xccf17d));}var _0x21bf75={'method':_0x24c3('0x5f'),'uri':util[_0x24c3('0x60')]('%s/custom_fields',_0x353665),'headers':{'Content-Type':_0x24c3('0x61'),'Accept':'application/json'},'json':!![]};if(_0x5596c9[_0x24c3('0x57')]===_0x24c3('0x62')){_0x21bf75['headers'][_0x24c3('0x63')]=util['format'](_0x24c3('0x64'),new Buffer(util[_0x24c3('0x60')]('%s:%s',_0x5596c9['username'],_0x5596c9[_0x24c3('0x59')]))['toString'](_0x24c3('0x65')));}return rp(_0x21bf75)[_0x24c3('0x29')](function(_0x253f05){return _0x577727[_0x24c3('0x66')](_['map'](_0x253f05[_0x24c3('0x67')][_0x24c3('0x68')],function(_0x2b8364){return{'id':_0x2b8364[_0x24c3('0x2c')],'name':_0x2b8364[_0x24c3('0x2c')],'type':_0x2b8364[_0x24c3('0x33')],'active':_0x2b8364[_0x24c3('0x69')],'label':_0x2b8364[_0x24c3('0x6a')],'custom':!![]};}));});}})[_0x24c3('0x29')](function(_0x2fd3e){return{'count':_0x2fd3e[_0x24c3('0x3b')],'rows':_0x2fd3e};})[_0x24c3('0x29')](respondWithResult(_0x32f9c8,null))[_0x24c3('0x48')](function(_0x315a3a){var _0xe5051e=_0x39219a[_0x24c3('0x36')][_0x24c3('0x6b')]?0x1f4:_0x315a3a[_0x24c3('0x6c')]||0x1f4;logger[_0x24c3('0x2a')](_0x24c3('0x6d'),'getFields',_0xe5051e,JSON[_0x24c3('0x6e')](_0x315a3a));delete _0x315a3a[_0x24c3('0x2c')];if(_0xe5051e===0x191){_0xe5051e=0x190;}_0x32f9c8['status'](_0xe5051e)[_0x24c3('0x2d')](_0x39219a['query'][_0x24c3('0x6b')]?{'message':_0x24c3('0x6f'),'statusCode':_0x315a3a[_0x24c3('0x6c')]}:_0x315a3a);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 7f9c9fe..1483609 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 _0x6b35=['../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports','define','DeskAccount','int_desk_accounts','lodash','util','../../config/logger','moment','path','rimraf'];(function(_0x2561db,_0x83abbe){var _0x6f3088=function(_0x6b4b92){while(--_0x6b4b92){_0x2561db['push'](_0x2561db['shift']());}};_0x6f3088(++_0x83abbe);}(_0x6b35,0x118));var _0x56b3=function(_0x40d088,_0xf79302){_0x40d088=_0x40d088-0x0;var _0x1ca2c3=_0x6b35[_0x40d088];return _0x1ca2c3;};'use strict';var _=require(_0x56b3('0x0'));var util=require(_0x56b3('0x1'));var logger=require(_0x56b3('0x2'))('api');var moment=require(_0x56b3('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x56b3('0x4'));var rimraf=require(_0x56b3('0x5'));var config=require(_0x56b3('0x6'));var attributes=require(_0x56b3('0x7'));var integrations=require(_0x56b3('0x8'));module[_0x56b3('0x9')]=function(_0x4419e7,_0x1c4419){return _0x4419e7[_0x56b3('0xa')](_0x56b3('0xb'),attributes,{'tableName':_0x56b3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x10c7=['../../components/integrations/configuration','define','DeskAccount','int_desk_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x50c492,_0x5c1e67){var _0x3505a8=function(_0x2f7937){while(--_0x2f7937){_0x50c492['push'](_0x50c492['shift']());}};_0x3505a8(++_0x5c1e67);}(_0x10c7,0x19c));var _0x710c=function(_0x4ee2be,_0x188b82){_0x4ee2be=_0x4ee2be-0x0;var _0x165535=_0x10c7[_0x4ee2be];return _0x165535;};'use strict';var _=require(_0x710c('0x0'));var util=require('util');var logger=require(_0x710c('0x1'))(_0x710c('0x2'));var moment=require(_0x710c('0x3'));var BPromise=require(_0x710c('0x4'));var rp=require(_0x710c('0x5'));var fs=require('fs');var path=require(_0x710c('0x6'));var rimraf=require('rimraf');var config=require(_0x710c('0x7'));var attributes=require('./intDeskAccount.attributes');var integrations=require(_0x710c('0x8'));module['exports']=function(_0x7b3636,_0x466430){return _0x7b3636[_0x710c('0x9')](_0x710c('0xa'),attributes,{'tableName':_0x710c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.rpc.js b/server/api/intDeskAccount/intDeskAccount.rpc.js index 1425243..ca73ed4 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 _0xb843=['debug','DeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','GetDeskAccount','findAll','options','raw','attributes','limit','include','map','model','ShowDeskAccount','DeskAccount','where','lodash','util','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','then','DeskAccount,\x20%s,\x20%s'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0xb843,0x7b));var _0x3b84=function(_0x3dd18e,_0x50c12c){_0x3dd18e=_0x3dd18e-0x0;var _0x70e60f=_0xb843[_0x3dd18e];return _0x70e60f;};'use strict';var _=require(_0x3b84('0x0'));var util=require(_0x3b84('0x1'));var moment=require(_0x3b84('0x2'));var BPromise=require('bluebird');var rs=require(_0x3b84('0x3'));var fs=require('fs');var Redis=require(_0x3b84('0x4'));var db=require(_0x3b84('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3b84('0x6'));var config=require(_0x3b84('0x7'));var jayson=require(_0x3b84('0x8'));var client=jayson[_0x3b84('0x9')][_0x3b84('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b5592,_0x253f04,_0x5baad4){return new BPromise(function(_0xf8e14f,_0x1d0e14){return client['request'](_0x3b5592,_0x5baad4)[_0x3b84('0xb')](function(_0x3f4cf1){logger['info'](_0x3b84('0xc'),_0x253f04,'request\x20sent');logger[_0x3b84('0xd')](_0x3b84('0xe'),_0x253f04,_0x3b84('0xf'),JSON[_0x3b84('0x10')](_0x3f4cf1));if(_0x3f4cf1['error']){if(_0x3f4cf1[_0x3b84('0x11')]['code']===0x1f4){logger[_0x3b84('0x11')](_0x3b84('0xc'),_0x253f04,_0x3f4cf1[_0x3b84('0x11')][_0x3b84('0x12')]);return _0x1d0e14(_0x3f4cf1['error']['message']);}logger[_0x3b84('0x11')](_0x3b84('0xc'),_0x253f04,_0x3f4cf1['error'][_0x3b84('0x12')]);return _0xf8e14f(_0x3f4cf1[_0x3b84('0x11')][_0x3b84('0x12')]);}else{logger[_0x3b84('0x13')](_0x3b84('0xc'),_0x253f04,'request\x20sent');_0xf8e14f(_0x3f4cf1[_0x3b84('0x14')][_0x3b84('0x12')]);}})[_0x3b84('0x15')](function(_0x4d8ec0){logger[_0x3b84('0x11')](_0x3b84('0xc'),_0x253f04,_0x4d8ec0);_0x1d0e14(_0x4d8ec0);});});}exports[_0x3b84('0x16')]=function(_0x1140f7){var _0x5d85b7=this;return new Promise(function(_0x54f40f,_0x3e4ccd){return db['DeskAccount'][_0x3b84('0x17')]({'raw':_0x1140f7['options']?_0x1140f7[_0x3b84('0x18')][_0x3b84('0x19')]===undefined?!![]:![]:!![],'where':_0x1140f7[_0x3b84('0x18')]?_0x1140f7[_0x3b84('0x18')]['where']||null:null,'attributes':_0x1140f7[_0x3b84('0x18')]?_0x1140f7[_0x3b84('0x18')][_0x3b84('0x1a')]||null:null,'limit':_0x1140f7[_0x3b84('0x18')]?_0x1140f7[_0x3b84('0x18')][_0x3b84('0x1b')]||null:null,'include':_0x1140f7[_0x3b84('0x18')]?_0x1140f7['options'][_0x3b84('0x1c')]?_[_0x3b84('0x1d')](_0x1140f7[_0x3b84('0x18')][_0x3b84('0x1c')],function(_0x80e1b9){return{'model':db[_0x80e1b9[_0x3b84('0x1e')]],'as':_0x80e1b9['as'],'attributes':_0x80e1b9[_0x3b84('0x1a')],'include':_0x80e1b9[_0x3b84('0x1c')]?_[_0x3b84('0x1d')](_0x80e1b9[_0x3b84('0x1c')],function(_0x500103){return{'model':db[_0x500103[_0x3b84('0x1e')]],'as':_0x500103['as'],'attributes':_0x500103[_0x3b84('0x1a')],'include':_0x500103[_0x3b84('0x1c')]?_[_0x3b84('0x1d')](_0x500103[_0x3b84('0x1c')],function(_0x15821f){return{'model':db[_0x15821f['model']],'as':_0x15821f['as'],'attributes':_0x15821f[_0x3b84('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1eff5d){logger[_0x3b84('0x13')](_0x3b84('0x16'),_0x1140f7);logger[_0x3b84('0xd')](_0x3b84('0x16'),_0x1140f7,JSON[_0x3b84('0x10')](_0x1eff5d));_0x54f40f(_0x1eff5d);})[_0x3b84('0x15')](function(_0x11c302){logger[_0x3b84('0x11')](_0x3b84('0x16'),_0x11c302['message'],_0x1140f7);_0x3e4ccd(_0x5d85b7[_0x3b84('0x11')](0x1f4,_0x11c302[_0x3b84('0x12')]));});});};exports[_0x3b84('0x1f')]=function(_0x19e4b8){var _0x5cf02f=this;return new Promise(function(_0x1fab1b,_0x57f9c3){return db[_0x3b84('0x20')]['find']({'raw':_0x19e4b8[_0x3b84('0x18')]?_0x19e4b8['options']['raw']===undefined?!![]:![]:!![],'where':_0x19e4b8[_0x3b84('0x18')]?_0x19e4b8[_0x3b84('0x18')][_0x3b84('0x21')]||null:null,'attributes':_0x19e4b8[_0x3b84('0x18')]?_0x19e4b8['options'][_0x3b84('0x1a')]||null:null,'include':_0x19e4b8[_0x3b84('0x18')]?_0x19e4b8['options'][_0x3b84('0x1c')]?_[_0x3b84('0x1d')](_0x19e4b8[_0x3b84('0x18')][_0x3b84('0x1c')],function(_0x3deecd){return{'model':db[_0x3deecd[_0x3b84('0x1e')]],'as':_0x3deecd['as'],'attributes':_0x3deecd[_0x3b84('0x1a')],'include':_0x3deecd[_0x3b84('0x1c')]?_[_0x3b84('0x1d')](_0x3deecd[_0x3b84('0x1c')],function(_0x4b0b08){return{'model':db[_0x4b0b08['model']],'as':_0x4b0b08['as'],'attributes':_0x4b0b08[_0x3b84('0x1a')],'include':_0x4b0b08[_0x3b84('0x1c')]?_[_0x3b84('0x1d')](_0x4b0b08[_0x3b84('0x1c')],function(_0x59a0ff){return{'model':db[_0x59a0ff[_0x3b84('0x1e')]],'as':_0x59a0ff['as'],'attributes':_0x59a0ff[_0x3b84('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x3b84('0xb')](function(_0x3373ca){logger[_0x3b84('0x13')](_0x3b84('0x1f'),_0x19e4b8);logger[_0x3b84('0xd')](_0x3b84('0x1f'),_0x19e4b8,JSON[_0x3b84('0x10')](_0x3373ca));_0x1fab1b(_0x3373ca);})['catch'](function(_0x31a90e){logger[_0x3b84('0x11')](_0x3b84('0x1f'),_0x31a90e['message'],_0x19e4b8);_0x57f9c3(_0x5cf02f[_0x3b84('0x11')](0x1f4,_0x31a90e[_0x3b84('0x12')]));});});}; \ No newline at end of file +var _0x916c=['DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','catch','GetDeskAccount','findAll','options','raw','where','attributes','include','map','model','ShowDeskAccount','DeskAccount','find','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/environment','jayson/promise','client','http','then','info','DeskAccount,\x20%s,\x20%s','debug'];(function(_0x1d5a46,_0x4d359f){var _0x33caec=function(_0x26d3fb){while(--_0x26d3fb){_0x1d5a46['push'](_0x1d5a46['shift']());}};_0x33caec(++_0x4d359f);}(_0x916c,0x92));var _0xc916=function(_0xe4bb3d,_0x21e87e){_0xe4bb3d=_0xe4bb3d-0x0;var _0xd9e51=_0x916c[_0xe4bb3d];return _0xd9e51;};'use strict';var _=require(_0xc916('0x0'));var util=require(_0xc916('0x1'));var moment=require(_0xc916('0x2'));var BPromise=require(_0xc916('0x3'));var rs=require(_0xc916('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc916('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xc916('0x6'));var jayson=require(_0xc916('0x7'));var client=jayson[_0xc916('0x8')][_0xc916('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4d155b,_0xd07211,_0x14917f){return new BPromise(function(_0x48a754,_0x34d4ca){return client['request'](_0x4d155b,_0x14917f)[_0xc916('0xa')](function(_0x1bd4ab){logger[_0xc916('0xb')](_0xc916('0xc'),_0xd07211,'request\x20sent');logger[_0xc916('0xd')](_0xc916('0xe'),_0xd07211,'request\x20sent',JSON[_0xc916('0xf')](_0x1bd4ab));if(_0x1bd4ab['error']){if(_0x1bd4ab[_0xc916('0x10')]['code']===0x1f4){logger['error'](_0xc916('0xc'),_0xd07211,_0x1bd4ab['error']['message']);return _0x34d4ca(_0x1bd4ab[_0xc916('0x10')][_0xc916('0x11')]);}logger[_0xc916('0x10')]('DeskAccount,\x20%s,\x20%s',_0xd07211,_0x1bd4ab[_0xc916('0x10')][_0xc916('0x11')]);return _0x48a754(_0x1bd4ab[_0xc916('0x10')][_0xc916('0x11')]);}else{logger[_0xc916('0xb')](_0xc916('0xc'),_0xd07211,_0xc916('0x12'));_0x48a754(_0x1bd4ab['result'][_0xc916('0x11')]);}})[_0xc916('0x13')](function(_0x5de003){logger[_0xc916('0x10')](_0xc916('0xc'),_0xd07211,_0x5de003);_0x34d4ca(_0x5de003);});});}exports[_0xc916('0x14')]=function(_0x524bf3){var _0x284597=this;return new Promise(function(_0x4ee12f,_0x21a3b0){return db['DeskAccount'][_0xc916('0x15')]({'raw':_0x524bf3[_0xc916('0x16')]?_0x524bf3[_0xc916('0x16')][_0xc916('0x17')]===undefined?!![]:![]:!![],'where':_0x524bf3[_0xc916('0x16')]?_0x524bf3[_0xc916('0x16')][_0xc916('0x18')]||null:null,'attributes':_0x524bf3[_0xc916('0x16')]?_0x524bf3[_0xc916('0x16')][_0xc916('0x19')]||null:null,'limit':_0x524bf3[_0xc916('0x16')]?_0x524bf3['options']['limit']||null:null,'include':_0x524bf3[_0xc916('0x16')]?_0x524bf3[_0xc916('0x16')][_0xc916('0x1a')]?_[_0xc916('0x1b')](_0x524bf3[_0xc916('0x16')][_0xc916('0x1a')],function(_0x11cd92){return{'model':db[_0x11cd92['model']],'as':_0x11cd92['as'],'attributes':_0x11cd92[_0xc916('0x19')],'include':_0x11cd92[_0xc916('0x1a')]?_['map'](_0x11cd92[_0xc916('0x1a')],function(_0x55c9f5){return{'model':db[_0x55c9f5[_0xc916('0x1c')]],'as':_0x55c9f5['as'],'attributes':_0x55c9f5[_0xc916('0x19')],'include':_0x55c9f5[_0xc916('0x1a')]?_[_0xc916('0x1b')](_0x55c9f5['include'],function(_0x5d27e1){return{'model':db[_0x5d27e1['model']],'as':_0x5d27e1['as'],'attributes':_0x5d27e1[_0xc916('0x19')]};}):[]};}):[]};}):[]:[]})[_0xc916('0xa')](function(_0x52ceb6){logger['info'](_0xc916('0x14'),_0x524bf3);logger[_0xc916('0xd')]('GetDeskAccount',_0x524bf3,JSON[_0xc916('0xf')](_0x52ceb6));_0x4ee12f(_0x52ceb6);})[_0xc916('0x13')](function(_0x2e6520){logger['error']('GetDeskAccount',_0x2e6520['message'],_0x524bf3);_0x21a3b0(_0x284597['error'](0x1f4,_0x2e6520['message']));});});};exports[_0xc916('0x1d')]=function(_0x2e1da4){var _0x3542e4=this;return new Promise(function(_0x449665,_0x583170){return db[_0xc916('0x1e')][_0xc916('0x1f')]({'raw':_0x2e1da4[_0xc916('0x16')]?_0x2e1da4[_0xc916('0x16')][_0xc916('0x17')]===undefined?!![]:![]:!![],'where':_0x2e1da4[_0xc916('0x16')]?_0x2e1da4[_0xc916('0x16')][_0xc916('0x18')]||null:null,'attributes':_0x2e1da4[_0xc916('0x16')]?_0x2e1da4[_0xc916('0x16')][_0xc916('0x19')]||null:null,'include':_0x2e1da4[_0xc916('0x16')]?_0x2e1da4[_0xc916('0x16')][_0xc916('0x1a')]?_[_0xc916('0x1b')](_0x2e1da4[_0xc916('0x16')][_0xc916('0x1a')],function(_0x19da83){return{'model':db[_0x19da83[_0xc916('0x1c')]],'as':_0x19da83['as'],'attributes':_0x19da83[_0xc916('0x19')],'include':_0x19da83[_0xc916('0x1a')]?_[_0xc916('0x1b')](_0x19da83[_0xc916('0x1a')],function(_0x45fd0e){return{'model':db[_0x45fd0e[_0xc916('0x1c')]],'as':_0x45fd0e['as'],'attributes':_0x45fd0e[_0xc916('0x19')],'include':_0x45fd0e[_0xc916('0x1a')]?_[_0xc916('0x1b')](_0x45fd0e[_0xc916('0x1a')],function(_0xecd9f0){return{'model':db[_0xecd9f0[_0xc916('0x1c')]],'as':_0xecd9f0['as'],'attributes':_0xecd9f0[_0xc916('0x19')]};}):[]};}):[]};}):[]:[]})[_0xc916('0xa')](function(_0x48a02f){logger[_0xc916('0xb')](_0xc916('0x1d'),_0x2e1da4);logger[_0xc916('0xd')](_0xc916('0x1d'),_0x2e1da4,JSON[_0xc916('0xf')](_0x48a02f));_0x449665(_0x48a02f);})[_0xc916('0x13')](function(_0x27da9c){logger[_0xc916('0x10')](_0xc916('0x1d'),_0x27da9c[_0xc916('0x11')],_0x2e1da4);_0x583170(_0x3542e4[_0xc916('0x10')](0x1f4,_0x27da9c[_0xc916('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 66e7c1e..9198497 100644 --- a/server/api/intDeskConfiguration/index.js +++ b/server/api/intDeskConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','getTags','post','/:id/tags','setTags','update','delete','exports','multer','path','connect-timeout','express','../../components/auth/service','../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id'];(function(_0x334fbc,_0x48039d){var _0x1c513b=function(_0x1683c4){while(--_0x1683c4){_0x334fbc['push'](_0x334fbc['shift']());}};_0x1c513b(++_0x48039d);}(_0x3e74,0x175));var _0x43e7=function(_0x391ec5,_0xf358ed){_0x391ec5=_0x391ec5-0x0;var _0x48c46a=_0x3e74[_0x391ec5];return _0x48c46a;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0x7')](_0x43e7('0xc'),auth['isAuthenticated'](),controller[_0x43e7('0xd')]);router['get']('/:id/subjects',auth[_0x43e7('0x8')](),controller[_0x43e7('0xe')]);router['get'](_0x43e7('0xf'),auth['isAuthenticated'](),controller[_0x43e7('0x10')]);router[_0x43e7('0x7')]('/:id/tags',auth[_0x43e7('0x8')](),controller[_0x43e7('0x11')]);router[_0x43e7('0x12')]('/',auth[_0x43e7('0x8')](),controller['create']);router['post'](_0x43e7('0x13'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x14')]);router['put']('/:id',auth[_0x43e7('0x8')](),controller[_0x43e7('0x15')]);router[_0x43e7('0x16')](_0x43e7('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x43e7('0x17')]=router; \ No newline at end of file +var _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(_0x4d8dc3,_0x585fd1){var _0x9b03d9=function(_0x7a31d5){while(--_0x7a31d5){_0x4d8dc3['push'](_0x4d8dc3['shift']());}};_0x9b03d9(++_0x585fd1);}(_0x55ca,0x126));var _0xa55c=function(_0x47de9a,_0x40cf23){_0x47de9a=_0x47de9a-0x0;var _0x4b9d6c=_0x55ca[_0x47de9a];return _0x4b9d6c;};'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 diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index 8ab8087..2b36110 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 _0x7cec=['sequelize'];(function(_0x27e79e,_0x5f0996){var _0x34a583=function(_0x52d273){while(--_0x52d273){_0x27e79e['push'](_0x27e79e['shift']());}};_0x34a583(++_0x5f0996);}(_0x7cec,0x130));var _0xc7ce=function(_0x15e3a3,_0x3d9051){_0x15e3a3=_0x15e3a3-0x0;var _0x2bf124=_0x7cec[_0x15e3a3];return _0x2bf124;};'use strict';var Sequelize=require(_0xc7ce('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x88cd=['exports','STRING'];(function(_0xca986,_0x1ef00f){var _0x46af69=function(_0x18ad13){while(--_0x18ad13){_0xca986['push'](_0xca986['shift']());}};_0x46af69(++_0x1ef00f);}(_0x88cd,0x1a0));var _0xd88c=function(_0x35a811,_0x294db6){_0x35a811=_0x35a811-0x0;var _0x4d445e=_0x88cd[_0x35a811];return _0x4d445e;};'use strict';var Sequelize=require('sequelize');module[_0xd88c('0x0')]={'name':{'type':Sequelize[_0xd88c('0x1')]},'description':{'type':Sequelize[_0xd88c('0x1')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index b9d2c93..729e372 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 _0x0745=['merge','where','VIRTUAL','options','includeAll','include','findAll','catch','show','params','keys','create','body','find','DeskField','length','getSubjects','findOne','getDescriptions','Tag','getTags','setTags','ids','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','limit','undefined','count','offset','Content-Range','json','apply','reject','update','then','destroy','error','name','send','map','DeskConfiguration','rawAttributes','fieldName','type','key','query','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','sort','filters','pick','filter'];(function(_0x1ba88a,_0x30b1d8){var _0x5d0fe7=function(_0x3dfd87){while(--_0x3dfd87){_0x1ba88a['push'](_0x1ba88a['shift']());}};_0x5d0fe7(++_0x30b1d8);}(_0x0745,0x153));var _0x5074=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x0745[_0x3e5086];return _0xfeb102;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5074('0x0'));var zipdir=require(_0x5074('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5074('0x2'));var moment=require('moment');var BPromise=require(_0x5074('0x3'));var Mustache=require(_0x5074('0x4'));var util=require(_0x5074('0x5'));var path=require('path');var sox=require(_0x5074('0x6'));var csv=require('to-csv');var ejs=require(_0x5074('0x7'));var fs=require('fs');var fs_extra=require(_0x5074('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x5074('0x9'));var deskjs=require(_0x5074('0xa'));var toCsv=require(_0x5074('0xb'));var querystring=require(_0x5074('0xc'));var Papa=require(_0x5074('0xd'));var Redis=require(_0x5074('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5074('0xf'));var logger=require('../../config/logger')(_0x5074('0x10'));var utils=require(_0x5074('0x11'));var config=require(_0x5074('0x12'));var licenseUtil=require(_0x5074('0x13'));var db=require(_0x5074('0x14'))['db'];function respondWithStatusCode(_0x1513b4,_0x2d7b1a){_0x2d7b1a=_0x2d7b1a||0xcc;return function(_0x22e4e2){if(_0x22e4e2){return _0x1513b4[_0x5074('0x15')](_0x2d7b1a);}return _0x1513b4[_0x5074('0x16')](_0x2d7b1a)[_0x5074('0x17')]();};}function respondWithResult(_0xfe126f,_0x256877){_0x256877=_0x256877||0xc8;return function(_0x37f471){if(_0x37f471){return _0xfe126f[_0x5074('0x16')](_0x256877)['json'](_0x37f471);}};}function respondWithFilteredResult(_0xdb2696,_0x3f65de){return function(_0x4d9a18){if(_0x4d9a18){var _0x2dc896=typeof _0x3f65de['offset']==='undefined'&&typeof _0x3f65de[_0x5074('0x18')]===_0x5074('0x19');var _0x2b1a39=_0x4d9a18[_0x5074('0x1a')];var _0x1b6275=_0x2dc896?0x0:_0x3f65de[_0x5074('0x1b')];var _0x566beb=_0x2dc896?_0x4d9a18['count']:_0x3f65de[_0x5074('0x1b')]+_0x3f65de[_0x5074('0x18')];var _0x321cda;if(_0x566beb>=_0x2b1a39){_0x566beb=_0x2b1a39;_0x321cda=0xc8;}else{_0x321cda=0xce;}_0xdb2696[_0x5074('0x16')](_0x321cda);return _0xdb2696['set'](_0x5074('0x1c'),_0x1b6275+'-'+_0x566beb+'/'+_0x2b1a39)[_0x5074('0x1d')](_0x4d9a18);}return null;};}function patchUpdates(_0xa3abd3){return function(_0x3f9592){try{jsonpatch[_0x5074('0x1e')](_0x3f9592,_0xa3abd3,!![]);}catch(_0x5e82fd){return BPromise[_0x5074('0x1f')](_0x5e82fd);}return _0x3f9592['save']();};}function saveUpdates(_0x58a0c2,_0x4f9149){return function(_0x339c8c){if(_0x339c8c){return _0x339c8c[_0x5074('0x20')](_0x58a0c2)[_0x5074('0x21')](function(_0x5ce84a){return _0x5ce84a;});}return null;};}function removeEntity(_0x19f922,_0xf88e6a){return function(_0x338fa1){if(_0x338fa1){return _0x338fa1[_0x5074('0x22')]()[_0x5074('0x21')](function(){_0x19f922['status'](0xcc)[_0x5074('0x17')]();});}};}function handleEntityNotFound(_0x5a1481,_0x42d5c5){return function(_0x396334){if(!_0x396334){_0x5a1481[_0x5074('0x15')](0x194);}return _0x396334;};}function handleError(_0x1c6188,_0x568490){_0x568490=_0x568490||0x1f4;return function(_0x57d5a0){logger[_0x5074('0x23')](_0x57d5a0['stack']);if(_0x57d5a0['name']){delete _0x57d5a0[_0x5074('0x24')];}_0x1c6188[_0x5074('0x16')](_0x568490)[_0x5074('0x25')](_0x57d5a0);};}exports['index']=function(_0x479a88,_0x5e6f58){var _0x395698={},_0x59573e={},_0x3f7096={'count':0x0,'rows':[]};var _0x44dc9f=_[_0x5074('0x26')](db[_0x5074('0x27')][_0x5074('0x28')],function(_0x5a9dd1){return{'name':_0x5a9dd1[_0x5074('0x29')],'type':_0x5a9dd1[_0x5074('0x2a')][_0x5074('0x2b')]};});_0x59573e['model']=_[_0x5074('0x26')](_0x44dc9f,'name');_0x59573e['query']=_['keys'](_0x479a88[_0x5074('0x2c')]);_0x59573e['filters']=_[_0x5074('0x2d')](_0x59573e['model'],_0x59573e[_0x5074('0x2c')]);_0x395698[_0x5074('0x2e')]=_[_0x5074('0x2d')](_0x59573e[_0x5074('0x2f')],qs[_0x5074('0x30')](_0x479a88[_0x5074('0x2c')]['fields']));_0x395698['attributes']=_0x395698['attributes']['length']?_0x395698[_0x5074('0x2e')]:_0x59573e[_0x5074('0x2f')];if(!_0x479a88[_0x5074('0x2c')][_0x5074('0x31')](_0x5074('0x32'))){_0x395698['limit']=qs[_0x5074('0x18')](_0x479a88[_0x5074('0x2c')][_0x5074('0x18')]);_0x395698[_0x5074('0x1b')]=qs[_0x5074('0x1b')](_0x479a88[_0x5074('0x2c')]['offset']);}_0x395698[_0x5074('0x33')]=qs[_0x5074('0x34')](_0x479a88['query']['sort']);_0x395698['where']=qs[_0x5074('0x35')](_[_0x5074('0x36')](_0x479a88[_0x5074('0x2c')],_0x59573e[_0x5074('0x35')]),_0x44dc9f);if(_0x479a88[_0x5074('0x2c')][_0x5074('0x37')]){_0x395698['where']=_[_0x5074('0x38')](_0x395698[_0x5074('0x39')],{'$or':_[_0x5074('0x26')](_0x44dc9f,function(_0x4402ef){if(_0x4402ef['type']!==_0x5074('0x3a')){var _0x135b16={};_0x135b16[_0x4402ef[_0x5074('0x24')]]={'$like':'%'+_0x479a88['query'][_0x5074('0x37')]+'%'};return _0x135b16;}})});}_0x395698=_[_0x5074('0x38')]({},_0x395698,_0x479a88[_0x5074('0x3b')]);var _0xa2b522={'where':_0x395698[_0x5074('0x39')]};return db['DeskConfiguration']['count'](_0xa2b522)[_0x5074('0x21')](function(_0x334440){_0x3f7096['count']=_0x334440;if(_0x479a88['query'][_0x5074('0x3c')]){_0x395698[_0x5074('0x3d')]=[{'all':!![]}];}return db[_0x5074('0x27')][_0x5074('0x3e')](_0x395698);})[_0x5074('0x21')](function(_0x4b7f34){_0x3f7096['rows']=_0x4b7f34;return _0x3f7096;})[_0x5074('0x21')](respondWithFilteredResult(_0x5e6f58,_0x395698))[_0x5074('0x3f')](handleError(_0x5e6f58,null));};exports[_0x5074('0x40')]=function(_0x1e3e00,_0x3c92fb){var _0x44f293={'raw':![],'where':{'id':_0x1e3e00[_0x5074('0x41')]['id']}},_0x3a0793={};_0x3a0793['model']=_[_0x5074('0x42')](db[_0x5074('0x27')][_0x5074('0x28')]);_0x3a0793[_0x5074('0x2c')]=_[_0x5074('0x42')](_0x1e3e00[_0x5074('0x2c')]);_0x3a0793['filters']=_[_0x5074('0x2d')](_0x3a0793[_0x5074('0x2f')],_0x3a0793['query']);_0x44f293[_0x5074('0x2e')]=_[_0x5074('0x2d')](_0x3a0793['model'],qs['fields'](_0x1e3e00[_0x5074('0x2c')][_0x5074('0x30')]));_0x44f293[_0x5074('0x2e')]=_0x44f293[_0x5074('0x2e')]['length']?_0x44f293[_0x5074('0x2e')]:_0x3a0793['model'];if(_0x1e3e00[_0x5074('0x2c')]['includeAll']){_0x44f293[_0x5074('0x3d')]=[{'all':!![]}];}_0x44f293=_[_0x5074('0x38')]({},_0x44f293,_0x1e3e00[_0x5074('0x3b')]);return db[_0x5074('0x27')]['find'](_0x44f293)[_0x5074('0x21')](handleEntityNotFound(_0x3c92fb,null))[_0x5074('0x21')](respondWithResult(_0x3c92fb,null))[_0x5074('0x3f')](handleError(_0x3c92fb,null));};exports[_0x5074('0x43')]=function(_0x1f9f9a,_0x5069db){return db[_0x5074('0x27')][_0x5074('0x43')](_0x1f9f9a['body'],{})[_0x5074('0x21')](respondWithResult(_0x5069db,0xc9))['catch'](handleError(_0x5069db,null));};exports['update']=function(_0x206be6,_0x29b896){if(_0x206be6[_0x5074('0x44')]['id']){delete _0x206be6[_0x5074('0x44')]['id'];}return db[_0x5074('0x27')][_0x5074('0x45')]({'where':{'id':_0x206be6[_0x5074('0x41')]['id']}})['then'](handleEntityNotFound(_0x29b896,null))['then'](saveUpdates(_0x206be6[_0x5074('0x44')],null))[_0x5074('0x21')](respondWithResult(_0x29b896,null))[_0x5074('0x3f')](handleError(_0x29b896,null));};exports[_0x5074('0x22')]=function(_0x3e1d34,_0x542598){return db[_0x5074('0x27')][_0x5074('0x45')]({'where':{'id':_0x3e1d34[_0x5074('0x41')]['id']}})[_0x5074('0x21')](handleEntityNotFound(_0x542598,null))[_0x5074('0x21')](removeEntity(_0x542598,null))['catch'](handleError(_0x542598,null));};exports['getFields']=function(_0x2c4851,_0x11f2d5,_0x472cc5){var _0x1d6c47={};var _0x253811={};var _0x179acd;var _0x4a669a;return db['DeskConfiguration']['findOne']({'where':{'id':_0x2c4851[_0x5074('0x41')]['id']}})[_0x5074('0x21')](handleEntityNotFound(_0x11f2d5,null))[_0x5074('0x21')](function(_0x1be7a3){if(_0x1be7a3){_0x179acd=_0x1be7a3;_0x253811[_0x5074('0x2f')]=_[_0x5074('0x42')](db[_0x5074('0x46')][_0x5074('0x28')]);_0x253811['query']=_[_0x5074('0x42')](_0x2c4851[_0x5074('0x2c')]);_0x253811[_0x5074('0x35')]=_[_0x5074('0x2d')](_0x253811[_0x5074('0x2f')],_0x253811['query']);_0x1d6c47[_0x5074('0x2e')]=_[_0x5074('0x2d')](_0x253811[_0x5074('0x2f')],qs[_0x5074('0x30')](_0x2c4851[_0x5074('0x2c')][_0x5074('0x30')]));_0x1d6c47[_0x5074('0x2e')]=_0x1d6c47['attributes'][_0x5074('0x47')]?_0x1d6c47['attributes']:_0x253811['model'];_0x1d6c47[_0x5074('0x33')]=qs[_0x5074('0x34')](_0x2c4851[_0x5074('0x2c')]['sort']);_0x1d6c47[_0x5074('0x39')]=qs[_0x5074('0x35')](_[_0x5074('0x36')](_0x2c4851['query'],_0x253811[_0x5074('0x35')]));if(_0x2c4851['query'][_0x5074('0x37')]){_0x1d6c47[_0x5074('0x39')]=_[_0x5074('0x38')](_0x1d6c47['where'],{'$or':_[_0x5074('0x26')](_0x1d6c47[_0x5074('0x2e')],function(_0xe15f35){var _0xee52db={};_0xee52db[_0xe15f35]={'$like':'%'+_0x2c4851[_0x5074('0x2c')][_0x5074('0x37')]+'%'};return _0xee52db;})});}_0x1d6c47=_[_0x5074('0x38')]({},_0x1d6c47,_0x2c4851[_0x5074('0x3b')]);return _0x179acd['getFields'](_0x1d6c47);}})[_0x5074('0x21')](function(_0x5cf790){if(_0x5cf790){_0x4a669a=_0x5cf790[_0x5074('0x47')];if(!_0x2c4851[_0x5074('0x2c')]['hasOwnProperty']('nolimit')){_0x1d6c47[_0x5074('0x18')]=qs[_0x5074('0x18')](_0x2c4851[_0x5074('0x2c')]['limit']);_0x1d6c47[_0x5074('0x1b')]=qs['offset'](_0x2c4851[_0x5074('0x2c')][_0x5074('0x1b')]);}return _0x179acd['getFields'](_0x1d6c47);}})[_0x5074('0x21')](function(_0x258c09){if(_0x258c09){return _0x258c09?{'count':_0x4a669a,'rows':_0x258c09}:null;}})[_0x5074('0x21')](respondWithResult(_0x11f2d5,null))[_0x5074('0x3f')](handleError(_0x11f2d5,null));};exports[_0x5074('0x48')]=function(_0xd925e,_0x119d62,_0x9c6f92){var _0x4b4a1d={};var _0x10c17c={};var _0x5486be;var _0x3b0e7f;return db[_0x5074('0x27')][_0x5074('0x49')]({'where':{'id':_0xd925e['params']['id']}})[_0x5074('0x21')](handleEntityNotFound(_0x119d62,null))['then'](function(_0x11d2f2){if(_0x11d2f2){_0x5486be=_0x11d2f2;_0x10c17c[_0x5074('0x2f')]=_['keys'](db[_0x5074('0x46')]['rawAttributes']);_0x10c17c[_0x5074('0x2c')]=_[_0x5074('0x42')](_0xd925e[_0x5074('0x2c')]);_0x10c17c[_0x5074('0x35')]=_[_0x5074('0x2d')](_0x10c17c[_0x5074('0x2f')],_0x10c17c[_0x5074('0x2c')]);_0x4b4a1d[_0x5074('0x2e')]=_[_0x5074('0x2d')](_0x10c17c[_0x5074('0x2f')],qs[_0x5074('0x30')](_0xd925e['query'][_0x5074('0x30')]));_0x4b4a1d['attributes']=_0x4b4a1d[_0x5074('0x2e')]['length']?_0x4b4a1d[_0x5074('0x2e')]:_0x10c17c[_0x5074('0x2f')];_0x4b4a1d[_0x5074('0x33')]=qs[_0x5074('0x34')](_0xd925e[_0x5074('0x2c')]['sort']);_0x4b4a1d['where']=qs[_0x5074('0x35')](_[_0x5074('0x36')](_0xd925e[_0x5074('0x2c')],_0x10c17c[_0x5074('0x35')]));if(_0xd925e[_0x5074('0x2c')][_0x5074('0x37')]){_0x4b4a1d[_0x5074('0x39')]=_[_0x5074('0x38')](_0x4b4a1d[_0x5074('0x39')],{'$or':_[_0x5074('0x26')](_0x4b4a1d['attributes'],function(_0x17f22e){var _0x18ada4={};_0x18ada4[_0x17f22e]={'$like':'%'+_0xd925e[_0x5074('0x2c')]['filter']+'%'};return _0x18ada4;})});}_0x4b4a1d=_[_0x5074('0x38')]({},_0x4b4a1d,_0xd925e[_0x5074('0x3b')]);return _0x5486be[_0x5074('0x48')](_0x4b4a1d);}})[_0x5074('0x21')](function(_0x351a8b){if(_0x351a8b){_0x3b0e7f=_0x351a8b['length'];if(!_0xd925e[_0x5074('0x2c')][_0x5074('0x31')](_0x5074('0x32'))){_0x4b4a1d[_0x5074('0x18')]=qs[_0x5074('0x18')](_0xd925e[_0x5074('0x2c')][_0x5074('0x18')]);_0x4b4a1d[_0x5074('0x1b')]=qs['offset'](_0xd925e[_0x5074('0x2c')][_0x5074('0x1b')]);}return _0x5486be[_0x5074('0x48')](_0x4b4a1d);}})[_0x5074('0x21')](function(_0x4f892c){if(_0x4f892c){return _0x4f892c?{'count':_0x3b0e7f,'rows':_0x4f892c}:null;}})['then'](respondWithResult(_0x119d62,null))[_0x5074('0x3f')](handleError(_0x119d62,null));};exports[_0x5074('0x4a')]=function(_0xb2316a,_0x180221,_0x283f33){var _0x16b885={};var _0x2de2ab={};var _0x2ad4de;var _0x50c967;return db[_0x5074('0x27')]['findOne']({'where':{'id':_0xb2316a['params']['id']}})[_0x5074('0x21')](handleEntityNotFound(_0x180221,null))['then'](function(_0x7a2791){if(_0x7a2791){_0x2ad4de=_0x7a2791;_0x2de2ab[_0x5074('0x2f')]=_['keys'](db[_0x5074('0x46')][_0x5074('0x28')]);_0x2de2ab['query']=_['keys'](_0xb2316a[_0x5074('0x2c')]);_0x2de2ab[_0x5074('0x35')]=_[_0x5074('0x2d')](_0x2de2ab[_0x5074('0x2f')],_0x2de2ab[_0x5074('0x2c')]);_0x16b885[_0x5074('0x2e')]=_['intersection'](_0x2de2ab[_0x5074('0x2f')],qs[_0x5074('0x30')](_0xb2316a['query']['fields']));_0x16b885[_0x5074('0x2e')]=_0x16b885[_0x5074('0x2e')][_0x5074('0x47')]?_0x16b885['attributes']:_0x2de2ab[_0x5074('0x2f')];_0x16b885[_0x5074('0x33')]=qs[_0x5074('0x34')](_0xb2316a[_0x5074('0x2c')][_0x5074('0x34')]);_0x16b885['where']=qs[_0x5074('0x35')](_[_0x5074('0x36')](_0xb2316a[_0x5074('0x2c')],_0x2de2ab[_0x5074('0x35')]));if(_0xb2316a['query']['filter']){_0x16b885[_0x5074('0x39')]=_[_0x5074('0x38')](_0x16b885[_0x5074('0x39')],{'$or':_[_0x5074('0x26')](_0x16b885[_0x5074('0x2e')],function(_0x10b30c){var _0x58467a={};_0x58467a[_0x10b30c]={'$like':'%'+_0xb2316a[_0x5074('0x2c')][_0x5074('0x37')]+'%'};return _0x58467a;})});}_0x16b885=_[_0x5074('0x38')]({},_0x16b885,_0xb2316a[_0x5074('0x3b')]);return _0x2ad4de['getDescriptions'](_0x16b885);}})['then'](function(_0x45122c){if(_0x45122c){_0x50c967=_0x45122c[_0x5074('0x47')];if(!_0xb2316a[_0x5074('0x2c')]['hasOwnProperty'](_0x5074('0x32'))){_0x16b885[_0x5074('0x18')]=qs['limit'](_0xb2316a[_0x5074('0x2c')]['limit']);_0x16b885[_0x5074('0x1b')]=qs['offset'](_0xb2316a[_0x5074('0x2c')][_0x5074('0x1b')]);}return _0x2ad4de[_0x5074('0x4a')](_0x16b885);}})[_0x5074('0x21')](function(_0x29c8ba){if(_0x29c8ba){return _0x29c8ba?{'count':_0x50c967,'rows':_0x29c8ba}:null;}})[_0x5074('0x21')](respondWithResult(_0x180221,null))[_0x5074('0x3f')](handleError(_0x180221,null));};exports['getTags']=function(_0x52274a,_0x198163,_0x197cf4){var _0x17363c={};var _0x16e68f={};var _0x36dd30;var _0x24e3a1;return db[_0x5074('0x27')][_0x5074('0x49')]({'where':{'id':_0x52274a['params']['id']}})[_0x5074('0x21')](handleEntityNotFound(_0x198163,null))['then'](function(_0x4b043f){if(_0x4b043f){_0x36dd30=_0x4b043f;_0x16e68f[_0x5074('0x2f')]=_['keys'](db[_0x5074('0x4b')][_0x5074('0x28')]);_0x16e68f['query']=_['keys'](_0x52274a[_0x5074('0x2c')]);_0x16e68f[_0x5074('0x35')]=_[_0x5074('0x2d')](_0x16e68f['model'],_0x16e68f[_0x5074('0x2c')]);_0x17363c[_0x5074('0x2e')]=_[_0x5074('0x2d')](_0x16e68f[_0x5074('0x2f')],qs['fields'](_0x52274a[_0x5074('0x2c')]['fields']));_0x17363c[_0x5074('0x2e')]=_0x17363c['attributes']['length']?_0x17363c[_0x5074('0x2e')]:_0x16e68f['model'];_0x17363c[_0x5074('0x33')]=qs[_0x5074('0x34')](_0x52274a[_0x5074('0x2c')][_0x5074('0x34')]);_0x17363c['where']=qs['filters'](_['pick'](_0x52274a[_0x5074('0x2c')],_0x16e68f['filters']));if(_0x52274a['query'][_0x5074('0x37')]){_0x17363c[_0x5074('0x39')]=_[_0x5074('0x38')](_0x17363c[_0x5074('0x39')],{'$or':_['map'](_0x17363c[_0x5074('0x2e')],function(_0x571f6b){var _0x33f3a7={};_0x33f3a7[_0x571f6b]={'$like':'%'+_0x52274a['query'][_0x5074('0x37')]+'%'};return _0x33f3a7;})});}_0x17363c=_['merge']({},_0x17363c,_0x52274a[_0x5074('0x3b')]);return _0x36dd30[_0x5074('0x4c')](_0x17363c);}})[_0x5074('0x21')](function(_0x59c4bc){if(_0x59c4bc){_0x24e3a1=_0x59c4bc['length'];if(!_0x52274a[_0x5074('0x2c')][_0x5074('0x31')](_0x5074('0x32'))){_0x17363c[_0x5074('0x18')]=qs[_0x5074('0x18')](_0x52274a[_0x5074('0x2c')][_0x5074('0x18')]);_0x17363c[_0x5074('0x1b')]=qs[_0x5074('0x1b')](_0x52274a[_0x5074('0x2c')]['offset']);}return _0x36dd30[_0x5074('0x4c')](_0x17363c);}})['then'](function(_0xba883c){if(_0xba883c){return _0xba883c?{'count':_0x24e3a1,'rows':_0xba883c}:null;}})['then'](respondWithResult(_0x198163,null))[_0x5074('0x3f')](handleError(_0x198163,null));};exports[_0x5074('0x4d')]=function(_0x2ca0d9,_0x36f1c6,_0x175539){if(_0x2ca0d9[_0x5074('0x44')]['id']){delete _0x2ca0d9[_0x5074('0x44')]['id'];}return db['DeskConfiguration'][_0x5074('0x49')]({'where':{'id':_0x2ca0d9[_0x5074('0x41')]['id']}})[_0x5074('0x21')](handleEntityNotFound(_0x36f1c6,null))[_0x5074('0x21')](function(_0x598e2c){if(_0x598e2c){return _0x598e2c[_0x5074('0x4d')](_0x2ca0d9[_0x5074('0x44')][_0x5074('0x4e')]||[]);}return null;})[_0x5074('0x21')](respondWithResult(_0x36f1c6,null))[_0x5074('0x3f')](handleError(_0x36f1c6,null));}; \ No newline at end of file +var _0x0aa5=['status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','then','destroy','error','name','index','map','DeskConfiguration','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','where','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','catch','include','find','create','body','params','getFields','DeskField','sort','nolimit','findOne','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x1ba43c,_0x5bd2e8){var _0x2f60eb=function(_0x349dff){while(--_0x349dff){_0x1ba43c['push'](_0x1ba43c['shift']());}};_0x2f60eb(++_0x5bd2e8);}(_0x0aa5,0x1c9));var _0x50aa=function(_0x5d42bb,_0x13ce40){_0x5d42bb=_0x5d42bb-0x0;var _0x57eb5b=_0x0aa5[_0x5d42bb];return _0x57eb5b;};'use strict';var emlformat=require(_0x50aa('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x50aa('0x1'));var moment=require(_0x50aa('0x2'));var BPromise=require(_0x50aa('0x3'));var Mustache=require(_0x50aa('0x4'));var util=require('util');var path=require('path');var sox=require(_0x50aa('0x5'));var csv=require(_0x50aa('0x6'));var ejs=require(_0x50aa('0x7'));var fs=require('fs');var fs_extra=require(_0x50aa('0x8'));var _=require(_0x50aa('0x9'));var squel=require(_0x50aa('0xa'));var crypto=require(_0x50aa('0xb'));var jsforce=require(_0x50aa('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x50aa('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x50aa('0xd'));var authService=require(_0x50aa('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x50aa('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x50aa('0x10'))(_0x50aa('0x11'));var utils=require(_0x50aa('0x12'));var config=require(_0x50aa('0x13'));var licenseUtil=require(_0x50aa('0x14'));var db=require(_0x50aa('0x15'))['db'];function respondWithStatusCode(_0x3bab46,_0x28b0eb){_0x28b0eb=_0x28b0eb||0xcc;return function(_0xdf406e){if(_0xdf406e){return _0x3bab46[_0x50aa('0x16')](_0x28b0eb);}return _0x3bab46[_0x50aa('0x17')](_0x28b0eb)[_0x50aa('0x18')]();};}function respondWithResult(_0x3578d1,_0x427656){_0x427656=_0x427656||0xc8;return function(_0x2aac3a){if(_0x2aac3a){return _0x3578d1[_0x50aa('0x17')](_0x427656)[_0x50aa('0x19')](_0x2aac3a);}};}function respondWithFilteredResult(_0x30ce24,_0x4a4447){return function(_0x2db6b9){if(_0x2db6b9){var _0x3ca5a8=typeof _0x4a4447['offset']===_0x50aa('0x1a')&&typeof _0x4a4447[_0x50aa('0x1b')]===_0x50aa('0x1a');var _0x4cb565=_0x2db6b9[_0x50aa('0x1c')];var _0x215648=_0x3ca5a8?0x0:_0x4a4447[_0x50aa('0x1d')];var _0x179777=_0x3ca5a8?_0x2db6b9[_0x50aa('0x1c')]:_0x4a4447[_0x50aa('0x1d')]+_0x4a4447[_0x50aa('0x1b')];var _0x248469;if(_0x179777>=_0x4cb565){_0x179777=_0x4cb565;_0x248469=0xc8;}else{_0x248469=0xce;}_0x30ce24['status'](_0x248469);return _0x30ce24[_0x50aa('0x1e')](_0x50aa('0x1f'),_0x215648+'-'+_0x179777+'/'+_0x4cb565)[_0x50aa('0x19')](_0x2db6b9);}return null;};}function patchUpdates(_0x45c8c7){return function(_0x17fc94){try{jsonpatch['apply'](_0x17fc94,_0x45c8c7,!![]);}catch(_0xd15336){return BPromise[_0x50aa('0x20')](_0xd15336);}return _0x17fc94[_0x50aa('0x21')]();};}function saveUpdates(_0x1a19c1,_0x3254fc){return function(_0x3d366a){if(_0x3d366a){return _0x3d366a['update'](_0x1a19c1)[_0x50aa('0x22')](function(_0x46ddb6){return _0x46ddb6;});}return null;};}function removeEntity(_0x3e8812,_0x41c105){return function(_0x7032ac){if(_0x7032ac){return _0x7032ac[_0x50aa('0x23')]()[_0x50aa('0x22')](function(){_0x3e8812[_0x50aa('0x17')](0xcc)[_0x50aa('0x18')]();});}};}function handleEntityNotFound(_0x50bf12,_0x5211fd){return function(_0x40169a){if(!_0x40169a){_0x50bf12[_0x50aa('0x16')](0x194);}return _0x40169a;};}function handleError(_0x5e24e3,_0x43aaa9){_0x43aaa9=_0x43aaa9||0x1f4;return function(_0x38fc30){logger[_0x50aa('0x24')](_0x38fc30['stack']);if(_0x38fc30['name']){delete _0x38fc30[_0x50aa('0x25')];}_0x5e24e3[_0x50aa('0x17')](_0x43aaa9)['send'](_0x38fc30);};}exports[_0x50aa('0x26')]=function(_0x37787c,_0x587a22){var _0x572c93={},_0x15e734={},_0x3ef739={'count':0x0,'rows':[]};var _0x587eda=_[_0x50aa('0x27')](db[_0x50aa('0x28')][_0x50aa('0x29')],function(_0x111bfc){return{'name':_0x111bfc[_0x50aa('0x2a')],'type':_0x111bfc['type'][_0x50aa('0x2b')]};});_0x15e734[_0x50aa('0x2c')]=_[_0x50aa('0x27')](_0x587eda,_0x50aa('0x25'));_0x15e734[_0x50aa('0x2d')]=_[_0x50aa('0x2e')](_0x37787c[_0x50aa('0x2d')]);_0x15e734[_0x50aa('0x2f')]=_[_0x50aa('0x30')](_0x15e734['model'],_0x15e734['query']);_0x572c93[_0x50aa('0x31')]=_['intersection'](_0x15e734[_0x50aa('0x2c')],qs[_0x50aa('0x32')](_0x37787c[_0x50aa('0x2d')][_0x50aa('0x32')]));_0x572c93['attributes']=_0x572c93[_0x50aa('0x31')][_0x50aa('0x33')]?_0x572c93[_0x50aa('0x31')]:_0x15e734[_0x50aa('0x2c')];if(!_0x37787c[_0x50aa('0x2d')][_0x50aa('0x34')]('nolimit')){_0x572c93[_0x50aa('0x1b')]=qs[_0x50aa('0x1b')](_0x37787c[_0x50aa('0x2d')]['limit']);_0x572c93[_0x50aa('0x1d')]=qs['offset'](_0x37787c[_0x50aa('0x2d')][_0x50aa('0x1d')]);}_0x572c93[_0x50aa('0x35')]=qs['sort'](_0x37787c[_0x50aa('0x2d')]['sort']);_0x572c93[_0x50aa('0x36')]=qs['filters'](_[_0x50aa('0x37')](_0x37787c['query'],_0x15e734['filters']),_0x587eda);if(_0x37787c[_0x50aa('0x2d')][_0x50aa('0x38')]){_0x572c93['where']=_[_0x50aa('0x39')](_0x572c93[_0x50aa('0x36')],{'$or':_[_0x50aa('0x27')](_0x587eda,function(_0x52d473){if(_0x52d473[_0x50aa('0x3a')]!==_0x50aa('0x3b')){var _0x45d073={};_0x45d073[_0x52d473[_0x50aa('0x25')]]={'$like':'%'+_0x37787c[_0x50aa('0x2d')][_0x50aa('0x38')]+'%'};return _0x45d073;}})});}_0x572c93=_['merge']({},_0x572c93,_0x37787c[_0x50aa('0x3c')]);var _0x295c89={'where':_0x572c93[_0x50aa('0x36')]};return db['DeskConfiguration'][_0x50aa('0x1c')](_0x295c89)['then'](function(_0x204059){_0x3ef739[_0x50aa('0x1c')]=_0x204059;if(_0x37787c[_0x50aa('0x2d')][_0x50aa('0x3d')]){_0x572c93['include']=[{'all':!![]}];}return db[_0x50aa('0x28')][_0x50aa('0x3e')](_0x572c93);})['then'](function(_0x3d26d8){_0x3ef739['rows']=_0x3d26d8;return _0x3ef739;})['then'](respondWithFilteredResult(_0x587a22,_0x572c93))[_0x50aa('0x3f')](handleError(_0x587a22,null));};exports['show']=function(_0x484633,_0x31bf04){var _0x1ad10d={'raw':![],'where':{'id':_0x484633['params']['id']}},_0x4afd4d={};_0x4afd4d[_0x50aa('0x2c')]=_['keys'](db[_0x50aa('0x28')][_0x50aa('0x29')]);_0x4afd4d[_0x50aa('0x2d')]=_[_0x50aa('0x2e')](_0x484633[_0x50aa('0x2d')]);_0x4afd4d[_0x50aa('0x2f')]=_[_0x50aa('0x30')](_0x4afd4d[_0x50aa('0x2c')],_0x4afd4d[_0x50aa('0x2d')]);_0x1ad10d['attributes']=_['intersection'](_0x4afd4d[_0x50aa('0x2c')],qs['fields'](_0x484633['query']['fields']));_0x1ad10d[_0x50aa('0x31')]=_0x1ad10d[_0x50aa('0x31')][_0x50aa('0x33')]?_0x1ad10d['attributes']:_0x4afd4d['model'];if(_0x484633[_0x50aa('0x2d')][_0x50aa('0x3d')]){_0x1ad10d[_0x50aa('0x40')]=[{'all':!![]}];}_0x1ad10d=_[_0x50aa('0x39')]({},_0x1ad10d,_0x484633[_0x50aa('0x3c')]);return db[_0x50aa('0x28')][_0x50aa('0x41')](_0x1ad10d)[_0x50aa('0x22')](handleEntityNotFound(_0x31bf04,null))[_0x50aa('0x22')](respondWithResult(_0x31bf04,null))[_0x50aa('0x3f')](handleError(_0x31bf04,null));};exports[_0x50aa('0x42')]=function(_0x106927,_0x288d49){return db[_0x50aa('0x28')]['create'](_0x106927[_0x50aa('0x43')],{})['then'](respondWithResult(_0x288d49,0xc9))[_0x50aa('0x3f')](handleError(_0x288d49,null));};exports['update']=function(_0x3cf835,_0x43b9e7){if(_0x3cf835[_0x50aa('0x43')]['id']){delete _0x3cf835['body']['id'];}return db[_0x50aa('0x28')]['find']({'where':{'id':_0x3cf835['params']['id']}})[_0x50aa('0x22')](handleEntityNotFound(_0x43b9e7,null))[_0x50aa('0x22')](saveUpdates(_0x3cf835[_0x50aa('0x43')],null))[_0x50aa('0x22')](respondWithResult(_0x43b9e7,null))[_0x50aa('0x3f')](handleError(_0x43b9e7,null));};exports[_0x50aa('0x23')]=function(_0x24e67f,_0x1246e7){return db['DeskConfiguration'][_0x50aa('0x41')]({'where':{'id':_0x24e67f[_0x50aa('0x44')]['id']}})[_0x50aa('0x22')](handleEntityNotFound(_0x1246e7,null))[_0x50aa('0x22')](removeEntity(_0x1246e7,null))[_0x50aa('0x3f')](handleError(_0x1246e7,null));};exports[_0x50aa('0x45')]=function(_0x2a7fe5,_0x567c08,_0x21c669){var _0xab91e0={};var _0x1eb498={};var _0x11ddea;var _0x171d3d;return db[_0x50aa('0x28')]['findOne']({'where':{'id':_0x2a7fe5['params']['id']}})['then'](handleEntityNotFound(_0x567c08,null))['then'](function(_0x4e46e3){if(_0x4e46e3){_0x11ddea=_0x4e46e3;_0x1eb498['model']=_[_0x50aa('0x2e')](db[_0x50aa('0x46')]['rawAttributes']);_0x1eb498['query']=_[_0x50aa('0x2e')](_0x2a7fe5[_0x50aa('0x2d')]);_0x1eb498[_0x50aa('0x2f')]=_[_0x50aa('0x30')](_0x1eb498[_0x50aa('0x2c')],_0x1eb498[_0x50aa('0x2d')]);_0xab91e0[_0x50aa('0x31')]=_['intersection'](_0x1eb498[_0x50aa('0x2c')],qs['fields'](_0x2a7fe5[_0x50aa('0x2d')][_0x50aa('0x32')]));_0xab91e0[_0x50aa('0x31')]=_0xab91e0['attributes'][_0x50aa('0x33')]?_0xab91e0[_0x50aa('0x31')]:_0x1eb498['model'];_0xab91e0['order']=qs[_0x50aa('0x47')](_0x2a7fe5['query']['sort']);_0xab91e0[_0x50aa('0x36')]=qs['filters'](_['pick'](_0x2a7fe5[_0x50aa('0x2d')],_0x1eb498['filters']));if(_0x2a7fe5[_0x50aa('0x2d')][_0x50aa('0x38')]){_0xab91e0[_0x50aa('0x36')]=_['merge'](_0xab91e0[_0x50aa('0x36')],{'$or':_[_0x50aa('0x27')](_0xab91e0[_0x50aa('0x31')],function(_0x4bff78){var _0x570da2={};_0x570da2[_0x4bff78]={'$like':'%'+_0x2a7fe5['query'][_0x50aa('0x38')]+'%'};return _0x570da2;})});}_0xab91e0=_[_0x50aa('0x39')]({},_0xab91e0,_0x2a7fe5[_0x50aa('0x3c')]);return _0x11ddea['getFields'](_0xab91e0);}})[_0x50aa('0x22')](function(_0xf6194b){if(_0xf6194b){_0x171d3d=_0xf6194b[_0x50aa('0x33')];if(!_0x2a7fe5['query'][_0x50aa('0x34')](_0x50aa('0x48'))){_0xab91e0['limit']=qs[_0x50aa('0x1b')](_0x2a7fe5[_0x50aa('0x2d')]['limit']);_0xab91e0['offset']=qs[_0x50aa('0x1d')](_0x2a7fe5[_0x50aa('0x2d')]['offset']);}return _0x11ddea['getFields'](_0xab91e0);}})['then'](function(_0x1b7af4){if(_0x1b7af4){return _0x1b7af4?{'count':_0x171d3d,'rows':_0x1b7af4}:null;}})[_0x50aa('0x22')](respondWithResult(_0x567c08,null))[_0x50aa('0x3f')](handleError(_0x567c08,null));};exports['getSubjects']=function(_0x3d7c12,_0x5df996,_0x206a69){var _0x3d9b7e={};var _0x1d1b98={};var _0x555db2;var _0x515e5d;return db['DeskConfiguration'][_0x50aa('0x49')]({'where':{'id':_0x3d7c12[_0x50aa('0x44')]['id']}})[_0x50aa('0x22')](handleEntityNotFound(_0x5df996,null))[_0x50aa('0x22')](function(_0x1726a6){if(_0x1726a6){_0x555db2=_0x1726a6;_0x1d1b98[_0x50aa('0x2c')]=_[_0x50aa('0x2e')](db[_0x50aa('0x46')][_0x50aa('0x29')]);_0x1d1b98[_0x50aa('0x2d')]=_['keys'](_0x3d7c12[_0x50aa('0x2d')]);_0x1d1b98['filters']=_[_0x50aa('0x30')](_0x1d1b98[_0x50aa('0x2c')],_0x1d1b98[_0x50aa('0x2d')]);_0x3d9b7e[_0x50aa('0x31')]=_[_0x50aa('0x30')](_0x1d1b98[_0x50aa('0x2c')],qs[_0x50aa('0x32')](_0x3d7c12[_0x50aa('0x2d')][_0x50aa('0x32')]));_0x3d9b7e[_0x50aa('0x31')]=_0x3d9b7e[_0x50aa('0x31')]['length']?_0x3d9b7e[_0x50aa('0x31')]:_0x1d1b98['model'];_0x3d9b7e['order']=qs[_0x50aa('0x47')](_0x3d7c12[_0x50aa('0x2d')][_0x50aa('0x47')]);_0x3d9b7e['where']=qs[_0x50aa('0x2f')](_[_0x50aa('0x37')](_0x3d7c12['query'],_0x1d1b98[_0x50aa('0x2f')]));if(_0x3d7c12[_0x50aa('0x2d')][_0x50aa('0x38')]){_0x3d9b7e['where']=_['merge'](_0x3d9b7e[_0x50aa('0x36')],{'$or':_[_0x50aa('0x27')](_0x3d9b7e[_0x50aa('0x31')],function(_0x530b55){var _0x3b72bc={};_0x3b72bc[_0x530b55]={'$like':'%'+_0x3d7c12['query'][_0x50aa('0x38')]+'%'};return _0x3b72bc;})});}_0x3d9b7e=_[_0x50aa('0x39')]({},_0x3d9b7e,_0x3d7c12['options']);return _0x555db2[_0x50aa('0x4a')](_0x3d9b7e);}})['then'](function(_0x4993d2){if(_0x4993d2){_0x515e5d=_0x4993d2[_0x50aa('0x33')];if(!_0x3d7c12[_0x50aa('0x2d')][_0x50aa('0x34')]('nolimit')){_0x3d9b7e[_0x50aa('0x1b')]=qs[_0x50aa('0x1b')](_0x3d7c12[_0x50aa('0x2d')]['limit']);_0x3d9b7e[_0x50aa('0x1d')]=qs[_0x50aa('0x1d')](_0x3d7c12[_0x50aa('0x2d')]['offset']);}return _0x555db2[_0x50aa('0x4a')](_0x3d9b7e);}})['then'](function(_0x224658){if(_0x224658){return _0x224658?{'count':_0x515e5d,'rows':_0x224658}:null;}})['then'](respondWithResult(_0x5df996,null))[_0x50aa('0x3f')](handleError(_0x5df996,null));};exports['getDescriptions']=function(_0x4005b1,_0x4e248f,_0x27dd1c){var _0x3c2169={};var _0x23d5e={};var _0x476b18;var _0x4444ec;return db['DeskConfiguration'][_0x50aa('0x49')]({'where':{'id':_0x4005b1[_0x50aa('0x44')]['id']}})[_0x50aa('0x22')](handleEntityNotFound(_0x4e248f,null))[_0x50aa('0x22')](function(_0x5479bb){if(_0x5479bb){_0x476b18=_0x5479bb;_0x23d5e['model']=_[_0x50aa('0x2e')](db[_0x50aa('0x46')]['rawAttributes']);_0x23d5e['query']=_['keys'](_0x4005b1[_0x50aa('0x2d')]);_0x23d5e[_0x50aa('0x2f')]=_['intersection'](_0x23d5e[_0x50aa('0x2c')],_0x23d5e[_0x50aa('0x2d')]);_0x3c2169[_0x50aa('0x31')]=_[_0x50aa('0x30')](_0x23d5e['model'],qs[_0x50aa('0x32')](_0x4005b1[_0x50aa('0x2d')][_0x50aa('0x32')]));_0x3c2169[_0x50aa('0x31')]=_0x3c2169[_0x50aa('0x31')]['length']?_0x3c2169['attributes']:_0x23d5e['model'];_0x3c2169['order']=qs[_0x50aa('0x47')](_0x4005b1[_0x50aa('0x2d')][_0x50aa('0x47')]);_0x3c2169[_0x50aa('0x36')]=qs[_0x50aa('0x2f')](_[_0x50aa('0x37')](_0x4005b1['query'],_0x23d5e[_0x50aa('0x2f')]));if(_0x4005b1[_0x50aa('0x2d')][_0x50aa('0x38')]){_0x3c2169[_0x50aa('0x36')]=_[_0x50aa('0x39')](_0x3c2169[_0x50aa('0x36')],{'$or':_[_0x50aa('0x27')](_0x3c2169[_0x50aa('0x31')],function(_0x3355c1){var _0x436fe4={};_0x436fe4[_0x3355c1]={'$like':'%'+_0x4005b1[_0x50aa('0x2d')][_0x50aa('0x38')]+'%'};return _0x436fe4;})});}_0x3c2169=_[_0x50aa('0x39')]({},_0x3c2169,_0x4005b1[_0x50aa('0x3c')]);return _0x476b18['getDescriptions'](_0x3c2169);}})['then'](function(_0x58c5b1){if(_0x58c5b1){_0x4444ec=_0x58c5b1[_0x50aa('0x33')];if(!_0x4005b1[_0x50aa('0x2d')][_0x50aa('0x34')](_0x50aa('0x48'))){_0x3c2169[_0x50aa('0x1b')]=qs['limit'](_0x4005b1['query']['limit']);_0x3c2169['offset']=qs[_0x50aa('0x1d')](_0x4005b1[_0x50aa('0x2d')][_0x50aa('0x1d')]);}return _0x476b18[_0x50aa('0x4b')](_0x3c2169);}})[_0x50aa('0x22')](function(_0x23e6a4){if(_0x23e6a4){return _0x23e6a4?{'count':_0x4444ec,'rows':_0x23e6a4}:null;}})[_0x50aa('0x22')](respondWithResult(_0x4e248f,null))['catch'](handleError(_0x4e248f,null));};exports[_0x50aa('0x4c')]=function(_0x275a93,_0x5c5986,_0x3b4cd8){var _0x550d3b={};var _0xe6c8e8={};var _0x5e2eef;var _0x435625;return db['DeskConfiguration'][_0x50aa('0x49')]({'where':{'id':_0x275a93['params']['id']}})[_0x50aa('0x22')](handleEntityNotFound(_0x5c5986,null))[_0x50aa('0x22')](function(_0x429a0a){if(_0x429a0a){_0x5e2eef=_0x429a0a;_0xe6c8e8[_0x50aa('0x2c')]=_[_0x50aa('0x2e')](db[_0x50aa('0x4d')]['rawAttributes']);_0xe6c8e8[_0x50aa('0x2d')]=_[_0x50aa('0x2e')](_0x275a93['query']);_0xe6c8e8['filters']=_[_0x50aa('0x30')](_0xe6c8e8[_0x50aa('0x2c')],_0xe6c8e8[_0x50aa('0x2d')]);_0x550d3b['attributes']=_[_0x50aa('0x30')](_0xe6c8e8[_0x50aa('0x2c')],qs[_0x50aa('0x32')](_0x275a93[_0x50aa('0x2d')][_0x50aa('0x32')]));_0x550d3b[_0x50aa('0x31')]=_0x550d3b[_0x50aa('0x31')][_0x50aa('0x33')]?_0x550d3b[_0x50aa('0x31')]:_0xe6c8e8[_0x50aa('0x2c')];_0x550d3b[_0x50aa('0x35')]=qs[_0x50aa('0x47')](_0x275a93[_0x50aa('0x2d')][_0x50aa('0x47')]);_0x550d3b[_0x50aa('0x36')]=qs[_0x50aa('0x2f')](_[_0x50aa('0x37')](_0x275a93[_0x50aa('0x2d')],_0xe6c8e8[_0x50aa('0x2f')]));if(_0x275a93[_0x50aa('0x2d')][_0x50aa('0x38')]){_0x550d3b[_0x50aa('0x36')]=_['merge'](_0x550d3b[_0x50aa('0x36')],{'$or':_['map'](_0x550d3b[_0x50aa('0x31')],function(_0x41040d){var _0x2a43e7={};_0x2a43e7[_0x41040d]={'$like':'%'+_0x275a93[_0x50aa('0x2d')]['filter']+'%'};return _0x2a43e7;})});}_0x550d3b=_[_0x50aa('0x39')]({},_0x550d3b,_0x275a93[_0x50aa('0x3c')]);return _0x5e2eef[_0x50aa('0x4c')](_0x550d3b);}})[_0x50aa('0x22')](function(_0x52125f){if(_0x52125f){_0x435625=_0x52125f['length'];if(!_0x275a93[_0x50aa('0x2d')][_0x50aa('0x34')](_0x50aa('0x48'))){_0x550d3b[_0x50aa('0x1b')]=qs[_0x50aa('0x1b')](_0x275a93[_0x50aa('0x2d')][_0x50aa('0x1b')]);_0x550d3b[_0x50aa('0x1d')]=qs['offset'](_0x275a93[_0x50aa('0x2d')][_0x50aa('0x1d')]);}return _0x5e2eef[_0x50aa('0x4c')](_0x550d3b);}})['then'](function(_0x5e4626){if(_0x5e4626){return _0x5e4626?{'count':_0x435625,'rows':_0x5e4626}:null;}})['then'](respondWithResult(_0x5c5986,null))['catch'](handleError(_0x5c5986,null));};exports[_0x50aa('0x4e')]=function(_0x468ae0,_0x14a494,_0x234a0f){if(_0x468ae0[_0x50aa('0x43')]['id']){delete _0x468ae0[_0x50aa('0x43')]['id'];}return db[_0x50aa('0x28')][_0x50aa('0x49')]({'where':{'id':_0x468ae0['params']['id']}})[_0x50aa('0x22')](handleEntityNotFound(_0x14a494,null))[_0x50aa('0x22')](function(_0x12d317){if(_0x12d317){return _0x12d317[_0x50aa('0x4e')](_0x468ae0[_0x50aa('0x43')][_0x50aa('0x4f')]||[]);}return null;})[_0x50aa('0x22')](respondWithResult(_0x14a494,null))[_0x50aa('0x3f')](handleError(_0x14a494,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 0790298..2c39c49 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 _0xc8be=['DeskConfiguration','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intDeskConfiguration.attributes','exports'];(function(_0x19ed26,_0x56ee48){var _0x431d88=function(_0x5bd09f){while(--_0x5bd09f){_0x19ed26['push'](_0x19ed26['shift']());}};_0x431d88(++_0x56ee48);}(_0xc8be,0x15d));var _0xec8b=function(_0x2ab3eb,_0x67f1f){_0x2ab3eb=_0x2ab3eb-0x0;var _0x9de395=_0xc8be[_0x2ab3eb];return _0x9de395;};'use strict';var _=require(_0xec8b('0x0'));var util=require(_0xec8b('0x1'));var logger=require(_0xec8b('0x2'))(_0xec8b('0x3'));var moment=require(_0xec8b('0x4'));var BPromise=require(_0xec8b('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xec8b('0x6'));var rimraf=require(_0xec8b('0x7'));var config=require(_0xec8b('0x8'));var attributes=require(_0xec8b('0x9'));module[_0xec8b('0xa')]=function(_0x438bdf,_0x18569c){return _0x438bdf['define'](_0xec8b('0xb'),attributes,{'tableName':'int_desk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x35d8=['DeskConfiguration','int_desk_configurations','util','../../config/logger','api','moment','bluebird','request-promise','./intDeskConfiguration.attributes','exports','define'];(function(_0x1a91d6,_0x4e3089){var _0x4a0b81=function(_0xdc7b1f){while(--_0xdc7b1f){_0x1a91d6['push'](_0x1a91d6['shift']());}};_0x4a0b81(++_0x4e3089);}(_0x35d8,0xa7));var _0x835d=function(_0x55c013,_0x2bb2de){_0x55c013=_0x55c013-0x0;var _0x1a6176=_0x35d8[_0x55c013];return _0x1a6176;};'use strict';var _=require('lodash');var util=require(_0x835d('0x0'));var logger=require(_0x835d('0x1'))(_0x835d('0x2'));var moment=require(_0x835d('0x3'));var BPromise=require(_0x835d('0x4'));var rp=require(_0x835d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x835d('0x6'));module[_0x835d('0x7')]=function(_0x3f4eef,_0x29095e){return _0x3f4eef[_0x835d('0x8')](_0x835d('0x9'),attributes,{'tableName':_0x835d('0xa'),'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 7740a75..71aa099 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 _0xd664=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','DeskConfiguration,\x20%s,\x20%s','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','ioredis'];(function(_0x15dd68,_0x268ff5){var _0x111dc2=function(_0x64b356){while(--_0x64b356){_0x15dd68['push'](_0x15dd68['shift']());}};_0x111dc2(++_0x268ff5);}(_0xd664,0xa5));var _0x4d66=function(_0x4c1c30,_0xc9e0b0){_0x4c1c30=_0x4c1c30-0x0;var _0x5592fe=_0xd664[_0x4c1c30];return _0x5592fe;};'use strict';var _=require(_0x4d66('0x0'));var util=require(_0x4d66('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4d66('0x2'));var db=require(_0x4d66('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x4d66('0x4'))(_0x4d66('0x5'));var config=require(_0x4d66('0x6'));var jayson=require(_0x4d66('0x7'));var client=jayson[_0x4d66('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1b3853,_0x2b7a3b,_0x2f85c8){return new BPromise(function(_0x5d913c,_0x92cbea){return client[_0x4d66('0x9')](_0x1b3853,_0x2f85c8)[_0x4d66('0xa')](function(_0xcea314){logger[_0x4d66('0xb')](_0x4d66('0xc'),_0x2b7a3b,'request\x20sent');logger[_0x4d66('0xd')](_0x4d66('0xe'),_0x2b7a3b,_0x4d66('0xf'),JSON[_0x4d66('0x10')](_0xcea314));if(_0xcea314[_0x4d66('0x11')]){if(_0xcea314[_0x4d66('0x11')][_0x4d66('0x12')]===0x1f4){logger[_0x4d66('0x11')](_0x4d66('0xc'),_0x2b7a3b,_0xcea314[_0x4d66('0x11')][_0x4d66('0x13')]);return _0x92cbea(_0xcea314[_0x4d66('0x11')][_0x4d66('0x13')]);}logger[_0x4d66('0x11')]('DeskConfiguration,\x20%s,\x20%s',_0x2b7a3b,_0xcea314[_0x4d66('0x11')]['message']);return _0x5d913c(_0xcea314[_0x4d66('0x11')][_0x4d66('0x13')]);}else{logger[_0x4d66('0xb')]('DeskConfiguration,\x20%s,\x20%s',_0x2b7a3b,_0x4d66('0xf'));_0x5d913c(_0xcea314[_0x4d66('0x14')][_0x4d66('0x13')]);}})['catch'](function(_0xbd27f2){logger[_0x4d66('0x11')](_0x4d66('0xc'),_0x2b7a3b,_0xbd27f2);_0x92cbea(_0xbd27f2);});});} \ No newline at end of file +var _0xb5c6=['catch','util','moment','bluebird','randomstring','rpc','../../config/environment','client','http','request','then','info','request\x20sent','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','DeskConfiguration,\x20%s,\x20%s'];(function(_0x289682,_0x516aed){var _0x159651=function(_0x2da045){while(--_0x2da045){_0x289682['push'](_0x289682['shift']());}};_0x159651(++_0x516aed);}(_0xb5c6,0xe5));var _0x6b5c=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xb5c6[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var util=require(_0x6b5c('0x0'));var moment=require(_0x6b5c('0x1'));var BPromise=require(_0x6b5c('0x2'));var rs=require(_0x6b5c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x6b5c('0x4'));var config=require(_0x6b5c('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x6b5c('0x6')][_0x6b5c('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4c93ca,_0x17fed5,_0x45cdf1){return new BPromise(function(_0x2a13d0,_0xa530){return client[_0x6b5c('0x8')](_0x4c93ca,_0x45cdf1)[_0x6b5c('0x9')](function(_0x329f33){logger[_0x6b5c('0xa')]('DeskConfiguration,\x20%s,\x20%s',_0x17fed5,_0x6b5c('0xb'));logger['debug'](_0x6b5c('0xc'),_0x17fed5,_0x6b5c('0xb'),JSON[_0x6b5c('0xd')](_0x329f33));if(_0x329f33[_0x6b5c('0xe')]){if(_0x329f33[_0x6b5c('0xe')][_0x6b5c('0xf')]===0x1f4){logger[_0x6b5c('0xe')]('DeskConfiguration,\x20%s,\x20%s',_0x17fed5,_0x329f33['error'][_0x6b5c('0x10')]);return _0xa530(_0x329f33[_0x6b5c('0xe')]['message']);}logger[_0x6b5c('0xe')](_0x6b5c('0x11'),_0x17fed5,_0x329f33[_0x6b5c('0xe')][_0x6b5c('0x10')]);return _0x2a13d0(_0x329f33[_0x6b5c('0xe')][_0x6b5c('0x10')]);}else{logger[_0x6b5c('0xa')]('DeskConfiguration,\x20%s,\x20%s',_0x17fed5,_0x6b5c('0xb'));_0x2a13d0(_0x329f33['result'][_0x6b5c('0x10')]);}})[_0x6b5c('0x12')](function(_0x5eefc6){logger[_0x6b5c('0xe')]('DeskConfiguration,\x20%s,\x20%s',_0x17fed5,_0x5eefc6);_0xa530(_0x5eefc6);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 95e3313..c245c01 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 _0xaf3f=['../../components/interaction/service','../../config/environment','./intDeskField.controller','get','index','isAuthenticated','show','post','put','/:id','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x1ad3d0,_0x2928d5){var _0x1849a8=function(_0x39094e){while(--_0x39094e){_0x1ad3d0['push'](_0x1ad3d0['shift']());}};_0x1849a8(++_0x2928d5);}(_0xaf3f,0x11e));var _0xfaf3=function(_0x12fbb3,_0x2c9ed3){_0x12fbb3=_0x12fbb3-0x0;var _0x1d508a=_0xaf3f[_0x12fbb3];return _0x1d508a;};'use strict';var multer=require(_0xfaf3('0x0'));var util=require(_0xfaf3('0x1'));var path=require(_0xfaf3('0x2'));var timeout=require(_0xfaf3('0x3'));var express=require(_0xfaf3('0x4'));var router=express[_0xfaf3('0x5')]();var fs_extra=require(_0xfaf3('0x6'));var auth=require(_0xfaf3('0x7'));var interaction=require(_0xfaf3('0x8'));var config=require(_0xfaf3('0x9'));var controller=require(_0xfaf3('0xa'));router[_0xfaf3('0xb')]('/',auth['isAuthenticated'](),controller[_0xfaf3('0xc')]);router['get']('/:id',auth[_0xfaf3('0xd')](),controller[_0xfaf3('0xe')]);router[_0xfaf3('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0xfaf3('0x10')](_0xfaf3('0x11'),auth[_0xfaf3('0xd')](),controller[_0xfaf3('0x12')]);router[_0xfaf3('0x13')](_0xfaf3('0x11'),auth[_0xfaf3('0xd')](),controller['destroy']);module[_0xfaf3('0x14')]=router; \ No newline at end of file +var _0xe2e1=['index','get','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','isAuthenticated'];(function(_0xaf403a,_0x4b14fa){var _0x2ba10e=function(_0x1db2e1){while(--_0x1db2e1){_0xaf403a['push'](_0xaf403a['shift']());}};_0x2ba10e(++_0x4b14fa);}(_0xe2e1,0x9e));var _0x1e2e=function(_0x1139dd,_0x2251a3){_0x1139dd=_0x1139dd-0x0;var _0x4d831d=_0xe2e1[_0x1139dd];return _0x4d831d;};'use strict';var multer=require(_0x1e2e('0x0'));var util=require(_0x1e2e('0x1'));var path=require(_0x1e2e('0x2'));var timeout=require(_0x1e2e('0x3'));var express=require('express');var router=express[_0x1e2e('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x1e2e('0x5'));var interaction=require(_0x1e2e('0x6'));var config=require(_0x1e2e('0x7'));var controller=require(_0x1e2e('0x8'));router['get']('/',auth[_0x1e2e('0x9')](),controller[_0x1e2e('0xa')]);router[_0x1e2e('0xb')](_0x1e2e('0xc'),auth[_0x1e2e('0x9')](),controller[_0x1e2e('0xd')]);router[_0x1e2e('0xe')]('/',auth[_0x1e2e('0x9')](),controller[_0x1e2e('0xf')]);router[_0x1e2e('0x10')](_0x1e2e('0xc'),auth['isAuthenticated'](),controller[_0x1e2e('0x11')]);router[_0x1e2e('0x12')](_0x1e2e('0xc'),auth['isAuthenticated'](),controller[_0x1e2e('0x13')]);module[_0x1e2e('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 6c9a19e..1c14ad2 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 _0x33ea=['variable','customVariable','picklist','string','STRING','BOOLEAN','sequelize'];(function(_0x57b60f,_0x34ba07){var _0x2d1dad=function(_0x467b8b){while(--_0x467b8b){_0x57b60f['push'](_0x57b60f['shift']());}};_0x2d1dad(++_0x34ba07);}(_0x33ea,0xd8));var _0xa33e=function(_0x2a531b,_0x1491ab){_0x2a531b=_0x2a531b-0x0;var _0x2f1839=_0x33ea[_0x2a531b];return _0x2f1839;};'use strict';var Sequelize=require(_0xa33e('0x0'));module['exports']={'type':{'type':Sequelize['ENUM']('string',_0xa33e('0x1'),_0xa33e('0x2'),'keyValue',_0xa33e('0x3')),'defaultValue':_0xa33e('0x4')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xa33e('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0xa33e('0x4'),_0xa33e('0x1'),_0xa33e('0x2'))},'keyContent':{'type':Sequelize[_0xa33e('0x5')]},'idField':{'type':Sequelize[_0xa33e('0x5')]},'nameField':{'type':Sequelize[_0xa33e('0x5')]},'customField':{'type':Sequelize[_0xa33e('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa33e('0x5')]}}; \ No newline at end of file +var _0xf7f8=['keyValue','STRING','BOOLEAN','sequelize','ENUM','string','variable','customVariable'];(function(_0x1186ba,_0x421a86){var _0x13a347=function(_0x357acb){while(--_0x357acb){_0x1186ba['push'](_0x1186ba['shift']());}};_0x13a347(++_0x421a86);}(_0xf7f8,0x1c3));var _0x8f7f=function(_0x5e796f,_0x33d559){_0x5e796f=_0x5e796f-0x0;var _0x4c615f=_0xf7f8[_0x5e796f];return _0x4c615f;};'use strict';var Sequelize=require(_0x8f7f('0x0'));module['exports']={'type':{'type':Sequelize[_0x8f7f('0x1')](_0x8f7f('0x2'),_0x8f7f('0x3'),_0x8f7f('0x4'),_0x8f7f('0x5'),'picklist'),'defaultValue':_0x8f7f('0x2')},'content':{'type':Sequelize[_0x8f7f('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x8f7f('0x1')](_0x8f7f('0x2'),_0x8f7f('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x8f7f('0x6')]},'idField':{'type':Sequelize[_0x8f7f('0x6')]},'nameField':{'type':Sequelize[_0x8f7f('0x6')]},'customField':{'type':Sequelize[_0x8f7f('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8f7f('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 0e8d95b..6d55db0 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 _0xcff4=['zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','error','stack','name','send','map','type','keys','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','DeskField','findAll','rows','show','params','find','create','body','catch','eml-format','rimraf'];(function(_0x5061aa,_0x40d588){var _0x439ca5=function(_0x3062f5){while(--_0x3062f5){_0x5061aa['push'](_0x5061aa['shift']());}};_0x439ca5(++_0x40d588);}(_0xcff4,0x11e));var _0x4cff=function(_0x1cfc8f,_0xfb43f7){_0x1cfc8f=_0x1cfc8f-0x0;var _0x4acca6=_0xcff4[_0x1cfc8f];return _0x4acca6;};'use strict';var emlformat=require(_0x4cff('0x0'));var rimraf=require(_0x4cff('0x1'));var zipdir=require(_0x4cff('0x2'));var jsonpatch=require(_0x4cff('0x3'));var rp=require(_0x4cff('0x4'));var moment=require(_0x4cff('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x4cff('0x6'));var util=require('util');var path=require(_0x4cff('0x7'));var sox=require(_0x4cff('0x8'));var csv=require(_0x4cff('0x9'));var ejs=require(_0x4cff('0xa'));var fs=require('fs');var fs_extra=require(_0x4cff('0xb'));var _=require(_0x4cff('0xc'));var squel=require('squel');var crypto=require(_0x4cff('0xd'));var jsforce=require(_0x4cff('0xe'));var deskjs=require(_0x4cff('0xf'));var toCsv=require(_0x4cff('0x9'));var querystring=require(_0x4cff('0x10'));var Papa=require(_0x4cff('0x11'));var Redis=require(_0x4cff('0x12'));var authService=require(_0x4cff('0x13'));var qs=require(_0x4cff('0x14'));var as=require(_0x4cff('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x4cff('0x16'));var utils=require(_0x4cff('0x17'));var config=require(_0x4cff('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x4cff('0x19'))['db'];function respondWithStatusCode(_0x2b8273,_0xd86c2c){_0xd86c2c=_0xd86c2c||0xcc;return function(_0x35a40b){if(_0x35a40b){return _0x2b8273[_0x4cff('0x1a')](_0xd86c2c);}return _0x2b8273[_0x4cff('0x1b')](_0xd86c2c)[_0x4cff('0x1c')]();};}function respondWithResult(_0x2e4e5d,_0x306e91){_0x306e91=_0x306e91||0xc8;return function(_0x12f445){if(_0x12f445){return _0x2e4e5d[_0x4cff('0x1b')](_0x306e91)[_0x4cff('0x1d')](_0x12f445);}};}function respondWithFilteredResult(_0x56ea80,_0x148e70){return function(_0x565647){if(_0x565647){var _0x14bce8=typeof _0x148e70[_0x4cff('0x1e')]===_0x4cff('0x1f')&&typeof _0x148e70[_0x4cff('0x20')]===_0x4cff('0x1f');var _0x2749ec=_0x565647[_0x4cff('0x21')];var _0x939924=_0x14bce8?0x0:_0x148e70['offset'];var _0xae8a0e=_0x14bce8?_0x565647['count']:_0x148e70[_0x4cff('0x1e')]+_0x148e70[_0x4cff('0x20')];var _0x110e85;if(_0xae8a0e>=_0x2749ec){_0xae8a0e=_0x2749ec;_0x110e85=0xc8;}else{_0x110e85=0xce;}_0x56ea80['status'](_0x110e85);return _0x56ea80['set'](_0x4cff('0x22'),_0x939924+'-'+_0xae8a0e+'/'+_0x2749ec)['json'](_0x565647);}return null;};}function patchUpdates(_0xc7388a){return function(_0x498771){try{jsonpatch[_0x4cff('0x23')](_0x498771,_0xc7388a,!![]);}catch(_0x448079){return BPromise['reject'](_0x448079);}return _0x498771[_0x4cff('0x24')]();};}function saveUpdates(_0x65c0ab,_0x2931cf){return function(_0x181ed4){if(_0x181ed4){return _0x181ed4[_0x4cff('0x25')](_0x65c0ab)[_0x4cff('0x26')](function(_0xe6bcff){return _0xe6bcff;});}return null;};}function removeEntity(_0xfe7adb,_0x304c08){return function(_0x1c054c){if(_0x1c054c){return _0x1c054c['destroy']()[_0x4cff('0x26')](function(){_0xfe7adb[_0x4cff('0x1b')](0xcc)[_0x4cff('0x1c')]();});}};}function handleEntityNotFound(_0x4bc25a,_0x4eb3c9){return function(_0x139957){if(!_0x139957){_0x4bc25a[_0x4cff('0x1a')](0x194);}return _0x139957;};}function handleError(_0xe70525,_0x2ba328){_0x2ba328=_0x2ba328||0x1f4;return function(_0x632d03){logger[_0x4cff('0x27')](_0x632d03[_0x4cff('0x28')]);if(_0x632d03[_0x4cff('0x29')]){delete _0x632d03[_0x4cff('0x29')];}_0xe70525['status'](_0x2ba328)[_0x4cff('0x2a')](_0x632d03);};}exports['index']=function(_0x4debdd,_0x5c9e64){var _0xc476b={},_0x5da67d={},_0x207683={'count':0x0,'rows':[]};var _0xab4a17=_[_0x4cff('0x2b')](db['DeskField']['rawAttributes'],function(_0x5915d6){return{'name':_0x5915d6['fieldName'],'type':_0x5915d6[_0x4cff('0x2c')]['key']};});_0x5da67d['model']=_['map'](_0xab4a17,'name');_0x5da67d['query']=_[_0x4cff('0x2d')](_0x4debdd[_0x4cff('0x2e')]);_0x5da67d[_0x4cff('0x2f')]=_[_0x4cff('0x30')](_0x5da67d[_0x4cff('0x31')],_0x5da67d[_0x4cff('0x2e')]);_0xc476b[_0x4cff('0x32')]=_[_0x4cff('0x30')](_0x5da67d[_0x4cff('0x31')],qs[_0x4cff('0x33')](_0x4debdd[_0x4cff('0x2e')][_0x4cff('0x33')]));_0xc476b[_0x4cff('0x32')]=_0xc476b['attributes'][_0x4cff('0x34')]?_0xc476b[_0x4cff('0x32')]:_0x5da67d['model'];if(!_0x4debdd[_0x4cff('0x2e')]['hasOwnProperty'](_0x4cff('0x35'))){_0xc476b[_0x4cff('0x20')]=qs[_0x4cff('0x20')](_0x4debdd[_0x4cff('0x2e')][_0x4cff('0x20')]);_0xc476b[_0x4cff('0x1e')]=qs[_0x4cff('0x1e')](_0x4debdd[_0x4cff('0x2e')][_0x4cff('0x1e')]);}_0xc476b[_0x4cff('0x36')]=qs[_0x4cff('0x37')](_0x4debdd['query']['sort']);_0xc476b[_0x4cff('0x38')]=qs[_0x4cff('0x2f')](_[_0x4cff('0x39')](_0x4debdd[_0x4cff('0x2e')],_0x5da67d['filters']),_0xab4a17);if(_0x4debdd['query'][_0x4cff('0x3a')]){_0xc476b[_0x4cff('0x38')]=_['merge'](_0xc476b[_0x4cff('0x38')],{'$or':_[_0x4cff('0x2b')](_0xab4a17,function(_0xe70ab4){if(_0xe70ab4[_0x4cff('0x2c')]!==_0x4cff('0x3b')){var _0x2c2ef4={};_0x2c2ef4[_0xe70ab4['name']]={'$like':'%'+_0x4debdd['query'][_0x4cff('0x3a')]+'%'};return _0x2c2ef4;}})});}_0xc476b=_[_0x4cff('0x3c')]({},_0xc476b,_0x4debdd[_0x4cff('0x3d')]);var _0x4c9ba5={'where':_0xc476b[_0x4cff('0x38')]};return db['DeskField'][_0x4cff('0x21')](_0x4c9ba5)[_0x4cff('0x26')](function(_0x452564){_0x207683[_0x4cff('0x21')]=_0x452564;if(_0x4debdd['query'][_0x4cff('0x3e')]){_0xc476b['include']=[{'all':!![]}];}return db[_0x4cff('0x3f')][_0x4cff('0x40')](_0xc476b);})['then'](function(_0x5c6279){_0x207683[_0x4cff('0x41')]=_0x5c6279;return _0x207683;})[_0x4cff('0x26')](respondWithFilteredResult(_0x5c9e64,_0xc476b))['catch'](handleError(_0x5c9e64,null));};exports[_0x4cff('0x42')]=function(_0xa91b2a,_0x470cc5){var _0x306c83={'raw':!![],'where':{'id':_0xa91b2a[_0x4cff('0x43')]['id']}},_0x1903f7={};_0x1903f7[_0x4cff('0x31')]=_[_0x4cff('0x2d')](db[_0x4cff('0x3f')]['rawAttributes']);_0x1903f7[_0x4cff('0x2e')]=_[_0x4cff('0x2d')](_0xa91b2a[_0x4cff('0x2e')]);_0x1903f7[_0x4cff('0x2f')]=_[_0x4cff('0x30')](_0x1903f7['model'],_0x1903f7[_0x4cff('0x2e')]);_0x306c83['attributes']=_[_0x4cff('0x30')](_0x1903f7[_0x4cff('0x31')],qs['fields'](_0xa91b2a[_0x4cff('0x2e')][_0x4cff('0x33')]));_0x306c83[_0x4cff('0x32')]=_0x306c83[_0x4cff('0x32')][_0x4cff('0x34')]?_0x306c83[_0x4cff('0x32')]:_0x1903f7['model'];if(_0xa91b2a['query']['includeAll']){_0x306c83['include']=[{'all':!![]}];}_0x306c83=_[_0x4cff('0x3c')]({},_0x306c83,_0xa91b2a['options']);return db[_0x4cff('0x3f')][_0x4cff('0x44')](_0x306c83)[_0x4cff('0x26')](handleEntityNotFound(_0x470cc5,null))[_0x4cff('0x26')](respondWithResult(_0x470cc5,null))['catch'](handleError(_0x470cc5,null));};exports[_0x4cff('0x45')]=function(_0x4e5f99,_0x1bedbb){return db[_0x4cff('0x3f')][_0x4cff('0x45')](_0x4e5f99[_0x4cff('0x46')],{})['then'](respondWithResult(_0x1bedbb,0xc9))['catch'](handleError(_0x1bedbb,null));};exports[_0x4cff('0x25')]=function(_0x4d9f4c,_0x33a9e0){if(_0x4d9f4c[_0x4cff('0x46')]['id']){delete _0x4d9f4c[_0x4cff('0x46')]['id'];}return db[_0x4cff('0x3f')][_0x4cff('0x44')]({'where':{'id':_0x4d9f4c[_0x4cff('0x43')]['id']}})[_0x4cff('0x26')](handleEntityNotFound(_0x33a9e0,null))[_0x4cff('0x26')](saveUpdates(_0x4d9f4c[_0x4cff('0x46')],null))[_0x4cff('0x26')](respondWithResult(_0x33a9e0,null))[_0x4cff('0x47')](handleError(_0x33a9e0,null));};exports['destroy']=function(_0x5ec97c,_0x117cca){return db[_0x4cff('0x3f')][_0x4cff('0x44')]({'where':{'id':_0x5ec97c[_0x4cff('0x43')]['id']}})[_0x4cff('0x26')](handleEntityNotFound(_0x117cca,null))['then'](removeEntity(_0x117cca,null))[_0x4cff('0x47')](handleError(_0x117cca,null));}; \ No newline at end of file +var _0x59f2=['limit','count','set','apply','then','destroy','sendStatus','error','name','send','map','DeskField','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','type','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','status','end','json','offset','undefined'];(function(_0x999b85,_0x1edc2b){var _0x1d7124=function(_0x59cd29){while(--_0x59cd29){_0x999b85['push'](_0x999b85['shift']());}};_0x1d7124(++_0x1edc2b);}(_0x59f2,0xb3));var _0x259f=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x59f2[_0x173441];return _0x2423a8;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x259f('0x0'));var rp=require('request-promise');var moment=require(_0x259f('0x1'));var BPromise=require(_0x259f('0x2'));var Mustache=require(_0x259f('0x3'));var util=require(_0x259f('0x4'));var path=require('path');var sox=require(_0x259f('0x5'));var csv=require(_0x259f('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x259f('0x7'));var squel=require(_0x259f('0x8'));var crypto=require(_0x259f('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x259f('0xa'));var toCsv=require('to-csv');var querystring=require(_0x259f('0xb'));var Papa=require(_0x259f('0xc'));var Redis=require(_0x259f('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x259f('0xe'));var as=require(_0x259f('0xf'));var hardwareService=require(_0x259f('0x10'));var logger=require('../../config/logger')(_0x259f('0x11'));var utils=require(_0x259f('0x12'));var config=require(_0x259f('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x314e55,_0x31a57f){_0x31a57f=_0x31a57f||0xcc;return function(_0x4d130f){if(_0x4d130f){return _0x314e55['sendStatus'](_0x31a57f);}return _0x314e55[_0x259f('0x14')](_0x31a57f)[_0x259f('0x15')]();};}function respondWithResult(_0x4007d9,_0xea5fa){_0xea5fa=_0xea5fa||0xc8;return function(_0x12a6ef){if(_0x12a6ef){return _0x4007d9[_0x259f('0x14')](_0xea5fa)[_0x259f('0x16')](_0x12a6ef);}};}function respondWithFilteredResult(_0x421c66,_0x4cb8a3){return function(_0x333c38){if(_0x333c38){var _0x447145=typeof _0x4cb8a3[_0x259f('0x17')]===_0x259f('0x18')&&typeof _0x4cb8a3[_0x259f('0x19')]===_0x259f('0x18');var _0x3303ca=_0x333c38[_0x259f('0x1a')];var _0x6daf07=_0x447145?0x0:_0x4cb8a3[_0x259f('0x17')];var _0x39e4ab=_0x447145?_0x333c38[_0x259f('0x1a')]:_0x4cb8a3['offset']+_0x4cb8a3[_0x259f('0x19')];var _0x4343b5;if(_0x39e4ab>=_0x3303ca){_0x39e4ab=_0x3303ca;_0x4343b5=0xc8;}else{_0x4343b5=0xce;}_0x421c66['status'](_0x4343b5);return _0x421c66[_0x259f('0x1b')]('Content-Range',_0x6daf07+'-'+_0x39e4ab+'/'+_0x3303ca)[_0x259f('0x16')](_0x333c38);}return null;};}function patchUpdates(_0x225d21){return function(_0x4d69c4){try{jsonpatch[_0x259f('0x1c')](_0x4d69c4,_0x225d21,!![]);}catch(_0x395a9e){return BPromise['reject'](_0x395a9e);}return _0x4d69c4['save']();};}function saveUpdates(_0x33b646,_0x3832b0){return function(_0x163d83){if(_0x163d83){return _0x163d83['update'](_0x33b646)[_0x259f('0x1d')](function(_0x55a58e){return _0x55a58e;});}return null;};}function removeEntity(_0xb78775,_0x55a9e0){return function(_0x42b578){if(_0x42b578){return _0x42b578[_0x259f('0x1e')]()[_0x259f('0x1d')](function(){_0xb78775[_0x259f('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x23079d,_0x4e3413){return function(_0x24de04){if(!_0x24de04){_0x23079d[_0x259f('0x1f')](0x194);}return _0x24de04;};}function handleError(_0x549d37,_0x47bf4b){_0x47bf4b=_0x47bf4b||0x1f4;return function(_0x208698){logger[_0x259f('0x20')](_0x208698['stack']);if(_0x208698[_0x259f('0x21')]){delete _0x208698[_0x259f('0x21')];}_0x549d37[_0x259f('0x14')](_0x47bf4b)[_0x259f('0x22')](_0x208698);};}exports['index']=function(_0x4c339b,_0x341635){var _0x47bf1e={},_0xc32493={},_0x14aef7={'count':0x0,'rows':[]};var _0x535b48=_[_0x259f('0x23')](db[_0x259f('0x24')][_0x259f('0x25')],function(_0x22ef0a){return{'name':_0x22ef0a[_0x259f('0x26')],'type':_0x22ef0a['type'][_0x259f('0x27')]};});_0xc32493[_0x259f('0x28')]=_[_0x259f('0x23')](_0x535b48,_0x259f('0x21'));_0xc32493[_0x259f('0x29')]=_[_0x259f('0x2a')](_0x4c339b[_0x259f('0x29')]);_0xc32493[_0x259f('0x2b')]=_[_0x259f('0x2c')](_0xc32493[_0x259f('0x28')],_0xc32493['query']);_0x47bf1e[_0x259f('0x2d')]=_[_0x259f('0x2c')](_0xc32493['model'],qs[_0x259f('0x2e')](_0x4c339b[_0x259f('0x29')][_0x259f('0x2e')]));_0x47bf1e[_0x259f('0x2d')]=_0x47bf1e[_0x259f('0x2d')][_0x259f('0x2f')]?_0x47bf1e[_0x259f('0x2d')]:_0xc32493[_0x259f('0x28')];if(!_0x4c339b[_0x259f('0x29')][_0x259f('0x30')](_0x259f('0x31'))){_0x47bf1e[_0x259f('0x19')]=qs[_0x259f('0x19')](_0x4c339b[_0x259f('0x29')][_0x259f('0x19')]);_0x47bf1e['offset']=qs[_0x259f('0x17')](_0x4c339b[_0x259f('0x29')][_0x259f('0x17')]);}_0x47bf1e[_0x259f('0x32')]=qs['sort'](_0x4c339b[_0x259f('0x29')][_0x259f('0x33')]);_0x47bf1e['where']=qs[_0x259f('0x2b')](_['pick'](_0x4c339b[_0x259f('0x29')],_0xc32493['filters']),_0x535b48);if(_0x4c339b['query']['filter']){_0x47bf1e[_0x259f('0x34')]=_['merge'](_0x47bf1e[_0x259f('0x34')],{'$or':_['map'](_0x535b48,function(_0x2732ea){if(_0x2732ea[_0x259f('0x35')]!==_0x259f('0x36')){var _0x1cd5c5={};_0x1cd5c5[_0x2732ea[_0x259f('0x21')]]={'$like':'%'+_0x4c339b[_0x259f('0x29')][_0x259f('0x37')]+'%'};return _0x1cd5c5;}})});}_0x47bf1e=_[_0x259f('0x38')]({},_0x47bf1e,_0x4c339b[_0x259f('0x39')]);var _0x122026={'where':_0x47bf1e[_0x259f('0x34')]};return db['DeskField']['count'](_0x122026)['then'](function(_0x3d402a){_0x14aef7[_0x259f('0x1a')]=_0x3d402a;if(_0x4c339b[_0x259f('0x29')][_0x259f('0x3a')]){_0x47bf1e[_0x259f('0x3b')]=[{'all':!![]}];}return db['DeskField'][_0x259f('0x3c')](_0x47bf1e);})[_0x259f('0x1d')](function(_0x5542a1){_0x14aef7[_0x259f('0x3d')]=_0x5542a1;return _0x14aef7;})[_0x259f('0x1d')](respondWithFilteredResult(_0x341635,_0x47bf1e))[_0x259f('0x3e')](handleError(_0x341635,null));};exports[_0x259f('0x3f')]=function(_0x4a01a8,_0xdc25a4){var _0x5ea1e3={'raw':!![],'where':{'id':_0x4a01a8['params']['id']}},_0x45774b={};_0x45774b[_0x259f('0x28')]=_['keys'](db[_0x259f('0x24')][_0x259f('0x25')]);_0x45774b[_0x259f('0x29')]=_[_0x259f('0x2a')](_0x4a01a8[_0x259f('0x29')]);_0x45774b[_0x259f('0x2b')]=_[_0x259f('0x2c')](_0x45774b['model'],_0x45774b[_0x259f('0x29')]);_0x5ea1e3[_0x259f('0x2d')]=_[_0x259f('0x2c')](_0x45774b[_0x259f('0x28')],qs[_0x259f('0x2e')](_0x4a01a8[_0x259f('0x29')]['fields']));_0x5ea1e3[_0x259f('0x2d')]=_0x5ea1e3[_0x259f('0x2d')][_0x259f('0x2f')]?_0x5ea1e3[_0x259f('0x2d')]:_0x45774b[_0x259f('0x28')];if(_0x4a01a8['query'][_0x259f('0x3a')]){_0x5ea1e3[_0x259f('0x3b')]=[{'all':!![]}];}_0x5ea1e3=_['merge']({},_0x5ea1e3,_0x4a01a8[_0x259f('0x39')]);return db[_0x259f('0x24')][_0x259f('0x40')](_0x5ea1e3)['then'](handleEntityNotFound(_0xdc25a4,null))[_0x259f('0x1d')](respondWithResult(_0xdc25a4,null))['catch'](handleError(_0xdc25a4,null));};exports['create']=function(_0xe4ff,_0x114461){return db[_0x259f('0x24')][_0x259f('0x41')](_0xe4ff[_0x259f('0x42')],{})['then'](respondWithResult(_0x114461,0xc9))[_0x259f('0x3e')](handleError(_0x114461,null));};exports['update']=function(_0x4f8446,_0x12bef4){if(_0x4f8446[_0x259f('0x42')]['id']){delete _0x4f8446[_0x259f('0x42')]['id'];}return db[_0x259f('0x24')][_0x259f('0x40')]({'where':{'id':_0x4f8446[_0x259f('0x43')]['id']}})[_0x259f('0x1d')](handleEntityNotFound(_0x12bef4,null))[_0x259f('0x1d')](saveUpdates(_0x4f8446[_0x259f('0x42')],null))[_0x259f('0x1d')](respondWithResult(_0x12bef4,null))[_0x259f('0x3e')](handleError(_0x12bef4,null));};exports['destroy']=function(_0x111ba5,_0x521a42){return db['DeskField']['find']({'where':{'id':_0x111ba5[_0x259f('0x43')]['id']}})[_0x259f('0x1d')](handleEntityNotFound(_0x521a42,null))[_0x259f('0x1d')](removeEntity(_0x521a42,null))[_0x259f('0x3e')](handleError(_0x521a42,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 421dbb8..05a4d2e 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 _0x9ed9=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','DeskField','int_desk_fields','desk_unique_index','idField','FieldId','lodash','util'];(function(_0x3b9382,_0x32d102){var _0x303c10=function(_0xd10b4){while(--_0xd10b4){_0x3b9382['push'](_0x3b9382['shift']());}};_0x303c10(++_0x32d102);}(_0x9ed9,0x148));var _0x99ed=function(_0x2e558b,_0x595f9c){_0x2e558b=_0x2e558b-0x0;var _0x156a8f=_0x9ed9[_0x2e558b];return _0x156a8f;};'use strict';var _=require(_0x99ed('0x0'));var util=require(_0x99ed('0x1'));var logger=require(_0x99ed('0x2'))(_0x99ed('0x3'));var moment=require('moment');var BPromise=require(_0x99ed('0x4'));var rp=require(_0x99ed('0x5'));var fs=require('fs');var path=require(_0x99ed('0x6'));var rimraf=require(_0x99ed('0x7'));var config=require(_0x99ed('0x8'));var attributes=require('./intDeskField.attributes');module[_0x99ed('0x9')]=function(_0x21a110,_0x4c4433){return _0x21a110['define'](_0x99ed('0xa'),attributes,{'tableName':_0x99ed('0xb'),'paranoid':![],'indexes':[{'name':_0x99ed('0xc'),'fields':[_0x99ed('0xd'),_0x99ed('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x08c0=['request-promise','rimraf','exports','define','desk_unique_index','idField','FieldId','lodash','util','api','moment','bluebird'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x08c0,0x14b));var _0x008c=function(_0x461a32,_0xbcf717){_0x461a32=_0x461a32-0x0;var _0x54957f=_0x08c0[_0x461a32];return _0x54957f;};'use strict';var _=require(_0x008c('0x0'));var util=require(_0x008c('0x1'));var logger=require('../../config/logger')(_0x008c('0x2'));var moment=require(_0x008c('0x3'));var BPromise=require(_0x008c('0x4'));var rp=require(_0x008c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x008c('0x6'));var config=require('../../config/environment');var attributes=require('./intDeskField.attributes');module[_0x008c('0x7')]=function(_0x3fbb46,_0x328c9e){return _0x3fbb46[_0x008c('0x8')]('DeskField',attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':_0x008c('0x9'),'fields':[_0x008c('0xa'),_0x008c('0xb')],'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 cbc53a4..5903117 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 _0x6a88=['request','then','debug','request\x20sent','stringify','error','code','DeskField,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','http'];(function(_0x42bafd,_0x3f0fe3){var _0x2ed705=function(_0x4311ea){while(--_0x4311ea){_0x42bafd['push'](_0x42bafd['shift']());}};_0x2ed705(++_0x3f0fe3);}(_0x6a88,0xdc));var _0x86a8=function(_0x1f96d7,_0x20d141){_0x1f96d7=_0x1f96d7-0x0;var _0x728705=_0x6a88[_0x1f96d7];return _0x728705;};'use strict';var _=require(_0x86a8('0x0'));var util=require(_0x86a8('0x1'));var moment=require('moment');var BPromise=require(_0x86a8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x86a8('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x86a8('0x4'));var logger=require(_0x86a8('0x5'))(_0x86a8('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x86a8('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3c1e21,_0x3270c3,_0x337d52){return new BPromise(function(_0x523479,_0x253fa6){return client[_0x86a8('0x8')](_0x3c1e21,_0x337d52)[_0x86a8('0x9')](function(_0x2dd509){logger['info']('DeskField,\x20%s,\x20%s',_0x3270c3,'request\x20sent');logger[_0x86a8('0xa')]('DeskField,\x20%s,\x20%s,\x20%s',_0x3270c3,_0x86a8('0xb'),JSON[_0x86a8('0xc')](_0x2dd509));if(_0x2dd509[_0x86a8('0xd')]){if(_0x2dd509[_0x86a8('0xd')][_0x86a8('0xe')]===0x1f4){logger['error'](_0x86a8('0xf'),_0x3270c3,_0x2dd509['error'][_0x86a8('0x10')]);return _0x253fa6(_0x2dd509[_0x86a8('0xd')][_0x86a8('0x10')]);}logger[_0x86a8('0xd')](_0x86a8('0xf'),_0x3270c3,_0x2dd509[_0x86a8('0xd')]['message']);return _0x523479(_0x2dd509[_0x86a8('0xd')]['message']);}else{logger['info'](_0x86a8('0xf'),_0x3270c3,_0x86a8('0xb'));_0x523479(_0x2dd509[_0x86a8('0x11')][_0x86a8('0x10')]);}})[_0x86a8('0x12')](function(_0x5b8f27){logger[_0x86a8('0xd')]('DeskField,\x20%s,\x20%s',_0x3270c3,_0x5b8f27);_0x253fa6(_0x5b8f27);});});} \ No newline at end of file +var _0xd6ce=['../../config/environment','http','request','then','info','DeskField,\x20%s,\x20%s','DeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x5dcd92,_0x1d29bd){var _0x106c3c=function(_0x2ee4e8){while(--_0x2ee4e8){_0x5dcd92['push'](_0x5dcd92['shift']());}};_0x106c3c(++_0x1d29bd);}(_0xd6ce,0xca));var _0xed6c=function(_0x28b887,_0x48b841){_0x28b887=_0x28b887-0x0;var _0x1e3629=_0xd6ce[_0x28b887];return _0x1e3629;};'use strict';var _=require('lodash');var util=require(_0xed6c('0x0'));var moment=require(_0xed6c('0x1'));var BPromise=require(_0xed6c('0x2'));var rs=require(_0xed6c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xed6c('0x4'))['db'];var utils=require(_0xed6c('0x5'));var logger=require(_0xed6c('0x6'))(_0xed6c('0x7'));var config=require(_0xed6c('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xed6c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5b87f3,_0x51b922,_0x3ade41){return new BPromise(function(_0x218030,_0x26fea9){return client[_0xed6c('0xa')](_0x5b87f3,_0x3ade41)[_0xed6c('0xb')](function(_0x210419){logger[_0xed6c('0xc')](_0xed6c('0xd'),_0x51b922,'request\x20sent');logger['debug'](_0xed6c('0xe'),_0x51b922,_0xed6c('0xf'),JSON[_0xed6c('0x10')](_0x210419));if(_0x210419['error']){if(_0x210419[_0xed6c('0x11')]['code']===0x1f4){logger[_0xed6c('0x11')](_0xed6c('0xd'),_0x51b922,_0x210419[_0xed6c('0x11')][_0xed6c('0x12')]);return _0x26fea9(_0x210419[_0xed6c('0x11')][_0xed6c('0x12')]);}logger[_0xed6c('0x11')]('DeskField,\x20%s,\x20%s',_0x51b922,_0x210419[_0xed6c('0x11')][_0xed6c('0x12')]);return _0x218030(_0x210419[_0xed6c('0x11')][_0xed6c('0x12')]);}else{logger[_0xed6c('0xc')](_0xed6c('0xd'),_0x51b922,_0xed6c('0xf'));_0x218030(_0x210419[_0xed6c('0x13')]['message']);}})[_0xed6c('0x14')](function(_0x21c568){logger[_0xed6c('0x11')](_0xed6c('0xd'),_0x51b922,_0x21c568);_0x26fea9(_0x21c568);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 4cadd4a..d01c6d8 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 _0x1e7b=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','delete','destroy','multer','util'];(function(_0x96602e,_0x3d75d4){var _0x5c004d=function(_0x1432ba){while(--_0x1432ba){_0x96602e['push'](_0x96602e['shift']());}};_0x5c004d(++_0x3d75d4);}(_0x1e7b,0xcd));var _0xb1e7=function(_0x4c5a52,_0x59ef62){_0x4c5a52=_0x4c5a52-0x0;var _0x5b40f5=_0x1e7b[_0x4c5a52];return _0x5b40f5;};'use strict';var multer=require(_0xb1e7('0x0'));var util=require(_0xb1e7('0x1'));var path=require(_0xb1e7('0x2'));var timeout=require(_0xb1e7('0x3'));var express=require(_0xb1e7('0x4'));var router=express[_0xb1e7('0x5')]();var fs_extra=require(_0xb1e7('0x6'));var auth=require(_0xb1e7('0x7'));var interaction=require(_0xb1e7('0x8'));var config=require(_0xb1e7('0x9'));var controller=require('./intDynamics365Account.controller');router[_0xb1e7('0xa')]('/',auth[_0xb1e7('0xb')](),controller['index']);router[_0xb1e7('0xa')](_0xb1e7('0xc'),auth[_0xb1e7('0xb')](),controller[_0xb1e7('0xd')]);router[_0xb1e7('0xa')](_0xb1e7('0xe'),auth[_0xb1e7('0xb')](),controller[_0xb1e7('0xf')]);router[_0xb1e7('0xa')](_0xb1e7('0x10'),auth[_0xb1e7('0xb')](),controller[_0xb1e7('0x11')]);router[_0xb1e7('0x12')]('/',auth[_0xb1e7('0xb')](),controller['create']);router['post'](_0xb1e7('0xe'),auth[_0xb1e7('0xb')](),controller[_0xb1e7('0x13')]);router[_0xb1e7('0x14')](_0xb1e7('0xc'),auth[_0xb1e7('0xb')](),controller['update']);router[_0xb1e7('0x15')](_0xb1e7('0xc'),auth[_0xb1e7('0xb')](),controller[_0xb1e7('0x16')]);module['exports']=router; \ No newline at end of file +var _0x3c6c=['./intDynamics365Account.controller','get','index','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','post','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x3c6c,0x116));var _0xc3c6=function(_0x37d228,_0x47cffa){_0x37d228=_0x37d228-0x0;var _0x9e8635=_0x3c6c[_0x37d228];return _0x9e8635;};'use strict';var multer=require(_0xc3c6('0x0'));var util=require(_0xc3c6('0x1'));var path=require('path');var timeout=require(_0xc3c6('0x2'));var express=require(_0xc3c6('0x3'));var router=express[_0xc3c6('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xc3c6('0x5'));var interaction=require(_0xc3c6('0x6'));var config=require(_0xc3c6('0x7'));var controller=require(_0xc3c6('0x8'));router[_0xc3c6('0x9')]('/',auth['isAuthenticated'](),controller[_0xc3c6('0xa')]);router['get'](_0xc3c6('0xb'),auth[_0xc3c6('0xc')](),controller[_0xc3c6('0xd')]);router['get'](_0xc3c6('0xe'),auth[_0xc3c6('0xc')](),controller[_0xc3c6('0xf')]);router[_0xc3c6('0x9')](_0xc3c6('0x10'),auth[_0xc3c6('0xc')](),controller['getFields']);router[_0xc3c6('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc3c6('0x11')]('/:id/configurations',auth['isAuthenticated'](),controller['addConfiguration']);router['put']('/:id',auth['isAuthenticated'](),controller[_0xc3c6('0x12')]);router[_0xc3c6('0x13')](_0xc3c6('0xb'),auth[_0xc3c6('0xc')](),controller[_0xc3c6('0x14')]);module[_0xc3c6('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index de36949..df4c74e 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 _0xf698=['STRING','BOOLEAN','sequelize','exports'];(function(_0x2bc0e1,_0x3a7941){var _0x34a615=function(_0x2fab0e){while(--_0x2fab0e){_0x2bc0e1['push'](_0x2bc0e1['shift']());}};_0x34a615(++_0x3a7941);}(_0xf698,0x1de));var _0x8f69=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xf698[_0x4fc9e6];return _0x551d28;};'use strict';var Sequelize=require(_0x8f69('0x0'));module[_0x8f69('0x1')]={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x8f69('0x2')]},'password':{'type':Sequelize[_0x8f69('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize[_0x8f69('0x2')]},'clientId':{'type':Sequelize[_0x8f69('0x2')]},'clientSecret':{'type':Sequelize[_0x8f69('0x2')]},'serverUrl':{'type':Sequelize[_0x8f69('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize[_0x8f69('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0xd5da=['exports','STRING','BOOLEAN','sequelize'];(function(_0x5887ce,_0x1bfde4){var _0x453dc1=function(_0xb7c6ce){while(--_0xb7c6ce){_0x5887ce['push'](_0x5887ce['shift']());}};_0x453dc1(++_0x1bfde4);}(_0xd5da,0x9f));var _0xad5d=function(_0x54a392,_0x28d6e2){_0x54a392=_0x54a392-0x0;var _0x4d9ed2=_0xd5da[_0x54a392];return _0x4d9ed2;};'use strict';var Sequelize=require(_0xad5d('0x0'));module[_0xad5d('0x1')]={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xad5d('0x2')]},'password':{'type':Sequelize[_0xad5d('0x2')]},'remoteUri':{'type':Sequelize[_0xad5d('0x2')]},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xad5d('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xad5d('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xad5d('0x2')]},'modernAuthentication':{'type':Sequelize[_0xad5d('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 1120fcc..35f8c57 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 _0xbc92=['../../mysqldb','../../components/integrations/configuration','status','json','offset','undefined','limit','count','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','Dynamics365Account','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','findAll','rows','params','rawAttributes','include','find','catch','create','body','findOne','Dynamics365Configuration','pick','getConfigurations','hasOwnProperty','AccountId','getSubjects','channel','Dynamics365Field','lastIndexOf','format','ticketType','incident','Incident','PhoneCall','title','customerid','caseorigincode','subject','phonenumber','directioncode','accountidname','contractdetailidname','createdbyname','createdbyyominame','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','influencescore','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedonbehalfbyname','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','productidname','productserialnumber','resolveby','resolvebykpiidname','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','statecode','statuscode','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','concat','username','password','remoteUri','tenantId','data5','data7','modernAuthentication','access_token','CloudProvider','POST','/oauth2/token','clientId','clientSecret','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','remove','includes','LogicalName','forEach','@odata.type','substring','PicklistAttributeMetadata','push','all','isNil','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','DecimalAttributeMetadata','test','statusCode','Wrong\x20credentials',')/Attributes(','OptionSet','Label','UserLocalizedLabel','Value','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','true','FalseOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','request-promise','util','lodash','../../components/parsers/qs','../../config/logger','api'];(function(_0x1dc536,_0x42cd87){var _0x50b2c8=function(_0x1f630c){while(--_0x1f630c){_0x1dc536['push'](_0x1dc536['shift']());}};_0x50b2c8(++_0x42cd87);}(_0xbc92,0xb0));var _0x2bc9=function(_0x3cb3ca,_0x44d697){_0x3cb3ca=_0x3cb3ca-0x0;var _0x214366=_0xbc92[_0x3cb3ca];return _0x214366;};'use strict';var rp=require(_0x2bc9('0x0'));var util=require(_0x2bc9('0x1'));var _=require(_0x2bc9('0x2'));var qs=require(_0x2bc9('0x3'));var logger=require(_0x2bc9('0x4'))(_0x2bc9('0x5'));var db=require(_0x2bc9('0x6'))['db'];var integrations=require(_0x2bc9('0x7'));function respondWithResult(_0x224183,_0x42a292){_0x42a292=_0x42a292||0xc8;return function(_0x2a6a23){if(_0x2a6a23){return _0x224183[_0x2bc9('0x8')](_0x42a292)[_0x2bc9('0x9')](_0x2a6a23);}};}function respondWithFilteredResult(_0x13a8c2,_0x465a04){return function(_0x1eeb51){if(_0x1eeb51){var _0x4957c1=typeof _0x465a04[_0x2bc9('0xa')]===_0x2bc9('0xb')&&typeof _0x465a04[_0x2bc9('0xc')]===_0x2bc9('0xb');var _0xcbbbbb=_0x1eeb51[_0x2bc9('0xd')];var _0x764b06=_0x4957c1?0x0:_0x465a04[_0x2bc9('0xa')];var _0x3e49ad=_0x4957c1?_0x1eeb51['count']:_0x465a04[_0x2bc9('0xa')]+_0x465a04['limit'];var _0x3fa565;if(_0x3e49ad>=_0xcbbbbb){_0x3e49ad=_0xcbbbbb;_0x3fa565=0xc8;}else{_0x3fa565=0xce;}_0x13a8c2[_0x2bc9('0x8')](_0x3fa565);return _0x13a8c2['set']('Content-Range',_0x764b06+'-'+_0x3e49ad+'/'+_0xcbbbbb)[_0x2bc9('0x9')](_0x1eeb51);}return null;};}function saveUpdates(_0x5ec4b6){return function(_0x413a00){if(_0x413a00){return _0x413a00[_0x2bc9('0xe')](_0x5ec4b6)[_0x2bc9('0xf')](function(_0x314250){return _0x314250;});}return null;};}function removeEntity(_0x1f481a){return function(_0x5f5236){if(_0x5f5236){return _0x5f5236[_0x2bc9('0x10')]()[_0x2bc9('0xf')](function(){_0x1f481a[_0x2bc9('0x8')](0xcc)[_0x2bc9('0x11')]();});}};}function handleEntityNotFound(_0x5a00bf){return function(_0x51f652){if(!_0x51f652){_0x5a00bf[_0x2bc9('0x12')](0x194);}return _0x51f652;};}function handleError(_0x5225c3,_0x542039){_0x542039=_0x542039||0x1f4;return function(_0x5eaede){logger[_0x2bc9('0x13')](_0x5eaede[_0x2bc9('0x14')]);if(_0x5eaede['name']){delete _0x5eaede[_0x2bc9('0x15')];}_0x5225c3[_0x2bc9('0x8')](_0x542039)[_0x2bc9('0x16')](_0x5eaede);};}exports[_0x2bc9('0x17')]=function(_0x194c26,_0x42b325){var _0x3a94eb={},_0x28ff78={},_0x40f064={'count':0x0,'rows':[]};var _0x5c9cf2=_[_0x2bc9('0x18')](db[_0x2bc9('0x19')]['rawAttributes'],function(_0x2ae20b){return{'name':_0x2ae20b[_0x2bc9('0x1a')],'type':_0x2ae20b[_0x2bc9('0x1b')][_0x2bc9('0x1c')]};});_0x28ff78['model']=_['map'](_0x5c9cf2,_0x2bc9('0x15'));_0x28ff78[_0x2bc9('0x1d')]=_[_0x2bc9('0x1e')](_0x194c26[_0x2bc9('0x1d')]);_0x28ff78[_0x2bc9('0x1f')]=_[_0x2bc9('0x20')](_0x28ff78[_0x2bc9('0x21')],_0x28ff78[_0x2bc9('0x1d')]);_0x3a94eb[_0x2bc9('0x22')]=_['intersection'](_0x28ff78['model'],qs[_0x2bc9('0x23')](_0x194c26[_0x2bc9('0x1d')]['fields']));_0x3a94eb[_0x2bc9('0x22')]=_0x3a94eb[_0x2bc9('0x22')][_0x2bc9('0x24')]?_0x3a94eb[_0x2bc9('0x22')]:_0x28ff78[_0x2bc9('0x21')];if(!_0x194c26['query']['hasOwnProperty'](_0x2bc9('0x25'))){_0x3a94eb[_0x2bc9('0xc')]=qs[_0x2bc9('0xc')](_0x194c26['query'][_0x2bc9('0xc')]);_0x3a94eb[_0x2bc9('0xa')]=qs[_0x2bc9('0xa')](_0x194c26['query'][_0x2bc9('0xa')]);}_0x3a94eb[_0x2bc9('0x26')]=qs[_0x2bc9('0x27')](_0x194c26[_0x2bc9('0x1d')]['sort']);_0x3a94eb[_0x2bc9('0x28')]=qs['filters'](_['pick'](_0x194c26['query'],_0x28ff78[_0x2bc9('0x1f')]),_0x5c9cf2);if(_0x194c26[_0x2bc9('0x1d')][_0x2bc9('0x29')]){_0x3a94eb[_0x2bc9('0x28')]=_['merge'](_0x3a94eb[_0x2bc9('0x28')],{'$or':_[_0x2bc9('0x18')](_0x5c9cf2,function(_0x2d4a75){if(_0x2d4a75[_0x2bc9('0x1b')]!==_0x2bc9('0x2a')){var _0x38ab89={};_0x38ab89[_0x2d4a75[_0x2bc9('0x15')]]={'$like':'%'+_0x194c26[_0x2bc9('0x1d')][_0x2bc9('0x29')]+'%'};return _0x38ab89;}})});}_0x3a94eb=_[_0x2bc9('0x2b')]({},_0x3a94eb,_0x194c26[_0x2bc9('0x2c')]);var _0x212ddd={'where':_0x3a94eb[_0x2bc9('0x28')]};return db[_0x2bc9('0x19')][_0x2bc9('0xd')](_0x212ddd)['then'](function(_0x1cfbe3){_0x40f064[_0x2bc9('0xd')]=_0x1cfbe3;if(_0x194c26[_0x2bc9('0x1d')][_0x2bc9('0x2d')]){_0x3a94eb['include']=[{'all':!![]}];}return db[_0x2bc9('0x19')][_0x2bc9('0x2e')](_0x3a94eb);})['then'](function(_0x51de34){_0x40f064[_0x2bc9('0x2f')]=_0x51de34;return _0x40f064;})[_0x2bc9('0xf')](respondWithFilteredResult(_0x42b325,_0x3a94eb))['catch'](handleError(_0x42b325,null));};exports['show']=function(_0x37f4ba,_0x1b49c1){var _0x4dbf13={'raw':![],'where':{'id':_0x37f4ba[_0x2bc9('0x30')]['id']}},_0x15036c={};_0x15036c[_0x2bc9('0x21')]=_[_0x2bc9('0x1e')](db['Dynamics365Account'][_0x2bc9('0x31')]);_0x15036c[_0x2bc9('0x1d')]=_[_0x2bc9('0x1e')](_0x37f4ba['query']);_0x15036c[_0x2bc9('0x1f')]=_[_0x2bc9('0x20')](_0x15036c[_0x2bc9('0x21')],_0x15036c[_0x2bc9('0x1d')]);_0x4dbf13[_0x2bc9('0x22')]=_[_0x2bc9('0x20')](_0x15036c[_0x2bc9('0x21')],qs[_0x2bc9('0x23')](_0x37f4ba['query'][_0x2bc9('0x23')]));_0x4dbf13[_0x2bc9('0x22')]=_0x4dbf13[_0x2bc9('0x22')][_0x2bc9('0x24')]?_0x4dbf13[_0x2bc9('0x22')]:_0x15036c[_0x2bc9('0x21')];if(_0x37f4ba[_0x2bc9('0x1d')][_0x2bc9('0x2d')]){_0x4dbf13[_0x2bc9('0x32')]=[{'all':!![]}];}_0x4dbf13=_['merge']({},_0x4dbf13,_0x37f4ba[_0x2bc9('0x2c')]);return db[_0x2bc9('0x19')][_0x2bc9('0x33')](_0x4dbf13)[_0x2bc9('0xf')](handleEntityNotFound(_0x1b49c1,null))[_0x2bc9('0xf')](respondWithResult(_0x1b49c1,null))[_0x2bc9('0x34')](handleError(_0x1b49c1,null));};exports[_0x2bc9('0x35')]=function(_0x5337ce,_0x7431c3){return db[_0x2bc9('0x19')][_0x2bc9('0x35')](_0x5337ce[_0x2bc9('0x36')],{})[_0x2bc9('0xf')](respondWithResult(_0x7431c3,0xc9))[_0x2bc9('0x34')](handleError(_0x7431c3,null));};exports['update']=function(_0x3e3363,_0x4c44de){if(_0x3e3363[_0x2bc9('0x36')]['id']){delete _0x3e3363[_0x2bc9('0x36')]['id'];}return db['Dynamics365Account']['find']({'where':{'id':_0x3e3363['params']['id']}})[_0x2bc9('0xf')](handleEntityNotFound(_0x4c44de,null))['then'](saveUpdates(_0x3e3363[_0x2bc9('0x36')],null))[_0x2bc9('0xf')](respondWithResult(_0x4c44de,null))['catch'](handleError(_0x4c44de,null));};exports[_0x2bc9('0x10')]=function(_0x208389,_0x37c156){return db[_0x2bc9('0x19')][_0x2bc9('0x33')]({'where':{'id':_0x208389['params']['id']}})[_0x2bc9('0xf')](handleEntityNotFound(_0x37c156,null))[_0x2bc9('0xf')](removeEntity(_0x37c156,null))[_0x2bc9('0x34')](handleError(_0x37c156,null));};exports['getConfigurations']=function(_0x4a98a4,_0x57e1fb){var _0x470f91={};var _0x55237f={};var _0x57b86b;var _0x2ab28e;return db[_0x2bc9('0x19')][_0x2bc9('0x37')]({'where':{'id':_0x4a98a4['params']['id']}})['then'](handleEntityNotFound(_0x57e1fb,null))['then'](function(_0x22e71d){if(_0x22e71d){_0x57b86b=_0x22e71d;_0x55237f['model']=_[_0x2bc9('0x1e')](db[_0x2bc9('0x38')]['rawAttributes']);_0x55237f[_0x2bc9('0x1d')]=_[_0x2bc9('0x1e')](_0x4a98a4[_0x2bc9('0x1d')]);_0x55237f['filters']=_['intersection'](_0x55237f[_0x2bc9('0x21')],_0x55237f[_0x2bc9('0x1d')]);_0x470f91[_0x2bc9('0x22')]=_[_0x2bc9('0x20')](_0x55237f['model'],qs[_0x2bc9('0x23')](_0x4a98a4[_0x2bc9('0x1d')][_0x2bc9('0x23')]));_0x470f91[_0x2bc9('0x22')]=_0x470f91[_0x2bc9('0x22')][_0x2bc9('0x24')]?_0x470f91[_0x2bc9('0x22')]:_0x55237f[_0x2bc9('0x21')];_0x470f91[_0x2bc9('0x26')]=qs[_0x2bc9('0x27')](_0x4a98a4[_0x2bc9('0x1d')][_0x2bc9('0x27')]);_0x470f91[_0x2bc9('0x28')]=qs['filters'](_[_0x2bc9('0x39')](_0x4a98a4[_0x2bc9('0x1d')],_0x55237f[_0x2bc9('0x1f')]));if(_0x4a98a4[_0x2bc9('0x1d')][_0x2bc9('0x29')]){_0x470f91['where']=_[_0x2bc9('0x2b')](_0x470f91[_0x2bc9('0x28')],{'$or':_[_0x2bc9('0x18')](_0x470f91[_0x2bc9('0x22')],function(_0x466756){var _0x3355d0={};_0x3355d0[_0x466756]={'$like':'%'+_0x4a98a4[_0x2bc9('0x1d')]['filter']+'%'};return _0x3355d0;})});}_0x470f91=_[_0x2bc9('0x2b')]({},_0x470f91,_0x4a98a4[_0x2bc9('0x2c')]);return _0x57b86b[_0x2bc9('0x3a')](_0x470f91);}})[_0x2bc9('0xf')](function(_0x1dc21f){if(_0x1dc21f){_0x2ab28e=_0x1dc21f[_0x2bc9('0x24')];if(!_0x4a98a4[_0x2bc9('0x1d')][_0x2bc9('0x3b')](_0x2bc9('0x25'))){_0x470f91['limit']=qs[_0x2bc9('0xc')](_0x4a98a4[_0x2bc9('0x1d')][_0x2bc9('0xc')]);_0x470f91['offset']=qs[_0x2bc9('0xa')](_0x4a98a4['query'][_0x2bc9('0xa')]);}return _0x57b86b[_0x2bc9('0x3a')](_0x470f91);}})[_0x2bc9('0xf')](function(_0x561d99){if(_0x561d99){return _0x561d99?{'count':_0x2ab28e,'rows':_0x561d99}:null;}})[_0x2bc9('0xf')](respondWithResult(_0x57e1fb,null))[_0x2bc9('0x34')](handleError(_0x57e1fb,null));};exports['addConfiguration']=function(_0x24aee9,_0x10000a){if(_0x24aee9['body']['id']){delete _0x24aee9['body']['id'];}return db[_0x2bc9('0x19')]['findOne']({'where':{'id':_0x24aee9[_0x2bc9('0x30')]['id']}})[_0x2bc9('0xf')](handleEntityNotFound(_0x10000a,null))[_0x2bc9('0xf')](function(_0xc1ed7e){if(_0xc1ed7e){_0x24aee9['body'][_0x2bc9('0x3c')]=_0xc1ed7e['id'];_0x24aee9['body']['Subjects']=integrations[_0x2bc9('0x3d')](_0x24aee9['body'][_0x2bc9('0x3e')],_0x24aee9[_0x2bc9('0x36')][_0x2bc9('0x1b')]);_0x24aee9[_0x2bc9('0x36')]['Descriptions']=integrations['getDescriptions'](_0x24aee9[_0x2bc9('0x36')][_0x2bc9('0x3e')],_0x24aee9[_0x2bc9('0x36')][_0x2bc9('0x1b')]);return db['Dynamics365Configuration'][_0x2bc9('0x35')](_0x24aee9[_0x2bc9('0x36')],{'include':[{'model':db[_0x2bc9('0x3f')],'as':'Subjects'},{'model':db[_0x2bc9('0x3f')],'as':'Descriptions'}]});}return null;})[_0x2bc9('0xf')](respondWithResult(_0x10000a,null))[_0x2bc9('0x34')](handleError(_0x10000a,null));};function sanitizeRemoteUri(_0xd8de0c){var _0x8d0a50=_0xd8de0c['slice'](-0x1);if(_0x8d0a50==='/')return _0xd8de0c['substring'](0x0,_0xd8de0c[_0x2bc9('0x40')](_0x8d0a50));return _0xd8de0c;}function getWebApiUrl(_0x154737){return util[_0x2bc9('0x41')]('%s/api/data/v9.0/',_0x154737);}exports['getFields']=function(_0x12b929,_0x3896c4){var _0x1d8e83=_0x12b929[_0x2bc9('0x1d')][_0x2bc9('0x42')];var _0x11ee75=_0x1d8e83===_0x2bc9('0x43')?_0x2bc9('0x44'):_0x2bc9('0x45');var _0x9de598='';var _0x34dd2f='';var _0xcdf47a='';var _0x295959='';var _0x30ac4f='';var _0x220296='';var _0x44ee27='';var _0x32600a='';var _0x4e2315=[_0x2bc9('0x46'),'description',_0x2bc9('0x47'),'ownerid',_0x2bc9('0x48'),_0x2bc9('0x49'),_0x2bc9('0x4a'),'regardingobjectid',_0x2bc9('0x4b'),'phonecall_activity_parties'];var _0x168904=[_0x2bc9('0x4c'),'accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame',_0x2bc9('0x4d'),'contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame',_0x2bc9('0x4e'),_0x2bc9('0x4f'),'createdon',_0x2bc9('0x50'),_0x2bc9('0x51'),_0x2bc9('0x52'),_0x2bc9('0x53'),_0x2bc9('0x54'),_0x2bc9('0x55'),_0x2bc9('0x56'),_0x2bc9('0x57'),_0x2bc9('0x58'),_0x2bc9('0x59'),_0x2bc9('0x5a'),_0x2bc9('0x5b'),_0x2bc9('0x5c'),'importsequencenumber',_0x2bc9('0x5d'),'kbarticleidname',_0x2bc9('0x5e'),_0x2bc9('0x5f'),_0x2bc9('0x60'),_0x2bc9('0x61'),_0x2bc9('0x62'),'modifiedbyyominame','modifiedon',_0x2bc9('0x63'),'modifiedonbehalfbyyominame','msdyn_incidenttypename',_0x2bc9('0x64'),_0x2bc9('0x65'),_0x2bc9('0x66'),_0x2bc9('0x67'),_0x2bc9('0x68'),_0x2bc9('0x69'),_0x2bc9('0x6a'),_0x2bc9('0x6b'),_0x2bc9('0x6c'),_0x2bc9('0x6d'),'prioritycodename',_0x2bc9('0x6e'),_0x2bc9('0x6f'),_0x2bc9('0x70'),_0x2bc9('0x71'),'responseby',_0x2bc9('0x72'),_0x2bc9('0x73'),_0x2bc9('0x74'),_0x2bc9('0x75'),'slaname','socialprofileidname',_0x2bc9('0x76'),_0x2bc9('0x77'),'subjectidname','ticketnumber',_0x2bc9('0x78'),_0x2bc9('0x79'),_0x2bc9('0x7a'),_0x2bc9('0x7b'),_0x2bc9('0x7c')];var _0x5239b3=_0x4e2315[_0x2bc9('0x7d')](_0x168904);return db[_0x2bc9('0x19')][_0x2bc9('0x37')]({'where':{'id':_0x12b929[_0x2bc9('0x30')]['id']},'attributes':['id',_0x2bc9('0x7e'),_0x2bc9('0x7f'),_0x2bc9('0x80'),_0x2bc9('0x81'),'clientId','clientSecret','modernAuthentication'],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','attributes':['id',_0x2bc9('0x82'),_0x2bc9('0x83')]}]})[_0x2bc9('0xf')](handleEntityNotFound(_0x3896c4,null))[_0x2bc9('0xf')](function(_0x56bc0a){if(_0x56bc0a){if(_0x56bc0a[_0x2bc9('0x84')]){_0x56bc0a[_0x2bc9('0x85')]=_0x56bc0a['CloudProvider']['data5'];_0x32600a=sanitizeRemoteUri(_0x56bc0a[_0x2bc9('0x86')]['data7']);_0x44ee27=getWebApiUrl(_0x32600a);return _0x56bc0a;}_0x32600a=sanitizeRemoteUri(_0x56bc0a['remoteUri']);_0x44ee27=getWebApiUrl(_0x32600a);var _0x3fd6fb={'method':_0x2bc9('0x87'),'uri':'https://login.microsoftonline.com/'+_0x56bc0a[_0x2bc9('0x81')]+_0x2bc9('0x88'),'form':{'client_id':_0x56bc0a[_0x2bc9('0x89')],'resource':_0x32600a,'username':_0x56bc0a['username'],'password':_0x56bc0a[_0x2bc9('0x7f')],'grant_type':_0x2bc9('0x7f'),'client_secret':_0x56bc0a[_0x2bc9('0x8a')]},'json':!![]};return rp(_0x3fd6fb);}})[_0x2bc9('0xf')](function(_0x240efa){_0x220296=_0x240efa['access_token'];var _0x363e1e={'method':_0x2bc9('0x8b'),'uri':encodeURI(_0x44ee27+_0x2bc9('0x8c')+_0x11ee75+'\x27'),'headers':{'Authorization':_0x2bc9('0x8d')+_0x220296,'If-None-Match':null,'OData-Version':_0x2bc9('0x8e')},'json':!![]};return rp(_0x363e1e);})['then'](function(_0xdfb6ef){var _0x507204=_0xdfb6ef[_0x2bc9('0x8f')][0x0];var _0x40edc2=_0x507204[_0x2bc9('0x90')];var _0x3a52bc={'method':_0x2bc9('0x8b'),'uri':_0x44ee27+_0x2bc9('0x91')+_0x40edc2+_0x2bc9('0x92'),'headers':{'Authorization':_0x2bc9('0x8d')+_0x220296,'If-None-Match':null,'OData-Version':_0x2bc9('0x8e')},'json':!![]};return rp(_0x3a52bc);})[_0x2bc9('0xf')](function(_0x4d8737){_0x9de598=_0x4d8737;_0x34dd2f=_0x9de598['Attributes'];_0x34dd2f=_[_0x2bc9('0x93')](_0x34dd2f,function(_0x2c0867){return!_0x5239b3[_0x2bc9('0x94')](_0x2c0867[_0x2bc9('0x95')]);});var _0x24eb63=[];var _0x53856f=[];_0x34dd2f[_0x2bc9('0x96')](function(_0x1a1430){if(_0x1a1430['@odata.type']){var _0x423b76=_0x1a1430[_0x2bc9('0x97')][_0x2bc9('0x98')](_0x1a1430[_0x2bc9('0x97')][_0x2bc9('0x40')]('.')+0x1);if(_0x423b76===_0x2bc9('0x99')){_0x24eb63[_0x2bc9('0x9a')](getSelectList(_0x44ee27,_0x1d8e83,_0x53856f,_0x9de598[_0x2bc9('0x90')],_0x1a1430[_0x2bc9('0x90')],_0x220296));}}});return Promise[_0x2bc9('0x9b')](_0x24eb63);})['then'](function(_0x3aa696){_0xcdf47a=_0x3aa696[0x0];var _0x367ef3=[];var _0x54f3bd=[];_0x34dd2f['forEach'](function(_0x44436a){if(!_[_0x2bc9('0x9c')](_0x44436a[_0x2bc9('0x97')])){var _0x27e7d0=_0x44436a[_0x2bc9('0x97')][_0x2bc9('0x98')](_0x44436a[_0x2bc9('0x97')][_0x2bc9('0x40')]('.')+0x1);if(_0x27e7d0===_0x2bc9('0x9d')){_0x367ef3['push'](getBooleanList(_0x44ee27,_0x1d8e83,_0x54f3bd,_0x9de598[_0x2bc9('0x90')],_0x44436a['MetadataId'],_0x220296));}}});return Promise[_0x2bc9('0x9b')](_0x367ef3);})[_0x2bc9('0xf')](function(_0x4f3707){_0x295959=_0x4f3707[0x0];var _0x4eab2c=[];var _0x392830=[];_0x34dd2f[_0x2bc9('0x96')](function(_0x6d794){if(_0x6d794[_0x2bc9('0x97')]){var _0x51946b=_0x6d794[_0x2bc9('0x97')]['substring'](_0x6d794['@odata.type']['lastIndexOf']('.')+0x1);if(_0x51946b===_0x2bc9('0x9e')||_0x51946b===_0x2bc9('0x9f')||_0x51946b===_0x2bc9('0xa0')||_0x51946b===_0x2bc9('0xa1')||_0x51946b===_0x2bc9('0xa2')||_0x51946b===_0x2bc9('0xa3')||_0x51946b===_0x2bc9('0xa4')||_0x51946b===_0x2bc9('0xa5')||_0x51946b==='StateAttributeMetadata'||_0x51946b===_0x2bc9('0xa6')){_0x4eab2c[_0x2bc9('0x9a')](getInputList(_0x44ee27,_0x1d8e83,_0x51946b,_0x392830,_0x9de598[_0x2bc9('0x90')],_0x6d794[_0x2bc9('0x90')],_0x220296));}}});return Promise[_0x2bc9('0x9b')](_0x4eab2c);})[_0x2bc9('0xf')](function(_0x2f52c7){_0x30ac4f=_0x2f52c7[0x0];var _0x17edb0=_0xcdf47a['concat'](_0x295959)[_0x2bc9('0x7d')](_0x30ac4f);var _0x280e3a={'count':_0x17edb0['length'],'rows':_0x17edb0};return _0x280e3a;})['then'](respondWithResult(_0x3896c4,null))[_0x2bc9('0x34')](function(_0x2371a2){var _0x338fba=_0x12b929[_0x2bc9('0x1d')][_0x2bc9('0xa7')]?0x1f4:_0x2371a2[_0x2bc9('0xa8')]||0x1f4;logger[_0x2bc9('0x13')](_0x2371a2[_0x2bc9('0x14')]);delete _0x2371a2[_0x2bc9('0x15')];if(_0x338fba===0x191){_0x338fba=0x190;}_0x3896c4[_0x2bc9('0x8')](_0x338fba)[_0x2bc9('0x16')](_0x12b929[_0x2bc9('0x1d')]['test']?{'message':_0x2bc9('0xa9'),'statusCode':_0x2371a2['statusCode']}:_0x2371a2);});};function getSelectList(_0x5b92b6,_0x2de4ee,_0x112e46,_0x32c856,_0xbb5446,_0x22fe19){var _0x451678={'method':_0x2bc9('0x8b'),'uri':_0x5b92b6+_0x2bc9('0x91')+_0x32c856+_0x2bc9('0xaa')+_0xbb5446+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':_0x2bc9('0x8d')+_0x22fe19,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x451678)['then'](function(_0x17f008){var _0xc2119c=[];var _0x16bdfe=_0x17f008[_0x2bc9('0xab')]['Options'];_0x16bdfe['forEach'](function(_0x21208b){_0xc2119c[_0x2bc9('0x9a')]({'name':_0x21208b[_0x2bc9('0xac')][_0x2bc9('0xad')][_0x2bc9('0xac')],'value':String(_0x21208b[_0x2bc9('0xae')])});});var _0x825219={'id':_0x2de4ee+'_'+_0x17f008[_0x2bc9('0x95')],'name':_0x17f008[_0x2bc9('0xaf')]['UserLocalizedLabel']['Label'],'custom':![],'options':_0xc2119c};_0x112e46[_0x2bc9('0x9a')](_0x825219);return _0x112e46;});}function getBooleanList(_0x585f63,_0xd35cb8,_0x57d138,_0x1f55c,_0x202c26,_0x14e630){var _0x18eeae={'method':'GET','uri':_0x585f63+'EntityDefinitions('+_0x1f55c+')/Attributes('+_0x202c26+_0x2bc9('0xb0'),'headers':{'Authorization':_0x2bc9('0x8d')+_0x14e630,'If-None-Match':null,'OData-Version':_0x2bc9('0x8e')},'json':!![]};return rp(_0x18eeae)[_0x2bc9('0xf')](function(_0x30c14b){var _0x2cdfe5=[];_0x2cdfe5['push']({'name':_0x30c14b[_0x2bc9('0xab')]['TrueOption'][_0x2bc9('0xac')][_0x2bc9('0xad')][_0x2bc9('0xac')],'value':_0x2bc9('0xb1')},{'name':_0x30c14b[_0x2bc9('0xab')][_0x2bc9('0xb2')][_0x2bc9('0xac')][_0x2bc9('0xad')][_0x2bc9('0xac')],'value':_0x2bc9('0xb3')});var _0x36f299={'id':_0xd35cb8+'_'+_0x30c14b[_0x2bc9('0x95')],'name':_0x30c14b[_0x2bc9('0xaf')][_0x2bc9('0xad')][_0x2bc9('0xac')],'custom':![],'options':_0x2cdfe5};_0x57d138[_0x2bc9('0x9a')](_0x36f299);return _0x57d138;});}function getInputList(_0x1f5f62,_0x198a34,_0x33ffd1,_0x47a386,_0x4802b5,_0x58d017,_0x4db755){var _0x3f2f41={'method':_0x2bc9('0x8b'),'uri':_0x1f5f62+_0x2bc9('0x91')+_0x4802b5+_0x2bc9('0xaa')+_0x58d017+_0x2bc9('0xb4')+_0x33ffd1+_0x2bc9('0xb5'),'headers':{'Authorization':'Bearer\x20'+_0x4db755,'If-None-Match':null,'OData-Version':_0x2bc9('0x8e')},'json':!![]};return rp(_0x3f2f41)[_0x2bc9('0xf')](function(_0x3fc82b){var _0x5db55d={'id':_0x198a34+'_'+_0x3fc82b[_0x2bc9('0x95')],'name':_0x3fc82b[_0x2bc9('0xaf')][_0x2bc9('0xad')]?_0x3fc82b[_0x2bc9('0xaf')]['UserLocalizedLabel']['Label']:_0x3fc82b['LogicalName'],'custom':![],'options':[]};_0x47a386['push'](_0x5db55d);return _0x47a386;});} \ No newline at end of file +var _0x5433=['intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','rows','show','includeAll','find','create','catch','update','body','params','findOne','Dynamics365Configuration','getConfigurations','AccountId','Subjects','channel','Descriptions','getDescriptions','Dynamics365Field','slice','lastIndexOf','format','%s/api/data/v9.0/','getFields','ticketType','Incident','title','description','customerid','ownerid','caseorigincode','subject','regardingobjectid','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyyominame','createdbyyominame','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridyominame','emailaddress','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','influencescore','kbarticleidname','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','onholdtime','overriddencreatedon','owneridname','owneridtype','owneridyominame','primarycontactidname','primarycontactidyominame','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slaname','statuscode','subjectidname','timezoneruleversionnumber','traversedpath','utcconversiontimezonecode','username','password','remoteUri','tenantId','clientId','clientSecret','CloudProvider','data5','modernAuthentication','access_token','data7','POST','https://login.microsoftonline.com/','/oauth2/token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','value','MetadataId',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','4.0','remove','forEach','@odata.type','substring','push','all','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','concat','statusCode','error','send','Wrong\x20credentials','EntityDefinitions(',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','Bearer\x20','Options','UserLocalizedLabel','Label','Value','LogicalName','DisplayName','OptionSet','TrueOption','true','FalseOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','request-promise','util','lodash','../../components/parsers/qs','../../config/logger','api','../../components/integrations/configuration','status','json','offset','limit','undefined','count','set','Content-Range','then','destroy','end','stack','name','index','map','Dynamics365Account','rawAttributes','fieldName','type','model','query','keys','filters'];(function(_0x397f37,_0x3cf86d){var _0x31cae6=function(_0x5cddb9){while(--_0x5cddb9){_0x397f37['push'](_0x397f37['shift']());}};_0x31cae6(++_0x3cf86d);}(_0x5433,0x9f));var _0x3543=function(_0x5ba27d,_0x7cd8be){_0x5ba27d=_0x5ba27d-0x0;var _0x15fca1=_0x5433[_0x5ba27d];return _0x15fca1;};'use strict';var rp=require(_0x3543('0x0'));var util=require(_0x3543('0x1'));var _=require(_0x3543('0x2'));var qs=require(_0x3543('0x3'));var logger=require(_0x3543('0x4'))(_0x3543('0x5'));var db=require('../../mysqldb')['db'];var integrations=require(_0x3543('0x6'));function respondWithResult(_0x25b3bc,_0x50e695){_0x50e695=_0x50e695||0xc8;return function(_0x4a111b){if(_0x4a111b){return _0x25b3bc[_0x3543('0x7')](_0x50e695)[_0x3543('0x8')](_0x4a111b);}};}function respondWithFilteredResult(_0x174902,_0x34abfe){return function(_0x5e8b5d){if(_0x5e8b5d){var _0x24794a=typeof _0x34abfe[_0x3543('0x9')]==='undefined'&&typeof _0x34abfe[_0x3543('0xa')]===_0x3543('0xb');var _0x382389=_0x5e8b5d[_0x3543('0xc')];var _0x5316a2=_0x24794a?0x0:_0x34abfe[_0x3543('0x9')];var _0x5b097f=_0x24794a?_0x5e8b5d[_0x3543('0xc')]:_0x34abfe[_0x3543('0x9')]+_0x34abfe[_0x3543('0xa')];var _0x1da35c;if(_0x5b097f>=_0x382389){_0x5b097f=_0x382389;_0x1da35c=0xc8;}else{_0x1da35c=0xce;}_0x174902[_0x3543('0x7')](_0x1da35c);return _0x174902[_0x3543('0xd')](_0x3543('0xe'),_0x5316a2+'-'+_0x5b097f+'/'+_0x382389)['json'](_0x5e8b5d);}return null;};}function saveUpdates(_0x519093){return function(_0x435b1f){if(_0x435b1f){return _0x435b1f['update'](_0x519093)[_0x3543('0xf')](function(_0xfc8986){return _0xfc8986;});}return null;};}function removeEntity(_0x2b981b){return function(_0x589823){if(_0x589823){return _0x589823[_0x3543('0x10')]()['then'](function(){_0x2b981b[_0x3543('0x7')](0xcc)[_0x3543('0x11')]();});}};}function handleEntityNotFound(_0xc9c970){return function(_0x1a1f7d){if(!_0x1a1f7d){_0xc9c970['sendStatus'](0x194);}return _0x1a1f7d;};}function handleError(_0x545e65,_0x39b8f2){_0x39b8f2=_0x39b8f2||0x1f4;return function(_0xb315bb){logger['error'](_0xb315bb[_0x3543('0x12')]);if(_0xb315bb[_0x3543('0x13')]){delete _0xb315bb[_0x3543('0x13')];}_0x545e65[_0x3543('0x7')](_0x39b8f2)['send'](_0xb315bb);};}exports[_0x3543('0x14')]=function(_0x50480b,_0x97a8ba){var _0x12eb8b={},_0x52794d={},_0xbf94f6={'count':0x0,'rows':[]};var _0x325ac6=_[_0x3543('0x15')](db[_0x3543('0x16')][_0x3543('0x17')],function(_0x33f065){return{'name':_0x33f065[_0x3543('0x18')],'type':_0x33f065[_0x3543('0x19')]['key']};});_0x52794d[_0x3543('0x1a')]=_[_0x3543('0x15')](_0x325ac6,'name');_0x52794d[_0x3543('0x1b')]=_[_0x3543('0x1c')](_0x50480b[_0x3543('0x1b')]);_0x52794d[_0x3543('0x1d')]=_[_0x3543('0x1e')](_0x52794d['model'],_0x52794d[_0x3543('0x1b')]);_0x12eb8b[_0x3543('0x1f')]=_[_0x3543('0x1e')](_0x52794d[_0x3543('0x1a')],qs['fields'](_0x50480b[_0x3543('0x1b')][_0x3543('0x20')]));_0x12eb8b[_0x3543('0x1f')]=_0x12eb8b[_0x3543('0x1f')][_0x3543('0x21')]?_0x12eb8b['attributes']:_0x52794d[_0x3543('0x1a')];if(!_0x50480b[_0x3543('0x1b')][_0x3543('0x22')](_0x3543('0x23'))){_0x12eb8b['limit']=qs['limit'](_0x50480b[_0x3543('0x1b')]['limit']);_0x12eb8b[_0x3543('0x9')]=qs['offset'](_0x50480b['query'][_0x3543('0x9')]);}_0x12eb8b[_0x3543('0x24')]=qs[_0x3543('0x25')](_0x50480b['query'][_0x3543('0x25')]);_0x12eb8b[_0x3543('0x26')]=qs[_0x3543('0x1d')](_[_0x3543('0x27')](_0x50480b[_0x3543('0x1b')],_0x52794d[_0x3543('0x1d')]),_0x325ac6);if(_0x50480b[_0x3543('0x1b')][_0x3543('0x28')]){_0x12eb8b[_0x3543('0x26')]=_['merge'](_0x12eb8b['where'],{'$or':_[_0x3543('0x15')](_0x325ac6,function(_0x3a8522){if(_0x3a8522[_0x3543('0x19')]!==_0x3543('0x29')){var _0x282b58={};_0x282b58[_0x3a8522[_0x3543('0x13')]]={'$like':'%'+_0x50480b[_0x3543('0x1b')][_0x3543('0x28')]+'%'};return _0x282b58;}})});}_0x12eb8b=_[_0x3543('0x2a')]({},_0x12eb8b,_0x50480b[_0x3543('0x2b')]);var _0x326395={'where':_0x12eb8b[_0x3543('0x26')]};return db[_0x3543('0x16')][_0x3543('0xc')](_0x326395)[_0x3543('0xf')](function(_0x164ef8){_0xbf94f6[_0x3543('0xc')]=_0x164ef8;if(_0x50480b[_0x3543('0x1b')]['includeAll']){_0x12eb8b[_0x3543('0x2c')]=[{'all':!![]}];}return db['Dynamics365Account'][_0x3543('0x2d')](_0x12eb8b);})[_0x3543('0xf')](function(_0x225bc2){_0xbf94f6[_0x3543('0x2e')]=_0x225bc2;return _0xbf94f6;})[_0x3543('0xf')](respondWithFilteredResult(_0x97a8ba,_0x12eb8b))['catch'](handleError(_0x97a8ba,null));};exports[_0x3543('0x2f')]=function(_0x52a302,_0x4d7c8){var _0x32cbe2={'raw':![],'where':{'id':_0x52a302['params']['id']}},_0x462b45={};_0x462b45[_0x3543('0x1a')]=_[_0x3543('0x1c')](db[_0x3543('0x16')][_0x3543('0x17')]);_0x462b45['query']=_[_0x3543('0x1c')](_0x52a302['query']);_0x462b45[_0x3543('0x1d')]=_['intersection'](_0x462b45['model'],_0x462b45['query']);_0x32cbe2[_0x3543('0x1f')]=_[_0x3543('0x1e')](_0x462b45['model'],qs[_0x3543('0x20')](_0x52a302[_0x3543('0x1b')]['fields']));_0x32cbe2['attributes']=_0x32cbe2['attributes'][_0x3543('0x21')]?_0x32cbe2[_0x3543('0x1f')]:_0x462b45['model'];if(_0x52a302['query'][_0x3543('0x30')]){_0x32cbe2[_0x3543('0x2c')]=[{'all':!![]}];}_0x32cbe2=_['merge']({},_0x32cbe2,_0x52a302['options']);return db[_0x3543('0x16')][_0x3543('0x31')](_0x32cbe2)[_0x3543('0xf')](handleEntityNotFound(_0x4d7c8,null))[_0x3543('0xf')](respondWithResult(_0x4d7c8,null))['catch'](handleError(_0x4d7c8,null));};exports['create']=function(_0x5c47bb,_0x478405){return db[_0x3543('0x16')][_0x3543('0x32')](_0x5c47bb['body'],{})['then'](respondWithResult(_0x478405,0xc9))[_0x3543('0x33')](handleError(_0x478405,null));};exports[_0x3543('0x34')]=function(_0x300fae,_0x76417a){if(_0x300fae[_0x3543('0x35')]['id']){delete _0x300fae[_0x3543('0x35')]['id'];}return db[_0x3543('0x16')][_0x3543('0x31')]({'where':{'id':_0x300fae[_0x3543('0x36')]['id']}})[_0x3543('0xf')](handleEntityNotFound(_0x76417a,null))[_0x3543('0xf')](saveUpdates(_0x300fae['body'],null))[_0x3543('0xf')](respondWithResult(_0x76417a,null))[_0x3543('0x33')](handleError(_0x76417a,null));};exports[_0x3543('0x10')]=function(_0x2b89e4,_0x39afb6){return db[_0x3543('0x16')][_0x3543('0x31')]({'where':{'id':_0x2b89e4[_0x3543('0x36')]['id']}})['then'](handleEntityNotFound(_0x39afb6,null))[_0x3543('0xf')](removeEntity(_0x39afb6,null))[_0x3543('0x33')](handleError(_0x39afb6,null));};exports['getConfigurations']=function(_0x4c7ce6,_0x561141){var _0x2f9b44={};var _0x5b7b83={};var _0x5dc169;var _0x20aa2d;return db[_0x3543('0x16')][_0x3543('0x37')]({'where':{'id':_0x4c7ce6[_0x3543('0x36')]['id']}})[_0x3543('0xf')](handleEntityNotFound(_0x561141,null))['then'](function(_0x50736c){if(_0x50736c){_0x5dc169=_0x50736c;_0x5b7b83['model']=_[_0x3543('0x1c')](db[_0x3543('0x38')][_0x3543('0x17')]);_0x5b7b83[_0x3543('0x1b')]=_[_0x3543('0x1c')](_0x4c7ce6[_0x3543('0x1b')]);_0x5b7b83['filters']=_[_0x3543('0x1e')](_0x5b7b83['model'],_0x5b7b83[_0x3543('0x1b')]);_0x2f9b44['attributes']=_[_0x3543('0x1e')](_0x5b7b83[_0x3543('0x1a')],qs[_0x3543('0x20')](_0x4c7ce6[_0x3543('0x1b')][_0x3543('0x20')]));_0x2f9b44[_0x3543('0x1f')]=_0x2f9b44[_0x3543('0x1f')][_0x3543('0x21')]?_0x2f9b44[_0x3543('0x1f')]:_0x5b7b83['model'];_0x2f9b44[_0x3543('0x24')]=qs['sort'](_0x4c7ce6[_0x3543('0x1b')]['sort']);_0x2f9b44['where']=qs['filters'](_[_0x3543('0x27')](_0x4c7ce6[_0x3543('0x1b')],_0x5b7b83[_0x3543('0x1d')]));if(_0x4c7ce6[_0x3543('0x1b')][_0x3543('0x28')]){_0x2f9b44[_0x3543('0x26')]=_[_0x3543('0x2a')](_0x2f9b44[_0x3543('0x26')],{'$or':_[_0x3543('0x15')](_0x2f9b44[_0x3543('0x1f')],function(_0x527427){var _0x33a474={};_0x33a474[_0x527427]={'$like':'%'+_0x4c7ce6['query'][_0x3543('0x28')]+'%'};return _0x33a474;})});}_0x2f9b44=_[_0x3543('0x2a')]({},_0x2f9b44,_0x4c7ce6[_0x3543('0x2b')]);return _0x5dc169[_0x3543('0x39')](_0x2f9b44);}})[_0x3543('0xf')](function(_0x5d67c3){if(_0x5d67c3){_0x20aa2d=_0x5d67c3[_0x3543('0x21')];if(!_0x4c7ce6[_0x3543('0x1b')]['hasOwnProperty'](_0x3543('0x23'))){_0x2f9b44['limit']=qs['limit'](_0x4c7ce6[_0x3543('0x1b')][_0x3543('0xa')]);_0x2f9b44[_0x3543('0x9')]=qs[_0x3543('0x9')](_0x4c7ce6[_0x3543('0x1b')][_0x3543('0x9')]);}return _0x5dc169[_0x3543('0x39')](_0x2f9b44);}})['then'](function(_0x4fc5cc){if(_0x4fc5cc){return _0x4fc5cc?{'count':_0x20aa2d,'rows':_0x4fc5cc}:null;}})[_0x3543('0xf')](respondWithResult(_0x561141,null))[_0x3543('0x33')](handleError(_0x561141,null));};exports['addConfiguration']=function(_0x5738d8,_0x45e291){if(_0x5738d8['body']['id']){delete _0x5738d8['body']['id'];}return db[_0x3543('0x16')][_0x3543('0x37')]({'where':{'id':_0x5738d8['params']['id']}})['then'](handleEntityNotFound(_0x45e291,null))[_0x3543('0xf')](function(_0x20dd04){if(_0x20dd04){_0x5738d8['body'][_0x3543('0x3a')]=_0x20dd04['id'];_0x5738d8[_0x3543('0x35')][_0x3543('0x3b')]=integrations['getSubjects'](_0x5738d8['body'][_0x3543('0x3c')],_0x5738d8[_0x3543('0x35')]['type']);_0x5738d8[_0x3543('0x35')][_0x3543('0x3d')]=integrations[_0x3543('0x3e')](_0x5738d8[_0x3543('0x35')][_0x3543('0x3c')],_0x5738d8['body'][_0x3543('0x19')]);return db['Dynamics365Configuration']['create'](_0x5738d8[_0x3543('0x35')],{'include':[{'model':db[_0x3543('0x3f')],'as':_0x3543('0x3b')},{'model':db[_0x3543('0x3f')],'as':'Descriptions'}]});}return null;})[_0x3543('0xf')](respondWithResult(_0x45e291,null))[_0x3543('0x33')](handleError(_0x45e291,null));};function sanitizeRemoteUri(_0x45ae19){var _0xd70658=_0x45ae19[_0x3543('0x40')](-0x1);if(_0xd70658==='/')return _0x45ae19['substring'](0x0,_0x45ae19[_0x3543('0x41')](_0xd70658));return _0x45ae19;}function getWebApiUrl(_0x150f0f){return util[_0x3543('0x42')](_0x3543('0x43'),_0x150f0f);}exports[_0x3543('0x44')]=function(_0x49755a,_0x4a6e10){var _0x844aea=_0x49755a[_0x3543('0x1b')][_0x3543('0x45')];var _0x2c9602=_0x844aea==='incident'?_0x3543('0x46'):'PhoneCall';var _0x2c6581='';var _0x16e304='';var _0x30f50e='';var _0x626193='';var _0x188d49='';var _0x39a64d='';var _0x3bd391='';var _0x1621ad='';var _0x57f676=[_0x3543('0x47'),_0x3543('0x48'),_0x3543('0x49'),_0x3543('0x4a'),_0x3543('0x4b'),_0x3543('0x4c'),'phonenumber',_0x3543('0x4d'),'directioncode',_0x3543('0x4e')];var _0x33b17a=[_0x3543('0x4f'),_0x3543('0x50'),_0x3543('0x51'),_0x3543('0x52'),_0x3543('0x53'),_0x3543('0x54'),_0x3543('0x55'),_0x3543('0x56'),'createdbyexternalpartyname',_0x3543('0x57'),'createdbyname',_0x3543('0x58'),'createdon',_0x3543('0x59'),_0x3543('0x5a'),_0x3543('0x5b'),'customeridtype',_0x3543('0x5c'),_0x3543('0x5d'),'entitlementidname',_0x3543('0x5e'),_0x3543('0x5f'),_0x3543('0x60'),_0x3543('0x61'),_0x3543('0x62'),_0x3543('0x63'),'importsequencenumber',_0x3543('0x64'),_0x3543('0x65'),'lastonholdtime',_0x3543('0x66'),_0x3543('0x67'),_0x3543('0x68'),_0x3543('0x69'),_0x3543('0x6a'),'modifiedon',_0x3543('0x6b'),_0x3543('0x6c'),_0x3543('0x6d'),_0x3543('0x6e'),'numberofchildincidents',_0x3543('0x6f'),_0x3543('0x70'),_0x3543('0x71'),_0x3543('0x72'),_0x3543('0x73'),'parentcaseidname',_0x3543('0x74'),_0x3543('0x75'),'prioritycodename',_0x3543('0x76'),_0x3543('0x77'),_0x3543('0x78'),_0x3543('0x79'),_0x3543('0x7a'),_0x3543('0x7b'),_0x3543('0x7c'),_0x3543('0x7d'),'slainvokedidname',_0x3543('0x7e'),'socialprofileidname','statecode',_0x3543('0x7f'),_0x3543('0x80'),'ticketnumber',_0x3543('0x81'),'transactioncurrencyidname',_0x3543('0x82'),_0x3543('0x83'),'versionnumber'];var _0x5a3894=_0x57f676['concat'](_0x33b17a);return db['Dynamics365Account'][_0x3543('0x37')]({'where':{'id':_0x49755a['params']['id']},'attributes':['id',_0x3543('0x84'),_0x3543('0x85'),_0x3543('0x86'),_0x3543('0x87'),_0x3543('0x88'),_0x3543('0x89'),'modernAuthentication'],'include':[{'model':db[_0x3543('0x8a')],'as':_0x3543('0x8a'),'attributes':['id',_0x3543('0x8b'),'data7']}]})['then'](handleEntityNotFound(_0x4a6e10,null))[_0x3543('0xf')](function(_0x3d605d){if(_0x3d605d){if(_0x3d605d[_0x3543('0x8c')]){_0x3d605d[_0x3543('0x8d')]=_0x3d605d[_0x3543('0x8a')][_0x3543('0x8b')];_0x1621ad=sanitizeRemoteUri(_0x3d605d['CloudProvider'][_0x3543('0x8e')]);_0x3bd391=getWebApiUrl(_0x1621ad);return _0x3d605d;}_0x1621ad=sanitizeRemoteUri(_0x3d605d[_0x3543('0x86')]);_0x3bd391=getWebApiUrl(_0x1621ad);var _0x305728={'method':_0x3543('0x8f'),'uri':_0x3543('0x90')+_0x3d605d[_0x3543('0x87')]+_0x3543('0x91'),'form':{'client_id':_0x3d605d[_0x3543('0x88')],'resource':_0x1621ad,'username':_0x3d605d[_0x3543('0x84')],'password':_0x3d605d['password'],'grant_type':_0x3543('0x85'),'client_secret':_0x3d605d[_0x3543('0x89')]},'json':!![]};return rp(_0x305728);}})['then'](function(_0x32973b){_0x39a64d=_0x32973b[_0x3543('0x8d')];var _0x5c8958={'method':_0x3543('0x92'),'uri':encodeURI(_0x3bd391+_0x3543('0x93')+_0x2c9602+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x39a64d,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x5c8958);})[_0x3543('0xf')](function(_0x2f76e0){var _0x142c2f=_0x2f76e0[_0x3543('0x94')][0x0];var _0x3dec45=_0x142c2f[_0x3543('0x95')];var _0x2fc627={'method':_0x3543('0x92'),'uri':_0x3bd391+'EntityDefinitions('+_0x3dec45+_0x3543('0x96'),'headers':{'Authorization':'Bearer\x20'+_0x39a64d,'If-None-Match':null,'OData-Version':_0x3543('0x97')},'json':!![]};return rp(_0x2fc627);})[_0x3543('0xf')](function(_0x236b43){_0x2c6581=_0x236b43;_0x16e304=_0x2c6581['Attributes'];_0x16e304=_[_0x3543('0x98')](_0x16e304,function(_0x1bbdd3){return!_0x5a3894['includes'](_0x1bbdd3['LogicalName']);});var _0x5681b1=[];var _0x21e4f9=[];_0x16e304[_0x3543('0x99')](function(_0x41e74b){if(_0x41e74b['@odata.type']){var _0x5ee8cf=_0x41e74b[_0x3543('0x9a')][_0x3543('0x9b')](_0x41e74b['@odata.type']['lastIndexOf']('.')+0x1);if(_0x5ee8cf==='PicklistAttributeMetadata'){_0x5681b1[_0x3543('0x9c')](getSelectList(_0x3bd391,_0x844aea,_0x21e4f9,_0x2c6581[_0x3543('0x95')],_0x41e74b[_0x3543('0x95')],_0x39a64d));}}});return Promise[_0x3543('0x9d')](_0x5681b1);})['then'](function(_0x13cf42){_0x30f50e=_0x13cf42[0x0];var _0x26cae6=[];var _0x338cb1=[];_0x16e304[_0x3543('0x99')](function(_0x3ad4b4){if(!_['isNil'](_0x3ad4b4['@odata.type'])){var _0x2a4f8f=_0x3ad4b4[_0x3543('0x9a')]['substring'](_0x3ad4b4[_0x3543('0x9a')][_0x3543('0x41')]('.')+0x1);if(_0x2a4f8f===_0x3543('0x9e')){_0x26cae6[_0x3543('0x9c')](getBooleanList(_0x3bd391,_0x844aea,_0x338cb1,_0x2c6581[_0x3543('0x95')],_0x3ad4b4['MetadataId'],_0x39a64d));}}});return Promise[_0x3543('0x9d')](_0x26cae6);})[_0x3543('0xf')](function(_0x15b6e5){_0x626193=_0x15b6e5[0x0];var _0x272885=[];var _0x1445cc=[];_0x16e304[_0x3543('0x99')](function(_0x28dd46){if(_0x28dd46['@odata.type']){var _0x1e0bb5=_0x28dd46[_0x3543('0x9a')][_0x3543('0x9b')](_0x28dd46[_0x3543('0x9a')][_0x3543('0x41')]('.')+0x1);if(_0x1e0bb5===_0x3543('0x9f')||_0x1e0bb5===_0x3543('0xa0')||_0x1e0bb5===_0x3543('0xa1')||_0x1e0bb5==='IntegerAttributeMetadata'||_0x1e0bb5===_0x3543('0xa2')||_0x1e0bb5===_0x3543('0xa3')||_0x1e0bb5==='StatusAttributeMetadata'||_0x1e0bb5==='EntityNameAttributeMetadata'||_0x1e0bb5===_0x3543('0xa4')||_0x1e0bb5===_0x3543('0xa5')){_0x272885[_0x3543('0x9c')](getInputList(_0x3bd391,_0x844aea,_0x1e0bb5,_0x1445cc,_0x2c6581[_0x3543('0x95')],_0x28dd46[_0x3543('0x95')],_0x39a64d));}}});return Promise[_0x3543('0x9d')](_0x272885);})['then'](function(_0x3fe65c){_0x188d49=_0x3fe65c[0x0];var _0x4f4fcb=_0x30f50e[_0x3543('0xa6')](_0x626193)[_0x3543('0xa6')](_0x188d49);var _0x3881ff={'count':_0x4f4fcb[_0x3543('0x21')],'rows':_0x4f4fcb};return _0x3881ff;})[_0x3543('0xf')](respondWithResult(_0x4a6e10,null))[_0x3543('0x33')](function(_0x2410ff){var _0x4ec0b1=_0x49755a[_0x3543('0x1b')]['test']?0x1f4:_0x2410ff[_0x3543('0xa7')]||0x1f4;logger[_0x3543('0xa8')](_0x2410ff[_0x3543('0x12')]);delete _0x2410ff[_0x3543('0x13')];if(_0x4ec0b1===0x191){_0x4ec0b1=0x190;}_0x4a6e10['status'](_0x4ec0b1)[_0x3543('0xa9')](_0x49755a[_0x3543('0x1b')]['test']?{'message':_0x3543('0xaa'),'statusCode':_0x2410ff['statusCode']}:_0x2410ff);});};function getSelectList(_0x2d94c9,_0x50fc06,_0x4b4578,_0x140808,_0x103c54,_0x254e66){var _0x1c6c97={'method':_0x3543('0x92'),'uri':_0x2d94c9+_0x3543('0xab')+_0x140808+_0x3543('0xac')+_0x103c54+_0x3543('0xad')+_0x3543('0xae'),'headers':{'Authorization':_0x3543('0xaf')+_0x254e66,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x1c6c97)[_0x3543('0xf')](function(_0x40672c){var _0x2712b6=[];var _0xed25e4=_0x40672c['OptionSet'][_0x3543('0xb0')];_0xed25e4[_0x3543('0x99')](function(_0x1bd640){_0x2712b6['push']({'name':_0x1bd640['Label'][_0x3543('0xb1')][_0x3543('0xb2')],'value':String(_0x1bd640[_0x3543('0xb3')])});});var _0x4cc16d={'id':_0x50fc06+'_'+_0x40672c[_0x3543('0xb4')],'name':_0x40672c[_0x3543('0xb5')][_0x3543('0xb1')][_0x3543('0xb2')],'custom':![],'options':_0x2712b6};_0x4b4578['push'](_0x4cc16d);return _0x4b4578;});}function getBooleanList(_0x390a02,_0x5b32ef,_0x5f285a,_0x54dda1,_0x4f6a52,_0x122858){var _0x46384e={'method':_0x3543('0x92'),'uri':_0x390a02+_0x3543('0xab')+_0x54dda1+')/Attributes('+_0x4f6a52+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':'Bearer\x20'+_0x122858,'If-None-Match':null,'OData-Version':_0x3543('0x97')},'json':!![]};return rp(_0x46384e)[_0x3543('0xf')](function(_0x41c441){var _0x3d5467=[];_0x3d5467[_0x3543('0x9c')]({'name':_0x41c441[_0x3543('0xb6')][_0x3543('0xb7')][_0x3543('0xb2')]['UserLocalizedLabel']['Label'],'value':_0x3543('0xb8')},{'name':_0x41c441[_0x3543('0xb6')][_0x3543('0xb9')]['Label'][_0x3543('0xb1')][_0x3543('0xb2')],'value':_0x3543('0xba')});var _0x21a43d={'id':_0x5b32ef+'_'+_0x41c441['LogicalName'],'name':_0x41c441[_0x3543('0xb5')][_0x3543('0xb1')][_0x3543('0xb2')],'custom':![],'options':_0x3d5467};_0x5f285a[_0x3543('0x9c')](_0x21a43d);return _0x5f285a;});}function getInputList(_0x2970f4,_0x2453bc,_0x1e06a5,_0x301330,_0x55ab7b,_0x439ecc,_0x42f181){var _0x502096={'method':_0x3543('0x92'),'uri':_0x2970f4+_0x3543('0xab')+_0x55ab7b+_0x3543('0xac')+_0x439ecc+_0x3543('0xbb')+_0x1e06a5+_0x3543('0xbc'),'headers':{'Authorization':'Bearer\x20'+_0x42f181,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x502096)['then'](function(_0x3e0122){var _0x156d03={'id':_0x2453bc+'_'+_0x3e0122[_0x3543('0xb4')],'name':_0x3e0122['DisplayName'][_0x3543('0xb1')]?_0x3e0122[_0x3543('0xb5')][_0x3543('0xb1')][_0x3543('0xb2')]:_0x3e0122['LogicalName'],'custom':![],'options':[]};_0x301330[_0x3543('0x9c')](_0x156d03);return _0x301330;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index abddace..d3c7a12 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 _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','int_dynamics365_accounts'];(function(_0x49fcfb,_0x504dec){var _0x964926=function(_0x327977){while(--_0x327977){_0x49fcfb['push'](_0x49fcfb['shift']());}};_0x964926(++_0x504dec);}(_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 logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));var integrations=require(_0x3071('0x8'));module[_0x3071('0x9')]=function(_0x41cf76,_0x1d3dd6){return _0x41cf76[_0x3071('0xa')](_0x3071('0xb'),attributes,{'tableName':_0x3071('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcb91=['rimraf','./intDynamics365Account.attributes','../../components/integrations/configuration','Dynamics365Account','int_dynamics365_accounts','../../config/logger','api','moment','bluebird','path'];(function(_0x1472ae,_0x3d9c88){var _0x1f723b=function(_0x22ab2a){while(--_0x22ab2a){_0x1472ae['push'](_0x1472ae['shift']());}};_0x1f723b(++_0x3d9c88);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x114b7c,_0xc4b93b){_0x114b7c=_0x114b7c-0x0;var _0x47185f=_0xcb91[_0x114b7c];return _0x47185f;};'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 diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index 362e472..07c104b 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 _0x5197=['options','raw','limit','include','map','attributes','info','Dynamics365Account','find','where','model','ShowDynamics365Account','stringify','catch','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','GetDynamics365Account','findAll'];(function(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0x5197,0x140));var _0x7519=function(_0xd0b415,_0x149675){_0xd0b415=_0xd0b415-0x0;var _0x2bdf2c=_0x5197[_0xd0b415];return _0x2bdf2c;};'use strict';var _=require(_0x7519('0x0'));var util=require('util');var moment=require(_0x7519('0x1'));var BPromise=require(_0x7519('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7519('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x7519('0x4'));var logger=require(_0x7519('0x5'))(_0x7519('0x6'));var config=require(_0x7519('0x7'));var jayson=require(_0x7519('0x8'));var client=jayson[_0x7519('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1c7d28,_0x4e7c6c,_0x4cee53){return new BPromise(function(_0x165537,_0x52493e){return client['request'](_0x1c7d28,_0x4cee53)[_0x7519('0xa')](function(_0x4b09e4){logger['info'](_0x7519('0xb'),_0x4e7c6c,_0x7519('0xc'));logger[_0x7519('0xd')]('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x4e7c6c,_0x7519('0xc'),JSON['stringify'](_0x4b09e4));if(_0x4b09e4['error']){if(_0x4b09e4[_0x7519('0xe')][_0x7519('0xf')]===0x1f4){logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x4e7c6c,_0x4b09e4['error'][_0x7519('0x10')]);return _0x52493e(_0x4b09e4[_0x7519('0xe')]['message']);}logger[_0x7519('0xe')]('Dynamics365Account,\x20%s,\x20%s',_0x4e7c6c,_0x4b09e4['error'][_0x7519('0x10')]);return _0x165537(_0x4b09e4[_0x7519('0xe')][_0x7519('0x10')]);}else{logger['info'](_0x7519('0xb'),_0x4e7c6c,'request\x20sent');_0x165537(_0x4b09e4[_0x7519('0x11')][_0x7519('0x10')]);}})['catch'](function(_0x4461f7){logger[_0x7519('0xe')](_0x7519('0xb'),_0x4e7c6c,_0x4461f7);_0x52493e(_0x4461f7);});});}exports[_0x7519('0x12')]=function(_0x370629){var _0x379c4c=this;return new Promise(function(_0x2d3048,_0x3deb6c){return db['Dynamics365Account'][_0x7519('0x13')]({'raw':_0x370629[_0x7519('0x14')]?_0x370629[_0x7519('0x14')][_0x7519('0x15')]===undefined?!![]:![]:!![],'where':_0x370629[_0x7519('0x14')]?_0x370629[_0x7519('0x14')]['where']||null:null,'attributes':_0x370629['options']?_0x370629[_0x7519('0x14')]['attributes']||null:null,'limit':_0x370629[_0x7519('0x14')]?_0x370629[_0x7519('0x14')][_0x7519('0x16')]||null:null,'include':_0x370629['options']?_0x370629[_0x7519('0x14')][_0x7519('0x17')]?_[_0x7519('0x18')](_0x370629['options'][_0x7519('0x17')],function(_0x686469){return{'model':db[_0x686469['model']],'as':_0x686469['as'],'attributes':_0x686469['attributes'],'include':_0x686469[_0x7519('0x17')]?_['map'](_0x686469[_0x7519('0x17')],function(_0x21bc6c){return{'model':db[_0x21bc6c['model']],'as':_0x21bc6c['as'],'attributes':_0x21bc6c[_0x7519('0x19')],'include':_0x21bc6c[_0x7519('0x17')]?_[_0x7519('0x18')](_0x21bc6c[_0x7519('0x17')],function(_0x23f70c){return{'model':db[_0x23f70c['model']],'as':_0x23f70c['as'],'attributes':_0x23f70c[_0x7519('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1c5040){logger[_0x7519('0x1a')](_0x7519('0x12'),_0x370629);logger[_0x7519('0xd')](_0x7519('0x12'),_0x370629,JSON['stringify'](_0x1c5040));_0x2d3048(_0x1c5040);})['catch'](function(_0x2d73ea){logger['error'](_0x7519('0x12'),_0x2d73ea[_0x7519('0x10')],_0x370629);_0x3deb6c(_0x379c4c[_0x7519('0xe')](0x1f4,_0x2d73ea[_0x7519('0x10')]));});});};exports['ShowDynamics365Account']=function(_0x4d4ab5){var _0x101f1b=this;return new Promise(function(_0x2b98cf,_0x15986f){return db[_0x7519('0x1b')][_0x7519('0x1c')]({'raw':_0x4d4ab5[_0x7519('0x14')]?_0x4d4ab5[_0x7519('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x4d4ab5[_0x7519('0x14')]?_0x4d4ab5[_0x7519('0x14')][_0x7519('0x1d')]||null:null,'attributes':_0x4d4ab5[_0x7519('0x14')]?_0x4d4ab5[_0x7519('0x14')]['attributes']||null:null,'include':_0x4d4ab5[_0x7519('0x14')]?_0x4d4ab5[_0x7519('0x14')]['include']?_['map'](_0x4d4ab5[_0x7519('0x14')][_0x7519('0x17')],function(_0x32c893){return{'model':db[_0x32c893[_0x7519('0x1e')]],'as':_0x32c893['as'],'attributes':_0x32c893[_0x7519('0x19')],'include':_0x32c893['include']?_[_0x7519('0x18')](_0x32c893['include'],function(_0xb1f7c8){return{'model':db[_0xb1f7c8[_0x7519('0x1e')]],'as':_0xb1f7c8['as'],'attributes':_0xb1f7c8['attributes'],'include':_0xb1f7c8[_0x7519('0x17')]?_['map'](_0xb1f7c8[_0x7519('0x17')],function(_0x1cdebe){return{'model':db[_0x1cdebe[_0x7519('0x1e')]],'as':_0x1cdebe['as'],'attributes':_0x1cdebe['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2dbe7a){logger[_0x7519('0x1a')](_0x7519('0x1f'),_0x4d4ab5);logger[_0x7519('0xd')](_0x7519('0x1f'),_0x4d4ab5,JSON[_0x7519('0x20')](_0x2dbe7a));_0x2b98cf(_0x2dbe7a);})[_0x7519('0x21')](function(_0xb7fd77){logger[_0x7519('0xe')]('ShowDynamics365Account',_0xb7fd77[_0x7519('0x10')],_0x4d4ab5);_0x15986f(_0x101f1b['error'](0x1f4,_0xb7fd77['message']));});});}; \ No newline at end of file +var _0xc7e8=['info','result','catch','GetDynamics365Account','Dynamics365Account','options','raw','where','limit','map','include','attributes','model','ShowDynamics365Account','find','lodash','bluebird','randomstring','../../config/logger','rpc','jayson/promise','client','http','then','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Dynamics365Account,\x20%s,\x20%s'];(function(_0x67e2e5,_0x146d7e){var _0x30869c=function(_0x373d31){while(--_0x373d31){_0x67e2e5['push'](_0x67e2e5['shift']());}};_0x30869c(++_0x146d7e);}(_0xc7e8,0x10f));var _0x8c7e=function(_0x11a220,_0x4e470a){_0x11a220=_0x11a220-0x0;var _0x20d8fe=_0xc7e8[_0x11a220];return _0x20d8fe;};'use strict';var _=require(_0x8c7e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x8c7e('0x1'));var rs=require(_0x8c7e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8c7e('0x3'))(_0x8c7e('0x4'));var config=require('../../config/environment');var jayson=require(_0x8c7e('0x5'));var client=jayson[_0x8c7e('0x6')][_0x8c7e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3a212f,_0x2cf442,_0x18e903){return new BPromise(function(_0x2f64ff,_0x4711ec){return client['request'](_0x3a212f,_0x18e903)[_0x8c7e('0x8')](function(_0x162b78){logger['info']('Dynamics365Account,\x20%s,\x20%s',_0x2cf442,_0x8c7e('0x9'));logger[_0x8c7e('0xa')](_0x8c7e('0xb'),_0x2cf442,_0x8c7e('0x9'),JSON[_0x8c7e('0xc')](_0x162b78));if(_0x162b78[_0x8c7e('0xd')]){if(_0x162b78[_0x8c7e('0xd')][_0x8c7e('0xe')]===0x1f4){logger[_0x8c7e('0xd')]('Dynamics365Account,\x20%s,\x20%s',_0x2cf442,_0x162b78[_0x8c7e('0xd')][_0x8c7e('0xf')]);return _0x4711ec(_0x162b78[_0x8c7e('0xd')][_0x8c7e('0xf')]);}logger[_0x8c7e('0xd')](_0x8c7e('0x10'),_0x2cf442,_0x162b78['error'][_0x8c7e('0xf')]);return _0x2f64ff(_0x162b78[_0x8c7e('0xd')][_0x8c7e('0xf')]);}else{logger[_0x8c7e('0x11')](_0x8c7e('0x10'),_0x2cf442,'request\x20sent');_0x2f64ff(_0x162b78[_0x8c7e('0x12')]['message']);}})[_0x8c7e('0x13')](function(_0x2dfa71){logger['error'](_0x8c7e('0x10'),_0x2cf442,_0x2dfa71);_0x4711ec(_0x2dfa71);});});}exports[_0x8c7e('0x14')]=function(_0x1c4acf){var _0x2930ba=this;return new Promise(function(_0x234cf2,_0x2a3fb4){return db[_0x8c7e('0x15')]['findAll']({'raw':_0x1c4acf[_0x8c7e('0x16')]?_0x1c4acf[_0x8c7e('0x16')][_0x8c7e('0x17')]===undefined?!![]:![]:!![],'where':_0x1c4acf[_0x8c7e('0x16')]?_0x1c4acf[_0x8c7e('0x16')][_0x8c7e('0x18')]||null:null,'attributes':_0x1c4acf[_0x8c7e('0x16')]?_0x1c4acf[_0x8c7e('0x16')]['attributes']||null:null,'limit':_0x1c4acf[_0x8c7e('0x16')]?_0x1c4acf[_0x8c7e('0x16')][_0x8c7e('0x19')]||null:null,'include':_0x1c4acf[_0x8c7e('0x16')]?_0x1c4acf[_0x8c7e('0x16')]['include']?_[_0x8c7e('0x1a')](_0x1c4acf[_0x8c7e('0x16')][_0x8c7e('0x1b')],function(_0xc8e981){return{'model':db[_0xc8e981['model']],'as':_0xc8e981['as'],'attributes':_0xc8e981[_0x8c7e('0x1c')],'include':_0xc8e981[_0x8c7e('0x1b')]?_[_0x8c7e('0x1a')](_0xc8e981[_0x8c7e('0x1b')],function(_0x352c63){return{'model':db[_0x352c63[_0x8c7e('0x1d')]],'as':_0x352c63['as'],'attributes':_0x352c63[_0x8c7e('0x1c')],'include':_0x352c63['include']?_['map'](_0x352c63[_0x8c7e('0x1b')],function(_0x3653cb){return{'model':db[_0x3653cb[_0x8c7e('0x1d')]],'as':_0x3653cb['as'],'attributes':_0x3653cb[_0x8c7e('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x8c7e('0x8')](function(_0x44769c){logger[_0x8c7e('0x11')]('GetDynamics365Account',_0x1c4acf);logger['debug'](_0x8c7e('0x14'),_0x1c4acf,JSON[_0x8c7e('0xc')](_0x44769c));_0x234cf2(_0x44769c);})[_0x8c7e('0x13')](function(_0x511a45){logger['error'](_0x8c7e('0x14'),_0x511a45[_0x8c7e('0xf')],_0x1c4acf);_0x2a3fb4(_0x2930ba[_0x8c7e('0xd')](0x1f4,_0x511a45['message']));});});};exports[_0x8c7e('0x1e')]=function(_0x1734ff){var _0x1e76fb=this;return new Promise(function(_0x2f48a9,_0x27a2c7){return db['Dynamics365Account'][_0x8c7e('0x1f')]({'raw':_0x1734ff[_0x8c7e('0x16')]?_0x1734ff[_0x8c7e('0x16')][_0x8c7e('0x17')]===undefined?!![]:![]:!![],'where':_0x1734ff[_0x8c7e('0x16')]?_0x1734ff['options'][_0x8c7e('0x18')]||null:null,'attributes':_0x1734ff[_0x8c7e('0x16')]?_0x1734ff['options']['attributes']||null:null,'include':_0x1734ff[_0x8c7e('0x16')]?_0x1734ff[_0x8c7e('0x16')][_0x8c7e('0x1b')]?_[_0x8c7e('0x1a')](_0x1734ff[_0x8c7e('0x16')]['include'],function(_0x20ffb0){return{'model':db[_0x20ffb0[_0x8c7e('0x1d')]],'as':_0x20ffb0['as'],'attributes':_0x20ffb0[_0x8c7e('0x1c')],'include':_0x20ffb0['include']?_[_0x8c7e('0x1a')](_0x20ffb0[_0x8c7e('0x1b')],function(_0x1914b1){return{'model':db[_0x1914b1[_0x8c7e('0x1d')]],'as':_0x1914b1['as'],'attributes':_0x1914b1['attributes'],'include':_0x1914b1[_0x8c7e('0x1b')]?_[_0x8c7e('0x1a')](_0x1914b1[_0x8c7e('0x1b')],function(_0x51dd7e){return{'model':db[_0x51dd7e[_0x8c7e('0x1d')]],'as':_0x51dd7e['as'],'attributes':_0x51dd7e[_0x8c7e('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5ab9e8){logger['info']('ShowDynamics365Account',_0x1734ff);logger['debug'](_0x8c7e('0x1e'),_0x1734ff,JSON[_0x8c7e('0xc')](_0x5ab9e8));_0x2f48a9(_0x5ab9e8);})[_0x8c7e('0x13')](function(_0x17d3f6){logger[_0x8c7e('0xd')](_0x8c7e('0x1e'),_0x17d3f6[_0x8c7e('0xf')],_0x1734ff);_0x27a2c7(_0x1e76fb[_0x8c7e('0xd')](0x1f4,_0x17d3f6[_0x8c7e('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 11e7e80..7728b82 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 _0x76d2=['fs-extra','../../components/auth/service','./intDynamics365Configuration.controller','get','isAuthenticated','index','/:id','show','getFields','/:id/subjects','getSubjects','getDescriptions','post','create','put','delete','destroy','exports','multer','util','path','express','Router'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0x76d2,0xf8));var _0x276d=function(_0x4126dc,_0x1430f8){_0x4126dc=_0x4126dc-0x0;var _0xef998b=_0x76d2[_0x4126dc];return _0xef998b;};'use strict';var multer=require(_0x276d('0x0'));var util=require(_0x276d('0x1'));var path=require(_0x276d('0x2'));var timeout=require('connect-timeout');var express=require(_0x276d('0x3'));var router=express[_0x276d('0x4')]();var fs_extra=require(_0x276d('0x5'));var auth=require(_0x276d('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x276d('0x7'));router[_0x276d('0x8')]('/',auth[_0x276d('0x9')](),controller[_0x276d('0xa')]);router[_0x276d('0x8')](_0x276d('0xb'),auth[_0x276d('0x9')](),controller[_0x276d('0xc')]);router[_0x276d('0x8')]('/:id/fields',auth['isAuthenticated'](),controller[_0x276d('0xd')]);router[_0x276d('0x8')](_0x276d('0xe'),auth[_0x276d('0x9')](),controller[_0x276d('0xf')]);router[_0x276d('0x8')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0x276d('0x10')]);router[_0x276d('0x11')]('/',auth[_0x276d('0x9')](),controller[_0x276d('0x12')]);router[_0x276d('0x13')](_0x276d('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x276d('0x14')](_0x276d('0xb'),auth[_0x276d('0x9')](),controller[_0x276d('0x15')]);module[_0x276d('0x16')]=router; \ No newline at end of file +var _0x32b6=['put','delete','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','index','/:id','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','post','create'];(function(_0x5280eb,_0x293fb6){var _0x4da89f=function(_0x243d65){while(--_0x243d65){_0x5280eb['push'](_0x5280eb['shift']());}};_0x4da89f(++_0x293fb6);}(_0x32b6,0x1d1));var _0x632b=function(_0xeb0d8,_0x20a6d3){_0xeb0d8=_0xeb0d8-0x0;var _0x50857d=_0x32b6[_0xeb0d8];return _0x50857d;};'use strict';var multer=require(_0x632b('0x0'));var util=require(_0x632b('0x1'));var path=require('path');var timeout=require(_0x632b('0x2'));var express=require(_0x632b('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x632b('0x4'));var interaction=require(_0x632b('0x5'));var config=require(_0x632b('0x6'));var controller=require(_0x632b('0x7'));router[_0x632b('0x8')]('/',auth[_0x632b('0x9')](),controller[_0x632b('0xa')]);router[_0x632b('0x8')](_0x632b('0xb'),auth[_0x632b('0x9')](),controller['show']);router[_0x632b('0x8')](_0x632b('0xc'),auth[_0x632b('0x9')](),controller[_0x632b('0xd')]);router['get']('/:id/subjects',auth['isAuthenticated'](),controller[_0x632b('0xe')]);router['get'](_0x632b('0xf'),auth[_0x632b('0x9')](),controller[_0x632b('0x10')]);router[_0x632b('0x11')]('/',auth[_0x632b('0x9')](),controller[_0x632b('0x12')]);router[_0x632b('0x13')](_0x632b('0xb'),auth[_0x632b('0x9')](),controller['update']);router[_0x632b('0x14')](_0x632b('0xb'),auth[_0x632b('0x9')](),controller['destroy']);module[_0x632b('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index e81d503..f2cbb81 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 _0x5128=['sequelize','exports','STRING','ENUM','contact','nothing','BOOLEAN'];(function(_0x13de42,_0x546b9a){var _0x3debb9=function(_0x3f896b){while(--_0x3f896b){_0x13de42['push'](_0x13de42['shift']());}};_0x3debb9(++_0x546b9a);}(_0x5128,0x1b9));var _0x8512=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0x5128[_0x47b58b];return _0x46bebe;};'use strict';var Sequelize=require(_0x8512('0x0'));module[_0x8512('0x1')]={'name':{'type':Sequelize[_0x8512('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x8512('0x3')]('incident','phonecall'),'defaultValue':'incident'},'moduleCreate':{'type':Sequelize['ENUM'](_0x8512('0x4'),_0x8512('0x5')),'defaultValue':_0x8512('0x4'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x8512('0x2')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x8512('0x6')],'defaultValue':!![]}}; \ No newline at end of file +var _0x1363=['STRING','ENUM','incident','contact','nothing','BOOLEAN','sequelize','exports'];(function(_0x349148,_0x31eabb){var _0x2f2b0f=function(_0x44726e){while(--_0x44726e){_0x349148['push'](_0x349148['shift']());}};_0x2f2b0f(++_0x31eabb);}(_0x1363,0x96));var _0x3136=function(_0x91bf9f,_0xb0192f){_0x91bf9f=_0x91bf9f-0x0;var _0x28a889=_0x1363[_0x91bf9f];return _0x28a889;};'use strict';var Sequelize=require(_0x3136('0x0'));module[_0x3136('0x1')]={'name':{'type':Sequelize[_0x3136('0x2')]},'description':{'type':Sequelize[_0x3136('0x2')]},'ticketType':{'type':Sequelize[_0x3136('0x3')](_0x3136('0x4'),'phonecall'),'defaultValue':_0x3136('0x4')},'moduleCreate':{'type':Sequelize[_0x3136('0x3')](_0x3136('0x5'),_0x3136('0x6')),'defaultValue':_0x3136('0x5'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x3136('0x2')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x3136('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 362a587..a1c5bc4 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 _0x136b=['sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','params','rawAttributes','find','catch','create','body','getFields','findOne','nolimit','getSubjects','getDescriptions','eml-format','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','Dynamics365Configuration','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order'];(function(_0xa4bb0d,_0x13aa9d){var _0xa50b08=function(_0x4d3ee5){while(--_0x4d3ee5){_0xa4bb0d['push'](_0xa4bb0d['shift']());}};_0xa50b08(++_0x13aa9d);}(_0x136b,0x1df));var _0xb136=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0x136b[_0xae7c2f];return _0x5d7001;};'use strict';var emlformat=require(_0xb136('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb136('0x1'));var rp=require(_0xb136('0x2'));var moment=require(_0xb136('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xb136('0x4'));var util=require('util');var path=require(_0xb136('0x5'));var sox=require(_0xb136('0x6'));var csv=require(_0xb136('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb136('0x8'));var squel=require(_0xb136('0x9'));var crypto=require(_0xb136('0xa'));var jsforce=require(_0xb136('0xb'));var deskjs=require(_0xb136('0xc'));var toCsv=require(_0xb136('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb136('0xd'));var authService=require(_0xb136('0xe'));var qs=require(_0xb136('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb136('0x10'));var logger=require(_0xb136('0x11'))(_0xb136('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xb136('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x10a996,_0x32c0cc){_0x32c0cc=_0x32c0cc||0xcc;return function(_0x26024b){if(_0x26024b){return _0x10a996[_0xb136('0x14')](_0x32c0cc);}return _0x10a996['status'](_0x32c0cc)[_0xb136('0x15')]();};}function respondWithResult(_0x35d113,_0x588ccd){_0x588ccd=_0x588ccd||0xc8;return function(_0x339708){if(_0x339708){return _0x35d113[_0xb136('0x16')](_0x588ccd)[_0xb136('0x17')](_0x339708);}};}function respondWithFilteredResult(_0x2f7c34,_0xf33964){return function(_0x2d9d1a){if(_0x2d9d1a){var _0x4055c6=typeof _0xf33964[_0xb136('0x18')]===_0xb136('0x19')&&typeof _0xf33964[_0xb136('0x1a')]===_0xb136('0x19');var _0xbf7527=_0x2d9d1a[_0xb136('0x1b')];var _0x11d460=_0x4055c6?0x0:_0xf33964[_0xb136('0x18')];var _0x1e5b21=_0x4055c6?_0x2d9d1a['count']:_0xf33964['offset']+_0xf33964[_0xb136('0x1a')];var _0x2322c8;if(_0x1e5b21>=_0xbf7527){_0x1e5b21=_0xbf7527;_0x2322c8=0xc8;}else{_0x2322c8=0xce;}_0x2f7c34[_0xb136('0x16')](_0x2322c8);return _0x2f7c34['set'](_0xb136('0x1c'),_0x11d460+'-'+_0x1e5b21+'/'+_0xbf7527)[_0xb136('0x17')](_0x2d9d1a);}return null;};}function patchUpdates(_0x29035f){return function(_0x2c6c7e){try{jsonpatch[_0xb136('0x1d')](_0x2c6c7e,_0x29035f,!![]);}catch(_0x53b991){return BPromise[_0xb136('0x1e')](_0x53b991);}return _0x2c6c7e['save']();};}function saveUpdates(_0x4e2e13,_0x292d39){return function(_0x262266){if(_0x262266){return _0x262266[_0xb136('0x1f')](_0x4e2e13)[_0xb136('0x20')](function(_0x26bbf1){return _0x26bbf1;});}return null;};}function removeEntity(_0x203884,_0x55ab20){return function(_0x2d988a){if(_0x2d988a){return _0x2d988a[_0xb136('0x21')]()[_0xb136('0x20')](function(){_0x203884[_0xb136('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe5827c,_0x15db2f){return function(_0x2c1be6){if(!_0x2c1be6){_0xe5827c[_0xb136('0x14')](0x194);}return _0x2c1be6;};}function handleError(_0x34ab78,_0x54bc38){_0x54bc38=_0x54bc38||0x1f4;return function(_0x39b468){logger[_0xb136('0x22')](_0x39b468[_0xb136('0x23')]);if(_0x39b468[_0xb136('0x24')]){delete _0x39b468['name'];}_0x34ab78[_0xb136('0x16')](_0x54bc38)[_0xb136('0x25')](_0x39b468);};}exports[_0xb136('0x26')]=function(_0x4cae97,_0x16ebc7){var _0x36474b={},_0x5a31a1={},_0x24512b={'count':0x0,'rows':[]};var _0xa55b8c=_[_0xb136('0x27')](db[_0xb136('0x28')]['rawAttributes'],function(_0x17437a){return{'name':_0x17437a[_0xb136('0x29')],'type':_0x17437a[_0xb136('0x2a')][_0xb136('0x2b')]};});_0x5a31a1[_0xb136('0x2c')]=_['map'](_0xa55b8c,_0xb136('0x24'));_0x5a31a1[_0xb136('0x2d')]=_[_0xb136('0x2e')](_0x4cae97[_0xb136('0x2d')]);_0x5a31a1['filters']=_[_0xb136('0x2f')](_0x5a31a1[_0xb136('0x2c')],_0x5a31a1[_0xb136('0x2d')]);_0x36474b[_0xb136('0x30')]=_[_0xb136('0x2f')](_0x5a31a1[_0xb136('0x2c')],qs['fields'](_0x4cae97[_0xb136('0x2d')][_0xb136('0x31')]));_0x36474b[_0xb136('0x30')]=_0x36474b[_0xb136('0x30')][_0xb136('0x32')]?_0x36474b['attributes']:_0x5a31a1[_0xb136('0x2c')];if(!_0x4cae97[_0xb136('0x2d')][_0xb136('0x33')]('nolimit')){_0x36474b[_0xb136('0x1a')]=qs[_0xb136('0x1a')](_0x4cae97[_0xb136('0x2d')][_0xb136('0x1a')]);_0x36474b[_0xb136('0x18')]=qs[_0xb136('0x18')](_0x4cae97[_0xb136('0x2d')][_0xb136('0x18')]);}_0x36474b[_0xb136('0x34')]=qs[_0xb136('0x35')](_0x4cae97[_0xb136('0x2d')][_0xb136('0x35')]);_0x36474b[_0xb136('0x36')]=qs[_0xb136('0x37')](_[_0xb136('0x38')](_0x4cae97[_0xb136('0x2d')],_0x5a31a1[_0xb136('0x37')]),_0xa55b8c);if(_0x4cae97[_0xb136('0x2d')]['filter']){_0x36474b[_0xb136('0x36')]=_[_0xb136('0x39')](_0x36474b[_0xb136('0x36')],{'$or':_[_0xb136('0x27')](_0xa55b8c,function(_0x591acf){if(_0x591acf['type']!==_0xb136('0x3a')){var _0x462ef7={};_0x462ef7[_0x591acf['name']]={'$like':'%'+_0x4cae97[_0xb136('0x2d')][_0xb136('0x3b')]+'%'};return _0x462ef7;}})});}_0x36474b=_[_0xb136('0x39')]({},_0x36474b,_0x4cae97[_0xb136('0x3c')]);var _0x4976bb={'where':_0x36474b[_0xb136('0x36')]};return db[_0xb136('0x28')][_0xb136('0x1b')](_0x4976bb)['then'](function(_0x33440c){_0x24512b[_0xb136('0x1b')]=_0x33440c;if(_0x4cae97[_0xb136('0x2d')][_0xb136('0x3d')]){_0x36474b[_0xb136('0x3e')]=[{'all':!![]}];}return db[_0xb136('0x28')][_0xb136('0x3f')](_0x36474b);})[_0xb136('0x20')](function(_0x59151f){_0x24512b[_0xb136('0x40')]=_0x59151f;return _0x24512b;})[_0xb136('0x20')](respondWithFilteredResult(_0x16ebc7,_0x36474b))['catch'](handleError(_0x16ebc7,null));};exports['show']=function(_0x91359c,_0x4c681f){var _0x51f78e={'raw':![],'where':{'id':_0x91359c[_0xb136('0x41')]['id']}},_0x526a25={};_0x526a25[_0xb136('0x2c')]=_['keys'](db[_0xb136('0x28')][_0xb136('0x42')]);_0x526a25['query']=_[_0xb136('0x2e')](_0x91359c[_0xb136('0x2d')]);_0x526a25[_0xb136('0x37')]=_[_0xb136('0x2f')](_0x526a25[_0xb136('0x2c')],_0x526a25[_0xb136('0x2d')]);_0x51f78e[_0xb136('0x30')]=_[_0xb136('0x2f')](_0x526a25[_0xb136('0x2c')],qs[_0xb136('0x31')](_0x91359c[_0xb136('0x2d')][_0xb136('0x31')]));_0x51f78e[_0xb136('0x30')]=_0x51f78e[_0xb136('0x30')][_0xb136('0x32')]?_0x51f78e[_0xb136('0x30')]:_0x526a25['model'];if(_0x91359c[_0xb136('0x2d')]['includeAll']){_0x51f78e[_0xb136('0x3e')]=[{'all':!![]}];}_0x51f78e=_[_0xb136('0x39')]({},_0x51f78e,_0x91359c['options']);return db[_0xb136('0x28')][_0xb136('0x43')](_0x51f78e)[_0xb136('0x20')](handleEntityNotFound(_0x4c681f,null))[_0xb136('0x20')](respondWithResult(_0x4c681f,null))[_0xb136('0x44')](handleError(_0x4c681f,null));};exports[_0xb136('0x45')]=function(_0x5c1fec,_0x42d1db){return db['Dynamics365Configuration'][_0xb136('0x45')](_0x5c1fec[_0xb136('0x46')],{})[_0xb136('0x20')](respondWithResult(_0x42d1db,0xc9))[_0xb136('0x44')](handleError(_0x42d1db,null));};exports[_0xb136('0x1f')]=function(_0x316e69,_0x1cc4c4){if(_0x316e69[_0xb136('0x46')]['id']){delete _0x316e69['body']['id'];}return db[_0xb136('0x28')]['find']({'where':{'id':_0x316e69['params']['id']}})[_0xb136('0x20')](handleEntityNotFound(_0x1cc4c4,null))[_0xb136('0x20')](saveUpdates(_0x316e69['body'],null))[_0xb136('0x20')](respondWithResult(_0x1cc4c4,null))[_0xb136('0x44')](handleError(_0x1cc4c4,null));};exports[_0xb136('0x21')]=function(_0x22404d,_0x4935c3){return db[_0xb136('0x28')][_0xb136('0x43')]({'where':{'id':_0x22404d[_0xb136('0x41')]['id']}})[_0xb136('0x20')](handleEntityNotFound(_0x4935c3,null))[_0xb136('0x20')](removeEntity(_0x4935c3,null))[_0xb136('0x44')](handleError(_0x4935c3,null));};exports[_0xb136('0x47')]=function(_0x2c2077,_0x280988,_0x509fde){var _0xa4118d={};var _0x7056b6={};var _0x100a64;var _0x28aa7e;return db[_0xb136('0x28')][_0xb136('0x48')]({'where':{'id':_0x2c2077[_0xb136('0x41')]['id']}})[_0xb136('0x20')](handleEntityNotFound(_0x280988,null))['then'](function(_0x4a7f9a){if(_0x4a7f9a){_0x100a64=_0x4a7f9a;_0x7056b6[_0xb136('0x2c')]=_[_0xb136('0x2e')](db['Dynamics365Field'][_0xb136('0x42')]);_0x7056b6[_0xb136('0x2d')]=_[_0xb136('0x2e')](_0x2c2077[_0xb136('0x2d')]);_0x7056b6['filters']=_['intersection'](_0x7056b6[_0xb136('0x2c')],_0x7056b6[_0xb136('0x2d')]);_0xa4118d[_0xb136('0x30')]=_[_0xb136('0x2f')](_0x7056b6[_0xb136('0x2c')],qs[_0xb136('0x31')](_0x2c2077['query'][_0xb136('0x31')]));_0xa4118d['attributes']=_0xa4118d[_0xb136('0x30')]['length']?_0xa4118d[_0xb136('0x30')]:_0x7056b6[_0xb136('0x2c')];_0xa4118d['order']=qs['sort'](_0x2c2077[_0xb136('0x2d')][_0xb136('0x35')]);_0xa4118d[_0xb136('0x36')]=qs['filters'](_['pick'](_0x2c2077['query'],_0x7056b6['filters']));if(_0x2c2077['query'][_0xb136('0x3b')]){_0xa4118d['where']=_[_0xb136('0x39')](_0xa4118d['where'],{'$or':_[_0xb136('0x27')](_0xa4118d['attributes'],function(_0x538acf){var _0x30f399={};_0x30f399[_0x538acf]={'$like':'%'+_0x2c2077['query']['filter']+'%'};return _0x30f399;})});}_0xa4118d=_[_0xb136('0x39')]({},_0xa4118d,_0x2c2077[_0xb136('0x3c')]);return _0x100a64[_0xb136('0x47')](_0xa4118d);}})[_0xb136('0x20')](function(_0x3dda6f){if(_0x3dda6f){_0x28aa7e=_0x3dda6f['length'];if(!_0x2c2077['query'][_0xb136('0x33')](_0xb136('0x49'))){_0xa4118d[_0xb136('0x1a')]=qs[_0xb136('0x1a')](_0x2c2077[_0xb136('0x2d')][_0xb136('0x1a')]);_0xa4118d[_0xb136('0x18')]=qs['offset'](_0x2c2077[_0xb136('0x2d')][_0xb136('0x18')]);}return _0x100a64['getFields'](_0xa4118d);}})[_0xb136('0x20')](function(_0x258441){if(_0x258441){return _0x258441?{'count':_0x28aa7e,'rows':_0x258441}:null;}})[_0xb136('0x20')](respondWithResult(_0x280988,null))[_0xb136('0x44')](handleError(_0x280988,null));};exports[_0xb136('0x4a')]=function(_0x2ebad,_0x2cf324,_0x56abeb){var _0x591cc6={};var _0x2f7c29={};var _0x238cbe;var _0x1bd899;return db[_0xb136('0x28')]['findOne']({'where':{'id':_0x2ebad[_0xb136('0x41')]['id']}})['then'](handleEntityNotFound(_0x2cf324,null))[_0xb136('0x20')](function(_0x393d94){if(_0x393d94){_0x238cbe=_0x393d94;_0x2f7c29[_0xb136('0x2c')]=_[_0xb136('0x2e')](db['Dynamics365Field']['rawAttributes']);_0x2f7c29['query']=_[_0xb136('0x2e')](_0x2ebad[_0xb136('0x2d')]);_0x2f7c29[_0xb136('0x37')]=_[_0xb136('0x2f')](_0x2f7c29[_0xb136('0x2c')],_0x2f7c29[_0xb136('0x2d')]);_0x591cc6[_0xb136('0x30')]=_[_0xb136('0x2f')](_0x2f7c29['model'],qs[_0xb136('0x31')](_0x2ebad[_0xb136('0x2d')][_0xb136('0x31')]));_0x591cc6[_0xb136('0x30')]=_0x591cc6[_0xb136('0x30')]['length']?_0x591cc6[_0xb136('0x30')]:_0x2f7c29[_0xb136('0x2c')];_0x591cc6[_0xb136('0x34')]=qs[_0xb136('0x35')](_0x2ebad[_0xb136('0x2d')]['sort']);_0x591cc6[_0xb136('0x36')]=qs[_0xb136('0x37')](_[_0xb136('0x38')](_0x2ebad[_0xb136('0x2d')],_0x2f7c29[_0xb136('0x37')]));if(_0x2ebad[_0xb136('0x2d')][_0xb136('0x3b')]){_0x591cc6[_0xb136('0x36')]=_['merge'](_0x591cc6[_0xb136('0x36')],{'$or':_[_0xb136('0x27')](_0x591cc6['attributes'],function(_0x3a7cc5){var _0x1c6aa8={};_0x1c6aa8[_0x3a7cc5]={'$like':'%'+_0x2ebad[_0xb136('0x2d')][_0xb136('0x3b')]+'%'};return _0x1c6aa8;})});}_0x591cc6=_[_0xb136('0x39')]({},_0x591cc6,_0x2ebad['options']);return _0x238cbe[_0xb136('0x4a')](_0x591cc6);}})[_0xb136('0x20')](function(_0x1fd1f8){if(_0x1fd1f8){_0x1bd899=_0x1fd1f8[_0xb136('0x32')];if(!_0x2ebad[_0xb136('0x2d')][_0xb136('0x33')](_0xb136('0x49'))){_0x591cc6[_0xb136('0x1a')]=qs[_0xb136('0x1a')](_0x2ebad[_0xb136('0x2d')]['limit']);_0x591cc6[_0xb136('0x18')]=qs[_0xb136('0x18')](_0x2ebad['query'][_0xb136('0x18')]);}return _0x238cbe[_0xb136('0x4a')](_0x591cc6);}})[_0xb136('0x20')](function(_0xde3592){if(_0xde3592){return _0xde3592?{'count':_0x1bd899,'rows':_0xde3592}:null;}})[_0xb136('0x20')](respondWithResult(_0x2cf324,null))[_0xb136('0x44')](handleError(_0x2cf324,null));};exports[_0xb136('0x4b')]=function(_0x1ce332,_0x558e51,_0x3289de){var _0x62dc72={};var _0x188b28={};var _0x5666ff;var _0x5bd610;return db['Dynamics365Configuration']['findOne']({'where':{'id':_0x1ce332['params']['id']}})[_0xb136('0x20')](handleEntityNotFound(_0x558e51,null))[_0xb136('0x20')](function(_0x67552e){if(_0x67552e){_0x5666ff=_0x67552e;_0x188b28[_0xb136('0x2c')]=_[_0xb136('0x2e')](db['Dynamics365Field'][_0xb136('0x42')]);_0x188b28[_0xb136('0x2d')]=_['keys'](_0x1ce332[_0xb136('0x2d')]);_0x188b28[_0xb136('0x37')]=_[_0xb136('0x2f')](_0x188b28[_0xb136('0x2c')],_0x188b28[_0xb136('0x2d')]);_0x62dc72['attributes']=_[_0xb136('0x2f')](_0x188b28[_0xb136('0x2c')],qs[_0xb136('0x31')](_0x1ce332[_0xb136('0x2d')]['fields']));_0x62dc72['attributes']=_0x62dc72[_0xb136('0x30')]['length']?_0x62dc72[_0xb136('0x30')]:_0x188b28['model'];_0x62dc72[_0xb136('0x34')]=qs['sort'](_0x1ce332['query'][_0xb136('0x35')]);_0x62dc72[_0xb136('0x36')]=qs[_0xb136('0x37')](_['pick'](_0x1ce332[_0xb136('0x2d')],_0x188b28[_0xb136('0x37')]));if(_0x1ce332[_0xb136('0x2d')]['filter']){_0x62dc72['where']=_[_0xb136('0x39')](_0x62dc72['where'],{'$or':_[_0xb136('0x27')](_0x62dc72[_0xb136('0x30')],function(_0x59a7d5){var _0x3bd853={};_0x3bd853[_0x59a7d5]={'$like':'%'+_0x1ce332[_0xb136('0x2d')][_0xb136('0x3b')]+'%'};return _0x3bd853;})});}_0x62dc72=_[_0xb136('0x39')]({},_0x62dc72,_0x1ce332[_0xb136('0x3c')]);return _0x5666ff[_0xb136('0x4b')](_0x62dc72);}})[_0xb136('0x20')](function(_0x2e5e2f){if(_0x2e5e2f){_0x5bd610=_0x2e5e2f[_0xb136('0x32')];if(!_0x1ce332[_0xb136('0x2d')][_0xb136('0x33')](_0xb136('0x49'))){_0x62dc72['limit']=qs[_0xb136('0x1a')](_0x1ce332[_0xb136('0x2d')][_0xb136('0x1a')]);_0x62dc72[_0xb136('0x18')]=qs[_0xb136('0x18')](_0x1ce332[_0xb136('0x2d')][_0xb136('0x18')]);}return _0x5666ff['getDescriptions'](_0x62dc72);}})[_0xb136('0x20')](function(_0x5c323d){if(_0x5c323d){return _0x5c323d?{'count':_0x5bd610,'rows':_0x5c323d}:null;}})[_0xb136('0x20')](respondWithResult(_0x558e51,null))[_0xb136('0x44')](handleError(_0x558e51,null));}; \ No newline at end of file +var _0x4420=['update','destroy','then','error','stack','name','send','index','map','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','sort','pick','filter','where','merge','VIRTUAL','count','includeAll','include','Dynamics365Configuration','findAll','rows','catch','params','length','options','find','create','body','getFields','findOne','Dynamics365Field','rawAttributes','hasOwnProperty','nolimit','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','offset','undefined','limit','set','json','apply','reject','save'];(function(_0x17c8a9,_0x531ca3){var _0x379aa6=function(_0x5ba780){while(--_0x5ba780){_0x17c8a9['push'](_0x17c8a9['shift']());}};_0x379aa6(++_0x531ca3);}(_0x4420,0x1d2));var _0x0442=function(_0x372c2f,_0xf4ff5c){_0x372c2f=_0x372c2f-0x0;var _0x366796=_0x4420[_0x372c2f];return _0x366796;};'use strict';var emlformat=require(_0x0442('0x0'));var rimraf=require(_0x0442('0x1'));var zipdir=require(_0x0442('0x2'));var jsonpatch=require(_0x0442('0x3'));var rp=require(_0x0442('0x4'));var moment=require(_0x0442('0x5'));var BPromise=require(_0x0442('0x6'));var Mustache=require(_0x0442('0x7'));var util=require('util');var path=require(_0x0442('0x8'));var sox=require(_0x0442('0x9'));var csv=require(_0x0442('0xa'));var ejs=require(_0x0442('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x0442('0xc'));var crypto=require(_0x0442('0xd'));var jsforce=require(_0x0442('0xe'));var deskjs=require(_0x0442('0xf'));var toCsv=require(_0x0442('0xa'));var querystring=require(_0x0442('0x10'));var Papa=require(_0x0442('0x11'));var Redis=require(_0x0442('0x12'));var authService=require(_0x0442('0x13'));var qs=require(_0x0442('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0442('0x15'));var logger=require(_0x0442('0x16'))(_0x0442('0x17'));var utils=require(_0x0442('0x18'));var config=require(_0x0442('0x19'));var licenseUtil=require(_0x0442('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xa86de3,_0x279ecf){_0x279ecf=_0x279ecf||0xcc;return function(_0x18a879){if(_0x18a879){return _0xa86de3[_0x0442('0x1b')](_0x279ecf);}return _0xa86de3['status'](_0x279ecf)[_0x0442('0x1c')]();};}function respondWithResult(_0x29b4da,_0x3d9b62){_0x3d9b62=_0x3d9b62||0xc8;return function(_0x397d65){if(_0x397d65){return _0x29b4da[_0x0442('0x1d')](_0x3d9b62)['json'](_0x397d65);}};}function respondWithFilteredResult(_0x3a780a,_0x92e27a){return function(_0xc8aa34){if(_0xc8aa34){var _0x16d5ce=typeof _0x92e27a[_0x0442('0x1e')]===_0x0442('0x1f')&&typeof _0x92e27a[_0x0442('0x20')]===_0x0442('0x1f');var _0x5a8d68=_0xc8aa34['count'];var _0x5c0d4e=_0x16d5ce?0x0:_0x92e27a['offset'];var _0x2c7630=_0x16d5ce?_0xc8aa34['count']:_0x92e27a[_0x0442('0x1e')]+_0x92e27a[_0x0442('0x20')];var _0xf69741;if(_0x2c7630>=_0x5a8d68){_0x2c7630=_0x5a8d68;_0xf69741=0xc8;}else{_0xf69741=0xce;}_0x3a780a[_0x0442('0x1d')](_0xf69741);return _0x3a780a[_0x0442('0x21')]('Content-Range',_0x5c0d4e+'-'+_0x2c7630+'/'+_0x5a8d68)[_0x0442('0x22')](_0xc8aa34);}return null;};}function patchUpdates(_0x423233){return function(_0x5a29e3){try{jsonpatch[_0x0442('0x23')](_0x5a29e3,_0x423233,!![]);}catch(_0x19888e){return BPromise[_0x0442('0x24')](_0x19888e);}return _0x5a29e3[_0x0442('0x25')]();};}function saveUpdates(_0xa732e7,_0x5100dd){return function(_0x27d9cf){if(_0x27d9cf){return _0x27d9cf[_0x0442('0x26')](_0xa732e7)['then'](function(_0x322b60){return _0x322b60;});}return null;};}function removeEntity(_0x4dc35,_0x45c1e6){return function(_0x103194){if(_0x103194){return _0x103194[_0x0442('0x27')]()[_0x0442('0x28')](function(){_0x4dc35[_0x0442('0x1d')](0xcc)[_0x0442('0x1c')]();});}};}function handleEntityNotFound(_0x1f1cff,_0x21dca8){return function(_0x534124){if(!_0x534124){_0x1f1cff[_0x0442('0x1b')](0x194);}return _0x534124;};}function handleError(_0x42529d,_0xaeda72){_0xaeda72=_0xaeda72||0x1f4;return function(_0x3e0544){logger[_0x0442('0x29')](_0x3e0544[_0x0442('0x2a')]);if(_0x3e0544[_0x0442('0x2b')]){delete _0x3e0544['name'];}_0x42529d[_0x0442('0x1d')](_0xaeda72)[_0x0442('0x2c')](_0x3e0544);};}exports[_0x0442('0x2d')]=function(_0x5214fe,_0x57f307){var _0x504143={},_0x329c39={},_0x42d137={'count':0x0,'rows':[]};var _0x4244ff=_[_0x0442('0x2e')](db['Dynamics365Configuration']['rawAttributes'],function(_0x4b905a){return{'name':_0x4b905a[_0x0442('0x2f')],'type':_0x4b905a[_0x0442('0x30')][_0x0442('0x31')]};});_0x329c39['model']=_[_0x0442('0x2e')](_0x4244ff,_0x0442('0x2b'));_0x329c39[_0x0442('0x32')]=_[_0x0442('0x33')](_0x5214fe[_0x0442('0x32')]);_0x329c39[_0x0442('0x34')]=_[_0x0442('0x35')](_0x329c39[_0x0442('0x36')],_0x329c39[_0x0442('0x32')]);_0x504143[_0x0442('0x37')]=_[_0x0442('0x35')](_0x329c39[_0x0442('0x36')],qs[_0x0442('0x38')](_0x5214fe[_0x0442('0x32')]['fields']));_0x504143[_0x0442('0x37')]=_0x504143[_0x0442('0x37')]['length']?_0x504143['attributes']:_0x329c39[_0x0442('0x36')];if(!_0x5214fe[_0x0442('0x32')]['hasOwnProperty']('nolimit')){_0x504143[_0x0442('0x20')]=qs['limit'](_0x5214fe[_0x0442('0x32')][_0x0442('0x20')]);_0x504143['offset']=qs['offset'](_0x5214fe[_0x0442('0x32')]['offset']);}_0x504143['order']=qs[_0x0442('0x39')](_0x5214fe[_0x0442('0x32')][_0x0442('0x39')]);_0x504143['where']=qs['filters'](_[_0x0442('0x3a')](_0x5214fe[_0x0442('0x32')],_0x329c39[_0x0442('0x34')]),_0x4244ff);if(_0x5214fe[_0x0442('0x32')][_0x0442('0x3b')]){_0x504143[_0x0442('0x3c')]=_[_0x0442('0x3d')](_0x504143[_0x0442('0x3c')],{'$or':_['map'](_0x4244ff,function(_0x474f14){if(_0x474f14[_0x0442('0x30')]!==_0x0442('0x3e')){var _0x596a85={};_0x596a85[_0x474f14[_0x0442('0x2b')]]={'$like':'%'+_0x5214fe[_0x0442('0x32')][_0x0442('0x3b')]+'%'};return _0x596a85;}})});}_0x504143=_[_0x0442('0x3d')]({},_0x504143,_0x5214fe['options']);var _0xc32a55={'where':_0x504143['where']};return db['Dynamics365Configuration'][_0x0442('0x3f')](_0xc32a55)[_0x0442('0x28')](function(_0x198933){_0x42d137[_0x0442('0x3f')]=_0x198933;if(_0x5214fe[_0x0442('0x32')][_0x0442('0x40')]){_0x504143[_0x0442('0x41')]=[{'all':!![]}];}return db[_0x0442('0x42')][_0x0442('0x43')](_0x504143);})['then'](function(_0x483c82){_0x42d137[_0x0442('0x44')]=_0x483c82;return _0x42d137;})[_0x0442('0x28')](respondWithFilteredResult(_0x57f307,_0x504143))[_0x0442('0x45')](handleError(_0x57f307,null));};exports['show']=function(_0xe58d1e,_0x1fdad7){var _0x272010={'raw':![],'where':{'id':_0xe58d1e[_0x0442('0x46')]['id']}},_0xec9451={};_0xec9451[_0x0442('0x36')]=_[_0x0442('0x33')](db['Dynamics365Configuration']['rawAttributes']);_0xec9451[_0x0442('0x32')]=_[_0x0442('0x33')](_0xe58d1e['query']);_0xec9451[_0x0442('0x34')]=_['intersection'](_0xec9451[_0x0442('0x36')],_0xec9451[_0x0442('0x32')]);_0x272010[_0x0442('0x37')]=_[_0x0442('0x35')](_0xec9451[_0x0442('0x36')],qs[_0x0442('0x38')](_0xe58d1e[_0x0442('0x32')][_0x0442('0x38')]));_0x272010['attributes']=_0x272010[_0x0442('0x37')][_0x0442('0x47')]?_0x272010['attributes']:_0xec9451['model'];if(_0xe58d1e['query'][_0x0442('0x40')]){_0x272010[_0x0442('0x41')]=[{'all':!![]}];}_0x272010=_['merge']({},_0x272010,_0xe58d1e[_0x0442('0x48')]);return db[_0x0442('0x42')][_0x0442('0x49')](_0x272010)[_0x0442('0x28')](handleEntityNotFound(_0x1fdad7,null))[_0x0442('0x28')](respondWithResult(_0x1fdad7,null))[_0x0442('0x45')](handleError(_0x1fdad7,null));};exports[_0x0442('0x4a')]=function(_0x200a91,_0x748bcb){return db[_0x0442('0x42')][_0x0442('0x4a')](_0x200a91[_0x0442('0x4b')],{})[_0x0442('0x28')](respondWithResult(_0x748bcb,0xc9))[_0x0442('0x45')](handleError(_0x748bcb,null));};exports[_0x0442('0x26')]=function(_0x326990,_0x58a9a2){if(_0x326990[_0x0442('0x4b')]['id']){delete _0x326990[_0x0442('0x4b')]['id'];}return db[_0x0442('0x42')][_0x0442('0x49')]({'where':{'id':_0x326990[_0x0442('0x46')]['id']}})[_0x0442('0x28')](handleEntityNotFound(_0x58a9a2,null))['then'](saveUpdates(_0x326990[_0x0442('0x4b')],null))[_0x0442('0x28')](respondWithResult(_0x58a9a2,null))['catch'](handleError(_0x58a9a2,null));};exports[_0x0442('0x27')]=function(_0x58e7e2,_0x1470f3){return db[_0x0442('0x42')][_0x0442('0x49')]({'where':{'id':_0x58e7e2['params']['id']}})['then'](handleEntityNotFound(_0x1470f3,null))['then'](removeEntity(_0x1470f3,null))[_0x0442('0x45')](handleError(_0x1470f3,null));};exports[_0x0442('0x4c')]=function(_0x2d44e2,_0x1de288,_0x3233e3){var _0x5ee440={};var _0x3a3798={};var _0x3f167e;var _0xef89b4;return db[_0x0442('0x42')][_0x0442('0x4d')]({'where':{'id':_0x2d44e2[_0x0442('0x46')]['id']}})['then'](handleEntityNotFound(_0x1de288,null))['then'](function(_0x49c1e2){if(_0x49c1e2){_0x3f167e=_0x49c1e2;_0x3a3798[_0x0442('0x36')]=_[_0x0442('0x33')](db[_0x0442('0x4e')][_0x0442('0x4f')]);_0x3a3798[_0x0442('0x32')]=_[_0x0442('0x33')](_0x2d44e2[_0x0442('0x32')]);_0x3a3798[_0x0442('0x34')]=_['intersection'](_0x3a3798['model'],_0x3a3798[_0x0442('0x32')]);_0x5ee440[_0x0442('0x37')]=_[_0x0442('0x35')](_0x3a3798['model'],qs[_0x0442('0x38')](_0x2d44e2[_0x0442('0x32')][_0x0442('0x38')]));_0x5ee440['attributes']=_0x5ee440[_0x0442('0x37')]['length']?_0x5ee440['attributes']:_0x3a3798['model'];_0x5ee440['order']=qs[_0x0442('0x39')](_0x2d44e2[_0x0442('0x32')][_0x0442('0x39')]);_0x5ee440[_0x0442('0x3c')]=qs[_0x0442('0x34')](_[_0x0442('0x3a')](_0x2d44e2['query'],_0x3a3798[_0x0442('0x34')]));if(_0x2d44e2['query'][_0x0442('0x3b')]){_0x5ee440[_0x0442('0x3c')]=_['merge'](_0x5ee440[_0x0442('0x3c')],{'$or':_[_0x0442('0x2e')](_0x5ee440[_0x0442('0x37')],function(_0x4891b5){var _0x2ba23c={};_0x2ba23c[_0x4891b5]={'$like':'%'+_0x2d44e2['query']['filter']+'%'};return _0x2ba23c;})});}_0x5ee440=_['merge']({},_0x5ee440,_0x2d44e2[_0x0442('0x48')]);return _0x3f167e['getFields'](_0x5ee440);}})[_0x0442('0x28')](function(_0x3fad86){if(_0x3fad86){_0xef89b4=_0x3fad86[_0x0442('0x47')];if(!_0x2d44e2[_0x0442('0x32')][_0x0442('0x50')](_0x0442('0x51'))){_0x5ee440['limit']=qs[_0x0442('0x20')](_0x2d44e2[_0x0442('0x32')][_0x0442('0x20')]);_0x5ee440[_0x0442('0x1e')]=qs[_0x0442('0x1e')](_0x2d44e2[_0x0442('0x32')][_0x0442('0x1e')]);}return _0x3f167e[_0x0442('0x4c')](_0x5ee440);}})[_0x0442('0x28')](function(_0x56025b){if(_0x56025b){return _0x56025b?{'count':_0xef89b4,'rows':_0x56025b}:null;}})[_0x0442('0x28')](respondWithResult(_0x1de288,null))['catch'](handleError(_0x1de288,null));};exports['getSubjects']=function(_0x2f8224,_0x1f89f1,_0xfcf3c4){var _0xa43d6f={};var _0x15a318={};var _0x29fc43;var _0x2db0a2;return db[_0x0442('0x42')][_0x0442('0x4d')]({'where':{'id':_0x2f8224[_0x0442('0x46')]['id']}})[_0x0442('0x28')](handleEntityNotFound(_0x1f89f1,null))['then'](function(_0x573c56){if(_0x573c56){_0x29fc43=_0x573c56;_0x15a318[_0x0442('0x36')]=_['keys'](db[_0x0442('0x4e')][_0x0442('0x4f')]);_0x15a318[_0x0442('0x32')]=_[_0x0442('0x33')](_0x2f8224[_0x0442('0x32')]);_0x15a318[_0x0442('0x34')]=_[_0x0442('0x35')](_0x15a318[_0x0442('0x36')],_0x15a318[_0x0442('0x32')]);_0xa43d6f[_0x0442('0x37')]=_[_0x0442('0x35')](_0x15a318[_0x0442('0x36')],qs[_0x0442('0x38')](_0x2f8224[_0x0442('0x32')][_0x0442('0x38')]));_0xa43d6f[_0x0442('0x37')]=_0xa43d6f[_0x0442('0x37')][_0x0442('0x47')]?_0xa43d6f['attributes']:_0x15a318[_0x0442('0x36')];_0xa43d6f['order']=qs[_0x0442('0x39')](_0x2f8224['query'][_0x0442('0x39')]);_0xa43d6f[_0x0442('0x3c')]=qs[_0x0442('0x34')](_[_0x0442('0x3a')](_0x2f8224['query'],_0x15a318['filters']));if(_0x2f8224[_0x0442('0x32')][_0x0442('0x3b')]){_0xa43d6f[_0x0442('0x3c')]=_['merge'](_0xa43d6f[_0x0442('0x3c')],{'$or':_[_0x0442('0x2e')](_0xa43d6f[_0x0442('0x37')],function(_0x510b8){var _0x4e2a17={};_0x4e2a17[_0x510b8]={'$like':'%'+_0x2f8224[_0x0442('0x32')]['filter']+'%'};return _0x4e2a17;})});}_0xa43d6f=_[_0x0442('0x3d')]({},_0xa43d6f,_0x2f8224['options']);return _0x29fc43['getSubjects'](_0xa43d6f);}})[_0x0442('0x28')](function(_0x24cc7d){if(_0x24cc7d){_0x2db0a2=_0x24cc7d[_0x0442('0x47')];if(!_0x2f8224['query'][_0x0442('0x50')](_0x0442('0x51'))){_0xa43d6f[_0x0442('0x20')]=qs[_0x0442('0x20')](_0x2f8224[_0x0442('0x32')]['limit']);_0xa43d6f['offset']=qs[_0x0442('0x1e')](_0x2f8224['query']['offset']);}return _0x29fc43[_0x0442('0x52')](_0xa43d6f);}})[_0x0442('0x28')](function(_0x2a81da){if(_0x2a81da){return _0x2a81da?{'count':_0x2db0a2,'rows':_0x2a81da}:null;}})[_0x0442('0x28')](respondWithResult(_0x1f89f1,null))['catch'](handleError(_0x1f89f1,null));};exports[_0x0442('0x53')]=function(_0x3439f6,_0x5c3517,_0x112418){var _0x12c859={};var _0x4607cd={};var _0x2996ff;var _0x491950;return db[_0x0442('0x42')][_0x0442('0x4d')]({'where':{'id':_0x3439f6[_0x0442('0x46')]['id']}})[_0x0442('0x28')](handleEntityNotFound(_0x5c3517,null))[_0x0442('0x28')](function(_0x2de64d){if(_0x2de64d){_0x2996ff=_0x2de64d;_0x4607cd[_0x0442('0x36')]=_[_0x0442('0x33')](db[_0x0442('0x4e')][_0x0442('0x4f')]);_0x4607cd[_0x0442('0x32')]=_[_0x0442('0x33')](_0x3439f6[_0x0442('0x32')]);_0x4607cd[_0x0442('0x34')]=_['intersection'](_0x4607cd[_0x0442('0x36')],_0x4607cd['query']);_0x12c859[_0x0442('0x37')]=_[_0x0442('0x35')](_0x4607cd[_0x0442('0x36')],qs['fields'](_0x3439f6[_0x0442('0x32')][_0x0442('0x38')]));_0x12c859[_0x0442('0x37')]=_0x12c859['attributes'][_0x0442('0x47')]?_0x12c859[_0x0442('0x37')]:_0x4607cd['model'];_0x12c859['order']=qs[_0x0442('0x39')](_0x3439f6[_0x0442('0x32')][_0x0442('0x39')]);_0x12c859[_0x0442('0x3c')]=qs[_0x0442('0x34')](_[_0x0442('0x3a')](_0x3439f6['query'],_0x4607cd['filters']));if(_0x3439f6[_0x0442('0x32')]['filter']){_0x12c859[_0x0442('0x3c')]=_[_0x0442('0x3d')](_0x12c859[_0x0442('0x3c')],{'$or':_[_0x0442('0x2e')](_0x12c859[_0x0442('0x37')],function(_0x1d4570){var _0x21ccdb={};_0x21ccdb[_0x1d4570]={'$like':'%'+_0x3439f6['query'][_0x0442('0x3b')]+'%'};return _0x21ccdb;})});}_0x12c859=_['merge']({},_0x12c859,_0x3439f6[_0x0442('0x48')]);return _0x2996ff['getDescriptions'](_0x12c859);}})[_0x0442('0x28')](function(_0x184b2a){if(_0x184b2a){_0x491950=_0x184b2a[_0x0442('0x47')];if(!_0x3439f6[_0x0442('0x32')]['hasOwnProperty'](_0x0442('0x51'))){_0x12c859[_0x0442('0x20')]=qs[_0x0442('0x20')](_0x3439f6[_0x0442('0x32')][_0x0442('0x20')]);_0x12c859['offset']=qs[_0x0442('0x1e')](_0x3439f6[_0x0442('0x32')][_0x0442('0x1e')]);}return _0x2996ff[_0x0442('0x53')](_0x12c859);}})[_0x0442('0x28')](function(_0x16eea3){if(_0x16eea3){return _0x16eea3?{'count':_0x491950,'rows':_0x16eea3}:null;}})['then'](respondWithResult(_0x5c3517,null))[_0x0442('0x45')](handleError(_0x5c3517,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 78d1d3d..dcc3d29 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 _0xb821=['rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','define','Dynamics365Configuration','int_dynamics365_configurations','util','../../config/logger','bluebird'];(function(_0x2d1bb3,_0x4af288){var _0x2e7f08=function(_0x3479e9){while(--_0x3479e9){_0x2d1bb3['push'](_0x2d1bb3['shift']());}};_0x2e7f08(++_0x4af288);}(_0xb821,0xa7));var _0x1b82=function(_0x2b8c56,_0x51b551){_0x2b8c56=_0x2b8c56-0x0;var _0x1ccaf6=_0xb821[_0x2b8c56];return _0x1ccaf6;};'use strict';var _=require('lodash');var util=require(_0x1b82('0x0'));var logger=require(_0x1b82('0x1'))('api');var moment=require('moment');var BPromise=require(_0x1b82('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1b82('0x3'));var config=require(_0x1b82('0x4'));var attributes=require(_0x1b82('0x5'));module[_0x1b82('0x6')]=function(_0x597ca7,_0x3e27c4){return _0x597ca7[_0x1b82('0x7')](_0x1b82('0x8'),attributes,{'tableName':_0x1b82('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb4e6=['path','rimraf','./intDynamics365Configuration.attributes','exports','define','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x124b99,_0x3b49f9){var _0x5d0bfb=function(_0x9216a4){while(--_0x9216a4){_0x124b99['push'](_0x124b99['shift']());}};_0x5d0bfb(++_0x3b49f9);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x40d8d7,_0x30dd5e){_0x40d8d7=_0x40d8d7-0x0;var _0x3454cc=_0xb4e6[_0x40d8d7];return _0x3454cc;};'use strict';var _=require(_0x6b4e('0x0'));var util=require('util');var logger=require(_0x6b4e('0x1'))(_0x6b4e('0x2'));var moment=require(_0x6b4e('0x3'));var BPromise=require(_0x6b4e('0x4'));var rp=require(_0x6b4e('0x5'));var fs=require('fs');var path=require(_0x6b4e('0x6'));var rimraf=require(_0x6b4e('0x7'));var config=require('../../config/environment');var attributes=require(_0x6b4e('0x8'));module[_0x6b4e('0x9')]=function(_0x1f67a2,_0x49de51){return _0x1f67a2[_0x6b4e('0xa')]('Dynamics365Configuration',attributes,{'tableName':'int_dynamics365_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index 616b859..058ef2c 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 _0xcdf1=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird'];(function(_0x1f42f5,_0x4d97d4){var _0x320bca=function(_0x18a174){while(--_0x18a174){_0x1f42f5['push'](_0x1f42f5['shift']());}};_0x320bca(++_0x4d97d4);}(_0xcdf1,0x16d));var _0x1cdf=function(_0x4b9bfb,_0x4ee2f8){_0x4b9bfb=_0x4b9bfb-0x0;var _0x5e1344=_0xcdf1[_0x4b9bfb];return _0x5e1344;};'use strict';var _=require('lodash');var util=require(_0x1cdf('0x0'));var moment=require(_0x1cdf('0x1'));var BPromise=require(_0x1cdf('0x2'));var rs=require(_0x1cdf('0x3'));var fs=require('fs');var Redis=require(_0x1cdf('0x4'));var db=require(_0x1cdf('0x5'))['db'];var utils=require(_0x1cdf('0x6'));var logger=require(_0x1cdf('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x1cdf('0x8'));var client=jayson[_0x1cdf('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x33bb60,_0x2b900a,_0x575c4c){return new BPromise(function(_0x2211ed,_0x470d82){return client[_0x1cdf('0xa')](_0x33bb60,_0x575c4c)[_0x1cdf('0xb')](function(_0x381ab8){logger[_0x1cdf('0xc')](_0x1cdf('0xd'),_0x2b900a,_0x1cdf('0xe'));logger[_0x1cdf('0xf')](_0x1cdf('0x10'),_0x2b900a,_0x1cdf('0xe'),JSON[_0x1cdf('0x11')](_0x381ab8));if(_0x381ab8[_0x1cdf('0x12')]){if(_0x381ab8[_0x1cdf('0x12')][_0x1cdf('0x13')]===0x1f4){logger[_0x1cdf('0x12')]('Dynamics365Configuration,\x20%s,\x20%s',_0x2b900a,_0x381ab8[_0x1cdf('0x12')][_0x1cdf('0x14')]);return _0x470d82(_0x381ab8[_0x1cdf('0x12')][_0x1cdf('0x14')]);}logger[_0x1cdf('0x12')](_0x1cdf('0xd'),_0x2b900a,_0x381ab8[_0x1cdf('0x12')][_0x1cdf('0x14')]);return _0x2211ed(_0x381ab8['error'][_0x1cdf('0x14')]);}else{logger['info'](_0x1cdf('0xd'),_0x2b900a,_0x1cdf('0xe'));_0x2211ed(_0x381ab8[_0x1cdf('0x15')][_0x1cdf('0x14')]);}})[_0x1cdf('0x16')](function(_0x61d019){logger['error'](_0x1cdf('0xd'),_0x2b900a,_0x61d019);_0x470d82(_0x61d019);});});} \ No newline at end of file +var _0x45cf=['error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../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'];(function(_0x3337ca,_0x4b4423){var _0x202505=function(_0x43a37e){while(--_0x43a37e){_0x3337ca['push'](_0x3337ca['shift']());}};_0x202505(++_0x4b4423);}(_0x45cf,0xbd));var _0xf45c=function(_0x50b4f5,_0x1220a9){_0x50b4f5=_0x50b4f5-0x0;var _0x34e486=_0x45cf[_0x50b4f5];return _0x34e486;};'use strict';var _=require(_0xf45c('0x0'));var util=require(_0xf45c('0x1'));var moment=require(_0xf45c('0x2'));var BPromise=require(_0xf45c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf45c('0x4'));var db=require(_0xf45c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf45c('0x6'))(_0xf45c('0x7'));var config=require(_0xf45c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xf45c('0x9')][_0xf45c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x51e03c,_0x56e92c,_0x334c38){return new BPromise(function(_0x4cf9a3,_0xa1043b){return client[_0xf45c('0xb')](_0x51e03c,_0x334c38)['then'](function(_0x4469e4){logger[_0xf45c('0xc')](_0xf45c('0xd'),_0x56e92c,_0xf45c('0xe'));logger[_0xf45c('0xf')](_0xf45c('0x10'),_0x56e92c,_0xf45c('0xe'),JSON[_0xf45c('0x11')](_0x4469e4));if(_0x4469e4[_0xf45c('0x12')]){if(_0x4469e4[_0xf45c('0x12')][_0xf45c('0x13')]===0x1f4){logger['error']('Dynamics365Configuration,\x20%s,\x20%s',_0x56e92c,_0x4469e4[_0xf45c('0x12')][_0xf45c('0x14')]);return _0xa1043b(_0x4469e4['error'][_0xf45c('0x14')]);}logger[_0xf45c('0x12')](_0xf45c('0xd'),_0x56e92c,_0x4469e4[_0xf45c('0x12')][_0xf45c('0x14')]);return _0x4cf9a3(_0x4469e4[_0xf45c('0x12')][_0xf45c('0x14')]);}else{logger[_0xf45c('0xc')]('Dynamics365Configuration,\x20%s,\x20%s',_0x56e92c,_0xf45c('0xe'));_0x4cf9a3(_0x4469e4[_0xf45c('0x15')][_0xf45c('0x14')]);}})[_0xf45c('0x16')](function(_0x56f258){logger[_0xf45c('0x12')](_0xf45c('0xd'),_0x56e92c,_0x56f258);_0xa1043b(_0x56f258);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index a735094..db4a15d 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 _0xb23c=['update','delete','exports','util','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','index','/:id','post','create','put'];(function(_0x3b9e7c,_0x3a80d){var _0x169664=function(_0x12fd5a){while(--_0x12fd5a){_0x3b9e7c['push'](_0x3b9e7c['shift']());}};_0x169664(++_0x3a80d);}(_0xb23c,0x1f3));var _0xcb23=function(_0x29b27d,_0x4363a0){_0x29b27d=_0x29b27d-0x0;var _0x39327c=_0xb23c[_0x29b27d];return _0x39327c;};'use strict';var multer=require('multer');var util=require(_0xcb23('0x0'));var path=require('path');var timeout=require(_0xcb23('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xcb23('0x2'));var auth=require(_0xcb23('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xcb23('0x4'));var controller=require(_0xcb23('0x5'));router[_0xcb23('0x6')]('/',auth[_0xcb23('0x7')](),controller[_0xcb23('0x8')]);router[_0xcb23('0x6')](_0xcb23('0x9'),auth['isAuthenticated'](),controller['show']);router[_0xcb23('0xa')]('/',auth[_0xcb23('0x7')](),controller[_0xcb23('0xb')]);router[_0xcb23('0xc')](_0xcb23('0x9'),auth[_0xcb23('0x7')](),controller[_0xcb23('0xd')]);router[_0xcb23('0xe')]('/:id',auth[_0xcb23('0x7')](),controller['destroy']);module[_0xcb23('0xf')]=router; \ No newline at end of file +var _0x7435=['put','delete','exports','multer','util','path','express','fs-extra','../../components/interaction/service','./intDynamics365Field.controller','get','index','/:id','isAuthenticated','show','post','create'];(function(_0x383b2e,_0x30abd6){var _0x56a2b9=function(_0x160239){while(--_0x160239){_0x383b2e['push'](_0x383b2e['shift']());}};_0x56a2b9(++_0x30abd6);}(_0x7435,0x157));var _0x5743=function(_0x59cf5e,_0x36edbf){_0x59cf5e=_0x59cf5e-0x0;var _0x17ef1d=_0x7435[_0x59cf5e];return _0x17ef1d;};'use strict';var multer=require(_0x5743('0x0'));var util=require(_0x5743('0x1'));var path=require(_0x5743('0x2'));var timeout=require('connect-timeout');var express=require(_0x5743('0x3'));var router=express['Router']();var fs_extra=require(_0x5743('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x5743('0x5'));var config=require('../../config/environment');var controller=require(_0x5743('0x6'));router[_0x5743('0x7')]('/',auth['isAuthenticated'](),controller[_0x5743('0x8')]);router['get'](_0x5743('0x9'),auth[_0x5743('0xa')](),controller[_0x5743('0xb')]);router[_0x5743('0xc')]('/',auth[_0x5743('0xa')](),controller[_0x5743('0xd')]);router[_0x5743('0xe')](_0x5743('0x9'),auth[_0x5743('0xa')](),controller['update']);router[_0x5743('0xf')](_0x5743('0x9'),auth[_0x5743('0xa')](),controller['destroy']);module[_0x5743('0x10')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index acd6397..5ae1375 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 _0x118b=['customVariable','picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable'];(function(_0x4a03c8,_0xf47e33){var _0x6e2fbb=function(_0x1be64c){while(--_0x1be64c){_0x4a03c8['push'](_0x4a03c8['shift']());}};_0x6e2fbb(++_0xf47e33);}(_0x118b,0x163));var _0xb118=function(_0x3d09cc,_0x378004){_0x3d09cc=_0x3d09cc-0x0;var _0x470e36=_0x118b[_0x3d09cc];return _0x470e36;};'use strict';var Sequelize=require(_0xb118('0x0'));module[_0xb118('0x1')]={'type':{'type':Sequelize[_0xb118('0x2')](_0xb118('0x3'),_0xb118('0x4'),_0xb118('0x5'),'keyValue',_0xb118('0x6')),'defaultValue':_0xb118('0x3')},'content':{'type':Sequelize[_0xb118('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xb118('0x2')](_0xb118('0x3'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0xb118('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xb118('0x7')]},'customField':{'type':Sequelize[_0xb118('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd6b4=['variable','customVariable','keyValue','picklist','STRING','ENUM','BOOLEAN','sequelize','string'];(function(_0x3f9b9e,_0x209ec4){var _0x4d4270=function(_0x396fbd){while(--_0x396fbd){_0x3f9b9e['push'](_0x3f9b9e['shift']());}};_0x4d4270(++_0x209ec4);}(_0xd6b4,0x181));var _0x4d6b=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xd6b4[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require(_0x4d6b('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0x4d6b('0x1'),_0x4d6b('0x2'),_0x4d6b('0x3'),_0x4d6b('0x4'),_0x4d6b('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x4d6b('0x6')]},'key':{'type':Sequelize[_0x4d6b('0x6')]},'keyType':{'type':Sequelize[_0x4d6b('0x7')](_0x4d6b('0x1'),'variable',_0x4d6b('0x3'))},'keyContent':{'type':Sequelize[_0x4d6b('0x6')]},'idField':{'type':Sequelize[_0x4d6b('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x4d6b('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 2c87461..fb16779 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 _0x2f59=['destroy','error','stack','name','send','index','map','Dynamics365Field','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','merge','VIRTUAL','filter','options','count','includeAll','include','findAll','rows','catch','params','length','find','create','body','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','set','apply','reject','save','update','then'];(function(_0x3537f0,_0x48dd16){var _0x47baaa=function(_0x13b7b5){while(--_0x13b7b5){_0x3537f0['push'](_0x3537f0['shift']());}};_0x47baaa(++_0x48dd16);}(_0x2f59,0xb6));var _0x92f5=function(_0x180c9b,_0x13d173){_0x180c9b=_0x180c9b-0x0;var _0x3ff116=_0x2f59[_0x180c9b];return _0x3ff116;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x92f5('0x0'));var jsonpatch=require(_0x92f5('0x1'));var rp=require(_0x92f5('0x2'));var moment=require('moment');var BPromise=require(_0x92f5('0x3'));var Mustache=require(_0x92f5('0x4'));var util=require(_0x92f5('0x5'));var path=require(_0x92f5('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x92f5('0x7'));var fs=require('fs');var fs_extra=require(_0x92f5('0x8'));var _=require(_0x92f5('0x9'));var squel=require(_0x92f5('0xa'));var crypto=require(_0x92f5('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x92f5('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x92f5('0xd'));var Redis=require(_0x92f5('0xe'));var authService=require(_0x92f5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x92f5('0x10'));var hardwareService=require(_0x92f5('0x11'));var logger=require(_0x92f5('0x12'))('api');var utils=require(_0x92f5('0x13'));var config=require(_0x92f5('0x14'));var licenseUtil=require(_0x92f5('0x15'));var db=require(_0x92f5('0x16'))['db'];function respondWithStatusCode(_0x3140f6,_0x3fee4b){_0x3fee4b=_0x3fee4b||0xcc;return function(_0x1b4248){if(_0x1b4248){return _0x3140f6['sendStatus'](_0x3fee4b);}return _0x3140f6[_0x92f5('0x17')](_0x3fee4b)[_0x92f5('0x18')]();};}function respondWithResult(_0x8922a9,_0x5272fe){_0x5272fe=_0x5272fe||0xc8;return function(_0x4c75fa){if(_0x4c75fa){return _0x8922a9[_0x92f5('0x17')](_0x5272fe)[_0x92f5('0x19')](_0x4c75fa);}};}function respondWithFilteredResult(_0x287537,_0x625408){return function(_0x5214ec){if(_0x5214ec){var _0x332e4a=typeof _0x625408[_0x92f5('0x1a')]==='undefined'&&typeof _0x625408[_0x92f5('0x1b')]==='undefined';var _0x40dbda=_0x5214ec['count'];var _0x83a9e4=_0x332e4a?0x0:_0x625408['offset'];var _0x5d66a2=_0x332e4a?_0x5214ec['count']:_0x625408[_0x92f5('0x1a')]+_0x625408['limit'];var _0x37ab39;if(_0x5d66a2>=_0x40dbda){_0x5d66a2=_0x40dbda;_0x37ab39=0xc8;}else{_0x37ab39=0xce;}_0x287537[_0x92f5('0x17')](_0x37ab39);return _0x287537[_0x92f5('0x1c')]('Content-Range',_0x83a9e4+'-'+_0x5d66a2+'/'+_0x40dbda)[_0x92f5('0x19')](_0x5214ec);}return null;};}function patchUpdates(_0x2123ae){return function(_0x2b2e54){try{jsonpatch[_0x92f5('0x1d')](_0x2b2e54,_0x2123ae,!![]);}catch(_0x490332){return BPromise[_0x92f5('0x1e')](_0x490332);}return _0x2b2e54[_0x92f5('0x1f')]();};}function saveUpdates(_0x541a5c,_0x25e69b){return function(_0x546e61){if(_0x546e61){return _0x546e61[_0x92f5('0x20')](_0x541a5c)[_0x92f5('0x21')](function(_0xaea55f){return _0xaea55f;});}return null;};}function removeEntity(_0x374050,_0x4ef235){return function(_0xb14e24){if(_0xb14e24){return _0xb14e24[_0x92f5('0x22')]()['then'](function(){_0x374050[_0x92f5('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x21bbbb,_0x2ed33a){return function(_0x34d9e6){if(!_0x34d9e6){_0x21bbbb['sendStatus'](0x194);}return _0x34d9e6;};}function handleError(_0x1442d8,_0x582a48){_0x582a48=_0x582a48||0x1f4;return function(_0x13013e){logger[_0x92f5('0x23')](_0x13013e[_0x92f5('0x24')]);if(_0x13013e[_0x92f5('0x25')]){delete _0x13013e[_0x92f5('0x25')];}_0x1442d8[_0x92f5('0x17')](_0x582a48)[_0x92f5('0x26')](_0x13013e);};}exports[_0x92f5('0x27')]=function(_0x27726b,_0x5baecf){var _0x278244={},_0x3d2d60={},_0x241ad1={'count':0x0,'rows':[]};var _0x227d0c=_[_0x92f5('0x28')](db[_0x92f5('0x29')][_0x92f5('0x2a')],function(_0x3ebc0b){return{'name':_0x3ebc0b[_0x92f5('0x2b')],'type':_0x3ebc0b[_0x92f5('0x2c')]['key']};});_0x3d2d60[_0x92f5('0x2d')]=_[_0x92f5('0x28')](_0x227d0c,_0x92f5('0x25'));_0x3d2d60[_0x92f5('0x2e')]=_[_0x92f5('0x2f')](_0x27726b[_0x92f5('0x2e')]);_0x3d2d60['filters']=_[_0x92f5('0x30')](_0x3d2d60[_0x92f5('0x2d')],_0x3d2d60[_0x92f5('0x2e')]);_0x278244[_0x92f5('0x31')]=_[_0x92f5('0x30')](_0x3d2d60[_0x92f5('0x2d')],qs[_0x92f5('0x32')](_0x27726b[_0x92f5('0x2e')]['fields']));_0x278244['attributes']=_0x278244[_0x92f5('0x31')]['length']?_0x278244['attributes']:_0x3d2d60[_0x92f5('0x2d')];if(!_0x27726b[_0x92f5('0x2e')][_0x92f5('0x33')](_0x92f5('0x34'))){_0x278244[_0x92f5('0x1b')]=qs[_0x92f5('0x1b')](_0x27726b[_0x92f5('0x2e')][_0x92f5('0x1b')]);_0x278244['offset']=qs['offset'](_0x27726b[_0x92f5('0x2e')][_0x92f5('0x1a')]);}_0x278244[_0x92f5('0x35')]=qs[_0x92f5('0x36')](_0x27726b[_0x92f5('0x2e')][_0x92f5('0x36')]);_0x278244[_0x92f5('0x37')]=qs[_0x92f5('0x38')](_['pick'](_0x27726b['query'],_0x3d2d60[_0x92f5('0x38')]),_0x227d0c);if(_0x27726b[_0x92f5('0x2e')]['filter']){_0x278244[_0x92f5('0x37')]=_[_0x92f5('0x39')](_0x278244[_0x92f5('0x37')],{'$or':_[_0x92f5('0x28')](_0x227d0c,function(_0x5373c5){if(_0x5373c5[_0x92f5('0x2c')]!==_0x92f5('0x3a')){var _0x2a2afd={};_0x2a2afd[_0x5373c5[_0x92f5('0x25')]]={'$like':'%'+_0x27726b[_0x92f5('0x2e')][_0x92f5('0x3b')]+'%'};return _0x2a2afd;}})});}_0x278244=_['merge']({},_0x278244,_0x27726b[_0x92f5('0x3c')]);var _0x3fc9c9={'where':_0x278244['where']};return db[_0x92f5('0x29')][_0x92f5('0x3d')](_0x3fc9c9)[_0x92f5('0x21')](function(_0x242ec9){_0x241ad1['count']=_0x242ec9;if(_0x27726b[_0x92f5('0x2e')][_0x92f5('0x3e')]){_0x278244[_0x92f5('0x3f')]=[{'all':!![]}];}return db[_0x92f5('0x29')][_0x92f5('0x40')](_0x278244);})[_0x92f5('0x21')](function(_0x48d397){_0x241ad1[_0x92f5('0x41')]=_0x48d397;return _0x241ad1;})[_0x92f5('0x21')](respondWithFilteredResult(_0x5baecf,_0x278244))[_0x92f5('0x42')](handleError(_0x5baecf,null));};exports['show']=function(_0xc21a89,_0x3bedfd){var _0x4d6508={'raw':!![],'where':{'id':_0xc21a89[_0x92f5('0x43')]['id']}},_0xeac25e={};_0xeac25e[_0x92f5('0x2d')]=_[_0x92f5('0x2f')](db[_0x92f5('0x29')]['rawAttributes']);_0xeac25e[_0x92f5('0x2e')]=_[_0x92f5('0x2f')](_0xc21a89[_0x92f5('0x2e')]);_0xeac25e[_0x92f5('0x38')]=_[_0x92f5('0x30')](_0xeac25e['model'],_0xeac25e[_0x92f5('0x2e')]);_0x4d6508[_0x92f5('0x31')]=_[_0x92f5('0x30')](_0xeac25e[_0x92f5('0x2d')],qs['fields'](_0xc21a89[_0x92f5('0x2e')][_0x92f5('0x32')]));_0x4d6508[_0x92f5('0x31')]=_0x4d6508[_0x92f5('0x31')][_0x92f5('0x44')]?_0x4d6508[_0x92f5('0x31')]:_0xeac25e['model'];if(_0xc21a89[_0x92f5('0x2e')][_0x92f5('0x3e')]){_0x4d6508[_0x92f5('0x3f')]=[{'all':!![]}];}_0x4d6508=_[_0x92f5('0x39')]({},_0x4d6508,_0xc21a89[_0x92f5('0x3c')]);return db['Dynamics365Field'][_0x92f5('0x45')](_0x4d6508)[_0x92f5('0x21')](handleEntityNotFound(_0x3bedfd,null))[_0x92f5('0x21')](respondWithResult(_0x3bedfd,null))['catch'](handleError(_0x3bedfd,null));};exports[_0x92f5('0x46')]=function(_0x2da9ed,_0x58403d){return db[_0x92f5('0x29')][_0x92f5('0x46')](_0x2da9ed[_0x92f5('0x47')],{})['then'](respondWithResult(_0x58403d,0xc9))['catch'](handleError(_0x58403d,null));};exports[_0x92f5('0x20')]=function(_0x95a7bd,_0x21442d){if(_0x95a7bd[_0x92f5('0x47')]['id']){delete _0x95a7bd[_0x92f5('0x47')]['id'];}return db[_0x92f5('0x29')][_0x92f5('0x45')]({'where':{'id':_0x95a7bd['params']['id']}})[_0x92f5('0x21')](handleEntityNotFound(_0x21442d,null))[_0x92f5('0x21')](saveUpdates(_0x95a7bd[_0x92f5('0x47')],null))['then'](respondWithResult(_0x21442d,null))['catch'](handleError(_0x21442d,null));};exports[_0x92f5('0x22')]=function(_0x4c002c,_0x5cc80c){return db[_0x92f5('0x29')]['find']({'where':{'id':_0x4c002c['params']['id']}})['then'](handleEntityNotFound(_0x5cc80c,null))[_0x92f5('0x21')](removeEntity(_0x5cc80c,null))['catch'](handleError(_0x5cc80c,null));}; \ No newline at end of file +var _0xb1cb=['request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','error','name','send','index','map','Dynamics365Field','rawAttributes','fieldName','type','key','model','keys','filters','query','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','show','params','fields','create','body','catch','find','destroy','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xb1cb,0x96));var _0xbb1c=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0xb1cb[_0x45d55e];return _0x29812a;};'use strict';var emlformat=require(_0xbb1c('0x0'));var rimraf=require(_0xbb1c('0x1'));var zipdir=require(_0xbb1c('0x2'));var jsonpatch=require(_0xbb1c('0x3'));var rp=require(_0xbb1c('0x4'));var moment=require(_0xbb1c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xbb1c('0x6'));var util=require(_0xbb1c('0x7'));var path=require(_0xbb1c('0x8'));var sox=require(_0xbb1c('0x9'));var csv=require(_0xbb1c('0xa'));var ejs=require(_0xbb1c('0xb'));var fs=require('fs');var fs_extra=require(_0xbb1c('0xc'));var _=require('lodash');var squel=require(_0xbb1c('0xd'));var crypto=require(_0xbb1c('0xe'));var jsforce=require(_0xbb1c('0xf'));var deskjs=require(_0xbb1c('0x10'));var toCsv=require('to-csv');var querystring=require(_0xbb1c('0x11'));var Papa=require(_0xbb1c('0x12'));var Redis=require(_0xbb1c('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xbb1c('0x14'));var as=require(_0xbb1c('0x15'));var hardwareService=require(_0xbb1c('0x16'));var logger=require(_0xbb1c('0x17'))(_0xbb1c('0x18'));var utils=require(_0xbb1c('0x19'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3bbbc8,_0xb0f49e){_0xb0f49e=_0xb0f49e||0xcc;return function(_0x3c9ec9){if(_0x3c9ec9){return _0x3bbbc8[_0xbb1c('0x1a')](_0xb0f49e);}return _0x3bbbc8[_0xbb1c('0x1b')](_0xb0f49e)[_0xbb1c('0x1c')]();};}function respondWithResult(_0x49566e,_0x2b8fc4){_0x2b8fc4=_0x2b8fc4||0xc8;return function(_0x5abe19){if(_0x5abe19){return _0x49566e[_0xbb1c('0x1b')](_0x2b8fc4)[_0xbb1c('0x1d')](_0x5abe19);}};}function respondWithFilteredResult(_0x283364,_0x4e54dc){return function(_0x2fe46d){if(_0x2fe46d){var _0x5a5922=typeof _0x4e54dc['offset']==='undefined'&&typeof _0x4e54dc['limit']===_0xbb1c('0x1e');var _0x4b6b33=_0x2fe46d[_0xbb1c('0x1f')];var _0x36d709=_0x5a5922?0x0:_0x4e54dc[_0xbb1c('0x20')];var _0x163251=_0x5a5922?_0x2fe46d['count']:_0x4e54dc[_0xbb1c('0x20')]+_0x4e54dc[_0xbb1c('0x21')];var _0x1d0c0a;if(_0x163251>=_0x4b6b33){_0x163251=_0x4b6b33;_0x1d0c0a=0xc8;}else{_0x1d0c0a=0xce;}_0x283364[_0xbb1c('0x1b')](_0x1d0c0a);return _0x283364[_0xbb1c('0x22')](_0xbb1c('0x23'),_0x36d709+'-'+_0x163251+'/'+_0x4b6b33)[_0xbb1c('0x1d')](_0x2fe46d);}return null;};}function patchUpdates(_0x1fefd5){return function(_0x135853){try{jsonpatch[_0xbb1c('0x24')](_0x135853,_0x1fefd5,!![]);}catch(_0x37f9fe){return BPromise[_0xbb1c('0x25')](_0x37f9fe);}return _0x135853[_0xbb1c('0x26')]();};}function saveUpdates(_0x4d5bcf,_0x2ebd61){return function(_0x4c8cdc){if(_0x4c8cdc){return _0x4c8cdc[_0xbb1c('0x27')](_0x4d5bcf)['then'](function(_0x18dba6){return _0x18dba6;});}return null;};}function removeEntity(_0x5cf040,_0x1d7f02){return function(_0x2f76f4){if(_0x2f76f4){return _0x2f76f4['destroy']()[_0xbb1c('0x28')](function(){_0x5cf040['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e3f77,_0xd4089d){return function(_0x354b11){if(!_0x354b11){_0x3e3f77[_0xbb1c('0x1a')](0x194);}return _0x354b11;};}function handleError(_0x443dea,_0x43bef9){_0x43bef9=_0x43bef9||0x1f4;return function(_0xa91aeb){logger[_0xbb1c('0x29')](_0xa91aeb['stack']);if(_0xa91aeb[_0xbb1c('0x2a')]){delete _0xa91aeb[_0xbb1c('0x2a')];}_0x443dea[_0xbb1c('0x1b')](_0x43bef9)[_0xbb1c('0x2b')](_0xa91aeb);};}exports[_0xbb1c('0x2c')]=function(_0x2f6338,_0x239800){var _0x46a4bc={},_0x38fdbd={},_0x804a16={'count':0x0,'rows':[]};var _0x25f652=_[_0xbb1c('0x2d')](db[_0xbb1c('0x2e')][_0xbb1c('0x2f')],function(_0x32d8f2){return{'name':_0x32d8f2[_0xbb1c('0x30')],'type':_0x32d8f2[_0xbb1c('0x31')][_0xbb1c('0x32')]};});_0x38fdbd[_0xbb1c('0x33')]=_[_0xbb1c('0x2d')](_0x25f652,_0xbb1c('0x2a'));_0x38fdbd['query']=_[_0xbb1c('0x34')](_0x2f6338['query']);_0x38fdbd[_0xbb1c('0x35')]=_['intersection'](_0x38fdbd[_0xbb1c('0x33')],_0x38fdbd[_0xbb1c('0x36')]);_0x46a4bc[_0xbb1c('0x37')]=_[_0xbb1c('0x38')](_0x38fdbd['model'],qs['fields'](_0x2f6338[_0xbb1c('0x36')]['fields']));_0x46a4bc[_0xbb1c('0x37')]=_0x46a4bc[_0xbb1c('0x37')][_0xbb1c('0x39')]?_0x46a4bc[_0xbb1c('0x37')]:_0x38fdbd[_0xbb1c('0x33')];if(!_0x2f6338[_0xbb1c('0x36')][_0xbb1c('0x3a')](_0xbb1c('0x3b'))){_0x46a4bc[_0xbb1c('0x21')]=qs['limit'](_0x2f6338[_0xbb1c('0x36')][_0xbb1c('0x21')]);_0x46a4bc[_0xbb1c('0x20')]=qs[_0xbb1c('0x20')](_0x2f6338[_0xbb1c('0x36')][_0xbb1c('0x20')]);}_0x46a4bc[_0xbb1c('0x3c')]=qs[_0xbb1c('0x3d')](_0x2f6338['query'][_0xbb1c('0x3d')]);_0x46a4bc[_0xbb1c('0x3e')]=qs['filters'](_[_0xbb1c('0x3f')](_0x2f6338['query'],_0x38fdbd['filters']),_0x25f652);if(_0x2f6338[_0xbb1c('0x36')][_0xbb1c('0x40')]){_0x46a4bc[_0xbb1c('0x3e')]=_[_0xbb1c('0x41')](_0x46a4bc['where'],{'$or':_[_0xbb1c('0x2d')](_0x25f652,function(_0x384af0){if(_0x384af0[_0xbb1c('0x31')]!=='VIRTUAL'){var _0x31d998={};_0x31d998[_0x384af0[_0xbb1c('0x2a')]]={'$like':'%'+_0x2f6338[_0xbb1c('0x36')][_0xbb1c('0x40')]+'%'};return _0x31d998;}})});}_0x46a4bc=_[_0xbb1c('0x41')]({},_0x46a4bc,_0x2f6338[_0xbb1c('0x42')]);var _0x1331b5={'where':_0x46a4bc[_0xbb1c('0x3e')]};return db[_0xbb1c('0x2e')][_0xbb1c('0x1f')](_0x1331b5)[_0xbb1c('0x28')](function(_0x27b49d){_0x804a16[_0xbb1c('0x1f')]=_0x27b49d;if(_0x2f6338[_0xbb1c('0x36')][_0xbb1c('0x43')]){_0x46a4bc[_0xbb1c('0x44')]=[{'all':!![]}];}return db['Dynamics365Field']['findAll'](_0x46a4bc);})[_0xbb1c('0x28')](function(_0x449a2e){_0x804a16['rows']=_0x449a2e;return _0x804a16;})[_0xbb1c('0x28')](respondWithFilteredResult(_0x239800,_0x46a4bc))['catch'](handleError(_0x239800,null));};exports[_0xbb1c('0x45')]=function(_0x25c92d,_0x54d226){var _0x55d2df={'raw':!![],'where':{'id':_0x25c92d[_0xbb1c('0x46')]['id']}},_0x296afd={};_0x296afd[_0xbb1c('0x33')]=_[_0xbb1c('0x34')](db[_0xbb1c('0x2e')]['rawAttributes']);_0x296afd[_0xbb1c('0x36')]=_[_0xbb1c('0x34')](_0x25c92d[_0xbb1c('0x36')]);_0x296afd[_0xbb1c('0x35')]=_[_0xbb1c('0x38')](_0x296afd['model'],_0x296afd[_0xbb1c('0x36')]);_0x55d2df[_0xbb1c('0x37')]=_['intersection'](_0x296afd[_0xbb1c('0x33')],qs[_0xbb1c('0x47')](_0x25c92d['query'][_0xbb1c('0x47')]));_0x55d2df['attributes']=_0x55d2df[_0xbb1c('0x37')][_0xbb1c('0x39')]?_0x55d2df[_0xbb1c('0x37')]:_0x296afd[_0xbb1c('0x33')];if(_0x25c92d[_0xbb1c('0x36')][_0xbb1c('0x43')]){_0x55d2df[_0xbb1c('0x44')]=[{'all':!![]}];}_0x55d2df=_['merge']({},_0x55d2df,_0x25c92d[_0xbb1c('0x42')]);return db['Dynamics365Field']['find'](_0x55d2df)['then'](handleEntityNotFound(_0x54d226,null))['then'](respondWithResult(_0x54d226,null))['catch'](handleError(_0x54d226,null));};exports[_0xbb1c('0x48')]=function(_0x15f2e9,_0x570097){return db[_0xbb1c('0x2e')][_0xbb1c('0x48')](_0x15f2e9[_0xbb1c('0x49')],{})[_0xbb1c('0x28')](respondWithResult(_0x570097,0xc9))[_0xbb1c('0x4a')](handleError(_0x570097,null));};exports['update']=function(_0x3c1a65,_0x1f78e1){if(_0x3c1a65['body']['id']){delete _0x3c1a65['body']['id'];}return db[_0xbb1c('0x2e')][_0xbb1c('0x4b')]({'where':{'id':_0x3c1a65[_0xbb1c('0x46')]['id']}})[_0xbb1c('0x28')](handleEntityNotFound(_0x1f78e1,null))[_0xbb1c('0x28')](saveUpdates(_0x3c1a65[_0xbb1c('0x49')],null))['then'](respondWithResult(_0x1f78e1,null))[_0xbb1c('0x4a')](handleError(_0x1f78e1,null));};exports[_0xbb1c('0x4c')]=function(_0x4c9f12,_0x54fc6e){return db[_0xbb1c('0x2e')][_0xbb1c('0x4b')]({'where':{'id':_0x4c9f12[_0xbb1c('0x46')]['id']}})[_0xbb1c('0x28')](handleEntityNotFound(_0x54fc6e,null))['then'](removeEntity(_0x54fc6e,null))[_0xbb1c('0x4a')](handleError(_0x54fc6e,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 6806a6f..2c87930 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 _0xec8a=['../../config/logger','api','moment','path','rimraf','../../config/environment','exports','define','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId','lodash','util'];(function(_0x44913c,_0x754aad){var _0x4b7ca2=function(_0x35345e){while(--_0x35345e){_0x44913c['push'](_0x44913c['shift']());}};_0x4b7ca2(++_0x754aad);}(_0xec8a,0x12a));var _0xaec8=function(_0x2d0ce5,_0x59714f){_0x2d0ce5=_0x2d0ce5-0x0;var _0xa627d2=_0xec8a[_0x2d0ce5];return _0xa627d2;};'use strict';var _=require(_0xaec8('0x0'));var util=require(_0xaec8('0x1'));var logger=require(_0xaec8('0x2'))(_0xaec8('0x3'));var moment=require(_0xaec8('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xaec8('0x5'));var rimraf=require(_0xaec8('0x6'));var config=require(_0xaec8('0x7'));var attributes=require('./intDynamics365Field.attributes');module[_0xaec8('0x8')]=function(_0x5cee08,_0x4912b1){return _0x5cee08[_0xaec8('0x9')](_0xaec8('0xa'),attributes,{'tableName':_0xaec8('0xb'),'paranoid':![],'indexes':[{'name':_0xaec8('0xc'),'fields':[_0xaec8('0xd'),_0xaec8('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc049=['bluebird','request-promise','rimraf','../../config/environment','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId','lodash','../../config/logger','moment'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0xc049,0x1e9));var _0x9c04=function(_0x14f32c,_0x31e75f){_0x14f32c=_0x14f32c-0x0;var _0x2eb5e2=_0xc049[_0x14f32c];return _0x2eb5e2;};'use strict';var _=require(_0x9c04('0x0'));var util=require('util');var logger=require(_0x9c04('0x1'))('api');var moment=require(_0x9c04('0x2'));var BPromise=require(_0x9c04('0x3'));var rp=require(_0x9c04('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9c04('0x5'));var config=require(_0x9c04('0x6'));var attributes=require('./intDynamics365Field.attributes');module['exports']=function(_0x55a165,_0x895230){return _0x55a165['define'](_0x9c04('0x7'),attributes,{'tableName':_0x9c04('0x8'),'paranoid':![],'indexes':[{'name':_0x9c04('0x9'),'fields':[_0x9c04('0xa'),_0x9c04('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.rpc.js b/server/api/intDynamics365Field/intDynamics365Field.rpc.js index c9a2d2b..094574a 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 _0x3666=['client','http','request','then','info','request\x20sent','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','Dynamics365Field,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x3666,0x1dc));var _0x6366=function(_0x1dc9ed,_0x57a458){_0x1dc9ed=_0x1dc9ed-0x0;var _0x2331b8=_0x3666[_0x1dc9ed];return _0x2331b8;};'use strict';var _=require(_0x6366('0x0'));var util=require(_0x6366('0x1'));var moment=require(_0x6366('0x2'));var BPromise=require(_0x6366('0x3'));var rs=require(_0x6366('0x4'));var fs=require('fs');var Redis=require(_0x6366('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6366('0x6'))('rpc');var config=require(_0x6366('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x6366('0x8')][_0x6366('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x28a5b9,_0x4a5bb1,_0x178cfe){return new BPromise(function(_0x2570db,_0x3a2c7e){return client[_0x6366('0xa')](_0x28a5b9,_0x178cfe)[_0x6366('0xb')](function(_0x6034bc){logger[_0x6366('0xc')]('Dynamics365Field,\x20%s,\x20%s',_0x4a5bb1,_0x6366('0xd'));logger['debug'](_0x6366('0xe'),_0x4a5bb1,_0x6366('0xd'),JSON[_0x6366('0xf')](_0x6034bc));if(_0x6034bc[_0x6366('0x10')]){if(_0x6034bc['error'][_0x6366('0x11')]===0x1f4){logger['error'](_0x6366('0x12'),_0x4a5bb1,_0x6034bc[_0x6366('0x10')][_0x6366('0x13')]);return _0x3a2c7e(_0x6034bc[_0x6366('0x10')][_0x6366('0x13')]);}logger[_0x6366('0x10')]('Dynamics365Field,\x20%s,\x20%s',_0x4a5bb1,_0x6034bc[_0x6366('0x10')]['message']);return _0x2570db(_0x6034bc[_0x6366('0x10')]['message']);}else{logger[_0x6366('0xc')](_0x6366('0x12'),_0x4a5bb1,_0x6366('0xd'));_0x2570db(_0x6034bc[_0x6366('0x14')][_0x6366('0x13')]);}})[_0x6366('0x15')](function(_0xfe2d41){logger[_0x6366('0x10')](_0x6366('0x12'),_0x4a5bb1,_0xfe2d41);_0x3a2c7e(_0xfe2d41);});});} \ No newline at end of file +var _0x2fc9=['request\x20sent','debug','stringify','error','code','message','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Field,\x20%s,\x20%s'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2fc9,0x7a));var _0x92fc=function(_0x4b2b03,_0xbf34ee){_0x4b2b03=_0x4b2b03-0x0;var _0x1bf0ed=_0x2fc9[_0x4b2b03];return _0x1bf0ed;};'use strict';var _=require(_0x92fc('0x0'));var util=require(_0x92fc('0x1'));var moment=require('moment');var BPromise=require(_0x92fc('0x2'));var rs=require(_0x92fc('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x92fc('0x4'))['db'];var utils=require(_0x92fc('0x5'));var logger=require(_0x92fc('0x6'))(_0x92fc('0x7'));var config=require(_0x92fc('0x8'));var jayson=require(_0x92fc('0x9'));var client=jayson[_0x92fc('0xa')][_0x92fc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5a50fc,_0x2822fc,_0x5f566f){return new BPromise(function(_0xcc77e6,_0x5c0d1e){return client[_0x92fc('0xc')](_0x5a50fc,_0x5f566f)[_0x92fc('0xd')](function(_0x3d60cd){logger[_0x92fc('0xe')](_0x92fc('0xf'),_0x2822fc,_0x92fc('0x10'));logger[_0x92fc('0x11')]('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0x2822fc,_0x92fc('0x10'),JSON[_0x92fc('0x12')](_0x3d60cd));if(_0x3d60cd[_0x92fc('0x13')]){if(_0x3d60cd[_0x92fc('0x13')][_0x92fc('0x14')]===0x1f4){logger[_0x92fc('0x13')](_0x92fc('0xf'),_0x2822fc,_0x3d60cd['error']['message']);return _0x5c0d1e(_0x3d60cd['error'][_0x92fc('0x15')]);}logger[_0x92fc('0x13')]('Dynamics365Field,\x20%s,\x20%s',_0x2822fc,_0x3d60cd[_0x92fc('0x13')][_0x92fc('0x15')]);return _0xcc77e6(_0x3d60cd[_0x92fc('0x13')][_0x92fc('0x15')]);}else{logger[_0x92fc('0xe')]('Dynamics365Field,\x20%s,\x20%s',_0x2822fc,_0x92fc('0x10'));_0xcc77e6(_0x3d60cd['result']['message']);}})[_0x92fc('0x16')](function(_0x2cecba){logger[_0x92fc('0x13')]('Dynamics365Field,\x20%s,\x20%s',_0x2822fc,_0x2cecba);_0x5c0d1e(_0x2cecba);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 99a7dc2..b590166 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 _0x5072=['../../config/environment','./intFreshdeskAccount.controller','get','show','/:id/configurations','isAuthenticated','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','/:id','delete','destroy','exports','util','path','express','../../components/auth/service','../../components/interaction/service'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x5072,0xd7));var _0x2507=function(_0x4b7c42,_0x2141b5){_0x4b7c42=_0x4b7c42-0x0;var _0x4ea4ac=_0x5072[_0x4b7c42];return _0x4ea4ac;};'use strict';var multer=require('multer');var util=require(_0x2507('0x0'));var path=require(_0x2507('0x1'));var timeout=require('connect-timeout');var express=require(_0x2507('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x2507('0x3'));var interaction=require(_0x2507('0x4'));var config=require(_0x2507('0x5'));var controller=require(_0x2507('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x2507('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x2507('0x8')]);router['get'](_0x2507('0x9'),auth[_0x2507('0xa')](),controller[_0x2507('0xb')]);router['get'](_0x2507('0xc'),auth['isAuthenticated'](),controller[_0x2507('0xd')]);router[_0x2507('0xe')]('/',auth['isAuthenticated'](),controller[_0x2507('0xf')]);router[_0x2507('0xe')](_0x2507('0x9'),auth[_0x2507('0xa')](),controller[_0x2507('0x10')]);router[_0x2507('0x11')](_0x2507('0x12'),auth[_0x2507('0xa')](),controller['update']);router[_0x2507('0x13')](_0x2507('0x12'),auth['isAuthenticated'](),controller[_0x2507('0x14')]);module[_0x2507('0x15')]=router; \ No newline at end of file +var _0x32df=['isAuthenticated','index','/:id','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get'];(function(_0x1663de,_0x76af67){var _0x2c2bcf=function(_0x3d054d){while(--_0x3d054d){_0x1663de['push'](_0x1663de['shift']());}};_0x2c2bcf(++_0x76af67);}(_0x32df,0xc5));var _0xf32d=function(_0xb8e162,_0xe166fa){_0xb8e162=_0xb8e162-0x0;var _0x3213e2=_0x32df[_0xb8e162];return _0x3213e2;};'use strict';var multer=require(_0xf32d('0x0'));var util=require(_0xf32d('0x1'));var path=require(_0xf32d('0x2'));var timeout=require(_0xf32d('0x3'));var express=require(_0xf32d('0x4'));var router=express[_0xf32d('0x5')]();var fs_extra=require(_0xf32d('0x6'));var auth=require(_0xf32d('0x7'));var interaction=require(_0xf32d('0x8'));var config=require('../../config/environment');var controller=require('./intFreshdeskAccount.controller');router[_0xf32d('0x9')]('/',auth[_0xf32d('0xa')](),controller[_0xf32d('0xb')]);router[_0xf32d('0x9')](_0xf32d('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xf32d('0x9')](_0xf32d('0xd'),auth[_0xf32d('0xa')](),controller[_0xf32d('0xe')]);router['get'](_0xf32d('0xf'),auth[_0xf32d('0xa')](),controller['getFields']);router[_0xf32d('0x10')]('/',auth[_0xf32d('0xa')](),controller[_0xf32d('0x11')]);router[_0xf32d('0x10')](_0xf32d('0xd'),auth[_0xf32d('0xa')](),controller[_0xf32d('0x12')]);router[_0xf32d('0x13')]('/:id',auth[_0xf32d('0xa')](),controller[_0xf32d('0x14')]);router[_0xf32d('0x15')](_0xf32d('0xc'),auth[_0xf32d('0xa')](),controller[_0xf32d('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 7df3bb3..d4a7a5b 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 _0x33af=['exports','STRING','username','remoteUri'];(function(_0x5ac45c,_0x4cb957){var _0x5e2954=function(_0x42d5fe){while(--_0x42d5fe){_0x5ac45c['push'](_0x5ac45c['shift']());}};_0x5e2954(++_0x4cb957);}(_0x33af,0xec));var _0xf33a=function(_0x190725,_0x4c879f){_0x190725=_0x190725-0x0;var _0x4fe2de=_0x33af[_0x190725];return _0x4fe2de;};'use strict';var Sequelize=require('sequelize');module[_0xf33a('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xf33a('0x1')]},'username':{'type':Sequelize[_0xf33a('0x1')],'unique':_0xf33a('0x2')},'apiKey':{'type':Sequelize[_0xf33a('0x1')]},'remoteUri':{'type':Sequelize[_0xf33a('0x1')],'unique':_0xf33a('0x3')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0xd7d1=['sequelize','exports','STRING','username','remoteUri'];(function(_0x1534ab,_0xf6b341){var _0x5dcccc=function(_0x478b57){while(--_0x478b57){_0x1534ab['push'](_0x1534ab['shift']());}};_0x5dcccc(++_0xf6b341);}(_0xd7d1,0x1b3));var _0x1d7d=function(_0x2dbc95,_0x32760c){_0x2dbc95=_0x2dbc95-0x0;var _0x43b48f=_0xd7d1[_0x2dbc95];return _0x43b48f;};'use strict';var Sequelize=require(_0x1d7d('0x0'));module[_0x1d7d('0x1')]={'name':{'type':Sequelize[_0x1d7d('0x2')]},'description':{'type':Sequelize[_0x1d7d('0x2')]},'username':{'type':Sequelize[_0x1d7d('0x2')],'unique':_0x1d7d('0x3')},'apiKey':{'type':Sequelize[_0x1d7d('0x2')]},'remoteUri':{'type':Sequelize[_0x1d7d('0x2')],'unique':_0x1d7d('0x4')},'serverUrl':{'type':Sequelize[_0x1d7d('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 8868e15..09a3acc 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 _0xdadd=['capitalize','test','statusCode','stringify','eml-format','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','limit','count','Content-Range','save','destroy','then','error','stack','name','send','FreshdeskAccount','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','order','filter','where','merge','map','type','VIRTUAL','includeAll','include','findAll','rows','show','params','keys','find','create','body','catch','update','getConfigurations','findOne','FreshdeskConfiguration','length','sort','pick','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshdeskField','getFields','remoteUri','slice','substring','lastIndexOf','GET','%s/%s','format','Basic\x20%s','%s:X','toString','base64','requester','subject','agent','description','priority','source','ticket_type','group','company','custom_text','label','default','choices'];(function(_0x21d1eb,_0x56f664){var _0x4cb8cd=function(_0x450a48){while(--_0x450a48){_0x21d1eb['push'](_0x21d1eb['shift']());}};_0x4cb8cd(++_0x56f664);}(_0xdadd,0x1c8));var _0xddad=function(_0x37eb5c,_0x477cc0){_0x37eb5c=_0x37eb5c-0x0;var _0x243e31=_0xdadd[_0x37eb5c];return _0x243e31;};'use strict';var emlformat=require(_0xddad('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xddad('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xddad('0x2'));var moment=require(_0xddad('0x3'));var BPromise=require(_0xddad('0x4'));var Mustache=require('mustache');var util=require(_0xddad('0x5'));var path=require(_0xddad('0x6'));var sox=require(_0xddad('0x7'));var csv=require(_0xddad('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xddad('0x9'));var squel=require(_0xddad('0xa'));var crypto=require('crypto');var jsforce=require(_0xddad('0xb'));var deskjs=require(_0xddad('0xc'));var toCsv=require(_0xddad('0x8'));var querystring=require(_0xddad('0xd'));var Papa=require(_0xddad('0xe'));var Redis=require(_0xddad('0xf'));var authService=require(_0xddad('0x10'));var qs=require(_0xddad('0x11'));var as=require(_0xddad('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xddad('0x13'))(_0xddad('0x14'));var utils=require(_0xddad('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xddad('0x16'));var db=require('../../mysqldb')['db'];var integrations=require(_0xddad('0x17'));function respondWithStatusCode(_0x248c9b,_0xc8973d){_0xc8973d=_0xc8973d||0xcc;return function(_0x413a59){if(_0x413a59){return _0x248c9b[_0xddad('0x18')](_0xc8973d);}return _0x248c9b[_0xddad('0x19')](_0xc8973d)['end']();};}function respondWithResult(_0x353723,_0x2c7b40){_0x2c7b40=_0x2c7b40||0xc8;return function(_0xa0da52){if(_0xa0da52){return _0x353723[_0xddad('0x19')](_0x2c7b40)[_0xddad('0x1a')](_0xa0da52);}};}function respondWithFilteredResult(_0x1b4b94,_0x4e0ca3){return function(_0x50c3e4){if(_0x50c3e4){var _0x13af9e=typeof _0x4e0ca3[_0xddad('0x1b')]===_0xddad('0x1c')&&typeof _0x4e0ca3[_0xddad('0x1d')]===_0xddad('0x1c');var _0x512bc9=_0x50c3e4[_0xddad('0x1e')];var _0x4649aa=_0x13af9e?0x0:_0x4e0ca3[_0xddad('0x1b')];var _0x596bf7=_0x13af9e?_0x50c3e4[_0xddad('0x1e')]:_0x4e0ca3['offset']+_0x4e0ca3[_0xddad('0x1d')];var _0x5c3b27;if(_0x596bf7>=_0x512bc9){_0x596bf7=_0x512bc9;_0x5c3b27=0xc8;}else{_0x5c3b27=0xce;}_0x1b4b94['status'](_0x5c3b27);return _0x1b4b94['set'](_0xddad('0x1f'),_0x4649aa+'-'+_0x596bf7+'/'+_0x512bc9)['json'](_0x50c3e4);}return null;};}function patchUpdates(_0x567986){return function(_0x56c771){try{jsonpatch['apply'](_0x56c771,_0x567986,!![]);}catch(_0x3fb4bf){return BPromise['reject'](_0x3fb4bf);}return _0x56c771[_0xddad('0x20')]();};}function saveUpdates(_0x450080,_0x2598c3){return function(_0x4e49b1){if(_0x4e49b1){return _0x4e49b1['update'](_0x450080)['then'](function(_0x321b25){return _0x321b25;});}return null;};}function removeEntity(_0x5e9e62,_0x3a6c68){return function(_0x286f5b){if(_0x286f5b){return _0x286f5b[_0xddad('0x21')]()[_0xddad('0x22')](function(){_0x5e9e62[_0xddad('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x17b9ce,_0x5b3a5b){return function(_0x5eb1b7){if(!_0x5eb1b7){_0x17b9ce[_0xddad('0x18')](0x194);}return _0x5eb1b7;};}function handleError(_0x74c3ea,_0x3b4bc8){_0x3b4bc8=_0x3b4bc8||0x1f4;return function(_0x5f4842){logger[_0xddad('0x23')](_0x5f4842[_0xddad('0x24')]);if(_0x5f4842['name']){delete _0x5f4842[_0xddad('0x25')];}_0x74c3ea['status'](_0x3b4bc8)[_0xddad('0x26')](_0x5f4842);};}exports['index']=function(_0x35a882,_0x1823b0){var _0x55ea75={},_0x108192={},_0x5617c0={'count':0x0,'rows':[]};var _0x424608=_['map'](db[_0xddad('0x27')][_0xddad('0x28')],function(_0x142297){return{'name':_0x142297[_0xddad('0x29')],'type':_0x142297['type'][_0xddad('0x2a')]};});_0x108192[_0xddad('0x2b')]=_['map'](_0x424608,_0xddad('0x25'));_0x108192['query']=_['keys'](_0x35a882[_0xddad('0x2c')]);_0x108192[_0xddad('0x2d')]=_[_0xddad('0x2e')](_0x108192[_0xddad('0x2b')],_0x108192[_0xddad('0x2c')]);_0x55ea75['attributes']=_[_0xddad('0x2e')](_0x108192[_0xddad('0x2b')],qs[_0xddad('0x2f')](_0x35a882['query'][_0xddad('0x2f')]));_0x55ea75['attributes']=_0x55ea75[_0xddad('0x30')]['length']?_0x55ea75[_0xddad('0x30')]:_0x108192[_0xddad('0x2b')];if(!_0x35a882['query'][_0xddad('0x31')]('nolimit')){_0x55ea75['limit']=qs['limit'](_0x35a882['query'][_0xddad('0x1d')]);_0x55ea75[_0xddad('0x1b')]=qs['offset'](_0x35a882['query']['offset']);}_0x55ea75[_0xddad('0x32')]=qs['sort'](_0x35a882[_0xddad('0x2c')]['sort']);_0x55ea75['where']=qs['filters'](_['pick'](_0x35a882['query'],_0x108192[_0xddad('0x2d')]),_0x424608);if(_0x35a882[_0xddad('0x2c')][_0xddad('0x33')]){_0x55ea75[_0xddad('0x34')]=_[_0xddad('0x35')](_0x55ea75[_0xddad('0x34')],{'$or':_[_0xddad('0x36')](_0x424608,function(_0x3e95ac){if(_0x3e95ac[_0xddad('0x37')]!==_0xddad('0x38')){var _0x365551={};_0x365551[_0x3e95ac[_0xddad('0x25')]]={'$like':'%'+_0x35a882['query'][_0xddad('0x33')]+'%'};return _0x365551;}})});}_0x55ea75=_[_0xddad('0x35')]({},_0x55ea75,_0x35a882['options']);var _0x2f3f09={'where':_0x55ea75['where']};return db[_0xddad('0x27')][_0xddad('0x1e')](_0x2f3f09)[_0xddad('0x22')](function(_0x41f614){_0x5617c0['count']=_0x41f614;if(_0x35a882['query'][_0xddad('0x39')]){_0x55ea75[_0xddad('0x3a')]=[{'all':!![]}];}return db[_0xddad('0x27')][_0xddad('0x3b')](_0x55ea75);})[_0xddad('0x22')](function(_0x5c8f63){_0x5617c0[_0xddad('0x3c')]=_0x5c8f63;return _0x5617c0;})[_0xddad('0x22')](respondWithFilteredResult(_0x1823b0,_0x55ea75))['catch'](handleError(_0x1823b0,null));};exports[_0xddad('0x3d')]=function(_0x3a9ed6,_0x17bded){var _0x47a6af={'raw':![],'where':{'id':_0x3a9ed6[_0xddad('0x3e')]['id']}},_0x41de54={};_0x41de54[_0xddad('0x2b')]=_[_0xddad('0x3f')](db[_0xddad('0x27')][_0xddad('0x28')]);_0x41de54[_0xddad('0x2c')]=_[_0xddad('0x3f')](_0x3a9ed6[_0xddad('0x2c')]);_0x41de54['filters']=_[_0xddad('0x2e')](_0x41de54[_0xddad('0x2b')],_0x41de54[_0xddad('0x2c')]);_0x47a6af[_0xddad('0x30')]=_['intersection'](_0x41de54['model'],qs[_0xddad('0x2f')](_0x3a9ed6[_0xddad('0x2c')]['fields']));_0x47a6af[_0xddad('0x30')]=_0x47a6af[_0xddad('0x30')]['length']?_0x47a6af['attributes']:_0x41de54[_0xddad('0x2b')];if(_0x3a9ed6[_0xddad('0x2c')][_0xddad('0x39')]){_0x47a6af[_0xddad('0x3a')]=[{'all':!![]}];}_0x47a6af=_['merge']({},_0x47a6af,_0x3a9ed6['options']);return db['FreshdeskAccount'][_0xddad('0x40')](_0x47a6af)[_0xddad('0x22')](handleEntityNotFound(_0x17bded,null))['then'](respondWithResult(_0x17bded,null))['catch'](handleError(_0x17bded,null));};exports[_0xddad('0x41')]=function(_0x43b19c,_0x10464f){return db[_0xddad('0x27')]['create'](_0x43b19c[_0xddad('0x42')],{})['then'](respondWithResult(_0x10464f,0xc9))[_0xddad('0x43')](handleError(_0x10464f,null));};exports[_0xddad('0x44')]=function(_0x4ba42d,_0x32a9f6){if(_0x4ba42d[_0xddad('0x42')]['id']){delete _0x4ba42d['body']['id'];}return db['FreshdeskAccount'][_0xddad('0x40')]({'where':{'id':_0x4ba42d[_0xddad('0x3e')]['id']}})[_0xddad('0x22')](handleEntityNotFound(_0x32a9f6,null))[_0xddad('0x22')](saveUpdates(_0x4ba42d[_0xddad('0x42')],null))[_0xddad('0x22')](respondWithResult(_0x32a9f6,null))['catch'](handleError(_0x32a9f6,null));};exports[_0xddad('0x21')]=function(_0x440124,_0x581758){return db['FreshdeskAccount']['find']({'where':{'id':_0x440124[_0xddad('0x3e')]['id']}})[_0xddad('0x22')](handleEntityNotFound(_0x581758,null))['then'](removeEntity(_0x581758,null))[_0xddad('0x43')](handleError(_0x581758,null));};exports[_0xddad('0x45')]=function(_0x2fe117,_0x4e9d26,_0xedb6ca){var _0x389c59={};var _0x4f29e1={};var _0x54a274;var _0x4dedbf;return db[_0xddad('0x27')][_0xddad('0x46')]({'where':{'id':_0x2fe117[_0xddad('0x3e')]['id']}})[_0xddad('0x22')](handleEntityNotFound(_0x4e9d26,null))[_0xddad('0x22')](function(_0x327405){if(_0x327405){_0x54a274=_0x327405;_0x4f29e1[_0xddad('0x2b')]=_[_0xddad('0x3f')](db[_0xddad('0x47')][_0xddad('0x28')]);_0x4f29e1[_0xddad('0x2c')]=_[_0xddad('0x3f')](_0x2fe117[_0xddad('0x2c')]);_0x4f29e1['filters']=_[_0xddad('0x2e')](_0x4f29e1[_0xddad('0x2b')],_0x4f29e1['query']);_0x389c59['attributes']=_[_0xddad('0x2e')](_0x4f29e1[_0xddad('0x2b')],qs['fields'](_0x2fe117[_0xddad('0x2c')][_0xddad('0x2f')]));_0x389c59[_0xddad('0x30')]=_0x389c59[_0xddad('0x30')][_0xddad('0x48')]?_0x389c59[_0xddad('0x30')]:_0x4f29e1[_0xddad('0x2b')];_0x389c59[_0xddad('0x32')]=qs['sort'](_0x2fe117[_0xddad('0x2c')][_0xddad('0x49')]);_0x389c59['where']=qs[_0xddad('0x2d')](_[_0xddad('0x4a')](_0x2fe117[_0xddad('0x2c')],_0x4f29e1[_0xddad('0x2d')]));if(_0x2fe117['query'][_0xddad('0x33')]){_0x389c59[_0xddad('0x34')]=_[_0xddad('0x35')](_0x389c59['where'],{'$or':_[_0xddad('0x36')](_0x389c59[_0xddad('0x30')],function(_0x3e9234){var _0x3f3cdb={};_0x3f3cdb[_0x3e9234]={'$like':'%'+_0x2fe117[_0xddad('0x2c')][_0xddad('0x33')]+'%'};return _0x3f3cdb;})});}_0x389c59=_[_0xddad('0x35')]({},_0x389c59,_0x2fe117['options']);return _0x54a274[_0xddad('0x45')](_0x389c59);}})['then'](function(_0x172a0c){if(_0x172a0c){_0x4dedbf=_0x172a0c['length'];if(!_0x2fe117['query'][_0xddad('0x31')](_0xddad('0x4b'))){_0x389c59['limit']=qs[_0xddad('0x1d')](_0x2fe117['query'][_0xddad('0x1d')]);_0x389c59['offset']=qs[_0xddad('0x1b')](_0x2fe117[_0xddad('0x2c')][_0xddad('0x1b')]);}return _0x54a274['getConfigurations'](_0x389c59);}})[_0xddad('0x22')](function(_0x119299){if(_0x119299){return _0x119299?{'count':_0x4dedbf,'rows':_0x119299}:null;}})[_0xddad('0x22')](respondWithResult(_0x4e9d26,null))['catch'](handleError(_0x4e9d26,null));};exports[_0xddad('0x4c')]=function(_0xf3694e,_0x1016b7,_0xd734ad){if(_0xf3694e[_0xddad('0x42')]['id']){delete _0xf3694e[_0xddad('0x42')]['id'];}return db[_0xddad('0x27')][_0xddad('0x46')]({'where':{'id':_0xf3694e[_0xddad('0x3e')]['id']}})[_0xddad('0x22')](handleEntityNotFound(_0x1016b7,null))['then'](function(_0x4dd199){if(_0x4dd199){_0xf3694e['body'][_0xddad('0x4d')]=_0x4dd199['id'];_0xf3694e[_0xddad('0x42')][_0xddad('0x4e')]=integrations[_0xddad('0x4f')](_0xf3694e[_0xddad('0x42')][_0xddad('0x50')],_0xf3694e['body'][_0xddad('0x37')]);_0xf3694e[_0xddad('0x42')][_0xddad('0x51')]=integrations[_0xddad('0x52')](_0xf3694e['body']['channel'],_0xf3694e['body'][_0xddad('0x37')]);return db[_0xddad('0x47')][_0xddad('0x41')](_0xf3694e[_0xddad('0x42')],{'include':[{'model':db[_0xddad('0x53')],'as':_0xddad('0x4e')},{'model':db['FreshdeskField'],'as':_0xddad('0x51')}]});}return null;})[_0xddad('0x22')](respondWithResult(_0x1016b7,null))[_0xddad('0x43')](handleError(_0x1016b7,null));};exports[_0xddad('0x54')]=function(_0x32b79b,_0x58ea24,_0x44425a){var _0x36ed3b='';return db[_0xddad('0x27')][_0xddad('0x46')]({'where':{'id':_0x32b79b[_0xddad('0x3e')]['id']},'attributes':['id',_0xddad('0x55'),'apiKey']})[_0xddad('0x22')](handleEntityNotFound(_0x58ea24,null))['then'](function(_0x21d90d){if(_0x21d90d){_0x36ed3b=_0x21d90d[_0xddad('0x55')];var _0x52eb0f=_0x36ed3b[_0xddad('0x56')](-0x1);if(_0x52eb0f==='/'){_0x36ed3b=_0x36ed3b[_0xddad('0x57')](0x0,_0x36ed3b[_0xddad('0x58')](_0x52eb0f));}return rp({'method':_0xddad('0x59'),'uri':util['format'](_0xddad('0x5a'),_0x36ed3b,'api/v2/ticket_fields'),'headers':{'Authorization':util[_0xddad('0x5b')](_0xddad('0x5c'),new Buffer(util['format'](_0xddad('0x5d'),_0x21d90d['apiKey']))[_0xddad('0x5e')](_0xddad('0x5f')))},'json':!![]});}})[_0xddad('0x22')](function(_0x3a4155){if(_0x3a4155){var _0x196a36=[_0xddad('0x60'),_0xddad('0x61'),_0xddad('0x62'),_0xddad('0x63'),_0xddad('0x19'),_0xddad('0x64'),'group',_0xddad('0x65'),_0xddad('0x66'),_0xddad('0x67'),_0xddad('0x68')];_['remove'](_0x3a4155,function(_0x5e74c6){return _0x196a36['includes'](_0x5e74c6[_0xddad('0x25')])||!_0x5e74c6['default']&&_0x5e74c6[_0xddad('0x37')]!==_0xddad('0x69')&&_0x5e74c6[_0xddad('0x37')]!=='custom_dropdown';});return{'count':_0x3a4155['length'],'rows':_[_0xddad('0x36')](_0x3a4155,function(_0x258028){return{'id':_0x258028[_0xddad('0x25')],'name':_0x258028[_0xddad('0x6a')],'custom':!_0x258028[_0xddad('0x6b')],'options':_0x258028[_0xddad('0x6c')]?_[_0xddad('0x36')](_0x258028[_0xddad('0x6c')],function(_0x1262e7){return{'name':_[_0xddad('0x6d')](_0x1262e7),'value':_0x1262e7};}):[]};})};}})['then'](respondWithResult(_0x58ea24,null))[_0xddad('0x43')](function(_0x488b9e){var _0x219a30=_0x32b79b['query'][_0xddad('0x6e')]?0x1f4:_0x488b9e[_0xddad('0x6f')]||0x1f4;logger[_0xddad('0x23')]('getFields,\x20%s,\x20%s,\x20%s',_0xddad('0x54'),_0x219a30,JSON[_0xddad('0x70')](_0x488b9e));delete _0x488b9e[_0xddad('0x25')];if(_0x219a30===0x191){_0x219a30=0x190;}_0x58ea24[_0xddad('0x19')](_0x219a30)[_0xddad('0x26')](_0x32b79b[_0xddad('0x2c')][_0xddad('0x6e')]?{'message':'Wrong\x20credentials','statusCode':_0x488b9e[_0xddad('0x6f')]}:_0x488b9e);});}; \ No newline at end of file +var _0x8721=['../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','destroy','then','end','error','name','index','FreshdeskAccount','rawAttributes','type','key','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','merge','where','VIRTUAL','options','count','includeAll','findAll','rows','catch','show','params','include','create','body','find','getConfigurations','findOne','FreshdeskConfiguration','order','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshdeskField','remoteUri','apiKey','slice','substring','lastIndexOf','%s/%s','api/v2/ticket_fields','format','toString','subject','agent','description','priority','group','source','ticket_type','remove','includes','default','custom_text','custom_dropdown','label','choices','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','eml-format','rimraf','zip-dir','moment','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x35e6ca,_0x54939f){var _0x239e43=function(_0x3ea90d){while(--_0x3ea90d){_0x35e6ca['push'](_0x35e6ca['shift']());}};_0x239e43(++_0x54939f);}(_0x8721,0xd9));var _0x1872=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0x8721[_0x134c2e];return _0x2825db;};'use strict';var emlformat=require(_0x1872('0x0'));var rimraf=require(_0x1872('0x1'));var zipdir=require(_0x1872('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1872('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x1872('0x4'));var sox=require(_0x1872('0x5'));var csv=require(_0x1872('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1872('0x7'));var squel=require(_0x1872('0x8'));var crypto=require(_0x1872('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x1872('0xa'));var toCsv=require(_0x1872('0x6'));var querystring=require(_0x1872('0xb'));var Papa=require(_0x1872('0xc'));var Redis=require(_0x1872('0xd'));var authService=require(_0x1872('0xe'));var qs=require(_0x1872('0xf'));var as=require(_0x1872('0x10'));var hardwareService=require(_0x1872('0x11'));var logger=require(_0x1872('0x12'))(_0x1872('0x13'));var utils=require('../../config/utils');var config=require(_0x1872('0x14'));var licenseUtil=require(_0x1872('0x15'));var db=require(_0x1872('0x16'))['db'];var integrations=require(_0x1872('0x17'));function respondWithStatusCode(_0x5122df,_0x412663){_0x412663=_0x412663||0xcc;return function(_0x1a8e90){if(_0x1a8e90){return _0x5122df[_0x1872('0x18')](_0x412663);}return _0x5122df[_0x1872('0x19')](_0x412663)['end']();};}function respondWithResult(_0x4df475,_0xe47f69){_0xe47f69=_0xe47f69||0xc8;return function(_0x9e92ef){if(_0x9e92ef){return _0x4df475[_0x1872('0x19')](_0xe47f69)[_0x1872('0x1a')](_0x9e92ef);}};}function respondWithFilteredResult(_0x1ffc89,_0x5662e6){return function(_0x4be58a){if(_0x4be58a){var _0x4d5d5d=typeof _0x5662e6[_0x1872('0x1b')]===_0x1872('0x1c')&&typeof _0x5662e6[_0x1872('0x1d')]==='undefined';var _0xd4204d=_0x4be58a['count'];var _0x444306=_0x4d5d5d?0x0:_0x5662e6[_0x1872('0x1b')];var _0x32147c=_0x4d5d5d?_0x4be58a['count']:_0x5662e6[_0x1872('0x1b')]+_0x5662e6['limit'];var _0x82b55e;if(_0x32147c>=_0xd4204d){_0x32147c=_0xd4204d;_0x82b55e=0xc8;}else{_0x82b55e=0xce;}_0x1ffc89[_0x1872('0x19')](_0x82b55e);return _0x1ffc89[_0x1872('0x1e')](_0x1872('0x1f'),_0x444306+'-'+_0x32147c+'/'+_0xd4204d)[_0x1872('0x1a')](_0x4be58a);}return null;};}function patchUpdates(_0x506a44){return function(_0x3e4ee7){try{jsonpatch[_0x1872('0x20')](_0x3e4ee7,_0x506a44,!![]);}catch(_0x1d0e89){return BPromise[_0x1872('0x21')](_0x1d0e89);}return _0x3e4ee7[_0x1872('0x22')]();};}function saveUpdates(_0x3142f8,_0x1fc33f){return function(_0x1acbc2){if(_0x1acbc2){return _0x1acbc2[_0x1872('0x23')](_0x3142f8)['then'](function(_0x54e059){return _0x54e059;});}return null;};}function removeEntity(_0x5f29f5,_0x42e0e4){return function(_0x3a9ca2){if(_0x3a9ca2){return _0x3a9ca2[_0x1872('0x24')]()[_0x1872('0x25')](function(){_0x5f29f5['status'](0xcc)[_0x1872('0x26')]();});}};}function handleEntityNotFound(_0x2ac6b8,_0x126ab4){return function(_0x588fc1){if(!_0x588fc1){_0x2ac6b8[_0x1872('0x18')](0x194);}return _0x588fc1;};}function handleError(_0x576efa,_0x43e178){_0x43e178=_0x43e178||0x1f4;return function(_0x8d964a){logger[_0x1872('0x27')](_0x8d964a['stack']);if(_0x8d964a[_0x1872('0x28')]){delete _0x8d964a[_0x1872('0x28')];}_0x576efa['status'](_0x43e178)['send'](_0x8d964a);};}exports[_0x1872('0x29')]=function(_0x5bab21,_0x5469e7){var _0x333961={},_0x5b1ef0={},_0x3f2779={'count':0x0,'rows':[]};var _0x7c1b35=_['map'](db[_0x1872('0x2a')][_0x1872('0x2b')],function(_0x30ad4f){return{'name':_0x30ad4f['fieldName'],'type':_0x30ad4f[_0x1872('0x2c')][_0x1872('0x2d')]};});_0x5b1ef0[_0x1872('0x2e')]=_[_0x1872('0x2f')](_0x7c1b35,_0x1872('0x28'));_0x5b1ef0['query']=_[_0x1872('0x30')](_0x5bab21[_0x1872('0x31')]);_0x5b1ef0[_0x1872('0x32')]=_[_0x1872('0x33')](_0x5b1ef0[_0x1872('0x2e')],_0x5b1ef0[_0x1872('0x31')]);_0x333961['attributes']=_[_0x1872('0x33')](_0x5b1ef0[_0x1872('0x2e')],qs[_0x1872('0x34')](_0x5bab21[_0x1872('0x31')][_0x1872('0x34')]));_0x333961[_0x1872('0x35')]=_0x333961[_0x1872('0x35')][_0x1872('0x36')]?_0x333961['attributes']:_0x5b1ef0['model'];if(!_0x5bab21[_0x1872('0x31')][_0x1872('0x37')](_0x1872('0x38'))){_0x333961[_0x1872('0x1d')]=qs[_0x1872('0x1d')](_0x5bab21[_0x1872('0x31')]['limit']);_0x333961[_0x1872('0x1b')]=qs[_0x1872('0x1b')](_0x5bab21['query']['offset']);}_0x333961['order']=qs[_0x1872('0x39')](_0x5bab21[_0x1872('0x31')][_0x1872('0x39')]);_0x333961['where']=qs[_0x1872('0x32')](_[_0x1872('0x3a')](_0x5bab21[_0x1872('0x31')],_0x5b1ef0[_0x1872('0x32')]),_0x7c1b35);if(_0x5bab21[_0x1872('0x31')][_0x1872('0x3b')]){_0x333961['where']=_[_0x1872('0x3c')](_0x333961[_0x1872('0x3d')],{'$or':_[_0x1872('0x2f')](_0x7c1b35,function(_0x3bd1da){if(_0x3bd1da[_0x1872('0x2c')]!==_0x1872('0x3e')){var _0x224d46={};_0x224d46[_0x3bd1da[_0x1872('0x28')]]={'$like':'%'+_0x5bab21['query'][_0x1872('0x3b')]+'%'};return _0x224d46;}})});}_0x333961=_[_0x1872('0x3c')]({},_0x333961,_0x5bab21[_0x1872('0x3f')]);var _0x4c3e9e={'where':_0x333961[_0x1872('0x3d')]};return db[_0x1872('0x2a')]['count'](_0x4c3e9e)[_0x1872('0x25')](function(_0x18a711){_0x3f2779[_0x1872('0x40')]=_0x18a711;if(_0x5bab21[_0x1872('0x31')][_0x1872('0x41')]){_0x333961['include']=[{'all':!![]}];}return db[_0x1872('0x2a')][_0x1872('0x42')](_0x333961);})[_0x1872('0x25')](function(_0x4b2dae){_0x3f2779[_0x1872('0x43')]=_0x4b2dae;return _0x3f2779;})[_0x1872('0x25')](respondWithFilteredResult(_0x5469e7,_0x333961))[_0x1872('0x44')](handleError(_0x5469e7,null));};exports[_0x1872('0x45')]=function(_0x38b60e,_0xbd6e46){var _0x857b68={'raw':![],'where':{'id':_0x38b60e[_0x1872('0x46')]['id']}},_0x300806={};_0x300806['model']=_[_0x1872('0x30')](db[_0x1872('0x2a')][_0x1872('0x2b')]);_0x300806[_0x1872('0x31')]=_[_0x1872('0x30')](_0x38b60e[_0x1872('0x31')]);_0x300806[_0x1872('0x32')]=_['intersection'](_0x300806['model'],_0x300806[_0x1872('0x31')]);_0x857b68[_0x1872('0x35')]=_[_0x1872('0x33')](_0x300806[_0x1872('0x2e')],qs['fields'](_0x38b60e['query']['fields']));_0x857b68['attributes']=_0x857b68[_0x1872('0x35')]['length']?_0x857b68[_0x1872('0x35')]:_0x300806[_0x1872('0x2e')];if(_0x38b60e['query'][_0x1872('0x41')]){_0x857b68[_0x1872('0x47')]=[{'all':!![]}];}_0x857b68=_['merge']({},_0x857b68,_0x38b60e[_0x1872('0x3f')]);return db[_0x1872('0x2a')]['find'](_0x857b68)[_0x1872('0x25')](handleEntityNotFound(_0xbd6e46,null))[_0x1872('0x25')](respondWithResult(_0xbd6e46,null))[_0x1872('0x44')](handleError(_0xbd6e46,null));};exports[_0x1872('0x48')]=function(_0x392f26,_0x2a6341){return db[_0x1872('0x2a')][_0x1872('0x48')](_0x392f26['body'],{})['then'](respondWithResult(_0x2a6341,0xc9))[_0x1872('0x44')](handleError(_0x2a6341,null));};exports[_0x1872('0x23')]=function(_0x3e985e,_0x5e70a6){if(_0x3e985e[_0x1872('0x49')]['id']){delete _0x3e985e[_0x1872('0x49')]['id'];}return db[_0x1872('0x2a')][_0x1872('0x4a')]({'where':{'id':_0x3e985e[_0x1872('0x46')]['id']}})['then'](handleEntityNotFound(_0x5e70a6,null))[_0x1872('0x25')](saveUpdates(_0x3e985e[_0x1872('0x49')],null))[_0x1872('0x25')](respondWithResult(_0x5e70a6,null))[_0x1872('0x44')](handleError(_0x5e70a6,null));};exports[_0x1872('0x24')]=function(_0x5b6c04,_0x3a6edb){return db[_0x1872('0x2a')][_0x1872('0x4a')]({'where':{'id':_0x5b6c04[_0x1872('0x46')]['id']}})[_0x1872('0x25')](handleEntityNotFound(_0x3a6edb,null))[_0x1872('0x25')](removeEntity(_0x3a6edb,null))[_0x1872('0x44')](handleError(_0x3a6edb,null));};exports[_0x1872('0x4b')]=function(_0x3528b6,_0x5f4ae9,_0xbdf0c6){var _0x183f7b={};var _0x3d4143={};var _0x17a80b;var _0x340570;return db[_0x1872('0x2a')][_0x1872('0x4c')]({'where':{'id':_0x3528b6['params']['id']}})['then'](handleEntityNotFound(_0x5f4ae9,null))[_0x1872('0x25')](function(_0x3145b1){if(_0x3145b1){_0x17a80b=_0x3145b1;_0x3d4143[_0x1872('0x2e')]=_['keys'](db[_0x1872('0x4d')][_0x1872('0x2b')]);_0x3d4143[_0x1872('0x31')]=_[_0x1872('0x30')](_0x3528b6[_0x1872('0x31')]);_0x3d4143[_0x1872('0x32')]=_[_0x1872('0x33')](_0x3d4143[_0x1872('0x2e')],_0x3d4143['query']);_0x183f7b[_0x1872('0x35')]=_['intersection'](_0x3d4143[_0x1872('0x2e')],qs[_0x1872('0x34')](_0x3528b6[_0x1872('0x31')]['fields']));_0x183f7b[_0x1872('0x35')]=_0x183f7b['attributes'][_0x1872('0x36')]?_0x183f7b['attributes']:_0x3d4143['model'];_0x183f7b[_0x1872('0x4e')]=qs[_0x1872('0x39')](_0x3528b6[_0x1872('0x31')][_0x1872('0x39')]);_0x183f7b['where']=qs[_0x1872('0x32')](_[_0x1872('0x3a')](_0x3528b6[_0x1872('0x31')],_0x3d4143[_0x1872('0x32')]));if(_0x3528b6[_0x1872('0x31')][_0x1872('0x3b')]){_0x183f7b[_0x1872('0x3d')]=_[_0x1872('0x3c')](_0x183f7b[_0x1872('0x3d')],{'$or':_[_0x1872('0x2f')](_0x183f7b[_0x1872('0x35')],function(_0x101ada){var _0x7d4201={};_0x7d4201[_0x101ada]={'$like':'%'+_0x3528b6[_0x1872('0x31')][_0x1872('0x3b')]+'%'};return _0x7d4201;})});}_0x183f7b=_[_0x1872('0x3c')]({},_0x183f7b,_0x3528b6[_0x1872('0x3f')]);return _0x17a80b[_0x1872('0x4b')](_0x183f7b);}})[_0x1872('0x25')](function(_0x1c3a86){if(_0x1c3a86){_0x340570=_0x1c3a86[_0x1872('0x36')];if(!_0x3528b6[_0x1872('0x31')][_0x1872('0x37')]('nolimit')){_0x183f7b[_0x1872('0x1d')]=qs['limit'](_0x3528b6[_0x1872('0x31')]['limit']);_0x183f7b['offset']=qs[_0x1872('0x1b')](_0x3528b6[_0x1872('0x31')][_0x1872('0x1b')]);}return _0x17a80b[_0x1872('0x4b')](_0x183f7b);}})[_0x1872('0x25')](function(_0x51c0d9){if(_0x51c0d9){return _0x51c0d9?{'count':_0x340570,'rows':_0x51c0d9}:null;}})[_0x1872('0x25')](respondWithResult(_0x5f4ae9,null))[_0x1872('0x44')](handleError(_0x5f4ae9,null));};exports[_0x1872('0x4f')]=function(_0x2cc5fd,_0x30596c,_0x59bd34){if(_0x2cc5fd[_0x1872('0x49')]['id']){delete _0x2cc5fd['body']['id'];}return db[_0x1872('0x2a')][_0x1872('0x4c')]({'where':{'id':_0x2cc5fd[_0x1872('0x46')]['id']}})[_0x1872('0x25')](handleEntityNotFound(_0x30596c,null))[_0x1872('0x25')](function(_0x36d3ee){if(_0x36d3ee){_0x2cc5fd[_0x1872('0x49')][_0x1872('0x50')]=_0x36d3ee['id'];_0x2cc5fd['body'][_0x1872('0x51')]=integrations[_0x1872('0x52')](_0x2cc5fd['body'][_0x1872('0x53')],_0x2cc5fd['body'][_0x1872('0x2c')]);_0x2cc5fd['body'][_0x1872('0x54')]=integrations[_0x1872('0x55')](_0x2cc5fd[_0x1872('0x49')]['channel'],_0x2cc5fd['body']['type']);return db[_0x1872('0x4d')][_0x1872('0x48')](_0x2cc5fd['body'],{'include':[{'model':db[_0x1872('0x56')],'as':_0x1872('0x51')},{'model':db[_0x1872('0x56')],'as':_0x1872('0x54')}]});}return null;})[_0x1872('0x25')](respondWithResult(_0x30596c,null))[_0x1872('0x44')](handleError(_0x30596c,null));};exports['getFields']=function(_0x1897fe,_0x2af635,_0x454a2f){var _0x2742b9='';return db[_0x1872('0x2a')][_0x1872('0x4c')]({'where':{'id':_0x1897fe[_0x1872('0x46')]['id']},'attributes':['id',_0x1872('0x57'),_0x1872('0x58')]})[_0x1872('0x25')](handleEntityNotFound(_0x2af635,null))[_0x1872('0x25')](function(_0x311fbc){if(_0x311fbc){_0x2742b9=_0x311fbc[_0x1872('0x57')];var _0xc8c0d3=_0x2742b9[_0x1872('0x59')](-0x1);if(_0xc8c0d3==='/'){_0x2742b9=_0x2742b9[_0x1872('0x5a')](0x0,_0x2742b9[_0x1872('0x5b')](_0xc8c0d3));}return rp({'method':'GET','uri':util['format'](_0x1872('0x5c'),_0x2742b9,_0x1872('0x5d')),'headers':{'Authorization':util[_0x1872('0x5e')]('Basic\x20%s',new Buffer(util[_0x1872('0x5e')]('%s:X',_0x311fbc['apiKey']))[_0x1872('0x5f')]('base64'))},'json':!![]});}})[_0x1872('0x25')](function(_0x5c057e){if(_0x5c057e){var _0x236b66=['requester',_0x1872('0x60'),_0x1872('0x61'),_0x1872('0x62'),_0x1872('0x19'),_0x1872('0x63'),_0x1872('0x64'),_0x1872('0x65'),_0x1872('0x66'),_0x1872('0x64'),'company'];_[_0x1872('0x67')](_0x5c057e,function(_0x9f53bc){return _0x236b66[_0x1872('0x68')](_0x9f53bc[_0x1872('0x28')])||!_0x9f53bc[_0x1872('0x69')]&&_0x9f53bc[_0x1872('0x2c')]!==_0x1872('0x6a')&&_0x9f53bc[_0x1872('0x2c')]!==_0x1872('0x6b');});return{'count':_0x5c057e[_0x1872('0x36')],'rows':_[_0x1872('0x2f')](_0x5c057e,function(_0xa39f0b){return{'id':_0xa39f0b[_0x1872('0x28')],'name':_0xa39f0b[_0x1872('0x6c')],'custom':!_0xa39f0b['default'],'options':_0xa39f0b['choices']?_['map'](_0xa39f0b[_0x1872('0x6d')],function(_0x5d5a72){return{'name':_[_0x1872('0x6e')](_0x5d5a72),'value':_0x5d5a72};}):[]};})};}})[_0x1872('0x25')](respondWithResult(_0x2af635,null))[_0x1872('0x44')](function(_0x57df91){var _0x5f5cae=_0x1897fe[_0x1872('0x31')][_0x1872('0x6f')]?0x1f4:_0x57df91[_0x1872('0x70')]||0x1f4;logger['error'](_0x1872('0x71'),'getFields',_0x5f5cae,JSON[_0x1872('0x72')](_0x57df91));delete _0x57df91[_0x1872('0x28')];if(_0x5f5cae===0x191){_0x5f5cae=0x190;}_0x2af635[_0x1872('0x19')](_0x5f5cae)[_0x1872('0x73')](_0x1897fe['query']['test']?{'message':_0x1872('0x74'),'statusCode':_0x57df91[_0x1872('0x70')]}:_0x57df91);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 3f575d1..2e698f4 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 _0x99aa=['int_freshdesk_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','FreshdeskAccount'];(function(_0x46a05f,_0x401502){var _0x3b723c=function(_0x859b3b){while(--_0x859b3b){_0x46a05f['push'](_0x46a05f['shift']());}};_0x3b723c(++_0x401502);}(_0x99aa,0x1e1));var _0xa99a=function(_0x3ca863,_0x3c968c){_0x3ca863=_0x3ca863-0x0;var _0x461623=_0x99aa[_0x3ca863];return _0x461623;};'use strict';var _=require(_0xa99a('0x0'));var util=require(_0xa99a('0x1'));var logger=require(_0xa99a('0x2'))(_0xa99a('0x3'));var moment=require(_0xa99a('0x4'));var BPromise=require(_0xa99a('0x5'));var rp=require(_0xa99a('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa99a('0x7'));var config=require(_0xa99a('0x8'));var attributes=require(_0xa99a('0x9'));var integrations=require(_0xa99a('0xa'));module[_0xa99a('0xb')]=function(_0x4763bd,_0xe9d8c4){return _0x4763bd[_0xa99a('0xc')](_0xa99a('0xd'),attributes,{'tableName':_0xa99a('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x717b=['FreshdeskAccount','int_freshdesk_accounts','lodash','api','request-promise','path','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define'];(function(_0xab0515,_0x4b8ab2){var _0x443d59=function(_0xfd6c59){while(--_0xfd6c59){_0xab0515['push'](_0xab0515['shift']());}};_0x443d59(++_0x4b8ab2);}(_0x717b,0x199));var _0xb717=function(_0xc318e1,_0x44db20){_0xc318e1=_0xc318e1-0x0;var _0x1b4383=_0x717b[_0xc318e1];return _0x1b4383;};'use strict';var _=require(_0xb717('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xb717('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb717('0x2'));var fs=require('fs');var path=require(_0xb717('0x3'));var rimraf=require('rimraf');var config=require(_0xb717('0x4'));var attributes=require(_0xb717('0x5'));var integrations=require(_0xb717('0x6'));module[_0xb717('0x7')]=function(_0x26a017,_0x545a7f){return _0x26a017[_0xb717('0x8')](_0xb717('0x9'),attributes,{'tableName':_0xb717('0xa'),'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 2011ee0..16ce564 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 _0x8fed=['map','then','catch','FreshdeskAccount','find','raw','ShowFreshdeskAccount','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','GetFreshdeskAccount','options','where','attributes','limit','include','model'];(function(_0x3beb49,_0x31630b){var _0xa7b76c=function(_0x322638){while(--_0x322638){_0x3beb49['push'](_0x3beb49['shift']());}};_0xa7b76c(++_0x31630b);}(_0x8fed,0xf5));var _0xd8fe=function(_0x11fc46,_0x191988){_0x11fc46=_0x11fc46-0x0;var _0x1c50da=_0x8fed[_0x11fc46];return _0x1c50da;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd8fe('0x0'));var BPromise=require(_0xd8fe('0x1'));var rs=require(_0xd8fe('0x2'));var fs=require('fs');var Redis=require(_0xd8fe('0x3'));var db=require(_0xd8fe('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd8fe('0x5'))(_0xd8fe('0x6'));var config=require(_0xd8fe('0x7'));var jayson=require(_0xd8fe('0x8'));var client=jayson[_0xd8fe('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x7e3b94,_0x1747b3,_0xa33e22){return new BPromise(function(_0x26d33d,_0x5e48f9){return client[_0xd8fe('0xa')](_0x7e3b94,_0xa33e22)['then'](function(_0x410d44){logger[_0xd8fe('0xb')](_0xd8fe('0xc'),_0x1747b3,_0xd8fe('0xd'));logger[_0xd8fe('0xe')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x1747b3,_0xd8fe('0xd'),JSON[_0xd8fe('0xf')](_0x410d44));if(_0x410d44[_0xd8fe('0x10')]){if(_0x410d44['error'][_0xd8fe('0x11')]===0x1f4){logger['error'](_0xd8fe('0xc'),_0x1747b3,_0x410d44[_0xd8fe('0x10')][_0xd8fe('0x12')]);return _0x5e48f9(_0x410d44[_0xd8fe('0x10')][_0xd8fe('0x12')]);}logger['error'](_0xd8fe('0xc'),_0x1747b3,_0x410d44[_0xd8fe('0x10')]['message']);return _0x26d33d(_0x410d44[_0xd8fe('0x10')][_0xd8fe('0x12')]);}else{logger[_0xd8fe('0xb')](_0xd8fe('0xc'),_0x1747b3,_0xd8fe('0xd'));_0x26d33d(_0x410d44[_0xd8fe('0x13')][_0xd8fe('0x12')]);}})['catch'](function(_0x260a7f){logger['error'](_0xd8fe('0xc'),_0x1747b3,_0x260a7f);_0x5e48f9(_0x260a7f);});});}exports[_0xd8fe('0x14')]=function(_0x4cfb98){var _0x31a5d7=this;return new Promise(function(_0x4b7d9e,_0x52a8b6){return db['FreshdeskAccount']['findAll']({'raw':_0x4cfb98['options']?_0x4cfb98[_0xd8fe('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x4cfb98[_0xd8fe('0x15')]?_0x4cfb98['options'][_0xd8fe('0x16')]||null:null,'attributes':_0x4cfb98['options']?_0x4cfb98[_0xd8fe('0x15')][_0xd8fe('0x17')]||null:null,'limit':_0x4cfb98[_0xd8fe('0x15')]?_0x4cfb98[_0xd8fe('0x15')][_0xd8fe('0x18')]||null:null,'include':_0x4cfb98[_0xd8fe('0x15')]?_0x4cfb98[_0xd8fe('0x15')][_0xd8fe('0x19')]?_['map'](_0x4cfb98[_0xd8fe('0x15')][_0xd8fe('0x19')],function(_0x19d4d1){return{'model':db[_0x19d4d1[_0xd8fe('0x1a')]],'as':_0x19d4d1['as'],'attributes':_0x19d4d1['attributes'],'include':_0x19d4d1[_0xd8fe('0x19')]?_[_0xd8fe('0x1b')](_0x19d4d1[_0xd8fe('0x19')],function(_0x130c16){return{'model':db[_0x130c16[_0xd8fe('0x1a')]],'as':_0x130c16['as'],'attributes':_0x130c16[_0xd8fe('0x17')],'include':_0x130c16['include']?_['map'](_0x130c16[_0xd8fe('0x19')],function(_0x22ef87){return{'model':db[_0x22ef87[_0xd8fe('0x1a')]],'as':_0x22ef87['as'],'attributes':_0x22ef87[_0xd8fe('0x17')]};}):[]};}):[]};}):[]:[]})[_0xd8fe('0x1c')](function(_0x1666e4){logger[_0xd8fe('0xb')](_0xd8fe('0x14'),_0x4cfb98);logger[_0xd8fe('0xe')](_0xd8fe('0x14'),_0x4cfb98,JSON[_0xd8fe('0xf')](_0x1666e4));_0x4b7d9e(_0x1666e4);})[_0xd8fe('0x1d')](function(_0x2c2767){logger[_0xd8fe('0x10')]('GetFreshdeskAccount',_0x2c2767[_0xd8fe('0x12')],_0x4cfb98);_0x52a8b6(_0x31a5d7[_0xd8fe('0x10')](0x1f4,_0x2c2767[_0xd8fe('0x12')]));});});};exports['ShowFreshdeskAccount']=function(_0x2df5a8){var _0x32f51a=this;return new Promise(function(_0x380c78,_0x196b20){return db[_0xd8fe('0x1e')][_0xd8fe('0x1f')]({'raw':_0x2df5a8[_0xd8fe('0x15')]?_0x2df5a8[_0xd8fe('0x15')][_0xd8fe('0x20')]===undefined?!![]:![]:!![],'where':_0x2df5a8[_0xd8fe('0x15')]?_0x2df5a8['options'][_0xd8fe('0x16')]||null:null,'attributes':_0x2df5a8[_0xd8fe('0x15')]?_0x2df5a8[_0xd8fe('0x15')][_0xd8fe('0x17')]||null:null,'include':_0x2df5a8[_0xd8fe('0x15')]?_0x2df5a8[_0xd8fe('0x15')][_0xd8fe('0x19')]?_['map'](_0x2df5a8[_0xd8fe('0x15')][_0xd8fe('0x19')],function(_0x276e0a){return{'model':db[_0x276e0a[_0xd8fe('0x1a')]],'as':_0x276e0a['as'],'attributes':_0x276e0a[_0xd8fe('0x17')],'include':_0x276e0a[_0xd8fe('0x19')]?_[_0xd8fe('0x1b')](_0x276e0a[_0xd8fe('0x19')],function(_0x2950b1){return{'model':db[_0x2950b1[_0xd8fe('0x1a')]],'as':_0x2950b1['as'],'attributes':_0x2950b1[_0xd8fe('0x17')],'include':_0x2950b1['include']?_[_0xd8fe('0x1b')](_0x2950b1[_0xd8fe('0x19')],function(_0xfc7ec2){return{'model':db[_0xfc7ec2[_0xd8fe('0x1a')]],'as':_0xfc7ec2['as'],'attributes':_0xfc7ec2[_0xd8fe('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4f2ef1){logger[_0xd8fe('0xb')](_0xd8fe('0x21'),_0x2df5a8);logger[_0xd8fe('0xe')]('ShowFreshdeskAccount',_0x2df5a8,JSON[_0xd8fe('0xf')](_0x4f2ef1));_0x380c78(_0x4f2ef1);})[_0xd8fe('0x1d')](function(_0x5a8bee){logger[_0xd8fe('0x10')](_0xd8fe('0x21'),_0x5a8bee['message'],_0x2df5a8);_0x196b20(_0x32f51a[_0xd8fe('0x10')](0x1f4,_0x5a8bee['message']));});});}; \ No newline at end of file +var _0xf6e4=['model','GetFreshdeskAccount','ShowFreshdeskAccount','where','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','then','info','FreshdeskAccount,\x20%s,\x20%s','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch','FreshdeskAccount','findAll','options','raw','attributes','limit','include','map'];(function(_0x58eb56,_0x1e19c6){var _0x1ec600=function(_0x102ff1){while(--_0x102ff1){_0x58eb56['push'](_0x58eb56['shift']());}};_0x1ec600(++_0x1e19c6);}(_0xf6e4,0x16f));var _0x4f6e=function(_0x1f9942,_0x355d1f){_0x1f9942=_0x1f9942-0x0;var _0x2d34c1=_0xf6e4[_0x1f9942];return _0x2d34c1;};'use strict';var _=require('lodash');var util=require(_0x4f6e('0x0'));var moment=require('moment');var BPromise=require(_0x4f6e('0x1'));var rs=require(_0x4f6e('0x2'));var fs=require('fs');var Redis=require(_0x4f6e('0x3'));var db=require(_0x4f6e('0x4'))['db'];var utils=require(_0x4f6e('0x5'));var logger=require('../../config/logger')(_0x4f6e('0x6'));var config=require(_0x4f6e('0x7'));var jayson=require(_0x4f6e('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x53fd17,_0x377b87,_0x16f4e8){return new BPromise(function(_0x1b22c6,_0xe4e0e9){return client['request'](_0x53fd17,_0x16f4e8)[_0x4f6e('0x9')](function(_0x318e12){logger[_0x4f6e('0xa')](_0x4f6e('0xb'),_0x377b87,'request\x20sent');logger[_0x4f6e('0xc')](_0x4f6e('0xd'),_0x377b87,_0x4f6e('0xe'),JSON[_0x4f6e('0xf')](_0x318e12));if(_0x318e12['error']){if(_0x318e12['error'][_0x4f6e('0x10')]===0x1f4){logger[_0x4f6e('0x11')](_0x4f6e('0xb'),_0x377b87,_0x318e12[_0x4f6e('0x11')][_0x4f6e('0x12')]);return _0xe4e0e9(_0x318e12[_0x4f6e('0x11')]['message']);}logger[_0x4f6e('0x11')]('FreshdeskAccount,\x20%s,\x20%s',_0x377b87,_0x318e12[_0x4f6e('0x11')][_0x4f6e('0x12')]);return _0x1b22c6(_0x318e12[_0x4f6e('0x11')][_0x4f6e('0x12')]);}else{logger[_0x4f6e('0xa')](_0x4f6e('0xb'),_0x377b87,_0x4f6e('0xe'));_0x1b22c6(_0x318e12[_0x4f6e('0x13')][_0x4f6e('0x12')]);}})[_0x4f6e('0x14')](function(_0x5b6558){logger[_0x4f6e('0x11')](_0x4f6e('0xb'),_0x377b87,_0x5b6558);_0xe4e0e9(_0x5b6558);});});}exports['GetFreshdeskAccount']=function(_0xec6403){var _0x38851c=this;return new Promise(function(_0x3e7686,_0x1a17f1){return db[_0x4f6e('0x15')][_0x4f6e('0x16')]({'raw':_0xec6403[_0x4f6e('0x17')]?_0xec6403[_0x4f6e('0x17')][_0x4f6e('0x18')]===undefined?!![]:![]:!![],'where':_0xec6403[_0x4f6e('0x17')]?_0xec6403[_0x4f6e('0x17')]['where']||null:null,'attributes':_0xec6403[_0x4f6e('0x17')]?_0xec6403['options'][_0x4f6e('0x19')]||null:null,'limit':_0xec6403[_0x4f6e('0x17')]?_0xec6403['options'][_0x4f6e('0x1a')]||null:null,'include':_0xec6403['options']?_0xec6403[_0x4f6e('0x17')][_0x4f6e('0x1b')]?_[_0x4f6e('0x1c')](_0xec6403['options'][_0x4f6e('0x1b')],function(_0x3bdc73){return{'model':db[_0x3bdc73['model']],'as':_0x3bdc73['as'],'attributes':_0x3bdc73[_0x4f6e('0x19')],'include':_0x3bdc73[_0x4f6e('0x1b')]?_[_0x4f6e('0x1c')](_0x3bdc73[_0x4f6e('0x1b')],function(_0x25e58e){return{'model':db[_0x25e58e[_0x4f6e('0x1d')]],'as':_0x25e58e['as'],'attributes':_0x25e58e[_0x4f6e('0x19')],'include':_0x25e58e[_0x4f6e('0x1b')]?_['map'](_0x25e58e['include'],function(_0x5ecd7b){return{'model':db[_0x5ecd7b[_0x4f6e('0x1d')]],'as':_0x5ecd7b['as'],'attributes':_0x5ecd7b['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3ac7d0){logger[_0x4f6e('0xa')]('GetFreshdeskAccount',_0xec6403);logger[_0x4f6e('0xc')](_0x4f6e('0x1e'),_0xec6403,JSON[_0x4f6e('0xf')](_0x3ac7d0));_0x3e7686(_0x3ac7d0);})[_0x4f6e('0x14')](function(_0x33f733){logger[_0x4f6e('0x11')](_0x4f6e('0x1e'),_0x33f733[_0x4f6e('0x12')],_0xec6403);_0x1a17f1(_0x38851c['error'](0x1f4,_0x33f733[_0x4f6e('0x12')]));});});};exports[_0x4f6e('0x1f')]=function(_0x222522){var _0x1f7971=this;return new Promise(function(_0x30855a,_0x278b26){return db['FreshdeskAccount']['find']({'raw':_0x222522['options']?_0x222522['options']['raw']===undefined?!![]:![]:!![],'where':_0x222522[_0x4f6e('0x17')]?_0x222522[_0x4f6e('0x17')][_0x4f6e('0x20')]||null:null,'attributes':_0x222522[_0x4f6e('0x17')]?_0x222522[_0x4f6e('0x17')][_0x4f6e('0x19')]||null:null,'include':_0x222522['options']?_0x222522[_0x4f6e('0x17')]['include']?_['map'](_0x222522['options'][_0x4f6e('0x1b')],function(_0x28b20e){return{'model':db[_0x28b20e[_0x4f6e('0x1d')]],'as':_0x28b20e['as'],'attributes':_0x28b20e[_0x4f6e('0x19')],'include':_0x28b20e['include']?_[_0x4f6e('0x1c')](_0x28b20e[_0x4f6e('0x1b')],function(_0x249800){return{'model':db[_0x249800['model']],'as':_0x249800['as'],'attributes':_0x249800[_0x4f6e('0x19')],'include':_0x249800[_0x4f6e('0x1b')]?_[_0x4f6e('0x1c')](_0x249800[_0x4f6e('0x1b')],function(_0x5731ae){return{'model':db[_0x5731ae[_0x4f6e('0x1d')]],'as':_0x5731ae['as'],'attributes':_0x5731ae[_0x4f6e('0x19')]};}):[]};}):[]};}):[]:[]})[_0x4f6e('0x9')](function(_0x147325){logger[_0x4f6e('0xa')](_0x4f6e('0x1f'),_0x222522);logger[_0x4f6e('0xc')]('ShowFreshdeskAccount',_0x222522,JSON[_0x4f6e('0xf')](_0x147325));_0x30855a(_0x147325);})[_0x4f6e('0x14')](function(_0x19b3d0){logger[_0x4f6e('0x11')](_0x4f6e('0x1f'),_0x19b3d0['message'],_0x222522);_0x278b26(_0x1f7971[_0x4f6e('0x11')](0x1f4,_0x19b3d0['message']));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index e53e957..4f398f2 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 _0x11c3=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','index','/:id','show','get','/:id/fields','isAuthenticated','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','put','update','delete','destroy','exports','multer','util','path'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0x11c3,0x193));var _0x311c=function(_0x331d7f,_0x32706e){_0x331d7f=_0x331d7f-0x0;var _0x4a619f=_0x11c3[_0x331d7f];return _0x4a619f;};'use strict';var multer=require(_0x311c('0x0'));var util=require(_0x311c('0x1'));var path=require(_0x311c('0x2'));var timeout=require(_0x311c('0x3'));var express=require(_0x311c('0x4'));var router=express[_0x311c('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x311c('0x6'));var interaction=require(_0x311c('0x7'));var config=require(_0x311c('0x8'));var controller=require(_0x311c('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x311c('0xa')]);router['get'](_0x311c('0xb'),auth['isAuthenticated'](),controller[_0x311c('0xc')]);router[_0x311c('0xd')](_0x311c('0xe'),auth[_0x311c('0xf')](),controller[_0x311c('0x10')]);router[_0x311c('0xd')](_0x311c('0x11'),auth[_0x311c('0xf')](),controller[_0x311c('0x12')]);router[_0x311c('0xd')](_0x311c('0x13'),auth[_0x311c('0xf')](),controller[_0x311c('0x14')]);router['get'](_0x311c('0x15'),auth[_0x311c('0xf')](),controller[_0x311c('0x16')]);router[_0x311c('0x17')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x311c('0x15'),auth[_0x311c('0xf')](),controller['setTags']);router[_0x311c('0x18')](_0x311c('0xb'),auth[_0x311c('0xf')](),controller[_0x311c('0x19')]);router[_0x311c('0x1a')]('/:id',auth['isAuthenticated'](),controller[_0x311c('0x1b')]);module[_0x311c('0x1c')]=router; \ No newline at end of file +var _0xc47e=['fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshdeskConfiguration.controller','get','isAuthenticated','/:id','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','setTags','put','multer','util','path','connect-timeout'];(function(_0x576e2b,_0x328953){var _0x46461a=function(_0xce4d9e){while(--_0xce4d9e){_0x576e2b['push'](_0x576e2b['shift']());}};_0x46461a(++_0x328953);}(_0xc47e,0x1b1));var _0xec47=function(_0x22bdd3,_0x552e50){_0x22bdd3=_0x22bdd3-0x0;var _0x44d9d9=_0xc47e[_0x22bdd3];return _0x44d9d9;};'use strict';var multer=require(_0xec47('0x0'));var util=require(_0xec47('0x1'));var path=require(_0xec47('0x2'));var timeout=require(_0xec47('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xec47('0x4'));var auth=require(_0xec47('0x5'));var interaction=require(_0xec47('0x6'));var config=require('../../config/environment');var controller=require(_0xec47('0x7'));router[_0xec47('0x8')]('/',auth[_0xec47('0x9')](),controller['index']);router[_0xec47('0x8')](_0xec47('0xa'),auth[_0xec47('0x9')](),controller[_0xec47('0xb')]);router[_0xec47('0x8')]('/:id/fields',auth[_0xec47('0x9')](),controller[_0xec47('0xc')]);router['get'](_0xec47('0xd'),auth['isAuthenticated'](),controller[_0xec47('0xe')]);router[_0xec47('0x8')](_0xec47('0xf'),auth['isAuthenticated'](),controller[_0xec47('0x10')]);router[_0xec47('0x8')](_0xec47('0x11'),auth[_0xec47('0x9')](),controller[_0xec47('0x12')]);router[_0xec47('0x13')]('/',auth[_0xec47('0x9')](),controller[_0xec47('0x14')]);router['post'](_0xec47('0x11'),auth[_0xec47('0x9')](),controller[_0xec47('0x15')]);router[_0xec47('0x16')](_0xec47('0xa'),auth[_0xec47('0x9')](),controller['update']);router['delete'](_0xec47('0xa'),auth[_0xec47('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index fa99bdb..ff97470 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 _0xc692=['STRING','sequelize'];(function(_0x343d40,_0x577e42){var _0xa3f900=function(_0x5b6853){while(--_0x5b6853){_0x343d40['push'](_0x343d40['shift']());}};_0xa3f900(++_0x577e42);}(_0xc692,0xc9));var _0x2c69=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xc692[_0x3b380d];return _0x54502b;};'use strict';var Sequelize=require(_0x2c69('0x0'));module['exports']={'name':{'type':Sequelize[_0x2c69('0x1')]},'description':{'type':Sequelize[_0x2c69('0x1')]}}; \ No newline at end of file +var _0xd81b=['exports','STRING','sequelize'];(function(_0x3af693,_0x220857){var _0x385005=function(_0x34e968){while(--_0x34e968){_0x3af693['push'](_0x3af693['shift']());}};_0x385005(++_0x220857);}(_0xd81b,0x1f1));var _0xbd81=function(_0x4df6bf,_0x53fc2e){_0x4df6bf=_0x4df6bf-0x0;var _0x1e0063=_0xd81b[_0x4df6bf];return _0x1e0063;};'use strict';var Sequelize=require(_0xbd81('0x0'));module[_0xbd81('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xbd81('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index a431047..8f03ff4 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 _0x7c7f=['to-csv','fs-extra','lodash','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','end','error','name','send','index','map','FreshdeskConfiguration','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','filter','includeAll','include','findAll','rows','catch','params','options','find','create','body','destroy','getFields','findOne','getSubjects','FreshdeskField','nolimit','getDescriptions','getTags','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox'];(function(_0x3babb2,_0x4e832d){var _0x43e8fd=function(_0x58fa4d){while(--_0x58fa4d){_0x3babb2['push'](_0x3babb2['shift']());}};_0x43e8fd(++_0x4e832d);}(_0x7c7f,0x9d));var _0xf7c7=function(_0x541260,_0x4c7f2e){_0x541260=_0x541260-0x0;var _0x1dd2b5=_0x7c7f[_0x541260];return _0x1dd2b5;};'use strict';var emlformat=require(_0xf7c7('0x0'));var rimraf=require(_0xf7c7('0x1'));var zipdir=require(_0xf7c7('0x2'));var jsonpatch=require(_0xf7c7('0x3'));var rp=require(_0xf7c7('0x4'));var moment=require(_0xf7c7('0x5'));var BPromise=require(_0xf7c7('0x6'));var Mustache=require(_0xf7c7('0x7'));var util=require(_0xf7c7('0x8'));var path=require(_0xf7c7('0x9'));var sox=require(_0xf7c7('0xa'));var csv=require(_0xf7c7('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf7c7('0xc'));var _=require(_0xf7c7('0xd'));var squel=require('squel');var crypto=require(_0xf7c7('0xe'));var jsforce=require(_0xf7c7('0xf'));var deskjs=require(_0xf7c7('0x10'));var toCsv=require(_0xf7c7('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xf7c7('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xf7c7('0x12'));var as=require(_0xf7c7('0x13'));var hardwareService=require(_0xf7c7('0x14'));var logger=require(_0xf7c7('0x15'))('api');var utils=require(_0xf7c7('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xf7c7('0x17'));var db=require(_0xf7c7('0x18'))['db'];function respondWithStatusCode(_0x3b5d56,_0x34c264){_0x34c264=_0x34c264||0xcc;return function(_0x5b211a){if(_0x5b211a){return _0x3b5d56[_0xf7c7('0x19')](_0x34c264);}return _0x3b5d56[_0xf7c7('0x1a')](_0x34c264)['end']();};}function respondWithResult(_0x344377,_0x3236c0){_0x3236c0=_0x3236c0||0xc8;return function(_0x2dfc73){if(_0x2dfc73){return _0x344377[_0xf7c7('0x1a')](_0x3236c0)[_0xf7c7('0x1b')](_0x2dfc73);}};}function respondWithFilteredResult(_0x19eb1a,_0x19b91b){return function(_0x21413d){if(_0x21413d){var _0x45685f=typeof _0x19b91b[_0xf7c7('0x1c')]===_0xf7c7('0x1d')&&typeof _0x19b91b['limit']===_0xf7c7('0x1d');var _0x3a191d=_0x21413d[_0xf7c7('0x1e')];var _0x37543a=_0x45685f?0x0:_0x19b91b['offset'];var _0x3eac81=_0x45685f?_0x21413d['count']:_0x19b91b[_0xf7c7('0x1c')]+_0x19b91b[_0xf7c7('0x1f')];var _0x500eeb;if(_0x3eac81>=_0x3a191d){_0x3eac81=_0x3a191d;_0x500eeb=0xc8;}else{_0x500eeb=0xce;}_0x19eb1a[_0xf7c7('0x1a')](_0x500eeb);return _0x19eb1a[_0xf7c7('0x20')](_0xf7c7('0x21'),_0x37543a+'-'+_0x3eac81+'/'+_0x3a191d)['json'](_0x21413d);}return null;};}function patchUpdates(_0x226d3b){return function(_0x30d342){try{jsonpatch[_0xf7c7('0x22')](_0x30d342,_0x226d3b,!![]);}catch(_0x3e8b09){return BPromise[_0xf7c7('0x23')](_0x3e8b09);}return _0x30d342[_0xf7c7('0x24')]();};}function saveUpdates(_0x19ab03,_0xa4aebb){return function(_0x3916b0){if(_0x3916b0){return _0x3916b0['update'](_0x19ab03)[_0xf7c7('0x25')](function(_0x125738){return _0x125738;});}return null;};}function removeEntity(_0x3c8606,_0x483724){return function(_0x20f630){if(_0x20f630){return _0x20f630['destroy']()[_0xf7c7('0x25')](function(){_0x3c8606[_0xf7c7('0x1a')](0xcc)[_0xf7c7('0x26')]();});}};}function handleEntityNotFound(_0x176935,_0x21945a){return function(_0x32beea){if(!_0x32beea){_0x176935[_0xf7c7('0x19')](0x194);}return _0x32beea;};}function handleError(_0xef83bc,_0x16c6ac){_0x16c6ac=_0x16c6ac||0x1f4;return function(_0x220450){logger[_0xf7c7('0x27')](_0x220450['stack']);if(_0x220450[_0xf7c7('0x28')]){delete _0x220450['name'];}_0xef83bc['status'](_0x16c6ac)[_0xf7c7('0x29')](_0x220450);};}exports[_0xf7c7('0x2a')]=function(_0x29623c,_0xf6ea1d){var _0x3034a4={},_0x489e9b={},_0x35ffcf={'count':0x0,'rows':[]};var _0x5c41f5=_[_0xf7c7('0x2b')](db[_0xf7c7('0x2c')][_0xf7c7('0x2d')],function(_0x5e938c){return{'name':_0x5e938c[_0xf7c7('0x2e')],'type':_0x5e938c[_0xf7c7('0x2f')][_0xf7c7('0x30')]};});_0x489e9b[_0xf7c7('0x31')]=_[_0xf7c7('0x2b')](_0x5c41f5,_0xf7c7('0x28'));_0x489e9b['query']=_[_0xf7c7('0x32')](_0x29623c['query']);_0x489e9b[_0xf7c7('0x33')]=_[_0xf7c7('0x34')](_0x489e9b[_0xf7c7('0x31')],_0x489e9b[_0xf7c7('0x35')]);_0x3034a4[_0xf7c7('0x36')]=_[_0xf7c7('0x34')](_0x489e9b[_0xf7c7('0x31')],qs[_0xf7c7('0x37')](_0x29623c[_0xf7c7('0x35')][_0xf7c7('0x37')]));_0x3034a4['attributes']=_0x3034a4[_0xf7c7('0x36')][_0xf7c7('0x38')]?_0x3034a4['attributes']:_0x489e9b['model'];if(!_0x29623c[_0xf7c7('0x35')][_0xf7c7('0x39')]('nolimit')){_0x3034a4[_0xf7c7('0x1f')]=qs['limit'](_0x29623c[_0xf7c7('0x35')][_0xf7c7('0x1f')]);_0x3034a4[_0xf7c7('0x1c')]=qs[_0xf7c7('0x1c')](_0x29623c[_0xf7c7('0x35')][_0xf7c7('0x1c')]);}_0x3034a4[_0xf7c7('0x3a')]=qs[_0xf7c7('0x3b')](_0x29623c[_0xf7c7('0x35')]['sort']);_0x3034a4[_0xf7c7('0x3c')]=qs[_0xf7c7('0x33')](_[_0xf7c7('0x3d')](_0x29623c[_0xf7c7('0x35')],_0x489e9b[_0xf7c7('0x33')]),_0x5c41f5);if(_0x29623c['query']['filter']){_0x3034a4[_0xf7c7('0x3c')]=_[_0xf7c7('0x3e')](_0x3034a4[_0xf7c7('0x3c')],{'$or':_[_0xf7c7('0x2b')](_0x5c41f5,function(_0x134646){if(_0x134646[_0xf7c7('0x2f')]!=='VIRTUAL'){var _0x20891a={};_0x20891a[_0x134646[_0xf7c7('0x28')]]={'$like':'%'+_0x29623c[_0xf7c7('0x35')][_0xf7c7('0x3f')]+'%'};return _0x20891a;}})});}_0x3034a4=_[_0xf7c7('0x3e')]({},_0x3034a4,_0x29623c['options']);var _0x4d943c={'where':_0x3034a4[_0xf7c7('0x3c')]};return db[_0xf7c7('0x2c')][_0xf7c7('0x1e')](_0x4d943c)[_0xf7c7('0x25')](function(_0x22e332){_0x35ffcf[_0xf7c7('0x1e')]=_0x22e332;if(_0x29623c['query'][_0xf7c7('0x40')]){_0x3034a4[_0xf7c7('0x41')]=[{'all':!![]}];}return db['FreshdeskConfiguration'][_0xf7c7('0x42')](_0x3034a4);})['then'](function(_0x3c0f06){_0x35ffcf[_0xf7c7('0x43')]=_0x3c0f06;return _0x35ffcf;})[_0xf7c7('0x25')](respondWithFilteredResult(_0xf6ea1d,_0x3034a4))[_0xf7c7('0x44')](handleError(_0xf6ea1d,null));};exports['show']=function(_0x4442d9,_0x83f9ab){var _0x502e98={'raw':![],'where':{'id':_0x4442d9[_0xf7c7('0x45')]['id']}},_0x5dd8fe={};_0x5dd8fe['model']=_['keys'](db[_0xf7c7('0x2c')][_0xf7c7('0x2d')]);_0x5dd8fe[_0xf7c7('0x35')]=_[_0xf7c7('0x32')](_0x4442d9[_0xf7c7('0x35')]);_0x5dd8fe[_0xf7c7('0x33')]=_['intersection'](_0x5dd8fe[_0xf7c7('0x31')],_0x5dd8fe[_0xf7c7('0x35')]);_0x502e98[_0xf7c7('0x36')]=_[_0xf7c7('0x34')](_0x5dd8fe['model'],qs[_0xf7c7('0x37')](_0x4442d9['query'][_0xf7c7('0x37')]));_0x502e98[_0xf7c7('0x36')]=_0x502e98['attributes'][_0xf7c7('0x38')]?_0x502e98[_0xf7c7('0x36')]:_0x5dd8fe[_0xf7c7('0x31')];if(_0x4442d9['query']['includeAll']){_0x502e98['include']=[{'all':!![]}];}_0x502e98=_[_0xf7c7('0x3e')]({},_0x502e98,_0x4442d9[_0xf7c7('0x46')]);return db[_0xf7c7('0x2c')][_0xf7c7('0x47')](_0x502e98)['then'](handleEntityNotFound(_0x83f9ab,null))[_0xf7c7('0x25')](respondWithResult(_0x83f9ab,null))[_0xf7c7('0x44')](handleError(_0x83f9ab,null));};exports[_0xf7c7('0x48')]=function(_0x33ad7f,_0x502159){return db[_0xf7c7('0x2c')][_0xf7c7('0x48')](_0x33ad7f[_0xf7c7('0x49')],{})[_0xf7c7('0x25')](respondWithResult(_0x502159,0xc9))[_0xf7c7('0x44')](handleError(_0x502159,null));};exports['update']=function(_0x55434d,_0x31363e){if(_0x55434d['body']['id']){delete _0x55434d[_0xf7c7('0x49')]['id'];}return db[_0xf7c7('0x2c')]['find']({'where':{'id':_0x55434d[_0xf7c7('0x45')]['id']}})['then'](handleEntityNotFound(_0x31363e,null))[_0xf7c7('0x25')](saveUpdates(_0x55434d[_0xf7c7('0x49')],null))[_0xf7c7('0x25')](respondWithResult(_0x31363e,null))[_0xf7c7('0x44')](handleError(_0x31363e,null));};exports[_0xf7c7('0x4a')]=function(_0x5898cc,_0x19962a){return db[_0xf7c7('0x2c')][_0xf7c7('0x47')]({'where':{'id':_0x5898cc['params']['id']}})[_0xf7c7('0x25')](handleEntityNotFound(_0x19962a,null))[_0xf7c7('0x25')](removeEntity(_0x19962a,null))[_0xf7c7('0x44')](handleError(_0x19962a,null));};exports[_0xf7c7('0x4b')]=function(_0x35c843,_0x9ef082,_0x627428){var _0x4ae6ca={};var _0x3f2852={};var _0xe66161;var _0x588545;return db[_0xf7c7('0x2c')][_0xf7c7('0x4c')]({'where':{'id':_0x35c843['params']['id']}})[_0xf7c7('0x25')](handleEntityNotFound(_0x9ef082,null))[_0xf7c7('0x25')](function(_0x52b330){if(_0x52b330){_0xe66161=_0x52b330;_0x3f2852['model']=_['keys'](db['FreshdeskField']['rawAttributes']);_0x3f2852['query']=_['keys'](_0x35c843[_0xf7c7('0x35')]);_0x3f2852[_0xf7c7('0x33')]=_[_0xf7c7('0x34')](_0x3f2852[_0xf7c7('0x31')],_0x3f2852[_0xf7c7('0x35')]);_0x4ae6ca[_0xf7c7('0x36')]=_[_0xf7c7('0x34')](_0x3f2852[_0xf7c7('0x31')],qs['fields'](_0x35c843[_0xf7c7('0x35')][_0xf7c7('0x37')]));_0x4ae6ca[_0xf7c7('0x36')]=_0x4ae6ca['attributes'][_0xf7c7('0x38')]?_0x4ae6ca[_0xf7c7('0x36')]:_0x3f2852[_0xf7c7('0x31')];_0x4ae6ca['order']=qs[_0xf7c7('0x3b')](_0x35c843[_0xf7c7('0x35')][_0xf7c7('0x3b')]);_0x4ae6ca[_0xf7c7('0x3c')]=qs[_0xf7c7('0x33')](_[_0xf7c7('0x3d')](_0x35c843['query'],_0x3f2852[_0xf7c7('0x33')]));if(_0x35c843['query']['filter']){_0x4ae6ca[_0xf7c7('0x3c')]=_[_0xf7c7('0x3e')](_0x4ae6ca[_0xf7c7('0x3c')],{'$or':_[_0xf7c7('0x2b')](_0x4ae6ca['attributes'],function(_0x21509c){var _0xc4b873={};_0xc4b873[_0x21509c]={'$like':'%'+_0x35c843['query'][_0xf7c7('0x3f')]+'%'};return _0xc4b873;})});}_0x4ae6ca=_[_0xf7c7('0x3e')]({},_0x4ae6ca,_0x35c843[_0xf7c7('0x46')]);return _0xe66161[_0xf7c7('0x4b')](_0x4ae6ca);}})[_0xf7c7('0x25')](function(_0x4d2b74){if(_0x4d2b74){_0x588545=_0x4d2b74[_0xf7c7('0x38')];if(!_0x35c843[_0xf7c7('0x35')][_0xf7c7('0x39')]('nolimit')){_0x4ae6ca[_0xf7c7('0x1f')]=qs[_0xf7c7('0x1f')](_0x35c843[_0xf7c7('0x35')][_0xf7c7('0x1f')]);_0x4ae6ca['offset']=qs[_0xf7c7('0x1c')](_0x35c843[_0xf7c7('0x35')][_0xf7c7('0x1c')]);}return _0xe66161[_0xf7c7('0x4b')](_0x4ae6ca);}})['then'](function(_0x4bbd0c){if(_0x4bbd0c){return _0x4bbd0c?{'count':_0x588545,'rows':_0x4bbd0c}:null;}})['then'](respondWithResult(_0x9ef082,null))[_0xf7c7('0x44')](handleError(_0x9ef082,null));};exports[_0xf7c7('0x4d')]=function(_0x4b5881,_0x4a9899,_0x350116){var _0x4eb34a={};var _0x3ce8af={};var _0x563e04;var _0x553833;return db[_0xf7c7('0x2c')][_0xf7c7('0x4c')]({'where':{'id':_0x4b5881['params']['id']}})[_0xf7c7('0x25')](handleEntityNotFound(_0x4a9899,null))['then'](function(_0x8d4785){if(_0x8d4785){_0x563e04=_0x8d4785;_0x3ce8af['model']=_[_0xf7c7('0x32')](db[_0xf7c7('0x4e')][_0xf7c7('0x2d')]);_0x3ce8af[_0xf7c7('0x35')]=_['keys'](_0x4b5881[_0xf7c7('0x35')]);_0x3ce8af['filters']=_[_0xf7c7('0x34')](_0x3ce8af[_0xf7c7('0x31')],_0x3ce8af[_0xf7c7('0x35')]);_0x4eb34a[_0xf7c7('0x36')]=_[_0xf7c7('0x34')](_0x3ce8af['model'],qs['fields'](_0x4b5881['query']['fields']));_0x4eb34a['attributes']=_0x4eb34a[_0xf7c7('0x36')][_0xf7c7('0x38')]?_0x4eb34a[_0xf7c7('0x36')]:_0x3ce8af[_0xf7c7('0x31')];_0x4eb34a[_0xf7c7('0x3a')]=qs[_0xf7c7('0x3b')](_0x4b5881[_0xf7c7('0x35')][_0xf7c7('0x3b')]);_0x4eb34a[_0xf7c7('0x3c')]=qs[_0xf7c7('0x33')](_[_0xf7c7('0x3d')](_0x4b5881['query'],_0x3ce8af['filters']));if(_0x4b5881[_0xf7c7('0x35')]['filter']){_0x4eb34a[_0xf7c7('0x3c')]=_[_0xf7c7('0x3e')](_0x4eb34a['where'],{'$or':_[_0xf7c7('0x2b')](_0x4eb34a['attributes'],function(_0x282388){var _0x63ce9b={};_0x63ce9b[_0x282388]={'$like':'%'+_0x4b5881[_0xf7c7('0x35')][_0xf7c7('0x3f')]+'%'};return _0x63ce9b;})});}_0x4eb34a=_[_0xf7c7('0x3e')]({},_0x4eb34a,_0x4b5881[_0xf7c7('0x46')]);return _0x563e04[_0xf7c7('0x4d')](_0x4eb34a);}})['then'](function(_0x317795){if(_0x317795){_0x553833=_0x317795[_0xf7c7('0x38')];if(!_0x4b5881[_0xf7c7('0x35')]['hasOwnProperty'](_0xf7c7('0x4f'))){_0x4eb34a[_0xf7c7('0x1f')]=qs[_0xf7c7('0x1f')](_0x4b5881[_0xf7c7('0x35')]['limit']);_0x4eb34a[_0xf7c7('0x1c')]=qs[_0xf7c7('0x1c')](_0x4b5881[_0xf7c7('0x35')]['offset']);}return _0x563e04[_0xf7c7('0x4d')](_0x4eb34a);}})[_0xf7c7('0x25')](function(_0x5b9ce7){if(_0x5b9ce7){return _0x5b9ce7?{'count':_0x553833,'rows':_0x5b9ce7}:null;}})['then'](respondWithResult(_0x4a9899,null))[_0xf7c7('0x44')](handleError(_0x4a9899,null));};exports['getDescriptions']=function(_0x42a25e,_0x172dbe,_0x30e172){var _0x258174={};var _0x170162={};var _0x243efb;var _0x1ceefc;return db[_0xf7c7('0x2c')]['findOne']({'where':{'id':_0x42a25e['params']['id']}})[_0xf7c7('0x25')](handleEntityNotFound(_0x172dbe,null))[_0xf7c7('0x25')](function(_0x5f078d){if(_0x5f078d){_0x243efb=_0x5f078d;_0x170162[_0xf7c7('0x31')]=_[_0xf7c7('0x32')](db[_0xf7c7('0x4e')]['rawAttributes']);_0x170162[_0xf7c7('0x35')]=_[_0xf7c7('0x32')](_0x42a25e[_0xf7c7('0x35')]);_0x170162[_0xf7c7('0x33')]=_['intersection'](_0x170162[_0xf7c7('0x31')],_0x170162[_0xf7c7('0x35')]);_0x258174[_0xf7c7('0x36')]=_['intersection'](_0x170162[_0xf7c7('0x31')],qs[_0xf7c7('0x37')](_0x42a25e[_0xf7c7('0x35')][_0xf7c7('0x37')]));_0x258174[_0xf7c7('0x36')]=_0x258174[_0xf7c7('0x36')][_0xf7c7('0x38')]?_0x258174['attributes']:_0x170162['model'];_0x258174['order']=qs[_0xf7c7('0x3b')](_0x42a25e[_0xf7c7('0x35')][_0xf7c7('0x3b')]);_0x258174[_0xf7c7('0x3c')]=qs[_0xf7c7('0x33')](_[_0xf7c7('0x3d')](_0x42a25e[_0xf7c7('0x35')],_0x170162[_0xf7c7('0x33')]));if(_0x42a25e['query'][_0xf7c7('0x3f')]){_0x258174[_0xf7c7('0x3c')]=_[_0xf7c7('0x3e')](_0x258174[_0xf7c7('0x3c')],{'$or':_[_0xf7c7('0x2b')](_0x258174[_0xf7c7('0x36')],function(_0x3ff3a8){var _0x3f422c={};_0x3f422c[_0x3ff3a8]={'$like':'%'+_0x42a25e[_0xf7c7('0x35')][_0xf7c7('0x3f')]+'%'};return _0x3f422c;})});}_0x258174=_[_0xf7c7('0x3e')]({},_0x258174,_0x42a25e[_0xf7c7('0x46')]);return _0x243efb[_0xf7c7('0x50')](_0x258174);}})[_0xf7c7('0x25')](function(_0x190f55){if(_0x190f55){_0x1ceefc=_0x190f55['length'];if(!_0x42a25e[_0xf7c7('0x35')][_0xf7c7('0x39')](_0xf7c7('0x4f'))){_0x258174['limit']=qs[_0xf7c7('0x1f')](_0x42a25e[_0xf7c7('0x35')][_0xf7c7('0x1f')]);_0x258174[_0xf7c7('0x1c')]=qs[_0xf7c7('0x1c')](_0x42a25e[_0xf7c7('0x35')]['offset']);}return _0x243efb[_0xf7c7('0x50')](_0x258174);}})[_0xf7c7('0x25')](function(_0x17d449){if(_0x17d449){return _0x17d449?{'count':_0x1ceefc,'rows':_0x17d449}:null;}})[_0xf7c7('0x25')](respondWithResult(_0x172dbe,null))[_0xf7c7('0x44')](handleError(_0x172dbe,null));};exports[_0xf7c7('0x51')]=function(_0x12daeb,_0x3bef22,_0xd39e2a){var _0x2d8a20={};var _0x23f922={};var _0x3a23a8;var _0x3ee467;return db[_0xf7c7('0x2c')][_0xf7c7('0x4c')]({'where':{'id':_0x12daeb[_0xf7c7('0x45')]['id']}})[_0xf7c7('0x25')](handleEntityNotFound(_0x3bef22,null))['then'](function(_0x483647){if(_0x483647){_0x3a23a8=_0x483647;_0x23f922[_0xf7c7('0x31')]=_['keys'](db['Tag'][_0xf7c7('0x2d')]);_0x23f922['query']=_[_0xf7c7('0x32')](_0x12daeb[_0xf7c7('0x35')]);_0x23f922[_0xf7c7('0x33')]=_[_0xf7c7('0x34')](_0x23f922[_0xf7c7('0x31')],_0x23f922[_0xf7c7('0x35')]);_0x2d8a20[_0xf7c7('0x36')]=_[_0xf7c7('0x34')](_0x23f922['model'],qs[_0xf7c7('0x37')](_0x12daeb[_0xf7c7('0x35')]['fields']));_0x2d8a20['attributes']=_0x2d8a20[_0xf7c7('0x36')][_0xf7c7('0x38')]?_0x2d8a20[_0xf7c7('0x36')]:_0x23f922[_0xf7c7('0x31')];_0x2d8a20[_0xf7c7('0x3a')]=qs['sort'](_0x12daeb[_0xf7c7('0x35')][_0xf7c7('0x3b')]);_0x2d8a20['where']=qs[_0xf7c7('0x33')](_[_0xf7c7('0x3d')](_0x12daeb[_0xf7c7('0x35')],_0x23f922[_0xf7c7('0x33')]));if(_0x12daeb[_0xf7c7('0x35')][_0xf7c7('0x3f')]){_0x2d8a20[_0xf7c7('0x3c')]=_['merge'](_0x2d8a20[_0xf7c7('0x3c')],{'$or':_[_0xf7c7('0x2b')](_0x2d8a20[_0xf7c7('0x36')],function(_0x4f4207){var _0x3340c0={};_0x3340c0[_0x4f4207]={'$like':'%'+_0x12daeb['query']['filter']+'%'};return _0x3340c0;})});}_0x2d8a20=_[_0xf7c7('0x3e')]({},_0x2d8a20,_0x12daeb[_0xf7c7('0x46')]);return _0x3a23a8[_0xf7c7('0x51')](_0x2d8a20);}})[_0xf7c7('0x25')](function(_0x551005){if(_0x551005){_0x3ee467=_0x551005['length'];if(!_0x12daeb[_0xf7c7('0x35')][_0xf7c7('0x39')](_0xf7c7('0x4f'))){_0x2d8a20['limit']=qs['limit'](_0x12daeb['query'][_0xf7c7('0x1f')]);_0x2d8a20[_0xf7c7('0x1c')]=qs[_0xf7c7('0x1c')](_0x12daeb[_0xf7c7('0x35')][_0xf7c7('0x1c')]);}return _0x3a23a8['getTags'](_0x2d8a20);}})['then'](function(_0x13d75c){if(_0x13d75c){return _0x13d75c?{'count':_0x3ee467,'rows':_0x13d75c}:null;}})[_0xf7c7('0x25')](respondWithResult(_0x3bef22,null))[_0xf7c7('0x44')](handleError(_0x3bef22,null));};exports[_0xf7c7('0x52')]=function(_0x1f4c93,_0x502f45,_0x281428){if(_0x1f4c93[_0xf7c7('0x49')]['id']){delete _0x1f4c93[_0xf7c7('0x49')]['id'];}return db[_0xf7c7('0x2c')][_0xf7c7('0x4c')]({'where':{'id':_0x1f4c93[_0xf7c7('0x45')]['id']}})[_0xf7c7('0x25')](handleEntityNotFound(_0x502f45,null))['then'](function(_0x2e2ccd){if(_0x2e2ccd){return _0x2e2ccd['setTags'](_0x1f4c93[_0xf7c7('0x49')][_0xf7c7('0x53')]||[]);}return null;})[_0xf7c7('0x25')](respondWithResult(_0x502f45,null))[_0xf7c7('0x44')](handleError(_0x502f45,null));}; \ No newline at end of file +var _0xe75a=['find','create','body','params','FreshdeskField','sort','getFields','findOne','nolimit','getDescriptions','getTags','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','undefined','limit','offset','count','Content-Range','json','apply','reject','update','then','destroy','stack','name','send','index','map','FreshdeskConfiguration','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xe75a,0x161));var _0xae75=function(_0x104a84,_0x285970){_0x104a84=_0x104a84-0x0;var _0x4973ff=_0xe75a[_0x104a84];return _0x4973ff;};'use strict';var emlformat=require(_0xae75('0x0'));var rimraf=require(_0xae75('0x1'));var zipdir=require(_0xae75('0x2'));var jsonpatch=require(_0xae75('0x3'));var rp=require(_0xae75('0x4'));var moment=require(_0xae75('0x5'));var BPromise=require(_0xae75('0x6'));var Mustache=require(_0xae75('0x7'));var util=require(_0xae75('0x8'));var path=require('path');var sox=require(_0xae75('0x9'));var csv=require(_0xae75('0xa'));var ejs=require(_0xae75('0xb'));var fs=require('fs');var fs_extra=require(_0xae75('0xc'));var _=require(_0xae75('0xd'));var squel=require(_0xae75('0xe'));var crypto=require(_0xae75('0xf'));var jsforce=require(_0xae75('0x10'));var deskjs=require(_0xae75('0x11'));var toCsv=require(_0xae75('0xa'));var querystring=require(_0xae75('0x12'));var Papa=require(_0xae75('0x13'));var Redis=require(_0xae75('0x14'));var authService=require('../../components/auth/service');var qs=require(_0xae75('0x15'));var as=require(_0xae75('0x16'));var hardwareService=require(_0xae75('0x17'));var logger=require(_0xae75('0x18'))(_0xae75('0x19'));var utils=require(_0xae75('0x1a'));var config=require(_0xae75('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0xae75('0x1c'))['db'];function respondWithStatusCode(_0x215df5,_0x3680e4){_0x3680e4=_0x3680e4||0xcc;return function(_0x47b8fe){if(_0x47b8fe){return _0x215df5[_0xae75('0x1d')](_0x3680e4);}return _0x215df5[_0xae75('0x1e')](_0x3680e4)[_0xae75('0x1f')]();};}function respondWithResult(_0x5d7e63,_0x41a09b){_0x41a09b=_0x41a09b||0xc8;return function(_0x2f2107){if(_0x2f2107){return _0x5d7e63['status'](_0x41a09b)['json'](_0x2f2107);}};}function respondWithFilteredResult(_0x238238,_0x2554bb){return function(_0x34b0b4){if(_0x34b0b4){var _0x2bd786=typeof _0x2554bb['offset']===_0xae75('0x20')&&typeof _0x2554bb[_0xae75('0x21')]===_0xae75('0x20');var _0x53a596=_0x34b0b4['count'];var _0x47ebbf=_0x2bd786?0x0:_0x2554bb[_0xae75('0x22')];var _0x8cd9ce=_0x2bd786?_0x34b0b4[_0xae75('0x23')]:_0x2554bb[_0xae75('0x22')]+_0x2554bb['limit'];var _0x216bf3;if(_0x8cd9ce>=_0x53a596){_0x8cd9ce=_0x53a596;_0x216bf3=0xc8;}else{_0x216bf3=0xce;}_0x238238[_0xae75('0x1e')](_0x216bf3);return _0x238238['set'](_0xae75('0x24'),_0x47ebbf+'-'+_0x8cd9ce+'/'+_0x53a596)[_0xae75('0x25')](_0x34b0b4);}return null;};}function patchUpdates(_0x2cbb12){return function(_0x5cfb4b){try{jsonpatch[_0xae75('0x26')](_0x5cfb4b,_0x2cbb12,!![]);}catch(_0x614de2){return BPromise[_0xae75('0x27')](_0x614de2);}return _0x5cfb4b['save']();};}function saveUpdates(_0x522de8,_0x247319){return function(_0x3d312f){if(_0x3d312f){return _0x3d312f[_0xae75('0x28')](_0x522de8)[_0xae75('0x29')](function(_0x3bbc89){return _0x3bbc89;});}return null;};}function removeEntity(_0x2c1619,_0x23de29){return function(_0x30d070){if(_0x30d070){return _0x30d070[_0xae75('0x2a')]()[_0xae75('0x29')](function(){_0x2c1619[_0xae75('0x1e')](0xcc)[_0xae75('0x1f')]();});}};}function handleEntityNotFound(_0x3c1138,_0x58cb2e){return function(_0x2b6e28){if(!_0x2b6e28){_0x3c1138['sendStatus'](0x194);}return _0x2b6e28;};}function handleError(_0x228c53,_0x113baa){_0x113baa=_0x113baa||0x1f4;return function(_0x3c55ac){logger['error'](_0x3c55ac[_0xae75('0x2b')]);if(_0x3c55ac[_0xae75('0x2c')]){delete _0x3c55ac[_0xae75('0x2c')];}_0x228c53[_0xae75('0x1e')](_0x113baa)[_0xae75('0x2d')](_0x3c55ac);};}exports[_0xae75('0x2e')]=function(_0x2d0aa5,_0x359e4){var _0xdddb93={},_0x44c825={},_0x36c424={'count':0x0,'rows':[]};var _0x197c77=_[_0xae75('0x2f')](db[_0xae75('0x30')][_0xae75('0x31')],function(_0x25b471){return{'name':_0x25b471['fieldName'],'type':_0x25b471['type'][_0xae75('0x32')]};});_0x44c825[_0xae75('0x33')]=_['map'](_0x197c77,_0xae75('0x2c'));_0x44c825[_0xae75('0x34')]=_[_0xae75('0x35')](_0x2d0aa5[_0xae75('0x34')]);_0x44c825[_0xae75('0x36')]=_[_0xae75('0x37')](_0x44c825['model'],_0x44c825[_0xae75('0x34')]);_0xdddb93[_0xae75('0x38')]=_[_0xae75('0x37')](_0x44c825[_0xae75('0x33')],qs[_0xae75('0x39')](_0x2d0aa5[_0xae75('0x34')]['fields']));_0xdddb93[_0xae75('0x38')]=_0xdddb93[_0xae75('0x38')][_0xae75('0x3a')]?_0xdddb93['attributes']:_0x44c825['model'];if(!_0x2d0aa5[_0xae75('0x34')][_0xae75('0x3b')]('nolimit')){_0xdddb93[_0xae75('0x21')]=qs['limit'](_0x2d0aa5[_0xae75('0x34')][_0xae75('0x21')]);_0xdddb93[_0xae75('0x22')]=qs[_0xae75('0x22')](_0x2d0aa5[_0xae75('0x34')]['offset']);}_0xdddb93[_0xae75('0x3c')]=qs['sort'](_0x2d0aa5['query']['sort']);_0xdddb93[_0xae75('0x3d')]=qs[_0xae75('0x36')](_[_0xae75('0x3e')](_0x2d0aa5[_0xae75('0x34')],_0x44c825[_0xae75('0x36')]),_0x197c77);if(_0x2d0aa5[_0xae75('0x34')][_0xae75('0x3f')]){_0xdddb93[_0xae75('0x3d')]=_[_0xae75('0x40')](_0xdddb93[_0xae75('0x3d')],{'$or':_[_0xae75('0x2f')](_0x197c77,function(_0xeba610){if(_0xeba610['type']!==_0xae75('0x41')){var _0x1070b2={};_0x1070b2[_0xeba610[_0xae75('0x2c')]]={'$like':'%'+_0x2d0aa5['query'][_0xae75('0x3f')]+'%'};return _0x1070b2;}})});}_0xdddb93=_[_0xae75('0x40')]({},_0xdddb93,_0x2d0aa5[_0xae75('0x42')]);var _0x1e8d49={'where':_0xdddb93['where']};return db[_0xae75('0x30')][_0xae75('0x23')](_0x1e8d49)[_0xae75('0x29')](function(_0x4503e8){_0x36c424[_0xae75('0x23')]=_0x4503e8;if(_0x2d0aa5[_0xae75('0x34')][_0xae75('0x43')]){_0xdddb93[_0xae75('0x44')]=[{'all':!![]}];}return db['FreshdeskConfiguration']['findAll'](_0xdddb93);})[_0xae75('0x29')](function(_0xd8954b){_0x36c424[_0xae75('0x45')]=_0xd8954b;return _0x36c424;})[_0xae75('0x29')](respondWithFilteredResult(_0x359e4,_0xdddb93))[_0xae75('0x46')](handleError(_0x359e4,null));};exports[_0xae75('0x47')]=function(_0x1423d4,_0x304181){var _0x1d47eb={'raw':![],'where':{'id':_0x1423d4['params']['id']}},_0x4e344a={};_0x4e344a[_0xae75('0x33')]=_['keys'](db[_0xae75('0x30')][_0xae75('0x31')]);_0x4e344a[_0xae75('0x34')]=_[_0xae75('0x35')](_0x1423d4['query']);_0x4e344a['filters']=_[_0xae75('0x37')](_0x4e344a['model'],_0x4e344a[_0xae75('0x34')]);_0x1d47eb[_0xae75('0x38')]=_[_0xae75('0x37')](_0x4e344a[_0xae75('0x33')],qs[_0xae75('0x39')](_0x1423d4[_0xae75('0x34')]['fields']));_0x1d47eb[_0xae75('0x38')]=_0x1d47eb[_0xae75('0x38')]['length']?_0x1d47eb[_0xae75('0x38')]:_0x4e344a[_0xae75('0x33')];if(_0x1423d4[_0xae75('0x34')][_0xae75('0x43')]){_0x1d47eb[_0xae75('0x44')]=[{'all':!![]}];}_0x1d47eb=_[_0xae75('0x40')]({},_0x1d47eb,_0x1423d4['options']);return db[_0xae75('0x30')][_0xae75('0x48')](_0x1d47eb)['then'](handleEntityNotFound(_0x304181,null))[_0xae75('0x29')](respondWithResult(_0x304181,null))[_0xae75('0x46')](handleError(_0x304181,null));};exports[_0xae75('0x49')]=function(_0xc6b0a4,_0x2b379d){return db[_0xae75('0x30')][_0xae75('0x49')](_0xc6b0a4[_0xae75('0x4a')],{})['then'](respondWithResult(_0x2b379d,0xc9))[_0xae75('0x46')](handleError(_0x2b379d,null));};exports[_0xae75('0x28')]=function(_0x1a64cb,_0x113b70){if(_0x1a64cb[_0xae75('0x4a')]['id']){delete _0x1a64cb[_0xae75('0x4a')]['id'];}return db[_0xae75('0x30')][_0xae75('0x48')]({'where':{'id':_0x1a64cb[_0xae75('0x4b')]['id']}})[_0xae75('0x29')](handleEntityNotFound(_0x113b70,null))[_0xae75('0x29')](saveUpdates(_0x1a64cb[_0xae75('0x4a')],null))['then'](respondWithResult(_0x113b70,null))[_0xae75('0x46')](handleError(_0x113b70,null));};exports['destroy']=function(_0x2bbbad,_0x1ccdfd){return db[_0xae75('0x30')][_0xae75('0x48')]({'where':{'id':_0x2bbbad[_0xae75('0x4b')]['id']}})[_0xae75('0x29')](handleEntityNotFound(_0x1ccdfd,null))[_0xae75('0x29')](removeEntity(_0x1ccdfd,null))[_0xae75('0x46')](handleError(_0x1ccdfd,null));};exports['getFields']=function(_0x215153,_0x1e1d60,_0x261a8b){var _0x5591fb={};var _0x44cf94={};var _0xd1975b;var _0x889d6a;return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x215153[_0xae75('0x4b')]['id']}})[_0xae75('0x29')](handleEntityNotFound(_0x1e1d60,null))[_0xae75('0x29')](function(_0x3c58ef){if(_0x3c58ef){_0xd1975b=_0x3c58ef;_0x44cf94[_0xae75('0x33')]=_[_0xae75('0x35')](db[_0xae75('0x4c')][_0xae75('0x31')]);_0x44cf94[_0xae75('0x34')]=_['keys'](_0x215153['query']);_0x44cf94[_0xae75('0x36')]=_['intersection'](_0x44cf94[_0xae75('0x33')],_0x44cf94[_0xae75('0x34')]);_0x5591fb[_0xae75('0x38')]=_[_0xae75('0x37')](_0x44cf94[_0xae75('0x33')],qs['fields'](_0x215153[_0xae75('0x34')][_0xae75('0x39')]));_0x5591fb[_0xae75('0x38')]=_0x5591fb['attributes'][_0xae75('0x3a')]?_0x5591fb[_0xae75('0x38')]:_0x44cf94[_0xae75('0x33')];_0x5591fb['order']=qs[_0xae75('0x4d')](_0x215153['query'][_0xae75('0x4d')]);_0x5591fb[_0xae75('0x3d')]=qs[_0xae75('0x36')](_[_0xae75('0x3e')](_0x215153[_0xae75('0x34')],_0x44cf94[_0xae75('0x36')]));if(_0x215153[_0xae75('0x34')][_0xae75('0x3f')]){_0x5591fb[_0xae75('0x3d')]=_[_0xae75('0x40')](_0x5591fb[_0xae75('0x3d')],{'$or':_[_0xae75('0x2f')](_0x5591fb['attributes'],function(_0x3e7a61){var _0x54e8b3={};_0x54e8b3[_0x3e7a61]={'$like':'%'+_0x215153[_0xae75('0x34')][_0xae75('0x3f')]+'%'};return _0x54e8b3;})});}_0x5591fb=_['merge']({},_0x5591fb,_0x215153[_0xae75('0x42')]);return _0xd1975b[_0xae75('0x4e')](_0x5591fb);}})['then'](function(_0x2cb7a3){if(_0x2cb7a3){_0x889d6a=_0x2cb7a3[_0xae75('0x3a')];if(!_0x215153[_0xae75('0x34')][_0xae75('0x3b')]('nolimit')){_0x5591fb['limit']=qs[_0xae75('0x21')](_0x215153[_0xae75('0x34')][_0xae75('0x21')]);_0x5591fb['offset']=qs['offset'](_0x215153[_0xae75('0x34')][_0xae75('0x22')]);}return _0xd1975b['getFields'](_0x5591fb);}})[_0xae75('0x29')](function(_0xd647bf){if(_0xd647bf){return _0xd647bf?{'count':_0x889d6a,'rows':_0xd647bf}:null;}})[_0xae75('0x29')](respondWithResult(_0x1e1d60,null))[_0xae75('0x46')](handleError(_0x1e1d60,null));};exports['getSubjects']=function(_0x3ccf28,_0x395387,_0x603547){var _0x244a67={};var _0x360b21={};var _0x155250;var _0x300c6d;return db[_0xae75('0x30')][_0xae75('0x4f')]({'where':{'id':_0x3ccf28[_0xae75('0x4b')]['id']}})[_0xae75('0x29')](handleEntityNotFound(_0x395387,null))[_0xae75('0x29')](function(_0x2b743d){if(_0x2b743d){_0x155250=_0x2b743d;_0x360b21[_0xae75('0x33')]=_['keys'](db[_0xae75('0x4c')][_0xae75('0x31')]);_0x360b21[_0xae75('0x34')]=_[_0xae75('0x35')](_0x3ccf28[_0xae75('0x34')]);_0x360b21['filters']=_[_0xae75('0x37')](_0x360b21['model'],_0x360b21[_0xae75('0x34')]);_0x244a67[_0xae75('0x38')]=_['intersection'](_0x360b21[_0xae75('0x33')],qs[_0xae75('0x39')](_0x3ccf28[_0xae75('0x34')]['fields']));_0x244a67[_0xae75('0x38')]=_0x244a67[_0xae75('0x38')]['length']?_0x244a67[_0xae75('0x38')]:_0x360b21[_0xae75('0x33')];_0x244a67['order']=qs[_0xae75('0x4d')](_0x3ccf28['query'][_0xae75('0x4d')]);_0x244a67[_0xae75('0x3d')]=qs[_0xae75('0x36')](_[_0xae75('0x3e')](_0x3ccf28['query'],_0x360b21[_0xae75('0x36')]));if(_0x3ccf28[_0xae75('0x34')][_0xae75('0x3f')]){_0x244a67[_0xae75('0x3d')]=_['merge'](_0x244a67[_0xae75('0x3d')],{'$or':_['map'](_0x244a67[_0xae75('0x38')],function(_0x4985bf){var _0x1802e2={};_0x1802e2[_0x4985bf]={'$like':'%'+_0x3ccf28[_0xae75('0x34')][_0xae75('0x3f')]+'%'};return _0x1802e2;})});}_0x244a67=_[_0xae75('0x40')]({},_0x244a67,_0x3ccf28['options']);return _0x155250['getSubjects'](_0x244a67);}})[_0xae75('0x29')](function(_0x5927aa){if(_0x5927aa){_0x300c6d=_0x5927aa[_0xae75('0x3a')];if(!_0x3ccf28[_0xae75('0x34')][_0xae75('0x3b')](_0xae75('0x50'))){_0x244a67[_0xae75('0x21')]=qs[_0xae75('0x21')](_0x3ccf28[_0xae75('0x34')]['limit']);_0x244a67[_0xae75('0x22')]=qs[_0xae75('0x22')](_0x3ccf28[_0xae75('0x34')][_0xae75('0x22')]);}return _0x155250['getSubjects'](_0x244a67);}})[_0xae75('0x29')](function(_0x1a12c8){if(_0x1a12c8){return _0x1a12c8?{'count':_0x300c6d,'rows':_0x1a12c8}:null;}})[_0xae75('0x29')](respondWithResult(_0x395387,null))[_0xae75('0x46')](handleError(_0x395387,null));};exports['getDescriptions']=function(_0x735082,_0x353239,_0xfef92e){var _0x37a8b6={};var _0x4e123f={};var _0x252974;var _0x3f1cf9;return db[_0xae75('0x30')]['findOne']({'where':{'id':_0x735082[_0xae75('0x4b')]['id']}})[_0xae75('0x29')](handleEntityNotFound(_0x353239,null))[_0xae75('0x29')](function(_0xd0377e){if(_0xd0377e){_0x252974=_0xd0377e;_0x4e123f[_0xae75('0x33')]=_[_0xae75('0x35')](db[_0xae75('0x4c')][_0xae75('0x31')]);_0x4e123f['query']=_[_0xae75('0x35')](_0x735082[_0xae75('0x34')]);_0x4e123f[_0xae75('0x36')]=_['intersection'](_0x4e123f[_0xae75('0x33')],_0x4e123f[_0xae75('0x34')]);_0x37a8b6['attributes']=_[_0xae75('0x37')](_0x4e123f[_0xae75('0x33')],qs[_0xae75('0x39')](_0x735082[_0xae75('0x34')][_0xae75('0x39')]));_0x37a8b6['attributes']=_0x37a8b6[_0xae75('0x38')][_0xae75('0x3a')]?_0x37a8b6['attributes']:_0x4e123f[_0xae75('0x33')];_0x37a8b6['order']=qs[_0xae75('0x4d')](_0x735082[_0xae75('0x34')]['sort']);_0x37a8b6['where']=qs[_0xae75('0x36')](_['pick'](_0x735082[_0xae75('0x34')],_0x4e123f[_0xae75('0x36')]));if(_0x735082[_0xae75('0x34')][_0xae75('0x3f')]){_0x37a8b6[_0xae75('0x3d')]=_[_0xae75('0x40')](_0x37a8b6['where'],{'$or':_['map'](_0x37a8b6[_0xae75('0x38')],function(_0x13b72f){var _0x210f97={};_0x210f97[_0x13b72f]={'$like':'%'+_0x735082[_0xae75('0x34')][_0xae75('0x3f')]+'%'};return _0x210f97;})});}_0x37a8b6=_['merge']({},_0x37a8b6,_0x735082[_0xae75('0x42')]);return _0x252974[_0xae75('0x51')](_0x37a8b6);}})['then'](function(_0x2e78a2){if(_0x2e78a2){_0x3f1cf9=_0x2e78a2['length'];if(!_0x735082[_0xae75('0x34')][_0xae75('0x3b')](_0xae75('0x50'))){_0x37a8b6[_0xae75('0x21')]=qs[_0xae75('0x21')](_0x735082[_0xae75('0x34')][_0xae75('0x21')]);_0x37a8b6[_0xae75('0x22')]=qs[_0xae75('0x22')](_0x735082[_0xae75('0x34')]['offset']);}return _0x252974[_0xae75('0x51')](_0x37a8b6);}})[_0xae75('0x29')](function(_0x437175){if(_0x437175){return _0x437175?{'count':_0x3f1cf9,'rows':_0x437175}:null;}})[_0xae75('0x29')](respondWithResult(_0x353239,null))['catch'](handleError(_0x353239,null));};exports[_0xae75('0x52')]=function(_0x1566d2,_0x554b09,_0xa11ce8){var _0x3cea74={};var _0x2412c0={};var _0x569508;var _0x3d5732;return db[_0xae75('0x30')][_0xae75('0x4f')]({'where':{'id':_0x1566d2[_0xae75('0x4b')]['id']}})[_0xae75('0x29')](handleEntityNotFound(_0x554b09,null))[_0xae75('0x29')](function(_0x3de485){if(_0x3de485){_0x569508=_0x3de485;_0x2412c0[_0xae75('0x33')]=_[_0xae75('0x35')](db['Tag'][_0xae75('0x31')]);_0x2412c0[_0xae75('0x34')]=_[_0xae75('0x35')](_0x1566d2[_0xae75('0x34')]);_0x2412c0[_0xae75('0x36')]=_[_0xae75('0x37')](_0x2412c0[_0xae75('0x33')],_0x2412c0['query']);_0x3cea74[_0xae75('0x38')]=_['intersection'](_0x2412c0[_0xae75('0x33')],qs[_0xae75('0x39')](_0x1566d2[_0xae75('0x34')][_0xae75('0x39')]));_0x3cea74[_0xae75('0x38')]=_0x3cea74[_0xae75('0x38')][_0xae75('0x3a')]?_0x3cea74['attributes']:_0x2412c0[_0xae75('0x33')];_0x3cea74[_0xae75('0x3c')]=qs[_0xae75('0x4d')](_0x1566d2['query']['sort']);_0x3cea74[_0xae75('0x3d')]=qs[_0xae75('0x36')](_[_0xae75('0x3e')](_0x1566d2[_0xae75('0x34')],_0x2412c0['filters']));if(_0x1566d2[_0xae75('0x34')][_0xae75('0x3f')]){_0x3cea74[_0xae75('0x3d')]=_[_0xae75('0x40')](_0x3cea74[_0xae75('0x3d')],{'$or':_['map'](_0x3cea74[_0xae75('0x38')],function(_0x5a217c){var _0x2d67c3={};_0x2d67c3[_0x5a217c]={'$like':'%'+_0x1566d2[_0xae75('0x34')][_0xae75('0x3f')]+'%'};return _0x2d67c3;})});}_0x3cea74=_['merge']({},_0x3cea74,_0x1566d2['options']);return _0x569508[_0xae75('0x52')](_0x3cea74);}})[_0xae75('0x29')](function(_0x8370e7){if(_0x8370e7){_0x3d5732=_0x8370e7[_0xae75('0x3a')];if(!_0x1566d2[_0xae75('0x34')][_0xae75('0x3b')](_0xae75('0x50'))){_0x3cea74[_0xae75('0x21')]=qs['limit'](_0x1566d2[_0xae75('0x34')][_0xae75('0x21')]);_0x3cea74[_0xae75('0x22')]=qs[_0xae75('0x22')](_0x1566d2[_0xae75('0x34')][_0xae75('0x22')]);}return _0x569508[_0xae75('0x52')](_0x3cea74);}})['then'](function(_0x1cc295){if(_0x1cc295){return _0x1cc295?{'count':_0x3d5732,'rows':_0x1cc295}:null;}})[_0xae75('0x29')](respondWithResult(_0x554b09,null))[_0xae75('0x46')](handleError(_0x554b09,null));};exports['setTags']=function(_0x2ac2c0,_0x473989,_0x619677){if(_0x2ac2c0[_0xae75('0x4a')]['id']){delete _0x2ac2c0[_0xae75('0x4a')]['id'];}return db[_0xae75('0x30')][_0xae75('0x4f')]({'where':{'id':_0x2ac2c0[_0xae75('0x4b')]['id']}})[_0xae75('0x29')](handleEntityNotFound(_0x473989,null))[_0xae75('0x29')](function(_0x57f308){if(_0x57f308){return _0x57f308[_0xae75('0x53')](_0x2ac2c0[_0xae75('0x4a')][_0xae75('0x54')]||[]);}return null;})[_0xae75('0x29')](respondWithResult(_0x473989,null))[_0xae75('0x46')](handleError(_0x473989,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 6c96673..44ab98a 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 _0x1c9e=['bluebird','rimraf','./intFreshdeskConfiguration.attributes','exports','define','int_freshdesk_configurations','lodash','../../config/logger','api','moment'];(function(_0x343788,_0x3f84d7){var _0x3dd8d8=function(_0x558683){while(--_0x558683){_0x343788['push'](_0x343788['shift']());}};_0x3dd8d8(++_0x3f84d7);}(_0x1c9e,0x11e));var _0xe1c9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1c9e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe1c9('0x0'));var util=require('util');var logger=require(_0xe1c9('0x1'))(_0xe1c9('0x2'));var moment=require(_0xe1c9('0x3'));var BPromise=require(_0xe1c9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xe1c9('0x5'));var config=require('../../config/environment');var attributes=require(_0xe1c9('0x6'));module[_0xe1c9('0x7')]=function(_0x297a54,_0x8df921){return _0x297a54[_0xe1c9('0x8')]('FreshdeskConfiguration',attributes,{'tableName':_0xe1c9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x39c7=['moment','bluebird','request-promise','path','rimraf','../../config/environment','define','FreshdeskConfiguration','lodash','../../config/logger','api'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x39c7,0xc3));var _0x739c=function(_0xc1fc39,_0x474166){_0xc1fc39=_0xc1fc39-0x0;var _0x29786e=_0x39c7[_0xc1fc39];return _0x29786e;};'use strict';var _=require(_0x739c('0x0'));var util=require('util');var logger=require(_0x739c('0x1'))(_0x739c('0x2'));var moment=require(_0x739c('0x3'));var BPromise=require(_0x739c('0x4'));var rp=require(_0x739c('0x5'));var fs=require('fs');var path=require(_0x739c('0x6'));var rimraf=require(_0x739c('0x7'));var config=require(_0x739c('0x8'));var attributes=require('./intFreshdeskConfiguration.attributes');module['exports']=function(_0x2bf7d4,_0x2aef4d){return _0x2bf7d4[_0x739c('0x9')](_0x739c('0xa'),attributes,{'tableName':'int_freshdesk_configurations','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 04bea71..5dba885 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 _0xd604=['FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','info'];(function(_0x52c8e8,_0x5ee20d){var _0x31bb1a=function(_0x47233a){while(--_0x47233a){_0x52c8e8['push'](_0x52c8e8['shift']());}};_0x31bb1a(++_0x5ee20d);}(_0xd604,0x15a));var _0x4d60=function(_0x58241b,_0x4709e4){_0x58241b=_0x58241b-0x0;var _0x5f34b1=_0xd604[_0x58241b];return _0x5f34b1;};'use strict';var _=require(_0x4d60('0x0'));var util=require(_0x4d60('0x1'));var moment=require(_0x4d60('0x2'));var BPromise=require(_0x4d60('0x3'));var rs=require(_0x4d60('0x4'));var fs=require('fs');var Redis=require(_0x4d60('0x5'));var db=require(_0x4d60('0x6'))['db'];var utils=require(_0x4d60('0x7'));var logger=require(_0x4d60('0x8'))('rpc');var config=require(_0x4d60('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x4d60('0xa')][_0x4d60('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xeb3ce4,_0xd4930b,_0x565147){return new BPromise(function(_0x4a339e,_0x360a6d){return client[_0x4d60('0xc')](_0xeb3ce4,_0x565147)['then'](function(_0x56d672){logger[_0x4d60('0xd')](_0x4d60('0xe'),_0xd4930b,_0x4d60('0xf'));logger[_0x4d60('0x10')](_0x4d60('0x11'),_0xd4930b,_0x4d60('0xf'),JSON[_0x4d60('0x12')](_0x56d672));if(_0x56d672[_0x4d60('0x13')]){if(_0x56d672[_0x4d60('0x13')][_0x4d60('0x14')]===0x1f4){logger[_0x4d60('0x13')]('FreshdeskConfiguration,\x20%s,\x20%s',_0xd4930b,_0x56d672[_0x4d60('0x13')][_0x4d60('0x15')]);return _0x360a6d(_0x56d672[_0x4d60('0x13')][_0x4d60('0x15')]);}logger[_0x4d60('0x13')]('FreshdeskConfiguration,\x20%s,\x20%s',_0xd4930b,_0x56d672[_0x4d60('0x13')][_0x4d60('0x15')]);return _0x4a339e(_0x56d672['error']['message']);}else{logger[_0x4d60('0xd')](_0x4d60('0xe'),_0xd4930b,_0x4d60('0xf'));_0x4a339e(_0x56d672[_0x4d60('0x16')][_0x4d60('0x15')]);}})[_0x4d60('0x17')](function(_0x57f456){logger['error']('FreshdeskConfiguration,\x20%s,\x20%s',_0xd4930b,_0x57f456);_0x360a6d(_0x57f456);});});} \ No newline at end of file +var _0x3796=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x3796,0x175));var _0x6379=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x3796[_0xfae23b];return _0x200640;};'use strict';var _=require(_0x6379('0x0'));var util=require('util');var moment=require(_0x6379('0x1'));var BPromise=require('bluebird');var rs=require(_0x6379('0x2'));var fs=require('fs');var Redis=require(_0x6379('0x3'));var db=require(_0x6379('0x4'))['db'];var utils=require(_0x6379('0x5'));var logger=require(_0x6379('0x6'))(_0x6379('0x7'));var config=require(_0x6379('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6379('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x560455,_0x3275cb,_0x2eabf4){return new BPromise(function(_0x3adf8a,_0x32b19a){return client[_0x6379('0xa')](_0x560455,_0x2eabf4)['then'](function(_0x1a048f){logger['info'](_0x6379('0xb'),_0x3275cb,_0x6379('0xc'));logger[_0x6379('0xd')](_0x6379('0xe'),_0x3275cb,'request\x20sent',JSON[_0x6379('0xf')](_0x1a048f));if(_0x1a048f[_0x6379('0x10')]){if(_0x1a048f['error'][_0x6379('0x11')]===0x1f4){logger[_0x6379('0x10')](_0x6379('0xb'),_0x3275cb,_0x1a048f['error'][_0x6379('0x12')]);return _0x32b19a(_0x1a048f[_0x6379('0x10')]['message']);}logger['error'](_0x6379('0xb'),_0x3275cb,_0x1a048f[_0x6379('0x10')]['message']);return _0x3adf8a(_0x1a048f['error'][_0x6379('0x12')]);}else{logger[_0x6379('0x13')](_0x6379('0xb'),_0x3275cb,_0x6379('0xc'));_0x3adf8a(_0x1a048f[_0x6379('0x14')][_0x6379('0x12')]);}})[_0x6379('0x15')](function(_0x3dc9be){logger[_0x6379('0x10')](_0x6379('0xb'),_0x3275cb,_0x3dc9be);_0x32b19a(_0x3dc9be);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index fc1a461..79181d6 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 _0xa281=['../../components/auth/service','../../components/interaction/service','./intFreshdeskField.controller','index','get','isAuthenticated','post','create','put','/:id','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x52caa7,_0x33e225){var _0x5da8f9=function(_0x4ddb4d){while(--_0x4ddb4d){_0x52caa7['push'](_0x52caa7['shift']());}};_0x5da8f9(++_0x33e225);}(_0xa281,0x14f));var _0x1a28=function(_0x44ec8a,_0x2fcc7e){_0x44ec8a=_0x44ec8a-0x0;var _0xeca833=_0xa281[_0x44ec8a];return _0xeca833;};'use strict';var multer=require(_0x1a28('0x0'));var util=require(_0x1a28('0x1'));var path=require(_0x1a28('0x2'));var timeout=require(_0x1a28('0x3'));var express=require(_0x1a28('0x4'));var router=express[_0x1a28('0x5')]();var fs_extra=require(_0x1a28('0x6'));var auth=require(_0x1a28('0x7'));var interaction=require(_0x1a28('0x8'));var config=require('../../config/environment');var controller=require(_0x1a28('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x1a28('0xa')]);router[_0x1a28('0xb')]('/:id',auth[_0x1a28('0xc')](),controller['show']);router[_0x1a28('0xd')]('/',auth[_0x1a28('0xc')](),controller[_0x1a28('0xe')]);router[_0x1a28('0xf')](_0x1a28('0x10'),auth[_0x1a28('0xc')](),controller['update']);router[_0x1a28('0x11')](_0x1a28('0x10'),auth[_0x1a28('0xc')](),controller['destroy']);module[_0x1a28('0x12')]=router; \ No newline at end of file +var _0xa0d9=['isAuthenticated','show','create','put','update','delete','exports','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','index','/:id'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0xa0d9,0x67));var _0x9a0d=function(_0x1635fe,_0x5f1d9f){_0x1635fe=_0x1635fe-0x0;var _0x3c512a=_0xa0d9[_0x1635fe];return _0x3c512a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9a0d('0x0'));var timeout=require(_0x9a0d('0x1'));var express=require('express');var router=express[_0x9a0d('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x9a0d('0x3'));var config=require(_0x9a0d('0x4'));var controller=require(_0x9a0d('0x5'));router[_0x9a0d('0x6')]('/',auth['isAuthenticated'](),controller[_0x9a0d('0x7')]);router[_0x9a0d('0x6')](_0x9a0d('0x8'),auth[_0x9a0d('0x9')](),controller[_0x9a0d('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0x9a0d('0xb')]);router[_0x9a0d('0xc')]('/:id',auth[_0x9a0d('0x9')](),controller[_0x9a0d('0xd')]);router[_0x9a0d('0xe')]('/:id',auth[_0x9a0d('0x9')](),controller['destroy']);module[_0x9a0d('0xf')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 2a09b8e..895f414 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 _0x6b4b=['variable','keyValue','STRING','BOOLEAN','sequelize','ENUM','string'];(function(_0xfd3bf8,_0x3b17df){var _0x29563c=function(_0x2c31a9){while(--_0x2c31a9){_0xfd3bf8['push'](_0xfd3bf8['shift']());}};_0x29563c(++_0x3b17df);}(_0x6b4b,0xb3));var _0xb6b4=function(_0x4c445a,_0x4ee80f){_0x4c445a=_0x4c445a-0x0;var _0x2f611c=_0x6b4b[_0x4c445a];return _0x2f611c;};'use strict';var Sequelize=require(_0xb6b4('0x0'));module['exports']={'type':{'type':Sequelize[_0xb6b4('0x1')](_0xb6b4('0x2'),_0xb6b4('0x3'),'customVariable',_0xb6b4('0x4'),'picklist'),'defaultValue':_0xb6b4('0x2')},'content':{'type':Sequelize[_0xb6b4('0x5')]},'key':{'type':Sequelize[_0xb6b4('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0xb6b4('0x2'),_0xb6b4('0x3'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xb6b4('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb6b4('0x5')]}}; \ No newline at end of file +var _0x9a84=['keyValue','picklist','STRING','customVariable','BOOLEAN','ENUM','string','variable'];(function(_0x1b53e8,_0x34d870){var _0x2f8e79=function(_0x27119f){while(--_0x27119f){_0x1b53e8['push'](_0x1b53e8['shift']());}};_0x2f8e79(++_0x34d870);}(_0x9a84,0x1c5));var _0x49a8=function(_0x14f458,_0x5dd219){_0x14f458=_0x14f458-0x0;var _0x4ff2da=_0x9a84[_0x14f458];return _0x4ff2da;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x49a8('0x0')](_0x49a8('0x1'),_0x49a8('0x2'),'customVariable',_0x49a8('0x3'),_0x49a8('0x4')),'defaultValue':_0x49a8('0x1')},'content':{'type':Sequelize[_0x49a8('0x5')]},'key':{'type':Sequelize[_0x49a8('0x5')]},'keyType':{'type':Sequelize[_0x49a8('0x0')](_0x49a8('0x1'),'variable',_0x49a8('0x6'))},'keyContent':{'type':Sequelize[_0x49a8('0x5')]},'idField':{'type':Sequelize[_0x49a8('0x5')]},'nameField':{'type':Sequelize[_0x49a8('0x5')]},'customField':{'type':Sequelize[_0x49a8('0x7')],'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 1228869..096da68 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 _0x9c44=['options','then','includeAll','include','findAll','rows','catch','params','find','create','body','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','FreshdeskField','rawAttributes','fieldName','type','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL'];(function(_0x4b8551,_0x4d0533){var _0x63e614=function(_0x714a7f){while(--_0x714a7f){_0x4b8551['push'](_0x4b8551['shift']());}};_0x63e614(++_0x4d0533);}(_0x9c44,0x178));var _0x49c4=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x9c44[_0x2d7f0e];return _0x110b07;};'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['FreshdeskField'][_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['FreshdeskField'][_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));}; \ No newline at end of file +var _0xfc03=['to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','FreshdeskField','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','keys','rawAttributes','find','catch','create','body','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','sox'];(function(_0x48ba38,_0x485dac){var _0x23bf1f=function(_0x33765f){while(--_0x33765f){_0x48ba38['push'](_0x48ba38['shift']());}};_0x23bf1f(++_0x485dac);}(_0xfc03,0x16f));var _0x3fc0=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0xfc03[_0x1928c9];return _0x51b5fb;};'use strict';var emlformat=require(_0x3fc0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3fc0('0x1'));var jsonpatch=require(_0x3fc0('0x2'));var rp=require('request-promise');var moment=require(_0x3fc0('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x3fc0('0x4'));var util=require(_0x3fc0('0x5'));var path=require(_0x3fc0('0x6'));var sox=require(_0x3fc0('0x7'));var csv=require(_0x3fc0('0x8'));var ejs=require(_0x3fc0('0x9'));var fs=require('fs');var fs_extra=require(_0x3fc0('0xa'));var _=require(_0x3fc0('0xb'));var squel=require('squel');var crypto=require(_0x3fc0('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x3fc0('0xd'));var toCsv=require(_0x3fc0('0x8'));var querystring=require(_0x3fc0('0xe'));var Papa=require(_0x3fc0('0xf'));var Redis=require('ioredis');var authService=require(_0x3fc0('0x10'));var qs=require(_0x3fc0('0x11'));var as=require(_0x3fc0('0x12'));var hardwareService=require(_0x3fc0('0x13'));var logger=require(_0x3fc0('0x14'))('api');var utils=require(_0x3fc0('0x15'));var config=require(_0x3fc0('0x16'));var licenseUtil=require(_0x3fc0('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1011b7,_0x582e22){_0x582e22=_0x582e22||0xcc;return function(_0x3a4cc0){if(_0x3a4cc0){return _0x1011b7[_0x3fc0('0x18')](_0x582e22);}return _0x1011b7['status'](_0x582e22)[_0x3fc0('0x19')]();};}function respondWithResult(_0x422926,_0x392c46){_0x392c46=_0x392c46||0xc8;return function(_0x4eb69a){if(_0x4eb69a){return _0x422926[_0x3fc0('0x1a')](_0x392c46)[_0x3fc0('0x1b')](_0x4eb69a);}};}function respondWithFilteredResult(_0x367ce1,_0x27619a){return function(_0x562ecc){if(_0x562ecc){var _0x277dbf=typeof _0x27619a[_0x3fc0('0x1c')]===_0x3fc0('0x1d')&&typeof _0x27619a['limit']===_0x3fc0('0x1d');var _0x491446=_0x562ecc[_0x3fc0('0x1e')];var _0x3c5026=_0x277dbf?0x0:_0x27619a['offset'];var _0x3bb388=_0x277dbf?_0x562ecc[_0x3fc0('0x1e')]:_0x27619a[_0x3fc0('0x1c')]+_0x27619a[_0x3fc0('0x1f')];var _0x1bd575;if(_0x3bb388>=_0x491446){_0x3bb388=_0x491446;_0x1bd575=0xc8;}else{_0x1bd575=0xce;}_0x367ce1[_0x3fc0('0x1a')](_0x1bd575);return _0x367ce1[_0x3fc0('0x20')](_0x3fc0('0x21'),_0x3c5026+'-'+_0x3bb388+'/'+_0x491446)[_0x3fc0('0x1b')](_0x562ecc);}return null;};}function patchUpdates(_0x5c859e){return function(_0xf13744){try{jsonpatch[_0x3fc0('0x22')](_0xf13744,_0x5c859e,!![]);}catch(_0x34ffa7){return BPromise[_0x3fc0('0x23')](_0x34ffa7);}return _0xf13744[_0x3fc0('0x24')]();};}function saveUpdates(_0x448293,_0x47c770){return function(_0x477674){if(_0x477674){return _0x477674[_0x3fc0('0x25')](_0x448293)[_0x3fc0('0x26')](function(_0x28fc65){return _0x28fc65;});}return null;};}function removeEntity(_0x46c213,_0x303dd2){return function(_0x2f423e){if(_0x2f423e){return _0x2f423e[_0x3fc0('0x27')]()[_0x3fc0('0x26')](function(){_0x46c213[_0x3fc0('0x1a')](0xcc)[_0x3fc0('0x19')]();});}};}function handleEntityNotFound(_0x1abe10,_0x784765){return function(_0xba1a23){if(!_0xba1a23){_0x1abe10[_0x3fc0('0x18')](0x194);}return _0xba1a23;};}function handleError(_0xbec5b5,_0x4f5111){_0x4f5111=_0x4f5111||0x1f4;return function(_0x365c8e){logger[_0x3fc0('0x28')](_0x365c8e[_0x3fc0('0x29')]);if(_0x365c8e[_0x3fc0('0x2a')]){delete _0x365c8e['name'];}_0xbec5b5[_0x3fc0('0x1a')](_0x4f5111)[_0x3fc0('0x2b')](_0x365c8e);};}exports[_0x3fc0('0x2c')]=function(_0x2645b4,_0x559fcc){var _0x1e4d99={},_0x1a2261={},_0x1960a4={'count':0x0,'rows':[]};var _0xac736c=_[_0x3fc0('0x2d')](db[_0x3fc0('0x2e')]['rawAttributes'],function(_0xd9ecae){return{'name':_0xd9ecae[_0x3fc0('0x2f')],'type':_0xd9ecae[_0x3fc0('0x30')][_0x3fc0('0x31')]};});_0x1a2261[_0x3fc0('0x32')]=_[_0x3fc0('0x2d')](_0xac736c,_0x3fc0('0x2a'));_0x1a2261[_0x3fc0('0x33')]=_['keys'](_0x2645b4['query']);_0x1a2261[_0x3fc0('0x34')]=_['intersection'](_0x1a2261[_0x3fc0('0x32')],_0x1a2261[_0x3fc0('0x33')]);_0x1e4d99[_0x3fc0('0x35')]=_[_0x3fc0('0x36')](_0x1a2261[_0x3fc0('0x32')],qs['fields'](_0x2645b4['query'][_0x3fc0('0x37')]));_0x1e4d99[_0x3fc0('0x35')]=_0x1e4d99[_0x3fc0('0x35')][_0x3fc0('0x38')]?_0x1e4d99[_0x3fc0('0x35')]:_0x1a2261['model'];if(!_0x2645b4[_0x3fc0('0x33')][_0x3fc0('0x39')](_0x3fc0('0x3a'))){_0x1e4d99['limit']=qs[_0x3fc0('0x1f')](_0x2645b4[_0x3fc0('0x33')][_0x3fc0('0x1f')]);_0x1e4d99[_0x3fc0('0x1c')]=qs['offset'](_0x2645b4[_0x3fc0('0x33')][_0x3fc0('0x1c')]);}_0x1e4d99['order']=qs[_0x3fc0('0x3b')](_0x2645b4['query'][_0x3fc0('0x3b')]);_0x1e4d99[_0x3fc0('0x3c')]=qs[_0x3fc0('0x34')](_[_0x3fc0('0x3d')](_0x2645b4[_0x3fc0('0x33')],_0x1a2261[_0x3fc0('0x34')]),_0xac736c);if(_0x2645b4[_0x3fc0('0x33')][_0x3fc0('0x3e')]){_0x1e4d99[_0x3fc0('0x3c')]=_[_0x3fc0('0x3f')](_0x1e4d99[_0x3fc0('0x3c')],{'$or':_['map'](_0xac736c,function(_0x6bbe04){if(_0x6bbe04[_0x3fc0('0x30')]!==_0x3fc0('0x40')){var _0x28b4d5={};_0x28b4d5[_0x6bbe04[_0x3fc0('0x2a')]]={'$like':'%'+_0x2645b4[_0x3fc0('0x33')]['filter']+'%'};return _0x28b4d5;}})});}_0x1e4d99=_['merge']({},_0x1e4d99,_0x2645b4[_0x3fc0('0x41')]);var _0x3386d2={'where':_0x1e4d99[_0x3fc0('0x3c')]};return db[_0x3fc0('0x2e')][_0x3fc0('0x1e')](_0x3386d2)['then'](function(_0x53b45e){_0x1960a4['count']=_0x53b45e;if(_0x2645b4[_0x3fc0('0x33')][_0x3fc0('0x42')]){_0x1e4d99[_0x3fc0('0x43')]=[{'all':!![]}];}return db['FreshdeskField']['findAll'](_0x1e4d99);})[_0x3fc0('0x26')](function(_0x239dc5){_0x1960a4[_0x3fc0('0x44')]=_0x239dc5;return _0x1960a4;})[_0x3fc0('0x26')](respondWithFilteredResult(_0x559fcc,_0x1e4d99))['catch'](handleError(_0x559fcc,null));};exports['show']=function(_0x17510a,_0x2a45dc){var _0x547670={'raw':!![],'where':{'id':_0x17510a['params']['id']}},_0x32768f={};_0x32768f[_0x3fc0('0x32')]=_[_0x3fc0('0x45')](db[_0x3fc0('0x2e')][_0x3fc0('0x46')]);_0x32768f[_0x3fc0('0x33')]=_[_0x3fc0('0x45')](_0x17510a[_0x3fc0('0x33')]);_0x32768f[_0x3fc0('0x34')]=_['intersection'](_0x32768f[_0x3fc0('0x32')],_0x32768f['query']);_0x547670[_0x3fc0('0x35')]=_[_0x3fc0('0x36')](_0x32768f[_0x3fc0('0x32')],qs[_0x3fc0('0x37')](_0x17510a[_0x3fc0('0x33')]['fields']));_0x547670[_0x3fc0('0x35')]=_0x547670[_0x3fc0('0x35')][_0x3fc0('0x38')]?_0x547670[_0x3fc0('0x35')]:_0x32768f['model'];if(_0x17510a[_0x3fc0('0x33')]['includeAll']){_0x547670[_0x3fc0('0x43')]=[{'all':!![]}];}_0x547670=_[_0x3fc0('0x3f')]({},_0x547670,_0x17510a[_0x3fc0('0x41')]);return db[_0x3fc0('0x2e')][_0x3fc0('0x47')](_0x547670)['then'](handleEntityNotFound(_0x2a45dc,null))[_0x3fc0('0x26')](respondWithResult(_0x2a45dc,null))[_0x3fc0('0x48')](handleError(_0x2a45dc,null));};exports[_0x3fc0('0x49')]=function(_0x4c4aed,_0x3df404){return db[_0x3fc0('0x2e')]['create'](_0x4c4aed[_0x3fc0('0x4a')],{})[_0x3fc0('0x26')](respondWithResult(_0x3df404,0xc9))[_0x3fc0('0x48')](handleError(_0x3df404,null));};exports['update']=function(_0x5e5c73,_0x3a35ac){if(_0x5e5c73[_0x3fc0('0x4a')]['id']){delete _0x5e5c73[_0x3fc0('0x4a')]['id'];}return db['FreshdeskField'][_0x3fc0('0x47')]({'where':{'id':_0x5e5c73['params']['id']}})[_0x3fc0('0x26')](handleEntityNotFound(_0x3a35ac,null))['then'](saveUpdates(_0x5e5c73['body'],null))['then'](respondWithResult(_0x3a35ac,null))[_0x3fc0('0x48')](handleError(_0x3a35ac,null));};exports[_0x3fc0('0x27')]=function(_0x141b4c,_0x3730f5){return db[_0x3fc0('0x2e')][_0x3fc0('0x47')]({'where':{'id':_0x141b4c['params']['id']}})[_0x3fc0('0x26')](handleEntityNotFound(_0x3730f5,null))[_0x3fc0('0x26')](removeEntity(_0x3730f5,null))['catch'](handleError(_0x3730f5,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index cb11fe4..d275a93 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 _0xe9da=['../../config/environment','./intFreshdeskField.attributes','exports','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','bluebird','request-promise','path'];(function(_0x2e408f,_0x52aa84){var _0x2004b4=function(_0x14ade9){while(--_0x14ade9){_0x2e408f['push'](_0x2e408f['shift']());}};_0x2004b4(++_0x52aa84);}(_0xe9da,0x1dd));var _0xae9d=function(_0x334135,_0x5ca007){_0x334135=_0x334135-0x0;var _0x529584=_0xe9da[_0x334135];return _0x529584;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xae9d('0x0'));var rp=require(_0xae9d('0x1'));var fs=require('fs');var path=require(_0xae9d('0x2'));var rimraf=require('rimraf');var config=require(_0xae9d('0x3'));var attributes=require(_0xae9d('0x4'));module[_0xae9d('0x5')]=function(_0x231c01,_0x189d75){return _0x231c01[_0xae9d('0x6')](_0xae9d('0x7'),attributes,{'tableName':_0xae9d('0x8'),'paranoid':![],'indexes':[{'name':_0xae9d('0x9'),'fields':[_0xae9d('0xa'),_0xae9d('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb81d=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intFreshdeskField.attributes','exports','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId'];(function(_0x42af45,_0x13cfae){var _0x2ddda6=function(_0x3f747f){while(--_0x3f747f){_0x42af45['push'](_0x42af45['shift']());}};_0x2ddda6(++_0x13cfae);}(_0xb81d,0xb4));var _0xdb81=function(_0x4f9e46,_0x393eff){_0x4f9e46=_0x4f9e46-0x0;var _0x442004=_0xb81d[_0x4f9e46];return _0x442004;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xdb81('0x0'))(_0xdb81('0x1'));var moment=require(_0xdb81('0x2'));var BPromise=require('bluebird');var rp=require(_0xdb81('0x3'));var fs=require('fs');var path=require(_0xdb81('0x4'));var rimraf=require(_0xdb81('0x5'));var config=require(_0xdb81('0x6'));var attributes=require(_0xdb81('0x7'));module[_0xdb81('0x8')]=function(_0x10296c,_0x571b41){return _0x10296c[_0xdb81('0x9')](_0xdb81('0xa'),attributes,{'tableName':_0xdb81('0xb'),'paranoid':![],'indexes':[{'name':_0xdb81('0xc'),'fields':[_0xdb81('0xd'),_0xdb81('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.rpc.js b/server/api/intFreshdeskField/intFreshdeskField.rpc.js index 035c083..3f03d46 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 _0x321a=['info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','then'];(function(_0x190511,_0x44b120){var _0x805e71=function(_0x13c73f){while(--_0x13c73f){_0x190511['push'](_0x190511['shift']());}};_0x805e71(++_0x44b120);}(_0x321a,0xf0));var _0xa321=function(_0x2de884,_0x3ede1a){_0x2de884=_0x2de884-0x0;var _0x660f87=_0x321a[_0x2de884];return _0x660f87;};'use strict';var _=require(_0xa321('0x0'));var util=require(_0xa321('0x1'));var moment=require(_0xa321('0x2'));var BPromise=require(_0xa321('0x3'));var rs=require(_0xa321('0x4'));var fs=require('fs');var Redis=require(_0xa321('0x5'));var db=require(_0xa321('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xa321('0x7'))(_0xa321('0x8'));var config=require(_0xa321('0x9'));var jayson=require(_0xa321('0xa'));var client=jayson['client'][_0xa321('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x582ee5,_0x353f01,_0xc36162){return new BPromise(function(_0x1f3231,_0x9d9247){return client['request'](_0x582ee5,_0xc36162)[_0xa321('0xc')](function(_0x4a3fa5){logger[_0xa321('0xd')](_0xa321('0xe'),_0x353f01,_0xa321('0xf'));logger[_0xa321('0x10')](_0xa321('0x11'),_0x353f01,_0xa321('0xf'),JSON[_0xa321('0x12')](_0x4a3fa5));if(_0x4a3fa5['error']){if(_0x4a3fa5[_0xa321('0x13')][_0xa321('0x14')]===0x1f4){logger[_0xa321('0x13')](_0xa321('0xe'),_0x353f01,_0x4a3fa5['error'][_0xa321('0x15')]);return _0x9d9247(_0x4a3fa5['error']['message']);}logger[_0xa321('0x13')](_0xa321('0xe'),_0x353f01,_0x4a3fa5[_0xa321('0x13')][_0xa321('0x15')]);return _0x1f3231(_0x4a3fa5[_0xa321('0x13')][_0xa321('0x15')]);}else{logger[_0xa321('0xd')]('FreshdeskField,\x20%s,\x20%s',_0x353f01,_0xa321('0xf'));_0x1f3231(_0x4a3fa5['result'][_0xa321('0x15')]);}})[_0xa321('0x16')](function(_0x26815b){logger[_0xa321('0x13')](_0xa321('0xe'),_0x353f01,_0x26815b);_0x9d9247(_0x26815b);});});} \ No newline at end of file +var _0x1a72=['lodash','util','bluebird','ioredis','rpc','../../config/environment','client','http','request','then','request\x20sent','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshdeskField,\x20%s,\x20%s','message','info','result','catch'];(function(_0x26ba2c,_0x584851){var _0x272302=function(_0x412134){while(--_0x412134){_0x26ba2c['push'](_0x26ba2c['shift']());}};_0x272302(++_0x584851);}(_0x1a72,0x17c));var _0x21a7=function(_0x241783,_0x30dcc7){_0x241783=_0x241783-0x0;var _0x48afed=_0x1a72[_0x241783];return _0x48afed;};'use strict';var _=require(_0x21a7('0x0'));var util=require(_0x21a7('0x1'));var moment=require('moment');var BPromise=require(_0x21a7('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x21a7('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x21a7('0x4'));var config=require(_0x21a7('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x21a7('0x6')][_0x21a7('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x511168,_0x529641,_0x51158a){return new BPromise(function(_0x30feec,_0x5c0065){return client[_0x21a7('0x8')](_0x511168,_0x51158a)[_0x21a7('0x9')](function(_0x16d61a){logger['info']('FreshdeskField,\x20%s,\x20%s',_0x529641,_0x21a7('0xa'));logger['debug'](_0x21a7('0xb'),_0x529641,_0x21a7('0xa'),JSON[_0x21a7('0xc')](_0x16d61a));if(_0x16d61a[_0x21a7('0xd')]){if(_0x16d61a['error'][_0x21a7('0xe')]===0x1f4){logger[_0x21a7('0xd')](_0x21a7('0xf'),_0x529641,_0x16d61a[_0x21a7('0xd')]['message']);return _0x5c0065(_0x16d61a[_0x21a7('0xd')][_0x21a7('0x10')]);}logger[_0x21a7('0xd')](_0x21a7('0xf'),_0x529641,_0x16d61a[_0x21a7('0xd')]['message']);return _0x30feec(_0x16d61a[_0x21a7('0xd')]['message']);}else{logger[_0x21a7('0x11')](_0x21a7('0xf'),_0x529641,_0x21a7('0xa'));_0x30feec(_0x16d61a[_0x21a7('0x12')][_0x21a7('0x10')]);}})[_0x21a7('0x13')](function(_0x3264bf){logger[_0x21a7('0xd')](_0x21a7('0xf'),_0x529641,_0x3264bf);_0x5c0065(_0x3264bf);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 354d972..93e133f 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 _0x36ee=['index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','update','delete','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated'];(function(_0x53172c,_0x440938){var _0x48bc6a=function(_0x33094f){while(--_0x33094f){_0x53172c['push'](_0x53172c['shift']());}};_0x48bc6a(++_0x440938);}(_0x36ee,0xe8));var _0xe36e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x36ee[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe36e('0x0'));var timeout=require('connect-timeout');var express=require(_0xe36e('0x1'));var router=express[_0xe36e('0x2')]();var fs_extra=require(_0xe36e('0x3'));var auth=require(_0xe36e('0x4'));var interaction=require(_0xe36e('0x5'));var config=require(_0xe36e('0x6'));var controller=require(_0xe36e('0x7'));router[_0xe36e('0x8')]('/',auth[_0xe36e('0x9')](),controller[_0xe36e('0xa')]);router[_0xe36e('0x8')](_0xe36e('0xb'),auth['isAuthenticated'](),controller[_0xe36e('0xc')]);router['get'](_0xe36e('0xd'),auth[_0xe36e('0x9')](),controller[_0xe36e('0xe')]);router['get'](_0xe36e('0xf'),auth['isAuthenticated'](),controller[_0xe36e('0x10')]);router[_0xe36e('0x11')]('/',auth[_0xe36e('0x9')](),controller[_0xe36e('0x12')]);router[_0xe36e('0x11')](_0xe36e('0xd'),auth[_0xe36e('0x9')](),controller[_0xe36e('0x13')]);router['put'](_0xe36e('0xb'),auth[_0xe36e('0x9')](),controller[_0xe36e('0x14')]);router[_0xe36e('0x15')]('/:id',auth[_0xe36e('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xb58b=['Router','fs-extra','../../components/interaction/service','./intFreshsalesAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post','create','put','update','delete','destroy','util','path','connect-timeout'];(function(_0x910793,_0x429cbf){var _0x21c77e=function(_0x45ca35){while(--_0x45ca35){_0x910793['push'](_0x910793['shift']());}};_0x21c77e(++_0x429cbf);}(_0xb58b,0x1f1));var _0xbb58=function(_0x5a6318,_0x216a38){_0x5a6318=_0x5a6318-0x0;var _0x1faa09=_0xb58b[_0x5a6318];return _0x1faa09;};'use strict';var multer=require('multer');var util=require(_0xbb58('0x0'));var path=require(_0xbb58('0x1'));var timeout=require(_0xbb58('0x2'));var express=require('express');var router=express[_0xbb58('0x3')]();var fs_extra=require(_0xbb58('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xbb58('0x5'));var config=require('../../config/environment');var controller=require(_0xbb58('0x6'));router[_0xbb58('0x7')]('/',auth[_0xbb58('0x8')](),controller['index']);router[_0xbb58('0x7')](_0xbb58('0x9'),auth[_0xbb58('0x8')](),controller[_0xbb58('0xa')]);router[_0xbb58('0x7')](_0xbb58('0xb'),auth[_0xbb58('0x8')](),controller[_0xbb58('0xc')]);router[_0xbb58('0x7')](_0xbb58('0xd'),auth[_0xbb58('0x8')](),controller['getFields']);router[_0xbb58('0xe')]('/',auth['isAuthenticated'](),controller[_0xbb58('0xf')]);router[_0xbb58('0xe')](_0xbb58('0xb'),auth[_0xbb58('0x8')](),controller['addConfiguration']);router[_0xbb58('0x10')](_0xbb58('0x9'),auth['isAuthenticated'](),controller[_0xbb58('0x11')]);router[_0xbb58('0x12')](_0xbb58('0x9'),auth[_0xbb58('0x8')](),controller[_0xbb58('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 2776ccd..1f0b678 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 _0x32f4=['sequelize','exports','STRING','username','remoteUri'];(function(_0x43a602,_0x4fe4ef){var _0x5b085c=function(_0xf6f6c4){while(--_0xf6f6c4){_0x43a602['push'](_0x43a602['shift']());}};_0x5b085c(++_0x4fe4ef);}(_0x32f4,0x154));var _0x432f=function(_0x360fb9,_0x16a085){_0x360fb9=_0x360fb9-0x0;var _0x23779d=_0x32f4[_0x360fb9];return _0x23779d;};'use strict';var Sequelize=require(_0x432f('0x0'));module[_0x432f('0x1')]={'name':{'type':Sequelize[_0x432f('0x2')]},'description':{'type':Sequelize[_0x432f('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x432f('0x3')},'apiKey':{'type':Sequelize[_0x432f('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x432f('0x4')},'serverUrl':{'type':Sequelize[_0x432f('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x93e9=['sequelize','exports','STRING','username'];(function(_0x1ae5ab,_0xc5d441){var _0x1ce001=function(_0x5ef96d){while(--_0x5ef96d){_0x1ae5ab['push'](_0x1ae5ab['shift']());}};_0x1ce001(++_0xc5d441);}(_0x93e9,0xcc));var _0x993e=function(_0x1b591b,_0x6d2e2b){_0x1b591b=_0x1b591b-0x0;var _0x3c24f0=_0x93e9[_0x1b591b];return _0x3c24f0;};'use strict';var Sequelize=require(_0x993e('0x0'));module[_0x993e('0x1')]={'name':{'type':Sequelize[_0x993e('0x2')]},'description':{'type':Sequelize[_0x993e('0x2')]},'username':{'type':Sequelize[_0x993e('0x2')],'unique':_0x993e('0x3')},'apiKey':{'type':Sequelize[_0x993e('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x993e('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 7cdd12b..4e2e685 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 _0x1107=['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/logger','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','destroy','error','name','send','index','map','FreshsalesAccount','rawAttributes','fieldName','type','key','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','filters','pick','filter','VIRTUAL','merge','include','rows','catch','show','params','includeAll','options','find','create','update','body','getConfigurations','findOne','FreshsalesConfiguration','sort','addConfiguration','Subjects','getSubjects','channel','Descriptions','FreshsalesField','getFields','remoteUri','slice','GET','format','Token\x20token=','users','Requested\x20Resource\x20not\x20Found','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','moment'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x1107,0x12d));var _0x7110=function(_0x130705,_0x2d266b){_0x130705=_0x130705-0x0;var _0x1fa991=_0x1107[_0x130705];return _0x1fa991;};'use strict';var emlformat=require(_0x7110('0x0'));var rimraf=require(_0x7110('0x1'));var zipdir=require(_0x7110('0x2'));var jsonpatch=require(_0x7110('0x3'));var rp=require('request-promise');var moment=require(_0x7110('0x4'));var BPromise=require(_0x7110('0x5'));var Mustache=require(_0x7110('0x6'));var util=require('util');var path=require(_0x7110('0x7'));var sox=require('sox');var csv=require(_0x7110('0x8'));var ejs=require(_0x7110('0x9'));var fs=require('fs');var fs_extra=require(_0x7110('0xa'));var _=require(_0x7110('0xb'));var squel=require(_0x7110('0xc'));var crypto=require(_0x7110('0xd'));var jsforce=require(_0x7110('0xe'));var deskjs=require(_0x7110('0xf'));var toCsv=require(_0x7110('0x8'));var querystring=require(_0x7110('0x10'));var Papa=require(_0x7110('0x11'));var Redis=require(_0x7110('0x12'));var authService=require(_0x7110('0x13'));var qs=require(_0x7110('0x14'));var as=require(_0x7110('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7110('0x16'))(_0x7110('0x17'));var utils=require(_0x7110('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7110('0x19'))['db'];var integrations=require(_0x7110('0x1a'));function respondWithStatusCode(_0x419873,_0x466dd6){_0x466dd6=_0x466dd6||0xcc;return function(_0xa1deb8){if(_0xa1deb8){return _0x419873[_0x7110('0x1b')](_0x466dd6);}return _0x419873[_0x7110('0x1c')](_0x466dd6)[_0x7110('0x1d')]();};}function respondWithResult(_0xc4c1e3,_0x54f739){_0x54f739=_0x54f739||0xc8;return function(_0x23c239){if(_0x23c239){return _0xc4c1e3[_0x7110('0x1c')](_0x54f739)[_0x7110('0x1e')](_0x23c239);}};}function respondWithFilteredResult(_0x1f4106,_0x3617be){return function(_0x373290){if(_0x373290){var _0x207b63=typeof _0x3617be['offset']===_0x7110('0x1f')&&typeof _0x3617be[_0x7110('0x20')]===_0x7110('0x1f');var _0x1149e4=_0x373290[_0x7110('0x21')];var _0x390f59=_0x207b63?0x0:_0x3617be[_0x7110('0x22')];var _0x3ad87e=_0x207b63?_0x373290[_0x7110('0x21')]:_0x3617be[_0x7110('0x22')]+_0x3617be[_0x7110('0x20')];var _0x49504d;if(_0x3ad87e>=_0x1149e4){_0x3ad87e=_0x1149e4;_0x49504d=0xc8;}else{_0x49504d=0xce;}_0x1f4106[_0x7110('0x1c')](_0x49504d);return _0x1f4106[_0x7110('0x23')](_0x7110('0x24'),_0x390f59+'-'+_0x3ad87e+'/'+_0x1149e4)[_0x7110('0x1e')](_0x373290);}return null;};}function patchUpdates(_0x419c9e){return function(_0xe89449){try{jsonpatch[_0x7110('0x25')](_0xe89449,_0x419c9e,!![]);}catch(_0x1adf29){return BPromise[_0x7110('0x26')](_0x1adf29);}return _0xe89449[_0x7110('0x27')]();};}function saveUpdates(_0x424c30,_0x54278c){return function(_0x53d315){if(_0x53d315){return _0x53d315['update'](_0x424c30)[_0x7110('0x28')](function(_0x58e6b0){return _0x58e6b0;});}return null;};}function removeEntity(_0x1bc951,_0x25e201){return function(_0x131232){if(_0x131232){return _0x131232[_0x7110('0x29')]()[_0x7110('0x28')](function(){_0x1bc951[_0x7110('0x1c')](0xcc)[_0x7110('0x1d')]();});}};}function handleEntityNotFound(_0x3c0eca,_0x7c843a){return function(_0xe36655){if(!_0xe36655){_0x3c0eca[_0x7110('0x1b')](0x194);}return _0xe36655;};}function handleError(_0x1dc716,_0xdeca90){_0xdeca90=_0xdeca90||0x1f4;return function(_0xc22762){logger[_0x7110('0x2a')](_0xc22762['stack']);if(_0xc22762['name']){delete _0xc22762[_0x7110('0x2b')];}_0x1dc716[_0x7110('0x1c')](_0xdeca90)[_0x7110('0x2c')](_0xc22762);};}exports[_0x7110('0x2d')]=function(_0x1ab55e,_0x40bf1f){var _0x88514f={},_0x5dd140={},_0x7f038a={'count':0x0,'rows':[]};var _0x539e84=_[_0x7110('0x2e')](db[_0x7110('0x2f')][_0x7110('0x30')],function(_0x17e520){return{'name':_0x17e520[_0x7110('0x31')],'type':_0x17e520[_0x7110('0x32')][_0x7110('0x33')]};});_0x5dd140[_0x7110('0x34')]=_[_0x7110('0x2e')](_0x539e84,_0x7110('0x2b'));_0x5dd140['query']=_[_0x7110('0x35')](_0x1ab55e[_0x7110('0x36')]);_0x5dd140['filters']=_['intersection'](_0x5dd140[_0x7110('0x34')],_0x5dd140[_0x7110('0x36')]);_0x88514f['attributes']=_[_0x7110('0x37')](_0x5dd140[_0x7110('0x34')],qs[_0x7110('0x38')](_0x1ab55e[_0x7110('0x36')][_0x7110('0x38')]));_0x88514f[_0x7110('0x39')]=_0x88514f[_0x7110('0x39')][_0x7110('0x3a')]?_0x88514f[_0x7110('0x39')]:_0x5dd140[_0x7110('0x34')];if(!_0x1ab55e['query'][_0x7110('0x3b')](_0x7110('0x3c'))){_0x88514f[_0x7110('0x20')]=qs[_0x7110('0x20')](_0x1ab55e[_0x7110('0x36')][_0x7110('0x20')]);_0x88514f[_0x7110('0x22')]=qs[_0x7110('0x22')](_0x1ab55e[_0x7110('0x36')][_0x7110('0x22')]);}_0x88514f[_0x7110('0x3d')]=qs['sort'](_0x1ab55e['query']['sort']);_0x88514f[_0x7110('0x3e')]=qs[_0x7110('0x3f')](_[_0x7110('0x40')](_0x1ab55e[_0x7110('0x36')],_0x5dd140[_0x7110('0x3f')]),_0x539e84);if(_0x1ab55e[_0x7110('0x36')][_0x7110('0x41')]){_0x88514f[_0x7110('0x3e')]=_['merge'](_0x88514f[_0x7110('0x3e')],{'$or':_[_0x7110('0x2e')](_0x539e84,function(_0x4ddfda){if(_0x4ddfda[_0x7110('0x32')]!==_0x7110('0x42')){var _0x5b90bf={};_0x5b90bf[_0x4ddfda[_0x7110('0x2b')]]={'$like':'%'+_0x1ab55e[_0x7110('0x36')][_0x7110('0x41')]+'%'};return _0x5b90bf;}})});}_0x88514f=_[_0x7110('0x43')]({},_0x88514f,_0x1ab55e['options']);var _0x5ac6bd={'where':_0x88514f[_0x7110('0x3e')]};return db[_0x7110('0x2f')]['count'](_0x5ac6bd)[_0x7110('0x28')](function(_0x2ab0e0){_0x7f038a[_0x7110('0x21')]=_0x2ab0e0;if(_0x1ab55e[_0x7110('0x36')]['includeAll']){_0x88514f[_0x7110('0x44')]=[{'all':!![]}];}return db[_0x7110('0x2f')]['findAll'](_0x88514f);})[_0x7110('0x28')](function(_0x487ff3){_0x7f038a[_0x7110('0x45')]=_0x487ff3;return _0x7f038a;})[_0x7110('0x28')](respondWithFilteredResult(_0x40bf1f,_0x88514f))[_0x7110('0x46')](handleError(_0x40bf1f,null));};exports[_0x7110('0x47')]=function(_0x584d89,_0x59b1d4){var _0x578f91={'raw':![],'where':{'id':_0x584d89[_0x7110('0x48')]['id']}},_0x3cd054={};_0x3cd054[_0x7110('0x34')]=_[_0x7110('0x35')](db[_0x7110('0x2f')][_0x7110('0x30')]);_0x3cd054['query']=_['keys'](_0x584d89['query']);_0x3cd054[_0x7110('0x3f')]=_[_0x7110('0x37')](_0x3cd054[_0x7110('0x34')],_0x3cd054['query']);_0x578f91[_0x7110('0x39')]=_[_0x7110('0x37')](_0x3cd054[_0x7110('0x34')],qs[_0x7110('0x38')](_0x584d89[_0x7110('0x36')][_0x7110('0x38')]));_0x578f91['attributes']=_0x578f91[_0x7110('0x39')][_0x7110('0x3a')]?_0x578f91[_0x7110('0x39')]:_0x3cd054[_0x7110('0x34')];if(_0x584d89[_0x7110('0x36')][_0x7110('0x49')]){_0x578f91[_0x7110('0x44')]=[{'all':!![]}];}_0x578f91=_[_0x7110('0x43')]({},_0x578f91,_0x584d89[_0x7110('0x4a')]);return db[_0x7110('0x2f')][_0x7110('0x4b')](_0x578f91)[_0x7110('0x28')](handleEntityNotFound(_0x59b1d4,null))['then'](respondWithResult(_0x59b1d4,null))[_0x7110('0x46')](handleError(_0x59b1d4,null));};exports['create']=function(_0x1444f7,_0x3ce236){return db[_0x7110('0x2f')][_0x7110('0x4c')](_0x1444f7['body'],{})[_0x7110('0x28')](respondWithResult(_0x3ce236,0xc9))['catch'](handleError(_0x3ce236,null));};exports[_0x7110('0x4d')]=function(_0x156839,_0x8ba9a0){if(_0x156839[_0x7110('0x4e')]['id']){delete _0x156839[_0x7110('0x4e')]['id'];}return db[_0x7110('0x2f')][_0x7110('0x4b')]({'where':{'id':_0x156839[_0x7110('0x48')]['id']}})[_0x7110('0x28')](handleEntityNotFound(_0x8ba9a0,null))['then'](saveUpdates(_0x156839[_0x7110('0x4e')],null))['then'](respondWithResult(_0x8ba9a0,null))[_0x7110('0x46')](handleError(_0x8ba9a0,null));};exports['destroy']=function(_0x14dc6a,_0x3e89eb){return db['FreshsalesAccount']['find']({'where':{'id':_0x14dc6a[_0x7110('0x48')]['id']}})[_0x7110('0x28')](handleEntityNotFound(_0x3e89eb,null))['then'](removeEntity(_0x3e89eb,null))[_0x7110('0x46')](handleError(_0x3e89eb,null));};exports[_0x7110('0x4f')]=function(_0x1a02ca,_0x484905,_0x4c7f15){var _0x398f28={};var _0x488817={};var _0x32ab70;var _0x31a08f;return db[_0x7110('0x2f')][_0x7110('0x50')]({'where':{'id':_0x1a02ca['params']['id']}})[_0x7110('0x28')](handleEntityNotFound(_0x484905,null))[_0x7110('0x28')](function(_0x3a6dc6){if(_0x3a6dc6){_0x32ab70=_0x3a6dc6;_0x488817['model']=_[_0x7110('0x35')](db[_0x7110('0x51')]['rawAttributes']);_0x488817[_0x7110('0x36')]=_[_0x7110('0x35')](_0x1a02ca[_0x7110('0x36')]);_0x488817['filters']=_['intersection'](_0x488817[_0x7110('0x34')],_0x488817[_0x7110('0x36')]);_0x398f28[_0x7110('0x39')]=_[_0x7110('0x37')](_0x488817[_0x7110('0x34')],qs['fields'](_0x1a02ca[_0x7110('0x36')]['fields']));_0x398f28[_0x7110('0x39')]=_0x398f28[_0x7110('0x39')][_0x7110('0x3a')]?_0x398f28[_0x7110('0x39')]:_0x488817[_0x7110('0x34')];_0x398f28['order']=qs['sort'](_0x1a02ca[_0x7110('0x36')][_0x7110('0x52')]);_0x398f28['where']=qs[_0x7110('0x3f')](_[_0x7110('0x40')](_0x1a02ca['query'],_0x488817['filters']));if(_0x1a02ca[_0x7110('0x36')][_0x7110('0x41')]){_0x398f28[_0x7110('0x3e')]=_[_0x7110('0x43')](_0x398f28[_0x7110('0x3e')],{'$or':_[_0x7110('0x2e')](_0x398f28[_0x7110('0x39')],function(_0x44e4ce){var _0x3761f8={};_0x3761f8[_0x44e4ce]={'$like':'%'+_0x1a02ca[_0x7110('0x36')][_0x7110('0x41')]+'%'};return _0x3761f8;})});}_0x398f28=_[_0x7110('0x43')]({},_0x398f28,_0x1a02ca[_0x7110('0x4a')]);return _0x32ab70[_0x7110('0x4f')](_0x398f28);}})[_0x7110('0x28')](function(_0x27250b){if(_0x27250b){_0x31a08f=_0x27250b[_0x7110('0x3a')];if(!_0x1a02ca[_0x7110('0x36')][_0x7110('0x3b')](_0x7110('0x3c'))){_0x398f28[_0x7110('0x20')]=qs[_0x7110('0x20')](_0x1a02ca['query']['limit']);_0x398f28[_0x7110('0x22')]=qs['offset'](_0x1a02ca[_0x7110('0x36')]['offset']);}return _0x32ab70[_0x7110('0x4f')](_0x398f28);}})[_0x7110('0x28')](function(_0x3edd4e){if(_0x3edd4e){return _0x3edd4e?{'count':_0x31a08f,'rows':_0x3edd4e}:null;}})[_0x7110('0x28')](respondWithResult(_0x484905,null))[_0x7110('0x46')](handleError(_0x484905,null));};exports[_0x7110('0x53')]=function(_0x48d117,_0x5763d6,_0x1a9f28){if(_0x48d117[_0x7110('0x4e')]['id']){delete _0x48d117[_0x7110('0x4e')]['id'];}return db[_0x7110('0x2f')]['findOne']({'where':{'id':_0x48d117[_0x7110('0x48')]['id']}})[_0x7110('0x28')](handleEntityNotFound(_0x5763d6,null))['then'](function(_0x5231bf){if(_0x5231bf){_0x48d117[_0x7110('0x4e')]['AccountId']=_0x5231bf['id'];_0x48d117[_0x7110('0x4e')][_0x7110('0x54')]=integrations[_0x7110('0x55')](_0x48d117['body'][_0x7110('0x56')],_0x48d117[_0x7110('0x4e')][_0x7110('0x32')]);_0x48d117[_0x7110('0x4e')][_0x7110('0x57')]=integrations['getDescriptions'](_0x48d117[_0x7110('0x4e')][_0x7110('0x56')],_0x48d117['body'][_0x7110('0x32')]);return db['FreshsalesConfiguration'][_0x7110('0x4c')](_0x48d117[_0x7110('0x4e')],{'include':[{'model':db[_0x7110('0x58')],'as':'Subjects'},{'model':db['FreshsalesField'],'as':_0x7110('0x57')}]});}return null;})[_0x7110('0x28')](respondWithResult(_0x5763d6,null))[_0x7110('0x46')](handleError(_0x5763d6,null));};exports[_0x7110('0x59')]=function(_0x594db2,_0x3bfc29,_0x56fa55){var _0x25acb2='';var _0x75397f='';return db[_0x7110('0x2f')][_0x7110('0x50')]({'where':{'id':_0x594db2[_0x7110('0x48')]['id']},'attributes':['id','username','remoteUri','apiKey']})[_0x7110('0x28')](handleEntityNotFound(_0x3bfc29,null))[_0x7110('0x28')](function(_0x5e8dd0){if(_0x5e8dd0){_0x75397f=_0x5e8dd0['username'];_0x25acb2=_0x5e8dd0[_0x7110('0x5a')];var _0x40808e=_0x5e8dd0[_0x7110('0x5a')][_0x7110('0x5b')](-0x1);if(_0x40808e==='/'){_0x25acb2=_0x25acb2['substring'](0x0,_0x25acb2['lastIndexOf'](_0x40808e));}return rp({'method':_0x7110('0x5c'),'uri':util[_0x7110('0x5d')]('%s%s',_0x25acb2,'/api/selector/owners'),'headers':{'Authorization':_0x7110('0x5e')+_0x5e8dd0['apiKey']},'json':!![]});}})[_0x7110('0x28')](function(_0x4d621b){if(_0x4d621b){var _0x6cc1ee=_0x4d621b[_0x7110('0x5f')];var _0x1f8bbd=![];var _0x26f315=null;for(_0x26f315=0x0;_0x26f315<_0x6cc1ee[_0x7110('0x3a')];_0x26f315++){if(_0x6cc1ee[_0x26f315]['email']===_0x75397f){_0x1f8bbd=!![];}}if(_0x1f8bbd){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x7110('0x60')});}}})[_0x7110('0x28')](respondWithResult(_0x3bfc29,null))['catch'](function(_0x4b5972){var _0x15aacd=_0x594db2['query'][_0x7110('0x61')]?0x1f4:_0x4b5972[_0x7110('0x62')]||0x1f4;logger[_0x7110('0x2a')](_0x7110('0x63'),_0x7110('0x59'),_0x15aacd,JSON[_0x7110('0x64')](_0x4b5972));delete _0x4b5972[_0x7110('0x2b')];if(_0x15aacd===0x191){_0x15aacd=0x190;}_0x3bfc29['status'](_0x15aacd)[_0x7110('0x2c')](_0x594db2['query']['test']?{'message':_0x7110('0x65'),'statusCode':_0x4b5972['statusCode']}:_0x4b5972);});}; \ No newline at end of file +var _0x43ad=['zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','name','send','index','map','FreshsalesAccount','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','destroy','findOne','FreshsalesConfiguration','order','getConfigurations','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshsalesField','getFields','username','remoteUri','substring','lastIndexOf','GET','format','/api/selector/owners','apiKey','users','email','test','statusCode','stringify','Wrong\x20credentials','eml-format'];(function(_0x38bac1,_0x240744){var _0x2b5960=function(_0x43293b){while(--_0x43293b){_0x38bac1['push'](_0x38bac1['shift']());}};_0x2b5960(++_0x240744);}(_0x43ad,0xcf));var _0xd43a=function(_0x376df5,_0x3caf6c){_0x376df5=_0x376df5-0x0;var _0x50c52c=_0x43ad[_0x376df5];return _0x50c52c;};'use strict';var emlformat=require(_0xd43a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd43a('0x1'));var jsonpatch=require(_0xd43a('0x2'));var rp=require(_0xd43a('0x3'));var moment=require(_0xd43a('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd43a('0x5'));var util=require(_0xd43a('0x6'));var path=require(_0xd43a('0x7'));var sox=require('sox');var csv=require(_0xd43a('0x8'));var ejs=require(_0xd43a('0x9'));var fs=require('fs');var fs_extra=require(_0xd43a('0xa'));var _=require(_0xd43a('0xb'));var squel=require(_0xd43a('0xc'));var crypto=require(_0xd43a('0xd'));var jsforce=require(_0xd43a('0xe'));var deskjs=require(_0xd43a('0xf'));var toCsv=require('to-csv');var querystring=require(_0xd43a('0x10'));var Papa=require(_0xd43a('0x11'));var Redis=require(_0xd43a('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xd43a('0x13'));var hardwareService=require(_0xd43a('0x14'));var logger=require('../../config/logger')(_0xd43a('0x15'));var utils=require(_0xd43a('0x16'));var config=require(_0xd43a('0x17'));var licenseUtil=require(_0xd43a('0x18'));var db=require(_0xd43a('0x19'))['db'];var integrations=require(_0xd43a('0x1a'));function respondWithStatusCode(_0x2a1def,_0x18d749){_0x18d749=_0x18d749||0xcc;return function(_0x2911af){if(_0x2911af){return _0x2a1def[_0xd43a('0x1b')](_0x18d749);}return _0x2a1def[_0xd43a('0x1c')](_0x18d749)[_0xd43a('0x1d')]();};}function respondWithResult(_0x3ab47c,_0x29eb03){_0x29eb03=_0x29eb03||0xc8;return function(_0x417062){if(_0x417062){return _0x3ab47c['status'](_0x29eb03)[_0xd43a('0x1e')](_0x417062);}};}function respondWithFilteredResult(_0x215b42,_0x134f86){return function(_0x324c37){if(_0x324c37){var _0x44fa14=typeof _0x134f86[_0xd43a('0x1f')]===_0xd43a('0x20')&&typeof _0x134f86[_0xd43a('0x21')]===_0xd43a('0x20');var _0x1d2ef8=_0x324c37['count'];var _0xd9fdcf=_0x44fa14?0x0:_0x134f86[_0xd43a('0x1f')];var _0x29d77b=_0x44fa14?_0x324c37[_0xd43a('0x22')]:_0x134f86[_0xd43a('0x1f')]+_0x134f86[_0xd43a('0x21')];var _0x443e86;if(_0x29d77b>=_0x1d2ef8){_0x29d77b=_0x1d2ef8;_0x443e86=0xc8;}else{_0x443e86=0xce;}_0x215b42['status'](_0x443e86);return _0x215b42[_0xd43a('0x23')](_0xd43a('0x24'),_0xd9fdcf+'-'+_0x29d77b+'/'+_0x1d2ef8)['json'](_0x324c37);}return null;};}function patchUpdates(_0x401005){return function(_0xa77ab5){try{jsonpatch[_0xd43a('0x25')](_0xa77ab5,_0x401005,!![]);}catch(_0x33a1ea){return BPromise[_0xd43a('0x26')](_0x33a1ea);}return _0xa77ab5[_0xd43a('0x27')]();};}function saveUpdates(_0x48388f,_0x4c4821){return function(_0x2b5264){if(_0x2b5264){return _0x2b5264[_0xd43a('0x28')](_0x48388f)['then'](function(_0x30389c){return _0x30389c;});}return null;};}function removeEntity(_0x5ef184,_0x2b03c6){return function(_0x106784){if(_0x106784){return _0x106784['destroy']()[_0xd43a('0x29')](function(){_0x5ef184[_0xd43a('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x6298fd,_0x115387){return function(_0x4e62bb){if(!_0x4e62bb){_0x6298fd['sendStatus'](0x194);}return _0x4e62bb;};}function handleError(_0x8c2bd4,_0x29bbd1){_0x29bbd1=_0x29bbd1||0x1f4;return function(_0x9e5fc1){logger[_0xd43a('0x2a')](_0x9e5fc1['stack']);if(_0x9e5fc1[_0xd43a('0x2b')]){delete _0x9e5fc1[_0xd43a('0x2b')];}_0x8c2bd4[_0xd43a('0x1c')](_0x29bbd1)[_0xd43a('0x2c')](_0x9e5fc1);};}exports[_0xd43a('0x2d')]=function(_0x2c6d25,_0x3d488a){var _0x5f510b={},_0x282ff2={},_0x587bcd={'count':0x0,'rows':[]};var _0x5957bb=_[_0xd43a('0x2e')](db[_0xd43a('0x2f')][_0xd43a('0x30')],function(_0x2ff772){return{'name':_0x2ff772[_0xd43a('0x31')],'type':_0x2ff772[_0xd43a('0x32')][_0xd43a('0x33')]};});_0x282ff2[_0xd43a('0x34')]=_[_0xd43a('0x2e')](_0x5957bb,'name');_0x282ff2['query']=_[_0xd43a('0x35')](_0x2c6d25[_0xd43a('0x36')]);_0x282ff2[_0xd43a('0x37')]=_['intersection'](_0x282ff2[_0xd43a('0x34')],_0x282ff2[_0xd43a('0x36')]);_0x5f510b[_0xd43a('0x38')]=_[_0xd43a('0x39')](_0x282ff2[_0xd43a('0x34')],qs[_0xd43a('0x3a')](_0x2c6d25[_0xd43a('0x36')][_0xd43a('0x3a')]));_0x5f510b[_0xd43a('0x38')]=_0x5f510b[_0xd43a('0x38')][_0xd43a('0x3b')]?_0x5f510b[_0xd43a('0x38')]:_0x282ff2[_0xd43a('0x34')];if(!_0x2c6d25[_0xd43a('0x36')]['hasOwnProperty'](_0xd43a('0x3c'))){_0x5f510b[_0xd43a('0x21')]=qs[_0xd43a('0x21')](_0x2c6d25['query'][_0xd43a('0x21')]);_0x5f510b[_0xd43a('0x1f')]=qs['offset'](_0x2c6d25[_0xd43a('0x36')][_0xd43a('0x1f')]);}_0x5f510b['order']=qs[_0xd43a('0x3d')](_0x2c6d25['query'][_0xd43a('0x3d')]);_0x5f510b[_0xd43a('0x3e')]=qs[_0xd43a('0x37')](_[_0xd43a('0x3f')](_0x2c6d25[_0xd43a('0x36')],_0x282ff2[_0xd43a('0x37')]),_0x5957bb);if(_0x2c6d25[_0xd43a('0x36')][_0xd43a('0x40')]){_0x5f510b['where']=_['merge'](_0x5f510b[_0xd43a('0x3e')],{'$or':_[_0xd43a('0x2e')](_0x5957bb,function(_0x552235){if(_0x552235[_0xd43a('0x32')]!=='VIRTUAL'){var _0x17cb9b={};_0x17cb9b[_0x552235[_0xd43a('0x2b')]]={'$like':'%'+_0x2c6d25[_0xd43a('0x36')]['filter']+'%'};return _0x17cb9b;}})});}_0x5f510b=_[_0xd43a('0x41')]({},_0x5f510b,_0x2c6d25[_0xd43a('0x42')]);var _0x1a973e={'where':_0x5f510b[_0xd43a('0x3e')]};return db[_0xd43a('0x2f')][_0xd43a('0x22')](_0x1a973e)[_0xd43a('0x29')](function(_0x24eeb2){_0x587bcd[_0xd43a('0x22')]=_0x24eeb2;if(_0x2c6d25[_0xd43a('0x36')][_0xd43a('0x43')]){_0x5f510b[_0xd43a('0x44')]=[{'all':!![]}];}return db[_0xd43a('0x2f')][_0xd43a('0x45')](_0x5f510b);})['then'](function(_0x462c18){_0x587bcd[_0xd43a('0x46')]=_0x462c18;return _0x587bcd;})[_0xd43a('0x29')](respondWithFilteredResult(_0x3d488a,_0x5f510b))['catch'](handleError(_0x3d488a,null));};exports[_0xd43a('0x47')]=function(_0x47b96c,_0x2d75ba){var _0x443a07={'raw':![],'where':{'id':_0x47b96c[_0xd43a('0x48')]['id']}},_0x3327df={};_0x3327df[_0xd43a('0x34')]=_[_0xd43a('0x35')](db['FreshsalesAccount'][_0xd43a('0x30')]);_0x3327df['query']=_[_0xd43a('0x35')](_0x47b96c[_0xd43a('0x36')]);_0x3327df['filters']=_[_0xd43a('0x39')](_0x3327df['model'],_0x3327df[_0xd43a('0x36')]);_0x443a07[_0xd43a('0x38')]=_['intersection'](_0x3327df[_0xd43a('0x34')],qs[_0xd43a('0x3a')](_0x47b96c[_0xd43a('0x36')][_0xd43a('0x3a')]));_0x443a07[_0xd43a('0x38')]=_0x443a07[_0xd43a('0x38')][_0xd43a('0x3b')]?_0x443a07[_0xd43a('0x38')]:_0x3327df[_0xd43a('0x34')];if(_0x47b96c[_0xd43a('0x36')][_0xd43a('0x43')]){_0x443a07[_0xd43a('0x44')]=[{'all':!![]}];}_0x443a07=_[_0xd43a('0x41')]({},_0x443a07,_0x47b96c[_0xd43a('0x42')]);return db[_0xd43a('0x2f')][_0xd43a('0x49')](_0x443a07)['then'](handleEntityNotFound(_0x2d75ba,null))[_0xd43a('0x29')](respondWithResult(_0x2d75ba,null))[_0xd43a('0x4a')](handleError(_0x2d75ba,null));};exports[_0xd43a('0x4b')]=function(_0x5ab82c,_0x31fc15){return db[_0xd43a('0x2f')][_0xd43a('0x4b')](_0x5ab82c[_0xd43a('0x4c')],{})[_0xd43a('0x29')](respondWithResult(_0x31fc15,0xc9))[_0xd43a('0x4a')](handleError(_0x31fc15,null));};exports[_0xd43a('0x28')]=function(_0x791236,_0x180c45){if(_0x791236[_0xd43a('0x4c')]['id']){delete _0x791236['body']['id'];}return db[_0xd43a('0x2f')][_0xd43a('0x49')]({'where':{'id':_0x791236[_0xd43a('0x48')]['id']}})[_0xd43a('0x29')](handleEntityNotFound(_0x180c45,null))['then'](saveUpdates(_0x791236['body'],null))[_0xd43a('0x29')](respondWithResult(_0x180c45,null))[_0xd43a('0x4a')](handleError(_0x180c45,null));};exports[_0xd43a('0x4d')]=function(_0xb6295,_0x370043){return db[_0xd43a('0x2f')]['find']({'where':{'id':_0xb6295[_0xd43a('0x48')]['id']}})[_0xd43a('0x29')](handleEntityNotFound(_0x370043,null))[_0xd43a('0x29')](removeEntity(_0x370043,null))['catch'](handleError(_0x370043,null));};exports['getConfigurations']=function(_0x18d42a,_0x160508,_0x30d593){var _0x2ee036={};var _0x2f8c72={};var _0x1baffd;var _0x406e68;return db['FreshsalesAccount'][_0xd43a('0x4e')]({'where':{'id':_0x18d42a['params']['id']}})[_0xd43a('0x29')](handleEntityNotFound(_0x160508,null))[_0xd43a('0x29')](function(_0x3eb69b){if(_0x3eb69b){_0x1baffd=_0x3eb69b;_0x2f8c72[_0xd43a('0x34')]=_[_0xd43a('0x35')](db[_0xd43a('0x4f')][_0xd43a('0x30')]);_0x2f8c72[_0xd43a('0x36')]=_[_0xd43a('0x35')](_0x18d42a[_0xd43a('0x36')]);_0x2f8c72['filters']=_[_0xd43a('0x39')](_0x2f8c72['model'],_0x2f8c72[_0xd43a('0x36')]);_0x2ee036[_0xd43a('0x38')]=_[_0xd43a('0x39')](_0x2f8c72[_0xd43a('0x34')],qs['fields'](_0x18d42a[_0xd43a('0x36')]['fields']));_0x2ee036[_0xd43a('0x38')]=_0x2ee036['attributes'][_0xd43a('0x3b')]?_0x2ee036[_0xd43a('0x38')]:_0x2f8c72[_0xd43a('0x34')];_0x2ee036[_0xd43a('0x50')]=qs['sort'](_0x18d42a['query'][_0xd43a('0x3d')]);_0x2ee036[_0xd43a('0x3e')]=qs[_0xd43a('0x37')](_[_0xd43a('0x3f')](_0x18d42a['query'],_0x2f8c72[_0xd43a('0x37')]));if(_0x18d42a[_0xd43a('0x36')]['filter']){_0x2ee036[_0xd43a('0x3e')]=_[_0xd43a('0x41')](_0x2ee036[_0xd43a('0x3e')],{'$or':_[_0xd43a('0x2e')](_0x2ee036[_0xd43a('0x38')],function(_0x1bff3f){var _0x34bfad={};_0x34bfad[_0x1bff3f]={'$like':'%'+_0x18d42a[_0xd43a('0x36')][_0xd43a('0x40')]+'%'};return _0x34bfad;})});}_0x2ee036=_[_0xd43a('0x41')]({},_0x2ee036,_0x18d42a[_0xd43a('0x42')]);return _0x1baffd['getConfigurations'](_0x2ee036);}})[_0xd43a('0x29')](function(_0x25d61f){if(_0x25d61f){_0x406e68=_0x25d61f[_0xd43a('0x3b')];if(!_0x18d42a[_0xd43a('0x36')]['hasOwnProperty']('nolimit')){_0x2ee036[_0xd43a('0x21')]=qs['limit'](_0x18d42a['query'][_0xd43a('0x21')]);_0x2ee036[_0xd43a('0x1f')]=qs[_0xd43a('0x1f')](_0x18d42a[_0xd43a('0x36')][_0xd43a('0x1f')]);}return _0x1baffd[_0xd43a('0x51')](_0x2ee036);}})[_0xd43a('0x29')](function(_0x1b2785){if(_0x1b2785){return _0x1b2785?{'count':_0x406e68,'rows':_0x1b2785}:null;}})[_0xd43a('0x29')](respondWithResult(_0x160508,null))[_0xd43a('0x4a')](handleError(_0x160508,null));};exports['addConfiguration']=function(_0xd07a37,_0x3b5aee,_0x54ac44){if(_0xd07a37[_0xd43a('0x4c')]['id']){delete _0xd07a37['body']['id'];}return db[_0xd43a('0x2f')][_0xd43a('0x4e')]({'where':{'id':_0xd07a37['params']['id']}})[_0xd43a('0x29')](handleEntityNotFound(_0x3b5aee,null))[_0xd43a('0x29')](function(_0x4d43d7){if(_0x4d43d7){_0xd07a37[_0xd43a('0x4c')][_0xd43a('0x52')]=_0x4d43d7['id'];_0xd07a37[_0xd43a('0x4c')][_0xd43a('0x53')]=integrations[_0xd43a('0x54')](_0xd07a37[_0xd43a('0x4c')][_0xd43a('0x55')],_0xd07a37[_0xd43a('0x4c')]['type']);_0xd07a37[_0xd43a('0x4c')][_0xd43a('0x56')]=integrations[_0xd43a('0x57')](_0xd07a37['body']['channel'],_0xd07a37[_0xd43a('0x4c')]['type']);return db[_0xd43a('0x4f')][_0xd43a('0x4b')](_0xd07a37[_0xd43a('0x4c')],{'include':[{'model':db[_0xd43a('0x58')],'as':_0xd43a('0x53')},{'model':db[_0xd43a('0x58')],'as':'Descriptions'}]});}return null;})[_0xd43a('0x29')](respondWithResult(_0x3b5aee,null))[_0xd43a('0x4a')](handleError(_0x3b5aee,null));};exports[_0xd43a('0x59')]=function(_0x31816e,_0x52eeb8,_0x3a419d){var _0x4276f3='';var _0x42cb7b='';return db[_0xd43a('0x2f')][_0xd43a('0x4e')]({'where':{'id':_0x31816e[_0xd43a('0x48')]['id']},'attributes':['id',_0xd43a('0x5a'),_0xd43a('0x5b'),'apiKey']})[_0xd43a('0x29')](handleEntityNotFound(_0x52eeb8,null))['then'](function(_0x3de30c){if(_0x3de30c){_0x42cb7b=_0x3de30c['username'];_0x4276f3=_0x3de30c[_0xd43a('0x5b')];var _0xcbd693=_0x3de30c[_0xd43a('0x5b')]['slice'](-0x1);if(_0xcbd693==='/'){_0x4276f3=_0x4276f3[_0xd43a('0x5c')](0x0,_0x4276f3[_0xd43a('0x5d')](_0xcbd693));}return rp({'method':_0xd43a('0x5e'),'uri':util[_0xd43a('0x5f')]('%s%s',_0x4276f3,_0xd43a('0x60')),'headers':{'Authorization':'Token\x20token='+_0x3de30c[_0xd43a('0x61')]},'json':!![]});}})[_0xd43a('0x29')](function(_0x3ed5bf){if(_0x3ed5bf){var _0x1afddf=_0x3ed5bf[_0xd43a('0x62')];var _0x2b3efa=![];var _0x104383=null;for(_0x104383=0x0;_0x104383<_0x1afddf[_0xd43a('0x3b')];_0x104383++){if(_0x1afddf[_0x104383][_0xd43a('0x63')]===_0x42cb7b){_0x2b3efa=!![];}}if(_0x2b3efa){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})['then'](respondWithResult(_0x52eeb8,null))[_0xd43a('0x4a')](function(_0x3b7cd4){var _0x26d101=_0x31816e['query'][_0xd43a('0x64')]?0x1f4:_0x3b7cd4[_0xd43a('0x65')]||0x1f4;logger[_0xd43a('0x2a')]('getFields,\x20%s,\x20%s,\x20%s',_0xd43a('0x59'),_0x26d101,JSON[_0xd43a('0x66')](_0x3b7cd4));delete _0x3b7cd4[_0xd43a('0x2b')];if(_0x26d101===0x191){_0x26d101=0x190;}_0x52eeb8[_0xd43a('0x1c')](_0x26d101)[_0xd43a('0x2c')](_0x31816e['query'][_0xd43a('0x64')]?{'message':_0xd43a('0x67'),'statusCode':_0x3b7cd4['statusCode']}:_0x3b7cd4);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index edd6181..461db2d 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 _0x7046=['lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define'];(function(_0x2a2dbf,_0x4f037c){var _0x2768e7=function(_0x5cbe80){while(--_0x5cbe80){_0x2a2dbf['push'](_0x2a2dbf['shift']());}};_0x2768e7(++_0x4f037c);}(_0x7046,0x144));var _0x6704=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x7046[_0xfae23b];return _0x200640;};'use strict';var _=require(_0x6704('0x0'));var util=require(_0x6704('0x1'));var logger=require(_0x6704('0x2'))(_0x6704('0x3'));var moment=require('moment');var BPromise=require(_0x6704('0x4'));var rp=require(_0x6704('0x5'));var fs=require('fs');var path=require(_0x6704('0x6'));var rimraf=require('rimraf');var config=require(_0x6704('0x7'));var attributes=require(_0x6704('0x8'));var integrations=require(_0x6704('0x9'));module[_0x6704('0xa')]=function(_0x2917be,_0x4badf8){return _0x2917be[_0x6704('0xb')]('FreshsalesAccount',attributes,{'tableName':'int_freshsales_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7ee1=['request-promise','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','FreshsalesAccount','lodash','moment','bluebird'];(function(_0x132886,_0x1b56cb){var _0x333c46=function(_0x28aa59){while(--_0x28aa59){_0x132886['push'](_0x132886['shift']());}};_0x333c46(++_0x1b56cb);}(_0x7ee1,0x8d));var _0x17ee=function(_0x2548c0,_0x5d9575){_0x2548c0=_0x2548c0-0x0;var _0x428bbd=_0x7ee1[_0x2548c0];return _0x428bbd;};'use strict';var _=require(_0x17ee('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x17ee('0x1'));var BPromise=require(_0x17ee('0x2'));var rp=require(_0x17ee('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x17ee('0x4'));var config=require(_0x17ee('0x5'));var attributes=require(_0x17ee('0x6'));var integrations=require(_0x17ee('0x7'));module['exports']=function(_0x52b1db,_0x29b9eb){return _0x52b1db['define'](_0x17ee('0x8'),attributes,{'tableName':'int_freshsales_accounts','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 ffe15a7..6364088 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 _0x781d=['model','map','GetFreshsalesAccount','find','ShowFreshsalesAccount','stringify','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','FreshsalesAccount,\x20%s,\x20%s','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','FreshsalesAccount','findAll','options','where','attributes','limit','include'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x781d,0x14a));var _0xd781=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x781d[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0xd781('0x0'));var util=require(_0xd781('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd781('0x2'));var fs=require('fs');var Redis=require(_0xd781('0x3'));var db=require(_0xd781('0x4'))['db'];var utils=require(_0xd781('0x5'));var logger=require(_0xd781('0x6'))(_0xd781('0x7'));var config=require(_0xd781('0x8'));var jayson=require(_0xd781('0x9'));var client=jayson[_0xd781('0xa')][_0xd781('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5a07f0,_0x133509,_0x1a242d){return new BPromise(function(_0x50610d,_0x248172){return client['request'](_0x5a07f0,_0x1a242d)[_0xd781('0xc')](function(_0x5c18c8){logger[_0xd781('0xd')](_0xd781('0xe'),_0x133509,'request\x20sent');logger[_0xd781('0xf')](_0xd781('0x10'),_0x133509,'request\x20sent',JSON['stringify'](_0x5c18c8));if(_0x5c18c8[_0xd781('0x11')]){if(_0x5c18c8[_0xd781('0x11')][_0xd781('0x12')]===0x1f4){logger[_0xd781('0x11')](_0xd781('0xe'),_0x133509,_0x5c18c8[_0xd781('0x11')][_0xd781('0x13')]);return _0x248172(_0x5c18c8[_0xd781('0x11')][_0xd781('0x13')]);}logger[_0xd781('0x11')](_0xd781('0xe'),_0x133509,_0x5c18c8['error'][_0xd781('0x13')]);return _0x50610d(_0x5c18c8[_0xd781('0x11')]['message']);}else{logger[_0xd781('0xd')]('FreshsalesAccount,\x20%s,\x20%s',_0x133509,_0xd781('0x14'));_0x50610d(_0x5c18c8[_0xd781('0x15')][_0xd781('0x13')]);}})[_0xd781('0x16')](function(_0x42a9c1){logger[_0xd781('0x11')](_0xd781('0xe'),_0x133509,_0x42a9c1);_0x248172(_0x42a9c1);});});}exports['GetFreshsalesAccount']=function(_0x1407fc){var _0x3f2922=this;return new Promise(function(_0x395d9c,_0x2f1273){return db[_0xd781('0x17')][_0xd781('0x18')]({'raw':_0x1407fc[_0xd781('0x19')]?_0x1407fc[_0xd781('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x1407fc[_0xd781('0x19')]?_0x1407fc[_0xd781('0x19')][_0xd781('0x1a')]||null:null,'attributes':_0x1407fc[_0xd781('0x19')]?_0x1407fc[_0xd781('0x19')][_0xd781('0x1b')]||null:null,'limit':_0x1407fc[_0xd781('0x19')]?_0x1407fc['options'][_0xd781('0x1c')]||null:null,'include':_0x1407fc['options']?_0x1407fc['options'][_0xd781('0x1d')]?_['map'](_0x1407fc[_0xd781('0x19')][_0xd781('0x1d')],function(_0x395087){return{'model':db[_0x395087[_0xd781('0x1e')]],'as':_0x395087['as'],'attributes':_0x395087[_0xd781('0x1b')],'include':_0x395087[_0xd781('0x1d')]?_[_0xd781('0x1f')](_0x395087[_0xd781('0x1d')],function(_0x10940b){return{'model':db[_0x10940b['model']],'as':_0x10940b['as'],'attributes':_0x10940b['attributes'],'include':_0x10940b[_0xd781('0x1d')]?_[_0xd781('0x1f')](_0x10940b[_0xd781('0x1d')],function(_0x57b41e){return{'model':db[_0x57b41e[_0xd781('0x1e')]],'as':_0x57b41e['as'],'attributes':_0x57b41e['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1e29c8){logger['info'](_0xd781('0x20'),_0x1407fc);logger[_0xd781('0xf')]('GetFreshsalesAccount',_0x1407fc,JSON['stringify'](_0x1e29c8));_0x395d9c(_0x1e29c8);})[_0xd781('0x16')](function(_0x5b0464){logger[_0xd781('0x11')]('GetFreshsalesAccount',_0x5b0464[_0xd781('0x13')],_0x1407fc);_0x2f1273(_0x3f2922[_0xd781('0x11')](0x1f4,_0x5b0464['message']));});});};exports['ShowFreshsalesAccount']=function(_0x432d14){var _0x29e81a=this;return new Promise(function(_0x1c7d83,_0x5a389c){return db['FreshsalesAccount'][_0xd781('0x21')]({'raw':_0x432d14[_0xd781('0x19')]?_0x432d14[_0xd781('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x432d14['options']?_0x432d14[_0xd781('0x19')][_0xd781('0x1a')]||null:null,'attributes':_0x432d14['options']?_0x432d14[_0xd781('0x19')][_0xd781('0x1b')]||null:null,'include':_0x432d14['options']?_0x432d14[_0xd781('0x19')][_0xd781('0x1d')]?_[_0xd781('0x1f')](_0x432d14[_0xd781('0x19')]['include'],function(_0x23dffb){return{'model':db[_0x23dffb[_0xd781('0x1e')]],'as':_0x23dffb['as'],'attributes':_0x23dffb[_0xd781('0x1b')],'include':_0x23dffb[_0xd781('0x1d')]?_['map'](_0x23dffb[_0xd781('0x1d')],function(_0x3f20e2){return{'model':db[_0x3f20e2['model']],'as':_0x3f20e2['as'],'attributes':_0x3f20e2[_0xd781('0x1b')],'include':_0x3f20e2['include']?_[_0xd781('0x1f')](_0x3f20e2[_0xd781('0x1d')],function(_0x57fdb6){return{'model':db[_0x57fdb6[_0xd781('0x1e')]],'as':_0x57fdb6['as'],'attributes':_0x57fdb6[_0xd781('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2a29b7){logger['info'](_0xd781('0x22'),_0x432d14);logger[_0xd781('0xf')]('ShowFreshsalesAccount',_0x432d14,JSON[_0xd781('0x23')](_0x2a29b7));_0x1c7d83(_0x2a29b7);})[_0xd781('0x16')](function(_0x5651de){logger[_0xd781('0x11')](_0xd781('0x22'),_0x5651de[_0xd781('0x13')],_0x432d14);_0x5a389c(_0x29e81a['error'](0x1f4,_0x5651de[_0xd781('0x13')]));});});}; \ No newline at end of file +var _0xfb11=['catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','where','include','map','model','attributes','debug','ShowFreshsalesAccount','lodash','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','client','http','request','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x16f46f,_0xf9b682){var _0x33c120=function(_0xb6e60f){while(--_0xb6e60f){_0x16f46f['push'](_0x16f46f['shift']());}};_0x33c120(++_0xf9b682);}(_0xfb11,0x1ad));var _0x1fb1=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xfb11[_0x4bfac3];return _0x15f0f2;};'use strict';var _=require(_0x1fb1('0x0'));var util=require('util');var moment=require(_0x1fb1('0x1'));var BPromise=require(_0x1fb1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1fb1('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1fb1('0x4'));var logger=require('../../config/logger')(_0x1fb1('0x5'));var config=require(_0x1fb1('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x1fb1('0x7')][_0x1fb1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4c098d,_0x1859da,_0x2596c2){return new BPromise(function(_0x34e61a,_0x236b20){return client[_0x1fb1('0x9')](_0x4c098d,_0x2596c2)[_0x1fb1('0xa')](function(_0x438d15){logger[_0x1fb1('0xb')](_0x1fb1('0xc'),_0x1859da,_0x1fb1('0xd'));logger['debug'](_0x1fb1('0xe'),_0x1859da,'request\x20sent',JSON[_0x1fb1('0xf')](_0x438d15));if(_0x438d15['error']){if(_0x438d15[_0x1fb1('0x10')][_0x1fb1('0x11')]===0x1f4){logger[_0x1fb1('0x10')](_0x1fb1('0xc'),_0x1859da,_0x438d15[_0x1fb1('0x10')][_0x1fb1('0x12')]);return _0x236b20(_0x438d15['error'][_0x1fb1('0x12')]);}logger[_0x1fb1('0x10')](_0x1fb1('0xc'),_0x1859da,_0x438d15[_0x1fb1('0x10')][_0x1fb1('0x12')]);return _0x34e61a(_0x438d15[_0x1fb1('0x10')][_0x1fb1('0x12')]);}else{logger[_0x1fb1('0xb')](_0x1fb1('0xc'),_0x1859da,'request\x20sent');_0x34e61a(_0x438d15['result'][_0x1fb1('0x12')]);}})[_0x1fb1('0x13')](function(_0x3924ab){logger['error'](_0x1fb1('0xc'),_0x1859da,_0x3924ab);_0x236b20(_0x3924ab);});});}exports[_0x1fb1('0x14')]=function(_0x24d4df){var _0x34076b=this;return new Promise(function(_0x33c6b6,_0x27d71f){return db[_0x1fb1('0x15')][_0x1fb1('0x16')]({'raw':_0x24d4df[_0x1fb1('0x17')]?_0x24d4df['options'][_0x1fb1('0x18')]===undefined?!![]:![]:!![],'where':_0x24d4df['options']?_0x24d4df['options'][_0x1fb1('0x19')]||null:null,'attributes':_0x24d4df[_0x1fb1('0x17')]?_0x24d4df[_0x1fb1('0x17')]['attributes']||null:null,'limit':_0x24d4df[_0x1fb1('0x17')]?_0x24d4df['options']['limit']||null:null,'include':_0x24d4df['options']?_0x24d4df[_0x1fb1('0x17')][_0x1fb1('0x1a')]?_[_0x1fb1('0x1b')](_0x24d4df[_0x1fb1('0x17')][_0x1fb1('0x1a')],function(_0x53b8af){return{'model':db[_0x53b8af[_0x1fb1('0x1c')]],'as':_0x53b8af['as'],'attributes':_0x53b8af[_0x1fb1('0x1d')],'include':_0x53b8af[_0x1fb1('0x1a')]?_[_0x1fb1('0x1b')](_0x53b8af[_0x1fb1('0x1a')],function(_0x1353a4){return{'model':db[_0x1353a4[_0x1fb1('0x1c')]],'as':_0x1353a4['as'],'attributes':_0x1353a4[_0x1fb1('0x1d')],'include':_0x1353a4['include']?_[_0x1fb1('0x1b')](_0x1353a4[_0x1fb1('0x1a')],function(_0x46ff60){return{'model':db[_0x46ff60[_0x1fb1('0x1c')]],'as':_0x46ff60['as'],'attributes':_0x46ff60[_0x1fb1('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x1fb1('0xa')](function(_0x1a74c4){logger[_0x1fb1('0xb')](_0x1fb1('0x14'),_0x24d4df);logger[_0x1fb1('0x1e')](_0x1fb1('0x14'),_0x24d4df,JSON[_0x1fb1('0xf')](_0x1a74c4));_0x33c6b6(_0x1a74c4);})[_0x1fb1('0x13')](function(_0xe8ec0a){logger[_0x1fb1('0x10')]('GetFreshsalesAccount',_0xe8ec0a[_0x1fb1('0x12')],_0x24d4df);_0x27d71f(_0x34076b[_0x1fb1('0x10')](0x1f4,_0xe8ec0a[_0x1fb1('0x12')]));});});};exports[_0x1fb1('0x1f')]=function(_0x5402e9){var _0x245f84=this;return new Promise(function(_0x30c8eb,_0x5d45a5){return db[_0x1fb1('0x15')]['find']({'raw':_0x5402e9['options']?_0x5402e9[_0x1fb1('0x17')][_0x1fb1('0x18')]===undefined?!![]:![]:!![],'where':_0x5402e9['options']?_0x5402e9[_0x1fb1('0x17')][_0x1fb1('0x19')]||null:null,'attributes':_0x5402e9[_0x1fb1('0x17')]?_0x5402e9[_0x1fb1('0x17')][_0x1fb1('0x1d')]||null:null,'include':_0x5402e9['options']?_0x5402e9[_0x1fb1('0x17')][_0x1fb1('0x1a')]?_[_0x1fb1('0x1b')](_0x5402e9[_0x1fb1('0x17')][_0x1fb1('0x1a')],function(_0x307700){return{'model':db[_0x307700[_0x1fb1('0x1c')]],'as':_0x307700['as'],'attributes':_0x307700[_0x1fb1('0x1d')],'include':_0x307700[_0x1fb1('0x1a')]?_['map'](_0x307700[_0x1fb1('0x1a')],function(_0x4b4271){return{'model':db[_0x4b4271[_0x1fb1('0x1c')]],'as':_0x4b4271['as'],'attributes':_0x4b4271['attributes'],'include':_0x4b4271[_0x1fb1('0x1a')]?_['map'](_0x4b4271['include'],function(_0x25ac36){return{'model':db[_0x25ac36[_0x1fb1('0x1c')]],'as':_0x25ac36['as'],'attributes':_0x25ac36[_0x1fb1('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x1fb1('0xa')](function(_0x564ed9){logger[_0x1fb1('0xb')](_0x1fb1('0x1f'),_0x5402e9);logger[_0x1fb1('0x1e')]('ShowFreshsalesAccount',_0x5402e9,JSON[_0x1fb1('0xf')](_0x564ed9));_0x30c8eb(_0x564ed9);})[_0x1fb1('0x13')](function(_0x228235){logger[_0x1fb1('0x10')](_0x1fb1('0x1f'),_0x228235[_0x1fb1('0x12')],_0x5402e9);_0x5d45a5(_0x245f84[_0x1fb1('0x10')](0x1f4,_0x228235['message']));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index e5e052d..520c105 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 _0x1a3c=['multer','path','express','Router','fs-extra','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id','/:id/subjects','getSubjects','getDescriptions','/:id/fields','getFields','post','create','put','update','delete','destroy','exports'];(function(_0x4cf765,_0xc7a6bf){var _0x473760=function(_0x2d501d){while(--_0x2d501d){_0x4cf765['push'](_0x4cf765['shift']());}};_0x473760(++_0xc7a6bf);}(_0x1a3c,0x18c));var _0xc1a3=function(_0x2dab5a,_0x1e6b8d){_0x2dab5a=_0x2dab5a-0x0;var _0x3251bd=_0x1a3c[_0x2dab5a];return _0x3251bd;};'use strict';var multer=require(_0xc1a3('0x0'));var util=require('util');var path=require(_0xc1a3('0x1'));var timeout=require('connect-timeout');var express=require(_0xc1a3('0x2'));var router=express[_0xc1a3('0x3')]();var fs_extra=require(_0xc1a3('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xc1a3('0x5'));router[_0xc1a3('0x6')]('/',auth[_0xc1a3('0x7')](),controller[_0xc1a3('0x8')]);router['get'](_0xc1a3('0x9'),auth[_0xc1a3('0x7')](),controller['show']);router[_0xc1a3('0x6')](_0xc1a3('0xa'),auth['isAuthenticated'](),controller[_0xc1a3('0xb')]);router[_0xc1a3('0x6')]('/:id/descriptions',auth[_0xc1a3('0x7')](),controller[_0xc1a3('0xc')]);router[_0xc1a3('0x6')](_0xc1a3('0xd'),auth['isAuthenticated'](),controller[_0xc1a3('0xe')]);router[_0xc1a3('0xf')]('/',auth[_0xc1a3('0x7')](),controller[_0xc1a3('0x10')]);router[_0xc1a3('0x11')](_0xc1a3('0x9'),auth[_0xc1a3('0x7')](),controller[_0xc1a3('0x12')]);router[_0xc1a3('0x13')](_0xc1a3('0x9'),auth['isAuthenticated'](),controller[_0xc1a3('0x14')]);module[_0xc1a3('0x15')]=router; \ No newline at end of file +var _0xbb20=['/:id','show','/:id/subjects','getSubjects','getDescriptions','/:id/fields','getFields','post','put','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','index'];(function(_0x3f064d,_0x399a17){var _0x1ede9e=function(_0xaa4b98){while(--_0xaa4b98){_0x3f064d['push'](_0x3f064d['shift']());}};_0x1ede9e(++_0x399a17);}(_0xbb20,0x108));var _0x0bb2=function(_0x9cef1f,_0x4dcd48){_0x9cef1f=_0x9cef1f-0x0;var _0x48a2b4=_0xbb20[_0x9cef1f];return _0x48a2b4;};'use strict';var multer=require(_0x0bb2('0x0'));var util=require(_0x0bb2('0x1'));var path=require('path');var timeout=require(_0x0bb2('0x2'));var express=require(_0x0bb2('0x3'));var router=express[_0x0bb2('0x4')]();var fs_extra=require(_0x0bb2('0x5'));var auth=require(_0x0bb2('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x0bb2('0x7'));var controller=require(_0x0bb2('0x8'));router[_0x0bb2('0x9')]('/',auth[_0x0bb2('0xa')](),controller[_0x0bb2('0xb')]);router[_0x0bb2('0x9')](_0x0bb2('0xc'),auth[_0x0bb2('0xa')](),controller[_0x0bb2('0xd')]);router['get'](_0x0bb2('0xe'),auth['isAuthenticated'](),controller[_0x0bb2('0xf')]);router['get']('/:id/descriptions',auth[_0x0bb2('0xa')](),controller[_0x0bb2('0x10')]);router['get'](_0x0bb2('0x11'),auth[_0x0bb2('0xa')](),controller[_0x0bb2('0x12')]);router[_0x0bb2('0x13')]('/',auth[_0x0bb2('0xa')](),controller['create']);router[_0x0bb2('0x14')](_0x0bb2('0xc'),auth[_0x0bb2('0xa')](),controller['update']);router['delete']('/:id',auth[_0x0bb2('0xa')](),controller[_0x0bb2('0x15')]);module[_0x0bb2('0x16')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 7daeb4c..c717b2f 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 _0x82e8=['STRING','sequelize'];(function(_0x5a339d,_0x1e01ed){var _0x32ecc2=function(_0x7fc0c){while(--_0x7fc0c){_0x5a339d['push'](_0x5a339d['shift']());}};_0x32ecc2(++_0x1e01ed);}(_0x82e8,0x141));var _0x882e=function(_0x10df18,_0x13338c){_0x10df18=_0x10df18-0x0;var _0x1f9a1d=_0x82e8[_0x10df18];return _0x1f9a1d;};'use strict';var Sequelize=require(_0x882e('0x0'));module['exports']={'name':{'type':Sequelize[_0x882e('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x498e=['sequelize','exports','STRING'];(function(_0x5b1df3,_0x5e2ec1){var _0xdc412e=function(_0x10236b){while(--_0x10236b){_0x5b1df3['push'](_0x5b1df3['shift']());}};_0xdc412e(++_0x5e2ec1);}(_0x498e,0x18f));var _0xe498=function(_0x1fd33f,_0x166ef6){_0x1fd33f=_0x1fd33f-0x0;var _0x29c82f=_0x498e[_0x1fd33f];return _0x29c82f;};'use strict';var Sequelize=require(_0xe498('0x0'));module[_0xe498('0x1')]={'name':{'type':Sequelize[_0xe498('0x2')]},'description':{'type':Sequelize[_0xe498('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 14ab384..232ab2b 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 _0xb3a1=['mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','sendStatus','stack','send','index','FreshsalesConfiguration','rawAttributes','type','key','model','map','name','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','length','find','create','body','catch','getSubjects','FreshsalesField','getDescriptions','findOne','order','getFields','rimraf','fast-json-patch','request-promise','moment','bluebird'];(function(_0x447550,_0x477c3b){var _0x50ce12=function(_0x1941da){while(--_0x1941da){_0x447550['push'](_0x447550['shift']());}};_0x50ce12(++_0x477c3b);}(_0xb3a1,0xf7));var _0x1b3a=function(_0x25d0c9,_0x593a72){_0x25d0c9=_0x25d0c9-0x0;var _0x30bc7c=_0xb3a1[_0x25d0c9];return _0x30bc7c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1b3a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1b3a('0x1'));var rp=require(_0x1b3a('0x2'));var moment=require(_0x1b3a('0x3'));var BPromise=require(_0x1b3a('0x4'));var Mustache=require(_0x1b3a('0x5'));var util=require(_0x1b3a('0x6'));var path=require(_0x1b3a('0x7'));var sox=require(_0x1b3a('0x8'));var csv=require('to-csv');var ejs=require(_0x1b3a('0x9'));var fs=require('fs');var fs_extra=require(_0x1b3a('0xa'));var _=require(_0x1b3a('0xb'));var squel=require(_0x1b3a('0xc'));var crypto=require(_0x1b3a('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x1b3a('0xe'));var toCsv=require(_0x1b3a('0xf'));var querystring=require(_0x1b3a('0x10'));var Papa=require(_0x1b3a('0x11'));var Redis=require(_0x1b3a('0x12'));var authService=require(_0x1b3a('0x13'));var qs=require(_0x1b3a('0x14'));var as=require(_0x1b3a('0x15'));var hardwareService=require(_0x1b3a('0x16'));var logger=require(_0x1b3a('0x17'))(_0x1b3a('0x18'));var utils=require(_0x1b3a('0x19'));var config=require(_0x1b3a('0x1a'));var licenseUtil=require(_0x1b3a('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x532d5c,_0x170132){_0x170132=_0x170132||0xcc;return function(_0x23d61d){if(_0x23d61d){return _0x532d5c['sendStatus'](_0x170132);}return _0x532d5c[_0x1b3a('0x1c')](_0x170132)[_0x1b3a('0x1d')]();};}function respondWithResult(_0xa90d12,_0x3730bf){_0x3730bf=_0x3730bf||0xc8;return function(_0x241fac){if(_0x241fac){return _0xa90d12[_0x1b3a('0x1c')](_0x3730bf)[_0x1b3a('0x1e')](_0x241fac);}};}function respondWithFilteredResult(_0x4bf76f,_0x31f92f){return function(_0x2176ca){if(_0x2176ca){var _0x5f4792=typeof _0x31f92f[_0x1b3a('0x1f')]===_0x1b3a('0x20')&&typeof _0x31f92f['limit']===_0x1b3a('0x20');var _0x3942f1=_0x2176ca[_0x1b3a('0x21')];var _0x10df94=_0x5f4792?0x0:_0x31f92f[_0x1b3a('0x1f')];var _0x1969aa=_0x5f4792?_0x2176ca['count']:_0x31f92f[_0x1b3a('0x1f')]+_0x31f92f[_0x1b3a('0x22')];var _0x314825;if(_0x1969aa>=_0x3942f1){_0x1969aa=_0x3942f1;_0x314825=0xc8;}else{_0x314825=0xce;}_0x4bf76f[_0x1b3a('0x1c')](_0x314825);return _0x4bf76f[_0x1b3a('0x23')](_0x1b3a('0x24'),_0x10df94+'-'+_0x1969aa+'/'+_0x3942f1)[_0x1b3a('0x1e')](_0x2176ca);}return null;};}function patchUpdates(_0x45bfd){return function(_0x1b4d7b){try{jsonpatch[_0x1b3a('0x25')](_0x1b4d7b,_0x45bfd,!![]);}catch(_0x5d89cd){return BPromise[_0x1b3a('0x26')](_0x5d89cd);}return _0x1b4d7b['save']();};}function saveUpdates(_0x863be3,_0x3538c5){return function(_0x43565e){if(_0x43565e){return _0x43565e[_0x1b3a('0x27')](_0x863be3)[_0x1b3a('0x28')](function(_0x4608ab){return _0x4608ab;});}return null;};}function removeEntity(_0x1dc761,_0x21caa9){return function(_0x4d9c3e){if(_0x4d9c3e){return _0x4d9c3e[_0x1b3a('0x29')]()[_0x1b3a('0x28')](function(){_0x1dc761['status'](0xcc)[_0x1b3a('0x1d')]();});}};}function handleEntityNotFound(_0x5e8753,_0x3db572){return function(_0x1ad0ec){if(!_0x1ad0ec){_0x5e8753[_0x1b3a('0x2a')](0x194);}return _0x1ad0ec;};}function handleError(_0x6ed510,_0x527754){_0x527754=_0x527754||0x1f4;return function(_0x1c33f7){logger['error'](_0x1c33f7[_0x1b3a('0x2b')]);if(_0x1c33f7['name']){delete _0x1c33f7['name'];}_0x6ed510['status'](_0x527754)[_0x1b3a('0x2c')](_0x1c33f7);};}exports[_0x1b3a('0x2d')]=function(_0x368a6a,_0x481876){var _0xecb37c={},_0x5122f5={},_0x4a6445={'count':0x0,'rows':[]};var _0x4db46c=_['map'](db[_0x1b3a('0x2e')][_0x1b3a('0x2f')],function(_0x2e82fa){return{'name':_0x2e82fa['fieldName'],'type':_0x2e82fa[_0x1b3a('0x30')][_0x1b3a('0x31')]};});_0x5122f5[_0x1b3a('0x32')]=_[_0x1b3a('0x33')](_0x4db46c,_0x1b3a('0x34'));_0x5122f5[_0x1b3a('0x35')]=_[_0x1b3a('0x36')](_0x368a6a['query']);_0x5122f5[_0x1b3a('0x37')]=_[_0x1b3a('0x38')](_0x5122f5[_0x1b3a('0x32')],_0x5122f5[_0x1b3a('0x35')]);_0xecb37c['attributes']=_[_0x1b3a('0x38')](_0x5122f5['model'],qs[_0x1b3a('0x39')](_0x368a6a[_0x1b3a('0x35')][_0x1b3a('0x39')]));_0xecb37c[_0x1b3a('0x3a')]=_0xecb37c[_0x1b3a('0x3a')]['length']?_0xecb37c['attributes']:_0x5122f5[_0x1b3a('0x32')];if(!_0x368a6a['query'][_0x1b3a('0x3b')](_0x1b3a('0x3c'))){_0xecb37c['limit']=qs[_0x1b3a('0x22')](_0x368a6a[_0x1b3a('0x35')][_0x1b3a('0x22')]);_0xecb37c['offset']=qs[_0x1b3a('0x1f')](_0x368a6a[_0x1b3a('0x35')][_0x1b3a('0x1f')]);}_0xecb37c['order']=qs[_0x1b3a('0x3d')](_0x368a6a['query'][_0x1b3a('0x3d')]);_0xecb37c[_0x1b3a('0x3e')]=qs['filters'](_[_0x1b3a('0x3f')](_0x368a6a[_0x1b3a('0x35')],_0x5122f5[_0x1b3a('0x37')]),_0x4db46c);if(_0x368a6a[_0x1b3a('0x35')][_0x1b3a('0x40')]){_0xecb37c[_0x1b3a('0x3e')]=_[_0x1b3a('0x41')](_0xecb37c[_0x1b3a('0x3e')],{'$or':_[_0x1b3a('0x33')](_0x4db46c,function(_0x2d8564){if(_0x2d8564[_0x1b3a('0x30')]!==_0x1b3a('0x42')){var _0x38867a={};_0x38867a[_0x2d8564[_0x1b3a('0x34')]]={'$like':'%'+_0x368a6a['query'][_0x1b3a('0x40')]+'%'};return _0x38867a;}})});}_0xecb37c=_[_0x1b3a('0x41')]({},_0xecb37c,_0x368a6a[_0x1b3a('0x43')]);var _0x89c8ef={'where':_0xecb37c['where']};return db['FreshsalesConfiguration'][_0x1b3a('0x21')](_0x89c8ef)[_0x1b3a('0x28')](function(_0x109deb){_0x4a6445[_0x1b3a('0x21')]=_0x109deb;if(_0x368a6a[_0x1b3a('0x35')]['includeAll']){_0xecb37c[_0x1b3a('0x44')]=[{'all':!![]}];}return db[_0x1b3a('0x2e')][_0x1b3a('0x45')](_0xecb37c);})[_0x1b3a('0x28')](function(_0x42c88d){_0x4a6445[_0x1b3a('0x46')]=_0x42c88d;return _0x4a6445;})[_0x1b3a('0x28')](respondWithFilteredResult(_0x481876,_0xecb37c))['catch'](handleError(_0x481876,null));};exports[_0x1b3a('0x47')]=function(_0x1fc4fe,_0x3969ec){var _0x1e6d1b={'raw':![],'where':{'id':_0x1fc4fe[_0x1b3a('0x48')]['id']}},_0x3291e4={};_0x3291e4[_0x1b3a('0x32')]=_[_0x1b3a('0x36')](db[_0x1b3a('0x2e')]['rawAttributes']);_0x3291e4[_0x1b3a('0x35')]=_[_0x1b3a('0x36')](_0x1fc4fe[_0x1b3a('0x35')]);_0x3291e4[_0x1b3a('0x37')]=_[_0x1b3a('0x38')](_0x3291e4[_0x1b3a('0x32')],_0x3291e4[_0x1b3a('0x35')]);_0x1e6d1b[_0x1b3a('0x3a')]=_[_0x1b3a('0x38')](_0x3291e4[_0x1b3a('0x32')],qs[_0x1b3a('0x39')](_0x1fc4fe[_0x1b3a('0x35')]['fields']));_0x1e6d1b[_0x1b3a('0x3a')]=_0x1e6d1b[_0x1b3a('0x3a')][_0x1b3a('0x49')]?_0x1e6d1b[_0x1b3a('0x3a')]:_0x3291e4[_0x1b3a('0x32')];if(_0x1fc4fe[_0x1b3a('0x35')]['includeAll']){_0x1e6d1b[_0x1b3a('0x44')]=[{'all':!![]}];}_0x1e6d1b=_[_0x1b3a('0x41')]({},_0x1e6d1b,_0x1fc4fe['options']);return db[_0x1b3a('0x2e')][_0x1b3a('0x4a')](_0x1e6d1b)[_0x1b3a('0x28')](handleEntityNotFound(_0x3969ec,null))[_0x1b3a('0x28')](respondWithResult(_0x3969ec,null))['catch'](handleError(_0x3969ec,null));};exports[_0x1b3a('0x4b')]=function(_0x21e361,_0x37757a){return db[_0x1b3a('0x2e')][_0x1b3a('0x4b')](_0x21e361[_0x1b3a('0x4c')],{})[_0x1b3a('0x28')](respondWithResult(_0x37757a,0xc9))[_0x1b3a('0x4d')](handleError(_0x37757a,null));};exports[_0x1b3a('0x27')]=function(_0x17fcd8,_0x1965ac){if(_0x17fcd8['body']['id']){delete _0x17fcd8[_0x1b3a('0x4c')]['id'];}return db[_0x1b3a('0x2e')]['find']({'where':{'id':_0x17fcd8[_0x1b3a('0x48')]['id']}})[_0x1b3a('0x28')](handleEntityNotFound(_0x1965ac,null))[_0x1b3a('0x28')](saveUpdates(_0x17fcd8[_0x1b3a('0x4c')],null))['then'](respondWithResult(_0x1965ac,null))[_0x1b3a('0x4d')](handleError(_0x1965ac,null));};exports[_0x1b3a('0x29')]=function(_0x21a309,_0x4ca00e){return db[_0x1b3a('0x2e')][_0x1b3a('0x4a')]({'where':{'id':_0x21a309['params']['id']}})['then'](handleEntityNotFound(_0x4ca00e,null))[_0x1b3a('0x28')](removeEntity(_0x4ca00e,null))[_0x1b3a('0x4d')](handleError(_0x4ca00e,null));};exports[_0x1b3a('0x4e')]=function(_0x16061f,_0xfa9c8e,_0x40971c){var _0x1e0ae4={};var _0x3d53a7={};var _0x3792ab;var _0x49865f;return db[_0x1b3a('0x2e')]['findOne']({'where':{'id':_0x16061f[_0x1b3a('0x48')]['id']}})['then'](handleEntityNotFound(_0xfa9c8e,null))[_0x1b3a('0x28')](function(_0x5bbb18){if(_0x5bbb18){_0x3792ab=_0x5bbb18;_0x3d53a7[_0x1b3a('0x32')]=_[_0x1b3a('0x36')](db[_0x1b3a('0x4f')][_0x1b3a('0x2f')]);_0x3d53a7[_0x1b3a('0x35')]=_['keys'](_0x16061f['query']);_0x3d53a7[_0x1b3a('0x37')]=_['intersection'](_0x3d53a7[_0x1b3a('0x32')],_0x3d53a7['query']);_0x1e0ae4['attributes']=_[_0x1b3a('0x38')](_0x3d53a7[_0x1b3a('0x32')],qs[_0x1b3a('0x39')](_0x16061f[_0x1b3a('0x35')][_0x1b3a('0x39')]));_0x1e0ae4['attributes']=_0x1e0ae4[_0x1b3a('0x3a')][_0x1b3a('0x49')]?_0x1e0ae4[_0x1b3a('0x3a')]:_0x3d53a7[_0x1b3a('0x32')];_0x1e0ae4['order']=qs[_0x1b3a('0x3d')](_0x16061f[_0x1b3a('0x35')][_0x1b3a('0x3d')]);_0x1e0ae4[_0x1b3a('0x3e')]=qs['filters'](_[_0x1b3a('0x3f')](_0x16061f[_0x1b3a('0x35')],_0x3d53a7['filters']));if(_0x16061f[_0x1b3a('0x35')][_0x1b3a('0x40')]){_0x1e0ae4['where']=_[_0x1b3a('0x41')](_0x1e0ae4['where'],{'$or':_[_0x1b3a('0x33')](_0x1e0ae4['attributes'],function(_0x292b22){var _0x19fc58={};_0x19fc58[_0x292b22]={'$like':'%'+_0x16061f[_0x1b3a('0x35')][_0x1b3a('0x40')]+'%'};return _0x19fc58;})});}_0x1e0ae4=_[_0x1b3a('0x41')]({},_0x1e0ae4,_0x16061f[_0x1b3a('0x43')]);return _0x3792ab[_0x1b3a('0x4e')](_0x1e0ae4);}})[_0x1b3a('0x28')](function(_0x1c52e6){if(_0x1c52e6){_0x49865f=_0x1c52e6[_0x1b3a('0x49')];if(!_0x16061f[_0x1b3a('0x35')][_0x1b3a('0x3b')](_0x1b3a('0x3c'))){_0x1e0ae4[_0x1b3a('0x22')]=qs[_0x1b3a('0x22')](_0x16061f[_0x1b3a('0x35')][_0x1b3a('0x22')]);_0x1e0ae4[_0x1b3a('0x1f')]=qs[_0x1b3a('0x1f')](_0x16061f[_0x1b3a('0x35')]['offset']);}return _0x3792ab[_0x1b3a('0x4e')](_0x1e0ae4);}})[_0x1b3a('0x28')](function(_0x500eed){if(_0x500eed){return _0x500eed?{'count':_0x49865f,'rows':_0x500eed}:null;}})[_0x1b3a('0x28')](respondWithResult(_0xfa9c8e,null))['catch'](handleError(_0xfa9c8e,null));};exports[_0x1b3a('0x50')]=function(_0x172e5c,_0x1417be,_0x587639){var _0x3ae68c={};var _0x469f7c={};var _0x37a871;var _0x1b744d;return db[_0x1b3a('0x2e')][_0x1b3a('0x51')]({'where':{'id':_0x172e5c[_0x1b3a('0x48')]['id']}})[_0x1b3a('0x28')](handleEntityNotFound(_0x1417be,null))[_0x1b3a('0x28')](function(_0x27178b){if(_0x27178b){_0x37a871=_0x27178b;_0x469f7c[_0x1b3a('0x32')]=_[_0x1b3a('0x36')](db['FreshsalesField'][_0x1b3a('0x2f')]);_0x469f7c[_0x1b3a('0x35')]=_[_0x1b3a('0x36')](_0x172e5c['query']);_0x469f7c[_0x1b3a('0x37')]=_['intersection'](_0x469f7c['model'],_0x469f7c[_0x1b3a('0x35')]);_0x3ae68c[_0x1b3a('0x3a')]=_[_0x1b3a('0x38')](_0x469f7c[_0x1b3a('0x32')],qs['fields'](_0x172e5c[_0x1b3a('0x35')][_0x1b3a('0x39')]));_0x3ae68c[_0x1b3a('0x3a')]=_0x3ae68c[_0x1b3a('0x3a')]['length']?_0x3ae68c[_0x1b3a('0x3a')]:_0x469f7c[_0x1b3a('0x32')];_0x3ae68c[_0x1b3a('0x52')]=qs[_0x1b3a('0x3d')](_0x172e5c[_0x1b3a('0x35')][_0x1b3a('0x3d')]);_0x3ae68c['where']=qs['filters'](_[_0x1b3a('0x3f')](_0x172e5c[_0x1b3a('0x35')],_0x469f7c[_0x1b3a('0x37')]));if(_0x172e5c[_0x1b3a('0x35')][_0x1b3a('0x40')]){_0x3ae68c[_0x1b3a('0x3e')]=_[_0x1b3a('0x41')](_0x3ae68c[_0x1b3a('0x3e')],{'$or':_[_0x1b3a('0x33')](_0x3ae68c[_0x1b3a('0x3a')],function(_0x570ff5){var _0x19b1ad={};_0x19b1ad[_0x570ff5]={'$like':'%'+_0x172e5c[_0x1b3a('0x35')][_0x1b3a('0x40')]+'%'};return _0x19b1ad;})});}_0x3ae68c=_[_0x1b3a('0x41')]({},_0x3ae68c,_0x172e5c[_0x1b3a('0x43')]);return _0x37a871['getDescriptions'](_0x3ae68c);}})[_0x1b3a('0x28')](function(_0x2fea74){if(_0x2fea74){_0x1b744d=_0x2fea74[_0x1b3a('0x49')];if(!_0x172e5c[_0x1b3a('0x35')][_0x1b3a('0x3b')](_0x1b3a('0x3c'))){_0x3ae68c[_0x1b3a('0x22')]=qs[_0x1b3a('0x22')](_0x172e5c['query'][_0x1b3a('0x22')]);_0x3ae68c['offset']=qs[_0x1b3a('0x1f')](_0x172e5c['query']['offset']);}return _0x37a871['getDescriptions'](_0x3ae68c);}})[_0x1b3a('0x28')](function(_0x507255){if(_0x507255){return _0x507255?{'count':_0x1b744d,'rows':_0x507255}:null;}})[_0x1b3a('0x28')](respondWithResult(_0x1417be,null))['catch'](handleError(_0x1417be,null));};exports[_0x1b3a('0x53')]=function(_0x4d8398,_0x34380c,_0x1cef4a){var _0x214f43={};var _0x218486={};var _0x33b4e9;var _0x3673d9;return db[_0x1b3a('0x2e')][_0x1b3a('0x51')]({'where':{'id':_0x4d8398[_0x1b3a('0x48')]['id']}})[_0x1b3a('0x28')](handleEntityNotFound(_0x34380c,null))[_0x1b3a('0x28')](function(_0x29226c){if(_0x29226c){_0x33b4e9=_0x29226c;_0x218486[_0x1b3a('0x32')]=_['keys'](db[_0x1b3a('0x4f')]['rawAttributes']);_0x218486[_0x1b3a('0x35')]=_[_0x1b3a('0x36')](_0x4d8398[_0x1b3a('0x35')]);_0x218486[_0x1b3a('0x37')]=_['intersection'](_0x218486[_0x1b3a('0x32')],_0x218486[_0x1b3a('0x35')]);_0x214f43[_0x1b3a('0x3a')]=_['intersection'](_0x218486['model'],qs[_0x1b3a('0x39')](_0x4d8398[_0x1b3a('0x35')][_0x1b3a('0x39')]));_0x214f43[_0x1b3a('0x3a')]=_0x214f43[_0x1b3a('0x3a')]['length']?_0x214f43[_0x1b3a('0x3a')]:_0x218486[_0x1b3a('0x32')];_0x214f43[_0x1b3a('0x52')]=qs['sort'](_0x4d8398[_0x1b3a('0x35')][_0x1b3a('0x3d')]);_0x214f43[_0x1b3a('0x3e')]=qs[_0x1b3a('0x37')](_[_0x1b3a('0x3f')](_0x4d8398[_0x1b3a('0x35')],_0x218486[_0x1b3a('0x37')]));if(_0x4d8398[_0x1b3a('0x35')][_0x1b3a('0x40')]){_0x214f43[_0x1b3a('0x3e')]=_['merge'](_0x214f43[_0x1b3a('0x3e')],{'$or':_['map'](_0x214f43[_0x1b3a('0x3a')],function(_0xf44daa){var _0xd33423={};_0xd33423[_0xf44daa]={'$like':'%'+_0x4d8398[_0x1b3a('0x35')][_0x1b3a('0x40')]+'%'};return _0xd33423;})});}_0x214f43=_[_0x1b3a('0x41')]({},_0x214f43,_0x4d8398['options']);return _0x33b4e9[_0x1b3a('0x53')](_0x214f43);}})[_0x1b3a('0x28')](function(_0x344f84){if(_0x344f84){_0x3673d9=_0x344f84[_0x1b3a('0x49')];if(!_0x4d8398[_0x1b3a('0x35')][_0x1b3a('0x3b')](_0x1b3a('0x3c'))){_0x214f43[_0x1b3a('0x22')]=qs['limit'](_0x4d8398[_0x1b3a('0x35')][_0x1b3a('0x22')]);_0x214f43[_0x1b3a('0x1f')]=qs[_0x1b3a('0x1f')](_0x4d8398[_0x1b3a('0x35')]['offset']);}return _0x33b4e9[_0x1b3a('0x53')](_0x214f43);}})[_0x1b3a('0x28')](function(_0x40b8b5){if(_0x40b8b5){return _0x40b8b5?{'count':_0x3673d9,'rows':_0x40b8b5}:null;}})['then'](respondWithResult(_0x34380c,null))['catch'](handleError(_0x34380c,null));}; \ No newline at end of file +var _0xa24a=['getSubjects','findOne','FreshsalesField','order','hasOwnProperty','getDescriptions','getFields','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','FreshsalesConfiguration','catch','show','params','length','include','find','create','body'];(function(_0x8df7da,_0x496482){var _0x48ecb1=function(_0x2b3a58){while(--_0x2b3a58){_0x8df7da['push'](_0x8df7da['shift']());}};_0x48ecb1(++_0x496482);}(_0xa24a,0xfa));var _0xaa24=function(_0x2ae16f,_0x18c9f0){_0x2ae16f=_0x2ae16f-0x0;var _0x21dfb2=_0xa24a[_0x2ae16f];return _0x21dfb2;};'use strict';var emlformat=require(_0xaa24('0x0'));var rimraf=require(_0xaa24('0x1'));var zipdir=require(_0xaa24('0x2'));var jsonpatch=require(_0xaa24('0x3'));var rp=require(_0xaa24('0x4'));var moment=require('moment');var BPromise=require(_0xaa24('0x5'));var Mustache=require(_0xaa24('0x6'));var util=require(_0xaa24('0x7'));var path=require(_0xaa24('0x8'));var sox=require('sox');var csv=require(_0xaa24('0x9'));var ejs=require(_0xaa24('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xaa24('0xb'));var squel=require(_0xaa24('0xc'));var crypto=require(_0xaa24('0xd'));var jsforce=require(_0xaa24('0xe'));var deskjs=require(_0xaa24('0xf'));var toCsv=require(_0xaa24('0x9'));var querystring=require(_0xaa24('0x10'));var Papa=require(_0xaa24('0x11'));var Redis=require(_0xaa24('0x12'));var authService=require(_0xaa24('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xaa24('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xaa24('0x15'))(_0xaa24('0x16'));var utils=require(_0xaa24('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xaa24('0x18'));var db=require(_0xaa24('0x19'))['db'];function respondWithStatusCode(_0x18353f,_0xad2650){_0xad2650=_0xad2650||0xcc;return function(_0x220ee){if(_0x220ee){return _0x18353f[_0xaa24('0x1a')](_0xad2650);}return _0x18353f['status'](_0xad2650)[_0xaa24('0x1b')]();};}function respondWithResult(_0x5b7307,_0x3dd837){_0x3dd837=_0x3dd837||0xc8;return function(_0x344056){if(_0x344056){return _0x5b7307[_0xaa24('0x1c')](_0x3dd837)[_0xaa24('0x1d')](_0x344056);}};}function respondWithFilteredResult(_0x380199,_0x512bb2){return function(_0xc67898){if(_0xc67898){var _0x130b40=typeof _0x512bb2[_0xaa24('0x1e')]===_0xaa24('0x1f')&&typeof _0x512bb2['limit']===_0xaa24('0x1f');var _0x335465=_0xc67898[_0xaa24('0x20')];var _0x51723d=_0x130b40?0x0:_0x512bb2[_0xaa24('0x1e')];var _0x58b917=_0x130b40?_0xc67898[_0xaa24('0x20')]:_0x512bb2[_0xaa24('0x1e')]+_0x512bb2[_0xaa24('0x21')];var _0x2fc385;if(_0x58b917>=_0x335465){_0x58b917=_0x335465;_0x2fc385=0xc8;}else{_0x2fc385=0xce;}_0x380199[_0xaa24('0x1c')](_0x2fc385);return _0x380199[_0xaa24('0x22')](_0xaa24('0x23'),_0x51723d+'-'+_0x58b917+'/'+_0x335465)[_0xaa24('0x1d')](_0xc67898);}return null;};}function patchUpdates(_0x9611bf){return function(_0x11f0e9){try{jsonpatch['apply'](_0x11f0e9,_0x9611bf,!![]);}catch(_0x3e9203){return BPromise[_0xaa24('0x24')](_0x3e9203);}return _0x11f0e9[_0xaa24('0x25')]();};}function saveUpdates(_0x3b7644,_0x13d044){return function(_0x40c395){if(_0x40c395){return _0x40c395[_0xaa24('0x26')](_0x3b7644)[_0xaa24('0x27')](function(_0x1697c0){return _0x1697c0;});}return null;};}function removeEntity(_0x4413e9,_0x3d693c){return function(_0x4cddb0){if(_0x4cddb0){return _0x4cddb0[_0xaa24('0x28')]()[_0xaa24('0x27')](function(){_0x4413e9[_0xaa24('0x1c')](0xcc)[_0xaa24('0x1b')]();});}};}function handleEntityNotFound(_0x31066c,_0xbedff1){return function(_0x405bbf){if(!_0x405bbf){_0x31066c[_0xaa24('0x1a')](0x194);}return _0x405bbf;};}function handleError(_0x270d6b,_0x5c3fb1){_0x5c3fb1=_0x5c3fb1||0x1f4;return function(_0x3a5590){logger[_0xaa24('0x29')](_0x3a5590[_0xaa24('0x2a')]);if(_0x3a5590[_0xaa24('0x2b')]){delete _0x3a5590[_0xaa24('0x2b')];}_0x270d6b[_0xaa24('0x1c')](_0x5c3fb1)[_0xaa24('0x2c')](_0x3a5590);};}exports['index']=function(_0x1a9756,_0xbade17){var _0x1c96cc={},_0x36a225={},_0x1a648c={'count':0x0,'rows':[]};var _0x2b11b6=_[_0xaa24('0x2d')](db['FreshsalesConfiguration'][_0xaa24('0x2e')],function(_0x239168){return{'name':_0x239168['fieldName'],'type':_0x239168[_0xaa24('0x2f')][_0xaa24('0x30')]};});_0x36a225[_0xaa24('0x31')]=_[_0xaa24('0x2d')](_0x2b11b6,'name');_0x36a225[_0xaa24('0x32')]=_[_0xaa24('0x33')](_0x1a9756[_0xaa24('0x32')]);_0x36a225[_0xaa24('0x34')]=_[_0xaa24('0x35')](_0x36a225['model'],_0x36a225[_0xaa24('0x32')]);_0x1c96cc[_0xaa24('0x36')]=_[_0xaa24('0x35')](_0x36a225[_0xaa24('0x31')],qs[_0xaa24('0x37')](_0x1a9756[_0xaa24('0x32')]['fields']));_0x1c96cc[_0xaa24('0x36')]=_0x1c96cc[_0xaa24('0x36')]['length']?_0x1c96cc[_0xaa24('0x36')]:_0x36a225[_0xaa24('0x31')];if(!_0x1a9756['query']['hasOwnProperty'](_0xaa24('0x38'))){_0x1c96cc[_0xaa24('0x21')]=qs['limit'](_0x1a9756['query'][_0xaa24('0x21')]);_0x1c96cc[_0xaa24('0x1e')]=qs[_0xaa24('0x1e')](_0x1a9756[_0xaa24('0x32')][_0xaa24('0x1e')]);}_0x1c96cc['order']=qs[_0xaa24('0x39')](_0x1a9756['query'][_0xaa24('0x39')]);_0x1c96cc[_0xaa24('0x3a')]=qs[_0xaa24('0x34')](_[_0xaa24('0x3b')](_0x1a9756[_0xaa24('0x32')],_0x36a225[_0xaa24('0x34')]),_0x2b11b6);if(_0x1a9756[_0xaa24('0x32')][_0xaa24('0x3c')]){_0x1c96cc['where']=_[_0xaa24('0x3d')](_0x1c96cc[_0xaa24('0x3a')],{'$or':_[_0xaa24('0x2d')](_0x2b11b6,function(_0x446a31){if(_0x446a31[_0xaa24('0x2f')]!==_0xaa24('0x3e')){var _0x247a26={};_0x247a26[_0x446a31[_0xaa24('0x2b')]]={'$like':'%'+_0x1a9756[_0xaa24('0x32')][_0xaa24('0x3c')]+'%'};return _0x247a26;}})});}_0x1c96cc=_[_0xaa24('0x3d')]({},_0x1c96cc,_0x1a9756[_0xaa24('0x3f')]);var _0xf4d881={'where':_0x1c96cc['where']};return db['FreshsalesConfiguration'][_0xaa24('0x20')](_0xf4d881)[_0xaa24('0x27')](function(_0x27dc8c){_0x1a648c[_0xaa24('0x20')]=_0x27dc8c;if(_0x1a9756['query'][_0xaa24('0x40')]){_0x1c96cc['include']=[{'all':!![]}];}return db[_0xaa24('0x41')]['findAll'](_0x1c96cc);})['then'](function(_0x2c8938){_0x1a648c['rows']=_0x2c8938;return _0x1a648c;})[_0xaa24('0x27')](respondWithFilteredResult(_0xbade17,_0x1c96cc))[_0xaa24('0x42')](handleError(_0xbade17,null));};exports[_0xaa24('0x43')]=function(_0x52ede9,_0x272e64){var _0x5902b6={'raw':![],'where':{'id':_0x52ede9[_0xaa24('0x44')]['id']}},_0x2c407d={};_0x2c407d['model']=_['keys'](db['FreshsalesConfiguration'][_0xaa24('0x2e')]);_0x2c407d[_0xaa24('0x32')]=_[_0xaa24('0x33')](_0x52ede9['query']);_0x2c407d[_0xaa24('0x34')]=_[_0xaa24('0x35')](_0x2c407d[_0xaa24('0x31')],_0x2c407d['query']);_0x5902b6[_0xaa24('0x36')]=_[_0xaa24('0x35')](_0x2c407d[_0xaa24('0x31')],qs['fields'](_0x52ede9[_0xaa24('0x32')][_0xaa24('0x37')]));_0x5902b6[_0xaa24('0x36')]=_0x5902b6['attributes'][_0xaa24('0x45')]?_0x5902b6['attributes']:_0x2c407d[_0xaa24('0x31')];if(_0x52ede9['query'][_0xaa24('0x40')]){_0x5902b6[_0xaa24('0x46')]=[{'all':!![]}];}_0x5902b6=_[_0xaa24('0x3d')]({},_0x5902b6,_0x52ede9[_0xaa24('0x3f')]);return db[_0xaa24('0x41')][_0xaa24('0x47')](_0x5902b6)[_0xaa24('0x27')](handleEntityNotFound(_0x272e64,null))['then'](respondWithResult(_0x272e64,null))[_0xaa24('0x42')](handleError(_0x272e64,null));};exports[_0xaa24('0x48')]=function(_0x40102c,_0x2e817){return db['FreshsalesConfiguration'][_0xaa24('0x48')](_0x40102c[_0xaa24('0x49')],{})['then'](respondWithResult(_0x2e817,0xc9))[_0xaa24('0x42')](handleError(_0x2e817,null));};exports['update']=function(_0x1b834f,_0x1251ff){if(_0x1b834f['body']['id']){delete _0x1b834f[_0xaa24('0x49')]['id'];}return db[_0xaa24('0x41')][_0xaa24('0x47')]({'where':{'id':_0x1b834f[_0xaa24('0x44')]['id']}})['then'](handleEntityNotFound(_0x1251ff,null))[_0xaa24('0x27')](saveUpdates(_0x1b834f[_0xaa24('0x49')],null))[_0xaa24('0x27')](respondWithResult(_0x1251ff,null))[_0xaa24('0x42')](handleError(_0x1251ff,null));};exports[_0xaa24('0x28')]=function(_0x29db71,_0x260007){return db[_0xaa24('0x41')]['find']({'where':{'id':_0x29db71[_0xaa24('0x44')]['id']}})[_0xaa24('0x27')](handleEntityNotFound(_0x260007,null))[_0xaa24('0x27')](removeEntity(_0x260007,null))['catch'](handleError(_0x260007,null));};exports[_0xaa24('0x4a')]=function(_0x1f8f78,_0x27f71d,_0x1d525b){var _0x3f783c={};var _0x5df00f={};var _0x1dc340;var _0x5dd4f3;return db[_0xaa24('0x41')][_0xaa24('0x4b')]({'where':{'id':_0x1f8f78[_0xaa24('0x44')]['id']}})[_0xaa24('0x27')](handleEntityNotFound(_0x27f71d,null))[_0xaa24('0x27')](function(_0x289334){if(_0x289334){_0x1dc340=_0x289334;_0x5df00f[_0xaa24('0x31')]=_[_0xaa24('0x33')](db[_0xaa24('0x4c')][_0xaa24('0x2e')]);_0x5df00f['query']=_[_0xaa24('0x33')](_0x1f8f78[_0xaa24('0x32')]);_0x5df00f[_0xaa24('0x34')]=_[_0xaa24('0x35')](_0x5df00f['model'],_0x5df00f['query']);_0x3f783c[_0xaa24('0x36')]=_[_0xaa24('0x35')](_0x5df00f['model'],qs[_0xaa24('0x37')](_0x1f8f78[_0xaa24('0x32')]['fields']));_0x3f783c['attributes']=_0x3f783c[_0xaa24('0x36')][_0xaa24('0x45')]?_0x3f783c[_0xaa24('0x36')]:_0x5df00f['model'];_0x3f783c[_0xaa24('0x4d')]=qs['sort'](_0x1f8f78[_0xaa24('0x32')][_0xaa24('0x39')]);_0x3f783c[_0xaa24('0x3a')]=qs[_0xaa24('0x34')](_[_0xaa24('0x3b')](_0x1f8f78[_0xaa24('0x32')],_0x5df00f[_0xaa24('0x34')]));if(_0x1f8f78[_0xaa24('0x32')][_0xaa24('0x3c')]){_0x3f783c[_0xaa24('0x3a')]=_[_0xaa24('0x3d')](_0x3f783c['where'],{'$or':_[_0xaa24('0x2d')](_0x3f783c[_0xaa24('0x36')],function(_0x5698f0){var _0x3e13a3={};_0x3e13a3[_0x5698f0]={'$like':'%'+_0x1f8f78[_0xaa24('0x32')][_0xaa24('0x3c')]+'%'};return _0x3e13a3;})});}_0x3f783c=_[_0xaa24('0x3d')]({},_0x3f783c,_0x1f8f78[_0xaa24('0x3f')]);return _0x1dc340['getSubjects'](_0x3f783c);}})[_0xaa24('0x27')](function(_0x317eaf){if(_0x317eaf){_0x5dd4f3=_0x317eaf[_0xaa24('0x45')];if(!_0x1f8f78['query'][_0xaa24('0x4e')](_0xaa24('0x38'))){_0x3f783c[_0xaa24('0x21')]=qs[_0xaa24('0x21')](_0x1f8f78['query'][_0xaa24('0x21')]);_0x3f783c[_0xaa24('0x1e')]=qs[_0xaa24('0x1e')](_0x1f8f78[_0xaa24('0x32')][_0xaa24('0x1e')]);}return _0x1dc340[_0xaa24('0x4a')](_0x3f783c);}})[_0xaa24('0x27')](function(_0x51f764){if(_0x51f764){return _0x51f764?{'count':_0x5dd4f3,'rows':_0x51f764}:null;}})[_0xaa24('0x27')](respondWithResult(_0x27f71d,null))[_0xaa24('0x42')](handleError(_0x27f71d,null));};exports[_0xaa24('0x4f')]=function(_0x17aeac,_0x30f805,_0x1f31df){var _0x175edd={};var _0x1cf3fa={};var _0x435f71;var _0x4617d4;return db[_0xaa24('0x41')]['findOne']({'where':{'id':_0x17aeac['params']['id']}})['then'](handleEntityNotFound(_0x30f805,null))[_0xaa24('0x27')](function(_0x52ab40){if(_0x52ab40){_0x435f71=_0x52ab40;_0x1cf3fa[_0xaa24('0x31')]=_[_0xaa24('0x33')](db[_0xaa24('0x4c')][_0xaa24('0x2e')]);_0x1cf3fa[_0xaa24('0x32')]=_[_0xaa24('0x33')](_0x17aeac[_0xaa24('0x32')]);_0x1cf3fa[_0xaa24('0x34')]=_['intersection'](_0x1cf3fa['model'],_0x1cf3fa['query']);_0x175edd[_0xaa24('0x36')]=_[_0xaa24('0x35')](_0x1cf3fa[_0xaa24('0x31')],qs[_0xaa24('0x37')](_0x17aeac[_0xaa24('0x32')][_0xaa24('0x37')]));_0x175edd[_0xaa24('0x36')]=_0x175edd[_0xaa24('0x36')][_0xaa24('0x45')]?_0x175edd['attributes']:_0x1cf3fa[_0xaa24('0x31')];_0x175edd[_0xaa24('0x4d')]=qs[_0xaa24('0x39')](_0x17aeac[_0xaa24('0x32')][_0xaa24('0x39')]);_0x175edd[_0xaa24('0x3a')]=qs[_0xaa24('0x34')](_[_0xaa24('0x3b')](_0x17aeac[_0xaa24('0x32')],_0x1cf3fa[_0xaa24('0x34')]));if(_0x17aeac['query'][_0xaa24('0x3c')]){_0x175edd['where']=_[_0xaa24('0x3d')](_0x175edd[_0xaa24('0x3a')],{'$or':_[_0xaa24('0x2d')](_0x175edd[_0xaa24('0x36')],function(_0x29ca87){var _0x4ada29={};_0x4ada29[_0x29ca87]={'$like':'%'+_0x17aeac['query'][_0xaa24('0x3c')]+'%'};return _0x4ada29;})});}_0x175edd=_['merge']({},_0x175edd,_0x17aeac[_0xaa24('0x3f')]);return _0x435f71[_0xaa24('0x4f')](_0x175edd);}})['then'](function(_0x465c39){if(_0x465c39){_0x4617d4=_0x465c39[_0xaa24('0x45')];if(!_0x17aeac['query'][_0xaa24('0x4e')](_0xaa24('0x38'))){_0x175edd[_0xaa24('0x21')]=qs[_0xaa24('0x21')](_0x17aeac[_0xaa24('0x32')][_0xaa24('0x21')]);_0x175edd['offset']=qs['offset'](_0x17aeac[_0xaa24('0x32')][_0xaa24('0x1e')]);}return _0x435f71['getDescriptions'](_0x175edd);}})[_0xaa24('0x27')](function(_0x5dd0ac){if(_0x5dd0ac){return _0x5dd0ac?{'count':_0x4617d4,'rows':_0x5dd0ac}:null;}})[_0xaa24('0x27')](respondWithResult(_0x30f805,null))['catch'](handleError(_0x30f805,null));};exports[_0xaa24('0x50')]=function(_0x24f340,_0xa7596f,_0x25c2e9){var _0x33831c={};var _0x4e2481={};var _0xb860b2;var _0x5e8cda;return db[_0xaa24('0x41')][_0xaa24('0x4b')]({'where':{'id':_0x24f340[_0xaa24('0x44')]['id']}})['then'](handleEntityNotFound(_0xa7596f,null))[_0xaa24('0x27')](function(_0x18d0a4){if(_0x18d0a4){_0xb860b2=_0x18d0a4;_0x4e2481[_0xaa24('0x31')]=_[_0xaa24('0x33')](db[_0xaa24('0x4c')]['rawAttributes']);_0x4e2481[_0xaa24('0x32')]=_[_0xaa24('0x33')](_0x24f340[_0xaa24('0x32')]);_0x4e2481[_0xaa24('0x34')]=_[_0xaa24('0x35')](_0x4e2481[_0xaa24('0x31')],_0x4e2481[_0xaa24('0x32')]);_0x33831c[_0xaa24('0x36')]=_[_0xaa24('0x35')](_0x4e2481[_0xaa24('0x31')],qs[_0xaa24('0x37')](_0x24f340[_0xaa24('0x32')][_0xaa24('0x37')]));_0x33831c['attributes']=_0x33831c[_0xaa24('0x36')]['length']?_0x33831c[_0xaa24('0x36')]:_0x4e2481[_0xaa24('0x31')];_0x33831c[_0xaa24('0x4d')]=qs[_0xaa24('0x39')](_0x24f340['query'][_0xaa24('0x39')]);_0x33831c[_0xaa24('0x3a')]=qs[_0xaa24('0x34')](_['pick'](_0x24f340['query'],_0x4e2481[_0xaa24('0x34')]));if(_0x24f340[_0xaa24('0x32')][_0xaa24('0x3c')]){_0x33831c[_0xaa24('0x3a')]=_['merge'](_0x33831c[_0xaa24('0x3a')],{'$or':_[_0xaa24('0x2d')](_0x33831c[_0xaa24('0x36')],function(_0x42fa7a){var _0x1e21c6={};_0x1e21c6[_0x42fa7a]={'$like':'%'+_0x24f340[_0xaa24('0x32')][_0xaa24('0x3c')]+'%'};return _0x1e21c6;})});}_0x33831c=_['merge']({},_0x33831c,_0x24f340['options']);return _0xb860b2['getFields'](_0x33831c);}})[_0xaa24('0x27')](function(_0xfbd2e1){if(_0xfbd2e1){_0x5e8cda=_0xfbd2e1['length'];if(!_0x24f340['query'][_0xaa24('0x4e')](_0xaa24('0x38'))){_0x33831c[_0xaa24('0x21')]=qs[_0xaa24('0x21')](_0x24f340[_0xaa24('0x32')][_0xaa24('0x21')]);_0x33831c[_0xaa24('0x1e')]=qs[_0xaa24('0x1e')](_0x24f340[_0xaa24('0x32')][_0xaa24('0x1e')]);}return _0xb860b2[_0xaa24('0x50')](_0x33831c);}})[_0xaa24('0x27')](function(_0x3621de){if(_0x3621de){return _0x3621de?{'count':_0x5e8cda,'rows':_0x3621de}:null;}})[_0xaa24('0x27')](respondWithResult(_0xa7596f,null))[_0xaa24('0x42')](handleError(_0xa7596f,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index c6bfc5e..1e28837 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 _0xedc0=['exports','define','FreshsalesConfiguration','int_freshsales_configurations','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x5f196e,_0x4b5dfa){var _0xc89eae=function(_0x1d9cd9){while(--_0x1d9cd9){_0x5f196e['push'](_0x5f196e['shift']());}};_0xc89eae(++_0x4b5dfa);}(_0xedc0,0x1a8));var _0x0edc=function(_0x3df9dd,_0x26f5cd){_0x3df9dd=_0x3df9dd-0x0;var _0x4f11e4=_0xedc0[_0x3df9dd];return _0x4f11e4;};'use strict';var _=require(_0x0edc('0x0'));var util=require(_0x0edc('0x1'));var logger=require(_0x0edc('0x2'))('api');var moment=require(_0x0edc('0x3'));var BPromise=require('bluebird');var rp=require(_0x0edc('0x4'));var fs=require('fs');var path=require(_0x0edc('0x5'));var rimraf=require(_0x0edc('0x6'));var config=require(_0x0edc('0x7'));var attributes=require('./intFreshsalesConfiguration.attributes');module[_0x0edc('0x8')]=function(_0x743342,_0xfcb5fa){return _0x743342[_0x0edc('0x9')](_0x0edc('0xa'),attributes,{'tableName':_0x0edc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4639=['util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','FreshsalesConfiguration','lodash'];(function(_0x3cba84,_0x51f496){var _0x14af6c=function(_0x4956c1){while(--_0x4956c1){_0x3cba84['push'](_0x3cba84['shift']());}};_0x14af6c(++_0x51f496);}(_0x4639,0x149));var _0x9463=function(_0x11b19b,_0x213234){_0x11b19b=_0x11b19b-0x0;var _0x1daac1=_0x4639[_0x11b19b];return _0x1daac1;};'use strict';var _=require(_0x9463('0x0'));var util=require(_0x9463('0x1'));var logger=require(_0x9463('0x2'))(_0x9463('0x3'));var moment=require(_0x9463('0x4'));var BPromise=require('bluebird');var rp=require(_0x9463('0x5'));var fs=require('fs');var path=require(_0x9463('0x6'));var rimraf=require(_0x9463('0x7'));var config=require(_0x9463('0x8'));var attributes=require(_0x9463('0x9'));module['exports']=function(_0x2eb5d9,_0x554147){return _0x2eb5d9['define'](_0x9463('0xa'),attributes,{'tableName':'int_freshsales_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js index a8ae979..a385a23 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 _0x31be=['client','http','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x17928f,_0x4ad33f){var _0x500b63=function(_0x127644){while(--_0x127644){_0x17928f['push'](_0x17928f['shift']());}};_0x500b63(++_0x4ad33f);}(_0x31be,0x162));var _0xe31b=function(_0x2b01c0,_0xb6a049){_0x2b01c0=_0x2b01c0-0x0;var _0x4f2bbf=_0x31be[_0x2b01c0];return _0x4f2bbf;};'use strict';var _=require(_0xe31b('0x0'));var util=require(_0xe31b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe31b('0x2'));var logger=require(_0xe31b('0x3'))('rpc');var config=require(_0xe31b('0x4'));var jayson=require(_0xe31b('0x5'));var client=jayson[_0xe31b('0x6')][_0xe31b('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x41b0b2,_0x10bc28,_0x43fd36){return new BPromise(function(_0x8450ec,_0x2a7c01){return client[_0xe31b('0x8')](_0x41b0b2,_0x43fd36)[_0xe31b('0x9')](function(_0x38e7b0){logger[_0xe31b('0xa')](_0xe31b('0xb'),_0x10bc28,'request\x20sent');logger[_0xe31b('0xc')](_0xe31b('0xd'),_0x10bc28,_0xe31b('0xe'),JSON[_0xe31b('0xf')](_0x38e7b0));if(_0x38e7b0[_0xe31b('0x10')]){if(_0x38e7b0['error']['code']===0x1f4){logger[_0xe31b('0x10')](_0xe31b('0xb'),_0x10bc28,_0x38e7b0[_0xe31b('0x10')][_0xe31b('0x11')]);return _0x2a7c01(_0x38e7b0['error']['message']);}logger['error'](_0xe31b('0xb'),_0x10bc28,_0x38e7b0['error']['message']);return _0x8450ec(_0x38e7b0[_0xe31b('0x10')][_0xe31b('0x11')]);}else{logger['info'](_0xe31b('0xb'),_0x10bc28,_0xe31b('0xe'));_0x8450ec(_0x38e7b0[_0xe31b('0x12')][_0xe31b('0x11')]);}})[_0xe31b('0x13')](function(_0x3fc53c){logger['error'](_0xe31b('0xb'),_0x10bc28,_0x3fc53c);_0x2a7c01(_0x3fc53c);});});} \ No newline at end of file +var _0xd550=['then','info','FreshsalesConfiguration,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','request'];(function(_0xc4a9b6,_0x225fdf){var _0x2d5a1a=function(_0x1d4b85){while(--_0x1d4b85){_0xc4a9b6['push'](_0xc4a9b6['shift']());}};_0x2d5a1a(++_0x225fdf);}(_0xd550,0x19a));var _0x0d55=function(_0x250aae,_0x121256){_0x250aae=_0x250aae-0x0;var _0x372cfe=_0xd550[_0x250aae];return _0x372cfe;};'use strict';var _=require(_0x0d55('0x0'));var util=require(_0x0d55('0x1'));var moment=require(_0x0d55('0x2'));var BPromise=require('bluebird');var rs=require(_0x0d55('0x3'));var fs=require('fs');var Redis=require(_0x0d55('0x4'));var db=require(_0x0d55('0x5'))['db'];var utils=require(_0x0d55('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x0d55('0x7'));var jayson=require(_0x0d55('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x14d8e5,_0x1f10e7,_0x251516){return new BPromise(function(_0x5475ae,_0x514ae1){return client[_0x0d55('0x9')](_0x14d8e5,_0x251516)[_0x0d55('0xa')](function(_0xce08c8){logger[_0x0d55('0xb')](_0x0d55('0xc'),_0x1f10e7,'request\x20sent');logger[_0x0d55('0xd')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x1f10e7,'request\x20sent',JSON[_0x0d55('0xe')](_0xce08c8));if(_0xce08c8[_0x0d55('0xf')]){if(_0xce08c8[_0x0d55('0xf')][_0x0d55('0x10')]===0x1f4){logger[_0x0d55('0xf')](_0x0d55('0xc'),_0x1f10e7,_0xce08c8[_0x0d55('0xf')][_0x0d55('0x11')]);return _0x514ae1(_0xce08c8[_0x0d55('0xf')][_0x0d55('0x11')]);}logger['error'](_0x0d55('0xc'),_0x1f10e7,_0xce08c8[_0x0d55('0xf')][_0x0d55('0x11')]);return _0x5475ae(_0xce08c8[_0x0d55('0xf')][_0x0d55('0x11')]);}else{logger['info'](_0x0d55('0xc'),_0x1f10e7,_0x0d55('0x12'));_0x5475ae(_0xce08c8[_0x0d55('0x13')]['message']);}})[_0x0d55('0x14')](function(_0x33c2cb){logger[_0x0d55('0xf')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x1f10e7,_0x33c2cb);_0x514ae1(_0x33c2cb);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 2c010df..d693c76 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 _0xb43b=['destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','show','post','create','put','update','delete','/:id'];(function(_0xb3910c,_0x1f9b14){var _0x1092c8=function(_0x52fc1e){while(--_0x52fc1e){_0xb3910c['push'](_0xb3910c['shift']());}};_0x1092c8(++_0x1f9b14);}(_0xb43b,0xbf));var _0xbb43=function(_0x1b705f,_0x3fa336){_0x1b705f=_0x1b705f-0x0;var _0x6ced22=_0xb43b[_0x1b705f];return _0x6ced22;};'use strict';var multer=require(_0xbb43('0x0'));var util=require('util');var path=require(_0xbb43('0x1'));var timeout=require(_0xbb43('0x2'));var express=require(_0xbb43('0x3'));var router=express[_0xbb43('0x4')]();var fs_extra=require(_0xbb43('0x5'));var auth=require(_0xbb43('0x6'));var interaction=require(_0xbb43('0x7'));var config=require(_0xbb43('0x8'));var controller=require(_0xbb43('0x9'));router[_0xbb43('0xa')]('/',auth[_0xbb43('0xb')](),controller['index']);router[_0xbb43('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xbb43('0xc')]);router[_0xbb43('0xd')]('/',auth[_0xbb43('0xb')](),controller[_0xbb43('0xe')]);router[_0xbb43('0xf')]('/:id',auth[_0xbb43('0xb')](),controller[_0xbb43('0x10')]);router[_0xbb43('0x11')](_0xbb43('0x12'),auth['isAuthenticated'](),controller[_0xbb43('0x13')]);module[_0xbb43('0x14')]=router; \ No newline at end of file +var _0xae7b=['isAuthenticated','index','/:id','show','post','put','update','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get'];(function(_0x31d851,_0xe7aa05){var _0x5f1487=function(_0xa2d5e5){while(--_0xa2d5e5){_0x31d851['push'](_0x31d851['shift']());}};_0x5f1487(++_0xe7aa05);}(_0xae7b,0xbe));var _0xbae7=function(_0x35ae71,_0x21b2b6){_0x35ae71=_0x35ae71-0x0;var _0x23aacf=_0xae7b[_0x35ae71];return _0x23aacf;};'use strict';var multer=require(_0xbae7('0x0'));var util=require(_0xbae7('0x1'));var path=require(_0xbae7('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xbae7('0x3')]();var fs_extra=require(_0xbae7('0x4'));var auth=require(_0xbae7('0x5'));var interaction=require(_0xbae7('0x6'));var config=require('../../config/environment');var controller=require('./intFreshsalesField.controller');router[_0xbae7('0x7')]('/',auth[_0xbae7('0x8')](),controller[_0xbae7('0x9')]);router['get'](_0xbae7('0xa'),auth['isAuthenticated'](),controller[_0xbae7('0xb')]);router[_0xbae7('0xc')]('/',auth[_0xbae7('0x8')](),controller['create']);router[_0xbae7('0xd')]('/:id',auth[_0xbae7('0x8')](),controller[_0xbae7('0xe')]);router[_0xbae7('0xf')](_0xbae7('0xa'),auth['isAuthenticated'](),controller[_0xbae7('0x10')]);module[_0xbae7('0x11')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index fbec524..de04749 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 _0xe400=['customVariable','keyValue','picklist','STRING','BOOLEAN','ENUM','string','variable'];(function(_0x4769cb,_0x5bc658){var _0x41cc4f=function(_0x265432){while(--_0x265432){_0x4769cb['push'](_0x4769cb['shift']());}};_0x41cc4f(++_0x5bc658);}(_0xe400,0x1ad));var _0x0e40=function(_0x3345a5,_0x29d4c1){_0x3345a5=_0x3345a5-0x0;var _0x31d654=_0xe400[_0x3345a5];return _0x31d654;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x0e40('0x0')](_0x0e40('0x1'),_0x0e40('0x2'),_0x0e40('0x3'),_0x0e40('0x4'),_0x0e40('0x5')),'defaultValue':_0x0e40('0x1')},'content':{'type':Sequelize[_0x0e40('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x0e40('0x0')](_0x0e40('0x1'),'variable',_0x0e40('0x3'))},'keyContent':{'type':Sequelize[_0x0e40('0x6')]},'idField':{'type':Sequelize[_0x0e40('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x0e40('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0e40('0x6')]}}; \ No newline at end of file +var _0xea18=['picklist','STRING','BOOLEAN','exports','ENUM','string','variable','keyValue'];(function(_0x8a80a3,_0x5f4c6a){var _0x3c06fc=function(_0x5d2f60){while(--_0x5d2f60){_0x8a80a3['push'](_0x8a80a3['shift']());}};_0x3c06fc(++_0x5f4c6a);}(_0xea18,0x7b));var _0x8ea1=function(_0x4d2eb4,_0x5defa3){_0x4d2eb4=_0x4d2eb4-0x0;var _0x3c2552=_0xea18[_0x4d2eb4];return _0x3c2552;};'use strict';var Sequelize=require('sequelize');module[_0x8ea1('0x0')]={'type':{'type':Sequelize[_0x8ea1('0x1')](_0x8ea1('0x2'),_0x8ea1('0x3'),'customVariable',_0x8ea1('0x4'),_0x8ea1('0x5')),'defaultValue':_0x8ea1('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x8ea1('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x8ea1('0x2'),_0x8ea1('0x3'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x8ea1('0x6')]},'customField':{'type':Sequelize[_0x8ea1('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8ea1('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 44efe36..ce0bb31 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 _0xf7bb=['pick','VIRTUAL','filter','merge','options','includeAll','include','FreshsalesField','rows','show','params','rawAttributes','find','catch','create','body','eml-format','rimraf','request-promise','moment','bluebird','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','map','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','where'];(function(_0x4723d8,_0x3c0d68){var _0x3371cb=function(_0x361c17){while(--_0x361c17){_0x4723d8['push'](_0x4723d8['shift']());}};_0x3371cb(++_0x3c0d68);}(_0xf7bb,0x1ba));var _0xbf7b=function(_0xcdf96f,_0xc63784){_0xcdf96f=_0xcdf96f-0x0;var _0xb59f45=_0xf7bb[_0xcdf96f];return _0xb59f45;};'use strict';var emlformat=require(_0xbf7b('0x0'));var rimraf=require(_0xbf7b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xbf7b('0x2'));var moment=require(_0xbf7b('0x3'));var BPromise=require(_0xbf7b('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xbf7b('0x5'));var sox=require('sox');var csv=require(_0xbf7b('0x6'));var ejs=require(_0xbf7b('0x7'));var fs=require('fs');var fs_extra=require(_0xbf7b('0x8'));var _=require('lodash');var squel=require(_0xbf7b('0x9'));var crypto=require(_0xbf7b('0xa'));var jsforce=require(_0xbf7b('0xb'));var deskjs=require(_0xbf7b('0xc'));var toCsv=require(_0xbf7b('0x6'));var querystring=require('querystring');var Papa=require(_0xbf7b('0xd'));var Redis=require('ioredis');var authService=require(_0xbf7b('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xbf7b('0xf'));var hardwareService=require(_0xbf7b('0x10'));var logger=require(_0xbf7b('0x11'))(_0xbf7b('0x12'));var utils=require('../../config/utils');var config=require(_0xbf7b('0x13'));var licenseUtil=require(_0xbf7b('0x14'));var db=require(_0xbf7b('0x15'))['db'];function respondWithStatusCode(_0x40b41f,_0x54cc44){_0x54cc44=_0x54cc44||0xcc;return function(_0x1e5b65){if(_0x1e5b65){return _0x40b41f[_0xbf7b('0x16')](_0x54cc44);}return _0x40b41f[_0xbf7b('0x17')](_0x54cc44)[_0xbf7b('0x18')]();};}function respondWithResult(_0x58fcfe,_0x2109ab){_0x2109ab=_0x2109ab||0xc8;return function(_0x36a773){if(_0x36a773){return _0x58fcfe['status'](_0x2109ab)[_0xbf7b('0x19')](_0x36a773);}};}function respondWithFilteredResult(_0x4b8852,_0x20c5ca){return function(_0x2246dc){if(_0x2246dc){var _0x4a4ec8=typeof _0x20c5ca[_0xbf7b('0x1a')]===_0xbf7b('0x1b')&&typeof _0x20c5ca[_0xbf7b('0x1c')]===_0xbf7b('0x1b');var _0x5ba419=_0x2246dc[_0xbf7b('0x1d')];var _0x1dc597=_0x4a4ec8?0x0:_0x20c5ca[_0xbf7b('0x1a')];var _0x4fd0b5=_0x4a4ec8?_0x2246dc[_0xbf7b('0x1d')]:_0x20c5ca[_0xbf7b('0x1a')]+_0x20c5ca[_0xbf7b('0x1c')];var _0x56e73e;if(_0x4fd0b5>=_0x5ba419){_0x4fd0b5=_0x5ba419;_0x56e73e=0xc8;}else{_0x56e73e=0xce;}_0x4b8852[_0xbf7b('0x17')](_0x56e73e);return _0x4b8852[_0xbf7b('0x1e')](_0xbf7b('0x1f'),_0x1dc597+'-'+_0x4fd0b5+'/'+_0x5ba419)['json'](_0x2246dc);}return null;};}function patchUpdates(_0x4a473b){return function(_0x437204){try{jsonpatch[_0xbf7b('0x20')](_0x437204,_0x4a473b,!![]);}catch(_0x39180c){return BPromise[_0xbf7b('0x21')](_0x39180c);}return _0x437204['save']();};}function saveUpdates(_0x510ae3,_0x4a8e42){return function(_0x3a6519){if(_0x3a6519){return _0x3a6519[_0xbf7b('0x22')](_0x510ae3)[_0xbf7b('0x23')](function(_0x170e55){return _0x170e55;});}return null;};}function removeEntity(_0x33a6c2,_0x5e60ed){return function(_0x4c17d3){if(_0x4c17d3){return _0x4c17d3[_0xbf7b('0x24')]()[_0xbf7b('0x23')](function(){_0x33a6c2[_0xbf7b('0x17')](0xcc)[_0xbf7b('0x18')]();});}};}function handleEntityNotFound(_0x34e0fc,_0x1d3435){return function(_0x22b6bd){if(!_0x22b6bd){_0x34e0fc[_0xbf7b('0x16')](0x194);}return _0x22b6bd;};}function handleError(_0x4771e5,_0x31a181){_0x31a181=_0x31a181||0x1f4;return function(_0x276f61){logger['error'](_0x276f61[_0xbf7b('0x25')]);if(_0x276f61[_0xbf7b('0x26')]){delete _0x276f61['name'];}_0x4771e5['status'](_0x31a181)[_0xbf7b('0x27')](_0x276f61);};}exports[_0xbf7b('0x28')]=function(_0x465037,_0x502981){var _0x51f445={},_0x502a1d={},_0xc0cff3={'count':0x0,'rows':[]};var _0x22dbbd=_[_0xbf7b('0x29')](db['FreshsalesField']['rawAttributes'],function(_0x1ac49d){return{'name':_0x1ac49d[_0xbf7b('0x2a')],'type':_0x1ac49d[_0xbf7b('0x2b')]['key']};});_0x502a1d[_0xbf7b('0x2c')]=_[_0xbf7b('0x29')](_0x22dbbd,'name');_0x502a1d['query']=_[_0xbf7b('0x2d')](_0x465037[_0xbf7b('0x2e')]);_0x502a1d[_0xbf7b('0x2f')]=_[_0xbf7b('0x30')](_0x502a1d[_0xbf7b('0x2c')],_0x502a1d[_0xbf7b('0x2e')]);_0x51f445[_0xbf7b('0x31')]=_[_0xbf7b('0x30')](_0x502a1d[_0xbf7b('0x2c')],qs[_0xbf7b('0x32')](_0x465037[_0xbf7b('0x2e')]['fields']));_0x51f445[_0xbf7b('0x31')]=_0x51f445[_0xbf7b('0x31')][_0xbf7b('0x33')]?_0x51f445[_0xbf7b('0x31')]:_0x502a1d[_0xbf7b('0x2c')];if(!_0x465037[_0xbf7b('0x2e')][_0xbf7b('0x34')](_0xbf7b('0x35'))){_0x51f445['limit']=qs[_0xbf7b('0x1c')](_0x465037['query'][_0xbf7b('0x1c')]);_0x51f445['offset']=qs['offset'](_0x465037['query'][_0xbf7b('0x1a')]);}_0x51f445['order']=qs['sort'](_0x465037[_0xbf7b('0x2e')]['sort']);_0x51f445[_0xbf7b('0x36')]=qs[_0xbf7b('0x2f')](_[_0xbf7b('0x37')](_0x465037['query'],_0x502a1d[_0xbf7b('0x2f')]),_0x22dbbd);if(_0x465037[_0xbf7b('0x2e')]['filter']){_0x51f445[_0xbf7b('0x36')]=_['merge'](_0x51f445[_0xbf7b('0x36')],{'$or':_['map'](_0x22dbbd,function(_0x51e9e9){if(_0x51e9e9[_0xbf7b('0x2b')]!==_0xbf7b('0x38')){var _0xafb8f9={};_0xafb8f9[_0x51e9e9[_0xbf7b('0x26')]]={'$like':'%'+_0x465037['query'][_0xbf7b('0x39')]+'%'};return _0xafb8f9;}})});}_0x51f445=_[_0xbf7b('0x3a')]({},_0x51f445,_0x465037[_0xbf7b('0x3b')]);var _0x35fb43={'where':_0x51f445[_0xbf7b('0x36')]};return db['FreshsalesField']['count'](_0x35fb43)[_0xbf7b('0x23')](function(_0x223313){_0xc0cff3[_0xbf7b('0x1d')]=_0x223313;if(_0x465037[_0xbf7b('0x2e')][_0xbf7b('0x3c')]){_0x51f445[_0xbf7b('0x3d')]=[{'all':!![]}];}return db[_0xbf7b('0x3e')]['findAll'](_0x51f445);})[_0xbf7b('0x23')](function(_0x446bf2){_0xc0cff3[_0xbf7b('0x3f')]=_0x446bf2;return _0xc0cff3;})[_0xbf7b('0x23')](respondWithFilteredResult(_0x502981,_0x51f445))['catch'](handleError(_0x502981,null));};exports[_0xbf7b('0x40')]=function(_0x4385e2,_0x20eec2){var _0x4da6ba={'raw':!![],'where':{'id':_0x4385e2[_0xbf7b('0x41')]['id']}},_0x5e00e4={};_0x5e00e4[_0xbf7b('0x2c')]=_[_0xbf7b('0x2d')](db[_0xbf7b('0x3e')][_0xbf7b('0x42')]);_0x5e00e4[_0xbf7b('0x2e')]=_[_0xbf7b('0x2d')](_0x4385e2[_0xbf7b('0x2e')]);_0x5e00e4[_0xbf7b('0x2f')]=_['intersection'](_0x5e00e4[_0xbf7b('0x2c')],_0x5e00e4['query']);_0x4da6ba[_0xbf7b('0x31')]=_['intersection'](_0x5e00e4[_0xbf7b('0x2c')],qs[_0xbf7b('0x32')](_0x4385e2['query']['fields']));_0x4da6ba[_0xbf7b('0x31')]=_0x4da6ba[_0xbf7b('0x31')][_0xbf7b('0x33')]?_0x4da6ba[_0xbf7b('0x31')]:_0x5e00e4[_0xbf7b('0x2c')];if(_0x4385e2[_0xbf7b('0x2e')][_0xbf7b('0x3c')]){_0x4da6ba[_0xbf7b('0x3d')]=[{'all':!![]}];}_0x4da6ba=_['merge']({},_0x4da6ba,_0x4385e2[_0xbf7b('0x3b')]);return db[_0xbf7b('0x3e')][_0xbf7b('0x43')](_0x4da6ba)[_0xbf7b('0x23')](handleEntityNotFound(_0x20eec2,null))['then'](respondWithResult(_0x20eec2,null))[_0xbf7b('0x44')](handleError(_0x20eec2,null));};exports[_0xbf7b('0x45')]=function(_0x44b1da,_0x82d43b){return db['FreshsalesField'][_0xbf7b('0x45')](_0x44b1da[_0xbf7b('0x46')],{})[_0xbf7b('0x23')](respondWithResult(_0x82d43b,0xc9))[_0xbf7b('0x44')](handleError(_0x82d43b,null));};exports[_0xbf7b('0x22')]=function(_0x5ecbe0,_0x123bf0){if(_0x5ecbe0[_0xbf7b('0x46')]['id']){delete _0x5ecbe0[_0xbf7b('0x46')]['id'];}return db['FreshsalesField'][_0xbf7b('0x43')]({'where':{'id':_0x5ecbe0[_0xbf7b('0x41')]['id']}})[_0xbf7b('0x23')](handleEntityNotFound(_0x123bf0,null))[_0xbf7b('0x23')](saveUpdates(_0x5ecbe0[_0xbf7b('0x46')],null))[_0xbf7b('0x23')](respondWithResult(_0x123bf0,null))[_0xbf7b('0x44')](handleError(_0x123bf0,null));};exports[_0xbf7b('0x24')]=function(_0x37fe6b,_0x31ae76){return db[_0xbf7b('0x3e')][_0xbf7b('0x43')]({'where':{'id':_0x37fe6b[_0xbf7b('0x41')]['id']}})[_0xbf7b('0x23')](handleEntityNotFound(_0x31ae76,null))[_0xbf7b('0x23')](removeEntity(_0x31ae76,null))[_0xbf7b('0x44')](handleError(_0x31ae76,null));}; \ No newline at end of file +var _0xb562=['fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','findAll','rows','catch','params','include','find','create','body','eml-format','zip-dir','fast-json-patch','moment','bluebird','path','to-csv','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','set','Content-Range','json','apply','reject','save','then','destroy','error','stack','name','index','map','FreshsalesField','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes'];(function(_0x9af0ce,_0x2416f9){var _0x540187=function(_0x34c519){while(--_0x34c519){_0x9af0ce['push'](_0x9af0ce['shift']());}};_0x540187(++_0x2416f9);}(_0xb562,0x13e));var _0x2b56=function(_0x2a02e2,_0x1b0aaa){_0x2a02e2=_0x2a02e2-0x0;var _0x348957=_0xb562[_0x2a02e2];return _0x348957;};'use strict';var emlformat=require(_0x2b56('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2b56('0x1'));var jsonpatch=require(_0x2b56('0x2'));var rp=require('request-promise');var moment=require(_0x2b56('0x3'));var BPromise=require(_0x2b56('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x2b56('0x5'));var sox=require('sox');var csv=require(_0x2b56('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2b56('0x7'));var _=require(_0x2b56('0x8'));var squel=require('squel');var crypto=require(_0x2b56('0x9'));var jsforce=require(_0x2b56('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x2b56('0x6'));var querystring=require(_0x2b56('0xb'));var Papa=require(_0x2b56('0xc'));var Redis=require(_0x2b56('0xd'));var authService=require(_0x2b56('0xe'));var qs=require(_0x2b56('0xf'));var as=require(_0x2b56('0x10'));var hardwareService=require(_0x2b56('0x11'));var logger=require(_0x2b56('0x12'))(_0x2b56('0x13'));var utils=require('../../config/utils');var config=require(_0x2b56('0x14'));var licenseUtil=require(_0x2b56('0x15'));var db=require(_0x2b56('0x16'))['db'];function respondWithStatusCode(_0x427d5c,_0x2f7678){_0x2f7678=_0x2f7678||0xcc;return function(_0x35f0a4){if(_0x35f0a4){return _0x427d5c[_0x2b56('0x17')](_0x2f7678);}return _0x427d5c[_0x2b56('0x18')](_0x2f7678)[_0x2b56('0x19')]();};}function respondWithResult(_0x51552e,_0x113738){_0x113738=_0x113738||0xc8;return function(_0x2904da){if(_0x2904da){return _0x51552e[_0x2b56('0x18')](_0x113738)['json'](_0x2904da);}};}function respondWithFilteredResult(_0x29ba2c,_0x10a94d){return function(_0x492be7){if(_0x492be7){var _0x14effe=typeof _0x10a94d[_0x2b56('0x1a')]===_0x2b56('0x1b')&&typeof _0x10a94d['limit']===_0x2b56('0x1b');var _0x5e132e=_0x492be7[_0x2b56('0x1c')];var _0x355470=_0x14effe?0x0:_0x10a94d[_0x2b56('0x1a')];var _0x22de25=_0x14effe?_0x492be7['count']:_0x10a94d[_0x2b56('0x1a')]+_0x10a94d['limit'];var _0x1da002;if(_0x22de25>=_0x5e132e){_0x22de25=_0x5e132e;_0x1da002=0xc8;}else{_0x1da002=0xce;}_0x29ba2c[_0x2b56('0x18')](_0x1da002);return _0x29ba2c[_0x2b56('0x1d')](_0x2b56('0x1e'),_0x355470+'-'+_0x22de25+'/'+_0x5e132e)[_0x2b56('0x1f')](_0x492be7);}return null;};}function patchUpdates(_0x319dfb){return function(_0x274b23){try{jsonpatch[_0x2b56('0x20')](_0x274b23,_0x319dfb,!![]);}catch(_0xa26050){return BPromise[_0x2b56('0x21')](_0xa26050);}return _0x274b23[_0x2b56('0x22')]();};}function saveUpdates(_0x73f223,_0x153e29){return function(_0x24e0f9){if(_0x24e0f9){return _0x24e0f9['update'](_0x73f223)[_0x2b56('0x23')](function(_0x203a3f){return _0x203a3f;});}return null;};}function removeEntity(_0x9bfcd6,_0x352d96){return function(_0x58358a){if(_0x58358a){return _0x58358a[_0x2b56('0x24')]()[_0x2b56('0x23')](function(){_0x9bfcd6[_0x2b56('0x18')](0xcc)[_0x2b56('0x19')]();});}};}function handleEntityNotFound(_0xcb061e,_0x2b65a8){return function(_0x1cebf3){if(!_0x1cebf3){_0xcb061e[_0x2b56('0x17')](0x194);}return _0x1cebf3;};}function handleError(_0x2c3fba,_0x190e91){_0x190e91=_0x190e91||0x1f4;return function(_0x90c85f){logger[_0x2b56('0x25')](_0x90c85f[_0x2b56('0x26')]);if(_0x90c85f[_0x2b56('0x27')]){delete _0x90c85f['name'];}_0x2c3fba[_0x2b56('0x18')](_0x190e91)['send'](_0x90c85f);};}exports[_0x2b56('0x28')]=function(_0x2f3eb3,_0x58f5c6){var _0x5e0afe={},_0x1db683={},_0x58993a={'count':0x0,'rows':[]};var _0x5c7662=_[_0x2b56('0x29')](db[_0x2b56('0x2a')][_0x2b56('0x2b')],function(_0x280367){return{'name':_0x280367[_0x2b56('0x2c')],'type':_0x280367['type'][_0x2b56('0x2d')]};});_0x1db683[_0x2b56('0x2e')]=_[_0x2b56('0x29')](_0x5c7662,_0x2b56('0x27'));_0x1db683[_0x2b56('0x2f')]=_[_0x2b56('0x30')](_0x2f3eb3[_0x2b56('0x2f')]);_0x1db683[_0x2b56('0x31')]=_[_0x2b56('0x32')](_0x1db683[_0x2b56('0x2e')],_0x1db683['query']);_0x5e0afe[_0x2b56('0x33')]=_['intersection'](_0x1db683[_0x2b56('0x2e')],qs['fields'](_0x2f3eb3[_0x2b56('0x2f')][_0x2b56('0x34')]));_0x5e0afe[_0x2b56('0x33')]=_0x5e0afe[_0x2b56('0x33')][_0x2b56('0x35')]?_0x5e0afe['attributes']:_0x1db683[_0x2b56('0x2e')];if(!_0x2f3eb3[_0x2b56('0x2f')][_0x2b56('0x36')](_0x2b56('0x37'))){_0x5e0afe[_0x2b56('0x38')]=qs['limit'](_0x2f3eb3['query'][_0x2b56('0x38')]);_0x5e0afe['offset']=qs[_0x2b56('0x1a')](_0x2f3eb3['query']['offset']);}_0x5e0afe[_0x2b56('0x39')]=qs[_0x2b56('0x3a')](_0x2f3eb3[_0x2b56('0x2f')][_0x2b56('0x3a')]);_0x5e0afe[_0x2b56('0x3b')]=qs[_0x2b56('0x31')](_[_0x2b56('0x3c')](_0x2f3eb3[_0x2b56('0x2f')],_0x1db683[_0x2b56('0x31')]),_0x5c7662);if(_0x2f3eb3['query'][_0x2b56('0x3d')]){_0x5e0afe[_0x2b56('0x3b')]=_[_0x2b56('0x3e')](_0x5e0afe[_0x2b56('0x3b')],{'$or':_[_0x2b56('0x29')](_0x5c7662,function(_0x366e85){if(_0x366e85[_0x2b56('0x3f')]!==_0x2b56('0x40')){var _0x552f7c={};_0x552f7c[_0x366e85['name']]={'$like':'%'+_0x2f3eb3['query'][_0x2b56('0x3d')]+'%'};return _0x552f7c;}})});}_0x5e0afe=_['merge']({},_0x5e0afe,_0x2f3eb3['options']);var _0x52dd05={'where':_0x5e0afe['where']};return db[_0x2b56('0x2a')][_0x2b56('0x1c')](_0x52dd05)['then'](function(_0x33be08){_0x58993a[_0x2b56('0x1c')]=_0x33be08;if(_0x2f3eb3[_0x2b56('0x2f')][_0x2b56('0x41')]){_0x5e0afe['include']=[{'all':!![]}];}return db['FreshsalesField'][_0x2b56('0x42')](_0x5e0afe);})[_0x2b56('0x23')](function(_0x16edae){_0x58993a[_0x2b56('0x43')]=_0x16edae;return _0x58993a;})[_0x2b56('0x23')](respondWithFilteredResult(_0x58f5c6,_0x5e0afe))[_0x2b56('0x44')](handleError(_0x58f5c6,null));};exports['show']=function(_0xf0ba63,_0x24bb8c){var _0x44e3dd={'raw':!![],'where':{'id':_0xf0ba63[_0x2b56('0x45')]['id']}},_0x5eff00={};_0x5eff00[_0x2b56('0x2e')]=_[_0x2b56('0x30')](db['FreshsalesField'][_0x2b56('0x2b')]);_0x5eff00[_0x2b56('0x2f')]=_[_0x2b56('0x30')](_0xf0ba63[_0x2b56('0x2f')]);_0x5eff00[_0x2b56('0x31')]=_[_0x2b56('0x32')](_0x5eff00[_0x2b56('0x2e')],_0x5eff00['query']);_0x44e3dd[_0x2b56('0x33')]=_['intersection'](_0x5eff00[_0x2b56('0x2e')],qs[_0x2b56('0x34')](_0xf0ba63[_0x2b56('0x2f')]['fields']));_0x44e3dd['attributes']=_0x44e3dd[_0x2b56('0x33')][_0x2b56('0x35')]?_0x44e3dd[_0x2b56('0x33')]:_0x5eff00[_0x2b56('0x2e')];if(_0xf0ba63[_0x2b56('0x2f')][_0x2b56('0x41')]){_0x44e3dd[_0x2b56('0x46')]=[{'all':!![]}];}_0x44e3dd=_[_0x2b56('0x3e')]({},_0x44e3dd,_0xf0ba63['options']);return db['FreshsalesField'][_0x2b56('0x47')](_0x44e3dd)['then'](handleEntityNotFound(_0x24bb8c,null))[_0x2b56('0x23')](respondWithResult(_0x24bb8c,null))['catch'](handleError(_0x24bb8c,null));};exports[_0x2b56('0x48')]=function(_0x58df8e,_0x3e1433){return db[_0x2b56('0x2a')]['create'](_0x58df8e[_0x2b56('0x49')],{})[_0x2b56('0x23')](respondWithResult(_0x3e1433,0xc9))[_0x2b56('0x44')](handleError(_0x3e1433,null));};exports['update']=function(_0x4974b8,_0x3c6204){if(_0x4974b8[_0x2b56('0x49')]['id']){delete _0x4974b8[_0x2b56('0x49')]['id'];}return db['FreshsalesField'][_0x2b56('0x47')]({'where':{'id':_0x4974b8['params']['id']}})[_0x2b56('0x23')](handleEntityNotFound(_0x3c6204,null))[_0x2b56('0x23')](saveUpdates(_0x4974b8[_0x2b56('0x49')],null))[_0x2b56('0x23')](respondWithResult(_0x3c6204,null))[_0x2b56('0x44')](handleError(_0x3c6204,null));};exports['destroy']=function(_0x30f2bc,_0x781db5){return db[_0x2b56('0x2a')][_0x2b56('0x47')]({'where':{'id':_0x30f2bc[_0x2b56('0x45')]['id']}})[_0x2b56('0x23')](handleEntityNotFound(_0x781db5,null))[_0x2b56('0x23')](removeEntity(_0x781db5,null))[_0x2b56('0x44')](handleError(_0x781db5,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 54cc115..7e47469 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 _0x0a6b=['FreshsalesField','idField','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesField.attributes','exports'];(function(_0x50ad66,_0x257ebe){var _0x68954c=function(_0x4fb294){while(--_0x4fb294){_0x50ad66['push'](_0x50ad66['shift']());}};_0x68954c(++_0x257ebe);}(_0x0a6b,0x120));var _0xb0a6=function(_0x52dc0d,_0x4db716){_0x52dc0d=_0x52dc0d-0x0;var _0x9e4e71=_0x0a6b[_0x52dc0d];return _0x9e4e71;};'use strict';var _=require(_0xb0a6('0x0'));var util=require('util');var logger=require(_0xb0a6('0x1'))(_0xb0a6('0x2'));var moment=require(_0xb0a6('0x3'));var BPromise=require(_0xb0a6('0x4'));var rp=require(_0xb0a6('0x5'));var fs=require('fs');var path=require(_0xb0a6('0x6'));var rimraf=require(_0xb0a6('0x7'));var config=require(_0xb0a6('0x8'));var attributes=require(_0xb0a6('0x9'));module[_0xb0a6('0xa')]=function(_0x4b47bc,_0x30b3b7){return _0x4b47bc['define'](_0xb0a6('0xb'),attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':[_0xb0a6('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa958=['path','./intFreshsalesField.attributes','exports','define','FreshsalesField','int_freshsales_fields','idField','FieldId','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x22fc8c,_0x32ebe3){var _0xeca1d8=function(_0x249bbe){while(--_0x249bbe){_0x22fc8c['push'](_0x22fc8c['shift']());}};_0xeca1d8(++_0x32ebe3);}(_0xa958,0x94));var _0x8a95=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0xa958[_0x5bd426];return _0x23a7eb;};'use strict';var _=require(_0x8a95('0x0'));var util=require('util');var logger=require(_0x8a95('0x1'))(_0x8a95('0x2'));var moment=require(_0x8a95('0x3'));var BPromise=require(_0x8a95('0x4'));var rp=require(_0x8a95('0x5'));var fs=require('fs');var path=require(_0x8a95('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8a95('0x7'));module[_0x8a95('0x8')]=function(_0x403364,_0x141f82){return _0x403364[_0x8a95('0x9')](_0x8a95('0xa'),attributes,{'tableName':_0x8a95('0xb'),'paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':[_0x8a95('0xc'),_0x8a95('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.rpc.js b/server/api/intFreshsalesField/intFreshsalesField.rpc.js index 6a78ce3..f3fd333 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 _0xdbf5=['util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','FreshsalesField,\x20%s,\x20%s','debug','stringify','code','error','message','request\x20sent','result','catch'];(function(_0x594c15,_0x5739b2){var _0x2c9fb5=function(_0x59e343){while(--_0x59e343){_0x594c15['push'](_0x594c15['shift']());}};_0x2c9fb5(++_0x5739b2);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x131eef,_0x113df7){_0x131eef=_0x131eef-0x0;var _0x20f631=_0xdbf5[_0x131eef];return _0x20f631;};'use strict';var _=require('lodash');var util=require(_0x5dbf('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5dbf('0x1'));var fs=require('fs');var Redis=require(_0x5dbf('0x2'));var db=require(_0x5dbf('0x3'))['db'];var utils=require(_0x5dbf('0x4'));var logger=require(_0x5dbf('0x5'))(_0x5dbf('0x6'));var config=require(_0x5dbf('0x7'));var jayson=require(_0x5dbf('0x8'));var client=jayson[_0x5dbf('0x9')][_0x5dbf('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x209b7d,_0x88128e,_0x93e657){return new BPromise(function(_0x52b039,_0x134810){return client['request'](_0x209b7d,_0x93e657)[_0x5dbf('0xb')](function(_0x3bec50){logger[_0x5dbf('0xc')](_0x5dbf('0xd'),_0x88128e,'request\x20sent');logger[_0x5dbf('0xe')]('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x88128e,'request\x20sent',JSON[_0x5dbf('0xf')](_0x3bec50));if(_0x3bec50['error']){if(_0x3bec50['error'][_0x5dbf('0x10')]===0x1f4){logger['error'](_0x5dbf('0xd'),_0x88128e,_0x3bec50[_0x5dbf('0x11')][_0x5dbf('0x12')]);return _0x134810(_0x3bec50[_0x5dbf('0x11')][_0x5dbf('0x12')]);}logger['error']('FreshsalesField,\x20%s,\x20%s',_0x88128e,_0x3bec50[_0x5dbf('0x11')][_0x5dbf('0x12')]);return _0x52b039(_0x3bec50['error'][_0x5dbf('0x12')]);}else{logger[_0x5dbf('0xc')](_0x5dbf('0xd'),_0x88128e,_0x5dbf('0x13'));_0x52b039(_0x3bec50[_0x5dbf('0x14')][_0x5dbf('0x12')]);}})[_0x5dbf('0x15')](function(_0x50ef1d){logger['error'](_0x5dbf('0xd'),_0x88128e,_0x50ef1d);_0x134810(_0x50ef1d);});});} \ No newline at end of file +var _0xda19=['error','message','info','result','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x5df838,_0x13d288){var _0x2d461c=function(_0x2eac55){while(--_0x2eac55){_0x5df838['push'](_0x5df838['shift']());}};_0x2d461c(++_0x13d288);}(_0xda19,0xd5));var _0x9da1=function(_0xa29740,_0x479f33){_0xa29740=_0xa29740-0x0;var _0x377c2f=_0xda19[_0xa29740];return _0x377c2f;};'use strict';var _=require('lodash');var util=require(_0x9da1('0x0'));var moment=require(_0x9da1('0x1'));var BPromise=require('bluebird');var rs=require(_0x9da1('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9da1('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x9da1('0x4'))(_0x9da1('0x5'));var config=require(_0x9da1('0x6'));var jayson=require(_0x9da1('0x7'));var client=jayson[_0x9da1('0x8')][_0x9da1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x23e4f7,_0x2c3cdd,_0x1c24e6){return new BPromise(function(_0x5e2d18,_0x47df89){return client['request'](_0x23e4f7,_0x1c24e6)['then'](function(_0x417312){logger['info'](_0x9da1('0xa'),_0x2c3cdd,_0x9da1('0xb'));logger[_0x9da1('0xc')](_0x9da1('0xd'),_0x2c3cdd,_0x9da1('0xb'),JSON[_0x9da1('0xe')](_0x417312));if(_0x417312[_0x9da1('0xf')]){if(_0x417312['error']['code']===0x1f4){logger[_0x9da1('0xf')]('FreshsalesField,\x20%s,\x20%s',_0x2c3cdd,_0x417312[_0x9da1('0xf')][_0x9da1('0x10')]);return _0x47df89(_0x417312[_0x9da1('0xf')][_0x9da1('0x10')]);}logger['error'](_0x9da1('0xa'),_0x2c3cdd,_0x417312['error']['message']);return _0x5e2d18(_0x417312[_0x9da1('0xf')]['message']);}else{logger[_0x9da1('0x11')](_0x9da1('0xa'),_0x2c3cdd,_0x9da1('0xb'));_0x5e2d18(_0x417312[_0x9da1('0x12')][_0x9da1('0x10')]);}})['catch'](function(_0x16f75a){logger[_0x9da1('0xf')](_0x9da1('0xa'),_0x2c3cdd,_0x16f75a);_0x47df89(_0x16f75a);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 34fb693..b7be498 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(_0x51e2cd,_0x59a5c7){var _0x513481=function(_0x2e3e92){while(--_0x2e3e92){_0x51e2cd['push'](_0x51e2cd['shift']());}};_0x513481(++_0x59a5c7);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +var _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(_0x3f7cf9,_0x29b96e){var _0x39021f=function(_0x272cc3){while(--_0x272cc3){_0x3f7cf9['push'](_0x3f7cf9['shift']());}};_0x39021f(++_0x29b96e);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index d00fc70..52db2f8 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 _0xccef=['username','integrationTab','newTab','exports','STRING'];(function(_0x38b43c,_0x4583f6){var _0x3378cc=function(_0x501500){while(--_0x501500){_0x38b43c['push'](_0x38b43c['shift']());}};_0x3378cc(++_0x4583f6);}(_0xccef,0x1d4));var _0xfcce=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xccef[_0x4565bf];return _0x5610ba;};'use strict';var Sequelize=require('sequelize');module[_0xfcce('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xfcce('0x1')]},'username':{'type':Sequelize[_0xfcce('0x1')],'unique':_0xfcce('0x2')},'remoteUri':{'type':Sequelize[_0xfcce('0x1')]},'password':{'type':Sequelize[_0xfcce('0x1')]},'clientId':{'type':Sequelize[_0xfcce('0x1')]},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xfcce('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xfcce('0x3'),_0xfcce('0x4')),'defaultValue':_0xfcce('0x3')}}; \ No newline at end of file +var _0x5232=['newTab','sequelize','exports','STRING','ENUM','integrationTab'];(function(_0x4a96ef,_0x5c1383){var _0x330714=function(_0x1bc221){while(--_0x1bc221){_0x4a96ef['push'](_0x4a96ef['shift']());}};_0x330714(++_0x5c1383);}(_0x5232,0x1c9));var _0x2523=function(_0x5400a1,_0x2275aa){_0x5400a1=_0x5400a1-0x0;var _0x4006c7=_0x5232[_0x5400a1];return _0x4006c7;};'use strict';var Sequelize=require(_0x2523('0x0'));module[_0x2523('0x1')]={'name':{'type':Sequelize[_0x2523('0x2')]},'description':{'type':Sequelize[_0x2523('0x2')]},'username':{'type':Sequelize[_0x2523('0x2')],'unique':'username'},'remoteUri':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x2523('0x2')]},'clientId':{'type':Sequelize[_0x2523('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize[_0x2523('0x2')]},'serverUrl':{'type':Sequelize[_0x2523('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x2523('0x3')](_0x2523('0x4'),_0x2523('0x5')),'defaultValue':_0x2523('0x4')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 0585a8a..956bb01 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 _0x3be4=['picklistValues','value','true','False','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../components/integrations/configuration','sendStatus','end','json','offset','limit','undefined','count','set','then','status','error','stack','name','send','index','map','SalesforceAccount','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','destroy','SalesforceConfiguration','length','getConfigurations','findOne','Subjects','getSubjects','channel','type','Descriptions','getDescriptions','SalesforceField','Task','remoteUri','clientId','clientSecret','username','securityToken','slice','substring','lastIndexOf','Connection','login','concat','isNil','ticketType','describe','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Description','string','int','picklist','boolean','email','label','custom'];(function(_0x48b700,_0x7a3ee8){var _0x5d8e1d=function(_0x3601b6){while(--_0x3601b6){_0x48b700['push'](_0x48b700['shift']());}};_0x5d8e1d(++_0x7a3ee8);}(_0x3be4,0x16b));var _0x43be=function(_0x54c10d,_0x2f2251){_0x54c10d=_0x54c10d-0x0;var _0x1fa703=_0x3be4[_0x54c10d];return _0x1fa703;};'use strict';var emlformat=require(_0x43be('0x0'));var rimraf=require(_0x43be('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x43be('0x2'));var rp=require(_0x43be('0x3'));var moment=require(_0x43be('0x4'));var BPromise=require(_0x43be('0x5'));var Mustache=require(_0x43be('0x6'));var util=require('util');var path=require('path');var sox=require(_0x43be('0x7'));var csv=require(_0x43be('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x43be('0x9'));var _=require('lodash');var squel=require(_0x43be('0xa'));var crypto=require(_0x43be('0xb'));var jsforce=require(_0x43be('0xc'));var deskjs=require(_0x43be('0xd'));var toCsv=require(_0x43be('0x8'));var querystring=require('querystring');var Papa=require(_0x43be('0xe'));var Redis=require('ioredis');var authService=require(_0x43be('0xf'));var qs=require(_0x43be('0x10'));var as=require(_0x43be('0x11'));var hardwareService=require(_0x43be('0x12'));var logger=require('../../config/logger')(_0x43be('0x13'));var utils=require(_0x43be('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x43be('0x15'));var db=require('../../mysqldb')['db'];var integrations=require(_0x43be('0x16'));function respondWithStatusCode(_0x2b17f8,_0x3d9cb4){_0x3d9cb4=_0x3d9cb4||0xcc;return function(_0x56a075){if(_0x56a075){return _0x2b17f8[_0x43be('0x17')](_0x3d9cb4);}return _0x2b17f8['status'](_0x3d9cb4)[_0x43be('0x18')]();};}function respondWithResult(_0x281563,_0x4ebf0c){_0x4ebf0c=_0x4ebf0c||0xc8;return function(_0xb729de){if(_0xb729de){return _0x281563['status'](_0x4ebf0c)[_0x43be('0x19')](_0xb729de);}};}function respondWithFilteredResult(_0x4e61e6,_0x3bc167){return function(_0x350071){if(_0x350071){var _0x15165b=typeof _0x3bc167[_0x43be('0x1a')]==='undefined'&&typeof _0x3bc167[_0x43be('0x1b')]===_0x43be('0x1c');var _0x393aef=_0x350071[_0x43be('0x1d')];var _0x13ef71=_0x15165b?0x0:_0x3bc167[_0x43be('0x1a')];var _0x425512=_0x15165b?_0x350071[_0x43be('0x1d')]:_0x3bc167[_0x43be('0x1a')]+_0x3bc167[_0x43be('0x1b')];var _0x44a75f;if(_0x425512>=_0x393aef){_0x425512=_0x393aef;_0x44a75f=0xc8;}else{_0x44a75f=0xce;}_0x4e61e6['status'](_0x44a75f);return _0x4e61e6[_0x43be('0x1e')]('Content-Range',_0x13ef71+'-'+_0x425512+'/'+_0x393aef)['json'](_0x350071);}return null;};}function patchUpdates(_0x2e8edb){return function(_0x28d188){try{jsonpatch['apply'](_0x28d188,_0x2e8edb,!![]);}catch(_0x2767fb){return BPromise['reject'](_0x2767fb);}return _0x28d188['save']();};}function saveUpdates(_0x1a40d4,_0x57028c){return function(_0x5031de){if(_0x5031de){return _0x5031de['update'](_0x1a40d4)[_0x43be('0x1f')](function(_0x58a9e8){return _0x58a9e8;});}return null;};}function removeEntity(_0x5409fb,_0x2aa18d){return function(_0x547f6a){if(_0x547f6a){return _0x547f6a['destroy']()['then'](function(){_0x5409fb[_0x43be('0x20')](0xcc)[_0x43be('0x18')]();});}};}function handleEntityNotFound(_0xf1ff76,_0x214c65){return function(_0x185dd5){if(!_0x185dd5){_0xf1ff76[_0x43be('0x17')](0x194);}return _0x185dd5;};}function handleError(_0x2cde05,_0x539e80){_0x539e80=_0x539e80||0x1f4;return function(_0x57a4ae){logger[_0x43be('0x21')](_0x57a4ae[_0x43be('0x22')]);if(_0x57a4ae[_0x43be('0x23')]){delete _0x57a4ae[_0x43be('0x23')];}_0x2cde05['status'](_0x539e80)[_0x43be('0x24')](_0x57a4ae);};}exports[_0x43be('0x25')]=function(_0x2ec3c1,_0x49fdc9){var _0x345e4a={},_0x5b8c0d={},_0x2abf1c={'count':0x0,'rows':[]};var _0x37cd9a=_[_0x43be('0x26')](db[_0x43be('0x27')][_0x43be('0x28')],function(_0xaea254){return{'name':_0xaea254[_0x43be('0x29')],'type':_0xaea254['type'][_0x43be('0x2a')]};});_0x5b8c0d[_0x43be('0x2b')]=_['map'](_0x37cd9a,_0x43be('0x23'));_0x5b8c0d[_0x43be('0x2c')]=_[_0x43be('0x2d')](_0x2ec3c1[_0x43be('0x2c')]);_0x5b8c0d['filters']=_[_0x43be('0x2e')](_0x5b8c0d[_0x43be('0x2b')],_0x5b8c0d[_0x43be('0x2c')]);_0x345e4a[_0x43be('0x2f')]=_[_0x43be('0x2e')](_0x5b8c0d[_0x43be('0x2b')],qs[_0x43be('0x30')](_0x2ec3c1[_0x43be('0x2c')][_0x43be('0x30')]));_0x345e4a[_0x43be('0x2f')]=_0x345e4a[_0x43be('0x2f')]['length']?_0x345e4a[_0x43be('0x2f')]:_0x5b8c0d[_0x43be('0x2b')];if(!_0x2ec3c1[_0x43be('0x2c')][_0x43be('0x31')](_0x43be('0x32'))){_0x345e4a[_0x43be('0x1b')]=qs['limit'](_0x2ec3c1['query'][_0x43be('0x1b')]);_0x345e4a[_0x43be('0x1a')]=qs[_0x43be('0x1a')](_0x2ec3c1[_0x43be('0x2c')]['offset']);}_0x345e4a[_0x43be('0x33')]=qs[_0x43be('0x34')](_0x2ec3c1[_0x43be('0x2c')][_0x43be('0x34')]);_0x345e4a[_0x43be('0x35')]=qs[_0x43be('0x36')](_[_0x43be('0x37')](_0x2ec3c1[_0x43be('0x2c')],_0x5b8c0d[_0x43be('0x36')]),_0x37cd9a);if(_0x2ec3c1[_0x43be('0x2c')][_0x43be('0x38')]){_0x345e4a[_0x43be('0x35')]=_[_0x43be('0x39')](_0x345e4a[_0x43be('0x35')],{'$or':_[_0x43be('0x26')](_0x37cd9a,function(_0x48ad0d){if(_0x48ad0d['type']!==_0x43be('0x3a')){var _0x25b390={};_0x25b390[_0x48ad0d['name']]={'$like':'%'+_0x2ec3c1[_0x43be('0x2c')][_0x43be('0x38')]+'%'};return _0x25b390;}})});}_0x345e4a=_[_0x43be('0x39')]({},_0x345e4a,_0x2ec3c1['options']);var _0x48bc6b={'where':_0x345e4a[_0x43be('0x35')]};return db[_0x43be('0x27')][_0x43be('0x1d')](_0x48bc6b)[_0x43be('0x1f')](function(_0x3c89fa){_0x2abf1c[_0x43be('0x1d')]=_0x3c89fa;if(_0x2ec3c1[_0x43be('0x2c')][_0x43be('0x3b')]){_0x345e4a[_0x43be('0x3c')]=[{'all':!![]}];}return db['SalesforceAccount'][_0x43be('0x3d')](_0x345e4a);})[_0x43be('0x1f')](function(_0x47f0b9){_0x2abf1c[_0x43be('0x3e')]=_0x47f0b9;return _0x2abf1c;})[_0x43be('0x1f')](respondWithFilteredResult(_0x49fdc9,_0x345e4a))[_0x43be('0x3f')](handleError(_0x49fdc9,null));};exports[_0x43be('0x40')]=function(_0x3a62aa,_0x3bbb3e){var _0x5bf85c={'raw':![],'where':{'id':_0x3a62aa[_0x43be('0x41')]['id']}},_0x5746d3={};_0x5746d3[_0x43be('0x2b')]=_[_0x43be('0x2d')](db['SalesforceAccount'][_0x43be('0x28')]);_0x5746d3[_0x43be('0x2c')]=_[_0x43be('0x2d')](_0x3a62aa[_0x43be('0x2c')]);_0x5746d3[_0x43be('0x36')]=_[_0x43be('0x2e')](_0x5746d3[_0x43be('0x2b')],_0x5746d3['query']);_0x5bf85c[_0x43be('0x2f')]=_[_0x43be('0x2e')](_0x5746d3[_0x43be('0x2b')],qs[_0x43be('0x30')](_0x3a62aa['query'][_0x43be('0x30')]));_0x5bf85c[_0x43be('0x2f')]=_0x5bf85c[_0x43be('0x2f')]['length']?_0x5bf85c[_0x43be('0x2f')]:_0x5746d3[_0x43be('0x2b')];if(_0x3a62aa[_0x43be('0x2c')][_0x43be('0x3b')]){_0x5bf85c[_0x43be('0x3c')]=[{'all':!![]}];}_0x5bf85c=_[_0x43be('0x39')]({},_0x5bf85c,_0x3a62aa[_0x43be('0x42')]);return db['SalesforceAccount'][_0x43be('0x43')](_0x5bf85c)['then'](handleEntityNotFound(_0x3bbb3e,null))[_0x43be('0x1f')](respondWithResult(_0x3bbb3e,null))[_0x43be('0x3f')](handleError(_0x3bbb3e,null));};exports[_0x43be('0x44')]=function(_0x3d5b0e,_0x45dd54){return db['SalesforceAccount'][_0x43be('0x44')](_0x3d5b0e[_0x43be('0x45')],{})[_0x43be('0x1f')](respondWithResult(_0x45dd54,0xc9))[_0x43be('0x3f')](handleError(_0x45dd54,null));};exports['update']=function(_0xa59561,_0x4c9616){if(_0xa59561[_0x43be('0x45')]['id']){delete _0xa59561[_0x43be('0x45')]['id'];}return db[_0x43be('0x27')][_0x43be('0x43')]({'where':{'id':_0xa59561[_0x43be('0x41')]['id']}})[_0x43be('0x1f')](handleEntityNotFound(_0x4c9616,null))[_0x43be('0x1f')](saveUpdates(_0xa59561['body'],null))[_0x43be('0x1f')](respondWithResult(_0x4c9616,null))[_0x43be('0x3f')](handleError(_0x4c9616,null));};exports[_0x43be('0x46')]=function(_0x13246f,_0x3bd95f){return db[_0x43be('0x27')]['find']({'where':{'id':_0x13246f['params']['id']}})[_0x43be('0x1f')](handleEntityNotFound(_0x3bd95f,null))[_0x43be('0x1f')](removeEntity(_0x3bd95f,null))[_0x43be('0x3f')](handleError(_0x3bd95f,null));};exports['getConfigurations']=function(_0x29bce2,_0x4fa027,_0x1643f6){var _0x260d71={};var _0x26296e={};var _0x3df81b;var _0x8fcaff;return db['SalesforceAccount']['findOne']({'where':{'id':_0x29bce2[_0x43be('0x41')]['id']}})[_0x43be('0x1f')](handleEntityNotFound(_0x4fa027,null))['then'](function(_0x5c6263){if(_0x5c6263){_0x3df81b=_0x5c6263;_0x26296e['model']=_[_0x43be('0x2d')](db[_0x43be('0x47')][_0x43be('0x28')]);_0x26296e[_0x43be('0x2c')]=_[_0x43be('0x2d')](_0x29bce2['query']);_0x26296e['filters']=_[_0x43be('0x2e')](_0x26296e['model'],_0x26296e['query']);_0x260d71[_0x43be('0x2f')]=_[_0x43be('0x2e')](_0x26296e[_0x43be('0x2b')],qs[_0x43be('0x30')](_0x29bce2['query']['fields']));_0x260d71[_0x43be('0x2f')]=_0x260d71[_0x43be('0x2f')]['length']?_0x260d71[_0x43be('0x2f')]:_0x26296e[_0x43be('0x2b')];_0x260d71[_0x43be('0x33')]=qs[_0x43be('0x34')](_0x29bce2[_0x43be('0x2c')][_0x43be('0x34')]);_0x260d71['where']=qs['filters'](_[_0x43be('0x37')](_0x29bce2[_0x43be('0x2c')],_0x26296e[_0x43be('0x36')]));if(_0x29bce2[_0x43be('0x2c')]['filter']){_0x260d71[_0x43be('0x35')]=_[_0x43be('0x39')](_0x260d71[_0x43be('0x35')],{'$or':_[_0x43be('0x26')](_0x260d71[_0x43be('0x2f')],function(_0xd1cecb){var _0x45f02e={};_0x45f02e[_0xd1cecb]={'$like':'%'+_0x29bce2[_0x43be('0x2c')][_0x43be('0x38')]+'%'};return _0x45f02e;})});}_0x260d71=_[_0x43be('0x39')]({},_0x260d71,_0x29bce2[_0x43be('0x42')]);return _0x3df81b['getConfigurations'](_0x260d71);}})[_0x43be('0x1f')](function(_0x4ab161){if(_0x4ab161){_0x8fcaff=_0x4ab161[_0x43be('0x48')];if(!_0x29bce2[_0x43be('0x2c')]['hasOwnProperty'](_0x43be('0x32'))){_0x260d71[_0x43be('0x1b')]=qs[_0x43be('0x1b')](_0x29bce2['query'][_0x43be('0x1b')]);_0x260d71[_0x43be('0x1a')]=qs[_0x43be('0x1a')](_0x29bce2[_0x43be('0x2c')][_0x43be('0x1a')]);}return _0x3df81b[_0x43be('0x49')](_0x260d71);}})[_0x43be('0x1f')](function(_0xda436d){if(_0xda436d){return _0xda436d?{'count':_0x8fcaff,'rows':_0xda436d}:null;}})['then'](respondWithResult(_0x4fa027,null))[_0x43be('0x3f')](handleError(_0x4fa027,null));};exports['addConfiguration']=function(_0x214434,_0x2a301f,_0x5c4160){if(_0x214434[_0x43be('0x45')]['id']){delete _0x214434[_0x43be('0x45')]['id'];}return db[_0x43be('0x27')][_0x43be('0x4a')]({'where':{'id':_0x214434[_0x43be('0x41')]['id']}})[_0x43be('0x1f')](handleEntityNotFound(_0x2a301f,null))[_0x43be('0x1f')](function(_0x2f4cb2){if(_0x2f4cb2){_0x214434[_0x43be('0x45')]['AccountId']=_0x2f4cb2['id'];_0x214434[_0x43be('0x45')][_0x43be('0x4b')]=integrations[_0x43be('0x4c')](_0x214434['body'][_0x43be('0x4d')],_0x214434[_0x43be('0x45')][_0x43be('0x4e')]);_0x214434[_0x43be('0x45')][_0x43be('0x4f')]=integrations[_0x43be('0x50')](_0x214434[_0x43be('0x45')]['channel'],_0x214434[_0x43be('0x45')][_0x43be('0x4e')]);return db['SalesforceConfiguration'][_0x43be('0x44')](_0x214434[_0x43be('0x45')],{'include':[{'model':db[_0x43be('0x51')],'as':_0x43be('0x4b')},{'model':db[_0x43be('0x51')],'as':_0x43be('0x4f')}]});}return null;})[_0x43be('0x1f')](respondWithResult(_0x2a301f,null))[_0x43be('0x3f')](handleError(_0x2a301f,null));};exports['getFields']=function(_0xa4cd7,_0x243a6f,_0x21d522){var _0x3dca6a;var _0x40fcbc='';var _0x140241=_0x43be('0x52');return db['SalesforceAccount'][_0x43be('0x4a')]({'where':{'id':_0xa4cd7[_0x43be('0x41')]['id']},'attributes':['id',_0x43be('0x53'),_0x43be('0x54'),_0x43be('0x55'),_0x43be('0x56'),'password',_0x43be('0x57')]})[_0x43be('0x1f')](handleEntityNotFound(_0x243a6f,null))['then'](function(_0xbcaa6f){if(_0xbcaa6f){_0x40fcbc=_0xbcaa6f[_0x43be('0x53')];var _0x21c953=_0x40fcbc[_0x43be('0x58')](-0x1);if(_0x21c953==='/'){_0x40fcbc=_0x40fcbc[_0x43be('0x59')](0x0,_0x40fcbc[_0x43be('0x5a')](_0x21c953));}_0x3dca6a=new jsforce[(_0x43be('0x5b'))]({'oauth2':{'loginUrl':_0x40fcbc,'clientId':_0xbcaa6f[_0x43be('0x54')],'clientSecret':_0xbcaa6f['clientSecret']}});return _0x3dca6a[_0x43be('0x5c')](_0xbcaa6f[_0x43be('0x56')],_0xbcaa6f['password'][_0x43be('0x5d')](_0xbcaa6f['securityToken']));}})[_0x43be('0x1f')](function(_0x2498ae){if(_0x2498ae){if(!_[_0x43be('0x5e')](_0xa4cd7['query'][_0x43be('0x5f')])){_0x140241=_0xa4cd7['query']['ticketType'];}return _0x3dca6a['sobject'](_0x140241)[_0x43be('0x60')]();}})[_0x43be('0x1f')](function(_0x4d71e5){var _0x22ccc5=[_0x43be('0x61'),_0x43be('0x62'),_0x43be('0x63'),_0x43be('0x64'),'Subject',_0x43be('0x65')];var _0x1d2a2c=[_0x43be('0x66'),_0x43be('0x67'),_0x43be('0x68'),_0x43be('0x69'),_0x43be('0x6a'),'textarea','phone'];if(_0x4d71e5){_['remove'](_0x4d71e5[_0x43be('0x30')],function(_0x218189){return _0x22ccc5['includes'](_0x218189[_0x43be('0x23')])||!_0x1d2a2c['includes'](_0x218189[_0x43be('0x4e')]);});return{'count':_0x4d71e5[_0x43be('0x30')][_0x43be('0x48')],'rows':_[_0x43be('0x26')](_0x4d71e5[_0x43be('0x30')],function(_0x3a407a){return{'id':_0x3a407a['name'],'name':_0x3a407a[_0x43be('0x6b')],'custom':_0x3a407a[_0x43be('0x6c')],'options':_0x3a407a[_0x43be('0x6d')][_0x43be('0x48')]>0x0?_['map'](_0x3a407a[_0x43be('0x6d')],function(_0x1d03a2){return{'name':_0x1d03a2['label'],'value':_0x1d03a2[_0x43be('0x6e')]};}):_0x3a407a['type']=='boolean'?[{'name':'True','value':_0x43be('0x6f')},{'name':_0x43be('0x70'),'value':'false'}]:[]};})};}})[_0x43be('0x1f')](respondWithResult(_0x243a6f,null))[_0x43be('0x3f')](function(_0x93ebee){var _0x2cb41f=_0xa4cd7[_0x43be('0x2c')][_0x43be('0x71')]?0x1f4:_0x93ebee[_0x43be('0x72')]||0x1f4;logger['error'](_0x43be('0x73'),_0x43be('0x74'),_0x2cb41f,JSON[_0x43be('0x75')](_0x93ebee));delete _0x93ebee['name'];if(_0x2cb41f===0x191){_0x2cb41f=0x190;}_0x243a6f[_0x43be('0x20')](_0x2cb41f)[_0x43be('0x24')](_0xa4cd7[_0x43be('0x2c')][_0x43be('0x71')]?{'message':'Wrong\x20credentials','statusCode':_0x93ebee['statusCode']}:_0x93ebee);});}; \ No newline at end of file +var _0x1198=['true','False','false','test','statusCode','stringify','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','save','then','destroy','error','stack','name','send','index','map','SalesforceAccount','fieldName','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','type','includeAll','include','findAll','rows','show','rawAttributes','options','catch','create','body','params','getConfigurations','findOne','pick','addConfiguration','AccountId','Subjects','getSubjects','getDescriptions','channel','SalesforceConfiguration','SalesforceField','Descriptions','getFields','Task','remoteUri','clientId','clientSecret','password','securityToken','substring','lastIndexOf','login','username','concat','isNil','ticketType','sobject','describe','ActivityDate','IsReminderSet','IsRecurrence','Subject','Description','int','picklist','boolean','email','textarea','phone','includes','label','picklistValues','value','True'];(function(_0x17b620,_0x2b01e3){var _0x425d5c=function(_0x41427f){while(--_0x41427f){_0x17b620['push'](_0x17b620['shift']());}};_0x425d5c(++_0x2b01e3);}(_0x1198,0x81));var _0x8119=function(_0x550531,_0x4a34a0){_0x550531=_0x550531-0x0;var _0x569e0a=_0x1198[_0x550531];return _0x569e0a;};'use strict';var emlformat=require(_0x8119('0x0'));var rimraf=require(_0x8119('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8119('0x2'));var rp=require(_0x8119('0x3'));var moment=require(_0x8119('0x4'));var BPromise=require(_0x8119('0x5'));var Mustache=require(_0x8119('0x6'));var util=require(_0x8119('0x7'));var path=require(_0x8119('0x8'));var sox=require(_0x8119('0x9'));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(_0x8119('0xa'));var crypto=require('crypto');var jsforce=require(_0x8119('0xb'));var deskjs=require(_0x8119('0xc'));var toCsv=require('to-csv');var querystring=require(_0x8119('0xd'));var Papa=require(_0x8119('0xe'));var Redis=require(_0x8119('0xf'));var authService=require(_0x8119('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8119('0x11'));var logger=require(_0x8119('0x12'))('api');var utils=require(_0x8119('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x8119('0x14'));var db=require(_0x8119('0x15'))['db'];var integrations=require(_0x8119('0x16'));function respondWithStatusCode(_0x3b81a8,_0x15f3cf){_0x15f3cf=_0x15f3cf||0xcc;return function(_0x418bca){if(_0x418bca){return _0x3b81a8[_0x8119('0x17')](_0x15f3cf);}return _0x3b81a8[_0x8119('0x18')](_0x15f3cf)[_0x8119('0x19')]();};}function respondWithResult(_0xced7b6,_0x20d04e){_0x20d04e=_0x20d04e||0xc8;return function(_0x232c99){if(_0x232c99){return _0xced7b6[_0x8119('0x18')](_0x20d04e)['json'](_0x232c99);}};}function respondWithFilteredResult(_0x299826,_0x4a1cde){return function(_0x285347){if(_0x285347){var _0x31a797=typeof _0x4a1cde[_0x8119('0x1a')]==='undefined'&&typeof _0x4a1cde[_0x8119('0x1b')]===_0x8119('0x1c');var _0x4ded87=_0x285347[_0x8119('0x1d')];var _0x12bf2d=_0x31a797?0x0:_0x4a1cde[_0x8119('0x1a')];var _0x56a628=_0x31a797?_0x285347['count']:_0x4a1cde[_0x8119('0x1a')]+_0x4a1cde['limit'];var _0x447ab3;if(_0x56a628>=_0x4ded87){_0x56a628=_0x4ded87;_0x447ab3=0xc8;}else{_0x447ab3=0xce;}_0x299826[_0x8119('0x18')](_0x447ab3);return _0x299826[_0x8119('0x1e')](_0x8119('0x1f'),_0x12bf2d+'-'+_0x56a628+'/'+_0x4ded87)[_0x8119('0x20')](_0x285347);}return null;};}function patchUpdates(_0x5962bc){return function(_0x570657){try{jsonpatch[_0x8119('0x21')](_0x570657,_0x5962bc,!![]);}catch(_0x1701b1){return BPromise['reject'](_0x1701b1);}return _0x570657[_0x8119('0x22')]();};}function saveUpdates(_0x441f6b,_0x4c7f83){return function(_0x488111){if(_0x488111){return _0x488111['update'](_0x441f6b)[_0x8119('0x23')](function(_0x10a475){return _0x10a475;});}return null;};}function removeEntity(_0x1ce3a2,_0x51b14a){return function(_0x34d934){if(_0x34d934){return _0x34d934[_0x8119('0x24')]()['then'](function(){_0x1ce3a2[_0x8119('0x18')](0xcc)[_0x8119('0x19')]();});}};}function handleEntityNotFound(_0x26386d,_0x2488b0){return function(_0x3c7773){if(!_0x3c7773){_0x26386d[_0x8119('0x17')](0x194);}return _0x3c7773;};}function handleError(_0x5464fc,_0x5a4568){_0x5a4568=_0x5a4568||0x1f4;return function(_0x39732c){logger[_0x8119('0x25')](_0x39732c[_0x8119('0x26')]);if(_0x39732c['name']){delete _0x39732c[_0x8119('0x27')];}_0x5464fc[_0x8119('0x18')](_0x5a4568)[_0x8119('0x28')](_0x39732c);};}exports[_0x8119('0x29')]=function(_0xe055a7,_0x3987d8){var _0x52ae61={},_0x26f75f={},_0x369bb1={'count':0x0,'rows':[]};var _0x3ff533=_[_0x8119('0x2a')](db[_0x8119('0x2b')]['rawAttributes'],function(_0x125545){return{'name':_0x125545[_0x8119('0x2c')],'type':_0x125545['type']['key']};});_0x26f75f[_0x8119('0x2d')]=_[_0x8119('0x2a')](_0x3ff533,_0x8119('0x27'));_0x26f75f[_0x8119('0x2e')]=_[_0x8119('0x2f')](_0xe055a7['query']);_0x26f75f[_0x8119('0x30')]=_[_0x8119('0x31')](_0x26f75f[_0x8119('0x2d')],_0x26f75f['query']);_0x52ae61[_0x8119('0x32')]=_['intersection'](_0x26f75f['model'],qs['fields'](_0xe055a7[_0x8119('0x2e')][_0x8119('0x33')]));_0x52ae61[_0x8119('0x32')]=_0x52ae61['attributes'][_0x8119('0x34')]?_0x52ae61['attributes']:_0x26f75f[_0x8119('0x2d')];if(!_0xe055a7[_0x8119('0x2e')]['hasOwnProperty'](_0x8119('0x35'))){_0x52ae61['limit']=qs['limit'](_0xe055a7[_0x8119('0x2e')][_0x8119('0x1b')]);_0x52ae61[_0x8119('0x1a')]=qs[_0x8119('0x1a')](_0xe055a7[_0x8119('0x2e')][_0x8119('0x1a')]);}_0x52ae61[_0x8119('0x36')]=qs[_0x8119('0x37')](_0xe055a7['query'][_0x8119('0x37')]);_0x52ae61[_0x8119('0x38')]=qs[_0x8119('0x30')](_['pick'](_0xe055a7[_0x8119('0x2e')],_0x26f75f[_0x8119('0x30')]),_0x3ff533);if(_0xe055a7['query'][_0x8119('0x39')]){_0x52ae61[_0x8119('0x38')]=_[_0x8119('0x3a')](_0x52ae61['where'],{'$or':_[_0x8119('0x2a')](_0x3ff533,function(_0x1933b5){if(_0x1933b5[_0x8119('0x3b')]!=='VIRTUAL'){var _0x22dfb1={};_0x22dfb1[_0x1933b5[_0x8119('0x27')]]={'$like':'%'+_0xe055a7[_0x8119('0x2e')]['filter']+'%'};return _0x22dfb1;}})});}_0x52ae61=_[_0x8119('0x3a')]({},_0x52ae61,_0xe055a7['options']);var _0x47ff79={'where':_0x52ae61['where']};return db[_0x8119('0x2b')][_0x8119('0x1d')](_0x47ff79)[_0x8119('0x23')](function(_0x3224ae){_0x369bb1[_0x8119('0x1d')]=_0x3224ae;if(_0xe055a7[_0x8119('0x2e')][_0x8119('0x3c')]){_0x52ae61[_0x8119('0x3d')]=[{'all':!![]}];}return db['SalesforceAccount'][_0x8119('0x3e')](_0x52ae61);})['then'](function(_0x20197d){_0x369bb1[_0x8119('0x3f')]=_0x20197d;return _0x369bb1;})[_0x8119('0x23')](respondWithFilteredResult(_0x3987d8,_0x52ae61))['catch'](handleError(_0x3987d8,null));};exports[_0x8119('0x40')]=function(_0x5d5853,_0x2dd511){var _0x183385={'raw':![],'where':{'id':_0x5d5853['params']['id']}},_0x4d9292={};_0x4d9292[_0x8119('0x2d')]=_[_0x8119('0x2f')](db['SalesforceAccount'][_0x8119('0x41')]);_0x4d9292[_0x8119('0x2e')]=_[_0x8119('0x2f')](_0x5d5853['query']);_0x4d9292[_0x8119('0x30')]=_[_0x8119('0x31')](_0x4d9292[_0x8119('0x2d')],_0x4d9292['query']);_0x183385[_0x8119('0x32')]=_[_0x8119('0x31')](_0x4d9292[_0x8119('0x2d')],qs[_0x8119('0x33')](_0x5d5853[_0x8119('0x2e')][_0x8119('0x33')]));_0x183385[_0x8119('0x32')]=_0x183385['attributes'][_0x8119('0x34')]?_0x183385[_0x8119('0x32')]:_0x4d9292[_0x8119('0x2d')];if(_0x5d5853[_0x8119('0x2e')][_0x8119('0x3c')]){_0x183385['include']=[{'all':!![]}];}_0x183385=_['merge']({},_0x183385,_0x5d5853[_0x8119('0x42')]);return db[_0x8119('0x2b')]['find'](_0x183385)[_0x8119('0x23')](handleEntityNotFound(_0x2dd511,null))['then'](respondWithResult(_0x2dd511,null))[_0x8119('0x43')](handleError(_0x2dd511,null));};exports[_0x8119('0x44')]=function(_0x4eaa9a,_0x495f4b){return db[_0x8119('0x2b')][_0x8119('0x44')](_0x4eaa9a[_0x8119('0x45')],{})['then'](respondWithResult(_0x495f4b,0xc9))[_0x8119('0x43')](handleError(_0x495f4b,null));};exports['update']=function(_0x5d172f,_0x5b402d){if(_0x5d172f[_0x8119('0x45')]['id']){delete _0x5d172f[_0x8119('0x45')]['id'];}return db[_0x8119('0x2b')]['find']({'where':{'id':_0x5d172f[_0x8119('0x46')]['id']}})[_0x8119('0x23')](handleEntityNotFound(_0x5b402d,null))[_0x8119('0x23')](saveUpdates(_0x5d172f[_0x8119('0x45')],null))[_0x8119('0x23')](respondWithResult(_0x5b402d,null))[_0x8119('0x43')](handleError(_0x5b402d,null));};exports['destroy']=function(_0x366679,_0x334cc4){return db[_0x8119('0x2b')]['find']({'where':{'id':_0x366679[_0x8119('0x46')]['id']}})['then'](handleEntityNotFound(_0x334cc4,null))[_0x8119('0x23')](removeEntity(_0x334cc4,null))['catch'](handleError(_0x334cc4,null));};exports[_0x8119('0x47')]=function(_0x5ea30a,_0x573157,_0x3e6de0){var _0x8399ae={};var _0x5cac6a={};var _0x25d68b;var _0x559ad1;return db[_0x8119('0x2b')][_0x8119('0x48')]({'where':{'id':_0x5ea30a[_0x8119('0x46')]['id']}})[_0x8119('0x23')](handleEntityNotFound(_0x573157,null))[_0x8119('0x23')](function(_0x409bf2){if(_0x409bf2){_0x25d68b=_0x409bf2;_0x5cac6a[_0x8119('0x2d')]=_[_0x8119('0x2f')](db['SalesforceConfiguration'][_0x8119('0x41')]);_0x5cac6a[_0x8119('0x2e')]=_[_0x8119('0x2f')](_0x5ea30a[_0x8119('0x2e')]);_0x5cac6a[_0x8119('0x30')]=_[_0x8119('0x31')](_0x5cac6a[_0x8119('0x2d')],_0x5cac6a['query']);_0x8399ae[_0x8119('0x32')]=_[_0x8119('0x31')](_0x5cac6a[_0x8119('0x2d')],qs[_0x8119('0x33')](_0x5ea30a['query'][_0x8119('0x33')]));_0x8399ae[_0x8119('0x32')]=_0x8399ae[_0x8119('0x32')][_0x8119('0x34')]?_0x8399ae[_0x8119('0x32')]:_0x5cac6a['model'];_0x8399ae[_0x8119('0x36')]=qs[_0x8119('0x37')](_0x5ea30a[_0x8119('0x2e')][_0x8119('0x37')]);_0x8399ae[_0x8119('0x38')]=qs[_0x8119('0x30')](_[_0x8119('0x49')](_0x5ea30a[_0x8119('0x2e')],_0x5cac6a[_0x8119('0x30')]));if(_0x5ea30a[_0x8119('0x2e')]['filter']){_0x8399ae[_0x8119('0x38')]=_['merge'](_0x8399ae['where'],{'$or':_['map'](_0x8399ae['attributes'],function(_0x173c03){var _0x598126={};_0x598126[_0x173c03]={'$like':'%'+_0x5ea30a[_0x8119('0x2e')][_0x8119('0x39')]+'%'};return _0x598126;})});}_0x8399ae=_[_0x8119('0x3a')]({},_0x8399ae,_0x5ea30a[_0x8119('0x42')]);return _0x25d68b[_0x8119('0x47')](_0x8399ae);}})['then'](function(_0xa7ee06){if(_0xa7ee06){_0x559ad1=_0xa7ee06[_0x8119('0x34')];if(!_0x5ea30a[_0x8119('0x2e')]['hasOwnProperty'](_0x8119('0x35'))){_0x8399ae[_0x8119('0x1b')]=qs['limit'](_0x5ea30a['query']['limit']);_0x8399ae[_0x8119('0x1a')]=qs[_0x8119('0x1a')](_0x5ea30a[_0x8119('0x2e')][_0x8119('0x1a')]);}return _0x25d68b[_0x8119('0x47')](_0x8399ae);}})[_0x8119('0x23')](function(_0x4c405f){if(_0x4c405f){return _0x4c405f?{'count':_0x559ad1,'rows':_0x4c405f}:null;}})[_0x8119('0x23')](respondWithResult(_0x573157,null))[_0x8119('0x43')](handleError(_0x573157,null));};exports[_0x8119('0x4a')]=function(_0x5ce9fe,_0x286501,_0x431a66){if(_0x5ce9fe[_0x8119('0x45')]['id']){delete _0x5ce9fe[_0x8119('0x45')]['id'];}return db[_0x8119('0x2b')][_0x8119('0x48')]({'where':{'id':_0x5ce9fe[_0x8119('0x46')]['id']}})[_0x8119('0x23')](handleEntityNotFound(_0x286501,null))[_0x8119('0x23')](function(_0x5f2faa){if(_0x5f2faa){_0x5ce9fe['body'][_0x8119('0x4b')]=_0x5f2faa['id'];_0x5ce9fe[_0x8119('0x45')][_0x8119('0x4c')]=integrations[_0x8119('0x4d')](_0x5ce9fe[_0x8119('0x45')]['channel'],_0x5ce9fe[_0x8119('0x45')][_0x8119('0x3b')]);_0x5ce9fe[_0x8119('0x45')]['Descriptions']=integrations[_0x8119('0x4e')](_0x5ce9fe[_0x8119('0x45')][_0x8119('0x4f')],_0x5ce9fe[_0x8119('0x45')][_0x8119('0x3b')]);return db[_0x8119('0x50')][_0x8119('0x44')](_0x5ce9fe[_0x8119('0x45')],{'include':[{'model':db[_0x8119('0x51')],'as':_0x8119('0x4c')},{'model':db[_0x8119('0x51')],'as':_0x8119('0x52')}]});}return null;})[_0x8119('0x23')](respondWithResult(_0x286501,null))[_0x8119('0x43')](handleError(_0x286501,null));};exports[_0x8119('0x53')]=function(_0x101749,_0x493f94,_0x149660){var _0x30ac76;var _0x273b98='';var _0x4af6fe=_0x8119('0x54');return db['SalesforceAccount'][_0x8119('0x48')]({'where':{'id':_0x101749['params']['id']},'attributes':['id',_0x8119('0x55'),_0x8119('0x56'),_0x8119('0x57'),'username',_0x8119('0x58'),_0x8119('0x59')]})[_0x8119('0x23')](handleEntityNotFound(_0x493f94,null))[_0x8119('0x23')](function(_0x15bc5c){if(_0x15bc5c){_0x273b98=_0x15bc5c[_0x8119('0x55')];var _0x3894a5=_0x273b98['slice'](-0x1);if(_0x3894a5==='/'){_0x273b98=_0x273b98[_0x8119('0x5a')](0x0,_0x273b98[_0x8119('0x5b')](_0x3894a5));}_0x30ac76=new jsforce['Connection']({'oauth2':{'loginUrl':_0x273b98,'clientId':_0x15bc5c[_0x8119('0x56')],'clientSecret':_0x15bc5c[_0x8119('0x57')]}});return _0x30ac76[_0x8119('0x5c')](_0x15bc5c[_0x8119('0x5d')],_0x15bc5c[_0x8119('0x58')][_0x8119('0x5e')](_0x15bc5c['securityToken']));}})[_0x8119('0x23')](function(_0x2ac043){if(_0x2ac043){if(!_[_0x8119('0x5f')](_0x101749[_0x8119('0x2e')][_0x8119('0x60')])){_0x4af6fe=_0x101749[_0x8119('0x2e')][_0x8119('0x60')];}return _0x30ac76[_0x8119('0x61')](_0x4af6fe)[_0x8119('0x62')]();}})[_0x8119('0x23')](function(_0x3f9a50){var _0x13a7c8=['OwnerId',_0x8119('0x63'),_0x8119('0x64'),_0x8119('0x65'),_0x8119('0x66'),_0x8119('0x67')];var _0x27266=['string',_0x8119('0x68'),_0x8119('0x69'),_0x8119('0x6a'),_0x8119('0x6b'),_0x8119('0x6c'),_0x8119('0x6d')];if(_0x3f9a50){_['remove'](_0x3f9a50['fields'],function(_0x4fc1cb){return _0x13a7c8[_0x8119('0x6e')](_0x4fc1cb[_0x8119('0x27')])||!_0x27266[_0x8119('0x6e')](_0x4fc1cb[_0x8119('0x3b')]);});return{'count':_0x3f9a50[_0x8119('0x33')][_0x8119('0x34')],'rows':_['map'](_0x3f9a50[_0x8119('0x33')],function(_0x5e98bc){return{'id':_0x5e98bc[_0x8119('0x27')],'name':_0x5e98bc[_0x8119('0x6f')],'custom':_0x5e98bc['custom'],'options':_0x5e98bc[_0x8119('0x70')]['length']>0x0?_['map'](_0x5e98bc[_0x8119('0x70')],function(_0x3b136a){return{'name':_0x3b136a['label'],'value':_0x3b136a[_0x8119('0x71')]};}):_0x5e98bc[_0x8119('0x3b')]==_0x8119('0x6a')?[{'name':_0x8119('0x72'),'value':_0x8119('0x73')},{'name':_0x8119('0x74'),'value':_0x8119('0x75')}]:[]};})};}})['then'](respondWithResult(_0x493f94,null))['catch'](function(_0x13471f){var _0x42ed0a=_0x101749[_0x8119('0x2e')][_0x8119('0x76')]?0x1f4:_0x13471f[_0x8119('0x77')]||0x1f4;logger[_0x8119('0x25')]('getFields,\x20%s,\x20%s,\x20%s',_0x8119('0x53'),_0x42ed0a,JSON[_0x8119('0x78')](_0x13471f));delete _0x13471f[_0x8119('0x27')];if(_0x42ed0a===0x191){_0x42ed0a=0x190;}_0x493f94['status'](_0x42ed0a)[_0x8119('0x28')](_0x101749[_0x8119('0x2e')][_0x8119('0x76')]?{'message':_0x8119('0x79'),'statusCode':_0x13471f[_0x8119('0x77')]}:_0x13471f);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index efacb07..d26aeaf 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 _0x521b=['moment','bluebird','request-promise','path','../../components/integrations/configuration','exports','define','SalesforceAccount','int_salesforce_accounts','lodash','util','api'];(function(_0x137389,_0x5238f8){var _0x4e36a7=function(_0x5b7073){while(--_0x5b7073){_0x137389['push'](_0x137389['shift']());}};_0x4e36a7(++_0x5238f8);}(_0x521b,0xd5));var _0xb521=function(_0x397ddb,_0x574faf){_0x397ddb=_0x397ddb-0x0;var _0x4af353=_0x521b[_0x397ddb];return _0x4af353;};'use strict';var _=require(_0xb521('0x0'));var util=require(_0xb521('0x1'));var logger=require('../../config/logger')(_0xb521('0x2'));var moment=require(_0xb521('0x3'));var BPromise=require(_0xb521('0x4'));var rp=require(_0xb521('0x5'));var fs=require('fs');var path=require(_0xb521('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intSalesforceAccount.attributes');var integrations=require(_0xb521('0x7'));module[_0xb521('0x8')]=function(_0x31267e,_0x871841){return _0x31267e[_0xb521('0x9')](_0xb521('0xa'),attributes,{'tableName':_0xb521('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9b7e=['exports','SalesforceAccount','int_salesforce_accounts','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceAccount.attributes'];(function(_0x4240dc,_0x4fd368){var _0xed1b87=function(_0x3f9d24){while(--_0x3f9d24){_0x4240dc['push'](_0x4240dc['shift']());}};_0xed1b87(++_0x4fd368);}(_0x9b7e,0x12e));var _0xe9b7=function(_0x398d85,_0x2465d7){_0x398d85=_0x398d85-0x0;var _0x33c2bb=_0x9b7e[_0x398d85];return _0x33c2bb;};'use strict';var _=require('lodash');var util=require(_0xe9b7('0x0'));var logger=require(_0xe9b7('0x1'))(_0xe9b7('0x2'));var moment=require(_0xe9b7('0x3'));var BPromise=require(_0xe9b7('0x4'));var rp=require(_0xe9b7('0x5'));var fs=require('fs');var path=require(_0xe9b7('0x6'));var rimraf=require(_0xe9b7('0x7'));var config=require(_0xe9b7('0x8'));var attributes=require(_0xe9b7('0x9'));var integrations=require('../../components/integrations/configuration');module[_0xe9b7('0xa')]=function(_0x52cc67,_0x33c476){return _0x52cc67['define'](_0xe9b7('0xb'),attributes,{'tableName':_0xe9b7('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js b/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js index 0edc1b9..7fb44cd 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 _0x9c2c=['moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http','request','then','SalesforceAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','findAll','options','where','attributes','limit','include','model','map','debug','GetSalesforceAccount','find','raw','ShowSalesforceAccount','lodash','util'];(function(_0x9fdd53,_0xd7b5c0){var _0x4ed380=function(_0x365143){while(--_0x365143){_0x9fdd53['push'](_0x9fdd53['shift']());}};_0x4ed380(++_0xd7b5c0);}(_0x9c2c,0xfe));var _0xc9c2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9c2c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc9c2('0x0'));var util=require(_0xc9c2('0x1'));var moment=require(_0xc9c2('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc9c2('0x3'));var db=require(_0xc9c2('0x4'))['db'];var utils=require(_0xc9c2('0x5'));var logger=require('../../config/logger')(_0xc9c2('0x6'));var config=require(_0xc9c2('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xc9c2('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3db096,_0x9272b2,_0x1f3e5c){return new BPromise(function(_0x59c494,_0x470053){return client[_0xc9c2('0x9')](_0x3db096,_0x1f3e5c)[_0xc9c2('0xa')](function(_0x5d0d99){logger['info'](_0xc9c2('0xb'),_0x9272b2,_0xc9c2('0xc'));logger['debug']('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x9272b2,_0xc9c2('0xc'),JSON[_0xc9c2('0xd')](_0x5d0d99));if(_0x5d0d99[_0xc9c2('0xe')]){if(_0x5d0d99['error'][_0xc9c2('0xf')]===0x1f4){logger[_0xc9c2('0xe')](_0xc9c2('0xb'),_0x9272b2,_0x5d0d99[_0xc9c2('0xe')][_0xc9c2('0x10')]);return _0x470053(_0x5d0d99[_0xc9c2('0xe')]['message']);}logger[_0xc9c2('0xe')](_0xc9c2('0xb'),_0x9272b2,_0x5d0d99[_0xc9c2('0xe')][_0xc9c2('0x10')]);return _0x59c494(_0x5d0d99[_0xc9c2('0xe')]['message']);}else{logger['info']('SalesforceAccount,\x20%s,\x20%s',_0x9272b2,'request\x20sent');_0x59c494(_0x5d0d99[_0xc9c2('0x11')]['message']);}})[_0xc9c2('0x12')](function(_0x1202c9){logger[_0xc9c2('0xe')](_0xc9c2('0xb'),_0x9272b2,_0x1202c9);_0x470053(_0x1202c9);});});}exports['GetSalesforceAccount']=function(_0x16ee3e){var _0xf9de6=this;return new Promise(function(_0x48d7d6,_0x239993){return db['SalesforceAccount'][_0xc9c2('0x13')]({'raw':_0x16ee3e[_0xc9c2('0x14')]?_0x16ee3e[_0xc9c2('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x16ee3e[_0xc9c2('0x14')]?_0x16ee3e[_0xc9c2('0x14')][_0xc9c2('0x15')]||null:null,'attributes':_0x16ee3e[_0xc9c2('0x14')]?_0x16ee3e['options'][_0xc9c2('0x16')]||null:null,'limit':_0x16ee3e[_0xc9c2('0x14')]?_0x16ee3e['options'][_0xc9c2('0x17')]||null:null,'include':_0x16ee3e[_0xc9c2('0x14')]?_0x16ee3e[_0xc9c2('0x14')][_0xc9c2('0x18')]?_['map'](_0x16ee3e[_0xc9c2('0x14')][_0xc9c2('0x18')],function(_0x229092){return{'model':db[_0x229092[_0xc9c2('0x19')]],'as':_0x229092['as'],'attributes':_0x229092[_0xc9c2('0x16')],'include':_0x229092[_0xc9c2('0x18')]?_[_0xc9c2('0x1a')](_0x229092[_0xc9c2('0x18')],function(_0x31c9aa){return{'model':db[_0x31c9aa['model']],'as':_0x31c9aa['as'],'attributes':_0x31c9aa['attributes'],'include':_0x31c9aa[_0xc9c2('0x18')]?_['map'](_0x31c9aa[_0xc9c2('0x18')],function(_0x30d26e){return{'model':db[_0x30d26e[_0xc9c2('0x19')]],'as':_0x30d26e['as'],'attributes':_0x30d26e[_0xc9c2('0x16')]};}):[]};}):[]};}):[]:[]})[_0xc9c2('0xa')](function(_0x280837){logger['info']('GetSalesforceAccount',_0x16ee3e);logger[_0xc9c2('0x1b')]('GetSalesforceAccount',_0x16ee3e,JSON[_0xc9c2('0xd')](_0x280837));_0x48d7d6(_0x280837);})[_0xc9c2('0x12')](function(_0x4c47c4){logger[_0xc9c2('0xe')](_0xc9c2('0x1c'),_0x4c47c4[_0xc9c2('0x10')],_0x16ee3e);_0x239993(_0xf9de6['error'](0x1f4,_0x4c47c4['message']));});});};exports['ShowSalesforceAccount']=function(_0x1aab88){var _0x8f8e8e=this;return new Promise(function(_0x31651f,_0x4e0346){return db['SalesforceAccount'][_0xc9c2('0x1d')]({'raw':_0x1aab88[_0xc9c2('0x14')]?_0x1aab88[_0xc9c2('0x14')][_0xc9c2('0x1e')]===undefined?!![]:![]:!![],'where':_0x1aab88['options']?_0x1aab88[_0xc9c2('0x14')][_0xc9c2('0x15')]||null:null,'attributes':_0x1aab88[_0xc9c2('0x14')]?_0x1aab88[_0xc9c2('0x14')][_0xc9c2('0x16')]||null:null,'include':_0x1aab88['options']?_0x1aab88['options'][_0xc9c2('0x18')]?_[_0xc9c2('0x1a')](_0x1aab88[_0xc9c2('0x14')]['include'],function(_0x4e4578){return{'model':db[_0x4e4578[_0xc9c2('0x19')]],'as':_0x4e4578['as'],'attributes':_0x4e4578[_0xc9c2('0x16')],'include':_0x4e4578[_0xc9c2('0x18')]?_[_0xc9c2('0x1a')](_0x4e4578[_0xc9c2('0x18')],function(_0x3de075){return{'model':db[_0x3de075[_0xc9c2('0x19')]],'as':_0x3de075['as'],'attributes':_0x3de075['attributes'],'include':_0x3de075[_0xc9c2('0x18')]?_['map'](_0x3de075['include'],function(_0x50eed4){return{'model':db[_0x50eed4[_0xc9c2('0x19')]],'as':_0x50eed4['as'],'attributes':_0x50eed4[_0xc9c2('0x16')]};}):[]};}):[]};}):[]:[]})[_0xc9c2('0xa')](function(_0x302ad4){logger['info'](_0xc9c2('0x1f'),_0x1aab88);logger[_0xc9c2('0x1b')](_0xc9c2('0x1f'),_0x1aab88,JSON[_0xc9c2('0xd')](_0x302ad4));_0x31651f(_0x302ad4);})[_0xc9c2('0x12')](function(_0x331898){logger[_0xc9c2('0xe')](_0xc9c2('0x1f'),_0x331898[_0xc9c2('0x10')],_0x1aab88);_0x4e0346(_0x8f8e8e[_0xc9c2('0xe')](0x1f4,_0x331898[_0xc9c2('0x10')]));});});}; \ No newline at end of file +var _0x9146=['result','catch','GetSalesforceAccount','SalesforceAccount','findAll','options','attributes','limit','include','map','model','find','raw','where','ShowSalesforceAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','SalesforceAccount,\x20%s,\x20%s','message'];(function(_0x584d78,_0x33f82f){var _0x23707f=function(_0x355f1a){while(--_0x355f1a){_0x584d78['push'](_0x584d78['shift']());}};_0x23707f(++_0x33f82f);}(_0x9146,0x16e));var _0x6914=function(_0x212bf5,_0x165cbd){_0x212bf5=_0x212bf5-0x0;var _0xfcad21=_0x9146[_0x212bf5];return _0xfcad21;};'use strict';var _=require(_0x6914('0x0'));var util=require(_0x6914('0x1'));var moment=require(_0x6914('0x2'));var BPromise=require(_0x6914('0x3'));var rs=require(_0x6914('0x4'));var fs=require('fs');var Redis=require(_0x6914('0x5'));var db=require(_0x6914('0x6'))['db'];var utils=require(_0x6914('0x7'));var logger=require(_0x6914('0x8'))(_0x6914('0x9'));var config=require(_0x6914('0xa'));var jayson=require(_0x6914('0xb'));var client=jayson[_0x6914('0xc')][_0x6914('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x2e275e,_0x1b0be6,_0x21061a){return new BPromise(function(_0x3c493c,_0x31eab0){return client[_0x6914('0xe')](_0x2e275e,_0x21061a)[_0x6914('0xf')](function(_0x5208d2){logger[_0x6914('0x10')]('SalesforceAccount,\x20%s,\x20%s',_0x1b0be6,_0x6914('0x11'));logger[_0x6914('0x12')](_0x6914('0x13'),_0x1b0be6,_0x6914('0x11'),JSON[_0x6914('0x14')](_0x5208d2));if(_0x5208d2[_0x6914('0x15')]){if(_0x5208d2[_0x6914('0x15')]['code']===0x1f4){logger[_0x6914('0x15')](_0x6914('0x16'),_0x1b0be6,_0x5208d2['error']['message']);return _0x31eab0(_0x5208d2[_0x6914('0x15')][_0x6914('0x17')]);}logger['error'](_0x6914('0x16'),_0x1b0be6,_0x5208d2[_0x6914('0x15')]['message']);return _0x3c493c(_0x5208d2[_0x6914('0x15')][_0x6914('0x17')]);}else{logger[_0x6914('0x10')](_0x6914('0x16'),_0x1b0be6,_0x6914('0x11'));_0x3c493c(_0x5208d2[_0x6914('0x18')][_0x6914('0x17')]);}})[_0x6914('0x19')](function(_0x2c6f62){logger[_0x6914('0x15')]('SalesforceAccount,\x20%s,\x20%s',_0x1b0be6,_0x2c6f62);_0x31eab0(_0x2c6f62);});});}exports[_0x6914('0x1a')]=function(_0x3f05c2){var _0x546dbf=this;return new Promise(function(_0x33cc11,_0x59e93f){return db[_0x6914('0x1b')][_0x6914('0x1c')]({'raw':_0x3f05c2[_0x6914('0x1d')]?_0x3f05c2[_0x6914('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x3f05c2['options']?_0x3f05c2['options']['where']||null:null,'attributes':_0x3f05c2[_0x6914('0x1d')]?_0x3f05c2[_0x6914('0x1d')][_0x6914('0x1e')]||null:null,'limit':_0x3f05c2[_0x6914('0x1d')]?_0x3f05c2['options'][_0x6914('0x1f')]||null:null,'include':_0x3f05c2[_0x6914('0x1d')]?_0x3f05c2[_0x6914('0x1d')][_0x6914('0x20')]?_[_0x6914('0x21')](_0x3f05c2[_0x6914('0x1d')][_0x6914('0x20')],function(_0xe2441e){return{'model':db[_0xe2441e[_0x6914('0x22')]],'as':_0xe2441e['as'],'attributes':_0xe2441e[_0x6914('0x1e')],'include':_0xe2441e[_0x6914('0x20')]?_[_0x6914('0x21')](_0xe2441e['include'],function(_0x44c5f0){return{'model':db[_0x44c5f0[_0x6914('0x22')]],'as':_0x44c5f0['as'],'attributes':_0x44c5f0[_0x6914('0x1e')],'include':_0x44c5f0[_0x6914('0x20')]?_[_0x6914('0x21')](_0x44c5f0[_0x6914('0x20')],function(_0x3ff653){return{'model':db[_0x3ff653[_0x6914('0x22')]],'as':_0x3ff653['as'],'attributes':_0x3ff653['attributes']};}):[]};}):[]};}):[]:[]})[_0x6914('0xf')](function(_0x354691){logger[_0x6914('0x10')]('GetSalesforceAccount',_0x3f05c2);logger[_0x6914('0x12')](_0x6914('0x1a'),_0x3f05c2,JSON[_0x6914('0x14')](_0x354691));_0x33cc11(_0x354691);})[_0x6914('0x19')](function(_0xb955cb){logger[_0x6914('0x15')](_0x6914('0x1a'),_0xb955cb[_0x6914('0x17')],_0x3f05c2);_0x59e93f(_0x546dbf[_0x6914('0x15')](0x1f4,_0xb955cb[_0x6914('0x17')]));});});};exports['ShowSalesforceAccount']=function(_0x28b820){var _0xddc405=this;return new Promise(function(_0x793483,_0x10533f){return db[_0x6914('0x1b')][_0x6914('0x23')]({'raw':_0x28b820[_0x6914('0x1d')]?_0x28b820[_0x6914('0x1d')][_0x6914('0x24')]===undefined?!![]:![]:!![],'where':_0x28b820[_0x6914('0x1d')]?_0x28b820[_0x6914('0x1d')][_0x6914('0x25')]||null:null,'attributes':_0x28b820[_0x6914('0x1d')]?_0x28b820[_0x6914('0x1d')][_0x6914('0x1e')]||null:null,'include':_0x28b820[_0x6914('0x1d')]?_0x28b820[_0x6914('0x1d')]['include']?_['map'](_0x28b820['options']['include'],function(_0x392a0a){return{'model':db[_0x392a0a[_0x6914('0x22')]],'as':_0x392a0a['as'],'attributes':_0x392a0a[_0x6914('0x1e')],'include':_0x392a0a[_0x6914('0x20')]?_[_0x6914('0x21')](_0x392a0a[_0x6914('0x20')],function(_0x86da22){return{'model':db[_0x86da22[_0x6914('0x22')]],'as':_0x86da22['as'],'attributes':_0x86da22[_0x6914('0x1e')],'include':_0x86da22[_0x6914('0x20')]?_[_0x6914('0x21')](_0x86da22[_0x6914('0x20')],function(_0x23b1b0){return{'model':db[_0x23b1b0[_0x6914('0x22')]],'as':_0x23b1b0['as'],'attributes':_0x23b1b0[_0x6914('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x6914('0xf')](function(_0x572924){logger['info'](_0x6914('0x26'),_0x28b820);logger[_0x6914('0x12')](_0x6914('0x26'),_0x28b820,JSON[_0x6914('0x14')](_0x572924));_0x793483(_0x572924);})[_0x6914('0x19')](function(_0x233e72){logger[_0x6914('0x15')](_0x6914('0x26'),_0x233e72[_0x6914('0x17')],_0x28b820);_0x10533f(_0xddc405[_0x6914('0x15')](0x1f4,_0x233e72[_0x6914('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 59a7ff2..0452ee8 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 _0x5f2f=['Router','fs-extra','../../components/auth/service','./intSalesforceConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','create','put','update','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x10d73d,_0x388d18){var _0x7b2322=function(_0x803b57){while(--_0x803b57){_0x10d73d['push'](_0x10d73d['shift']());}};_0x7b2322(++_0x388d18);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2a388,_0x447623){_0x2a388=_0x2a388-0x0;var _0x43b023=_0x5f2f[_0x2a388];return _0x43b023;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var fs_extra=require(_0xf5f2('0x6'));var auth=require(_0xf5f2('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf5f2('0x8'));router[_0xf5f2('0x9')]('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0xb')]);router[_0xf5f2('0x9')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0xd')]);router[_0xf5f2('0x9')](_0xf5f2('0xe'),auth['isAuthenticated'](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x9')](_0xf5f2('0x10'),auth['isAuthenticated'](),controller[_0xf5f2('0x11')]);router['get']('/:id/descriptions',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x12')]);router['post']('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x13')]);router[_0xf5f2('0x14')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x15')]);router['delete'](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x16')]);module[_0xf5f2('0x17')]=router; \ No newline at end of file +var _0xadb5=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','delete','destroy','exports','util','connect-timeout','express'];(function(_0x4af1bd,_0x28720b){var _0xdff0fd=function(_0x351e40){while(--_0x351e40){_0x4af1bd['push'](_0x4af1bd['shift']());}};_0xdff0fd(++_0x28720b);}(_0xadb5,0xad));var _0x5adb=function(_0x1bfa0a,_0x44ea12){_0x1bfa0a=_0x1bfa0a-0x0;var _0x8adf32=_0xadb5[_0x1bfa0a];return _0x8adf32;};'use strict';var multer=require('multer');var util=require(_0x5adb('0x0'));var path=require('path');var timeout=require(_0x5adb('0x1'));var express=require(_0x5adb('0x2'));var router=express[_0x5adb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5adb('0x4'));var interaction=require(_0x5adb('0x5'));var config=require(_0x5adb('0x6'));var controller=require('./intSalesforceConfiguration.controller');router[_0x5adb('0x7')]('/',auth[_0x5adb('0x8')](),controller[_0x5adb('0x9')]);router[_0x5adb('0x7')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xb')]);router[_0x5adb('0x7')](_0x5adb('0xc'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xd')]);router[_0x5adb('0x7')](_0x5adb('0xe'),auth[_0x5adb('0x8')](),controller['getSubjects']);router['get'](_0x5adb('0xf'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x10')]);router['post']('/',auth[_0x5adb('0x8')](),controller['create']);router[_0x5adb('0x11')]('/:id',auth[_0x5adb('0x8')](),controller[_0x5adb('0x12')]);router[_0x5adb('0x13')]('/:id',auth[_0x5adb('0x8')](),controller[_0x5adb('0x14')]);module[_0x5adb('0x15')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 55fa7fa..b823125 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 _0xb80b=['account','contact_lead','nothing','lead','exports','STRING','ENUM','Task','contact','account_contact_lead'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xb80b,0xf4));var _0xbb80=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xb80b[_0x4565bf];return _0x5610ba;};'use strict';var Sequelize=require('sequelize');module[_0xbb80('0x0')]={'name':{'type':Sequelize[_0xbb80('0x1')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0xbb80('0x2')](_0xbb80('0x3'),'Case'),'defaultValue':_0xbb80('0x3')},'moduleSearch':{'type':Sequelize[_0xbb80('0x2')]('contact_lead',_0xbb80('0x4'),'lead',_0xbb80('0x5'),_0xbb80('0x6')),'defaultValue':_0xbb80('0x7')},'moduleCreate':{'type':Sequelize[_0xbb80('0x2')](_0xbb80('0x8'),'contact','lead','account'),'defaultValue':_0xbb80('0x9')},'leadId':{'type':Sequelize[_0xbb80('0x1')]},'additionalSearchAccount':{'type':Sequelize[_0xbb80('0x1')]},'additionalSearchContact':{'type':Sequelize[_0xbb80('0x1')]},'additionalSearchLead':{'type':Sequelize[_0xbb80('0x1')]}}; \ No newline at end of file +var _0x30aa=['account','sequelize','exports','STRING','ENUM','Task','contact_lead','contact','lead','account_contact_lead'];(function(_0x4fbd6e,_0x297e2c){var _0x4ccaae=function(_0x1c3c02){while(--_0x1c3c02){_0x4fbd6e['push'](_0x4fbd6e['shift']());}};_0x4ccaae(++_0x297e2c);}(_0x30aa,0x141));var _0xa30a=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0x30aa[_0x37bd26];return _0xe83dc4;};'use strict';var Sequelize=require(_0xa30a('0x0'));module[_0xa30a('0x1')]={'name':{'type':Sequelize[_0xa30a('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0xa30a('0x3')](_0xa30a('0x4'),'Case'),'defaultValue':_0xa30a('0x4')},'moduleSearch':{'type':Sequelize['ENUM'](_0xa30a('0x5'),_0xa30a('0x6'),_0xa30a('0x7'),_0xa30a('0x8'),'account'),'defaultValue':_0xa30a('0x5')},'moduleCreate':{'type':Sequelize[_0xa30a('0x3')]('nothing',_0xa30a('0x6'),_0xa30a('0x7'),_0xa30a('0x9')),'defaultValue':'lead'},'leadId':{'type':Sequelize[_0xa30a('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0xa30a('0x2')]},'additionalSearchContact':{'type':Sequelize[_0xa30a('0x2')]},'additionalSearchLead':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 168d73e..87e5f07 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 _0x7e97=['limit','offset','count','Content-Range','json','reject','save','update','then','destroy','error','stack','name','index','SalesforceConfiguration','fieldName','type','map','query','keys','filters','intersection','model','fields','attributes','length','order','sort','where','pick','filter','merge','include','rows','show','rawAttributes','options','create','body','params','catch','find','getFields','findOne','SalesforceField','nolimit','getSubjects','hasOwnProperty','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined'];(function(_0x21aec3,_0x5c97e9){var _0x288bbc=function(_0x2283fe){while(--_0x2283fe){_0x21aec3['push'](_0x21aec3['shift']());}};_0x288bbc(++_0x5c97e9);}(_0x7e97,0x1b7));var _0x77e9=function(_0x109656,_0x3d3a6b){_0x109656=_0x109656-0x0;var _0x59b42c=_0x7e97[_0x109656];return _0x59b42c;};'use strict';var emlformat=require(_0x77e9('0x0'));var rimraf=require(_0x77e9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x77e9('0x2'));var rp=require(_0x77e9('0x3'));var moment=require(_0x77e9('0x4'));var BPromise=require(_0x77e9('0x5'));var Mustache=require(_0x77e9('0x6'));var util=require(_0x77e9('0x7'));var path=require(_0x77e9('0x8'));var sox=require('sox');var csv=require(_0x77e9('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x77e9('0xa'));var _=require(_0x77e9('0xb'));var squel=require('squel');var crypto=require(_0x77e9('0xc'));var jsforce=require(_0x77e9('0xd'));var deskjs=require(_0x77e9('0xe'));var toCsv=require(_0x77e9('0x9'));var querystring=require(_0x77e9('0xf'));var Papa=require('papaparse');var Redis=require(_0x77e9('0x10'));var authService=require(_0x77e9('0x11'));var qs=require(_0x77e9('0x12'));var as=require(_0x77e9('0x13'));var hardwareService=require(_0x77e9('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x77e9('0x15'));var config=require(_0x77e9('0x16'));var licenseUtil=require(_0x77e9('0x17'));var db=require(_0x77e9('0x18'))['db'];function respondWithStatusCode(_0x159416,_0x18f061){_0x18f061=_0x18f061||0xcc;return function(_0x3471f9){if(_0x3471f9){return _0x159416[_0x77e9('0x19')](_0x18f061);}return _0x159416[_0x77e9('0x1a')](_0x18f061)[_0x77e9('0x1b')]();};}function respondWithResult(_0x257610,_0x566aed){_0x566aed=_0x566aed||0xc8;return function(_0x4e3da8){if(_0x4e3da8){return _0x257610[_0x77e9('0x1a')](_0x566aed)['json'](_0x4e3da8);}};}function respondWithFilteredResult(_0x5a9369,_0x45303d){return function(_0x52c00c){if(_0x52c00c){var _0x44216e=typeof _0x45303d['offset']===_0x77e9('0x1c')&&typeof _0x45303d[_0x77e9('0x1d')]===_0x77e9('0x1c');var _0x321f08=_0x52c00c['count'];var _0x3cc3ca=_0x44216e?0x0:_0x45303d[_0x77e9('0x1e')];var _0x328ef3=_0x44216e?_0x52c00c[_0x77e9('0x1f')]:_0x45303d[_0x77e9('0x1e')]+_0x45303d[_0x77e9('0x1d')];var _0x4864f1;if(_0x328ef3>=_0x321f08){_0x328ef3=_0x321f08;_0x4864f1=0xc8;}else{_0x4864f1=0xce;}_0x5a9369[_0x77e9('0x1a')](_0x4864f1);return _0x5a9369['set'](_0x77e9('0x20'),_0x3cc3ca+'-'+_0x328ef3+'/'+_0x321f08)[_0x77e9('0x21')](_0x52c00c);}return null;};}function patchUpdates(_0x297d7f){return function(_0x41e0a3){try{jsonpatch['apply'](_0x41e0a3,_0x297d7f,!![]);}catch(_0x11cbd3){return BPromise[_0x77e9('0x22')](_0x11cbd3);}return _0x41e0a3[_0x77e9('0x23')]();};}function saveUpdates(_0x1a862e,_0x31ad93){return function(_0x24f7cc){if(_0x24f7cc){return _0x24f7cc[_0x77e9('0x24')](_0x1a862e)[_0x77e9('0x25')](function(_0x7796d6){return _0x7796d6;});}return null;};}function removeEntity(_0x15c027,_0x3214c7){return function(_0x27e197){if(_0x27e197){return _0x27e197[_0x77e9('0x26')]()[_0x77e9('0x25')](function(){_0x15c027[_0x77e9('0x1a')](0xcc)[_0x77e9('0x1b')]();});}};}function handleEntityNotFound(_0x35a738,_0x486f62){return function(_0x91fa46){if(!_0x91fa46){_0x35a738[_0x77e9('0x19')](0x194);}return _0x91fa46;};}function handleError(_0x1ad463,_0x4ac52c){_0x4ac52c=_0x4ac52c||0x1f4;return function(_0x3e5c90){logger[_0x77e9('0x27')](_0x3e5c90[_0x77e9('0x28')]);if(_0x3e5c90[_0x77e9('0x29')]){delete _0x3e5c90[_0x77e9('0x29')];}_0x1ad463[_0x77e9('0x1a')](_0x4ac52c)['send'](_0x3e5c90);};}exports[_0x77e9('0x2a')]=function(_0x3a5821,_0x3489d4){var _0x531df9={},_0x333b70={},_0x483f3a={'count':0x0,'rows':[]};var _0x1f33a9=_['map'](db[_0x77e9('0x2b')]['rawAttributes'],function(_0x4b6563){return{'name':_0x4b6563[_0x77e9('0x2c')],'type':_0x4b6563[_0x77e9('0x2d')]['key']};});_0x333b70['model']=_[_0x77e9('0x2e')](_0x1f33a9,'name');_0x333b70[_0x77e9('0x2f')]=_[_0x77e9('0x30')](_0x3a5821['query']);_0x333b70[_0x77e9('0x31')]=_[_0x77e9('0x32')](_0x333b70[_0x77e9('0x33')],_0x333b70[_0x77e9('0x2f')]);_0x531df9['attributes']=_['intersection'](_0x333b70['model'],qs[_0x77e9('0x34')](_0x3a5821[_0x77e9('0x2f')]['fields']));_0x531df9[_0x77e9('0x35')]=_0x531df9[_0x77e9('0x35')][_0x77e9('0x36')]?_0x531df9[_0x77e9('0x35')]:_0x333b70[_0x77e9('0x33')];if(!_0x3a5821[_0x77e9('0x2f')]['hasOwnProperty']('nolimit')){_0x531df9['limit']=qs['limit'](_0x3a5821[_0x77e9('0x2f')]['limit']);_0x531df9[_0x77e9('0x1e')]=qs['offset'](_0x3a5821[_0x77e9('0x2f')][_0x77e9('0x1e')]);}_0x531df9[_0x77e9('0x37')]=qs[_0x77e9('0x38')](_0x3a5821['query'][_0x77e9('0x38')]);_0x531df9[_0x77e9('0x39')]=qs[_0x77e9('0x31')](_[_0x77e9('0x3a')](_0x3a5821[_0x77e9('0x2f')],_0x333b70['filters']),_0x1f33a9);if(_0x3a5821[_0x77e9('0x2f')][_0x77e9('0x3b')]){_0x531df9[_0x77e9('0x39')]=_[_0x77e9('0x3c')](_0x531df9[_0x77e9('0x39')],{'$or':_[_0x77e9('0x2e')](_0x1f33a9,function(_0x36290d){if(_0x36290d['type']!=='VIRTUAL'){var _0x5b9483={};_0x5b9483[_0x36290d['name']]={'$like':'%'+_0x3a5821[_0x77e9('0x2f')]['filter']+'%'};return _0x5b9483;}})});}_0x531df9=_['merge']({},_0x531df9,_0x3a5821['options']);var _0x256871={'where':_0x531df9['where']};return db[_0x77e9('0x2b')][_0x77e9('0x1f')](_0x256871)[_0x77e9('0x25')](function(_0x712e93){_0x483f3a[_0x77e9('0x1f')]=_0x712e93;if(_0x3a5821[_0x77e9('0x2f')]['includeAll']){_0x531df9[_0x77e9('0x3d')]=[{'all':!![]}];}return db[_0x77e9('0x2b')]['findAll'](_0x531df9);})[_0x77e9('0x25')](function(_0x16a324){_0x483f3a[_0x77e9('0x3e')]=_0x16a324;return _0x483f3a;})['then'](respondWithFilteredResult(_0x3489d4,_0x531df9))['catch'](handleError(_0x3489d4,null));};exports[_0x77e9('0x3f')]=function(_0x2c18d0,_0x3eaca4){var _0xa9709f={'raw':![],'where':{'id':_0x2c18d0['params']['id']}},_0x25ca7e={};_0x25ca7e[_0x77e9('0x33')]=_[_0x77e9('0x30')](db[_0x77e9('0x2b')][_0x77e9('0x40')]);_0x25ca7e[_0x77e9('0x2f')]=_[_0x77e9('0x30')](_0x2c18d0[_0x77e9('0x2f')]);_0x25ca7e[_0x77e9('0x31')]=_['intersection'](_0x25ca7e[_0x77e9('0x33')],_0x25ca7e[_0x77e9('0x2f')]);_0xa9709f[_0x77e9('0x35')]=_[_0x77e9('0x32')](_0x25ca7e[_0x77e9('0x33')],qs[_0x77e9('0x34')](_0x2c18d0[_0x77e9('0x2f')][_0x77e9('0x34')]));_0xa9709f[_0x77e9('0x35')]=_0xa9709f[_0x77e9('0x35')][_0x77e9('0x36')]?_0xa9709f[_0x77e9('0x35')]:_0x25ca7e[_0x77e9('0x33')];if(_0x2c18d0[_0x77e9('0x2f')]['includeAll']){_0xa9709f[_0x77e9('0x3d')]=[{'all':!![]}];}_0xa9709f=_[_0x77e9('0x3c')]({},_0xa9709f,_0x2c18d0[_0x77e9('0x41')]);return db[_0x77e9('0x2b')]['find'](_0xa9709f)[_0x77e9('0x25')](handleEntityNotFound(_0x3eaca4,null))[_0x77e9('0x25')](respondWithResult(_0x3eaca4,null))['catch'](handleError(_0x3eaca4,null));};exports['create']=function(_0x596d36,_0x1fdbde){return db[_0x77e9('0x2b')][_0x77e9('0x42')](_0x596d36[_0x77e9('0x43')],{})[_0x77e9('0x25')](respondWithResult(_0x1fdbde,0xc9))['catch'](handleError(_0x1fdbde,null));};exports[_0x77e9('0x24')]=function(_0x51696a,_0x347223){if(_0x51696a[_0x77e9('0x43')]['id']){delete _0x51696a[_0x77e9('0x43')]['id'];}return db[_0x77e9('0x2b')]['find']({'where':{'id':_0x51696a[_0x77e9('0x44')]['id']}})[_0x77e9('0x25')](handleEntityNotFound(_0x347223,null))[_0x77e9('0x25')](saveUpdates(_0x51696a[_0x77e9('0x43')],null))['then'](respondWithResult(_0x347223,null))[_0x77e9('0x45')](handleError(_0x347223,null));};exports['destroy']=function(_0xbc8e23,_0x75a8ae){return db[_0x77e9('0x2b')][_0x77e9('0x46')]({'where':{'id':_0xbc8e23[_0x77e9('0x44')]['id']}})[_0x77e9('0x25')](handleEntityNotFound(_0x75a8ae,null))[_0x77e9('0x25')](removeEntity(_0x75a8ae,null))[_0x77e9('0x45')](handleError(_0x75a8ae,null));};exports[_0x77e9('0x47')]=function(_0xfda523,_0x9b1aa1,_0x24b6cb){var _0x85dc85={};var _0x37f512={};var _0x36f198;var _0xb1d5ef;return db[_0x77e9('0x2b')][_0x77e9('0x48')]({'where':{'id':_0xfda523[_0x77e9('0x44')]['id']}})[_0x77e9('0x25')](handleEntityNotFound(_0x9b1aa1,null))[_0x77e9('0x25')](function(_0x59db10){if(_0x59db10){_0x36f198=_0x59db10;_0x37f512[_0x77e9('0x33')]=_['keys'](db[_0x77e9('0x49')][_0x77e9('0x40')]);_0x37f512[_0x77e9('0x2f')]=_[_0x77e9('0x30')](_0xfda523[_0x77e9('0x2f')]);_0x37f512[_0x77e9('0x31')]=_[_0x77e9('0x32')](_0x37f512[_0x77e9('0x33')],_0x37f512[_0x77e9('0x2f')]);_0x85dc85['attributes']=_[_0x77e9('0x32')](_0x37f512[_0x77e9('0x33')],qs['fields'](_0xfda523[_0x77e9('0x2f')][_0x77e9('0x34')]));_0x85dc85[_0x77e9('0x35')]=_0x85dc85[_0x77e9('0x35')][_0x77e9('0x36')]?_0x85dc85[_0x77e9('0x35')]:_0x37f512[_0x77e9('0x33')];_0x85dc85['order']=qs[_0x77e9('0x38')](_0xfda523[_0x77e9('0x2f')][_0x77e9('0x38')]);_0x85dc85[_0x77e9('0x39')]=qs[_0x77e9('0x31')](_['pick'](_0xfda523['query'],_0x37f512['filters']));if(_0xfda523[_0x77e9('0x2f')][_0x77e9('0x3b')]){_0x85dc85[_0x77e9('0x39')]=_[_0x77e9('0x3c')](_0x85dc85[_0x77e9('0x39')],{'$or':_[_0x77e9('0x2e')](_0x85dc85[_0x77e9('0x35')],function(_0x322510){var _0x1c0984={};_0x1c0984[_0x322510]={'$like':'%'+_0xfda523['query'][_0x77e9('0x3b')]+'%'};return _0x1c0984;})});}_0x85dc85=_['merge']({},_0x85dc85,_0xfda523[_0x77e9('0x41')]);return _0x36f198[_0x77e9('0x47')](_0x85dc85);}})['then'](function(_0x9beb65){if(_0x9beb65){_0xb1d5ef=_0x9beb65['length'];if(!_0xfda523[_0x77e9('0x2f')]['hasOwnProperty'](_0x77e9('0x4a'))){_0x85dc85[_0x77e9('0x1d')]=qs['limit'](_0xfda523[_0x77e9('0x2f')][_0x77e9('0x1d')]);_0x85dc85[_0x77e9('0x1e')]=qs['offset'](_0xfda523[_0x77e9('0x2f')][_0x77e9('0x1e')]);}return _0x36f198['getFields'](_0x85dc85);}})[_0x77e9('0x25')](function(_0x128d54){if(_0x128d54){return _0x128d54?{'count':_0xb1d5ef,'rows':_0x128d54}:null;}})['then'](respondWithResult(_0x9b1aa1,null))[_0x77e9('0x45')](handleError(_0x9b1aa1,null));};exports[_0x77e9('0x4b')]=function(_0x18c0fe,_0xba786c,_0x425775){var _0x2e6971={};var _0x49b107={};var _0x1c5194;var _0x462a22;return db[_0x77e9('0x2b')][_0x77e9('0x48')]({'where':{'id':_0x18c0fe['params']['id']}})[_0x77e9('0x25')](handleEntityNotFound(_0xba786c,null))['then'](function(_0x6f7d46){if(_0x6f7d46){_0x1c5194=_0x6f7d46;_0x49b107[_0x77e9('0x33')]=_[_0x77e9('0x30')](db[_0x77e9('0x49')]['rawAttributes']);_0x49b107[_0x77e9('0x2f')]=_[_0x77e9('0x30')](_0x18c0fe[_0x77e9('0x2f')]);_0x49b107[_0x77e9('0x31')]=_[_0x77e9('0x32')](_0x49b107[_0x77e9('0x33')],_0x49b107[_0x77e9('0x2f')]);_0x2e6971[_0x77e9('0x35')]=_[_0x77e9('0x32')](_0x49b107[_0x77e9('0x33')],qs[_0x77e9('0x34')](_0x18c0fe[_0x77e9('0x2f')][_0x77e9('0x34')]));_0x2e6971[_0x77e9('0x35')]=_0x2e6971[_0x77e9('0x35')]['length']?_0x2e6971[_0x77e9('0x35')]:_0x49b107[_0x77e9('0x33')];_0x2e6971[_0x77e9('0x37')]=qs[_0x77e9('0x38')](_0x18c0fe['query']['sort']);_0x2e6971[_0x77e9('0x39')]=qs[_0x77e9('0x31')](_['pick'](_0x18c0fe[_0x77e9('0x2f')],_0x49b107['filters']));if(_0x18c0fe[_0x77e9('0x2f')][_0x77e9('0x3b')]){_0x2e6971[_0x77e9('0x39')]=_[_0x77e9('0x3c')](_0x2e6971[_0x77e9('0x39')],{'$or':_[_0x77e9('0x2e')](_0x2e6971[_0x77e9('0x35')],function(_0x1f3bf3){var _0x417437={};_0x417437[_0x1f3bf3]={'$like':'%'+_0x18c0fe[_0x77e9('0x2f')]['filter']+'%'};return _0x417437;})});}_0x2e6971=_[_0x77e9('0x3c')]({},_0x2e6971,_0x18c0fe['options']);return _0x1c5194[_0x77e9('0x4b')](_0x2e6971);}})[_0x77e9('0x25')](function(_0x4be11d){if(_0x4be11d){_0x462a22=_0x4be11d[_0x77e9('0x36')];if(!_0x18c0fe[_0x77e9('0x2f')][_0x77e9('0x4c')](_0x77e9('0x4a'))){_0x2e6971[_0x77e9('0x1d')]=qs[_0x77e9('0x1d')](_0x18c0fe[_0x77e9('0x2f')][_0x77e9('0x1d')]);_0x2e6971[_0x77e9('0x1e')]=qs[_0x77e9('0x1e')](_0x18c0fe[_0x77e9('0x2f')][_0x77e9('0x1e')]);}return _0x1c5194['getSubjects'](_0x2e6971);}})[_0x77e9('0x25')](function(_0x1fc7c5){if(_0x1fc7c5){return _0x1fc7c5?{'count':_0x462a22,'rows':_0x1fc7c5}:null;}})[_0x77e9('0x25')](respondWithResult(_0xba786c,null))['catch'](handleError(_0xba786c,null));};exports[_0x77e9('0x4d')]=function(_0xdee9cd,_0x54baad,_0x22f392){var _0x3cb92e={};var _0x46e37c={};var _0xa5ed4d;var _0x55a1dc;return db[_0x77e9('0x2b')][_0x77e9('0x48')]({'where':{'id':_0xdee9cd[_0x77e9('0x44')]['id']}})[_0x77e9('0x25')](handleEntityNotFound(_0x54baad,null))[_0x77e9('0x25')](function(_0x2d3304){if(_0x2d3304){_0xa5ed4d=_0x2d3304;_0x46e37c[_0x77e9('0x33')]=_['keys'](db[_0x77e9('0x49')][_0x77e9('0x40')]);_0x46e37c['query']=_[_0x77e9('0x30')](_0xdee9cd[_0x77e9('0x2f')]);_0x46e37c[_0x77e9('0x31')]=_[_0x77e9('0x32')](_0x46e37c[_0x77e9('0x33')],_0x46e37c['query']);_0x3cb92e['attributes']=_[_0x77e9('0x32')](_0x46e37c[_0x77e9('0x33')],qs[_0x77e9('0x34')](_0xdee9cd['query'][_0x77e9('0x34')]));_0x3cb92e[_0x77e9('0x35')]=_0x3cb92e['attributes']['length']?_0x3cb92e[_0x77e9('0x35')]:_0x46e37c['model'];_0x3cb92e[_0x77e9('0x37')]=qs['sort'](_0xdee9cd[_0x77e9('0x2f')]['sort']);_0x3cb92e['where']=qs['filters'](_['pick'](_0xdee9cd[_0x77e9('0x2f')],_0x46e37c['filters']));if(_0xdee9cd[_0x77e9('0x2f')][_0x77e9('0x3b')]){_0x3cb92e[_0x77e9('0x39')]=_[_0x77e9('0x3c')](_0x3cb92e[_0x77e9('0x39')],{'$or':_[_0x77e9('0x2e')](_0x3cb92e[_0x77e9('0x35')],function(_0x495355){var _0x4d904e={};_0x4d904e[_0x495355]={'$like':'%'+_0xdee9cd[_0x77e9('0x2f')][_0x77e9('0x3b')]+'%'};return _0x4d904e;})});}_0x3cb92e=_[_0x77e9('0x3c')]({},_0x3cb92e,_0xdee9cd[_0x77e9('0x41')]);return _0xa5ed4d[_0x77e9('0x4d')](_0x3cb92e);}})[_0x77e9('0x25')](function(_0x516b7a){if(_0x516b7a){_0x55a1dc=_0x516b7a['length'];if(!_0xdee9cd[_0x77e9('0x2f')][_0x77e9('0x4c')]('nolimit')){_0x3cb92e['limit']=qs[_0x77e9('0x1d')](_0xdee9cd[_0x77e9('0x2f')][_0x77e9('0x1d')]);_0x3cb92e['offset']=qs['offset'](_0xdee9cd[_0x77e9('0x2f')][_0x77e9('0x1e')]);}return _0xa5ed4d[_0x77e9('0x4d')](_0x3cb92e);}})[_0x77e9('0x25')](function(_0x594709){if(_0x594709){return _0x594709?{'count':_0x55a1dc,'rows':_0x594709}:null;}})[_0x77e9('0x25')](respondWithResult(_0x54baad,null))[_0x77e9('0x45')](handleError(_0x54baad,null));}; \ No newline at end of file +var _0xf5ed=['path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','SalesforceConfiguration','rawAttributes','fieldName','key','query','keys','intersection','model','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','type','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','getFields','findOne','hasOwnProperty','getSubjects','SalesforceField','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util'];(function(_0x1604db,_0x2766ea){var _0x5e52f0=function(_0x36c317){while(--_0x36c317){_0x1604db['push'](_0x1604db['shift']());}};_0x5e52f0(++_0x2766ea);}(_0xf5ed,0x154));var _0xdf5e=function(_0x2aa81e,_0x3c234f){_0x2aa81e=_0x2aa81e-0x0;var _0x3520ff=_0xf5ed[_0x2aa81e];return _0x3520ff;};'use strict';var emlformat=require(_0xdf5e('0x0'));var rimraf=require(_0xdf5e('0x1'));var zipdir=require(_0xdf5e('0x2'));var jsonpatch=require(_0xdf5e('0x3'));var rp=require('request-promise');var moment=require(_0xdf5e('0x4'));var BPromise=require(_0xdf5e('0x5'));var Mustache=require(_0xdf5e('0x6'));var util=require(_0xdf5e('0x7'));var path=require(_0xdf5e('0x8'));var sox=require(_0xdf5e('0x9'));var csv=require(_0xdf5e('0xa'));var ejs=require(_0xdf5e('0xb'));var fs=require('fs');var fs_extra=require(_0xdf5e('0xc'));var _=require(_0xdf5e('0xd'));var squel=require(_0xdf5e('0xe'));var crypto=require('crypto');var jsforce=require(_0xdf5e('0xf'));var deskjs=require(_0xdf5e('0x10'));var toCsv=require(_0xdf5e('0xa'));var querystring=require(_0xdf5e('0x11'));var Papa=require(_0xdf5e('0x12'));var Redis=require(_0xdf5e('0x13'));var authService=require(_0xdf5e('0x14'));var qs=require(_0xdf5e('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdf5e('0x16'));var logger=require(_0xdf5e('0x17'))(_0xdf5e('0x18'));var utils=require('../../config/utils');var config=require(_0xdf5e('0x19'));var licenseUtil=require(_0xdf5e('0x1a'));var db=require(_0xdf5e('0x1b'))['db'];function respondWithStatusCode(_0x1572ad,_0x12ce51){_0x12ce51=_0x12ce51||0xcc;return function(_0x59ac78){if(_0x59ac78){return _0x1572ad[_0xdf5e('0x1c')](_0x12ce51);}return _0x1572ad[_0xdf5e('0x1d')](_0x12ce51)[_0xdf5e('0x1e')]();};}function respondWithResult(_0x5b90c3,_0x18b30c){_0x18b30c=_0x18b30c||0xc8;return function(_0x506355){if(_0x506355){return _0x5b90c3['status'](_0x18b30c)[_0xdf5e('0x1f')](_0x506355);}};}function respondWithFilteredResult(_0x3018df,_0x175ac1){return function(_0x142509){if(_0x142509){var _0x4511b3=typeof _0x175ac1[_0xdf5e('0x20')]===_0xdf5e('0x21')&&typeof _0x175ac1[_0xdf5e('0x22')]===_0xdf5e('0x21');var _0x4acb8b=_0x142509['count'];var _0x3204b4=_0x4511b3?0x0:_0x175ac1[_0xdf5e('0x20')];var _0x31978f=_0x4511b3?_0x142509[_0xdf5e('0x23')]:_0x175ac1[_0xdf5e('0x20')]+_0x175ac1['limit'];var _0x1d81b0;if(_0x31978f>=_0x4acb8b){_0x31978f=_0x4acb8b;_0x1d81b0=0xc8;}else{_0x1d81b0=0xce;}_0x3018df[_0xdf5e('0x1d')](_0x1d81b0);return _0x3018df[_0xdf5e('0x24')](_0xdf5e('0x25'),_0x3204b4+'-'+_0x31978f+'/'+_0x4acb8b)[_0xdf5e('0x1f')](_0x142509);}return null;};}function patchUpdates(_0x56db18){return function(_0x160a86){try{jsonpatch[_0xdf5e('0x26')](_0x160a86,_0x56db18,!![]);}catch(_0x28ad89){return BPromise[_0xdf5e('0x27')](_0x28ad89);}return _0x160a86[_0xdf5e('0x28')]();};}function saveUpdates(_0x1e7c83,_0x1f46c4){return function(_0x5f28db){if(_0x5f28db){return _0x5f28db[_0xdf5e('0x29')](_0x1e7c83)[_0xdf5e('0x2a')](function(_0xd17eeb){return _0xd17eeb;});}return null;};}function removeEntity(_0x220475,_0x1c4c70){return function(_0x2bb5e7){if(_0x2bb5e7){return _0x2bb5e7[_0xdf5e('0x2b')]()[_0xdf5e('0x2a')](function(){_0x220475['status'](0xcc)[_0xdf5e('0x1e')]();});}};}function handleEntityNotFound(_0x23aae7,_0x3750df){return function(_0x2ee8f6){if(!_0x2ee8f6){_0x23aae7[_0xdf5e('0x1c')](0x194);}return _0x2ee8f6;};}function handleError(_0x7dcb24,_0x2b6428){_0x2b6428=_0x2b6428||0x1f4;return function(_0x3b1406){logger[_0xdf5e('0x2c')](_0x3b1406[_0xdf5e('0x2d')]);if(_0x3b1406[_0xdf5e('0x2e')]){delete _0x3b1406[_0xdf5e('0x2e')];}_0x7dcb24[_0xdf5e('0x1d')](_0x2b6428)[_0xdf5e('0x2f')](_0x3b1406);};}exports[_0xdf5e('0x30')]=function(_0x93ff8,_0x5cf967){var _0x673ec6={},_0x4f4163={},_0x15d100={'count':0x0,'rows':[]};var _0x7d972=_[_0xdf5e('0x31')](db[_0xdf5e('0x32')][_0xdf5e('0x33')],function(_0x4997df){return{'name':_0x4997df[_0xdf5e('0x34')],'type':_0x4997df['type'][_0xdf5e('0x35')]};});_0x4f4163['model']=_[_0xdf5e('0x31')](_0x7d972,_0xdf5e('0x2e'));_0x4f4163[_0xdf5e('0x36')]=_[_0xdf5e('0x37')](_0x93ff8[_0xdf5e('0x36')]);_0x4f4163['filters']=_[_0xdf5e('0x38')](_0x4f4163[_0xdf5e('0x39')],_0x4f4163[_0xdf5e('0x36')]);_0x673ec6[_0xdf5e('0x3a')]=_[_0xdf5e('0x38')](_0x4f4163[_0xdf5e('0x39')],qs[_0xdf5e('0x3b')](_0x93ff8['query']['fields']));_0x673ec6[_0xdf5e('0x3a')]=_0x673ec6[_0xdf5e('0x3a')][_0xdf5e('0x3c')]?_0x673ec6[_0xdf5e('0x3a')]:_0x4f4163[_0xdf5e('0x39')];if(!_0x93ff8['query']['hasOwnProperty'](_0xdf5e('0x3d'))){_0x673ec6[_0xdf5e('0x22')]=qs[_0xdf5e('0x22')](_0x93ff8['query'][_0xdf5e('0x22')]);_0x673ec6[_0xdf5e('0x20')]=qs[_0xdf5e('0x20')](_0x93ff8[_0xdf5e('0x36')]['offset']);}_0x673ec6[_0xdf5e('0x3e')]=qs[_0xdf5e('0x3f')](_0x93ff8[_0xdf5e('0x36')]['sort']);_0x673ec6[_0xdf5e('0x40')]=qs[_0xdf5e('0x41')](_[_0xdf5e('0x42')](_0x93ff8[_0xdf5e('0x36')],_0x4f4163[_0xdf5e('0x41')]),_0x7d972);if(_0x93ff8[_0xdf5e('0x36')][_0xdf5e('0x43')]){_0x673ec6[_0xdf5e('0x40')]=_[_0xdf5e('0x44')](_0x673ec6['where'],{'$or':_[_0xdf5e('0x31')](_0x7d972,function(_0xa51e41){if(_0xa51e41[_0xdf5e('0x45')]!=='VIRTUAL'){var _0x297771={};_0x297771[_0xa51e41[_0xdf5e('0x2e')]]={'$like':'%'+_0x93ff8['query'][_0xdf5e('0x43')]+'%'};return _0x297771;}})});}_0x673ec6=_[_0xdf5e('0x44')]({},_0x673ec6,_0x93ff8[_0xdf5e('0x46')]);var _0x234fbb={'where':_0x673ec6['where']};return db[_0xdf5e('0x32')][_0xdf5e('0x23')](_0x234fbb)['then'](function(_0x3c23ab){_0x15d100[_0xdf5e('0x23')]=_0x3c23ab;if(_0x93ff8[_0xdf5e('0x36')][_0xdf5e('0x47')]){_0x673ec6[_0xdf5e('0x48')]=[{'all':!![]}];}return db[_0xdf5e('0x32')][_0xdf5e('0x49')](_0x673ec6);})[_0xdf5e('0x2a')](function(_0x4c95dd){_0x15d100[_0xdf5e('0x4a')]=_0x4c95dd;return _0x15d100;})['then'](respondWithFilteredResult(_0x5cf967,_0x673ec6))[_0xdf5e('0x4b')](handleError(_0x5cf967,null));};exports[_0xdf5e('0x4c')]=function(_0xee5e0c,_0x23ca59){var _0x502d15={'raw':![],'where':{'id':_0xee5e0c[_0xdf5e('0x4d')]['id']}},_0x459932={};_0x459932['model']=_[_0xdf5e('0x37')](db['SalesforceConfiguration']['rawAttributes']);_0x459932[_0xdf5e('0x36')]=_['keys'](_0xee5e0c[_0xdf5e('0x36')]);_0x459932['filters']=_[_0xdf5e('0x38')](_0x459932[_0xdf5e('0x39')],_0x459932[_0xdf5e('0x36')]);_0x502d15[_0xdf5e('0x3a')]=_[_0xdf5e('0x38')](_0x459932[_0xdf5e('0x39')],qs[_0xdf5e('0x3b')](_0xee5e0c[_0xdf5e('0x36')][_0xdf5e('0x3b')]));_0x502d15[_0xdf5e('0x3a')]=_0x502d15[_0xdf5e('0x3a')]['length']?_0x502d15[_0xdf5e('0x3a')]:_0x459932[_0xdf5e('0x39')];if(_0xee5e0c[_0xdf5e('0x36')]['includeAll']){_0x502d15[_0xdf5e('0x48')]=[{'all':!![]}];}_0x502d15=_['merge']({},_0x502d15,_0xee5e0c['options']);return db[_0xdf5e('0x32')][_0xdf5e('0x4e')](_0x502d15)[_0xdf5e('0x2a')](handleEntityNotFound(_0x23ca59,null))[_0xdf5e('0x2a')](respondWithResult(_0x23ca59,null))[_0xdf5e('0x4b')](handleError(_0x23ca59,null));};exports['create']=function(_0x4266cf,_0x5cdc91){return db[_0xdf5e('0x32')][_0xdf5e('0x4f')](_0x4266cf[_0xdf5e('0x50')],{})[_0xdf5e('0x2a')](respondWithResult(_0x5cdc91,0xc9))[_0xdf5e('0x4b')](handleError(_0x5cdc91,null));};exports[_0xdf5e('0x29')]=function(_0x248e1c,_0x494280){if(_0x248e1c[_0xdf5e('0x50')]['id']){delete _0x248e1c[_0xdf5e('0x50')]['id'];}return db[_0xdf5e('0x32')][_0xdf5e('0x4e')]({'where':{'id':_0x248e1c[_0xdf5e('0x4d')]['id']}})[_0xdf5e('0x2a')](handleEntityNotFound(_0x494280,null))[_0xdf5e('0x2a')](saveUpdates(_0x248e1c[_0xdf5e('0x50')],null))[_0xdf5e('0x2a')](respondWithResult(_0x494280,null))[_0xdf5e('0x4b')](handleError(_0x494280,null));};exports[_0xdf5e('0x2b')]=function(_0x4b1580,_0x50b77a){return db[_0xdf5e('0x32')]['find']({'where':{'id':_0x4b1580[_0xdf5e('0x4d')]['id']}})[_0xdf5e('0x2a')](handleEntityNotFound(_0x50b77a,null))[_0xdf5e('0x2a')](removeEntity(_0x50b77a,null))[_0xdf5e('0x4b')](handleError(_0x50b77a,null));};exports[_0xdf5e('0x51')]=function(_0x3c3df3,_0x427c0d,_0x49666f){var _0x1d9f23={};var _0x2a781e={};var _0x4e9d3e;var _0x390a85;return db[_0xdf5e('0x32')][_0xdf5e('0x52')]({'where':{'id':_0x3c3df3[_0xdf5e('0x4d')]['id']}})[_0xdf5e('0x2a')](handleEntityNotFound(_0x427c0d,null))[_0xdf5e('0x2a')](function(_0x40285c){if(_0x40285c){_0x4e9d3e=_0x40285c;_0x2a781e['model']=_[_0xdf5e('0x37')](db['SalesforceField'][_0xdf5e('0x33')]);_0x2a781e[_0xdf5e('0x36')]=_[_0xdf5e('0x37')](_0x3c3df3[_0xdf5e('0x36')]);_0x2a781e[_0xdf5e('0x41')]=_[_0xdf5e('0x38')](_0x2a781e['model'],_0x2a781e['query']);_0x1d9f23['attributes']=_[_0xdf5e('0x38')](_0x2a781e['model'],qs[_0xdf5e('0x3b')](_0x3c3df3['query'][_0xdf5e('0x3b')]));_0x1d9f23['attributes']=_0x1d9f23[_0xdf5e('0x3a')][_0xdf5e('0x3c')]?_0x1d9f23[_0xdf5e('0x3a')]:_0x2a781e['model'];_0x1d9f23['order']=qs[_0xdf5e('0x3f')](_0x3c3df3[_0xdf5e('0x36')][_0xdf5e('0x3f')]);_0x1d9f23['where']=qs[_0xdf5e('0x41')](_[_0xdf5e('0x42')](_0x3c3df3['query'],_0x2a781e[_0xdf5e('0x41')]));if(_0x3c3df3[_0xdf5e('0x36')][_0xdf5e('0x43')]){_0x1d9f23['where']=_[_0xdf5e('0x44')](_0x1d9f23[_0xdf5e('0x40')],{'$or':_[_0xdf5e('0x31')](_0x1d9f23[_0xdf5e('0x3a')],function(_0x44d06b){var _0x34f7a8={};_0x34f7a8[_0x44d06b]={'$like':'%'+_0x3c3df3[_0xdf5e('0x36')]['filter']+'%'};return _0x34f7a8;})});}_0x1d9f23=_['merge']({},_0x1d9f23,_0x3c3df3[_0xdf5e('0x46')]);return _0x4e9d3e[_0xdf5e('0x51')](_0x1d9f23);}})['then'](function(_0x5e4551){if(_0x5e4551){_0x390a85=_0x5e4551['length'];if(!_0x3c3df3['query'][_0xdf5e('0x53')](_0xdf5e('0x3d'))){_0x1d9f23[_0xdf5e('0x22')]=qs[_0xdf5e('0x22')](_0x3c3df3[_0xdf5e('0x36')][_0xdf5e('0x22')]);_0x1d9f23[_0xdf5e('0x20')]=qs['offset'](_0x3c3df3[_0xdf5e('0x36')]['offset']);}return _0x4e9d3e['getFields'](_0x1d9f23);}})['then'](function(_0x57eb2f){if(_0x57eb2f){return _0x57eb2f?{'count':_0x390a85,'rows':_0x57eb2f}:null;}})[_0xdf5e('0x2a')](respondWithResult(_0x427c0d,null))['catch'](handleError(_0x427c0d,null));};exports[_0xdf5e('0x54')]=function(_0x3f42e4,_0x58abae,_0x2cdfa3){var _0xab0ee2={};var _0x14e8d8={};var _0x5ad561;var _0x4574cc;return db['SalesforceConfiguration'][_0xdf5e('0x52')]({'where':{'id':_0x3f42e4['params']['id']}})[_0xdf5e('0x2a')](handleEntityNotFound(_0x58abae,null))[_0xdf5e('0x2a')](function(_0x4ae041){if(_0x4ae041){_0x5ad561=_0x4ae041;_0x14e8d8['model']=_['keys'](db[_0xdf5e('0x55')][_0xdf5e('0x33')]);_0x14e8d8[_0xdf5e('0x36')]=_[_0xdf5e('0x37')](_0x3f42e4['query']);_0x14e8d8['filters']=_[_0xdf5e('0x38')](_0x14e8d8[_0xdf5e('0x39')],_0x14e8d8['query']);_0xab0ee2[_0xdf5e('0x3a')]=_[_0xdf5e('0x38')](_0x14e8d8[_0xdf5e('0x39')],qs[_0xdf5e('0x3b')](_0x3f42e4[_0xdf5e('0x36')][_0xdf5e('0x3b')]));_0xab0ee2['attributes']=_0xab0ee2['attributes']['length']?_0xab0ee2[_0xdf5e('0x3a')]:_0x14e8d8['model'];_0xab0ee2[_0xdf5e('0x3e')]=qs[_0xdf5e('0x3f')](_0x3f42e4[_0xdf5e('0x36')][_0xdf5e('0x3f')]);_0xab0ee2[_0xdf5e('0x40')]=qs['filters'](_[_0xdf5e('0x42')](_0x3f42e4[_0xdf5e('0x36')],_0x14e8d8[_0xdf5e('0x41')]));if(_0x3f42e4[_0xdf5e('0x36')][_0xdf5e('0x43')]){_0xab0ee2[_0xdf5e('0x40')]=_[_0xdf5e('0x44')](_0xab0ee2[_0xdf5e('0x40')],{'$or':_[_0xdf5e('0x31')](_0xab0ee2[_0xdf5e('0x3a')],function(_0x392494){var _0x2f5115={};_0x2f5115[_0x392494]={'$like':'%'+_0x3f42e4[_0xdf5e('0x36')][_0xdf5e('0x43')]+'%'};return _0x2f5115;})});}_0xab0ee2=_[_0xdf5e('0x44')]({},_0xab0ee2,_0x3f42e4[_0xdf5e('0x46')]);return _0x5ad561[_0xdf5e('0x54')](_0xab0ee2);}})[_0xdf5e('0x2a')](function(_0x480219){if(_0x480219){_0x4574cc=_0x480219[_0xdf5e('0x3c')];if(!_0x3f42e4[_0xdf5e('0x36')][_0xdf5e('0x53')](_0xdf5e('0x3d'))){_0xab0ee2[_0xdf5e('0x22')]=qs[_0xdf5e('0x22')](_0x3f42e4[_0xdf5e('0x36')][_0xdf5e('0x22')]);_0xab0ee2[_0xdf5e('0x20')]=qs['offset'](_0x3f42e4[_0xdf5e('0x36')][_0xdf5e('0x20')]);}return _0x5ad561[_0xdf5e('0x54')](_0xab0ee2);}})['then'](function(_0x49aa32){if(_0x49aa32){return _0x49aa32?{'count':_0x4574cc,'rows':_0x49aa32}:null;}})[_0xdf5e('0x2a')](respondWithResult(_0x58abae,null))[_0xdf5e('0x4b')](handleError(_0x58abae,null));};exports['getDescriptions']=function(_0x163936,_0x5790f1,_0x489a7d){var _0x557039={};var _0x5a65e4={};var _0xb462ac;var _0x353d9f;return db[_0xdf5e('0x32')]['findOne']({'where':{'id':_0x163936[_0xdf5e('0x4d')]['id']}})[_0xdf5e('0x2a')](handleEntityNotFound(_0x5790f1,null))['then'](function(_0x4b20c5){if(_0x4b20c5){_0xb462ac=_0x4b20c5;_0x5a65e4[_0xdf5e('0x39')]=_[_0xdf5e('0x37')](db[_0xdf5e('0x55')][_0xdf5e('0x33')]);_0x5a65e4[_0xdf5e('0x36')]=_[_0xdf5e('0x37')](_0x163936['query']);_0x5a65e4[_0xdf5e('0x41')]=_[_0xdf5e('0x38')](_0x5a65e4['model'],_0x5a65e4[_0xdf5e('0x36')]);_0x557039['attributes']=_[_0xdf5e('0x38')](_0x5a65e4[_0xdf5e('0x39')],qs[_0xdf5e('0x3b')](_0x163936[_0xdf5e('0x36')][_0xdf5e('0x3b')]));_0x557039[_0xdf5e('0x3a')]=_0x557039['attributes']['length']?_0x557039[_0xdf5e('0x3a')]:_0x5a65e4[_0xdf5e('0x39')];_0x557039['order']=qs[_0xdf5e('0x3f')](_0x163936[_0xdf5e('0x36')]['sort']);_0x557039[_0xdf5e('0x40')]=qs['filters'](_[_0xdf5e('0x42')](_0x163936[_0xdf5e('0x36')],_0x5a65e4[_0xdf5e('0x41')]));if(_0x163936['query']['filter']){_0x557039[_0xdf5e('0x40')]=_[_0xdf5e('0x44')](_0x557039['where'],{'$or':_['map'](_0x557039[_0xdf5e('0x3a')],function(_0x30e692){var _0xea5706={};_0xea5706[_0x30e692]={'$like':'%'+_0x163936[_0xdf5e('0x36')][_0xdf5e('0x43')]+'%'};return _0xea5706;})});}_0x557039=_[_0xdf5e('0x44')]({},_0x557039,_0x163936['options']);return _0xb462ac[_0xdf5e('0x56')](_0x557039);}})['then'](function(_0x358815){if(_0x358815){_0x353d9f=_0x358815['length'];if(!_0x163936[_0xdf5e('0x36')]['hasOwnProperty'](_0xdf5e('0x3d'))){_0x557039[_0xdf5e('0x22')]=qs['limit'](_0x163936[_0xdf5e('0x36')]['limit']);_0x557039[_0xdf5e('0x20')]=qs[_0xdf5e('0x20')](_0x163936[_0xdf5e('0x36')][_0xdf5e('0x20')]);}return _0xb462ac[_0xdf5e('0x56')](_0x557039);}})[_0xdf5e('0x2a')](function(_0x29d7c8){if(_0x29d7c8){return _0x29d7c8?{'count':_0x353d9f,'rows':_0x29d7c8}:null;}})['then'](respondWithResult(_0x5790f1,null))[_0xdf5e('0x4b')](handleError(_0x5790f1,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 9165e57..41e7cb2 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 _0xe880=['SalesforceConfiguration','int_salesforce_configurations','lodash','util','api','path','rimraf','../../config/environment','define'];(function(_0xdeebe1,_0x1d7434){var _0x2d8616=function(_0x20cb8b){while(--_0x20cb8b){_0xdeebe1['push'](_0xdeebe1['shift']());}};_0x2d8616(++_0x1d7434);}(_0xe880,0x1d6));var _0x0e88=function(_0x39d544,_0x35c14f){_0x39d544=_0x39d544-0x0;var _0x5a5ff2=_0xe880[_0x39d544];return _0x5a5ff2;};'use strict';var _=require(_0x0e88('0x0'));var util=require(_0x0e88('0x1'));var logger=require('../../config/logger')(_0x0e88('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x0e88('0x3'));var rimraf=require(_0x0e88('0x4'));var config=require(_0x0e88('0x5'));var attributes=require('./intSalesforceConfiguration.attributes');module['exports']=function(_0x166f27,_0x217439){return _0x166f27[_0x0e88('0x6')](_0x0e88('0x7'),attributes,{'tableName':_0x0e88('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf4ca=['moment','bluebird','request-promise','path','rimraf','../../config/environment','lodash','util'];(function(_0x469f15,_0x2e2e98){var _0x212f33=function(_0x3147e3){while(--_0x3147e3){_0x469f15['push'](_0x469f15['shift']());}};_0x212f33(++_0x2e2e98);}(_0xf4ca,0x10e));var _0xaf4c=function(_0x3a668b,_0x4dbecd){_0x3a668b=_0x3a668b-0x0;var _0x331700=_0xf4ca[_0x3a668b];return _0x331700;};'use strict';var _=require(_0xaf4c('0x0'));var util=require(_0xaf4c('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xaf4c('0x2'));var BPromise=require(_0xaf4c('0x3'));var rp=require(_0xaf4c('0x4'));var fs=require('fs');var path=require(_0xaf4c('0x5'));var rimraf=require(_0xaf4c('0x6'));var config=require(_0xaf4c('0x7'));var attributes=require('./intSalesforceConfiguration.attributes');module['exports']=function(_0x2391c2,_0x3ba0a2){return _0x2391c2['define']('SalesforceConfiguration',attributes,{'tableName':'int_salesforce_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js index 9ae70cd..83f54cb 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 _0x47ab=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','request\x20sent','stringify','error','code','SalesforceConfiguration,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x4efd3d,_0x2b9694){var _0x1293f2=function(_0x14b90f){while(--_0x14b90f){_0x4efd3d['push'](_0x4efd3d['shift']());}};_0x1293f2(++_0x2b9694);}(_0x47ab,0x95));var _0xb47a=function(_0x57e32f,_0x1a8ebd){_0x57e32f=_0x57e32f-0x0;var _0x33cf33=_0x47ab[_0x57e32f];return _0x33cf33;};'use strict';var _=require(_0xb47a('0x0'));var util=require('util');var moment=require(_0xb47a('0x1'));var BPromise=require(_0xb47a('0x2'));var rs=require(_0xb47a('0x3'));var fs=require('fs');var Redis=require(_0xb47a('0x4'));var db=require(_0xb47a('0x5'))['db'];var utils=require(_0xb47a('0x6'));var logger=require(_0xb47a('0x7'))('rpc');var config=require(_0xb47a('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xb47a('0x9')][_0xb47a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2faa08,_0x8743f6,_0x336f50){return new BPromise(function(_0x9b137,_0x1a0725){return client[_0xb47a('0xb')](_0x2faa08,_0x336f50)[_0xb47a('0xc')](function(_0x3ee0d8){logger[_0xb47a('0xd')]('SalesforceConfiguration,\x20%s,\x20%s',_0x8743f6,_0xb47a('0xe'));logger['debug']('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x8743f6,_0xb47a('0xe'),JSON[_0xb47a('0xf')](_0x3ee0d8));if(_0x3ee0d8[_0xb47a('0x10')]){if(_0x3ee0d8[_0xb47a('0x10')][_0xb47a('0x11')]===0x1f4){logger[_0xb47a('0x10')](_0xb47a('0x12'),_0x8743f6,_0x3ee0d8[_0xb47a('0x10')][_0xb47a('0x13')]);return _0x1a0725(_0x3ee0d8[_0xb47a('0x10')][_0xb47a('0x13')]);}logger[_0xb47a('0x10')](_0xb47a('0x12'),_0x8743f6,_0x3ee0d8['error']['message']);return _0x9b137(_0x3ee0d8[_0xb47a('0x10')][_0xb47a('0x13')]);}else{logger[_0xb47a('0xd')](_0xb47a('0x12'),_0x8743f6,_0xb47a('0xe'));_0x9b137(_0x3ee0d8[_0xb47a('0x14')][_0xb47a('0x13')]);}})[_0xb47a('0x15')](function(_0x340a99){logger['error'](_0xb47a('0x12'),_0x8743f6,_0x340a99);_0x1a0725(_0x340a99);});});} \ No newline at end of file +var _0x5fd2=['client','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x4eafed,_0x26e2bc){var _0x159c85=function(_0x6f129f){while(--_0x6f129f){_0x4eafed['push'](_0x4eafed['shift']());}};_0x159c85(++_0x26e2bc);}(_0x5fd2,0xbd));var _0x25fd=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x5fd2[_0x1d1779];return _0x2377e9;};'use strict';var _=require(_0x25fd('0x0'));var util=require(_0x25fd('0x1'));var moment=require('moment');var BPromise=require(_0x25fd('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x25fd('0x3'));var db=require(_0x25fd('0x4'))['db'];var utils=require(_0x25fd('0x5'));var logger=require('../../config/logger')(_0x25fd('0x6'));var config=require(_0x25fd('0x7'));var jayson=require(_0x25fd('0x8'));var client=jayson[_0x25fd('0x9')][_0x25fd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x92ad48,_0x2a74b6,_0x24f14f){return new BPromise(function(_0x3df6bd,_0x1e47f7){return client[_0x25fd('0xb')](_0x92ad48,_0x24f14f)[_0x25fd('0xc')](function(_0x49568a){logger[_0x25fd('0xd')](_0x25fd('0xe'),_0x2a74b6,_0x25fd('0xf'));logger['debug'](_0x25fd('0x10'),_0x2a74b6,_0x25fd('0xf'),JSON[_0x25fd('0x11')](_0x49568a));if(_0x49568a['error']){if(_0x49568a[_0x25fd('0x12')]['code']===0x1f4){logger['error'](_0x25fd('0xe'),_0x2a74b6,_0x49568a[_0x25fd('0x12')]['message']);return _0x1e47f7(_0x49568a[_0x25fd('0x12')][_0x25fd('0x13')]);}logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x2a74b6,_0x49568a['error']['message']);return _0x3df6bd(_0x49568a['error'][_0x25fd('0x13')]);}else{logger[_0x25fd('0xd')](_0x25fd('0xe'),_0x2a74b6,_0x25fd('0xf'));_0x3df6bd(_0x49568a[_0x25fd('0x14')]['message']);}})[_0x25fd('0x15')](function(_0x34e4d2){logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x2a74b6,_0x34e4d2);_0x1e47f7(_0x34e4d2);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index bb81bf2..4c32818 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 _0x2c24=['update','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','index','/:id','show','post','isAuthenticated','put'];(function(_0x3bc0c2,_0x211d06){var _0x32468f=function(_0x1e2862){while(--_0x1e2862){_0x3bc0c2['push'](_0x3bc0c2['shift']());}};_0x32468f(++_0x211d06);}(_0x2c24,0xca));var _0x42c2=function(_0x465ddc,_0x8af23c){_0x465ddc=_0x465ddc-0x0;var _0x33f8cd=_0x2c24[_0x465ddc];return _0x33f8cd;};'use strict';var multer=require(_0x42c2('0x0'));var util=require(_0x42c2('0x1'));var path=require(_0x42c2('0x2'));var timeout=require(_0x42c2('0x3'));var express=require(_0x42c2('0x4'));var router=express[_0x42c2('0x5')]();var fs_extra=require(_0x42c2('0x6'));var auth=require(_0x42c2('0x7'));var interaction=require(_0x42c2('0x8'));var config=require(_0x42c2('0x9'));var controller=require(_0x42c2('0xa'));router[_0x42c2('0xb')]('/',auth['isAuthenticated'](),controller[_0x42c2('0xc')]);router[_0x42c2('0xb')](_0x42c2('0xd'),auth['isAuthenticated'](),controller[_0x42c2('0xe')]);router[_0x42c2('0xf')]('/',auth[_0x42c2('0x10')](),controller['create']);router[_0x42c2('0x11')](_0x42c2('0xd'),auth[_0x42c2('0x10')](),controller[_0x42c2('0x12')]);router['delete'](_0x42c2('0xd'),auth[_0x42c2('0x10')](),controller[_0x42c2('0x13')]);module['exports']=router; \ No newline at end of file +var _0x2a01=['../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','/:id','isAuthenticated','post','create','update','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x30d92f,_0x56b4d1){var _0x5cd9b9=function(_0x3e3593){while(--_0x3e3593){_0x30d92f['push'](_0x30d92f['shift']());}};_0x5cd9b9(++_0x56b4d1);}(_0x2a01,0xa5));var _0x12a0=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0x2a01[_0x51020b];return _0x371e47;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x12a0('0x0'));var timeout=require(_0x12a0('0x1'));var express=require(_0x12a0('0x2'));var router=express[_0x12a0('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x12a0('0x4'));var interaction=require(_0x12a0('0x5'));var config=require(_0x12a0('0x6'));var controller=require(_0x12a0('0x7'));router[_0x12a0('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x12a0('0x8')](_0x12a0('0x9'),auth[_0x12a0('0xa')](),controller['show']);router[_0x12a0('0xb')]('/',auth[_0x12a0('0xa')](),controller[_0x12a0('0xc')]);router['put'](_0x12a0('0x9'),auth['isAuthenticated'](),controller[_0x12a0('0xd')]);router[_0x12a0('0xe')](_0x12a0('0x9'),auth['isAuthenticated'](),controller[_0x12a0('0xf')]);module[_0x12a0('0x10')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index f698dd4..62f3e10 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 _0x47c5=['string','STRING','customVariable','exports','ENUM','variable','keyValue'];(function(_0x3f623c,_0x305c12){var _0x3d0d6e=function(_0x4354a1){while(--_0x4354a1){_0x3f623c['push'](_0x3f623c['shift']());}};_0x3d0d6e(++_0x305c12);}(_0x47c5,0x1f4));var _0x547c=function(_0x388da2,_0x571cad){_0x388da2=_0x388da2-0x0;var _0x2b1a45=_0x47c5[_0x388da2];return _0x2b1a45;};'use strict';var Sequelize=require('sequelize');module[_0x547c('0x0')]={'type':{'type':Sequelize[_0x547c('0x1')]('string',_0x547c('0x2'),'customVariable',_0x547c('0x3'),'picklist'),'defaultValue':_0x547c('0x4')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x547c('0x5')]},'keyType':{'type':Sequelize['ENUM']('string',_0x547c('0x2'),_0x547c('0x6'))},'keyContent':{'type':Sequelize[_0x547c('0x5')]},'idField':{'type':Sequelize[_0x547c('0x5')]},'variableName':{'type':Sequelize[_0x547c('0x5')]}}; \ No newline at end of file +var _0xaf00=['string','variable','customVariable','keyValue','picklist','STRING','sequelize','exports','ENUM'];(function(_0x51e062,_0x49bc1e){var _0x2573a5=function(_0x472154){while(--_0x472154){_0x51e062['push'](_0x51e062['shift']());}};_0x2573a5(++_0x49bc1e);}(_0xaf00,0x165));var _0x0af0=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0xaf00[_0x5f09c5];return _0x426ad9;};'use strict';var Sequelize=require(_0x0af0('0x0'));module[_0x0af0('0x1')]={'type':{'type':Sequelize[_0x0af0('0x2')](_0x0af0('0x3'),_0x0af0('0x4'),_0x0af0('0x5'),_0x0af0('0x6'),_0x0af0('0x7')),'defaultValue':_0x0af0('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x0af0('0x8')]},'keyType':{'type':Sequelize[_0x0af0('0x2')](_0x0af0('0x3'),'variable',_0x0af0('0x5'))},'keyContent':{'type':Sequelize[_0x0af0('0x8')]},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 340f774..f8e6d2b 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 _0xa9bf=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','update','then','destroy','error','stack','name','index','map','SalesforceField','rawAttributes','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','pick','where','merge','type','VIRTUAL','filter','includeAll','rows','catch','keys','length','create','body','find','params','rimraf','fast-json-patch','request-promise','moment','util','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x4ac267,_0x436a5d){var _0x36c1ad=function(_0xfee4c6){while(--_0xfee4c6){_0x4ac267['push'](_0x4ac267['shift']());}};_0x36c1ad(++_0x436a5d);}(_0xa9bf,0xfe));var _0xfa9b=function(_0x3aee37,_0x4a4dfa){_0x3aee37=_0x3aee37-0x0;var _0x4e1a6b=_0xa9bf[_0x3aee37];return _0x4e1a6b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfa9b('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfa9b('0x1'));var rp=require(_0xfa9b('0x2'));var moment=require(_0xfa9b('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xfa9b('0x4'));var path=require('path');var sox=require(_0xfa9b('0x5'));var csv=require(_0xfa9b('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfa9b('0x7'));var squel=require(_0xfa9b('0x8'));var crypto=require(_0xfa9b('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xfa9b('0xa'));var toCsv=require(_0xfa9b('0x6'));var querystring=require(_0xfa9b('0xb'));var Papa=require(_0xfa9b('0xc'));var Redis=require(_0xfa9b('0xd'));var authService=require(_0xfa9b('0xe'));var qs=require(_0xfa9b('0xf'));var as=require(_0xfa9b('0x10'));var hardwareService=require(_0xfa9b('0x11'));var logger=require(_0xfa9b('0x12'))(_0xfa9b('0x13'));var utils=require(_0xfa9b('0x14'));var config=require(_0xfa9b('0x15'));var licenseUtil=require(_0xfa9b('0x16'));var db=require(_0xfa9b('0x17'))['db'];function respondWithStatusCode(_0x545371,_0x3960f0){_0x3960f0=_0x3960f0||0xcc;return function(_0xbae5e3){if(_0xbae5e3){return _0x545371[_0xfa9b('0x18')](_0x3960f0);}return _0x545371[_0xfa9b('0x19')](_0x3960f0)[_0xfa9b('0x1a')]();};}function respondWithResult(_0x5b98d3,_0x315bb3){_0x315bb3=_0x315bb3||0xc8;return function(_0x1762aa){if(_0x1762aa){return _0x5b98d3[_0xfa9b('0x19')](_0x315bb3)[_0xfa9b('0x1b')](_0x1762aa);}};}function respondWithFilteredResult(_0x50c555,_0x10b41d){return function(_0x304c26){if(_0x304c26){var _0x38e9a1=typeof _0x10b41d['offset']===_0xfa9b('0x1c')&&typeof _0x10b41d['limit']===_0xfa9b('0x1c');var _0x36f35e=_0x304c26[_0xfa9b('0x1d')];var _0x476aff=_0x38e9a1?0x0:_0x10b41d[_0xfa9b('0x1e')];var _0x226955=_0x38e9a1?_0x304c26['count']:_0x10b41d['offset']+_0x10b41d[_0xfa9b('0x1f')];var _0x1790f3;if(_0x226955>=_0x36f35e){_0x226955=_0x36f35e;_0x1790f3=0xc8;}else{_0x1790f3=0xce;}_0x50c555[_0xfa9b('0x19')](_0x1790f3);return _0x50c555[_0xfa9b('0x20')](_0xfa9b('0x21'),_0x476aff+'-'+_0x226955+'/'+_0x36f35e)['json'](_0x304c26);}return null;};}function patchUpdates(_0x161a6e){return function(_0x55aaec){try{jsonpatch['apply'](_0x55aaec,_0x161a6e,!![]);}catch(_0x39eb07){return BPromise['reject'](_0x39eb07);}return _0x55aaec['save']();};}function saveUpdates(_0x292ce1,_0x23aec3){return function(_0x3535c8){if(_0x3535c8){return _0x3535c8[_0xfa9b('0x22')](_0x292ce1)[_0xfa9b('0x23')](function(_0x230987){return _0x230987;});}return null;};}function removeEntity(_0x612a7b,_0x71eb49){return function(_0x47d196){if(_0x47d196){return _0x47d196[_0xfa9b('0x24')]()[_0xfa9b('0x23')](function(){_0x612a7b[_0xfa9b('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x86d8dd,_0x4555ed){return function(_0x9374c3){if(!_0x9374c3){_0x86d8dd['sendStatus'](0x194);}return _0x9374c3;};}function handleError(_0x21b03e,_0x746cef){_0x746cef=_0x746cef||0x1f4;return function(_0x595c23){logger[_0xfa9b('0x25')](_0x595c23[_0xfa9b('0x26')]);if(_0x595c23[_0xfa9b('0x27')]){delete _0x595c23['name'];}_0x21b03e[_0xfa9b('0x19')](_0x746cef)['send'](_0x595c23);};}exports[_0xfa9b('0x28')]=function(_0x46117b,_0x2bd65a){var _0x4c6289={},_0x4b7e62={},_0x17ca77={'count':0x0,'rows':[]};var _0x3350=_[_0xfa9b('0x29')](db[_0xfa9b('0x2a')][_0xfa9b('0x2b')],function(_0x4e10fa){return{'name':_0x4e10fa['fieldName'],'type':_0x4e10fa['type']['key']};});_0x4b7e62[_0xfa9b('0x2c')]=_[_0xfa9b('0x29')](_0x3350,_0xfa9b('0x27'));_0x4b7e62['query']=_['keys'](_0x46117b[_0xfa9b('0x2d')]);_0x4b7e62[_0xfa9b('0x2e')]=_[_0xfa9b('0x2f')](_0x4b7e62[_0xfa9b('0x2c')],_0x4b7e62[_0xfa9b('0x2d')]);_0x4c6289[_0xfa9b('0x30')]=_[_0xfa9b('0x2f')](_0x4b7e62[_0xfa9b('0x2c')],qs['fields'](_0x46117b[_0xfa9b('0x2d')][_0xfa9b('0x31')]));_0x4c6289['attributes']=_0x4c6289[_0xfa9b('0x30')]['length']?_0x4c6289[_0xfa9b('0x30')]:_0x4b7e62[_0xfa9b('0x2c')];if(!_0x46117b[_0xfa9b('0x2d')][_0xfa9b('0x32')](_0xfa9b('0x33'))){_0x4c6289['limit']=qs[_0xfa9b('0x1f')](_0x46117b['query'][_0xfa9b('0x1f')]);_0x4c6289[_0xfa9b('0x1e')]=qs['offset'](_0x46117b[_0xfa9b('0x2d')][_0xfa9b('0x1e')]);}_0x4c6289['order']=qs[_0xfa9b('0x34')](_0x46117b['query'][_0xfa9b('0x34')]);_0x4c6289['where']=qs[_0xfa9b('0x2e')](_[_0xfa9b('0x35')](_0x46117b[_0xfa9b('0x2d')],_0x4b7e62[_0xfa9b('0x2e')]),_0x3350);if(_0x46117b[_0xfa9b('0x2d')]['filter']){_0x4c6289[_0xfa9b('0x36')]=_[_0xfa9b('0x37')](_0x4c6289['where'],{'$or':_[_0xfa9b('0x29')](_0x3350,function(_0x369aca){if(_0x369aca[_0xfa9b('0x38')]!==_0xfa9b('0x39')){var _0x257a81={};_0x257a81[_0x369aca[_0xfa9b('0x27')]]={'$like':'%'+_0x46117b[_0xfa9b('0x2d')][_0xfa9b('0x3a')]+'%'};return _0x257a81;}})});}_0x4c6289=_['merge']({},_0x4c6289,_0x46117b['options']);var _0x7cdf7a={'where':_0x4c6289[_0xfa9b('0x36')]};return db[_0xfa9b('0x2a')][_0xfa9b('0x1d')](_0x7cdf7a)[_0xfa9b('0x23')](function(_0x4522fc){_0x17ca77['count']=_0x4522fc;if(_0x46117b[_0xfa9b('0x2d')][_0xfa9b('0x3b')]){_0x4c6289['include']=[{'all':!![]}];}return db[_0xfa9b('0x2a')]['findAll'](_0x4c6289);})[_0xfa9b('0x23')](function(_0x43d288){_0x17ca77[_0xfa9b('0x3c')]=_0x43d288;return _0x17ca77;})[_0xfa9b('0x23')](respondWithFilteredResult(_0x2bd65a,_0x4c6289))[_0xfa9b('0x3d')](handleError(_0x2bd65a,null));};exports['show']=function(_0x13ef6e,_0x15c418){var _0x4909e1={'raw':!![],'where':{'id':_0x13ef6e['params']['id']}},_0x356b22={};_0x356b22[_0xfa9b('0x2c')]=_[_0xfa9b('0x3e')](db[_0xfa9b('0x2a')][_0xfa9b('0x2b')]);_0x356b22[_0xfa9b('0x2d')]=_[_0xfa9b('0x3e')](_0x13ef6e[_0xfa9b('0x2d')]);_0x356b22['filters']=_[_0xfa9b('0x2f')](_0x356b22[_0xfa9b('0x2c')],_0x356b22[_0xfa9b('0x2d')]);_0x4909e1['attributes']=_['intersection'](_0x356b22[_0xfa9b('0x2c')],qs[_0xfa9b('0x31')](_0x13ef6e[_0xfa9b('0x2d')][_0xfa9b('0x31')]));_0x4909e1[_0xfa9b('0x30')]=_0x4909e1[_0xfa9b('0x30')][_0xfa9b('0x3f')]?_0x4909e1[_0xfa9b('0x30')]:_0x356b22[_0xfa9b('0x2c')];if(_0x13ef6e[_0xfa9b('0x2d')][_0xfa9b('0x3b')]){_0x4909e1['include']=[{'all':!![]}];}_0x4909e1=_[_0xfa9b('0x37')]({},_0x4909e1,_0x13ef6e['options']);return db['SalesforceField']['find'](_0x4909e1)[_0xfa9b('0x23')](handleEntityNotFound(_0x15c418,null))[_0xfa9b('0x23')](respondWithResult(_0x15c418,null))[_0xfa9b('0x3d')](handleError(_0x15c418,null));};exports['create']=function(_0x55d333,_0x560a95){return db['SalesforceField'][_0xfa9b('0x40')](_0x55d333[_0xfa9b('0x41')],{})['then'](respondWithResult(_0x560a95,0xc9))[_0xfa9b('0x3d')](handleError(_0x560a95,null));};exports[_0xfa9b('0x22')]=function(_0x478ef9,_0x259a8c){if(_0x478ef9[_0xfa9b('0x41')]['id']){delete _0x478ef9[_0xfa9b('0x41')]['id'];}return db[_0xfa9b('0x2a')][_0xfa9b('0x42')]({'where':{'id':_0x478ef9[_0xfa9b('0x43')]['id']}})[_0xfa9b('0x23')](handleEntityNotFound(_0x259a8c,null))['then'](saveUpdates(_0x478ef9[_0xfa9b('0x41')],null))[_0xfa9b('0x23')](respondWithResult(_0x259a8c,null))[_0xfa9b('0x3d')](handleError(_0x259a8c,null));};exports[_0xfa9b('0x24')]=function(_0x11a800,_0x14625b){return db[_0xfa9b('0x2a')]['find']({'where':{'id':_0x11a800[_0xfa9b('0x43')]['id']}})[_0xfa9b('0x23')](handleEntityNotFound(_0x14625b,null))[_0xfa9b('0x23')](removeEntity(_0x14625b,null))[_0xfa9b('0x3d')](handleError(_0x14625b,null));}; \ No newline at end of file +var _0xa3f9=['filters','intersection','fields','attributes','length','nolimit','order','sort','where','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','end','error','stack','name','send','SalesforceField','rawAttributes','fieldName','key','model','map','query'];(function(_0x438685,_0x4ec0c0){var _0x41cca2=function(_0x532003){while(--_0x532003){_0x438685['push'](_0x438685['shift']());}};_0x41cca2(++_0x4ec0c0);}(_0xa3f9,0x19e));var _0x9a3f=function(_0x4c4958,_0x120ed1){_0x4c4958=_0x4c4958-0x0;var _0xb8271b=_0xa3f9[_0x4c4958];return _0xb8271b;};'use strict';var emlformat=require(_0x9a3f('0x0'));var rimraf=require(_0x9a3f('0x1'));var zipdir=require(_0x9a3f('0x2'));var jsonpatch=require(_0x9a3f('0x3'));var rp=require(_0x9a3f('0x4'));var moment=require('moment');var BPromise=require(_0x9a3f('0x5'));var Mustache=require(_0x9a3f('0x6'));var util=require(_0x9a3f('0x7'));var path=require(_0x9a3f('0x8'));var sox=require(_0x9a3f('0x9'));var csv=require(_0x9a3f('0xa'));var ejs=require(_0x9a3f('0xb'));var fs=require('fs');var fs_extra=require(_0x9a3f('0xc'));var _=require(_0x9a3f('0xd'));var squel=require(_0x9a3f('0xe'));var crypto=require(_0x9a3f('0xf'));var jsforce=require(_0x9a3f('0x10'));var deskjs=require(_0x9a3f('0x11'));var toCsv=require('to-csv');var querystring=require(_0x9a3f('0x12'));var Papa=require(_0x9a3f('0x13'));var Redis=require(_0x9a3f('0x14'));var authService=require(_0x9a3f('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0x9a3f('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9a3f('0x17'))(_0x9a3f('0x18'));var utils=require(_0x9a3f('0x19'));var config=require(_0x9a3f('0x1a'));var licenseUtil=require(_0x9a3f('0x1b'));var db=require(_0x9a3f('0x1c'))['db'];function respondWithStatusCode(_0x352e17,_0x406d31){_0x406d31=_0x406d31||0xcc;return function(_0x2af319){if(_0x2af319){return _0x352e17[_0x9a3f('0x1d')](_0x406d31);}return _0x352e17['status'](_0x406d31)['end']();};}function respondWithResult(_0xb1c8b4,_0x5566e){_0x5566e=_0x5566e||0xc8;return function(_0x19ea2f){if(_0x19ea2f){return _0xb1c8b4[_0x9a3f('0x1e')](_0x5566e)[_0x9a3f('0x1f')](_0x19ea2f);}};}function respondWithFilteredResult(_0x350c34,_0x2e2335){return function(_0x5452aa){if(_0x5452aa){var _0x5293fc=typeof _0x2e2335[_0x9a3f('0x20')]===_0x9a3f('0x21')&&typeof _0x2e2335[_0x9a3f('0x22')]==='undefined';var _0x417726=_0x5452aa[_0x9a3f('0x23')];var _0x352c74=_0x5293fc?0x0:_0x2e2335[_0x9a3f('0x20')];var _0x13eccb=_0x5293fc?_0x5452aa['count']:_0x2e2335['offset']+_0x2e2335['limit'];var _0x119c4b;if(_0x13eccb>=_0x417726){_0x13eccb=_0x417726;_0x119c4b=0xc8;}else{_0x119c4b=0xce;}_0x350c34[_0x9a3f('0x1e')](_0x119c4b);return _0x350c34[_0x9a3f('0x24')]('Content-Range',_0x352c74+'-'+_0x13eccb+'/'+_0x417726)[_0x9a3f('0x1f')](_0x5452aa);}return null;};}function patchUpdates(_0x2b1682){return function(_0x4a5e6b){try{jsonpatch[_0x9a3f('0x25')](_0x4a5e6b,_0x2b1682,!![]);}catch(_0x420b5d){return BPromise[_0x9a3f('0x26')](_0x420b5d);}return _0x4a5e6b[_0x9a3f('0x27')]();};}function saveUpdates(_0x26696a,_0x31ac49){return function(_0x38c9ff){if(_0x38c9ff){return _0x38c9ff[_0x9a3f('0x28')](_0x26696a)['then'](function(_0x1d218c){return _0x1d218c;});}return null;};}function removeEntity(_0x15982a,_0xce18fa){return function(_0xdc7a32){if(_0xdc7a32){return _0xdc7a32['destroy']()[_0x9a3f('0x29')](function(){_0x15982a['status'](0xcc)[_0x9a3f('0x2a')]();});}};}function handleEntityNotFound(_0x227f77,_0x4bb14e){return function(_0x2e928c){if(!_0x2e928c){_0x227f77['sendStatus'](0x194);}return _0x2e928c;};}function handleError(_0x112bf5,_0xe5cb4f){_0xe5cb4f=_0xe5cb4f||0x1f4;return function(_0x2d70c4){logger[_0x9a3f('0x2b')](_0x2d70c4[_0x9a3f('0x2c')]);if(_0x2d70c4['name']){delete _0x2d70c4[_0x9a3f('0x2d')];}_0x112bf5[_0x9a3f('0x1e')](_0xe5cb4f)[_0x9a3f('0x2e')](_0x2d70c4);};}exports['index']=function(_0x4bd3a5,_0x2e41f7){var _0x4bd580={},_0x71eb66={},_0x27d4e2={'count':0x0,'rows':[]};var _0x52a594=_['map'](db[_0x9a3f('0x2f')][_0x9a3f('0x30')],function(_0x450217){return{'name':_0x450217[_0x9a3f('0x31')],'type':_0x450217['type'][_0x9a3f('0x32')]};});_0x71eb66[_0x9a3f('0x33')]=_[_0x9a3f('0x34')](_0x52a594,_0x9a3f('0x2d'));_0x71eb66[_0x9a3f('0x35')]=_['keys'](_0x4bd3a5[_0x9a3f('0x35')]);_0x71eb66[_0x9a3f('0x36')]=_[_0x9a3f('0x37')](_0x71eb66[_0x9a3f('0x33')],_0x71eb66[_0x9a3f('0x35')]);_0x4bd580['attributes']=_['intersection'](_0x71eb66[_0x9a3f('0x33')],qs[_0x9a3f('0x38')](_0x4bd3a5[_0x9a3f('0x35')][_0x9a3f('0x38')]));_0x4bd580['attributes']=_0x4bd580[_0x9a3f('0x39')][_0x9a3f('0x3a')]?_0x4bd580['attributes']:_0x71eb66[_0x9a3f('0x33')];if(!_0x4bd3a5[_0x9a3f('0x35')]['hasOwnProperty'](_0x9a3f('0x3b'))){_0x4bd580[_0x9a3f('0x22')]=qs[_0x9a3f('0x22')](_0x4bd3a5[_0x9a3f('0x35')][_0x9a3f('0x22')]);_0x4bd580[_0x9a3f('0x20')]=qs[_0x9a3f('0x20')](_0x4bd3a5['query']['offset']);}_0x4bd580[_0x9a3f('0x3c')]=qs[_0x9a3f('0x3d')](_0x4bd3a5[_0x9a3f('0x35')]['sort']);_0x4bd580[_0x9a3f('0x3e')]=qs[_0x9a3f('0x36')](_['pick'](_0x4bd3a5['query'],_0x71eb66[_0x9a3f('0x36')]),_0x52a594);if(_0x4bd3a5[_0x9a3f('0x35')][_0x9a3f('0x3f')]){_0x4bd580[_0x9a3f('0x3e')]=_[_0x9a3f('0x40')](_0x4bd580['where'],{'$or':_['map'](_0x52a594,function(_0x197f39){if(_0x197f39[_0x9a3f('0x41')]!==_0x9a3f('0x42')){var _0x2cf6da={};_0x2cf6da[_0x197f39['name']]={'$like':'%'+_0x4bd3a5[_0x9a3f('0x35')][_0x9a3f('0x3f')]+'%'};return _0x2cf6da;}})});}_0x4bd580=_[_0x9a3f('0x40')]({},_0x4bd580,_0x4bd3a5['options']);var _0x84fce1={'where':_0x4bd580[_0x9a3f('0x3e')]};return db[_0x9a3f('0x2f')][_0x9a3f('0x23')](_0x84fce1)[_0x9a3f('0x29')](function(_0x57ebd4){_0x27d4e2[_0x9a3f('0x23')]=_0x57ebd4;if(_0x4bd3a5[_0x9a3f('0x35')][_0x9a3f('0x43')]){_0x4bd580[_0x9a3f('0x44')]=[{'all':!![]}];}return db[_0x9a3f('0x2f')][_0x9a3f('0x45')](_0x4bd580);})[_0x9a3f('0x29')](function(_0x4243b6){_0x27d4e2[_0x9a3f('0x46')]=_0x4243b6;return _0x27d4e2;})[_0x9a3f('0x29')](respondWithFilteredResult(_0x2e41f7,_0x4bd580))[_0x9a3f('0x47')](handleError(_0x2e41f7,null));};exports[_0x9a3f('0x48')]=function(_0x215c29,_0x5b54d6){var _0x304d06={'raw':!![],'where':{'id':_0x215c29[_0x9a3f('0x49')]['id']}},_0x3a79b6={};_0x3a79b6[_0x9a3f('0x33')]=_[_0x9a3f('0x4a')](db[_0x9a3f('0x2f')][_0x9a3f('0x30')]);_0x3a79b6[_0x9a3f('0x35')]=_[_0x9a3f('0x4a')](_0x215c29['query']);_0x3a79b6[_0x9a3f('0x36')]=_[_0x9a3f('0x37')](_0x3a79b6[_0x9a3f('0x33')],_0x3a79b6[_0x9a3f('0x35')]);_0x304d06[_0x9a3f('0x39')]=_[_0x9a3f('0x37')](_0x3a79b6[_0x9a3f('0x33')],qs[_0x9a3f('0x38')](_0x215c29[_0x9a3f('0x35')][_0x9a3f('0x38')]));_0x304d06[_0x9a3f('0x39')]=_0x304d06[_0x9a3f('0x39')][_0x9a3f('0x3a')]?_0x304d06[_0x9a3f('0x39')]:_0x3a79b6[_0x9a3f('0x33')];if(_0x215c29[_0x9a3f('0x35')][_0x9a3f('0x43')]){_0x304d06['include']=[{'all':!![]}];}_0x304d06=_[_0x9a3f('0x40')]({},_0x304d06,_0x215c29['options']);return db[_0x9a3f('0x2f')]['find'](_0x304d06)[_0x9a3f('0x29')](handleEntityNotFound(_0x5b54d6,null))[_0x9a3f('0x29')](respondWithResult(_0x5b54d6,null))[_0x9a3f('0x47')](handleError(_0x5b54d6,null));};exports[_0x9a3f('0x4b')]=function(_0x3622e4,_0x1c68e9){return db[_0x9a3f('0x2f')]['create'](_0x3622e4['body'],{})[_0x9a3f('0x29')](respondWithResult(_0x1c68e9,0xc9))[_0x9a3f('0x47')](handleError(_0x1c68e9,null));};exports[_0x9a3f('0x28')]=function(_0x4401b5,_0x399537){if(_0x4401b5[_0x9a3f('0x4c')]['id']){delete _0x4401b5[_0x9a3f('0x4c')]['id'];}return db[_0x9a3f('0x2f')][_0x9a3f('0x4d')]({'where':{'id':_0x4401b5[_0x9a3f('0x49')]['id']}})['then'](handleEntityNotFound(_0x399537,null))[_0x9a3f('0x29')](saveUpdates(_0x4401b5[_0x9a3f('0x4c')],null))[_0x9a3f('0x29')](respondWithResult(_0x399537,null))[_0x9a3f('0x47')](handleError(_0x399537,null));};exports['destroy']=function(_0x2cfeaf,_0x49ea22){return db[_0x9a3f('0x2f')][_0x9a3f('0x4d')]({'where':{'id':_0x2cfeaf[_0x9a3f('0x49')]['id']}})[_0x9a3f('0x29')](handleEntityNotFound(_0x49ea22,null))[_0x9a3f('0x29')](removeEntity(_0x49ea22,null))[_0x9a3f('0x47')](handleError(_0x49ea22,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 994a1bb..0d2c54c 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 _0x5fd3=['request-promise','path','rimraf','../../config/environment','./intSalesforceField.attributes','exports','SalesforceField','salesforce_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x3fe365,_0x366dc2){var _0x404f2d=function(_0x40f2db){while(--_0x40f2db){_0x3fe365['push'](_0x3fe365['shift']());}};_0x404f2d(++_0x366dc2);}(_0x5fd3,0x10a));var _0x35fd=function(_0x4c02d7,_0x20d2fe){_0x4c02d7=_0x4c02d7-0x0;var _0x1219e0=_0x5fd3[_0x4c02d7];return _0x1219e0;};'use strict';var _=require(_0x35fd('0x0'));var util=require(_0x35fd('0x1'));var logger=require(_0x35fd('0x2'))(_0x35fd('0x3'));var moment=require(_0x35fd('0x4'));var BPromise=require(_0x35fd('0x5'));var rp=require(_0x35fd('0x6'));var fs=require('fs');var path=require(_0x35fd('0x7'));var rimraf=require(_0x35fd('0x8'));var config=require(_0x35fd('0x9'));var attributes=require(_0x35fd('0xa'));module[_0x35fd('0xb')]=function(_0x50c0d5,_0x5637db){return _0x50c0d5['define'](_0x35fd('0xc'),attributes,{'tableName':'int_salesforce_fields','paranoid':![],'indexes':[{'name':_0x35fd('0xd'),'fields':[_0x35fd('0xe'),_0x35fd('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0b6f=['lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','./intSalesforceField.attributes','exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','FieldId'];(function(_0x1ce464,_0x5e3f41){var _0x3381d8=function(_0x2c742c){while(--_0x2c742c){_0x1ce464['push'](_0x1ce464['shift']());}};_0x3381d8(++_0x5e3f41);}(_0x0b6f,0xd2));var _0xf0b6=function(_0x408e38,_0x23cda8){_0x408e38=_0x408e38-0x0;var _0x426b0e=_0x0b6f[_0x408e38];return _0x426b0e;};'use strict';var _=require(_0xf0b6('0x0'));var util=require('util');var logger=require(_0xf0b6('0x1'))(_0xf0b6('0x2'));var moment=require('moment');var BPromise=require(_0xf0b6('0x3'));var rp=require(_0xf0b6('0x4'));var fs=require('fs');var path=require(_0xf0b6('0x5'));var rimraf=require(_0xf0b6('0x6'));var config=require('../../config/environment');var attributes=require(_0xf0b6('0x7'));module[_0xf0b6('0x8')]=function(_0x43c657,_0x110468){return _0x43c657[_0xf0b6('0x9')](_0xf0b6('0xa'),attributes,{'tableName':_0xf0b6('0xb'),'paranoid':![],'indexes':[{'name':_0xf0b6('0xc'),'fields':['idField',_0xf0b6('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.rpc.js b/server/api/intSalesforceField/intSalesforceField.rpc.js index 4d8ad69..16055a7 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 _0x6046=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','error','code','message','SalesforceField,\x20%s,\x20%s','info','lodash','util'];(function(_0x7d6eca,_0x59d54a){var _0x128263=function(_0x4019d6){while(--_0x4019d6){_0x7d6eca['push'](_0x7d6eca['shift']());}};_0x128263(++_0x59d54a);}(_0x6046,0x157));var _0x6604=function(_0x300f0e,_0x1bac38){_0x300f0e=_0x300f0e-0x0;var _0x911361=_0x6046[_0x300f0e];return _0x911361;};'use strict';var _=require(_0x6604('0x0'));var util=require(_0x6604('0x1'));var moment=require(_0x6604('0x2'));var BPromise=require(_0x6604('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6604('0x4'));var db=require(_0x6604('0x5'))['db'];var utils=require(_0x6604('0x6'));var logger=require(_0x6604('0x7'))(_0x6604('0x8'));var config=require(_0x6604('0x9'));var jayson=require(_0x6604('0xa'));var client=jayson[_0x6604('0xb')][_0x6604('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x57d155,_0x460ada,_0x53b36c){return new BPromise(function(_0xeab8bd,_0x5caeee){return client[_0x6604('0xd')](_0x57d155,_0x53b36c)[_0x6604('0xe')](function(_0x2b8dd6){logger['info']('SalesforceField,\x20%s,\x20%s',_0x460ada,_0x6604('0xf'));logger[_0x6604('0x10')](_0x6604('0x11'),_0x460ada,_0x6604('0xf'),JSON['stringify'](_0x2b8dd6));if(_0x2b8dd6[_0x6604('0x12')]){if(_0x2b8dd6['error'][_0x6604('0x13')]===0x1f4){logger[_0x6604('0x12')]('SalesforceField,\x20%s,\x20%s',_0x460ada,_0x2b8dd6[_0x6604('0x12')][_0x6604('0x14')]);return _0x5caeee(_0x2b8dd6[_0x6604('0x12')][_0x6604('0x14')]);}logger[_0x6604('0x12')](_0x6604('0x15'),_0x460ada,_0x2b8dd6[_0x6604('0x12')]['message']);return _0xeab8bd(_0x2b8dd6[_0x6604('0x12')][_0x6604('0x14')]);}else{logger[_0x6604('0x16')](_0x6604('0x15'),_0x460ada,_0x6604('0xf'));_0xeab8bd(_0x2b8dd6['result'][_0x6604('0x14')]);}})['catch'](function(_0x4933a4){logger[_0x6604('0x12')]('SalesforceField,\x20%s,\x20%s',_0x460ada,_0x4933a4);_0x5caeee(_0x4933a4);});});} \ No newline at end of file +var _0xccb5=['stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','SalesforceField,\x20%s,\x20%s','request\x20sent','SalesforceField,\x20%s,\x20%s,\x20%s'];(function(_0x2b6985,_0x48aaaa){var _0x696bc1=function(_0x4e2702){while(--_0x4e2702){_0x2b6985['push'](_0x2b6985['shift']());}};_0x696bc1(++_0x48aaaa);}(_0xccb5,0x1ea));var _0x5ccb=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xccb5[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x5ccb('0x0'));var util=require(_0x5ccb('0x1'));var moment=require(_0x5ccb('0x2'));var BPromise=require(_0x5ccb('0x3'));var rs=require(_0x5ccb('0x4'));var fs=require('fs');var Redis=require(_0x5ccb('0x5'));var db=require(_0x5ccb('0x6'))['db'];var utils=require(_0x5ccb('0x7'));var logger=require(_0x5ccb('0x8'))(_0x5ccb('0x9'));var config=require(_0x5ccb('0xa'));var jayson=require(_0x5ccb('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1f8515,_0x128a5f,_0x2a4cb8){return new BPromise(function(_0x413924,_0x3b7bc2){return client['request'](_0x1f8515,_0x2a4cb8)[_0x5ccb('0xc')](function(_0x3014f0){logger['info'](_0x5ccb('0xd'),_0x128a5f,_0x5ccb('0xe'));logger['debug'](_0x5ccb('0xf'),_0x128a5f,_0x5ccb('0xe'),JSON[_0x5ccb('0x10')](_0x3014f0));if(_0x3014f0[_0x5ccb('0x11')]){if(_0x3014f0[_0x5ccb('0x11')][_0x5ccb('0x12')]===0x1f4){logger[_0x5ccb('0x11')](_0x5ccb('0xd'),_0x128a5f,_0x3014f0[_0x5ccb('0x11')][_0x5ccb('0x13')]);return _0x3b7bc2(_0x3014f0[_0x5ccb('0x11')]['message']);}logger[_0x5ccb('0x11')](_0x5ccb('0xd'),_0x128a5f,_0x3014f0[_0x5ccb('0x11')][_0x5ccb('0x13')]);return _0x413924(_0x3014f0[_0x5ccb('0x11')][_0x5ccb('0x13')]);}else{logger[_0x5ccb('0x14')]('SalesforceField,\x20%s,\x20%s',_0x128a5f,'request\x20sent');_0x413924(_0x3014f0[_0x5ccb('0x15')]['message']);}})[_0x5ccb('0x16')](function(_0xc94b39){logger[_0x5ccb('0x11')](_0x5ccb('0xd'),_0x128a5f,_0xc94b39);_0x3b7bc2(_0xc94b39);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index b4a6591..11e8324 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 _0x2b88=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','create','post','addConfiguration','update','delete','destroy'];(function(_0x42a8ef,_0x47ca83){var _0x41d986=function(_0x1fb122){while(--_0x1fb122){_0x42a8ef['push'](_0x42a8ef['shift']());}};_0x41d986(++_0x47ca83);}(_0x2b88,0xc1));var _0x82b8=function(_0xf30651,_0x964c8){_0xf30651=_0xf30651-0x0;var _0x5382a0=_0x2b88[_0xf30651];return _0x5382a0;};'use strict';var multer=require(_0x82b8('0x0'));var util=require(_0x82b8('0x1'));var path=require(_0x82b8('0x2'));var timeout=require(_0x82b8('0x3'));var express=require(_0x82b8('0x4'));var router=express[_0x82b8('0x5')]();var fs_extra=require(_0x82b8('0x6'));var auth=require(_0x82b8('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x82b8('0x8'));var controller=require(_0x82b8('0x9'));router[_0x82b8('0xa')]('/',auth[_0x82b8('0xb')](),controller[_0x82b8('0xc')]);router[_0x82b8('0xa')](_0x82b8('0xd'),auth[_0x82b8('0xb')](),controller[_0x82b8('0xe')]);router[_0x82b8('0xa')](_0x82b8('0xf'),auth[_0x82b8('0xb')](),controller['getConfigurations']);router['get'](_0x82b8('0x10'),auth[_0x82b8('0xb')](),controller['getFields']);router['post']('/',auth['isAuthenticated'](),controller[_0x82b8('0x11')]);router[_0x82b8('0x12')](_0x82b8('0xf'),auth[_0x82b8('0xb')](),controller[_0x82b8('0x13')]);router['put'](_0x82b8('0xd'),auth[_0x82b8('0xb')](),controller[_0x82b8('0x14')]);router[_0x82b8('0x15')](_0x82b8('0xd'),auth[_0x82b8('0xb')](),controller[_0x82b8('0x16')]);module[_0x82b8('0x17')]=router; \ No newline at end of file +var _0xf0db=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','isAuthenticated','index','/:id','show','/:id/configurations','get','/:id/fields','getFields','post','create','addConfiguration','put','delete'];(function(_0x447c93,_0x52f6ad){var _0x3cf531=function(_0x2f1462){while(--_0x2f1462){_0x447c93['push'](_0x447c93['shift']());}};_0x3cf531(++_0x52f6ad);}(_0xf0db,0x160));var _0xbf0d=function(_0x23c1e0,_0x2b78f3){_0x23c1e0=_0x23c1e0-0x0;var _0x14b5d3=_0xf0db[_0x23c1e0];return _0x14b5d3;};'use strict';var multer=require(_0xbf0d('0x0'));var util=require(_0xbf0d('0x1'));var path=require(_0xbf0d('0x2'));var timeout=require(_0xbf0d('0x3'));var express=require(_0xbf0d('0x4'));var router=express[_0xbf0d('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xbf0d('0x6'));var interaction=require(_0xbf0d('0x7'));var config=require(_0xbf0d('0x8'));var controller=require(_0xbf0d('0x9'));router['get']('/',auth[_0xbf0d('0xa')](),controller[_0xbf0d('0xb')]);router['get'](_0xbf0d('0xc'),auth['isAuthenticated'](),controller[_0xbf0d('0xd')]);router['get'](_0xbf0d('0xe'),auth[_0xbf0d('0xa')](),controller['getConfigurations']);router[_0xbf0d('0xf')](_0xbf0d('0x10'),auth['isAuthenticated'](),controller[_0xbf0d('0x11')]);router[_0xbf0d('0x12')]('/',auth[_0xbf0d('0xa')](),controller[_0xbf0d('0x13')]);router['post'](_0xbf0d('0xe'),auth[_0xbf0d('0xa')](),controller[_0xbf0d('0x14')]);router[_0xbf0d('0x15')](_0xbf0d('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xbf0d('0x16')](_0xbf0d('0xc'),auth[_0xbf0d('0xa')](),controller[_0xbf0d('0x17')]);module[_0xbf0d('0x18')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 86affe8..d26a48f 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 _0x259f=['sequelize','STRING','username','remoteUri'];(function(_0x1f1a97,_0xadfc15){var _0x29fc6a=function(_0x38c180){while(--_0x38c180){_0x1f1a97['push'](_0x1f1a97['shift']());}};_0x29fc6a(++_0xadfc15);}(_0x259f,0x1b4));var _0xf259=function(_0x44b8de,_0x57a49a){_0x44b8de=_0x44b8de-0x0;var _0x28d026=_0x259f[_0x44b8de];return _0x28d026;};'use strict';var Sequelize=require(_0xf259('0x0'));module['exports']={'name':{'type':Sequelize[_0xf259('0x1')]},'description':{'type':Sequelize[_0xf259('0x1')]},'username':{'type':Sequelize[_0xf259('0x1')],'unique':_0xf259('0x2')},'password':{'type':Sequelize[_0xf259('0x1')]},'email':{'type':Sequelize[_0xf259('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xf259('0x3')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x88c1=['STRING','username'];(function(_0xeedc37,_0x471981){var _0x3a4bcd=function(_0x43984e){while(--_0x43984e){_0xeedc37['push'](_0xeedc37['shift']());}};_0x3a4bcd(++_0x471981);}(_0x88c1,0x98));var _0x188c=function(_0xf9b6da,_0x25eb5d){_0xf9b6da=_0xf9b6da-0x0;var _0x3d6658=_0x88c1[_0xf9b6da];return _0x3d6658;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x188c('0x0')]},'description':{'type':Sequelize[_0x188c('0x0')]},'username':{'type':Sequelize[_0x188c('0x0')],'unique':_0x188c('0x1')},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x188c('0x0')]},'remoteUri':{'type':Sequelize[_0x188c('0x0')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x188c('0x0')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index 6a80a52..8deb073 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 _0xf03e=['findAll','catch','show','rawAttributes','length','includeAll','find','create','body','params','destroy','findOne','ServicenowConfiguration','order','pick','filter','options','getConfigurations','addConfiguration','Subjects','channel','getDescriptions','ServicenowField','getFields','made_sla','hold_reason','notify','incident_state','upon_reject','sys_updated_on','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on','sys_domain','state','calendar_stc','closed_at','cmdb_ci','delivery_plan','impact','active','work_notes_list','priority','sys_domain_path','time_worked','expected_start','business_duration','group_list','work_end','resolved_at','caller_id','subcategory','work_notes','short_description','close_code','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','contact_type','reopened_by','urgency','problem_id','company','reassignment_count','activity_due','comments','sla_due','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','escalation','correlation_id','category','username','password','remoteUri','serverUrl','slice','substring','lastIndexOf','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','result','includes','forEach','label','push','assign','log','TCL:\x20_object','remove','internalType','all','concat','ServiceNow\x20error:\x20','test','statusCode','error','Wrong\x20credentials','boolean','True','true','False','false','value','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','limit','offset','count','set','json','apply','reject','save','update','then','stack','name','send','index','ServicenowAccount','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL'];(function(_0x93f0ec,_0x221cb1){var _0x29983e=function(_0xbee51a){while(--_0xbee51a){_0x93f0ec['push'](_0x93f0ec['shift']());}};_0x29983e(++_0x221cb1);}(_0xf03e,0x1e2));var _0xef03=function(_0xa48d39,_0x180f15){_0xa48d39=_0xa48d39-0x0;var _0x565bf7=_0xf03e[_0xa48d39];return _0x565bf7;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xef03('0x0'));var jsonpatch=require(_0xef03('0x1'));var rp=require(_0xef03('0x2'));var moment=require(_0xef03('0x3'));var BPromise=require(_0xef03('0x4'));var Mustache=require(_0xef03('0x5'));var util=require(_0xef03('0x6'));var path=require('path');var sox=require(_0xef03('0x7'));var csv=require(_0xef03('0x8'));var ejs=require(_0xef03('0x9'));var fs=require('fs');var fs_extra=require(_0xef03('0xa'));var _=require(_0xef03('0xb'));var squel=require(_0xef03('0xc'));var crypto=require('crypto');var jsforce=require(_0xef03('0xd'));var deskjs=require(_0xef03('0xe'));var toCsv=require(_0xef03('0x8'));var querystring=require(_0xef03('0xf'));var Papa=require(_0xef03('0x10'));var Redis=require(_0xef03('0x11'));var authService=require(_0xef03('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xef03('0x13'));var hardwareService=require(_0xef03('0x14'));var logger=require(_0xef03('0x15'))(_0xef03('0x16'));var utils=require(_0xef03('0x17'));var config=require(_0xef03('0x18'));var licenseUtil=require(_0xef03('0x19'));var db=require('../../mysqldb')['db'];var integrations=require(_0xef03('0x1a'));function respondWithStatusCode(_0x1a4db2,_0x3f7ac){_0x3f7ac=_0x3f7ac||0xcc;return function(_0x37f6dd){if(_0x37f6dd){return _0x1a4db2[_0xef03('0x1b')](_0x3f7ac);}return _0x1a4db2[_0xef03('0x1c')](_0x3f7ac)[_0xef03('0x1d')]();};}function respondWithResult(_0xbca47d,_0x49d178){_0x49d178=_0x49d178||0xc8;return function(_0x4cc8e9){if(_0x4cc8e9){return _0xbca47d[_0xef03('0x1c')](_0x49d178)['json'](_0x4cc8e9);}};}function respondWithFilteredResult(_0x25861f,_0x1b39e0){return function(_0x48f028){if(_0x48f028){var _0x1a3dcd=typeof _0x1b39e0['offset']==='undefined'&&typeof _0x1b39e0[_0xef03('0x1e')]==='undefined';var _0x5da874=_0x48f028['count'];var _0x3edd18=_0x1a3dcd?0x0:_0x1b39e0[_0xef03('0x1f')];var _0x5c7cae=_0x1a3dcd?_0x48f028[_0xef03('0x20')]:_0x1b39e0[_0xef03('0x1f')]+_0x1b39e0[_0xef03('0x1e')];var _0x523301;if(_0x5c7cae>=_0x5da874){_0x5c7cae=_0x5da874;_0x523301=0xc8;}else{_0x523301=0xce;}_0x25861f['status'](_0x523301);return _0x25861f[_0xef03('0x21')]('Content-Range',_0x3edd18+'-'+_0x5c7cae+'/'+_0x5da874)[_0xef03('0x22')](_0x48f028);}return null;};}function patchUpdates(_0x5de541){return function(_0x91957f){try{jsonpatch[_0xef03('0x23')](_0x91957f,_0x5de541,!![]);}catch(_0x1d8e53){return BPromise[_0xef03('0x24')](_0x1d8e53);}return _0x91957f[_0xef03('0x25')]();};}function saveUpdates(_0x3bbf7c,_0x1c344d){return function(_0x1e4332){if(_0x1e4332){return _0x1e4332[_0xef03('0x26')](_0x3bbf7c)[_0xef03('0x27')](function(_0x5540fb){return _0x5540fb;});}return null;};}function removeEntity(_0xf8a541,_0x7effd8){return function(_0x3829eb){if(_0x3829eb){return _0x3829eb['destroy']()[_0xef03('0x27')](function(){_0xf8a541[_0xef03('0x1c')](0xcc)[_0xef03('0x1d')]();});}};}function handleEntityNotFound(_0x40e959,_0x1fb8c7){return function(_0x558be0){if(!_0x558be0){_0x40e959['sendStatus'](0x194);}return _0x558be0;};}function handleError(_0x4d8a50,_0x2865d1){_0x2865d1=_0x2865d1||0x1f4;return function(_0x5cde64){logger['error'](_0x5cde64[_0xef03('0x28')]);if(_0x5cde64[_0xef03('0x29')]){delete _0x5cde64[_0xef03('0x29')];}_0x4d8a50[_0xef03('0x1c')](_0x2865d1)[_0xef03('0x2a')](_0x5cde64);};}exports[_0xef03('0x2b')]=function(_0x1bafc1,_0x2a8b17){var _0x35648f={},_0x4aae0d={},_0x5476f8={'count':0x0,'rows':[]};var _0x37345e=_['map'](db[_0xef03('0x2c')]['rawAttributes'],function(_0x2adc47){return{'name':_0x2adc47[_0xef03('0x2d')],'type':_0x2adc47[_0xef03('0x2e')][_0xef03('0x2f')]};});_0x4aae0d['model']=_['map'](_0x37345e,_0xef03('0x29'));_0x4aae0d[_0xef03('0x30')]=_[_0xef03('0x31')](_0x1bafc1[_0xef03('0x30')]);_0x4aae0d[_0xef03('0x32')]=_[_0xef03('0x33')](_0x4aae0d[_0xef03('0x34')],_0x4aae0d['query']);_0x35648f[_0xef03('0x35')]=_[_0xef03('0x33')](_0x4aae0d[_0xef03('0x34')],qs[_0xef03('0x36')](_0x1bafc1[_0xef03('0x30')][_0xef03('0x36')]));_0x35648f[_0xef03('0x35')]=_0x35648f[_0xef03('0x35')]['length']?_0x35648f[_0xef03('0x35')]:_0x4aae0d[_0xef03('0x34')];if(!_0x1bafc1[_0xef03('0x30')][_0xef03('0x37')](_0xef03('0x38'))){_0x35648f[_0xef03('0x1e')]=qs['limit'](_0x1bafc1[_0xef03('0x30')]['limit']);_0x35648f[_0xef03('0x1f')]=qs[_0xef03('0x1f')](_0x1bafc1[_0xef03('0x30')]['offset']);}_0x35648f['order']=qs['sort'](_0x1bafc1[_0xef03('0x30')][_0xef03('0x39')]);_0x35648f[_0xef03('0x3a')]=qs[_0xef03('0x32')](_['pick'](_0x1bafc1[_0xef03('0x30')],_0x4aae0d[_0xef03('0x32')]),_0x37345e);if(_0x1bafc1[_0xef03('0x30')]['filter']){_0x35648f[_0xef03('0x3a')]=_[_0xef03('0x3b')](_0x35648f['where'],{'$or':_['map'](_0x37345e,function(_0x1dfbf3){if(_0x1dfbf3[_0xef03('0x2e')]!==_0xef03('0x3c')){var _0x11cf95={};_0x11cf95[_0x1dfbf3[_0xef03('0x29')]]={'$like':'%'+_0x1bafc1[_0xef03('0x30')]['filter']+'%'};return _0x11cf95;}})});}_0x35648f=_[_0xef03('0x3b')]({},_0x35648f,_0x1bafc1['options']);var _0x2bd781={'where':_0x35648f[_0xef03('0x3a')]};return db[_0xef03('0x2c')][_0xef03('0x20')](_0x2bd781)['then'](function(_0x5089e3){_0x5476f8[_0xef03('0x20')]=_0x5089e3;if(_0x1bafc1[_0xef03('0x30')]['includeAll']){_0x35648f['include']=[{'all':!![]}];}return db['ServicenowAccount'][_0xef03('0x3d')](_0x35648f);})['then'](function(_0x58ecba){_0x5476f8['rows']=_0x58ecba;return _0x5476f8;})[_0xef03('0x27')](respondWithFilteredResult(_0x2a8b17,_0x35648f))[_0xef03('0x3e')](handleError(_0x2a8b17,null));};exports[_0xef03('0x3f')]=function(_0x83871f,_0x131af0){var _0x2cc950={'raw':![],'where':{'id':_0x83871f['params']['id']}},_0x28ea26={};_0x28ea26[_0xef03('0x34')]=_[_0xef03('0x31')](db[_0xef03('0x2c')][_0xef03('0x40')]);_0x28ea26['query']=_[_0xef03('0x31')](_0x83871f['query']);_0x28ea26[_0xef03('0x32')]=_[_0xef03('0x33')](_0x28ea26[_0xef03('0x34')],_0x28ea26['query']);_0x2cc950[_0xef03('0x35')]=_[_0xef03('0x33')](_0x28ea26['model'],qs[_0xef03('0x36')](_0x83871f[_0xef03('0x30')][_0xef03('0x36')]));_0x2cc950[_0xef03('0x35')]=_0x2cc950[_0xef03('0x35')][_0xef03('0x41')]?_0x2cc950[_0xef03('0x35')]:_0x28ea26[_0xef03('0x34')];if(_0x83871f['query'][_0xef03('0x42')]){_0x2cc950['include']=[{'all':!![]}];}_0x2cc950=_[_0xef03('0x3b')]({},_0x2cc950,_0x83871f['options']);return db['ServicenowAccount'][_0xef03('0x43')](_0x2cc950)[_0xef03('0x27')](handleEntityNotFound(_0x131af0,null))['then'](respondWithResult(_0x131af0,null))['catch'](handleError(_0x131af0,null));};exports[_0xef03('0x44')]=function(_0x25b763,_0x186aa9){return db['ServicenowAccount'][_0xef03('0x44')](_0x25b763[_0xef03('0x45')],{})['then'](respondWithResult(_0x186aa9,0xc9))[_0xef03('0x3e')](handleError(_0x186aa9,null));};exports['update']=function(_0x1f9e1b,_0x194d94){if(_0x1f9e1b[_0xef03('0x45')]['id']){delete _0x1f9e1b[_0xef03('0x45')]['id'];}return db['ServicenowAccount']['find']({'where':{'id':_0x1f9e1b[_0xef03('0x46')]['id']}})[_0xef03('0x27')](handleEntityNotFound(_0x194d94,null))[_0xef03('0x27')](saveUpdates(_0x1f9e1b[_0xef03('0x45')],null))[_0xef03('0x27')](respondWithResult(_0x194d94,null))[_0xef03('0x3e')](handleError(_0x194d94,null));};exports[_0xef03('0x47')]=function(_0x306ed8,_0x3b4496){return db[_0xef03('0x2c')][_0xef03('0x43')]({'where':{'id':_0x306ed8[_0xef03('0x46')]['id']}})[_0xef03('0x27')](handleEntityNotFound(_0x3b4496,null))[_0xef03('0x27')](removeEntity(_0x3b4496,null))[_0xef03('0x3e')](handleError(_0x3b4496,null));};exports['getConfigurations']=function(_0xfee905,_0x5068b2,_0x622bf4){var _0x12da8b={};var _0x5c9949={};var _0x668ad7;var _0x22cb6d;return db[_0xef03('0x2c')][_0xef03('0x48')]({'where':{'id':_0xfee905['params']['id']}})[_0xef03('0x27')](handleEntityNotFound(_0x5068b2,null))[_0xef03('0x27')](function(_0x10d119){if(_0x10d119){_0x668ad7=_0x10d119;_0x5c9949[_0xef03('0x34')]=_['keys'](db[_0xef03('0x49')]['rawAttributes']);_0x5c9949[_0xef03('0x30')]=_[_0xef03('0x31')](_0xfee905['query']);_0x5c9949[_0xef03('0x32')]=_[_0xef03('0x33')](_0x5c9949[_0xef03('0x34')],_0x5c9949[_0xef03('0x30')]);_0x12da8b[_0xef03('0x35')]=_['intersection'](_0x5c9949['model'],qs[_0xef03('0x36')](_0xfee905[_0xef03('0x30')][_0xef03('0x36')]));_0x12da8b[_0xef03('0x35')]=_0x12da8b['attributes'][_0xef03('0x41')]?_0x12da8b[_0xef03('0x35')]:_0x5c9949['model'];_0x12da8b[_0xef03('0x4a')]=qs[_0xef03('0x39')](_0xfee905['query'][_0xef03('0x39')]);_0x12da8b[_0xef03('0x3a')]=qs[_0xef03('0x32')](_[_0xef03('0x4b')](_0xfee905[_0xef03('0x30')],_0x5c9949[_0xef03('0x32')]));if(_0xfee905['query'][_0xef03('0x4c')]){_0x12da8b[_0xef03('0x3a')]=_[_0xef03('0x3b')](_0x12da8b[_0xef03('0x3a')],{'$or':_['map'](_0x12da8b[_0xef03('0x35')],function(_0x3eae64){var _0x2b2b0b={};_0x2b2b0b[_0x3eae64]={'$like':'%'+_0xfee905[_0xef03('0x30')][_0xef03('0x4c')]+'%'};return _0x2b2b0b;})});}_0x12da8b=_[_0xef03('0x3b')]({},_0x12da8b,_0xfee905[_0xef03('0x4d')]);return _0x668ad7[_0xef03('0x4e')](_0x12da8b);}})['then'](function(_0x12c6c0){if(_0x12c6c0){_0x22cb6d=_0x12c6c0['length'];if(!_0xfee905['query']['hasOwnProperty']('nolimit')){_0x12da8b[_0xef03('0x1e')]=qs[_0xef03('0x1e')](_0xfee905['query'][_0xef03('0x1e')]);_0x12da8b['offset']=qs[_0xef03('0x1f')](_0xfee905[_0xef03('0x30')]['offset']);}return _0x668ad7['getConfigurations'](_0x12da8b);}})[_0xef03('0x27')](function(_0x596e42){if(_0x596e42){return _0x596e42?{'count':_0x22cb6d,'rows':_0x596e42}:null;}})[_0xef03('0x27')](respondWithResult(_0x5068b2,null))[_0xef03('0x3e')](handleError(_0x5068b2,null));};exports[_0xef03('0x4f')]=function(_0x3ca67b,_0x11de33,_0x18ba2f){if(_0x3ca67b['body']['id']){delete _0x3ca67b[_0xef03('0x45')]['id'];}return db[_0xef03('0x2c')][_0xef03('0x48')]({'where':{'id':_0x3ca67b['params']['id']}})[_0xef03('0x27')](handleEntityNotFound(_0x11de33,null))['then'](function(_0x18a49c){if(_0x18a49c){_0x3ca67b[_0xef03('0x45')]['AccountId']=_0x18a49c['id'];_0x3ca67b['body'][_0xef03('0x50')]=integrations['getSubjects'](_0x3ca67b[_0xef03('0x45')][_0xef03('0x51')],_0x3ca67b[_0xef03('0x45')]['type']);_0x3ca67b[_0xef03('0x45')]['Descriptions']=integrations[_0xef03('0x52')](_0x3ca67b[_0xef03('0x45')][_0xef03('0x51')],_0x3ca67b['body']['type']);return db[_0xef03('0x49')][_0xef03('0x44')](_0x3ca67b[_0xef03('0x45')],{'include':[{'model':db[_0xef03('0x53')],'as':'Subjects'},{'model':db[_0xef03('0x53')],'as':'Descriptions'}]});}return null;})[_0xef03('0x27')](respondWithResult(_0x11de33,null))[_0xef03('0x3e')](handleError(_0x11de33,null));};exports[_0xef03('0x54')]=function(_0x370480,_0x239f66,_0x2478bf){var _0x1d3e2c=[_0xef03('0x55'),_0xef03('0x56'),'knowledge','subcategory','close_code',_0xef03('0x57'),_0xef03('0x58'),'severity','category'];var _0x3f3f14=['parent',_0xef03('0x55'),'caused_by','watch_list',_0xef03('0x59'),_0xef03('0x5a'),'child_incidents','hold_reason','approval_history','number',_0xef03('0x5b'),_0xef03('0x5c'),_0xef03('0x5d'),_0xef03('0x5e'),_0xef03('0x5f'),_0xef03('0x60'),_0xef03('0x61'),'sys_created_by','knowledge',_0xef03('0x4a'),_0xef03('0x62'),_0xef03('0x63'),_0xef03('0x64'),_0xef03('0x65'),_0xef03('0x66'),_0xef03('0x67'),_0xef03('0x68'),'business_service',_0xef03('0x69'),_0xef03('0x6a'),'rfc',_0xef03('0x6b'),_0xef03('0x6c'),'opened_at',_0xef03('0x6d'),_0xef03('0x6e'),_0xef03('0x6f'),'reopened_time',_0xef03('0x70'),_0xef03('0x71'),'approval_set',_0xef03('0x72'),_0xef03('0x73'),_0xef03('0x74'),_0xef03('0x75'),_0xef03('0x76'),_0xef03('0x77'),_0xef03('0x78'),_0xef03('0x79'),_0xef03('0x7a'),_0xef03('0x7b'),_0xef03('0x7c'),_0xef03('0x7d'),_0xef03('0x57'),_0xef03('0x7e'),_0xef03('0x7f'),_0xef03('0x80'),_0xef03('0x81'),_0xef03('0x82'),'sys_id',_0xef03('0x83'),_0xef03('0x84'),_0xef03('0x58'),_0xef03('0x85'),_0xef03('0x86'),_0xef03('0x87'),_0xef03('0x88'),_0xef03('0x89'),'assigned_to','severity',_0xef03('0x8a'),_0xef03('0x8b'),'approval',_0xef03('0x8c'),_0xef03('0x8d'),_0xef03('0x8e'),_0xef03('0x8f'),_0xef03('0x90'),_0xef03('0x91'),'upon_approval',_0xef03('0x92'),'location',_0xef03('0x93')];var _0x2ade6b='';var _0x451510='';var _0x1d5085=[];var _0x8db403='';var _0x612baa='';var _0x1e60b0=[];var _0x1f3aeb='';var _0x24aa7f='';var _0x578fad={};var _0x28006e='';return db[_0xef03('0x2c')][_0xef03('0x48')]({'where':{'id':_0x370480[_0xef03('0x46')]['id']},'attributes':['id',_0xef03('0x94'),_0xef03('0x95'),'email',_0xef03('0x96'),_0xef03('0x97')]})[_0xef03('0x27')](handleEntityNotFound(_0x239f66,null))[_0xef03('0x27')](function(_0x577ee0){if(_0x577ee0){_0x28006e=_0x577ee0[_0xef03('0x96')];var _0x24eae3=_0x28006e[_0xef03('0x98')](-0x1);if(_0x24eae3==='/'){_0x28006e=_0x28006e[_0xef03('0x99')](0x0,_0x28006e[_0xef03('0x9a')](_0x24eae3));}_0x24aa7f=util['format'](_0xef03('0x9b'),_0x28006e);_0x1f3aeb=util['format'](_0xef03('0x9c'),_0x28006e);_0x578fad={'user':_0x577ee0[_0xef03('0x94')],'pass':_0x577ee0[_0xef03('0x95')]};var _0x482345={'method':_0xef03('0x9d'),'uri':_0x24aa7f+'incident?sysparm_display_value=all','auth':_0x578fad,'json':!![]};return rp(_0x482345);}})[_0xef03('0x27')](function(_0x292c53){if(_0x292c53[_0xef03('0x9e')][_0xef03('0x41')]>0x0){_0x2ade6b=_0x292c53[_0xef03('0x9e')];}console['log']('incident\x20table\x20objects',_0x2ade6b);_0x1e60b0=[];_0x451510=Object['assign']([],_0x2ade6b);_['remove'](_0x451510,function(_0x468bbc){return!_0x1d3e2c[_0xef03('0x9f')](_0x468bbc[_0xef03('0x29')]);});_0x451510[_0xef03('0xa0')](function(_0xf5d914){var _0x5652b8=createFieldObject(_0x1f3aeb,_0x578fad,_0xf5d914['internalType'],_0xf5d914['name'],_0xf5d914[_0xef03('0xa1')],![]);_0x1e60b0[_0xef03('0xa2')](_0x5652b8);});return Promise['all'](_0x1e60b0);})[_0xef03('0x27')](function(_0x4c1c13){_0x1d5085=_0x4c1c13;_0x8db403=Object[_0xef03('0xa3')]([],_0x2ade6b);console[_0xef03('0xa4')](_0xef03('0xa5'),_0x2ade6b);_[_0xef03('0xa6')](_0x8db403,function(_0x596687){return _0x3f3f14[_0xef03('0x9f')](_0x596687[_0xef03('0x29')]);});console[_0xef03('0xa4')]('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x8db403);_0x1e60b0=[];_0x8db403['forEach'](function(_0x41d17e){var _0x49f447=createFieldObject(_0x1f3aeb,_0x578fad,_0x41d17e[_0xef03('0xa7')],_0x41d17e[_0xef03('0x29')],_0x41d17e[_0xef03('0xa1')],!![]);_0x1e60b0[_0xef03('0xa2')](_0x49f447);});return Promise[_0xef03('0xa8')](_0x1e60b0);})[_0xef03('0x27')](function(_0x1e900e){_0x612baa=_0x1e900e;var _0x51120f=_0x1d5085[_0xef03('0xa9')](_0x612baa);return{'count':_0x51120f['length'],'rows':_0x51120f};})[_0xef03('0x27')](respondWithResult(_0x239f66,null))[_0xef03('0x3e')](function(_0x57c1a6){console[_0xef03('0xa4')](_0xef03('0xaa')+_0x57c1a6);var _0x2d416d=_0x370480[_0xef03('0x30')][_0xef03('0xab')]?0x1f4:_0x57c1a6[_0xef03('0xac')]||0x1f4;logger[_0xef03('0xad')](_0x57c1a6[_0xef03('0x28')]);delete _0x57c1a6[_0xef03('0x29')];if(_0x2d416d===0x191){_0x2d416d=0x190;}_0x239f66['status'](_0x2d416d)[_0xef03('0x2a')](_0x370480[_0xef03('0x30')][_0xef03('0xab')]?{'message':_0xef03('0xae'),'statusCode':_0x57c1a6[_0xef03('0xac')]}:_0x57c1a6);});};function createFieldObject(_0x1cce7f,_0x42b34d,_0x16f80b,_0x47e288,_0x301a9c,_0x359b5c){return new Promise(function(_0x314f40,_0x3bfa7d){var _0x4d8d36={'id':_0x47e288,'name':_0x301a9c,'custom':_0x359b5c};if(_0x16f80b===_0xef03('0xaf')){_0x4d8d36[_0xef03('0x4d')]=[{'name':_0xef03('0xb0'),'value':_0xef03('0xb1')},{'name':_0xef03('0xb2'),'value':_0xef03('0xb3')}];_0x314f40(_0x4d8d36);}else{var _0x3d8073={'method':'GET','uri':_0x1cce7f+'sys_choice?sysparm_query=name=incident^element='+_0x47e288,'auth':_0x42b34d,'json':!![]};return rp(_0x3d8073)[_0xef03('0x27')](function(_0x294212){var _0x4328e9=[];if(_0x294212['result']['length']>0x0){_0x294212[_0xef03('0x9e')][_0xef03('0xa0')](function(_0x2768b6){if(_0x2768b6['inactive']===_0xef03('0xb3')){var _0x332053={'name':_0x2768b6['label'],'value':_0x2768b6[_0xef03('0xb4')]};_0x4328e9[_0xef03('0xa2')](_0x332053);}});}_0x4d8d36[_0xef03('0x4d')]=_0x4328e9;if(_0x4d8d36['options'][_0xef03('0x41')]>0x0){_0x314f40(_0x4d8d36);}else{if(_0x359b5c==![]){_0x314f40();}else{_0x314f40(_0x4d8d36);}}});}});} \ No newline at end of file +var _0x6a7d=['sort','where','pick','filter','merge','VIRTUAL','options','ServicenowAccount','include','findAll','catch','show','params','rawAttributes','includeAll','create','body','find','getConfigurations','addConfiguration','findOne','AccountId','Subjects','getSubjects','getDescriptions','channel','ServicenowConfiguration','ServicenowField','getFields','made_sla','hold_reason','subcategory','close_code','severity','category','caused_by','watch_list','upon_reject','sys_updated_on','approval_history','number','opened_by','user_input','sys_created_on','sys_domain','sys_created_by','knowledge','calendar_stc','closed_at','cmdb_ci','delivery_plan','work_notes_list','business_service','priority','sys_domain_path','rfc','time_worked','opened_at','work_end','reopened_time','resolved_at','approval_set','work_notes','short_description','correlation_display','delivery_task','business_stc','calendar_duration','notify','sys_class_name','close_notes','closed_by','follow_up','parent_incident','urgency','problem_id','company','activity_due','assigned_to','comments','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','escalation','upon_approval','location','username','email','remoteUri','serverUrl','slice','substring','lastIndexOf','%s/api/now/doc/table/schema/','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','remove','includes','internalType','label','push','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','forEach','ServiceNow\x20error:\x20','Wrong\x20credentials','statusCode','boolean','true','false','inactive','value','eml-format','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','limit','undefined','count','offset','set','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order'];(function(_0x5be8a1,_0x292a52){var _0x5f4587=function(_0x44874b){while(--_0x44874b){_0x5be8a1['push'](_0x5be8a1['shift']());}};_0x5f4587(++_0x292a52);}(_0x6a7d,0x77));var _0xd6a7=function(_0x33c638,_0x462bff){_0x33c638=_0x33c638-0x0;var _0x18a079=_0x6a7d[_0x33c638];return _0x18a079;};'use strict';var emlformat=require(_0xd6a7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd6a7('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd6a7('0x2'));var moment=require('moment');var BPromise=require(_0xd6a7('0x3'));var Mustache=require(_0xd6a7('0x4'));var util=require('util');var path=require(_0xd6a7('0x5'));var sox=require(_0xd6a7('0x6'));var csv=require(_0xd6a7('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd6a7('0x8'));var _=require(_0xd6a7('0x9'));var squel=require(_0xd6a7('0xa'));var crypto=require(_0xd6a7('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd6a7('0x7'));var querystring=require(_0xd6a7('0xc'));var Papa=require('papaparse');var Redis=require(_0xd6a7('0xd'));var authService=require(_0xd6a7('0xe'));var qs=require(_0xd6a7('0xf'));var as=require(_0xd6a7('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd6a7('0x11'));var utils=require(_0xd6a7('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xd6a7('0x13'));var db=require(_0xd6a7('0x14'))['db'];var integrations=require(_0xd6a7('0x15'));function respondWithStatusCode(_0xffc26a,_0x2d2766){_0x2d2766=_0x2d2766||0xcc;return function(_0x366e04){if(_0x366e04){return _0xffc26a[_0xd6a7('0x16')](_0x2d2766);}return _0xffc26a[_0xd6a7('0x17')](_0x2d2766)['end']();};}function respondWithResult(_0x357264,_0x56f492){_0x56f492=_0x56f492||0xc8;return function(_0x31edd7){if(_0x31edd7){return _0x357264['status'](_0x56f492)[_0xd6a7('0x18')](_0x31edd7);}};}function respondWithFilteredResult(_0x43d1cb,_0x58ea45){return function(_0x277542){if(_0x277542){var _0x4499f8=typeof _0x58ea45['offset']==='undefined'&&typeof _0x58ea45[_0xd6a7('0x19')]===_0xd6a7('0x1a');var _0x25c735=_0x277542[_0xd6a7('0x1b')];var _0x265059=_0x4499f8?0x0:_0x58ea45['offset'];var _0x4ba056=_0x4499f8?_0x277542[_0xd6a7('0x1b')]:_0x58ea45[_0xd6a7('0x1c')]+_0x58ea45['limit'];var _0x554f31;if(_0x4ba056>=_0x25c735){_0x4ba056=_0x25c735;_0x554f31=0xc8;}else{_0x554f31=0xce;}_0x43d1cb[_0xd6a7('0x17')](_0x554f31);return _0x43d1cb[_0xd6a7('0x1d')]('Content-Range',_0x265059+'-'+_0x4ba056+'/'+_0x25c735)[_0xd6a7('0x18')](_0x277542);}return null;};}function patchUpdates(_0x50fd0a){return function(_0x1dab50){try{jsonpatch[_0xd6a7('0x1e')](_0x1dab50,_0x50fd0a,!![]);}catch(_0x22b3d5){return BPromise[_0xd6a7('0x1f')](_0x22b3d5);}return _0x1dab50[_0xd6a7('0x20')]();};}function saveUpdates(_0x57a796,_0x5dcb04){return function(_0x41b1ca){if(_0x41b1ca){return _0x41b1ca[_0xd6a7('0x21')](_0x57a796)[_0xd6a7('0x22')](function(_0x525bbb){return _0x525bbb;});}return null;};}function removeEntity(_0x1d807d,_0x182459){return function(_0x2d3a60){if(_0x2d3a60){return _0x2d3a60[_0xd6a7('0x23')]()[_0xd6a7('0x22')](function(){_0x1d807d[_0xd6a7('0x17')](0xcc)[_0xd6a7('0x24')]();});}};}function handleEntityNotFound(_0x4b78de,_0x1e94bc){return function(_0x297d9c){if(!_0x297d9c){_0x4b78de[_0xd6a7('0x16')](0x194);}return _0x297d9c;};}function handleError(_0x5b5a7a,_0x18eb66){_0x18eb66=_0x18eb66||0x1f4;return function(_0x48d7ad){logger[_0xd6a7('0x25')](_0x48d7ad[_0xd6a7('0x26')]);if(_0x48d7ad['name']){delete _0x48d7ad[_0xd6a7('0x27')];}_0x5b5a7a['status'](_0x18eb66)[_0xd6a7('0x28')](_0x48d7ad);};}exports[_0xd6a7('0x29')]=function(_0x9ea300,_0x535c56){var _0x30451c={},_0x5a53ea={},_0x4954d6={'count':0x0,'rows':[]};var _0x2ff72a=_['map'](db['ServicenowAccount']['rawAttributes'],function(_0xccf3bf){return{'name':_0xccf3bf['fieldName'],'type':_0xccf3bf[_0xd6a7('0x2a')][_0xd6a7('0x2b')]};});_0x5a53ea[_0xd6a7('0x2c')]=_[_0xd6a7('0x2d')](_0x2ff72a,_0xd6a7('0x27'));_0x5a53ea[_0xd6a7('0x2e')]=_[_0xd6a7('0x2f')](_0x9ea300['query']);_0x5a53ea[_0xd6a7('0x30')]=_[_0xd6a7('0x31')](_0x5a53ea[_0xd6a7('0x2c')],_0x5a53ea['query']);_0x30451c[_0xd6a7('0x32')]=_['intersection'](_0x5a53ea[_0xd6a7('0x2c')],qs[_0xd6a7('0x33')](_0x9ea300[_0xd6a7('0x2e')][_0xd6a7('0x33')]));_0x30451c[_0xd6a7('0x32')]=_0x30451c['attributes'][_0xd6a7('0x34')]?_0x30451c['attributes']:_0x5a53ea[_0xd6a7('0x2c')];if(!_0x9ea300[_0xd6a7('0x2e')][_0xd6a7('0x35')]('nolimit')){_0x30451c[_0xd6a7('0x19')]=qs[_0xd6a7('0x19')](_0x9ea300[_0xd6a7('0x2e')][_0xd6a7('0x19')]);_0x30451c[_0xd6a7('0x1c')]=qs['offset'](_0x9ea300[_0xd6a7('0x2e')]['offset']);}_0x30451c[_0xd6a7('0x36')]=qs[_0xd6a7('0x37')](_0x9ea300[_0xd6a7('0x2e')][_0xd6a7('0x37')]);_0x30451c[_0xd6a7('0x38')]=qs[_0xd6a7('0x30')](_[_0xd6a7('0x39')](_0x9ea300[_0xd6a7('0x2e')],_0x5a53ea[_0xd6a7('0x30')]),_0x2ff72a);if(_0x9ea300[_0xd6a7('0x2e')][_0xd6a7('0x3a')]){_0x30451c[_0xd6a7('0x38')]=_[_0xd6a7('0x3b')](_0x30451c[_0xd6a7('0x38')],{'$or':_[_0xd6a7('0x2d')](_0x2ff72a,function(_0xcebbc7){if(_0xcebbc7['type']!==_0xd6a7('0x3c')){var _0x5e4062={};_0x5e4062[_0xcebbc7[_0xd6a7('0x27')]]={'$like':'%'+_0x9ea300[_0xd6a7('0x2e')]['filter']+'%'};return _0x5e4062;}})});}_0x30451c=_[_0xd6a7('0x3b')]({},_0x30451c,_0x9ea300[_0xd6a7('0x3d')]);var _0x4096de={'where':_0x30451c['where']};return db[_0xd6a7('0x3e')][_0xd6a7('0x1b')](_0x4096de)['then'](function(_0x3ef298){_0x4954d6[_0xd6a7('0x1b')]=_0x3ef298;if(_0x9ea300[_0xd6a7('0x2e')]['includeAll']){_0x30451c[_0xd6a7('0x3f')]=[{'all':!![]}];}return db['ServicenowAccount'][_0xd6a7('0x40')](_0x30451c);})[_0xd6a7('0x22')](function(_0x23f0c7){_0x4954d6['rows']=_0x23f0c7;return _0x4954d6;})[_0xd6a7('0x22')](respondWithFilteredResult(_0x535c56,_0x30451c))[_0xd6a7('0x41')](handleError(_0x535c56,null));};exports[_0xd6a7('0x42')]=function(_0x411a13,_0x25fdbc){var _0x55419b={'raw':![],'where':{'id':_0x411a13[_0xd6a7('0x43')]['id']}},_0x32bf2a={};_0x32bf2a[_0xd6a7('0x2c')]=_[_0xd6a7('0x2f')](db[_0xd6a7('0x3e')][_0xd6a7('0x44')]);_0x32bf2a['query']=_[_0xd6a7('0x2f')](_0x411a13[_0xd6a7('0x2e')]);_0x32bf2a[_0xd6a7('0x30')]=_['intersection'](_0x32bf2a[_0xd6a7('0x2c')],_0x32bf2a['query']);_0x55419b[_0xd6a7('0x32')]=_['intersection'](_0x32bf2a[_0xd6a7('0x2c')],qs[_0xd6a7('0x33')](_0x411a13['query'][_0xd6a7('0x33')]));_0x55419b[_0xd6a7('0x32')]=_0x55419b['attributes']['length']?_0x55419b['attributes']:_0x32bf2a[_0xd6a7('0x2c')];if(_0x411a13[_0xd6a7('0x2e')][_0xd6a7('0x45')]){_0x55419b[_0xd6a7('0x3f')]=[{'all':!![]}];}_0x55419b=_[_0xd6a7('0x3b')]({},_0x55419b,_0x411a13[_0xd6a7('0x3d')]);return db[_0xd6a7('0x3e')]['find'](_0x55419b)[_0xd6a7('0x22')](handleEntityNotFound(_0x25fdbc,null))[_0xd6a7('0x22')](respondWithResult(_0x25fdbc,null))['catch'](handleError(_0x25fdbc,null));};exports[_0xd6a7('0x46')]=function(_0x465bd8,_0x3af22a){return db[_0xd6a7('0x3e')]['create'](_0x465bd8[_0xd6a7('0x47')],{})[_0xd6a7('0x22')](respondWithResult(_0x3af22a,0xc9))[_0xd6a7('0x41')](handleError(_0x3af22a,null));};exports['update']=function(_0x345022,_0x1e2a3b){if(_0x345022['body']['id']){delete _0x345022['body']['id'];}return db[_0xd6a7('0x3e')][_0xd6a7('0x48')]({'where':{'id':_0x345022[_0xd6a7('0x43')]['id']}})[_0xd6a7('0x22')](handleEntityNotFound(_0x1e2a3b,null))['then'](saveUpdates(_0x345022[_0xd6a7('0x47')],null))[_0xd6a7('0x22')](respondWithResult(_0x1e2a3b,null))[_0xd6a7('0x41')](handleError(_0x1e2a3b,null));};exports[_0xd6a7('0x23')]=function(_0x1e2564,_0x1c12d6){return db[_0xd6a7('0x3e')][_0xd6a7('0x48')]({'where':{'id':_0x1e2564[_0xd6a7('0x43')]['id']}})[_0xd6a7('0x22')](handleEntityNotFound(_0x1c12d6,null))[_0xd6a7('0x22')](removeEntity(_0x1c12d6,null))[_0xd6a7('0x41')](handleError(_0x1c12d6,null));};exports['getConfigurations']=function(_0x419175,_0x343d41,_0x47e654){var _0x413161={};var _0x444606={};var _0x16d07c;var _0x4d2cdb;return db[_0xd6a7('0x3e')]['findOne']({'where':{'id':_0x419175['params']['id']}})[_0xd6a7('0x22')](handleEntityNotFound(_0x343d41,null))['then'](function(_0x30280b){if(_0x30280b){_0x16d07c=_0x30280b;_0x444606[_0xd6a7('0x2c')]=_[_0xd6a7('0x2f')](db['ServicenowConfiguration'][_0xd6a7('0x44')]);_0x444606[_0xd6a7('0x2e')]=_[_0xd6a7('0x2f')](_0x419175['query']);_0x444606[_0xd6a7('0x30')]=_[_0xd6a7('0x31')](_0x444606[_0xd6a7('0x2c')],_0x444606[_0xd6a7('0x2e')]);_0x413161[_0xd6a7('0x32')]=_[_0xd6a7('0x31')](_0x444606[_0xd6a7('0x2c')],qs[_0xd6a7('0x33')](_0x419175[_0xd6a7('0x2e')][_0xd6a7('0x33')]));_0x413161['attributes']=_0x413161[_0xd6a7('0x32')][_0xd6a7('0x34')]?_0x413161[_0xd6a7('0x32')]:_0x444606[_0xd6a7('0x2c')];_0x413161[_0xd6a7('0x36')]=qs[_0xd6a7('0x37')](_0x419175['query'][_0xd6a7('0x37')]);_0x413161['where']=qs[_0xd6a7('0x30')](_[_0xd6a7('0x39')](_0x419175[_0xd6a7('0x2e')],_0x444606[_0xd6a7('0x30')]));if(_0x419175[_0xd6a7('0x2e')][_0xd6a7('0x3a')]){_0x413161[_0xd6a7('0x38')]=_[_0xd6a7('0x3b')](_0x413161['where'],{'$or':_[_0xd6a7('0x2d')](_0x413161[_0xd6a7('0x32')],function(_0x698cb1){var _0x344f79={};_0x344f79[_0x698cb1]={'$like':'%'+_0x419175[_0xd6a7('0x2e')][_0xd6a7('0x3a')]+'%'};return _0x344f79;})});}_0x413161=_[_0xd6a7('0x3b')]({},_0x413161,_0x419175[_0xd6a7('0x3d')]);return _0x16d07c[_0xd6a7('0x49')](_0x413161);}})[_0xd6a7('0x22')](function(_0x48f68a){if(_0x48f68a){_0x4d2cdb=_0x48f68a[_0xd6a7('0x34')];if(!_0x419175[_0xd6a7('0x2e')][_0xd6a7('0x35')]('nolimit')){_0x413161[_0xd6a7('0x19')]=qs[_0xd6a7('0x19')](_0x419175[_0xd6a7('0x2e')][_0xd6a7('0x19')]);_0x413161[_0xd6a7('0x1c')]=qs[_0xd6a7('0x1c')](_0x419175['query'][_0xd6a7('0x1c')]);}return _0x16d07c[_0xd6a7('0x49')](_0x413161);}})[_0xd6a7('0x22')](function(_0x50cecb){if(_0x50cecb){return _0x50cecb?{'count':_0x4d2cdb,'rows':_0x50cecb}:null;}})['then'](respondWithResult(_0x343d41,null))[_0xd6a7('0x41')](handleError(_0x343d41,null));};exports[_0xd6a7('0x4a')]=function(_0xa8b114,_0x255c51,_0x5c5d0f){if(_0xa8b114[_0xd6a7('0x47')]['id']){delete _0xa8b114['body']['id'];}return db[_0xd6a7('0x3e')][_0xd6a7('0x4b')]({'where':{'id':_0xa8b114[_0xd6a7('0x43')]['id']}})[_0xd6a7('0x22')](handleEntityNotFound(_0x255c51,null))['then'](function(_0x2d3455){if(_0x2d3455){_0xa8b114[_0xd6a7('0x47')][_0xd6a7('0x4c')]=_0x2d3455['id'];_0xa8b114[_0xd6a7('0x47')][_0xd6a7('0x4d')]=integrations[_0xd6a7('0x4e')](_0xa8b114[_0xd6a7('0x47')]['channel'],_0xa8b114[_0xd6a7('0x47')]['type']);_0xa8b114['body']['Descriptions']=integrations[_0xd6a7('0x4f')](_0xa8b114[_0xd6a7('0x47')][_0xd6a7('0x50')],_0xa8b114[_0xd6a7('0x47')][_0xd6a7('0x2a')]);return db[_0xd6a7('0x51')]['create'](_0xa8b114[_0xd6a7('0x47')],{'include':[{'model':db[_0xd6a7('0x52')],'as':_0xd6a7('0x4d')},{'model':db['ServicenowField'],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x255c51,null))['catch'](handleError(_0x255c51,null));};exports[_0xd6a7('0x53')]=function(_0x2d07fa,_0x5cd7ad,_0x355de5){var _0x1fceba=[_0xd6a7('0x54'),_0xd6a7('0x55'),'knowledge',_0xd6a7('0x56'),_0xd6a7('0x57'),'notify','incident_state',_0xd6a7('0x58'),_0xd6a7('0x59')];var _0x20a4fe=['parent',_0xd6a7('0x54'),_0xd6a7('0x5a'),_0xd6a7('0x5b'),_0xd6a7('0x5c'),_0xd6a7('0x5d'),'child_incidents',_0xd6a7('0x55'),_0xd6a7('0x5e'),_0xd6a7('0x5f'),'resolved_by','sys_updated_by',_0xd6a7('0x60'),_0xd6a7('0x61'),_0xd6a7('0x62'),_0xd6a7('0x63'),'state',_0xd6a7('0x64'),_0xd6a7('0x65'),_0xd6a7('0x36'),_0xd6a7('0x66'),_0xd6a7('0x67'),_0xd6a7('0x68'),_0xd6a7('0x69'),'impact','active',_0xd6a7('0x6a'),_0xd6a7('0x6b'),_0xd6a7('0x6c'),_0xd6a7('0x6d'),_0xd6a7('0x6e'),_0xd6a7('0x6f'),'expected_start',_0xd6a7('0x70'),'business_duration','group_list',_0xd6a7('0x71'),_0xd6a7('0x72'),_0xd6a7('0x73'),'caller_id',_0xd6a7('0x74'),_0xd6a7('0x56'),_0xd6a7('0x75'),_0xd6a7('0x76'),_0xd6a7('0x57'),_0xd6a7('0x77'),_0xd6a7('0x78'),'work_start','assignment_group',_0xd6a7('0x79'),'additional_assignee_list','description',_0xd6a7('0x7a'),_0xd6a7('0x7b'),_0xd6a7('0x7c'),_0xd6a7('0x7d'),_0xd6a7('0x7e'),_0xd6a7('0x7f'),_0xd6a7('0x80'),'sys_id','contact_type','reopened_by','incident_state',_0xd6a7('0x81'),_0xd6a7('0x82'),_0xd6a7('0x83'),'reassignment_count',_0xd6a7('0x84'),_0xd6a7('0x85'),'severity',_0xd6a7('0x86'),_0xd6a7('0x87'),_0xd6a7('0x88'),_0xd6a7('0x89'),_0xd6a7('0x8a'),_0xd6a7('0x8b'),_0xd6a7('0x8c'),'sys_tags',_0xd6a7('0x8d'),_0xd6a7('0x8e'),'correlation_id',_0xd6a7('0x8f'),_0xd6a7('0x59')];var _0x442f1a='';var _0x44e1a4='';var _0xa9c4e0=[];var _0x4ce848='';var _0x3e3622='';var _0x1c39b0=[];var _0x1cb856='';var _0x545c73='';var _0x5c8d1c={};var _0x19ba1a='';return db[_0xd6a7('0x3e')][_0xd6a7('0x4b')]({'where':{'id':_0x2d07fa[_0xd6a7('0x43')]['id']},'attributes':['id',_0xd6a7('0x90'),'password',_0xd6a7('0x91'),_0xd6a7('0x92'),_0xd6a7('0x93')]})[_0xd6a7('0x22')](handleEntityNotFound(_0x5cd7ad,null))['then'](function(_0x14b67c){if(_0x14b67c){_0x19ba1a=_0x14b67c[_0xd6a7('0x92')];var _0xc49f99=_0x19ba1a[_0xd6a7('0x94')](-0x1);if(_0xc49f99==='/'){_0x19ba1a=_0x19ba1a[_0xd6a7('0x95')](0x0,_0x19ba1a[_0xd6a7('0x96')](_0xc49f99));}_0x545c73=util['format'](_0xd6a7('0x97'),_0x19ba1a);_0x1cb856=util['format']('%s/api/now/table/',_0x19ba1a);_0x5c8d1c={'user':_0x14b67c[_0xd6a7('0x90')],'pass':_0x14b67c['password']};var _0xccea5e={'method':_0xd6a7('0x98'),'uri':_0x545c73+_0xd6a7('0x99'),'auth':_0x5c8d1c,'json':!![]};return rp(_0xccea5e);}})[_0xd6a7('0x22')](function(_0x29e7ab){if(_0x29e7ab[_0xd6a7('0x9a')][_0xd6a7('0x34')]>0x0){_0x442f1a=_0x29e7ab[_0xd6a7('0x9a')];}console[_0xd6a7('0x9b')](_0xd6a7('0x9c'),_0x442f1a);_0x1c39b0=[];_0x44e1a4=Object[_0xd6a7('0x9d')]([],_0x442f1a);_[_0xd6a7('0x9e')](_0x44e1a4,function(_0x17c075){return!_0x1fceba[_0xd6a7('0x9f')](_0x17c075[_0xd6a7('0x27')]);});_0x44e1a4['forEach'](function(_0x1b91b2){var _0x43db38=createFieldObject(_0x1cb856,_0x5c8d1c,_0x1b91b2[_0xd6a7('0xa0')],_0x1b91b2[_0xd6a7('0x27')],_0x1b91b2[_0xd6a7('0xa1')],![]);_0x1c39b0[_0xd6a7('0xa2')](_0x43db38);});return Promise['all'](_0x1c39b0);})['then'](function(_0xc09471){_0xa9c4e0=_0xc09471;_0x4ce848=Object[_0xd6a7('0x9d')]([],_0x442f1a);console[_0xd6a7('0x9b')](_0xd6a7('0xa3'),_0x442f1a);_[_0xd6a7('0x9e')](_0x4ce848,function(_0x42fae7){return _0x20a4fe['includes'](_0x42fae7[_0xd6a7('0x27')]);});console[_0xd6a7('0x9b')](_0xd6a7('0xa4'),_0x4ce848);_0x1c39b0=[];_0x4ce848[_0xd6a7('0xa5')](function(_0x259c8b){var _0x2faec6=createFieldObject(_0x1cb856,_0x5c8d1c,_0x259c8b['internalType'],_0x259c8b[_0xd6a7('0x27')],_0x259c8b['label'],!![]);_0x1c39b0['push'](_0x2faec6);});return Promise['all'](_0x1c39b0);})[_0xd6a7('0x22')](function(_0x39f68c){_0x3e3622=_0x39f68c;var _0x378518=_0xa9c4e0['concat'](_0x3e3622);return{'count':_0x378518['length'],'rows':_0x378518};})[_0xd6a7('0x22')](respondWithResult(_0x5cd7ad,null))[_0xd6a7('0x41')](function(_0x14c91a){console[_0xd6a7('0x9b')](_0xd6a7('0xa6')+_0x14c91a);var _0x375ee3=_0x2d07fa['query']['test']?0x1f4:_0x14c91a['statusCode']||0x1f4;logger[_0xd6a7('0x25')](_0x14c91a[_0xd6a7('0x26')]);delete _0x14c91a[_0xd6a7('0x27')];if(_0x375ee3===0x191){_0x375ee3=0x190;}_0x5cd7ad[_0xd6a7('0x17')](_0x375ee3)['send'](_0x2d07fa[_0xd6a7('0x2e')]['test']?{'message':_0xd6a7('0xa7'),'statusCode':_0x14c91a[_0xd6a7('0xa8')]}:_0x14c91a);});};function createFieldObject(_0x26594a,_0x343ef6,_0x14fc99,_0x12d977,_0xe280a4,_0x516da7){return new Promise(function(_0xd6d96d,_0x330856){var _0x4383cf={'id':_0x12d977,'name':_0xe280a4,'custom':_0x516da7};if(_0x14fc99===_0xd6a7('0xa9')){_0x4383cf['options']=[{'name':'True','value':_0xd6a7('0xaa')},{'name':'False','value':_0xd6a7('0xab')}];_0xd6d96d(_0x4383cf);}else{var _0x5927ab={'method':_0xd6a7('0x98'),'uri':_0x26594a+'sys_choice?sysparm_query=name=incident^element='+_0x12d977,'auth':_0x343ef6,'json':!![]};return rp(_0x5927ab)[_0xd6a7('0x22')](function(_0x40a6e0){var _0x39eae1=[];if(_0x40a6e0['result'][_0xd6a7('0x34')]>0x0){_0x40a6e0[_0xd6a7('0x9a')][_0xd6a7('0xa5')](function(_0x472a4a){if(_0x472a4a[_0xd6a7('0xac')]==='false'){var _0x317283={'name':_0x472a4a[_0xd6a7('0xa1')],'value':_0x472a4a[_0xd6a7('0xad')]};_0x39eae1[_0xd6a7('0xa2')](_0x317283);}});}_0x4383cf[_0xd6a7('0x3d')]=_0x39eae1;if(_0x4383cf['options']['length']>0x0){_0xd6d96d(_0x4383cf);}else{if(_0x516da7==![]){_0xd6d96d();}else{_0xd6d96d(_0x4383cf);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 7706ffd..64a42fa 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 _0x1cb9=['api','moment','bluebird','path','rimraf','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','int_servicenow_accounts','lodash','../../config/logger'];(function(_0x404eed,_0x5390c5){var _0xd45887=function(_0x1ee42b){while(--_0x1ee42b){_0x404eed['push'](_0x404eed['shift']());}};_0xd45887(++_0x5390c5);}(_0x1cb9,0x14e));var _0x91cb=function(_0x3e4655,_0x198f4d){_0x3e4655=_0x3e4655-0x0;var _0x19a01a=_0x1cb9[_0x3e4655];return _0x19a01a;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var logger=require(_0x91cb('0x1'))(_0x91cb('0x2'));var moment=require(_0x91cb('0x3'));var BPromise=require(_0x91cb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x91cb('0x5'));var rimraf=require(_0x91cb('0x6'));var config=require('../../config/environment');var attributes=require(_0x91cb('0x7'));var integrations=require(_0x91cb('0x8'));module[_0x91cb('0x9')]=function(_0x28543e,_0x3b9d98){return _0x28543e[_0x91cb('0xa')]('ServicenowAccount',attributes,{'tableName':_0x91cb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeda8=['path','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','ServicenowAccount','int_servicenow_accounts','lodash','util','api','moment','bluebird','request-promise'];(function(_0x1e3651,_0x19a1be){var _0x5c53fa=function(_0x48bf5a){while(--_0x48bf5a){_0x1e3651['push'](_0x1e3651['shift']());}};_0x5c53fa(++_0x19a1be);}(_0xeda8,0x104));var _0x8eda=function(_0x56ecda,_0x5b98c9){_0x56ecda=_0x56ecda-0x0;var _0x56ffae=_0xeda8[_0x56ecda];return _0x56ffae;};'use strict';var _=require(_0x8eda('0x0'));var util=require(_0x8eda('0x1'));var logger=require('../../config/logger')(_0x8eda('0x2'));var moment=require(_0x8eda('0x3'));var BPromise=require(_0x8eda('0x4'));var rp=require(_0x8eda('0x5'));var fs=require('fs');var path=require(_0x8eda('0x6'));var rimraf=require(_0x8eda('0x7'));var config=require(_0x8eda('0x8'));var attributes=require(_0x8eda('0x9'));var integrations=require(_0x8eda('0xa'));module[_0x8eda('0xb')]=function(_0x349361,_0x32abe8){return _0x349361['define'](_0x8eda('0xc'),attributes,{'tableName':_0x8eda('0xd'),'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 740a424..1f67e3b 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 _0x3550=['ServicenowAccount,\x20%s,\x20%s','request\x20sent','stringify','error','message','ServicenowAccount','findAll','options','raw','where','attributes','limit','map','include','model','GetServicenowAccount','catch','ShowServicenowAccount','find','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x13be56,_0x3bbb52){var _0x79a4b6=function(_0x761399){while(--_0x761399){_0x13be56['push'](_0x13be56['shift']());}};_0x79a4b6(++_0x3bbb52);}(_0x3550,0x11b));var _0x0355=function(_0x4c0338,_0x494441){_0x4c0338=_0x4c0338-0x0;var _0x519481=_0x3550[_0x4c0338];return _0x519481;};'use strict';var _=require(_0x0355('0x0'));var util=require(_0x0355('0x1'));var moment=require(_0x0355('0x2'));var BPromise=require('bluebird');var rs=require(_0x0355('0x3'));var fs=require('fs');var Redis=require(_0x0355('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0355('0x5'))(_0x0355('0x6'));var config=require(_0x0355('0x7'));var jayson=require(_0x0355('0x8'));var client=jayson[_0x0355('0x9')][_0x0355('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x489d41,_0x2cf9a9,_0x22fa6e){return new BPromise(function(_0x54a60e,_0x1583ea){return client[_0x0355('0xb')](_0x489d41,_0x22fa6e)[_0x0355('0xc')](function(_0x42146d){logger[_0x0355('0xd')](_0x0355('0xe'),_0x2cf9a9,_0x0355('0xf'));logger['debug']('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x2cf9a9,_0x0355('0xf'),JSON[_0x0355('0x10')](_0x42146d));if(_0x42146d[_0x0355('0x11')]){if(_0x42146d['error']['code']===0x1f4){logger['error'](_0x0355('0xe'),_0x2cf9a9,_0x42146d['error'][_0x0355('0x12')]);return _0x1583ea(_0x42146d['error']['message']);}logger['error']('ServicenowAccount,\x20%s,\x20%s',_0x2cf9a9,_0x42146d['error'][_0x0355('0x12')]);return _0x54a60e(_0x42146d[_0x0355('0x11')][_0x0355('0x12')]);}else{logger[_0x0355('0xd')]('ServicenowAccount,\x20%s,\x20%s',_0x2cf9a9,_0x0355('0xf'));_0x54a60e(_0x42146d['result'][_0x0355('0x12')]);}})['catch'](function(_0x8c6924){logger[_0x0355('0x11')]('ServicenowAccount,\x20%s,\x20%s',_0x2cf9a9,_0x8c6924);_0x1583ea(_0x8c6924);});});}exports['GetServicenowAccount']=function(_0x2c044b){var _0x7846cc=this;return new Promise(function(_0x16cc0d,_0x122678){return db[_0x0355('0x13')][_0x0355('0x14')]({'raw':_0x2c044b[_0x0355('0x15')]?_0x2c044b['options'][_0x0355('0x16')]===undefined?!![]:![]:!![],'where':_0x2c044b['options']?_0x2c044b[_0x0355('0x15')][_0x0355('0x17')]||null:null,'attributes':_0x2c044b[_0x0355('0x15')]?_0x2c044b[_0x0355('0x15')][_0x0355('0x18')]||null:null,'limit':_0x2c044b[_0x0355('0x15')]?_0x2c044b[_0x0355('0x15')][_0x0355('0x19')]||null:null,'include':_0x2c044b[_0x0355('0x15')]?_0x2c044b[_0x0355('0x15')]['include']?_[_0x0355('0x1a')](_0x2c044b[_0x0355('0x15')][_0x0355('0x1b')],function(_0x23d479){return{'model':db[_0x23d479[_0x0355('0x1c')]],'as':_0x23d479['as'],'attributes':_0x23d479['attributes'],'include':_0x23d479[_0x0355('0x1b')]?_[_0x0355('0x1a')](_0x23d479[_0x0355('0x1b')],function(_0x305b52){return{'model':db[_0x305b52['model']],'as':_0x305b52['as'],'attributes':_0x305b52[_0x0355('0x18')],'include':_0x305b52[_0x0355('0x1b')]?_['map'](_0x305b52[_0x0355('0x1b')],function(_0x706f1a){return{'model':db[_0x706f1a[_0x0355('0x1c')]],'as':_0x706f1a['as'],'attributes':_0x706f1a['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4be9f7){logger[_0x0355('0xd')](_0x0355('0x1d'),_0x2c044b);logger['debug']('GetServicenowAccount',_0x2c044b,JSON[_0x0355('0x10')](_0x4be9f7));_0x16cc0d(_0x4be9f7);})[_0x0355('0x1e')](function(_0x1be6c4){logger[_0x0355('0x11')](_0x0355('0x1d'),_0x1be6c4[_0x0355('0x12')],_0x2c044b);_0x122678(_0x7846cc['error'](0x1f4,_0x1be6c4[_0x0355('0x12')]));});});};exports[_0x0355('0x1f')]=function(_0x2a4d68){var _0x140e81=this;return new Promise(function(_0x1241ba,_0x9c95b3){return db[_0x0355('0x13')][_0x0355('0x20')]({'raw':_0x2a4d68[_0x0355('0x15')]?_0x2a4d68[_0x0355('0x15')][_0x0355('0x16')]===undefined?!![]:![]:!![],'where':_0x2a4d68['options']?_0x2a4d68[_0x0355('0x15')][_0x0355('0x17')]||null:null,'attributes':_0x2a4d68['options']?_0x2a4d68[_0x0355('0x15')][_0x0355('0x18')]||null:null,'include':_0x2a4d68['options']?_0x2a4d68['options'][_0x0355('0x1b')]?_[_0x0355('0x1a')](_0x2a4d68[_0x0355('0x15')][_0x0355('0x1b')],function(_0x1a2c9c){return{'model':db[_0x1a2c9c['model']],'as':_0x1a2c9c['as'],'attributes':_0x1a2c9c[_0x0355('0x18')],'include':_0x1a2c9c[_0x0355('0x1b')]?_['map'](_0x1a2c9c[_0x0355('0x1b')],function(_0x47d38a){return{'model':db[_0x47d38a[_0x0355('0x1c')]],'as':_0x47d38a['as'],'attributes':_0x47d38a[_0x0355('0x18')],'include':_0x47d38a[_0x0355('0x1b')]?_['map'](_0x47d38a[_0x0355('0x1b')],function(_0x3b3f4a){return{'model':db[_0x3b3f4a['model']],'as':_0x3b3f4a['as'],'attributes':_0x3b3f4a['attributes']};}):[]};}):[]};}):[]:[]})[_0x0355('0xc')](function(_0x221426){logger[_0x0355('0xd')](_0x0355('0x1f'),_0x2a4d68);logger['debug'](_0x0355('0x1f'),_0x2a4d68,JSON[_0x0355('0x10')](_0x221426));_0x1241ba(_0x221426);})['catch'](function(_0x58b964){logger['error'](_0x0355('0x1f'),_0x58b964[_0x0355('0x12')],_0x2a4d68);_0x9c95b3(_0x140e81['error'](0x1f4,_0x58b964[_0x0355('0x12')]));});});}; \ No newline at end of file +var _0xf550=['GetServicenowAccount','ServicenowAccount','findAll','options','raw','limit','include','model','attributes','map','stringify','catch','ShowServicenowAccount','lodash','util','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','error','code','message','info'];(function(_0x4adeb1,_0x3e7856){var _0x4fd1d6=function(_0x16bf5b){while(--_0x16bf5b){_0x4adeb1['push'](_0x4adeb1['shift']());}};_0x4fd1d6(++_0x3e7856);}(_0xf550,0x1a5));var _0x0f55=function(_0x5517c0,_0x358609){_0x5517c0=_0x5517c0-0x0;var _0x33803b=_0xf550[_0x5517c0];return _0x33803b;};'use strict';var _=require(_0x0f55('0x0'));var util=require(_0x0f55('0x1'));var moment=require(_0x0f55('0x2'));var BPromise=require('bluebird');var rs=require(_0x0f55('0x3'));var fs=require('fs');var Redis=require(_0x0f55('0x4'));var db=require(_0x0f55('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x0f55('0x6'));var config=require(_0x0f55('0x7'));var jayson=require(_0x0f55('0x8'));var client=jayson[_0x0f55('0x9')][_0x0f55('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d26ed,_0x819be0,_0x414873){return new BPromise(function(_0x19056b,_0x30e7cd){return client[_0x0f55('0xb')](_0x1d26ed,_0x414873)[_0x0f55('0xc')](function(_0x175847){logger['info'](_0x0f55('0xd'),_0x819be0,_0x0f55('0xe'));logger[_0x0f55('0xf')](_0x0f55('0x10'),_0x819be0,'request\x20sent',JSON['stringify'](_0x175847));if(_0x175847[_0x0f55('0x11')]){if(_0x175847[_0x0f55('0x11')][_0x0f55('0x12')]===0x1f4){logger[_0x0f55('0x11')](_0x0f55('0xd'),_0x819be0,_0x175847[_0x0f55('0x11')][_0x0f55('0x13')]);return _0x30e7cd(_0x175847['error'][_0x0f55('0x13')]);}logger[_0x0f55('0x11')](_0x0f55('0xd'),_0x819be0,_0x175847['error'][_0x0f55('0x13')]);return _0x19056b(_0x175847[_0x0f55('0x11')][_0x0f55('0x13')]);}else{logger[_0x0f55('0x14')](_0x0f55('0xd'),_0x819be0,_0x0f55('0xe'));_0x19056b(_0x175847['result'][_0x0f55('0x13')]);}})['catch'](function(_0x299180){logger[_0x0f55('0x11')](_0x0f55('0xd'),_0x819be0,_0x299180);_0x30e7cd(_0x299180);});});}exports[_0x0f55('0x15')]=function(_0x59a844){var _0x30c17e=this;return new Promise(function(_0x191e4e,_0x132d04){return db[_0x0f55('0x16')][_0x0f55('0x17')]({'raw':_0x59a844[_0x0f55('0x18')]?_0x59a844[_0x0f55('0x18')][_0x0f55('0x19')]===undefined?!![]:![]:!![],'where':_0x59a844[_0x0f55('0x18')]?_0x59a844[_0x0f55('0x18')]['where']||null:null,'attributes':_0x59a844['options']?_0x59a844['options']['attributes']||null:null,'limit':_0x59a844[_0x0f55('0x18')]?_0x59a844[_0x0f55('0x18')][_0x0f55('0x1a')]||null:null,'include':_0x59a844['options']?_0x59a844[_0x0f55('0x18')][_0x0f55('0x1b')]?_['map'](_0x59a844['options'][_0x0f55('0x1b')],function(_0x4e7a8c){return{'model':db[_0x4e7a8c[_0x0f55('0x1c')]],'as':_0x4e7a8c['as'],'attributes':_0x4e7a8c[_0x0f55('0x1d')],'include':_0x4e7a8c['include']?_[_0x0f55('0x1e')](_0x4e7a8c[_0x0f55('0x1b')],function(_0x147770){return{'model':db[_0x147770[_0x0f55('0x1c')]],'as':_0x147770['as'],'attributes':_0x147770[_0x0f55('0x1d')],'include':_0x147770['include']?_['map'](_0x147770[_0x0f55('0x1b')],function(_0x551f2d){return{'model':db[_0x551f2d['model']],'as':_0x551f2d['as'],'attributes':_0x551f2d[_0x0f55('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x425b16){logger['info']('GetServicenowAccount',_0x59a844);logger[_0x0f55('0xf')](_0x0f55('0x15'),_0x59a844,JSON[_0x0f55('0x1f')](_0x425b16));_0x191e4e(_0x425b16);})[_0x0f55('0x20')](function(_0x4ff65d){logger[_0x0f55('0x11')](_0x0f55('0x15'),_0x4ff65d['message'],_0x59a844);_0x132d04(_0x30c17e['error'](0x1f4,_0x4ff65d[_0x0f55('0x13')]));});});};exports[_0x0f55('0x21')]=function(_0x488eea){var _0x351ce0=this;return new Promise(function(_0x1566ee,_0x10c5a5){return db['ServicenowAccount']['find']({'raw':_0x488eea[_0x0f55('0x18')]?_0x488eea['options'][_0x0f55('0x19')]===undefined?!![]:![]:!![],'where':_0x488eea[_0x0f55('0x18')]?_0x488eea['options']['where']||null:null,'attributes':_0x488eea[_0x0f55('0x18')]?_0x488eea[_0x0f55('0x18')]['attributes']||null:null,'include':_0x488eea['options']?_0x488eea['options'][_0x0f55('0x1b')]?_['map'](_0x488eea[_0x0f55('0x18')][_0x0f55('0x1b')],function(_0xcfc86b){return{'model':db[_0xcfc86b[_0x0f55('0x1c')]],'as':_0xcfc86b['as'],'attributes':_0xcfc86b['attributes'],'include':_0xcfc86b[_0x0f55('0x1b')]?_[_0x0f55('0x1e')](_0xcfc86b['include'],function(_0x1b9b80){return{'model':db[_0x1b9b80[_0x0f55('0x1c')]],'as':_0x1b9b80['as'],'attributes':_0x1b9b80['attributes'],'include':_0x1b9b80[_0x0f55('0x1b')]?_[_0x0f55('0x1e')](_0x1b9b80['include'],function(_0x5cb258){return{'model':db[_0x5cb258[_0x0f55('0x1c')]],'as':_0x5cb258['as'],'attributes':_0x5cb258[_0x0f55('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x0f55('0xc')](function(_0xce85d6){logger[_0x0f55('0x14')]('ShowServicenowAccount',_0x488eea);logger['debug'](_0x0f55('0x21'),_0x488eea,JSON[_0x0f55('0x1f')](_0xce85d6));_0x1566ee(_0xce85d6);})[_0x0f55('0x20')](function(_0x14e902){logger[_0x0f55('0x11')]('ShowServicenowAccount',_0x14e902['message'],_0x488eea);_0x10c5a5(_0x351ce0[_0x0f55('0x11')](0x1f4,_0x14e902[_0x0f55('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 7ad3f7e..b270d99 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 _0xc031=['destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intServicenowConfiguration.controller','get','isAuthenticated','index','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','/:id','update'];(function(_0x478a3d,_0x29488b){var _0x1f4588=function(_0x49c547){while(--_0x49c547){_0x478a3d['push'](_0x478a3d['shift']());}};_0x1f4588(++_0x29488b);}(_0xc031,0x7a));var _0x1c03=function(_0x500419,_0x549162){_0x500419=_0x500419-0x0;var _0x241c1a=_0xc031[_0x500419];return _0x241c1a;};'use strict';var multer=require(_0x1c03('0x0'));var util=require(_0x1c03('0x1'));var path=require(_0x1c03('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1c03('0x3')]();var fs_extra=require(_0x1c03('0x4'));var auth=require(_0x1c03('0x5'));var interaction=require(_0x1c03('0x6'));var config=require('../../config/environment');var controller=require(_0x1c03('0x7'));router[_0x1c03('0x8')]('/',auth[_0x1c03('0x9')](),controller[_0x1c03('0xa')]);router['get']('/:id',auth[_0x1c03('0x9')](),controller[_0x1c03('0xb')]);router['get']('/:id/fields',auth[_0x1c03('0x9')](),controller[_0x1c03('0xc')]);router['get'](_0x1c03('0xd'),auth['isAuthenticated'](),controller[_0x1c03('0xe')]);router[_0x1c03('0x8')](_0x1c03('0xf'),auth[_0x1c03('0x9')](),controller[_0x1c03('0x10')]);router[_0x1c03('0x11')]('/',auth[_0x1c03('0x9')](),controller[_0x1c03('0x12')]);router[_0x1c03('0x13')](_0x1c03('0x14'),auth[_0x1c03('0x9')](),controller[_0x1c03('0x15')]);router['delete'](_0x1c03('0x14'),auth[_0x1c03('0x9')](),controller[_0x1c03('0x16')]);module[_0x1c03('0x17')]=router; \ No newline at end of file +var _0x8f5b=['/:id/descriptions','post','create','update','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id','show','getSubjects'];(function(_0x5aecfe,_0x5e4e3c){var _0x26e98e=function(_0x1e4ac3){while(--_0x1e4ac3){_0x5aecfe['push'](_0x5aecfe['shift']());}};_0x26e98e(++_0x5e4e3c);}(_0x8f5b,0x13b));var _0xb8f5=function(_0x185559,_0x3271fd){_0x185559=_0x185559-0x0;var _0x33a706=_0x8f5b[_0x185559];return _0x33a706;};'use strict';var multer=require(_0xb8f5('0x0'));var util=require(_0xb8f5('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb8f5('0x2'));var router=express[_0xb8f5('0x3')]();var fs_extra=require(_0xb8f5('0x4'));var auth=require(_0xb8f5('0x5'));var interaction=require(_0xb8f5('0x6'));var config=require(_0xb8f5('0x7'));var controller=require(_0xb8f5('0x8'));router[_0xb8f5('0x9')]('/',auth[_0xb8f5('0xa')](),controller[_0xb8f5('0xb')]);router[_0xb8f5('0x9')](_0xb8f5('0xc'),auth[_0xb8f5('0xa')](),controller[_0xb8f5('0xd')]);router[_0xb8f5('0x9')]('/:id/fields',auth[_0xb8f5('0xa')](),controller['getFields']);router[_0xb8f5('0x9')]('/:id/subjects',auth[_0xb8f5('0xa')](),controller[_0xb8f5('0xe')]);router[_0xb8f5('0x9')](_0xb8f5('0xf'),auth[_0xb8f5('0xa')](),controller['getDescriptions']);router[_0xb8f5('0x10')]('/',auth[_0xb8f5('0xa')](),controller[_0xb8f5('0x11')]);router['put'](_0xb8f5('0xc'),auth[_0xb8f5('0xa')](),controller[_0xb8f5('0x12')]);router[_0xb8f5('0x13')](_0xb8f5('0xc'),auth['isAuthenticated'](),controller[_0xb8f5('0x14')]);module[_0xb8f5('0x15')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index f5f5c6c..565b919 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 _0x457d=['STRING','sequelize','exports'];(function(_0xb0b922,_0x183826){var _0x5dc41e=function(_0x461183){while(--_0x461183){_0xb0b922['push'](_0xb0b922['shift']());}};_0x5dc41e(++_0x183826);}(_0x457d,0xd6));var _0xd457=function(_0x421e36,_0x18776e){_0x421e36=_0x421e36-0x0;var _0x20b3e3=_0x457d[_0x421e36];return _0x20b3e3;};'use strict';var Sequelize=require(_0xd457('0x0'));module[_0xd457('0x1')]={'name':{'type':Sequelize[_0xd457('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xce61=['STRING','sequelize','exports'];(function(_0x244452,_0x1c5845){var _0x21a959=function(_0x10556c){while(--_0x10556c){_0x244452['push'](_0x244452['shift']());}};_0x21a959(++_0x1c5845);}(_0xce61,0x136));var _0x1ce6=function(_0x2f93a4,_0xa01d44){_0x2f93a4=_0x2f93a4-0x0;var _0x46a0d5=_0xce61[_0x2f93a4];return _0x46a0d5;};'use strict';var Sequelize=require(_0x1ce6('0x0'));module[_0x1ce6('0x1')]={'name':{'type':Sequelize[_0x1ce6('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 142ed3b..673efc1 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 _0xf485=['getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','ServicenowConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','find','body','findOne','ServicenowField','length','getFields','getSubjects','options'];(function(_0x385142,_0x18945e){var _0x9fb3db=function(_0x169fce){while(--_0x169fce){_0x385142['push'](_0x385142['shift']());}};_0x9fb3db(++_0x18945e);}(_0xf485,0xad));var _0x5f48=function(_0x44e741,_0x453afd){_0x44e741=_0x44e741-0x0;var _0x3484bf=_0xf485[_0x44e741];return _0x3484bf;};'use strict';var emlformat=require(_0x5f48('0x0'));var rimraf=require(_0x5f48('0x1'));var zipdir=require(_0x5f48('0x2'));var jsonpatch=require(_0x5f48('0x3'));var rp=require(_0x5f48('0x4'));var moment=require(_0x5f48('0x5'));var BPromise=require(_0x5f48('0x6'));var Mustache=require(_0x5f48('0x7'));var util=require('util');var path=require('path');var sox=require(_0x5f48('0x8'));var csv=require(_0x5f48('0x9'));var ejs=require(_0x5f48('0xa'));var fs=require('fs');var fs_extra=require(_0x5f48('0xb'));var _=require(_0x5f48('0xc'));var squel=require(_0x5f48('0xd'));var crypto=require(_0x5f48('0xe'));var jsforce=require(_0x5f48('0xf'));var deskjs=require(_0x5f48('0x10'));var toCsv=require(_0x5f48('0x9'));var querystring=require(_0x5f48('0x11'));var Papa=require(_0x5f48('0x12'));var Redis=require(_0x5f48('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x5f48('0x14'));var as=require(_0x5f48('0x15'));var hardwareService=require(_0x5f48('0x16'));var logger=require(_0x5f48('0x17'))(_0x5f48('0x18'));var utils=require(_0x5f48('0x19'));var config=require(_0x5f48('0x1a'));var licenseUtil=require(_0x5f48('0x1b'));var db=require(_0x5f48('0x1c'))['db'];function respondWithStatusCode(_0x501c50,_0x11acd6){_0x11acd6=_0x11acd6||0xcc;return function(_0x4d541a){if(_0x4d541a){return _0x501c50[_0x5f48('0x1d')](_0x11acd6);}return _0x501c50['status'](_0x11acd6)[_0x5f48('0x1e')]();};}function respondWithResult(_0x682f8f,_0x722a86){_0x722a86=_0x722a86||0xc8;return function(_0x4d1bf9){if(_0x4d1bf9){return _0x682f8f['status'](_0x722a86)[_0x5f48('0x1f')](_0x4d1bf9);}};}function respondWithFilteredResult(_0x434af3,_0x5a3d9e){return function(_0x5415a5){if(_0x5415a5){var _0x30958a=typeof _0x5a3d9e[_0x5f48('0x20')]===_0x5f48('0x21')&&typeof _0x5a3d9e[_0x5f48('0x22')]==='undefined';var _0x214ba3=_0x5415a5[_0x5f48('0x23')];var _0x8f5b52=_0x30958a?0x0:_0x5a3d9e['offset'];var _0x173486=_0x30958a?_0x5415a5[_0x5f48('0x23')]:_0x5a3d9e[_0x5f48('0x20')]+_0x5a3d9e[_0x5f48('0x22')];var _0x1f0ce2;if(_0x173486>=_0x214ba3){_0x173486=_0x214ba3;_0x1f0ce2=0xc8;}else{_0x1f0ce2=0xce;}_0x434af3[_0x5f48('0x24')](_0x1f0ce2);return _0x434af3['set'](_0x5f48('0x25'),_0x8f5b52+'-'+_0x173486+'/'+_0x214ba3)[_0x5f48('0x1f')](_0x5415a5);}return null;};}function patchUpdates(_0x525b23){return function(_0x1ab2ff){try{jsonpatch[_0x5f48('0x26')](_0x1ab2ff,_0x525b23,!![]);}catch(_0x462858){return BPromise[_0x5f48('0x27')](_0x462858);}return _0x1ab2ff[_0x5f48('0x28')]();};}function saveUpdates(_0x5c1bcb,_0x308a89){return function(_0x196d15){if(_0x196d15){return _0x196d15[_0x5f48('0x29')](_0x5c1bcb)[_0x5f48('0x2a')](function(_0x5a04a1){return _0x5a04a1;});}return null;};}function removeEntity(_0x19cc6f,_0x58b046){return function(_0xb766b){if(_0xb766b){return _0xb766b[_0x5f48('0x2b')]()[_0x5f48('0x2a')](function(){_0x19cc6f[_0x5f48('0x24')](0xcc)[_0x5f48('0x1e')]();});}};}function handleEntityNotFound(_0x3dc65f,_0x156cf2){return function(_0x132d46){if(!_0x132d46){_0x3dc65f[_0x5f48('0x1d')](0x194);}return _0x132d46;};}function handleError(_0x15fcf7,_0x3d7bab){_0x3d7bab=_0x3d7bab||0x1f4;return function(_0x2fcf63){logger['error'](_0x2fcf63[_0x5f48('0x2c')]);if(_0x2fcf63['name']){delete _0x2fcf63[_0x5f48('0x2d')];}_0x15fcf7[_0x5f48('0x24')](_0x3d7bab)[_0x5f48('0x2e')](_0x2fcf63);};}exports[_0x5f48('0x2f')]=function(_0xfc7c98,_0x2edde3){var _0x19cfb5={},_0x43cf5f={},_0x10f805={'count':0x0,'rows':[]};var _0x598c73=_[_0x5f48('0x30')](db[_0x5f48('0x31')][_0x5f48('0x32')],function(_0x4b4b1e){return{'name':_0x4b4b1e[_0x5f48('0x33')],'type':_0x4b4b1e[_0x5f48('0x34')][_0x5f48('0x35')]};});_0x43cf5f[_0x5f48('0x36')]=_[_0x5f48('0x30')](_0x598c73,_0x5f48('0x2d'));_0x43cf5f[_0x5f48('0x37')]=_[_0x5f48('0x38')](_0xfc7c98[_0x5f48('0x37')]);_0x43cf5f[_0x5f48('0x39')]=_[_0x5f48('0x3a')](_0x43cf5f[_0x5f48('0x36')],_0x43cf5f[_0x5f48('0x37')]);_0x19cfb5[_0x5f48('0x3b')]=_['intersection'](_0x43cf5f[_0x5f48('0x36')],qs[_0x5f48('0x3c')](_0xfc7c98[_0x5f48('0x37')][_0x5f48('0x3c')]));_0x19cfb5[_0x5f48('0x3b')]=_0x19cfb5[_0x5f48('0x3b')]['length']?_0x19cfb5[_0x5f48('0x3b')]:_0x43cf5f[_0x5f48('0x36')];if(!_0xfc7c98[_0x5f48('0x37')][_0x5f48('0x3d')](_0x5f48('0x3e'))){_0x19cfb5[_0x5f48('0x22')]=qs[_0x5f48('0x22')](_0xfc7c98[_0x5f48('0x37')][_0x5f48('0x22')]);_0x19cfb5[_0x5f48('0x20')]=qs['offset'](_0xfc7c98[_0x5f48('0x37')][_0x5f48('0x20')]);}_0x19cfb5[_0x5f48('0x3f')]=qs[_0x5f48('0x40')](_0xfc7c98[_0x5f48('0x37')][_0x5f48('0x40')]);_0x19cfb5['where']=qs['filters'](_[_0x5f48('0x41')](_0xfc7c98[_0x5f48('0x37')],_0x43cf5f['filters']),_0x598c73);if(_0xfc7c98[_0x5f48('0x37')][_0x5f48('0x42')]){_0x19cfb5[_0x5f48('0x43')]=_[_0x5f48('0x44')](_0x19cfb5[_0x5f48('0x43')],{'$or':_[_0x5f48('0x30')](_0x598c73,function(_0x526686){if(_0x526686['type']!==_0x5f48('0x45')){var _0x37edb3={};_0x37edb3[_0x526686['name']]={'$like':'%'+_0xfc7c98[_0x5f48('0x37')][_0x5f48('0x42')]+'%'};return _0x37edb3;}})});}_0x19cfb5=_[_0x5f48('0x44')]({},_0x19cfb5,_0xfc7c98['options']);var _0xa4c60f={'where':_0x19cfb5[_0x5f48('0x43')]};return db[_0x5f48('0x31')][_0x5f48('0x23')](_0xa4c60f)[_0x5f48('0x2a')](function(_0x23330e){_0x10f805[_0x5f48('0x23')]=_0x23330e;if(_0xfc7c98[_0x5f48('0x37')][_0x5f48('0x46')]){_0x19cfb5[_0x5f48('0x47')]=[{'all':!![]}];}return db[_0x5f48('0x31')][_0x5f48('0x48')](_0x19cfb5);})[_0x5f48('0x2a')](function(_0x3af5d3){_0x10f805[_0x5f48('0x49')]=_0x3af5d3;return _0x10f805;})['then'](respondWithFilteredResult(_0x2edde3,_0x19cfb5))[_0x5f48('0x4a')](handleError(_0x2edde3,null));};exports[_0x5f48('0x4b')]=function(_0x1b3937,_0x3e7cc){var _0x5ef7d6={'raw':![],'where':{'id':_0x1b3937[_0x5f48('0x4c')]['id']}},_0x29efca={};_0x29efca[_0x5f48('0x36')]=_['keys'](db[_0x5f48('0x31')][_0x5f48('0x32')]);_0x29efca[_0x5f48('0x37')]=_['keys'](_0x1b3937[_0x5f48('0x37')]);_0x29efca['filters']=_[_0x5f48('0x3a')](_0x29efca[_0x5f48('0x36')],_0x29efca['query']);_0x5ef7d6[_0x5f48('0x3b')]=_[_0x5f48('0x3a')](_0x29efca[_0x5f48('0x36')],qs['fields'](_0x1b3937[_0x5f48('0x37')]['fields']));_0x5ef7d6[_0x5f48('0x3b')]=_0x5ef7d6[_0x5f48('0x3b')]['length']?_0x5ef7d6[_0x5f48('0x3b')]:_0x29efca[_0x5f48('0x36')];if(_0x1b3937[_0x5f48('0x37')][_0x5f48('0x46')]){_0x5ef7d6['include']=[{'all':!![]}];}_0x5ef7d6=_[_0x5f48('0x44')]({},_0x5ef7d6,_0x1b3937['options']);return db[_0x5f48('0x31')][_0x5f48('0x4d')](_0x5ef7d6)[_0x5f48('0x2a')](handleEntityNotFound(_0x3e7cc,null))[_0x5f48('0x2a')](respondWithResult(_0x3e7cc,null))[_0x5f48('0x4a')](handleError(_0x3e7cc,null));};exports['create']=function(_0x593b60,_0x5bae35){return db[_0x5f48('0x31')]['create'](_0x593b60[_0x5f48('0x4e')],{})[_0x5f48('0x2a')](respondWithResult(_0x5bae35,0xc9))[_0x5f48('0x4a')](handleError(_0x5bae35,null));};exports[_0x5f48('0x29')]=function(_0x5cffb1,_0x144147){if(_0x5cffb1[_0x5f48('0x4e')]['id']){delete _0x5cffb1['body']['id'];}return db['ServicenowConfiguration'][_0x5f48('0x4d')]({'where':{'id':_0x5cffb1['params']['id']}})[_0x5f48('0x2a')](handleEntityNotFound(_0x144147,null))[_0x5f48('0x2a')](saveUpdates(_0x5cffb1[_0x5f48('0x4e')],null))[_0x5f48('0x2a')](respondWithResult(_0x144147,null))['catch'](handleError(_0x144147,null));};exports[_0x5f48('0x2b')]=function(_0x2ba963,_0x3a2cc4){return db[_0x5f48('0x31')][_0x5f48('0x4d')]({'where':{'id':_0x2ba963[_0x5f48('0x4c')]['id']}})[_0x5f48('0x2a')](handleEntityNotFound(_0x3a2cc4,null))[_0x5f48('0x2a')](removeEntity(_0x3a2cc4,null))[_0x5f48('0x4a')](handleError(_0x3a2cc4,null));};exports['getFields']=function(_0x443d11,_0xdae7b5,_0x44abcd){var _0x343d87={};var _0x1b6341={};var _0x13f035;var _0x2fcb8a;return db[_0x5f48('0x31')][_0x5f48('0x4f')]({'where':{'id':_0x443d11[_0x5f48('0x4c')]['id']}})['then'](handleEntityNotFound(_0xdae7b5,null))[_0x5f48('0x2a')](function(_0x2d7ce2){if(_0x2d7ce2){_0x13f035=_0x2d7ce2;_0x1b6341[_0x5f48('0x36')]=_[_0x5f48('0x38')](db[_0x5f48('0x50')]['rawAttributes']);_0x1b6341[_0x5f48('0x37')]=_['keys'](_0x443d11[_0x5f48('0x37')]);_0x1b6341['filters']=_[_0x5f48('0x3a')](_0x1b6341[_0x5f48('0x36')],_0x1b6341[_0x5f48('0x37')]);_0x343d87[_0x5f48('0x3b')]=_[_0x5f48('0x3a')](_0x1b6341[_0x5f48('0x36')],qs['fields'](_0x443d11[_0x5f48('0x37')][_0x5f48('0x3c')]));_0x343d87[_0x5f48('0x3b')]=_0x343d87[_0x5f48('0x3b')][_0x5f48('0x51')]?_0x343d87[_0x5f48('0x3b')]:_0x1b6341['model'];_0x343d87[_0x5f48('0x3f')]=qs[_0x5f48('0x40')](_0x443d11[_0x5f48('0x37')][_0x5f48('0x40')]);_0x343d87[_0x5f48('0x43')]=qs[_0x5f48('0x39')](_['pick'](_0x443d11[_0x5f48('0x37')],_0x1b6341[_0x5f48('0x39')]));if(_0x443d11[_0x5f48('0x37')]['filter']){_0x343d87[_0x5f48('0x43')]=_[_0x5f48('0x44')](_0x343d87[_0x5f48('0x43')],{'$or':_[_0x5f48('0x30')](_0x343d87[_0x5f48('0x3b')],function(_0x3bd0cd){var _0x4a62be={};_0x4a62be[_0x3bd0cd]={'$like':'%'+_0x443d11[_0x5f48('0x37')][_0x5f48('0x42')]+'%'};return _0x4a62be;})});}_0x343d87=_[_0x5f48('0x44')]({},_0x343d87,_0x443d11['options']);return _0x13f035[_0x5f48('0x52')](_0x343d87);}})[_0x5f48('0x2a')](function(_0x7d0322){if(_0x7d0322){_0x2fcb8a=_0x7d0322['length'];if(!_0x443d11[_0x5f48('0x37')][_0x5f48('0x3d')](_0x5f48('0x3e'))){_0x343d87['limit']=qs[_0x5f48('0x22')](_0x443d11[_0x5f48('0x37')][_0x5f48('0x22')]);_0x343d87['offset']=qs['offset'](_0x443d11[_0x5f48('0x37')][_0x5f48('0x20')]);}return _0x13f035[_0x5f48('0x52')](_0x343d87);}})[_0x5f48('0x2a')](function(_0x2fae47){if(_0x2fae47){return _0x2fae47?{'count':_0x2fcb8a,'rows':_0x2fae47}:null;}})[_0x5f48('0x2a')](respondWithResult(_0xdae7b5,null))[_0x5f48('0x4a')](handleError(_0xdae7b5,null));};exports[_0x5f48('0x53')]=function(_0x436619,_0x26b4bc,_0x1909e7){var _0x31ed90={};var _0xf57954={};var _0x5b2bb6;var _0x3d8530;return db['ServicenowConfiguration'][_0x5f48('0x4f')]({'where':{'id':_0x436619[_0x5f48('0x4c')]['id']}})[_0x5f48('0x2a')](handleEntityNotFound(_0x26b4bc,null))[_0x5f48('0x2a')](function(_0x39b1d1){if(_0x39b1d1){_0x5b2bb6=_0x39b1d1;_0xf57954[_0x5f48('0x36')]=_['keys'](db[_0x5f48('0x50')]['rawAttributes']);_0xf57954[_0x5f48('0x37')]=_['keys'](_0x436619[_0x5f48('0x37')]);_0xf57954[_0x5f48('0x39')]=_['intersection'](_0xf57954[_0x5f48('0x36')],_0xf57954[_0x5f48('0x37')]);_0x31ed90[_0x5f48('0x3b')]=_[_0x5f48('0x3a')](_0xf57954[_0x5f48('0x36')],qs[_0x5f48('0x3c')](_0x436619[_0x5f48('0x37')][_0x5f48('0x3c')]));_0x31ed90[_0x5f48('0x3b')]=_0x31ed90[_0x5f48('0x3b')]['length']?_0x31ed90[_0x5f48('0x3b')]:_0xf57954['model'];_0x31ed90[_0x5f48('0x3f')]=qs[_0x5f48('0x40')](_0x436619[_0x5f48('0x37')]['sort']);_0x31ed90[_0x5f48('0x43')]=qs[_0x5f48('0x39')](_['pick'](_0x436619[_0x5f48('0x37')],_0xf57954['filters']));if(_0x436619['query']['filter']){_0x31ed90[_0x5f48('0x43')]=_[_0x5f48('0x44')](_0x31ed90[_0x5f48('0x43')],{'$or':_['map'](_0x31ed90[_0x5f48('0x3b')],function(_0x130bf0){var _0x781ea6={};_0x781ea6[_0x130bf0]={'$like':'%'+_0x436619['query'][_0x5f48('0x42')]+'%'};return _0x781ea6;})});}_0x31ed90=_[_0x5f48('0x44')]({},_0x31ed90,_0x436619[_0x5f48('0x54')]);return _0x5b2bb6[_0x5f48('0x53')](_0x31ed90);}})[_0x5f48('0x2a')](function(_0xd11503){if(_0xd11503){_0x3d8530=_0xd11503[_0x5f48('0x51')];if(!_0x436619[_0x5f48('0x37')]['hasOwnProperty'](_0x5f48('0x3e'))){_0x31ed90[_0x5f48('0x22')]=qs['limit'](_0x436619[_0x5f48('0x37')]['limit']);_0x31ed90['offset']=qs[_0x5f48('0x20')](_0x436619[_0x5f48('0x37')][_0x5f48('0x20')]);}return _0x5b2bb6['getSubjects'](_0x31ed90);}})[_0x5f48('0x2a')](function(_0x42c1da){if(_0x42c1da){return _0x42c1da?{'count':_0x3d8530,'rows':_0x42c1da}:null;}})['then'](respondWithResult(_0x26b4bc,null))[_0x5f48('0x4a')](handleError(_0x26b4bc,null));};exports[_0x5f48('0x55')]=function(_0x4b6b4a,_0x21649c,_0x4baf37){var _0x148611={};var _0x319c28={};var _0x321d69;var _0xd3e33b;return db[_0x5f48('0x31')][_0x5f48('0x4f')]({'where':{'id':_0x4b6b4a['params']['id']}})['then'](handleEntityNotFound(_0x21649c,null))[_0x5f48('0x2a')](function(_0x19b477){if(_0x19b477){_0x321d69=_0x19b477;_0x319c28['model']=_[_0x5f48('0x38')](db[_0x5f48('0x50')]['rawAttributes']);_0x319c28[_0x5f48('0x37')]=_['keys'](_0x4b6b4a[_0x5f48('0x37')]);_0x319c28['filters']=_['intersection'](_0x319c28[_0x5f48('0x36')],_0x319c28['query']);_0x148611[_0x5f48('0x3b')]=_['intersection'](_0x319c28[_0x5f48('0x36')],qs[_0x5f48('0x3c')](_0x4b6b4a['query'][_0x5f48('0x3c')]));_0x148611[_0x5f48('0x3b')]=_0x148611[_0x5f48('0x3b')][_0x5f48('0x51')]?_0x148611[_0x5f48('0x3b')]:_0x319c28[_0x5f48('0x36')];_0x148611[_0x5f48('0x3f')]=qs[_0x5f48('0x40')](_0x4b6b4a['query'][_0x5f48('0x40')]);_0x148611['where']=qs[_0x5f48('0x39')](_[_0x5f48('0x41')](_0x4b6b4a[_0x5f48('0x37')],_0x319c28[_0x5f48('0x39')]));if(_0x4b6b4a[_0x5f48('0x37')][_0x5f48('0x42')]){_0x148611['where']=_[_0x5f48('0x44')](_0x148611['where'],{'$or':_[_0x5f48('0x30')](_0x148611[_0x5f48('0x3b')],function(_0x382ea0){var _0x28cc90={};_0x28cc90[_0x382ea0]={'$like':'%'+_0x4b6b4a[_0x5f48('0x37')]['filter']+'%'};return _0x28cc90;})});}_0x148611=_['merge']({},_0x148611,_0x4b6b4a[_0x5f48('0x54')]);return _0x321d69[_0x5f48('0x55')](_0x148611);}})[_0x5f48('0x2a')](function(_0x16c9f0){if(_0x16c9f0){_0xd3e33b=_0x16c9f0[_0x5f48('0x51')];if(!_0x4b6b4a[_0x5f48('0x37')][_0x5f48('0x3d')](_0x5f48('0x3e'))){_0x148611['limit']=qs[_0x5f48('0x22')](_0x4b6b4a[_0x5f48('0x37')][_0x5f48('0x22')]);_0x148611[_0x5f48('0x20')]=qs['offset'](_0x4b6b4a[_0x5f48('0x37')][_0x5f48('0x20')]);}return _0x321d69[_0x5f48('0x55')](_0x148611);}})['then'](function(_0x44678e){if(_0x44678e){return _0x44678e?{'count':_0xd3e33b,'rows':_0x44678e}:null;}})[_0x5f48('0x2a')](respondWithResult(_0x21649c,null))[_0x5f48('0x4a')](handleError(_0x21649c,null));}; \ No newline at end of file +var _0x7464=['send','index','map','ServicenowConfiguration','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','includeAll','findAll','rows','show','params','include','options','find','catch','create','body','update','getFields','ServicenowField','findOne','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','stack','name'];(function(_0x514c21,_0x5b9f67){var _0xd85d62=function(_0x3ade6e){while(--_0x3ade6e){_0x514c21['push'](_0x514c21['shift']());}};_0xd85d62(++_0x5b9f67);}(_0x7464,0x7e));var _0x4746=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7464[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x4746('0x0'));var rimraf=require(_0x4746('0x1'));var zipdir=require(_0x4746('0x2'));var jsonpatch=require(_0x4746('0x3'));var rp=require('request-promise');var moment=require(_0x4746('0x4'));var BPromise=require(_0x4746('0x5'));var Mustache=require(_0x4746('0x6'));var util=require('util');var path=require(_0x4746('0x7'));var sox=require('sox');var csv=require(_0x4746('0x8'));var ejs=require(_0x4746('0x9'));var fs=require('fs');var fs_extra=require(_0x4746('0xa'));var _=require(_0x4746('0xb'));var squel=require(_0x4746('0xc'));var crypto=require('crypto');var jsforce=require(_0x4746('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x4746('0x8'));var querystring=require(_0x4746('0xe'));var Papa=require(_0x4746('0xf'));var Redis=require(_0x4746('0x10'));var authService=require(_0x4746('0x11'));var qs=require(_0x4746('0x12'));var as=require(_0x4746('0x13'));var hardwareService=require(_0x4746('0x14'));var logger=require(_0x4746('0x15'))(_0x4746('0x16'));var utils=require(_0x4746('0x17'));var config=require(_0x4746('0x18'));var licenseUtil=require(_0x4746('0x19'));var db=require(_0x4746('0x1a'))['db'];function respondWithStatusCode(_0x369513,_0x3acb2e){_0x3acb2e=_0x3acb2e||0xcc;return function(_0x961c1f){if(_0x961c1f){return _0x369513[_0x4746('0x1b')](_0x3acb2e);}return _0x369513[_0x4746('0x1c')](_0x3acb2e)[_0x4746('0x1d')]();};}function respondWithResult(_0x1857a9,_0x4f33c0){_0x4f33c0=_0x4f33c0||0xc8;return function(_0x419d96){if(_0x419d96){return _0x1857a9[_0x4746('0x1c')](_0x4f33c0)[_0x4746('0x1e')](_0x419d96);}};}function respondWithFilteredResult(_0x103583,_0x2b9a06){return function(_0x1182f2){if(_0x1182f2){var _0x3a68e1=typeof _0x2b9a06[_0x4746('0x1f')]===_0x4746('0x20')&&typeof _0x2b9a06[_0x4746('0x21')]===_0x4746('0x20');var _0x1dc68e=_0x1182f2[_0x4746('0x22')];var _0x2c45c2=_0x3a68e1?0x0:_0x2b9a06['offset'];var _0x3e7ad0=_0x3a68e1?_0x1182f2[_0x4746('0x22')]:_0x2b9a06[_0x4746('0x1f')]+_0x2b9a06[_0x4746('0x21')];var _0x82dd7;if(_0x3e7ad0>=_0x1dc68e){_0x3e7ad0=_0x1dc68e;_0x82dd7=0xc8;}else{_0x82dd7=0xce;}_0x103583[_0x4746('0x1c')](_0x82dd7);return _0x103583[_0x4746('0x23')](_0x4746('0x24'),_0x2c45c2+'-'+_0x3e7ad0+'/'+_0x1dc68e)['json'](_0x1182f2);}return null;};}function patchUpdates(_0x203238){return function(_0x1a7131){try{jsonpatch[_0x4746('0x25')](_0x1a7131,_0x203238,!![]);}catch(_0x570842){return BPromise[_0x4746('0x26')](_0x570842);}return _0x1a7131[_0x4746('0x27')]();};}function saveUpdates(_0x3070d4,_0x42f872){return function(_0x20db07){if(_0x20db07){return _0x20db07['update'](_0x3070d4)[_0x4746('0x28')](function(_0x881973){return _0x881973;});}return null;};}function removeEntity(_0x47a34c,_0x532fb5){return function(_0x460491){if(_0x460491){return _0x460491[_0x4746('0x29')]()[_0x4746('0x28')](function(){_0x47a34c[_0x4746('0x1c')](0xcc)[_0x4746('0x1d')]();});}};}function handleEntityNotFound(_0x52d197,_0x50044a){return function(_0x5a81cd){if(!_0x5a81cd){_0x52d197[_0x4746('0x1b')](0x194);}return _0x5a81cd;};}function handleError(_0x188d3f,_0x172b22){_0x172b22=_0x172b22||0x1f4;return function(_0x7c5f6f){logger['error'](_0x7c5f6f[_0x4746('0x2a')]);if(_0x7c5f6f['name']){delete _0x7c5f6f[_0x4746('0x2b')];}_0x188d3f[_0x4746('0x1c')](_0x172b22)[_0x4746('0x2c')](_0x7c5f6f);};}exports[_0x4746('0x2d')]=function(_0x14edbc,_0x3c235e){var _0x305d92={},_0x1205d7={},_0x192bc4={'count':0x0,'rows':[]};var _0x4e8187=_[_0x4746('0x2e')](db[_0x4746('0x2f')][_0x4746('0x30')],function(_0x155918){return{'name':_0x155918['fieldName'],'type':_0x155918[_0x4746('0x31')][_0x4746('0x32')]};});_0x1205d7[_0x4746('0x33')]=_[_0x4746('0x2e')](_0x4e8187,_0x4746('0x2b'));_0x1205d7[_0x4746('0x34')]=_[_0x4746('0x35')](_0x14edbc[_0x4746('0x34')]);_0x1205d7[_0x4746('0x36')]=_['intersection'](_0x1205d7['model'],_0x1205d7[_0x4746('0x34')]);_0x305d92['attributes']=_[_0x4746('0x37')](_0x1205d7[_0x4746('0x33')],qs['fields'](_0x14edbc[_0x4746('0x34')][_0x4746('0x38')]));_0x305d92[_0x4746('0x39')]=_0x305d92[_0x4746('0x39')][_0x4746('0x3a')]?_0x305d92[_0x4746('0x39')]:_0x1205d7[_0x4746('0x33')];if(!_0x14edbc[_0x4746('0x34')][_0x4746('0x3b')](_0x4746('0x3c'))){_0x305d92[_0x4746('0x21')]=qs[_0x4746('0x21')](_0x14edbc[_0x4746('0x34')][_0x4746('0x21')]);_0x305d92[_0x4746('0x1f')]=qs[_0x4746('0x1f')](_0x14edbc[_0x4746('0x34')][_0x4746('0x1f')]);}_0x305d92[_0x4746('0x3d')]=qs[_0x4746('0x3e')](_0x14edbc[_0x4746('0x34')][_0x4746('0x3e')]);_0x305d92['where']=qs[_0x4746('0x36')](_[_0x4746('0x3f')](_0x14edbc[_0x4746('0x34')],_0x1205d7[_0x4746('0x36')]),_0x4e8187);if(_0x14edbc[_0x4746('0x34')][_0x4746('0x40')]){_0x305d92['where']=_[_0x4746('0x41')](_0x305d92[_0x4746('0x42')],{'$or':_[_0x4746('0x2e')](_0x4e8187,function(_0x197a32){if(_0x197a32['type']!==_0x4746('0x43')){var _0x456f48={};_0x456f48[_0x197a32['name']]={'$like':'%'+_0x14edbc[_0x4746('0x34')][_0x4746('0x40')]+'%'};return _0x456f48;}})});}_0x305d92=_[_0x4746('0x41')]({},_0x305d92,_0x14edbc['options']);var _0xa502a4={'where':_0x305d92['where']};return db[_0x4746('0x2f')][_0x4746('0x22')](_0xa502a4)[_0x4746('0x28')](function(_0x44da34){_0x192bc4[_0x4746('0x22')]=_0x44da34;if(_0x14edbc[_0x4746('0x34')][_0x4746('0x44')]){_0x305d92['include']=[{'all':!![]}];}return db['ServicenowConfiguration'][_0x4746('0x45')](_0x305d92);})[_0x4746('0x28')](function(_0x5b2c94){_0x192bc4[_0x4746('0x46')]=_0x5b2c94;return _0x192bc4;})[_0x4746('0x28')](respondWithFilteredResult(_0x3c235e,_0x305d92))['catch'](handleError(_0x3c235e,null));};exports[_0x4746('0x47')]=function(_0x27f67d,_0x3cc99d){var _0x2e2e62={'raw':![],'where':{'id':_0x27f67d[_0x4746('0x48')]['id']}},_0x2a3e63={};_0x2a3e63[_0x4746('0x33')]=_[_0x4746('0x35')](db[_0x4746('0x2f')][_0x4746('0x30')]);_0x2a3e63[_0x4746('0x34')]=_['keys'](_0x27f67d[_0x4746('0x34')]);_0x2a3e63[_0x4746('0x36')]=_[_0x4746('0x37')](_0x2a3e63['model'],_0x2a3e63[_0x4746('0x34')]);_0x2e2e62[_0x4746('0x39')]=_[_0x4746('0x37')](_0x2a3e63[_0x4746('0x33')],qs[_0x4746('0x38')](_0x27f67d['query'][_0x4746('0x38')]));_0x2e2e62['attributes']=_0x2e2e62[_0x4746('0x39')][_0x4746('0x3a')]?_0x2e2e62['attributes']:_0x2a3e63[_0x4746('0x33')];if(_0x27f67d[_0x4746('0x34')][_0x4746('0x44')]){_0x2e2e62[_0x4746('0x49')]=[{'all':!![]}];}_0x2e2e62=_[_0x4746('0x41')]({},_0x2e2e62,_0x27f67d[_0x4746('0x4a')]);return db[_0x4746('0x2f')][_0x4746('0x4b')](_0x2e2e62)[_0x4746('0x28')](handleEntityNotFound(_0x3cc99d,null))[_0x4746('0x28')](respondWithResult(_0x3cc99d,null))[_0x4746('0x4c')](handleError(_0x3cc99d,null));};exports[_0x4746('0x4d')]=function(_0x5f467c,_0x169247){return db['ServicenowConfiguration'][_0x4746('0x4d')](_0x5f467c[_0x4746('0x4e')],{})['then'](respondWithResult(_0x169247,0xc9))[_0x4746('0x4c')](handleError(_0x169247,null));};exports[_0x4746('0x4f')]=function(_0x167807,_0x282532){if(_0x167807[_0x4746('0x4e')]['id']){delete _0x167807['body']['id'];}return db[_0x4746('0x2f')][_0x4746('0x4b')]({'where':{'id':_0x167807['params']['id']}})[_0x4746('0x28')](handleEntityNotFound(_0x282532,null))[_0x4746('0x28')](saveUpdates(_0x167807[_0x4746('0x4e')],null))['then'](respondWithResult(_0x282532,null))['catch'](handleError(_0x282532,null));};exports['destroy']=function(_0x4047e3,_0x5d00df){return db[_0x4746('0x2f')][_0x4746('0x4b')]({'where':{'id':_0x4047e3[_0x4746('0x48')]['id']}})[_0x4746('0x28')](handleEntityNotFound(_0x5d00df,null))[_0x4746('0x28')](removeEntity(_0x5d00df,null))[_0x4746('0x4c')](handleError(_0x5d00df,null));};exports[_0x4746('0x50')]=function(_0x20056d,_0x4334da,_0x397389){var _0x2b5033={};var _0x54b834={};var _0x3814c9;var _0x367b93;return db[_0x4746('0x2f')]['findOne']({'where':{'id':_0x20056d[_0x4746('0x48')]['id']}})[_0x4746('0x28')](handleEntityNotFound(_0x4334da,null))['then'](function(_0x20438b){if(_0x20438b){_0x3814c9=_0x20438b;_0x54b834[_0x4746('0x33')]=_[_0x4746('0x35')](db[_0x4746('0x51')][_0x4746('0x30')]);_0x54b834['query']=_['keys'](_0x20056d['query']);_0x54b834['filters']=_[_0x4746('0x37')](_0x54b834['model'],_0x54b834[_0x4746('0x34')]);_0x2b5033[_0x4746('0x39')]=_['intersection'](_0x54b834['model'],qs[_0x4746('0x38')](_0x20056d[_0x4746('0x34')]['fields']));_0x2b5033[_0x4746('0x39')]=_0x2b5033[_0x4746('0x39')][_0x4746('0x3a')]?_0x2b5033['attributes']:_0x54b834[_0x4746('0x33')];_0x2b5033[_0x4746('0x3d')]=qs[_0x4746('0x3e')](_0x20056d[_0x4746('0x34')][_0x4746('0x3e')]);_0x2b5033[_0x4746('0x42')]=qs[_0x4746('0x36')](_[_0x4746('0x3f')](_0x20056d[_0x4746('0x34')],_0x54b834['filters']));if(_0x20056d[_0x4746('0x34')]['filter']){_0x2b5033[_0x4746('0x42')]=_[_0x4746('0x41')](_0x2b5033[_0x4746('0x42')],{'$or':_[_0x4746('0x2e')](_0x2b5033[_0x4746('0x39')],function(_0x51576b){var _0x1d36a2={};_0x1d36a2[_0x51576b]={'$like':'%'+_0x20056d[_0x4746('0x34')]['filter']+'%'};return _0x1d36a2;})});}_0x2b5033=_[_0x4746('0x41')]({},_0x2b5033,_0x20056d['options']);return _0x3814c9[_0x4746('0x50')](_0x2b5033);}})['then'](function(_0xaa1bc2){if(_0xaa1bc2){_0x367b93=_0xaa1bc2[_0x4746('0x3a')];if(!_0x20056d[_0x4746('0x34')][_0x4746('0x3b')](_0x4746('0x3c'))){_0x2b5033[_0x4746('0x21')]=qs[_0x4746('0x21')](_0x20056d[_0x4746('0x34')]['limit']);_0x2b5033[_0x4746('0x1f')]=qs[_0x4746('0x1f')](_0x20056d[_0x4746('0x34')][_0x4746('0x1f')]);}return _0x3814c9[_0x4746('0x50')](_0x2b5033);}})[_0x4746('0x28')](function(_0x5069cb){if(_0x5069cb){return _0x5069cb?{'count':_0x367b93,'rows':_0x5069cb}:null;}})['then'](respondWithResult(_0x4334da,null))[_0x4746('0x4c')](handleError(_0x4334da,null));};exports['getSubjects']=function(_0x3dabbf,_0x3ae6e8,_0x13f0e5){var _0x186ac={};var _0xcfc4a9={};var _0x2974b9;var _0x18b45b;return db[_0x4746('0x2f')][_0x4746('0x52')]({'where':{'id':_0x3dabbf[_0x4746('0x48')]['id']}})['then'](handleEntityNotFound(_0x3ae6e8,null))[_0x4746('0x28')](function(_0x3c2a01){if(_0x3c2a01){_0x2974b9=_0x3c2a01;_0xcfc4a9[_0x4746('0x33')]=_[_0x4746('0x35')](db['ServicenowField']['rawAttributes']);_0xcfc4a9[_0x4746('0x34')]=_[_0x4746('0x35')](_0x3dabbf[_0x4746('0x34')]);_0xcfc4a9[_0x4746('0x36')]=_[_0x4746('0x37')](_0xcfc4a9[_0x4746('0x33')],_0xcfc4a9[_0x4746('0x34')]);_0x186ac[_0x4746('0x39')]=_[_0x4746('0x37')](_0xcfc4a9['model'],qs['fields'](_0x3dabbf[_0x4746('0x34')][_0x4746('0x38')]));_0x186ac[_0x4746('0x39')]=_0x186ac[_0x4746('0x39')][_0x4746('0x3a')]?_0x186ac[_0x4746('0x39')]:_0xcfc4a9[_0x4746('0x33')];_0x186ac[_0x4746('0x3d')]=qs[_0x4746('0x3e')](_0x3dabbf['query'][_0x4746('0x3e')]);_0x186ac[_0x4746('0x42')]=qs[_0x4746('0x36')](_[_0x4746('0x3f')](_0x3dabbf[_0x4746('0x34')],_0xcfc4a9[_0x4746('0x36')]));if(_0x3dabbf[_0x4746('0x34')]['filter']){_0x186ac[_0x4746('0x42')]=_['merge'](_0x186ac[_0x4746('0x42')],{'$or':_[_0x4746('0x2e')](_0x186ac[_0x4746('0x39')],function(_0x5e06de){var _0xca30bf={};_0xca30bf[_0x5e06de]={'$like':'%'+_0x3dabbf[_0x4746('0x34')][_0x4746('0x40')]+'%'};return _0xca30bf;})});}_0x186ac=_['merge']({},_0x186ac,_0x3dabbf[_0x4746('0x4a')]);return _0x2974b9['getSubjects'](_0x186ac);}})[_0x4746('0x28')](function(_0x2cf491){if(_0x2cf491){_0x18b45b=_0x2cf491[_0x4746('0x3a')];if(!_0x3dabbf[_0x4746('0x34')][_0x4746('0x3b')]('nolimit')){_0x186ac[_0x4746('0x21')]=qs[_0x4746('0x21')](_0x3dabbf[_0x4746('0x34')]['limit']);_0x186ac[_0x4746('0x1f')]=qs[_0x4746('0x1f')](_0x3dabbf[_0x4746('0x34')]['offset']);}return _0x2974b9[_0x4746('0x53')](_0x186ac);}})[_0x4746('0x28')](function(_0x55237e){if(_0x55237e){return _0x55237e?{'count':_0x18b45b,'rows':_0x55237e}:null;}})[_0x4746('0x28')](respondWithResult(_0x3ae6e8,null))[_0x4746('0x4c')](handleError(_0x3ae6e8,null));};exports['getDescriptions']=function(_0x5c14a0,_0xfdef85,_0x180e36){var _0x5a92e4={};var _0x4621aa={};var _0x534857;var _0x24ba84;return db['ServicenowConfiguration'][_0x4746('0x52')]({'where':{'id':_0x5c14a0[_0x4746('0x48')]['id']}})['then'](handleEntityNotFound(_0xfdef85,null))[_0x4746('0x28')](function(_0x4a0198){if(_0x4a0198){_0x534857=_0x4a0198;_0x4621aa[_0x4746('0x33')]=_[_0x4746('0x35')](db[_0x4746('0x51')]['rawAttributes']);_0x4621aa['query']=_[_0x4746('0x35')](_0x5c14a0[_0x4746('0x34')]);_0x4621aa['filters']=_[_0x4746('0x37')](_0x4621aa['model'],_0x4621aa['query']);_0x5a92e4[_0x4746('0x39')]=_[_0x4746('0x37')](_0x4621aa['model'],qs[_0x4746('0x38')](_0x5c14a0['query']['fields']));_0x5a92e4['attributes']=_0x5a92e4[_0x4746('0x39')][_0x4746('0x3a')]?_0x5a92e4[_0x4746('0x39')]:_0x4621aa[_0x4746('0x33')];_0x5a92e4[_0x4746('0x3d')]=qs[_0x4746('0x3e')](_0x5c14a0[_0x4746('0x34')][_0x4746('0x3e')]);_0x5a92e4[_0x4746('0x42')]=qs[_0x4746('0x36')](_['pick'](_0x5c14a0[_0x4746('0x34')],_0x4621aa[_0x4746('0x36')]));if(_0x5c14a0[_0x4746('0x34')]['filter']){_0x5a92e4['where']=_[_0x4746('0x41')](_0x5a92e4['where'],{'$or':_[_0x4746('0x2e')](_0x5a92e4[_0x4746('0x39')],function(_0xe26ffe){var _0x11bace={};_0x11bace[_0xe26ffe]={'$like':'%'+_0x5c14a0[_0x4746('0x34')][_0x4746('0x40')]+'%'};return _0x11bace;})});}_0x5a92e4=_[_0x4746('0x41')]({},_0x5a92e4,_0x5c14a0[_0x4746('0x4a')]);return _0x534857[_0x4746('0x54')](_0x5a92e4);}})[_0x4746('0x28')](function(_0x5d78e9){if(_0x5d78e9){_0x24ba84=_0x5d78e9[_0x4746('0x3a')];if(!_0x5c14a0[_0x4746('0x34')][_0x4746('0x3b')](_0x4746('0x3c'))){_0x5a92e4['limit']=qs[_0x4746('0x21')](_0x5c14a0[_0x4746('0x34')][_0x4746('0x21')]);_0x5a92e4[_0x4746('0x1f')]=qs[_0x4746('0x1f')](_0x5c14a0[_0x4746('0x34')][_0x4746('0x1f')]);}return _0x534857[_0x4746('0x54')](_0x5a92e4);}})['then'](function(_0x23148f){if(_0x23148f){return _0x23148f?{'count':_0x24ba84,'rows':_0x23148f}:null;}})[_0x4746('0x28')](respondWithResult(_0xfdef85,null))['catch'](handleError(_0xfdef85,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index ae6d44a..d4fa939 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 _0x8580=['api','request-promise','path','../../config/environment','./intServicenowConfiguration.attributes','define','ServicenowConfiguration','util'];(function(_0x3b2fa0,_0x41ffda){var _0x8dd6a5=function(_0x78ff0f){while(--_0x78ff0f){_0x3b2fa0['push'](_0x3b2fa0['shift']());}};_0x8dd6a5(++_0x41ffda);}(_0x8580,0x1c7));var _0x0858=function(_0x4f8f96,_0xf8b5d0){_0x4f8f96=_0x4f8f96-0x0;var _0x5bff7c=_0x8580[_0x4f8f96];return _0x5bff7c;};'use strict';var _=require('lodash');var util=require(_0x0858('0x0'));var logger=require('../../config/logger')(_0x0858('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0858('0x2'));var fs=require('fs');var path=require(_0x0858('0x3'));var rimraf=require('rimraf');var config=require(_0x0858('0x4'));var attributes=require(_0x0858('0x5'));module['exports']=function(_0x2b34e0,_0x8c913d){return _0x2b34e0[_0x0858('0x6')](_0x0858('0x7'),attributes,{'tableName':'int_servicenow_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbc87=['../../config/environment','./intServicenowConfiguration.attributes','exports','ServicenowConfiguration','int_servicenow_configurations','lodash','util','api','moment','bluebird','request-promise','rimraf'];(function(_0x1bde63,_0x324a2f){var _0x59eade=function(_0x438d51){while(--_0x438d51){_0x1bde63['push'](_0x1bde63['shift']());}};_0x59eade(++_0x324a2f);}(_0xbc87,0x1cd));var _0x7bc8=function(_0x15a00f,_0x3f0213){_0x15a00f=_0x15a00f-0x0;var _0x3d55cf=_0xbc87[_0x15a00f];return _0x3d55cf;};'use strict';var _=require(_0x7bc8('0x0'));var util=require(_0x7bc8('0x1'));var logger=require('../../config/logger')(_0x7bc8('0x2'));var moment=require(_0x7bc8('0x3'));var BPromise=require(_0x7bc8('0x4'));var rp=require(_0x7bc8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7bc8('0x6'));var config=require(_0x7bc8('0x7'));var attributes=require(_0x7bc8('0x8'));module[_0x7bc8('0x9')]=function(_0x3db27b,_0x4f291a){return _0x3db27b['define'](_0x7bc8('0xa'),attributes,{'tableName':_0x7bc8('0xb'),'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 439302b..3539a08 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 _0x7181=['../../config/environment','jayson/promise','client','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0xf363f0,_0x3b5eeb){var _0x55a386=function(_0x548349){while(--_0x548349){_0xf363f0['push'](_0xf363f0['shift']());}};_0x55a386(++_0x3b5eeb);}(_0x7181,0xb1));var _0x1718=function(_0x1c208e,_0x2a0a5b){_0x1c208e=_0x1c208e-0x0;var _0x5104ff=_0x7181[_0x1c208e];return _0x5104ff;};'use strict';var _=require('lodash');var util=require(_0x1718('0x0'));var moment=require('moment');var BPromise=require(_0x1718('0x1'));var rs=require(_0x1718('0x2'));var fs=require('fs');var Redis=require(_0x1718('0x3'));var db=require(_0x1718('0x4'))['db'];var utils=require(_0x1718('0x5'));var logger=require('../../config/logger')(_0x1718('0x6'));var config=require(_0x1718('0x7'));var jayson=require(_0x1718('0x8'));var client=jayson[_0x1718('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1ba5a5,_0x87b910,_0x10c076){return new BPromise(function(_0x5dc8c4,_0x3ec935){return client[_0x1718('0xa')](_0x1ba5a5,_0x10c076)[_0x1718('0xb')](function(_0x273550){logger[_0x1718('0xc')](_0x1718('0xd'),_0x87b910,_0x1718('0xe'));logger[_0x1718('0xf')](_0x1718('0x10'),_0x87b910,_0x1718('0xe'),JSON[_0x1718('0x11')](_0x273550));if(_0x273550[_0x1718('0x12')]){if(_0x273550[_0x1718('0x12')][_0x1718('0x13')]===0x1f4){logger[_0x1718('0x12')](_0x1718('0xd'),_0x87b910,_0x273550[_0x1718('0x12')]['message']);return _0x3ec935(_0x273550[_0x1718('0x12')][_0x1718('0x14')]);}logger[_0x1718('0x12')]('ServicenowConfiguration,\x20%s,\x20%s',_0x87b910,_0x273550['error']['message']);return _0x5dc8c4(_0x273550[_0x1718('0x12')][_0x1718('0x14')]);}else{logger['info'](_0x1718('0xd'),_0x87b910,'request\x20sent');_0x5dc8c4(_0x273550[_0x1718('0x15')][_0x1718('0x14')]);}})[_0x1718('0x16')](function(_0x36702e){logger[_0x1718('0x12')](_0x1718('0xd'),_0x87b910,_0x36702e);_0x3ec935(_0x36702e);});});} \ No newline at end of file +var _0x4f29=['lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch'];(function(_0x38a6ed,_0x5a4380){var _0x3eb276=function(_0x580e59){while(--_0x580e59){_0x38a6ed['push'](_0x38a6ed['shift']());}};_0x3eb276(++_0x5a4380);}(_0x4f29,0x1e0));var _0x94f2=function(_0x14d188,_0x654c7d){_0x14d188=_0x14d188-0x0;var _0x5bdc1c=_0x4f29[_0x14d188];return _0x5bdc1c;};'use strict';var _=require(_0x94f2('0x0'));var util=require(_0x94f2('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x94f2('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x94f2('0x3'))['db'];var utils=require(_0x94f2('0x4'));var logger=require(_0x94f2('0x5'))(_0x94f2('0x6'));var config=require(_0x94f2('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x94f2('0x8')][_0x94f2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x43eb5c,_0x277d1a,_0x477049){return new BPromise(function(_0x14ffce,_0x1ea88f){return client[_0x94f2('0xa')](_0x43eb5c,_0x477049)['then'](function(_0x2d9c17){logger[_0x94f2('0xb')](_0x94f2('0xc'),_0x277d1a,_0x94f2('0xd'));logger['debug'](_0x94f2('0xe'),_0x277d1a,'request\x20sent',JSON['stringify'](_0x2d9c17));if(_0x2d9c17['error']){if(_0x2d9c17[_0x94f2('0xf')][_0x94f2('0x10')]===0x1f4){logger[_0x94f2('0xf')](_0x94f2('0xc'),_0x277d1a,_0x2d9c17[_0x94f2('0xf')][_0x94f2('0x11')]);return _0x1ea88f(_0x2d9c17[_0x94f2('0xf')][_0x94f2('0x11')]);}logger[_0x94f2('0xf')](_0x94f2('0xc'),_0x277d1a,_0x2d9c17[_0x94f2('0xf')]['message']);return _0x14ffce(_0x2d9c17[_0x94f2('0xf')][_0x94f2('0x11')]);}else{logger['info'](_0x94f2('0xc'),_0x277d1a,'request\x20sent');_0x14ffce(_0x2d9c17[_0x94f2('0x12')][_0x94f2('0x11')]);}})[_0x94f2('0x13')](function(_0x2a629f){logger['error'](_0x94f2('0xc'),_0x277d1a,_0x2a629f);_0x1ea88f(_0x2a629f);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 9d4f1cb..80038d3 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 _0xbb1a=['post','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./intServicenowField.controller','get','index','isAuthenticated'];(function(_0xbf9238,_0x48e881){var _0x42b177=function(_0x4e33ec){while(--_0x4e33ec){_0xbf9238['push'](_0xbf9238['shift']());}};_0x42b177(++_0x48e881);}(_0xbb1a,0x127));var _0xabb1=function(_0x426fae,_0x2d155f){_0x426fae=_0x426fae-0x0;var _0x40543b=_0xbb1a[_0x426fae];return _0x40543b;};'use strict';var multer=require(_0xabb1('0x0'));var util=require('util');var path=require(_0xabb1('0x1'));var timeout=require(_0xabb1('0x2'));var express=require(_0xabb1('0x3'));var router=express[_0xabb1('0x4')]();var fs_extra=require(_0xabb1('0x5'));var auth=require(_0xabb1('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xabb1('0x7'));router[_0xabb1('0x8')]('/',auth['isAuthenticated'](),controller[_0xabb1('0x9')]);router[_0xabb1('0x8')]('/:id',auth[_0xabb1('0xa')](),controller['show']);router[_0xabb1('0xb')]('/',auth[_0xabb1('0xa')](),controller['create']);router['put'](_0xabb1('0xc'),auth[_0xabb1('0xa')](),controller[_0xabb1('0xd')]);router[_0xabb1('0xe')]('/:id',auth[_0xabb1('0xa')](),controller[_0xabb1('0xf')]);module[_0xabb1('0x10')]=router; \ No newline at end of file +var _0x4e20=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy','exports','multer'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x4e20,0x125));var _0x04e2=function(_0x418549,_0x11b13d){_0x418549=_0x418549-0x0;var _0x288826=_0x4e20[_0x418549];return _0x288826;};'use strict';var multer=require(_0x04e2('0x0'));var util=require(_0x04e2('0x1'));var path=require(_0x04e2('0x2'));var timeout=require(_0x04e2('0x3'));var express=require(_0x04e2('0x4'));var router=express[_0x04e2('0x5')]();var fs_extra=require(_0x04e2('0x6'));var auth=require(_0x04e2('0x7'));var interaction=require(_0x04e2('0x8'));var config=require(_0x04e2('0x9'));var controller=require('./intServicenowField.controller');router[_0x04e2('0xa')]('/',auth[_0x04e2('0xb')](),controller[_0x04e2('0xc')]);router[_0x04e2('0xa')](_0x04e2('0xd'),auth[_0x04e2('0xb')](),controller[_0x04e2('0xe')]);router[_0x04e2('0xf')]('/',auth[_0x04e2('0xb')](),controller['create']);router[_0x04e2('0x10')](_0x04e2('0xd'),auth[_0x04e2('0xb')](),controller[_0x04e2('0x11')]);router[_0x04e2('0x12')](_0x04e2('0xd'),auth[_0x04e2('0xb')](),controller[_0x04e2('0x13')]);module[_0x04e2('0x14')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 0340f74..fbf8e89 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 _0x9224=['ENUM','string','variable','keyValue','STRING','customVariable','BOOLEAN','exports'];(function(_0x5c0f6b,_0xda7bfa){var _0x14ebd1=function(_0x4479a8){while(--_0x4479a8){_0x5c0f6b['push'](_0x5c0f6b['shift']());}};_0x14ebd1(++_0xda7bfa);}(_0x9224,0x6f));var _0x4922=function(_0x242ef3,_0x5b4e98){_0x242ef3=_0x242ef3-0x0;var _0x15bdfd=_0x9224[_0x242ef3];return _0x15bdfd;};'use strict';var Sequelize=require('sequelize');module[_0x4922('0x0')]={'type':{'type':Sequelize[_0x4922('0x1')](_0x4922('0x2'),_0x4922('0x3'),'customVariable',_0x4922('0x4'),'picklist'),'defaultValue':_0x4922('0x2')},'content':{'type':Sequelize[_0x4922('0x5')]},'key':{'type':Sequelize[_0x4922('0x5')]},'keyType':{'type':Sequelize[_0x4922('0x1')](_0x4922('0x2'),_0x4922('0x3'),_0x4922('0x6'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x4922('0x5')]},'customField':{'type':Sequelize[_0x4922('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4922('0x5')]}}; \ No newline at end of file +var _0x5b42=['keyValue','picklist','STRING','customVariable','BOOLEAN','sequelize','exports','ENUM','string','variable'];(function(_0x4145ed,_0x1965e3){var _0x2294a6=function(_0x21c3bb){while(--_0x21c3bb){_0x4145ed['push'](_0x4145ed['shift']());}};_0x2294a6(++_0x1965e3);}(_0x5b42,0x1a9));var _0x25b4=function(_0x28112e,_0x507134){_0x28112e=_0x28112e-0x0;var _0x133881=_0x5b42[_0x28112e];return _0x133881;};'use strict';var Sequelize=require(_0x25b4('0x0'));module[_0x25b4('0x1')]={'type':{'type':Sequelize[_0x25b4('0x2')](_0x25b4('0x3'),_0x25b4('0x4'),'customVariable',_0x25b4('0x5'),_0x25b4('0x6')),'defaultValue':_0x25b4('0x3')},'content':{'type':Sequelize[_0x25b4('0x7')]},'key':{'type':Sequelize[_0x25b4('0x7')]},'keyType':{'type':Sequelize[_0x25b4('0x2')]('string','variable',_0x25b4('0x8'))},'keyContent':{'type':Sequelize[_0x25b4('0x7')]},'idField':{'type':Sequelize[_0x25b4('0x7')]},'nameField':{'type':Sequelize[_0x25b4('0x7')]},'customField':{'type':Sequelize[_0x25b4('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 5a95f56..fbdaac7 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 _0x2a55=['../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','limit','Content-Range','apply','reject','update','then','error','stack','name','map','fieldName','type','key','model','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','ServicenowField','includeAll','findAll','rows','show','params','rawAttributes','include','create','body','catch','find','zip-dir','fast-json-patch','request-promise','util','path','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x6c0123,_0x4c8d3b){var _0x5a87d2=function(_0x1ff614){while(--_0x1ff614){_0x6c0123['push'](_0x6c0123['shift']());}};_0x5a87d2(++_0x4c8d3b);}(_0x2a55,0xfd));var _0x52a5=function(_0x48cc96,_0x242d75){_0x48cc96=_0x48cc96-0x0;var _0x5cd2d0=_0x2a55[_0x48cc96];return _0x5cd2d0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x52a5('0x0'));var jsonpatch=require(_0x52a5('0x1'));var rp=require(_0x52a5('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x52a5('0x3'));var path=require(_0x52a5('0x4'));var sox=require('sox');var csv=require(_0x52a5('0x5'));var ejs=require(_0x52a5('0x6'));var fs=require('fs');var fs_extra=require(_0x52a5('0x7'));var _=require(_0x52a5('0x8'));var squel=require('squel');var crypto=require(_0x52a5('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x52a5('0xa'));var toCsv=require(_0x52a5('0x5'));var querystring=require('querystring');var Papa=require(_0x52a5('0xb'));var Redis=require(_0x52a5('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x52a5('0xd'));var as=require(_0x52a5('0xe'));var hardwareService=require(_0x52a5('0xf'));var logger=require(_0x52a5('0x10'))('api');var utils=require(_0x52a5('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x52a5('0x12'));var db=require(_0x52a5('0x13'))['db'];function respondWithStatusCode(_0x3434fa,_0x332628){_0x332628=_0x332628||0xcc;return function(_0x11cb0c){if(_0x11cb0c){return _0x3434fa[_0x52a5('0x14')](_0x332628);}return _0x3434fa[_0x52a5('0x15')](_0x332628)['end']();};}function respondWithResult(_0x9c4fdb,_0x47cb85){_0x47cb85=_0x47cb85||0xc8;return function(_0x5d476d){if(_0x5d476d){return _0x9c4fdb[_0x52a5('0x15')](_0x47cb85)['json'](_0x5d476d);}};}function respondWithFilteredResult(_0x2e9555,_0xe6f330){return function(_0x31cc8b){if(_0x31cc8b){var _0x5ad670=typeof _0xe6f330[_0x52a5('0x16')]===_0x52a5('0x17')&&typeof _0xe6f330['limit']==='undefined';var _0x4e2148=_0x31cc8b[_0x52a5('0x18')];var _0x17bced=_0x5ad670?0x0:_0xe6f330[_0x52a5('0x16')];var _0x9ec104=_0x5ad670?_0x31cc8b[_0x52a5('0x18')]:_0xe6f330['offset']+_0xe6f330[_0x52a5('0x19')];var _0x105b9a;if(_0x9ec104>=_0x4e2148){_0x9ec104=_0x4e2148;_0x105b9a=0xc8;}else{_0x105b9a=0xce;}_0x2e9555[_0x52a5('0x15')](_0x105b9a);return _0x2e9555['set'](_0x52a5('0x1a'),_0x17bced+'-'+_0x9ec104+'/'+_0x4e2148)['json'](_0x31cc8b);}return null;};}function patchUpdates(_0x2be95b){return function(_0x430731){try{jsonpatch[_0x52a5('0x1b')](_0x430731,_0x2be95b,!![]);}catch(_0x2a70b3){return BPromise[_0x52a5('0x1c')](_0x2a70b3);}return _0x430731['save']();};}function saveUpdates(_0x5c7e27,_0x29fea5){return function(_0x40b3db){if(_0x40b3db){return _0x40b3db[_0x52a5('0x1d')](_0x5c7e27)[_0x52a5('0x1e')](function(_0x23d0eb){return _0x23d0eb;});}return null;};}function removeEntity(_0x4576d4,_0x3fe22c){return function(_0x2dd042){if(_0x2dd042){return _0x2dd042['destroy']()[_0x52a5('0x1e')](function(){_0x4576d4[_0x52a5('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5d5349,_0xe1ff79){return function(_0x389865){if(!_0x389865){_0x5d5349[_0x52a5('0x14')](0x194);}return _0x389865;};}function handleError(_0x90bc47,_0x1bed75){_0x1bed75=_0x1bed75||0x1f4;return function(_0x3c4240){logger[_0x52a5('0x1f')](_0x3c4240[_0x52a5('0x20')]);if(_0x3c4240[_0x52a5('0x21')]){delete _0x3c4240[_0x52a5('0x21')];}_0x90bc47[_0x52a5('0x15')](_0x1bed75)['send'](_0x3c4240);};}exports['index']=function(_0x139eb4,_0x14ae10){var _0x519083={},_0x26572c={},_0xaba531={'count':0x0,'rows':[]};var _0x3c0734=_[_0x52a5('0x22')](db['ServicenowField']['rawAttributes'],function(_0x2b0dea){return{'name':_0x2b0dea[_0x52a5('0x23')],'type':_0x2b0dea[_0x52a5('0x24')][_0x52a5('0x25')]};});_0x26572c[_0x52a5('0x26')]=_['map'](_0x3c0734,_0x52a5('0x21'));_0x26572c['query']=_[_0x52a5('0x27')](_0x139eb4[_0x52a5('0x28')]);_0x26572c['filters']=_[_0x52a5('0x29')](_0x26572c[_0x52a5('0x26')],_0x26572c[_0x52a5('0x28')]);_0x519083[_0x52a5('0x2a')]=_['intersection'](_0x26572c[_0x52a5('0x26')],qs[_0x52a5('0x2b')](_0x139eb4['query']['fields']));_0x519083[_0x52a5('0x2a')]=_0x519083['attributes']['length']?_0x519083[_0x52a5('0x2a')]:_0x26572c[_0x52a5('0x26')];if(!_0x139eb4[_0x52a5('0x28')][_0x52a5('0x2c')](_0x52a5('0x2d'))){_0x519083[_0x52a5('0x19')]=qs['limit'](_0x139eb4[_0x52a5('0x28')][_0x52a5('0x19')]);_0x519083[_0x52a5('0x16')]=qs[_0x52a5('0x16')](_0x139eb4[_0x52a5('0x28')][_0x52a5('0x16')]);}_0x519083[_0x52a5('0x2e')]=qs[_0x52a5('0x2f')](_0x139eb4['query'][_0x52a5('0x2f')]);_0x519083[_0x52a5('0x30')]=qs[_0x52a5('0x31')](_[_0x52a5('0x32')](_0x139eb4[_0x52a5('0x28')],_0x26572c[_0x52a5('0x31')]),_0x3c0734);if(_0x139eb4[_0x52a5('0x28')][_0x52a5('0x33')]){_0x519083[_0x52a5('0x30')]=_[_0x52a5('0x34')](_0x519083['where'],{'$or':_[_0x52a5('0x22')](_0x3c0734,function(_0xfaf8c3){if(_0xfaf8c3[_0x52a5('0x24')]!==_0x52a5('0x35')){var _0x3f2bb9={};_0x3f2bb9[_0xfaf8c3['name']]={'$like':'%'+_0x139eb4[_0x52a5('0x28')][_0x52a5('0x33')]+'%'};return _0x3f2bb9;}})});}_0x519083=_[_0x52a5('0x34')]({},_0x519083,_0x139eb4[_0x52a5('0x36')]);var _0x48af77={'where':_0x519083['where']};return db[_0x52a5('0x37')][_0x52a5('0x18')](_0x48af77)[_0x52a5('0x1e')](function(_0x125f5a){_0xaba531[_0x52a5('0x18')]=_0x125f5a;if(_0x139eb4[_0x52a5('0x28')][_0x52a5('0x38')]){_0x519083['include']=[{'all':!![]}];}return db[_0x52a5('0x37')][_0x52a5('0x39')](_0x519083);})[_0x52a5('0x1e')](function(_0x5b06e6){_0xaba531[_0x52a5('0x3a')]=_0x5b06e6;return _0xaba531;})[_0x52a5('0x1e')](respondWithFilteredResult(_0x14ae10,_0x519083))['catch'](handleError(_0x14ae10,null));};exports[_0x52a5('0x3b')]=function(_0x3c0779,_0x17a1ec){var _0x5b6c4b={'raw':!![],'where':{'id':_0x3c0779[_0x52a5('0x3c')]['id']}},_0x5abc29={};_0x5abc29[_0x52a5('0x26')]=_[_0x52a5('0x27')](db[_0x52a5('0x37')][_0x52a5('0x3d')]);_0x5abc29['query']=_['keys'](_0x3c0779['query']);_0x5abc29['filters']=_['intersection'](_0x5abc29[_0x52a5('0x26')],_0x5abc29[_0x52a5('0x28')]);_0x5b6c4b[_0x52a5('0x2a')]=_[_0x52a5('0x29')](_0x5abc29[_0x52a5('0x26')],qs['fields'](_0x3c0779['query'][_0x52a5('0x2b')]));_0x5b6c4b[_0x52a5('0x2a')]=_0x5b6c4b[_0x52a5('0x2a')]['length']?_0x5b6c4b[_0x52a5('0x2a')]:_0x5abc29[_0x52a5('0x26')];if(_0x3c0779['query'][_0x52a5('0x38')]){_0x5b6c4b[_0x52a5('0x3e')]=[{'all':!![]}];}_0x5b6c4b=_[_0x52a5('0x34')]({},_0x5b6c4b,_0x3c0779[_0x52a5('0x36')]);return db[_0x52a5('0x37')]['find'](_0x5b6c4b)[_0x52a5('0x1e')](handleEntityNotFound(_0x17a1ec,null))[_0x52a5('0x1e')](respondWithResult(_0x17a1ec,null))['catch'](handleError(_0x17a1ec,null));};exports[_0x52a5('0x3f')]=function(_0x304e2c,_0x204b16){return db['ServicenowField'][_0x52a5('0x3f')](_0x304e2c[_0x52a5('0x40')],{})[_0x52a5('0x1e')](respondWithResult(_0x204b16,0xc9))[_0x52a5('0x41')](handleError(_0x204b16,null));};exports[_0x52a5('0x1d')]=function(_0x15ae86,_0x4aef54){if(_0x15ae86[_0x52a5('0x40')]['id']){delete _0x15ae86['body']['id'];}return db['ServicenowField'][_0x52a5('0x42')]({'where':{'id':_0x15ae86[_0x52a5('0x3c')]['id']}})[_0x52a5('0x1e')](handleEntityNotFound(_0x4aef54,null))[_0x52a5('0x1e')](saveUpdates(_0x15ae86[_0x52a5('0x40')],null))[_0x52a5('0x1e')](respondWithResult(_0x4aef54,null))[_0x52a5('0x41')](handleError(_0x4aef54,null));};exports['destroy']=function(_0x567d46,_0x1db05c){return db['ServicenowField'][_0x52a5('0x42')]({'where':{'id':_0x567d46['params']['id']}})['then'](handleEntityNotFound(_0x1db05c,null))['then'](removeEntity(_0x1db05c,null))[_0x52a5('0x41')](handleError(_0x1db05c,null));}; \ No newline at end of file +var _0x58d0=['query','filters','attributes','fields','length','order','sort','pick','filter','where','merge','map','VIRTUAL','options','findAll','rows','catch','params','includeAll','find','create','body','eml-format','rimraf','fast-json-patch','moment','mustache','util','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','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','ServicenowField','rawAttributes','fieldName','type','model','keys'];(function(_0x54129c,_0x4be058){var _0x250fff=function(_0x2ef882){while(--_0x2ef882){_0x54129c['push'](_0x54129c['shift']());}};_0x250fff(++_0x4be058);}(_0x58d0,0xa4));var _0x058d=function(_0x471755,_0x49b2d4){_0x471755=_0x471755-0x0;var _0x577fc2=_0x58d0[_0x471755];return _0x577fc2;};'use strict';var emlformat=require(_0x058d('0x0'));var rimraf=require(_0x058d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x058d('0x2'));var rp=require('request-promise');var moment=require(_0x058d('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x058d('0x4'));var util=require(_0x058d('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x058d('0x6'));var ejs=require(_0x058d('0x7'));var fs=require('fs');var fs_extra=require(_0x058d('0x8'));var _=require(_0x058d('0x9'));var squel=require(_0x058d('0xa'));var crypto=require(_0x058d('0xb'));var jsforce=require(_0x058d('0xc'));var deskjs=require(_0x058d('0xd'));var toCsv=require(_0x058d('0x6'));var querystring=require(_0x058d('0xe'));var Papa=require(_0x058d('0xf'));var Redis=require('ioredis');var authService=require(_0x058d('0x10'));var qs=require(_0x058d('0x11'));var as=require(_0x058d('0x12'));var hardwareService=require(_0x058d('0x13'));var logger=require('../../config/logger')(_0x058d('0x14'));var utils=require(_0x058d('0x15'));var config=require(_0x058d('0x16'));var licenseUtil=require(_0x058d('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4d14f0,_0x471f0f){_0x471f0f=_0x471f0f||0xcc;return function(_0x38f9b2){if(_0x38f9b2){return _0x4d14f0[_0x058d('0x18')](_0x471f0f);}return _0x4d14f0[_0x058d('0x19')](_0x471f0f)['end']();};}function respondWithResult(_0x37c7b9,_0x4eb356){_0x4eb356=_0x4eb356||0xc8;return function(_0x2726c2){if(_0x2726c2){return _0x37c7b9[_0x058d('0x19')](_0x4eb356)[_0x058d('0x1a')](_0x2726c2);}};}function respondWithFilteredResult(_0x4f33fe,_0x9c372d){return function(_0x1528f7){if(_0x1528f7){var _0x587683=typeof _0x9c372d['offset']===_0x058d('0x1b')&&typeof _0x9c372d[_0x058d('0x1c')]===_0x058d('0x1b');var _0x3177d7=_0x1528f7[_0x058d('0x1d')];var _0x24cc34=_0x587683?0x0:_0x9c372d[_0x058d('0x1e')];var _0x237bab=_0x587683?_0x1528f7[_0x058d('0x1d')]:_0x9c372d[_0x058d('0x1e')]+_0x9c372d[_0x058d('0x1c')];var _0x5b6a9e;if(_0x237bab>=_0x3177d7){_0x237bab=_0x3177d7;_0x5b6a9e=0xc8;}else{_0x5b6a9e=0xce;}_0x4f33fe[_0x058d('0x19')](_0x5b6a9e);return _0x4f33fe['set'](_0x058d('0x1f'),_0x24cc34+'-'+_0x237bab+'/'+_0x3177d7)[_0x058d('0x1a')](_0x1528f7);}return null;};}function patchUpdates(_0x3252c7){return function(_0x270245){try{jsonpatch[_0x058d('0x20')](_0x270245,_0x3252c7,!![]);}catch(_0x15b447){return BPromise[_0x058d('0x21')](_0x15b447);}return _0x270245[_0x058d('0x22')]();};}function saveUpdates(_0x1c0a32,_0x58d948){return function(_0x322cd1){if(_0x322cd1){return _0x322cd1[_0x058d('0x23')](_0x1c0a32)[_0x058d('0x24')](function(_0x142998){return _0x142998;});}return null;};}function removeEntity(_0x4919b5,_0x23346d){return function(_0x5e9417){if(_0x5e9417){return _0x5e9417[_0x058d('0x25')]()['then'](function(){_0x4919b5[_0x058d('0x19')](0xcc)[_0x058d('0x26')]();});}};}function handleEntityNotFound(_0x3c43eb,_0x541238){return function(_0x19c072){if(!_0x19c072){_0x3c43eb[_0x058d('0x18')](0x194);}return _0x19c072;};}function handleError(_0x14b42a,_0x35e88e){_0x35e88e=_0x35e88e||0x1f4;return function(_0x2fa059){logger[_0x058d('0x27')](_0x2fa059['stack']);if(_0x2fa059[_0x058d('0x28')]){delete _0x2fa059[_0x058d('0x28')];}_0x14b42a[_0x058d('0x19')](_0x35e88e)[_0x058d('0x29')](_0x2fa059);};}exports[_0x058d('0x2a')]=function(_0x4805ef,_0x58c577){var _0x20e613={},_0x5bd135={},_0x19343b={'count':0x0,'rows':[]};var _0x41069f=_['map'](db[_0x058d('0x2b')][_0x058d('0x2c')],function(_0x1e8b11){return{'name':_0x1e8b11[_0x058d('0x2d')],'type':_0x1e8b11[_0x058d('0x2e')]['key']};});_0x5bd135[_0x058d('0x2f')]=_['map'](_0x41069f,'name');_0x5bd135['query']=_[_0x058d('0x30')](_0x4805ef[_0x058d('0x31')]);_0x5bd135[_0x058d('0x32')]=_['intersection'](_0x5bd135[_0x058d('0x2f')],_0x5bd135[_0x058d('0x31')]);_0x20e613[_0x058d('0x33')]=_['intersection'](_0x5bd135[_0x058d('0x2f')],qs['fields'](_0x4805ef[_0x058d('0x31')][_0x058d('0x34')]));_0x20e613[_0x058d('0x33')]=_0x20e613[_0x058d('0x33')][_0x058d('0x35')]?_0x20e613[_0x058d('0x33')]:_0x5bd135[_0x058d('0x2f')];if(!_0x4805ef[_0x058d('0x31')]['hasOwnProperty']('nolimit')){_0x20e613[_0x058d('0x1c')]=qs[_0x058d('0x1c')](_0x4805ef['query'][_0x058d('0x1c')]);_0x20e613[_0x058d('0x1e')]=qs[_0x058d('0x1e')](_0x4805ef['query'][_0x058d('0x1e')]);}_0x20e613[_0x058d('0x36')]=qs['sort'](_0x4805ef[_0x058d('0x31')][_0x058d('0x37')]);_0x20e613['where']=qs[_0x058d('0x32')](_[_0x058d('0x38')](_0x4805ef[_0x058d('0x31')],_0x5bd135['filters']),_0x41069f);if(_0x4805ef['query'][_0x058d('0x39')]){_0x20e613[_0x058d('0x3a')]=_[_0x058d('0x3b')](_0x20e613['where'],{'$or':_[_0x058d('0x3c')](_0x41069f,function(_0xa0da10){if(_0xa0da10[_0x058d('0x2e')]!==_0x058d('0x3d')){var _0x46b6d3={};_0x46b6d3[_0xa0da10[_0x058d('0x28')]]={'$like':'%'+_0x4805ef[_0x058d('0x31')][_0x058d('0x39')]+'%'};return _0x46b6d3;}})});}_0x20e613=_[_0x058d('0x3b')]({},_0x20e613,_0x4805ef[_0x058d('0x3e')]);var _0x1ffdab={'where':_0x20e613['where']};return db[_0x058d('0x2b')][_0x058d('0x1d')](_0x1ffdab)[_0x058d('0x24')](function(_0x1e064a){_0x19343b[_0x058d('0x1d')]=_0x1e064a;if(_0x4805ef[_0x058d('0x31')]['includeAll']){_0x20e613['include']=[{'all':!![]}];}return db[_0x058d('0x2b')][_0x058d('0x3f')](_0x20e613);})[_0x058d('0x24')](function(_0x138981){_0x19343b[_0x058d('0x40')]=_0x138981;return _0x19343b;})[_0x058d('0x24')](respondWithFilteredResult(_0x58c577,_0x20e613))[_0x058d('0x41')](handleError(_0x58c577,null));};exports['show']=function(_0x147053,_0x560fcc){var _0x52f4df={'raw':!![],'where':{'id':_0x147053[_0x058d('0x42')]['id']}},_0x35f8c6={};_0x35f8c6[_0x058d('0x2f')]=_[_0x058d('0x30')](db['ServicenowField'][_0x058d('0x2c')]);_0x35f8c6[_0x058d('0x31')]=_['keys'](_0x147053[_0x058d('0x31')]);_0x35f8c6['filters']=_['intersection'](_0x35f8c6[_0x058d('0x2f')],_0x35f8c6[_0x058d('0x31')]);_0x52f4df[_0x058d('0x33')]=_['intersection'](_0x35f8c6[_0x058d('0x2f')],qs[_0x058d('0x34')](_0x147053['query'][_0x058d('0x34')]));_0x52f4df[_0x058d('0x33')]=_0x52f4df[_0x058d('0x33')]['length']?_0x52f4df[_0x058d('0x33')]:_0x35f8c6[_0x058d('0x2f')];if(_0x147053['query'][_0x058d('0x43')]){_0x52f4df['include']=[{'all':!![]}];}_0x52f4df=_[_0x058d('0x3b')]({},_0x52f4df,_0x147053['options']);return db[_0x058d('0x2b')][_0x058d('0x44')](_0x52f4df)[_0x058d('0x24')](handleEntityNotFound(_0x560fcc,null))[_0x058d('0x24')](respondWithResult(_0x560fcc,null))[_0x058d('0x41')](handleError(_0x560fcc,null));};exports[_0x058d('0x45')]=function(_0x2a5116,_0x18e1f5){return db[_0x058d('0x2b')][_0x058d('0x45')](_0x2a5116[_0x058d('0x46')],{})[_0x058d('0x24')](respondWithResult(_0x18e1f5,0xc9))[_0x058d('0x41')](handleError(_0x18e1f5,null));};exports['update']=function(_0x3b4df8,_0x6681d3){if(_0x3b4df8[_0x058d('0x46')]['id']){delete _0x3b4df8[_0x058d('0x46')]['id'];}return db[_0x058d('0x2b')][_0x058d('0x44')]({'where':{'id':_0x3b4df8['params']['id']}})[_0x058d('0x24')](handleEntityNotFound(_0x6681d3,null))[_0x058d('0x24')](saveUpdates(_0x3b4df8[_0x058d('0x46')],null))[_0x058d('0x24')](respondWithResult(_0x6681d3,null))[_0x058d('0x41')](handleError(_0x6681d3,null));};exports['destroy']=function(_0x4c9b5a,_0x1c81bf){return db[_0x058d('0x2b')]['find']({'where':{'id':_0x4c9b5a['params']['id']}})[_0x058d('0x24')](handleEntityNotFound(_0x1c81bf,null))[_0x058d('0x24')](removeEntity(_0x1c81bf,null))['catch'](handleError(_0x1c81bf,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 117e253..18f98c2 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 _0xb4bf=['request-promise','rimraf','./intServicenowField.attributes','exports','define','int_servicenow_fields','servicenow_unique_index','idField','lodash','../../config/logger','api','moment','bluebird'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xb4bf,0xcb));var _0xfb4b=function(_0x243b2f,_0x30aa15){_0x243b2f=_0x243b2f-0x0;var _0xcb3c2d=_0xb4bf[_0x243b2f];return _0xcb3c2d;};'use strict';var _=require(_0xfb4b('0x0'));var util=require('util');var logger=require(_0xfb4b('0x1'))(_0xfb4b('0x2'));var moment=require(_0xfb4b('0x3'));var BPromise=require(_0xfb4b('0x4'));var rp=require(_0xfb4b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfb4b('0x6'));var config=require('../../config/environment');var attributes=require(_0xfb4b('0x7'));module[_0xfb4b('0x8')]=function(_0x3663b3,_0x23ddcc){return _0x3663b3[_0xfb4b('0x9')]('ServicenowField',attributes,{'tableName':_0xfb4b('0xa'),'paranoid':![],'indexes':[{'name':_0xfb4b('0xb'),'fields':[_0xfb4b('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xeb9a=['bluebird','request-promise','path','rimraf','../../config/environment','exports','ServicenowField','int_servicenow_fields','idField','FieldId','lodash','util','api','moment'];(function(_0x147078,_0x4e509c){var _0x2d2f5c=function(_0x231582){while(--_0x231582){_0x147078['push'](_0x147078['shift']());}};_0x2d2f5c(++_0x4e509c);}(_0xeb9a,0xce));var _0xaeb9=function(_0x35885a,_0x42fed7){_0x35885a=_0x35885a-0x0;var _0xe86249=_0xeb9a[_0x35885a];return _0xe86249;};'use strict';var _=require(_0xaeb9('0x0'));var util=require(_0xaeb9('0x1'));var logger=require('../../config/logger')(_0xaeb9('0x2'));var moment=require(_0xaeb9('0x3'));var BPromise=require(_0xaeb9('0x4'));var rp=require(_0xaeb9('0x5'));var fs=require('fs');var path=require(_0xaeb9('0x6'));var rimraf=require(_0xaeb9('0x7'));var config=require(_0xaeb9('0x8'));var attributes=require('./intServicenowField.attributes');module[_0xaeb9('0x9')]=function(_0x9ebf47,_0x2c43a8){return _0x9ebf47['define'](_0xaeb9('0xa'),attributes,{'tableName':_0xaeb9('0xb'),'paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':[_0xaeb9('0xc'),_0xaeb9('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 f0a3a3d..ba260a6 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 _0xcb91=['stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s'];(function(_0x2cb826,_0x18e31d){var _0x478859=function(_0x341505){while(--_0x341505){_0x2cb826['push'](_0x2cb826['shift']());}};_0x478859(++_0x18e31d);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2aa0e7,_0x4e5145){_0x2aa0e7=_0x2aa0e7-0x0;var _0x1472c0=_0xcb91[_0x2aa0e7];return _0x1472c0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var BPromise=require(_0x1cb9('0x1'));var rs=require(_0x1cb9('0x2'));var fs=require('fs');var Redis=require(_0x1cb9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('rpc');var config=require(_0x1cb9('0x6'));var jayson=require(_0x1cb9('0x7'));var client=jayson['client'][_0x1cb9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f7deb,_0x4ffe20,_0x38737d){return new BPromise(function(_0x12567c,_0x59d1be){return client[_0x1cb9('0x9')](_0x3f7deb,_0x38737d)['then'](function(_0x567139){logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,_0x1cb9('0xc'));logger[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x4ffe20,'request\x20sent',JSON[_0x1cb9('0xf')](_0x567139));if(_0x567139[_0x1cb9('0x10')]){if(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x11')]===0x1f4){logger[_0x1cb9('0x10')]('ServicenowField,\x20%s,\x20%s',_0x4ffe20,_0x567139['error']['message']);return _0x59d1be(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x567139['error'][_0x1cb9('0x12')]);return _0x12567c(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}else{logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,'request\x20sent');_0x12567c(_0x567139['result'][_0x1cb9('0x12')]);}})[_0x1cb9('0x13')](function(_0x3904b7){logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x3904b7);_0x59d1be(_0x3904b7);});});} \ No newline at end of file +var _0xda3f=['rpc','jayson/promise','client','request','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','../../mysqldb','../../config/logger'];(function(_0xcfe8cc,_0xb83aeb){var _0x55ac53=function(_0x4067d4){while(--_0x4067d4){_0xcfe8cc['push'](_0xcfe8cc['shift']());}};_0x55ac53(++_0xb83aeb);}(_0xda3f,0xec));var _0xfda3=function(_0x41a28a,_0x3e07c6){_0x41a28a=_0x41a28a-0x0;var _0x10f439=_0xda3f[_0x41a28a];return _0x10f439;};'use strict';var _=require('lodash');var util=require(_0xfda3('0x0'));var moment=require(_0xfda3('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfda3('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xfda3('0x3'))(_0xfda3('0x4'));var config=require('../../config/environment');var jayson=require(_0xfda3('0x5'));var client=jayson[_0xfda3('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e72d1,_0x316792,_0x42476a){return new BPromise(function(_0x125e2a,_0x4018c0){return client[_0xfda3('0x7')](_0x4e72d1,_0x42476a)[_0xfda3('0x8')](function(_0x46655c){logger[_0xfda3('0x9')](_0xfda3('0xa'),_0x316792,_0xfda3('0xb'));logger[_0xfda3('0xc')](_0xfda3('0xd'),_0x316792,'request\x20sent',JSON[_0xfda3('0xe')](_0x46655c));if(_0x46655c[_0xfda3('0xf')]){if(_0x46655c[_0xfda3('0xf')][_0xfda3('0x10')]===0x1f4){logger[_0xfda3('0xf')]('ServicenowField,\x20%s,\x20%s',_0x316792,_0x46655c[_0xfda3('0xf')]['message']);return _0x4018c0(_0x46655c[_0xfda3('0xf')][_0xfda3('0x11')]);}logger['error']('ServicenowField,\x20%s,\x20%s',_0x316792,_0x46655c['error'][_0xfda3('0x11')]);return _0x125e2a(_0x46655c[_0xfda3('0xf')]['message']);}else{logger['info']('ServicenowField,\x20%s,\x20%s',_0x316792,_0xfda3('0xb'));_0x125e2a(_0x46655c[_0xfda3('0x12')][_0xfda3('0x11')]);}})[_0xfda3('0x13')](function(_0x34900d){logger[_0xfda3('0xf')](_0xfda3('0xa'),_0x316792,_0x34900d);_0x4018c0(_0x34900d);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index b861baa..32e7855 100644 --- a/server/api/intSugarcrmAccount/index.js +++ b/server/api/intSugarcrmAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x360fc3,_0x437e0e){var _0x40f7de=function(_0x577373){while(--_0x577373){_0x360fc3['push'](_0x360fc3['shift']());}};_0x40f7de(++_0x437e0e);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x1cc25d,_0x561ead){var _0x478120=function(_0x57a7b1){while(--_0x57a7b1){_0x1cc25d['push'](_0x1cc25d['shift']());}};_0x478120(++_0x561ead);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 653a43c..d41ac5e 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(_0x2b4367,_0x469e89){var _0x3d5858=function(_0x81198b){while(--_0x81198b){_0x2b4367['push'](_0x2b4367['shift']());}};_0x3d5858(++_0x469e89);}(_0xa9e0,0x123));var _0x0a9e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xa9e0[_0x38a7ac];return _0x53061a;};'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(_0x174e72,_0x565e88){var _0x35f570=function(_0x422147){while(--_0x422147){_0x174e72['push'](_0x174e72['shift']());}};_0x35f570(++_0x565e88);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'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 bb964aa..87d5da7 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 _0x36f9=['../../components/integrations/configuration','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','destroy','stack','name','index','SugarcrmAccount','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','map','VIRTUAL','includeAll','findAll','rows','catch','show','params','options','find','create','body','findOne','SugarcrmConfiguration','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','SugarcrmField','getFields','assigned_user_id','created_by','date_start','duration_hours','duration_minutes','parent_id','parent_name','username','password','remoteUri','slice','substring','POST','format','%s%s','/service/v4_1/rest.php','JSON','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','Calls','values','module_fields','remove','value','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','sox','ejs','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x2c42ad,_0x42638a){var _0x49cbbc=function(_0x1801a1){while(--_0x1801a1){_0x2c42ad['push'](_0x2c42ad['shift']());}};_0x49cbbc(++_0x42638a);}(_0x36f9,0xd8));var _0x936f=function(_0x3b6fa5,_0x45406a){_0x3b6fa5=_0x3b6fa5-0x0;var _0x2ed929=_0x36f9[_0x3b6fa5];return _0x2ed929;};'use strict';var emlformat=require(_0x936f('0x0'));var rimraf=require(_0x936f('0x1'));var zipdir=require(_0x936f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x936f('0x3'));var moment=require(_0x936f('0x4'));var BPromise=require(_0x936f('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x936f('0x6'));var csv=require('to-csv');var ejs=require(_0x936f('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x936f('0x8'));var squel=require('squel');var crypto=require(_0x936f('0x9'));var jsforce=require(_0x936f('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x936f('0xb'));var querystring=require(_0x936f('0xc'));var Papa=require(_0x936f('0xd'));var Redis=require(_0x936f('0xe'));var authService=require(_0x936f('0xf'));var qs=require(_0x936f('0x10'));var as=require(_0x936f('0x11'));var hardwareService=require(_0x936f('0x12'));var logger=require(_0x936f('0x13'))(_0x936f('0x14'));var utils=require(_0x936f('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x936f('0x16'));var db=require(_0x936f('0x17'))['db'];var integrations=require(_0x936f('0x18'));function respondWithStatusCode(_0x4dad99,_0x112fb2){_0x112fb2=_0x112fb2||0xcc;return function(_0xf91e35){if(_0xf91e35){return _0x4dad99[_0x936f('0x19')](_0x112fb2);}return _0x4dad99['status'](_0x112fb2)[_0x936f('0x1a')]();};}function respondWithResult(_0x4ebc05,_0xdeafd9){_0xdeafd9=_0xdeafd9||0xc8;return function(_0x39321b){if(_0x39321b){return _0x4ebc05[_0x936f('0x1b')](_0xdeafd9)['json'](_0x39321b);}};}function respondWithFilteredResult(_0x2227f8,_0x33fc48){return function(_0x31d5fd){if(_0x31d5fd){var _0x46504f=typeof _0x33fc48[_0x936f('0x1c')]===_0x936f('0x1d')&&typeof _0x33fc48[_0x936f('0x1e')]===_0x936f('0x1d');var _0x22c20a=_0x31d5fd[_0x936f('0x1f')];var _0x4aa64a=_0x46504f?0x0:_0x33fc48[_0x936f('0x1c')];var _0x1565a7=_0x46504f?_0x31d5fd[_0x936f('0x1f')]:_0x33fc48[_0x936f('0x1c')]+_0x33fc48[_0x936f('0x1e')];var _0x1119f4;if(_0x1565a7>=_0x22c20a){_0x1565a7=_0x22c20a;_0x1119f4=0xc8;}else{_0x1119f4=0xce;}_0x2227f8[_0x936f('0x1b')](_0x1119f4);return _0x2227f8[_0x936f('0x20')](_0x936f('0x21'),_0x4aa64a+'-'+_0x1565a7+'/'+_0x22c20a)[_0x936f('0x22')](_0x31d5fd);}return null;};}function patchUpdates(_0x1c1361){return function(_0x123619){try{jsonpatch[_0x936f('0x23')](_0x123619,_0x1c1361,!![]);}catch(_0x81f670){return BPromise['reject'](_0x81f670);}return _0x123619[_0x936f('0x24')]();};}function saveUpdates(_0x4abe3a,_0xdcd5c8){return function(_0x5b32b9){if(_0x5b32b9){return _0x5b32b9[_0x936f('0x25')](_0x4abe3a)[_0x936f('0x26')](function(_0x104a64){return _0x104a64;});}return null;};}function removeEntity(_0x57034c,_0x24f657){return function(_0x31095a){if(_0x31095a){return _0x31095a[_0x936f('0x27')]()[_0x936f('0x26')](function(){_0x57034c[_0x936f('0x1b')](0xcc)[_0x936f('0x1a')]();});}};}function handleEntityNotFound(_0x7f97c9,_0x1853b8){return function(_0x32de85){if(!_0x32de85){_0x7f97c9[_0x936f('0x19')](0x194);}return _0x32de85;};}function handleError(_0x15bce1,_0x574a5c){_0x574a5c=_0x574a5c||0x1f4;return function(_0x4545e6){logger['error'](_0x4545e6[_0x936f('0x28')]);if(_0x4545e6[_0x936f('0x29')]){delete _0x4545e6[_0x936f('0x29')];}_0x15bce1['status'](_0x574a5c)['send'](_0x4545e6);};}exports[_0x936f('0x2a')]=function(_0x343db0,_0x262340){var _0x2eb5ce={},_0xe6c52a={},_0x12613f={'count':0x0,'rows':[]};var _0x579464=_['map'](db[_0x936f('0x2b')][_0x936f('0x2c')],function(_0x4585cb){return{'name':_0x4585cb[_0x936f('0x2d')],'type':_0x4585cb[_0x936f('0x2e')][_0x936f('0x2f')]};});_0xe6c52a[_0x936f('0x30')]=_['map'](_0x579464,_0x936f('0x29'));_0xe6c52a[_0x936f('0x31')]=_[_0x936f('0x32')](_0x343db0[_0x936f('0x31')]);_0xe6c52a['filters']=_[_0x936f('0x33')](_0xe6c52a[_0x936f('0x30')],_0xe6c52a[_0x936f('0x31')]);_0x2eb5ce[_0x936f('0x34')]=_['intersection'](_0xe6c52a[_0x936f('0x30')],qs[_0x936f('0x35')](_0x343db0[_0x936f('0x31')]['fields']));_0x2eb5ce[_0x936f('0x34')]=_0x2eb5ce['attributes'][_0x936f('0x36')]?_0x2eb5ce[_0x936f('0x34')]:_0xe6c52a[_0x936f('0x30')];if(!_0x343db0[_0x936f('0x31')][_0x936f('0x37')](_0x936f('0x38'))){_0x2eb5ce[_0x936f('0x1e')]=qs[_0x936f('0x1e')](_0x343db0['query'][_0x936f('0x1e')]);_0x2eb5ce[_0x936f('0x1c')]=qs[_0x936f('0x1c')](_0x343db0[_0x936f('0x31')][_0x936f('0x1c')]);}_0x2eb5ce[_0x936f('0x39')]=qs[_0x936f('0x3a')](_0x343db0[_0x936f('0x31')][_0x936f('0x3a')]);_0x2eb5ce[_0x936f('0x3b')]=qs['filters'](_[_0x936f('0x3c')](_0x343db0[_0x936f('0x31')],_0xe6c52a[_0x936f('0x3d')]),_0x579464);if(_0x343db0[_0x936f('0x31')][_0x936f('0x3e')]){_0x2eb5ce['where']=_[_0x936f('0x3f')](_0x2eb5ce[_0x936f('0x3b')],{'$or':_[_0x936f('0x40')](_0x579464,function(_0xd3701a){if(_0xd3701a[_0x936f('0x2e')]!==_0x936f('0x41')){var _0x4d9956={};_0x4d9956[_0xd3701a[_0x936f('0x29')]]={'$like':'%'+_0x343db0[_0x936f('0x31')][_0x936f('0x3e')]+'%'};return _0x4d9956;}})});}_0x2eb5ce=_['merge']({},_0x2eb5ce,_0x343db0['options']);var _0x56939b={'where':_0x2eb5ce[_0x936f('0x3b')]};return db['SugarcrmAccount'][_0x936f('0x1f')](_0x56939b)[_0x936f('0x26')](function(_0x3057dd){_0x12613f[_0x936f('0x1f')]=_0x3057dd;if(_0x343db0['query'][_0x936f('0x42')]){_0x2eb5ce['include']=[{'all':!![]}];}return db[_0x936f('0x2b')][_0x936f('0x43')](_0x2eb5ce);})[_0x936f('0x26')](function(_0x4eedae){_0x12613f[_0x936f('0x44')]=_0x4eedae;return _0x12613f;})[_0x936f('0x26')](respondWithFilteredResult(_0x262340,_0x2eb5ce))[_0x936f('0x45')](handleError(_0x262340,null));};exports[_0x936f('0x46')]=function(_0x2dfe76,_0x522221){var _0x4a0907={'raw':![],'where':{'id':_0x2dfe76[_0x936f('0x47')]['id']}},_0x12274c={};_0x12274c[_0x936f('0x30')]=_[_0x936f('0x32')](db[_0x936f('0x2b')]['rawAttributes']);_0x12274c[_0x936f('0x31')]=_['keys'](_0x2dfe76[_0x936f('0x31')]);_0x12274c['filters']=_['intersection'](_0x12274c[_0x936f('0x30')],_0x12274c[_0x936f('0x31')]);_0x4a0907[_0x936f('0x34')]=_[_0x936f('0x33')](_0x12274c[_0x936f('0x30')],qs[_0x936f('0x35')](_0x2dfe76[_0x936f('0x31')][_0x936f('0x35')]));_0x4a0907['attributes']=_0x4a0907[_0x936f('0x34')]['length']?_0x4a0907[_0x936f('0x34')]:_0x12274c['model'];if(_0x2dfe76[_0x936f('0x31')]['includeAll']){_0x4a0907['include']=[{'all':!![]}];}_0x4a0907=_[_0x936f('0x3f')]({},_0x4a0907,_0x2dfe76[_0x936f('0x48')]);return db['SugarcrmAccount'][_0x936f('0x49')](_0x4a0907)['then'](handleEntityNotFound(_0x522221,null))[_0x936f('0x26')](respondWithResult(_0x522221,null))[_0x936f('0x45')](handleError(_0x522221,null));};exports[_0x936f('0x4a')]=function(_0x22d7da,_0x1f0e3a){return db[_0x936f('0x2b')][_0x936f('0x4a')](_0x22d7da[_0x936f('0x4b')],{})[_0x936f('0x26')](respondWithResult(_0x1f0e3a,0xc9))[_0x936f('0x45')](handleError(_0x1f0e3a,null));};exports['update']=function(_0x42e9f6,_0x2e5048){if(_0x42e9f6['body']['id']){delete _0x42e9f6[_0x936f('0x4b')]['id'];}return db[_0x936f('0x2b')]['find']({'where':{'id':_0x42e9f6['params']['id']}})['then'](handleEntityNotFound(_0x2e5048,null))[_0x936f('0x26')](saveUpdates(_0x42e9f6[_0x936f('0x4b')],null))['then'](respondWithResult(_0x2e5048,null))[_0x936f('0x45')](handleError(_0x2e5048,null));};exports[_0x936f('0x27')]=function(_0x2faad2,_0xfc8842){return db[_0x936f('0x2b')][_0x936f('0x49')]({'where':{'id':_0x2faad2[_0x936f('0x47')]['id']}})['then'](handleEntityNotFound(_0xfc8842,null))[_0x936f('0x26')](removeEntity(_0xfc8842,null))[_0x936f('0x45')](handleError(_0xfc8842,null));};exports['getConfigurations']=function(_0x3e7e56,_0x255958,_0x59cc62){var _0x24bd37={};var _0x665166={};var _0x3c7993;var _0x248f29;return db[_0x936f('0x2b')][_0x936f('0x4c')]({'where':{'id':_0x3e7e56[_0x936f('0x47')]['id']}})[_0x936f('0x26')](handleEntityNotFound(_0x255958,null))[_0x936f('0x26')](function(_0xbbc7ac){if(_0xbbc7ac){_0x3c7993=_0xbbc7ac;_0x665166[_0x936f('0x30')]=_[_0x936f('0x32')](db[_0x936f('0x4d')]['rawAttributes']);_0x665166['query']=_[_0x936f('0x32')](_0x3e7e56[_0x936f('0x31')]);_0x665166['filters']=_[_0x936f('0x33')](_0x665166[_0x936f('0x30')],_0x665166[_0x936f('0x31')]);_0x24bd37[_0x936f('0x34')]=_['intersection'](_0x665166['model'],qs[_0x936f('0x35')](_0x3e7e56['query'][_0x936f('0x35')]));_0x24bd37['attributes']=_0x24bd37[_0x936f('0x34')][_0x936f('0x36')]?_0x24bd37['attributes']:_0x665166['model'];_0x24bd37['order']=qs[_0x936f('0x3a')](_0x3e7e56['query'][_0x936f('0x3a')]);_0x24bd37[_0x936f('0x3b')]=qs[_0x936f('0x3d')](_[_0x936f('0x3c')](_0x3e7e56[_0x936f('0x31')],_0x665166[_0x936f('0x3d')]));if(_0x3e7e56['query'][_0x936f('0x3e')]){_0x24bd37[_0x936f('0x3b')]=_['merge'](_0x24bd37[_0x936f('0x3b')],{'$or':_[_0x936f('0x40')](_0x24bd37[_0x936f('0x34')],function(_0x59cd68){var _0x15eb8f={};_0x15eb8f[_0x59cd68]={'$like':'%'+_0x3e7e56[_0x936f('0x31')]['filter']+'%'};return _0x15eb8f;})});}_0x24bd37=_[_0x936f('0x3f')]({},_0x24bd37,_0x3e7e56[_0x936f('0x48')]);return _0x3c7993[_0x936f('0x4e')](_0x24bd37);}})[_0x936f('0x26')](function(_0x454e83){if(_0x454e83){_0x248f29=_0x454e83[_0x936f('0x36')];if(!_0x3e7e56['query'][_0x936f('0x37')](_0x936f('0x38'))){_0x24bd37[_0x936f('0x1e')]=qs[_0x936f('0x1e')](_0x3e7e56[_0x936f('0x31')][_0x936f('0x1e')]);_0x24bd37['offset']=qs['offset'](_0x3e7e56['query'][_0x936f('0x1c')]);}return _0x3c7993[_0x936f('0x4e')](_0x24bd37);}})[_0x936f('0x26')](function(_0x9b861a){if(_0x9b861a){return _0x9b861a?{'count':_0x248f29,'rows':_0x9b861a}:null;}})['then'](respondWithResult(_0x255958,null))['catch'](handleError(_0x255958,null));};exports[_0x936f('0x4f')]=function(_0x28d3e9,_0x2277eb,_0xa7316d){if(_0x28d3e9[_0x936f('0x4b')]['id']){delete _0x28d3e9[_0x936f('0x4b')]['id'];}return db[_0x936f('0x2b')][_0x936f('0x4c')]({'where':{'id':_0x28d3e9[_0x936f('0x47')]['id']}})[_0x936f('0x26')](handleEntityNotFound(_0x2277eb,null))[_0x936f('0x26')](function(_0x88c31c){if(_0x88c31c){_0x28d3e9[_0x936f('0x4b')][_0x936f('0x50')]=_0x88c31c['id'];_0x28d3e9['body'][_0x936f('0x51')]=integrations[_0x936f('0x52')](_0x28d3e9[_0x936f('0x4b')][_0x936f('0x53')],_0x28d3e9['body'][_0x936f('0x2e')]);_0x28d3e9[_0x936f('0x4b')][_0x936f('0x54')]=integrations['getDescriptions'](_0x28d3e9['body'][_0x936f('0x53')],_0x28d3e9[_0x936f('0x4b')][_0x936f('0x2e')]);return db[_0x936f('0x4d')]['create'](_0x28d3e9[_0x936f('0x4b')],{'include':[{'model':db[_0x936f('0x55')],'as':_0x936f('0x51')},{'model':db['SugarcrmField'],'as':_0x936f('0x54')}]});}return null;})['then'](respondWithResult(_0x2277eb,null))[_0x936f('0x45')](handleError(_0x2277eb,null));};exports[_0x936f('0x56')]=function(_0x2c4f89,_0x54a252,_0x286b16){var _0x3a5213='';var _0x2153d3=['id',_0x936f('0x29'),_0x936f('0x57'),_0x936f('0x58'),'description',_0x936f('0x59'),_0x936f('0x5a'),_0x936f('0x5b'),_0x936f('0x5c'),'parent_type',_0x936f('0x5d'),'direction'];return db['SugarcrmAccount']['findOne']({'where':{'id':_0x2c4f89['params']['id']},'attributes':['id',_0x936f('0x5e'),_0x936f('0x5f'),_0x936f('0x60')]})[_0x936f('0x26')](handleEntityNotFound(_0x54a252,null))['then'](function(_0x21ccac){if(_0x21ccac){_0x3a5213=_0x21ccac[_0x936f('0x60')];var _0xbd4a6f=_0x3a5213[_0x936f('0x61')](-0x1);if(_0xbd4a6f==='/'){_0x3a5213=_0x3a5213[_0x936f('0x62')](0x0,_0x3a5213['lastIndexOf'](_0xbd4a6f));}return rp({'method':_0x936f('0x63'),'uri':util[_0x936f('0x64')](_0x936f('0x65'),_0x3a5213,_0x936f('0x66')),'json':!![],'form':{'method':'login','input_type':_0x936f('0x67'),'response_type':_0x936f('0x67'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x21ccac['username'],'password':_0x21ccac[_0x936f('0x5f')],'encryption':_0x936f('0x68')},'application':_0x936f('0x69')})}});}})[_0x936f('0x26')](function(_0x231ace){if(_0x231ace&&_0x231ace['name']!==_0x936f('0x6a')&&_0x231ace['name']!==_0x936f('0x6b')){return rp({'method':_0x936f('0x63'),'uri':util[_0x936f('0x64')]('%s%s',_0x3a5213,_0x936f('0x66')),'json':!![],'form':{'method':'get_module_fields','input_type':'JSON','response_type':'JSON','rest_data':JSON['stringify']({'session':_0x231ace['id'],'module_name':_0x936f('0x6c')})}})['then'](function(_0x40a0df){if(_0x40a0df){var _0x5a84f3=_[_0x936f('0x6d')](_0x40a0df[_0x936f('0x6e')]);_[_0x936f('0x6f')](_0x5a84f3,function(_0x2d4cfd){return _0x2153d3['includes'](_0x2d4cfd[_0x936f('0x29')]);});return{'count':_0x5a84f3[_0x936f('0x36')],'rows':_[_0x936f('0x40')](_0x5a84f3,function(_0x230cb5){return{'id':_0x230cb5[_0x936f('0x29')],'name':_0x230cb5['label'],'custom':_['endsWith'](_0x230cb5['name'],'_c')?!![]:![],'options':_0x230cb5[_0x936f('0x48')]?_['map'](_[_0x936f('0x6d')](_0x230cb5[_0x936f('0x48')]),function(_0x20a5b9){return{'name':_0x20a5b9[_0x936f('0x70')],'value':_0x20a5b9[_0x936f('0x29')]};}):[]};})};}})['then'](respondWithResult(_0x54a252,null))[_0x936f('0x45')](function(_0x2df7e7){var _0x13c1c5=_0x2c4f89[_0x936f('0x31')][_0x936f('0x71')]?0x1f4:_0x2df7e7[_0x936f('0x72')]||0x1f4;logger[_0x936f('0x73')](_0x936f('0x74'),'getFields',_0x13c1c5,JSON[_0x936f('0x75')](_0x2df7e7));delete _0x2df7e7['name'];if(_0x13c1c5===0x191){_0x13c1c5=0x190;}_0x54a252[_0x936f('0x1b')](_0x13c1c5)[_0x936f('0x76')](_0x2c4f89[_0x936f('0x31')][_0x936f('0x71')]?{'message':_0x936f('0x77'),'statusCode':_0x2df7e7[_0x936f('0x72')]}:_0x2df7e7);});}else{var _0x177d77=0x1f4;_0x54a252[_0x936f('0x1b')](_0x177d77)[_0x936f('0x76')]({'message':'Wrong\x20credentials','statusCode':0x190});}});}; \ No newline at end of file +var _0x0348=['params','keys','rawAttributes','options','find','create','body','SugarcrmConfiguration','hasOwnProperty','getConfigurations','addConfiguration','findOne','Subjects','getSubjects','channel','Descriptions','getDescriptions','SugarcrmField','getFields','description','duration_hours','duration_minutes','parent_name','username','password','slice','substring','POST','format','/service/v4_1/rest.php','login','JSON','stringify','PLAIN','Invalid\x20Login','Password\x20Expired','get_module_fields','Calls','values','module_fields','remove','endsWith','value','test','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','statusCode','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','fieldName','key','model','query','filters','attributes','intersection','fields','length','nolimit','order','sort','pick','filter','where','merge','type','SugarcrmAccount','includeAll','include','findAll','rows','catch','show'];(function(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0x0348,0x18b));var _0x8034=function(_0x3e32b1,_0x487a75){_0x3e32b1=_0x3e32b1-0x0;var _0x419327=_0x0348[_0x3e32b1];return _0x419327;};'use strict';var emlformat=require(_0x8034('0x0'));var rimraf=require(_0x8034('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8034('0x2'));var rp=require(_0x8034('0x3'));var moment=require(_0x8034('0x4'));var BPromise=require(_0x8034('0x5'));var Mustache=require(_0x8034('0x6'));var util=require('util');var path=require('path');var sox=require(_0x8034('0x7'));var csv=require(_0x8034('0x8'));var ejs=require(_0x8034('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8034('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8034('0xb'));var toCsv=require(_0x8034('0x8'));var querystring=require(_0x8034('0xc'));var Papa=require(_0x8034('0xd'));var Redis=require(_0x8034('0xe'));var authService=require(_0x8034('0xf'));var qs=require(_0x8034('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8034('0x11'));var logger=require(_0x8034('0x12'))(_0x8034('0x13'));var utils=require(_0x8034('0x14'));var config=require(_0x8034('0x15'));var licenseUtil=require(_0x8034('0x16'));var db=require(_0x8034('0x17'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x5b142d,_0x523010){_0x523010=_0x523010||0xcc;return function(_0x2ce8e1){if(_0x2ce8e1){return _0x5b142d[_0x8034('0x18')](_0x523010);}return _0x5b142d[_0x8034('0x19')](_0x523010)[_0x8034('0x1a')]();};}function respondWithResult(_0x2a25ac,_0x9cfa09){_0x9cfa09=_0x9cfa09||0xc8;return function(_0xbc7220){if(_0xbc7220){return _0x2a25ac[_0x8034('0x19')](_0x9cfa09)[_0x8034('0x1b')](_0xbc7220);}};}function respondWithFilteredResult(_0x520a33,_0x4486a2){return function(_0x396fbf){if(_0x396fbf){var _0x195abe=typeof _0x4486a2[_0x8034('0x1c')]===_0x8034('0x1d')&&typeof _0x4486a2[_0x8034('0x1e')]===_0x8034('0x1d');var _0x184398=_0x396fbf[_0x8034('0x1f')];var _0x116817=_0x195abe?0x0:_0x4486a2[_0x8034('0x1c')];var _0x1b7bc5=_0x195abe?_0x396fbf[_0x8034('0x1f')]:_0x4486a2[_0x8034('0x1c')]+_0x4486a2['limit'];var _0x5e4140;if(_0x1b7bc5>=_0x184398){_0x1b7bc5=_0x184398;_0x5e4140=0xc8;}else{_0x5e4140=0xce;}_0x520a33[_0x8034('0x19')](_0x5e4140);return _0x520a33[_0x8034('0x20')]('Content-Range',_0x116817+'-'+_0x1b7bc5+'/'+_0x184398)[_0x8034('0x1b')](_0x396fbf);}return null;};}function patchUpdates(_0x3217d1){return function(_0x5ef4f0){try{jsonpatch[_0x8034('0x21')](_0x5ef4f0,_0x3217d1,!![]);}catch(_0x52c547){return BPromise[_0x8034('0x22')](_0x52c547);}return _0x5ef4f0[_0x8034('0x23')]();};}function saveUpdates(_0x2d2cf8,_0x559505){return function(_0x195fa2){if(_0x195fa2){return _0x195fa2[_0x8034('0x24')](_0x2d2cf8)[_0x8034('0x25')](function(_0x1d6905){return _0x1d6905;});}return null;};}function removeEntity(_0x50c2d7,_0x54b776){return function(_0x5f3f35){if(_0x5f3f35){return _0x5f3f35[_0x8034('0x26')]()[_0x8034('0x25')](function(){_0x50c2d7['status'](0xcc)[_0x8034('0x1a')]();});}};}function handleEntityNotFound(_0x3c15c2,_0x1f0b35){return function(_0x162152){if(!_0x162152){_0x3c15c2[_0x8034('0x18')](0x194);}return _0x162152;};}function handleError(_0x5c2448,_0x287b46){_0x287b46=_0x287b46||0x1f4;return function(_0x36e511){logger[_0x8034('0x27')](_0x36e511[_0x8034('0x28')]);if(_0x36e511[_0x8034('0x29')]){delete _0x36e511[_0x8034('0x29')];}_0x5c2448[_0x8034('0x19')](_0x287b46)[_0x8034('0x2a')](_0x36e511);};}exports[_0x8034('0x2b')]=function(_0x29a7c1,_0x1cc717){var _0x49bd92={},_0xaa4260={},_0x30eec5={'count':0x0,'rows':[]};var _0x7c1f7f=_[_0x8034('0x2c')](db['SugarcrmAccount']['rawAttributes'],function(_0x5a6f50){return{'name':_0x5a6f50[_0x8034('0x2d')],'type':_0x5a6f50['type'][_0x8034('0x2e')]};});_0xaa4260[_0x8034('0x2f')]=_[_0x8034('0x2c')](_0x7c1f7f,_0x8034('0x29'));_0xaa4260['query']=_['keys'](_0x29a7c1[_0x8034('0x30')]);_0xaa4260[_0x8034('0x31')]=_['intersection'](_0xaa4260[_0x8034('0x2f')],_0xaa4260['query']);_0x49bd92[_0x8034('0x32')]=_[_0x8034('0x33')](_0xaa4260['model'],qs[_0x8034('0x34')](_0x29a7c1['query'][_0x8034('0x34')]));_0x49bd92[_0x8034('0x32')]=_0x49bd92[_0x8034('0x32')][_0x8034('0x35')]?_0x49bd92['attributes']:_0xaa4260[_0x8034('0x2f')];if(!_0x29a7c1['query']['hasOwnProperty'](_0x8034('0x36'))){_0x49bd92[_0x8034('0x1e')]=qs[_0x8034('0x1e')](_0x29a7c1[_0x8034('0x30')][_0x8034('0x1e')]);_0x49bd92[_0x8034('0x1c')]=qs['offset'](_0x29a7c1['query'][_0x8034('0x1c')]);}_0x49bd92[_0x8034('0x37')]=qs[_0x8034('0x38')](_0x29a7c1[_0x8034('0x30')][_0x8034('0x38')]);_0x49bd92['where']=qs[_0x8034('0x31')](_[_0x8034('0x39')](_0x29a7c1[_0x8034('0x30')],_0xaa4260['filters']),_0x7c1f7f);if(_0x29a7c1['query'][_0x8034('0x3a')]){_0x49bd92[_0x8034('0x3b')]=_[_0x8034('0x3c')](_0x49bd92[_0x8034('0x3b')],{'$or':_['map'](_0x7c1f7f,function(_0x207edc){if(_0x207edc[_0x8034('0x3d')]!=='VIRTUAL'){var _0xf7d5a6={};_0xf7d5a6[_0x207edc[_0x8034('0x29')]]={'$like':'%'+_0x29a7c1[_0x8034('0x30')][_0x8034('0x3a')]+'%'};return _0xf7d5a6;}})});}_0x49bd92=_['merge']({},_0x49bd92,_0x29a7c1['options']);var _0x1abd7b={'where':_0x49bd92[_0x8034('0x3b')]};return db[_0x8034('0x3e')][_0x8034('0x1f')](_0x1abd7b)[_0x8034('0x25')](function(_0x4ce0e2){_0x30eec5[_0x8034('0x1f')]=_0x4ce0e2;if(_0x29a7c1[_0x8034('0x30')][_0x8034('0x3f')]){_0x49bd92[_0x8034('0x40')]=[{'all':!![]}];}return db[_0x8034('0x3e')][_0x8034('0x41')](_0x49bd92);})[_0x8034('0x25')](function(_0x541bc9){_0x30eec5[_0x8034('0x42')]=_0x541bc9;return _0x30eec5;})[_0x8034('0x25')](respondWithFilteredResult(_0x1cc717,_0x49bd92))[_0x8034('0x43')](handleError(_0x1cc717,null));};exports[_0x8034('0x44')]=function(_0xac3627,_0x1e5a6a){var _0x347993={'raw':![],'where':{'id':_0xac3627[_0x8034('0x45')]['id']}},_0x50ccde={};_0x50ccde['model']=_[_0x8034('0x46')](db[_0x8034('0x3e')][_0x8034('0x47')]);_0x50ccde[_0x8034('0x30')]=_['keys'](_0xac3627[_0x8034('0x30')]);_0x50ccde[_0x8034('0x31')]=_[_0x8034('0x33')](_0x50ccde[_0x8034('0x2f')],_0x50ccde[_0x8034('0x30')]);_0x347993['attributes']=_[_0x8034('0x33')](_0x50ccde['model'],qs[_0x8034('0x34')](_0xac3627[_0x8034('0x30')][_0x8034('0x34')]));_0x347993[_0x8034('0x32')]=_0x347993[_0x8034('0x32')]['length']?_0x347993[_0x8034('0x32')]:_0x50ccde[_0x8034('0x2f')];if(_0xac3627['query'][_0x8034('0x3f')]){_0x347993['include']=[{'all':!![]}];}_0x347993=_[_0x8034('0x3c')]({},_0x347993,_0xac3627[_0x8034('0x48')]);return db[_0x8034('0x3e')][_0x8034('0x49')](_0x347993)['then'](handleEntityNotFound(_0x1e5a6a,null))['then'](respondWithResult(_0x1e5a6a,null))['catch'](handleError(_0x1e5a6a,null));};exports[_0x8034('0x4a')]=function(_0x1b6ab0,_0x1e6191){return db[_0x8034('0x3e')][_0x8034('0x4a')](_0x1b6ab0[_0x8034('0x4b')],{})['then'](respondWithResult(_0x1e6191,0xc9))[_0x8034('0x43')](handleError(_0x1e6191,null));};exports[_0x8034('0x24')]=function(_0x2fc182,_0x14ec3b){if(_0x2fc182[_0x8034('0x4b')]['id']){delete _0x2fc182['body']['id'];}return db[_0x8034('0x3e')][_0x8034('0x49')]({'where':{'id':_0x2fc182['params']['id']}})[_0x8034('0x25')](handleEntityNotFound(_0x14ec3b,null))[_0x8034('0x25')](saveUpdates(_0x2fc182['body'],null))[_0x8034('0x25')](respondWithResult(_0x14ec3b,null))[_0x8034('0x43')](handleError(_0x14ec3b,null));};exports[_0x8034('0x26')]=function(_0xdb4da1,_0x1cb274){return db['SugarcrmAccount'][_0x8034('0x49')]({'where':{'id':_0xdb4da1[_0x8034('0x45')]['id']}})[_0x8034('0x25')](handleEntityNotFound(_0x1cb274,null))[_0x8034('0x25')](removeEntity(_0x1cb274,null))[_0x8034('0x43')](handleError(_0x1cb274,null));};exports['getConfigurations']=function(_0x13322d,_0x43b94d,_0x162e3c){var _0x972f23={};var _0x4ba986={};var _0x42fd81;var _0x17343a;return db[_0x8034('0x3e')]['findOne']({'where':{'id':_0x13322d[_0x8034('0x45')]['id']}})[_0x8034('0x25')](handleEntityNotFound(_0x43b94d,null))[_0x8034('0x25')](function(_0x59245c){if(_0x59245c){_0x42fd81=_0x59245c;_0x4ba986['model']=_[_0x8034('0x46')](db[_0x8034('0x4c')]['rawAttributes']);_0x4ba986[_0x8034('0x30')]=_[_0x8034('0x46')](_0x13322d[_0x8034('0x30')]);_0x4ba986[_0x8034('0x31')]=_[_0x8034('0x33')](_0x4ba986[_0x8034('0x2f')],_0x4ba986[_0x8034('0x30')]);_0x972f23[_0x8034('0x32')]=_[_0x8034('0x33')](_0x4ba986[_0x8034('0x2f')],qs[_0x8034('0x34')](_0x13322d['query']['fields']));_0x972f23[_0x8034('0x32')]=_0x972f23[_0x8034('0x32')][_0x8034('0x35')]?_0x972f23[_0x8034('0x32')]:_0x4ba986['model'];_0x972f23[_0x8034('0x37')]=qs[_0x8034('0x38')](_0x13322d['query'][_0x8034('0x38')]);_0x972f23[_0x8034('0x3b')]=qs[_0x8034('0x31')](_[_0x8034('0x39')](_0x13322d[_0x8034('0x30')],_0x4ba986[_0x8034('0x31')]));if(_0x13322d[_0x8034('0x30')][_0x8034('0x3a')]){_0x972f23[_0x8034('0x3b')]=_[_0x8034('0x3c')](_0x972f23[_0x8034('0x3b')],{'$or':_['map'](_0x972f23[_0x8034('0x32')],function(_0x31ff18){var _0x40457f={};_0x40457f[_0x31ff18]={'$like':'%'+_0x13322d[_0x8034('0x30')][_0x8034('0x3a')]+'%'};return _0x40457f;})});}_0x972f23=_[_0x8034('0x3c')]({},_0x972f23,_0x13322d[_0x8034('0x48')]);return _0x42fd81['getConfigurations'](_0x972f23);}})[_0x8034('0x25')](function(_0x4b3795){if(_0x4b3795){_0x17343a=_0x4b3795[_0x8034('0x35')];if(!_0x13322d['query'][_0x8034('0x4d')](_0x8034('0x36'))){_0x972f23[_0x8034('0x1e')]=qs[_0x8034('0x1e')](_0x13322d['query'][_0x8034('0x1e')]);_0x972f23[_0x8034('0x1c')]=qs[_0x8034('0x1c')](_0x13322d[_0x8034('0x30')][_0x8034('0x1c')]);}return _0x42fd81[_0x8034('0x4e')](_0x972f23);}})[_0x8034('0x25')](function(_0xcf02c3){if(_0xcf02c3){return _0xcf02c3?{'count':_0x17343a,'rows':_0xcf02c3}:null;}})[_0x8034('0x25')](respondWithResult(_0x43b94d,null))[_0x8034('0x43')](handleError(_0x43b94d,null));};exports[_0x8034('0x4f')]=function(_0x54b6b6,_0x3c71f1,_0x32eab8){if(_0x54b6b6[_0x8034('0x4b')]['id']){delete _0x54b6b6[_0x8034('0x4b')]['id'];}return db[_0x8034('0x3e')][_0x8034('0x50')]({'where':{'id':_0x54b6b6[_0x8034('0x45')]['id']}})[_0x8034('0x25')](handleEntityNotFound(_0x3c71f1,null))[_0x8034('0x25')](function(_0x52bfe6){if(_0x52bfe6){_0x54b6b6[_0x8034('0x4b')]['AccountId']=_0x52bfe6['id'];_0x54b6b6[_0x8034('0x4b')][_0x8034('0x51')]=integrations[_0x8034('0x52')](_0x54b6b6[_0x8034('0x4b')][_0x8034('0x53')],_0x54b6b6[_0x8034('0x4b')]['type']);_0x54b6b6[_0x8034('0x4b')][_0x8034('0x54')]=integrations[_0x8034('0x55')](_0x54b6b6[_0x8034('0x4b')]['channel'],_0x54b6b6[_0x8034('0x4b')]['type']);return db[_0x8034('0x4c')][_0x8034('0x4a')](_0x54b6b6[_0x8034('0x4b')],{'include':[{'model':db[_0x8034('0x56')],'as':_0x8034('0x51')},{'model':db[_0x8034('0x56')],'as':_0x8034('0x54')}]});}return null;})[_0x8034('0x25')](respondWithResult(_0x3c71f1,null))['catch'](handleError(_0x3c71f1,null));};exports[_0x8034('0x57')]=function(_0x406b46,_0x3d2210,_0x16ed4f){var _0x47522b='';var _0xa5ba17=['id',_0x8034('0x29'),'assigned_user_id','created_by',_0x8034('0x58'),'date_start',_0x8034('0x59'),_0x8034('0x5a'),'parent_id','parent_type',_0x8034('0x5b'),'direction'];return db[_0x8034('0x3e')][_0x8034('0x50')]({'where':{'id':_0x406b46['params']['id']},'attributes':['id',_0x8034('0x5c'),_0x8034('0x5d'),'remoteUri']})[_0x8034('0x25')](handleEntityNotFound(_0x3d2210,null))[_0x8034('0x25')](function(_0x14a532){if(_0x14a532){_0x47522b=_0x14a532['remoteUri'];var _0x4330c7=_0x47522b[_0x8034('0x5e')](-0x1);if(_0x4330c7==='/'){_0x47522b=_0x47522b[_0x8034('0x5f')](0x0,_0x47522b['lastIndexOf'](_0x4330c7));}return rp({'method':_0x8034('0x60'),'uri':util[_0x8034('0x61')]('%s%s',_0x47522b,_0x8034('0x62')),'json':!![],'form':{'method':_0x8034('0x63'),'input_type':_0x8034('0x64'),'response_type':_0x8034('0x64'),'rest_data':JSON[_0x8034('0x65')]({'user_auth':{'user_name':_0x14a532[_0x8034('0x5c')],'password':_0x14a532['password'],'encryption':_0x8034('0x66')},'application':'xCALLY\x20Motion\x20Integration'})}});}})[_0x8034('0x25')](function(_0xd825ed){if(_0xd825ed&&_0xd825ed['name']!==_0x8034('0x67')&&_0xd825ed[_0x8034('0x29')]!==_0x8034('0x68')){return rp({'method':_0x8034('0x60'),'uri':util[_0x8034('0x61')]('%s%s',_0x47522b,_0x8034('0x62')),'json':!![],'form':{'method':_0x8034('0x69'),'input_type':_0x8034('0x64'),'response_type':_0x8034('0x64'),'rest_data':JSON[_0x8034('0x65')]({'session':_0xd825ed['id'],'module_name':_0x8034('0x6a')})}})[_0x8034('0x25')](function(_0x1c1b70){if(_0x1c1b70){var _0x59ce1b=_[_0x8034('0x6b')](_0x1c1b70[_0x8034('0x6c')]);_[_0x8034('0x6d')](_0x59ce1b,function(_0x3c0481){return _0xa5ba17['includes'](_0x3c0481['name']);});return{'count':_0x59ce1b['length'],'rows':_['map'](_0x59ce1b,function(_0x1b82d1){return{'id':_0x1b82d1[_0x8034('0x29')],'name':_0x1b82d1['label'],'custom':_[_0x8034('0x6e')](_0x1b82d1[_0x8034('0x29')],'_c')?!![]:![],'options':_0x1b82d1['options']?_['map'](_[_0x8034('0x6b')](_0x1b82d1[_0x8034('0x48')]),function(_0x3af001){return{'name':_0x3af001[_0x8034('0x6f')],'value':_0x3af001['name']};}):[]};})};}})[_0x8034('0x25')](respondWithResult(_0x3d2210,null))[_0x8034('0x43')](function(_0x4ed4c4){var _0xc249fc=_0x406b46['query'][_0x8034('0x70')]?0x1f4:_0x4ed4c4['statusCode']||0x1f4;logger['error'](_0x8034('0x71'),_0x8034('0x57'),_0xc249fc,JSON[_0x8034('0x65')](_0x4ed4c4));delete _0x4ed4c4['name'];if(_0xc249fc===0x191){_0xc249fc=0x190;}_0x3d2210[_0x8034('0x19')](_0xc249fc)['send'](_0x406b46[_0x8034('0x30')]['test']?{'message':_0x8034('0x72'),'statusCode':_0x4ed4c4[_0x8034('0x73')]}:_0x4ed4c4);});}else{var _0x14273b=0x1f4;_0x3d2210[_0x8034('0x19')](_0x14273b)[_0x8034('0x2a')]({'message':_0x8034('0x72'),'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 78b7fec..da8b77c 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 _0xfb0b=['./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','int_sugarcrm_accounts','lodash','util','../../config/logger','moment','bluebird','rimraf'];(function(_0x28f1de,_0x355054){var _0x5b5dad=function(_0x399b72){while(--_0x399b72){_0x28f1de['push'](_0x28f1de['shift']());}};_0x5b5dad(++_0x355054);}(_0xfb0b,0x94));var _0xbfb0=function(_0x565e24,_0x5c9962){_0x565e24=_0x565e24-0x0;var _0x2191d4=_0xfb0b[_0x565e24];return _0x2191d4;};'use strict';var _=require(_0xbfb0('0x0'));var util=require(_0xbfb0('0x1'));var logger=require(_0xbfb0('0x2'))('api');var moment=require(_0xbfb0('0x3'));var BPromise=require(_0xbfb0('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xbfb0('0x5'));var config=require('../../config/environment');var attributes=require(_0xbfb0('0x6'));var integrations=require(_0xbfb0('0x7'));module[_0xbfb0('0x8')]=function(_0x35d657,_0x2b3840){return _0x35d657[_0xbfb0('0x9')]('SugarcrmAccount',attributes,{'tableName':_0xbfb0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc58f=['./intSugarcrmAccount.attributes','../../components/integrations/configuration','define','SugarcrmAccount','int_sugarcrm_accounts','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xc58f,0xad));var _0xfc58=function(_0x5aece9,_0x2bbb9a){_0x5aece9=_0x5aece9-0x0;var _0x1c46d6=_0xc58f[_0x5aece9];return _0x1c46d6;};'use strict';var _=require(_0xfc58('0x0'));var util=require(_0xfc58('0x1'));var logger=require(_0xfc58('0x2'))('api');var moment=require(_0xfc58('0x3'));var BPromise=require(_0xfc58('0x4'));var rp=require(_0xfc58('0x5'));var fs=require('fs');var path=require(_0xfc58('0x6'));var rimraf=require(_0xfc58('0x7'));var config=require(_0xfc58('0x8'));var attributes=require(_0xfc58('0x9'));var integrations=require(_0xfc58('0xa'));module['exports']=function(_0xe4fd3e,_0x3a6257){return _0xe4fd3e[_0xfc58('0xb')](_0xfc58('0xc'),attributes,{'tableName':_0xfc58('0xd'),'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 d0e57f9..d607ccf 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 _0x1692=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetSugarcrmAccount','findAll','options','limit','include','map','model','attributes','ShowSugarcrmAccount','SugarcrmAccount','find','raw','where','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x217e78,_0x1ad140){var _0x664d2f=function(_0x5bddfe){while(--_0x5bddfe){_0x217e78['push'](_0x217e78['shift']());}};_0x664d2f(++_0x1ad140);}(_0x1692,0x157));var _0x2169=function(_0x2994df,_0x67a99a){_0x2994df=_0x2994df-0x0;var _0x3e0758=_0x1692[_0x2994df];return _0x3e0758;};'use strict';var _=require(_0x2169('0x0'));var util=require(_0x2169('0x1'));var moment=require(_0x2169('0x2'));var BPromise=require('bluebird');var rs=require(_0x2169('0x3'));var fs=require('fs');var Redis=require(_0x2169('0x4'));var db=require(_0x2169('0x5'))['db'];var utils=require(_0x2169('0x6'));var logger=require(_0x2169('0x7'))(_0x2169('0x8'));var config=require(_0x2169('0x9'));var jayson=require(_0x2169('0xa'));var client=jayson[_0x2169('0xb')][_0x2169('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x46f347,_0x3e54e6,_0x323b8e){return new BPromise(function(_0x21e72c,_0x170fb0){return client[_0x2169('0xd')](_0x46f347,_0x323b8e)[_0x2169('0xe')](function(_0x4065f2){logger[_0x2169('0xf')](_0x2169('0x10'),_0x3e54e6,'request\x20sent');logger[_0x2169('0x11')](_0x2169('0x12'),_0x3e54e6,_0x2169('0x13'),JSON[_0x2169('0x14')](_0x4065f2));if(_0x4065f2[_0x2169('0x15')]){if(_0x4065f2['error'][_0x2169('0x16')]===0x1f4){logger[_0x2169('0x15')](_0x2169('0x10'),_0x3e54e6,_0x4065f2['error'][_0x2169('0x17')]);return _0x170fb0(_0x4065f2[_0x2169('0x15')]['message']);}logger[_0x2169('0x15')](_0x2169('0x10'),_0x3e54e6,_0x4065f2[_0x2169('0x15')]['message']);return _0x21e72c(_0x4065f2[_0x2169('0x15')][_0x2169('0x17')]);}else{logger[_0x2169('0xf')]('SugarcrmAccount,\x20%s,\x20%s',_0x3e54e6,'request\x20sent');_0x21e72c(_0x4065f2[_0x2169('0x18')][_0x2169('0x17')]);}})[_0x2169('0x19')](function(_0x5d2a1b){logger['error'](_0x2169('0x10'),_0x3e54e6,_0x5d2a1b);_0x170fb0(_0x5d2a1b);});});}exports[_0x2169('0x1a')]=function(_0x16a6dc){var _0x19e8d4=this;return new Promise(function(_0x591d2b,_0x4a5c49){return db['SugarcrmAccount'][_0x2169('0x1b')]({'raw':_0x16a6dc['options']?_0x16a6dc[_0x2169('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x16a6dc[_0x2169('0x1c')]?_0x16a6dc[_0x2169('0x1c')]['where']||null:null,'attributes':_0x16a6dc[_0x2169('0x1c')]?_0x16a6dc[_0x2169('0x1c')]['attributes']||null:null,'limit':_0x16a6dc[_0x2169('0x1c')]?_0x16a6dc[_0x2169('0x1c')][_0x2169('0x1d')]||null:null,'include':_0x16a6dc[_0x2169('0x1c')]?_0x16a6dc[_0x2169('0x1c')][_0x2169('0x1e')]?_[_0x2169('0x1f')](_0x16a6dc[_0x2169('0x1c')][_0x2169('0x1e')],function(_0x12f6ff){return{'model':db[_0x12f6ff[_0x2169('0x20')]],'as':_0x12f6ff['as'],'attributes':_0x12f6ff[_0x2169('0x21')],'include':_0x12f6ff[_0x2169('0x1e')]?_['map'](_0x12f6ff[_0x2169('0x1e')],function(_0x55c000){return{'model':db[_0x55c000[_0x2169('0x20')]],'as':_0x55c000['as'],'attributes':_0x55c000['attributes'],'include':_0x55c000['include']?_[_0x2169('0x1f')](_0x55c000['include'],function(_0x559a90){return{'model':db[_0x559a90['model']],'as':_0x559a90['as'],'attributes':_0x559a90['attributes']};}):[]};}):[]};}):[]:[]})[_0x2169('0xe')](function(_0x184ca9){logger[_0x2169('0xf')](_0x2169('0x1a'),_0x16a6dc);logger[_0x2169('0x11')](_0x2169('0x1a'),_0x16a6dc,JSON['stringify'](_0x184ca9));_0x591d2b(_0x184ca9);})[_0x2169('0x19')](function(_0x5b0043){logger[_0x2169('0x15')](_0x2169('0x1a'),_0x5b0043['message'],_0x16a6dc);_0x4a5c49(_0x19e8d4[_0x2169('0x15')](0x1f4,_0x5b0043[_0x2169('0x17')]));});});};exports[_0x2169('0x22')]=function(_0x27b7b7){var _0x4655fb=this;return new Promise(function(_0x4e9138,_0xa6816b){return db[_0x2169('0x23')][_0x2169('0x24')]({'raw':_0x27b7b7[_0x2169('0x1c')]?_0x27b7b7[_0x2169('0x1c')][_0x2169('0x25')]===undefined?!![]:![]:!![],'where':_0x27b7b7[_0x2169('0x1c')]?_0x27b7b7[_0x2169('0x1c')][_0x2169('0x26')]||null:null,'attributes':_0x27b7b7[_0x2169('0x1c')]?_0x27b7b7[_0x2169('0x1c')][_0x2169('0x21')]||null:null,'include':_0x27b7b7[_0x2169('0x1c')]?_0x27b7b7[_0x2169('0x1c')]['include']?_[_0x2169('0x1f')](_0x27b7b7[_0x2169('0x1c')][_0x2169('0x1e')],function(_0x565a48){return{'model':db[_0x565a48[_0x2169('0x20')]],'as':_0x565a48['as'],'attributes':_0x565a48[_0x2169('0x21')],'include':_0x565a48['include']?_[_0x2169('0x1f')](_0x565a48[_0x2169('0x1e')],function(_0x16bb89){return{'model':db[_0x16bb89[_0x2169('0x20')]],'as':_0x16bb89['as'],'attributes':_0x16bb89['attributes'],'include':_0x16bb89[_0x2169('0x1e')]?_['map'](_0x16bb89[_0x2169('0x1e')],function(_0x1da34a){return{'model':db[_0x1da34a['model']],'as':_0x1da34a['as'],'attributes':_0x1da34a[_0x2169('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4f81ed){logger[_0x2169('0xf')]('ShowSugarcrmAccount',_0x27b7b7);logger[_0x2169('0x11')](_0x2169('0x22'),_0x27b7b7,JSON[_0x2169('0x14')](_0x4f81ed));_0x4e9138(_0x4f81ed);})[_0x2169('0x19')](function(_0x17c668){logger['error'](_0x2169('0x22'),_0x17c668['message'],_0x27b7b7);_0xa6816b(_0x4655fb[_0x2169('0x15')](0x1f4,_0x17c668[_0x2169('0x17')]));});});}; \ No newline at end of file +var _0x09b2=['lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','findAll','options','raw','where','attributes','limit','include','map','model','GetSugarcrmAccount','ShowSugarcrmAccount','find'];(function(_0x40050a,_0x1393ab){var _0x1b8fb0=function(_0x4dde0b){while(--_0x4dde0b){_0x40050a['push'](_0x40050a['shift']());}};_0x1b8fb0(++_0x1393ab);}(_0x09b2,0xee));var _0x209b=function(_0x38a308,_0xdf9c05){_0x38a308=_0x38a308-0x0;var _0x4934dc=_0x09b2[_0x38a308];return _0x4934dc;};'use strict';var _=require(_0x209b('0x0'));var util=require(_0x209b('0x1'));var moment=require('moment');var BPromise=require(_0x209b('0x2'));var rs=require(_0x209b('0x3'));var fs=require('fs');var Redis=require(_0x209b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x209b('0x5'));var logger=require(_0x209b('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x209b('0x7'));var client=jayson[_0x209b('0x8')][_0x209b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1fd591,_0x3aef9f,_0x24c22a){return new BPromise(function(_0x5370fc,_0x48dde9){return client[_0x209b('0xa')](_0x1fd591,_0x24c22a)[_0x209b('0xb')](function(_0xd97a5a){logger[_0x209b('0xc')](_0x209b('0xd'),_0x3aef9f,_0x209b('0xe'));logger[_0x209b('0xf')](_0x209b('0x10'),_0x3aef9f,_0x209b('0xe'),JSON[_0x209b('0x11')](_0xd97a5a));if(_0xd97a5a[_0x209b('0x12')]){if(_0xd97a5a['error']['code']===0x1f4){logger['error'](_0x209b('0xd'),_0x3aef9f,_0xd97a5a[_0x209b('0x12')][_0x209b('0x13')]);return _0x48dde9(_0xd97a5a['error'][_0x209b('0x13')]);}logger['error'](_0x209b('0xd'),_0x3aef9f,_0xd97a5a['error']['message']);return _0x5370fc(_0xd97a5a[_0x209b('0x12')][_0x209b('0x13')]);}else{logger['info']('SugarcrmAccount,\x20%s,\x20%s',_0x3aef9f,_0x209b('0xe'));_0x5370fc(_0xd97a5a[_0x209b('0x14')][_0x209b('0x13')]);}})[_0x209b('0x15')](function(_0x568430){logger[_0x209b('0x12')](_0x209b('0xd'),_0x3aef9f,_0x568430);_0x48dde9(_0x568430);});});}exports['GetSugarcrmAccount']=function(_0x40f838){var _0xca0d01=this;return new Promise(function(_0x5683d2,_0x3fe86c){return db['SugarcrmAccount'][_0x209b('0x16')]({'raw':_0x40f838['options']?_0x40f838[_0x209b('0x17')][_0x209b('0x18')]===undefined?!![]:![]:!![],'where':_0x40f838[_0x209b('0x17')]?_0x40f838['options'][_0x209b('0x19')]||null:null,'attributes':_0x40f838[_0x209b('0x17')]?_0x40f838[_0x209b('0x17')][_0x209b('0x1a')]||null:null,'limit':_0x40f838[_0x209b('0x17')]?_0x40f838[_0x209b('0x17')][_0x209b('0x1b')]||null:null,'include':_0x40f838[_0x209b('0x17')]?_0x40f838[_0x209b('0x17')][_0x209b('0x1c')]?_[_0x209b('0x1d')](_0x40f838[_0x209b('0x17')][_0x209b('0x1c')],function(_0x2d186b){return{'model':db[_0x2d186b['model']],'as':_0x2d186b['as'],'attributes':_0x2d186b['attributes'],'include':_0x2d186b[_0x209b('0x1c')]?_['map'](_0x2d186b[_0x209b('0x1c')],function(_0x452703){return{'model':db[_0x452703['model']],'as':_0x452703['as'],'attributes':_0x452703[_0x209b('0x1a')],'include':_0x452703[_0x209b('0x1c')]?_[_0x209b('0x1d')](_0x452703[_0x209b('0x1c')],function(_0x251991){return{'model':db[_0x251991[_0x209b('0x1e')]],'as':_0x251991['as'],'attributes':_0x251991[_0x209b('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x209b('0xb')](function(_0x1e836e){logger[_0x209b('0xc')]('GetSugarcrmAccount',_0x40f838);logger['debug'](_0x209b('0x1f'),_0x40f838,JSON[_0x209b('0x11')](_0x1e836e));_0x5683d2(_0x1e836e);})['catch'](function(_0x2c3069){logger['error'](_0x209b('0x1f'),_0x2c3069[_0x209b('0x13')],_0x40f838);_0x3fe86c(_0xca0d01[_0x209b('0x12')](0x1f4,_0x2c3069['message']));});});};exports[_0x209b('0x20')]=function(_0x4226a1){var _0x509f8c=this;return new Promise(function(_0x16d659,_0x5916c3){return db['SugarcrmAccount'][_0x209b('0x21')]({'raw':_0x4226a1[_0x209b('0x17')]?_0x4226a1[_0x209b('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x4226a1[_0x209b('0x17')]?_0x4226a1['options'][_0x209b('0x19')]||null:null,'attributes':_0x4226a1['options']?_0x4226a1[_0x209b('0x17')][_0x209b('0x1a')]||null:null,'include':_0x4226a1['options']?_0x4226a1[_0x209b('0x17')][_0x209b('0x1c')]?_[_0x209b('0x1d')](_0x4226a1['options']['include'],function(_0x4d5752){return{'model':db[_0x4d5752[_0x209b('0x1e')]],'as':_0x4d5752['as'],'attributes':_0x4d5752[_0x209b('0x1a')],'include':_0x4d5752[_0x209b('0x1c')]?_[_0x209b('0x1d')](_0x4d5752[_0x209b('0x1c')],function(_0xf828bc){return{'model':db[_0xf828bc[_0x209b('0x1e')]],'as':_0xf828bc['as'],'attributes':_0xf828bc[_0x209b('0x1a')],'include':_0xf828bc[_0x209b('0x1c')]?_[_0x209b('0x1d')](_0xf828bc[_0x209b('0x1c')],function(_0x1e4092){return{'model':db[_0x1e4092[_0x209b('0x1e')]],'as':_0x1e4092['as'],'attributes':_0x1e4092[_0x209b('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x209b('0xb')](function(_0x9e3d5d){logger[_0x209b('0xc')](_0x209b('0x20'),_0x4226a1);logger[_0x209b('0xf')](_0x209b('0x20'),_0x4226a1,JSON[_0x209b('0x11')](_0x9e3d5d));_0x16d659(_0x9e3d5d);})[_0x209b('0x15')](function(_0x357540){logger[_0x209b('0x12')](_0x209b('0x20'),_0x357540[_0x209b('0x13')],_0x4226a1);_0x5916c3(_0x509f8c[_0x209b('0x12')](0x1f4,_0x357540[_0x209b('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 2b54bde..e74156e 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 _0xb9f9=['getSubjects','/:id/descriptions','getDescriptions','post','put','/:id','update','delete','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','isAuthenticated','index','get','/:id/fields','getFields','/:id/subjects'];(function(_0x9b2251,_0x2de1ce){var _0x1737ea=function(_0x2d4604){while(--_0x2d4604){_0x9b2251['push'](_0x9b2251['shift']());}};_0x1737ea(++_0x2de1ce);}(_0xb9f9,0xeb));var _0x9b9f=function(_0x2bc6a2,_0x44e6ea){_0x2bc6a2=_0x2bc6a2-0x0;var _0x50f1ce=_0xb9f9[_0x2bc6a2];return _0x50f1ce;};'use strict';var multer=require(_0x9b9f('0x0'));var util=require(_0x9b9f('0x1'));var path=require(_0x9b9f('0x2'));var timeout=require('connect-timeout');var express=require(_0x9b9f('0x3'));var router=express['Router']();var fs_extra=require(_0x9b9f('0x4'));var auth=require(_0x9b9f('0x5'));var interaction=require(_0x9b9f('0x6'));var config=require(_0x9b9f('0x7'));var controller=require(_0x9b9f('0x8'));router['get']('/',auth[_0x9b9f('0x9')](),controller[_0x9b9f('0xa')]);router[_0x9b9f('0xb')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x9b9f('0xb')](_0x9b9f('0xc'),auth[_0x9b9f('0x9')](),controller[_0x9b9f('0xd')]);router[_0x9b9f('0xb')](_0x9b9f('0xe'),auth[_0x9b9f('0x9')](),controller[_0x9b9f('0xf')]);router[_0x9b9f('0xb')](_0x9b9f('0x10'),auth[_0x9b9f('0x9')](),controller[_0x9b9f('0x11')]);router[_0x9b9f('0x12')]('/',auth[_0x9b9f('0x9')](),controller['create']);router[_0x9b9f('0x13')](_0x9b9f('0x14'),auth['isAuthenticated'](),controller[_0x9b9f('0x15')]);router[_0x9b9f('0x16')](_0x9b9f('0x14'),auth[_0x9b9f('0x9')](),controller[_0x9b9f('0x17')]);module[_0x9b9f('0x18')]=router; \ No newline at end of file +var _0x8a1b=['multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','getSubjects','/:id/descriptions','post','create','put','update','destroy','exports'];(function(_0x1da4a3,_0x581c9b){var _0x576ac0=function(_0x3bb03c){while(--_0x3bb03c){_0x1da4a3['push'](_0x1da4a3['shift']());}};_0x576ac0(++_0x581c9b);}(_0x8a1b,0x73));var _0xb8a1=function(_0x4b3629,_0x2afb3a){_0x4b3629=_0x4b3629-0x0;var _0x3695b7=_0x8a1b[_0x4b3629];return _0x3695b7;};'use strict';var multer=require(_0xb8a1('0x0'));var util=require(_0xb8a1('0x1'));var path=require('path');var timeout=require(_0xb8a1('0x2'));var express=require(_0xb8a1('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xb8a1('0x4'));var interaction=require(_0xb8a1('0x5'));var config=require(_0xb8a1('0x6'));var controller=require(_0xb8a1('0x7'));router[_0xb8a1('0x8')]('/',auth[_0xb8a1('0x9')](),controller[_0xb8a1('0xa')]);router['get'](_0xb8a1('0xb'),auth['isAuthenticated'](),controller[_0xb8a1('0xc')]);router[_0xb8a1('0x8')](_0xb8a1('0xd'),auth[_0xb8a1('0x9')](),controller[_0xb8a1('0xe')]);router['get']('/:id/subjects',auth[_0xb8a1('0x9')](),controller[_0xb8a1('0xf')]);router['get'](_0xb8a1('0x10'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0xb8a1('0x11')]('/',auth[_0xb8a1('0x9')](),controller[_0xb8a1('0x12')]);router[_0xb8a1('0x13')](_0xb8a1('0xb'),auth[_0xb8a1('0x9')](),controller[_0xb8a1('0x14')]);router['delete'](_0xb8a1('0xb'),auth[_0xb8a1('0x9')](),controller[_0xb8a1('0x15')]);module[_0xb8a1('0x16')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 655e581..f2c17ce 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 _0xb9fd=['sequelize','exports','STRING'];(function(_0x2555d0,_0x4150a6){var _0x3bb486=function(_0x1eb89f){while(--_0x1eb89f){_0x2555d0['push'](_0x2555d0['shift']());}};_0x3bb486(++_0x4150a6);}(_0xb9fd,0x180));var _0xdb9f=function(_0x265aa2,_0x220072){_0x265aa2=_0x265aa2-0x0;var _0x447a3a=_0xb9fd[_0x265aa2];return _0x447a3a;};'use strict';var Sequelize=require(_0xdb9f('0x0'));module[_0xdb9f('0x1')]={'name':{'type':Sequelize[_0xdb9f('0x2')]},'description':{'type':Sequelize[_0xdb9f('0x2')]}}; \ No newline at end of file +var _0x359b=['STRING'];(function(_0x24e200,_0x210b9a){var _0x21d27b=function(_0x451687){while(--_0x451687){_0x24e200['push'](_0x24e200['shift']());}};_0x21d27b(++_0x210b9a);}(_0x359b,0x73));var _0xb359=function(_0x460f2a,_0x391b3c){_0x460f2a=_0x460f2a-0x0;var _0x455e68=_0x359b[_0x460f2a];return _0x455e68;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xb359('0x0')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 478fb59..1265629 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 _0x4783=['model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','filter','VIRTUAL','merge','options','SugarcrmConfiguration','includeAll','findAll','catch','show','params','include','find','create','body','getFields','findOne','hasOwnProperty','nolimit','pick','getSubjects','SugarcrmField','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','limit','undefined','count','set','json','apply','reject','update','destroy','then','sendStatus','error','name','send','index','map','rawAttributes','fieldName','type'];(function(_0x28c9f1,_0x47313e){var _0x101907=function(_0x48140d){while(--_0x48140d){_0x28c9f1['push'](_0x28c9f1['shift']());}};_0x101907(++_0x47313e);}(_0x4783,0x1c0));var _0x3478=function(_0x1368a7,_0x1bd12c){_0x1368a7=_0x1368a7-0x0;var _0x58d897=_0x4783[_0x1368a7];return _0x58d897;};'use strict';var emlformat=require(_0x3478('0x0'));var rimraf=require(_0x3478('0x1'));var zipdir=require(_0x3478('0x2'));var jsonpatch=require(_0x3478('0x3'));var rp=require(_0x3478('0x4'));var moment=require(_0x3478('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x3478('0x6'));var util=require(_0x3478('0x7'));var path=require(_0x3478('0x8'));var sox=require(_0x3478('0x9'));var csv=require(_0x3478('0xa'));var ejs=require(_0x3478('0xb'));var fs=require('fs');var fs_extra=require(_0x3478('0xc'));var _=require(_0x3478('0xd'));var squel=require(_0x3478('0xe'));var crypto=require(_0x3478('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x3478('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3478('0x11'));var Redis=require(_0x3478('0x12'));var authService=require(_0x3478('0x13'));var qs=require(_0x3478('0x14'));var as=require(_0x3478('0x15'));var hardwareService=require(_0x3478('0x16'));var logger=require(_0x3478('0x17'))(_0x3478('0x18'));var utils=require('../../config/utils');var config=require(_0x3478('0x19'));var licenseUtil=require(_0x3478('0x1a'));var db=require(_0x3478('0x1b'))['db'];function respondWithStatusCode(_0x5bd7db,_0x47f901){_0x47f901=_0x47f901||0xcc;return function(_0x1d030d){if(_0x1d030d){return _0x5bd7db['sendStatus'](_0x47f901);}return _0x5bd7db[_0x3478('0x1c')](_0x47f901)[_0x3478('0x1d')]();};}function respondWithResult(_0x29a8a7,_0x36a4d9){_0x36a4d9=_0x36a4d9||0xc8;return function(_0x599dbc){if(_0x599dbc){return _0x29a8a7['status'](_0x36a4d9)['json'](_0x599dbc);}};}function respondWithFilteredResult(_0x342cd2,_0x8bd059){return function(_0x1f33a6){if(_0x1f33a6){var _0x31dce0=typeof _0x8bd059[_0x3478('0x1e')]==='undefined'&&typeof _0x8bd059[_0x3478('0x1f')]===_0x3478('0x20');var _0xc3e442=_0x1f33a6[_0x3478('0x21')];var _0x3a0382=_0x31dce0?0x0:_0x8bd059[_0x3478('0x1e')];var _0x46ab80=_0x31dce0?_0x1f33a6[_0x3478('0x21')]:_0x8bd059[_0x3478('0x1e')]+_0x8bd059[_0x3478('0x1f')];var _0x148454;if(_0x46ab80>=_0xc3e442){_0x46ab80=_0xc3e442;_0x148454=0xc8;}else{_0x148454=0xce;}_0x342cd2[_0x3478('0x1c')](_0x148454);return _0x342cd2[_0x3478('0x22')]('Content-Range',_0x3a0382+'-'+_0x46ab80+'/'+_0xc3e442)[_0x3478('0x23')](_0x1f33a6);}return null;};}function patchUpdates(_0x1a76df){return function(_0x13e692){try{jsonpatch[_0x3478('0x24')](_0x13e692,_0x1a76df,!![]);}catch(_0x580685){return BPromise[_0x3478('0x25')](_0x580685);}return _0x13e692['save']();};}function saveUpdates(_0x2bfbd0,_0x57a957){return function(_0x2132f4){if(_0x2132f4){return _0x2132f4[_0x3478('0x26')](_0x2bfbd0)['then'](function(_0x1db839){return _0x1db839;});}return null;};}function removeEntity(_0x477d80,_0x3a8194){return function(_0x274298){if(_0x274298){return _0x274298[_0x3478('0x27')]()[_0x3478('0x28')](function(){_0x477d80['status'](0xcc)[_0x3478('0x1d')]();});}};}function handleEntityNotFound(_0x989712,_0x4924fa){return function(_0xd7395){if(!_0xd7395){_0x989712[_0x3478('0x29')](0x194);}return _0xd7395;};}function handleError(_0x720fa6,_0x5986c8){_0x5986c8=_0x5986c8||0x1f4;return function(_0x3d1f2b){logger[_0x3478('0x2a')](_0x3d1f2b['stack']);if(_0x3d1f2b[_0x3478('0x2b')]){delete _0x3d1f2b[_0x3478('0x2b')];}_0x720fa6[_0x3478('0x1c')](_0x5986c8)[_0x3478('0x2c')](_0x3d1f2b);};}exports[_0x3478('0x2d')]=function(_0x1f8ad9,_0x3eec0c){var _0x210d7d={},_0x54c339={},_0x58d774={'count':0x0,'rows':[]};var _0x45e09a=_[_0x3478('0x2e')](db['SugarcrmConfiguration'][_0x3478('0x2f')],function(_0x5ac9cf){return{'name':_0x5ac9cf[_0x3478('0x30')],'type':_0x5ac9cf[_0x3478('0x31')]['key']};});_0x54c339[_0x3478('0x32')]=_[_0x3478('0x2e')](_0x45e09a,_0x3478('0x2b'));_0x54c339[_0x3478('0x33')]=_[_0x3478('0x34')](_0x1f8ad9[_0x3478('0x33')]);_0x54c339[_0x3478('0x35')]=_[_0x3478('0x36')](_0x54c339['model'],_0x54c339[_0x3478('0x33')]);_0x210d7d[_0x3478('0x37')]=_[_0x3478('0x36')](_0x54c339[_0x3478('0x32')],qs[_0x3478('0x38')](_0x1f8ad9[_0x3478('0x33')][_0x3478('0x38')]));_0x210d7d['attributes']=_0x210d7d[_0x3478('0x37')][_0x3478('0x39')]?_0x210d7d[_0x3478('0x37')]:_0x54c339[_0x3478('0x32')];if(!_0x1f8ad9['query']['hasOwnProperty']('nolimit')){_0x210d7d[_0x3478('0x1f')]=qs[_0x3478('0x1f')](_0x1f8ad9[_0x3478('0x33')][_0x3478('0x1f')]);_0x210d7d[_0x3478('0x1e')]=qs[_0x3478('0x1e')](_0x1f8ad9[_0x3478('0x33')][_0x3478('0x1e')]);}_0x210d7d[_0x3478('0x3a')]=qs[_0x3478('0x3b')](_0x1f8ad9[_0x3478('0x33')][_0x3478('0x3b')]);_0x210d7d[_0x3478('0x3c')]=qs[_0x3478('0x35')](_['pick'](_0x1f8ad9[_0x3478('0x33')],_0x54c339[_0x3478('0x35')]),_0x45e09a);if(_0x1f8ad9[_0x3478('0x33')][_0x3478('0x3d')]){_0x210d7d['where']=_['merge'](_0x210d7d[_0x3478('0x3c')],{'$or':_['map'](_0x45e09a,function(_0x2bd1a2){if(_0x2bd1a2[_0x3478('0x31')]!==_0x3478('0x3e')){var _0x70c81c={};_0x70c81c[_0x2bd1a2['name']]={'$like':'%'+_0x1f8ad9['query'][_0x3478('0x3d')]+'%'};return _0x70c81c;}})});}_0x210d7d=_[_0x3478('0x3f')]({},_0x210d7d,_0x1f8ad9[_0x3478('0x40')]);var _0x3f27e9={'where':_0x210d7d[_0x3478('0x3c')]};return db[_0x3478('0x41')][_0x3478('0x21')](_0x3f27e9)[_0x3478('0x28')](function(_0x57a829){_0x58d774[_0x3478('0x21')]=_0x57a829;if(_0x1f8ad9[_0x3478('0x33')][_0x3478('0x42')]){_0x210d7d['include']=[{'all':!![]}];}return db[_0x3478('0x41')][_0x3478('0x43')](_0x210d7d);})[_0x3478('0x28')](function(_0x34375d){_0x58d774['rows']=_0x34375d;return _0x58d774;})[_0x3478('0x28')](respondWithFilteredResult(_0x3eec0c,_0x210d7d))[_0x3478('0x44')](handleError(_0x3eec0c,null));};exports[_0x3478('0x45')]=function(_0x56b846,_0x147334){var _0x1f7dfd={'raw':![],'where':{'id':_0x56b846[_0x3478('0x46')]['id']}},_0x1ad2a4={};_0x1ad2a4['model']=_[_0x3478('0x34')](db['SugarcrmConfiguration']['rawAttributes']);_0x1ad2a4[_0x3478('0x33')]=_[_0x3478('0x34')](_0x56b846['query']);_0x1ad2a4[_0x3478('0x35')]=_['intersection'](_0x1ad2a4[_0x3478('0x32')],_0x1ad2a4[_0x3478('0x33')]);_0x1f7dfd['attributes']=_['intersection'](_0x1ad2a4[_0x3478('0x32')],qs[_0x3478('0x38')](_0x56b846['query'][_0x3478('0x38')]));_0x1f7dfd[_0x3478('0x37')]=_0x1f7dfd[_0x3478('0x37')][_0x3478('0x39')]?_0x1f7dfd[_0x3478('0x37')]:_0x1ad2a4[_0x3478('0x32')];if(_0x56b846[_0x3478('0x33')][_0x3478('0x42')]){_0x1f7dfd[_0x3478('0x47')]=[{'all':!![]}];}_0x1f7dfd=_['merge']({},_0x1f7dfd,_0x56b846[_0x3478('0x40')]);return db['SugarcrmConfiguration'][_0x3478('0x48')](_0x1f7dfd)[_0x3478('0x28')](handleEntityNotFound(_0x147334,null))[_0x3478('0x28')](respondWithResult(_0x147334,null))[_0x3478('0x44')](handleError(_0x147334,null));};exports[_0x3478('0x49')]=function(_0x1c80a8,_0x178a86){return db[_0x3478('0x41')]['create'](_0x1c80a8[_0x3478('0x4a')],{})[_0x3478('0x28')](respondWithResult(_0x178a86,0xc9))['catch'](handleError(_0x178a86,null));};exports['update']=function(_0x42446c,_0x5219e5){if(_0x42446c[_0x3478('0x4a')]['id']){delete _0x42446c[_0x3478('0x4a')]['id'];}return db[_0x3478('0x41')][_0x3478('0x48')]({'where':{'id':_0x42446c[_0x3478('0x46')]['id']}})['then'](handleEntityNotFound(_0x5219e5,null))[_0x3478('0x28')](saveUpdates(_0x42446c[_0x3478('0x4a')],null))['then'](respondWithResult(_0x5219e5,null))['catch'](handleError(_0x5219e5,null));};exports[_0x3478('0x27')]=function(_0x10cfb7,_0xe12c61){return db[_0x3478('0x41')][_0x3478('0x48')]({'where':{'id':_0x10cfb7[_0x3478('0x46')]['id']}})[_0x3478('0x28')](handleEntityNotFound(_0xe12c61,null))[_0x3478('0x28')](removeEntity(_0xe12c61,null))['catch'](handleError(_0xe12c61,null));};exports[_0x3478('0x4b')]=function(_0x1277dc,_0xe13094,_0x126ef0){var _0x43aaf5={};var _0x245c33={};var _0x2939f1;var _0x1a1d84;return db[_0x3478('0x41')][_0x3478('0x4c')]({'where':{'id':_0x1277dc[_0x3478('0x46')]['id']}})['then'](handleEntityNotFound(_0xe13094,null))[_0x3478('0x28')](function(_0x198d63){if(_0x198d63){_0x2939f1=_0x198d63;_0x245c33[_0x3478('0x32')]=_[_0x3478('0x34')](db['SugarcrmField']['rawAttributes']);_0x245c33[_0x3478('0x33')]=_[_0x3478('0x34')](_0x1277dc[_0x3478('0x33')]);_0x245c33[_0x3478('0x35')]=_['intersection'](_0x245c33[_0x3478('0x32')],_0x245c33[_0x3478('0x33')]);_0x43aaf5[_0x3478('0x37')]=_[_0x3478('0x36')](_0x245c33[_0x3478('0x32')],qs[_0x3478('0x38')](_0x1277dc['query']['fields']));_0x43aaf5['attributes']=_0x43aaf5['attributes'][_0x3478('0x39')]?_0x43aaf5[_0x3478('0x37')]:_0x245c33[_0x3478('0x32')];_0x43aaf5[_0x3478('0x3a')]=qs[_0x3478('0x3b')](_0x1277dc['query'][_0x3478('0x3b')]);_0x43aaf5[_0x3478('0x3c')]=qs[_0x3478('0x35')](_['pick'](_0x1277dc[_0x3478('0x33')],_0x245c33[_0x3478('0x35')]));if(_0x1277dc[_0x3478('0x33')][_0x3478('0x3d')]){_0x43aaf5[_0x3478('0x3c')]=_[_0x3478('0x3f')](_0x43aaf5[_0x3478('0x3c')],{'$or':_[_0x3478('0x2e')](_0x43aaf5['attributes'],function(_0xc8507a){var _0x3e3be6={};_0x3e3be6[_0xc8507a]={'$like':'%'+_0x1277dc[_0x3478('0x33')][_0x3478('0x3d')]+'%'};return _0x3e3be6;})});}_0x43aaf5=_['merge']({},_0x43aaf5,_0x1277dc[_0x3478('0x40')]);return _0x2939f1[_0x3478('0x4b')](_0x43aaf5);}})[_0x3478('0x28')](function(_0x3e1657){if(_0x3e1657){_0x1a1d84=_0x3e1657['length'];if(!_0x1277dc[_0x3478('0x33')][_0x3478('0x4d')](_0x3478('0x4e'))){_0x43aaf5['limit']=qs['limit'](_0x1277dc['query'][_0x3478('0x1f')]);_0x43aaf5['offset']=qs[_0x3478('0x1e')](_0x1277dc[_0x3478('0x33')]['offset']);}return _0x2939f1[_0x3478('0x4b')](_0x43aaf5);}})[_0x3478('0x28')](function(_0x4ebc4d){if(_0x4ebc4d){return _0x4ebc4d?{'count':_0x1a1d84,'rows':_0x4ebc4d}:null;}})[_0x3478('0x28')](respondWithResult(_0xe13094,null))[_0x3478('0x44')](handleError(_0xe13094,null));};exports['getSubjects']=function(_0x62afbb,_0x11e0e7,_0x26404d){var _0x51fd9a={};var _0x3f5f16={};var _0x5d97f5;var _0x191e23;return db[_0x3478('0x41')][_0x3478('0x4c')]({'where':{'id':_0x62afbb['params']['id']}})[_0x3478('0x28')](handleEntityNotFound(_0x11e0e7,null))['then'](function(_0x411382){if(_0x411382){_0x5d97f5=_0x411382;_0x3f5f16[_0x3478('0x32')]=_[_0x3478('0x34')](db['SugarcrmField'][_0x3478('0x2f')]);_0x3f5f16[_0x3478('0x33')]=_['keys'](_0x62afbb[_0x3478('0x33')]);_0x3f5f16[_0x3478('0x35')]=_[_0x3478('0x36')](_0x3f5f16[_0x3478('0x32')],_0x3f5f16[_0x3478('0x33')]);_0x51fd9a['attributes']=_[_0x3478('0x36')](_0x3f5f16['model'],qs[_0x3478('0x38')](_0x62afbb[_0x3478('0x33')]['fields']));_0x51fd9a[_0x3478('0x37')]=_0x51fd9a[_0x3478('0x37')][_0x3478('0x39')]?_0x51fd9a['attributes']:_0x3f5f16[_0x3478('0x32')];_0x51fd9a[_0x3478('0x3a')]=qs[_0x3478('0x3b')](_0x62afbb[_0x3478('0x33')]['sort']);_0x51fd9a[_0x3478('0x3c')]=qs[_0x3478('0x35')](_[_0x3478('0x4f')](_0x62afbb['query'],_0x3f5f16[_0x3478('0x35')]));if(_0x62afbb[_0x3478('0x33')][_0x3478('0x3d')]){_0x51fd9a[_0x3478('0x3c')]=_[_0x3478('0x3f')](_0x51fd9a[_0x3478('0x3c')],{'$or':_[_0x3478('0x2e')](_0x51fd9a[_0x3478('0x37')],function(_0x3a3244){var _0x595d7e={};_0x595d7e[_0x3a3244]={'$like':'%'+_0x62afbb[_0x3478('0x33')][_0x3478('0x3d')]+'%'};return _0x595d7e;})});}_0x51fd9a=_[_0x3478('0x3f')]({},_0x51fd9a,_0x62afbb[_0x3478('0x40')]);return _0x5d97f5['getSubjects'](_0x51fd9a);}})[_0x3478('0x28')](function(_0x44b643){if(_0x44b643){_0x191e23=_0x44b643[_0x3478('0x39')];if(!_0x62afbb[_0x3478('0x33')][_0x3478('0x4d')]('nolimit')){_0x51fd9a[_0x3478('0x1f')]=qs['limit'](_0x62afbb[_0x3478('0x33')]['limit']);_0x51fd9a[_0x3478('0x1e')]=qs[_0x3478('0x1e')](_0x62afbb[_0x3478('0x33')]['offset']);}return _0x5d97f5[_0x3478('0x50')](_0x51fd9a);}})['then'](function(_0x1112d3){if(_0x1112d3){return _0x1112d3?{'count':_0x191e23,'rows':_0x1112d3}:null;}})[_0x3478('0x28')](respondWithResult(_0x11e0e7,null))[_0x3478('0x44')](handleError(_0x11e0e7,null));};exports['getDescriptions']=function(_0x3c9d4a,_0x2b814b,_0x5d2ae2){var _0x44d9bc={};var _0x44763b={};var _0x1425f7;var _0x13f001;return db[_0x3478('0x41')]['findOne']({'where':{'id':_0x3c9d4a[_0x3478('0x46')]['id']}})[_0x3478('0x28')](handleEntityNotFound(_0x2b814b,null))[_0x3478('0x28')](function(_0x521d08){if(_0x521d08){_0x1425f7=_0x521d08;_0x44763b['model']=_[_0x3478('0x34')](db[_0x3478('0x51')][_0x3478('0x2f')]);_0x44763b[_0x3478('0x33')]=_[_0x3478('0x34')](_0x3c9d4a['query']);_0x44763b['filters']=_[_0x3478('0x36')](_0x44763b[_0x3478('0x32')],_0x44763b[_0x3478('0x33')]);_0x44d9bc['attributes']=_[_0x3478('0x36')](_0x44763b[_0x3478('0x32')],qs[_0x3478('0x38')](_0x3c9d4a['query'][_0x3478('0x38')]));_0x44d9bc[_0x3478('0x37')]=_0x44d9bc[_0x3478('0x37')]['length']?_0x44d9bc[_0x3478('0x37')]:_0x44763b[_0x3478('0x32')];_0x44d9bc['order']=qs[_0x3478('0x3b')](_0x3c9d4a[_0x3478('0x33')][_0x3478('0x3b')]);_0x44d9bc['where']=qs[_0x3478('0x35')](_[_0x3478('0x4f')](_0x3c9d4a[_0x3478('0x33')],_0x44763b[_0x3478('0x35')]));if(_0x3c9d4a['query'][_0x3478('0x3d')]){_0x44d9bc[_0x3478('0x3c')]=_[_0x3478('0x3f')](_0x44d9bc[_0x3478('0x3c')],{'$or':_[_0x3478('0x2e')](_0x44d9bc[_0x3478('0x37')],function(_0x1bcf03){var _0x1b046b={};_0x1b046b[_0x1bcf03]={'$like':'%'+_0x3c9d4a[_0x3478('0x33')][_0x3478('0x3d')]+'%'};return _0x1b046b;})});}_0x44d9bc=_[_0x3478('0x3f')]({},_0x44d9bc,_0x3c9d4a['options']);return _0x1425f7[_0x3478('0x52')](_0x44d9bc);}})['then'](function(_0x2c1055){if(_0x2c1055){_0x13f001=_0x2c1055[_0x3478('0x39')];if(!_0x3c9d4a['query']['hasOwnProperty']('nolimit')){_0x44d9bc[_0x3478('0x1f')]=qs[_0x3478('0x1f')](_0x3c9d4a[_0x3478('0x33')]['limit']);_0x44d9bc['offset']=qs[_0x3478('0x1e')](_0x3c9d4a['query']['offset']);}return _0x1425f7[_0x3478('0x52')](_0x44d9bc);}})[_0x3478('0x28')](function(_0x2aaaf1){if(_0x2aaaf1){return _0x2aaaf1?{'count':_0x13f001,'rows':_0x2aaaf1}:null;}})[_0x3478('0x28')](respondWithResult(_0x2b814b,null))[_0x3478('0x44')](handleError(_0x2b814b,null));}; \ No newline at end of file +var _0xbcfa=['stack','name','send','index','map','SugarcrmConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','nolimit','order','sort','where','pick','filter','merge','includeAll','include','show','length','options','find','catch','create','body','params','destroy','getFields','findOne','SugarcrmField','hasOwnProperty','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','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','sendStatus','status','end','json','offset','undefined','limit','count','set','save','update','then','error'];(function(_0x16af81,_0x27561e){var _0x2792ed=function(_0x5e571c){while(--_0x5e571c){_0x16af81['push'](_0x16af81['shift']());}};_0x2792ed(++_0x27561e);}(_0xbcfa,0x119));var _0xabcf=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xbcfa[_0x46e363];return _0x3fb059;};'use strict';var emlformat=require(_0xabcf('0x0'));var rimraf=require(_0xabcf('0x1'));var zipdir=require(_0xabcf('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xabcf('0x3'));var moment=require(_0xabcf('0x4'));var BPromise=require(_0xabcf('0x5'));var Mustache=require(_0xabcf('0x6'));var util=require(_0xabcf('0x7'));var path=require(_0xabcf('0x8'));var sox=require(_0xabcf('0x9'));var csv=require(_0xabcf('0xa'));var ejs=require(_0xabcf('0xb'));var fs=require('fs');var fs_extra=require(_0xabcf('0xc'));var _=require('lodash');var squel=require(_0xabcf('0xd'));var crypto=require(_0xabcf('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xabcf('0xa'));var querystring=require(_0xabcf('0xf'));var Papa=require(_0xabcf('0x10'));var Redis=require(_0xabcf('0x11'));var authService=require(_0xabcf('0x12'));var qs=require(_0xabcf('0x13'));var as=require(_0xabcf('0x14'));var hardwareService=require(_0xabcf('0x15'));var logger=require(_0xabcf('0x16'))('api');var utils=require(_0xabcf('0x17'));var config=require(_0xabcf('0x18'));var licenseUtil=require(_0xabcf('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5cfff3,_0x5bfd62){_0x5bfd62=_0x5bfd62||0xcc;return function(_0x223252){if(_0x223252){return _0x5cfff3[_0xabcf('0x1a')](_0x5bfd62);}return _0x5cfff3[_0xabcf('0x1b')](_0x5bfd62)[_0xabcf('0x1c')]();};}function respondWithResult(_0x41b573,_0x518b52){_0x518b52=_0x518b52||0xc8;return function(_0x3ac098){if(_0x3ac098){return _0x41b573[_0xabcf('0x1b')](_0x518b52)[_0xabcf('0x1d')](_0x3ac098);}};}function respondWithFilteredResult(_0x3d00f2,_0x438d9a){return function(_0x3e58d4){if(_0x3e58d4){var _0x29bf25=typeof _0x438d9a[_0xabcf('0x1e')]===_0xabcf('0x1f')&&typeof _0x438d9a[_0xabcf('0x20')]===_0xabcf('0x1f');var _0x265494=_0x3e58d4[_0xabcf('0x21')];var _0x19b1f0=_0x29bf25?0x0:_0x438d9a['offset'];var _0x3c1b92=_0x29bf25?_0x3e58d4[_0xabcf('0x21')]:_0x438d9a['offset']+_0x438d9a[_0xabcf('0x20')];var _0x1cdef2;if(_0x3c1b92>=_0x265494){_0x3c1b92=_0x265494;_0x1cdef2=0xc8;}else{_0x1cdef2=0xce;}_0x3d00f2['status'](_0x1cdef2);return _0x3d00f2[_0xabcf('0x22')]('Content-Range',_0x19b1f0+'-'+_0x3c1b92+'/'+_0x265494)[_0xabcf('0x1d')](_0x3e58d4);}return null;};}function patchUpdates(_0x264649){return function(_0x6617c5){try{jsonpatch['apply'](_0x6617c5,_0x264649,!![]);}catch(_0x113bc6){return BPromise['reject'](_0x113bc6);}return _0x6617c5[_0xabcf('0x23')]();};}function saveUpdates(_0x4d21f8,_0x921d49){return function(_0x5ea0b1){if(_0x5ea0b1){return _0x5ea0b1[_0xabcf('0x24')](_0x4d21f8)[_0xabcf('0x25')](function(_0x4c70b0){return _0x4c70b0;});}return null;};}function removeEntity(_0x12805c,_0x3e53ca){return function(_0x28e869){if(_0x28e869){return _0x28e869['destroy']()[_0xabcf('0x25')](function(){_0x12805c[_0xabcf('0x1b')](0xcc)[_0xabcf('0x1c')]();});}};}function handleEntityNotFound(_0x1955b5,_0x3af2d4){return function(_0x148625){if(!_0x148625){_0x1955b5[_0xabcf('0x1a')](0x194);}return _0x148625;};}function handleError(_0x388df7,_0x5c24e9){_0x5c24e9=_0x5c24e9||0x1f4;return function(_0x1deb79){logger[_0xabcf('0x26')](_0x1deb79[_0xabcf('0x27')]);if(_0x1deb79[_0xabcf('0x28')]){delete _0x1deb79['name'];}_0x388df7[_0xabcf('0x1b')](_0x5c24e9)[_0xabcf('0x29')](_0x1deb79);};}exports[_0xabcf('0x2a')]=function(_0x449052,_0x5b98af){var _0x34a13c={},_0x5ac968={},_0x1fb21a={'count':0x0,'rows':[]};var _0x4d50d5=_[_0xabcf('0x2b')](db[_0xabcf('0x2c')][_0xabcf('0x2d')],function(_0xacfba0){return{'name':_0xacfba0[_0xabcf('0x2e')],'type':_0xacfba0[_0xabcf('0x2f')][_0xabcf('0x30')]};});_0x5ac968[_0xabcf('0x31')]=_['map'](_0x4d50d5,_0xabcf('0x28'));_0x5ac968[_0xabcf('0x32')]=_[_0xabcf('0x33')](_0x449052['query']);_0x5ac968[_0xabcf('0x34')]=_['intersection'](_0x5ac968['model'],_0x5ac968[_0xabcf('0x32')]);_0x34a13c[_0xabcf('0x35')]=_[_0xabcf('0x36')](_0x5ac968['model'],qs[_0xabcf('0x37')](_0x449052[_0xabcf('0x32')][_0xabcf('0x37')]));_0x34a13c[_0xabcf('0x35')]=_0x34a13c['attributes']['length']?_0x34a13c[_0xabcf('0x35')]:_0x5ac968[_0xabcf('0x31')];if(!_0x449052[_0xabcf('0x32')]['hasOwnProperty'](_0xabcf('0x38'))){_0x34a13c[_0xabcf('0x20')]=qs['limit'](_0x449052[_0xabcf('0x32')][_0xabcf('0x20')]);_0x34a13c[_0xabcf('0x1e')]=qs['offset'](_0x449052['query'][_0xabcf('0x1e')]);}_0x34a13c[_0xabcf('0x39')]=qs[_0xabcf('0x3a')](_0x449052['query'][_0xabcf('0x3a')]);_0x34a13c[_0xabcf('0x3b')]=qs[_0xabcf('0x34')](_[_0xabcf('0x3c')](_0x449052[_0xabcf('0x32')],_0x5ac968[_0xabcf('0x34')]),_0x4d50d5);if(_0x449052['query'][_0xabcf('0x3d')]){_0x34a13c['where']=_[_0xabcf('0x3e')](_0x34a13c[_0xabcf('0x3b')],{'$or':_[_0xabcf('0x2b')](_0x4d50d5,function(_0x47b45e){if(_0x47b45e[_0xabcf('0x2f')]!=='VIRTUAL'){var _0x5503eb={};_0x5503eb[_0x47b45e['name']]={'$like':'%'+_0x449052[_0xabcf('0x32')]['filter']+'%'};return _0x5503eb;}})});}_0x34a13c=_[_0xabcf('0x3e')]({},_0x34a13c,_0x449052['options']);var _0x3c22f5={'where':_0x34a13c[_0xabcf('0x3b')]};return db['SugarcrmConfiguration']['count'](_0x3c22f5)[_0xabcf('0x25')](function(_0x29bf74){_0x1fb21a['count']=_0x29bf74;if(_0x449052['query'][_0xabcf('0x3f')]){_0x34a13c[_0xabcf('0x40')]=[{'all':!![]}];}return db['SugarcrmConfiguration']['findAll'](_0x34a13c);})[_0xabcf('0x25')](function(_0x533e29){_0x1fb21a['rows']=_0x533e29;return _0x1fb21a;})[_0xabcf('0x25')](respondWithFilteredResult(_0x5b98af,_0x34a13c))['catch'](handleError(_0x5b98af,null));};exports[_0xabcf('0x41')]=function(_0x493158,_0x4a5875){var _0x1dfd16={'raw':![],'where':{'id':_0x493158['params']['id']}},_0x12d6a0={};_0x12d6a0[_0xabcf('0x31')]=_[_0xabcf('0x33')](db[_0xabcf('0x2c')][_0xabcf('0x2d')]);_0x12d6a0['query']=_[_0xabcf('0x33')](_0x493158['query']);_0x12d6a0[_0xabcf('0x34')]=_[_0xabcf('0x36')](_0x12d6a0[_0xabcf('0x31')],_0x12d6a0[_0xabcf('0x32')]);_0x1dfd16[_0xabcf('0x35')]=_[_0xabcf('0x36')](_0x12d6a0[_0xabcf('0x31')],qs['fields'](_0x493158[_0xabcf('0x32')][_0xabcf('0x37')]));_0x1dfd16[_0xabcf('0x35')]=_0x1dfd16[_0xabcf('0x35')][_0xabcf('0x42')]?_0x1dfd16[_0xabcf('0x35')]:_0x12d6a0[_0xabcf('0x31')];if(_0x493158[_0xabcf('0x32')]['includeAll']){_0x1dfd16[_0xabcf('0x40')]=[{'all':!![]}];}_0x1dfd16=_[_0xabcf('0x3e')]({},_0x1dfd16,_0x493158[_0xabcf('0x43')]);return db[_0xabcf('0x2c')][_0xabcf('0x44')](_0x1dfd16)[_0xabcf('0x25')](handleEntityNotFound(_0x4a5875,null))[_0xabcf('0x25')](respondWithResult(_0x4a5875,null))[_0xabcf('0x45')](handleError(_0x4a5875,null));};exports['create']=function(_0x390361,_0x2a4866){return db[_0xabcf('0x2c')][_0xabcf('0x46')](_0x390361[_0xabcf('0x47')],{})['then'](respondWithResult(_0x2a4866,0xc9))[_0xabcf('0x45')](handleError(_0x2a4866,null));};exports[_0xabcf('0x24')]=function(_0x49d3ca,_0x3178f8){if(_0x49d3ca[_0xabcf('0x47')]['id']){delete _0x49d3ca[_0xabcf('0x47')]['id'];}return db[_0xabcf('0x2c')][_0xabcf('0x44')]({'where':{'id':_0x49d3ca[_0xabcf('0x48')]['id']}})[_0xabcf('0x25')](handleEntityNotFound(_0x3178f8,null))['then'](saveUpdates(_0x49d3ca[_0xabcf('0x47')],null))[_0xabcf('0x25')](respondWithResult(_0x3178f8,null))[_0xabcf('0x45')](handleError(_0x3178f8,null));};exports[_0xabcf('0x49')]=function(_0x491e5d,_0x40e163){return db[_0xabcf('0x2c')][_0xabcf('0x44')]({'where':{'id':_0x491e5d[_0xabcf('0x48')]['id']}})[_0xabcf('0x25')](handleEntityNotFound(_0x40e163,null))[_0xabcf('0x25')](removeEntity(_0x40e163,null))[_0xabcf('0x45')](handleError(_0x40e163,null));};exports[_0xabcf('0x4a')]=function(_0x2f93ea,_0x424cbc,_0xb1af71){var _0x4ed601={};var _0x340dd2={};var _0x20b9d9;var _0x2a4f3e;return db[_0xabcf('0x2c')][_0xabcf('0x4b')]({'where':{'id':_0x2f93ea[_0xabcf('0x48')]['id']}})[_0xabcf('0x25')](handleEntityNotFound(_0x424cbc,null))[_0xabcf('0x25')](function(_0x4685f2){if(_0x4685f2){_0x20b9d9=_0x4685f2;_0x340dd2[_0xabcf('0x31')]=_[_0xabcf('0x33')](db[_0xabcf('0x4c')][_0xabcf('0x2d')]);_0x340dd2[_0xabcf('0x32')]=_[_0xabcf('0x33')](_0x2f93ea[_0xabcf('0x32')]);_0x340dd2['filters']=_[_0xabcf('0x36')](_0x340dd2['model'],_0x340dd2[_0xabcf('0x32')]);_0x4ed601[_0xabcf('0x35')]=_[_0xabcf('0x36')](_0x340dd2[_0xabcf('0x31')],qs['fields'](_0x2f93ea[_0xabcf('0x32')][_0xabcf('0x37')]));_0x4ed601[_0xabcf('0x35')]=_0x4ed601[_0xabcf('0x35')][_0xabcf('0x42')]?_0x4ed601[_0xabcf('0x35')]:_0x340dd2['model'];_0x4ed601[_0xabcf('0x39')]=qs['sort'](_0x2f93ea[_0xabcf('0x32')][_0xabcf('0x3a')]);_0x4ed601['where']=qs[_0xabcf('0x34')](_[_0xabcf('0x3c')](_0x2f93ea[_0xabcf('0x32')],_0x340dd2[_0xabcf('0x34')]));if(_0x2f93ea[_0xabcf('0x32')][_0xabcf('0x3d')]){_0x4ed601[_0xabcf('0x3b')]=_[_0xabcf('0x3e')](_0x4ed601['where'],{'$or':_[_0xabcf('0x2b')](_0x4ed601['attributes'],function(_0x32226b){var _0x49579f={};_0x49579f[_0x32226b]={'$like':'%'+_0x2f93ea[_0xabcf('0x32')][_0xabcf('0x3d')]+'%'};return _0x49579f;})});}_0x4ed601=_['merge']({},_0x4ed601,_0x2f93ea[_0xabcf('0x43')]);return _0x20b9d9['getFields'](_0x4ed601);}})['then'](function(_0x2a949f){if(_0x2a949f){_0x2a4f3e=_0x2a949f[_0xabcf('0x42')];if(!_0x2f93ea[_0xabcf('0x32')][_0xabcf('0x4d')]('nolimit')){_0x4ed601[_0xabcf('0x20')]=qs['limit'](_0x2f93ea[_0xabcf('0x32')][_0xabcf('0x20')]);_0x4ed601['offset']=qs[_0xabcf('0x1e')](_0x2f93ea[_0xabcf('0x32')][_0xabcf('0x1e')]);}return _0x20b9d9[_0xabcf('0x4a')](_0x4ed601);}})[_0xabcf('0x25')](function(_0x189e1e){if(_0x189e1e){return _0x189e1e?{'count':_0x2a4f3e,'rows':_0x189e1e}:null;}})[_0xabcf('0x25')](respondWithResult(_0x424cbc,null))[_0xabcf('0x45')](handleError(_0x424cbc,null));};exports['getSubjects']=function(_0x1ff21f,_0x4f6e8e,_0x102aa4){var _0xfcaff9={};var _0x58287a={};var _0xbcb985;var _0xab0ea2;return db['SugarcrmConfiguration'][_0xabcf('0x4b')]({'where':{'id':_0x1ff21f['params']['id']}})[_0xabcf('0x25')](handleEntityNotFound(_0x4f6e8e,null))[_0xabcf('0x25')](function(_0x13a9af){if(_0x13a9af){_0xbcb985=_0x13a9af;_0x58287a[_0xabcf('0x31')]=_['keys'](db[_0xabcf('0x4c')][_0xabcf('0x2d')]);_0x58287a['query']=_['keys'](_0x1ff21f[_0xabcf('0x32')]);_0x58287a['filters']=_[_0xabcf('0x36')](_0x58287a[_0xabcf('0x31')],_0x58287a[_0xabcf('0x32')]);_0xfcaff9['attributes']=_[_0xabcf('0x36')](_0x58287a[_0xabcf('0x31')],qs[_0xabcf('0x37')](_0x1ff21f[_0xabcf('0x32')][_0xabcf('0x37')]));_0xfcaff9[_0xabcf('0x35')]=_0xfcaff9['attributes'][_0xabcf('0x42')]?_0xfcaff9[_0xabcf('0x35')]:_0x58287a['model'];_0xfcaff9[_0xabcf('0x39')]=qs['sort'](_0x1ff21f['query'][_0xabcf('0x3a')]);_0xfcaff9[_0xabcf('0x3b')]=qs[_0xabcf('0x34')](_['pick'](_0x1ff21f[_0xabcf('0x32')],_0x58287a['filters']));if(_0x1ff21f[_0xabcf('0x32')][_0xabcf('0x3d')]){_0xfcaff9['where']=_[_0xabcf('0x3e')](_0xfcaff9[_0xabcf('0x3b')],{'$or':_[_0xabcf('0x2b')](_0xfcaff9[_0xabcf('0x35')],function(_0x50c1ad){var _0xaf9584={};_0xaf9584[_0x50c1ad]={'$like':'%'+_0x1ff21f['query'][_0xabcf('0x3d')]+'%'};return _0xaf9584;})});}_0xfcaff9=_[_0xabcf('0x3e')]({},_0xfcaff9,_0x1ff21f['options']);return _0xbcb985[_0xabcf('0x4e')](_0xfcaff9);}})[_0xabcf('0x25')](function(_0x18a17d){if(_0x18a17d){_0xab0ea2=_0x18a17d[_0xabcf('0x42')];if(!_0x1ff21f['query']['hasOwnProperty']('nolimit')){_0xfcaff9[_0xabcf('0x20')]=qs['limit'](_0x1ff21f['query'][_0xabcf('0x20')]);_0xfcaff9['offset']=qs[_0xabcf('0x1e')](_0x1ff21f[_0xabcf('0x32')][_0xabcf('0x1e')]);}return _0xbcb985[_0xabcf('0x4e')](_0xfcaff9);}})[_0xabcf('0x25')](function(_0x4aecc8){if(_0x4aecc8){return _0x4aecc8?{'count':_0xab0ea2,'rows':_0x4aecc8}:null;}})[_0xabcf('0x25')](respondWithResult(_0x4f6e8e,null))[_0xabcf('0x45')](handleError(_0x4f6e8e,null));};exports[_0xabcf('0x4f')]=function(_0x55e0b6,_0x3775a3,_0x5af90b){var _0x57dc3a={};var _0x245bf3={};var _0x5a2512;var _0x157905;return db[_0xabcf('0x2c')]['findOne']({'where':{'id':_0x55e0b6['params']['id']}})[_0xabcf('0x25')](handleEntityNotFound(_0x3775a3,null))[_0xabcf('0x25')](function(_0x382fe7){if(_0x382fe7){_0x5a2512=_0x382fe7;_0x245bf3[_0xabcf('0x31')]=_['keys'](db[_0xabcf('0x4c')][_0xabcf('0x2d')]);_0x245bf3[_0xabcf('0x32')]=_[_0xabcf('0x33')](_0x55e0b6['query']);_0x245bf3['filters']=_['intersection'](_0x245bf3[_0xabcf('0x31')],_0x245bf3[_0xabcf('0x32')]);_0x57dc3a[_0xabcf('0x35')]=_[_0xabcf('0x36')](_0x245bf3[_0xabcf('0x31')],qs[_0xabcf('0x37')](_0x55e0b6[_0xabcf('0x32')][_0xabcf('0x37')]));_0x57dc3a[_0xabcf('0x35')]=_0x57dc3a[_0xabcf('0x35')][_0xabcf('0x42')]?_0x57dc3a[_0xabcf('0x35')]:_0x245bf3[_0xabcf('0x31')];_0x57dc3a[_0xabcf('0x39')]=qs[_0xabcf('0x3a')](_0x55e0b6[_0xabcf('0x32')][_0xabcf('0x3a')]);_0x57dc3a['where']=qs['filters'](_['pick'](_0x55e0b6[_0xabcf('0x32')],_0x245bf3[_0xabcf('0x34')]));if(_0x55e0b6[_0xabcf('0x32')][_0xabcf('0x3d')]){_0x57dc3a['where']=_[_0xabcf('0x3e')](_0x57dc3a['where'],{'$or':_[_0xabcf('0x2b')](_0x57dc3a[_0xabcf('0x35')],function(_0x45f2a4){var _0x36270a={};_0x36270a[_0x45f2a4]={'$like':'%'+_0x55e0b6['query'][_0xabcf('0x3d')]+'%'};return _0x36270a;})});}_0x57dc3a=_[_0xabcf('0x3e')]({},_0x57dc3a,_0x55e0b6['options']);return _0x5a2512[_0xabcf('0x4f')](_0x57dc3a);}})[_0xabcf('0x25')](function(_0x50c16e){if(_0x50c16e){_0x157905=_0x50c16e[_0xabcf('0x42')];if(!_0x55e0b6[_0xabcf('0x32')][_0xabcf('0x4d')](_0xabcf('0x38'))){_0x57dc3a[_0xabcf('0x20')]=qs[_0xabcf('0x20')](_0x55e0b6[_0xabcf('0x32')][_0xabcf('0x20')]);_0x57dc3a[_0xabcf('0x1e')]=qs[_0xabcf('0x1e')](_0x55e0b6[_0xabcf('0x32')][_0xabcf('0x1e')]);}return _0x5a2512['getDescriptions'](_0x57dc3a);}})['then'](function(_0x5b16f0){if(_0x5b16f0){return _0x5b16f0?{'count':_0x157905,'rows':_0x5b16f0}:null;}})['then'](respondWithResult(_0x3775a3,null))['catch'](handleError(_0x3775a3,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index e4543f1..b582cbb 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 _0xc7b8=['SugarcrmConfiguration','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','define'];(function(_0x7e4e90,_0x4b2115){var _0xcecb5b=function(_0x883e92){while(--_0x883e92){_0x7e4e90['push'](_0x7e4e90['shift']());}};_0xcecb5b(++_0x4b2115);}(_0xc7b8,0x12d));var _0x8c7b=function(_0x1c49c9,_0x291d3f){_0x1c49c9=_0x1c49c9-0x0;var _0x49f276=_0xc7b8[_0x1c49c9];return _0x49f276;};'use strict';var _=require(_0x8c7b('0x0'));var util=require(_0x8c7b('0x1'));var logger=require(_0x8c7b('0x2'))(_0x8c7b('0x3'));var moment=require(_0x8c7b('0x4'));var BPromise=require(_0x8c7b('0x5'));var rp=require(_0x8c7b('0x6'));var fs=require('fs');var path=require(_0x8c7b('0x7'));var rimraf=require('rimraf');var config=require(_0x8c7b('0x8'));var attributes=require('./intSugarcrmConfiguration.attributes');module[_0x8c7b('0x9')]=function(_0x32a650,_0x56d5c3){return _0x32a650[_0x8c7b('0xa')](_0x8c7b('0xb'),attributes,{'tableName':'int_sugarcrm_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe0d6=['path','rimraf','../../config/environment','exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x24563c,_0x49d7cd){var _0x14796e=function(_0x3ab3d9){while(--_0x3ab3d9){_0x24563c['push'](_0x24563c['shift']());}};_0x14796e(++_0x49d7cd);}(_0xe0d6,0xa3));var _0x6e0d=function(_0x2ef843,_0x175154){_0x2ef843=_0x2ef843-0x0;var _0x11d9e5=_0xe0d6[_0x2ef843];return _0x11d9e5;};'use strict';var _=require('lodash');var util=require(_0x6e0d('0x0'));var logger=require(_0x6e0d('0x1'))(_0x6e0d('0x2'));var moment=require(_0x6e0d('0x3'));var BPromise=require(_0x6e0d('0x4'));var rp=require(_0x6e0d('0x5'));var fs=require('fs');var path=require(_0x6e0d('0x6'));var rimraf=require(_0x6e0d('0x7'));var config=require(_0x6e0d('0x8'));var attributes=require('./intSugarcrmConfiguration.attributes');module[_0x6e0d('0x9')]=function(_0x5bc3b2,_0x1db4f0){return _0x5bc3b2[_0x6e0d('0xa')](_0x6e0d('0xb'),attributes,{'tableName':_0x6e0d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js index 04b7551..e581275 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 _0x8d98=['info','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','error','code','message'];(function(_0x1e4150,_0x55b02a){var _0x1ce3ee=function(_0x59324e){while(--_0x59324e){_0x1e4150['push'](_0x1e4150['shift']());}};_0x1ce3ee(++_0x55b02a);}(_0x8d98,0x8f));var _0x88d9=function(_0x127775,_0x482d6b){_0x127775=_0x127775-0x0;var _0x1429cc=_0x8d98[_0x127775];return _0x1429cc;};'use strict';var _=require('lodash');var util=require(_0x88d9('0x0'));var moment=require(_0x88d9('0x1'));var BPromise=require(_0x88d9('0x2'));var rs=require(_0x88d9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x88d9('0x4'))['db'];var utils=require(_0x88d9('0x5'));var logger=require(_0x88d9('0x6'))(_0x88d9('0x7'));var config=require('../../config/environment');var jayson=require(_0x88d9('0x8'));var client=jayson[_0x88d9('0x9')][_0x88d9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x10221e,_0x211147,_0x3feb7f){return new BPromise(function(_0x3fae48,_0x5ea12c){return client['request'](_0x10221e,_0x3feb7f)[_0x88d9('0xb')](function(_0x3516d5){logger['info'](_0x88d9('0xc'),_0x211147,_0x88d9('0xd'));logger['debug']('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x211147,'request\x20sent',JSON['stringify'](_0x3516d5));if(_0x3516d5[_0x88d9('0xe')]){if(_0x3516d5[_0x88d9('0xe')][_0x88d9('0xf')]===0x1f4){logger['error'](_0x88d9('0xc'),_0x211147,_0x3516d5['error']['message']);return _0x5ea12c(_0x3516d5[_0x88d9('0xe')][_0x88d9('0x10')]);}logger[_0x88d9('0xe')](_0x88d9('0xc'),_0x211147,_0x3516d5['error'][_0x88d9('0x10')]);return _0x3fae48(_0x3516d5[_0x88d9('0xe')]['message']);}else{logger[_0x88d9('0x11')](_0x88d9('0xc'),_0x211147,'request\x20sent');_0x3fae48(_0x3516d5[_0x88d9('0x12')][_0x88d9('0x10')]);}})[_0x88d9('0x13')](function(_0x2152c1){logger[_0x88d9('0xe')](_0x88d9('0xc'),_0x211147,_0x2152c1);_0x5ea12c(_0x2152c1);});});} \ No newline at end of file +var _0xb401=['result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','debug','request\x20sent','error','code','message'];(function(_0x2d786d,_0xfbe6c6){var _0x3b1aeb=function(_0x5a3c19){while(--_0x5a3c19){_0x2d786d['push'](_0x2d786d['shift']());}};_0x3b1aeb(++_0xfbe6c6);}(_0xb401,0x17e));var _0x1b40=function(_0x77cbc3,_0x3f2d07){_0x77cbc3=_0x77cbc3-0x0;var _0x263ee5=_0xb401[_0x77cbc3];return _0x263ee5;};'use strict';var _=require(_0x1b40('0x0'));var util=require(_0x1b40('0x1'));var moment=require(_0x1b40('0x2'));var BPromise=require('bluebird');var rs=require(_0x1b40('0x3'));var fs=require('fs');var Redis=require(_0x1b40('0x4'));var db=require(_0x1b40('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x1b40('0x6'));var jayson=require(_0x1b40('0x7'));var client=jayson[_0x1b40('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a2761,_0x104a10,_0x232044){return new BPromise(function(_0x2a1bce,_0x32b050){return client[_0x1b40('0x9')](_0x5a2761,_0x232044)[_0x1b40('0xa')](function(_0x5a5c3c){logger[_0x1b40('0xb')](_0x1b40('0xc'),_0x104a10,'request\x20sent');logger[_0x1b40('0xd')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x104a10,_0x1b40('0xe'),JSON['stringify'](_0x5a5c3c));if(_0x5a5c3c[_0x1b40('0xf')]){if(_0x5a5c3c[_0x1b40('0xf')][_0x1b40('0x10')]===0x1f4){logger[_0x1b40('0xf')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x104a10,_0x5a5c3c[_0x1b40('0xf')][_0x1b40('0x11')]);return _0x32b050(_0x5a5c3c['error']['message']);}logger[_0x1b40('0xf')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x104a10,_0x5a5c3c[_0x1b40('0xf')][_0x1b40('0x11')]);return _0x2a1bce(_0x5a5c3c[_0x1b40('0xf')]['message']);}else{logger['info']('SugarcrmConfiguration,\x20%s,\x20%s',_0x104a10,_0x1b40('0xe'));_0x2a1bce(_0x5a5c3c[_0x1b40('0x12')][_0x1b40('0x11')]);}})[_0x1b40('0x13')](function(_0x58e0af){logger[_0x1b40('0xf')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x104a10,_0x58e0af);_0x32b050(_0x58e0af);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 77e216f..499d352 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 _0xd922=['exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','post','create','put','update'];(function(_0xfa368c,_0x387c70){var _0x47541f=function(_0x3737b9){while(--_0x3737b9){_0xfa368c['push'](_0xfa368c['shift']());}};_0x47541f(++_0x387c70);}(_0xd922,0x1e7));var _0x2d92=function(_0x392652,_0x390bfd){_0x392652=_0x392652-0x0;var _0x5cd320=_0xd922[_0x392652];return _0x5cd320;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2d92('0x0'));var timeout=require(_0x2d92('0x1'));var express=require(_0x2d92('0x2'));var router=express[_0x2d92('0x3')]();var fs_extra=require(_0x2d92('0x4'));var auth=require(_0x2d92('0x5'));var interaction=require(_0x2d92('0x6'));var config=require(_0x2d92('0x7'));var controller=require('./intSugarcrmField.controller');router[_0x2d92('0x8')]('/',auth['isAuthenticated'](),controller[_0x2d92('0x9')]);router[_0x2d92('0x8')](_0x2d92('0xa'),auth[_0x2d92('0xb')](),controller[_0x2d92('0xc')]);router[_0x2d92('0xd')]('/',auth['isAuthenticated'](),controller[_0x2d92('0xe')]);router[_0x2d92('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x2d92('0x10')]);router['delete'](_0x2d92('0xa'),auth[_0x2d92('0xb')](),controller['destroy']);module[_0x2d92('0x11')]=router; \ No newline at end of file +var _0xd39a=['isAuthenticated','/:id','show','post','create','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','./intSugarcrmField.controller','get'];(function(_0x1c6472,_0x5c9a2a){var _0x367d6a=function(_0x2cf59e){while(--_0x2cf59e){_0x1c6472['push'](_0x1c6472['shift']());}};_0x367d6a(++_0x5c9a2a);}(_0xd39a,0x1b2));var _0xad39=function(_0x295a3d,_0x56d487){_0x295a3d=_0x295a3d-0x0;var _0x23a732=_0xd39a[_0x295a3d];return _0x23a732;};'use strict';var multer=require('multer');var util=require(_0xad39('0x0'));var path=require(_0xad39('0x1'));var timeout=require(_0xad39('0x2'));var express=require(_0xad39('0x3'));var router=express[_0xad39('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xad39('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xad39('0x6'));router[_0xad39('0x7')]('/',auth[_0xad39('0x8')](),controller['index']);router['get'](_0xad39('0x9'),auth[_0xad39('0x8')](),controller[_0xad39('0xa')]);router[_0xad39('0xb')]('/',auth['isAuthenticated'](),controller[_0xad39('0xc')]);router['put'](_0xad39('0x9'),auth[_0xad39('0x8')](),controller[_0xad39('0xd')]);router[_0xad39('0xe')]('/:id',auth[_0xad39('0x8')](),controller[_0xad39('0xf')]);module[_0xad39('0x10')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 62ea49d..6979b6b 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 _0xc845=['ENUM','string','variable','customVariable','keyValue','STRING','BOOLEAN','sequelize','exports'];(function(_0x4a705c,_0x5196c3){var _0x3e1195=function(_0x519726){while(--_0x519726){_0x4a705c['push'](_0x4a705c['shift']());}};_0x3e1195(++_0x5196c3);}(_0xc845,0x142));var _0x5c84=function(_0x29425a,_0x537ec5){_0x29425a=_0x29425a-0x0;var _0x164fa5=_0xc845[_0x29425a];return _0x164fa5;};'use strict';var Sequelize=require(_0x5c84('0x0'));module[_0x5c84('0x1')]={'type':{'type':Sequelize[_0x5c84('0x2')](_0x5c84('0x3'),_0x5c84('0x4'),_0x5c84('0x5'),_0x5c84('0x6'),'picklist'),'defaultValue':_0x5c84('0x3')},'content':{'type':Sequelize[_0x5c84('0x7')]},'key':{'type':Sequelize[_0x5c84('0x7')]},'keyType':{'type':Sequelize[_0x5c84('0x2')](_0x5c84('0x3'),_0x5c84('0x4'),_0x5c84('0x5'))},'keyContent':{'type':Sequelize[_0x5c84('0x7')]},'idField':{'type':Sequelize[_0x5c84('0x7')]},'nameField':{'type':Sequelize[_0x5c84('0x7')]},'customField':{'type':Sequelize[_0x5c84('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5c84('0x7')]}}; \ No newline at end of file +var _0x150e=['string','keyValue','picklist','STRING','variable','BOOLEAN','exports','ENUM'];(function(_0x588f93,_0x2b0e30){var _0x229e04=function(_0x120990){while(--_0x120990){_0x588f93['push'](_0x588f93['shift']());}};_0x229e04(++_0x2b0e30);}(_0x150e,0xf6));var _0xe150=function(_0x59864c,_0x5e2cc2){_0x59864c=_0x59864c-0x0;var _0x3dd30c=_0x150e[_0x59864c];return _0x3dd30c;};'use strict';var Sequelize=require('sequelize');module[_0xe150('0x0')]={'type':{'type':Sequelize[_0xe150('0x1')](_0xe150('0x2'),'variable','customVariable',_0xe150('0x3'),_0xe150('0x4')),'defaultValue':_0xe150('0x2')},'content':{'type':Sequelize[_0xe150('0x5')]},'key':{'type':Sequelize[_0xe150('0x5')]},'keyType':{'type':Sequelize[_0xe150('0x1')](_0xe150('0x2'),_0xe150('0x6'),'customVariable')},'keyContent':{'type':Sequelize[_0xe150('0x5')]},'idField':{'type':Sequelize[_0xe150('0x5')]},'nameField':{'type':Sequelize[_0xe150('0x5')]},'customField':{'type':Sequelize[_0xe150('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 80f97b2..35880e0 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 _0x7a69=['../../components/parsers/qs','../../config/license/hardware','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','end','error','stack','name','send','index','map','SugarcrmField','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','order','sort','pick','filter','where','type','options','includeAll','rows','catch','show','rawAttributes','length','merge','find','create','body','params','destroy','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x11eb0b,_0xe6cfe7){var _0x487fe0=function(_0x8f2b27){while(--_0x8f2b27){_0x11eb0b['push'](_0x11eb0b['shift']());}};_0x487fe0(++_0xe6cfe7);}(_0x7a69,0x108));var _0x97a6=function(_0x11290e,_0x5f1981){_0x11290e=_0x11290e-0x0;var _0xda7c1d=_0x7a69[_0x11290e];return _0xda7c1d;};'use strict';var emlformat=require(_0x97a6('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x97a6('0x1'));var rp=require(_0x97a6('0x2'));var moment=require('moment');var BPromise=require(_0x97a6('0x3'));var Mustache=require(_0x97a6('0x4'));var util=require(_0x97a6('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x97a6('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x97a6('0x7'));var _=require(_0x97a6('0x8'));var squel=require(_0x97a6('0x9'));var crypto=require(_0x97a6('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x97a6('0xb'));var toCsv=require(_0x97a6('0x6'));var querystring=require(_0x97a6('0xc'));var Papa=require(_0x97a6('0xd'));var Redis=require(_0x97a6('0xe'));var authService=require(_0x97a6('0xf'));var qs=require(_0x97a6('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x97a6('0x11'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x97a6('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x97a6('0x13'))['db'];function respondWithStatusCode(_0xa5a353,_0x241da2){_0x241da2=_0x241da2||0xcc;return function(_0x407467){if(_0x407467){return _0xa5a353[_0x97a6('0x14')](_0x241da2);}return _0xa5a353[_0x97a6('0x15')](_0x241da2)['end']();};}function respondWithResult(_0x17e88b,_0x343b45){_0x343b45=_0x343b45||0xc8;return function(_0x3bb0e7){if(_0x3bb0e7){return _0x17e88b[_0x97a6('0x15')](_0x343b45)[_0x97a6('0x16')](_0x3bb0e7);}};}function respondWithFilteredResult(_0x3c652d,_0x1a300c){return function(_0x4d4445){if(_0x4d4445){var _0x581fee=typeof _0x1a300c[_0x97a6('0x17')]===_0x97a6('0x18')&&typeof _0x1a300c[_0x97a6('0x19')]==='undefined';var _0xf59c5=_0x4d4445[_0x97a6('0x1a')];var _0x36c3d7=_0x581fee?0x0:_0x1a300c[_0x97a6('0x17')];var _0x51d04c=_0x581fee?_0x4d4445[_0x97a6('0x1a')]:_0x1a300c[_0x97a6('0x17')]+_0x1a300c[_0x97a6('0x19')];var _0x2ad46c;if(_0x51d04c>=_0xf59c5){_0x51d04c=_0xf59c5;_0x2ad46c=0xc8;}else{_0x2ad46c=0xce;}_0x3c652d[_0x97a6('0x15')](_0x2ad46c);return _0x3c652d[_0x97a6('0x1b')](_0x97a6('0x1c'),_0x36c3d7+'-'+_0x51d04c+'/'+_0xf59c5)[_0x97a6('0x16')](_0x4d4445);}return null;};}function patchUpdates(_0x1e71e7){return function(_0x5bdf8c){try{jsonpatch[_0x97a6('0x1d')](_0x5bdf8c,_0x1e71e7,!![]);}catch(_0x409cf8){return BPromise[_0x97a6('0x1e')](_0x409cf8);}return _0x5bdf8c[_0x97a6('0x1f')]();};}function saveUpdates(_0x5b5259,_0x2de01e){return function(_0x50b0f8){if(_0x50b0f8){return _0x50b0f8[_0x97a6('0x20')](_0x5b5259)['then'](function(_0x9bfddb){return _0x9bfddb;});}return null;};}function removeEntity(_0x3b2d8e,_0x524d0c){return function(_0x3c2026){if(_0x3c2026){return _0x3c2026['destroy']()[_0x97a6('0x21')](function(){_0x3b2d8e[_0x97a6('0x15')](0xcc)[_0x97a6('0x22')]();});}};}function handleEntityNotFound(_0x5378e6,_0x21dcae){return function(_0x167ca3){if(!_0x167ca3){_0x5378e6['sendStatus'](0x194);}return _0x167ca3;};}function handleError(_0x598ccb,_0x460829){_0x460829=_0x460829||0x1f4;return function(_0xe2da00){logger[_0x97a6('0x23')](_0xe2da00[_0x97a6('0x24')]);if(_0xe2da00[_0x97a6('0x25')]){delete _0xe2da00[_0x97a6('0x25')];}_0x598ccb[_0x97a6('0x15')](_0x460829)[_0x97a6('0x26')](_0xe2da00);};}exports[_0x97a6('0x27')]=function(_0x5d9fa3,_0x46a480){var _0x18bdef={},_0x22eca0={},_0x5b8787={'count':0x0,'rows':[]};var _0x597d7e=_[_0x97a6('0x28')](db[_0x97a6('0x29')]['rawAttributes'],function(_0x552cef){return{'name':_0x552cef['fieldName'],'type':_0x552cef['type'][_0x97a6('0x2a')]};});_0x22eca0[_0x97a6('0x2b')]=_['map'](_0x597d7e,_0x97a6('0x25'));_0x22eca0[_0x97a6('0x2c')]=_[_0x97a6('0x2d')](_0x5d9fa3[_0x97a6('0x2c')]);_0x22eca0[_0x97a6('0x2e')]=_['intersection'](_0x22eca0[_0x97a6('0x2b')],_0x22eca0['query']);_0x18bdef[_0x97a6('0x2f')]=_[_0x97a6('0x30')](_0x22eca0[_0x97a6('0x2b')],qs[_0x97a6('0x31')](_0x5d9fa3['query'][_0x97a6('0x31')]));_0x18bdef[_0x97a6('0x2f')]=_0x18bdef['attributes']['length']?_0x18bdef[_0x97a6('0x2f')]:_0x22eca0['model'];if(!_0x5d9fa3[_0x97a6('0x2c')][_0x97a6('0x32')]('nolimit')){_0x18bdef['limit']=qs['limit'](_0x5d9fa3[_0x97a6('0x2c')][_0x97a6('0x19')]);_0x18bdef[_0x97a6('0x17')]=qs[_0x97a6('0x17')](_0x5d9fa3[_0x97a6('0x2c')][_0x97a6('0x17')]);}_0x18bdef[_0x97a6('0x33')]=qs[_0x97a6('0x34')](_0x5d9fa3[_0x97a6('0x2c')]['sort']);_0x18bdef['where']=qs[_0x97a6('0x2e')](_[_0x97a6('0x35')](_0x5d9fa3[_0x97a6('0x2c')],_0x22eca0[_0x97a6('0x2e')]),_0x597d7e);if(_0x5d9fa3[_0x97a6('0x2c')][_0x97a6('0x36')]){_0x18bdef[_0x97a6('0x37')]=_['merge'](_0x18bdef['where'],{'$or':_['map'](_0x597d7e,function(_0x343ace){if(_0x343ace[_0x97a6('0x38')]!=='VIRTUAL'){var _0x97db39={};_0x97db39[_0x343ace['name']]={'$like':'%'+_0x5d9fa3['query']['filter']+'%'};return _0x97db39;}})});}_0x18bdef=_['merge']({},_0x18bdef,_0x5d9fa3[_0x97a6('0x39')]);var _0x20f8fc={'where':_0x18bdef[_0x97a6('0x37')]};return db['SugarcrmField']['count'](_0x20f8fc)[_0x97a6('0x21')](function(_0x402c9c){_0x5b8787[_0x97a6('0x1a')]=_0x402c9c;if(_0x5d9fa3[_0x97a6('0x2c')][_0x97a6('0x3a')]){_0x18bdef['include']=[{'all':!![]}];}return db[_0x97a6('0x29')]['findAll'](_0x18bdef);})[_0x97a6('0x21')](function(_0x8c3bd2){_0x5b8787[_0x97a6('0x3b')]=_0x8c3bd2;return _0x5b8787;})[_0x97a6('0x21')](respondWithFilteredResult(_0x46a480,_0x18bdef))[_0x97a6('0x3c')](handleError(_0x46a480,null));};exports[_0x97a6('0x3d')]=function(_0x2943f4,_0x1f5a6c){var _0x53db7b={'raw':!![],'where':{'id':_0x2943f4['params']['id']}},_0xbc3d55={};_0xbc3d55[_0x97a6('0x2b')]=_[_0x97a6('0x2d')](db[_0x97a6('0x29')][_0x97a6('0x3e')]);_0xbc3d55[_0x97a6('0x2c')]=_['keys'](_0x2943f4['query']);_0xbc3d55[_0x97a6('0x2e')]=_[_0x97a6('0x30')](_0xbc3d55[_0x97a6('0x2b')],_0xbc3d55['query']);_0x53db7b['attributes']=_[_0x97a6('0x30')](_0xbc3d55[_0x97a6('0x2b')],qs['fields'](_0x2943f4[_0x97a6('0x2c')]['fields']));_0x53db7b[_0x97a6('0x2f')]=_0x53db7b[_0x97a6('0x2f')][_0x97a6('0x3f')]?_0x53db7b[_0x97a6('0x2f')]:_0xbc3d55[_0x97a6('0x2b')];if(_0x2943f4['query'][_0x97a6('0x3a')]){_0x53db7b['include']=[{'all':!![]}];}_0x53db7b=_[_0x97a6('0x40')]({},_0x53db7b,_0x2943f4['options']);return db[_0x97a6('0x29')][_0x97a6('0x41')](_0x53db7b)[_0x97a6('0x21')](handleEntityNotFound(_0x1f5a6c,null))['then'](respondWithResult(_0x1f5a6c,null))[_0x97a6('0x3c')](handleError(_0x1f5a6c,null));};exports[_0x97a6('0x42')]=function(_0x1c29df,_0x53147a){return db[_0x97a6('0x29')][_0x97a6('0x42')](_0x1c29df['body'],{})[_0x97a6('0x21')](respondWithResult(_0x53147a,0xc9))['catch'](handleError(_0x53147a,null));};exports['update']=function(_0x2806b1,_0x13bf75){if(_0x2806b1[_0x97a6('0x43')]['id']){delete _0x2806b1[_0x97a6('0x43')]['id'];}return db[_0x97a6('0x29')][_0x97a6('0x41')]({'where':{'id':_0x2806b1[_0x97a6('0x44')]['id']}})['then'](handleEntityNotFound(_0x13bf75,null))[_0x97a6('0x21')](saveUpdates(_0x2806b1['body'],null))[_0x97a6('0x21')](respondWithResult(_0x13bf75,null))[_0x97a6('0x3c')](handleError(_0x13bf75,null));};exports[_0x97a6('0x45')]=function(_0x2964f3,_0x543197){return db[_0x97a6('0x29')][_0x97a6('0x41')]({'where':{'id':_0x2964f3['params']['id']}})[_0x97a6('0x21')](handleEntityNotFound(_0x543197,null))['then'](removeEntity(_0x543197,null))['catch'](handleError(_0x543197,null));}; \ No newline at end of file +var _0x5bc8=['attributes','fields','length','hasOwnProperty','order','sort','filter','where','merge','type','VIRTUAL','options','includeAll','include','rows','catch','show','params','rawAttributes','find','create','body','destroy','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','reject','update','then','end','error','stack','name','send','index','SugarcrmField','fieldName','key','model','map','query','keys','filters','intersection'];(function(_0x3a8c79,_0x5987f0){var _0x20d726=function(_0x5a1846){while(--_0x5a1846){_0x3a8c79['push'](_0x3a8c79['shift']());}};_0x20d726(++_0x5987f0);}(_0x5bc8,0xf8));var _0x85bc=function(_0x5ac84c,_0x287781){_0x5ac84c=_0x5ac84c-0x0;var _0x3c53d2=_0x5bc8[_0x5ac84c];return _0x3c53d2;};'use strict';var emlformat=require(_0x85bc('0x0'));var rimraf=require(_0x85bc('0x1'));var zipdir=require(_0x85bc('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x85bc('0x3'));var moment=require('moment');var BPromise=require(_0x85bc('0x4'));var Mustache=require(_0x85bc('0x5'));var util=require(_0x85bc('0x6'));var path=require(_0x85bc('0x7'));var sox=require(_0x85bc('0x8'));var csv=require(_0x85bc('0x9'));var ejs=require(_0x85bc('0xa'));var fs=require('fs');var fs_extra=require(_0x85bc('0xb'));var _=require('lodash');var squel=require(_0x85bc('0xc'));var crypto=require(_0x85bc('0xd'));var jsforce=require(_0x85bc('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x85bc('0x9'));var querystring=require(_0x85bc('0xf'));var Papa=require(_0x85bc('0x10'));var Redis=require('ioredis');var authService=require(_0x85bc('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x85bc('0x12'));var hardwareService=require(_0x85bc('0x13'));var logger=require(_0x85bc('0x14'))(_0x85bc('0x15'));var utils=require(_0x85bc('0x16'));var config=require(_0x85bc('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x85bc('0x18'))['db'];function respondWithStatusCode(_0x2bae74,_0x30fe13){_0x30fe13=_0x30fe13||0xcc;return function(_0x16fa93){if(_0x16fa93){return _0x2bae74[_0x85bc('0x19')](_0x30fe13);}return _0x2bae74[_0x85bc('0x1a')](_0x30fe13)['end']();};}function respondWithResult(_0x116334,_0x4b7057){_0x4b7057=_0x4b7057||0xc8;return function(_0x4783ec){if(_0x4783ec){return _0x116334[_0x85bc('0x1a')](_0x4b7057)[_0x85bc('0x1b')](_0x4783ec);}};}function respondWithFilteredResult(_0x522d59,_0x216c68){return function(_0x41775e){if(_0x41775e){var _0x3c926e=typeof _0x216c68['offset']===_0x85bc('0x1c')&&typeof _0x216c68[_0x85bc('0x1d')]===_0x85bc('0x1c');var _0x425d71=_0x41775e[_0x85bc('0x1e')];var _0x1dab01=_0x3c926e?0x0:_0x216c68[_0x85bc('0x1f')];var _0x5dbc76=_0x3c926e?_0x41775e[_0x85bc('0x1e')]:_0x216c68[_0x85bc('0x1f')]+_0x216c68[_0x85bc('0x1d')];var _0x318649;if(_0x5dbc76>=_0x425d71){_0x5dbc76=_0x425d71;_0x318649=0xc8;}else{_0x318649=0xce;}_0x522d59['status'](_0x318649);return _0x522d59[_0x85bc('0x20')](_0x85bc('0x21'),_0x1dab01+'-'+_0x5dbc76+'/'+_0x425d71)[_0x85bc('0x1b')](_0x41775e);}return null;};}function patchUpdates(_0x5aa137){return function(_0x320960){try{jsonpatch['apply'](_0x320960,_0x5aa137,!![]);}catch(_0x36d74b){return BPromise[_0x85bc('0x22')](_0x36d74b);}return _0x320960['save']();};}function saveUpdates(_0x21524d,_0x25b8d3){return function(_0x4fe1f2){if(_0x4fe1f2){return _0x4fe1f2[_0x85bc('0x23')](_0x21524d)['then'](function(_0x215f44){return _0x215f44;});}return null;};}function removeEntity(_0xb9ac81,_0x1dfe6f){return function(_0x1c4894){if(_0x1c4894){return _0x1c4894['destroy']()[_0x85bc('0x24')](function(){_0xb9ac81[_0x85bc('0x1a')](0xcc)[_0x85bc('0x25')]();});}};}function handleEntityNotFound(_0x2cb254,_0x24ca9b){return function(_0x26db38){if(!_0x26db38){_0x2cb254[_0x85bc('0x19')](0x194);}return _0x26db38;};}function handleError(_0x3fa065,_0x510281){_0x510281=_0x510281||0x1f4;return function(_0x112946){logger[_0x85bc('0x26')](_0x112946[_0x85bc('0x27')]);if(_0x112946['name']){delete _0x112946[_0x85bc('0x28')];}_0x3fa065['status'](_0x510281)[_0x85bc('0x29')](_0x112946);};}exports[_0x85bc('0x2a')]=function(_0x5bc74c,_0x257a7b){var _0x1c58de={},_0x5b55e3={},_0x977582={'count':0x0,'rows':[]};var _0x3bb8fd=_['map'](db[_0x85bc('0x2b')]['rawAttributes'],function(_0x5bfedb){return{'name':_0x5bfedb[_0x85bc('0x2c')],'type':_0x5bfedb['type'][_0x85bc('0x2d')]};});_0x5b55e3[_0x85bc('0x2e')]=_[_0x85bc('0x2f')](_0x3bb8fd,_0x85bc('0x28'));_0x5b55e3[_0x85bc('0x30')]=_[_0x85bc('0x31')](_0x5bc74c[_0x85bc('0x30')]);_0x5b55e3[_0x85bc('0x32')]=_[_0x85bc('0x33')](_0x5b55e3[_0x85bc('0x2e')],_0x5b55e3['query']);_0x1c58de[_0x85bc('0x34')]=_['intersection'](_0x5b55e3[_0x85bc('0x2e')],qs[_0x85bc('0x35')](_0x5bc74c[_0x85bc('0x30')]['fields']));_0x1c58de[_0x85bc('0x34')]=_0x1c58de['attributes'][_0x85bc('0x36')]?_0x1c58de[_0x85bc('0x34')]:_0x5b55e3[_0x85bc('0x2e')];if(!_0x5bc74c[_0x85bc('0x30')][_0x85bc('0x37')]('nolimit')){_0x1c58de[_0x85bc('0x1d')]=qs['limit'](_0x5bc74c['query'][_0x85bc('0x1d')]);_0x1c58de[_0x85bc('0x1f')]=qs['offset'](_0x5bc74c[_0x85bc('0x30')][_0x85bc('0x1f')]);}_0x1c58de[_0x85bc('0x38')]=qs[_0x85bc('0x39')](_0x5bc74c[_0x85bc('0x30')][_0x85bc('0x39')]);_0x1c58de['where']=qs[_0x85bc('0x32')](_['pick'](_0x5bc74c[_0x85bc('0x30')],_0x5b55e3['filters']),_0x3bb8fd);if(_0x5bc74c[_0x85bc('0x30')][_0x85bc('0x3a')]){_0x1c58de[_0x85bc('0x3b')]=_[_0x85bc('0x3c')](_0x1c58de[_0x85bc('0x3b')],{'$or':_[_0x85bc('0x2f')](_0x3bb8fd,function(_0x16a7d8){if(_0x16a7d8[_0x85bc('0x3d')]!==_0x85bc('0x3e')){var _0x276c60={};_0x276c60[_0x16a7d8[_0x85bc('0x28')]]={'$like':'%'+_0x5bc74c[_0x85bc('0x30')][_0x85bc('0x3a')]+'%'};return _0x276c60;}})});}_0x1c58de=_[_0x85bc('0x3c')]({},_0x1c58de,_0x5bc74c[_0x85bc('0x3f')]);var _0x25bfd1={'where':_0x1c58de[_0x85bc('0x3b')]};return db[_0x85bc('0x2b')][_0x85bc('0x1e')](_0x25bfd1)[_0x85bc('0x24')](function(_0x1a3167){_0x977582[_0x85bc('0x1e')]=_0x1a3167;if(_0x5bc74c[_0x85bc('0x30')][_0x85bc('0x40')]){_0x1c58de[_0x85bc('0x41')]=[{'all':!![]}];}return db[_0x85bc('0x2b')]['findAll'](_0x1c58de);})[_0x85bc('0x24')](function(_0x2a4ed0){_0x977582[_0x85bc('0x42')]=_0x2a4ed0;return _0x977582;})['then'](respondWithFilteredResult(_0x257a7b,_0x1c58de))[_0x85bc('0x43')](handleError(_0x257a7b,null));};exports[_0x85bc('0x44')]=function(_0x5ac838,_0x2f6c42){var _0x9cde31={'raw':!![],'where':{'id':_0x5ac838[_0x85bc('0x45')]['id']}},_0x598743={};_0x598743['model']=_[_0x85bc('0x31')](db['SugarcrmField'][_0x85bc('0x46')]);_0x598743[_0x85bc('0x30')]=_[_0x85bc('0x31')](_0x5ac838[_0x85bc('0x30')]);_0x598743[_0x85bc('0x32')]=_['intersection'](_0x598743[_0x85bc('0x2e')],_0x598743[_0x85bc('0x30')]);_0x9cde31[_0x85bc('0x34')]=_[_0x85bc('0x33')](_0x598743[_0x85bc('0x2e')],qs[_0x85bc('0x35')](_0x5ac838[_0x85bc('0x30')][_0x85bc('0x35')]));_0x9cde31['attributes']=_0x9cde31[_0x85bc('0x34')][_0x85bc('0x36')]?_0x9cde31['attributes']:_0x598743['model'];if(_0x5ac838[_0x85bc('0x30')][_0x85bc('0x40')]){_0x9cde31[_0x85bc('0x41')]=[{'all':!![]}];}_0x9cde31=_['merge']({},_0x9cde31,_0x5ac838[_0x85bc('0x3f')]);return db[_0x85bc('0x2b')][_0x85bc('0x47')](_0x9cde31)[_0x85bc('0x24')](handleEntityNotFound(_0x2f6c42,null))[_0x85bc('0x24')](respondWithResult(_0x2f6c42,null))[_0x85bc('0x43')](handleError(_0x2f6c42,null));};exports['create']=function(_0xd0765,_0x3bbfea){return db[_0x85bc('0x2b')][_0x85bc('0x48')](_0xd0765[_0x85bc('0x49')],{})[_0x85bc('0x24')](respondWithResult(_0x3bbfea,0xc9))[_0x85bc('0x43')](handleError(_0x3bbfea,null));};exports[_0x85bc('0x23')]=function(_0x601adc,_0x509f25){if(_0x601adc['body']['id']){delete _0x601adc[_0x85bc('0x49')]['id'];}return db[_0x85bc('0x2b')]['find']({'where':{'id':_0x601adc['params']['id']}})[_0x85bc('0x24')](handleEntityNotFound(_0x509f25,null))[_0x85bc('0x24')](saveUpdates(_0x601adc['body'],null))['then'](respondWithResult(_0x509f25,null))[_0x85bc('0x43')](handleError(_0x509f25,null));};exports[_0x85bc('0x4a')]=function(_0x146a94,_0x206136){return db['SugarcrmField'][_0x85bc('0x47')]({'where':{'id':_0x146a94[_0x85bc('0x45')]['id']}})[_0x85bc('0x24')](handleEntityNotFound(_0x206136,null))[_0x85bc('0x24')](removeEntity(_0x206136,null))[_0x85bc('0x43')](handleError(_0x206136,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index bec8b8b..41d55b4 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 _0x44b2=['moment','request-promise','path','../../config/environment','./intSugarcrmField.attributes','exports','define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId','lodash','util','api'];(function(_0x3535c6,_0xe0076d){var _0x3049c9=function(_0x4f6707){while(--_0x4f6707){_0x3535c6['push'](_0x3535c6['shift']());}};_0x3049c9(++_0xe0076d);}(_0x44b2,0x192));var _0x244b=function(_0x59b111,_0x1b5f76){_0x59b111=_0x59b111-0x0;var _0x3e0750=_0x44b2[_0x59b111];return _0x3e0750;};'use strict';var _=require(_0x244b('0x0'));var util=require(_0x244b('0x1'));var logger=require('../../config/logger')(_0x244b('0x2'));var moment=require(_0x244b('0x3'));var BPromise=require('bluebird');var rp=require(_0x244b('0x4'));var fs=require('fs');var path=require(_0x244b('0x5'));var rimraf=require('rimraf');var config=require(_0x244b('0x6'));var attributes=require(_0x244b('0x7'));module[_0x244b('0x8')]=function(_0x158608,_0x10ea3c){return _0x158608[_0x244b('0x9')](_0x244b('0xa'),attributes,{'tableName':_0x244b('0xb'),'paranoid':![],'indexes':[{'name':_0x244b('0xc'),'fields':[_0x244b('0xd'),_0x244b('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2b12=['api','request-promise','exports','define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','idField','lodash','util','../../config/logger'];(function(_0x26c4cc,_0x336db6){var _0xd7be80=function(_0x137595){while(--_0x137595){_0x26c4cc['push'](_0x26c4cc['shift']());}};_0xd7be80(++_0x336db6);}(_0x2b12,0xd9));var _0x22b1=function(_0x2c463f,_0x2383c8){_0x2c463f=_0x2c463f-0x0;var _0x2988d4=_0x2b12[_0x2c463f];return _0x2988d4;};'use strict';var _=require(_0x22b1('0x0'));var util=require(_0x22b1('0x1'));var logger=require(_0x22b1('0x2'))(_0x22b1('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x22b1('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intSugarcrmField.attributes');module[_0x22b1('0x5')]=function(_0x26da4b,_0x1bc06d){return _0x26da4b[_0x22b1('0x6')](_0x22b1('0x7'),attributes,{'tableName':_0x22b1('0x8'),'paranoid':![],'indexes':[{'name':_0x22b1('0x9'),'fields':[_0x22b1('0xa'),'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 1ef75dc..fd520a1 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 _0xec2b=['../../config/environment','jayson/promise','http','request','then','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','bluebird','../../mysqldb','../../config/utils','rpc'];(function(_0x11e075,_0x27faf0){var _0x1362a8=function(_0x4fdab4){while(--_0x4fdab4){_0x11e075['push'](_0x11e075['shift']());}};_0x1362a8(++_0x27faf0);}(_0xec2b,0x19e));var _0xbec2=function(_0x325467,_0x4cff05){_0x325467=_0x325467-0x0;var _0x3c4462=_0xec2b[_0x325467];return _0x3c4462;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xbec2('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbec2('0x1'))['db'];var utils=require(_0xbec2('0x2'));var logger=require('../../config/logger')(_0xbec2('0x3'));var config=require(_0xbec2('0x4'));var jayson=require(_0xbec2('0x5'));var client=jayson['client'][_0xbec2('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x2dd5b5,_0x2dd569,_0x1d51ef){return new BPromise(function(_0x1f0f8f,_0x284f45){return client[_0xbec2('0x7')](_0x2dd5b5,_0x1d51ef)[_0xbec2('0x8')](function(_0x15c7b6){logger[_0xbec2('0x9')](_0xbec2('0xa'),_0x2dd569,_0xbec2('0xb'));logger[_0xbec2('0xc')](_0xbec2('0xd'),_0x2dd569,'request\x20sent',JSON[_0xbec2('0xe')](_0x15c7b6));if(_0x15c7b6[_0xbec2('0xf')]){if(_0x15c7b6[_0xbec2('0xf')][_0xbec2('0x10')]===0x1f4){logger[_0xbec2('0xf')](_0xbec2('0xa'),_0x2dd569,_0x15c7b6[_0xbec2('0xf')][_0xbec2('0x11')]);return _0x284f45(_0x15c7b6[_0xbec2('0xf')]['message']);}logger[_0xbec2('0xf')](_0xbec2('0xa'),_0x2dd569,_0x15c7b6[_0xbec2('0xf')]['message']);return _0x1f0f8f(_0x15c7b6['error']['message']);}else{logger[_0xbec2('0x9')](_0xbec2('0xa'),_0x2dd569,_0xbec2('0xb'));_0x1f0f8f(_0x15c7b6['result'][_0xbec2('0x11')]);}})[_0xbec2('0x12')](function(_0x35dc36){logger[_0xbec2('0xf')]('SugarcrmField,\x20%s,\x20%s',_0x2dd569,_0x35dc36);_0x284f45(_0x35dc36);});});} \ No newline at end of file +var _0xc4c1=['SugarcrmField,\x20%s,\x20%s','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0xc4c1,0x1eb));var _0x1c4c=function(_0x51e4d7,_0xa1584c){_0x51e4d7=_0x51e4d7-0x0;var _0x9e4467=_0xc4c1[_0x51e4d7];return _0x9e4467;};'use strict';var _=require(_0x1c4c('0x0'));var util=require(_0x1c4c('0x1'));var moment=require(_0x1c4c('0x2'));var BPromise=require(_0x1c4c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1c4c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1c4c('0x5'));var logger=require(_0x1c4c('0x6'))(_0x1c4c('0x7'));var config=require('../../config/environment');var jayson=require(_0x1c4c('0x8'));var client=jayson[_0x1c4c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5c97d9,_0x7e7bb5,_0x25607d){return new BPromise(function(_0x412592,_0x5430b2){return client[_0x1c4c('0xa')](_0x5c97d9,_0x25607d)[_0x1c4c('0xb')](function(_0x6df3f8){logger[_0x1c4c('0xc')](_0x1c4c('0xd'),_0x7e7bb5,'request\x20sent');logger[_0x1c4c('0xe')](_0x1c4c('0xf'),_0x7e7bb5,'request\x20sent',JSON[_0x1c4c('0x10')](_0x6df3f8));if(_0x6df3f8[_0x1c4c('0x11')]){if(_0x6df3f8['error']['code']===0x1f4){logger[_0x1c4c('0x11')](_0x1c4c('0xd'),_0x7e7bb5,_0x6df3f8[_0x1c4c('0x11')][_0x1c4c('0x12')]);return _0x5430b2(_0x6df3f8[_0x1c4c('0x11')][_0x1c4c('0x12')]);}logger['error'](_0x1c4c('0xd'),_0x7e7bb5,_0x6df3f8['error'][_0x1c4c('0x12')]);return _0x412592(_0x6df3f8[_0x1c4c('0x11')]['message']);}else{logger['info'](_0x1c4c('0xd'),_0x7e7bb5,_0x1c4c('0x13'));_0x412592(_0x6df3f8['result']['message']);}})[_0x1c4c('0x14')](function(_0x1dd9ee){logger[_0x1c4c('0x11')](_0x1c4c('0xd'),_0x7e7bb5,_0x1dd9ee);_0x5430b2(_0x1dd9ee);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index df4128f..73374fb 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 _0xe79f=['index','get','isAuthenticated','show','/:id/configurations','/:id/fields','getFields','post','addConfiguration','put','/:id','update','delete','destroy','multer','path','express','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller'];(function(_0x1142fe,_0x29f150){var _0x2a4379=function(_0x528acb){while(--_0x528acb){_0x1142fe['push'](_0x1142fe['shift']());}};_0x2a4379(++_0x29f150);}(_0xe79f,0x13a));var _0xfe79=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe79f[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xfe79('0x0'));var util=require('util');var path=require(_0xfe79('0x1'));var timeout=require('connect-timeout');var express=require(_0xfe79('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xfe79('0x3'));var config=require(_0xfe79('0x4'));var controller=require(_0xfe79('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0xfe79('0x6')]);router[_0xfe79('0x7')]('/:id',auth[_0xfe79('0x8')](),controller[_0xfe79('0x9')]);router['get'](_0xfe79('0xa'),auth[_0xfe79('0x8')](),controller['getConfigurations']);router['get'](_0xfe79('0xb'),auth[_0xfe79('0x8')](),controller[_0xfe79('0xc')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xfe79('0xd')]('/:id/configurations',auth[_0xfe79('0x8')](),controller[_0xfe79('0xe')]);router[_0xfe79('0xf')](_0xfe79('0x10'),auth['isAuthenticated'](),controller[_0xfe79('0x11')]);router[_0xfe79('0x12')](_0xfe79('0x10'),auth[_0xfe79('0x8')](),controller[_0xfe79('0x13')]);module['exports']=router; \ No newline at end of file +var _0x567c=['addConfiguration','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post'];(function(_0x12849b,_0x686435){var _0x16f709=function(_0x865a17){while(--_0x865a17){_0x12849b['push'](_0x12849b['shift']());}};_0x16f709(++_0x686435);}(_0x567c,0x8d));var _0xc567=function(_0x24eb5a,_0x371fdf){_0x24eb5a=_0x24eb5a-0x0;var _0x5d3141=_0x567c[_0x24eb5a];return _0x5d3141;};'use strict';var multer=require(_0xc567('0x0'));var util=require(_0xc567('0x1'));var path=require(_0xc567('0x2'));var timeout=require(_0xc567('0x3'));var express=require(_0xc567('0x4'));var router=express[_0xc567('0x5')]();var fs_extra=require(_0xc567('0x6'));var auth=require(_0xc567('0x7'));var interaction=require(_0xc567('0x8'));var config=require(_0xc567('0x9'));var controller=require(_0xc567('0xa'));router[_0xc567('0xb')]('/',auth[_0xc567('0xc')](),controller[_0xc567('0xd')]);router[_0xc567('0xb')](_0xc567('0xe'),auth[_0xc567('0xc')](),controller[_0xc567('0xf')]);router[_0xc567('0xb')](_0xc567('0x10'),auth[_0xc567('0xc')](),controller[_0xc567('0x11')]);router['get'](_0xc567('0x12'),auth['isAuthenticated'](),controller[_0xc567('0x13')]);router[_0xc567('0x14')]('/',auth[_0xc567('0xc')](),controller['create']);router[_0xc567('0x14')]('/:id/configurations',auth[_0xc567('0xc')](),controller[_0xc567('0x15')]);router[_0xc567('0x16')](_0xc567('0xe'),auth['isAuthenticated'](),controller[_0xc567('0x17')]);router[_0xc567('0x18')](_0xc567('0xe'),auth['isAuthenticated'](),controller[_0xc567('0x19')]);module[_0xc567('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index aeb18d4..132beb2 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 _0x4d9d=['STRING','exports'];(function(_0x63c794,_0x14f52c){var _0x16f319=function(_0x149940){while(--_0x149940){_0x63c794['push'](_0x63c794['shift']());}};_0x16f319(++_0x14f52c);}(_0x4d9d,0x159));var _0xd4d9=function(_0x406696,_0x39f9b1){_0x406696=_0x406696-0x0;var _0x10e35c=_0x4d9d[_0x406696];return _0x10e35c;};'use strict';var Sequelize=require('sequelize');module[_0xd4d9('0x0')]={'name':{'type':Sequelize[_0xd4d9('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xd4d9('0x1')]},'username':{'type':Sequelize[_0xd4d9('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize[_0xd4d9('0x1')],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize[_0xd4d9('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xd4d9('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize[_0xd4d9('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x04e4=['sequelize','STRING','HelpDesk'];(function(_0x5a4088,_0x42c282){var _0x19baac=function(_0x5f37e7){while(--_0x5f37e7){_0x5a4088['push'](_0x5a4088['shift']());}};_0x19baac(++_0x42c282);}(_0x04e4,0xed));var _0x404e=function(_0x4a2f27,_0x5e29cc){_0x4a2f27=_0x4a2f27-0x0;var _0x51a04b=_0x04e4[_0x4a2f27];return _0x51a04b;};'use strict';var Sequelize=require(_0x404e('0x0'));module['exports']={'name':{'type':Sequelize[_0x404e('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x404e('0x1')]},'username':{'type':Sequelize[_0x404e('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x404e('0x1')],'allowNull':![],'defaultValue':_0x404e('0x2')},'remoteUri':{'type':Sequelize[_0x404e('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x404e('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x404e('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 29b97dd..26f1ba0 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 _0x5865=['cf_','picklist','picklistValues','value','log','test','statusCode','stringify','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','VtigerAccount','includeAll','include','rows','show','params','keys','create','catch','body','find','getConfigurations','findOne','addConfiguration','Subjects','getSubjects','channel','getDescriptions','VtigerField','Descriptions','getFields','username','description','moduleName','remoteUri','serverUrl','slice','lastIndexOf','%s/webservice.php','GET','getchallenge','success','POST','result','token','describe','sessionName','autogenerated','owner','remove','includes','editable','label','startsWith'];(function(_0x5b0761,_0x388bad){var _0x237b2a=function(_0x84e481){while(--_0x84e481){_0x5b0761['push'](_0x5b0761['shift']());}};_0x237b2a(++_0x388bad);}(_0x5865,0x1dd));var _0x5586=function(_0xf5ee72,_0x415e96){_0xf5ee72=_0xf5ee72-0x0;var _0x5e4f68=_0x5865[_0xf5ee72];return _0x5e4f68;};'use strict';var emlformat=require(_0x5586('0x0'));var rimraf=require(_0x5586('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5586('0x2'));var rp=require(_0x5586('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x5586('0x4'));var path=require(_0x5586('0x5'));var sox=require(_0x5586('0x6'));var csv=require(_0x5586('0x7'));var ejs=require(_0x5586('0x8'));var fs=require('fs');var fs_extra=require(_0x5586('0x9'));var _=require(_0x5586('0xa'));var squel=require(_0x5586('0xb'));var crypto=require(_0x5586('0xc'));var jsforce=require(_0x5586('0xd'));var deskjs=require(_0x5586('0xe'));var toCsv=require(_0x5586('0x7'));var querystring=require(_0x5586('0xf'));var Papa=require(_0x5586('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x5586('0x11'));var hardwareService=require(_0x5586('0x12'));var logger=require('../../config/logger')(_0x5586('0x13'));var utils=require(_0x5586('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x5586('0x15'));var db=require(_0x5586('0x16'))['db'];var integrations=require(_0x5586('0x17'));function respondWithStatusCode(_0x3961fb,_0x2a3d4c){_0x2a3d4c=_0x2a3d4c||0xcc;return function(_0x254869){if(_0x254869){return _0x3961fb['sendStatus'](_0x2a3d4c);}return _0x3961fb[_0x5586('0x18')](_0x2a3d4c)['end']();};}function respondWithResult(_0x26d741,_0x266355){_0x266355=_0x266355||0xc8;return function(_0x227e76){if(_0x227e76){return _0x26d741[_0x5586('0x18')](_0x266355)[_0x5586('0x19')](_0x227e76);}};}function respondWithFilteredResult(_0x1d552f,_0x16946c){return function(_0x1cefa7){if(_0x1cefa7){var _0x2a9726=typeof _0x16946c[_0x5586('0x1a')]==='undefined'&&typeof _0x16946c[_0x5586('0x1b')]===_0x5586('0x1c');var _0x1c3dae=_0x1cefa7[_0x5586('0x1d')];var _0x698e53=_0x2a9726?0x0:_0x16946c[_0x5586('0x1a')];var _0x3ffb9f=_0x2a9726?_0x1cefa7[_0x5586('0x1d')]:_0x16946c[_0x5586('0x1a')]+_0x16946c[_0x5586('0x1b')];var _0x3694f3;if(_0x3ffb9f>=_0x1c3dae){_0x3ffb9f=_0x1c3dae;_0x3694f3=0xc8;}else{_0x3694f3=0xce;}_0x1d552f[_0x5586('0x18')](_0x3694f3);return _0x1d552f['set'](_0x5586('0x1e'),_0x698e53+'-'+_0x3ffb9f+'/'+_0x1c3dae)['json'](_0x1cefa7);}return null;};}function patchUpdates(_0x4be5d7){return function(_0x20644d){try{jsonpatch[_0x5586('0x1f')](_0x20644d,_0x4be5d7,!![]);}catch(_0xf48bdf){return BPromise[_0x5586('0x20')](_0xf48bdf);}return _0x20644d[_0x5586('0x21')]();};}function saveUpdates(_0xe503a7,_0x518c9b){return function(_0xcb3a74){if(_0xcb3a74){return _0xcb3a74[_0x5586('0x22')](_0xe503a7)[_0x5586('0x23')](function(_0x5f5cb9){return _0x5f5cb9;});}return null;};}function removeEntity(_0x167102,_0x35d455){return function(_0x509df7){if(_0x509df7){return _0x509df7[_0x5586('0x24')]()[_0x5586('0x23')](function(){_0x167102[_0x5586('0x18')](0xcc)[_0x5586('0x25')]();});}};}function handleEntityNotFound(_0x2d8d08,_0x109cc8){return function(_0x4f56d1){if(!_0x4f56d1){_0x2d8d08[_0x5586('0x26')](0x194);}return _0x4f56d1;};}function handleError(_0x43b2fb,_0x44b082){_0x44b082=_0x44b082||0x1f4;return function(_0x639093){logger[_0x5586('0x27')](_0x639093[_0x5586('0x28')]);if(_0x639093[_0x5586('0x29')]){delete _0x639093[_0x5586('0x29')];}_0x43b2fb['status'](_0x44b082)[_0x5586('0x2a')](_0x639093);};}exports['index']=function(_0x203a1e,_0x449767){var _0x42a679={},_0xa63dd6={},_0x3230ab={'count':0x0,'rows':[]};var _0x1beed0=_[_0x5586('0x2b')](db['VtigerAccount'][_0x5586('0x2c')],function(_0x58c0ac){return{'name':_0x58c0ac[_0x5586('0x2d')],'type':_0x58c0ac[_0x5586('0x2e')][_0x5586('0x2f')]};});_0xa63dd6[_0x5586('0x30')]=_[_0x5586('0x2b')](_0x1beed0,'name');_0xa63dd6[_0x5586('0x31')]=_['keys'](_0x203a1e['query']);_0xa63dd6[_0x5586('0x32')]=_[_0x5586('0x33')](_0xa63dd6[_0x5586('0x30')],_0xa63dd6[_0x5586('0x31')]);_0x42a679['attributes']=_['intersection'](_0xa63dd6[_0x5586('0x30')],qs[_0x5586('0x34')](_0x203a1e[_0x5586('0x31')]['fields']));_0x42a679[_0x5586('0x35')]=_0x42a679[_0x5586('0x35')][_0x5586('0x36')]?_0x42a679[_0x5586('0x35')]:_0xa63dd6[_0x5586('0x30')];if(!_0x203a1e[_0x5586('0x31')][_0x5586('0x37')]('nolimit')){_0x42a679[_0x5586('0x1b')]=qs[_0x5586('0x1b')](_0x203a1e['query'][_0x5586('0x1b')]);_0x42a679['offset']=qs[_0x5586('0x1a')](_0x203a1e[_0x5586('0x31')][_0x5586('0x1a')]);}_0x42a679[_0x5586('0x38')]=qs[_0x5586('0x39')](_0x203a1e[_0x5586('0x31')]['sort']);_0x42a679[_0x5586('0x3a')]=qs[_0x5586('0x32')](_[_0x5586('0x3b')](_0x203a1e['query'],_0xa63dd6[_0x5586('0x32')]),_0x1beed0);if(_0x203a1e[_0x5586('0x31')][_0x5586('0x3c')]){_0x42a679[_0x5586('0x3a')]=_['merge'](_0x42a679['where'],{'$or':_['map'](_0x1beed0,function(_0x589ab6){if(_0x589ab6[_0x5586('0x2e')]!==_0x5586('0x3d')){var _0x506f82={};_0x506f82[_0x589ab6[_0x5586('0x29')]]={'$like':'%'+_0x203a1e[_0x5586('0x31')][_0x5586('0x3c')]+'%'};return _0x506f82;}})});}_0x42a679=_[_0x5586('0x3e')]({},_0x42a679,_0x203a1e[_0x5586('0x3f')]);var _0x5bd5a4={'where':_0x42a679[_0x5586('0x3a')]};return db[_0x5586('0x40')][_0x5586('0x1d')](_0x5bd5a4)[_0x5586('0x23')](function(_0x10f92d){_0x3230ab[_0x5586('0x1d')]=_0x10f92d;if(_0x203a1e[_0x5586('0x31')][_0x5586('0x41')]){_0x42a679[_0x5586('0x42')]=[{'all':!![]}];}return db['VtigerAccount']['findAll'](_0x42a679);})[_0x5586('0x23')](function(_0x5a8446){_0x3230ab[_0x5586('0x43')]=_0x5a8446;return _0x3230ab;})[_0x5586('0x23')](respondWithFilteredResult(_0x449767,_0x42a679))['catch'](handleError(_0x449767,null));};exports[_0x5586('0x44')]=function(_0xef4c41,_0x4bdc0a){var _0x35afaf={'raw':![],'where':{'id':_0xef4c41[_0x5586('0x45')]['id']}},_0x29495c={};_0x29495c[_0x5586('0x30')]=_[_0x5586('0x46')](db['VtigerAccount']['rawAttributes']);_0x29495c[_0x5586('0x31')]=_[_0x5586('0x46')](_0xef4c41[_0x5586('0x31')]);_0x29495c[_0x5586('0x32')]=_['intersection'](_0x29495c[_0x5586('0x30')],_0x29495c[_0x5586('0x31')]);_0x35afaf['attributes']=_['intersection'](_0x29495c[_0x5586('0x30')],qs[_0x5586('0x34')](_0xef4c41['query'][_0x5586('0x34')]));_0x35afaf[_0x5586('0x35')]=_0x35afaf['attributes'][_0x5586('0x36')]?_0x35afaf[_0x5586('0x35')]:_0x29495c[_0x5586('0x30')];if(_0xef4c41[_0x5586('0x31')]['includeAll']){_0x35afaf[_0x5586('0x42')]=[{'all':!![]}];}_0x35afaf=_[_0x5586('0x3e')]({},_0x35afaf,_0xef4c41[_0x5586('0x3f')]);return db[_0x5586('0x40')]['find'](_0x35afaf)[_0x5586('0x23')](handleEntityNotFound(_0x4bdc0a,null))['then'](respondWithResult(_0x4bdc0a,null))['catch'](handleError(_0x4bdc0a,null));};exports[_0x5586('0x47')]=function(_0x17c275,_0x3f07e9){return db['VtigerAccount'][_0x5586('0x47')](_0x17c275['body'],{})[_0x5586('0x23')](respondWithResult(_0x3f07e9,0xc9))[_0x5586('0x48')](handleError(_0x3f07e9,null));};exports[_0x5586('0x22')]=function(_0x2d8d70,_0x13d37d){if(_0x2d8d70[_0x5586('0x49')]['id']){delete _0x2d8d70['body']['id'];}return db['VtigerAccount'][_0x5586('0x4a')]({'where':{'id':_0x2d8d70[_0x5586('0x45')]['id']}})[_0x5586('0x23')](handleEntityNotFound(_0x13d37d,null))[_0x5586('0x23')](saveUpdates(_0x2d8d70[_0x5586('0x49')],null))[_0x5586('0x23')](respondWithResult(_0x13d37d,null))['catch'](handleError(_0x13d37d,null));};exports[_0x5586('0x24')]=function(_0x231047,_0x3e2f34){return db[_0x5586('0x40')]['find']({'where':{'id':_0x231047[_0x5586('0x45')]['id']}})[_0x5586('0x23')](handleEntityNotFound(_0x3e2f34,null))['then'](removeEntity(_0x3e2f34,null))[_0x5586('0x48')](handleError(_0x3e2f34,null));};exports[_0x5586('0x4b')]=function(_0x1860df,_0x4f1ff5,_0x12a629){var _0x56be61={};var _0x486486={};var _0x2faa15;var _0x80ec63;return db['VtigerAccount'][_0x5586('0x4c')]({'where':{'id':_0x1860df[_0x5586('0x45')]['id']}})[_0x5586('0x23')](handleEntityNotFound(_0x4f1ff5,null))[_0x5586('0x23')](function(_0x3c48d8){if(_0x3c48d8){_0x2faa15=_0x3c48d8;_0x486486[_0x5586('0x30')]=_[_0x5586('0x46')](db['VtigerConfiguration'][_0x5586('0x2c')]);_0x486486[_0x5586('0x31')]=_[_0x5586('0x46')](_0x1860df['query']);_0x486486['filters']=_['intersection'](_0x486486['model'],_0x486486[_0x5586('0x31')]);_0x56be61['attributes']=_[_0x5586('0x33')](_0x486486['model'],qs[_0x5586('0x34')](_0x1860df[_0x5586('0x31')][_0x5586('0x34')]));_0x56be61[_0x5586('0x35')]=_0x56be61[_0x5586('0x35')]['length']?_0x56be61[_0x5586('0x35')]:_0x486486[_0x5586('0x30')];_0x56be61[_0x5586('0x38')]=qs[_0x5586('0x39')](_0x1860df[_0x5586('0x31')][_0x5586('0x39')]);_0x56be61[_0x5586('0x3a')]=qs[_0x5586('0x32')](_[_0x5586('0x3b')](_0x1860df[_0x5586('0x31')],_0x486486[_0x5586('0x32')]));if(_0x1860df[_0x5586('0x31')]['filter']){_0x56be61[_0x5586('0x3a')]=_[_0x5586('0x3e')](_0x56be61[_0x5586('0x3a')],{'$or':_['map'](_0x56be61[_0x5586('0x35')],function(_0x1fb6cc){var _0x1d685e={};_0x1d685e[_0x1fb6cc]={'$like':'%'+_0x1860df[_0x5586('0x31')]['filter']+'%'};return _0x1d685e;})});}_0x56be61=_[_0x5586('0x3e')]({},_0x56be61,_0x1860df[_0x5586('0x3f')]);return _0x2faa15[_0x5586('0x4b')](_0x56be61);}})[_0x5586('0x23')](function(_0x11c7bc){if(_0x11c7bc){_0x80ec63=_0x11c7bc['length'];if(!_0x1860df['query'][_0x5586('0x37')]('nolimit')){_0x56be61[_0x5586('0x1b')]=qs['limit'](_0x1860df['query']['limit']);_0x56be61[_0x5586('0x1a')]=qs[_0x5586('0x1a')](_0x1860df[_0x5586('0x31')][_0x5586('0x1a')]);}return _0x2faa15['getConfigurations'](_0x56be61);}})[_0x5586('0x23')](function(_0x56d62f){if(_0x56d62f){return _0x56d62f?{'count':_0x80ec63,'rows':_0x56d62f}:null;}})['then'](respondWithResult(_0x4f1ff5,null))[_0x5586('0x48')](handleError(_0x4f1ff5,null));};exports[_0x5586('0x4d')]=function(_0x202759,_0xd005dc,_0x446808){if(_0x202759[_0x5586('0x49')]['id']){delete _0x202759['body']['id'];}return db['VtigerAccount'][_0x5586('0x4c')]({'where':{'id':_0x202759[_0x5586('0x45')]['id']}})['then'](handleEntityNotFound(_0xd005dc,null))[_0x5586('0x23')](function(_0x34e11b){if(_0x34e11b){_0x202759[_0x5586('0x49')]['AccountId']=_0x34e11b['id'];_0x202759['body'][_0x5586('0x4e')]=integrations[_0x5586('0x4f')](_0x202759[_0x5586('0x49')][_0x5586('0x50')],_0x202759[_0x5586('0x49')][_0x5586('0x2e')]);_0x202759[_0x5586('0x49')]['Descriptions']=integrations[_0x5586('0x51')](_0x202759[_0x5586('0x49')][_0x5586('0x50')],_0x202759[_0x5586('0x49')][_0x5586('0x2e')]);return db['VtigerConfiguration'][_0x5586('0x47')](_0x202759[_0x5586('0x49')],{'include':[{'model':db[_0x5586('0x52')],'as':_0x5586('0x4e')},{'model':db[_0x5586('0x52')],'as':_0x5586('0x53')}]});}return null;})['then'](respondWithResult(_0xd005dc,null))['catch'](handleError(_0xd005dc,null));};var md5=require('md5');exports[_0x5586('0x54')]=function(_0x28de9e,_0x1a7d0e,_0x44cec4){var _0xad211d=null;var _0x428011=null;var _0x2e3602=null;var _0x36672e=null;var _0x429235='';return db[_0x5586('0x40')][_0x5586('0x4c')]({'where':{'id':_0x28de9e['params']['id']},'attributes':['id',_0x5586('0x29'),_0x5586('0x55'),_0x5586('0x56'),_0x5586('0x57'),_0x5586('0x58'),_0x5586('0x59'),'accessKey']})[_0x5586('0x23')](handleEntityNotFound(_0x1a7d0e,null))[_0x5586('0x23')](function(_0x38e1bc){if(_0x38e1bc){_0xad211d=_0x38e1bc['username'];_0x428011=_0x38e1bc['accessKey'];_0x2e3602=_0x38e1bc[_0x5586('0x57')];_0x429235=_0x38e1bc[_0x5586('0x58')];var _0x1a0d26=_0x429235[_0x5586('0x5a')](-0x1);if(_0x1a0d26==='/'){_0x429235=_0x429235['substring'](0x0,_0x429235[_0x5586('0x5b')](_0x1a0d26));}_0x36672e=util['format'](_0x5586('0x5c'),_0x429235);var _0x5ed6e6={'method':_0x5586('0x5d'),'uri':_0x36672e,'qs':{'operation':_0x5586('0x5e'),'username':_0x38e1bc[_0x5586('0x55')]},'json':!![]};return rp(_0x5ed6e6);}})['then'](function(_0x215bc8){if(_0x215bc8[_0x5586('0x5f')]){var _0x5e7745={'method':_0x5586('0x60'),'uri':_0x36672e,'form':{'operation':'login','username':_0xad211d,'accessKey':md5(_0x215bc8[_0x5586('0x61')][_0x5586('0x62')]+_0x428011)},'json':!![]};return rp(_0x5e7745);}})[_0x5586('0x23')](function(_0x3d0f21){if(_0x3d0f21[_0x5586('0x5f')]){var _0x5067f6={'method':'GET','uri':_0x36672e,'qs':{'operation':_0x5586('0x63'),'username':_0xad211d,'sessionName':_0x3d0f21[_0x5586('0x61')][_0x5586('0x64')],'elementType':_0x2e3602},'json':!![]};return rp(_0x5067f6);}})[_0x5586('0x23')](function(_0x4c9eb4){if(_0x4c9eb4[_0x5586('0x5f')]){var _0x79a449=[_0x5586('0x65'),'reference',_0x5586('0x66')];_[_0x5586('0x67')](_0x4c9eb4['result'][_0x5586('0x34')],function(_0x5e7b4e){return _0x79a449[_0x5586('0x68')](_0x5e7b4e['type'][_0x5586('0x29')]);});_[_0x5586('0x67')](_0x4c9eb4[_0x5586('0x61')]['fields'],function(_0x3f71b9){return _0x3f71b9[_0x5586('0x69')]==='false';});return{'count':_0x4c9eb4[_0x5586('0x61')][_0x5586('0x34')][_0x5586('0x36')],'rows':_[_0x5586('0x2b')](_0x4c9eb4[_0x5586('0x61')][_0x5586('0x34')],function(_0x59ead3){return{'id':_0x59ead3[_0x5586('0x29')],'name':_0x59ead3[_0x5586('0x6a')],'custom':_[_0x5586('0x6b')](_0x59ead3[_0x5586('0x29')],_0x5586('0x6c'))?!![]:![],'options':_0x59ead3[_0x5586('0x2e')][_0x5586('0x29')]===_0x5586('0x6d')&&_0x59ead3[_0x5586('0x2e')][_0x5586('0x6e')][_0x5586('0x36')]>0x0?_[_0x5586('0x2b')](_0x59ead3[_0x5586('0x2e')][_0x5586('0x6e')],function(_0x16d148){return{'name':_0x16d148['label'],'value':_0x16d148[_0x5586('0x6f')]};}):[]};})};}})[_0x5586('0x23')](respondWithResult(_0x1a7d0e,null))[_0x5586('0x48')](function(_0x252d00){console[_0x5586('0x70')]('vTiger\x20error:\x20'+_0x252d00);var _0x12e302=_0x28de9e[_0x5586('0x31')][_0x5586('0x71')]?0x1f4:_0x252d00[_0x5586('0x72')]||0x1f4;logger[_0x5586('0x27')]('getFields,\x20%s,\x20%s,\x20%s',_0x5586('0x54'),_0x12e302,JSON[_0x5586('0x73')](_0x252d00));delete _0x252d00[_0x5586('0x29')];if(_0x12e302===0x191){_0x12e302=0x190;}_0x1a7d0e['status'](_0x12e302)[_0x5586('0x2a')](_0x28de9e[_0x5586('0x31')][_0x5586('0x71')]?{'message':_0x5586('0x74'),'statusCode':_0x252d00[_0x5586('0x72')]}:_0x252d00);});}; \ No newline at end of file +var _0x032f=['test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../mysqldb','../../components/integrations/configuration','end','json','offset','undefined','limit','count','status','set','apply','reject','update','then','destroy','sendStatus','stack','name','send','index','map','VtigerAccount','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','rawAttributes','find','body','getConfigurations','findOne','addConfiguration','Subjects','channel','Descriptions','getDescriptions','VtigerConfiguration','create','VtigerField','md5','username','description','moduleName','serverUrl','accessKey','remoteUri','slice','substring','format','%s/webservice.php','getchallenge','success','POST','login','result','token','sessionName','autogenerated','owner','includes','editable','false','label','startsWith','picklist','picklistValues','value','log','vTiger\x20error:\x20'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x032f,0x7b));var _0xf032=function(_0x971aaa,_0x5b02c0){_0x971aaa=_0x971aaa-0x0;var _0x2a0776=_0x032f[_0x971aaa];return _0x2a0776;};'use strict';var emlformat=require(_0xf032('0x0'));var rimraf=require(_0xf032('0x1'));var zipdir=require(_0xf032('0x2'));var jsonpatch=require(_0xf032('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf032('0x4'));var util=require(_0xf032('0x5'));var path=require(_0xf032('0x6'));var sox=require(_0xf032('0x7'));var csv=require(_0xf032('0x8'));var ejs=require(_0xf032('0x9'));var fs=require('fs');var fs_extra=require(_0xf032('0xa'));var _=require(_0xf032('0xb'));var squel=require(_0xf032('0xc'));var crypto=require(_0xf032('0xd'));var jsforce=require(_0xf032('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xf032('0x8'));var querystring=require(_0xf032('0xf'));var Papa=require(_0xf032('0x10'));var Redis=require(_0xf032('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xf032('0x12'));var as=require(_0xf032('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xf032('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xf032('0x15'))['db'];var integrations=require(_0xf032('0x16'));function respondWithStatusCode(_0x25ae7e,_0x21ea31){_0x21ea31=_0x21ea31||0xcc;return function(_0x21d32d){if(_0x21d32d){return _0x25ae7e['sendStatus'](_0x21ea31);}return _0x25ae7e['status'](_0x21ea31)[_0xf032('0x17')]();};}function respondWithResult(_0x3231d0,_0x17c4ab){_0x17c4ab=_0x17c4ab||0xc8;return function(_0x271b20){if(_0x271b20){return _0x3231d0['status'](_0x17c4ab)[_0xf032('0x18')](_0x271b20);}};}function respondWithFilteredResult(_0x3ce02f,_0x3eab9d){return function(_0x20ec95){if(_0x20ec95){var _0x3d896b=typeof _0x3eab9d[_0xf032('0x19')]===_0xf032('0x1a')&&typeof _0x3eab9d[_0xf032('0x1b')]===_0xf032('0x1a');var _0x4b1482=_0x20ec95['count'];var _0x17a86f=_0x3d896b?0x0:_0x3eab9d['offset'];var _0x26edfe=_0x3d896b?_0x20ec95[_0xf032('0x1c')]:_0x3eab9d[_0xf032('0x19')]+_0x3eab9d[_0xf032('0x1b')];var _0x3c663f;if(_0x26edfe>=_0x4b1482){_0x26edfe=_0x4b1482;_0x3c663f=0xc8;}else{_0x3c663f=0xce;}_0x3ce02f[_0xf032('0x1d')](_0x3c663f);return _0x3ce02f[_0xf032('0x1e')]('Content-Range',_0x17a86f+'-'+_0x26edfe+'/'+_0x4b1482)[_0xf032('0x18')](_0x20ec95);}return null;};}function patchUpdates(_0x3a7bd1){return function(_0x452a4b){try{jsonpatch[_0xf032('0x1f')](_0x452a4b,_0x3a7bd1,!![]);}catch(_0x4f2f99){return BPromise[_0xf032('0x20')](_0x4f2f99);}return _0x452a4b['save']();};}function saveUpdates(_0xe129d2,_0x2264dc){return function(_0x1e37e5){if(_0x1e37e5){return _0x1e37e5[_0xf032('0x21')](_0xe129d2)[_0xf032('0x22')](function(_0xda000b){return _0xda000b;});}return null;};}function removeEntity(_0x40273a,_0x3fe17f){return function(_0x2e0142){if(_0x2e0142){return _0x2e0142[_0xf032('0x23')]()['then'](function(){_0x40273a['status'](0xcc)[_0xf032('0x17')]();});}};}function handleEntityNotFound(_0xd84588,_0x19ec26){return function(_0x156f9f){if(!_0x156f9f){_0xd84588[_0xf032('0x24')](0x194);}return _0x156f9f;};}function handleError(_0x3905b9,_0x258f1f){_0x258f1f=_0x258f1f||0x1f4;return function(_0x5e3124){logger['error'](_0x5e3124[_0xf032('0x25')]);if(_0x5e3124[_0xf032('0x26')]){delete _0x5e3124['name'];}_0x3905b9[_0xf032('0x1d')](_0x258f1f)[_0xf032('0x27')](_0x5e3124);};}exports[_0xf032('0x28')]=function(_0x513d46,_0x40e7ef){var _0x33281e={},_0x24ff6d={},_0x5c4b5a={'count':0x0,'rows':[]};var _0x1684cd=_[_0xf032('0x29')](db[_0xf032('0x2a')]['rawAttributes'],function(_0x2a1ff3){return{'name':_0x2a1ff3[_0xf032('0x2b')],'type':_0x2a1ff3[_0xf032('0x2c')][_0xf032('0x2d')]};});_0x24ff6d['model']=_['map'](_0x1684cd,_0xf032('0x26'));_0x24ff6d[_0xf032('0x2e')]=_[_0xf032('0x2f')](_0x513d46[_0xf032('0x2e')]);_0x24ff6d[_0xf032('0x30')]=_[_0xf032('0x31')](_0x24ff6d[_0xf032('0x32')],_0x24ff6d[_0xf032('0x2e')]);_0x33281e[_0xf032('0x33')]=_[_0xf032('0x31')](_0x24ff6d['model'],qs[_0xf032('0x34')](_0x513d46[_0xf032('0x2e')][_0xf032('0x34')]));_0x33281e[_0xf032('0x33')]=_0x33281e['attributes'][_0xf032('0x35')]?_0x33281e[_0xf032('0x33')]:_0x24ff6d[_0xf032('0x32')];if(!_0x513d46['query'][_0xf032('0x36')](_0xf032('0x37'))){_0x33281e[_0xf032('0x1b')]=qs['limit'](_0x513d46[_0xf032('0x2e')][_0xf032('0x1b')]);_0x33281e[_0xf032('0x19')]=qs[_0xf032('0x19')](_0x513d46[_0xf032('0x2e')]['offset']);}_0x33281e[_0xf032('0x38')]=qs[_0xf032('0x39')](_0x513d46[_0xf032('0x2e')][_0xf032('0x39')]);_0x33281e[_0xf032('0x3a')]=qs[_0xf032('0x30')](_[_0xf032('0x3b')](_0x513d46[_0xf032('0x2e')],_0x24ff6d[_0xf032('0x30')]),_0x1684cd);if(_0x513d46[_0xf032('0x2e')][_0xf032('0x3c')]){_0x33281e[_0xf032('0x3a')]=_['merge'](_0x33281e['where'],{'$or':_['map'](_0x1684cd,function(_0x39e177){if(_0x39e177['type']!==_0xf032('0x3d')){var _0x35bdff={};_0x35bdff[_0x39e177['name']]={'$like':'%'+_0x513d46[_0xf032('0x2e')][_0xf032('0x3c')]+'%'};return _0x35bdff;}})});}_0x33281e=_[_0xf032('0x3e')]({},_0x33281e,_0x513d46[_0xf032('0x3f')]);var _0x39d484={'where':_0x33281e['where']};return db[_0xf032('0x2a')][_0xf032('0x1c')](_0x39d484)[_0xf032('0x22')](function(_0x1fdcd7){_0x5c4b5a[_0xf032('0x1c')]=_0x1fdcd7;if(_0x513d46['query'][_0xf032('0x40')]){_0x33281e[_0xf032('0x41')]=[{'all':!![]}];}return db[_0xf032('0x2a')][_0xf032('0x42')](_0x33281e);})[_0xf032('0x22')](function(_0x285d45){_0x5c4b5a['rows']=_0x285d45;return _0x5c4b5a;})['then'](respondWithFilteredResult(_0x40e7ef,_0x33281e))[_0xf032('0x43')](handleError(_0x40e7ef,null));};exports[_0xf032('0x44')]=function(_0x5c07d1,_0x250581){var _0x2e5a54={'raw':![],'where':{'id':_0x5c07d1[_0xf032('0x45')]['id']}},_0x166097={};_0x166097[_0xf032('0x32')]=_[_0xf032('0x2f')](db[_0xf032('0x2a')][_0xf032('0x46')]);_0x166097[_0xf032('0x2e')]=_['keys'](_0x5c07d1[_0xf032('0x2e')]);_0x166097[_0xf032('0x30')]=_['intersection'](_0x166097['model'],_0x166097[_0xf032('0x2e')]);_0x2e5a54[_0xf032('0x33')]=_['intersection'](_0x166097['model'],qs['fields'](_0x5c07d1[_0xf032('0x2e')][_0xf032('0x34')]));_0x2e5a54[_0xf032('0x33')]=_0x2e5a54[_0xf032('0x33')][_0xf032('0x35')]?_0x2e5a54['attributes']:_0x166097[_0xf032('0x32')];if(_0x5c07d1[_0xf032('0x2e')][_0xf032('0x40')]){_0x2e5a54[_0xf032('0x41')]=[{'all':!![]}];}_0x2e5a54=_['merge']({},_0x2e5a54,_0x5c07d1[_0xf032('0x3f')]);return db[_0xf032('0x2a')][_0xf032('0x47')](_0x2e5a54)[_0xf032('0x22')](handleEntityNotFound(_0x250581,null))[_0xf032('0x22')](respondWithResult(_0x250581,null))['catch'](handleError(_0x250581,null));};exports['create']=function(_0x552705,_0x39ae4c){return db[_0xf032('0x2a')]['create'](_0x552705[_0xf032('0x48')],{})[_0xf032('0x22')](respondWithResult(_0x39ae4c,0xc9))[_0xf032('0x43')](handleError(_0x39ae4c,null));};exports[_0xf032('0x21')]=function(_0x5501b6,_0x145429){if(_0x5501b6['body']['id']){delete _0x5501b6['body']['id'];}return db[_0xf032('0x2a')][_0xf032('0x47')]({'where':{'id':_0x5501b6[_0xf032('0x45')]['id']}})[_0xf032('0x22')](handleEntityNotFound(_0x145429,null))[_0xf032('0x22')](saveUpdates(_0x5501b6[_0xf032('0x48')],null))[_0xf032('0x22')](respondWithResult(_0x145429,null))[_0xf032('0x43')](handleError(_0x145429,null));};exports[_0xf032('0x23')]=function(_0x1dcf39,_0x91de0e){return db['VtigerAccount'][_0xf032('0x47')]({'where':{'id':_0x1dcf39[_0xf032('0x45')]['id']}})['then'](handleEntityNotFound(_0x91de0e,null))[_0xf032('0x22')](removeEntity(_0x91de0e,null))['catch'](handleError(_0x91de0e,null));};exports[_0xf032('0x49')]=function(_0x4fd33e,_0x20a4e4,_0x5bbb5f){var _0xc8df79={};var _0x47da60={};var _0x1a2c84;var _0xa716c9;return db[_0xf032('0x2a')][_0xf032('0x4a')]({'where':{'id':_0x4fd33e['params']['id']}})[_0xf032('0x22')](handleEntityNotFound(_0x20a4e4,null))[_0xf032('0x22')](function(_0x5a8bdd){if(_0x5a8bdd){_0x1a2c84=_0x5a8bdd;_0x47da60['model']=_[_0xf032('0x2f')](db['VtigerConfiguration'][_0xf032('0x46')]);_0x47da60['query']=_[_0xf032('0x2f')](_0x4fd33e[_0xf032('0x2e')]);_0x47da60[_0xf032('0x30')]=_['intersection'](_0x47da60[_0xf032('0x32')],_0x47da60['query']);_0xc8df79[_0xf032('0x33')]=_['intersection'](_0x47da60[_0xf032('0x32')],qs['fields'](_0x4fd33e[_0xf032('0x2e')][_0xf032('0x34')]));_0xc8df79[_0xf032('0x33')]=_0xc8df79[_0xf032('0x33')][_0xf032('0x35')]?_0xc8df79[_0xf032('0x33')]:_0x47da60[_0xf032('0x32')];_0xc8df79[_0xf032('0x38')]=qs[_0xf032('0x39')](_0x4fd33e[_0xf032('0x2e')][_0xf032('0x39')]);_0xc8df79['where']=qs[_0xf032('0x30')](_[_0xf032('0x3b')](_0x4fd33e['query'],_0x47da60[_0xf032('0x30')]));if(_0x4fd33e[_0xf032('0x2e')][_0xf032('0x3c')]){_0xc8df79[_0xf032('0x3a')]=_[_0xf032('0x3e')](_0xc8df79[_0xf032('0x3a')],{'$or':_[_0xf032('0x29')](_0xc8df79['attributes'],function(_0xeda642){var _0x17a8dc={};_0x17a8dc[_0xeda642]={'$like':'%'+_0x4fd33e[_0xf032('0x2e')]['filter']+'%'};return _0x17a8dc;})});}_0xc8df79=_[_0xf032('0x3e')]({},_0xc8df79,_0x4fd33e[_0xf032('0x3f')]);return _0x1a2c84[_0xf032('0x49')](_0xc8df79);}})[_0xf032('0x22')](function(_0x14f7d1){if(_0x14f7d1){_0xa716c9=_0x14f7d1['length'];if(!_0x4fd33e['query'][_0xf032('0x36')](_0xf032('0x37'))){_0xc8df79['limit']=qs['limit'](_0x4fd33e[_0xf032('0x2e')]['limit']);_0xc8df79['offset']=qs[_0xf032('0x19')](_0x4fd33e['query'][_0xf032('0x19')]);}return _0x1a2c84['getConfigurations'](_0xc8df79);}})[_0xf032('0x22')](function(_0x7ed354){if(_0x7ed354){return _0x7ed354?{'count':_0xa716c9,'rows':_0x7ed354}:null;}})[_0xf032('0x22')](respondWithResult(_0x20a4e4,null))[_0xf032('0x43')](handleError(_0x20a4e4,null));};exports[_0xf032('0x4b')]=function(_0x20f929,_0x9a8d9,_0x131614){if(_0x20f929[_0xf032('0x48')]['id']){delete _0x20f929[_0xf032('0x48')]['id'];}return db[_0xf032('0x2a')]['findOne']({'where':{'id':_0x20f929[_0xf032('0x45')]['id']}})[_0xf032('0x22')](handleEntityNotFound(_0x9a8d9,null))[_0xf032('0x22')](function(_0x2cb47e){if(_0x2cb47e){_0x20f929[_0xf032('0x48')]['AccountId']=_0x2cb47e['id'];_0x20f929[_0xf032('0x48')][_0xf032('0x4c')]=integrations['getSubjects'](_0x20f929[_0xf032('0x48')][_0xf032('0x4d')],_0x20f929[_0xf032('0x48')][_0xf032('0x2c')]);_0x20f929[_0xf032('0x48')][_0xf032('0x4e')]=integrations[_0xf032('0x4f')](_0x20f929[_0xf032('0x48')][_0xf032('0x4d')],_0x20f929[_0xf032('0x48')][_0xf032('0x2c')]);return db[_0xf032('0x50')][_0xf032('0x51')](_0x20f929[_0xf032('0x48')],{'include':[{'model':db[_0xf032('0x52')],'as':_0xf032('0x4c')},{'model':db[_0xf032('0x52')],'as':_0xf032('0x4e')}]});}return null;})['then'](respondWithResult(_0x9a8d9,null))[_0xf032('0x43')](handleError(_0x9a8d9,null));};var md5=require(_0xf032('0x53'));exports['getFields']=function(_0x4a2e3c,_0x3cd73c,_0x107421){var _0x274eb9=null;var _0x1f3195=null;var _0x6f1f94=null;var _0x5d0dff=null;var _0x2e83cc='';return db[_0xf032('0x2a')][_0xf032('0x4a')]({'where':{'id':_0x4a2e3c[_0xf032('0x45')]['id']},'attributes':['id',_0xf032('0x26'),_0xf032('0x54'),_0xf032('0x55'),_0xf032('0x56'),'remoteUri',_0xf032('0x57'),_0xf032('0x58')]})['then'](handleEntityNotFound(_0x3cd73c,null))['then'](function(_0x520e9d){if(_0x520e9d){_0x274eb9=_0x520e9d[_0xf032('0x54')];_0x1f3195=_0x520e9d[_0xf032('0x58')];_0x6f1f94=_0x520e9d[_0xf032('0x56')];_0x2e83cc=_0x520e9d[_0xf032('0x59')];var _0x5e4663=_0x2e83cc[_0xf032('0x5a')](-0x1);if(_0x5e4663==='/'){_0x2e83cc=_0x2e83cc[_0xf032('0x5b')](0x0,_0x2e83cc['lastIndexOf'](_0x5e4663));}_0x5d0dff=util[_0xf032('0x5c')](_0xf032('0x5d'),_0x2e83cc);var _0x5cafde={'method':'GET','uri':_0x5d0dff,'qs':{'operation':_0xf032('0x5e'),'username':_0x520e9d['username']},'json':!![]};return rp(_0x5cafde);}})[_0xf032('0x22')](function(_0x417907){if(_0x417907[_0xf032('0x5f')]){var _0x2bda3f={'method':_0xf032('0x60'),'uri':_0x5d0dff,'form':{'operation':_0xf032('0x61'),'username':_0x274eb9,'accessKey':md5(_0x417907[_0xf032('0x62')][_0xf032('0x63')]+_0x1f3195)},'json':!![]};return rp(_0x2bda3f);}})[_0xf032('0x22')](function(_0x408400){if(_0x408400['success']){var _0x5f2813={'method':'GET','uri':_0x5d0dff,'qs':{'operation':'describe','username':_0x274eb9,'sessionName':_0x408400[_0xf032('0x62')][_0xf032('0x64')],'elementType':_0x6f1f94},'json':!![]};return rp(_0x5f2813);}})[_0xf032('0x22')](function(_0x423076){if(_0x423076['success']){var _0x31be8a=[_0xf032('0x65'),'reference',_0xf032('0x66')];_['remove'](_0x423076[_0xf032('0x62')][_0xf032('0x34')],function(_0x4cfee7){return _0x31be8a[_0xf032('0x67')](_0x4cfee7[_0xf032('0x2c')][_0xf032('0x26')]);});_['remove'](_0x423076['result'][_0xf032('0x34')],function(_0x109fd0){return _0x109fd0[_0xf032('0x68')]===_0xf032('0x69');});return{'count':_0x423076[_0xf032('0x62')]['fields']['length'],'rows':_[_0xf032('0x29')](_0x423076[_0xf032('0x62')][_0xf032('0x34')],function(_0x108010){return{'id':_0x108010[_0xf032('0x26')],'name':_0x108010[_0xf032('0x6a')],'custom':_[_0xf032('0x6b')](_0x108010[_0xf032('0x26')],'cf_')?!![]:![],'options':_0x108010[_0xf032('0x2c')]['name']===_0xf032('0x6c')&&_0x108010[_0xf032('0x2c')][_0xf032('0x6d')]['length']>0x0?_[_0xf032('0x29')](_0x108010[_0xf032('0x2c')][_0xf032('0x6d')],function(_0x19bd0a){return{'name':_0x19bd0a[_0xf032('0x6a')],'value':_0x19bd0a[_0xf032('0x6e')]};}):[]};})};}})[_0xf032('0x22')](respondWithResult(_0x3cd73c,null))[_0xf032('0x43')](function(_0x21de09){console[_0xf032('0x6f')](_0xf032('0x70')+_0x21de09);var _0x238a7f=_0x4a2e3c[_0xf032('0x2e')][_0xf032('0x71')]?0x1f4:_0x21de09[_0xf032('0x72')]||0x1f4;logger['error'](_0xf032('0x73'),'getFields',_0x238a7f,JSON[_0xf032('0x74')](_0x21de09));delete _0x21de09['name'];if(_0x238a7f===0x191){_0x238a7f=0x190;}_0x3cd73c[_0xf032('0x1d')](_0x238a7f)['send'](_0x4a2e3c[_0xf032('0x2e')][_0xf032('0x71')]?{'message':_0xf032('0x75'),'statusCode':_0x21de09[_0xf032('0x72')]}:_0x21de09);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 92374cb..7f84c86 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 _0x0f30=['VtigerAccount','int_vtiger_accounts','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','exports','define'];(function(_0x18f152,_0x41585a){var _0xa10b34=function(_0x1e9798){while(--_0x1e9798){_0x18f152['push'](_0x18f152['shift']());}};_0xa10b34(++_0x41585a);}(_0x0f30,0xda));var _0x00f3=function(_0x24e2a3,_0x534875){_0x24e2a3=_0x24e2a3-0x0;var _0x3e82f4=_0x0f30[_0x24e2a3];return _0x3e82f4;};'use strict';var _=require(_0x00f3('0x0'));var util=require(_0x00f3('0x1'));var logger=require(_0x00f3('0x2'))(_0x00f3('0x3'));var moment=require(_0x00f3('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x00f3('0x5'));var rimraf=require(_0x00f3('0x6'));var config=require(_0x00f3('0x7'));var attributes=require('./intVtigerAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x00f3('0x8')]=function(_0x2dd272,_0x36f433){return _0x2dd272[_0x00f3('0x9')](_0x00f3('0xa'),attributes,{'tableName':_0x00f3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x739b=['../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','VtigerAccount','int_vtiger_accounts','lodash','../../config/logger','api','moment','path','rimraf'];(function(_0x3294be,_0x24aa1c){var _0x106bce=function(_0x5a565b){while(--_0x5a565b){_0x3294be['push'](_0x3294be['shift']());}};_0x106bce(++_0x24aa1c);}(_0x739b,0x96));var _0xb739=function(_0x10c2de,_0x700f2d){_0x10c2de=_0x10c2de-0x0;var _0x2429a9=_0x739b[_0x10c2de];return _0x2429a9;};'use strict';var _=require(_0xb739('0x0'));var util=require('util');var logger=require(_0xb739('0x1'))(_0xb739('0x2'));var moment=require(_0xb739('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb739('0x4'));var rimraf=require(_0xb739('0x5'));var config=require(_0xb739('0x6'));var attributes=require(_0xb739('0x7'));var integrations=require(_0xb739('0x8'));module[_0xb739('0x9')]=function(_0x39dbdc,_0x2b76e5){return _0x39dbdc[_0xb739('0xa')](_0xb739('0xb'),attributes,{'tableName':_0xb739('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 b48de71..91407ed 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 _0xeb74=['attributes','model','stringify','ShowVtigerAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','VtigerAccount,\x20%s,\x20%s','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','GetVtigerAccount','VtigerAccount','findAll','options','raw','where','limit','include','map'];(function(_0x41e0dc,_0x4c0126){var _0x42443d=function(_0x1623f6){while(--_0x1623f6){_0x41e0dc['push'](_0x41e0dc['shift']());}};_0x42443d(++_0x4c0126);}(_0xeb74,0xe3));var _0x4eb7=function(_0x18a941,_0x4df48d){_0x18a941=_0x18a941-0x0;var _0x588ccf=_0xeb74[_0x18a941];return _0x588ccf;};'use strict';var _=require(_0x4eb7('0x0'));var util=require(_0x4eb7('0x1'));var moment=require(_0x4eb7('0x2'));var BPromise=require(_0x4eb7('0x3'));var rs=require(_0x4eb7('0x4'));var fs=require('fs');var Redis=require(_0x4eb7('0x5'));var db=require(_0x4eb7('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x4eb7('0x7'))(_0x4eb7('0x8'));var config=require(_0x4eb7('0x9'));var jayson=require(_0x4eb7('0xa'));var client=jayson[_0x4eb7('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3986cd,_0x54859c,_0xcac7c5){return new BPromise(function(_0x2cffe7,_0x588a1c){return client['request'](_0x3986cd,_0xcac7c5)[_0x4eb7('0xc')](function(_0x2f8296){logger['info'](_0x4eb7('0xd'),_0x54859c,'request\x20sent');logger[_0x4eb7('0xe')](_0x4eb7('0xf'),_0x54859c,_0x4eb7('0x10'),JSON['stringify'](_0x2f8296));if(_0x2f8296[_0x4eb7('0x11')]){if(_0x2f8296[_0x4eb7('0x11')][_0x4eb7('0x12')]===0x1f4){logger[_0x4eb7('0x11')](_0x4eb7('0xd'),_0x54859c,_0x2f8296[_0x4eb7('0x11')][_0x4eb7('0x13')]);return _0x588a1c(_0x2f8296['error']['message']);}logger['error'](_0x4eb7('0xd'),_0x54859c,_0x2f8296['error'][_0x4eb7('0x13')]);return _0x2cffe7(_0x2f8296[_0x4eb7('0x11')][_0x4eb7('0x13')]);}else{logger[_0x4eb7('0x14')](_0x4eb7('0xd'),_0x54859c,_0x4eb7('0x10'));_0x2cffe7(_0x2f8296[_0x4eb7('0x15')][_0x4eb7('0x13')]);}})[_0x4eb7('0x16')](function(_0x17377f){logger['error'](_0x4eb7('0xd'),_0x54859c,_0x17377f);_0x588a1c(_0x17377f);});});}exports[_0x4eb7('0x17')]=function(_0x3b6d41){var _0xf14478=this;return new Promise(function(_0x302e16,_0x44f1b9){return db[_0x4eb7('0x18')][_0x4eb7('0x19')]({'raw':_0x3b6d41['options']?_0x3b6d41[_0x4eb7('0x1a')][_0x4eb7('0x1b')]===undefined?!![]:![]:!![],'where':_0x3b6d41[_0x4eb7('0x1a')]?_0x3b6d41[_0x4eb7('0x1a')][_0x4eb7('0x1c')]||null:null,'attributes':_0x3b6d41[_0x4eb7('0x1a')]?_0x3b6d41[_0x4eb7('0x1a')]['attributes']||null:null,'limit':_0x3b6d41[_0x4eb7('0x1a')]?_0x3b6d41[_0x4eb7('0x1a')][_0x4eb7('0x1d')]||null:null,'include':_0x3b6d41[_0x4eb7('0x1a')]?_0x3b6d41[_0x4eb7('0x1a')][_0x4eb7('0x1e')]?_[_0x4eb7('0x1f')](_0x3b6d41[_0x4eb7('0x1a')][_0x4eb7('0x1e')],function(_0x13e871){return{'model':db[_0x13e871['model']],'as':_0x13e871['as'],'attributes':_0x13e871[_0x4eb7('0x20')],'include':_0x13e871[_0x4eb7('0x1e')]?_[_0x4eb7('0x1f')](_0x13e871[_0x4eb7('0x1e')],function(_0x3e0da2){return{'model':db[_0x3e0da2[_0x4eb7('0x21')]],'as':_0x3e0da2['as'],'attributes':_0x3e0da2[_0x4eb7('0x20')],'include':_0x3e0da2[_0x4eb7('0x1e')]?_[_0x4eb7('0x1f')](_0x3e0da2[_0x4eb7('0x1e')],function(_0xf83c11){return{'model':db[_0xf83c11[_0x4eb7('0x21')]],'as':_0xf83c11['as'],'attributes':_0xf83c11[_0x4eb7('0x20')]};}):[]};}):[]};}):[]:[]})[_0x4eb7('0xc')](function(_0x433794){logger[_0x4eb7('0x14')](_0x4eb7('0x17'),_0x3b6d41);logger[_0x4eb7('0xe')](_0x4eb7('0x17'),_0x3b6d41,JSON[_0x4eb7('0x22')](_0x433794));_0x302e16(_0x433794);})[_0x4eb7('0x16')](function(_0x17030a){logger[_0x4eb7('0x11')]('GetVtigerAccount',_0x17030a[_0x4eb7('0x13')],_0x3b6d41);_0x44f1b9(_0xf14478['error'](0x1f4,_0x17030a[_0x4eb7('0x13')]));});});};exports[_0x4eb7('0x23')]=function(_0xc5aa21){var _0x1fe298=this;return new Promise(function(_0x468195,_0x1cec8e){return db[_0x4eb7('0x18')][_0x4eb7('0x24')]({'raw':_0xc5aa21[_0x4eb7('0x1a')]?_0xc5aa21['options'][_0x4eb7('0x1b')]===undefined?!![]:![]:!![],'where':_0xc5aa21['options']?_0xc5aa21[_0x4eb7('0x1a')][_0x4eb7('0x1c')]||null:null,'attributes':_0xc5aa21['options']?_0xc5aa21['options'][_0x4eb7('0x20')]||null:null,'include':_0xc5aa21[_0x4eb7('0x1a')]?_0xc5aa21[_0x4eb7('0x1a')][_0x4eb7('0x1e')]?_['map'](_0xc5aa21[_0x4eb7('0x1a')][_0x4eb7('0x1e')],function(_0xcc9bb4){return{'model':db[_0xcc9bb4[_0x4eb7('0x21')]],'as':_0xcc9bb4['as'],'attributes':_0xcc9bb4[_0x4eb7('0x20')],'include':_0xcc9bb4['include']?_[_0x4eb7('0x1f')](_0xcc9bb4[_0x4eb7('0x1e')],function(_0x31cc6d){return{'model':db[_0x31cc6d['model']],'as':_0x31cc6d['as'],'attributes':_0x31cc6d[_0x4eb7('0x20')],'include':_0x31cc6d[_0x4eb7('0x1e')]?_[_0x4eb7('0x1f')](_0x31cc6d['include'],function(_0x70f2b2){return{'model':db[_0x70f2b2['model']],'as':_0x70f2b2['as'],'attributes':_0x70f2b2[_0x4eb7('0x20')]};}):[]};}):[]};}):[]:[]})[_0x4eb7('0xc')](function(_0x392fa3){logger[_0x4eb7('0x14')]('ShowVtigerAccount',_0xc5aa21);logger[_0x4eb7('0xe')](_0x4eb7('0x23'),_0xc5aa21,JSON[_0x4eb7('0x22')](_0x392fa3));_0x468195(_0x392fa3);})[_0x4eb7('0x16')](function(_0x4f0cce){logger['error']('ShowVtigerAccount',_0x4f0cce[_0x4eb7('0x13')],_0xc5aa21);_0x1cec8e(_0x1fe298[_0x4eb7('0x11')](0x1f4,_0x4f0cce[_0x4eb7('0x13')]));});});}; \ No newline at end of file +var _0x750a=['util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','stringify','error','code','VtigerAccount,\x20%s,\x20%s','message','catch','options','raw','attributes','limit','model','include','map','GetVtigerAccount','ShowVtigerAccount','VtigerAccount','where'];(function(_0x81926a,_0x56b99d){var _0x833fb1=function(_0xd73a44){while(--_0xd73a44){_0x81926a['push'](_0x81926a['shift']());}};_0x833fb1(++_0x56b99d);}(_0x750a,0x140));var _0xa750=function(_0x15da16,_0x279689){_0x15da16=_0x15da16-0x0;var _0x498922=_0x750a[_0x15da16];return _0x498922;};'use strict';var _=require('lodash');var util=require(_0xa750('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa750('0x1'));var fs=require('fs');var Redis=require(_0xa750('0x2'));var db=require(_0xa750('0x3'))['db'];var utils=require(_0xa750('0x4'));var logger=require(_0xa750('0x5'))(_0xa750('0x6'));var config=require(_0xa750('0x7'));var jayson=require(_0xa750('0x8'));var client=jayson[_0xa750('0x9')][_0xa750('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x197299,_0x1ae455,_0x3d7c43){return new BPromise(function(_0x47a4dd,_0x53f2cb){return client[_0xa750('0xb')](_0x197299,_0x3d7c43)['then'](function(_0x4458b1){logger[_0xa750('0xc')]('VtigerAccount,\x20%s,\x20%s',_0x1ae455,_0xa750('0xd'));logger[_0xa750('0xe')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x1ae455,'request\x20sent',JSON[_0xa750('0xf')](_0x4458b1));if(_0x4458b1['error']){if(_0x4458b1[_0xa750('0x10')][_0xa750('0x11')]===0x1f4){logger['error'](_0xa750('0x12'),_0x1ae455,_0x4458b1[_0xa750('0x10')][_0xa750('0x13')]);return _0x53f2cb(_0x4458b1['error'][_0xa750('0x13')]);}logger[_0xa750('0x10')](_0xa750('0x12'),_0x1ae455,_0x4458b1[_0xa750('0x10')][_0xa750('0x13')]);return _0x47a4dd(_0x4458b1[_0xa750('0x10')]['message']);}else{logger[_0xa750('0xc')](_0xa750('0x12'),_0x1ae455,_0xa750('0xd'));_0x47a4dd(_0x4458b1['result'][_0xa750('0x13')]);}})[_0xa750('0x14')](function(_0x58639b){logger['error'](_0xa750('0x12'),_0x1ae455,_0x58639b);_0x53f2cb(_0x58639b);});});}exports['GetVtigerAccount']=function(_0x433dbd){var _0x1bde87=this;return new Promise(function(_0x4f1faa,_0x36dcca){return db['VtigerAccount']['findAll']({'raw':_0x433dbd[_0xa750('0x15')]?_0x433dbd['options'][_0xa750('0x16')]===undefined?!![]:![]:!![],'where':_0x433dbd['options']?_0x433dbd[_0xa750('0x15')]['where']||null:null,'attributes':_0x433dbd[_0xa750('0x15')]?_0x433dbd['options'][_0xa750('0x17')]||null:null,'limit':_0x433dbd['options']?_0x433dbd['options'][_0xa750('0x18')]||null:null,'include':_0x433dbd['options']?_0x433dbd[_0xa750('0x15')]['include']?_['map'](_0x433dbd['options']['include'],function(_0x15d72f){return{'model':db[_0x15d72f[_0xa750('0x19')]],'as':_0x15d72f['as'],'attributes':_0x15d72f[_0xa750('0x17')],'include':_0x15d72f[_0xa750('0x1a')]?_[_0xa750('0x1b')](_0x15d72f[_0xa750('0x1a')],function(_0x3001bc){return{'model':db[_0x3001bc[_0xa750('0x19')]],'as':_0x3001bc['as'],'attributes':_0x3001bc[_0xa750('0x17')],'include':_0x3001bc[_0xa750('0x1a')]?_[_0xa750('0x1b')](_0x3001bc[_0xa750('0x1a')],function(_0x31ea63){return{'model':db[_0x31ea63[_0xa750('0x19')]],'as':_0x31ea63['as'],'attributes':_0x31ea63[_0xa750('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3d3923){logger[_0xa750('0xc')](_0xa750('0x1c'),_0x433dbd);logger['debug'](_0xa750('0x1c'),_0x433dbd,JSON[_0xa750('0xf')](_0x3d3923));_0x4f1faa(_0x3d3923);})[_0xa750('0x14')](function(_0x1223d2){logger['error'](_0xa750('0x1c'),_0x1223d2[_0xa750('0x13')],_0x433dbd);_0x36dcca(_0x1bde87[_0xa750('0x10')](0x1f4,_0x1223d2[_0xa750('0x13')]));});});};exports[_0xa750('0x1d')]=function(_0x59ab33){var _0x46cc11=this;return new Promise(function(_0x4c2c9e,_0x2d0e93){return db[_0xa750('0x1e')]['find']({'raw':_0x59ab33[_0xa750('0x15')]?_0x59ab33[_0xa750('0x15')][_0xa750('0x16')]===undefined?!![]:![]:!![],'where':_0x59ab33[_0xa750('0x15')]?_0x59ab33[_0xa750('0x15')][_0xa750('0x1f')]||null:null,'attributes':_0x59ab33[_0xa750('0x15')]?_0x59ab33[_0xa750('0x15')]['attributes']||null:null,'include':_0x59ab33[_0xa750('0x15')]?_0x59ab33['options'][_0xa750('0x1a')]?_[_0xa750('0x1b')](_0x59ab33[_0xa750('0x15')][_0xa750('0x1a')],function(_0x556fde){return{'model':db[_0x556fde[_0xa750('0x19')]],'as':_0x556fde['as'],'attributes':_0x556fde[_0xa750('0x17')],'include':_0x556fde['include']?_[_0xa750('0x1b')](_0x556fde[_0xa750('0x1a')],function(_0x280b87){return{'model':db[_0x280b87[_0xa750('0x19')]],'as':_0x280b87['as'],'attributes':_0x280b87['attributes'],'include':_0x280b87[_0xa750('0x1a')]?_['map'](_0x280b87['include'],function(_0x4e59f3){return{'model':db[_0x4e59f3[_0xa750('0x19')]],'as':_0x4e59f3['as'],'attributes':_0x4e59f3[_0xa750('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x470089){logger[_0xa750('0xc')](_0xa750('0x1d'),_0x59ab33);logger['debug'](_0xa750('0x1d'),_0x59ab33,JSON[_0xa750('0xf')](_0x470089));_0x4c2c9e(_0x470089);})[_0xa750('0x14')](function(_0x5d402a){logger[_0xa750('0x10')](_0xa750('0x1d'),_0x5d402a[_0xa750('0x13')],_0x59ab33);_0x2d0e93(_0x46cc11['error'](0x1f4,_0x5d402a[_0xa750('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index d5c0ca5..3e9e46d 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 _0x2c67=['/:id/descriptions','getDescriptions','post','create','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects'];(function(_0xdd598a,_0x2f4169){var _0x18c8d7=function(_0x52be9c){while(--_0x52be9c){_0xdd598a['push'](_0xdd598a['shift']());}};_0x18c8d7(++_0x2f4169);}(_0x2c67,0xec));var _0x72c6=function(_0x1742bc,_0x67c564){_0x1742bc=_0x1742bc-0x0;var _0x3c8d9e=_0x2c67[_0x1742bc];return _0x3c8d9e;};'use strict';var multer=require(_0x72c6('0x0'));var util=require(_0x72c6('0x1'));var path=require('path');var timeout=require(_0x72c6('0x2'));var express=require(_0x72c6('0x3'));var router=express['Router']();var fs_extra=require(_0x72c6('0x4'));var auth=require(_0x72c6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x72c6('0x6'));var controller=require(_0x72c6('0x7'));router[_0x72c6('0x8')]('/',auth[_0x72c6('0x9')](),controller[_0x72c6('0xa')]);router[_0x72c6('0x8')](_0x72c6('0xb'),auth[_0x72c6('0x9')](),controller[_0x72c6('0xc')]);router[_0x72c6('0x8')](_0x72c6('0xd'),auth[_0x72c6('0x9')](),controller[_0x72c6('0xe')]);router['get'](_0x72c6('0xf'),auth['isAuthenticated'](),controller[_0x72c6('0x10')]);router[_0x72c6('0x8')](_0x72c6('0x11'),auth[_0x72c6('0x9')](),controller[_0x72c6('0x12')]);router[_0x72c6('0x13')]('/',auth[_0x72c6('0x9')](),controller[_0x72c6('0x14')]);router['put'](_0x72c6('0xb'),auth[_0x72c6('0x9')](),controller['update']);router['delete'](_0x72c6('0xb'),auth[_0x72c6('0x9')](),controller[_0x72c6('0x15')]);module[_0x72c6('0x16')]=router; \ No newline at end of file +var _0xa7d0=['/:id/subjects','/:id/descriptions','getDescriptions','create','/:id','update','delete','destroy','exports','multer','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated','show','/:id/fields','getFields'];(function(_0x2c3064,_0x3f4f72){var _0xba5392=function(_0x18387a){while(--_0x18387a){_0x2c3064['push'](_0x2c3064['shift']());}};_0xba5392(++_0x3f4f72);}(_0xa7d0,0x111));var _0x0a7d=function(_0x2a4bec,_0x20a306){_0x2a4bec=_0x2a4bec-0x0;var _0x16c939=_0xa7d0[_0x2a4bec];return _0x16c939;};'use strict';var multer=require(_0x0a7d('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0a7d('0x1'));var router=express[_0x0a7d('0x2')]();var fs_extra=require(_0x0a7d('0x3'));var auth=require(_0x0a7d('0x4'));var interaction=require(_0x0a7d('0x5'));var config=require(_0x0a7d('0x6'));var controller=require(_0x0a7d('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x0a7d('0x8')]('/:id',auth[_0x0a7d('0x9')](),controller[_0x0a7d('0xa')]);router[_0x0a7d('0x8')](_0x0a7d('0xb'),auth['isAuthenticated'](),controller[_0x0a7d('0xc')]);router['get'](_0x0a7d('0xd'),auth[_0x0a7d('0x9')](),controller['getSubjects']);router[_0x0a7d('0x8')](_0x0a7d('0xe'),auth[_0x0a7d('0x9')](),controller[_0x0a7d('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x0a7d('0x10')]);router['put'](_0x0a7d('0x11'),auth[_0x0a7d('0x9')](),controller[_0x0a7d('0x12')]);router[_0x0a7d('0x13')]('/:id',auth[_0x0a7d('0x9')](),controller[_0x0a7d('0x14')]);module[_0x0a7d('0x15')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 1b0f601..5081a70 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 _0xad64=['STRING','exports'];(function(_0x553279,_0x5e0fb1){var _0x54f4ac=function(_0x1d6888){while(--_0x1d6888){_0x553279['push'](_0x553279['shift']());}};_0x54f4ac(++_0x5e0fb1);}(_0xad64,0x177));var _0x4ad6=function(_0x1b4943,_0x48bd8d){_0x1b4943=_0x1b4943-0x0;var _0x1e91f0=_0xad64[_0x1b4943];return _0x1e91f0;};'use strict';var Sequelize=require('sequelize');module[_0x4ad6('0x0')]={'name':{'type':Sequelize[_0x4ad6('0x1')]},'description':{'type':Sequelize[_0x4ad6('0x1')]}}; \ No newline at end of file +var _0x429f=['sequelize','exports','STRING'];(function(_0xeadc11,_0x27e378){var _0x4257b6=function(_0x38bb40){while(--_0x38bb40){_0xeadc11['push'](_0xeadc11['shift']());}};_0x4257b6(++_0x27e378);}(_0x429f,0x156));var _0xf429=function(_0x200045,_0x4e5da1){_0x200045=_0x200045-0x0;var _0x566a8d=_0x429f[_0x200045];return _0x566a8d;};'use strict';var Sequelize=require(_0xf429('0x0'));module[_0xf429('0x1')]={'name':{'type':Sequelize[_0xf429('0x2')]},'description':{'type':Sequelize[_0xf429('0x2')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index d6fe99c..cf55328 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 _0xdb7c=['../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','count','Content-Range','apply','save','update','then','destroy','sendStatus','error','stack','name','index','VtigerConfiguration','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','limit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','catch','show','params','include','create','body','find','getFields','findOne','VtigerField','map','nolimit','order','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api'];(function(_0x2e6bf1,_0x42bdaa){var _0x52c91b=function(_0x508a1c){while(--_0x508a1c){_0x2e6bf1['push'](_0x2e6bf1['shift']());}};_0x52c91b(++_0x42bdaa);}(_0xdb7c,0xdb));var _0xcdb7=function(_0x322522,_0x4db288){_0x322522=_0x322522-0x0;var _0x293bcf=_0xdb7c[_0x322522];return _0x293bcf;};'use strict';var emlformat=require(_0xcdb7('0x0'));var rimraf=require(_0xcdb7('0x1'));var zipdir=require(_0xcdb7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcdb7('0x3'));var moment=require(_0xcdb7('0x4'));var BPromise=require(_0xcdb7('0x5'));var Mustache=require(_0xcdb7('0x6'));var util=require(_0xcdb7('0x7'));var path=require(_0xcdb7('0x8'));var sox=require(_0xcdb7('0x9'));var csv=require(_0xcdb7('0xa'));var ejs=require(_0xcdb7('0xb'));var fs=require('fs');var fs_extra=require(_0xcdb7('0xc'));var _=require(_0xcdb7('0xd'));var squel=require('squel');var crypto=require(_0xcdb7('0xe'));var jsforce=require(_0xcdb7('0xf'));var deskjs=require(_0xcdb7('0x10'));var toCsv=require(_0xcdb7('0xa'));var querystring=require(_0xcdb7('0x11'));var Papa=require(_0xcdb7('0x12'));var Redis=require(_0xcdb7('0x13'));var authService=require(_0xcdb7('0x14'));var qs=require(_0xcdb7('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xcdb7('0x16'))(_0xcdb7('0x17'));var utils=require(_0xcdb7('0x18'));var config=require(_0xcdb7('0x19'));var licenseUtil=require(_0xcdb7('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4ab24d,_0x560c02){_0x560c02=_0x560c02||0xcc;return function(_0x38b5c9){if(_0x38b5c9){return _0x4ab24d['sendStatus'](_0x560c02);}return _0x4ab24d[_0xcdb7('0x1b')](_0x560c02)[_0xcdb7('0x1c')]();};}function respondWithResult(_0xfed53,_0x1505e2){_0x1505e2=_0x1505e2||0xc8;return function(_0x22bc3f){if(_0x22bc3f){return _0xfed53['status'](_0x1505e2)[_0xcdb7('0x1d')](_0x22bc3f);}};}function respondWithFilteredResult(_0x2953be,_0x8bf9c8){return function(_0x15941b){if(_0x15941b){var _0x3863ac=typeof _0x8bf9c8['offset']==='undefined'&&typeof _0x8bf9c8['limit']==='undefined';var _0x2a6228=_0x15941b['count'];var _0x4fdce6=_0x3863ac?0x0:_0x8bf9c8[_0xcdb7('0x1e')];var _0xa719db=_0x3863ac?_0x15941b[_0xcdb7('0x1f')]:_0x8bf9c8[_0xcdb7('0x1e')]+_0x8bf9c8['limit'];var _0x4895e3;if(_0xa719db>=_0x2a6228){_0xa719db=_0x2a6228;_0x4895e3=0xc8;}else{_0x4895e3=0xce;}_0x2953be[_0xcdb7('0x1b')](_0x4895e3);return _0x2953be['set'](_0xcdb7('0x20'),_0x4fdce6+'-'+_0xa719db+'/'+_0x2a6228)[_0xcdb7('0x1d')](_0x15941b);}return null;};}function patchUpdates(_0x4cc2a7){return function(_0x5a40f3){try{jsonpatch[_0xcdb7('0x21')](_0x5a40f3,_0x4cc2a7,!![]);}catch(_0x1b2084){return BPromise['reject'](_0x1b2084);}return _0x5a40f3[_0xcdb7('0x22')]();};}function saveUpdates(_0x419c6a,_0x31594a){return function(_0x164820){if(_0x164820){return _0x164820[_0xcdb7('0x23')](_0x419c6a)[_0xcdb7('0x24')](function(_0x427683){return _0x427683;});}return null;};}function removeEntity(_0x9a37ab,_0x6561cd){return function(_0x368282){if(_0x368282){return _0x368282[_0xcdb7('0x25')]()['then'](function(){_0x9a37ab[_0xcdb7('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2bc594,_0x22866c){return function(_0x44351b){if(!_0x44351b){_0x2bc594[_0xcdb7('0x26')](0x194);}return _0x44351b;};}function handleError(_0x4e0499,_0x10964a){_0x10964a=_0x10964a||0x1f4;return function(_0x5ced42){logger[_0xcdb7('0x27')](_0x5ced42[_0xcdb7('0x28')]);if(_0x5ced42[_0xcdb7('0x29')]){delete _0x5ced42[_0xcdb7('0x29')];}_0x4e0499[_0xcdb7('0x1b')](_0x10964a)['send'](_0x5ced42);};}exports[_0xcdb7('0x2a')]=function(_0x5a7202,_0x36ad63){var _0x4ea499={},_0x3b8189={},_0x303126={'count':0x0,'rows':[]};var _0x1c1bd7=_['map'](db[_0xcdb7('0x2b')][_0xcdb7('0x2c')],function(_0x5d7a30){return{'name':_0x5d7a30['fieldName'],'type':_0x5d7a30[_0xcdb7('0x2d')][_0xcdb7('0x2e')]};});_0x3b8189[_0xcdb7('0x2f')]=_['map'](_0x1c1bd7,_0xcdb7('0x29'));_0x3b8189[_0xcdb7('0x30')]=_[_0xcdb7('0x31')](_0x5a7202[_0xcdb7('0x30')]);_0x3b8189[_0xcdb7('0x32')]=_[_0xcdb7('0x33')](_0x3b8189[_0xcdb7('0x2f')],_0x3b8189[_0xcdb7('0x30')]);_0x4ea499['attributes']=_[_0xcdb7('0x33')](_0x3b8189[_0xcdb7('0x2f')],qs[_0xcdb7('0x34')](_0x5a7202[_0xcdb7('0x30')][_0xcdb7('0x34')]));_0x4ea499[_0xcdb7('0x35')]=_0x4ea499[_0xcdb7('0x35')][_0xcdb7('0x36')]?_0x4ea499[_0xcdb7('0x35')]:_0x3b8189[_0xcdb7('0x2f')];if(!_0x5a7202[_0xcdb7('0x30')][_0xcdb7('0x37')]('nolimit')){_0x4ea499[_0xcdb7('0x38')]=qs[_0xcdb7('0x38')](_0x5a7202[_0xcdb7('0x30')][_0xcdb7('0x38')]);_0x4ea499[_0xcdb7('0x1e')]=qs[_0xcdb7('0x1e')](_0x5a7202['query'][_0xcdb7('0x1e')]);}_0x4ea499['order']=qs['sort'](_0x5a7202['query'][_0xcdb7('0x39')]);_0x4ea499[_0xcdb7('0x3a')]=qs[_0xcdb7('0x32')](_[_0xcdb7('0x3b')](_0x5a7202['query'],_0x3b8189[_0xcdb7('0x32')]),_0x1c1bd7);if(_0x5a7202[_0xcdb7('0x30')][_0xcdb7('0x3c')]){_0x4ea499[_0xcdb7('0x3a')]=_[_0xcdb7('0x3d')](_0x4ea499[_0xcdb7('0x3a')],{'$or':_['map'](_0x1c1bd7,function(_0x517543){if(_0x517543[_0xcdb7('0x2d')]!==_0xcdb7('0x3e')){var _0x54c10f={};_0x54c10f[_0x517543[_0xcdb7('0x29')]]={'$like':'%'+_0x5a7202[_0xcdb7('0x30')][_0xcdb7('0x3c')]+'%'};return _0x54c10f;}})});}_0x4ea499=_[_0xcdb7('0x3d')]({},_0x4ea499,_0x5a7202[_0xcdb7('0x3f')]);var _0x14190b={'where':_0x4ea499[_0xcdb7('0x3a')]};return db[_0xcdb7('0x2b')][_0xcdb7('0x1f')](_0x14190b)[_0xcdb7('0x24')](function(_0x95da42){_0x303126['count']=_0x95da42;if(_0x5a7202['query'][_0xcdb7('0x40')]){_0x4ea499['include']=[{'all':!![]}];}return db[_0xcdb7('0x2b')][_0xcdb7('0x41')](_0x4ea499);})[_0xcdb7('0x24')](function(_0x39d2e8){_0x303126['rows']=_0x39d2e8;return _0x303126;})['then'](respondWithFilteredResult(_0x36ad63,_0x4ea499))[_0xcdb7('0x42')](handleError(_0x36ad63,null));};exports[_0xcdb7('0x43')]=function(_0x157c9c,_0x489e1f){var _0xeaab9c={'raw':![],'where':{'id':_0x157c9c[_0xcdb7('0x44')]['id']}},_0x142345={};_0x142345['model']=_['keys'](db[_0xcdb7('0x2b')][_0xcdb7('0x2c')]);_0x142345['query']=_[_0xcdb7('0x31')](_0x157c9c[_0xcdb7('0x30')]);_0x142345[_0xcdb7('0x32')]=_['intersection'](_0x142345['model'],_0x142345[_0xcdb7('0x30')]);_0xeaab9c['attributes']=_[_0xcdb7('0x33')](_0x142345['model'],qs['fields'](_0x157c9c[_0xcdb7('0x30')][_0xcdb7('0x34')]));_0xeaab9c[_0xcdb7('0x35')]=_0xeaab9c['attributes'][_0xcdb7('0x36')]?_0xeaab9c[_0xcdb7('0x35')]:_0x142345[_0xcdb7('0x2f')];if(_0x157c9c['query'][_0xcdb7('0x40')]){_0xeaab9c[_0xcdb7('0x45')]=[{'all':!![]}];}_0xeaab9c=_['merge']({},_0xeaab9c,_0x157c9c[_0xcdb7('0x3f')]);return db[_0xcdb7('0x2b')]['find'](_0xeaab9c)[_0xcdb7('0x24')](handleEntityNotFound(_0x489e1f,null))[_0xcdb7('0x24')](respondWithResult(_0x489e1f,null))[_0xcdb7('0x42')](handleError(_0x489e1f,null));};exports['create']=function(_0x47a856,_0x3e28d5){return db[_0xcdb7('0x2b')][_0xcdb7('0x46')](_0x47a856[_0xcdb7('0x47')],{})[_0xcdb7('0x24')](respondWithResult(_0x3e28d5,0xc9))['catch'](handleError(_0x3e28d5,null));};exports[_0xcdb7('0x23')]=function(_0x4d68fa,_0x531914){if(_0x4d68fa['body']['id']){delete _0x4d68fa[_0xcdb7('0x47')]['id'];}return db[_0xcdb7('0x2b')]['find']({'where':{'id':_0x4d68fa['params']['id']}})['then'](handleEntityNotFound(_0x531914,null))['then'](saveUpdates(_0x4d68fa['body'],null))['then'](respondWithResult(_0x531914,null))[_0xcdb7('0x42')](handleError(_0x531914,null));};exports[_0xcdb7('0x25')]=function(_0x19c769,_0x3818e7){return db[_0xcdb7('0x2b')][_0xcdb7('0x48')]({'where':{'id':_0x19c769[_0xcdb7('0x44')]['id']}})[_0xcdb7('0x24')](handleEntityNotFound(_0x3818e7,null))[_0xcdb7('0x24')](removeEntity(_0x3818e7,null))[_0xcdb7('0x42')](handleError(_0x3818e7,null));};exports[_0xcdb7('0x49')]=function(_0x4ee245,_0x56313e,_0x211334){var _0x2e58d1={};var _0x47ad0c={};var _0x394f5c;var _0x2bf39c;return db[_0xcdb7('0x2b')][_0xcdb7('0x4a')]({'where':{'id':_0x4ee245[_0xcdb7('0x44')]['id']}})[_0xcdb7('0x24')](handleEntityNotFound(_0x56313e,null))['then'](function(_0x53a103){if(_0x53a103){_0x394f5c=_0x53a103;_0x47ad0c[_0xcdb7('0x2f')]=_[_0xcdb7('0x31')](db[_0xcdb7('0x4b')][_0xcdb7('0x2c')]);_0x47ad0c[_0xcdb7('0x30')]=_[_0xcdb7('0x31')](_0x4ee245[_0xcdb7('0x30')]);_0x47ad0c[_0xcdb7('0x32')]=_[_0xcdb7('0x33')](_0x47ad0c[_0xcdb7('0x2f')],_0x47ad0c[_0xcdb7('0x30')]);_0x2e58d1[_0xcdb7('0x35')]=_['intersection'](_0x47ad0c[_0xcdb7('0x2f')],qs[_0xcdb7('0x34')](_0x4ee245['query'][_0xcdb7('0x34')]));_0x2e58d1[_0xcdb7('0x35')]=_0x2e58d1['attributes'][_0xcdb7('0x36')]?_0x2e58d1[_0xcdb7('0x35')]:_0x47ad0c[_0xcdb7('0x2f')];_0x2e58d1['order']=qs[_0xcdb7('0x39')](_0x4ee245[_0xcdb7('0x30')][_0xcdb7('0x39')]);_0x2e58d1[_0xcdb7('0x3a')]=qs[_0xcdb7('0x32')](_[_0xcdb7('0x3b')](_0x4ee245[_0xcdb7('0x30')],_0x47ad0c['filters']));if(_0x4ee245[_0xcdb7('0x30')][_0xcdb7('0x3c')]){_0x2e58d1[_0xcdb7('0x3a')]=_[_0xcdb7('0x3d')](_0x2e58d1['where'],{'$or':_[_0xcdb7('0x4c')](_0x2e58d1[_0xcdb7('0x35')],function(_0x32d4b6){var _0x129e25={};_0x129e25[_0x32d4b6]={'$like':'%'+_0x4ee245[_0xcdb7('0x30')][_0xcdb7('0x3c')]+'%'};return _0x129e25;})});}_0x2e58d1=_[_0xcdb7('0x3d')]({},_0x2e58d1,_0x4ee245['options']);return _0x394f5c[_0xcdb7('0x49')](_0x2e58d1);}})[_0xcdb7('0x24')](function(_0x5e569d){if(_0x5e569d){_0x2bf39c=_0x5e569d[_0xcdb7('0x36')];if(!_0x4ee245[_0xcdb7('0x30')]['hasOwnProperty'](_0xcdb7('0x4d'))){_0x2e58d1[_0xcdb7('0x38')]=qs['limit'](_0x4ee245[_0xcdb7('0x30')][_0xcdb7('0x38')]);_0x2e58d1[_0xcdb7('0x1e')]=qs[_0xcdb7('0x1e')](_0x4ee245['query'][_0xcdb7('0x1e')]);}return _0x394f5c['getFields'](_0x2e58d1);}})[_0xcdb7('0x24')](function(_0x2394a1){if(_0x2394a1){return _0x2394a1?{'count':_0x2bf39c,'rows':_0x2394a1}:null;}})[_0xcdb7('0x24')](respondWithResult(_0x56313e,null))[_0xcdb7('0x42')](handleError(_0x56313e,null));};exports['getSubjects']=function(_0x54711a,_0x4d62c7,_0x3cdb05){var _0x4b8dcc={};var _0x187f79={};var _0x28dd47;var _0x4cd32f;return db[_0xcdb7('0x2b')][_0xcdb7('0x4a')]({'where':{'id':_0x54711a['params']['id']}})['then'](handleEntityNotFound(_0x4d62c7,null))[_0xcdb7('0x24')](function(_0x2ba6a6){if(_0x2ba6a6){_0x28dd47=_0x2ba6a6;_0x187f79[_0xcdb7('0x2f')]=_['keys'](db[_0xcdb7('0x4b')]['rawAttributes']);_0x187f79[_0xcdb7('0x30')]=_['keys'](_0x54711a[_0xcdb7('0x30')]);_0x187f79[_0xcdb7('0x32')]=_[_0xcdb7('0x33')](_0x187f79[_0xcdb7('0x2f')],_0x187f79[_0xcdb7('0x30')]);_0x4b8dcc[_0xcdb7('0x35')]=_[_0xcdb7('0x33')](_0x187f79[_0xcdb7('0x2f')],qs[_0xcdb7('0x34')](_0x54711a[_0xcdb7('0x30')][_0xcdb7('0x34')]));_0x4b8dcc[_0xcdb7('0x35')]=_0x4b8dcc[_0xcdb7('0x35')]['length']?_0x4b8dcc[_0xcdb7('0x35')]:_0x187f79['model'];_0x4b8dcc[_0xcdb7('0x4e')]=qs['sort'](_0x54711a[_0xcdb7('0x30')]['sort']);_0x4b8dcc[_0xcdb7('0x3a')]=qs['filters'](_['pick'](_0x54711a[_0xcdb7('0x30')],_0x187f79[_0xcdb7('0x32')]));if(_0x54711a[_0xcdb7('0x30')][_0xcdb7('0x3c')]){_0x4b8dcc['where']=_[_0xcdb7('0x3d')](_0x4b8dcc[_0xcdb7('0x3a')],{'$or':_['map'](_0x4b8dcc['attributes'],function(_0x264dfd){var _0x4a3b7e={};_0x4a3b7e[_0x264dfd]={'$like':'%'+_0x54711a['query'][_0xcdb7('0x3c')]+'%'};return _0x4a3b7e;})});}_0x4b8dcc=_[_0xcdb7('0x3d')]({},_0x4b8dcc,_0x54711a[_0xcdb7('0x3f')]);return _0x28dd47[_0xcdb7('0x4f')](_0x4b8dcc);}})[_0xcdb7('0x24')](function(_0x58a554){if(_0x58a554){_0x4cd32f=_0x58a554['length'];if(!_0x54711a['query'][_0xcdb7('0x37')](_0xcdb7('0x4d'))){_0x4b8dcc[_0xcdb7('0x38')]=qs['limit'](_0x54711a[_0xcdb7('0x30')][_0xcdb7('0x38')]);_0x4b8dcc[_0xcdb7('0x1e')]=qs[_0xcdb7('0x1e')](_0x54711a[_0xcdb7('0x30')][_0xcdb7('0x1e')]);}return _0x28dd47[_0xcdb7('0x4f')](_0x4b8dcc);}})[_0xcdb7('0x24')](function(_0x3b375a){if(_0x3b375a){return _0x3b375a?{'count':_0x4cd32f,'rows':_0x3b375a}:null;}})[_0xcdb7('0x24')](respondWithResult(_0x4d62c7,null))['catch'](handleError(_0x4d62c7,null));};exports[_0xcdb7('0x50')]=function(_0x24d28f,_0x29039a,_0x2aeb16){var _0x2bd845={};var _0x1c4847={};var _0x5bf011;var _0x351eb9;return db[_0xcdb7('0x2b')]['findOne']({'where':{'id':_0x24d28f[_0xcdb7('0x44')]['id']}})[_0xcdb7('0x24')](handleEntityNotFound(_0x29039a,null))[_0xcdb7('0x24')](function(_0x4116ce){if(_0x4116ce){_0x5bf011=_0x4116ce;_0x1c4847[_0xcdb7('0x2f')]=_['keys'](db[_0xcdb7('0x4b')][_0xcdb7('0x2c')]);_0x1c4847[_0xcdb7('0x30')]=_[_0xcdb7('0x31')](_0x24d28f[_0xcdb7('0x30')]);_0x1c4847[_0xcdb7('0x32')]=_['intersection'](_0x1c4847[_0xcdb7('0x2f')],_0x1c4847['query']);_0x2bd845[_0xcdb7('0x35')]=_['intersection'](_0x1c4847['model'],qs[_0xcdb7('0x34')](_0x24d28f[_0xcdb7('0x30')][_0xcdb7('0x34')]));_0x2bd845[_0xcdb7('0x35')]=_0x2bd845[_0xcdb7('0x35')]['length']?_0x2bd845[_0xcdb7('0x35')]:_0x1c4847[_0xcdb7('0x2f')];_0x2bd845[_0xcdb7('0x4e')]=qs['sort'](_0x24d28f[_0xcdb7('0x30')][_0xcdb7('0x39')]);_0x2bd845[_0xcdb7('0x3a')]=qs[_0xcdb7('0x32')](_[_0xcdb7('0x3b')](_0x24d28f['query'],_0x1c4847['filters']));if(_0x24d28f['query'][_0xcdb7('0x3c')]){_0x2bd845[_0xcdb7('0x3a')]=_['merge'](_0x2bd845['where'],{'$or':_[_0xcdb7('0x4c')](_0x2bd845[_0xcdb7('0x35')],function(_0x1499e4){var _0x3f6b4b={};_0x3f6b4b[_0x1499e4]={'$like':'%'+_0x24d28f[_0xcdb7('0x30')][_0xcdb7('0x3c')]+'%'};return _0x3f6b4b;})});}_0x2bd845=_[_0xcdb7('0x3d')]({},_0x2bd845,_0x24d28f[_0xcdb7('0x3f')]);return _0x5bf011[_0xcdb7('0x50')](_0x2bd845);}})[_0xcdb7('0x24')](function(_0x4fddf9){if(_0x4fddf9){_0x351eb9=_0x4fddf9[_0xcdb7('0x36')];if(!_0x24d28f[_0xcdb7('0x30')][_0xcdb7('0x37')]('nolimit')){_0x2bd845[_0xcdb7('0x38')]=qs[_0xcdb7('0x38')](_0x24d28f[_0xcdb7('0x30')][_0xcdb7('0x38')]);_0x2bd845[_0xcdb7('0x1e')]=qs['offset'](_0x24d28f[_0xcdb7('0x30')][_0xcdb7('0x1e')]);}return _0x5bf011['getDescriptions'](_0x2bd845);}})[_0xcdb7('0x24')](function(_0x5ddc07){if(_0x5ddc07){return _0x5ddc07?{'count':_0x351eb9,'rows':_0x5ddc07}:null;}})['then'](respondWithResult(_0x29039a,null))[_0xcdb7('0x42')](handleError(_0x29039a,null));}; \ No newline at end of file +var _0xa3d8=['send','index','map','VtigerConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','name','includeAll','include','findAll','rows','catch','show','params','length','options','create','body','find','getFields','findOne','order','getSubjects','VtigerField','nolimit','getDescriptions','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','destroy','then','error'];(function(_0x2438bd,_0x2c3604){var _0xab3dbc=function(_0x11d57d){while(--_0x11d57d){_0x2438bd['push'](_0x2438bd['shift']());}};_0xab3dbc(++_0x2c3604);}(_0xa3d8,0x17a));var _0x8a3d=function(_0x42af54,_0x5439a2){_0x42af54=_0x42af54-0x0;var _0x31add8=_0xa3d8[_0x42af54];return _0x31add8;};'use strict';var emlformat=require(_0x8a3d('0x0'));var rimraf=require(_0x8a3d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x8a3d('0x2'));var moment=require(_0x8a3d('0x3'));var BPromise=require(_0x8a3d('0x4'));var Mustache=require(_0x8a3d('0x5'));var util=require(_0x8a3d('0x6'));var path=require(_0x8a3d('0x7'));var sox=require(_0x8a3d('0x8'));var csv=require(_0x8a3d('0x9'));var ejs=require(_0x8a3d('0xa'));var fs=require('fs');var fs_extra=require(_0x8a3d('0xb'));var _=require(_0x8a3d('0xc'));var squel=require('squel');var crypto=require(_0x8a3d('0xd'));var jsforce=require(_0x8a3d('0xe'));var deskjs=require(_0x8a3d('0xf'));var toCsv=require(_0x8a3d('0x9'));var querystring=require(_0x8a3d('0x10'));var Papa=require('papaparse');var Redis=require(_0x8a3d('0x11'));var authService=require(_0x8a3d('0x12'));var qs=require(_0x8a3d('0x13'));var as=require(_0x8a3d('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8a3d('0x15'))(_0x8a3d('0x16'));var utils=require(_0x8a3d('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x8a3d('0x18'));var db=require(_0x8a3d('0x19'))['db'];function respondWithStatusCode(_0x570cee,_0x2a8412){_0x2a8412=_0x2a8412||0xcc;return function(_0x2b3f40){if(_0x2b3f40){return _0x570cee[_0x8a3d('0x1a')](_0x2a8412);}return _0x570cee[_0x8a3d('0x1b')](_0x2a8412)[_0x8a3d('0x1c')]();};}function respondWithResult(_0xbb494a,_0x5a9318){_0x5a9318=_0x5a9318||0xc8;return function(_0x5985b9){if(_0x5985b9){return _0xbb494a[_0x8a3d('0x1b')](_0x5a9318)[_0x8a3d('0x1d')](_0x5985b9);}};}function respondWithFilteredResult(_0x4dbc49,_0x299f8a){return function(_0x51a54c){if(_0x51a54c){var _0x4224be=typeof _0x299f8a[_0x8a3d('0x1e')]==='undefined'&&typeof _0x299f8a[_0x8a3d('0x1f')]===_0x8a3d('0x20');var _0x4fccc2=_0x51a54c[_0x8a3d('0x21')];var _0x17f7d6=_0x4224be?0x0:_0x299f8a['offset'];var _0x4be53c=_0x4224be?_0x51a54c['count']:_0x299f8a[_0x8a3d('0x1e')]+_0x299f8a[_0x8a3d('0x1f')];var _0x4b8a40;if(_0x4be53c>=_0x4fccc2){_0x4be53c=_0x4fccc2;_0x4b8a40=0xc8;}else{_0x4b8a40=0xce;}_0x4dbc49[_0x8a3d('0x1b')](_0x4b8a40);return _0x4dbc49[_0x8a3d('0x22')](_0x8a3d('0x23'),_0x17f7d6+'-'+_0x4be53c+'/'+_0x4fccc2)[_0x8a3d('0x1d')](_0x51a54c);}return null;};}function patchUpdates(_0x48b146){return function(_0x1a1a33){try{jsonpatch[_0x8a3d('0x24')](_0x1a1a33,_0x48b146,!![]);}catch(_0x57c677){return BPromise['reject'](_0x57c677);}return _0x1a1a33[_0x8a3d('0x25')]();};}function saveUpdates(_0xa3f4c8,_0x4544d1){return function(_0x52f0bb){if(_0x52f0bb){return _0x52f0bb[_0x8a3d('0x26')](_0xa3f4c8)['then'](function(_0x300681){return _0x300681;});}return null;};}function removeEntity(_0x10ddde,_0x1a1b95){return function(_0x21077d){if(_0x21077d){return _0x21077d[_0x8a3d('0x27')]()[_0x8a3d('0x28')](function(){_0x10ddde[_0x8a3d('0x1b')](0xcc)[_0x8a3d('0x1c')]();});}};}function handleEntityNotFound(_0x3335fc,_0x2e1690){return function(_0x95379a){if(!_0x95379a){_0x3335fc[_0x8a3d('0x1a')](0x194);}return _0x95379a;};}function handleError(_0x27139e,_0x2d39eb){_0x2d39eb=_0x2d39eb||0x1f4;return function(_0x590513){logger[_0x8a3d('0x29')](_0x590513['stack']);if(_0x590513['name']){delete _0x590513['name'];}_0x27139e['status'](_0x2d39eb)[_0x8a3d('0x2a')](_0x590513);};}exports[_0x8a3d('0x2b')]=function(_0x470ee9,_0x28d18a){var _0x591f6e={},_0x3261d8={},_0x210cff={'count':0x0,'rows':[]};var _0x35c10b=_[_0x8a3d('0x2c')](db[_0x8a3d('0x2d')][_0x8a3d('0x2e')],function(_0x5cb30c){return{'name':_0x5cb30c[_0x8a3d('0x2f')],'type':_0x5cb30c[_0x8a3d('0x30')][_0x8a3d('0x31')]};});_0x3261d8[_0x8a3d('0x32')]=_['map'](_0x35c10b,'name');_0x3261d8[_0x8a3d('0x33')]=_[_0x8a3d('0x34')](_0x470ee9['query']);_0x3261d8[_0x8a3d('0x35')]=_['intersection'](_0x3261d8['model'],_0x3261d8[_0x8a3d('0x33')]);_0x591f6e['attributes']=_[_0x8a3d('0x36')](_0x3261d8[_0x8a3d('0x32')],qs[_0x8a3d('0x37')](_0x470ee9[_0x8a3d('0x33')][_0x8a3d('0x37')]));_0x591f6e['attributes']=_0x591f6e[_0x8a3d('0x38')]['length']?_0x591f6e['attributes']:_0x3261d8['model'];if(!_0x470ee9['query'][_0x8a3d('0x39')]('nolimit')){_0x591f6e[_0x8a3d('0x1f')]=qs[_0x8a3d('0x1f')](_0x470ee9[_0x8a3d('0x33')][_0x8a3d('0x1f')]);_0x591f6e[_0x8a3d('0x1e')]=qs[_0x8a3d('0x1e')](_0x470ee9[_0x8a3d('0x33')]['offset']);}_0x591f6e['order']=qs[_0x8a3d('0x3a')](_0x470ee9[_0x8a3d('0x33')][_0x8a3d('0x3a')]);_0x591f6e[_0x8a3d('0x3b')]=qs[_0x8a3d('0x35')](_[_0x8a3d('0x3c')](_0x470ee9[_0x8a3d('0x33')],_0x3261d8[_0x8a3d('0x35')]),_0x35c10b);if(_0x470ee9['query'][_0x8a3d('0x3d')]){_0x591f6e['where']=_[_0x8a3d('0x3e')](_0x591f6e[_0x8a3d('0x3b')],{'$or':_[_0x8a3d('0x2c')](_0x35c10b,function(_0x5d9003){if(_0x5d9003[_0x8a3d('0x30')]!==_0x8a3d('0x3f')){var _0x2539e5={};_0x2539e5[_0x5d9003[_0x8a3d('0x40')]]={'$like':'%'+_0x470ee9[_0x8a3d('0x33')][_0x8a3d('0x3d')]+'%'};return _0x2539e5;}})});}_0x591f6e=_[_0x8a3d('0x3e')]({},_0x591f6e,_0x470ee9['options']);var _0x3ecead={'where':_0x591f6e[_0x8a3d('0x3b')]};return db[_0x8a3d('0x2d')][_0x8a3d('0x21')](_0x3ecead)[_0x8a3d('0x28')](function(_0x4eff7){_0x210cff[_0x8a3d('0x21')]=_0x4eff7;if(_0x470ee9[_0x8a3d('0x33')][_0x8a3d('0x41')]){_0x591f6e[_0x8a3d('0x42')]=[{'all':!![]}];}return db[_0x8a3d('0x2d')][_0x8a3d('0x43')](_0x591f6e);})['then'](function(_0xebd3ba){_0x210cff[_0x8a3d('0x44')]=_0xebd3ba;return _0x210cff;})['then'](respondWithFilteredResult(_0x28d18a,_0x591f6e))[_0x8a3d('0x45')](handleError(_0x28d18a,null));};exports[_0x8a3d('0x46')]=function(_0x152b01,_0x5d0f00){var _0x3a5941={'raw':![],'where':{'id':_0x152b01[_0x8a3d('0x47')]['id']}},_0x5cbf98={};_0x5cbf98[_0x8a3d('0x32')]=_[_0x8a3d('0x34')](db[_0x8a3d('0x2d')][_0x8a3d('0x2e')]);_0x5cbf98[_0x8a3d('0x33')]=_[_0x8a3d('0x34')](_0x152b01['query']);_0x5cbf98[_0x8a3d('0x35')]=_[_0x8a3d('0x36')](_0x5cbf98[_0x8a3d('0x32')],_0x5cbf98['query']);_0x3a5941[_0x8a3d('0x38')]=_[_0x8a3d('0x36')](_0x5cbf98[_0x8a3d('0x32')],qs[_0x8a3d('0x37')](_0x152b01[_0x8a3d('0x33')][_0x8a3d('0x37')]));_0x3a5941['attributes']=_0x3a5941[_0x8a3d('0x38')][_0x8a3d('0x48')]?_0x3a5941[_0x8a3d('0x38')]:_0x5cbf98[_0x8a3d('0x32')];if(_0x152b01[_0x8a3d('0x33')][_0x8a3d('0x41')]){_0x3a5941[_0x8a3d('0x42')]=[{'all':!![]}];}_0x3a5941=_['merge']({},_0x3a5941,_0x152b01[_0x8a3d('0x49')]);return db[_0x8a3d('0x2d')]['find'](_0x3a5941)['then'](handleEntityNotFound(_0x5d0f00,null))[_0x8a3d('0x28')](respondWithResult(_0x5d0f00,null))[_0x8a3d('0x45')](handleError(_0x5d0f00,null));};exports[_0x8a3d('0x4a')]=function(_0x17da66,_0xa87880){return db[_0x8a3d('0x2d')][_0x8a3d('0x4a')](_0x17da66[_0x8a3d('0x4b')],{})['then'](respondWithResult(_0xa87880,0xc9))['catch'](handleError(_0xa87880,null));};exports[_0x8a3d('0x26')]=function(_0x39b653,_0x569977){if(_0x39b653['body']['id']){delete _0x39b653[_0x8a3d('0x4b')]['id'];}return db['VtigerConfiguration'][_0x8a3d('0x4c')]({'where':{'id':_0x39b653[_0x8a3d('0x47')]['id']}})[_0x8a3d('0x28')](handleEntityNotFound(_0x569977,null))['then'](saveUpdates(_0x39b653[_0x8a3d('0x4b')],null))[_0x8a3d('0x28')](respondWithResult(_0x569977,null))[_0x8a3d('0x45')](handleError(_0x569977,null));};exports[_0x8a3d('0x27')]=function(_0x3858cd,_0x4196e8){return db[_0x8a3d('0x2d')]['find']({'where':{'id':_0x3858cd['params']['id']}})[_0x8a3d('0x28')](handleEntityNotFound(_0x4196e8,null))['then'](removeEntity(_0x4196e8,null))['catch'](handleError(_0x4196e8,null));};exports[_0x8a3d('0x4d')]=function(_0x31e739,_0x4f04cd,_0x3cdeae){var _0x18d5b8={};var _0x2df1f5={};var _0x106198;var _0x1571bd;return db[_0x8a3d('0x2d')][_0x8a3d('0x4e')]({'where':{'id':_0x31e739[_0x8a3d('0x47')]['id']}})[_0x8a3d('0x28')](handleEntityNotFound(_0x4f04cd,null))['then'](function(_0x2e2f49){if(_0x2e2f49){_0x106198=_0x2e2f49;_0x2df1f5['model']=_['keys'](db['VtigerField'][_0x8a3d('0x2e')]);_0x2df1f5[_0x8a3d('0x33')]=_[_0x8a3d('0x34')](_0x31e739[_0x8a3d('0x33')]);_0x2df1f5[_0x8a3d('0x35')]=_[_0x8a3d('0x36')](_0x2df1f5[_0x8a3d('0x32')],_0x2df1f5[_0x8a3d('0x33')]);_0x18d5b8[_0x8a3d('0x38')]=_[_0x8a3d('0x36')](_0x2df1f5[_0x8a3d('0x32')],qs[_0x8a3d('0x37')](_0x31e739[_0x8a3d('0x33')][_0x8a3d('0x37')]));_0x18d5b8[_0x8a3d('0x38')]=_0x18d5b8['attributes'][_0x8a3d('0x48')]?_0x18d5b8[_0x8a3d('0x38')]:_0x2df1f5[_0x8a3d('0x32')];_0x18d5b8[_0x8a3d('0x4f')]=qs[_0x8a3d('0x3a')](_0x31e739[_0x8a3d('0x33')][_0x8a3d('0x3a')]);_0x18d5b8[_0x8a3d('0x3b')]=qs[_0x8a3d('0x35')](_['pick'](_0x31e739[_0x8a3d('0x33')],_0x2df1f5[_0x8a3d('0x35')]));if(_0x31e739['query'][_0x8a3d('0x3d')]){_0x18d5b8['where']=_[_0x8a3d('0x3e')](_0x18d5b8['where'],{'$or':_[_0x8a3d('0x2c')](_0x18d5b8[_0x8a3d('0x38')],function(_0x40537b){var _0x5e643a={};_0x5e643a[_0x40537b]={'$like':'%'+_0x31e739['query']['filter']+'%'};return _0x5e643a;})});}_0x18d5b8=_['merge']({},_0x18d5b8,_0x31e739[_0x8a3d('0x49')]);return _0x106198['getFields'](_0x18d5b8);}})[_0x8a3d('0x28')](function(_0x5334b8){if(_0x5334b8){_0x1571bd=_0x5334b8[_0x8a3d('0x48')];if(!_0x31e739[_0x8a3d('0x33')][_0x8a3d('0x39')]('nolimit')){_0x18d5b8['limit']=qs[_0x8a3d('0x1f')](_0x31e739[_0x8a3d('0x33')]['limit']);_0x18d5b8['offset']=qs['offset'](_0x31e739['query']['offset']);}return _0x106198['getFields'](_0x18d5b8);}})[_0x8a3d('0x28')](function(_0x156df6){if(_0x156df6){return _0x156df6?{'count':_0x1571bd,'rows':_0x156df6}:null;}})['then'](respondWithResult(_0x4f04cd,null))[_0x8a3d('0x45')](handleError(_0x4f04cd,null));};exports[_0x8a3d('0x50')]=function(_0x204d01,_0x245736,_0x2fc447){var _0x22f520={};var _0x3cfec0={};var _0x285ec5;var _0x47b150;return db[_0x8a3d('0x2d')]['findOne']({'where':{'id':_0x204d01[_0x8a3d('0x47')]['id']}})[_0x8a3d('0x28')](handleEntityNotFound(_0x245736,null))[_0x8a3d('0x28')](function(_0x49b54b){if(_0x49b54b){_0x285ec5=_0x49b54b;_0x3cfec0[_0x8a3d('0x32')]=_[_0x8a3d('0x34')](db[_0x8a3d('0x51')]['rawAttributes']);_0x3cfec0[_0x8a3d('0x33')]=_[_0x8a3d('0x34')](_0x204d01['query']);_0x3cfec0[_0x8a3d('0x35')]=_[_0x8a3d('0x36')](_0x3cfec0[_0x8a3d('0x32')],_0x3cfec0[_0x8a3d('0x33')]);_0x22f520[_0x8a3d('0x38')]=_[_0x8a3d('0x36')](_0x3cfec0[_0x8a3d('0x32')],qs[_0x8a3d('0x37')](_0x204d01[_0x8a3d('0x33')][_0x8a3d('0x37')]));_0x22f520['attributes']=_0x22f520['attributes'][_0x8a3d('0x48')]?_0x22f520[_0x8a3d('0x38')]:_0x3cfec0['model'];_0x22f520['order']=qs[_0x8a3d('0x3a')](_0x204d01['query'][_0x8a3d('0x3a')]);_0x22f520[_0x8a3d('0x3b')]=qs[_0x8a3d('0x35')](_[_0x8a3d('0x3c')](_0x204d01[_0x8a3d('0x33')],_0x3cfec0[_0x8a3d('0x35')]));if(_0x204d01['query'][_0x8a3d('0x3d')]){_0x22f520['where']=_['merge'](_0x22f520[_0x8a3d('0x3b')],{'$or':_[_0x8a3d('0x2c')](_0x22f520[_0x8a3d('0x38')],function(_0x5229c1){var _0x4cf9f5={};_0x4cf9f5[_0x5229c1]={'$like':'%'+_0x204d01['query'][_0x8a3d('0x3d')]+'%'};return _0x4cf9f5;})});}_0x22f520=_[_0x8a3d('0x3e')]({},_0x22f520,_0x204d01[_0x8a3d('0x49')]);return _0x285ec5[_0x8a3d('0x50')](_0x22f520);}})[_0x8a3d('0x28')](function(_0x5a4d3b){if(_0x5a4d3b){_0x47b150=_0x5a4d3b[_0x8a3d('0x48')];if(!_0x204d01['query'][_0x8a3d('0x39')](_0x8a3d('0x52'))){_0x22f520['limit']=qs[_0x8a3d('0x1f')](_0x204d01[_0x8a3d('0x33')][_0x8a3d('0x1f')]);_0x22f520['offset']=qs['offset'](_0x204d01[_0x8a3d('0x33')][_0x8a3d('0x1e')]);}return _0x285ec5[_0x8a3d('0x50')](_0x22f520);}})['then'](function(_0x37084b){if(_0x37084b){return _0x37084b?{'count':_0x47b150,'rows':_0x37084b}:null;}})[_0x8a3d('0x28')](respondWithResult(_0x245736,null))['catch'](handleError(_0x245736,null));};exports[_0x8a3d('0x53')]=function(_0x4c4a6d,_0x30850c,_0x294ad6){var _0x2f2670={};var _0x2786c5={};var _0x3ccc71;var _0x1329e8;return db['VtigerConfiguration']['findOne']({'where':{'id':_0x4c4a6d[_0x8a3d('0x47')]['id']}})['then'](handleEntityNotFound(_0x30850c,null))[_0x8a3d('0x28')](function(_0x387363){if(_0x387363){_0x3ccc71=_0x387363;_0x2786c5[_0x8a3d('0x32')]=_[_0x8a3d('0x34')](db[_0x8a3d('0x51')][_0x8a3d('0x2e')]);_0x2786c5[_0x8a3d('0x33')]=_['keys'](_0x4c4a6d[_0x8a3d('0x33')]);_0x2786c5[_0x8a3d('0x35')]=_[_0x8a3d('0x36')](_0x2786c5[_0x8a3d('0x32')],_0x2786c5[_0x8a3d('0x33')]);_0x2f2670[_0x8a3d('0x38')]=_[_0x8a3d('0x36')](_0x2786c5[_0x8a3d('0x32')],qs[_0x8a3d('0x37')](_0x4c4a6d['query'][_0x8a3d('0x37')]));_0x2f2670[_0x8a3d('0x38')]=_0x2f2670[_0x8a3d('0x38')][_0x8a3d('0x48')]?_0x2f2670[_0x8a3d('0x38')]:_0x2786c5[_0x8a3d('0x32')];_0x2f2670[_0x8a3d('0x4f')]=qs[_0x8a3d('0x3a')](_0x4c4a6d['query'][_0x8a3d('0x3a')]);_0x2f2670[_0x8a3d('0x3b')]=qs['filters'](_[_0x8a3d('0x3c')](_0x4c4a6d[_0x8a3d('0x33')],_0x2786c5[_0x8a3d('0x35')]));if(_0x4c4a6d[_0x8a3d('0x33')]['filter']){_0x2f2670[_0x8a3d('0x3b')]=_[_0x8a3d('0x3e')](_0x2f2670[_0x8a3d('0x3b')],{'$or':_[_0x8a3d('0x2c')](_0x2f2670[_0x8a3d('0x38')],function(_0x2f9fe7){var _0x3aef8d={};_0x3aef8d[_0x2f9fe7]={'$like':'%'+_0x4c4a6d[_0x8a3d('0x33')][_0x8a3d('0x3d')]+'%'};return _0x3aef8d;})});}_0x2f2670=_[_0x8a3d('0x3e')]({},_0x2f2670,_0x4c4a6d[_0x8a3d('0x49')]);return _0x3ccc71[_0x8a3d('0x53')](_0x2f2670);}})[_0x8a3d('0x28')](function(_0x34f387){if(_0x34f387){_0x1329e8=_0x34f387[_0x8a3d('0x48')];if(!_0x4c4a6d['query'][_0x8a3d('0x39')]('nolimit')){_0x2f2670[_0x8a3d('0x1f')]=qs['limit'](_0x4c4a6d[_0x8a3d('0x33')][_0x8a3d('0x1f')]);_0x2f2670[_0x8a3d('0x1e')]=qs['offset'](_0x4c4a6d[_0x8a3d('0x33')][_0x8a3d('0x1e')]);}return _0x3ccc71[_0x8a3d('0x53')](_0x2f2670);}})[_0x8a3d('0x28')](function(_0x5e5a8b){if(_0x5e5a8b){return _0x5e5a8b?{'count':_0x1329e8,'rows':_0x5e5a8b}:null;}})[_0x8a3d('0x28')](respondWithResult(_0x30850c,null))[_0x8a3d('0x45')](handleError(_0x30850c,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 9b90a2d..408bee1 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 _0x9da1=['request-promise','rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration','int_vtiger_configurations','../../config/logger','api','moment','bluebird'];(function(_0xbf2d48,_0x48a121){var _0xda709=function(_0x470b03){while(--_0x470b03){_0xbf2d48['push'](_0xbf2d48['shift']());}};_0xda709(++_0x48a121);}(_0x9da1,0xec));var _0x19da=function(_0x4f35ec,_0x840f6e){_0x4f35ec=_0x4f35ec-0x0;var _0x111757=_0x9da1[_0x4f35ec];return _0x111757;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x19da('0x0'))(_0x19da('0x1'));var moment=require(_0x19da('0x2'));var BPromise=require(_0x19da('0x3'));var rp=require(_0x19da('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x19da('0x5'));var config=require(_0x19da('0x6'));var attributes=require(_0x19da('0x7'));module[_0x19da('0x8')]=function(_0x24bd8e,_0xdc929b){return _0x24bd8e[_0x19da('0x9')](_0x19da('0xa'),attributes,{'tableName':_0x19da('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdaf9=['exports','define','VtigerConfiguration','int_vtiger_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerConfiguration.attributes'];(function(_0x128ed0,_0x4cd3b8){var _0xe375dd=function(_0x151138){while(--_0x151138){_0x128ed0['push'](_0x128ed0['shift']());}};_0xe375dd(++_0x4cd3b8);}(_0xdaf9,0x130));var _0x9daf=function(_0x4c935e,_0x4d2929){_0x4c935e=_0x4c935e-0x0;var _0x548cc2=_0xdaf9[_0x4c935e];return _0x548cc2;};'use strict';var _=require(_0x9daf('0x0'));var util=require(_0x9daf('0x1'));var logger=require(_0x9daf('0x2'))(_0x9daf('0x3'));var moment=require(_0x9daf('0x4'));var BPromise=require(_0x9daf('0x5'));var rp=require(_0x9daf('0x6'));var fs=require('fs');var path=require(_0x9daf('0x7'));var rimraf=require(_0x9daf('0x8'));var config=require(_0x9daf('0x9'));var attributes=require(_0x9daf('0xa'));module[_0x9daf('0xb')]=function(_0x739a11,_0x3e7706){return _0x739a11[_0x9daf('0xc')](_0x9daf('0xd'),attributes,{'tableName':_0x9daf('0xe'),'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 d9a0945..3e22817 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 _0x5f7e=['message','result','catch','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0x5f7e,0x10b));var _0xe5f7=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x5f7e[_0x5bd426];return _0x23a7eb;};'use strict';var _=require(_0xe5f7('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xe5f7('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe5f7('0x2'));var db=require(_0xe5f7('0x3'))['db'];var utils=require(_0xe5f7('0x4'));var logger=require('../../config/logger')(_0xe5f7('0x5'));var config=require(_0xe5f7('0x6'));var jayson=require(_0xe5f7('0x7'));var client=jayson[_0xe5f7('0x8')][_0xe5f7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1f670a,_0x58099f,_0x5a4fc6){return new BPromise(function(_0xb7c394,_0xc4dc84){return client['request'](_0x1f670a,_0x5a4fc6)[_0xe5f7('0xa')](function(_0x5970af){logger[_0xe5f7('0xb')](_0xe5f7('0xc'),_0x58099f,_0xe5f7('0xd'));logger[_0xe5f7('0xe')](_0xe5f7('0xf'),_0x58099f,_0xe5f7('0xd'),JSON[_0xe5f7('0x10')](_0x5970af));if(_0x5970af[_0xe5f7('0x11')]){if(_0x5970af['error'][_0xe5f7('0x12')]===0x1f4){logger[_0xe5f7('0x11')](_0xe5f7('0xc'),_0x58099f,_0x5970af[_0xe5f7('0x11')]['message']);return _0xc4dc84(_0x5970af[_0xe5f7('0x11')]['message']);}logger[_0xe5f7('0x11')](_0xe5f7('0xc'),_0x58099f,_0x5970af[_0xe5f7('0x11')]['message']);return _0xb7c394(_0x5970af['error'][_0xe5f7('0x13')]);}else{logger[_0xe5f7('0xb')]('VtigerConfiguration,\x20%s,\x20%s',_0x58099f,'request\x20sent');_0xb7c394(_0x5970af[_0xe5f7('0x14')][_0xe5f7('0x13')]);}})[_0xe5f7('0x15')](function(_0x1e1008){logger[_0xe5f7('0x11')](_0xe5f7('0xc'),_0x58099f,_0x1e1008);_0xc4dc84(_0x1e1008);});});} \ No newline at end of file +var _0x264c=['catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x264c,0x12d));var _0xc264=function(_0x113e32,_0x5339f0){_0x113e32=_0x113e32-0x0;var _0x4ff939=_0x264c[_0x113e32];return _0x4ff939;};'use strict';var _=require('lodash');var util=require(_0xc264('0x0'));var moment=require(_0xc264('0x1'));var BPromise=require(_0xc264('0x2'));var rs=require(_0xc264('0x3'));var fs=require('fs');var Redis=require(_0xc264('0x4'));var db=require(_0xc264('0x5'))['db'];var utils=require(_0xc264('0x6'));var logger=require(_0xc264('0x7'))('rpc');var config=require(_0xc264('0x8'));var jayson=require(_0xc264('0x9'));var client=jayson[_0xc264('0xa')][_0xc264('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5756b0,_0x267cdd,_0x485023){return new BPromise(function(_0xc1c92f,_0x1fc2c0){return client[_0xc264('0xc')](_0x5756b0,_0x485023)[_0xc264('0xd')](function(_0x54a76b){logger[_0xc264('0xe')](_0xc264('0xf'),_0x267cdd,_0xc264('0x10'));logger[_0xc264('0x11')](_0xc264('0x12'),_0x267cdd,_0xc264('0x10'),JSON[_0xc264('0x13')](_0x54a76b));if(_0x54a76b['error']){if(_0x54a76b[_0xc264('0x14')][_0xc264('0x15')]===0x1f4){logger['error'](_0xc264('0xf'),_0x267cdd,_0x54a76b[_0xc264('0x14')]['message']);return _0x1fc2c0(_0x54a76b[_0xc264('0x14')][_0xc264('0x16')]);}logger[_0xc264('0x14')](_0xc264('0xf'),_0x267cdd,_0x54a76b[_0xc264('0x14')][_0xc264('0x16')]);return _0xc1c92f(_0x54a76b[_0xc264('0x14')][_0xc264('0x16')]);}else{logger[_0xc264('0xe')](_0xc264('0xf'),_0x267cdd,_0xc264('0x10'));_0xc1c92f(_0x54a76b[_0xc264('0x17')]['message']);}})[_0xc264('0x18')](function(_0x580617){logger[_0xc264('0x14')](_0xc264('0xf'),_0x267cdd,_0x580617);_0x1fc2c0(_0x580617);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 2cb2f2e..bddd6a2 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 _0xca24=['./intVtigerField.controller','isAuthenticated','index','get','/:id','show','post','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0xca24,0x11c));var _0x4ca2=function(_0x50a9e4,_0x3bd0f8){_0x50a9e4=_0x50a9e4-0x0;var _0x587c3f=_0xca24[_0x50a9e4];return _0x587c3f;};'use strict';var multer=require(_0x4ca2('0x0'));var util=require(_0x4ca2('0x1'));var path=require(_0x4ca2('0x2'));var timeout=require(_0x4ca2('0x3'));var express=require(_0x4ca2('0x4'));var router=express[_0x4ca2('0x5')]();var fs_extra=require(_0x4ca2('0x6'));var auth=require(_0x4ca2('0x7'));var interaction=require(_0x4ca2('0x8'));var config=require(_0x4ca2('0x9'));var controller=require(_0x4ca2('0xa'));router['get']('/',auth[_0x4ca2('0xb')](),controller[_0x4ca2('0xc')]);router[_0x4ca2('0xd')](_0x4ca2('0xe'),auth['isAuthenticated'](),controller[_0x4ca2('0xf')]);router[_0x4ca2('0x10')]('/',auth[_0x4ca2('0xb')](),controller['create']);router[_0x4ca2('0x11')](_0x4ca2('0xe'),auth[_0x4ca2('0xb')](),controller[_0x4ca2('0x12')]);router['delete'](_0x4ca2('0xe'),auth[_0x4ca2('0xb')](),controller[_0x4ca2('0x13')]);module[_0x4ca2('0x14')]=router; \ No newline at end of file +var _0xf5b9=['util','express','Router','../../components/auth/service','../../config/environment','./intVtigerField.controller','get','isAuthenticated','create','put','update','delete','exports','multer'];(function(_0x54109d,_0x32cdbe){var _0x1de552=function(_0x5d4ee9){while(--_0x5d4ee9){_0x54109d['push'](_0x54109d['shift']());}};_0x1de552(++_0x32cdbe);}(_0xf5b9,0xc3));var _0x9f5b=function(_0x10c6ed,_0x4e8325){_0x10c6ed=_0x10c6ed-0x0;var _0x5a4779=_0xf5b9[_0x10c6ed];return _0x5a4779;};'use strict';var multer=require(_0x9f5b('0x0'));var util=require(_0x9f5b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x9f5b('0x2'));var router=express[_0x9f5b('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x9f5b('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x9f5b('0x5'));var controller=require(_0x9f5b('0x6'));router[_0x9f5b('0x7')]('/',auth[_0x9f5b('0x8')](),controller['index']);router[_0x9f5b('0x7')]('/:id',auth[_0x9f5b('0x8')](),controller['show']);router['post']('/',auth[_0x9f5b('0x8')](),controller[_0x9f5b('0x9')]);router[_0x9f5b('0xa')]('/:id',auth[_0x9f5b('0x8')](),controller[_0x9f5b('0xb')]);router[_0x9f5b('0xc')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x9f5b('0xd')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 906ead1..2301fbc 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 _0x9c10=['BOOLEAN','exports','string','variable','customVariable','keyValue','picklist','STRING','ENUM'];(function(_0x454d07,_0x17aa08){var _0x4e0a61=function(_0x54dd3c){while(--_0x54dd3c){_0x454d07['push'](_0x454d07['shift']());}};_0x4e0a61(++_0x17aa08);}(_0x9c10,0xfd));var _0x09c1=function(_0x4bdad2,_0x3bb56b){_0x4bdad2=_0x4bdad2-0x0;var _0x249aa7=_0x9c10[_0x4bdad2];return _0x249aa7;};'use strict';var Sequelize=require('sequelize');module[_0x09c1('0x0')]={'type':{'type':Sequelize['ENUM'](_0x09c1('0x1'),_0x09c1('0x2'),_0x09c1('0x3'),_0x09c1('0x4'),_0x09c1('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x09c1('0x6')]},'key':{'type':Sequelize[_0x09c1('0x6')]},'keyType':{'type':Sequelize[_0x09c1('0x7')](_0x09c1('0x1'),_0x09c1('0x2'),_0x09c1('0x3'))},'keyContent':{'type':Sequelize[_0x09c1('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x09c1('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x09c1('0x6')]}}; \ No newline at end of file +var _0xbafb=['BOOLEAN','sequelize','exports','ENUM','string','customVariable','keyValue','picklist','STRING','variable'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xbafb,0xa1));var _0xbbaf=function(_0xd0829d,_0x184418){_0xd0829d=_0xd0829d-0x0;var _0x3f13f5=_0xbafb[_0xd0829d];return _0x3f13f5;};'use strict';var Sequelize=require(_0xbbaf('0x0'));module[_0xbbaf('0x1')]={'type':{'type':Sequelize[_0xbbaf('0x2')](_0xbbaf('0x3'),'variable',_0xbbaf('0x4'),_0xbbaf('0x5'),_0xbbaf('0x6')),'defaultValue':_0xbbaf('0x3')},'content':{'type':Sequelize[_0xbbaf('0x7')]},'key':{'type':Sequelize[_0xbbaf('0x7')]},'keyType':{'type':Sequelize[_0xbbaf('0x2')]('string',_0xbbaf('0x8'),_0xbbaf('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xbbaf('0x7')]},'nameField':{'type':Sequelize[_0xbbaf('0x7')]},'customField':{'type':Sequelize[_0xbbaf('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xbbaf('0x7')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 6e70f11..d9df80f 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 _0x345e=['../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','error','stack','name','send','map','VtigerField','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','order','where','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','merge','create','body','find','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x44da21,_0x5e027e){var _0x43c71e=function(_0x391197){while(--_0x391197){_0x44da21['push'](_0x44da21['shift']());}};_0x43c71e(++_0x5e027e);}(_0x345e,0x10d));var _0xe345=function(_0x2faaba,_0x3f2b50){_0x2faaba=_0x2faaba-0x0;var _0x7099d9=_0x345e[_0x2faaba];return _0x7099d9;};'use strict';var emlformat=require(_0xe345('0x0'));var rimraf=require(_0xe345('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe345('0x2'));var moment=require(_0xe345('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xe345('0x4'));var util=require(_0xe345('0x5'));var path=require(_0xe345('0x6'));var sox=require(_0xe345('0x7'));var csv=require(_0xe345('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe345('0x9'));var squel=require(_0xe345('0xa'));var crypto=require('crypto');var jsforce=require(_0xe345('0xb'));var deskjs=require(_0xe345('0xc'));var toCsv=require(_0xe345('0x8'));var querystring=require('querystring');var Papa=require(_0xe345('0xd'));var Redis=require(_0xe345('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xe345('0xf'));var as=require(_0xe345('0x10'));var hardwareService=require(_0xe345('0x11'));var logger=require(_0xe345('0x12'))(_0xe345('0x13'));var utils=require(_0xe345('0x14'));var config=require(_0xe345('0x15'));var licenseUtil=require(_0xe345('0x16'));var db=require(_0xe345('0x17'))['db'];function respondWithStatusCode(_0x3b4345,_0x50fa0e){_0x50fa0e=_0x50fa0e||0xcc;return function(_0x40f5bb){if(_0x40f5bb){return _0x3b4345[_0xe345('0x18')](_0x50fa0e);}return _0x3b4345[_0xe345('0x19')](_0x50fa0e)[_0xe345('0x1a')]();};}function respondWithResult(_0x16ec54,_0x52a308){_0x52a308=_0x52a308||0xc8;return function(_0xec970b){if(_0xec970b){return _0x16ec54[_0xe345('0x19')](_0x52a308)[_0xe345('0x1b')](_0xec970b);}};}function respondWithFilteredResult(_0x8cb9df,_0xb1a481){return function(_0x330c37){if(_0x330c37){var _0x505035=typeof _0xb1a481[_0xe345('0x1c')]===_0xe345('0x1d')&&typeof _0xb1a481[_0xe345('0x1e')]===_0xe345('0x1d');var _0x523bb1=_0x330c37[_0xe345('0x1f')];var _0x26c134=_0x505035?0x0:_0xb1a481[_0xe345('0x1c')];var _0x50d19d=_0x505035?_0x330c37[_0xe345('0x1f')]:_0xb1a481[_0xe345('0x1c')]+_0xb1a481['limit'];var _0x42c4a1;if(_0x50d19d>=_0x523bb1){_0x50d19d=_0x523bb1;_0x42c4a1=0xc8;}else{_0x42c4a1=0xce;}_0x8cb9df['status'](_0x42c4a1);return _0x8cb9df[_0xe345('0x20')](_0xe345('0x21'),_0x26c134+'-'+_0x50d19d+'/'+_0x523bb1)[_0xe345('0x1b')](_0x330c37);}return null;};}function patchUpdates(_0x578a3a){return function(_0x58d8bf){try{jsonpatch[_0xe345('0x22')](_0x58d8bf,_0x578a3a,!![]);}catch(_0x9e2920){return BPromise[_0xe345('0x23')](_0x9e2920);}return _0x58d8bf['save']();};}function saveUpdates(_0x24a828,_0x5e909f){return function(_0x4004a6){if(_0x4004a6){return _0x4004a6[_0xe345('0x24')](_0x24a828)[_0xe345('0x25')](function(_0x3de52f){return _0x3de52f;});}return null;};}function removeEntity(_0x18774e,_0x569926){return function(_0x384978){if(_0x384978){return _0x384978['destroy']()['then'](function(){_0x18774e[_0xe345('0x19')](0xcc)[_0xe345('0x1a')]();});}};}function handleEntityNotFound(_0xcfbae8,_0x36871e){return function(_0x33a8dc){if(!_0x33a8dc){_0xcfbae8[_0xe345('0x18')](0x194);}return _0x33a8dc;};}function handleError(_0x55f298,_0x2f9607){_0x2f9607=_0x2f9607||0x1f4;return function(_0x1aa9c9){logger[_0xe345('0x26')](_0x1aa9c9[_0xe345('0x27')]);if(_0x1aa9c9['name']){delete _0x1aa9c9[_0xe345('0x28')];}_0x55f298['status'](_0x2f9607)[_0xe345('0x29')](_0x1aa9c9);};}exports['index']=function(_0x3ae991,_0x200752){var _0x122df9={},_0x13a6d8={},_0x1abd41={'count':0x0,'rows':[]};var _0x40e1e7=_[_0xe345('0x2a')](db[_0xe345('0x2b')][_0xe345('0x2c')],function(_0x2033ee){return{'name':_0x2033ee[_0xe345('0x2d')],'type':_0x2033ee[_0xe345('0x2e')][_0xe345('0x2f')]};});_0x13a6d8[_0xe345('0x30')]=_[_0xe345('0x2a')](_0x40e1e7,_0xe345('0x28'));_0x13a6d8['query']=_[_0xe345('0x31')](_0x3ae991['query']);_0x13a6d8[_0xe345('0x32')]=_[_0xe345('0x33')](_0x13a6d8[_0xe345('0x30')],_0x13a6d8[_0xe345('0x34')]);_0x122df9[_0xe345('0x35')]=_[_0xe345('0x33')](_0x13a6d8[_0xe345('0x30')],qs[_0xe345('0x36')](_0x3ae991[_0xe345('0x34')][_0xe345('0x36')]));_0x122df9[_0xe345('0x35')]=_0x122df9[_0xe345('0x35')][_0xe345('0x37')]?_0x122df9[_0xe345('0x35')]:_0x13a6d8[_0xe345('0x30')];if(!_0x3ae991['query'][_0xe345('0x38')]('nolimit')){_0x122df9['limit']=qs[_0xe345('0x1e')](_0x3ae991[_0xe345('0x34')][_0xe345('0x1e')]);_0x122df9['offset']=qs['offset'](_0x3ae991['query']['offset']);}_0x122df9[_0xe345('0x39')]=qs['sort'](_0x3ae991[_0xe345('0x34')]['sort']);_0x122df9[_0xe345('0x3a')]=qs[_0xe345('0x32')](_['pick'](_0x3ae991[_0xe345('0x34')],_0x13a6d8['filters']),_0x40e1e7);if(_0x3ae991[_0xe345('0x34')][_0xe345('0x3b')]){_0x122df9[_0xe345('0x3a')]=_['merge'](_0x122df9[_0xe345('0x3a')],{'$or':_[_0xe345('0x2a')](_0x40e1e7,function(_0x3ac53f){if(_0x3ac53f[_0xe345('0x2e')]!==_0xe345('0x3c')){var _0x2ec8e0={};_0x2ec8e0[_0x3ac53f['name']]={'$like':'%'+_0x3ae991['query'][_0xe345('0x3b')]+'%'};return _0x2ec8e0;}})});}_0x122df9=_['merge']({},_0x122df9,_0x3ae991[_0xe345('0x3d')]);var _0x2c91f4={'where':_0x122df9[_0xe345('0x3a')]};return db[_0xe345('0x2b')][_0xe345('0x1f')](_0x2c91f4)[_0xe345('0x25')](function(_0x2f4893){_0x1abd41['count']=_0x2f4893;if(_0x3ae991[_0xe345('0x34')][_0xe345('0x3e')]){_0x122df9[_0xe345('0x3f')]=[{'all':!![]}];}return db['VtigerField'][_0xe345('0x40')](_0x122df9);})[_0xe345('0x25')](function(_0x23f3ae){_0x1abd41[_0xe345('0x41')]=_0x23f3ae;return _0x1abd41;})[_0xe345('0x25')](respondWithFilteredResult(_0x200752,_0x122df9))[_0xe345('0x42')](handleError(_0x200752,null));};exports[_0xe345('0x43')]=function(_0x4acccf,_0xb24f47){var _0x2857e8={'raw':!![],'where':{'id':_0x4acccf[_0xe345('0x44')]['id']}},_0x5cbc02={};_0x5cbc02[_0xe345('0x30')]=_[_0xe345('0x31')](db[_0xe345('0x2b')]['rawAttributes']);_0x5cbc02[_0xe345('0x34')]=_[_0xe345('0x31')](_0x4acccf[_0xe345('0x34')]);_0x5cbc02[_0xe345('0x32')]=_[_0xe345('0x33')](_0x5cbc02[_0xe345('0x30')],_0x5cbc02['query']);_0x2857e8[_0xe345('0x35')]=_['intersection'](_0x5cbc02[_0xe345('0x30')],qs[_0xe345('0x36')](_0x4acccf[_0xe345('0x34')][_0xe345('0x36')]));_0x2857e8[_0xe345('0x35')]=_0x2857e8[_0xe345('0x35')][_0xe345('0x37')]?_0x2857e8[_0xe345('0x35')]:_0x5cbc02[_0xe345('0x30')];if(_0x4acccf['query'][_0xe345('0x3e')]){_0x2857e8['include']=[{'all':!![]}];}_0x2857e8=_[_0xe345('0x45')]({},_0x2857e8,_0x4acccf['options']);return db[_0xe345('0x2b')]['find'](_0x2857e8)[_0xe345('0x25')](handleEntityNotFound(_0xb24f47,null))[_0xe345('0x25')](respondWithResult(_0xb24f47,null))[_0xe345('0x42')](handleError(_0xb24f47,null));};exports[_0xe345('0x46')]=function(_0x5a8a79,_0x13462c){return db[_0xe345('0x2b')][_0xe345('0x46')](_0x5a8a79['body'],{})[_0xe345('0x25')](respondWithResult(_0x13462c,0xc9))[_0xe345('0x42')](handleError(_0x13462c,null));};exports['update']=function(_0x24b915,_0x5be853){if(_0x24b915[_0xe345('0x47')]['id']){delete _0x24b915[_0xe345('0x47')]['id'];}return db[_0xe345('0x2b')][_0xe345('0x48')]({'where':{'id':_0x24b915[_0xe345('0x44')]['id']}})[_0xe345('0x25')](handleEntityNotFound(_0x5be853,null))[_0xe345('0x25')](saveUpdates(_0x24b915[_0xe345('0x47')],null))[_0xe345('0x25')](respondWithResult(_0x5be853,null))[_0xe345('0x42')](handleError(_0x5be853,null));};exports['destroy']=function(_0x493fd8,_0xd28f2f){return db['VtigerField']['find']({'where':{'id':_0x493fd8[_0xe345('0x44')]['id']}})[_0xe345('0x25')](handleEntityNotFound(_0xd28f2f,null))[_0xe345('0x25')](removeEntity(_0xd28f2f,null))[_0xe345('0x42')](handleError(_0xd28f2f,null));}; \ No newline at end of file +var _0x8139=['length','sort','where','filters','filter','VIRTUAL','options','VtigerField','includeAll','include','findAll','rows','catch','show','merge','body','find','params','destroy','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','end','sendStatus','error','stack','name','send','index','rawAttributes','fieldName','key','map','keys','query','intersection','model','fields','attributes'];(function(_0x77a1ff,_0xab2cbd){var _0x51c44f=function(_0xe97f7a){while(--_0xe97f7a){_0x77a1ff['push'](_0x77a1ff['shift']());}};_0x51c44f(++_0xab2cbd);}(_0x8139,0xa7));var _0x9813=function(_0x1ad57c,_0x57f1fd){_0x1ad57c=_0x1ad57c-0x0;var _0xe15dc7=_0x8139[_0x1ad57c];return _0xe15dc7;};'use strict';var emlformat=require(_0x9813('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9813('0x1'));var jsonpatch=require(_0x9813('0x2'));var rp=require('request-promise');var moment=require(_0x9813('0x3'));var BPromise=require(_0x9813('0x4'));var Mustache=require(_0x9813('0x5'));var util=require('util');var path=require(_0x9813('0x6'));var sox=require('sox');var csv=require(_0x9813('0x7'));var ejs=require(_0x9813('0x8'));var fs=require('fs');var fs_extra=require(_0x9813('0x9'));var _=require(_0x9813('0xa'));var squel=require(_0x9813('0xb'));var crypto=require('crypto');var jsforce=require(_0x9813('0xc'));var deskjs=require(_0x9813('0xd'));var toCsv=require('to-csv');var querystring=require(_0x9813('0xe'));var Papa=require(_0x9813('0xf'));var Redis=require(_0x9813('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9813('0x11'));var as=require(_0x9813('0x12'));var hardwareService=require(_0x9813('0x13'));var logger=require(_0x9813('0x14'))(_0x9813('0x15'));var utils=require(_0x9813('0x16'));var config=require(_0x9813('0x17'));var licenseUtil=require(_0x9813('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a610f,_0x3d5cb6){_0x3d5cb6=_0x3d5cb6||0xcc;return function(_0x456490){if(_0x456490){return _0x1a610f['sendStatus'](_0x3d5cb6);}return _0x1a610f[_0x9813('0x19')](_0x3d5cb6)['end']();};}function respondWithResult(_0x1007b9,_0xb7584f){_0xb7584f=_0xb7584f||0xc8;return function(_0x572179){if(_0x572179){return _0x1007b9['status'](_0xb7584f)['json'](_0x572179);}};}function respondWithFilteredResult(_0x5377fa,_0x1ec8b7){return function(_0x3ea077){if(_0x3ea077){var _0x297020=typeof _0x1ec8b7[_0x9813('0x1a')]===_0x9813('0x1b')&&typeof _0x1ec8b7[_0x9813('0x1c')]==='undefined';var _0x5f330d=_0x3ea077[_0x9813('0x1d')];var _0xe660aa=_0x297020?0x0:_0x1ec8b7[_0x9813('0x1a')];var _0x3b60b4=_0x297020?_0x3ea077[_0x9813('0x1d')]:_0x1ec8b7['offset']+_0x1ec8b7['limit'];var _0x3ed642;if(_0x3b60b4>=_0x5f330d){_0x3b60b4=_0x5f330d;_0x3ed642=0xc8;}else{_0x3ed642=0xce;}_0x5377fa[_0x9813('0x19')](_0x3ed642);return _0x5377fa[_0x9813('0x1e')](_0x9813('0x1f'),_0xe660aa+'-'+_0x3b60b4+'/'+_0x5f330d)[_0x9813('0x20')](_0x3ea077);}return null;};}function patchUpdates(_0x68a2c5){return function(_0x481a0e){try{jsonpatch[_0x9813('0x21')](_0x481a0e,_0x68a2c5,!![]);}catch(_0x22bb00){return BPromise[_0x9813('0x22')](_0x22bb00);}return _0x481a0e[_0x9813('0x23')]();};}function saveUpdates(_0x43cdcc,_0x4b7d34){return function(_0x1211f4){if(_0x1211f4){return _0x1211f4[_0x9813('0x24')](_0x43cdcc)['then'](function(_0x1e7497){return _0x1e7497;});}return null;};}function removeEntity(_0xdeedd3,_0x22e65f){return function(_0x982f5c){if(_0x982f5c){return _0x982f5c['destroy']()[_0x9813('0x25')](function(){_0xdeedd3[_0x9813('0x19')](0xcc)[_0x9813('0x26')]();});}};}function handleEntityNotFound(_0x1d4c89,_0x5f2ab9){return function(_0x3f83ee){if(!_0x3f83ee){_0x1d4c89[_0x9813('0x27')](0x194);}return _0x3f83ee;};}function handleError(_0x11654e,_0x25750e){_0x25750e=_0x25750e||0x1f4;return function(_0x2e63b4){logger[_0x9813('0x28')](_0x2e63b4[_0x9813('0x29')]);if(_0x2e63b4[_0x9813('0x2a')]){delete _0x2e63b4[_0x9813('0x2a')];}_0x11654e[_0x9813('0x19')](_0x25750e)[_0x9813('0x2b')](_0x2e63b4);};}exports[_0x9813('0x2c')]=function(_0x2356ed,_0x556c27){var _0x3297df={},_0x269062={},_0x260881={'count':0x0,'rows':[]};var _0x1c72c2=_['map'](db['VtigerField'][_0x9813('0x2d')],function(_0xbff545){return{'name':_0xbff545[_0x9813('0x2e')],'type':_0xbff545['type'][_0x9813('0x2f')]};});_0x269062['model']=_[_0x9813('0x30')](_0x1c72c2,_0x9813('0x2a'));_0x269062['query']=_[_0x9813('0x31')](_0x2356ed[_0x9813('0x32')]);_0x269062['filters']=_[_0x9813('0x33')](_0x269062[_0x9813('0x34')],_0x269062[_0x9813('0x32')]);_0x3297df['attributes']=_[_0x9813('0x33')](_0x269062[_0x9813('0x34')],qs[_0x9813('0x35')](_0x2356ed[_0x9813('0x32')]['fields']));_0x3297df[_0x9813('0x36')]=_0x3297df[_0x9813('0x36')][_0x9813('0x37')]?_0x3297df[_0x9813('0x36')]:_0x269062['model'];if(!_0x2356ed[_0x9813('0x32')]['hasOwnProperty']('nolimit')){_0x3297df[_0x9813('0x1c')]=qs['limit'](_0x2356ed[_0x9813('0x32')][_0x9813('0x1c')]);_0x3297df[_0x9813('0x1a')]=qs[_0x9813('0x1a')](_0x2356ed[_0x9813('0x32')]['offset']);}_0x3297df['order']=qs[_0x9813('0x38')](_0x2356ed['query'][_0x9813('0x38')]);_0x3297df[_0x9813('0x39')]=qs[_0x9813('0x3a')](_['pick'](_0x2356ed[_0x9813('0x32')],_0x269062[_0x9813('0x3a')]),_0x1c72c2);if(_0x2356ed[_0x9813('0x32')][_0x9813('0x3b')]){_0x3297df['where']=_['merge'](_0x3297df['where'],{'$or':_[_0x9813('0x30')](_0x1c72c2,function(_0x107292){if(_0x107292['type']!==_0x9813('0x3c')){var _0x1188e8={};_0x1188e8[_0x107292[_0x9813('0x2a')]]={'$like':'%'+_0x2356ed[_0x9813('0x32')][_0x9813('0x3b')]+'%'};return _0x1188e8;}})});}_0x3297df=_['merge']({},_0x3297df,_0x2356ed[_0x9813('0x3d')]);var _0x35b133={'where':_0x3297df[_0x9813('0x39')]};return db[_0x9813('0x3e')]['count'](_0x35b133)[_0x9813('0x25')](function(_0x36b76c){_0x260881['count']=_0x36b76c;if(_0x2356ed[_0x9813('0x32')][_0x9813('0x3f')]){_0x3297df[_0x9813('0x40')]=[{'all':!![]}];}return db[_0x9813('0x3e')][_0x9813('0x41')](_0x3297df);})[_0x9813('0x25')](function(_0x2f0094){_0x260881[_0x9813('0x42')]=_0x2f0094;return _0x260881;})[_0x9813('0x25')](respondWithFilteredResult(_0x556c27,_0x3297df))[_0x9813('0x43')](handleError(_0x556c27,null));};exports[_0x9813('0x44')]=function(_0x1b3307,_0x34eb94){var _0x1a7f0d={'raw':!![],'where':{'id':_0x1b3307['params']['id']}},_0x3e97c1={};_0x3e97c1[_0x9813('0x34')]=_['keys'](db[_0x9813('0x3e')][_0x9813('0x2d')]);_0x3e97c1[_0x9813('0x32')]=_['keys'](_0x1b3307['query']);_0x3e97c1[_0x9813('0x3a')]=_[_0x9813('0x33')](_0x3e97c1[_0x9813('0x34')],_0x3e97c1[_0x9813('0x32')]);_0x1a7f0d[_0x9813('0x36')]=_[_0x9813('0x33')](_0x3e97c1[_0x9813('0x34')],qs[_0x9813('0x35')](_0x1b3307[_0x9813('0x32')][_0x9813('0x35')]));_0x1a7f0d[_0x9813('0x36')]=_0x1a7f0d['attributes'][_0x9813('0x37')]?_0x1a7f0d[_0x9813('0x36')]:_0x3e97c1[_0x9813('0x34')];if(_0x1b3307[_0x9813('0x32')][_0x9813('0x3f')]){_0x1a7f0d['include']=[{'all':!![]}];}_0x1a7f0d=_[_0x9813('0x45')]({},_0x1a7f0d,_0x1b3307[_0x9813('0x3d')]);return db[_0x9813('0x3e')]['find'](_0x1a7f0d)[_0x9813('0x25')](handleEntityNotFound(_0x34eb94,null))[_0x9813('0x25')](respondWithResult(_0x34eb94,null))[_0x9813('0x43')](handleError(_0x34eb94,null));};exports['create']=function(_0x484c87,_0x402ddc){return db[_0x9813('0x3e')]['create'](_0x484c87['body'],{})[_0x9813('0x25')](respondWithResult(_0x402ddc,0xc9))[_0x9813('0x43')](handleError(_0x402ddc,null));};exports[_0x9813('0x24')]=function(_0x32473c,_0x2b6347){if(_0x32473c[_0x9813('0x46')]['id']){delete _0x32473c[_0x9813('0x46')]['id'];}return db[_0x9813('0x3e')][_0x9813('0x47')]({'where':{'id':_0x32473c[_0x9813('0x48')]['id']}})['then'](handleEntityNotFound(_0x2b6347,null))['then'](saveUpdates(_0x32473c[_0x9813('0x46')],null))[_0x9813('0x25')](respondWithResult(_0x2b6347,null))[_0x9813('0x43')](handleError(_0x2b6347,null));};exports[_0x9813('0x49')]=function(_0x20d146,_0x4d0116){return db[_0x9813('0x3e')][_0x9813('0x47')]({'where':{'id':_0x20d146[_0x9813('0x48')]['id']}})[_0x9813('0x25')](handleEntityNotFound(_0x4d0116,null))['then'](removeEntity(_0x4d0116,null))[_0x9813('0x43')](handleError(_0x4d0116,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 2e980f2..019e6a7 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 _0x77ef=['define','VtigerField','int_vtiger_fields','vtiger_unique_index','idField','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerField.attributes'];(function(_0xf517e2,_0xc41536){var _0x41d172=function(_0xc80b48){while(--_0xc80b48){_0xf517e2['push'](_0xf517e2['shift']());}};_0x41d172(++_0xc41536);}(_0x77ef,0x8c));var _0xf77e=function(_0x17c070,_0x5b246d){_0x17c070=_0x17c070-0x0;var _0x310049=_0x77ef[_0x17c070];return _0x310049;};'use strict';var _=require('lodash');var util=require(_0xf77e('0x0'));var logger=require(_0xf77e('0x1'))(_0xf77e('0x2'));var moment=require(_0xf77e('0x3'));var BPromise=require(_0xf77e('0x4'));var rp=require(_0xf77e('0x5'));var fs=require('fs');var path=require(_0xf77e('0x6'));var rimraf=require(_0xf77e('0x7'));var config=require(_0xf77e('0x8'));var attributes=require(_0xf77e('0x9'));module['exports']=function(_0x5d691b,_0x7dad8a){return _0x5d691b[_0xf77e('0xa')](_0xf77e('0xb'),attributes,{'tableName':_0xf77e('0xc'),'paranoid':![],'indexes':[{'name':_0xf77e('0xd'),'fields':[_0xf77e('0xe'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcc8a=['moment','bluebird','request-promise','path','rimraf','./intVtigerField.attributes','exports','define','VtigerField','int_vtiger_fields','vtiger_unique_index','FieldId','lodash','util'];(function(_0x101802,_0x11f913){var _0x5d61ce=function(_0x4acc0){while(--_0x4acc0){_0x101802['push'](_0x101802['shift']());}};_0x5d61ce(++_0x11f913);}(_0xcc8a,0x178));var _0xacc8=function(_0x252938,_0x2461a6){_0x252938=_0x252938-0x0;var _0x95f9e6=_0xcc8a[_0x252938];return _0x95f9e6;};'use strict';var _=require(_0xacc8('0x0'));var util=require(_0xacc8('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xacc8('0x2'));var BPromise=require(_0xacc8('0x3'));var rp=require(_0xacc8('0x4'));var fs=require('fs');var path=require(_0xacc8('0x5'));var rimraf=require(_0xacc8('0x6'));var config=require('../../config/environment');var attributes=require(_0xacc8('0x7'));module[_0xacc8('0x8')]=function(_0x59799d,_0x1b501c){return _0x59799d[_0xacc8('0x9')](_0xacc8('0xa'),attributes,{'tableName':_0xacc8('0xb'),'paranoid':![],'indexes':[{'name':_0xacc8('0xc'),'fields':['idField',_0xacc8('0xd')],'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 58dc4ad..022517d 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 _0x7c33=['code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x1e00a0,_0x4b6893){var _0x271dc4=function(_0x1a2951){while(--_0x1a2951){_0x1e00a0['push'](_0x1e00a0['shift']());}};_0x271dc4(++_0x4b6893);}(_0x7c33,0x10c));var _0x37c3=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0x7c33[_0x565c49];return _0x20ca34;};'use strict';var _=require(_0x37c3('0x0'));var util=require('util');var moment=require(_0x37c3('0x1'));var BPromise=require(_0x37c3('0x2'));var rs=require(_0x37c3('0x3'));var fs=require('fs');var Redis=require(_0x37c3('0x4'));var db=require(_0x37c3('0x5'))['db'];var utils=require(_0x37c3('0x6'));var logger=require(_0x37c3('0x7'))('rpc');var config=require(_0x37c3('0x8'));var jayson=require(_0x37c3('0x9'));var client=jayson[_0x37c3('0xa')][_0x37c3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x83b626,_0x301256,_0x273a35){return new BPromise(function(_0x144a04,_0x2589a7){return client['request'](_0x83b626,_0x273a35)[_0x37c3('0xc')](function(_0x4e65d8){logger[_0x37c3('0xd')](_0x37c3('0xe'),_0x301256,_0x37c3('0xf'));logger[_0x37c3('0x10')](_0x37c3('0x11'),_0x301256,_0x37c3('0xf'),JSON[_0x37c3('0x12')](_0x4e65d8));if(_0x4e65d8[_0x37c3('0x13')]){if(_0x4e65d8['error'][_0x37c3('0x14')]===0x1f4){logger[_0x37c3('0x13')](_0x37c3('0xe'),_0x301256,_0x4e65d8[_0x37c3('0x13')][_0x37c3('0x15')]);return _0x2589a7(_0x4e65d8['error'][_0x37c3('0x15')]);}logger['error']('VtigerField,\x20%s,\x20%s',_0x301256,_0x4e65d8['error'][_0x37c3('0x15')]);return _0x144a04(_0x4e65d8['error'][_0x37c3('0x15')]);}else{logger['info'](_0x37c3('0xe'),_0x301256,_0x37c3('0xf'));_0x144a04(_0x4e65d8[_0x37c3('0x16')][_0x37c3('0x15')]);}})[_0x37c3('0x17')](function(_0x2b74ad){logger[_0x37c3('0x13')]('VtigerField,\x20%s,\x20%s',_0x301256,_0x2b74ad);_0x2589a7(_0x2b74ad);});});} \ No newline at end of file +var _0x6b19=['error','message','result','catch','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6b19,0xe8));var _0x96b1=function(_0x25c3b8,_0x13a873){_0x25c3b8=_0x25c3b8-0x0;var _0x3454b3=_0x6b19[_0x25c3b8];return _0x3454b3;};'use strict';var _=require(_0x96b1('0x0'));var util=require(_0x96b1('0x1'));var moment=require('moment');var BPromise=require(_0x96b1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x96b1('0x3'))['db'];var utils=require(_0x96b1('0x4'));var logger=require(_0x96b1('0x5'))(_0x96b1('0x6'));var config=require(_0x96b1('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x96b1('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3e3e1a,_0x572fde,_0x57a23a){return new BPromise(function(_0x307e65,_0x535cc9){return client[_0x96b1('0x9')](_0x3e3e1a,_0x57a23a)['then'](function(_0x36ea50){logger[_0x96b1('0xa')](_0x96b1('0xb'),_0x572fde,_0x96b1('0xc'));logger[_0x96b1('0xd')](_0x96b1('0xe'),_0x572fde,_0x96b1('0xc'),JSON['stringify'](_0x36ea50));if(_0x36ea50['error']){if(_0x36ea50[_0x96b1('0xf')]['code']===0x1f4){logger['error'](_0x96b1('0xb'),_0x572fde,_0x36ea50[_0x96b1('0xf')][_0x96b1('0x10')]);return _0x535cc9(_0x36ea50['error'][_0x96b1('0x10')]);}logger[_0x96b1('0xf')](_0x96b1('0xb'),_0x572fde,_0x36ea50[_0x96b1('0xf')][_0x96b1('0x10')]);return _0x307e65(_0x36ea50['error'][_0x96b1('0x10')]);}else{logger[_0x96b1('0xa')](_0x96b1('0xb'),_0x572fde,_0x96b1('0xc'));_0x307e65(_0x36ea50[_0x96b1('0x11')][_0x96b1('0x10')]);}})[_0x96b1('0x12')](function(_0x2d5a32){logger[_0x96b1('0xf')](_0x96b1('0xb'),_0x572fde,_0x2d5a32);_0x535cc9(_0x2d5a32);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index e03037d..b0d68da 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 _0x84c6=['index','/:id','show','/:id/configurations','getFields','post','create','put','delete','destroy','exports','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x84c6,0xe7));var _0x684c=function(_0x5cd510,_0x304bc0){_0x5cd510=_0x5cd510-0x0;var _0x1c0021=_0x84c6[_0x5cd510];return _0x1c0021;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x684c('0x0'));var timeout=require(_0x684c('0x1'));var express=require(_0x684c('0x2'));var router=express['Router']();var fs_extra=require(_0x684c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x684c('0x4'));var config=require(_0x684c('0x5'));var controller=require(_0x684c('0x6'));router[_0x684c('0x7')]('/',auth[_0x684c('0x8')](),controller[_0x684c('0x9')]);router[_0x684c('0x7')](_0x684c('0xa'),auth[_0x684c('0x8')](),controller[_0x684c('0xb')]);router['get'](_0x684c('0xc'),auth[_0x684c('0x8')](),controller['getConfigurations']);router[_0x684c('0x7')]('/:id/fields',auth[_0x684c('0x8')](),controller[_0x684c('0xd')]);router[_0x684c('0xe')]('/',auth[_0x684c('0x8')](),controller[_0x684c('0xf')]);router['post']('/:id/configurations',auth[_0x684c('0x8')](),controller['addConfiguration']);router[_0x684c('0x10')](_0x684c('0xa'),auth[_0x684c('0x8')](),controller['update']);router[_0x684c('0x11')]('/:id',auth[_0x684c('0x8')](),controller[_0x684c('0x12')]);module[_0x684c('0x13')]=router; \ No newline at end of file +var _0xba46=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','/:id/fields','post','create','addConfiguration','put','update','delete','exports','multer'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xba46,0x141));var _0x6ba4=function(_0x2eab40,_0x44f6e5){_0x2eab40=_0x2eab40-0x0;var _0x1570cf=_0xba46[_0x2eab40];return _0x1570cf;};'use strict';var multer=require(_0x6ba4('0x0'));var util=require(_0x6ba4('0x1'));var path=require(_0x6ba4('0x2'));var timeout=require(_0x6ba4('0x3'));var express=require(_0x6ba4('0x4'));var router=express[_0x6ba4('0x5')]();var fs_extra=require(_0x6ba4('0x6'));var auth=require(_0x6ba4('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x6ba4('0x8'));var controller=require(_0x6ba4('0x9'));router[_0x6ba4('0xa')]('/',auth[_0x6ba4('0xb')](),controller[_0x6ba4('0xc')]);router[_0x6ba4('0xa')](_0x6ba4('0xd'),auth[_0x6ba4('0xb')](),controller['show']);router[_0x6ba4('0xa')](_0x6ba4('0xe'),auth[_0x6ba4('0xb')](),controller['getConfigurations']);router[_0x6ba4('0xa')](_0x6ba4('0xf'),auth[_0x6ba4('0xb')](),controller['getFields']);router[_0x6ba4('0x10')]('/',auth[_0x6ba4('0xb')](),controller[_0x6ba4('0x11')]);router[_0x6ba4('0x10')](_0x6ba4('0xe'),auth['isAuthenticated'](),controller[_0x6ba4('0x12')]);router[_0x6ba4('0x13')]('/:id',auth[_0x6ba4('0xb')](),controller[_0x6ba4('0x14')]);router[_0x6ba4('0x15')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x6ba4('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 5cab026..2a3231f 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 _0x9b0d=['STRING','remoteUri','password','token','ENUM','integrationTab','newTab','exports'];(function(_0xc6be3a,_0x540e05){var _0x56a310=function(_0x50a144){while(--_0x50a144){_0xc6be3a['push'](_0xc6be3a['shift']());}};_0x56a310(++_0x540e05);}(_0x9b0d,0xb7));var _0xd9b0=function(_0x24c3d8,_0x401a93){_0x24c3d8=_0x24c3d8-0x0;var _0x332518=_0x9b0d[_0x24c3d8];return _0x332518;};'use strict';var Sequelize=require('sequelize');module[_0xd9b0('0x0')]={'name':{'type':Sequelize[_0xd9b0('0x1')]},'description':{'type':Sequelize[_0xd9b0('0x1')]},'username':{'type':Sequelize[_0xd9b0('0x1')],'unique':'username'},'password':{'type':Sequelize[_0xd9b0('0x1')]},'token':{'type':Sequelize[_0xd9b0('0x1')]},'remoteUri':{'type':Sequelize[_0xd9b0('0x1')],'unique':_0xd9b0('0x2')},'authType':{'type':Sequelize['ENUM'](_0xd9b0('0x3'),_0xd9b0('0x4')),'defaultValue':_0xd9b0('0x3')},'serverUrl':{'type':Sequelize[_0xd9b0('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xd9b0('0x5')](_0xd9b0('0x6'),_0xd9b0('0x7')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0xf03a=['exports','STRING','remoteUri','ENUM','password','token','integrationTab','newTab'];(function(_0x37ffea,_0x25b006){var _0x2e2615=function(_0x5e6c74){while(--_0x5e6c74){_0x37ffea['push'](_0x37ffea['shift']());}};_0x2e2615(++_0x25b006);}(_0xf03a,0x1a0));var _0xaf03=function(_0x10b92f,_0x58e0a8){_0x10b92f=_0x10b92f-0x0;var _0x5bfd2e=_0xf03a[_0x10b92f];return _0x5bfd2e;};'use strict';var Sequelize=require('sequelize');module[_0xaf03('0x0')]={'name':{'type':Sequelize[_0xaf03('0x1')]},'description':{'type':Sequelize[_0xaf03('0x1')]},'username':{'type':Sequelize[_0xaf03('0x1')],'unique':'username'},'password':{'type':Sequelize[_0xaf03('0x1')]},'token':{'type':Sequelize[_0xaf03('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xaf03('0x2')},'authType':{'type':Sequelize[_0xaf03('0x3')](_0xaf03('0x4'),_0xaf03('0x5')),'defaultValue':'password'},'serverUrl':{'type':Sequelize[_0xaf03('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xaf03('0x6'),_0xaf03('0x7')),'defaultValue':_0xaf03('0x6')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 2950494..8defd69 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 _0x34b7=['body','find','getConfigurations','findOne','params','ZendeskConfiguration','length','order','options','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZendeskField','username','password','token','remoteUri','substring','lastIndexOf','GET','format','ticket_fields','authType','headers','%s:%s','base64','Basic\x20%s','%s/token:%s','toString','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','group','assignee','includes','position','system_field_options','custom_field_options','test','error','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','statusCode','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','map','ZendeskAccount','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','merge','include','rows','catch','show','includeAll','create'];(function(_0x4b99f0,_0x419040){var _0x29d886=function(_0x398626){while(--_0x398626){_0x4b99f0['push'](_0x4b99f0['shift']());}};_0x29d886(++_0x419040);}(_0x34b7,0x196));var _0x734b=function(_0x52b24f,_0xca062d){_0x52b24f=_0x52b24f-0x0;var _0x46ea6b=_0x34b7[_0x52b24f];return _0x46ea6b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x734b('0x0'));var jsonpatch=require(_0x734b('0x1'));var rp=require(_0x734b('0x2'));var moment=require(_0x734b('0x3'));var BPromise=require(_0x734b('0x4'));var Mustache=require(_0x734b('0x5'));var util=require('util');var path=require('path');var sox=require(_0x734b('0x6'));var csv=require(_0x734b('0x7'));var ejs=require(_0x734b('0x8'));var fs=require('fs');var fs_extra=require(_0x734b('0x9'));var _=require(_0x734b('0xa'));var squel=require(_0x734b('0xb'));var crypto=require('crypto');var jsforce=require(_0x734b('0xc'));var deskjs=require(_0x734b('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x734b('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x734b('0xf'));var as=require(_0x734b('0x10'));var hardwareService=require(_0x734b('0x11'));var logger=require(_0x734b('0x12'))(_0x734b('0x13'));var utils=require(_0x734b('0x14'));var config=require(_0x734b('0x15'));var licenseUtil=require(_0x734b('0x16'));var db=require(_0x734b('0x17'))['db'];var integrations=require(_0x734b('0x18'));function respondWithStatusCode(_0x189a82,_0xff9ddf){_0xff9ddf=_0xff9ddf||0xcc;return function(_0x145ec3){if(_0x145ec3){return _0x189a82[_0x734b('0x19')](_0xff9ddf);}return _0x189a82['status'](_0xff9ddf)[_0x734b('0x1a')]();};}function respondWithResult(_0x252510,_0x47791c){_0x47791c=_0x47791c||0xc8;return function(_0xd1ab2a){if(_0xd1ab2a){return _0x252510[_0x734b('0x1b')](_0x47791c)[_0x734b('0x1c')](_0xd1ab2a);}};}function respondWithFilteredResult(_0x2372bd,_0x2c03bd){return function(_0xa6d111){if(_0xa6d111){var _0x4b8c63=typeof _0x2c03bd[_0x734b('0x1d')]==='undefined'&&typeof _0x2c03bd[_0x734b('0x1e')]===_0x734b('0x1f');var _0xfb661a=_0xa6d111[_0x734b('0x20')];var _0x4d3b9c=_0x4b8c63?0x0:_0x2c03bd['offset'];var _0xcd12a1=_0x4b8c63?_0xa6d111[_0x734b('0x20')]:_0x2c03bd[_0x734b('0x1d')]+_0x2c03bd[_0x734b('0x1e')];var _0x1c605c;if(_0xcd12a1>=_0xfb661a){_0xcd12a1=_0xfb661a;_0x1c605c=0xc8;}else{_0x1c605c=0xce;}_0x2372bd[_0x734b('0x1b')](_0x1c605c);return _0x2372bd[_0x734b('0x21')](_0x734b('0x22'),_0x4d3b9c+'-'+_0xcd12a1+'/'+_0xfb661a)[_0x734b('0x1c')](_0xa6d111);}return null;};}function patchUpdates(_0x1d2b27){return function(_0x7060f8){try{jsonpatch[_0x734b('0x23')](_0x7060f8,_0x1d2b27,!![]);}catch(_0x477d6d){return BPromise[_0x734b('0x24')](_0x477d6d);}return _0x7060f8['save']();};}function saveUpdates(_0x1e4dcc,_0x7856d7){return function(_0x4f98a7){if(_0x4f98a7){return _0x4f98a7[_0x734b('0x25')](_0x1e4dcc)[_0x734b('0x26')](function(_0x1a7908){return _0x1a7908;});}return null;};}function removeEntity(_0x11fb8e,_0x46d432){return function(_0x26d118){if(_0x26d118){return _0x26d118[_0x734b('0x27')]()[_0x734b('0x26')](function(){_0x11fb8e[_0x734b('0x1b')](0xcc)[_0x734b('0x1a')]();});}};}function handleEntityNotFound(_0x44ffa9,_0x148abe){return function(_0x3bb651){if(!_0x3bb651){_0x44ffa9['sendStatus'](0x194);}return _0x3bb651;};}function handleError(_0x49732b,_0x13cc5a){_0x13cc5a=_0x13cc5a||0x1f4;return function(_0x3680a0){logger['error'](_0x3680a0[_0x734b('0x28')]);if(_0x3680a0[_0x734b('0x29')]){delete _0x3680a0[_0x734b('0x29')];}_0x49732b[_0x734b('0x1b')](_0x13cc5a)[_0x734b('0x2a')](_0x3680a0);};}exports[_0x734b('0x2b')]=function(_0x3ba39c,_0x5c6c5d){var _0x1f3652={},_0x436efe={},_0x42e9ae={'count':0x0,'rows':[]};var _0x241c89=_[_0x734b('0x2c')](db[_0x734b('0x2d')][_0x734b('0x2e')],function(_0x21ed3c){return{'name':_0x21ed3c[_0x734b('0x2f')],'type':_0x21ed3c[_0x734b('0x30')]['key']};});_0x436efe[_0x734b('0x31')]=_[_0x734b('0x2c')](_0x241c89,'name');_0x436efe[_0x734b('0x32')]=_[_0x734b('0x33')](_0x3ba39c[_0x734b('0x32')]);_0x436efe[_0x734b('0x34')]=_[_0x734b('0x35')](_0x436efe[_0x734b('0x31')],_0x436efe[_0x734b('0x32')]);_0x1f3652[_0x734b('0x36')]=_[_0x734b('0x35')](_0x436efe[_0x734b('0x31')],qs[_0x734b('0x37')](_0x3ba39c[_0x734b('0x32')][_0x734b('0x37')]));_0x1f3652[_0x734b('0x36')]=_0x1f3652[_0x734b('0x36')]['length']?_0x1f3652[_0x734b('0x36')]:_0x436efe['model'];if(!_0x3ba39c[_0x734b('0x32')][_0x734b('0x38')](_0x734b('0x39'))){_0x1f3652[_0x734b('0x1e')]=qs[_0x734b('0x1e')](_0x3ba39c[_0x734b('0x32')]['limit']);_0x1f3652['offset']=qs[_0x734b('0x1d')](_0x3ba39c['query'][_0x734b('0x1d')]);}_0x1f3652['order']=qs[_0x734b('0x3a')](_0x3ba39c['query'][_0x734b('0x3a')]);_0x1f3652['where']=qs[_0x734b('0x34')](_[_0x734b('0x3b')](_0x3ba39c[_0x734b('0x32')],_0x436efe[_0x734b('0x34')]),_0x241c89);if(_0x3ba39c[_0x734b('0x32')][_0x734b('0x3c')]){_0x1f3652[_0x734b('0x3d')]=_['merge'](_0x1f3652[_0x734b('0x3d')],{'$or':_[_0x734b('0x2c')](_0x241c89,function(_0x58db39){if(_0x58db39[_0x734b('0x30')]!==_0x734b('0x3e')){var _0x2bb422={};_0x2bb422[_0x58db39[_0x734b('0x29')]]={'$like':'%'+_0x3ba39c['query'][_0x734b('0x3c')]+'%'};return _0x2bb422;}})});}_0x1f3652=_[_0x734b('0x3f')]({},_0x1f3652,_0x3ba39c['options']);var _0x40674c={'where':_0x1f3652[_0x734b('0x3d')]};return db['ZendeskAccount'][_0x734b('0x20')](_0x40674c)[_0x734b('0x26')](function(_0x2820f9){_0x42e9ae[_0x734b('0x20')]=_0x2820f9;if(_0x3ba39c['query']['includeAll']){_0x1f3652[_0x734b('0x40')]=[{'all':!![]}];}return db['ZendeskAccount']['findAll'](_0x1f3652);})[_0x734b('0x26')](function(_0x50bde2){_0x42e9ae[_0x734b('0x41')]=_0x50bde2;return _0x42e9ae;})['then'](respondWithFilteredResult(_0x5c6c5d,_0x1f3652))[_0x734b('0x42')](handleError(_0x5c6c5d,null));};exports[_0x734b('0x43')]=function(_0xe4fe38,_0x4c3fdc){var _0x5cf3a0={'raw':![],'where':{'id':_0xe4fe38['params']['id']}},_0x2e1aa8={};_0x2e1aa8['model']=_[_0x734b('0x33')](db[_0x734b('0x2d')]['rawAttributes']);_0x2e1aa8[_0x734b('0x32')]=_['keys'](_0xe4fe38[_0x734b('0x32')]);_0x2e1aa8[_0x734b('0x34')]=_[_0x734b('0x35')](_0x2e1aa8['model'],_0x2e1aa8[_0x734b('0x32')]);_0x5cf3a0[_0x734b('0x36')]=_[_0x734b('0x35')](_0x2e1aa8[_0x734b('0x31')],qs['fields'](_0xe4fe38['query']['fields']));_0x5cf3a0[_0x734b('0x36')]=_0x5cf3a0['attributes']['length']?_0x5cf3a0[_0x734b('0x36')]:_0x2e1aa8['model'];if(_0xe4fe38[_0x734b('0x32')][_0x734b('0x44')]){_0x5cf3a0[_0x734b('0x40')]=[{'all':!![]}];}_0x5cf3a0=_[_0x734b('0x3f')]({},_0x5cf3a0,_0xe4fe38['options']);return db[_0x734b('0x2d')]['find'](_0x5cf3a0)[_0x734b('0x26')](handleEntityNotFound(_0x4c3fdc,null))[_0x734b('0x26')](respondWithResult(_0x4c3fdc,null))[_0x734b('0x42')](handleError(_0x4c3fdc,null));};exports['create']=function(_0x370326,_0x4c3efb){return db[_0x734b('0x2d')][_0x734b('0x45')](_0x370326['body'],{})[_0x734b('0x26')](respondWithResult(_0x4c3efb,0xc9))[_0x734b('0x42')](handleError(_0x4c3efb,null));};exports[_0x734b('0x25')]=function(_0x38125a,_0x21e127){if(_0x38125a['body']['id']){delete _0x38125a[_0x734b('0x46')]['id'];}return db['ZendeskAccount'][_0x734b('0x47')]({'where':{'id':_0x38125a['params']['id']}})[_0x734b('0x26')](handleEntityNotFound(_0x21e127,null))[_0x734b('0x26')](saveUpdates(_0x38125a[_0x734b('0x46')],null))[_0x734b('0x26')](respondWithResult(_0x21e127,null))[_0x734b('0x42')](handleError(_0x21e127,null));};exports['destroy']=function(_0x4c0378,_0x484156){return db[_0x734b('0x2d')][_0x734b('0x47')]({'where':{'id':_0x4c0378['params']['id']}})[_0x734b('0x26')](handleEntityNotFound(_0x484156,null))[_0x734b('0x26')](removeEntity(_0x484156,null))['catch'](handleError(_0x484156,null));};exports[_0x734b('0x48')]=function(_0x3a9749,_0x44e6d2,_0x4d6501){var _0x2e95aa={};var _0x226f6c={};var _0x423b22;var _0xe605be;return db['ZendeskAccount'][_0x734b('0x49')]({'where':{'id':_0x3a9749[_0x734b('0x4a')]['id']}})[_0x734b('0x26')](handleEntityNotFound(_0x44e6d2,null))[_0x734b('0x26')](function(_0x4b65bf){if(_0x4b65bf){_0x423b22=_0x4b65bf;_0x226f6c[_0x734b('0x31')]=_['keys'](db[_0x734b('0x4b')][_0x734b('0x2e')]);_0x226f6c[_0x734b('0x32')]=_[_0x734b('0x33')](_0x3a9749['query']);_0x226f6c[_0x734b('0x34')]=_[_0x734b('0x35')](_0x226f6c['model'],_0x226f6c['query']);_0x2e95aa[_0x734b('0x36')]=_['intersection'](_0x226f6c[_0x734b('0x31')],qs[_0x734b('0x37')](_0x3a9749[_0x734b('0x32')]['fields']));_0x2e95aa[_0x734b('0x36')]=_0x2e95aa['attributes'][_0x734b('0x4c')]?_0x2e95aa[_0x734b('0x36')]:_0x226f6c[_0x734b('0x31')];_0x2e95aa[_0x734b('0x4d')]=qs['sort'](_0x3a9749[_0x734b('0x32')]['sort']);_0x2e95aa[_0x734b('0x3d')]=qs[_0x734b('0x34')](_[_0x734b('0x3b')](_0x3a9749['query'],_0x226f6c[_0x734b('0x34')]));if(_0x3a9749['query'][_0x734b('0x3c')]){_0x2e95aa[_0x734b('0x3d')]=_[_0x734b('0x3f')](_0x2e95aa[_0x734b('0x3d')],{'$or':_['map'](_0x2e95aa[_0x734b('0x36')],function(_0x48c613){var _0x44e876={};_0x44e876[_0x48c613]={'$like':'%'+_0x3a9749[_0x734b('0x32')][_0x734b('0x3c')]+'%'};return _0x44e876;})});}_0x2e95aa=_['merge']({},_0x2e95aa,_0x3a9749[_0x734b('0x4e')]);return _0x423b22[_0x734b('0x48')](_0x2e95aa);}})[_0x734b('0x26')](function(_0x3b16bb){if(_0x3b16bb){_0xe605be=_0x3b16bb[_0x734b('0x4c')];if(!_0x3a9749[_0x734b('0x32')][_0x734b('0x38')]('nolimit')){_0x2e95aa[_0x734b('0x1e')]=qs[_0x734b('0x1e')](_0x3a9749[_0x734b('0x32')]['limit']);_0x2e95aa['offset']=qs[_0x734b('0x1d')](_0x3a9749[_0x734b('0x32')][_0x734b('0x1d')]);}return _0x423b22[_0x734b('0x48')](_0x2e95aa);}})['then'](function(_0x565a2e){if(_0x565a2e){return _0x565a2e?{'count':_0xe605be,'rows':_0x565a2e}:null;}})['then'](respondWithResult(_0x44e6d2,null))[_0x734b('0x42')](handleError(_0x44e6d2,null));};exports[_0x734b('0x4f')]=function(_0x1f9cfe,_0x292c68,_0x1b57c5){if(_0x1f9cfe[_0x734b('0x46')]['id']){delete _0x1f9cfe[_0x734b('0x46')]['id'];}return db[_0x734b('0x2d')][_0x734b('0x49')]({'where':{'id':_0x1f9cfe[_0x734b('0x4a')]['id']}})[_0x734b('0x26')](handleEntityNotFound(_0x292c68,null))[_0x734b('0x26')](function(_0x43951a){if(_0x43951a){_0x1f9cfe[_0x734b('0x46')][_0x734b('0x50')]=_0x43951a['id'];_0x1f9cfe[_0x734b('0x46')][_0x734b('0x51')]=integrations[_0x734b('0x52')](_0x1f9cfe[_0x734b('0x46')][_0x734b('0x53')],_0x1f9cfe[_0x734b('0x46')]['type']);_0x1f9cfe[_0x734b('0x46')][_0x734b('0x54')]=integrations[_0x734b('0x55')](_0x1f9cfe[_0x734b('0x46')][_0x734b('0x53')],_0x1f9cfe['body'][_0x734b('0x30')]);return db[_0x734b('0x4b')][_0x734b('0x45')](_0x1f9cfe[_0x734b('0x46')],{'include':[{'model':db[_0x734b('0x56')],'as':_0x734b('0x51')},{'model':db['ZendeskField'],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x292c68,null))['catch'](handleError(_0x292c68,null));};exports['getFields']=function(_0x3ce4bc,_0x30ffea,_0x16c9d2){var _0xb23b61='';return db['ZendeskAccount']['findOne']({'where':{'id':_0x3ce4bc[_0x734b('0x4a')]['id']},'attributes':['id',_0x734b('0x57'),_0x734b('0x58'),_0x734b('0x59'),'authType',_0x734b('0x5a')]})[_0x734b('0x26')](handleEntityNotFound(_0x30ffea,null))[_0x734b('0x26')](function(_0x17abbc){if(_0x17abbc){_0xb23b61=_0x17abbc['remoteUri'];var _0x18d7d5=_0xb23b61['slice'](-0x1);if(_0x18d7d5==='/'){_0xb23b61=_0xb23b61[_0x734b('0x5b')](0x0,_0xb23b61[_0x734b('0x5c')](_0x18d7d5));}var _0x14ee37={'method':_0x734b('0x5d'),'uri':util[_0x734b('0x5e')]('%s/%s',_0xb23b61,_0x734b('0x5f')),'json':!![]};switch(_0x17abbc[_0x734b('0x60')]){case _0x734b('0x58'):_0x14ee37[_0x734b('0x61')]={'Authorization':util[_0x734b('0x5e')]('Basic\x20%s',new Buffer(util[_0x734b('0x5e')](_0x734b('0x62'),_0x17abbc[_0x734b('0x57')],_0x17abbc[_0x734b('0x58')]))['toString'](_0x734b('0x63')))};break;case _0x734b('0x59'):_0x14ee37[_0x734b('0x61')]={'Authorization':util[_0x734b('0x5e')](_0x734b('0x64'),new Buffer(util['format'](_0x734b('0x65'),_0x17abbc['username'],_0x17abbc[_0x734b('0x59')]))[_0x734b('0x66')](_0x734b('0x63')))};break;default:throw new db[(_0x734b('0x67'))][(_0x734b('0x68'))](_0x734b('0x69'));}return rp(_0x14ee37);}})['then'](function(_0x4bf06e){if(_0x4bf06e){var _0x55b28e=[_0x734b('0x6a'),'description',_0x734b('0x6b'),_0x734b('0x6c')];_['remove'](_0x4bf06e[_0x734b('0x5f')],function(_0x3ec9e1){return _0x55b28e[_0x734b('0x6d')](_0x3ec9e1[_0x734b('0x30')]);});return{'count':_0x4bf06e[_0x734b('0x5f')][_0x734b('0x4c')],'rows':_[_0x734b('0x2c')](_0x4bf06e[_0x734b('0x5f')],function(_0x408625){return{'id':_0x408625['id'],'name':_0x408625[_0x734b('0x6e')]>0x7?_0x408625['title']:_0x408625[_0x734b('0x30')],'custom':_0x408625[_0x734b('0x6e')]>0x7?!![]:![],'options':_0x408625[_0x734b('0x6f')]?_0x408625['system_field_options']:_0x408625[_0x734b('0x70')]?_0x408625[_0x734b('0x70')]:[]};})};}})[_0x734b('0x26')](respondWithResult(_0x30ffea,null))[_0x734b('0x42')](function(_0x82080a){var _0x309d01=_0x3ce4bc[_0x734b('0x32')][_0x734b('0x71')]?0x1f4:_0x82080a['statusCode']||0x1f4;logger[_0x734b('0x72')](_0x734b('0x73'),_0x734b('0x74'),_0x309d01,JSON[_0x734b('0x75')](_0x82080a));delete _0x82080a[_0x734b('0x29')];if(_0x309d01===0x191){_0x309d01=0x190;}_0x30ffea[_0x734b('0x1b')](_0x309d01)[_0x734b('0x2a')](_0x3ce4bc[_0x734b('0x32')][_0x734b('0x71')]?{'message':'Wrong\x20credentials','statusCode':_0x82080a[_0x734b('0x76')]}:_0x82080a);});}; \ No newline at end of file +var _0x63a5=['username','password','token','remoteUri','substring','lastIndexOf','GET','%s/%s','ticket_fields','authType','headers','format','toString','base64','Basic\x20%s','%s/token:%s','Sequelize','Unknown\x20authentication\x20type','description','group','assignee','remove','includes','position','title','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','ejs','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','offset','undefined','limit','set','Content-Range','json','apply','reject','save','update','destroy','then','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','options','ZendeskAccount','count','includeAll','rows','params','length','include','find','catch','create','body','getConfigurations','findOne','ZendeskConfiguration','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','ZendeskField','getFields'];(function(_0x3dd441,_0x4d25b4){var _0x1f5833=function(_0x305ca6){while(--_0x305ca6){_0x3dd441['push'](_0x3dd441['shift']());}};_0x1f5833(++_0x4d25b4);}(_0x63a5,0x18e));var _0x563a=function(_0x2261ce,_0x9ed8b6){_0x2261ce=_0x2261ce-0x0;var _0x524640=_0x63a5[_0x2261ce];return _0x524640;};'use strict';var emlformat=require(_0x563a('0x0'));var rimraf=require(_0x563a('0x1'));var zipdir=require(_0x563a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x563a('0x3'));var moment=require('moment');var BPromise=require(_0x563a('0x4'));var Mustache=require(_0x563a('0x5'));var util=require(_0x563a('0x6'));var path=require(_0x563a('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x563a('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x563a('0x9'));var squel=require(_0x563a('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x563a('0xb'));var toCsv=require(_0x563a('0xc'));var querystring=require(_0x563a('0xd'));var Papa=require(_0x563a('0xe'));var Redis=require(_0x563a('0xf'));var authService=require(_0x563a('0x10'));var qs=require(_0x563a('0x11'));var as=require(_0x563a('0x12'));var hardwareService=require(_0x563a('0x13'));var logger=require(_0x563a('0x14'))(_0x563a('0x15'));var utils=require(_0x563a('0x16'));var config=require(_0x563a('0x17'));var licenseUtil=require(_0x563a('0x18'));var db=require('../../mysqldb')['db'];var integrations=require(_0x563a('0x19'));function respondWithStatusCode(_0x214f42,_0x10de2e){_0x10de2e=_0x10de2e||0xcc;return function(_0x27034c){if(_0x27034c){return _0x214f42[_0x563a('0x1a')](_0x10de2e);}return _0x214f42[_0x563a('0x1b')](_0x10de2e)['end']();};}function respondWithResult(_0x2cf052,_0x3045ac){_0x3045ac=_0x3045ac||0xc8;return function(_0x8c3727){if(_0x8c3727){return _0x2cf052[_0x563a('0x1b')](_0x3045ac)['json'](_0x8c3727);}};}function respondWithFilteredResult(_0x504cb7,_0x414535){return function(_0x2ad667){if(_0x2ad667){var _0x5b291f=typeof _0x414535[_0x563a('0x1c')]===_0x563a('0x1d')&&typeof _0x414535[_0x563a('0x1e')]===_0x563a('0x1d');var _0x4f947d=_0x2ad667['count'];var _0xe3d2bd=_0x5b291f?0x0:_0x414535[_0x563a('0x1c')];var _0x54a3b4=_0x5b291f?_0x2ad667['count']:_0x414535['offset']+_0x414535['limit'];var _0x4c15c1;if(_0x54a3b4>=_0x4f947d){_0x54a3b4=_0x4f947d;_0x4c15c1=0xc8;}else{_0x4c15c1=0xce;}_0x504cb7[_0x563a('0x1b')](_0x4c15c1);return _0x504cb7[_0x563a('0x1f')](_0x563a('0x20'),_0xe3d2bd+'-'+_0x54a3b4+'/'+_0x4f947d)[_0x563a('0x21')](_0x2ad667);}return null;};}function patchUpdates(_0x562fce){return function(_0x4e3b67){try{jsonpatch[_0x563a('0x22')](_0x4e3b67,_0x562fce,!![]);}catch(_0x9f8b29){return BPromise[_0x563a('0x23')](_0x9f8b29);}return _0x4e3b67[_0x563a('0x24')]();};}function saveUpdates(_0x1bf502,_0x2dc7e2){return function(_0x44b460){if(_0x44b460){return _0x44b460[_0x563a('0x25')](_0x1bf502)['then'](function(_0xd59ba8){return _0xd59ba8;});}return null;};}function removeEntity(_0x5422f6,_0x44e2c1){return function(_0xd3e0ae){if(_0xd3e0ae){return _0xd3e0ae[_0x563a('0x26')]()[_0x563a('0x27')](function(){_0x5422f6[_0x563a('0x1b')](0xcc)[_0x563a('0x28')]();});}};}function handleEntityNotFound(_0x3642b3,_0x173990){return function(_0x4de4c3){if(!_0x4de4c3){_0x3642b3[_0x563a('0x1a')](0x194);}return _0x4de4c3;};}function handleError(_0x2b688e,_0x2311f2){_0x2311f2=_0x2311f2||0x1f4;return function(_0x3d79ac){logger[_0x563a('0x29')](_0x3d79ac[_0x563a('0x2a')]);if(_0x3d79ac[_0x563a('0x2b')]){delete _0x3d79ac[_0x563a('0x2b')];}_0x2b688e[_0x563a('0x1b')](_0x2311f2)[_0x563a('0x2c')](_0x3d79ac);};}exports[_0x563a('0x2d')]=function(_0x24d1a8,_0x1bdfb0){var _0x7696c2={},_0x579cb5={},_0x43379c={'count':0x0,'rows':[]};var _0x3c16d0=_[_0x563a('0x2e')](db['ZendeskAccount'][_0x563a('0x2f')],function(_0x2e5c4b){return{'name':_0x2e5c4b[_0x563a('0x30')],'type':_0x2e5c4b[_0x563a('0x31')][_0x563a('0x32')]};});_0x579cb5[_0x563a('0x33')]=_[_0x563a('0x2e')](_0x3c16d0,'name');_0x579cb5[_0x563a('0x34')]=_[_0x563a('0x35')](_0x24d1a8[_0x563a('0x34')]);_0x579cb5[_0x563a('0x36')]=_[_0x563a('0x37')](_0x579cb5['model'],_0x579cb5['query']);_0x7696c2['attributes']=_['intersection'](_0x579cb5[_0x563a('0x33')],qs[_0x563a('0x38')](_0x24d1a8[_0x563a('0x34')][_0x563a('0x38')]));_0x7696c2[_0x563a('0x39')]=_0x7696c2[_0x563a('0x39')]['length']?_0x7696c2['attributes']:_0x579cb5[_0x563a('0x33')];if(!_0x24d1a8[_0x563a('0x34')][_0x563a('0x3a')](_0x563a('0x3b'))){_0x7696c2[_0x563a('0x1e')]=qs[_0x563a('0x1e')](_0x24d1a8[_0x563a('0x34')][_0x563a('0x1e')]);_0x7696c2[_0x563a('0x1c')]=qs[_0x563a('0x1c')](_0x24d1a8[_0x563a('0x34')][_0x563a('0x1c')]);}_0x7696c2[_0x563a('0x3c')]=qs[_0x563a('0x3d')](_0x24d1a8[_0x563a('0x34')][_0x563a('0x3d')]);_0x7696c2['where']=qs[_0x563a('0x36')](_[_0x563a('0x3e')](_0x24d1a8[_0x563a('0x34')],_0x579cb5['filters']),_0x3c16d0);if(_0x24d1a8[_0x563a('0x34')]['filter']){_0x7696c2[_0x563a('0x3f')]=_[_0x563a('0x40')](_0x7696c2['where'],{'$or':_['map'](_0x3c16d0,function(_0x1b48f1){if(_0x1b48f1['type']!==_0x563a('0x41')){var _0x92bd6={};_0x92bd6[_0x1b48f1[_0x563a('0x2b')]]={'$like':'%'+_0x24d1a8[_0x563a('0x34')]['filter']+'%'};return _0x92bd6;}})});}_0x7696c2=_['merge']({},_0x7696c2,_0x24d1a8[_0x563a('0x42')]);var _0x598ee3={'where':_0x7696c2[_0x563a('0x3f')]};return db[_0x563a('0x43')][_0x563a('0x44')](_0x598ee3)[_0x563a('0x27')](function(_0x3a2eb0){_0x43379c[_0x563a('0x44')]=_0x3a2eb0;if(_0x24d1a8[_0x563a('0x34')][_0x563a('0x45')]){_0x7696c2['include']=[{'all':!![]}];}return db[_0x563a('0x43')]['findAll'](_0x7696c2);})[_0x563a('0x27')](function(_0x3de697){_0x43379c[_0x563a('0x46')]=_0x3de697;return _0x43379c;})[_0x563a('0x27')](respondWithFilteredResult(_0x1bdfb0,_0x7696c2))['catch'](handleError(_0x1bdfb0,null));};exports['show']=function(_0x54ac1e,_0x2221d4){var _0x1255da={'raw':![],'where':{'id':_0x54ac1e[_0x563a('0x47')]['id']}},_0x19b18f={};_0x19b18f[_0x563a('0x33')]=_[_0x563a('0x35')](db[_0x563a('0x43')][_0x563a('0x2f')]);_0x19b18f[_0x563a('0x34')]=_[_0x563a('0x35')](_0x54ac1e[_0x563a('0x34')]);_0x19b18f[_0x563a('0x36')]=_[_0x563a('0x37')](_0x19b18f[_0x563a('0x33')],_0x19b18f[_0x563a('0x34')]);_0x1255da[_0x563a('0x39')]=_[_0x563a('0x37')](_0x19b18f[_0x563a('0x33')],qs[_0x563a('0x38')](_0x54ac1e['query']['fields']));_0x1255da[_0x563a('0x39')]=_0x1255da[_0x563a('0x39')][_0x563a('0x48')]?_0x1255da[_0x563a('0x39')]:_0x19b18f[_0x563a('0x33')];if(_0x54ac1e[_0x563a('0x34')][_0x563a('0x45')]){_0x1255da[_0x563a('0x49')]=[{'all':!![]}];}_0x1255da=_['merge']({},_0x1255da,_0x54ac1e['options']);return db[_0x563a('0x43')][_0x563a('0x4a')](_0x1255da)[_0x563a('0x27')](handleEntityNotFound(_0x2221d4,null))[_0x563a('0x27')](respondWithResult(_0x2221d4,null))[_0x563a('0x4b')](handleError(_0x2221d4,null));};exports[_0x563a('0x4c')]=function(_0x2689b5,_0x276642){return db['ZendeskAccount'][_0x563a('0x4c')](_0x2689b5[_0x563a('0x4d')],{})['then'](respondWithResult(_0x276642,0xc9))[_0x563a('0x4b')](handleError(_0x276642,null));};exports['update']=function(_0x3ea787,_0xab7b16){if(_0x3ea787[_0x563a('0x4d')]['id']){delete _0x3ea787['body']['id'];}return db[_0x563a('0x43')][_0x563a('0x4a')]({'where':{'id':_0x3ea787[_0x563a('0x47')]['id']}})[_0x563a('0x27')](handleEntityNotFound(_0xab7b16,null))[_0x563a('0x27')](saveUpdates(_0x3ea787[_0x563a('0x4d')],null))[_0x563a('0x27')](respondWithResult(_0xab7b16,null))[_0x563a('0x4b')](handleError(_0xab7b16,null));};exports[_0x563a('0x26')]=function(_0x2008d4,_0x3c98d5){return db[_0x563a('0x43')][_0x563a('0x4a')]({'where':{'id':_0x2008d4['params']['id']}})['then'](handleEntityNotFound(_0x3c98d5,null))[_0x563a('0x27')](removeEntity(_0x3c98d5,null))[_0x563a('0x4b')](handleError(_0x3c98d5,null));};exports[_0x563a('0x4e')]=function(_0x4a807f,_0x5ae08f,_0x13530f){var _0x1fc4d2={};var _0x50ebde={};var _0x4b6ba9;var _0x51e142;return db[_0x563a('0x43')][_0x563a('0x4f')]({'where':{'id':_0x4a807f[_0x563a('0x47')]['id']}})[_0x563a('0x27')](handleEntityNotFound(_0x5ae08f,null))[_0x563a('0x27')](function(_0x2805eb){if(_0x2805eb){_0x4b6ba9=_0x2805eb;_0x50ebde['model']=_['keys'](db[_0x563a('0x50')]['rawAttributes']);_0x50ebde[_0x563a('0x34')]=_[_0x563a('0x35')](_0x4a807f[_0x563a('0x34')]);_0x50ebde[_0x563a('0x36')]=_[_0x563a('0x37')](_0x50ebde[_0x563a('0x33')],_0x50ebde[_0x563a('0x34')]);_0x1fc4d2['attributes']=_[_0x563a('0x37')](_0x50ebde[_0x563a('0x33')],qs['fields'](_0x4a807f[_0x563a('0x34')][_0x563a('0x38')]));_0x1fc4d2[_0x563a('0x39')]=_0x1fc4d2[_0x563a('0x39')][_0x563a('0x48')]?_0x1fc4d2[_0x563a('0x39')]:_0x50ebde[_0x563a('0x33')];_0x1fc4d2[_0x563a('0x3c')]=qs[_0x563a('0x3d')](_0x4a807f[_0x563a('0x34')]['sort']);_0x1fc4d2[_0x563a('0x3f')]=qs[_0x563a('0x36')](_['pick'](_0x4a807f['query'],_0x50ebde[_0x563a('0x36')]));if(_0x4a807f[_0x563a('0x34')]['filter']){_0x1fc4d2[_0x563a('0x3f')]=_['merge'](_0x1fc4d2[_0x563a('0x3f')],{'$or':_[_0x563a('0x2e')](_0x1fc4d2[_0x563a('0x39')],function(_0xbe9fff){var _0x7fa423={};_0x7fa423[_0xbe9fff]={'$like':'%'+_0x4a807f['query']['filter']+'%'};return _0x7fa423;})});}_0x1fc4d2=_['merge']({},_0x1fc4d2,_0x4a807f['options']);return _0x4b6ba9[_0x563a('0x4e')](_0x1fc4d2);}})['then'](function(_0x111444){if(_0x111444){_0x51e142=_0x111444['length'];if(!_0x4a807f[_0x563a('0x34')][_0x563a('0x3a')](_0x563a('0x3b'))){_0x1fc4d2[_0x563a('0x1e')]=qs[_0x563a('0x1e')](_0x4a807f['query'][_0x563a('0x1e')]);_0x1fc4d2['offset']=qs['offset'](_0x4a807f[_0x563a('0x34')][_0x563a('0x1c')]);}return _0x4b6ba9[_0x563a('0x4e')](_0x1fc4d2);}})[_0x563a('0x27')](function(_0x1c8ad7){if(_0x1c8ad7){return _0x1c8ad7?{'count':_0x51e142,'rows':_0x1c8ad7}:null;}})['then'](respondWithResult(_0x5ae08f,null))[_0x563a('0x4b')](handleError(_0x5ae08f,null));};exports[_0x563a('0x51')]=function(_0x20bd36,_0x3bbe7c,_0x36d40c){if(_0x20bd36['body']['id']){delete _0x20bd36[_0x563a('0x4d')]['id'];}return db['ZendeskAccount'][_0x563a('0x4f')]({'where':{'id':_0x20bd36[_0x563a('0x47')]['id']}})['then'](handleEntityNotFound(_0x3bbe7c,null))[_0x563a('0x27')](function(_0x30bf2b){if(_0x30bf2b){_0x20bd36[_0x563a('0x4d')][_0x563a('0x52')]=_0x30bf2b['id'];_0x20bd36[_0x563a('0x4d')][_0x563a('0x53')]=integrations[_0x563a('0x54')](_0x20bd36[_0x563a('0x4d')]['channel'],_0x20bd36[_0x563a('0x4d')][_0x563a('0x31')]);_0x20bd36[_0x563a('0x4d')][_0x563a('0x55')]=integrations[_0x563a('0x56')](_0x20bd36[_0x563a('0x4d')][_0x563a('0x57')],_0x20bd36['body'][_0x563a('0x31')]);return db['ZendeskConfiguration']['create'](_0x20bd36['body'],{'include':[{'model':db[_0x563a('0x58')],'as':'Subjects'},{'model':db['ZendeskField'],'as':_0x563a('0x55')}]});}return null;})[_0x563a('0x27')](respondWithResult(_0x3bbe7c,null))[_0x563a('0x4b')](handleError(_0x3bbe7c,null));};exports[_0x563a('0x59')]=function(_0x2e442f,_0x51220c,_0x4814b3){var _0x4c9ad7='';return db[_0x563a('0x43')][_0x563a('0x4f')]({'where':{'id':_0x2e442f[_0x563a('0x47')]['id']},'attributes':['id',_0x563a('0x5a'),_0x563a('0x5b'),_0x563a('0x5c'),'authType',_0x563a('0x5d')]})[_0x563a('0x27')](handleEntityNotFound(_0x51220c,null))['then'](function(_0x1983e5){if(_0x1983e5){_0x4c9ad7=_0x1983e5[_0x563a('0x5d')];var _0x15e9ce=_0x4c9ad7['slice'](-0x1);if(_0x15e9ce==='/'){_0x4c9ad7=_0x4c9ad7[_0x563a('0x5e')](0x0,_0x4c9ad7[_0x563a('0x5f')](_0x15e9ce));}var _0x332428={'method':_0x563a('0x60'),'uri':util['format'](_0x563a('0x61'),_0x4c9ad7,_0x563a('0x62')),'json':!![]};switch(_0x1983e5[_0x563a('0x63')]){case _0x563a('0x5b'):_0x332428[_0x563a('0x64')]={'Authorization':util['format']('Basic\x20%s',new Buffer(util[_0x563a('0x65')]('%s:%s',_0x1983e5[_0x563a('0x5a')],_0x1983e5[_0x563a('0x5b')]))[_0x563a('0x66')](_0x563a('0x67')))};break;case _0x563a('0x5c'):_0x332428[_0x563a('0x64')]={'Authorization':util[_0x563a('0x65')](_0x563a('0x68'),new Buffer(util[_0x563a('0x65')](_0x563a('0x69'),_0x1983e5['username'],_0x1983e5[_0x563a('0x5c')]))['toString'](_0x563a('0x67')))};break;default:throw new db[(_0x563a('0x6a'))]['ValidationError'](_0x563a('0x6b'));}return rp(_0x332428);}})['then'](function(_0x41f530){if(_0x41f530){var _0x42c448=['subject',_0x563a('0x6c'),_0x563a('0x6d'),_0x563a('0x6e')];_[_0x563a('0x6f')](_0x41f530['ticket_fields'],function(_0x418646){return _0x42c448[_0x563a('0x70')](_0x418646[_0x563a('0x31')]);});return{'count':_0x41f530[_0x563a('0x62')][_0x563a('0x48')],'rows':_[_0x563a('0x2e')](_0x41f530[_0x563a('0x62')],function(_0x137d52){return{'id':_0x137d52['id'],'name':_0x137d52[_0x563a('0x71')]>0x7?_0x137d52[_0x563a('0x72')]:_0x137d52['type'],'custom':_0x137d52[_0x563a('0x71')]>0x7?!![]:![],'options':_0x137d52[_0x563a('0x73')]?_0x137d52[_0x563a('0x73')]:_0x137d52['custom_field_options']?_0x137d52[_0x563a('0x74')]:[]};})};}})[_0x563a('0x27')](respondWithResult(_0x51220c,null))[_0x563a('0x4b')](function(_0xe27e02){var _0x2cca62=_0x2e442f[_0x563a('0x34')][_0x563a('0x75')]?0x1f4:_0xe27e02[_0x563a('0x76')]||0x1f4;logger[_0x563a('0x29')](_0x563a('0x77'),_0x563a('0x59'),_0x2cca62,JSON[_0x563a('0x78')](_0xe27e02));delete _0xe27e02[_0x563a('0x2b')];if(_0x2cca62===0x191){_0x2cca62=0x190;}_0x51220c['status'](_0x2cca62)[_0x563a('0x2c')](_0x2e442f[_0x563a('0x34')]['test']?{'message':_0x563a('0x79'),'statusCode':_0xe27e02[_0x563a('0x76')]}:_0xe27e02);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 8179daa..c34b3c3 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 _0x1d4a=['../../components/integrations/configuration','define','ZendeskAccount','int_zendesk_accounts','util','../../config/logger','api','moment','path','rimraf'];(function(_0xece86e,_0x1284e6){var _0xcb1529=function(_0x2f0633){while(--_0x2f0633){_0xece86e['push'](_0xece86e['shift']());}};_0xcb1529(++_0x1284e6);}(_0x1d4a,0x1bc));var _0xa1d4=function(_0x41423a,_0x5caa2c){_0x41423a=_0x41423a-0x0;var _0x538a41=_0x1d4a[_0x41423a];return _0x538a41;};'use strict';var _=require('lodash');var util=require(_0xa1d4('0x0'));var logger=require(_0xa1d4('0x1'))(_0xa1d4('0x2'));var moment=require(_0xa1d4('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa1d4('0x4'));var rimraf=require(_0xa1d4('0x5'));var config=require('../../config/environment');var attributes=require('./intZendeskAccount.attributes');var integrations=require(_0xa1d4('0x6'));module['exports']=function(_0x151b9f,_0x450025){return _0x151b9f[_0xa1d4('0x7')](_0xa1d4('0x8'),attributes,{'tableName':_0xa1d4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xef05=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define','ZendeskAccount','int_zendesk_accounts','util'];(function(_0x471724,_0x24bd2d){var _0x5eee21=function(_0x143ad6){while(--_0x143ad6){_0x471724['push'](_0x471724['shift']());}};_0x5eee21(++_0x24bd2d);}(_0xef05,0xa7));var _0x5ef0=function(_0x4f8977,_0x3cc58a){_0x4f8977=_0x4f8977-0x0;var _0x2f44d1=_0xef05[_0x4f8977];return _0x2f44d1;};'use strict';var _=require('lodash');var util=require(_0x5ef0('0x0'));var logger=require(_0x5ef0('0x1'))('api');var moment=require(_0x5ef0('0x2'));var BPromise=require(_0x5ef0('0x3'));var rp=require(_0x5ef0('0x4'));var fs=require('fs');var path=require(_0x5ef0('0x5'));var rimraf=require(_0x5ef0('0x6'));var config=require(_0x5ef0('0x7'));var attributes=require(_0x5ef0('0x8'));var integrations=require(_0x5ef0('0x9'));module[_0x5ef0('0xa')]=function(_0x450f04,_0x36e755){return _0x450f04[_0x5ef0('0xb')](_0x5ef0('0xc'),attributes,{'tableName':_0x5ef0('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.rpc.js b/server/api/intZendeskAccount/intZendeskAccount.rpc.js index 1713a36..8de8f6c 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 _0x01a9=['../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','ZendeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','GetZendeskAccount','ShowZendeskAccount','find','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x53f707,_0x51a2f7){var _0x10a9f5=function(_0x14b513){while(--_0x14b513){_0x53f707['push'](_0x53f707['shift']());}};_0x10a9f5(++_0x51a2f7);}(_0x01a9,0xee));var _0x901a=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x01a9[_0x173441];return _0x2423a8;};'use strict';var _=require(_0x901a('0x0'));var util=require(_0x901a('0x1'));var moment=require(_0x901a('0x2'));var BPromise=require(_0x901a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x901a('0x4'));var db=require(_0x901a('0x5'))['db'];var utils=require(_0x901a('0x6'));var logger=require(_0x901a('0x7'))('rpc');var config=require(_0x901a('0x8'));var jayson=require(_0x901a('0x9'));var client=jayson[_0x901a('0xa')][_0x901a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4314ce,_0x348f49,_0x2f4c43){return new BPromise(function(_0x247162,_0x364f8e){return client[_0x901a('0xc')](_0x4314ce,_0x2f4c43)[_0x901a('0xd')](function(_0x338090){logger[_0x901a('0xe')](_0x901a('0xf'),_0x348f49,_0x901a('0x10'));logger[_0x901a('0x11')](_0x901a('0x12'),_0x348f49,_0x901a('0x10'),JSON[_0x901a('0x13')](_0x338090));if(_0x338090[_0x901a('0x14')]){if(_0x338090[_0x901a('0x14')]['code']===0x1f4){logger[_0x901a('0x14')](_0x901a('0xf'),_0x348f49,_0x338090['error'][_0x901a('0x15')]);return _0x364f8e(_0x338090[_0x901a('0x14')]['message']);}logger[_0x901a('0x14')]('ZendeskAccount,\x20%s,\x20%s',_0x348f49,_0x338090[_0x901a('0x14')][_0x901a('0x15')]);return _0x247162(_0x338090[_0x901a('0x14')][_0x901a('0x15')]);}else{logger[_0x901a('0xe')](_0x901a('0xf'),_0x348f49,_0x901a('0x10'));_0x247162(_0x338090['result'][_0x901a('0x15')]);}})['catch'](function(_0x350931){logger[_0x901a('0x14')](_0x901a('0xf'),_0x348f49,_0x350931);_0x364f8e(_0x350931);});});}exports['GetZendeskAccount']=function(_0xf579ff){var _0x3a9e7d=this;return new Promise(function(_0x260e4d,_0xac01a0){return db[_0x901a('0x16')][_0x901a('0x17')]({'raw':_0xf579ff[_0x901a('0x18')]?_0xf579ff[_0x901a('0x18')][_0x901a('0x19')]===undefined?!![]:![]:!![],'where':_0xf579ff['options']?_0xf579ff[_0x901a('0x18')][_0x901a('0x1a')]||null:null,'attributes':_0xf579ff[_0x901a('0x18')]?_0xf579ff[_0x901a('0x18')][_0x901a('0x1b')]||null:null,'limit':_0xf579ff[_0x901a('0x18')]?_0xf579ff[_0x901a('0x18')][_0x901a('0x1c')]||null:null,'include':_0xf579ff['options']?_0xf579ff[_0x901a('0x18')][_0x901a('0x1d')]?_[_0x901a('0x1e')](_0xf579ff[_0x901a('0x18')][_0x901a('0x1d')],function(_0x43821c){return{'model':db[_0x43821c[_0x901a('0x1f')]],'as':_0x43821c['as'],'attributes':_0x43821c[_0x901a('0x1b')],'include':_0x43821c[_0x901a('0x1d')]?_['map'](_0x43821c[_0x901a('0x1d')],function(_0x3e6d11){return{'model':db[_0x3e6d11[_0x901a('0x1f')]],'as':_0x3e6d11['as'],'attributes':_0x3e6d11[_0x901a('0x1b')],'include':_0x3e6d11[_0x901a('0x1d')]?_['map'](_0x3e6d11[_0x901a('0x1d')],function(_0xd733d){return{'model':db[_0xd733d[_0x901a('0x1f')]],'as':_0xd733d['as'],'attributes':_0xd733d[_0x901a('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x901a('0xd')](function(_0x57a3ef){logger['info'](_0x901a('0x20'),_0xf579ff);logger['debug'](_0x901a('0x20'),_0xf579ff,JSON['stringify'](_0x57a3ef));_0x260e4d(_0x57a3ef);})['catch'](function(_0x5b26cd){logger[_0x901a('0x14')](_0x901a('0x20'),_0x5b26cd['message'],_0xf579ff);_0xac01a0(_0x3a9e7d['error'](0x1f4,_0x5b26cd[_0x901a('0x15')]));});});};exports[_0x901a('0x21')]=function(_0x5b2310){var _0x353159=this;return new Promise(function(_0x5bfece,_0x953226){return db[_0x901a('0x16')][_0x901a('0x22')]({'raw':_0x5b2310['options']?_0x5b2310[_0x901a('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x5b2310[_0x901a('0x18')]?_0x5b2310[_0x901a('0x18')][_0x901a('0x1a')]||null:null,'attributes':_0x5b2310[_0x901a('0x18')]?_0x5b2310['options'][_0x901a('0x1b')]||null:null,'include':_0x5b2310['options']?_0x5b2310[_0x901a('0x18')][_0x901a('0x1d')]?_[_0x901a('0x1e')](_0x5b2310[_0x901a('0x18')]['include'],function(_0x1796f9){return{'model':db[_0x1796f9[_0x901a('0x1f')]],'as':_0x1796f9['as'],'attributes':_0x1796f9[_0x901a('0x1b')],'include':_0x1796f9[_0x901a('0x1d')]?_['map'](_0x1796f9[_0x901a('0x1d')],function(_0x567c55){return{'model':db[_0x567c55[_0x901a('0x1f')]],'as':_0x567c55['as'],'attributes':_0x567c55[_0x901a('0x1b')],'include':_0x567c55['include']?_['map'](_0x567c55[_0x901a('0x1d')],function(_0x563ad0){return{'model':db[_0x563ad0[_0x901a('0x1f')]],'as':_0x563ad0['as'],'attributes':_0x563ad0[_0x901a('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x901a('0xd')](function(_0x1c30ed){logger['info'](_0x901a('0x21'),_0x5b2310);logger['debug']('ShowZendeskAccount',_0x5b2310,JSON[_0x901a('0x13')](_0x1c30ed));_0x5bfece(_0x1c30ed);})['catch'](function(_0x28aeee){logger['error'](_0x901a('0x21'),_0x28aeee[_0x901a('0x15')],_0x5b2310);_0x953226(_0x353159[_0x901a('0x14')](0x1f4,_0x28aeee[_0x901a('0x15')]));});});}; \ No newline at end of file +var _0x27e9=['client','request','info','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ZendeskAccount,\x20%s,\x20%s','result','GetZendeskAccount','ZendeskAccount','findAll','options','raw','where','attributes','limit','include','model','map','then','catch','ShowZendeskAccount','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0xcfe8cc,_0xb83aeb){var _0x55ac53=function(_0x4067d4){while(--_0x4067d4){_0xcfe8cc['push'](_0xcfe8cc['shift']());}};_0x55ac53(++_0xb83aeb);}(_0x27e9,0x116));var _0x927e=function(_0x1aaf46,_0x422b70){_0x1aaf46=_0x1aaf46-0x0;var _0x433cf7=_0x27e9[_0x1aaf46];return _0x433cf7;};'use strict';var _=require(_0x927e('0x0'));var util=require(_0x927e('0x1'));var moment=require('moment');var BPromise=require(_0x927e('0x2'));var rs=require(_0x927e('0x3'));var fs=require('fs');var Redis=require(_0x927e('0x4'));var db=require(_0x927e('0x5'))['db'];var utils=require(_0x927e('0x6'));var logger=require(_0x927e('0x7'))('rpc');var config=require(_0x927e('0x8'));var jayson=require(_0x927e('0x9'));var client=jayson[_0x927e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x44aa7e,_0x1a71e3,_0xe48c9e){return new BPromise(function(_0x173c6a,_0x2738e8){return client[_0x927e('0xb')](_0x44aa7e,_0xe48c9e)['then'](function(_0x25633b){logger[_0x927e('0xc')]('ZendeskAccount,\x20%s,\x20%s',_0x1a71e3,_0x927e('0xd'));logger[_0x927e('0xe')](_0x927e('0xf'),_0x1a71e3,_0x927e('0xd'),JSON[_0x927e('0x10')](_0x25633b));if(_0x25633b[_0x927e('0x11')]){if(_0x25633b[_0x927e('0x11')][_0x927e('0x12')]===0x1f4){logger[_0x927e('0x11')]('ZendeskAccount,\x20%s,\x20%s',_0x1a71e3,_0x25633b[_0x927e('0x11')][_0x927e('0x13')]);return _0x2738e8(_0x25633b[_0x927e('0x11')][_0x927e('0x13')]);}logger['error'](_0x927e('0x14'),_0x1a71e3,_0x25633b['error'][_0x927e('0x13')]);return _0x173c6a(_0x25633b['error'][_0x927e('0x13')]);}else{logger['info'](_0x927e('0x14'),_0x1a71e3,_0x927e('0xd'));_0x173c6a(_0x25633b[_0x927e('0x15')][_0x927e('0x13')]);}})['catch'](function(_0x41733a){logger[_0x927e('0x11')]('ZendeskAccount,\x20%s,\x20%s',_0x1a71e3,_0x41733a);_0x2738e8(_0x41733a);});});}exports[_0x927e('0x16')]=function(_0x198711){var _0x236660=this;return new Promise(function(_0x323784,_0x89c929){return db[_0x927e('0x17')][_0x927e('0x18')]({'raw':_0x198711[_0x927e('0x19')]?_0x198711[_0x927e('0x19')][_0x927e('0x1a')]===undefined?!![]:![]:!![],'where':_0x198711[_0x927e('0x19')]?_0x198711['options'][_0x927e('0x1b')]||null:null,'attributes':_0x198711[_0x927e('0x19')]?_0x198711[_0x927e('0x19')][_0x927e('0x1c')]||null:null,'limit':_0x198711[_0x927e('0x19')]?_0x198711[_0x927e('0x19')][_0x927e('0x1d')]||null:null,'include':_0x198711['options']?_0x198711[_0x927e('0x19')][_0x927e('0x1e')]?_['map'](_0x198711['options'][_0x927e('0x1e')],function(_0x5aff88){return{'model':db[_0x5aff88[_0x927e('0x1f')]],'as':_0x5aff88['as'],'attributes':_0x5aff88['attributes'],'include':_0x5aff88[_0x927e('0x1e')]?_[_0x927e('0x20')](_0x5aff88[_0x927e('0x1e')],function(_0x26dd84){return{'model':db[_0x26dd84[_0x927e('0x1f')]],'as':_0x26dd84['as'],'attributes':_0x26dd84['attributes'],'include':_0x26dd84['include']?_[_0x927e('0x20')](_0x26dd84['include'],function(_0x36d1e2){return{'model':db[_0x36d1e2['model']],'as':_0x36d1e2['as'],'attributes':_0x36d1e2[_0x927e('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x927e('0x21')](function(_0x421d34){logger['info'](_0x927e('0x16'),_0x198711);logger[_0x927e('0xe')]('GetZendeskAccount',_0x198711,JSON[_0x927e('0x10')](_0x421d34));_0x323784(_0x421d34);})[_0x927e('0x22')](function(_0x59031f){logger[_0x927e('0x11')]('GetZendeskAccount',_0x59031f[_0x927e('0x13')],_0x198711);_0x89c929(_0x236660[_0x927e('0x11')](0x1f4,_0x59031f['message']));});});};exports['ShowZendeskAccount']=function(_0x4c1181){var _0x414785=this;return new Promise(function(_0x139d14,_0x37dc32){return db[_0x927e('0x17')]['find']({'raw':_0x4c1181[_0x927e('0x19')]?_0x4c1181[_0x927e('0x19')][_0x927e('0x1a')]===undefined?!![]:![]:!![],'where':_0x4c1181['options']?_0x4c1181[_0x927e('0x19')]['where']||null:null,'attributes':_0x4c1181[_0x927e('0x19')]?_0x4c1181['options'][_0x927e('0x1c')]||null:null,'include':_0x4c1181[_0x927e('0x19')]?_0x4c1181[_0x927e('0x19')][_0x927e('0x1e')]?_[_0x927e('0x20')](_0x4c1181[_0x927e('0x19')][_0x927e('0x1e')],function(_0x258fe8){return{'model':db[_0x258fe8[_0x927e('0x1f')]],'as':_0x258fe8['as'],'attributes':_0x258fe8[_0x927e('0x1c')],'include':_0x258fe8[_0x927e('0x1e')]?_['map'](_0x258fe8[_0x927e('0x1e')],function(_0x18b5fa){return{'model':db[_0x18b5fa[_0x927e('0x1f')]],'as':_0x18b5fa['as'],'attributes':_0x18b5fa[_0x927e('0x1c')],'include':_0x18b5fa['include']?_[_0x927e('0x20')](_0x18b5fa['include'],function(_0x404bbb){return{'model':db[_0x404bbb[_0x927e('0x1f')]],'as':_0x404bbb['as'],'attributes':_0x404bbb[_0x927e('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x927e('0x21')](function(_0x59eede){logger[_0x927e('0xc')]('ShowZendeskAccount',_0x4c1181);logger[_0x927e('0xe')](_0x927e('0x23'),_0x4c1181,JSON[_0x927e('0x10')](_0x59eede));_0x139d14(_0x59eede);})['catch'](function(_0xe3c046){logger[_0x927e('0x11')](_0x927e('0x23'),_0xe3c046[_0x927e('0x13')],_0x4c1181);_0x37dc32(_0x414785[_0x927e('0x11')](0x1f4,_0xe3c046[_0x927e('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 4198c3f..7d60070 100644 --- a/server/api/intZendeskConfiguration/index.js +++ b/server/api/intZendeskConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5eb8=['getTags','post','/:id/tags','setTags','put','update','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions'];(function(_0xb83bf0,_0x3593aa){var _0x2e7571=function(_0x411bc8){while(--_0x411bc8){_0xb83bf0['push'](_0xb83bf0['shift']());}};_0x2e7571(++_0x3593aa);}(_0x5eb8,0xb0));var _0x85eb=function(_0x257841,_0x389b4d){_0x257841=_0x257841-0x0;var _0x1b87ed=_0x5eb8[_0x257841];return _0x1b87ed;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x85eb('0x0'));var timeout=require(_0x85eb('0x1'));var express=require(_0x85eb('0x2'));var router=express[_0x85eb('0x3')]();var fs_extra=require(_0x85eb('0x4'));var auth=require(_0x85eb('0x5'));var interaction=require(_0x85eb('0x6'));var config=require(_0x85eb('0x7'));var controller=require(_0x85eb('0x8'));router[_0x85eb('0x9')]('/',auth[_0x85eb('0xa')](),controller[_0x85eb('0xb')]);router['get'](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller[_0x85eb('0xd')]);router['get'](_0x85eb('0xe'),auth['isAuthenticated'](),controller[_0x85eb('0xf')]);router[_0x85eb('0x9')](_0x85eb('0x10'),auth[_0x85eb('0xa')](),controller[_0x85eb('0x11')]);router[_0x85eb('0x9')](_0x85eb('0x12'),auth['isAuthenticated'](),controller[_0x85eb('0x13')]);router[_0x85eb('0x9')]('/:id/tags',auth[_0x85eb('0xa')](),controller[_0x85eb('0x14')]);router[_0x85eb('0x15')]('/',auth[_0x85eb('0xa')](),controller['create']);router['post'](_0x85eb('0x16'),auth['isAuthenticated'](),controller[_0x85eb('0x17')]);router[_0x85eb('0x18')](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller[_0x85eb('0x19')]);router['delete'](_0x85eb('0xc'),auth['isAuthenticated'](),controller[_0x85eb('0x1a')]);module[_0x85eb('0x1b')]=router; \ No newline at end of file +var _0xb7e7=['delete','destroy','exports','multer','path','express','fs-extra','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','index','get','/:id','show','/:id/fields','isAuthenticated','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','create','put','update'];(function(_0x2faddb,_0xc18b78){var _0x273c05=function(_0x1a3785){while(--_0x1a3785){_0x2faddb['push'](_0x2faddb['shift']());}};_0x273c05(++_0xc18b78);}(_0xb7e7,0x121));var _0x7b7e=function(_0x710815,_0x520da8){_0x710815=_0x710815-0x0;var _0x5b3b89=_0xb7e7[_0x710815];return _0x5b3b89;};'use strict';var multer=require(_0x7b7e('0x0'));var util=require('util');var path=require(_0x7b7e('0x1'));var timeout=require('connect-timeout');var express=require(_0x7b7e('0x2'));var router=express['Router']();var fs_extra=require(_0x7b7e('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var controller=require(_0x7b7e('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x7b7e('0x7')]);router[_0x7b7e('0x8')](_0x7b7e('0x9'),auth['isAuthenticated'](),controller[_0x7b7e('0xa')]);router[_0x7b7e('0x8')](_0x7b7e('0xb'),auth[_0x7b7e('0xc')](),controller[_0x7b7e('0xd')]);router[_0x7b7e('0x8')](_0x7b7e('0xe'),auth['isAuthenticated'](),controller[_0x7b7e('0xf')]);router[_0x7b7e('0x8')](_0x7b7e('0x10'),auth[_0x7b7e('0xc')](),controller[_0x7b7e('0x11')]);router[_0x7b7e('0x8')](_0x7b7e('0x12'),auth[_0x7b7e('0xc')](),controller[_0x7b7e('0x13')]);router['post']('/',auth[_0x7b7e('0xc')](),controller[_0x7b7e('0x14')]);router['post'](_0x7b7e('0x12'),auth['isAuthenticated'](),controller['setTags']);router[_0x7b7e('0x15')](_0x7b7e('0x9'),auth[_0x7b7e('0xc')](),controller[_0x7b7e('0x16')]);router[_0x7b7e('0x17')]('/:id',auth['isAuthenticated'](),controller[_0x7b7e('0x18')]);module[_0x7b7e('0x19')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 8ff79b8..6401e11 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 _0x867e=['STRING','sequelize','exports'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x867e,0x187));var _0xe867=function(_0xe69c97,_0x10cf75){_0xe69c97=_0xe69c97-0x0;var _0x1481b9=_0x867e[_0xe69c97];return _0x1481b9;};'use strict';var Sequelize=require(_0xe867('0x0'));module[_0xe867('0x1')]={'name':{'type':Sequelize[_0xe867('0x2')]},'description':{'type':Sequelize[_0xe867('0x2')]}}; \ No newline at end of file +var _0x42b5=['STRING'];(function(_0x57b366,_0x2ddbac){var _0x5a4d89=function(_0x746399){while(--_0x746399){_0x57b366['push'](_0x57b366['shift']());}};_0x5a4d89(++_0x2ddbac);}(_0x42b5,0x103));var _0x542b=function(_0x3d1c2a,_0x4643ce){_0x3d1c2a=_0x3d1c2a-0x0;var _0x494989=_0x42b5[_0x3d1c2a];return _0x494989;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x542b('0x0')]},'description':{'type':Sequelize[_0x542b('0x0')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 69804ed..fd5e2c0 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 _0xef1f=['key','name','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','then','includeAll','include','findAll','rows','show','params','keys','rawAttributes','length','options','find','create','body','catch','getFields','findOne','ZendeskField','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','error','stack','index','map','ZendeskConfiguration','fieldName','type'];(function(_0x414ef7,_0x1e5378){var _0x96d92a=function(_0x4a5d2c){while(--_0x4a5d2c){_0x414ef7['push'](_0x414ef7['shift']());}};_0x96d92a(++_0x1e5378);}(_0xef1f,0x191));var _0xfef1=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xef1f[_0x42cae2];return _0x5f256f;};'use strict';var emlformat=require(_0xfef1('0x0'));var rimraf=require(_0xfef1('0x1'));var zipdir=require(_0xfef1('0x2'));var jsonpatch=require(_0xfef1('0x3'));var rp=require(_0xfef1('0x4'));var moment=require(_0xfef1('0x5'));var BPromise=require(_0xfef1('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xfef1('0x7'));var sox=require(_0xfef1('0x8'));var csv=require('to-csv');var ejs=require(_0xfef1('0x9'));var fs=require('fs');var fs_extra=require(_0xfef1('0xa'));var _=require('lodash');var squel=require(_0xfef1('0xb'));var crypto=require(_0xfef1('0xc'));var jsforce=require(_0xfef1('0xd'));var deskjs=require(_0xfef1('0xe'));var toCsv=require(_0xfef1('0xf'));var querystring=require(_0xfef1('0x10'));var Papa=require(_0xfef1('0x11'));var Redis=require(_0xfef1('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xfef1('0x13'));var as=require(_0xfef1('0x14'));var hardwareService=require(_0xfef1('0x15'));var logger=require(_0xfef1('0x16'))(_0xfef1('0x17'));var utils=require('../../config/utils');var config=require(_0xfef1('0x18'));var licenseUtil=require(_0xfef1('0x19'));var db=require(_0xfef1('0x1a'))['db'];function respondWithStatusCode(_0x1283f8,_0x521caf){_0x521caf=_0x521caf||0xcc;return function(_0x199abc){if(_0x199abc){return _0x1283f8[_0xfef1('0x1b')](_0x521caf);}return _0x1283f8[_0xfef1('0x1c')](_0x521caf)[_0xfef1('0x1d')]();};}function respondWithResult(_0x2c100b,_0xef3023){_0xef3023=_0xef3023||0xc8;return function(_0x54d964){if(_0x54d964){return _0x2c100b[_0xfef1('0x1c')](_0xef3023)['json'](_0x54d964);}};}function respondWithFilteredResult(_0x408f1e,_0x38b83b){return function(_0x4e22af){if(_0x4e22af){var _0x5d4853=typeof _0x38b83b[_0xfef1('0x1e')]===_0xfef1('0x1f')&&typeof _0x38b83b[_0xfef1('0x20')]===_0xfef1('0x1f');var _0x37ba6c=_0x4e22af['count'];var _0xa46564=_0x5d4853?0x0:_0x38b83b[_0xfef1('0x1e')];var _0x134db7=_0x5d4853?_0x4e22af[_0xfef1('0x21')]:_0x38b83b[_0xfef1('0x1e')]+_0x38b83b[_0xfef1('0x20')];var _0x3bf398;if(_0x134db7>=_0x37ba6c){_0x134db7=_0x37ba6c;_0x3bf398=0xc8;}else{_0x3bf398=0xce;}_0x408f1e['status'](_0x3bf398);return _0x408f1e[_0xfef1('0x22')](_0xfef1('0x23'),_0xa46564+'-'+_0x134db7+'/'+_0x37ba6c)[_0xfef1('0x24')](_0x4e22af);}return null;};}function patchUpdates(_0x46fc50){return function(_0x40cc0d){try{jsonpatch[_0xfef1('0x25')](_0x40cc0d,_0x46fc50,!![]);}catch(_0x300f99){return BPromise[_0xfef1('0x26')](_0x300f99);}return _0x40cc0d[_0xfef1('0x27')]();};}function saveUpdates(_0x4c2c29,_0x5ec238){return function(_0x3318eb){if(_0x3318eb){return _0x3318eb[_0xfef1('0x28')](_0x4c2c29)['then'](function(_0x5cb0f5){return _0x5cb0f5;});}return null;};}function removeEntity(_0xe90212,_0x858e5){return function(_0x1eaac6){if(_0x1eaac6){return _0x1eaac6[_0xfef1('0x29')]()['then'](function(){_0xe90212['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x36c904,_0x22f6c9){return function(_0x3363c3){if(!_0x3363c3){_0x36c904[_0xfef1('0x1b')](0x194);}return _0x3363c3;};}function handleError(_0x417c99,_0x403140){_0x403140=_0x403140||0x1f4;return function(_0x407fa4){logger[_0xfef1('0x2a')](_0x407fa4[_0xfef1('0x2b')]);if(_0x407fa4['name']){delete _0x407fa4['name'];}_0x417c99['status'](_0x403140)['send'](_0x407fa4);};}exports[_0xfef1('0x2c')]=function(_0x2b9311,_0x56520a){var _0x3d958d={},_0x1ec7af={},_0x604eb0={'count':0x0,'rows':[]};var _0x1fc933=_[_0xfef1('0x2d')](db[_0xfef1('0x2e')]['rawAttributes'],function(_0x2bfb23){return{'name':_0x2bfb23[_0xfef1('0x2f')],'type':_0x2bfb23[_0xfef1('0x30')][_0xfef1('0x31')]};});_0x1ec7af['model']=_[_0xfef1('0x2d')](_0x1fc933,_0xfef1('0x32'));_0x1ec7af[_0xfef1('0x33')]=_['keys'](_0x2b9311[_0xfef1('0x33')]);_0x1ec7af[_0xfef1('0x34')]=_[_0xfef1('0x35')](_0x1ec7af[_0xfef1('0x36')],_0x1ec7af[_0xfef1('0x33')]);_0x3d958d[_0xfef1('0x37')]=_[_0xfef1('0x35')](_0x1ec7af[_0xfef1('0x36')],qs[_0xfef1('0x38')](_0x2b9311[_0xfef1('0x33')]['fields']));_0x3d958d[_0xfef1('0x37')]=_0x3d958d[_0xfef1('0x37')]['length']?_0x3d958d['attributes']:_0x1ec7af[_0xfef1('0x36')];if(!_0x2b9311[_0xfef1('0x33')][_0xfef1('0x39')](_0xfef1('0x3a'))){_0x3d958d[_0xfef1('0x20')]=qs['limit'](_0x2b9311[_0xfef1('0x33')][_0xfef1('0x20')]);_0x3d958d[_0xfef1('0x1e')]=qs[_0xfef1('0x1e')](_0x2b9311[_0xfef1('0x33')][_0xfef1('0x1e')]);}_0x3d958d[_0xfef1('0x3b')]=qs[_0xfef1('0x3c')](_0x2b9311[_0xfef1('0x33')]['sort']);_0x3d958d[_0xfef1('0x3d')]=qs[_0xfef1('0x34')](_[_0xfef1('0x3e')](_0x2b9311['query'],_0x1ec7af[_0xfef1('0x34')]),_0x1fc933);if(_0x2b9311[_0xfef1('0x33')][_0xfef1('0x3f')]){_0x3d958d[_0xfef1('0x3d')]=_['merge'](_0x3d958d[_0xfef1('0x3d')],{'$or':_[_0xfef1('0x2d')](_0x1fc933,function(_0x5608e3){if(_0x5608e3[_0xfef1('0x30')]!==_0xfef1('0x40')){var _0x283122={};_0x283122[_0x5608e3[_0xfef1('0x32')]]={'$like':'%'+_0x2b9311['query'][_0xfef1('0x3f')]+'%'};return _0x283122;}})});}_0x3d958d=_[_0xfef1('0x41')]({},_0x3d958d,_0x2b9311['options']);var _0x3e5765={'where':_0x3d958d[_0xfef1('0x3d')]};return db['ZendeskConfiguration'][_0xfef1('0x21')](_0x3e5765)[_0xfef1('0x42')](function(_0x2234a0){_0x604eb0['count']=_0x2234a0;if(_0x2b9311[_0xfef1('0x33')][_0xfef1('0x43')]){_0x3d958d[_0xfef1('0x44')]=[{'all':!![]}];}return db[_0xfef1('0x2e')][_0xfef1('0x45')](_0x3d958d);})['then'](function(_0x1901c8){_0x604eb0[_0xfef1('0x46')]=_0x1901c8;return _0x604eb0;})['then'](respondWithFilteredResult(_0x56520a,_0x3d958d))['catch'](handleError(_0x56520a,null));};exports[_0xfef1('0x47')]=function(_0x190f53,_0x44f16d){var _0x2a69b2={'raw':![],'where':{'id':_0x190f53[_0xfef1('0x48')]['id']}},_0x3b8064={};_0x3b8064['model']=_[_0xfef1('0x49')](db[_0xfef1('0x2e')][_0xfef1('0x4a')]);_0x3b8064[_0xfef1('0x33')]=_[_0xfef1('0x49')](_0x190f53['query']);_0x3b8064[_0xfef1('0x34')]=_[_0xfef1('0x35')](_0x3b8064['model'],_0x3b8064[_0xfef1('0x33')]);_0x2a69b2['attributes']=_['intersection'](_0x3b8064[_0xfef1('0x36')],qs[_0xfef1('0x38')](_0x190f53[_0xfef1('0x33')][_0xfef1('0x38')]));_0x2a69b2[_0xfef1('0x37')]=_0x2a69b2[_0xfef1('0x37')][_0xfef1('0x4b')]?_0x2a69b2[_0xfef1('0x37')]:_0x3b8064[_0xfef1('0x36')];if(_0x190f53['query'][_0xfef1('0x43')]){_0x2a69b2[_0xfef1('0x44')]=[{'all':!![]}];}_0x2a69b2=_[_0xfef1('0x41')]({},_0x2a69b2,_0x190f53[_0xfef1('0x4c')]);return db['ZendeskConfiguration'][_0xfef1('0x4d')](_0x2a69b2)[_0xfef1('0x42')](handleEntityNotFound(_0x44f16d,null))['then'](respondWithResult(_0x44f16d,null))['catch'](handleError(_0x44f16d,null));};exports[_0xfef1('0x4e')]=function(_0xfb20d6,_0x1f6164){return db['ZendeskConfiguration']['create'](_0xfb20d6[_0xfef1('0x4f')],{})[_0xfef1('0x42')](respondWithResult(_0x1f6164,0xc9))[_0xfef1('0x50')](handleError(_0x1f6164,null));};exports[_0xfef1('0x28')]=function(_0x3c6bcc,_0x340056){if(_0x3c6bcc['body']['id']){delete _0x3c6bcc[_0xfef1('0x4f')]['id'];}return db[_0xfef1('0x2e')]['find']({'where':{'id':_0x3c6bcc[_0xfef1('0x48')]['id']}})[_0xfef1('0x42')](handleEntityNotFound(_0x340056,null))['then'](saveUpdates(_0x3c6bcc[_0xfef1('0x4f')],null))[_0xfef1('0x42')](respondWithResult(_0x340056,null))[_0xfef1('0x50')](handleError(_0x340056,null));};exports[_0xfef1('0x29')]=function(_0x59f42c,_0x2fe0af){return db[_0xfef1('0x2e')][_0xfef1('0x4d')]({'where':{'id':_0x59f42c[_0xfef1('0x48')]['id']}})[_0xfef1('0x42')](handleEntityNotFound(_0x2fe0af,null))[_0xfef1('0x42')](removeEntity(_0x2fe0af,null))[_0xfef1('0x50')](handleError(_0x2fe0af,null));};exports[_0xfef1('0x51')]=function(_0x2ea149,_0x423b86,_0x5bbc31){var _0x18f360={};var _0xe5910a={};var _0x20c188;var _0x625e69;return db[_0xfef1('0x2e')]['findOne']({'where':{'id':_0x2ea149[_0xfef1('0x48')]['id']}})[_0xfef1('0x42')](handleEntityNotFound(_0x423b86,null))[_0xfef1('0x42')](function(_0x4622a9){if(_0x4622a9){_0x20c188=_0x4622a9;_0xe5910a[_0xfef1('0x36')]=_[_0xfef1('0x49')](db['ZendeskField']['rawAttributes']);_0xe5910a[_0xfef1('0x33')]=_['keys'](_0x2ea149[_0xfef1('0x33')]);_0xe5910a[_0xfef1('0x34')]=_['intersection'](_0xe5910a[_0xfef1('0x36')],_0xe5910a[_0xfef1('0x33')]);_0x18f360['attributes']=_[_0xfef1('0x35')](_0xe5910a[_0xfef1('0x36')],qs['fields'](_0x2ea149[_0xfef1('0x33')][_0xfef1('0x38')]));_0x18f360[_0xfef1('0x37')]=_0x18f360[_0xfef1('0x37')]['length']?_0x18f360[_0xfef1('0x37')]:_0xe5910a[_0xfef1('0x36')];_0x18f360['order']=qs['sort'](_0x2ea149[_0xfef1('0x33')][_0xfef1('0x3c')]);_0x18f360['where']=qs[_0xfef1('0x34')](_['pick'](_0x2ea149['query'],_0xe5910a['filters']));if(_0x2ea149['query'][_0xfef1('0x3f')]){_0x18f360[_0xfef1('0x3d')]=_['merge'](_0x18f360[_0xfef1('0x3d')],{'$or':_[_0xfef1('0x2d')](_0x18f360['attributes'],function(_0x23d46f){var _0x428a5={};_0x428a5[_0x23d46f]={'$like':'%'+_0x2ea149['query'][_0xfef1('0x3f')]+'%'};return _0x428a5;})});}_0x18f360=_['merge']({},_0x18f360,_0x2ea149[_0xfef1('0x4c')]);return _0x20c188[_0xfef1('0x51')](_0x18f360);}})[_0xfef1('0x42')](function(_0x26210b){if(_0x26210b){_0x625e69=_0x26210b[_0xfef1('0x4b')];if(!_0x2ea149[_0xfef1('0x33')][_0xfef1('0x39')](_0xfef1('0x3a'))){_0x18f360[_0xfef1('0x20')]=qs[_0xfef1('0x20')](_0x2ea149[_0xfef1('0x33')]['limit']);_0x18f360[_0xfef1('0x1e')]=qs['offset'](_0x2ea149['query']['offset']);}return _0x20c188[_0xfef1('0x51')](_0x18f360);}})['then'](function(_0x223359){if(_0x223359){return _0x223359?{'count':_0x625e69,'rows':_0x223359}:null;}})[_0xfef1('0x42')](respondWithResult(_0x423b86,null))[_0xfef1('0x50')](handleError(_0x423b86,null));};exports['getSubjects']=function(_0x1b0cde,_0xd8ec4e,_0x98c001){var _0x148c6b={};var _0x27d35b={};var _0x41a0d7;var _0x3d161f;return db[_0xfef1('0x2e')][_0xfef1('0x52')]({'where':{'id':_0x1b0cde[_0xfef1('0x48')]['id']}})[_0xfef1('0x42')](handleEntityNotFound(_0xd8ec4e,null))['then'](function(_0x58621b){if(_0x58621b){_0x41a0d7=_0x58621b;_0x27d35b[_0xfef1('0x36')]=_[_0xfef1('0x49')](db[_0xfef1('0x53')][_0xfef1('0x4a')]);_0x27d35b[_0xfef1('0x33')]=_[_0xfef1('0x49')](_0x1b0cde['query']);_0x27d35b[_0xfef1('0x34')]=_[_0xfef1('0x35')](_0x27d35b['model'],_0x27d35b[_0xfef1('0x33')]);_0x148c6b[_0xfef1('0x37')]=_[_0xfef1('0x35')](_0x27d35b[_0xfef1('0x36')],qs['fields'](_0x1b0cde[_0xfef1('0x33')][_0xfef1('0x38')]));_0x148c6b[_0xfef1('0x37')]=_0x148c6b[_0xfef1('0x37')][_0xfef1('0x4b')]?_0x148c6b[_0xfef1('0x37')]:_0x27d35b[_0xfef1('0x36')];_0x148c6b[_0xfef1('0x3b')]=qs[_0xfef1('0x3c')](_0x1b0cde[_0xfef1('0x33')][_0xfef1('0x3c')]);_0x148c6b[_0xfef1('0x3d')]=qs[_0xfef1('0x34')](_[_0xfef1('0x3e')](_0x1b0cde['query'],_0x27d35b['filters']));if(_0x1b0cde[_0xfef1('0x33')][_0xfef1('0x3f')]){_0x148c6b[_0xfef1('0x3d')]=_[_0xfef1('0x41')](_0x148c6b['where'],{'$or':_[_0xfef1('0x2d')](_0x148c6b[_0xfef1('0x37')],function(_0x22ca3f){var _0x295c9c={};_0x295c9c[_0x22ca3f]={'$like':'%'+_0x1b0cde[_0xfef1('0x33')][_0xfef1('0x3f')]+'%'};return _0x295c9c;})});}_0x148c6b=_['merge']({},_0x148c6b,_0x1b0cde[_0xfef1('0x4c')]);return _0x41a0d7[_0xfef1('0x54')](_0x148c6b);}})['then'](function(_0x3772c8){if(_0x3772c8){_0x3d161f=_0x3772c8['length'];if(!_0x1b0cde['query'][_0xfef1('0x39')](_0xfef1('0x3a'))){_0x148c6b[_0xfef1('0x20')]=qs['limit'](_0x1b0cde['query'][_0xfef1('0x20')]);_0x148c6b['offset']=qs['offset'](_0x1b0cde[_0xfef1('0x33')][_0xfef1('0x1e')]);}return _0x41a0d7[_0xfef1('0x54')](_0x148c6b);}})[_0xfef1('0x42')](function(_0x1aa8b0){if(_0x1aa8b0){return _0x1aa8b0?{'count':_0x3d161f,'rows':_0x1aa8b0}:null;}})[_0xfef1('0x42')](respondWithResult(_0xd8ec4e,null))[_0xfef1('0x50')](handleError(_0xd8ec4e,null));};exports[_0xfef1('0x55')]=function(_0x4a7b66,_0x5937b6,_0x35f422){var _0x42e519={};var _0x53f895={};var _0x384c61;var _0x4f2186;return db['ZendeskConfiguration'][_0xfef1('0x52')]({'where':{'id':_0x4a7b66['params']['id']}})[_0xfef1('0x42')](handleEntityNotFound(_0x5937b6,null))[_0xfef1('0x42')](function(_0x260015){if(_0x260015){_0x384c61=_0x260015;_0x53f895[_0xfef1('0x36')]=_[_0xfef1('0x49')](db['ZendeskField'][_0xfef1('0x4a')]);_0x53f895['query']=_[_0xfef1('0x49')](_0x4a7b66['query']);_0x53f895[_0xfef1('0x34')]=_[_0xfef1('0x35')](_0x53f895[_0xfef1('0x36')],_0x53f895[_0xfef1('0x33')]);_0x42e519['attributes']=_[_0xfef1('0x35')](_0x53f895[_0xfef1('0x36')],qs[_0xfef1('0x38')](_0x4a7b66['query'][_0xfef1('0x38')]));_0x42e519[_0xfef1('0x37')]=_0x42e519['attributes'][_0xfef1('0x4b')]?_0x42e519[_0xfef1('0x37')]:_0x53f895['model'];_0x42e519[_0xfef1('0x3b')]=qs[_0xfef1('0x3c')](_0x4a7b66[_0xfef1('0x33')]['sort']);_0x42e519[_0xfef1('0x3d')]=qs[_0xfef1('0x34')](_[_0xfef1('0x3e')](_0x4a7b66['query'],_0x53f895[_0xfef1('0x34')]));if(_0x4a7b66['query']['filter']){_0x42e519[_0xfef1('0x3d')]=_[_0xfef1('0x41')](_0x42e519[_0xfef1('0x3d')],{'$or':_[_0xfef1('0x2d')](_0x42e519[_0xfef1('0x37')],function(_0x1c533c){var _0x54d557={};_0x54d557[_0x1c533c]={'$like':'%'+_0x4a7b66[_0xfef1('0x33')][_0xfef1('0x3f')]+'%'};return _0x54d557;})});}_0x42e519=_[_0xfef1('0x41')]({},_0x42e519,_0x4a7b66[_0xfef1('0x4c')]);return _0x384c61[_0xfef1('0x55')](_0x42e519);}})[_0xfef1('0x42')](function(_0x133282){if(_0x133282){_0x4f2186=_0x133282[_0xfef1('0x4b')];if(!_0x4a7b66[_0xfef1('0x33')]['hasOwnProperty']('nolimit')){_0x42e519[_0xfef1('0x20')]=qs[_0xfef1('0x20')](_0x4a7b66[_0xfef1('0x33')][_0xfef1('0x20')]);_0x42e519['offset']=qs[_0xfef1('0x1e')](_0x4a7b66['query'][_0xfef1('0x1e')]);}return _0x384c61['getDescriptions'](_0x42e519);}})[_0xfef1('0x42')](function(_0x52626b){if(_0x52626b){return _0x52626b?{'count':_0x4f2186,'rows':_0x52626b}:null;}})['then'](respondWithResult(_0x5937b6,null))[_0xfef1('0x50')](handleError(_0x5937b6,null));};exports[_0xfef1('0x56')]=function(_0x3df9a9,_0x3ccaf0,_0x40d573){var _0x59cddd={};var _0x4ac6ce={};var _0x11fbd8;var _0x58f2d7;return db['ZendeskConfiguration'][_0xfef1('0x52')]({'where':{'id':_0x3df9a9[_0xfef1('0x48')]['id']}})['then'](handleEntityNotFound(_0x3ccaf0,null))[_0xfef1('0x42')](function(_0xfa7f3e){if(_0xfa7f3e){_0x11fbd8=_0xfa7f3e;_0x4ac6ce[_0xfef1('0x36')]=_['keys'](db[_0xfef1('0x57')][_0xfef1('0x4a')]);_0x4ac6ce[_0xfef1('0x33')]=_[_0xfef1('0x49')](_0x3df9a9[_0xfef1('0x33')]);_0x4ac6ce[_0xfef1('0x34')]=_[_0xfef1('0x35')](_0x4ac6ce[_0xfef1('0x36')],_0x4ac6ce[_0xfef1('0x33')]);_0x59cddd[_0xfef1('0x37')]=_[_0xfef1('0x35')](_0x4ac6ce[_0xfef1('0x36')],qs[_0xfef1('0x38')](_0x3df9a9[_0xfef1('0x33')][_0xfef1('0x38')]));_0x59cddd[_0xfef1('0x37')]=_0x59cddd[_0xfef1('0x37')][_0xfef1('0x4b')]?_0x59cddd[_0xfef1('0x37')]:_0x4ac6ce[_0xfef1('0x36')];_0x59cddd[_0xfef1('0x3b')]=qs[_0xfef1('0x3c')](_0x3df9a9[_0xfef1('0x33')][_0xfef1('0x3c')]);_0x59cddd['where']=qs[_0xfef1('0x34')](_[_0xfef1('0x3e')](_0x3df9a9[_0xfef1('0x33')],_0x4ac6ce[_0xfef1('0x34')]));if(_0x3df9a9[_0xfef1('0x33')][_0xfef1('0x3f')]){_0x59cddd['where']=_['merge'](_0x59cddd[_0xfef1('0x3d')],{'$or':_[_0xfef1('0x2d')](_0x59cddd[_0xfef1('0x37')],function(_0x1f2005){var _0x91e248={};_0x91e248[_0x1f2005]={'$like':'%'+_0x3df9a9[_0xfef1('0x33')][_0xfef1('0x3f')]+'%'};return _0x91e248;})});}_0x59cddd=_['merge']({},_0x59cddd,_0x3df9a9[_0xfef1('0x4c')]);return _0x11fbd8[_0xfef1('0x56')](_0x59cddd);}})[_0xfef1('0x42')](function(_0x54bb6a){if(_0x54bb6a){_0x58f2d7=_0x54bb6a['length'];if(!_0x3df9a9[_0xfef1('0x33')]['hasOwnProperty'](_0xfef1('0x3a'))){_0x59cddd[_0xfef1('0x20')]=qs['limit'](_0x3df9a9['query']['limit']);_0x59cddd['offset']=qs['offset'](_0x3df9a9[_0xfef1('0x33')][_0xfef1('0x1e')]);}return _0x11fbd8['getTags'](_0x59cddd);}})[_0xfef1('0x42')](function(_0x4e336b){if(_0x4e336b){return _0x4e336b?{'count':_0x58f2d7,'rows':_0x4e336b}:null;}})[_0xfef1('0x42')](respondWithResult(_0x3ccaf0,null))[_0xfef1('0x50')](handleError(_0x3ccaf0,null));};exports[_0xfef1('0x58')]=function(_0x438a0e,_0x2c589f,_0x25cb32){if(_0x438a0e[_0xfef1('0x4f')]['id']){delete _0x438a0e[_0xfef1('0x4f')]['id'];}return db['ZendeskConfiguration'][_0xfef1('0x52')]({'where':{'id':_0x438a0e[_0xfef1('0x48')]['id']}})[_0xfef1('0x42')](handleEntityNotFound(_0x2c589f,null))[_0xfef1('0x42')](function(_0x337eec){if(_0x337eec){return _0x337eec[_0xfef1('0x58')](_0x438a0e['body'][_0xfef1('0x59')]||[]);}return null;})[_0xfef1('0x42')](respondWithResult(_0x2c589f,null))[_0xfef1('0x50')](handleError(_0x2c589f,null));}; \ No newline at end of file +var _0x0920=['offset','limit','undefined','count','set','Content-Range','apply','save','then','destroy','error','stack','name','send','index','map','ZendeskConfiguration','rawAttributes','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','merge','type','VIRTUAL','filter','options','include','findAll','rows','show','params','includeAll','find','create','body','update','catch','getFields','findOne','pick','nolimit','getSubjects','ZendeskField','getDescriptions','getTags','Tag','setTags','ids','eml-format','request-promise','moment','bluebird','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end'];(function(_0xffa198,_0x5a8940){var _0x1e4b50=function(_0x1f1c43){while(--_0x1f1c43){_0xffa198['push'](_0xffa198['shift']());}};_0x1e4b50(++_0x5a8940);}(_0x0920,0x133));var _0x0092=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0x0920[_0x2b7764];return _0x848dcb;};'use strict';var emlformat=require(_0x0092('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0092('0x1'));var moment=require(_0x0092('0x2'));var BPromise=require(_0x0092('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x0092('0x4'));var sox=require(_0x0092('0x5'));var csv=require(_0x0092('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0092('0x7'));var _=require('lodash');var squel=require(_0x0092('0x8'));var crypto=require(_0x0092('0x9'));var jsforce=require(_0x0092('0xa'));var deskjs=require(_0x0092('0xb'));var toCsv=require(_0x0092('0x6'));var querystring=require(_0x0092('0xc'));var Papa=require('papaparse');var Redis=require(_0x0092('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x0092('0xe'));var as=require(_0x0092('0xf'));var hardwareService=require(_0x0092('0x10'));var logger=require(_0x0092('0x11'))(_0x0092('0x12'));var utils=require(_0x0092('0x13'));var config=require(_0x0092('0x14'));var licenseUtil=require(_0x0092('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x305a16,_0x3d80b1){_0x3d80b1=_0x3d80b1||0xcc;return function(_0x542488){if(_0x542488){return _0x305a16[_0x0092('0x16')](_0x3d80b1);}return _0x305a16[_0x0092('0x17')](_0x3d80b1)[_0x0092('0x18')]();};}function respondWithResult(_0x31699b,_0x5b65b1){_0x5b65b1=_0x5b65b1||0xc8;return function(_0x321783){if(_0x321783){return _0x31699b['status'](_0x5b65b1)['json'](_0x321783);}};}function respondWithFilteredResult(_0x3c01f1,_0x4879a9){return function(_0x33a5a2){if(_0x33a5a2){var _0x10f41b=typeof _0x4879a9[_0x0092('0x19')]==='undefined'&&typeof _0x4879a9[_0x0092('0x1a')]===_0x0092('0x1b');var _0x36a204=_0x33a5a2[_0x0092('0x1c')];var _0x275ebe=_0x10f41b?0x0:_0x4879a9['offset'];var _0x4c88df=_0x10f41b?_0x33a5a2[_0x0092('0x1c')]:_0x4879a9[_0x0092('0x19')]+_0x4879a9[_0x0092('0x1a')];var _0x39b0a5;if(_0x4c88df>=_0x36a204){_0x4c88df=_0x36a204;_0x39b0a5=0xc8;}else{_0x39b0a5=0xce;}_0x3c01f1['status'](_0x39b0a5);return _0x3c01f1[_0x0092('0x1d')](_0x0092('0x1e'),_0x275ebe+'-'+_0x4c88df+'/'+_0x36a204)['json'](_0x33a5a2);}return null;};}function patchUpdates(_0xb0e25a){return function(_0x3c1f01){try{jsonpatch[_0x0092('0x1f')](_0x3c1f01,_0xb0e25a,!![]);}catch(_0x31fcbc){return BPromise['reject'](_0x31fcbc);}return _0x3c1f01[_0x0092('0x20')]();};}function saveUpdates(_0x3a0814,_0x3eb0fc){return function(_0x523dc6){if(_0x523dc6){return _0x523dc6['update'](_0x3a0814)[_0x0092('0x21')](function(_0x59e849){return _0x59e849;});}return null;};}function removeEntity(_0x23d95c,_0x307fe3){return function(_0x48286e){if(_0x48286e){return _0x48286e[_0x0092('0x22')]()[_0x0092('0x21')](function(){_0x23d95c[_0x0092('0x17')](0xcc)[_0x0092('0x18')]();});}};}function handleEntityNotFound(_0x139ce5,_0x4360fd){return function(_0x3085c7){if(!_0x3085c7){_0x139ce5[_0x0092('0x16')](0x194);}return _0x3085c7;};}function handleError(_0x5323db,_0x51760a){_0x51760a=_0x51760a||0x1f4;return function(_0x100d4a){logger[_0x0092('0x23')](_0x100d4a[_0x0092('0x24')]);if(_0x100d4a[_0x0092('0x25')]){delete _0x100d4a[_0x0092('0x25')];}_0x5323db[_0x0092('0x17')](_0x51760a)[_0x0092('0x26')](_0x100d4a);};}exports[_0x0092('0x27')]=function(_0x492773,_0x523dde){var _0x5e2e2b={},_0x11a0ca={},_0x10b396={'count':0x0,'rows':[]};var _0x5a3eaf=_[_0x0092('0x28')](db[_0x0092('0x29')][_0x0092('0x2a')],function(_0x177aa3){return{'name':_0x177aa3['fieldName'],'type':_0x177aa3['type'][_0x0092('0x2b')]};});_0x11a0ca[_0x0092('0x2c')]=_[_0x0092('0x28')](_0x5a3eaf,'name');_0x11a0ca['query']=_[_0x0092('0x2d')](_0x492773[_0x0092('0x2e')]);_0x11a0ca[_0x0092('0x2f')]=_['intersection'](_0x11a0ca['model'],_0x11a0ca[_0x0092('0x2e')]);_0x5e2e2b[_0x0092('0x30')]=_[_0x0092('0x31')](_0x11a0ca[_0x0092('0x2c')],qs[_0x0092('0x32')](_0x492773['query'][_0x0092('0x32')]));_0x5e2e2b[_0x0092('0x30')]=_0x5e2e2b[_0x0092('0x30')][_0x0092('0x33')]?_0x5e2e2b['attributes']:_0x11a0ca[_0x0092('0x2c')];if(!_0x492773['query'][_0x0092('0x34')]('nolimit')){_0x5e2e2b['limit']=qs[_0x0092('0x1a')](_0x492773['query'][_0x0092('0x1a')]);_0x5e2e2b[_0x0092('0x19')]=qs[_0x0092('0x19')](_0x492773['query']['offset']);}_0x5e2e2b[_0x0092('0x35')]=qs[_0x0092('0x36')](_0x492773[_0x0092('0x2e')][_0x0092('0x36')]);_0x5e2e2b[_0x0092('0x37')]=qs[_0x0092('0x2f')](_['pick'](_0x492773[_0x0092('0x2e')],_0x11a0ca[_0x0092('0x2f')]),_0x5a3eaf);if(_0x492773[_0x0092('0x2e')]['filter']){_0x5e2e2b['where']=_[_0x0092('0x38')](_0x5e2e2b['where'],{'$or':_[_0x0092('0x28')](_0x5a3eaf,function(_0x3b65ba){if(_0x3b65ba[_0x0092('0x39')]!==_0x0092('0x3a')){var _0x143154={};_0x143154[_0x3b65ba[_0x0092('0x25')]]={'$like':'%'+_0x492773[_0x0092('0x2e')][_0x0092('0x3b')]+'%'};return _0x143154;}})});}_0x5e2e2b=_['merge']({},_0x5e2e2b,_0x492773[_0x0092('0x3c')]);var _0x53ffe4={'where':_0x5e2e2b['where']};return db[_0x0092('0x29')][_0x0092('0x1c')](_0x53ffe4)[_0x0092('0x21')](function(_0x30b4f2){_0x10b396['count']=_0x30b4f2;if(_0x492773[_0x0092('0x2e')]['includeAll']){_0x5e2e2b[_0x0092('0x3d')]=[{'all':!![]}];}return db[_0x0092('0x29')][_0x0092('0x3e')](_0x5e2e2b);})[_0x0092('0x21')](function(_0x3c7995){_0x10b396[_0x0092('0x3f')]=_0x3c7995;return _0x10b396;})['then'](respondWithFilteredResult(_0x523dde,_0x5e2e2b))['catch'](handleError(_0x523dde,null));};exports[_0x0092('0x40')]=function(_0xee515f,_0x3aac91){var _0x154b57={'raw':![],'where':{'id':_0xee515f[_0x0092('0x41')]['id']}},_0x5bd010={};_0x5bd010[_0x0092('0x2c')]=_['keys'](db[_0x0092('0x29')][_0x0092('0x2a')]);_0x5bd010[_0x0092('0x2e')]=_[_0x0092('0x2d')](_0xee515f[_0x0092('0x2e')]);_0x5bd010[_0x0092('0x2f')]=_[_0x0092('0x31')](_0x5bd010[_0x0092('0x2c')],_0x5bd010[_0x0092('0x2e')]);_0x154b57[_0x0092('0x30')]=_[_0x0092('0x31')](_0x5bd010[_0x0092('0x2c')],qs[_0x0092('0x32')](_0xee515f[_0x0092('0x2e')][_0x0092('0x32')]));_0x154b57['attributes']=_0x154b57[_0x0092('0x30')]['length']?_0x154b57[_0x0092('0x30')]:_0x5bd010[_0x0092('0x2c')];if(_0xee515f['query'][_0x0092('0x42')]){_0x154b57['include']=[{'all':!![]}];}_0x154b57=_[_0x0092('0x38')]({},_0x154b57,_0xee515f['options']);return db[_0x0092('0x29')][_0x0092('0x43')](_0x154b57)[_0x0092('0x21')](handleEntityNotFound(_0x3aac91,null))[_0x0092('0x21')](respondWithResult(_0x3aac91,null))['catch'](handleError(_0x3aac91,null));};exports[_0x0092('0x44')]=function(_0x538a98,_0x5849c5){return db['ZendeskConfiguration']['create'](_0x538a98[_0x0092('0x45')],{})[_0x0092('0x21')](respondWithResult(_0x5849c5,0xc9))['catch'](handleError(_0x5849c5,null));};exports[_0x0092('0x46')]=function(_0x1aa14a,_0x4d9048){if(_0x1aa14a[_0x0092('0x45')]['id']){delete _0x1aa14a[_0x0092('0x45')]['id'];}return db['ZendeskConfiguration'][_0x0092('0x43')]({'where':{'id':_0x1aa14a[_0x0092('0x41')]['id']}})[_0x0092('0x21')](handleEntityNotFound(_0x4d9048,null))[_0x0092('0x21')](saveUpdates(_0x1aa14a[_0x0092('0x45')],null))[_0x0092('0x21')](respondWithResult(_0x4d9048,null))[_0x0092('0x47')](handleError(_0x4d9048,null));};exports[_0x0092('0x22')]=function(_0x336f0c,_0x1a0b06){return db[_0x0092('0x29')][_0x0092('0x43')]({'where':{'id':_0x336f0c[_0x0092('0x41')]['id']}})[_0x0092('0x21')](handleEntityNotFound(_0x1a0b06,null))[_0x0092('0x21')](removeEntity(_0x1a0b06,null))['catch'](handleError(_0x1a0b06,null));};exports[_0x0092('0x48')]=function(_0x416644,_0x68b729,_0x5a42a6){var _0x1ff89c={};var _0x23eac2={};var _0x521900;var _0x1bc378;return db[_0x0092('0x29')][_0x0092('0x49')]({'where':{'id':_0x416644[_0x0092('0x41')]['id']}})[_0x0092('0x21')](handleEntityNotFound(_0x68b729,null))['then'](function(_0x15ed0b){if(_0x15ed0b){_0x521900=_0x15ed0b;_0x23eac2[_0x0092('0x2c')]=_['keys'](db['ZendeskField']['rawAttributes']);_0x23eac2['query']=_[_0x0092('0x2d')](_0x416644['query']);_0x23eac2['filters']=_['intersection'](_0x23eac2[_0x0092('0x2c')],_0x23eac2[_0x0092('0x2e')]);_0x1ff89c[_0x0092('0x30')]=_[_0x0092('0x31')](_0x23eac2[_0x0092('0x2c')],qs[_0x0092('0x32')](_0x416644[_0x0092('0x2e')][_0x0092('0x32')]));_0x1ff89c[_0x0092('0x30')]=_0x1ff89c[_0x0092('0x30')][_0x0092('0x33')]?_0x1ff89c[_0x0092('0x30')]:_0x23eac2['model'];_0x1ff89c[_0x0092('0x35')]=qs[_0x0092('0x36')](_0x416644[_0x0092('0x2e')][_0x0092('0x36')]);_0x1ff89c['where']=qs[_0x0092('0x2f')](_[_0x0092('0x4a')](_0x416644['query'],_0x23eac2['filters']));if(_0x416644[_0x0092('0x2e')][_0x0092('0x3b')]){_0x1ff89c[_0x0092('0x37')]=_[_0x0092('0x38')](_0x1ff89c['where'],{'$or':_[_0x0092('0x28')](_0x1ff89c[_0x0092('0x30')],function(_0x51303c){var _0x132fbb={};_0x132fbb[_0x51303c]={'$like':'%'+_0x416644[_0x0092('0x2e')]['filter']+'%'};return _0x132fbb;})});}_0x1ff89c=_[_0x0092('0x38')]({},_0x1ff89c,_0x416644['options']);return _0x521900[_0x0092('0x48')](_0x1ff89c);}})['then'](function(_0x550739){if(_0x550739){_0x1bc378=_0x550739['length'];if(!_0x416644[_0x0092('0x2e')][_0x0092('0x34')](_0x0092('0x4b'))){_0x1ff89c[_0x0092('0x1a')]=qs[_0x0092('0x1a')](_0x416644[_0x0092('0x2e')][_0x0092('0x1a')]);_0x1ff89c['offset']=qs['offset'](_0x416644['query']['offset']);}return _0x521900[_0x0092('0x48')](_0x1ff89c);}})[_0x0092('0x21')](function(_0x13f14e){if(_0x13f14e){return _0x13f14e?{'count':_0x1bc378,'rows':_0x13f14e}:null;}})[_0x0092('0x21')](respondWithResult(_0x68b729,null))[_0x0092('0x47')](handleError(_0x68b729,null));};exports[_0x0092('0x4c')]=function(_0x41059d,_0x3b81c4,_0x543cef){var _0x1fee8a={};var _0x38e2f2={};var _0x19df1a;var _0xe8f41b;return db[_0x0092('0x29')][_0x0092('0x49')]({'where':{'id':_0x41059d[_0x0092('0x41')]['id']}})['then'](handleEntityNotFound(_0x3b81c4,null))[_0x0092('0x21')](function(_0x5d6d03){if(_0x5d6d03){_0x19df1a=_0x5d6d03;_0x38e2f2['model']=_[_0x0092('0x2d')](db[_0x0092('0x4d')]['rawAttributes']);_0x38e2f2['query']=_[_0x0092('0x2d')](_0x41059d[_0x0092('0x2e')]);_0x38e2f2[_0x0092('0x2f')]=_['intersection'](_0x38e2f2[_0x0092('0x2c')],_0x38e2f2[_0x0092('0x2e')]);_0x1fee8a[_0x0092('0x30')]=_[_0x0092('0x31')](_0x38e2f2[_0x0092('0x2c')],qs[_0x0092('0x32')](_0x41059d[_0x0092('0x2e')]['fields']));_0x1fee8a[_0x0092('0x30')]=_0x1fee8a[_0x0092('0x30')][_0x0092('0x33')]?_0x1fee8a[_0x0092('0x30')]:_0x38e2f2[_0x0092('0x2c')];_0x1fee8a['order']=qs[_0x0092('0x36')](_0x41059d[_0x0092('0x2e')][_0x0092('0x36')]);_0x1fee8a['where']=qs[_0x0092('0x2f')](_['pick'](_0x41059d[_0x0092('0x2e')],_0x38e2f2[_0x0092('0x2f')]));if(_0x41059d[_0x0092('0x2e')][_0x0092('0x3b')]){_0x1fee8a[_0x0092('0x37')]=_[_0x0092('0x38')](_0x1fee8a[_0x0092('0x37')],{'$or':_[_0x0092('0x28')](_0x1fee8a[_0x0092('0x30')],function(_0x1a1fd3){var _0x35cd28={};_0x35cd28[_0x1a1fd3]={'$like':'%'+_0x41059d[_0x0092('0x2e')]['filter']+'%'};return _0x35cd28;})});}_0x1fee8a=_[_0x0092('0x38')]({},_0x1fee8a,_0x41059d[_0x0092('0x3c')]);return _0x19df1a[_0x0092('0x4c')](_0x1fee8a);}})['then'](function(_0x108895){if(_0x108895){_0xe8f41b=_0x108895[_0x0092('0x33')];if(!_0x41059d['query']['hasOwnProperty'](_0x0092('0x4b'))){_0x1fee8a[_0x0092('0x1a')]=qs[_0x0092('0x1a')](_0x41059d['query']['limit']);_0x1fee8a[_0x0092('0x19')]=qs[_0x0092('0x19')](_0x41059d[_0x0092('0x2e')][_0x0092('0x19')]);}return _0x19df1a[_0x0092('0x4c')](_0x1fee8a);}})[_0x0092('0x21')](function(_0x560d86){if(_0x560d86){return _0x560d86?{'count':_0xe8f41b,'rows':_0x560d86}:null;}})['then'](respondWithResult(_0x3b81c4,null))[_0x0092('0x47')](handleError(_0x3b81c4,null));};exports[_0x0092('0x4e')]=function(_0x240560,_0xc2149b,_0x3ee44f){var _0x4a2b86={};var _0x595a21={};var _0x98e25;var _0x2d8c55;return db['ZendeskConfiguration'][_0x0092('0x49')]({'where':{'id':_0x240560[_0x0092('0x41')]['id']}})[_0x0092('0x21')](handleEntityNotFound(_0xc2149b,null))[_0x0092('0x21')](function(_0x286380){if(_0x286380){_0x98e25=_0x286380;_0x595a21[_0x0092('0x2c')]=_[_0x0092('0x2d')](db[_0x0092('0x4d')][_0x0092('0x2a')]);_0x595a21[_0x0092('0x2e')]=_[_0x0092('0x2d')](_0x240560[_0x0092('0x2e')]);_0x595a21[_0x0092('0x2f')]=_['intersection'](_0x595a21[_0x0092('0x2c')],_0x595a21['query']);_0x4a2b86['attributes']=_[_0x0092('0x31')](_0x595a21['model'],qs[_0x0092('0x32')](_0x240560['query'][_0x0092('0x32')]));_0x4a2b86[_0x0092('0x30')]=_0x4a2b86['attributes'][_0x0092('0x33')]?_0x4a2b86[_0x0092('0x30')]:_0x595a21[_0x0092('0x2c')];_0x4a2b86[_0x0092('0x35')]=qs[_0x0092('0x36')](_0x240560['query'][_0x0092('0x36')]);_0x4a2b86[_0x0092('0x37')]=qs[_0x0092('0x2f')](_[_0x0092('0x4a')](_0x240560[_0x0092('0x2e')],_0x595a21[_0x0092('0x2f')]));if(_0x240560[_0x0092('0x2e')]['filter']){_0x4a2b86[_0x0092('0x37')]=_[_0x0092('0x38')](_0x4a2b86['where'],{'$or':_[_0x0092('0x28')](_0x4a2b86[_0x0092('0x30')],function(_0x2571e8){var _0x2a0d02={};_0x2a0d02[_0x2571e8]={'$like':'%'+_0x240560['query'][_0x0092('0x3b')]+'%'};return _0x2a0d02;})});}_0x4a2b86=_[_0x0092('0x38')]({},_0x4a2b86,_0x240560[_0x0092('0x3c')]);return _0x98e25['getDescriptions'](_0x4a2b86);}})['then'](function(_0x233eea){if(_0x233eea){_0x2d8c55=_0x233eea[_0x0092('0x33')];if(!_0x240560[_0x0092('0x2e')][_0x0092('0x34')]('nolimit')){_0x4a2b86[_0x0092('0x1a')]=qs[_0x0092('0x1a')](_0x240560[_0x0092('0x2e')][_0x0092('0x1a')]);_0x4a2b86[_0x0092('0x19')]=qs[_0x0092('0x19')](_0x240560[_0x0092('0x2e')][_0x0092('0x19')]);}return _0x98e25['getDescriptions'](_0x4a2b86);}})[_0x0092('0x21')](function(_0x131244){if(_0x131244){return _0x131244?{'count':_0x2d8c55,'rows':_0x131244}:null;}})['then'](respondWithResult(_0xc2149b,null))[_0x0092('0x47')](handleError(_0xc2149b,null));};exports[_0x0092('0x4f')]=function(_0x3bf5ba,_0x14ca97,_0x5d36b3){var _0x3525e3={};var _0x4d1d89={};var _0x2186eb;var _0x5d9015;return db[_0x0092('0x29')]['findOne']({'where':{'id':_0x3bf5ba[_0x0092('0x41')]['id']}})[_0x0092('0x21')](handleEntityNotFound(_0x14ca97,null))['then'](function(_0x3fe7a9){if(_0x3fe7a9){_0x2186eb=_0x3fe7a9;_0x4d1d89[_0x0092('0x2c')]=_[_0x0092('0x2d')](db[_0x0092('0x50')]['rawAttributes']);_0x4d1d89[_0x0092('0x2e')]=_[_0x0092('0x2d')](_0x3bf5ba[_0x0092('0x2e')]);_0x4d1d89[_0x0092('0x2f')]=_[_0x0092('0x31')](_0x4d1d89['model'],_0x4d1d89[_0x0092('0x2e')]);_0x3525e3[_0x0092('0x30')]=_[_0x0092('0x31')](_0x4d1d89[_0x0092('0x2c')],qs[_0x0092('0x32')](_0x3bf5ba[_0x0092('0x2e')]['fields']));_0x3525e3[_0x0092('0x30')]=_0x3525e3[_0x0092('0x30')][_0x0092('0x33')]?_0x3525e3['attributes']:_0x4d1d89['model'];_0x3525e3[_0x0092('0x35')]=qs[_0x0092('0x36')](_0x3bf5ba['query']['sort']);_0x3525e3[_0x0092('0x37')]=qs[_0x0092('0x2f')](_[_0x0092('0x4a')](_0x3bf5ba[_0x0092('0x2e')],_0x4d1d89[_0x0092('0x2f')]));if(_0x3bf5ba[_0x0092('0x2e')]['filter']){_0x3525e3[_0x0092('0x37')]=_['merge'](_0x3525e3[_0x0092('0x37')],{'$or':_[_0x0092('0x28')](_0x3525e3[_0x0092('0x30')],function(_0x26a546){var _0x57539a={};_0x57539a[_0x26a546]={'$like':'%'+_0x3bf5ba[_0x0092('0x2e')]['filter']+'%'};return _0x57539a;})});}_0x3525e3=_[_0x0092('0x38')]({},_0x3525e3,_0x3bf5ba['options']);return _0x2186eb[_0x0092('0x4f')](_0x3525e3);}})['then'](function(_0xe0acd1){if(_0xe0acd1){_0x5d9015=_0xe0acd1[_0x0092('0x33')];if(!_0x3bf5ba[_0x0092('0x2e')][_0x0092('0x34')](_0x0092('0x4b'))){_0x3525e3[_0x0092('0x1a')]=qs[_0x0092('0x1a')](_0x3bf5ba[_0x0092('0x2e')]['limit']);_0x3525e3[_0x0092('0x19')]=qs['offset'](_0x3bf5ba[_0x0092('0x2e')][_0x0092('0x19')]);}return _0x2186eb[_0x0092('0x4f')](_0x3525e3);}})[_0x0092('0x21')](function(_0x39dc4e){if(_0x39dc4e){return _0x39dc4e?{'count':_0x5d9015,'rows':_0x39dc4e}:null;}})[_0x0092('0x21')](respondWithResult(_0x14ca97,null))[_0x0092('0x47')](handleError(_0x14ca97,null));};exports['setTags']=function(_0x422d65,_0x4e453c,_0x2c03a3){if(_0x422d65[_0x0092('0x45')]['id']){delete _0x422d65[_0x0092('0x45')]['id'];}return db[_0x0092('0x29')][_0x0092('0x49')]({'where':{'id':_0x422d65[_0x0092('0x41')]['id']}})[_0x0092('0x21')](handleEntityNotFound(_0x4e453c,null))[_0x0092('0x21')](function(_0x5e8ca0){if(_0x5e8ca0){return _0x5e8ca0[_0x0092('0x51')](_0x422d65[_0x0092('0x45')][_0x0092('0x52')]||[]);}return null;})[_0x0092('0x21')](respondWithResult(_0x4e453c,null))[_0x0092('0x47')](handleError(_0x4e453c,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index dc83190..679295e 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 _0xcf66=['exports','ZendeskConfiguration','int_zendesk_configurations','lodash','util','../../config/logger','moment','bluebird','rimraf','../../config/environment'];(function(_0x5ae0a3,_0x5bddb9){var _0x2f8bba=function(_0x43831d){while(--_0x43831d){_0x5ae0a3['push'](_0x5ae0a3['shift']());}};_0x2f8bba(++_0x5bddb9);}(_0xcf66,0x71));var _0x6cf6=function(_0x4afd0d,_0x2575a1){_0x4afd0d=_0x4afd0d-0x0;var _0x6c0a7a=_0xcf66[_0x4afd0d];return _0x6c0a7a;};'use strict';var _=require(_0x6cf6('0x0'));var util=require(_0x6cf6('0x1'));var logger=require(_0x6cf6('0x2'))('api');var moment=require(_0x6cf6('0x3'));var BPromise=require(_0x6cf6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6cf6('0x5'));var config=require(_0x6cf6('0x6'));var attributes=require('./intZendeskConfiguration.attributes');module[_0x6cf6('0x7')]=function(_0x1fbedd,_0x2a573e){return _0x1fbedd['define'](_0x6cf6('0x8'),attributes,{'tableName':_0x6cf6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6b20=['lodash','util','api','bluebird','request-promise','path','../../config/environment','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration'];(function(_0x547594,_0x512536){var _0x587c5d=function(_0x5eba60){while(--_0x5eba60){_0x547594['push'](_0x547594['shift']());}};_0x587c5d(++_0x512536);}(_0x6b20,0xd1));var _0x06b2=function(_0x50e266,_0x1e221d){_0x50e266=_0x50e266-0x0;var _0x97bdb8=_0x6b20[_0x50e266];return _0x97bdb8;};'use strict';var _=require(_0x06b2('0x0'));var util=require(_0x06b2('0x1'));var logger=require('../../config/logger')(_0x06b2('0x2'));var moment=require('moment');var BPromise=require(_0x06b2('0x3'));var rp=require(_0x06b2('0x4'));var fs=require('fs');var path=require(_0x06b2('0x5'));var rimraf=require('rimraf');var config=require(_0x06b2('0x6'));var attributes=require(_0x06b2('0x7'));module[_0x06b2('0x8')]=function(_0x30d39c,_0x3b792b){return _0x30d39c[_0x06b2('0x9')](_0x06b2('0xa'),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 d25e4d4..f8d2280 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 _0xb296=['ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','ZendeskConfiguration,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring'];(function(_0x3a791b,_0x45afd0){var _0x151ee2=function(_0xc077cb){while(--_0xc077cb){_0x3a791b['push'](_0x3a791b['shift']());}};_0x151ee2(++_0x45afd0);}(_0xb296,0x183));var _0x6b29=function(_0x427785,_0x255893){_0x427785=_0x427785-0x0;var _0x378340=_0xb296[_0x427785];return _0x378340;};'use strict';var _=require('lodash');var util=require(_0x6b29('0x0'));var moment=require(_0x6b29('0x1'));var BPromise=require(_0x6b29('0x2'));var rs=require(_0x6b29('0x3'));var fs=require('fs');var Redis=require(_0x6b29('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6b29('0x5'));var logger=require(_0x6b29('0x6'))('rpc');var config=require(_0x6b29('0x7'));var jayson=require(_0x6b29('0x8'));var client=jayson[_0x6b29('0x9')][_0x6b29('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x312eda,_0x391d7e,_0x5c1ad8){return new BPromise(function(_0x122dea,_0x465c98){return client[_0x6b29('0xb')](_0x312eda,_0x5c1ad8)[_0x6b29('0xc')](function(_0x5004d4){logger[_0x6b29('0xd')]('ZendeskConfiguration,\x20%s,\x20%s',_0x391d7e,_0x6b29('0xe'));logger[_0x6b29('0xf')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x391d7e,_0x6b29('0xe'),JSON[_0x6b29('0x10')](_0x5004d4));if(_0x5004d4[_0x6b29('0x11')]){if(_0x5004d4['error'][_0x6b29('0x12')]===0x1f4){logger[_0x6b29('0x11')](_0x6b29('0x13'),_0x391d7e,_0x5004d4[_0x6b29('0x11')][_0x6b29('0x14')]);return _0x465c98(_0x5004d4[_0x6b29('0x11')]['message']);}logger['error'](_0x6b29('0x13'),_0x391d7e,_0x5004d4['error'][_0x6b29('0x14')]);return _0x122dea(_0x5004d4[_0x6b29('0x11')][_0x6b29('0x14')]);}else{logger[_0x6b29('0xd')]('ZendeskConfiguration,\x20%s,\x20%s',_0x391d7e,'request\x20sent');_0x122dea(_0x5004d4[_0x6b29('0x15')]['message']);}})[_0x6b29('0x16')](function(_0x49572c){logger[_0x6b29('0x11')]('ZendeskConfiguration,\x20%s,\x20%s',_0x391d7e,_0x49572c);_0x465c98(_0x49572c);});});} \ No newline at end of file +var _0xcc8a=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','ZendeskConfiguration,\x20%s,\x20%s','message','catch','lodash','bluebird','ioredis'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0xcc8a,0x1e0));var _0xacc8=function(_0xd83abd,_0x442167){_0xd83abd=_0xd83abd-0x0;var _0x35ba97=_0xcc8a[_0xd83abd];return _0x35ba97;};'use strict';var _=require(_0xacc8('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xacc8('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xacc8('0x2'));var db=require(_0xacc8('0x3'))['db'];var utils=require(_0xacc8('0x4'));var logger=require(_0xacc8('0x5'))(_0xacc8('0x6'));var config=require(_0xacc8('0x7'));var jayson=require(_0xacc8('0x8'));var client=jayson[_0xacc8('0x9')][_0xacc8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x41f341,_0x3f2c37,_0x3057ea){return new BPromise(function(_0x15931c,_0x225991){return client['request'](_0x41f341,_0x3057ea)['then'](function(_0x36cf76){logger[_0xacc8('0xb')]('ZendeskConfiguration,\x20%s,\x20%s',_0x3f2c37,_0xacc8('0xc'));logger[_0xacc8('0xd')](_0xacc8('0xe'),_0x3f2c37,_0xacc8('0xc'),JSON[_0xacc8('0xf')](_0x36cf76));if(_0x36cf76['error']){if(_0x36cf76[_0xacc8('0x10')][_0xacc8('0x11')]===0x1f4){logger[_0xacc8('0x10')](_0xacc8('0x12'),_0x3f2c37,_0x36cf76[_0xacc8('0x10')][_0xacc8('0x13')]);return _0x225991(_0x36cf76[_0xacc8('0x10')][_0xacc8('0x13')]);}logger[_0xacc8('0x10')](_0xacc8('0x12'),_0x3f2c37,_0x36cf76['error'][_0xacc8('0x13')]);return _0x15931c(_0x36cf76[_0xacc8('0x10')]['message']);}else{logger[_0xacc8('0xb')](_0xacc8('0x12'),_0x3f2c37,_0xacc8('0xc'));_0x15931c(_0x36cf76['result']['message']);}})[_0xacc8('0x14')](function(_0x378ea7){logger[_0xacc8('0x10')](_0xacc8('0x12'),_0x3f2c37,_0x378ea7);_0x225991(_0x378ea7);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 5547b21..f8ad99a 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 _0x8577=['Router','fs-extra','../../config/environment','get','isAuthenticated','index','/:id','show','post','put','destroy','exports','util','path','connect-timeout','express'];(function(_0x33554b,_0x48162b){var _0x256954=function(_0x185f66){while(--_0x185f66){_0x33554b['push'](_0x33554b['shift']());}};_0x256954(++_0x48162b);}(_0x8577,0xfc));var _0x7857=function(_0x36595f,_0x361a2c){_0x36595f=_0x36595f-0x0;var _0x27c39d=_0x8577[_0x36595f];return _0x27c39d;};'use strict';var multer=require('multer');var util=require(_0x7857('0x0'));var path=require(_0x7857('0x1'));var timeout=require(_0x7857('0x2'));var express=require(_0x7857('0x3'));var router=express[_0x7857('0x4')]();var fs_extra=require(_0x7857('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7857('0x6'));var controller=require('./intZendeskField.controller');router[_0x7857('0x7')]('/',auth[_0x7857('0x8')](),controller[_0x7857('0x9')]);router[_0x7857('0x7')](_0x7857('0xa'),auth[_0x7857('0x8')](),controller[_0x7857('0xb')]);router[_0x7857('0xc')]('/',auth[_0x7857('0x8')](),controller['create']);router[_0x7857('0xd')](_0x7857('0xa'),auth[_0x7857('0x8')](),controller['update']);router['delete'](_0x7857('0xa'),auth[_0x7857('0x8')](),controller[_0x7857('0xe')]);module[_0x7857('0xf')]=router; \ No newline at end of file +var _0x2d13=['get','/:id','isAuthenticated','show','put','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intZendeskField.controller','index'];(function(_0x361d3f,_0x3be2aa){var _0x320229=function(_0x138319){while(--_0x138319){_0x361d3f['push'](_0x361d3f['shift']());}};_0x320229(++_0x3be2aa);}(_0x2d13,0x1c2));var _0x32d1=function(_0x52a6e3,_0x4a73b4){_0x52a6e3=_0x52a6e3-0x0;var _0x8910d0=_0x2d13[_0x52a6e3];return _0x8910d0;};'use strict';var multer=require(_0x32d1('0x0'));var util=require('util');var path=require(_0x32d1('0x1'));var timeout=require(_0x32d1('0x2'));var express=require(_0x32d1('0x3'));var router=express[_0x32d1('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x32d1('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x32d1('0x6'));var controller=require(_0x32d1('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x32d1('0x8')]);router[_0x32d1('0x9')](_0x32d1('0xa'),auth[_0x32d1('0xb')](),controller[_0x32d1('0xc')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x32d1('0xd')](_0x32d1('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x32d1('0xe')](_0x32d1('0xa'),auth[_0x32d1('0xb')](),controller[_0x32d1('0xf')]);module[_0x32d1('0x10')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 3e2d36f..c0d5991 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 _0xc29e=['string','customVariable','keyValue','picklist','STRING','variable','sequelize','ENUM'];(function(_0x5d78c0,_0x61059d){var _0xeb86c8=function(_0x358789){while(--_0x358789){_0x5d78c0['push'](_0x5d78c0['shift']());}};_0xeb86c8(++_0x61059d);}(_0xc29e,0xe6));var _0xec29=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xc29e[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require(_0xec29('0x0'));module['exports']={'type':{'type':Sequelize[_0xec29('0x1')](_0xec29('0x2'),'variable',_0xec29('0x3'),_0xec29('0x4'),_0xec29('0x5')),'defaultValue':_0xec29('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xec29('0x6')]},'keyType':{'type':Sequelize[_0xec29('0x1')](_0xec29('0x2'),_0xec29('0x7'),_0xec29('0x3'))},'keyContent':{'type':Sequelize[_0xec29('0x6')]},'idField':{'type':Sequelize[_0xec29('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6386=['exports','ENUM','keyValue','string','STRING','customVariable'];(function(_0x3bbbd2,_0x506692){var _0x18ad2e=function(_0x3f1d2f){while(--_0x3f1d2f){_0x3bbbd2['push'](_0x3bbbd2['shift']());}};_0x18ad2e(++_0x506692);}(_0x6386,0x1bc));var _0x6638=function(_0x40e7e5,_0x33af13){_0x40e7e5=_0x40e7e5-0x0;var _0x40f3c6=_0x6386[_0x40e7e5];return _0x40f3c6;};'use strict';var Sequelize=require('sequelize');module[_0x6638('0x0')]={'type':{'type':Sequelize[_0x6638('0x1')]('string','variable','customVariable',_0x6638('0x2'),'picklist'),'defaultValue':_0x6638('0x3')},'content':{'type':Sequelize[_0x6638('0x4')]},'key':{'type':Sequelize[_0x6638('0x4')]},'keyType':{'type':Sequelize['ENUM'](_0x6638('0x3'),'variable',_0x6638('0x5'))},'keyContent':{'type':Sequelize[_0x6638('0x4')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x6638('0x4')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6638('0x4')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index af8c6d8..906e1a2 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 _0x2aaa=['../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','error','stack','name','index','map','ZendeskField','rawAttributes','type','key','model','query','filters','attributes','intersection','fields','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','then','rows','catch','show','params','keys','length','find','body','update','destroy','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x5eae0c,_0x36d39b){var _0x1695ed=function(_0x265afa){while(--_0x265afa){_0x5eae0c['push'](_0x5eae0c['shift']());}};_0x1695ed(++_0x36d39b);}(_0x2aaa,0x1d8));var _0xa2aa=function(_0x25e434,_0x48e43a){_0x25e434=_0x25e434-0x0;var _0x546adb=_0x2aaa[_0x25e434];return _0x546adb;};'use strict';var emlformat=require(_0xa2aa('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa2aa('0x1'));var jsonpatch=require(_0xa2aa('0x2'));var rp=require(_0xa2aa('0x3'));var moment=require('moment');var BPromise=require(_0xa2aa('0x4'));var Mustache=require(_0xa2aa('0x5'));var util=require(_0xa2aa('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xa2aa('0x7'));var ejs=require(_0xa2aa('0x8'));var fs=require('fs');var fs_extra=require(_0xa2aa('0x9'));var _=require(_0xa2aa('0xa'));var squel=require(_0xa2aa('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa2aa('0xc'));var toCsv=require(_0xa2aa('0x7'));var querystring=require(_0xa2aa('0xd'));var Papa=require(_0xa2aa('0xe'));var Redis=require(_0xa2aa('0xf'));var authService=require(_0xa2aa('0x10'));var qs=require(_0xa2aa('0x11'));var as=require(_0xa2aa('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa2aa('0x13'))(_0xa2aa('0x14'));var utils=require('../../config/utils');var config=require(_0xa2aa('0x15'));var licenseUtil=require(_0xa2aa('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2eeef6,_0xd115de){_0xd115de=_0xd115de||0xcc;return function(_0x410a40){if(_0x410a40){return _0x2eeef6[_0xa2aa('0x17')](_0xd115de);}return _0x2eeef6[_0xa2aa('0x18')](_0xd115de)[_0xa2aa('0x19')]();};}function respondWithResult(_0x17181e,_0x1531ea){_0x1531ea=_0x1531ea||0xc8;return function(_0x2478c8){if(_0x2478c8){return _0x17181e[_0xa2aa('0x18')](_0x1531ea)[_0xa2aa('0x1a')](_0x2478c8);}};}function respondWithFilteredResult(_0x2ddcb5,_0x18fdaf){return function(_0x260642){if(_0x260642){var _0x587f3b=typeof _0x18fdaf[_0xa2aa('0x1b')]===_0xa2aa('0x1c')&&typeof _0x18fdaf[_0xa2aa('0x1d')]===_0xa2aa('0x1c');var _0x43372f=_0x260642['count'];var _0x496e6e=_0x587f3b?0x0:_0x18fdaf[_0xa2aa('0x1b')];var _0x13853f=_0x587f3b?_0x260642[_0xa2aa('0x1e')]:_0x18fdaf['offset']+_0x18fdaf[_0xa2aa('0x1d')];var _0xa0a8f4;if(_0x13853f>=_0x43372f){_0x13853f=_0x43372f;_0xa0a8f4=0xc8;}else{_0xa0a8f4=0xce;}_0x2ddcb5[_0xa2aa('0x18')](_0xa0a8f4);return _0x2ddcb5[_0xa2aa('0x1f')](_0xa2aa('0x20'),_0x496e6e+'-'+_0x13853f+'/'+_0x43372f)['json'](_0x260642);}return null;};}function patchUpdates(_0x30e747){return function(_0x2ca932){try{jsonpatch[_0xa2aa('0x21')](_0x2ca932,_0x30e747,!![]);}catch(_0x5148eb){return BPromise[_0xa2aa('0x22')](_0x5148eb);}return _0x2ca932['save']();};}function saveUpdates(_0xae922a,_0x165157){return function(_0x217830){if(_0x217830){return _0x217830['update'](_0xae922a)['then'](function(_0x499080){return _0x499080;});}return null;};}function removeEntity(_0x34b792,_0x3642f0){return function(_0x9badbd){if(_0x9badbd){return _0x9badbd['destroy']()['then'](function(){_0x34b792[_0xa2aa('0x18')](0xcc)[_0xa2aa('0x19')]();});}};}function handleEntityNotFound(_0xfdfbc9,_0x3d63cf){return function(_0x3a8cb9){if(!_0x3a8cb9){_0xfdfbc9[_0xa2aa('0x17')](0x194);}return _0x3a8cb9;};}function handleError(_0x4a542d,_0x100181){_0x100181=_0x100181||0x1f4;return function(_0x104640){logger[_0xa2aa('0x23')](_0x104640[_0xa2aa('0x24')]);if(_0x104640[_0xa2aa('0x25')]){delete _0x104640[_0xa2aa('0x25')];}_0x4a542d['status'](_0x100181)['send'](_0x104640);};}exports[_0xa2aa('0x26')]=function(_0x54eca9,_0x3efe60){var _0xd3d76c={},_0x36db0d={},_0x1b407b={'count':0x0,'rows':[]};var _0x465150=_[_0xa2aa('0x27')](db[_0xa2aa('0x28')][_0xa2aa('0x29')],function(_0x318c38){return{'name':_0x318c38['fieldName'],'type':_0x318c38[_0xa2aa('0x2a')][_0xa2aa('0x2b')]};});_0x36db0d[_0xa2aa('0x2c')]=_[_0xa2aa('0x27')](_0x465150,_0xa2aa('0x25'));_0x36db0d[_0xa2aa('0x2d')]=_['keys'](_0x54eca9[_0xa2aa('0x2d')]);_0x36db0d[_0xa2aa('0x2e')]=_['intersection'](_0x36db0d[_0xa2aa('0x2c')],_0x36db0d[_0xa2aa('0x2d')]);_0xd3d76c[_0xa2aa('0x2f')]=_[_0xa2aa('0x30')](_0x36db0d[_0xa2aa('0x2c')],qs[_0xa2aa('0x31')](_0x54eca9[_0xa2aa('0x2d')][_0xa2aa('0x31')]));_0xd3d76c['attributes']=_0xd3d76c[_0xa2aa('0x2f')]['length']?_0xd3d76c[_0xa2aa('0x2f')]:_0x36db0d[_0xa2aa('0x2c')];if(!_0x54eca9[_0xa2aa('0x2d')][_0xa2aa('0x32')]('nolimit')){_0xd3d76c[_0xa2aa('0x1d')]=qs[_0xa2aa('0x1d')](_0x54eca9[_0xa2aa('0x2d')][_0xa2aa('0x1d')]);_0xd3d76c['offset']=qs[_0xa2aa('0x1b')](_0x54eca9[_0xa2aa('0x2d')][_0xa2aa('0x1b')]);}_0xd3d76c[_0xa2aa('0x33')]=qs[_0xa2aa('0x34')](_0x54eca9[_0xa2aa('0x2d')][_0xa2aa('0x34')]);_0xd3d76c[_0xa2aa('0x35')]=qs['filters'](_[_0xa2aa('0x36')](_0x54eca9['query'],_0x36db0d[_0xa2aa('0x2e')]),_0x465150);if(_0x54eca9['query'][_0xa2aa('0x37')]){_0xd3d76c[_0xa2aa('0x35')]=_['merge'](_0xd3d76c[_0xa2aa('0x35')],{'$or':_[_0xa2aa('0x27')](_0x465150,function(_0x2205d2){if(_0x2205d2[_0xa2aa('0x2a')]!=='VIRTUAL'){var _0x9679e8={};_0x9679e8[_0x2205d2[_0xa2aa('0x25')]]={'$like':'%'+_0x54eca9[_0xa2aa('0x2d')][_0xa2aa('0x37')]+'%'};return _0x9679e8;}})});}_0xd3d76c=_[_0xa2aa('0x38')]({},_0xd3d76c,_0x54eca9[_0xa2aa('0x39')]);var _0x1400b9={'where':_0xd3d76c[_0xa2aa('0x35')]};return db['ZendeskField'][_0xa2aa('0x1e')](_0x1400b9)['then'](function(_0x196992){_0x1b407b['count']=_0x196992;if(_0x54eca9['query'][_0xa2aa('0x3a')]){_0xd3d76c['include']=[{'all':!![]}];}return db[_0xa2aa('0x28')]['findAll'](_0xd3d76c);})[_0xa2aa('0x3b')](function(_0x340774){_0x1b407b[_0xa2aa('0x3c')]=_0x340774;return _0x1b407b;})[_0xa2aa('0x3b')](respondWithFilteredResult(_0x3efe60,_0xd3d76c))[_0xa2aa('0x3d')](handleError(_0x3efe60,null));};exports[_0xa2aa('0x3e')]=function(_0x4a73df,_0x47a807){var _0x371e6b={'raw':!![],'where':{'id':_0x4a73df[_0xa2aa('0x3f')]['id']}},_0x201561={};_0x201561[_0xa2aa('0x2c')]=_[_0xa2aa('0x40')](db[_0xa2aa('0x28')][_0xa2aa('0x29')]);_0x201561['query']=_['keys'](_0x4a73df[_0xa2aa('0x2d')]);_0x201561[_0xa2aa('0x2e')]=_[_0xa2aa('0x30')](_0x201561[_0xa2aa('0x2c')],_0x201561[_0xa2aa('0x2d')]);_0x371e6b[_0xa2aa('0x2f')]=_['intersection'](_0x201561[_0xa2aa('0x2c')],qs['fields'](_0x4a73df[_0xa2aa('0x2d')]['fields']));_0x371e6b[_0xa2aa('0x2f')]=_0x371e6b[_0xa2aa('0x2f')][_0xa2aa('0x41')]?_0x371e6b[_0xa2aa('0x2f')]:_0x201561['model'];if(_0x4a73df[_0xa2aa('0x2d')][_0xa2aa('0x3a')]){_0x371e6b['include']=[{'all':!![]}];}_0x371e6b=_[_0xa2aa('0x38')]({},_0x371e6b,_0x4a73df[_0xa2aa('0x39')]);return db['ZendeskField'][_0xa2aa('0x42')](_0x371e6b)[_0xa2aa('0x3b')](handleEntityNotFound(_0x47a807,null))[_0xa2aa('0x3b')](respondWithResult(_0x47a807,null))[_0xa2aa('0x3d')](handleError(_0x47a807,null));};exports['create']=function(_0x4aad2e,_0x56e26e){return db[_0xa2aa('0x28')]['create'](_0x4aad2e[_0xa2aa('0x43')],{})[_0xa2aa('0x3b')](respondWithResult(_0x56e26e,0xc9))[_0xa2aa('0x3d')](handleError(_0x56e26e,null));};exports[_0xa2aa('0x44')]=function(_0x38814a,_0x3ed449){if(_0x38814a['body']['id']){delete _0x38814a[_0xa2aa('0x43')]['id'];}return db[_0xa2aa('0x28')]['find']({'where':{'id':_0x38814a[_0xa2aa('0x3f')]['id']}})[_0xa2aa('0x3b')](handleEntityNotFound(_0x3ed449,null))[_0xa2aa('0x3b')](saveUpdates(_0x38814a['body'],null))['then'](respondWithResult(_0x3ed449,null))['catch'](handleError(_0x3ed449,null));};exports[_0xa2aa('0x45')]=function(_0x1e9b73,_0x3f164c){return db[_0xa2aa('0x28')][_0xa2aa('0x42')]({'where':{'id':_0x1e9b73[_0xa2aa('0x3f')]['id']}})[_0xa2aa('0x3b')](handleEntityNotFound(_0x3f164c,null))[_0xa2aa('0x3b')](removeEntity(_0x3f164c,null))[_0xa2aa('0x3d')](handleError(_0x3f164c,null));}; \ No newline at end of file +var _0x726e=['includeAll','include','findAll','length','options','find','create','body','catch','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../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','index','map','ZendeskField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x726e,0x186));var _0xe726=function(_0x3d3b75,_0x4e5961){_0x3d3b75=_0x3d3b75-0x0;var _0x4bb4ab=_0x726e[_0x3d3b75];return _0x4bb4ab;};'use strict';var emlformat=require(_0xe726('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe726('0x1'));var jsonpatch=require(_0xe726('0x2'));var rp=require(_0xe726('0x3'));var moment=require(_0xe726('0x4'));var BPromise=require(_0xe726('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xe726('0x6'));var sox=require(_0xe726('0x7'));var csv=require('to-csv');var ejs=require(_0xe726('0x8'));var fs=require('fs');var fs_extra=require(_0xe726('0x9'));var _=require(_0xe726('0xa'));var squel=require(_0xe726('0xb'));var crypto=require(_0xe726('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xe726('0xd'));var toCsv=require(_0xe726('0xe'));var querystring=require(_0xe726('0xf'));var Papa=require(_0xe726('0x10'));var Redis=require(_0xe726('0x11'));var authService=require(_0xe726('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe726('0x13'))(_0xe726('0x14'));var utils=require(_0xe726('0x15'));var config=require(_0xe726('0x16'));var licenseUtil=require(_0xe726('0x17'));var db=require(_0xe726('0x18'))['db'];function respondWithStatusCode(_0x2da712,_0x418b11){_0x418b11=_0x418b11||0xcc;return function(_0x4b096e){if(_0x4b096e){return _0x2da712[_0xe726('0x19')](_0x418b11);}return _0x2da712[_0xe726('0x1a')](_0x418b11)[_0xe726('0x1b')]();};}function respondWithResult(_0x1bfcce,_0x4ce692){_0x4ce692=_0x4ce692||0xc8;return function(_0x74d7df){if(_0x74d7df){return _0x1bfcce[_0xe726('0x1a')](_0x4ce692)[_0xe726('0x1c')](_0x74d7df);}};}function respondWithFilteredResult(_0x2dc9dc,_0x1a54a3){return function(_0x1644d1){if(_0x1644d1){var _0x39af50=typeof _0x1a54a3['offset']===_0xe726('0x1d')&&typeof _0x1a54a3[_0xe726('0x1e')]===_0xe726('0x1d');var _0x3c5be0=_0x1644d1[_0xe726('0x1f')];var _0x5bff0d=_0x39af50?0x0:_0x1a54a3[_0xe726('0x20')];var _0x1202a2=_0x39af50?_0x1644d1[_0xe726('0x1f')]:_0x1a54a3[_0xe726('0x20')]+_0x1a54a3[_0xe726('0x1e')];var _0x20742d;if(_0x1202a2>=_0x3c5be0){_0x1202a2=_0x3c5be0;_0x20742d=0xc8;}else{_0x20742d=0xce;}_0x2dc9dc['status'](_0x20742d);return _0x2dc9dc[_0xe726('0x21')](_0xe726('0x22'),_0x5bff0d+'-'+_0x1202a2+'/'+_0x3c5be0)[_0xe726('0x1c')](_0x1644d1);}return null;};}function patchUpdates(_0x1fce4c){return function(_0xe4e7b3){try{jsonpatch[_0xe726('0x23')](_0xe4e7b3,_0x1fce4c,!![]);}catch(_0x29a2a6){return BPromise[_0xe726('0x24')](_0x29a2a6);}return _0xe4e7b3[_0xe726('0x25')]();};}function saveUpdates(_0x314531,_0x55cf32){return function(_0x304b16){if(_0x304b16){return _0x304b16[_0xe726('0x26')](_0x314531)[_0xe726('0x27')](function(_0x5a67d3){return _0x5a67d3;});}return null;};}function removeEntity(_0x3f2e4a,_0x5e5314){return function(_0x222337){if(_0x222337){return _0x222337[_0xe726('0x28')]()[_0xe726('0x27')](function(){_0x3f2e4a[_0xe726('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e6aad,_0x444e7d){return function(_0x2ac054){if(!_0x2ac054){_0x1e6aad[_0xe726('0x19')](0x194);}return _0x2ac054;};}function handleError(_0x31e2b5,_0x50b395){_0x50b395=_0x50b395||0x1f4;return function(_0x1ddeb4){logger[_0xe726('0x29')](_0x1ddeb4[_0xe726('0x2a')]);if(_0x1ddeb4[_0xe726('0x2b')]){delete _0x1ddeb4['name'];}_0x31e2b5[_0xe726('0x1a')](_0x50b395)['send'](_0x1ddeb4);};}exports[_0xe726('0x2c')]=function(_0x46f287,_0x5a7934){var _0x161dd5={},_0x35e0ed={},_0x2781b6={'count':0x0,'rows':[]};var _0x34c03a=_[_0xe726('0x2d')](db[_0xe726('0x2e')][_0xe726('0x2f')],function(_0x246f61){return{'name':_0x246f61[_0xe726('0x30')],'type':_0x246f61[_0xe726('0x31')][_0xe726('0x32')]};});_0x35e0ed[_0xe726('0x33')]=_[_0xe726('0x2d')](_0x34c03a,_0xe726('0x2b'));_0x35e0ed[_0xe726('0x34')]=_[_0xe726('0x35')](_0x46f287[_0xe726('0x34')]);_0x35e0ed[_0xe726('0x36')]=_[_0xe726('0x37')](_0x35e0ed['model'],_0x35e0ed[_0xe726('0x34')]);_0x161dd5[_0xe726('0x38')]=_['intersection'](_0x35e0ed[_0xe726('0x33')],qs[_0xe726('0x39')](_0x46f287[_0xe726('0x34')][_0xe726('0x39')]));_0x161dd5[_0xe726('0x38')]=_0x161dd5[_0xe726('0x38')]['length']?_0x161dd5[_0xe726('0x38')]:_0x35e0ed[_0xe726('0x33')];if(!_0x46f287[_0xe726('0x34')][_0xe726('0x3a')](_0xe726('0x3b'))){_0x161dd5[_0xe726('0x1e')]=qs[_0xe726('0x1e')](_0x46f287[_0xe726('0x34')][_0xe726('0x1e')]);_0x161dd5[_0xe726('0x20')]=qs['offset'](_0x46f287[_0xe726('0x34')][_0xe726('0x20')]);}_0x161dd5[_0xe726('0x3c')]=qs[_0xe726('0x3d')](_0x46f287[_0xe726('0x34')][_0xe726('0x3d')]);_0x161dd5[_0xe726('0x3e')]=qs['filters'](_['pick'](_0x46f287[_0xe726('0x34')],_0x35e0ed[_0xe726('0x36')]),_0x34c03a);if(_0x46f287[_0xe726('0x34')]['filter']){_0x161dd5[_0xe726('0x3e')]=_[_0xe726('0x3f')](_0x161dd5[_0xe726('0x3e')],{'$or':_[_0xe726('0x2d')](_0x34c03a,function(_0x41cd5e){if(_0x41cd5e[_0xe726('0x31')]!==_0xe726('0x40')){var _0x470143={};_0x470143[_0x41cd5e['name']]={'$like':'%'+_0x46f287['query'][_0xe726('0x41')]+'%'};return _0x470143;}})});}_0x161dd5=_['merge']({},_0x161dd5,_0x46f287['options']);var _0xdea4b5={'where':_0x161dd5[_0xe726('0x3e')]};return db['ZendeskField'][_0xe726('0x1f')](_0xdea4b5)[_0xe726('0x27')](function(_0x35348e){_0x2781b6[_0xe726('0x1f')]=_0x35348e;if(_0x46f287['query'][_0xe726('0x42')]){_0x161dd5[_0xe726('0x43')]=[{'all':!![]}];}return db[_0xe726('0x2e')][_0xe726('0x44')](_0x161dd5);})[_0xe726('0x27')](function(_0xa3fae7){_0x2781b6['rows']=_0xa3fae7;return _0x2781b6;})['then'](respondWithFilteredResult(_0x5a7934,_0x161dd5))['catch'](handleError(_0x5a7934,null));};exports['show']=function(_0x56d5c9,_0x44f2c2){var _0x47f8de={'raw':!![],'where':{'id':_0x56d5c9['params']['id']}},_0x2a1d32={};_0x2a1d32['model']=_['keys'](db[_0xe726('0x2e')][_0xe726('0x2f')]);_0x2a1d32[_0xe726('0x34')]=_[_0xe726('0x35')](_0x56d5c9[_0xe726('0x34')]);_0x2a1d32['filters']=_[_0xe726('0x37')](_0x2a1d32[_0xe726('0x33')],_0x2a1d32[_0xe726('0x34')]);_0x47f8de[_0xe726('0x38')]=_['intersection'](_0x2a1d32[_0xe726('0x33')],qs['fields'](_0x56d5c9[_0xe726('0x34')][_0xe726('0x39')]));_0x47f8de['attributes']=_0x47f8de[_0xe726('0x38')][_0xe726('0x45')]?_0x47f8de[_0xe726('0x38')]:_0x2a1d32[_0xe726('0x33')];if(_0x56d5c9[_0xe726('0x34')][_0xe726('0x42')]){_0x47f8de[_0xe726('0x43')]=[{'all':!![]}];}_0x47f8de=_['merge']({},_0x47f8de,_0x56d5c9[_0xe726('0x46')]);return db[_0xe726('0x2e')][_0xe726('0x47')](_0x47f8de)['then'](handleEntityNotFound(_0x44f2c2,null))[_0xe726('0x27')](respondWithResult(_0x44f2c2,null))['catch'](handleError(_0x44f2c2,null));};exports[_0xe726('0x48')]=function(_0x29bac4,_0xf57734){return db[_0xe726('0x2e')]['create'](_0x29bac4[_0xe726('0x49')],{})['then'](respondWithResult(_0xf57734,0xc9))[_0xe726('0x4a')](handleError(_0xf57734,null));};exports[_0xe726('0x26')]=function(_0x4f7ea4,_0x4bcb7e){if(_0x4f7ea4[_0xe726('0x49')]['id']){delete _0x4f7ea4['body']['id'];}return db['ZendeskField'][_0xe726('0x47')]({'where':{'id':_0x4f7ea4['params']['id']}})[_0xe726('0x27')](handleEntityNotFound(_0x4bcb7e,null))['then'](saveUpdates(_0x4f7ea4[_0xe726('0x49')],null))['then'](respondWithResult(_0x4bcb7e,null))[_0xe726('0x4a')](handleError(_0x4bcb7e,null));};exports[_0xe726('0x28')]=function(_0x5dac19,_0x5289f2){return db[_0xe726('0x2e')][_0xe726('0x47')]({'where':{'id':_0x5dac19[_0xe726('0x4b')]['id']}})[_0xe726('0x27')](handleEntityNotFound(_0x5289f2,null))[_0xe726('0x27')](removeEntity(_0x5289f2,null))[_0xe726('0x4a')](handleError(_0x5289f2,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index b01c0c1..5ff1f05 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 _0x1cba=['./intZendeskField.attributes','exports','define','int_zendesk_fields','idField','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment'];(function(_0x2a41dd,_0x1bfba8){var _0x262b42=function(_0x4fab2d){while(--_0x4fab2d){_0x2a41dd['push'](_0x2a41dd['shift']());}};_0x262b42(++_0x1bfba8);}(_0x1cba,0x1f3));var _0xa1cb=function(_0x224fd6,_0x58bb26){_0x224fd6=_0x224fd6-0x0;var _0xa56932=_0x1cba[_0x224fd6];return _0xa56932;};'use strict';var _=require(_0xa1cb('0x0'));var util=require(_0xa1cb('0x1'));var logger=require(_0xa1cb('0x2'))(_0xa1cb('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa1cb('0x4'));var fs=require('fs');var path=require(_0xa1cb('0x5'));var rimraf=require(_0xa1cb('0x6'));var config=require(_0xa1cb('0x7'));var attributes=require(_0xa1cb('0x8'));module[_0xa1cb('0x9')]=function(_0x48d9de,_0x2ff056){return _0x48d9de[_0xa1cb('0xa')]('ZendeskField',attributes,{'tableName':_0xa1cb('0xb'),'paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':[_0xa1cb('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc57a=['util','api','moment','bluebird','rimraf','../../config/environment','./intZendeskField.attributes','define','ZendeskField','int_zendesk_fields','zendesk_unique_index','idField','lodash'];(function(_0x3b5e9f,_0x29601e){var _0x1e9a49=function(_0x31cf02){while(--_0x31cf02){_0x3b5e9f['push'](_0x3b5e9f['shift']());}};_0x1e9a49(++_0x29601e);}(_0xc57a,0x81));var _0xac57=function(_0x251895,_0x414adb){_0x251895=_0x251895-0x0;var _0x70b2dd=_0xc57a[_0x251895];return _0x70b2dd;};'use strict';var _=require(_0xac57('0x0'));var util=require(_0xac57('0x1'));var logger=require('../../config/logger')(_0xac57('0x2'));var moment=require(_0xac57('0x3'));var BPromise=require(_0xac57('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xac57('0x5'));var config=require(_0xac57('0x6'));var attributes=require(_0xac57('0x7'));module['exports']=function(_0x327ed6,_0x306934){return _0x327ed6[_0xac57('0x8')](_0xac57('0x9'),attributes,{'tableName':_0xac57('0xa'),'paranoid':![],'indexes':[{'name':_0xac57('0xb'),'fields':[_0xac57('0xc'),'FieldId'],'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 a11664c..332e617 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 _0x5ac9=['moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http','then','info','debug','request\x20sent','stringify','error','message','ZendeskField,\x20%s,\x20%s','catch','lodash'];(function(_0x431fc5,_0x45baf6){var _0x10ff01=function(_0x42786e){while(--_0x42786e){_0x431fc5['push'](_0x431fc5['shift']());}};_0x10ff01(++_0x45baf6);}(_0x5ac9,0x164));var _0x95ac=function(_0x39d4ab,_0x4b013b){_0x39d4ab=_0x39d4ab-0x0;var _0x3c6bb4=_0x5ac9[_0x39d4ab];return _0x3c6bb4;};'use strict';var _=require(_0x95ac('0x0'));var util=require('util');var moment=require(_0x95ac('0x1'));var BPromise=require('bluebird');var rs=require(_0x95ac('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x95ac('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x95ac('0x4'))(_0x95ac('0x5'));var config=require(_0x95ac('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x95ac('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5cb314,_0x5dcb1a,_0x48aea1){return new BPromise(function(_0x355b0,_0x4b53ed){return client['request'](_0x5cb314,_0x48aea1)[_0x95ac('0x8')](function(_0x116d5d){logger[_0x95ac('0x9')]('ZendeskField,\x20%s,\x20%s',_0x5dcb1a,'request\x20sent');logger[_0x95ac('0xa')]('ZendeskField,\x20%s,\x20%s,\x20%s',_0x5dcb1a,_0x95ac('0xb'),JSON[_0x95ac('0xc')](_0x116d5d));if(_0x116d5d[_0x95ac('0xd')]){if(_0x116d5d['error']['code']===0x1f4){logger['error']('ZendeskField,\x20%s,\x20%s',_0x5dcb1a,_0x116d5d['error'][_0x95ac('0xe')]);return _0x4b53ed(_0x116d5d[_0x95ac('0xd')][_0x95ac('0xe')]);}logger[_0x95ac('0xd')](_0x95ac('0xf'),_0x5dcb1a,_0x116d5d['error'][_0x95ac('0xe')]);return _0x355b0(_0x116d5d[_0x95ac('0xd')][_0x95ac('0xe')]);}else{logger[_0x95ac('0x9')](_0x95ac('0xf'),_0x5dcb1a,'request\x20sent');_0x355b0(_0x116d5d['result'][_0x95ac('0xe')]);}})[_0x95ac('0x10')](function(_0x2b981e){logger[_0x95ac('0xd')]('ZendeskField,\x20%s,\x20%s',_0x5dcb1a,_0x2b981e);_0x4b53ed(_0x2b981e);});});} \ No newline at end of file +var _0x4ed1=['moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util'];(function(_0x3a7a1d,_0xf0a687){var _0x2b5fe0=function(_0x47ba52){while(--_0x47ba52){_0x3a7a1d['push'](_0x3a7a1d['shift']());}};_0x2b5fe0(++_0xf0a687);}(_0x4ed1,0x16f));var _0x14ed=function(_0x40b6ea,_0xe65162){_0x40b6ea=_0x40b6ea-0x0;var _0x40a588=_0x4ed1[_0x40b6ea];return _0x40a588;};'use strict';var _=require('lodash');var util=require(_0x14ed('0x0'));var moment=require(_0x14ed('0x1'));var BPromise=require(_0x14ed('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x14ed('0x3'))['db'];var utils=require(_0x14ed('0x4'));var logger=require(_0x14ed('0x5'))(_0x14ed('0x6'));var config=require(_0x14ed('0x7'));var jayson=require(_0x14ed('0x8'));var client=jayson[_0x14ed('0x9')][_0x14ed('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x167a0f,_0x3b6d7c,_0x1569b6){return new BPromise(function(_0x4302d6,_0x2e35dc){return client[_0x14ed('0xb')](_0x167a0f,_0x1569b6)['then'](function(_0x468a31){logger[_0x14ed('0xc')](_0x14ed('0xd'),_0x3b6d7c,_0x14ed('0xe'));logger[_0x14ed('0xf')](_0x14ed('0x10'),_0x3b6d7c,_0x14ed('0xe'),JSON[_0x14ed('0x11')](_0x468a31));if(_0x468a31[_0x14ed('0x12')]){if(_0x468a31[_0x14ed('0x12')][_0x14ed('0x13')]===0x1f4){logger[_0x14ed('0x12')]('ZendeskField,\x20%s,\x20%s',_0x3b6d7c,_0x468a31[_0x14ed('0x12')][_0x14ed('0x14')]);return _0x2e35dc(_0x468a31[_0x14ed('0x12')][_0x14ed('0x14')]);}logger[_0x14ed('0x12')](_0x14ed('0xd'),_0x3b6d7c,_0x468a31[_0x14ed('0x12')]['message']);return _0x4302d6(_0x468a31[_0x14ed('0x12')][_0x14ed('0x14')]);}else{logger[_0x14ed('0xc')](_0x14ed('0xd'),_0x3b6d7c,'request\x20sent');_0x4302d6(_0x468a31[_0x14ed('0x15')][_0x14ed('0x14')]);}})[_0x14ed('0x16')](function(_0x4f4b16){logger[_0x14ed('0x12')]('ZendeskField,\x20%s,\x20%s',_0x3b6d7c,_0x4f4b16);_0x2e35dc(_0x4f4b16);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 9d41a99..ec43242 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 _0x46cf=['addConfiguration','put','delete','exports','multer','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','getConfigurations','getFields','post','create','/:id/configurations'];(function(_0x3349e4,_0x6f2e1b){var _0x9f19a0=function(_0xb6642d){while(--_0xb6642d){_0x3349e4['push'](_0x3349e4['shift']());}};_0x9f19a0(++_0x6f2e1b);}(_0x46cf,0x115));var _0xf46c=function(_0x88cd7b,_0x4c884c){_0x88cd7b=_0x88cd7b-0x0;var _0x56fcc8=_0x46cf[_0x88cd7b];return _0x56fcc8;};'use strict';var multer=require(_0xf46c('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xf46c('0x1'));var router=express[_0xf46c('0x2')]();var fs_extra=require(_0xf46c('0x3'));var auth=require(_0xf46c('0x4'));var interaction=require(_0xf46c('0x5'));var config=require(_0xf46c('0x6'));var controller=require('./intZohoAccount.controller');router[_0xf46c('0x7')]('/',auth[_0xf46c('0x8')](),controller[_0xf46c('0x9')]);router['get'](_0xf46c('0xa'),auth[_0xf46c('0x8')](),controller[_0xf46c('0xb')]);router[_0xf46c('0x7')]('/:id/configurations',auth[_0xf46c('0x8')](),controller[_0xf46c('0xc')]);router[_0xf46c('0x7')]('/:id/fields',auth[_0xf46c('0x8')](),controller[_0xf46c('0xd')]);router[_0xf46c('0xe')]('/',auth[_0xf46c('0x8')](),controller[_0xf46c('0xf')]);router[_0xf46c('0xe')](_0xf46c('0x10'),auth[_0xf46c('0x8')](),controller[_0xf46c('0x11')]);router[_0xf46c('0x12')](_0xf46c('0xa'),auth[_0xf46c('0x8')](),controller['update']);router[_0xf46c('0x13')](_0xf46c('0xa'),auth[_0xf46c('0x8')](),controller['destroy']);module[_0xf46c('0x14')]=router; \ No newline at end of file +var _0x9004=['getConfigurations','/:id/fields','getFields','post','create','addConfiguration','/:id','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intZohoAccount.controller','isAuthenticated','index','get','show','/:id/configurations'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x9004,0x6a));var _0x4900=function(_0x4bba05,_0x4e8e67){_0x4bba05=_0x4bba05-0x0;var _0x100b05=_0x9004[_0x4bba05];return _0x100b05;};'use strict';var multer=require(_0x4900('0x0'));var util=require(_0x4900('0x1'));var path=require('path');var timeout=require(_0x4900('0x2'));var express=require(_0x4900('0x3'));var router=express[_0x4900('0x4')]();var fs_extra=require(_0x4900('0x5'));var auth=require(_0x4900('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x4900('0x7'));var controller=require(_0x4900('0x8'));router['get']('/',auth[_0x4900('0x9')](),controller[_0x4900('0xa')]);router[_0x4900('0xb')]('/:id',auth[_0x4900('0x9')](),controller[_0x4900('0xc')]);router[_0x4900('0xb')](_0x4900('0xd'),auth[_0x4900('0x9')](),controller[_0x4900('0xe')]);router[_0x4900('0xb')](_0x4900('0xf'),auth[_0x4900('0x9')](),controller[_0x4900('0x10')]);router[_0x4900('0x11')]('/',auth[_0x4900('0x9')](),controller[_0x4900('0x12')]);router[_0x4900('0x11')](_0x4900('0xd'),auth[_0x4900('0x9')](),controller[_0x4900('0x13')]);router['put'](_0x4900('0x14'),auth[_0x4900('0x9')](),controller['update']);router[_0x4900('0x15')](_0x4900('0x14'),auth['isAuthenticated'](),controller[_0x4900('0x16')]);module[_0x4900('0x17')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index f833b4d..b04193a 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 _0x22fb=['STRING'];(function(_0xfbc744,_0x27a1dd){var _0x1dd4b7=function(_0x1ba781){while(--_0x1ba781){_0xfbc744['push'](_0xfbc744['shift']());}};_0x1dd4b7(++_0x27a1dd);}(_0x22fb,0x192));var _0xb22f=function(_0x35f8a2,_0x5be980){_0x35f8a2=_0x35f8a2-0x0;var _0xb886f6=_0x22fb[_0x35f8a2];return _0xb886f6;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xb22f('0x0')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xb22f('0x0')]},'zone':{'type':Sequelize[_0xb22f('0x0')]},'clientId':{'type':Sequelize[_0xb22f('0x0')]},'clientSecret':{'type':Sequelize[_0xb22f('0x0')]},'serverUrl':{'type':Sequelize[_0xb22f('0x0')],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0xb22f('0x0')]}}; \ No newline at end of file +var _0x91a7=['STRING','exports'];(function(_0x442f5b,_0x39d79d){var _0x19fd96=function(_0x419b3f){while(--_0x419b3f){_0x442f5b['push'](_0x442f5b['shift']());}};_0x19fd96(++_0x39d79d);}(_0x91a7,0xe7));var _0x791a=function(_0x32f145,_0xf6a2ae){_0x32f145=_0x32f145-0x0;var _0xe274ba=_0x91a7[_0x32f145];return _0xe274ba;};'use strict';var Sequelize=require('sequelize');module[_0x791a('0x0')]={'name':{'type':Sequelize[_0x791a('0x1')]},'description':{'type':Sequelize[_0x791a('0x1')]},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0x791a('0x1')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x791a('0x1')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0x791a('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 1b91d78..35537f1 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 _0xdd94=['Calls','Zoho-oauthtoken\x20','response','Owner','Subject','Description','WhoId','Call_Result','Call_Type','includes','api_name','system_mandatory','push','display_label','custom_field','pick_list_values','test','stringify','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','send','index','map','ZohoAccount','rawAttributes','type','key','model','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','filter','merge','include','findAll','show','params','keys','options','find','create','catch','body','getConfigurations','pick','hasOwnProperty','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZohoConfiguration','ZohoField','zone','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.com.cn','POST','/oauth/v2/token','clientId','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','clientSecret','code','refreshToken','zoho.eu','com','serverUrl','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields'];(function(_0x16855d,_0x38f8b8){var _0xc4b447=function(_0x59a8f7){while(--_0x59a8f7){_0x16855d['push'](_0x16855d['shift']());}};_0xc4b447(++_0x38f8b8);}(_0xdd94,0x95));var _0x4dd9=function(_0x1eff2a,_0x50ee28){_0x1eff2a=_0x1eff2a-0x0;var _0x3d9be1=_0xdd94[_0x1eff2a];return _0x3d9be1;};'use strict';var emlformat=require(_0x4dd9('0x0'));var rimraf=require(_0x4dd9('0x1'));var zipdir=require(_0x4dd9('0x2'));var jsonpatch=require(_0x4dd9('0x3'));var rp=require(_0x4dd9('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x4dd9('0x5'));var sox=require(_0x4dd9('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4dd9('0x7'));var _=require(_0x4dd9('0x8'));var squel=require(_0x4dd9('0x9'));var crypto=require(_0x4dd9('0xa'));var jsforce=require(_0x4dd9('0xb'));var deskjs=require(_0x4dd9('0xc'));var toCsv=require(_0x4dd9('0xd'));var querystring=require(_0x4dd9('0xe'));var Papa=require(_0x4dd9('0xf'));var Redis=require(_0x4dd9('0x10'));var authService=require(_0x4dd9('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x4dd9('0x12'));var hardwareService=require(_0x4dd9('0x13'));var logger=require('../../config/logger')(_0x4dd9('0x14'));var utils=require(_0x4dd9('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x4dd9('0x16'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x7ee106,_0x5294f0){_0x5294f0=_0x5294f0||0xcc;return function(_0x5a36be){if(_0x5a36be){return _0x7ee106[_0x4dd9('0x17')](_0x5294f0);}return _0x7ee106[_0x4dd9('0x18')](_0x5294f0)['end']();};}function respondWithResult(_0x1ebb15,_0x277818){_0x277818=_0x277818||0xc8;return function(_0x253628){if(_0x253628){return _0x1ebb15[_0x4dd9('0x18')](_0x277818)[_0x4dd9('0x19')](_0x253628);}};}function respondWithFilteredResult(_0x2fe41d,_0xb5a12d){return function(_0xb26387){if(_0xb26387){var _0x2443ea=typeof _0xb5a12d[_0x4dd9('0x1a')]===_0x4dd9('0x1b')&&typeof _0xb5a12d[_0x4dd9('0x1c')]===_0x4dd9('0x1b');var _0x431b78=_0xb26387[_0x4dd9('0x1d')];var _0x1cd15f=_0x2443ea?0x0:_0xb5a12d[_0x4dd9('0x1a')];var _0xd88477=_0x2443ea?_0xb26387[_0x4dd9('0x1d')]:_0xb5a12d[_0x4dd9('0x1a')]+_0xb5a12d['limit'];var _0xca7313;if(_0xd88477>=_0x431b78){_0xd88477=_0x431b78;_0xca7313=0xc8;}else{_0xca7313=0xce;}_0x2fe41d[_0x4dd9('0x18')](_0xca7313);return _0x2fe41d[_0x4dd9('0x1e')](_0x4dd9('0x1f'),_0x1cd15f+'-'+_0xd88477+'/'+_0x431b78)['json'](_0xb26387);}return null;};}function patchUpdates(_0x38eff1){return function(_0x83cbd2){try{jsonpatch[_0x4dd9('0x20')](_0x83cbd2,_0x38eff1,!![]);}catch(_0xa1b5d5){return BPromise[_0x4dd9('0x21')](_0xa1b5d5);}return _0x83cbd2['save']();};}function saveUpdates(_0x3b850a,_0x18522c){return function(_0x1a88f9){if(_0x1a88f9){return _0x1a88f9[_0x4dd9('0x22')](_0x3b850a)[_0x4dd9('0x23')](function(_0x21b3c9){return _0x21b3c9;});}return null;};}function removeEntity(_0x4665f9,_0xdcb60c){return function(_0x133b02){if(_0x133b02){return _0x133b02[_0x4dd9('0x24')]()['then'](function(){_0x4665f9[_0x4dd9('0x18')](0xcc)[_0x4dd9('0x25')]();});}};}function handleEntityNotFound(_0x23b0b7,_0x264ac6){return function(_0xc04f02){if(!_0xc04f02){_0x23b0b7[_0x4dd9('0x17')](0x194);}return _0xc04f02;};}function handleError(_0x373904,_0x11e4f4){_0x11e4f4=_0x11e4f4||0x1f4;return function(_0x19cd0c){logger[_0x4dd9('0x26')](_0x19cd0c[_0x4dd9('0x27')]);if(_0x19cd0c['name']){delete _0x19cd0c[_0x4dd9('0x28')];}_0x373904['status'](_0x11e4f4)[_0x4dd9('0x29')](_0x19cd0c);};}exports[_0x4dd9('0x2a')]=function(_0x1ddfbd,_0x40c1cd){var _0x301d82={},_0xbcc2eb={},_0x32389e={'count':0x0,'rows':[]};var _0x224c35=_[_0x4dd9('0x2b')](db[_0x4dd9('0x2c')][_0x4dd9('0x2d')],function(_0x225b7f){return{'name':_0x225b7f['fieldName'],'type':_0x225b7f[_0x4dd9('0x2e')][_0x4dd9('0x2f')]};});_0xbcc2eb[_0x4dd9('0x30')]=_[_0x4dd9('0x2b')](_0x224c35,'name');_0xbcc2eb[_0x4dd9('0x31')]=_['keys'](_0x1ddfbd['query']);_0xbcc2eb[_0x4dd9('0x32')]=_[_0x4dd9('0x33')](_0xbcc2eb['model'],_0xbcc2eb[_0x4dd9('0x31')]);_0x301d82['attributes']=_['intersection'](_0xbcc2eb['model'],qs[_0x4dd9('0x34')](_0x1ddfbd['query'][_0x4dd9('0x34')]));_0x301d82[_0x4dd9('0x35')]=_0x301d82[_0x4dd9('0x35')][_0x4dd9('0x36')]?_0x301d82['attributes']:_0xbcc2eb['model'];if(!_0x1ddfbd[_0x4dd9('0x31')]['hasOwnProperty'](_0x4dd9('0x37'))){_0x301d82[_0x4dd9('0x1c')]=qs['limit'](_0x1ddfbd[_0x4dd9('0x31')][_0x4dd9('0x1c')]);_0x301d82['offset']=qs['offset'](_0x1ddfbd[_0x4dd9('0x31')][_0x4dd9('0x1a')]);}_0x301d82[_0x4dd9('0x38')]=qs[_0x4dd9('0x39')](_0x1ddfbd[_0x4dd9('0x31')][_0x4dd9('0x39')]);_0x301d82[_0x4dd9('0x3a')]=qs[_0x4dd9('0x32')](_['pick'](_0x1ddfbd[_0x4dd9('0x31')],_0xbcc2eb[_0x4dd9('0x32')]),_0x224c35);if(_0x1ddfbd[_0x4dd9('0x31')]['filter']){_0x301d82[_0x4dd9('0x3a')]=_['merge'](_0x301d82['where'],{'$or':_[_0x4dd9('0x2b')](_0x224c35,function(_0x290df6){if(_0x290df6[_0x4dd9('0x2e')]!=='VIRTUAL'){var _0x35103c={};_0x35103c[_0x290df6[_0x4dd9('0x28')]]={'$like':'%'+_0x1ddfbd[_0x4dd9('0x31')][_0x4dd9('0x3b')]+'%'};return _0x35103c;}})});}_0x301d82=_[_0x4dd9('0x3c')]({},_0x301d82,_0x1ddfbd['options']);var _0x1dda70={'where':_0x301d82[_0x4dd9('0x3a')]};return db['ZohoAccount'][_0x4dd9('0x1d')](_0x1dda70)[_0x4dd9('0x23')](function(_0x12d226){_0x32389e['count']=_0x12d226;if(_0x1ddfbd[_0x4dd9('0x31')]['includeAll']){_0x301d82[_0x4dd9('0x3d')]=[{'all':!![]}];}return db[_0x4dd9('0x2c')][_0x4dd9('0x3e')](_0x301d82);})[_0x4dd9('0x23')](function(_0x5969fe){_0x32389e['rows']=_0x5969fe;return _0x32389e;})[_0x4dd9('0x23')](respondWithFilteredResult(_0x40c1cd,_0x301d82))['catch'](handleError(_0x40c1cd,null));};exports[_0x4dd9('0x3f')]=function(_0x389826,_0x569464){var _0x2989a0={'raw':![],'where':{'id':_0x389826[_0x4dd9('0x40')]['id']}},_0x2685cb={};_0x2685cb[_0x4dd9('0x30')]=_[_0x4dd9('0x41')](db[_0x4dd9('0x2c')]['rawAttributes']);_0x2685cb[_0x4dd9('0x31')]=_[_0x4dd9('0x41')](_0x389826[_0x4dd9('0x31')]);_0x2685cb[_0x4dd9('0x32')]=_[_0x4dd9('0x33')](_0x2685cb[_0x4dd9('0x30')],_0x2685cb['query']);_0x2989a0[_0x4dd9('0x35')]=_[_0x4dd9('0x33')](_0x2685cb[_0x4dd9('0x30')],qs[_0x4dd9('0x34')](_0x389826['query']['fields']));_0x2989a0[_0x4dd9('0x35')]=_0x2989a0[_0x4dd9('0x35')][_0x4dd9('0x36')]?_0x2989a0['attributes']:_0x2685cb[_0x4dd9('0x30')];if(_0x389826[_0x4dd9('0x31')]['includeAll']){_0x2989a0[_0x4dd9('0x3d')]=[{'all':!![]}];}_0x2989a0=_[_0x4dd9('0x3c')]({},_0x2989a0,_0x389826[_0x4dd9('0x42')]);return db[_0x4dd9('0x2c')][_0x4dd9('0x43')](_0x2989a0)['then'](handleEntityNotFound(_0x569464,null))[_0x4dd9('0x23')](respondWithResult(_0x569464,null))['catch'](handleError(_0x569464,null));};exports['create']=function(_0x7c30c0,_0x15e052){return db['ZohoAccount'][_0x4dd9('0x44')](_0x7c30c0['body'],{})[_0x4dd9('0x23')](respondWithResult(_0x15e052,0xc9))[_0x4dd9('0x45')](handleError(_0x15e052,null));};exports[_0x4dd9('0x22')]=function(_0x2c4a21,_0x222b2e){if(_0x2c4a21[_0x4dd9('0x46')]['id']){delete _0x2c4a21[_0x4dd9('0x46')]['id'];}return db[_0x4dd9('0x2c')][_0x4dd9('0x43')]({'where':{'id':_0x2c4a21[_0x4dd9('0x40')]['id']}})[_0x4dd9('0x23')](handleEntityNotFound(_0x222b2e,null))[_0x4dd9('0x23')](saveUpdates(_0x2c4a21[_0x4dd9('0x46')],null))['then'](respondWithResult(_0x222b2e,null))[_0x4dd9('0x45')](handleError(_0x222b2e,null));};exports[_0x4dd9('0x24')]=function(_0x4155ff,_0xf004f4){return db[_0x4dd9('0x2c')]['find']({'where':{'id':_0x4155ff[_0x4dd9('0x40')]['id']}})[_0x4dd9('0x23')](handleEntityNotFound(_0xf004f4,null))[_0x4dd9('0x23')](removeEntity(_0xf004f4,null))[_0x4dd9('0x45')](handleError(_0xf004f4,null));};exports[_0x4dd9('0x47')]=function(_0x50902f,_0xf6d9d9,_0x3b31bc){var _0x5f2178={};var _0x1852e2={};var _0x4c026b;var _0x2029d7;return db[_0x4dd9('0x2c')]['findOne']({'where':{'id':_0x50902f['params']['id']}})['then'](handleEntityNotFound(_0xf6d9d9,null))[_0x4dd9('0x23')](function(_0x1d3b12){if(_0x1d3b12){_0x4c026b=_0x1d3b12;_0x1852e2[_0x4dd9('0x30')]=_[_0x4dd9('0x41')](db['ZohoConfiguration']['rawAttributes']);_0x1852e2[_0x4dd9('0x31')]=_[_0x4dd9('0x41')](_0x50902f['query']);_0x1852e2['filters']=_[_0x4dd9('0x33')](_0x1852e2[_0x4dd9('0x30')],_0x1852e2[_0x4dd9('0x31')]);_0x5f2178[_0x4dd9('0x35')]=_[_0x4dd9('0x33')](_0x1852e2[_0x4dd9('0x30')],qs['fields'](_0x50902f[_0x4dd9('0x31')][_0x4dd9('0x34')]));_0x5f2178[_0x4dd9('0x35')]=_0x5f2178[_0x4dd9('0x35')][_0x4dd9('0x36')]?_0x5f2178[_0x4dd9('0x35')]:_0x1852e2[_0x4dd9('0x30')];_0x5f2178[_0x4dd9('0x38')]=qs[_0x4dd9('0x39')](_0x50902f[_0x4dd9('0x31')]['sort']);_0x5f2178[_0x4dd9('0x3a')]=qs[_0x4dd9('0x32')](_[_0x4dd9('0x48')](_0x50902f[_0x4dd9('0x31')],_0x1852e2[_0x4dd9('0x32')]));if(_0x50902f[_0x4dd9('0x31')][_0x4dd9('0x3b')]){_0x5f2178[_0x4dd9('0x3a')]=_['merge'](_0x5f2178[_0x4dd9('0x3a')],{'$or':_[_0x4dd9('0x2b')](_0x5f2178['attributes'],function(_0x3a0f2a){var _0x594b08={};_0x594b08[_0x3a0f2a]={'$like':'%'+_0x50902f[_0x4dd9('0x31')][_0x4dd9('0x3b')]+'%'};return _0x594b08;})});}_0x5f2178=_[_0x4dd9('0x3c')]({},_0x5f2178,_0x50902f[_0x4dd9('0x42')]);return _0x4c026b[_0x4dd9('0x47')](_0x5f2178);}})[_0x4dd9('0x23')](function(_0x19e81e){if(_0x19e81e){_0x2029d7=_0x19e81e[_0x4dd9('0x36')];if(!_0x50902f[_0x4dd9('0x31')][_0x4dd9('0x49')](_0x4dd9('0x37'))){_0x5f2178[_0x4dd9('0x1c')]=qs[_0x4dd9('0x1c')](_0x50902f[_0x4dd9('0x31')][_0x4dd9('0x1c')]);_0x5f2178[_0x4dd9('0x1a')]=qs[_0x4dd9('0x1a')](_0x50902f['query'][_0x4dd9('0x1a')]);}return _0x4c026b[_0x4dd9('0x47')](_0x5f2178);}})[_0x4dd9('0x23')](function(_0x3cf180){if(_0x3cf180){return _0x3cf180?{'count':_0x2029d7,'rows':_0x3cf180}:null;}})[_0x4dd9('0x23')](respondWithResult(_0xf6d9d9,null))['catch'](handleError(_0xf6d9d9,null));};exports[_0x4dd9('0x4a')]=function(_0x3010f5,_0x37f8ee,_0x3a77ce){if(_0x3010f5[_0x4dd9('0x46')]['id']){delete _0x3010f5[_0x4dd9('0x46')]['id'];}return db['ZohoAccount'][_0x4dd9('0x4b')]({'where':{'id':_0x3010f5[_0x4dd9('0x40')]['id']}})[_0x4dd9('0x23')](handleEntityNotFound(_0x37f8ee,null))['then'](function(_0x41ba99){if(_0x41ba99){_0x3010f5[_0x4dd9('0x46')][_0x4dd9('0x4c')]=_0x41ba99['id'];_0x3010f5[_0x4dd9('0x46')][_0x4dd9('0x4d')]=integrations[_0x4dd9('0x4e')](_0x3010f5[_0x4dd9('0x46')][_0x4dd9('0x4f')],_0x3010f5[_0x4dd9('0x46')]['type']);_0x3010f5[_0x4dd9('0x46')][_0x4dd9('0x50')]=integrations[_0x4dd9('0x51')](_0x3010f5[_0x4dd9('0x46')][_0x4dd9('0x4f')],_0x3010f5[_0x4dd9('0x46')]['type']);return db[_0x4dd9('0x52')][_0x4dd9('0x44')](_0x3010f5[_0x4dd9('0x46')],{'include':[{'model':db[_0x4dd9('0x53')],'as':_0x4dd9('0x4d')},{'model':db[_0x4dd9('0x53')],'as':_0x4dd9('0x50')}]});}return null;})[_0x4dd9('0x23')](respondWithResult(_0x37f8ee,null))[_0x4dd9('0x45')](handleError(_0x37f8ee,null));};function getAccessToken(_0x4d72ad){return new Promise(function(_0x2431b7,_0x107101){var _0x4ce704;switch(_0x4d72ad[_0x4dd9('0x54')]){case'US':_0x4ce704='https://accounts.zoho.com';break;case'AU':_0x4ce704=_0x4dd9('0x55');break;case'EU':_0x4ce704=_0x4dd9('0x56');break;case'IN':_0x4ce704='https://accounts.zoho.in';break;case'CN':_0x4ce704=_0x4dd9('0x57');break;default:_0x4ce704='https://accounts.zoho.eu';break;}var _0x5a039d={'method':_0x4dd9('0x58'),'uri':_0x4ce704+_0x4dd9('0x59'),'qs':{'refresh_token':_0x4d72ad['refreshToken'],'client_id':_0x4d72ad[_0x4dd9('0x5a')],'client_secret':_0x4d72ad['clientSecret'],'grant_type':_0x4dd9('0x5b')},'json':!![]};return rp(_0x5a039d)[_0x4dd9('0x23')](function(_0x51a07d){if(_0x51a07d[_0x4dd9('0x5c')]){_0x2431b7(_0x51a07d[_0x4dd9('0x5c')]);}else{_0x107101(_0x4dd9('0x5d'));}})['catch'](function(_0x56af2d){_0x107101(_0x56af2d);});});}exports[_0x4dd9('0x5e')]=function(_0x149d51,_0x5d92fc,_0x18af4e){var _0x270f0a,_0xf48470,_0x47d6ff,_0x4f8f27,_0x430203;return db[_0x4dd9('0x2c')][_0x4dd9('0x4b')]({'where':{'id':_0x149d51[_0x4dd9('0x40')]['id']},'attributes':['id',_0x4dd9('0x5f'),'zone',_0x4dd9('0x5a'),_0x4dd9('0x60'),'serverUrl',_0x4dd9('0x61'),_0x4dd9('0x62')]})[_0x4dd9('0x23')](handleEntityNotFound(_0x5d92fc,null))[_0x4dd9('0x23')](function(_0x6bd8c5){_0x430203=_0x6bd8c5;_0x270f0a=_0x430203[_0x4dd9('0x5f')];_0xf48470=_0x270f0a===_0x4dd9('0x63')?'eu':_0x4dd9('0x64');_0x47d6ff=_0x430203[_0x4dd9('0x65')];var _0x2e1069=_0x47d6ff[_0x4dd9('0x66')](-0x1);if(_0x2e1069==='/'||_0x2e1069==='\x5c'||_0x2e1069===':'){_0x47d6ff=_0x47d6ff[_0x4dd9('0x67')](0x0,_0x47d6ff[_0x4dd9('0x68')](_0x2e1069));}if(!_0x430203['refreshToken']){throw new Error(_0x4dd9('0x69'));}return getAccessToken(_0x430203);})['then'](function(_0xd8f5dc){if(_0xd8f5dc){return rp({'method':_0x4dd9('0x6a'),'uri':util[_0x4dd9('0x6b')](_0x4dd9('0x6c'),_0xf48470),'qs':{'module':_0x4dd9('0x6d')},'headers':{'Authorization':_0x4dd9('0x6e')+_0xd8f5dc},'json':!![]});}})['then'](function(_0x50b92d){if(_0x50b92d){if(_0x50b92d[_0x4dd9('0x6f')]&&_0x50b92d[_0x4dd9('0x6f')]['error']){throw new Error(_0x50b92d[_0x4dd9('0x6f')]['error']['message']);}var _0x7bc33a=[];var _0x153ecf=[];var _0x284b3c=[_0x4dd9('0x70'),_0x4dd9('0x71'),_0x4dd9('0x72'),_0x4dd9('0x73'),'Call_Duration',_0x4dd9('0x74'),'Call_Start_Time',_0x4dd9('0x75')];_0x153ecf=_['remove'](_0x50b92d[_0x4dd9('0x34')],function(_0x12a77a){return _0x284b3c[_0x4dd9('0x76')](_0x12a77a[_0x4dd9('0x77')]);});for(var _0x149745=0x0;_0x149745<_0x153ecf[_0x4dd9('0x36')];_0x149745++){if(_0x153ecf[_0x149745][_0x4dd9('0x78')]===![]){_0x7bc33a[_0x4dd9('0x79')]({'id':_0x153ecf[_0x149745]['id'],'name':_0x153ecf[_0x149745][_0x4dd9('0x7a')],'custom':_0x153ecf[_0x149745][_0x4dd9('0x7b')],'options':_0x153ecf[_0x149745]['data_type']==='picklist'&&_0x153ecf[_0x149745]['pick_list_values'][_0x4dd9('0x36')]>-0x1?_['map'](_0x153ecf[_0x149745][_0x4dd9('0x7c')],function(_0x181391){return{'name':_0x181391,'value':_0x181391};}):[]});}}return{'count':_0x7bc33a['length'],'rows':_0x7bc33a};}else{return{'count':0x0,'rows':[]};}})[_0x4dd9('0x23')](respondWithResult(_0x5d92fc,null))[_0x4dd9('0x45')](function(_0x36bcce){var _0x58b713=_0x149d51['query'][_0x4dd9('0x7d')]?0x1f4:_0x36bcce['statusCode']||0x1f4;logger[_0x4dd9('0x26')]('getFields,\x20%s,\x20%s,\x20%s',_0x4dd9('0x5e'),_0x58b713,JSON[_0x4dd9('0x7e')](_0x36bcce));delete _0x36bcce[_0x4dd9('0x28')];if(_0x58b713===0x191){_0x58b713=0x190;}_0x5d92fc[_0x4dd9('0x18')](_0x58b713)[_0x4dd9('0x29')](_0x149d51[_0x4dd9('0x31')][_0x4dd9('0x7d')]?{'message':_0x4dd9('0x7f'),'statusCode':_0x36bcce[_0x4dd9('0x80')]}:_0x36bcce);});}; \ No newline at end of file +var _0x342e=['Owner','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Type','remove','push','custom_field','data_type','picklist','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','rimraf','fast-json-patch','request-promise','mustache','path','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','reject','update','then','destroy','error','stack','name','index','map','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','limit','order','sort','filter','where','VIRTUAL','merge','options','ZohoAccount','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','getConfigurations','nolimit','addConfiguration','findOne','getSubjects','getDescriptions','ZohoField','Subjects','Descriptions','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','clientId','clientSecret','serverUrl','code','host','zoho.eu','slice','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','message'];(function(_0x40215a,_0x4b0876){var _0x5eb303=function(_0xa1fce0){while(--_0xa1fce0){_0x40215a['push'](_0x40215a['shift']());}};_0x5eb303(++_0x4b0876);}(_0x342e,0x8d));var _0xe342=function(_0x80d733,_0x266211){_0x80d733=_0x80d733-0x0;var _0x435868=_0x342e[_0x80d733];return _0x435868;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe342('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe342('0x1'));var rp=require(_0xe342('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe342('0x3'));var util=require('util');var path=require(_0xe342('0x4'));var sox=require('sox');var csv=require(_0xe342('0x5'));var ejs=require(_0xe342('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe342('0x7'));var squel=require(_0xe342('0x8'));var crypto=require(_0xe342('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xe342('0x5'));var querystring=require(_0xe342('0xa'));var Papa=require(_0xe342('0xb'));var Redis=require(_0xe342('0xc'));var authService=require(_0xe342('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xe342('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xe342('0xf'));var utils=require(_0xe342('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0xe342('0x11'));var db=require(_0xe342('0x12'))['db'];var integrations=require(_0xe342('0x13'));function respondWithStatusCode(_0xf80e6a,_0x3fc3d5){_0x3fc3d5=_0x3fc3d5||0xcc;return function(_0x125089){if(_0x125089){return _0xf80e6a[_0xe342('0x14')](_0x3fc3d5);}return _0xf80e6a[_0xe342('0x15')](_0x3fc3d5)[_0xe342('0x16')]();};}function respondWithResult(_0x4b3b2d,_0x3d1c77){_0x3d1c77=_0x3d1c77||0xc8;return function(_0x165a01){if(_0x165a01){return _0x4b3b2d[_0xe342('0x15')](_0x3d1c77)[_0xe342('0x17')](_0x165a01);}};}function respondWithFilteredResult(_0x3d960c,_0x456718){return function(_0x2af9f0){if(_0x2af9f0){var _0x4aada5=typeof _0x456718[_0xe342('0x18')]===_0xe342('0x19')&&typeof _0x456718['limit']==='undefined';var _0x28da83=_0x2af9f0['count'];var _0x4b14f1=_0x4aada5?0x0:_0x456718[_0xe342('0x18')];var _0x280805=_0x4aada5?_0x2af9f0[_0xe342('0x1a')]:_0x456718['offset']+_0x456718['limit'];var _0x492897;if(_0x280805>=_0x28da83){_0x280805=_0x28da83;_0x492897=0xc8;}else{_0x492897=0xce;}_0x3d960c['status'](_0x492897);return _0x3d960c[_0xe342('0x1b')](_0xe342('0x1c'),_0x4b14f1+'-'+_0x280805+'/'+_0x28da83)['json'](_0x2af9f0);}return null;};}function patchUpdates(_0x54c5d8){return function(_0x2574cc){try{jsonpatch['apply'](_0x2574cc,_0x54c5d8,!![]);}catch(_0x16b4e6){return BPromise[_0xe342('0x1d')](_0x16b4e6);}return _0x2574cc['save']();};}function saveUpdates(_0x32d47b,_0x5e34ab){return function(_0x14ef34){if(_0x14ef34){return _0x14ef34[_0xe342('0x1e')](_0x32d47b)[_0xe342('0x1f')](function(_0x27ae70){return _0x27ae70;});}return null;};}function removeEntity(_0x186a72,_0x2c72cf){return function(_0x2d7bc3){if(_0x2d7bc3){return _0x2d7bc3[_0xe342('0x20')]()[_0xe342('0x1f')](function(){_0x186a72['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f762f,_0x2d7cc8){return function(_0x55fde1){if(!_0x55fde1){_0x3f762f['sendStatus'](0x194);}return _0x55fde1;};}function handleError(_0x523bfc,_0x90debb){_0x90debb=_0x90debb||0x1f4;return function(_0x19945d){logger[_0xe342('0x21')](_0x19945d[_0xe342('0x22')]);if(_0x19945d[_0xe342('0x23')]){delete _0x19945d['name'];}_0x523bfc[_0xe342('0x15')](_0x90debb)['send'](_0x19945d);};}exports[_0xe342('0x24')]=function(_0x199c2b,_0x2ae55c){var _0x57f00a={},_0x17f87b={},_0x4306f2={'count':0x0,'rows':[]};var _0x3284a2=_[_0xe342('0x25')](db['ZohoAccount'][_0xe342('0x26')],function(_0x57038b){return{'name':_0x57038b['fieldName'],'type':_0x57038b[_0xe342('0x27')][_0xe342('0x28')]};});_0x17f87b['model']=_[_0xe342('0x25')](_0x3284a2,_0xe342('0x23'));_0x17f87b[_0xe342('0x29')]=_[_0xe342('0x2a')](_0x199c2b[_0xe342('0x29')]);_0x17f87b[_0xe342('0x2b')]=_[_0xe342('0x2c')](_0x17f87b[_0xe342('0x2d')],_0x17f87b[_0xe342('0x29')]);_0x57f00a[_0xe342('0x2e')]=_[_0xe342('0x2c')](_0x17f87b['model'],qs['fields'](_0x199c2b[_0xe342('0x29')][_0xe342('0x2f')]));_0x57f00a[_0xe342('0x2e')]=_0x57f00a[_0xe342('0x2e')]['length']?_0x57f00a['attributes']:_0x17f87b['model'];if(!_0x199c2b['query'][_0xe342('0x30')]('nolimit')){_0x57f00a[_0xe342('0x31')]=qs[_0xe342('0x31')](_0x199c2b[_0xe342('0x29')][_0xe342('0x31')]);_0x57f00a[_0xe342('0x18')]=qs[_0xe342('0x18')](_0x199c2b[_0xe342('0x29')][_0xe342('0x18')]);}_0x57f00a[_0xe342('0x32')]=qs[_0xe342('0x33')](_0x199c2b[_0xe342('0x29')][_0xe342('0x33')]);_0x57f00a['where']=qs[_0xe342('0x2b')](_['pick'](_0x199c2b['query'],_0x17f87b[_0xe342('0x2b')]),_0x3284a2);if(_0x199c2b[_0xe342('0x29')][_0xe342('0x34')]){_0x57f00a[_0xe342('0x35')]=_['merge'](_0x57f00a[_0xe342('0x35')],{'$or':_[_0xe342('0x25')](_0x3284a2,function(_0x10dea6){if(_0x10dea6[_0xe342('0x27')]!==_0xe342('0x36')){var _0x5b9843={};_0x5b9843[_0x10dea6[_0xe342('0x23')]]={'$like':'%'+_0x199c2b[_0xe342('0x29')][_0xe342('0x34')]+'%'};return _0x5b9843;}})});}_0x57f00a=_[_0xe342('0x37')]({},_0x57f00a,_0x199c2b[_0xe342('0x38')]);var _0x4122f6={'where':_0x57f00a[_0xe342('0x35')]};return db[_0xe342('0x39')][_0xe342('0x1a')](_0x4122f6)[_0xe342('0x1f')](function(_0x7fd486){_0x4306f2[_0xe342('0x1a')]=_0x7fd486;if(_0x199c2b[_0xe342('0x29')][_0xe342('0x3a')]){_0x57f00a[_0xe342('0x3b')]=[{'all':!![]}];}return db[_0xe342('0x39')][_0xe342('0x3c')](_0x57f00a);})[_0xe342('0x1f')](function(_0x401087){_0x4306f2[_0xe342('0x3d')]=_0x401087;return _0x4306f2;})['then'](respondWithFilteredResult(_0x2ae55c,_0x57f00a))[_0xe342('0x3e')](handleError(_0x2ae55c,null));};exports[_0xe342('0x3f')]=function(_0x51068a,_0x1abdd0){var _0x2e47b2={'raw':![],'where':{'id':_0x51068a[_0xe342('0x40')]['id']}},_0x3629e8={};_0x3629e8[_0xe342('0x2d')]=_[_0xe342('0x2a')](db[_0xe342('0x39')][_0xe342('0x26')]);_0x3629e8[_0xe342('0x29')]=_[_0xe342('0x2a')](_0x51068a[_0xe342('0x29')]);_0x3629e8[_0xe342('0x2b')]=_[_0xe342('0x2c')](_0x3629e8[_0xe342('0x2d')],_0x3629e8[_0xe342('0x29')]);_0x2e47b2['attributes']=_[_0xe342('0x2c')](_0x3629e8['model'],qs['fields'](_0x51068a[_0xe342('0x29')]['fields']));_0x2e47b2[_0xe342('0x2e')]=_0x2e47b2['attributes'][_0xe342('0x41')]?_0x2e47b2['attributes']:_0x3629e8[_0xe342('0x2d')];if(_0x51068a[_0xe342('0x29')][_0xe342('0x3a')]){_0x2e47b2[_0xe342('0x3b')]=[{'all':!![]}];}_0x2e47b2=_['merge']({},_0x2e47b2,_0x51068a[_0xe342('0x38')]);return db[_0xe342('0x39')][_0xe342('0x42')](_0x2e47b2)['then'](handleEntityNotFound(_0x1abdd0,null))[_0xe342('0x1f')](respondWithResult(_0x1abdd0,null))[_0xe342('0x3e')](handleError(_0x1abdd0,null));};exports[_0xe342('0x43')]=function(_0x2190ca,_0x4a6ce6){return db[_0xe342('0x39')][_0xe342('0x43')](_0x2190ca['body'],{})[_0xe342('0x1f')](respondWithResult(_0x4a6ce6,0xc9))[_0xe342('0x3e')](handleError(_0x4a6ce6,null));};exports[_0xe342('0x1e')]=function(_0x154cc4,_0xb0ac81){if(_0x154cc4[_0xe342('0x44')]['id']){delete _0x154cc4[_0xe342('0x44')]['id'];}return db[_0xe342('0x39')][_0xe342('0x42')]({'where':{'id':_0x154cc4[_0xe342('0x40')]['id']}})[_0xe342('0x1f')](handleEntityNotFound(_0xb0ac81,null))['then'](saveUpdates(_0x154cc4[_0xe342('0x44')],null))[_0xe342('0x1f')](respondWithResult(_0xb0ac81,null))[_0xe342('0x3e')](handleError(_0xb0ac81,null));};exports[_0xe342('0x20')]=function(_0x5aa285,_0x4c3e70){return db['ZohoAccount']['find']({'where':{'id':_0x5aa285[_0xe342('0x40')]['id']}})[_0xe342('0x1f')](handleEntityNotFound(_0x4c3e70,null))[_0xe342('0x1f')](removeEntity(_0x4c3e70,null))[_0xe342('0x3e')](handleError(_0x4c3e70,null));};exports[_0xe342('0x45')]=function(_0x406238,_0xc4203d,_0xa77d95){var _0x1a79cd={};var _0x51c665={};var _0x109b72;var _0xc214b0;return db['ZohoAccount']['findOne']({'where':{'id':_0x406238[_0xe342('0x40')]['id']}})[_0xe342('0x1f')](handleEntityNotFound(_0xc4203d,null))['then'](function(_0x1cf852){if(_0x1cf852){_0x109b72=_0x1cf852;_0x51c665[_0xe342('0x2d')]=_[_0xe342('0x2a')](db['ZohoConfiguration']['rawAttributes']);_0x51c665[_0xe342('0x29')]=_['keys'](_0x406238[_0xe342('0x29')]);_0x51c665[_0xe342('0x2b')]=_['intersection'](_0x51c665[_0xe342('0x2d')],_0x51c665[_0xe342('0x29')]);_0x1a79cd[_0xe342('0x2e')]=_[_0xe342('0x2c')](_0x51c665[_0xe342('0x2d')],qs[_0xe342('0x2f')](_0x406238[_0xe342('0x29')][_0xe342('0x2f')]));_0x1a79cd[_0xe342('0x2e')]=_0x1a79cd[_0xe342('0x2e')]['length']?_0x1a79cd['attributes']:_0x51c665['model'];_0x1a79cd[_0xe342('0x32')]=qs[_0xe342('0x33')](_0x406238[_0xe342('0x29')][_0xe342('0x33')]);_0x1a79cd['where']=qs['filters'](_['pick'](_0x406238[_0xe342('0x29')],_0x51c665[_0xe342('0x2b')]));if(_0x406238[_0xe342('0x29')]['filter']){_0x1a79cd[_0xe342('0x35')]=_['merge'](_0x1a79cd[_0xe342('0x35')],{'$or':_['map'](_0x1a79cd[_0xe342('0x2e')],function(_0xf5e032){var _0x537273={};_0x537273[_0xf5e032]={'$like':'%'+_0x406238[_0xe342('0x29')]['filter']+'%'};return _0x537273;})});}_0x1a79cd=_['merge']({},_0x1a79cd,_0x406238[_0xe342('0x38')]);return _0x109b72[_0xe342('0x45')](_0x1a79cd);}})[_0xe342('0x1f')](function(_0xb72eb5){if(_0xb72eb5){_0xc214b0=_0xb72eb5[_0xe342('0x41')];if(!_0x406238[_0xe342('0x29')]['hasOwnProperty'](_0xe342('0x46'))){_0x1a79cd[_0xe342('0x31')]=qs[_0xe342('0x31')](_0x406238[_0xe342('0x29')][_0xe342('0x31')]);_0x1a79cd[_0xe342('0x18')]=qs['offset'](_0x406238[_0xe342('0x29')][_0xe342('0x18')]);}return _0x109b72[_0xe342('0x45')](_0x1a79cd);}})[_0xe342('0x1f')](function(_0x59de14){if(_0x59de14){return _0x59de14?{'count':_0xc214b0,'rows':_0x59de14}:null;}})[_0xe342('0x1f')](respondWithResult(_0xc4203d,null))[_0xe342('0x3e')](handleError(_0xc4203d,null));};exports[_0xe342('0x47')]=function(_0x198f3a,_0x1257a7,_0x1227d6){if(_0x198f3a[_0xe342('0x44')]['id']){delete _0x198f3a[_0xe342('0x44')]['id'];}return db['ZohoAccount'][_0xe342('0x48')]({'where':{'id':_0x198f3a[_0xe342('0x40')]['id']}})[_0xe342('0x1f')](handleEntityNotFound(_0x1257a7,null))[_0xe342('0x1f')](function(_0x2f38e0){if(_0x2f38e0){_0x198f3a[_0xe342('0x44')]['AccountId']=_0x2f38e0['id'];_0x198f3a[_0xe342('0x44')]['Subjects']=integrations[_0xe342('0x49')](_0x198f3a['body']['channel'],_0x198f3a['body'][_0xe342('0x27')]);_0x198f3a['body']['Descriptions']=integrations[_0xe342('0x4a')](_0x198f3a[_0xe342('0x44')]['channel'],_0x198f3a[_0xe342('0x44')]['type']);return db['ZohoConfiguration'][_0xe342('0x43')](_0x198f3a[_0xe342('0x44')],{'include':[{'model':db[_0xe342('0x4b')],'as':_0xe342('0x4c')},{'model':db[_0xe342('0x4b')],'as':_0xe342('0x4d')}]});}return null;})[_0xe342('0x1f')](respondWithResult(_0x1257a7,null))[_0xe342('0x3e')](handleError(_0x1257a7,null));};function getAccessToken(_0x17a679){return new Promise(function(_0x3dd0e5,_0x41df21){var _0x1cc9d0;switch(_0x17a679[_0xe342('0x4e')]){case'US':_0x1cc9d0=_0xe342('0x4f');break;case'AU':_0x1cc9d0=_0xe342('0x50');break;case'EU':_0x1cc9d0=_0xe342('0x51');break;case'IN':_0x1cc9d0=_0xe342('0x52');break;case'CN':_0x1cc9d0=_0xe342('0x53');break;default:_0x1cc9d0='https://accounts.zoho.eu';break;}var _0x3d114d={'method':_0xe342('0x54'),'uri':_0x1cc9d0+_0xe342('0x55'),'qs':{'refresh_token':_0x17a679[_0xe342('0x56')],'client_id':_0x17a679['clientId'],'client_secret':_0x17a679['clientSecret'],'grant_type':'refresh_token'},'json':!![]};return rp(_0x3d114d)[_0xe342('0x1f')](function(_0x91cfea){if(_0x91cfea[_0xe342('0x57')]){_0x3dd0e5(_0x91cfea[_0xe342('0x57')]);}else{_0x41df21(_0xe342('0x58'));}})[_0xe342('0x3e')](function(_0x59b7e5){_0x41df21(_0x59b7e5);});});}exports['getFields']=function(_0x5ac8d3,_0x19a254,_0x2419b2){var _0x379258,_0x5ec4a0,_0x24fc93,_0x2d24a7,_0x5f0d37;return db[_0xe342('0x39')][_0xe342('0x48')]({'where':{'id':_0x5ac8d3[_0xe342('0x40')]['id']},'attributes':['id','host','zone',_0xe342('0x59'),_0xe342('0x5a'),_0xe342('0x5b'),_0xe342('0x5c'),_0xe342('0x56')]})['then'](handleEntityNotFound(_0x19a254,null))[_0xe342('0x1f')](function(_0x292372){_0x5f0d37=_0x292372;_0x379258=_0x5f0d37[_0xe342('0x5d')];_0x5ec4a0=_0x379258===_0xe342('0x5e')?'eu':'com';_0x24fc93=_0x5f0d37['serverUrl'];var _0x25f059=_0x24fc93[_0xe342('0x5f')](-0x1);if(_0x25f059==='/'||_0x25f059==='\x5c'||_0x25f059===':'){_0x24fc93=_0x24fc93['substring'](0x0,_0x24fc93['lastIndexOf'](_0x25f059));}if(!_0x5f0d37[_0xe342('0x56')]){throw new Error(_0xe342('0x60'));}return getAccessToken(_0x5f0d37);})[_0xe342('0x1f')](function(_0x2fa489){if(_0x2fa489){return rp({'method':_0xe342('0x61'),'uri':util['format'](_0xe342('0x62'),_0x5ec4a0),'qs':{'module':_0xe342('0x63')},'headers':{'Authorization':_0xe342('0x64')+_0x2fa489},'json':!![]});}})[_0xe342('0x1f')](function(_0x5e39a1){if(_0x5e39a1){if(_0x5e39a1[_0xe342('0x65')]&&_0x5e39a1[_0xe342('0x65')][_0xe342('0x21')]){throw new Error(_0x5e39a1[_0xe342('0x65')][_0xe342('0x21')][_0xe342('0x66')]);}var _0x24ccce=[];var _0x3bc8a6=[];var _0x460791=[_0xe342('0x67'),_0xe342('0x68'),_0xe342('0x69'),_0xe342('0x6a'),_0xe342('0x6b'),_0xe342('0x6c'),'Call_Start_Time',_0xe342('0x6d')];_0x3bc8a6=_[_0xe342('0x6e')](_0x5e39a1['fields'],function(_0x48a5b8){return _0x460791['includes'](_0x48a5b8['api_name']);});for(var _0x1fe3b8=0x0;_0x1fe3b8<_0x3bc8a6[_0xe342('0x41')];_0x1fe3b8++){if(_0x3bc8a6[_0x1fe3b8]['system_mandatory']===![]){_0x24ccce[_0xe342('0x6f')]({'id':_0x3bc8a6[_0x1fe3b8]['id'],'name':_0x3bc8a6[_0x1fe3b8]['display_label'],'custom':_0x3bc8a6[_0x1fe3b8][_0xe342('0x70')],'options':_0x3bc8a6[_0x1fe3b8][_0xe342('0x71')]===_0xe342('0x72')&&_0x3bc8a6[_0x1fe3b8][_0xe342('0x73')][_0xe342('0x41')]>-0x1?_[_0xe342('0x25')](_0x3bc8a6[_0x1fe3b8][_0xe342('0x73')],function(_0x31996f){return{'name':_0x31996f,'value':_0x31996f};}):[]});}}return{'count':_0x24ccce['length'],'rows':_0x24ccce};}else{return{'count':0x0,'rows':[]};}})[_0xe342('0x1f')](respondWithResult(_0x19a254,null))[_0xe342('0x3e')](function(_0x8536ed){var _0x480c85=_0x5ac8d3[_0xe342('0x29')][_0xe342('0x74')]?0x1f4:_0x8536ed[_0xe342('0x75')]||0x1f4;logger[_0xe342('0x21')](_0xe342('0x76'),'getFields',_0x480c85,JSON[_0xe342('0x77')](_0x8536ed));delete _0x8536ed[_0xe342('0x23')];if(_0x480c85===0x191){_0x480c85=0x190;}_0x19a254[_0xe342('0x15')](_0x480c85)[_0xe342('0x78')](_0x5ac8d3[_0xe342('0x29')][_0xe342('0x74')]?{'message':_0xe342('0x79'),'statusCode':_0x8536ed[_0xe342('0x75')]}:_0x8536ed);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index f0fe3d3..8354a4c 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 _0xcc92=['https://accounts.zoho.in','POST','/oauth/v2/token','authorization_code','then','parse','refresh_token','refreshToken','info','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','format','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','https://accounts.zoho.com.cn','https://accounts.zoho.eu','error','catch','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','int_zoho_accounts','changed','serverUrl','clientId','clientSecret','code','host','substring','lastIndexOf','zone','https://accounts.zoho.com'];(function(_0x1fc6a0,_0x1700c2){var _0x529f9a=function(_0x47e3c2){while(--_0x47e3c2){_0x1fc6a0['push'](_0x1fc6a0['shift']());}};_0x529f9a(++_0x1700c2);}(_0xcc92,0x18c));var _0x2cc9=function(_0x37a7c6,_0x3a84b6){_0x37a7c6=_0x37a7c6-0x0;var _0x539905=_0xcc92[_0x37a7c6];return _0x539905;};'use strict';var _=require(_0x2cc9('0x0'));var util=require(_0x2cc9('0x1'));var logger=require(_0x2cc9('0x2'))(_0x2cc9('0x3'));var moment=require(_0x2cc9('0x4'));var BPromise=require(_0x2cc9('0x5'));var rp=require(_0x2cc9('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2cc9('0x7'));var config=require(_0x2cc9('0x8'));var attributes=require(_0x2cc9('0x9'));var integrations=require(_0x2cc9('0xa'));module[_0x2cc9('0xb')]=function(_0x285a28,_0x4118a7){return _0x285a28[_0x2cc9('0xc')]('ZohoAccount',attributes,{'tableName':_0x2cc9('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x102ed3,_0x15d5d1,_0x342209){if(_0x102ed3['changed']('zone')||_0x102ed3[_0x2cc9('0xe')](_0x2cc9('0xf'))||_0x102ed3['changed'](_0x2cc9('0x10'))||_0x102ed3[_0x2cc9('0xe')](_0x2cc9('0x11'))||_0x102ed3[_0x2cc9('0xe')](_0x2cc9('0x12'))||_0x102ed3[_0x2cc9('0xe')](_0x2cc9('0x13'))){var _0xdf9d99,_0x1efd8b;_0xdf9d99=_0x102ed3[_0x2cc9('0xf')];var _0x4bc9fd=_0xdf9d99['slice'](-0x1);if(_0x4bc9fd==='/'||_0x4bc9fd==='\x5c'||_0x4bc9fd===':'){_0xdf9d99=_0xdf9d99[_0x2cc9('0x14')](0x0,_0xdf9d99[_0x2cc9('0x15')](_0x4bc9fd));}switch(_0x102ed3[_0x2cc9('0x16')]){case'US':_0x1efd8b=_0x2cc9('0x17');break;case'AU':_0x1efd8b='https://accounts.zoho.com.au';break;case'IN':_0x1efd8b=_0x2cc9('0x18');break;case'CN':_0x1efd8b='https://accounts.zoho.com.cn';break;default:_0x1efd8b='https://accounts.zoho.eu';break;}var _0x5be313={'method':_0x2cc9('0x19'),'uri':_0x1efd8b+_0x2cc9('0x1a'),'form':{'grant_type':_0x2cc9('0x1b'),'client_id':_0x102ed3['clientId'],'client_secret':_0x102ed3[_0x2cc9('0x11')],'redirect_uri':_0x102ed3[_0x2cc9('0xf')],'code':_0x102ed3['code']},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x5be313)[_0x2cc9('0x1c')](function(_0x62ea28){var _0x33c174=JSON[_0x2cc9('0x1d')](_0x62ea28);if(_0x33c174[_0x2cc9('0x1e')]){_0x102ed3[_0x2cc9('0x1f')]=_0x33c174[_0x2cc9('0x1e')];logger[_0x2cc9('0x20')](util['format'](_0x2cc9('0x21'),_0x102ed3[_0x2cc9('0x22')],_0x102ed3['id']));}else{logger['error'](util[_0x2cc9('0x23')](_0x2cc9('0x24'),_0x102ed3[_0x2cc9('0x22')],_0x102ed3['id']),util[_0x2cc9('0x25')](_0x33c174,{'showHidden':![],'depth':null}));}return _0x342209(null,_0x15d5d1);})['catch'](function(_0x18ab7d){logger['error'](util[_0x2cc9('0x23')](_0x2cc9('0x24'),_0x102ed3[_0x2cc9('0x22')],_0x102ed3['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x342209(_0x18ab7d);});}else{return _0x342209(null,_0x15d5d1);}},'beforeUpdate':function(_0x1839b5,_0x53aaae,_0x414e7b){if(_0x1839b5[_0x2cc9('0xe')]('zone')||_0x1839b5[_0x2cc9('0xe')](_0x2cc9('0xf'))||_0x1839b5['changed'](_0x2cc9('0x10'))||_0x1839b5['changed']('clientSecret')||_0x1839b5[_0x2cc9('0xe')](_0x2cc9('0x12'))||_0x1839b5[_0x2cc9('0xe')]('host')){var _0x135534,_0x48d177;_0x135534=_0x1839b5['serverUrl'];var _0x283a44=_0x135534['slice'](-0x1);if(_0x283a44==='/'||_0x283a44==='\x5c'||_0x283a44===':'){_0x135534=_0x135534[_0x2cc9('0x14')](0x0,_0x135534['lastIndexOf'](_0x283a44));}switch(_0x1839b5[_0x2cc9('0x16')]){case'US':_0x48d177='https://accounts.zoho.com';break;case'AU':_0x48d177='https://accounts.zoho.com.au';break;case'IN':_0x48d177=_0x2cc9('0x18');break;case'CN':_0x48d177=_0x2cc9('0x26');break;default:_0x48d177=_0x2cc9('0x27');break;}var _0x5d37e1={'method':_0x2cc9('0x19'),'uri':_0x48d177+_0x2cc9('0x1a'),'form':{'grant_type':_0x2cc9('0x1b'),'client_id':_0x1839b5[_0x2cc9('0x10')],'client_secret':_0x1839b5[_0x2cc9('0x11')],'redirect_uri':_0x1839b5[_0x2cc9('0xf')],'code':_0x1839b5[_0x2cc9('0x12')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x5d37e1)[_0x2cc9('0x1c')](function(_0x622542){var _0x1efe24=JSON[_0x2cc9('0x1d')](_0x622542);if(_0x1efe24[_0x2cc9('0x1e')]){_0x1839b5[_0x2cc9('0x1f')]=_0x1efe24[_0x2cc9('0x1e')];logger[_0x2cc9('0x20')](util[_0x2cc9('0x23')](_0x2cc9('0x21'),_0x1839b5[_0x2cc9('0x22')],_0x1839b5['id']));}else{logger[_0x2cc9('0x28')](util[_0x2cc9('0x23')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x1839b5[_0x2cc9('0x22')],_0x1839b5['id']),util[_0x2cc9('0x25')](_0x1efe24,{'showHidden':![],'depth':null}));}return _0x414e7b(null,_0x53aaae);})[_0x2cc9('0x29')](function(_0x5d1884){logger[_0x2cc9('0x28')](util[_0x2cc9('0x23')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x1839b5[_0x2cc9('0x22')],_0x1839b5['id']),util[_0x2cc9('0x25')](parsedResult,{'showHidden':![],'depth':null}));return _0x414e7b(_0x5d1884);});}else{return _0x414e7b(null,_0x53aaae);}}}});}; \ No newline at end of file +var _0x7400=['https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','authorization_code','parse','refresh_token','refreshToken','info','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','inspect','catch','format','/oauth/v2/token','application/x-www-form-urlencoded','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','lodash','api','request-promise','path','rimraf','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','int_zoho_accounts','changed','zone','serverUrl','clientId','clientSecret','code','host','slice','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au'];(function(_0x3dfa3e,_0x293558){var _0x3ff9ed=function(_0x400e9b){while(--_0x400e9b){_0x3dfa3e['push'](_0x3dfa3e['shift']());}};_0x3ff9ed(++_0x293558);}(_0x7400,0x108));var _0x0740=function(_0x2f06e0,_0x2e1c2a){_0x2f06e0=_0x2f06e0-0x0;var _0xf2711b=_0x7400[_0x2f06e0];return _0xf2711b;};'use strict';var _=require(_0x0740('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x0740('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0740('0x2'));var fs=require('fs');var path=require(_0x0740('0x3'));var rimraf=require(_0x0740('0x4'));var config=require('../../config/environment');var attributes=require(_0x0740('0x5'));var integrations=require(_0x0740('0x6'));module[_0x0740('0x7')]=function(_0x3e69d4,_0x7c2164){return _0x3e69d4[_0x0740('0x8')](_0x0740('0x9'),attributes,{'tableName':_0x0740('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x57ba02,_0x56bdbd,_0x595041){if(_0x57ba02[_0x0740('0xb')](_0x0740('0xc'))||_0x57ba02[_0x0740('0xb')](_0x0740('0xd'))||_0x57ba02[_0x0740('0xb')](_0x0740('0xe'))||_0x57ba02['changed'](_0x0740('0xf'))||_0x57ba02[_0x0740('0xb')](_0x0740('0x10'))||_0x57ba02[_0x0740('0xb')](_0x0740('0x11'))){var _0x43b986,_0xd74f7b;_0x43b986=_0x57ba02['serverUrl'];var _0x5607ef=_0x43b986[_0x0740('0x12')](-0x1);if(_0x5607ef==='/'||_0x5607ef==='\x5c'||_0x5607ef===':'){_0x43b986=_0x43b986[_0x0740('0x13')](0x0,_0x43b986[_0x0740('0x14')](_0x5607ef));}switch(_0x57ba02['zone']){case'US':_0xd74f7b=_0x0740('0x15');break;case'AU':_0xd74f7b=_0x0740('0x16');break;case'IN':_0xd74f7b=_0x0740('0x17');break;case'CN':_0xd74f7b=_0x0740('0x18');break;default:_0xd74f7b=_0x0740('0x19');break;}var _0x3b4537={'method':_0x0740('0x1a'),'uri':_0xd74f7b+'/oauth/v2/token','form':{'grant_type':_0x0740('0x1b'),'client_id':_0x57ba02['clientId'],'client_secret':_0x57ba02['clientSecret'],'redirect_uri':_0x57ba02['serverUrl'],'code':_0x57ba02[_0x0740('0x10')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x3b4537)['then'](function(_0x140f6a){var _0x45605e=JSON[_0x0740('0x1c')](_0x140f6a);if(_0x45605e[_0x0740('0x1d')]){_0x57ba02[_0x0740('0x1e')]=_0x45605e[_0x0740('0x1d')];logger[_0x0740('0x1f')](util['format'](_0x0740('0x20'),_0x57ba02[_0x0740('0x21')],_0x57ba02['id']));}else{logger[_0x0740('0x22')](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x57ba02['name'],_0x57ba02['id']),util[_0x0740('0x23')](_0x45605e,{'showHidden':![],'depth':null}));}return _0x595041(null,_0x56bdbd);})[_0x0740('0x24')](function(_0x414381){logger['error'](util[_0x0740('0x25')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x57ba02[_0x0740('0x21')],_0x57ba02['id']),util[_0x0740('0x23')](parsedResult,{'showHidden':![],'depth':null}));return _0x595041(_0x414381);});}else{return _0x595041(null,_0x56bdbd);}},'beforeUpdate':function(_0x2c84be,_0x3a8235,_0x38316e){if(_0x2c84be['changed'](_0x0740('0xc'))||_0x2c84be['changed'](_0x0740('0xd'))||_0x2c84be[_0x0740('0xb')](_0x0740('0xe'))||_0x2c84be[_0x0740('0xb')](_0x0740('0xf'))||_0x2c84be[_0x0740('0xb')]('code')||_0x2c84be[_0x0740('0xb')](_0x0740('0x11'))){var _0x1541c8,_0x29303a;_0x1541c8=_0x2c84be[_0x0740('0xd')];var _0x2ba83e=_0x1541c8[_0x0740('0x12')](-0x1);if(_0x2ba83e==='/'||_0x2ba83e==='\x5c'||_0x2ba83e===':'){_0x1541c8=_0x1541c8[_0x0740('0x13')](0x0,_0x1541c8[_0x0740('0x14')](_0x2ba83e));}switch(_0x2c84be[_0x0740('0xc')]){case'US':_0x29303a=_0x0740('0x15');break;case'AU':_0x29303a=_0x0740('0x16');break;case'IN':_0x29303a='https://accounts.zoho.in';break;case'CN':_0x29303a=_0x0740('0x18');break;default:_0x29303a=_0x0740('0x19');break;}var _0x93e241={'method':_0x0740('0x1a'),'uri':_0x29303a+_0x0740('0x26'),'form':{'grant_type':_0x0740('0x1b'),'client_id':_0x2c84be[_0x0740('0xe')],'client_secret':_0x2c84be[_0x0740('0xf')],'redirect_uri':_0x2c84be['serverUrl'],'code':_0x2c84be[_0x0740('0x10')]},'headers':{'Content-Type':_0x0740('0x27')}};return rp(_0x93e241)['then'](function(_0x3ba13c){var _0x434a06=JSON[_0x0740('0x1c')](_0x3ba13c);if(_0x434a06['refresh_token']){_0x2c84be[_0x0740('0x1e')]=_0x434a06[_0x0740('0x1d')];logger[_0x0740('0x1f')](util[_0x0740('0x25')](_0x0740('0x20'),_0x2c84be['name'],_0x2c84be['id']));}else{logger[_0x0740('0x22')](util[_0x0740('0x25')](_0x0740('0x28'),_0x2c84be[_0x0740('0x21')],_0x2c84be['id']),util[_0x0740('0x23')](_0x434a06,{'showHidden':![],'depth':null}));}return _0x38316e(null,_0x3a8235);})['catch'](function(_0x417bd8){logger[_0x0740('0x22')](util[_0x0740('0x25')](_0x0740('0x28'),_0x2c84be[_0x0740('0x21')],_0x2c84be['id']),util[_0x0740('0x23')](parsedResult,{'showHidden':![],'depth':null}));return _0x38316e(_0x417bd8);});}else{return _0x38316e(null,_0x3a8235);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index e2ac72c..4358678 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 _0x52aa=['info','ZohoAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','GetZohoAccount','ZohoAccount','findAll','options','where','attributes','limit','include','map','model','find','raw','ShowZohoAccount','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then'];(function(_0x278bfc,_0xc5d072){var _0x5e5853=function(_0x37e37f){while(--_0x37e37f){_0x278bfc['push'](_0x278bfc['shift']());}};_0x5e5853(++_0xc5d072);}(_0x52aa,0x113));var _0xa52a=function(_0x45afd0,_0x223c15){_0x45afd0=_0x45afd0-0x0;var _0x590be4=_0x52aa[_0x45afd0];return _0x590be4;};'use strict';var _=require('lodash');var util=require(_0xa52a('0x0'));var moment=require(_0xa52a('0x1'));var BPromise=require(_0xa52a('0x2'));var rs=require(_0xa52a('0x3'));var fs=require('fs');var Redis=require(_0xa52a('0x4'));var db=require(_0xa52a('0x5'))['db'];var utils=require(_0xa52a('0x6'));var logger=require(_0xa52a('0x7'))(_0xa52a('0x8'));var config=require(_0xa52a('0x9'));var jayson=require(_0xa52a('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x8609ec,_0x14bc85,_0x289bb0){return new BPromise(function(_0xbb295a,_0x19d5cf){return client[_0xa52a('0xb')](_0x8609ec,_0x289bb0)[_0xa52a('0xc')](function(_0xd006ed){logger[_0xa52a('0xd')](_0xa52a('0xe'),_0x14bc85,'request\x20sent');logger[_0xa52a('0xf')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x14bc85,_0xa52a('0x10'),JSON[_0xa52a('0x11')](_0xd006ed));if(_0xd006ed[_0xa52a('0x12')]){if(_0xd006ed[_0xa52a('0x12')][_0xa52a('0x13')]===0x1f4){logger[_0xa52a('0x12')](_0xa52a('0xe'),_0x14bc85,_0xd006ed[_0xa52a('0x12')][_0xa52a('0x14')]);return _0x19d5cf(_0xd006ed[_0xa52a('0x12')][_0xa52a('0x14')]);}logger[_0xa52a('0x12')](_0xa52a('0xe'),_0x14bc85,_0xd006ed['error']['message']);return _0xbb295a(_0xd006ed[_0xa52a('0x12')][_0xa52a('0x14')]);}else{logger['info'](_0xa52a('0xe'),_0x14bc85,_0xa52a('0x10'));_0xbb295a(_0xd006ed[_0xa52a('0x15')][_0xa52a('0x14')]);}})[_0xa52a('0x16')](function(_0x3ec21a){logger[_0xa52a('0x12')](_0xa52a('0xe'),_0x14bc85,_0x3ec21a);_0x19d5cf(_0x3ec21a);});});}exports[_0xa52a('0x17')]=function(_0x314323){var _0x5e0018=this;return new Promise(function(_0x1e2cc8,_0x139634){return db[_0xa52a('0x18')][_0xa52a('0x19')]({'raw':_0x314323[_0xa52a('0x1a')]?_0x314323[_0xa52a('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x314323[_0xa52a('0x1a')]?_0x314323[_0xa52a('0x1a')][_0xa52a('0x1b')]||null:null,'attributes':_0x314323[_0xa52a('0x1a')]?_0x314323['options'][_0xa52a('0x1c')]||null:null,'limit':_0x314323[_0xa52a('0x1a')]?_0x314323[_0xa52a('0x1a')][_0xa52a('0x1d')]||null:null,'include':_0x314323[_0xa52a('0x1a')]?_0x314323['options'][_0xa52a('0x1e')]?_['map'](_0x314323['options'][_0xa52a('0x1e')],function(_0x1de0a5){return{'model':db[_0x1de0a5['model']],'as':_0x1de0a5['as'],'attributes':_0x1de0a5['attributes'],'include':_0x1de0a5[_0xa52a('0x1e')]?_[_0xa52a('0x1f')](_0x1de0a5['include'],function(_0x1fbdc5){return{'model':db[_0x1fbdc5[_0xa52a('0x20')]],'as':_0x1fbdc5['as'],'attributes':_0x1fbdc5[_0xa52a('0x1c')],'include':_0x1fbdc5[_0xa52a('0x1e')]?_[_0xa52a('0x1f')](_0x1fbdc5[_0xa52a('0x1e')],function(_0x3f2e9e){return{'model':db[_0x3f2e9e[_0xa52a('0x20')]],'as':_0x3f2e9e['as'],'attributes':_0x3f2e9e[_0xa52a('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa52a('0xc')](function(_0x2fd577){logger[_0xa52a('0xd')](_0xa52a('0x17'),_0x314323);logger[_0xa52a('0xf')](_0xa52a('0x17'),_0x314323,JSON[_0xa52a('0x11')](_0x2fd577));_0x1e2cc8(_0x2fd577);})[_0xa52a('0x16')](function(_0x950f7e){logger['error'](_0xa52a('0x17'),_0x950f7e[_0xa52a('0x14')],_0x314323);_0x139634(_0x5e0018[_0xa52a('0x12')](0x1f4,_0x950f7e['message']));});});};exports['ShowZohoAccount']=function(_0x30449c){var _0x2d2180=this;return new Promise(function(_0x3c8c7d,_0x5d234b){return db[_0xa52a('0x18')][_0xa52a('0x21')]({'raw':_0x30449c['options']?_0x30449c[_0xa52a('0x1a')][_0xa52a('0x22')]===undefined?!![]:![]:!![],'where':_0x30449c[_0xa52a('0x1a')]?_0x30449c[_0xa52a('0x1a')][_0xa52a('0x1b')]||null:null,'attributes':_0x30449c[_0xa52a('0x1a')]?_0x30449c[_0xa52a('0x1a')][_0xa52a('0x1c')]||null:null,'include':_0x30449c['options']?_0x30449c[_0xa52a('0x1a')]['include']?_['map'](_0x30449c[_0xa52a('0x1a')][_0xa52a('0x1e')],function(_0x81edf5){return{'model':db[_0x81edf5[_0xa52a('0x20')]],'as':_0x81edf5['as'],'attributes':_0x81edf5['attributes'],'include':_0x81edf5[_0xa52a('0x1e')]?_['map'](_0x81edf5[_0xa52a('0x1e')],function(_0x4dc231){return{'model':db[_0x4dc231[_0xa52a('0x20')]],'as':_0x4dc231['as'],'attributes':_0x4dc231[_0xa52a('0x1c')],'include':_0x4dc231[_0xa52a('0x1e')]?_['map'](_0x4dc231['include'],function(_0x90c20){return{'model':db[_0x90c20[_0xa52a('0x20')]],'as':_0x90c20['as'],'attributes':_0x90c20[_0xa52a('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa52a('0xc')](function(_0xefe044){logger[_0xa52a('0xd')](_0xa52a('0x23'),_0x30449c);logger[_0xa52a('0xf')]('ShowZohoAccount',_0x30449c,JSON['stringify'](_0xefe044));_0x3c8c7d(_0xefe044);})['catch'](function(_0xbd41c1){logger[_0xa52a('0x12')]('ShowZohoAccount',_0xbd41c1['message'],_0x30449c);_0x5d234b(_0x2d2180[_0xa52a('0x12')](0x1f4,_0xbd41c1['message']));});});}; \ No newline at end of file +var _0xb0ee=['attributes','find','ShowZohoAccount','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetZohoAccount','ZohoAccount','findAll','options','raw','where','map','model','include'];(function(_0x147925,_0x51e81b){var _0x596381=function(_0x5bbfd5){while(--_0x5bbfd5){_0x147925['push'](_0x147925['shift']());}};_0x596381(++_0x51e81b);}(_0xb0ee,0x18f));var _0xeb0e=function(_0x1a72f3,_0x217011){_0x1a72f3=_0x1a72f3-0x0;var _0x57ef47=_0xb0ee[_0x1a72f3];return _0x57ef47;};'use strict';var _=require('lodash');var util=require(_0xeb0e('0x0'));var moment=require(_0xeb0e('0x1'));var BPromise=require(_0xeb0e('0x2'));var rs=require(_0xeb0e('0x3'));var fs=require('fs');var Redis=require(_0xeb0e('0x4'));var db=require(_0xeb0e('0x5'))['db'];var utils=require(_0xeb0e('0x6'));var logger=require(_0xeb0e('0x7'))(_0xeb0e('0x8'));var config=require(_0xeb0e('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xeb0e('0xa')][_0xeb0e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x423095,_0x3e7872,_0x572ee1){return new BPromise(function(_0x3b3c6e,_0x1dcf56){return client[_0xeb0e('0xc')](_0x423095,_0x572ee1)[_0xeb0e('0xd')](function(_0x2b90ba){logger[_0xeb0e('0xe')](_0xeb0e('0xf'),_0x3e7872,_0xeb0e('0x10'));logger[_0xeb0e('0x11')](_0xeb0e('0x12'),_0x3e7872,_0xeb0e('0x10'),JSON[_0xeb0e('0x13')](_0x2b90ba));if(_0x2b90ba[_0xeb0e('0x14')]){if(_0x2b90ba[_0xeb0e('0x14')][_0xeb0e('0x15')]===0x1f4){logger[_0xeb0e('0x14')](_0xeb0e('0xf'),_0x3e7872,_0x2b90ba[_0xeb0e('0x14')]['message']);return _0x1dcf56(_0x2b90ba['error'][_0xeb0e('0x16')]);}logger['error']('ZohoAccount,\x20%s,\x20%s',_0x3e7872,_0x2b90ba[_0xeb0e('0x14')][_0xeb0e('0x16')]);return _0x3b3c6e(_0x2b90ba[_0xeb0e('0x14')][_0xeb0e('0x16')]);}else{logger['info'](_0xeb0e('0xf'),_0x3e7872,_0xeb0e('0x10'));_0x3b3c6e(_0x2b90ba['result'][_0xeb0e('0x16')]);}})[_0xeb0e('0x17')](function(_0xa9a9c4){logger[_0xeb0e('0x14')](_0xeb0e('0xf'),_0x3e7872,_0xa9a9c4);_0x1dcf56(_0xa9a9c4);});});}exports[_0xeb0e('0x18')]=function(_0x2c78aa){var _0x51f14d=this;return new Promise(function(_0x1396a4,_0x972b84){return db[_0xeb0e('0x19')][_0xeb0e('0x1a')]({'raw':_0x2c78aa[_0xeb0e('0x1b')]?_0x2c78aa[_0xeb0e('0x1b')][_0xeb0e('0x1c')]===undefined?!![]:![]:!![],'where':_0x2c78aa[_0xeb0e('0x1b')]?_0x2c78aa['options'][_0xeb0e('0x1d')]||null:null,'attributes':_0x2c78aa[_0xeb0e('0x1b')]?_0x2c78aa['options']['attributes']||null:null,'limit':_0x2c78aa[_0xeb0e('0x1b')]?_0x2c78aa[_0xeb0e('0x1b')]['limit']||null:null,'include':_0x2c78aa[_0xeb0e('0x1b')]?_0x2c78aa[_0xeb0e('0x1b')]['include']?_[_0xeb0e('0x1e')](_0x2c78aa['options']['include'],function(_0x582a90){return{'model':db[_0x582a90[_0xeb0e('0x1f')]],'as':_0x582a90['as'],'attributes':_0x582a90['attributes'],'include':_0x582a90[_0xeb0e('0x20')]?_[_0xeb0e('0x1e')](_0x582a90[_0xeb0e('0x20')],function(_0x1849d5){return{'model':db[_0x1849d5[_0xeb0e('0x1f')]],'as':_0x1849d5['as'],'attributes':_0x1849d5[_0xeb0e('0x21')],'include':_0x1849d5[_0xeb0e('0x20')]?_['map'](_0x1849d5['include'],function(_0x27267d){return{'model':db[_0x27267d[_0xeb0e('0x1f')]],'as':_0x27267d['as'],'attributes':_0x27267d['attributes']};}):[]};}):[]};}):[]:[]})[_0xeb0e('0xd')](function(_0x2d9135){logger[_0xeb0e('0xe')](_0xeb0e('0x18'),_0x2c78aa);logger[_0xeb0e('0x11')](_0xeb0e('0x18'),_0x2c78aa,JSON[_0xeb0e('0x13')](_0x2d9135));_0x1396a4(_0x2d9135);})[_0xeb0e('0x17')](function(_0x4d23a3){logger[_0xeb0e('0x14')](_0xeb0e('0x18'),_0x4d23a3[_0xeb0e('0x16')],_0x2c78aa);_0x972b84(_0x51f14d[_0xeb0e('0x14')](0x1f4,_0x4d23a3['message']));});});};exports['ShowZohoAccount']=function(_0x2c4b4e){var _0x5d14f4=this;return new Promise(function(_0x1ad8ed,_0x35862d){return db[_0xeb0e('0x19')][_0xeb0e('0x22')]({'raw':_0x2c4b4e[_0xeb0e('0x1b')]?_0x2c4b4e[_0xeb0e('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x2c4b4e[_0xeb0e('0x1b')]?_0x2c4b4e['options'][_0xeb0e('0x1d')]||null:null,'attributes':_0x2c4b4e[_0xeb0e('0x1b')]?_0x2c4b4e['options']['attributes']||null:null,'include':_0x2c4b4e[_0xeb0e('0x1b')]?_0x2c4b4e[_0xeb0e('0x1b')][_0xeb0e('0x20')]?_['map'](_0x2c4b4e[_0xeb0e('0x1b')][_0xeb0e('0x20')],function(_0x1c3625){return{'model':db[_0x1c3625[_0xeb0e('0x1f')]],'as':_0x1c3625['as'],'attributes':_0x1c3625['attributes'],'include':_0x1c3625[_0xeb0e('0x20')]?_[_0xeb0e('0x1e')](_0x1c3625[_0xeb0e('0x20')],function(_0x23e3f3){return{'model':db[_0x23e3f3[_0xeb0e('0x1f')]],'as':_0x23e3f3['as'],'attributes':_0x23e3f3[_0xeb0e('0x21')],'include':_0x23e3f3[_0xeb0e('0x20')]?_[_0xeb0e('0x1e')](_0x23e3f3['include'],function(_0x52b017){return{'model':db[_0x52b017[_0xeb0e('0x1f')]],'as':_0x52b017['as'],'attributes':_0x52b017['attributes']};}):[]};}):[]};}):[]:[]})[_0xeb0e('0xd')](function(_0x266337){logger['info'](_0xeb0e('0x23'),_0x2c4b4e);logger[_0xeb0e('0x11')]('ShowZohoAccount',_0x2c4b4e,JSON['stringify'](_0x266337));_0x1ad8ed(_0x266337);})[_0xeb0e('0x17')](function(_0x3bb158){logger[_0xeb0e('0x14')](_0xeb0e('0x23'),_0x3bb158['message'],_0x2c4b4e);_0x35862d(_0x5d14f4[_0xeb0e('0x14')](0x1f4,_0x3bb158['message']));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index a832b0d..0abaa03 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 _0x8d21=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','index','/:id','isAuthenticated','/:id/fields','getFields','getSubjects','getDescriptions','post','create','delete','destroy'];(function(_0x143368,_0x5d0b64){var _0x44c10a=function(_0x30c90c){while(--_0x30c90c){_0x143368['push'](_0x143368['shift']());}};_0x44c10a(++_0x5d0b64);}(_0x8d21,0xd0));var _0x18d2=function(_0x2ea298,_0x5cae8b){_0x2ea298=_0x2ea298-0x0;var _0x23735f=_0x8d21[_0x2ea298];return _0x23735f;};'use strict';var multer=require(_0x18d2('0x0'));var util=require(_0x18d2('0x1'));var path=require(_0x18d2('0x2'));var timeout=require(_0x18d2('0x3'));var express=require(_0x18d2('0x4'));var router=express[_0x18d2('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x18d2('0x6'));var interaction=require(_0x18d2('0x7'));var config=require(_0x18d2('0x8'));var controller=require(_0x18d2('0x9'));router[_0x18d2('0xa')]('/',auth['isAuthenticated'](),controller[_0x18d2('0xb')]);router[_0x18d2('0xa')](_0x18d2('0xc'),auth[_0x18d2('0xd')](),controller['show']);router[_0x18d2('0xa')](_0x18d2('0xe'),auth['isAuthenticated'](),controller[_0x18d2('0xf')]);router['get']('/:id/subjects',auth[_0x18d2('0xd')](),controller[_0x18d2('0x10')]);router['get']('/:id/descriptions',auth[_0x18d2('0xd')](),controller[_0x18d2('0x11')]);router[_0x18d2('0x12')]('/',auth[_0x18d2('0xd')](),controller[_0x18d2('0x13')]);router['put'](_0x18d2('0xc'),auth[_0x18d2('0xd')](),controller['update']);router[_0x18d2('0x14')]('/:id',auth[_0x18d2('0xd')](),controller[_0x18d2('0x15')]);module[_0x18d2('0x16')]=router; \ No newline at end of file +var _0x5779=['multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/fields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','delete','destroy','exports'];(function(_0x4c260a,_0x148241){var _0x17bbdd=function(_0x4f3e9f){while(--_0x4f3e9f){_0x4c260a['push'](_0x4c260a['shift']());}};_0x17bbdd(++_0x148241);}(_0x5779,0x84));var _0x9577=function(_0x300a7b,_0x1b5602){_0x300a7b=_0x300a7b-0x0;var _0x3dd394=_0x5779[_0x300a7b];return _0x3dd394;};'use strict';var multer=require(_0x9577('0x0'));var util=require(_0x9577('0x1'));var path=require('path');var timeout=require(_0x9577('0x2'));var express=require('express');var router=express[_0x9577('0x3')]();var fs_extra=require(_0x9577('0x4'));var auth=require(_0x9577('0x5'));var interaction=require(_0x9577('0x6'));var config=require(_0x9577('0x7'));var controller=require('./intZohoConfiguration.controller');router[_0x9577('0x8')]('/',auth[_0x9577('0x9')](),controller[_0x9577('0xa')]);router[_0x9577('0x8')](_0x9577('0xb'),auth[_0x9577('0x9')](),controller[_0x9577('0xc')]);router[_0x9577('0x8')](_0x9577('0xd'),auth['isAuthenticated'](),controller['getFields']);router[_0x9577('0x8')](_0x9577('0xe'),auth[_0x9577('0x9')](),controller['getSubjects']);router[_0x9577('0x8')](_0x9577('0xf'),auth['isAuthenticated'](),controller[_0x9577('0x10')]);router[_0x9577('0x11')]('/',auth['isAuthenticated'](),controller[_0x9577('0x12')]);router['put'](_0x9577('0xb'),auth[_0x9577('0x9')](),controller['update']);router[_0x9577('0x13')](_0x9577('0xb'),auth[_0x9577('0x9')](),controller[_0x9577('0x14')]);module[_0x9577('0x15')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 6abb057..1e7b804 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 _0xbe9f=['ENUM','lead','contact','nothing','contact_lead','exports','STRING'];(function(_0x7a42d9,_0x5a0c72){var _0x278b78=function(_0x1fa030){while(--_0x1fa030){_0x7a42d9['push'](_0x7a42d9['shift']());}};_0x278b78(++_0x5a0c72);}(_0xbe9f,0xc2));var _0xfbe9=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xbe9f[_0x46e363];return _0x3fb059;};'use strict';var Sequelize=require('sequelize');module[_0xfbe9('0x0')]={'name':{'type':Sequelize[_0xfbe9('0x1')]},'moduleCreate':{'type':Sequelize[_0xfbe9('0x2')](_0xfbe9('0x3'),_0xfbe9('0x4'),_0xfbe9('0x5')),'defaultValue':_0xfbe9('0x3')},'moduleSearch':{'type':Sequelize[_0xfbe9('0x2')](_0xfbe9('0x6'),_0xfbe9('0x4'),_0xfbe9('0x3')),'defaultValue':'contact_lead'},'description':{'type':Sequelize[_0xfbe9('0x1')]}}; \ No newline at end of file +var _0x96f6=['sequelize','exports','ENUM','contact','nothing','lead','contact_lead'];(function(_0x46ce9d,_0xa564b0){var _0x1639c4=function(_0x1f59a2){while(--_0x1f59a2){_0x46ce9d['push'](_0x46ce9d['shift']());}};_0x1639c4(++_0xa564b0);}(_0x96f6,0x181));var _0x696f=function(_0x1460f6,_0x59051a){_0x1460f6=_0x1460f6-0x0;var _0x46ce94=_0x96f6[_0x1460f6];return _0x46ce94;};'use strict';var Sequelize=require(_0x696f('0x0'));module[_0x696f('0x1')]={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize[_0x696f('0x2')]('lead',_0x696f('0x3'),_0x696f('0x4')),'defaultValue':_0x696f('0x5')},'moduleSearch':{'type':Sequelize[_0x696f('0x2')](_0x696f('0x6'),'contact',_0x696f('0x5')),'defaultValue':_0x696f('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 e35e21b..248c280 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 _0x3bf0=['includeAll','find','catch','create','body','findOne','ZohoField','getFields','hasOwnProperty','getSubjects','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','Content-Range','apply','save','update','then','destroy','sendStatus','stack','name','send','map','ZohoConfiguration','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','show','params','keys','length'];(function(_0x44cb92,_0x59afa3){var _0x56b9e6=function(_0x2841e0){while(--_0x2841e0){_0x44cb92['push'](_0x44cb92['shift']());}};_0x56b9e6(++_0x59afa3);}(_0x3bf0,0x1f0));var _0x03bf=function(_0x2745f8,_0x8eb7ce){_0x2745f8=_0x2745f8-0x0;var _0x47f290=_0x3bf0[_0x2745f8];return _0x47f290;};'use strict';var emlformat=require(_0x03bf('0x0'));var rimraf=require(_0x03bf('0x1'));var zipdir=require(_0x03bf('0x2'));var jsonpatch=require(_0x03bf('0x3'));var rp=require(_0x03bf('0x4'));var moment=require(_0x03bf('0x5'));var BPromise=require(_0x03bf('0x6'));var Mustache=require(_0x03bf('0x7'));var util=require(_0x03bf('0x8'));var path=require('path');var sox=require(_0x03bf('0x9'));var csv=require(_0x03bf('0xa'));var ejs=require(_0x03bf('0xb'));var fs=require('fs');var fs_extra=require(_0x03bf('0xc'));var _=require(_0x03bf('0xd'));var squel=require(_0x03bf('0xe'));var crypto=require('crypto');var jsforce=require(_0x03bf('0xf'));var deskjs=require(_0x03bf('0x10'));var toCsv=require('to-csv');var querystring=require(_0x03bf('0x11'));var Papa=require(_0x03bf('0x12'));var Redis=require(_0x03bf('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x03bf('0x14'));var as=require(_0x03bf('0x15'));var hardwareService=require(_0x03bf('0x16'));var logger=require(_0x03bf('0x17'))(_0x03bf('0x18'));var utils=require(_0x03bf('0x19'));var config=require(_0x03bf('0x1a'));var licenseUtil=require(_0x03bf('0x1b'));var db=require(_0x03bf('0x1c'))['db'];function respondWithStatusCode(_0x13498d,_0x38ba5f){_0x38ba5f=_0x38ba5f||0xcc;return function(_0x5ca87b){if(_0x5ca87b){return _0x13498d['sendStatus'](_0x38ba5f);}return _0x13498d[_0x03bf('0x1d')](_0x38ba5f)[_0x03bf('0x1e')]();};}function respondWithResult(_0x2fad5a,_0x2caac8){_0x2caac8=_0x2caac8||0xc8;return function(_0x174a35){if(_0x174a35){return _0x2fad5a[_0x03bf('0x1d')](_0x2caac8)[_0x03bf('0x1f')](_0x174a35);}};}function respondWithFilteredResult(_0x334178,_0x4ab8df){return function(_0xfbf3b9){if(_0xfbf3b9){var _0x4f3d50=typeof _0x4ab8df[_0x03bf('0x20')]==='undefined'&&typeof _0x4ab8df[_0x03bf('0x21')]===_0x03bf('0x22');var _0x389ca3=_0xfbf3b9['count'];var _0xa7a767=_0x4f3d50?0x0:_0x4ab8df[_0x03bf('0x20')];var _0x541374=_0x4f3d50?_0xfbf3b9[_0x03bf('0x23')]:_0x4ab8df[_0x03bf('0x20')]+_0x4ab8df[_0x03bf('0x21')];var _0x1802bf;if(_0x541374>=_0x389ca3){_0x541374=_0x389ca3;_0x1802bf=0xc8;}else{_0x1802bf=0xce;}_0x334178[_0x03bf('0x1d')](_0x1802bf);return _0x334178['set'](_0x03bf('0x24'),_0xa7a767+'-'+_0x541374+'/'+_0x389ca3)[_0x03bf('0x1f')](_0xfbf3b9);}return null;};}function patchUpdates(_0x2854f3){return function(_0x3c6092){try{jsonpatch[_0x03bf('0x25')](_0x3c6092,_0x2854f3,!![]);}catch(_0x9d907c){return BPromise['reject'](_0x9d907c);}return _0x3c6092[_0x03bf('0x26')]();};}function saveUpdates(_0x5cdf48,_0x5902ba){return function(_0x2acefd){if(_0x2acefd){return _0x2acefd[_0x03bf('0x27')](_0x5cdf48)[_0x03bf('0x28')](function(_0x48a322){return _0x48a322;});}return null;};}function removeEntity(_0x5243e5,_0x34a55){return function(_0x463cc9){if(_0x463cc9){return _0x463cc9[_0x03bf('0x29')]()[_0x03bf('0x28')](function(){_0x5243e5[_0x03bf('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0xb00263,_0x3357e8){return function(_0xd85423){if(!_0xd85423){_0xb00263[_0x03bf('0x2a')](0x194);}return _0xd85423;};}function handleError(_0x25a65b,_0xe86ecb){_0xe86ecb=_0xe86ecb||0x1f4;return function(_0xaa35d2){logger['error'](_0xaa35d2[_0x03bf('0x2b')]);if(_0xaa35d2['name']){delete _0xaa35d2[_0x03bf('0x2c')];}_0x25a65b[_0x03bf('0x1d')](_0xe86ecb)[_0x03bf('0x2d')](_0xaa35d2);};}exports['index']=function(_0x17daf6,_0x2e1179){var _0x1ab194={},_0x23eb3e={},_0x57a3fc={'count':0x0,'rows':[]};var _0x297348=_[_0x03bf('0x2e')](db[_0x03bf('0x2f')][_0x03bf('0x30')],function(_0x49198d){return{'name':_0x49198d['fieldName'],'type':_0x49198d[_0x03bf('0x31')][_0x03bf('0x32')]};});_0x23eb3e[_0x03bf('0x33')]=_[_0x03bf('0x2e')](_0x297348,'name');_0x23eb3e[_0x03bf('0x34')]=_['keys'](_0x17daf6[_0x03bf('0x34')]);_0x23eb3e[_0x03bf('0x35')]=_[_0x03bf('0x36')](_0x23eb3e[_0x03bf('0x33')],_0x23eb3e[_0x03bf('0x34')]);_0x1ab194[_0x03bf('0x37')]=_[_0x03bf('0x36')](_0x23eb3e[_0x03bf('0x33')],qs[_0x03bf('0x38')](_0x17daf6[_0x03bf('0x34')]['fields']));_0x1ab194[_0x03bf('0x37')]=_0x1ab194[_0x03bf('0x37')]['length']?_0x1ab194[_0x03bf('0x37')]:_0x23eb3e[_0x03bf('0x33')];if(!_0x17daf6[_0x03bf('0x34')]['hasOwnProperty'](_0x03bf('0x39'))){_0x1ab194[_0x03bf('0x21')]=qs[_0x03bf('0x21')](_0x17daf6[_0x03bf('0x34')][_0x03bf('0x21')]);_0x1ab194['offset']=qs[_0x03bf('0x20')](_0x17daf6[_0x03bf('0x34')][_0x03bf('0x20')]);}_0x1ab194[_0x03bf('0x3a')]=qs[_0x03bf('0x3b')](_0x17daf6['query']['sort']);_0x1ab194[_0x03bf('0x3c')]=qs[_0x03bf('0x35')](_[_0x03bf('0x3d')](_0x17daf6[_0x03bf('0x34')],_0x23eb3e[_0x03bf('0x35')]),_0x297348);if(_0x17daf6[_0x03bf('0x34')][_0x03bf('0x3e')]){_0x1ab194['where']=_[_0x03bf('0x3f')](_0x1ab194['where'],{'$or':_[_0x03bf('0x2e')](_0x297348,function(_0xf9a22c){if(_0xf9a22c[_0x03bf('0x31')]!==_0x03bf('0x40')){var _0x332b05={};_0x332b05[_0xf9a22c[_0x03bf('0x2c')]]={'$like':'%'+_0x17daf6[_0x03bf('0x34')][_0x03bf('0x3e')]+'%'};return _0x332b05;}})});}_0x1ab194=_[_0x03bf('0x3f')]({},_0x1ab194,_0x17daf6[_0x03bf('0x41')]);var _0xebe382={'where':_0x1ab194['where']};return db[_0x03bf('0x2f')][_0x03bf('0x23')](_0xebe382)[_0x03bf('0x28')](function(_0x491939){_0x57a3fc[_0x03bf('0x23')]=_0x491939;if(_0x17daf6[_0x03bf('0x34')]['includeAll']){_0x1ab194['include']=[{'all':!![]}];}return db[_0x03bf('0x2f')][_0x03bf('0x42')](_0x1ab194);})[_0x03bf('0x28')](function(_0x4e9913){_0x57a3fc['rows']=_0x4e9913;return _0x57a3fc;})[_0x03bf('0x28')](respondWithFilteredResult(_0x2e1179,_0x1ab194))['catch'](handleError(_0x2e1179,null));};exports[_0x03bf('0x43')]=function(_0x843f0e,_0x3d5538){var _0x3930a2={'raw':![],'where':{'id':_0x843f0e[_0x03bf('0x44')]['id']}},_0x56566d={};_0x56566d[_0x03bf('0x33')]=_[_0x03bf('0x45')](db[_0x03bf('0x2f')][_0x03bf('0x30')]);_0x56566d['query']=_[_0x03bf('0x45')](_0x843f0e[_0x03bf('0x34')]);_0x56566d[_0x03bf('0x35')]=_['intersection'](_0x56566d['model'],_0x56566d[_0x03bf('0x34')]);_0x3930a2[_0x03bf('0x37')]=_[_0x03bf('0x36')](_0x56566d[_0x03bf('0x33')],qs['fields'](_0x843f0e[_0x03bf('0x34')]['fields']));_0x3930a2[_0x03bf('0x37')]=_0x3930a2['attributes'][_0x03bf('0x46')]?_0x3930a2['attributes']:_0x56566d['model'];if(_0x843f0e['query'][_0x03bf('0x47')]){_0x3930a2['include']=[{'all':!![]}];}_0x3930a2=_[_0x03bf('0x3f')]({},_0x3930a2,_0x843f0e[_0x03bf('0x41')]);return db[_0x03bf('0x2f')][_0x03bf('0x48')](_0x3930a2)[_0x03bf('0x28')](handleEntityNotFound(_0x3d5538,null))[_0x03bf('0x28')](respondWithResult(_0x3d5538,null))[_0x03bf('0x49')](handleError(_0x3d5538,null));};exports[_0x03bf('0x4a')]=function(_0x58165b,_0x5b7037){return db[_0x03bf('0x2f')][_0x03bf('0x4a')](_0x58165b[_0x03bf('0x4b')],{})[_0x03bf('0x28')](respondWithResult(_0x5b7037,0xc9))['catch'](handleError(_0x5b7037,null));};exports['update']=function(_0xd2d255,_0x46fcf2){if(_0xd2d255[_0x03bf('0x4b')]['id']){delete _0xd2d255[_0x03bf('0x4b')]['id'];}return db[_0x03bf('0x2f')][_0x03bf('0x48')]({'where':{'id':_0xd2d255[_0x03bf('0x44')]['id']}})[_0x03bf('0x28')](handleEntityNotFound(_0x46fcf2,null))[_0x03bf('0x28')](saveUpdates(_0xd2d255[_0x03bf('0x4b')],null))['then'](respondWithResult(_0x46fcf2,null))[_0x03bf('0x49')](handleError(_0x46fcf2,null));};exports[_0x03bf('0x29')]=function(_0x4cd1d3,_0x45ed1c){return db[_0x03bf('0x2f')][_0x03bf('0x48')]({'where':{'id':_0x4cd1d3[_0x03bf('0x44')]['id']}})[_0x03bf('0x28')](handleEntityNotFound(_0x45ed1c,null))[_0x03bf('0x28')](removeEntity(_0x45ed1c,null))[_0x03bf('0x49')](handleError(_0x45ed1c,null));};exports['getFields']=function(_0xf359fb,_0x4bd584,_0x37967b){var _0x4f21ea={};var _0x505f40={};var _0x4d542d;var _0x296583;return db[_0x03bf('0x2f')][_0x03bf('0x4c')]({'where':{'id':_0xf359fb['params']['id']}})[_0x03bf('0x28')](handleEntityNotFound(_0x4bd584,null))[_0x03bf('0x28')](function(_0x569580){if(_0x569580){_0x4d542d=_0x569580;_0x505f40[_0x03bf('0x33')]=_['keys'](db[_0x03bf('0x4d')][_0x03bf('0x30')]);_0x505f40['query']=_[_0x03bf('0x45')](_0xf359fb['query']);_0x505f40[_0x03bf('0x35')]=_[_0x03bf('0x36')](_0x505f40['model'],_0x505f40[_0x03bf('0x34')]);_0x4f21ea[_0x03bf('0x37')]=_[_0x03bf('0x36')](_0x505f40[_0x03bf('0x33')],qs[_0x03bf('0x38')](_0xf359fb['query'][_0x03bf('0x38')]));_0x4f21ea[_0x03bf('0x37')]=_0x4f21ea[_0x03bf('0x37')][_0x03bf('0x46')]?_0x4f21ea['attributes']:_0x505f40[_0x03bf('0x33')];_0x4f21ea[_0x03bf('0x3a')]=qs[_0x03bf('0x3b')](_0xf359fb[_0x03bf('0x34')]['sort']);_0x4f21ea['where']=qs[_0x03bf('0x35')](_['pick'](_0xf359fb[_0x03bf('0x34')],_0x505f40[_0x03bf('0x35')]));if(_0xf359fb[_0x03bf('0x34')][_0x03bf('0x3e')]){_0x4f21ea[_0x03bf('0x3c')]=_[_0x03bf('0x3f')](_0x4f21ea['where'],{'$or':_['map'](_0x4f21ea['attributes'],function(_0x243f5c){var _0x30c5b7={};_0x30c5b7[_0x243f5c]={'$like':'%'+_0xf359fb[_0x03bf('0x34')][_0x03bf('0x3e')]+'%'};return _0x30c5b7;})});}_0x4f21ea=_['merge']({},_0x4f21ea,_0xf359fb[_0x03bf('0x41')]);return _0x4d542d[_0x03bf('0x4e')](_0x4f21ea);}})[_0x03bf('0x28')](function(_0x3ac6ad){if(_0x3ac6ad){_0x296583=_0x3ac6ad[_0x03bf('0x46')];if(!_0xf359fb[_0x03bf('0x34')][_0x03bf('0x4f')](_0x03bf('0x39'))){_0x4f21ea[_0x03bf('0x21')]=qs[_0x03bf('0x21')](_0xf359fb['query'][_0x03bf('0x21')]);_0x4f21ea[_0x03bf('0x20')]=qs[_0x03bf('0x20')](_0xf359fb[_0x03bf('0x34')][_0x03bf('0x20')]);}return _0x4d542d[_0x03bf('0x4e')](_0x4f21ea);}})['then'](function(_0x3e6f7d){if(_0x3e6f7d){return _0x3e6f7d?{'count':_0x296583,'rows':_0x3e6f7d}:null;}})[_0x03bf('0x28')](respondWithResult(_0x4bd584,null))[_0x03bf('0x49')](handleError(_0x4bd584,null));};exports[_0x03bf('0x50')]=function(_0x4f9a2c,_0x4083b2,_0x4c6fea){var _0x58d9db={};var _0x55a82f={};var _0x4bc140;var _0xb3dfba;return db[_0x03bf('0x2f')][_0x03bf('0x4c')]({'where':{'id':_0x4f9a2c[_0x03bf('0x44')]['id']}})[_0x03bf('0x28')](handleEntityNotFound(_0x4083b2,null))['then'](function(_0x218392){if(_0x218392){_0x4bc140=_0x218392;_0x55a82f[_0x03bf('0x33')]=_['keys'](db[_0x03bf('0x4d')][_0x03bf('0x30')]);_0x55a82f[_0x03bf('0x34')]=_[_0x03bf('0x45')](_0x4f9a2c[_0x03bf('0x34')]);_0x55a82f[_0x03bf('0x35')]=_[_0x03bf('0x36')](_0x55a82f[_0x03bf('0x33')],_0x55a82f[_0x03bf('0x34')]);_0x58d9db[_0x03bf('0x37')]=_[_0x03bf('0x36')](_0x55a82f['model'],qs[_0x03bf('0x38')](_0x4f9a2c['query']['fields']));_0x58d9db[_0x03bf('0x37')]=_0x58d9db['attributes'][_0x03bf('0x46')]?_0x58d9db[_0x03bf('0x37')]:_0x55a82f[_0x03bf('0x33')];_0x58d9db['order']=qs[_0x03bf('0x3b')](_0x4f9a2c['query'][_0x03bf('0x3b')]);_0x58d9db[_0x03bf('0x3c')]=qs[_0x03bf('0x35')](_['pick'](_0x4f9a2c[_0x03bf('0x34')],_0x55a82f[_0x03bf('0x35')]));if(_0x4f9a2c[_0x03bf('0x34')]['filter']){_0x58d9db[_0x03bf('0x3c')]=_[_0x03bf('0x3f')](_0x58d9db[_0x03bf('0x3c')],{'$or':_['map'](_0x58d9db[_0x03bf('0x37')],function(_0x45636d){var _0x24670f={};_0x24670f[_0x45636d]={'$like':'%'+_0x4f9a2c['query']['filter']+'%'};return _0x24670f;})});}_0x58d9db=_[_0x03bf('0x3f')]({},_0x58d9db,_0x4f9a2c[_0x03bf('0x41')]);return _0x4bc140['getSubjects'](_0x58d9db);}})[_0x03bf('0x28')](function(_0x5c91b7){if(_0x5c91b7){_0xb3dfba=_0x5c91b7[_0x03bf('0x46')];if(!_0x4f9a2c['query'][_0x03bf('0x4f')](_0x03bf('0x39'))){_0x58d9db['limit']=qs['limit'](_0x4f9a2c[_0x03bf('0x34')][_0x03bf('0x21')]);_0x58d9db[_0x03bf('0x20')]=qs[_0x03bf('0x20')](_0x4f9a2c[_0x03bf('0x34')][_0x03bf('0x20')]);}return _0x4bc140[_0x03bf('0x50')](_0x58d9db);}})[_0x03bf('0x28')](function(_0xacf662){if(_0xacf662){return _0xacf662?{'count':_0xb3dfba,'rows':_0xacf662}:null;}})[_0x03bf('0x28')](respondWithResult(_0x4083b2,null))[_0x03bf('0x49')](handleError(_0x4083b2,null));};exports['getDescriptions']=function(_0x546e16,_0xe1e4bd,_0x179632){var _0x5a9b28={};var _0x186940={};var _0x67a827;var _0x133cdd;return db[_0x03bf('0x2f')][_0x03bf('0x4c')]({'where':{'id':_0x546e16[_0x03bf('0x44')]['id']}})[_0x03bf('0x28')](handleEntityNotFound(_0xe1e4bd,null))[_0x03bf('0x28')](function(_0x203ebd){if(_0x203ebd){_0x67a827=_0x203ebd;_0x186940['model']=_[_0x03bf('0x45')](db[_0x03bf('0x4d')]['rawAttributes']);_0x186940[_0x03bf('0x34')]=_[_0x03bf('0x45')](_0x546e16[_0x03bf('0x34')]);_0x186940[_0x03bf('0x35')]=_[_0x03bf('0x36')](_0x186940[_0x03bf('0x33')],_0x186940[_0x03bf('0x34')]);_0x5a9b28['attributes']=_[_0x03bf('0x36')](_0x186940['model'],qs[_0x03bf('0x38')](_0x546e16['query'][_0x03bf('0x38')]));_0x5a9b28[_0x03bf('0x37')]=_0x5a9b28['attributes']['length']?_0x5a9b28[_0x03bf('0x37')]:_0x186940[_0x03bf('0x33')];_0x5a9b28[_0x03bf('0x3a')]=qs['sort'](_0x546e16['query'][_0x03bf('0x3b')]);_0x5a9b28['where']=qs['filters'](_['pick'](_0x546e16[_0x03bf('0x34')],_0x186940[_0x03bf('0x35')]));if(_0x546e16[_0x03bf('0x34')]['filter']){_0x5a9b28[_0x03bf('0x3c')]=_['merge'](_0x5a9b28[_0x03bf('0x3c')],{'$or':_[_0x03bf('0x2e')](_0x5a9b28[_0x03bf('0x37')],function(_0x5d97b5){var _0xd0e64={};_0xd0e64[_0x5d97b5]={'$like':'%'+_0x546e16[_0x03bf('0x34')][_0x03bf('0x3e')]+'%'};return _0xd0e64;})});}_0x5a9b28=_['merge']({},_0x5a9b28,_0x546e16[_0x03bf('0x41')]);return _0x67a827['getDescriptions'](_0x5a9b28);}})[_0x03bf('0x28')](function(_0x21f239){if(_0x21f239){_0x133cdd=_0x21f239[_0x03bf('0x46')];if(!_0x546e16[_0x03bf('0x34')]['hasOwnProperty']('nolimit')){_0x5a9b28['limit']=qs[_0x03bf('0x21')](_0x546e16['query'][_0x03bf('0x21')]);_0x5a9b28[_0x03bf('0x20')]=qs[_0x03bf('0x20')](_0x546e16[_0x03bf('0x34')][_0x03bf('0x20')]);}return _0x67a827['getDescriptions'](_0x5a9b28);}})[_0x03bf('0x28')](function(_0x185941){if(_0x185941){return _0x185941?{'count':_0x133cdd,'rows':_0x185941}:null;}})[_0x03bf('0x28')](respondWithResult(_0xe1e4bd,null))[_0x03bf('0x49')](handleError(_0xe1e4bd,null));}; \ No newline at end of file +var _0x66da=['destroy','error','send','ZohoConfiguration','rawAttributes','fieldName','key','model','map','name','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','type','VIRTUAL','filter','merge','options','includeAll','findAll','catch','include','find','create','body','params','getFields','hasOwnProperty','findOne','ZohoField','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','undefined','offset','count','limit','set','Content-Range','json','apply','reject','save','update','then'];(function(_0x1e1ff5,_0x4ff315){var _0x391865=function(_0x76c323){while(--_0x76c323){_0x1e1ff5['push'](_0x1e1ff5['shift']());}};_0x391865(++_0x4ff315);}(_0x66da,0xc9));var _0xa66d=function(_0x8e9386,_0x3cc60f){_0x8e9386=_0x8e9386-0x0;var _0x4abf26=_0x66da[_0x8e9386];return _0x4abf26;};'use strict';var emlformat=require(_0xa66d('0x0'));var rimraf=require(_0xa66d('0x1'));var zipdir=require(_0xa66d('0x2'));var jsonpatch=require(_0xa66d('0x3'));var rp=require(_0xa66d('0x4'));var moment=require('moment');var BPromise=require(_0xa66d('0x5'));var Mustache=require(_0xa66d('0x6'));var util=require(_0xa66d('0x7'));var path=require('path');var sox=require(_0xa66d('0x8'));var csv=require(_0xa66d('0x9'));var ejs=require(_0xa66d('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa66d('0xb'));var squel=require(_0xa66d('0xc'));var crypto=require(_0xa66d('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa66d('0x9'));var querystring=require(_0xa66d('0xe'));var Papa=require(_0xa66d('0xf'));var Redis=require(_0xa66d('0x10'));var authService=require(_0xa66d('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa66d('0x12'));var logger=require(_0xa66d('0x13'))(_0xa66d('0x14'));var utils=require(_0xa66d('0x15'));var config=require(_0xa66d('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xa66d('0x17'))['db'];function respondWithStatusCode(_0x375269,_0x10dd8e){_0x10dd8e=_0x10dd8e||0xcc;return function(_0x3fb23f){if(_0x3fb23f){return _0x375269[_0xa66d('0x18')](_0x10dd8e);}return _0x375269['status'](_0x10dd8e)[_0xa66d('0x19')]();};}function respondWithResult(_0x2170fc,_0x5f407a){_0x5f407a=_0x5f407a||0xc8;return function(_0x2a006b){if(_0x2a006b){return _0x2170fc[_0xa66d('0x1a')](_0x5f407a)['json'](_0x2a006b);}};}function respondWithFilteredResult(_0x5d8f66,_0x624042){return function(_0xa471e6){if(_0xa471e6){var _0x48a2ac=typeof _0x624042['offset']===_0xa66d('0x1b')&&typeof _0x624042['limit']===_0xa66d('0x1b');var _0x2f97b8=_0xa471e6['count'];var _0x50ab42=_0x48a2ac?0x0:_0x624042[_0xa66d('0x1c')];var _0x463811=_0x48a2ac?_0xa471e6[_0xa66d('0x1d')]:_0x624042[_0xa66d('0x1c')]+_0x624042[_0xa66d('0x1e')];var _0x2713e2;if(_0x463811>=_0x2f97b8){_0x463811=_0x2f97b8;_0x2713e2=0xc8;}else{_0x2713e2=0xce;}_0x5d8f66['status'](_0x2713e2);return _0x5d8f66[_0xa66d('0x1f')](_0xa66d('0x20'),_0x50ab42+'-'+_0x463811+'/'+_0x2f97b8)[_0xa66d('0x21')](_0xa471e6);}return null;};}function patchUpdates(_0x5561c3){return function(_0x1a3f70){try{jsonpatch[_0xa66d('0x22')](_0x1a3f70,_0x5561c3,!![]);}catch(_0x59c096){return BPromise[_0xa66d('0x23')](_0x59c096);}return _0x1a3f70[_0xa66d('0x24')]();};}function saveUpdates(_0x3936ac,_0x123122){return function(_0x5ae2c7){if(_0x5ae2c7){return _0x5ae2c7[_0xa66d('0x25')](_0x3936ac)[_0xa66d('0x26')](function(_0x4bf278){return _0x4bf278;});}return null;};}function removeEntity(_0x2d651c,_0x10b973){return function(_0x59cd0c){if(_0x59cd0c){return _0x59cd0c[_0xa66d('0x27')]()[_0xa66d('0x26')](function(){_0x2d651c['status'](0xcc)[_0xa66d('0x19')]();});}};}function handleEntityNotFound(_0x2e0849,_0x324f7c){return function(_0x3e425d){if(!_0x3e425d){_0x2e0849[_0xa66d('0x18')](0x194);}return _0x3e425d;};}function handleError(_0x2effe5,_0x24d55e){_0x24d55e=_0x24d55e||0x1f4;return function(_0x321ce1){logger[_0xa66d('0x28')](_0x321ce1['stack']);if(_0x321ce1['name']){delete _0x321ce1['name'];}_0x2effe5['status'](_0x24d55e)[_0xa66d('0x29')](_0x321ce1);};}exports['index']=function(_0x3f74c5,_0x5678fa){var _0x38e4ed={},_0x461172={},_0x35e4ec={'count':0x0,'rows':[]};var _0x48ace3=_['map'](db[_0xa66d('0x2a')][_0xa66d('0x2b')],function(_0x2c7d44){return{'name':_0x2c7d44[_0xa66d('0x2c')],'type':_0x2c7d44['type'][_0xa66d('0x2d')]};});_0x461172[_0xa66d('0x2e')]=_[_0xa66d('0x2f')](_0x48ace3,_0xa66d('0x30'));_0x461172[_0xa66d('0x31')]=_[_0xa66d('0x32')](_0x3f74c5['query']);_0x461172[_0xa66d('0x33')]=_[_0xa66d('0x34')](_0x461172[_0xa66d('0x2e')],_0x461172[_0xa66d('0x31')]);_0x38e4ed[_0xa66d('0x35')]=_[_0xa66d('0x34')](_0x461172[_0xa66d('0x2e')],qs[_0xa66d('0x36')](_0x3f74c5[_0xa66d('0x31')]['fields']));_0x38e4ed[_0xa66d('0x35')]=_0x38e4ed[_0xa66d('0x35')][_0xa66d('0x37')]?_0x38e4ed['attributes']:_0x461172[_0xa66d('0x2e')];if(!_0x3f74c5[_0xa66d('0x31')]['hasOwnProperty'](_0xa66d('0x38'))){_0x38e4ed[_0xa66d('0x1e')]=qs['limit'](_0x3f74c5['query']['limit']);_0x38e4ed[_0xa66d('0x1c')]=qs[_0xa66d('0x1c')](_0x3f74c5[_0xa66d('0x31')][_0xa66d('0x1c')]);}_0x38e4ed[_0xa66d('0x39')]=qs[_0xa66d('0x3a')](_0x3f74c5[_0xa66d('0x31')][_0xa66d('0x3a')]);_0x38e4ed[_0xa66d('0x3b')]=qs[_0xa66d('0x33')](_[_0xa66d('0x3c')](_0x3f74c5[_0xa66d('0x31')],_0x461172[_0xa66d('0x33')]),_0x48ace3);if(_0x3f74c5[_0xa66d('0x31')]['filter']){_0x38e4ed[_0xa66d('0x3b')]=_['merge'](_0x38e4ed[_0xa66d('0x3b')],{'$or':_[_0xa66d('0x2f')](_0x48ace3,function(_0x404489){if(_0x404489[_0xa66d('0x3d')]!==_0xa66d('0x3e')){var _0x1a76a0={};_0x1a76a0[_0x404489[_0xa66d('0x30')]]={'$like':'%'+_0x3f74c5[_0xa66d('0x31')][_0xa66d('0x3f')]+'%'};return _0x1a76a0;}})});}_0x38e4ed=_[_0xa66d('0x40')]({},_0x38e4ed,_0x3f74c5[_0xa66d('0x41')]);var _0x1f7e99={'where':_0x38e4ed['where']};return db[_0xa66d('0x2a')]['count'](_0x1f7e99)[_0xa66d('0x26')](function(_0x656d88){_0x35e4ec[_0xa66d('0x1d')]=_0x656d88;if(_0x3f74c5[_0xa66d('0x31')][_0xa66d('0x42')]){_0x38e4ed['include']=[{'all':!![]}];}return db[_0xa66d('0x2a')][_0xa66d('0x43')](_0x38e4ed);})[_0xa66d('0x26')](function(_0x43b4d9){_0x35e4ec['rows']=_0x43b4d9;return _0x35e4ec;})[_0xa66d('0x26')](respondWithFilteredResult(_0x5678fa,_0x38e4ed))[_0xa66d('0x44')](handleError(_0x5678fa,null));};exports['show']=function(_0x460810,_0x106793){var _0x46f546={'raw':![],'where':{'id':_0x460810['params']['id']}},_0x1268ee={};_0x1268ee[_0xa66d('0x2e')]=_[_0xa66d('0x32')](db[_0xa66d('0x2a')]['rawAttributes']);_0x1268ee[_0xa66d('0x31')]=_[_0xa66d('0x32')](_0x460810[_0xa66d('0x31')]);_0x1268ee[_0xa66d('0x33')]=_['intersection'](_0x1268ee['model'],_0x1268ee['query']);_0x46f546['attributes']=_['intersection'](_0x1268ee['model'],qs[_0xa66d('0x36')](_0x460810[_0xa66d('0x31')]['fields']));_0x46f546['attributes']=_0x46f546[_0xa66d('0x35')][_0xa66d('0x37')]?_0x46f546[_0xa66d('0x35')]:_0x1268ee[_0xa66d('0x2e')];if(_0x460810[_0xa66d('0x31')]['includeAll']){_0x46f546[_0xa66d('0x45')]=[{'all':!![]}];}_0x46f546=_[_0xa66d('0x40')]({},_0x46f546,_0x460810[_0xa66d('0x41')]);return db['ZohoConfiguration'][_0xa66d('0x46')](_0x46f546)[_0xa66d('0x26')](handleEntityNotFound(_0x106793,null))['then'](respondWithResult(_0x106793,null))[_0xa66d('0x44')](handleError(_0x106793,null));};exports[_0xa66d('0x47')]=function(_0x2c40a5,_0x60c41f){return db['ZohoConfiguration'][_0xa66d('0x47')](_0x2c40a5[_0xa66d('0x48')],{})[_0xa66d('0x26')](respondWithResult(_0x60c41f,0xc9))['catch'](handleError(_0x60c41f,null));};exports[_0xa66d('0x25')]=function(_0x506e36,_0x327eb0){if(_0x506e36[_0xa66d('0x48')]['id']){delete _0x506e36[_0xa66d('0x48')]['id'];}return db[_0xa66d('0x2a')][_0xa66d('0x46')]({'where':{'id':_0x506e36[_0xa66d('0x49')]['id']}})[_0xa66d('0x26')](handleEntityNotFound(_0x327eb0,null))[_0xa66d('0x26')](saveUpdates(_0x506e36[_0xa66d('0x48')],null))['then'](respondWithResult(_0x327eb0,null))[_0xa66d('0x44')](handleError(_0x327eb0,null));};exports[_0xa66d('0x27')]=function(_0x1e4399,_0x1f7b48){return db['ZohoConfiguration'][_0xa66d('0x46')]({'where':{'id':_0x1e4399[_0xa66d('0x49')]['id']}})[_0xa66d('0x26')](handleEntityNotFound(_0x1f7b48,null))[_0xa66d('0x26')](removeEntity(_0x1f7b48,null))[_0xa66d('0x44')](handleError(_0x1f7b48,null));};exports[_0xa66d('0x4a')]=function(_0x42800f,_0x38eb8a,_0x1dcb39){var _0x5def6f={};var _0x2f64a1={};var _0x312984;var _0x244d0d;return db[_0xa66d('0x2a')]['findOne']({'where':{'id':_0x42800f[_0xa66d('0x49')]['id']}})[_0xa66d('0x26')](handleEntityNotFound(_0x38eb8a,null))[_0xa66d('0x26')](function(_0x97a172){if(_0x97a172){_0x312984=_0x97a172;_0x2f64a1[_0xa66d('0x2e')]=_[_0xa66d('0x32')](db['ZohoField']['rawAttributes']);_0x2f64a1[_0xa66d('0x31')]=_[_0xa66d('0x32')](_0x42800f[_0xa66d('0x31')]);_0x2f64a1[_0xa66d('0x33')]=_[_0xa66d('0x34')](_0x2f64a1[_0xa66d('0x2e')],_0x2f64a1[_0xa66d('0x31')]);_0x5def6f[_0xa66d('0x35')]=_[_0xa66d('0x34')](_0x2f64a1[_0xa66d('0x2e')],qs['fields'](_0x42800f['query'][_0xa66d('0x36')]));_0x5def6f[_0xa66d('0x35')]=_0x5def6f[_0xa66d('0x35')][_0xa66d('0x37')]?_0x5def6f[_0xa66d('0x35')]:_0x2f64a1['model'];_0x5def6f[_0xa66d('0x39')]=qs[_0xa66d('0x3a')](_0x42800f[_0xa66d('0x31')]['sort']);_0x5def6f[_0xa66d('0x3b')]=qs[_0xa66d('0x33')](_[_0xa66d('0x3c')](_0x42800f[_0xa66d('0x31')],_0x2f64a1['filters']));if(_0x42800f[_0xa66d('0x31')][_0xa66d('0x3f')]){_0x5def6f[_0xa66d('0x3b')]=_[_0xa66d('0x40')](_0x5def6f[_0xa66d('0x3b')],{'$or':_[_0xa66d('0x2f')](_0x5def6f['attributes'],function(_0x27614c){var _0xe94e5e={};_0xe94e5e[_0x27614c]={'$like':'%'+_0x42800f[_0xa66d('0x31')][_0xa66d('0x3f')]+'%'};return _0xe94e5e;})});}_0x5def6f=_[_0xa66d('0x40')]({},_0x5def6f,_0x42800f['options']);return _0x312984[_0xa66d('0x4a')](_0x5def6f);}})[_0xa66d('0x26')](function(_0x11be7b){if(_0x11be7b){_0x244d0d=_0x11be7b[_0xa66d('0x37')];if(!_0x42800f[_0xa66d('0x31')][_0xa66d('0x4b')](_0xa66d('0x38'))){_0x5def6f['limit']=qs[_0xa66d('0x1e')](_0x42800f['query']['limit']);_0x5def6f[_0xa66d('0x1c')]=qs[_0xa66d('0x1c')](_0x42800f[_0xa66d('0x31')][_0xa66d('0x1c')]);}return _0x312984['getFields'](_0x5def6f);}})[_0xa66d('0x26')](function(_0x5bcbd0){if(_0x5bcbd0){return _0x5bcbd0?{'count':_0x244d0d,'rows':_0x5bcbd0}:null;}})[_0xa66d('0x26')](respondWithResult(_0x38eb8a,null))[_0xa66d('0x44')](handleError(_0x38eb8a,null));};exports['getSubjects']=function(_0x212fff,_0xf82e82,_0x4dfde5){var _0x586628={};var _0x2111b3={};var _0x337f50;var _0x4ecd0b;return db[_0xa66d('0x2a')][_0xa66d('0x4c')]({'where':{'id':_0x212fff[_0xa66d('0x49')]['id']}})[_0xa66d('0x26')](handleEntityNotFound(_0xf82e82,null))[_0xa66d('0x26')](function(_0x1ad85f){if(_0x1ad85f){_0x337f50=_0x1ad85f;_0x2111b3[_0xa66d('0x2e')]=_[_0xa66d('0x32')](db[_0xa66d('0x4d')][_0xa66d('0x2b')]);_0x2111b3['query']=_['keys'](_0x212fff['query']);_0x2111b3[_0xa66d('0x33')]=_[_0xa66d('0x34')](_0x2111b3[_0xa66d('0x2e')],_0x2111b3[_0xa66d('0x31')]);_0x586628[_0xa66d('0x35')]=_[_0xa66d('0x34')](_0x2111b3[_0xa66d('0x2e')],qs[_0xa66d('0x36')](_0x212fff[_0xa66d('0x31')]['fields']));_0x586628[_0xa66d('0x35')]=_0x586628[_0xa66d('0x35')]['length']?_0x586628[_0xa66d('0x35')]:_0x2111b3['model'];_0x586628[_0xa66d('0x39')]=qs[_0xa66d('0x3a')](_0x212fff[_0xa66d('0x31')]['sort']);_0x586628[_0xa66d('0x3b')]=qs[_0xa66d('0x33')](_[_0xa66d('0x3c')](_0x212fff['query'],_0x2111b3[_0xa66d('0x33')]));if(_0x212fff[_0xa66d('0x31')][_0xa66d('0x3f')]){_0x586628[_0xa66d('0x3b')]=_[_0xa66d('0x40')](_0x586628['where'],{'$or':_['map'](_0x586628['attributes'],function(_0xc8c477){var _0x3d20a5={};_0x3d20a5[_0xc8c477]={'$like':'%'+_0x212fff['query'][_0xa66d('0x3f')]+'%'};return _0x3d20a5;})});}_0x586628=_[_0xa66d('0x40')]({},_0x586628,_0x212fff[_0xa66d('0x41')]);return _0x337f50[_0xa66d('0x4e')](_0x586628);}})[_0xa66d('0x26')](function(_0xafbb83){if(_0xafbb83){_0x4ecd0b=_0xafbb83[_0xa66d('0x37')];if(!_0x212fff[_0xa66d('0x31')][_0xa66d('0x4b')](_0xa66d('0x38'))){_0x586628[_0xa66d('0x1e')]=qs[_0xa66d('0x1e')](_0x212fff[_0xa66d('0x31')][_0xa66d('0x1e')]);_0x586628[_0xa66d('0x1c')]=qs[_0xa66d('0x1c')](_0x212fff[_0xa66d('0x31')][_0xa66d('0x1c')]);}return _0x337f50[_0xa66d('0x4e')](_0x586628);}})['then'](function(_0x5cff9a){if(_0x5cff9a){return _0x5cff9a?{'count':_0x4ecd0b,'rows':_0x5cff9a}:null;}})['then'](respondWithResult(_0xf82e82,null))[_0xa66d('0x44')](handleError(_0xf82e82,null));};exports[_0xa66d('0x4f')]=function(_0x246718,_0x372726,_0x5f4fe5){var _0x430924={};var _0x23acbf={};var _0x2c8d5f;var _0x3f57d3;return db[_0xa66d('0x2a')]['findOne']({'where':{'id':_0x246718[_0xa66d('0x49')]['id']}})[_0xa66d('0x26')](handleEntityNotFound(_0x372726,null))[_0xa66d('0x26')](function(_0x6d1569){if(_0x6d1569){_0x2c8d5f=_0x6d1569;_0x23acbf[_0xa66d('0x2e')]=_[_0xa66d('0x32')](db['ZohoField'][_0xa66d('0x2b')]);_0x23acbf[_0xa66d('0x31')]=_[_0xa66d('0x32')](_0x246718[_0xa66d('0x31')]);_0x23acbf[_0xa66d('0x33')]=_[_0xa66d('0x34')](_0x23acbf['model'],_0x23acbf['query']);_0x430924[_0xa66d('0x35')]=_[_0xa66d('0x34')](_0x23acbf[_0xa66d('0x2e')],qs[_0xa66d('0x36')](_0x246718['query'][_0xa66d('0x36')]));_0x430924[_0xa66d('0x35')]=_0x430924[_0xa66d('0x35')][_0xa66d('0x37')]?_0x430924['attributes']:_0x23acbf[_0xa66d('0x2e')];_0x430924[_0xa66d('0x39')]=qs['sort'](_0x246718[_0xa66d('0x31')][_0xa66d('0x3a')]);_0x430924[_0xa66d('0x3b')]=qs[_0xa66d('0x33')](_['pick'](_0x246718['query'],_0x23acbf['filters']));if(_0x246718[_0xa66d('0x31')][_0xa66d('0x3f')]){_0x430924[_0xa66d('0x3b')]=_[_0xa66d('0x40')](_0x430924[_0xa66d('0x3b')],{'$or':_[_0xa66d('0x2f')](_0x430924[_0xa66d('0x35')],function(_0x40e838){var _0xbcbed6={};_0xbcbed6[_0x40e838]={'$like':'%'+_0x246718[_0xa66d('0x31')][_0xa66d('0x3f')]+'%'};return _0xbcbed6;})});}_0x430924=_[_0xa66d('0x40')]({},_0x430924,_0x246718['options']);return _0x2c8d5f[_0xa66d('0x4f')](_0x430924);}})[_0xa66d('0x26')](function(_0x1bd41a){if(_0x1bd41a){_0x3f57d3=_0x1bd41a[_0xa66d('0x37')];if(!_0x246718[_0xa66d('0x31')][_0xa66d('0x4b')](_0xa66d('0x38'))){_0x430924[_0xa66d('0x1e')]=qs['limit'](_0x246718[_0xa66d('0x31')]['limit']);_0x430924[_0xa66d('0x1c')]=qs[_0xa66d('0x1c')](_0x246718['query'][_0xa66d('0x1c')]);}return _0x2c8d5f[_0xa66d('0x4f')](_0x430924);}})[_0xa66d('0x26')](function(_0x1f82ff){if(_0x1f82ff){return _0x1f82ff?{'count':_0x3f57d3,'rows':_0x1f82ff}:null;}})['then'](respondWithResult(_0x372726,null))['catch'](handleError(_0x372726,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index ecb2907..05fa923 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 _0x815f=['moment','path','../../config/environment','./intZohoConfiguration.attributes','exports','define','lodash','util','../../config/logger','api'];(function(_0x57da0a,_0x284aed){var _0x3145d5=function(_0xfe7c3b){while(--_0xfe7c3b){_0x57da0a['push'](_0x57da0a['shift']());}};_0x3145d5(++_0x284aed);}(_0x815f,0x74));var _0xf815=function(_0x58ccd5,_0x1f3697){_0x58ccd5=_0x58ccd5-0x0;var _0x7c4be2=_0x815f[_0x58ccd5];return _0x7c4be2;};'use strict';var _=require(_0xf815('0x0'));var util=require(_0xf815('0x1'));var logger=require(_0xf815('0x2'))(_0xf815('0x3'));var moment=require(_0xf815('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf815('0x5'));var rimraf=require('rimraf');var config=require(_0xf815('0x6'));var attributes=require(_0xf815('0x7'));module[_0xf815('0x8')]=function(_0x4e2a98,_0x27fdf0){return _0x4e2a98[_0xf815('0x9')]('ZohoConfiguration',attributes,{'tableName':'int_zoho_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x17ec=['util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','ZohoConfiguration','lodash'];(function(_0x305016,_0x4937f3){var _0x46a0a3=function(_0x545942){while(--_0x545942){_0x305016['push'](_0x305016['shift']());}};_0x46a0a3(++_0x4937f3);}(_0x17ec,0x1a3));var _0xc17e=function(_0x430d92,_0x468681){_0x430d92=_0x430d92-0x0;var _0x4df196=_0x17ec[_0x430d92];return _0x4df196;};'use strict';var _=require(_0xc17e('0x0'));var util=require(_0xc17e('0x1'));var logger=require(_0xc17e('0x2'))(_0xc17e('0x3'));var moment=require(_0xc17e('0x4'));var BPromise=require(_0xc17e('0x5'));var rp=require(_0xc17e('0x6'));var fs=require('fs');var path=require(_0xc17e('0x7'));var rimraf=require('rimraf');var config=require(_0xc17e('0x8'));var attributes=require('./intZohoConfiguration.attributes');module[_0xc17e('0x9')]=function(_0xcc1d19,_0x368436){return _0xcc1d19[_0xc17e('0xa')](_0xc17e('0xb'),attributes,{'tableName':'int_zoho_configurations','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 3522435..9bc9b1d 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 _0x0892=['result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','ZohoConfiguration,\x20%s,\x20%s','message'];(function(_0x221a05,_0x26d7c){var _0xe32384=function(_0x196632){while(--_0x196632){_0x221a05['push'](_0x221a05['shift']());}};_0xe32384(++_0x26d7c);}(_0x0892,0x1a6));var _0x2089=function(_0x1dfe25,_0x10cdde){_0x1dfe25=_0x1dfe25-0x0;var _0x37a605=_0x0892[_0x1dfe25];return _0x37a605;};'use strict';var _=require(_0x2089('0x0'));var util=require('util');var moment=require(_0x2089('0x1'));var BPromise=require(_0x2089('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2089('0x3'));var db=require(_0x2089('0x4'))['db'];var utils=require(_0x2089('0x5'));var logger=require(_0x2089('0x6'))('rpc');var config=require(_0x2089('0x7'));var jayson=require(_0x2089('0x8'));var client=jayson[_0x2089('0x9')][_0x2089('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x7060fb,_0x396064,_0x42d355){return new BPromise(function(_0x371ffc,_0x467136){return client[_0x2089('0xb')](_0x7060fb,_0x42d355)['then'](function(_0x194f12){logger['info']('ZohoConfiguration,\x20%s,\x20%s',_0x396064,'request\x20sent');logger['debug'](_0x2089('0xc'),_0x396064,'request\x20sent',JSON[_0x2089('0xd')](_0x194f12));if(_0x194f12['error']){if(_0x194f12[_0x2089('0xe')][_0x2089('0xf')]===0x1f4){logger['error'](_0x2089('0x10'),_0x396064,_0x194f12[_0x2089('0xe')]['message']);return _0x467136(_0x194f12[_0x2089('0xe')][_0x2089('0x11')]);}logger[_0x2089('0xe')]('ZohoConfiguration,\x20%s,\x20%s',_0x396064,_0x194f12[_0x2089('0xe')][_0x2089('0x11')]);return _0x371ffc(_0x194f12[_0x2089('0xe')]['message']);}else{logger['info'](_0x2089('0x10'),_0x396064,'request\x20sent');_0x371ffc(_0x194f12[_0x2089('0x12')][_0x2089('0x11')]);}})[_0x2089('0x13')](function(_0x478563){logger[_0x2089('0xe')](_0x2089('0x10'),_0x396064,_0x478563);_0x467136(_0x478563);});});} \ No newline at end of file +var _0xf549=['ZohoConfiguration,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info'];(function(_0x29b948,_0xd1e59b){var _0x32fb00=function(_0x5dcbd6){while(--_0x5dcbd6){_0x29b948['push'](_0x29b948['shift']());}};_0x32fb00(++_0xd1e59b);}(_0xf549,0x178));var _0x9f54=function(_0xada38c,_0x550eb8){_0xada38c=_0xada38c-0x0;var _0x26545b=_0xf549[_0xada38c];return _0x26545b;};'use strict';var _=require(_0x9f54('0x0'));var util=require(_0x9f54('0x1'));var moment=require(_0x9f54('0x2'));var BPromise=require(_0x9f54('0x3'));var rs=require(_0x9f54('0x4'));var fs=require('fs');var Redis=require(_0x9f54('0x5'));var db=require(_0x9f54('0x6'))['db'];var utils=require(_0x9f54('0x7'));var logger=require(_0x9f54('0x8'))(_0x9f54('0x9'));var config=require(_0x9f54('0xa'));var jayson=require(_0x9f54('0xb'));var client=jayson[_0x9f54('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2441ff,_0x539676,_0x21d953){return new BPromise(function(_0x1d8de5,_0x3fc5ad){return client[_0x9f54('0xd')](_0x2441ff,_0x21d953)['then'](function(_0x12f907){logger[_0x9f54('0xe')](_0x9f54('0xf'),_0x539676,'request\x20sent');logger[_0x9f54('0x10')]('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x539676,_0x9f54('0x11'),JSON[_0x9f54('0x12')](_0x12f907));if(_0x12f907[_0x9f54('0x13')]){if(_0x12f907['error'][_0x9f54('0x14')]===0x1f4){logger['error']('ZohoConfiguration,\x20%s,\x20%s',_0x539676,_0x12f907['error'][_0x9f54('0x15')]);return _0x3fc5ad(_0x12f907['error']['message']);}logger[_0x9f54('0x13')]('ZohoConfiguration,\x20%s,\x20%s',_0x539676,_0x12f907[_0x9f54('0x13')][_0x9f54('0x15')]);return _0x1d8de5(_0x12f907[_0x9f54('0x13')][_0x9f54('0x15')]);}else{logger[_0x9f54('0xe')]('ZohoConfiguration,\x20%s,\x20%s',_0x539676,_0x9f54('0x11'));_0x1d8de5(_0x12f907[_0x9f54('0x16')][_0x9f54('0x15')]);}})['catch'](function(_0x22047c){logger[_0x9f54('0x13')](_0x9f54('0xf'),_0x539676,_0x22047c);_0x3fc5ad(_0x22047c);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 796afd6..e71e8de 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 _0x80a8=['./intZohoField.controller','get','isAuthenticated','/:id','delete','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x355fdc,_0x1d9886){var _0x3fe99a=function(_0x34ee99){while(--_0x34ee99){_0x355fdc['push'](_0x355fdc['shift']());}};_0x3fe99a(++_0x1d9886);}(_0x80a8,0x1aa));var _0x880a=function(_0x3c1312,_0x45bfdb){_0x3c1312=_0x3c1312-0x0;var _0x5b4831=_0x80a8[_0x3c1312];return _0x5b4831;};'use strict';var multer=require(_0x880a('0x0'));var util=require('util');var path=require(_0x880a('0x1'));var timeout=require('connect-timeout');var express=require(_0x880a('0x2'));var router=express[_0x880a('0x3')]();var fs_extra=require(_0x880a('0x4'));var auth=require(_0x880a('0x5'));var interaction=require(_0x880a('0x6'));var config=require(_0x880a('0x7'));var controller=require(_0x880a('0x8'));router[_0x880a('0x9')]('/',auth[_0x880a('0xa')](),controller['index']);router[_0x880a('0x9')]('/:id',auth[_0x880a('0xa')](),controller['show']);router['post']('/',auth[_0x880a('0xa')](),controller['create']);router['put'](_0x880a('0xb'),auth[_0x880a('0xa')](),controller['update']);router[_0x880a('0xc')](_0x880a('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x880a('0xd')]=router; \ No newline at end of file +var _0xbca2=['/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intZohoField.controller','isAuthenticated','index','get'];(function(_0x20012f,_0x53c28e){var _0x74e7ce=function(_0x39297f){while(--_0x39297f){_0x20012f['push'](_0x20012f['shift']());}};_0x74e7ce(++_0x53c28e);}(_0xbca2,0x9c));var _0x2bca=function(_0x1a7550,_0x1edace){_0x1a7550=_0x1a7550-0x0;var _0x426e22=_0xbca2[_0x1a7550];return _0x426e22;};'use strict';var multer=require(_0x2bca('0x0'));var util=require(_0x2bca('0x1'));var path=require(_0x2bca('0x2'));var timeout=require('connect-timeout');var express=require(_0x2bca('0x3'));var router=express[_0x2bca('0x4')]();var fs_extra=require(_0x2bca('0x5'));var auth=require(_0x2bca('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x2bca('0x7'));var controller=require(_0x2bca('0x8'));router['get']('/',auth[_0x2bca('0x9')](),controller[_0x2bca('0xa')]);router[_0x2bca('0xb')](_0x2bca('0xc'),auth['isAuthenticated'](),controller[_0x2bca('0xd')]);router[_0x2bca('0xe')]('/',auth[_0x2bca('0x9')](),controller[_0x2bca('0xf')]);router[_0x2bca('0x10')](_0x2bca('0xc'),auth[_0x2bca('0x9')](),controller[_0x2bca('0x11')]);router[_0x2bca('0x12')](_0x2bca('0xc'),auth[_0x2bca('0x9')](),controller[_0x2bca('0x13')]);module[_0x2bca('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 6f10c67..a5ec402 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 _0x7f57=['ENUM','BOOLEAN','exports','string','variable','customVariable','keyValue','picklist','STRING'];(function(_0x3599cd,_0x585a06){var _0x3609fc=function(_0x15089e){while(--_0x15089e){_0x3599cd['push'](_0x3599cd['shift']());}};_0x3609fc(++_0x585a06);}(_0x7f57,0x14f));var _0x77f5=function(_0x1a72f3,_0x217011){_0x1a72f3=_0x1a72f3-0x0;var _0x57ef47=_0x7f57[_0x1a72f3];return _0x57ef47;};'use strict';var Sequelize=require('sequelize');module[_0x77f5('0x0')]={'type':{'type':Sequelize['ENUM'](_0x77f5('0x1'),_0x77f5('0x2'),_0x77f5('0x3'),_0x77f5('0x4'),_0x77f5('0x5')),'defaultValue':_0x77f5('0x1')},'content':{'type':Sequelize[_0x77f5('0x6')]},'key':{'type':Sequelize[_0x77f5('0x6')]},'keyType':{'type':Sequelize[_0x77f5('0x7')]('string',_0x77f5('0x2'),_0x77f5('0x3'))},'keyContent':{'type':Sequelize[_0x77f5('0x6')]},'idField':{'type':Sequelize[_0x77f5('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x77f5('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x50eb=['STRING','ENUM','BOOLEAN','string','customVariable','keyValue'];(function(_0x1b6186,_0x1ec7f2){var _0x186121=function(_0x1748a8){while(--_0x1748a8){_0x1b6186['push'](_0x1b6186['shift']());}};_0x186121(++_0x1ec7f2);}(_0x50eb,0x6f));var _0xb50e=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x50eb[_0x199572];return _0x13cfa3;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize['ENUM'](_0xb50e('0x0'),'variable',_0xb50e('0x1'),_0xb50e('0x2'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xb50e('0x3')]},'keyType':{'type':Sequelize[_0xb50e('0x4')]('string','variable',_0xb50e('0x1'))},'keyContent':{'type':Sequelize[_0xb50e('0x3')]},'idField':{'type':Sequelize[_0xb50e('0x3')]},'nameField':{'type':Sequelize[_0xb50e('0x3')]},'customField':{'type':Sequelize[_0xb50e('0x5')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb50e('0x3')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index f422365..93e55ca 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 _0x19a8=['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','../../mysqldb','sendStatus','status','json','offset','undefined','limit','set','Content-Range','reject','save','update','destroy','error','stack','name','send','index','rawAttributes','fieldName','type','key','map','keys','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','ZohoField','count','then','includeAll','include','findAll','rows','catch','params','find','create','body','eml-format','rimraf','request-promise','mustache'];(function(_0x50ce69,_0x1f26cb){var _0xee265a=function(_0x7562d0){while(--_0x7562d0){_0x50ce69['push'](_0x50ce69['shift']());}};_0xee265a(++_0x1f26cb);}(_0x19a8,0x120));var _0x819a=function(_0x3ca4b4,_0x5718e0){_0x3ca4b4=_0x3ca4b4-0x0;var _0x27061a=_0x19a8[_0x3ca4b4];return _0x27061a;};'use strict';var emlformat=require(_0x819a('0x0'));var rimraf=require(_0x819a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x819a('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x819a('0x3'));var util=require(_0x819a('0x4'));var path=require(_0x819a('0x5'));var sox=require('sox');var csv=require(_0x819a('0x6'));var ejs=require(_0x819a('0x7'));var fs=require('fs');var fs_extra=require(_0x819a('0x8'));var _=require(_0x819a('0x9'));var squel=require(_0x819a('0xa'));var crypto=require(_0x819a('0xb'));var jsforce=require(_0x819a('0xc'));var deskjs=require(_0x819a('0xd'));var toCsv=require(_0x819a('0x6'));var querystring=require(_0x819a('0xe'));var Papa=require(_0x819a('0xf'));var Redis=require(_0x819a('0x10'));var authService=require(_0x819a('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x819a('0x12'));var hardwareService=require(_0x819a('0x13'));var logger=require(_0x819a('0x14'))(_0x819a('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x819a('0x16'))['db'];function respondWithStatusCode(_0x3a76dd,_0x505a5b){_0x505a5b=_0x505a5b||0xcc;return function(_0x3e7588){if(_0x3e7588){return _0x3a76dd[_0x819a('0x17')](_0x505a5b);}return _0x3a76dd[_0x819a('0x18')](_0x505a5b)['end']();};}function respondWithResult(_0x4a2e86,_0x93c33d){_0x93c33d=_0x93c33d||0xc8;return function(_0x403a26){if(_0x403a26){return _0x4a2e86[_0x819a('0x18')](_0x93c33d)[_0x819a('0x19')](_0x403a26);}};}function respondWithFilteredResult(_0x41189d,_0x359781){return function(_0x29dc8f){if(_0x29dc8f){var _0x51bedd=typeof _0x359781[_0x819a('0x1a')]===_0x819a('0x1b')&&typeof _0x359781[_0x819a('0x1c')]===_0x819a('0x1b');var _0x13bd2e=_0x29dc8f['count'];var _0x490710=_0x51bedd?0x0:_0x359781[_0x819a('0x1a')];var _0x519d61=_0x51bedd?_0x29dc8f['count']:_0x359781['offset']+_0x359781[_0x819a('0x1c')];var _0x256d6a;if(_0x519d61>=_0x13bd2e){_0x519d61=_0x13bd2e;_0x256d6a=0xc8;}else{_0x256d6a=0xce;}_0x41189d[_0x819a('0x18')](_0x256d6a);return _0x41189d[_0x819a('0x1d')](_0x819a('0x1e'),_0x490710+'-'+_0x519d61+'/'+_0x13bd2e)['json'](_0x29dc8f);}return null;};}function patchUpdates(_0x4f68cd){return function(_0x58aa4d){try{jsonpatch['apply'](_0x58aa4d,_0x4f68cd,!![]);}catch(_0x3858a2){return BPromise[_0x819a('0x1f')](_0x3858a2);}return _0x58aa4d[_0x819a('0x20')]();};}function saveUpdates(_0x1142cf,_0x4251cc){return function(_0x37677b){if(_0x37677b){return _0x37677b[_0x819a('0x21')](_0x1142cf)['then'](function(_0x339f76){return _0x339f76;});}return null;};}function removeEntity(_0x7707a9,_0x393546){return function(_0xb95310){if(_0xb95310){return _0xb95310[_0x819a('0x22')]()['then'](function(){_0x7707a9[_0x819a('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4fbec1,_0x490e75){return function(_0x323bdb){if(!_0x323bdb){_0x4fbec1['sendStatus'](0x194);}return _0x323bdb;};}function handleError(_0x5adfce,_0x53b1a6){_0x53b1a6=_0x53b1a6||0x1f4;return function(_0x4592a0){logger[_0x819a('0x23')](_0x4592a0[_0x819a('0x24')]);if(_0x4592a0[_0x819a('0x25')]){delete _0x4592a0['name'];}_0x5adfce[_0x819a('0x18')](_0x53b1a6)[_0x819a('0x26')](_0x4592a0);};}exports[_0x819a('0x27')]=function(_0x393ce8,_0x160590){var _0x47a6c2={},_0x10ee56={},_0x408bbf={'count':0x0,'rows':[]};var _0x4c88d2=_['map'](db['ZohoField'][_0x819a('0x28')],function(_0x4045db){return{'name':_0x4045db[_0x819a('0x29')],'type':_0x4045db[_0x819a('0x2a')][_0x819a('0x2b')]};});_0x10ee56['model']=_[_0x819a('0x2c')](_0x4c88d2,'name');_0x10ee56['query']=_[_0x819a('0x2d')](_0x393ce8[_0x819a('0x2e')]);_0x10ee56[_0x819a('0x2f')]=_[_0x819a('0x30')](_0x10ee56[_0x819a('0x31')],_0x10ee56[_0x819a('0x2e')]);_0x47a6c2[_0x819a('0x32')]=_[_0x819a('0x30')](_0x10ee56[_0x819a('0x31')],qs['fields'](_0x393ce8[_0x819a('0x2e')][_0x819a('0x33')]));_0x47a6c2[_0x819a('0x32')]=_0x47a6c2['attributes'][_0x819a('0x34')]?_0x47a6c2['attributes']:_0x10ee56['model'];if(!_0x393ce8[_0x819a('0x2e')]['hasOwnProperty'](_0x819a('0x35'))){_0x47a6c2[_0x819a('0x1c')]=qs[_0x819a('0x1c')](_0x393ce8[_0x819a('0x2e')][_0x819a('0x1c')]);_0x47a6c2['offset']=qs[_0x819a('0x1a')](_0x393ce8[_0x819a('0x2e')][_0x819a('0x1a')]);}_0x47a6c2[_0x819a('0x36')]=qs[_0x819a('0x37')](_0x393ce8[_0x819a('0x2e')][_0x819a('0x37')]);_0x47a6c2[_0x819a('0x38')]=qs[_0x819a('0x2f')](_['pick'](_0x393ce8[_0x819a('0x2e')],_0x10ee56[_0x819a('0x2f')]),_0x4c88d2);if(_0x393ce8['query'][_0x819a('0x39')]){_0x47a6c2[_0x819a('0x38')]=_[_0x819a('0x3a')](_0x47a6c2[_0x819a('0x38')],{'$or':_[_0x819a('0x2c')](_0x4c88d2,function(_0x21455b){if(_0x21455b[_0x819a('0x2a')]!==_0x819a('0x3b')){var _0x4215a4={};_0x4215a4[_0x21455b[_0x819a('0x25')]]={'$like':'%'+_0x393ce8[_0x819a('0x2e')][_0x819a('0x39')]+'%'};return _0x4215a4;}})});}_0x47a6c2=_['merge']({},_0x47a6c2,_0x393ce8[_0x819a('0x3c')]);var _0x596ab1={'where':_0x47a6c2[_0x819a('0x38')]};return db[_0x819a('0x3d')][_0x819a('0x3e')](_0x596ab1)[_0x819a('0x3f')](function(_0x434753){_0x408bbf['count']=_0x434753;if(_0x393ce8[_0x819a('0x2e')][_0x819a('0x40')]){_0x47a6c2[_0x819a('0x41')]=[{'all':!![]}];}return db[_0x819a('0x3d')][_0x819a('0x42')](_0x47a6c2);})[_0x819a('0x3f')](function(_0x7383a4){_0x408bbf[_0x819a('0x43')]=_0x7383a4;return _0x408bbf;})[_0x819a('0x3f')](respondWithFilteredResult(_0x160590,_0x47a6c2))[_0x819a('0x44')](handleError(_0x160590,null));};exports['show']=function(_0x13d762,_0x28912f){var _0x35c893={'raw':!![],'where':{'id':_0x13d762[_0x819a('0x45')]['id']}},_0x1062c8={};_0x1062c8['model']=_['keys'](db['ZohoField'][_0x819a('0x28')]);_0x1062c8[_0x819a('0x2e')]=_[_0x819a('0x2d')](_0x13d762[_0x819a('0x2e')]);_0x1062c8[_0x819a('0x2f')]=_[_0x819a('0x30')](_0x1062c8[_0x819a('0x31')],_0x1062c8[_0x819a('0x2e')]);_0x35c893[_0x819a('0x32')]=_['intersection'](_0x1062c8['model'],qs[_0x819a('0x33')](_0x13d762['query'][_0x819a('0x33')]));_0x35c893['attributes']=_0x35c893[_0x819a('0x32')][_0x819a('0x34')]?_0x35c893['attributes']:_0x1062c8['model'];if(_0x13d762[_0x819a('0x2e')]['includeAll']){_0x35c893[_0x819a('0x41')]=[{'all':!![]}];}_0x35c893=_[_0x819a('0x3a')]({},_0x35c893,_0x13d762[_0x819a('0x3c')]);return db[_0x819a('0x3d')][_0x819a('0x46')](_0x35c893)[_0x819a('0x3f')](handleEntityNotFound(_0x28912f,null))[_0x819a('0x3f')](respondWithResult(_0x28912f,null))[_0x819a('0x44')](handleError(_0x28912f,null));};exports[_0x819a('0x47')]=function(_0x25e5bc,_0x1ae24a){return db[_0x819a('0x3d')]['create'](_0x25e5bc['body'],{})[_0x819a('0x3f')](respondWithResult(_0x1ae24a,0xc9))[_0x819a('0x44')](handleError(_0x1ae24a,null));};exports[_0x819a('0x21')]=function(_0x3ced8c,_0x41674c){if(_0x3ced8c[_0x819a('0x48')]['id']){delete _0x3ced8c[_0x819a('0x48')]['id'];}return db[_0x819a('0x3d')]['find']({'where':{'id':_0x3ced8c[_0x819a('0x45')]['id']}})[_0x819a('0x3f')](handleEntityNotFound(_0x41674c,null))['then'](saveUpdates(_0x3ced8c[_0x819a('0x48')],null))[_0x819a('0x3f')](respondWithResult(_0x41674c,null))['catch'](handleError(_0x41674c,null));};exports[_0x819a('0x22')]=function(_0x48a817,_0x47ed5b){return db[_0x819a('0x3d')][_0x819a('0x46')]({'where':{'id':_0x48a817[_0x819a('0x45')]['id']}})[_0x819a('0x3f')](handleEntityNotFound(_0x47ed5b,null))[_0x819a('0x3f')](removeEntity(_0x47ed5b,null))['catch'](handleError(_0x47ed5b,null));}; \ No newline at end of file +var _0xf401=['keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','include','findAll','rows','catch','show','params','length','includeAll','find','body','update','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','fs-extra','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','then','destroy','name','index','map','ZohoField','rawAttributes','fieldName','type','key','model','query'];(function(_0x523315,_0x11b8f5){var _0x2715ac=function(_0x38dc0e){while(--_0x38dc0e){_0x523315['push'](_0x523315['shift']());}};_0x2715ac(++_0x11b8f5);}(_0xf401,0x1b7));var _0x1f40=function(_0x5bb2d2,_0x299b87){_0x5bb2d2=_0x5bb2d2-0x0;var _0x7d4026=_0xf401[_0x5bb2d2];return _0x7d4026;};'use strict';var emlformat=require(_0x1f40('0x0'));var rimraf=require(_0x1f40('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1f40('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x1f40('0x3'));var Mustache=require(_0x1f40('0x4'));var util=require(_0x1f40('0x5'));var path=require(_0x1f40('0x6'));var sox=require(_0x1f40('0x7'));var csv=require(_0x1f40('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1f40('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x1f40('0xa'));var toCsv=require(_0x1f40('0x8'));var querystring=require(_0x1f40('0xb'));var Papa=require(_0x1f40('0xc'));var Redis=require(_0x1f40('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x1f40('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1f40('0xf'));var logger=require(_0x1f40('0x10'))(_0x1f40('0x11'));var utils=require(_0x1f40('0x12'));var config=require(_0x1f40('0x13'));var licenseUtil=require(_0x1f40('0x14'));var db=require(_0x1f40('0x15'))['db'];function respondWithStatusCode(_0x15164b,_0x490bdc){_0x490bdc=_0x490bdc||0xcc;return function(_0x540f78){if(_0x540f78){return _0x15164b[_0x1f40('0x16')](_0x490bdc);}return _0x15164b[_0x1f40('0x17')](_0x490bdc)[_0x1f40('0x18')]();};}function respondWithResult(_0x30887e,_0x2e853c){_0x2e853c=_0x2e853c||0xc8;return function(_0x5e0d44){if(_0x5e0d44){return _0x30887e[_0x1f40('0x17')](_0x2e853c)[_0x1f40('0x19')](_0x5e0d44);}};}function respondWithFilteredResult(_0x1ecc06,_0x36bda5){return function(_0x27b2d0){if(_0x27b2d0){var _0x35934f=typeof _0x36bda5[_0x1f40('0x1a')]==='undefined'&&typeof _0x36bda5[_0x1f40('0x1b')]===_0x1f40('0x1c');var _0x9e2b33=_0x27b2d0[_0x1f40('0x1d')];var _0x104e6d=_0x35934f?0x0:_0x36bda5['offset'];var _0x51f3d5=_0x35934f?_0x27b2d0[_0x1f40('0x1d')]:_0x36bda5[_0x1f40('0x1a')]+_0x36bda5[_0x1f40('0x1b')];var _0x59f474;if(_0x51f3d5>=_0x9e2b33){_0x51f3d5=_0x9e2b33;_0x59f474=0xc8;}else{_0x59f474=0xce;}_0x1ecc06[_0x1f40('0x17')](_0x59f474);return _0x1ecc06[_0x1f40('0x1e')](_0x1f40('0x1f'),_0x104e6d+'-'+_0x51f3d5+'/'+_0x9e2b33)[_0x1f40('0x19')](_0x27b2d0);}return null;};}function patchUpdates(_0x2ffd2b){return function(_0x14598d){try{jsonpatch['apply'](_0x14598d,_0x2ffd2b,!![]);}catch(_0x41acd0){return BPromise['reject'](_0x41acd0);}return _0x14598d['save']();};}function saveUpdates(_0xc41e9e,_0x144989){return function(_0x2c15d8){if(_0x2c15d8){return _0x2c15d8['update'](_0xc41e9e)[_0x1f40('0x20')](function(_0x222a3a){return _0x222a3a;});}return null;};}function removeEntity(_0x183d81,_0x4bad59){return function(_0x33f2d6){if(_0x33f2d6){return _0x33f2d6[_0x1f40('0x21')]()[_0x1f40('0x20')](function(){_0x183d81[_0x1f40('0x17')](0xcc)[_0x1f40('0x18')]();});}};}function handleEntityNotFound(_0x1507e2,_0x5be590){return function(_0x1b612b){if(!_0x1b612b){_0x1507e2[_0x1f40('0x16')](0x194);}return _0x1b612b;};}function handleError(_0x12ffb2,_0x2e88e7){_0x2e88e7=_0x2e88e7||0x1f4;return function(_0x41665a){logger['error'](_0x41665a['stack']);if(_0x41665a[_0x1f40('0x22')]){delete _0x41665a[_0x1f40('0x22')];}_0x12ffb2[_0x1f40('0x17')](_0x2e88e7)['send'](_0x41665a);};}exports[_0x1f40('0x23')]=function(_0x48a093,_0x323e08){var _0x1a3e9a={},_0x9d070={},_0x13a216={'count':0x0,'rows':[]};var _0x1e25bb=_[_0x1f40('0x24')](db[_0x1f40('0x25')][_0x1f40('0x26')],function(_0xca2d39){return{'name':_0xca2d39[_0x1f40('0x27')],'type':_0xca2d39[_0x1f40('0x28')][_0x1f40('0x29')]};});_0x9d070[_0x1f40('0x2a')]=_[_0x1f40('0x24')](_0x1e25bb,_0x1f40('0x22'));_0x9d070[_0x1f40('0x2b')]=_[_0x1f40('0x2c')](_0x48a093[_0x1f40('0x2b')]);_0x9d070[_0x1f40('0x2d')]=_[_0x1f40('0x2e')](_0x9d070[_0x1f40('0x2a')],_0x9d070[_0x1f40('0x2b')]);_0x1a3e9a['attributes']=_[_0x1f40('0x2e')](_0x9d070['model'],qs['fields'](_0x48a093[_0x1f40('0x2b')][_0x1f40('0x2f')]));_0x1a3e9a[_0x1f40('0x30')]=_0x1a3e9a[_0x1f40('0x30')]['length']?_0x1a3e9a[_0x1f40('0x30')]:_0x9d070['model'];if(!_0x48a093[_0x1f40('0x2b')][_0x1f40('0x31')](_0x1f40('0x32'))){_0x1a3e9a['limit']=qs[_0x1f40('0x1b')](_0x48a093[_0x1f40('0x2b')][_0x1f40('0x1b')]);_0x1a3e9a[_0x1f40('0x1a')]=qs[_0x1f40('0x1a')](_0x48a093[_0x1f40('0x2b')]['offset']);}_0x1a3e9a[_0x1f40('0x33')]=qs[_0x1f40('0x34')](_0x48a093[_0x1f40('0x2b')]['sort']);_0x1a3e9a[_0x1f40('0x35')]=qs[_0x1f40('0x2d')](_[_0x1f40('0x36')](_0x48a093[_0x1f40('0x2b')],_0x9d070['filters']),_0x1e25bb);if(_0x48a093[_0x1f40('0x2b')][_0x1f40('0x37')]){_0x1a3e9a[_0x1f40('0x35')]=_['merge'](_0x1a3e9a[_0x1f40('0x35')],{'$or':_[_0x1f40('0x24')](_0x1e25bb,function(_0x2215b6){if(_0x2215b6[_0x1f40('0x28')]!==_0x1f40('0x38')){var _0x55563a={};_0x55563a[_0x2215b6[_0x1f40('0x22')]]={'$like':'%'+_0x48a093[_0x1f40('0x2b')][_0x1f40('0x37')]+'%'};return _0x55563a;}})});}_0x1a3e9a=_[_0x1f40('0x39')]({},_0x1a3e9a,_0x48a093['options']);var _0x39a9c7={'where':_0x1a3e9a['where']};return db[_0x1f40('0x25')][_0x1f40('0x1d')](_0x39a9c7)['then'](function(_0x47a765){_0x13a216[_0x1f40('0x1d')]=_0x47a765;if(_0x48a093['query']['includeAll']){_0x1a3e9a[_0x1f40('0x3a')]=[{'all':!![]}];}return db[_0x1f40('0x25')][_0x1f40('0x3b')](_0x1a3e9a);})['then'](function(_0x185c02){_0x13a216[_0x1f40('0x3c')]=_0x185c02;return _0x13a216;})[_0x1f40('0x20')](respondWithFilteredResult(_0x323e08,_0x1a3e9a))[_0x1f40('0x3d')](handleError(_0x323e08,null));};exports[_0x1f40('0x3e')]=function(_0x54bfcd,_0x523424){var _0x46f522={'raw':!![],'where':{'id':_0x54bfcd[_0x1f40('0x3f')]['id']}},_0x3858ce={};_0x3858ce[_0x1f40('0x2a')]=_['keys'](db['ZohoField'][_0x1f40('0x26')]);_0x3858ce['query']=_[_0x1f40('0x2c')](_0x54bfcd['query']);_0x3858ce[_0x1f40('0x2d')]=_[_0x1f40('0x2e')](_0x3858ce['model'],_0x3858ce['query']);_0x46f522[_0x1f40('0x30')]=_[_0x1f40('0x2e')](_0x3858ce['model'],qs[_0x1f40('0x2f')](_0x54bfcd['query']['fields']));_0x46f522['attributes']=_0x46f522['attributes'][_0x1f40('0x40')]?_0x46f522[_0x1f40('0x30')]:_0x3858ce[_0x1f40('0x2a')];if(_0x54bfcd[_0x1f40('0x2b')][_0x1f40('0x41')]){_0x46f522[_0x1f40('0x3a')]=[{'all':!![]}];}_0x46f522=_['merge']({},_0x46f522,_0x54bfcd['options']);return db['ZohoField'][_0x1f40('0x42')](_0x46f522)[_0x1f40('0x20')](handleEntityNotFound(_0x523424,null))[_0x1f40('0x20')](respondWithResult(_0x523424,null))[_0x1f40('0x3d')](handleError(_0x523424,null));};exports['create']=function(_0x1777f5,_0x5788a4){return db[_0x1f40('0x25')]['create'](_0x1777f5[_0x1f40('0x43')],{})[_0x1f40('0x20')](respondWithResult(_0x5788a4,0xc9))[_0x1f40('0x3d')](handleError(_0x5788a4,null));};exports[_0x1f40('0x44')]=function(_0x2485f3,_0x33a70d){if(_0x2485f3[_0x1f40('0x43')]['id']){delete _0x2485f3[_0x1f40('0x43')]['id'];}return db['ZohoField'][_0x1f40('0x42')]({'where':{'id':_0x2485f3[_0x1f40('0x3f')]['id']}})[_0x1f40('0x20')](handleEntityNotFound(_0x33a70d,null))[_0x1f40('0x20')](saveUpdates(_0x2485f3[_0x1f40('0x43')],null))['then'](respondWithResult(_0x33a70d,null))['catch'](handleError(_0x33a70d,null));};exports[_0x1f40('0x21')]=function(_0xe70b0e,_0xf705fc){return db[_0x1f40('0x25')][_0x1f40('0x42')]({'where':{'id':_0xe70b0e[_0x1f40('0x3f')]['id']}})[_0x1f40('0x20')](handleEntityNotFound(_0xf705fc,null))['then'](removeEntity(_0xf705fc,null))[_0x1f40('0x3d')](handleError(_0xf705fc,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index b2eb762..a70eca5 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 _0x68b3=['../../config/environment','exports','define','ZohoField','int_zoho_fields','zoho_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x1c0ab1,_0x9317ae){var _0xab1b8=function(_0x14cae4){while(--_0x14cae4){_0x1c0ab1['push'](_0x1c0ab1['shift']());}};_0xab1b8(++_0x9317ae);}(_0x68b3,0x1d8));var _0x368b=function(_0x1536ed,_0x179ab6){_0x1536ed=_0x1536ed-0x0;var _0x710eff=_0x68b3[_0x1536ed];return _0x710eff;};'use strict';var _=require(_0x368b('0x0'));var util=require(_0x368b('0x1'));var logger=require(_0x368b('0x2'))(_0x368b('0x3'));var moment=require(_0x368b('0x4'));var BPromise=require('bluebird');var rp=require(_0x368b('0x5'));var fs=require('fs');var path=require(_0x368b('0x6'));var rimraf=require(_0x368b('0x7'));var config=require(_0x368b('0x8'));var attributes=require('./intZohoField.attributes');module[_0x368b('0x9')]=function(_0x41b15b,_0x104dad){return _0x41b15b[_0x368b('0xa')](_0x368b('0xb'),attributes,{'tableName':_0x368b('0xc'),'paranoid':![],'indexes':[{'name':_0x368b('0xd'),'fields':[_0x368b('0xe'),_0x368b('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4bd3=['lodash','../../config/logger','api','path','rimraf','../../config/environment','exports','define','ZohoField','zoho_unique_index','idField','FieldId'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0x4bd3,0x174));var _0x34bd=function(_0x3d5ad8,_0x338d1c){_0x3d5ad8=_0x3d5ad8-0x0;var _0x40bf6a=_0x4bd3[_0x3d5ad8];return _0x40bf6a;};'use strict';var _=require(_0x34bd('0x0'));var util=require('util');var logger=require(_0x34bd('0x1'))(_0x34bd('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x34bd('0x3'));var rimraf=require(_0x34bd('0x4'));var config=require(_0x34bd('0x5'));var attributes=require('./intZohoField.attributes');module[_0x34bd('0x6')]=function(_0x2a15a2,_0x5c2a7a){return _0x2a15a2[_0x34bd('0x7')](_0x34bd('0x8'),attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':_0x34bd('0x9'),'fields':[_0x34bd('0xa'),_0x34bd('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 4543948..000ee05 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 _0xedba=['http','request','then','info','ZohoField,\x20%s,\x20%s','debug','stringify','error','message','request\x20sent','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x54e9f1,_0x2b0b5e){var _0x59d81c=function(_0x2d3ceb){while(--_0x2d3ceb){_0x54e9f1['push'](_0x54e9f1['shift']());}};_0x59d81c(++_0x2b0b5e);}(_0xedba,0xf2));var _0xaedb=function(_0x8362be,_0x57010d){_0x8362be=_0x8362be-0x0;var _0x469540=_0xedba[_0x8362be];return _0x469540;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xaedb('0x0'));var BPromise=require(_0xaedb('0x1'));var rs=require(_0xaedb('0x2'));var fs=require('fs');var Redis=require(_0xaedb('0x3'));var db=require(_0xaedb('0x4'))['db'];var utils=require(_0xaedb('0x5'));var logger=require(_0xaedb('0x6'))(_0xaedb('0x7'));var config=require(_0xaedb('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xaedb('0x9')][_0xaedb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xfc978e,_0xa4881,_0xe2a383){return new BPromise(function(_0x5f4ee2,_0x3f6f90){return client[_0xaedb('0xb')](_0xfc978e,_0xe2a383)[_0xaedb('0xc')](function(_0x51df7f){logger[_0xaedb('0xd')](_0xaedb('0xe'),_0xa4881,'request\x20sent');logger[_0xaedb('0xf')]('ZohoField,\x20%s,\x20%s,\x20%s',_0xa4881,'request\x20sent',JSON[_0xaedb('0x10')](_0x51df7f));if(_0x51df7f[_0xaedb('0x11')]){if(_0x51df7f['error']['code']===0x1f4){logger['error'](_0xaedb('0xe'),_0xa4881,_0x51df7f[_0xaedb('0x11')][_0xaedb('0x12')]);return _0x3f6f90(_0x51df7f[_0xaedb('0x11')][_0xaedb('0x12')]);}logger[_0xaedb('0x11')](_0xaedb('0xe'),_0xa4881,_0x51df7f[_0xaedb('0x11')][_0xaedb('0x12')]);return _0x5f4ee2(_0x51df7f['error'][_0xaedb('0x12')]);}else{logger[_0xaedb('0xd')](_0xaedb('0xe'),_0xa4881,_0xaedb('0x13'));_0x5f4ee2(_0x51df7f['result'][_0xaedb('0x12')]);}})[_0xaedb('0x14')](function(_0x213556){logger[_0xaedb('0x11')](_0xaedb('0xe'),_0xa4881,_0x213556);_0x3f6f90(_0x213556);});});} \ No newline at end of file +var _0x50db=['error','code','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','ZohoField,\x20%s,\x20%s','request\x20sent'];(function(_0x5e206c,_0x366173){var _0xc5a89e=function(_0x1634e1){while(--_0x1634e1){_0x5e206c['push'](_0x5e206c['shift']());}};_0xc5a89e(++_0x366173);}(_0x50db,0x11c));var _0xb50d=function(_0x2f5137,_0x5367d3){_0x2f5137=_0x2f5137-0x0;var _0x26bdb5=_0x50db[_0x2f5137];return _0x26bdb5;};'use strict';var _=require(_0xb50d('0x0'));var util=require('util');var moment=require(_0xb50d('0x1'));var BPromise=require(_0xb50d('0x2'));var rs=require(_0xb50d('0x3'));var fs=require('fs');var Redis=require(_0xb50d('0x4'));var db=require(_0xb50d('0x5'))['db'];var utils=require(_0xb50d('0x6'));var logger=require('../../config/logger')(_0xb50d('0x7'));var config=require('../../config/environment');var jayson=require(_0xb50d('0x8'));var client=jayson[_0xb50d('0x9')][_0xb50d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xbc805a,_0x112bef,_0x4bcffe){return new BPromise(function(_0x469ac1,_0x11a94f){return client[_0xb50d('0xb')](_0xbc805a,_0x4bcffe)[_0xb50d('0xc')](function(_0xe68561){logger[_0xb50d('0xd')](_0xb50d('0xe'),_0x112bef,_0xb50d('0xf'));logger['debug']('ZohoField,\x20%s,\x20%s,\x20%s',_0x112bef,_0xb50d('0xf'),JSON['stringify'](_0xe68561));if(_0xe68561[_0xb50d('0x10')]){if(_0xe68561[_0xb50d('0x10')][_0xb50d('0x11')]===0x1f4){logger[_0xb50d('0x10')](_0xb50d('0xe'),_0x112bef,_0xe68561[_0xb50d('0x10')][_0xb50d('0x12')]);return _0x11a94f(_0xe68561[_0xb50d('0x10')][_0xb50d('0x12')]);}logger[_0xb50d('0x10')](_0xb50d('0xe'),_0x112bef,_0xe68561[_0xb50d('0x10')][_0xb50d('0x12')]);return _0x469ac1(_0xe68561[_0xb50d('0x10')][_0xb50d('0x12')]);}else{logger[_0xb50d('0xd')](_0xb50d('0xe'),_0x112bef,_0xb50d('0xf'));_0x469ac1(_0xe68561[_0xb50d('0x13')]['message']);}})['catch'](function(_0x203aa2){logger[_0xb50d('0x10')](_0xb50d('0xe'),_0x112bef,_0x203aa2);_0x11a94f(_0x203aa2);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 4673cb6..01e8a15 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x40d77c,_0x4e8b4b){var _0x20ef26=function(_0xcab77a){while(--_0xcab77a){_0x40d77c['push'](_0x40d77c['shift']());}};_0x20ef26(++_0x4e8b4b);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x28edda,_0xbd447a){_0x28edda=_0x28edda-0x0;var _0x21f4a4=_0xcb91[_0x28edda];return _0x21f4a4;};'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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x2b26c5,_0x547bea){var _0xfc7f7f=function(_0x2280b9){while(--_0x2280b9){_0x2b26c5['push'](_0x2b26c5['shift']());}};_0xfc7f7f(++_0x547bea);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index b9d16e8..52547f0 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 _0xc072=['unique_name_and_version','app.js','INTEGER','state','STRING'];(function(_0x1561e7,_0x18801d){var _0x333df8=function(_0x2933db){while(--_0x2933db){_0x1561e7['push'](_0x1561e7['shift']());}};_0x333df8(++_0x18801d);}(_0xc072,0x14e));var _0x2c07=function(_0x4f2f74,_0x224978){_0x4f2f74=_0x4f2f74-0x0;var _0x1cc343=_0xc072[_0x4f2f74];return _0x1cc343;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x2c07('0x0')],'allowNull':![],'unique':_0x2c07('0x1')},'version':{'type':Sequelize[_0x2c07('0x0')],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize[_0x2c07('0x0')],'defaultValue':_0x2c07('0x2')},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize[_0x2c07('0x0')]},'type':{'type':Sequelize[_0x2c07('0x0')]},'size':{'type':Sequelize[_0x2c07('0x3')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize[_0x2c07('0x0')]},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize[_0x2c07('0x0')],'unique':_0x2c07('0x4')},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize[_0x2c07('0x0')]},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize[_0x2c07('0x0')],'defaultValue':'#'}}; \ No newline at end of file +var _0x72f8=['exports','STRING','unique_name_and_version','INTEGER','state','sequelize'];(function(_0x2dd078,_0x337a46){var _0x50a2b8=function(_0x3d0341){while(--_0x3d0341){_0x2dd078['push'](_0x2dd078['shift']());}};_0x50a2b8(++_0x337a46);}(_0x72f8,0xa7));var _0x872f=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0x72f8[_0x47aa64];return _0x549c7a;};'use strict';var Sequelize=require(_0x872f('0x0'));module[_0x872f('0x1')]={'name':{'type':Sequelize[_0x872f('0x2')],'allowNull':![],'unique':_0x872f('0x3')},'version':{'type':Sequelize[_0x872f('0x2')],'allowNull':![],'unique':_0x872f('0x3')},'main':{'type':Sequelize[_0x872f('0x2')],'defaultValue':'app.js'},'filename':{'type':Sequelize[_0x872f('0x2')]},'path':{'type':Sequelize[_0x872f('0x2')]},'type':{'type':Sequelize[_0x872f('0x2')]},'size':{'type':Sequelize[_0x872f('0x4')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize[_0x872f('0x2')]},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize['STRING'],'unique':_0x872f('0x5')},'description':{'type':Sequelize[_0x872f('0x2')]},'title':{'type':Sequelize[_0x872f('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize[_0x872f('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 4aab698..065b9ce 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 _0xc6ac=['type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','show','params','includeAll','include','find','catch','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','then','destroy','end','error','name','send','Integration','rawAttributes','fieldName'];(function(_0x362256,_0x4f8638){var _0xfa7997=function(_0xfb12d0){while(--_0xfb12d0){_0x362256['push'](_0x362256['shift']());}};_0xfa7997(++_0x4f8638);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x33d2d6,_0x159199){_0x33d2d6=_0x33d2d6-0x0;var _0x485808=_0xc6ac[_0x33d2d6];return _0x485808;};'use strict';var emlformat=require(_0xcc6a('0x0'));var rimraf=require(_0xcc6a('0x1'));var zipdir=require(_0xcc6a('0x2'));var jsonpatch=require(_0xcc6a('0x3'));var rp=require(_0xcc6a('0x4'));var moment=require(_0xcc6a('0x5'));var BPromise=require(_0xcc6a('0x6'));var Mustache=require(_0xcc6a('0x7'));var util=require(_0xcc6a('0x8'));var path=require(_0xcc6a('0x9'));var sox=require(_0xcc6a('0xa'));var csv=require(_0xcc6a('0xb'));var ejs=require(_0xcc6a('0xc'));var fs=require('fs');var fs_extra=require(_0xcc6a('0xd'));var _=require('lodash');var squel=require(_0xcc6a('0xe'));var crypto=require(_0xcc6a('0xf'));var jsforce=require(_0xcc6a('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xcc6a('0xb'));var querystring=require(_0xcc6a('0x11'));var Papa=require(_0xcc6a('0x12'));var Redis=require(_0xcc6a('0x13'));var authService=require(_0xcc6a('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xcc6a('0x15'));var hardwareService=require(_0xcc6a('0x16'));var logger=require(_0xcc6a('0x17'))('api');var utils=require(_0xcc6a('0x18'));var config=require(_0xcc6a('0x19'));var licenseUtil=require(_0xcc6a('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x59ce6d,_0xf0f6d5){_0xf0f6d5=_0xf0f6d5||0xcc;return function(_0x211444){if(_0x211444){return _0x59ce6d[_0xcc6a('0x1b')](_0xf0f6d5);}return _0x59ce6d['status'](_0xf0f6d5)['end']();};}function respondWithResult(_0x369dc1,_0xcb9e2e){_0xcb9e2e=_0xcb9e2e||0xc8;return function(_0x43710d){if(_0x43710d){return _0x369dc1[_0xcc6a('0x1c')](_0xcb9e2e)[_0xcc6a('0x1d')](_0x43710d);}};}function respondWithFilteredResult(_0x337ec5,_0x4133fa){return function(_0x403b18){if(_0x403b18){var _0x56ffb0=typeof _0x4133fa['offset']==='undefined'&&typeof _0x4133fa[_0xcc6a('0x1e')]===_0xcc6a('0x1f');var _0x307f2a=_0x403b18[_0xcc6a('0x20')];var _0x33079c=_0x56ffb0?0x0:_0x4133fa[_0xcc6a('0x21')];var _0x2d9585=_0x56ffb0?_0x403b18[_0xcc6a('0x20')]:_0x4133fa[_0xcc6a('0x21')]+_0x4133fa[_0xcc6a('0x1e')];var _0x1d20a3;if(_0x2d9585>=_0x307f2a){_0x2d9585=_0x307f2a;_0x1d20a3=0xc8;}else{_0x1d20a3=0xce;}_0x337ec5['status'](_0x1d20a3);return _0x337ec5[_0xcc6a('0x22')](_0xcc6a('0x23'),_0x33079c+'-'+_0x2d9585+'/'+_0x307f2a)[_0xcc6a('0x1d')](_0x403b18);}return null;};}function patchUpdates(_0x368a6e){return function(_0x1495d8){try{jsonpatch[_0xcc6a('0x24')](_0x1495d8,_0x368a6e,!![]);}catch(_0x36c80f){return BPromise[_0xcc6a('0x25')](_0x36c80f);}return _0x1495d8[_0xcc6a('0x26')]();};}function saveUpdates(_0x19d32c,_0x329d17){return function(_0x845088){if(_0x845088){return _0x845088['update'](_0x19d32c)[_0xcc6a('0x27')](function(_0x3a081e){return _0x3a081e;});}return null;};}function removeEntity(_0x38f812,_0x581aae){return function(_0x10016a){if(_0x10016a){return _0x10016a[_0xcc6a('0x28')]()[_0xcc6a('0x27')](function(){_0x38f812[_0xcc6a('0x1c')](0xcc)[_0xcc6a('0x29')]();});}};}function handleEntityNotFound(_0x5fc697,_0x50abc1){return function(_0x26def8){if(!_0x26def8){_0x5fc697[_0xcc6a('0x1b')](0x194);}return _0x26def8;};}function handleError(_0x3514f3,_0x5f27e5){_0x5f27e5=_0x5f27e5||0x1f4;return function(_0x3afb3a){logger[_0xcc6a('0x2a')](_0x3afb3a['stack']);if(_0x3afb3a[_0xcc6a('0x2b')]){delete _0x3afb3a[_0xcc6a('0x2b')];}_0x3514f3[_0xcc6a('0x1c')](_0x5f27e5)[_0xcc6a('0x2c')](_0x3afb3a);};}exports['index']=function(_0x194aab,_0x3cf14c){var _0x2c6d88={},_0x4f176b={},_0x2590a2={'count':0x0,'rows':[]};var _0x5308d4=_['map'](db[_0xcc6a('0x2d')][_0xcc6a('0x2e')],function(_0x3aa315){return{'name':_0x3aa315[_0xcc6a('0x2f')],'type':_0x3aa315[_0xcc6a('0x30')][_0xcc6a('0x31')]};});_0x4f176b['model']=_[_0xcc6a('0x32')](_0x5308d4,_0xcc6a('0x2b'));_0x4f176b[_0xcc6a('0x33')]=_[_0xcc6a('0x34')](_0x194aab[_0xcc6a('0x33')]);_0x4f176b[_0xcc6a('0x35')]=_[_0xcc6a('0x36')](_0x4f176b[_0xcc6a('0x37')],_0x4f176b['query']);_0x2c6d88[_0xcc6a('0x38')]=_[_0xcc6a('0x36')](_0x4f176b[_0xcc6a('0x37')],qs[_0xcc6a('0x39')](_0x194aab[_0xcc6a('0x33')][_0xcc6a('0x39')]));_0x2c6d88[_0xcc6a('0x38')]=_0x2c6d88['attributes'][_0xcc6a('0x3a')]?_0x2c6d88['attributes']:_0x4f176b['model'];if(!_0x194aab['query'][_0xcc6a('0x3b')](_0xcc6a('0x3c'))){_0x2c6d88[_0xcc6a('0x1e')]=qs[_0xcc6a('0x1e')](_0x194aab[_0xcc6a('0x33')]['limit']);_0x2c6d88['offset']=qs[_0xcc6a('0x21')](_0x194aab[_0xcc6a('0x33')][_0xcc6a('0x21')]);}_0x2c6d88['order']=qs[_0xcc6a('0x3d')](_0x194aab[_0xcc6a('0x33')][_0xcc6a('0x3d')]);_0x2c6d88[_0xcc6a('0x3e')]=qs[_0xcc6a('0x35')](_[_0xcc6a('0x3f')](_0x194aab[_0xcc6a('0x33')],_0x4f176b[_0xcc6a('0x35')]),_0x5308d4);if(_0x194aab[_0xcc6a('0x33')][_0xcc6a('0x40')]){_0x2c6d88[_0xcc6a('0x3e')]=_[_0xcc6a('0x41')](_0x2c6d88[_0xcc6a('0x3e')],{'$or':_[_0xcc6a('0x32')](_0x5308d4,function(_0x262a1e){if(_0x262a1e[_0xcc6a('0x30')]!==_0xcc6a('0x42')){var _0x386cbc={};_0x386cbc[_0x262a1e['name']]={'$like':'%'+_0x194aab['query'][_0xcc6a('0x40')]+'%'};return _0x386cbc;}})});}_0x2c6d88=_[_0xcc6a('0x41')]({},_0x2c6d88,_0x194aab[_0xcc6a('0x43')]);var _0x1fd8e1={'where':_0x2c6d88[_0xcc6a('0x3e')]};return db[_0xcc6a('0x2d')][_0xcc6a('0x20')](_0x1fd8e1)[_0xcc6a('0x27')](function(_0x49b65c){_0x2590a2['count']=_0x49b65c;if(_0x194aab[_0xcc6a('0x33')]['includeAll']){_0x2c6d88['include']=[{'all':!![]}];}return db['Integration'][_0xcc6a('0x44')](_0x2c6d88);})[_0xcc6a('0x27')](function(_0xb42897){_0x2590a2[_0xcc6a('0x45')]=_0xb42897;return _0x2590a2;})[_0xcc6a('0x27')](respondWithFilteredResult(_0x3cf14c,_0x2c6d88))['catch'](handleError(_0x3cf14c,null));};exports[_0xcc6a('0x46')]=function(_0xfbb079,_0x17e5a0){var _0x2f966f={'raw':![],'where':{'id':_0xfbb079[_0xcc6a('0x47')]['id']}},_0x14ca90={};_0x14ca90['model']=_[_0xcc6a('0x34')](db[_0xcc6a('0x2d')][_0xcc6a('0x2e')]);_0x14ca90[_0xcc6a('0x33')]=_['keys'](_0xfbb079[_0xcc6a('0x33')]);_0x14ca90['filters']=_[_0xcc6a('0x36')](_0x14ca90[_0xcc6a('0x37')],_0x14ca90[_0xcc6a('0x33')]);_0x2f966f['attributes']=_[_0xcc6a('0x36')](_0x14ca90[_0xcc6a('0x37')],qs[_0xcc6a('0x39')](_0xfbb079['query']['fields']));_0x2f966f[_0xcc6a('0x38')]=_0x2f966f[_0xcc6a('0x38')][_0xcc6a('0x3a')]?_0x2f966f[_0xcc6a('0x38')]:_0x14ca90[_0xcc6a('0x37')];if(_0xfbb079['query'][_0xcc6a('0x48')]){_0x2f966f[_0xcc6a('0x49')]=[{'all':!![]}];}_0x2f966f=_['merge']({},_0x2f966f,_0xfbb079[_0xcc6a('0x43')]);return db[_0xcc6a('0x2d')][_0xcc6a('0x4a')](_0x2f966f)[_0xcc6a('0x27')](handleEntityNotFound(_0x17e5a0,null))[_0xcc6a('0x27')](respondWithResult(_0x17e5a0,null))[_0xcc6a('0x4b')](handleError(_0x17e5a0,null));};exports['create']=function(_0x4e1a0b,_0x47c999){return db[_0xcc6a('0x2d')][_0xcc6a('0x4c')](_0x4e1a0b[_0xcc6a('0x4d')],{})[_0xcc6a('0x27')](respondWithResult(_0x47c999,0xc9))['catch'](handleError(_0x47c999,null));};exports[_0xcc6a('0x4e')]=function(_0x5e7bab,_0x3aa7dd){if(_0x5e7bab[_0xcc6a('0x4d')]['id']){delete _0x5e7bab[_0xcc6a('0x4d')]['id'];}return db[_0xcc6a('0x2d')][_0xcc6a('0x4a')]({'where':{'id':_0x5e7bab[_0xcc6a('0x47')]['id']}})['then'](handleEntityNotFound(_0x3aa7dd,null))[_0xcc6a('0x27')](saveUpdates(_0x5e7bab[_0xcc6a('0x4d')],null))[_0xcc6a('0x27')](respondWithResult(_0x3aa7dd,null))[_0xcc6a('0x4b')](handleError(_0x3aa7dd,null));};exports[_0xcc6a('0x28')]=function(_0x362bf6,_0x431684){return db[_0xcc6a('0x2d')][_0xcc6a('0x4a')]({'where':{'id':_0x362bf6[_0xcc6a('0x47')]['id']}})['then'](handleEntityNotFound(_0x431684,null))[_0xcc6a('0x27')](removeEntity(_0x431684,null))[_0xcc6a('0x4b')](handleError(_0x431684,null));}; \ No newline at end of file +var _0x66fa=['../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','rawAttributes','type','key','map','query','keys','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','VIRTUAL','includeAll','include','Integration','findAll','rows','catch','merge','options','find','create','body','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x66fa,0x117));var _0xa66f=function(_0x23ae96,_0x3cbf59){_0x23ae96=_0x23ae96-0x0;var _0x3b7efa=_0x66fa[_0x23ae96];return _0x3b7efa;};'use strict';var emlformat=require(_0xa66f('0x0'));var rimraf=require(_0xa66f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa66f('0x2'));var rp=require(_0xa66f('0x3'));var moment=require(_0xa66f('0x4'));var BPromise=require(_0xa66f('0x5'));var Mustache=require(_0xa66f('0x6'));var util=require(_0xa66f('0x7'));var path=require(_0xa66f('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa66f('0x9'));var fs=require('fs');var fs_extra=require(_0xa66f('0xa'));var _=require(_0xa66f('0xb'));var squel=require(_0xa66f('0xc'));var crypto=require(_0xa66f('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xa66f('0xe'));var toCsv=require('to-csv');var querystring=require(_0xa66f('0xf'));var Papa=require('papaparse');var Redis=require(_0xa66f('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa66f('0x11'));var logger=require(_0xa66f('0x12'))('api');var utils=require(_0xa66f('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xa66f('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x251189,_0x14af70){_0x14af70=_0x14af70||0xcc;return function(_0xca12f8){if(_0xca12f8){return _0x251189['sendStatus'](_0x14af70);}return _0x251189['status'](_0x14af70)[_0xa66f('0x15')]();};}function respondWithResult(_0x4e09cf,_0x528427){_0x528427=_0x528427||0xc8;return function(_0x5a7b16){if(_0x5a7b16){return _0x4e09cf[_0xa66f('0x16')](_0x528427)[_0xa66f('0x17')](_0x5a7b16);}};}function respondWithFilteredResult(_0x267129,_0x236d64){return function(_0xd348f9){if(_0xd348f9){var _0x567d4f=typeof _0x236d64['offset']===_0xa66f('0x18')&&typeof _0x236d64[_0xa66f('0x19')]===_0xa66f('0x18');var _0x403f4d=_0xd348f9['count'];var _0x1cbe64=_0x567d4f?0x0:_0x236d64['offset'];var _0x4a28d4=_0x567d4f?_0xd348f9[_0xa66f('0x1a')]:_0x236d64[_0xa66f('0x1b')]+_0x236d64[_0xa66f('0x19')];var _0x355ddc;if(_0x4a28d4>=_0x403f4d){_0x4a28d4=_0x403f4d;_0x355ddc=0xc8;}else{_0x355ddc=0xce;}_0x267129[_0xa66f('0x16')](_0x355ddc);return _0x267129[_0xa66f('0x1c')](_0xa66f('0x1d'),_0x1cbe64+'-'+_0x4a28d4+'/'+_0x403f4d)[_0xa66f('0x17')](_0xd348f9);}return null;};}function patchUpdates(_0x2033a4){return function(_0x2d9602){try{jsonpatch[_0xa66f('0x1e')](_0x2d9602,_0x2033a4,!![]);}catch(_0xbba376){return BPromise[_0xa66f('0x1f')](_0xbba376);}return _0x2d9602[_0xa66f('0x20')]();};}function saveUpdates(_0x82924d,_0x5cd613){return function(_0x27f570){if(_0x27f570){return _0x27f570[_0xa66f('0x21')](_0x82924d)[_0xa66f('0x22')](function(_0x37ee13){return _0x37ee13;});}return null;};}function removeEntity(_0x5cbd82,_0x337602){return function(_0x473822){if(_0x473822){return _0x473822[_0xa66f('0x23')]()[_0xa66f('0x22')](function(){_0x5cbd82['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xed98b9,_0x598942){return function(_0x3a3e4f){if(!_0x3a3e4f){_0xed98b9[_0xa66f('0x24')](0x194);}return _0x3a3e4f;};}function handleError(_0x384164,_0x57da7f){_0x57da7f=_0x57da7f||0x1f4;return function(_0x4683c7){logger[_0xa66f('0x25')](_0x4683c7[_0xa66f('0x26')]);if(_0x4683c7[_0xa66f('0x27')]){delete _0x4683c7[_0xa66f('0x27')];}_0x384164[_0xa66f('0x16')](_0x57da7f)[_0xa66f('0x28')](_0x4683c7);};}exports[_0xa66f('0x29')]=function(_0x20ee67,_0x117d03){var _0x45f71c={},_0x63650b={},_0x42b966={'count':0x0,'rows':[]};var _0xeeb22e=_['map'](db['Integration'][_0xa66f('0x2a')],function(_0x27ceae){return{'name':_0x27ceae['fieldName'],'type':_0x27ceae[_0xa66f('0x2b')][_0xa66f('0x2c')]};});_0x63650b['model']=_[_0xa66f('0x2d')](_0xeeb22e,_0xa66f('0x27'));_0x63650b[_0xa66f('0x2e')]=_[_0xa66f('0x2f')](_0x20ee67[_0xa66f('0x2e')]);_0x63650b['filters']=_[_0xa66f('0x30')](_0x63650b['model'],_0x63650b[_0xa66f('0x2e')]);_0x45f71c[_0xa66f('0x31')]=_[_0xa66f('0x30')](_0x63650b['model'],qs[_0xa66f('0x32')](_0x20ee67[_0xa66f('0x2e')]['fields']));_0x45f71c[_0xa66f('0x31')]=_0x45f71c[_0xa66f('0x31')][_0xa66f('0x33')]?_0x45f71c[_0xa66f('0x31')]:_0x63650b[_0xa66f('0x34')];if(!_0x20ee67[_0xa66f('0x2e')][_0xa66f('0x35')](_0xa66f('0x36'))){_0x45f71c[_0xa66f('0x19')]=qs[_0xa66f('0x19')](_0x20ee67['query'][_0xa66f('0x19')]);_0x45f71c['offset']=qs[_0xa66f('0x1b')](_0x20ee67[_0xa66f('0x2e')][_0xa66f('0x1b')]);}_0x45f71c[_0xa66f('0x37')]=qs[_0xa66f('0x38')](_0x20ee67[_0xa66f('0x2e')][_0xa66f('0x38')]);_0x45f71c[_0xa66f('0x39')]=qs['filters'](_[_0xa66f('0x3a')](_0x20ee67['query'],_0x63650b[_0xa66f('0x3b')]),_0xeeb22e);if(_0x20ee67[_0xa66f('0x2e')][_0xa66f('0x3c')]){_0x45f71c['where']=_['merge'](_0x45f71c[_0xa66f('0x39')],{'$or':_[_0xa66f('0x2d')](_0xeeb22e,function(_0x20b07e){if(_0x20b07e[_0xa66f('0x2b')]!==_0xa66f('0x3d')){var _0x581dca={};_0x581dca[_0x20b07e['name']]={'$like':'%'+_0x20ee67['query'][_0xa66f('0x3c')]+'%'};return _0x581dca;}})});}_0x45f71c=_['merge']({},_0x45f71c,_0x20ee67['options']);var _0x5bf856={'where':_0x45f71c[_0xa66f('0x39')]};return db['Integration'][_0xa66f('0x1a')](_0x5bf856)[_0xa66f('0x22')](function(_0x23a546){_0x42b966[_0xa66f('0x1a')]=_0x23a546;if(_0x20ee67[_0xa66f('0x2e')][_0xa66f('0x3e')]){_0x45f71c[_0xa66f('0x3f')]=[{'all':!![]}];}return db[_0xa66f('0x40')][_0xa66f('0x41')](_0x45f71c);})[_0xa66f('0x22')](function(_0x3a7929){_0x42b966[_0xa66f('0x42')]=_0x3a7929;return _0x42b966;})[_0xa66f('0x22')](respondWithFilteredResult(_0x117d03,_0x45f71c))[_0xa66f('0x43')](handleError(_0x117d03,null));};exports['show']=function(_0x36037c,_0x25c2cb){var _0x58c1f2={'raw':![],'where':{'id':_0x36037c['params']['id']}},_0x248587={};_0x248587[_0xa66f('0x34')]=_[_0xa66f('0x2f')](db['Integration'][_0xa66f('0x2a')]);_0x248587[_0xa66f('0x2e')]=_[_0xa66f('0x2f')](_0x36037c['query']);_0x248587[_0xa66f('0x3b')]=_['intersection'](_0x248587[_0xa66f('0x34')],_0x248587[_0xa66f('0x2e')]);_0x58c1f2[_0xa66f('0x31')]=_[_0xa66f('0x30')](_0x248587[_0xa66f('0x34')],qs[_0xa66f('0x32')](_0x36037c[_0xa66f('0x2e')]['fields']));_0x58c1f2[_0xa66f('0x31')]=_0x58c1f2[_0xa66f('0x31')][_0xa66f('0x33')]?_0x58c1f2[_0xa66f('0x31')]:_0x248587[_0xa66f('0x34')];if(_0x36037c['query']['includeAll']){_0x58c1f2[_0xa66f('0x3f')]=[{'all':!![]}];}_0x58c1f2=_[_0xa66f('0x44')]({},_0x58c1f2,_0x36037c[_0xa66f('0x45')]);return db[_0xa66f('0x40')][_0xa66f('0x46')](_0x58c1f2)[_0xa66f('0x22')](handleEntityNotFound(_0x25c2cb,null))['then'](respondWithResult(_0x25c2cb,null))[_0xa66f('0x43')](handleError(_0x25c2cb,null));};exports[_0xa66f('0x47')]=function(_0x3f9cdd,_0x5651e9){return db['Integration'][_0xa66f('0x47')](_0x3f9cdd[_0xa66f('0x48')],{})[_0xa66f('0x22')](respondWithResult(_0x5651e9,0xc9))['catch'](handleError(_0x5651e9,null));};exports['update']=function(_0x52054e,_0x19e7ce){if(_0x52054e[_0xa66f('0x48')]['id']){delete _0x52054e[_0xa66f('0x48')]['id'];}return db[_0xa66f('0x40')][_0xa66f('0x46')]({'where':{'id':_0x52054e[_0xa66f('0x49')]['id']}})[_0xa66f('0x22')](handleEntityNotFound(_0x19e7ce,null))[_0xa66f('0x22')](saveUpdates(_0x52054e['body'],null))[_0xa66f('0x22')](respondWithResult(_0x19e7ce,null))[_0xa66f('0x43')](handleError(_0x19e7ce,null));};exports[_0xa66f('0x23')]=function(_0x393755,_0x11597b){return db[_0xa66f('0x40')]['find']({'where':{'id':_0x393755[_0xa66f('0x49')]['id']}})[_0xa66f('0x22')](handleEntityNotFound(_0x11597b,null))[_0xa66f('0x22')](removeEntity(_0x11597b,null))[_0xa66f('0x43')](handleError(_0x11597b,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 264b529..0ef7712 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 _0xf287=['api','path','rimraf','./integration.attributes','exports','define','Integration','integrations','lodash','util','../../config/logger'];(function(_0x7e5c8f,_0x39fcc5){var _0x176d4a=function(_0xb90bc2){while(--_0xb90bc2){_0x7e5c8f['push'](_0x7e5c8f['shift']());}};_0x176d4a(++_0x39fcc5);}(_0xf287,0x173));var _0x7f28=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf287[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7f28('0x0'));var util=require(_0x7f28('0x1'));var logger=require(_0x7f28('0x2'))(_0x7f28('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7f28('0x4'));var rimraf=require(_0x7f28('0x5'));var config=require('../../config/environment');var attributes=require(_0x7f28('0x6'));module[_0x7f28('0x7')]=function(_0x24275c,_0x340e90){return _0x24275c[_0x7f28('0x8')](_0x7f28('0x9'),attributes,{'tableName':_0x7f28('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa048=['lodash','moment','request-promise','path','./integration.attributes','exports','define','Integration'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xa048,0x1d0));var _0x8a04=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xa048[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x8a04('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x8a04('0x1'));var BPromise=require('bluebird');var rp=require(_0x8a04('0x2'));var fs=require('fs');var path=require(_0x8a04('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8a04('0x4'));module[_0x8a04('0x5')]=function(_0x12f2b8,_0x11067e){return _0x12f2b8[_0x8a04('0x6')](_0x8a04('0x7'),attributes,{'tableName':'integrations','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 24b5754..25fc1ae 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 _0x5f66=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','code','message','error','info','catch','util','bluebird','randomstring','ioredis'];(function(_0x4e5099,_0x4e402c){var _0xd86619=function(_0x393d26){while(--_0x393d26){_0x4e5099['push'](_0x4e5099['shift']());}};_0xd86619(++_0x4e402c);}(_0x5f66,0x1a0));var _0x65f6=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x5f66[_0x4154a6];return _0x3b2786;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ed98f,_0x1c0e12,_0x2c6571){return new BPromise(function(_0x112079,_0x8f6451){return client[_0x65f6('0x9')](_0x4ed98f,_0x2c6571)[_0x65f6('0xa')](function(_0x48d85c){logger['info'](_0x65f6('0xb'),_0x1c0e12,_0x65f6('0xc'));logger[_0x65f6('0xd')](_0x65f6('0xe'),_0x1c0e12,'request\x20sent',JSON[_0x65f6('0xf')](_0x48d85c));if(_0x48d85c['error']){if(_0x48d85c['error'][_0x65f6('0x10')]===0x1f4){logger['error'](_0x65f6('0xb'),_0x1c0e12,_0x48d85c['error'][_0x65f6('0x11')]);return _0x8f6451(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);return _0x112079(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}else{logger[_0x65f6('0x13')]('Integration,\x20%s,\x20%s',_0x1c0e12,_0x65f6('0xc'));_0x112079(_0x48d85c['result']['message']);}})[_0x65f6('0x14')](function(_0x5c69f8){logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x5c69f8);_0x8f6451(_0x5c69f8);});});} \ 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','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','Integration,\x20%s,\x20%s','message','lodash','util','moment','bluebird','randomstring'];(function(_0x4c05da,_0x414720){var _0x1614db=function(_0xa19cf6){while(--_0xa19cf6){_0x4c05da['push'](_0x4c05da['shift']());}};_0x1614db(++_0x414720);}(_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')]('Integration,\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/integrationReport/index.js b/server/api/integrationReport/index.js index 464028b..88649b8 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 _0x896e=['show','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','index','/describe','isAuthenticated','describe','/:id'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0x896e,0x1e9));var _0xe896=function(_0x8f75e6,_0x53a7ca){_0x8f75e6=_0x8f75e6-0x0;var _0x4acc51=_0x896e[_0x8f75e6];return _0x4acc51;};'use strict';var multer=require(_0xe896('0x0'));var util=require(_0xe896('0x1'));var path=require(_0xe896('0x2'));var timeout=require(_0xe896('0x3'));var express=require(_0xe896('0x4'));var router=express[_0xe896('0x5')]();var fs_extra=require(_0xe896('0x6'));var auth=require(_0xe896('0x7'));var interaction=require(_0xe896('0x8'));var config=require(_0xe896('0x9'));var controller=require(_0xe896('0xa'));router[_0xe896('0xb')]('/',auth['isAuthenticated'](),controller[_0xe896('0xc')]);router[_0xe896('0xb')](_0xe896('0xd'),auth[_0xe896('0xe')](),controller[_0xe896('0xf')]);router['get'](_0xe896('0x10'),auth[_0xe896('0xe')](),controller[_0xe896('0x11')]);router['post']('/',auth[_0xe896('0xe')](),controller['create']);router[_0xe896('0x12')]('/:id',auth[_0xe896('0xe')](),controller[_0xe896('0x13')]);router[_0xe896('0x14')]('/:id',auth[_0xe896('0xe')](),controller[_0xe896('0x15')]);module[_0xe896('0x16')]=router; \ No newline at end of file +var _0x9f0e=['path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','/describe','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','multer','util'];(function(_0x4bad42,_0x2c5e2e){var _0x3487bc=function(_0x205662){while(--_0x205662){_0x4bad42['push'](_0x4bad42['shift']());}};_0x3487bc(++_0x2c5e2e);}(_0x9f0e,0x116));var _0xe9f0=function(_0x244a12,_0x40c8ed){_0x244a12=_0x244a12-0x0;var _0x7656fd=_0x9f0e[_0x244a12];return _0x7656fd;};'use strict';var multer=require(_0xe9f0('0x0'));var util=require(_0xe9f0('0x1'));var path=require(_0xe9f0('0x2'));var timeout=require(_0xe9f0('0x3'));var express=require(_0xe9f0('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe9f0('0x5'));var interaction=require(_0xe9f0('0x6'));var config=require(_0xe9f0('0x7'));var controller=require(_0xe9f0('0x8'));router[_0xe9f0('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xe9f0('0x9')](_0xe9f0('0xa'),auth[_0xe9f0('0xb')](),controller['describe']);router[_0xe9f0('0x9')](_0xe9f0('0xc'),auth[_0xe9f0('0xb')](),controller[_0xe9f0('0xd')]);router[_0xe9f0('0xe')]('/',auth[_0xe9f0('0xb')](),controller[_0xe9f0('0xf')]);router[_0xe9f0('0x10')](_0xe9f0('0xc'),auth['isAuthenticated'](),controller[_0xe9f0('0x11')]);router[_0xe9f0('0x12')](_0xe9f0('0xc'),auth['isAuthenticated'](),controller[_0xe9f0('0x13')]);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 7a02cb4..0294d14 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 _0xb08e=['INTEGER','BOOLEAN','DATE','TEXT','ENUM','RECEIVED','FAILED','sequelize','exports','STRING'];(function(_0x55e4f1,_0x250192){var _0xcb34bb=function(_0x148da9){while(--_0x148da9){_0x55e4f1['push'](_0x55e4f1['shift']());}};_0xcb34bb(++_0x250192);}(_0xb08e,0xe3));var _0xeb08=function(_0xf7c52b,_0x4463b4){_0xf7c52b=_0xf7c52b-0x0;var _0xd27b94=_0xb08e[_0xf7c52b];return _0xd27b94;};'use strict';var Sequelize=require(_0xeb08('0x0'));module[_0xeb08('0x1')]={'integration':{'type':Sequelize[_0xeb08('0x2')]},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize[_0xeb08('0x2')]},'integrationId':{'type':Sequelize[_0xeb08('0x3')]},'contacts':{'type':Sequelize[_0xeb08('0x2')]},'uniqueid':{'type':Sequelize[_0xeb08('0x2')]},'calleridnum':{'type':Sequelize[_0xeb08('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0xeb08('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0xeb08('0x3')]},'agentcomplete':{'type':Sequelize[_0xeb08('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xeb08('0x5')]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0xeb08('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xeb08('0x3')]},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize[_0xeb08('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize[_0xeb08('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0xeb08('0x2')]},'channel':{'type':Sequelize[_0xeb08('0x2')]},'channelstate':{'type':Sequelize[_0xeb08('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xeb08('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xeb08('0x2')]},'accountcode':{'type':Sequelize[_0xeb08('0x2')]},'context':{'type':Sequelize[_0xeb08('0x2')]},'exten':{'type':Sequelize[_0xeb08('0x2')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xeb08('0x2')]},'destchannelstate':{'type':Sequelize[_0xeb08('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xeb08('0x2')]},'destcalleridnum':{'type':Sequelize[_0xeb08('0x2')]},'destcalleridname':{'type':Sequelize[_0xeb08('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xeb08('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xeb08('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0xeb08('0x2')]},'destcontext':{'type':Sequelize[_0xeb08('0x2')]},'destexten':{'type':Sequelize[_0xeb08('0x2')]},'destpriority':{'type':Sequelize[_0xeb08('0x2')]},'destuniqueid':{'type':Sequelize[_0xeb08('0x2')]},'messageId':{'type':Sequelize[_0xeb08('0x2')]},'inReplyTo':{'type':Sequelize[_0xeb08('0x2')]},'subject':{'type':Sequelize[_0xeb08('0x2')]},'from':{'type':Sequelize[_0xeb08('0x2')]},'to':{'type':Sequelize[_0xeb08('0x2')]},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize[_0xeb08('0x6')]},'html':{'type':Sequelize[_0xeb08('0x6')]},'text':{'type':Sequelize[_0xeb08('0x6')]},'status':{'type':Sequelize[_0xeb08('0x7')]('SENT','SENDING',_0xeb08('0x8'),_0xeb08('0x9'))},'url':{'type':Sequelize[_0xeb08('0x2')]},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize[_0xeb08('0x2')]},'projectId':{'type':Sequelize[_0xeb08('0x3')]}}; \ No newline at end of file +var _0x847e=['exports','STRING','DATE','INTEGER','BOOLEAN','TEXT','ENUM','SENDING','RECEIVED','FAILED','sequelize'];(function(_0x5da084,_0x193510){var _0x4c7bb6=function(_0x31c5ef){while(--_0x31c5ef){_0x5da084['push'](_0x5da084['shift']());}};_0x4c7bb6(++_0x193510);}(_0x847e,0x78));var _0xe847=function(_0x2185c7,_0x482bc7){_0x2185c7=_0x2185c7-0x0;var _0x58aa31=_0x847e[_0x2185c7];return _0x58aa31;};'use strict';var Sequelize=require(_0xe847('0x0'));module[_0xe847('0x1')]={'integration':{'type':Sequelize[_0xe847('0x2')]},'eventChannel':{'type':Sequelize[_0xe847('0x2')]},'exitStatus':{'type':Sequelize[_0xe847('0x2')]},'ticketId':{'type':Sequelize['STRING']},'integrationId':{'type':Sequelize['INTEGER']},'contacts':{'type':Sequelize[_0xe847('0x2')]},'uniqueid':{'type':Sequelize[_0xe847('0x2')]},'calleridnum':{'type':Sequelize[_0xe847('0x2')]},'calleridname':{'type':Sequelize[_0xe847('0x2')]},'queue':{'type':Sequelize[_0xe847('0x2')]},'interface':{'type':Sequelize[_0xe847('0x2')]},'membername':{'type':Sequelize[_0xe847('0x2')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0xe847('0x3')]},'holdtime':{'type':Sequelize[_0xe847('0x4')]},'agentcomplete':{'type':Sequelize[_0xe847('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xe847('0x3')]},'talktime':{'type':Sequelize[_0xe847('0x4')]},'agentacw':{'type':Sequelize[_0xe847('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xe847('0x4')]},'reason':{'type':Sequelize[_0xe847('0x2')]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xe847('0x3')]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0xe847('0x2')]},'channel':{'type':Sequelize[_0xe847('0x2')]},'channelstate':{'type':Sequelize[_0xe847('0x4')]},'channelstatedesc':{'type':Sequelize[_0xe847('0x2')]},'connectedlinenum':{'type':Sequelize[_0xe847('0x2')]},'connectedlinename':{'type':Sequelize[_0xe847('0x2')]},'language':{'type':Sequelize[_0xe847('0x2')]},'accountcode':{'type':Sequelize[_0xe847('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xe847('0x2')]},'priority':{'type':Sequelize[_0xe847('0x2')]},'destchannel':{'type':Sequelize[_0xe847('0x2')]},'destchannelstate':{'type':Sequelize[_0xe847('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0xe847('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0xe847('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0xe847('0x2')]},'destaccountcode':{'type':Sequelize[_0xe847('0x2')]},'destcontext':{'type':Sequelize[_0xe847('0x2')]},'destexten':{'type':Sequelize[_0xe847('0x2')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0xe847('0x2')]},'messageId':{'type':Sequelize[_0xe847('0x2')]},'inReplyTo':{'type':Sequelize[_0xe847('0x2')]},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize[_0xe847('0x2')]},'to':{'type':Sequelize[_0xe847('0x2')]},'cc':{'type':Sequelize[_0xe847('0x2')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize[_0xe847('0x6')]},'text':{'type':Sequelize[_0xe847('0x6')]},'status':{'type':Sequelize[_0xe847('0x7')]('SENT',_0xe847('0x8'),_0xe847('0x9'),_0xe847('0xa'))},'url':{'type':Sequelize[_0xe847('0x2')]},'app':{'type':Sequelize[_0xe847('0x2')]},'appdata':{'type':Sequelize[_0xe847('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 65664c2..ceb5433 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 _0x5045=['error','stack','name','send','index','map','IntegrationReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','findAll','rows','catch','show','params','length','includeAll','include','create','body','find','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','destroy'];(function(_0x4dc125,_0x501ed5){var _0x555136=function(_0x122564){while(--_0x122564){_0x4dc125['push'](_0x4dc125['shift']());}};_0x555136(++_0x501ed5);}(_0x5045,0xc1));var _0x5504=function(_0x34375f,_0x1ff790){_0x34375f=_0x34375f-0x0;var _0x412b93=_0x5045[_0x34375f];return _0x412b93;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x5504('0x0'));var jsonpatch=require(_0x5504('0x1'));var rp=require(_0x5504('0x2'));var moment=require(_0x5504('0x3'));var BPromise=require(_0x5504('0x4'));var Mustache=require('mustache');var util=require(_0x5504('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x5504('0x6'));var ejs=require(_0x5504('0x7'));var fs=require('fs');var fs_extra=require(_0x5504('0x8'));var _=require(_0x5504('0x9'));var squel=require('squel');var crypto=require(_0x5504('0xa'));var jsforce=require(_0x5504('0xb'));var deskjs=require(_0x5504('0xc'));var toCsv=require(_0x5504('0x6'));var querystring=require(_0x5504('0xd'));var Papa=require(_0x5504('0xe'));var Redis=require(_0x5504('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x5504('0x10'));var as=require(_0x5504('0x11'));var hardwareService=require(_0x5504('0x12'));var logger=require(_0x5504('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x5504('0x14'));var licenseUtil=require(_0x5504('0x15'));var db=require(_0x5504('0x16'))['db'];function respondWithStatusCode(_0x120a73,_0x10ac1e){_0x10ac1e=_0x10ac1e||0xcc;return function(_0x170c0d){if(_0x170c0d){return _0x120a73[_0x5504('0x17')](_0x10ac1e);}return _0x120a73[_0x5504('0x18')](_0x10ac1e)[_0x5504('0x19')]();};}function respondWithResult(_0x42dc4d,_0x109a11){_0x109a11=_0x109a11||0xc8;return function(_0x7a2aed){if(_0x7a2aed){return _0x42dc4d[_0x5504('0x18')](_0x109a11)['json'](_0x7a2aed);}};}function respondWithFilteredResult(_0x51cc24,_0x3f627e){return function(_0x4062f7){if(_0x4062f7){var _0x2a3a94=typeof _0x3f627e[_0x5504('0x1a')]===_0x5504('0x1b')&&typeof _0x3f627e[_0x5504('0x1c')]===_0x5504('0x1b');var _0xbd60e9=_0x4062f7[_0x5504('0x1d')];var _0x478ffa=_0x2a3a94?0x0:_0x3f627e[_0x5504('0x1a')];var _0xdc9a53=_0x2a3a94?_0x4062f7[_0x5504('0x1d')]:_0x3f627e[_0x5504('0x1a')]+_0x3f627e[_0x5504('0x1c')];var _0x542e9c;if(_0xdc9a53>=_0xbd60e9){_0xdc9a53=_0xbd60e9;_0x542e9c=0xc8;}else{_0x542e9c=0xce;}_0x51cc24['status'](_0x542e9c);return _0x51cc24['set'](_0x5504('0x1e'),_0x478ffa+'-'+_0xdc9a53+'/'+_0xbd60e9)[_0x5504('0x1f')](_0x4062f7);}return null;};}function patchUpdates(_0x951944){return function(_0x3c209f){try{jsonpatch[_0x5504('0x20')](_0x3c209f,_0x951944,!![]);}catch(_0x5c2d00){return BPromise[_0x5504('0x21')](_0x5c2d00);}return _0x3c209f[_0x5504('0x22')]();};}function saveUpdates(_0x2219a2,_0x57c7c0){return function(_0x13005e){if(_0x13005e){return _0x13005e[_0x5504('0x23')](_0x2219a2)[_0x5504('0x24')](function(_0x371beb){return _0x371beb;});}return null;};}function removeEntity(_0x49ef77,_0x146fe8){return function(_0x2afc2b){if(_0x2afc2b){return _0x2afc2b[_0x5504('0x25')]()['then'](function(){_0x49ef77[_0x5504('0x18')](0xcc)[_0x5504('0x19')]();});}};}function handleEntityNotFound(_0x3b3e84,_0x444c33){return function(_0x34105){if(!_0x34105){_0x3b3e84[_0x5504('0x17')](0x194);}return _0x34105;};}function handleError(_0x297746,_0x1a7045){_0x1a7045=_0x1a7045||0x1f4;return function(_0x137cef){logger[_0x5504('0x26')](_0x137cef[_0x5504('0x27')]);if(_0x137cef[_0x5504('0x28')]){delete _0x137cef[_0x5504('0x28')];}_0x297746[_0x5504('0x18')](_0x1a7045)[_0x5504('0x29')](_0x137cef);};}exports[_0x5504('0x2a')]=function(_0x5b9b70,_0x51c561){var _0x9a0038={},_0x592b93={},_0x2f492f={'count':0x0,'rows':[]};var _0x5c68db=_[_0x5504('0x2b')](db[_0x5504('0x2c')][_0x5504('0x2d')],function(_0x221fea){return{'name':_0x221fea[_0x5504('0x2e')],'type':_0x221fea[_0x5504('0x2f')][_0x5504('0x30')]};});_0x592b93[_0x5504('0x31')]=_[_0x5504('0x2b')](_0x5c68db,_0x5504('0x28'));_0x592b93[_0x5504('0x32')]=_[_0x5504('0x33')](_0x5b9b70[_0x5504('0x32')]);_0x592b93['filters']=_[_0x5504('0x34')](_0x592b93[_0x5504('0x31')],_0x592b93[_0x5504('0x32')]);_0x9a0038[_0x5504('0x35')]=_[_0x5504('0x34')](_0x592b93[_0x5504('0x31')],qs[_0x5504('0x36')](_0x5b9b70[_0x5504('0x32')][_0x5504('0x36')]));_0x9a0038[_0x5504('0x35')]=_0x9a0038[_0x5504('0x35')]['length']?_0x9a0038[_0x5504('0x35')]:_0x592b93[_0x5504('0x31')];if(!_0x5b9b70[_0x5504('0x32')][_0x5504('0x37')](_0x5504('0x38'))){_0x9a0038[_0x5504('0x1c')]=qs['limit'](_0x5b9b70[_0x5504('0x32')][_0x5504('0x1c')]);_0x9a0038[_0x5504('0x1a')]=qs[_0x5504('0x1a')](_0x5b9b70[_0x5504('0x32')][_0x5504('0x1a')]);}_0x9a0038[_0x5504('0x39')]=qs[_0x5504('0x3a')](_0x5b9b70['query'][_0x5504('0x3a')]);_0x9a0038[_0x5504('0x3b')]=qs[_0x5504('0x3c')](_[_0x5504('0x3d')](_0x5b9b70[_0x5504('0x32')],_0x592b93['filters']),_0x5c68db);if(_0x5b9b70['query'][_0x5504('0x3e')]){_0x9a0038[_0x5504('0x3b')]=_[_0x5504('0x3f')](_0x9a0038[_0x5504('0x3b')],{'$or':_[_0x5504('0x2b')](_0x5c68db,function(_0x44a9d2){if(_0x44a9d2[_0x5504('0x2f')]!=='VIRTUAL'){var _0x107d28={};_0x107d28[_0x44a9d2[_0x5504('0x28')]]={'$like':'%'+_0x5b9b70[_0x5504('0x32')][_0x5504('0x3e')]+'%'};return _0x107d28;}})});}_0x9a0038=_['merge']({},_0x9a0038,_0x5b9b70[_0x5504('0x40')]);var _0x451223={'where':_0x9a0038['where']};return db['IntegrationReport'][_0x5504('0x1d')](_0x451223)['then'](function(_0x531f3d){_0x2f492f[_0x5504('0x1d')]=_0x531f3d;if(_0x5b9b70[_0x5504('0x32')]['includeAll']){_0x9a0038['include']=[{'all':!![]}];}return db[_0x5504('0x2c')][_0x5504('0x41')](_0x9a0038);})['then'](function(_0x543c3a){_0x2f492f[_0x5504('0x42')]=_0x543c3a;return _0x2f492f;})[_0x5504('0x24')](respondWithFilteredResult(_0x51c561,_0x9a0038))[_0x5504('0x43')](handleError(_0x51c561,null));};exports[_0x5504('0x44')]=function(_0x7962a0,_0x1e6b7f){var _0x43c403={'raw':![],'where':{'id':_0x7962a0[_0x5504('0x45')]['id']}},_0x12670c={};_0x12670c[_0x5504('0x31')]=_[_0x5504('0x33')](db[_0x5504('0x2c')][_0x5504('0x2d')]);_0x12670c[_0x5504('0x32')]=_[_0x5504('0x33')](_0x7962a0[_0x5504('0x32')]);_0x12670c[_0x5504('0x3c')]=_['intersection'](_0x12670c[_0x5504('0x31')],_0x12670c['query']);_0x43c403[_0x5504('0x35')]=_[_0x5504('0x34')](_0x12670c[_0x5504('0x31')],qs[_0x5504('0x36')](_0x7962a0[_0x5504('0x32')]['fields']));_0x43c403[_0x5504('0x35')]=_0x43c403[_0x5504('0x35')][_0x5504('0x46')]?_0x43c403[_0x5504('0x35')]:_0x12670c[_0x5504('0x31')];if(_0x7962a0[_0x5504('0x32')][_0x5504('0x47')]){_0x43c403[_0x5504('0x48')]=[{'all':!![]}];}_0x43c403=_['merge']({},_0x43c403,_0x7962a0[_0x5504('0x40')]);return db[_0x5504('0x2c')]['find'](_0x43c403)['then'](handleEntityNotFound(_0x1e6b7f,null))['then'](respondWithResult(_0x1e6b7f,null))[_0x5504('0x43')](handleError(_0x1e6b7f,null));};exports[_0x5504('0x49')]=function(_0x4a04d1,_0x4643ee){return db['IntegrationReport'][_0x5504('0x49')](_0x4a04d1['body'],{})[_0x5504('0x24')](respondWithResult(_0x4643ee,0xc9))[_0x5504('0x43')](handleError(_0x4643ee,null));};exports['update']=function(_0x1a2e2d,_0x5340e6){if(_0x1a2e2d[_0x5504('0x4a')]['id']){delete _0x1a2e2d[_0x5504('0x4a')]['id'];}return db[_0x5504('0x2c')][_0x5504('0x4b')]({'where':{'id':_0x1a2e2d['params']['id']}})['then'](handleEntityNotFound(_0x5340e6,null))[_0x5504('0x24')](saveUpdates(_0x1a2e2d['body'],null))[_0x5504('0x24')](respondWithResult(_0x5340e6,null))[_0x5504('0x43')](handleError(_0x5340e6,null));};exports['destroy']=function(_0x1e4453,_0xc1a7a4){return db[_0x5504('0x2c')][_0x5504('0x4b')]({'where':{'id':_0x1e4453[_0x5504('0x45')]['id']}})['then'](handleEntityNotFound(_0xc1a7a4,null))[_0x5504('0x24')](removeEntity(_0xc1a7a4,null))[_0x5504('0x43')](handleError(_0xc1a7a4,null));};exports[_0x5504('0x4c')]=function(_0x118c44,_0x59ab11){return db[_0x5504('0x2c')][_0x5504('0x4c')]()[_0x5504('0x24')](respondWithResult(_0x59ab11,null))[_0x5504('0x43')](handleError(_0x59ab11,null));}; \ No newline at end of file +var _0xdb14=['VIRTUAL','options','IntegrationReport','includeAll','include','rows','catch','find','create','body','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge'];(function(_0x413a25,_0x273aa9){var _0x43d03a=function(_0x51bfbb){while(--_0x51bfbb){_0x413a25['push'](_0x413a25['shift']());}};_0x43d03a(++_0x273aa9);}(_0xdb14,0x192));var _0x4db1=function(_0x2f30f0,_0x56aa74){_0x2f30f0=_0x2f30f0-0x0;var _0x56a36a=_0xdb14[_0x2f30f0];return _0x56a36a;};'use strict';var emlformat=require(_0x4db1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4db1('0x1'));var jsonpatch=require(_0x4db1('0x2'));var rp=require(_0x4db1('0x3'));var moment=require(_0x4db1('0x4'));var BPromise=require(_0x4db1('0x5'));var Mustache=require(_0x4db1('0x6'));var util=require(_0x4db1('0x7'));var path=require(_0x4db1('0x8'));var sox=require(_0x4db1('0x9'));var csv=require(_0x4db1('0xa'));var ejs=require(_0x4db1('0xb'));var fs=require('fs');var fs_extra=require(_0x4db1('0xc'));var _=require(_0x4db1('0xd'));var squel=require('squel');var crypto=require(_0x4db1('0xe'));var jsforce=require(_0x4db1('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x4db1('0xa'));var querystring=require('querystring');var Papa=require(_0x4db1('0x10'));var Redis=require(_0x4db1('0x11'));var authService=require(_0x4db1('0x12'));var qs=require(_0x4db1('0x13'));var as=require(_0x4db1('0x14'));var hardwareService=require(_0x4db1('0x15'));var logger=require('../../config/logger')(_0x4db1('0x16'));var utils=require(_0x4db1('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x4db1('0x18'));var db=require(_0x4db1('0x19'))['db'];function respondWithStatusCode(_0x31dcd2,_0x38f6f0){_0x38f6f0=_0x38f6f0||0xcc;return function(_0x5a5c33){if(_0x5a5c33){return _0x31dcd2[_0x4db1('0x1a')](_0x38f6f0);}return _0x31dcd2[_0x4db1('0x1b')](_0x38f6f0)[_0x4db1('0x1c')]();};}function respondWithResult(_0x4af8ff,_0x553175){_0x553175=_0x553175||0xc8;return function(_0x9a7542){if(_0x9a7542){return _0x4af8ff['status'](_0x553175)[_0x4db1('0x1d')](_0x9a7542);}};}function respondWithFilteredResult(_0x2f56cb,_0x47abb8){return function(_0x1644a5){if(_0x1644a5){var _0x5e0474=typeof _0x47abb8['offset']===_0x4db1('0x1e')&&typeof _0x47abb8[_0x4db1('0x1f')]===_0x4db1('0x1e');var _0x292462=_0x1644a5[_0x4db1('0x20')];var _0x566410=_0x5e0474?0x0:_0x47abb8['offset'];var _0x6cfb59=_0x5e0474?_0x1644a5[_0x4db1('0x20')]:_0x47abb8[_0x4db1('0x21')]+_0x47abb8['limit'];var _0x289cb2;if(_0x6cfb59>=_0x292462){_0x6cfb59=_0x292462;_0x289cb2=0xc8;}else{_0x289cb2=0xce;}_0x2f56cb[_0x4db1('0x1b')](_0x289cb2);return _0x2f56cb[_0x4db1('0x22')](_0x4db1('0x23'),_0x566410+'-'+_0x6cfb59+'/'+_0x292462)[_0x4db1('0x1d')](_0x1644a5);}return null;};}function patchUpdates(_0x292e59){return function(_0x7a682f){try{jsonpatch[_0x4db1('0x24')](_0x7a682f,_0x292e59,!![]);}catch(_0x19c3da){return BPromise[_0x4db1('0x25')](_0x19c3da);}return _0x7a682f[_0x4db1('0x26')]();};}function saveUpdates(_0x38bf80,_0x1d8ea3){return function(_0x251fa8){if(_0x251fa8){return _0x251fa8[_0x4db1('0x27')](_0x38bf80)[_0x4db1('0x28')](function(_0xe223f4){return _0xe223f4;});}return null;};}function removeEntity(_0x2ee233,_0x2927e6){return function(_0x3d2562){if(_0x3d2562){return _0x3d2562[_0x4db1('0x29')]()[_0x4db1('0x28')](function(){_0x2ee233[_0x4db1('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2083d1,_0x27ee38){return function(_0x15481a){if(!_0x15481a){_0x2083d1['sendStatus'](0x194);}return _0x15481a;};}function handleError(_0x4e6d53,_0x40b0a4){_0x40b0a4=_0x40b0a4||0x1f4;return function(_0x3ef7bd){logger[_0x4db1('0x2a')](_0x3ef7bd[_0x4db1('0x2b')]);if(_0x3ef7bd[_0x4db1('0x2c')]){delete _0x3ef7bd[_0x4db1('0x2c')];}_0x4e6d53[_0x4db1('0x1b')](_0x40b0a4)['send'](_0x3ef7bd);};}exports['index']=function(_0x39221d,_0x5825da){var _0x41e1b4={},_0x4d6a31={},_0x4c0a68={'count':0x0,'rows':[]};var _0x3438ff=_[_0x4db1('0x2d')](db['IntegrationReport'][_0x4db1('0x2e')],function(_0x354675){return{'name':_0x354675[_0x4db1('0x2f')],'type':_0x354675[_0x4db1('0x30')][_0x4db1('0x31')]};});_0x4d6a31[_0x4db1('0x32')]=_[_0x4db1('0x2d')](_0x3438ff,_0x4db1('0x2c'));_0x4d6a31[_0x4db1('0x33')]=_[_0x4db1('0x34')](_0x39221d['query']);_0x4d6a31['filters']=_[_0x4db1('0x35')](_0x4d6a31[_0x4db1('0x32')],_0x4d6a31['query']);_0x41e1b4['attributes']=_[_0x4db1('0x35')](_0x4d6a31[_0x4db1('0x32')],qs[_0x4db1('0x36')](_0x39221d[_0x4db1('0x33')][_0x4db1('0x36')]));_0x41e1b4['attributes']=_0x41e1b4[_0x4db1('0x37')][_0x4db1('0x38')]?_0x41e1b4[_0x4db1('0x37')]:_0x4d6a31[_0x4db1('0x32')];if(!_0x39221d['query'][_0x4db1('0x39')](_0x4db1('0x3a'))){_0x41e1b4[_0x4db1('0x1f')]=qs['limit'](_0x39221d['query'][_0x4db1('0x1f')]);_0x41e1b4['offset']=qs[_0x4db1('0x21')](_0x39221d[_0x4db1('0x33')][_0x4db1('0x21')]);}_0x41e1b4[_0x4db1('0x3b')]=qs['sort'](_0x39221d[_0x4db1('0x33')][_0x4db1('0x3c')]);_0x41e1b4[_0x4db1('0x3d')]=qs[_0x4db1('0x3e')](_[_0x4db1('0x3f')](_0x39221d[_0x4db1('0x33')],_0x4d6a31[_0x4db1('0x3e')]),_0x3438ff);if(_0x39221d[_0x4db1('0x33')][_0x4db1('0x40')]){_0x41e1b4[_0x4db1('0x3d')]=_[_0x4db1('0x41')](_0x41e1b4[_0x4db1('0x3d')],{'$or':_[_0x4db1('0x2d')](_0x3438ff,function(_0x5d77d0){if(_0x5d77d0[_0x4db1('0x30')]!==_0x4db1('0x42')){var _0x2051ce={};_0x2051ce[_0x5d77d0[_0x4db1('0x2c')]]={'$like':'%'+_0x39221d[_0x4db1('0x33')][_0x4db1('0x40')]+'%'};return _0x2051ce;}})});}_0x41e1b4=_[_0x4db1('0x41')]({},_0x41e1b4,_0x39221d[_0x4db1('0x43')]);var _0xdd6dfb={'where':_0x41e1b4[_0x4db1('0x3d')]};return db[_0x4db1('0x44')][_0x4db1('0x20')](_0xdd6dfb)[_0x4db1('0x28')](function(_0x1b1270){_0x4c0a68['count']=_0x1b1270;if(_0x39221d[_0x4db1('0x33')][_0x4db1('0x45')]){_0x41e1b4[_0x4db1('0x46')]=[{'all':!![]}];}return db['IntegrationReport']['findAll'](_0x41e1b4);})[_0x4db1('0x28')](function(_0x3d70d6){_0x4c0a68[_0x4db1('0x47')]=_0x3d70d6;return _0x4c0a68;})[_0x4db1('0x28')](respondWithFilteredResult(_0x5825da,_0x41e1b4))[_0x4db1('0x48')](handleError(_0x5825da,null));};exports['show']=function(_0x30261b,_0x1b4d31){var _0x4e8615={'raw':![],'where':{'id':_0x30261b['params']['id']}},_0x6f588b={};_0x6f588b[_0x4db1('0x32')]=_[_0x4db1('0x34')](db[_0x4db1('0x44')][_0x4db1('0x2e')]);_0x6f588b[_0x4db1('0x33')]=_[_0x4db1('0x34')](_0x30261b[_0x4db1('0x33')]);_0x6f588b[_0x4db1('0x3e')]=_['intersection'](_0x6f588b['model'],_0x6f588b[_0x4db1('0x33')]);_0x4e8615[_0x4db1('0x37')]=_[_0x4db1('0x35')](_0x6f588b[_0x4db1('0x32')],qs[_0x4db1('0x36')](_0x30261b[_0x4db1('0x33')][_0x4db1('0x36')]));_0x4e8615[_0x4db1('0x37')]=_0x4e8615[_0x4db1('0x37')]['length']?_0x4e8615['attributes']:_0x6f588b[_0x4db1('0x32')];if(_0x30261b[_0x4db1('0x33')]['includeAll']){_0x4e8615[_0x4db1('0x46')]=[{'all':!![]}];}_0x4e8615=_['merge']({},_0x4e8615,_0x30261b[_0x4db1('0x43')]);return db[_0x4db1('0x44')][_0x4db1('0x49')](_0x4e8615)[_0x4db1('0x28')](handleEntityNotFound(_0x1b4d31,null))[_0x4db1('0x28')](respondWithResult(_0x1b4d31,null))[_0x4db1('0x48')](handleError(_0x1b4d31,null));};exports[_0x4db1('0x4a')]=function(_0x165b08,_0x2c5707){return db[_0x4db1('0x44')]['create'](_0x165b08[_0x4db1('0x4b')],{})[_0x4db1('0x28')](respondWithResult(_0x2c5707,0xc9))[_0x4db1('0x48')](handleError(_0x2c5707,null));};exports['update']=function(_0x181039,_0x55b545){if(_0x181039[_0x4db1('0x4b')]['id']){delete _0x181039['body']['id'];}return db[_0x4db1('0x44')][_0x4db1('0x49')]({'where':{'id':_0x181039[_0x4db1('0x4c')]['id']}})['then'](handleEntityNotFound(_0x55b545,null))[_0x4db1('0x28')](saveUpdates(_0x181039[_0x4db1('0x4b')],null))[_0x4db1('0x28')](respondWithResult(_0x55b545,null))[_0x4db1('0x48')](handleError(_0x55b545,null));};exports[_0x4db1('0x29')]=function(_0x1084b2,_0x3caaa9){return db[_0x4db1('0x44')][_0x4db1('0x49')]({'where':{'id':_0x1084b2['params']['id']}})['then'](handleEntityNotFound(_0x3caaa9,null))['then'](removeEntity(_0x3caaa9,null))[_0x4db1('0x48')](handleError(_0x3caaa9,null));};exports[_0x4db1('0x4d')]=function(_0xf703f7,_0x826dc3){return db['IntegrationReport'][_0x4db1('0x4d')]()[_0x4db1('0x28')](respondWithResult(_0x826dc3,null))[_0x4db1('0x48')](handleError(_0x826dc3,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 509c910..d0585df 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 _0x206a=['moment','../../config/environment','exports','define','report_integration','lodash','../../config/logger','api'];(function(_0x2ec0b2,_0x82244){var _0x4370f1=function(_0x43d7d2){while(--_0x43d7d2){_0x2ec0b2['push'](_0x2ec0b2['shift']());}};_0x4370f1(++_0x82244);}(_0x206a,0x1bd));var _0xa206=function(_0x37affd,_0x53e54d){_0x37affd=_0x37affd-0x0;var _0x5c385a=_0x206a[_0x37affd];return _0x5c385a;};'use strict';var _=require(_0xa206('0x0'));var util=require('util');var logger=require(_0xa206('0x1'))(_0xa206('0x2'));var moment=require(_0xa206('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa206('0x4'));var attributes=require('./integrationReport.attributes');module[_0xa206('0x5')]=function(_0x64801c,_0x17f5c3){return _0x64801c[_0xa206('0x6')]('IntegrationReport',attributes,{'tableName':_0xa206('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfb67=['util','../../config/logger','api','path','../../config/environment','./integrationReport.attributes','exports','lodash'];(function(_0x3ac79e,_0x5a1242){var _0x2b52f7=function(_0x3996fb){while(--_0x3996fb){_0x3ac79e['push'](_0x3ac79e['shift']());}};_0x2b52f7(++_0x5a1242);}(_0xfb67,0x167));var _0x7fb6=function(_0x476d66,_0x219d00){_0x476d66=_0x476d66-0x0;var _0x4f676b=_0xfb67[_0x476d66];return _0x4f676b;};'use strict';var _=require(_0x7fb6('0x0'));var util=require(_0x7fb6('0x1'));var logger=require(_0x7fb6('0x2'))(_0x7fb6('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7fb6('0x4'));var rimraf=require('rimraf');var config=require(_0x7fb6('0x5'));var attributes=require(_0x7fb6('0x6'));module[_0x7fb6('0x7')]=function(_0x56c065,_0x5c6f58){return _0x56c065['define']('IntegrationReport',attributes,{'tableName':'report_integration','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.rpc.js b/server/api/integrationReport/integrationReport.rpc.js index f609cbe..276ae1c 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 _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(_0x2253ea,_0x6320e){var _0x2d046c=function(_0x707761){while(--_0x707761){_0x2253ea['push'](_0x2253ea['shift']());}};_0x2d046c(++_0x6320e);}(_0xadb5,0xad));var _0x5adb=function(_0x12f99e,_0x166635){_0x12f99e=_0x12f99e-0x0;var _0x11244a=_0xadb5[_0x12f99e];return _0x11244a;};'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 +var _0x57ca=['client','http','request','info','request\x20sent','IntegrationReport,\x20%s,\x20%s,\x20%s','error','code','IntegrationReport,\x20%s,\x20%s','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x38eb9e,_0x440324){var _0x12b3b4=function(_0x1a5c71){while(--_0x1a5c71){_0x38eb9e['push'](_0x38eb9e['shift']());}};_0x12b3b4(++_0x440324);}(_0x57ca,0x108));var _0xa57c=function(_0x40092f,_0x55a6a5){_0x40092f=_0x40092f-0x0;var _0x283923=_0x57ca[_0x40092f];return _0x283923;};'use strict';var _=require('lodash');var util=require(_0xa57c('0x0'));var moment=require(_0xa57c('0x1'));var BPromise=require('bluebird');var rs=require(_0xa57c('0x2'));var fs=require('fs');var Redis=require(_0xa57c('0x3'));var db=require(_0xa57c('0x4'))['db'];var utils=require(_0xa57c('0x5'));var logger=require(_0xa57c('0x6'))('rpc');var config=require(_0xa57c('0x7'));var jayson=require(_0xa57c('0x8'));var client=jayson[_0xa57c('0x9')][_0xa57c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xbdfffb,_0x314574,_0x19e28e){return new BPromise(function(_0x271ccc,_0x5e3962){return client[_0xa57c('0xb')](_0xbdfffb,_0x19e28e)['then'](function(_0x46ba92){logger[_0xa57c('0xc')]('IntegrationReport,\x20%s,\x20%s',_0x314574,_0xa57c('0xd'));logger['debug'](_0xa57c('0xe'),_0x314574,_0xa57c('0xd'),JSON['stringify'](_0x46ba92));if(_0x46ba92[_0xa57c('0xf')]){if(_0x46ba92['error'][_0xa57c('0x10')]===0x1f4){logger[_0xa57c('0xf')](_0xa57c('0x11'),_0x314574,_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);return _0x5e3962(_0x46ba92['error'][_0xa57c('0x12')]);}logger['error'](_0xa57c('0x11'),_0x314574,_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);return _0x271ccc(_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);}else{logger[_0xa57c('0xc')](_0xa57c('0x11'),_0x314574,'request\x20sent');_0x271ccc(_0x46ba92[_0xa57c('0x13')][_0xa57c('0x12')]);}})[_0xa57c('0x14')](function(_0x5a6024){logger[_0xa57c('0xf')]('IntegrationReport,\x20%s,\x20%s',_0x314574,_0x5a6024);_0x5e3962(_0x5a6024);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 48a5216..d21ddf5 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 _0x2cc4=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./interval.controller','get','isAuthenticated','index','/:id','show','/:id/sub_intervals','getIntervals','post','create','addIntervals'];(function(_0x1cca4f,_0x1af874){var _0x486fed=function(_0x89468f){while(--_0x89468f){_0x1cca4f['push'](_0x1cca4f['shift']());}};_0x486fed(++_0x1af874);}(_0x2cc4,0xdd));var _0x42cc=function(_0x4b91c4,_0x23f35f){_0x4b91c4=_0x4b91c4-0x0;var _0x25cb80=_0x2cc4[_0x4b91c4];return _0x25cb80;};'use strict';var multer=require(_0x42cc('0x0'));var util=require(_0x42cc('0x1'));var path=require(_0x42cc('0x2'));var timeout=require(_0x42cc('0x3'));var express=require(_0x42cc('0x4'));var router=express['Router']();var fs_extra=require(_0x42cc('0x5'));var auth=require(_0x42cc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x42cc('0x7'));var controller=require(_0x42cc('0x8'));router[_0x42cc('0x9')]('/',auth[_0x42cc('0xa')](),controller[_0x42cc('0xb')]);router['get'](_0x42cc('0xc'),auth[_0x42cc('0xa')](),controller[_0x42cc('0xd')]);router[_0x42cc('0x9')](_0x42cc('0xe'),auth[_0x42cc('0xa')](),controller[_0x42cc('0xf')]);router[_0x42cc('0x10')]('/',auth[_0x42cc('0xa')](),controller[_0x42cc('0x11')]);router[_0x42cc('0x10')](_0x42cc('0xe'),auth['isAuthenticated'](),controller['addInterval']);router['post']('/:id/sub_intervals/create_many',auth[_0x42cc('0xa')](),controller[_0x42cc('0x12')]);router[_0x42cc('0x13')](_0x42cc('0xc'),auth['isAuthenticated'](),controller[_0x42cc('0x14')]);router[_0x42cc('0x15')](_0x42cc('0xc'),auth[_0x42cc('0xa')](),controller[_0x42cc('0x16')]);module[_0x42cc('0x17')]=router; \ No newline at end of file +var _0xabce=['/:id/sub_intervals','addInterval','/:id/sub_intervals/create_many','addIntervals','put','/:id','delete','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','show','getIntervals','post','create'];(function(_0x5153df,_0x67bc3){var _0x55884e=function(_0x5d2eb1){while(--_0x5d2eb1){_0x5153df['push'](_0x5153df['shift']());}};_0x55884e(++_0x67bc3);}(_0xabce,0x103));var _0xeabc=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xabce[_0x3b5250];return _0xc844a1;};'use strict';var multer=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var path=require(_0xeabc('0x2'));var timeout=require(_0xeabc('0x3'));var express=require(_0xeabc('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xeabc('0x5'));var interaction=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var controller=require('./interval.controller');router['get']('/',auth[_0xeabc('0x8')](),controller['index']);router[_0xeabc('0x9')]('/:id',auth[_0xeabc('0x8')](),controller[_0xeabc('0xa')]);router[_0xeabc('0x9')]('/:id/sub_intervals',auth[_0xeabc('0x8')](),controller[_0xeabc('0xb')]);router[_0xeabc('0xc')]('/',auth[_0xeabc('0x8')](),controller[_0xeabc('0xd')]);router[_0xeabc('0xc')](_0xeabc('0xe'),auth[_0xeabc('0x8')](),controller[_0xeabc('0xf')]);router[_0xeabc('0xc')](_0xeabc('0x10'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x11')]);router[_0xeabc('0x12')](_0xeabc('0x13'),auth[_0xeabc('0x8')](),controller['update']);router[_0xeabc('0x14')](_0xeabc('0x13'),auth[_0xeabc('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index a70ddc2..d2885c4 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 _0x8d91=['sequelize','STRING'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8d91,0xda));var _0x18d9=function(_0x52bb5c,_0x4528c3){_0x52bb5c=_0x52bb5c-0x0;var _0x416f42=_0x8d91[_0x52bb5c];return _0x416f42;};'use strict';var Sequelize=require(_0x18d9('0x0'));module['exports']={'name':{'type':Sequelize[_0x18d9('0x1')]},'description':{'type':Sequelize[_0x18d9('0x1')]},'interval':{'type':Sequelize[_0x18d9('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0x9f96=['sequelize','exports','STRING'];(function(_0x269f02,_0x224371){var _0x2c8ebf=function(_0x243f81){while(--_0x243f81){_0x269f02['push'](_0x269f02['shift']());}};_0x2c8ebf(++_0x224371);}(_0x9f96,0x156));var _0x69f9=function(_0x57e79d,_0x51aefb){_0x57e79d=_0x57e79d-0x0;var _0x366916=_0x9f96[_0x57e79d];return _0x366916;};'use strict';var Sequelize=require(_0x69f9('0x0'));module[_0x69f9('0x1')]={'name':{'type':Sequelize[_0x69f9('0x2')]},'description':{'type':Sequelize[_0x69f9('0x2')]},'interval':{'type':Sequelize[_0x69f9('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 1076e84..c6cd74c 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 _0x2795=['include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Intervals','UserProfileSection','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','IntervalId','getIntervals','findOne','length','pick','addIntervals','transaction','bulkCreate','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','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','map','Interval','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filter','merge','where','options','includeAll'];(function(_0x4f276c,_0x249be1){var _0x3ba50d=function(_0x561ab6){while(--_0x561ab6){_0x4f276c['push'](_0x4f276c['shift']());}};_0x3ba50d(++_0x249be1);}(_0x2795,0x77));var _0x5279=function(_0x3e64d7,_0x225dea){_0x3e64d7=_0x3e64d7-0x0;var _0x5c47fd=_0x2795[_0x3e64d7];return _0x5c47fd;};'use strict';var emlformat=require(_0x5279('0x0'));var rimraf=require(_0x5279('0x1'));var zipdir=require(_0x5279('0x2'));var jsonpatch=require(_0x5279('0x3'));var rp=require(_0x5279('0x4'));var moment=require(_0x5279('0x5'));var BPromise=require(_0x5279('0x6'));var Mustache=require(_0x5279('0x7'));var util=require(_0x5279('0x8'));var path=require(_0x5279('0x9'));var sox=require('sox');var csv=require(_0x5279('0xa'));var ejs=require(_0x5279('0xb'));var fs=require('fs');var fs_extra=require(_0x5279('0xc'));var _=require(_0x5279('0xd'));var squel=require(_0x5279('0xe'));var crypto=require('crypto');var jsforce=require(_0x5279('0xf'));var deskjs=require(_0x5279('0x10'));var toCsv=require(_0x5279('0xa'));var querystring=require(_0x5279('0x11'));var Papa=require(_0x5279('0x12'));var Redis=require(_0x5279('0x13'));var authService=require(_0x5279('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x5279('0x15'));var hardwareService=require(_0x5279('0x16'));var logger=require(_0x5279('0x17'))(_0x5279('0x18'));var utils=require('../../config/utils');var config=require(_0x5279('0x19'));var licenseUtil=require(_0x5279('0x1a'));var db=require(_0x5279('0x1b'))['db'];var extensions=require(_0x5279('0x1c'));function respondWithStatusCode(_0x549f39,_0x48e068){_0x48e068=_0x48e068||0xcc;return function(_0x1bbd8f){if(_0x1bbd8f){return _0x549f39['sendStatus'](_0x48e068);}return _0x549f39[_0x5279('0x1d')](_0x48e068)[_0x5279('0x1e')]();};}function respondWithResult(_0x27f19d,_0x1bf284){_0x1bf284=_0x1bf284||0xc8;return function(_0x119da2){if(_0x119da2){return _0x27f19d[_0x5279('0x1d')](_0x1bf284)[_0x5279('0x1f')](_0x119da2);}};}function respondWithFilteredResult(_0x2ae7e1,_0x43829f){return function(_0x3ca515){if(_0x3ca515){var _0x178c21=typeof _0x43829f[_0x5279('0x20')]===_0x5279('0x21')&&typeof _0x43829f[_0x5279('0x22')]===_0x5279('0x21');var _0x5a5fc0=_0x3ca515[_0x5279('0x23')];var _0x3caad8=_0x178c21?0x0:_0x43829f[_0x5279('0x20')];var _0x2f831c=_0x178c21?_0x3ca515['count']:_0x43829f[_0x5279('0x20')]+_0x43829f[_0x5279('0x22')];var _0x1289a5;if(_0x2f831c>=_0x5a5fc0){_0x2f831c=_0x5a5fc0;_0x1289a5=0xc8;}else{_0x1289a5=0xce;}_0x2ae7e1[_0x5279('0x1d')](_0x1289a5);return _0x2ae7e1[_0x5279('0x24')](_0x5279('0x25'),_0x3caad8+'-'+_0x2f831c+'/'+_0x5a5fc0)[_0x5279('0x1f')](_0x3ca515);}return null;};}function patchUpdates(_0x2a330f){return function(_0x1e7d58){try{jsonpatch[_0x5279('0x26')](_0x1e7d58,_0x2a330f,!![]);}catch(_0x1abc67){return BPromise[_0x5279('0x27')](_0x1abc67);}return _0x1e7d58['save']();};}function saveUpdates(_0x30269a,_0x363679){return function(_0x55f6d6){if(_0x55f6d6){return _0x55f6d6[_0x5279('0x28')](_0x30269a)[_0x5279('0x29')](function(_0x1a6c83){return _0x1a6c83;});}return null;};}function removeEntity(_0xfa8dce,_0x346bb5){return function(_0x5d984e){if(_0x5d984e){return _0x5d984e[_0x5279('0x2a')]()[_0x5279('0x29')](function(){var _0x433298=_0x5d984e['get']({'plain':!![]});var _0x56a452='Intervals';return db['UserProfileResource']['destroy']({'where':{'type':_0x56a452,'resourceId':_0x433298['id']}})['then'](function(){return _0x5d984e;});})[_0x5279('0x29')](function(){_0xfa8dce['status'](0xcc)[_0x5279('0x1e')]();});}};}function handleEntityNotFound(_0x3be518,_0x5e7ad2){return function(_0x4da46d){if(!_0x4da46d){_0x3be518['sendStatus'](0x194);}return _0x4da46d;};}function handleError(_0x1789f8,_0x998e77){_0x998e77=_0x998e77||0x1f4;return function(_0xdbec75){logger['error'](_0xdbec75[_0x5279('0x2b')]);if(_0xdbec75['name']){delete _0xdbec75[_0x5279('0x2c')];}_0x1789f8[_0x5279('0x1d')](_0x998e77)[_0x5279('0x2d')](_0xdbec75);};}exports['index']=function(_0x2b8e74,_0x4ac948){var _0x227eed={},_0x22877f={},_0x4f2406={'count':0x0,'rows':[]};var _0x23ff77=_[_0x5279('0x2e')](db[_0x5279('0x2f')][_0x5279('0x30')],function(_0x4999cf){return{'name':_0x4999cf[_0x5279('0x31')],'type':_0x4999cf[_0x5279('0x32')]['key']};});_0x22877f[_0x5279('0x33')]=_[_0x5279('0x2e')](_0x23ff77,_0x5279('0x2c'));_0x22877f[_0x5279('0x34')]=_[_0x5279('0x35')](_0x2b8e74['query']);_0x22877f[_0x5279('0x36')]=_[_0x5279('0x37')](_0x22877f[_0x5279('0x33')],_0x22877f[_0x5279('0x34')]);_0x227eed[_0x5279('0x38')]=_['intersection'](_0x22877f[_0x5279('0x33')],qs[_0x5279('0x39')](_0x2b8e74[_0x5279('0x34')][_0x5279('0x39')]));_0x227eed[_0x5279('0x38')]=_0x227eed[_0x5279('0x38')]['length']?_0x227eed['attributes']:_0x22877f[_0x5279('0x33')];if(!_0x2b8e74[_0x5279('0x34')][_0x5279('0x3a')](_0x5279('0x3b'))){_0x227eed['limit']=qs[_0x5279('0x22')](_0x2b8e74['query']['limit']);_0x227eed[_0x5279('0x20')]=qs['offset'](_0x2b8e74[_0x5279('0x34')]['offset']);}_0x227eed[_0x5279('0x3c')]=qs[_0x5279('0x3d')](_0x2b8e74[_0x5279('0x34')][_0x5279('0x3d')]);_0x227eed['where']=qs[_0x5279('0x36')](_['pick'](_0x2b8e74[_0x5279('0x34')],_0x22877f[_0x5279('0x36')]),_0x23ff77);if(_0x2b8e74[_0x5279('0x34')][_0x5279('0x3e')]){_0x227eed['where']=_[_0x5279('0x3f')](_0x227eed[_0x5279('0x40')],{'$or':_[_0x5279('0x2e')](_0x23ff77,function(_0x22a50b){if(_0x22a50b[_0x5279('0x32')]!=='VIRTUAL'){var _0x536d30={};_0x536d30[_0x22a50b[_0x5279('0x2c')]]={'$like':'%'+_0x2b8e74[_0x5279('0x34')][_0x5279('0x3e')]+'%'};return _0x536d30;}})});}_0x227eed=_[_0x5279('0x3f')]({},_0x227eed,_0x2b8e74[_0x5279('0x41')]);var _0x139931={'where':_0x227eed[_0x5279('0x40')]};return db[_0x5279('0x2f')][_0x5279('0x23')](_0x139931)[_0x5279('0x29')](function(_0x2c2044){_0x4f2406[_0x5279('0x23')]=_0x2c2044;if(_0x2b8e74[_0x5279('0x34')][_0x5279('0x42')]){_0x227eed[_0x5279('0x43')]=[{'all':!![]}];}return db['Interval'][_0x5279('0x44')](_0x227eed);})[_0x5279('0x29')](function(_0x4e65ce){_0x4f2406[_0x5279('0x45')]=_0x4e65ce;return _0x4f2406;})['then'](respondWithFilteredResult(_0x4ac948,_0x227eed))[_0x5279('0x46')](handleError(_0x4ac948,null));};exports[_0x5279('0x47')]=function(_0x2d73a1,_0x474cf7){var _0x984ac9={'raw':!![],'where':{'id':_0x2d73a1[_0x5279('0x48')]['id']}},_0x34d3dc={};_0x34d3dc[_0x5279('0x33')]=_[_0x5279('0x35')](db[_0x5279('0x2f')][_0x5279('0x30')]);_0x34d3dc[_0x5279('0x34')]=_[_0x5279('0x35')](_0x2d73a1[_0x5279('0x34')]);_0x34d3dc[_0x5279('0x36')]=_[_0x5279('0x37')](_0x34d3dc['model'],_0x34d3dc[_0x5279('0x34')]);_0x984ac9[_0x5279('0x38')]=_['intersection'](_0x34d3dc[_0x5279('0x33')],qs[_0x5279('0x39')](_0x2d73a1[_0x5279('0x34')][_0x5279('0x39')]));_0x984ac9['attributes']=_0x984ac9[_0x5279('0x38')]['length']?_0x984ac9[_0x5279('0x38')]:_0x34d3dc[_0x5279('0x33')];if(_0x2d73a1[_0x5279('0x34')][_0x5279('0x42')]){_0x984ac9['include']=[{'all':!![]}];}_0x984ac9=_[_0x5279('0x3f')]({},_0x984ac9,_0x2d73a1[_0x5279('0x41')]);return db[_0x5279('0x2f')][_0x5279('0x49')](_0x984ac9)[_0x5279('0x29')](handleEntityNotFound(_0x474cf7,null))['then'](respondWithResult(_0x474cf7,null))[_0x5279('0x46')](handleError(_0x474cf7,null));};exports['create']=function(_0x122d87,_0x30d057){return db[_0x5279('0x2f')][_0x5279('0x4a')](_0x122d87[_0x5279('0x4b')],{})[_0x5279('0x29')](function(_0x1440f0){var _0x13d883=_0x122d87[_0x5279('0x4c')]['get']({'plain':!![]});if(!_0x13d883)throw new Error(_0x5279('0x4d'));if(_0x13d883['role']===_0x5279('0x4c')){var _0x8c7f8c=_0x1440f0['get']({'plain':!![]});var _0x2ec47f=_0x5279('0x4e');return db[_0x5279('0x4f')][_0x5279('0x49')]({'where':{'name':_0x2ec47f,'userProfileId':_0x13d883['userProfileId']},'raw':!![]})['then'](function(_0xcd9c4c){if(_0xcd9c4c&&_0xcd9c4c[_0x5279('0x50')]===0x0){return db[_0x5279('0x51')][_0x5279('0x4a')]({'name':_0x8c7f8c[_0x5279('0x2c')],'resourceId':_0x8c7f8c['id'],'type':_0xcd9c4c[_0x5279('0x2c')],'sectionId':_0xcd9c4c['id']},{})['then'](function(){return _0x1440f0;});}else{return _0x1440f0;}})[_0x5279('0x46')](function(_0x3f851f){logger[_0x5279('0x52')](_0x5279('0x53'),_0x3f851f);throw _0x3f851f;});}return _0x1440f0;})[_0x5279('0x29')](respondWithResult(_0x30d057,0xc9))[_0x5279('0x46')](handleError(_0x30d057,null));};exports[_0x5279('0x28')]=function(_0x4c04d8,_0x2778e9){if(_0x4c04d8[_0x5279('0x4b')]['id']){delete _0x4c04d8[_0x5279('0x4b')]['id'];}return db[_0x5279('0x2f')]['find']({'where':{'id':_0x4c04d8[_0x5279('0x48')]['id']}})['then'](handleEntityNotFound(_0x2778e9,null))[_0x5279('0x29')](saveUpdates(_0x4c04d8[_0x5279('0x4b')],null))['then'](respondWithResult(_0x2778e9,null))[_0x5279('0x46')](handleError(_0x2778e9,null));};exports[_0x5279('0x2a')]=function(_0x57f04b,_0x556e26){return db['Interval']['find']({'where':{'id':_0x57f04b[_0x5279('0x48')]['id']}})['then'](handleEntityNotFound(_0x556e26,null))[_0x5279('0x29')](removeEntity(_0x556e26,null))['catch'](handleError(_0x556e26,null));};exports[_0x5279('0x54')]=function(_0x4feca0,_0x4e39d2,_0x173df6){if(_0x4feca0[_0x5279('0x4b')]['id']){delete _0x4feca0[_0x5279('0x4b')]['id'];}return db[_0x5279('0x2f')][_0x5279('0x49')]({'where':{'id':_0x4feca0[_0x5279('0x48')]['id']}})[_0x5279('0x29')](handleEntityNotFound(_0x4e39d2,null))[_0x5279('0x29')](function(_0x4bc78d){if(_0x4bc78d){_0x4feca0[_0x5279('0x4b')][_0x5279('0x55')]=_0x4bc78d['id'];return db[_0x5279('0x2f')][_0x5279('0x4a')](_0x4feca0[_0x5279('0x4b')]);}})['then'](respondWithResult(_0x4e39d2,null))[_0x5279('0x46')](handleError(_0x4e39d2,null));};exports[_0x5279('0x56')]=function(_0x4d9cf3,_0x2f493f,_0x5297d5){var _0x490236={};var _0x4ecaae={};var _0x21f0d2;var _0x53f3d6;return db['Interval'][_0x5279('0x57')]({'where':{'id':_0x4d9cf3[_0x5279('0x48')]['id']}})['then'](handleEntityNotFound(_0x2f493f,null))['then'](function(_0x3cb195){if(_0x3cb195){_0x21f0d2=_0x3cb195;_0x4ecaae[_0x5279('0x33')]=_[_0x5279('0x35')](db['Interval']['rawAttributes']);_0x4ecaae[_0x5279('0x34')]=_[_0x5279('0x35')](_0x4d9cf3[_0x5279('0x34')]);_0x4ecaae[_0x5279('0x36')]=_[_0x5279('0x37')](_0x4ecaae[_0x5279('0x33')],_0x4ecaae['query']);_0x490236[_0x5279('0x38')]=_['intersection'](_0x4ecaae[_0x5279('0x33')],qs[_0x5279('0x39')](_0x4d9cf3['query'][_0x5279('0x39')]));_0x490236[_0x5279('0x38')]=_0x490236[_0x5279('0x38')][_0x5279('0x58')]?_0x490236['attributes']:_0x4ecaae[_0x5279('0x33')];_0x490236[_0x5279('0x3c')]=qs['sort'](_0x4d9cf3[_0x5279('0x34')][_0x5279('0x3d')]);_0x490236[_0x5279('0x40')]=qs[_0x5279('0x36')](_[_0x5279('0x59')](_0x4d9cf3['query'],_0x4ecaae[_0x5279('0x36')]));if(_0x4d9cf3[_0x5279('0x34')][_0x5279('0x3e')]){_0x490236[_0x5279('0x40')]=_[_0x5279('0x3f')](_0x490236[_0x5279('0x40')],{'$or':_['map'](_0x490236[_0x5279('0x38')],function(_0x222c18){var _0x5e8123={};_0x5e8123[_0x222c18]={'$like':'%'+_0x4d9cf3[_0x5279('0x34')]['filter']+'%'};return _0x5e8123;})});}_0x490236=_[_0x5279('0x3f')]({},_0x490236,_0x4d9cf3[_0x5279('0x41')]);return _0x21f0d2[_0x5279('0x56')](_0x490236);}})[_0x5279('0x29')](function(_0x762181){if(_0x762181){_0x53f3d6=_0x762181[_0x5279('0x58')];if(!_0x4d9cf3[_0x5279('0x34')][_0x5279('0x3a')]('nolimit')){_0x490236[_0x5279('0x22')]=qs['limit'](_0x4d9cf3[_0x5279('0x34')]['limit']);_0x490236[_0x5279('0x20')]=qs[_0x5279('0x20')](_0x4d9cf3[_0x5279('0x34')][_0x5279('0x20')]);}return _0x21f0d2[_0x5279('0x56')](_0x490236);}})[_0x5279('0x29')](function(_0x47ca63){if(_0x47ca63){return _0x47ca63?{'count':_0x53f3d6,'rows':_0x47ca63}:null;}})['then'](respondWithResult(_0x2f493f,null))[_0x5279('0x46')](handleError(_0x2f493f,null));};exports[_0x5279('0x5a')]=function(_0x4dda47,_0x2a2f05,_0x5d6437){return db[_0x5279('0x2f')][_0x5279('0x57')]({'where':{'id':_0x4dda47[_0x5279('0x48')]['id']}})[_0x5279('0x29')](handleEntityNotFound(_0x2a2f05,null))[_0x5279('0x29')](function(_0xcaf92c){if(_0xcaf92c){return db['sequelize'][_0x5279('0x5b')](function(_0xc277fb){return db[_0x5279('0x2f')]['destroy']({'where':{'IntervalId':_0x4dda47[_0x5279('0x48')]['id']},'transaction':_0xc277fb})[_0x5279('0x29')](function(_0x12cad2){var _0x11d116=_[_0x5279('0x2e')](_0x4dda47['body'],function(_0xe65ab0){delete _0xe65ab0['id'];_0xe65ab0['IntervalId']=_0x4dda47[_0x5279('0x48')]['id'];return _0xe65ab0;});return db['Interval'][_0x5279('0x5c')](_0x11d116,{'transaction':_0xc277fb});});})[_0x5279('0x29')](function(){return db[_0x5279('0x2f')][_0x5279('0x44')]({'where':{'IntervalId':_0x4dda47[_0x5279('0x48')]['id']}});});}})[_0x5279('0x29')](respondWithResult(_0x2a2f05,null))[_0x5279('0x46')](handleError(_0x2a2f05,null));}; \ No newline at end of file +var _0x8dc9=['sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','IntervalId','getIntervals','findOne','filter','addIntervals','transaction','bulkCreate','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','then','get','Intervals','UserProfileResource','error','stack','name','send','Interval','rawAttributes','type','key','map','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order'];(function(_0x7185f7,_0x37065){var _0x182e45=function(_0x519e0d){while(--_0x519e0d){_0x7185f7['push'](_0x7185f7['shift']());}};_0x182e45(++_0x37065);}(_0x8dc9,0x74));var _0x98dc=function(_0x4a171f,_0x2fc4c4){_0x4a171f=_0x4a171f-0x0;var _0x36777e=_0x8dc9[_0x4a171f];return _0x36777e;};'use strict';var emlformat=require(_0x98dc('0x0'));var rimraf=require(_0x98dc('0x1'));var zipdir=require(_0x98dc('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x98dc('0x3'));var moment=require(_0x98dc('0x4'));var BPromise=require(_0x98dc('0x5'));var Mustache=require(_0x98dc('0x6'));var util=require(_0x98dc('0x7'));var path=require(_0x98dc('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x98dc('0x9'));var fs=require('fs');var fs_extra=require(_0x98dc('0xa'));var _=require('lodash');var squel=require(_0x98dc('0xb'));var crypto=require('crypto');var jsforce=require(_0x98dc('0xc'));var deskjs=require(_0x98dc('0xd'));var toCsv=require(_0x98dc('0xe'));var querystring=require(_0x98dc('0xf'));var Papa=require(_0x98dc('0x10'));var Redis=require(_0x98dc('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x98dc('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x98dc('0x13'));var utils=require(_0x98dc('0x14'));var config=require(_0x98dc('0x15'));var licenseUtil=require(_0x98dc('0x16'));var db=require(_0x98dc('0x17'))['db'];var extensions=require(_0x98dc('0x18'));function respondWithStatusCode(_0x1342dc,_0x30eede){_0x30eede=_0x30eede||0xcc;return function(_0xd6ab1a){if(_0xd6ab1a){return _0x1342dc[_0x98dc('0x19')](_0x30eede);}return _0x1342dc[_0x98dc('0x1a')](_0x30eede)[_0x98dc('0x1b')]();};}function respondWithResult(_0x2cf262,_0xffbeb0){_0xffbeb0=_0xffbeb0||0xc8;return function(_0x3cf624){if(_0x3cf624){return _0x2cf262['status'](_0xffbeb0)[_0x98dc('0x1c')](_0x3cf624);}};}function respondWithFilteredResult(_0x13faa8,_0x57a94d){return function(_0x34b8c4){if(_0x34b8c4){var _0x15aebf=typeof _0x57a94d[_0x98dc('0x1d')]===_0x98dc('0x1e')&&typeof _0x57a94d[_0x98dc('0x1f')]===_0x98dc('0x1e');var _0x26f5f5=_0x34b8c4[_0x98dc('0x20')];var _0x458018=_0x15aebf?0x0:_0x57a94d[_0x98dc('0x1d')];var _0x1a3a19=_0x15aebf?_0x34b8c4[_0x98dc('0x20')]:_0x57a94d[_0x98dc('0x1d')]+_0x57a94d[_0x98dc('0x1f')];var _0xc3127b;if(_0x1a3a19>=_0x26f5f5){_0x1a3a19=_0x26f5f5;_0xc3127b=0xc8;}else{_0xc3127b=0xce;}_0x13faa8[_0x98dc('0x1a')](_0xc3127b);return _0x13faa8[_0x98dc('0x21')](_0x98dc('0x22'),_0x458018+'-'+_0x1a3a19+'/'+_0x26f5f5)[_0x98dc('0x1c')](_0x34b8c4);}return null;};}function patchUpdates(_0x15f2c2){return function(_0x1c8dcc){try{jsonpatch[_0x98dc('0x23')](_0x1c8dcc,_0x15f2c2,!![]);}catch(_0x561335){return BPromise['reject'](_0x561335);}return _0x1c8dcc['save']();};}function saveUpdates(_0x53db78,_0x174216){return function(_0x4d733d){if(_0x4d733d){return _0x4d733d['update'](_0x53db78)[_0x98dc('0x24')](function(_0x4360d1){return _0x4360d1;});}return null;};}function removeEntity(_0x9b6f57,_0x4f27c2){return function(_0x3cb4fe){if(_0x3cb4fe){return _0x3cb4fe['destroy']()[_0x98dc('0x24')](function(){var _0x5a2a83=_0x3cb4fe[_0x98dc('0x25')]({'plain':!![]});var _0x2aa28f=_0x98dc('0x26');return db[_0x98dc('0x27')]['destroy']({'where':{'type':_0x2aa28f,'resourceId':_0x5a2a83['id']}})[_0x98dc('0x24')](function(){return _0x3cb4fe;});})[_0x98dc('0x24')](function(){_0x9b6f57[_0x98dc('0x1a')](0xcc)[_0x98dc('0x1b')]();});}};}function handleEntityNotFound(_0x512480,_0x42d6b2){return function(_0x26b580){if(!_0x26b580){_0x512480['sendStatus'](0x194);}return _0x26b580;};}function handleError(_0x2ffb48,_0x3e35c0){_0x3e35c0=_0x3e35c0||0x1f4;return function(_0x183251){logger[_0x98dc('0x28')](_0x183251[_0x98dc('0x29')]);if(_0x183251[_0x98dc('0x2a')]){delete _0x183251[_0x98dc('0x2a')];}_0x2ffb48['status'](_0x3e35c0)[_0x98dc('0x2b')](_0x183251);};}exports['index']=function(_0x1635ed,_0x1f265c){var _0x129004={},_0x188aef={},_0x3c618e={'count':0x0,'rows':[]};var _0x4b0193=_['map'](db[_0x98dc('0x2c')][_0x98dc('0x2d')],function(_0x328a6c){return{'name':_0x328a6c['fieldName'],'type':_0x328a6c[_0x98dc('0x2e')][_0x98dc('0x2f')]};});_0x188aef['model']=_[_0x98dc('0x30')](_0x4b0193,_0x98dc('0x2a'));_0x188aef[_0x98dc('0x31')]=_[_0x98dc('0x32')](_0x1635ed[_0x98dc('0x31')]);_0x188aef[_0x98dc('0x33')]=_[_0x98dc('0x34')](_0x188aef['model'],_0x188aef[_0x98dc('0x31')]);_0x129004['attributes']=_[_0x98dc('0x34')](_0x188aef[_0x98dc('0x35')],qs[_0x98dc('0x36')](_0x1635ed['query'][_0x98dc('0x36')]));_0x129004[_0x98dc('0x37')]=_0x129004[_0x98dc('0x37')][_0x98dc('0x38')]?_0x129004['attributes']:_0x188aef[_0x98dc('0x35')];if(!_0x1635ed[_0x98dc('0x31')][_0x98dc('0x39')](_0x98dc('0x3a'))){_0x129004[_0x98dc('0x1f')]=qs['limit'](_0x1635ed[_0x98dc('0x31')][_0x98dc('0x1f')]);_0x129004[_0x98dc('0x1d')]=qs[_0x98dc('0x1d')](_0x1635ed[_0x98dc('0x31')][_0x98dc('0x1d')]);}_0x129004[_0x98dc('0x3b')]=qs[_0x98dc('0x3c')](_0x1635ed[_0x98dc('0x31')][_0x98dc('0x3c')]);_0x129004[_0x98dc('0x3d')]=qs['filters'](_[_0x98dc('0x3e')](_0x1635ed['query'],_0x188aef[_0x98dc('0x33')]),_0x4b0193);if(_0x1635ed[_0x98dc('0x31')]['filter']){_0x129004[_0x98dc('0x3d')]=_[_0x98dc('0x3f')](_0x129004['where'],{'$or':_['map'](_0x4b0193,function(_0x515062){if(_0x515062['type']!==_0x98dc('0x40')){var _0x5c6096={};_0x5c6096[_0x515062[_0x98dc('0x2a')]]={'$like':'%'+_0x1635ed[_0x98dc('0x31')]['filter']+'%'};return _0x5c6096;}})});}_0x129004=_['merge']({},_0x129004,_0x1635ed[_0x98dc('0x41')]);var _0x3e1ee8={'where':_0x129004[_0x98dc('0x3d')]};return db['Interval'][_0x98dc('0x20')](_0x3e1ee8)[_0x98dc('0x24')](function(_0x265816){_0x3c618e['count']=_0x265816;if(_0x1635ed['query'][_0x98dc('0x42')]){_0x129004[_0x98dc('0x43')]=[{'all':!![]}];}return db[_0x98dc('0x2c')][_0x98dc('0x44')](_0x129004);})[_0x98dc('0x24')](function(_0x26b1d4){_0x3c618e['rows']=_0x26b1d4;return _0x3c618e;})['then'](respondWithFilteredResult(_0x1f265c,_0x129004))['catch'](handleError(_0x1f265c,null));};exports[_0x98dc('0x45')]=function(_0x3d61bf,_0x50c0df){var _0x4d985d={'raw':!![],'where':{'id':_0x3d61bf[_0x98dc('0x46')]['id']}},_0x59fa38={};_0x59fa38['model']=_['keys'](db[_0x98dc('0x2c')][_0x98dc('0x2d')]);_0x59fa38[_0x98dc('0x31')]=_[_0x98dc('0x32')](_0x3d61bf[_0x98dc('0x31')]);_0x59fa38[_0x98dc('0x33')]=_[_0x98dc('0x34')](_0x59fa38[_0x98dc('0x35')],_0x59fa38['query']);_0x4d985d['attributes']=_[_0x98dc('0x34')](_0x59fa38[_0x98dc('0x35')],qs[_0x98dc('0x36')](_0x3d61bf[_0x98dc('0x31')][_0x98dc('0x36')]));_0x4d985d[_0x98dc('0x37')]=_0x4d985d['attributes']['length']?_0x4d985d[_0x98dc('0x37')]:_0x59fa38[_0x98dc('0x35')];if(_0x3d61bf['query'][_0x98dc('0x42')]){_0x4d985d[_0x98dc('0x43')]=[{'all':!![]}];}_0x4d985d=_[_0x98dc('0x3f')]({},_0x4d985d,_0x3d61bf[_0x98dc('0x41')]);return db[_0x98dc('0x2c')][_0x98dc('0x47')](_0x4d985d)['then'](handleEntityNotFound(_0x50c0df,null))[_0x98dc('0x24')](respondWithResult(_0x50c0df,null))['catch'](handleError(_0x50c0df,null));};exports['create']=function(_0x5f34f5,_0x296733){return db['Interval'][_0x98dc('0x48')](_0x5f34f5[_0x98dc('0x49')],{})['then'](function(_0x373f46){var _0x59f44e=_0x5f34f5[_0x98dc('0x4a')]['get']({'plain':!![]});if(!_0x59f44e)throw new Error(_0x98dc('0x4b'));if(_0x59f44e['role']===_0x98dc('0x4a')){var _0x3fe8ff=_0x373f46[_0x98dc('0x25')]({'plain':!![]});var _0xd68bb9=_0x98dc('0x26');return db[_0x98dc('0x4c')][_0x98dc('0x47')]({'where':{'name':_0xd68bb9,'userProfileId':_0x59f44e['userProfileId']},'raw':!![]})['then'](function(_0x952cf3){if(_0x952cf3&&_0x952cf3[_0x98dc('0x4d')]===0x0){return db[_0x98dc('0x27')][_0x98dc('0x48')]({'name':_0x3fe8ff[_0x98dc('0x2a')],'resourceId':_0x3fe8ff['id'],'type':_0x952cf3['name'],'sectionId':_0x952cf3['id']},{})['then'](function(){return _0x373f46;});}else{return _0x373f46;}})[_0x98dc('0x4e')](function(_0x54e46b){logger['error'](_0x98dc('0x4f'),_0x54e46b);throw _0x54e46b;});}return _0x373f46;})[_0x98dc('0x24')](respondWithResult(_0x296733,0xc9))[_0x98dc('0x4e')](handleError(_0x296733,null));};exports['update']=function(_0x4e5dac,_0x1985e9){if(_0x4e5dac['body']['id']){delete _0x4e5dac[_0x98dc('0x49')]['id'];}return db[_0x98dc('0x2c')][_0x98dc('0x47')]({'where':{'id':_0x4e5dac[_0x98dc('0x46')]['id']}})[_0x98dc('0x24')](handleEntityNotFound(_0x1985e9,null))['then'](saveUpdates(_0x4e5dac['body'],null))[_0x98dc('0x24')](respondWithResult(_0x1985e9,null))[_0x98dc('0x4e')](handleError(_0x1985e9,null));};exports[_0x98dc('0x50')]=function(_0x3d1e82,_0x526191){return db[_0x98dc('0x2c')][_0x98dc('0x47')]({'where':{'id':_0x3d1e82[_0x98dc('0x46')]['id']}})[_0x98dc('0x24')](handleEntityNotFound(_0x526191,null))[_0x98dc('0x24')](removeEntity(_0x526191,null))[_0x98dc('0x4e')](handleError(_0x526191,null));};exports['addInterval']=function(_0x5067f0,_0x46221b,_0x34c849){if(_0x5067f0[_0x98dc('0x49')]['id']){delete _0x5067f0[_0x98dc('0x49')]['id'];}return db[_0x98dc('0x2c')][_0x98dc('0x47')]({'where':{'id':_0x5067f0[_0x98dc('0x46')]['id']}})[_0x98dc('0x24')](handleEntityNotFound(_0x46221b,null))['then'](function(_0x220b88){if(_0x220b88){_0x5067f0[_0x98dc('0x49')][_0x98dc('0x51')]=_0x220b88['id'];return db['Interval'][_0x98dc('0x48')](_0x5067f0['body']);}})[_0x98dc('0x24')](respondWithResult(_0x46221b,null))[_0x98dc('0x4e')](handleError(_0x46221b,null));};exports[_0x98dc('0x52')]=function(_0x4c23b3,_0x440055,_0x382c74){var _0x375c2f={};var _0x1deaf6={};var _0x3c82e2;var _0xfb160f;return db[_0x98dc('0x2c')][_0x98dc('0x53')]({'where':{'id':_0x4c23b3[_0x98dc('0x46')]['id']}})[_0x98dc('0x24')](handleEntityNotFound(_0x440055,null))[_0x98dc('0x24')](function(_0xc28a4){if(_0xc28a4){_0x3c82e2=_0xc28a4;_0x1deaf6['model']=_[_0x98dc('0x32')](db[_0x98dc('0x2c')][_0x98dc('0x2d')]);_0x1deaf6[_0x98dc('0x31')]=_[_0x98dc('0x32')](_0x4c23b3['query']);_0x1deaf6[_0x98dc('0x33')]=_[_0x98dc('0x34')](_0x1deaf6['model'],_0x1deaf6[_0x98dc('0x31')]);_0x375c2f[_0x98dc('0x37')]=_['intersection'](_0x1deaf6['model'],qs['fields'](_0x4c23b3[_0x98dc('0x31')][_0x98dc('0x36')]));_0x375c2f[_0x98dc('0x37')]=_0x375c2f['attributes'][_0x98dc('0x38')]?_0x375c2f[_0x98dc('0x37')]:_0x1deaf6[_0x98dc('0x35')];_0x375c2f[_0x98dc('0x3b')]=qs[_0x98dc('0x3c')](_0x4c23b3[_0x98dc('0x31')][_0x98dc('0x3c')]);_0x375c2f[_0x98dc('0x3d')]=qs[_0x98dc('0x33')](_[_0x98dc('0x3e')](_0x4c23b3[_0x98dc('0x31')],_0x1deaf6['filters']));if(_0x4c23b3[_0x98dc('0x31')][_0x98dc('0x54')]){_0x375c2f[_0x98dc('0x3d')]=_['merge'](_0x375c2f[_0x98dc('0x3d')],{'$or':_[_0x98dc('0x30')](_0x375c2f[_0x98dc('0x37')],function(_0x4ef1ef){var _0x1fdc5a={};_0x1fdc5a[_0x4ef1ef]={'$like':'%'+_0x4c23b3['query'][_0x98dc('0x54')]+'%'};return _0x1fdc5a;})});}_0x375c2f=_[_0x98dc('0x3f')]({},_0x375c2f,_0x4c23b3[_0x98dc('0x41')]);return _0x3c82e2[_0x98dc('0x52')](_0x375c2f);}})[_0x98dc('0x24')](function(_0x241fd2){if(_0x241fd2){_0xfb160f=_0x241fd2[_0x98dc('0x38')];if(!_0x4c23b3[_0x98dc('0x31')][_0x98dc('0x39')](_0x98dc('0x3a'))){_0x375c2f['limit']=qs[_0x98dc('0x1f')](_0x4c23b3[_0x98dc('0x31')]['limit']);_0x375c2f[_0x98dc('0x1d')]=qs[_0x98dc('0x1d')](_0x4c23b3[_0x98dc('0x31')][_0x98dc('0x1d')]);}return _0x3c82e2['getIntervals'](_0x375c2f);}})[_0x98dc('0x24')](function(_0x15dd1c){if(_0x15dd1c){return _0x15dd1c?{'count':_0xfb160f,'rows':_0x15dd1c}:null;}})[_0x98dc('0x24')](respondWithResult(_0x440055,null))['catch'](handleError(_0x440055,null));};exports[_0x98dc('0x55')]=function(_0x234666,_0x5349a2,_0x252924){return db['Interval']['findOne']({'where':{'id':_0x234666['params']['id']}})[_0x98dc('0x24')](handleEntityNotFound(_0x5349a2,null))[_0x98dc('0x24')](function(_0x323c75){if(_0x323c75){return db['sequelize'][_0x98dc('0x56')](function(_0x5c3f37){return db[_0x98dc('0x2c')][_0x98dc('0x50')]({'where':{'IntervalId':_0x234666['params']['id']},'transaction':_0x5c3f37})[_0x98dc('0x24')](function(_0x5ecafb){var _0x5e0be7=_[_0x98dc('0x30')](_0x234666[_0x98dc('0x49')],function(_0x142f8f){delete _0x142f8f['id'];_0x142f8f[_0x98dc('0x51')]=_0x234666[_0x98dc('0x46')]['id'];return _0x142f8f;});return db[_0x98dc('0x2c')][_0x98dc('0x57')](_0x5e0be7,{'transaction':_0x5c3f37});});})[_0x98dc('0x24')](function(){return db[_0x98dc('0x2c')][_0x98dc('0x44')]({'where':{'IntervalId':_0x234666[_0x98dc('0x46')]['id']}});});}})[_0x98dc('0x24')](respondWithResult(_0x5349a2,null))[_0x98dc('0x4e')](handleError(_0x5349a2,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 397e48d..b9713e3 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 _0x0dfc=['../../utils/iftime','iftime','define','Interval','rewrite','interval','string','then','all','map','./interval.attributes','../../components/extensions/rewrite'];(function(_0x1ba95f,_0x25864c){var _0xd951a5=function(_0xf8057a){while(--_0xf8057a){_0x1ba95f['push'](_0x1ba95f['shift']());}};_0xd951a5(++_0x25864c);}(_0x0dfc,0xbe));var _0xc0df=function(_0x226940,_0x2b1289){_0x226940=_0x226940-0x0;var _0x33b4b1=_0x0dfc[_0x226940];return _0x33b4b1;};'use strict';var attributes=require(_0xc0df('0x0'));var extensions=require(_0xc0df('0x1'));var iftime=require(_0xc0df('0x2'))[_0xc0df('0x3')];module['exports']=function(_0x1ebf66){return _0x1ebf66[_0xc0df('0x4')](_0xc0df('0x5'),attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x1afb1a){extensions[_0xc0df('0x6')](_0x1ebf66,_0x1afb1a);},'afterBulkCreate':function(_0x44fe54,_0x46ed13,_0x581862){_0x581862();extensions[_0xc0df('0x6')](_0x1ebf66,_0x44fe54[0x0]);},'afterUpdate':function(_0x4d5614){extensions['rewrite'](_0x1ebf66,_0x4d5614);},'afterDestroy':function(_0x350a3c){extensions[_0xc0df('0x6')](_0x1ebf66,_0x350a3c);}},'instanceMethods':{'ifTime':function(_0x32cbb4=undefined,_0x1fc878=new Date()){if(typeof this[_0xc0df('0x7')]===_0xc0df('0x8')){return iftime(this[_0xc0df('0x7')],_0x32cbb4,_0x1fc878);}else{return this['getIntervals']()[_0xc0df('0x9')](function(_0x3fcc58){return Promise[_0xc0df('0xa')](_0x3fcc58[_0xc0df('0xb')](function(_0x1531cc){return _0x1531cc['ifTime'](_0x32cbb4,_0x1fc878);}));})[_0xc0df('0x9')](function(_0x1e134f){return _0x1e134f['reduce'](function(_0x45adfb,_0x24cf63){return _0x45adfb||_0x24cf63;},![]);});}}}});}; \ No newline at end of file +var _0xdb97=['ifTime','reduce','./interval.attributes','../../utils/iftime','exports','define','tools_intervals','rewrite','interval','string','then','all','map'];(function(_0x1beda4,_0x458db6){var _0x36912b=function(_0x3bba7d){while(--_0x3bba7d){_0x1beda4['push'](_0x1beda4['shift']());}};_0x36912b(++_0x458db6);}(_0xdb97,0x161));var _0x7db9=function(_0x163da0,_0x1215a6){_0x163da0=_0x163da0-0x0;var _0x6baea9=_0xdb97[_0x163da0];return _0x6baea9;};'use strict';var attributes=require(_0x7db9('0x0'));var extensions=require('../../components/extensions/rewrite');var iftime=require(_0x7db9('0x1'))['iftime'];module[_0x7db9('0x2')]=function(_0x2fe5df){return _0x2fe5df[_0x7db9('0x3')]('Interval',attributes,{'tableName':_0x7db9('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0xf2ca5c){extensions[_0x7db9('0x5')](_0x2fe5df,_0xf2ca5c);},'afterBulkCreate':function(_0x18dd89,_0x404f20,_0x413f9c){_0x413f9c();extensions[_0x7db9('0x5')](_0x2fe5df,_0x18dd89[0x0]);},'afterUpdate':function(_0x14fe34){extensions[_0x7db9('0x5')](_0x2fe5df,_0x14fe34);},'afterDestroy':function(_0x1cd43d){extensions[_0x7db9('0x5')](_0x2fe5df,_0x1cd43d);}},'instanceMethods':{'ifTime':function(_0x2d8d90=undefined,_0x4eb0b3=new Date()){if(typeof this[_0x7db9('0x6')]===_0x7db9('0x7')){return iftime(this['interval'],_0x2d8d90,_0x4eb0b3);}else{return this['getIntervals']()[_0x7db9('0x8')](function(_0x57b8ac){return Promise[_0x7db9('0x9')](_0x57b8ac[_0x7db9('0xa')](function(_0x2b4980){return _0x2b4980[_0x7db9('0xb')](_0x2d8d90,_0x4eb0b3);}));})[_0x7db9('0x8')](function(_0x37edee){return _0x37edee[_0x7db9('0xc')](function(_0xb92cfb,_0xe5b41e){return _0xb92cfb||_0xe5b41e;},![]);});}}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 33d9eb3..63a6263 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 _0x0400=['findAll','options','raw','where','attributes','limit','map','model','include','info','debug','stringify','catch','error','message','ShowInterval','then','all','ifTime','reduce','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','join','findById','format','IntervalIftime','intervalIds','intervals','string','IntervalIftime:\x20interval\x20strings\x20=\x20%s','IntervalIftime:\x20timezone\x20=\x20%s','silly','lodash','../../mysqldb','iftime','../../config/logger','rpc','GetInterval','Interval'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0x0400,0x103));var _0x0040=function(_0x4e4413,_0x1116a6){_0x4e4413=_0x4e4413-0x0;var _0x4c449a=_0x0400[_0x4e4413];return _0x4c449a;};'use strict';var _=require(_0x0040('0x0'));var util=require('util');var db=require(_0x0040('0x1'))['db'];var iftime=require('../../utils/iftime')[_0x0040('0x2')];var logger=require(_0x0040('0x3'))(_0x0040('0x4'));exports[_0x0040('0x5')]=function(_0xa7da45){var _0x31a5f4=this;return new Promise(function(_0x24ce3e,_0x5b7edb){return db[_0x0040('0x6')][_0x0040('0x7')]({'raw':_0xa7da45[_0x0040('0x8')]?_0xa7da45[_0x0040('0x8')][_0x0040('0x9')]===undefined?!![]:![]:!![],'where':_0xa7da45['options']?_0xa7da45['options'][_0x0040('0xa')]||null:null,'attributes':_0xa7da45[_0x0040('0x8')]?_0xa7da45[_0x0040('0x8')][_0x0040('0xb')]||null:null,'limit':_0xa7da45[_0x0040('0x8')]?_0xa7da45['options'][_0x0040('0xc')]||null:null,'include':_0xa7da45[_0x0040('0x8')]?_0xa7da45[_0x0040('0x8')]['include']?_[_0x0040('0xd')](_0xa7da45[_0x0040('0x8')]['include'],function(_0x5c5667){return{'model':db[_0x5c5667[_0x0040('0xe')]],'as':_0x5c5667['as'],'attributes':_0x5c5667[_0x0040('0xb')],'include':_0x5c5667[_0x0040('0xf')]?_['map'](_0x5c5667['include'],function(_0x526659){return{'model':db[_0x526659[_0x0040('0xe')]],'as':_0x526659['as'],'attributes':_0x526659[_0x0040('0xb')],'include':_0x526659['include']?_[_0x0040('0xd')](_0x526659[_0x0040('0xf')],function(_0x1961a5){return{'model':db[_0x1961a5['model']],'as':_0x1961a5['as'],'attributes':_0x1961a5[_0x0040('0xb')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x121d63){logger[_0x0040('0x10')](_0x0040('0x5'),_0xa7da45);logger[_0x0040('0x11')](_0x0040('0x5'),_0xa7da45,JSON[_0x0040('0x12')](_0x121d63));_0x24ce3e(_0x121d63);})[_0x0040('0x13')](function(_0x1b9021){logger[_0x0040('0x14')](_0x0040('0x5'),_0x1b9021['message'],_0xa7da45);_0x5b7edb(_0x31a5f4[_0x0040('0x14')](0x1f4,_0x1b9021[_0x0040('0x15')]));});});};exports[_0x0040('0x16')]=function(_0x20b40b){var _0x3e6511=this;return new Promise(function(_0x160626,_0x10829d){return db[_0x0040('0x6')]['find']({'raw':_0x20b40b[_0x0040('0x8')]?_0x20b40b[_0x0040('0x8')][_0x0040('0x9')]===undefined?!![]:![]:!![],'where':_0x20b40b[_0x0040('0x8')]?_0x20b40b['options'][_0x0040('0xa')]||null:null,'attributes':_0x20b40b[_0x0040('0x8')]?_0x20b40b['options'][_0x0040('0xb')]||null:null,'include':_0x20b40b['options']?_0x20b40b[_0x0040('0x8')][_0x0040('0xf')]?_[_0x0040('0xd')](_0x20b40b[_0x0040('0x8')][_0x0040('0xf')],function(_0xa644c1){return{'model':db[_0xa644c1[_0x0040('0xe')]],'as':_0xa644c1['as'],'attributes':_0xa644c1[_0x0040('0xb')],'include':_0xa644c1[_0x0040('0xf')]?_[_0x0040('0xd')](_0xa644c1['include'],function(_0x493421){return{'model':db[_0x493421[_0x0040('0xe')]],'as':_0x493421['as'],'attributes':_0x493421['attributes'],'include':_0x493421[_0x0040('0xf')]?_['map'](_0x493421[_0x0040('0xf')],function(_0x8b29e3){return{'model':db[_0x8b29e3[_0x0040('0xe')]],'as':_0x8b29e3['as'],'attributes':_0x8b29e3[_0x0040('0xb')]};}):[]};}):[]};}):[]:[]})[_0x0040('0x17')](function(_0x30758c){logger[_0x0040('0x10')](_0x0040('0x16'),_0x20b40b);logger[_0x0040('0x11')](_0x0040('0x16'),_0x20b40b,JSON[_0x0040('0x12')](_0x30758c));_0x160626(_0x30758c);})['catch'](function(_0xf69182){logger[_0x0040('0x14')](_0x0040('0x16'),_0xf69182[_0x0040('0x15')],_0x20b40b);_0x10829d(_0x3e6511[_0x0040('0x14')](0x1f4,_0xf69182[_0x0040('0x15')]));});});};function checkArrayOfIntervals(_0x15d5c1,_0x2b8a0a){var _0x3a83b6=[];return db[_0x0040('0x6')][_0x0040('0x7')]({'where':{'id':_0x15d5c1}})[_0x0040('0x17')](function(_0x4ac9f5){_0x3a83b6=_0x4ac9f5;return Promise[_0x0040('0x18')](_0x3a83b6[_0x0040('0xd')](function(_0x21a641){return _0x21a641[_0x0040('0x19')](_0x2b8a0a);}));})[_0x0040('0x17')](function(_0xae42b6){var _0x395036=_0xae42b6[_0x0040('0x1a')](function(_0x57a536,_0x286559){return _0x57a536||_0x286559;},![]);logger[_0x0040('0x10')](util['format'](_0x0040('0x1b'),_0x3a83b6[_0x0040('0xd')](function(_0xde4bb6){return _0xde4bb6['name'];})[_0x0040('0x1c')](',\x20'),_0x3a83b6['map'](function(_0x1e76e7){return _0x1e76e7['id'];})[_0x0040('0x1c')](',\x20')));return _0x395036;});}function checkSingleInterval(_0x547662,_0x416a67){return db[_0x0040('0x6')][_0x0040('0x1d')](_0x547662)['then'](function(_0x48cf67){if(_0x48cf67){logger['info'](util[_0x0040('0x1e')]('IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)',_0x48cf67['name'],_0x48cf67['id']));return _0x48cf67['ifTime'](_0x416a67);}});}exports[_0x0040('0x1f')]=function(_0x87bfd2){var _0x343a47=_0x87bfd2[_0x0040('0x20')];var _0x317f19=Array['isArray'](_0x87bfd2[_0x0040('0x21')])?_0x87bfd2[_0x0040('0x21')]:typeof _0x87bfd2[_0x0040('0x21')]===_0x0040('0x22')?[_0x87bfd2['intervals']]:[];var _0x5c66df=_0x87bfd2['timezone']||undefined;var _0x406ad4=![];if(_0x317f19['length']){logger['info'](util[_0x0040('0x1e')](_0x0040('0x23'),_0x317f19[_0x0040('0x1c')](';\x20')));}if(_0x5c66df){logger[_0x0040('0x10')](util[_0x0040('0x1e')](_0x0040('0x24'),_0x5c66df));}logger[_0x0040('0x11')]('Iftime',_0x406ad4);logger[_0x0040('0x25')]('IntervalIftime',_0x87bfd2);return Promise['resolve']()['then'](function(){if(Array['isArray'](_0x343a47)){return checkArrayOfIntervals(_0x343a47,_0x5c66df);}else if(_0x343a47){return checkSingleInterval(_0x343a47,_0x5c66df);}})[_0x0040('0x17')](function(_0x274037){var _0x348f94=_0x317f19[_0x0040('0x1a')](function(_0xb3e6f0,_0x4ddc99){return _0xb3e6f0||iftime(_0x4ddc99,_0x5c66df);},![]);_0x406ad4=_0x274037||_0x348f94;return _0x406ad4;})[_0x0040('0x13')](function(_0x2096e4){logger[_0x0040('0x14')](_0x0040('0x1f'),_0x87bfd2,_0x2096e4);throw this[_0x0040('0x14')](0x1f4,_0x2096e4[_0x0040('0x15')]);});}; \ No newline at end of file +var _0x8315=['model','then','debug','stringify','error','message','ShowInterval','find','catch','findAll','ifTime','reduce','info','format','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','name','join','findById','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','intervalIds','isArray','intervals','string','timezone','IntervalIftime:\x20timezone\x20=\x20%s','silly','IntervalIftime','resolve','lodash','../../utils/iftime','iftime','rpc','GetInterval','Interval','options','raw','where','attributes','limit','include','map'];(function(_0x3b37c1,_0x2644f6){var _0x5518c4=function(_0x358b96){while(--_0x358b96){_0x3b37c1['push'](_0x3b37c1['shift']());}};_0x5518c4(++_0x2644f6);}(_0x8315,0x1df));var _0x5831=function(_0x447d79,_0x11804f){_0x447d79=_0x447d79-0x0;var _0x41e536=_0x8315[_0x447d79];return _0x41e536;};'use strict';var _=require(_0x5831('0x0'));var util=require('util');var db=require('../../mysqldb')['db'];var iftime=require(_0x5831('0x1'))[_0x5831('0x2')];var logger=require('../../config/logger')(_0x5831('0x3'));exports[_0x5831('0x4')]=function(_0x2bdf59){var _0x4d1461=this;return new Promise(function(_0x353efd,_0x5d6bd3){return db[_0x5831('0x5')]['findAll']({'raw':_0x2bdf59[_0x5831('0x6')]?_0x2bdf59[_0x5831('0x6')][_0x5831('0x7')]===undefined?!![]:![]:!![],'where':_0x2bdf59[_0x5831('0x6')]?_0x2bdf59[_0x5831('0x6')][_0x5831('0x8')]||null:null,'attributes':_0x2bdf59[_0x5831('0x6')]?_0x2bdf59['options'][_0x5831('0x9')]||null:null,'limit':_0x2bdf59[_0x5831('0x6')]?_0x2bdf59[_0x5831('0x6')][_0x5831('0xa')]||null:null,'include':_0x2bdf59[_0x5831('0x6')]?_0x2bdf59[_0x5831('0x6')][_0x5831('0xb')]?_[_0x5831('0xc')](_0x2bdf59[_0x5831('0x6')][_0x5831('0xb')],function(_0x426910){return{'model':db[_0x426910[_0x5831('0xd')]],'as':_0x426910['as'],'attributes':_0x426910[_0x5831('0x9')],'include':_0x426910[_0x5831('0xb')]?_[_0x5831('0xc')](_0x426910['include'],function(_0x5018ed){return{'model':db[_0x5018ed['model']],'as':_0x5018ed['as'],'attributes':_0x5018ed['attributes'],'include':_0x5018ed[_0x5831('0xb')]?_['map'](_0x5018ed[_0x5831('0xb')],function(_0x421d37){return{'model':db[_0x421d37['model']],'as':_0x421d37['as'],'attributes':_0x421d37[_0x5831('0x9')]};}):[]};}):[]};}):[]:[]})[_0x5831('0xe')](function(_0x352d47){logger['info']('GetInterval',_0x2bdf59);logger[_0x5831('0xf')](_0x5831('0x4'),_0x2bdf59,JSON[_0x5831('0x10')](_0x352d47));_0x353efd(_0x352d47);})['catch'](function(_0x434626){logger[_0x5831('0x11')](_0x5831('0x4'),_0x434626[_0x5831('0x12')],_0x2bdf59);_0x5d6bd3(_0x4d1461[_0x5831('0x11')](0x1f4,_0x434626[_0x5831('0x12')]));});});};exports[_0x5831('0x13')]=function(_0x1d54cf){var _0x31ff6b=this;return new Promise(function(_0x2023c7,_0x2e4ba8){return db[_0x5831('0x5')][_0x5831('0x14')]({'raw':_0x1d54cf[_0x5831('0x6')]?_0x1d54cf[_0x5831('0x6')][_0x5831('0x7')]===undefined?!![]:![]:!![],'where':_0x1d54cf[_0x5831('0x6')]?_0x1d54cf[_0x5831('0x6')]['where']||null:null,'attributes':_0x1d54cf['options']?_0x1d54cf[_0x5831('0x6')][_0x5831('0x9')]||null:null,'include':_0x1d54cf[_0x5831('0x6')]?_0x1d54cf[_0x5831('0x6')][_0x5831('0xb')]?_[_0x5831('0xc')](_0x1d54cf[_0x5831('0x6')][_0x5831('0xb')],function(_0x15d8e2){return{'model':db[_0x15d8e2[_0x5831('0xd')]],'as':_0x15d8e2['as'],'attributes':_0x15d8e2[_0x5831('0x9')],'include':_0x15d8e2[_0x5831('0xb')]?_[_0x5831('0xc')](_0x15d8e2[_0x5831('0xb')],function(_0x51ab0f){return{'model':db[_0x51ab0f['model']],'as':_0x51ab0f['as'],'attributes':_0x51ab0f[_0x5831('0x9')],'include':_0x51ab0f[_0x5831('0xb')]?_[_0x5831('0xc')](_0x51ab0f[_0x5831('0xb')],function(_0x5dca0c){return{'model':db[_0x5dca0c[_0x5831('0xd')]],'as':_0x5dca0c['as'],'attributes':_0x5dca0c[_0x5831('0x9')]};}):[]};}):[]};}):[]:[]})[_0x5831('0xe')](function(_0x4fdadf){logger['info']('ShowInterval',_0x1d54cf);logger[_0x5831('0xf')](_0x5831('0x13'),_0x1d54cf,JSON[_0x5831('0x10')](_0x4fdadf));_0x2023c7(_0x4fdadf);})[_0x5831('0x15')](function(_0x6ee4e7){logger[_0x5831('0x11')]('ShowInterval',_0x6ee4e7[_0x5831('0x12')],_0x1d54cf);_0x2e4ba8(_0x31ff6b['error'](0x1f4,_0x6ee4e7[_0x5831('0x12')]));});});};function checkArrayOfIntervals(_0x2b65a5,_0x4d3862){var _0x4aee11=[];return db[_0x5831('0x5')][_0x5831('0x16')]({'where':{'id':_0x2b65a5}})[_0x5831('0xe')](function(_0x18c280){_0x4aee11=_0x18c280;return Promise['all'](_0x4aee11[_0x5831('0xc')](function(_0x55f89b){return _0x55f89b[_0x5831('0x17')](_0x4d3862);}));})['then'](function(_0x143937){var _0x432c95=_0x143937[_0x5831('0x18')](function(_0x5b1304,_0x3861f9){return _0x5b1304||_0x3861f9;},![]);logger[_0x5831('0x19')](util[_0x5831('0x1a')](_0x5831('0x1b'),_0x4aee11[_0x5831('0xc')](function(_0x113ddc){return _0x113ddc[_0x5831('0x1c')];})[_0x5831('0x1d')](',\x20'),_0x4aee11[_0x5831('0xc')](function(_0x22189d){return _0x22189d['id'];})[_0x5831('0x1d')](',\x20')));return _0x432c95;});}function checkSingleInterval(_0x7d885b,_0x4f4216){return db[_0x5831('0x5')][_0x5831('0x1e')](_0x7d885b)[_0x5831('0xe')](function(_0x10a4e9){if(_0x10a4e9){logger[_0x5831('0x19')](util['format'](_0x5831('0x1f'),_0x10a4e9['name'],_0x10a4e9['id']));return _0x10a4e9[_0x5831('0x17')](_0x4f4216);}});}exports['IntervalIftime']=function(_0x55c982){var _0x59910a=_0x55c982[_0x5831('0x20')];var _0x37acae=Array[_0x5831('0x21')](_0x55c982['intervals'])?_0x55c982[_0x5831('0x22')]:typeof _0x55c982[_0x5831('0x22')]===_0x5831('0x23')?[_0x55c982[_0x5831('0x22')]]:[];var _0x38af97=_0x55c982[_0x5831('0x24')]||undefined;var _0x578c2b=![];if(_0x37acae['length']){logger[_0x5831('0x19')](util[_0x5831('0x1a')]('IntervalIftime:\x20interval\x20strings\x20=\x20%s',_0x37acae[_0x5831('0x1d')](';\x20')));}if(_0x38af97){logger[_0x5831('0x19')](util[_0x5831('0x1a')](_0x5831('0x25'),_0x38af97));}logger[_0x5831('0xf')]('Iftime',_0x578c2b);logger[_0x5831('0x26')](_0x5831('0x27'),_0x55c982);return Promise[_0x5831('0x28')]()[_0x5831('0xe')](function(){if(Array[_0x5831('0x21')](_0x59910a)){return checkArrayOfIntervals(_0x59910a,_0x38af97);}else if(_0x59910a){return checkSingleInterval(_0x59910a,_0x38af97);}})['then'](function(_0x38267d){var _0x5067c3=_0x37acae['reduce'](function(_0x2213cb,_0x47ef06){return _0x2213cb||iftime(_0x47ef06,_0x38af97);},![]);_0x578c2b=_0x38267d||_0x5067c3;return _0x578c2b;})['catch'](function(_0x3fedce){logger['error'](_0x5831('0x27'),_0x55c982,_0x3fedce);throw this[_0x5831('0x11')](0x1f4,_0x3fedce['message']);});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 74500f3..3d2a6b5 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 _0xb10b=['./jira.controller','post','send','exports','express','../../components/auth/service'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0xb10b,0x12a));var _0xbb10=function(_0x23e33d,_0x31c8c8){_0x23e33d=_0x23e33d-0x0;var _0x818fc=_0xb10b[_0x23e33d];return _0x818fc;};'use strict';var express=require(_0xbb10('0x0'));var router=express['Router']();var auth=require(_0xbb10('0x1'));var controller=require(_0xbb10('0x2'));router[_0xbb10('0x3')]('/',auth['isAuthenticated'](),controller[_0xbb10('0x4')]);module[_0xbb10('0x5')]=router; \ No newline at end of file +var _0x5f2f=['isAuthenticated','send','exports','express','Router','../../components/auth/service','./jira.controller','post'];(function(_0x42cf89,_0x2bd0dd){var _0x5a918f=function(_0x27591a){while(--_0x27591a){_0x42cf89['push'](_0x42cf89['shift']());}};_0x5a918f(++_0x2bd0dd);}(_0x5f2f,0x73));var _0xf5f2=function(_0x44202a,_0x3ef5fb){_0x44202a=_0x44202a-0x0;var _0x880c5a=_0x5f2f[_0x44202a];return _0x880c5a;};'use strict';var express=require(_0xf5f2('0x0'));var router=express[_0xf5f2('0x1')]();var auth=require(_0xf5f2('0x2'));var controller=require(_0xf5f2('0x3'));router[_0xf5f2('0x4')]('/',auth[_0xf5f2('0x5')](),controller[_0xf5f2('0x6')]);module[_0xf5f2('0x7')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 9e28f9f..a109f6a 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 _0x9329=['https','api','support','3eAmWpBVP0','key','MOTGUI','summary','Report','\x20from\x20','description','stringify','issuetype','Bug','email','fields','customfield_11502','newToken','customfield_11503','name','customfield_11504','reason','customfield_10102','/rest/api/2/issue','POST','application/json','toString','base64','request','utf8','data','end','status','statusCode','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','send','body','x-forwarded-for','connection','remoteAddress','socket','bluebird'];(function(_0x2f9a05,_0x12f3a5){var _0x3cb09d=function(_0x541a6a){while(--_0x541a6a){_0x2f9a05['push'](_0x2f9a05['shift']());}};_0x3cb09d(++_0x12f3a5);}(_0x9329,0x16f));var _0x9932=function(_0x521031,_0x19f52e){_0x521031=_0x521031-0x0;var _0x4cf8f9=_0x9329[_0x521031];return _0x4cf8f9;};'use strict';var BPromise=require(_0x9932('0x0'));var https=require(_0x9932('0x1'));var logger=require('../../config/logger')(_0x9932('0x2'));var USERNAME=_0x9932('0x3');var PASSWORD=_0x9932('0x4');function openIssue(_0x441694,_0x7e52e){var _0xe50489={'fields':{'project':{'key':_0x441694[_0x9932('0x5')]||_0x9932('0x6')},'summary':(_0x441694[_0x9932('0x7')]||_0x9932('0x8'))+_0x9932('0x9')+_0x441694['ip'],'description':_0x441694[_0x9932('0xa')]||JSON[_0x9932('0xb')](_0x441694),'issuetype':{'name':_0x441694[_0x9932('0xc')]||_0x9932('0xd')}}};_0xe50489['fields']['customfield_11500']=_0x441694[_0x9932('0xe')];_0xe50489[_0x9932('0xf')]['customfield_11501']=_0x441694['oldToken'];_0xe50489[_0x9932('0xf')][_0x9932('0x10')]=_0x441694[_0x9932('0x11')];_0xe50489['fields'][_0x9932('0x12')]=_0x441694[_0x9932('0x13')];_0xe50489[_0x9932('0xf')][_0x9932('0x14')]=_0x441694[_0x9932('0x15')];_0xe50489[_0x9932('0xf')][_0x9932('0x16')]=_0x441694['ip'];var _0x33e0dd={'host':'track.xcallymotion.com','port':0x1bb,'path':_0x9932('0x17'),'method':_0x9932('0x18'),'timeout':0x4e20,'headers':{'Content-Type':_0x9932('0x19'),'Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)[_0x9932('0x1a')](_0x9932('0x1b'))}};var _0x3b011f=JSON[_0x9932('0xb')](_0xe50489);var _0xdf5de0=https[_0x9932('0x1c')](_0x33e0dd,function(_0x2e672d){_0x2e672d['setEncoding'](_0x9932('0x1d'));var _0x2c7946='';_0x2e672d['on'](_0x9932('0x1e'),function(_0x4f927f){_0x2c7946+=_0x4f927f;});_0x2e672d['on'](_0x9932('0x1f'),function(){if(_0x7e52e){return _0x7e52e[_0x9932('0x20')](_0x2e672d[_0x9932('0x21')])[_0x9932('0x22')](JSON[_0x9932('0x23')](_0x2c7946));}});});_0xdf5de0['on'](_0x9932('0x24'),function(_0x5513ea){if(_0x7e52e){return _0x7e52e[_0x9932('0x20')](0x1f4)[_0x9932('0x22')]({'errors':[{'message':_0x9932('0x25'),'type':_0x9932('0x26')}]});}});_0xdf5de0[_0x9932('0x27')](_0x3b011f);_0xdf5de0[_0x9932('0x1f')]();}exports['openIssue']=openIssue;exports[_0x9932('0x28')]=function(_0x500684,_0x2b768a){_0x500684[_0x9932('0x29')]['ip']=_0x500684['headers'][_0x9932('0x2a')]||_0x500684[_0x9932('0x2b')][_0x9932('0x2c')]||_0x500684[_0x9932('0x2d')]['remoteAddress']||_0x500684[_0x9932('0x2b')][_0x9932('0x2d')][_0x9932('0x2c')];return openIssue(_0x500684[_0x9932('0x29')],_0x2b768a);}; \ No newline at end of file +var _0x92d5=['x-forwarded-for','connection','remoteAddress','socket','body','bluebird','https','../../config/logger','api','3eAmWpBVP0','MOTGUI','summary','Report','\x20from\x20','stringify','issuetype','Bug','fields','customfield_11500','email','customfield_11501','customfield_11502','newToken','name','reason','customfield_10102','track.xcallymotion.com','POST','application/json','Basic\x20','base64','request','setEncoding','utf8','data','end','parse','api.jira','openIssue','send','headers'];(function(_0x1ce794,_0xe7f9bc){var _0x5abb47=function(_0x1160ed){while(--_0x1160ed){_0x1ce794['push'](_0x1ce794['shift']());}};_0x5abb47(++_0xe7f9bc);}(_0x92d5,0x80));var _0x592d=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x92d5[_0x2f5ac5];return _0x37c9a8;};'use strict';var BPromise=require(_0x592d('0x0'));var https=require(_0x592d('0x1'));var logger=require(_0x592d('0x2'))(_0x592d('0x3'));var USERNAME='support';var PASSWORD=_0x592d('0x4');function openIssue(_0x297a48,_0x179ca9){var _0x226731={'fields':{'project':{'key':_0x297a48['key']||_0x592d('0x5')},'summary':(_0x297a48[_0x592d('0x6')]||_0x592d('0x7'))+_0x592d('0x8')+_0x297a48['ip'],'description':_0x297a48['description']||JSON[_0x592d('0x9')](_0x297a48),'issuetype':{'name':_0x297a48[_0x592d('0xa')]||_0x592d('0xb')}}};_0x226731[_0x592d('0xc')][_0x592d('0xd')]=_0x297a48[_0x592d('0xe')];_0x226731['fields'][_0x592d('0xf')]=_0x297a48['oldToken'];_0x226731[_0x592d('0xc')][_0x592d('0x10')]=_0x297a48[_0x592d('0x11')];_0x226731['fields']['customfield_11503']=_0x297a48[_0x592d('0x12')];_0x226731[_0x592d('0xc')]['customfield_11504']=_0x297a48[_0x592d('0x13')];_0x226731[_0x592d('0xc')][_0x592d('0x14')]=_0x297a48['ip'];var _0x43aae={'host':_0x592d('0x15'),'port':0x1bb,'path':'/rest/api/2/issue','method':_0x592d('0x16'),'timeout':0x4e20,'headers':{'Content-Type':_0x592d('0x17'),'Authorization':_0x592d('0x18')+new Buffer(USERNAME+':'+PASSWORD)['toString'](_0x592d('0x19'))}};var _0x3c6dcc=JSON[_0x592d('0x9')](_0x226731);var _0xd5f57c=https[_0x592d('0x1a')](_0x43aae,function(_0x52c4e5){_0x52c4e5[_0x592d('0x1b')](_0x592d('0x1c'));var _0x5052b6='';_0x52c4e5['on'](_0x592d('0x1d'),function(_0x46ddda){_0x5052b6+=_0x46ddda;});_0x52c4e5['on'](_0x592d('0x1e'),function(){if(_0x179ca9){return _0x179ca9['status'](_0x52c4e5['statusCode'])['json'](JSON[_0x592d('0x1f')](_0x5052b6));}});});_0xd5f57c['on']('error',function(_0x49c62e){if(_0x179ca9){return _0x179ca9['status'](0x1f4)['json']({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':_0x592d('0x20')}]});}});_0xd5f57c['write'](_0x3c6dcc);_0xd5f57c[_0x592d('0x1e')]();}exports[_0x592d('0x21')]=openIssue;exports[_0x592d('0x22')]=function(_0x995f9,_0x260c75){_0x995f9['body']['ip']=_0x995f9[_0x592d('0x23')][_0x592d('0x24')]||_0x995f9[_0x592d('0x25')][_0x592d('0x26')]||_0x995f9[_0x592d('0x27')][_0x592d('0x26')]||_0x995f9[_0x592d('0x25')][_0x592d('0x27')][_0x592d('0x26')];return openIssue(_0x995f9[_0x592d('0x28')],_0x260c75);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 11ddf22..e0ba4d1 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 _0xee5b=['fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','show','post','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','Router'];(function(_0x246360,_0x46ed80){var _0x3d3aea=function(_0x18275c){while(--_0x18275c){_0x246360['push'](_0x246360['shift']());}};_0x3d3aea(++_0x46ed80);}(_0xee5b,0x1f4));var _0xbee5=function(_0x3e6b26,_0x1e3d9d){_0x3e6b26=_0x3e6b26-0x0;var _0xbca48e=_0xee5b[_0x3e6b26];return _0xbca48e;};'use strict';var multer=require(_0xbee5('0x0'));var util=require('util');var path=require(_0xbee5('0x1'));var timeout=require(_0xbee5('0x2'));var express=require('express');var router=express[_0xbee5('0x3')]();var fs_extra=require(_0xbee5('0x4'));var auth=require(_0xbee5('0x5'));var interaction=require(_0xbee5('0x6'));var config=require('../../config/environment');var controller=require('./jscriptyAnswerReport.controller');router[_0xbee5('0x7')]('/',auth[_0xbee5('0x8')](),controller[_0xbee5('0x9')]);router[_0xbee5('0x7')]('/describe',auth['isAuthenticated'](),controller['describe']);router['get']('/:id',auth[_0xbee5('0x8')](),controller[_0xbee5('0xa')]);router[_0xbee5('0xb')]('/',auth[_0xbee5('0x8')](),controller['create']);router[_0xbee5('0xc')](_0xbee5('0xd'),auth[_0xbee5('0x8')](),controller[_0xbee5('0xe')]);router[_0xbee5('0xf')](_0xbee5('0xd'),auth[_0xbee5('0x8')](),controller[_0xbee5('0x10')]);module[_0xbee5('0x11')]=router; \ No newline at end of file +var _0x878f=['./jscriptyAnswerReport.controller','get','/describe','/:id','post','isAuthenticated','create','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3a93b7,_0x658183){var _0x2ed891=function(_0x1a60de){while(--_0x1a60de){_0x3a93b7['push'](_0x3a93b7['shift']());}};_0x2ed891(++_0x658183);}(_0x878f,0x173));var _0xf878=function(_0x2f93a8,_0xe57f85){_0x2f93a8=_0x2f93a8-0x0;var _0x3c99c1=_0x878f[_0x2f93a8];return _0x3c99c1;};'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['describe']);router['get'](_0xf878('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xf878('0xd')]('/',auth[_0xf878('0xe')](),controller[_0xf878('0xf')]);router['put'](_0xf878('0xc'),auth[_0xf878('0xe')](),controller['update']);router[_0xf878('0x10')]('/:id',auth[_0xf878('0xe')](),controller[_0xf878('0x11')]);module[_0xf878('0x12')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index aaa4f03..bc9d483 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(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0x7a54,0x106));var _0x47a5=function(_0x21c3e6,_0x3e52c5){_0x21c3e6=_0x21c3e6-0x0;var _0x51e7c0=_0x7a54[_0x21c3e6];return _0x51e7c0;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'question':{'type':Sequelize[_0x47a5('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x47a5('0x3'))},'membername':{'type':Sequelize[_0x47a5('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x47a5('0x4')]},'uniqueid':{'type':Sequelize[_0x47a5('0x4')]},'calleridname':{'type':Sequelize[_0x47a5('0x4')]},'calleridnum':{'type':Sequelize[_0x47a5('0x4')]},'questionId':{'type':Sequelize[_0x47a5('0x4')]}}; \ No newline at end of file +var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0x7a54,0x106));var _0x47a5=function(_0x348ac0,_0x25f496){_0x348ac0=_0x348ac0-0x0;var _0x14febe=_0x7a54[_0x348ac0];return _0x14febe;};'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 7256d91..bb89a25 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 _0x126e=['../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','JscriptyAnswerReport','rawAttributes','type','model','map','keys','query','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','include','show','params','intersection','find','catch','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch'];(function(_0x1ff5f3,_0x1e4905){var _0x3d660c=function(_0x10df42){while(--_0x10df42){_0x1ff5f3['push'](_0x1ff5f3['shift']());}};_0x3d660c(++_0x1e4905);}(_0x126e,0x108));var _0xe126=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x126e[_0xbca1b1];return _0x4e1686;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe126('0x0'));var zipdir=require(_0xe126('0x1'));var jsonpatch=require(_0xe126('0x2'));var rp=require(_0xe126('0x3'));var moment=require(_0xe126('0x4'));var BPromise=require(_0xe126('0x5'));var Mustache=require('mustache');var util=require(_0xe126('0x6'));var path=require(_0xe126('0x7'));var sox=require(_0xe126('0x8'));var csv=require(_0xe126('0x9'));var ejs=require(_0xe126('0xa'));var fs=require('fs');var fs_extra=require(_0xe126('0xb'));var _=require(_0xe126('0xc'));var squel=require('squel');var crypto=require(_0xe126('0xd'));var jsforce=require(_0xe126('0xe'));var deskjs=require(_0xe126('0xf'));var toCsv=require(_0xe126('0x9'));var querystring=require(_0xe126('0x10'));var Papa=require('papaparse');var Redis=require(_0xe126('0x11'));var authService=require(_0xe126('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xe126('0x13'));var hardwareService=require(_0xe126('0x14'));var logger=require('../../config/logger')(_0xe126('0x15'));var utils=require('../../config/utils');var config=require(_0xe126('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe126('0x17'))['db'];function respondWithStatusCode(_0x34ae06,_0x23ff02){_0x23ff02=_0x23ff02||0xcc;return function(_0x38b8c3){if(_0x38b8c3){return _0x34ae06[_0xe126('0x18')](_0x23ff02);}return _0x34ae06[_0xe126('0x19')](_0x23ff02)[_0xe126('0x1a')]();};}function respondWithResult(_0x55f10a,_0xd55baf){_0xd55baf=_0xd55baf||0xc8;return function(_0x1c02c9){if(_0x1c02c9){return _0x55f10a['status'](_0xd55baf)[_0xe126('0x1b')](_0x1c02c9);}};}function respondWithFilteredResult(_0x28d7dd,_0x10bc24){return function(_0x38b0c0){if(_0x38b0c0){var _0x5e52d1=typeof _0x10bc24[_0xe126('0x1c')]===_0xe126('0x1d')&&typeof _0x10bc24[_0xe126('0x1e')]==='undefined';var _0x2b0baa=_0x38b0c0['count'];var _0x46c98a=_0x5e52d1?0x0:_0x10bc24[_0xe126('0x1c')];var _0x19b0a3=_0x5e52d1?_0x38b0c0[_0xe126('0x1f')]:_0x10bc24[_0xe126('0x1c')]+_0x10bc24[_0xe126('0x1e')];var _0x20874b;if(_0x19b0a3>=_0x2b0baa){_0x19b0a3=_0x2b0baa;_0x20874b=0xc8;}else{_0x20874b=0xce;}_0x28d7dd[_0xe126('0x19')](_0x20874b);return _0x28d7dd['set'](_0xe126('0x20'),_0x46c98a+'-'+_0x19b0a3+'/'+_0x2b0baa)[_0xe126('0x1b')](_0x38b0c0);}return null;};}function patchUpdates(_0x35ab64){return function(_0x2e5617){try{jsonpatch[_0xe126('0x21')](_0x2e5617,_0x35ab64,!![]);}catch(_0x24076e){return BPromise[_0xe126('0x22')](_0x24076e);}return _0x2e5617[_0xe126('0x23')]();};}function saveUpdates(_0x5257bc,_0x4a1a97){return function(_0xdb6544){if(_0xdb6544){return _0xdb6544[_0xe126('0x24')](_0x5257bc)[_0xe126('0x25')](function(_0x5f1ce1){return _0x5f1ce1;});}return null;};}function removeEntity(_0x5381e1,_0x47f179){return function(_0x4807d3){if(_0x4807d3){return _0x4807d3[_0xe126('0x26')]()['then'](function(){_0x5381e1[_0xe126('0x19')](0xcc)[_0xe126('0x1a')]();});}};}function handleEntityNotFound(_0x4157ed,_0x1674c9){return function(_0x532409){if(!_0x532409){_0x4157ed['sendStatus'](0x194);}return _0x532409;};}function handleError(_0x26482f,_0x4facea){_0x4facea=_0x4facea||0x1f4;return function(_0x3f5de5){logger[_0xe126('0x27')](_0x3f5de5[_0xe126('0x28')]);if(_0x3f5de5['name']){delete _0x3f5de5[_0xe126('0x29')];}_0x26482f[_0xe126('0x19')](_0x4facea)['send'](_0x3f5de5);};}exports[_0xe126('0x2a')]=function(_0x259059,_0x5a8b2a){var _0x9d9e28={},_0x1fb354={},_0x29dec4={'count':0x0,'rows':[]};var _0x181ccc=_['map'](db[_0xe126('0x2b')][_0xe126('0x2c')],function(_0x5e7bab){return{'name':_0x5e7bab['fieldName'],'type':_0x5e7bab[_0xe126('0x2d')]['key']};});_0x1fb354[_0xe126('0x2e')]=_[_0xe126('0x2f')](_0x181ccc,_0xe126('0x29'));_0x1fb354['query']=_[_0xe126('0x30')](_0x259059[_0xe126('0x31')]);_0x1fb354[_0xe126('0x32')]=_['intersection'](_0x1fb354[_0xe126('0x2e')],_0x1fb354[_0xe126('0x31')]);_0x9d9e28['attributes']=_['intersection'](_0x1fb354[_0xe126('0x2e')],qs[_0xe126('0x33')](_0x259059[_0xe126('0x31')][_0xe126('0x33')]));_0x9d9e28[_0xe126('0x34')]=_0x9d9e28[_0xe126('0x34')][_0xe126('0x35')]?_0x9d9e28[_0xe126('0x34')]:_0x1fb354['model'];if(!_0x259059[_0xe126('0x31')][_0xe126('0x36')](_0xe126('0x37'))){_0x9d9e28[_0xe126('0x1e')]=qs[_0xe126('0x1e')](_0x259059[_0xe126('0x31')]['limit']);_0x9d9e28[_0xe126('0x1c')]=qs[_0xe126('0x1c')](_0x259059[_0xe126('0x31')][_0xe126('0x1c')]);}_0x9d9e28[_0xe126('0x38')]=qs['sort'](_0x259059[_0xe126('0x31')][_0xe126('0x39')]);_0x9d9e28[_0xe126('0x3a')]=qs[_0xe126('0x32')](_['pick'](_0x259059[_0xe126('0x31')],_0x1fb354[_0xe126('0x32')]),_0x181ccc);if(_0x259059[_0xe126('0x31')][_0xe126('0x3b')]){_0x9d9e28[_0xe126('0x3a')]=_[_0xe126('0x3c')](_0x9d9e28['where'],{'$or':_[_0xe126('0x2f')](_0x181ccc,function(_0x1a8edf){if(_0x1a8edf[_0xe126('0x2d')]!=='VIRTUAL'){var _0x5073bc={};_0x5073bc[_0x1a8edf[_0xe126('0x29')]]={'$like':'%'+_0x259059[_0xe126('0x31')][_0xe126('0x3b')]+'%'};return _0x5073bc;}})});}_0x9d9e28=_[_0xe126('0x3c')]({},_0x9d9e28,_0x259059[_0xe126('0x3d')]);var _0x1c128d={'where':_0x9d9e28['where']};return db[_0xe126('0x2b')][_0xe126('0x1f')](_0x1c128d)['then'](function(_0x4eb3d7){_0x29dec4[_0xe126('0x1f')]=_0x4eb3d7;if(_0x259059[_0xe126('0x31')]['includeAll']){_0x9d9e28[_0xe126('0x3e')]=[{'all':!![]}];}return db[_0xe126('0x2b')]['findAll'](_0x9d9e28);})[_0xe126('0x25')](function(_0x366754){_0x29dec4['rows']=_0x366754;return _0x29dec4;})[_0xe126('0x25')](respondWithFilteredResult(_0x5a8b2a,_0x9d9e28))['catch'](handleError(_0x5a8b2a,null));};exports[_0xe126('0x3f')]=function(_0x23d1d8,_0x5d5111){var _0x3613de={'raw':!![],'where':{'id':_0x23d1d8[_0xe126('0x40')]['id']}},_0x149b84={};_0x149b84['model']=_[_0xe126('0x30')](db['JscriptyAnswerReport'][_0xe126('0x2c')]);_0x149b84[_0xe126('0x31')]=_[_0xe126('0x30')](_0x23d1d8[_0xe126('0x31')]);_0x149b84[_0xe126('0x32')]=_[_0xe126('0x41')](_0x149b84[_0xe126('0x2e')],_0x149b84[_0xe126('0x31')]);_0x3613de[_0xe126('0x34')]=_[_0xe126('0x41')](_0x149b84[_0xe126('0x2e')],qs['fields'](_0x23d1d8['query'][_0xe126('0x33')]));_0x3613de[_0xe126('0x34')]=_0x3613de['attributes'][_0xe126('0x35')]?_0x3613de[_0xe126('0x34')]:_0x149b84[_0xe126('0x2e')];if(_0x23d1d8[_0xe126('0x31')]['includeAll']){_0x3613de[_0xe126('0x3e')]=[{'all':!![]}];}_0x3613de=_[_0xe126('0x3c')]({},_0x3613de,_0x23d1d8[_0xe126('0x3d')]);return db[_0xe126('0x2b')][_0xe126('0x42')](_0x3613de)[_0xe126('0x25')](handleEntityNotFound(_0x5d5111,null))[_0xe126('0x25')](respondWithResult(_0x5d5111,null))[_0xe126('0x43')](handleError(_0x5d5111,null));};exports[_0xe126('0x44')]=function(_0xccc25d,_0x23007d){return db[_0xe126('0x2b')][_0xe126('0x44')](_0xccc25d['body'],{})['then'](respondWithResult(_0x23007d,0xc9))['catch'](handleError(_0x23007d,null));};exports['update']=function(_0xe642ae,_0x8d5abd){if(_0xe642ae[_0xe126('0x45')]['id']){delete _0xe642ae[_0xe126('0x45')]['id'];}return db[_0xe126('0x2b')][_0xe126('0x42')]({'where':{'id':_0xe642ae[_0xe126('0x40')]['id']}})['then'](handleEntityNotFound(_0x8d5abd,null))['then'](saveUpdates(_0xe642ae[_0xe126('0x45')],null))[_0xe126('0x25')](respondWithResult(_0x8d5abd,null))['catch'](handleError(_0x8d5abd,null));};exports[_0xe126('0x26')]=function(_0x209002,_0x518e43){return db[_0xe126('0x2b')][_0xe126('0x42')]({'where':{'id':_0x209002['params']['id']}})['then'](handleEntityNotFound(_0x518e43,null))[_0xe126('0x25')](removeEntity(_0x518e43,null))[_0xe126('0x43')](handleError(_0x518e43,null));};exports[_0xe126('0x46')]=function(_0x48fbed,_0x31e193){return db['JscriptyAnswerReport'][_0xe126('0x46')]()[_0xe126('0x25')](respondWithResult(_0x31e193,null))['catch'](handleError(_0x31e193,null));}; \ No newline at end of file +var _0x5b20=['json','offset','undefined','limit','count','Content-Range','apply','reject','update','destroy','then','sendStatus','error','stack','name','send','JscriptyAnswerReport','rawAttributes','fieldName','key','map','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','type','VIRTUAL','filter','options','include','findAll','rows','show','params','includeAll','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end'];(function(_0x488cf4,_0x3bbbe7){var _0x3c724e=function(_0x89fd22){while(--_0x89fd22){_0x488cf4['push'](_0x488cf4['shift']());}};_0x3c724e(++_0x3bbbe7);}(_0x5b20,0x86));var _0x05b2=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x5b20[_0x59ee6f];return _0x4c0979;};'use strict';var emlformat=require(_0x05b2('0x0'));var rimraf=require(_0x05b2('0x1'));var zipdir=require(_0x05b2('0x2'));var jsonpatch=require(_0x05b2('0x3'));var rp=require(_0x05b2('0x4'));var moment=require(_0x05b2('0x5'));var BPromise=require(_0x05b2('0x6'));var Mustache=require(_0x05b2('0x7'));var util=require(_0x05b2('0x8'));var path=require(_0x05b2('0x9'));var sox=require(_0x05b2('0xa'));var csv=require('to-csv');var ejs=require(_0x05b2('0xb'));var fs=require('fs');var fs_extra=require(_0x05b2('0xc'));var _=require('lodash');var squel=require(_0x05b2('0xd'));var crypto=require(_0x05b2('0xe'));var jsforce=require(_0x05b2('0xf'));var deskjs=require(_0x05b2('0x10'));var toCsv=require(_0x05b2('0x11'));var querystring=require(_0x05b2('0x12'));var Papa=require(_0x05b2('0x13'));var Redis=require(_0x05b2('0x14'));var authService=require(_0x05b2('0x15'));var qs=require(_0x05b2('0x16'));var as=require(_0x05b2('0x17'));var hardwareService=require(_0x05b2('0x18'));var logger=require(_0x05b2('0x19'))(_0x05b2('0x1a'));var utils=require(_0x05b2('0x1b'));var config=require(_0x05b2('0x1c'));var licenseUtil=require('../../config/license/util');var db=require(_0x05b2('0x1d'))['db'];function respondWithStatusCode(_0x12ca67,_0x30eb0a){_0x30eb0a=_0x30eb0a||0xcc;return function(_0x40b8b8){if(_0x40b8b8){return _0x12ca67['sendStatus'](_0x30eb0a);}return _0x12ca67[_0x05b2('0x1e')](_0x30eb0a)[_0x05b2('0x1f')]();};}function respondWithResult(_0x33d532,_0x5a12d4){_0x5a12d4=_0x5a12d4||0xc8;return function(_0x4e5c5d){if(_0x4e5c5d){return _0x33d532[_0x05b2('0x1e')](_0x5a12d4)[_0x05b2('0x20')](_0x4e5c5d);}};}function respondWithFilteredResult(_0x4d6d7e,_0x4c2ee4){return function(_0x3d3664){if(_0x3d3664){var _0x3fe466=typeof _0x4c2ee4[_0x05b2('0x21')]===_0x05b2('0x22')&&typeof _0x4c2ee4[_0x05b2('0x23')]===_0x05b2('0x22');var _0x290cce=_0x3d3664[_0x05b2('0x24')];var _0x468f42=_0x3fe466?0x0:_0x4c2ee4[_0x05b2('0x21')];var _0x8c390d=_0x3fe466?_0x3d3664[_0x05b2('0x24')]:_0x4c2ee4[_0x05b2('0x21')]+_0x4c2ee4[_0x05b2('0x23')];var _0xb3e12e;if(_0x8c390d>=_0x290cce){_0x8c390d=_0x290cce;_0xb3e12e=0xc8;}else{_0xb3e12e=0xce;}_0x4d6d7e[_0x05b2('0x1e')](_0xb3e12e);return _0x4d6d7e['set'](_0x05b2('0x25'),_0x468f42+'-'+_0x8c390d+'/'+_0x290cce)[_0x05b2('0x20')](_0x3d3664);}return null;};}function patchUpdates(_0xd1a576){return function(_0x41bea5){try{jsonpatch[_0x05b2('0x26')](_0x41bea5,_0xd1a576,!![]);}catch(_0x113b6c){return BPromise[_0x05b2('0x27')](_0x113b6c);}return _0x41bea5['save']();};}function saveUpdates(_0x1e76f1,_0x4b14ec){return function(_0x2874e8){if(_0x2874e8){return _0x2874e8[_0x05b2('0x28')](_0x1e76f1)['then'](function(_0x2cccea){return _0x2cccea;});}return null;};}function removeEntity(_0x1a7d84,_0x3bc5a3){return function(_0x4221f5){if(_0x4221f5){return _0x4221f5[_0x05b2('0x29')]()[_0x05b2('0x2a')](function(){_0x1a7d84[_0x05b2('0x1e')](0xcc)[_0x05b2('0x1f')]();});}};}function handleEntityNotFound(_0x4f1e20,_0x4a2d66){return function(_0x5434bd){if(!_0x5434bd){_0x4f1e20[_0x05b2('0x2b')](0x194);}return _0x5434bd;};}function handleError(_0x4f0b2b,_0x5d79a2){_0x5d79a2=_0x5d79a2||0x1f4;return function(_0x35b6ba){logger[_0x05b2('0x2c')](_0x35b6ba[_0x05b2('0x2d')]);if(_0x35b6ba[_0x05b2('0x2e')]){delete _0x35b6ba[_0x05b2('0x2e')];}_0x4f0b2b[_0x05b2('0x1e')](_0x5d79a2)[_0x05b2('0x2f')](_0x35b6ba);};}exports['index']=function(_0x14ebf8,_0x1c7e8a){var _0x717140={},_0x121ada={},_0x50fffd={'count':0x0,'rows':[]};var _0x1d2ea1=_['map'](db[_0x05b2('0x30')][_0x05b2('0x31')],function(_0x3a4ea9){return{'name':_0x3a4ea9[_0x05b2('0x32')],'type':_0x3a4ea9['type'][_0x05b2('0x33')]};});_0x121ada['model']=_[_0x05b2('0x34')](_0x1d2ea1,'name');_0x121ada[_0x05b2('0x35')]=_[_0x05b2('0x36')](_0x14ebf8[_0x05b2('0x35')]);_0x121ada['filters']=_['intersection'](_0x121ada[_0x05b2('0x37')],_0x121ada[_0x05b2('0x35')]);_0x717140[_0x05b2('0x38')]=_[_0x05b2('0x39')](_0x121ada['model'],qs[_0x05b2('0x3a')](_0x14ebf8['query'][_0x05b2('0x3a')]));_0x717140[_0x05b2('0x38')]=_0x717140['attributes'][_0x05b2('0x3b')]?_0x717140[_0x05b2('0x38')]:_0x121ada['model'];if(!_0x14ebf8['query'][_0x05b2('0x3c')](_0x05b2('0x3d'))){_0x717140['limit']=qs[_0x05b2('0x23')](_0x14ebf8[_0x05b2('0x35')][_0x05b2('0x23')]);_0x717140[_0x05b2('0x21')]=qs['offset'](_0x14ebf8['query']['offset']);}_0x717140[_0x05b2('0x3e')]=qs[_0x05b2('0x3f')](_0x14ebf8['query'][_0x05b2('0x3f')]);_0x717140[_0x05b2('0x40')]=qs[_0x05b2('0x41')](_[_0x05b2('0x42')](_0x14ebf8[_0x05b2('0x35')],_0x121ada[_0x05b2('0x41')]),_0x1d2ea1);if(_0x14ebf8[_0x05b2('0x35')]['filter']){_0x717140[_0x05b2('0x40')]=_[_0x05b2('0x43')](_0x717140[_0x05b2('0x40')],{'$or':_[_0x05b2('0x34')](_0x1d2ea1,function(_0x486990){if(_0x486990[_0x05b2('0x44')]!==_0x05b2('0x45')){var _0x5b6ad7={};_0x5b6ad7[_0x486990['name']]={'$like':'%'+_0x14ebf8[_0x05b2('0x35')][_0x05b2('0x46')]+'%'};return _0x5b6ad7;}})});}_0x717140=_[_0x05b2('0x43')]({},_0x717140,_0x14ebf8[_0x05b2('0x47')]);var _0xbf443={'where':_0x717140[_0x05b2('0x40')]};return db[_0x05b2('0x30')][_0x05b2('0x24')](_0xbf443)['then'](function(_0x524964){_0x50fffd[_0x05b2('0x24')]=_0x524964;if(_0x14ebf8[_0x05b2('0x35')]['includeAll']){_0x717140[_0x05b2('0x48')]=[{'all':!![]}];}return db[_0x05b2('0x30')][_0x05b2('0x49')](_0x717140);})[_0x05b2('0x2a')](function(_0x3c526c){_0x50fffd[_0x05b2('0x4a')]=_0x3c526c;return _0x50fffd;})[_0x05b2('0x2a')](respondWithFilteredResult(_0x1c7e8a,_0x717140))['catch'](handleError(_0x1c7e8a,null));};exports[_0x05b2('0x4b')]=function(_0x48bf3b,_0x1e955b){var _0x89a455={'raw':!![],'where':{'id':_0x48bf3b[_0x05b2('0x4c')]['id']}},_0x4a8c3d={};_0x4a8c3d[_0x05b2('0x37')]=_['keys'](db[_0x05b2('0x30')][_0x05b2('0x31')]);_0x4a8c3d[_0x05b2('0x35')]=_[_0x05b2('0x36')](_0x48bf3b[_0x05b2('0x35')]);_0x4a8c3d[_0x05b2('0x41')]=_[_0x05b2('0x39')](_0x4a8c3d[_0x05b2('0x37')],_0x4a8c3d['query']);_0x89a455['attributes']=_[_0x05b2('0x39')](_0x4a8c3d[_0x05b2('0x37')],qs['fields'](_0x48bf3b['query']['fields']));_0x89a455[_0x05b2('0x38')]=_0x89a455['attributes'][_0x05b2('0x3b')]?_0x89a455['attributes']:_0x4a8c3d[_0x05b2('0x37')];if(_0x48bf3b[_0x05b2('0x35')][_0x05b2('0x4d')]){_0x89a455[_0x05b2('0x48')]=[{'all':!![]}];}_0x89a455=_[_0x05b2('0x43')]({},_0x89a455,_0x48bf3b[_0x05b2('0x47')]);return db[_0x05b2('0x30')][_0x05b2('0x4e')](_0x89a455)[_0x05b2('0x2a')](handleEntityNotFound(_0x1e955b,null))['then'](respondWithResult(_0x1e955b,null))[_0x05b2('0x4f')](handleError(_0x1e955b,null));};exports[_0x05b2('0x50')]=function(_0x174c17,_0x4870){return db[_0x05b2('0x30')]['create'](_0x174c17['body'],{})[_0x05b2('0x2a')](respondWithResult(_0x4870,0xc9))[_0x05b2('0x4f')](handleError(_0x4870,null));};exports[_0x05b2('0x28')]=function(_0x1b6973,_0xb7ab8e){if(_0x1b6973[_0x05b2('0x51')]['id']){delete _0x1b6973['body']['id'];}return db[_0x05b2('0x30')][_0x05b2('0x4e')]({'where':{'id':_0x1b6973[_0x05b2('0x4c')]['id']}})[_0x05b2('0x2a')](handleEntityNotFound(_0xb7ab8e,null))[_0x05b2('0x2a')](saveUpdates(_0x1b6973[_0x05b2('0x51')],null))['then'](respondWithResult(_0xb7ab8e,null))[_0x05b2('0x4f')](handleError(_0xb7ab8e,null));};exports[_0x05b2('0x29')]=function(_0x1ef89c,_0x1c3169){return db[_0x05b2('0x30')][_0x05b2('0x4e')]({'where':{'id':_0x1ef89c[_0x05b2('0x4c')]['id']}})[_0x05b2('0x2a')](handleEntityNotFound(_0x1c3169,null))[_0x05b2('0x2a')](removeEntity(_0x1c3169,null))['catch'](handleError(_0x1c3169,null));};exports[_0x05b2('0x52')]=function(_0x35f2bb,_0x2be4e2){return db[_0x05b2('0x30')][_0x05b2('0x52')]()[_0x05b2('0x2a')](respondWithResult(_0x2be4e2,null))[_0x05b2('0x4f')](handleError(_0x2be4e2,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 07565ca..791c116 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 _0x40b1=['../../config/logger','moment','request-promise','path','../../config/environment','./jscriptyAnswerReport.attributes','exports','define','report_jscripty_answers','lodash'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x40b1,0x1c1));var _0x140b=function(_0x28b6dd,_0x109a9d){_0x28b6dd=_0x28b6dd-0x0;var _0x127beb=_0x40b1[_0x28b6dd];return _0x127beb;};'use strict';var _=require(_0x140b('0x0'));var util=require('util');var logger=require(_0x140b('0x1'))('api');var moment=require(_0x140b('0x2'));var BPromise=require('bluebird');var rp=require(_0x140b('0x3'));var fs=require('fs');var path=require(_0x140b('0x4'));var rimraf=require('rimraf');var config=require(_0x140b('0x5'));var attributes=require(_0x140b('0x6'));module[_0x140b('0x7')]=function(_0x57818e,_0x5ad1ac){return _0x57818e[_0x140b('0x8')]('JscriptyAnswerReport',attributes,{'tableName':_0x140b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0d02=['moment','bluebird','request-promise','path','../../config/environment','./jscriptyAnswerReport.attributes','exports','define','../../config/logger','api'];(function(_0x1fd675,_0x165dfe){var _0x16b554=function(_0x5761ff){while(--_0x5761ff){_0x1fd675['push'](_0x1fd675['shift']());}};_0x16b554(++_0x165dfe);}(_0x0d02,0xee));var _0x20d0=function(_0xc2da68,_0x294f09){_0xc2da68=_0xc2da68-0x0;var _0x69c69e=_0x0d02[_0xc2da68];return _0x69c69e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x20d0('0x0'))(_0x20d0('0x1'));var moment=require(_0x20d0('0x2'));var BPromise=require(_0x20d0('0x3'));var rp=require(_0x20d0('0x4'));var fs=require('fs');var path=require(_0x20d0('0x5'));var rimraf=require('rimraf');var config=require(_0x20d0('0x6'));var attributes=require(_0x20d0('0x7'));module[_0x20d0('0x8')]=function(_0x7dda6d,_0x38b984){return _0x7dda6d[_0x20d0('0x9')]('JscriptyAnswerReport',attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index a7a3efd..093bc51 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 _0x1b72=['request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x4aec32,_0x31a362){var _0x3de5b1=function(_0x1b3457){while(--_0x1b3457){_0x4aec32['push'](_0x4aec32['shift']());}};_0x3de5b1(++_0x31a362);}(_0x1b72,0x1c4));var _0x21b7=function(_0x2112d4,_0x3c863c){_0x2112d4=_0x2112d4-0x0;var _0x434972=_0x1b72[_0x2112d4];return _0x434972;};'use strict';var _=require(_0x21b7('0x0'));var util=require(_0x21b7('0x1'));var moment=require(_0x21b7('0x2'));var BPromise=require('bluebird');var rs=require(_0x21b7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x21b7('0x4'));var logger=require('../../config/logger')(_0x21b7('0x5'));var config=require(_0x21b7('0x6'));var jayson=require(_0x21b7('0x7'));var client=jayson[_0x21b7('0x8')][_0x21b7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x49f6a4,_0x595937,_0x501a8b){return new BPromise(function(_0x384340,_0x237743){return client[_0x21b7('0xa')](_0x49f6a4,_0x501a8b)[_0x21b7('0xb')](function(_0x52d820){logger[_0x21b7('0xc')](_0x21b7('0xd'),_0x595937,'request\x20sent');logger[_0x21b7('0xe')]('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0x595937,_0x21b7('0xf'),JSON[_0x21b7('0x10')](_0x52d820));if(_0x52d820[_0x21b7('0x11')]){if(_0x52d820[_0x21b7('0x11')][_0x21b7('0x12')]===0x1f4){logger[_0x21b7('0x11')](_0x21b7('0xd'),_0x595937,_0x52d820[_0x21b7('0x11')][_0x21b7('0x13')]);return _0x237743(_0x52d820[_0x21b7('0x11')][_0x21b7('0x13')]);}logger[_0x21b7('0x11')](_0x21b7('0xd'),_0x595937,_0x52d820[_0x21b7('0x11')][_0x21b7('0x13')]);return _0x384340(_0x52d820['error'][_0x21b7('0x13')]);}else{logger[_0x21b7('0xc')](_0x21b7('0xd'),_0x595937,_0x21b7('0xf'));_0x384340(_0x52d820[_0x21b7('0x14')][_0x21b7('0x13')]);}})[_0x21b7('0x15')](function(_0x41dad4){logger[_0x21b7('0x11')](_0x21b7('0xd'),_0x595937,_0x41dad4);_0x237743(_0x41dad4);});});} \ No newline at end of file +var _0x07e0=['util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','http','info','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','JscriptyAnswerReport,\x20%s,\x20%s','message','catch'];(function(_0x8afdd0,_0x548ad1){var _0x3de7ac=function(_0x2dc2c4){while(--_0x2dc2c4){_0x8afdd0['push'](_0x8afdd0['shift']());}};_0x3de7ac(++_0x548ad1);}(_0x07e0,0xf7));var _0x007e=function(_0x111164,_0x48487f){_0x111164=_0x111164-0x0;var _0x532f6e=_0x07e0[_0x111164];return _0x532f6e;};'use strict';var _=require('lodash');var util=require(_0x007e('0x0'));var moment=require(_0x007e('0x1'));var BPromise=require(_0x007e('0x2'));var rs=require(_0x007e('0x3'));var fs=require('fs');var Redis=require(_0x007e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x007e('0x5'));var logger=require(_0x007e('0x6'))(_0x007e('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x007e('0x8')][_0x007e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x24a5b9,_0x3cbf6e,_0x18d8f8){return new BPromise(function(_0xbaa161,_0x3ce026){return client['request'](_0x24a5b9,_0x18d8f8)['then'](function(_0x5761a1){logger[_0x007e('0xa')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x3cbf6e,_0x007e('0xb'));logger[_0x007e('0xc')](_0x007e('0xd'),_0x3cbf6e,'request\x20sent',JSON[_0x007e('0xe')](_0x5761a1));if(_0x5761a1[_0x007e('0xf')]){if(_0x5761a1['error']['code']===0x1f4){logger[_0x007e('0xf')](_0x007e('0x10'),_0x3cbf6e,_0x5761a1[_0x007e('0xf')]['message']);return _0x3ce026(_0x5761a1[_0x007e('0xf')]['message']);}logger[_0x007e('0xf')](_0x007e('0x10'),_0x3cbf6e,_0x5761a1[_0x007e('0xf')]['message']);return _0xbaa161(_0x5761a1[_0x007e('0xf')][_0x007e('0x11')]);}else{logger[_0x007e('0xa')](_0x007e('0x10'),_0x3cbf6e,'request\x20sent');_0xbaa161(_0x5761a1['result'][_0x007e('0x11')]);}})[_0x007e('0x12')](function(_0x3d86d4){logger[_0x007e('0xf')](_0x007e('0x10'),_0x3cbf6e,_0x3d86d4);_0x3ce026(_0x3d86d4);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 13c26a6..bf04b46 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 _0xd83c=['getAnswers','/:id/summary','30s','getSummary','post','put','update','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','index','get','/:id','show','/:id/sessions','isAuthenticated','getSessions','/:id/answers'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0xd83c,0x8b));var _0xcd83=function(_0x575b72,_0x1a7eb1){_0x575b72=_0x575b72-0x0;var _0x561c57=_0xd83c[_0x575b72];return _0x561c57;};'use strict';var multer=require(_0xcd83('0x0'));var util=require(_0xcd83('0x1'));var path=require('path');var timeout=require(_0xcd83('0x2'));var express=require(_0xcd83('0x3'));var router=express[_0xcd83('0x4')]();var fs_extra=require(_0xcd83('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xcd83('0x6'));var config=require(_0xcd83('0x7'));var controller=require(_0xcd83('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xcd83('0x9')]);router[_0xcd83('0xa')](_0xcd83('0xb'),auth['isAuthenticated'](),controller[_0xcd83('0xc')]);router[_0xcd83('0xa')](_0xcd83('0xd'),auth[_0xcd83('0xe')](),controller[_0xcd83('0xf')]);router[_0xcd83('0xa')](_0xcd83('0x10'),auth[_0xcd83('0xe')](),controller[_0xcd83('0x11')]);router[_0xcd83('0xa')](_0xcd83('0x12'),auth[_0xcd83('0xe')](),timeout(_0xcd83('0x13')),controller[_0xcd83('0x14')]);router[_0xcd83('0x15')]('/',auth[_0xcd83('0xe')](),controller['create']);router[_0xcd83('0x15')]('/:id/clone',auth[_0xcd83('0xe')](),controller['clone']);router[_0xcd83('0x16')](_0xcd83('0xb'),auth[_0xcd83('0xe')](),controller[_0xcd83('0x17')]);router[_0xcd83('0x18')](_0xcd83('0xb'),auth[_0xcd83('0xe')](),controller[_0xcd83('0x19')]);module['exports']=router; \ No newline at end of file +var _0x435c=['/:id/sessions','getSessions','/:id/answers','/:id/summary','post','create','clone','put','destroy','exports','multer','connect-timeout','express','fs-extra','../../components/auth/service','./jscriptyProject.controller','get','isAuthenticated','index','/:id','show'];(function(_0x26dd36,_0x231f1a){var _0x9d7b3f=function(_0x5e440e){while(--_0x5e440e){_0x26dd36['push'](_0x26dd36['shift']());}};_0x9d7b3f(++_0x231f1a);}(_0x435c,0x145));var _0xc435=function(_0x1a89a1,_0x56d889){_0x1a89a1=_0x1a89a1-0x0;var _0x3d5b46=_0x435c[_0x1a89a1];return _0x3d5b46;};'use strict';var multer=require(_0xc435('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xc435('0x1'));var express=require(_0xc435('0x2'));var router=express['Router']();var fs_extra=require(_0xc435('0x3'));var auth=require(_0xc435('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xc435('0x5'));router[_0xc435('0x6')]('/',auth[_0xc435('0x7')](),controller[_0xc435('0x8')]);router[_0xc435('0x6')](_0xc435('0x9'),auth[_0xc435('0x7')](),controller[_0xc435('0xa')]);router['get'](_0xc435('0xb'),auth['isAuthenticated'](),controller[_0xc435('0xc')]);router['get'](_0xc435('0xd'),auth[_0xc435('0x7')](),controller['getAnswers']);router[_0xc435('0x6')](_0xc435('0xe'),auth[_0xc435('0x7')](),timeout('30s'),controller['getSummary']);router[_0xc435('0xf')]('/',auth['isAuthenticated'](),controller[_0xc435('0x10')]);router[_0xc435('0xf')]('/:id/clone',auth[_0xc435('0x7')](),controller[_0xc435('0x11')]);router[_0xc435('0x12')](_0xc435('0x9'),auth[_0xc435('0x7')](),controller['update']);router['delete'](_0xc435('0x9'),auth['isAuthenticated'](),controller[_0xc435('0x13')]);module[_0xc435('0x14')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index d7d9672..18cac5f 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 _0x9054=['STRING','name','TEXT','long','setDataValue','formData','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','BOOLEAN','lodash','util','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9054,0x128));var _0x4905=function(_0x630bf2,_0x418829){_0x630bf2=_0x630bf2-0x0;var _0x34fbbd=_0x9054[_0x630bf2];return _0x34fbbd;};'use strict';var Sequelize=require('sequelize');var _=require(_0x4905('0x0'));var util=require(_0x4905('0x1'));module[_0x4905('0x2')]={'name':{'type':Sequelize[_0x4905('0x3')],'unique':_0x4905('0x4')},'description':{'type':Sequelize[_0x4905('0x3')]},'formData':{'type':Sequelize[_0x4905('0x5')](_0x4905('0x6')),'set':function(_0x1da134){if(_['isObjectLike'](_0x1da134)){this[_0x4905('0x7')](_0x4905('0x8'),JSON['stringify'](_0x1da134));}else if(_['isString'](_0x1da134)){this[_0x4905('0x7')](_0x4905('0x8'),_0x1da134);}else{this[_0x4905('0x7')]('formData',util[_0x4905('0x9')](_0x4905('0xa'),this[_0x4905('0xb')]('name')||'',this[_0x4905('0xb')]('description')||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x4905('0xc')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x4905('0xc')],'defaultValue':![]}}; \ No newline at end of file +var _0xcfd7=['{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','lodash','util','STRING','TEXT','long','setDataValue','stringify','formData','format'];(function(_0x271ce8,_0x4062eb){var _0x69abd5=function(_0x57dd27){while(--_0x57dd27){_0x271ce8['push'](_0x271ce8['shift']());}};_0x69abd5(++_0x4062eb);}(_0xcfd7,0xc7));var _0x7cfd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcfd7[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');var _=require(_0x7cfd('0x0'));var util=require(_0x7cfd('0x1'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name'},'description':{'type':Sequelize[_0x7cfd('0x2')]},'formData':{'type':Sequelize[_0x7cfd('0x3')](_0x7cfd('0x4')),'set':function(_0x2e2036){if(_['isObjectLike'](_0x2e2036)){this[_0x7cfd('0x5')]('formData',JSON[_0x7cfd('0x6')](_0x2e2036));}else if(_['isString'](_0x2e2036)){this[_0x7cfd('0x5')](_0x7cfd('0x7'),_0x2e2036);}else{this[_0x7cfd('0x5')]('formData',util[_0x7cfd('0x8')](_0x7cfd('0x9'),this[_0x7cfd('0xa')]('name')||'',this[_0x7cfd('0xa')](_0x7cfd('0xb'))||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x7cfd('0xc')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 8badf0f..86aed52 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 _0xf65d=['catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','Projects','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','options','createdAt','updatedAt','body','JscriptySessionReport','hasOwnProperty','sort','ProjectId','rows','getAnswers','findOne','JscriptyAnswerReport','number','toString','indexOf','replace','getSummary','startTime','starttime','JscriptyQuestionReport','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','push','isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','text/csv','sendStatus','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','get','destroy','error','stack','name','send','index','JscriptyProject','fieldName','key','model','map','query','keys','intersection','attributes','fields','nolimit','order','where','filters','pick','filter','merge','VIRTUAL','include','findAll','show','params','rawAttributes','length','includeAll','find'];(function(_0xf4666e,_0x571140){var _0x1853f1=function(_0x5160a5){while(--_0x5160a5){_0xf4666e['push'](_0xf4666e['shift']());}};_0x1853f1(++_0x571140);}(_0xf65d,0x9f));var _0xdf65=function(_0x2642cb,_0x4b917f){_0x2642cb=_0x2642cb-0x0;var _0xe6e41=_0xf65d[_0x2642cb];return _0xe6e41;};'use strict';var emlformat=require(_0xdf65('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdf65('0x1'));var jsonpatch=require(_0xdf65('0x2'));var rp=require(_0xdf65('0x3'));var moment=require(_0xdf65('0x4'));var BPromise=require(_0xdf65('0x5'));var Mustache=require(_0xdf65('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xdf65('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdf65('0x8'));var _=require(_0xdf65('0x9'));var squel=require('squel');var crypto=require(_0xdf65('0xa'));var jsforce=require(_0xdf65('0xb'));var deskjs=require(_0xdf65('0xc'));var toCsv=require(_0xdf65('0x7'));var querystring=require(_0xdf65('0xd'));var Papa=require(_0xdf65('0xe'));var Redis=require('ioredis');var authService=require(_0xdf65('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xdf65('0x10'));var hardwareService=require(_0xdf65('0x11'));var logger=require(_0xdf65('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xdf65('0x13'));var licenseUtil=require(_0xdf65('0x14'));var db=require(_0xdf65('0x15'))['db'];function respondWithStatusCode(_0x389a24,_0x20162f){_0x20162f=_0x20162f||0xcc;return function(_0x42cfce){if(_0x42cfce){return _0x389a24['sendStatus'](_0x20162f);}return _0x389a24[_0xdf65('0x16')](_0x20162f)[_0xdf65('0x17')]();};}function respondWithResult(_0x51f281,_0x50de22){_0x50de22=_0x50de22||0xc8;return function(_0x5a0ae1){if(_0x5a0ae1){return _0x51f281[_0xdf65('0x16')](_0x50de22)[_0xdf65('0x18')](_0x5a0ae1);}};}function respondWithFilteredResult(_0x11f0e3,_0x1b6d10){return function(_0x1d6f22){if(_0x1d6f22){var _0x9bcb1c=typeof _0x1b6d10[_0xdf65('0x19')]===_0xdf65('0x1a')&&typeof _0x1b6d10[_0xdf65('0x1b')]===_0xdf65('0x1a');var _0x54e0b2=_0x1d6f22[_0xdf65('0x1c')];var _0x532215=_0x9bcb1c?0x0:_0x1b6d10[_0xdf65('0x19')];var _0x3a175b=_0x9bcb1c?_0x1d6f22[_0xdf65('0x1c')]:_0x1b6d10[_0xdf65('0x19')]+_0x1b6d10[_0xdf65('0x1b')];var _0x30a521;if(_0x3a175b>=_0x54e0b2){_0x3a175b=_0x54e0b2;_0x30a521=0xc8;}else{_0x30a521=0xce;}_0x11f0e3['status'](_0x30a521);return _0x11f0e3[_0xdf65('0x1d')]('Content-Range',_0x532215+'-'+_0x3a175b+'/'+_0x54e0b2)[_0xdf65('0x18')](_0x1d6f22);}return null;};}function patchUpdates(_0x299ed3){return function(_0xd57bc8){try{jsonpatch[_0xdf65('0x1e')](_0xd57bc8,_0x299ed3,!![]);}catch(_0x2042a5){return BPromise['reject'](_0x2042a5);}return _0xd57bc8[_0xdf65('0x1f')]();};}function saveUpdates(_0x326995,_0x5ee78d){return function(_0x45fb5f){if(_0x45fb5f){return _0x45fb5f[_0xdf65('0x20')](_0x326995)[_0xdf65('0x21')](function(_0x12e935){return _0x12e935;});}return null;};}function removeEntity(_0x529bf0,_0x2c6900){return function(_0x2eff40){if(_0x2eff40){return _0x2eff40['destroy']()['then'](function(){var _0x14a54c=_0x2eff40[_0xdf65('0x22')]({'plain':!![]});var _0x3d0aea='Projects';return db['UserProfileResource'][_0xdf65('0x23')]({'where':{'type':_0x3d0aea,'resourceId':_0x14a54c['id']}})[_0xdf65('0x21')](function(){return _0x2eff40;});})['then'](function(){_0x529bf0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x364606,_0x5b5147){return function(_0xa04154){if(!_0xa04154){_0x364606['sendStatus'](0x194);}return _0xa04154;};}function handleError(_0x28c7b1,_0x1ff773){_0x1ff773=_0x1ff773||0x1f4;return function(_0x501b53){logger[_0xdf65('0x24')](_0x501b53[_0xdf65('0x25')]);if(_0x501b53[_0xdf65('0x26')]){delete _0x501b53[_0xdf65('0x26')];}_0x28c7b1[_0xdf65('0x16')](_0x1ff773)[_0xdf65('0x27')](_0x501b53);};}exports[_0xdf65('0x28')]=function(_0x4507f1,_0x5581da){var _0x4a40fb={},_0x183e04={},_0x2262d0={'count':0x0,'rows':[]};var _0x292be3=_['map'](db[_0xdf65('0x29')]['rawAttributes'],function(_0x46d275){return{'name':_0x46d275[_0xdf65('0x2a')],'type':_0x46d275['type'][_0xdf65('0x2b')]};});_0x183e04[_0xdf65('0x2c')]=_[_0xdf65('0x2d')](_0x292be3,_0xdf65('0x26'));_0x183e04[_0xdf65('0x2e')]=_[_0xdf65('0x2f')](_0x4507f1['query']);_0x183e04['filters']=_[_0xdf65('0x30')](_0x183e04['model'],_0x183e04[_0xdf65('0x2e')]);_0x4a40fb[_0xdf65('0x31')]=_[_0xdf65('0x30')](_0x183e04['model'],qs[_0xdf65('0x32')](_0x4507f1[_0xdf65('0x2e')][_0xdf65('0x32')]));_0x4a40fb[_0xdf65('0x31')]=_0x4a40fb[_0xdf65('0x31')]['length']?_0x4a40fb[_0xdf65('0x31')]:_0x183e04[_0xdf65('0x2c')];if(!_0x4507f1[_0xdf65('0x2e')]['hasOwnProperty'](_0xdf65('0x33'))){_0x4a40fb[_0xdf65('0x1b')]=qs[_0xdf65('0x1b')](_0x4507f1[_0xdf65('0x2e')][_0xdf65('0x1b')]);_0x4a40fb['offset']=qs['offset'](_0x4507f1[_0xdf65('0x2e')][_0xdf65('0x19')]);}_0x4a40fb[_0xdf65('0x34')]=qs['sort'](_0x4507f1[_0xdf65('0x2e')]['sort']);_0x4a40fb[_0xdf65('0x35')]=qs[_0xdf65('0x36')](_[_0xdf65('0x37')](_0x4507f1['query'],_0x183e04[_0xdf65('0x36')]),_0x292be3);if(_0x4507f1[_0xdf65('0x2e')][_0xdf65('0x38')]){_0x4a40fb[_0xdf65('0x35')]=_[_0xdf65('0x39')](_0x4a40fb[_0xdf65('0x35')],{'$or':_[_0xdf65('0x2d')](_0x292be3,function(_0x2cdf0b){if(_0x2cdf0b['type']!==_0xdf65('0x3a')){var _0x1ff52a={};_0x1ff52a[_0x2cdf0b[_0xdf65('0x26')]]={'$like':'%'+_0x4507f1['query']['filter']+'%'};return _0x1ff52a;}})});}_0x4a40fb=_[_0xdf65('0x39')]({},_0x4a40fb,_0x4507f1['options']);var _0x1e86bd={'where':_0x4a40fb['where']};return db['JscriptyProject']['count'](_0x1e86bd)[_0xdf65('0x21')](function(_0x352e21){_0x2262d0[_0xdf65('0x1c')]=_0x352e21;if(_0x4507f1['query']['includeAll']){_0x4a40fb[_0xdf65('0x3b')]=[{'all':!![]}];}return db['JscriptyProject'][_0xdf65('0x3c')](_0x4a40fb);})[_0xdf65('0x21')](function(_0x2e3e35){_0x2262d0['rows']=_0x2e3e35;return _0x2262d0;})[_0xdf65('0x21')](respondWithFilteredResult(_0x5581da,_0x4a40fb))['catch'](handleError(_0x5581da,null));};exports[_0xdf65('0x3d')]=function(_0xe6228a,_0x4c4217){var _0x29a17d={'raw':![],'where':{'id':_0xe6228a[_0xdf65('0x3e')]['id']}},_0x40cc01={};_0x40cc01['model']=_[_0xdf65('0x2f')](db[_0xdf65('0x29')][_0xdf65('0x3f')]);_0x40cc01[_0xdf65('0x2e')]=_[_0xdf65('0x2f')](_0xe6228a[_0xdf65('0x2e')]);_0x40cc01[_0xdf65('0x36')]=_['intersection'](_0x40cc01[_0xdf65('0x2c')],_0x40cc01[_0xdf65('0x2e')]);_0x29a17d[_0xdf65('0x31')]=_[_0xdf65('0x30')](_0x40cc01[_0xdf65('0x2c')],qs['fields'](_0xe6228a['query'][_0xdf65('0x32')]));_0x29a17d[_0xdf65('0x31')]=_0x29a17d[_0xdf65('0x31')][_0xdf65('0x40')]?_0x29a17d[_0xdf65('0x31')]:_0x40cc01[_0xdf65('0x2c')];if(_0xe6228a[_0xdf65('0x2e')][_0xdf65('0x41')]){_0x29a17d[_0xdf65('0x3b')]=[{'all':!![]}];}_0x29a17d=_[_0xdf65('0x39')]({},_0x29a17d,_0xe6228a['options']);return db[_0xdf65('0x29')][_0xdf65('0x42')](_0x29a17d)['then'](handleEntityNotFound(_0x4c4217,null))[_0xdf65('0x21')](respondWithResult(_0x4c4217,null))[_0xdf65('0x43')](handleError(_0x4c4217,null));};exports[_0xdf65('0x44')]=function(_0x502716,_0x39be69){return db[_0xdf65('0x29')][_0xdf65('0x44')](_0x502716['body'],{})[_0xdf65('0x21')](function(_0x485351){var _0x49be75=_0x502716['user'][_0xdf65('0x22')]({'plain':!![]});if(!_0x49be75)throw new Error(_0xdf65('0x45'));if(_0x49be75['role']===_0xdf65('0x46')){var _0x2f4c75=_0x485351[_0xdf65('0x22')]({'plain':!![]});var _0x5d9d84=_0xdf65('0x47');return db[_0xdf65('0x48')][_0xdf65('0x42')]({'where':{'name':_0x5d9d84,'userProfileId':_0x49be75[_0xdf65('0x49')]},'raw':!![]})['then'](function(_0x2e6cff){if(_0x2e6cff&&_0x2e6cff[_0xdf65('0x4a')]===0x0){return db[_0xdf65('0x4b')][_0xdf65('0x44')]({'name':_0x2f4c75[_0xdf65('0x26')],'resourceId':_0x2f4c75['id'],'type':_0x2e6cff[_0xdf65('0x26')],'sectionId':_0x2e6cff['id']},{})[_0xdf65('0x21')](function(){return _0x485351;});}else{return _0x485351;}})[_0xdf65('0x43')](function(_0x2f0c3b){logger['error'](_0xdf65('0x4c'),_0x2f0c3b);throw _0x2f0c3b;});}return _0x485351;})[_0xdf65('0x21')](respondWithResult(_0x39be69,0xc9))['catch'](handleError(_0x39be69,null));};exports[_0xdf65('0x4d')]=function(_0x40fedd,_0x36b259){var _0x2d9e26={'where':{'id':_0x40fedd[_0xdf65('0x3e')]['id']}},_0x321ccd={};_0x321ccd[_0xdf65('0x2c')]=_[_0xdf65('0x2f')](db[_0xdf65('0x29')][_0xdf65('0x3f')]);_0x2d9e26['attributes']=_[_0xdf65('0x30')](_0x321ccd[_0xdf65('0x2c')],qs[_0xdf65('0x32')](_0x40fedd[_0xdf65('0x2e')][_0xdf65('0x32')]));_0x2d9e26[_0xdf65('0x31')]=_0x2d9e26['attributes'][_0xdf65('0x40')]?_0x2d9e26[_0xdf65('0x31')]:_0x321ccd[_0xdf65('0x2c')];if(_0x40fedd['query'][_0xdf65('0x41')]){_0x2d9e26[_0xdf65('0x3b')]=[{'all':!![]}];}_0x2d9e26=_[_0xdf65('0x39')]({},_0x2d9e26,_0x40fedd[_0xdf65('0x4e')]);return db[_0xdf65('0x29')][_0xdf65('0x42')](_0x2d9e26)['then'](handleEntityNotFound(_0x36b259,null))[_0xdf65('0x21')](function(_0x789ac9){if(_0x789ac9){var _0x9c15ec=_0x789ac9['get']({'plain':!![]});_0x9c15ec=qs['omit'](_0x9c15ec,['id',_0xdf65('0x4f'),_0xdf65('0x50')]);_0x40fedd[_0xdf65('0x51')]=_['omit'](_0x40fedd[_0xdf65('0x51')],['id',_0xdf65('0x4f'),_0xdf65('0x50')]);return db['JscriptyProject']['create'](_[_0xdf65('0x39')](_0x9c15ec,_0x40fedd['body']),{'include':_0x40fedd['query'][_0xdf65('0x41')]?[{'all':!![]}]:undefined})['then'](function(_0x15c0fe){var _0x28ad26=_0x40fedd[_0xdf65('0x46')][_0xdf65('0x22')]({'plain':!![]});if(!_0x28ad26)throw new Error(_0xdf65('0x45'));if(_0x28ad26['role']===_0xdf65('0x46')){var _0x51d6e6=_0x15c0fe['get']({'plain':!![]});var _0x280cb1=_0xdf65('0x47');return db[_0xdf65('0x48')][_0xdf65('0x42')]({'where':{'name':_0x280cb1,'userProfileId':_0x28ad26[_0xdf65('0x49')]},'raw':!![]})[_0xdf65('0x21')](function(_0x339f0d){if(_0x339f0d&&_0x339f0d['autoAssociation']===0x0){return db[_0xdf65('0x4b')]['create']({'name':_0x51d6e6[_0xdf65('0x26')],'resourceId':_0x51d6e6['id'],'type':_0x339f0d[_0xdf65('0x26')],'sectionId':_0x339f0d['id']},{})['then'](function(){return _0x15c0fe;});}else{return _0x15c0fe;}})[_0xdf65('0x43')](function(_0x841b2e){logger[_0xdf65('0x24')](_0xdf65('0x4c'),_0x841b2e);throw _0x841b2e;});}return _0x15c0fe;});}})[_0xdf65('0x21')](respondWithResult(_0x36b259,0xc9))['catch'](handleError(_0x36b259,null));};exports[_0xdf65('0x20')]=function(_0x2a27e7,_0x46b0a5){if(_0x2a27e7[_0xdf65('0x51')]['id']){delete _0x2a27e7[_0xdf65('0x51')]['id'];}return db[_0xdf65('0x29')][_0xdf65('0x42')]({'where':{'id':_0x2a27e7['params']['id']}})[_0xdf65('0x21')](handleEntityNotFound(_0x46b0a5,null))[_0xdf65('0x21')](saveUpdates(_0x2a27e7[_0xdf65('0x51')],null))['then'](respondWithResult(_0x46b0a5,null))[_0xdf65('0x43')](handleError(_0x46b0a5,null));};exports[_0xdf65('0x23')]=function(_0x58f0e4,_0x55c211){return db['JscriptyProject']['find']({'where':{'id':_0x58f0e4['params']['id']}})[_0xdf65('0x21')](handleEntityNotFound(_0x55c211,null))[_0xdf65('0x21')](removeEntity(_0x55c211,null))[_0xdf65('0x43')](handleError(_0x55c211,null));};exports['getSessions']=function(_0x803ab4,_0x25e53a,_0x571148){var _0x2006d3={'raw':!![],'where':{}};var _0x2f4fc0={};var _0x2e9340={'count':0x0,'rows':[]};return db[_0xdf65('0x29')]['findOne']({'where':{'id':_0x803ab4['params']['id']}})['then'](handleEntityNotFound(_0x25e53a,null))[_0xdf65('0x21')](function(_0x3f7a8b){if(_0x3f7a8b){_0x2f4fc0[_0xdf65('0x2c')]=_[_0xdf65('0x2f')](db[_0xdf65('0x52')][_0xdf65('0x3f')]);_0x2f4fc0['query']=_[_0xdf65('0x2f')](_0x803ab4[_0xdf65('0x2e')]);_0x2f4fc0[_0xdf65('0x36')]=_[_0xdf65('0x30')](_0x2f4fc0['model'],_0x2f4fc0['query']);_0x2006d3[_0xdf65('0x31')]=_[_0xdf65('0x30')](_0x2f4fc0['model'],qs[_0xdf65('0x32')](_0x803ab4['query'][_0xdf65('0x32')]));_0x2006d3['attributes']=_0x2006d3['attributes'][_0xdf65('0x40')]?_0x2006d3['attributes']:_0x2f4fc0[_0xdf65('0x2c')];if(!_0x803ab4[_0xdf65('0x2e')][_0xdf65('0x53')](_0xdf65('0x33'))){_0x2006d3[_0xdf65('0x1b')]=qs[_0xdf65('0x1b')](_0x803ab4[_0xdf65('0x2e')][_0xdf65('0x1b')]);_0x2006d3[_0xdf65('0x19')]=qs[_0xdf65('0x19')](_0x803ab4['query'][_0xdf65('0x19')]);}_0x2006d3[_0xdf65('0x34')]=qs[_0xdf65('0x54')](_0x803ab4['query'][_0xdf65('0x54')]);_0x2006d3[_0xdf65('0x35')]=qs[_0xdf65('0x36')](_[_0xdf65('0x37')](_0x803ab4[_0xdf65('0x2e')],_0x2f4fc0[_0xdf65('0x36')]));_0x2006d3[_0xdf65('0x35')][_0xdf65('0x55')]=_0x3f7a8b['id'];if(_0x803ab4[_0xdf65('0x2e')][_0xdf65('0x38')]){_0x2006d3[_0xdf65('0x35')]=_['merge'](_0x2006d3[_0xdf65('0x35')],{'$or':_['map'](_0x2006d3[_0xdf65('0x31')],function(_0x25ce02){var _0x226fb1={};_0x226fb1[_0x25ce02]={'$like':'%'+_0x803ab4[_0xdf65('0x2e')][_0xdf65('0x38')]+'%'};return _0x226fb1;})});}_0x2006d3=_[_0xdf65('0x39')]({},_0x2006d3,_0x803ab4[_0xdf65('0x4e')]);return db[_0xdf65('0x52')][_0xdf65('0x1c')]({'where':_0x2006d3[_0xdf65('0x35')]})[_0xdf65('0x21')](function(_0x2679cd){_0x2e9340[_0xdf65('0x1c')]=_0x2679cd;if(_0x803ab4[_0xdf65('0x2e')]['includeAll']){_0x2006d3[_0xdf65('0x3b')]=[{'all':!![]}];}return db[_0xdf65('0x52')][_0xdf65('0x3c')](_0x2006d3);})[_0xdf65('0x21')](function(_0xc87c7){_0x2e9340[_0xdf65('0x56')]=_0xc87c7;return _0x2e9340;});}})[_0xdf65('0x21')](respondWithFilteredResult(_0x25e53a,_0x2006d3))[_0xdf65('0x43')](handleError(_0x25e53a,null));};exports[_0xdf65('0x57')]=function(_0x457568,_0x4014b5,_0x52e96c){var _0x8644d0={'raw':!![],'where':{}};var _0x4718a6={};var _0x298669={'count':0x0,'rows':[]};return db[_0xdf65('0x29')][_0xdf65('0x58')]({'where':{'id':_0x457568[_0xdf65('0x3e')]['id']}})[_0xdf65('0x21')](handleEntityNotFound(_0x4014b5,null))[_0xdf65('0x21')](function(_0x16c684){if(_0x16c684){_0x4718a6[_0xdf65('0x2c')]=_['keys'](db[_0xdf65('0x59')]['rawAttributes']);_0x4718a6[_0xdf65('0x2e')]=_['keys'](_0x457568['query']);_0x4718a6['filters']=_[_0xdf65('0x30')](_0x4718a6[_0xdf65('0x2c')],_0x4718a6[_0xdf65('0x2e')]);_0x8644d0['attributes']=_[_0xdf65('0x30')](_0x4718a6[_0xdf65('0x2c')],qs[_0xdf65('0x32')](_0x457568[_0xdf65('0x2e')][_0xdf65('0x32')]));_0x8644d0[_0xdf65('0x31')]=_0x8644d0['attributes'][_0xdf65('0x40')]?_0x8644d0['attributes']:_0x4718a6[_0xdf65('0x2c')];if(!_0x457568[_0xdf65('0x2e')][_0xdf65('0x53')](_0xdf65('0x33'))){_0x8644d0[_0xdf65('0x1b')]=qs['limit'](_0x457568[_0xdf65('0x2e')][_0xdf65('0x1b')]);_0x8644d0[_0xdf65('0x19')]=qs[_0xdf65('0x19')](_0x457568[_0xdf65('0x2e')][_0xdf65('0x19')]);}_0x8644d0[_0xdf65('0x34')]=qs['sort'](_0x457568[_0xdf65('0x2e')][_0xdf65('0x54')]);_0x8644d0['where']=qs[_0xdf65('0x36')](_[_0xdf65('0x37')](_0x457568[_0xdf65('0x2e')],_0x4718a6[_0xdf65('0x36')]));_0x8644d0[_0xdf65('0x35')][_0xdf65('0x55')]=_0x16c684['id'];if(_0x457568[_0xdf65('0x2e')][_0xdf65('0x38')]){_0x8644d0[_0xdf65('0x35')]=_['merge'](_0x8644d0[_0xdf65('0x35')],{'$or':_['map'](_0x8644d0[_0xdf65('0x31')],function(_0x134971){var _0x400c82={};_0x400c82[_0x134971]={'$like':'%'+_0x457568[_0xdf65('0x2e')][_0xdf65('0x38')]+'%'};return _0x400c82;})});}_0x8644d0=_[_0xdf65('0x39')]({},_0x8644d0,_0x457568[_0xdf65('0x4e')]);return db[_0xdf65('0x59')]['count']({'where':_0x8644d0[_0xdf65('0x35')]})['then'](function(_0x1d0bac){_0x298669[_0xdf65('0x1c')]=_0x1d0bac;if(_0x457568['query'][_0xdf65('0x41')]){_0x8644d0['include']=[{'all':!![]}];}return db[_0xdf65('0x59')]['findAll'](_0x8644d0);})[_0xdf65('0x21')](function(_0x513679){_0x298669[_0xdf65('0x56')]=_0x513679;return _0x298669;});}})[_0xdf65('0x21')](respondWithFilteredResult(_0x4014b5,_0x8644d0))['catch'](handleError(_0x4014b5,null));};function char(_0x25d3b9){return _0xdf65('0x5a')===typeof _0x25d3b9?String['fromCharCode']['apply'](null,arguments):_0x25d3b9;}function needsEncapsulation(_0x518e73){return!!_0x518e73&&(_0x518e73[_0xdf65('0x5b')]()[_0xdf65('0x5c')](char(0xd))>=0x0||_0x518e73[_0xdf65('0x5b')]()['indexOf'](char(0xa))>=0x0||_0x518e73['toString']()['indexOf'](char(0x2c))>=0x0||_0x518e73['toString']()[_0xdf65('0x5c')](char(0x22))>=0x0);}function encapsulate(_0x1a61c4){var _0x58379e=char(0x22),_0x532e03='\x5c'+char(0x22),_0x1a4b59=_0x1a61c4[_0xdf65('0x5b')]()[_0xdf65('0x5d')](new RegExp(_0x58379e,'g'),_0x532e03);return _0x58379e+_0x1a4b59+_0x58379e;}exports[_0xdf65('0x5e')]=function(_0x57e8ca,_0x2909b3,_0x4fa0cd){var _0x5d3f53,_0x82610f;var _0x19335e={'where':{'ProjectId':_0x57e8ca[_0xdf65('0x3e')]['id']}};if(_0x57e8ca['query'][_0xdf65('0x5f')]){_0x19335e[_0xdf65('0x35')][_0xdf65('0x60')]=JSON['parse'](_0x57e8ca['query'][_0xdf65('0x5f')]);}return db[_0xdf65('0x52')][_0xdf65('0x3c')](_0x19335e)[_0xdf65('0x21')](handleEntityNotFound(_0x2909b3,null))[_0xdf65('0x21')](function(_0x57fb85){if(_0x57fb85){_0x5d3f53=_0x57fb85;return db[_0xdf65('0x61')][_0xdf65('0x3c')]({'where':{'SessionId':{'$in':_['map'](_0x5d3f53,'id')},'ProjectId':_0x57e8ca[_0xdf65('0x3e')]['id']},'order':'-createdAt'});}})[_0xdf65('0x21')](handleEntityNotFound(_0x2909b3,null))[_0xdf65('0x21')](function(_0x3a9d87){if(_0x3a9d87){_0x82610f=_0x3a9d87;var _0x2e7201={};for(var _0x16d8bf=0x0,_0x47d9d8=_0x82610f[_0xdf65('0x40')];_0x16d8bf<_0x47d9d8;_0x16d8bf++){if(!_0x2e7201[_0xdf65('0x53')](_0x82610f[_0x16d8bf][_0xdf65('0x62')])){_0x2e7201[_0x82610f[_0x16d8bf][_0xdf65('0x62')]]=needsEncapsulation(_0x82610f[_0x16d8bf][_0xdf65('0x63')])?encapsulate(_0x82610f[_0x16d8bf][_0xdf65('0x63')]):_0x82610f[_0x16d8bf][_0xdf65('0x63')];}}var _0x121a1d=[],_0x3ed772={};for(var _0x10490e=0x0,_0x324629=_0x5d3f53['length'];_0x10490e<_0x324629;_0x10490e++){_0x3ed772={'ProjectId':_0x57e8ca[_0xdf65('0x3e')]['id'],'SessionId':_0x5d3f53[_0x10490e]['id'],'StartTime':moment(_0x5d3f53[_0x10490e]['starttime'])[_0xdf65('0x64')](_0xdf65('0x65'))};for(var _0x191e88=0x0,_0x34a3f0=_0x82610f['length'];_0x191e88<_0x34a3f0;_0x191e88++){if(_0x82610f[_0x191e88]['SessionId']==_0x5d3f53[_0x10490e]['id']&&_0x2e7201['hasOwnProperty'](_0x82610f[_0x191e88][_0xdf65('0x62')])){_0x3ed772[_0x2e7201[_0x82610f[_0x191e88][_0xdf65('0x62')]]]=_0x82610f[_0x191e88]['answer'];}}for(var _0x269b6e in _0x2e7201){if(!_0x3ed772['hasOwnProperty'](_0x2e7201[_0x269b6e])){_0x3ed772[_0x2e7201[_0x269b6e]]=null;}}_0x121a1d[_0xdf65('0x66')](_0x3ed772);}return _0x121a1d;}})[_0xdf65('0x21')](function(_0x45b05e){if(!_[_0xdf65('0x67')](_0x45b05e)){var _0x2e1927=toCsv(_0x45b05e);var _0x14cc38=Date[_0xdf65('0x68')]();fs[_0xdf65('0x69')](util[_0xdf65('0x64')](_0xdf65('0x6a'),_0x57e8ca[_0xdf65('0x3e')]['id'],_0x14cc38),_0x2e1927);_0x2909b3[_0xdf65('0x6b')](_0xdf65('0x6c'),_0xdf65('0x6d')+util[_0xdf65('0x64')](_0xdf65('0x6e'),_0x57e8ca['params']['id'],_0x14cc38));_0x2909b3[_0xdf65('0x6b')]('Content-type',_0xdf65('0x6f'));return _0x2909b3['download'](util[_0xdf65('0x64')](_0xdf65('0x6a'),_0x57e8ca[_0xdf65('0x3e')]['id'],_0x14cc38));}else{return _0x2909b3[_0xdf65('0x70')](0xcc);}})[_0xdf65('0x43')](handleError(_0x2909b3,null));}; \ No newline at end of file +var _0x5b1c=['Content-Range','reject','save','update','then','get','Projects','UserProfileResource','destroy','sendStatus','error','stack','name','send','index','JscriptyProject','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','merge','VIRTUAL','where','includeAll','include','findAll','catch','show','params','rawAttributes','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','autoAssociation','clone','omit','updatedAt','createdAt','getSessions','JscriptySessionReport','pick','ProjectId','rows','getAnswers','JscriptyAnswerReport','fromCharCode','apply','toString','indexOf','replace','getSummary','startTime','starttime','JscriptyQuestionReport','questionId','question','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','format','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','Content-type','download','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set'];(function(_0x1d70db,_0x142b63){var _0x3060c6=function(_0x347866){while(--_0x347866){_0x1d70db['push'](_0x1d70db['shift']());}};_0x3060c6(++_0x142b63);}(_0x5b1c,0x1b9));var _0xc5b1=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x5b1c[_0x19950b];return _0x3c6b41;};'use strict';var emlformat=require(_0xc5b1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc5b1('0x1'));var jsonpatch=require(_0xc5b1('0x2'));var rp=require(_0xc5b1('0x3'));var moment=require(_0xc5b1('0x4'));var BPromise=require(_0xc5b1('0x5'));var Mustache=require(_0xc5b1('0x6'));var util=require(_0xc5b1('0x7'));var path=require(_0xc5b1('0x8'));var sox=require(_0xc5b1('0x9'));var csv=require(_0xc5b1('0xa'));var ejs=require(_0xc5b1('0xb'));var fs=require('fs');var fs_extra=require(_0xc5b1('0xc'));var _=require(_0xc5b1('0xd'));var squel=require(_0xc5b1('0xe'));var crypto=require(_0xc5b1('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xc5b1('0x10'));var toCsv=require(_0xc5b1('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xc5b1('0x11'));var authService=require(_0xc5b1('0x12'));var qs=require(_0xc5b1('0x13'));var as=require(_0xc5b1('0x14'));var hardwareService=require(_0xc5b1('0x15'));var logger=require(_0xc5b1('0x16'))(_0xc5b1('0x17'));var utils=require(_0xc5b1('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xc5b1('0x19'));var db=require(_0xc5b1('0x1a'))['db'];function respondWithStatusCode(_0x445ea2,_0x8aff8f){_0x8aff8f=_0x8aff8f||0xcc;return function(_0x495ece){if(_0x495ece){return _0x445ea2['sendStatus'](_0x8aff8f);}return _0x445ea2[_0xc5b1('0x1b')](_0x8aff8f)[_0xc5b1('0x1c')]();};}function respondWithResult(_0x10537b,_0x2f3a80){_0x2f3a80=_0x2f3a80||0xc8;return function(_0x406c65){if(_0x406c65){return _0x10537b[_0xc5b1('0x1b')](_0x2f3a80)[_0xc5b1('0x1d')](_0x406c65);}};}function respondWithFilteredResult(_0x1abae8,_0x31431c){return function(_0x5a61fa){if(_0x5a61fa){var _0x4880d1=typeof _0x31431c[_0xc5b1('0x1e')]==='undefined'&&typeof _0x31431c[_0xc5b1('0x1f')]===_0xc5b1('0x20');var _0x3bc11b=_0x5a61fa[_0xc5b1('0x21')];var _0x5a6213=_0x4880d1?0x0:_0x31431c[_0xc5b1('0x1e')];var _0x31190f=_0x4880d1?_0x5a61fa[_0xc5b1('0x21')]:_0x31431c[_0xc5b1('0x1e')]+_0x31431c[_0xc5b1('0x1f')];var _0x4a9527;if(_0x31190f>=_0x3bc11b){_0x31190f=_0x3bc11b;_0x4a9527=0xc8;}else{_0x4a9527=0xce;}_0x1abae8['status'](_0x4a9527);return _0x1abae8[_0xc5b1('0x22')](_0xc5b1('0x23'),_0x5a6213+'-'+_0x31190f+'/'+_0x3bc11b)[_0xc5b1('0x1d')](_0x5a61fa);}return null;};}function patchUpdates(_0x5961b4){return function(_0x3aecec){try{jsonpatch['apply'](_0x3aecec,_0x5961b4,!![]);}catch(_0xa58289){return BPromise[_0xc5b1('0x24')](_0xa58289);}return _0x3aecec[_0xc5b1('0x25')]();};}function saveUpdates(_0x3891f4,_0x24335f){return function(_0x13cdab){if(_0x13cdab){return _0x13cdab[_0xc5b1('0x26')](_0x3891f4)[_0xc5b1('0x27')](function(_0xe7acf3){return _0xe7acf3;});}return null;};}function removeEntity(_0x48f28d,_0x51b37b){return function(_0x119af5){if(_0x119af5){return _0x119af5['destroy']()['then'](function(){var _0xb4bd4c=_0x119af5[_0xc5b1('0x28')]({'plain':!![]});var _0x53e9f9=_0xc5b1('0x29');return db[_0xc5b1('0x2a')][_0xc5b1('0x2b')]({'where':{'type':_0x53e9f9,'resourceId':_0xb4bd4c['id']}})['then'](function(){return _0x119af5;});})[_0xc5b1('0x27')](function(){_0x48f28d[_0xc5b1('0x1b')](0xcc)[_0xc5b1('0x1c')]();});}};}function handleEntityNotFound(_0x1632c3,_0xa0b9bc){return function(_0x441e48){if(!_0x441e48){_0x1632c3[_0xc5b1('0x2c')](0x194);}return _0x441e48;};}function handleError(_0x188753,_0x3b510a){_0x3b510a=_0x3b510a||0x1f4;return function(_0x37fca1){logger[_0xc5b1('0x2d')](_0x37fca1[_0xc5b1('0x2e')]);if(_0x37fca1[_0xc5b1('0x2f')]){delete _0x37fca1[_0xc5b1('0x2f')];}_0x188753[_0xc5b1('0x1b')](_0x3b510a)[_0xc5b1('0x30')](_0x37fca1);};}exports[_0xc5b1('0x31')]=function(_0x125075,_0x3f4ae0){var _0x6ba578={},_0x2fe48d={},_0x1fc834={'count':0x0,'rows':[]};var _0x1c19d2=_['map'](db[_0xc5b1('0x32')]['rawAttributes'],function(_0x42930f){return{'name':_0x42930f[_0xc5b1('0x33')],'type':_0x42930f[_0xc5b1('0x34')][_0xc5b1('0x35')]};});_0x2fe48d[_0xc5b1('0x36')]=_[_0xc5b1('0x37')](_0x1c19d2,_0xc5b1('0x2f'));_0x2fe48d[_0xc5b1('0x38')]=_[_0xc5b1('0x39')](_0x125075[_0xc5b1('0x38')]);_0x2fe48d[_0xc5b1('0x3a')]=_[_0xc5b1('0x3b')](_0x2fe48d[_0xc5b1('0x36')],_0x2fe48d[_0xc5b1('0x38')]);_0x6ba578[_0xc5b1('0x3c')]=_['intersection'](_0x2fe48d[_0xc5b1('0x36')],qs[_0xc5b1('0x3d')](_0x125075['query'][_0xc5b1('0x3d')]));_0x6ba578[_0xc5b1('0x3c')]=_0x6ba578[_0xc5b1('0x3c')][_0xc5b1('0x3e')]?_0x6ba578[_0xc5b1('0x3c')]:_0x2fe48d[_0xc5b1('0x36')];if(!_0x125075[_0xc5b1('0x38')][_0xc5b1('0x3f')](_0xc5b1('0x40'))){_0x6ba578[_0xc5b1('0x1f')]=qs[_0xc5b1('0x1f')](_0x125075[_0xc5b1('0x38')]['limit']);_0x6ba578[_0xc5b1('0x1e')]=qs[_0xc5b1('0x1e')](_0x125075[_0xc5b1('0x38')][_0xc5b1('0x1e')]);}_0x6ba578[_0xc5b1('0x41')]=qs[_0xc5b1('0x42')](_0x125075[_0xc5b1('0x38')][_0xc5b1('0x42')]);_0x6ba578['where']=qs[_0xc5b1('0x3a')](_['pick'](_0x125075[_0xc5b1('0x38')],_0x2fe48d['filters']),_0x1c19d2);if(_0x125075['query'][_0xc5b1('0x43')]){_0x6ba578['where']=_[_0xc5b1('0x44')](_0x6ba578['where'],{'$or':_[_0xc5b1('0x37')](_0x1c19d2,function(_0x12a5be){if(_0x12a5be[_0xc5b1('0x34')]!==_0xc5b1('0x45')){var _0x241660={};_0x241660[_0x12a5be[_0xc5b1('0x2f')]]={'$like':'%'+_0x125075[_0xc5b1('0x38')]['filter']+'%'};return _0x241660;}})});}_0x6ba578=_[_0xc5b1('0x44')]({},_0x6ba578,_0x125075['options']);var _0x2db05f={'where':_0x6ba578[_0xc5b1('0x46')]};return db['JscriptyProject'][_0xc5b1('0x21')](_0x2db05f)[_0xc5b1('0x27')](function(_0x3e3b0a){_0x1fc834[_0xc5b1('0x21')]=_0x3e3b0a;if(_0x125075[_0xc5b1('0x38')][_0xc5b1('0x47')]){_0x6ba578[_0xc5b1('0x48')]=[{'all':!![]}];}return db[_0xc5b1('0x32')][_0xc5b1('0x49')](_0x6ba578);})[_0xc5b1('0x27')](function(_0x41dfd8){_0x1fc834['rows']=_0x41dfd8;return _0x1fc834;})['then'](respondWithFilteredResult(_0x3f4ae0,_0x6ba578))[_0xc5b1('0x4a')](handleError(_0x3f4ae0,null));};exports[_0xc5b1('0x4b')]=function(_0x29c517,_0x35ec2c){var _0x58bd13={'raw':![],'where':{'id':_0x29c517[_0xc5b1('0x4c')]['id']}},_0x431ba8={};_0x431ba8[_0xc5b1('0x36')]=_[_0xc5b1('0x39')](db['JscriptyProject'][_0xc5b1('0x4d')]);_0x431ba8[_0xc5b1('0x38')]=_[_0xc5b1('0x39')](_0x29c517[_0xc5b1('0x38')]);_0x431ba8[_0xc5b1('0x3a')]=_[_0xc5b1('0x3b')](_0x431ba8[_0xc5b1('0x36')],_0x431ba8[_0xc5b1('0x38')]);_0x58bd13[_0xc5b1('0x3c')]=_[_0xc5b1('0x3b')](_0x431ba8[_0xc5b1('0x36')],qs[_0xc5b1('0x3d')](_0x29c517[_0xc5b1('0x38')][_0xc5b1('0x3d')]));_0x58bd13[_0xc5b1('0x3c')]=_0x58bd13[_0xc5b1('0x3c')][_0xc5b1('0x3e')]?_0x58bd13[_0xc5b1('0x3c')]:_0x431ba8[_0xc5b1('0x36')];if(_0x29c517[_0xc5b1('0x38')]['includeAll']){_0x58bd13[_0xc5b1('0x48')]=[{'all':!![]}];}_0x58bd13=_[_0xc5b1('0x44')]({},_0x58bd13,_0x29c517[_0xc5b1('0x4e')]);return db['JscriptyProject']['find'](_0x58bd13)[_0xc5b1('0x27')](handleEntityNotFound(_0x35ec2c,null))['then'](respondWithResult(_0x35ec2c,null))[_0xc5b1('0x4a')](handleError(_0x35ec2c,null));};exports[_0xc5b1('0x4f')]=function(_0x5d748d,_0x3c6f42){return db[_0xc5b1('0x32')]['create'](_0x5d748d[_0xc5b1('0x50')],{})['then'](function(_0x14ce4b){var _0x19a358=_0x5d748d[_0xc5b1('0x51')][_0xc5b1('0x28')]({'plain':!![]});if(!_0x19a358)throw new Error(_0xc5b1('0x52'));if(_0x19a358[_0xc5b1('0x53')]===_0xc5b1('0x51')){var _0x542e89=_0x14ce4b[_0xc5b1('0x28')]({'plain':!![]});var _0x26efe4=_0xc5b1('0x29');return db['UserProfileSection'][_0xc5b1('0x54')]({'where':{'name':_0x26efe4,'userProfileId':_0x19a358['userProfileId']},'raw':!![]})['then'](function(_0x325760){if(_0x325760&&_0x325760[_0xc5b1('0x55')]===0x0){return db[_0xc5b1('0x2a')][_0xc5b1('0x4f')]({'name':_0x542e89[_0xc5b1('0x2f')],'resourceId':_0x542e89['id'],'type':_0x325760[_0xc5b1('0x2f')],'sectionId':_0x325760['id']},{})[_0xc5b1('0x27')](function(){return _0x14ce4b;});}else{return _0x14ce4b;}})['catch'](function(_0x3d4a05){logger[_0xc5b1('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3d4a05);throw _0x3d4a05;});}return _0x14ce4b;})[_0xc5b1('0x27')](respondWithResult(_0x3c6f42,0xc9))[_0xc5b1('0x4a')](handleError(_0x3c6f42,null));};exports[_0xc5b1('0x56')]=function(_0x5c6d77,_0x1154af){var _0x5f06a7={'where':{'id':_0x5c6d77[_0xc5b1('0x4c')]['id']}},_0x3151ec={};_0x3151ec[_0xc5b1('0x36')]=_['keys'](db[_0xc5b1('0x32')]['rawAttributes']);_0x5f06a7[_0xc5b1('0x3c')]=_['intersection'](_0x3151ec['model'],qs[_0xc5b1('0x3d')](_0x5c6d77['query'][_0xc5b1('0x3d')]));_0x5f06a7['attributes']=_0x5f06a7[_0xc5b1('0x3c')][_0xc5b1('0x3e')]?_0x5f06a7[_0xc5b1('0x3c')]:_0x3151ec[_0xc5b1('0x36')];if(_0x5c6d77[_0xc5b1('0x38')][_0xc5b1('0x47')]){_0x5f06a7[_0xc5b1('0x48')]=[{'all':!![]}];}_0x5f06a7=_[_0xc5b1('0x44')]({},_0x5f06a7,_0x5c6d77[_0xc5b1('0x4e')]);return db[_0xc5b1('0x32')][_0xc5b1('0x54')](_0x5f06a7)[_0xc5b1('0x27')](handleEntityNotFound(_0x1154af,null))[_0xc5b1('0x27')](function(_0x5bc73a){if(_0x5bc73a){var _0x5ffd1e=_0x5bc73a['get']({'plain':!![]});_0x5ffd1e=qs[_0xc5b1('0x57')](_0x5ffd1e,['id','createdAt',_0xc5b1('0x58')]);_0x5c6d77[_0xc5b1('0x50')]=_[_0xc5b1('0x57')](_0x5c6d77['body'],['id',_0xc5b1('0x59'),'updatedAt']);return db[_0xc5b1('0x32')][_0xc5b1('0x4f')](_[_0xc5b1('0x44')](_0x5ffd1e,_0x5c6d77['body']),{'include':_0x5c6d77[_0xc5b1('0x38')][_0xc5b1('0x47')]?[{'all':!![]}]:undefined})['then'](function(_0x34d070){var _0x4655f2=_0x5c6d77[_0xc5b1('0x51')][_0xc5b1('0x28')]({'plain':!![]});if(!_0x4655f2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4655f2[_0xc5b1('0x53')]===_0xc5b1('0x51')){var _0x3721ce=_0x34d070[_0xc5b1('0x28')]({'plain':!![]});var _0x45a206=_0xc5b1('0x29');return db['UserProfileSection'][_0xc5b1('0x54')]({'where':{'name':_0x45a206,'userProfileId':_0x4655f2['userProfileId']},'raw':!![]})['then'](function(_0x38c925){if(_0x38c925&&_0x38c925[_0xc5b1('0x55')]===0x0){return db['UserProfileResource']['create']({'name':_0x3721ce[_0xc5b1('0x2f')],'resourceId':_0x3721ce['id'],'type':_0x38c925[_0xc5b1('0x2f')],'sectionId':_0x38c925['id']},{})[_0xc5b1('0x27')](function(){return _0x34d070;});}else{return _0x34d070;}})[_0xc5b1('0x4a')](function(_0x349c6b){logger[_0xc5b1('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x349c6b);throw _0x349c6b;});}return _0x34d070;});}})[_0xc5b1('0x27')](respondWithResult(_0x1154af,0xc9))['catch'](handleError(_0x1154af,null));};exports[_0xc5b1('0x26')]=function(_0x19f99e,_0x3a5a72){if(_0x19f99e[_0xc5b1('0x50')]['id']){delete _0x19f99e[_0xc5b1('0x50')]['id'];}return db['JscriptyProject'][_0xc5b1('0x54')]({'where':{'id':_0x19f99e[_0xc5b1('0x4c')]['id']}})[_0xc5b1('0x27')](handleEntityNotFound(_0x3a5a72,null))['then'](saveUpdates(_0x19f99e[_0xc5b1('0x50')],null))[_0xc5b1('0x27')](respondWithResult(_0x3a5a72,null))[_0xc5b1('0x4a')](handleError(_0x3a5a72,null));};exports[_0xc5b1('0x2b')]=function(_0x4b0fa6,_0x2c6ebc){return db[_0xc5b1('0x32')][_0xc5b1('0x54')]({'where':{'id':_0x4b0fa6[_0xc5b1('0x4c')]['id']}})[_0xc5b1('0x27')](handleEntityNotFound(_0x2c6ebc,null))['then'](removeEntity(_0x2c6ebc,null))[_0xc5b1('0x4a')](handleError(_0x2c6ebc,null));};exports[_0xc5b1('0x5a')]=function(_0x5675f5,_0x31b74a,_0x568700){var _0x16b75c={'raw':!![],'where':{}};var _0x3e4ae9={};var _0x27a99c={'count':0x0,'rows':[]};return db[_0xc5b1('0x32')]['findOne']({'where':{'id':_0x5675f5[_0xc5b1('0x4c')]['id']}})[_0xc5b1('0x27')](handleEntityNotFound(_0x31b74a,null))[_0xc5b1('0x27')](function(_0x3d460b){if(_0x3d460b){_0x3e4ae9[_0xc5b1('0x36')]=_[_0xc5b1('0x39')](db[_0xc5b1('0x5b')][_0xc5b1('0x4d')]);_0x3e4ae9[_0xc5b1('0x38')]=_[_0xc5b1('0x39')](_0x5675f5[_0xc5b1('0x38')]);_0x3e4ae9[_0xc5b1('0x3a')]=_['intersection'](_0x3e4ae9['model'],_0x3e4ae9[_0xc5b1('0x38')]);_0x16b75c['attributes']=_[_0xc5b1('0x3b')](_0x3e4ae9[_0xc5b1('0x36')],qs['fields'](_0x5675f5[_0xc5b1('0x38')][_0xc5b1('0x3d')]));_0x16b75c[_0xc5b1('0x3c')]=_0x16b75c[_0xc5b1('0x3c')][_0xc5b1('0x3e')]?_0x16b75c[_0xc5b1('0x3c')]:_0x3e4ae9[_0xc5b1('0x36')];if(!_0x5675f5[_0xc5b1('0x38')]['hasOwnProperty'](_0xc5b1('0x40'))){_0x16b75c[_0xc5b1('0x1f')]=qs[_0xc5b1('0x1f')](_0x5675f5[_0xc5b1('0x38')][_0xc5b1('0x1f')]);_0x16b75c[_0xc5b1('0x1e')]=qs[_0xc5b1('0x1e')](_0x5675f5[_0xc5b1('0x38')]['offset']);}_0x16b75c[_0xc5b1('0x41')]=qs['sort'](_0x5675f5[_0xc5b1('0x38')][_0xc5b1('0x42')]);_0x16b75c[_0xc5b1('0x46')]=qs['filters'](_[_0xc5b1('0x5c')](_0x5675f5[_0xc5b1('0x38')],_0x3e4ae9[_0xc5b1('0x3a')]));_0x16b75c[_0xc5b1('0x46')][_0xc5b1('0x5d')]=_0x3d460b['id'];if(_0x5675f5['query']['filter']){_0x16b75c[_0xc5b1('0x46')]=_[_0xc5b1('0x44')](_0x16b75c['where'],{'$or':_[_0xc5b1('0x37')](_0x16b75c[_0xc5b1('0x3c')],function(_0x145a79){var _0x5eaab0={};_0x5eaab0[_0x145a79]={'$like':'%'+_0x5675f5[_0xc5b1('0x38')][_0xc5b1('0x43')]+'%'};return _0x5eaab0;})});}_0x16b75c=_[_0xc5b1('0x44')]({},_0x16b75c,_0x5675f5[_0xc5b1('0x4e')]);return db[_0xc5b1('0x5b')][_0xc5b1('0x21')]({'where':_0x16b75c['where']})['then'](function(_0x254c88){_0x27a99c[_0xc5b1('0x21')]=_0x254c88;if(_0x5675f5['query'][_0xc5b1('0x47')]){_0x16b75c[_0xc5b1('0x48')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0xc5b1('0x49')](_0x16b75c);})[_0xc5b1('0x27')](function(_0x430292){_0x27a99c[_0xc5b1('0x5e')]=_0x430292;return _0x27a99c;});}})[_0xc5b1('0x27')](respondWithFilteredResult(_0x31b74a,_0x16b75c))['catch'](handleError(_0x31b74a,null));};exports[_0xc5b1('0x5f')]=function(_0x585192,_0x57480b,_0x54b42a){var _0x34aabc={'raw':!![],'where':{}};var _0x2f86b8={};var _0x533b9b={'count':0x0,'rows':[]};return db[_0xc5b1('0x32')]['findOne']({'where':{'id':_0x585192[_0xc5b1('0x4c')]['id']}})[_0xc5b1('0x27')](handleEntityNotFound(_0x57480b,null))['then'](function(_0x20c89d){if(_0x20c89d){_0x2f86b8[_0xc5b1('0x36')]=_[_0xc5b1('0x39')](db[_0xc5b1('0x60')][_0xc5b1('0x4d')]);_0x2f86b8[_0xc5b1('0x38')]=_[_0xc5b1('0x39')](_0x585192[_0xc5b1('0x38')]);_0x2f86b8[_0xc5b1('0x3a')]=_['intersection'](_0x2f86b8[_0xc5b1('0x36')],_0x2f86b8[_0xc5b1('0x38')]);_0x34aabc['attributes']=_[_0xc5b1('0x3b')](_0x2f86b8[_0xc5b1('0x36')],qs['fields'](_0x585192['query'][_0xc5b1('0x3d')]));_0x34aabc[_0xc5b1('0x3c')]=_0x34aabc['attributes']['length']?_0x34aabc[_0xc5b1('0x3c')]:_0x2f86b8['model'];if(!_0x585192[_0xc5b1('0x38')][_0xc5b1('0x3f')](_0xc5b1('0x40'))){_0x34aabc[_0xc5b1('0x1f')]=qs[_0xc5b1('0x1f')](_0x585192[_0xc5b1('0x38')]['limit']);_0x34aabc[_0xc5b1('0x1e')]=qs['offset'](_0x585192[_0xc5b1('0x38')]['offset']);}_0x34aabc[_0xc5b1('0x41')]=qs[_0xc5b1('0x42')](_0x585192[_0xc5b1('0x38')][_0xc5b1('0x42')]);_0x34aabc['where']=qs['filters'](_[_0xc5b1('0x5c')](_0x585192['query'],_0x2f86b8[_0xc5b1('0x3a')]));_0x34aabc[_0xc5b1('0x46')]['ProjectId']=_0x20c89d['id'];if(_0x585192[_0xc5b1('0x38')][_0xc5b1('0x43')]){_0x34aabc['where']=_[_0xc5b1('0x44')](_0x34aabc[_0xc5b1('0x46')],{'$or':_[_0xc5b1('0x37')](_0x34aabc['attributes'],function(_0x3eb209){var _0x3fb675={};_0x3fb675[_0x3eb209]={'$like':'%'+_0x585192['query'][_0xc5b1('0x43')]+'%'};return _0x3fb675;})});}_0x34aabc=_[_0xc5b1('0x44')]({},_0x34aabc,_0x585192[_0xc5b1('0x4e')]);return db[_0xc5b1('0x60')]['count']({'where':_0x34aabc[_0xc5b1('0x46')]})[_0xc5b1('0x27')](function(_0x239133){_0x533b9b[_0xc5b1('0x21')]=_0x239133;if(_0x585192['query']['includeAll']){_0x34aabc[_0xc5b1('0x48')]=[{'all':!![]}];}return db[_0xc5b1('0x60')][_0xc5b1('0x49')](_0x34aabc);})[_0xc5b1('0x27')](function(_0x2a3692){_0x533b9b[_0xc5b1('0x5e')]=_0x2a3692;return _0x533b9b;});}})[_0xc5b1('0x27')](respondWithFilteredResult(_0x57480b,_0x34aabc))[_0xc5b1('0x4a')](handleError(_0x57480b,null));};function char(_0x81091f){return'number'===typeof _0x81091f?String[_0xc5b1('0x61')][_0xc5b1('0x62')](null,arguments):_0x81091f;}function needsEncapsulation(_0x38fbd7){return!!_0x38fbd7&&(_0x38fbd7[_0xc5b1('0x63')]()[_0xc5b1('0x64')](char(0xd))>=0x0||_0x38fbd7[_0xc5b1('0x63')]()[_0xc5b1('0x64')](char(0xa))>=0x0||_0x38fbd7[_0xc5b1('0x63')]()[_0xc5b1('0x64')](char(0x2c))>=0x0||_0x38fbd7[_0xc5b1('0x63')]()[_0xc5b1('0x64')](char(0x22))>=0x0);}function encapsulate(_0x6fe0d7){var _0x41b185=char(0x22),_0x356b2c='\x5c'+char(0x22),_0x2cf570=_0x6fe0d7[_0xc5b1('0x63')]()[_0xc5b1('0x65')](new RegExp(_0x41b185,'g'),_0x356b2c);return _0x41b185+_0x2cf570+_0x41b185;}exports[_0xc5b1('0x66')]=function(_0x543a45,_0x5d562e,_0x3a9360){var _0x1955a1,_0x2352f2;var _0x4cd79a={'where':{'ProjectId':_0x543a45[_0xc5b1('0x4c')]['id']}};if(_0x543a45[_0xc5b1('0x38')][_0xc5b1('0x67')]){_0x4cd79a[_0xc5b1('0x46')][_0xc5b1('0x68')]=JSON['parse'](_0x543a45[_0xc5b1('0x38')]['startTime']);}return db[_0xc5b1('0x5b')][_0xc5b1('0x49')](_0x4cd79a)[_0xc5b1('0x27')](handleEntityNotFound(_0x5d562e,null))[_0xc5b1('0x27')](function(_0x1c6902){if(_0x1c6902){_0x1955a1=_0x1c6902;return db[_0xc5b1('0x69')][_0xc5b1('0x49')]({'where':{'SessionId':{'$in':_['map'](_0x1955a1,'id')},'ProjectId':_0x543a45[_0xc5b1('0x4c')]['id']},'order':'-createdAt'});}})[_0xc5b1('0x27')](handleEntityNotFound(_0x5d562e,null))[_0xc5b1('0x27')](function(_0x288dec){if(_0x288dec){_0x2352f2=_0x288dec;var _0x2f8d5f={};for(var _0x6631a9=0x0,_0x26d0ff=_0x2352f2[_0xc5b1('0x3e')];_0x6631a9<_0x26d0ff;_0x6631a9++){if(!_0x2f8d5f[_0xc5b1('0x3f')](_0x2352f2[_0x6631a9][_0xc5b1('0x6a')])){_0x2f8d5f[_0x2352f2[_0x6631a9][_0xc5b1('0x6a')]]=needsEncapsulation(_0x2352f2[_0x6631a9][_0xc5b1('0x6b')])?encapsulate(_0x2352f2[_0x6631a9]['question']):_0x2352f2[_0x6631a9][_0xc5b1('0x6b')];}}var _0xa8e8e0=[],_0x42aa68={};for(var _0x570af4=0x0,_0x377e90=_0x1955a1['length'];_0x570af4<_0x377e90;_0x570af4++){_0x42aa68={'ProjectId':_0x543a45[_0xc5b1('0x4c')]['id'],'SessionId':_0x1955a1[_0x570af4]['id'],'StartTime':moment(_0x1955a1[_0x570af4][_0xc5b1('0x68')])['format'](_0xc5b1('0x6c'))};for(var _0x2f3dd7=0x0,_0x181436=_0x2352f2[_0xc5b1('0x3e')];_0x2f3dd7<_0x181436;_0x2f3dd7++){if(_0x2352f2[_0x2f3dd7][_0xc5b1('0x6d')]==_0x1955a1[_0x570af4]['id']&&_0x2f8d5f[_0xc5b1('0x3f')](_0x2352f2[_0x2f3dd7][_0xc5b1('0x6a')])){_0x42aa68[_0x2f8d5f[_0x2352f2[_0x2f3dd7][_0xc5b1('0x6a')]]]=_0x2352f2[_0x2f3dd7][_0xc5b1('0x6e')];}}for(var _0x5e46f4 in _0x2f8d5f){if(!_0x42aa68[_0xc5b1('0x3f')](_0x2f8d5f[_0x5e46f4])){_0x42aa68[_0x2f8d5f[_0x5e46f4]]=null;}}_0xa8e8e0[_0xc5b1('0x6f')](_0x42aa68);}return _0xa8e8e0;}})[_0xc5b1('0x27')](function(_0x1f9136){if(!_[_0xc5b1('0x70')](_0x1f9136)){var _0x55e041=toCsv(_0x1f9136);var _0x21fe4e=Date['now']();fs['writeFileSync'](util[_0xc5b1('0x71')](_0xc5b1('0x72'),_0x543a45[_0xc5b1('0x4c')]['id'],_0x21fe4e),_0x55e041);_0x5d562e[_0xc5b1('0x73')](_0xc5b1('0x74'),'attachment;\x20filename='+util['format']('Jscripty_Project_%d_Summary_%s.csv',_0x543a45[_0xc5b1('0x4c')]['id'],_0x21fe4e));_0x5d562e[_0xc5b1('0x73')](_0xc5b1('0x75'),'text/csv');return _0x5d562e[_0xc5b1('0x76')](util[_0xc5b1('0x71')](_0xc5b1('0x72'),_0x543a45[_0xc5b1('0x4c')]['id'],_0x21fe4e));}else{return _0x5d562e[_0xc5b1('0x2c')](0xcc);}})[_0xc5b1('0x4a')](handleError(_0x5d562e,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index e60b359..9fba9fb 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 _0x34aa=['./jscriptyProject.attributes','exports','define','JscriptyProject','jscripty_projects','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x4219d8,_0xc21922){var _0x539415=function(_0x254cc1){while(--_0x254cc1){_0x4219d8['push'](_0x4219d8['shift']());}};_0x539415(++_0xc21922);}(_0x34aa,0x171));var _0xa34a=function(_0x2f8530,_0x5cbd67){_0x2f8530=_0x2f8530-0x0;var _0x5e814e=_0x34aa[_0x2f8530];return _0x5e814e;};'use strict';var _=require(_0xa34a('0x0'));var util=require('util');var logger=require(_0xa34a('0x1'))(_0xa34a('0x2'));var moment=require(_0xa34a('0x3'));var BPromise=require(_0xa34a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa34a('0x5'));var rimraf=require(_0xa34a('0x6'));var config=require(_0xa34a('0x7'));var attributes=require(_0xa34a('0x8'));module[_0xa34a('0x9')]=function(_0x475f8f,_0x27349c){return _0x475f8f[_0xa34a('0xa')](_0xa34a('0xb'),attributes,{'tableName':_0xa34a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1666=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyProject.attributes','define','JscriptyProject','jscripty_projects'];(function(_0x58cafd,_0x28b94c){var _0x184499=function(_0x2ea06e){while(--_0x2ea06e){_0x58cafd['push'](_0x58cafd['shift']());}};_0x184499(++_0x28b94c);}(_0x1666,0x75));var _0x6166=function(_0x1d2f74,_0x26de72){_0x1d2f74=_0x1d2f74-0x0;var _0x2f35f4=_0x1666[_0x1d2f74];return _0x2f35f4;};'use strict';var _=require(_0x6166('0x0'));var util=require(_0x6166('0x1'));var logger=require('../../config/logger')(_0x6166('0x2'));var moment=require(_0x6166('0x3'));var BPromise=require(_0x6166('0x4'));var rp=require(_0x6166('0x5'));var fs=require('fs');var path=require(_0x6166('0x6'));var rimraf=require(_0x6166('0x7'));var config=require(_0x6166('0x8'));var attributes=require(_0x6166('0x9'));module['exports']=function(_0x2ee359,_0x1d4f2a){return _0x2ee359[_0x6166('0xa')](_0x6166('0xb'),attributes,{'tableName':_0x6166('0xc'),'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 2b4dc1b..affd838 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 _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(_0x59fd7b,_0x2efaca){var _0x5aa063=function(_0x315f72){while(--_0x315f72){_0x59fd7b['push'](_0x59fd7b['shift']());}};_0x5aa063(++_0x2efaca);}(_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 +var _0xf4eb=['JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x5d77fb,_0x2616e8){var _0x270181=function(_0x3ab093){while(--_0x3ab093){_0x5d77fb['push'](_0x5d77fb['shift']());}};_0x270181(++_0x2616e8);}(_0xf4eb,0xec));var _0xbf4e=function(_0x3030f5,_0x101cf4){_0x3030f5=_0x3030f5-0x0;var _0x146346=_0xf4eb[_0x3030f5];return _0x146346;};'use strict';var _=require(_0xbf4e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbf4e('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbf4e('0x2'))(_0xbf4e('0x3'));var config=require(_0xbf4e('0x4'));var jayson=require(_0xbf4e('0x5'));var client=jayson[_0xbf4e('0x6')][_0xbf4e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x15b99f,_0x540736,_0x449d55){return new BPromise(function(_0x5013c2,_0x5e23d4){return client[_0xbf4e('0x8')](_0x15b99f,_0x449d55)[_0xbf4e('0x9')](function(_0xcc4097){logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));logger[_0xbf4e('0xd')]('JscriptyProject,\x20%s,\x20%s,\x20%s',_0x540736,'request\x20sent',JSON[_0xbf4e('0xe')](_0xcc4097));if(_0xcc4097['error']){if(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x10')]===0x1f4){logger['error'](_0xbf4e('0xb'),_0x540736,_0xcc4097['error']['message']);return _0x5e23d4(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);}logger[_0xbf4e('0xf')](_0xbf4e('0xb'),_0x540736,_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);return _0x5013c2(_0xcc4097['error']['message']);}else{logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));_0x5013c2(_0xcc4097['result'][_0xbf4e('0x11')]);}})[_0xbf4e('0x12')](function(_0x912fc0){logger[_0xbf4e('0xf')]('JscriptyProject,\x20%s,\x20%s',_0x540736,_0x912fc0);_0x5e23d4(_0x912fc0);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 9d86d7c..415b3b3 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 _0xf7cc=['put','update','destroy','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','index','get','/describe','describe','/:id','isAuthenticated','show','post'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf7cc,0xc1));var _0xcf7c=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xf7cc[_0x3ab51d];return _0x29a04e;};'use strict';var multer=require(_0xcf7c('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xcf7c('0x1'));var express=require(_0xcf7c('0x2'));var router=express[_0xcf7c('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xcf7c('0x4'));var interaction=require(_0xcf7c('0x5'));var config=require(_0xcf7c('0x6'));var controller=require(_0xcf7c('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xcf7c('0x8')]);router[_0xcf7c('0x9')](_0xcf7c('0xa'),auth['isAuthenticated'](),controller[_0xcf7c('0xb')]);router[_0xcf7c('0x9')](_0xcf7c('0xc'),auth[_0xcf7c('0xd')](),controller[_0xcf7c('0xe')]);router[_0xcf7c('0xf')]('/',auth[_0xcf7c('0xd')](),controller['create']);router[_0xcf7c('0x10')](_0xcf7c('0xc'),auth[_0xcf7c('0xd')](),controller[_0xcf7c('0x11')]);router['delete'](_0xcf7c('0xc'),auth['isAuthenticated'](),controller[_0xcf7c('0x12')]);module['exports']=router; \ No newline at end of file +var _0x3967=['update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','./jscriptyQuestionReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','put'];(function(_0x4a3898,_0x4c9853){var _0x25ceb0=function(_0x528b6d){while(--_0x528b6d){_0x4a3898['push'](_0x4a3898['shift']());}};_0x25ceb0(++_0x4c9853);}(_0x3967,0x1d0));var _0x7396=function(_0x9dfc10,_0x19c2d5){_0x9dfc10=_0x9dfc10-0x0;var _0x4f938a=_0x3967[_0x9dfc10];return _0x4f938a;};'use strict';var multer=require('multer');var util=require(_0x7396('0x0'));var path=require(_0x7396('0x1'));var timeout=require(_0x7396('0x2'));var express=require(_0x7396('0x3'));var router=express[_0x7396('0x4')]();var fs_extra=require(_0x7396('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7396('0x6'));router[_0x7396('0x7')]('/',auth[_0x7396('0x8')](),controller[_0x7396('0x9')]);router[_0x7396('0x7')](_0x7396('0xa'),auth[_0x7396('0x8')](),controller[_0x7396('0xb')]);router[_0x7396('0x7')](_0x7396('0xc'),auth[_0x7396('0x8')](),controller['show']);router[_0x7396('0xd')]('/',auth['isAuthenticated'](),controller[_0x7396('0xe')]);router[_0x7396('0xf')](_0x7396('0xc'),auth[_0x7396('0x8')](),controller[_0x7396('0x10')]);router[_0x7396('0x11')](_0x7396('0xc'),auth[_0x7396('0x8')](),controller[_0x7396('0x12')]);module[_0x7396('0x13')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index efc67a7..7f82ddb 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(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0x7a54,0x106));var _0x47a5=function(_0x16fbab,_0x3cec2a){_0x16fbab=_0x16fbab-0x0;var _0x29e2a7=_0x7a54[_0x16fbab];return _0x29e2a7;};'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(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0x7a54,0x106));var _0x47a5=function(_0x21f7e7,_0x556d3d){_0x21f7e7=_0x21f7e7-0x0;var _0x7cd45d=_0x7a54[_0x21f7e7];return _0x7cd45d;};'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 f687552..1b24b77 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 _0x0276=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','name','send','index','JscriptyQuestionReport','rawAttributes','type','key','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','params','options','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/parsers/qs'];(function(_0x4b700a,_0x9fd753){var _0x4686c4=function(_0x4532a2){while(--_0x4532a2){_0x4b700a['push'](_0x4b700a['shift']());}};_0x4686c4(++_0x9fd753);}(_0x0276,0x15c));var _0x6027=function(_0x53e35e,_0x114a69){_0x53e35e=_0x53e35e-0x0;var _0xaaaa6a=_0x0276[_0x53e35e];return _0xaaaa6a;};'use strict';var emlformat=require(_0x6027('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6027('0x1'));var jsonpatch=require(_0x6027('0x2'));var rp=require(_0x6027('0x3'));var moment=require(_0x6027('0x4'));var BPromise=require(_0x6027('0x5'));var Mustache=require(_0x6027('0x6'));var util=require(_0x6027('0x7'));var path=require(_0x6027('0x8'));var sox=require('sox');var csv=require(_0x6027('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6027('0xa'));var _=require(_0x6027('0xb'));var squel=require(_0x6027('0xc'));var crypto=require(_0x6027('0xd'));var jsforce=require(_0x6027('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x6027('0x9'));var querystring=require('querystring');var Papa=require(_0x6027('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6027('0x10'));var as=require(_0x6027('0x11'));var hardwareService=require(_0x6027('0x12'));var logger=require(_0x6027('0x13'))(_0x6027('0x14'));var utils=require('../../config/utils');var config=require(_0x6027('0x15'));var licenseUtil=require(_0x6027('0x16'));var db=require(_0x6027('0x17'))['db'];function respondWithStatusCode(_0x34cd10,_0x135d6f){_0x135d6f=_0x135d6f||0xcc;return function(_0x400a1d){if(_0x400a1d){return _0x34cd10['sendStatus'](_0x135d6f);}return _0x34cd10[_0x6027('0x18')](_0x135d6f)[_0x6027('0x19')]();};}function respondWithResult(_0x2d70d4,_0x120ee9){_0x120ee9=_0x120ee9||0xc8;return function(_0x2b4bff){if(_0x2b4bff){return _0x2d70d4[_0x6027('0x18')](_0x120ee9)[_0x6027('0x1a')](_0x2b4bff);}};}function respondWithFilteredResult(_0x195aae,_0xd819d1){return function(_0x3615dd){if(_0x3615dd){var _0x57d616=typeof _0xd819d1[_0x6027('0x1b')]===_0x6027('0x1c')&&typeof _0xd819d1[_0x6027('0x1d')]===_0x6027('0x1c');var _0x1d65e2=_0x3615dd[_0x6027('0x1e')];var _0x59daf8=_0x57d616?0x0:_0xd819d1[_0x6027('0x1b')];var _0x43ce94=_0x57d616?_0x3615dd[_0x6027('0x1e')]:_0xd819d1[_0x6027('0x1b')]+_0xd819d1['limit'];var _0x4a20bc;if(_0x43ce94>=_0x1d65e2){_0x43ce94=_0x1d65e2;_0x4a20bc=0xc8;}else{_0x4a20bc=0xce;}_0x195aae[_0x6027('0x18')](_0x4a20bc);return _0x195aae[_0x6027('0x1f')](_0x6027('0x20'),_0x59daf8+'-'+_0x43ce94+'/'+_0x1d65e2)['json'](_0x3615dd);}return null;};}function patchUpdates(_0x22f747){return function(_0xa1c6fb){try{jsonpatch[_0x6027('0x21')](_0xa1c6fb,_0x22f747,!![]);}catch(_0x507e3b){return BPromise['reject'](_0x507e3b);}return _0xa1c6fb[_0x6027('0x22')]();};}function saveUpdates(_0x1a4f00,_0x240ab3){return function(_0xef99ef){if(_0xef99ef){return _0xef99ef[_0x6027('0x23')](_0x1a4f00)[_0x6027('0x24')](function(_0x60bd91){return _0x60bd91;});}return null;};}function removeEntity(_0x4ba34b,_0x366734){return function(_0x4c1d36){if(_0x4c1d36){return _0x4c1d36[_0x6027('0x25')]()[_0x6027('0x24')](function(){_0x4ba34b[_0x6027('0x18')](0xcc)[_0x6027('0x19')]();});}};}function handleEntityNotFound(_0x44e546,_0x19c276){return function(_0x507787){if(!_0x507787){_0x44e546['sendStatus'](0x194);}return _0x507787;};}function handleError(_0x50a5da,_0x5a8dba){_0x5a8dba=_0x5a8dba||0x1f4;return function(_0xf0f445){logger[_0x6027('0x26')](_0xf0f445['stack']);if(_0xf0f445['name']){delete _0xf0f445[_0x6027('0x27')];}_0x50a5da['status'](_0x5a8dba)[_0x6027('0x28')](_0xf0f445);};}exports[_0x6027('0x29')]=function(_0x1c2600,_0x180358){var _0x5a6b9a={},_0x58a774={},_0x104cd4={'count':0x0,'rows':[]};var _0x269bcc=_['map'](db[_0x6027('0x2a')][_0x6027('0x2b')],function(_0x59501f){return{'name':_0x59501f['fieldName'],'type':_0x59501f[_0x6027('0x2c')][_0x6027('0x2d')]};});_0x58a774[_0x6027('0x2e')]=_[_0x6027('0x2f')](_0x269bcc,_0x6027('0x27'));_0x58a774[_0x6027('0x30')]=_[_0x6027('0x31')](_0x1c2600['query']);_0x58a774[_0x6027('0x32')]=_[_0x6027('0x33')](_0x58a774['model'],_0x58a774[_0x6027('0x30')]);_0x5a6b9a['attributes']=_[_0x6027('0x33')](_0x58a774[_0x6027('0x2e')],qs[_0x6027('0x34')](_0x1c2600[_0x6027('0x30')][_0x6027('0x34')]));_0x5a6b9a[_0x6027('0x35')]=_0x5a6b9a[_0x6027('0x35')]['length']?_0x5a6b9a['attributes']:_0x58a774[_0x6027('0x2e')];if(!_0x1c2600['query'][_0x6027('0x36')](_0x6027('0x37'))){_0x5a6b9a[_0x6027('0x1d')]=qs[_0x6027('0x1d')](_0x1c2600[_0x6027('0x30')][_0x6027('0x1d')]);_0x5a6b9a['offset']=qs[_0x6027('0x1b')](_0x1c2600[_0x6027('0x30')][_0x6027('0x1b')]);}_0x5a6b9a['order']=qs[_0x6027('0x38')](_0x1c2600[_0x6027('0x30')][_0x6027('0x38')]);_0x5a6b9a[_0x6027('0x39')]=qs[_0x6027('0x32')](_[_0x6027('0x3a')](_0x1c2600[_0x6027('0x30')],_0x58a774[_0x6027('0x32')]),_0x269bcc);if(_0x1c2600[_0x6027('0x30')][_0x6027('0x3b')]){_0x5a6b9a['where']=_['merge'](_0x5a6b9a['where'],{'$or':_[_0x6027('0x2f')](_0x269bcc,function(_0x417962){if(_0x417962[_0x6027('0x2c')]!==_0x6027('0x3c')){var _0x49d3f0={};_0x49d3f0[_0x417962[_0x6027('0x27')]]={'$like':'%'+_0x1c2600[_0x6027('0x30')][_0x6027('0x3b')]+'%'};return _0x49d3f0;}})});}_0x5a6b9a=_[_0x6027('0x3d')]({},_0x5a6b9a,_0x1c2600['options']);var _0x5b1c92={'where':_0x5a6b9a[_0x6027('0x39')]};return db[_0x6027('0x2a')]['count'](_0x5b1c92)[_0x6027('0x24')](function(_0x131c90){_0x104cd4['count']=_0x131c90;if(_0x1c2600['query'][_0x6027('0x3e')]){_0x5a6b9a[_0x6027('0x3f')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x6027('0x40')](_0x5a6b9a);})[_0x6027('0x24')](function(_0x26a4eb){_0x104cd4[_0x6027('0x41')]=_0x26a4eb;return _0x104cd4;})[_0x6027('0x24')](respondWithFilteredResult(_0x180358,_0x5a6b9a))[_0x6027('0x42')](handleError(_0x180358,null));};exports['show']=function(_0x399369,_0x10f338){var _0x2f299d={'raw':!![],'where':{'id':_0x399369[_0x6027('0x43')]['id']}},_0x44c935={};_0x44c935['model']=_['keys'](db[_0x6027('0x2a')][_0x6027('0x2b')]);_0x44c935[_0x6027('0x30')]=_[_0x6027('0x31')](_0x399369[_0x6027('0x30')]);_0x44c935[_0x6027('0x32')]=_[_0x6027('0x33')](_0x44c935[_0x6027('0x2e')],_0x44c935['query']);_0x2f299d['attributes']=_[_0x6027('0x33')](_0x44c935['model'],qs[_0x6027('0x34')](_0x399369[_0x6027('0x30')][_0x6027('0x34')]));_0x2f299d[_0x6027('0x35')]=_0x2f299d[_0x6027('0x35')]['length']?_0x2f299d[_0x6027('0x35')]:_0x44c935[_0x6027('0x2e')];if(_0x399369[_0x6027('0x30')][_0x6027('0x3e')]){_0x2f299d[_0x6027('0x3f')]=[{'all':!![]}];}_0x2f299d=_[_0x6027('0x3d')]({},_0x2f299d,_0x399369[_0x6027('0x44')]);return db[_0x6027('0x2a')][_0x6027('0x45')](_0x2f299d)[_0x6027('0x24')](handleEntityNotFound(_0x10f338,null))['then'](respondWithResult(_0x10f338,null))[_0x6027('0x42')](handleError(_0x10f338,null));};exports['create']=function(_0x1d0fd3,_0x4ad00f){return db['JscriptyQuestionReport'][_0x6027('0x46')](_0x1d0fd3[_0x6027('0x47')],{})['then'](respondWithResult(_0x4ad00f,0xc9))[_0x6027('0x42')](handleError(_0x4ad00f,null));};exports['update']=function(_0x19d45c,_0x1d650c){if(_0x19d45c[_0x6027('0x47')]['id']){delete _0x19d45c[_0x6027('0x47')]['id'];}return db[_0x6027('0x2a')][_0x6027('0x45')]({'where':{'id':_0x19d45c[_0x6027('0x43')]['id']}})[_0x6027('0x24')](handleEntityNotFound(_0x1d650c,null))[_0x6027('0x24')](saveUpdates(_0x19d45c[_0x6027('0x47')],null))[_0x6027('0x24')](respondWithResult(_0x1d650c,null))[_0x6027('0x42')](handleError(_0x1d650c,null));};exports[_0x6027('0x25')]=function(_0x4068c5,_0x20f6b9){return db[_0x6027('0x2a')][_0x6027('0x45')]({'where':{'id':_0x4068c5[_0x6027('0x43')]['id']}})[_0x6027('0x24')](handleEntityNotFound(_0x20f6b9,null))[_0x6027('0x24')](removeEntity(_0x20f6b9,null))[_0x6027('0x42')](handleError(_0x20f6b9,null));};exports[_0x6027('0x48')]=function(_0x23974b,_0x3be036){return db[_0x6027('0x2a')][_0x6027('0x48')]()[_0x6027('0x24')](respondWithResult(_0x3be036,null))[_0x6027('0x42')](handleError(_0x3be036,null));}; \ No newline at end of file +var _0xdeae=['hasOwnProperty','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params','length','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','mustache','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','end','status','offset','undefined','limit','count','set','json','apply','save','update','then','destroy','sendStatus','stack','name','index','map','JscriptyQuestionReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes'];(function(_0x12bab,_0x152135){var _0x3d966c=function(_0x5abf8d){while(--_0x5abf8d){_0x12bab['push'](_0x12bab['shift']());}};_0x3d966c(++_0x152135);}(_0xdeae,0xa0));var _0xedea=function(_0x3cd451,_0x26e81a){_0x3cd451=_0x3cd451-0x0;var _0x571ce6=_0xdeae[_0x3cd451];return _0x571ce6;};'use strict';var emlformat=require(_0xedea('0x0'));var rimraf=require(_0xedea('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xedea('0x2'));var rp=require(_0xedea('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xedea('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xedea('0x5'));var ejs=require(_0xedea('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xedea('0x7'));var squel=require(_0xedea('0x8'));var crypto=require(_0xedea('0x9'));var jsforce=require(_0xedea('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xedea('0xb'));var Papa=require(_0xedea('0xc'));var Redis=require('ioredis');var authService=require(_0xedea('0xd'));var qs=require(_0xedea('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xedea('0xf'));var logger=require('../../config/logger')(_0xedea('0x10'));var utils=require(_0xedea('0x11'));var config=require(_0xedea('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xedea('0x13'))['db'];function respondWithStatusCode(_0x3d4d7c,_0xf8e727){_0xf8e727=_0xf8e727||0xcc;return function(_0x5b2e6c){if(_0x5b2e6c){return _0x3d4d7c['sendStatus'](_0xf8e727);}return _0x3d4d7c['status'](_0xf8e727)[_0xedea('0x14')]();};}function respondWithResult(_0x5546ed,_0x5c2a20){_0x5c2a20=_0x5c2a20||0xc8;return function(_0x15148c){if(_0x15148c){return _0x5546ed[_0xedea('0x15')](_0x5c2a20)['json'](_0x15148c);}};}function respondWithFilteredResult(_0xccabe7,_0x2241c1){return function(_0x1d5d44){if(_0x1d5d44){var _0x5b8081=typeof _0x2241c1[_0xedea('0x16')]===_0xedea('0x17')&&typeof _0x2241c1[_0xedea('0x18')]===_0xedea('0x17');var _0x7ab753=_0x1d5d44['count'];var _0x4de7f3=_0x5b8081?0x0:_0x2241c1[_0xedea('0x16')];var _0x5311b0=_0x5b8081?_0x1d5d44[_0xedea('0x19')]:_0x2241c1[_0xedea('0x16')]+_0x2241c1[_0xedea('0x18')];var _0x5042e7;if(_0x5311b0>=_0x7ab753){_0x5311b0=_0x7ab753;_0x5042e7=0xc8;}else{_0x5042e7=0xce;}_0xccabe7[_0xedea('0x15')](_0x5042e7);return _0xccabe7[_0xedea('0x1a')]('Content-Range',_0x4de7f3+'-'+_0x5311b0+'/'+_0x7ab753)[_0xedea('0x1b')](_0x1d5d44);}return null;};}function patchUpdates(_0x225943){return function(_0xbe8845){try{jsonpatch[_0xedea('0x1c')](_0xbe8845,_0x225943,!![]);}catch(_0x4e24a5){return BPromise['reject'](_0x4e24a5);}return _0xbe8845[_0xedea('0x1d')]();};}function saveUpdates(_0x45e7bd,_0x34394d){return function(_0x3ec4f4){if(_0x3ec4f4){return _0x3ec4f4[_0xedea('0x1e')](_0x45e7bd)[_0xedea('0x1f')](function(_0x493d55){return _0x493d55;});}return null;};}function removeEntity(_0x17b48f,_0x196df3){return function(_0x38c239){if(_0x38c239){return _0x38c239[_0xedea('0x20')]()['then'](function(){_0x17b48f[_0xedea('0x15')](0xcc)[_0xedea('0x14')]();});}};}function handleEntityNotFound(_0x5d0696,_0x480b9f){return function(_0x5ac8fd){if(!_0x5ac8fd){_0x5d0696[_0xedea('0x21')](0x194);}return _0x5ac8fd;};}function handleError(_0xd110f4,_0x38c4d9){_0x38c4d9=_0x38c4d9||0x1f4;return function(_0x22b2d5){logger['error'](_0x22b2d5[_0xedea('0x22')]);if(_0x22b2d5[_0xedea('0x23')]){delete _0x22b2d5[_0xedea('0x23')];}_0xd110f4['status'](_0x38c4d9)['send'](_0x22b2d5);};}exports[_0xedea('0x24')]=function(_0x49e2bd,_0x574a7e){var _0x44333b={},_0x28a8c0={},_0x49a074={'count':0x0,'rows':[]};var _0x203742=_[_0xedea('0x25')](db[_0xedea('0x26')][_0xedea('0x27')],function(_0x38041d){return{'name':_0x38041d[_0xedea('0x28')],'type':_0x38041d[_0xedea('0x29')][_0xedea('0x2a')]};});_0x28a8c0[_0xedea('0x2b')]=_[_0xedea('0x25')](_0x203742,_0xedea('0x23'));_0x28a8c0[_0xedea('0x2c')]=_[_0xedea('0x2d')](_0x49e2bd[_0xedea('0x2c')]);_0x28a8c0[_0xedea('0x2e')]=_[_0xedea('0x2f')](_0x28a8c0[_0xedea('0x2b')],_0x28a8c0[_0xedea('0x2c')]);_0x44333b['attributes']=_['intersection'](_0x28a8c0[_0xedea('0x2b')],qs[_0xedea('0x30')](_0x49e2bd['query']['fields']));_0x44333b[_0xedea('0x31')]=_0x44333b[_0xedea('0x31')]['length']?_0x44333b['attributes']:_0x28a8c0[_0xedea('0x2b')];if(!_0x49e2bd[_0xedea('0x2c')][_0xedea('0x32')]('nolimit')){_0x44333b[_0xedea('0x18')]=qs[_0xedea('0x18')](_0x49e2bd[_0xedea('0x2c')][_0xedea('0x18')]);_0x44333b[_0xedea('0x16')]=qs[_0xedea('0x16')](_0x49e2bd[_0xedea('0x2c')][_0xedea('0x16')]);}_0x44333b[_0xedea('0x33')]=qs['sort'](_0x49e2bd[_0xedea('0x2c')][_0xedea('0x34')]);_0x44333b['where']=qs[_0xedea('0x2e')](_[_0xedea('0x35')](_0x49e2bd['query'],_0x28a8c0[_0xedea('0x2e')]),_0x203742);if(_0x49e2bd[_0xedea('0x2c')]['filter']){_0x44333b[_0xedea('0x36')]=_[_0xedea('0x37')](_0x44333b[_0xedea('0x36')],{'$or':_['map'](_0x203742,function(_0x45b0ce){if(_0x45b0ce[_0xedea('0x29')]!==_0xedea('0x38')){var _0x404438={};_0x404438[_0x45b0ce['name']]={'$like':'%'+_0x49e2bd['query'][_0xedea('0x39')]+'%'};return _0x404438;}})});}_0x44333b=_[_0xedea('0x37')]({},_0x44333b,_0x49e2bd[_0xedea('0x3a')]);var _0x422c09={'where':_0x44333b[_0xedea('0x36')]};return db[_0xedea('0x26')][_0xedea('0x19')](_0x422c09)['then'](function(_0x4f157d){_0x49a074['count']=_0x4f157d;if(_0x49e2bd[_0xedea('0x2c')][_0xedea('0x3b')]){_0x44333b['include']=[{'all':!![]}];}return db[_0xedea('0x26')][_0xedea('0x3c')](_0x44333b);})['then'](function(_0x3d7ed1){_0x49a074[_0xedea('0x3d')]=_0x3d7ed1;return _0x49a074;})['then'](respondWithFilteredResult(_0x574a7e,_0x44333b))[_0xedea('0x3e')](handleError(_0x574a7e,null));};exports[_0xedea('0x3f')]=function(_0x57b009,_0x29662e){var _0x349812={'raw':!![],'where':{'id':_0x57b009[_0xedea('0x40')]['id']}},_0x5167cd={};_0x5167cd[_0xedea('0x2b')]=_[_0xedea('0x2d')](db[_0xedea('0x26')][_0xedea('0x27')]);_0x5167cd[_0xedea('0x2c')]=_[_0xedea('0x2d')](_0x57b009[_0xedea('0x2c')]);_0x5167cd[_0xedea('0x2e')]=_[_0xedea('0x2f')](_0x5167cd['model'],_0x5167cd[_0xedea('0x2c')]);_0x349812['attributes']=_[_0xedea('0x2f')](_0x5167cd[_0xedea('0x2b')],qs[_0xedea('0x30')](_0x57b009[_0xedea('0x2c')][_0xedea('0x30')]));_0x349812[_0xedea('0x31')]=_0x349812[_0xedea('0x31')][_0xedea('0x41')]?_0x349812['attributes']:_0x5167cd[_0xedea('0x2b')];if(_0x57b009[_0xedea('0x2c')][_0xedea('0x3b')]){_0x349812['include']=[{'all':!![]}];}_0x349812=_[_0xedea('0x37')]({},_0x349812,_0x57b009[_0xedea('0x3a')]);return db[_0xedea('0x26')][_0xedea('0x42')](_0x349812)['then'](handleEntityNotFound(_0x29662e,null))[_0xedea('0x1f')](respondWithResult(_0x29662e,null))['catch'](handleError(_0x29662e,null));};exports[_0xedea('0x43')]=function(_0x227ae0,_0x29a249){return db[_0xedea('0x26')][_0xedea('0x43')](_0x227ae0[_0xedea('0x44')],{})[_0xedea('0x1f')](respondWithResult(_0x29a249,0xc9))['catch'](handleError(_0x29a249,null));};exports[_0xedea('0x1e')]=function(_0x5dea80,_0x47f149){if(_0x5dea80[_0xedea('0x44')]['id']){delete _0x5dea80[_0xedea('0x44')]['id'];}return db[_0xedea('0x26')]['find']({'where':{'id':_0x5dea80[_0xedea('0x40')]['id']}})['then'](handleEntityNotFound(_0x47f149,null))[_0xedea('0x1f')](saveUpdates(_0x5dea80[_0xedea('0x44')],null))[_0xedea('0x1f')](respondWithResult(_0x47f149,null))[_0xedea('0x3e')](handleError(_0x47f149,null));};exports[_0xedea('0x20')]=function(_0x54a80d,_0x11edb8){return db[_0xedea('0x26')][_0xedea('0x42')]({'where':{'id':_0x54a80d['params']['id']}})[_0xedea('0x1f')](handleEntityNotFound(_0x11edb8,null))['then'](removeEntity(_0x11edb8,null))[_0xedea('0x3e')](handleError(_0x11edb8,null));};exports[_0xedea('0x45')]=function(_0x1279dc,_0x2cd90f){return db[_0xedea('0x26')]['describe']()['then'](respondWithResult(_0x2cd90f,null))[_0xedea('0x3e')](handleError(_0x2cd90f,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 0e3835f..d4628c6 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 _0x6bef=['exports','define','report_jscripty_questions','lodash','util','../../config/logger','api','moment','request-promise','../../config/environment','./jscriptyQuestionReport.attributes'];(function(_0x523efb,_0x44b1bc){var _0x5cb238=function(_0xb4be2d){while(--_0xb4be2d){_0x523efb['push'](_0x523efb['shift']());}};_0x5cb238(++_0x44b1bc);}(_0x6bef,0x1bb));var _0xf6be=function(_0xf2deb7,_0x222b79){_0xf2deb7=_0xf2deb7-0x0;var _0x25d0cb=_0x6bef[_0xf2deb7];return _0x25d0cb;};'use strict';var _=require(_0xf6be('0x0'));var util=require(_0xf6be('0x1'));var logger=require(_0xf6be('0x2'))(_0xf6be('0x3'));var moment=require(_0xf6be('0x4'));var BPromise=require('bluebird');var rp=require(_0xf6be('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xf6be('0x6'));var attributes=require(_0xf6be('0x7'));module[_0xf6be('0x8')]=function(_0x5d5023,_0x434aa9){return _0x5d5023[_0xf6be('0x9')]('JscriptyQuestionReport',attributes,{'tableName':_0xf6be('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3dd6=['report_jscripty_questions','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','define','JscriptyQuestionReport'];(function(_0x11096c,_0x4aab24){var _0x3ba1c5=function(_0x4b55fb){while(--_0x4b55fb){_0x11096c['push'](_0x11096c['shift']());}};_0x3ba1c5(++_0x4aab24);}(_0x3dd6,0x1c1));var _0x63dd=function(_0x4a6e77,_0x4a677c){_0x4a6e77=_0x4a6e77-0x0;var _0x1c137e=_0x3dd6[_0x4a6e77];return _0x1c137e;};'use strict';var _=require(_0x63dd('0x0'));var util=require(_0x63dd('0x1'));var logger=require(_0x63dd('0x2'))(_0x63dd('0x3'));var moment=require(_0x63dd('0x4'));var BPromise=require(_0x63dd('0x5'));var rp=require(_0x63dd('0x6'));var fs=require('fs');var path=require(_0x63dd('0x7'));var rimraf=require(_0x63dd('0x8'));var config=require(_0x63dd('0x9'));var attributes=require(_0x63dd('0xa'));module['exports']=function(_0x1b5b38,_0x2e210b){return _0x1b5b38[_0x63dd('0xb')](_0x63dd('0xc'),attributes,{'tableName':_0x63dd('0xd'),'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 fbbca40..8b97e65 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 _0xc66d=['randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','bluebird'];(function(_0x20fc8d,_0xe77e58){var _0x176f0b=function(_0x17764d){while(--_0x17764d){_0x20fc8d['push'](_0x20fc8d['shift']());}};_0x176f0b(++_0xe77e58);}(_0xc66d,0xfa));var _0xdc66=function(_0x4618e2,_0x50d133){_0x4618e2=_0x4618e2-0x0;var _0x5edeca=_0xc66d[_0x4618e2];return _0x5edeca;};'use strict';var _=require('lodash');var util=require(_0xdc66('0x0'));var moment=require('moment');var BPromise=require(_0xdc66('0x1'));var rs=require(_0xdc66('0x2'));var fs=require('fs');var Redis=require(_0xdc66('0x3'));var db=require(_0xdc66('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xdc66('0x5'))('rpc');var config=require(_0xdc66('0x6'));var jayson=require(_0xdc66('0x7'));var client=jayson['client'][_0xdc66('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x455a3c,_0x56a3be,_0x1ac6e5){return new BPromise(function(_0x475c36,_0x29ad1a){return client[_0xdc66('0x9')](_0x455a3c,_0x1ac6e5)[_0xdc66('0xa')](function(_0x4d0884){logger[_0xdc66('0xb')](_0xdc66('0xc'),_0x56a3be,_0xdc66('0xd'));logger[_0xdc66('0xe')](_0xdc66('0xf'),_0x56a3be,_0xdc66('0xd'),JSON[_0xdc66('0x10')](_0x4d0884));if(_0x4d0884[_0xdc66('0x11')]){if(_0x4d0884['error'][_0xdc66('0x12')]===0x1f4){logger['error'](_0xdc66('0xc'),_0x56a3be,_0x4d0884[_0xdc66('0x11')][_0xdc66('0x13')]);return _0x29ad1a(_0x4d0884[_0xdc66('0x11')][_0xdc66('0x13')]);}logger[_0xdc66('0x11')](_0xdc66('0xc'),_0x56a3be,_0x4d0884[_0xdc66('0x11')][_0xdc66('0x13')]);return _0x475c36(_0x4d0884[_0xdc66('0x11')]['message']);}else{logger[_0xdc66('0xb')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x56a3be,'request\x20sent');_0x475c36(_0x4d0884[_0xdc66('0x14')][_0xdc66('0x13')]);}})['catch'](function(_0x527206){logger[_0xdc66('0x11')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x56a3be,_0x527206);_0x29ad1a(_0x527206);});});} \ No newline at end of file +var _0x9611=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x3d237d,_0x50af61){var _0x5459d4=function(_0x18809b){while(--_0x18809b){_0x3d237d['push'](_0x3d237d['shift']());}};_0x5459d4(++_0x50af61);}(_0x9611,0xdb));var _0x1961=function(_0x48b17a,_0x264fd9){_0x48b17a=_0x48b17a-0x0;var _0x4197ba=_0x9611[_0x48b17a];return _0x4197ba;};'use strict';var _=require(_0x1961('0x0'));var util=require(_0x1961('0x1'));var moment=require(_0x1961('0x2'));var BPromise=require(_0x1961('0x3'));var rs=require(_0x1961('0x4'));var fs=require('fs');var Redis=require(_0x1961('0x5'));var db=require(_0x1961('0x6'))['db'];var utils=require(_0x1961('0x7'));var logger=require(_0x1961('0x8'))(_0x1961('0x9'));var config=require(_0x1961('0xa'));var jayson=require(_0x1961('0xb'));var client=jayson['client'][_0x1961('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x572384,_0x52b524,_0x9f55f9){return new BPromise(function(_0x587cc3,_0x22bfa9){return client[_0x1961('0xd')](_0x572384,_0x9f55f9)[_0x1961('0xe')](function(_0xb48f1f){logger['info'](_0x1961('0xf'),_0x52b524,_0x1961('0x10'));logger[_0x1961('0x11')](_0x1961('0x12'),_0x52b524,_0x1961('0x10'),JSON[_0x1961('0x13')](_0xb48f1f));if(_0xb48f1f[_0x1961('0x14')]){if(_0xb48f1f[_0x1961('0x14')][_0x1961('0x15')]===0x1f4){logger[_0x1961('0x14')](_0x1961('0xf'),_0x52b524,_0xb48f1f['error'][_0x1961('0x16')]);return _0x22bfa9(_0xb48f1f['error'][_0x1961('0x16')]);}logger[_0x1961('0x14')](_0x1961('0xf'),_0x52b524,_0xb48f1f[_0x1961('0x14')][_0x1961('0x16')]);return _0x587cc3(_0xb48f1f['error'][_0x1961('0x16')]);}else{logger['info'](_0x1961('0xf'),_0x52b524,_0x1961('0x10'));_0x587cc3(_0xb48f1f[_0x1961('0x17')]['message']);}})[_0x1961('0x18')](function(_0x14c3c6){logger[_0x1961('0x14')](_0x1961('0xf'),_0x52b524,_0x14c3c6);_0x22bfa9(_0x14c3c6);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 2565f8f..93357f8 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 _0x3368=['/:id/questions','getQuestions','post','create','put','update','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./jscriptySessionReport.controller','get','isAuthenticated','/describe','/:id','show'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0x3368,0x1e2));var _0x8336=function(_0x11c3d7,_0x4d9e67){_0x11c3d7=_0x11c3d7-0x0;var _0x4d37b0=_0x3368[_0x11c3d7];return _0x4d37b0;};'use strict';var multer=require('multer');var util=require(_0x8336('0x0'));var path=require('path');var timeout=require(_0x8336('0x1'));var express=require(_0x8336('0x2'));var router=express[_0x8336('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x8336('0x4'));var interaction=require(_0x8336('0x5'));var config=require('../../config/environment');var controller=require(_0x8336('0x6'));router[_0x8336('0x7')]('/',auth[_0x8336('0x8')](),controller['index']);router[_0x8336('0x7')](_0x8336('0x9'),auth[_0x8336('0x8')](),controller['describe']);router['get'](_0x8336('0xa'),auth[_0x8336('0x8')](),controller[_0x8336('0xb')]);router[_0x8336('0x7')](_0x8336('0xc'),auth[_0x8336('0x8')](),controller[_0x8336('0xd')]);router[_0x8336('0xe')]('/',auth[_0x8336('0x8')](),controller[_0x8336('0xf')]);router[_0x8336('0x10')](_0x8336('0xa'),auth[_0x8336('0x8')](),controller[_0x8336('0x11')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x8336('0x12')]=router; \ No newline at end of file +var _0x618b=['../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','/describe','describe','getQuestions','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra'];(function(_0xce4eed,_0x3c8fd8){var _0x1a10cc=function(_0x1d39bd){while(--_0x1d39bd){_0xce4eed['push'](_0xce4eed['shift']());}};_0x1a10cc(++_0x3c8fd8);}(_0x618b,0xf6));var _0xb618=function(_0x2441cc,_0x450696){_0x2441cc=_0x2441cc-0x0;var _0x199774=_0x618b[_0x2441cc];return _0x199774;};'use strict';var multer=require(_0xb618('0x0'));var util=require(_0xb618('0x1'));var path=require('path');var timeout=require(_0xb618('0x2'));var express=require(_0xb618('0x3'));var router=express[_0xb618('0x4')]();var fs_extra=require(_0xb618('0x5'));var auth=require(_0xb618('0x6'));var interaction=require(_0xb618('0x7'));var config=require(_0xb618('0x8'));var controller=require(_0xb618('0x9'));router[_0xb618('0xa')]('/',auth[_0xb618('0xb')](),controller['index']);router[_0xb618('0xa')](_0xb618('0xc'),auth[_0xb618('0xb')](),controller[_0xb618('0xd')]);router[_0xb618('0xa')]('/:id',auth[_0xb618('0xb')](),controller['show']);router[_0xb618('0xa')]('/:id/questions',auth[_0xb618('0xb')](),controller[_0xb618('0xe')]);router['post']('/',auth[_0xb618('0xb')](),controller['create']);router[_0xb618('0xf')](_0xb618('0x10'),auth[_0xb618('0xb')](),controller[_0xb618('0x11')]);router[_0xb618('0x12')](_0xb618('0x10'),auth[_0xb618('0xb')](),controller[_0xb618('0x13')]);module[_0xb618('0x14')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 3590389..c2e52cf 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 _0x8eb6=['DATE','setDataValue','starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','exports'];(function(_0x12c7c4,_0x445b21){var _0x30bbdb=function(_0x3b9a58){while(--_0x3b9a58){_0x12c7c4['push'](_0x12c7c4['shift']());}};_0x30bbdb(++_0x445b21);}(_0x8eb6,0x98));var _0x68eb=function(_0x3825a7,_0x1cc51c){_0x3825a7=_0x3825a7-0x0;var _0x232fda=_0x8eb6[_0x3825a7];return _0x232fda;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x68eb('0x0')]={'starttime':{'type':Sequelize[_0x68eb('0x1')],'set':function(_0x30cf29){this[_0x68eb('0x2')](_0x68eb('0x3'),_0x30cf29);this[_0x68eb('0x2')](_0x68eb('0x4'),moment()[_0x68eb('0x5')](_0x68eb('0x6')));}},'endtime':{'type':Sequelize[_0x68eb('0x1')]},'membername':{'type':Sequelize[_0x68eb('0x7')]},'projectname':{'type':Sequelize[_0x68eb('0x7')]},'queue':{'type':Sequelize[_0x68eb('0x7')]},'uniqueid':{'type':Sequelize[_0x68eb('0x7')]},'calleridname':{'type':Sequelize[_0x68eb('0x7')]},'calleridnum':{'type':Sequelize[_0x68eb('0x7')]},'completed':{'type':Sequelize[_0x68eb('0x8')],'defaultValue':![]}}; \ No newline at end of file +var _0x9311=['setDataValue','format','STRING','BOOLEAN','moment','sequelize'];(function(_0x89e0e3,_0x2008a0){var _0x1a8213=function(_0x574448){while(--_0x574448){_0x89e0e3['push'](_0x89e0e3['shift']());}};_0x1a8213(++_0x2008a0);}(_0x9311,0x1e4));var _0x1931=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9311[_0x14add3];return _0x4a174f;};'use strict';var moment=require(_0x1931('0x0'));var Sequelize=require(_0x1931('0x1'));module['exports']={'starttime':{'type':Sequelize['DATE'],'set':function(_0x1c255b){this[_0x1931('0x2')]('starttime',_0x1c255b);this['setDataValue']('endtime',moment()[_0x1931('0x3')]('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize[_0x1931('0x4')]},'projectname':{'type':Sequelize[_0x1931('0x4')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x1931('0x4')]},'calleridname':{'type':Sequelize[_0x1931('0x4')]},'calleridnum':{'type':Sequelize[_0x1931('0x4')]},'completed':{'type':Sequelize[_0x1931('0x5')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 5d8d481..ba789f5 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 _0x2536=['pick','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','end','error','stack','name','send','index','map','JscriptySessionReport','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','filter','where','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','create','body','destroy','find','findOne','JscriptyQuestionReport','hasOwnProperty'];(function(_0x3c2ee2,_0x232628){var _0x5f48a1=function(_0x24f054){while(--_0x24f054){_0x3c2ee2['push'](_0x3c2ee2['shift']());}};_0x5f48a1(++_0x232628);}(_0x2536,0x191));var _0x6253=function(_0x59f523,_0x5051){_0x59f523=_0x59f523-0x0;var _0x1bd1ce=_0x2536[_0x59f523];return _0x1bd1ce;};'use strict';var emlformat=require(_0x6253('0x0'));var rimraf=require(_0x6253('0x1'));var zipdir=require(_0x6253('0x2'));var jsonpatch=require(_0x6253('0x3'));var rp=require(_0x6253('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x6253('0x5'));var util=require('util');var path=require(_0x6253('0x6'));var sox=require('sox');var csv=require(_0x6253('0x7'));var ejs=require(_0x6253('0x8'));var fs=require('fs');var fs_extra=require(_0x6253('0x9'));var _=require(_0x6253('0xa'));var squel=require(_0x6253('0xb'));var crypto=require('crypto');var jsforce=require(_0x6253('0xc'));var deskjs=require(_0x6253('0xd'));var toCsv=require(_0x6253('0x7'));var querystring=require(_0x6253('0xe'));var Papa=require(_0x6253('0xf'));var Redis=require(_0x6253('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x6253('0x11'));var as=require(_0x6253('0x12'));var hardwareService=require(_0x6253('0x13'));var logger=require(_0x6253('0x14'))(_0x6253('0x15'));var utils=require(_0x6253('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x6253('0x17'));var db=require(_0x6253('0x18'))['db'];function respondWithStatusCode(_0x2a9436,_0x1ad3f4){_0x1ad3f4=_0x1ad3f4||0xcc;return function(_0x3bac46){if(_0x3bac46){return _0x2a9436[_0x6253('0x19')](_0x1ad3f4);}return _0x2a9436['status'](_0x1ad3f4)['end']();};}function respondWithResult(_0xb96ad7,_0xd1b748){_0xd1b748=_0xd1b748||0xc8;return function(_0x447dc4){if(_0x447dc4){return _0xb96ad7[_0x6253('0x1a')](_0xd1b748)[_0x6253('0x1b')](_0x447dc4);}};}function respondWithFilteredResult(_0x1c1b17,_0x2d8bf7){return function(_0x16c0d5){if(_0x16c0d5){var _0x560b61=typeof _0x2d8bf7['offset']===_0x6253('0x1c')&&typeof _0x2d8bf7[_0x6253('0x1d')]===_0x6253('0x1c');var _0x399879=_0x16c0d5[_0x6253('0x1e')];var _0x332b9e=_0x560b61?0x0:_0x2d8bf7[_0x6253('0x1f')];var _0x4b7cad=_0x560b61?_0x16c0d5['count']:_0x2d8bf7['offset']+_0x2d8bf7[_0x6253('0x1d')];var _0x7247ee;if(_0x4b7cad>=_0x399879){_0x4b7cad=_0x399879;_0x7247ee=0xc8;}else{_0x7247ee=0xce;}_0x1c1b17[_0x6253('0x1a')](_0x7247ee);return _0x1c1b17[_0x6253('0x20')](_0x6253('0x21'),_0x332b9e+'-'+_0x4b7cad+'/'+_0x399879)['json'](_0x16c0d5);}return null;};}function patchUpdates(_0x41250c){return function(_0x1ea4ea){try{jsonpatch[_0x6253('0x22')](_0x1ea4ea,_0x41250c,!![]);}catch(_0xeab219){return BPromise['reject'](_0xeab219);}return _0x1ea4ea[_0x6253('0x23')]();};}function saveUpdates(_0x4da853,_0x50687c){return function(_0x33621e){if(_0x33621e){return _0x33621e[_0x6253('0x24')](_0x4da853)[_0x6253('0x25')](function(_0x207298){return _0x207298;});}return null;};}function removeEntity(_0x6dccf2,_0x465a03){return function(_0x2687ff){if(_0x2687ff){return _0x2687ff['destroy']()[_0x6253('0x25')](function(){_0x6dccf2[_0x6253('0x1a')](0xcc)[_0x6253('0x26')]();});}};}function handleEntityNotFound(_0x275168,_0x3f5f11){return function(_0x41c853){if(!_0x41c853){_0x275168[_0x6253('0x19')](0x194);}return _0x41c853;};}function handleError(_0x57f666,_0xd6ad68){_0xd6ad68=_0xd6ad68||0x1f4;return function(_0x3e36e6){logger[_0x6253('0x27')](_0x3e36e6[_0x6253('0x28')]);if(_0x3e36e6[_0x6253('0x29')]){delete _0x3e36e6[_0x6253('0x29')];}_0x57f666[_0x6253('0x1a')](_0xd6ad68)[_0x6253('0x2a')](_0x3e36e6);};}exports[_0x6253('0x2b')]=function(_0x3763cd,_0x1107b9){var _0x4bfb59={},_0x580e30={},_0x2cd8d8={'count':0x0,'rows':[]};var _0x42e42a=_[_0x6253('0x2c')](db[_0x6253('0x2d')][_0x6253('0x2e')],function(_0x129253){return{'name':_0x129253[_0x6253('0x2f')],'type':_0x129253[_0x6253('0x30')]['key']};});_0x580e30[_0x6253('0x31')]=_[_0x6253('0x2c')](_0x42e42a,_0x6253('0x29'));_0x580e30[_0x6253('0x32')]=_[_0x6253('0x33')](_0x3763cd[_0x6253('0x32')]);_0x580e30[_0x6253('0x34')]=_['intersection'](_0x580e30[_0x6253('0x31')],_0x580e30[_0x6253('0x32')]);_0x4bfb59[_0x6253('0x35')]=_[_0x6253('0x36')](_0x580e30[_0x6253('0x31')],qs[_0x6253('0x37')](_0x3763cd[_0x6253('0x32')]['fields']));_0x4bfb59[_0x6253('0x35')]=_0x4bfb59[_0x6253('0x35')][_0x6253('0x38')]?_0x4bfb59[_0x6253('0x35')]:_0x580e30[_0x6253('0x31')];if(!_0x3763cd[_0x6253('0x32')]['hasOwnProperty'](_0x6253('0x39'))){_0x4bfb59[_0x6253('0x1d')]=qs[_0x6253('0x1d')](_0x3763cd[_0x6253('0x32')][_0x6253('0x1d')]);_0x4bfb59[_0x6253('0x1f')]=qs[_0x6253('0x1f')](_0x3763cd['query']['offset']);}_0x4bfb59[_0x6253('0x3a')]=qs['sort'](_0x3763cd[_0x6253('0x32')][_0x6253('0x3b')]);_0x4bfb59['where']=qs[_0x6253('0x34')](_['pick'](_0x3763cd[_0x6253('0x32')],_0x580e30['filters']),_0x42e42a);if(_0x3763cd[_0x6253('0x32')][_0x6253('0x3c')]){_0x4bfb59[_0x6253('0x3d')]=_[_0x6253('0x3e')](_0x4bfb59[_0x6253('0x3d')],{'$or':_[_0x6253('0x2c')](_0x42e42a,function(_0x491924){if(_0x491924[_0x6253('0x30')]!==_0x6253('0x3f')){var _0x445c74={};_0x445c74[_0x491924[_0x6253('0x29')]]={'$like':'%'+_0x3763cd['query'][_0x6253('0x3c')]+'%'};return _0x445c74;}})});}_0x4bfb59=_[_0x6253('0x3e')]({},_0x4bfb59,_0x3763cd[_0x6253('0x40')]);var _0x2991c3={'where':_0x4bfb59[_0x6253('0x3d')]};return db[_0x6253('0x2d')][_0x6253('0x1e')](_0x2991c3)[_0x6253('0x25')](function(_0x2e7edd){_0x2cd8d8[_0x6253('0x1e')]=_0x2e7edd;if(_0x3763cd[_0x6253('0x32')]['includeAll']){_0x4bfb59[_0x6253('0x41')]=[{'all':!![]}];}return db[_0x6253('0x2d')][_0x6253('0x42')](_0x4bfb59);})['then'](function(_0x5dfadf){_0x2cd8d8[_0x6253('0x43')]=_0x5dfadf;return _0x2cd8d8;})[_0x6253('0x25')](respondWithFilteredResult(_0x1107b9,_0x4bfb59))[_0x6253('0x44')](handleError(_0x1107b9,null));};exports[_0x6253('0x45')]=function(_0x509c0f,_0x46c85d){var _0x4e8dd7={'raw':!![],'where':{'id':_0x509c0f[_0x6253('0x46')]['id']}},_0x2e75c4={};_0x2e75c4[_0x6253('0x31')]=_[_0x6253('0x33')](db[_0x6253('0x2d')][_0x6253('0x2e')]);_0x2e75c4[_0x6253('0x32')]=_[_0x6253('0x33')](_0x509c0f[_0x6253('0x32')]);_0x2e75c4[_0x6253('0x34')]=_[_0x6253('0x36')](_0x2e75c4[_0x6253('0x31')],_0x2e75c4[_0x6253('0x32')]);_0x4e8dd7[_0x6253('0x35')]=_[_0x6253('0x36')](_0x2e75c4[_0x6253('0x31')],qs[_0x6253('0x37')](_0x509c0f[_0x6253('0x32')][_0x6253('0x37')]));_0x4e8dd7[_0x6253('0x35')]=_0x4e8dd7[_0x6253('0x35')]['length']?_0x4e8dd7[_0x6253('0x35')]:_0x2e75c4[_0x6253('0x31')];if(_0x509c0f[_0x6253('0x32')][_0x6253('0x47')]){_0x4e8dd7['include']=[{'all':!![]}];}_0x4e8dd7=_[_0x6253('0x3e')]({},_0x4e8dd7,_0x509c0f[_0x6253('0x40')]);return db[_0x6253('0x2d')]['find'](_0x4e8dd7)['then'](handleEntityNotFound(_0x46c85d,null))[_0x6253('0x25')](respondWithResult(_0x46c85d,null))[_0x6253('0x44')](handleError(_0x46c85d,null));};exports[_0x6253('0x48')]=function(_0x5caba8,_0x27f20e){return db[_0x6253('0x2d')][_0x6253('0x48')](_0x5caba8[_0x6253('0x49')],{})[_0x6253('0x25')](respondWithResult(_0x27f20e,0xc9))[_0x6253('0x44')](handleError(_0x27f20e,null));};exports[_0x6253('0x24')]=function(_0xc15f53,_0x1b6332){if(_0xc15f53[_0x6253('0x49')]['id']){delete _0xc15f53['body']['id'];}return db[_0x6253('0x2d')]['find']({'where':{'id':_0xc15f53['params']['id']}})[_0x6253('0x25')](handleEntityNotFound(_0x1b6332,null))[_0x6253('0x25')](saveUpdates(_0xc15f53['body'],null))[_0x6253('0x25')](respondWithResult(_0x1b6332,null))['catch'](handleError(_0x1b6332,null));};exports[_0x6253('0x4a')]=function(_0x2e6d3a,_0x18a5dd){return db[_0x6253('0x2d')][_0x6253('0x4b')]({'where':{'id':_0x2e6d3a[_0x6253('0x46')]['id']}})['then'](handleEntityNotFound(_0x18a5dd,null))['then'](removeEntity(_0x18a5dd,null))['catch'](handleError(_0x18a5dd,null));};exports['describe']=function(_0x401967,_0x2ce2e6){return db[_0x6253('0x2d')]['describe']()[_0x6253('0x25')](respondWithResult(_0x2ce2e6,null))['catch'](handleError(_0x2ce2e6,null));};exports['getQuestions']=function(_0x5a2267,_0x237816,_0x4f75c2){var _0x3c1c71={'raw':!![],'where':{}};var _0x3ae9e1={};var _0x29a338={'count':0x0,'rows':[]};return db[_0x6253('0x2d')][_0x6253('0x4c')]({'where':{'id':_0x5a2267[_0x6253('0x46')]['id']}})['then'](handleEntityNotFound(_0x237816,null))[_0x6253('0x25')](function(_0x4d3a2a){if(_0x4d3a2a){_0x3ae9e1[_0x6253('0x31')]=_[_0x6253('0x33')](db[_0x6253('0x4d')][_0x6253('0x2e')]);_0x3ae9e1[_0x6253('0x32')]=_[_0x6253('0x33')](_0x5a2267['query']);_0x3ae9e1['filters']=_[_0x6253('0x36')](_0x3ae9e1[_0x6253('0x31')],_0x3ae9e1['query']);_0x3c1c71['attributes']=_[_0x6253('0x36')](_0x3ae9e1[_0x6253('0x31')],qs[_0x6253('0x37')](_0x5a2267[_0x6253('0x32')]['fields']));_0x3c1c71[_0x6253('0x35')]=_0x3c1c71[_0x6253('0x35')][_0x6253('0x38')]?_0x3c1c71[_0x6253('0x35')]:_0x3ae9e1[_0x6253('0x31')];if(!_0x5a2267[_0x6253('0x32')][_0x6253('0x4e')](_0x6253('0x39'))){_0x3c1c71[_0x6253('0x1d')]=qs[_0x6253('0x1d')](_0x5a2267[_0x6253('0x32')][_0x6253('0x1d')]);_0x3c1c71[_0x6253('0x1f')]=qs[_0x6253('0x1f')](_0x5a2267['query']['offset']);}_0x3c1c71['order']=qs[_0x6253('0x3b')](_0x5a2267['query'][_0x6253('0x3b')]);_0x3c1c71[_0x6253('0x3d')]=qs[_0x6253('0x34')](_[_0x6253('0x4f')](_0x5a2267[_0x6253('0x32')],_0x3ae9e1['filters']));_0x3c1c71[_0x6253('0x3d')]['SessionId']=_0x4d3a2a['id'];if(_0x5a2267[_0x6253('0x32')][_0x6253('0x3c')]){_0x3c1c71[_0x6253('0x3d')]=_['merge'](_0x3c1c71[_0x6253('0x3d')],{'$or':_['map'](_0x3c1c71[_0x6253('0x35')],function(_0x801b6b){var _0x47af18={};_0x47af18[_0x801b6b]={'$like':'%'+_0x5a2267[_0x6253('0x32')][_0x6253('0x3c')]+'%'};return _0x47af18;})});}_0x3c1c71=_['merge']({},_0x3c1c71,_0x5a2267['options']);return db['JscriptyQuestionReport'][_0x6253('0x1e')]({'where':_0x3c1c71[_0x6253('0x3d')]})['then'](function(_0x2fe56b){_0x29a338[_0x6253('0x1e')]=_0x2fe56b;if(_0x5a2267[_0x6253('0x32')][_0x6253('0x47')]){_0x3c1c71[_0x6253('0x41')]=[{'all':!![]}];}return db[_0x6253('0x4d')][_0x6253('0x42')](_0x3c1c71);})[_0x6253('0x25')](function(_0xb8125d){_0x29a338[_0x6253('0x43')]=_0xb8125d;return _0x29a338;});}})[_0x6253('0x25')](respondWithFilteredResult(_0x237816,_0x3c1c71))[_0x6253('0x44')](handleError(_0x237816,null));}; \ No newline at end of file +var _0x6b71=['set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','JscriptySessionReport','rawAttributes','fieldName','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filter','type','merge','includeAll','findAll','catch','include','options','find','create','body','params','describe','getQuestions','findOne','JscriptyQuestionReport','order','pick','SessionId','rows','rimraf','zip-dir','fast-json-patch','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','offset','count'];(function(_0x3895bc,_0x47d35d){var _0xc4ba5b=function(_0x5aa16a){while(--_0x5aa16a){_0x3895bc['push'](_0x3895bc['shift']());}};_0xc4ba5b(++_0x47d35d);}(_0x6b71,0xc7));var _0x16b7=function(_0x1ade10,_0x1c8f0d){_0x1ade10=_0x1ade10-0x0;var _0x432d4d=_0x6b71[_0x1ade10];return _0x432d4d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x16b7('0x0'));var zipdir=require(_0x16b7('0x1'));var jsonpatch=require(_0x16b7('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x16b7('0x3'));var sox=require('sox');var csv=require(_0x16b7('0x4'));var ejs=require(_0x16b7('0x5'));var fs=require('fs');var fs_extra=require(_0x16b7('0x6'));var _=require(_0x16b7('0x7'));var squel=require(_0x16b7('0x8'));var crypto=require('crypto');var jsforce=require(_0x16b7('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x16b7('0x4'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x16b7('0xa'));var authService=require(_0x16b7('0xb'));var qs=require(_0x16b7('0xc'));var as=require(_0x16b7('0xd'));var hardwareService=require(_0x16b7('0xe'));var logger=require('../../config/logger')(_0x16b7('0xf'));var utils=require('../../config/utils');var config=require(_0x16b7('0x10'));var licenseUtil=require(_0x16b7('0x11'));var db=require(_0x16b7('0x12'))['db'];function respondWithStatusCode(_0x1364b7,_0x481fc8){_0x481fc8=_0x481fc8||0xcc;return function(_0x508d3c){if(_0x508d3c){return _0x1364b7['sendStatus'](_0x481fc8);}return _0x1364b7[_0x16b7('0x13')](_0x481fc8)[_0x16b7('0x14')]();};}function respondWithResult(_0x163490,_0x1aa099){_0x1aa099=_0x1aa099||0xc8;return function(_0xccd895){if(_0xccd895){return _0x163490[_0x16b7('0x13')](_0x1aa099)[_0x16b7('0x15')](_0xccd895);}};}function respondWithFilteredResult(_0xb2d431,_0x36ac03){return function(_0x2874e2){if(_0x2874e2){var _0x30d24e=typeof _0x36ac03['offset']===_0x16b7('0x16')&&typeof _0x36ac03[_0x16b7('0x17')]===_0x16b7('0x16');var _0x303f0d=_0x2874e2['count'];var _0x58ea30=_0x30d24e?0x0:_0x36ac03[_0x16b7('0x18')];var _0x320bc8=_0x30d24e?_0x2874e2[_0x16b7('0x19')]:_0x36ac03[_0x16b7('0x18')]+_0x36ac03[_0x16b7('0x17')];var _0x3e2dfd;if(_0x320bc8>=_0x303f0d){_0x320bc8=_0x303f0d;_0x3e2dfd=0xc8;}else{_0x3e2dfd=0xce;}_0xb2d431[_0x16b7('0x13')](_0x3e2dfd);return _0xb2d431[_0x16b7('0x1a')](_0x16b7('0x1b'),_0x58ea30+'-'+_0x320bc8+'/'+_0x303f0d)['json'](_0x2874e2);}return null;};}function patchUpdates(_0x5c8ef6){return function(_0x5cb581){try{jsonpatch[_0x16b7('0x1c')](_0x5cb581,_0x5c8ef6,!![]);}catch(_0x5637fe){return BPromise[_0x16b7('0x1d')](_0x5637fe);}return _0x5cb581[_0x16b7('0x1e')]();};}function saveUpdates(_0x12c398,_0x305b97){return function(_0x4f1278){if(_0x4f1278){return _0x4f1278[_0x16b7('0x1f')](_0x12c398)[_0x16b7('0x20')](function(_0x55454c){return _0x55454c;});}return null;};}function removeEntity(_0x3c1046,_0x57236e){return function(_0x490ab9){if(_0x490ab9){return _0x490ab9[_0x16b7('0x21')]()[_0x16b7('0x20')](function(){_0x3c1046[_0x16b7('0x13')](0xcc)[_0x16b7('0x14')]();});}};}function handleEntityNotFound(_0xccb4e0,_0x30ff36){return function(_0x5aefd6){if(!_0x5aefd6){_0xccb4e0['sendStatus'](0x194);}return _0x5aefd6;};}function handleError(_0x8021e9,_0x17f27e){_0x17f27e=_0x17f27e||0x1f4;return function(_0x4e5b2f){logger[_0x16b7('0x22')](_0x4e5b2f['stack']);if(_0x4e5b2f[_0x16b7('0x23')]){delete _0x4e5b2f[_0x16b7('0x23')];}_0x8021e9[_0x16b7('0x13')](_0x17f27e)[_0x16b7('0x24')](_0x4e5b2f);};}exports[_0x16b7('0x25')]=function(_0x12d806,_0x560935){var _0x3046a2={},_0x23afc0={},_0x4f30f2={'count':0x0,'rows':[]};var _0x579e10=_['map'](db[_0x16b7('0x26')][_0x16b7('0x27')],function(_0x28cbc7){return{'name':_0x28cbc7[_0x16b7('0x28')],'type':_0x28cbc7['type'][_0x16b7('0x29')]};});_0x23afc0[_0x16b7('0x2a')]=_[_0x16b7('0x2b')](_0x579e10,'name');_0x23afc0[_0x16b7('0x2c')]=_[_0x16b7('0x2d')](_0x12d806[_0x16b7('0x2c')]);_0x23afc0[_0x16b7('0x2e')]=_['intersection'](_0x23afc0[_0x16b7('0x2a')],_0x23afc0[_0x16b7('0x2c')]);_0x3046a2[_0x16b7('0x2f')]=_[_0x16b7('0x30')](_0x23afc0[_0x16b7('0x2a')],qs['fields'](_0x12d806['query'][_0x16b7('0x31')]));_0x3046a2['attributes']=_0x3046a2[_0x16b7('0x2f')][_0x16b7('0x32')]?_0x3046a2[_0x16b7('0x2f')]:_0x23afc0[_0x16b7('0x2a')];if(!_0x12d806[_0x16b7('0x2c')][_0x16b7('0x33')](_0x16b7('0x34'))){_0x3046a2[_0x16b7('0x17')]=qs[_0x16b7('0x17')](_0x12d806[_0x16b7('0x2c')][_0x16b7('0x17')]);_0x3046a2['offset']=qs[_0x16b7('0x18')](_0x12d806[_0x16b7('0x2c')][_0x16b7('0x18')]);}_0x3046a2['order']=qs[_0x16b7('0x35')](_0x12d806['query'][_0x16b7('0x35')]);_0x3046a2[_0x16b7('0x36')]=qs[_0x16b7('0x2e')](_['pick'](_0x12d806[_0x16b7('0x2c')],_0x23afc0['filters']),_0x579e10);if(_0x12d806['query'][_0x16b7('0x37')]){_0x3046a2[_0x16b7('0x36')]=_['merge'](_0x3046a2[_0x16b7('0x36')],{'$or':_[_0x16b7('0x2b')](_0x579e10,function(_0x489b84){if(_0x489b84[_0x16b7('0x38')]!=='VIRTUAL'){var _0x2cd7ae={};_0x2cd7ae[_0x489b84[_0x16b7('0x23')]]={'$like':'%'+_0x12d806[_0x16b7('0x2c')][_0x16b7('0x37')]+'%'};return _0x2cd7ae;}})});}_0x3046a2=_[_0x16b7('0x39')]({},_0x3046a2,_0x12d806['options']);var _0x208668={'where':_0x3046a2[_0x16b7('0x36')]};return db[_0x16b7('0x26')][_0x16b7('0x19')](_0x208668)[_0x16b7('0x20')](function(_0x3f38dd){_0x4f30f2[_0x16b7('0x19')]=_0x3f38dd;if(_0x12d806['query'][_0x16b7('0x3a')]){_0x3046a2['include']=[{'all':!![]}];}return db[_0x16b7('0x26')][_0x16b7('0x3b')](_0x3046a2);})['then'](function(_0x5d6dfa){_0x4f30f2['rows']=_0x5d6dfa;return _0x4f30f2;})[_0x16b7('0x20')](respondWithFilteredResult(_0x560935,_0x3046a2))[_0x16b7('0x3c')](handleError(_0x560935,null));};exports['show']=function(_0x1cdb5d,_0x1d5310){var _0xa03a31={'raw':!![],'where':{'id':_0x1cdb5d['params']['id']}},_0xeba1dd={};_0xeba1dd[_0x16b7('0x2a')]=_[_0x16b7('0x2d')](db[_0x16b7('0x26')][_0x16b7('0x27')]);_0xeba1dd[_0x16b7('0x2c')]=_[_0x16b7('0x2d')](_0x1cdb5d[_0x16b7('0x2c')]);_0xeba1dd[_0x16b7('0x2e')]=_['intersection'](_0xeba1dd[_0x16b7('0x2a')],_0xeba1dd[_0x16b7('0x2c')]);_0xa03a31[_0x16b7('0x2f')]=_['intersection'](_0xeba1dd[_0x16b7('0x2a')],qs['fields'](_0x1cdb5d[_0x16b7('0x2c')][_0x16b7('0x31')]));_0xa03a31['attributes']=_0xa03a31[_0x16b7('0x2f')][_0x16b7('0x32')]?_0xa03a31['attributes']:_0xeba1dd[_0x16b7('0x2a')];if(_0x1cdb5d['query'][_0x16b7('0x3a')]){_0xa03a31[_0x16b7('0x3d')]=[{'all':!![]}];}_0xa03a31=_[_0x16b7('0x39')]({},_0xa03a31,_0x1cdb5d[_0x16b7('0x3e')]);return db[_0x16b7('0x26')][_0x16b7('0x3f')](_0xa03a31)[_0x16b7('0x20')](handleEntityNotFound(_0x1d5310,null))['then'](respondWithResult(_0x1d5310,null))[_0x16b7('0x3c')](handleError(_0x1d5310,null));};exports['create']=function(_0x502be5,_0x35d82a){return db[_0x16b7('0x26')][_0x16b7('0x40')](_0x502be5[_0x16b7('0x41')],{})[_0x16b7('0x20')](respondWithResult(_0x35d82a,0xc9))[_0x16b7('0x3c')](handleError(_0x35d82a,null));};exports[_0x16b7('0x1f')]=function(_0x34599f,_0x1b83ee){if(_0x34599f['body']['id']){delete _0x34599f[_0x16b7('0x41')]['id'];}return db[_0x16b7('0x26')][_0x16b7('0x3f')]({'where':{'id':_0x34599f[_0x16b7('0x42')]['id']}})[_0x16b7('0x20')](handleEntityNotFound(_0x1b83ee,null))[_0x16b7('0x20')](saveUpdates(_0x34599f[_0x16b7('0x41')],null))[_0x16b7('0x20')](respondWithResult(_0x1b83ee,null))[_0x16b7('0x3c')](handleError(_0x1b83ee,null));};exports[_0x16b7('0x21')]=function(_0x5b6295,_0x4a6e67){return db[_0x16b7('0x26')][_0x16b7('0x3f')]({'where':{'id':_0x5b6295[_0x16b7('0x42')]['id']}})['then'](handleEntityNotFound(_0x4a6e67,null))[_0x16b7('0x20')](removeEntity(_0x4a6e67,null))[_0x16b7('0x3c')](handleError(_0x4a6e67,null));};exports[_0x16b7('0x43')]=function(_0x480173,_0x4d9da9){return db['JscriptySessionReport'][_0x16b7('0x43')]()[_0x16b7('0x20')](respondWithResult(_0x4d9da9,null))[_0x16b7('0x3c')](handleError(_0x4d9da9,null));};exports[_0x16b7('0x44')]=function(_0x4d9d29,_0x199260,_0x4181be){var _0x2a4bb2={'raw':!![],'where':{}};var _0x4aac19={};var _0x12ddc7={'count':0x0,'rows':[]};return db['JscriptySessionReport'][_0x16b7('0x45')]({'where':{'id':_0x4d9d29[_0x16b7('0x42')]['id']}})[_0x16b7('0x20')](handleEntityNotFound(_0x199260,null))['then'](function(_0xc32754){if(_0xc32754){_0x4aac19[_0x16b7('0x2a')]=_['keys'](db[_0x16b7('0x46')]['rawAttributes']);_0x4aac19[_0x16b7('0x2c')]=_[_0x16b7('0x2d')](_0x4d9d29[_0x16b7('0x2c')]);_0x4aac19[_0x16b7('0x2e')]=_[_0x16b7('0x30')](_0x4aac19[_0x16b7('0x2a')],_0x4aac19[_0x16b7('0x2c')]);_0x2a4bb2['attributes']=_[_0x16b7('0x30')](_0x4aac19['model'],qs[_0x16b7('0x31')](_0x4d9d29[_0x16b7('0x2c')][_0x16b7('0x31')]));_0x2a4bb2[_0x16b7('0x2f')]=_0x2a4bb2[_0x16b7('0x2f')]['length']?_0x2a4bb2[_0x16b7('0x2f')]:_0x4aac19[_0x16b7('0x2a')];if(!_0x4d9d29[_0x16b7('0x2c')][_0x16b7('0x33')]('nolimit')){_0x2a4bb2[_0x16b7('0x17')]=qs[_0x16b7('0x17')](_0x4d9d29[_0x16b7('0x2c')][_0x16b7('0x17')]);_0x2a4bb2[_0x16b7('0x18')]=qs['offset'](_0x4d9d29[_0x16b7('0x2c')][_0x16b7('0x18')]);}_0x2a4bb2[_0x16b7('0x47')]=qs[_0x16b7('0x35')](_0x4d9d29[_0x16b7('0x2c')]['sort']);_0x2a4bb2[_0x16b7('0x36')]=qs[_0x16b7('0x2e')](_[_0x16b7('0x48')](_0x4d9d29[_0x16b7('0x2c')],_0x4aac19[_0x16b7('0x2e')]));_0x2a4bb2[_0x16b7('0x36')][_0x16b7('0x49')]=_0xc32754['id'];if(_0x4d9d29[_0x16b7('0x2c')]['filter']){_0x2a4bb2[_0x16b7('0x36')]=_[_0x16b7('0x39')](_0x2a4bb2['where'],{'$or':_['map'](_0x2a4bb2['attributes'],function(_0x27e898){var _0x4797f6={};_0x4797f6[_0x27e898]={'$like':'%'+_0x4d9d29[_0x16b7('0x2c')][_0x16b7('0x37')]+'%'};return _0x4797f6;})});}_0x2a4bb2=_['merge']({},_0x2a4bb2,_0x4d9d29['options']);return db['JscriptyQuestionReport'][_0x16b7('0x19')]({'where':_0x2a4bb2[_0x16b7('0x36')]})['then'](function(_0x5db62d){_0x12ddc7[_0x16b7('0x19')]=_0x5db62d;if(_0x4d9d29[_0x16b7('0x2c')][_0x16b7('0x3a')]){_0x2a4bb2[_0x16b7('0x3d')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x16b7('0x3b')](_0x2a4bb2);})[_0x16b7('0x20')](function(_0x40f03a){_0x12ddc7[_0x16b7('0x4a')]=_0x40f03a;return _0x12ddc7;});}})[_0x16b7('0x20')](respondWithFilteredResult(_0x199260,_0x2a4bb2))['catch'](handleError(_0x199260,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index acd2da2..2975f79 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 _0x84e7=['./jscriptySessionReport.attributes','exports','define','report_jscripty_sessions','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment'];(function(_0xb833b1,_0x1c3d3f){var _0x1ab87a=function(_0x1c9f6c){while(--_0x1c9f6c){_0xb833b1['push'](_0xb833b1['shift']());}};_0x1ab87a(++_0x1c3d3f);}(_0x84e7,0x122));var _0x784e=function(_0x5f5d03,_0x4b88db){_0x5f5d03=_0x5f5d03-0x0;var _0x5c94fc=_0x84e7[_0x5f5d03];return _0x5c94fc;};'use strict';var _=require('lodash');var util=require(_0x784e('0x0'));var logger=require(_0x784e('0x1'))('api');var moment=require(_0x784e('0x2'));var BPromise=require(_0x784e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x784e('0x4'));var rimraf=require(_0x784e('0x5'));var config=require(_0x784e('0x6'));var attributes=require(_0x784e('0x7'));module[_0x784e('0x8')]=function(_0x133296,_0x48ed22){return _0x133296[_0x784e('0x9')]('JscriptySessionReport',attributes,{'tableName':_0x784e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfcf0=['lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport'];(function(_0x472173,_0x140ece){var _0x5abc10=function(_0x248388){while(--_0x248388){_0x472173['push'](_0x472173['shift']());}};_0x5abc10(++_0x140ece);}(_0xfcf0,0x138));var _0x0fcf=function(_0x155c64,_0x26ff95){_0x155c64=_0x155c64-0x0;var _0x1f154a=_0xfcf0[_0x155c64];return _0x1f154a;};'use strict';var _=require(_0x0fcf('0x0'));var util=require(_0x0fcf('0x1'));var logger=require('../../config/logger')(_0x0fcf('0x2'));var moment=require(_0x0fcf('0x3'));var BPromise=require(_0x0fcf('0x4'));var rp=require(_0x0fcf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0fcf('0x6'));var config=require(_0x0fcf('0x7'));var attributes=require(_0x0fcf('0x8'));module[_0x0fcf('0x9')]=function(_0x1bace8,_0x1a7b03){return _0x1bace8[_0x0fcf('0xa')](_0x0fcf('0xb'),attributes,{'tableName':'report_jscripty_sessions','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 9ea60dd..cbd3060 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 _0x1893=['../../config/logger','../../config/environment','jayson/promise','client','http','request','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x10d34b,_0x4fef76){var _0x92b0bf=function(_0x16e291){while(--_0x16e291){_0x10d34b['push'](_0x10d34b['shift']());}};_0x92b0bf(++_0x4fef76);}(_0x1893,0xa2));var _0x3189=function(_0x34c553,_0x3e7dfc){_0x34c553=_0x34c553-0x0;var _0x1357d2=_0x1893[_0x34c553];return _0x1357d2;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3189('0x0'));var BPromise=require(_0x3189('0x1'));var rs=require(_0x3189('0x2'));var fs=require('fs');var Redis=require(_0x3189('0x3'));var db=require(_0x3189('0x4'))['db'];var utils=require(_0x3189('0x5'));var logger=require(_0x3189('0x6'))('rpc');var config=require(_0x3189('0x7'));var jayson=require(_0x3189('0x8'));var client=jayson[_0x3189('0x9')][_0x3189('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x77c566,_0x118970,_0x14d84b){return new BPromise(function(_0x1f6764,_0x5312a3){return client[_0x3189('0xb')](_0x77c566,_0x14d84b)['then'](function(_0x127449){logger['info'](_0x3189('0xc'),_0x118970,_0x3189('0xd'));logger[_0x3189('0xe')](_0x3189('0xf'),_0x118970,'request\x20sent',JSON[_0x3189('0x10')](_0x127449));if(_0x127449[_0x3189('0x11')]){if(_0x127449[_0x3189('0x11')][_0x3189('0x12')]===0x1f4){logger[_0x3189('0x11')]('JscriptySessionReport,\x20%s,\x20%s',_0x118970,_0x127449[_0x3189('0x11')][_0x3189('0x13')]);return _0x5312a3(_0x127449[_0x3189('0x11')][_0x3189('0x13')]);}logger[_0x3189('0x11')](_0x3189('0xc'),_0x118970,_0x127449[_0x3189('0x11')][_0x3189('0x13')]);return _0x1f6764(_0x127449['error'][_0x3189('0x13')]);}else{logger[_0x3189('0x14')](_0x3189('0xc'),_0x118970,_0x3189('0xd'));_0x1f6764(_0x127449['result'][_0x3189('0x13')]);}})['catch'](function(_0x55f432){logger[_0x3189('0x11')]('JscriptySessionReport,\x20%s,\x20%s',_0x118970,_0x55f432);_0x5312a3(_0x55f432);});});} \ No newline at end of file +var _0x57ca=['client','http','request','info','request\x20sent','JscriptySessionReport,\x20%s,\x20%s,\x20%s','error','code','JscriptySessionReport,\x20%s,\x20%s','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x54dcc,_0x1abab9){var _0x4fd3c7=function(_0x1bbfa6){while(--_0x1bbfa6){_0x54dcc['push'](_0x54dcc['shift']());}};_0x4fd3c7(++_0x1abab9);}(_0x57ca,0x108));var _0xa57c=function(_0xda90c,_0x1b67e0){_0xda90c=_0xda90c-0x0;var _0xedbd19=_0x57ca[_0xda90c];return _0xedbd19;};'use strict';var _=require('lodash');var util=require(_0xa57c('0x0'));var moment=require(_0xa57c('0x1'));var BPromise=require('bluebird');var rs=require(_0xa57c('0x2'));var fs=require('fs');var Redis=require(_0xa57c('0x3'));var db=require(_0xa57c('0x4'))['db'];var utils=require(_0xa57c('0x5'));var logger=require(_0xa57c('0x6'))('rpc');var config=require(_0xa57c('0x7'));var jayson=require(_0xa57c('0x8'));var client=jayson[_0xa57c('0x9')][_0xa57c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xbdfffb,_0x314574,_0x19e28e){return new BPromise(function(_0x271ccc,_0x5e3962){return client[_0xa57c('0xb')](_0xbdfffb,_0x19e28e)['then'](function(_0x46ba92){logger[_0xa57c('0xc')]('JscriptySessionReport,\x20%s,\x20%s',_0x314574,_0xa57c('0xd'));logger['debug'](_0xa57c('0xe'),_0x314574,_0xa57c('0xd'),JSON['stringify'](_0x46ba92));if(_0x46ba92[_0xa57c('0xf')]){if(_0x46ba92['error'][_0xa57c('0x10')]===0x1f4){logger[_0xa57c('0xf')](_0xa57c('0x11'),_0x314574,_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);return _0x5e3962(_0x46ba92['error'][_0xa57c('0x12')]);}logger['error'](_0xa57c('0x11'),_0x314574,_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);return _0x271ccc(_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);}else{logger[_0xa57c('0xc')](_0xa57c('0x11'),_0x314574,'request\x20sent');_0x271ccc(_0x46ba92[_0xa57c('0x13')][_0xa57c('0x12')]);}})[_0xa57c('0x14')](function(_0x5a6024){logger[_0xa57c('0xf')]('JscriptySessionReport,\x20%s,\x20%s',_0x314574,_0x5a6024);_0x5e3962(_0x5a6024);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 368bb70..ea52118 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 _0x1869=['express','Router','fs-extra','../../components/auth/service','../../config/environment','get','index','/:id','isAuthenticated','update','/download_log_file','downloadLogFile','exports','multer','path','connect-timeout'];(function(_0x43ce8a,_0x59b660){var _0x442bcf=function(_0x96a650){while(--_0x96a650){_0x43ce8a['push'](_0x43ce8a['shift']());}};_0x442bcf(++_0x59b660);}(_0x1869,0x9d));var _0x9186=function(_0xb68438,_0x21c2c0){_0xb68438=_0xb68438-0x0;var _0xbb3e85=_0x1869[_0xb68438];return _0xbb3e85;};'use strict';var multer=require(_0x9186('0x0'));var util=require('util');var path=require(_0x9186('0x1'));var timeout=require(_0x9186('0x2'));var express=require(_0x9186('0x3'));var router=express[_0x9186('0x4')]();var fs_extra=require(_0x9186('0x5'));var auth=require(_0x9186('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x9186('0x7'));var controller=require('./license.controller');router[_0x9186('0x8')]('/',controller[_0x9186('0x9')]);router['put'](_0x9186('0xa'),auth[_0x9186('0xb')](),controller[_0x9186('0xc')]);router[_0x9186('0x8')](_0x9186('0xd'),auth[_0x9186('0xb')](),controller[_0x9186('0xe')]);module[_0x9186('0xf')]=router; \ No newline at end of file +var _0x3b18=['/download_log_file','downloadLogFile','exports','util','connect-timeout','express','Router','fs-extra','../../config/environment','./license.controller','get','index','/:id','isAuthenticated','update'];(function(_0x17e9aa,_0x43c7ce){var _0x57e010=function(_0x1a8937){while(--_0x1a8937){_0x17e9aa['push'](_0x17e9aa['shift']());}};_0x57e010(++_0x43c7ce);}(_0x3b18,0xe4));var _0x83b1=function(_0xe74ea6,_0x461881){_0xe74ea6=_0xe74ea6-0x0;var _0x133ecd=_0x3b18[_0xe74ea6];return _0x133ecd;};'use strict';var multer=require('multer');var util=require(_0x83b1('0x0'));var path=require('path');var timeout=require(_0x83b1('0x1'));var express=require(_0x83b1('0x2'));var router=express[_0x83b1('0x3')]();var fs_extra=require(_0x83b1('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x83b1('0x5'));var controller=require(_0x83b1('0x6'));router[_0x83b1('0x7')]('/',controller[_0x83b1('0x8')]);router['put'](_0x83b1('0x9'),auth[_0x83b1('0xa')](),controller[_0x83b1('0xb')]);router[_0x83b1('0x7')](_0x83b1('0xc'),auth['isAuthenticated'](),controller[_0x83b1('0xd')]);module[_0x83b1('0xe')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 05e019a..57ac3bd 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 _0x7750=['exports','TEXT','STRING','INTEGER'];(function(_0x177dda,_0x3739af){var _0x2a5f5f=function(_0x264d17){while(--_0x264d17){_0x177dda['push'](_0x177dda['shift']());}};_0x2a5f5f(++_0x3739af);}(_0x7750,0x18c));var _0x0775=function(_0x233662,_0x359ad6){_0x233662=_0x233662-0x0;var _0x1e82db=_0x7750[_0x233662];return _0x1e82db;};'use strict';var Sequelize=require('sequelize');module[_0x0775('0x0')]={'license':{'type':Sequelize[_0x0775('0x1')]},'data1':{'type':Sequelize[_0x0775('0x2')]},'data2':{'type':Sequelize['STRING']},'chatLicenseExceeded':{'type':Sequelize[_0x0775('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x2470=['TEXT','STRING','INTEGER','sequelize'];(function(_0x2036b0,_0x4da04a){var _0x1a5fae=function(_0x3ea671){while(--_0x3ea671){_0x2036b0['push'](_0x2036b0['shift']());}};_0x1a5fae(++_0x4da04a);}(_0x2470,0x1e3));var _0x0247=function(_0xe161be,_0x5acf0c){_0xe161be=_0xe161be-0x0;var _0x470ecd=_0x2470[_0xe161be];return _0x470ecd;};'use strict';var Sequelize=require(_0x0247('0x0'));module['exports']={'license':{'type':Sequelize[_0x0247('0x1')]},'data1':{'type':Sequelize[_0x0247('0x2')]},'data2':{'type':Sequelize['STRING']},'chatLicenseExceeded':{'type':Sequelize[_0x0247('0x3')],'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 05c93a5..8cf195f 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 _0x81ef=['key','join','/var','log','xcally','setHeader','Content-disposition','Content-Type','download','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','save','update','then','destroy','error','stack','name','index','License','rawAttributes','query','keys','intersection','model','fields','attributes','length','merge','options','getLicense','catch','body','find','params'];(function(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0x81ef,0x109));var _0xf81e=function(_0x19f72b,_0x36b6f7){_0x19f72b=_0x19f72b-0x0;var _0x419910=_0x81ef[_0x19f72b];return _0x419910;};'use strict';var emlformat=require(_0xf81e('0x0'));var rimraf=require(_0xf81e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf81e('0x2'));var rp=require('request-promise');var moment=require(_0xf81e('0x3'));var BPromise=require(_0xf81e('0x4'));var Mustache=require('mustache');var util=require(_0xf81e('0x5'));var path=require(_0xf81e('0x6'));var sox=require(_0xf81e('0x7'));var csv=require(_0xf81e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf81e('0x9'));var squel=require(_0xf81e('0xa'));var crypto=require(_0xf81e('0xb'));var jsforce=require(_0xf81e('0xc'));var deskjs=require(_0xf81e('0xd'));var toCsv=require('to-csv');var querystring=require(_0xf81e('0xe'));var Papa=require(_0xf81e('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf81e('0x10'));var hardwareService=require(_0xf81e('0x11'));var logger=require(_0xf81e('0x12'))('api');var utils=require(_0xf81e('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xf81e('0x14'));var db=require(_0xf81e('0x15'))['db'];function respondWithStatusCode(_0x2cc273,_0x4b5729){_0x4b5729=_0x4b5729||0xcc;return function(_0xa1e43a){if(_0xa1e43a){return _0x2cc273[_0xf81e('0x16')](_0x4b5729);}return _0x2cc273[_0xf81e('0x17')](_0x4b5729)[_0xf81e('0x18')]();};}function respondWithResult(_0x8b5f6d,_0x59bf92){_0x59bf92=_0x59bf92||0xc8;return function(_0x4a7e6a){if(_0x4a7e6a){return _0x8b5f6d[_0xf81e('0x17')](_0x59bf92)[_0xf81e('0x19')](_0x4a7e6a);}};}function respondWithFilteredResult(_0xb542ce,_0x98dd2b){return function(_0x47db70){if(_0x47db70){var _0x23d1a0=typeof _0x98dd2b[_0xf81e('0x1a')]===_0xf81e('0x1b')&&typeof _0x98dd2b[_0xf81e('0x1c')]===_0xf81e('0x1b');var _0x2d1ad5=_0x47db70[_0xf81e('0x1d')];var _0x1ead55=_0x23d1a0?0x0:_0x98dd2b[_0xf81e('0x1a')];var _0x5d27c1=_0x23d1a0?_0x47db70[_0xf81e('0x1d')]:_0x98dd2b[_0xf81e('0x1a')]+_0x98dd2b[_0xf81e('0x1c')];var _0x283784;if(_0x5d27c1>=_0x2d1ad5){_0x5d27c1=_0x2d1ad5;_0x283784=0xc8;}else{_0x283784=0xce;}_0xb542ce[_0xf81e('0x17')](_0x283784);return _0xb542ce[_0xf81e('0x1e')]('Content-Range',_0x1ead55+'-'+_0x5d27c1+'/'+_0x2d1ad5)[_0xf81e('0x19')](_0x47db70);}return null;};}function patchUpdates(_0x571d1d){return function(_0x49a30c){try{jsonpatch['apply'](_0x49a30c,_0x571d1d,!![]);}catch(_0x5a2e76){return BPromise['reject'](_0x5a2e76);}return _0x49a30c[_0xf81e('0x1f')]();};}function saveUpdates(_0x2d0cc2,_0x215839){return function(_0x560668){if(_0x560668){return _0x560668[_0xf81e('0x20')](_0x2d0cc2)[_0xf81e('0x21')](function(_0x244451){return _0x244451;});}return null;};}function removeEntity(_0x32564a,_0x5998a0){return function(_0x305b98){if(_0x305b98){return _0x305b98[_0xf81e('0x22')]()[_0xf81e('0x21')](function(){_0x32564a['status'](0xcc)[_0xf81e('0x18')]();});}};}function handleEntityNotFound(_0x3f033c,_0x53d573){return function(_0x55de30){if(!_0x55de30){_0x3f033c['sendStatus'](0x194);}return _0x55de30;};}function handleError(_0x43a65e,_0xa83f54){_0xa83f54=_0xa83f54||0x1f4;return function(_0x3a60ab){logger[_0xf81e('0x23')](_0x3a60ab[_0xf81e('0x24')]);if(_0x3a60ab[_0xf81e('0x25')]){delete _0x3a60ab[_0xf81e('0x25')];}_0x43a65e[_0xf81e('0x17')](_0xa83f54)['send'](_0x3a60ab);};}var utilLicense=require(_0xf81e('0x14'));exports[_0xf81e('0x26')]=function(_0x173b97,_0x1fbc9){var _0x182a81={'raw':!![],'where':{'id':0x1}},_0x249ae0={};_0x249ae0['model']=_['keys'](db[_0xf81e('0x27')][_0xf81e('0x28')]);_0x249ae0[_0xf81e('0x29')]=_[_0xf81e('0x2a')](_0x173b97['query']);_0x249ae0['filters']=_[_0xf81e('0x2b')](_0x249ae0[_0xf81e('0x2c')],_0x249ae0[_0xf81e('0x29')]);_0x182a81['attributes']=_['intersection'](_0x249ae0['model'],qs[_0xf81e('0x2d')](_0x173b97['query']['fields']));_0x182a81[_0xf81e('0x2e')]=_0x182a81[_0xf81e('0x2e')][_0xf81e('0x2f')]?_0x182a81['attributes']:_0x249ae0['model'];_0x182a81=_[_0xf81e('0x30')]({},_0x182a81,_0x173b97[_0xf81e('0x31')]);return utilLicense[_0xf81e('0x32')](_0x182a81)[_0xf81e('0x21')](respondWithResult(_0x1fbc9,null))[_0xf81e('0x33')](handleError(_0x1fbc9,null));};exports['update']=function(_0x2e916c,_0x2d2308){if(_0x2e916c[_0xf81e('0x34')]['id']){delete _0x2e916c[_0xf81e('0x34')]['id'];}return db[_0xf81e('0x27')][_0xf81e('0x35')]({'where':{'id':_0x2e916c[_0xf81e('0x36')]['id']}})[_0xf81e('0x21')](handleEntityNotFound(_0x2d2308,null))[_0xf81e('0x21')](function(_0x11136d){var _0x30021a=_0x11136d['get']({'plain':!![]});return utilLicense['checkLicense'](_0x30021a,_0x2e916c[_0xf81e('0x34')][_0xf81e('0x37')]);})[_0xf81e('0x21')](function(_0xc7aeee){if(!_0xc7aeee['demo']){return saveUpdates(_0x2e916c[_0xf81e('0x34')],null);}return _0xc7aeee;})[_0xf81e('0x21')](respondWithResult(_0x2d2308,null))[_0xf81e('0x33')](handleError(_0x2d2308,null));};exports['downloadLogFile']=function(_0x580fba,_0x34dae5){var _0x29a64f='license-info.log';var _0x61956f=path[_0xf81e('0x38')](_0xf81e('0x39'),_0xf81e('0x3a'),_0xf81e('0x3b'),_0x29a64f);_0x34dae5[_0xf81e('0x3c')](_0xf81e('0x3d'),'attachment;\x20filename='+_0x29a64f);_0x34dae5[_0xf81e('0x1e')](_0xf81e('0x3e'),'text/plain');_0x34dae5[_0xf81e('0x3f')](_0x61956f);}; \ No newline at end of file +var _0x55b5=['error','stack','name','send','index','model','keys','License','rawAttributes','query','filters','intersection','attributes','fields','length','options','catch','body','find','checkLicense','key','demo','license-info.log','/var','log','xcally','Content-disposition','Content-Type','text/plain','download','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','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','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','end'];(function(_0x1b24a3,_0xf93b88){var _0xa81e40=function(_0x4a1c20){while(--_0x4a1c20){_0x1b24a3['push'](_0x1b24a3['shift']());}};_0xa81e40(++_0xf93b88);}(_0x55b5,0x186));var _0x555b=function(_0x295770,_0x50a408){_0x295770=_0x295770-0x0;var _0x4b7f0a=_0x55b5[_0x295770];return _0x4b7f0a;};'use strict';var emlformat=require(_0x555b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x555b('0x1'));var jsonpatch=require(_0x555b('0x2'));var rp=require(_0x555b('0x3'));var moment=require(_0x555b('0x4'));var BPromise=require(_0x555b('0x5'));var Mustache=require(_0x555b('0x6'));var util=require(_0x555b('0x7'));var path=require(_0x555b('0x8'));var sox=require(_0x555b('0x9'));var csv=require(_0x555b('0xa'));var ejs=require(_0x555b('0xb'));var fs=require('fs');var fs_extra=require(_0x555b('0xc'));var _=require(_0x555b('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x555b('0xe'));var deskjs=require(_0x555b('0xf'));var toCsv=require(_0x555b('0xa'));var querystring=require(_0x555b('0x10'));var Papa=require(_0x555b('0x11'));var Redis=require(_0x555b('0x12'));var authService=require(_0x555b('0x13'));var qs=require(_0x555b('0x14'));var as=require(_0x555b('0x15'));var hardwareService=require(_0x555b('0x16'));var logger=require(_0x555b('0x17'))(_0x555b('0x18'));var utils=require(_0x555b('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x555b('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x405868,_0x57b29f){_0x57b29f=_0x57b29f||0xcc;return function(_0x34a6cc){if(_0x34a6cc){return _0x405868[_0x555b('0x1b')](_0x57b29f);}return _0x405868[_0x555b('0x1c')](_0x57b29f)['end']();};}function respondWithResult(_0x1b2dfa,_0x142eda){_0x142eda=_0x142eda||0xc8;return function(_0x3e6a48){if(_0x3e6a48){return _0x1b2dfa[_0x555b('0x1c')](_0x142eda)[_0x555b('0x1d')](_0x3e6a48);}};}function respondWithFilteredResult(_0x4a32,_0x514e74){return function(_0x44d09a){if(_0x44d09a){var _0x7461e0=typeof _0x514e74[_0x555b('0x1e')]===_0x555b('0x1f')&&typeof _0x514e74[_0x555b('0x20')]===_0x555b('0x1f');var _0x2e3727=_0x44d09a[_0x555b('0x21')];var _0x52951d=_0x7461e0?0x0:_0x514e74[_0x555b('0x1e')];var _0x13ba42=_0x7461e0?_0x44d09a[_0x555b('0x21')]:_0x514e74[_0x555b('0x1e')]+_0x514e74[_0x555b('0x20')];var _0xe19706;if(_0x13ba42>=_0x2e3727){_0x13ba42=_0x2e3727;_0xe19706=0xc8;}else{_0xe19706=0xce;}_0x4a32[_0x555b('0x1c')](_0xe19706);return _0x4a32[_0x555b('0x22')](_0x555b('0x23'),_0x52951d+'-'+_0x13ba42+'/'+_0x2e3727)[_0x555b('0x1d')](_0x44d09a);}return null;};}function patchUpdates(_0x541ab6){return function(_0x1bbae8){try{jsonpatch[_0x555b('0x24')](_0x1bbae8,_0x541ab6,!![]);}catch(_0x1fb5df){return BPromise[_0x555b('0x25')](_0x1fb5df);}return _0x1bbae8[_0x555b('0x26')]();};}function saveUpdates(_0x204bc1,_0x39c961){return function(_0x45ba93){if(_0x45ba93){return _0x45ba93[_0x555b('0x27')](_0x204bc1)[_0x555b('0x28')](function(_0x3503d4){return _0x3503d4;});}return null;};}function removeEntity(_0xf036c5,_0x1a4ceb){return function(_0x363502){if(_0x363502){return _0x363502['destroy']()[_0x555b('0x28')](function(){_0xf036c5[_0x555b('0x1c')](0xcc)[_0x555b('0x29')]();});}};}function handleEntityNotFound(_0x3dbb29,_0x970f87){return function(_0x3e5257){if(!_0x3e5257){_0x3dbb29['sendStatus'](0x194);}return _0x3e5257;};}function handleError(_0x405bd5,_0x386b6b){_0x386b6b=_0x386b6b||0x1f4;return function(_0x4b37b7){logger[_0x555b('0x2a')](_0x4b37b7[_0x555b('0x2b')]);if(_0x4b37b7[_0x555b('0x2c')]){delete _0x4b37b7[_0x555b('0x2c')];}_0x405bd5[_0x555b('0x1c')](_0x386b6b)[_0x555b('0x2d')](_0x4b37b7);};}var utilLicense=require(_0x555b('0x1a'));exports[_0x555b('0x2e')]=function(_0x3e6371,_0x1f4116){var _0x262a56={'raw':!![],'where':{'id':0x1}},_0x2a1b9b={};_0x2a1b9b[_0x555b('0x2f')]=_[_0x555b('0x30')](db[_0x555b('0x31')][_0x555b('0x32')]);_0x2a1b9b[_0x555b('0x33')]=_[_0x555b('0x30')](_0x3e6371[_0x555b('0x33')]);_0x2a1b9b[_0x555b('0x34')]=_[_0x555b('0x35')](_0x2a1b9b[_0x555b('0x2f')],_0x2a1b9b[_0x555b('0x33')]);_0x262a56[_0x555b('0x36')]=_['intersection'](_0x2a1b9b['model'],qs['fields'](_0x3e6371['query'][_0x555b('0x37')]));_0x262a56[_0x555b('0x36')]=_0x262a56[_0x555b('0x36')][_0x555b('0x38')]?_0x262a56[_0x555b('0x36')]:_0x2a1b9b[_0x555b('0x2f')];_0x262a56=_['merge']({},_0x262a56,_0x3e6371[_0x555b('0x39')]);return utilLicense['getLicense'](_0x262a56)[_0x555b('0x28')](respondWithResult(_0x1f4116,null))[_0x555b('0x3a')](handleError(_0x1f4116,null));};exports[_0x555b('0x27')]=function(_0x50dc61,_0x4c3d3e){if(_0x50dc61[_0x555b('0x3b')]['id']){delete _0x50dc61[_0x555b('0x3b')]['id'];}return db['License'][_0x555b('0x3c')]({'where':{'id':_0x50dc61['params']['id']}})[_0x555b('0x28')](handleEntityNotFound(_0x4c3d3e,null))[_0x555b('0x28')](function(_0x58fb94){var _0x441927=_0x58fb94['get']({'plain':!![]});return utilLicense[_0x555b('0x3d')](_0x441927,_0x50dc61['body'][_0x555b('0x3e')]);})[_0x555b('0x28')](function(_0x441047){if(!_0x441047[_0x555b('0x3f')]){return saveUpdates(_0x50dc61[_0x555b('0x3b')],null);}return _0x441047;})['then'](respondWithResult(_0x4c3d3e,null))[_0x555b('0x3a')](handleError(_0x4c3d3e,null));};exports['downloadLogFile']=function(_0x575d4e,_0x178ab1){var _0x1505a2=_0x555b('0x40');var _0x167bf8=path['join'](_0x555b('0x41'),_0x555b('0x42'),_0x555b('0x43'),_0x1505a2);_0x178ab1['setHeader'](_0x555b('0x44'),'attachment;\x20filename='+_0x1505a2);_0x178ab1[_0x555b('0x22')](_0x555b('0x45'),_0x555b('0x46'));_0x178ab1[_0x555b('0x47')](_0x167bf8);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 159e8b9..67496cd 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 _0xfd0f=['util','../../config/logger','bluebird','path','rimraf','../../config/environment','./license.attributes','exports','define','license','lodash'];(function(_0x2135a8,_0x31bb78){var _0x2fd0b4=function(_0x299adb){while(--_0x299adb){_0x2135a8['push'](_0x2135a8['shift']());}};_0x2fd0b4(++_0x31bb78);}(_0xfd0f,0x149));var _0xffd0=function(_0x1e5e37,_0x41d78b){_0x1e5e37=_0x1e5e37-0x0;var _0x562da5=_0xfd0f[_0x1e5e37];return _0x562da5;};'use strict';var _=require(_0xffd0('0x0'));var util=require(_0xffd0('0x1'));var logger=require(_0xffd0('0x2'))('api');var moment=require('moment');var BPromise=require(_0xffd0('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xffd0('0x4'));var rimraf=require(_0xffd0('0x5'));var config=require(_0xffd0('0x6'));var attributes=require(_0xffd0('0x7'));module[_0xffd0('0x8')]=function(_0x21b800,_0x1640f5){return _0x21b800[_0xffd0('0x9')]('License',attributes,{'tableName':_0xffd0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8ec0=['request-promise','path','rimraf','./license.attributes','exports','license','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0xc7ea29,_0xf9ec02){var _0xe4771b=function(_0x1a72b2){while(--_0x1a72b2){_0xc7ea29['push'](_0xc7ea29['shift']());}};_0xe4771b(++_0xf9ec02);}(_0x8ec0,0x19e));var _0x08ec=function(_0x283ca5,_0x49fae5){_0x283ca5=_0x283ca5-0x0;var _0x368f5b=_0x8ec0[_0x283ca5];return _0x368f5b;};'use strict';var _=require(_0x08ec('0x0'));var util=require(_0x08ec('0x1'));var logger=require(_0x08ec('0x2'))(_0x08ec('0x3'));var moment=require(_0x08ec('0x4'));var BPromise=require(_0x08ec('0x5'));var rp=require(_0x08ec('0x6'));var fs=require('fs');var path=require(_0x08ec('0x7'));var rimraf=require(_0x08ec('0x8'));var config=require('../../config/environment');var attributes=require(_0x08ec('0x9'));module[_0x08ec('0xa')]=function(_0x1a6619,_0x158f96){return _0x1a6619['define']('License',attributes,{'tableName':_0x08ec('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 7e7603b..92b64b6 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 _0x3861=['jayson/promise','client','http','request','then','info','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x11ba56,_0x111d59){var _0xf61692=function(_0x56ba81){while(--_0x56ba81){_0x11ba56['push'](_0x11ba56['shift']());}};_0xf61692(++_0x111d59);}(_0x3861,0xe7));var _0x1386=function(_0x3ac801,_0xd23599){_0x3ac801=_0x3ac801-0x0;var _0x34c62e=_0x3861[_0x3ac801];return _0x34c62e;};'use strict';var _=require(_0x1386('0x0'));var util=require(_0x1386('0x1'));var moment=require(_0x1386('0x2'));var BPromise=require(_0x1386('0x3'));var rs=require(_0x1386('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1386('0x5'))['db'];var utils=require(_0x1386('0x6'));var logger=require(_0x1386('0x7'))('rpc');var config=require(_0x1386('0x8'));var jayson=require(_0x1386('0x9'));var client=jayson[_0x1386('0xa')][_0x1386('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x57c174,_0x254b6f,_0x620bf){return new BPromise(function(_0x4e6e06,_0x19073c){return client[_0x1386('0xc')](_0x57c174,_0x620bf)[_0x1386('0xd')](function(_0x103ddb){logger[_0x1386('0xe')](_0x1386('0xf'),_0x254b6f,_0x1386('0x10'));logger[_0x1386('0x11')](_0x1386('0x12'),_0x254b6f,'request\x20sent',JSON[_0x1386('0x13')](_0x103ddb));if(_0x103ddb[_0x1386('0x14')]){if(_0x103ddb[_0x1386('0x14')][_0x1386('0x15')]===0x1f4){logger[_0x1386('0x14')](_0x1386('0xf'),_0x254b6f,_0x103ddb[_0x1386('0x14')][_0x1386('0x16')]);return _0x19073c(_0x103ddb[_0x1386('0x14')][_0x1386('0x16')]);}logger['error'](_0x1386('0xf'),_0x254b6f,_0x103ddb[_0x1386('0x14')][_0x1386('0x16')]);return _0x4e6e06(_0x103ddb[_0x1386('0x14')]['message']);}else{logger[_0x1386('0xe')]('License,\x20%s,\x20%s',_0x254b6f,'request\x20sent');_0x4e6e06(_0x103ddb[_0x1386('0x17')][_0x1386('0x16')]);}})['catch'](function(_0x38f001){logger[_0x1386('0x14')](_0x1386('0xf'),_0x254b6f,_0x38f001);_0x19073c(_0x38f001);});});} \ No newline at end of file +var _0x88a3=['result','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','License,\x20%s,\x20%s','License,\x20%s,\x20%s,\x20%s','error','code','message','info'];(function(_0x11878f,_0x36c76b){var _0x5cac43=function(_0x5131bb){while(--_0x5131bb){_0x11878f['push'](_0x11878f['shift']());}};_0x5cac43(++_0x36c76b);}(_0x88a3,0x1a5));var _0x388a=function(_0x189305,_0x46c43f){_0x189305=_0x189305-0x0;var _0xea3406=_0x88a3[_0x189305];return _0xea3406;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x388a('0x0'));var BPromise=require('bluebird');var rs=require(_0x388a('0x1'));var fs=require('fs');var Redis=require(_0x388a('0x2'));var db=require(_0x388a('0x3'))['db'];var utils=require(_0x388a('0x4'));var logger=require(_0x388a('0x5'))(_0x388a('0x6'));var config=require(_0x388a('0x7'));var jayson=require(_0x388a('0x8'));var client=jayson[_0x388a('0x9')][_0x388a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x28491a,_0x4ed2a2,_0x13afd5){return new BPromise(function(_0x318881,_0x4eb9fd){return client[_0x388a('0xb')](_0x28491a,_0x13afd5)[_0x388a('0xc')](function(_0x331825){logger['info'](_0x388a('0xd'),_0x4ed2a2,'request\x20sent');logger['debug'](_0x388a('0xe'),_0x4ed2a2,'request\x20sent',JSON['stringify'](_0x331825));if(_0x331825[_0x388a('0xf')]){if(_0x331825['error'][_0x388a('0x10')]===0x1f4){logger[_0x388a('0xf')]('License,\x20%s,\x20%s',_0x4ed2a2,_0x331825[_0x388a('0xf')]['message']);return _0x4eb9fd(_0x331825[_0x388a('0xf')][_0x388a('0x11')]);}logger[_0x388a('0xf')](_0x388a('0xd'),_0x4ed2a2,_0x331825['error']['message']);return _0x318881(_0x331825[_0x388a('0xf')]['message']);}else{logger[_0x388a('0x12')](_0x388a('0xd'),_0x4ed2a2,'request\x20sent');_0x318881(_0x331825[_0x388a('0x13')][_0x388a('0x11')]);}})['catch'](function(_0x43d7d1){logger[_0x388a('0xf')](_0x388a('0xd'),_0x4ed2a2,_0x43d7d1);_0x4eb9fd(_0x43d7d1);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 2681f1f..eccf09e 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 _0xfce5=['/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getInteractions','/:id/applications','getApplications','getMessages','/:id/verify','verifySmtp','/:id/users','getAgents','addDisposition','addAnswer','create','post','addImap','addSmtp','/:id/interactions','addInteraction','addApplications','/:id/send','send','put','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','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/dispositions','getDispositions'];(function(_0x25996d,_0x174b3b){var _0x4b746a=function(_0x3f87a2){while(--_0x3f87a2){_0x25996d['push'](_0x25996d['shift']());}};_0x4b746a(++_0x174b3b);}(_0xfce5,0x1c0));var _0x5fce=function(_0x25a233,_0x1402dd){_0x25a233=_0x25a233-0x0;var _0x48ed17=_0xfce5[_0x25a233];return _0x48ed17;};'use strict';var multer=require(_0x5fce('0x0'));var util=require(_0x5fce('0x1'));var path=require(_0x5fce('0x2'));var timeout=require(_0x5fce('0x3'));var express=require(_0x5fce('0x4'));var router=express[_0x5fce('0x5')]();var fs_extra=require(_0x5fce('0x6'));var auth=require(_0x5fce('0x7'));var interaction=require(_0x5fce('0x8'));var config=require(_0x5fce('0x9'));var controller=require(_0x5fce('0xa'));router['get']('/',auth[_0x5fce('0xb')](),controller[_0x5fce('0xc')]);router[_0x5fce('0xd')](_0x5fce('0xe'),auth[_0x5fce('0xb')](),controller[_0x5fce('0xf')]);router[_0x5fce('0xd')](_0x5fce('0x10'),auth[_0x5fce('0xb')](),controller[_0x5fce('0x11')]);router[_0x5fce('0xd')](_0x5fce('0x12'),auth[_0x5fce('0xb')](),controller[_0x5fce('0x13')]);router['get'](_0x5fce('0x14'),auth[_0x5fce('0xb')](),controller[_0x5fce('0x15')]);router[_0x5fce('0xd')](_0x5fce('0x16'),auth[_0x5fce('0xb')](),controller[_0x5fce('0x17')]);router[_0x5fce('0xd')](_0x5fce('0x18'),auth[_0x5fce('0xb')](),controller['getSmtp']);router[_0x5fce('0xd')]('/:id/interactions',auth[_0x5fce('0xb')](),controller[_0x5fce('0x19')]);router[_0x5fce('0xd')](_0x5fce('0x1a'),auth[_0x5fce('0xb')](),controller[_0x5fce('0x1b')]);router['get']('/:id/messages',auth['isAuthenticated'](),controller[_0x5fce('0x1c')]);router[_0x5fce('0xd')](_0x5fce('0x1d'),auth[_0x5fce('0xb')](),controller[_0x5fce('0x1e')]);router[_0x5fce('0xd')](_0x5fce('0x1f'),auth['isAuthenticated'](),controller[_0x5fce('0x20')]);router['post'](_0x5fce('0x12'),auth[_0x5fce('0xb')](),controller[_0x5fce('0x21')]);router['post'](_0x5fce('0x14'),auth[_0x5fce('0xb')](),controller[_0x5fce('0x22')]);router['post']('/',auth[_0x5fce('0xb')](),controller[_0x5fce('0x23')]);router[_0x5fce('0x24')]('/:id/in_servers',auth[_0x5fce('0xb')](),controller[_0x5fce('0x25')]);router['post'](_0x5fce('0x18'),auth[_0x5fce('0xb')](),controller[_0x5fce('0x26')]);router['post'](_0x5fce('0x27'),auth[_0x5fce('0xb')](),controller[_0x5fce('0x28')]);router[_0x5fce('0x24')](_0x5fce('0x1a'),auth[_0x5fce('0xb')](),controller[_0x5fce('0x29')]);router['post'](_0x5fce('0x2a'),auth[_0x5fce('0xb')](),controller[_0x5fce('0x2b')]);router[_0x5fce('0x24')](_0x5fce('0x1f'),auth[_0x5fce('0xb')](),controller['addAgents']);router[_0x5fce('0x2c')]('/:id',auth[_0x5fce('0xb')](),controller['update']);router[_0x5fce('0x2d')](_0x5fce('0x12'),auth[_0x5fce('0xb')](),controller[_0x5fce('0x2e')]);router['delete'](_0x5fce('0x14'),auth[_0x5fce('0xb')](),controller[_0x5fce('0x2f')]);router[_0x5fce('0x2d')]('/:id/in_servers',auth[_0x5fce('0xb')](),controller[_0x5fce('0x30')]);router[_0x5fce('0x2d')]('/:id/out_servers',auth[_0x5fce('0xb')](),controller[_0x5fce('0x31')]);router['delete']('/:id',auth[_0x5fce('0xb')](),controller[_0x5fce('0x32')]);router['delete'](_0x5fce('0x1f'),auth[_0x5fce('0xb')](),controller['removeAgents']);module[_0x5fce('0x33')]=router; \ No newline at end of file +var _0x5356=['Router','../../components/auth/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/users','getAgents','post','addImap','addSmtp','addInteraction','addApplications','/:id/send','addAgents','update','removeDispositions','delete','removeAnswers','/:id/in_servers','removeImap','removeSmtp','removeAgents','exports','path','connect-timeout'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5356,0x181));var _0x6535=function(_0x1724d7,_0x45fca2){_0x1724d7=_0x1724d7-0x0;var _0x190ed4=_0x5356[_0x1724d7];return _0x190ed4;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6535('0x0'));var timeout=require(_0x6535('0x1'));var express=require('express');var router=express[_0x6535('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x6535('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x6535('0x4'));var controller=require(_0x6535('0x5'));router[_0x6535('0x6')]('/',auth[_0x6535('0x7')](),controller[_0x6535('0x8')]);router[_0x6535('0x6')](_0x6535('0x9'),auth[_0x6535('0x7')](),controller[_0x6535('0xa')]);router[_0x6535('0x6')](_0x6535('0xb'),auth[_0x6535('0x7')](),controller['show']);router[_0x6535('0x6')](_0x6535('0xc'),auth[_0x6535('0x7')](),controller[_0x6535('0xd')]);router[_0x6535('0x6')](_0x6535('0xe'),auth[_0x6535('0x7')](),controller[_0x6535('0xf')]);router['get']('/:id/in_servers',auth[_0x6535('0x7')](),controller[_0x6535('0x10')]);router[_0x6535('0x6')](_0x6535('0x11'),auth[_0x6535('0x7')](),controller[_0x6535('0x12')]);router['get'](_0x6535('0x13'),auth[_0x6535('0x7')](),controller[_0x6535('0x14')]);router[_0x6535('0x6')](_0x6535('0x15'),auth['isAuthenticated'](),controller[_0x6535('0x16')]);router['get'](_0x6535('0x17'),auth['isAuthenticated'](),controller[_0x6535('0x18')]);router[_0x6535('0x6')]('/:id/verify',auth[_0x6535('0x7')](),controller['verifySmtp']);router[_0x6535('0x6')](_0x6535('0x19'),auth[_0x6535('0x7')](),controller[_0x6535('0x1a')]);router[_0x6535('0x1b')](_0x6535('0xc'),auth[_0x6535('0x7')](),controller['addDisposition']);router[_0x6535('0x1b')]('/:id/canned_answers',auth[_0x6535('0x7')](),controller['addAnswer']);router['post']('/',auth[_0x6535('0x7')](),controller['create']);router[_0x6535('0x1b')]('/:id/in_servers',auth[_0x6535('0x7')](),controller[_0x6535('0x1c')]);router[_0x6535('0x1b')](_0x6535('0x11'),auth['isAuthenticated'](),controller[_0x6535('0x1d')]);router[_0x6535('0x1b')](_0x6535('0x13'),auth[_0x6535('0x7')](),controller[_0x6535('0x1e')]);router[_0x6535('0x1b')](_0x6535('0x15'),auth[_0x6535('0x7')](),controller[_0x6535('0x1f')]);router[_0x6535('0x1b')](_0x6535('0x20'),auth[_0x6535('0x7')](),controller['send']);router['post'](_0x6535('0x19'),auth[_0x6535('0x7')](),controller[_0x6535('0x21')]);router['put'](_0x6535('0xb'),auth[_0x6535('0x7')](),controller[_0x6535('0x22')]);router['delete'](_0x6535('0xc'),auth['isAuthenticated'](),controller[_0x6535('0x23')]);router[_0x6535('0x24')](_0x6535('0xe'),auth[_0x6535('0x7')](),controller[_0x6535('0x25')]);router[_0x6535('0x24')](_0x6535('0x26'),auth[_0x6535('0x7')](),controller[_0x6535('0x27')]);router['delete']('/:id/out_servers',auth[_0x6535('0x7')](),controller[_0x6535('0x28')]);router[_0x6535('0x24')]('/:id',auth[_0x6535('0x7')](),controller['destroy']);router[_0x6535('0x24')](_0x6535('0x19'),auth['isAuthenticated'](),controller[_0x6535('0x29')]);module[_0x6535('0x2a')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 899f821..989876e 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 _0xfd34=['Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','ENUM','getDataValue','provider','custom','sequelize','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}'];(function(_0xd66a97,_0x2fb0c9){var _0x57441d=function(_0x591728){while(--_0x591728){_0xd66a97['push'](_0xd66a97['shift']());}};_0x57441d(++_0x2fb0c9);}(_0xfd34,0x6e));var _0x4fd3=function(_0x27031e,_0x1eb8cd){_0x27031e=_0x27031e-0x0;var _0xfd46b3=_0xfd34[_0x27031e];return _0xfd46b3;};'use strict';var Sequelize=require(_0x4fd3('0x0'));module[_0x4fd3('0x1')]={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x4fd3('0x2')],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0x4fd3('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x4fd3('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0x4fd3('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0x4fd3('0x4')]},'markAsUnread':{'type':Sequelize[_0x4fd3('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x4fd3('0x2')],'allowNull':![],'defaultValue':_0x4fd3('0x5')},'fontSize':{'type':Sequelize[_0x4fd3('0x6')](0x2)[_0x4fd3('0x7')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x4fd3('0x4')],'defaultValue':function(){return _0x4fd3('0x8');}},'notificationSound':{'type':Sequelize[_0x4fd3('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x4fd3('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x4fd3('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x4fd3('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x4fd3('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x4fd3('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x4fd3('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x4fd3('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x4fd3('0x3')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x1cecbb){if(!_0x1cecbb)this[_0x4fd3('0xa')](_0x4fd3('0xb'),null);this[_0x4fd3('0xa')](_0x4fd3('0xc'),_0x1cecbb);}},'provider':{'type':Sequelize[_0x4fd3('0xd')]('gmail','hotmail','yahoo','outlook365'),'defaultValue':null,'get':function(){if(!this[_0x4fd3('0xe')](_0x4fd3('0xf')))return _0x4fd3('0x10');return this[_0x4fd3('0xe')](_0x4fd3('0xf'));},'set':function(_0x4a01f7){if(_0x4a01f7===_0x4fd3('0x10'))_0x4a01f7=null;return this[_0x4fd3('0xa')](_0x4fd3('0xf'),_0x4a01f7);}}}; \ No newline at end of file +var _0xc144=['exports','STRING','BOOLEAN','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','ENUM','gmail','hotmail','yahoo','outlook365','getDataValue','provider','custom','sequelize'];(function(_0x88fa63,_0x441eed){var _0x2d8616=function(_0x44f561){while(--_0x44f561){_0x88fa63['push'](_0x88fa63['shift']());}};_0x2d8616(++_0x441eed);}(_0xc144,0x1a3));var _0x4c14=function(_0x11f1ff,_0x3ae51b){_0x11f1ff=_0x11f1ff-0x0;var _0x1a1eed=_0xc144[_0x11f1ff];return _0x1a1eed;};'use strict';var Sequelize=require(_0x4c14('0x0'));module[_0x4c14('0x1')]={'description':{'type':Sequelize[_0x4c14('0x2')]},'name':{'type':Sequelize[_0x4c14('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0x4c14('0x3')],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x4c14('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0x4c14('0x2')],'allowNull':![]},'template':{'type':Sequelize['TEXT']},'markAsUnread':{'type':Sequelize[_0x4c14('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x4c14('0x2')],'allowNull':![],'defaultValue':_0x4c14('0x4')},'fontSize':{'type':Sequelize[_0x4c14('0x5')](0x2)[_0x4c14('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x4c14('0x7')],'defaultValue':function(){return _0x4c14('0x8');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x4c14('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x4c14('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x4c14('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x4c14('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x4c14('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x4c14('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x4c14('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x4c14('0x5')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x4c14('0x9'),'set':function(_0x5e4507){if(!_0x5e4507)this[_0x4c14('0xa')](_0x4c14('0xb'),null);this[_0x4c14('0xa')]('mandatoryDisposition',_0x5e4507);}},'provider':{'type':Sequelize[_0x4c14('0xc')](_0x4c14('0xd'),_0x4c14('0xe'),_0x4c14('0xf'),_0x4c14('0x10')),'defaultValue':null,'get':function(){if(!this[_0x4c14('0x11')](_0x4c14('0x12')))return _0x4c14('0x13');return this[_0x4c14('0x11')](_0x4c14('0x12'));},'set':function(_0x58c51d){if(_0x58c51d===_0x4c14('0x13'))_0x58c51d=null;return this[_0x4c14('0xa')](_0x4c14('0x12'),_0x58c51d);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 7563599..96b983d 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 _0xad6f=['addDisposition','Disposition','getDispositions','params','order','pick','MailAccountId','options','findAll','removeDispositions','ids','addAnswer','CannedAnswer','create','getAnswers','findOne','removeAnswers','custom','email','isNil','active','description','role','MailAccounts','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','setSmtp','addInteraction','MailInteraction','omit','getInteractions','Contact','User','Owner','fullname','internal','Tag','Tags','tag','transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','bulkCreate','findAndCountAll','getApplications','getMessages','$gte','split','format','MailMessage','CmContact','updatedAt','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','from','%s\x20<%s>','attachments','join','server/files/attachments','basename','getSmtpOptions','sendMail','List','Contacts','messageId','subject','attach','out','YYYY-MM-DD\x20HH:mm:ss','Interaction','Messages','verifySmtp','Sequelize','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','removeAgents','userMailAccount:remove','getAgents','bluebird','util','juice','ioredis','../../config/logger','../../config/environment','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','jayson/promise','client','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','status','offset','undefined','limit','count','set','json','update','destroy','get','UserProfileResource','end','sendStatus','stack','name','send','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','Unknown\x20email\x20service\x20provider','smtp.gmail.com','smtp.mail.yahoo.com','smtp-mail.outlook.com','smtp.office365.com','user','username','password','pass','modernAuthentication','CloudProviderId','host','port','secure','service','authentication','Imap','Smtp','index','MailServerIn','Pause','map','MailAccount','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','includeAll','include','rows','show','MailServerOut','mandatoryDispositionPause','keys','body','provider','find','Mail\x20Account\x20not\x20found','describe'];(function(_0x2cde6d,_0x47d167){var _0x148bb6=function(_0x5ac17e){while(--_0x5ac17e){_0x2cde6d['push'](_0x2cde6d['shift']());}};_0x148bb6(++_0x47d167);}(_0xad6f,0x1d2));var _0xfad6=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xad6f[_0x17d9e3];return _0x14192d;};'use strict';var moment=require('moment');var BPromise=require(_0xfad6('0x0'));var util=require(_0xfad6('0x1'));var path=require('path');var _=require('lodash');var juice=require(_0xfad6('0x2'));var Redis=require(_0xfad6('0x3'));var qs=require('../../components/parsers/qs');var logger=require(_0xfad6('0x4'))('api');var config=require(_0xfad6('0x5'));var db=require('../../mysqldb')['db'];config[_0xfad6('0x6')]=_[_0xfad6('0x7')](config[_0xfad6('0x6')],{'host':_0xfad6('0x8'),'port':0x18eb});var socket=require(_0xfad6('0x9'))(new Redis(config[_0xfad6('0x6')]));require(_0xfad6('0xa'))['register'](socket);var jayson=require(_0xfad6('0xb'));var client=jayson[_0xfad6('0xc')]['http']({'port':0x232b});function respondWithRpcPromise(_0x2f659e,_0x30e971,_0x3f69f8,_0x5589ed){return new BPromise(function(_0x1dd2a2,_0x84daf3){var _0x3e03cf=_0x5589ed||client;return _0x3e03cf[_0xfad6('0xd')](_0x2f659e,_0x3f69f8)[_0xfad6('0xe')](function(_0x37fd6a){logger[_0xfad6('0xf')](_0xfad6('0x10'),_0x30e971,_0xfad6('0x11'));logger[_0xfad6('0x12')](_0xfad6('0x13'),_0x30e971,'request\x20sent',JSON['stringify'](_0x37fd6a));if(_0x37fd6a[_0xfad6('0x14')]){if(_0x37fd6a[_0xfad6('0x14')][_0xfad6('0x15')]===0x1f4){logger[_0xfad6('0x14')](_0xfad6('0x10'),_0x30e971,_0x37fd6a[_0xfad6('0x14')][_0xfad6('0x16')]);return _0x84daf3(_0x37fd6a[_0xfad6('0x14')]['message']);}logger['error'](_0xfad6('0x10'),_0x30e971,_0x37fd6a['error'][_0xfad6('0x16')]);return _0x1dd2a2(_0x37fd6a['error'][_0xfad6('0x16')]);}else{logger[_0xfad6('0xf')](_0xfad6('0x10'),_0x30e971,'request\x20sent');_0x1dd2a2(_0x37fd6a[_0xfad6('0x17')][_0xfad6('0x16')]);}})[_0xfad6('0x18')](function(_0x6bea00){logger[_0xfad6('0x14')]('MailAccount,\x20%s,\x20%s',_0x30e971,_0x6bea00);_0x84daf3(_0x6bea00);});});}function respondWithStatusCode(_0x41ffcd,_0xf0617a){_0xf0617a=_0xf0617a||0xcc;return function(_0x118217){if(_0x118217){return _0x41ffcd['sendStatus'](_0xf0617a);}return _0x41ffcd[_0xfad6('0x19')](_0xf0617a)['end']();};}function respondWithResult(_0x3d3438,_0x49a79c){_0x49a79c=_0x49a79c||0xc8;return function(_0x2eaa97){if(_0x2eaa97){return _0x3d3438[_0xfad6('0x19')](_0x49a79c)['json'](_0x2eaa97);}};}function respondWithFilteredResult(_0x3828ed,_0x2ce72d){return function(_0x5715fb){if(_0x5715fb){var _0x1cf47c=typeof _0x2ce72d[_0xfad6('0x1a')]===_0xfad6('0x1b')&&typeof _0x2ce72d[_0xfad6('0x1c')]===_0xfad6('0x1b');var _0x1a4ac8=_0x5715fb[_0xfad6('0x1d')];var _0x410662=_0x1cf47c?0x0:_0x2ce72d[_0xfad6('0x1a')];var _0x4e14c6=_0x1cf47c?_0x5715fb[_0xfad6('0x1d')]:_0x2ce72d['offset']+_0x2ce72d[_0xfad6('0x1c')];var _0x337a62;if(_0x4e14c6>=_0x1a4ac8){_0x4e14c6=_0x1a4ac8;_0x337a62=0xc8;}else{_0x337a62=0xce;}_0x3828ed['status'](_0x337a62);return _0x3828ed[_0xfad6('0x1e')]('Content-Range',_0x410662+'-'+_0x4e14c6+'/'+_0x1a4ac8)[_0xfad6('0x1f')](_0x5715fb);}return null;};}function saveUpdates(_0x11acfc){return function(_0x4a874f){if(_0x4a874f){return _0x4a874f[_0xfad6('0x20')](_0x11acfc)[_0xfad6('0xe')](function(_0x5082dc){return _0x5082dc;});}return null;};}function removeEntity(_0x3d26f2){return function(_0x1c0067){if(_0x1c0067){return _0x1c0067[_0xfad6('0x21')]()[_0xfad6('0xe')](function(){var _0x281b48=_0x1c0067[_0xfad6('0x22')]({'plain':!![]});var _0x5ba2f0='MailAccounts';return db[_0xfad6('0x23')]['destroy']({'where':{'type':_0x5ba2f0,'resourceId':_0x281b48['id']}})['then'](function(){return _0x1c0067;});})[_0xfad6('0xe')](function(){_0x3d26f2[_0xfad6('0x19')](0xcc)[_0xfad6('0x24')]();});}};}function handleEntityNotFound(_0x5d9e98){return function(_0x11bc7b){if(!_0x11bc7b){_0x5d9e98[_0xfad6('0x25')](0x194);}return _0x11bc7b;};}function handleError(_0x3a09f9,_0x19d558){_0x19d558=_0x19d558||0x1f4;return function(_0x2678a5){logger['error'](_0x2678a5[_0xfad6('0x26')]);if(_0x2678a5[_0xfad6('0x27')]){delete _0x2678a5[_0xfad6('0x27')];}_0x3a09f9[_0xfad6('0x19')](_0x19d558)[_0xfad6('0x28')](_0x2678a5);};}function getImapHost(_0x3b26e6){switch(_0x3b26e6){case _0xfad6('0x29'):return _0xfad6('0x2a');case _0xfad6('0x2b'):return _0xfad6('0x2c');case _0xfad6('0x2d'):return _0xfad6('0x2e');case _0xfad6('0x2f'):return _0xfad6('0x30');}throw new Error(_0xfad6('0x31'),_0x3b26e6);}function getSmtpHost(_0x4f45e1){switch(_0x4f45e1){case'gmail':return _0xfad6('0x32');case _0xfad6('0x2b'):return _0xfad6('0x33');case _0xfad6('0x2d'):return _0xfad6('0x34');case _0xfad6('0x2f'):return _0xfad6('0x35');}throw new Error('Unknown\x20email\x20service\x20provider',_0x4f45e1);}function getAuthenticationOptions(_0x519707,_0x476cdb){var _0x5934b3={};var _0x5f46e2={};if(_0x519707){_0x5934b3[_0xfad6('0x36')]=_0x5f46e2['user']=_0x476cdb[_0xfad6('0x37')];_0x5934b3[_0xfad6('0x38')]=_0x5f46e2[_0xfad6('0x39')]=_0x476cdb['password'];if(_0x476cdb[_0xfad6('0x3a')]){_0x5934b3[_0xfad6('0x3a')]=_0x5f46e2[_0xfad6('0x3a')]=!![];_0x5934b3[_0xfad6('0x3b')]=_0x5f46e2[_0xfad6('0x3b')]=_0x476cdb['CloudProviderId'];_0x5934b3[_0xfad6('0x38')]=_0x5f46e2[_0xfad6('0x39')]=null;}else{_0x5934b3[_0xfad6('0x3b')]=_0x5f46e2[_0xfad6('0x3b')]=null;}_0x5934b3[_0xfad6('0x3c')]=getImapHost(_0x519707);_0x5934b3[_0xfad6('0x3d')]=0x3e1;_0x5f46e2['host']=getSmtpHost(_0x519707);_0x5f46e2[_0xfad6('0x3d')]=0x24b;_0x5f46e2[_0xfad6('0x3e')]=![];_0x5934b3[_0xfad6('0x3f')]=_0x5f46e2[_0xfad6('0x3f')]=null;}else{if(_0x476cdb[_0xfad6('0x40')]){_0x5934b3[_0xfad6('0x36')]=_0x5f46e2[_0xfad6('0x36')]=_0x476cdb[_0xfad6('0x37')];_0x5934b3[_0xfad6('0x38')]=_0x5f46e2[_0xfad6('0x39')]=_0x476cdb[_0xfad6('0x38')];}else{_0x5934b3['authentication']=_0x5f46e2['authentication']=![];_0x5934b3[_0xfad6('0x36')]=_0x5f46e2[_0xfad6('0x36')]=null;_0x5934b3['password']=_0x5f46e2[_0xfad6('0x39')]=null;}_0x5934b3[_0xfad6('0x3c')]=_0x476cdb[_0xfad6('0x41')][_0xfad6('0x3c')];_0x5934b3[_0xfad6('0x3d')]=_0x476cdb[_0xfad6('0x41')]['port'];_0x5f46e2[_0xfad6('0x3c')]=_0x476cdb[_0xfad6('0x42')][_0xfad6('0x3c')];_0x5f46e2[_0xfad6('0x3d')]=_0x476cdb[_0xfad6('0x42')][_0xfad6('0x3d')];}return{'Imap':_0x5934b3,'Smtp':_0x5f46e2};}exports[_0xfad6('0x43')]=function(_0x3e8f33,_0x1e3c6c){var _0x27ad6a={'include':[{'model':db[_0xfad6('0x44')],'as':'Imap'},{'model':db['MailServerOut'],'as':'Smtp'},{'model':db[_0xfad6('0x45')],'as':'mandatoryDispositionPause'}]},_0x1de484={},_0x423709={'count':0x0,'rows':[]};var _0x1d4f36=_[_0xfad6('0x46')](db[_0xfad6('0x47')][_0xfad6('0x48')],function(_0x223cf3){return{'name':_0x223cf3['fieldName'],'type':_0x223cf3[_0xfad6('0x49')][_0xfad6('0x4a')]};});_0x1de484[_0xfad6('0x4b')]=_[_0xfad6('0x46')](_0x1d4f36,_0xfad6('0x27'));_0x1de484[_0xfad6('0x4c')]=_['keys'](_0x3e8f33['query']);_0x1de484[_0xfad6('0x4d')]=_[_0xfad6('0x4e')](_0x1de484['model'],_0x1de484[_0xfad6('0x4c')]);_0x27ad6a[_0xfad6('0x4f')]=_[_0xfad6('0x4e')](_0x1de484[_0xfad6('0x4b')],qs[_0xfad6('0x50')](_0x3e8f33['query']['fields']));_0x27ad6a['attributes']=_0x27ad6a['attributes'][_0xfad6('0x51')]?_0x27ad6a['attributes']:_0x1de484['model'];if(!_0x3e8f33['query'][_0xfad6('0x52')](_0xfad6('0x53'))){_0x27ad6a['limit']=qs['limit'](_0x3e8f33[_0xfad6('0x4c')][_0xfad6('0x1c')]);_0x27ad6a[_0xfad6('0x1a')]=qs[_0xfad6('0x1a')](_0x3e8f33['query'][_0xfad6('0x1a')]);}_0x27ad6a['order']=qs[_0xfad6('0x54')](_0x3e8f33['query'][_0xfad6('0x54')]);_0x27ad6a[_0xfad6('0x55')]=qs['filters'](_['pick'](_0x3e8f33[_0xfad6('0x4c')],_0x1de484[_0xfad6('0x4d')]),_0x1d4f36);if(_0x3e8f33[_0xfad6('0x4c')][_0xfad6('0x56')]){_0x27ad6a['where']=_[_0xfad6('0x57')](_0x27ad6a[_0xfad6('0x55')],{'$or':_[_0xfad6('0x46')](_0x1d4f36,function(_0x3c4905){if(_0x3c4905['type']!==_0xfad6('0x58')){var _0x2c3d12={};_0x2c3d12[_0x3c4905['name']]={'$like':'%'+_0x3e8f33['query']['filter']+'%'};return _0x2c3d12;}})});}_0x27ad6a=_[_0xfad6('0x57')]({},_0x27ad6a,_0x3e8f33['options']);var _0x4ac2c4={'where':_0x27ad6a[_0xfad6('0x55')]};return db['MailAccount'][_0xfad6('0x1d')](_0x4ac2c4)[_0xfad6('0xe')](function(_0x3965ed){_0x423709[_0xfad6('0x1d')]=_0x3965ed;if(_0x3e8f33[_0xfad6('0x4c')][_0xfad6('0x59')]){_0x27ad6a[_0xfad6('0x5a')]=[{'all':!![]}];}return db[_0xfad6('0x47')]['findAll'](_0x27ad6a);})[_0xfad6('0xe')](function(_0x2565fc){_0x423709[_0xfad6('0x5b')]=_0x2565fc;return _0x423709;})[_0xfad6('0xe')](respondWithFilteredResult(_0x1e3c6c,_0x27ad6a))['catch'](handleError(_0x1e3c6c,null));};exports[_0xfad6('0x5c')]=function(_0x596b23,_0x2147ae){var _0x10930c={'raw':![],'where':{'id':_0x596b23['params']['id']},'include':[{'model':db[_0xfad6('0x44')],'as':_0xfad6('0x41')},{'model':db[_0xfad6('0x5d')],'as':_0xfad6('0x42')},{'model':db[_0xfad6('0x45')],'as':_0xfad6('0x5e')}]},_0x34943a={};_0x34943a[_0xfad6('0x4b')]=_['keys'](db[_0xfad6('0x47')][_0xfad6('0x48')]);_0x34943a[_0xfad6('0x4c')]=_[_0xfad6('0x5f')](_0x596b23['query']);_0x34943a[_0xfad6('0x4d')]=_[_0xfad6('0x4e')](_0x34943a[_0xfad6('0x4b')],_0x34943a[_0xfad6('0x4c')]);_0x10930c[_0xfad6('0x4f')]=_[_0xfad6('0x4e')](_0x34943a[_0xfad6('0x4b')],qs['fields'](_0x596b23['query'][_0xfad6('0x50')]));_0x10930c[_0xfad6('0x4f')]=_0x10930c[_0xfad6('0x4f')]['length']?_0x10930c[_0xfad6('0x4f')]:_0x34943a[_0xfad6('0x4b')];if(_0x596b23[_0xfad6('0x4c')][_0xfad6('0x59')]){_0x10930c['include']=[{'all':!![]}];}_0x10930c=_[_0xfad6('0x57')]({},_0x10930c,_0x596b23['options']);return db[_0xfad6('0x47')]['find'](_0x10930c)[_0xfad6('0xe')](handleEntityNotFound(_0x2147ae,null))[_0xfad6('0xe')](respondWithResult(_0x2147ae,null))[_0xfad6('0x18')](handleError(_0x2147ae,null));};exports[_0xfad6('0x20')]=function(_0xea6064,_0x9ad342){if(_0xea6064[_0xfad6('0x60')]['id']){delete _0xea6064[_0xfad6('0x60')]['id'];}var _0x393f56=_0xea6064[_0xfad6('0x60')][_0xfad6('0x61')]==='custom'?null:_0xea6064[_0xfad6('0x60')][_0xfad6('0x61')];var _0x5a25de=_0xea6064[_0xfad6('0x60')][_0xfad6('0x41')]||{};var _0x4dbe03=_0xea6064[_0xfad6('0x60')]['Smtp']||{};if(_0x393f56){_0x5a25de[_0xfad6('0x3c')]=getImapHost(_0x393f56);_0x5a25de['port']=0x3e1;_0x4dbe03[_0xfad6('0x3c')]=getSmtpHost(_0x393f56);_0x4dbe03[_0xfad6('0x3d')]=0x24b;_0x4dbe03['secure']=![];}if(_0x4dbe03[_0xfad6('0x3a')]){_0x4dbe03[_0xfad6('0x3e')]=![];}else{_0x4dbe03[_0xfad6('0x3b')]=null;}if(!_0x5a25de['modernAuthentication'])_0x5a25de[_0xfad6('0x3b')]=null;_0xea6064['body'][_0xfad6('0x41')]=_0x5a25de;_0xea6064['body'][_0xfad6('0x42')]=_0x4dbe03;return db['MailAccount'][_0xfad6('0x62')]({'where':{'id':_0xea6064['params']['id']},'include':[{'model':db[_0xfad6('0x44')],'as':_0xfad6('0x41')},{'model':db[_0xfad6('0x5d')],'as':_0xfad6('0x42')},{'model':db[_0xfad6('0x45')],'as':'mandatoryDispositionPause'}]})[_0xfad6('0xe')](handleEntityNotFound(_0x9ad342,null))[_0xfad6('0xe')](function(_0x55a1cd){if(!_0x55a1cd)throw new Error(_0xfad6('0x63'));if(_0x55a1cd[_0xfad6('0x3f')])delete _0xea6064[_0xfad6('0x60')][_0xfad6('0x41')];return _0x55a1cd;})[_0xfad6('0xe')](saveUpdates(_0xea6064[_0xfad6('0x60')],null))[_0xfad6('0xe')](function(_0x505bec){if(!_0xea6064[_0xfad6('0x60')][_0xfad6('0x41')])return _0x505bec;return db[_0xfad6('0x44')][_0xfad6('0x20')](_0xea6064[_0xfad6('0x60')][_0xfad6('0x41')],{'where':{'MailAccountId':_0x505bec['id']}})[_0xfad6('0xe')](function(){return _0x505bec;});})[_0xfad6('0xe')](function(_0x456ffe){if(!_0xea6064[_0xfad6('0x60')][_0xfad6('0x42')])return _0x456ffe;return db['MailServerOut'][_0xfad6('0x20')](_0xea6064[_0xfad6('0x60')][_0xfad6('0x42')],{'where':{'MailAccountId':_0x456ffe['id']}})['then'](function(){return _0x456ffe;});})['then'](respondWithResult(_0x9ad342,null))[_0xfad6('0x18')](handleError(_0x9ad342,null));};exports['describe']=function(_0x5d4b2a,_0x1295f8){return db['MailAccount'][_0xfad6('0x64')]()[_0xfad6('0xe')](respondWithResult(_0x1295f8,null))['catch'](handleError(_0x1295f8,null));};exports[_0xfad6('0x65')]=function(_0x34fde0,_0x6412fd){if(_0x34fde0[_0xfad6('0x60')]['id']){delete _0x34fde0[_0xfad6('0x60')]['id'];}return db[_0xfad6('0x47')][_0xfad6('0x62')]({'where':{'id':_0x34fde0['params']['id']}})[_0xfad6('0xe')](handleEntityNotFound(_0x6412fd,null))[_0xfad6('0xe')](function(_0x4a12cc){if(_0x4a12cc){_0x34fde0[_0xfad6('0x60')]['MailAccountId']=_0x4a12cc['id'];return db[_0xfad6('0x66')]['create'](_0x34fde0[_0xfad6('0x60')]);}})[_0xfad6('0xe')](respondWithResult(_0x6412fd,null))['catch'](handleError(_0x6412fd,null));};exports[_0xfad6('0x67')]=function(_0x213e2d,_0x14540d){var _0x25356d={'raw':![],'where':{}};var _0x41d3b3={};var _0x3f7739={'count':0x0,'rows':[]};return db[_0xfad6('0x47')]['findOne']({'where':{'id':_0x213e2d[_0xfad6('0x68')]['id']}})[_0xfad6('0xe')](handleEntityNotFound(_0x14540d,null))['then'](function(_0x53bc7f){if(_0x53bc7f){_0x41d3b3[_0xfad6('0x4b')]=_['keys'](db[_0xfad6('0x66')][_0xfad6('0x48')]);_0x41d3b3['query']=_[_0xfad6('0x5f')](_0x213e2d[_0xfad6('0x4c')]);_0x41d3b3['filters']=_['intersection'](_0x41d3b3[_0xfad6('0x4b')],_0x41d3b3[_0xfad6('0x4c')]);_0x25356d['attributes']=_[_0xfad6('0x4e')](_0x41d3b3[_0xfad6('0x4b')],qs['fields'](_0x213e2d[_0xfad6('0x4c')][_0xfad6('0x50')]));_0x25356d['attributes']=_0x25356d[_0xfad6('0x4f')][_0xfad6('0x51')]?_0x25356d['attributes']:_0x41d3b3[_0xfad6('0x4b')];if(!_0x213e2d[_0xfad6('0x4c')]['hasOwnProperty'](_0xfad6('0x53'))){_0x25356d[_0xfad6('0x1c')]=qs[_0xfad6('0x1c')](_0x213e2d[_0xfad6('0x4c')][_0xfad6('0x1c')]);_0x25356d['offset']=qs['offset'](_0x213e2d[_0xfad6('0x4c')][_0xfad6('0x1a')]);}_0x25356d[_0xfad6('0x69')]=qs[_0xfad6('0x54')](_0x213e2d[_0xfad6('0x4c')][_0xfad6('0x54')]);_0x25356d[_0xfad6('0x55')]=qs[_0xfad6('0x4d')](_[_0xfad6('0x6a')](_0x213e2d[_0xfad6('0x4c')],_0x41d3b3['filters']));_0x25356d[_0xfad6('0x55')][_0xfad6('0x6b')]=_0x53bc7f['id'];if(_0x213e2d[_0xfad6('0x4c')][_0xfad6('0x56')]){_0x25356d['where']=_[_0xfad6('0x57')](_0x25356d[_0xfad6('0x55')],{'$or':_[_0xfad6('0x46')](_0x25356d['attributes'],function(_0x2f86d2){var _0x2c3319={};_0x2c3319[_0x2f86d2]={'$like':'%'+_0x213e2d['query'][_0xfad6('0x56')]+'%'};return _0x2c3319;})});}_0x25356d=_[_0xfad6('0x57')]({},_0x25356d,_0x213e2d[_0xfad6('0x6c')]);return db[_0xfad6('0x66')][_0xfad6('0x1d')]({'where':_0x25356d[_0xfad6('0x55')]})[_0xfad6('0xe')](function(_0x1f1d20){_0x3f7739[_0xfad6('0x1d')]=_0x1f1d20;if(_0x213e2d[_0xfad6('0x4c')]['includeAll']){_0x25356d[_0xfad6('0x5a')]=[{'all':!![]}];}return db[_0xfad6('0x66')][_0xfad6('0x6d')](_0x25356d);})['then'](function(_0x52ae12){_0x3f7739[_0xfad6('0x5b')]=_0x52ae12;return _0x3f7739;});}})[_0xfad6('0xe')](respondWithFilteredResult(_0x14540d,_0x25356d))[_0xfad6('0x18')](handleError(_0x14540d,null));};exports[_0xfad6('0x6e')]=function(_0x36452a,_0x16bfff){return db['MailAccount'][_0xfad6('0x62')]({'where':{'id':_0x36452a[_0xfad6('0x68')]['id']}})[_0xfad6('0xe')](handleEntityNotFound(_0x16bfff,null))['then'](function(_0x28118c){if(_0x28118c){return _0x28118c[_0xfad6('0x6e')](_0x36452a[_0xfad6('0x4c')][_0xfad6('0x6f')]);}})[_0xfad6('0xe')](respondWithStatusCode(_0x16bfff,null))[_0xfad6('0x18')](handleError(_0x16bfff,null));};exports[_0xfad6('0x70')]=function(_0x12760,_0xc86c84){if(_0x12760[_0xfad6('0x60')]['id']){delete _0x12760['body']['id'];}return db[_0xfad6('0x47')][_0xfad6('0x62')]({'where':{'id':_0x12760['params']['id']}})[_0xfad6('0xe')](handleEntityNotFound(_0xc86c84,null))[_0xfad6('0xe')](function(_0x558c44){if(_0x558c44){_0x12760[_0xfad6('0x60')][_0xfad6('0x6b')]=_0x558c44['id'];return db[_0xfad6('0x71')][_0xfad6('0x72')](_0x12760[_0xfad6('0x60')]);}})['then'](respondWithResult(_0xc86c84,null))[_0xfad6('0x18')](handleError(_0xc86c84,null));};exports[_0xfad6('0x73')]=function(_0x3d24e5,_0x19c85b){var _0x36cded={'raw':![],'where':{}};var _0x16c4c6={};var _0x50b0f3={'count':0x0,'rows':[]};return db[_0xfad6('0x47')][_0xfad6('0x74')]({'where':{'id':_0x3d24e5[_0xfad6('0x68')]['id']}})[_0xfad6('0xe')](handleEntityNotFound(_0x19c85b,null))[_0xfad6('0xe')](function(_0x4ca407){if(_0x4ca407){_0x16c4c6[_0xfad6('0x4b')]=_[_0xfad6('0x5f')](db[_0xfad6('0x71')][_0xfad6('0x48')]);_0x16c4c6[_0xfad6('0x4c')]=_['keys'](_0x3d24e5[_0xfad6('0x4c')]);_0x16c4c6[_0xfad6('0x4d')]=_[_0xfad6('0x4e')](_0x16c4c6[_0xfad6('0x4b')],_0x16c4c6[_0xfad6('0x4c')]);_0x36cded[_0xfad6('0x4f')]=_[_0xfad6('0x4e')](_0x16c4c6[_0xfad6('0x4b')],qs[_0xfad6('0x50')](_0x3d24e5[_0xfad6('0x4c')][_0xfad6('0x50')]));_0x36cded[_0xfad6('0x4f')]=_0x36cded['attributes'][_0xfad6('0x51')]?_0x36cded['attributes']:_0x16c4c6['model'];if(!_0x3d24e5[_0xfad6('0x4c')]['hasOwnProperty'](_0xfad6('0x53'))){_0x36cded[_0xfad6('0x1c')]=qs['limit'](_0x3d24e5[_0xfad6('0x4c')][_0xfad6('0x1c')]);_0x36cded['offset']=qs[_0xfad6('0x1a')](_0x3d24e5[_0xfad6('0x4c')][_0xfad6('0x1a')]);}_0x36cded[_0xfad6('0x69')]=qs[_0xfad6('0x54')](_0x3d24e5[_0xfad6('0x4c')][_0xfad6('0x54')]);_0x36cded[_0xfad6('0x55')]=qs['filters'](_['pick'](_0x3d24e5[_0xfad6('0x4c')],_0x16c4c6['filters']));_0x36cded['where']['MailAccountId']=_0x4ca407['id'];if(_0x3d24e5[_0xfad6('0x4c')][_0xfad6('0x56')]){_0x36cded['where']=_[_0xfad6('0x57')](_0x36cded['where'],{'$or':_[_0xfad6('0x46')](_0x36cded[_0xfad6('0x4f')],function(_0x5e1e64){var _0x4161ec={};_0x4161ec[_0x5e1e64]={'$like':'%'+_0x3d24e5[_0xfad6('0x4c')][_0xfad6('0x56')]+'%'};return _0x4161ec;})});}_0x36cded=_[_0xfad6('0x57')]({},_0x36cded,_0x3d24e5[_0xfad6('0x6c')]);return db[_0xfad6('0x71')][_0xfad6('0x1d')]({'where':_0x36cded[_0xfad6('0x55')]})[_0xfad6('0xe')](function(_0x5e5633){_0x50b0f3[_0xfad6('0x1d')]=_0x5e5633;if(_0x3d24e5['query'][_0xfad6('0x59')]){_0x36cded[_0xfad6('0x5a')]=[{'all':!![]}];}return db[_0xfad6('0x71')][_0xfad6('0x6d')](_0x36cded);})['then'](function(_0x545d11){_0x50b0f3[_0xfad6('0x5b')]=_0x545d11;return _0x50b0f3;});}})['then'](respondWithFilteredResult(_0x19c85b,_0x36cded))[_0xfad6('0x18')](handleError(_0x19c85b,null));};exports[_0xfad6('0x75')]=function(_0x317984,_0x473355){return db['MailAccount']['find']({'where':{'id':_0x317984[_0xfad6('0x68')]['id']}})[_0xfad6('0xe')](handleEntityNotFound(_0x473355,null))['then'](function(_0xf15a5d){if(_0xf15a5d){return _0xf15a5d[_0xfad6('0x75')](_0x317984[_0xfad6('0x4c')][_0xfad6('0x6f')]);}})[_0xfad6('0xe')](respondWithStatusCode(_0x473355,null))[_0xfad6('0x18')](handleError(_0x473355,null));};exports['create']=function(_0x314b16,_0x47c8b6){var _0x417c59={'name':_0x314b16['body']['name'],'key':_0x314b16[_0xfad6('0x60')][_0xfad6('0x4a')],'provider':_0x314b16[_0xfad6('0x60')][_0xfad6('0x61')]===_0xfad6('0x76')?null:_0x314b16[_0xfad6('0x60')][_0xfad6('0x61')],'email':_0x314b16[_0xfad6('0x60')][_0xfad6('0x77')],'ListId':_0x314b16['body']['ListId'],'active':!_[_0xfad6('0x78')](_0x314b16[_0xfad6('0x60')][_0xfad6('0x79')])?_0x314b16[_0xfad6('0x60')][_0xfad6('0x79')]:!![],'description':_0x314b16[_0xfad6('0x60')][_0xfad6('0x7a')]||null};var _0x132fe4=getAuthenticationOptions(_0x417c59['provider'],_0x314b16['body']);_0x417c59['Imap']=_0x132fe4[_0xfad6('0x41')];_0x417c59[_0xfad6('0x42')]=_0x132fe4['Smtp'];return db[_0xfad6('0x47')][_0xfad6('0x72')](_0x417c59,{'include':[{'model':db[_0xfad6('0x5d')],'as':'Smtp'},{'model':db[_0xfad6('0x44')],'as':'Imap'}]})['then'](function(_0x5353ce){var _0xbf35=_0x314b16['user'][_0xfad6('0x22')]({'plain':!![]});if(!_0xbf35)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xbf35[_0xfad6('0x7b')]===_0xfad6('0x36')){var _0x47beea=_0x5353ce[_0xfad6('0x22')]({'plain':!![]});return db['UserProfileSection'][_0xfad6('0x62')]({'where':{'name':_0xfad6('0x7c'),'userProfileId':_0xbf35[_0xfad6('0x7d')]},'raw':!![]})['then'](function(_0x5a5f09){if(_0x5a5f09&&_0x5a5f09['autoAssociation']===0x0){return db[_0xfad6('0x23')]['create']({'name':_0x47beea[_0xfad6('0x27')],'resourceId':_0x47beea['id'],'type':_0x5a5f09[_0xfad6('0x27')],'sectionId':_0x5a5f09['id']},{})[_0xfad6('0xe')](function(){return _0x5353ce;});}else{return _0x5353ce;}})[_0xfad6('0x18')](function(_0x1d5737){logger[_0xfad6('0x14')](_0xfad6('0x7e'),_0x1d5737);throw _0x1d5737;});}return _0x5353ce;})[_0xfad6('0xe')](respondWithResult(_0x47c8b6,0xc9))[_0xfad6('0x18')](handleError(_0x47c8b6,null));};exports[_0xfad6('0x7f')]=function(_0x56387a,_0x4ef98b){return db[_0xfad6('0x47')]['findOne']({'where':{'id':_0x56387a[_0xfad6('0x68')]['id']}})[_0xfad6('0xe')](handleEntityNotFound(_0x4ef98b,null))[_0xfad6('0xe')](function(_0x45476d){if(_0x45476d){return _0x45476d[_0xfad6('0x7f')]();}return null;})[_0xfad6('0xe')](respondWithResult(_0x4ef98b,null))[_0xfad6('0x18')](handleError(_0x4ef98b,null));};exports[_0xfad6('0x80')]=function(_0x44e768,_0x123241){if(_0x44e768['body']['id']){delete _0x44e768['body']['id'];}return db['MailAccount'][_0xfad6('0x62')]({'where':{'id':_0x44e768['params']['id']}})[_0xfad6('0xe')](handleEntityNotFound(_0x123241,null))[_0xfad6('0xe')](function(_0x12a831){if(_0x12a831){_0x44e768['body'][_0xfad6('0x6b')]=_0x12a831['id'];return db[_0xfad6('0x44')][_0xfad6('0x72')](_0x44e768[_0xfad6('0x60')]);}})[_0xfad6('0xe')](respondWithResult(_0x123241,null))['catch'](handleError(_0x123241,null));};exports[_0xfad6('0x81')]=function(_0x2e2cac,_0x19a977){return db['MailAccount'][_0xfad6('0x74')]({'where':{'id':_0x2e2cac[_0xfad6('0x68')]['id']}})[_0xfad6('0xe')](handleEntityNotFound(_0x19a977,null))[_0xfad6('0xe')](function(_0x27adca){if(_0x27adca){return _0x27adca[_0xfad6('0x82')](null);}return null;})['then'](respondWithStatusCode(_0x19a977,null))['catch'](handleError(_0x19a977,null));};exports['getSmtp']=function(_0x476a03,_0x306c00){return db['MailAccount'][_0xfad6('0x74')]({'where':{'id':_0x476a03[_0xfad6('0x68')]['id']}})[_0xfad6('0xe')](handleEntityNotFound(_0x306c00,null))[_0xfad6('0xe')](function(_0x1724b5){if(_0x1724b5){return _0x1724b5[_0xfad6('0x83')]();}return null;})['then'](respondWithResult(_0x306c00,null))['catch'](handleError(_0x306c00,null));};exports[_0xfad6('0x84')]=function(_0x299d8f,_0x41ecfa){if(_0x299d8f['body']['id']){delete _0x299d8f[_0xfad6('0x60')]['id'];}return db[_0xfad6('0x47')][_0xfad6('0x62')]({'where':{'id':_0x299d8f[_0xfad6('0x68')]['id']}})[_0xfad6('0xe')](handleEntityNotFound(_0x41ecfa,null))[_0xfad6('0xe')](function(_0x44be66){if(_0x44be66){_0x299d8f[_0xfad6('0x60')][_0xfad6('0x6b')]=_0x44be66['id'];return db['MailServerOut'][_0xfad6('0x72')](_0x299d8f[_0xfad6('0x60')]);}})[_0xfad6('0xe')](respondWithResult(_0x41ecfa,null))[_0xfad6('0x18')](handleError(_0x41ecfa,null));};exports['removeSmtp']=function(_0x131562,_0x46c2e1){return db[_0xfad6('0x47')][_0xfad6('0x74')]({'where':{'id':_0x131562[_0xfad6('0x68')]['id']}})[_0xfad6('0xe')](handleEntityNotFound(_0x46c2e1,null))[_0xfad6('0xe')](function(_0x53e388){if(_0x53e388){return _0x53e388[_0xfad6('0x85')](null);}return null;})[_0xfad6('0xe')](respondWithStatusCode(_0x46c2e1,null))[_0xfad6('0x18')](handleError(_0x46c2e1,null));};exports[_0xfad6('0x86')]=function(_0x5121b0,_0xa6408f){return db[_0xfad6('0x87')][_0xfad6('0x62')]({'where':{'id':_0x5121b0[_0xfad6('0x68')]['id']}})[_0xfad6('0xe')](handleEntityNotFound(_0xa6408f,null))['then'](function(_0x1dc1b6){if(_0x1dc1b6){return _0x1dc1b6[_0xfad6('0x86')](_0x5121b0[_0xfad6('0x60')][_0xfad6('0x6f')],_[_0xfad6('0x88')](_0x5121b0[_0xfad6('0x60')],[_0xfad6('0x6f'),'id'])||{});}})[_0xfad6('0xe')](respondWithResult(_0xa6408f,null))['catch'](handleError(_0xa6408f,null));};exports[_0xfad6('0x89')]=function(_0x144242,_0x1bd23e){var _0x2a853c={'raw':![],'where':{}};var _0x562854={};var _0x311c2e={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x144242[_0xfad6('0x68')]['id']}})[_0xfad6('0xe')](handleEntityNotFound(_0x1bd23e,null))[_0xfad6('0xe')](function(_0x6f010a){if(_0x6f010a){_0x562854[_0xfad6('0x4b')]=_[_0xfad6('0x5f')](db[_0xfad6('0x87')][_0xfad6('0x48')]);_0x562854['query']=_[_0xfad6('0x5f')](_0x144242['query']);_0x562854['filters']=_[_0xfad6('0x4e')](_0x562854[_0xfad6('0x4b')],_0x562854[_0xfad6('0x4c')]);_0x2a853c[_0xfad6('0x4f')]=_[_0xfad6('0x4e')](_0x562854[_0xfad6('0x4b')],qs['fields'](_0x144242[_0xfad6('0x4c')][_0xfad6('0x50')]));_0x2a853c[_0xfad6('0x4f')]=_0x2a853c[_0xfad6('0x4f')][_0xfad6('0x51')]?_0x2a853c[_0xfad6('0x4f')]:_0x562854[_0xfad6('0x4b')];if(!_0x144242[_0xfad6('0x4c')][_0xfad6('0x52')](_0xfad6('0x53'))){_0x2a853c['limit']=qs[_0xfad6('0x1c')](_0x144242['query'][_0xfad6('0x1c')]);_0x2a853c[_0xfad6('0x1a')]=qs[_0xfad6('0x1a')](_0x144242['query'][_0xfad6('0x1a')]);}_0x2a853c['order']=qs['sort'](_0x144242[_0xfad6('0x4c')]['sort']);_0x2a853c[_0xfad6('0x55')]=qs['filters'](_[_0xfad6('0x6a')](_0x144242[_0xfad6('0x4c')],_0x562854[_0xfad6('0x4d')]));_0x2a853c[_0xfad6('0x55')][_0xfad6('0x6b')]=_0x6f010a['id'];if(_0x144242[_0xfad6('0x4c')][_0xfad6('0x56')]){_0x2a853c[_0xfad6('0x55')]=_[_0xfad6('0x57')](_0x2a853c[_0xfad6('0x55')],{'$or':_[_0xfad6('0x46')](_0x2a853c['attributes'],function(_0x45fbe5){var _0x2f9ea6={};_0x2f9ea6[_0x45fbe5]={'$like':'%'+_0x144242[_0xfad6('0x4c')][_0xfad6('0x56')]+'%'};return _0x2f9ea6;})});}_0x2a853c=_['merge']({},_0x2a853c,_0x144242[_0xfad6('0x6c')]);return db[_0xfad6('0x87')][_0xfad6('0x1d')]({'where':_0x2a853c[_0xfad6('0x55')]})[_0xfad6('0xe')](function(_0x418093){_0x311c2e[_0xfad6('0x1d')]=_0x418093;if(_0x144242[_0xfad6('0x4c')][_0xfad6('0x59')]){_0x2a853c[_0xfad6('0x5a')]=[{'model':db['CmContact'],'as':_0xfad6('0x8a'),'required':![]},{'model':db[_0xfad6('0x8b')],'as':_0xfad6('0x8c'),'attributes':['name',_0xfad6('0x8d'),_0xfad6('0x8e')],'required':![]},{'model':db[_0xfad6('0x8f')],'as':_0xfad6('0x90'),'attributes':['id','name','color'],'where':_0x144242[_0xfad6('0x4c')][_0xfad6('0x91')]?{'id':_0x144242[_0xfad6('0x4c')][_0xfad6('0x91')]}:undefined,'required':_0x144242[_0xfad6('0x4c')][_0xfad6('0x91')]?!![]:![]}];}return db[_0xfad6('0x87')][_0xfad6('0x6d')](_0x2a853c);})[_0xfad6('0xe')](function(_0x3fb4a5){_0x311c2e['rows']=_0x3fb4a5;return _0x311c2e;});}})[_0xfad6('0xe')](respondWithFilteredResult(_0x1bd23e,_0x2a853c))[_0xfad6('0x18')](handleError(_0x1bd23e,null));};exports['addApplications']=function addApplications(_0x320848,_0x2173f0){var _0x42f40d=_0x320848[_0xfad6('0x68')]['id'];var _0x49fb6c=_0x320848[_0xfad6('0x60')];var _0x4c85cd=0xc8;var _0x22c1c9=null;return db['sequelize'][_0xfad6('0x92')]({'isolationLevel':db['sequelize']['Transaction'][_0xfad6('0x93')][_0xfad6('0x94')]},function(_0x13c8e6){return db[_0xfad6('0x47')][_0xfad6('0x74')]({'where':{'id':_0x42f40d},'transaction':_0x13c8e6})[_0xfad6('0xe')](function(_0x17f80c){if(_0x17f80c){return db[_0xfad6('0x95')][_0xfad6('0x21')]({'where':{'MailAccountId':_0x42f40d},'transaction':_0x13c8e6})[_0xfad6('0xe')](function(){var _0x38dde7=_[_0xfad6('0x46')](_0x49fb6c,function(_0x21b126){_0x21b126['MailAccountId']=_0x42f40d;return _0x21b126;});return db[_0xfad6('0x95')][_0xfad6('0x96')](_0x38dde7,{'transaction':_0x13c8e6});});}else{_0x4c85cd=0x194;_0x22c1c9=[];}});})[_0xfad6('0xe')](function(){if(_0x4c85cd!==0x194){return db[_0xfad6('0x95')][_0xfad6('0x97')]({'where':{'MailAccountId':_0x42f40d},'order':'priority'})[_0xfad6('0xe')](function(_0x2a135f){_0x22c1c9=_0x2a135f;});}})['catch'](function(_0x4081a6){_0x4c85cd=0x1f4;logger['error'](_0x4081a6[_0xfad6('0x26')]);if(_0x4081a6[_0xfad6('0x27')]){delete _0x4081a6[_0xfad6('0x27')];}_0x22c1c9=_0x4081a6;})['finally'](function(){if(_0x22c1c9===null){_0x2173f0[_0xfad6('0x25')](_0x4c85cd);}else{if(_0x4c85cd===0x1f4){_0x2173f0[_0xfad6('0x19')](_0x4c85cd)[_0xfad6('0x28')](_0x22c1c9);}else{_0x2173f0[_0xfad6('0x19')](_0x4c85cd)[_0xfad6('0x1f')](_0x22c1c9);}}});};exports['getApplications']=function(_0x4c882f,_0x163df9){var _0x560216={};var _0x1628e3={};var _0x34169c;var _0x5b33d1;return db['MailAccount']['findOne']({'where':{'id':_0x4c882f['params']['id']}})['then'](handleEntityNotFound(_0x163df9,null))[_0xfad6('0xe')](function(_0x321280){if(_0x321280){_0x34169c=_0x321280;_0x1628e3[_0xfad6('0x4b')]=_[_0xfad6('0x5f')](db[_0xfad6('0x95')][_0xfad6('0x48')]);_0x1628e3[_0xfad6('0x4c')]=_[_0xfad6('0x5f')](_0x4c882f[_0xfad6('0x4c')]);_0x1628e3['filters']=_[_0xfad6('0x4e')](_0x1628e3[_0xfad6('0x4b')],_0x1628e3['query']);_0x560216[_0xfad6('0x4f')]=_['intersection'](_0x1628e3[_0xfad6('0x4b')],qs[_0xfad6('0x50')](_0x4c882f[_0xfad6('0x4c')]['fields']));_0x560216['attributes']=_0x560216[_0xfad6('0x4f')][_0xfad6('0x51')]?_0x560216[_0xfad6('0x4f')]:_0x1628e3[_0xfad6('0x4b')];_0x560216[_0xfad6('0x69')]=qs[_0xfad6('0x54')](_0x4c882f[_0xfad6('0x4c')][_0xfad6('0x54')]);_0x560216[_0xfad6('0x55')]=qs[_0xfad6('0x4d')](_[_0xfad6('0x6a')](_0x4c882f['query'],_0x1628e3[_0xfad6('0x4d')]));if(_0x4c882f[_0xfad6('0x4c')][_0xfad6('0x56')]){_0x560216['where']=_['merge'](_0x560216['where'],{'$or':_[_0xfad6('0x46')](_0x560216[_0xfad6('0x4f')],function(_0x235e61){var _0xb7cdbc={};_0xb7cdbc[_0x235e61]={'$like':'%'+_0x4c882f[_0xfad6('0x4c')][_0xfad6('0x56')]+'%'};return _0xb7cdbc;})});}_0x560216=_[_0xfad6('0x57')]({},_0x560216,_0x4c882f[_0xfad6('0x6c')]);return _0x34169c[_0xfad6('0x98')](_0x560216);}})['then'](function(_0x4e14b0){if(_0x4e14b0){_0x5b33d1=_0x4e14b0[_0xfad6('0x51')];if(!_0x4c882f[_0xfad6('0x4c')][_0xfad6('0x52')](_0xfad6('0x53'))){_0x560216['limit']=qs[_0xfad6('0x1c')](_0x4c882f[_0xfad6('0x4c')][_0xfad6('0x1c')]);_0x560216[_0xfad6('0x1a')]=qs[_0xfad6('0x1a')](_0x4c882f[_0xfad6('0x4c')][_0xfad6('0x1a')]);}return _0x34169c['getApplications'](_0x560216);}})[_0xfad6('0xe')](function(_0x3dbfb7){if(_0x3dbfb7){return _0x3dbfb7?{'count':_0x5b33d1,'rows':_0x3dbfb7}:null;}})['then'](respondWithResult(_0x163df9,null))[_0xfad6('0x18')](handleError(_0x163df9,null));};exports[_0xfad6('0x99')]=function(_0x532bf7,_0xa5e5ca){var _0x2414d0={'raw':!![],'where':{}};var _0x52128e={};var _0x19a89b={'count':0x0,'rows':[]};return db[_0xfad6('0x47')][_0xfad6('0x74')]({'where':{'id':_0x532bf7[_0xfad6('0x68')]['id']}})[_0xfad6('0xe')](handleEntityNotFound(_0xa5e5ca,null))['then'](function(_0x5cd670){if(_0x5cd670){_0x52128e[_0xfad6('0x4b')]=_['keys'](db['MailMessage'][_0xfad6('0x48')]);_0x52128e[_0xfad6('0x4c')]=_['keys'](_0x532bf7[_0xfad6('0x4c')]);_0x52128e['filters']=_[_0xfad6('0x4e')](_0x52128e[_0xfad6('0x4b')],_0x52128e[_0xfad6('0x4c')]);_0x2414d0['attributes']=_[_0xfad6('0x4e')](_0x52128e[_0xfad6('0x4b')],qs[_0xfad6('0x50')](_0x532bf7[_0xfad6('0x4c')][_0xfad6('0x50')]));_0x2414d0[_0xfad6('0x4f')]=_0x2414d0[_0xfad6('0x4f')]['length']?_0x2414d0['attributes']:_0x52128e[_0xfad6('0x4b')];if(!_0x532bf7['query'][_0xfad6('0x52')](_0xfad6('0x53'))){_0x2414d0[_0xfad6('0x1c')]=qs[_0xfad6('0x1c')](_0x532bf7[_0xfad6('0x4c')][_0xfad6('0x1c')]);_0x2414d0[_0xfad6('0x1a')]=qs[_0xfad6('0x1a')](_0x532bf7[_0xfad6('0x4c')][_0xfad6('0x1a')]);}_0x2414d0[_0xfad6('0x69')]=qs[_0xfad6('0x54')](_0x532bf7['query'][_0xfad6('0x54')]);_0x2414d0['where']=qs['filters'](_[_0xfad6('0x6a')](_0x532bf7[_0xfad6('0x4c')],_0x52128e[_0xfad6('0x4d')]));_0x2414d0['where'][_0xfad6('0x6b')]=_0x5cd670['id'];if(_0x532bf7[_0xfad6('0x4c')][_0xfad6('0x56')]){_0x2414d0[_0xfad6('0x55')]=_[_0xfad6('0x57')](_0x2414d0[_0xfad6('0x55')],{'$or':_[_0xfad6('0x46')](_0x2414d0[_0xfad6('0x4f')],function(_0x5b5f4e){var _0x43395e={};_0x43395e[_0x5b5f4e]={'$like':'%'+_0x532bf7[_0xfad6('0x4c')][_0xfad6('0x56')]+'%'};return _0x43395e;})});}if(_0x532bf7[_0xfad6('0x4c')][_0xfad6('0x9a')]){var _0x3a99ef=_0x532bf7['query'][_0xfad6('0x9a')][_0xfad6('0x9b')](',');var _0x2921aa={};_0x2921aa[_0x3a99ef[0x0]]={'$gte':moment(_0x3a99ef[0x1])[_0xfad6('0x9c')]('YYYY-MM-DD\x20HH:mm:ss')};_0x2414d0['where']=_[_0xfad6('0x57')](_0x2414d0[_0xfad6('0x55')],_0x2921aa);}_0x2414d0=_[_0xfad6('0x57')]({},_0x2414d0,_0x532bf7[_0xfad6('0x6c')]);return db[_0xfad6('0x9d')]['count']({'where':_0x2414d0[_0xfad6('0x55')]})[_0xfad6('0xe')](function(_0x35a7e8){_0x19a89b[_0xfad6('0x1d')]=_0x35a7e8;if(_0x532bf7['query'][_0xfad6('0x59')]){_0x2414d0[_0xfad6('0x5a')]=[{'all':!![]}];}return db[_0xfad6('0x9d')][_0xfad6('0x6d')](_0x2414d0);})['then'](function(_0x387949){if(_0x532bf7[_0xfad6('0x4c')]['inlineCss']==='true'){for(var _0x2f56c8=0x0;_0x2f56c8<_0x387949[_0xfad6('0x51')];_0x2f56c8++){_0x387949[_0x2f56c8][_0xfad6('0x60')]=juice(_0x387949[_0x2f56c8][_0xfad6('0x60')]);}}_0x19a89b['rows']=_0x387949;return _0x19a89b;});}})['then'](respondWithFilteredResult(_0xa5e5ca,_0x2414d0))['catch'](handleError(_0xa5e5ca,null));};exports[_0xfad6('0x28')]=function(_0x58c9ed,_0x18c965){var _0x31a866,_0xa030e4={},_0x50de08;if(_0x58c9ed[_0xfad6('0x60')]['to']){_0x50de08=_0x58c9ed[_0xfad6('0x60')]['to']['split'](',')[0x0];}return db['MailAccount'][_0xfad6('0x62')]({'where':{'id':_0x58c9ed[_0xfad6('0x68')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0xfad6('0x9e')],'as':'Contacts','where':{'email':_0x50de08},'limit':0x1,'order':[[_0xfad6('0x9f'),_0xfad6('0xa0')]]}]},{'model':db[_0xfad6('0x5d')],'as':_0xfad6('0x42'),'raw':!![],'include':[{'model':db[_0xfad6('0xa1')],'as':_0xfad6('0xa1'),'raw':!![]}]}]})[_0xfad6('0xe')](handleEntityNotFound(_0x18c965,null))[_0xfad6('0xe')](function(_0x1eb72d){if(!_0x1eb72d)return;_0x31a866=_0x1eb72d;if(!_0x1eb72d['Smtp'])throw new Error(_0xfad6('0xa2'));if(_['isNil'](_0x58c9ed[_0xfad6('0x60')]['from'])){_0x58c9ed['body'][_0xfad6('0xa3')]=util[_0xfad6('0x9c')](_0xfad6('0xa4'),_0x1eb72d[_0xfad6('0x27')],_0x1eb72d['email']||_0x1eb72d['Smtp']['user']);}if(_0x58c9ed[_0xfad6('0x60')][_0xfad6('0xa5')]&&_0x58c9ed[_0xfad6('0x60')][_0xfad6('0xa5')][_0xfad6('0x51')]){for(var _0xe17781=0x0;_0xe17781<_0x58c9ed['body'][_0xfad6('0xa5')][_0xfad6('0x51')];_0xe17781+=0x1){_0x58c9ed[_0xfad6('0x60')][_0xfad6('0xa5')][_0xe17781]={'filename':_0x58c9ed[_0xfad6('0x60')][_0xfad6('0xa5')][_0xe17781]['name'],'path':path[_0xfad6('0xa6')](config['root'],_0xfad6('0xa7'),_0x58c9ed['body'][_0xfad6('0xa5')][_0xe17781][_0xfad6('0xa8')])};}}var _0x428094=_0x1eb72d[_0xfad6('0xa9')]();return respondWithRpcPromise('SendMail',_0xfad6('0xaa'),{'account':_0x428094,'message':_0x58c9ed['body']});})['then'](function(_0x62d8ec){if(!_0x62d8ec)return;_0xa030e4=_0x62d8ec;if(!_0x31a866[_0xfad6('0xab')])throw new Error('List\x20not\x20found');if(_0x31a866[_0xfad6('0xab')]['Contacts'][_0xfad6('0x51')])return _0x31a866['List'][_0xfad6('0xac')][0x0];return db['CmContact'][_0xfad6('0x72')](_[_0xfad6('0x7')](_0x58c9ed[_0xfad6('0x60')],{'firstName':_0x58c9ed[_0xfad6('0x60')]['to'],'email':_0x58c9ed[_0xfad6('0x60')]['to'],'phone':_0x58c9ed['body']['to'],'ListId':_0x31a866['ListId']}));})[_0xfad6('0xe')](function(_0x4a8400){if(!_0x4a8400)return;var _0x45bc01={'UserId':_0x58c9ed[_0xfad6('0x36')]['id'],'ContactId':_0x4a8400['id'],'MailAccountId':_0x31a866['id'],'inReplyTo':_0xa030e4[_0xfad6('0xad')],'to':_0x58c9ed['body'][_0xfad6('0xa3')],'cc':_0x58c9ed[_0xfad6('0x60')]['cc'],'subject':_0x58c9ed[_0xfad6('0x60')][_0xfad6('0xae')],'attach':_0x58c9ed[_0xfad6('0x60')][_0xfad6('0xaf')],'firstMsgDirection':_0xfad6('0xb0'),'lastMsgAt':moment()['format'](_0xfad6('0xb1')),'lastMsgDirection':'out','Messages':[_['merge'](_0x58c9ed['body'],{'messageId':_0xa030e4[_0xfad6('0xad')],'sentAt':moment()['format'](_0xfad6('0xb1')),'read':!![],'MailAccountId':_0x31a866['id'],'UserId':_0x58c9ed[_0xfad6('0x36')]['id'],'ContactId':_0x4a8400['id']})]};if(_0x58c9ed[_0xfad6('0x60')][_0xfad6('0xb2')]){_0x45bc01=_[_0xfad6('0x57')](_0x45bc01,_0x58c9ed[_0xfad6('0x60')][_0xfad6('0xb2')]);}return db[_0xfad6('0x87')][_0xfad6('0x72')](_0x45bc01,{'include':[{'model':db['MailMessage'],'as':_0xfad6('0xb3')}]});})['then'](respondWithResult(_0x18c965,null))[_0xfad6('0x18')](handleError(_0x18c965,null));};exports['verifySmtp']=function(_0x43d15e,_0x3f0ca5){return db['MailAccount']['find']({'where':{'id':_0x43d15e[_0xfad6('0x68')]['id']},'include':[{'model':db[_0xfad6('0x5d')],'as':_0xfad6('0x42'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','raw':!![]}]}]})[_0xfad6('0xe')](handleEntityNotFound(_0x3f0ca5,null))[_0xfad6('0xe')](function(_0x1e3199){if(!_0x1e3199[_0xfad6('0x42')])return;var _0x12555c=_0x1e3199['getSmtpOptions']();return respondWithRpcPromise('VerifySmtp',_0xfad6('0xb4'),{'account':_0x12555c});})[_0xfad6('0xe')](respondWithResult(_0x3f0ca5,null))[_0xfad6('0x18')](handleError(_0x3f0ca5,null));};exports[_0xfad6('0x21')]=function(_0x1fde79,_0x31e3e5){return db[_0xfad6('0x47')][_0xfad6('0x62')]({'where':{'id':_0x1fde79[_0xfad6('0x68')]['id']}})[_0xfad6('0xe')](handleEntityNotFound(_0x31e3e5,null))[_0xfad6('0xe')](function(_0x15d156){if(_0x15d156&&_0x15d156[_0xfad6('0x3f')]){throw new db[(_0xfad6('0xb5'))]['ValidationError'](_0xfad6('0xb6'));}return _0x15d156;})[_0xfad6('0xe')](removeEntity(_0x31e3e5,null))[_0xfad6('0x18')](handleError(_0x31e3e5,null));};exports[_0xfad6('0xb7')]=function(_0x2ec41a,_0x3a382b){return db[_0xfad6('0x47')][_0xfad6('0x62')]({'where':{'id':_0x2ec41a[_0xfad6('0x68')]['id']}})[_0xfad6('0xe')](handleEntityNotFound(_0x3a382b,null))[_0xfad6('0xe')](function(_0x2be2c7){if(_0x2be2c7){return _0x2be2c7[_0xfad6('0xb7')](_0x2ec41a[_0xfad6('0x60')][_0xfad6('0x6f')],_[_0xfad6('0x88')](_0x2ec41a[_0xfad6('0x60')],[_0xfad6('0x6f'),'id'])||{})[_0xfad6('0xb8')](function(_0x44f3d9){for(var _0x40b9b3=0x0;_0x40b9b3<_0x2ec41a[_0xfad6('0x60')]['ids'][_0xfad6('0x51')];_0x40b9b3+=0x1){socket[_0xfad6('0xb9')]('userMailAccount:save',{'UserId':Number(_0x2ec41a[_0xfad6('0x60')][_0xfad6('0x6f')][_0x40b9b3]),'MailAccountId':Number(_0x2ec41a[_0xfad6('0x68')]['id'])});}return _0x44f3d9;});}})[_0xfad6('0xe')](respondWithResult(_0x3a382b,null))[_0xfad6('0x18')](handleError(_0x3a382b,null));};exports[_0xfad6('0xba')]=function(_0x1e6a7b,_0x20cc92){return db[_0xfad6('0x47')][_0xfad6('0x62')]({'where':{'id':_0x1e6a7b[_0xfad6('0x68')]['id']}})[_0xfad6('0xe')](handleEntityNotFound(_0x20cc92,null))[_0xfad6('0xe')](function(_0x2eb8d7){if(_0x2eb8d7){return _0x2eb8d7['removeAgents'](_0x1e6a7b[_0xfad6('0x4c')]['ids'])[_0xfad6('0xe')](function(){if(_['isArray'](_0x1e6a7b['query'][_0xfad6('0x6f')])){for(var _0x17f299=0x0;_0x17f299<_0x1e6a7b[_0xfad6('0x4c')][_0xfad6('0x6f')][_0xfad6('0x51')];_0x17f299+=0x1){socket[_0xfad6('0xb9')]('userMailAccount:remove',{'UserId':Number(_0x1e6a7b[_0xfad6('0x4c')][_0xfad6('0x6f')][_0x17f299]),'MailAccountId':Number(_0x1e6a7b[_0xfad6('0x68')]['id'])});}}else{socket[_0xfad6('0xb9')](_0xfad6('0xbb'),{'UserId':Number(_0x1e6a7b['query'][_0xfad6('0x6f')]),'MailAccountId':Number(_0x1e6a7b[_0xfad6('0x68')]['id'])});}});}})[_0xfad6('0xe')](respondWithStatusCode(_0x20cc92,null))['catch'](handleError(_0x20cc92,null));};exports[_0xfad6('0xbc')]=function(_0x275f82,_0x35d633){var _0x1099f6={};var _0x4fbcb5={};var _0x131bb1;var _0xf58656;return db[_0xfad6('0x47')]['findOne']({'where':{'id':_0x275f82['params']['id']}})[_0xfad6('0xe')](handleEntityNotFound(_0x35d633,null))[_0xfad6('0xe')](function(_0x516e23){if(_0x516e23){_0x131bb1=_0x516e23;_0x4fbcb5[_0xfad6('0x4b')]=_[_0xfad6('0x5f')](db['User'][_0xfad6('0x48')]);_0x4fbcb5[_0xfad6('0x4c')]=_[_0xfad6('0x5f')](_0x275f82[_0xfad6('0x4c')]);_0x4fbcb5[_0xfad6('0x4d')]=_['intersection'](_0x4fbcb5['model'],_0x4fbcb5[_0xfad6('0x4c')]);_0x1099f6[_0xfad6('0x4f')]=_[_0xfad6('0x4e')](_0x4fbcb5[_0xfad6('0x4b')],qs['fields'](_0x275f82['query'][_0xfad6('0x50')]));_0x1099f6['attributes']=_0x1099f6[_0xfad6('0x4f')][_0xfad6('0x51')]?_0x1099f6[_0xfad6('0x4f')]:_0x4fbcb5['model'];_0x1099f6[_0xfad6('0x69')]=qs[_0xfad6('0x54')](_0x275f82['query'][_0xfad6('0x54')]);_0x1099f6['where']=qs[_0xfad6('0x4d')](_[_0xfad6('0x6a')](_0x275f82[_0xfad6('0x4c')],_0x4fbcb5[_0xfad6('0x4d')]));if(_0x275f82[_0xfad6('0x4c')]['filter']){_0x1099f6[_0xfad6('0x55')]=_[_0xfad6('0x57')](_0x1099f6['where'],{'$or':_[_0xfad6('0x46')](_0x1099f6[_0xfad6('0x4f')],function(_0xd201ed){var _0x5714a0={};_0x5714a0[_0xd201ed]={'$like':'%'+_0x275f82[_0xfad6('0x4c')][_0xfad6('0x56')]+'%'};return _0x5714a0;})});}_0x1099f6=_['merge']({},_0x1099f6,_0x275f82[_0xfad6('0x6c')]);return _0x131bb1[_0xfad6('0xbc')](_0x1099f6);}})[_0xfad6('0xe')](function(_0x1525d5){if(_0x1525d5){_0xf58656=_0x1525d5[_0xfad6('0x51')];if(!_0x275f82[_0xfad6('0x4c')][_0xfad6('0x52')](_0xfad6('0x53'))){_0x1099f6[_0xfad6('0x1c')]=qs[_0xfad6('0x1c')](_0x275f82['query'][_0xfad6('0x1c')]);_0x1099f6[_0xfad6('0x1a')]=qs[_0xfad6('0x1a')](_0x275f82[_0xfad6('0x4c')][_0xfad6('0x1a')]);}return _0x131bb1[_0xfad6('0xbc')](_0x1099f6);}})['then'](function(_0x1b03b2){if(_0x1b03b2){return _0x1b03b2?{'count':_0xf58656,'rows':_0x1b03b2}:null;}})[_0xfad6('0xe')](respondWithResult(_0x35d633,null))[_0xfad6('0x18')](handleError(_0x35d633,null));}; \ No newline at end of file +var _0xd571=['Owner','fullname','internal','Tags','color','tag','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','findAndCountAll','priority','finally','getApplications','getMessages','MailMessage','$gte','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','split','CmList','List','CmContact','Contacts','DESC','CloudProvider','from','%s\x20<%s>','email','attachments','join','root','server/files/attachments','basename','getSmtpOptions','SendMail','sendMail','subject','attach','out','Interaction','Messages','verifySmtp','VerifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','userMailAccount:save','removeAgents','isArray','emit','userMailAccount:remove','getAgents','bluebird','util','path','juice','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','client','http','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','destroy','get','MailAccounts','UserProfileResource','stack','name','send','gmail','imap.gmail.com','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','username','password','pass','modernAuthentication','CloudProviderId','host','port','secure','service','authentication','user','Imap','Smtp','index','MailServerIn','MailServerOut','Pause','mandatoryDispositionPause','map','MailAccount','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','VIRTUAL','filter','merge','where','includeAll','include','findAll','show','params','length','options','find','body','provider','Mail\x20Account\x20not\x20found','describe','addDisposition','MailAccountId','Disposition','create','getDispositions','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','custom','ListId','active','description','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','findOne','addImap','removeImap','removeSmtp','setSmtp','addInteraction','MailInteraction','omit','getInteractions','Contact','User'];(function(_0xeff563,_0x5eae5b){var _0x1d25e2=function(_0x2de1c8){while(--_0x2de1c8){_0xeff563['push'](_0xeff563['shift']());}};_0x1d25e2(++_0x5eae5b);}(_0xd571,0x1cb));var _0x1d57=function(_0x2ba5dd,_0x381f44){_0x2ba5dd=_0x2ba5dd-0x0;var _0x2605f6=_0xd571[_0x2ba5dd];return _0x2605f6;};'use strict';var moment=require('moment');var BPromise=require(_0x1d57('0x0'));var util=require(_0x1d57('0x1'));var path=require(_0x1d57('0x2'));var _=require('lodash');var juice=require(_0x1d57('0x3'));var Redis=require(_0x1d57('0x4'));var qs=require(_0x1d57('0x5'));var logger=require('../../config/logger')(_0x1d57('0x6'));var config=require(_0x1d57('0x7'));var db=require(_0x1d57('0x8'))['db'];config[_0x1d57('0x9')]=_[_0x1d57('0xa')](config[_0x1d57('0x9')],{'host':_0x1d57('0xb'),'port':0x18eb});var socket=require(_0x1d57('0xc'))(new Redis(config['redis']));require(_0x1d57('0xd'))[_0x1d57('0xe')](socket);var jayson=require('jayson/promise');var client=jayson[_0x1d57('0xf')][_0x1d57('0x10')]({'port':0x232b});function respondWithRpcPromise(_0x26c307,_0x58ddf4,_0x2e0e0a,_0x166a7c){return new BPromise(function(_0x18a97e,_0x5c00ed){var _0x3bb25a=_0x166a7c||client;return _0x3bb25a[_0x1d57('0x11')](_0x26c307,_0x2e0e0a)[_0x1d57('0x12')](function(_0x3fe2aa){logger[_0x1d57('0x13')](_0x1d57('0x14'),_0x58ddf4,_0x1d57('0x15'));logger['debug'](_0x1d57('0x16'),_0x58ddf4,_0x1d57('0x15'),JSON[_0x1d57('0x17')](_0x3fe2aa));if(_0x3fe2aa['error']){if(_0x3fe2aa[_0x1d57('0x18')]['code']===0x1f4){logger[_0x1d57('0x18')](_0x1d57('0x14'),_0x58ddf4,_0x3fe2aa[_0x1d57('0x18')]['message']);return _0x5c00ed(_0x3fe2aa[_0x1d57('0x18')][_0x1d57('0x19')]);}logger[_0x1d57('0x18')]('MailAccount,\x20%s,\x20%s',_0x58ddf4,_0x3fe2aa[_0x1d57('0x18')][_0x1d57('0x19')]);return _0x18a97e(_0x3fe2aa[_0x1d57('0x18')]['message']);}else{logger['info'](_0x1d57('0x14'),_0x58ddf4,_0x1d57('0x15'));_0x18a97e(_0x3fe2aa[_0x1d57('0x1a')]['message']);}})[_0x1d57('0x1b')](function(_0x575422){logger[_0x1d57('0x18')](_0x1d57('0x14'),_0x58ddf4,_0x575422);_0x5c00ed(_0x575422);});});}function respondWithStatusCode(_0x377e51,_0x4c2a9b){_0x4c2a9b=_0x4c2a9b||0xcc;return function(_0x43e8b5){if(_0x43e8b5){return _0x377e51[_0x1d57('0x1c')](_0x4c2a9b);}return _0x377e51[_0x1d57('0x1d')](_0x4c2a9b)[_0x1d57('0x1e')]();};}function respondWithResult(_0x12f12b,_0x15ebb9){_0x15ebb9=_0x15ebb9||0xc8;return function(_0x3be3df){if(_0x3be3df){return _0x12f12b[_0x1d57('0x1d')](_0x15ebb9)[_0x1d57('0x1f')](_0x3be3df);}};}function respondWithFilteredResult(_0x3213cb,_0x5bc5ea){return function(_0x561a64){if(_0x561a64){var _0x4f719a=typeof _0x5bc5ea[_0x1d57('0x20')]===_0x1d57('0x21')&&typeof _0x5bc5ea[_0x1d57('0x22')]==='undefined';var _0x435308=_0x561a64[_0x1d57('0x23')];var _0x531db6=_0x4f719a?0x0:_0x5bc5ea[_0x1d57('0x20')];var _0x2721c5=_0x4f719a?_0x561a64[_0x1d57('0x23')]:_0x5bc5ea[_0x1d57('0x20')]+_0x5bc5ea['limit'];var _0x470e2e;if(_0x2721c5>=_0x435308){_0x2721c5=_0x435308;_0x470e2e=0xc8;}else{_0x470e2e=0xce;}_0x3213cb['status'](_0x470e2e);return _0x3213cb[_0x1d57('0x24')](_0x1d57('0x25'),_0x531db6+'-'+_0x2721c5+'/'+_0x435308)[_0x1d57('0x1f')](_0x561a64);}return null;};}function saveUpdates(_0x22349a){return function(_0x174da7){if(_0x174da7){return _0x174da7[_0x1d57('0x26')](_0x22349a)[_0x1d57('0x12')](function(_0x1a312c){return _0x1a312c;});}return null;};}function removeEntity(_0x144ebd){return function(_0x426ebb){if(_0x426ebb){return _0x426ebb[_0x1d57('0x27')]()[_0x1d57('0x12')](function(){var _0x3dd791=_0x426ebb[_0x1d57('0x28')]({'plain':!![]});var _0x5e552b=_0x1d57('0x29');return db[_0x1d57('0x2a')][_0x1d57('0x27')]({'where':{'type':_0x5e552b,'resourceId':_0x3dd791['id']}})['then'](function(){return _0x426ebb;});})[_0x1d57('0x12')](function(){_0x144ebd[_0x1d57('0x1d')](0xcc)[_0x1d57('0x1e')]();});}};}function handleEntityNotFound(_0x59e6ab){return function(_0x1263c7){if(!_0x1263c7){_0x59e6ab[_0x1d57('0x1c')](0x194);}return _0x1263c7;};}function handleError(_0x170b5a,_0x39cc58){_0x39cc58=_0x39cc58||0x1f4;return function(_0x5b1e40){logger['error'](_0x5b1e40[_0x1d57('0x2b')]);if(_0x5b1e40[_0x1d57('0x2c')]){delete _0x5b1e40['name'];}_0x170b5a[_0x1d57('0x1d')](_0x39cc58)[_0x1d57('0x2d')](_0x5b1e40);};}function getImapHost(_0x3c0033){switch(_0x3c0033){case _0x1d57('0x2e'):return _0x1d57('0x2f');case _0x1d57('0x30'):return _0x1d57('0x31');case _0x1d57('0x32'):return'imap-mail.outlook.com';case _0x1d57('0x33'):return'outlook.office365.com';}throw new Error(_0x1d57('0x34'),_0x3c0033);}function getSmtpHost(_0x264be3){switch(_0x264be3){case _0x1d57('0x2e'):return _0x1d57('0x35');case _0x1d57('0x30'):return _0x1d57('0x36');case _0x1d57('0x32'):return _0x1d57('0x37');case _0x1d57('0x33'):return _0x1d57('0x38');}throw new Error('Unknown\x20email\x20service\x20provider',_0x264be3);}function getAuthenticationOptions(_0x1f0502,_0x5681a9){var _0x22a4a3={};var _0x17c486={};if(_0x1f0502){_0x22a4a3['user']=_0x17c486['user']=_0x5681a9[_0x1d57('0x39')];_0x22a4a3[_0x1d57('0x3a')]=_0x17c486[_0x1d57('0x3b')]=_0x5681a9[_0x1d57('0x3a')];if(_0x5681a9[_0x1d57('0x3c')]){_0x22a4a3[_0x1d57('0x3c')]=_0x17c486['modernAuthentication']=!![];_0x22a4a3['CloudProviderId']=_0x17c486[_0x1d57('0x3d')]=_0x5681a9[_0x1d57('0x3d')];_0x22a4a3[_0x1d57('0x3a')]=_0x17c486[_0x1d57('0x3b')]=null;}else{_0x22a4a3['CloudProviderId']=_0x17c486[_0x1d57('0x3d')]=null;}_0x22a4a3[_0x1d57('0x3e')]=getImapHost(_0x1f0502);_0x22a4a3[_0x1d57('0x3f')]=0x3e1;_0x17c486[_0x1d57('0x3e')]=getSmtpHost(_0x1f0502);_0x17c486[_0x1d57('0x3f')]=0x24b;_0x17c486[_0x1d57('0x40')]=![];_0x22a4a3[_0x1d57('0x41')]=_0x17c486[_0x1d57('0x41')]=null;}else{if(_0x5681a9[_0x1d57('0x42')]){_0x22a4a3['user']=_0x17c486['user']=_0x5681a9[_0x1d57('0x39')];_0x22a4a3['password']=_0x17c486['pass']=_0x5681a9['password'];}else{_0x22a4a3[_0x1d57('0x42')]=_0x17c486[_0x1d57('0x42')]=![];_0x22a4a3[_0x1d57('0x43')]=_0x17c486['user']=null;_0x22a4a3['password']=_0x17c486['pass']=null;}_0x22a4a3[_0x1d57('0x3e')]=_0x5681a9['Imap']['host'];_0x22a4a3[_0x1d57('0x3f')]=_0x5681a9[_0x1d57('0x44')][_0x1d57('0x3f')];_0x17c486['host']=_0x5681a9[_0x1d57('0x45')]['host'];_0x17c486[_0x1d57('0x3f')]=_0x5681a9[_0x1d57('0x45')][_0x1d57('0x3f')];}return{'Imap':_0x22a4a3,'Smtp':_0x17c486};}exports[_0x1d57('0x46')]=function(_0x691c4e,_0x281d15){var _0x5bb7cb={'include':[{'model':db[_0x1d57('0x47')],'as':_0x1d57('0x44')},{'model':db[_0x1d57('0x48')],'as':_0x1d57('0x45')},{'model':db[_0x1d57('0x49')],'as':_0x1d57('0x4a')}]},_0x2bb55c={},_0x24eb8b={'count':0x0,'rows':[]};var _0x58bc59=_[_0x1d57('0x4b')](db[_0x1d57('0x4c')][_0x1d57('0x4d')],function(_0x21421c){return{'name':_0x21421c[_0x1d57('0x4e')],'type':_0x21421c['type'][_0x1d57('0x4f')]};});_0x2bb55c['model']=_['map'](_0x58bc59,_0x1d57('0x2c'));_0x2bb55c[_0x1d57('0x50')]=_[_0x1d57('0x51')](_0x691c4e[_0x1d57('0x50')]);_0x2bb55c[_0x1d57('0x52')]=_[_0x1d57('0x53')](_0x2bb55c[_0x1d57('0x54')],_0x2bb55c[_0x1d57('0x50')]);_0x5bb7cb[_0x1d57('0x55')]=_[_0x1d57('0x53')](_0x2bb55c[_0x1d57('0x54')],qs['fields'](_0x691c4e[_0x1d57('0x50')][_0x1d57('0x56')]));_0x5bb7cb[_0x1d57('0x55')]=_0x5bb7cb[_0x1d57('0x55')]['length']?_0x5bb7cb[_0x1d57('0x55')]:_0x2bb55c[_0x1d57('0x54')];if(!_0x691c4e[_0x1d57('0x50')][_0x1d57('0x57')](_0x1d57('0x58'))){_0x5bb7cb['limit']=qs['limit'](_0x691c4e[_0x1d57('0x50')]['limit']);_0x5bb7cb[_0x1d57('0x20')]=qs['offset'](_0x691c4e[_0x1d57('0x50')][_0x1d57('0x20')]);}_0x5bb7cb[_0x1d57('0x59')]=qs[_0x1d57('0x5a')](_0x691c4e[_0x1d57('0x50')]['sort']);_0x5bb7cb['where']=qs[_0x1d57('0x52')](_[_0x1d57('0x5b')](_0x691c4e[_0x1d57('0x50')],_0x2bb55c['filters']),_0x58bc59);if(_0x691c4e[_0x1d57('0x50')]['filter']){_0x5bb7cb['where']=_['merge'](_0x5bb7cb['where'],{'$or':_['map'](_0x58bc59,function(_0x21915a){if(_0x21915a['type']!==_0x1d57('0x5c')){var _0x496cde={};_0x496cde[_0x21915a['name']]={'$like':'%'+_0x691c4e[_0x1d57('0x50')][_0x1d57('0x5d')]+'%'};return _0x496cde;}})});}_0x5bb7cb=_[_0x1d57('0x5e')]({},_0x5bb7cb,_0x691c4e['options']);var _0x1f62af={'where':_0x5bb7cb[_0x1d57('0x5f')]};return db[_0x1d57('0x4c')][_0x1d57('0x23')](_0x1f62af)['then'](function(_0x8b1405){_0x24eb8b[_0x1d57('0x23')]=_0x8b1405;if(_0x691c4e[_0x1d57('0x50')][_0x1d57('0x60')]){_0x5bb7cb[_0x1d57('0x61')]=[{'all':!![]}];}return db['MailAccount'][_0x1d57('0x62')](_0x5bb7cb);})[_0x1d57('0x12')](function(_0x53219f){_0x24eb8b['rows']=_0x53219f;return _0x24eb8b;})[_0x1d57('0x12')](respondWithFilteredResult(_0x281d15,_0x5bb7cb))['catch'](handleError(_0x281d15,null));};exports[_0x1d57('0x63')]=function(_0x23eed8,_0x1fd4f9){var _0x50a737={'raw':![],'where':{'id':_0x23eed8[_0x1d57('0x64')]['id']},'include':[{'model':db[_0x1d57('0x47')],'as':_0x1d57('0x44')},{'model':db['MailServerOut'],'as':_0x1d57('0x45')},{'model':db[_0x1d57('0x49')],'as':_0x1d57('0x4a')}]},_0x555596={};_0x555596['model']=_[_0x1d57('0x51')](db[_0x1d57('0x4c')][_0x1d57('0x4d')]);_0x555596[_0x1d57('0x50')]=_[_0x1d57('0x51')](_0x23eed8[_0x1d57('0x50')]);_0x555596[_0x1d57('0x52')]=_[_0x1d57('0x53')](_0x555596[_0x1d57('0x54')],_0x555596[_0x1d57('0x50')]);_0x50a737[_0x1d57('0x55')]=_['intersection'](_0x555596[_0x1d57('0x54')],qs[_0x1d57('0x56')](_0x23eed8[_0x1d57('0x50')]['fields']));_0x50a737[_0x1d57('0x55')]=_0x50a737[_0x1d57('0x55')][_0x1d57('0x65')]?_0x50a737[_0x1d57('0x55')]:_0x555596[_0x1d57('0x54')];if(_0x23eed8[_0x1d57('0x50')][_0x1d57('0x60')]){_0x50a737[_0x1d57('0x61')]=[{'all':!![]}];}_0x50a737=_[_0x1d57('0x5e')]({},_0x50a737,_0x23eed8[_0x1d57('0x66')]);return db[_0x1d57('0x4c')][_0x1d57('0x67')](_0x50a737)[_0x1d57('0x12')](handleEntityNotFound(_0x1fd4f9,null))['then'](respondWithResult(_0x1fd4f9,null))[_0x1d57('0x1b')](handleError(_0x1fd4f9,null));};exports[_0x1d57('0x26')]=function(_0x137a45,_0xb79298){if(_0x137a45[_0x1d57('0x68')]['id']){delete _0x137a45[_0x1d57('0x68')]['id'];}var _0x397a97=_0x137a45[_0x1d57('0x68')][_0x1d57('0x69')]==='custom'?null:_0x137a45[_0x1d57('0x68')][_0x1d57('0x69')];var _0x1df522=_0x137a45[_0x1d57('0x68')][_0x1d57('0x44')]||{};var _0x46f529=_0x137a45[_0x1d57('0x68')][_0x1d57('0x45')]||{};if(_0x397a97){_0x1df522[_0x1d57('0x3e')]=getImapHost(_0x397a97);_0x1df522['port']=0x3e1;_0x46f529[_0x1d57('0x3e')]=getSmtpHost(_0x397a97);_0x46f529[_0x1d57('0x3f')]=0x24b;_0x46f529[_0x1d57('0x40')]=![];}if(_0x46f529[_0x1d57('0x3c')]){_0x46f529[_0x1d57('0x40')]=![];}else{_0x46f529[_0x1d57('0x3d')]=null;}if(!_0x1df522[_0x1d57('0x3c')])_0x1df522[_0x1d57('0x3d')]=null;_0x137a45[_0x1d57('0x68')][_0x1d57('0x44')]=_0x1df522;_0x137a45[_0x1d57('0x68')][_0x1d57('0x45')]=_0x46f529;return db[_0x1d57('0x4c')][_0x1d57('0x67')]({'where':{'id':_0x137a45['params']['id']},'include':[{'model':db['MailServerIn'],'as':'Imap'},{'model':db[_0x1d57('0x48')],'as':'Smtp'},{'model':db[_0x1d57('0x49')],'as':_0x1d57('0x4a')}]})[_0x1d57('0x12')](handleEntityNotFound(_0xb79298,null))[_0x1d57('0x12')](function(_0x5b23fc){if(!_0x5b23fc)throw new Error(_0x1d57('0x6a'));if(_0x5b23fc[_0x1d57('0x41')])delete _0x137a45['body']['Imap'];return _0x5b23fc;})['then'](saveUpdates(_0x137a45[_0x1d57('0x68')],null))[_0x1d57('0x12')](function(_0x264f0){if(!_0x137a45[_0x1d57('0x68')][_0x1d57('0x44')])return _0x264f0;return db[_0x1d57('0x47')]['update'](_0x137a45[_0x1d57('0x68')][_0x1d57('0x44')],{'where':{'MailAccountId':_0x264f0['id']}})[_0x1d57('0x12')](function(){return _0x264f0;});})[_0x1d57('0x12')](function(_0x324f9c){if(!_0x137a45[_0x1d57('0x68')][_0x1d57('0x45')])return _0x324f9c;return db[_0x1d57('0x48')]['update'](_0x137a45[_0x1d57('0x68')][_0x1d57('0x45')],{'where':{'MailAccountId':_0x324f9c['id']}})['then'](function(){return _0x324f9c;});})[_0x1d57('0x12')](respondWithResult(_0xb79298,null))[_0x1d57('0x1b')](handleError(_0xb79298,null));};exports[_0x1d57('0x6b')]=function(_0x2d85b2,_0x343a0a){return db[_0x1d57('0x4c')]['describe']()[_0x1d57('0x12')](respondWithResult(_0x343a0a,null))[_0x1d57('0x1b')](handleError(_0x343a0a,null));};exports[_0x1d57('0x6c')]=function(_0x21a9c7,_0x26968f){if(_0x21a9c7[_0x1d57('0x68')]['id']){delete _0x21a9c7[_0x1d57('0x68')]['id'];}return db[_0x1d57('0x4c')][_0x1d57('0x67')]({'where':{'id':_0x21a9c7[_0x1d57('0x64')]['id']}})[_0x1d57('0x12')](handleEntityNotFound(_0x26968f,null))[_0x1d57('0x12')](function(_0x4bc034){if(_0x4bc034){_0x21a9c7[_0x1d57('0x68')][_0x1d57('0x6d')]=_0x4bc034['id'];return db[_0x1d57('0x6e')][_0x1d57('0x6f')](_0x21a9c7[_0x1d57('0x68')]);}})[_0x1d57('0x12')](respondWithResult(_0x26968f,null))['catch'](handleError(_0x26968f,null));};exports[_0x1d57('0x70')]=function(_0xfb1ee0,_0x37bb39){var _0x502b08={'raw':![],'where':{}};var _0x105efe={};var _0x56d7e7={'count':0x0,'rows':[]};return db[_0x1d57('0x4c')]['findOne']({'where':{'id':_0xfb1ee0[_0x1d57('0x64')]['id']}})[_0x1d57('0x12')](handleEntityNotFound(_0x37bb39,null))[_0x1d57('0x12')](function(_0x2dc40e){if(_0x2dc40e){_0x105efe['model']=_[_0x1d57('0x51')](db[_0x1d57('0x6e')][_0x1d57('0x4d')]);_0x105efe[_0x1d57('0x50')]=_['keys'](_0xfb1ee0[_0x1d57('0x50')]);_0x105efe[_0x1d57('0x52')]=_[_0x1d57('0x53')](_0x105efe['model'],_0x105efe[_0x1d57('0x50')]);_0x502b08['attributes']=_[_0x1d57('0x53')](_0x105efe['model'],qs[_0x1d57('0x56')](_0xfb1ee0[_0x1d57('0x50')][_0x1d57('0x56')]));_0x502b08[_0x1d57('0x55')]=_0x502b08[_0x1d57('0x55')]['length']?_0x502b08[_0x1d57('0x55')]:_0x105efe[_0x1d57('0x54')];if(!_0xfb1ee0[_0x1d57('0x50')][_0x1d57('0x57')](_0x1d57('0x58'))){_0x502b08['limit']=qs[_0x1d57('0x22')](_0xfb1ee0['query'][_0x1d57('0x22')]);_0x502b08[_0x1d57('0x20')]=qs['offset'](_0xfb1ee0[_0x1d57('0x50')]['offset']);}_0x502b08[_0x1d57('0x59')]=qs[_0x1d57('0x5a')](_0xfb1ee0[_0x1d57('0x50')][_0x1d57('0x5a')]);_0x502b08[_0x1d57('0x5f')]=qs['filters'](_[_0x1d57('0x5b')](_0xfb1ee0[_0x1d57('0x50')],_0x105efe[_0x1d57('0x52')]));_0x502b08['where'][_0x1d57('0x6d')]=_0x2dc40e['id'];if(_0xfb1ee0[_0x1d57('0x50')]['filter']){_0x502b08[_0x1d57('0x5f')]=_[_0x1d57('0x5e')](_0x502b08[_0x1d57('0x5f')],{'$or':_[_0x1d57('0x4b')](_0x502b08[_0x1d57('0x55')],function(_0x505de6){var _0x38bebd={};_0x38bebd[_0x505de6]={'$like':'%'+_0xfb1ee0[_0x1d57('0x50')][_0x1d57('0x5d')]+'%'};return _0x38bebd;})});}_0x502b08=_[_0x1d57('0x5e')]({},_0x502b08,_0xfb1ee0[_0x1d57('0x66')]);return db[_0x1d57('0x6e')][_0x1d57('0x23')]({'where':_0x502b08[_0x1d57('0x5f')]})['then'](function(_0x303649){_0x56d7e7[_0x1d57('0x23')]=_0x303649;if(_0xfb1ee0[_0x1d57('0x50')]['includeAll']){_0x502b08[_0x1d57('0x61')]=[{'all':!![]}];}return db[_0x1d57('0x6e')][_0x1d57('0x62')](_0x502b08);})[_0x1d57('0x12')](function(_0x4a6d20){_0x56d7e7[_0x1d57('0x71')]=_0x4a6d20;return _0x56d7e7;});}})[_0x1d57('0x12')](respondWithFilteredResult(_0x37bb39,_0x502b08))[_0x1d57('0x1b')](handleError(_0x37bb39,null));};exports[_0x1d57('0x72')]=function(_0x2aae5a,_0x3a55b5){return db[_0x1d57('0x4c')][_0x1d57('0x67')]({'where':{'id':_0x2aae5a[_0x1d57('0x64')]['id']}})[_0x1d57('0x12')](handleEntityNotFound(_0x3a55b5,null))[_0x1d57('0x12')](function(_0x256316){if(_0x256316){return _0x256316[_0x1d57('0x72')](_0x2aae5a[_0x1d57('0x50')][_0x1d57('0x73')]);}})['then'](respondWithStatusCode(_0x3a55b5,null))[_0x1d57('0x1b')](handleError(_0x3a55b5,null));};exports[_0x1d57('0x74')]=function(_0x38b2ca,_0xde6210){if(_0x38b2ca[_0x1d57('0x68')]['id']){delete _0x38b2ca['body']['id'];}return db[_0x1d57('0x4c')][_0x1d57('0x67')]({'where':{'id':_0x38b2ca['params']['id']}})[_0x1d57('0x12')](handleEntityNotFound(_0xde6210,null))[_0x1d57('0x12')](function(_0x58a38e){if(_0x58a38e){_0x38b2ca[_0x1d57('0x68')]['MailAccountId']=_0x58a38e['id'];return db[_0x1d57('0x75')][_0x1d57('0x6f')](_0x38b2ca[_0x1d57('0x68')]);}})[_0x1d57('0x12')](respondWithResult(_0xde6210,null))['catch'](handleError(_0xde6210,null));};exports[_0x1d57('0x76')]=function(_0x5b3eec,_0x92eaf1){var _0x20d754={'raw':![],'where':{}};var _0x4015fa={};var _0x30dbd3={'count':0x0,'rows':[]};return db[_0x1d57('0x4c')]['findOne']({'where':{'id':_0x5b3eec[_0x1d57('0x64')]['id']}})['then'](handleEntityNotFound(_0x92eaf1,null))[_0x1d57('0x12')](function(_0x13dc0f){if(_0x13dc0f){_0x4015fa[_0x1d57('0x54')]=_[_0x1d57('0x51')](db['CannedAnswer'][_0x1d57('0x4d')]);_0x4015fa['query']=_[_0x1d57('0x51')](_0x5b3eec[_0x1d57('0x50')]);_0x4015fa[_0x1d57('0x52')]=_[_0x1d57('0x53')](_0x4015fa['model'],_0x4015fa[_0x1d57('0x50')]);_0x20d754['attributes']=_['intersection'](_0x4015fa[_0x1d57('0x54')],qs[_0x1d57('0x56')](_0x5b3eec['query'][_0x1d57('0x56')]));_0x20d754['attributes']=_0x20d754[_0x1d57('0x55')][_0x1d57('0x65')]?_0x20d754[_0x1d57('0x55')]:_0x4015fa[_0x1d57('0x54')];if(!_0x5b3eec[_0x1d57('0x50')][_0x1d57('0x57')](_0x1d57('0x58'))){_0x20d754[_0x1d57('0x22')]=qs[_0x1d57('0x22')](_0x5b3eec[_0x1d57('0x50')][_0x1d57('0x22')]);_0x20d754[_0x1d57('0x20')]=qs[_0x1d57('0x20')](_0x5b3eec['query'][_0x1d57('0x20')]);}_0x20d754[_0x1d57('0x59')]=qs[_0x1d57('0x5a')](_0x5b3eec[_0x1d57('0x50')][_0x1d57('0x5a')]);_0x20d754[_0x1d57('0x5f')]=qs['filters'](_[_0x1d57('0x5b')](_0x5b3eec[_0x1d57('0x50')],_0x4015fa[_0x1d57('0x52')]));_0x20d754[_0x1d57('0x5f')]['MailAccountId']=_0x13dc0f['id'];if(_0x5b3eec[_0x1d57('0x50')][_0x1d57('0x5d')]){_0x20d754[_0x1d57('0x5f')]=_[_0x1d57('0x5e')](_0x20d754[_0x1d57('0x5f')],{'$or':_[_0x1d57('0x4b')](_0x20d754[_0x1d57('0x55')],function(_0x3ee4c6){var _0x45868f={};_0x45868f[_0x3ee4c6]={'$like':'%'+_0x5b3eec[_0x1d57('0x50')][_0x1d57('0x5d')]+'%'};return _0x45868f;})});}_0x20d754=_[_0x1d57('0x5e')]({},_0x20d754,_0x5b3eec[_0x1d57('0x66')]);return db['CannedAnswer']['count']({'where':_0x20d754[_0x1d57('0x5f')]})[_0x1d57('0x12')](function(_0x477f24){_0x30dbd3[_0x1d57('0x23')]=_0x477f24;if(_0x5b3eec[_0x1d57('0x50')]['includeAll']){_0x20d754['include']=[{'all':!![]}];}return db[_0x1d57('0x75')][_0x1d57('0x62')](_0x20d754);})['then'](function(_0x313e5b){_0x30dbd3[_0x1d57('0x71')]=_0x313e5b;return _0x30dbd3;});}})['then'](respondWithFilteredResult(_0x92eaf1,_0x20d754))['catch'](handleError(_0x92eaf1,null));};exports[_0x1d57('0x77')]=function(_0x477536,_0x479edc){return db[_0x1d57('0x4c')][_0x1d57('0x67')]({'where':{'id':_0x477536['params']['id']}})[_0x1d57('0x12')](handleEntityNotFound(_0x479edc,null))[_0x1d57('0x12')](function(_0x2bd350){if(_0x2bd350){return _0x2bd350['removeAnswers'](_0x477536[_0x1d57('0x50')][_0x1d57('0x73')]);}})[_0x1d57('0x12')](respondWithStatusCode(_0x479edc,null))['catch'](handleError(_0x479edc,null));};exports[_0x1d57('0x6f')]=function(_0x5c5e00,_0x138ab2){var _0x3dd8b4={'name':_0x5c5e00[_0x1d57('0x68')]['name'],'key':_0x5c5e00[_0x1d57('0x68')]['key'],'provider':_0x5c5e00['body'][_0x1d57('0x69')]===_0x1d57('0x78')?null:_0x5c5e00[_0x1d57('0x68')][_0x1d57('0x69')],'email':_0x5c5e00['body']['email'],'ListId':_0x5c5e00['body'][_0x1d57('0x79')],'active':!_['isNil'](_0x5c5e00[_0x1d57('0x68')][_0x1d57('0x7a')])?_0x5c5e00[_0x1d57('0x68')][_0x1d57('0x7a')]:!![],'description':_0x5c5e00[_0x1d57('0x68')][_0x1d57('0x7b')]||null};var _0x24385b=getAuthenticationOptions(_0x3dd8b4[_0x1d57('0x69')],_0x5c5e00[_0x1d57('0x68')]);_0x3dd8b4[_0x1d57('0x44')]=_0x24385b[_0x1d57('0x44')];_0x3dd8b4[_0x1d57('0x45')]=_0x24385b[_0x1d57('0x45')];return db['MailAccount'][_0x1d57('0x6f')](_0x3dd8b4,{'include':[{'model':db[_0x1d57('0x48')],'as':'Smtp'},{'model':db[_0x1d57('0x47')],'as':_0x1d57('0x44')}]})[_0x1d57('0x12')](function(_0x2ba35f){var _0x56a81a=_0x5c5e00[_0x1d57('0x43')][_0x1d57('0x28')]({'plain':!![]});if(!_0x56a81a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x56a81a[_0x1d57('0x7c')]===_0x1d57('0x43')){var _0x17b0c8=_0x2ba35f[_0x1d57('0x28')]({'plain':!![]});return db[_0x1d57('0x7d')][_0x1d57('0x67')]({'where':{'name':_0x1d57('0x29'),'userProfileId':_0x56a81a[_0x1d57('0x7e')]},'raw':!![]})['then'](function(_0x28a055){if(_0x28a055&&_0x28a055[_0x1d57('0x7f')]===0x0){return db[_0x1d57('0x2a')][_0x1d57('0x6f')]({'name':_0x17b0c8[_0x1d57('0x2c')],'resourceId':_0x17b0c8['id'],'type':_0x28a055[_0x1d57('0x2c')],'sectionId':_0x28a055['id']},{})[_0x1d57('0x12')](function(){return _0x2ba35f;});}else{return _0x2ba35f;}})[_0x1d57('0x1b')](function(_0x142f49){logger['error'](_0x1d57('0x80'),_0x142f49);throw _0x142f49;});}return _0x2ba35f;})[_0x1d57('0x12')](respondWithResult(_0x138ab2,0xc9))[_0x1d57('0x1b')](handleError(_0x138ab2,null));};exports[_0x1d57('0x81')]=function(_0x4cb1b2,_0x421fe5){return db[_0x1d57('0x4c')][_0x1d57('0x82')]({'where':{'id':_0x4cb1b2['params']['id']}})[_0x1d57('0x12')](handleEntityNotFound(_0x421fe5,null))['then'](function(_0x49df57){if(_0x49df57){return _0x49df57[_0x1d57('0x81')]();}return null;})[_0x1d57('0x12')](respondWithResult(_0x421fe5,null))[_0x1d57('0x1b')](handleError(_0x421fe5,null));};exports[_0x1d57('0x83')]=function(_0x59b5cf,_0x33d9cf){if(_0x59b5cf['body']['id']){delete _0x59b5cf[_0x1d57('0x68')]['id'];}return db['MailAccount']['find']({'where':{'id':_0x59b5cf[_0x1d57('0x64')]['id']}})[_0x1d57('0x12')](handleEntityNotFound(_0x33d9cf,null))[_0x1d57('0x12')](function(_0x307181){if(_0x307181){_0x59b5cf[_0x1d57('0x68')]['MailAccountId']=_0x307181['id'];return db['MailServerIn']['create'](_0x59b5cf['body']);}})[_0x1d57('0x12')](respondWithResult(_0x33d9cf,null))[_0x1d57('0x1b')](handleError(_0x33d9cf,null));};exports[_0x1d57('0x84')]=function(_0x1cfab1,_0x443825){return db['MailAccount'][_0x1d57('0x82')]({'where':{'id':_0x1cfab1[_0x1d57('0x64')]['id']}})[_0x1d57('0x12')](handleEntityNotFound(_0x443825,null))[_0x1d57('0x12')](function(_0x5ef37f){if(_0x5ef37f){return _0x5ef37f['setImap'](null);}return null;})[_0x1d57('0x12')](respondWithStatusCode(_0x443825,null))[_0x1d57('0x1b')](handleError(_0x443825,null));};exports['getSmtp']=function(_0x535248,_0x539fc3){return db[_0x1d57('0x4c')][_0x1d57('0x82')]({'where':{'id':_0x535248[_0x1d57('0x64')]['id']}})[_0x1d57('0x12')](handleEntityNotFound(_0x539fc3,null))[_0x1d57('0x12')](function(_0x4e3d6a){if(_0x4e3d6a){return _0x4e3d6a['getSmtp']();}return null;})[_0x1d57('0x12')](respondWithResult(_0x539fc3,null))[_0x1d57('0x1b')](handleError(_0x539fc3,null));};exports['addSmtp']=function(_0x34655c,_0x1f1ea3){if(_0x34655c['body']['id']){delete _0x34655c[_0x1d57('0x68')]['id'];}return db[_0x1d57('0x4c')][_0x1d57('0x67')]({'where':{'id':_0x34655c['params']['id']}})[_0x1d57('0x12')](handleEntityNotFound(_0x1f1ea3,null))[_0x1d57('0x12')](function(_0x368226){if(_0x368226){_0x34655c['body'][_0x1d57('0x6d')]=_0x368226['id'];return db[_0x1d57('0x48')][_0x1d57('0x6f')](_0x34655c[_0x1d57('0x68')]);}})[_0x1d57('0x12')](respondWithResult(_0x1f1ea3,null))[_0x1d57('0x1b')](handleError(_0x1f1ea3,null));};exports[_0x1d57('0x85')]=function(_0x4ecbb8,_0x1aab86){return db['MailAccount']['findOne']({'where':{'id':_0x4ecbb8['params']['id']}})[_0x1d57('0x12')](handleEntityNotFound(_0x1aab86,null))[_0x1d57('0x12')](function(_0x5ce7f8){if(_0x5ce7f8){return _0x5ce7f8[_0x1d57('0x86')](null);}return null;})[_0x1d57('0x12')](respondWithStatusCode(_0x1aab86,null))[_0x1d57('0x1b')](handleError(_0x1aab86,null));};exports[_0x1d57('0x87')]=function(_0x24f75a,_0x5c3176){return db[_0x1d57('0x88')][_0x1d57('0x67')]({'where':{'id':_0x24f75a[_0x1d57('0x64')]['id']}})[_0x1d57('0x12')](handleEntityNotFound(_0x5c3176,null))[_0x1d57('0x12')](function(_0x41d561){if(_0x41d561){return _0x41d561[_0x1d57('0x87')](_0x24f75a[_0x1d57('0x68')][_0x1d57('0x73')],_[_0x1d57('0x89')](_0x24f75a['body'],[_0x1d57('0x73'),'id'])||{});}})[_0x1d57('0x12')](respondWithResult(_0x5c3176,null))[_0x1d57('0x1b')](handleError(_0x5c3176,null));};exports[_0x1d57('0x8a')]=function(_0x16e439,_0x577b3a){var _0x4dc2b8={'raw':![],'where':{}};var _0x1159b9={};var _0x59b4e6={'count':0x0,'rows':[]};return db[_0x1d57('0x4c')][_0x1d57('0x82')]({'where':{'id':_0x16e439[_0x1d57('0x64')]['id']}})[_0x1d57('0x12')](handleEntityNotFound(_0x577b3a,null))[_0x1d57('0x12')](function(_0xc68bd5){if(_0xc68bd5){_0x1159b9['model']=_['keys'](db[_0x1d57('0x88')][_0x1d57('0x4d')]);_0x1159b9[_0x1d57('0x50')]=_[_0x1d57('0x51')](_0x16e439['query']);_0x1159b9[_0x1d57('0x52')]=_['intersection'](_0x1159b9['model'],_0x1159b9['query']);_0x4dc2b8[_0x1d57('0x55')]=_[_0x1d57('0x53')](_0x1159b9[_0x1d57('0x54')],qs[_0x1d57('0x56')](_0x16e439[_0x1d57('0x50')][_0x1d57('0x56')]));_0x4dc2b8[_0x1d57('0x55')]=_0x4dc2b8[_0x1d57('0x55')]['length']?_0x4dc2b8['attributes']:_0x1159b9[_0x1d57('0x54')];if(!_0x16e439[_0x1d57('0x50')][_0x1d57('0x57')](_0x1d57('0x58'))){_0x4dc2b8[_0x1d57('0x22')]=qs[_0x1d57('0x22')](_0x16e439['query'][_0x1d57('0x22')]);_0x4dc2b8[_0x1d57('0x20')]=qs[_0x1d57('0x20')](_0x16e439[_0x1d57('0x50')][_0x1d57('0x20')]);}_0x4dc2b8[_0x1d57('0x59')]=qs['sort'](_0x16e439[_0x1d57('0x50')]['sort']);_0x4dc2b8[_0x1d57('0x5f')]=qs[_0x1d57('0x52')](_[_0x1d57('0x5b')](_0x16e439['query'],_0x1159b9['filters']));_0x4dc2b8['where'][_0x1d57('0x6d')]=_0xc68bd5['id'];if(_0x16e439[_0x1d57('0x50')][_0x1d57('0x5d')]){_0x4dc2b8['where']=_[_0x1d57('0x5e')](_0x4dc2b8[_0x1d57('0x5f')],{'$or':_[_0x1d57('0x4b')](_0x4dc2b8[_0x1d57('0x55')],function(_0x5d8868){var _0x8d8481={};_0x8d8481[_0x5d8868]={'$like':'%'+_0x16e439[_0x1d57('0x50')][_0x1d57('0x5d')]+'%'};return _0x8d8481;})});}_0x4dc2b8=_['merge']({},_0x4dc2b8,_0x16e439[_0x1d57('0x66')]);return db['MailInteraction'][_0x1d57('0x23')]({'where':_0x4dc2b8['where']})[_0x1d57('0x12')](function(_0xcf9893){_0x59b4e6[_0x1d57('0x23')]=_0xcf9893;if(_0x16e439['query'][_0x1d57('0x60')]){_0x4dc2b8[_0x1d57('0x61')]=[{'model':db['CmContact'],'as':_0x1d57('0x8b'),'required':![]},{'model':db[_0x1d57('0x8c')],'as':_0x1d57('0x8d'),'attributes':['name',_0x1d57('0x8e'),_0x1d57('0x8f')],'required':![]},{'model':db['Tag'],'as':_0x1d57('0x90'),'attributes':['id',_0x1d57('0x2c'),_0x1d57('0x91')],'where':_0x16e439['query'][_0x1d57('0x92')]?{'id':_0x16e439[_0x1d57('0x50')][_0x1d57('0x92')]}:undefined,'required':_0x16e439['query'][_0x1d57('0x92')]?!![]:![]}];}return db['MailInteraction'][_0x1d57('0x62')](_0x4dc2b8);})[_0x1d57('0x12')](function(_0x30edc2){_0x59b4e6[_0x1d57('0x71')]=_0x30edc2;return _0x59b4e6;});}})[_0x1d57('0x12')](respondWithFilteredResult(_0x577b3a,_0x4dc2b8))['catch'](handleError(_0x577b3a,null));};exports[_0x1d57('0x93')]=function addApplications(_0x153920,_0x1a9bec){var _0x2dcb97=_0x153920[_0x1d57('0x64')]['id'];var _0x2d23f3=_0x153920[_0x1d57('0x68')];var _0x198b35=0xc8;var _0x8c096=null;return db[_0x1d57('0x94')]['transaction']({'isolationLevel':db[_0x1d57('0x94')][_0x1d57('0x95')][_0x1d57('0x96')][_0x1d57('0x97')]},function(_0x543e56){return db['MailAccount'][_0x1d57('0x82')]({'where':{'id':_0x2dcb97},'transaction':_0x543e56})[_0x1d57('0x12')](function(_0x483275){if(_0x483275){return db['MailApplication'][_0x1d57('0x27')]({'where':{'MailAccountId':_0x2dcb97},'transaction':_0x543e56})['then'](function(){var _0xa1e868=_[_0x1d57('0x4b')](_0x2d23f3,function(_0x2c5be2){_0x2c5be2[_0x1d57('0x6d')]=_0x2dcb97;return _0x2c5be2;});return db['MailApplication']['bulkCreate'](_0xa1e868,{'transaction':_0x543e56});});}else{_0x198b35=0x194;_0x8c096=[];}});})[_0x1d57('0x12')](function(){if(_0x198b35!==0x194){return db[_0x1d57('0x98')][_0x1d57('0x99')]({'where':{'MailAccountId':_0x2dcb97},'order':_0x1d57('0x9a')})['then'](function(_0x2677c9){_0x8c096=_0x2677c9;});}})['catch'](function(_0x209f51){_0x198b35=0x1f4;logger[_0x1d57('0x18')](_0x209f51['stack']);if(_0x209f51[_0x1d57('0x2c')]){delete _0x209f51['name'];}_0x8c096=_0x209f51;})[_0x1d57('0x9b')](function(){if(_0x8c096===null){_0x1a9bec['sendStatus'](_0x198b35);}else{if(_0x198b35===0x1f4){_0x1a9bec[_0x1d57('0x1d')](_0x198b35)[_0x1d57('0x2d')](_0x8c096);}else{_0x1a9bec[_0x1d57('0x1d')](_0x198b35)['json'](_0x8c096);}}});};exports[_0x1d57('0x9c')]=function(_0x1c66f4,_0xd79643){var _0x2eebde={};var _0x5c83e7={};var _0x77c31;var _0x2449a1;return db[_0x1d57('0x4c')][_0x1d57('0x82')]({'where':{'id':_0x1c66f4[_0x1d57('0x64')]['id']}})[_0x1d57('0x12')](handleEntityNotFound(_0xd79643,null))[_0x1d57('0x12')](function(_0x4846b5){if(_0x4846b5){_0x77c31=_0x4846b5;_0x5c83e7[_0x1d57('0x54')]=_['keys'](db[_0x1d57('0x98')][_0x1d57('0x4d')]);_0x5c83e7['query']=_['keys'](_0x1c66f4[_0x1d57('0x50')]);_0x5c83e7[_0x1d57('0x52')]=_[_0x1d57('0x53')](_0x5c83e7[_0x1d57('0x54')],_0x5c83e7[_0x1d57('0x50')]);_0x2eebde['attributes']=_[_0x1d57('0x53')](_0x5c83e7['model'],qs[_0x1d57('0x56')](_0x1c66f4[_0x1d57('0x50')][_0x1d57('0x56')]));_0x2eebde[_0x1d57('0x55')]=_0x2eebde[_0x1d57('0x55')]['length']?_0x2eebde[_0x1d57('0x55')]:_0x5c83e7['model'];_0x2eebde[_0x1d57('0x59')]=qs[_0x1d57('0x5a')](_0x1c66f4[_0x1d57('0x50')][_0x1d57('0x5a')]);_0x2eebde[_0x1d57('0x5f')]=qs[_0x1d57('0x52')](_[_0x1d57('0x5b')](_0x1c66f4[_0x1d57('0x50')],_0x5c83e7[_0x1d57('0x52')]));if(_0x1c66f4[_0x1d57('0x50')][_0x1d57('0x5d')]){_0x2eebde['where']=_[_0x1d57('0x5e')](_0x2eebde[_0x1d57('0x5f')],{'$or':_[_0x1d57('0x4b')](_0x2eebde[_0x1d57('0x55')],function(_0x496470){var _0x41304b={};_0x41304b[_0x496470]={'$like':'%'+_0x1c66f4[_0x1d57('0x50')]['filter']+'%'};return _0x41304b;})});}_0x2eebde=_[_0x1d57('0x5e')]({},_0x2eebde,_0x1c66f4[_0x1d57('0x66')]);return _0x77c31[_0x1d57('0x9c')](_0x2eebde);}})[_0x1d57('0x12')](function(_0x160fbb){if(_0x160fbb){_0x2449a1=_0x160fbb[_0x1d57('0x65')];if(!_0x1c66f4[_0x1d57('0x50')][_0x1d57('0x57')](_0x1d57('0x58'))){_0x2eebde[_0x1d57('0x22')]=qs[_0x1d57('0x22')](_0x1c66f4[_0x1d57('0x50')][_0x1d57('0x22')]);_0x2eebde[_0x1d57('0x20')]=qs[_0x1d57('0x20')](_0x1c66f4['query'][_0x1d57('0x20')]);}return _0x77c31[_0x1d57('0x9c')](_0x2eebde);}})[_0x1d57('0x12')](function(_0x497a00){if(_0x497a00){return _0x497a00?{'count':_0x2449a1,'rows':_0x497a00}:null;}})[_0x1d57('0x12')](respondWithResult(_0xd79643,null))[_0x1d57('0x1b')](handleError(_0xd79643,null));};exports[_0x1d57('0x9d')]=function(_0x1446af,_0x150f00){var _0x225a72={'raw':!![],'where':{}};var _0x143fd5={};var _0xe969ae={'count':0x0,'rows':[]};return db[_0x1d57('0x4c')][_0x1d57('0x82')]({'where':{'id':_0x1446af[_0x1d57('0x64')]['id']}})[_0x1d57('0x12')](handleEntityNotFound(_0x150f00,null))[_0x1d57('0x12')](function(_0x5ebf84){if(_0x5ebf84){_0x143fd5[_0x1d57('0x54')]=_[_0x1d57('0x51')](db[_0x1d57('0x9e')][_0x1d57('0x4d')]);_0x143fd5['query']=_[_0x1d57('0x51')](_0x1446af[_0x1d57('0x50')]);_0x143fd5['filters']=_[_0x1d57('0x53')](_0x143fd5['model'],_0x143fd5['query']);_0x225a72[_0x1d57('0x55')]=_['intersection'](_0x143fd5[_0x1d57('0x54')],qs[_0x1d57('0x56')](_0x1446af['query'][_0x1d57('0x56')]));_0x225a72[_0x1d57('0x55')]=_0x225a72[_0x1d57('0x55')]['length']?_0x225a72['attributes']:_0x143fd5[_0x1d57('0x54')];if(!_0x1446af[_0x1d57('0x50')][_0x1d57('0x57')](_0x1d57('0x58'))){_0x225a72[_0x1d57('0x22')]=qs[_0x1d57('0x22')](_0x1446af[_0x1d57('0x50')][_0x1d57('0x22')]);_0x225a72['offset']=qs[_0x1d57('0x20')](_0x1446af['query'][_0x1d57('0x20')]);}_0x225a72[_0x1d57('0x59')]=qs[_0x1d57('0x5a')](_0x1446af[_0x1d57('0x50')][_0x1d57('0x5a')]);_0x225a72['where']=qs[_0x1d57('0x52')](_[_0x1d57('0x5b')](_0x1446af[_0x1d57('0x50')],_0x143fd5['filters']));_0x225a72['where'][_0x1d57('0x6d')]=_0x5ebf84['id'];if(_0x1446af[_0x1d57('0x50')][_0x1d57('0x5d')]){_0x225a72[_0x1d57('0x5f')]=_['merge'](_0x225a72[_0x1d57('0x5f')],{'$or':_['map'](_0x225a72['attributes'],function(_0x1da8d4){var _0x5da1be={};_0x5da1be[_0x1da8d4]={'$like':'%'+_0x1446af['query']['filter']+'%'};return _0x5da1be;})});}if(_0x1446af['query']['$gte']){var _0x43f909=_0x1446af[_0x1d57('0x50')][_0x1d57('0x9f')]['split'](',');var _0x151015={};_0x151015[_0x43f909[0x0]]={'$gte':moment(_0x43f909[0x1])[_0x1d57('0xa0')](_0x1d57('0xa1'))};_0x225a72[_0x1d57('0x5f')]=_[_0x1d57('0x5e')](_0x225a72[_0x1d57('0x5f')],_0x151015);}_0x225a72=_[_0x1d57('0x5e')]({},_0x225a72,_0x1446af[_0x1d57('0x66')]);return db['MailMessage'][_0x1d57('0x23')]({'where':_0x225a72[_0x1d57('0x5f')]})[_0x1d57('0x12')](function(_0x4844db){_0xe969ae[_0x1d57('0x23')]=_0x4844db;if(_0x1446af['query'][_0x1d57('0x60')]){_0x225a72[_0x1d57('0x61')]=[{'all':!![]}];}return db[_0x1d57('0x9e')][_0x1d57('0x62')](_0x225a72);})[_0x1d57('0x12')](function(_0x15b650){if(_0x1446af[_0x1d57('0x50')][_0x1d57('0xa2')]===_0x1d57('0xa3')){for(var _0x1cb8d6=0x0;_0x1cb8d6<_0x15b650['length'];_0x1cb8d6++){_0x15b650[_0x1cb8d6][_0x1d57('0x68')]=juice(_0x15b650[_0x1cb8d6][_0x1d57('0x68')]);}}_0xe969ae['rows']=_0x15b650;return _0xe969ae;});}})['then'](respondWithFilteredResult(_0x150f00,_0x225a72))[_0x1d57('0x1b')](handleError(_0x150f00,null));};exports[_0x1d57('0x2d')]=function(_0x565fb5,_0x119e80){var _0x564b0a,_0x244db0={},_0x134a67;if(_0x565fb5[_0x1d57('0x68')]['to']){_0x134a67=_0x565fb5[_0x1d57('0x68')]['to'][_0x1d57('0xa4')](',')[0x0];}return db[_0x1d57('0x4c')][_0x1d57('0x67')]({'where':{'id':_0x565fb5['params']['id']},'include':[{'model':db[_0x1d57('0xa5')],'as':_0x1d57('0xa6'),'include':[{'model':db[_0x1d57('0xa7')],'as':_0x1d57('0xa8'),'where':{'email':_0x134a67},'limit':0x1,'order':[['updatedAt',_0x1d57('0xa9')]]}]},{'model':db[_0x1d57('0x48')],'as':_0x1d57('0x45'),'raw':!![],'include':[{'model':db[_0x1d57('0xaa')],'as':_0x1d57('0xaa'),'raw':!![]}]}]})['then'](handleEntityNotFound(_0x119e80,null))[_0x1d57('0x12')](function(_0x222c7c){if(!_0x222c7c)return;_0x564b0a=_0x222c7c;if(!_0x222c7c[_0x1d57('0x45')])throw new Error('Smtp\x20configuration\x20not\x20found');if(_['isNil'](_0x565fb5['body'][_0x1d57('0xab')])){_0x565fb5[_0x1d57('0x68')][_0x1d57('0xab')]=util[_0x1d57('0xa0')](_0x1d57('0xac'),_0x222c7c[_0x1d57('0x2c')],_0x222c7c[_0x1d57('0xad')]||_0x222c7c['Smtp']['user']);}if(_0x565fb5['body'][_0x1d57('0xae')]&&_0x565fb5[_0x1d57('0x68')][_0x1d57('0xae')][_0x1d57('0x65')]){for(var _0x3731af=0x0;_0x3731af<_0x565fb5[_0x1d57('0x68')][_0x1d57('0xae')][_0x1d57('0x65')];_0x3731af+=0x1){_0x565fb5[_0x1d57('0x68')][_0x1d57('0xae')][_0x3731af]={'filename':_0x565fb5[_0x1d57('0x68')]['attachments'][_0x3731af][_0x1d57('0x2c')],'path':path[_0x1d57('0xaf')](config[_0x1d57('0xb0')],_0x1d57('0xb1'),_0x565fb5[_0x1d57('0x68')]['attachments'][_0x3731af][_0x1d57('0xb2')])};}}var _0x102940=_0x222c7c[_0x1d57('0xb3')]();return respondWithRpcPromise(_0x1d57('0xb4'),_0x1d57('0xb5'),{'account':_0x102940,'message':_0x565fb5[_0x1d57('0x68')]});})[_0x1d57('0x12')](function(_0x209fa8){if(!_0x209fa8)return;_0x244db0=_0x209fa8;if(!_0x564b0a[_0x1d57('0xa6')])throw new Error('List\x20not\x20found');if(_0x564b0a[_0x1d57('0xa6')]['Contacts'][_0x1d57('0x65')])return _0x564b0a[_0x1d57('0xa6')][_0x1d57('0xa8')][0x0];return db[_0x1d57('0xa7')][_0x1d57('0x6f')](_[_0x1d57('0xa')](_0x565fb5[_0x1d57('0x68')],{'firstName':_0x565fb5['body']['to'],'email':_0x565fb5['body']['to'],'phone':_0x565fb5[_0x1d57('0x68')]['to'],'ListId':_0x564b0a[_0x1d57('0x79')]}));})[_0x1d57('0x12')](function(_0x36495d){if(!_0x36495d)return;var _0xf4711d={'UserId':_0x565fb5['user']['id'],'ContactId':_0x36495d['id'],'MailAccountId':_0x564b0a['id'],'inReplyTo':_0x244db0['messageId'],'to':_0x565fb5[_0x1d57('0x68')]['from'],'cc':_0x565fb5[_0x1d57('0x68')]['cc'],'subject':_0x565fb5[_0x1d57('0x68')][_0x1d57('0xb6')],'attach':_0x565fb5['body'][_0x1d57('0xb7')],'firstMsgDirection':'out','lastMsgAt':moment()[_0x1d57('0xa0')](_0x1d57('0xa1')),'lastMsgDirection':_0x1d57('0xb8'),'Messages':[_[_0x1d57('0x5e')](_0x565fb5[_0x1d57('0x68')],{'messageId':_0x244db0['messageId'],'sentAt':moment()[_0x1d57('0xa0')]('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0x564b0a['id'],'UserId':_0x565fb5[_0x1d57('0x43')]['id'],'ContactId':_0x36495d['id']})]};if(_0x565fb5[_0x1d57('0x68')]['Interaction']){_0xf4711d=_[_0x1d57('0x5e')](_0xf4711d,_0x565fb5['body'][_0x1d57('0xb9')]);}return db[_0x1d57('0x88')]['create'](_0xf4711d,{'include':[{'model':db['MailMessage'],'as':_0x1d57('0xba')}]});})['then'](respondWithResult(_0x119e80,null))[_0x1d57('0x1b')](handleError(_0x119e80,null));};exports[_0x1d57('0xbb')]=function(_0x20806f,_0x45b10f){return db['MailAccount'][_0x1d57('0x67')]({'where':{'id':_0x20806f[_0x1d57('0x64')]['id']},'include':[{'model':db['MailServerOut'],'as':_0x1d57('0x45'),'raw':!![],'include':[{'model':db[_0x1d57('0xaa')],'as':'CloudProvider','raw':!![]}]}]})[_0x1d57('0x12')](handleEntityNotFound(_0x45b10f,null))['then'](function(_0x4ba8aa){if(!_0x4ba8aa[_0x1d57('0x45')])return;var _0x21408f=_0x4ba8aa[_0x1d57('0xb3')]();return respondWithRpcPromise(_0x1d57('0xbc'),_0x1d57('0xbb'),{'account':_0x21408f});})[_0x1d57('0x12')](respondWithResult(_0x45b10f,null))[_0x1d57('0x1b')](handleError(_0x45b10f,null));};exports[_0x1d57('0x27')]=function(_0x41fb5e,_0x6e70a2){return db['MailAccount'][_0x1d57('0x67')]({'where':{'id':_0x41fb5e[_0x1d57('0x64')]['id']}})[_0x1d57('0x12')](handleEntityNotFound(_0x6e70a2,null))[_0x1d57('0x12')](function(_0x2f5ef8){if(_0x2f5ef8&&_0x2f5ef8[_0x1d57('0x41')]){throw new db[(_0x1d57('0xbd'))][(_0x1d57('0xbe'))](_0x1d57('0xbf'));}return _0x2f5ef8;})[_0x1d57('0x12')](removeEntity(_0x6e70a2,null))[_0x1d57('0x1b')](handleError(_0x6e70a2,null));};exports[_0x1d57('0xc0')]=function(_0x7b5d86,_0xb0c642){return db[_0x1d57('0x4c')][_0x1d57('0x67')]({'where':{'id':_0x7b5d86[_0x1d57('0x64')]['id']}})[_0x1d57('0x12')](handleEntityNotFound(_0xb0c642,null))[_0x1d57('0x12')](function(_0x1cbc90){if(_0x1cbc90){return _0x1cbc90['addAgents'](_0x7b5d86[_0x1d57('0x68')]['ids'],_[_0x1d57('0x89')](_0x7b5d86[_0x1d57('0x68')],[_0x1d57('0x73'),'id'])||{})[_0x1d57('0xc1')](function(_0x1fb486){for(var _0x7e0b2=0x0;_0x7e0b2<_0x7b5d86[_0x1d57('0x68')][_0x1d57('0x73')]['length'];_0x7e0b2+=0x1){socket['emit'](_0x1d57('0xc2'),{'UserId':Number(_0x7b5d86[_0x1d57('0x68')]['ids'][_0x7e0b2]),'MailAccountId':Number(_0x7b5d86[_0x1d57('0x64')]['id'])});}return _0x1fb486;});}})[_0x1d57('0x12')](respondWithResult(_0xb0c642,null))[_0x1d57('0x1b')](handleError(_0xb0c642,null));};exports[_0x1d57('0xc3')]=function(_0x246548,_0x7b5747){return db[_0x1d57('0x4c')]['find']({'where':{'id':_0x246548[_0x1d57('0x64')]['id']}})[_0x1d57('0x12')](handleEntityNotFound(_0x7b5747,null))[_0x1d57('0x12')](function(_0x10c9f){if(_0x10c9f){return _0x10c9f[_0x1d57('0xc3')](_0x246548[_0x1d57('0x50')]['ids'])[_0x1d57('0x12')](function(){if(_[_0x1d57('0xc4')](_0x246548[_0x1d57('0x50')][_0x1d57('0x73')])){for(var _0x2df811=0x0;_0x2df811<_0x246548[_0x1d57('0x50')][_0x1d57('0x73')][_0x1d57('0x65')];_0x2df811+=0x1){socket[_0x1d57('0xc5')]('userMailAccount:remove',{'UserId':Number(_0x246548[_0x1d57('0x50')][_0x1d57('0x73')][_0x2df811]),'MailAccountId':Number(_0x246548[_0x1d57('0x64')]['id'])});}}else{socket['emit'](_0x1d57('0xc6'),{'UserId':Number(_0x246548[_0x1d57('0x50')][_0x1d57('0x73')]),'MailAccountId':Number(_0x246548[_0x1d57('0x64')]['id'])});}});}})[_0x1d57('0x12')](respondWithStatusCode(_0x7b5747,null))[_0x1d57('0x1b')](handleError(_0x7b5747,null));};exports[_0x1d57('0xc7')]=function(_0x1155e8,_0x5ab049){var _0x23928c={};var _0x2a6285={};var _0x28df82;var _0x3df7c3;return db[_0x1d57('0x4c')][_0x1d57('0x82')]({'where':{'id':_0x1155e8[_0x1d57('0x64')]['id']}})[_0x1d57('0x12')](handleEntityNotFound(_0x5ab049,null))[_0x1d57('0x12')](function(_0x92d1ea){if(_0x92d1ea){_0x28df82=_0x92d1ea;_0x2a6285[_0x1d57('0x54')]=_['keys'](db[_0x1d57('0x8c')]['rawAttributes']);_0x2a6285[_0x1d57('0x50')]=_[_0x1d57('0x51')](_0x1155e8[_0x1d57('0x50')]);_0x2a6285[_0x1d57('0x52')]=_[_0x1d57('0x53')](_0x2a6285[_0x1d57('0x54')],_0x2a6285[_0x1d57('0x50')]);_0x23928c[_0x1d57('0x55')]=_['intersection'](_0x2a6285[_0x1d57('0x54')],qs['fields'](_0x1155e8[_0x1d57('0x50')][_0x1d57('0x56')]));_0x23928c[_0x1d57('0x55')]=_0x23928c['attributes'][_0x1d57('0x65')]?_0x23928c['attributes']:_0x2a6285[_0x1d57('0x54')];_0x23928c[_0x1d57('0x59')]=qs[_0x1d57('0x5a')](_0x1155e8[_0x1d57('0x50')]['sort']);_0x23928c[_0x1d57('0x5f')]=qs['filters'](_['pick'](_0x1155e8['query'],_0x2a6285['filters']));if(_0x1155e8[_0x1d57('0x50')][_0x1d57('0x5d')]){_0x23928c[_0x1d57('0x5f')]=_[_0x1d57('0x5e')](_0x23928c['where'],{'$or':_['map'](_0x23928c['attributes'],function(_0x1947e9){var _0x4fdb2f={};_0x4fdb2f[_0x1947e9]={'$like':'%'+_0x1155e8['query'][_0x1d57('0x5d')]+'%'};return _0x4fdb2f;})});}_0x23928c=_[_0x1d57('0x5e')]({},_0x23928c,_0x1155e8[_0x1d57('0x66')]);return _0x28df82[_0x1d57('0xc7')](_0x23928c);}})[_0x1d57('0x12')](function(_0x3af890){if(_0x3af890){_0x3df7c3=_0x3af890[_0x1d57('0x65')];if(!_0x1155e8[_0x1d57('0x50')]['hasOwnProperty'](_0x1d57('0x58'))){_0x23928c[_0x1d57('0x22')]=qs[_0x1d57('0x22')](_0x1155e8[_0x1d57('0x50')]['limit']);_0x23928c[_0x1d57('0x20')]=qs[_0x1d57('0x20')](_0x1155e8['query']['offset']);}return _0x28df82[_0x1d57('0xc7')](_0x23928c);}})[_0x1d57('0x12')](function(_0x491deb){if(_0x491deb){return _0x491deb?{'count':_0x3df7c3,'rows':_0x491deb}:null;}})[_0x1d57('0x12')](respondWithResult(_0x5ab049,null))[_0x1d57('0x1b')](handleError(_0x5ab049,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 02c6291..db53fe7 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 _0x1261=['update','remove','hasOwnProperty','hook','../../mysqldb','MailAccount','setMaxListeners','save'];(function(_0xbc25e1,_0x27007d){var _0xaf0a85=function(_0x52acb3){while(--_0x52acb3){_0xbc25e1['push'](_0xbc25e1['shift']());}};_0xaf0a85(++_0x27007d);}(_0x1261,0x144));var _0x1126=function(_0xb65ffb,_0x2cc0af){_0xb65ffb=_0xb65ffb-0x0;var _0x58f55c=_0x1261[_0xb65ffb];return _0x58f55c;};'use strict';var EventEmitter=require('events');var MailAccount=require(_0x1126('0x0'))['db'][_0x1126('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x1126('0x2')](0x0);var events={'afterCreate':_0x1126('0x3'),'afterUpdate':_0x1126('0x4'),'afterDestroy':_0x1126('0x5')};function emitEvent(_0x3cc93f){return function(_0x4245ca,_0x21a480,_0x75a851){MailAccountEvents['emit'](_0x3cc93f+':'+_0x4245ca['id'],_0x4245ca);MailAccountEvents['emit'](_0x3cc93f,_0x4245ca);_0x75a851(null);};}for(var e in events){if(events[_0x1126('0x6')](e)){var event=events[e];MailAccount[_0x1126('0x7')](e,emitEvent(event));}}module['exports']=MailAccountEvents; \ No newline at end of file +var _0xbff5=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailAccount','setMaxListeners','save','update','remove'];(function(_0x27e558,_0x42155b){var _0x190d65=function(_0x10eb3a){while(--_0x10eb3a){_0x27e558['push'](_0x27e558['shift']());}};_0x190d65(++_0x42155b);}(_0xbff5,0x1bc));var _0x5bff=function(_0x2dbae3,_0x4df3b2){_0x2dbae3=_0x2dbae3-0x0;var _0x4a5471=_0xbff5[_0x2dbae3];return _0x4a5471;};'use strict';var EventEmitter=require(_0x5bff('0x0'));var MailAccount=require(_0x5bff('0x1'))['db'][_0x5bff('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x5bff('0x3')](0x0);var events={'afterCreate':_0x5bff('0x4'),'afterUpdate':_0x5bff('0x5'),'afterDestroy':_0x5bff('0x6')};function emitEvent(_0x4dccf3){return function(_0x3868ae,_0x486083,_0x4c567d){MailAccountEvents[_0x5bff('0x7')](_0x4dccf3+':'+_0x3868ae['id'],_0x3868ae);MailAccountEvents[_0x5bff('0x7')](_0x4dccf3,_0x3868ae);_0x4c567d(null);};}for(var e in events){if(events[_0x5bff('0x8')](e)){var event=events[e];MailAccount[_0x5bff('0x9')](e,emitEvent(event));}}module[_0x5bff('0xa')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 5fd97b2..12f8aee 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 _0xed36=['modernAuthentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','auth','OAuth2','user','data5','pass','./mailAccount.attributes','exports','MailAccount','mail_accounts','provider','service','host','port','Smtp','secure','authentication'];(function(_0x3bd046,_0x4379b2){var _0x16bd9d=function(_0x32c751){while(--_0x32c751){_0x3bd046['push'](_0x3bd046['shift']());}};_0x16bd9d(++_0x4379b2);}(_0xed36,0xb3));var _0x6ed3=function(_0x319604,_0x3f0bd5){_0x319604=_0x319604-0x0;var _0x20758d=_0xed36[_0x319604];return _0x20758d;};'use strict';var attributes=require(_0x6ed3('0x0'));module[_0x6ed3('0x1')]=function(_0x4bfd34){return _0x4bfd34['define'](_0x6ed3('0x2'),attributes,{'tableName':_0x6ed3('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x75a5b8=this;var _0x29a06a={'id':_0x75a5b8['id'],'tls':{'rejectUnauthorized':![]}};if(_0x75a5b8[_0x6ed3('0x4')]!=='custom'){_0x29a06a[_0x6ed3('0x5')]=_0x75a5b8[_0x6ed3('0x4')];}else{_0x29a06a[_0x6ed3('0x6')]=_0x75a5b8['Smtp'][_0x6ed3('0x6')];_0x29a06a[_0x6ed3('0x7')]=_0x75a5b8[_0x6ed3('0x8')]['port'];_0x29a06a[_0x6ed3('0x9')]=_0x75a5b8[_0x6ed3('0x8')][_0x6ed3('0x9')];}if(_0x75a5b8['Smtp'][_0x6ed3('0xa')]){if(_0x75a5b8[_0x6ed3('0x8')][_0x6ed3('0xb')]){if(!_0x75a5b8[_0x6ed3('0x8')][_0x6ed3('0xc')])throw new Error(_0x6ed3('0xd'));_0x29a06a[_0x6ed3('0xe')]={'type':_0x6ed3('0xf'),'user':_0x75a5b8['Smtp'][_0x6ed3('0x10')],'accessToken':_0x75a5b8[_0x6ed3('0x8')]['CloudProvider'][_0x6ed3('0x11')]};}else{_0x29a06a['auth']={'user':_0x75a5b8['Smtp'][_0x6ed3('0x10')],'pass':_0x75a5b8[_0x6ed3('0x8')][_0x6ed3('0x12')]};}}return _0x29a06a;}}});}; \ No newline at end of file +var _0xcf7a=['exports','MailAccount','custom','service','provider','host','Smtp','port','secure','authentication','modernAuthentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','OAuth2','user','data5','auth','pass'];(function(_0xbb103c,_0x4b570a){var _0x3c75c0=function(_0x4285d9){while(--_0x4285d9){_0xbb103c['push'](_0xbb103c['shift']());}};_0x3c75c0(++_0x4b570a);}(_0xcf7a,0x132));var _0xacf7=function(_0x594801,_0x610323){_0x594801=_0x594801-0x0;var _0x5ce1db=_0xcf7a[_0x594801];return _0x5ce1db;};'use strict';var attributes=require('./mailAccount.attributes');module[_0xacf7('0x0')]=function(_0x5111f4){return _0x5111f4['define'](_0xacf7('0x1'),attributes,{'tableName':'mail_accounts','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x32ef1f=this;var _0xe33b2f={'id':_0x32ef1f['id'],'tls':{'rejectUnauthorized':![]}};if(_0x32ef1f['provider']!==_0xacf7('0x2')){_0xe33b2f[_0xacf7('0x3')]=_0x32ef1f[_0xacf7('0x4')];}else{_0xe33b2f[_0xacf7('0x5')]=_0x32ef1f[_0xacf7('0x6')]['host'];_0xe33b2f['port']=_0x32ef1f[_0xacf7('0x6')][_0xacf7('0x7')];_0xe33b2f[_0xacf7('0x8')]=_0x32ef1f[_0xacf7('0x6')][_0xacf7('0x8')];}if(_0x32ef1f['Smtp'][_0xacf7('0x9')]){if(_0x32ef1f[_0xacf7('0x6')][_0xacf7('0xa')]){if(!_0x32ef1f[_0xacf7('0x6')][_0xacf7('0xb')])throw new Error(_0xacf7('0xc'));_0xe33b2f['auth']={'type':_0xacf7('0xd'),'user':_0x32ef1f[_0xacf7('0x6')][_0xacf7('0xe')],'accessToken':_0x32ef1f[_0xacf7('0x6')][_0xacf7('0xb')][_0xacf7('0xf')]};}else{_0xe33b2f[_0xacf7('0x10')]={'user':_0x32ef1f[_0xacf7('0x6')][_0xacf7('0xe')],'pass':_0x32ef1f[_0xacf7('0x6')][_0xacf7('0x11')]};}}return _0xe33b2f;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index ab4f7be..f63702a 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 _0xaa3f=['GetMailAccount','MailAccount','findAll','options','raw','where','limit','include','map','model','attributes','catch','ShowMailAccount','find','smtp','setDataValue','smtpOptions','debug','NotifyMailAccount','mail','keys','CmContact','rawAttributes','CompanyId','isNil','body','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','from','List','Contacts','updatedAt','DESC','MailApplication','Applications','Smtp','CloudProvider','account','applications','priority','asc','autoclose','push','length','*,*,*,*','ListId','create','List\x20not\x20found','contact','messageId','generate','subject','YYYY-MM-DD\x20HH:mm:ss','MailMessage','Messages','MailInteraction','Contact\x20not\x20found','update','attach','format','get','created','attachments','originTo','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachment','Attachments','interaction','UserId','name','unshift','queueId','MailQueue','queue','Start','startRouting','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','defaults','redis','localhost','socket.io-emitter','./mailAccount.socket','register','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x5a3197,_0x20ec98){var _0xb7a1c4=function(_0x2b2d81){while(--_0x2b2d81){_0x5a3197['push'](_0x5a3197['shift']());}};_0xb7a1c4(++_0x20ec98);}(_0xaa3f,0xbb));var _0xfaa3=function(_0x1c06d1,_0x21b507){_0x1c06d1=_0x1c06d1-0x0;var _0xd88999=_0xaa3f[_0x1c06d1];return _0xd88999;};'use strict';var _=require(_0xfaa3('0x0'));var moment=require(_0xfaa3('0x1'));var BPromise=require(_0xfaa3('0x2'));var rs=require(_0xfaa3('0x3'));var Redis=require(_0xfaa3('0x4'));var db=require(_0xfaa3('0x5'))['db'];var logger=require(_0xfaa3('0x6'))(_0xfaa3('0x7'));var config=require(_0xfaa3('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xfaa3('0x9')]({'port':0x232c});config['redis']=_[_0xfaa3('0xa')](config[_0xfaa3('0xb')],{'host':_0xfaa3('0xc'),'port':0x18eb});var socket=require(_0xfaa3('0xd'))(new Redis(config[_0xfaa3('0xb')]));require(_0xfaa3('0xe'))[_0xfaa3('0xf')](socket);function respondWithRpcPromise(_0x54fb06,_0x37bcd5,_0x28de66){return new BPromise(function(_0x49380c,_0x5ca0da){return client[_0xfaa3('0x10')](_0x54fb06,_0x28de66)[_0xfaa3('0x11')](function(_0x34d3dc){logger[_0xfaa3('0x12')](_0xfaa3('0x13'),_0x37bcd5,_0xfaa3('0x14'));logger['debug'](_0xfaa3('0x15'),_0x37bcd5,'request\x20sent',JSON[_0xfaa3('0x16')](_0x34d3dc));if(_0x34d3dc[_0xfaa3('0x17')]){if(_0x34d3dc[_0xfaa3('0x17')]['code']===0x1f4){logger[_0xfaa3('0x17')]('MailAccount,\x20%s,\x20%s',_0x37bcd5,_0x34d3dc[_0xfaa3('0x17')][_0xfaa3('0x18')]);return _0x5ca0da(_0x34d3dc[_0xfaa3('0x17')][_0xfaa3('0x18')]);}logger[_0xfaa3('0x17')](_0xfaa3('0x13'),_0x37bcd5,_0x34d3dc['error']['message']);return _0x49380c(_0x34d3dc[_0xfaa3('0x17')][_0xfaa3('0x18')]);}else{logger[_0xfaa3('0x12')](_0xfaa3('0x13'),_0x37bcd5,'request\x20sent');_0x49380c(_0x34d3dc['result']['message']);}})['catch'](function(_0x499148){logger[_0xfaa3('0x17')]('MailAccount,\x20%s,\x20%s',_0x37bcd5,_0x499148);_0x5ca0da(_0x499148);});});}exports[_0xfaa3('0x19')]=function(_0x42846e){var _0x38b978=this;return new Promise(function(_0x34b276,_0x1c32dd){return db[_0xfaa3('0x1a')][_0xfaa3('0x1b')]({'raw':_0x42846e[_0xfaa3('0x1c')]?_0x42846e[_0xfaa3('0x1c')][_0xfaa3('0x1d')]===undefined?!![]:![]:!![],'where':_0x42846e['options']?_0x42846e[_0xfaa3('0x1c')][_0xfaa3('0x1e')]||null:null,'attributes':_0x42846e[_0xfaa3('0x1c')]?_0x42846e[_0xfaa3('0x1c')]['attributes']||null:null,'limit':_0x42846e[_0xfaa3('0x1c')]?_0x42846e[_0xfaa3('0x1c')][_0xfaa3('0x1f')]||null:null,'include':_0x42846e[_0xfaa3('0x1c')]?_0x42846e[_0xfaa3('0x1c')][_0xfaa3('0x20')]?_[_0xfaa3('0x21')](_0x42846e[_0xfaa3('0x1c')]['include'],function(_0xe075fc){return{'model':db[_0xe075fc[_0xfaa3('0x22')]],'as':_0xe075fc['as'],'attributes':_0xe075fc[_0xfaa3('0x23')],'include':_0xe075fc[_0xfaa3('0x20')]?_[_0xfaa3('0x21')](_0xe075fc[_0xfaa3('0x20')],function(_0x2416fe){return{'model':db[_0x2416fe[_0xfaa3('0x22')]],'as':_0x2416fe['as'],'attributes':_0x2416fe[_0xfaa3('0x23')],'include':_0x2416fe[_0xfaa3('0x20')]?_[_0xfaa3('0x21')](_0x2416fe[_0xfaa3('0x20')],function(_0x18bd3e){return{'model':db[_0x18bd3e[_0xfaa3('0x22')]],'as':_0x18bd3e['as'],'attributes':_0x18bd3e[_0xfaa3('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x230430){logger[_0xfaa3('0x12')](_0xfaa3('0x19'),_0x42846e);logger['debug'](_0xfaa3('0x19'),_0x42846e,JSON['stringify'](_0x230430));_0x34b276(_0x230430);})[_0xfaa3('0x24')](function(_0x5d37bb){logger[_0xfaa3('0x17')](_0xfaa3('0x19'),_0x5d37bb[_0xfaa3('0x18')],_0x42846e);_0x1c32dd(_0x38b978[_0xfaa3('0x17')](0x1f4,_0x5d37bb[_0xfaa3('0x18')]));});});};exports[_0xfaa3('0x25')]=function(_0x101772){var _0xb2aeac=this;return new Promise(function(_0x58f4f8,_0x3992c5){return db[_0xfaa3('0x1a')][_0xfaa3('0x26')]({'raw':_0x101772[_0xfaa3('0x1c')]?_0x101772[_0xfaa3('0x1c')][_0xfaa3('0x1d')]===undefined?!![]:![]:!![],'where':_0x101772[_0xfaa3('0x1c')]?_0x101772[_0xfaa3('0x1c')][_0xfaa3('0x1e')]||null:null,'attributes':_0x101772[_0xfaa3('0x1c')]?_0x101772[_0xfaa3('0x1c')][_0xfaa3('0x23')]||null:null,'include':_0x101772[_0xfaa3('0x1c')]?_0x101772[_0xfaa3('0x1c')][_0xfaa3('0x20')]?_[_0xfaa3('0x21')](_0x101772['options'][_0xfaa3('0x20')],function(_0x1a381f){return{'model':db[_0x1a381f[_0xfaa3('0x22')]],'as':_0x1a381f['as'],'attributes':_0x1a381f[_0xfaa3('0x23')],'include':_0x1a381f[_0xfaa3('0x20')]?_[_0xfaa3('0x21')](_0x1a381f[_0xfaa3('0x20')],function(_0x35ca7c){return{'model':db[_0x35ca7c['model']],'as':_0x35ca7c['as'],'attributes':_0x35ca7c[_0xfaa3('0x23')],'include':_0x35ca7c[_0xfaa3('0x20')]?_[_0xfaa3('0x21')](_0x35ca7c['include'],function(_0x229fc8){return{'model':db[_0x229fc8[_0xfaa3('0x22')]],'as':_0x229fc8['as'],'attributes':_0x229fc8['attributes']};}):[]};}):[]};}):[]:[]})[_0xfaa3('0x11')](function(_0x23fc89){if(_0x101772[_0xfaa3('0x1c')][_0xfaa3('0x27')]===!![])_0x23fc89[_0xfaa3('0x28')](_0xfaa3('0x29'),_0x23fc89['getSmtpOptions']());logger['info'](_0xfaa3('0x25'),_0x101772);logger[_0xfaa3('0x2a')]('ShowMailAccount',_0x101772,JSON['stringify'](_0x23fc89));_0x58f4f8(_0x23fc89);})[_0xfaa3('0x24')](function(_0x5bd091){logger[_0xfaa3('0x17')](_0xfaa3('0x25'),_0x5bd091[_0xfaa3('0x18')],_0x101772);_0x3992c5(_0xb2aeac[_0xfaa3('0x17')](0x1f4,_0x5bd091[_0xfaa3('0x18')]));});});};exports[_0xfaa3('0x2b')]=function(_0x44a5cb){var _0x2b8731=this;return new Promise(function(_0x551cd5,_0x507cca){var _0x5e3e88={'body':_0x44a5cb['body'],'channel':_0xfaa3('0x2c')};var _0x1aff91=_['difference'](_[_0xfaa3('0x2d')](db[_0xfaa3('0x2e')][_0xfaa3('0x2f')]),['createdAt','updatedAt',_0xfaa3('0x30'),'ListId']);var _0x1701bc=![];if(_0x44a5cb['body']['id']){delete _0x44a5cb['body']['id'];}if(_[_0xfaa3('0x31')](_0x44a5cb[_0xfaa3('0x32')]['from'])){return _0x507cca(_0x2b8731[_0xfaa3('0x17')](0x1f4,'from\x20is\x20mandatory'));}if(_[_0xfaa3('0x31')](_0x44a5cb['body'][_0xfaa3('0x32')])||_0x44a5cb[_0xfaa3('0x32')][_0xfaa3('0x32')]===''){return _0x507cca(_0x2b8731['error'](0x1f4,_0xfaa3('0x33')));}if(_[_0xfaa3('0x31')](_0x44a5cb['body'][_0xfaa3('0x34')])){return _0x507cca(_0x2b8731[_0xfaa3('0x17')](0x1f4,_0xfaa3('0x35')+_0x1aff91));}if(!_[_0xfaa3('0x36')](_0x1aff91,_0x44a5cb['body'][_0xfaa3('0x34')])){return _0x507cca(_0x2b8731[_0xfaa3('0x17')](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1aff91));}var _0xd26e61={};_0xd26e61[_0x44a5cb['body'][_0xfaa3('0x34')]]=_0x44a5cb[_0xfaa3('0x32')][_0xfaa3('0x37')];return db['MailAccount'][_0xfaa3('0x26')]({'where':{'id':_0x44a5cb['account']['id']},'include':[{'model':db['CmList'],'as':_0xfaa3('0x38'),'include':[{'model':db[_0xfaa3('0x2e')],'as':_0xfaa3('0x39'),'where':_0xd26e61,'limit':0x1,'order':[[_0xfaa3('0x3a'),_0xfaa3('0x3b')]]}]},{'model':db[_0xfaa3('0x3c')],'as':_0xfaa3('0x3d')},{'model':db['MailServerOut'],'as':_0xfaa3('0x3e'),'include':[{'model':db[_0xfaa3('0x3f')],'as':_0xfaa3('0x3f')}]}]})[_0xfaa3('0x11')](function(_0x431725){if(_0x431725&&_0x431725[_0xfaa3('0x38')]){var _0x22c8ec=_0x431725['get']({'plain':!![]});_0x5e3e88['account']=_['omit'](_0x22c8ec,[_0xfaa3('0x3d'),_0xfaa3('0x38')]);_0x5e3e88[_0xfaa3('0x40')][_0xfaa3('0x29')]=_0x431725['getSmtpOptions']();_0x5e3e88[_0xfaa3('0x41')]=_0x22c8ec['Applications'];_0x5e3e88['list']=_0x22c8ec['List'];_0x5e3e88['applications']=_['orderBy'](_0x5e3e88[_0xfaa3('0x41')],[_0xfaa3('0x42')],[_0xfaa3('0x43')]);if(_0x5e3e88[_0xfaa3('0x40')]&&_0x5e3e88[_0xfaa3('0x40')][_0xfaa3('0x44')]){_0x5e3e88[_0xfaa3('0x41')][_0xfaa3('0x45')]({'id':0x0,'priority':_0x5e3e88['applications'][_0xfaa3('0x46')]+0x1,'app':'close','appdata':'autoclose','interval':_0xfaa3('0x47')});}if(_0x5e3e88[_0xfaa3('0x40')][_0xfaa3('0x3d')]){delete _0x5e3e88[_0xfaa3('0x40')][_0xfaa3('0x3d')];}if(_0x5e3e88[_0xfaa3('0x40')][_0xfaa3('0x38')]){delete _0x5e3e88[_0xfaa3('0x40')][_0xfaa3('0x38')];}if(_0x22c8ec[_0xfaa3('0x38')][_0xfaa3('0x39')][_0xfaa3('0x46')]){return _0x22c8ec[_0xfaa3('0x38')][_0xfaa3('0x39')][0x0];}var _0x1a0097=_['defaults'](_0x44a5cb[_0xfaa3('0x32')],{'firstName':_0x44a5cb['body'][_0xfaa3('0x37')],'ListId':_0x22c8ec[_0xfaa3('0x48')]});_0x1a0097[_0x44a5cb[_0xfaa3('0x32')][_0xfaa3('0x34')]]=_0x44a5cb[_0xfaa3('0x32')][_0xfaa3('0x37')];return db[_0xfaa3('0x2e')][_0xfaa3('0x49')](_0x1a0097);}else{throw new Error(_0xfaa3('0x4a'));}})['then'](function(_0x29da3f){_0x5e3e88[_0xfaa3('0x4b')]=_0x29da3f;if(_0x29da3f){if(!_0x44a5cb[_0xfaa3('0x32')][_0xfaa3('0x18')]['messageId']){_0x44a5cb[_0xfaa3('0x32')][_0xfaa3('0x18')][_0xfaa3('0x4c')]=rs[_0xfaa3('0x4d')]()+'\x20'+_0x44a5cb[_0xfaa3('0x32')][_0xfaa3('0x18')][_0xfaa3('0x37')];}var _0x4c811b={'ContactId':_0x29da3f['id'],'MailAccountId':_0x44a5cb[_0xfaa3('0x40')]['id'],'inReplyTo':_0x44a5cb[_0xfaa3('0x32')][_0xfaa3('0x18')][_0xfaa3('0x4c')],'to':_0x44a5cb['body'][_0xfaa3('0x18')][_0xfaa3('0x37')],'cc':_0x44a5cb[_0xfaa3('0x32')][_0xfaa3('0x18')]['cc'],'subject':_0x44a5cb[_0xfaa3('0x32')][_0xfaa3('0x18')][_0xfaa3('0x4e')],'attach':_0x44a5cb[_0xfaa3('0x32')][_0xfaa3('0x18')]['attach'],'lastMsgAt':moment()['format'](_0xfaa3('0x4f')),'lastMsgDirection':'in'};return db['MailInteraction']['find']({'where':{'closed':![],'MailAccountId':_0x44a5cb[_0xfaa3('0x40')]['id']},'include':[{'model':db[_0xfaa3('0x50')],'as':_0xfaa3('0x51'),'attributes':['messageId'],'where':{'messageId':_0x44a5cb[_0xfaa3('0x32')][_0xfaa3('0x18')]['inReplyTo']}}]})[_0xfaa3('0x11')](function(_0x2a1dde){if(_0x2a1dde){return[_0x2a1dde,![]];}return db[_0xfaa3('0x52')][_0xfaa3('0x49')](_0x4c811b)['then'](function(_0x1fd9cf){return[_0x1fd9cf,!![]];});});}else{throw new Error(_0xfaa3('0x53'));}})['spread'](function(_0x345291,_0x33ba8e){if(_0x345291){_0x1701bc=_0x33ba8e;if(!_0x33ba8e){return _0x345291[_0xfaa3('0x54')]({'inReplyTo':_0x44a5cb[_0xfaa3('0x32')][_0xfaa3('0x18')]['messageId'],'to':_0x44a5cb[_0xfaa3('0x32')][_0xfaa3('0x18')]['from'],'cc':_0x44a5cb['body']['message']['cc'],'subject':_0x44a5cb[_0xfaa3('0x32')][_0xfaa3('0x18')][_0xfaa3('0x4e')],'attach':_0x345291[_0xfaa3('0x55')]?_0x345291[_0xfaa3('0x55')]:_0x44a5cb[_0xfaa3('0x32')][_0xfaa3('0x18')][_0xfaa3('0x55')],'substatus':null,'substatusAt':moment()[_0xfaa3('0x56')](_0xfaa3('0x4f')),'lastMsgAt':moment()[_0xfaa3('0x56')](_0xfaa3('0x4f')),'lastMsgDirection':'in'});}else{return _0x345291;}}})['then'](function(_0xbbad66){_0x5e3e88['interaction']=_0xbbad66[_0xfaa3('0x57')]({'plain':!![]});_0x5e3e88['interaction'][_0xfaa3('0x58')]=_0x1701bc;return db[_0xfaa3('0x50')]['create']({'body':_0x44a5cb['body'][_0xfaa3('0x32')],'MailAccountId':_0x44a5cb[_0xfaa3('0x40')]['id'],'MailInteractionId':_0xbbad66['id'],'direction':'in','ContactId':_0x5e3e88[_0xfaa3('0x4b')]['id'],'messageId':_0x44a5cb[_0xfaa3('0x32')][_0xfaa3('0x18')][_0xfaa3('0x4c')],'from':_0x44a5cb[_0xfaa3('0x32')]['message'][_0xfaa3('0x37')],'to':_0x44a5cb[_0xfaa3('0x32')][_0xfaa3('0x18')]['to'],'cc':_0x44a5cb['body'][_0xfaa3('0x18')]['cc'],'subject':_0x44a5cb[_0xfaa3('0x32')][_0xfaa3('0x18')][_0xfaa3('0x4e')],'attach':_0x44a5cb['body'][_0xfaa3('0x18')]['attach'],'Attachments':_0x44a5cb['body'][_0xfaa3('0x18')][_0xfaa3('0x59')],'originTo':_0x44a5cb[_0xfaa3('0x32')][_0xfaa3('0x18')][_0xfaa3('0x5a')],'originCc':_0x44a5cb[_0xfaa3('0x32')][_0xfaa3('0x18')]['originCc'],'bcc':_0x44a5cb[_0xfaa3('0x32')]['message']['bcc'],'ChatWebsiteId':_0x44a5cb[_0xfaa3('0x32')]['message'][_0xfaa3('0x5b')]||null,'originChannel':_0x44a5cb['body']['message'][_0xfaa3('0x5c')]||_0xfaa3('0x5d'),'ChatOfflineMessageId':_0x44a5cb[_0xfaa3('0x32')]['message'][_0xfaa3('0x5e')]||null},{'include':[{'model':db[_0xfaa3('0x5f')],'as':_0xfaa3('0x60')}]});})[_0xfaa3('0x11')](function(_0x2cd46b){_0x5e3e88['message']=_0x2cd46b;if(!_0x5e3e88[_0xfaa3('0x61')][_0xfaa3('0x62')]){return;}return db['User'][_0xfaa3('0x26')]({'attributes':['id',_0xfaa3('0x63')],'where':{'id':_0x5e3e88[_0xfaa3('0x61')][_0xfaa3('0x62')]}});})[_0xfaa3('0x11')](function(_0x8b00a4){if(_0x8b00a4){_0x5e3e88[_0xfaa3('0x41')][_0xfaa3('0x64')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x8b00a4[_0xfaa3('0x63')]+','+(_0x5e3e88[_0xfaa3('0x40')]['waitForTheAssignedAgent']||0xa),'interval':_0xfaa3('0x47')});}if(!_0x5e3e88[_0xfaa3('0x61')][_0xfaa3('0x65')]){return;}return db[_0xfaa3('0x66')][_0xfaa3('0x26')]({'attributes':['id','name'],'where':{'id':_0x5e3e88[_0xfaa3('0x61')][_0xfaa3('0x65')]}});})[_0xfaa3('0x11')](function(_0x479203){if(_0x479203){_0x5e3e88[_0xfaa3('0x41')]['unshift']({'id':0x0,'priority':0x1,'app':_0xfaa3('0x67'),'appdata':_0x479203[_0xfaa3('0x63')]+','+(_0x5e3e88[_0xfaa3('0x40')]['waitForTheAssignedQueue']||0x12c),'interval':_0xfaa3('0x47')});}return respondWithRpcPromise(_0xfaa3('0x68'),_0xfaa3('0x69'),_0x5e3e88);})[_0xfaa3('0x11')](function(_0x51d82e){_0x551cd5(_0x51d82e);})['catch'](function(_0x513944){_0x507cca(_0x2b8731[_0xfaa3('0x17')](0x1f4,_0x513944[_0xfaa3('0x18')]));});});}; \ No newline at end of file +var _0x5d17=['list','applications','orderBy','priority','autoclose','push','length','close','*,*,*,*','create','List\x20not\x20found','contact','messageId','generate','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','Contact\x20not\x20found','spread','update','interaction','get','created','originTo','bcc','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachment','UserId','agent','name','waitForTheAssignedAgent','queueId','unshift','queue','waitForTheAssignedQueue','Start','startRouting','lodash','moment','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./mailAccount.socket','register','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetMailAccount','MailAccount','findAll','options','limit','include','model','map','stringify','ShowMailAccount','find','raw','where','attributes','smtp','setDataValue','smtpOptions','getSmtpOptions','NotifyMailAccount','body','mail','difference','keys','CmContact','rawAttributes','createdAt','updatedAt','CompanyId','ListId','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','List','Contacts','DESC','MailApplication','Applications','CloudProvider','account','omit'];(function(_0x54575b,_0x1e4356){var _0x2aa5be=function(_0x318996){while(--_0x318996){_0x54575b['push'](_0x54575b['shift']());}};_0x2aa5be(++_0x1e4356);}(_0x5d17,0x114));var _0x75d1=function(_0x5f4abc,_0x1692ac){_0x5f4abc=_0x5f4abc-0x0;var _0x3c29a6=_0x5d17[_0x5f4abc];return _0x3c29a6;};'use strict';var _=require(_0x75d1('0x0'));var moment=require(_0x75d1('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var Redis=require(_0x75d1('0x2'));var db=require(_0x75d1('0x3'))['db'];var logger=require(_0x75d1('0x4'))('rpc');var config=require(_0x75d1('0x5'));var jayson=require(_0x75d1('0x6'));var client=jayson[_0x75d1('0x7')][_0x75d1('0x8')]({'port':0x232c});config['redis']=_[_0x75d1('0x9')](config[_0x75d1('0xa')],{'host':_0x75d1('0xb'),'port':0x18eb});var socket=require(_0x75d1('0xc'))(new Redis(config[_0x75d1('0xa')]));require(_0x75d1('0xd'))[_0x75d1('0xe')](socket);function respondWithRpcPromise(_0x5acfa0,_0x4cf632,_0x40df40){return new BPromise(function(_0x4a3bb3,_0x57be31){return client[_0x75d1('0xf')](_0x5acfa0,_0x40df40)[_0x75d1('0x10')](function(_0x4d4aa1){logger[_0x75d1('0x11')](_0x75d1('0x12'),_0x4cf632,_0x75d1('0x13'));logger[_0x75d1('0x14')](_0x75d1('0x15'),_0x4cf632,_0x75d1('0x13'),JSON['stringify'](_0x4d4aa1));if(_0x4d4aa1[_0x75d1('0x16')]){if(_0x4d4aa1[_0x75d1('0x16')][_0x75d1('0x17')]===0x1f4){logger[_0x75d1('0x16')]('MailAccount,\x20%s,\x20%s',_0x4cf632,_0x4d4aa1['error']['message']);return _0x57be31(_0x4d4aa1[_0x75d1('0x16')][_0x75d1('0x18')]);}logger[_0x75d1('0x16')]('MailAccount,\x20%s,\x20%s',_0x4cf632,_0x4d4aa1[_0x75d1('0x16')][_0x75d1('0x18')]);return _0x4a3bb3(_0x4d4aa1[_0x75d1('0x16')][_0x75d1('0x18')]);}else{logger[_0x75d1('0x11')](_0x75d1('0x12'),_0x4cf632,_0x75d1('0x13'));_0x4a3bb3(_0x4d4aa1[_0x75d1('0x19')][_0x75d1('0x18')]);}})[_0x75d1('0x1a')](function(_0x2c2a6d){logger['error']('MailAccount,\x20%s,\x20%s',_0x4cf632,_0x2c2a6d);_0x57be31(_0x2c2a6d);});});}exports[_0x75d1('0x1b')]=function(_0x42b7ac){var _0x56730d=this;return new Promise(function(_0x31eb88,_0x406143){return db[_0x75d1('0x1c')][_0x75d1('0x1d')]({'raw':_0x42b7ac[_0x75d1('0x1e')]?_0x42b7ac[_0x75d1('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x42b7ac[_0x75d1('0x1e')]?_0x42b7ac[_0x75d1('0x1e')]['where']||null:null,'attributes':_0x42b7ac[_0x75d1('0x1e')]?_0x42b7ac[_0x75d1('0x1e')]['attributes']||null:null,'limit':_0x42b7ac[_0x75d1('0x1e')]?_0x42b7ac['options'][_0x75d1('0x1f')]||null:null,'include':_0x42b7ac[_0x75d1('0x1e')]?_0x42b7ac[_0x75d1('0x1e')]['include']?_['map'](_0x42b7ac[_0x75d1('0x1e')][_0x75d1('0x20')],function(_0x315ce5){return{'model':db[_0x315ce5[_0x75d1('0x21')]],'as':_0x315ce5['as'],'attributes':_0x315ce5['attributes'],'include':_0x315ce5[_0x75d1('0x20')]?_[_0x75d1('0x22')](_0x315ce5[_0x75d1('0x20')],function(_0x51138e){return{'model':db[_0x51138e['model']],'as':_0x51138e['as'],'attributes':_0x51138e['attributes'],'include':_0x51138e[_0x75d1('0x20')]?_[_0x75d1('0x22')](_0x51138e[_0x75d1('0x20')],function(_0x468bf0){return{'model':db[_0x468bf0[_0x75d1('0x21')]],'as':_0x468bf0['as'],'attributes':_0x468bf0['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x410e16){logger[_0x75d1('0x11')]('GetMailAccount',_0x42b7ac);logger[_0x75d1('0x14')]('GetMailAccount',_0x42b7ac,JSON[_0x75d1('0x23')](_0x410e16));_0x31eb88(_0x410e16);})[_0x75d1('0x1a')](function(_0x91e7c9){logger[_0x75d1('0x16')](_0x75d1('0x1b'),_0x91e7c9['message'],_0x42b7ac);_0x406143(_0x56730d[_0x75d1('0x16')](0x1f4,_0x91e7c9[_0x75d1('0x18')]));});});};exports[_0x75d1('0x24')]=function(_0x84d9ae){var _0x4dde94=this;return new Promise(function(_0x75b18a,_0x551824){return db[_0x75d1('0x1c')][_0x75d1('0x25')]({'raw':_0x84d9ae['options']?_0x84d9ae[_0x75d1('0x1e')][_0x75d1('0x26')]===undefined?!![]:![]:!![],'where':_0x84d9ae[_0x75d1('0x1e')]?_0x84d9ae[_0x75d1('0x1e')][_0x75d1('0x27')]||null:null,'attributes':_0x84d9ae['options']?_0x84d9ae[_0x75d1('0x1e')][_0x75d1('0x28')]||null:null,'include':_0x84d9ae[_0x75d1('0x1e')]?_0x84d9ae[_0x75d1('0x1e')]['include']?_['map'](_0x84d9ae['options'][_0x75d1('0x20')],function(_0x29ad6b){return{'model':db[_0x29ad6b[_0x75d1('0x21')]],'as':_0x29ad6b['as'],'attributes':_0x29ad6b[_0x75d1('0x28')],'include':_0x29ad6b[_0x75d1('0x20')]?_[_0x75d1('0x22')](_0x29ad6b[_0x75d1('0x20')],function(_0x2dce68){return{'model':db[_0x2dce68[_0x75d1('0x21')]],'as':_0x2dce68['as'],'attributes':_0x2dce68['attributes'],'include':_0x2dce68[_0x75d1('0x20')]?_[_0x75d1('0x22')](_0x2dce68[_0x75d1('0x20')],function(_0x62b37e){return{'model':db[_0x62b37e[_0x75d1('0x21')]],'as':_0x62b37e['as'],'attributes':_0x62b37e['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x487431){if(_0x84d9ae[_0x75d1('0x1e')][_0x75d1('0x29')]===!![])_0x487431[_0x75d1('0x2a')](_0x75d1('0x2b'),_0x487431[_0x75d1('0x2c')]());logger[_0x75d1('0x11')]('ShowMailAccount',_0x84d9ae);logger['debug']('ShowMailAccount',_0x84d9ae,JSON[_0x75d1('0x23')](_0x487431));_0x75b18a(_0x487431);})['catch'](function(_0x53a1af){logger[_0x75d1('0x16')](_0x75d1('0x24'),_0x53a1af[_0x75d1('0x18')],_0x84d9ae);_0x551824(_0x4dde94[_0x75d1('0x16')](0x1f4,_0x53a1af['message']));});});};exports[_0x75d1('0x2d')]=function(_0x2acdc8){var _0x38bf47=this;return new Promise(function(_0x3d4137,_0x33bbe7){var _0xbc6473={'body':_0x2acdc8[_0x75d1('0x2e')],'channel':_0x75d1('0x2f')};var _0x2c88f2=_[_0x75d1('0x30')](_[_0x75d1('0x31')](db[_0x75d1('0x32')][_0x75d1('0x33')]),[_0x75d1('0x34'),_0x75d1('0x35'),_0x75d1('0x36'),_0x75d1('0x37')]);var _0x2ad3ef=![];if(_0x2acdc8[_0x75d1('0x2e')]['id']){delete _0x2acdc8[_0x75d1('0x2e')]['id'];}if(_[_0x75d1('0x38')](_0x2acdc8[_0x75d1('0x2e')]['from'])){return _0x33bbe7(_0x38bf47['error'](0x1f4,_0x75d1('0x39')));}if(_[_0x75d1('0x38')](_0x2acdc8[_0x75d1('0x2e')][_0x75d1('0x2e')])||_0x2acdc8['body'][_0x75d1('0x2e')]===''){return _0x33bbe7(_0x38bf47[_0x75d1('0x16')](0x1f4,_0x75d1('0x3a')));}if(_[_0x75d1('0x38')](_0x2acdc8['body'][_0x75d1('0x3b')])){return _0x33bbe7(_0x38bf47[_0x75d1('0x16')](0x1f4,_0x75d1('0x3c')+_0x2c88f2));}if(!_[_0x75d1('0x3d')](_0x2c88f2,_0x2acdc8['body'][_0x75d1('0x3b')])){return _0x33bbe7(_0x38bf47['error'](0x1f4,_0x75d1('0x3e')+_0x2c88f2));}var _0x1d063d={};_0x1d063d[_0x2acdc8[_0x75d1('0x2e')][_0x75d1('0x3b')]]=_0x2acdc8[_0x75d1('0x2e')][_0x75d1('0x3f')];return db['MailAccount'][_0x75d1('0x25')]({'where':{'id':_0x2acdc8['account']['id']},'include':[{'model':db['CmList'],'as':_0x75d1('0x40'),'include':[{'model':db[_0x75d1('0x32')],'as':_0x75d1('0x41'),'where':_0x1d063d,'limit':0x1,'order':[[_0x75d1('0x35'),_0x75d1('0x42')]]}]},{'model':db[_0x75d1('0x43')],'as':_0x75d1('0x44')},{'model':db['MailServerOut'],'as':'Smtp','include':[{'model':db[_0x75d1('0x45')],'as':_0x75d1('0x45')}]}]})['then'](function(_0x2d380d){if(_0x2d380d&&_0x2d380d[_0x75d1('0x40')]){var _0x2066c8=_0x2d380d['get']({'plain':!![]});_0xbc6473[_0x75d1('0x46')]=_[_0x75d1('0x47')](_0x2066c8,[_0x75d1('0x44'),_0x75d1('0x40')]);_0xbc6473[_0x75d1('0x46')][_0x75d1('0x2b')]=_0x2d380d[_0x75d1('0x2c')]();_0xbc6473['applications']=_0x2066c8[_0x75d1('0x44')];_0xbc6473[_0x75d1('0x48')]=_0x2066c8[_0x75d1('0x40')];_0xbc6473[_0x75d1('0x49')]=_[_0x75d1('0x4a')](_0xbc6473[_0x75d1('0x49')],[_0x75d1('0x4b')],['asc']);if(_0xbc6473[_0x75d1('0x46')]&&_0xbc6473[_0x75d1('0x46')][_0x75d1('0x4c')]){_0xbc6473['applications'][_0x75d1('0x4d')]({'id':0x0,'priority':_0xbc6473[_0x75d1('0x49')][_0x75d1('0x4e')]+0x1,'app':_0x75d1('0x4f'),'appdata':_0x75d1('0x4c'),'interval':_0x75d1('0x50')});}if(_0xbc6473['account'][_0x75d1('0x44')]){delete _0xbc6473[_0x75d1('0x46')][_0x75d1('0x44')];}if(_0xbc6473[_0x75d1('0x46')][_0x75d1('0x40')]){delete _0xbc6473[_0x75d1('0x46')][_0x75d1('0x40')];}if(_0x2066c8[_0x75d1('0x40')][_0x75d1('0x41')][_0x75d1('0x4e')]){return _0x2066c8[_0x75d1('0x40')][_0x75d1('0x41')][0x0];}var _0x5ceb42=_['defaults'](_0x2acdc8[_0x75d1('0x2e')],{'firstName':_0x2acdc8['body'][_0x75d1('0x3f')],'ListId':_0x2066c8[_0x75d1('0x37')]});_0x5ceb42[_0x2acdc8['body'][_0x75d1('0x3b')]]=_0x2acdc8[_0x75d1('0x2e')][_0x75d1('0x3f')];return db[_0x75d1('0x32')][_0x75d1('0x51')](_0x5ceb42);}else{throw new Error(_0x75d1('0x52'));}})[_0x75d1('0x10')](function(_0x5048ef){_0xbc6473[_0x75d1('0x53')]=_0x5048ef;if(_0x5048ef){if(!_0x2acdc8[_0x75d1('0x2e')][_0x75d1('0x18')][_0x75d1('0x54')]){_0x2acdc8[_0x75d1('0x2e')][_0x75d1('0x18')][_0x75d1('0x54')]=rs[_0x75d1('0x55')]()+'\x20'+_0x2acdc8[_0x75d1('0x2e')][_0x75d1('0x18')]['from'];}var _0x4e8e50={'ContactId':_0x5048ef['id'],'MailAccountId':_0x2acdc8[_0x75d1('0x46')]['id'],'inReplyTo':_0x2acdc8[_0x75d1('0x2e')][_0x75d1('0x18')]['messageId'],'to':_0x2acdc8[_0x75d1('0x2e')]['message'][_0x75d1('0x3f')],'cc':_0x2acdc8[_0x75d1('0x2e')][_0x75d1('0x18')]['cc'],'subject':_0x2acdc8[_0x75d1('0x2e')]['message'][_0x75d1('0x56')],'attach':_0x2acdc8['body']['message'][_0x75d1('0x57')],'lastMsgAt':moment()[_0x75d1('0x58')](_0x75d1('0x59')),'lastMsgDirection':'in'};return db[_0x75d1('0x5a')]['find']({'where':{'closed':![],'MailAccountId':_0x2acdc8['account']['id']},'include':[{'model':db[_0x75d1('0x5b')],'as':_0x75d1('0x5c'),'attributes':[_0x75d1('0x54')],'where':{'messageId':_0x2acdc8[_0x75d1('0x2e')][_0x75d1('0x18')]['inReplyTo']}}]})[_0x75d1('0x10')](function(_0x44173c){if(_0x44173c){return[_0x44173c,![]];}return db[_0x75d1('0x5a')][_0x75d1('0x51')](_0x4e8e50)[_0x75d1('0x10')](function(_0x32d022){return[_0x32d022,!![]];});});}else{throw new Error(_0x75d1('0x5d'));}})[_0x75d1('0x5e')](function(_0x40f50b,_0x9e30a5){if(_0x40f50b){_0x2ad3ef=_0x9e30a5;if(!_0x9e30a5){return _0x40f50b[_0x75d1('0x5f')]({'inReplyTo':_0x2acdc8['body'][_0x75d1('0x18')][_0x75d1('0x54')],'to':_0x2acdc8[_0x75d1('0x2e')][_0x75d1('0x18')][_0x75d1('0x3f')],'cc':_0x2acdc8[_0x75d1('0x2e')][_0x75d1('0x18')]['cc'],'subject':_0x2acdc8['body']['message'][_0x75d1('0x56')],'attach':_0x40f50b[_0x75d1('0x57')]?_0x40f50b[_0x75d1('0x57')]:_0x2acdc8[_0x75d1('0x2e')][_0x75d1('0x18')]['attach'],'substatus':null,'substatusAt':moment()['format'](_0x75d1('0x59')),'lastMsgAt':moment()[_0x75d1('0x58')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'});}else{return _0x40f50b;}}})[_0x75d1('0x10')](function(_0x29b1f4){_0xbc6473[_0x75d1('0x60')]=_0x29b1f4[_0x75d1('0x61')]({'plain':!![]});_0xbc6473[_0x75d1('0x60')][_0x75d1('0x62')]=_0x2ad3ef;return db['MailMessage']['create']({'body':_0x2acdc8[_0x75d1('0x2e')][_0x75d1('0x2e')],'MailAccountId':_0x2acdc8['account']['id'],'MailInteractionId':_0x29b1f4['id'],'direction':'in','ContactId':_0xbc6473[_0x75d1('0x53')]['id'],'messageId':_0x2acdc8['body'][_0x75d1('0x18')][_0x75d1('0x54')],'from':_0x2acdc8[_0x75d1('0x2e')]['message'][_0x75d1('0x3f')],'to':_0x2acdc8[_0x75d1('0x2e')][_0x75d1('0x18')]['to'],'cc':_0x2acdc8[_0x75d1('0x2e')][_0x75d1('0x18')]['cc'],'subject':_0x2acdc8['body']['message'][_0x75d1('0x56')],'attach':_0x2acdc8['body'][_0x75d1('0x18')][_0x75d1('0x57')],'Attachments':_0x2acdc8[_0x75d1('0x2e')]['message']['attachments'],'originTo':_0x2acdc8[_0x75d1('0x2e')]['message'][_0x75d1('0x63')],'originCc':_0x2acdc8[_0x75d1('0x2e')][_0x75d1('0x18')]['originCc'],'bcc':_0x2acdc8[_0x75d1('0x2e')][_0x75d1('0x18')][_0x75d1('0x64')],'ChatWebsiteId':_0x2acdc8[_0x75d1('0x2e')][_0x75d1('0x18')][_0x75d1('0x65')]||null,'originChannel':_0x2acdc8[_0x75d1('0x2e')][_0x75d1('0x18')][_0x75d1('0x66')]||_0x75d1('0x67'),'ChatOfflineMessageId':_0x2acdc8[_0x75d1('0x2e')][_0x75d1('0x18')][_0x75d1('0x68')]||null},{'include':[{'model':db[_0x75d1('0x69')],'as':'Attachments'}]});})['then'](function(_0x410fa1){_0xbc6473[_0x75d1('0x18')]=_0x410fa1;if(!_0xbc6473['interaction'][_0x75d1('0x6a')]){return;}return db['User']['find']({'attributes':['id','name'],'where':{'id':_0xbc6473[_0x75d1('0x60')][_0x75d1('0x6a')]}});})[_0x75d1('0x10')](function(_0xcb6eba){if(_0xcb6eba){_0xbc6473[_0x75d1('0x49')]['unshift']({'id':0x0,'priority':0x0,'app':_0x75d1('0x6b'),'appdata':_0xcb6eba[_0x75d1('0x6c')]+','+(_0xbc6473[_0x75d1('0x46')][_0x75d1('0x6d')]||0xa),'interval':_0x75d1('0x50')});}if(!_0xbc6473['interaction'][_0x75d1('0x6e')]){return;}return db['MailQueue'][_0x75d1('0x25')]({'attributes':['id',_0x75d1('0x6c')],'where':{'id':_0xbc6473[_0x75d1('0x60')]['queueId']}});})['then'](function(_0x4e88e9){if(_0x4e88e9){_0xbc6473[_0x75d1('0x49')][_0x75d1('0x6f')]({'id':0x0,'priority':0x1,'app':_0x75d1('0x70'),'appdata':_0x4e88e9[_0x75d1('0x6c')]+','+(_0xbc6473[_0x75d1('0x46')][_0x75d1('0x71')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x75d1('0x72'),_0x75d1('0x73'),_0xbc6473);})['then'](function(_0x4eda90){_0x3d4137(_0x4eda90);})['catch'](function(_0x5331f7){_0x33bbe7(_0x38bf47['error'](0x1f4,_0x5331f7[_0x75d1('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 35e4819..95800fa 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 _0x075e=['remove','update','emit','removeListener','register','length'];(function(_0x369151,_0x179f72){var _0x4292d5=function(_0x330422){while(--_0x330422){_0x369151['push'](_0x369151['shift']());}};_0x4292d5(++_0x179f72);}(_0x075e,0x1a4));var _0xe075=function(_0x510528,_0x51fa35){_0x510528=_0x510528-0x0;var _0x319d0a=_0x075e[_0x510528];return _0x319d0a;};'use strict';var MailAccountEvents=require('./mailAccount.events');var events=['save',_0xe075('0x0'),_0xe075('0x1')];function createListener(_0x4ededf,_0x2740fe){return function(_0x1fa037){_0x2740fe[_0xe075('0x2')](_0x4ededf,_0x1fa037);};}function removeListener(_0x5cfb17,_0x68d2db){return function(){MailAccountEvents[_0xe075('0x3')](_0x5cfb17,_0x68d2db);};}exports[_0xe075('0x4')]=function(_0x3a507b){for(var _0x394755=0x0,_0x45287d=events[_0xe075('0x5')];_0x394755<_0x45287d;_0x394755++){var _0x2a106e=events[_0x394755];var _0x47de1a=createListener('mailAccount:'+_0x2a106e,_0x3a507b);MailAccountEvents['on'](_0x2a106e,_0x47de1a);}}; \ No newline at end of file +var _0xafcd=['mailAccount:','./mailAccount.events','save','remove','update','removeListener'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xafcd,0x157));var _0xdafc=function(_0x34233f,_0x18f1b1){_0x34233f=_0x34233f-0x0;var _0x2199a4=_0xafcd[_0x34233f];return _0x2199a4;};'use strict';var MailAccountEvents=require(_0xdafc('0x0'));var events=[_0xdafc('0x1'),_0xdafc('0x2'),_0xdafc('0x3')];function createListener(_0x27ad41,_0x34b3d1){return function(_0x665fc){_0x34b3d1['emit'](_0x27ad41,_0x665fc);};}function removeListener(_0x145095,_0x54a63b){return function(){MailAccountEvents[_0xdafc('0x4')](_0x145095,_0x54a63b);};}exports['register']=function(_0x3b4373){for(var _0x2aa781=0x0,_0x33adc9=events['length'];_0x2aa781<_0x33adc9;_0x2aa781++){var _0x24f2e7=events[_0x2aa781];var _0x255125=createListener(_0xdafc('0x5')+_0x24f2e7,_0x3b4373);MailAccountEvents['on'](_0x24f2e7,_0x255125);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index d04f7d1..544f25f 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 _0x330c=['delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','get','/:id','show','put','isAuthenticated','update'];(function(_0x802997,_0x5534a2){var _0x35c641=function(_0x22c4f2){while(--_0x22c4f2){_0x802997['push'](_0x802997['shift']());}};_0x35c641(++_0x5534a2);}(_0x330c,0x7b));var _0xc330=function(_0x3d0cac,_0x2345c8){_0x3d0cac=_0x3d0cac-0x0;var _0x2eeb34=_0x330c[_0x3d0cac];return _0x2eeb34;};'use strict';var multer=require(_0xc330('0x0'));var util=require(_0xc330('0x1'));var path=require('path');var timeout=require(_0xc330('0x2'));var express=require(_0xc330('0x3'));var router=express['Router']();var fs_extra=require(_0xc330('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xc330('0x5'));var config=require('../../config/environment');var controller=require('./mailApplication.controller');router[_0xc330('0x6')](_0xc330('0x7'),auth['isAuthenticated'](),controller[_0xc330('0x8')]);router[_0xc330('0x9')](_0xc330('0x7'),auth[_0xc330('0xa')](),controller[_0xc330('0xb')]);router[_0xc330('0xc')](_0xc330('0x7'),auth[_0xc330('0xa')](),controller[_0xc330('0xd')]);module[_0xc330('0xe')]=router; \ No newline at end of file +var _0xa5dc=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','/:id','isAuthenticated','put','update','delete','destroy','exports','multer','util'];(function(_0x3ee986,_0x358289){var _0x133ea2=function(_0x41a157){while(--_0x41a157){_0x3ee986['push'](_0x3ee986['shift']());}};_0x133ea2(++_0x358289);}(_0xa5dc,0x7e));var _0xca5d=function(_0xcfcbaa,_0x369d95){_0xcfcbaa=_0xcfcbaa-0x0;var _0x157ed0=_0xa5dc[_0xcfcbaa];return _0x157ed0;};'use strict';var multer=require(_0xca5d('0x0'));var util=require(_0xca5d('0x1'));var path=require('path');var timeout=require(_0xca5d('0x2'));var express=require(_0xca5d('0x3'));var router=express[_0xca5d('0x4')]();var fs_extra=require(_0xca5d('0x5'));var auth=require(_0xca5d('0x6'));var interaction=require(_0xca5d('0x7'));var config=require('../../config/environment');var controller=require('./mailApplication.controller');router[_0xca5d('0x8')](_0xca5d('0x9'),auth[_0xca5d('0xa')](),controller['show']);router[_0xca5d('0xb')](_0xca5d('0x9'),auth[_0xca5d('0xa')](),controller[_0xca5d('0xc')]);router[_0xca5d('0xd')]('/:id',auth['isAuthenticated'](),controller[_0xca5d('0xe')]);module[_0xca5d('0xf')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 808e664..4add15a 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 _0xad72=['INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize'];(function(_0x334774,_0x14feff){var _0x240f77=function(_0x45a6af){while(--_0x45a6af){_0x334774['push'](_0x334774['shift']());}};_0x240f77(++_0x14feff);}(_0xad72,0x179));var _0x2ad7=function(_0x20fb13,_0x4c2383){_0x20fb13=_0x20fb13-0x0;var _0x45d7da=_0xad72[_0x20fb13];return _0x45d7da;};'use strict';var Sequelize=require(_0x2ad7('0x0'));module['exports']={'priority':{'type':Sequelize[_0x2ad7('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x2ad7('0x2')],'allowNull':![],'defaultValue':_0x2ad7('0x3')},'appdata':{'type':Sequelize[_0x2ad7('0x4')]()},'description':{'type':Sequelize[_0x2ad7('0x2')]},'interval':{'type':Sequelize[_0x2ad7('0x2')],'defaultValue':_0x2ad7('0x5')}}; \ No newline at end of file +var _0x2e28=['*,*,*,*','sequelize','exports','STRING','noop'];(function(_0x44f0a1,_0x457d11){var _0x4af42e=function(_0x15fcbf){while(--_0x15fcbf){_0x44f0a1['push'](_0x44f0a1['shift']());}};_0x4af42e(++_0x457d11);}(_0x2e28,0x6f));var _0x82e2=function(_0x543429,_0x140390){_0x543429=_0x543429-0x0;var _0x112a46=_0x2e28[_0x543429];return _0x112a46;};'use strict';var Sequelize=require(_0x82e2('0x0'));module[_0x82e2('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x82e2('0x2')],'allowNull':![],'defaultValue':_0x82e2('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x82e2('0x2')]},'interval':{'type':Sequelize[_0x82e2('0x2')],'defaultValue':_0x82e2('0x4')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 5d644ed..50731ad 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 _0xf4eb=['limit','count','Content-Range','json','apply','reject','save','then','destroy','error','name','send','params','keys','MailApplication','rawAttributes','query','filters','intersection','model','fields','attributes','includeAll','include','options','find','catch','body','eml-format','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined'];(function(_0x1149a7,_0x47f764){var _0x112605=function(_0x12ecf3){while(--_0x12ecf3){_0x1149a7['push'](_0x1149a7['shift']());}};_0x112605(++_0x47f764);}(_0xf4eb,0xec));var _0xbf4e=function(_0x384641,_0x14f611){_0x384641=_0x384641-0x0;var _0x1fb732=_0xf4eb[_0x384641];return _0x1fb732;};'use strict';var emlformat=require(_0xbf4e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xbf4e('0x1'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xbf4e('0x2'));var path=require(_0xbf4e('0x3'));var sox=require(_0xbf4e('0x4'));var csv=require(_0xbf4e('0x5'));var ejs=require(_0xbf4e('0x6'));var fs=require('fs');var fs_extra=require(_0xbf4e('0x7'));var _=require(_0xbf4e('0x8'));var squel=require('squel');var crypto=require(_0xbf4e('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xbf4e('0x5'));var querystring=require(_0xbf4e('0xa'));var Papa=require(_0xbf4e('0xb'));var Redis=require(_0xbf4e('0xc'));var authService=require(_0xbf4e('0xd'));var qs=require(_0xbf4e('0xe'));var as=require(_0xbf4e('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xbf4e('0x10'));var utils=require('../../config/utils');var config=require(_0xbf4e('0x11'));var licenseUtil=require(_0xbf4e('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x17fd01,_0x5a3035){_0x5a3035=_0x5a3035||0xcc;return function(_0x56d185){if(_0x56d185){return _0x17fd01[_0xbf4e('0x13')](_0x5a3035);}return _0x17fd01[_0xbf4e('0x14')](_0x5a3035)[_0xbf4e('0x15')]();};}function respondWithResult(_0x302841,_0x3b74bd){_0x3b74bd=_0x3b74bd||0xc8;return function(_0x61bd54){if(_0x61bd54){return _0x302841['status'](_0x3b74bd)['json'](_0x61bd54);}};}function respondWithFilteredResult(_0x180432,_0x1735ae){return function(_0x28fc6b){if(_0x28fc6b){var _0x542909=typeof _0x1735ae[_0xbf4e('0x16')]===_0xbf4e('0x17')&&typeof _0x1735ae[_0xbf4e('0x18')]===_0xbf4e('0x17');var _0x5a631e=_0x28fc6b[_0xbf4e('0x19')];var _0x577c27=_0x542909?0x0:_0x1735ae['offset'];var _0x566ec3=_0x542909?_0x28fc6b['count']:_0x1735ae[_0xbf4e('0x16')]+_0x1735ae[_0xbf4e('0x18')];var _0x1fc800;if(_0x566ec3>=_0x5a631e){_0x566ec3=_0x5a631e;_0x1fc800=0xc8;}else{_0x1fc800=0xce;}_0x180432['status'](_0x1fc800);return _0x180432['set'](_0xbf4e('0x1a'),_0x577c27+'-'+_0x566ec3+'/'+_0x5a631e)[_0xbf4e('0x1b')](_0x28fc6b);}return null;};}function patchUpdates(_0x3be138){return function(_0x3a875b){try{jsonpatch[_0xbf4e('0x1c')](_0x3a875b,_0x3be138,!![]);}catch(_0x1e2a68){return BPromise[_0xbf4e('0x1d')](_0x1e2a68);}return _0x3a875b[_0xbf4e('0x1e')]();};}function saveUpdates(_0xd09e12,_0x376832){return function(_0x30539b){if(_0x30539b){return _0x30539b['update'](_0xd09e12)[_0xbf4e('0x1f')](function(_0x2e7673){return _0x2e7673;});}return null;};}function removeEntity(_0x51648c,_0x31e3f5){return function(_0x30994d){if(_0x30994d){return _0x30994d[_0xbf4e('0x20')]()[_0xbf4e('0x1f')](function(){_0x51648c[_0xbf4e('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x90635e,_0x36688a){return function(_0x3d6863){if(!_0x3d6863){_0x90635e['sendStatus'](0x194);}return _0x3d6863;};}function handleError(_0x2fb490,_0x5e08b1){_0x5e08b1=_0x5e08b1||0x1f4;return function(_0x5bcf71){logger[_0xbf4e('0x21')](_0x5bcf71['stack']);if(_0x5bcf71[_0xbf4e('0x22')]){delete _0x5bcf71[_0xbf4e('0x22')];}_0x2fb490[_0xbf4e('0x14')](_0x5e08b1)[_0xbf4e('0x23')](_0x5bcf71);};}exports['show']=function(_0x2d4686,_0x8e0ab5){var _0x43879d={'raw':!![],'where':{'id':_0x2d4686[_0xbf4e('0x24')]['id']}},_0x4cd4a1={};_0x4cd4a1['model']=_[_0xbf4e('0x25')](db[_0xbf4e('0x26')][_0xbf4e('0x27')]);_0x4cd4a1['query']=_[_0xbf4e('0x25')](_0x2d4686[_0xbf4e('0x28')]);_0x4cd4a1[_0xbf4e('0x29')]=_[_0xbf4e('0x2a')](_0x4cd4a1[_0xbf4e('0x2b')],_0x4cd4a1[_0xbf4e('0x28')]);_0x43879d['attributes']=_[_0xbf4e('0x2a')](_0x4cd4a1[_0xbf4e('0x2b')],qs['fields'](_0x2d4686[_0xbf4e('0x28')][_0xbf4e('0x2c')]));_0x43879d['attributes']=_0x43879d[_0xbf4e('0x2d')]['length']?_0x43879d[_0xbf4e('0x2d')]:_0x4cd4a1['model'];if(_0x2d4686[_0xbf4e('0x28')][_0xbf4e('0x2e')]){_0x43879d[_0xbf4e('0x2f')]=[{'all':!![]}];}_0x43879d=_['merge']({},_0x43879d,_0x2d4686[_0xbf4e('0x30')]);return db[_0xbf4e('0x26')][_0xbf4e('0x31')](_0x43879d)[_0xbf4e('0x1f')](handleEntityNotFound(_0x8e0ab5,null))[_0xbf4e('0x1f')](respondWithResult(_0x8e0ab5,null))[_0xbf4e('0x32')](handleError(_0x8e0ab5,null));};exports['update']=function(_0x99b320,_0x3dbb2b){if(_0x99b320[_0xbf4e('0x33')]['id']){delete _0x99b320[_0xbf4e('0x33')]['id'];}return db[_0xbf4e('0x26')]['find']({'where':{'id':_0x99b320['params']['id']}})['then'](handleEntityNotFound(_0x3dbb2b,null))['then'](saveUpdates(_0x99b320[_0xbf4e('0x33')],null))[_0xbf4e('0x1f')](respondWithResult(_0x3dbb2b,null))[_0xbf4e('0x32')](handleError(_0x3dbb2b,null));};exports[_0xbf4e('0x20')]=function(_0x22ddde,_0x257b74){return db[_0xbf4e('0x26')][_0xbf4e('0x31')]({'where':{'id':_0x22ddde[_0xbf4e('0x24')]['id']}})['then'](handleEntityNotFound(_0x257b74,null))['then'](removeEntity(_0x257b74,null))[_0xbf4e('0x32')](handleError(_0x257b74,null));}; \ No newline at end of file +var _0x70e0=['util','sox','ejs','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','count','limit','set','apply','save','update','then','error','stack','name','send','show','model','keys','MailApplication','query','filters','attributes','intersection','length','includeAll','include','find','catch','body','params','eml-format','rimraf','zip-dir','moment','bluebird','mustache'];(function(_0x3d34fc,_0x19448a){var _0x35a98c=function(_0x34b179){while(--_0x34b179){_0x3d34fc['push'](_0x3d34fc['shift']());}};_0x35a98c(++_0x19448a);}(_0x70e0,0x17b));var _0x070e=function(_0x562175,_0x5677be){_0x562175=_0x562175-0x0;var _0x3b8956=_0x70e0[_0x562175];return _0x3b8956;};'use strict';var emlformat=require(_0x070e('0x0'));var rimraf=require(_0x070e('0x1'));var zipdir=require(_0x070e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x070e('0x3'));var BPromise=require(_0x070e('0x4'));var Mustache=require(_0x070e('0x5'));var util=require(_0x070e('0x6'));var path=require('path');var sox=require(_0x070e('0x7'));var csv=require('to-csv');var ejs=require(_0x070e('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x070e('0x9'));var jsforce=require(_0x070e('0xa'));var deskjs=require(_0x070e('0xb'));var toCsv=require(_0x070e('0xc'));var querystring=require(_0x070e('0xd'));var Papa=require(_0x070e('0xe'));var Redis=require(_0x070e('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x070e('0x10'));var hardwareService=require(_0x070e('0x11'));var logger=require(_0x070e('0x12'))(_0x070e('0x13'));var utils=require(_0x070e('0x14'));var config=require(_0x070e('0x15'));var licenseUtil=require(_0x070e('0x16'));var db=require(_0x070e('0x17'))['db'];function respondWithStatusCode(_0x39d2b9,_0x5bf079){_0x5bf079=_0x5bf079||0xcc;return function(_0x2930b8){if(_0x2930b8){return _0x39d2b9['sendStatus'](_0x5bf079);}return _0x39d2b9['status'](_0x5bf079)[_0x070e('0x18')]();};}function respondWithResult(_0x56c7ba,_0x4a33d2){_0x4a33d2=_0x4a33d2||0xc8;return function(_0x5bae0f){if(_0x5bae0f){return _0x56c7ba[_0x070e('0x19')](_0x4a33d2)[_0x070e('0x1a')](_0x5bae0f);}};}function respondWithFilteredResult(_0x51d14d,_0x5d3a38){return function(_0x373d86){if(_0x373d86){var _0xeae1a5=typeof _0x5d3a38[_0x070e('0x1b')]===_0x070e('0x1c')&&typeof _0x5d3a38['limit']==='undefined';var _0x17e2e4=_0x373d86[_0x070e('0x1d')];var _0x38f6e6=_0xeae1a5?0x0:_0x5d3a38[_0x070e('0x1b')];var _0x364b3f=_0xeae1a5?_0x373d86['count']:_0x5d3a38[_0x070e('0x1b')]+_0x5d3a38[_0x070e('0x1e')];var _0x1ad3de;if(_0x364b3f>=_0x17e2e4){_0x364b3f=_0x17e2e4;_0x1ad3de=0xc8;}else{_0x1ad3de=0xce;}_0x51d14d[_0x070e('0x19')](_0x1ad3de);return _0x51d14d[_0x070e('0x1f')]('Content-Range',_0x38f6e6+'-'+_0x364b3f+'/'+_0x17e2e4)['json'](_0x373d86);}return null;};}function patchUpdates(_0x4e958f){return function(_0x9907cf){try{jsonpatch[_0x070e('0x20')](_0x9907cf,_0x4e958f,!![]);}catch(_0x20dc60){return BPromise['reject'](_0x20dc60);}return _0x9907cf[_0x070e('0x21')]();};}function saveUpdates(_0x5dc5d2,_0xf8dd5d){return function(_0x3f6985){if(_0x3f6985){return _0x3f6985[_0x070e('0x22')](_0x5dc5d2)[_0x070e('0x23')](function(_0x28a1c3){return _0x28a1c3;});}return null;};}function removeEntity(_0xa86797,_0xe405e){return function(_0x164cdf){if(_0x164cdf){return _0x164cdf['destroy']()[_0x070e('0x23')](function(){_0xa86797[_0x070e('0x19')](0xcc)[_0x070e('0x18')]();});}};}function handleEntityNotFound(_0x503f4d,_0xf17c56){return function(_0x5f3e9d){if(!_0x5f3e9d){_0x503f4d['sendStatus'](0x194);}return _0x5f3e9d;};}function handleError(_0x2ccbd7,_0x25f6e){_0x25f6e=_0x25f6e||0x1f4;return function(_0x41deb1){logger[_0x070e('0x24')](_0x41deb1[_0x070e('0x25')]);if(_0x41deb1['name']){delete _0x41deb1[_0x070e('0x26')];}_0x2ccbd7[_0x070e('0x19')](_0x25f6e)[_0x070e('0x27')](_0x41deb1);};}exports[_0x070e('0x28')]=function(_0x43dd96,_0x28d7f2){var _0x1a1892={'raw':!![],'where':{'id':_0x43dd96['params']['id']}},_0x26373b={};_0x26373b[_0x070e('0x29')]=_[_0x070e('0x2a')](db[_0x070e('0x2b')]['rawAttributes']);_0x26373b['query']=_[_0x070e('0x2a')](_0x43dd96[_0x070e('0x2c')]);_0x26373b[_0x070e('0x2d')]=_['intersection'](_0x26373b[_0x070e('0x29')],_0x26373b[_0x070e('0x2c')]);_0x1a1892[_0x070e('0x2e')]=_[_0x070e('0x2f')](_0x26373b['model'],qs['fields'](_0x43dd96['query']['fields']));_0x1a1892[_0x070e('0x2e')]=_0x1a1892['attributes'][_0x070e('0x30')]?_0x1a1892[_0x070e('0x2e')]:_0x26373b['model'];if(_0x43dd96['query'][_0x070e('0x31')]){_0x1a1892[_0x070e('0x32')]=[{'all':!![]}];}_0x1a1892=_['merge']({},_0x1a1892,_0x43dd96['options']);return db[_0x070e('0x2b')][_0x070e('0x33')](_0x1a1892)[_0x070e('0x23')](handleEntityNotFound(_0x28d7f2,null))[_0x070e('0x23')](respondWithResult(_0x28d7f2,null))[_0x070e('0x34')](handleError(_0x28d7f2,null));};exports['update']=function(_0x482cc2,_0x24d17d){if(_0x482cc2[_0x070e('0x35')]['id']){delete _0x482cc2[_0x070e('0x35')]['id'];}return db[_0x070e('0x2b')][_0x070e('0x33')]({'where':{'id':_0x482cc2['params']['id']}})[_0x070e('0x23')](handleEntityNotFound(_0x24d17d,null))[_0x070e('0x23')](saveUpdates(_0x482cc2['body'],null))[_0x070e('0x23')](respondWithResult(_0x24d17d,null))[_0x070e('0x34')](handleError(_0x24d17d,null));};exports['destroy']=function(_0x4d4ee8,_0x5ddbe9){return db[_0x070e('0x2b')][_0x070e('0x33')]({'where':{'id':_0x4d4ee8[_0x070e('0x36')]['id']}})[_0x070e('0x23')](handleEntityNotFound(_0x5ddbe9,null))[_0x070e('0x23')](removeEntity(_0x5ddbe9,null))['catch'](handleError(_0x5ddbe9,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index c05e7e1..9cb5ee6 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 _0x6853=['bluebird','request-promise','path','rimraf','../../config/environment','./mailApplication.attributes','exports','utf8mb4','util','../../config/logger','api'];(function(_0x3573fb,_0x1b0c35){var _0x5ce833=function(_0x45eda7){while(--_0x45eda7){_0x3573fb['push'](_0x3573fb['shift']());}};_0x5ce833(++_0x1b0c35);}(_0x6853,0x1e1));var _0x3685=function(_0x2d5aff,_0x5616ef){_0x2d5aff=_0x2d5aff-0x0;var _0x287aa5=_0x6853[_0x2d5aff];return _0x287aa5;};'use strict';var _=require('lodash');var util=require(_0x3685('0x0'));var logger=require(_0x3685('0x1'))(_0x3685('0x2'));var moment=require('moment');var BPromise=require(_0x3685('0x3'));var rp=require(_0x3685('0x4'));var fs=require('fs');var path=require(_0x3685('0x5'));var rimraf=require(_0x3685('0x6'));var config=require(_0x3685('0x7'));var attributes=require(_0x3685('0x8'));module[_0x3685('0x9')]=function(_0x5aca0c,_0x113e58){return _0x5aca0c['define']('MailApplication',attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3685('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x3750=['util','api','moment','../../config/environment','./mailApplication.attributes','exports','define','MailApplication','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x41226f,_0x17f84d){var _0x33a8d6=function(_0x3e9c2f){while(--_0x3e9c2f){_0x41226f['push'](_0x41226f['shift']());}};_0x33a8d6(++_0x17f84d);}(_0x3750,0x15f));var _0x0375=function(_0xc1ede1,_0x27c567){_0xc1ede1=_0xc1ede1-0x0;var _0x36f293=_0x3750[_0xc1ede1];return _0x36f293;};'use strict';var _=require(_0x0375('0x0'));var util=require(_0x0375('0x1'));var logger=require('../../config/logger')(_0x0375('0x2'));var moment=require(_0x0375('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x0375('0x4'));var attributes=require(_0x0375('0x5'));module[_0x0375('0x6')]=function(_0x168eed,_0x5ac6b5){return _0x168eed[_0x0375('0x7')](_0x0375('0x8'),attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0375('0x9'),'collate':_0x0375('0xa')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index a31ad28..399e05d 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 _0x45fd=['stringify','error','message','MailApplication','update','body','options','attributes','UpdateMailApplication','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s'];(function(_0x430746,_0x383a2a){var _0x20e93c=function(_0x483c89){while(--_0x483c89){_0x430746['push'](_0x430746['shift']());}};_0x20e93c(++_0x383a2a);}(_0x45fd,0xac));var _0xd45f=function(_0x3234ef,_0x55d750){_0x3234ef=_0x3234ef-0x0;var _0x4099b8=_0x45fd[_0x3234ef];return _0x4099b8;};'use strict';var _=require(_0xd45f('0x0'));var util=require(_0xd45f('0x1'));var moment=require('moment');var BPromise=require(_0xd45f('0x2'));var rs=require(_0xd45f('0x3'));var fs=require('fs');var Redis=require(_0xd45f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd45f('0x5'));var logger=require(_0xd45f('0x6'))(_0xd45f('0x7'));var config=require(_0xd45f('0x8'));var jayson=require(_0xd45f('0x9'));var client=jayson[_0xd45f('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x33c963,_0x4227da,_0x2219cf){return new BPromise(function(_0x2cd4d6,_0x4dedde){return client['request'](_0x33c963,_0x2219cf)[_0xd45f('0xb')](function(_0xeaa067){logger[_0xd45f('0xc')](_0xd45f('0xd'),_0x4227da,_0xd45f('0xe'));logger[_0xd45f('0xf')](_0xd45f('0x10'),_0x4227da,_0xd45f('0xe'),JSON[_0xd45f('0x11')](_0xeaa067));if(_0xeaa067[_0xd45f('0x12')]){if(_0xeaa067['error']['code']===0x1f4){logger[_0xd45f('0x12')](_0xd45f('0xd'),_0x4227da,_0xeaa067[_0xd45f('0x12')][_0xd45f('0x13')]);return _0x4dedde(_0xeaa067[_0xd45f('0x12')]['message']);}logger[_0xd45f('0x12')](_0xd45f('0xd'),_0x4227da,_0xeaa067[_0xd45f('0x12')]['message']);return _0x2cd4d6(_0xeaa067[_0xd45f('0x12')][_0xd45f('0x13')]);}else{logger[_0xd45f('0xc')](_0xd45f('0xd'),_0x4227da,_0xd45f('0xe'));_0x2cd4d6(_0xeaa067['result'][_0xd45f('0x13')]);}})['catch'](function(_0x4896bf){logger['error'](_0xd45f('0xd'),_0x4227da,_0x4896bf);_0x4dedde(_0x4896bf);});});}exports['UpdateMailApplication']=function(_0x5825bf){var _0x3d7391=this;return new Promise(function(_0xb4e533,_0x4d074b){return db[_0xd45f('0x14')][_0xd45f('0x15')](_0x5825bf[_0xd45f('0x16')],{'raw':_0x5825bf[_0xd45f('0x17')]?_0x5825bf[_0xd45f('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5825bf[_0xd45f('0x17')]?_0x5825bf[_0xd45f('0x17')]['where']||null:null,'attributes':_0x5825bf[_0xd45f('0x17')]?_0x5825bf['options'][_0xd45f('0x18')]||null:null,'limit':_0x5825bf[_0xd45f('0x17')]?_0x5825bf[_0xd45f('0x17')]['limit']||null:null})['then'](function(_0x3e3079){logger['info'](_0xd45f('0x19'),_0x5825bf);logger[_0xd45f('0xf')](_0xd45f('0x19'),_0x5825bf,JSON['stringify'](_0x3e3079));_0xb4e533(_0x3e3079);})[_0xd45f('0x1a')](function(_0xd7e43b){logger['error'](_0xd45f('0x19'),_0xd7e43b['message'],_0x5825bf);_0x4d074b(_0x3d7391['error'](0x1f4,_0xd7e43b[_0xd45f('0x13')]));});});}; \ No newline at end of file +var _0xff6e=['code','message','info','catch','MailApplication','update','body','options','raw','where','attributes','limit','UpdateMailApplication','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','MailApplication,\x20%s,\x20%s','request\x20sent','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3cede3,_0x468270){var _0x48e29c=function(_0x3e4193){while(--_0x3e4193){_0x3cede3['push'](_0x3cede3['shift']());}};_0x48e29c(++_0x468270);}(_0xff6e,0x179));var _0xeff6=function(_0x41ee16,_0xfa94c3){_0x41ee16=_0x41ee16-0x0;var _0x1f60de=_0xff6e[_0x41ee16];return _0x1f60de;};'use strict';var _=require(_0xeff6('0x0'));var util=require(_0xeff6('0x1'));var moment=require(_0xeff6('0x2'));var BPromise=require(_0xeff6('0x3'));var rs=require(_0xeff6('0x4'));var fs=require('fs');var Redis=require(_0xeff6('0x5'));var db=require(_0xeff6('0x6'))['db'];var utils=require(_0xeff6('0x7'));var logger=require(_0xeff6('0x8'))(_0xeff6('0x9'));var config=require(_0xeff6('0xa'));var jayson=require(_0xeff6('0xb'));var client=jayson['client'][_0xeff6('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3ca8e7,_0x528941,_0x2b657a){return new BPromise(function(_0x27a43a,_0x3ab97c){return client['request'](_0x3ca8e7,_0x2b657a)[_0xeff6('0xd')](function(_0x3ee628){logger['info'](_0xeff6('0xe'),_0x528941,_0xeff6('0xf'));logger['debug'](_0xeff6('0x10'),_0x528941,'request\x20sent',JSON[_0xeff6('0x11')](_0x3ee628));if(_0x3ee628[_0xeff6('0x12')]){if(_0x3ee628[_0xeff6('0x12')][_0xeff6('0x13')]===0x1f4){logger[_0xeff6('0x12')](_0xeff6('0xe'),_0x528941,_0x3ee628[_0xeff6('0x12')][_0xeff6('0x14')]);return _0x3ab97c(_0x3ee628[_0xeff6('0x12')]['message']);}logger[_0xeff6('0x12')]('MailApplication,\x20%s,\x20%s',_0x528941,_0x3ee628['error'][_0xeff6('0x14')]);return _0x27a43a(_0x3ee628['error']['message']);}else{logger[_0xeff6('0x15')](_0xeff6('0xe'),_0x528941,_0xeff6('0xf'));_0x27a43a(_0x3ee628['result'][_0xeff6('0x14')]);}})[_0xeff6('0x16')](function(_0x591a5b){logger[_0xeff6('0x12')](_0xeff6('0xe'),_0x528941,_0x591a5b);_0x3ab97c(_0x591a5b);});});}exports['UpdateMailApplication']=function(_0x6f0b32){var _0x22e1f1=this;return new Promise(function(_0x218d97,_0x1e06a0){return db[_0xeff6('0x17')][_0xeff6('0x18')](_0x6f0b32[_0xeff6('0x19')],{'raw':_0x6f0b32['options']?_0x6f0b32[_0xeff6('0x1a')][_0xeff6('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x6f0b32[_0xeff6('0x1a')]?_0x6f0b32['options'][_0xeff6('0x1c')]||null:null,'attributes':_0x6f0b32[_0xeff6('0x1a')]?_0x6f0b32[_0xeff6('0x1a')][_0xeff6('0x1d')]||null:null,'limit':_0x6f0b32[_0xeff6('0x1a')]?_0x6f0b32['options'][_0xeff6('0x1e')]||null:null})[_0xeff6('0xd')](function(_0x4275eb){logger['info'](_0xeff6('0x1f'),_0x6f0b32);logger[_0xeff6('0x20')](_0xeff6('0x1f'),_0x6f0b32,JSON[_0xeff6('0x11')](_0x4275eb));_0x218d97(_0x4275eb);})[_0xeff6('0x16')](function(_0x185cca){logger[_0xeff6('0x12')]('UpdateMailApplication',_0x185cca['message'],_0x6f0b32);_0x1e06a0(_0x22e1f1[_0xeff6('0x12')](0x1f4,_0x185cca[_0xeff6('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 6658220..81ac09b 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 _0xd80f=['/:id/tags','tracked','mail','mailinteraction:addtags','addTags','put','update','mailinteraction:destroy','destroy','delete','removeTags','exports','express','Router','../../components/auth/service','./mailInteraction.controller','get','index','/describe','isAuthenticated','/:id','show','/:id/messages','getMessages','post','create','addMessage'];(function(_0xf2628e,_0x521bf7){var _0x13863a=function(_0x2b04ab){while(--_0x2b04ab){_0xf2628e['push'](_0xf2628e['shift']());}};_0x13863a(++_0x521bf7);}(_0xd80f,0xae));var _0xfd80=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd80f[_0x3dd15e];return _0x231fd0;};'use strict';var express=require(_0xfd80('0x0'));var router=express[_0xfd80('0x1')]();var auth=require(_0xfd80('0x2'));var interaction=require('../../components/interaction/service');var controller=require(_0xfd80('0x3'));router[_0xfd80('0x4')]('/',auth['isAuthenticated'](),controller[_0xfd80('0x5')]);router[_0xfd80('0x4')](_0xfd80('0x6'),auth[_0xfd80('0x7')](),controller['describe']);router['get'](_0xfd80('0x8'),auth['isAuthenticated'](),controller[_0xfd80('0x9')]);router[_0xfd80('0x4')](_0xfd80('0xa'),auth[_0xfd80('0x7')](),controller[_0xfd80('0xb')]);router[_0xfd80('0x4')]('/:id/download',auth[_0xfd80('0x7')](),controller['download']);router[_0xfd80('0xc')]('/',auth[_0xfd80('0x7')](),controller[_0xfd80('0xd')]);router[_0xfd80('0xc')]('/:id/messages',auth[_0xfd80('0x7')](),controller[_0xfd80('0xe')]);router['post'](_0xfd80('0xf'),auth[_0xfd80('0x7')](),interaction[_0xfd80('0x10')](_0xfd80('0x11'),_0xfd80('0x12')),controller[_0xfd80('0x13')]);router[_0xfd80('0x14')](_0xfd80('0x8'),auth['isAuthenticated'](),interaction[_0xfd80('0x10')](_0xfd80('0x11'),'mailinteraction:update'),controller[_0xfd80('0x15')]);router['delete'](_0xfd80('0x8'),auth[_0xfd80('0x7')](),interaction[_0xfd80('0x10')](_0xfd80('0x11'),_0xfd80('0x16')),controller[_0xfd80('0x17')]);router[_0xfd80('0x18')](_0xfd80('0xf'),auth[_0xfd80('0x7')](),controller[_0xfd80('0x19')]);module[_0xfd80('0x1a')]=router; \ No newline at end of file +var _0xe280=['/:id/messages','/:id/download','download','post','create','mailinteraction:addtags','addTags','put','tracked','update','delete','mail','mailinteraction:destroy','destroy','removeTags','exports','express','../../components/interaction/service','./mailInteraction.controller','get','index','/describe','describe','/:id','isAuthenticated','show'];(function(_0x219213,_0xf446a6){var _0xec6fde=function(_0x1f281d){while(--_0x1f281d){_0x219213['push'](_0x219213['shift']());}};_0xec6fde(++_0xf446a6);}(_0xe280,0xe0));var _0x0e28=function(_0x166d93,_0x301f09){_0x166d93=_0x166d93-0x0;var _0xba708=_0xe280[_0x166d93];return _0xba708;};'use strict';var express=require(_0x0e28('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x0e28('0x1'));var controller=require(_0x0e28('0x2'));router[_0x0e28('0x3')]('/',auth['isAuthenticated'](),controller[_0x0e28('0x4')]);router[_0x0e28('0x3')](_0x0e28('0x5'),auth['isAuthenticated'](),controller[_0x0e28('0x6')]);router[_0x0e28('0x3')](_0x0e28('0x7'),auth[_0x0e28('0x8')](),controller[_0x0e28('0x9')]);router[_0x0e28('0x3')](_0x0e28('0xa'),auth[_0x0e28('0x8')](),controller['getMessages']);router['get'](_0x0e28('0xb'),auth['isAuthenticated'](),controller[_0x0e28('0xc')]);router[_0x0e28('0xd')]('/',auth['isAuthenticated'](),controller[_0x0e28('0xe')]);router['post'](_0x0e28('0xa'),auth[_0x0e28('0x8')](),controller['addMessage']);router[_0x0e28('0xd')]('/:id/tags',auth[_0x0e28('0x8')](),interaction['tracked']('mail',_0x0e28('0xf')),controller[_0x0e28('0x10')]);router[_0x0e28('0x11')](_0x0e28('0x7'),auth['isAuthenticated'](),interaction[_0x0e28('0x12')]('mail','mailinteraction:update'),controller[_0x0e28('0x13')]);router[_0x0e28('0x14')](_0x0e28('0x7'),auth[_0x0e28('0x8')](),interaction[_0x0e28('0x12')](_0x0e28('0x15'),_0x0e28('0x16')),controller[_0x0e28('0x17')]);router[_0x0e28('0x14')]('/:id/tags',auth[_0x0e28('0x8')](),controller[_0x0e28('0x18')]);module[_0x0e28('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 1476994..a63f9fb 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 _0x60c5=['sequelize','iconv','exports','BOOLEAN','DATE','STRING','TEXT','out','ENUM','INTEGER'];(function(_0x43606b,_0x2f2292){var _0xbfd21a=function(_0x2f28fa){while(--_0x2f28fa){_0x43606b['push'](_0x43606b['shift']());}};_0xbfd21a(++_0x2f2292);}(_0x60c5,0xdc));var _0x560c=function(_0x2ddc92,_0x1cea86){_0x2ddc92=_0x2ddc92-0x0;var _0x3be675=_0x60c5[_0x2ddc92];return _0x3be675;};'use strict';var Sequelize=require(_0x560c('0x0'));var iconv=require(_0x560c('0x1'));module[_0x560c('0x2')]={'closed':{'type':Sequelize[_0x560c('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x560c('0x4')]},'disposition':{'type':Sequelize[_0x560c('0x5')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x560c('0x5')]},'note':{'type':Sequelize[_0x560c('0x5')]},'inReplyTo':{'type':Sequelize[_0x560c('0x5')](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x560c('0x6')]('long')},'subject':{'type':Sequelize[_0x560c('0x6')]()},'attach':{'type':Sequelize[_0x560c('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x560c('0x4')]},'substatus':{'type':Sequelize[_0x560c('0x5')](0x3c)},'substatusAt':{'type':Sequelize[_0x560c('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x560c('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x560c('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x560c('0x8')]('in',_0x560c('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x560c('0x3')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x560c('0x9')]}}; \ No newline at end of file +var _0x24e9=['ENUM','out','INTEGER','sequelize','exports','BOOLEAN','DATE','STRING','TEXT','long'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x24e9,0x14d));var _0x924e=function(_0x4d82ea,_0x4d459f){_0x4d82ea=_0x4d82ea-0x0;var _0x257f4a=_0x24e9[_0x4d82ea];return _0x257f4a;};'use strict';var Sequelize=require(_0x924e('0x0'));var iconv=require('iconv');module[_0x924e('0x1')]={'closed':{'type':Sequelize[_0x924e('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x924e('0x3')]},'disposition':{'type':Sequelize[_0x924e('0x4')]},'secondDisposition':{'type':Sequelize[_0x924e('0x4')]},'thirdDisposition':{'type':Sequelize[_0x924e('0x4')]},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x924e('0x4')](0x1fe)},'to':{'type':Sequelize[_0x924e('0x4')]},'cc':{'type':Sequelize[_0x924e('0x5')](_0x924e('0x6'))},'subject':{'type':Sequelize[_0x924e('0x5')]()},'attach':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x924e('0x3')]},'substatus':{'type':Sequelize[_0x924e('0x4')](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x924e('0x7')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x924e('0x7')]('in',_0x924e('0x8')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x924e('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x924e('0x9')]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 86a9c11..763e6ff 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 _0xbbd4=['toString','join','root','server','files','tmp','transcript-%d-%s.zip','attachments','Attachment','Attachments','Messages','from','subject','createdAt','sort','get','each','missing.recipient@your.company.com','decode','headers','Bcc','bcc','basename','existsSync','type','readFileSync','message%d.eml','unlinkSync','eml-format','rimraf','moment','util','lodash','juice','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','html-entities','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','sendStatus','status','json','offset','undefined','count','set','Content-Range','update','destroy','then','error','stack','name','send','index','map','rawAttributes','fieldName','findAll','mail','user','show','params','model','query','filters','intersection','fields','attributes','include','merge','options','find','catch','create','body','MailInteraction','addMessage','ids','omit','getMessages','keys','length','limit','order','where','pick','MailInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','inlineCss','true','rows','spread','Tag','color','emit','mailInteractionTags:save','removeTags','download','unix'];(function(_0x5b3f5f,_0x204206){var _0x40ec47=function(_0x4964d1){while(--_0x4964d1){_0x5b3f5f['push'](_0x5b3f5f['shift']());}};_0x40ec47(++_0x204206);}(_0xbbd4,0x1e0));var _0x4bbd=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xbbd4[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x4bbd('0x0'));var rimraf=require(_0x4bbd('0x1'));var zipdir=require('zip-dir');var moment=require(_0x4bbd('0x2'));var BPromise=require('bluebird');var util=require(_0x4bbd('0x3'));var path=require('path');var fs=require('fs');var _=require(_0x4bbd('0x4'));var juice=require(_0x4bbd('0x5'));var Redis=require('ioredis');var interaction=require(_0x4bbd('0x6'));var qs=require(_0x4bbd('0x7'));var logger=require(_0x4bbd('0x8'))(_0x4bbd('0x9'));var config=require(_0x4bbd('0xa'));var db=require(_0x4bbd('0xb'))['db'];var htmlEntities=require(_0x4bbd('0xc'));config[_0x4bbd('0xd')]=_[_0x4bbd('0xe')](config['redis'],{'host':_0x4bbd('0xf'),'port':0x18eb});var socket=require(_0x4bbd('0x10'))(new Redis(config['redis']));require(_0x4bbd('0x11'))[_0x4bbd('0x12')](socket);function respondWithStatusCode(_0x6be978,_0x579489){_0x579489=_0x579489||0xcc;return function(_0x5a62dd){if(_0x5a62dd){return _0x6be978[_0x4bbd('0x13')](_0x579489);}return _0x6be978[_0x4bbd('0x14')](_0x579489)['end']();};}function respondWithResult(_0x42b9e8,_0x6f00db){_0x6f00db=_0x6f00db||0xc8;return function(_0x2a44db){if(_0x2a44db){return _0x42b9e8['status'](_0x6f00db)[_0x4bbd('0x15')](_0x2a44db);}};}function respondWithFilteredResult(_0x391858,_0x4daf86){return function(_0x399a82){if(_0x399a82){var _0x3143f2=typeof _0x4daf86[_0x4bbd('0x16')]===_0x4bbd('0x17')&&typeof _0x4daf86['limit']==='undefined';var _0x2a1ac4=_0x399a82[_0x4bbd('0x18')];var _0x3869d2=_0x3143f2?0x0:_0x4daf86[_0x4bbd('0x16')];var _0x3e9855=_0x3143f2?_0x399a82['count']:_0x4daf86[_0x4bbd('0x16')]+_0x4daf86['limit'];var _0x300262;if(_0x3e9855>=_0x2a1ac4){_0x3e9855=_0x2a1ac4;_0x300262=0xc8;}else{_0x300262=0xce;}_0x391858[_0x4bbd('0x14')](_0x300262);return _0x391858[_0x4bbd('0x19')](_0x4bbd('0x1a'),_0x3869d2+'-'+_0x3e9855+'/'+_0x2a1ac4)[_0x4bbd('0x15')](_0x399a82);}return null;};}function saveUpdates(_0x8e87a8){return function(_0x4a27a2){if(_0x4a27a2){return _0x4a27a2[_0x4bbd('0x1b')](_0x8e87a8)['then'](function(_0x37dd2b){return _0x37dd2b;});}return null;};}function removeEntity(_0x365529){return function(_0xf8be8){if(_0xf8be8){return _0xf8be8[_0x4bbd('0x1c')]()[_0x4bbd('0x1d')](function(){_0x365529[_0x4bbd('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ddff2){return function(_0x57007a){if(!_0x57007a){_0x1ddff2['sendStatus'](0x194);}return _0x57007a;};}function handleError(_0x1ffb7e,_0x108564){_0x108564=_0x108564||0x1f4;return function(_0x1b4c8f){logger[_0x4bbd('0x1e')](_0x1b4c8f[_0x4bbd('0x1f')]);if(_0x1b4c8f[_0x4bbd('0x20')]){delete _0x1b4c8f[_0x4bbd('0x20')];}_0x1ffb7e[_0x4bbd('0x14')](_0x108564)[_0x4bbd('0x21')](_0x1b4c8f);};}exports[_0x4bbd('0x22')]=function(_0x5ce19d,_0x492cc1){var _0x530a9a={};var _0x249431=_[_0x4bbd('0x23')](db['MailInteraction'][_0x4bbd('0x24')],function(_0x4a36bb){return{'name':_0x4a36bb[_0x4bbd('0x25')],'type':_0x4a36bb['type']['key']};});_0x530a9a=qs['getOptions'](_0x249431,_0x5ce19d);return interaction[_0x4bbd('0x26')](_0x4bbd('0x27'),_0x5ce19d['query'],_0x5ce19d[_0x4bbd('0x28')],_0x530a9a,_0x249431)[_0x4bbd('0x1d')](respondWithFilteredResult(_0x492cc1,_0x530a9a))['catch'](handleError(_0x492cc1,null));};exports[_0x4bbd('0x29')]=function(_0x58fffd,_0x5136e2){var _0x138918={'raw':![],'where':{'id':_0x58fffd[_0x4bbd('0x2a')]['id']}},_0x398cf3={};_0x398cf3[_0x4bbd('0x2b')]=_['keys'](db['MailInteraction'][_0x4bbd('0x24')]);_0x398cf3[_0x4bbd('0x2c')]=_['keys'](_0x58fffd[_0x4bbd('0x2c')]);_0x398cf3[_0x4bbd('0x2d')]=_[_0x4bbd('0x2e')](_0x398cf3[_0x4bbd('0x2b')],_0x398cf3[_0x4bbd('0x2c')]);_0x138918['attributes']=_[_0x4bbd('0x2e')](_0x398cf3['model'],qs[_0x4bbd('0x2f')](_0x58fffd[_0x4bbd('0x2c')][_0x4bbd('0x2f')]));_0x138918[_0x4bbd('0x30')]=_0x138918[_0x4bbd('0x30')]['length']?_0x138918[_0x4bbd('0x30')]:_0x398cf3[_0x4bbd('0x2b')];if(_0x58fffd[_0x4bbd('0x2c')]['includeAll']){_0x138918[_0x4bbd('0x31')]=[{'all':!![]}];}_0x138918=_[_0x4bbd('0x32')]({},_0x138918,_0x58fffd[_0x4bbd('0x33')]);return db['MailInteraction'][_0x4bbd('0x34')](_0x138918)[_0x4bbd('0x1d')](handleEntityNotFound(_0x5136e2,null))['then'](respondWithResult(_0x5136e2,null))[_0x4bbd('0x35')](handleError(_0x5136e2,null));};exports[_0x4bbd('0x36')]=function(_0x482919,_0x419c30){return db['MailInteraction'][_0x4bbd('0x36')](_0x482919[_0x4bbd('0x37')],{})[_0x4bbd('0x1d')](respondWithResult(_0x419c30,0xc9))['catch'](handleError(_0x419c30,null));};exports[_0x4bbd('0x1b')]=function(_0x4bab32,_0x4a840b){if(_0x4bab32[_0x4bbd('0x37')]['id']){delete _0x4bab32[_0x4bbd('0x37')]['id'];}return db[_0x4bbd('0x38')][_0x4bbd('0x34')]({'where':{'id':_0x4bab32[_0x4bbd('0x2a')]['id']}})[_0x4bbd('0x1d')](handleEntityNotFound(_0x4a840b,null))['then'](saveUpdates(_0x4bab32['body'],null))[_0x4bbd('0x1d')](respondWithResult(_0x4a840b,null))['catch'](handleError(_0x4a840b,null));};exports[_0x4bbd('0x1c')]=function(_0x13d217,_0x653994){return db['MailInteraction']['find']({'where':{'id':_0x13d217[_0x4bbd('0x2a')]['id']}})[_0x4bbd('0x1d')](handleEntityNotFound(_0x653994,null))['then'](removeEntity(_0x653994,null))[_0x4bbd('0x35')](handleError(_0x653994,null));};exports['describe']=function(_0x34d95b,_0xac3921){return db['MailInteraction']['describe']()['then'](respondWithResult(_0xac3921,null))[_0x4bbd('0x35')](handleError(_0xac3921,null));};exports[_0x4bbd('0x39')]=function(_0x4c1102,_0x4e5a9c){return db['MailMessage']['find']({'where':{'id':_0x4c1102[_0x4bbd('0x2a')]['id']}})[_0x4bbd('0x1d')](handleEntityNotFound(_0x4e5a9c,null))[_0x4bbd('0x1d')](function(_0x9739f9){if(_0x9739f9){return _0x9739f9[_0x4bbd('0x39')](_0x4c1102[_0x4bbd('0x37')][_0x4bbd('0x3a')],_[_0x4bbd('0x3b')](_0x4c1102[_0x4bbd('0x37')],[_0x4bbd('0x3a'),'id'])||{});}})['then'](respondWithResult(_0x4e5a9c,null))['catch'](handleError(_0x4e5a9c,null));};exports[_0x4bbd('0x3c')]=function(_0x255ab9,_0x3aaf6c){var _0x5a2483={'raw':![],'where':{}};var _0x2d10a6={};var _0xd3e6e5={'count':0x0,'rows':[]};return db['MailInteraction']['findOne']({'where':{'id':_0x255ab9[_0x4bbd('0x2a')]['id']}})[_0x4bbd('0x1d')](handleEntityNotFound(_0x3aaf6c,null))[_0x4bbd('0x1d')](function(_0x1c2e03){if(_0x1c2e03){_0x2d10a6[_0x4bbd('0x2b')]=_[_0x4bbd('0x3d')](db['MailMessage'][_0x4bbd('0x24')]);_0x2d10a6[_0x4bbd('0x2c')]=_[_0x4bbd('0x3d')](_0x255ab9['query']);_0x2d10a6[_0x4bbd('0x2d')]=_[_0x4bbd('0x2e')](_0x2d10a6[_0x4bbd('0x2b')],_0x2d10a6[_0x4bbd('0x2c')]);_0x5a2483[_0x4bbd('0x30')]=_[_0x4bbd('0x2e')](_0x2d10a6['model'],qs[_0x4bbd('0x2f')](_0x255ab9[_0x4bbd('0x2c')][_0x4bbd('0x2f')]));_0x5a2483[_0x4bbd('0x30')]=_0x5a2483[_0x4bbd('0x30')][_0x4bbd('0x3e')]?_0x5a2483[_0x4bbd('0x30')]:_0x2d10a6[_0x4bbd('0x2b')];if(!_0x255ab9[_0x4bbd('0x2c')]['hasOwnProperty']('nolimit')){_0x5a2483[_0x4bbd('0x3f')]=qs[_0x4bbd('0x3f')](_0x255ab9[_0x4bbd('0x2c')]['limit']);_0x5a2483['offset']=qs[_0x4bbd('0x16')](_0x255ab9[_0x4bbd('0x2c')]['offset']);}_0x5a2483[_0x4bbd('0x40')]=qs['sort'](_0x255ab9[_0x4bbd('0x2c')]['sort']);_0x5a2483[_0x4bbd('0x41')]=qs[_0x4bbd('0x2d')](_[_0x4bbd('0x42')](_0x255ab9[_0x4bbd('0x2c')],_0x2d10a6['filters']));_0x5a2483[_0x4bbd('0x41')][_0x4bbd('0x43')]=_0x1c2e03['id'];if(_0x255ab9['query'][_0x4bbd('0x44')]){_0x5a2483[_0x4bbd('0x41')]=_['merge'](_0x5a2483[_0x4bbd('0x41')],{'$or':_['map'](_0x5a2483['attributes'],function(_0x3efae4){var _0x3bfea0={};_0x3bfea0[_0x3efae4]={'$like':'%'+_0x255ab9[_0x4bbd('0x2c')]['filter']+'%'};return _0x3bfea0;})});}if(_0x255ab9['query'][_0x4bbd('0x45')]){var _0x1d31cd=_0x255ab9[_0x4bbd('0x2c')][_0x4bbd('0x45')][_0x4bbd('0x46')](',');var _0x56d0c4={};_0x56d0c4[_0x1d31cd[0x0]]={'$gte':moment(_0x1d31cd[0x1])[_0x4bbd('0x47')](_0x4bbd('0x48'))};_0x5a2483[_0x4bbd('0x41')]=_[_0x4bbd('0x32')](_0x5a2483['where'],_0x56d0c4);}_0x5a2483=_['merge']({},_0x5a2483,_0x255ab9[_0x4bbd('0x33')]);return db[_0x4bbd('0x49')][_0x4bbd('0x18')]({'where':_0x5a2483[_0x4bbd('0x41')]})[_0x4bbd('0x1d')](function(_0x9afeea){_0xd3e6e5[_0x4bbd('0x18')]=_0x9afeea;if(_0x255ab9['query']['includeAll']){_0x5a2483[_0x4bbd('0x31')]=[{'all':!![]}];}return db[_0x4bbd('0x49')][_0x4bbd('0x26')](_0x5a2483);})['then'](function(_0x490af0){if(_0x255ab9[_0x4bbd('0x2c')][_0x4bbd('0x4a')]===_0x4bbd('0x4b')){for(var _0x38aaee=0x0;_0x38aaee<_0x490af0[_0x4bbd('0x3e')];_0x38aaee++){_0x490af0[_0x38aaee][_0x4bbd('0x37')]=juice(_0x490af0[_0x38aaee][_0x4bbd('0x37')]);}}_0xd3e6e5[_0x4bbd('0x4c')]=_0x490af0;return _0xd3e6e5;});}})[_0x4bbd('0x1d')](respondWithFilteredResult(_0x3aaf6c,_0x5a2483))['catch'](handleError(_0x3aaf6c,null));};exports['addTags']=function(_0x1b9246,_0x5250c8){return db['MailInteraction'][_0x4bbd('0x34')]({'where':{'id':_0x1b9246[_0x4bbd('0x2a')]['id']}})['then'](handleEntityNotFound(_0x5250c8,null))[_0x4bbd('0x1d')](function(_0x4b850e){if(_0x4b850e){return _0x4b850e['setTags'](_0x1b9246['body'][_0x4bbd('0x3a')],_[_0x4bbd('0x3b')](_0x1b9246[_0x4bbd('0x37')],[_0x4bbd('0x3a'),'id'])||{})[_0x4bbd('0x4d')](function(){return db[_0x4bbd('0x4e')][_0x4bbd('0x26')]({'attributes':['id',_0x4bbd('0x20'),_0x4bbd('0x4f')],'where':{'id':_0x1b9246[_0x4bbd('0x37')][_0x4bbd('0x3a')]}});})[_0x4bbd('0x1d')](function(_0x4f07be){socket[_0x4bbd('0x50')](_0x4bbd('0x51'),{'id':Number(_0x1b9246[_0x4bbd('0x2a')]['id']),'tags':_0x4f07be||[]});return{'id':Number(_0x1b9246[_0x4bbd('0x2a')]['id']),'tags':_0x4f07be||[]};});}})['then'](respondWithResult(_0x5250c8,null))['catch'](handleError(_0x5250c8,null));};exports['removeTags']=function(_0x17d89e,_0x499102){return db[_0x4bbd('0x38')]['find']({'where':{'id':_0x17d89e[_0x4bbd('0x2a')]['id']}})[_0x4bbd('0x1d')](handleEntityNotFound(_0x499102,null))[_0x4bbd('0x1d')](function(_0x155e46){if(_0x155e46){return _0x155e46[_0x4bbd('0x52')](_0x17d89e[_0x4bbd('0x2c')][_0x4bbd('0x3a')]);}})[_0x4bbd('0x1d')](respondWithStatusCode(_0x499102,null))[_0x4bbd('0x35')](handleError(_0x499102,null));};exports[_0x4bbd('0x53')]=function(_0x50e3ae,_0x5b4283){var _0xf3fdfc=moment()[_0x4bbd('0x54')]()[_0x4bbd('0x55')]();var _0x407186=path[_0x4bbd('0x56')](config[_0x4bbd('0x57')],_0x4bbd('0x58'),_0x4bbd('0x59'),_0x4bbd('0x5a'));var _0x1e1eb5=path[_0x4bbd('0x56')](config[_0x4bbd('0x57')],_0x4bbd('0x58'),'files','attachments');var _0x3ee53c=path['join'](_0x407186,_0xf3fdfc);var _0x58511f=util[_0x4bbd('0x47')](_0x4bbd('0x5b'),_0x50e3ae['params']['id'],_0xf3fdfc);var _0x116a52=path[_0x4bbd('0x56')](_0x407186,_0x58511f);var _0x459273=[];if(_0x50e3ae[_0x4bbd('0x2c')][_0x4bbd('0x5c')]){_0x459273['push']({'model':db[_0x4bbd('0x5d')],'as':_0x4bbd('0x5e'),'raw':!![]});}var _0x5e0e4c=[{'model':db[_0x4bbd('0x49')],'as':_0x4bbd('0x5f'),'attributes':['id',_0x4bbd('0x37'),_0x4bbd('0x60'),'to','cc','bcc',_0x4bbd('0x61'),_0x4bbd('0x62')],'where':{'secret':![]},'order':qs[_0x4bbd('0x63')]('id'),'include':_0x459273}];return db[_0x4bbd('0x38')]['find']({'where':{'id':_0x50e3ae[_0x4bbd('0x2a')]['id']},'include':_0x5e0e4c})[_0x4bbd('0x1d')](handleEntityNotFound(_0x5b4283,null))['then'](function(_0x16f5b7){if(_0x16f5b7&&_0x16f5b7[_0x4bbd('0x5f')]){var _0x14d868=_0x16f5b7[_0x4bbd('0x64')]({'plain':!![]});fs['mkdirSync'](_0x3ee53c);return BPromise[_0x4bbd('0x65')](_0x14d868['Messages'],function(_0x52034e,_0x8791dd){var _0x133119={'from':_0x52034e[_0x4bbd('0x60')],'to':_0x52034e['to']||_0x4bbd('0x66'),'subject':_0x52034e['subject'],'html':htmlEntities[_0x4bbd('0x67')](_0x52034e['body']),'headers':{'Date':moment(_0x52034e['createdAt'])[_0x4bbd('0x47')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x52034e['cc']){_0x133119[_0x4bbd('0x68')]['Cc']=_0x52034e['cc'];}if(_0x52034e['bcc']){_0x133119[_0x4bbd('0x68')][_0x4bbd('0x69')]=_0x52034e[_0x4bbd('0x6a')];}return new BPromise(function(_0x14287b,_0xf9c0c2){if(_0x52034e[_0x4bbd('0x5e')]){for(var _0x52ad58=0x0;_0x52ad58<_0x52034e[_0x4bbd('0x5e')][_0x4bbd('0x3e')];_0x52ad58++){var _0x36177f=_0x52034e[_0x4bbd('0x5e')][_0x52ad58];var _0x1ca237=path[_0x4bbd('0x56')](_0x1e1eb5,_0x36177f[_0x4bbd('0x6b')]);if(fs[_0x4bbd('0x6c')](_0x1ca237)){_0x133119[_0x4bbd('0x5c')]['push']({'name':_0x36177f['name'],'contentType':_0x36177f[_0x4bbd('0x6d')],'data':fs[_0x4bbd('0x6e')](_0x1ca237)});}}}emlformat['build'](_0x133119,function(_0x459813,_0x318884){if(_0x459813)return _0xf9c0c2(_0x459813);fs['writeFileSync'](path[_0x4bbd('0x56')](_0x3ee53c,util[_0x4bbd('0x47')](_0x4bbd('0x6f'),_0x8791dd)),_0x318884);return _0x14287b(_0x318884);});});})[_0x4bbd('0x1d')](function(){return new BPromise(function(_0x177648,_0x40044a){zipdir(_0x3ee53c,{'saveTo':_0x116a52},function(_0x320182,_0x2ebebe){if(_0x320182)return _0x40044a(_0x320182);return _0x177648(_0x2ebebe);});})[_0x4bbd('0x1d')](function(){return new BPromise(function(_0x510c6d,_0xea2f40){rimraf(_0x3ee53c,function(_0x4dc94c){if(_0x4dc94c)_0xea2f40(_0x4dc94c);return _0x510c6d();});});})['then'](function(){return _0x5b4283[_0x4bbd('0x53')](_0x116a52,_0x58511f,function(_0x43412f){if(!_0x43412f)fs[_0x4bbd('0x70')](_0x116a52);});});});}else{return _0x5b4283['sendStatus'](0xc8);}})[_0x4bbd('0x35')](handleError(_0x5b4283,null));}; \ No newline at end of file +var _0x9dff=['toString','join','root','files','tmp','server','transcript-%d-%s.zip','attachments','Attachment','Attachments','Messages','from','bcc','subject','get','mkdirSync','each','createdAt','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','basename','writeFileSync','unlinkSync','eml-format','moment','bluebird','util','path','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','html-entities','defaults','redis','socket.io-emitter','./mailInteraction.socket','register','status','end','json','offset','undefined','limit','count','set','Content-Range','then','destroy','sendStatus','stack','name','send','index','map','MailInteraction','type','key','findAll','mail','query','user','catch','show','params','keys','rawAttributes','intersection','model','attributes','fields','length','includeAll','merge','options','find','create','update','body','describe','addMessage','ids','omit','getMessages','findOne','MailMessage','hasOwnProperty','nolimit','order','sort','filters','pick','where','MailInteractionId','filter','$gte','format','inlineCss','true','rows','addTags','setTags','spread','Tag','color','emit','mailInteractionTags:save','removeTags','unix'];(function(_0x54a5cb,_0x4e5f16){var _0x168e1c=function(_0x3c97a9){while(--_0x3c97a9){_0x54a5cb['push'](_0x54a5cb['shift']());}};_0x168e1c(++_0x4e5f16);}(_0x9dff,0x1d4));var _0xf9df=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x9dff[_0x3ab51d];return _0x29a04e;};'use strict';var emlformat=require(_0xf9df('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var moment=require(_0xf9df('0x1'));var BPromise=require(_0xf9df('0x2'));var util=require(_0xf9df('0x3'));var path=require(_0xf9df('0x4'));var fs=require('fs');var _=require('lodash');var juice=require('juice');var Redis=require(_0xf9df('0x5'));var interaction=require('../../components/interaction/service');var qs=require(_0xf9df('0x6'));var logger=require(_0xf9df('0x7'))(_0xf9df('0x8'));var config=require(_0xf9df('0x9'));var db=require('../../mysqldb')['db'];var htmlEntities=require(_0xf9df('0xa'));config['redis']=_[_0xf9df('0xb')](config[_0xf9df('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xf9df('0xd'))(new Redis(config['redis']));require(_0xf9df('0xe'))[_0xf9df('0xf')](socket);function respondWithStatusCode(_0x5d4ed6,_0x1412c3){_0x1412c3=_0x1412c3||0xcc;return function(_0x1b1fa9){if(_0x1b1fa9){return _0x5d4ed6['sendStatus'](_0x1412c3);}return _0x5d4ed6[_0xf9df('0x10')](_0x1412c3)[_0xf9df('0x11')]();};}function respondWithResult(_0x4c5640,_0x50665d){_0x50665d=_0x50665d||0xc8;return function(_0x4928da){if(_0x4928da){return _0x4c5640[_0xf9df('0x10')](_0x50665d)[_0xf9df('0x12')](_0x4928da);}};}function respondWithFilteredResult(_0x403601,_0x5cebdc){return function(_0x569bc8){if(_0x569bc8){var _0x4cc588=typeof _0x5cebdc[_0xf9df('0x13')]===_0xf9df('0x14')&&typeof _0x5cebdc[_0xf9df('0x15')]===_0xf9df('0x14');var _0x3bcda5=_0x569bc8[_0xf9df('0x16')];var _0x4f19a9=_0x4cc588?0x0:_0x5cebdc[_0xf9df('0x13')];var _0x482363=_0x4cc588?_0x569bc8[_0xf9df('0x16')]:_0x5cebdc[_0xf9df('0x13')]+_0x5cebdc[_0xf9df('0x15')];var _0x145389;if(_0x482363>=_0x3bcda5){_0x482363=_0x3bcda5;_0x145389=0xc8;}else{_0x145389=0xce;}_0x403601[_0xf9df('0x10')](_0x145389);return _0x403601[_0xf9df('0x17')](_0xf9df('0x18'),_0x4f19a9+'-'+_0x482363+'/'+_0x3bcda5)[_0xf9df('0x12')](_0x569bc8);}return null;};}function saveUpdates(_0x2892e1){return function(_0x27b6ca){if(_0x27b6ca){return _0x27b6ca['update'](_0x2892e1)[_0xf9df('0x19')](function(_0x455de1){return _0x455de1;});}return null;};}function removeEntity(_0x3e2a7c){return function(_0x52133f){if(_0x52133f){return _0x52133f[_0xf9df('0x1a')]()[_0xf9df('0x19')](function(){_0x3e2a7c['status'](0xcc)[_0xf9df('0x11')]();});}};}function handleEntityNotFound(_0x23f1cd){return function(_0x56b311){if(!_0x56b311){_0x23f1cd[_0xf9df('0x1b')](0x194);}return _0x56b311;};}function handleError(_0xa166bb,_0x1d25ac){_0x1d25ac=_0x1d25ac||0x1f4;return function(_0xee2d4e){logger['error'](_0xee2d4e[_0xf9df('0x1c')]);if(_0xee2d4e[_0xf9df('0x1d')]){delete _0xee2d4e[_0xf9df('0x1d')];}_0xa166bb[_0xf9df('0x10')](_0x1d25ac)[_0xf9df('0x1e')](_0xee2d4e);};}exports[_0xf9df('0x1f')]=function(_0x5501f0,_0x408673){var _0x3262c5={};var _0x5cf595=_[_0xf9df('0x20')](db[_0xf9df('0x21')]['rawAttributes'],function(_0x4fe0f1){return{'name':_0x4fe0f1['fieldName'],'type':_0x4fe0f1[_0xf9df('0x22')][_0xf9df('0x23')]};});_0x3262c5=qs['getOptions'](_0x5cf595,_0x5501f0);return interaction[_0xf9df('0x24')](_0xf9df('0x25'),_0x5501f0[_0xf9df('0x26')],_0x5501f0[_0xf9df('0x27')],_0x3262c5,_0x5cf595)[_0xf9df('0x19')](respondWithFilteredResult(_0x408673,_0x3262c5))[_0xf9df('0x28')](handleError(_0x408673,null));};exports[_0xf9df('0x29')]=function(_0x44ea11,_0x491531){var _0x9a0942={'raw':![],'where':{'id':_0x44ea11[_0xf9df('0x2a')]['id']}},_0x149fd9={};_0x149fd9['model']=_[_0xf9df('0x2b')](db[_0xf9df('0x21')][_0xf9df('0x2c')]);_0x149fd9[_0xf9df('0x26')]=_['keys'](_0x44ea11['query']);_0x149fd9['filters']=_[_0xf9df('0x2d')](_0x149fd9[_0xf9df('0x2e')],_0x149fd9[_0xf9df('0x26')]);_0x9a0942[_0xf9df('0x2f')]=_[_0xf9df('0x2d')](_0x149fd9[_0xf9df('0x2e')],qs[_0xf9df('0x30')](_0x44ea11[_0xf9df('0x26')][_0xf9df('0x30')]));_0x9a0942[_0xf9df('0x2f')]=_0x9a0942[_0xf9df('0x2f')][_0xf9df('0x31')]?_0x9a0942[_0xf9df('0x2f')]:_0x149fd9[_0xf9df('0x2e')];if(_0x44ea11[_0xf9df('0x26')][_0xf9df('0x32')]){_0x9a0942['include']=[{'all':!![]}];}_0x9a0942=_[_0xf9df('0x33')]({},_0x9a0942,_0x44ea11[_0xf9df('0x34')]);return db[_0xf9df('0x21')][_0xf9df('0x35')](_0x9a0942)[_0xf9df('0x19')](handleEntityNotFound(_0x491531,null))['then'](respondWithResult(_0x491531,null))[_0xf9df('0x28')](handleError(_0x491531,null));};exports[_0xf9df('0x36')]=function(_0x56234e,_0x4054d7){return db[_0xf9df('0x21')][_0xf9df('0x36')](_0x56234e['body'],{})[_0xf9df('0x19')](respondWithResult(_0x4054d7,0xc9))[_0xf9df('0x28')](handleError(_0x4054d7,null));};exports[_0xf9df('0x37')]=function(_0x450786,_0xc00f3f){if(_0x450786[_0xf9df('0x38')]['id']){delete _0x450786['body']['id'];}return db[_0xf9df('0x21')]['find']({'where':{'id':_0x450786[_0xf9df('0x2a')]['id']}})[_0xf9df('0x19')](handleEntityNotFound(_0xc00f3f,null))[_0xf9df('0x19')](saveUpdates(_0x450786[_0xf9df('0x38')],null))[_0xf9df('0x19')](respondWithResult(_0xc00f3f,null))[_0xf9df('0x28')](handleError(_0xc00f3f,null));};exports[_0xf9df('0x1a')]=function(_0x298cb5,_0x46495a){return db[_0xf9df('0x21')][_0xf9df('0x35')]({'where':{'id':_0x298cb5[_0xf9df('0x2a')]['id']}})[_0xf9df('0x19')](handleEntityNotFound(_0x46495a,null))[_0xf9df('0x19')](removeEntity(_0x46495a,null))['catch'](handleError(_0x46495a,null));};exports[_0xf9df('0x39')]=function(_0x21e378,_0xf6bb60){return db[_0xf9df('0x21')]['describe']()[_0xf9df('0x19')](respondWithResult(_0xf6bb60,null))['catch'](handleError(_0xf6bb60,null));};exports['addMessage']=function(_0x4ddee4,_0x5779a5){return db['MailMessage'][_0xf9df('0x35')]({'where':{'id':_0x4ddee4[_0xf9df('0x2a')]['id']}})[_0xf9df('0x19')](handleEntityNotFound(_0x5779a5,null))[_0xf9df('0x19')](function(_0x300245){if(_0x300245){return _0x300245[_0xf9df('0x3a')](_0x4ddee4[_0xf9df('0x38')][_0xf9df('0x3b')],_[_0xf9df('0x3c')](_0x4ddee4[_0xf9df('0x38')],[_0xf9df('0x3b'),'id'])||{});}})[_0xf9df('0x19')](respondWithResult(_0x5779a5,null))[_0xf9df('0x28')](handleError(_0x5779a5,null));};exports[_0xf9df('0x3d')]=function(_0x2c71a9,_0x5828cd){var _0x5a8e9c={'raw':![],'where':{}};var _0x2fbdae={};var _0x4eaee4={'count':0x0,'rows':[]};return db[_0xf9df('0x21')][_0xf9df('0x3e')]({'where':{'id':_0x2c71a9[_0xf9df('0x2a')]['id']}})[_0xf9df('0x19')](handleEntityNotFound(_0x5828cd,null))[_0xf9df('0x19')](function(_0x32c191){if(_0x32c191){_0x2fbdae[_0xf9df('0x2e')]=_[_0xf9df('0x2b')](db[_0xf9df('0x3f')][_0xf9df('0x2c')]);_0x2fbdae[_0xf9df('0x26')]=_[_0xf9df('0x2b')](_0x2c71a9['query']);_0x2fbdae['filters']=_[_0xf9df('0x2d')](_0x2fbdae[_0xf9df('0x2e')],_0x2fbdae[_0xf9df('0x26')]);_0x5a8e9c['attributes']=_[_0xf9df('0x2d')](_0x2fbdae['model'],qs[_0xf9df('0x30')](_0x2c71a9[_0xf9df('0x26')][_0xf9df('0x30')]));_0x5a8e9c[_0xf9df('0x2f')]=_0x5a8e9c[_0xf9df('0x2f')][_0xf9df('0x31')]?_0x5a8e9c[_0xf9df('0x2f')]:_0x2fbdae[_0xf9df('0x2e')];if(!_0x2c71a9[_0xf9df('0x26')][_0xf9df('0x40')](_0xf9df('0x41'))){_0x5a8e9c[_0xf9df('0x15')]=qs[_0xf9df('0x15')](_0x2c71a9[_0xf9df('0x26')][_0xf9df('0x15')]);_0x5a8e9c[_0xf9df('0x13')]=qs[_0xf9df('0x13')](_0x2c71a9[_0xf9df('0x26')][_0xf9df('0x13')]);}_0x5a8e9c[_0xf9df('0x42')]=qs['sort'](_0x2c71a9[_0xf9df('0x26')][_0xf9df('0x43')]);_0x5a8e9c['where']=qs[_0xf9df('0x44')](_[_0xf9df('0x45')](_0x2c71a9[_0xf9df('0x26')],_0x2fbdae[_0xf9df('0x44')]));_0x5a8e9c[_0xf9df('0x46')][_0xf9df('0x47')]=_0x32c191['id'];if(_0x2c71a9[_0xf9df('0x26')][_0xf9df('0x48')]){_0x5a8e9c[_0xf9df('0x46')]=_[_0xf9df('0x33')](_0x5a8e9c[_0xf9df('0x46')],{'$or':_[_0xf9df('0x20')](_0x5a8e9c[_0xf9df('0x2f')],function(_0x22880c){var _0x5ee907={};_0x5ee907[_0x22880c]={'$like':'%'+_0x2c71a9[_0xf9df('0x26')][_0xf9df('0x48')]+'%'};return _0x5ee907;})});}if(_0x2c71a9[_0xf9df('0x26')][_0xf9df('0x49')]){var _0x35eae6=_0x2c71a9[_0xf9df('0x26')]['$gte']['split'](',');var _0x48d761={};_0x48d761[_0x35eae6[0x0]]={'$gte':moment(_0x35eae6[0x1])[_0xf9df('0x4a')]('YYYY-MM-DD\x20HH:mm:ss')};_0x5a8e9c[_0xf9df('0x46')]=_['merge'](_0x5a8e9c['where'],_0x48d761);}_0x5a8e9c=_[_0xf9df('0x33')]({},_0x5a8e9c,_0x2c71a9[_0xf9df('0x34')]);return db[_0xf9df('0x3f')][_0xf9df('0x16')]({'where':_0x5a8e9c[_0xf9df('0x46')]})[_0xf9df('0x19')](function(_0x682dd5){_0x4eaee4[_0xf9df('0x16')]=_0x682dd5;if(_0x2c71a9['query'][_0xf9df('0x32')]){_0x5a8e9c['include']=[{'all':!![]}];}return db['MailMessage'][_0xf9df('0x24')](_0x5a8e9c);})[_0xf9df('0x19')](function(_0x312e14){if(_0x2c71a9[_0xf9df('0x26')][_0xf9df('0x4b')]===_0xf9df('0x4c')){for(var _0x29170b=0x0;_0x29170b<_0x312e14[_0xf9df('0x31')];_0x29170b++){_0x312e14[_0x29170b][_0xf9df('0x38')]=juice(_0x312e14[_0x29170b][_0xf9df('0x38')]);}}_0x4eaee4[_0xf9df('0x4d')]=_0x312e14;return _0x4eaee4;});}})[_0xf9df('0x19')](respondWithFilteredResult(_0x5828cd,_0x5a8e9c))[_0xf9df('0x28')](handleError(_0x5828cd,null));};exports[_0xf9df('0x4e')]=function(_0x301df0,_0x2c7379){return db[_0xf9df('0x21')][_0xf9df('0x35')]({'where':{'id':_0x301df0[_0xf9df('0x2a')]['id']}})['then'](handleEntityNotFound(_0x2c7379,null))[_0xf9df('0x19')](function(_0x186eba){if(_0x186eba){return _0x186eba[_0xf9df('0x4f')](_0x301df0['body']['ids'],_['omit'](_0x301df0[_0xf9df('0x38')],['ids','id'])||{})[_0xf9df('0x50')](function(){return db[_0xf9df('0x51')]['findAll']({'attributes':['id',_0xf9df('0x1d'),_0xf9df('0x52')],'where':{'id':_0x301df0[_0xf9df('0x38')]['ids']}});})['then'](function(_0x430ae1){socket[_0xf9df('0x53')](_0xf9df('0x54'),{'id':Number(_0x301df0[_0xf9df('0x2a')]['id']),'tags':_0x430ae1||[]});return{'id':Number(_0x301df0[_0xf9df('0x2a')]['id']),'tags':_0x430ae1||[]};});}})[_0xf9df('0x19')](respondWithResult(_0x2c7379,null))['catch'](handleError(_0x2c7379,null));};exports[_0xf9df('0x55')]=function(_0x1f37c9,_0x298257){return db[_0xf9df('0x21')]['find']({'where':{'id':_0x1f37c9['params']['id']}})[_0xf9df('0x19')](handleEntityNotFound(_0x298257,null))['then'](function(_0x3b9d36){if(_0x3b9d36){return _0x3b9d36[_0xf9df('0x55')](_0x1f37c9[_0xf9df('0x26')][_0xf9df('0x3b')]);}})[_0xf9df('0x19')](respondWithStatusCode(_0x298257,null))[_0xf9df('0x28')](handleError(_0x298257,null));};exports['download']=function(_0x294cab,_0x5d3943){var _0x20cb22=moment()[_0xf9df('0x56')]()[_0xf9df('0x57')]();var _0x3d9aa0=path[_0xf9df('0x58')](config[_0xf9df('0x59')],'server',_0xf9df('0x5a'),_0xf9df('0x5b'));var _0x2dac98=path[_0xf9df('0x58')](config[_0xf9df('0x59')],_0xf9df('0x5c'),_0xf9df('0x5a'),'attachments');var _0x1945ad=path[_0xf9df('0x58')](_0x3d9aa0,_0x20cb22);var _0x45ab69=util[_0xf9df('0x4a')](_0xf9df('0x5d'),_0x294cab[_0xf9df('0x2a')]['id'],_0x20cb22);var _0x36e08b=path['join'](_0x3d9aa0,_0x45ab69);var _0x19df28=[];if(_0x294cab[_0xf9df('0x26')][_0xf9df('0x5e')]){_0x19df28['push']({'model':db[_0xf9df('0x5f')],'as':_0xf9df('0x60'),'raw':!![]});}var _0xabe3b2=[{'model':db[_0xf9df('0x3f')],'as':_0xf9df('0x61'),'attributes':['id',_0xf9df('0x38'),_0xf9df('0x62'),'to','cc',_0xf9df('0x63'),_0xf9df('0x64'),'createdAt'],'where':{'secret':![]},'order':qs['sort']('id'),'include':_0x19df28}];return db[_0xf9df('0x21')]['find']({'where':{'id':_0x294cab[_0xf9df('0x2a')]['id']},'include':_0xabe3b2})['then'](handleEntityNotFound(_0x5d3943,null))[_0xf9df('0x19')](function(_0x4e5717){if(_0x4e5717&&_0x4e5717[_0xf9df('0x61')]){var _0x28c977=_0x4e5717[_0xf9df('0x65')]({'plain':!![]});fs[_0xf9df('0x66')](_0x1945ad);return BPromise[_0xf9df('0x67')](_0x28c977['Messages'],function(_0x318e24,_0x2c593d){var _0x203e8f={'from':_0x318e24[_0xf9df('0x62')],'to':_0x318e24['to']||'missing.recipient@your.company.com','subject':_0x318e24[_0xf9df('0x64')],'html':htmlEntities['decode'](_0x318e24[_0xf9df('0x38')]),'headers':{'Date':moment(_0x318e24[_0xf9df('0x68')])['format'](_0xf9df('0x69'))},'attachments':[]};if(_0x318e24['cc']){_0x203e8f[_0xf9df('0x6a')]['Cc']=_0x318e24['cc'];}if(_0x318e24[_0xf9df('0x63')]){_0x203e8f[_0xf9df('0x6a')][_0xf9df('0x6b')]=_0x318e24[_0xf9df('0x63')];}return new BPromise(function(_0x76e3ab,_0x1be857){if(_0x318e24[_0xf9df('0x60')]){for(var _0x2e7e58=0x0;_0x2e7e58<_0x318e24['Attachments'][_0xf9df('0x31')];_0x2e7e58++){var _0x483e3f=_0x318e24[_0xf9df('0x60')][_0x2e7e58];var _0x411265=path[_0xf9df('0x58')](_0x2dac98,_0x483e3f[_0xf9df('0x6c')]);if(fs['existsSync'](_0x411265)){_0x203e8f[_0xf9df('0x5e')]['push']({'name':_0x483e3f['name'],'contentType':_0x483e3f[_0xf9df('0x22')],'data':fs['readFileSync'](_0x411265)});}}}emlformat['build'](_0x203e8f,function(_0x4dd673,_0x52c80d){if(_0x4dd673)return _0x1be857(_0x4dd673);fs[_0xf9df('0x6d')](path[_0xf9df('0x58')](_0x1945ad,util['format']('message%d.eml',_0x2c593d)),_0x52c80d);return _0x76e3ab(_0x52c80d);});});})[_0xf9df('0x19')](function(){return new BPromise(function(_0x43de6f,_0x318901){zipdir(_0x1945ad,{'saveTo':_0x36e08b},function(_0x11b5d1,_0x3b9093){if(_0x11b5d1)return _0x318901(_0x11b5d1);return _0x43de6f(_0x3b9093);});})[_0xf9df('0x19')](function(){return new BPromise(function(_0x252172,_0x5d0bb3){rimraf(_0x1945ad,function(_0x12efe4){if(_0x12efe4)_0x5d0bb3(_0x12efe4);return _0x252172();});});})['then'](function(){return _0x5d3943['download'](_0x36e08b,_0x45ab69,function(_0x586b73){if(!_0x586b73)fs[_0xf9df('0x6e')](_0x36e08b);});});});}else{return _0x5d3943['sendStatus'](0xc8);}})[_0xf9df('0x28')](handleError(_0x5d3943,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 50e0922..e7b96c7 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 _0xdae0=['catch','hasOwnProperty','hook','exports','events','../../mysqldb','MailInteraction','MailMessage','setMaxListeners','save','update','remove','setDataValue','map','then','unreadMessages','length','emit'];(function(_0x3cb09b,_0x31c2a5){var _0x242048=function(_0x464aba){while(--_0x464aba){_0x3cb09b['push'](_0x3cb09b['shift']());}};_0x242048(++_0x31c2a5);}(_0xdae0,0x15a));var _0x0dae=function(_0xfaa85b,_0x3427b3){_0xfaa85b=_0xfaa85b-0x0;var _0x55e01e=_0xdae0[_0xfaa85b];return _0x55e01e;};'use strict';var EventEmitter=require(_0x0dae('0x0'));var MailInteraction=require(_0x0dae('0x1'))['db'][_0x0dae('0x2')];var MailMessage=require('../../mysqldb')['db'][_0x0dae('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x0dae('0x4')](0x0);var events={'afterCreate':_0x0dae('0x5'),'afterUpdate':_0x0dae('0x6'),'afterDestroy':_0x0dae('0x7')};function emitEvent(_0x2b6fc1){return function(_0xc1706c,_0x2e793d,_0x4f95bb){_0xc1706c['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x530f72){_0xc1706c[_0x0dae('0x8')]('Users',_0x530f72[_0x0dae('0x9')](function(_0x5becdc){return{'id':_0x5becdc['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0xc1706c['id'],'direction':'in','read':![]},'raw':!![]});})[_0x0dae('0xa')](function(_0xed749e){_0xc1706c[_0x0dae('0x8')](_0x0dae('0xb'),_0xed749e[_0x0dae('0xc')]);MailInteractionEvents[_0x0dae('0xd')](_0x2b6fc1+':'+_0xc1706c['id'],_0xc1706c);MailInteractionEvents[_0x0dae('0xd')](_0x2b6fc1,_0xc1706c);_0x4f95bb(null);})[_0x0dae('0xe')](_0x4f95bb(null));};}for(var e in events){if(events[_0x0dae('0xf')](e)){var event=events[e];MailInteraction[_0x0dae('0x10')](e,emitEvent(event));}}module[_0x0dae('0x11')]=MailInteractionEvents; \ No newline at end of file +var _0x3a75=['MailMessage','setMaxListeners','save','update','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x5d74a3,_0x13fcbc){var _0xc7c572=function(_0x52232f){while(--_0x52232f){_0x5d74a3['push'](_0x5d74a3['shift']());}};_0xc7c572(++_0x13fcbc);}(_0x3a75,0x1b3));var _0x53a7=function(_0x565813,_0x2378b0){_0x565813=_0x565813-0x0;var _0x31d9ca=_0x3a75[_0x565813];return _0x31d9ca;};'use strict';var EventEmitter=require(_0x53a7('0x0'));var MailInteraction=require(_0x53a7('0x1'))['db']['MailInteraction'];var MailMessage=require('../../mysqldb')['db'][_0x53a7('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x53a7('0x3')](0x0);var events={'afterCreate':_0x53a7('0x4'),'afterUpdate':_0x53a7('0x5'),'afterDestroy':'remove'};function emitEvent(_0xcd6d2e){return function(_0x6a060d,_0x5824c3,_0x50ecd8){_0x6a060d[_0x53a7('0x6')]({'attributes':['id'],'raw':!![]})[_0x53a7('0x7')](function(_0xe18408){_0x6a060d[_0x53a7('0x8')](_0x53a7('0x9'),_0xe18408[_0x53a7('0xa')](function(_0x17c138){return{'id':_0x17c138['id']};}));return MailMessage[_0x53a7('0xb')]({'where':{'MailInteractionId':_0x6a060d['id'],'direction':'in','read':![]},'raw':!![]});})[_0x53a7('0x7')](function(_0x2a70d3){_0x6a060d['setDataValue'](_0x53a7('0xc'),_0x2a70d3[_0x53a7('0xd')]);MailInteractionEvents[_0x53a7('0xe')](_0xcd6d2e+':'+_0x6a060d['id'],_0x6a060d);MailInteractionEvents['emit'](_0xcd6d2e,_0x6a060d);_0x50ecd8(null);})[_0x53a7('0xf')](_0x50ecd8(null));};}for(var e in events){if(events[_0x53a7('0x10')](e)){var event=events[e];MailInteraction[_0x53a7('0x11')](e,emitEvent(event));}}module[_0x53a7('0x12')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 6766c18..a0eabbd 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 _0xb7c8=['request-promise','../../config/environment','MailInteraction','subject','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','changed','closedAt','models','update','then','catch','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xb7c8,0xd7));var _0x8b7c=function(_0x5576e1,_0x4b47cd){_0x5576e1=_0x5576e1-0x0;var _0x2c2426=_0xb7c8[_0x5576e1];return _0x2c2426;};'use strict';var _=require('lodash');var util=require(_0x8b7c('0x0'));var logger=require(_0x8b7c('0x1'))(_0x8b7c('0x2'));var moment=require(_0x8b7c('0x3'));var BPromise=require(_0x8b7c('0x4'));var rp=require(_0x8b7c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8b7c('0x6'));var attributes=require('./mailInteraction.attributes');module['exports']=function(_0xef31e2,_0x2a3f6c){return _0xef31e2['define'](_0x8b7c('0x7'),attributes,{'tableName':'mail_interactions','paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':[_0x8b7c('0x8'),'to'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x5592bc,_0x47fb0b,_0x1f3f5a){if(_0x5592bc[_0x8b7c('0x9')]){_0x5592bc[_0x8b7c('0xa')]=moment()[_0x8b7c('0xb')](_0x8b7c('0xc'));}if(_0x5592bc[_0x8b7c('0xd')]){_0x5592bc['closedAt']=moment()['format'](_0x8b7c('0xc'));}_0x1f3f5a(null,_0x47fb0b);},'beforeUpdate':function(_0x7a574d,_0x433354,_0xf89ae8){if(_0x7a574d[_0x8b7c('0xe')](_0x8b7c('0x9'))){_0x7a574d[_0x8b7c('0xa')]=_0x7a574d['substatus']?moment()[_0x8b7c('0xb')](_0x8b7c('0xc')):null;}if(_0x7a574d[_0x8b7c('0xe')]('closed')){_0x7a574d[_0x8b7c('0xf')]=moment()['format'](_0x8b7c('0xc'));_0x7a574d['substatus']=null;_0x7a574d[_0x8b7c('0xa')]=null;}_0xf89ae8(null,_0x7a574d);},'afterUpdate':function(_0x40e0d0,_0x216f5a,_0x267046){var _0x208303=_0xef31e2[_0x8b7c('0x10')];var _0x4d6c35=_0x40e0d0['get']({'plain':!![]});if(_0x4d6c35[_0x8b7c('0xd')]){return _0x208303['MailMessage'][_0x8b7c('0x11')]({'read':!![]},{'where':{'MailInteractionId':_0x4d6c35['id']}})[_0x8b7c('0x12')](function(){_0x267046();})[_0x8b7c('0x13')](function(_0x1405a3){_0x267046(_0x1405a3);});}else{_0x267046();}}},'charset':_0x8b7c('0x14'),'collate':_0x8b7c('0x15')});}; \ No newline at end of file +var _0x8efd=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailInteraction.attributes','define','MailInteraction','mail_interactions','fti_mail_interactions','FULLTEXT','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','format','changed','substatus','substatusAt','models','get','MailMessage','then','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x5de818,_0x7c4485){var _0x345670=function(_0x5e268d){while(--_0x5e268d){_0x5de818['push'](_0x5de818['shift']());}};_0x345670(++_0x7c4485);}(_0x8efd,0x1cf));var _0xd8ef=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x8efd[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0xd8ef('0x0'));var util=require(_0xd8ef('0x1'));var logger=require(_0xd8ef('0x2'))(_0xd8ef('0x3'));var moment=require(_0xd8ef('0x4'));var BPromise=require(_0xd8ef('0x5'));var rp=require(_0xd8ef('0x6'));var fs=require('fs');var path=require(_0xd8ef('0x7'));var rimraf=require(_0xd8ef('0x8'));var config=require(_0xd8ef('0x9'));var attributes=require(_0xd8ef('0xa'));module['exports']=function(_0x11d5a1,_0x218fd4){return _0x11d5a1[_0xd8ef('0xb')](_0xd8ef('0xc'),attributes,{'tableName':_0xd8ef('0xd'),'paranoid':![],'indexes':[{'name':_0xd8ef('0xe'),'fields':['subject','to'],'type':_0xd8ef('0xf')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x50244d,_0x20f756,_0x52dfa3){if(_0x50244d['substatus']){_0x50244d['substatusAt']=moment()['format'](_0xd8ef('0x10'));}if(_0x50244d[_0xd8ef('0x11')]){_0x50244d[_0xd8ef('0x12')]=moment()[_0xd8ef('0x13')](_0xd8ef('0x10'));}_0x52dfa3(null,_0x20f756);},'beforeUpdate':function(_0x26cc9f,_0x4e8ec6,_0x1276a9){if(_0x26cc9f[_0xd8ef('0x14')](_0xd8ef('0x15'))){_0x26cc9f[_0xd8ef('0x16')]=_0x26cc9f[_0xd8ef('0x15')]?moment()[_0xd8ef('0x13')](_0xd8ef('0x10')):null;}if(_0x26cc9f[_0xd8ef('0x14')](_0xd8ef('0x11'))){_0x26cc9f['closedAt']=moment()[_0xd8ef('0x13')]('YYYY-MM-DD\x20HH:mm:ss');_0x26cc9f[_0xd8ef('0x15')]=null;_0x26cc9f['substatusAt']=null;}_0x1276a9(null,_0x26cc9f);},'afterUpdate':function(_0x34217d,_0x2e573c,_0x3d10bc){var _0xd1d20b=_0x11d5a1[_0xd8ef('0x17')];var _0x9cb2f9=_0x34217d[_0xd8ef('0x18')]({'plain':!![]});if(_0x9cb2f9[_0xd8ef('0x11')]){return _0xd1d20b[_0xd8ef('0x19')]['update']({'read':!![]},{'where':{'MailInteractionId':_0x9cb2f9['id']}})[_0xd8ef('0x1a')](function(){_0x3d10bc();})['catch'](function(_0x2460f7){_0x3d10bc(_0x2460f7);});}else{_0x3d10bc();}}},'charset':_0xd8ef('0x1b'),'collate':_0xd8ef('0x1c')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index cb4a6b7..84cf7b4 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 _0xa84f=['localhost','socket.io-emitter','register','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','MailInteraction','body','options','raw','where','attributes','limit','then','UpdateMailInteraction','find','omit','spread','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults'];(function(_0x58ee19,_0xdf0765){var _0x49af25=function(_0x109b5e){while(--_0x109b5e){_0x58ee19['push'](_0x58ee19['shift']());}};_0x49af25(++_0xdf0765);}(_0xa84f,0x1dd));var _0xfa84=function(_0x582d0b,_0x28f609){_0x582d0b=_0x582d0b-0x0;var _0x2e93e1=_0xa84f[_0x582d0b];return _0x2e93e1;};'use strict';var _=require(_0xfa84('0x0'));var util=require(_0xfa84('0x1'));var moment=require(_0xfa84('0x2'));var BPromise=require(_0xfa84('0x3'));var rs=require(_0xfa84('0x4'));var fs=require('fs');var Redis=require(_0xfa84('0x5'));var db=require(_0xfa84('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xfa84('0x7'))(_0xfa84('0x8'));var config=require(_0xfa84('0x9'));var jayson=require(_0xfa84('0xa'));var client=jayson[_0xfa84('0xb')][_0xfa84('0xc')]({'port':0x232a});config[_0xfa84('0xd')]=_[_0xfa84('0xe')](config[_0xfa84('0xd')],{'host':_0xfa84('0xf'),'port':0x18eb});var socket=require(_0xfa84('0x10'))(new Redis(config[_0xfa84('0xd')]));require('./mailInteraction.socket')[_0xfa84('0x11')](socket);function respondWithRpcPromise(_0x156a4c,_0x504c54,_0x3f0153){return new BPromise(function(_0x1fe5f2,_0x47534d){return client['request'](_0x156a4c,_0x3f0153)['then'](function(_0x19c769){logger[_0xfa84('0x12')](_0xfa84('0x13'),_0x504c54,_0xfa84('0x14'));logger[_0xfa84('0x15')](_0xfa84('0x16'),_0x504c54,_0xfa84('0x14'),JSON[_0xfa84('0x17')](_0x19c769));if(_0x19c769[_0xfa84('0x18')]){if(_0x19c769[_0xfa84('0x18')][_0xfa84('0x19')]===0x1f4){logger[_0xfa84('0x18')](_0xfa84('0x13'),_0x504c54,_0x19c769[_0xfa84('0x18')][_0xfa84('0x1a')]);return _0x47534d(_0x19c769['error'][_0xfa84('0x1a')]);}logger['error'](_0xfa84('0x13'),_0x504c54,_0x19c769[_0xfa84('0x18')][_0xfa84('0x1a')]);return _0x1fe5f2(_0x19c769[_0xfa84('0x18')][_0xfa84('0x1a')]);}else{logger[_0xfa84('0x12')](_0xfa84('0x13'),_0x504c54,_0xfa84('0x14'));_0x1fe5f2(_0x19c769[_0xfa84('0x1b')][_0xfa84('0x1a')]);}})[_0xfa84('0x1c')](function(_0x135d39){logger[_0xfa84('0x18')](_0xfa84('0x13'),_0x504c54,_0x135d39);_0x47534d(_0x135d39);});});}exports['UpdateMailInteraction']=function(_0x3f34f1){var _0x40e6e8=this;return new Promise(function(_0x3151ad,_0x2113d0){return db[_0xfa84('0x1d')]['update'](_0x3f34f1[_0xfa84('0x1e')],{'raw':_0x3f34f1[_0xfa84('0x1f')]?_0x3f34f1[_0xfa84('0x1f')][_0xfa84('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f34f1[_0xfa84('0x1f')]?_0x3f34f1[_0xfa84('0x1f')][_0xfa84('0x21')]||null:null,'attributes':_0x3f34f1[_0xfa84('0x1f')]?_0x3f34f1[_0xfa84('0x1f')][_0xfa84('0x22')]||null:null,'limit':_0x3f34f1[_0xfa84('0x1f')]?_0x3f34f1[_0xfa84('0x1f')][_0xfa84('0x23')]||null:null})[_0xfa84('0x24')](function(_0x11a9da){logger['info']('UpdateMailInteraction',_0x3f34f1);logger[_0xfa84('0x15')]('UpdateMailInteraction',_0x3f34f1,JSON[_0xfa84('0x17')](_0x11a9da));_0x3151ad(_0x11a9da);})['catch'](function(_0x35a146){logger[_0xfa84('0x18')](_0xfa84('0x25'),_0x35a146[_0xfa84('0x1a')],_0x3f34f1);_0x2113d0(_0x40e6e8['error'](0x1f4,_0x35a146['message']));});});};exports['AddTagsToMailInteraction']=function(_0x20dbb2){return new Promise(function(_0x2b124a,_0xc9af8a){return db[_0xfa84('0x1d')][_0xfa84('0x26')]({'where':_0x20dbb2[_0xfa84('0x1f')]?_0x20dbb2[_0xfa84('0x1f')][_0xfa84('0x21')]||null:null})[_0xfa84('0x24')](function(_0x4ef64d){if(_0x4ef64d){return _0x4ef64d['addTags'](_0x20dbb2['body']['ids'],_[_0xfa84('0x27')](_0x20dbb2[_0xfa84('0x1e')],['ids','id'])||{});}})[_0xfa84('0x28')](function(_0x255c98){logger[_0xfa84('0x12')]('AddTags',_0x20dbb2);logger[_0xfa84('0x15')]('AddTags',_0x20dbb2,JSON[_0xfa84('0x17')](_0x255c98));_0x2b124a(_0x255c98);})[_0xfa84('0x1c')](function(_0x3fe04e){logger[_0xfa84('0x18')]('AddTags',_0x3fe04e['message'],_0x20dbb2);_0xc9af8a(_this['error'](0x1f4,_0x3fe04e[_0xfa84('0x1a')]));});});}; \ No newline at end of file +var _0x2b67=['http','redis','defaults','socket.io-emitter','./mailInteraction.socket','register','request','then','info','debug','MailInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','MailInteraction,\x20%s,\x20%s','message','result','catch','MailInteraction','body','options','where','attributes','limit','UpdateMailInteraction','AddTagsToMailInteraction','ids','omit','AddTags','lodash','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x179f5b,_0x56fee9){var _0x34a4ed=function(_0x1a3e44){while(--_0x1a3e44){_0x179f5b['push'](_0x179f5b['shift']());}};_0x34a4ed(++_0x56fee9);}(_0x2b67,0x67));var _0x72b6=function(_0x20e458,_0x265875){_0x20e458=_0x20e458-0x0;var _0x5c4296=_0x2b67[_0x20e458];return _0x5c4296;};'use strict';var _=require(_0x72b6('0x0'));var util=require('util');var moment=require(_0x72b6('0x1'));var BPromise=require(_0x72b6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x72b6('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x72b6('0x4'))(_0x72b6('0x5'));var config=require(_0x72b6('0x6'));var jayson=require(_0x72b6('0x7'));var client=jayson['client'][_0x72b6('0x8')]({'port':0x232a});config[_0x72b6('0x9')]=_[_0x72b6('0xa')](config[_0x72b6('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x72b6('0xb'))(new Redis(config[_0x72b6('0x9')]));require(_0x72b6('0xc'))[_0x72b6('0xd')](socket);function respondWithRpcPromise(_0x319c13,_0x392a3a,_0x5a5253){return new BPromise(function(_0x1a7a0f,_0x5e8376){return client[_0x72b6('0xe')](_0x319c13,_0x5a5253)[_0x72b6('0xf')](function(_0x6774f2){logger[_0x72b6('0x10')]('MailInteraction,\x20%s,\x20%s',_0x392a3a,'request\x20sent');logger[_0x72b6('0x11')](_0x72b6('0x12'),_0x392a3a,_0x72b6('0x13'),JSON[_0x72b6('0x14')](_0x6774f2));if(_0x6774f2[_0x72b6('0x15')]){if(_0x6774f2[_0x72b6('0x15')]['code']===0x1f4){logger[_0x72b6('0x15')](_0x72b6('0x16'),_0x392a3a,_0x6774f2[_0x72b6('0x15')][_0x72b6('0x17')]);return _0x5e8376(_0x6774f2[_0x72b6('0x15')]['message']);}logger[_0x72b6('0x15')](_0x72b6('0x16'),_0x392a3a,_0x6774f2[_0x72b6('0x15')]['message']);return _0x1a7a0f(_0x6774f2[_0x72b6('0x15')][_0x72b6('0x17')]);}else{logger[_0x72b6('0x10')](_0x72b6('0x16'),_0x392a3a,_0x72b6('0x13'));_0x1a7a0f(_0x6774f2[_0x72b6('0x18')][_0x72b6('0x17')]);}})[_0x72b6('0x19')](function(_0x152966){logger['error'](_0x72b6('0x16'),_0x392a3a,_0x152966);_0x5e8376(_0x152966);});});}exports['UpdateMailInteraction']=function(_0x141fe2){var _0x3c8d3e=this;return new Promise(function(_0x1735cd,_0x55367f){return db[_0x72b6('0x1a')]['update'](_0x141fe2[_0x72b6('0x1b')],{'raw':_0x141fe2[_0x72b6('0x1c')]?_0x141fe2[_0x72b6('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x141fe2[_0x72b6('0x1c')]?_0x141fe2[_0x72b6('0x1c')][_0x72b6('0x1d')]||null:null,'attributes':_0x141fe2['options']?_0x141fe2['options'][_0x72b6('0x1e')]||null:null,'limit':_0x141fe2['options']?_0x141fe2[_0x72b6('0x1c')][_0x72b6('0x1f')]||null:null})[_0x72b6('0xf')](function(_0x44ee5b){logger['info'](_0x72b6('0x20'),_0x141fe2);logger[_0x72b6('0x11')]('UpdateMailInteraction',_0x141fe2,JSON[_0x72b6('0x14')](_0x44ee5b));_0x1735cd(_0x44ee5b);})[_0x72b6('0x19')](function(_0x590a97){logger['error']('UpdateMailInteraction',_0x590a97[_0x72b6('0x17')],_0x141fe2);_0x55367f(_0x3c8d3e['error'](0x1f4,_0x590a97[_0x72b6('0x17')]));});});};exports[_0x72b6('0x21')]=function(_0x58afe5){return new Promise(function(_0x22a3d3,_0x5a8cc4){return db[_0x72b6('0x1a')]['find']({'where':_0x58afe5[_0x72b6('0x1c')]?_0x58afe5['options']['where']||null:null})[_0x72b6('0xf')](function(_0x452ba9){if(_0x452ba9){return _0x452ba9['addTags'](_0x58afe5['body'][_0x72b6('0x22')],_[_0x72b6('0x23')](_0x58afe5[_0x72b6('0x1b')],[_0x72b6('0x22'),'id'])||{});}})['spread'](function(_0x7a0d5){logger[_0x72b6('0x10')](_0x72b6('0x24'),_0x58afe5);logger[_0x72b6('0x11')]('AddTags',_0x58afe5,JSON[_0x72b6('0x14')](_0x7a0d5));_0x22a3d3(_0x7a0d5);})[_0x72b6('0x19')](function(_0x57af31){logger[_0x72b6('0x15')]('AddTags',_0x57af31[_0x72b6('0x17')],_0x58afe5);_0x5a8cc4(_this[_0x72b6('0x15')](0x1f4,_0x57af31[_0x72b6('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 038204b..63ec87e 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 _0x98ce=['remove','register','length','mailInteraction:','./mailInteraction.events'];(function(_0x2f767c,_0x37588e){var _0x1101b1=function(_0x2ebb18){while(--_0x2ebb18){_0x2f767c['push'](_0x2f767c['shift']());}};_0x1101b1(++_0x37588e);}(_0x98ce,0x1ee));var _0xe98c=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x98ce[_0x3ab51d];return _0x29a04e;};'use strict';var MailInteractionEvents=require(_0xe98c('0x0'));var events=['save',_0xe98c('0x1'),'update'];function createListener(_0x3f40eb,_0x30ae88){return function(_0xc5969b){_0x30ae88['emit'](_0x3f40eb,_0xc5969b);};}function removeListener(_0x1d56d4,_0xc2dc19){return function(){MailInteractionEvents['removeListener'](_0x1d56d4,_0xc2dc19);};}exports[_0xe98c('0x2')]=function(_0xed6a8){for(var _0x2e483b=0x0,_0x1984e5=events[_0xe98c('0x3')];_0x2e483b<_0x1984e5;_0x2e483b++){var _0x4fce3e=events[_0x2e483b];var _0x8945b8=createListener(_0xe98c('0x4')+_0x4fce3e,_0xed6a8);MailInteractionEvents['on'](_0x4fce3e,_0x8945b8);}}; \ No newline at end of file +var _0xa305=['./mailInteraction.events','save','remove','update','emit','removeListener'];(function(_0x30994d,_0x2cc269){var _0x4554df=function(_0x125125){while(--_0x125125){_0x30994d['push'](_0x30994d['shift']());}};_0x4554df(++_0x2cc269);}(_0xa305,0xc0));var _0x5a30=function(_0x1bc111,_0x366640){_0x1bc111=_0x1bc111-0x0;var _0x10b114=_0xa305[_0x1bc111];return _0x10b114;};'use strict';var MailInteractionEvents=require(_0x5a30('0x0'));var events=[_0x5a30('0x1'),_0x5a30('0x2'),_0x5a30('0x3')];function createListener(_0x51bf57,_0x2b729e){return function(_0x2523c1){_0x2b729e[_0x5a30('0x4')](_0x51bf57,_0x2523c1);};}function removeListener(_0x1e0d3d,_0x3508eb){return function(){MailInteractionEvents[_0x5a30('0x5')](_0x1e0d3d,_0x3508eb);};}exports['register']=function(_0x590790){for(var _0x4d3862=0x0,_0x3d9407=events['length'];_0x4d3862<_0x3d9407;_0x4d3862++){var _0x21da17=events[_0x4d3862];var _0x13bfcb=createListener('mailInteraction:'+_0x21da17,_0x590790);MailInteractionEvents['on'](_0x21da17,_0x13bfcb);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index df54b94..6724d68 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 _0xf46a=['delete','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','index','/describe','describe','download','tracked','mail','create','/:id','update','/:id/accept','accept','put','/:id/reject','reject'];(function(_0x37dbe8,_0x10e968){var _0x2416b6=function(_0xd39957){while(--_0xd39957){_0x37dbe8['push'](_0x37dbe8['shift']());}};_0x2416b6(++_0x10e968);}(_0xf46a,0xa4));var _0xaf46=function(_0x420dca,_0xaea2ab){_0x420dca=_0x420dca-0x0;var _0x372515=_0xf46a[_0x420dca];return _0x372515;};'use strict';var multer=require(_0xaf46('0x0'));var util=require('util');var path=require(_0xaf46('0x1'));var timeout=require(_0xaf46('0x2'));var express=require('express');var router=express[_0xaf46('0x3')]();var fs_extra=require(_0xaf46('0x4'));var auth=require(_0xaf46('0x5'));var interaction=require(_0xaf46('0x6'));var config=require(_0xaf46('0x7'));var controller=require(_0xaf46('0x8'));router[_0xaf46('0x9')]('/',auth[_0xaf46('0xa')](),controller[_0xaf46('0xb')]);router[_0xaf46('0x9')](_0xaf46('0xc'),auth[_0xaf46('0xa')](),controller[_0xaf46('0xd')]);router[_0xaf46('0x9')]('/:id',auth[_0xaf46('0xa')](),controller['show']);router['get']('/:id/download',auth[_0xaf46('0xa')](),controller[_0xaf46('0xe')]);router['post']('/',auth[_0xaf46('0xa')](),interaction[_0xaf46('0xf')](_0xaf46('0x10'),'mailmessage:create'),controller[_0xaf46('0x11')]);router['put'](_0xaf46('0x12'),auth['isAuthenticated'](),controller[_0xaf46('0x13')]);router['put'](_0xaf46('0x14'),auth[_0xaf46('0xa')](),controller[_0xaf46('0x15')]);router[_0xaf46('0x16')](_0xaf46('0x17'),auth[_0xaf46('0xa')](),controller[_0xaf46('0x18')]);router[_0xaf46('0x19')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xaf46('0x1a')]=router; \ No newline at end of file +var _0xa9d0=['connect-timeout','express','Router','fs-extra','./mailMessage.controller','get','isAuthenticated','index','/describe','/:id','show','download','post','mail','mailmessage:create','create','put','update','/:id/reject','reject','delete','destroy','exports','multer','util','path'];(function(_0x3fba9f,_0x3b7b9b){var _0x192cf1=function(_0x557290){while(--_0x557290){_0x3fba9f['push'](_0x3fba9f['shift']());}};_0x192cf1(++_0x3b7b9b);}(_0xa9d0,0x1eb));var _0x0a9d=function(_0x426c9f,_0x45931b){_0x426c9f=_0x426c9f-0x0;var _0x387490=_0xa9d0[_0x426c9f];return _0x387490;};'use strict';var multer=require(_0x0a9d('0x0'));var util=require(_0x0a9d('0x1'));var path=require(_0x0a9d('0x2'));var timeout=require(_0x0a9d('0x3'));var express=require(_0x0a9d('0x4'));var router=express[_0x0a9d('0x5')]();var fs_extra=require(_0x0a9d('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x0a9d('0x7'));router[_0x0a9d('0x8')]('/',auth[_0x0a9d('0x9')](),controller[_0x0a9d('0xa')]);router[_0x0a9d('0x8')](_0x0a9d('0xb'),auth[_0x0a9d('0x9')](),controller['describe']);router[_0x0a9d('0x8')](_0x0a9d('0xc'),auth['isAuthenticated'](),controller[_0x0a9d('0xd')]);router[_0x0a9d('0x8')]('/:id/download',auth['isAuthenticated'](),controller[_0x0a9d('0xe')]);router[_0x0a9d('0xf')]('/',auth[_0x0a9d('0x9')](),interaction['tracked'](_0x0a9d('0x10'),_0x0a9d('0x11')),controller[_0x0a9d('0x12')]);router[_0x0a9d('0x13')]('/:id',auth[_0x0a9d('0x9')](),controller[_0x0a9d('0x14')]);router[_0x0a9d('0x13')]('/:id/accept',auth[_0x0a9d('0x9')](),controller['accept']);router[_0x0a9d('0x13')](_0x0a9d('0x15'),auth[_0x0a9d('0x9')](),controller[_0x0a9d('0x16')]);router[_0x0a9d('0x17')]('/:id',auth[_0x0a9d('0x9')](),controller[_0x0a9d('0x18')]);module[_0x0a9d('0x19')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 8576262..ecdf433 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 _0x236b=['STRING','DATE','INTEGER','Email','sequelize','lodash','TEXT','long','BOOLEAN','ENUM','out'];(function(_0x2d2878,_0x10dbd2){var _0x4752e4=function(_0x10849e){while(--_0x10849e){_0x2d2878['push'](_0x2d2878['shift']());}};_0x4752e4(++_0x10dbd2);}(_0x236b,0xa9));var _0xb236=function(_0x17b12f,_0x132ab1){_0x17b12f=_0x17b12f-0x0;var _0x38292b=_0x236b[_0x17b12f];return _0x38292b;};'use strict';var Sequelize=require(_0xb236('0x0'));var _=require(_0xb236('0x1'));module['exports']={'body':{'type':Sequelize[_0xb236('0x2')](_0xb236('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xb236('0x2')]('medium')},'read':{'type':Sequelize[_0xb236('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xb236('0x5')]('in',_0xb236('0x6')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0xb236('0x7')](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0xb236('0x2')](_0xb236('0x3'))},'cc':{'type':Sequelize['TEXT'](_0xb236('0x3'))},'bcc':{'type':Sequelize[_0xb236('0x2')](_0xb236('0x3'))},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize[_0xb236('0x8')]},'attach':{'type':Sequelize[_0xb236('0x9')],'defaultValue':0x0},'secret':{'type':Sequelize[_0xb236('0x4')],'defaultValue':![]},'readAt':{'type':Sequelize[_0xb236('0x8')]},'originTo':{'type':Sequelize[_0xb236('0x2')](_0xb236('0x3'))},'originCc':{'type':Sequelize[_0xb236('0x2')](_0xb236('0x3'))},'originChannel':{'type':Sequelize['ENUM'](_0xb236('0xa'),'Chat'),'defaultValue':_0xb236('0xa'),'allowNull':![]}}; \ No newline at end of file +var _0xd333=['lodash','exports','long','TEXT','BOOLEAN','ENUM','out','STRING','DATE','INTEGER','Email','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd333,0x1a3));var _0x3d33=function(_0x3a4f84,_0x5aec68){_0x3a4f84=_0x3a4f84-0x0;var _0x4d4d0b=_0xd333[_0x3a4f84];return _0x4d4d0b;};'use strict';var Sequelize=require(_0x3d33('0x0'));var _=require(_0x3d33('0x1'));module[_0x3d33('0x2')]={'body':{'type':Sequelize['TEXT'](_0x3d33('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x3d33('0x4')]('medium')},'read':{'type':Sequelize[_0x3d33('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0x3d33('0x6')]('in',_0x3d33('0x7')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x3d33('0x8')](0x1fe)},'from':{'type':Sequelize[_0x3d33('0x8')]},'to':{'type':Sequelize['TEXT'](_0x3d33('0x3'))},'cc':{'type':Sequelize[_0x3d33('0x4')](_0x3d33('0x3'))},'bcc':{'type':Sequelize[_0x3d33('0x4')]('long')},'subject':{'type':Sequelize[_0x3d33('0x4')]},'sentAt':{'type':Sequelize[_0x3d33('0x9')]},'attach':{'type':Sequelize[_0x3d33('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x3d33('0x5')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x3d33('0x9')]},'originTo':{'type':Sequelize[_0x3d33('0x4')](_0x3d33('0x3'))},'originCc':{'type':Sequelize[_0x3d33('0x4')](_0x3d33('0x3'))},'originChannel':{'type':Sequelize[_0x3d33('0x6')](_0x3d33('0xb'),'Chat'),'defaultValue':_0x3d33('0xb'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 1a1929d..6825772 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 _0xc03a=['sendStatus','stack','name','send','index','map','MailMessage','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','rows','show','params','includeAll','include','find','body','describe','create','direction','secret','split','MailAccount','findOne','MailAccountId','List','CmContact','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','join','root','server/files/attachments','basename','Contacts','List\x20not\x20found','SendMail','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','stringify','accept','mail','read','readAt','UserId','MailInteraction','MailInteractionId','update','isNil','read1stAt','get','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','interaction','AcceptMessage','acceptMessage','sequelize','Sequelize','QueryTypes','User','fullname','internal','manual','interface','SIP/%s','channel','motionChannel','event','fromString','EventManager','acceptmessage','reject','agent','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','SELECT','contact','email','rejectmessage','download','unix','toString','files','server','from','bcc','subject','createdAt','Attachment','Attachments','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','existsSync','build','writeFileSync','unlinkSync','eml-format','moment','bluebird','util','lodash','ioredis','html-to-text','../../components/parsers/qs','../../config/logger','api','mail-interactions','../../mysqldb','redis','localhost','html-entities','./mailMessage.socket','register','jayson/promise','client','http','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','status','json','offset','undefined','limit','count','set','Content-Range','destroy','end'];(function(_0x5d949e,_0x555707){var _0x445c1e=function(_0x160f2a){while(--_0x160f2a){_0x5d949e['push'](_0x5d949e['shift']());}};_0x445c1e(++_0x555707);}(_0xc03a,0x1cb));var _0xac03=function(_0x1219d0,_0x48dd39){_0x1219d0=_0x1219d0-0x0;var _0x2aa446=_0xc03a[_0x1219d0];return _0x2aa446;};'use strict';var emlformat=require(_0xac03('0x0'));var moment=require(_0xac03('0x1'));var BPromise=require(_0xac03('0x2'));var util=require(_0xac03('0x3'));var path=require('path');var fs=require('fs');var _=require(_0xac03('0x4'));var Redis=require(_0xac03('0x5'));var htmlToText=require(_0xac03('0x6'));var qs=require(_0xac03('0x7'));var logger=require(_0xac03('0x8'))(_0xac03('0x9'));var interaction_log=require('../../config/logger')(_0xac03('0xa'));var config=require('../../config/environment');var db=require(_0xac03('0xb'))['db'];config[_0xac03('0xc')]=_['defaults'](config['redis'],{'host':_0xac03('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xac03('0xc')]));var htmlEntities=require(_0xac03('0xe'));require(_0xac03('0xf'))[_0xac03('0x10')](socket);var jayson=require(_0xac03('0x11'));var client=jayson[_0xac03('0x12')][_0xac03('0x13')]({'port':0x232c});var client9003=jayson[_0xac03('0x12')][_0xac03('0x13')]({'port':0x232b});var client9002=jayson[_0xac03('0x12')][_0xac03('0x13')]({'port':0x232a});function respondWithRpcPromise(_0x548629,_0x1c8df9,_0x22cabb,_0x1eb355){return new BPromise(function(_0x297f69,_0x58da0b){var _0x44704a=_0x1eb355||client;return _0x44704a[_0xac03('0x14')](_0x548629,_0x22cabb)[_0xac03('0x15')](function(_0x5cd475){logger[_0xac03('0x16')](_0xac03('0x17'),_0x1c8df9,_0xac03('0x18'));logger[_0xac03('0x19')](_0xac03('0x1a'),_0x1c8df9,_0xac03('0x18'),JSON['stringify'](_0x5cd475));if(_0x5cd475[_0xac03('0x1b')]){if(_0x5cd475[_0xac03('0x1b')][_0xac03('0x1c')]===0x1f4){logger[_0xac03('0x1b')]('MailMessage,\x20%s,\x20%s',_0x1c8df9,_0x5cd475[_0xac03('0x1b')][_0xac03('0x1d')]);return _0x58da0b(_0x5cd475[_0xac03('0x1b')][_0xac03('0x1d')]);}logger[_0xac03('0x1b')](_0xac03('0x17'),_0x1c8df9,_0x5cd475[_0xac03('0x1b')][_0xac03('0x1d')]);return _0x297f69(_0x5cd475[_0xac03('0x1b')][_0xac03('0x1d')]);}else{logger[_0xac03('0x16')](_0xac03('0x17'),_0x1c8df9,'request\x20sent');_0x297f69(_0x5cd475[_0xac03('0x1e')]['message']);}})[_0xac03('0x1f')](function(_0x26611a){logger[_0xac03('0x1b')](_0xac03('0x17'),_0x1c8df9,_0x26611a);_0x58da0b(_0x26611a);});});}function respondWithResult(_0x12207c,_0x2a8df6){_0x2a8df6=_0x2a8df6||0xc8;return function(_0x5cfd1f){if(_0x5cfd1f){return _0x12207c[_0xac03('0x20')](_0x2a8df6)[_0xac03('0x21')](_0x5cfd1f);}};}function respondWithFilteredResult(_0x295e41,_0x130ad1){return function(_0x344aed){if(_0x344aed){var _0x5949d0=typeof _0x130ad1[_0xac03('0x22')]===_0xac03('0x23')&&typeof _0x130ad1[_0xac03('0x24')]===_0xac03('0x23');var _0x4f91d2=_0x344aed[_0xac03('0x25')];var _0x1597c6=_0x5949d0?0x0:_0x130ad1[_0xac03('0x22')];var _0x3dc632=_0x5949d0?_0x344aed[_0xac03('0x25')]:_0x130ad1[_0xac03('0x22')]+_0x130ad1[_0xac03('0x24')];var _0x55daac;if(_0x3dc632>=_0x4f91d2){_0x3dc632=_0x4f91d2;_0x55daac=0xc8;}else{_0x55daac=0xce;}_0x295e41['status'](_0x55daac);return _0x295e41[_0xac03('0x26')](_0xac03('0x27'),_0x1597c6+'-'+_0x3dc632+'/'+_0x4f91d2)[_0xac03('0x21')](_0x344aed);}return null;};}function saveUpdates(_0xc68710){return function(_0x454cc5){if(_0x454cc5){return _0x454cc5['update'](_0xc68710)[_0xac03('0x15')](function(_0x226107){return _0x226107;});}return null;};}function removeEntity(_0x491e71){return function(_0x12302b){if(_0x12302b){return _0x12302b[_0xac03('0x28')]()[_0xac03('0x15')](function(){_0x491e71[_0xac03('0x20')](0xcc)[_0xac03('0x29')]();});}};}function handleEntityNotFound(_0x21de34){return function(_0x3cdec3){if(!_0x3cdec3){_0x21de34[_0xac03('0x2a')](0x194);}return _0x3cdec3;};}function handleError(_0x2bc808,_0x170dff){_0x170dff=_0x170dff||0x1f4;return function(_0x126699){logger[_0xac03('0x1b')](_0x126699[_0xac03('0x2b')]);if(_0x126699['name']){delete _0x126699[_0xac03('0x2c')];}_0x2bc808[_0xac03('0x20')](_0x170dff)[_0xac03('0x2d')](_0x126699);};}exports[_0xac03('0x2e')]=function(_0x4af57f,_0x59fe57){var _0x5a2fd2={},_0x7d024e={},_0x1ae3d5={'count':0x0,'rows':[]};var _0x79b1f=_[_0xac03('0x2f')](db[_0xac03('0x30')][_0xac03('0x31')],function(_0x328586){return{'name':_0x328586[_0xac03('0x32')],'type':_0x328586['type'][_0xac03('0x33')]};});_0x7d024e[_0xac03('0x34')]=_[_0xac03('0x2f')](_0x79b1f,_0xac03('0x2c'));_0x7d024e[_0xac03('0x35')]=_[_0xac03('0x36')](_0x4af57f[_0xac03('0x35')]);_0x7d024e[_0xac03('0x37')]=_['intersection'](_0x7d024e[_0xac03('0x34')],_0x7d024e[_0xac03('0x35')]);_0x5a2fd2[_0xac03('0x38')]=_[_0xac03('0x39')](_0x7d024e['model'],qs[_0xac03('0x3a')](_0x4af57f['query']['fields']));_0x5a2fd2[_0xac03('0x38')]=_0x5a2fd2[_0xac03('0x38')][_0xac03('0x3b')]?_0x5a2fd2[_0xac03('0x38')]:_0x7d024e[_0xac03('0x34')];if(!_0x4af57f['query'][_0xac03('0x3c')](_0xac03('0x3d'))){_0x5a2fd2['limit']=qs[_0xac03('0x24')](_0x4af57f['query'][_0xac03('0x24')]);_0x5a2fd2[_0xac03('0x22')]=qs[_0xac03('0x22')](_0x4af57f['query'][_0xac03('0x22')]);}_0x5a2fd2[_0xac03('0x3e')]=qs[_0xac03('0x3f')](_0x4af57f[_0xac03('0x35')][_0xac03('0x3f')]);_0x5a2fd2[_0xac03('0x40')]=qs[_0xac03('0x37')](_[_0xac03('0x41')](_0x4af57f[_0xac03('0x35')],_0x7d024e['filters']),_0x79b1f);if(_0x4af57f[_0xac03('0x35')][_0xac03('0x42')]){_0x5a2fd2[_0xac03('0x40')]=_[_0xac03('0x43')](_0x5a2fd2[_0xac03('0x40')],{'$or':_['map'](_0x79b1f,function(_0x122629){if(_0x122629[_0xac03('0x44')]!==_0xac03('0x45')){var _0x873337={};_0x873337[_0x122629['name']]={'$like':'%'+_0x4af57f['query'][_0xac03('0x42')]+'%'};return _0x873337;}})});}_0x5a2fd2=_['merge']({},_0x5a2fd2,_0x4af57f[_0xac03('0x46')]);var _0xaecf99={'where':_0x5a2fd2[_0xac03('0x40')]};return db[_0xac03('0x30')][_0xac03('0x25')](_0xaecf99)['then'](function(_0x114a9a){_0x1ae3d5[_0xac03('0x25')]=_0x114a9a;if(_0x4af57f[_0xac03('0x35')]['includeAll']){_0x5a2fd2['include']=[{'all':!![]}];}return db[_0xac03('0x30')]['findAll'](_0x5a2fd2);})[_0xac03('0x15')](function(_0xfc3365){_0x1ae3d5[_0xac03('0x47')]=_0xfc3365;return _0x1ae3d5;})[_0xac03('0x15')](respondWithFilteredResult(_0x59fe57,_0x5a2fd2))[_0xac03('0x1f')](handleError(_0x59fe57,null));};exports[_0xac03('0x48')]=function(_0x3b9e00,_0x650ca5){var _0x1ac42f={'raw':!![],'where':{'id':_0x3b9e00[_0xac03('0x49')]['id']}},_0x3d7201={};_0x3d7201[_0xac03('0x34')]=_[_0xac03('0x36')](db[_0xac03('0x30')][_0xac03('0x31')]);_0x3d7201['query']=_[_0xac03('0x36')](_0x3b9e00[_0xac03('0x35')]);_0x3d7201[_0xac03('0x37')]=_['intersection'](_0x3d7201[_0xac03('0x34')],_0x3d7201[_0xac03('0x35')]);_0x1ac42f[_0xac03('0x38')]=_['intersection'](_0x3d7201['model'],qs[_0xac03('0x3a')](_0x3b9e00[_0xac03('0x35')][_0xac03('0x3a')]));_0x1ac42f['attributes']=_0x1ac42f[_0xac03('0x38')][_0xac03('0x3b')]?_0x1ac42f[_0xac03('0x38')]:_0x3d7201['model'];if(_0x3b9e00[_0xac03('0x35')][_0xac03('0x4a')]){_0x1ac42f[_0xac03('0x4b')]=[{'all':!![]}];}_0x1ac42f=_[_0xac03('0x43')]({},_0x1ac42f,_0x3b9e00[_0xac03('0x46')]);return db[_0xac03('0x30')][_0xac03('0x4c')](_0x1ac42f)[_0xac03('0x15')](handleEntityNotFound(_0x650ca5,null))[_0xac03('0x15')](respondWithResult(_0x650ca5,null))[_0xac03('0x1f')](handleError(_0x650ca5,null));};exports['update']=function(_0x18f4ae,_0x31d58e){if(_0x18f4ae[_0xac03('0x4d')]['id']){delete _0x18f4ae[_0xac03('0x4d')]['id'];}return db[_0xac03('0x30')][_0xac03('0x4c')]({'where':{'id':_0x18f4ae[_0xac03('0x49')]['id']}})[_0xac03('0x15')](handleEntityNotFound(_0x31d58e,null))[_0xac03('0x15')](saveUpdates(_0x18f4ae[_0xac03('0x4d')],null))[_0xac03('0x15')](respondWithResult(_0x31d58e,null))[_0xac03('0x1f')](handleError(_0x31d58e,null));};exports['destroy']=function(_0x546cc6,_0x4c3899){return db['MailMessage'][_0xac03('0x4c')]({'where':{'id':_0x546cc6[_0xac03('0x49')]['id']}})[_0xac03('0x15')](handleEntityNotFound(_0x4c3899,null))[_0xac03('0x15')](removeEntity(_0x4c3899,null))[_0xac03('0x1f')](handleError(_0x4c3899,null));};exports[_0xac03('0x4e')]=function(_0x5c7ecf,_0x195460){return db[_0xac03('0x30')]['describe']()['then'](respondWithResult(_0x195460,null))[_0xac03('0x1f')](handleError(_0x195460,null));};exports['create']=function(_0x4b14eb,_0x1b364a){return db['MailMessage'][_0xac03('0x4f')](_0x4b14eb[_0xac03('0x4d')])['then'](function(_0x192894){if(_0x192894){if(_0x192894[_0xac03('0x50')]==='out'&&!_0x192894[_0xac03('0x51')]){var _0x29d0a8,_0x70e2fc,_0x120591;if(_0x4b14eb[_0xac03('0x4d')]['to']){_0x70e2fc=_0x4b14eb[_0xac03('0x4d')]['to'][_0xac03('0x52')](',')[0x0];}return db[_0xac03('0x53')][_0xac03('0x54')]({'where':{'id':_0x192894[_0xac03('0x55')]},'include':[{'model':db['CmList'],'as':_0xac03('0x56'),'include':[{'model':db[_0xac03('0x57')],'as':'Contacts','where':{'email':_0x70e2fc},'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0xac03('0x58')],'as':_0xac03('0x59'),'raw':!![],'include':[{'model':db[_0xac03('0x5a')],'as':_0xac03('0x5a'),'raw':!![]}]}]})['then'](function(_0x3c3445){_0x29d0a8=_0x3c3445;if(!_0x29d0a8||!_0x29d0a8[_0xac03('0x59')])return;var _0x33c129=_0x29d0a8[_0xac03('0x5b')]();if(_0x4b14eb[_0xac03('0x4d')]['attachments']&&_0x4b14eb[_0xac03('0x4d')][_0xac03('0x5c')][_0xac03('0x3b')]){for(var _0x34fb21=0x0;_0x34fb21<_0x4b14eb[_0xac03('0x4d')]['attachments'][_0xac03('0x3b')];_0x34fb21+=0x1){_0x4b14eb[_0xac03('0x4d')][_0xac03('0x5c')][_0x34fb21]={'filename':_0x4b14eb[_0xac03('0x4d')][_0xac03('0x5c')][_0x34fb21][_0xac03('0x2c')],'path':path[_0xac03('0x5d')](config[_0xac03('0x5e')],_0xac03('0x5f'),_0x4b14eb['body'][_0xac03('0x5c')][_0x34fb21][_0xac03('0x60')])};}}_0x120591={'account':_0x33c129,'message':_0x4b14eb['body']};return;})[_0xac03('0x15')](function(){if(_0x29d0a8['List']){if(_0x29d0a8[_0xac03('0x56')][_0xac03('0x61')]['length']){return _0x29d0a8[_0xac03('0x56')][_0xac03('0x61')][0x0];}else{return db['CmContact'][_0xac03('0x4f')](_['defaults'](_0x4b14eb['body'],{'firstName':_0x4b14eb[_0xac03('0x4d')]['to'],'email':_0x4b14eb[_0xac03('0x4d')]['to'],'phone':_0x4b14eb[_0xac03('0x4d')]['to'],'ListId':_0x29d0a8['ListId']}));}}else{throw new Error(_0xac03('0x62'));}})[_0xac03('0x15')](function(){if(_0x120591){return respondWithRpcPromise(_0xac03('0x63'),_0xac03('0x64'),_0x120591,client9003)[_0xac03('0x15')](function(_0x50f157){return _0x192894['update']({'read':!![],'messageId':_0x50f157[_0xac03('0x65')],'sentAt':moment()[_0xac03('0x66')](_0xac03('0x67'))});})[_0xac03('0x1f')](function(_0x4e0cca){logger[_0xac03('0x1b')]('%s',JSON[_0xac03('0x68')](_0x4e0cca));return _0x192894;});}return _0x192894;});}return _0x192894;}})[_0xac03('0x15')](respondWithResult(_0x1b364a,0xc9))['catch'](handleError(_0x1b364a,null));};exports[_0xac03('0x69')]=function(_0x576d09,_0x135b84){var _0x212160={'agent':{},'channel':_0xac03('0x6a')};if(_0x576d09['body']['id']){delete _0x576d09['body']['id'];}_0x576d09[_0xac03('0x4d')][_0xac03('0x6b')]=!![];_0x576d09[_0xac03('0x4d')][_0xac03('0x6c')]=moment()[_0xac03('0x66')](_0xac03('0x67'));_0x576d09[_0xac03('0x4d')][_0xac03('0x6d')]=_0x576d09['body'][_0xac03('0x6d')]||_0x576d09['user']['id'];_0x212160['agent']['id']=_0x576d09[_0xac03('0x4d')][_0xac03('0x6d')];return db['MailMessage'][_0xac03('0x4c')]({'where':{'id':_0x576d09[_0xac03('0x49')]['id'],'UserId':null}})[_0xac03('0x15')](handleEntityNotFound(_0x135b84,null))['then'](saveUpdates(_0x576d09[_0xac03('0x4d')],null))['then'](function(_0x31c386){if(_0x31c386){_0x212160[_0xac03('0x1d')]=_0x31c386['get']({'plain':!![]});return db[_0xac03('0x6e')]['find']({'where':{'id':_0x31c386[_0xac03('0x6f')]}});}return null;})['then'](handleEntityNotFound(_0x135b84,null))[_0xac03('0x15')](function(_0x3e590f){if(_0x3e590f){return _0x3e590f[_0xac03('0x70')]({'UserId':_0x576d09[_0xac03('0x4d')][_0xac03('0x6d')],'read1stAt':_[_0xac03('0x71')](_0x3e590f[_0xac03('0x72')])?moment()[_0xac03('0x66')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x1df1d9){if(_0x1df1d9){_0x212160['interaction']=_0x1df1d9[_0xac03('0x73')]({'plain':!![]});interaction_log[_0xac03('0x16')](_0xac03('0x74'),_0x576d09[_0xac03('0x75')]['id'],_0x576d09[_0xac03('0x75')][_0xac03('0x2c')],_0x576d09[_0xac03('0x75')][_0xac03('0x76')],_0x212160[_0xac03('0x77')]['id'],_0x576d09[_0xac03('0x4d')]?JSON[_0xac03('0x68')](_0x576d09[_0xac03('0x4d')]):'null');return respondWithRpcPromise(_0xac03('0x78'),_0xac03('0x79'),_0x212160);}return null;})[_0xac03('0x15')](function(_0x133135){var _0x184130='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x133135[_0xac03('0x1d')]['ContactId'];return db[_0xac03('0x7a')][_0xac03('0x35')](_0x184130,{'type':db[_0xac03('0x7b')][_0xac03('0x7c')]['SELECT'],'raw':!![]})['then'](function(_0x243d75){return _0x243d75;});})[_0xac03('0x15')](function(_0x909bc9){if(_0x909bc9){_0x212160[_0xac03('0x1d')]['contact']=_0x909bc9[0x0];if(!_0x576d09[_0xac03('0x4d')]['UserId'])return;return db[_0xac03('0x7d')][_0xac03('0x4c')]({'where':{'id':_0x576d09[_0xac03('0x4d')][_0xac03('0x6d')],'role':'agent'},'attributes':['id',_0xac03('0x2c'),_0xac03('0x7e'),'email',_0xac03('0x7f')],'raw':!![]});}return null;})[_0xac03('0x15')](function(_0x14b251){if(!_0x14b251)return null;_0x212160[_0xac03('0x1d')]['agent']=_0x14b251;return _0x212160;})[_0xac03('0x15')](function(_0x37d2f9){if(_0x37d2f9){if(_0x576d09[_0xac03('0x4d')][_0xac03('0x80')]){_0x212160[_0xac03('0x1d')][_0xac03('0x81')]=util[_0xac03('0x66')](_0xac03('0x82'),_0x576d09['user']['name']);_0x212160['message'][_0xac03('0x83')]=_0x212160[_0xac03('0x83')];_0x212160['message'][_0xac03('0x84')]=_0x212160['channel'];_0x212160[_0xac03('0x1d')][_0xac03('0x85')]=_0xac03('0x69');_0x212160[_0xac03('0x1d')][_0xac03('0x4d')]=htmlToText[_0xac03('0x86')](_0x212160['message']['body']);return respondWithRpcPromise(_0xac03('0x87'),_0xac03('0x87'),{'event':_0xac03('0x88'),'message':_0x212160[_0xac03('0x1d')]},client9002)[_0xac03('0x15')](function(){return _0x212160;});}return _0x212160;}return null;})['then'](respondWithResult(_0x135b84,null))[_0xac03('0x1f')](handleError(_0x135b84,null));};exports[_0xac03('0x89')]=function(_0x5cffa7,_0x54f0e9){var _0x31aaa3={'agent':{},'channel':_0xac03('0x6a')};if(_0x5cffa7[_0xac03('0x4d')]['id']){delete _0x5cffa7[_0xac03('0x4d')]['id'];}_0x5cffa7[_0xac03('0x4d')][_0xac03('0x6d')]=_0x5cffa7[_0xac03('0x4d')]['UserId']||_0x5cffa7[_0xac03('0x75')]['id'];_0x31aaa3[_0xac03('0x8a')]['id']=_0x5cffa7['body']['UserId'];return db['MailMessage'][_0xac03('0x4c')]({'where':{'id':_0x5cffa7[_0xac03('0x49')]['id'],'UserId':null}})[_0xac03('0x15')](handleEntityNotFound(_0x54f0e9,null))[_0xac03('0x15')](function(_0x354238){if(_0x354238){_0x31aaa3[_0xac03('0x1d')]=_0x354238[_0xac03('0x73')]({'plain':!![]});return db['MailInteraction'][_0xac03('0x4c')]({'where':{'id':_0x354238[_0xac03('0x6f')]}});}return null;})[_0xac03('0x15')](handleEntityNotFound(_0x54f0e9,null))[_0xac03('0x15')](function(_0x33d95b){if(_0x33d95b){_0x31aaa3['interaction']=_0x33d95b[_0xac03('0x73')]({'plain':!![]});interaction_log[_0xac03('0x16')](_0xac03('0x8b'),_0x5cffa7['user']['id'],_0x5cffa7[_0xac03('0x75')]['name'],_0x5cffa7[_0xac03('0x75')][_0xac03('0x76')],_0x31aaa3[_0xac03('0x77')]['id'],_0x5cffa7[_0xac03('0x4d')]?JSON[_0xac03('0x68')](_0x5cffa7[_0xac03('0x4d')]):_0xac03('0x8c'));return respondWithRpcPromise(_0xac03('0x8d'),_0xac03('0x8e'),_0x31aaa3);}return null;})['then'](function(_0x2ddea2){var _0x16c83d=_0xac03('0x8f')+_0x2ddea2[_0xac03('0x1d')][_0xac03('0x90')];return db[_0xac03('0x7a')]['query'](_0x16c83d,{'type':db[_0xac03('0x7b')][_0xac03('0x7c')][_0xac03('0x91')],'raw':!![]})[_0xac03('0x15')](function(_0x153de3){return _0x153de3;});})[_0xac03('0x15')](function(_0x17fb85){if(_0x17fb85){_0x31aaa3[_0xac03('0x1d')][_0xac03('0x92')]=_0x17fb85[0x0];if(!_0x5cffa7[_0xac03('0x4d')][_0xac03('0x6d')])return;return db['User'][_0xac03('0x4c')]({'where':{'id':_0x5cffa7[_0xac03('0x4d')][_0xac03('0x6d')],'role':_0xac03('0x8a')},'attributes':['id',_0xac03('0x2c'),_0xac03('0x7e'),_0xac03('0x93'),_0xac03('0x7f')],'raw':!![]});}return null;})[_0xac03('0x15')](function(_0x17a59e){if(!_0x17a59e)return null;_0x31aaa3[_0xac03('0x1d')][_0xac03('0x8a')]=_0x17a59e;return _0x31aaa3;})[_0xac03('0x15')](function(_0x3af86b){if(_0x3af86b){_0x3af86b[_0xac03('0x1d')][_0xac03('0x81')]=util['format']('SIP/%s',_0x5cffa7[_0xac03('0x75')][_0xac03('0x2c')]);_0x3af86b['message'][_0xac03('0x83')]=_0x31aaa3[_0xac03('0x83')];_0x3af86b[_0xac03('0x1d')][_0xac03('0x84')]=_0x31aaa3[_0xac03('0x83')];_0x3af86b[_0xac03('0x1d')]['event']=_0xac03('0x89');_0x3af86b[_0xac03('0x1d')][_0xac03('0x4d')]=htmlToText[_0xac03('0x86')](_0x31aaa3[_0xac03('0x1d')][_0xac03('0x4d')]);respondWithRpcPromise(_0xac03('0x87'),'EventManager',{'event':_0xac03('0x94'),'message':_0x3af86b[_0xac03('0x1d')]},client9002);return _0x31aaa3;}return null;})[_0xac03('0x15')](respondWithResult(_0x54f0e9,null))[_0xac03('0x1f')](handleError(_0x54f0e9,null));};exports[_0xac03('0x95')]=function(_0x9411b1,_0x2a1605){var _0x256f74=moment()[_0xac03('0x96')]()[_0xac03('0x97')]();var _0x220c6a=path[_0xac03('0x5d')](config[_0xac03('0x5e')],'server',_0xac03('0x98'),'tmp');var _0x5c834e=path[_0xac03('0x5d')](config[_0xac03('0x5e')],_0xac03('0x99'),_0xac03('0x98'),_0xac03('0x5c'));var _0x59fd4d=util[_0xac03('0x66')]('message-%s.eml',_0x256f74);return db[_0xac03('0x30')][_0xac03('0x4c')]({'where':{'id':_0x9411b1[_0xac03('0x49')]['id']},'attributes':['id',_0xac03('0x4d'),_0xac03('0x9a'),'to','cc',_0xac03('0x9b'),_0xac03('0x9c'),_0xac03('0x9d')],'include':_0x9411b1[_0xac03('0x35')]['attachments']?[{'model':db[_0xac03('0x9e')],'as':_0xac03('0x9f')}]:undefined})[_0xac03('0x15')](handleEntityNotFound(_0x2a1605,null))[_0xac03('0x15')](function(_0x4037c1){if(_0x4037c1){var _0x10dc07=_0x4037c1;var _0x51d165={'from':_0x10dc07[_0xac03('0x9a')],'to':_0x10dc07['to'],'subject':_0x10dc07[_0xac03('0x9c')],'html':htmlEntities[_0xac03('0xa0')](_0x10dc07[_0xac03('0x4d')]),'headers':{'Date':moment(_0x10dc07[_0xac03('0x9d')])[_0xac03('0x66')](_0xac03('0xa1'))},'attachments':[]};if(_0x4037c1['cc']){_0x51d165['headers']['Cc']=_0x4037c1['cc'];}if(_0x4037c1[_0xac03('0x9b')]){_0x51d165[_0xac03('0xa2')]['Bcc']=_0x4037c1[_0xac03('0x9b')];}return new BPromise(function(_0x182676,_0x272ba5){if(_0x4037c1[_0xac03('0x9f')]){for(var _0x26056d=0x0;_0x26056d<_0x4037c1[_0xac03('0x9f')][_0xac03('0x3b')];_0x26056d++){var _0x438d52=_0x4037c1[_0xac03('0x9f')][_0x26056d];var _0x4a8788=path[_0xac03('0x5d')](_0x5c834e,_0x438d52[_0xac03('0x60')]);if(fs[_0xac03('0xa3')](_0x4a8788)){_0x51d165[_0xac03('0x5c')]['push']({'name':_0x438d52[_0xac03('0x2c')],'contentType':_0x438d52[_0xac03('0x44')],'data':fs['readFileSync'](_0x4a8788)});}}}emlformat[_0xac03('0xa4')](_0x51d165,function(_0x79056c,_0x49198b){if(_0x79056c)return _0x272ba5(_0x79056c);fs[_0xac03('0xa5')](path['join'](_0x220c6a,_0x59fd4d),_0x49198b);return _0x182676(_0x49198b);});});}})[_0xac03('0x15')](function(_0xf439cb){if(_0xf439cb){return _0x2a1605[_0xac03('0x95')](path['join'](_0x220c6a,_0x59fd4d),_0x59fd4d,function(_0x1cca23){if(!_0x1cca23)fs[_0xac03('0xa6')](path[_0xac03('0x5d')](_0x220c6a,_0x59fd4d));});}})[_0xac03('0x1f')](handleError(_0x2a1605,null));}; \ No newline at end of file +var _0xc4a9=['basename','readFileSync','build','eml-format','moment','bluebird','util','path','lodash','ioredis','html-to-text','../../config/logger','mail-interactions','../../config/environment','redis','defaults','localhost','socket.io-emitter','html-entities','./mailMessage.socket','register','client','http','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','json','offset','undefined','limit','count','status','set','Content-Range','update','destroy','end','sendStatus','stack','name','send','index','MailMessage','rawAttributes','type','map','query','keys','model','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','options','includeAll','include','params','fields','body','find','describe','create','direction','out','secret','MailAccountId','CmList','List','Contacts','updatedAt','DESC','Smtp','CloudProvider','attachments','join','server/files/attachments','CmContact','ListId','List\x20not\x20found','SendMail','messageId','accept','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','MailInteraction','MailInteractionId','isNil','read1stAt','format','interaction','null','acceptMessage','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','internal','manual','interface','channel','motionChannel','event','EventManager','acceptmessage','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','ContactId','SIP/%s','reject','fromString','rejectmessage','download','toString','server','files','tmp','root','message-%s.eml','bcc','subject','createdAt','Attachment','Attachments','from','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers'];(function(_0x4c184d,_0x4278ab){var _0x23d997=function(_0x22d068){while(--_0x22d068){_0x4c184d['push'](_0x4c184d['shift']());}};_0x23d997(++_0x4278ab);}(_0xc4a9,0x131));var _0x9c4a=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xc4a9[_0x3947c9];return _0x2e7871;};'use strict';var emlformat=require(_0x9c4a('0x0'));var moment=require(_0x9c4a('0x1'));var BPromise=require(_0x9c4a('0x2'));var util=require(_0x9c4a('0x3'));var path=require(_0x9c4a('0x4'));var fs=require('fs');var _=require(_0x9c4a('0x5'));var Redis=require(_0x9c4a('0x6'));var htmlToText=require(_0x9c4a('0x7'));var qs=require('../../components/parsers/qs');var logger=require(_0x9c4a('0x8'))('api');var interaction_log=require('../../config/logger')(_0x9c4a('0x9'));var config=require(_0x9c4a('0xa'));var db=require('../../mysqldb')['db'];config[_0x9c4a('0xb')]=_[_0x9c4a('0xc')](config[_0x9c4a('0xb')],{'host':_0x9c4a('0xd'),'port':0x18eb});var socket=require(_0x9c4a('0xe'))(new Redis(config[_0x9c4a('0xb')]));var htmlEntities=require(_0x9c4a('0xf'));require(_0x9c4a('0x10'))[_0x9c4a('0x11')](socket);var jayson=require('jayson/promise');var client=jayson[_0x9c4a('0x12')][_0x9c4a('0x13')]({'port':0x232c});var client9003=jayson[_0x9c4a('0x12')][_0x9c4a('0x13')]({'port':0x232b});var client9002=jayson[_0x9c4a('0x12')][_0x9c4a('0x13')]({'port':0x232a});function respondWithRpcPromise(_0x4544f2,_0x352ac3,_0x3fb028,_0x13a261){return new BPromise(function(_0x1f29c7,_0x2f4a6c){var _0x5bec27=_0x13a261||client;return _0x5bec27[_0x9c4a('0x14')](_0x4544f2,_0x3fb028)[_0x9c4a('0x15')](function(_0x16dd69){logger[_0x9c4a('0x16')](_0x9c4a('0x17'),_0x352ac3,_0x9c4a('0x18'));logger[_0x9c4a('0x19')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x352ac3,_0x9c4a('0x18'),JSON[_0x9c4a('0x1a')](_0x16dd69));if(_0x16dd69['error']){if(_0x16dd69[_0x9c4a('0x1b')][_0x9c4a('0x1c')]===0x1f4){logger[_0x9c4a('0x1b')](_0x9c4a('0x17'),_0x352ac3,_0x16dd69[_0x9c4a('0x1b')][_0x9c4a('0x1d')]);return _0x2f4a6c(_0x16dd69[_0x9c4a('0x1b')][_0x9c4a('0x1d')]);}logger[_0x9c4a('0x1b')]('MailMessage,\x20%s,\x20%s',_0x352ac3,_0x16dd69['error'][_0x9c4a('0x1d')]);return _0x1f29c7(_0x16dd69[_0x9c4a('0x1b')][_0x9c4a('0x1d')]);}else{logger[_0x9c4a('0x16')](_0x9c4a('0x17'),_0x352ac3,_0x9c4a('0x18'));_0x1f29c7(_0x16dd69[_0x9c4a('0x1e')][_0x9c4a('0x1d')]);}})[_0x9c4a('0x1f')](function(_0xd27fee){logger[_0x9c4a('0x1b')](_0x9c4a('0x17'),_0x352ac3,_0xd27fee);_0x2f4a6c(_0xd27fee);});});}function respondWithResult(_0xf0b430,_0x2edeca){_0x2edeca=_0x2edeca||0xc8;return function(_0x32d72c){if(_0x32d72c){return _0xf0b430['status'](_0x2edeca)[_0x9c4a('0x20')](_0x32d72c);}};}function respondWithFilteredResult(_0x25bc11,_0x5b48bb){return function(_0x3c412a){if(_0x3c412a){var _0x5e78a4=typeof _0x5b48bb[_0x9c4a('0x21')]===_0x9c4a('0x22')&&typeof _0x5b48bb[_0x9c4a('0x23')]==='undefined';var _0x405956=_0x3c412a[_0x9c4a('0x24')];var _0x56707d=_0x5e78a4?0x0:_0x5b48bb[_0x9c4a('0x21')];var _0x920051=_0x5e78a4?_0x3c412a[_0x9c4a('0x24')]:_0x5b48bb[_0x9c4a('0x21')]+_0x5b48bb[_0x9c4a('0x23')];var _0x436fe8;if(_0x920051>=_0x405956){_0x920051=_0x405956;_0x436fe8=0xc8;}else{_0x436fe8=0xce;}_0x25bc11[_0x9c4a('0x25')](_0x436fe8);return _0x25bc11[_0x9c4a('0x26')](_0x9c4a('0x27'),_0x56707d+'-'+_0x920051+'/'+_0x405956)['json'](_0x3c412a);}return null;};}function saveUpdates(_0x4fc5a6){return function(_0x52eb62){if(_0x52eb62){return _0x52eb62[_0x9c4a('0x28')](_0x4fc5a6)[_0x9c4a('0x15')](function(_0x252e71){return _0x252e71;});}return null;};}function removeEntity(_0x2da746){return function(_0xcc7053){if(_0xcc7053){return _0xcc7053[_0x9c4a('0x29')]()[_0x9c4a('0x15')](function(){_0x2da746['status'](0xcc)[_0x9c4a('0x2a')]();});}};}function handleEntityNotFound(_0x12e94f){return function(_0x4c44ae){if(!_0x4c44ae){_0x12e94f[_0x9c4a('0x2b')](0x194);}return _0x4c44ae;};}function handleError(_0x57babe,_0x50656e){_0x50656e=_0x50656e||0x1f4;return function(_0x5a9f3d){logger[_0x9c4a('0x1b')](_0x5a9f3d[_0x9c4a('0x2c')]);if(_0x5a9f3d[_0x9c4a('0x2d')]){delete _0x5a9f3d[_0x9c4a('0x2d')];}_0x57babe['status'](_0x50656e)[_0x9c4a('0x2e')](_0x5a9f3d);};}exports[_0x9c4a('0x2f')]=function(_0x3333fa,_0x2c746b){var _0x5095a4={},_0x232183={},_0x33e182={'count':0x0,'rows':[]};var _0x6f76ba=_['map'](db[_0x9c4a('0x30')][_0x9c4a('0x31')],function(_0x3501db){return{'name':_0x3501db['fieldName'],'type':_0x3501db[_0x9c4a('0x32')]['key']};});_0x232183['model']=_[_0x9c4a('0x33')](_0x6f76ba,_0x9c4a('0x2d'));_0x232183[_0x9c4a('0x34')]=_[_0x9c4a('0x35')](_0x3333fa[_0x9c4a('0x34')]);_0x232183['filters']=_['intersection'](_0x232183[_0x9c4a('0x36')],_0x232183[_0x9c4a('0x34')]);_0x5095a4[_0x9c4a('0x37')]=_[_0x9c4a('0x38')](_0x232183['model'],qs['fields'](_0x3333fa[_0x9c4a('0x34')]['fields']));_0x5095a4[_0x9c4a('0x37')]=_0x5095a4[_0x9c4a('0x37')][_0x9c4a('0x39')]?_0x5095a4['attributes']:_0x232183[_0x9c4a('0x36')];if(!_0x3333fa[_0x9c4a('0x34')][_0x9c4a('0x3a')](_0x9c4a('0x3b'))){_0x5095a4[_0x9c4a('0x23')]=qs[_0x9c4a('0x23')](_0x3333fa['query'][_0x9c4a('0x23')]);_0x5095a4['offset']=qs[_0x9c4a('0x21')](_0x3333fa[_0x9c4a('0x34')]['offset']);}_0x5095a4[_0x9c4a('0x3c')]=qs[_0x9c4a('0x3d')](_0x3333fa[_0x9c4a('0x34')]['sort']);_0x5095a4[_0x9c4a('0x3e')]=qs[_0x9c4a('0x3f')](_['pick'](_0x3333fa['query'],_0x232183[_0x9c4a('0x3f')]),_0x6f76ba);if(_0x3333fa[_0x9c4a('0x34')]['filter']){_0x5095a4[_0x9c4a('0x3e')]=_['merge'](_0x5095a4['where'],{'$or':_['map'](_0x6f76ba,function(_0x382eee){if(_0x382eee['type']!=='VIRTUAL'){var _0x5b7482={};_0x5b7482[_0x382eee['name']]={'$like':'%'+_0x3333fa[_0x9c4a('0x34')][_0x9c4a('0x40')]+'%'};return _0x5b7482;}})});}_0x5095a4=_[_0x9c4a('0x41')]({},_0x5095a4,_0x3333fa[_0x9c4a('0x42')]);var _0x42788d={'where':_0x5095a4[_0x9c4a('0x3e')]};return db[_0x9c4a('0x30')]['count'](_0x42788d)['then'](function(_0x3e0ab0){_0x33e182[_0x9c4a('0x24')]=_0x3e0ab0;if(_0x3333fa[_0x9c4a('0x34')][_0x9c4a('0x43')]){_0x5095a4[_0x9c4a('0x44')]=[{'all':!![]}];}return db[_0x9c4a('0x30')]['findAll'](_0x5095a4);})[_0x9c4a('0x15')](function(_0x5cadab){_0x33e182['rows']=_0x5cadab;return _0x33e182;})[_0x9c4a('0x15')](respondWithFilteredResult(_0x2c746b,_0x5095a4))[_0x9c4a('0x1f')](handleError(_0x2c746b,null));};exports['show']=function(_0x358858,_0x18599d){var _0x52192b={'raw':!![],'where':{'id':_0x358858[_0x9c4a('0x45')]['id']}},_0x5e7b4b={};_0x5e7b4b[_0x9c4a('0x36')]=_[_0x9c4a('0x35')](db[_0x9c4a('0x30')]['rawAttributes']);_0x5e7b4b[_0x9c4a('0x34')]=_[_0x9c4a('0x35')](_0x358858[_0x9c4a('0x34')]);_0x5e7b4b[_0x9c4a('0x3f')]=_[_0x9c4a('0x38')](_0x5e7b4b[_0x9c4a('0x36')],_0x5e7b4b[_0x9c4a('0x34')]);_0x52192b[_0x9c4a('0x37')]=_[_0x9c4a('0x38')](_0x5e7b4b[_0x9c4a('0x36')],qs[_0x9c4a('0x46')](_0x358858[_0x9c4a('0x34')][_0x9c4a('0x46')]));_0x52192b[_0x9c4a('0x37')]=_0x52192b[_0x9c4a('0x37')][_0x9c4a('0x39')]?_0x52192b[_0x9c4a('0x37')]:_0x5e7b4b[_0x9c4a('0x36')];if(_0x358858[_0x9c4a('0x34')][_0x9c4a('0x43')]){_0x52192b[_0x9c4a('0x44')]=[{'all':!![]}];}_0x52192b=_[_0x9c4a('0x41')]({},_0x52192b,_0x358858[_0x9c4a('0x42')]);return db[_0x9c4a('0x30')]['find'](_0x52192b)[_0x9c4a('0x15')](handleEntityNotFound(_0x18599d,null))[_0x9c4a('0x15')](respondWithResult(_0x18599d,null))[_0x9c4a('0x1f')](handleError(_0x18599d,null));};exports['update']=function(_0x38f810,_0xa6866f){if(_0x38f810[_0x9c4a('0x47')]['id']){delete _0x38f810['body']['id'];}return db[_0x9c4a('0x30')][_0x9c4a('0x48')]({'where':{'id':_0x38f810['params']['id']}})[_0x9c4a('0x15')](handleEntityNotFound(_0xa6866f,null))[_0x9c4a('0x15')](saveUpdates(_0x38f810[_0x9c4a('0x47')],null))[_0x9c4a('0x15')](respondWithResult(_0xa6866f,null))[_0x9c4a('0x1f')](handleError(_0xa6866f,null));};exports[_0x9c4a('0x29')]=function(_0x55849b,_0x575a2c){return db['MailMessage']['find']({'where':{'id':_0x55849b['params']['id']}})[_0x9c4a('0x15')](handleEntityNotFound(_0x575a2c,null))[_0x9c4a('0x15')](removeEntity(_0x575a2c,null))[_0x9c4a('0x1f')](handleError(_0x575a2c,null));};exports[_0x9c4a('0x49')]=function(_0x211eab,_0x121b31){return db[_0x9c4a('0x30')][_0x9c4a('0x49')]()['then'](respondWithResult(_0x121b31,null))[_0x9c4a('0x1f')](handleError(_0x121b31,null));};exports[_0x9c4a('0x4a')]=function(_0x12c276,_0x83da16){return db[_0x9c4a('0x30')][_0x9c4a('0x4a')](_0x12c276[_0x9c4a('0x47')])[_0x9c4a('0x15')](function(_0x550eba){if(_0x550eba){if(_0x550eba[_0x9c4a('0x4b')]===_0x9c4a('0x4c')&&!_0x550eba[_0x9c4a('0x4d')]){var _0x4cc93c,_0x440c85,_0x1816c2;if(_0x12c276[_0x9c4a('0x47')]['to']){_0x440c85=_0x12c276[_0x9c4a('0x47')]['to']['split'](',')[0x0];}return db['MailAccount']['findOne']({'where':{'id':_0x550eba[_0x9c4a('0x4e')]},'include':[{'model':db[_0x9c4a('0x4f')],'as':_0x9c4a('0x50'),'include':[{'model':db['CmContact'],'as':_0x9c4a('0x51'),'where':{'email':_0x440c85},'limit':0x1,'order':[[_0x9c4a('0x52'),_0x9c4a('0x53')]]}]},{'model':db['MailServerOut'],'as':_0x9c4a('0x54'),'raw':!![],'include':[{'model':db[_0x9c4a('0x55')],'as':'CloudProvider','raw':!![]}]}]})[_0x9c4a('0x15')](function(_0x2d7ebb){_0x4cc93c=_0x2d7ebb;if(!_0x4cc93c||!_0x4cc93c[_0x9c4a('0x54')])return;var _0x21827f=_0x4cc93c['getSmtpOptions']();if(_0x12c276[_0x9c4a('0x47')]['attachments']&&_0x12c276[_0x9c4a('0x47')][_0x9c4a('0x56')][_0x9c4a('0x39')]){for(var _0x77de09=0x0;_0x77de09<_0x12c276[_0x9c4a('0x47')][_0x9c4a('0x56')]['length'];_0x77de09+=0x1){_0x12c276[_0x9c4a('0x47')][_0x9c4a('0x56')][_0x77de09]={'filename':_0x12c276[_0x9c4a('0x47')]['attachments'][_0x77de09][_0x9c4a('0x2d')],'path':path[_0x9c4a('0x57')](config['root'],_0x9c4a('0x58'),_0x12c276[_0x9c4a('0x47')][_0x9c4a('0x56')][_0x77de09]['basename'])};}}_0x1816c2={'account':_0x21827f,'message':_0x12c276['body']};return;})[_0x9c4a('0x15')](function(){if(_0x4cc93c['List']){if(_0x4cc93c['List']['Contacts']['length']){return _0x4cc93c[_0x9c4a('0x50')][_0x9c4a('0x51')][0x0];}else{return db[_0x9c4a('0x59')][_0x9c4a('0x4a')](_[_0x9c4a('0xc')](_0x12c276['body'],{'firstName':_0x12c276[_0x9c4a('0x47')]['to'],'email':_0x12c276[_0x9c4a('0x47')]['to'],'phone':_0x12c276['body']['to'],'ListId':_0x4cc93c[_0x9c4a('0x5a')]}));}}else{throw new Error(_0x9c4a('0x5b'));}})[_0x9c4a('0x15')](function(){if(_0x1816c2){return respondWithRpcPromise(_0x9c4a('0x5c'),'sendMail',_0x1816c2,client9003)[_0x9c4a('0x15')](function(_0x43ffb8){return _0x550eba[_0x9c4a('0x28')]({'read':!![],'messageId':_0x43ffb8[_0x9c4a('0x5d')],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')});})['catch'](function(_0x420a36){logger[_0x9c4a('0x1b')]('%s',JSON[_0x9c4a('0x1a')](_0x420a36));return _0x550eba;});}return _0x550eba;});}return _0x550eba;}})[_0x9c4a('0x15')](respondWithResult(_0x83da16,0xc9))[_0x9c4a('0x1f')](handleError(_0x83da16,null));};exports[_0x9c4a('0x5e')]=function(_0x4469ac,_0x317b6e){var _0x50d580={'agent':{},'channel':'mail'};if(_0x4469ac['body']['id']){delete _0x4469ac['body']['id'];}_0x4469ac[_0x9c4a('0x47')][_0x9c4a('0x5f')]=!![];_0x4469ac[_0x9c4a('0x47')][_0x9c4a('0x60')]=moment()['format'](_0x9c4a('0x61'));_0x4469ac[_0x9c4a('0x47')][_0x9c4a('0x62')]=_0x4469ac[_0x9c4a('0x47')][_0x9c4a('0x62')]||_0x4469ac[_0x9c4a('0x63')]['id'];_0x50d580[_0x9c4a('0x64')]['id']=_0x4469ac['body'][_0x9c4a('0x62')];return db[_0x9c4a('0x30')][_0x9c4a('0x48')]({'where':{'id':_0x4469ac[_0x9c4a('0x45')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x317b6e,null))[_0x9c4a('0x15')](saveUpdates(_0x4469ac[_0x9c4a('0x47')],null))['then'](function(_0x365db9){if(_0x365db9){_0x50d580['message']=_0x365db9[_0x9c4a('0x65')]({'plain':!![]});return db[_0x9c4a('0x66')][_0x9c4a('0x48')]({'where':{'id':_0x365db9[_0x9c4a('0x67')]}});}return null;})[_0x9c4a('0x15')](handleEntityNotFound(_0x317b6e,null))[_0x9c4a('0x15')](function(_0x16b2e7){if(_0x16b2e7){return _0x16b2e7[_0x9c4a('0x28')]({'UserId':_0x4469ac[_0x9c4a('0x47')]['UserId'],'read1stAt':_[_0x9c4a('0x68')](_0x16b2e7[_0x9c4a('0x69')])?moment()[_0x9c4a('0x6a')](_0x9c4a('0x61')):undefined});}return null;})[_0x9c4a('0x15')](function(_0x21bd28){if(_0x21bd28){_0x50d580[_0x9c4a('0x6b')]=_0x21bd28[_0x9c4a('0x65')]({'plain':!![]});interaction_log[_0x9c4a('0x16')]('[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4469ac[_0x9c4a('0x63')]['id'],_0x4469ac[_0x9c4a('0x63')]['name'],_0x4469ac[_0x9c4a('0x63')]['role'],_0x50d580[_0x9c4a('0x6b')]['id'],_0x4469ac[_0x9c4a('0x47')]?JSON[_0x9c4a('0x1a')](_0x4469ac[_0x9c4a('0x47')]):_0x9c4a('0x6c'));return respondWithRpcPromise('AcceptMessage',_0x9c4a('0x6d'),_0x50d580);}return null;})[_0x9c4a('0x15')](function(_0x2bbd91){var _0x4ceed2='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x2bbd91['message']['ContactId'];return db[_0x9c4a('0x6e')]['query'](_0x4ceed2,{'type':db[_0x9c4a('0x6f')][_0x9c4a('0x70')][_0x9c4a('0x71')],'raw':!![]})[_0x9c4a('0x15')](function(_0x4b9ec2){return _0x4b9ec2;});})[_0x9c4a('0x15')](function(_0x15d962){if(_0x15d962){_0x50d580[_0x9c4a('0x1d')][_0x9c4a('0x72')]=_0x15d962[0x0];if(!_0x4469ac[_0x9c4a('0x47')]['UserId'])return;return db[_0x9c4a('0x73')][_0x9c4a('0x48')]({'where':{'id':_0x4469ac['body'][_0x9c4a('0x62')],'role':_0x9c4a('0x64')},'attributes':['id','name',_0x9c4a('0x74'),'email',_0x9c4a('0x75')],'raw':!![]});}return null;})[_0x9c4a('0x15')](function(_0x2b399f){if(!_0x2b399f)return null;_0x50d580['message'][_0x9c4a('0x64')]=_0x2b399f;return _0x50d580;})[_0x9c4a('0x15')](function(_0x2fe60d){if(_0x2fe60d){if(_0x4469ac['body'][_0x9c4a('0x76')]){_0x50d580['message'][_0x9c4a('0x77')]=util[_0x9c4a('0x6a')]('SIP/%s',_0x4469ac[_0x9c4a('0x63')][_0x9c4a('0x2d')]);_0x50d580[_0x9c4a('0x1d')][_0x9c4a('0x78')]=_0x50d580[_0x9c4a('0x78')];_0x50d580[_0x9c4a('0x1d')][_0x9c4a('0x79')]=_0x50d580[_0x9c4a('0x78')];_0x50d580['message'][_0x9c4a('0x7a')]='accept';_0x50d580[_0x9c4a('0x1d')][_0x9c4a('0x47')]=htmlToText['fromString'](_0x50d580[_0x9c4a('0x1d')][_0x9c4a('0x47')]);return respondWithRpcPromise(_0x9c4a('0x7b'),_0x9c4a('0x7b'),{'event':_0x9c4a('0x7c'),'message':_0x50d580[_0x9c4a('0x1d')]},client9002)[_0x9c4a('0x15')](function(){return _0x50d580;});}return _0x50d580;}return null;})[_0x9c4a('0x15')](respondWithResult(_0x317b6e,null))[_0x9c4a('0x1f')](handleError(_0x317b6e,null));};exports['reject']=function(_0x4f2d79,_0x4d2e71){var _0x7b2fd0={'agent':{},'channel':'mail'};if(_0x4f2d79[_0x9c4a('0x47')]['id']){delete _0x4f2d79['body']['id'];}_0x4f2d79[_0x9c4a('0x47')][_0x9c4a('0x62')]=_0x4f2d79[_0x9c4a('0x47')]['UserId']||_0x4f2d79['user']['id'];_0x7b2fd0[_0x9c4a('0x64')]['id']=_0x4f2d79[_0x9c4a('0x47')][_0x9c4a('0x62')];return db[_0x9c4a('0x30')]['find']({'where':{'id':_0x4f2d79[_0x9c4a('0x45')]['id'],'UserId':null}})[_0x9c4a('0x15')](handleEntityNotFound(_0x4d2e71,null))[_0x9c4a('0x15')](function(_0x5df654){if(_0x5df654){_0x7b2fd0['message']=_0x5df654[_0x9c4a('0x65')]({'plain':!![]});return db[_0x9c4a('0x66')][_0x9c4a('0x48')]({'where':{'id':_0x5df654[_0x9c4a('0x67')]}});}return null;})[_0x9c4a('0x15')](handleEntityNotFound(_0x4d2e71,null))[_0x9c4a('0x15')](function(_0x1296db){if(_0x1296db){_0x7b2fd0[_0x9c4a('0x6b')]=_0x1296db['get']({'plain':!![]});interaction_log[_0x9c4a('0x16')](_0x9c4a('0x7d'),_0x4f2d79[_0x9c4a('0x63')]['id'],_0x4f2d79[_0x9c4a('0x63')][_0x9c4a('0x2d')],_0x4f2d79[_0x9c4a('0x63')][_0x9c4a('0x7e')],_0x7b2fd0[_0x9c4a('0x6b')]['id'],_0x4f2d79[_0x9c4a('0x47')]?JSON[_0x9c4a('0x1a')](_0x4f2d79['body']):_0x9c4a('0x6c'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0x7b2fd0);}return null;})[_0x9c4a('0x15')](function(_0x10c85d){var _0x8a2f97='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x10c85d[_0x9c4a('0x1d')][_0x9c4a('0x7f')];return db[_0x9c4a('0x6e')][_0x9c4a('0x34')](_0x8a2f97,{'type':db[_0x9c4a('0x6f')]['QueryTypes'][_0x9c4a('0x71')],'raw':!![]})[_0x9c4a('0x15')](function(_0x33949a){return _0x33949a;});})['then'](function(_0x1a33f5){if(_0x1a33f5){_0x7b2fd0[_0x9c4a('0x1d')][_0x9c4a('0x72')]=_0x1a33f5[0x0];if(!_0x4f2d79['body'][_0x9c4a('0x62')])return;return db[_0x9c4a('0x73')][_0x9c4a('0x48')]({'where':{'id':_0x4f2d79[_0x9c4a('0x47')][_0x9c4a('0x62')],'role':_0x9c4a('0x64')},'attributes':['id','name',_0x9c4a('0x74'),'email',_0x9c4a('0x75')],'raw':!![]});}return null;})[_0x9c4a('0x15')](function(_0x15910f){if(!_0x15910f)return null;_0x7b2fd0[_0x9c4a('0x1d')][_0x9c4a('0x64')]=_0x15910f;return _0x7b2fd0;})[_0x9c4a('0x15')](function(_0x4346ce){if(_0x4346ce){_0x4346ce[_0x9c4a('0x1d')][_0x9c4a('0x77')]=util[_0x9c4a('0x6a')](_0x9c4a('0x80'),_0x4f2d79['user'][_0x9c4a('0x2d')]);_0x4346ce['message']['channel']=_0x7b2fd0[_0x9c4a('0x78')];_0x4346ce[_0x9c4a('0x1d')][_0x9c4a('0x79')]=_0x7b2fd0['channel'];_0x4346ce[_0x9c4a('0x1d')][_0x9c4a('0x7a')]=_0x9c4a('0x81');_0x4346ce[_0x9c4a('0x1d')][_0x9c4a('0x47')]=htmlToText[_0x9c4a('0x82')](_0x7b2fd0[_0x9c4a('0x1d')][_0x9c4a('0x47')]);respondWithRpcPromise(_0x9c4a('0x7b'),_0x9c4a('0x7b'),{'event':_0x9c4a('0x83'),'message':_0x4346ce['message']},client9002);return _0x7b2fd0;}return null;})[_0x9c4a('0x15')](respondWithResult(_0x4d2e71,null))[_0x9c4a('0x1f')](handleError(_0x4d2e71,null));};exports[_0x9c4a('0x84')]=function(_0x4d7582,_0x1e4cd3){var _0x41f185=moment()['unix']()[_0x9c4a('0x85')]();var _0x50f1a8=path[_0x9c4a('0x57')](config['root'],_0x9c4a('0x86'),_0x9c4a('0x87'),_0x9c4a('0x88'));var _0x5b26af=path['join'](config[_0x9c4a('0x89')],_0x9c4a('0x86'),'files',_0x9c4a('0x56'));var _0x1a0524=util['format'](_0x9c4a('0x8a'),_0x41f185);return db[_0x9c4a('0x30')][_0x9c4a('0x48')]({'where':{'id':_0x4d7582['params']['id']},'attributes':['id',_0x9c4a('0x47'),'from','to','cc',_0x9c4a('0x8b'),_0x9c4a('0x8c'),_0x9c4a('0x8d')],'include':_0x4d7582[_0x9c4a('0x34')][_0x9c4a('0x56')]?[{'model':db[_0x9c4a('0x8e')],'as':_0x9c4a('0x8f')}]:undefined})['then'](handleEntityNotFound(_0x1e4cd3,null))['then'](function(_0x391929){if(_0x391929){var _0x268bb1=_0x391929;var _0x274560={'from':_0x268bb1[_0x9c4a('0x90')],'to':_0x268bb1['to'],'subject':_0x268bb1['subject'],'html':htmlEntities[_0x9c4a('0x91')](_0x268bb1[_0x9c4a('0x47')]),'headers':{'Date':moment(_0x268bb1[_0x9c4a('0x8d')])['format'](_0x9c4a('0x92'))},'attachments':[]};if(_0x391929['cc']){_0x274560['headers']['Cc']=_0x391929['cc'];}if(_0x391929[_0x9c4a('0x8b')]){_0x274560[_0x9c4a('0x93')]['Bcc']=_0x391929[_0x9c4a('0x8b')];}return new BPromise(function(_0x5bd55b,_0x568520){if(_0x391929[_0x9c4a('0x8f')]){for(var _0x273603=0x0;_0x273603<_0x391929[_0x9c4a('0x8f')][_0x9c4a('0x39')];_0x273603++){var _0x33aaa7=_0x391929[_0x9c4a('0x8f')][_0x273603];var _0x35cd80=path[_0x9c4a('0x57')](_0x5b26af,_0x33aaa7[_0x9c4a('0x94')]);if(fs['existsSync'](_0x35cd80)){_0x274560[_0x9c4a('0x56')]['push']({'name':_0x33aaa7[_0x9c4a('0x2d')],'contentType':_0x33aaa7[_0x9c4a('0x32')],'data':fs[_0x9c4a('0x95')](_0x35cd80)});}}}emlformat[_0x9c4a('0x96')](_0x274560,function(_0xd65240,_0x5b5ceb){if(_0xd65240)return _0x568520(_0xd65240);fs['writeFileSync'](path[_0x9c4a('0x57')](_0x50f1a8,_0x1a0524),_0x5b5ceb);return _0x5bd55b(_0x5b5ceb);});});}})[_0x9c4a('0x15')](function(_0x587006){if(_0x587006){return _0x1e4cd3[_0x9c4a('0x84')](path[_0x9c4a('0x57')](_0x50f1a8,_0x1a0524),_0x1a0524,function(_0x3aeeff){if(!_0x3aeeff)fs['unlinkSync'](path['join'](_0x50f1a8,_0x1a0524));});}})[_0x9c4a('0x1f')](handleError(_0x1e4cd3,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 710497c..d4c5560 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 _0x3b70=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailMessage','setMaxListeners','save'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x3b70,0x15b));var _0x03b7=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x3b70[_0x2dafbe];return _0x58a45a;};'use strict';var EventEmitter=require(_0x03b7('0x0'));var MailMessage=require(_0x03b7('0x1'))['db'][_0x03b7('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x03b7('0x3')](0x0);var events={'afterCreate':_0x03b7('0x4'),'afterUpdate':_0x03b7('0x5'),'afterDestroy':_0x03b7('0x6')};function emitEvent(_0xc53071){return function(_0x14dce0,_0x3f5b7d,_0x224faa){MailMessageEvents[_0x03b7('0x7')](_0xc53071+':'+_0x14dce0['id'],_0x14dce0);MailMessageEvents[_0x03b7('0x7')](_0xc53071,_0x14dce0);_0x224faa(null);};}for(var e in events){if(events[_0x03b7('0x8')](e)){var event=events[e];MailMessage[_0x03b7('0x9')](e,emitEvent(event));}}module[_0x03b7('0xa')]=MailMessageEvents; \ No newline at end of file +var _0x5079=['emit','hasOwnProperty','exports','events','setMaxListeners','save','update','remove'];(function(_0x2a2166,_0x3a077f){var _0x3bcf50=function(_0x3f0300){while(--_0x3f0300){_0x2a2166['push'](_0x2a2166['shift']());}};_0x3bcf50(++_0x3a077f);}(_0x5079,0xf3));var _0x9507=function(_0x2a2166,_0x3a077f){_0x2a2166=_0x2a2166-0x0;var _0x3bcf50=_0x5079[_0x2a2166];return _0x3bcf50;};'use strict';var EventEmitter=require(_0x9507('0x0'));var MailMessage=require('../../mysqldb')['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x9507('0x1')](0x0);var events={'afterCreate':_0x9507('0x2'),'afterUpdate':_0x9507('0x3'),'afterDestroy':_0x9507('0x4')};function emitEvent(_0x5d67b4){return function(_0x138492,_0x59da3d,_0x499936){MailMessageEvents[_0x9507('0x5')](_0x5d67b4+':'+_0x138492['id'],_0x138492);MailMessageEvents[_0x9507('0x5')](_0x5d67b4,_0x138492);_0x499936(null);};}for(var e in events){if(events[_0x9507('0x6')](e)){var event=events[e];MailMessage['hook'](e,emitEvent(event));}}module[_0x9507('0x7')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 76ca0fe..c8df3ac 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 _0x9a16=['toLowerCase','direction','out','secret','UserId','findOne','MailInteractionId','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./mailMessage.attributes','exports','MailMessage','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','fromString','body','get'];(function(_0x380e75,_0x486360){var _0x444d96=function(_0x32c8f8){while(--_0x32c8f8){_0x380e75['push'](_0x380e75['shift']());}};_0x444d96(++_0x486360);}(_0x9a16,0x71));var _0x69a1=function(_0x5dd61b,_0x4412dd){_0x5dd61b=_0x5dd61b-0x0;var _0x5e1b45=_0x9a16[_0x5dd61b];return _0x5e1b45;};'use strict';var _=require(_0x69a1('0x0'));var util=require(_0x69a1('0x1'));var logger=require(_0x69a1('0x2'))('api');var moment=require(_0x69a1('0x3'));var BPromise=require('bluebird');var rp=require(_0x69a1('0x4'));var htmlToText=require('html-to-text');var fs=require('fs');var path=require(_0x69a1('0x5'));var rimraf=require(_0x69a1('0x6'));var config=require(_0x69a1('0x7'));var attributes=require(_0x69a1('0x8'));module[_0x69a1('0x9')]=function(_0x153139,_0x17d25e){return _0x153139['define'](_0x69a1('0xa'),attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':_0x69a1('0xb'),'fields':[_0x69a1('0xb')]},{'name':_0x69a1('0xc'),'fields':[_0x69a1('0xd'),_0x69a1('0xe')],'type':_0x69a1('0xf')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x5a9cbb,_0xe4d103,_0x27dedf){if(_0x5a9cbb['body']){_0x5a9cbb[_0x69a1('0xd')]=htmlToText[_0x69a1('0x10')](_0x5a9cbb[_0x69a1('0x11')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x27dedf(null,_0xe4d103);},'afterCreate':function(_0x268e72,_0x55c1a3,_0x247718){var _0x226679=_0x153139['models'];var _0x35de3=_0x268e72[_0x69a1('0x12')]({'plain':!![]});if(_0x35de3['direction'][_0x69a1('0x13')]()==='in'||_0x35de3[_0x69a1('0x14')][_0x69a1('0x13')]()===_0x69a1('0x15')&&!_0x35de3[_0x69a1('0x16')]&&!_['isNil'](_0x35de3[_0x69a1('0x17')])){_0x226679['MailInteraction'][_0x69a1('0x18')]({'where':{'id':_0x35de3[_0x69a1('0x19')]}})[_0x69a1('0x1a')](function(_0x56bb0a){if(_0x56bb0a){_0x56bb0a[_0x69a1('0x1b')]({'lastMsgAt':_0x35de3[_0x69a1('0x1c')],'lastMsgDirection':_0x35de3[_0x69a1('0x14')][_0x69a1('0x13')]()});}})[_0x69a1('0x1d')](function(_0x502fd6){console[_0x69a1('0x1e')](_0x502fd6);});}_0x247718();}},'charset':_0x69a1('0x1f'),'collate':_0x69a1('0x20')});}; \ No newline at end of file +var _0x2498=['moment','bluebird','html-to-text','rimraf','./mailMessage.attributes','define','MailMessage','mail_messages','messageId','plainBody','subject','body','fromString','models','get','direction','toLowerCase','secret','UserId','MailInteraction','findOne','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api'];(function(_0x12aba8,_0x40a036){var _0x2aac66=function(_0x3e56b7){while(--_0x3e56b7){_0x12aba8['push'](_0x12aba8['shift']());}};_0x2aac66(++_0x40a036);}(_0x2498,0x13c));var _0x8249=function(_0x5ca104,_0x2b333b){_0x5ca104=_0x5ca104-0x0;var _0x1718b1=_0x2498[_0x5ca104];return _0x1718b1;};'use strict';var _=require(_0x8249('0x0'));var util=require(_0x8249('0x1'));var logger=require(_0x8249('0x2'))(_0x8249('0x3'));var moment=require(_0x8249('0x4'));var BPromise=require(_0x8249('0x5'));var rp=require('request-promise');var htmlToText=require(_0x8249('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8249('0x7'));var config=require('../../config/environment');var attributes=require(_0x8249('0x8'));module['exports']=function(_0x1fd645,_0x57761a){return _0x1fd645[_0x8249('0x9')](_0x8249('0xa'),attributes,{'tableName':_0x8249('0xb'),'paranoid':![],'indexes':[{'name':_0x8249('0xc'),'fields':[_0x8249('0xc')]},{'name':'fti_mail_messages','fields':[_0x8249('0xd'),_0x8249('0xe')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x40cbde,_0x19db5d,_0x1cdf4a){if(_0x40cbde[_0x8249('0xf')]){_0x40cbde[_0x8249('0xd')]=htmlToText[_0x8249('0x10')](_0x40cbde[_0x8249('0xf')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x1cdf4a(null,_0x19db5d);},'afterCreate':function(_0x205e1a,_0x27f837,_0x3eb564){var _0x2aebb8=_0x1fd645[_0x8249('0x11')];var _0x55959a=_0x205e1a[_0x8249('0x12')]({'plain':!![]});if(_0x55959a[_0x8249('0x13')]['toLowerCase']()==='in'||_0x55959a['direction'][_0x8249('0x14')]()==='out'&&!_0x55959a[_0x8249('0x15')]&&!_['isNil'](_0x55959a[_0x8249('0x16')])){_0x2aebb8[_0x8249('0x17')][_0x8249('0x18')]({'where':{'id':_0x55959a['MailInteractionId']}})[_0x8249('0x19')](function(_0x629d9d){if(_0x629d9d){_0x629d9d[_0x8249('0x1a')]({'lastMsgAt':_0x55959a[_0x8249('0x1b')],'lastMsgDirection':_0x55959a[_0x8249('0x13')]['toLowerCase']()});}})[_0x8249('0x1c')](function(_0x29538f){console[_0x8249('0x1d')](_0x29538f);});}_0x3eb564();}},'charset':_0x8249('0x1e'),'collate':_0x8249('0x1f')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 9bb936b..1eb6809 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 _0x1eba=['jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','then','info','request\x20sent','debug','error','MailMessage,\x20%s,\x20%s','message','result','catch','CreateMailMessage','MailMessage','body','options','raw','stringify','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x1eba,0x1d7));var _0xa1eb=function(_0x2b6600,_0x24c497){_0x2b6600=_0x2b6600-0x0;var _0x912ee2=_0x1eba[_0x2b6600];return _0x912ee2;};'use strict';var _=require(_0xa1eb('0x0'));var util=require(_0xa1eb('0x1'));var moment=require(_0xa1eb('0x2'));var BPromise=require(_0xa1eb('0x3'));var rs=require(_0xa1eb('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa1eb('0x5'));var logger=require(_0xa1eb('0x6'))(_0xa1eb('0x7'));var config=require(_0xa1eb('0x8'));var jayson=require(_0xa1eb('0x9'));var client=jayson[_0xa1eb('0xa')][_0xa1eb('0xb')]({'port':0x232a});config[_0xa1eb('0xc')]=_[_0xa1eb('0xd')](config[_0xa1eb('0xc')],{'host':_0xa1eb('0xe'),'port':0x18eb});var socket=require(_0xa1eb('0xf'))(new Redis(config['redis']));require(_0xa1eb('0x10'))['register'](socket);function respondWithRpcPromise(_0x219802,_0x54cdad,_0x3f53ff){return new BPromise(function(_0x5d7101,_0x41a7bc){return client['request'](_0x219802,_0x3f53ff)[_0xa1eb('0x11')](function(_0x325d13){logger[_0xa1eb('0x12')]('MailMessage,\x20%s,\x20%s',_0x54cdad,_0xa1eb('0x13'));logger[_0xa1eb('0x14')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x54cdad,_0xa1eb('0x13'),JSON['stringify'](_0x325d13));if(_0x325d13['error']){if(_0x325d13[_0xa1eb('0x15')]['code']===0x1f4){logger[_0xa1eb('0x15')](_0xa1eb('0x16'),_0x54cdad,_0x325d13[_0xa1eb('0x15')][_0xa1eb('0x17')]);return _0x41a7bc(_0x325d13[_0xa1eb('0x15')][_0xa1eb('0x17')]);}logger[_0xa1eb('0x15')](_0xa1eb('0x16'),_0x54cdad,_0x325d13[_0xa1eb('0x15')]['message']);return _0x5d7101(_0x325d13[_0xa1eb('0x15')]['message']);}else{logger[_0xa1eb('0x12')](_0xa1eb('0x16'),_0x54cdad,_0xa1eb('0x13'));_0x5d7101(_0x325d13[_0xa1eb('0x18')]['message']);}})[_0xa1eb('0x19')](function(_0x22cd44){logger[_0xa1eb('0x15')](_0xa1eb('0x16'),_0x54cdad,_0x22cd44);_0x41a7bc(_0x22cd44);});});}exports[_0xa1eb('0x1a')]=function(_0x3b8607){var _0x2143e6=this;return new Promise(function(_0x166f7f,_0x4fc14a){return db[_0xa1eb('0x1b')]['create'](_0x3b8607[_0xa1eb('0x1c')],{'raw':_0x3b8607[_0xa1eb('0x1d')]?_0x3b8607[_0xa1eb('0x1d')][_0xa1eb('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x539634){logger[_0xa1eb('0x12')](_0xa1eb('0x1a'),_0x3b8607);logger['debug'](_0xa1eb('0x1a'),_0x3b8607,JSON[_0xa1eb('0x1f')](_0x539634));_0x166f7f(_0x539634);})[_0xa1eb('0x19')](function(_0xa6b20c){logger[_0xa1eb('0x15')](_0xa1eb('0x1a'),_0xa6b20c[_0xa1eb('0x17')],_0x3b8607);_0x4fc14a(_0x2143e6[_0xa1eb('0x15')](0x1f4,_0xa6b20c[_0xa1eb('0x17')]));});});}; \ No newline at end of file +var _0x36ee=['catch','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./mailMessage.socket','register','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CreateMailMessage','MailMessage','create','body','options','debug'];(function(_0x5a0a64,_0x5c418d){var _0x35d769=function(_0x9bec5e){while(--_0x9bec5e){_0x5a0a64['push'](_0x5a0a64['shift']());}};_0x35d769(++_0x5c418d);}(_0x36ee,0xe8));var _0xe36e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x36ee[_0x1facfa];return _0x9ec701;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe36e('0x0'));var BPromise=require('bluebird');var rs=require(_0xe36e('0x1'));var fs=require('fs');var Redis=require(_0xe36e('0x2'));var db=require(_0xe36e('0x3'))['db'];var utils=require(_0xe36e('0x4'));var logger=require(_0xe36e('0x5'))(_0xe36e('0x6'));var config=require(_0xe36e('0x7'));var jayson=require(_0xe36e('0x8'));var client=jayson[_0xe36e('0x9')][_0xe36e('0xa')]({'port':0x232a});config[_0xe36e('0xb')]=_[_0xe36e('0xc')](config['redis'],{'host':_0xe36e('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe36e('0xb')]));require(_0xe36e('0xe'))[_0xe36e('0xf')](socket);function respondWithRpcPromise(_0x47ce3a,_0xf119e4,_0x48981b){return new BPromise(function(_0x2e968d,_0x2133cf){return client[_0xe36e('0x10')](_0x47ce3a,_0x48981b)[_0xe36e('0x11')](function(_0xce0110){logger[_0xe36e('0x12')](_0xe36e('0x13'),_0xf119e4,_0xe36e('0x14'));logger['debug'](_0xe36e('0x15'),_0xf119e4,_0xe36e('0x14'),JSON[_0xe36e('0x16')](_0xce0110));if(_0xce0110[_0xe36e('0x17')]){if(_0xce0110['error'][_0xe36e('0x18')]===0x1f4){logger['error']('MailMessage,\x20%s,\x20%s',_0xf119e4,_0xce0110[_0xe36e('0x17')][_0xe36e('0x19')]);return _0x2133cf(_0xce0110[_0xe36e('0x17')][_0xe36e('0x19')]);}logger[_0xe36e('0x17')](_0xe36e('0x13'),_0xf119e4,_0xce0110[_0xe36e('0x17')][_0xe36e('0x19')]);return _0x2e968d(_0xce0110[_0xe36e('0x17')][_0xe36e('0x19')]);}else{logger['info'](_0xe36e('0x13'),_0xf119e4,_0xe36e('0x14'));_0x2e968d(_0xce0110['result'][_0xe36e('0x19')]);}})['catch'](function(_0x471400){logger[_0xe36e('0x17')]('MailMessage,\x20%s,\x20%s',_0xf119e4,_0x471400);_0x2133cf(_0x471400);});});}exports[_0xe36e('0x1a')]=function(_0x6aa186){var _0x21efe7=this;return new Promise(function(_0x597331,_0x21e95e){return db[_0xe36e('0x1b')][_0xe36e('0x1c')](_0x6aa186[_0xe36e('0x1d')],{'raw':_0x6aa186[_0xe36e('0x1e')]?_0x6aa186[_0xe36e('0x1e')]['raw']===undefined?!![]:![]:!![]})[_0xe36e('0x11')](function(_0x4f214a){logger[_0xe36e('0x12')](_0xe36e('0x1a'),_0x6aa186);logger[_0xe36e('0x1f')]('CreateMailMessage',_0x6aa186,JSON['stringify'](_0x4f214a));_0x597331(_0x4f214a);})[_0xe36e('0x20')](function(_0x10818d){logger[_0xe36e('0x17')](_0xe36e('0x1a'),_0x10818d[_0xe36e('0x19')],_0x6aa186);_0x21e95e(_0x21efe7[_0xe36e('0x17')](0x1f4,_0x10818d[_0xe36e('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index b1ac765..7b85905 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 _0xcd53=['length','mailMessage:','remove','update','emit','removeListener','register'];(function(_0x494966,_0x26f1d1){var _0x1f3806=function(_0x2dc327){while(--_0x2dc327){_0x494966['push'](_0x494966['shift']());}};_0x1f3806(++_0x26f1d1);}(_0xcd53,0x8e));var _0x3cd5=function(_0x1ca4c3,_0x554126){_0x1ca4c3=_0x1ca4c3-0x0;var _0x4426a6=_0xcd53[_0x1ca4c3];return _0x4426a6;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=['save',_0x3cd5('0x0'),_0x3cd5('0x1')];function createListener(_0x15f570,_0x2d9674){return function(_0x5f574d){_0x2d9674[_0x3cd5('0x2')](_0x15f570,_0x5f574d);};}function removeListener(_0xf64fcd,_0x7e3afd){return function(){MailMessageEvents[_0x3cd5('0x3')](_0xf64fcd,_0x7e3afd);};}exports[_0x3cd5('0x4')]=function(_0x138ade){for(var _0x530022=0x0,_0xd2196f=events[_0x3cd5('0x5')];_0x530022<_0xd2196f;_0x530022++){var _0x426cd0=events[_0x530022];var _0x46f29e=createListener(_0x3cd5('0x6')+_0x426cd0,_0x138ade);MailMessageEvents['on'](_0x426cd0,_0x46f29e);}}; \ No newline at end of file +var _0x5379=['mailMessage:','./mailMessage.events','emit','removeListener','register','length'];(function(_0x1681f0,_0x1d3c06){var _0x492ab4=function(_0x4740ba){while(--_0x4740ba){_0x1681f0['push'](_0x1681f0['shift']());}};_0x492ab4(++_0x1d3c06);}(_0x5379,0x85));var _0x9537=function(_0x11cc9a,_0x37226f){_0x11cc9a=_0x11cc9a-0x0;var _0x27ffeb=_0x5379[_0x11cc9a];return _0x27ffeb;};'use strict';var MailMessageEvents=require(_0x9537('0x0'));var events=['save','remove','update'];function createListener(_0x149bd5,_0x2aa8b4){return function(_0x2e8041){_0x2aa8b4[_0x9537('0x1')](_0x149bd5,_0x2e8041);};}function removeListener(_0xd1ac66,_0x37090e){return function(){MailMessageEvents[_0x9537('0x2')](_0xd1ac66,_0x37090e);};}exports[_0x9537('0x3')]=function(_0x7a3337){for(var _0x24fc44=0x0,_0x323b3a=events[_0x9537('0x4')];_0x24fc44<_0x323b3a;_0x24fc44++){var _0x1d7e40=events[_0x24fc44];var _0x5a27b3=createListener(_0x9537('0x5')+_0x1d7e40,_0x7a3337);MailMessageEvents['on'](_0x1d7e40,_0x5a27b3);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 6af0eb1..22ec9c4 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 _0x4716=['exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show','/:id/members','getMembers','getTeams','/:id/users','/:id/teams','post','addAgents','put','update','delete','removeTeams','removeAgents'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4716,0x135));var _0x6471=function(_0x3f5a71,_0x279f1d){_0x3f5a71=_0x3f5a71-0x0;var _0x1792dc=_0x4716[_0x3f5a71];return _0x1792dc;};'use strict';var multer=require(_0x6471('0x0'));var util=require('util');var path=require(_0x6471('0x1'));var timeout=require(_0x6471('0x2'));var express=require(_0x6471('0x3'));var router=express[_0x6471('0x4')]();var fs_extra=require(_0x6471('0x5'));var auth=require(_0x6471('0x6'));var interaction=require(_0x6471('0x7'));var config=require(_0x6471('0x8'));var controller=require('./mailQueue.controller');router[_0x6471('0x9')]('/',auth[_0x6471('0xa')](),controller[_0x6471('0xb')]);router[_0x6471('0x9')](_0x6471('0xc'),auth[_0x6471('0xa')](),controller['describe']);router[_0x6471('0x9')](_0x6471('0xd'),auth[_0x6471('0xa')](),controller[_0x6471('0xe')]);router['get'](_0x6471('0xf'),auth[_0x6471('0xa')](),controller[_0x6471('0x10')]);router[_0x6471('0x9')]('/:id/teams',auth[_0x6471('0xa')](),controller[_0x6471('0x11')]);router[_0x6471('0x9')](_0x6471('0x12'),auth[_0x6471('0xa')](),controller['getAgents']);router['post']('/',auth[_0x6471('0xa')](),controller['create']);router['post'](_0x6471('0x13'),auth[_0x6471('0xa')](),controller['addTeams']);router[_0x6471('0x14')](_0x6471('0x12'),auth['isAuthenticated'](),controller[_0x6471('0x15')]);router[_0x6471('0x16')](_0x6471('0xd'),auth[_0x6471('0xa')](),controller[_0x6471('0x17')]);router['delete'](_0x6471('0xd'),auth[_0x6471('0xa')](),controller['destroy']);router[_0x6471('0x18')]('/:id/teams',auth[_0x6471('0xa')](),controller[_0x6471('0x19')]);router[_0x6471('0x18')](_0x6471('0x12'),auth[_0x6471('0xa')](),controller[_0x6471('0x1a')]);module[_0x6471('0x1b')]=router; \ No newline at end of file +var _0x466c=['util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','isAuthenticated','index','get','describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','removeAgents','exports','multer'];(function(_0x5a8608,_0x318f93){var _0x25ddc9=function(_0x962504){while(--_0x962504){_0x5a8608['push'](_0x5a8608['shift']());}};_0x25ddc9(++_0x318f93);}(_0x466c,0xe7));var _0xc466=function(_0x4fb34f,_0x1a95cf){_0x4fb34f=_0x4fb34f-0x0;var _0x1d4726=_0x466c[_0x4fb34f];return _0x1d4726;};'use strict';var multer=require(_0xc466('0x0'));var util=require(_0xc466('0x1'));var path=require(_0xc466('0x2'));var timeout=require('connect-timeout');var express=require(_0xc466('0x3'));var router=express[_0xc466('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xc466('0x5'));var interaction=require(_0xc466('0x6'));var config=require(_0xc466('0x7'));var controller=require(_0xc466('0x8'));router['get']('/',auth[_0xc466('0x9')](),controller[_0xc466('0xa')]);router[_0xc466('0xb')]('/describe',auth[_0xc466('0x9')](),controller[_0xc466('0xc')]);router[_0xc466('0xb')](_0xc466('0xd'),auth[_0xc466('0x9')](),controller[_0xc466('0xe')]);router[_0xc466('0xb')](_0xc466('0xf'),auth[_0xc466('0x9')](),controller['getMembers']);router[_0xc466('0xb')](_0xc466('0x10'),auth[_0xc466('0x9')](),controller[_0xc466('0x11')]);router[_0xc466('0xb')](_0xc466('0x12'),auth[_0xc466('0x9')](),controller[_0xc466('0x13')]);router[_0xc466('0x14')]('/',auth[_0xc466('0x9')](),controller[_0xc466('0x15')]);router[_0xc466('0x14')](_0xc466('0x10'),auth[_0xc466('0x9')](),controller[_0xc466('0x16')]);router['post'](_0xc466('0x12'),auth[_0xc466('0x9')](),controller[_0xc466('0x17')]);router[_0xc466('0x18')](_0xc466('0xd'),auth[_0xc466('0x9')](),controller[_0xc466('0x19')]);router[_0xc466('0x1a')]('/:id',auth[_0xc466('0x9')](),controller['destroy']);router[_0xc466('0x1a')]('/:id/teams',auth[_0xc466('0x9')](),controller['removeTeams']);router[_0xc466('0x1a')]('/:id/users',auth[_0xc466('0x9')](),controller[_0xc466('0x1b')]);module[_0xc466('0x1c')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 4b64d35..6f14069 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 _0x82f7=['sequelize','exports','STRING','name','ENUM','rrmemory','beepall'];(function(_0x4bb427,_0x295739){var _0x3f7dc7=function(_0x2276a0){while(--_0x2276a0){_0x4bb427['push'](_0x4bb427['shift']());}};_0x3f7dc7(++_0x295739);}(_0x82f7,0x157));var _0x782f=function(_0x37cb11,_0x4c1a7c){_0x37cb11=_0x37cb11-0x0;var _0x28da03=_0x82f7[_0x37cb11];return _0x28da03;};'use strict';var Sequelize=require(_0x782f('0x0'));module[_0x782f('0x1')]={'name':{'type':Sequelize[_0x782f('0x2')],'unique':_0x782f('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x782f('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x782f('0x4')](_0x782f('0x5'),_0x782f('0x6'),'roundrobin')}}; \ No newline at end of file +var _0x92c4=['roundrobin','sequelize','exports','STRING','name','rrmemory','beepall'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x92c4,0x1c8));var _0x492c=function(_0x3f38e5,_0x5b6733){_0x3f38e5=_0x3f38e5-0x0;var _0x4724ab=_0x92c4[_0x3f38e5];return _0x4724ab;};'use strict';var Sequelize=require(_0x492c('0x0'));module[_0x492c('0x1')]={'name':{'type':Sequelize[_0x492c('0x2')],'unique':_0x492c('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x492c('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x492c('0x4'),_0x492c('0x5'),_0x492c('0x6'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 0f047b4..68f18a5 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 _0x621b=['status','end','undefined','limit','count','offset','set','Content-Range','json','update','destroy','then','get','MailQueues','UserProfileResource','error','stack','name','index','map','type','getOptions','where','MailQueue','include','query','findAll','catch','show','params','model','keys','rawAttributes','filters','intersection','fields','attributes','includeAll','merge','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','length','order','sort','filter','UserMailQueue','User','UserId','agent','mailPause','updatedAt','createdAt','rows','format','SIP','getTeams','nolimit','addTeams','ids','Team','Agents','online','interface','flatMap','transaction','findOrCreate','forEach','emit','userMailQueue:save','removeTeams','select','field','tq.TeamId','team_has_mail_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','sequelize','QueryTypes','every','includes','union','compact','isEmpty','removeAgents','userMailQueue:remove','addAgents','omit','spread','isArray','findOne','pick','hasOwnProperty','getAgents','bluebird','lodash','squel','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./mailQueue.socket','sendStatus'];(function(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0x621b,0x155));var _0xb621=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0x621b[_0x5f3f88];return _0xd08119;};'use strict';var BPromise=require(_0xb621('0x0'));var util=require('util');var _=require(_0xb621('0x1'));var squel=require(_0xb621('0x2'));var Redis=require(_0xb621('0x3'));var qs=require('../../components/parsers/qs');var logger=require(_0xb621('0x4'))(_0xb621('0x5'));var config=require(_0xb621('0x6'));var db=require(_0xb621('0x7'))['db'];config[_0xb621('0x8')]=_[_0xb621('0x9')](config['redis'],{'host':_0xb621('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb621('0x8')]));require(_0xb621('0xb'))['register'](socket);function respondWithStatusCode(_0x3ce872,_0x1cb539){_0x1cb539=_0x1cb539||0xcc;return function(_0x1421e7){if(_0x1421e7){return _0x3ce872[_0xb621('0xc')](_0x1cb539);}return _0x3ce872[_0xb621('0xd')](_0x1cb539)[_0xb621('0xe')]();};}function respondWithResult(_0x1cba07,_0x1a4502){_0x1a4502=_0x1a4502||0xc8;return function(_0x2d5158){if(_0x2d5158){return _0x1cba07[_0xb621('0xd')](_0x1a4502)['json'](_0x2d5158);}};}function respondWithFilteredResult(_0x32fdac,_0x5ee652){return function(_0x4d315f){if(_0x4d315f){var _0x42fc05=typeof _0x5ee652['offset']===_0xb621('0xf')&&typeof _0x5ee652[_0xb621('0x10')]===_0xb621('0xf');var _0x4c2fa9=_0x4d315f[_0xb621('0x11')];var _0x24b506=_0x42fc05?0x0:_0x5ee652['offset'];var _0x27ad13=_0x42fc05?_0x4d315f['count']:_0x5ee652[_0xb621('0x12')]+_0x5ee652[_0xb621('0x10')];var _0x46ed68;if(_0x27ad13>=_0x4c2fa9){_0x27ad13=_0x4c2fa9;_0x46ed68=0xc8;}else{_0x46ed68=0xce;}_0x32fdac[_0xb621('0xd')](_0x46ed68);return _0x32fdac[_0xb621('0x13')](_0xb621('0x14'),_0x24b506+'-'+_0x27ad13+'/'+_0x4c2fa9)[_0xb621('0x15')](_0x4d315f);}return null;};}function saveUpdates(_0x4c678c){return function(_0x5d9719){if(_0x5d9719){return _0x5d9719[_0xb621('0x16')](_0x4c678c)['then'](function(_0x5c1f41){return _0x5c1f41;});}return null;};}function removeEntity(_0x443fa0){return function(_0x177772){if(_0x177772){return _0x177772[_0xb621('0x17')]()[_0xb621('0x18')](function(){var _0x551fba=_0x177772[_0xb621('0x19')]({'plain':!![]});var _0x375471=_0xb621('0x1a');return db[_0xb621('0x1b')]['destroy']({'where':{'type':_0x375471,'resourceId':_0x551fba['id']}})['then'](function(){return _0x177772;});})[_0xb621('0x18')](function(){_0x443fa0[_0xb621('0xd')](0xcc)[_0xb621('0xe')]();});}};}function handleEntityNotFound(_0x42790d){return function(_0x1ed2df){if(!_0x1ed2df){_0x42790d['sendStatus'](0x194);}return _0x1ed2df;};}function handleError(_0x1cda59,_0x4324ab){_0x4324ab=_0x4324ab||0x1f4;return function(_0xfdb4b7){logger[_0xb621('0x1c')](_0xfdb4b7[_0xb621('0x1d')]);if(_0xfdb4b7['name']){delete _0xfdb4b7[_0xb621('0x1e')];}_0x1cda59['status'](_0x4324ab)['send'](_0xfdb4b7);};}exports[_0xb621('0x1f')]=function(_0x1da8d0,_0x18c03f){var _0x4898fc={};var _0x15746b={'count':0x0,'rows':[]};var _0x1b811d=_[_0xb621('0x20')](db['MailQueue']['rawAttributes'],function(_0x148958){return{'name':_0x148958['fieldName'],'type':_0x148958[_0xb621('0x21')]['key']};});_0x4898fc=qs[_0xb621('0x22')](_0x1b811d,_0x1da8d0);var _0x1e6567={'where':_0x4898fc[_0xb621('0x23')]};return db[_0xb621('0x24')][_0xb621('0x11')](_0x1e6567)[_0xb621('0x18')](function(_0x314a98){_0x15746b[_0xb621('0x11')]=_0x314a98;_0x4898fc[_0xb621('0x25')]=qs[_0xb621('0x25')](_0x1da8d0[_0xb621('0x26')]);return db['MailQueue'][_0xb621('0x27')](_0x4898fc);})[_0xb621('0x18')](function(_0x1b4a2c){_0x15746b['rows']=_0x1b4a2c;return _0x15746b;})['then'](respondWithFilteredResult(_0x18c03f,_0x4898fc))[_0xb621('0x28')](handleError(_0x18c03f,null));};exports[_0xb621('0x29')]=function(_0x235f37,_0xa6cd49){var _0x22f26f={'raw':!![],'where':{'id':_0x235f37[_0xb621('0x2a')]['id']}},_0x5c9682={};_0x5c9682[_0xb621('0x2b')]=_[_0xb621('0x2c')](db[_0xb621('0x24')][_0xb621('0x2d')]);_0x5c9682[_0xb621('0x26')]=_[_0xb621('0x2c')](_0x235f37[_0xb621('0x26')]);_0x5c9682[_0xb621('0x2e')]=_[_0xb621('0x2f')](_0x5c9682[_0xb621('0x2b')],_0x5c9682['query']);_0x22f26f['attributes']=_[_0xb621('0x2f')](_0x5c9682[_0xb621('0x2b')],qs[_0xb621('0x30')](_0x235f37[_0xb621('0x26')][_0xb621('0x30')]));_0x22f26f[_0xb621('0x31')]=_0x22f26f[_0xb621('0x31')]['length']?_0x22f26f[_0xb621('0x31')]:_0x5c9682[_0xb621('0x2b')];if(_0x235f37['query'][_0xb621('0x32')]){_0x22f26f[_0xb621('0x25')]=[{'all':!![]}];}_0x22f26f=_[_0xb621('0x33')]({},_0x22f26f,_0x235f37[_0xb621('0x34')]);return db[_0xb621('0x24')][_0xb621('0x35')](_0x22f26f)['then'](handleEntityNotFound(_0xa6cd49,null))[_0xb621('0x18')](respondWithResult(_0xa6cd49,null))[_0xb621('0x28')](handleError(_0xa6cd49,null));};exports[_0xb621('0x36')]=function(_0x3f374e,_0x1724ce){return db[_0xb621('0x24')][_0xb621('0x36')](_0x3f374e[_0xb621('0x37')],{})[_0xb621('0x18')](function(_0x4febff){var _0x7807b9=_0x3f374e[_0xb621('0x38')]['get']({'plain':!![]});if(!_0x7807b9)throw new Error(_0xb621('0x39'));if(_0x7807b9[_0xb621('0x3a')]===_0xb621('0x38')){var _0x34bad1=_0x4febff[_0xb621('0x19')]({'plain':!![]});var _0x3e0258=_0xb621('0x1a');return db[_0xb621('0x3b')][_0xb621('0x35')]({'where':{'name':_0x3e0258,'userProfileId':_0x7807b9[_0xb621('0x3c')]},'raw':!![]})[_0xb621('0x18')](function(_0x34e70b){if(_0x34e70b&&_0x34e70b['autoAssociation']===0x0){return db[_0xb621('0x1b')][_0xb621('0x36')]({'name':_0x34bad1['name'],'resourceId':_0x34bad1['id'],'type':_0x34e70b['name'],'sectionId':_0x34e70b['id']},{})[_0xb621('0x18')](function(){return _0x4febff;});}else{return _0x4febff;}})['catch'](function(_0x1bffef){logger[_0xb621('0x1c')](_0xb621('0x3d'),_0x1bffef);throw _0x1bffef;});}return _0x4febff;})[_0xb621('0x18')](respondWithResult(_0x1724ce,0xc9))['catch'](handleError(_0x1724ce,null));};exports[_0xb621('0x16')]=function(_0x2643d1,_0x3be4b0){if(_0x2643d1[_0xb621('0x37')]['id']){delete _0x2643d1[_0xb621('0x37')]['id'];}return db['MailQueue'][_0xb621('0x35')]({'where':{'id':_0x2643d1[_0xb621('0x2a')]['id']}})[_0xb621('0x18')](handleEntityNotFound(_0x3be4b0,null))[_0xb621('0x18')](saveUpdates(_0x2643d1[_0xb621('0x37')],null))['then'](respondWithResult(_0x3be4b0,null))[_0xb621('0x28')](handleError(_0x3be4b0,null));};exports[_0xb621('0x17')]=function(_0x4b662b,_0x421295){return db[_0xb621('0x24')][_0xb621('0x35')]({'where':{'id':_0x4b662b[_0xb621('0x2a')]['id']}})[_0xb621('0x18')](handleEntityNotFound(_0x421295,null))[_0xb621('0x18')](removeEntity(_0x421295,null))[_0xb621('0x28')](handleError(_0x421295,null));};exports[_0xb621('0x3e')]=function(_0x3d51c8,_0xf5d5a0){return db[_0xb621('0x24')][_0xb621('0x3e')]()[_0xb621('0x18')](respondWithResult(_0xf5d5a0,null))['catch'](handleError(_0xf5d5a0,null));};exports['getMembers']=function(_0x585787,_0x6f5676){var _0x20174b={'raw':!![],'where':{}},_0x175f9c={},_0x1a843e;return db[_0xb621('0x24')]['findOne']({'where':{'id':_0x585787['params']['id']}})['then'](handleEntityNotFound(_0x6f5676,null))[_0xb621('0x18')](function(_0x30768f){if(_0x30768f){_0x1a843e=_0x30768f['get']({'plain':!![]});_0x175f9c[_0xb621('0x2b')]=_[_0xb621('0x2c')](db['UserMailQueue'][_0xb621('0x2d')]);_0x175f9c[_0xb621('0x26')]=_[_0xb621('0x2c')](_0x585787['query']);_0x175f9c[_0xb621('0x2e')]=_['intersection'](_0x175f9c['model'],_0x175f9c[_0xb621('0x26')]);_0x20174b['attributes']=_[_0xb621('0x2f')](_0x175f9c['model'],qs[_0xb621('0x30')](_0x585787['query'][_0xb621('0x30')]));_0x20174b['attributes']=_0x20174b[_0xb621('0x31')][_0xb621('0x3f')]?_0x20174b[_0xb621('0x31')]:_0x175f9c['model'];if(!_0x585787['query']['hasOwnProperty']('nolimit')){_0x20174b[_0xb621('0x10')]=qs[_0xb621('0x10')](_0x585787['query'][_0xb621('0x10')]);_0x20174b['offset']=qs[_0xb621('0x12')](_0x585787[_0xb621('0x26')][_0xb621('0x12')]);}_0x20174b[_0xb621('0x40')]=qs['sort'](_0x585787[_0xb621('0x26')][_0xb621('0x41')]);_0x20174b[_0xb621('0x23')]=qs[_0xb621('0x2e')](_['pick'](_0x585787['query'],_0x175f9c[_0xb621('0x2e')]));_0x20174b['where']['MailQueueId']=_0x30768f['id'];if(_0x585787[_0xb621('0x26')][_0xb621('0x42')]){_0x20174b[_0xb621('0x23')]=_[_0xb621('0x33')](_0x20174b['where'],{'$or':_[_0xb621('0x20')](_0x20174b['attributes'],function(_0x2b1101){var _0x443262={};_0x443262[_0x2b1101]={'$like':'%'+_0x585787[_0xb621('0x26')][_0xb621('0x42')]+'%'};return _0x443262;})});}_0x20174b=_[_0xb621('0x33')]({},_0x20174b,_0x585787[_0xb621('0x34')]);return db[_0xb621('0x43')][_0xb621('0x27')](_0x20174b);}})[_0xb621('0x18')](function(_0x1b1b60){if(_0x1b1b60){return db[_0xb621('0x44')]['findAndCountAll']({'where':{'id':_[_0xb621('0x20')](_0x1b1b60,_0xb621('0x45')),'role':_0xb621('0x46')},'attributes':['id',_0xb621('0x1e'),_0xb621('0x47'),_0xb621('0x48'),_0xb621('0x49')]});}})['then'](function(_0x96244e){if(_0x96244e){return{'count':_0x96244e[_0xb621('0x11')],'rows':_[_0xb621('0x20')](_0x96244e[_0xb621('0x4a')],function(_0x4848ac){return{'membername':_0x4848ac['name'],'UserId':_0x4848ac['id'],'queue_name':_0x1a843e[_0xb621('0x1e')],'MailQueueId':_0x1a843e['id'],'interface':util[_0xb621('0x4b')]('%s/%s',_0xb621('0x4c'),_0x4848ac[_0xb621('0x1e')]),'penalty':0x0,'paused':_0x4848ac[_0xb621('0x47')],'createdAt':_0x4848ac['createdAt'],'updatedAt':_0x4848ac[_0xb621('0x48')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xb621('0x18')](respondWithFilteredResult(_0x6f5676,_0x20174b))[_0xb621('0x28')](handleError(_0x6f5676,null));};exports[_0xb621('0x4d')]=function(_0x5b7ef8,_0x149168){var _0x2d7ccc={};var _0x524759={};var _0x21bcd9;var _0x5a5c29;return db[_0xb621('0x24')]['findOne']({'where':{'id':_0x5b7ef8[_0xb621('0x2a')]['id']}})[_0xb621('0x18')](handleEntityNotFound(_0x149168,null))['then'](function(_0x31de11){if(_0x31de11){_0x21bcd9=_0x31de11;_0x524759[_0xb621('0x2b')]=_['keys'](db['Team']['rawAttributes']);_0x524759[_0xb621('0x26')]=_[_0xb621('0x2c')](_0x5b7ef8[_0xb621('0x26')]);_0x524759['filters']=_[_0xb621('0x2f')](_0x524759[_0xb621('0x2b')],_0x524759['query']);_0x2d7ccc[_0xb621('0x31')]=_[_0xb621('0x2f')](_0x524759[_0xb621('0x2b')],qs[_0xb621('0x30')](_0x5b7ef8[_0xb621('0x26')][_0xb621('0x30')]));_0x2d7ccc[_0xb621('0x31')]=_0x2d7ccc[_0xb621('0x31')][_0xb621('0x3f')]?_0x2d7ccc[_0xb621('0x31')]:_0x524759[_0xb621('0x2b')];_0x2d7ccc['order']=qs[_0xb621('0x41')](_0x5b7ef8[_0xb621('0x26')][_0xb621('0x41')]);_0x2d7ccc[_0xb621('0x23')]=qs[_0xb621('0x2e')](_['pick'](_0x5b7ef8[_0xb621('0x26')],_0x524759[_0xb621('0x2e')]));if(_0x5b7ef8[_0xb621('0x26')]['filter']){_0x2d7ccc[_0xb621('0x23')]=_['merge'](_0x2d7ccc[_0xb621('0x23')],{'$or':_[_0xb621('0x20')](_0x2d7ccc[_0xb621('0x31')],function(_0x2d668b){var _0xb98b58={};_0xb98b58[_0x2d668b]={'$like':'%'+_0x5b7ef8[_0xb621('0x26')][_0xb621('0x42')]+'%'};return _0xb98b58;})});}_0x2d7ccc=_[_0xb621('0x33')]({},_0x2d7ccc,_0x5b7ef8[_0xb621('0x34')]);return _0x21bcd9['getTeams'](_0x2d7ccc);}})[_0xb621('0x18')](function(_0x238ec4){if(_0x238ec4){_0x5a5c29=_0x238ec4[_0xb621('0x3f')];if(!_0x5b7ef8[_0xb621('0x26')]['hasOwnProperty'](_0xb621('0x4e'))){_0x2d7ccc['limit']=qs[_0xb621('0x10')](_0x5b7ef8[_0xb621('0x26')][_0xb621('0x10')]);_0x2d7ccc[_0xb621('0x12')]=qs[_0xb621('0x12')](_0x5b7ef8[_0xb621('0x26')][_0xb621('0x12')]);}return _0x21bcd9[_0xb621('0x4d')](_0x2d7ccc);}})['then'](function(_0x21852e){if(_0x21852e){return _0x21852e?{'count':_0x5a5c29,'rows':_0x21852e}:null;}})[_0xb621('0x18')](respondWithResult(_0x149168,null))[_0xb621('0x28')](handleError(_0x149168,null));};exports[_0xb621('0x4f')]=function(_0x353470,_0x303bb8){var _0x16a3a6=_0x353470[_0xb621('0x37')][_0xb621('0x50')];return db[_0xb621('0x51')]['findAll']({'where':{'id':_0x16a3a6},'attributes':['id'],'include':[{'model':db['User'],'as':_0xb621('0x52'),'attributes':['id','name',_0xb621('0x53'),'voicePause',_0xb621('0x54')],'raw':!![]}]})[_0xb621('0x18')](function(_0x2d12cb){if(_0x2d12cb){var _0x545c1a=_[_0xb621('0x55')](_0x2d12cb,function(_0x37abd5){var _0x1f0dff=_0x37abd5[_0xb621('0x19')]({'plain':!![]});return _0x1f0dff['Agents'];});return db[_0xb621('0x24')]['find']({'where':{'id':_0x353470['params']['id']}})[_0xb621('0x18')](function(_0x328e23){return db['sequelize'][_0xb621('0x56')](function(_0x1924ac){return _0x328e23['addTeams'](_0x16a3a6,{'transaction':_0x1924ac})['then'](function(){return BPromise['each'](_0x545c1a,function(_0x561fc3){return db[_0xb621('0x43')][_0xb621('0x57')]({'where':{'UserId':_0x561fc3['id'],'MailQueueId':_0x353470[_0xb621('0x2a')]['id']},'transaction':_0x1924ac});});})[_0xb621('0x18')](function(){_0x545c1a[_0xb621('0x58')](function(_0x56117a){socket[_0xb621('0x59')](_0xb621('0x5a'),{'UserId':_0x56117a['id'],'MailQueueId':_0x328e23['id']});});});});});}})[_0xb621('0x18')](respondWithStatusCode(_0x303bb8,null))['catch'](handleError(_0x303bb8,null));};exports[_0xb621('0x5b')]=function(_0x22f41e,_0x2266ec){return db['Team'][_0xb621('0x27')]({'where':{'id':_0x22f41e[_0xb621('0x26')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0xb621('0x52'),'attributes':['id'],'raw':!![]}]})[_0xb621('0x18')](handleEntityNotFound(_0x2266ec,null))[_0xb621('0x18')](function(_0x1c3ff2){var _0x91cceb=_['map'](_0x1c3ff2,'id');var _0x26e72a=[];var _0x3368c3=[];var _0x489b07=squel[_0xb621('0x5c')]();_0x489b07[_0xb621('0x5d')](_0xb621('0x5e'))['from'](_0xb621('0x5f'),'tq')['join'](_0xb621('0x60'),'ut',_0xb621('0x61'))['where'](_0xb621('0x62'),_0x22f41e[_0xb621('0x2a')]['id']);for(var _0x1ea5ae=0x0;_0x1ea5ae<_0x1c3ff2[_0xb621('0x3f')];_0x1ea5ae+=0x1){let _0x469ff0=_0x1c3ff2[_0x1ea5ae];for(var _0x348a01=0x0;_0x348a01<_0x469ff0['Agents'][_0xb621('0x3f')];_0x348a01+=0x1){let _0x15f4ad=_0x469ff0['Agents'][_0x348a01];var _0x52430e=_0x489b07[_0xb621('0x63')]();_0x52430e['where'](_0xb621('0x64'),_0x15f4ad['id']);_0x3368c3['push'](db[_0xb621('0x65')][_0xb621('0x26')](_0x52430e['toString'](),{'type':db[_0xb621('0x65')][_0xb621('0x66')]['SELECT']})[_0xb621('0x18')](function(_0x177f7a){if(_0x177f7a['length']===0x1){return _0x15f4ad['id'];}else{var _0x23032c=_[_0xb621('0x67')](_[_0xb621('0x20')](_0x177f7a,'TeamId'),function(_0x8f884){return _[_0xb621('0x68')](_0x91cceb,_0x8f884);});if(_0x23032c){return _0x15f4ad['id'];}}}));}}return BPromise['all'](_0x3368c3)['then'](function(_0x16580f){_0x26e72a=_(_0x26e72a)[_0xb621('0x69')](_0x16580f)[_0xb621('0x6a')]()['value']();return db[_0xb621('0x24')]['find']({'where':{'id':_0x22f41e[_0xb621('0x2a')]['id']}})[_0xb621('0x18')](function(_0x568499){return db[_0xb621('0x65')][_0xb621('0x56')](function(_0x566ae2){return _0x568499[_0xb621('0x5b')](_0x22f41e[_0xb621('0x26')][_0xb621('0x50')],{'transaction':_0x566ae2})[_0xb621('0x18')](function(){if(!_[_0xb621('0x6b')](_0x26e72a)){return _0x568499[_0xb621('0x6c')](_0x26e72a,{'transaction':_0x566ae2});}})['then'](function(){_0x26e72a['forEach'](function(_0x253ad3){socket[_0xb621('0x59')](_0xb621('0x6d'),{'UserId':_0x253ad3,'MailQueueId':_0x568499['id']});});});});});});})['then'](respondWithStatusCode(_0x2266ec,null))[_0xb621('0x28')](handleError(_0x2266ec,null));};exports['addAgents']=function(_0x3d1a1b,_0x526352){return db[_0xb621('0x24')][_0xb621('0x35')]({'where':{'id':_0x3d1a1b[_0xb621('0x2a')]['id']}})[_0xb621('0x18')](handleEntityNotFound(_0x526352,null))['then'](function(_0x51a10d){if(_0x51a10d){return _0x51a10d[_0xb621('0x6e')](_0x3d1a1b['body'][_0xb621('0x50')],_[_0xb621('0x6f')](_0x3d1a1b['body'],[_0xb621('0x50'),'id'])||{})[_0xb621('0x70')](function(_0x4062c6){for(var _0x1a8dd4=0x0;_0x1a8dd4<_0x3d1a1b['body']['ids'][_0xb621('0x3f')];_0x1a8dd4+=0x1){socket[_0xb621('0x59')](_0xb621('0x5a'),{'UserId':Number(_0x3d1a1b['body']['ids'][_0x1a8dd4]),'MailQueueId':Number(_0x3d1a1b[_0xb621('0x2a')]['id'])});}return _0x4062c6;});}})['then'](respondWithResult(_0x526352,null))['catch'](handleError(_0x526352,null));};exports[_0xb621('0x6c')]=function(_0x48a9b1,_0xde09c5){return db['MailQueue'][_0xb621('0x35')]({'where':{'id':_0x48a9b1[_0xb621('0x2a')]['id']}})[_0xb621('0x18')](handleEntityNotFound(_0xde09c5,null))[_0xb621('0x18')](function(_0x37c0ba){if(_0x37c0ba){return _0x37c0ba[_0xb621('0x6c')](_0x48a9b1[_0xb621('0x26')][_0xb621('0x50')])['then'](function(){if(_[_0xb621('0x71')](_0x48a9b1[_0xb621('0x26')]['ids'])){for(var _0x7d44e=0x0;_0x7d44e<_0x48a9b1[_0xb621('0x26')]['ids'][_0xb621('0x3f')];_0x7d44e+=0x1){socket[_0xb621('0x59')](_0xb621('0x6d'),{'UserId':Number(_0x48a9b1[_0xb621('0x26')][_0xb621('0x50')][_0x7d44e]),'MailQueueId':Number(_0x48a9b1[_0xb621('0x2a')]['id'])});}}else{socket[_0xb621('0x59')]('userMailQueue:remove',{'UserId':Number(_0x48a9b1[_0xb621('0x26')][_0xb621('0x50')]),'MailQueueId':Number(_0x48a9b1[_0xb621('0x2a')]['id'])});}});}})[_0xb621('0x18')](respondWithStatusCode(_0xde09c5,null))[_0xb621('0x28')](handleError(_0xde09c5,null));};exports['getAgents']=function(_0x5ceafb,_0x41ba71){var _0xc2acac={};var _0x40a4f8={};var _0x52273a;var _0x1e5b4b;return db[_0xb621('0x24')][_0xb621('0x72')]({'where':{'id':_0x5ceafb[_0xb621('0x2a')]['id']}})['then'](handleEntityNotFound(_0x41ba71,null))[_0xb621('0x18')](function(_0x2d770c){if(_0x2d770c){_0x52273a=_0x2d770c;_0x40a4f8[_0xb621('0x2b')]=_[_0xb621('0x2c')](db[_0xb621('0x44')][_0xb621('0x2d')]);_0x40a4f8[_0xb621('0x26')]=_[_0xb621('0x2c')](_0x5ceafb[_0xb621('0x26')]);_0x40a4f8['filters']=_[_0xb621('0x2f')](_0x40a4f8[_0xb621('0x2b')],_0x40a4f8[_0xb621('0x26')]);_0xc2acac[_0xb621('0x31')]=_[_0xb621('0x2f')](_0x40a4f8[_0xb621('0x2b')],qs[_0xb621('0x30')](_0x5ceafb['query'][_0xb621('0x30')]));_0xc2acac[_0xb621('0x31')]=_0xc2acac[_0xb621('0x31')][_0xb621('0x3f')]?_0xc2acac[_0xb621('0x31')]:_0x40a4f8['model'];_0xc2acac[_0xb621('0x40')]=qs[_0xb621('0x41')](_0x5ceafb['query'][_0xb621('0x41')]);_0xc2acac[_0xb621('0x23')]=qs[_0xb621('0x2e')](_[_0xb621('0x73')](_0x5ceafb[_0xb621('0x26')],_0x40a4f8['filters']));if(_0x5ceafb[_0xb621('0x26')]['filter']){_0xc2acac[_0xb621('0x23')]=_[_0xb621('0x33')](_0xc2acac['where'],{'$or':_['map'](_0xc2acac[_0xb621('0x31')],function(_0x2b51db){var _0x4a40c5={};_0x4a40c5[_0x2b51db]={'$like':'%'+_0x5ceafb[_0xb621('0x26')]['filter']+'%'};return _0x4a40c5;})});}_0xc2acac=_[_0xb621('0x33')]({},_0xc2acac,_0x5ceafb['options']);return _0x52273a['getAgents'](_0xc2acac);}})[_0xb621('0x18')](function(_0xf6939b){if(_0xf6939b){_0x1e5b4b=_0xf6939b[_0xb621('0x3f')];if(!_0x5ceafb[_0xb621('0x26')][_0xb621('0x74')](_0xb621('0x4e'))){_0xc2acac['limit']=qs[_0xb621('0x10')](_0x5ceafb[_0xb621('0x26')]['limit']);_0xc2acac[_0xb621('0x12')]=qs[_0xb621('0x12')](_0x5ceafb['query']['offset']);}return _0x52273a[_0xb621('0x75')](_0xc2acac);}})[_0xb621('0x18')](function(_0x296ce7){if(_0x296ce7){return _0x296ce7?{'count':_0x1e5b4b,'rows':_0x296ce7}:null;}})[_0xb621('0x18')](respondWithResult(_0x41ba71,null))[_0xb621('0x28')](handleError(_0x41ba71,null));}; \ No newline at end of file +var _0xa89a=['forEach','userMailQueue:remove','addAgents','omit','spread','isArray','getAgents','bluebird','lodash','squel','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','update','then','MailQueues','destroy','error','stack','name','index','map','rawAttributes','type','key','where','include','query','findAll','rows','catch','show','keys','MailQueue','filters','intersection','model','attributes','fields','length','includeAll','options','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','UserProfileResource','params','describe','getMembers','nolimit','sort','pick','MailQueueId','filter','merge','User','findAndCountAll','UserId','mailPause','updatedAt','format','createdAt','getTeams','findOne','Team','order','hasOwnProperty','addTeams','ids','Agents','voicePause','interface','flatMap','transaction','UserMailQueue','emit','userMailQueue:save','removeTeams','field','from','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','every','TeamId','includes','all','compact','value','isEmpty','removeAgents'];(function(_0x28150d,_0x276ffa){var _0x52fd33=function(_0x295559){while(--_0x295559){_0x28150d['push'](_0x28150d['shift']());}};_0x52fd33(++_0x276ffa);}(_0xa89a,0x16c));var _0xaa89=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xa89a[_0x2641f9];return _0x585741;};'use strict';var BPromise=require(_0xaa89('0x0'));var util=require('util');var _=require(_0xaa89('0x1'));var squel=require(_0xaa89('0x2'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0xaa89('0x3'));var config=require(_0xaa89('0x4'));var db=require(_0xaa89('0x5'))['db'];config[_0xaa89('0x6')]=_[_0xaa89('0x7')](config[_0xaa89('0x6')],{'host':_0xaa89('0x8'),'port':0x18eb});var socket=require(_0xaa89('0x9'))(new Redis(config[_0xaa89('0x6')]));require('./mailQueue.socket')[_0xaa89('0xa')](socket);function respondWithStatusCode(_0x2a3f73,_0x1f1daa){_0x1f1daa=_0x1f1daa||0xcc;return function(_0x1df311){if(_0x1df311){return _0x2a3f73[_0xaa89('0xb')](_0x1f1daa);}return _0x2a3f73['status'](_0x1f1daa)[_0xaa89('0xc')]();};}function respondWithResult(_0x11d11c,_0x3b44e2){_0x3b44e2=_0x3b44e2||0xc8;return function(_0x19003e){if(_0x19003e){return _0x11d11c['status'](_0x3b44e2)[_0xaa89('0xd')](_0x19003e);}};}function respondWithFilteredResult(_0x4f0f28,_0x5ef75a){return function(_0x3a3c4b){if(_0x3a3c4b){var _0x3bdf7d=typeof _0x5ef75a[_0xaa89('0xe')]===_0xaa89('0xf')&&typeof _0x5ef75a[_0xaa89('0x10')]==='undefined';var _0x28e014=_0x3a3c4b[_0xaa89('0x11')];var _0x581416=_0x3bdf7d?0x0:_0x5ef75a[_0xaa89('0xe')];var _0x1f11db=_0x3bdf7d?_0x3a3c4b[_0xaa89('0x11')]:_0x5ef75a[_0xaa89('0xe')]+_0x5ef75a[_0xaa89('0x10')];var _0x5eb844;if(_0x1f11db>=_0x28e014){_0x1f11db=_0x28e014;_0x5eb844=0xc8;}else{_0x5eb844=0xce;}_0x4f0f28[_0xaa89('0x12')](_0x5eb844);return _0x4f0f28[_0xaa89('0x13')](_0xaa89('0x14'),_0x581416+'-'+_0x1f11db+'/'+_0x28e014)[_0xaa89('0xd')](_0x3a3c4b);}return null;};}function saveUpdates(_0x14b01b){return function(_0x41d699){if(_0x41d699){return _0x41d699[_0xaa89('0x15')](_0x14b01b)['then'](function(_0x5d5325){return _0x5d5325;});}return null;};}function removeEntity(_0x43d9a2){return function(_0x591b37){if(_0x591b37){return _0x591b37['destroy']()[_0xaa89('0x16')](function(){var _0x55b7ea=_0x591b37['get']({'plain':!![]});var _0x28fdbf=_0xaa89('0x17');return db['UserProfileResource'][_0xaa89('0x18')]({'where':{'type':_0x28fdbf,'resourceId':_0x55b7ea['id']}})[_0xaa89('0x16')](function(){return _0x591b37;});})[_0xaa89('0x16')](function(){_0x43d9a2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x23e78e){return function(_0x3cc510){if(!_0x3cc510){_0x23e78e[_0xaa89('0xb')](0x194);}return _0x3cc510;};}function handleError(_0x2c3ccf,_0x5e9fe5){_0x5e9fe5=_0x5e9fe5||0x1f4;return function(_0x15406e){logger[_0xaa89('0x19')](_0x15406e[_0xaa89('0x1a')]);if(_0x15406e[_0xaa89('0x1b')]){delete _0x15406e['name'];}_0x2c3ccf[_0xaa89('0x12')](_0x5e9fe5)['send'](_0x15406e);};}exports[_0xaa89('0x1c')]=function(_0x15ff67,_0x5cfa9d){var _0x4b523c={};var _0x143da6={'count':0x0,'rows':[]};var _0x5a31cc=_[_0xaa89('0x1d')](db['MailQueue'][_0xaa89('0x1e')],function(_0x2ea689){return{'name':_0x2ea689['fieldName'],'type':_0x2ea689[_0xaa89('0x1f')][_0xaa89('0x20')]};});_0x4b523c=qs['getOptions'](_0x5a31cc,_0x15ff67);var _0x340388={'where':_0x4b523c[_0xaa89('0x21')]};return db['MailQueue'][_0xaa89('0x11')](_0x340388)[_0xaa89('0x16')](function(_0x4a2d48){_0x143da6[_0xaa89('0x11')]=_0x4a2d48;_0x4b523c[_0xaa89('0x22')]=qs[_0xaa89('0x22')](_0x15ff67[_0xaa89('0x23')]);return db['MailQueue'][_0xaa89('0x24')](_0x4b523c);})[_0xaa89('0x16')](function(_0xe9189d){_0x143da6[_0xaa89('0x25')]=_0xe9189d;return _0x143da6;})[_0xaa89('0x16')](respondWithFilteredResult(_0x5cfa9d,_0x4b523c))[_0xaa89('0x26')](handleError(_0x5cfa9d,null));};exports[_0xaa89('0x27')]=function(_0x54ec8a,_0x16c1ca){var _0x31b126={'raw':!![],'where':{'id':_0x54ec8a['params']['id']}},_0x28cbb7={};_0x28cbb7['model']=_[_0xaa89('0x28')](db[_0xaa89('0x29')][_0xaa89('0x1e')]);_0x28cbb7[_0xaa89('0x23')]=_[_0xaa89('0x28')](_0x54ec8a[_0xaa89('0x23')]);_0x28cbb7[_0xaa89('0x2a')]=_[_0xaa89('0x2b')](_0x28cbb7[_0xaa89('0x2c')],_0x28cbb7[_0xaa89('0x23')]);_0x31b126[_0xaa89('0x2d')]=_[_0xaa89('0x2b')](_0x28cbb7['model'],qs[_0xaa89('0x2e')](_0x54ec8a['query'][_0xaa89('0x2e')]));_0x31b126['attributes']=_0x31b126[_0xaa89('0x2d')][_0xaa89('0x2f')]?_0x31b126[_0xaa89('0x2d')]:_0x28cbb7[_0xaa89('0x2c')];if(_0x54ec8a[_0xaa89('0x23')][_0xaa89('0x30')]){_0x31b126[_0xaa89('0x22')]=[{'all':!![]}];}_0x31b126=_['merge']({},_0x31b126,_0x54ec8a[_0xaa89('0x31')]);return db[_0xaa89('0x29')][_0xaa89('0x32')](_0x31b126)[_0xaa89('0x16')](handleEntityNotFound(_0x16c1ca,null))['then'](respondWithResult(_0x16c1ca,null))['catch'](handleError(_0x16c1ca,null));};exports[_0xaa89('0x33')]=function(_0x4c8ae4,_0x5d3c6d){return db[_0xaa89('0x29')][_0xaa89('0x33')](_0x4c8ae4[_0xaa89('0x34')],{})[_0xaa89('0x16')](function(_0x4dd9ea){var _0xc30ae0=_0x4c8ae4['user'][_0xaa89('0x35')]({'plain':!![]});if(!_0xc30ae0)throw new Error(_0xaa89('0x36'));if(_0xc30ae0[_0xaa89('0x37')]===_0xaa89('0x38')){var _0x576473=_0x4dd9ea[_0xaa89('0x35')]({'plain':!![]});var _0x4ace54=_0xaa89('0x17');return db['UserProfileSection'][_0xaa89('0x32')]({'where':{'name':_0x4ace54,'userProfileId':_0xc30ae0[_0xaa89('0x39')]},'raw':!![]})['then'](function(_0x20d082){if(_0x20d082&&_0x20d082[_0xaa89('0x3a')]===0x0){return db[_0xaa89('0x3b')][_0xaa89('0x33')]({'name':_0x576473[_0xaa89('0x1b')],'resourceId':_0x576473['id'],'type':_0x20d082[_0xaa89('0x1b')],'sectionId':_0x20d082['id']},{})[_0xaa89('0x16')](function(){return _0x4dd9ea;});}else{return _0x4dd9ea;}})[_0xaa89('0x26')](function(_0x5e383c){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5e383c);throw _0x5e383c;});}return _0x4dd9ea;})[_0xaa89('0x16')](respondWithResult(_0x5d3c6d,0xc9))[_0xaa89('0x26')](handleError(_0x5d3c6d,null));};exports['update']=function(_0x37b830,_0x2d489e){if(_0x37b830[_0xaa89('0x34')]['id']){delete _0x37b830[_0xaa89('0x34')]['id'];}return db[_0xaa89('0x29')][_0xaa89('0x32')]({'where':{'id':_0x37b830[_0xaa89('0x3c')]['id']}})[_0xaa89('0x16')](handleEntityNotFound(_0x2d489e,null))['then'](saveUpdates(_0x37b830[_0xaa89('0x34')],null))[_0xaa89('0x16')](respondWithResult(_0x2d489e,null))[_0xaa89('0x26')](handleError(_0x2d489e,null));};exports[_0xaa89('0x18')]=function(_0x383b26,_0x2f2705){return db[_0xaa89('0x29')][_0xaa89('0x32')]({'where':{'id':_0x383b26['params']['id']}})[_0xaa89('0x16')](handleEntityNotFound(_0x2f2705,null))[_0xaa89('0x16')](removeEntity(_0x2f2705,null))[_0xaa89('0x26')](handleError(_0x2f2705,null));};exports[_0xaa89('0x3d')]=function(_0x5bbd28,_0xebb77a){return db[_0xaa89('0x29')][_0xaa89('0x3d')]()[_0xaa89('0x16')](respondWithResult(_0xebb77a,null))[_0xaa89('0x26')](handleError(_0xebb77a,null));};exports[_0xaa89('0x3e')]=function(_0x2fe876,_0x3ebde4){var _0x1e7836={'raw':!![],'where':{}},_0x4f4670={},_0xa305e6;return db[_0xaa89('0x29')]['findOne']({'where':{'id':_0x2fe876['params']['id']}})[_0xaa89('0x16')](handleEntityNotFound(_0x3ebde4,null))[_0xaa89('0x16')](function(_0x1085fd){if(_0x1085fd){_0xa305e6=_0x1085fd[_0xaa89('0x35')]({'plain':!![]});_0x4f4670[_0xaa89('0x2c')]=_[_0xaa89('0x28')](db['UserMailQueue'][_0xaa89('0x1e')]);_0x4f4670[_0xaa89('0x23')]=_['keys'](_0x2fe876['query']);_0x4f4670['filters']=_[_0xaa89('0x2b')](_0x4f4670[_0xaa89('0x2c')],_0x4f4670[_0xaa89('0x23')]);_0x1e7836[_0xaa89('0x2d')]=_[_0xaa89('0x2b')](_0x4f4670[_0xaa89('0x2c')],qs[_0xaa89('0x2e')](_0x2fe876[_0xaa89('0x23')]['fields']));_0x1e7836[_0xaa89('0x2d')]=_0x1e7836[_0xaa89('0x2d')]['length']?_0x1e7836[_0xaa89('0x2d')]:_0x4f4670[_0xaa89('0x2c')];if(!_0x2fe876['query']['hasOwnProperty'](_0xaa89('0x3f'))){_0x1e7836[_0xaa89('0x10')]=qs[_0xaa89('0x10')](_0x2fe876['query'][_0xaa89('0x10')]);_0x1e7836[_0xaa89('0xe')]=qs['offset'](_0x2fe876[_0xaa89('0x23')][_0xaa89('0xe')]);}_0x1e7836['order']=qs[_0xaa89('0x40')](_0x2fe876[_0xaa89('0x23')][_0xaa89('0x40')]);_0x1e7836[_0xaa89('0x21')]=qs[_0xaa89('0x2a')](_[_0xaa89('0x41')](_0x2fe876['query'],_0x4f4670[_0xaa89('0x2a')]));_0x1e7836['where'][_0xaa89('0x42')]=_0x1085fd['id'];if(_0x2fe876[_0xaa89('0x23')][_0xaa89('0x43')]){_0x1e7836[_0xaa89('0x21')]=_[_0xaa89('0x44')](_0x1e7836[_0xaa89('0x21')],{'$or':_[_0xaa89('0x1d')](_0x1e7836[_0xaa89('0x2d')],function(_0x1c3a74){var _0x788deb={};_0x788deb[_0x1c3a74]={'$like':'%'+_0x2fe876[_0xaa89('0x23')][_0xaa89('0x43')]+'%'};return _0x788deb;})});}_0x1e7836=_[_0xaa89('0x44')]({},_0x1e7836,_0x2fe876[_0xaa89('0x31')]);return db['UserMailQueue']['findAll'](_0x1e7836);}})['then'](function(_0x4dcc7b){if(_0x4dcc7b){return db[_0xaa89('0x45')][_0xaa89('0x46')]({'where':{'id':_[_0xaa89('0x1d')](_0x4dcc7b,_0xaa89('0x47')),'role':'agent'},'attributes':['id','name',_0xaa89('0x48'),_0xaa89('0x49'),'createdAt']});}})['then'](function(_0x34ee4e){if(_0x34ee4e){return{'count':_0x34ee4e[_0xaa89('0x11')],'rows':_[_0xaa89('0x1d')](_0x34ee4e[_0xaa89('0x25')],function(_0x1a1cd0){return{'membername':_0x1a1cd0[_0xaa89('0x1b')],'UserId':_0x1a1cd0['id'],'queue_name':_0xa305e6[_0xaa89('0x1b')],'MailQueueId':_0xa305e6['id'],'interface':util[_0xaa89('0x4a')]('%s/%s','SIP',_0x1a1cd0[_0xaa89('0x1b')]),'penalty':0x0,'paused':_0x1a1cd0[_0xaa89('0x48')],'createdAt':_0x1a1cd0[_0xaa89('0x4b')],'updatedAt':_0x1a1cd0[_0xaa89('0x49')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xaa89('0x16')](respondWithFilteredResult(_0x3ebde4,_0x1e7836))[_0xaa89('0x26')](handleError(_0x3ebde4,null));};exports[_0xaa89('0x4c')]=function(_0x1d94b0,_0x322723){var _0x4fd6c8={};var _0x4a624f={};var _0x4e076d;var _0x18aae4;return db[_0xaa89('0x29')][_0xaa89('0x4d')]({'where':{'id':_0x1d94b0['params']['id']}})['then'](handleEntityNotFound(_0x322723,null))['then'](function(_0x42343c){if(_0x42343c){_0x4e076d=_0x42343c;_0x4a624f[_0xaa89('0x2c')]=_['keys'](db[_0xaa89('0x4e')][_0xaa89('0x1e')]);_0x4a624f['query']=_[_0xaa89('0x28')](_0x1d94b0['query']);_0x4a624f[_0xaa89('0x2a')]=_['intersection'](_0x4a624f[_0xaa89('0x2c')],_0x4a624f[_0xaa89('0x23')]);_0x4fd6c8[_0xaa89('0x2d')]=_['intersection'](_0x4a624f['model'],qs[_0xaa89('0x2e')](_0x1d94b0[_0xaa89('0x23')][_0xaa89('0x2e')]));_0x4fd6c8[_0xaa89('0x2d')]=_0x4fd6c8[_0xaa89('0x2d')][_0xaa89('0x2f')]?_0x4fd6c8['attributes']:_0x4a624f[_0xaa89('0x2c')];_0x4fd6c8[_0xaa89('0x4f')]=qs[_0xaa89('0x40')](_0x1d94b0['query'][_0xaa89('0x40')]);_0x4fd6c8[_0xaa89('0x21')]=qs[_0xaa89('0x2a')](_[_0xaa89('0x41')](_0x1d94b0[_0xaa89('0x23')],_0x4a624f[_0xaa89('0x2a')]));if(_0x1d94b0[_0xaa89('0x23')]['filter']){_0x4fd6c8[_0xaa89('0x21')]=_[_0xaa89('0x44')](_0x4fd6c8['where'],{'$or':_[_0xaa89('0x1d')](_0x4fd6c8[_0xaa89('0x2d')],function(_0x2830bd){var _0x1ba8af={};_0x1ba8af[_0x2830bd]={'$like':'%'+_0x1d94b0[_0xaa89('0x23')][_0xaa89('0x43')]+'%'};return _0x1ba8af;})});}_0x4fd6c8=_['merge']({},_0x4fd6c8,_0x1d94b0[_0xaa89('0x31')]);return _0x4e076d[_0xaa89('0x4c')](_0x4fd6c8);}})[_0xaa89('0x16')](function(_0x365362){if(_0x365362){_0x18aae4=_0x365362[_0xaa89('0x2f')];if(!_0x1d94b0[_0xaa89('0x23')][_0xaa89('0x50')](_0xaa89('0x3f'))){_0x4fd6c8[_0xaa89('0x10')]=qs[_0xaa89('0x10')](_0x1d94b0[_0xaa89('0x23')]['limit']);_0x4fd6c8['offset']=qs[_0xaa89('0xe')](_0x1d94b0[_0xaa89('0x23')][_0xaa89('0xe')]);}return _0x4e076d[_0xaa89('0x4c')](_0x4fd6c8);}})['then'](function(_0x2806b9){if(_0x2806b9){return _0x2806b9?{'count':_0x18aae4,'rows':_0x2806b9}:null;}})[_0xaa89('0x16')](respondWithResult(_0x322723,null))[_0xaa89('0x26')](handleError(_0x322723,null));};exports[_0xaa89('0x51')]=function(_0x5a1e71,_0x464279){var _0x582783=_0x5a1e71[_0xaa89('0x34')][_0xaa89('0x52')];return db[_0xaa89('0x4e')][_0xaa89('0x24')]({'where':{'id':_0x582783},'attributes':['id'],'include':[{'model':db[_0xaa89('0x45')],'as':_0xaa89('0x53'),'attributes':['id',_0xaa89('0x1b'),'online',_0xaa89('0x54'),_0xaa89('0x55')],'raw':!![]}]})['then'](function(_0x327da9){if(_0x327da9){var _0xf15997=_[_0xaa89('0x56')](_0x327da9,function(_0x2ddf0c){var _0x6d9a32=_0x2ddf0c[_0xaa89('0x35')]({'plain':!![]});return _0x6d9a32[_0xaa89('0x53')];});return db[_0xaa89('0x29')][_0xaa89('0x32')]({'where':{'id':_0x5a1e71[_0xaa89('0x3c')]['id']}})['then'](function(_0x7e2c97){return db['sequelize'][_0xaa89('0x57')](function(_0x7bf24a){return _0x7e2c97[_0xaa89('0x51')](_0x582783,{'transaction':_0x7bf24a})[_0xaa89('0x16')](function(){return BPromise['each'](_0xf15997,function(_0x2ee6a6){return db[_0xaa89('0x58')]['findOrCreate']({'where':{'UserId':_0x2ee6a6['id'],'MailQueueId':_0x5a1e71['params']['id']},'transaction':_0x7bf24a});});})[_0xaa89('0x16')](function(){_0xf15997['forEach'](function(_0x56a696){socket[_0xaa89('0x59')](_0xaa89('0x5a'),{'UserId':_0x56a696['id'],'MailQueueId':_0x7e2c97['id']});});});});});}})[_0xaa89('0x16')](respondWithStatusCode(_0x464279,null))[_0xaa89('0x26')](handleError(_0x464279,null));};exports[_0xaa89('0x5b')]=function(_0x560462,_0x1e9400){return db[_0xaa89('0x4e')][_0xaa89('0x24')]({'where':{'id':_0x560462[_0xaa89('0x23')]['ids']},'attributes':['id'],'include':[{'model':db[_0xaa89('0x45')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x1e9400,null))['then'](function(_0xd0b4c9){var _0xcd6148=_[_0xaa89('0x1d')](_0xd0b4c9,'id');var _0x22f6a0=[];var _0x194f52=[];var _0x4ccbf9=squel['select']();_0x4ccbf9[_0xaa89('0x5c')]('tq.TeamId')[_0xaa89('0x5d')](_0xaa89('0x5e'),'tq')[_0xaa89('0x5f')](_0xaa89('0x60'),'ut',_0xaa89('0x61'))[_0xaa89('0x21')](_0xaa89('0x62'),_0x560462[_0xaa89('0x3c')]['id']);for(var _0x116ef8=0x0;_0x116ef8<_0xd0b4c9[_0xaa89('0x2f')];_0x116ef8+=0x1){let _0x275aed=_0xd0b4c9[_0x116ef8];for(var _0x3281fd=0x0;_0x3281fd<_0x275aed[_0xaa89('0x53')][_0xaa89('0x2f')];_0x3281fd+=0x1){let _0x18f04d=_0x275aed[_0xaa89('0x53')][_0x3281fd];var _0x1d17b3=_0x4ccbf9['clone']();_0x1d17b3[_0xaa89('0x21')](_0xaa89('0x63'),_0x18f04d['id']);_0x194f52[_0xaa89('0x64')](db[_0xaa89('0x65')][_0xaa89('0x23')](_0x1d17b3[_0xaa89('0x66')](),{'type':db[_0xaa89('0x65')][_0xaa89('0x67')]['SELECT']})['then'](function(_0x4295d6){if(_0x4295d6['length']===0x1){return _0x18f04d['id'];}else{var _0x1e4077=_[_0xaa89('0x68')](_[_0xaa89('0x1d')](_0x4295d6,_0xaa89('0x69')),function(_0x3891bf){return _[_0xaa89('0x6a')](_0xcd6148,_0x3891bf);});if(_0x1e4077){return _0x18f04d['id'];}}}));}}return BPromise[_0xaa89('0x6b')](_0x194f52)[_0xaa89('0x16')](function(_0x5e225c){_0x22f6a0=_(_0x22f6a0)['union'](_0x5e225c)[_0xaa89('0x6c')]()[_0xaa89('0x6d')]();return db[_0xaa89('0x29')][_0xaa89('0x32')]({'where':{'id':_0x560462[_0xaa89('0x3c')]['id']}})['then'](function(_0x1f0abb){return db['sequelize']['transaction'](function(_0x3fc623){return _0x1f0abb[_0xaa89('0x5b')](_0x560462[_0xaa89('0x23')][_0xaa89('0x52')],{'transaction':_0x3fc623})[_0xaa89('0x16')](function(){if(!_[_0xaa89('0x6e')](_0x22f6a0)){return _0x1f0abb[_0xaa89('0x6f')](_0x22f6a0,{'transaction':_0x3fc623});}})[_0xaa89('0x16')](function(){_0x22f6a0[_0xaa89('0x70')](function(_0x4cd596){socket[_0xaa89('0x59')](_0xaa89('0x71'),{'UserId':_0x4cd596,'MailQueueId':_0x1f0abb['id']});});});});});});})[_0xaa89('0x16')](respondWithStatusCode(_0x1e9400,null))[_0xaa89('0x26')](handleError(_0x1e9400,null));};exports[_0xaa89('0x72')]=function(_0x3b1504,_0x5532d7){return db[_0xaa89('0x29')]['find']({'where':{'id':_0x3b1504[_0xaa89('0x3c')]['id']}})[_0xaa89('0x16')](handleEntityNotFound(_0x5532d7,null))[_0xaa89('0x16')](function(_0x25c41e){if(_0x25c41e){return _0x25c41e['addAgents'](_0x3b1504[_0xaa89('0x34')][_0xaa89('0x52')],_[_0xaa89('0x73')](_0x3b1504[_0xaa89('0x34')],['ids','id'])||{})[_0xaa89('0x74')](function(_0x341f77){for(var _0x3106ca=0x0;_0x3106ca<_0x3b1504[_0xaa89('0x34')][_0xaa89('0x52')][_0xaa89('0x2f')];_0x3106ca+=0x1){socket[_0xaa89('0x59')](_0xaa89('0x5a'),{'UserId':Number(_0x3b1504['body'][_0xaa89('0x52')][_0x3106ca]),'MailQueueId':Number(_0x3b1504[_0xaa89('0x3c')]['id'])});}return _0x341f77;});}})[_0xaa89('0x16')](respondWithResult(_0x5532d7,null))[_0xaa89('0x26')](handleError(_0x5532d7,null));};exports[_0xaa89('0x6f')]=function(_0x42ba85,_0x569a9e){return db[_0xaa89('0x29')][_0xaa89('0x32')]({'where':{'id':_0x42ba85['params']['id']}})['then'](handleEntityNotFound(_0x569a9e,null))[_0xaa89('0x16')](function(_0x2be3c0){if(_0x2be3c0){return _0x2be3c0[_0xaa89('0x6f')](_0x42ba85[_0xaa89('0x23')]['ids'])['then'](function(){if(_[_0xaa89('0x75')](_0x42ba85[_0xaa89('0x23')][_0xaa89('0x52')])){for(var _0x3ab177=0x0;_0x3ab177<_0x42ba85[_0xaa89('0x23')]['ids'][_0xaa89('0x2f')];_0x3ab177+=0x1){socket[_0xaa89('0x59')](_0xaa89('0x71'),{'UserId':Number(_0x42ba85[_0xaa89('0x23')][_0xaa89('0x52')][_0x3ab177]),'MailQueueId':Number(_0x42ba85['params']['id'])});}}else{socket[_0xaa89('0x59')](_0xaa89('0x71'),{'UserId':Number(_0x42ba85[_0xaa89('0x23')]['ids']),'MailQueueId':Number(_0x42ba85[_0xaa89('0x3c')]['id'])});}});}})[_0xaa89('0x16')](respondWithStatusCode(_0x569a9e,null))[_0xaa89('0x26')](handleError(_0x569a9e,null));};exports[_0xaa89('0x76')]=function(_0x3e8887,_0x335bd){var _0x3ca345={};var _0x3ff062={};var _0x495179;var _0x4006ce;return db[_0xaa89('0x29')][_0xaa89('0x4d')]({'where':{'id':_0x3e8887['params']['id']}})['then'](handleEntityNotFound(_0x335bd,null))[_0xaa89('0x16')](function(_0x3214fe){if(_0x3214fe){_0x495179=_0x3214fe;_0x3ff062[_0xaa89('0x2c')]=_['keys'](db[_0xaa89('0x45')][_0xaa89('0x1e')]);_0x3ff062[_0xaa89('0x23')]=_[_0xaa89('0x28')](_0x3e8887['query']);_0x3ff062[_0xaa89('0x2a')]=_[_0xaa89('0x2b')](_0x3ff062['model'],_0x3ff062[_0xaa89('0x23')]);_0x3ca345['attributes']=_[_0xaa89('0x2b')](_0x3ff062['model'],qs[_0xaa89('0x2e')](_0x3e8887[_0xaa89('0x23')][_0xaa89('0x2e')]));_0x3ca345[_0xaa89('0x2d')]=_0x3ca345[_0xaa89('0x2d')]['length']?_0x3ca345['attributes']:_0x3ff062[_0xaa89('0x2c')];_0x3ca345[_0xaa89('0x4f')]=qs[_0xaa89('0x40')](_0x3e8887[_0xaa89('0x23')][_0xaa89('0x40')]);_0x3ca345[_0xaa89('0x21')]=qs[_0xaa89('0x2a')](_[_0xaa89('0x41')](_0x3e8887[_0xaa89('0x23')],_0x3ff062[_0xaa89('0x2a')]));if(_0x3e8887[_0xaa89('0x23')][_0xaa89('0x43')]){_0x3ca345[_0xaa89('0x21')]=_['merge'](_0x3ca345['where'],{'$or':_['map'](_0x3ca345[_0xaa89('0x2d')],function(_0x410b15){var _0x24fd38={};_0x24fd38[_0x410b15]={'$like':'%'+_0x3e8887[_0xaa89('0x23')][_0xaa89('0x43')]+'%'};return _0x24fd38;})});}_0x3ca345=_[_0xaa89('0x44')]({},_0x3ca345,_0x3e8887[_0xaa89('0x31')]);return _0x495179[_0xaa89('0x76')](_0x3ca345);}})[_0xaa89('0x16')](function(_0x39892f){if(_0x39892f){_0x4006ce=_0x39892f[_0xaa89('0x2f')];if(!_0x3e8887[_0xaa89('0x23')][_0xaa89('0x50')](_0xaa89('0x3f'))){_0x3ca345[_0xaa89('0x10')]=qs[_0xaa89('0x10')](_0x3e8887[_0xaa89('0x23')]['limit']);_0x3ca345[_0xaa89('0xe')]=qs['offset'](_0x3e8887[_0xaa89('0x23')][_0xaa89('0xe')]);}return _0x495179['getAgents'](_0x3ca345);}})[_0xaa89('0x16')](function(_0x2c2b42){if(_0x2c2b42){return _0x2c2b42?{'count':_0x4006ce,'rows':_0x2c2b42}:null;}})[_0xaa89('0x16')](respondWithResult(_0x335bd,null))['catch'](handleError(_0x335bd,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index cefc67c..f6fda3a 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 _0x7a17=['emit','hasOwnProperty','hook','../../mysqldb','setMaxListeners','save','update','remove'];(function(_0x437dee,_0x37450f){var _0x56cfa8=function(_0x3b86e5){while(--_0x3b86e5){_0x437dee['push'](_0x437dee['shift']());}};_0x56cfa8(++_0x37450f);}(_0x7a17,0x83));var _0x77a1=function(_0x4ef53a,_0x1acf35){_0x4ef53a=_0x4ef53a-0x0;var _0x3f8883=_0x7a17[_0x4ef53a];return _0x3f8883;};'use strict';var EventEmitter=require('events');var MailQueue=require(_0x77a1('0x0'))['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x77a1('0x1')](0x0);var events={'afterCreate':_0x77a1('0x2'),'afterUpdate':_0x77a1('0x3'),'afterDestroy':_0x77a1('0x4')};function emitEvent(_0x318716){return function(_0x47c118,_0x30f29d,_0x19e619){MailQueueEvents[_0x77a1('0x5')](_0x318716+':'+_0x47c118['id'],_0x47c118);MailQueueEvents['emit'](_0x318716,_0x47c118);_0x19e619(null);};}for(var e in events){if(events[_0x77a1('0x6')](e)){var event=events[e];MailQueue[_0x77a1('0x7')](e,emitEvent(event));}}module['exports']=MailQueueEvents; \ No newline at end of file +var _0x95ba=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailQueue','setMaxListeners','save','remove'];(function(_0x5e1f08,_0x4c6848){var _0x372d91=function(_0x213fec){while(--_0x213fec){_0x5e1f08['push'](_0x5e1f08['shift']());}};_0x372d91(++_0x4c6848);}(_0x95ba,0x9a));var _0xa95b=function(_0x5670e7,_0xd759ea){_0x5670e7=_0x5670e7-0x0;var _0x3050b2=_0x95ba[_0x5670e7];return _0x3050b2;};'use strict';var EventEmitter=require(_0xa95b('0x0'));var MailQueue=require(_0xa95b('0x1'))['db'][_0xa95b('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xa95b('0x3')](0x0);var events={'afterCreate':_0xa95b('0x4'),'afterUpdate':'update','afterDestroy':_0xa95b('0x5')};function emitEvent(_0x536c43){return function(_0x537de1,_0x42b1e4,_0x3e417a){MailQueueEvents[_0xa95b('0x6')](_0x536c43+':'+_0x537de1['id'],_0x537de1);MailQueueEvents[_0xa95b('0x6')](_0x536c43,_0x537de1);_0x3e417a(null);};}for(var e in events){if(events[_0xa95b('0x7')](e)){var event=events[e];MailQueue[_0xa95b('0x8')](e,emitEvent(event));}}module[_0xa95b('0x9')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index f4a5386..54569cd 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 _0x5368=['../../config/logger','moment','request-promise','path','rimraf','./mailQueue.attributes','exports','define','MailQueue','mail_queues','lodash','util'];(function(_0xc52382,_0x365b39){var _0x1d4fcd=function(_0x1bee4d){while(--_0x1bee4d){_0xc52382['push'](_0xc52382['shift']());}};_0x1d4fcd(++_0x365b39);}(_0x5368,0x196));var _0x8536=function(_0x16066e,_0x119d49){_0x16066e=_0x16066e-0x0;var _0x4e6890=_0x5368[_0x16066e];return _0x4e6890;};'use strict';var _=require(_0x8536('0x0'));var util=require(_0x8536('0x1'));var logger=require(_0x8536('0x2'))('api');var moment=require(_0x8536('0x3'));var BPromise=require('bluebird');var rp=require(_0x8536('0x4'));var fs=require('fs');var path=require(_0x8536('0x5'));var rimraf=require(_0x8536('0x6'));var config=require('../../config/environment');var attributes=require(_0x8536('0x7'));module[_0x8536('0x8')]=function(_0x372538,_0x4d9b01){return _0x372538[_0x8536('0x9')](_0x8536('0xa'),attributes,{'tableName':_0x8536('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xab58=['mail_queues','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./mailQueue.attributes','exports','define','MailQueue'];(function(_0x4edb25,_0x20880c){var _0x5dade1=function(_0x359b75){while(--_0x359b75){_0x4edb25['push'](_0x4edb25['shift']());}};_0x5dade1(++_0x20880c);}(_0xab58,0x17a));var _0x8ab5=function(_0x558f7f,_0x2652bc){_0x558f7f=_0x558f7f-0x0;var _0x357551=_0xab58[_0x558f7f];return _0x357551;};'use strict';var _=require('lodash');var util=require(_0x8ab5('0x0'));var logger=require(_0x8ab5('0x1'))(_0x8ab5('0x2'));var moment=require(_0x8ab5('0x3'));var BPromise=require(_0x8ab5('0x4'));var rp=require(_0x8ab5('0x5'));var fs=require('fs');var path=require(_0x8ab5('0x6'));var rimraf=require(_0x8ab5('0x7'));var config=require('../../config/environment');var attributes=require(_0x8ab5('0x8'));module[_0x8ab5('0x9')]=function(_0x343046,_0xa79b2f){return _0x343046[_0x8ab5('0xa')](_0x8ab5('0xb'),attributes,{'tableName':_0x8ab5('0xc'),'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 e0e13f9..ff71614 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 _0x5c7e=['info','result','catch','GetMailQueue','MailQueue','findAll','options','raw','where','include','map','model','attributes','ShowMailQueue','find','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./mailQueue.socket','register','request','then','MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x36c9ea,_0xac8d77){var _0x5d11cc=function(_0x17a3db){while(--_0x17a3db){_0x36c9ea['push'](_0x36c9ea['shift']());}};_0x5d11cc(++_0xac8d77);}(_0x5c7e,0x16e));var _0xe5c7=function(_0x2b91c5,_0x3b6db5){_0x2b91c5=_0x2b91c5-0x0;var _0xbd5531=_0x5c7e[_0x2b91c5];return _0xbd5531;};'use strict';var _=require(_0xe5c7('0x0'));var util=require(_0xe5c7('0x1'));var moment=require(_0xe5c7('0x2'));var BPromise=require(_0xe5c7('0x3'));var rs=require(_0xe5c7('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe5c7('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe5c7('0x6'));var config=require(_0xe5c7('0x7'));var jayson=require(_0xe5c7('0x8'));var client=jayson[_0xe5c7('0x9')][_0xe5c7('0xa')]({'port':0x232a});config[_0xe5c7('0xb')]=_['defaults'](config['redis'],{'host':_0xe5c7('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe5c7('0xb')]));require(_0xe5c7('0xd'))[_0xe5c7('0xe')](socket);function respondWithRpcPromise(_0x16c35c,_0x481524,_0x588a23){return new BPromise(function(_0x5e782e,_0x3a1028){return client[_0xe5c7('0xf')](_0x16c35c,_0x588a23)[_0xe5c7('0x10')](function(_0x5370a3){logger['info'](_0xe5c7('0x11'),_0x481524,_0xe5c7('0x12'));logger[_0xe5c7('0x13')](_0xe5c7('0x14'),_0x481524,_0xe5c7('0x12'),JSON[_0xe5c7('0x15')](_0x5370a3));if(_0x5370a3[_0xe5c7('0x16')]){if(_0x5370a3['error']['code']===0x1f4){logger[_0xe5c7('0x16')](_0xe5c7('0x11'),_0x481524,_0x5370a3['error'][_0xe5c7('0x17')]);return _0x3a1028(_0x5370a3[_0xe5c7('0x16')][_0xe5c7('0x17')]);}logger['error']('MailQueue,\x20%s,\x20%s',_0x481524,_0x5370a3[_0xe5c7('0x16')][_0xe5c7('0x17')]);return _0x5e782e(_0x5370a3[_0xe5c7('0x16')][_0xe5c7('0x17')]);}else{logger[_0xe5c7('0x18')](_0xe5c7('0x11'),_0x481524,_0xe5c7('0x12'));_0x5e782e(_0x5370a3[_0xe5c7('0x19')][_0xe5c7('0x17')]);}})[_0xe5c7('0x1a')](function(_0x416d78){logger[_0xe5c7('0x16')]('MailQueue,\x20%s,\x20%s',_0x481524,_0x416d78);_0x3a1028(_0x416d78);});});}exports[_0xe5c7('0x1b')]=function(_0x3e9809){var _0x2a3665=this;return new Promise(function(_0x4c76c7,_0x23e8b2){return db[_0xe5c7('0x1c')][_0xe5c7('0x1d')]({'raw':_0x3e9809[_0xe5c7('0x1e')]?_0x3e9809[_0xe5c7('0x1e')][_0xe5c7('0x1f')]===undefined?!![]:![]:!![],'where':_0x3e9809[_0xe5c7('0x1e')]?_0x3e9809['options'][_0xe5c7('0x20')]||null:null,'attributes':_0x3e9809[_0xe5c7('0x1e')]?_0x3e9809[_0xe5c7('0x1e')]['attributes']||null:null,'limit':_0x3e9809[_0xe5c7('0x1e')]?_0x3e9809['options']['limit']||null:null,'include':_0x3e9809[_0xe5c7('0x1e')]?_0x3e9809['options'][_0xe5c7('0x21')]?_[_0xe5c7('0x22')](_0x3e9809['options'][_0xe5c7('0x21')],function(_0x327c88){return{'model':db[_0x327c88[_0xe5c7('0x23')]],'as':_0x327c88['as'],'attributes':_0x327c88[_0xe5c7('0x24')],'include':_0x327c88['include']?_[_0xe5c7('0x22')](_0x327c88['include'],function(_0x258a6e){return{'model':db[_0x258a6e['model']],'as':_0x258a6e['as'],'attributes':_0x258a6e[_0xe5c7('0x24')],'include':_0x258a6e['include']?_['map'](_0x258a6e[_0xe5c7('0x21')],function(_0x2ac0f3){return{'model':db[_0x2ac0f3['model']],'as':_0x2ac0f3['as'],'attributes':_0x2ac0f3[_0xe5c7('0x24')]};}):[]};}):[]};}):[]:[]})[_0xe5c7('0x10')](function(_0x18fda8){logger[_0xe5c7('0x18')]('GetMailQueue',_0x3e9809);logger[_0xe5c7('0x13')]('GetMailQueue',_0x3e9809,JSON[_0xe5c7('0x15')](_0x18fda8));_0x4c76c7(_0x18fda8);})[_0xe5c7('0x1a')](function(_0x309df0){logger['error'](_0xe5c7('0x1b'),_0x309df0[_0xe5c7('0x17')],_0x3e9809);_0x23e8b2(_0x2a3665[_0xe5c7('0x16')](0x1f4,_0x309df0[_0xe5c7('0x17')]));});});};exports[_0xe5c7('0x25')]=function(_0x5b8c5a){var _0x516bb8=this;return new Promise(function(_0x606ad7,_0xf5303){return db[_0xe5c7('0x1c')][_0xe5c7('0x26')]({'raw':_0x5b8c5a['options']?_0x5b8c5a['options'][_0xe5c7('0x1f')]===undefined?!![]:![]:!![],'where':_0x5b8c5a[_0xe5c7('0x1e')]?_0x5b8c5a[_0xe5c7('0x1e')][_0xe5c7('0x20')]||null:null,'attributes':_0x5b8c5a[_0xe5c7('0x1e')]?_0x5b8c5a[_0xe5c7('0x1e')][_0xe5c7('0x24')]||null:null,'include':_0x5b8c5a[_0xe5c7('0x1e')]?_0x5b8c5a['options'][_0xe5c7('0x21')]?_['map'](_0x5b8c5a[_0xe5c7('0x1e')][_0xe5c7('0x21')],function(_0x5ed082){return{'model':db[_0x5ed082[_0xe5c7('0x23')]],'as':_0x5ed082['as'],'attributes':_0x5ed082[_0xe5c7('0x24')],'include':_0x5ed082[_0xe5c7('0x21')]?_[_0xe5c7('0x22')](_0x5ed082['include'],function(_0x473136){return{'model':db[_0x473136['model']],'as':_0x473136['as'],'attributes':_0x473136['attributes'],'include':_0x473136[_0xe5c7('0x21')]?_[_0xe5c7('0x22')](_0x473136[_0xe5c7('0x21')],function(_0x50391d){return{'model':db[_0x50391d['model']],'as':_0x50391d['as'],'attributes':_0x50391d[_0xe5c7('0x24')]};}):[]};}):[]};}):[]:[]})[_0xe5c7('0x10')](function(_0x2ead0c){logger[_0xe5c7('0x18')]('ShowMailQueue',_0x5b8c5a);logger[_0xe5c7('0x13')](_0xe5c7('0x25'),_0x5b8c5a,JSON['stringify'](_0x2ead0c));_0x606ad7(_0x2ead0c);})[_0xe5c7('0x1a')](function(_0x51af7b){logger[_0xe5c7('0x16')](_0xe5c7('0x25'),_0x51af7b[_0xe5c7('0x17')],_0x5b8c5a);_0xf5303(_0x516bb8[_0xe5c7('0x16')](0x1f4,_0x51af7b[_0xe5c7('0x17')]));});});}; \ No newline at end of file +var _0x6002=['../../config/utils','../../config/logger','client','http','redis','./mailQueue.socket','register','request','then','info','request\x20sent','stringify','error','message','MailQueue,\x20%s,\x20%s','GetMailQueue','MailQueue','options','raw','where','attributes','map','include','model','ShowMailQueue','find','debug','catch','lodash','util','bluebird','randomstring','../../mysqldb'];(function(_0x35ab0a,_0x148476){var _0x15c29b=function(_0x460736){while(--_0x460736){_0x35ab0a['push'](_0x35ab0a['shift']());}};_0x15c29b(++_0x148476);}(_0x6002,0x103));var _0x2600=function(_0x14e379,_0x25e449){_0x14e379=_0x14e379-0x0;var _0x125a12=_0x6002[_0x14e379];return _0x125a12;};'use strict';var _=require(_0x2600('0x0'));var util=require(_0x2600('0x1'));var moment=require('moment');var BPromise=require(_0x2600('0x2'));var rs=require(_0x2600('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2600('0x4'))['db'];var utils=require(_0x2600('0x5'));var logger=require(_0x2600('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2600('0x7')][_0x2600('0x8')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2600('0x9')]));require(_0x2600('0xa'))[_0x2600('0xb')](socket);function respondWithRpcPromise(_0x5ffacf,_0xf66a15,_0x271ea4){return new BPromise(function(_0x495031,_0x1ec1bc){return client[_0x2600('0xc')](_0x5ffacf,_0x271ea4)[_0x2600('0xd')](function(_0x1e8d3c){logger[_0x2600('0xe')]('MailQueue,\x20%s,\x20%s',_0xf66a15,_0x2600('0xf'));logger['debug']('MailQueue,\x20%s,\x20%s,\x20%s',_0xf66a15,_0x2600('0xf'),JSON[_0x2600('0x10')](_0x1e8d3c));if(_0x1e8d3c[_0x2600('0x11')]){if(_0x1e8d3c[_0x2600('0x11')]['code']===0x1f4){logger['error']('MailQueue,\x20%s,\x20%s',_0xf66a15,_0x1e8d3c[_0x2600('0x11')][_0x2600('0x12')]);return _0x1ec1bc(_0x1e8d3c['error'][_0x2600('0x12')]);}logger[_0x2600('0x11')]('MailQueue,\x20%s,\x20%s',_0xf66a15,_0x1e8d3c[_0x2600('0x11')][_0x2600('0x12')]);return _0x495031(_0x1e8d3c[_0x2600('0x11')]['message']);}else{logger[_0x2600('0xe')](_0x2600('0x13'),_0xf66a15,_0x2600('0xf'));_0x495031(_0x1e8d3c['result']['message']);}})['catch'](function(_0x3e3769){logger[_0x2600('0x11')](_0x2600('0x13'),_0xf66a15,_0x3e3769);_0x1ec1bc(_0x3e3769);});});}exports[_0x2600('0x14')]=function(_0x18bb11){var _0x584ccf=this;return new Promise(function(_0x3e8774,_0x1c3386){return db[_0x2600('0x15')]['findAll']({'raw':_0x18bb11['options']?_0x18bb11[_0x2600('0x16')][_0x2600('0x17')]===undefined?!![]:![]:!![],'where':_0x18bb11['options']?_0x18bb11[_0x2600('0x16')][_0x2600('0x18')]||null:null,'attributes':_0x18bb11[_0x2600('0x16')]?_0x18bb11[_0x2600('0x16')][_0x2600('0x19')]||null:null,'limit':_0x18bb11[_0x2600('0x16')]?_0x18bb11[_0x2600('0x16')]['limit']||null:null,'include':_0x18bb11[_0x2600('0x16')]?_0x18bb11['options']['include']?_[_0x2600('0x1a')](_0x18bb11['options'][_0x2600('0x1b')],function(_0x9f4e35){return{'model':db[_0x9f4e35[_0x2600('0x1c')]],'as':_0x9f4e35['as'],'attributes':_0x9f4e35[_0x2600('0x19')],'include':_0x9f4e35[_0x2600('0x1b')]?_['map'](_0x9f4e35[_0x2600('0x1b')],function(_0x13cf91){return{'model':db[_0x13cf91[_0x2600('0x1c')]],'as':_0x13cf91['as'],'attributes':_0x13cf91[_0x2600('0x19')],'include':_0x13cf91['include']?_[_0x2600('0x1a')](_0x13cf91['include'],function(_0x1e3c22){return{'model':db[_0x1e3c22[_0x2600('0x1c')]],'as':_0x1e3c22['as'],'attributes':_0x1e3c22[_0x2600('0x19')]};}):[]};}):[]};}):[]:[]})[_0x2600('0xd')](function(_0x487b80){logger[_0x2600('0xe')](_0x2600('0x14'),_0x18bb11);logger['debug']('GetMailQueue',_0x18bb11,JSON[_0x2600('0x10')](_0x487b80));_0x3e8774(_0x487b80);})['catch'](function(_0x5711af){logger[_0x2600('0x11')](_0x2600('0x14'),_0x5711af[_0x2600('0x12')],_0x18bb11);_0x1c3386(_0x584ccf[_0x2600('0x11')](0x1f4,_0x5711af['message']));});});};exports[_0x2600('0x1d')]=function(_0x16b0fe){var _0x1f545d=this;return new Promise(function(_0x3b9e4a,_0x3d2bf8){return db['MailQueue'][_0x2600('0x1e')]({'raw':_0x16b0fe[_0x2600('0x16')]?_0x16b0fe[_0x2600('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x16b0fe[_0x2600('0x16')]?_0x16b0fe[_0x2600('0x16')]['where']||null:null,'attributes':_0x16b0fe[_0x2600('0x16')]?_0x16b0fe['options'][_0x2600('0x19')]||null:null,'include':_0x16b0fe[_0x2600('0x16')]?_0x16b0fe[_0x2600('0x16')][_0x2600('0x1b')]?_[_0x2600('0x1a')](_0x16b0fe[_0x2600('0x16')][_0x2600('0x1b')],function(_0x3ddacb){return{'model':db[_0x3ddacb[_0x2600('0x1c')]],'as':_0x3ddacb['as'],'attributes':_0x3ddacb[_0x2600('0x19')],'include':_0x3ddacb[_0x2600('0x1b')]?_[_0x2600('0x1a')](_0x3ddacb['include'],function(_0x4d64f3){return{'model':db[_0x4d64f3[_0x2600('0x1c')]],'as':_0x4d64f3['as'],'attributes':_0x4d64f3['attributes'],'include':_0x4d64f3['include']?_[_0x2600('0x1a')](_0x4d64f3[_0x2600('0x1b')],function(_0x546553){return{'model':db[_0x546553['model']],'as':_0x546553['as'],'attributes':_0x546553['attributes']};}):[]};}):[]};}):[]:[]})[_0x2600('0xd')](function(_0x4cf888){logger[_0x2600('0xe')]('ShowMailQueue',_0x16b0fe);logger[_0x2600('0x1f')](_0x2600('0x1d'),_0x16b0fe,JSON[_0x2600('0x10')](_0x4cf888));_0x3b9e4a(_0x4cf888);})[_0x2600('0x20')](function(_0x59e9a2){logger[_0x2600('0x11')]('ShowMailQueue',_0x59e9a2[_0x2600('0x12')],_0x16b0fe);_0x3d2bf8(_0x1f545d[_0x2600('0x11')](0x1f4,_0x59e9a2[_0x2600('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 801a1cc..a740258 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 _0xe62a=['mailQueue:','./mailQueue.events','save','emit','removeListener','register','length'];(function(_0x2e476a,_0x1c655d){var _0x188142=function(_0x4936ef){while(--_0x4936ef){_0x2e476a['push'](_0x2e476a['shift']());}};_0x188142(++_0x1c655d);}(_0xe62a,0x143));var _0xae62=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0xe62a[_0x53ccf2];return _0x5a2964;};'use strict';var MailQueueEvents=require(_0xae62('0x0'));var events=[_0xae62('0x1'),'remove','update'];function createListener(_0x4b6bce,_0x10f15b){return function(_0x37923c){_0x10f15b[_0xae62('0x2')](_0x4b6bce,_0x37923c);};}function removeListener(_0x3ce754,_0x2bb2ba){return function(){MailQueueEvents[_0xae62('0x3')](_0x3ce754,_0x2bb2ba);};}exports[_0xae62('0x4')]=function(_0x1c69d8){for(var _0x10a5dd=0x0,_0x362244=events[_0xae62('0x5')];_0x10a5dd<_0x362244;_0x10a5dd++){var _0x2a8d24=events[_0x10a5dd];var _0x891ab3=createListener(_0xae62('0x6')+_0x2a8d24,_0x1c69d8);MailQueueEvents['on'](_0x2a8d24,_0x891ab3);}}; \ No newline at end of file +var _0x5862=['update','emit','register','length','mailQueue:','./mailQueue.events'];(function(_0x12b667,_0x1686d2){var _0x52e605=function(_0x493f65){while(--_0x493f65){_0x12b667['push'](_0x12b667['shift']());}};_0x52e605(++_0x1686d2);}(_0x5862,0x137));var _0x2586=function(_0x2c781a,_0x58476e){_0x2c781a=_0x2c781a-0x0;var _0xb0e167=_0x5862[_0x2c781a];return _0xb0e167;};'use strict';var MailQueueEvents=require(_0x2586('0x0'));var events=['save','remove',_0x2586('0x1')];function createListener(_0x43e869,_0x488914){return function(_0x47ad9b){_0x488914[_0x2586('0x2')](_0x43e869,_0x47ad9b);};}function removeListener(_0x645fb4,_0x198c27){return function(){MailQueueEvents['removeListener'](_0x645fb4,_0x198c27);};}exports[_0x2586('0x3')]=function(_0x4ed0ec){for(var _0x10e111=0x0,_0x4fba35=events[_0x2586('0x4')];_0x10e111<_0x4fba35;_0x10e111++){var _0x546b7d=events[_0x10e111];var _0x3ca5b7=createListener(_0x2586('0x5')+_0x546b7d,_0x4ed0ec);MailQueueEvents['on'](_0x546b7d,_0x3ca5b7);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 96154c6..5f1d04d 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 _0x2f7a=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','isAuthenticated','index','get','describe','show','create','/:id','destroy','exports'];(function(_0x27188e,_0x2cb7b7){var _0x466456=function(_0x2b9758){while(--_0x2b9758){_0x27188e['push'](_0x27188e['shift']());}};_0x466456(++_0x2cb7b7);}(_0x2f7a,0xc8));var _0xa2f7=function(_0x5ca3ec,_0x1f6dc4){_0x5ca3ec=_0x5ca3ec-0x0;var _0x1eb84f=_0x2f7a[_0x5ca3ec];return _0x1eb84f;};'use strict';var multer=require(_0xa2f7('0x0'));var util=require(_0xa2f7('0x1'));var path=require(_0xa2f7('0x2'));var timeout=require(_0xa2f7('0x3'));var express=require(_0xa2f7('0x4'));var router=express[_0xa2f7('0x5')]();var fs_extra=require(_0xa2f7('0x6'));var auth=require(_0xa2f7('0x7'));var interaction=require(_0xa2f7('0x8'));var config=require(_0xa2f7('0x9'));var controller=require(_0xa2f7('0xa'));router['get']('/',auth[_0xa2f7('0xb')](),controller[_0xa2f7('0xc')]);router[_0xa2f7('0xd')]('/describe',auth[_0xa2f7('0xb')](),controller[_0xa2f7('0xe')]);router[_0xa2f7('0xd')]('/:id',auth[_0xa2f7('0xb')](),controller[_0xa2f7('0xf')]);router['post']('/',auth[_0xa2f7('0xb')](),controller[_0xa2f7('0x10')]);router['put']('/:id',auth[_0xa2f7('0xb')](),controller['update']);router['delete'](_0xa2f7('0x11'),auth[_0xa2f7('0xb')](),controller[_0xa2f7('0x12')]);module[_0xa2f7('0x13')]=router; \ No newline at end of file +var _0x6b1e=['/:id','isAuthenticated','show','put','update','delete','destroy','util','path','Router','fs-extra','../../components/auth/service','../../config/environment','./mailQueueReport.controller','get','/describe','describe'];(function(_0x23a4bc,_0x37a04b){var _0x6047a9=function(_0x52f82c){while(--_0x52f82c){_0x23a4bc['push'](_0x23a4bc['shift']());}};_0x6047a9(++_0x37a04b);}(_0x6b1e,0x128));var _0xe6b1=function(_0x5032b6,_0x48ad96){_0x5032b6=_0x5032b6-0x0;var _0x25dcba=_0x6b1e[_0x5032b6];return _0x25dcba;};'use strict';var multer=require('multer');var util=require(_0xe6b1('0x0'));var path=require(_0xe6b1('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe6b1('0x2')]();var fs_extra=require(_0xe6b1('0x3'));var auth=require(_0xe6b1('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xe6b1('0x5'));var controller=require(_0xe6b1('0x6'));router[_0xe6b1('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xe6b1('0x7')](_0xe6b1('0x8'),auth['isAuthenticated'](),controller[_0xe6b1('0x9')]);router[_0xe6b1('0x7')](_0xe6b1('0xa'),auth[_0xe6b1('0xb')](),controller[_0xe6b1('0xc')]);router['post']('/',auth[_0xe6b1('0xb')](),controller['create']);router[_0xe6b1('0xd')]('/:id',auth[_0xe6b1('0xb')](),controller[_0xe6b1('0xe')]);router[_0xe6b1('0xf')]('/:id',auth[_0xe6b1('0xb')](),controller[_0xe6b1('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index c102e46..a25be6d 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 _0xde41=['STRING','DATE','moment','sequelize','exports'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xde41,0xcf));var _0x1de4=function(_0x14d23c,_0x183d99){_0x14d23c=_0x14d23c-0x0;var _0x48524f=_0xde41[_0x14d23c];return _0x48524f;};'use strict';var moment=require(_0x1de4('0x0'));var Sequelize=require(_0x1de4('0x1'));module[_0x1de4('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x1de4('0x3')]},'joinAt':{'type':Sequelize[_0x1de4('0x4')]},'leaveAt':{'type':Sequelize[_0x1de4('0x4')]},'acceptAt':{'type':Sequelize[_0x1de4('0x4')]},'exitAt':{'type':Sequelize[_0x1de4('0x4')]},'reason':{'type':Sequelize[_0x1de4('0x3')]}}; \ No newline at end of file +var _0xf1bc=['exports','STRING','DATE','sequelize'];(function(_0x3dc14a,_0x4dabd6){var _0x3959fb=function(_0x2a9ce7){while(--_0x2a9ce7){_0x3dc14a['push'](_0x3dc14a['shift']());}};_0x3959fb(++_0x4dabd6);}(_0xf1bc,0x117));var _0xcf1b=function(_0x688f5a,_0x150ef3){_0x688f5a=_0x688f5a-0x0;var _0x8d8b3f=_0xf1bc[_0x688f5a];return _0x8d8b3f;};'use strict';var moment=require('moment');var Sequelize=require(_0xcf1b('0x0'));module[_0xcf1b('0x1')]={'uniqueid':{'type':Sequelize[_0xcf1b('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xcf1b('0x2')]},'joinAt':{'type':Sequelize[_0xcf1b('0x3')]},'leaveAt':{'type':Sequelize[_0xcf1b('0x3')]},'acceptAt':{'type':Sequelize[_0xcf1b('0x3')]},'exitAt':{'type':Sequelize[_0xcf1b('0x3')]},'reason':{'type':Sequelize[_0xcf1b('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 301ccd9..5662cc3 100644 --- a/server/api/mailQueueReport/mailQueueReport.controller.js +++ b/server/api/mailQueueReport/mailQueueReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4991=['hasOwnProperty','nolimit','order','sort','where','merge','type','filter','options','MailQueueReport','includeAll','include','findAll','rows','show','params','keys','find','create','body','catch','describe','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','map','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length'];(function(_0x477a41,_0x396f0d){var _0x3db51f=function(_0x1f253c){while(--_0x1f253c){_0x477a41['push'](_0x477a41['shift']());}};_0x3db51f(++_0x396f0d);}(_0x4991,0xf7));var _0x1499=function(_0x13ff0f,_0x3f6d1d){_0x13ff0f=_0x13ff0f-0x0;var _0x4aaa81=_0x4991[_0x13ff0f];return _0x4aaa81;};'use strict';var emlformat=require(_0x1499('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1499('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1499('0x2'));var moment=require(_0x1499('0x3'));var BPromise=require(_0x1499('0x4'));var Mustache=require(_0x1499('0x5'));var util=require(_0x1499('0x6'));var path=require(_0x1499('0x7'));var sox=require(_0x1499('0x8'));var csv=require(_0x1499('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1499('0xa'));var _=require(_0x1499('0xb'));var squel=require(_0x1499('0xc'));var crypto=require(_0x1499('0xd'));var jsforce=require(_0x1499('0xe'));var deskjs=require(_0x1499('0xf'));var toCsv=require(_0x1499('0x9'));var querystring=require(_0x1499('0x10'));var Papa=require('papaparse');var Redis=require(_0x1499('0x11'));var authService=require(_0x1499('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x1499('0x13'));var hardwareService=require(_0x1499('0x14'));var logger=require('../../config/logger')(_0x1499('0x15'));var utils=require(_0x1499('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3039ce,_0x274bc1){_0x274bc1=_0x274bc1||0xcc;return function(_0x34a928){if(_0x34a928){return _0x3039ce[_0x1499('0x17')](_0x274bc1);}return _0x3039ce[_0x1499('0x18')](_0x274bc1)['end']();};}function respondWithResult(_0x5f34f2,_0x308177){_0x308177=_0x308177||0xc8;return function(_0x4e5195){if(_0x4e5195){return _0x5f34f2[_0x1499('0x18')](_0x308177)[_0x1499('0x19')](_0x4e5195);}};}function respondWithFilteredResult(_0x308318,_0x3ab605){return function(_0x48f654){if(_0x48f654){var _0x1ed43b=typeof _0x3ab605[_0x1499('0x1a')]==='undefined'&&typeof _0x3ab605[_0x1499('0x1b')]===_0x1499('0x1c');var _0x46b364=_0x48f654[_0x1499('0x1d')];var _0x1e45a9=_0x1ed43b?0x0:_0x3ab605[_0x1499('0x1a')];var _0x5b9859=_0x1ed43b?_0x48f654['count']:_0x3ab605['offset']+_0x3ab605[_0x1499('0x1b')];var _0xad534b;if(_0x5b9859>=_0x46b364){_0x5b9859=_0x46b364;_0xad534b=0xc8;}else{_0xad534b=0xce;}_0x308318['status'](_0xad534b);return _0x308318[_0x1499('0x1e')](_0x1499('0x1f'),_0x1e45a9+'-'+_0x5b9859+'/'+_0x46b364)[_0x1499('0x19')](_0x48f654);}return null;};}function patchUpdates(_0x18e4a6){return function(_0x21e887){try{jsonpatch[_0x1499('0x20')](_0x21e887,_0x18e4a6,!![]);}catch(_0x2b0458){return BPromise[_0x1499('0x21')](_0x2b0458);}return _0x21e887[_0x1499('0x22')]();};}function saveUpdates(_0x15bcd4,_0x2bb71f){return function(_0x836081){if(_0x836081){return _0x836081[_0x1499('0x23')](_0x15bcd4)[_0x1499('0x24')](function(_0x4ec57a){return _0x4ec57a;});}return null;};}function removeEntity(_0x1e2c51,_0x2c7f57){return function(_0x5615b4){if(_0x5615b4){return _0x5615b4[_0x1499('0x25')]()[_0x1499('0x24')](function(){_0x1e2c51[_0x1499('0x18')](0xcc)[_0x1499('0x26')]();});}};}function handleEntityNotFound(_0x3968e0,_0x16d036){return function(_0x54f3c2){if(!_0x54f3c2){_0x3968e0['sendStatus'](0x194);}return _0x54f3c2;};}function handleError(_0x12739b,_0x3c9aca){_0x3c9aca=_0x3c9aca||0x1f4;return function(_0x3b9259){logger[_0x1499('0x27')](_0x3b9259[_0x1499('0x28')]);if(_0x3b9259['name']){delete _0x3b9259[_0x1499('0x29')];}_0x12739b['status'](_0x3c9aca)['send'](_0x3b9259);};}exports['index']=function(_0x21d204,_0x103efa){var _0x40932a={},_0x1b460b={},_0x3dad86={'count':0x0,'rows':[]};var _0x388513=_[_0x1499('0x2a')](db['MailQueueReport'][_0x1499('0x2b')],function(_0x1a2c99){return{'name':_0x1a2c99[_0x1499('0x2c')],'type':_0x1a2c99['type'][_0x1499('0x2d')]};});_0x1b460b[_0x1499('0x2e')]=_['map'](_0x388513,_0x1499('0x29'));_0x1b460b[_0x1499('0x2f')]=_['keys'](_0x21d204[_0x1499('0x2f')]);_0x1b460b[_0x1499('0x30')]=_[_0x1499('0x31')](_0x1b460b[_0x1499('0x2e')],_0x1b460b[_0x1499('0x2f')]);_0x40932a[_0x1499('0x32')]=_[_0x1499('0x31')](_0x1b460b[_0x1499('0x2e')],qs[_0x1499('0x33')](_0x21d204[_0x1499('0x2f')][_0x1499('0x33')]));_0x40932a[_0x1499('0x32')]=_0x40932a[_0x1499('0x32')][_0x1499('0x34')]?_0x40932a[_0x1499('0x32')]:_0x1b460b[_0x1499('0x2e')];if(!_0x21d204[_0x1499('0x2f')][_0x1499('0x35')](_0x1499('0x36'))){_0x40932a[_0x1499('0x1b')]=qs['limit'](_0x21d204[_0x1499('0x2f')][_0x1499('0x1b')]);_0x40932a[_0x1499('0x1a')]=qs[_0x1499('0x1a')](_0x21d204[_0x1499('0x2f')][_0x1499('0x1a')]);}_0x40932a[_0x1499('0x37')]=qs[_0x1499('0x38')](_0x21d204[_0x1499('0x2f')][_0x1499('0x38')]);_0x40932a[_0x1499('0x39')]=qs['filters'](_['pick'](_0x21d204[_0x1499('0x2f')],_0x1b460b['filters']),_0x388513);if(_0x21d204[_0x1499('0x2f')]['filter']){_0x40932a[_0x1499('0x39')]=_[_0x1499('0x3a')](_0x40932a[_0x1499('0x39')],{'$or':_[_0x1499('0x2a')](_0x388513,function(_0x531933){if(_0x531933[_0x1499('0x3b')]!=='VIRTUAL'){var _0x2f9c59={};_0x2f9c59[_0x531933[_0x1499('0x29')]]={'$like':'%'+_0x21d204[_0x1499('0x2f')][_0x1499('0x3c')]+'%'};return _0x2f9c59;}})});}_0x40932a=_['merge']({},_0x40932a,_0x21d204[_0x1499('0x3d')]);var _0x815a99={'where':_0x40932a[_0x1499('0x39')]};return db[_0x1499('0x3e')]['count'](_0x815a99)[_0x1499('0x24')](function(_0x4cc411){_0x3dad86[_0x1499('0x1d')]=_0x4cc411;if(_0x21d204[_0x1499('0x2f')][_0x1499('0x3f')]){_0x40932a[_0x1499('0x40')]=[{'all':!![]}];}return db[_0x1499('0x3e')][_0x1499('0x41')](_0x40932a);})[_0x1499('0x24')](function(_0xcb85eb){_0x3dad86[_0x1499('0x42')]=_0xcb85eb;return _0x3dad86;})[_0x1499('0x24')](respondWithFilteredResult(_0x103efa,_0x40932a))['catch'](handleError(_0x103efa,null));};exports[_0x1499('0x43')]=function(_0x5dd36c,_0x2cfdaf){var _0x1af1a1={'raw':!![],'where':{'id':_0x5dd36c[_0x1499('0x44')]['id']}},_0x5646cf={};_0x5646cf[_0x1499('0x2e')]=_[_0x1499('0x45')](db[_0x1499('0x3e')][_0x1499('0x2b')]);_0x5646cf['query']=_['keys'](_0x5dd36c[_0x1499('0x2f')]);_0x5646cf[_0x1499('0x30')]=_['intersection'](_0x5646cf[_0x1499('0x2e')],_0x5646cf[_0x1499('0x2f')]);_0x1af1a1['attributes']=_['intersection'](_0x5646cf[_0x1499('0x2e')],qs[_0x1499('0x33')](_0x5dd36c[_0x1499('0x2f')]['fields']));_0x1af1a1[_0x1499('0x32')]=_0x1af1a1[_0x1499('0x32')][_0x1499('0x34')]?_0x1af1a1[_0x1499('0x32')]:_0x5646cf['model'];if(_0x5dd36c[_0x1499('0x2f')][_0x1499('0x3f')]){_0x1af1a1[_0x1499('0x40')]=[{'all':!![]}];}_0x1af1a1=_[_0x1499('0x3a')]({},_0x1af1a1,_0x5dd36c['options']);return db[_0x1499('0x3e')][_0x1499('0x46')](_0x1af1a1)[_0x1499('0x24')](handleEntityNotFound(_0x2cfdaf,null))['then'](respondWithResult(_0x2cfdaf,null))['catch'](handleError(_0x2cfdaf,null));};exports[_0x1499('0x47')]=function(_0x491777,_0x7fa101){return db[_0x1499('0x3e')][_0x1499('0x47')](_0x491777[_0x1499('0x48')],{})[_0x1499('0x24')](respondWithResult(_0x7fa101,0xc9))[_0x1499('0x49')](handleError(_0x7fa101,null));};exports[_0x1499('0x23')]=function(_0x591aa8,_0x420d16){if(_0x591aa8['body']['id']){delete _0x591aa8[_0x1499('0x48')]['id'];}return db[_0x1499('0x3e')]['find']({'where':{'id':_0x591aa8[_0x1499('0x44')]['id']}})[_0x1499('0x24')](handleEntityNotFound(_0x420d16,null))[_0x1499('0x24')](saveUpdates(_0x591aa8['body'],null))[_0x1499('0x24')](respondWithResult(_0x420d16,null))[_0x1499('0x49')](handleError(_0x420d16,null));};exports[_0x1499('0x25')]=function(_0x29ac0f,_0x305599){return db[_0x1499('0x3e')][_0x1499('0x46')]({'where':{'id':_0x29ac0f[_0x1499('0x44')]['id']}})[_0x1499('0x24')](handleEntityNotFound(_0x305599,null))[_0x1499('0x24')](removeEntity(_0x305599,null))['catch'](handleError(_0x305599,null));};exports[_0x1499('0x4a')]=function(_0x9f0520,_0x278178){return db['MailQueueReport'][_0x1499('0x4a')]()[_0x1499('0x24')](respondWithResult(_0x278178,null))['catch'](handleError(_0x278178,null));}; \ No newline at end of file +var _0xaebd=['zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','stack','send','index','map','fieldName','type','key','model','name','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','includeAll','include','findAll','catch','params','MailQueueReport','options','create','body','find','describe','eml-format'];(function(_0x8b40fc,_0x13a66e){var _0x5a2b2b=function(_0x3c8509){while(--_0x3c8509){_0x8b40fc['push'](_0x8b40fc['shift']());}};_0x5a2b2b(++_0x13a66e);}(_0xaebd,0x1e9));var _0xdaeb=function(_0x3a9cfa,_0x59a479){_0x3a9cfa=_0x3a9cfa-0x0;var _0x8c1be=_0xaebd[_0x3a9cfa];return _0x8c1be;};'use strict';var emlformat=require(_0xdaeb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdaeb('0x1'));var jsonpatch=require(_0xdaeb('0x2'));var rp=require(_0xdaeb('0x3'));var moment=require(_0xdaeb('0x4'));var BPromise=require(_0xdaeb('0x5'));var Mustache=require('mustache');var util=require(_0xdaeb('0x6'));var path=require(_0xdaeb('0x7'));var sox=require(_0xdaeb('0x8'));var csv=require(_0xdaeb('0x9'));var ejs=require(_0xdaeb('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdaeb('0xb'));var squel=require(_0xdaeb('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xdaeb('0xd'));var toCsv=require(_0xdaeb('0x9'));var querystring=require(_0xdaeb('0xe'));var Papa=require('papaparse');var Redis=require(_0xdaeb('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xdaeb('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdaeb('0x11'));var logger=require('../../config/logger')(_0xdaeb('0x12'));var utils=require(_0xdaeb('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xdaeb('0x14'))['db'];function respondWithStatusCode(_0x5aedaa,_0x4ee3cc){_0x4ee3cc=_0x4ee3cc||0xcc;return function(_0x2673db){if(_0x2673db){return _0x5aedaa[_0xdaeb('0x15')](_0x4ee3cc);}return _0x5aedaa[_0xdaeb('0x16')](_0x4ee3cc)[_0xdaeb('0x17')]();};}function respondWithResult(_0x1f31be,_0xc6c611){_0xc6c611=_0xc6c611||0xc8;return function(_0x49ba9a){if(_0x49ba9a){return _0x1f31be['status'](_0xc6c611)[_0xdaeb('0x18')](_0x49ba9a);}};}function respondWithFilteredResult(_0x306bdb,_0x34b2fe){return function(_0x18ec4e){if(_0x18ec4e){var _0x538a25=typeof _0x34b2fe['offset']===_0xdaeb('0x19')&&typeof _0x34b2fe['limit']==='undefined';var _0x42e509=_0x18ec4e[_0xdaeb('0x1a')];var _0x1b5243=_0x538a25?0x0:_0x34b2fe[_0xdaeb('0x1b')];var _0x2d8f11=_0x538a25?_0x18ec4e[_0xdaeb('0x1a')]:_0x34b2fe['offset']+_0x34b2fe[_0xdaeb('0x1c')];var _0x5ccf66;if(_0x2d8f11>=_0x42e509){_0x2d8f11=_0x42e509;_0x5ccf66=0xc8;}else{_0x5ccf66=0xce;}_0x306bdb[_0xdaeb('0x16')](_0x5ccf66);return _0x306bdb[_0xdaeb('0x1d')](_0xdaeb('0x1e'),_0x1b5243+'-'+_0x2d8f11+'/'+_0x42e509)['json'](_0x18ec4e);}return null;};}function patchUpdates(_0x4e97e0){return function(_0x13563c){try{jsonpatch[_0xdaeb('0x1f')](_0x13563c,_0x4e97e0,!![]);}catch(_0x23fccb){return BPromise[_0xdaeb('0x20')](_0x23fccb);}return _0x13563c[_0xdaeb('0x21')]();};}function saveUpdates(_0x536aae,_0x597bb7){return function(_0x2c969d){if(_0x2c969d){return _0x2c969d[_0xdaeb('0x22')](_0x536aae)[_0xdaeb('0x23')](function(_0x1d919a){return _0x1d919a;});}return null;};}function removeEntity(_0x39dfae,_0x55c825){return function(_0x254c3b){if(_0x254c3b){return _0x254c3b['destroy']()[_0xdaeb('0x23')](function(){_0x39dfae[_0xdaeb('0x16')](0xcc)[_0xdaeb('0x17')]();});}};}function handleEntityNotFound(_0x3b0770,_0x32c2c1){return function(_0x4fc3e2){if(!_0x4fc3e2){_0x3b0770[_0xdaeb('0x15')](0x194);}return _0x4fc3e2;};}function handleError(_0x34fa21,_0x338687){_0x338687=_0x338687||0x1f4;return function(_0x4eb719){logger['error'](_0x4eb719[_0xdaeb('0x24')]);if(_0x4eb719['name']){delete _0x4eb719['name'];}_0x34fa21[_0xdaeb('0x16')](_0x338687)[_0xdaeb('0x25')](_0x4eb719);};}exports[_0xdaeb('0x26')]=function(_0x5eb7b5,_0x5e6f97){var _0x32966f={},_0x440022={},_0x37f468={'count':0x0,'rows':[]};var _0x596c19=_[_0xdaeb('0x27')](db['MailQueueReport']['rawAttributes'],function(_0x28812c){return{'name':_0x28812c[_0xdaeb('0x28')],'type':_0x28812c[_0xdaeb('0x29')][_0xdaeb('0x2a')]};});_0x440022[_0xdaeb('0x2b')]=_[_0xdaeb('0x27')](_0x596c19,_0xdaeb('0x2c'));_0x440022['query']=_[_0xdaeb('0x2d')](_0x5eb7b5[_0xdaeb('0x2e')]);_0x440022[_0xdaeb('0x2f')]=_[_0xdaeb('0x30')](_0x440022[_0xdaeb('0x2b')],_0x440022['query']);_0x32966f[_0xdaeb('0x31')]=_[_0xdaeb('0x30')](_0x440022['model'],qs[_0xdaeb('0x32')](_0x5eb7b5[_0xdaeb('0x2e')][_0xdaeb('0x32')]));_0x32966f[_0xdaeb('0x31')]=_0x32966f[_0xdaeb('0x31')][_0xdaeb('0x33')]?_0x32966f[_0xdaeb('0x31')]:_0x440022[_0xdaeb('0x2b')];if(!_0x5eb7b5[_0xdaeb('0x2e')][_0xdaeb('0x34')]('nolimit')){_0x32966f['limit']=qs[_0xdaeb('0x1c')](_0x5eb7b5['query'][_0xdaeb('0x1c')]);_0x32966f[_0xdaeb('0x1b')]=qs[_0xdaeb('0x1b')](_0x5eb7b5[_0xdaeb('0x2e')][_0xdaeb('0x1b')]);}_0x32966f[_0xdaeb('0x35')]=qs['sort'](_0x5eb7b5[_0xdaeb('0x2e')][_0xdaeb('0x36')]);_0x32966f[_0xdaeb('0x37')]=qs['filters'](_[_0xdaeb('0x38')](_0x5eb7b5[_0xdaeb('0x2e')],_0x440022[_0xdaeb('0x2f')]),_0x596c19);if(_0x5eb7b5[_0xdaeb('0x2e')][_0xdaeb('0x39')]){_0x32966f[_0xdaeb('0x37')]=_[_0xdaeb('0x3a')](_0x32966f['where'],{'$or':_[_0xdaeb('0x27')](_0x596c19,function(_0x170009){if(_0x170009['type']!=='VIRTUAL'){var _0x2ef310={};_0x2ef310[_0x170009[_0xdaeb('0x2c')]]={'$like':'%'+_0x5eb7b5['query'][_0xdaeb('0x39')]+'%'};return _0x2ef310;}})});}_0x32966f=_[_0xdaeb('0x3a')]({},_0x32966f,_0x5eb7b5['options']);var _0x151cc4={'where':_0x32966f[_0xdaeb('0x37')]};return db['MailQueueReport']['count'](_0x151cc4)[_0xdaeb('0x23')](function(_0x11dce7){_0x37f468[_0xdaeb('0x1a')]=_0x11dce7;if(_0x5eb7b5[_0xdaeb('0x2e')][_0xdaeb('0x3b')]){_0x32966f[_0xdaeb('0x3c')]=[{'all':!![]}];}return db['MailQueueReport'][_0xdaeb('0x3d')](_0x32966f);})['then'](function(_0x46aa44){_0x37f468['rows']=_0x46aa44;return _0x37f468;})['then'](respondWithFilteredResult(_0x5e6f97,_0x32966f))[_0xdaeb('0x3e')](handleError(_0x5e6f97,null));};exports['show']=function(_0x5a42a6,_0x4efd96){var _0x45c3fc={'raw':!![],'where':{'id':_0x5a42a6[_0xdaeb('0x3f')]['id']}},_0x244369={};_0x244369[_0xdaeb('0x2b')]=_['keys'](db[_0xdaeb('0x40')]['rawAttributes']);_0x244369[_0xdaeb('0x2e')]=_[_0xdaeb('0x2d')](_0x5a42a6[_0xdaeb('0x2e')]);_0x244369['filters']=_[_0xdaeb('0x30')](_0x244369[_0xdaeb('0x2b')],_0x244369[_0xdaeb('0x2e')]);_0x45c3fc[_0xdaeb('0x31')]=_[_0xdaeb('0x30')](_0x244369[_0xdaeb('0x2b')],qs[_0xdaeb('0x32')](_0x5a42a6[_0xdaeb('0x2e')][_0xdaeb('0x32')]));_0x45c3fc[_0xdaeb('0x31')]=_0x45c3fc[_0xdaeb('0x31')][_0xdaeb('0x33')]?_0x45c3fc['attributes']:_0x244369[_0xdaeb('0x2b')];if(_0x5a42a6[_0xdaeb('0x2e')]['includeAll']){_0x45c3fc['include']=[{'all':!![]}];}_0x45c3fc=_[_0xdaeb('0x3a')]({},_0x45c3fc,_0x5a42a6[_0xdaeb('0x41')]);return db[_0xdaeb('0x40')]['find'](_0x45c3fc)[_0xdaeb('0x23')](handleEntityNotFound(_0x4efd96,null))[_0xdaeb('0x23')](respondWithResult(_0x4efd96,null))[_0xdaeb('0x3e')](handleError(_0x4efd96,null));};exports[_0xdaeb('0x42')]=function(_0x266d6b,_0x45344b){return db[_0xdaeb('0x40')][_0xdaeb('0x42')](_0x266d6b['body'],{})[_0xdaeb('0x23')](respondWithResult(_0x45344b,0xc9))[_0xdaeb('0x3e')](handleError(_0x45344b,null));};exports['update']=function(_0x38d2ee,_0x4dd70c){if(_0x38d2ee[_0xdaeb('0x43')]['id']){delete _0x38d2ee[_0xdaeb('0x43')]['id'];}return db[_0xdaeb('0x40')][_0xdaeb('0x44')]({'where':{'id':_0x38d2ee[_0xdaeb('0x3f')]['id']}})[_0xdaeb('0x23')](handleEntityNotFound(_0x4dd70c,null))[_0xdaeb('0x23')](saveUpdates(_0x38d2ee[_0xdaeb('0x43')],null))[_0xdaeb('0x23')](respondWithResult(_0x4dd70c,null))['catch'](handleError(_0x4dd70c,null));};exports['destroy']=function(_0x1403c8,_0x3112d2){return db[_0xdaeb('0x40')][_0xdaeb('0x44')]({'where':{'id':_0x1403c8[_0xdaeb('0x3f')]['id']}})[_0xdaeb('0x23')](handleEntityNotFound(_0x3112d2,null))['then'](removeEntity(_0x3112d2,null))[_0xdaeb('0x3e')](handleError(_0x3112d2,null));};exports[_0xdaeb('0x45')]=function(_0x3f6a88,_0x589442){return db[_0xdaeb('0x40')]['describe']()[_0xdaeb('0x23')](respondWithResult(_0x589442,null))[_0xdaeb('0x3e')](handleError(_0x589442,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 21497a2..1fb1fc2 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 _0xf58e=['../../config/logger','api','moment','bluebird','request-promise','path','./mailQueueReport.attributes','define','MailQueueReport','report_mail_queue','uniqueid','lodash'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0xf58e,0x1eb));var _0xef58=function(_0x5e90e8,_0x2a5af5){_0x5e90e8=_0x5e90e8-0x0;var _0x383f72=_0xf58e[_0x5e90e8];return _0x383f72;};'use strict';var _=require(_0xef58('0x0'));var util=require('util');var logger=require(_0xef58('0x1'))(_0xef58('0x2'));var moment=require(_0xef58('0x3'));var BPromise=require(_0xef58('0x4'));var rp=require(_0xef58('0x5'));var fs=require('fs');var path=require(_0xef58('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xef58('0x7'));module['exports']=function(_0xd81c01,_0x8787b3){return _0xd81c01[_0xef58('0x8')](_0xef58('0x9'),attributes,{'tableName':_0xef58('0xa'),'paranoid':![],'indexes':[{'name':_0xef58('0xb'),'fields':[_0xef58('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4f61=['../../config/environment','./mailQueueReport.attributes','exports','define','MailQueueReport','report_mail_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf'];(function(_0x26508c,_0x322993){var _0x116195=function(_0x4c37de){while(--_0x4c37de){_0x26508c['push'](_0x26508c['shift']());}};_0x116195(++_0x322993);}(_0x4f61,0x149));var _0x14f6=function(_0x388e51,_0x5e4a4d){_0x388e51=_0x388e51-0x0;var _0x5b6137=_0x4f61[_0x388e51];return _0x5b6137;};'use strict';var _=require(_0x14f6('0x0'));var util=require(_0x14f6('0x1'));var logger=require(_0x14f6('0x2'))('api');var moment=require(_0x14f6('0x3'));var BPromise=require(_0x14f6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x14f6('0x5'));var rimraf=require(_0x14f6('0x6'));var config=require(_0x14f6('0x7'));var attributes=require(_0x14f6('0x8'));module[_0x14f6('0x9')]=function(_0x1fbf17,_0x4f4291){return _0x1fbf17[_0x14f6('0xa')](_0x14f6('0xb'),attributes,{'tableName':_0x14f6('0xc'),'paranoid':![],'indexes':[{'name':_0x14f6('0xd'),'fields':[_0x14f6('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index a6bad80..b166935 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 _0x326f=['error','code','message','result','catch','CreateMailQueueReport','MailQueueReport','options','raw','stringify','UpdateMailQueueReport','body','attributes','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x5a64fc,_0x3a3e0a){var _0x183603=function(_0x2d2291){while(--_0x2d2291){_0x5a64fc['push'](_0x5a64fc['shift']());}};_0x183603(++_0x3a3e0a);}(_0x326f,0xd1));var _0xf326=function(_0x21837c,_0xa3d004){_0x21837c=_0x21837c-0x0;var _0x51ed9e=_0x326f[_0x21837c];return _0x51ed9e;};'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')]('MailQueueReport,\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')]('MailQueueReport,\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')]['create'](_0x453100['body'],{'raw':_0x453100['options']?_0x453100[_0xf326('0x16')][_0xf326('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x4cabce){logger[_0xf326('0xb')]('CreateMailQueueReport',_0x453100);logger['debug'](_0xf326('0x14'),_0x453100,JSON[_0xf326('0x18')](_0x4cabce));_0x31ffb9(_0x4cabce);})['catch'](function(_0x5aa184){logger[_0xf326('0xf')](_0xf326('0x14'),_0x5aa184['message'],_0x453100);_0xcef2b5(_0x18bee3[_0xf326('0xf')](0x1f4,_0x5aa184[_0xf326('0x11')]));});});};exports[_0xf326('0x19')]=function(_0x295752){var _0x17c157=this;return new Promise(function(_0x2049ec,_0x5ce532){return db['MailQueueReport']['update'](_0x295752[_0xf326('0x1a')],{'raw':_0x295752[_0xf326('0x16')]?_0x295752[_0xf326('0x16')][_0xf326('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x295752[_0xf326('0x16')]?_0x295752[_0xf326('0x16')]['where']||null:null,'attributes':_0x295752[_0xf326('0x16')]?_0x295752[_0xf326('0x16')][_0xf326('0x1b')]||null:null,'limit':_0x295752['options']?_0x295752[_0xf326('0x16')]['limit']||null:null})['then'](function(_0x6a8e89){logger[_0xf326('0xb')](_0xf326('0x19'),_0x295752);logger['debug'](_0xf326('0x19'),_0x295752,JSON[_0xf326('0x18')](_0x6a8e89));_0x2049ec(_0x6a8e89);})['catch'](function(_0x225776){logger[_0xf326('0xf')](_0xf326('0x19'),_0x225776[_0xf326('0x11')],_0x295752);_0x5ce532(_0x17c157[_0xf326('0xf')](0x1f4,_0x225776[_0xf326('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(_0x1bd662,_0x6f3911){var _0x2c1bb6=function(_0x24663f){while(--_0x24663f){_0x1bd662['push'](_0x1bd662['shift']());}};_0x2c1bb6(++_0x6f3911);}(_0xadb5,0xad));var _0x5adb=function(_0xef7fe4,_0x521aaa){_0xef7fe4=_0xef7fe4-0x0;var _0x3e1c2f=_0xadb5[_0xef7fe4];return _0x3e1c2f;};'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 ab552fa..c12ca5e 100644 --- a/server/api/mailServerIn/index.js +++ b/server/api/mailServerIn/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x2d0f71,_0x44071e){var _0x8ab51=function(_0x1ba53d){while(--_0x1ba53d){_0x2d0f71['push'](_0x2d0f71['shift']());}};_0x8ab51(++_0x44071e);}(_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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x59bd35,_0x586897){var _0x203e8a=function(_0x2aecf6){while(--_0x2aecf6){_0x59bd35['push'](_0x59bd35['shift']());}};_0x203e8a(++_0x586897);}(_0xe706,0xa3));var _0x6e70=function(_0x400f2a,_0x52a559){_0x400f2a=_0x400f2a-0x0;var _0x3dd8d1=_0xe706[_0x400f2a];return _0x3dd8d1;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 73c4a68..1e3f1f9 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 _0xb15a=['exports','STRING','BOOLEAN','INBOX','INTEGER','sequelize'];(function(_0x14b0ae,_0x226b62){var _0x13d07a=function(_0x2e7472){while(--_0x2e7472){_0x14b0ae['push'](_0x14b0ae['shift']());}};_0x13d07a(++_0x226b62);}(_0xb15a,0x197));var _0xab15=function(_0x25c326,_0x250137){_0x25c326=_0x25c326-0x0;var _0x762452=_0xb15a[_0x25c326];return _0x762452;};'use strict';var Sequelize=require(_0xab15('0x0'));module[_0xab15('0x1')]={'description':{'type':Sequelize[_0xab15('0x2')]},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0xab15('0x3')],'defaultValue':!![]},'user':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xab15('0x2')]},'port':{'type':Sequelize['INTEGER']},'tls':{'type':Sequelize[_0xab15('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xab15('0x2')],'defaultValue':_0xab15('0x4')},'connTimeout':{'type':Sequelize[_0xab15('0x5')],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize[_0xab15('0x2')]},'modernAuthentication':{'type':Sequelize[_0xab15('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x00f7=['INTEGER','INBOX','BOOLEAN','exports','STRING'];(function(_0x1a0b6d,_0x2fc879){var _0x3236c2=function(_0x35275a){while(--_0x35275a){_0x1a0b6d['push'](_0x1a0b6d['shift']());}};_0x3236c2(++_0x2fc879);}(_0x00f7,0x12a));var _0x700f=function(_0xf78c27,_0x55e306){_0xf78c27=_0xf78c27-0x0;var _0x1c7570=_0x00f7[_0xf78c27];return _0x1c7570;};'use strict';var Sequelize=require('sequelize');module[_0x700f('0x0')]={'description':{'type':Sequelize[_0x700f('0x1')]},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'user':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x700f('0x1')]},'port':{'type':Sequelize[_0x700f('0x2')]},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x700f('0x1')],'defaultValue':_0x700f('0x3')},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x700f('0x2')],'defaultValue':0x5},'service':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize[_0x700f('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 88c5414..b2b8593 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 _0x3835=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailServerIn.attributes','exports','define','mail_servers_in','util'];(function(_0x14ffe1,_0x4d7e5d){var _0x328ec1=function(_0x556bfa){while(--_0x556bfa){_0x14ffe1['push'](_0x14ffe1['shift']());}};_0x328ec1(++_0x4d7e5d);}(_0x3835,0x6b));var _0x5383=function(_0x3ed893,_0x2dcaf8){_0x3ed893=_0x3ed893-0x0;var _0x3a7909=_0x3835[_0x3ed893];return _0x3a7909;};'use strict';var _=require('lodash');var util=require(_0x5383('0x0'));var logger=require(_0x5383('0x1'))('api');var moment=require(_0x5383('0x2'));var BPromise=require(_0x5383('0x3'));var rp=require(_0x5383('0x4'));var fs=require('fs');var path=require(_0x5383('0x5'));var rimraf=require(_0x5383('0x6'));var config=require(_0x5383('0x7'));var attributes=require(_0x5383('0x8'));module[_0x5383('0x9')]=function(_0xba690,_0x1ca558){return _0xba690[_0x5383('0xa')]('MailServerIn',attributes,{'tableName':_0x5383('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x40d5=['rimraf','../../config/environment','exports','define','mail_servers_in','lodash','../../config/logger','moment','request-promise','path'];(function(_0x458779,_0x2526ba){var _0x570faa=function(_0x4555e8){while(--_0x4555e8){_0x458779['push'](_0x458779['shift']());}};_0x570faa(++_0x2526ba);}(_0x40d5,0x73));var _0x540d=function(_0x383875,_0x45b02b){_0x383875=_0x383875-0x0;var _0x128fc2=_0x40d5[_0x383875];return _0x128fc2;};'use strict';var _=require(_0x540d('0x0'));var util=require('util');var logger=require(_0x540d('0x1'))('api');var moment=require(_0x540d('0x2'));var BPromise=require('bluebird');var rp=require(_0x540d('0x3'));var fs=require('fs');var path=require(_0x540d('0x4'));var rimraf=require(_0x540d('0x5'));var config=require(_0x540d('0x6'));var attributes=require('./mailServerIn.attributes');module[_0x540d('0x7')]=function(_0x47905a,_0x102d79){return _0x47905a[_0x540d('0x8')]('MailServerIn',attributes,{'tableName':_0x540d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.rpc.js b/server/api/mailServerIn/mailServerIn.rpc.js index 0296152..b9f9556 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 _0x5656=['map','model','debug','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message','GetMailServerIn','MailServerIn','findAll','options','raw','where','attributes','include'];(function(_0x4ccf96,_0x34978e){var _0xd103b7=function(_0x55736b){while(--_0x55736b){_0x4ccf96['push'](_0x4ccf96['shift']());}};_0xd103b7(++_0x34978e);}(_0x5656,0x1d5));var _0x6565=function(_0x4e9a52,_0x25b20d){_0x4e9a52=_0x4e9a52-0x0;var _0x2d425f=_0x5656[_0x4e9a52];return _0x2d425f;};'use strict';var _=require(_0x6565('0x0'));var util=require(_0x6565('0x1'));var moment=require(_0x6565('0x2'));var BPromise=require(_0x6565('0x3'));var rs=require(_0x6565('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6565('0x5'));var logger=require(_0x6565('0x6'))(_0x6565('0x7'));var config=require('../../config/environment');var jayson=require(_0x6565('0x8'));var client=jayson[_0x6565('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1318ba,_0x3bab76,_0x47c8f1){return new BPromise(function(_0x20e359,_0x59f0b2){return client['request'](_0x1318ba,_0x47c8f1)[_0x6565('0xa')](function(_0xea00a0){logger[_0x6565('0xb')](_0x6565('0xc'),_0x3bab76,_0x6565('0xd'));logger['debug'](_0x6565('0xe'),_0x3bab76,'request\x20sent',JSON[_0x6565('0xf')](_0xea00a0));if(_0xea00a0[_0x6565('0x10')]){if(_0xea00a0[_0x6565('0x10')][_0x6565('0x11')]===0x1f4){logger['error'](_0x6565('0xc'),_0x3bab76,_0xea00a0['error'][_0x6565('0x12')]);return _0x59f0b2(_0xea00a0[_0x6565('0x10')][_0x6565('0x12')]);}logger[_0x6565('0x10')](_0x6565('0xc'),_0x3bab76,_0xea00a0[_0x6565('0x10')][_0x6565('0x12')]);return _0x20e359(_0xea00a0['error'][_0x6565('0x12')]);}else{logger[_0x6565('0xb')](_0x6565('0xc'),_0x3bab76,_0x6565('0xd'));_0x20e359(_0xea00a0['result'][_0x6565('0x12')]);}})['catch'](function(_0x1b3837){logger[_0x6565('0x10')]('MailServerIn,\x20%s,\x20%s',_0x3bab76,_0x1b3837);_0x59f0b2(_0x1b3837);});});}exports[_0x6565('0x13')]=function(_0x25727f){var _0x334f69=this;return new Promise(function(_0x3a70d4,_0x17b5be){return db[_0x6565('0x14')][_0x6565('0x15')]({'raw':_0x25727f[_0x6565('0x16')]?_0x25727f[_0x6565('0x16')][_0x6565('0x17')]===undefined?!![]:![]:!![],'where':_0x25727f[_0x6565('0x16')]?_0x25727f[_0x6565('0x16')][_0x6565('0x18')]||null:null,'attributes':_0x25727f[_0x6565('0x16')]?_0x25727f['options'][_0x6565('0x19')]||null:null,'limit':_0x25727f[_0x6565('0x16')]?_0x25727f[_0x6565('0x16')]['limit']||null:null,'include':_0x25727f[_0x6565('0x16')]?_0x25727f['options'][_0x6565('0x1a')]?_[_0x6565('0x1b')](_0x25727f[_0x6565('0x16')][_0x6565('0x1a')],function(_0x4a76f4){return{'model':db[_0x4a76f4[_0x6565('0x1c')]],'as':_0x4a76f4['as'],'attributes':_0x4a76f4[_0x6565('0x19')],'include':_0x4a76f4[_0x6565('0x1a')]?_['map'](_0x4a76f4[_0x6565('0x1a')],function(_0x1fd7d0){return{'model':db[_0x1fd7d0[_0x6565('0x1c')]],'as':_0x1fd7d0['as'],'attributes':_0x1fd7d0[_0x6565('0x19')],'include':_0x1fd7d0[_0x6565('0x1a')]?_[_0x6565('0x1b')](_0x1fd7d0['include'],function(_0x28439d){return{'model':db[_0x28439d[_0x6565('0x1c')]],'as':_0x28439d['as'],'attributes':_0x28439d[_0x6565('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x32db0a){logger[_0x6565('0xb')]('GetMailServerIn',_0x25727f);logger[_0x6565('0x1d')](_0x6565('0x13'),_0x25727f,JSON[_0x6565('0xf')](_0x32db0a));_0x3a70d4(_0x32db0a);})[_0x6565('0x1e')](function(_0x3e3885){logger[_0x6565('0x10')](_0x6565('0x13'),_0x3e3885[_0x6565('0x12')],_0x25727f);_0x17b5be(_0x334f69['error'](0x1f4,_0x3e3885[_0x6565('0x12')]));});});}; \ No newline at end of file +var _0xd810=['findAll','options','raw','where','include','map','model','attributes','then','debug','stringify','catch','lodash','util','bluebird','randomstring','../../config/utils','rpc','jayson/promise','client','http','request','MailServerIn,\x20%s,\x20%s','request\x20sent','MailServerIn,\x20%s,\x20%s,\x20%s','error','message','info','result','GetMailServerIn','MailServerIn'];(function(_0x5e42fb,_0x4a808a){var _0x3a54f5=function(_0x1201b8){while(--_0x1201b8){_0x5e42fb['push'](_0x5e42fb['shift']());}};_0x3a54f5(++_0x4a808a);}(_0xd810,0x1dd));var _0x0d81=function(_0x468b0f,_0x408566){_0x468b0f=_0x468b0f-0x0;var _0x3e74d9=_0xd810[_0x468b0f];return _0x3e74d9;};'use strict';var _=require(_0x0d81('0x0'));var util=require(_0x0d81('0x1'));var moment=require('moment');var BPromise=require(_0x0d81('0x2'));var rs=require(_0x0d81('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0d81('0x4'));var logger=require('../../config/logger')(_0x0d81('0x5'));var config=require('../../config/environment');var jayson=require(_0x0d81('0x6'));var client=jayson[_0x0d81('0x7')][_0x0d81('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x53697e,_0x2a9f6a,_0x11fd91){return new BPromise(function(_0x1a5356,_0x43aee0){return client[_0x0d81('0x9')](_0x53697e,_0x11fd91)['then'](function(_0x2417a5){logger['info'](_0x0d81('0xa'),_0x2a9f6a,_0x0d81('0xb'));logger['debug'](_0x0d81('0xc'),_0x2a9f6a,_0x0d81('0xb'),JSON['stringify'](_0x2417a5));if(_0x2417a5['error']){if(_0x2417a5[_0x0d81('0xd')]['code']===0x1f4){logger['error'](_0x0d81('0xa'),_0x2a9f6a,_0x2417a5['error'][_0x0d81('0xe')]);return _0x43aee0(_0x2417a5[_0x0d81('0xd')][_0x0d81('0xe')]);}logger['error'](_0x0d81('0xa'),_0x2a9f6a,_0x2417a5[_0x0d81('0xd')][_0x0d81('0xe')]);return _0x1a5356(_0x2417a5['error'][_0x0d81('0xe')]);}else{logger[_0x0d81('0xf')](_0x0d81('0xa'),_0x2a9f6a,_0x0d81('0xb'));_0x1a5356(_0x2417a5[_0x0d81('0x10')][_0x0d81('0xe')]);}})['catch'](function(_0x3a550a){logger[_0x0d81('0xd')](_0x0d81('0xa'),_0x2a9f6a,_0x3a550a);_0x43aee0(_0x3a550a);});});}exports[_0x0d81('0x11')]=function(_0x58d9c7){var _0x1b095d=this;return new Promise(function(_0x4ae939,_0x37d06b){return db[_0x0d81('0x12')][_0x0d81('0x13')]({'raw':_0x58d9c7[_0x0d81('0x14')]?_0x58d9c7[_0x0d81('0x14')][_0x0d81('0x15')]===undefined?!![]:![]:!![],'where':_0x58d9c7[_0x0d81('0x14')]?_0x58d9c7[_0x0d81('0x14')][_0x0d81('0x16')]||null:null,'attributes':_0x58d9c7[_0x0d81('0x14')]?_0x58d9c7[_0x0d81('0x14')]['attributes']||null:null,'limit':_0x58d9c7[_0x0d81('0x14')]?_0x58d9c7[_0x0d81('0x14')]['limit']||null:null,'include':_0x58d9c7['options']?_0x58d9c7[_0x0d81('0x14')][_0x0d81('0x17')]?_[_0x0d81('0x18')](_0x58d9c7[_0x0d81('0x14')][_0x0d81('0x17')],function(_0x204e81){return{'model':db[_0x204e81[_0x0d81('0x19')]],'as':_0x204e81['as'],'attributes':_0x204e81[_0x0d81('0x1a')],'include':_0x204e81['include']?_['map'](_0x204e81[_0x0d81('0x17')],function(_0x235353){return{'model':db[_0x235353['model']],'as':_0x235353['as'],'attributes':_0x235353[_0x0d81('0x1a')],'include':_0x235353[_0x0d81('0x17')]?_['map'](_0x235353[_0x0d81('0x17')],function(_0x20bbeb){return{'model':db[_0x20bbeb['model']],'as':_0x20bbeb['as'],'attributes':_0x20bbeb[_0x0d81('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x0d81('0x1b')](function(_0x32a77c){logger[_0x0d81('0xf')](_0x0d81('0x11'),_0x58d9c7);logger[_0x0d81('0x1c')](_0x0d81('0x11'),_0x58d9c7,JSON[_0x0d81('0x1d')](_0x32a77c));_0x4ae939(_0x32a77c);})[_0x0d81('0x1e')](function(_0x238da2){logger['error'](_0x0d81('0x11'),_0x238da2['message'],_0x58d9c7);_0x37d06b(_0x1b095d[_0x0d81('0xd')](0x1f4,_0x238da2['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 11b6ea2..bf61e80 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(_0x2160a9,_0x3cbd9e){var _0xa88cf7=function(_0x51ab6f){while(--_0x51ab6f){_0x2160a9['push'](_0x2160a9['shift']());}};_0xa88cf7(++_0x3cbd9e);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'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 _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(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_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('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index b0d0547..11e9882 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 _0x28f2=['STRING','INTEGER','BOOLEAN','sequelize','exports'];(function(_0x5efc66,_0x572973){var _0x1092d1=function(_0x16a405){while(--_0x16a405){_0x5efc66['push'](_0x5efc66['shift']());}};_0x1092d1(++_0x572973);}(_0x28f2,0x193));var _0x228f=function(_0x5292fa,_0x510536){_0x5292fa=_0x5292fa-0x0;var _0x18da43=_0x28f2[_0x5292fa];return _0x18da43;};'use strict';var Sequelize=require(_0x228f('0x0'));module[_0x228f('0x1')]={'description':{'type':Sequelize[_0x228f('0x2')]},'host':{'type':Sequelize[_0x228f('0x2')]},'user':{'type':Sequelize[_0x228f('0x2')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x228f('0x3')]},'secure':{'type':Sequelize[_0x228f('0x4')],'defaultValue':![]},'service':{'type':Sequelize[_0x228f('0x2')]},'authentication':{'type':Sequelize[_0x228f('0x4')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x228f('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0xa5fa=['exports','STRING','INTEGER','BOOLEAN'];(function(_0x3c6a9b,_0x36818a){var _0x57999e=function(_0x4c6f57){while(--_0x4c6f57){_0x3c6a9b['push'](_0x3c6a9b['shift']());}};_0x57999e(++_0x36818a);}(_0xa5fa,0xc4));var _0xaa5f=function(_0x4c7d23,_0x1eed42){_0x4c7d23=_0x4c7d23-0x0;var _0x4bd04c=_0xa5fa[_0x4c7d23];return _0x4bd04c;};'use strict';var Sequelize=require('sequelize');module[_0xaa5f('0x0')]={'description':{'type':Sequelize[_0xaa5f('0x1')]},'host':{'type':Sequelize[_0xaa5f('0x1')]},'user':{'type':Sequelize[_0xaa5f('0x1')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xaa5f('0x2')]},'secure':{'type':Sequelize[_0xaa5f('0x3')],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0xaa5f('0x3')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0xaa5f('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 f17342d..8754569 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 _0xb9b1=['include','show','params','keys','options','find','catch','create','body','update','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','sendStatus','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','status','error','stack','send','index','map','MailServerOut','rawAttributes','fieldName','model','name','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll'];(function(_0xcc06bd,_0x58e65b){var _0xb52157=function(_0x5beff9){while(--_0x5beff9){_0xcc06bd['push'](_0xcc06bd['shift']());}};_0xb52157(++_0x58e65b);}(_0xb9b1,0x12a));var _0x1b9b=function(_0x1661e6,_0x271d77){_0x1661e6=_0x1661e6-0x0;var _0x14428e=_0xb9b1[_0x1661e6];return _0x14428e;};'use strict';var emlformat=require(_0x1b9b('0x0'));var rimraf=require(_0x1b9b('0x1'));var zipdir=require(_0x1b9b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1b9b('0x3'));var BPromise=require(_0x1b9b('0x4'));var Mustache=require(_0x1b9b('0x5'));var util=require(_0x1b9b('0x6'));var path=require(_0x1b9b('0x7'));var sox=require(_0x1b9b('0x8'));var csv=require(_0x1b9b('0x9'));var ejs=require(_0x1b9b('0xa'));var fs=require('fs');var fs_extra=require(_0x1b9b('0xb'));var _=require(_0x1b9b('0xc'));var squel=require(_0x1b9b('0xd'));var crypto=require(_0x1b9b('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x1b9b('0xf'));var toCsv=require(_0x1b9b('0x9'));var querystring=require('querystring');var Papa=require(_0x1b9b('0x10'));var Redis=require(_0x1b9b('0x11'));var authService=require(_0x1b9b('0x12'));var qs=require(_0x1b9b('0x13'));var as=require(_0x1b9b('0x14'));var hardwareService=require(_0x1b9b('0x15'));var logger=require(_0x1b9b('0x16'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1c3e2a,_0x458102){_0x458102=_0x458102||0xcc;return function(_0x17d8bd){if(_0x17d8bd){return _0x1c3e2a[_0x1b9b('0x17')](_0x458102);}return _0x1c3e2a['status'](_0x458102)[_0x1b9b('0x18')]();};}function respondWithResult(_0x44433a,_0x4eac4a){_0x4eac4a=_0x4eac4a||0xc8;return function(_0x36ef8f){if(_0x36ef8f){return _0x44433a['status'](_0x4eac4a)[_0x1b9b('0x19')](_0x36ef8f);}};}function respondWithFilteredResult(_0x5bb862,_0x1d271f){return function(_0x5864f6){if(_0x5864f6){var _0x3b9d22=typeof _0x1d271f[_0x1b9b('0x1a')]===_0x1b9b('0x1b')&&typeof _0x1d271f[_0x1b9b('0x1c')]===_0x1b9b('0x1b');var _0x37e78a=_0x5864f6['count'];var _0x581dd3=_0x3b9d22?0x0:_0x1d271f[_0x1b9b('0x1a')];var _0x4b1dc1=_0x3b9d22?_0x5864f6[_0x1b9b('0x1d')]:_0x1d271f[_0x1b9b('0x1a')]+_0x1d271f[_0x1b9b('0x1c')];var _0x5bb8bc;if(_0x4b1dc1>=_0x37e78a){_0x4b1dc1=_0x37e78a;_0x5bb8bc=0xc8;}else{_0x5bb8bc=0xce;}_0x5bb862['status'](_0x5bb8bc);return _0x5bb862['set'](_0x1b9b('0x1e'),_0x581dd3+'-'+_0x4b1dc1+'/'+_0x37e78a)[_0x1b9b('0x19')](_0x5864f6);}return null;};}function patchUpdates(_0x5c5a7f){return function(_0x2b64df){try{jsonpatch[_0x1b9b('0x1f')](_0x2b64df,_0x5c5a7f,!![]);}catch(_0x5110e2){return BPromise[_0x1b9b('0x20')](_0x5110e2);}return _0x2b64df[_0x1b9b('0x21')]();};}function saveUpdates(_0x346651,_0x4e5c58){return function(_0x4c07b6){if(_0x4c07b6){return _0x4c07b6['update'](_0x346651)[_0x1b9b('0x22')](function(_0x4a7fd3){return _0x4a7fd3;});}return null;};}function removeEntity(_0x613098,_0x222bef){return function(_0x5c19da){if(_0x5c19da){return _0x5c19da[_0x1b9b('0x23')]()['then'](function(){_0x613098[_0x1b9b('0x24')](0xcc)[_0x1b9b('0x18')]();});}};}function handleEntityNotFound(_0x76a66e,_0x1681a0){return function(_0x3aeedf){if(!_0x3aeedf){_0x76a66e[_0x1b9b('0x17')](0x194);}return _0x3aeedf;};}function handleError(_0x447e02,_0x594836){_0x594836=_0x594836||0x1f4;return function(_0xb861fc){logger[_0x1b9b('0x25')](_0xb861fc[_0x1b9b('0x26')]);if(_0xb861fc['name']){delete _0xb861fc['name'];}_0x447e02['status'](_0x594836)[_0x1b9b('0x27')](_0xb861fc);};}exports[_0x1b9b('0x28')]=function(_0x58834e,_0x3f7e21){var _0x521513={},_0x20c15c={},_0x1177af={'count':0x0,'rows':[]};var _0x3af72=_[_0x1b9b('0x29')](db[_0x1b9b('0x2a')][_0x1b9b('0x2b')],function(_0x2224ff){return{'name':_0x2224ff[_0x1b9b('0x2c')],'type':_0x2224ff['type']['key']};});_0x20c15c[_0x1b9b('0x2d')]=_[_0x1b9b('0x29')](_0x3af72,_0x1b9b('0x2e'));_0x20c15c[_0x1b9b('0x2f')]=_['keys'](_0x58834e[_0x1b9b('0x2f')]);_0x20c15c[_0x1b9b('0x30')]=_[_0x1b9b('0x31')](_0x20c15c[_0x1b9b('0x2d')],_0x20c15c[_0x1b9b('0x2f')]);_0x521513['attributes']=_[_0x1b9b('0x31')](_0x20c15c[_0x1b9b('0x2d')],qs[_0x1b9b('0x32')](_0x58834e['query'][_0x1b9b('0x32')]));_0x521513['attributes']=_0x521513[_0x1b9b('0x33')][_0x1b9b('0x34')]?_0x521513[_0x1b9b('0x33')]:_0x20c15c[_0x1b9b('0x2d')];if(!_0x58834e['query'][_0x1b9b('0x35')](_0x1b9b('0x36'))){_0x521513[_0x1b9b('0x1c')]=qs[_0x1b9b('0x1c')](_0x58834e[_0x1b9b('0x2f')][_0x1b9b('0x1c')]);_0x521513[_0x1b9b('0x1a')]=qs['offset'](_0x58834e[_0x1b9b('0x2f')][_0x1b9b('0x1a')]);}_0x521513[_0x1b9b('0x37')]=qs[_0x1b9b('0x38')](_0x58834e[_0x1b9b('0x2f')]['sort']);_0x521513[_0x1b9b('0x39')]=qs[_0x1b9b('0x30')](_['pick'](_0x58834e[_0x1b9b('0x2f')],_0x20c15c[_0x1b9b('0x30')]),_0x3af72);if(_0x58834e[_0x1b9b('0x2f')][_0x1b9b('0x3a')]){_0x521513[_0x1b9b('0x39')]=_[_0x1b9b('0x3b')](_0x521513[_0x1b9b('0x39')],{'$or':_['map'](_0x3af72,function(_0x5a61f5){if(_0x5a61f5['type']!==_0x1b9b('0x3c')){var _0x135fb7={};_0x135fb7[_0x5a61f5[_0x1b9b('0x2e')]]={'$like':'%'+_0x58834e[_0x1b9b('0x2f')][_0x1b9b('0x3a')]+'%'};return _0x135fb7;}})});}_0x521513=_[_0x1b9b('0x3b')]({},_0x521513,_0x58834e['options']);var _0x1103ba={'where':_0x521513[_0x1b9b('0x39')]};return db[_0x1b9b('0x2a')][_0x1b9b('0x1d')](_0x1103ba)[_0x1b9b('0x22')](function(_0x5139bb){_0x1177af[_0x1b9b('0x1d')]=_0x5139bb;if(_0x58834e['query'][_0x1b9b('0x3d')]){_0x521513[_0x1b9b('0x3e')]=[{'all':!![]}];}return db[_0x1b9b('0x2a')]['findAll'](_0x521513);})[_0x1b9b('0x22')](function(_0x287eed){_0x1177af['rows']=_0x287eed;return _0x1177af;})[_0x1b9b('0x22')](respondWithFilteredResult(_0x3f7e21,_0x521513))['catch'](handleError(_0x3f7e21,null));};exports[_0x1b9b('0x3f')]=function(_0x4fbfed,_0x6d33c4){var _0xf7826c={'raw':!![],'where':{'id':_0x4fbfed[_0x1b9b('0x40')]['id']}},_0x315347={};_0x315347[_0x1b9b('0x2d')]=_['keys'](db[_0x1b9b('0x2a')]['rawAttributes']);_0x315347[_0x1b9b('0x2f')]=_[_0x1b9b('0x41')](_0x4fbfed[_0x1b9b('0x2f')]);_0x315347[_0x1b9b('0x30')]=_[_0x1b9b('0x31')](_0x315347['model'],_0x315347['query']);_0xf7826c[_0x1b9b('0x33')]=_[_0x1b9b('0x31')](_0x315347[_0x1b9b('0x2d')],qs[_0x1b9b('0x32')](_0x4fbfed[_0x1b9b('0x2f')][_0x1b9b('0x32')]));_0xf7826c[_0x1b9b('0x33')]=_0xf7826c[_0x1b9b('0x33')][_0x1b9b('0x34')]?_0xf7826c['attributes']:_0x315347[_0x1b9b('0x2d')];if(_0x4fbfed[_0x1b9b('0x2f')]['includeAll']){_0xf7826c[_0x1b9b('0x3e')]=[{'all':!![]}];}_0xf7826c=_[_0x1b9b('0x3b')]({},_0xf7826c,_0x4fbfed[_0x1b9b('0x42')]);return db[_0x1b9b('0x2a')][_0x1b9b('0x43')](_0xf7826c)['then'](handleEntityNotFound(_0x6d33c4,null))[_0x1b9b('0x22')](respondWithResult(_0x6d33c4,null))[_0x1b9b('0x44')](handleError(_0x6d33c4,null));};exports['create']=function(_0x17afed,_0x24db7a){return db[_0x1b9b('0x2a')][_0x1b9b('0x45')](_0x17afed[_0x1b9b('0x46')],{})[_0x1b9b('0x22')](respondWithResult(_0x24db7a,0xc9))['catch'](handleError(_0x24db7a,null));};exports[_0x1b9b('0x47')]=function(_0x257b0c,_0x4a7b2a){if(_0x257b0c['body']['id']){delete _0x257b0c[_0x1b9b('0x46')]['id'];}return db[_0x1b9b('0x2a')]['find']({'where':{'id':_0x257b0c['params']['id']}})[_0x1b9b('0x22')](handleEntityNotFound(_0x4a7b2a,null))['then'](saveUpdates(_0x257b0c[_0x1b9b('0x46')],null))[_0x1b9b('0x22')](respondWithResult(_0x4a7b2a,null))[_0x1b9b('0x44')](handleError(_0x4a7b2a,null));};exports[_0x1b9b('0x23')]=function(_0x2fb045,_0x4c5fe9){return db[_0x1b9b('0x2a')][_0x1b9b('0x43')]({'where':{'id':_0x2fb045['params']['id']}})[_0x1b9b('0x22')](handleEntityNotFound(_0x4c5fe9,null))[_0x1b9b('0x22')](removeEntity(_0x4c5fe9,null))[_0x1b9b('0x44')](handleError(_0x4c5fe9,null));}; \ No newline at end of file +var _0x602f=['mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','end','error','name','send','index','map','MailServerOut','rawAttributes','fieldName','key','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','update','destroy','eml-format','rimraf','fast-json-patch','bluebird'];(function(_0x368fb9,_0x1a9895){var _0x4892fb=function(_0x28d735){while(--_0x28d735){_0x368fb9['push'](_0x368fb9['shift']());}};_0x4892fb(++_0x1a9895);}(_0x602f,0x96));var _0xf602=function(_0x14d059,_0x37191c){_0x14d059=_0x14d059-0x0;var _0x53fe88=_0x602f[_0x14d059];return _0x53fe88;};'use strict';var emlformat=require(_0xf602('0x0'));var rimraf=require(_0xf602('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf602('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf602('0x3'));var Mustache=require(_0xf602('0x4'));var util=require(_0xf602('0x5'));var path=require(_0xf602('0x6'));var sox=require(_0xf602('0x7'));var csv=require(_0xf602('0x8'));var ejs=require(_0xf602('0x9'));var fs=require('fs');var fs_extra=require(_0xf602('0xa'));var _=require('lodash');var squel=require(_0xf602('0xb'));var crypto=require(_0xf602('0xc'));var jsforce=require(_0xf602('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xf602('0xe'));var authService=require(_0xf602('0xf'));var qs=require(_0xf602('0x10'));var as=require(_0xf602('0x11'));var hardwareService=require(_0xf602('0x12'));var logger=require(_0xf602('0x13'))(_0xf602('0x14'));var utils=require(_0xf602('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf602('0x16'));var db=require(_0xf602('0x17'))['db'];function respondWithStatusCode(_0x4ca917,_0x5839f1){_0x5839f1=_0x5839f1||0xcc;return function(_0x4ee978){if(_0x4ee978){return _0x4ca917[_0xf602('0x18')](_0x5839f1);}return _0x4ca917[_0xf602('0x19')](_0x5839f1)['end']();};}function respondWithResult(_0x597bf4,_0x1fdcb9){_0x1fdcb9=_0x1fdcb9||0xc8;return function(_0x1ca9c4){if(_0x1ca9c4){return _0x597bf4[_0xf602('0x19')](_0x1fdcb9)[_0xf602('0x1a')](_0x1ca9c4);}};}function respondWithFilteredResult(_0x711b08,_0x15244f){return function(_0x12e7f6){if(_0x12e7f6){var _0x39a526=typeof _0x15244f[_0xf602('0x1b')]===_0xf602('0x1c')&&typeof _0x15244f[_0xf602('0x1d')]===_0xf602('0x1c');var _0x8c7ad4=_0x12e7f6[_0xf602('0x1e')];var _0x13542a=_0x39a526?0x0:_0x15244f[_0xf602('0x1b')];var _0x503ba8=_0x39a526?_0x12e7f6[_0xf602('0x1e')]:_0x15244f[_0xf602('0x1b')]+_0x15244f[_0xf602('0x1d')];var _0xc5dfa5;if(_0x503ba8>=_0x8c7ad4){_0x503ba8=_0x8c7ad4;_0xc5dfa5=0xc8;}else{_0xc5dfa5=0xce;}_0x711b08['status'](_0xc5dfa5);return _0x711b08[_0xf602('0x1f')](_0xf602('0x20'),_0x13542a+'-'+_0x503ba8+'/'+_0x8c7ad4)[_0xf602('0x1a')](_0x12e7f6);}return null;};}function patchUpdates(_0x1b4783){return function(_0x5dc204){try{jsonpatch[_0xf602('0x21')](_0x5dc204,_0x1b4783,!![]);}catch(_0x341e6a){return BPromise[_0xf602('0x22')](_0x341e6a);}return _0x5dc204[_0xf602('0x23')]();};}function saveUpdates(_0x5c4b12,_0x16b724){return function(_0x316720){if(_0x316720){return _0x316720['update'](_0x5c4b12)['then'](function(_0x1b546a){return _0x1b546a;});}return null;};}function removeEntity(_0x153fb0,_0x5253cf){return function(_0x35f8a2){if(_0x35f8a2){return _0x35f8a2['destroy']()[_0xf602('0x24')](function(){_0x153fb0[_0xf602('0x19')](0xcc)[_0xf602('0x25')]();});}};}function handleEntityNotFound(_0x475f4b,_0x1641b7){return function(_0x50b836){if(!_0x50b836){_0x475f4b[_0xf602('0x18')](0x194);}return _0x50b836;};}function handleError(_0x15cf7f,_0xc728dc){_0xc728dc=_0xc728dc||0x1f4;return function(_0x25c403){logger[_0xf602('0x26')](_0x25c403['stack']);if(_0x25c403['name']){delete _0x25c403[_0xf602('0x27')];}_0x15cf7f['status'](_0xc728dc)[_0xf602('0x28')](_0x25c403);};}exports[_0xf602('0x29')]=function(_0x5a03d7,_0x1967c2){var _0x5f552f={},_0x161d02={},_0x53f50b={'count':0x0,'rows':[]};var _0x42607d=_[_0xf602('0x2a')](db[_0xf602('0x2b')][_0xf602('0x2c')],function(_0x5046c5){return{'name':_0x5046c5[_0xf602('0x2d')],'type':_0x5046c5['type'][_0xf602('0x2e')]};});_0x161d02['model']=_[_0xf602('0x2a')](_0x42607d,_0xf602('0x27'));_0x161d02[_0xf602('0x2f')]=_[_0xf602('0x30')](_0x5a03d7['query']);_0x161d02['filters']=_[_0xf602('0x31')](_0x161d02[_0xf602('0x32')],_0x161d02[_0xf602('0x2f')]);_0x5f552f['attributes']=_[_0xf602('0x31')](_0x161d02[_0xf602('0x32')],qs[_0xf602('0x33')](_0x5a03d7[_0xf602('0x2f')][_0xf602('0x33')]));_0x5f552f[_0xf602('0x34')]=_0x5f552f[_0xf602('0x34')][_0xf602('0x35')]?_0x5f552f[_0xf602('0x34')]:_0x161d02[_0xf602('0x32')];if(!_0x5a03d7[_0xf602('0x2f')][_0xf602('0x36')](_0xf602('0x37'))){_0x5f552f[_0xf602('0x1d')]=qs['limit'](_0x5a03d7[_0xf602('0x2f')][_0xf602('0x1d')]);_0x5f552f[_0xf602('0x1b')]=qs['offset'](_0x5a03d7[_0xf602('0x2f')][_0xf602('0x1b')]);}_0x5f552f[_0xf602('0x38')]=qs[_0xf602('0x39')](_0x5a03d7[_0xf602('0x2f')]['sort']);_0x5f552f[_0xf602('0x3a')]=qs[_0xf602('0x3b')](_[_0xf602('0x3c')](_0x5a03d7[_0xf602('0x2f')],_0x161d02[_0xf602('0x3b')]),_0x42607d);if(_0x5a03d7[_0xf602('0x2f')]['filter']){_0x5f552f[_0xf602('0x3a')]=_[_0xf602('0x3d')](_0x5f552f[_0xf602('0x3a')],{'$or':_[_0xf602('0x2a')](_0x42607d,function(_0x2492cf){if(_0x2492cf['type']!==_0xf602('0x3e')){var _0xc70ab5={};_0xc70ab5[_0x2492cf[_0xf602('0x27')]]={'$like':'%'+_0x5a03d7[_0xf602('0x2f')][_0xf602('0x3f')]+'%'};return _0xc70ab5;}})});}_0x5f552f=_[_0xf602('0x3d')]({},_0x5f552f,_0x5a03d7[_0xf602('0x40')]);var _0x237717={'where':_0x5f552f[_0xf602('0x3a')]};return db['MailServerOut']['count'](_0x237717)[_0xf602('0x24')](function(_0xcb98f3){_0x53f50b['count']=_0xcb98f3;if(_0x5a03d7[_0xf602('0x2f')][_0xf602('0x41')]){_0x5f552f[_0xf602('0x42')]=[{'all':!![]}];}return db[_0xf602('0x2b')][_0xf602('0x43')](_0x5f552f);})['then'](function(_0x7f9430){_0x53f50b[_0xf602('0x44')]=_0x7f9430;return _0x53f50b;})[_0xf602('0x24')](respondWithFilteredResult(_0x1967c2,_0x5f552f))[_0xf602('0x45')](handleError(_0x1967c2,null));};exports[_0xf602('0x46')]=function(_0xee8e55,_0x2a902b){var _0x558351={'raw':!![],'where':{'id':_0xee8e55[_0xf602('0x47')]['id']}},_0x5278b9={};_0x5278b9[_0xf602('0x32')]=_[_0xf602('0x30')](db[_0xf602('0x2b')][_0xf602('0x2c')]);_0x5278b9['query']=_[_0xf602('0x30')](_0xee8e55[_0xf602('0x2f')]);_0x5278b9['filters']=_['intersection'](_0x5278b9['model'],_0x5278b9[_0xf602('0x2f')]);_0x558351[_0xf602('0x34')]=_[_0xf602('0x31')](_0x5278b9['model'],qs['fields'](_0xee8e55[_0xf602('0x2f')]['fields']));_0x558351[_0xf602('0x34')]=_0x558351[_0xf602('0x34')][_0xf602('0x35')]?_0x558351[_0xf602('0x34')]:_0x5278b9[_0xf602('0x32')];if(_0xee8e55['query']['includeAll']){_0x558351['include']=[{'all':!![]}];}_0x558351=_[_0xf602('0x3d')]({},_0x558351,_0xee8e55['options']);return db[_0xf602('0x2b')][_0xf602('0x48')](_0x558351)[_0xf602('0x24')](handleEntityNotFound(_0x2a902b,null))[_0xf602('0x24')](respondWithResult(_0x2a902b,null))['catch'](handleError(_0x2a902b,null));};exports['create']=function(_0x49f9c0,_0x1b6f05){return db[_0xf602('0x2b')][_0xf602('0x49')](_0x49f9c0[_0xf602('0x4a')],{})[_0xf602('0x24')](respondWithResult(_0x1b6f05,0xc9))['catch'](handleError(_0x1b6f05,null));};exports[_0xf602('0x4b')]=function(_0x189227,_0x399caa){if(_0x189227[_0xf602('0x4a')]['id']){delete _0x189227[_0xf602('0x4a')]['id'];}return db['MailServerOut'][_0xf602('0x48')]({'where':{'id':_0x189227[_0xf602('0x47')]['id']}})[_0xf602('0x24')](handleEntityNotFound(_0x399caa,null))['then'](saveUpdates(_0x189227[_0xf602('0x4a')],null))[_0xf602('0x24')](respondWithResult(_0x399caa,null))['catch'](handleError(_0x399caa,null));};exports[_0xf602('0x4c')]=function(_0x13b0dc,_0x1926cd){return db['MailServerOut']['find']({'where':{'id':_0x13b0dc[_0xf602('0x47')]['id']}})[_0xf602('0x24')](handleEntityNotFound(_0x1926cd,null))['then'](removeEntity(_0x1926cd,null))['catch'](handleError(_0x1926cd,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 0cb8e90..a5faea1 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 _0x85e8=['bluebird','rimraf','../../config/environment','./mailServerOut.attributes','exports','MailServerOut','mail_servers_out','lodash','util','api','moment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x85e8,0x125));var _0x885e=function(_0x5eb9bb,_0x5c8956){_0x5eb9bb=_0x5eb9bb-0x0;var _0x33277a=_0x85e8[_0x5eb9bb];return _0x33277a;};'use strict';var _=require(_0x885e('0x0'));var util=require(_0x885e('0x1'));var logger=require('../../config/logger')(_0x885e('0x2'));var moment=require(_0x885e('0x3'));var BPromise=require(_0x885e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x885e('0x5'));var config=require(_0x885e('0x6'));var attributes=require(_0x885e('0x7'));module[_0x885e('0x8')]=function(_0x164f74,_0x3f13ac){return _0x164f74['define'](_0x885e('0x9'),attributes,{'tableName':_0x885e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa5a7=['bluebird','path','rimraf','./mailServerOut.attributes','define','lodash','../../config/logger','api'];(function(_0x1a8330,_0xeae015){var _0x113759=function(_0x4dbb11){while(--_0x4dbb11){_0x1a8330['push'](_0x1a8330['shift']());}};_0x113759(++_0xeae015);}(_0xa5a7,0xed));var _0x7a5a=function(_0x3b4513,_0x4f7372){_0x3b4513=_0x3b4513-0x0;var _0x42e222=_0xa5a7[_0x3b4513];return _0x42e222;};'use strict';var _=require(_0x7a5a('0x0'));var util=require('util');var logger=require(_0x7a5a('0x1'))(_0x7a5a('0x2'));var moment=require('moment');var BPromise=require(_0x7a5a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7a5a('0x4'));var rimraf=require(_0x7a5a('0x5'));var config=require('../../config/environment');var attributes=require(_0x7a5a('0x6'));module['exports']=function(_0x4618e5,_0x573d4b){return _0x4618e5[_0x7a5a('0x7')]('MailServerOut',attributes,{'tableName':'mail_servers_out','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.rpc.js b/server/api/mailServerOut/mailServerOut.rpc.js index e8fd844..ed01ab1 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 _0xdb28=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util'];(function(_0x1308a2,_0x39e3dc){var _0x2e7839=function(_0x1a53b0){while(--_0x1a53b0){_0x1308a2['push'](_0x1308a2['shift']());}};_0x2e7839(++_0x39e3dc);}(_0xdb28,0x106));var _0x8db2=function(_0x13fe69,_0x398f95){_0x13fe69=_0x13fe69-0x0;var _0xba91cc=_0xdb28[_0x13fe69];return _0xba91cc;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494b40,_0x477f50,_0x46932f){return new BPromise(function(_0x131537,_0x29f698){return client[_0x8db2('0xb')](_0x494b40,_0x46932f)[_0x8db2('0xc')](function(_0x126c78){logger['info'](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));logger[_0x8db2('0xf')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});} \ No newline at end of file +var _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(_0x1a9d4b,_0x3a5d59){var _0x51a2d9=function(_0xd4cfef){while(--_0xd4cfef){_0x1a9d4b['push'](_0x1a9d4b['shift']());}};_0x51a2d9(++_0x3a5d59);}(_0x5f2f,0x73));var _0xf5f2=function(_0x5a998b,_0x5a3c95){_0x5a998b=_0x5a998b-0x0;var _0x402fcc=_0x5f2f[_0x5a998b];return _0x402fcc;};'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 0238a48..ed27d46 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 _0xf478=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','index','/describe','isAuthenticated','describe','get','/:id','show','put','delete','destroy','util'];(function(_0x5984bb,_0x56f02a){var _0x5351d8=function(_0x43415a){while(--_0x43415a){_0x5984bb['push'](_0x5984bb['shift']());}};_0x5351d8(++_0x56f02a);}(_0xf478,0x1d3));var _0x8f47=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xf478[_0x31e29a];return _0x32d892;};'use strict';var multer=require('multer');var util=require(_0x8f47('0x0'));var path=require(_0x8f47('0x1'));var timeout=require(_0x8f47('0x2'));var express=require(_0x8f47('0x3'));var router=express[_0x8f47('0x4')]();var fs_extra=require(_0x8f47('0x5'));var auth=require(_0x8f47('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8f47('0x7'));var controller=require('./mailSubstatus.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x8f47('0x8')]);router['get'](_0x8f47('0x9'),auth[_0x8f47('0xa')](),controller[_0x8f47('0xb')]);router[_0x8f47('0xc')](_0x8f47('0xd'),auth[_0x8f47('0xa')](),controller[_0x8f47('0xe')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x8f47('0xf')](_0x8f47('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x8f47('0x10')](_0x8f47('0xd'),auth[_0x8f47('0xa')](),controller[_0x8f47('0x11')]);module['exports']=router; \ No newline at end of file +var _0x1827=['/describe','describe','/:id','post','put','update','delete','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get'];(function(_0xfb56ff,_0xe8be82){var _0x5079ac=function(_0x57f00c){while(--_0x57f00c){_0xfb56ff['push'](_0xfb56ff['shift']());}};_0x5079ac(++_0xe8be82);}(_0x1827,0xd9));var _0x7182=function(_0x1e7b16,_0x4607a1){_0x1e7b16=_0x1e7b16-0x0;var _0x37fadc=_0x1827[_0x1e7b16];return _0x37fadc;};'use strict';var multer=require(_0x7182('0x0'));var util=require(_0x7182('0x1'));var path=require(_0x7182('0x2'));var timeout=require('connect-timeout');var express=require(_0x7182('0x3'));var router=express['Router']();var fs_extra=require(_0x7182('0x4'));var auth=require(_0x7182('0x5'));var interaction=require(_0x7182('0x6'));var config=require(_0x7182('0x7'));var controller=require('./mailSubstatus.controller');router['get']('/',auth[_0x7182('0x8')](),controller[_0x7182('0x9')]);router[_0x7182('0xa')](_0x7182('0xb'),auth['isAuthenticated'](),controller[_0x7182('0xc')]);router[_0x7182('0xa')](_0x7182('0xd'),auth[_0x7182('0x8')](),controller['show']);router[_0x7182('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x7182('0xf')]('/:id',auth[_0x7182('0x8')](),controller[_0x7182('0x10')]);router[_0x7182('0x11')]('/:id',auth[_0x7182('0x8')](),controller['destroy']);module[_0x7182('0x12')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 6b8c529..279958d 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 _0x6596=['exports','name','STRING','sequelize'];(function(_0x4ce075,_0x6e5df4){var _0x187a84=function(_0x26ba4b){while(--_0x26ba4b){_0x4ce075['push'](_0x4ce075['shift']());}};_0x187a84(++_0x6e5df4);}(_0x6596,0x1d3));var _0x6659=function(_0x19dd82,_0x34eec6){_0x19dd82=_0x19dd82-0x0;var _0x6aab1b=_0x6596[_0x19dd82];return _0x6aab1b;};'use strict';var Sequelize=require(_0x6659('0x0'));module[_0x6659('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x6659('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x6659('0x3')]}}; \ No newline at end of file +var _0x814b=['STRING','name','sequelize','exports'];(function(_0x436b04,_0x20d0d3){var _0x4bada6=function(_0x10d007){while(--_0x10d007){_0x436b04['push'](_0x436b04['shift']());}};_0x4bada6(++_0x20d0d3);}(_0x814b,0x1a2));var _0xb814=function(_0x3fb030,_0x12aebe){_0x3fb030=_0x3fb030-0x0;var _0xd6899b=_0x814b[_0x3fb030];return _0xd6899b;};'use strict';var Sequelize=require(_0xb814('0x0'));module[_0xb814('0x1')]={'name':{'type':Sequelize[_0xb814('0x2')],'unique':_0xb814('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xb814('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 9d6c937..bcfcc0d 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 _0xf675=['ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','fieldName','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','order','sort','filters','pick','filter','where','merge','type','VIRTUAL','options','MailSubstatus','includeAll','findAll','catch','show','params','rawAttributes','include','find','create','body','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv'];(function(_0x10791d,_0x2562b6){var _0x1b4f9c=function(_0x3b2815){while(--_0x3b2815){_0x10791d['push'](_0x10791d['shift']());}};_0x1b4f9c(++_0x2562b6);}(_0xf675,0xe4));var _0x5f67=function(_0x39db05,_0x3868d0){_0x39db05=_0x39db05-0x0;var _0x3f0e22=_0xf675[_0x39db05];return _0x3f0e22;};'use strict';var emlformat=require(_0x5f67('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5f67('0x1'));var rp=require(_0x5f67('0x2'));var moment=require(_0x5f67('0x3'));var BPromise=require(_0x5f67('0x4'));var Mustache=require(_0x5f67('0x5'));var util=require('util');var path=require(_0x5f67('0x6'));var sox=require(_0x5f67('0x7'));var csv=require(_0x5f67('0x8'));var ejs=require(_0x5f67('0x9'));var fs=require('fs');var fs_extra=require(_0x5f67('0xa'));var _=require(_0x5f67('0xb'));var squel=require('squel');var crypto=require(_0x5f67('0xc'));var jsforce=require(_0x5f67('0xd'));var deskjs=require(_0x5f67('0xe'));var toCsv=require('to-csv');var querystring=require(_0x5f67('0xf'));var Papa=require(_0x5f67('0x10'));var Redis=require(_0x5f67('0x11'));var authService=require(_0x5f67('0x12'));var qs=require(_0x5f67('0x13'));var as=require(_0x5f67('0x14'));var hardwareService=require(_0x5f67('0x15'));var logger=require(_0x5f67('0x16'))(_0x5f67('0x17'));var utils=require('../../config/utils');var config=require(_0x5f67('0x18'));var licenseUtil=require(_0x5f67('0x19'));var db=require(_0x5f67('0x1a'))['db'];function respondWithStatusCode(_0x518454,_0x4473ef){_0x4473ef=_0x4473ef||0xcc;return function(_0x4fe01c){if(_0x4fe01c){return _0x518454[_0x5f67('0x1b')](_0x4473ef);}return _0x518454[_0x5f67('0x1c')](_0x4473ef)[_0x5f67('0x1d')]();};}function respondWithResult(_0x894ee,_0x4999f5){_0x4999f5=_0x4999f5||0xc8;return function(_0xaf0b5a){if(_0xaf0b5a){return _0x894ee['status'](_0x4999f5)[_0x5f67('0x1e')](_0xaf0b5a);}};}function respondWithFilteredResult(_0x56fb56,_0x4ad1d4){return function(_0x293661){if(_0x293661){var _0x6f822f=typeof _0x4ad1d4[_0x5f67('0x1f')]==='undefined'&&typeof _0x4ad1d4[_0x5f67('0x20')]===_0x5f67('0x21');var _0x502f3a=_0x293661[_0x5f67('0x22')];var _0x1d5c11=_0x6f822f?0x0:_0x4ad1d4[_0x5f67('0x1f')];var _0x2af08f=_0x6f822f?_0x293661[_0x5f67('0x22')]:_0x4ad1d4[_0x5f67('0x1f')]+_0x4ad1d4['limit'];var _0x2ecf93;if(_0x2af08f>=_0x502f3a){_0x2af08f=_0x502f3a;_0x2ecf93=0xc8;}else{_0x2ecf93=0xce;}_0x56fb56[_0x5f67('0x1c')](_0x2ecf93);return _0x56fb56[_0x5f67('0x23')](_0x5f67('0x24'),_0x1d5c11+'-'+_0x2af08f+'/'+_0x502f3a)[_0x5f67('0x1e')](_0x293661);}return null;};}function patchUpdates(_0x3c2972){return function(_0x309017){try{jsonpatch[_0x5f67('0x25')](_0x309017,_0x3c2972,!![]);}catch(_0x3623b5){return BPromise['reject'](_0x3623b5);}return _0x309017[_0x5f67('0x26')]();};}function saveUpdates(_0x133429,_0x4b2b99){return function(_0xdca25f){if(_0xdca25f){return _0xdca25f[_0x5f67('0x27')](_0x133429)[_0x5f67('0x28')](function(_0xd21729){return _0xd21729;});}return null;};}function removeEntity(_0x4ea253,_0x4f45f6){return function(_0x1672cb){if(_0x1672cb){return _0x1672cb[_0x5f67('0x29')]()[_0x5f67('0x28')](function(){_0x4ea253[_0x5f67('0x1c')](0xcc)[_0x5f67('0x1d')]();});}};}function handleEntityNotFound(_0x467c39,_0x40b86f){return function(_0x480ed6){if(!_0x480ed6){_0x467c39[_0x5f67('0x1b')](0x194);}return _0x480ed6;};}function handleError(_0x2167f2,_0x30d032){_0x30d032=_0x30d032||0x1f4;return function(_0x58b252){logger[_0x5f67('0x2a')](_0x58b252[_0x5f67('0x2b')]);if(_0x58b252['name']){delete _0x58b252[_0x5f67('0x2c')];}_0x2167f2[_0x5f67('0x1c')](_0x30d032)[_0x5f67('0x2d')](_0x58b252);};}exports[_0x5f67('0x2e')]=function(_0x30636e,_0x1ea9ad){var _0x27a57a={},_0x271a32={},_0xc0238={'count':0x0,'rows':[]};var _0x2bd0c5=_[_0x5f67('0x2f')](db['MailSubstatus']['rawAttributes'],function(_0x5626cb){return{'name':_0x5626cb[_0x5f67('0x30')],'type':_0x5626cb['type']['key']};});_0x271a32[_0x5f67('0x31')]=_['map'](_0x2bd0c5,_0x5f67('0x2c'));_0x271a32[_0x5f67('0x32')]=_[_0x5f67('0x33')](_0x30636e[_0x5f67('0x32')]);_0x271a32['filters']=_[_0x5f67('0x34')](_0x271a32['model'],_0x271a32[_0x5f67('0x32')]);_0x27a57a['attributes']=_[_0x5f67('0x34')](_0x271a32[_0x5f67('0x31')],qs['fields'](_0x30636e[_0x5f67('0x32')][_0x5f67('0x35')]));_0x27a57a[_0x5f67('0x36')]=_0x27a57a[_0x5f67('0x36')][_0x5f67('0x37')]?_0x27a57a[_0x5f67('0x36')]:_0x271a32[_0x5f67('0x31')];if(!_0x30636e[_0x5f67('0x32')][_0x5f67('0x38')]('nolimit')){_0x27a57a['limit']=qs[_0x5f67('0x20')](_0x30636e[_0x5f67('0x32')][_0x5f67('0x20')]);_0x27a57a['offset']=qs[_0x5f67('0x1f')](_0x30636e[_0x5f67('0x32')][_0x5f67('0x1f')]);}_0x27a57a[_0x5f67('0x39')]=qs[_0x5f67('0x3a')](_0x30636e[_0x5f67('0x32')][_0x5f67('0x3a')]);_0x27a57a['where']=qs[_0x5f67('0x3b')](_[_0x5f67('0x3c')](_0x30636e[_0x5f67('0x32')],_0x271a32[_0x5f67('0x3b')]),_0x2bd0c5);if(_0x30636e[_0x5f67('0x32')][_0x5f67('0x3d')]){_0x27a57a[_0x5f67('0x3e')]=_[_0x5f67('0x3f')](_0x27a57a[_0x5f67('0x3e')],{'$or':_['map'](_0x2bd0c5,function(_0x1db607){if(_0x1db607[_0x5f67('0x40')]!==_0x5f67('0x41')){var _0x5f0f14={};_0x5f0f14[_0x1db607[_0x5f67('0x2c')]]={'$like':'%'+_0x30636e[_0x5f67('0x32')][_0x5f67('0x3d')]+'%'};return _0x5f0f14;}})});}_0x27a57a=_[_0x5f67('0x3f')]({},_0x27a57a,_0x30636e[_0x5f67('0x42')]);var _0x134103={'where':_0x27a57a[_0x5f67('0x3e')]};return db[_0x5f67('0x43')][_0x5f67('0x22')](_0x134103)['then'](function(_0x623e7c){_0xc0238[_0x5f67('0x22')]=_0x623e7c;if(_0x30636e[_0x5f67('0x32')][_0x5f67('0x44')]){_0x27a57a['include']=[{'all':!![]}];}return db[_0x5f67('0x43')][_0x5f67('0x45')](_0x27a57a);})['then'](function(_0x22352f){_0xc0238['rows']=_0x22352f;return _0xc0238;})['then'](respondWithFilteredResult(_0x1ea9ad,_0x27a57a))[_0x5f67('0x46')](handleError(_0x1ea9ad,null));};exports[_0x5f67('0x47')]=function(_0x32d825,_0x17bbd7){var _0xb384a6={'raw':!![],'where':{'id':_0x32d825[_0x5f67('0x48')]['id']}},_0x448c12={};_0x448c12[_0x5f67('0x31')]=_[_0x5f67('0x33')](db[_0x5f67('0x43')][_0x5f67('0x49')]);_0x448c12[_0x5f67('0x32')]=_[_0x5f67('0x33')](_0x32d825[_0x5f67('0x32')]);_0x448c12[_0x5f67('0x3b')]=_[_0x5f67('0x34')](_0x448c12['model'],_0x448c12['query']);_0xb384a6[_0x5f67('0x36')]=_[_0x5f67('0x34')](_0x448c12[_0x5f67('0x31')],qs[_0x5f67('0x35')](_0x32d825[_0x5f67('0x32')][_0x5f67('0x35')]));_0xb384a6[_0x5f67('0x36')]=_0xb384a6[_0x5f67('0x36')][_0x5f67('0x37')]?_0xb384a6[_0x5f67('0x36')]:_0x448c12[_0x5f67('0x31')];if(_0x32d825[_0x5f67('0x32')][_0x5f67('0x44')]){_0xb384a6[_0x5f67('0x4a')]=[{'all':!![]}];}_0xb384a6=_[_0x5f67('0x3f')]({},_0xb384a6,_0x32d825[_0x5f67('0x42')]);return db['MailSubstatus'][_0x5f67('0x4b')](_0xb384a6)['then'](handleEntityNotFound(_0x17bbd7,null))[_0x5f67('0x28')](respondWithResult(_0x17bbd7,null))[_0x5f67('0x46')](handleError(_0x17bbd7,null));};exports[_0x5f67('0x4c')]=function(_0x25130a,_0x512c8b){return db[_0x5f67('0x43')][_0x5f67('0x4c')](_0x25130a['body'],{})[_0x5f67('0x28')](respondWithResult(_0x512c8b,0xc9))[_0x5f67('0x46')](handleError(_0x512c8b,null));};exports[_0x5f67('0x27')]=function(_0x3ff28a,_0x59abb4){if(_0x3ff28a['body']['id']){delete _0x3ff28a[_0x5f67('0x4d')]['id'];}return db['MailSubstatus'][_0x5f67('0x4b')]({'where':{'id':_0x3ff28a[_0x5f67('0x48')]['id']}})[_0x5f67('0x28')](handleEntityNotFound(_0x59abb4,null))[_0x5f67('0x28')](saveUpdates(_0x3ff28a[_0x5f67('0x4d')],null))[_0x5f67('0x28')](respondWithResult(_0x59abb4,null))[_0x5f67('0x46')](handleError(_0x59abb4,null));};exports['destroy']=function(_0x6cfda,_0xd38948){return db[_0x5f67('0x43')]['find']({'where':{'id':_0x6cfda[_0x5f67('0x48')]['id']}})[_0x5f67('0x28')](handleEntityNotFound(_0xd38948,null))[_0x5f67('0x28')](removeEntity(_0xd38948,null))[_0x5f67('0x46')](handleError(_0xd38948,null));};exports[_0x5f67('0x4e')]=function(_0x403a7f,_0x30503d){return db[_0x5f67('0x43')]['describe']()[_0x5f67('0x28')](respondWithResult(_0x30503d,null))[_0x5f67('0x46')](handleError(_0x30503d,null));}; \ No newline at end of file +var _0xe90e=['end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','sendStatus','error','stack','name','index','map','MailSubstatus','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','keys','find','create','body','params','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','status'];(function(_0x27f933,_0x2004f6){var _0x3c0ae8=function(_0x566c6){while(--_0x566c6){_0x27f933['push'](_0x27f933['shift']());}};_0x3c0ae8(++_0x2004f6);}(_0xe90e,0x157));var _0xee90=function(_0xf85c54,_0x5b7cc2){_0xf85c54=_0xf85c54-0x0;var _0x5a0829=_0xe90e[_0xf85c54];return _0x5a0829;};'use strict';var emlformat=require(_0xee90('0x0'));var rimraf=require(_0xee90('0x1'));var zipdir=require(_0xee90('0x2'));var jsonpatch=require(_0xee90('0x3'));var rp=require('request-promise');var moment=require(_0xee90('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xee90('0x5'));var util=require('util');var path=require(_0xee90('0x6'));var sox=require(_0xee90('0x7'));var csv=require(_0xee90('0x8'));var ejs=require(_0xee90('0x9'));var fs=require('fs');var fs_extra=require(_0xee90('0xa'));var _=require('lodash');var squel=require(_0xee90('0xb'));var crypto=require(_0xee90('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xee90('0xd'));var toCsv=require(_0xee90('0x8'));var querystring=require('querystring');var Papa=require(_0xee90('0xe'));var Redis=require(_0xee90('0xf'));var authService=require(_0xee90('0x10'));var qs=require(_0xee90('0x11'));var as=require(_0xee90('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xee90('0x13'))('api');var utils=require(_0xee90('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5beaf7,_0x5ce1e2){_0x5ce1e2=_0x5ce1e2||0xcc;return function(_0x5183ab){if(_0x5183ab){return _0x5beaf7['sendStatus'](_0x5ce1e2);}return _0x5beaf7[_0xee90('0x15')](_0x5ce1e2)[_0xee90('0x16')]();};}function respondWithResult(_0x5cceca,_0x2ca7b3){_0x2ca7b3=_0x2ca7b3||0xc8;return function(_0xcc603c){if(_0xcc603c){return _0x5cceca['status'](_0x2ca7b3)['json'](_0xcc603c);}};}function respondWithFilteredResult(_0xe7f147,_0x5d29b9){return function(_0x4844a7){if(_0x4844a7){var _0x3e9b88=typeof _0x5d29b9[_0xee90('0x17')]===_0xee90('0x18')&&typeof _0x5d29b9[_0xee90('0x19')]===_0xee90('0x18');var _0x25026b=_0x4844a7['count'];var _0x3dd82c=_0x3e9b88?0x0:_0x5d29b9['offset'];var _0x1d275c=_0x3e9b88?_0x4844a7[_0xee90('0x1a')]:_0x5d29b9[_0xee90('0x17')]+_0x5d29b9['limit'];var _0x102112;if(_0x1d275c>=_0x25026b){_0x1d275c=_0x25026b;_0x102112=0xc8;}else{_0x102112=0xce;}_0xe7f147['status'](_0x102112);return _0xe7f147[_0xee90('0x1b')](_0xee90('0x1c'),_0x3dd82c+'-'+_0x1d275c+'/'+_0x25026b)[_0xee90('0x1d')](_0x4844a7);}return null;};}function patchUpdates(_0xc021e8){return function(_0x9023e7){try{jsonpatch[_0xee90('0x1e')](_0x9023e7,_0xc021e8,!![]);}catch(_0x2abd03){return BPromise[_0xee90('0x1f')](_0x2abd03);}return _0x9023e7['save']();};}function saveUpdates(_0x1b7879,_0x35ce58){return function(_0x56eeb0){if(_0x56eeb0){return _0x56eeb0[_0xee90('0x20')](_0x1b7879)[_0xee90('0x21')](function(_0x161463){return _0x161463;});}return null;};}function removeEntity(_0x114f44,_0x42406a){return function(_0x3564cb){if(_0x3564cb){return _0x3564cb['destroy']()[_0xee90('0x21')](function(){_0x114f44[_0xee90('0x15')](0xcc)[_0xee90('0x16')]();});}};}function handleEntityNotFound(_0x405c2b,_0x1002f3){return function(_0x2b9fc7){if(!_0x2b9fc7){_0x405c2b[_0xee90('0x22')](0x194);}return _0x2b9fc7;};}function handleError(_0x557b51,_0x2a4a17){_0x2a4a17=_0x2a4a17||0x1f4;return function(_0x29b541){logger[_0xee90('0x23')](_0x29b541[_0xee90('0x24')]);if(_0x29b541[_0xee90('0x25')]){delete _0x29b541[_0xee90('0x25')];}_0x557b51['status'](_0x2a4a17)['send'](_0x29b541);};}exports[_0xee90('0x26')]=function(_0x312837,_0x15f351){var _0x1916a3={},_0x404b33={},_0x2c92de={'count':0x0,'rows':[]};var _0x179a03=_[_0xee90('0x27')](db[_0xee90('0x28')][_0xee90('0x29')],function(_0x3e2dcd){return{'name':_0x3e2dcd[_0xee90('0x2a')],'type':_0x3e2dcd[_0xee90('0x2b')][_0xee90('0x2c')]};});_0x404b33['model']=_[_0xee90('0x27')](_0x179a03,_0xee90('0x25'));_0x404b33['query']=_['keys'](_0x312837[_0xee90('0x2d')]);_0x404b33[_0xee90('0x2e')]=_[_0xee90('0x2f')](_0x404b33[_0xee90('0x30')],_0x404b33[_0xee90('0x2d')]);_0x1916a3[_0xee90('0x31')]=_[_0xee90('0x2f')](_0x404b33[_0xee90('0x30')],qs[_0xee90('0x32')](_0x312837[_0xee90('0x2d')]['fields']));_0x1916a3[_0xee90('0x31')]=_0x1916a3[_0xee90('0x31')][_0xee90('0x33')]?_0x1916a3[_0xee90('0x31')]:_0x404b33[_0xee90('0x30')];if(!_0x312837[_0xee90('0x2d')][_0xee90('0x34')](_0xee90('0x35'))){_0x1916a3[_0xee90('0x19')]=qs[_0xee90('0x19')](_0x312837[_0xee90('0x2d')][_0xee90('0x19')]);_0x1916a3[_0xee90('0x17')]=qs[_0xee90('0x17')](_0x312837[_0xee90('0x2d')]['offset']);}_0x1916a3[_0xee90('0x36')]=qs[_0xee90('0x37')](_0x312837[_0xee90('0x2d')]['sort']);_0x1916a3[_0xee90('0x38')]=qs[_0xee90('0x2e')](_[_0xee90('0x39')](_0x312837[_0xee90('0x2d')],_0x404b33['filters']),_0x179a03);if(_0x312837[_0xee90('0x2d')]['filter']){_0x1916a3[_0xee90('0x38')]=_[_0xee90('0x3a')](_0x1916a3[_0xee90('0x38')],{'$or':_[_0xee90('0x27')](_0x179a03,function(_0x1f490b){if(_0x1f490b[_0xee90('0x2b')]!==_0xee90('0x3b')){var _0x37f48c={};_0x37f48c[_0x1f490b[_0xee90('0x25')]]={'$like':'%'+_0x312837['query']['filter']+'%'};return _0x37f48c;}})});}_0x1916a3=_[_0xee90('0x3a')]({},_0x1916a3,_0x312837[_0xee90('0x3c')]);var _0x212ec2={'where':_0x1916a3['where']};return db[_0xee90('0x28')][_0xee90('0x1a')](_0x212ec2)[_0xee90('0x21')](function(_0x2a2ba3){_0x2c92de['count']=_0x2a2ba3;if(_0x312837[_0xee90('0x2d')][_0xee90('0x3d')]){_0x1916a3['include']=[{'all':!![]}];}return db['MailSubstatus'][_0xee90('0x3e')](_0x1916a3);})['then'](function(_0x4f754e){_0x2c92de[_0xee90('0x3f')]=_0x4f754e;return _0x2c92de;})[_0xee90('0x21')](respondWithFilteredResult(_0x15f351,_0x1916a3))[_0xee90('0x40')](handleError(_0x15f351,null));};exports[_0xee90('0x41')]=function(_0x140936,_0x4b9836){var _0x2ddbad={'raw':!![],'where':{'id':_0x140936['params']['id']}},_0x15ade8={};_0x15ade8[_0xee90('0x30')]=_['keys'](db[_0xee90('0x28')][_0xee90('0x29')]);_0x15ade8[_0xee90('0x2d')]=_[_0xee90('0x42')](_0x140936['query']);_0x15ade8['filters']=_[_0xee90('0x2f')](_0x15ade8[_0xee90('0x30')],_0x15ade8[_0xee90('0x2d')]);_0x2ddbad['attributes']=_['intersection'](_0x15ade8[_0xee90('0x30')],qs[_0xee90('0x32')](_0x140936[_0xee90('0x2d')]['fields']));_0x2ddbad['attributes']=_0x2ddbad[_0xee90('0x31')]['length']?_0x2ddbad['attributes']:_0x15ade8[_0xee90('0x30')];if(_0x140936[_0xee90('0x2d')]['includeAll']){_0x2ddbad['include']=[{'all':!![]}];}_0x2ddbad=_[_0xee90('0x3a')]({},_0x2ddbad,_0x140936[_0xee90('0x3c')]);return db['MailSubstatus'][_0xee90('0x43')](_0x2ddbad)[_0xee90('0x21')](handleEntityNotFound(_0x4b9836,null))[_0xee90('0x21')](respondWithResult(_0x4b9836,null))[_0xee90('0x40')](handleError(_0x4b9836,null));};exports[_0xee90('0x44')]=function(_0x21f5c8,_0x4ef0fe){return db[_0xee90('0x28')][_0xee90('0x44')](_0x21f5c8[_0xee90('0x45')],{})[_0xee90('0x21')](respondWithResult(_0x4ef0fe,0xc9))[_0xee90('0x40')](handleError(_0x4ef0fe,null));};exports[_0xee90('0x20')]=function(_0x1bd2f3,_0xbd66a5){if(_0x1bd2f3[_0xee90('0x45')]['id']){delete _0x1bd2f3['body']['id'];}return db[_0xee90('0x28')]['find']({'where':{'id':_0x1bd2f3[_0xee90('0x46')]['id']}})[_0xee90('0x21')](handleEntityNotFound(_0xbd66a5,null))['then'](saveUpdates(_0x1bd2f3[_0xee90('0x45')],null))['then'](respondWithResult(_0xbd66a5,null))['catch'](handleError(_0xbd66a5,null));};exports[_0xee90('0x47')]=function(_0x32a89e,_0x291c65){return db[_0xee90('0x28')][_0xee90('0x43')]({'where':{'id':_0x32a89e[_0xee90('0x46')]['id']}})[_0xee90('0x21')](handleEntityNotFound(_0x291c65,null))[_0xee90('0x21')](removeEntity(_0x291c65,null))[_0xee90('0x40')](handleError(_0x291c65,null));};exports['describe']=function(_0x548cf9,_0x2772a3){return db['MailSubstatus'][_0xee90('0x48')]()['then'](respondWithResult(_0x2772a3,null))[_0xee90('0x40')](handleError(_0x2772a3,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index 0ebe41e..ac7b66f 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 _0xdd03=['../../mysqldb','MailSubstatus','setMaxListeners','update','emit','hasOwnProperty'];(function(_0x554047,_0x46ec41){var _0x5d11e4=function(_0x5a026e){while(--_0x5a026e){_0x554047['push'](_0x554047['shift']());}};_0x5d11e4(++_0x46ec41);}(_0xdd03,0x150));var _0x3dd0=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xdd03[_0x167cc1];return _0x10bc4b;};'use strict';var EventEmitter=require('events');var MailSubstatus=require(_0x3dd0('0x0'))['db'][_0x3dd0('0x1')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x3dd0('0x2')](0x0);var events={'afterUpdate':_0x3dd0('0x3')};function emitEvent(_0xdf7db6){return function(_0x316a88,_0xab376e,_0x457848){MailSubstatusEvents['emit'](_0xdf7db6+':'+_0x316a88['id'],_0x316a88);MailSubstatusEvents[_0x3dd0('0x4')](_0xdf7db6,_0x316a88);_0x457848(null);};}for(var e in events){if(events[_0x3dd0('0x5')](e)){var event=events[e];MailSubstatus['hook'](e,emitEvent(event));}}module['exports']=MailSubstatusEvents; \ No newline at end of file +var _0x87b4=['MailSubstatus','setMaxListeners','update','emit','exports','events','../../mysqldb'];(function(_0xa57e3a,_0x174b68){var _0x41214d=function(_0x136b31){while(--_0x136b31){_0xa57e3a['push'](_0xa57e3a['shift']());}};_0x41214d(++_0x174b68);}(_0x87b4,0x1cc));var _0x487b=function(_0xfc170c,_0x258b27){_0xfc170c=_0xfc170c-0x0;var _0x295e5e=_0x87b4[_0xfc170c];return _0x295e5e;};'use strict';var EventEmitter=require(_0x487b('0x0'));var MailSubstatus=require(_0x487b('0x1'))['db'][_0x487b('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x487b('0x3')](0x0);var events={'afterUpdate':_0x487b('0x4')};function emitEvent(_0xbe0981){return function(_0x4daa2c,_0x434f9c,_0x4a1bfb){MailSubstatusEvents['emit'](_0xbe0981+':'+_0x4daa2c['id'],_0x4daa2c);MailSubstatusEvents[_0x487b('0x5')](_0xbe0981,_0x4daa2c);_0x4a1bfb(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailSubstatus['hook'](e,emitEvent(event));}}module[_0x487b('0x6')]=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index d036b37..c912c83 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 _0x6be9=['update','name','mailSubstatus','_previousDataValues','then','./mailSubstatus.attributes','exports','define','MailSubstatus','mail_substatuses','Condition'];(function(_0x125f9b,_0x3aa805){var _0x1e7d0e=function(_0x3c161c){while(--_0x3c161c){_0x125f9b['push'](_0x125f9b['shift']());}};_0x1e7d0e(++_0x3aa805);}(_0x6be9,0xec));var _0x96be=function(_0x1b3f18,_0x358e43){_0x1b3f18=_0x1b3f18-0x0;var _0x2e8c2b=_0x6be9[_0x1b3f18];return _0x2e8c2b;};'use strict';var attributes=require(_0x96be('0x0'));module[_0x96be('0x1')]=function(_0x3b9a69){var _0x78de52=_0x3b9a69['models'];return _0x3b9a69[_0x96be('0x2')](_0x96be('0x3'),attributes,{'tableName':_0x96be('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x162adc,_0x301fc6,_0x239e19){return _0x78de52[_0x96be('0x5')][_0x96be('0x6')]({'value':_0x162adc[_0x96be('0x7')]},{'where':{'field':_0x96be('0x8'),'value':_0x162adc[_0x96be('0x9')][_0x96be('0x7')]}})[_0x96be('0xa')](function(){_0x239e19();})['catch'](function(_0x1cdea7){_0x239e19(_0x1cdea7);});}}});}; \ No newline at end of file +var _0xda23=['_previousDataValues','then','catch','exports','models','define','MailSubstatus','mail_substatuses','Condition','name','mailSubstatus'];(function(_0x2a5099,_0x329e92){var _0x2802f1=function(_0x53f99b){while(--_0x53f99b){_0x2a5099['push'](_0x2a5099['shift']());}};_0x2802f1(++_0x329e92);}(_0xda23,0x1d1));var _0x3da2=function(_0x456b57,_0x58691a){_0x456b57=_0x456b57-0x0;var _0x18f49f=_0xda23[_0x456b57];return _0x18f49f;};'use strict';var attributes=require('./mailSubstatus.attributes');module[_0x3da2('0x0')]=function(_0x4797e5){var _0x358e65=_0x4797e5[_0x3da2('0x1')];return _0x4797e5[_0x3da2('0x2')](_0x3da2('0x3'),attributes,{'tableName':_0x3da2('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x5f46f7,_0x65c451,_0x4d7621){return _0x358e65[_0x3da2('0x5')]['update']({'value':_0x5f46f7[_0x3da2('0x6')]},{'where':{'field':_0x3da2('0x7'),'value':_0x5f46f7[_0x3da2('0x8')]['name']}})[_0x3da2('0x9')](function(){_0x4d7621();})[_0x3da2('0xa')](function(_0xfa0bbf){_0x4d7621(_0xfa0bbf);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 57019d5..d1cd32c 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 _0xb90b=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','MailSubstatus,\x20%s,\x20%s','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x183b21,_0x271b8e){var _0x4dbe1b=function(_0x32e3e2){while(--_0x32e3e2){_0x183b21['push'](_0x183b21['shift']());}};_0x4dbe1b(++_0x271b8e);}(_0xb90b,0xd2));var _0xbb90=function(_0x2b02b7,_0x45dafb){_0x2b02b7=_0x2b02b7-0x0;var _0x3cd05a=_0xb90b[_0x2b02b7];return _0x3cd05a;};'use strict';var _=require(_0xbb90('0x0'));var util=require(_0xbb90('0x1'));var moment=require(_0xbb90('0x2'));var BPromise=require(_0xbb90('0x3'));var rs=require(_0xbb90('0x4'));var fs=require('fs');var Redis=require(_0xbb90('0x5'));var db=require(_0xbb90('0x6'))['db'];var utils=require(_0xbb90('0x7'));var logger=require(_0xbb90('0x8'))(_0xbb90('0x9'));var config=require(_0xbb90('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xbb90('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0xbf1f30,_0x58c819,_0x3c4a31){return new BPromise(function(_0x5b1b35,_0x4f54b5){return client[_0xbb90('0xc')](_0xbf1f30,_0x3c4a31)[_0xbb90('0xd')](function(_0x5d4986){logger[_0xbb90('0xe')](_0xbb90('0xf'),_0x58c819,'request\x20sent');logger[_0xbb90('0x10')](_0xbb90('0x11'),_0x58c819,_0xbb90('0x12'),JSON[_0xbb90('0x13')](_0x5d4986));if(_0x5d4986['error']){if(_0x5d4986[_0xbb90('0x14')][_0xbb90('0x15')]===0x1f4){logger[_0xbb90('0x14')]('MailSubstatus,\x20%s,\x20%s',_0x58c819,_0x5d4986[_0xbb90('0x14')][_0xbb90('0x16')]);return _0x4f54b5(_0x5d4986[_0xbb90('0x14')]['message']);}logger[_0xbb90('0x14')](_0xbb90('0xf'),_0x58c819,_0x5d4986[_0xbb90('0x14')][_0xbb90('0x16')]);return _0x5b1b35(_0x5d4986[_0xbb90('0x14')]['message']);}else{logger[_0xbb90('0xe')](_0xbb90('0xf'),_0x58c819,_0xbb90('0x12'));_0x5b1b35(_0x5d4986[_0xbb90('0x17')][_0xbb90('0x16')]);}})['catch'](function(_0x253790){logger[_0xbb90('0x14')]('MailSubstatus,\x20%s,\x20%s',_0x58c819,_0x253790);_0x4f54b5(_0x253790);});});} \ No newline at end of file +var _0x08e6=['../../config/logger','rpc','../../config/environment','client','http','request','then','MailSubstatus,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x08e6,0x1b1));var _0x608e=function(_0x54a70,_0xac82ee){_0x54a70=_0x54a70-0x0;var _0x422d1d=_0x08e6[_0x54a70];return _0x422d1d;};'use strict';var _=require('lodash');var util=require(_0x608e('0x0'));var moment=require(_0x608e('0x1'));var BPromise=require(_0x608e('0x2'));var rs=require(_0x608e('0x3'));var fs=require('fs');var Redis=require(_0x608e('0x4'));var db=require(_0x608e('0x5'))['db'];var utils=require(_0x608e('0x6'));var logger=require(_0x608e('0x7'))(_0x608e('0x8'));var config=require(_0x608e('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x608e('0xa')][_0x608e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x588f56,_0x375677,_0x4357cf){return new BPromise(function(_0xe3900b,_0x13d465){return client[_0x608e('0xc')](_0x588f56,_0x4357cf)[_0x608e('0xd')](function(_0x53c107){logger['info'](_0x608e('0xe'),_0x375677,'request\x20sent');logger['debug']('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x375677,_0x608e('0xf'),JSON[_0x608e('0x10')](_0x53c107));if(_0x53c107['error']){if(_0x53c107[_0x608e('0x11')][_0x608e('0x12')]===0x1f4){logger['error']('MailSubstatus,\x20%s,\x20%s',_0x375677,_0x53c107[_0x608e('0x11')][_0x608e('0x13')]);return _0x13d465(_0x53c107[_0x608e('0x11')][_0x608e('0x13')]);}logger[_0x608e('0x11')](_0x608e('0xe'),_0x375677,_0x53c107[_0x608e('0x11')][_0x608e('0x13')]);return _0xe3900b(_0x53c107['error']['message']);}else{logger['info'](_0x608e('0xe'),_0x375677,_0x608e('0xf'));_0xe3900b(_0x53c107[_0x608e('0x14')][_0x608e('0x13')]);}})[_0x608e('0x15')](function(_0x207b0f){logger[_0x608e('0x11')](_0x608e('0xe'),_0x375677,_0x207b0f);_0x13d465(_0x207b0f);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 789dcb7..0f1c903 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 _0x61f9=['/describe','describe','show','create','put','/:id','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','isAuthenticated','get'];(function(_0x51ac09,_0x383098){var _0x3f827d=function(_0x2d8d0f){while(--_0x2d8d0f){_0x51ac09['push'](_0x51ac09['shift']());}};_0x3f827d(++_0x383098);}(_0x61f9,0x97));var _0x961f=function(_0x2208f6,_0x3135c2){_0x2208f6=_0x2208f6-0x0;var _0x12ed61=_0x61f9[_0x2208f6];return _0x12ed61;};'use strict';var multer=require(_0x961f('0x0'));var util=require(_0x961f('0x1'));var path=require(_0x961f('0x2'));var timeout=require(_0x961f('0x3'));var express=require(_0x961f('0x4'));var router=express[_0x961f('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x961f('0x6'));var config=require('../../config/environment');var controller=require('./mailTransferReport.controller');router['get']('/',auth[_0x961f('0x7')](),controller['index']);router[_0x961f('0x8')](_0x961f('0x9'),auth['isAuthenticated'](),controller[_0x961f('0xa')]);router[_0x961f('0x8')]('/:id',auth[_0x961f('0x7')](),controller[_0x961f('0xb')]);router['post']('/',auth[_0x961f('0x7')](),controller[_0x961f('0xc')]);router[_0x961f('0xd')](_0x961f('0xe'),auth[_0x961f('0x7')](),controller['update']);router['delete'](_0x961f('0xe'),auth[_0x961f('0x7')](),controller['destroy']);module[_0x961f('0xf')]=router; \ No newline at end of file +var _0x9096=['./mailTransferReport.controller','get','index','/describe','isAuthenticated','describe','show','post','create','put','update','delete','/:id','destroy','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment'];(function(_0x402f03,_0x49bc02){var _0x29a404=function(_0x2d3fe8){while(--_0x2d3fe8){_0x402f03['push'](_0x402f03['shift']());}};_0x29a404(++_0x49bc02);}(_0x9096,0x1b2));var _0x6909=function(_0x218e6b,_0xbca2e6){_0x218e6b=_0x218e6b-0x0;var _0x1487cc=_0x9096[_0x218e6b];return _0x1487cc;};'use strict';var multer=require(_0x6909('0x0'));var util=require('util');var path=require(_0x6909('0x1'));var timeout=require(_0x6909('0x2'));var express=require(_0x6909('0x3'));var router=express[_0x6909('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x6909('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x6909('0x6'));var controller=require(_0x6909('0x7'));router[_0x6909('0x8')]('/',auth['isAuthenticated'](),controller[_0x6909('0x9')]);router[_0x6909('0x8')](_0x6909('0xa'),auth[_0x6909('0xb')](),controller[_0x6909('0xc')]);router[_0x6909('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x6909('0xd')]);router[_0x6909('0xe')]('/',auth[_0x6909('0xb')](),controller[_0x6909('0xf')]);router[_0x6909('0x10')]('/:id',auth[_0x6909('0xb')](),controller[_0x6909('0x11')]);router[_0x6909('0x12')](_0x6909('0x13'),auth['isAuthenticated'](),controller[_0x6909('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index e952de5..5c33a3e 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 _0xe706=['NOW','moment','sequelize','exports','ENUM','account','agent','queue','DATE'];(function(_0x790c80,_0x58e752){var _0x2321be=function(_0x4d3ad2){while(--_0x4d3ad2){_0x790c80['push'](_0x790c80['shift']());}};_0x2321be(++_0x58e752);}(_0xe706,0xa3));var _0x6e70=function(_0x85e9c6,_0xedec06){_0x85e9c6=_0x85e9c6-0x0;var _0x880842=_0xe706[_0x85e9c6];return _0x880842;};'use strict';var moment=require(_0x6e70('0x0'));var Sequelize=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x6e70('0x3')](_0x6e70('0x4'),_0x6e70('0x5'),_0x6e70('0x6')),'allowNull':![],'defaultValue':_0x6e70('0x6')},'transferredAt':{'type':Sequelize[_0x6e70('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x6e70('0x8')]}}; \ No newline at end of file +var _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x3ce2c4,_0x4544c1){var _0x4047c1=function(_0x3fece6){while(--_0x3fece6){_0x3ce2c4['push'](_0x3ce2c4['shift']());}};_0x4047c1(++_0x4544c1);}(_0xb43b,0x1b2));var _0xbb43=function(_0x4b0f75,_0x4df71f){_0x4b0f75=_0x4b0f75-0x0;var _0x577679=_0xb43b[_0x4b0f75];return _0x577679;};'use strict';var moment=require(_0xbb43('0x0'));var Sequelize=require(_0xbb43('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xbb43('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbb43('0x3')](_0xbb43('0x4'),'agent',_0xbb43('0x5')),'allowNull':![],'defaultValue':_0xbb43('0x5')},'transferredAt':{'type':Sequelize[_0xbb43('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xbb43('0x7')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 7fc16dc..768a4ba 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 _0xceca=['key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','filter','where','merge','VIRTUAL','includeAll','include','findAll','show','params','options','find','catch','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','end','error','stack','name','index','map','MailTransferReport','rawAttributes','fieldName','type'];(function(_0x529987,_0x4c88a5){var _0x1fee90=function(_0x3b908d){while(--_0x3b908d){_0x529987['push'](_0x529987['shift']());}};_0x1fee90(++_0x4c88a5);}(_0xceca,0x1ef));var _0xacec=function(_0x47736a,_0x399e19){_0x47736a=_0x47736a-0x0;var _0xb6cdf2=_0xceca[_0x47736a];return _0xb6cdf2;};'use strict';var emlformat=require(_0xacec('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xacec('0x1'));var jsonpatch=require(_0xacec('0x2'));var rp=require(_0xacec('0x3'));var moment=require(_0xacec('0x4'));var BPromise=require(_0xacec('0x5'));var Mustache=require(_0xacec('0x6'));var util=require(_0xacec('0x7'));var path=require(_0xacec('0x8'));var sox=require(_0xacec('0x9'));var csv=require(_0xacec('0xa'));var ejs=require(_0xacec('0xb'));var fs=require('fs');var fs_extra=require(_0xacec('0xc'));var _=require(_0xacec('0xd'));var squel=require('squel');var crypto=require(_0xacec('0xe'));var jsforce=require(_0xacec('0xf'));var deskjs=require(_0xacec('0x10'));var toCsv=require(_0xacec('0xa'));var querystring=require(_0xacec('0x11'));var Papa=require(_0xacec('0x12'));var Redis=require(_0xacec('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xacec('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xacec('0x15'));var logger=require(_0xacec('0x16'))(_0xacec('0x17'));var utils=require(_0xacec('0x18'));var config=require(_0xacec('0x19'));var licenseUtil=require(_0xacec('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x81e664,_0x56699c){_0x56699c=_0x56699c||0xcc;return function(_0xd91c39){if(_0xd91c39){return _0x81e664[_0xacec('0x1b')](_0x56699c);}return _0x81e664['status'](_0x56699c)['end']();};}function respondWithResult(_0x1ff830,_0x9f12d3){_0x9f12d3=_0x9f12d3||0xc8;return function(_0x47cfc4){if(_0x47cfc4){return _0x1ff830[_0xacec('0x1c')](_0x9f12d3)[_0xacec('0x1d')](_0x47cfc4);}};}function respondWithFilteredResult(_0x4558c7,_0x2afc51){return function(_0x2aa1dd){if(_0x2aa1dd){var _0x2734db=typeof _0x2afc51['offset']===_0xacec('0x1e')&&typeof _0x2afc51['limit']===_0xacec('0x1e');var _0x4bd34d=_0x2aa1dd[_0xacec('0x1f')];var _0x4f2bf3=_0x2734db?0x0:_0x2afc51[_0xacec('0x20')];var _0x511c9f=_0x2734db?_0x2aa1dd[_0xacec('0x1f')]:_0x2afc51[_0xacec('0x20')]+_0x2afc51[_0xacec('0x21')];var _0x5b02f7;if(_0x511c9f>=_0x4bd34d){_0x511c9f=_0x4bd34d;_0x5b02f7=0xc8;}else{_0x5b02f7=0xce;}_0x4558c7[_0xacec('0x1c')](_0x5b02f7);return _0x4558c7[_0xacec('0x22')](_0xacec('0x23'),_0x4f2bf3+'-'+_0x511c9f+'/'+_0x4bd34d)['json'](_0x2aa1dd);}return null;};}function patchUpdates(_0x5c83b5){return function(_0x290129){try{jsonpatch[_0xacec('0x24')](_0x290129,_0x5c83b5,!![]);}catch(_0x5b21a2){return BPromise[_0xacec('0x25')](_0x5b21a2);}return _0x290129[_0xacec('0x26')]();};}function saveUpdates(_0x39f552,_0x1dfc10){return function(_0x502a17){if(_0x502a17){return _0x502a17[_0xacec('0x27')](_0x39f552)[_0xacec('0x28')](function(_0x2de73c){return _0x2de73c;});}return null;};}function removeEntity(_0x18b403,_0x3c4e67){return function(_0x4e1b11){if(_0x4e1b11){return _0x4e1b11['destroy']()[_0xacec('0x28')](function(){_0x18b403[_0xacec('0x1c')](0xcc)[_0xacec('0x29')]();});}};}function handleEntityNotFound(_0xf8df79,_0x5baf9d){return function(_0x35c560){if(!_0x35c560){_0xf8df79[_0xacec('0x1b')](0x194);}return _0x35c560;};}function handleError(_0x1d8170,_0x220831){_0x220831=_0x220831||0x1f4;return function(_0x99f0fe){logger[_0xacec('0x2a')](_0x99f0fe[_0xacec('0x2b')]);if(_0x99f0fe[_0xacec('0x2c')]){delete _0x99f0fe['name'];}_0x1d8170[_0xacec('0x1c')](_0x220831)['send'](_0x99f0fe);};}exports[_0xacec('0x2d')]=function(_0x32bee7,_0x22043e){var _0x1c1bde={},_0x573614={},_0x52ac4b={'count':0x0,'rows':[]};var _0x3239ab=_[_0xacec('0x2e')](db[_0xacec('0x2f')][_0xacec('0x30')],function(_0x30156c){return{'name':_0x30156c[_0xacec('0x31')],'type':_0x30156c[_0xacec('0x32')][_0xacec('0x33')]};});_0x573614[_0xacec('0x34')]=_[_0xacec('0x2e')](_0x3239ab,_0xacec('0x2c'));_0x573614[_0xacec('0x35')]=_[_0xacec('0x36')](_0x32bee7['query']);_0x573614['filters']=_[_0xacec('0x37')](_0x573614[_0xacec('0x34')],_0x573614[_0xacec('0x35')]);_0x1c1bde[_0xacec('0x38')]=_['intersection'](_0x573614[_0xacec('0x34')],qs[_0xacec('0x39')](_0x32bee7[_0xacec('0x35')][_0xacec('0x39')]));_0x1c1bde[_0xacec('0x38')]=_0x1c1bde[_0xacec('0x38')][_0xacec('0x3a')]?_0x1c1bde['attributes']:_0x573614[_0xacec('0x34')];if(!_0x32bee7[_0xacec('0x35')][_0xacec('0x3b')]('nolimit')){_0x1c1bde[_0xacec('0x21')]=qs[_0xacec('0x21')](_0x32bee7[_0xacec('0x35')][_0xacec('0x21')]);_0x1c1bde[_0xacec('0x20')]=qs[_0xacec('0x20')](_0x32bee7[_0xacec('0x35')]['offset']);}_0x1c1bde[_0xacec('0x3c')]=qs[_0xacec('0x3d')](_0x32bee7[_0xacec('0x35')]['sort']);_0x1c1bde['where']=qs[_0xacec('0x3e')](_['pick'](_0x32bee7[_0xacec('0x35')],_0x573614[_0xacec('0x3e')]),_0x3239ab);if(_0x32bee7['query'][_0xacec('0x3f')]){_0x1c1bde[_0xacec('0x40')]=_[_0xacec('0x41')](_0x1c1bde['where'],{'$or':_['map'](_0x3239ab,function(_0x27c9bd){if(_0x27c9bd[_0xacec('0x32')]!==_0xacec('0x42')){var _0x3ed4af={};_0x3ed4af[_0x27c9bd[_0xacec('0x2c')]]={'$like':'%'+_0x32bee7['query'][_0xacec('0x3f')]+'%'};return _0x3ed4af;}})});}_0x1c1bde=_[_0xacec('0x41')]({},_0x1c1bde,_0x32bee7['options']);var _0x524215={'where':_0x1c1bde[_0xacec('0x40')]};return db[_0xacec('0x2f')][_0xacec('0x1f')](_0x524215)[_0xacec('0x28')](function(_0x239b66){_0x52ac4b[_0xacec('0x1f')]=_0x239b66;if(_0x32bee7[_0xacec('0x35')][_0xacec('0x43')]){_0x1c1bde[_0xacec('0x44')]=[{'all':!![]}];}return db[_0xacec('0x2f')][_0xacec('0x45')](_0x1c1bde);})[_0xacec('0x28')](function(_0x30e06c){_0x52ac4b['rows']=_0x30e06c;return _0x52ac4b;})['then'](respondWithFilteredResult(_0x22043e,_0x1c1bde))['catch'](handleError(_0x22043e,null));};exports[_0xacec('0x46')]=function(_0x2b7515,_0x11a3c7){var _0x442be3={'raw':!![],'where':{'id':_0x2b7515[_0xacec('0x47')]['id']}},_0x43ee1b={};_0x43ee1b['model']=_['keys'](db[_0xacec('0x2f')]['rawAttributes']);_0x43ee1b[_0xacec('0x35')]=_[_0xacec('0x36')](_0x2b7515['query']);_0x43ee1b[_0xacec('0x3e')]=_[_0xacec('0x37')](_0x43ee1b[_0xacec('0x34')],_0x43ee1b[_0xacec('0x35')]);_0x442be3[_0xacec('0x38')]=_[_0xacec('0x37')](_0x43ee1b[_0xacec('0x34')],qs['fields'](_0x2b7515[_0xacec('0x35')]['fields']));_0x442be3[_0xacec('0x38')]=_0x442be3[_0xacec('0x38')]['length']?_0x442be3[_0xacec('0x38')]:_0x43ee1b[_0xacec('0x34')];if(_0x2b7515['query'][_0xacec('0x43')]){_0x442be3['include']=[{'all':!![]}];}_0x442be3=_[_0xacec('0x41')]({},_0x442be3,_0x2b7515[_0xacec('0x48')]);return db[_0xacec('0x2f')][_0xacec('0x49')](_0x442be3)[_0xacec('0x28')](handleEntityNotFound(_0x11a3c7,null))['then'](respondWithResult(_0x11a3c7,null))[_0xacec('0x4a')](handleError(_0x11a3c7,null));};exports[_0xacec('0x4b')]=function(_0x2777ca,_0x434c56){return db[_0xacec('0x2f')][_0xacec('0x4b')](_0x2777ca[_0xacec('0x4c')],{})['then'](respondWithResult(_0x434c56,0xc9))[_0xacec('0x4a')](handleError(_0x434c56,null));};exports[_0xacec('0x27')]=function(_0x48e272,_0x1c652d){if(_0x48e272[_0xacec('0x4c')]['id']){delete _0x48e272[_0xacec('0x4c')]['id'];}return db[_0xacec('0x2f')][_0xacec('0x49')]({'where':{'id':_0x48e272[_0xacec('0x47')]['id']}})['then'](handleEntityNotFound(_0x1c652d,null))[_0xacec('0x28')](saveUpdates(_0x48e272[_0xacec('0x4c')],null))[_0xacec('0x28')](respondWithResult(_0x1c652d,null))['catch'](handleError(_0x1c652d,null));};exports['destroy']=function(_0x1e8842,_0x8894f){return db[_0xacec('0x2f')][_0xacec('0x49')]({'where':{'id':_0x1e8842['params']['id']}})[_0xacec('0x28')](handleEntityNotFound(_0x8894f,null))[_0xacec('0x28')](removeEntity(_0x8894f,null))[_0xacec('0x4a')](handleError(_0x8894f,null));};exports[_0xacec('0x4d')]=function(_0xe639fc,_0x875981){return db[_0xacec('0x2f')][_0xacec('0x4d')]()[_0xacec('0x28')](respondWithResult(_0x875981,null))['catch'](handleError(_0x875981,null));}; \ No newline at end of file +var _0xd4eb=['eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','index','map','MailTransferReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body'];(function(_0x2e7529,_0x2d828b){var _0x4930f2=function(_0x56445a){while(--_0x56445a){_0x2e7529['push'](_0x2e7529['shift']());}};_0x4930f2(++_0x2d828b);}(_0xd4eb,0xf3));var _0xbd4e=function(_0x143be8,_0x58da73){_0x143be8=_0x143be8-0x0;var _0x3ba966=_0xd4eb[_0x143be8];return _0x3ba966;};'use strict';var emlformat=require(_0xbd4e('0x0'));var rimraf=require(_0xbd4e('0x1'));var zipdir=require(_0xbd4e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbd4e('0x3'));var moment=require(_0xbd4e('0x4'));var BPromise=require(_0xbd4e('0x5'));var Mustache=require('mustache');var util=require(_0xbd4e('0x6'));var path=require(_0xbd4e('0x7'));var sox=require(_0xbd4e('0x8'));var csv=require(_0xbd4e('0x9'));var ejs=require(_0xbd4e('0xa'));var fs=require('fs');var fs_extra=require(_0xbd4e('0xb'));var _=require(_0xbd4e('0xc'));var squel=require(_0xbd4e('0xd'));var crypto=require(_0xbd4e('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xbd4e('0xf'));var toCsv=require(_0xbd4e('0x9'));var querystring=require(_0xbd4e('0x10'));var Papa=require(_0xbd4e('0x11'));var Redis=require('ioredis');var authService=require(_0xbd4e('0x12'));var qs=require(_0xbd4e('0x13'));var as=require(_0xbd4e('0x14'));var hardwareService=require(_0xbd4e('0x15'));var logger=require(_0xbd4e('0x16'))(_0xbd4e('0x17'));var utils=require(_0xbd4e('0x18'));var config=require(_0xbd4e('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xbd4e('0x1a'))['db'];function respondWithStatusCode(_0x6db90d,_0x122ef5){_0x122ef5=_0x122ef5||0xcc;return function(_0x545f66){if(_0x545f66){return _0x6db90d['sendStatus'](_0x122ef5);}return _0x6db90d[_0xbd4e('0x1b')](_0x122ef5)[_0xbd4e('0x1c')]();};}function respondWithResult(_0x29338d,_0x1103c2){_0x1103c2=_0x1103c2||0xc8;return function(_0x41886e){if(_0x41886e){return _0x29338d[_0xbd4e('0x1b')](_0x1103c2)[_0xbd4e('0x1d')](_0x41886e);}};}function respondWithFilteredResult(_0x1b089d,_0xc37161){return function(_0x20900f){if(_0x20900f){var _0x3eb95e=typeof _0xc37161[_0xbd4e('0x1e')]==='undefined'&&typeof _0xc37161[_0xbd4e('0x1f')]===_0xbd4e('0x20');var _0x2111aa=_0x20900f[_0xbd4e('0x21')];var _0x1dea6f=_0x3eb95e?0x0:_0xc37161[_0xbd4e('0x1e')];var _0x20def8=_0x3eb95e?_0x20900f['count']:_0xc37161[_0xbd4e('0x1e')]+_0xc37161['limit'];var _0x2d8d18;if(_0x20def8>=_0x2111aa){_0x20def8=_0x2111aa;_0x2d8d18=0xc8;}else{_0x2d8d18=0xce;}_0x1b089d['status'](_0x2d8d18);return _0x1b089d[_0xbd4e('0x22')](_0xbd4e('0x23'),_0x1dea6f+'-'+_0x20def8+'/'+_0x2111aa)[_0xbd4e('0x1d')](_0x20900f);}return null;};}function patchUpdates(_0x25055a){return function(_0x5c36bc){try{jsonpatch[_0xbd4e('0x24')](_0x5c36bc,_0x25055a,!![]);}catch(_0x2c0be2){return BPromise[_0xbd4e('0x25')](_0x2c0be2);}return _0x5c36bc[_0xbd4e('0x26')]();};}function saveUpdates(_0x1a3236,_0xc2522d){return function(_0x3b4e87){if(_0x3b4e87){return _0x3b4e87[_0xbd4e('0x27')](_0x1a3236)[_0xbd4e('0x28')](function(_0xe2726c){return _0xe2726c;});}return null;};}function removeEntity(_0x10bdfd,_0x312abd){return function(_0x41ca9f){if(_0x41ca9f){return _0x41ca9f[_0xbd4e('0x29')]()[_0xbd4e('0x28')](function(){_0x10bdfd[_0xbd4e('0x1b')](0xcc)[_0xbd4e('0x1c')]();});}};}function handleEntityNotFound(_0x36f1ef,_0x580dbc){return function(_0x42aed4){if(!_0x42aed4){_0x36f1ef[_0xbd4e('0x2a')](0x194);}return _0x42aed4;};}function handleError(_0x3fe15a,_0x25ca5f){_0x25ca5f=_0x25ca5f||0x1f4;return function(_0x24a233){logger['error'](_0x24a233[_0xbd4e('0x2b')]);if(_0x24a233[_0xbd4e('0x2c')]){delete _0x24a233['name'];}_0x3fe15a['status'](_0x25ca5f)[_0xbd4e('0x2d')](_0x24a233);};}exports[_0xbd4e('0x2e')]=function(_0xda7d5f,_0x20715d){var _0x371772={},_0x15ff30={},_0x3c43cc={'count':0x0,'rows':[]};var _0x573858=_[_0xbd4e('0x2f')](db[_0xbd4e('0x30')][_0xbd4e('0x31')],function(_0x107e49){return{'name':_0x107e49[_0xbd4e('0x32')],'type':_0x107e49[_0xbd4e('0x33')][_0xbd4e('0x34')]};});_0x15ff30[_0xbd4e('0x35')]=_[_0xbd4e('0x2f')](_0x573858,_0xbd4e('0x2c'));_0x15ff30['query']=_[_0xbd4e('0x36')](_0xda7d5f[_0xbd4e('0x37')]);_0x15ff30[_0xbd4e('0x38')]=_[_0xbd4e('0x39')](_0x15ff30[_0xbd4e('0x35')],_0x15ff30[_0xbd4e('0x37')]);_0x371772[_0xbd4e('0x3a')]=_[_0xbd4e('0x39')](_0x15ff30['model'],qs[_0xbd4e('0x3b')](_0xda7d5f['query']['fields']));_0x371772['attributes']=_0x371772[_0xbd4e('0x3a')][_0xbd4e('0x3c')]?_0x371772['attributes']:_0x15ff30[_0xbd4e('0x35')];if(!_0xda7d5f[_0xbd4e('0x37')][_0xbd4e('0x3d')](_0xbd4e('0x3e'))){_0x371772[_0xbd4e('0x1f')]=qs[_0xbd4e('0x1f')](_0xda7d5f[_0xbd4e('0x37')]['limit']);_0x371772[_0xbd4e('0x1e')]=qs[_0xbd4e('0x1e')](_0xda7d5f[_0xbd4e('0x37')][_0xbd4e('0x1e')]);}_0x371772[_0xbd4e('0x3f')]=qs[_0xbd4e('0x40')](_0xda7d5f[_0xbd4e('0x37')][_0xbd4e('0x40')]);_0x371772['where']=qs[_0xbd4e('0x38')](_[_0xbd4e('0x41')](_0xda7d5f[_0xbd4e('0x37')],_0x15ff30[_0xbd4e('0x38')]),_0x573858);if(_0xda7d5f[_0xbd4e('0x37')][_0xbd4e('0x42')]){_0x371772[_0xbd4e('0x43')]=_[_0xbd4e('0x44')](_0x371772[_0xbd4e('0x43')],{'$or':_['map'](_0x573858,function(_0xa64c4c){if(_0xa64c4c['type']!==_0xbd4e('0x45')){var _0x27b278={};_0x27b278[_0xa64c4c['name']]={'$like':'%'+_0xda7d5f[_0xbd4e('0x37')][_0xbd4e('0x42')]+'%'};return _0x27b278;}})});}_0x371772=_[_0xbd4e('0x44')]({},_0x371772,_0xda7d5f[_0xbd4e('0x46')]);var _0x3105e6={'where':_0x371772[_0xbd4e('0x43')]};return db[_0xbd4e('0x30')]['count'](_0x3105e6)['then'](function(_0x5d4947){_0x3c43cc[_0xbd4e('0x21')]=_0x5d4947;if(_0xda7d5f[_0xbd4e('0x37')][_0xbd4e('0x47')]){_0x371772[_0xbd4e('0x48')]=[{'all':!![]}];}return db[_0xbd4e('0x30')][_0xbd4e('0x49')](_0x371772);})['then'](function(_0x4a5371){_0x3c43cc[_0xbd4e('0x4a')]=_0x4a5371;return _0x3c43cc;})['then'](respondWithFilteredResult(_0x20715d,_0x371772))[_0xbd4e('0x4b')](handleError(_0x20715d,null));};exports[_0xbd4e('0x4c')]=function(_0x5d7a39,_0x371a4b){var _0x150d86={'raw':!![],'where':{'id':_0x5d7a39[_0xbd4e('0x4d')]['id']}},_0x18eca4={};_0x18eca4['model']=_['keys'](db['MailTransferReport'][_0xbd4e('0x31')]);_0x18eca4[_0xbd4e('0x37')]=_[_0xbd4e('0x36')](_0x5d7a39[_0xbd4e('0x37')]);_0x18eca4[_0xbd4e('0x38')]=_[_0xbd4e('0x39')](_0x18eca4[_0xbd4e('0x35')],_0x18eca4[_0xbd4e('0x37')]);_0x150d86[_0xbd4e('0x3a')]=_[_0xbd4e('0x39')](_0x18eca4[_0xbd4e('0x35')],qs[_0xbd4e('0x3b')](_0x5d7a39['query'][_0xbd4e('0x3b')]));_0x150d86['attributes']=_0x150d86['attributes']['length']?_0x150d86[_0xbd4e('0x3a')]:_0x18eca4['model'];if(_0x5d7a39[_0xbd4e('0x37')][_0xbd4e('0x47')]){_0x150d86['include']=[{'all':!![]}];}_0x150d86=_[_0xbd4e('0x44')]({},_0x150d86,_0x5d7a39[_0xbd4e('0x46')]);return db[_0xbd4e('0x30')][_0xbd4e('0x4e')](_0x150d86)[_0xbd4e('0x28')](handleEntityNotFound(_0x371a4b,null))[_0xbd4e('0x28')](respondWithResult(_0x371a4b,null))['catch'](handleError(_0x371a4b,null));};exports[_0xbd4e('0x4f')]=function(_0xd064d,_0x4e99f5){return db[_0xbd4e('0x30')]['create'](_0xd064d[_0xbd4e('0x50')],{})[_0xbd4e('0x28')](respondWithResult(_0x4e99f5,0xc9))['catch'](handleError(_0x4e99f5,null));};exports[_0xbd4e('0x27')]=function(_0x4fe0e6,_0x3c28ca){if(_0x4fe0e6[_0xbd4e('0x50')]['id']){delete _0x4fe0e6[_0xbd4e('0x50')]['id'];}return db[_0xbd4e('0x30')][_0xbd4e('0x4e')]({'where':{'id':_0x4fe0e6[_0xbd4e('0x4d')]['id']}})['then'](handleEntityNotFound(_0x3c28ca,null))[_0xbd4e('0x28')](saveUpdates(_0x4fe0e6[_0xbd4e('0x50')],null))[_0xbd4e('0x28')](respondWithResult(_0x3c28ca,null))[_0xbd4e('0x4b')](handleError(_0x3c28ca,null));};exports[_0xbd4e('0x29')]=function(_0x1dd59d,_0x5c1ab1){return db[_0xbd4e('0x30')][_0xbd4e('0x4e')]({'where':{'id':_0x1dd59d[_0xbd4e('0x4d')]['id']}})[_0xbd4e('0x28')](handleEntityNotFound(_0x5c1ab1,null))[_0xbd4e('0x28')](removeEntity(_0x5c1ab1,null))[_0xbd4e('0x4b')](handleError(_0x5c1ab1,null));};exports['describe']=function(_0x447f56,_0x56bb8f){return db[_0xbd4e('0x30')]['describe']()[_0xbd4e('0x28')](respondWithResult(_0x56bb8f,null))['catch'](handleError(_0x56bb8f,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 8df1394..aecaa68 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 _0xb27d=['request-promise','path','rimraf','../../config/environment','./mailTransferReport.attributes','MailTransferReport','report_mail_transfer','uniqueid','lodash','util','../../config/logger','api','bluebird'];(function(_0x517c77,_0x20ac95){var _0x5a5cfa=function(_0x19de06){while(--_0x19de06){_0x517c77['push'](_0x517c77['shift']());}};_0x5a5cfa(++_0x20ac95);}(_0xb27d,0xe5));var _0xdb27=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xb27d[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0xdb27('0x0'));var util=require(_0xdb27('0x1'));var logger=require(_0xdb27('0x2'))(_0xdb27('0x3'));var moment=require('moment');var BPromise=require(_0xdb27('0x4'));var rp=require(_0xdb27('0x5'));var fs=require('fs');var path=require(_0xdb27('0x6'));var rimraf=require(_0xdb27('0x7'));var config=require(_0xdb27('0x8'));var attributes=require(_0xdb27('0x9'));module['exports']=function(_0x4ce81b,_0x98c60){return _0x4ce81b['define'](_0xdb27('0xa'),attributes,{'tableName':_0xdb27('0xb'),'paranoid':![],'indexes':[{'name':_0xdb27('0xc'),'fields':[_0xdb27('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc57c=['MailTransferReport','report_mail_transfer','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailTransferReport.attributes'];(function(_0x41679e,_0x56e202){var _0x2668d0=function(_0x1d0709){while(--_0x1d0709){_0x41679e['push'](_0x41679e['shift']());}};_0x2668d0(++_0x56e202);}(_0xc57c,0x9f));var _0xcc57=function(_0xc76cef,_0x194abb){_0xc76cef=_0xc76cef-0x0;var _0x515c04=_0xc57c[_0xc76cef];return _0x515c04;};'use strict';var _=require(_0xcc57('0x0'));var util=require('util');var logger=require(_0xcc57('0x1'))(_0xcc57('0x2'));var moment=require(_0xcc57('0x3'));var BPromise=require(_0xcc57('0x4'));var rp=require(_0xcc57('0x5'));var fs=require('fs');var path=require(_0xcc57('0x6'));var rimraf=require(_0xcc57('0x7'));var config=require(_0xcc57('0x8'));var attributes=require(_0xcc57('0x9'));module['exports']=function(_0x1d77dd,_0x243766){return _0x1d77dd['define'](_0xcc57('0xa'),attributes,{'tableName':_0xcc57('0xb'),'paranoid':![],'indexes':[{'name':_0xcc57('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 32f6e4d..5a81800 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 _0xcc60=['MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','then','info'];(function(_0x3d7f78,_0x17e4d0){var _0x3bf252=function(_0x2dd1c0){while(--_0x2dd1c0){_0x3d7f78['push'](_0x3d7f78['shift']());}};_0x3bf252(++_0x17e4d0);}(_0xcc60,0x94));var _0x0cc6=function(_0xfeea33,_0xe23099){_0xfeea33=_0xfeea33-0x0;var _0x14ec7f=_0xcc60[_0xfeea33];return _0x14ec7f;};'use strict';var _=require(_0x0cc6('0x0'));var util=require(_0x0cc6('0x1'));var moment=require(_0x0cc6('0x2'));var BPromise=require(_0x0cc6('0x3'));var rs=require(_0x0cc6('0x4'));var fs=require('fs');var Redis=require(_0x0cc6('0x5'));var db=require(_0x0cc6('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x0cc6('0x7'));var config=require(_0x0cc6('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0cc6('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4b94d3,_0x44dc81,_0x474335){return new BPromise(function(_0x4bf31b,_0x63873f){return client['request'](_0x4b94d3,_0x474335)[_0x0cc6('0xa')](function(_0x18f4f6){logger[_0x0cc6('0xb')](_0x0cc6('0xc'),_0x44dc81,_0x0cc6('0xd'));logger[_0x0cc6('0xe')]('MailTransferReport,\x20%s,\x20%s,\x20%s',_0x44dc81,_0x0cc6('0xd'),JSON[_0x0cc6('0xf')](_0x18f4f6));if(_0x18f4f6[_0x0cc6('0x10')]){if(_0x18f4f6[_0x0cc6('0x10')][_0x0cc6('0x11')]===0x1f4){logger[_0x0cc6('0x10')](_0x0cc6('0xc'),_0x44dc81,_0x18f4f6[_0x0cc6('0x10')][_0x0cc6('0x12')]);return _0x63873f(_0x18f4f6['error']['message']);}logger[_0x0cc6('0x10')](_0x0cc6('0xc'),_0x44dc81,_0x18f4f6[_0x0cc6('0x10')]['message']);return _0x4bf31b(_0x18f4f6[_0x0cc6('0x10')][_0x0cc6('0x12')]);}else{logger[_0x0cc6('0xb')](_0x0cc6('0xc'),_0x44dc81,_0x0cc6('0xd'));_0x4bf31b(_0x18f4f6['result'][_0x0cc6('0x12')]);}})[_0x0cc6('0x13')](function(_0x3b0b00){logger[_0x0cc6('0x10')]('MailTransferReport,\x20%s,\x20%s',_0x44dc81,_0x3b0b00);_0x63873f(_0x3b0b00);});});} \ No newline at end of file +var _0x4193=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','http','request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash'];(function(_0x3779eb,_0xc19002){var _0x50423a=function(_0x16e841){while(--_0x16e841){_0x3779eb['push'](_0x3779eb['shift']());}};_0x50423a(++_0xc19002);}(_0x4193,0x17b));var _0x3419=function(_0x501081,_0x4e3e26){_0x501081=_0x501081-0x0;var _0x58af6e=_0x4193[_0x501081];return _0x58af6e;};'use strict';var _=require(_0x3419('0x0'));var util=require('util');var moment=require(_0x3419('0x1'));var BPromise=require(_0x3419('0x2'));var rs=require(_0x3419('0x3'));var fs=require('fs');var Redis=require(_0x3419('0x4'));var db=require(_0x3419('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x3419('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x3419('0x7'));var client=jayson['client'][_0x3419('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x19ea09,_0x13caa9,_0x164149){return new BPromise(function(_0x5e702d,_0x1450ef){return client[_0x3419('0x9')](_0x19ea09,_0x164149)[_0x3419('0xa')](function(_0x308a84){logger[_0x3419('0xb')](_0x3419('0xc'),_0x13caa9,_0x3419('0xd'));logger['debug'](_0x3419('0xe'),_0x13caa9,_0x3419('0xd'),JSON[_0x3419('0xf')](_0x308a84));if(_0x308a84[_0x3419('0x10')]){if(_0x308a84[_0x3419('0x10')][_0x3419('0x11')]===0x1f4){logger[_0x3419('0x10')](_0x3419('0xc'),_0x13caa9,_0x308a84[_0x3419('0x10')]['message']);return _0x1450ef(_0x308a84[_0x3419('0x10')][_0x3419('0x12')]);}logger[_0x3419('0x10')](_0x3419('0xc'),_0x13caa9,_0x308a84[_0x3419('0x10')][_0x3419('0x12')]);return _0x5e702d(_0x308a84['error'][_0x3419('0x12')]);}else{logger[_0x3419('0xb')](_0x3419('0xc'),_0x13caa9,_0x3419('0xd'));_0x5e702d(_0x308a84[_0x3419('0x13')][_0x3419('0x12')]);}})['catch'](function(_0x5be1f){logger[_0x3419('0x10')](_0x3419('0xc'),_0x13caa9,_0x5be1f);_0x1450ef(_0x5be1f);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index be676fb..39c58ac 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 _0x9e67=['put','/:id','update','delete','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./memberReport.controller','get','index','/describe','describe','isAuthenticated','post','create'];(function(_0x2850bd,_0x2f4ad2){var _0x5f3930=function(_0x3531cd){while(--_0x3531cd){_0x2850bd['push'](_0x2850bd['shift']());}};_0x5f3930(++_0x2f4ad2);}(_0x9e67,0x7d));var _0x79e6=function(_0x173a87,_0x161302){_0x173a87=_0x173a87-0x0;var _0x15fbe8=_0x9e67[_0x173a87];return _0x15fbe8;};'use strict';var multer=require('multer');var util=require(_0x79e6('0x0'));var path=require(_0x79e6('0x1'));var timeout=require(_0x79e6('0x2'));var express=require(_0x79e6('0x3'));var router=express['Router']();var fs_extra=require(_0x79e6('0x4'));var auth=require(_0x79e6('0x5'));var interaction=require(_0x79e6('0x6'));var config=require('../../config/environment');var controller=require(_0x79e6('0x7'));router[_0x79e6('0x8')]('/',auth['isAuthenticated'](),controller[_0x79e6('0x9')]);router[_0x79e6('0x8')](_0x79e6('0xa'),auth['isAuthenticated'](),controller[_0x79e6('0xb')]);router[_0x79e6('0x8')]('/:id',auth[_0x79e6('0xc')](),controller['show']);router[_0x79e6('0xd')]('/',auth[_0x79e6('0xc')](),controller[_0x79e6('0xe')]);router[_0x79e6('0xf')](_0x79e6('0x10'),auth['isAuthenticated'](),controller[_0x79e6('0x11')]);router[_0x79e6('0x12')](_0x79e6('0x10'),auth[_0x79e6('0xc')](),controller['destroy']);module[_0x79e6('0x13')]=router; \ No newline at end of file +var _0x70b5=['/describe','describe','show','create','put','delete','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./memberReport.controller','get','isAuthenticated','index'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x70b5,0xf1));var _0x570b=function(_0x4521e3,_0x10a8a4){_0x4521e3=_0x4521e3-0x0;var _0x46a272=_0x70b5[_0x4521e3];return _0x46a272;};'use strict';var multer=require('multer');var util=require(_0x570b('0x0'));var path=require(_0x570b('0x1'));var timeout=require('connect-timeout');var express=require(_0x570b('0x2'));var router=express[_0x570b('0x3')]();var fs_extra=require(_0x570b('0x4'));var auth=require(_0x570b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x570b('0x6'));var controller=require(_0x570b('0x7'));router[_0x570b('0x8')]('/',auth[_0x570b('0x9')](),controller[_0x570b('0xa')]);router[_0x570b('0x8')](_0x570b('0xb'),auth[_0x570b('0x9')](),controller[_0x570b('0xc')]);router[_0x570b('0x8')]('/:id',auth[_0x570b('0x9')](),controller[_0x570b('0xd')]);router['post']('/',auth[_0x570b('0x9')](),controller[_0x570b('0xe')]);router[_0x570b('0xf')]('/:id',auth[_0x570b('0x9')](),controller['update']);router[_0x570b('0x10')]('/:id',auth[_0x570b('0x9')](),controller['destroy']);module[_0x570b('0x11')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 6cd305e..545db81 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 _0x7a91=['moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','diff','seconds','setDataValue','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[dial\x20string]','sequelize'];(function(_0x212a11,_0x2346cb){var _0x170ed5=function(_0x51b35c){while(--_0x51b35c){_0x212a11['push'](_0x212a11['shift']());}};_0x170ed5(++_0x2346cb);}(_0x7a91,0xfe));var _0x17a9=function(_0x217b5b,_0x3572bf){_0x217b5b=_0x217b5b-0x0;var _0x2c357f=_0x7a91[_0x217b5b];return _0x2c357f;};'use strict';var Sequelize=require(_0x17a9('0x0'));var moment=require(_0x17a9('0x1'));module[_0x17a9('0x2')]={'channel':{'type':Sequelize[_0x17a9('0x3')]},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x17a9('0x3')]},'type':{'type':Sequelize[_0x17a9('0x3')],'defaultValue':_0x17a9('0x4'),'comment':_0x17a9('0x5')},'duration':{'type':Sequelize[_0x17a9('0x6')]},'enterAt':{'type':Sequelize[_0x17a9('0x7')]},'exitAt':{'type':Sequelize[_0x17a9('0x7')],'set':function(_0x1028e5){var _0x5c9b3b=moment(_0x1028e5);var _0x2c68b9=moment(this[_0x17a9('0x8')]('enterAt'));var _0x19ab69=_0x5c9b3b[_0x17a9('0x9')](_0x2c68b9,_0x17a9('0xa'));this[_0x17a9('0xb')]('exitAt',_0x1028e5);this[_0x17a9('0xb')](_0x17a9('0xc'),_0x19ab69>=0x0?_0x19ab69:null);}},'data1':{'type':Sequelize[_0x17a9('0x3')],'comment':_0x17a9('0xd')},'data2':{'type':Sequelize[_0x17a9('0x3')],'comment':'talk:[start]'},'data3':{'type':Sequelize[_0x17a9('0x3')],'comment':'talk:[destination]'},'data4':{'type':Sequelize['STRING'],'comment':_0x17a9('0xe')},'data5':{'type':Sequelize['STRING'],'comment':'talk:[queue]'},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize[_0x17a9('0x6')]},'uniqueid':{'type':Sequelize[_0x17a9('0x3')]}}; \ No newline at end of file +var _0xc1bf=['talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','moment','exports','STRING','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt','diff','seconds','setDataValue','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]'];(function(_0x12729b,_0x55dd9f){var _0x44eb1f=function(_0x5fe157){while(--_0x5fe157){_0x12729b['push'](_0x12729b['shift']());}};_0x44eb1f(++_0x55dd9f);}(_0xc1bf,0xdb));var _0xfc1b=function(_0x209fcd,_0x1ecccc){_0x209fcd=_0x209fcd-0x0;var _0x501d5e=_0xc1bf[_0x209fcd];return _0x501d5e;};'use strict';var Sequelize=require(_0xfc1b('0x0'));var moment=require(_0xfc1b('0x1'));module[_0xfc1b('0x2')]={'channel':{'type':Sequelize[_0xfc1b('0x3')]},'membername':{'type':Sequelize[_0xfc1b('0x3')]},'interface':{'type':Sequelize[_0xfc1b('0x3')]},'type':{'type':Sequelize[_0xfc1b('0x3')],'defaultValue':'DEFAULT\x20PAUSE','comment':_0xfc1b('0x4')},'duration':{'type':Sequelize[_0xfc1b('0x5')]},'enterAt':{'type':Sequelize[_0xfc1b('0x6')]},'exitAt':{'type':Sequelize['DATE'],'set':function(_0x4d8773){var _0x273502=moment(_0x4d8773);var _0x444462=moment(this[_0xfc1b('0x7')](_0xfc1b('0x8')));var _0x975921=_0x273502[_0xfc1b('0x9')](_0x444462,_0xfc1b('0xa'));this[_0xfc1b('0xb')](_0xfc1b('0xc'),_0x4d8773);this[_0xfc1b('0xb')](_0xfc1b('0xd'),_0x975921>=0x0?_0x975921:null);}},'data1':{'type':Sequelize[_0xfc1b('0x3')],'comment':_0xfc1b('0xe')},'data2':{'type':Sequelize[_0xfc1b('0x3')],'comment':'talk:[start]'},'data3':{'type':Sequelize['STRING'],'comment':_0xfc1b('0xf')},'data4':{'type':Sequelize[_0xfc1b('0x3')],'comment':_0xfc1b('0x10')},'data5':{'type':Sequelize[_0xfc1b('0x3')],'comment':_0xfc1b('0x11')},'role':{'type':Sequelize[_0xfc1b('0x3')]},'internal':{'type':Sequelize[_0xfc1b('0x5')]},'uniqueid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index c499480..dffe983 100644 --- a/server/api/memberReport/memberReport.controller.js +++ b/server/api/memberReport/memberReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55ca=['merge','filter','includeAll','include','findAll','rawAttributes','options','create','body','find','params','catch','destroy','describe','eml-format','rimraf','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','reject','update','then','end','sendStatus','error','stack','name','send','index','map','MemberReport','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x55ca,0x126));var _0xa55c=function(_0x5c0ff6,_0x22cdd2){_0x5c0ff6=_0x5c0ff6-0x0;var _0x1135cd=_0x55ca[_0x5c0ff6];return _0x1135cd;};'use strict';var emlformat=require(_0xa55c('0x0'));var rimraf=require(_0xa55c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa55c('0x2'));var BPromise=require(_0xa55c('0x3'));var Mustache=require('mustache');var util=require(_0xa55c('0x4'));var path=require(_0xa55c('0x5'));var sox=require(_0xa55c('0x6'));var csv=require(_0xa55c('0x7'));var ejs=require(_0xa55c('0x8'));var fs=require('fs');var fs_extra=require(_0xa55c('0x9'));var _=require(_0xa55c('0xa'));var squel=require('squel');var crypto=require(_0xa55c('0xb'));var jsforce=require(_0xa55c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa55c('0x7'));var querystring=require(_0xa55c('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa55c('0xe'));var qs=require(_0xa55c('0xf'));var as=require(_0xa55c('0x10'));var hardwareService=require(_0xa55c('0x11'));var logger=require(_0xa55c('0x12'))(_0xa55c('0x13'));var utils=require(_0xa55c('0x14'));var config=require(_0xa55c('0x15'));var licenseUtil=require(_0xa55c('0x16'));var db=require(_0xa55c('0x17'))['db'];function respondWithStatusCode(_0x5d47ff,_0x59d84a){_0x59d84a=_0x59d84a||0xcc;return function(_0x2a35be){if(_0x2a35be){return _0x5d47ff['sendStatus'](_0x59d84a);}return _0x5d47ff['status'](_0x59d84a)['end']();};}function respondWithResult(_0x18ee85,_0x3930e4){_0x3930e4=_0x3930e4||0xc8;return function(_0x462cd6){if(_0x462cd6){return _0x18ee85[_0xa55c('0x18')](_0x3930e4)[_0xa55c('0x19')](_0x462cd6);}};}function respondWithFilteredResult(_0x247e77,_0x4e0b2f){return function(_0x3ccf65){if(_0x3ccf65){var _0x3dcf4f=typeof _0x4e0b2f[_0xa55c('0x1a')]===_0xa55c('0x1b')&&typeof _0x4e0b2f[_0xa55c('0x1c')]===_0xa55c('0x1b');var _0x51590e=_0x3ccf65[_0xa55c('0x1d')];var _0x24783b=_0x3dcf4f?0x0:_0x4e0b2f['offset'];var _0x3d4c9e=_0x3dcf4f?_0x3ccf65[_0xa55c('0x1d')]:_0x4e0b2f[_0xa55c('0x1a')]+_0x4e0b2f[_0xa55c('0x1c')];var _0x23a1ae;if(_0x3d4c9e>=_0x51590e){_0x3d4c9e=_0x51590e;_0x23a1ae=0xc8;}else{_0x23a1ae=0xce;}_0x247e77[_0xa55c('0x18')](_0x23a1ae);return _0x247e77['set']('Content-Range',_0x24783b+'-'+_0x3d4c9e+'/'+_0x51590e)[_0xa55c('0x19')](_0x3ccf65);}return null;};}function patchUpdates(_0x3776ac){return function(_0xade4c4){try{jsonpatch['apply'](_0xade4c4,_0x3776ac,!![]);}catch(_0x383d92){return BPromise[_0xa55c('0x1e')](_0x383d92);}return _0xade4c4['save']();};}function saveUpdates(_0x187a87,_0x133096){return function(_0x940f28){if(_0x940f28){return _0x940f28[_0xa55c('0x1f')](_0x187a87)[_0xa55c('0x20')](function(_0x49ed04){return _0x49ed04;});}return null;};}function removeEntity(_0x1fc828,_0x504c24){return function(_0x5ba836){if(_0x5ba836){return _0x5ba836['destroy']()[_0xa55c('0x20')](function(){_0x1fc828['status'](0xcc)[_0xa55c('0x21')]();});}};}function handleEntityNotFound(_0x190757,_0x3f64de){return function(_0xf0e574){if(!_0xf0e574){_0x190757[_0xa55c('0x22')](0x194);}return _0xf0e574;};}function handleError(_0x170ba4,_0x1da633){_0x1da633=_0x1da633||0x1f4;return function(_0x11e7f7){logger[_0xa55c('0x23')](_0x11e7f7[_0xa55c('0x24')]);if(_0x11e7f7[_0xa55c('0x25')]){delete _0x11e7f7['name'];}_0x170ba4[_0xa55c('0x18')](_0x1da633)[_0xa55c('0x26')](_0x11e7f7);};}exports[_0xa55c('0x27')]=function(_0x906caa,_0x5d940d){var _0x1377b0={},_0x22f6b6={},_0x1b8388={'count':0x0,'rows':[]};var _0x201941=_[_0xa55c('0x28')](db[_0xa55c('0x29')]['rawAttributes'],function(_0x23e698){return{'name':_0x23e698['fieldName'],'type':_0x23e698[_0xa55c('0x2a')][_0xa55c('0x2b')]};});_0x22f6b6[_0xa55c('0x2c')]=_[_0xa55c('0x28')](_0x201941,'name');_0x22f6b6[_0xa55c('0x2d')]=_[_0xa55c('0x2e')](_0x906caa[_0xa55c('0x2d')]);_0x22f6b6[_0xa55c('0x2f')]=_[_0xa55c('0x30')](_0x22f6b6[_0xa55c('0x2c')],_0x22f6b6[_0xa55c('0x2d')]);_0x1377b0[_0xa55c('0x31')]=_[_0xa55c('0x30')](_0x22f6b6[_0xa55c('0x2c')],qs[_0xa55c('0x32')](_0x906caa['query']['fields']));_0x1377b0[_0xa55c('0x31')]=_0x1377b0[_0xa55c('0x31')]['length']?_0x1377b0[_0xa55c('0x31')]:_0x22f6b6[_0xa55c('0x2c')];if(!_0x906caa[_0xa55c('0x2d')][_0xa55c('0x33')](_0xa55c('0x34'))){_0x1377b0[_0xa55c('0x1c')]=qs[_0xa55c('0x1c')](_0x906caa[_0xa55c('0x2d')][_0xa55c('0x1c')]);_0x1377b0['offset']=qs['offset'](_0x906caa['query'][_0xa55c('0x1a')]);}_0x1377b0[_0xa55c('0x35')]=qs[_0xa55c('0x36')](_0x906caa['query'][_0xa55c('0x36')]);_0x1377b0['where']=qs[_0xa55c('0x2f')](_['pick'](_0x906caa[_0xa55c('0x2d')],_0x22f6b6[_0xa55c('0x2f')]),_0x201941);if(_0x906caa[_0xa55c('0x2d')]['filter']){_0x1377b0[_0xa55c('0x37')]=_[_0xa55c('0x38')](_0x1377b0['where'],{'$or':_[_0xa55c('0x28')](_0x201941,function(_0x194e78){if(_0x194e78['type']!=='VIRTUAL'){var _0x235f6b={};_0x235f6b[_0x194e78['name']]={'$like':'%'+_0x906caa[_0xa55c('0x2d')][_0xa55c('0x39')]+'%'};return _0x235f6b;}})});}_0x1377b0=_['merge']({},_0x1377b0,_0x906caa['options']);var _0x5e50b6={'where':_0x1377b0['where']};return db[_0xa55c('0x29')][_0xa55c('0x1d')](_0x5e50b6)[_0xa55c('0x20')](function(_0x99c4f8){_0x1b8388[_0xa55c('0x1d')]=_0x99c4f8;if(_0x906caa['query'][_0xa55c('0x3a')]){_0x1377b0[_0xa55c('0x3b')]=[{'all':!![]}];}return db[_0xa55c('0x29')][_0xa55c('0x3c')](_0x1377b0);})[_0xa55c('0x20')](function(_0x23cef5){_0x1b8388['rows']=_0x23cef5;return _0x1b8388;})[_0xa55c('0x20')](respondWithFilteredResult(_0x5d940d,_0x1377b0))['catch'](handleError(_0x5d940d,null));};exports['show']=function(_0x404e7f,_0x1f63d8){var _0x496920={'raw':!![],'where':{'id':_0x404e7f['params']['id']}},_0x2bd98b={};_0x2bd98b['model']=_[_0xa55c('0x2e')](db[_0xa55c('0x29')][_0xa55c('0x3d')]);_0x2bd98b['query']=_[_0xa55c('0x2e')](_0x404e7f[_0xa55c('0x2d')]);_0x2bd98b['filters']=_[_0xa55c('0x30')](_0x2bd98b['model'],_0x2bd98b[_0xa55c('0x2d')]);_0x496920[_0xa55c('0x31')]=_['intersection'](_0x2bd98b[_0xa55c('0x2c')],qs[_0xa55c('0x32')](_0x404e7f['query'][_0xa55c('0x32')]));_0x496920[_0xa55c('0x31')]=_0x496920[_0xa55c('0x31')]['length']?_0x496920[_0xa55c('0x31')]:_0x2bd98b['model'];if(_0x404e7f[_0xa55c('0x2d')][_0xa55c('0x3a')]){_0x496920[_0xa55c('0x3b')]=[{'all':!![]}];}_0x496920=_['merge']({},_0x496920,_0x404e7f[_0xa55c('0x3e')]);return db[_0xa55c('0x29')]['find'](_0x496920)[_0xa55c('0x20')](handleEntityNotFound(_0x1f63d8,null))[_0xa55c('0x20')](respondWithResult(_0x1f63d8,null))['catch'](handleError(_0x1f63d8,null));};exports[_0xa55c('0x3f')]=function(_0xd3fe78,_0x52f9a7){return db[_0xa55c('0x29')][_0xa55c('0x3f')](_0xd3fe78[_0xa55c('0x40')],{})[_0xa55c('0x20')](respondWithResult(_0x52f9a7,0xc9))['catch'](handleError(_0x52f9a7,null));};exports[_0xa55c('0x1f')]=function(_0x58a7ea,_0x2157d6){if(_0x58a7ea[_0xa55c('0x40')]['id']){delete _0x58a7ea[_0xa55c('0x40')]['id'];}return db['MemberReport'][_0xa55c('0x41')]({'where':{'id':_0x58a7ea[_0xa55c('0x42')]['id']}})['then'](handleEntityNotFound(_0x2157d6,null))[_0xa55c('0x20')](saveUpdates(_0x58a7ea[_0xa55c('0x40')],null))[_0xa55c('0x20')](respondWithResult(_0x2157d6,null))[_0xa55c('0x43')](handleError(_0x2157d6,null));};exports[_0xa55c('0x44')]=function(_0x1c84d9,_0x1e1293){return db[_0xa55c('0x29')][_0xa55c('0x41')]({'where':{'id':_0x1c84d9[_0xa55c('0x42')]['id']}})['then'](handleEntityNotFound(_0x1e1293,null))[_0xa55c('0x20')](removeEntity(_0x1e1293,null))[_0xa55c('0x43')](handleError(_0x1e1293,null));};exports[_0xa55c('0x45')]=function(_0x4f73b6,_0x4c3095){return db[_0xa55c('0x29')]['describe']()[_0xa55c('0x20')](respondWithResult(_0x4c3095,null))['catch'](handleError(_0x4c3095,null));}; \ No newline at end of file +var _0x7217=['query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','merge','filter','includeAll','include','rows','catch','show','params','rawAttributes','length','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','send','index','map','MemberReport','fieldName','type','model','name','keys'];(function(_0x3315a7,_0x51d249){var _0x3eeb28=function(_0x5ef230){while(--_0x5ef230){_0x3315a7['push'](_0x3315a7['shift']());}};_0x3eeb28(++_0x51d249);}(_0x7217,0x19e));var _0x7721=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0x7217[_0x2b10c6];return _0x3789d2;};'use strict';var emlformat=require(_0x7721('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7721('0x1'));var jsonpatch=require(_0x7721('0x2'));var rp=require(_0x7721('0x3'));var moment=require(_0x7721('0x4'));var BPromise=require(_0x7721('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x7721('0x6'));var sox=require(_0x7721('0x7'));var csv=require(_0x7721('0x8'));var ejs=require(_0x7721('0x9'));var fs=require('fs');var fs_extra=require(_0x7721('0xa'));var _=require(_0x7721('0xb'));var squel=require(_0x7721('0xc'));var crypto=require(_0x7721('0xd'));var jsforce=require(_0x7721('0xe'));var deskjs=require(_0x7721('0xf'));var toCsv=require(_0x7721('0x8'));var querystring=require(_0x7721('0x10'));var Papa=require(_0x7721('0x11'));var Redis=require(_0x7721('0x12'));var authService=require(_0x7721('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x7721('0x14'));var hardwareService=require(_0x7721('0x15'));var logger=require(_0x7721('0x16'))(_0x7721('0x17'));var utils=require(_0x7721('0x18'));var config=require(_0x7721('0x19'));var licenseUtil=require(_0x7721('0x1a'));var db=require(_0x7721('0x1b'))['db'];function respondWithStatusCode(_0x55b4ca,_0x2911ec){_0x2911ec=_0x2911ec||0xcc;return function(_0x199930){if(_0x199930){return _0x55b4ca['sendStatus'](_0x2911ec);}return _0x55b4ca[_0x7721('0x1c')](_0x2911ec)[_0x7721('0x1d')]();};}function respondWithResult(_0x3f01c5,_0x2e9752){_0x2e9752=_0x2e9752||0xc8;return function(_0x5069da){if(_0x5069da){return _0x3f01c5[_0x7721('0x1c')](_0x2e9752)[_0x7721('0x1e')](_0x5069da);}};}function respondWithFilteredResult(_0x534f1b,_0x4e199a){return function(_0x4b183e){if(_0x4b183e){var _0x5ed54=typeof _0x4e199a[_0x7721('0x1f')]===_0x7721('0x20')&&typeof _0x4e199a[_0x7721('0x21')]==='undefined';var _0x20f669=_0x4b183e['count'];var _0x3fc09e=_0x5ed54?0x0:_0x4e199a['offset'];var _0xfec626=_0x5ed54?_0x4b183e[_0x7721('0x22')]:_0x4e199a[_0x7721('0x1f')]+_0x4e199a[_0x7721('0x21')];var _0x2286e5;if(_0xfec626>=_0x20f669){_0xfec626=_0x20f669;_0x2286e5=0xc8;}else{_0x2286e5=0xce;}_0x534f1b[_0x7721('0x1c')](_0x2286e5);return _0x534f1b[_0x7721('0x23')](_0x7721('0x24'),_0x3fc09e+'-'+_0xfec626+'/'+_0x20f669)[_0x7721('0x1e')](_0x4b183e);}return null;};}function patchUpdates(_0xaeccc4){return function(_0x4ce1db){try{jsonpatch[_0x7721('0x25')](_0x4ce1db,_0xaeccc4,!![]);}catch(_0x2c1583){return BPromise[_0x7721('0x26')](_0x2c1583);}return _0x4ce1db[_0x7721('0x27')]();};}function saveUpdates(_0x57140c,_0x28f5a6){return function(_0x512f31){if(_0x512f31){return _0x512f31[_0x7721('0x28')](_0x57140c)[_0x7721('0x29')](function(_0x3e8a4e){return _0x3e8a4e;});}return null;};}function removeEntity(_0x1caad8,_0x121cc4){return function(_0x395b15){if(_0x395b15){return _0x395b15[_0x7721('0x2a')]()['then'](function(){_0x1caad8[_0x7721('0x1c')](0xcc)[_0x7721('0x1d')]();});}};}function handleEntityNotFound(_0x125564,_0x1f67c7){return function(_0x40d550){if(!_0x40d550){_0x125564[_0x7721('0x2b')](0x194);}return _0x40d550;};}function handleError(_0x424e05,_0xf753f1){_0xf753f1=_0xf753f1||0x1f4;return function(_0x40f367){logger['error'](_0x40f367[_0x7721('0x2c')]);if(_0x40f367['name']){delete _0x40f367['name'];}_0x424e05[_0x7721('0x1c')](_0xf753f1)[_0x7721('0x2d')](_0x40f367);};}exports[_0x7721('0x2e')]=function(_0x158d98,_0x1ea4d){var _0x37b9f0={},_0xd7d703={},_0x1da2d8={'count':0x0,'rows':[]};var _0x5c54f0=_[_0x7721('0x2f')](db[_0x7721('0x30')]['rawAttributes'],function(_0x4a25c9){return{'name':_0x4a25c9[_0x7721('0x31')],'type':_0x4a25c9[_0x7721('0x32')]['key']};});_0xd7d703[_0x7721('0x33')]=_[_0x7721('0x2f')](_0x5c54f0,_0x7721('0x34'));_0xd7d703['query']=_[_0x7721('0x35')](_0x158d98[_0x7721('0x36')]);_0xd7d703[_0x7721('0x37')]=_[_0x7721('0x38')](_0xd7d703[_0x7721('0x33')],_0xd7d703['query']);_0x37b9f0[_0x7721('0x39')]=_[_0x7721('0x38')](_0xd7d703[_0x7721('0x33')],qs['fields'](_0x158d98[_0x7721('0x36')][_0x7721('0x3a')]));_0x37b9f0['attributes']=_0x37b9f0[_0x7721('0x39')]['length']?_0x37b9f0[_0x7721('0x39')]:_0xd7d703[_0x7721('0x33')];if(!_0x158d98[_0x7721('0x36')][_0x7721('0x3b')](_0x7721('0x3c'))){_0x37b9f0[_0x7721('0x21')]=qs[_0x7721('0x21')](_0x158d98[_0x7721('0x36')][_0x7721('0x21')]);_0x37b9f0[_0x7721('0x1f')]=qs[_0x7721('0x1f')](_0x158d98['query'][_0x7721('0x1f')]);}_0x37b9f0['order']=qs[_0x7721('0x3d')](_0x158d98[_0x7721('0x36')][_0x7721('0x3d')]);_0x37b9f0[_0x7721('0x3e')]=qs[_0x7721('0x37')](_[_0x7721('0x3f')](_0x158d98['query'],_0xd7d703['filters']),_0x5c54f0);if(_0x158d98['query']['filter']){_0x37b9f0[_0x7721('0x3e')]=_[_0x7721('0x40')](_0x37b9f0[_0x7721('0x3e')],{'$or':_[_0x7721('0x2f')](_0x5c54f0,function(_0x4a90ce){if(_0x4a90ce[_0x7721('0x32')]!=='VIRTUAL'){var _0xfab37b={};_0xfab37b[_0x4a90ce[_0x7721('0x34')]]={'$like':'%'+_0x158d98['query'][_0x7721('0x41')]+'%'};return _0xfab37b;}})});}_0x37b9f0=_[_0x7721('0x40')]({},_0x37b9f0,_0x158d98['options']);var _0x4d0111={'where':_0x37b9f0[_0x7721('0x3e')]};return db[_0x7721('0x30')][_0x7721('0x22')](_0x4d0111)[_0x7721('0x29')](function(_0x577af9){_0x1da2d8[_0x7721('0x22')]=_0x577af9;if(_0x158d98[_0x7721('0x36')][_0x7721('0x42')]){_0x37b9f0[_0x7721('0x43')]=[{'all':!![]}];}return db[_0x7721('0x30')]['findAll'](_0x37b9f0);})[_0x7721('0x29')](function(_0x4a2c28){_0x1da2d8[_0x7721('0x44')]=_0x4a2c28;return _0x1da2d8;})['then'](respondWithFilteredResult(_0x1ea4d,_0x37b9f0))[_0x7721('0x45')](handleError(_0x1ea4d,null));};exports[_0x7721('0x46')]=function(_0x231dad,_0x49e0c5){var _0x1453d4={'raw':!![],'where':{'id':_0x231dad[_0x7721('0x47')]['id']}},_0x11d853={};_0x11d853['model']=_[_0x7721('0x35')](db[_0x7721('0x30')][_0x7721('0x48')]);_0x11d853[_0x7721('0x36')]=_[_0x7721('0x35')](_0x231dad[_0x7721('0x36')]);_0x11d853[_0x7721('0x37')]=_['intersection'](_0x11d853['model'],_0x11d853[_0x7721('0x36')]);_0x1453d4[_0x7721('0x39')]=_[_0x7721('0x38')](_0x11d853[_0x7721('0x33')],qs[_0x7721('0x3a')](_0x231dad[_0x7721('0x36')][_0x7721('0x3a')]));_0x1453d4[_0x7721('0x39')]=_0x1453d4[_0x7721('0x39')][_0x7721('0x49')]?_0x1453d4['attributes']:_0x11d853['model'];if(_0x231dad[_0x7721('0x36')][_0x7721('0x42')]){_0x1453d4[_0x7721('0x43')]=[{'all':!![]}];}_0x1453d4=_[_0x7721('0x40')]({},_0x1453d4,_0x231dad['options']);return db[_0x7721('0x30')][_0x7721('0x4a')](_0x1453d4)['then'](handleEntityNotFound(_0x49e0c5,null))[_0x7721('0x29')](respondWithResult(_0x49e0c5,null))['catch'](handleError(_0x49e0c5,null));};exports[_0x7721('0x4b')]=function(_0x5c6922,_0x334f23){return db[_0x7721('0x30')][_0x7721('0x4b')](_0x5c6922['body'],{})[_0x7721('0x29')](respondWithResult(_0x334f23,0xc9))[_0x7721('0x45')](handleError(_0x334f23,null));};exports['update']=function(_0x223d93,_0x1196c2){if(_0x223d93[_0x7721('0x4c')]['id']){delete _0x223d93['body']['id'];}return db[_0x7721('0x30')]['find']({'where':{'id':_0x223d93[_0x7721('0x47')]['id']}})[_0x7721('0x29')](handleEntityNotFound(_0x1196c2,null))[_0x7721('0x29')](saveUpdates(_0x223d93[_0x7721('0x4c')],null))[_0x7721('0x29')](respondWithResult(_0x1196c2,null))[_0x7721('0x45')](handleError(_0x1196c2,null));};exports[_0x7721('0x2a')]=function(_0x7fbb73,_0x694d2f){return db[_0x7721('0x30')][_0x7721('0x4a')]({'where':{'id':_0x7fbb73[_0x7721('0x47')]['id']}})[_0x7721('0x29')](handleEntityNotFound(_0x694d2f,null))[_0x7721('0x29')](removeEntity(_0x694d2f,null))[_0x7721('0x45')](handleError(_0x694d2f,null));};exports['describe']=function(_0x474f32,_0x2f6f30){return db[_0x7721('0x30')][_0x7721('0x4d')]()[_0x7721('0x29')](respondWithResult(_0x2f6f30,null))[_0x7721('0x45')](handleError(_0x2f6f30,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 710db0e..cb30e67 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 _0x1602=['request-promise','path','rimraf','../../config/environment','define','MemberReport','membername_interface','membername','interface','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x24061a,_0x1c9f4d){var _0x82054e=function(_0x2ec346){while(--_0x2ec346){_0x24061a['push'](_0x24061a['shift']());}};_0x82054e(++_0x1c9f4d);}(_0x1602,0x135));var _0x2160=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x1602[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x2160('0x0'));var util=require(_0x2160('0x1'));var logger=require(_0x2160('0x2'))(_0x2160('0x3'));var moment=require(_0x2160('0x4'));var BPromise=require(_0x2160('0x5'));var rp=require(_0x2160('0x6'));var fs=require('fs');var path=require(_0x2160('0x7'));var rimraf=require(_0x2160('0x8'));var config=require(_0x2160('0x9'));var attributes=require('./memberReport.attributes');module['exports']=function(_0x58d741,_0x374d1d){return _0x58d741[_0x2160('0xa')](_0x2160('0xb'),attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':_0x2160('0xc'),'fields':[_0x2160('0xd'),_0x2160('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x21ff=['report_member','membername_interface','membername','interface','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./memberReport.attributes','exports','MemberReport'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0x21ff,0x8c));var _0xf21f=function(_0x3f6565,_0x12a8bb){_0x3f6565=_0x3f6565-0x0;var _0x4abd23=_0x21ff[_0x3f6565];return _0x4abd23;};'use strict';var _=require(_0xf21f('0x0'));var util=require(_0xf21f('0x1'));var logger=require(_0xf21f('0x2'))(_0xf21f('0x3'));var moment=require(_0xf21f('0x4'));var BPromise=require(_0xf21f('0x5'));var rp=require(_0xf21f('0x6'));var fs=require('fs');var path=require(_0xf21f('0x7'));var rimraf=require(_0xf21f('0x8'));var config=require(_0xf21f('0x9'));var attributes=require(_0xf21f('0xa'));module[_0xf21f('0xb')]=function(_0x272269,_0x3a2956){return _0x272269['define'](_0xf21f('0xc'),attributes,{'tableName':_0xf21f('0xd'),'paranoid':![],'indexes':[{'name':_0xf21f('0xe'),'fields':[_0xf21f('0xf'),_0xf21f('0x10')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index a14f374..08071af 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 _0xe3da=['stringify','error','code','message','result','MemberReport','findAll','options','raw','attributes','limit','include','map','model','then','GetMemberReport','catch','CreateMemberReport','body','UpdateMemberReport','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s'];(function(_0x1fc13b,_0x35dba1){var _0x9695fc=function(_0x4b6f9a){while(--_0x4b6f9a){_0x1fc13b['push'](_0x1fc13b['shift']());}};_0x9695fc(++_0x35dba1);}(_0xe3da,0x1cd));var _0xae3d=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xe3da[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0xae3d('0x0'));var util=require(_0xae3d('0x1'));var moment=require(_0xae3d('0x2'));var BPromise=require(_0xae3d('0x3'));var rs=require(_0xae3d('0x4'));var fs=require('fs');var Redis=require(_0xae3d('0x5'));var db=require(_0xae3d('0x6'))['db'];var utils=require(_0xae3d('0x7'));var logger=require(_0xae3d('0x8'))(_0xae3d('0x9'));var config=require(_0xae3d('0xa'));var jayson=require(_0xae3d('0xb'));var client=jayson[_0xae3d('0xc')][_0xae3d('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x476579,_0x33c089,_0x583b98){return new BPromise(function(_0x2a5c45,_0x3d6650){return client['request'](_0x476579,_0x583b98)['then'](function(_0x459592){logger[_0xae3d('0xe')](_0xae3d('0xf'),_0x33c089,_0xae3d('0x10'));logger[_0xae3d('0x11')](_0xae3d('0x12'),_0x33c089,'request\x20sent',JSON[_0xae3d('0x13')](_0x459592));if(_0x459592['error']){if(_0x459592[_0xae3d('0x14')][_0xae3d('0x15')]===0x1f4){logger[_0xae3d('0x14')](_0xae3d('0xf'),_0x33c089,_0x459592['error'][_0xae3d('0x16')]);return _0x3d6650(_0x459592[_0xae3d('0x14')][_0xae3d('0x16')]);}logger[_0xae3d('0x14')](_0xae3d('0xf'),_0x33c089,_0x459592[_0xae3d('0x14')][_0xae3d('0x16')]);return _0x2a5c45(_0x459592['error'][_0xae3d('0x16')]);}else{logger[_0xae3d('0xe')](_0xae3d('0xf'),_0x33c089,_0xae3d('0x10'));_0x2a5c45(_0x459592[_0xae3d('0x17')][_0xae3d('0x16')]);}})['catch'](function(_0xe925fd){logger[_0xae3d('0x14')](_0xae3d('0xf'),_0x33c089,_0xe925fd);_0x3d6650(_0xe925fd);});});}exports['GetMemberReport']=function(_0x3f8cf9){var _0x4cbe4e=this;return new Promise(function(_0x558e42,_0x4d931d){return db[_0xae3d('0x18')][_0xae3d('0x19')]({'raw':_0x3f8cf9[_0xae3d('0x1a')]?_0x3f8cf9[_0xae3d('0x1a')][_0xae3d('0x1b')]===undefined?!![]:![]:!![],'where':_0x3f8cf9['options']?_0x3f8cf9[_0xae3d('0x1a')]['where']||null:null,'attributes':_0x3f8cf9[_0xae3d('0x1a')]?_0x3f8cf9[_0xae3d('0x1a')][_0xae3d('0x1c')]||null:null,'limit':_0x3f8cf9[_0xae3d('0x1a')]?_0x3f8cf9[_0xae3d('0x1a')][_0xae3d('0x1d')]||null:null,'include':_0x3f8cf9[_0xae3d('0x1a')]?_0x3f8cf9[_0xae3d('0x1a')][_0xae3d('0x1e')]?_[_0xae3d('0x1f')](_0x3f8cf9[_0xae3d('0x1a')][_0xae3d('0x1e')],function(_0x37f5ff){return{'model':db[_0x37f5ff[_0xae3d('0x20')]],'as':_0x37f5ff['as'],'attributes':_0x37f5ff[_0xae3d('0x1c')],'include':_0x37f5ff[_0xae3d('0x1e')]?_[_0xae3d('0x1f')](_0x37f5ff[_0xae3d('0x1e')],function(_0x2131e9){return{'model':db[_0x2131e9[_0xae3d('0x20')]],'as':_0x2131e9['as'],'attributes':_0x2131e9['attributes'],'include':_0x2131e9[_0xae3d('0x1e')]?_[_0xae3d('0x1f')](_0x2131e9[_0xae3d('0x1e')],function(_0x52df0f){return{'model':db[_0x52df0f[_0xae3d('0x20')]],'as':_0x52df0f['as'],'attributes':_0x52df0f[_0xae3d('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xae3d('0x21')](function(_0x54c1e1){logger['info'](_0xae3d('0x22'),_0x3f8cf9);logger[_0xae3d('0x11')](_0xae3d('0x22'),_0x3f8cf9,JSON[_0xae3d('0x13')](_0x54c1e1));_0x558e42(_0x54c1e1);})[_0xae3d('0x23')](function(_0x561371){logger[_0xae3d('0x14')](_0xae3d('0x22'),_0x561371['message'],_0x3f8cf9);_0x4d931d(_0x4cbe4e[_0xae3d('0x14')](0x1f4,_0x561371[_0xae3d('0x16')]));});});};exports[_0xae3d('0x24')]=function(_0x46f484){var _0x432c04=this;return new Promise(function(_0x6ef13c,_0x5356d4){return db['MemberReport']['create'](_0x46f484[_0xae3d('0x25')],{'raw':_0x46f484[_0xae3d('0x1a')]?_0x46f484[_0xae3d('0x1a')][_0xae3d('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x31af1b){logger[_0xae3d('0xe')](_0xae3d('0x24'),_0x46f484);logger[_0xae3d('0x11')](_0xae3d('0x24'),_0x46f484,JSON[_0xae3d('0x13')](_0x31af1b));_0x6ef13c(_0x31af1b);})[_0xae3d('0x23')](function(_0x5ea647){logger[_0xae3d('0x14')]('CreateMemberReport',_0x5ea647['message'],_0x46f484);_0x5356d4(_0x432c04[_0xae3d('0x14')](0x1f4,_0x5ea647['message']));});});};exports[_0xae3d('0x26')]=function(_0x4b79ed){var _0x59425f=this;return new Promise(function(_0x1a28b5,_0x2e055a){return db[_0xae3d('0x18')]['update'](_0x4b79ed[_0xae3d('0x25')],{'raw':_0x4b79ed['options']?_0x4b79ed[_0xae3d('0x1a')][_0xae3d('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b79ed[_0xae3d('0x1a')]?_0x4b79ed[_0xae3d('0x1a')][_0xae3d('0x27')]||null:null,'attributes':_0x4b79ed[_0xae3d('0x1a')]?_0x4b79ed[_0xae3d('0x1a')][_0xae3d('0x1c')]||null:null,'limit':_0x4b79ed[_0xae3d('0x1a')]?_0x4b79ed[_0xae3d('0x1a')][_0xae3d('0x1d')]||null:null})['then'](function(_0x544269){logger[_0xae3d('0xe')]('UpdateMemberReport',_0x4b79ed);logger[_0xae3d('0x11')](_0xae3d('0x26'),_0x4b79ed,JSON[_0xae3d('0x13')](_0x544269));_0x1a28b5(_0x544269);})[_0xae3d('0x23')](function(_0x2c2892){logger[_0xae3d('0x14')](_0xae3d('0x26'),_0x2c2892[_0xae3d('0x16')],_0x4b79ed);_0x2e055a(_0x59425f[_0xae3d('0x14')](0x1f4,_0x2c2892[_0xae3d('0x16')]));});});}; \ No newline at end of file +var _0x5031=['options','attributes','limit','include','map','model','CreateMemberReport','raw','update','body','where','UpdateMemberReport','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMemberReport','MemberReport','findAll'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5031,0x144));var _0x1503=function(_0x52786f,_0x24fa18){_0x52786f=_0x52786f-0x0;var _0x517f5a=_0x5031[_0x52786f];return _0x517f5a;};'use strict';var _=require(_0x1503('0x0'));var util=require(_0x1503('0x1'));var moment=require(_0x1503('0x2'));var BPromise=require(_0x1503('0x3'));var rs=require(_0x1503('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1503('0x5'));var logger=require(_0x1503('0x6'))(_0x1503('0x7'));var config=require(_0x1503('0x8'));var jayson=require(_0x1503('0x9'));var client=jayson[_0x1503('0xa')][_0x1503('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x114bec,_0x2db96e,_0x4c93e7){return new BPromise(function(_0x2007d0,_0x2dddb6){return client['request'](_0x114bec,_0x4c93e7)[_0x1503('0xc')](function(_0x466900){logger[_0x1503('0xd')](_0x1503('0xe'),_0x2db96e,_0x1503('0xf'));logger[_0x1503('0x10')](_0x1503('0x11'),_0x2db96e,_0x1503('0xf'),JSON[_0x1503('0x12')](_0x466900));if(_0x466900[_0x1503('0x13')]){if(_0x466900['error'][_0x1503('0x14')]===0x1f4){logger[_0x1503('0x13')](_0x1503('0xe'),_0x2db96e,_0x466900[_0x1503('0x13')][_0x1503('0x15')]);return _0x2dddb6(_0x466900['error'][_0x1503('0x15')]);}logger[_0x1503('0x13')](_0x1503('0xe'),_0x2db96e,_0x466900[_0x1503('0x13')][_0x1503('0x15')]);return _0x2007d0(_0x466900[_0x1503('0x13')][_0x1503('0x15')]);}else{logger[_0x1503('0xd')](_0x1503('0xe'),_0x2db96e,_0x1503('0xf'));_0x2007d0(_0x466900[_0x1503('0x16')][_0x1503('0x15')]);}})[_0x1503('0x17')](function(_0x33dae9){logger[_0x1503('0x13')](_0x1503('0xe'),_0x2db96e,_0x33dae9);_0x2dddb6(_0x33dae9);});});}exports[_0x1503('0x18')]=function(_0x3dc3c5){var _0x401b1b=this;return new Promise(function(_0x4c7390,_0x3f8c15){return db[_0x1503('0x19')][_0x1503('0x1a')]({'raw':_0x3dc3c5[_0x1503('0x1b')]?_0x3dc3c5[_0x1503('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x3dc3c5['options']?_0x3dc3c5['options']['where']||null:null,'attributes':_0x3dc3c5[_0x1503('0x1b')]?_0x3dc3c5[_0x1503('0x1b')][_0x1503('0x1c')]||null:null,'limit':_0x3dc3c5[_0x1503('0x1b')]?_0x3dc3c5['options'][_0x1503('0x1d')]||null:null,'include':_0x3dc3c5[_0x1503('0x1b')]?_0x3dc3c5[_0x1503('0x1b')][_0x1503('0x1e')]?_[_0x1503('0x1f')](_0x3dc3c5[_0x1503('0x1b')][_0x1503('0x1e')],function(_0xde9620){return{'model':db[_0xde9620[_0x1503('0x20')]],'as':_0xde9620['as'],'attributes':_0xde9620['attributes'],'include':_0xde9620[_0x1503('0x1e')]?_['map'](_0xde9620[_0x1503('0x1e')],function(_0x2e8ee1){return{'model':db[_0x2e8ee1[_0x1503('0x20')]],'as':_0x2e8ee1['as'],'attributes':_0x2e8ee1[_0x1503('0x1c')],'include':_0x2e8ee1['include']?_[_0x1503('0x1f')](_0x2e8ee1[_0x1503('0x1e')],function(_0x1116b0){return{'model':db[_0x1116b0[_0x1503('0x20')]],'as':_0x1116b0['as'],'attributes':_0x1116b0[_0x1503('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x1503('0xc')](function(_0x4cab3a){logger[_0x1503('0xd')](_0x1503('0x18'),_0x3dc3c5);logger[_0x1503('0x10')](_0x1503('0x18'),_0x3dc3c5,JSON[_0x1503('0x12')](_0x4cab3a));_0x4c7390(_0x4cab3a);})[_0x1503('0x17')](function(_0x3e7b2b){logger[_0x1503('0x13')](_0x1503('0x18'),_0x3e7b2b[_0x1503('0x15')],_0x3dc3c5);_0x3f8c15(_0x401b1b['error'](0x1f4,_0x3e7b2b[_0x1503('0x15')]));});});};exports[_0x1503('0x21')]=function(_0x131c4f){var _0x53acd7=this;return new Promise(function(_0x58b2fc,_0x52ecd2){return db[_0x1503('0x19')]['create'](_0x131c4f['body'],{'raw':_0x131c4f[_0x1503('0x1b')]?_0x131c4f[_0x1503('0x1b')][_0x1503('0x22')]===undefined?!![]:![]:!![]})[_0x1503('0xc')](function(_0x5d170e){logger[_0x1503('0xd')]('CreateMemberReport',_0x131c4f);logger[_0x1503('0x10')](_0x1503('0x21'),_0x131c4f,JSON[_0x1503('0x12')](_0x5d170e));_0x58b2fc(_0x5d170e);})[_0x1503('0x17')](function(_0x4d87a7){logger[_0x1503('0x13')](_0x1503('0x21'),_0x4d87a7['message'],_0x131c4f);_0x52ecd2(_0x53acd7[_0x1503('0x13')](0x1f4,_0x4d87a7[_0x1503('0x15')]));});});};exports['UpdateMemberReport']=function(_0x201b5b){var _0x2d9beb=this;return new Promise(function(_0x2989b3,_0x204ec4){return db['MemberReport'][_0x1503('0x23')](_0x201b5b[_0x1503('0x24')],{'raw':_0x201b5b[_0x1503('0x1b')]?_0x201b5b[_0x1503('0x1b')][_0x1503('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x201b5b['options']?_0x201b5b[_0x1503('0x1b')][_0x1503('0x25')]||null:null,'attributes':_0x201b5b['options']?_0x201b5b[_0x1503('0x1b')][_0x1503('0x1c')]||null:null,'limit':_0x201b5b[_0x1503('0x1b')]?_0x201b5b[_0x1503('0x1b')]['limit']||null:null})['then'](function(_0x1e4fc6){logger[_0x1503('0xd')](_0x1503('0x26'),_0x201b5b);logger[_0x1503('0x10')](_0x1503('0x26'),_0x201b5b,JSON[_0x1503('0x12')](_0x1e4fc6));_0x2989b3(_0x1e4fc6);})[_0x1503('0x17')](function(_0xbf77a5){logger[_0x1503('0x13')](_0x1503('0x26'),_0xbf77a5[_0x1503('0x15')],_0x201b5b);_0x204ec4(_0x2d9beb[_0x1503('0x13')](0x1f4,_0xbf77a5[_0x1503('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 05d15a6..5ac930b 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 _0x1eba=['connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./migration.controller','get','index','exports','multer','path'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x1eba,0xda));var _0xa1eb=function(_0x4aac5a,_0x15b04c){_0x4aac5a=_0x4aac5a-0x0;var _0x42e7bc=_0x1eba[_0x4aac5a];return _0x42e7bc;};'use strict';var multer=require(_0xa1eb('0x0'));var util=require('util');var path=require(_0xa1eb('0x1'));var timeout=require(_0xa1eb('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xa1eb('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa1eb('0x4'));var config=require(_0xa1eb('0x5'));var controller=require(_0xa1eb('0x6'));router[_0xa1eb('0x7')]('/',controller[_0xa1eb('0x8')]);module[_0xa1eb('0x9')]=router; \ No newline at end of file +var _0x3657=['express','Router','../../config/environment','./migration.controller','get','index','exports','util','path'];(function(_0x1cc855,_0x4ed46a){var _0x7f3f44=function(_0x2a95e6){while(--_0x2a95e6){_0x1cc855['push'](_0x1cc855['shift']());}};_0x7f3f44(++_0x4ed46a);}(_0x3657,0xcd));var _0x7365=function(_0x5f3905,_0x43a651){_0x5f3905=_0x5f3905-0x0;var _0x2923b1=_0x3657[_0x5f3905];return _0x2923b1;};'use strict';var multer=require('multer');var util=require(_0x7365('0x0'));var path=require(_0x7365('0x1'));var timeout=require('connect-timeout');var express=require(_0x7365('0x2'));var router=express[_0x7365('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7365('0x4'));var controller=require(_0x7365('0x5'));router[_0x7365('0x6')]('/',controller[_0x7365('0x7')]);module[_0x7365('0x8')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index df9b5dc..3b7bac1 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 _0x4177=['exports','version','sequelize'];(function(_0x7ea3fe,_0x64e4bf){var _0x21cda9=function(_0x2b3af4){while(--_0x2b3af4){_0x7ea3fe['push'](_0x7ea3fe['shift']());}};_0x21cda9(++_0x64e4bf);}(_0x4177,0x137));var _0x7417=function(_0x327d10,_0x518c7f){_0x327d10=_0x327d10-0x0;var _0x3ed7c4=_0x4177[_0x327d10];return _0x3ed7c4;};'use strict';var Sequelize=require(_0x7417('0x0'));module[_0x7417('0x1')]={'version':{'type':Sequelize['STRING'],'unique':_0x7417('0x2')}}; \ No newline at end of file +var _0xb07b=['STRING','version','sequelize','exports'];(function(_0x4de877,_0x340170){var _0xb2cfeb=function(_0x488634){while(--_0x488634){_0x4de877['push'](_0x4de877['shift']());}};_0xb2cfeb(++_0x340170);}(_0xb07b,0x96));var _0xbb07=function(_0x3d0293,_0x3d3c80){_0x3d0293=_0x3d0293-0x0;var _0x5aa8d3=_0xb07b[_0x3d0293];return _0x5aa8d3;};'use strict';var Sequelize=require(_0xbb07('0x0'));module[_0xbb07('0x1')]={'version':{'type':Sequelize[_0xbb07('0x2')],'unique':_0xbb07('0x3')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 6893d84..c7abfe5 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 _0x1258=['bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','save','update','then','error','name','send','Migration','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','includeAll','include','findAll','rows','catch','eml-format','zip-dir','fast-json-patch','request-promise'];(function(_0x3c9a10,_0x3e000b){var _0x303ffa=function(_0x5678a3){while(--_0x5678a3){_0x3c9a10['push'](_0x3c9a10['shift']());}};_0x303ffa(++_0x3e000b);}(_0x1258,0x1ca));var _0x8125=function(_0x5d9ed3,_0x23448e){_0x5d9ed3=_0x5d9ed3-0x0;var _0x16b1db=_0x1258[_0x5d9ed3];return _0x16b1db;};'use strict';var emlformat=require(_0x8125('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8125('0x1'));var jsonpatch=require(_0x8125('0x2'));var rp=require(_0x8125('0x3'));var moment=require('moment');var BPromise=require(_0x8125('0x4'));var Mustache=require(_0x8125('0x5'));var util=require('util');var path=require(_0x8125('0x6'));var sox=require(_0x8125('0x7'));var csv=require(_0x8125('0x8'));var ejs=require(_0x8125('0x9'));var fs=require('fs');var fs_extra=require(_0x8125('0xa'));var _=require(_0x8125('0xb'));var squel=require(_0x8125('0xc'));var crypto=require(_0x8125('0xd'));var jsforce=require(_0x8125('0xe'));var deskjs=require(_0x8125('0xf'));var toCsv=require(_0x8125('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8125('0x10'));var authService=require(_0x8125('0x11'));var qs=require(_0x8125('0x12'));var as=require(_0x8125('0x13'));var hardwareService=require(_0x8125('0x14'));var logger=require(_0x8125('0x15'))(_0x8125('0x16'));var utils=require(_0x8125('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x8125('0x18'));var db=require(_0x8125('0x19'))['db'];function respondWithStatusCode(_0x5905d0,_0x5aea3f){_0x5aea3f=_0x5aea3f||0xcc;return function(_0x196494){if(_0x196494){return _0x5905d0[_0x8125('0x1a')](_0x5aea3f);}return _0x5905d0[_0x8125('0x1b')](_0x5aea3f)[_0x8125('0x1c')]();};}function respondWithResult(_0x542c5d,_0x56e21f){_0x56e21f=_0x56e21f||0xc8;return function(_0x581f28){if(_0x581f28){return _0x542c5d['status'](_0x56e21f)[_0x8125('0x1d')](_0x581f28);}};}function respondWithFilteredResult(_0x2289d9,_0x5b4b8e){return function(_0x44908b){if(_0x44908b){var _0x8891e2=typeof _0x5b4b8e[_0x8125('0x1e')]===_0x8125('0x1f')&&typeof _0x5b4b8e[_0x8125('0x20')]===_0x8125('0x1f');var _0x3992a2=_0x44908b['count'];var _0x166b06=_0x8891e2?0x0:_0x5b4b8e['offset'];var _0x42b6ae=_0x8891e2?_0x44908b[_0x8125('0x21')]:_0x5b4b8e[_0x8125('0x1e')]+_0x5b4b8e[_0x8125('0x20')];var _0x84ade4;if(_0x42b6ae>=_0x3992a2){_0x42b6ae=_0x3992a2;_0x84ade4=0xc8;}else{_0x84ade4=0xce;}_0x2289d9[_0x8125('0x1b')](_0x84ade4);return _0x2289d9['set']('Content-Range',_0x166b06+'-'+_0x42b6ae+'/'+_0x3992a2)[_0x8125('0x1d')](_0x44908b);}return null;};}function patchUpdates(_0x2c0d26){return function(_0x4e97fc){try{jsonpatch['apply'](_0x4e97fc,_0x2c0d26,!![]);}catch(_0x17f8ff){return BPromise['reject'](_0x17f8ff);}return _0x4e97fc[_0x8125('0x22')]();};}function saveUpdates(_0x1ee19d,_0x1e0e01){return function(_0x11f742){if(_0x11f742){return _0x11f742[_0x8125('0x23')](_0x1ee19d)[_0x8125('0x24')](function(_0x7943b7){return _0x7943b7;});}return null;};}function removeEntity(_0x3a2800,_0x3f41b3){return function(_0x85b03b){if(_0x85b03b){return _0x85b03b['destroy']()['then'](function(){_0x3a2800[_0x8125('0x1b')](0xcc)[_0x8125('0x1c')]();});}};}function handleEntityNotFound(_0x38a49c,_0x49ce50){return function(_0x199c56){if(!_0x199c56){_0x38a49c[_0x8125('0x1a')](0x194);}return _0x199c56;};}function handleError(_0x2b27fb,_0x332870){_0x332870=_0x332870||0x1f4;return function(_0x30153e){logger[_0x8125('0x25')](_0x30153e['stack']);if(_0x30153e['name']){delete _0x30153e[_0x8125('0x26')];}_0x2b27fb[_0x8125('0x1b')](_0x332870)[_0x8125('0x27')](_0x30153e);};}exports['index']=function(_0x45e1d1,_0x51f564){var _0x104546={},_0x54b43f={},_0x131d2e={'count':0x0,'rows':[]};var _0x3f64de=_['map'](db[_0x8125('0x28')][_0x8125('0x29')],function(_0x1eb8c2){return{'name':_0x1eb8c2[_0x8125('0x2a')],'type':_0x1eb8c2[_0x8125('0x2b')]['key']};});_0x54b43f[_0x8125('0x2c')]=_['map'](_0x3f64de,_0x8125('0x26'));_0x54b43f[_0x8125('0x2d')]=_['keys'](_0x45e1d1[_0x8125('0x2d')]);_0x54b43f[_0x8125('0x2e')]=_[_0x8125('0x2f')](_0x54b43f[_0x8125('0x2c')],_0x54b43f[_0x8125('0x2d')]);_0x104546[_0x8125('0x30')]=_['intersection'](_0x54b43f['model'],qs[_0x8125('0x31')](_0x45e1d1['query']['fields']));_0x104546[_0x8125('0x30')]=_0x104546[_0x8125('0x30')][_0x8125('0x32')]?_0x104546['attributes']:_0x54b43f[_0x8125('0x2c')];if(!_0x45e1d1[_0x8125('0x2d')][_0x8125('0x33')](_0x8125('0x34'))){_0x104546[_0x8125('0x20')]=qs[_0x8125('0x20')](_0x45e1d1[_0x8125('0x2d')][_0x8125('0x20')]);_0x104546[_0x8125('0x1e')]=qs[_0x8125('0x1e')](_0x45e1d1['query'][_0x8125('0x1e')]);}_0x104546[_0x8125('0x35')]=qs['sort'](_0x45e1d1[_0x8125('0x2d')][_0x8125('0x36')]);_0x104546[_0x8125('0x37')]=qs[_0x8125('0x2e')](_[_0x8125('0x38')](_0x45e1d1[_0x8125('0x2d')],_0x54b43f[_0x8125('0x2e')]),_0x3f64de);if(_0x45e1d1[_0x8125('0x2d')][_0x8125('0x39')]){_0x104546[_0x8125('0x37')]=_[_0x8125('0x3a')](_0x104546[_0x8125('0x37')],{'$or':_[_0x8125('0x3b')](_0x3f64de,function(_0x11de6c){if(_0x11de6c[_0x8125('0x2b')]!==_0x8125('0x3c')){var _0x5a175e={};_0x5a175e[_0x11de6c[_0x8125('0x26')]]={'$like':'%'+_0x45e1d1[_0x8125('0x2d')][_0x8125('0x39')]+'%'};return _0x5a175e;}})});}_0x104546=_[_0x8125('0x3a')]({},_0x104546,_0x45e1d1['options']);var _0x2a609f={'where':_0x104546[_0x8125('0x37')]};return db[_0x8125('0x28')][_0x8125('0x21')](_0x2a609f)[_0x8125('0x24')](function(_0x19ed26){_0x131d2e[_0x8125('0x21')]=_0x19ed26;if(_0x45e1d1[_0x8125('0x2d')][_0x8125('0x3d')]){_0x104546[_0x8125('0x3e')]=[{'all':!![]}];}return db[_0x8125('0x28')][_0x8125('0x3f')](_0x104546);})[_0x8125('0x24')](function(_0x388207){_0x131d2e[_0x8125('0x40')]=_0x388207;return _0x131d2e;})[_0x8125('0x24')](respondWithFilteredResult(_0x51f564,_0x104546))[_0x8125('0x41')](handleError(_0x51f564,null));}; \ No newline at end of file +var _0x74d8=['key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','Migration','include','findAll','catch','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','error','name','send','index','map','rawAttributes','fieldName','type'];(function(_0x2f62aa,_0x108e95){var _0x1a341f=function(_0x3aedcf){while(--_0x3aedcf){_0x2f62aa['push'](_0x2f62aa['shift']());}};_0x1a341f(++_0x108e95);}(_0x74d8,0xd8));var _0x874d=function(_0x2dbf10,_0xdaa708){_0x2dbf10=_0x2dbf10-0x0;var _0x2d7bd2=_0x74d8[_0x2dbf10];return _0x2d7bd2;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x874d('0x0'));var jsonpatch=require(_0x874d('0x1'));var rp=require(_0x874d('0x2'));var moment=require('moment');var BPromise=require(_0x874d('0x3'));var Mustache=require(_0x874d('0x4'));var util=require('util');var path=require(_0x874d('0x5'));var sox=require(_0x874d('0x6'));var csv=require(_0x874d('0x7'));var ejs=require(_0x874d('0x8'));var fs=require('fs');var fs_extra=require(_0x874d('0x9'));var _=require(_0x874d('0xa'));var squel=require('squel');var crypto=require(_0x874d('0xb'));var jsforce=require(_0x874d('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x874d('0xd'));var Papa=require('papaparse');var Redis=require(_0x874d('0xe'));var authService=require(_0x874d('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x874d('0x10'));var hardwareService=require(_0x874d('0x11'));var logger=require(_0x874d('0x12'))(_0x874d('0x13'));var utils=require('../../config/utils');var config=require(_0x874d('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x874d('0x15'))['db'];function respondWithStatusCode(_0x124ca3,_0xb0b12a){_0xb0b12a=_0xb0b12a||0xcc;return function(_0x3ecd0d){if(_0x3ecd0d){return _0x124ca3[_0x874d('0x16')](_0xb0b12a);}return _0x124ca3[_0x874d('0x17')](_0xb0b12a)[_0x874d('0x18')]();};}function respondWithResult(_0x454b3f,_0x229510){_0x229510=_0x229510||0xc8;return function(_0x1010cb){if(_0x1010cb){return _0x454b3f[_0x874d('0x17')](_0x229510)[_0x874d('0x19')](_0x1010cb);}};}function respondWithFilteredResult(_0x1cd4a8,_0x5a43b9){return function(_0x36b090){if(_0x36b090){var _0x2c21ca=typeof _0x5a43b9[_0x874d('0x1a')]==='undefined'&&typeof _0x5a43b9[_0x874d('0x1b')]===_0x874d('0x1c');var _0x583e8b=_0x36b090[_0x874d('0x1d')];var _0x82f9d8=_0x2c21ca?0x0:_0x5a43b9[_0x874d('0x1a')];var _0x505d29=_0x2c21ca?_0x36b090['count']:_0x5a43b9[_0x874d('0x1a')]+_0x5a43b9[_0x874d('0x1b')];var _0x3048eb;if(_0x505d29>=_0x583e8b){_0x505d29=_0x583e8b;_0x3048eb=0xc8;}else{_0x3048eb=0xce;}_0x1cd4a8[_0x874d('0x17')](_0x3048eb);return _0x1cd4a8['set'](_0x874d('0x1e'),_0x82f9d8+'-'+_0x505d29+'/'+_0x583e8b)['json'](_0x36b090);}return null;};}function patchUpdates(_0x24224e){return function(_0x20658b){try{jsonpatch[_0x874d('0x1f')](_0x20658b,_0x24224e,!![]);}catch(_0x2ffff4){return BPromise[_0x874d('0x20')](_0x2ffff4);}return _0x20658b[_0x874d('0x21')]();};}function saveUpdates(_0x4cd8bf,_0x4e1cf1){return function(_0x1b0917){if(_0x1b0917){return _0x1b0917[_0x874d('0x22')](_0x4cd8bf)[_0x874d('0x23')](function(_0x52e371){return _0x52e371;});}return null;};}function removeEntity(_0x588451,_0x54f21c){return function(_0x1f8102){if(_0x1f8102){return _0x1f8102['destroy']()[_0x874d('0x23')](function(){_0x588451['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x45034f,_0x291af3){return function(_0x2c8ab9){if(!_0x2c8ab9){_0x45034f[_0x874d('0x16')](0x194);}return _0x2c8ab9;};}function handleError(_0xb7ad9e,_0x2d5b4d){_0x2d5b4d=_0x2d5b4d||0x1f4;return function(_0x488805){logger[_0x874d('0x24')](_0x488805['stack']);if(_0x488805[_0x874d('0x25')]){delete _0x488805[_0x874d('0x25')];}_0xb7ad9e['status'](_0x2d5b4d)[_0x874d('0x26')](_0x488805);};}exports[_0x874d('0x27')]=function(_0x86db18,_0x43d872){var _0x15785d={},_0xe947df={},_0x16f63b={'count':0x0,'rows':[]};var _0x55533b=_[_0x874d('0x28')](db['Migration'][_0x874d('0x29')],function(_0xba20cc){return{'name':_0xba20cc[_0x874d('0x2a')],'type':_0xba20cc[_0x874d('0x2b')][_0x874d('0x2c')]};});_0xe947df[_0x874d('0x2d')]=_[_0x874d('0x28')](_0x55533b,_0x874d('0x25'));_0xe947df[_0x874d('0x2e')]=_[_0x874d('0x2f')](_0x86db18[_0x874d('0x2e')]);_0xe947df[_0x874d('0x30')]=_['intersection'](_0xe947df['model'],_0xe947df[_0x874d('0x2e')]);_0x15785d['attributes']=_[_0x874d('0x31')](_0xe947df[_0x874d('0x2d')],qs[_0x874d('0x32')](_0x86db18[_0x874d('0x2e')][_0x874d('0x32')]));_0x15785d[_0x874d('0x33')]=_0x15785d[_0x874d('0x33')][_0x874d('0x34')]?_0x15785d[_0x874d('0x33')]:_0xe947df[_0x874d('0x2d')];if(!_0x86db18[_0x874d('0x2e')][_0x874d('0x35')](_0x874d('0x36'))){_0x15785d['limit']=qs[_0x874d('0x1b')](_0x86db18[_0x874d('0x2e')]['limit']);_0x15785d['offset']=qs[_0x874d('0x1a')](_0x86db18['query'][_0x874d('0x1a')]);}_0x15785d['order']=qs[_0x874d('0x37')](_0x86db18[_0x874d('0x2e')][_0x874d('0x37')]);_0x15785d[_0x874d('0x38')]=qs[_0x874d('0x30')](_[_0x874d('0x39')](_0x86db18[_0x874d('0x2e')],_0xe947df[_0x874d('0x30')]),_0x55533b);if(_0x86db18[_0x874d('0x2e')][_0x874d('0x3a')]){_0x15785d[_0x874d('0x38')]=_['merge'](_0x15785d[_0x874d('0x38')],{'$or':_['map'](_0x55533b,function(_0x49fb2f){if(_0x49fb2f[_0x874d('0x2b')]!=='VIRTUAL'){var _0x29eb75={};_0x29eb75[_0x49fb2f[_0x874d('0x25')]]={'$like':'%'+_0x86db18[_0x874d('0x2e')][_0x874d('0x3a')]+'%'};return _0x29eb75;}})});}_0x15785d=_[_0x874d('0x3b')]({},_0x15785d,_0x86db18[_0x874d('0x3c')]);var _0x3adc19={'where':_0x15785d[_0x874d('0x38')]};return db[_0x874d('0x3d')][_0x874d('0x1d')](_0x3adc19)['then'](function(_0x4caa02){_0x16f63b[_0x874d('0x1d')]=_0x4caa02;if(_0x86db18[_0x874d('0x2e')]['includeAll']){_0x15785d[_0x874d('0x3e')]=[{'all':!![]}];}return db[_0x874d('0x3d')][_0x874d('0x3f')](_0x15785d);})['then'](function(_0x3f5a1f){_0x16f63b['rows']=_0x3f5a1f;return _0x16f63b;})['then'](respondWithFilteredResult(_0x43d872,_0x15785d))[_0x874d('0x40')](handleError(_0x43d872,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 009e6ab..0d96b30 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 _0x9a73=['rimraf','../../config/environment','./migration.attributes','exports','Migration','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x9a73,0x1b2));var _0x39a7=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x9a73[_0x3e5086];return _0xfeb102;};'use strict';var _=require(_0x39a7('0x0'));var util=require(_0x39a7('0x1'));var logger=require(_0x39a7('0x2'))(_0x39a7('0x3'));var moment=require(_0x39a7('0x4'));var BPromise=require(_0x39a7('0x5'));var rp=require(_0x39a7('0x6'));var fs=require('fs');var path=require(_0x39a7('0x7'));var rimraf=require(_0x39a7('0x8'));var config=require(_0x39a7('0x9'));var attributes=require(_0x39a7('0xa'));module[_0x39a7('0xb')]=function(_0x1f530f,_0x50acbe){return _0x1f530f['define'](_0x39a7('0xc'),attributes,{'tableName':'migrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8eca=['path','../../config/environment','./migration.attributes','define','Migration','migrations','util','../../config/logger','api','moment','request-promise'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x8eca,0xcc));var _0xa8ec=function(_0xd7e064,_0x117354){_0xd7e064=_0xd7e064-0x0;var _0x15f386=_0x8eca[_0xd7e064];return _0x15f386;};'use strict';var _=require('lodash');var util=require(_0xa8ec('0x0'));var logger=require(_0xa8ec('0x1'))(_0xa8ec('0x2'));var moment=require(_0xa8ec('0x3'));var BPromise=require('bluebird');var rp=require(_0xa8ec('0x4'));var fs=require('fs');var path=require(_0xa8ec('0x5'));var rimraf=require('rimraf');var config=require(_0xa8ec('0x6'));var attributes=require(_0xa8ec('0x7'));module['exports']=function(_0x16b6a4,_0x51eee4){return _0x16b6a4[_0xa8ec('0x8')](_0xa8ec('0x9'),attributes,{'tableName':_0xa8ec('0xa'),'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 b13f36e..af6cb18 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 _0xfc03=['moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash'];(function(_0x458adb,_0x5d482c){var _0x5f3920=function(_0x15be3f){while(--_0x15be3f){_0x458adb['push'](_0x458adb['shift']());}};_0x5f3920(++_0x5d482c);}(_0xfc03,0x16f));var _0x3fc0=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0xfc03[_0x178e48];return _0x440d7e;};'use strict';var _=require(_0x3fc0('0x0'));var util=require('util');var moment=require(_0x3fc0('0x1'));var BPromise=require(_0x3fc0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3fc0('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x3fc0('0x4'));var logger=require(_0x3fc0('0x5'))(_0x3fc0('0x6'));var config=require(_0x3fc0('0x7'));var jayson=require(_0x3fc0('0x8'));var client=jayson[_0x3fc0('0x9')][_0x3fc0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xeeb912,_0x55eac5,_0x2fb1a6){return new BPromise(function(_0x5f52b5,_0x1369ac){return client[_0x3fc0('0xb')](_0xeeb912,_0x2fb1a6)[_0x3fc0('0xc')](function(_0x392999){logger['info'](_0x3fc0('0xd'),_0x55eac5,_0x3fc0('0xe'));logger[_0x3fc0('0xf')](_0x3fc0('0x10'),_0x55eac5,_0x3fc0('0xe'),JSON['stringify'](_0x392999));if(_0x392999[_0x3fc0('0x11')]){if(_0x392999[_0x3fc0('0x11')][_0x3fc0('0x12')]===0x1f4){logger['error'](_0x3fc0('0xd'),_0x55eac5,_0x392999['error'][_0x3fc0('0x13')]);return _0x1369ac(_0x392999[_0x3fc0('0x11')]['message']);}logger[_0x3fc0('0x11')](_0x3fc0('0xd'),_0x55eac5,_0x392999[_0x3fc0('0x11')]['message']);return _0x5f52b5(_0x392999[_0x3fc0('0x11')][_0x3fc0('0x13')]);}else{logger[_0x3fc0('0x14')](_0x3fc0('0xd'),_0x55eac5,'request\x20sent');_0x5f52b5(_0x392999[_0x3fc0('0x15')][_0x3fc0('0x13')]);}})[_0x3fc0('0x16')](function(_0x5b59f1){logger[_0x3fc0('0x11')]('Migration,\x20%s,\x20%s',_0x55eac5,_0x5b59f1);_0x1369ac(_0x5b59f1);});});} \ No newline at end of file +var _0xc788=['request\x20sent','Migration,\x20%s,\x20%s,\x20%s','error','message','Migration,\x20%s,\x20%s','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info'];(function(_0x2f9467,_0x40576f){var _0x39894c=function(_0x13e344){while(--_0x13e344){_0x2f9467['push'](_0x2f9467['shift']());}};_0x39894c(++_0x40576f);}(_0xc788,0xc4));var _0x8c78=function(_0x31b9cf,_0x1a809b){_0x31b9cf=_0x31b9cf-0x0;var _0x357b8a=_0xc788[_0x31b9cf];return _0x357b8a;};'use strict';var _=require(_0x8c78('0x0'));var util=require(_0x8c78('0x1'));var moment=require(_0x8c78('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8c78('0x3'));var db=require(_0x8c78('0x4'))['db'];var utils=require(_0x8c78('0x5'));var logger=require(_0x8c78('0x6'))(_0x8c78('0x7'));var config=require('../../config/environment');var jayson=require(_0x8c78('0x8'));var client=jayson[_0x8c78('0x9')][_0x8c78('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1ac27f,_0x205cc1,_0x4d54a5){return new BPromise(function(_0x247188,_0x299d9d){return client[_0x8c78('0xb')](_0x1ac27f,_0x4d54a5)[_0x8c78('0xc')](function(_0xdb0c17){logger[_0x8c78('0xd')]('Migration,\x20%s,\x20%s',_0x205cc1,_0x8c78('0xe'));logger['debug'](_0x8c78('0xf'),_0x205cc1,_0x8c78('0xe'),JSON['stringify'](_0xdb0c17));if(_0xdb0c17[_0x8c78('0x10')]){if(_0xdb0c17[_0x8c78('0x10')]['code']===0x1f4){logger[_0x8c78('0x10')]('Migration,\x20%s,\x20%s',_0x205cc1,_0xdb0c17['error'][_0x8c78('0x11')]);return _0x299d9d(_0xdb0c17[_0x8c78('0x10')][_0x8c78('0x11')]);}logger[_0x8c78('0x10')](_0x8c78('0x12'),_0x205cc1,_0xdb0c17[_0x8c78('0x10')][_0x8c78('0x11')]);return _0x247188(_0xdb0c17[_0x8c78('0x10')][_0x8c78('0x11')]);}else{logger[_0x8c78('0xd')]('Migration,\x20%s,\x20%s',_0x205cc1,_0x8c78('0xe'));_0x247188(_0xdb0c17[_0x8c78('0x13')]['message']);}})[_0x8c78('0x14')](function(_0x554464){logger[_0x8c78('0x10')](_0x8c78('0x12'),_0x205cc1,_0x554464);_0x299d9d(_0x554464);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index e6af14a..0c4b08d 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 _0xcf98=['/:id','show','post','create','put','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./network.controller','get','isAuthenticated','index'];(function(_0x128b78,_0x163c3d){var _0x3adb90=function(_0x32d25f){while(--_0x32d25f){_0x128b78['push'](_0x128b78['shift']());}};_0x3adb90(++_0x163c3d);}(_0xcf98,0x8d));var _0x8cf9=function(_0x5af31a,_0x2299f8){_0x5af31a=_0x5af31a-0x0;var _0x46fb68=_0xcf98[_0x5af31a];return _0x46fb68;};'use strict';var multer=require('multer');var util=require(_0x8cf9('0x0'));var path=require(_0x8cf9('0x1'));var timeout=require(_0x8cf9('0x2'));var express=require(_0x8cf9('0x3'));var router=express[_0x8cf9('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x8cf9('0x5'));var config=require(_0x8cf9('0x6'));var controller=require(_0x8cf9('0x7'));router[_0x8cf9('0x8')]('/',auth[_0x8cf9('0x9')](),controller[_0x8cf9('0xa')]);router[_0x8cf9('0x8')](_0x8cf9('0xb'),auth[_0x8cf9('0x9')](),controller[_0x8cf9('0xc')]);router[_0x8cf9('0xd')]('/',auth['isAuthenticated'](),controller[_0x8cf9('0xe')]);router[_0x8cf9('0xf')]('/:id',auth[_0x8cf9('0x9')](),controller['update']);router[_0x8cf9('0x10')](_0x8cf9('0xb'),auth[_0x8cf9('0x9')](),controller[_0x8cf9('0x11')]);module[_0x8cf9('0x12')]=router; \ No newline at end of file +var _0x9666=['path','connect-timeout','Router','fs-extra','../../components/auth/service','./network.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy','exports','multer','util'];(function(_0x9b2b50,_0x38787e){var _0x4698ea=function(_0xa817af){while(--_0xa817af){_0x9b2b50['push'](_0x9b2b50['shift']());}};_0x4698ea(++_0x38787e);}(_0x9666,0x17a));var _0x6966=function(_0x31e925,_0x32cdfb){_0x31e925=_0x31e925-0x0;var _0x1a20bf=_0x9666[_0x31e925];return _0x1a20bf;};'use strict';var multer=require(_0x6966('0x0'));var util=require(_0x6966('0x1'));var path=require(_0x6966('0x2'));var timeout=require(_0x6966('0x3'));var express=require('express');var router=express[_0x6966('0x4')]();var fs_extra=require(_0x6966('0x5'));var auth=require(_0x6966('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x6966('0x7'));router[_0x6966('0x8')]('/',auth[_0x6966('0x9')](),controller[_0x6966('0xa')]);router[_0x6966('0x8')](_0x6966('0xb'),auth['isAuthenticated'](),controller[_0x6966('0xc')]);router[_0x6966('0xd')]('/',auth[_0x6966('0x9')](),controller['create']);router[_0x6966('0xe')](_0x6966('0xb'),auth[_0x6966('0x9')](),controller[_0x6966('0xf')]);router[_0x6966('0x10')](_0x6966('0xb'),auth[_0x6966('0x9')](),controller[_0x6966('0x11')]);module[_0x6966('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 3593111..a3e5a2a 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 _0xedfd=['stun','turn','STRING','sequelize','ENUM','localnet','externip'];(function(_0x41f6d4,_0x255693){var _0x42a2a9=function(_0x1d0a8){while(--_0x1d0a8){_0x41f6d4['push'](_0x41f6d4['shift']());}};_0x42a2a9(++_0x255693);}(_0xedfd,0xab));var _0xdedf=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xedfd[_0x40ac5e];return _0x2839d6;};'use strict';var Sequelize=require(_0xdedf('0x0'));module['exports']={'type':{'type':Sequelize[_0xdedf('0x1')](_0xdedf('0x2'),_0xdedf('0x3'),_0xdedf('0x4'),_0xdedf('0x5'))},'value':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xdedf('0x6')]},'password':{'type':Sequelize[_0xdedf('0x6')]}}; \ No newline at end of file +var _0x4f0c=['localnet','externip','turn','STRING'];(function(_0x1679c8,_0x5eff59){var _0x3b1766=function(_0x5ada5c){while(--_0x5ada5c){_0x1679c8['push'](_0x1679c8['shift']());}};_0x3b1766(++_0x5eff59);}(_0x4f0c,0x13c));var _0xc4f0=function(_0x196a11,_0x12e1e5){_0x196a11=_0x196a11-0x0;var _0x284139=_0x4f0c[_0x196a11];return _0x284139;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize['ENUM'](_0xc4f0('0x0'),_0xc4f0('0x1'),'stun',_0xc4f0('0x2'))},'value':{'type':Sequelize[_0xc4f0('0x3')]},'username':{'type':Sequelize[_0xc4f0('0x3')]},'password':{'type':Sequelize[_0xc4f0('0x3')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index fd8ad37..53cf759 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 _0xe3f4=['undefined','limit','count','set','update','destroy','end','sendStatus','stack','name','index','map','Network','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','include','rows','show','params','includeAll','find','create','body','STUN','readFileSync','join','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','toUpperCase','TURN','root','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','res_stun_monitor.so','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','findAll','server/files/templates/stun_multiple.ejs','chan_sip.so','util','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','jayson/promise','client','http','request','then','info','Network,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Network,\x20%s,\x20%s','message','catch','status','json','offset'];(function(_0x4688f6,_0x80c241){var _0x367087=function(_0x5764a1){while(--_0x5764a1){_0x4688f6['push'](_0x4688f6['shift']());}};_0x367087(++_0x80c241);}(_0xe3f4,0xe5));var _0x4e3f=function(_0x48b878,_0x32cb41){_0x48b878=_0x48b878-0x0;var _0x119962=_0xe3f4[_0x48b878];return _0x119962;};'use strict';var util=require(_0x4e3f('0x0'));var path=require('path');var ejs=require('ejs');var fs=require('fs');var _=require(_0x4e3f('0x1'));var qs=require(_0x4e3f('0x2'));var logger=require(_0x4e3f('0x3'))(_0x4e3f('0x4'));var config=require('../../config/environment');var db=require(_0x4e3f('0x5'))['db'];var jayson=require(_0x4e3f('0x6'));var client=jayson[_0x4e3f('0x7')][_0x4e3f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4972e9,_0x3c4c62,_0x3525ab,_0x1d0cd0){return new Promise(function(_0x2857cc,_0x129b62){var _0x36128e=_0x1d0cd0||client;return _0x36128e[_0x4e3f('0x9')](_0x4972e9,_0x3525ab)[_0x4e3f('0xa')](function(_0x16bf3c){logger[_0x4e3f('0xb')]('Network,\x20%s,\x20%s',_0x3c4c62,'request\x20sent');logger['debug'](_0x4e3f('0xc'),_0x3c4c62,_0x4e3f('0xd'),JSON[_0x4e3f('0xe')](_0x16bf3c));if(_0x16bf3c[_0x4e3f('0xf')]){if(_0x16bf3c[_0x4e3f('0xf')][_0x4e3f('0x10')]===0x1f4){logger[_0x4e3f('0xf')](_0x4e3f('0x11'),_0x3c4c62,_0x16bf3c['error'][_0x4e3f('0x12')]);return _0x129b62(_0x16bf3c[_0x4e3f('0xf')][_0x4e3f('0x12')]);}logger[_0x4e3f('0xf')](_0x4e3f('0x11'),_0x3c4c62,_0x16bf3c[_0x4e3f('0xf')][_0x4e3f('0x12')]);return _0x2857cc(_0x16bf3c[_0x4e3f('0xf')][_0x4e3f('0x12')]);}else{logger['info'](_0x4e3f('0x11'),_0x3c4c62,'request\x20sent');_0x2857cc(_0x16bf3c['result'][_0x4e3f('0x12')]);}})[_0x4e3f('0x13')](function(_0x32e6aa){logger[_0x4e3f('0xf')](_0x4e3f('0x11'),_0x3c4c62,_0x32e6aa);_0x129b62(_0x32e6aa);});});}function respondWithResult(_0x35d7da,_0x586785){_0x586785=_0x586785||0xc8;return function(_0x188eb5){if(_0x188eb5){return _0x35d7da[_0x4e3f('0x14')](_0x586785)[_0x4e3f('0x15')](_0x188eb5);}};}function respondWithFilteredResult(_0x14ae26,_0x778db3){return function(_0x322998){if(_0x322998){var _0x35087f=typeof _0x778db3[_0x4e3f('0x16')]===_0x4e3f('0x17')&&typeof _0x778db3[_0x4e3f('0x18')]===_0x4e3f('0x17');var _0x1c5fbd=_0x322998[_0x4e3f('0x19')];var _0x56ae7f=_0x35087f?0x0:_0x778db3[_0x4e3f('0x16')];var _0x5164fd=_0x35087f?_0x322998[_0x4e3f('0x19')]:_0x778db3[_0x4e3f('0x16')]+_0x778db3[_0x4e3f('0x18')];var _0x33327c;if(_0x5164fd>=_0x1c5fbd){_0x5164fd=_0x1c5fbd;_0x33327c=0xc8;}else{_0x33327c=0xce;}_0x14ae26[_0x4e3f('0x14')](_0x33327c);return _0x14ae26[_0x4e3f('0x1a')]('Content-Range',_0x56ae7f+'-'+_0x5164fd+'/'+_0x1c5fbd)[_0x4e3f('0x15')](_0x322998);}return null;};}function saveUpdates(_0x5273ab){return function(_0x429557){if(_0x429557){return _0x429557[_0x4e3f('0x1b')](_0x5273ab)[_0x4e3f('0xa')](function(_0x5bfe54){return _0x5bfe54;});}return null;};}function removeEntity(_0x32674b){return function(_0x110588){if(_0x110588){return _0x110588[_0x4e3f('0x1c')]()['then'](function(){_0x32674b['status'](0xcc)[_0x4e3f('0x1d')]();});}};}function handleEntityNotFound(_0x35dcc3){return function(_0x548565){if(!_0x548565){_0x35dcc3[_0x4e3f('0x1e')](0x194);}return _0x548565;};}function handleError(_0x14f0a6,_0x58a699){_0x58a699=_0x58a699||0x1f4;return function(_0x20afb3){logger[_0x4e3f('0xf')](_0x20afb3[_0x4e3f('0x1f')]);if(_0x20afb3[_0x4e3f('0x20')]){delete _0x20afb3[_0x4e3f('0x20')];}_0x14f0a6[_0x4e3f('0x14')](_0x58a699)['send'](_0x20afb3);};}exports[_0x4e3f('0x21')]=function(_0x5312c9,_0x37bc8d){var _0x25b9a5={},_0x3b3c6e={},_0xbf73b8={'count':0x0,'rows':[]};var _0x55851e=_[_0x4e3f('0x22')](db[_0x4e3f('0x23')][_0x4e3f('0x24')],function(_0xf803eb){return{'name':_0xf803eb['fieldName'],'type':_0xf803eb[_0x4e3f('0x25')][_0x4e3f('0x26')]};});_0x3b3c6e[_0x4e3f('0x27')]=_[_0x4e3f('0x22')](_0x55851e,_0x4e3f('0x20'));_0x3b3c6e[_0x4e3f('0x28')]=_[_0x4e3f('0x29')](_0x5312c9[_0x4e3f('0x28')]);_0x3b3c6e[_0x4e3f('0x2a')]=_[_0x4e3f('0x2b')](_0x3b3c6e[_0x4e3f('0x27')],_0x3b3c6e[_0x4e3f('0x28')]);_0x25b9a5[_0x4e3f('0x2c')]=_['intersection'](_0x3b3c6e['model'],qs[_0x4e3f('0x2d')](_0x5312c9['query'][_0x4e3f('0x2d')]));_0x25b9a5['attributes']=_0x25b9a5[_0x4e3f('0x2c')][_0x4e3f('0x2e')]?_0x25b9a5['attributes']:_0x3b3c6e[_0x4e3f('0x27')];if(!_0x5312c9['query'][_0x4e3f('0x2f')](_0x4e3f('0x30'))){_0x25b9a5[_0x4e3f('0x18')]=qs[_0x4e3f('0x18')](_0x5312c9[_0x4e3f('0x28')][_0x4e3f('0x18')]);_0x25b9a5['offset']=qs[_0x4e3f('0x16')](_0x5312c9[_0x4e3f('0x28')][_0x4e3f('0x16')]);}_0x25b9a5['order']=qs[_0x4e3f('0x31')](_0x5312c9[_0x4e3f('0x28')]['sort']);_0x25b9a5[_0x4e3f('0x32')]=qs[_0x4e3f('0x2a')](_['pick'](_0x5312c9[_0x4e3f('0x28')],_0x3b3c6e['filters']),_0x55851e);if(_0x5312c9[_0x4e3f('0x28')][_0x4e3f('0x33')]){_0x25b9a5[_0x4e3f('0x32')]=_[_0x4e3f('0x34')](_0x25b9a5['where'],{'$or':_[_0x4e3f('0x22')](_0x55851e,function(_0x2ef9a5){if(_0x2ef9a5[_0x4e3f('0x25')]!==_0x4e3f('0x35')){var _0x2920cc={};_0x2920cc[_0x2ef9a5['name']]={'$like':'%'+_0x5312c9[_0x4e3f('0x28')]['filter']+'%'};return _0x2920cc;}})});}_0x25b9a5=_['merge']({},_0x25b9a5,_0x5312c9[_0x4e3f('0x36')]);var _0x18056a={'where':_0x25b9a5[_0x4e3f('0x32')]};return db[_0x4e3f('0x23')]['count'](_0x18056a)['then'](function(_0x59d25d){_0xbf73b8['count']=_0x59d25d;if(_0x5312c9[_0x4e3f('0x28')]['includeAll']){_0x25b9a5[_0x4e3f('0x37')]=[{'all':!![]}];}return db[_0x4e3f('0x23')]['findAll'](_0x25b9a5);})['then'](function(_0x580842){_0xbf73b8[_0x4e3f('0x38')]=_0x580842;return _0xbf73b8;})['then'](respondWithFilteredResult(_0x37bc8d,_0x25b9a5))[_0x4e3f('0x13')](handleError(_0x37bc8d,null));};exports[_0x4e3f('0x39')]=function(_0x26f960,_0x45cb60){var _0x55fb07={'raw':!![],'where':{'id':_0x26f960[_0x4e3f('0x3a')]['id']}},_0x7e1c63={};_0x7e1c63[_0x4e3f('0x27')]=_[_0x4e3f('0x29')](db[_0x4e3f('0x23')]['rawAttributes']);_0x7e1c63[_0x4e3f('0x28')]=_[_0x4e3f('0x29')](_0x26f960[_0x4e3f('0x28')]);_0x7e1c63[_0x4e3f('0x2a')]=_[_0x4e3f('0x2b')](_0x7e1c63[_0x4e3f('0x27')],_0x7e1c63[_0x4e3f('0x28')]);_0x55fb07[_0x4e3f('0x2c')]=_[_0x4e3f('0x2b')](_0x7e1c63[_0x4e3f('0x27')],qs[_0x4e3f('0x2d')](_0x26f960[_0x4e3f('0x28')][_0x4e3f('0x2d')]));_0x55fb07[_0x4e3f('0x2c')]=_0x55fb07[_0x4e3f('0x2c')]['length']?_0x55fb07[_0x4e3f('0x2c')]:_0x7e1c63['model'];if(_0x26f960[_0x4e3f('0x28')][_0x4e3f('0x3b')]){_0x55fb07[_0x4e3f('0x37')]=[{'all':!![]}];}_0x55fb07=_[_0x4e3f('0x34')]({},_0x55fb07,_0x26f960[_0x4e3f('0x36')]);return db['Network'][_0x4e3f('0x3c')](_0x55fb07)[_0x4e3f('0xa')](handleEntityNotFound(_0x45cb60,null))[_0x4e3f('0xa')](respondWithResult(_0x45cb60,null))[_0x4e3f('0x13')](handleError(_0x45cb60,null));};exports['create']=function(_0x722da6,_0x1e4270){var _0x240391;return db[_0x4e3f('0x23')][_0x4e3f('0x3d')](_0x722da6[_0x4e3f('0x3e')],{'raw':!![]})[_0x4e3f('0xa')](function(_0xcd2856){_0x240391=_0xcd2856;return db[_0x4e3f('0x23')]['findAll']({'where':{'type':_0x722da6['body'][_0x4e3f('0x25')]},'raw':!![]});})[_0x4e3f('0xa')](function(_0x49f658){if(_0x240391[_0x4e3f('0x25')]['toUpperCase']()==_0x4e3f('0x3f')){var _0x431c02=fs[_0x4e3f('0x40')](path[_0x4e3f('0x41')](config['root'],'server/files/templates/stun_multiple.ejs'),_0x4e3f('0x42'));var _0x47d60f=ejs[_0x4e3f('0x43')](_0x431c02,{'networks':_0x49f658||[]});fs[_0x4e3f('0x44')](_0x4e3f('0x45'),_0x47d60f);return respondWithRpcPromise(_0x4e3f('0x46'),_0x4e3f('0x3d'),{'module':'res_stun_monitor.so'});}else if(_0x240391[_0x4e3f('0x25')][_0x4e3f('0x47')]()==_0x4e3f('0x48')){var _0x2e1e9=fs[_0x4e3f('0x40')](path['join'](config[_0x4e3f('0x49')],_0x4e3f('0x4a')),_0x4e3f('0x42'));var _0x2afc29=ejs[_0x4e3f('0x43')](_0x2e1e9,{'networks':_0x49f658||[]});fs[_0x4e3f('0x44')](_0x4e3f('0x4b'),_0x2afc29);return respondWithRpcPromise(_0x4e3f('0x46'),_0x4e3f('0x3d'),{'module':_0x4e3f('0x4c')});}else{var _0x338d7e=fs[_0x4e3f('0x40')](path['join'](config['root'],_0x4e3f('0x4d')),_0x4e3f('0x42'));var _0x55665d=ejs[_0x4e3f('0x43')](_0x338d7e,{'networks':_0x49f658||[]});fs['writeFileSync'](util[_0x4e3f('0x4e')](_0x4e3f('0x4f'),_0x722da6[_0x4e3f('0x3e')][_0x4e3f('0x25')][_0x4e3f('0x50')]()),_0x55665d);return respondWithRpcPromise(_0x4e3f('0x46'),_0x4e3f('0x3d'),{'module':'chan_sip.so'});}})['then'](function(){return _0x240391;})['then'](respondWithResult(_0x1e4270,0xc9))[_0x4e3f('0x13')](handleError(_0x1e4270,null));};exports[_0x4e3f('0x1b')]=function(_0x574328,_0x1749cd){var _0x3df4cd;return db[_0x4e3f('0x23')]['find']({'where':{'id':_0x574328[_0x4e3f('0x3a')]['id']}})[_0x4e3f('0xa')](handleEntityNotFound(_0x1749cd,null))[_0x4e3f('0xa')](saveUpdates(_0x574328[_0x4e3f('0x3e')],null))[_0x4e3f('0xa')](function(_0x22fd20){if(_0x22fd20){_0x3df4cd=_0x22fd20;return db[_0x4e3f('0x23')][_0x4e3f('0x51')]({'where':{'type':_0x3df4cd[_0x4e3f('0x25')]},'raw':!![]});}return null;})['then'](function(_0x17b76a){if(_0x3df4cd[_0x4e3f('0x25')]['toUpperCase']()==_0x4e3f('0x3f')){var _0x314ece=fs['readFileSync'](path[_0x4e3f('0x41')](config[_0x4e3f('0x49')],_0x4e3f('0x52')),_0x4e3f('0x42'));var _0x5b593c=ejs['render'](_0x314ece,{'networks':_0x17b76a||[]});fs[_0x4e3f('0x44')]('/etc/asterisk/stun_xcally.conf',_0x5b593c);return respondWithRpcPromise(_0x4e3f('0x46'),_0x4e3f('0x1b'),{'module':'res_stun_monitor.so'});}else if(_0x3df4cd['type'][_0x4e3f('0x47')]()==_0x4e3f('0x48')){var _0xc4c1=fs[_0x4e3f('0x40')](path[_0x4e3f('0x41')](config[_0x4e3f('0x49')],_0x4e3f('0x4a')),_0x4e3f('0x42'));var _0x3be40c=ejs[_0x4e3f('0x43')](_0xc4c1,{'networks':_0x17b76a||[]});fs[_0x4e3f('0x44')](_0x4e3f('0x4b'),_0x3be40c);return respondWithRpcPromise('Reload',_0x4e3f('0x1b'),{'module':'res_stun_monitor.so'});}else{var _0x1e9970=fs[_0x4e3f('0x40')](path[_0x4e3f('0x41')](config[_0x4e3f('0x49')],'server/files/templates/network.ejs'),'utf8');var _0x52eb7a=ejs[_0x4e3f('0x43')](_0x1e9970,{'networks':_0x17b76a||[]});fs[_0x4e3f('0x44')](util['format'](_0x4e3f('0x4f'),_0x574328[_0x4e3f('0x3e')][_0x4e3f('0x25')]['toLowerCase']()),_0x52eb7a);return respondWithRpcPromise('Reload',_0x4e3f('0x1b'),{'module':'chan_sip.so'});}})[_0x4e3f('0xa')](function(_0x12f705){if(_0x12f705){return _0x3df4cd;}return null;})[_0x4e3f('0xa')](respondWithResult(_0x1749cd,null))['catch'](handleError(_0x1749cd,null));};exports[_0x4e3f('0x1c')]=function(_0x297f1c,_0x55703e){var _0x16082f;return db[_0x4e3f('0x23')][_0x4e3f('0x3c')]({'where':{'id':_0x297f1c[_0x4e3f('0x3a')]['id']}})['then'](function(_0x4809a9){_0x16082f=_0x4809a9;return _0x4809a9;})[_0x4e3f('0xa')](handleEntityNotFound(_0x55703e,null))[_0x4e3f('0xa')](removeEntity(_0x55703e,null))[_0x4e3f('0xa')](function(){if(_0x16082f){return db['Network'][_0x4e3f('0x51')]({'where':{'type':_0x16082f[_0x4e3f('0x25')]},'raw':!![]});}})[_0x4e3f('0xa')](function(_0x5db2a0){if(_0x16082f[_0x4e3f('0x25')]['toUpperCase']()==_0x4e3f('0x3f')){var _0xb358c3=fs['readFileSync'](path[_0x4e3f('0x41')](config[_0x4e3f('0x49')],_0x4e3f('0x52')),_0x4e3f('0x42'));var _0x569d06=ejs[_0x4e3f('0x43')](_0xb358c3,{'networks':_0x5db2a0||[]});fs[_0x4e3f('0x44')]('/etc/asterisk/stun_xcally.conf',_0x569d06);return respondWithRpcPromise(_0x4e3f('0x46'),_0x4e3f('0x1c'),{'module':'res_stun_monitor.so'});}else if(_0x16082f[_0x4e3f('0x25')][_0x4e3f('0x47')]()==_0x4e3f('0x48')){var _0x2043eb=fs['readFileSync'](path[_0x4e3f('0x41')](config['root'],_0x4e3f('0x4a')),_0x4e3f('0x42'));var _0x3b0801=ejs[_0x4e3f('0x43')](_0x2043eb,{'networks':_0x5db2a0||[]});fs[_0x4e3f('0x44')]('/etc/asterisk/turn_xcally.conf',_0x3b0801);return respondWithRpcPromise(_0x4e3f('0x46'),_0x4e3f('0x1c'),{'module':_0x4e3f('0x4c')});}else{var _0x3c57b3=fs[_0x4e3f('0x40')](path[_0x4e3f('0x41')](config[_0x4e3f('0x49')],_0x4e3f('0x4d')),'utf8');var _0x22a110=ejs[_0x4e3f('0x43')](_0x3c57b3,{'networks':_0x5db2a0||[]});fs[_0x4e3f('0x44')](util[_0x4e3f('0x4e')](_0x4e3f('0x4f'),_0x16082f[_0x4e3f('0x25')][_0x4e3f('0x50')]()),_0x22a110);return respondWithRpcPromise(_0x4e3f('0x46'),_0x4e3f('0x1c'),{'module':_0x4e3f('0x53')});}})[_0x4e3f('0x13')](handleError(_0x55703e,null));}; \ No newline at end of file +var _0xe86e=['findAll','show','params','keys','find','create','body','readFileSync','join','server/files/templates/stun_multiple.ejs','utf8','writeFileSync','/etc/asterisk/stun_xcally.conf','toUpperCase','TURN','root','server/files/templates/turn_multiple.ejs','render','/etc/asterisk/turn_xcally.conf','Reload','server/files/templates/network.ejs','format','chan_sip.so','res_stun_monitor.so','/etc/asterisk/sip_xcally_%s.conf','STUN','destroy','util','ejs','lodash','jayson/promise','http','then','Network,\x20%s,\x20%s','debug','Network,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','status','json','offset','undefined','limit','count','Content-Range','update','end','sendStatus','stack','name','send','index','map','Network','rawAttributes','type','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe86e,0x10b));var _0xee86=function(_0x58ebd2,_0xefcf97){_0x58ebd2=_0x58ebd2-0x0;var _0x3b074e=_0xe86e[_0x58ebd2];return _0x3b074e;};'use strict';var util=require(_0xee86('0x0'));var path=require('path');var ejs=require(_0xee86('0x1'));var fs=require('fs');var _=require(_0xee86('0x2'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')('api');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var jayson=require(_0xee86('0x3'));var client=jayson['client'][_0xee86('0x4')]({'port':0x232a});function respondWithRpcPromise(_0x3032f0,_0x145be5,_0x3a10ba,_0x26066e){return new Promise(function(_0x20d054,_0x475898){var _0x1ab2ca=_0x26066e||client;return _0x1ab2ca['request'](_0x3032f0,_0x3a10ba)[_0xee86('0x5')](function(_0x34b119){logger['info'](_0xee86('0x6'),_0x145be5,'request\x20sent');logger[_0xee86('0x7')](_0xee86('0x8'),_0x145be5,_0xee86('0x9'),JSON[_0xee86('0xa')](_0x34b119));if(_0x34b119[_0xee86('0xb')]){if(_0x34b119['error']['code']===0x1f4){logger['error'](_0xee86('0x6'),_0x145be5,_0x34b119[_0xee86('0xb')][_0xee86('0xc')]);return _0x475898(_0x34b119[_0xee86('0xb')][_0xee86('0xc')]);}logger[_0xee86('0xb')]('Network,\x20%s,\x20%s',_0x145be5,_0x34b119[_0xee86('0xb')][_0xee86('0xc')]);return _0x20d054(_0x34b119[_0xee86('0xb')][_0xee86('0xc')]);}else{logger[_0xee86('0xd')](_0xee86('0x6'),_0x145be5,_0xee86('0x9'));_0x20d054(_0x34b119[_0xee86('0xe')][_0xee86('0xc')]);}})[_0xee86('0xf')](function(_0x23c2ff){logger[_0xee86('0xb')](_0xee86('0x6'),_0x145be5,_0x23c2ff);_0x475898(_0x23c2ff);});});}function respondWithResult(_0x339a1b,_0x15fd08){_0x15fd08=_0x15fd08||0xc8;return function(_0x222fd9){if(_0x222fd9){return _0x339a1b[_0xee86('0x10')](_0x15fd08)[_0xee86('0x11')](_0x222fd9);}};}function respondWithFilteredResult(_0x5d4611,_0x23b96b){return function(_0x2de099){if(_0x2de099){var _0x2c2242=typeof _0x23b96b[_0xee86('0x12')]===_0xee86('0x13')&&typeof _0x23b96b[_0xee86('0x14')]==='undefined';var _0x25c3ec=_0x2de099['count'];var _0x5135ad=_0x2c2242?0x0:_0x23b96b[_0xee86('0x12')];var _0x853da5=_0x2c2242?_0x2de099[_0xee86('0x15')]:_0x23b96b[_0xee86('0x12')]+_0x23b96b['limit'];var _0x3c7ff7;if(_0x853da5>=_0x25c3ec){_0x853da5=_0x25c3ec;_0x3c7ff7=0xc8;}else{_0x3c7ff7=0xce;}_0x5d4611[_0xee86('0x10')](_0x3c7ff7);return _0x5d4611['set'](_0xee86('0x16'),_0x5135ad+'-'+_0x853da5+'/'+_0x25c3ec)[_0xee86('0x11')](_0x2de099);}return null;};}function saveUpdates(_0x41526e){return function(_0x2a1784){if(_0x2a1784){return _0x2a1784[_0xee86('0x17')](_0x41526e)[_0xee86('0x5')](function(_0x233564){return _0x233564;});}return null;};}function removeEntity(_0x54614e){return function(_0x59a628){if(_0x59a628){return _0x59a628['destroy']()['then'](function(){_0x54614e['status'](0xcc)[_0xee86('0x18')]();});}};}function handleEntityNotFound(_0x368d29){return function(_0x515e64){if(!_0x515e64){_0x368d29[_0xee86('0x19')](0x194);}return _0x515e64;};}function handleError(_0x384d83,_0x14b63f){_0x14b63f=_0x14b63f||0x1f4;return function(_0x16272c){logger[_0xee86('0xb')](_0x16272c[_0xee86('0x1a')]);if(_0x16272c[_0xee86('0x1b')]){delete _0x16272c[_0xee86('0x1b')];}_0x384d83[_0xee86('0x10')](_0x14b63f)[_0xee86('0x1c')](_0x16272c);};}exports[_0xee86('0x1d')]=function(_0x3f72f4,_0x33e7f8){var _0x317a50={},_0x15042e={},_0x31d7bd={'count':0x0,'rows':[]};var _0x50049a=_[_0xee86('0x1e')](db[_0xee86('0x1f')][_0xee86('0x20')],function(_0x557665){return{'name':_0x557665['fieldName'],'type':_0x557665[_0xee86('0x21')]['key']};});_0x15042e['model']=_['map'](_0x50049a,'name');_0x15042e[_0xee86('0x22')]=_['keys'](_0x3f72f4[_0xee86('0x22')]);_0x15042e[_0xee86('0x23')]=_['intersection'](_0x15042e[_0xee86('0x24')],_0x15042e['query']);_0x317a50[_0xee86('0x25')]=_[_0xee86('0x26')](_0x15042e['model'],qs[_0xee86('0x27')](_0x3f72f4[_0xee86('0x22')][_0xee86('0x27')]));_0x317a50[_0xee86('0x25')]=_0x317a50[_0xee86('0x25')][_0xee86('0x28')]?_0x317a50[_0xee86('0x25')]:_0x15042e[_0xee86('0x24')];if(!_0x3f72f4[_0xee86('0x22')][_0xee86('0x29')](_0xee86('0x2a'))){_0x317a50[_0xee86('0x14')]=qs[_0xee86('0x14')](_0x3f72f4[_0xee86('0x22')][_0xee86('0x14')]);_0x317a50[_0xee86('0x12')]=qs[_0xee86('0x12')](_0x3f72f4[_0xee86('0x22')]['offset']);}_0x317a50[_0xee86('0x2b')]=qs[_0xee86('0x2c')](_0x3f72f4[_0xee86('0x22')][_0xee86('0x2c')]);_0x317a50[_0xee86('0x2d')]=qs[_0xee86('0x23')](_[_0xee86('0x2e')](_0x3f72f4[_0xee86('0x22')],_0x15042e[_0xee86('0x23')]),_0x50049a);if(_0x3f72f4['query']['filter']){_0x317a50[_0xee86('0x2d')]=_[_0xee86('0x2f')](_0x317a50[_0xee86('0x2d')],{'$or':_[_0xee86('0x1e')](_0x50049a,function(_0x3ee7fe){if(_0x3ee7fe[_0xee86('0x21')]!==_0xee86('0x30')){var _0x88ea2={};_0x88ea2[_0x3ee7fe[_0xee86('0x1b')]]={'$like':'%'+_0x3f72f4[_0xee86('0x22')][_0xee86('0x31')]+'%'};return _0x88ea2;}})});}_0x317a50=_['merge']({},_0x317a50,_0x3f72f4[_0xee86('0x32')]);var _0x1ee23d={'where':_0x317a50['where']};return db['Network'][_0xee86('0x15')](_0x1ee23d)[_0xee86('0x5')](function(_0x3d1128){_0x31d7bd[_0xee86('0x15')]=_0x3d1128;if(_0x3f72f4[_0xee86('0x22')][_0xee86('0x33')]){_0x317a50[_0xee86('0x34')]=[{'all':!![]}];}return db[_0xee86('0x1f')][_0xee86('0x35')](_0x317a50);})['then'](function(_0xd93676){_0x31d7bd['rows']=_0xd93676;return _0x31d7bd;})['then'](respondWithFilteredResult(_0x33e7f8,_0x317a50))[_0xee86('0xf')](handleError(_0x33e7f8,null));};exports[_0xee86('0x36')]=function(_0xbd133b,_0x2ffb99){var _0x385abd={'raw':!![],'where':{'id':_0xbd133b[_0xee86('0x37')]['id']}},_0xe0cfe={};_0xe0cfe['model']=_[_0xee86('0x38')](db[_0xee86('0x1f')][_0xee86('0x20')]);_0xe0cfe['query']=_[_0xee86('0x38')](_0xbd133b['query']);_0xe0cfe['filters']=_[_0xee86('0x26')](_0xe0cfe['model'],_0xe0cfe[_0xee86('0x22')]);_0x385abd[_0xee86('0x25')]=_[_0xee86('0x26')](_0xe0cfe[_0xee86('0x24')],qs[_0xee86('0x27')](_0xbd133b[_0xee86('0x22')]['fields']));_0x385abd[_0xee86('0x25')]=_0x385abd[_0xee86('0x25')]['length']?_0x385abd['attributes']:_0xe0cfe[_0xee86('0x24')];if(_0xbd133b['query'][_0xee86('0x33')]){_0x385abd[_0xee86('0x34')]=[{'all':!![]}];}_0x385abd=_[_0xee86('0x2f')]({},_0x385abd,_0xbd133b['options']);return db[_0xee86('0x1f')][_0xee86('0x39')](_0x385abd)[_0xee86('0x5')](handleEntityNotFound(_0x2ffb99,null))[_0xee86('0x5')](respondWithResult(_0x2ffb99,null))['catch'](handleError(_0x2ffb99,null));};exports[_0xee86('0x3a')]=function(_0x3b1cd5,_0x26a060){var _0x274094;return db[_0xee86('0x1f')][_0xee86('0x3a')](_0x3b1cd5[_0xee86('0x3b')],{'raw':!![]})[_0xee86('0x5')](function(_0x1f4084){_0x274094=_0x1f4084;return db[_0xee86('0x1f')][_0xee86('0x35')]({'where':{'type':_0x3b1cd5[_0xee86('0x3b')][_0xee86('0x21')]},'raw':!![]});})[_0xee86('0x5')](function(_0x37ee7b){if(_0x274094[_0xee86('0x21')]['toUpperCase']()=='STUN'){var _0xf7a00d=fs[_0xee86('0x3c')](path[_0xee86('0x3d')](config['root'],_0xee86('0x3e')),_0xee86('0x3f'));var _0x2cf29c=ejs['render'](_0xf7a00d,{'networks':_0x37ee7b||[]});fs[_0xee86('0x40')](_0xee86('0x41'),_0x2cf29c);return respondWithRpcPromise('Reload',_0xee86('0x3a'),{'module':'res_stun_monitor.so'});}else if(_0x274094[_0xee86('0x21')][_0xee86('0x42')]()==_0xee86('0x43')){var _0x4bdfcb=fs[_0xee86('0x3c')](path[_0xee86('0x3d')](config[_0xee86('0x44')],_0xee86('0x45')),_0xee86('0x3f'));var _0x51c8c0=ejs[_0xee86('0x46')](_0x4bdfcb,{'networks':_0x37ee7b||[]});fs[_0xee86('0x40')](_0xee86('0x47'),_0x51c8c0);return respondWithRpcPromise(_0xee86('0x48'),'create',{'module':'res_stun_monitor.so'});}else{var _0x244af8=fs['readFileSync'](path['join'](config[_0xee86('0x44')],_0xee86('0x49')),_0xee86('0x3f'));var _0x3c8b44=ejs[_0xee86('0x46')](_0x244af8,{'networks':_0x37ee7b||[]});fs['writeFileSync'](util[_0xee86('0x4a')]('/etc/asterisk/sip_xcally_%s.conf',_0x3b1cd5['body']['type']['toLowerCase']()),_0x3c8b44);return respondWithRpcPromise(_0xee86('0x48'),'create',{'module':_0xee86('0x4b')});}})[_0xee86('0x5')](function(){return _0x274094;})['then'](respondWithResult(_0x26a060,0xc9))[_0xee86('0xf')](handleError(_0x26a060,null));};exports[_0xee86('0x17')]=function(_0x533d8b,_0x3d6639){var _0x255c97;return db['Network'][_0xee86('0x39')]({'where':{'id':_0x533d8b[_0xee86('0x37')]['id']}})[_0xee86('0x5')](handleEntityNotFound(_0x3d6639,null))[_0xee86('0x5')](saveUpdates(_0x533d8b[_0xee86('0x3b')],null))['then'](function(_0x313af2){if(_0x313af2){_0x255c97=_0x313af2;return db[_0xee86('0x1f')][_0xee86('0x35')]({'where':{'type':_0x255c97[_0xee86('0x21')]},'raw':!![]});}return null;})[_0xee86('0x5')](function(_0x8ffb79){if(_0x255c97[_0xee86('0x21')][_0xee86('0x42')]()=='STUN'){var _0x2feb58=fs['readFileSync'](path[_0xee86('0x3d')](config[_0xee86('0x44')],_0xee86('0x3e')),_0xee86('0x3f'));var _0xac510b=ejs[_0xee86('0x46')](_0x2feb58,{'networks':_0x8ffb79||[]});fs[_0xee86('0x40')](_0xee86('0x41'),_0xac510b);return respondWithRpcPromise('Reload',_0xee86('0x17'),{'module':_0xee86('0x4c')});}else if(_0x255c97[_0xee86('0x21')][_0xee86('0x42')]()==_0xee86('0x43')){var _0x5cf156=fs['readFileSync'](path['join'](config[_0xee86('0x44')],_0xee86('0x45')),_0xee86('0x3f'));var _0x5ee565=ejs[_0xee86('0x46')](_0x5cf156,{'networks':_0x8ffb79||[]});fs[_0xee86('0x40')](_0xee86('0x47'),_0x5ee565);return respondWithRpcPromise(_0xee86('0x48'),_0xee86('0x17'),{'module':_0xee86('0x4c')});}else{var _0x32cbfe=fs[_0xee86('0x3c')](path[_0xee86('0x3d')](config[_0xee86('0x44')],_0xee86('0x49')),_0xee86('0x3f'));var _0x5a34ef=ejs[_0xee86('0x46')](_0x32cbfe,{'networks':_0x8ffb79||[]});fs['writeFileSync'](util[_0xee86('0x4a')](_0xee86('0x4d'),_0x533d8b['body'][_0xee86('0x21')]['toLowerCase']()),_0x5a34ef);return respondWithRpcPromise(_0xee86('0x48'),_0xee86('0x17'),{'module':_0xee86('0x4b')});}})[_0xee86('0x5')](function(_0x1b3dfd){if(_0x1b3dfd){return _0x255c97;}return null;})['then'](respondWithResult(_0x3d6639,null))[_0xee86('0xf')](handleError(_0x3d6639,null));};exports['destroy']=function(_0x5b8e01,_0x38ad3b){var _0x1491d5;return db['Network'][_0xee86('0x39')]({'where':{'id':_0x5b8e01[_0xee86('0x37')]['id']}})[_0xee86('0x5')](function(_0x4cb8f2){_0x1491d5=_0x4cb8f2;return _0x4cb8f2;})[_0xee86('0x5')](handleEntityNotFound(_0x38ad3b,null))[_0xee86('0x5')](removeEntity(_0x38ad3b,null))['then'](function(){if(_0x1491d5){return db[_0xee86('0x1f')][_0xee86('0x35')]({'where':{'type':_0x1491d5[_0xee86('0x21')]},'raw':!![]});}})[_0xee86('0x5')](function(_0x3a99ad){if(_0x1491d5[_0xee86('0x21')][_0xee86('0x42')]()==_0xee86('0x4e')){var _0x298569=fs['readFileSync'](path[_0xee86('0x3d')](config['root'],_0xee86('0x3e')),_0xee86('0x3f'));var _0x1ece66=ejs[_0xee86('0x46')](_0x298569,{'networks':_0x3a99ad||[]});fs['writeFileSync']('/etc/asterisk/stun_xcally.conf',_0x1ece66);return respondWithRpcPromise(_0xee86('0x48'),_0xee86('0x4f'),{'module':_0xee86('0x4c')});}else if(_0x1491d5[_0xee86('0x21')][_0xee86('0x42')]()=='TURN'){var _0x22627b=fs[_0xee86('0x3c')](path['join'](config['root'],'server/files/templates/turn_multiple.ejs'),_0xee86('0x3f'));var _0x395657=ejs['render'](_0x22627b,{'networks':_0x3a99ad||[]});fs[_0xee86('0x40')]('/etc/asterisk/turn_xcally.conf',_0x395657);return respondWithRpcPromise(_0xee86('0x48'),_0xee86('0x4f'),{'module':'res_stun_monitor.so'});}else{var _0x37bf0f=fs['readFileSync'](path[_0xee86('0x3d')](config['root'],_0xee86('0x49')),_0xee86('0x3f'));var _0x5ce68c=ejs[_0xee86('0x46')](_0x37bf0f,{'networks':_0x3a99ad||[]});fs[_0xee86('0x40')](util['format']('/etc/asterisk/sip_xcally_%s.conf',_0x1491d5[_0xee86('0x21')]['toLowerCase']()),_0x5ce68c);return respondWithRpcPromise(_0xee86('0x48'),_0xee86('0x4f'),{'module':_0xee86('0x4b')});}})[_0xee86('0xf')](handleError(_0x38ad3b,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index ca5f344..89b65ce 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 _0xa902=['../../config/logger','api','moment','request-promise','../../config/environment','./network.attributes','exports','define','network','lodash','util'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0xa902,0x8d));var _0x2a90=function(_0xdaffc7,_0x453662){_0xdaffc7=_0xdaffc7-0x0;var _0x503d65=_0xa902[_0xdaffc7];return _0x503d65;};'use strict';var _=require(_0x2a90('0x0'));var util=require(_0x2a90('0x1'));var logger=require(_0x2a90('0x2'))(_0x2a90('0x3'));var moment=require(_0x2a90('0x4'));var BPromise=require('bluebird');var rp=require(_0x2a90('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2a90('0x6'));var attributes=require(_0x2a90('0x7'));module[_0x2a90('0x8')]=function(_0x21e1d2,_0x4a32c7){return _0x21e1d2[_0x2a90('0x9')]('Network',attributes,{'tableName':_0x2a90('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x37f8=['Network','network','util','../../config/logger','api','moment','request-promise','define'];(function(_0x10e5ec,_0x3568bb){var _0x19b8ce=function(_0xe6660c){while(--_0xe6660c){_0x10e5ec['push'](_0x10e5ec['shift']());}};_0x19b8ce(++_0x3568bb);}(_0x37f8,0xd2));var _0x837f=function(_0x415c7a,_0x95e6c7){_0x415c7a=_0x415c7a-0x0;var _0x207b3f=_0x37f8[_0x415c7a];return _0x207b3f;};'use strict';var _=require('lodash');var util=require(_0x837f('0x0'));var logger=require(_0x837f('0x1'))(_0x837f('0x2'));var moment=require(_0x837f('0x3'));var BPromise=require('bluebird');var rp=require(_0x837f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./network.attributes');module['exports']=function(_0x19c939,_0x42986f){return _0x19c939[_0x837f('0x5')](_0x837f('0x6'),attributes,{'tableName':_0x837f('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/network/network.rpc.js b/server/api/network/network.rpc.js index d3db068..5de8c54 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(_0xc7674a,_0x39a38a){var _0x153dad=function(_0x5ad75f){while(--_0x5ad75f){_0xc7674a['push'](_0xc7674a['shift']());}};_0x153dad(++_0x39a38a);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var 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(_0x37ce9a,_0x2051f3){var _0x41c7cc=function(_0x3ddf45){while(--_0x3ddf45){_0x37ce9a['push'](_0x37ce9a['shift']());}};_0x41c7cc(++_0x2051f3);}(_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 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 6f4068e..42c4ad6 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 _0xa057=['addApplications','/:id/send','send','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','isAuthenticated','get','/describe','describe','/:id','show','/:id/canned_answers','/:id/applications','getApplications','getInteractions','/:id/users','getAgents','post','/:id/dispositions','addDisposition','addAnswer','/:id/notify','notify'];(function(_0x1573ea,_0x434f02){var _0x51c0e2=function(_0x5c9b28){while(--_0x5c9b28){_0x1573ea['push'](_0x1573ea['shift']());}};_0x51c0e2(++_0x434f02);}(_0xa057,0x1a2));var _0x7a05=function(_0xe871b2,_0x3c3be5){_0xe871b2=_0xe871b2-0x0;var _0x3e5d4=_0xa057[_0xe871b2];return _0x3e5d4;};'use strict';var multer=require('multer');var util=require(_0x7a05('0x0'));var path=require('path');var timeout=require(_0x7a05('0x1'));var express=require(_0x7a05('0x2'));var router=express[_0x7a05('0x3')]();var fs_extra=require(_0x7a05('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x7a05('0x5'));var config=require(_0x7a05('0x6'));var controller=require(_0x7a05('0x7'));router['get']('/',auth[_0x7a05('0x8')](),controller['index']);router[_0x7a05('0x9')](_0x7a05('0xa'),auth[_0x7a05('0x8')](),controller[_0x7a05('0xb')]);router[_0x7a05('0x9')](_0x7a05('0xc'),auth['isAuthenticated'](),controller[_0x7a05('0xd')]);router[_0x7a05('0x9')]('/:id/dispositions',auth[_0x7a05('0x8')](),controller['getDispositions']);router[_0x7a05('0x9')](_0x7a05('0xe'),auth[_0x7a05('0x8')](),controller['getAnswers']);router[_0x7a05('0x9')](_0x7a05('0xf'),auth[_0x7a05('0x8')](),controller[_0x7a05('0x10')]);router[_0x7a05('0x9')]('/:id/interactions',auth[_0x7a05('0x8')](),controller[_0x7a05('0x11')]);router[_0x7a05('0x9')](_0x7a05('0x12'),auth[_0x7a05('0x8')](),controller[_0x7a05('0x13')]);router[_0x7a05('0x14')]('/',auth[_0x7a05('0x8')](),controller['create']);router['post'](_0x7a05('0x15'),auth[_0x7a05('0x8')](),controller[_0x7a05('0x16')]);router[_0x7a05('0x14')](_0x7a05('0xe'),auth[_0x7a05('0x8')](),controller[_0x7a05('0x17')]);router[_0x7a05('0x14')](_0x7a05('0x18'),controller[_0x7a05('0x19')]);router[_0x7a05('0x14')]('/:id/applications',auth[_0x7a05('0x8')](),controller[_0x7a05('0x1a')]);router[_0x7a05('0x14')](_0x7a05('0x12'),auth[_0x7a05('0x8')](),controller['addAgents']);router[_0x7a05('0x14')](_0x7a05('0x1b'),auth['isAuthenticated'](),controller[_0x7a05('0x1c')]);router[_0x7a05('0x1d')](_0x7a05('0xc'),auth[_0x7a05('0x8')](),controller[_0x7a05('0x1e')]);router[_0x7a05('0x1f')](_0x7a05('0xc'),auth[_0x7a05('0x8')](),controller[_0x7a05('0x20')]);router['delete'](_0x7a05('0x15'),auth[_0x7a05('0x8')](),controller[_0x7a05('0x21')]);router['delete'](_0x7a05('0xe'),auth['isAuthenticated'](),controller[_0x7a05('0x22')]);router[_0x7a05('0x1f')](_0x7a05('0x12'),auth[_0x7a05('0x8')](),controller[_0x7a05('0x23')]);module[_0x7a05('0x24')]=router; \ No newline at end of file +var _0x4460=['../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','getApplications','/:id/interactions','getInteractions','getAgents','post','create','addDisposition','addAnswer','/:id/notify','notify','/:id/applications','addApplications','/:id/users','addAgents','send','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','Router','fs-extra','../../components/auth/service'];(function(_0x53c256,_0x382a24){var _0x25feb6=function(_0x2652fd){while(--_0x2652fd){_0x53c256['push'](_0x53c256['shift']());}};_0x25feb6(++_0x382a24);}(_0x4460,0x19e));var _0x0446=function(_0x49f35f,_0x5add21){_0x49f35f=_0x49f35f-0x0;var _0x317e9c=_0x4460[_0x49f35f];return _0x317e9c;};'use strict';var multer=require(_0x0446('0x0'));var util=require(_0x0446('0x1'));var path=require(_0x0446('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0446('0x3')]();var fs_extra=require(_0x0446('0x4'));var auth=require(_0x0446('0x5'));var interaction=require(_0x0446('0x6'));var config=require(_0x0446('0x7'));var controller=require(_0x0446('0x8'));router[_0x0446('0x9')]('/',auth[_0x0446('0xa')](),controller[_0x0446('0xb')]);router[_0x0446('0x9')](_0x0446('0xc'),auth[_0x0446('0xa')](),controller[_0x0446('0xd')]);router[_0x0446('0x9')](_0x0446('0xe'),auth[_0x0446('0xa')](),controller[_0x0446('0xf')]);router[_0x0446('0x9')](_0x0446('0x10'),auth[_0x0446('0xa')](),controller['getDispositions']);router[_0x0446('0x9')](_0x0446('0x11'),auth[_0x0446('0xa')](),controller[_0x0446('0x12')]);router[_0x0446('0x9')]('/:id/applications',auth['isAuthenticated'](),controller[_0x0446('0x13')]);router[_0x0446('0x9')](_0x0446('0x14'),auth[_0x0446('0xa')](),controller[_0x0446('0x15')]);router[_0x0446('0x9')]('/:id/users',auth[_0x0446('0xa')](),controller[_0x0446('0x16')]);router[_0x0446('0x17')]('/',auth[_0x0446('0xa')](),controller[_0x0446('0x18')]);router[_0x0446('0x17')](_0x0446('0x10'),auth['isAuthenticated'](),controller[_0x0446('0x19')]);router['post']('/:id/canned_answers',auth[_0x0446('0xa')](),controller[_0x0446('0x1a')]);router['post'](_0x0446('0x1b'),controller[_0x0446('0x1c')]);router[_0x0446('0x17')](_0x0446('0x1d'),auth['isAuthenticated'](),controller[_0x0446('0x1e')]);router[_0x0446('0x17')](_0x0446('0x1f'),auth[_0x0446('0xa')](),controller[_0x0446('0x20')]);router['post']('/:id/send',auth[_0x0446('0xa')](),controller[_0x0446('0x21')]);router[_0x0446('0x22')](_0x0446('0xe'),auth[_0x0446('0xa')](),controller[_0x0446('0x23')]);router[_0x0446('0x24')](_0x0446('0xe'),auth[_0x0446('0xa')](),controller[_0x0446('0x25')]);router[_0x0446('0x24')]('/:id/dispositions',auth[_0x0446('0xa')](),controller[_0x0446('0x26')]);router['delete'](_0x0446('0x11'),auth[_0x0446('0xa')](),controller[_0x0446('0x27')]);router[_0x0446('0x24')]('/:id/users',auth['isAuthenticated'](),controller[_0x0446('0x28')]);module[_0x0446('0x29')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 5a65f94..bcb0a9f 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 _0x4efb=['BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','exports','STRING','name','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}'];(function(_0x387dc1,_0x3ba649){var _0x17567c=function(_0x4690aa){while(--_0x4690aa){_0x387dc1['push'](_0x387dc1['shift']());}};_0x17567c(++_0x3ba649);}(_0x4efb,0x69));var _0xb4ef=function(_0x262a93,_0x48f4a2){_0x262a93=_0x262a93-0x0;var _0x23309e=_0x4efb[_0x262a93];return _0x23309e;};'use strict';var Sequelize=require(_0xb4ef('0x0'));var rs=require('randomstring');module[_0xb4ef('0x1')]={'name':{'type':Sequelize[_0xb4ef('0x2')],'unique':_0xb4ef('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0xb4ef('0x2')],'defaultValue':function(){return rs[_0xb4ef('0x4')]();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xb4ef('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xb4ef('0x5')],'defaultValue':function(){return _0xb4ef('0x6');}},'notificationSound':{'type':Sequelize[_0xb4ef('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xb4ef('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xb4ef('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xb4ef('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize[_0xb4ef('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xb4ef('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xb4ef('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xb4ef('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xb4ef('0x8')],'allowNull':!![],'defaultValue':null,'comment':_0xb4ef('0x9')},'mandatoryDisposition':{'type':Sequelize[_0xb4ef('0x7')],'defaultValue':![],'comment':_0xb4ef('0xa'),'set':function(_0x3f8b1f){if(!_0x3f8b1f)this['setDataValue'](_0xb4ef('0xb'),null);this[_0xb4ef('0xc')](_0xb4ef('0xd'),_0x3f8b1f);}}}; \ No newline at end of file +var _0x53c1=['Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','randomstring','STRING','name','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER'];(function(_0x3bda9b,_0x4fbd5b){var _0x114de4=function(_0x539c88){while(--_0x539c88){_0x3bda9b['push'](_0x3bda9b['shift']());}};_0x114de4(++_0x4fbd5b);}(_0x53c1,0x1d9));var _0x153c=function(_0x5e37ef,_0x5f4ef3){_0x5e37ef=_0x5e37ef-0x0;var _0x47196c=_0x53c1[_0x5e37ef];return _0x47196c;};'use strict';var Sequelize=require(_0x153c('0x0'));var rs=require(_0x153c('0x1'));module['exports']={'name':{'type':Sequelize[_0x153c('0x2')],'unique':_0x153c('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x153c('0x2')]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize[_0x153c('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x153c('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x153c('0x4')],'defaultValue':function(){return _0x153c('0x5');}},'notificationSound':{'type':Sequelize[_0x153c('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x153c('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x153c('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize[_0x153c('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x153c('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x153c('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x153c('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x153c('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0x153c('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x153c('0x6')],'defaultValue':![],'comment':_0x153c('0x9'),'set':function(_0x2d8fea){if(!_0x2d8fea)this['setDataValue'](_0x153c('0xa'),null);this[_0x153c('0xb')](_0x153c('0xc'),_0x2d8fea);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 7589c33..0e7e433 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 _0x44c2=['CmContact','Contacts','DESC','Applications','account','applications','list','orderBy','priority','defaults','contact','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','firstName','lastName','messageId','interaction','created','autoclose','push','close','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','queueId','OpenchannelQueue','queue','waitForTheAssignedQueue','startRouting','EventManager','addApplications','transaction','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','OpenchannelApplication','bulkCreate','findAndCountAll','finally','getApplications','getInteractions','Owner','fullname','internal','Tag','color','tag','addAgents','emit','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','out','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','fs-extra','squel','desk.js','to-csv','papaparse','../../components/parsers/qs','../../config/license/hardware','api','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','http','request','then','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','end','status','json','limit','undefined','count','offset','set','Content-Range','apply','save','update','destroy','get','OpenchannelAccounts','UserProfileResource','sendStatus','stack','name','send','index','Pause','mandatoryDispositionPause','OpenchannelAccount','rawAttributes','fieldName','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','options','includeAll','include','rows','show','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','describe','addDisposition','Disposition','getDispositions','findOne','OpenchannelAccountId','findAll','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','notify','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','isNil','from','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List'];(function(_0x32ce9a,_0x2a9ab5){var _0x648d8d=function(_0x13654d){while(--_0x13654d){_0x32ce9a['push'](_0x32ce9a['shift']());}};_0x648d8d(++_0x2a9ab5);}(_0x44c2,0x100));var _0x244c=function(_0x39fd11,_0x5d7883){_0x39fd11=_0x39fd11-0x0;var _0x302799=_0x44c2[_0x39fd11];return _0x302799;};'use strict';var emlformat=require(_0x244c('0x0'));var rimraf=require(_0x244c('0x1'));var zipdir=require(_0x244c('0x2'));var jsonpatch=require(_0x244c('0x3'));var rp=require('request-promise');var moment=require(_0x244c('0x4'));var BPromise=require(_0x244c('0x5'));var Mustache=require(_0x244c('0x6'));var util=require(_0x244c('0x7'));var path=require(_0x244c('0x8'));var sox=require(_0x244c('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x244c('0xa'));var _=require('lodash');var squel=require(_0x244c('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x244c('0xc'));var toCsv=require(_0x244c('0xd'));var querystring=require('querystring');var Papa=require(_0x244c('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x244c('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x244c('0x10'));var logger=require('../../config/logger')(_0x244c('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x244c('0x12'));var db=require(_0x244c('0x13'))['db'];config[_0x244c('0x14')]=_['defaults'](config[_0x244c('0x14')],{'host':_0x244c('0x15'),'port':0x18eb});var socket=require(_0x244c('0x16'))(new Redis(config[_0x244c('0x14')]));require(_0x244c('0x17'))[_0x244c('0x18')](socket);var jayson=require(_0x244c('0x19'));var client=jayson['client'][_0x244c('0x1a')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x151f1f,_0x94e7a4,_0x2773e7,_0x31beaa){return new BPromise(function(_0x5f2a11,_0x2948a8){var _0xe98b9b=_0x31beaa||client;return _0xe98b9b[_0x244c('0x1b')](_0x151f1f,_0x2773e7)[_0x244c('0x1c')](function(_0x1ba203){logger['info'](_0x244c('0x1d'),_0x94e7a4,_0x244c('0x1e'));logger[_0x244c('0x1f')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x94e7a4,'request\x20sent',JSON['stringify'](_0x1ba203));if(_0x1ba203[_0x244c('0x20')]){if(_0x1ba203[_0x244c('0x20')][_0x244c('0x21')]===0x1f4){logger[_0x244c('0x20')](_0x244c('0x1d'),_0x94e7a4,_0x1ba203[_0x244c('0x20')]['message']);return _0x2948a8(_0x1ba203[_0x244c('0x20')][_0x244c('0x22')]);}logger[_0x244c('0x20')]('OpenchannelAccount,\x20%s,\x20%s',_0x94e7a4,_0x1ba203[_0x244c('0x20')]['message']);return _0x5f2a11(_0x1ba203['error'][_0x244c('0x22')]);}else{logger[_0x244c('0x23')]('OpenchannelAccount,\x20%s,\x20%s',_0x94e7a4,_0x244c('0x1e'));_0x5f2a11(_0x1ba203[_0x244c('0x24')][_0x244c('0x22')]);}})[_0x244c('0x25')](function(_0x54b7ae){logger[_0x244c('0x20')](_0x244c('0x1d'),_0x94e7a4,_0x54b7ae);_0x2948a8(_0x54b7ae);});});}function respondWithStatusCode(_0x227c53,_0x1616cf){_0x1616cf=_0x1616cf||0xcc;return function(_0x40adde){if(_0x40adde){return _0x227c53['sendStatus'](_0x1616cf);}return _0x227c53['status'](_0x1616cf)[_0x244c('0x26')]();};}function respondWithResult(_0x2f35a5,_0x193c50){_0x193c50=_0x193c50||0xc8;return function(_0x2e1bfc){if(_0x2e1bfc){return _0x2f35a5[_0x244c('0x27')](_0x193c50)[_0x244c('0x28')](_0x2e1bfc);}};}function respondWithFilteredResult(_0x301111,_0x3f9b84){return function(_0x2ad9e3){if(_0x2ad9e3){var _0x3dc983=typeof _0x3f9b84['offset']==='undefined'&&typeof _0x3f9b84[_0x244c('0x29')]===_0x244c('0x2a');var _0x41352b=_0x2ad9e3[_0x244c('0x2b')];var _0xf82c11=_0x3dc983?0x0:_0x3f9b84[_0x244c('0x2c')];var _0x53d882=_0x3dc983?_0x2ad9e3[_0x244c('0x2b')]:_0x3f9b84[_0x244c('0x2c')]+_0x3f9b84[_0x244c('0x29')];var _0x14a176;if(_0x53d882>=_0x41352b){_0x53d882=_0x41352b;_0x14a176=0xc8;}else{_0x14a176=0xce;}_0x301111[_0x244c('0x27')](_0x14a176);return _0x301111[_0x244c('0x2d')](_0x244c('0x2e'),_0xf82c11+'-'+_0x53d882+'/'+_0x41352b)[_0x244c('0x28')](_0x2ad9e3);}return null;};}function patchUpdates(_0x15aeaf){return function(_0x349152){try{jsonpatch[_0x244c('0x2f')](_0x349152,_0x15aeaf,!![]);}catch(_0x17f62a){return BPromise['reject'](_0x17f62a);}return _0x349152[_0x244c('0x30')]();};}function saveUpdates(_0x413d04,_0x38da69){return function(_0x34e898){if(_0x34e898){return _0x34e898[_0x244c('0x31')](_0x413d04)[_0x244c('0x1c')](function(_0x63e0a3){return _0x63e0a3;});}return null;};}function removeEntity(_0x18e3a6,_0x53f9cd){return function(_0x2e6a88){if(_0x2e6a88){return _0x2e6a88[_0x244c('0x32')]()['then'](function(){var _0x3025a4=_0x2e6a88[_0x244c('0x33')]({'plain':!![]});var _0x253d0b=_0x244c('0x34');return db[_0x244c('0x35')][_0x244c('0x32')]({'where':{'type':_0x253d0b,'resourceId':_0x3025a4['id']}})[_0x244c('0x1c')](function(){return _0x2e6a88;});})[_0x244c('0x1c')](function(){_0x18e3a6[_0x244c('0x27')](0xcc)[_0x244c('0x26')]();});}};}function handleEntityNotFound(_0x5e0827,_0x2fd6f4){return function(_0x1a32c8){if(!_0x1a32c8){_0x5e0827[_0x244c('0x36')](0x194);}return _0x1a32c8;};}function handleError(_0x302f9e,_0x199dae){_0x199dae=_0x199dae||0x1f4;return function(_0x491f85){logger['error'](_0x491f85[_0x244c('0x37')]);if(_0x491f85['name']){delete _0x491f85[_0x244c('0x38')];}_0x302f9e[_0x244c('0x27')](_0x199dae)[_0x244c('0x39')](_0x491f85);};}exports[_0x244c('0x3a')]=function(_0x1c69ab,_0x3f52ce){var _0x49bff7={'include':[{'model':db[_0x244c('0x3b')],'as':_0x244c('0x3c')}]},_0x58ba1e={},_0x320272={'count':0x0,'rows':[]};var _0x16c2d9=_['map'](db[_0x244c('0x3d')][_0x244c('0x3e')],function(_0x576d33){return{'name':_0x576d33[_0x244c('0x3f')],'type':_0x576d33['type'][_0x244c('0x40')]};});_0x58ba1e[_0x244c('0x41')]=_[_0x244c('0x42')](_0x16c2d9,_0x244c('0x38'));_0x58ba1e['query']=_['keys'](_0x1c69ab[_0x244c('0x43')]);_0x58ba1e['filters']=_[_0x244c('0x44')](_0x58ba1e[_0x244c('0x41')],_0x58ba1e[_0x244c('0x43')]);_0x49bff7[_0x244c('0x45')]=_[_0x244c('0x44')](_0x58ba1e[_0x244c('0x41')],qs[_0x244c('0x46')](_0x1c69ab['query'][_0x244c('0x46')]));_0x49bff7[_0x244c('0x45')]=_0x49bff7[_0x244c('0x45')][_0x244c('0x47')]?_0x49bff7[_0x244c('0x45')]:_0x58ba1e[_0x244c('0x41')];if(!_0x1c69ab[_0x244c('0x43')][_0x244c('0x48')](_0x244c('0x49'))){_0x49bff7[_0x244c('0x29')]=qs[_0x244c('0x29')](_0x1c69ab[_0x244c('0x43')][_0x244c('0x29')]);_0x49bff7[_0x244c('0x2c')]=qs[_0x244c('0x2c')](_0x1c69ab[_0x244c('0x43')][_0x244c('0x2c')]);}_0x49bff7[_0x244c('0x4a')]=qs[_0x244c('0x4b')](_0x1c69ab['query']['sort']);_0x49bff7[_0x244c('0x4c')]=qs[_0x244c('0x4d')](_[_0x244c('0x4e')](_0x1c69ab[_0x244c('0x43')],_0x58ba1e['filters']),_0x16c2d9);if(_0x1c69ab[_0x244c('0x43')][_0x244c('0x4f')]){_0x49bff7[_0x244c('0x4c')]=_[_0x244c('0x50')](_0x49bff7[_0x244c('0x4c')],{'$or':_[_0x244c('0x42')](_0x16c2d9,function(_0x886278){if(_0x886278[_0x244c('0x51')]!=='VIRTUAL'){var _0x88a54b={};_0x88a54b[_0x886278['name']]={'$like':'%'+_0x1c69ab[_0x244c('0x43')][_0x244c('0x4f')]+'%'};return _0x88a54b;}})});}_0x49bff7=_['merge']({},_0x49bff7,_0x1c69ab[_0x244c('0x52')]);var _0x21c9e9={'where':_0x49bff7[_0x244c('0x4c')]};return db[_0x244c('0x3d')]['count'](_0x21c9e9)[_0x244c('0x1c')](function(_0x25ad2a){_0x320272[_0x244c('0x2b')]=_0x25ad2a;if(_0x1c69ab[_0x244c('0x43')][_0x244c('0x53')]){_0x49bff7[_0x244c('0x54')]=[{'all':!![]}];}return db['OpenchannelAccount']['findAll'](_0x49bff7);})[_0x244c('0x1c')](function(_0x12bd0a){_0x320272[_0x244c('0x55')]=_0x12bd0a;return _0x320272;})[_0x244c('0x1c')](respondWithFilteredResult(_0x3f52ce,_0x49bff7))[_0x244c('0x25')](handleError(_0x3f52ce,null));};exports[_0x244c('0x56')]=function(_0x10676c,_0x2cee0d){var _0x13e864={'raw':![],'where':{'id':_0x10676c[_0x244c('0x57')]['id']},'include':[{'model':db[_0x244c('0x3b')],'as':_0x244c('0x3c')}]},_0x139258={};_0x139258['model']=_[_0x244c('0x58')](db[_0x244c('0x3d')]['rawAttributes']);_0x139258['query']=_['keys'](_0x10676c[_0x244c('0x43')]);_0x139258['filters']=_[_0x244c('0x44')](_0x139258[_0x244c('0x41')],_0x139258[_0x244c('0x43')]);_0x13e864[_0x244c('0x45')]=_['intersection'](_0x139258[_0x244c('0x41')],qs[_0x244c('0x46')](_0x10676c[_0x244c('0x43')][_0x244c('0x46')]));_0x13e864[_0x244c('0x45')]=_0x13e864[_0x244c('0x45')][_0x244c('0x47')]?_0x13e864['attributes']:_0x139258[_0x244c('0x41')];if(_0x10676c[_0x244c('0x43')][_0x244c('0x53')]){_0x13e864[_0x244c('0x54')]=[{'all':!![]}];}_0x13e864=_[_0x244c('0x50')]({},_0x13e864,_0x10676c[_0x244c('0x52')]);return db[_0x244c('0x3d')][_0x244c('0x59')](_0x13e864)['then'](handleEntityNotFound(_0x2cee0d,null))[_0x244c('0x1c')](respondWithResult(_0x2cee0d,null))[_0x244c('0x25')](handleError(_0x2cee0d,null));};exports['create']=function(_0x577765,_0x26999b){return db[_0x244c('0x3d')][_0x244c('0x5a')](_0x577765[_0x244c('0x5b')],{})[_0x244c('0x1c')](function(_0x3bb0a3){var _0x4eb8ff=_0x577765[_0x244c('0x5c')][_0x244c('0x33')]({'plain':!![]});if(!_0x4eb8ff)throw new Error(_0x244c('0x5d'));if(_0x4eb8ff['role']==='user'){var _0x38da50=_0x3bb0a3['get']({'plain':!![]});var _0x33ecce=_0x244c('0x34');return db[_0x244c('0x5e')][_0x244c('0x59')]({'where':{'name':_0x33ecce,'userProfileId':_0x4eb8ff[_0x244c('0x5f')]},'raw':!![]})[_0x244c('0x1c')](function(_0x525e21){if(_0x525e21&&_0x525e21[_0x244c('0x60')]===0x0){return db[_0x244c('0x35')][_0x244c('0x5a')]({'name':_0x38da50[_0x244c('0x38')],'resourceId':_0x38da50['id'],'type':_0x525e21[_0x244c('0x38')],'sectionId':_0x525e21['id']},{})['then'](function(){return _0x3bb0a3;});}else{return _0x3bb0a3;}})[_0x244c('0x25')](function(_0x460f84){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x460f84);throw _0x460f84;});}return _0x3bb0a3;})[_0x244c('0x1c')](respondWithResult(_0x26999b,0xc9))[_0x244c('0x25')](handleError(_0x26999b,null));};exports[_0x244c('0x31')]=function(_0x3d0148,_0x45d1d6){if(_0x3d0148[_0x244c('0x5b')]['id']){delete _0x3d0148[_0x244c('0x5b')]['id'];}return db[_0x244c('0x3d')][_0x244c('0x59')]({'where':{'id':_0x3d0148[_0x244c('0x57')]['id']},'include':[{'model':db[_0x244c('0x3b')],'as':'mandatoryDispositionPause'}]})[_0x244c('0x1c')](handleEntityNotFound(_0x45d1d6,null))[_0x244c('0x1c')](saveUpdates(_0x3d0148['body'],null))['then'](respondWithResult(_0x45d1d6,null))[_0x244c('0x25')](handleError(_0x45d1d6,null));};exports[_0x244c('0x32')]=function(_0xbce298,_0x4a1232){return db[_0x244c('0x3d')]['find']({'where':{'id':_0xbce298[_0x244c('0x57')]['id']}})[_0x244c('0x1c')](handleEntityNotFound(_0x4a1232,null))[_0x244c('0x1c')](removeEntity(_0x4a1232,null))[_0x244c('0x25')](handleError(_0x4a1232,null));};exports[_0x244c('0x61')]=function(_0x1283b4,_0x121f10){return db[_0x244c('0x3d')]['describe']()[_0x244c('0x1c')](respondWithResult(_0x121f10,null))['catch'](handleError(_0x121f10,null));};exports[_0x244c('0x62')]=function(_0x44ccdb,_0x1b79cb,_0x11fa6a){if(_0x44ccdb[_0x244c('0x5b')]['id']){delete _0x44ccdb[_0x244c('0x5b')]['id'];}return db['OpenchannelAccount'][_0x244c('0x59')]({'where':{'id':_0x44ccdb['params']['id']}})[_0x244c('0x1c')](handleEntityNotFound(_0x1b79cb,null))[_0x244c('0x1c')](function(_0x50c0d0){if(_0x50c0d0){_0x44ccdb['body']['OpenchannelAccountId']=_0x50c0d0['id'];return db[_0x244c('0x63')][_0x244c('0x5a')](_0x44ccdb[_0x244c('0x5b')]);}})[_0x244c('0x1c')](respondWithResult(_0x1b79cb,null))['catch'](handleError(_0x1b79cb,null));};exports[_0x244c('0x64')]=function(_0x3e306d,_0x519b61,_0x14f922){var _0x549fa8={'raw':![],'where':{}};var _0x2800e6={};var _0x270e29={'count':0x0,'rows':[]};return db[_0x244c('0x3d')][_0x244c('0x65')]({'where':{'id':_0x3e306d[_0x244c('0x57')]['id']}})['then'](handleEntityNotFound(_0x519b61,null))['then'](function(_0x1e395a){if(_0x1e395a){_0x2800e6[_0x244c('0x41')]=_['keys'](db['Disposition'][_0x244c('0x3e')]);_0x2800e6[_0x244c('0x43')]=_[_0x244c('0x58')](_0x3e306d['query']);_0x2800e6['filters']=_[_0x244c('0x44')](_0x2800e6[_0x244c('0x41')],_0x2800e6[_0x244c('0x43')]);_0x549fa8[_0x244c('0x45')]=_[_0x244c('0x44')](_0x2800e6[_0x244c('0x41')],qs['fields'](_0x3e306d[_0x244c('0x43')][_0x244c('0x46')]));_0x549fa8[_0x244c('0x45')]=_0x549fa8[_0x244c('0x45')]['length']?_0x549fa8['attributes']:_0x2800e6[_0x244c('0x41')];if(!_0x3e306d[_0x244c('0x43')][_0x244c('0x48')](_0x244c('0x49'))){_0x549fa8[_0x244c('0x29')]=qs[_0x244c('0x29')](_0x3e306d[_0x244c('0x43')][_0x244c('0x29')]);_0x549fa8[_0x244c('0x2c')]=qs['offset'](_0x3e306d['query'][_0x244c('0x2c')]);}_0x549fa8[_0x244c('0x4a')]=qs[_0x244c('0x4b')](_0x3e306d[_0x244c('0x43')][_0x244c('0x4b')]);_0x549fa8[_0x244c('0x4c')]=qs[_0x244c('0x4d')](_['pick'](_0x3e306d['query'],_0x2800e6['filters']));_0x549fa8[_0x244c('0x4c')][_0x244c('0x66')]=_0x1e395a['id'];if(_0x3e306d[_0x244c('0x43')]['filter']){_0x549fa8[_0x244c('0x4c')]=_[_0x244c('0x50')](_0x549fa8[_0x244c('0x4c')],{'$or':_[_0x244c('0x42')](_0x549fa8['attributes'],function(_0x56da4f){var _0xe52989={};_0xe52989[_0x56da4f]={'$like':'%'+_0x3e306d[_0x244c('0x43')][_0x244c('0x4f')]+'%'};return _0xe52989;})});}_0x549fa8=_[_0x244c('0x50')]({},_0x549fa8,_0x3e306d[_0x244c('0x52')]);return db[_0x244c('0x63')][_0x244c('0x2b')]({'where':_0x549fa8[_0x244c('0x4c')]})['then'](function(_0x284b20){_0x270e29[_0x244c('0x2b')]=_0x284b20;if(_0x3e306d['query'][_0x244c('0x53')]){_0x549fa8[_0x244c('0x54')]=[{'all':!![]}];}return db['Disposition'][_0x244c('0x67')](_0x549fa8);})[_0x244c('0x1c')](function(_0x21107b){_0x270e29[_0x244c('0x55')]=_0x21107b;return _0x270e29;});}})[_0x244c('0x1c')](respondWithFilteredResult(_0x519b61,_0x549fa8))['catch'](handleError(_0x519b61,null));};exports['removeDispositions']=function(_0x355225,_0x2f6772,_0x366308){return db[_0x244c('0x3d')][_0x244c('0x59')]({'where':{'id':_0x355225[_0x244c('0x57')]['id']}})[_0x244c('0x1c')](handleEntityNotFound(_0x2f6772,null))['then'](function(_0x10f519){if(_0x10f519){return _0x10f519[_0x244c('0x68')](_0x355225[_0x244c('0x43')]['ids']);}})[_0x244c('0x1c')](respondWithStatusCode(_0x2f6772,null))[_0x244c('0x25')](handleError(_0x2f6772,null));};exports[_0x244c('0x69')]=function(_0x19dcb6,_0x135084,_0x2c3f0a){if(_0x19dcb6[_0x244c('0x5b')]['id']){delete _0x19dcb6[_0x244c('0x5b')]['id'];}return db[_0x244c('0x3d')][_0x244c('0x59')]({'where':{'id':_0x19dcb6[_0x244c('0x57')]['id']}})[_0x244c('0x1c')](handleEntityNotFound(_0x135084,null))[_0x244c('0x1c')](function(_0xdf7d2e){if(_0xdf7d2e){_0x19dcb6[_0x244c('0x5b')][_0x244c('0x66')]=_0xdf7d2e['id'];return db[_0x244c('0x6a')]['create'](_0x19dcb6[_0x244c('0x5b')]);}})[_0x244c('0x1c')](respondWithResult(_0x135084,null))['catch'](handleError(_0x135084,null));};exports[_0x244c('0x6b')]=function(_0x14caf4,_0x537513,_0x52658c){var _0x33b672={'raw':![],'where':{}};var _0x23312b={};var _0x27fe7e={'count':0x0,'rows':[]};return db[_0x244c('0x3d')][_0x244c('0x65')]({'where':{'id':_0x14caf4[_0x244c('0x57')]['id']}})['then'](handleEntityNotFound(_0x537513,null))[_0x244c('0x1c')](function(_0x123bab){if(_0x123bab){_0x23312b[_0x244c('0x41')]=_[_0x244c('0x58')](db['CannedAnswer']['rawAttributes']);_0x23312b['query']=_[_0x244c('0x58')](_0x14caf4[_0x244c('0x43')]);_0x23312b[_0x244c('0x4d')]=_['intersection'](_0x23312b['model'],_0x23312b[_0x244c('0x43')]);_0x33b672[_0x244c('0x45')]=_[_0x244c('0x44')](_0x23312b[_0x244c('0x41')],qs[_0x244c('0x46')](_0x14caf4[_0x244c('0x43')][_0x244c('0x46')]));_0x33b672['attributes']=_0x33b672['attributes'][_0x244c('0x47')]?_0x33b672[_0x244c('0x45')]:_0x23312b[_0x244c('0x41')];if(!_0x14caf4['query'][_0x244c('0x48')](_0x244c('0x49'))){_0x33b672['limit']=qs[_0x244c('0x29')](_0x14caf4['query']['limit']);_0x33b672[_0x244c('0x2c')]=qs['offset'](_0x14caf4[_0x244c('0x43')][_0x244c('0x2c')]);}_0x33b672[_0x244c('0x4a')]=qs[_0x244c('0x4b')](_0x14caf4[_0x244c('0x43')][_0x244c('0x4b')]);_0x33b672[_0x244c('0x4c')]=qs[_0x244c('0x4d')](_[_0x244c('0x4e')](_0x14caf4[_0x244c('0x43')],_0x23312b[_0x244c('0x4d')]));_0x33b672['where'][_0x244c('0x66')]=_0x123bab['id'];if(_0x14caf4[_0x244c('0x43')][_0x244c('0x4f')]){_0x33b672[_0x244c('0x4c')]=_[_0x244c('0x50')](_0x33b672[_0x244c('0x4c')],{'$or':_[_0x244c('0x42')](_0x33b672['attributes'],function(_0x56d312){var _0x24c324={};_0x24c324[_0x56d312]={'$like':'%'+_0x14caf4['query'][_0x244c('0x4f')]+'%'};return _0x24c324;})});}_0x33b672=_[_0x244c('0x50')]({},_0x33b672,_0x14caf4[_0x244c('0x52')]);return db[_0x244c('0x6a')][_0x244c('0x2b')]({'where':_0x33b672[_0x244c('0x4c')]})[_0x244c('0x1c')](function(_0x4dfea4){_0x27fe7e['count']=_0x4dfea4;if(_0x14caf4[_0x244c('0x43')][_0x244c('0x53')]){_0x33b672[_0x244c('0x54')]=[{'all':!![]}];}return db[_0x244c('0x6a')][_0x244c('0x67')](_0x33b672);})[_0x244c('0x1c')](function(_0x1fb4c7){_0x27fe7e[_0x244c('0x55')]=_0x1fb4c7;return _0x27fe7e;});}})['then'](respondWithFilteredResult(_0x537513,_0x33b672))[_0x244c('0x25')](handleError(_0x537513,null));};exports[_0x244c('0x6c')]=function(_0x591694,_0x37042f,_0x5c06d9){return db[_0x244c('0x3d')][_0x244c('0x59')]({'where':{'id':_0x591694[_0x244c('0x57')]['id']}})[_0x244c('0x1c')](handleEntityNotFound(_0x37042f,null))['then'](function(_0x433758){if(_0x433758){return _0x433758[_0x244c('0x6c')](_0x591694['query'][_0x244c('0x6d')]);}})['then'](respondWithStatusCode(_0x37042f,null))['catch'](handleError(_0x37042f,null));};exports[_0x244c('0x6e')]=function(_0x25912b,_0x1de831,_0x52069c){var _0x444f4b={'body':_0x25912b[_0x244c('0x5b')],'channel':'openchannel'};var _0x22f704=[];var _0x367887=[];var _0x4452d8={};var _0x43df8d=![];return db['CmContact']['describe']()[_0x244c('0x1c')](function(_0x4101a3){if(!_0x4101a3){throw new db[(_0x244c('0x6f'))]['ValidationError'](_0x244c('0x70'));}_0x22f704=_[_0x244c('0x71')](_[_0x244c('0x58')](_0x4101a3),[_0x244c('0x72'),_0x244c('0x73')]);_0x367887=_['difference'](_[_0x244c('0x58')](_0x4101a3),[_0x244c('0x72'),_0x244c('0x73'),'CompanyId',_0x244c('0x74')]);if(_0x25912b[_0x244c('0x5b')]['id']){delete _0x25912b[_0x244c('0x5b')]['id'];}if(_[_0x244c('0x75')](_0x25912b[_0x244c('0x5b')][_0x244c('0x76')])){throw new db[(_0x244c('0x6f'))]['ValidationError']('from\x20is\x20mandatory');}if(_['isNil'](_0x25912b[_0x244c('0x5b')][_0x244c('0x5b')])||_0x25912b[_0x244c('0x5b')][_0x244c('0x5b')]===''){throw new db['Sequelize'][(_0x244c('0x77'))](_0x244c('0x78'));}if(_[_0x244c('0x75')](_0x25912b['body'][_0x244c('0x79')])){throw new db['Sequelize'][(_0x244c('0x77'))](_0x244c('0x7a')+_0x367887);}if(!_['includes'](_0x367887,_0x25912b[_0x244c('0x5b')]['mapKey'])){throw new db[(_0x244c('0x6f'))][(_0x244c('0x77'))](_0x244c('0x7b')+_0x367887);}_0x4452d8[_0x25912b[_0x244c('0x5b')][_0x244c('0x79')]]=_0x25912b[_0x244c('0x5b')]['from'];})[_0x244c('0x1c')](function(){return db[_0x244c('0x3d')]['find']({'where':{'id':_0x25912b[_0x244c('0x57')]['id']},'include':[{'model':db[_0x244c('0x7c')],'as':_0x244c('0x7d'),'include':[{'model':db[_0x244c('0x7e')],'as':_0x244c('0x7f'),'where':_0x4452d8,'limit':0x1,'order':[[_0x244c('0x73'),_0x244c('0x80')]]}]},{'model':db['OpenchannelApplication'],'as':_0x244c('0x81')}]});})[_0x244c('0x1c')](handleEntityNotFound(_0x1de831,null))['then'](function(_0x5143e3){if(_0x5143e3&&_0x5143e3[_0x244c('0x7d')]){_0x444f4b[_0x244c('0x82')]=_0x5143e3;_0x444f4b[_0x244c('0x83')]=_0x5143e3['Applications'];_0x444f4b[_0x244c('0x84')]=_0x5143e3['List'];_0x444f4b[_0x244c('0x83')]=_[_0x244c('0x85')](_0x444f4b['applications'],[_0x244c('0x86')],['asc']);if(_0x444f4b['account'][_0x244c('0x81')]){delete _0x444f4b[_0x244c('0x82')][_0x244c('0x81')];}if(_0x444f4b['account']['List']&&_0x444f4b[_0x244c('0x82')]['List'][_0x244c('0x7f')][_0x244c('0x47')]){return _0x444f4b['account'][_0x244c('0x7d')][_0x244c('0x7f')][0x0];}var _0x4bf1ca=_[_0x244c('0x87')](_0x25912b['body'],{'firstName':_0x25912b['body'][_0x244c('0x76')],'ListId':_0x5143e3['ListId']});_0x4bf1ca[_0x25912b['body']['mapKey']]=_0x25912b['body']['from'];return db[_0x244c('0x7e')]['create'](_0x4bf1ca,{'fields':_0x22f704,'raw':!![]});}})['then'](handleEntityNotFound(_0x1de831,null))[_0x244c('0x1c')](function(_0x392d52){_0x444f4b[_0x244c('0x88')]=_0x392d52;if(_0x392d52){var _0x15ca15={'ContactId':_0x392d52['id'],'OpenchannelAccountId':_0x25912b[_0x244c('0x57')]['id'],'from':(_0x392d52['firstName']||'')+'\x20'+(_0x392d52['lastName']||'')};var _0x3a8e8f={'OpenchannelAccountId':_0x25912b['params']['id'],'closed':![]};if(_0x25912b[_0x244c('0x5b')][_0x244c('0x89')]){_0x3a8e8f['threadId']=_0x25912b[_0x244c('0x5b')]['threadId'];return db[_0x244c('0x8a')][_0x244c('0x59')]({'where':_0x3a8e8f})[_0x244c('0x1c')](function(_0x49e082){if(_0x49e082){return[_0x49e082,![]];}_0x15ca15[_0x244c('0x89')]=_0x25912b['body'][_0x244c('0x89')];_0x15ca15[_0x244c('0x8b')]=_0x25912b[_0x244c('0x5b')][_0x244c('0x8b')];return db[_0x244c('0x8a')][_0x244c('0x5a')](_0x15ca15)[_0x244c('0x1c')](function(_0x44d074){return[_0x44d074,!![]];});});}else{_0x3a8e8f[_0x244c('0x89')]=null;}_0x3a8e8f[_0x244c('0x8c')]=_0x392d52['id'];return db['OpenchannelInteraction']['find']({'where':_0x3a8e8f})[_0x244c('0x1c')](function(_0x1be617){if(_0x1be617){return[_0x1be617,![]];}return db[_0x244c('0x8a')]['create'](_0x15ca15)[_0x244c('0x1c')](function(_0x5d4ba7){return[_0x5d4ba7,!![]];});});}})[_0x244c('0x8d')](function(_0x13fba0,_0x582c89){if(_0x13fba0){_0x43df8d=_0x582c89;if(!_0x582c89){var _0x524f70={'from':(_0x444f4b[_0x244c('0x88')][_0x244c('0x8e')]||'')+'\x20'+(_0x444f4b[_0x244c('0x88')][_0x244c('0x8f')]||'')};if(_0x25912b['body'][_0x244c('0x89')]&&_0x25912b[_0x244c('0x5b')][_0x244c('0x90')]&&_0x25912b[_0x244c('0x5b')][_0x244c('0x89')]!=_0x25912b[_0x244c('0x5b')][_0x244c('0x90')]){_0x524f70[_0x244c('0x89')]=_0x25912b[_0x244c('0x5b')]['messageId'];}return _0x13fba0[_0x244c('0x31')](_0x524f70);}else{return _0x13fba0;}}})[_0x244c('0x1c')](function(_0x542b60){_0x444f4b[_0x244c('0x91')]=_0x542b60[_0x244c('0x33')]({'plain':!![]});_0x444f4b[_0x244c('0x91')][_0x244c('0x92')]=_0x43df8d;if(_0x444f4b[_0x244c('0x91')][_0x244c('0x92')]){if(_0x444f4b[_0x244c('0x82')][_0x244c('0x93')]){_0x444f4b['applications'][_0x244c('0x94')]({'id':0x0,'priority':_0x444f4b[_0x244c('0x83')][_0x244c('0x47')]+0x1,'app':_0x244c('0x95'),'appdata':'unmanaged','interval':_0x244c('0x96')});}}return db[_0x244c('0x97')][_0x244c('0x5a')]({'body':_0x25912b[_0x244c('0x5b')][_0x244c('0x5b')],'OpenchannelAccountId':_0x25912b[_0x244c('0x57')]['id'],'OpenchannelInteractionId':_0x542b60['id'],'direction':'in','ContactId':_0x444f4b[_0x244c('0x88')]['id'],'AttachmentId':_0x25912b[_0x244c('0x5b')][_0x244c('0x98')]});})[_0x244c('0x1c')](function(_0x4142db){_0x444f4b[_0x244c('0x22')]=_0x4142db;if(!_0x444f4b[_0x244c('0x91')][_0x244c('0x99')])return;return db[_0x244c('0x9a')][_0x244c('0x59')]({'attributes':['id',_0x244c('0x38')],'where':{'id':_0x444f4b[_0x244c('0x91')][_0x244c('0x99')]}});})['then'](function(_0x522a88){if(_0x522a88){_0x444f4b['applications'][_0x244c('0x9b')]({'id':0x0,'priority':0x0,'app':_0x244c('0x9c'),'appdata':_0x522a88[_0x244c('0x38')]+','+(_0x444f4b[_0x244c('0x82')][_0x244c('0x9d')]||0xa),'interval':_0x244c('0x96')});}if(!_0x444f4b[_0x244c('0x91')][_0x244c('0x9e')])return;return db[_0x244c('0x9f')][_0x244c('0x59')]({'attributes':['id',_0x244c('0x38')],'where':{'id':_0x444f4b['interaction'][_0x244c('0x9e')]}});})[_0x244c('0x1c')](function(_0x3bb2ce){if(_0x3bb2ce){_0x444f4b[_0x244c('0x83')][_0x244c('0x9b')]({'id':0x0,'priority':0x1,'app':_0x244c('0xa0'),'appdata':_0x3bb2ce[_0x244c('0x38')]+','+(_0x444f4b[_0x244c('0x82')][_0x244c('0xa1')]||0x12c),'interval':_0x244c('0x96')});}return respondWithRpcPromise('Start',_0x244c('0xa2'),_0x444f4b);})[_0x244c('0x1c')](function(_0x1215da){respondWithRpcPromise(_0x244c('0xa3'),_0x244c('0xa3'),{'event':_0x244c('0x6e'),'message':_0x1215da},client9002);return _0x1215da;})[_0x244c('0x1c')](respondWithResult(_0x1de831,null))['catch'](handleError(_0x1de831,null));};exports[_0x244c('0xa4')]=function(_0x487bf4,_0x4a6afe){var _0x4d03c9=_0x487bf4[_0x244c('0x57')]['id'];var _0x5c5ae6=_0x487bf4[_0x244c('0x5b')];var _0x333e48=0xc8;var _0x5917d0=null;return db['sequelize'][_0x244c('0xa5')]({'isolationLevel':db[_0x244c('0xa6')][_0x244c('0xa7')][_0x244c('0xa8')][_0x244c('0xa9')]},function(_0x496311){return db[_0x244c('0x3d')][_0x244c('0x65')]({'where':{'id':_0x4d03c9},'transaction':_0x496311})[_0x244c('0x1c')](function(_0x530bfd){if(_0x530bfd){return db[_0x244c('0xaa')][_0x244c('0x32')]({'where':{'OpenchannelAccountId':_0x4d03c9},'transaction':_0x496311})['then'](function(){var _0xff3622=_[_0x244c('0x42')](_0x5c5ae6,function(_0x4b4dde){_0x4b4dde[_0x244c('0x66')]=_0x4d03c9;return _0x4b4dde;});return db[_0x244c('0xaa')][_0x244c('0xab')](_0xff3622,{'transaction':_0x496311});});}else{_0x333e48=0x194;_0x5917d0=[];}});})[_0x244c('0x1c')](function(){if(_0x333e48!==0x194){return db[_0x244c('0xaa')][_0x244c('0xac')]({'where':{'OpenchannelAccountId':_0x4d03c9},'order':_0x244c('0x86')})[_0x244c('0x1c')](function(_0x522605){_0x5917d0=_0x522605;});}})['catch'](function(_0x2d9c4a){_0x333e48=0x1f4;logger[_0x244c('0x20')](_0x2d9c4a[_0x244c('0x37')]);if(_0x2d9c4a['name']){delete _0x2d9c4a[_0x244c('0x38')];}_0x5917d0=_0x2d9c4a;})[_0x244c('0xad')](function(){if(_0x5917d0===null){_0x4a6afe[_0x244c('0x36')](_0x333e48);}else{if(_0x333e48===0x1f4){_0x4a6afe[_0x244c('0x27')](_0x333e48)['send'](_0x5917d0);}else{_0x4a6afe['status'](_0x333e48)[_0x244c('0x28')](_0x5917d0);}}});};exports['getApplications']=function(_0x39e52f,_0x25a4d0,_0x5c6501){var _0x5c0ad6={};var _0x113ea3={};var _0x34911b;var _0x37df0b;return db[_0x244c('0x3d')][_0x244c('0x65')]({'where':{'id':_0x39e52f[_0x244c('0x57')]['id']}})[_0x244c('0x1c')](handleEntityNotFound(_0x25a4d0,null))[_0x244c('0x1c')](function(_0x3a8605){if(_0x3a8605){_0x34911b=_0x3a8605;_0x113ea3['model']=_['keys'](db[_0x244c('0xaa')][_0x244c('0x3e')]);_0x113ea3[_0x244c('0x43')]=_[_0x244c('0x58')](_0x39e52f[_0x244c('0x43')]);_0x113ea3[_0x244c('0x4d')]=_[_0x244c('0x44')](_0x113ea3[_0x244c('0x41')],_0x113ea3['query']);_0x5c0ad6['attributes']=_['intersection'](_0x113ea3['model'],qs[_0x244c('0x46')](_0x39e52f[_0x244c('0x43')][_0x244c('0x46')]));_0x5c0ad6[_0x244c('0x45')]=_0x5c0ad6[_0x244c('0x45')][_0x244c('0x47')]?_0x5c0ad6[_0x244c('0x45')]:_0x113ea3[_0x244c('0x41')];_0x5c0ad6[_0x244c('0x4a')]=qs[_0x244c('0x4b')](_0x39e52f['query'][_0x244c('0x4b')]);_0x5c0ad6['where']=qs[_0x244c('0x4d')](_['pick'](_0x39e52f[_0x244c('0x43')],_0x113ea3[_0x244c('0x4d')]));if(_0x39e52f[_0x244c('0x43')][_0x244c('0x4f')]){_0x5c0ad6[_0x244c('0x4c')]=_['merge'](_0x5c0ad6[_0x244c('0x4c')],{'$or':_[_0x244c('0x42')](_0x5c0ad6[_0x244c('0x45')],function(_0x518d4f){var _0x5de1d0={};_0x5de1d0[_0x518d4f]={'$like':'%'+_0x39e52f[_0x244c('0x43')][_0x244c('0x4f')]+'%'};return _0x5de1d0;})});}_0x5c0ad6=_[_0x244c('0x50')]({},_0x5c0ad6,_0x39e52f['options']);return _0x34911b['getApplications'](_0x5c0ad6);}})[_0x244c('0x1c')](function(_0x366fa7){if(_0x366fa7){_0x37df0b=_0x366fa7[_0x244c('0x47')];if(!_0x39e52f['query'][_0x244c('0x48')](_0x244c('0x49'))){_0x5c0ad6[_0x244c('0x29')]=qs[_0x244c('0x29')](_0x39e52f[_0x244c('0x43')][_0x244c('0x29')]);_0x5c0ad6[_0x244c('0x2c')]=qs['offset'](_0x39e52f[_0x244c('0x43')][_0x244c('0x2c')]);}return _0x34911b[_0x244c('0xae')](_0x5c0ad6);}})[_0x244c('0x1c')](function(_0xc19b5){if(_0xc19b5){return _0xc19b5?{'count':_0x37df0b,'rows':_0xc19b5}:null;}})[_0x244c('0x1c')](respondWithResult(_0x25a4d0,null))[_0x244c('0x25')](handleError(_0x25a4d0,null));};exports[_0x244c('0xaf')]=function(_0x20e666,_0x2f24cf,_0xaedc3a){var _0x276614={'raw':![],'where':{}};var _0x2fd1dd={};var _0x480f66={'count':0x0,'rows':[]};return db['OpenchannelAccount']['findOne']({'where':{'id':_0x20e666[_0x244c('0x57')]['id']}})['then'](handleEntityNotFound(_0x2f24cf,null))['then'](function(_0x1db626){if(_0x1db626){_0x2fd1dd['model']=_[_0x244c('0x58')](db['OpenchannelInteraction']['rawAttributes']);_0x2fd1dd['query']=_['keys'](_0x20e666[_0x244c('0x43')]);_0x2fd1dd[_0x244c('0x4d')]=_[_0x244c('0x44')](_0x2fd1dd[_0x244c('0x41')],_0x2fd1dd[_0x244c('0x43')]);_0x276614[_0x244c('0x45')]=_[_0x244c('0x44')](_0x2fd1dd[_0x244c('0x41')],qs[_0x244c('0x46')](_0x20e666[_0x244c('0x43')][_0x244c('0x46')]));_0x276614['attributes']=_0x276614[_0x244c('0x45')][_0x244c('0x47')]?_0x276614[_0x244c('0x45')]:_0x2fd1dd[_0x244c('0x41')];if(!_0x20e666['query'][_0x244c('0x48')](_0x244c('0x49'))){_0x276614[_0x244c('0x29')]=qs['limit'](_0x20e666[_0x244c('0x43')][_0x244c('0x29')]);_0x276614['offset']=qs[_0x244c('0x2c')](_0x20e666[_0x244c('0x43')]['offset']);}_0x276614[_0x244c('0x4a')]=qs[_0x244c('0x4b')](_0x20e666[_0x244c('0x43')][_0x244c('0x4b')]);_0x276614['where']=qs['filters'](_[_0x244c('0x4e')](_0x20e666['query'],_0x2fd1dd['filters']));_0x276614[_0x244c('0x4c')][_0x244c('0x66')]=_0x1db626['id'];if(_0x20e666[_0x244c('0x43')]['filter']){_0x276614[_0x244c('0x4c')]=_[_0x244c('0x50')](_0x276614['where'],{'$or':_[_0x244c('0x42')](_0x276614[_0x244c('0x45')],function(_0x1d2135){var _0x5b8fa2={};_0x5b8fa2[_0x1d2135]={'$like':'%'+_0x20e666[_0x244c('0x43')]['filter']+'%'};return _0x5b8fa2;})});}_0x276614=_[_0x244c('0x50')]({},_0x276614,_0x20e666[_0x244c('0x52')]);return db[_0x244c('0x8a')][_0x244c('0x2b')]({'where':_0x276614[_0x244c('0x4c')]})['then'](function(_0x3252ca){_0x480f66[_0x244c('0x2b')]=_0x3252ca;if(_0x20e666['query'][_0x244c('0x53')]){_0x276614['include']=[{'model':db[_0x244c('0x7e')],'as':'Contact','required':![]},{'model':db[_0x244c('0x9a')],'as':_0x244c('0xb0'),'attributes':[_0x244c('0x38'),_0x244c('0xb1'),_0x244c('0xb2')],'required':![]},{'model':db[_0x244c('0xb3')],'as':'Tags','attributes':['id','name',_0x244c('0xb4')],'where':_0x20e666['query']['tag']?{'id':_0x20e666[_0x244c('0x43')][_0x244c('0xb5')]}:undefined,'required':_0x20e666[_0x244c('0x43')][_0x244c('0xb5')]?!![]:![]}];}return db[_0x244c('0x8a')]['findAll'](_0x276614);})[_0x244c('0x1c')](function(_0x4b85d8){_0x480f66[_0x244c('0x55')]=_0x4b85d8;return _0x480f66;});}})['then'](respondWithFilteredResult(_0x2f24cf,_0x276614))[_0x244c('0x25')](handleError(_0x2f24cf,null));};exports['addAgents']=function(_0x1c202d,_0x40e586,_0x30f379){return db['OpenchannelAccount'][_0x244c('0x59')]({'where':{'id':_0x1c202d[_0x244c('0x57')]['id']}})['then'](handleEntityNotFound(_0x40e586,null))[_0x244c('0x1c')](function(_0x17c335){if(_0x17c335){return _0x17c335[_0x244c('0xb6')](_0x1c202d[_0x244c('0x5b')]['ids'],_['omit'](_0x1c202d[_0x244c('0x5b')],[_0x244c('0x6d'),'id'])||{})[_0x244c('0x8d')](function(_0x1efe03){for(var _0x13141e=0x0;_0x13141e<_0x1c202d['body'][_0x244c('0x6d')][_0x244c('0x47')];_0x13141e+=0x1){socket[_0x244c('0xb7')]('userOpenchannelAccount:save',{'UserId':Number(_0x1c202d['body'][_0x244c('0x6d')][_0x13141e]),'OpenchannelAccountId':Number(_0x1c202d['params']['id'])});}return _0x1efe03;});}})[_0x244c('0x1c')](respondWithResult(_0x40e586,null))[_0x244c('0x25')](handleError(_0x40e586,null));};exports[_0x244c('0xb8')]=function(_0x1cf550,_0x17c1ef,_0x50512d){return db[_0x244c('0x3d')][_0x244c('0x59')]({'where':{'id':_0x1cf550[_0x244c('0x57')]['id']}})[_0x244c('0x1c')](handleEntityNotFound(_0x17c1ef,null))[_0x244c('0x1c')](function(_0xca1e51){if(_0xca1e51){return _0xca1e51[_0x244c('0xb8')](_0x1cf550[_0x244c('0x43')][_0x244c('0x6d')])[_0x244c('0x1c')](function(){if(_[_0x244c('0xb9')](_0x1cf550['query'][_0x244c('0x6d')])){for(var _0x1dc949=0x0;_0x1dc949<_0x1cf550[_0x244c('0x43')][_0x244c('0x6d')][_0x244c('0x47')];_0x1dc949+=0x1){socket[_0x244c('0xb7')](_0x244c('0xba'),{'UserId':Number(_0x1cf550[_0x244c('0x43')][_0x244c('0x6d')][_0x1dc949]),'OpenchannelAccountId':Number(_0x1cf550[_0x244c('0x57')]['id'])});}}else{socket[_0x244c('0xb7')](_0x244c('0xba'),{'UserId':Number(_0x1cf550[_0x244c('0x43')]['ids']),'OpenchannelAccountId':Number(_0x1cf550[_0x244c('0x57')]['id'])});}});}})['then'](respondWithStatusCode(_0x17c1ef,null))[_0x244c('0x25')](handleError(_0x17c1ef,null));};exports[_0x244c('0xbb')]=function(_0x194f5d,_0x477238,_0x3cb2d3){var _0x38f318={};var _0x3143ea={};var _0x99f4aa;var _0x15ae27;return db[_0x244c('0x3d')][_0x244c('0x65')]({'where':{'id':_0x194f5d[_0x244c('0x57')]['id']}})[_0x244c('0x1c')](handleEntityNotFound(_0x477238,null))[_0x244c('0x1c')](function(_0x367f7c){if(_0x367f7c){_0x99f4aa=_0x367f7c;_0x3143ea[_0x244c('0x41')]=_[_0x244c('0x58')](db[_0x244c('0x9a')][_0x244c('0x3e')]);_0x3143ea['query']=_['keys'](_0x194f5d[_0x244c('0x43')]);_0x3143ea['filters']=_[_0x244c('0x44')](_0x3143ea['model'],_0x3143ea[_0x244c('0x43')]);_0x38f318[_0x244c('0x45')]=_[_0x244c('0x44')](_0x3143ea[_0x244c('0x41')],qs['fields'](_0x194f5d[_0x244c('0x43')]['fields']));_0x38f318[_0x244c('0x45')]=_0x38f318[_0x244c('0x45')][_0x244c('0x47')]?_0x38f318[_0x244c('0x45')]:_0x3143ea['model'];_0x38f318['order']=qs['sort'](_0x194f5d[_0x244c('0x43')][_0x244c('0x4b')]);_0x38f318['where']=qs[_0x244c('0x4d')](_[_0x244c('0x4e')](_0x194f5d[_0x244c('0x43')],_0x3143ea[_0x244c('0x4d')]));if(_0x194f5d[_0x244c('0x43')][_0x244c('0x4f')]){_0x38f318[_0x244c('0x4c')]=_['merge'](_0x38f318[_0x244c('0x4c')],{'$or':_[_0x244c('0x42')](_0x38f318['attributes'],function(_0x4c7cc1){var _0x495063={};_0x495063[_0x4c7cc1]={'$like':'%'+_0x194f5d['query'][_0x244c('0x4f')]+'%'};return _0x495063;})});}_0x38f318=_['merge']({},_0x38f318,_0x194f5d[_0x244c('0x52')]);return _0x99f4aa['getAgents'](_0x38f318);}})['then'](function(_0x35fadc){if(_0x35fadc){_0x15ae27=_0x35fadc['length'];if(!_0x194f5d[_0x244c('0x43')][_0x244c('0x48')](_0x244c('0x49'))){_0x38f318[_0x244c('0x29')]=qs['limit'](_0x194f5d['query']['limit']);_0x38f318[_0x244c('0x2c')]=qs[_0x244c('0x2c')](_0x194f5d['query'][_0x244c('0x2c')]);}return _0x99f4aa['getAgents'](_0x38f318);}})[_0x244c('0x1c')](function(_0x578103){if(_0x578103){return _0x578103?{'count':_0x15ae27,'rows':_0x578103}:null;}})[_0x244c('0x1c')](respondWithResult(_0x477238,null))[_0x244c('0x25')](handleError(_0x477238,null));};exports[_0x244c('0x39')]=function(_0x385694,_0x172241,_0x2b8d29){var _0x5e7ef9,_0x1f6535,_0x581e6a;if(_[_0x244c('0x75')](_0x385694[_0x244c('0x5b')][_0x244c('0x5b')])||_0x385694[_0x244c('0x5b')][_0x244c('0x5b')]===''){throw new db[(_0x244c('0x6f'))][(_0x244c('0x77'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x244c('0x75')](_0x385694['body']['to'])){}_0x5e7ef9=_0x385694[_0x244c('0x5b')]['to'];return db[_0x244c('0x3d')][_0x244c('0x65')]({'where':{'id':_0x385694[_0x244c('0x57')]['id']}})['then'](handleEntityNotFound(_0x172241,null))[_0x244c('0x1c')](function(_0x3e86f1){if(_0x3e86f1){return db[_0x244c('0x3d')]['find']({'where':{'id':_0x3e86f1['id']},'include':[{'model':db[_0x244c('0x7c')],'as':_0x244c('0x7d'),'include':[{'model':db[_0x244c('0x7e')],'as':_0x244c('0x7f'),'where':{[_0x3e86f1[_0x244c('0x79')]]:_0x5e7ef9},'limit':0x1,'order':[['updatedAt',_0x244c('0x80')]]}]}]})[_0x244c('0x1c')](handleEntityNotFound(_0x172241,null))[_0x244c('0x1c')](function(_0x1e83e5){if(_0x1e83e5&&_0x1e83e5[_0x244c('0x7d')]){_0x1f6535=_0x1e83e5['get']({'plain':!![]});if(_0x1f6535['List']&&_0x1f6535[_0x244c('0x7d')]['Contacts'][_0x244c('0x47')]){return _0x1f6535[_0x244c('0x7d')]['Contacts'][0x0];}return db[_0x244c('0x7e')][_0x244c('0x5a')](_[_0x244c('0x87')](_0x385694[_0x244c('0x5b')],{'firstName':_0x5e7ef9,[_0x1e83e5['mapKey']]:_0x5e7ef9,'phone':_0x5e7ef9,'ListId':_0x1f6535[_0x244c('0x74')]}));}})[_0x244c('0x1c')](handleEntityNotFound(_0x172241,null))[_0x244c('0x1c')](function(_0x5bcfa1){if(_0x5bcfa1){_0x581e6a=_0x5bcfa1;return db[_0x244c('0x8a')][_0x244c('0x59')]({'where':{'ContactId':_0x581e6a['id'],'closed':![],'OpenchannelAccountId':_0x1f6535['id']}})[_0x244c('0x1c')](function(_0x17d6d6){if(_0x17d6d6){return[_0x17d6d6,![]];}return db[_0x244c('0x8a')][_0x244c('0x5a')]({'UserId':_0x385694[_0x244c('0x5c')]['id'],'ContactId':_0x581e6a['id'],'OpenchannelAccountId':_0x1f6535['id'],'lastMsgDirection':'out','firstMsgDirection':_0x244c('0xbc'),'Messages':[_['merge'](_0x385694[_0x244c('0x5b')],{'read':![],'body':_0x385694['body'][_0x244c('0x5b')],'OpenchannelAccountId':_0x1f6535['id'],'UserId':_0x385694[_0x244c('0x5c')]['id'],'ContactId':_0x581e6a['id']})]},{'include':[{'model':db[_0x244c('0x97')],'as':_0x244c('0xbd')}]})[_0x244c('0x1c')](function(_0x347006){return[_0x347006,!![]];});});}})[_0x244c('0x8d')](function(_0x106eb1,_0x55c598){if(_0x55c598){return _0x106eb1;}return db['OpenchannelMessage'][_0x244c('0x5a')](_[_0x244c('0x50')](_0x385694[_0x244c('0x5b')],{'read':![],'body':_0x385694[_0x244c('0x5b')][_0x244c('0x5b')],'OpenchannelAccountId':_0x1f6535['id'],'OpenchannelInteractionId':_0x106eb1['id'],'UserId':_0x385694['user']['id'],'ContactId':_0x581e6a['id']}))[_0x244c('0x1c')](function(_0xac8346){_0x106eb1[_0x244c('0xbe')]['Messages']=[];_0x106eb1[_0x244c('0xbe')][_0x244c('0xbd')]['push'](_0xac8346[_0x244c('0xbe')]);return _0x106eb1;});});}})[_0x244c('0x1c')](respondWithResult(_0x172241,null))[_0x244c('0x25')](handleError(_0x172241,null));}; \ No newline at end of file +var _0xb091=['crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','client','http','request','then','info','OpenchannelAccount,\x20%s,\x20%s','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','sendStatus','status','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','destroy','get','OpenchannelAccounts','end','stack','name','Pause','mandatoryDispositionPause','rawAttributes','fieldName','type','key','map','query','filters','intersection','model','attributes','fields','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','OpenchannelAccount','includeAll','include','findAll','params','keys','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','OpenchannelAccountId','Disposition','getDispositions','findOne','hasOwnProperty','rows','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','notify','CmContact','Sequelize','ValidationError','updatedAt','difference','createdAt','CompanyId','from','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','List','Contacts','DESC','Applications','account','applications','list','orderBy','ListId','contact','threadId','OpenchannelInteraction','externalUrl','ContactId','firstName','messageId','interaction','created','autoclose','close','OpenchannelMessage','UserId','User','unshift','waitForTheAssignedAgent','*,*,*,*','queueId','OpenchannelQueue','waitForTheAssignedQueue','startRouting','EventManager','addApplications','transaction','sequelize','Transaction','ISOLATION_LEVELS','OpenchannelApplication','bulkCreate','findAndCountAll','priority','finally','send','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','tag','addAgents','omit','spread','emit','isArray','userOpenchannelAccount:remove','getAgents','out','Messages','dataValues','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','ejs','fs-extra','lodash'];(function(_0x183e8c,_0x342e9e){var _0x25af6b=function(_0x330fe4){while(--_0x330fe4){_0x183e8c['push'](_0x183e8c['shift']());}};_0x25af6b(++_0x342e9e);}(_0xb091,0x16e));var _0x1b09=function(_0x26a9f1,_0x409447){_0x26a9f1=_0x26a9f1-0x0;var _0x44c4b7=_0xb091[_0x26a9f1];return _0x44c4b7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1b09('0x0'));var zipdir=require(_0x1b09('0x1'));var jsonpatch=require(_0x1b09('0x2'));var rp=require(_0x1b09('0x3'));var moment=require('moment');var BPromise=require(_0x1b09('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x1b09('0x5'));var sox=require(_0x1b09('0x6'));var csv=require('to-csv');var ejs=require(_0x1b09('0x7'));var fs=require('fs');var fs_extra=require(_0x1b09('0x8'));var _=require(_0x1b09('0x9'));var squel=require('squel');var crypto=require(_0x1b09('0xa'));var jsforce=require(_0x1b09('0xb'));var deskjs=require(_0x1b09('0xc'));var toCsv=require(_0x1b09('0xd'));var querystring=require(_0x1b09('0xe'));var Papa=require(_0x1b09('0xf'));var Redis=require(_0x1b09('0x10'));var authService=require(_0x1b09('0x11'));var qs=require(_0x1b09('0x12'));var as=require(_0x1b09('0x13'));var hardwareService=require(_0x1b09('0x14'));var logger=require('../../config/logger')(_0x1b09('0x15'));var utils=require(_0x1b09('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1b09('0x17'))['db'];config[_0x1b09('0x18')]=_[_0x1b09('0x19')](config[_0x1b09('0x18')],{'host':_0x1b09('0x1a'),'port':0x18eb});var socket=require(_0x1b09('0x1b'))(new Redis(config[_0x1b09('0x18')]));require('./openchannelAccount.socket')[_0x1b09('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson[_0x1b09('0x1d')][_0x1b09('0x1e')]({'port':0x232c});var client9002=jayson[_0x1b09('0x1d')][_0x1b09('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x10b7eb,_0x1dc96b,_0x64689a,_0x33129b){return new BPromise(function(_0x1196b2,_0x32244e){var _0x311158=_0x33129b||client;return _0x311158[_0x1b09('0x1f')](_0x10b7eb,_0x64689a)[_0x1b09('0x20')](function(_0x4c64e1){logger[_0x1b09('0x21')](_0x1b09('0x22'),_0x1dc96b,'request\x20sent');logger['debug'](_0x1b09('0x23'),_0x1dc96b,'request\x20sent',JSON[_0x1b09('0x24')](_0x4c64e1));if(_0x4c64e1['error']){if(_0x4c64e1[_0x1b09('0x25')][_0x1b09('0x26')]===0x1f4){logger[_0x1b09('0x25')](_0x1b09('0x22'),_0x1dc96b,_0x4c64e1[_0x1b09('0x25')][_0x1b09('0x27')]);return _0x32244e(_0x4c64e1[_0x1b09('0x25')][_0x1b09('0x27')]);}logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x1dc96b,_0x4c64e1[_0x1b09('0x25')][_0x1b09('0x27')]);return _0x1196b2(_0x4c64e1['error'][_0x1b09('0x27')]);}else{logger[_0x1b09('0x21')](_0x1b09('0x22'),_0x1dc96b,_0x1b09('0x28'));_0x1196b2(_0x4c64e1['result'][_0x1b09('0x27')]);}})[_0x1b09('0x29')](function(_0x4936d0){logger[_0x1b09('0x25')](_0x1b09('0x22'),_0x1dc96b,_0x4936d0);_0x32244e(_0x4936d0);});});}function respondWithStatusCode(_0x4dd3e5,_0x13c89c){_0x13c89c=_0x13c89c||0xcc;return function(_0x108d80){if(_0x108d80){return _0x4dd3e5[_0x1b09('0x2a')](_0x13c89c);}return _0x4dd3e5[_0x1b09('0x2b')](_0x13c89c)['end']();};}function respondWithResult(_0xb3cf07,_0x3cdbc5){_0x3cdbc5=_0x3cdbc5||0xc8;return function(_0x532589){if(_0x532589){return _0xb3cf07[_0x1b09('0x2b')](_0x3cdbc5)[_0x1b09('0x2c')](_0x532589);}};}function respondWithFilteredResult(_0x26befb,_0x1cbbd5){return function(_0x11098e){if(_0x11098e){var _0x1aa179=typeof _0x1cbbd5[_0x1b09('0x2d')]==='undefined'&&typeof _0x1cbbd5[_0x1b09('0x2e')]===_0x1b09('0x2f');var _0x4bf0ad=_0x11098e[_0x1b09('0x30')];var _0x1a6130=_0x1aa179?0x0:_0x1cbbd5[_0x1b09('0x2d')];var _0x122b1c=_0x1aa179?_0x11098e[_0x1b09('0x30')]:_0x1cbbd5['offset']+_0x1cbbd5[_0x1b09('0x2e')];var _0x54bf30;if(_0x122b1c>=_0x4bf0ad){_0x122b1c=_0x4bf0ad;_0x54bf30=0xc8;}else{_0x54bf30=0xce;}_0x26befb[_0x1b09('0x2b')](_0x54bf30);return _0x26befb['set'](_0x1b09('0x31'),_0x1a6130+'-'+_0x122b1c+'/'+_0x4bf0ad)[_0x1b09('0x2c')](_0x11098e);}return null;};}function patchUpdates(_0x381e76){return function(_0x2cf3cb){try{jsonpatch[_0x1b09('0x32')](_0x2cf3cb,_0x381e76,!![]);}catch(_0x8d76b9){return BPromise[_0x1b09('0x33')](_0x8d76b9);}return _0x2cf3cb[_0x1b09('0x34')]();};}function saveUpdates(_0x2db0e0,_0x33bca2){return function(_0x5003f8){if(_0x5003f8){return _0x5003f8[_0x1b09('0x35')](_0x2db0e0)[_0x1b09('0x20')](function(_0x23b8d9){return _0x23b8d9;});}return null;};}function removeEntity(_0x54c0a2,_0x4b9ada){return function(_0x339b66){if(_0x339b66){return _0x339b66[_0x1b09('0x36')]()[_0x1b09('0x20')](function(){var _0x12a720=_0x339b66[_0x1b09('0x37')]({'plain':!![]});var _0x31eb3f=_0x1b09('0x38');return db['UserProfileResource'][_0x1b09('0x36')]({'where':{'type':_0x31eb3f,'resourceId':_0x12a720['id']}})['then'](function(){return _0x339b66;});})[_0x1b09('0x20')](function(){_0x54c0a2['status'](0xcc)[_0x1b09('0x39')]();});}};}function handleEntityNotFound(_0x278aa8,_0x46e202){return function(_0x2ba156){if(!_0x2ba156){_0x278aa8[_0x1b09('0x2a')](0x194);}return _0x2ba156;};}function handleError(_0x37f240,_0x659067){_0x659067=_0x659067||0x1f4;return function(_0x466502){logger[_0x1b09('0x25')](_0x466502[_0x1b09('0x3a')]);if(_0x466502[_0x1b09('0x3b')]){delete _0x466502[_0x1b09('0x3b')];}_0x37f240[_0x1b09('0x2b')](_0x659067)['send'](_0x466502);};}exports['index']=function(_0x23ce9a,_0xb2ef05){var _0x27a78c={'include':[{'model':db[_0x1b09('0x3c')],'as':_0x1b09('0x3d')}]},_0x2470a0={},_0x147c2b={'count':0x0,'rows':[]};var _0x33d697=_['map'](db['OpenchannelAccount'][_0x1b09('0x3e')],function(_0x51d5eb){return{'name':_0x51d5eb[_0x1b09('0x3f')],'type':_0x51d5eb[_0x1b09('0x40')][_0x1b09('0x41')]};});_0x2470a0['model']=_[_0x1b09('0x42')](_0x33d697,_0x1b09('0x3b'));_0x2470a0[_0x1b09('0x43')]=_['keys'](_0x23ce9a[_0x1b09('0x43')]);_0x2470a0[_0x1b09('0x44')]=_[_0x1b09('0x45')](_0x2470a0[_0x1b09('0x46')],_0x2470a0['query']);_0x27a78c[_0x1b09('0x47')]=_[_0x1b09('0x45')](_0x2470a0['model'],qs[_0x1b09('0x48')](_0x23ce9a[_0x1b09('0x43')]['fields']));_0x27a78c['attributes']=_0x27a78c['attributes']['length']?_0x27a78c[_0x1b09('0x47')]:_0x2470a0[_0x1b09('0x46')];if(!_0x23ce9a[_0x1b09('0x43')]['hasOwnProperty'](_0x1b09('0x49'))){_0x27a78c[_0x1b09('0x2e')]=qs['limit'](_0x23ce9a[_0x1b09('0x43')][_0x1b09('0x2e')]);_0x27a78c[_0x1b09('0x2d')]=qs[_0x1b09('0x2d')](_0x23ce9a[_0x1b09('0x43')][_0x1b09('0x2d')]);}_0x27a78c[_0x1b09('0x4a')]=qs[_0x1b09('0x4b')](_0x23ce9a[_0x1b09('0x43')][_0x1b09('0x4b')]);_0x27a78c['where']=qs[_0x1b09('0x44')](_[_0x1b09('0x4c')](_0x23ce9a[_0x1b09('0x43')],_0x2470a0['filters']),_0x33d697);if(_0x23ce9a[_0x1b09('0x43')]['filter']){_0x27a78c[_0x1b09('0x4d')]=_[_0x1b09('0x4e')](_0x27a78c['where'],{'$or':_[_0x1b09('0x42')](_0x33d697,function(_0x9be1a){if(_0x9be1a[_0x1b09('0x40')]!==_0x1b09('0x4f')){var _0x13294c={};_0x13294c[_0x9be1a[_0x1b09('0x3b')]]={'$like':'%'+_0x23ce9a['query'][_0x1b09('0x50')]+'%'};return _0x13294c;}})});}_0x27a78c=_['merge']({},_0x27a78c,_0x23ce9a[_0x1b09('0x51')]);var _0x58a158={'where':_0x27a78c['where']};return db[_0x1b09('0x52')][_0x1b09('0x30')](_0x58a158)[_0x1b09('0x20')](function(_0xa2b80f){_0x147c2b[_0x1b09('0x30')]=_0xa2b80f;if(_0x23ce9a[_0x1b09('0x43')][_0x1b09('0x53')]){_0x27a78c[_0x1b09('0x54')]=[{'all':!![]}];}return db['OpenchannelAccount'][_0x1b09('0x55')](_0x27a78c);})[_0x1b09('0x20')](function(_0x21b4c2){_0x147c2b['rows']=_0x21b4c2;return _0x147c2b;})['then'](respondWithFilteredResult(_0xb2ef05,_0x27a78c))[_0x1b09('0x29')](handleError(_0xb2ef05,null));};exports['show']=function(_0x2abc94,_0x3e3dc2){var _0x49b051={'raw':![],'where':{'id':_0x2abc94[_0x1b09('0x56')]['id']},'include':[{'model':db['Pause'],'as':_0x1b09('0x3d')}]},_0x17378b={};_0x17378b[_0x1b09('0x46')]=_[_0x1b09('0x57')](db[_0x1b09('0x52')][_0x1b09('0x3e')]);_0x17378b['query']=_[_0x1b09('0x57')](_0x2abc94[_0x1b09('0x43')]);_0x17378b[_0x1b09('0x44')]=_[_0x1b09('0x45')](_0x17378b[_0x1b09('0x46')],_0x17378b[_0x1b09('0x43')]);_0x49b051[_0x1b09('0x47')]=_['intersection'](_0x17378b['model'],qs[_0x1b09('0x48')](_0x2abc94[_0x1b09('0x43')][_0x1b09('0x48')]));_0x49b051['attributes']=_0x49b051[_0x1b09('0x47')][_0x1b09('0x58')]?_0x49b051[_0x1b09('0x47')]:_0x17378b['model'];if(_0x2abc94[_0x1b09('0x43')][_0x1b09('0x53')]){_0x49b051[_0x1b09('0x54')]=[{'all':!![]}];}_0x49b051=_[_0x1b09('0x4e')]({},_0x49b051,_0x2abc94[_0x1b09('0x51')]);return db[_0x1b09('0x52')][_0x1b09('0x59')](_0x49b051)[_0x1b09('0x20')](handleEntityNotFound(_0x3e3dc2,null))[_0x1b09('0x20')](respondWithResult(_0x3e3dc2,null))[_0x1b09('0x29')](handleError(_0x3e3dc2,null));};exports[_0x1b09('0x5a')]=function(_0x114ac3,_0x1950ab){return db[_0x1b09('0x52')][_0x1b09('0x5a')](_0x114ac3['body'],{})['then'](function(_0x2cc31e){var _0x54efba=_0x114ac3[_0x1b09('0x5b')][_0x1b09('0x37')]({'plain':!![]});if(!_0x54efba)throw new Error(_0x1b09('0x5c'));if(_0x54efba['role']==='user'){var _0x2cb7ba=_0x2cc31e[_0x1b09('0x37')]({'plain':!![]});var _0x5ad730=_0x1b09('0x38');return db[_0x1b09('0x5d')][_0x1b09('0x59')]({'where':{'name':_0x5ad730,'userProfileId':_0x54efba[_0x1b09('0x5e')]},'raw':!![]})[_0x1b09('0x20')](function(_0x1f8f1c){if(_0x1f8f1c&&_0x1f8f1c[_0x1b09('0x5f')]===0x0){return db['UserProfileResource'][_0x1b09('0x5a')]({'name':_0x2cb7ba['name'],'resourceId':_0x2cb7ba['id'],'type':_0x1f8f1c[_0x1b09('0x3b')],'sectionId':_0x1f8f1c['id']},{})[_0x1b09('0x20')](function(){return _0x2cc31e;});}else{return _0x2cc31e;}})[_0x1b09('0x29')](function(_0x3aa271){logger[_0x1b09('0x25')](_0x1b09('0x60'),_0x3aa271);throw _0x3aa271;});}return _0x2cc31e;})[_0x1b09('0x20')](respondWithResult(_0x1950ab,0xc9))[_0x1b09('0x29')](handleError(_0x1950ab,null));};exports[_0x1b09('0x35')]=function(_0x3e1dba,_0x391790){if(_0x3e1dba[_0x1b09('0x61')]['id']){delete _0x3e1dba['body']['id'];}return db['OpenchannelAccount'][_0x1b09('0x59')]({'where':{'id':_0x3e1dba[_0x1b09('0x56')]['id']},'include':[{'model':db[_0x1b09('0x3c')],'as':'mandatoryDispositionPause'}]})[_0x1b09('0x20')](handleEntityNotFound(_0x391790,null))[_0x1b09('0x20')](saveUpdates(_0x3e1dba[_0x1b09('0x61')],null))['then'](respondWithResult(_0x391790,null))[_0x1b09('0x29')](handleError(_0x391790,null));};exports[_0x1b09('0x36')]=function(_0x187a11,_0x49b7b6){return db[_0x1b09('0x52')]['find']({'where':{'id':_0x187a11['params']['id']}})[_0x1b09('0x20')](handleEntityNotFound(_0x49b7b6,null))[_0x1b09('0x20')](removeEntity(_0x49b7b6,null))[_0x1b09('0x29')](handleError(_0x49b7b6,null));};exports['describe']=function(_0x345b99,_0x49ec3f){return db[_0x1b09('0x52')][_0x1b09('0x62')]()['then'](respondWithResult(_0x49ec3f,null))[_0x1b09('0x29')](handleError(_0x49ec3f,null));};exports['addDisposition']=function(_0x2bd18b,_0x2a537d,_0x52b5cf){if(_0x2bd18b[_0x1b09('0x61')]['id']){delete _0x2bd18b[_0x1b09('0x61')]['id'];}return db[_0x1b09('0x52')][_0x1b09('0x59')]({'where':{'id':_0x2bd18b[_0x1b09('0x56')]['id']}})[_0x1b09('0x20')](handleEntityNotFound(_0x2a537d,null))[_0x1b09('0x20')](function(_0x576060){if(_0x576060){_0x2bd18b[_0x1b09('0x61')][_0x1b09('0x63')]=_0x576060['id'];return db[_0x1b09('0x64')]['create'](_0x2bd18b[_0x1b09('0x61')]);}})[_0x1b09('0x20')](respondWithResult(_0x2a537d,null))[_0x1b09('0x29')](handleError(_0x2a537d,null));};exports[_0x1b09('0x65')]=function(_0x25fca8,_0x5051dc,_0x130fdf){var _0x598302={'raw':![],'where':{}};var _0x3261bc={};var _0x417875={'count':0x0,'rows':[]};return db[_0x1b09('0x52')][_0x1b09('0x66')]({'where':{'id':_0x25fca8[_0x1b09('0x56')]['id']}})[_0x1b09('0x20')](handleEntityNotFound(_0x5051dc,null))[_0x1b09('0x20')](function(_0x3db691){if(_0x3db691){_0x3261bc['model']=_[_0x1b09('0x57')](db[_0x1b09('0x64')]['rawAttributes']);_0x3261bc[_0x1b09('0x43')]=_[_0x1b09('0x57')](_0x25fca8[_0x1b09('0x43')]);_0x3261bc[_0x1b09('0x44')]=_[_0x1b09('0x45')](_0x3261bc[_0x1b09('0x46')],_0x3261bc[_0x1b09('0x43')]);_0x598302[_0x1b09('0x47')]=_[_0x1b09('0x45')](_0x3261bc['model'],qs[_0x1b09('0x48')](_0x25fca8[_0x1b09('0x43')][_0x1b09('0x48')]));_0x598302[_0x1b09('0x47')]=_0x598302[_0x1b09('0x47')]['length']?_0x598302[_0x1b09('0x47')]:_0x3261bc[_0x1b09('0x46')];if(!_0x25fca8['query'][_0x1b09('0x67')]('nolimit')){_0x598302[_0x1b09('0x2e')]=qs[_0x1b09('0x2e')](_0x25fca8[_0x1b09('0x43')]['limit']);_0x598302['offset']=qs['offset'](_0x25fca8[_0x1b09('0x43')][_0x1b09('0x2d')]);}_0x598302[_0x1b09('0x4a')]=qs[_0x1b09('0x4b')](_0x25fca8[_0x1b09('0x43')][_0x1b09('0x4b')]);_0x598302[_0x1b09('0x4d')]=qs[_0x1b09('0x44')](_[_0x1b09('0x4c')](_0x25fca8[_0x1b09('0x43')],_0x3261bc[_0x1b09('0x44')]));_0x598302[_0x1b09('0x4d')]['OpenchannelAccountId']=_0x3db691['id'];if(_0x25fca8['query'][_0x1b09('0x50')]){_0x598302[_0x1b09('0x4d')]=_[_0x1b09('0x4e')](_0x598302[_0x1b09('0x4d')],{'$or':_[_0x1b09('0x42')](_0x598302[_0x1b09('0x47')],function(_0x162de1){var _0x52f219={};_0x52f219[_0x162de1]={'$like':'%'+_0x25fca8[_0x1b09('0x43')][_0x1b09('0x50')]+'%'};return _0x52f219;})});}_0x598302=_[_0x1b09('0x4e')]({},_0x598302,_0x25fca8['options']);return db[_0x1b09('0x64')][_0x1b09('0x30')]({'where':_0x598302[_0x1b09('0x4d')]})[_0x1b09('0x20')](function(_0x2d95b1){_0x417875['count']=_0x2d95b1;if(_0x25fca8['query'][_0x1b09('0x53')]){_0x598302[_0x1b09('0x54')]=[{'all':!![]}];}return db['Disposition'][_0x1b09('0x55')](_0x598302);})['then'](function(_0x3b66fc){_0x417875[_0x1b09('0x68')]=_0x3b66fc;return _0x417875;});}})[_0x1b09('0x20')](respondWithFilteredResult(_0x5051dc,_0x598302))['catch'](handleError(_0x5051dc,null));};exports[_0x1b09('0x69')]=function(_0x4c504d,_0x4c4b37,_0xaabf59){return db['OpenchannelAccount']['find']({'where':{'id':_0x4c504d['params']['id']}})[_0x1b09('0x20')](handleEntityNotFound(_0x4c4b37,null))[_0x1b09('0x20')](function(_0x24efd0){if(_0x24efd0){return _0x24efd0[_0x1b09('0x69')](_0x4c504d['query'][_0x1b09('0x6a')]);}})[_0x1b09('0x20')](respondWithStatusCode(_0x4c4b37,null))[_0x1b09('0x29')](handleError(_0x4c4b37,null));};exports[_0x1b09('0x6b')]=function(_0x388bf5,_0x4e1562,_0x3dd3ea){if(_0x388bf5[_0x1b09('0x61')]['id']){delete _0x388bf5[_0x1b09('0x61')]['id'];}return db[_0x1b09('0x52')]['find']({'where':{'id':_0x388bf5['params']['id']}})['then'](handleEntityNotFound(_0x4e1562,null))[_0x1b09('0x20')](function(_0x419add){if(_0x419add){_0x388bf5[_0x1b09('0x61')][_0x1b09('0x63')]=_0x419add['id'];return db[_0x1b09('0x6c')][_0x1b09('0x5a')](_0x388bf5['body']);}})[_0x1b09('0x20')](respondWithResult(_0x4e1562,null))[_0x1b09('0x29')](handleError(_0x4e1562,null));};exports['getAnswers']=function(_0x56be94,_0x356d3a,_0xde20b0){var _0x145a82={'raw':![],'where':{}};var _0x49a600={};var _0x5c0c7a={'count':0x0,'rows':[]};return db[_0x1b09('0x52')]['findOne']({'where':{'id':_0x56be94[_0x1b09('0x56')]['id']}})['then'](handleEntityNotFound(_0x356d3a,null))['then'](function(_0x24a450){if(_0x24a450){_0x49a600[_0x1b09('0x46')]=_[_0x1b09('0x57')](db['CannedAnswer'][_0x1b09('0x3e')]);_0x49a600[_0x1b09('0x43')]=_[_0x1b09('0x57')](_0x56be94[_0x1b09('0x43')]);_0x49a600[_0x1b09('0x44')]=_[_0x1b09('0x45')](_0x49a600[_0x1b09('0x46')],_0x49a600['query']);_0x145a82[_0x1b09('0x47')]=_['intersection'](_0x49a600[_0x1b09('0x46')],qs[_0x1b09('0x48')](_0x56be94['query'][_0x1b09('0x48')]));_0x145a82[_0x1b09('0x47')]=_0x145a82['attributes']['length']?_0x145a82[_0x1b09('0x47')]:_0x49a600[_0x1b09('0x46')];if(!_0x56be94[_0x1b09('0x43')][_0x1b09('0x67')](_0x1b09('0x49'))){_0x145a82[_0x1b09('0x2e')]=qs[_0x1b09('0x2e')](_0x56be94[_0x1b09('0x43')][_0x1b09('0x2e')]);_0x145a82[_0x1b09('0x2d')]=qs[_0x1b09('0x2d')](_0x56be94[_0x1b09('0x43')][_0x1b09('0x2d')]);}_0x145a82['order']=qs[_0x1b09('0x4b')](_0x56be94[_0x1b09('0x43')][_0x1b09('0x4b')]);_0x145a82[_0x1b09('0x4d')]=qs[_0x1b09('0x44')](_[_0x1b09('0x4c')](_0x56be94[_0x1b09('0x43')],_0x49a600[_0x1b09('0x44')]));_0x145a82[_0x1b09('0x4d')][_0x1b09('0x63')]=_0x24a450['id'];if(_0x56be94[_0x1b09('0x43')][_0x1b09('0x50')]){_0x145a82[_0x1b09('0x4d')]=_[_0x1b09('0x4e')](_0x145a82[_0x1b09('0x4d')],{'$or':_[_0x1b09('0x42')](_0x145a82['attributes'],function(_0x4ec415){var _0x47f7d2={};_0x47f7d2[_0x4ec415]={'$like':'%'+_0x56be94['query']['filter']+'%'};return _0x47f7d2;})});}_0x145a82=_[_0x1b09('0x4e')]({},_0x145a82,_0x56be94[_0x1b09('0x51')]);return db['CannedAnswer']['count']({'where':_0x145a82[_0x1b09('0x4d')]})[_0x1b09('0x20')](function(_0x36bee8){_0x5c0c7a[_0x1b09('0x30')]=_0x36bee8;if(_0x56be94[_0x1b09('0x43')][_0x1b09('0x53')]){_0x145a82[_0x1b09('0x54')]=[{'all':!![]}];}return db[_0x1b09('0x6c')][_0x1b09('0x55')](_0x145a82);})['then'](function(_0x1c1f2f){_0x5c0c7a[_0x1b09('0x68')]=_0x1c1f2f;return _0x5c0c7a;});}})[_0x1b09('0x20')](respondWithFilteredResult(_0x356d3a,_0x145a82))['catch'](handleError(_0x356d3a,null));};exports[_0x1b09('0x6d')]=function(_0xc65c0e,_0x41ec2b,_0x294866){return db[_0x1b09('0x52')][_0x1b09('0x59')]({'where':{'id':_0xc65c0e[_0x1b09('0x56')]['id']}})[_0x1b09('0x20')](handleEntityNotFound(_0x41ec2b,null))['then'](function(_0x57571b){if(_0x57571b){return _0x57571b[_0x1b09('0x6d')](_0xc65c0e['query']['ids']);}})[_0x1b09('0x20')](respondWithStatusCode(_0x41ec2b,null))[_0x1b09('0x29')](handleError(_0x41ec2b,null));};exports[_0x1b09('0x6e')]=function(_0x166415,_0x913569,_0x46f967){var _0x565223={'body':_0x166415[_0x1b09('0x61')],'channel':'openchannel'};var _0x33991c=[];var _0x3d9adc=[];var _0xcd385a={};var _0x1263d0=![];return db[_0x1b09('0x6f')]['describe']()[_0x1b09('0x20')](function(_0x5e237d){if(!_0x5e237d){throw new db[(_0x1b09('0x70'))][(_0x1b09('0x71'))]('no\x20available\x20attributes');}_0x33991c=_['difference'](_[_0x1b09('0x57')](_0x5e237d),['createdAt',_0x1b09('0x72')]);_0x3d9adc=_[_0x1b09('0x73')](_['keys'](_0x5e237d),[_0x1b09('0x74'),_0x1b09('0x72'),_0x1b09('0x75'),'ListId']);if(_0x166415[_0x1b09('0x61')]['id']){delete _0x166415[_0x1b09('0x61')]['id'];}if(_['isNil'](_0x166415[_0x1b09('0x61')][_0x1b09('0x76')])){throw new db['Sequelize'][(_0x1b09('0x71'))](_0x1b09('0x77'));}if(_[_0x1b09('0x78')](_0x166415[_0x1b09('0x61')]['body'])||_0x166415['body'][_0x1b09('0x61')]===''){throw new db[(_0x1b09('0x70'))]['ValidationError'](_0x1b09('0x79'));}if(_[_0x1b09('0x78')](_0x166415[_0x1b09('0x61')][_0x1b09('0x7a')])){throw new db[(_0x1b09('0x70'))]['ValidationError'](_0x1b09('0x7b')+_0x3d9adc);}if(!_[_0x1b09('0x7c')](_0x3d9adc,_0x166415[_0x1b09('0x61')]['mapKey'])){throw new db[(_0x1b09('0x70'))][(_0x1b09('0x71'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3d9adc);}_0xcd385a[_0x166415[_0x1b09('0x61')][_0x1b09('0x7a')]]=_0x166415[_0x1b09('0x61')][_0x1b09('0x76')];})[_0x1b09('0x20')](function(){return db[_0x1b09('0x52')]['find']({'where':{'id':_0x166415['params']['id']},'include':[{'model':db[_0x1b09('0x7d')],'as':_0x1b09('0x7e'),'include':[{'model':db[_0x1b09('0x6f')],'as':_0x1b09('0x7f'),'where':_0xcd385a,'limit':0x1,'order':[['updatedAt',_0x1b09('0x80')]]}]},{'model':db['OpenchannelApplication'],'as':_0x1b09('0x81')}]});})['then'](handleEntityNotFound(_0x913569,null))[_0x1b09('0x20')](function(_0x3e14ca){if(_0x3e14ca&&_0x3e14ca[_0x1b09('0x7e')]){_0x565223[_0x1b09('0x82')]=_0x3e14ca;_0x565223[_0x1b09('0x83')]=_0x3e14ca['Applications'];_0x565223[_0x1b09('0x84')]=_0x3e14ca[_0x1b09('0x7e')];_0x565223['applications']=_[_0x1b09('0x85')](_0x565223['applications'],['priority'],['asc']);if(_0x565223[_0x1b09('0x82')]['Applications']){delete _0x565223[_0x1b09('0x82')][_0x1b09('0x81')];}if(_0x565223[_0x1b09('0x82')][_0x1b09('0x7e')]&&_0x565223[_0x1b09('0x82')][_0x1b09('0x7e')][_0x1b09('0x7f')][_0x1b09('0x58')]){return _0x565223[_0x1b09('0x82')][_0x1b09('0x7e')][_0x1b09('0x7f')][0x0];}var _0x44552d=_['defaults'](_0x166415[_0x1b09('0x61')],{'firstName':_0x166415[_0x1b09('0x61')][_0x1b09('0x76')],'ListId':_0x3e14ca[_0x1b09('0x86')]});_0x44552d[_0x166415[_0x1b09('0x61')][_0x1b09('0x7a')]]=_0x166415['body'][_0x1b09('0x76')];return db[_0x1b09('0x6f')][_0x1b09('0x5a')](_0x44552d,{'fields':_0x33991c,'raw':!![]});}})[_0x1b09('0x20')](handleEntityNotFound(_0x913569,null))[_0x1b09('0x20')](function(_0x5d93d7){_0x565223[_0x1b09('0x87')]=_0x5d93d7;if(_0x5d93d7){var _0x37591a={'ContactId':_0x5d93d7['id'],'OpenchannelAccountId':_0x166415[_0x1b09('0x56')]['id'],'from':(_0x5d93d7['firstName']||'')+'\x20'+(_0x5d93d7['lastName']||'')};var _0xf1b0aa={'OpenchannelAccountId':_0x166415[_0x1b09('0x56')]['id'],'closed':![]};if(_0x166415['body']['threadId']){_0xf1b0aa[_0x1b09('0x88')]=_0x166415[_0x1b09('0x61')][_0x1b09('0x88')];return db[_0x1b09('0x89')][_0x1b09('0x59')]({'where':_0xf1b0aa})['then'](function(_0x3bb02e){if(_0x3bb02e){return[_0x3bb02e,![]];}_0x37591a[_0x1b09('0x88')]=_0x166415[_0x1b09('0x61')]['threadId'];_0x37591a['externalUrl']=_0x166415[_0x1b09('0x61')][_0x1b09('0x8a')];return db[_0x1b09('0x89')][_0x1b09('0x5a')](_0x37591a)[_0x1b09('0x20')](function(_0x42af18){return[_0x42af18,!![]];});});}else{_0xf1b0aa[_0x1b09('0x88')]=null;}_0xf1b0aa[_0x1b09('0x8b')]=_0x5d93d7['id'];return db['OpenchannelInteraction'][_0x1b09('0x59')]({'where':_0xf1b0aa})[_0x1b09('0x20')](function(_0x12e8e7){if(_0x12e8e7){return[_0x12e8e7,![]];}return db[_0x1b09('0x89')][_0x1b09('0x5a')](_0x37591a)[_0x1b09('0x20')](function(_0x13115f){return[_0x13115f,!![]];});});}})['spread'](function(_0x3218dd,_0x3f632a){if(_0x3218dd){_0x1263d0=_0x3f632a;if(!_0x3f632a){var _0x32639f={'from':(_0x565223[_0x1b09('0x87')][_0x1b09('0x8c')]||'')+'\x20'+(_0x565223[_0x1b09('0x87')]['lastName']||'')};if(_0x166415[_0x1b09('0x61')]['threadId']&&_0x166415['body'][_0x1b09('0x8d')]&&_0x166415[_0x1b09('0x61')]['threadId']!=_0x166415[_0x1b09('0x61')][_0x1b09('0x8d')]){_0x32639f[_0x1b09('0x88')]=_0x166415[_0x1b09('0x61')][_0x1b09('0x8d')];}return _0x3218dd[_0x1b09('0x35')](_0x32639f);}else{return _0x3218dd;}}})['then'](function(_0x94dbd5){_0x565223[_0x1b09('0x8e')]=_0x94dbd5['get']({'plain':!![]});_0x565223[_0x1b09('0x8e')][_0x1b09('0x8f')]=_0x1263d0;if(_0x565223[_0x1b09('0x8e')][_0x1b09('0x8f')]){if(_0x565223[_0x1b09('0x82')][_0x1b09('0x90')]){_0x565223[_0x1b09('0x83')]['push']({'id':0x0,'priority':_0x565223[_0x1b09('0x83')][_0x1b09('0x58')]+0x1,'app':_0x1b09('0x91'),'appdata':'unmanaged','interval':'*,*,*,*'});}}return db[_0x1b09('0x92')]['create']({'body':_0x166415[_0x1b09('0x61')][_0x1b09('0x61')],'OpenchannelAccountId':_0x166415[_0x1b09('0x56')]['id'],'OpenchannelInteractionId':_0x94dbd5['id'],'direction':'in','ContactId':_0x565223['contact']['id'],'AttachmentId':_0x166415[_0x1b09('0x61')]['AttachmentId']});})[_0x1b09('0x20')](function(_0x40876a){_0x565223['message']=_0x40876a;if(!_0x565223[_0x1b09('0x8e')][_0x1b09('0x93')])return;return db[_0x1b09('0x94')][_0x1b09('0x59')]({'attributes':['id',_0x1b09('0x3b')],'where':{'id':_0x565223[_0x1b09('0x8e')][_0x1b09('0x93')]}});})['then'](function(_0x32bd9e){if(_0x32bd9e){_0x565223[_0x1b09('0x83')][_0x1b09('0x95')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x32bd9e['name']+','+(_0x565223[_0x1b09('0x82')][_0x1b09('0x96')]||0xa),'interval':_0x1b09('0x97')});}if(!_0x565223[_0x1b09('0x8e')][_0x1b09('0x98')])return;return db[_0x1b09('0x99')][_0x1b09('0x59')]({'attributes':['id',_0x1b09('0x3b')],'where':{'id':_0x565223['interaction']['queueId']}});})[_0x1b09('0x20')](function(_0x1d3d7a){if(_0x1d3d7a){_0x565223[_0x1b09('0x83')]['unshift']({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x1d3d7a[_0x1b09('0x3b')]+','+(_0x565223[_0x1b09('0x82')][_0x1b09('0x9a')]||0x12c),'interval':_0x1b09('0x97')});}return respondWithRpcPromise('Start',_0x1b09('0x9b'),_0x565223);})['then'](function(_0x21440a){respondWithRpcPromise('EventManager',_0x1b09('0x9c'),{'event':_0x1b09('0x6e'),'message':_0x21440a},client9002);return _0x21440a;})[_0x1b09('0x20')](respondWithResult(_0x913569,null))[_0x1b09('0x29')](handleError(_0x913569,null));};exports[_0x1b09('0x9d')]=function(_0x45966e,_0x5449a3){var _0x48beeb=_0x45966e[_0x1b09('0x56')]['id'];var _0x4b5c23=_0x45966e[_0x1b09('0x61')];var _0x346237=0xc8;var _0x187853=null;return db['sequelize'][_0x1b09('0x9e')]({'isolationLevel':db[_0x1b09('0x9f')][_0x1b09('0xa0')][_0x1b09('0xa1')]['READ_COMMITTED']},function(_0x1d89c9){return db[_0x1b09('0x52')]['findOne']({'where':{'id':_0x48beeb},'transaction':_0x1d89c9})[_0x1b09('0x20')](function(_0x55ce19){if(_0x55ce19){return db[_0x1b09('0xa2')][_0x1b09('0x36')]({'where':{'OpenchannelAccountId':_0x48beeb},'transaction':_0x1d89c9})[_0x1b09('0x20')](function(){var _0x4c5109=_[_0x1b09('0x42')](_0x4b5c23,function(_0x3100fe){_0x3100fe['OpenchannelAccountId']=_0x48beeb;return _0x3100fe;});return db['OpenchannelApplication'][_0x1b09('0xa3')](_0x4c5109,{'transaction':_0x1d89c9});});}else{_0x346237=0x194;_0x187853=[];}});})[_0x1b09('0x20')](function(){if(_0x346237!==0x194){return db[_0x1b09('0xa2')][_0x1b09('0xa4')]({'where':{'OpenchannelAccountId':_0x48beeb},'order':_0x1b09('0xa5')})[_0x1b09('0x20')](function(_0x25f65b){_0x187853=_0x25f65b;});}})[_0x1b09('0x29')](function(_0x102e47){_0x346237=0x1f4;logger['error'](_0x102e47[_0x1b09('0x3a')]);if(_0x102e47['name']){delete _0x102e47[_0x1b09('0x3b')];}_0x187853=_0x102e47;})[_0x1b09('0xa6')](function(){if(_0x187853===null){_0x5449a3[_0x1b09('0x2a')](_0x346237);}else{if(_0x346237===0x1f4){_0x5449a3[_0x1b09('0x2b')](_0x346237)[_0x1b09('0xa7')](_0x187853);}else{_0x5449a3[_0x1b09('0x2b')](_0x346237)[_0x1b09('0x2c')](_0x187853);}}});};exports[_0x1b09('0xa8')]=function(_0x1894aa,_0x3ae55e,_0x5be3cd){var _0x2502e1={};var _0x47e424={};var _0x4f86c4;var _0x379628;return db[_0x1b09('0x52')]['findOne']({'where':{'id':_0x1894aa[_0x1b09('0x56')]['id']}})[_0x1b09('0x20')](handleEntityNotFound(_0x3ae55e,null))[_0x1b09('0x20')](function(_0x276056){if(_0x276056){_0x4f86c4=_0x276056;_0x47e424[_0x1b09('0x46')]=_[_0x1b09('0x57')](db[_0x1b09('0xa2')][_0x1b09('0x3e')]);_0x47e424['query']=_[_0x1b09('0x57')](_0x1894aa['query']);_0x47e424[_0x1b09('0x44')]=_[_0x1b09('0x45')](_0x47e424[_0x1b09('0x46')],_0x47e424['query']);_0x2502e1[_0x1b09('0x47')]=_[_0x1b09('0x45')](_0x47e424[_0x1b09('0x46')],qs['fields'](_0x1894aa[_0x1b09('0x43')][_0x1b09('0x48')]));_0x2502e1[_0x1b09('0x47')]=_0x2502e1['attributes'][_0x1b09('0x58')]?_0x2502e1['attributes']:_0x47e424['model'];_0x2502e1[_0x1b09('0x4a')]=qs[_0x1b09('0x4b')](_0x1894aa[_0x1b09('0x43')][_0x1b09('0x4b')]);_0x2502e1['where']=qs[_0x1b09('0x44')](_[_0x1b09('0x4c')](_0x1894aa[_0x1b09('0x43')],_0x47e424[_0x1b09('0x44')]));if(_0x1894aa[_0x1b09('0x43')][_0x1b09('0x50')]){_0x2502e1[_0x1b09('0x4d')]=_['merge'](_0x2502e1[_0x1b09('0x4d')],{'$or':_[_0x1b09('0x42')](_0x2502e1[_0x1b09('0x47')],function(_0x32ba7a){var _0x451a67={};_0x451a67[_0x32ba7a]={'$like':'%'+_0x1894aa[_0x1b09('0x43')]['filter']+'%'};return _0x451a67;})});}_0x2502e1=_[_0x1b09('0x4e')]({},_0x2502e1,_0x1894aa['options']);return _0x4f86c4[_0x1b09('0xa8')](_0x2502e1);}})['then'](function(_0x127c31){if(_0x127c31){_0x379628=_0x127c31['length'];if(!_0x1894aa[_0x1b09('0x43')][_0x1b09('0x67')](_0x1b09('0x49'))){_0x2502e1[_0x1b09('0x2e')]=qs[_0x1b09('0x2e')](_0x1894aa['query'][_0x1b09('0x2e')]);_0x2502e1[_0x1b09('0x2d')]=qs[_0x1b09('0x2d')](_0x1894aa[_0x1b09('0x43')][_0x1b09('0x2d')]);}return _0x4f86c4[_0x1b09('0xa8')](_0x2502e1);}})[_0x1b09('0x20')](function(_0x5c37e5){if(_0x5c37e5){return _0x5c37e5?{'count':_0x379628,'rows':_0x5c37e5}:null;}})[_0x1b09('0x20')](respondWithResult(_0x3ae55e,null))[_0x1b09('0x29')](handleError(_0x3ae55e,null));};exports[_0x1b09('0xa9')]=function(_0x178a84,_0x395b13,_0x322ab0){var _0x7b0026={'raw':![],'where':{}};var _0x589fd1={};var _0x372881={'count':0x0,'rows':[]};return db[_0x1b09('0x52')][_0x1b09('0x66')]({'where':{'id':_0x178a84[_0x1b09('0x56')]['id']}})[_0x1b09('0x20')](handleEntityNotFound(_0x395b13,null))[_0x1b09('0x20')](function(_0x5a3b3c){if(_0x5a3b3c){_0x589fd1[_0x1b09('0x46')]=_['keys'](db[_0x1b09('0x89')][_0x1b09('0x3e')]);_0x589fd1[_0x1b09('0x43')]=_['keys'](_0x178a84[_0x1b09('0x43')]);_0x589fd1[_0x1b09('0x44')]=_['intersection'](_0x589fd1[_0x1b09('0x46')],_0x589fd1[_0x1b09('0x43')]);_0x7b0026[_0x1b09('0x47')]=_[_0x1b09('0x45')](_0x589fd1[_0x1b09('0x46')],qs[_0x1b09('0x48')](_0x178a84['query'][_0x1b09('0x48')]));_0x7b0026[_0x1b09('0x47')]=_0x7b0026[_0x1b09('0x47')]['length']?_0x7b0026[_0x1b09('0x47')]:_0x589fd1[_0x1b09('0x46')];if(!_0x178a84[_0x1b09('0x43')][_0x1b09('0x67')]('nolimit')){_0x7b0026[_0x1b09('0x2e')]=qs[_0x1b09('0x2e')](_0x178a84[_0x1b09('0x43')][_0x1b09('0x2e')]);_0x7b0026['offset']=qs[_0x1b09('0x2d')](_0x178a84['query'][_0x1b09('0x2d')]);}_0x7b0026[_0x1b09('0x4a')]=qs['sort'](_0x178a84[_0x1b09('0x43')][_0x1b09('0x4b')]);_0x7b0026[_0x1b09('0x4d')]=qs[_0x1b09('0x44')](_[_0x1b09('0x4c')](_0x178a84[_0x1b09('0x43')],_0x589fd1[_0x1b09('0x44')]));_0x7b0026[_0x1b09('0x4d')][_0x1b09('0x63')]=_0x5a3b3c['id'];if(_0x178a84[_0x1b09('0x43')][_0x1b09('0x50')]){_0x7b0026[_0x1b09('0x4d')]=_['merge'](_0x7b0026['where'],{'$or':_[_0x1b09('0x42')](_0x7b0026['attributes'],function(_0x27c4ac){var _0xfd81aa={};_0xfd81aa[_0x27c4ac]={'$like':'%'+_0x178a84[_0x1b09('0x43')][_0x1b09('0x50')]+'%'};return _0xfd81aa;})});}_0x7b0026=_[_0x1b09('0x4e')]({},_0x7b0026,_0x178a84[_0x1b09('0x51')]);return db[_0x1b09('0x89')]['count']({'where':_0x7b0026[_0x1b09('0x4d')]})[_0x1b09('0x20')](function(_0x3c9223){_0x372881[_0x1b09('0x30')]=_0x3c9223;if(_0x178a84[_0x1b09('0x43')][_0x1b09('0x53')]){_0x7b0026[_0x1b09('0x54')]=[{'model':db[_0x1b09('0x6f')],'as':_0x1b09('0xaa'),'required':![]},{'model':db['User'],'as':_0x1b09('0xab'),'attributes':['name',_0x1b09('0xac'),_0x1b09('0xad')],'required':![]},{'model':db[_0x1b09('0xae')],'as':_0x1b09('0xaf'),'attributes':['id',_0x1b09('0x3b'),_0x1b09('0xb0')],'where':_0x178a84[_0x1b09('0x43')][_0x1b09('0xb1')]?{'id':_0x178a84[_0x1b09('0x43')]['tag']}:undefined,'required':_0x178a84['query'][_0x1b09('0xb1')]?!![]:![]}];}return db['OpenchannelInteraction'][_0x1b09('0x55')](_0x7b0026);})[_0x1b09('0x20')](function(_0xc2f345){_0x372881[_0x1b09('0x68')]=_0xc2f345;return _0x372881;});}})[_0x1b09('0x20')](respondWithFilteredResult(_0x395b13,_0x7b0026))['catch'](handleError(_0x395b13,null));};exports['addAgents']=function(_0xee8f59,_0x568853,_0x586cd8){return db[_0x1b09('0x52')][_0x1b09('0x59')]({'where':{'id':_0xee8f59[_0x1b09('0x56')]['id']}})[_0x1b09('0x20')](handleEntityNotFound(_0x568853,null))['then'](function(_0x1e55ba){if(_0x1e55ba){return _0x1e55ba[_0x1b09('0xb2')](_0xee8f59[_0x1b09('0x61')][_0x1b09('0x6a')],_[_0x1b09('0xb3')](_0xee8f59[_0x1b09('0x61')],[_0x1b09('0x6a'),'id'])||{})[_0x1b09('0xb4')](function(_0x522453){for(var _0x2e4447=0x0;_0x2e4447<_0xee8f59[_0x1b09('0x61')][_0x1b09('0x6a')]['length'];_0x2e4447+=0x1){socket[_0x1b09('0xb5')]('userOpenchannelAccount:save',{'UserId':Number(_0xee8f59[_0x1b09('0x61')]['ids'][_0x2e4447]),'OpenchannelAccountId':Number(_0xee8f59[_0x1b09('0x56')]['id'])});}return _0x522453;});}})['then'](respondWithResult(_0x568853,null))[_0x1b09('0x29')](handleError(_0x568853,null));};exports['removeAgents']=function(_0x24b132,_0x5c7bf6,_0x1158da){return db[_0x1b09('0x52')][_0x1b09('0x59')]({'where':{'id':_0x24b132[_0x1b09('0x56')]['id']}})['then'](handleEntityNotFound(_0x5c7bf6,null))[_0x1b09('0x20')](function(_0x51646b){if(_0x51646b){return _0x51646b['removeAgents'](_0x24b132[_0x1b09('0x43')][_0x1b09('0x6a')])['then'](function(){if(_[_0x1b09('0xb6')](_0x24b132[_0x1b09('0x43')][_0x1b09('0x6a')])){for(var _0x18e614=0x0;_0x18e614<_0x24b132[_0x1b09('0x43')]['ids'][_0x1b09('0x58')];_0x18e614+=0x1){socket[_0x1b09('0xb5')](_0x1b09('0xb7'),{'UserId':Number(_0x24b132[_0x1b09('0x43')][_0x1b09('0x6a')][_0x18e614]),'OpenchannelAccountId':Number(_0x24b132['params']['id'])});}}else{socket[_0x1b09('0xb5')](_0x1b09('0xb7'),{'UserId':Number(_0x24b132[_0x1b09('0x43')]['ids']),'OpenchannelAccountId':Number(_0x24b132[_0x1b09('0x56')]['id'])});}});}})['then'](respondWithStatusCode(_0x5c7bf6,null))[_0x1b09('0x29')](handleError(_0x5c7bf6,null));};exports[_0x1b09('0xb8')]=function(_0x515fdd,_0x290b4e,_0x28af93){var _0x1bdc44={};var _0x4fe7e4={};var _0x84597d;var _0x10cee7;return db['OpenchannelAccount'][_0x1b09('0x66')]({'where':{'id':_0x515fdd['params']['id']}})[_0x1b09('0x20')](handleEntityNotFound(_0x290b4e,null))[_0x1b09('0x20')](function(_0x55f50d){if(_0x55f50d){_0x84597d=_0x55f50d;_0x4fe7e4[_0x1b09('0x46')]=_['keys'](db[_0x1b09('0x94')]['rawAttributes']);_0x4fe7e4[_0x1b09('0x43')]=_['keys'](_0x515fdd[_0x1b09('0x43')]);_0x4fe7e4[_0x1b09('0x44')]=_[_0x1b09('0x45')](_0x4fe7e4[_0x1b09('0x46')],_0x4fe7e4[_0x1b09('0x43')]);_0x1bdc44[_0x1b09('0x47')]=_['intersection'](_0x4fe7e4[_0x1b09('0x46')],qs[_0x1b09('0x48')](_0x515fdd[_0x1b09('0x43')][_0x1b09('0x48')]));_0x1bdc44[_0x1b09('0x47')]=_0x1bdc44[_0x1b09('0x47')][_0x1b09('0x58')]?_0x1bdc44[_0x1b09('0x47')]:_0x4fe7e4[_0x1b09('0x46')];_0x1bdc44[_0x1b09('0x4a')]=qs[_0x1b09('0x4b')](_0x515fdd[_0x1b09('0x43')][_0x1b09('0x4b')]);_0x1bdc44[_0x1b09('0x4d')]=qs[_0x1b09('0x44')](_['pick'](_0x515fdd['query'],_0x4fe7e4['filters']));if(_0x515fdd[_0x1b09('0x43')][_0x1b09('0x50')]){_0x1bdc44[_0x1b09('0x4d')]=_[_0x1b09('0x4e')](_0x1bdc44[_0x1b09('0x4d')],{'$or':_[_0x1b09('0x42')](_0x1bdc44['attributes'],function(_0x76ef7f){var _0x2bc53c={};_0x2bc53c[_0x76ef7f]={'$like':'%'+_0x515fdd['query'][_0x1b09('0x50')]+'%'};return _0x2bc53c;})});}_0x1bdc44=_[_0x1b09('0x4e')]({},_0x1bdc44,_0x515fdd[_0x1b09('0x51')]);return _0x84597d[_0x1b09('0xb8')](_0x1bdc44);}})[_0x1b09('0x20')](function(_0x16e32a){if(_0x16e32a){_0x10cee7=_0x16e32a['length'];if(!_0x515fdd[_0x1b09('0x43')]['hasOwnProperty'](_0x1b09('0x49'))){_0x1bdc44['limit']=qs['limit'](_0x515fdd[_0x1b09('0x43')][_0x1b09('0x2e')]);_0x1bdc44[_0x1b09('0x2d')]=qs[_0x1b09('0x2d')](_0x515fdd[_0x1b09('0x43')][_0x1b09('0x2d')]);}return _0x84597d[_0x1b09('0xb8')](_0x1bdc44);}})[_0x1b09('0x20')](function(_0x9a729b){if(_0x9a729b){return _0x9a729b?{'count':_0x10cee7,'rows':_0x9a729b}:null;}})['then'](respondWithResult(_0x290b4e,null))['catch'](handleError(_0x290b4e,null));};exports[_0x1b09('0xa7')]=function(_0x2fe8ad,_0x31e606,_0x3860ce){var _0x1c2d87,_0x2974a2,_0x43eef;if(_[_0x1b09('0x78')](_0x2fe8ad[_0x1b09('0x61')]['body'])||_0x2fe8ad[_0x1b09('0x61')][_0x1b09('0x61')]===''){throw new db[(_0x1b09('0x70'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x1b09('0x78')](_0x2fe8ad[_0x1b09('0x61')]['to'])){}_0x1c2d87=_0x2fe8ad[_0x1b09('0x61')]['to'];return db[_0x1b09('0x52')][_0x1b09('0x66')]({'where':{'id':_0x2fe8ad[_0x1b09('0x56')]['id']}})[_0x1b09('0x20')](handleEntityNotFound(_0x31e606,null))[_0x1b09('0x20')](function(_0xfa18af){if(_0xfa18af){return db['OpenchannelAccount'][_0x1b09('0x59')]({'where':{'id':_0xfa18af['id']},'include':[{'model':db[_0x1b09('0x7d')],'as':'List','include':[{'model':db[_0x1b09('0x6f')],'as':_0x1b09('0x7f'),'where':{[_0xfa18af[_0x1b09('0x7a')]]:_0x1c2d87},'limit':0x1,'order':[[_0x1b09('0x72'),_0x1b09('0x80')]]}]}]})['then'](handleEntityNotFound(_0x31e606,null))[_0x1b09('0x20')](function(_0x4311ef){if(_0x4311ef&&_0x4311ef[_0x1b09('0x7e')]){_0x2974a2=_0x4311ef[_0x1b09('0x37')]({'plain':!![]});if(_0x2974a2[_0x1b09('0x7e')]&&_0x2974a2[_0x1b09('0x7e')][_0x1b09('0x7f')][_0x1b09('0x58')]){return _0x2974a2['List'][_0x1b09('0x7f')][0x0];}return db[_0x1b09('0x6f')][_0x1b09('0x5a')](_[_0x1b09('0x19')](_0x2fe8ad[_0x1b09('0x61')],{'firstName':_0x1c2d87,[_0x4311ef['mapKey']]:_0x1c2d87,'phone':_0x1c2d87,'ListId':_0x2974a2[_0x1b09('0x86')]}));}})[_0x1b09('0x20')](handleEntityNotFound(_0x31e606,null))[_0x1b09('0x20')](function(_0x216b75){if(_0x216b75){_0x43eef=_0x216b75;return db[_0x1b09('0x89')]['find']({'where':{'ContactId':_0x43eef['id'],'closed':![],'OpenchannelAccountId':_0x2974a2['id']}})[_0x1b09('0x20')](function(_0x33ab1f){if(_0x33ab1f){return[_0x33ab1f,![]];}return db['OpenchannelInteraction']['create']({'UserId':_0x2fe8ad[_0x1b09('0x5b')]['id'],'ContactId':_0x43eef['id'],'OpenchannelAccountId':_0x2974a2['id'],'lastMsgDirection':_0x1b09('0xb9'),'firstMsgDirection':'out','Messages':[_['merge'](_0x2fe8ad[_0x1b09('0x61')],{'read':![],'body':_0x2fe8ad[_0x1b09('0x61')][_0x1b09('0x61')],'OpenchannelAccountId':_0x2974a2['id'],'UserId':_0x2fe8ad[_0x1b09('0x5b')]['id'],'ContactId':_0x43eef['id']})]},{'include':[{'model':db[_0x1b09('0x92')],'as':_0x1b09('0xba')}]})['then'](function(_0x32d515){return[_0x32d515,!![]];});});}})[_0x1b09('0xb4')](function(_0x3aa637,_0x266c5d){if(_0x266c5d){return _0x3aa637;}return db[_0x1b09('0x92')][_0x1b09('0x5a')](_[_0x1b09('0x4e')](_0x2fe8ad[_0x1b09('0x61')],{'read':![],'body':_0x2fe8ad[_0x1b09('0x61')][_0x1b09('0x61')],'OpenchannelAccountId':_0x2974a2['id'],'OpenchannelInteractionId':_0x3aa637['id'],'UserId':_0x2fe8ad[_0x1b09('0x5b')]['id'],'ContactId':_0x43eef['id']}))['then'](function(_0x3104b7){_0x3aa637[_0x1b09('0xbb')][_0x1b09('0xba')]=[];_0x3aa637[_0x1b09('0xbb')][_0x1b09('0xba')]['push'](_0x3104b7[_0x1b09('0xbb')]);return _0x3aa637;});});}})[_0x1b09('0x20')](respondWithResult(_0x31e606,null))[_0x1b09('0x29')](handleError(_0x31e606,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 61ba889..85a0ce2 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 _0x4483=['../../mysqldb','OpenchannelAccount','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x4483,0x1a3));var _0x3448=function(_0x3e68b5,_0x237d2e){_0x3e68b5=_0x3e68b5-0x0;var _0x1be285=_0x4483[_0x3e68b5];return _0x1be285;};'use strict';var EventEmitter=require(_0x3448('0x0'));var OpenchannelAccount=require(_0x3448('0x1'))['db'][_0x3448('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3448('0x3'),'afterUpdate':_0x3448('0x4'),'afterDestroy':_0x3448('0x5')};function emitEvent(_0x3a7178){return function(_0xef1a93,_0x5f5163,_0xeb5b8){OpenchannelAccountEvents[_0x3448('0x6')](_0x3a7178+':'+_0xef1a93['id'],_0xef1a93);OpenchannelAccountEvents[_0x3448('0x6')](_0x3a7178,_0xef1a93);_0xeb5b8(null);};}for(var e in events){if(events[_0x3448('0x7')](e)){var event=events[e];OpenchannelAccount[_0x3448('0x8')](e,emitEvent(event));}}module[_0x3448('0x9')]=OpenchannelAccountEvents; \ No newline at end of file +var _0xec56=['emit','hasOwnProperty','hook','exports','events','setMaxListeners','save','update','remove'];(function(_0x2e6dbf,_0x57dd06){var _0x2680e5=function(_0x4018f4){while(--_0x4018f4){_0x2e6dbf['push'](_0x2e6dbf['shift']());}};_0x2680e5(++_0x57dd06);}(_0xec56,0x1bd));var _0x6ec5=function(_0x534c77,_0x43a1f7){_0x534c77=_0x534c77-0x0;var _0x37a241=_0xec56[_0x534c77];return _0x37a241;};'use strict';var EventEmitter=require(_0x6ec5('0x0'));var OpenchannelAccount=require('../../mysqldb')['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x6ec5('0x1')](0x0);var events={'afterCreate':_0x6ec5('0x2'),'afterUpdate':_0x6ec5('0x3'),'afterDestroy':_0x6ec5('0x4')};function emitEvent(_0x43c2cd){return function(_0x399441,_0x469679,_0x173aeb){OpenchannelAccountEvents[_0x6ec5('0x5')](_0x43c2cd+':'+_0x399441['id'],_0x399441);OpenchannelAccountEvents[_0x6ec5('0x5')](_0x43c2cd,_0x399441);_0x173aeb(null);};}for(var e in events){if(events[_0x6ec5('0x6')](e)){var event=events[e];OpenchannelAccount[_0x6ec5('0x7')](e,emitEvent(event));}}module[_0x6ec5('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 d1ed3de..f02d4b4 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(_0x5d6b93,_0x2e08c5){var _0x5169af=function(_0xe23448){while(--_0xe23448){_0x5d6b93['push'](_0x5d6b93['shift']());}};_0x5169af(++_0x2e08c5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xa9e0[_0x4baae2];return _0x1a2285;};'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(_0xeb1914,_0x53e264){var _0x15f7f3=function(_0x5dc097){while(--_0x5dc097){_0xeb1914['push'](_0xeb1914['shift']());}};_0x15f7f3(++_0x53e264);}(_0xa9e0,0x123));var _0x0a9e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa9e0[_0x501510];return _0x1e6ee5;};'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 5dca46a..7609bb7 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 _0xbdb7=['http','redis','localhost','socket.io-emitter','register','request','then','request\x20sent','debug','error','code','message','OpenchannelAccount,\x20%s,\x20%s','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x52002d,_0x56a4b7){var _0x255b0e=function(_0x10ab9b){while(--_0x10ab9b){_0x52002d['push'](_0x52002d['shift']());}};_0x255b0e(++_0x56a4b7);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x15876c,_0x510dd4){_0x15876c=_0x15876c-0x0;var _0x39d91b=_0xbdb7[_0x15876c];return _0x39d91b;};'use strict';var _=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var moment=require(_0x7bdb('0x2'));var BPromise=require(_0x7bdb('0x3'));var rs=require(_0x7bdb('0x4'));var fs=require('fs');var Redis=require(_0x7bdb('0x5'));var db=require(_0x7bdb('0x6'))['db'];var utils=require(_0x7bdb('0x7'));var logger=require(_0x7bdb('0x8'))('rpc');var config=require(_0x7bdb('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7bdb('0xa')]({'port':0x232a});config[_0x7bdb('0xb')]=_['defaults'](config['redis'],{'host':_0x7bdb('0xc'),'port':0x18eb});var socket=require(_0x7bdb('0xd'))(new Redis(config['redis']));require('./openchannelAccount.socket')[_0x7bdb('0xe')](socket);function respondWithRpcPromise(_0x1a6b61,_0x2cb569,_0x2c328e){return new BPromise(function(_0x27297d,_0x144ff7){return client[_0x7bdb('0xf')](_0x1a6b61,_0x2c328e)[_0x7bdb('0x10')](function(_0x5462da){logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x2cb569,_0x7bdb('0x11'));logger[_0x7bdb('0x12')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x2cb569,_0x7bdb('0x11'),JSON['stringify'](_0x5462da));if(_0x5462da['error']){if(_0x5462da[_0x7bdb('0x13')][_0x7bdb('0x14')]===0x1f4){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x2cb569,_0x5462da['error'][_0x7bdb('0x15')]);return _0x144ff7(_0x5462da[_0x7bdb('0x13')][_0x7bdb('0x15')]);}logger[_0x7bdb('0x13')](_0x7bdb('0x16'),_0x2cb569,_0x5462da[_0x7bdb('0x13')][_0x7bdb('0x15')]);return _0x27297d(_0x5462da[_0x7bdb('0x13')]['message']);}else{logger[_0x7bdb('0x17')](_0x7bdb('0x16'),_0x2cb569,_0x7bdb('0x11'));_0x27297d(_0x5462da[_0x7bdb('0x18')]['message']);}})[_0x7bdb('0x19')](function(_0x23e9eb){logger['error'](_0x7bdb('0x16'),_0x2cb569,_0x23e9eb);_0x144ff7(_0x23e9eb);});});} \ No newline at end of file +var _0xbc9d=['moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./openchannelAccount.socket','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util'];(function(_0x144492,_0x18dd3b){var _0x55995e=function(_0x420906){while(--_0x420906){_0x144492['push'](_0x144492['shift']());}};_0x55995e(++_0x18dd3b);}(_0xbc9d,0xb4));var _0xdbc9=function(_0x18ff0c,_0x129418){_0x18ff0c=_0x18ff0c-0x0;var _0x53dcbf=_0xbc9d[_0x18ff0c];return _0x53dcbf;};'use strict';var _=require(_0xdbc9('0x0'));var util=require(_0xdbc9('0x1'));var moment=require(_0xdbc9('0x2'));var BPromise=require(_0xdbc9('0x3'));var rs=require(_0xdbc9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xdbc9('0x5'))(_0xdbc9('0x6'));var config=require(_0xdbc9('0x7'));var jayson=require(_0xdbc9('0x8'));var client=jayson[_0xdbc9('0x9')][_0xdbc9('0xa')]({'port':0x232a});config[_0xdbc9('0xb')]=_['defaults'](config[_0xdbc9('0xb')],{'host':_0xdbc9('0xc'),'port':0x18eb});var socket=require(_0xdbc9('0xd'))(new Redis(config['redis']));require(_0xdbc9('0xe'))['register'](socket);function respondWithRpcPromise(_0x5b5de2,_0x11b448,_0xe9bbde){return new BPromise(function(_0x19be1d,_0x2f5e6d){return client['request'](_0x5b5de2,_0xe9bbde)[_0xdbc9('0xf')](function(_0x187149){logger[_0xdbc9('0x10')](_0xdbc9('0x11'),_0x11b448,_0xdbc9('0x12'));logger[_0xdbc9('0x13')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x11b448,'request\x20sent',JSON[_0xdbc9('0x14')](_0x187149));if(_0x187149[_0xdbc9('0x15')]){if(_0x187149[_0xdbc9('0x15')][_0xdbc9('0x16')]===0x1f4){logger[_0xdbc9('0x15')]('OpenchannelAccount,\x20%s,\x20%s',_0x11b448,_0x187149[_0xdbc9('0x15')][_0xdbc9('0x17')]);return _0x2f5e6d(_0x187149[_0xdbc9('0x15')]['message']);}logger[_0xdbc9('0x15')](_0xdbc9('0x11'),_0x11b448,_0x187149['error'][_0xdbc9('0x17')]);return _0x19be1d(_0x187149[_0xdbc9('0x15')][_0xdbc9('0x17')]);}else{logger[_0xdbc9('0x10')](_0xdbc9('0x11'),_0x11b448,_0xdbc9('0x12'));_0x19be1d(_0x187149[_0xdbc9('0x18')][_0xdbc9('0x17')]);}})[_0xdbc9('0x19')](function(_0x981fc0){logger['error'](_0xdbc9('0x11'),_0x11b448,_0x981fc0);_0x2f5e6d(_0x981fc0);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 5e11010..10b193f 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 _0x5bc5=['register','length','./openchannelAccount.events','save','remove','update','emit','removeListener'];(function(_0x12ca5f,_0x223d98){var _0xfc3ae9=function(_0x1928fb){while(--_0x1928fb){_0x12ca5f['push'](_0x12ca5f['shift']());}};_0xfc3ae9(++_0x223d98);}(_0x5bc5,0xb2));var _0x55bc=function(_0x456a4b,_0x51df8){_0x456a4b=_0x456a4b-0x0;var _0x42957c=_0x5bc5[_0x456a4b];return _0x42957c;};'use strict';var OpenchannelAccountEvents=require(_0x55bc('0x0'));var events=[_0x55bc('0x1'),_0x55bc('0x2'),_0x55bc('0x3')];function createListener(_0x19006b,_0x2e077d){return function(_0x2ebc5a){_0x2e077d[_0x55bc('0x4')](_0x19006b,_0x2ebc5a);};}function removeListener(_0xa94795,_0x1ea633){return function(){OpenchannelAccountEvents[_0x55bc('0x5')](_0xa94795,_0x1ea633);};}exports[_0x55bc('0x6')]=function(_0x188eb6){for(var _0x5d5f1d=0x0,_0x4d78d6=events[_0x55bc('0x7')];_0x5d5f1d<_0x4d78d6;_0x5d5f1d++){var _0x2a612b=events[_0x5d5f1d];var _0x38839e=createListener('openchannelAccount:'+_0x2a612b,_0x188eb6);OpenchannelAccountEvents['on'](_0x2a612b,_0x38839e);}}; \ No newline at end of file +var _0x0531=['emit','removeListener','register','length','openchannelAccount:','./openchannelAccount.events','save'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0531,0xde));var _0x1053=function(_0x49c057,_0xc808ed){_0x49c057=_0x49c057-0x0;var _0xd8f0e6=_0x0531[_0x49c057];return _0xd8f0e6;};'use strict';var OpenchannelAccountEvents=require(_0x1053('0x0'));var events=[_0x1053('0x1'),'remove','update'];function createListener(_0x450b81,_0x48bca0){return function(_0x5ced96){_0x48bca0[_0x1053('0x2')](_0x450b81,_0x5ced96);};}function removeListener(_0x117b5a,_0x12d7ea){return function(){OpenchannelAccountEvents[_0x1053('0x3')](_0x117b5a,_0x12d7ea);};}exports[_0x1053('0x4')]=function(_0x5d8ce2){for(var _0x29e7cd=0x0,_0x3350a0=events[_0x1053('0x5')];_0x29e7cd<_0x3350a0;_0x29e7cd++){var _0x3d052e=events[_0x29e7cd];var _0x4f1877=createListener(_0x1053('0x6')+_0x3d052e,_0x5d8ce2);OpenchannelAccountEvents['on'](_0x3d052e,_0x4f1877);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 1067ffe..6d9ed9d 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 _0x67d1=['path','connect-timeout','express','Router','../../components/interaction/service','./openchannelApplication.controller','get','isAuthenticated','/:id','post','create','put','update','delete','destroy','exports','multer','util'];(function(_0x125ff8,_0x41925f){var _0x2d9ef=function(_0x4ef34c){while(--_0x4ef34c){_0x125ff8['push'](_0x125ff8['shift']());}};_0x2d9ef(++_0x41925f);}(_0x67d1,0x166));var _0x167d=function(_0x565ed7,_0x398228){_0x565ed7=_0x565ed7-0x0;var _0x183ad7=_0x67d1[_0x565ed7];return _0x183ad7;};'use strict';var multer=require(_0x167d('0x0'));var util=require(_0x167d('0x1'));var path=require(_0x167d('0x2'));var timeout=require(_0x167d('0x3'));var express=require(_0x167d('0x4'));var router=express[_0x167d('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x167d('0x6'));var config=require('../../config/environment');var controller=require(_0x167d('0x7'));router[_0x167d('0x8')]('/',auth[_0x167d('0x9')](),controller['index']);router[_0x167d('0x8')](_0x167d('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x167d('0xb')]('/',auth[_0x167d('0x9')](),controller[_0x167d('0xc')]);router[_0x167d('0xd')](_0x167d('0xa'),auth[_0x167d('0x9')](),controller[_0x167d('0xe')]);router[_0x167d('0xf')]('/:id',auth[_0x167d('0x9')](),controller[_0x167d('0x10')]);module[_0x167d('0x11')]=router; \ No newline at end of file +var _0x9907=['show','post','update','destroy','exports','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id'];(function(_0x571d97,_0x37b351){var _0x1d916a=function(_0x5dcb54){while(--_0x5dcb54){_0x571d97['push'](_0x571d97['shift']());}};_0x1d916a(++_0x37b351);}(_0x9907,0x1c7));var _0x7990=function(_0x5ad0d7,_0x2645f8){_0x5ad0d7=_0x5ad0d7-0x0;var _0xd83bd=_0x9907[_0x5ad0d7];return _0xd83bd;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x7990('0x0'));var express=require(_0x7990('0x1'));var router=express[_0x7990('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x7990('0x3'));var interaction=require(_0x7990('0x4'));var config=require(_0x7990('0x5'));var controller=require('./openchannelApplication.controller');router[_0x7990('0x6')]('/',auth[_0x7990('0x7')](),controller[_0x7990('0x8')]);router['get'](_0x7990('0x9'),auth[_0x7990('0x7')](),controller[_0x7990('0xa')]);router[_0x7990('0xb')]('/',auth[_0x7990('0x7')](),controller['create']);router['put'](_0x7990('0x9'),auth[_0x7990('0x7')](),controller[_0x7990('0xc')]);router['delete'](_0x7990('0x9'),auth[_0x7990('0x7')](),controller[_0x7990('0xd')]);module[_0x7990('0xe')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 351c170..cfe0b20 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 _0x670f=['*,*,*,*','sequelize','exports','INTEGER','STRING','TEXT'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x670f,0xcd));var _0xf670=function(_0x3775e3,_0x159b92){_0x3775e3=_0x3775e3-0x0;var _0x265a20=_0x670f[_0x3775e3];return _0x265a20;};'use strict';var Sequelize=require(_0xf670('0x0'));module[_0xf670('0x1')]={'priority':{'type':Sequelize[_0xf670('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xf670('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xf670('0x4')]()},'description':{'type':Sequelize[_0xf670('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xf670('0x5')}}; \ No newline at end of file +var _0x882a=['STRING','TEXT','*,*,*,*','sequelize'];(function(_0x99ea58,_0x137c1a){var _0x319e3b=function(_0x13489f){while(--_0x13489f){_0x99ea58['push'](_0x99ea58['shift']());}};_0x319e3b(++_0x137c1a);}(_0x882a,0x1e7));var _0xa882=function(_0x100bbe,_0x1f1a15){_0x100bbe=_0x100bbe-0x0;var _0x14ddab=_0x882a[_0x100bbe];return _0x14ddab;};'use strict';var Sequelize=require(_0xa882('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xa882('0x1')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xa882('0x2')]()},'description':{'type':Sequelize[_0xa882('0x1')]},'interval':{'type':Sequelize[_0xa882('0x1')],'defaultValue':_0xa882('0x3')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 6c143ac..b2d48d0 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 _0x0dbe=['ejs','fs-extra','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','Content-Range','apply','reject','save','destroy','then','sendStatus','error','stack','name','map','OpenchannelApplication','rawAttributes','fieldName','key','keys','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','options','create','update','body','params','find','rimraf','zip-dir','request-promise','moment','mustache','path','sox','to-csv'];(function(_0x36284d,_0x5782d3){var _0x5a6ea8=function(_0x335b45){while(--_0x335b45){_0x36284d['push'](_0x36284d['shift']());}};_0x5a6ea8(++_0x5782d3);}(_0x0dbe,0x16f));var _0xe0db=function(_0x393d69,_0x3a8c83){_0x393d69=_0x393d69-0x0;var _0x3cee37=_0x0dbe[_0x393d69];return _0x3cee37;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe0db('0x0'));var zipdir=require(_0xe0db('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe0db('0x2'));var moment=require(_0xe0db('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xe0db('0x4'));var util=require('util');var path=require(_0xe0db('0x5'));var sox=require(_0xe0db('0x6'));var csv=require(_0xe0db('0x7'));var ejs=require(_0xe0db('0x8'));var fs=require('fs');var fs_extra=require(_0xe0db('0x9'));var _=require('lodash');var squel=require(_0xe0db('0xa'));var crypto=require(_0xe0db('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xe0db('0x7'));var querystring=require(_0xe0db('0xc'));var Papa=require(_0xe0db('0xd'));var Redis=require(_0xe0db('0xe'));var authService=require(_0xe0db('0xf'));var qs=require(_0xe0db('0x10'));var as=require(_0xe0db('0x11'));var hardwareService=require(_0xe0db('0x12'));var logger=require(_0xe0db('0x13'))(_0xe0db('0x14'));var utils=require(_0xe0db('0x15'));var config=require(_0xe0db('0x16'));var licenseUtil=require(_0xe0db('0x17'));var db=require(_0xe0db('0x18'))['db'];function respondWithStatusCode(_0x3bf8cc,_0x432d8c){_0x432d8c=_0x432d8c||0xcc;return function(_0x1f0e21){if(_0x1f0e21){return _0x3bf8cc['sendStatus'](_0x432d8c);}return _0x3bf8cc[_0xe0db('0x19')](_0x432d8c)[_0xe0db('0x1a')]();};}function respondWithResult(_0x37b9cd,_0x284a12){_0x284a12=_0x284a12||0xc8;return function(_0x3413af){if(_0x3413af){return _0x37b9cd['status'](_0x284a12)[_0xe0db('0x1b')](_0x3413af);}};}function respondWithFilteredResult(_0x34dc78,_0x5b772a){return function(_0x4715b5){if(_0x4715b5){var _0x54921e=typeof _0x5b772a[_0xe0db('0x1c')]===_0xe0db('0x1d')&&typeof _0x5b772a[_0xe0db('0x1e')]==='undefined';var _0x2f43e8=_0x4715b5['count'];var _0x35feae=_0x54921e?0x0:_0x5b772a[_0xe0db('0x1c')];var _0x38477e=_0x54921e?_0x4715b5['count']:_0x5b772a['offset']+_0x5b772a[_0xe0db('0x1e')];var _0x17a20e;if(_0x38477e>=_0x2f43e8){_0x38477e=_0x2f43e8;_0x17a20e=0xc8;}else{_0x17a20e=0xce;}_0x34dc78['status'](_0x17a20e);return _0x34dc78['set'](_0xe0db('0x1f'),_0x35feae+'-'+_0x38477e+'/'+_0x2f43e8)['json'](_0x4715b5);}return null;};}function patchUpdates(_0x2c456b){return function(_0x33e755){try{jsonpatch[_0xe0db('0x20')](_0x33e755,_0x2c456b,!![]);}catch(_0x2055ee){return BPromise[_0xe0db('0x21')](_0x2055ee);}return _0x33e755[_0xe0db('0x22')]();};}function saveUpdates(_0x164320,_0x53dc0d){return function(_0x4ab137){if(_0x4ab137){return _0x4ab137['update'](_0x164320)['then'](function(_0x5e176e){return _0x5e176e;});}return null;};}function removeEntity(_0x57fb88,_0x269bad){return function(_0x17f06d){if(_0x17f06d){return _0x17f06d[_0xe0db('0x23')]()[_0xe0db('0x24')](function(){_0x57fb88['status'](0xcc)[_0xe0db('0x1a')]();});}};}function handleEntityNotFound(_0x1bd06e,_0x2f2f7d){return function(_0x1f6da9){if(!_0x1f6da9){_0x1bd06e[_0xe0db('0x25')](0x194);}return _0x1f6da9;};}function handleError(_0x580134,_0x1487ed){_0x1487ed=_0x1487ed||0x1f4;return function(_0x41c23f){logger[_0xe0db('0x26')](_0x41c23f[_0xe0db('0x27')]);if(_0x41c23f[_0xe0db('0x28')]){delete _0x41c23f[_0xe0db('0x28')];}_0x580134[_0xe0db('0x19')](_0x1487ed)['send'](_0x41c23f);};}exports['index']=function(_0x43a58c,_0x20dcb4){var _0x3d95f0={},_0x3f8b00={},_0x63a828={'count':0x0,'rows':[]};var _0x262f48=_[_0xe0db('0x29')](db[_0xe0db('0x2a')][_0xe0db('0x2b')],function(_0x55982d){return{'name':_0x55982d[_0xe0db('0x2c')],'type':_0x55982d['type'][_0xe0db('0x2d')]};});_0x3f8b00['model']=_[_0xe0db('0x29')](_0x262f48,'name');_0x3f8b00['query']=_[_0xe0db('0x2e')](_0x43a58c[_0xe0db('0x2f')]);_0x3f8b00[_0xe0db('0x30')]=_[_0xe0db('0x31')](_0x3f8b00['model'],_0x3f8b00[_0xe0db('0x2f')]);_0x3d95f0[_0xe0db('0x32')]=_[_0xe0db('0x31')](_0x3f8b00[_0xe0db('0x33')],qs[_0xe0db('0x34')](_0x43a58c[_0xe0db('0x2f')][_0xe0db('0x34')]));_0x3d95f0[_0xe0db('0x32')]=_0x3d95f0[_0xe0db('0x32')][_0xe0db('0x35')]?_0x3d95f0['attributes']:_0x3f8b00[_0xe0db('0x33')];if(!_0x43a58c[_0xe0db('0x2f')][_0xe0db('0x36')](_0xe0db('0x37'))){_0x3d95f0[_0xe0db('0x1e')]=qs[_0xe0db('0x1e')](_0x43a58c[_0xe0db('0x2f')]['limit']);_0x3d95f0[_0xe0db('0x1c')]=qs[_0xe0db('0x1c')](_0x43a58c[_0xe0db('0x2f')][_0xe0db('0x1c')]);}_0x3d95f0['order']=qs[_0xe0db('0x38')](_0x43a58c[_0xe0db('0x2f')][_0xe0db('0x38')]);_0x3d95f0[_0xe0db('0x39')]=qs[_0xe0db('0x30')](_[_0xe0db('0x3a')](_0x43a58c[_0xe0db('0x2f')],_0x3f8b00[_0xe0db('0x30')]),_0x262f48);if(_0x43a58c['query'][_0xe0db('0x3b')]){_0x3d95f0[_0xe0db('0x39')]=_[_0xe0db('0x3c')](_0x3d95f0[_0xe0db('0x39')],{'$or':_[_0xe0db('0x29')](_0x262f48,function(_0x1642a0){if(_0x1642a0[_0xe0db('0x3d')]!==_0xe0db('0x3e')){var _0x3a2cc9={};_0x3a2cc9[_0x1642a0[_0xe0db('0x28')]]={'$like':'%'+_0x43a58c['query']['filter']+'%'};return _0x3a2cc9;}})});}_0x3d95f0=_[_0xe0db('0x3c')]({},_0x3d95f0,_0x43a58c['options']);var _0x4ce002={'where':_0x3d95f0[_0xe0db('0x39')]};return db[_0xe0db('0x2a')]['count'](_0x4ce002)[_0xe0db('0x24')](function(_0x323774){_0x63a828['count']=_0x323774;if(_0x43a58c['query'][_0xe0db('0x3f')]){_0x3d95f0[_0xe0db('0x40')]=[{'all':!![]}];}return db[_0xe0db('0x2a')][_0xe0db('0x41')](_0x3d95f0);})[_0xe0db('0x24')](function(_0x5d68ea){_0x63a828[_0xe0db('0x42')]=_0x5d68ea;return _0x63a828;})[_0xe0db('0x24')](respondWithFilteredResult(_0x20dcb4,_0x3d95f0))[_0xe0db('0x43')](handleError(_0x20dcb4,null));};exports[_0xe0db('0x44')]=function(_0x43a5c3,_0x498e63){var _0x26aed7={'raw':!![],'where':{'id':_0x43a5c3['params']['id']}},_0x1e8c6b={};_0x1e8c6b[_0xe0db('0x33')]=_[_0xe0db('0x2e')](db[_0xe0db('0x2a')][_0xe0db('0x2b')]);_0x1e8c6b[_0xe0db('0x2f')]=_['keys'](_0x43a5c3['query']);_0x1e8c6b[_0xe0db('0x30')]=_['intersection'](_0x1e8c6b['model'],_0x1e8c6b[_0xe0db('0x2f')]);_0x26aed7['attributes']=_[_0xe0db('0x31')](_0x1e8c6b['model'],qs['fields'](_0x43a5c3['query']['fields']));_0x26aed7[_0xe0db('0x32')]=_0x26aed7[_0xe0db('0x32')][_0xe0db('0x35')]?_0x26aed7[_0xe0db('0x32')]:_0x1e8c6b[_0xe0db('0x33')];if(_0x43a5c3[_0xe0db('0x2f')][_0xe0db('0x3f')]){_0x26aed7[_0xe0db('0x40')]=[{'all':!![]}];}_0x26aed7=_[_0xe0db('0x3c')]({},_0x26aed7,_0x43a5c3[_0xe0db('0x45')]);return db[_0xe0db('0x2a')]['find'](_0x26aed7)[_0xe0db('0x24')](handleEntityNotFound(_0x498e63,null))['then'](respondWithResult(_0x498e63,null))['catch'](handleError(_0x498e63,null));};exports['create']=function(_0x5e6fa1,_0x2079ad){return db[_0xe0db('0x2a')][_0xe0db('0x46')](_0x5e6fa1['body'],{})[_0xe0db('0x24')](respondWithResult(_0x2079ad,0xc9))['catch'](handleError(_0x2079ad,null));};exports[_0xe0db('0x47')]=function(_0x1ed757,_0x84d5e1){if(_0x1ed757[_0xe0db('0x48')]['id']){delete _0x1ed757['body']['id'];}return db[_0xe0db('0x2a')]['find']({'where':{'id':_0x1ed757[_0xe0db('0x49')]['id']}})[_0xe0db('0x24')](handleEntityNotFound(_0x84d5e1,null))[_0xe0db('0x24')](saveUpdates(_0x1ed757[_0xe0db('0x48')],null))['then'](respondWithResult(_0x84d5e1,null))[_0xe0db('0x43')](handleError(_0x84d5e1,null));};exports['destroy']=function(_0x4dc998,_0xc8b214){return db[_0xe0db('0x2a')][_0xe0db('0x4a')]({'where':{'id':_0x4dc998[_0xe0db('0x49')]['id']}})[_0xe0db('0x24')](handleEntityNotFound(_0xc8b214,null))[_0xe0db('0x24')](removeEntity(_0xc8b214,null))[_0xe0db('0x43')](handleError(_0xc8b214,null));}; \ No newline at end of file +var _0x2b87=['moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','save','then','destroy','error','name','send','index','OpenchannelApplication','rawAttributes','type','key','map','keys','query','model','intersection','fields','attributes','length','sort','where','pick','filters','filter','merge','options','includeAll','include','rows','params','catch','create','body','update','find','zip-dir','fast-json-patch','request-promise'];(function(_0x2a6809,_0x44edde){var _0x11c371=function(_0x1a4888){while(--_0x1a4888){_0x2a6809['push'](_0x2a6809['shift']());}};_0x11c371(++_0x44edde);}(_0x2b87,0x111));var _0x72b8=function(_0x348df0,_0x50076b){_0x348df0=_0x348df0-0x0;var _0x53f21a=_0x2b87[_0x348df0];return _0x53f21a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x72b8('0x0'));var jsonpatch=require(_0x72b8('0x1'));var rp=require(_0x72b8('0x2'));var moment=require(_0x72b8('0x3'));var BPromise=require(_0x72b8('0x4'));var Mustache=require(_0x72b8('0x5'));var util=require(_0x72b8('0x6'));var path=require(_0x72b8('0x7'));var sox=require(_0x72b8('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x72b8('0x9'));var _=require(_0x72b8('0xa'));var squel=require(_0x72b8('0xb'));var crypto=require(_0x72b8('0xc'));var jsforce=require(_0x72b8('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x72b8('0xe'));var Papa=require(_0x72b8('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x72b8('0x10'));var hardwareService=require(_0x72b8('0x11'));var logger=require(_0x72b8('0x12'))(_0x72b8('0x13'));var utils=require(_0x72b8('0x14'));var config=require(_0x72b8('0x15'));var licenseUtil=require(_0x72b8('0x16'));var db=require(_0x72b8('0x17'))['db'];function respondWithStatusCode(_0x2772ee,_0x164606){_0x164606=_0x164606||0xcc;return function(_0x575669){if(_0x575669){return _0x2772ee[_0x72b8('0x18')](_0x164606);}return _0x2772ee[_0x72b8('0x19')](_0x164606)[_0x72b8('0x1a')]();};}function respondWithResult(_0x45944c,_0x4b581b){_0x4b581b=_0x4b581b||0xc8;return function(_0x2d4698){if(_0x2d4698){return _0x45944c[_0x72b8('0x19')](_0x4b581b)[_0x72b8('0x1b')](_0x2d4698);}};}function respondWithFilteredResult(_0x4aafe2,_0x292e3d){return function(_0x108af2){if(_0x108af2){var _0x2bc098=typeof _0x292e3d[_0x72b8('0x1c')]===_0x72b8('0x1d')&&typeof _0x292e3d['limit']==='undefined';var _0xb5c7d4=_0x108af2[_0x72b8('0x1e')];var _0x1e83ea=_0x2bc098?0x0:_0x292e3d[_0x72b8('0x1c')];var _0x2b8d14=_0x2bc098?_0x108af2[_0x72b8('0x1e')]:_0x292e3d[_0x72b8('0x1c')]+_0x292e3d[_0x72b8('0x1f')];var _0x26e188;if(_0x2b8d14>=_0xb5c7d4){_0x2b8d14=_0xb5c7d4;_0x26e188=0xc8;}else{_0x26e188=0xce;}_0x4aafe2['status'](_0x26e188);return _0x4aafe2['set'](_0x72b8('0x20'),_0x1e83ea+'-'+_0x2b8d14+'/'+_0xb5c7d4)[_0x72b8('0x1b')](_0x108af2);}return null;};}function patchUpdates(_0x1331af){return function(_0x517f8b){try{jsonpatch[_0x72b8('0x21')](_0x517f8b,_0x1331af,!![]);}catch(_0x1e89d0){return BPromise['reject'](_0x1e89d0);}return _0x517f8b[_0x72b8('0x22')]();};}function saveUpdates(_0xd951b8,_0x1524b9){return function(_0x198d95){if(_0x198d95){return _0x198d95['update'](_0xd951b8)[_0x72b8('0x23')](function(_0x536895){return _0x536895;});}return null;};}function removeEntity(_0x52812d,_0x459545){return function(_0x4ba753){if(_0x4ba753){return _0x4ba753[_0x72b8('0x24')]()[_0x72b8('0x23')](function(){_0x52812d[_0x72b8('0x19')](0xcc)[_0x72b8('0x1a')]();});}};}function handleEntityNotFound(_0x1a0838,_0x522d22){return function(_0x504c76){if(!_0x504c76){_0x1a0838[_0x72b8('0x18')](0x194);}return _0x504c76;};}function handleError(_0x5b2b7c,_0x39069b){_0x39069b=_0x39069b||0x1f4;return function(_0x4d634d){logger[_0x72b8('0x25')](_0x4d634d['stack']);if(_0x4d634d[_0x72b8('0x26')]){delete _0x4d634d[_0x72b8('0x26')];}_0x5b2b7c[_0x72b8('0x19')](_0x39069b)[_0x72b8('0x27')](_0x4d634d);};}exports[_0x72b8('0x28')]=function(_0x2749ec,_0xf22b3b){var _0x175735={},_0x49109c={},_0x1dc686={'count':0x0,'rows':[]};var _0x1981aa=_['map'](db[_0x72b8('0x29')][_0x72b8('0x2a')],function(_0x320a32){return{'name':_0x320a32['fieldName'],'type':_0x320a32[_0x72b8('0x2b')][_0x72b8('0x2c')]};});_0x49109c['model']=_[_0x72b8('0x2d')](_0x1981aa,_0x72b8('0x26'));_0x49109c['query']=_[_0x72b8('0x2e')](_0x2749ec[_0x72b8('0x2f')]);_0x49109c['filters']=_['intersection'](_0x49109c[_0x72b8('0x30')],_0x49109c['query']);_0x175735['attributes']=_[_0x72b8('0x31')](_0x49109c[_0x72b8('0x30')],qs[_0x72b8('0x32')](_0x2749ec[_0x72b8('0x2f')]['fields']));_0x175735[_0x72b8('0x33')]=_0x175735[_0x72b8('0x33')][_0x72b8('0x34')]?_0x175735[_0x72b8('0x33')]:_0x49109c['model'];if(!_0x2749ec[_0x72b8('0x2f')]['hasOwnProperty']('nolimit')){_0x175735['limit']=qs['limit'](_0x2749ec[_0x72b8('0x2f')][_0x72b8('0x1f')]);_0x175735[_0x72b8('0x1c')]=qs['offset'](_0x2749ec['query'][_0x72b8('0x1c')]);}_0x175735['order']=qs['sort'](_0x2749ec[_0x72b8('0x2f')][_0x72b8('0x35')]);_0x175735[_0x72b8('0x36')]=qs['filters'](_[_0x72b8('0x37')](_0x2749ec[_0x72b8('0x2f')],_0x49109c[_0x72b8('0x38')]),_0x1981aa);if(_0x2749ec[_0x72b8('0x2f')][_0x72b8('0x39')]){_0x175735[_0x72b8('0x36')]=_[_0x72b8('0x3a')](_0x175735['where'],{'$or':_['map'](_0x1981aa,function(_0x3f1d17){if(_0x3f1d17[_0x72b8('0x2b')]!=='VIRTUAL'){var _0x4dfd93={};_0x4dfd93[_0x3f1d17[_0x72b8('0x26')]]={'$like':'%'+_0x2749ec[_0x72b8('0x2f')]['filter']+'%'};return _0x4dfd93;}})});}_0x175735=_[_0x72b8('0x3a')]({},_0x175735,_0x2749ec[_0x72b8('0x3b')]);var _0x5aa261={'where':_0x175735['where']};return db[_0x72b8('0x29')]['count'](_0x5aa261)['then'](function(_0x4cb90d){_0x1dc686[_0x72b8('0x1e')]=_0x4cb90d;if(_0x2749ec[_0x72b8('0x2f')][_0x72b8('0x3c')]){_0x175735[_0x72b8('0x3d')]=[{'all':!![]}];}return db[_0x72b8('0x29')]['findAll'](_0x175735);})['then'](function(_0x2c5e89){_0x1dc686[_0x72b8('0x3e')]=_0x2c5e89;return _0x1dc686;})[_0x72b8('0x23')](respondWithFilteredResult(_0xf22b3b,_0x175735))['catch'](handleError(_0xf22b3b,null));};exports['show']=function(_0x415471,_0x43a2de){var _0x441e16={'raw':!![],'where':{'id':_0x415471[_0x72b8('0x3f')]['id']}},_0x304c3e={};_0x304c3e[_0x72b8('0x30')]=_[_0x72b8('0x2e')](db[_0x72b8('0x29')][_0x72b8('0x2a')]);_0x304c3e['query']=_[_0x72b8('0x2e')](_0x415471[_0x72b8('0x2f')]);_0x304c3e[_0x72b8('0x38')]=_[_0x72b8('0x31')](_0x304c3e[_0x72b8('0x30')],_0x304c3e[_0x72b8('0x2f')]);_0x441e16[_0x72b8('0x33')]=_[_0x72b8('0x31')](_0x304c3e[_0x72b8('0x30')],qs['fields'](_0x415471[_0x72b8('0x2f')][_0x72b8('0x32')]));_0x441e16[_0x72b8('0x33')]=_0x441e16[_0x72b8('0x33')][_0x72b8('0x34')]?_0x441e16[_0x72b8('0x33')]:_0x304c3e[_0x72b8('0x30')];if(_0x415471[_0x72b8('0x2f')][_0x72b8('0x3c')]){_0x441e16['include']=[{'all':!![]}];}_0x441e16=_['merge']({},_0x441e16,_0x415471[_0x72b8('0x3b')]);return db[_0x72b8('0x29')]['find'](_0x441e16)['then'](handleEntityNotFound(_0x43a2de,null))['then'](respondWithResult(_0x43a2de,null))[_0x72b8('0x40')](handleError(_0x43a2de,null));};exports['create']=function(_0x4193f9,_0x4ec301){return db[_0x72b8('0x29')][_0x72b8('0x41')](_0x4193f9[_0x72b8('0x42')],{})[_0x72b8('0x23')](respondWithResult(_0x4ec301,0xc9))[_0x72b8('0x40')](handleError(_0x4ec301,null));};exports[_0x72b8('0x43')]=function(_0x397f24,_0x3236df){if(_0x397f24[_0x72b8('0x42')]['id']){delete _0x397f24[_0x72b8('0x42')]['id'];}return db[_0x72b8('0x29')]['find']({'where':{'id':_0x397f24[_0x72b8('0x3f')]['id']}})[_0x72b8('0x23')](handleEntityNotFound(_0x3236df,null))[_0x72b8('0x23')](saveUpdates(_0x397f24[_0x72b8('0x42')],null))[_0x72b8('0x23')](respondWithResult(_0x3236df,null))['catch'](handleError(_0x3236df,null));};exports[_0x72b8('0x24')]=function(_0x239544,_0x34de9e){return db[_0x72b8('0x29')][_0x72b8('0x44')]({'where':{'id':_0x239544['params']['id']}})[_0x72b8('0x23')](handleEntityNotFound(_0x34de9e,null))[_0x72b8('0x23')](removeEntity(_0x34de9e,null))[_0x72b8('0x40')](handleError(_0x34de9e,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 97b2778..4fd73d4 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 _0x52e9=['utf8mb4_unicode_ci','lodash','util','moment','bluebird','path','rimraf','../../config/environment','./openchannelApplication.attributes','exports','define','openchannel_applications','utf8mb4'];(function(_0x413072,_0x403426){var _0xed5724=function(_0x483bb8){while(--_0x483bb8){_0x413072['push'](_0x413072['shift']());}};_0xed5724(++_0x403426);}(_0x52e9,0x105));var _0x952e=function(_0x38191e,_0x337aa7){_0x38191e=_0x38191e-0x0;var _0x1504f1=_0x52e9[_0x38191e];return _0x1504f1;};'use strict';var _=require(_0x952e('0x0'));var util=require(_0x952e('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x952e('0x2'));var BPromise=require(_0x952e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x952e('0x4'));var rimraf=require(_0x952e('0x5'));var config=require(_0x952e('0x6'));var attributes=require(_0x952e('0x7'));module[_0x952e('0x8')]=function(_0x2f6a06,_0x45c0f1){return _0x2f6a06[_0x952e('0x9')]('OpenchannelApplication',attributes,{'tableName':_0x952e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x952e('0xb'),'collate':_0x952e('0xc')});}; \ No newline at end of file +var _0x3578=['moment','bluebird','request-promise','path','../../config/environment','./openchannelApplication.attributes','exports','define','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api'];(function(_0x2bd1ec,_0x3fe65f){var _0x2f7577=function(_0x5234fb){while(--_0x5234fb){_0x2bd1ec['push'](_0x2bd1ec['shift']());}};_0x2f7577(++_0x3fe65f);}(_0x3578,0x185));var _0x8357=function(_0x3b2be3,_0x3e602d){_0x3b2be3=_0x3b2be3-0x0;var _0x511b35=_0x3578[_0x3b2be3];return _0x511b35;};'use strict';var _=require('lodash');var util=require(_0x8357('0x0'));var logger=require(_0x8357('0x1'))(_0x8357('0x2'));var moment=require(_0x8357('0x3'));var BPromise=require(_0x8357('0x4'));var rp=require(_0x8357('0x5'));var fs=require('fs');var path=require(_0x8357('0x6'));var rimraf=require('rimraf');var config=require(_0x8357('0x7'));var attributes=require(_0x8357('0x8'));module[_0x8357('0x9')]=function(_0x787a4e,_0x453a0b){return _0x787a4e[_0x8357('0xa')]('OpenchannelApplication',attributes,{'tableName':_0x8357('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8357('0xc'),'collate':_0x8357('0xd')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index dd9ece0..71d559c 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 _0xf2d3=['attributes','limit','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options','where'];(function(_0x4ad885,_0x335d88){var _0x217da1=function(_0x2f5109){while(--_0x2f5109){_0x4ad885['push'](_0x4ad885['shift']());}};_0x217da1(++_0x335d88);}(_0xf2d3,0xea));var _0x3f2d=function(_0x29afdf,_0x434a58){_0x29afdf=_0x29afdf-0x0;var _0x312e47=_0xf2d3[_0x29afdf];return _0x312e47;};'use strict';var _=require(_0x3f2d('0x0'));var util=require(_0x3f2d('0x1'));var moment=require(_0x3f2d('0x2'));var BPromise=require(_0x3f2d('0x3'));var rs=require(_0x3f2d('0x4'));var fs=require('fs');var Redis=require(_0x3f2d('0x5'));var db=require(_0x3f2d('0x6'))['db'];var utils=require(_0x3f2d('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x3f2d('0x8'));var jayson=require(_0x3f2d('0x9'));var client=jayson[_0x3f2d('0xa')][_0x3f2d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x21dddd,_0x22c4d2,_0x5124a9){return new BPromise(function(_0x3ccc81,_0x17c77f){return client[_0x3f2d('0xc')](_0x21dddd,_0x5124a9)[_0x3f2d('0xd')](function(_0x54cbd6){logger[_0x3f2d('0xe')](_0x3f2d('0xf'),_0x22c4d2,_0x3f2d('0x10'));logger[_0x3f2d('0x11')](_0x3f2d('0x12'),_0x22c4d2,_0x3f2d('0x10'),JSON[_0x3f2d('0x13')](_0x54cbd6));if(_0x54cbd6[_0x3f2d('0x14')]){if(_0x54cbd6['error'][_0x3f2d('0x15')]===0x1f4){logger[_0x3f2d('0x14')](_0x3f2d('0xf'),_0x22c4d2,_0x54cbd6[_0x3f2d('0x14')][_0x3f2d('0x16')]);return _0x17c77f(_0x54cbd6[_0x3f2d('0x14')]['message']);}logger[_0x3f2d('0x14')](_0x3f2d('0xf'),_0x22c4d2,_0x54cbd6[_0x3f2d('0x14')][_0x3f2d('0x16')]);return _0x3ccc81(_0x54cbd6[_0x3f2d('0x14')][_0x3f2d('0x16')]);}else{logger['info']('OpenchannelApplication,\x20%s,\x20%s',_0x22c4d2,'request\x20sent');_0x3ccc81(_0x54cbd6[_0x3f2d('0x17')][_0x3f2d('0x16')]);}})['catch'](function(_0x4cdcc4){logger[_0x3f2d('0x14')]('OpenchannelApplication,\x20%s,\x20%s',_0x22c4d2,_0x4cdcc4);_0x17c77f(_0x4cdcc4);});});}exports[_0x3f2d('0x18')]=function(_0x1a8d69){var _0x57661a=this;return new Promise(function(_0x3b2793,_0x207a2d){return db[_0x3f2d('0x19')][_0x3f2d('0x1a')](_0x1a8d69[_0x3f2d('0x1b')],{'raw':_0x1a8d69['options']?_0x1a8d69[_0x3f2d('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1a8d69[_0x3f2d('0x1c')]?_0x1a8d69[_0x3f2d('0x1c')][_0x3f2d('0x1d')]||null:null,'attributes':_0x1a8d69[_0x3f2d('0x1c')]?_0x1a8d69[_0x3f2d('0x1c')][_0x3f2d('0x1e')]||null:null,'limit':_0x1a8d69[_0x3f2d('0x1c')]?_0x1a8d69['options'][_0x3f2d('0x1f')]||null:null})['then'](function(_0xd41a63){logger[_0x3f2d('0xe')](_0x3f2d('0x18'),_0x1a8d69);logger[_0x3f2d('0x11')](_0x3f2d('0x18'),_0x1a8d69,JSON[_0x3f2d('0x13')](_0xd41a63));_0x3b2793(_0xd41a63);})[_0x3f2d('0x20')](function(_0x2aa585){logger[_0x3f2d('0x14')]('UpdateOpenchannelApplication',_0x2aa585['message'],_0x1a8d69);_0x207a2d(_0x57661a[_0x3f2d('0x14')](0x1f4,_0x2aa585[_0x3f2d('0x16')]));});});}; \ No newline at end of file +var _0x99df=['where','attributes','debug','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','then','info','OpenchannelApplication,\x20%s,\x20%s','OpenchannelApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','UpdateOpenchannelApplication','OpenchannelApplication','update','options','raw'];(function(_0x4b002b,_0x2bc1f0){var _0x41b40a=function(_0x370a73){while(--_0x370a73){_0x4b002b['push'](_0x4b002b['shift']());}};_0x41b40a(++_0x2bc1f0);}(_0x99df,0x1a8));var _0xf99d=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0x99df[_0x13b02f];return _0x12e9a6;};'use strict';var _=require('lodash');var util=require(_0xf99d('0x0'));var moment=require(_0xf99d('0x1'));var BPromise=require(_0xf99d('0x2'));var rs=require(_0xf99d('0x3'));var fs=require('fs');var Redis=require(_0xf99d('0x4'));var db=require(_0xf99d('0x5'))['db'];var utils=require(_0xf99d('0x6'));var logger=require(_0xf99d('0x7'))(_0xf99d('0x8'));var config=require('../../config/environment');var jayson=require(_0xf99d('0x9'));var client=jayson['client'][_0xf99d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x28fe30,_0x146655,_0x495fca){return new BPromise(function(_0x1c114e,_0x36ab19){return client['request'](_0x28fe30,_0x495fca)[_0xf99d('0xb')](function(_0x5194cd){logger[_0xf99d('0xc')](_0xf99d('0xd'),_0x146655,'request\x20sent');logger['debug'](_0xf99d('0xe'),_0x146655,_0xf99d('0xf'),JSON[_0xf99d('0x10')](_0x5194cd));if(_0x5194cd[_0xf99d('0x11')]){if(_0x5194cd[_0xf99d('0x11')][_0xf99d('0x12')]===0x1f4){logger[_0xf99d('0x11')](_0xf99d('0xd'),_0x146655,_0x5194cd[_0xf99d('0x11')][_0xf99d('0x13')]);return _0x36ab19(_0x5194cd[_0xf99d('0x11')]['message']);}logger[_0xf99d('0x11')](_0xf99d('0xd'),_0x146655,_0x5194cd[_0xf99d('0x11')][_0xf99d('0x13')]);return _0x1c114e(_0x5194cd[_0xf99d('0x11')]['message']);}else{logger[_0xf99d('0xc')](_0xf99d('0xd'),_0x146655,_0xf99d('0xf'));_0x1c114e(_0x5194cd[_0xf99d('0x14')][_0xf99d('0x13')]);}})['catch'](function(_0x46da75){logger[_0xf99d('0x11')](_0xf99d('0xd'),_0x146655,_0x46da75);_0x36ab19(_0x46da75);});});}exports[_0xf99d('0x15')]=function(_0x2d0a8c){var _0x5e319a=this;return new Promise(function(_0x4558b9,_0x1bdc39){return db[_0xf99d('0x16')][_0xf99d('0x17')](_0x2d0a8c['body'],{'raw':_0x2d0a8c[_0xf99d('0x18')]?_0x2d0a8c['options'][_0xf99d('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2d0a8c[_0xf99d('0x18')]?_0x2d0a8c['options'][_0xf99d('0x1a')]||null:null,'attributes':_0x2d0a8c[_0xf99d('0x18')]?_0x2d0a8c[_0xf99d('0x18')][_0xf99d('0x1b')]||null:null,'limit':_0x2d0a8c['options']?_0x2d0a8c[_0xf99d('0x18')]['limit']||null:null})[_0xf99d('0xb')](function(_0x2cc0af){logger['info'](_0xf99d('0x15'),_0x2d0a8c);logger[_0xf99d('0x1c')](_0xf99d('0x15'),_0x2d0a8c,JSON[_0xf99d('0x10')](_0x2cc0af));_0x4558b9(_0x2cc0af);})[_0xf99d('0x1d')](function(_0x26a335){logger[_0xf99d('0x11')]('UpdateOpenchannelApplication',_0x26a335[_0xf99d('0x13')],_0x2d0a8c);_0x1bdc39(_0x5e319a[_0xf99d('0x11')](0x1f4,_0x26a335[_0xf99d('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 431021a..9ce74e4 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 _0xdba9=['../../components/auth/service','../../components/interaction/service','./openchannelInteraction.controller','isAuthenticated','index','get','/describe','describe','getMessages','/:id/download','post','/:id/messages','addMessage','/:id/tags','openchannel','tracked','openchannelinteraction:update','delete','openchannelinteraction:destroy','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x58cbde,_0x4b0f62){var _0x5799f3=function(_0x326eca){while(--_0x326eca){_0x58cbde['push'](_0x58cbde['shift']());}};_0x5799f3(++_0x4b0f62);}(_0xdba9,0x77));var _0x9dba=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xdba9[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require('multer');var util=require(_0x9dba('0x0'));var path=require(_0x9dba('0x1'));var timeout=require(_0x9dba('0x2'));var express=require(_0x9dba('0x3'));var router=express[_0x9dba('0x4')]();var fs_extra=require(_0x9dba('0x5'));var auth=require(_0x9dba('0x6'));var interaction=require(_0x9dba('0x7'));var config=require('../../config/environment');var controller=require(_0x9dba('0x8'));router['get']('/',auth[_0x9dba('0x9')](),controller[_0x9dba('0xa')]);router[_0x9dba('0xb')](_0x9dba('0xc'),auth[_0x9dba('0x9')](),controller[_0x9dba('0xd')]);router[_0x9dba('0xb')]('/:id',auth['isAuthenticated'](),controller['show']);router['get']('/:id/messages',auth['isAuthenticated'](),controller[_0x9dba('0xe')]);router[_0x9dba('0xb')](_0x9dba('0xf'),auth['isAuthenticated'](),controller['download']);router[_0x9dba('0x10')]('/',auth[_0x9dba('0x9')](),controller['create']);router[_0x9dba('0x10')](_0x9dba('0x11'),auth[_0x9dba('0x9')](),controller[_0x9dba('0x12')]);router[_0x9dba('0x10')](_0x9dba('0x13'),auth['isAuthenticated'](),interaction['tracked'](_0x9dba('0x14'),'openchannelinteraction:addtags'),controller['addTags']);router['put']('/:id',auth['isAuthenticated'](),interaction[_0x9dba('0x15')](_0x9dba('0x14'),_0x9dba('0x16')),controller['update']);router[_0x9dba('0x17')]('/:id',auth[_0x9dba('0x9')](),interaction['tracked'](_0x9dba('0x14'),_0x9dba('0x18')),controller['destroy']);router['delete']('/:id/tags',auth['isAuthenticated'](),controller['removeTags']);module['exports']=router; \ No newline at end of file +var _0x5426=['index','/describe','describe','/:id','/:id/messages','getMessages','download','post','create','addMessage','tracked','openchannel','addTags','put','update','delete','openchannelinteraction:destroy','destroy','/:id/tags','removeTags','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated'];(function(_0x3c2a69,_0x4c8b41){var _0x596bc8=function(_0x1b4b7c){while(--_0x1b4b7c){_0x3c2a69['push'](_0x3c2a69['shift']());}};_0x596bc8(++_0x4c8b41);}(_0x5426,0xd5));var _0x6542=function(_0x1891f3,_0x33726e){_0x1891f3=_0x1891f3-0x0;var _0x289be3=_0x5426[_0x1891f3];return _0x289be3;};'use strict';var multer=require(_0x6542('0x0'));var util=require(_0x6542('0x1'));var path=require(_0x6542('0x2'));var timeout=require(_0x6542('0x3'));var express=require(_0x6542('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x6542('0x5'));var interaction=require(_0x6542('0x6'));var config=require(_0x6542('0x7'));var controller=require(_0x6542('0x8'));router[_0x6542('0x9')]('/',auth[_0x6542('0xa')](),controller[_0x6542('0xb')]);router['get'](_0x6542('0xc'),auth[_0x6542('0xa')](),controller[_0x6542('0xd')]);router[_0x6542('0x9')](_0x6542('0xe'),auth[_0x6542('0xa')](),controller['show']);router[_0x6542('0x9')](_0x6542('0xf'),auth[_0x6542('0xa')](),controller[_0x6542('0x10')]);router[_0x6542('0x9')]('/:id/download',auth[_0x6542('0xa')](),controller[_0x6542('0x11')]);router[_0x6542('0x12')]('/',auth[_0x6542('0xa')](),controller[_0x6542('0x13')]);router[_0x6542('0x12')](_0x6542('0xf'),auth[_0x6542('0xa')](),controller[_0x6542('0x14')]);router[_0x6542('0x12')]('/:id/tags',auth[_0x6542('0xa')](),interaction[_0x6542('0x15')](_0x6542('0x16'),'openchannelinteraction:addtags'),controller[_0x6542('0x17')]);router[_0x6542('0x18')](_0x6542('0xe'),auth[_0x6542('0xa')](),interaction[_0x6542('0x15')]('openchannel','openchannelinteraction:update'),controller[_0x6542('0x19')]);router[_0x6542('0x1a')](_0x6542('0xe'),auth['isAuthenticated'](),interaction[_0x6542('0x15')](_0x6542('0x16'),_0x6542('0x1b')),controller[_0x6542('0x1c')]);router['delete'](_0x6542('0x1d'),auth[_0x6542('0xa')](),controller[_0x6542('0x1e')]);module[_0x6542('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 57de433..5f4b7e0 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 _0x5f25=['ENUM','out','INTEGER','sequelize','exports','BOOLEAN','DATE','STRING'];(function(_0x5d80e7,_0x57d877){var _0x5dea17=function(_0x3d377d){while(--_0x3d377d){_0x5d80e7['push'](_0x5d80e7['shift']());}};_0x5dea17(++_0x57d877);}(_0x5f25,0x1cb));var _0x55f2=function(_0x9307ea,_0x38968a){_0x9307ea=_0x9307ea-0x0;var _0x295554=_0x5f25[_0x9307ea];return _0x295554;};'use strict';var Sequelize=require(_0x55f2('0x0'));module[_0x55f2('0x1')]={'closed':{'type':Sequelize[_0x55f2('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x55f2('0x3')]},'disposition':{'type':Sequelize[_0x55f2('0x4')]},'secondDisposition':{'type':Sequelize[_0x55f2('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x55f2('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize[_0x55f2('0x4')]},'externalUrl':{'type':Sequelize[_0x55f2('0x4')]},'lastMsgAt':{'type':Sequelize[_0x55f2('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x55f2('0x5')]('in',_0x55f2('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x55f2('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x55f2('0x4')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize[_0x55f2('0x7')]}}; \ No newline at end of file +var _0xedb4=['BOOLEAN','DATE','STRING','ENUM','out','INTEGER','exports'];(function(_0x27a2cc,_0x42b44a){var _0x2240ba=function(_0x493e3f){while(--_0x493e3f){_0x27a2cc['push'](_0x27a2cc['shift']());}};_0x2240ba(++_0x42b44a);}(_0xedb4,0x156));var _0x4edb=function(_0xb68772,_0x5253ac){_0xb68772=_0xb68772-0x0;var _0x4189bb=_0xedb4[_0xb68772];return _0x4189bb;};'use strict';var Sequelize=require('sequelize');module[_0x4edb('0x0')]={'closed':{'type':Sequelize[_0x4edb('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x4edb('0x2')]},'disposition':{'type':Sequelize[_0x4edb('0x3')]},'secondDisposition':{'type':Sequelize[_0x4edb('0x3')]},'thirdDisposition':{'type':Sequelize[_0x4edb('0x3')]},'note':{'type':Sequelize[_0x4edb('0x3')]},'read1stAt':{'type':Sequelize[_0x4edb('0x2')]},'threadId':{'type':Sequelize[_0x4edb('0x3')]},'externalUrl':{'type':Sequelize[_0x4edb('0x3')]},'lastMsgAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x4edb('0x4')]('in',_0x4edb('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x4edb('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x4edb('0x3')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize[_0x4edb('0x6')]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index cf9b405..6c34f6f 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 _0x65ef=['user','catch','show','from','params','keys','filters','model','attributes','fields','length','includeAll','merge','options','find','body','update','describe','addMessage','omit','ids','getMessages','findOne','OpenchannelMessage','intersection','hasOwnProperty','nolimit','order','sort','where','OpenchannelInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','addTags','setTags','spread','name','color','emit','removeTags','download','toString','join','root','server','files','tmp','attachments','push','User','fullname','firstName','lastName','Attachment','Messages','createdAt','direction','secret','read','Account','Owner','mkdirSync','Openchannel','N.A.','closed','closedAt','disposition','Public','Private','existsSync','createReadStream','pipe','createWriteStream','basename','System','Contact','out','renderFile','views','downloadInteraction.ejs','createPdfFromHTML','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','rimraf','zip-dir','moment','path','ejs','lodash','ioredis','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','end','status','json','offset','undefined','limit','count','set','Content-Range','destroy','then','sendStatus','error','index','map','OpenchannelInteraction','rawAttributes','fieldName','type','getOptions','findAll','openchannel','query'];(function(_0x297cf4,_0x180caf){var _0x16df1d=function(_0x4688c3){while(--_0x4688c3){_0x297cf4['push'](_0x297cf4['shift']());}};_0x16df1d(++_0x180caf);}(_0x65ef,0x156));var _0xf65e=function(_0x21a419,_0x3cd800){_0x21a419=_0x21a419-0x0;var _0x53945a=_0x65ef[_0x21a419];return _0x53945a;};'use strict';var rimraf=require(_0xf65e('0x0'));var zipdir=require(_0xf65e('0x1'));var moment=require(_0xf65e('0x2'));var util=require('util');var path=require(_0xf65e('0x3'));var ejs=require(_0xf65e('0x4'));var fs=require('fs');var _=require(_0xf65e('0x5'));var Redis=require(_0xf65e('0x6'));var interaction=require('../../components/interaction/service');var qs=require(_0xf65e('0x7'));var pdf=require(_0xf65e('0x8'));var logger=require(_0xf65e('0x9'))(_0xf65e('0xa'));var config=require(_0xf65e('0xb'));var db=require(_0xf65e('0xc'))['db'];config['redis']=_[_0xf65e('0xd')](config[_0xf65e('0xe')],{'host':_0xf65e('0xf'),'port':0x18eb});var socket=require(_0xf65e('0x10'))(new Redis(config[_0xf65e('0xe')]));require(_0xf65e('0x11'))[_0xf65e('0x12')](socket);function respondWithStatusCode(_0x23c185,_0x2f295e){_0x2f295e=_0x2f295e||0xcc;return function(_0x3b22f6){if(_0x3b22f6){return _0x23c185['sendStatus'](_0x2f295e);}return _0x23c185['status'](_0x2f295e)[_0xf65e('0x13')]();};}function respondWithResult(_0x4f67b9,_0x52f86c){_0x52f86c=_0x52f86c||0xc8;return function(_0x1992b8){if(_0x1992b8){return _0x4f67b9[_0xf65e('0x14')](_0x52f86c)[_0xf65e('0x15')](_0x1992b8);}};}function respondWithFilteredResult(_0x4c345e,_0x53dfa6){return function(_0x279bca){if(_0x279bca){var _0x22d179=typeof _0x53dfa6[_0xf65e('0x16')]===_0xf65e('0x17')&&typeof _0x53dfa6[_0xf65e('0x18')]===_0xf65e('0x17');var _0x598bcb=_0x279bca['count'];var _0x62a5f2=_0x22d179?0x0:_0x53dfa6['offset'];var _0x2295a1=_0x22d179?_0x279bca[_0xf65e('0x19')]:_0x53dfa6[_0xf65e('0x16')]+_0x53dfa6[_0xf65e('0x18')];var _0x19341b;if(_0x2295a1>=_0x598bcb){_0x2295a1=_0x598bcb;_0x19341b=0xc8;}else{_0x19341b=0xce;}_0x4c345e[_0xf65e('0x14')](_0x19341b);return _0x4c345e[_0xf65e('0x1a')](_0xf65e('0x1b'),_0x62a5f2+'-'+_0x2295a1+'/'+_0x598bcb)[_0xf65e('0x15')](_0x279bca);}return null;};}function saveUpdates(_0x21a1f8){return function(_0x4b53a2){if(_0x4b53a2){return _0x4b53a2['update'](_0x21a1f8)['then'](function(_0x4ae478){return _0x4ae478;});}return null;};}function removeEntity(_0x77bea2){return function(_0x133564){if(_0x133564){return _0x133564[_0xf65e('0x1c')]()[_0xf65e('0x1d')](function(){_0x77bea2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a8813){return function(_0x625338){if(!_0x625338){_0x3a8813[_0xf65e('0x1e')](0x194);}return _0x625338;};}function handleError(_0x5f2c2e,_0x285482){_0x285482=_0x285482||0x1f4;return function(_0x2704f4){logger[_0xf65e('0x1f')](_0x2704f4['stack']);if(_0x2704f4['name']){delete _0x2704f4['name'];}_0x5f2c2e[_0xf65e('0x14')](_0x285482)['send'](_0x2704f4);};}exports[_0xf65e('0x20')]=function(_0x173d6e,_0x360eaf){var _0xd3e134={};var _0x465001=_[_0xf65e('0x21')](db[_0xf65e('0x22')][_0xf65e('0x23')],function(_0x2128ae){return{'name':_0x2128ae[_0xf65e('0x24')],'type':_0x2128ae[_0xf65e('0x25')]['key']};});_0xd3e134=qs[_0xf65e('0x26')](_0x465001,_0x173d6e);return interaction[_0xf65e('0x27')](_0xf65e('0x28'),_0x173d6e[_0xf65e('0x29')],_0x173d6e[_0xf65e('0x2a')],_0xd3e134,_0x465001)[_0xf65e('0x1d')](respondWithFilteredResult(_0x360eaf,_0xd3e134))[_0xf65e('0x2b')](handleError(_0x360eaf,null));};exports[_0xf65e('0x2c')]=function(_0x487632,_0x1c4d78){var _0x1aa199={};if(_0x487632[_0xf65e('0x29')][_0xf65e('0x25')]&&_0x487632[_0xf65e('0x29')]['type']===_0xf65e('0x2d')){_0x1aa199[_0xf65e('0x2d')]=_0x487632['params']['id'];}else{_0x1aa199['id']=_0x487632[_0xf65e('0x2e')]['id'];}var _0x3eca56={'raw':![],'where':_0x1aa199},_0x28bc34={};_0x28bc34['model']=_[_0xf65e('0x2f')](db[_0xf65e('0x22')][_0xf65e('0x23')]);_0x28bc34[_0xf65e('0x29')]=_[_0xf65e('0x2f')](_0x487632[_0xf65e('0x29')]);_0x28bc34[_0xf65e('0x30')]=_['intersection'](_0x28bc34[_0xf65e('0x31')],_0x28bc34[_0xf65e('0x29')]);_0x3eca56[_0xf65e('0x32')]=_['intersection'](_0x28bc34['model'],qs[_0xf65e('0x33')](_0x487632[_0xf65e('0x29')][_0xf65e('0x33')]));_0x3eca56[_0xf65e('0x32')]=_0x3eca56['attributes'][_0xf65e('0x34')]?_0x3eca56['attributes']:_0x28bc34[_0xf65e('0x31')];if(_0x487632['query'][_0xf65e('0x35')]){_0x3eca56['include']=[{'all':!![]}];}_0x3eca56=_[_0xf65e('0x36')]({},_0x3eca56,_0x487632[_0xf65e('0x37')]);return db['OpenchannelInteraction'][_0xf65e('0x38')](_0x3eca56)['then'](handleEntityNotFound(_0x1c4d78,null))[_0xf65e('0x1d')](respondWithResult(_0x1c4d78,null))[_0xf65e('0x2b')](handleError(_0x1c4d78,null));};exports['create']=function(_0x57a5ca,_0x28b3d5){return db[_0xf65e('0x22')]['create'](_0x57a5ca[_0xf65e('0x39')],{})['then'](respondWithResult(_0x28b3d5,0xc9))['catch'](handleError(_0x28b3d5,null));};exports[_0xf65e('0x3a')]=function(_0x265fa8,_0xa7a5a8){if(_0x265fa8[_0xf65e('0x39')]['id']){delete _0x265fa8['body']['id'];}return db[_0xf65e('0x22')][_0xf65e('0x38')]({'where':{'id':_0x265fa8['params']['id']}})['then'](handleEntityNotFound(_0xa7a5a8,null))[_0xf65e('0x1d')](saveUpdates(_0x265fa8[_0xf65e('0x39')],null))[_0xf65e('0x1d')](respondWithResult(_0xa7a5a8,null))['catch'](handleError(_0xa7a5a8,null));};exports[_0xf65e('0x1c')]=function(_0x1bb729,_0x148f87){return db[_0xf65e('0x22')][_0xf65e('0x38')]({'where':{'id':_0x1bb729[_0xf65e('0x2e')]['id']}})['then'](handleEntityNotFound(_0x148f87,null))[_0xf65e('0x1d')](removeEntity(_0x148f87,null))['catch'](handleError(_0x148f87,null));};exports[_0xf65e('0x3b')]=function(_0x3defa3,_0x57b145){return db[_0xf65e('0x22')]['describe']()['then'](respondWithResult(_0x57b145,null))['catch'](handleError(_0x57b145,null));};exports[_0xf65e('0x3c')]=function(_0x3157e4,_0x422b18){return db['OpenchannelMessage'][_0xf65e('0x38')]({'where':{'id':_0x3157e4[_0xf65e('0x2e')]['id']}})['then'](handleEntityNotFound(_0x422b18,null))[_0xf65e('0x1d')](function(_0x2f999f){if(_0x2f999f){return _0x2f999f[_0xf65e('0x3c')](_0x3157e4[_0xf65e('0x39')]['ids'],_[_0xf65e('0x3d')](_0x3157e4[_0xf65e('0x39')],[_0xf65e('0x3e'),'id'])||{});}})[_0xf65e('0x1d')](respondWithResult(_0x422b18,null))[_0xf65e('0x2b')](handleError(_0x422b18,null));};exports[_0xf65e('0x3f')]=function(_0x49c210,_0x166bd2){var _0x5af01a={'raw':![],'where':{}};var _0x5ea414={};var _0x43fed1={'count':0x0,'rows':[]};return db[_0xf65e('0x22')][_0xf65e('0x40')]({'where':{'id':_0x49c210[_0xf65e('0x2e')]['id']}})[_0xf65e('0x1d')](handleEntityNotFound(_0x166bd2,null))[_0xf65e('0x1d')](function(_0x4a56a2){if(_0x4a56a2){_0x5ea414[_0xf65e('0x31')]=_[_0xf65e('0x2f')](db[_0xf65e('0x41')][_0xf65e('0x23')]);_0x5ea414['query']=_[_0xf65e('0x2f')](_0x49c210[_0xf65e('0x29')]);_0x5ea414[_0xf65e('0x30')]=_[_0xf65e('0x42')](_0x5ea414['model'],_0x5ea414[_0xf65e('0x29')]);_0x5af01a[_0xf65e('0x32')]=_['intersection'](_0x5ea414[_0xf65e('0x31')],qs['fields'](_0x49c210[_0xf65e('0x29')]['fields']));_0x5af01a['attributes']=_0x5af01a[_0xf65e('0x32')][_0xf65e('0x34')]?_0x5af01a[_0xf65e('0x32')]:_0x5ea414[_0xf65e('0x31')];if(!_0x49c210['query'][_0xf65e('0x43')](_0xf65e('0x44'))){_0x5af01a[_0xf65e('0x18')]=qs[_0xf65e('0x18')](_0x49c210[_0xf65e('0x29')][_0xf65e('0x18')]);_0x5af01a[_0xf65e('0x16')]=qs[_0xf65e('0x16')](_0x49c210[_0xf65e('0x29')]['offset']);}_0x5af01a[_0xf65e('0x45')]=qs[_0xf65e('0x46')](_0x49c210[_0xf65e('0x29')]['sort']);_0x5af01a[_0xf65e('0x47')]=qs[_0xf65e('0x30')](_['pick'](_0x49c210['query'],_0x5ea414[_0xf65e('0x30')]));_0x5af01a[_0xf65e('0x47')][_0xf65e('0x48')]=_0x4a56a2['id'];if(_0x49c210[_0xf65e('0x29')][_0xf65e('0x49')]){_0x5af01a[_0xf65e('0x47')]=_[_0xf65e('0x36')](_0x5af01a[_0xf65e('0x47')],{'$or':_['map'](_0x5af01a[_0xf65e('0x32')],function(_0x3fa174){var _0x1ec0f8={};_0x1ec0f8[_0x3fa174]={'$like':'%'+_0x49c210[_0xf65e('0x29')][_0xf65e('0x49')]+'%'};return _0x1ec0f8;})});}if(_0x49c210[_0xf65e('0x29')][_0xf65e('0x4a')]){var _0x281f1a=_0x49c210[_0xf65e('0x29')][_0xf65e('0x4a')][_0xf65e('0x4b')](',');var _0x5f9e7b={};_0x5f9e7b[_0x281f1a[0x0]]={'$gte':moment(_0x281f1a[0x1])[_0xf65e('0x4c')](_0xf65e('0x4d'))};_0x5af01a[_0xf65e('0x47')]=_[_0xf65e('0x36')](_0x5af01a[_0xf65e('0x47')],_0x5f9e7b);}_0x5af01a=_[_0xf65e('0x36')]({},_0x5af01a,_0x49c210[_0xf65e('0x37')]);return db[_0xf65e('0x41')][_0xf65e('0x19')]({'where':_0x5af01a[_0xf65e('0x47')]})[_0xf65e('0x1d')](function(_0x41ae5b){_0x43fed1['count']=_0x41ae5b;if(_0x49c210[_0xf65e('0x29')][_0xf65e('0x35')]){_0x5af01a['include']=[{'all':!![]}];}return db['OpenchannelMessage'][_0xf65e('0x27')](_0x5af01a);})[_0xf65e('0x1d')](function(_0x15e844){_0x43fed1['rows']=_0x15e844;return _0x43fed1;});}})['then'](respondWithFilteredResult(_0x166bd2,_0x5af01a))[_0xf65e('0x2b')](handleError(_0x166bd2,null));};exports[_0xf65e('0x4e')]=function(_0x14386b,_0xb3f5e5){return db[_0xf65e('0x22')][_0xf65e('0x38')]({'where':{'id':_0x14386b[_0xf65e('0x2e')]['id']}})['then'](handleEntityNotFound(_0xb3f5e5,null))[_0xf65e('0x1d')](function(_0x1c40e3){if(_0x1c40e3){return _0x1c40e3[_0xf65e('0x4f')](_0x14386b[_0xf65e('0x39')][_0xf65e('0x3e')],_[_0xf65e('0x3d')](_0x14386b[_0xf65e('0x39')],[_0xf65e('0x3e'),'id'])||{})[_0xf65e('0x50')](function(){return db['Tag'][_0xf65e('0x27')]({'attributes':['id',_0xf65e('0x51'),_0xf65e('0x52')],'where':{'id':_0x14386b['body']['ids']}});})[_0xf65e('0x1d')](function(_0x54a757){socket[_0xf65e('0x53')]('openchannelInteractionTags:save',{'id':Number(_0x14386b[_0xf65e('0x2e')]['id']),'tags':_0x54a757||[]});return{'id':Number(_0x14386b[_0xf65e('0x2e')]['id']),'tags':_0x54a757||[]};});}})[_0xf65e('0x1d')](respondWithResult(_0xb3f5e5,null))[_0xf65e('0x2b')](handleError(_0xb3f5e5,null));};exports['removeTags']=function(_0x1851ab,_0x510c48){return db[_0xf65e('0x22')][_0xf65e('0x38')]({'where':{'id':_0x1851ab['params']['id']}})['then'](handleEntityNotFound(_0x510c48,null))[_0xf65e('0x1d')](function(_0x1e573f){if(_0x1e573f){return _0x1e573f[_0xf65e('0x54')](_0x1851ab['query'][_0xf65e('0x3e')]);}})[_0xf65e('0x1d')](respondWithStatusCode(_0x510c48,null))['catch'](handleError(_0x510c48,null));};exports[_0xf65e('0x55')]=function(_0x2eed65,_0x59bc35){var _0x33bafa=moment()['unix']()[_0xf65e('0x56')]();var _0xb0694b=path[_0xf65e('0x57')](config[_0xf65e('0x58')],_0xf65e('0x59'),_0xf65e('0x5a'),_0xf65e('0x5b'));var _0x42751d=path['join'](config[_0xf65e('0x58')],_0xf65e('0x59'),_0xf65e('0x5a'),_0xf65e('0x5c'));var _0x4da00b=path['join'](_0xb0694b,_0x33bafa);var _0x3b90df=util['format']('transcript-%d-%s.zip',_0x2eed65[_0xf65e('0x2e')]['id'],_0x33bafa);var _0x5097a4=path[_0xf65e('0x57')](_0xb0694b,_0x3b90df);var _0x43bc76=[];_0x43bc76[_0xf65e('0x5d')]({'model':db['User'],'as':_0xf65e('0x5e'),'attributes':['id',_0xf65e('0x5f')],'raw':!![]});_0x43bc76[_0xf65e('0x5d')]({'model':db['CmContact'],'as':'Contact','attributes':['id',_0xf65e('0x60'),_0xf65e('0x61')],'raw':!![]});if(_0x2eed65[_0xf65e('0x29')][_0xf65e('0x5c')]){_0x43bc76['push']({'model':db[_0xf65e('0x62')],'as':_0xf65e('0x62'),'raw':!![]});}var _0x161771=[{'model':db[_0xf65e('0x41')],'as':_0xf65e('0x63'),'attributes':['id',_0xf65e('0x39'),_0xf65e('0x64'),_0xf65e('0x65'),_0xf65e('0x66'),_0xf65e('0x67')],'include':_0x43bc76}];_0x161771['push']({'model':db['OpenchannelAccount'],'as':_0xf65e('0x68'),'attributes':['id','name']});_0x161771[_0xf65e('0x5d')]({'model':db[_0xf65e('0x5e')],'as':_0xf65e('0x69'),'attributes':['id',_0xf65e('0x5f')]});return db[_0xf65e('0x22')][_0xf65e('0x38')]({'where':{'id':_0x2eed65['params']['id']},'include':_0x161771})[_0xf65e('0x1d')](handleEntityNotFound(_0x59bc35,null))['then'](function(_0x44f490){if(_0x44f490){var _0x10e1c6=_0x44f490['get']({'plain':!![]});fs[_0xf65e('0x6a')](_0x4da00b);var _0x318a29={'channel':_0xf65e('0x6b'),'account':_0x10e1c6[_0xf65e('0x68')][_0xf65e('0x51')],'agent':_0x10e1c6[_0xf65e('0x69')]?_0x10e1c6[_0xf65e('0x69')]['fullname']:_0xf65e('0x6c'),'createdAt':moment(_0x10e1c6[_0xf65e('0x64')])[_0xf65e('0x4c')]('YYYY-MM-DD\x20HH:mm:ss')[_0xf65e('0x56')](),'closedAt':_0x10e1c6[_0xf65e('0x6d')]?moment(_0x10e1c6[_0xf65e('0x6e')])[_0xf65e('0x4c')](_0xf65e('0x4d'))[_0xf65e('0x56')]():'','disposition':_0x10e1c6[_0xf65e('0x6f')],'visibility':_0x10e1c6['threadId']?_0xf65e('0x70'):_0xf65e('0x71'),'messages':_(_0x10e1c6[_0xf65e('0x63')])['filter']({'secret':![]})['map'](function(_0xb9eedd){if(_0xb9eedd['Attachment']){var _0x556fb3=path[_0xf65e('0x57')](_0x42751d,_0xb9eedd['Attachment']['basename']);if(fs[_0xf65e('0x72')](_0x556fb3)){fs[_0xf65e('0x73')](_0x556fb3)[_0xf65e('0x74')](fs[_0xf65e('0x75')](path[_0xf65e('0x57')](_0x4da00b,_0xb9eedd[_0xf65e('0x62')][_0xf65e('0x76')])));}}return{'date':moment(_0xb9eedd[_0xf65e('0x64')])['format'](_0xf65e('0x4d'))[_0xf65e('0x56')](),'sender':_0xb9eedd['direction']==='out'?_0xb9eedd['User']?_0xb9eedd['User']['fullname']:_0xf65e('0x77'):_0xb9eedd[_0xf65e('0x78')][_0xf65e('0x60')]+(_0xb9eedd['Contact'][_0xf65e('0x61')]?'\x20'+_0xb9eedd[_0xf65e('0x78')][_0xf65e('0x61')]:''),'body':_0xb9eedd[_0xf65e('0x62')]?_0xb9eedd[_0xf65e('0x62')][_0xf65e('0x76')]:_0xb9eedd[_0xf65e('0x39')],'direction':_0xb9eedd[_0xf65e('0x65')]===_0xf65e('0x79')?'A':'C','secret':_0xb9eedd['secret'],'read':_0xb9eedd[_0xf65e('0x67')],'attachment':_0xb9eedd['Attachment']};})['value']()};return ejs[_0xf65e('0x7a')](path[_0xf65e('0x57')](config[_0xf65e('0x58')],_0xf65e('0x59'),_0xf65e('0x7b'),_0xf65e('0x7c')),{'interaction':_0x318a29})['then'](function(_0x3ffb30){var _0x1088e6=path[_0xf65e('0x57')](_0x4da00b,'transcript-'+_0x10e1c6['id']+'-'+_0x33bafa+'.pdf');var _0x3dc925={'path':_0x1088e6,'channel':'Openchannel','interactionId':_0x10e1c6['id']};return pdf[_0xf65e('0x7d')](_0x3ffb30,_0x3dc925);})[_0xf65e('0x1d')](function(){return new Promise(function(_0xe16861,_0x3d714c){zipdir(_0x4da00b,{'saveTo':_0x5097a4},function(_0x3f8c83,_0x580b49){if(_0x3f8c83)return _0x3d714c(_0x3f8c83);return _0xe16861(_0x580b49);});})['then'](function(){return new Promise(function(_0x82d49d,_0x295d53){rimraf(_0x4da00b,function(_0x38b589){if(_0x38b589)_0x295d53(_0x38b589);return _0x82d49d();});});})[_0xf65e('0x1d')](function(){return _0x59bc35[_0xf65e('0x55')](_0x5097a4,_0x3b90df,function(_0x11b15e){if(_0x11b15e){logger['error'](_0xf65e('0x7e'),_0x11b15e);}else{fs[_0xf65e('0x7f')](_0x5097a4);}});});});}else{return _0x59bc35[_0xf65e('0x1e')](0xc8);}})[_0xf65e('0x2b')](handleError(_0x59bc35,null));}; \ No newline at end of file +var _0x80d0=['secret','read','OpenchannelAccount','Account','fullname','Owner','N.A.','closed','closedAt','disposition','Public','Private','basename','existsSync','createReadStream','pipe','direction','System','firstName','out','value','views','downloadInteraction.ejs','transcript-','.pdf','Openchannel','createPdfFromHTML','Unable\x20to\x20delete\x20zip\x20file','rimraf','moment','util','path','ejs','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','status','end','json','limit','undefined','count','offset','Content-Range','update','destroy','then','sendStatus','error','stack','name','send','index','OpenchannelInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','openchannel','query','user','catch','show','from','params','model','keys','filters','attributes','intersection','fields','length','includeAll','include','merge','options','find','create','body','describe','addMessage','OpenchannelMessage','ids','omit','findOne','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','$gte','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','Tag','emit','openchannelInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','push','User','CmContact','Contact','lastName','Attachment','Messages','createdAt'];(function(_0x3c6198,_0x3f3d3c){var _0x5643fb=function(_0x24b264){while(--_0x24b264){_0x3c6198['push'](_0x3c6198['shift']());}};_0x5643fb(++_0x3f3d3c);}(_0x80d0,0x126));var _0x080d=function(_0x6f70f5,_0x25f1f7){_0x6f70f5=_0x6f70f5-0x0;var _0x22ed7d=_0x80d0[_0x6f70f5];return _0x22ed7d;};'use strict';var rimraf=require(_0x080d('0x0'));var zipdir=require('zip-dir');var moment=require(_0x080d('0x1'));var util=require(_0x080d('0x2'));var path=require(_0x080d('0x3'));var ejs=require(_0x080d('0x4'));var fs=require('fs');var _=require('lodash');var Redis=require('ioredis');var interaction=require(_0x080d('0x5'));var qs=require(_0x080d('0x6'));var pdf=require(_0x080d('0x7'));var logger=require(_0x080d('0x8'))(_0x080d('0x9'));var config=require(_0x080d('0xa'));var db=require(_0x080d('0xb'))['db'];config[_0x080d('0xc')]=_[_0x080d('0xd')](config[_0x080d('0xc')],{'host':_0x080d('0xe'),'port':0x18eb});var socket=require(_0x080d('0xf'))(new Redis(config['redis']));require(_0x080d('0x10'))[_0x080d('0x11')](socket);function respondWithStatusCode(_0xefce0c,_0x43ac40){_0x43ac40=_0x43ac40||0xcc;return function(_0x1055c2){if(_0x1055c2){return _0xefce0c['sendStatus'](_0x43ac40);}return _0xefce0c[_0x080d('0x12')](_0x43ac40)[_0x080d('0x13')]();};}function respondWithResult(_0x486050,_0x4d3662){_0x4d3662=_0x4d3662||0xc8;return function(_0x174bf6){if(_0x174bf6){return _0x486050[_0x080d('0x12')](_0x4d3662)[_0x080d('0x14')](_0x174bf6);}};}function respondWithFilteredResult(_0x3fd440,_0x292cea){return function(_0x2a78d4){if(_0x2a78d4){var _0x49c89b=typeof _0x292cea['offset']==='undefined'&&typeof _0x292cea[_0x080d('0x15')]===_0x080d('0x16');var _0x5def84=_0x2a78d4[_0x080d('0x17')];var _0x47611a=_0x49c89b?0x0:_0x292cea['offset'];var _0x596b59=_0x49c89b?_0x2a78d4[_0x080d('0x17')]:_0x292cea[_0x080d('0x18')]+_0x292cea[_0x080d('0x15')];var _0x11f8f0;if(_0x596b59>=_0x5def84){_0x596b59=_0x5def84;_0x11f8f0=0xc8;}else{_0x11f8f0=0xce;}_0x3fd440[_0x080d('0x12')](_0x11f8f0);return _0x3fd440['set'](_0x080d('0x19'),_0x47611a+'-'+_0x596b59+'/'+_0x5def84)[_0x080d('0x14')](_0x2a78d4);}return null;};}function saveUpdates(_0x271105){return function(_0x4babf3){if(_0x4babf3){return _0x4babf3[_0x080d('0x1a')](_0x271105)['then'](function(_0x11b7ae){return _0x11b7ae;});}return null;};}function removeEntity(_0x1a9975){return function(_0x59d979){if(_0x59d979){return _0x59d979[_0x080d('0x1b')]()[_0x080d('0x1c')](function(){_0x1a9975['status'](0xcc)[_0x080d('0x13')]();});}};}function handleEntityNotFound(_0x2dda3d){return function(_0x4ae827){if(!_0x4ae827){_0x2dda3d[_0x080d('0x1d')](0x194);}return _0x4ae827;};}function handleError(_0x57187e,_0x13afc1){_0x13afc1=_0x13afc1||0x1f4;return function(_0xe37101){logger[_0x080d('0x1e')](_0xe37101[_0x080d('0x1f')]);if(_0xe37101['name']){delete _0xe37101[_0x080d('0x20')];}_0x57187e[_0x080d('0x12')](_0x13afc1)[_0x080d('0x21')](_0xe37101);};}exports[_0x080d('0x22')]=function(_0x408fe3,_0x33037c){var _0x20d45f={};var _0x484070=_['map'](db[_0x080d('0x23')][_0x080d('0x24')],function(_0x1337b5){return{'name':_0x1337b5[_0x080d('0x25')],'type':_0x1337b5[_0x080d('0x26')][_0x080d('0x27')]};});_0x20d45f=qs[_0x080d('0x28')](_0x484070,_0x408fe3);return interaction[_0x080d('0x29')](_0x080d('0x2a'),_0x408fe3[_0x080d('0x2b')],_0x408fe3[_0x080d('0x2c')],_0x20d45f,_0x484070)[_0x080d('0x1c')](respondWithFilteredResult(_0x33037c,_0x20d45f))[_0x080d('0x2d')](handleError(_0x33037c,null));};exports[_0x080d('0x2e')]=function(_0x3e2cf2,_0x333a58){var _0x1f566a={};if(_0x3e2cf2[_0x080d('0x2b')][_0x080d('0x26')]&&_0x3e2cf2[_0x080d('0x2b')][_0x080d('0x26')]==='from'){_0x1f566a[_0x080d('0x2f')]=_0x3e2cf2[_0x080d('0x30')]['id'];}else{_0x1f566a['id']=_0x3e2cf2['params']['id'];}var _0x392085={'raw':![],'where':_0x1f566a},_0x1d360b={};_0x1d360b[_0x080d('0x31')]=_[_0x080d('0x32')](db[_0x080d('0x23')][_0x080d('0x24')]);_0x1d360b[_0x080d('0x2b')]=_[_0x080d('0x32')](_0x3e2cf2[_0x080d('0x2b')]);_0x1d360b[_0x080d('0x33')]=_['intersection'](_0x1d360b[_0x080d('0x31')],_0x1d360b[_0x080d('0x2b')]);_0x392085[_0x080d('0x34')]=_[_0x080d('0x35')](_0x1d360b[_0x080d('0x31')],qs[_0x080d('0x36')](_0x3e2cf2['query']['fields']));_0x392085[_0x080d('0x34')]=_0x392085[_0x080d('0x34')][_0x080d('0x37')]?_0x392085['attributes']:_0x1d360b['model'];if(_0x3e2cf2['query'][_0x080d('0x38')]){_0x392085[_0x080d('0x39')]=[{'all':!![]}];}_0x392085=_[_0x080d('0x3a')]({},_0x392085,_0x3e2cf2[_0x080d('0x3b')]);return db[_0x080d('0x23')][_0x080d('0x3c')](_0x392085)['then'](handleEntityNotFound(_0x333a58,null))[_0x080d('0x1c')](respondWithResult(_0x333a58,null))['catch'](handleError(_0x333a58,null));};exports[_0x080d('0x3d')]=function(_0xee4349,_0x4afaea){return db[_0x080d('0x23')][_0x080d('0x3d')](_0xee4349['body'],{})['then'](respondWithResult(_0x4afaea,0xc9))['catch'](handleError(_0x4afaea,null));};exports[_0x080d('0x1a')]=function(_0x30046e,_0x223e7b){if(_0x30046e[_0x080d('0x3e')]['id']){delete _0x30046e[_0x080d('0x3e')]['id'];}return db['OpenchannelInteraction'][_0x080d('0x3c')]({'where':{'id':_0x30046e[_0x080d('0x30')]['id']}})[_0x080d('0x1c')](handleEntityNotFound(_0x223e7b,null))[_0x080d('0x1c')](saveUpdates(_0x30046e[_0x080d('0x3e')],null))[_0x080d('0x1c')](respondWithResult(_0x223e7b,null))[_0x080d('0x2d')](handleError(_0x223e7b,null));};exports[_0x080d('0x1b')]=function(_0x3bab29,_0x3ee8b6){return db[_0x080d('0x23')][_0x080d('0x3c')]({'where':{'id':_0x3bab29[_0x080d('0x30')]['id']}})[_0x080d('0x1c')](handleEntityNotFound(_0x3ee8b6,null))[_0x080d('0x1c')](removeEntity(_0x3ee8b6,null))[_0x080d('0x2d')](handleError(_0x3ee8b6,null));};exports[_0x080d('0x3f')]=function(_0xb92488,_0x2d334b){return db[_0x080d('0x23')][_0x080d('0x3f')]()['then'](respondWithResult(_0x2d334b,null))[_0x080d('0x2d')](handleError(_0x2d334b,null));};exports[_0x080d('0x40')]=function(_0x453a26,_0x371827){return db[_0x080d('0x41')]['find']({'where':{'id':_0x453a26['params']['id']}})[_0x080d('0x1c')](handleEntityNotFound(_0x371827,null))[_0x080d('0x1c')](function(_0x208348){if(_0x208348){return _0x208348[_0x080d('0x40')](_0x453a26['body'][_0x080d('0x42')],_[_0x080d('0x43')](_0x453a26[_0x080d('0x3e')],[_0x080d('0x42'),'id'])||{});}})[_0x080d('0x1c')](respondWithResult(_0x371827,null))[_0x080d('0x2d')](handleError(_0x371827,null));};exports['getMessages']=function(_0x584ee5,_0x16dbf5){var _0x313080={'raw':![],'where':{}};var _0x333607={};var _0x200ddc={'count':0x0,'rows':[]};return db['OpenchannelInteraction'][_0x080d('0x44')]({'where':{'id':_0x584ee5[_0x080d('0x30')]['id']}})[_0x080d('0x1c')](handleEntityNotFound(_0x16dbf5,null))['then'](function(_0x3c7f34){if(_0x3c7f34){_0x333607[_0x080d('0x31')]=_[_0x080d('0x32')](db['OpenchannelMessage']['rawAttributes']);_0x333607['query']=_[_0x080d('0x32')](_0x584ee5[_0x080d('0x2b')]);_0x333607[_0x080d('0x33')]=_[_0x080d('0x35')](_0x333607[_0x080d('0x31')],_0x333607[_0x080d('0x2b')]);_0x313080[_0x080d('0x34')]=_['intersection'](_0x333607[_0x080d('0x31')],qs[_0x080d('0x36')](_0x584ee5['query']['fields']));_0x313080[_0x080d('0x34')]=_0x313080[_0x080d('0x34')][_0x080d('0x37')]?_0x313080[_0x080d('0x34')]:_0x333607[_0x080d('0x31')];if(!_0x584ee5['query'][_0x080d('0x45')](_0x080d('0x46'))){_0x313080['limit']=qs['limit'](_0x584ee5[_0x080d('0x2b')][_0x080d('0x15')]);_0x313080['offset']=qs[_0x080d('0x18')](_0x584ee5['query'][_0x080d('0x18')]);}_0x313080[_0x080d('0x47')]=qs[_0x080d('0x48')](_0x584ee5[_0x080d('0x2b')][_0x080d('0x48')]);_0x313080[_0x080d('0x49')]=qs['filters'](_[_0x080d('0x4a')](_0x584ee5[_0x080d('0x2b')],_0x333607['filters']));_0x313080[_0x080d('0x49')]['OpenchannelInteractionId']=_0x3c7f34['id'];if(_0x584ee5[_0x080d('0x2b')][_0x080d('0x4b')]){_0x313080['where']=_[_0x080d('0x3a')](_0x313080['where'],{'$or':_[_0x080d('0x4c')](_0x313080['attributes'],function(_0x353d10){var _0x2fb5e5={};_0x2fb5e5[_0x353d10]={'$like':'%'+_0x584ee5[_0x080d('0x2b')][_0x080d('0x4b')]+'%'};return _0x2fb5e5;})});}if(_0x584ee5[_0x080d('0x2b')][_0x080d('0x4d')]){var _0x3979d4=_0x584ee5[_0x080d('0x2b')][_0x080d('0x4d')]['split'](',');var _0x52c786={};_0x52c786[_0x3979d4[0x0]]={'$gte':moment(_0x3979d4[0x1])[_0x080d('0x4e')](_0x080d('0x4f'))};_0x313080[_0x080d('0x49')]=_[_0x080d('0x3a')](_0x313080[_0x080d('0x49')],_0x52c786);}_0x313080=_[_0x080d('0x3a')]({},_0x313080,_0x584ee5['options']);return db[_0x080d('0x41')][_0x080d('0x17')]({'where':_0x313080[_0x080d('0x49')]})[_0x080d('0x1c')](function(_0x4a868c){_0x200ddc['count']=_0x4a868c;if(_0x584ee5[_0x080d('0x2b')][_0x080d('0x38')]){_0x313080[_0x080d('0x39')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0x080d('0x29')](_0x313080);})[_0x080d('0x1c')](function(_0x2f57ac){_0x200ddc[_0x080d('0x50')]=_0x2f57ac;return _0x200ddc;});}})[_0x080d('0x1c')](respondWithFilteredResult(_0x16dbf5,_0x313080))[_0x080d('0x2d')](handleError(_0x16dbf5,null));};exports[_0x080d('0x51')]=function(_0x21d966,_0x2da7a8){return db['OpenchannelInteraction']['find']({'where':{'id':_0x21d966[_0x080d('0x30')]['id']}})['then'](handleEntityNotFound(_0x2da7a8,null))[_0x080d('0x1c')](function(_0x1bed0c){if(_0x1bed0c){return _0x1bed0c[_0x080d('0x52')](_0x21d966[_0x080d('0x3e')][_0x080d('0x42')],_[_0x080d('0x43')](_0x21d966[_0x080d('0x3e')],[_0x080d('0x42'),'id'])||{})['spread'](function(){return db[_0x080d('0x53')][_0x080d('0x29')]({'attributes':['id','name','color'],'where':{'id':_0x21d966[_0x080d('0x3e')]['ids']}});})[_0x080d('0x1c')](function(_0x4bc74b){socket[_0x080d('0x54')](_0x080d('0x55'),{'id':Number(_0x21d966[_0x080d('0x30')]['id']),'tags':_0x4bc74b||[]});return{'id':Number(_0x21d966[_0x080d('0x30')]['id']),'tags':_0x4bc74b||[]};});}})[_0x080d('0x1c')](respondWithResult(_0x2da7a8,null))[_0x080d('0x2d')](handleError(_0x2da7a8,null));};exports[_0x080d('0x56')]=function(_0x519d6b,_0x295fbf){return db[_0x080d('0x23')][_0x080d('0x3c')]({'where':{'id':_0x519d6b[_0x080d('0x30')]['id']}})[_0x080d('0x1c')](handleEntityNotFound(_0x295fbf,null))[_0x080d('0x1c')](function(_0x5ab604){if(_0x5ab604){return _0x5ab604[_0x080d('0x56')](_0x519d6b[_0x080d('0x2b')]['ids']);}})[_0x080d('0x1c')](respondWithStatusCode(_0x295fbf,null))[_0x080d('0x2d')](handleError(_0x295fbf,null));};exports[_0x080d('0x57')]=function(_0x1f6e99,_0x401139){var _0x1b3a06=moment()[_0x080d('0x58')]()[_0x080d('0x59')]();var _0x10d81e=path[_0x080d('0x5a')](config[_0x080d('0x5b')],_0x080d('0x5c'),_0x080d('0x5d'),_0x080d('0x5e'));var _0x591e5d=path[_0x080d('0x5a')](config[_0x080d('0x5b')],_0x080d('0x5c'),_0x080d('0x5d'),_0x080d('0x5f'));var _0x56e45a=path[_0x080d('0x5a')](_0x10d81e,_0x1b3a06);var _0x53d828=util['format'](_0x080d('0x60'),_0x1f6e99[_0x080d('0x30')]['id'],_0x1b3a06);var _0x36c14e=path[_0x080d('0x5a')](_0x10d81e,_0x53d828);var _0x3bca2f=[];_0x3bca2f[_0x080d('0x61')]({'model':db[_0x080d('0x62')],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x3bca2f[_0x080d('0x61')]({'model':db[_0x080d('0x63')],'as':_0x080d('0x64'),'attributes':['id','firstName',_0x080d('0x65')],'raw':!![]});if(_0x1f6e99[_0x080d('0x2b')][_0x080d('0x5f')]){_0x3bca2f[_0x080d('0x61')]({'model':db['Attachment'],'as':_0x080d('0x66'),'raw':!![]});}var _0x439917=[{'model':db[_0x080d('0x41')],'as':_0x080d('0x67'),'attributes':['id','body',_0x080d('0x68'),'direction',_0x080d('0x69'),_0x080d('0x6a')],'include':_0x3bca2f}];_0x439917['push']({'model':db[_0x080d('0x6b')],'as':_0x080d('0x6c'),'attributes':['id',_0x080d('0x20')]});_0x439917[_0x080d('0x61')]({'model':db[_0x080d('0x62')],'as':'Owner','attributes':['id',_0x080d('0x6d')]});return db[_0x080d('0x23')][_0x080d('0x3c')]({'where':{'id':_0x1f6e99[_0x080d('0x30')]['id']},'include':_0x439917})[_0x080d('0x1c')](handleEntityNotFound(_0x401139,null))[_0x080d('0x1c')](function(_0x575457){if(_0x575457){var _0x4c7767=_0x575457['get']({'plain':!![]});fs['mkdirSync'](_0x56e45a);var _0x444a83={'channel':'Openchannel','account':_0x4c7767[_0x080d('0x6c')][_0x080d('0x20')],'agent':_0x4c7767['Owner']?_0x4c7767[_0x080d('0x6e')][_0x080d('0x6d')]:_0x080d('0x6f'),'createdAt':moment(_0x4c7767['createdAt'])[_0x080d('0x4e')](_0x080d('0x4f'))[_0x080d('0x59')](),'closedAt':_0x4c7767[_0x080d('0x70')]?moment(_0x4c7767[_0x080d('0x71')])[_0x080d('0x4e')](_0x080d('0x4f'))[_0x080d('0x59')]():'','disposition':_0x4c7767[_0x080d('0x72')],'visibility':_0x4c7767['threadId']?_0x080d('0x73'):_0x080d('0x74'),'messages':_(_0x4c7767[_0x080d('0x67')])[_0x080d('0x4b')]({'secret':![]})[_0x080d('0x4c')](function(_0xf6ec76){if(_0xf6ec76[_0x080d('0x66')]){var _0x18584f=path[_0x080d('0x5a')](_0x591e5d,_0xf6ec76[_0x080d('0x66')][_0x080d('0x75')]);if(fs[_0x080d('0x76')](_0x18584f)){fs[_0x080d('0x77')](_0x18584f)[_0x080d('0x78')](fs['createWriteStream'](path[_0x080d('0x5a')](_0x56e45a,_0xf6ec76[_0x080d('0x66')][_0x080d('0x75')])));}}return{'date':moment(_0xf6ec76[_0x080d('0x68')])[_0x080d('0x4e')](_0x080d('0x4f'))[_0x080d('0x59')](),'sender':_0xf6ec76[_0x080d('0x79')]==='out'?_0xf6ec76[_0x080d('0x62')]?_0xf6ec76['User'][_0x080d('0x6d')]:_0x080d('0x7a'):_0xf6ec76[_0x080d('0x64')][_0x080d('0x7b')]+(_0xf6ec76[_0x080d('0x64')]['lastName']?'\x20'+_0xf6ec76[_0x080d('0x64')][_0x080d('0x65')]:''),'body':_0xf6ec76[_0x080d('0x66')]?_0xf6ec76['Attachment'][_0x080d('0x75')]:_0xf6ec76[_0x080d('0x3e')],'direction':_0xf6ec76[_0x080d('0x79')]===_0x080d('0x7c')?'A':'C','secret':_0xf6ec76[_0x080d('0x69')],'read':_0xf6ec76[_0x080d('0x6a')],'attachment':_0xf6ec76[_0x080d('0x66')]};})[_0x080d('0x7d')]()};return ejs['renderFile'](path[_0x080d('0x5a')](config[_0x080d('0x5b')],_0x080d('0x5c'),_0x080d('0x7e'),_0x080d('0x7f')),{'interaction':_0x444a83})[_0x080d('0x1c')](function(_0x3356a3){var _0x2fc3e0=path[_0x080d('0x5a')](_0x56e45a,_0x080d('0x80')+_0x4c7767['id']+'-'+_0x1b3a06+_0x080d('0x81'));var _0x238780={'path':_0x2fc3e0,'channel':_0x080d('0x82'),'interactionId':_0x4c7767['id']};return pdf[_0x080d('0x83')](_0x3356a3,_0x238780);})[_0x080d('0x1c')](function(){return new Promise(function(_0x3f0075,_0x50dc69){zipdir(_0x56e45a,{'saveTo':_0x36c14e},function(_0x47c9d,_0x1f299c){if(_0x47c9d)return _0x50dc69(_0x47c9d);return _0x3f0075(_0x1f299c);});})[_0x080d('0x1c')](function(){return new Promise(function(_0x60fbce,_0x5999c2){rimraf(_0x56e45a,function(_0x59cbb9){if(_0x59cbb9)_0x5999c2(_0x59cbb9);return _0x60fbce();});});})['then'](function(){return _0x401139[_0x080d('0x57')](_0x36c14e,_0x53d828,function(_0x54e402){if(_0x54e402){logger['error'](_0x080d('0x84'),_0x54e402);}else{fs['unlinkSync'](_0x36c14e);}});});});}else{return _0x401139[_0x080d('0x1d')](0xc8);}})['catch'](handleError(_0x401139,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 7061d9b..af8fa44 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 _0x10aa=['map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0x10aa,0x16e));var _0xa10a=function(_0x43a96e,_0x111f6f){_0x43a96e=_0x43a96e-0x0;var _0x1af069=_0x10aa[_0x43a96e];return _0x1af069;};'use strict';var EventEmitter=require(_0xa10a('0x0'));var OpenchannelInteraction=require(_0xa10a('0x1'))['db'][_0xa10a('0x2')];var OpenchannelMessage=require('../../mysqldb')['db'][_0xa10a('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xa10a('0x4')](0x0);var events={'afterCreate':_0xa10a('0x5'),'afterUpdate':_0xa10a('0x6'),'afterDestroy':_0xa10a('0x7')};function emitEvent(_0x1c83a4){return function(_0x437d94,_0x33a364,_0x5d3d15){_0x437d94[_0xa10a('0x8')]({'attributes':['id'],'raw':!![]})[_0xa10a('0x9')](function(_0x1b4480){_0x437d94[_0xa10a('0xa')](_0xa10a('0xb'),_0x1b4480[_0xa10a('0xc')](function(_0x1dfb47){return{'id':_0x1dfb47['id']};}));return OpenchannelMessage[_0xa10a('0xd')]({'where':{'OpenchannelInteractionId':_0x437d94['id'],'direction':'in','read':![]},'raw':!![]});})[_0xa10a('0x9')](function(_0x3fa5cd){_0x437d94[_0xa10a('0xa')](_0xa10a('0xe'),_0x3fa5cd[_0xa10a('0xf')]);OpenchannelInteractionEvents[_0xa10a('0x10')](_0x1c83a4+':'+_0x437d94['id'],_0x437d94);OpenchannelInteractionEvents[_0xa10a('0x10')](_0x1c83a4,_0x437d94);_0x5d3d15(null);})[_0xa10a('0x11')](_0x5d3d15(null));};}for(var e in events){if(events[_0xa10a('0x12')](e)){var event=events[e];OpenchannelInteraction[_0xa10a('0x13')](e,emitEvent(event));}}module[_0xa10a('0x14')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x1d3f=['remove','getUsers','then','setDataValue','Users','map','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','save','update'];(function(_0x42e248,_0x14d672){var _0x2746a3=function(_0x274fba){while(--_0x274fba){_0x42e248['push'](_0x42e248['shift']());}};_0x2746a3(++_0x14d672);}(_0x1d3f,0x139));var _0xf1d3=function(_0x49aa99,_0x4ef618){_0x49aa99=_0x49aa99-0x0;var _0x1786d7=_0x1d3f[_0x49aa99];return _0x1786d7;};'use strict';var EventEmitter=require(_0xf1d3('0x0'));var OpenchannelInteraction=require(_0xf1d3('0x1'))['db'][_0xf1d3('0x2')];var OpenchannelMessage=require(_0xf1d3('0x1'))['db'][_0xf1d3('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xf1d3('0x4')](0x0);var events={'afterCreate':_0xf1d3('0x5'),'afterUpdate':_0xf1d3('0x6'),'afterDestroy':_0xf1d3('0x7')};function emitEvent(_0x5b562b){return function(_0xe0e938,_0x415f5c,_0x37d442){_0xe0e938[_0xf1d3('0x8')]({'attributes':['id'],'raw':!![]})[_0xf1d3('0x9')](function(_0x112501){_0xe0e938[_0xf1d3('0xa')](_0xf1d3('0xb'),_0x112501[_0xf1d3('0xc')](function(_0x38261d){return{'id':_0x38261d['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0xe0e938['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf1d3('0x9')](function(_0x55df69){_0xe0e938[_0xf1d3('0xa')](_0xf1d3('0xd'),_0x55df69[_0xf1d3('0xe')]);OpenchannelInteractionEvents[_0xf1d3('0xf')](_0x5b562b+':'+_0xe0e938['id'],_0xe0e938);OpenchannelInteractionEvents[_0xf1d3('0xf')](_0x5b562b,_0xe0e938);_0x37d442(null);})[_0xf1d3('0x10')](_0x37d442(null));};}for(var e in events){if(events[_0xf1d3('0x11')](e)){var event=events[e];OpenchannelInteraction[_0xf1d3('0x12')](e,emitEvent(event));}}module[_0xf1d3('0x13')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 4363bd2..d6798ac 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 _0xf9d6=['format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','utf8mb4','utf8mb4_unicode_ci','changed','closedAt'];(function(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0xf9d6,0x134));var _0x6f9d=function(_0x1283d4,_0x36b6f1){_0x1283d4=_0x1283d4-0x0;var _0x433643=_0xf9d6[_0x1283d4];return _0x433643;};'use strict';var _=require(_0x6f9d('0x0'));var util=require('util');var logger=require(_0x6f9d('0x1'))(_0x6f9d('0x2'));var moment=require(_0x6f9d('0x3'));var BPromise=require(_0x6f9d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6f9d('0x5'));var rimraf=require(_0x6f9d('0x6'));var config=require(_0x6f9d('0x7'));var attributes=require(_0x6f9d('0x8'));module[_0x6f9d('0x9')]=function(_0x1e8234,_0x47475e){return _0x1e8234[_0x6f9d('0xa')](_0x6f9d('0xb'),attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6f9d('0xc'),'collate':_0x6f9d('0xd'),'hooks':{'beforeUpdate':function(_0x2a6037,_0x593deb,_0x2e1761){if(_0x2a6037[_0x6f9d('0xe')]('closed')){_0x2a6037[_0x6f9d('0xf')]=moment()[_0x6f9d('0x10')](_0x6f9d('0x11'));}_0x2e1761(null,_0x2a6037);}}});}; \ No newline at end of file +var _0xf4f5=['api','moment','bluebird','request-promise','path','../../config/environment','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x4a0d89,_0x22132c){var _0x1329a0=function(_0x5c8582){while(--_0x5c8582){_0x4a0d89['push'](_0x4a0d89['shift']());}};_0x1329a0(++_0x22132c);}(_0xf4f5,0x1dc));var _0x5f4f=function(_0x367c24,_0x4993a4){_0x367c24=_0x367c24-0x0;var _0x46a215=_0xf4f5[_0x367c24];return _0x46a215;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x5f4f('0x0'));var moment=require(_0x5f4f('0x1'));var BPromise=require(_0x5f4f('0x2'));var rp=require(_0x5f4f('0x3'));var fs=require('fs');var path=require(_0x5f4f('0x4'));var rimraf=require('rimraf');var config=require(_0x5f4f('0x5'));var attributes=require(_0x5f4f('0x6'));module[_0x5f4f('0x7')]=function(_0x21a321,_0x5721c1){return _0x21a321[_0x5f4f('0x8')](_0x5f4f('0x9'),attributes,{'tableName':_0x5f4f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5f4f('0xb'),'collate':_0x5f4f('0xc'),'hooks':{'beforeUpdate':function(_0x53e034,_0x332267,_0x4e1ff4){if(_0x53e034[_0x5f4f('0xd')](_0x5f4f('0xe'))){_0x53e034[_0x5f4f('0xf')]=moment()['format'](_0x5f4f('0x10'));}_0x4e1ff4(null,_0x53e034);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 21fa3b3..22c043c 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 _0x878f=['lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','then','info','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','error','code','message','OpenchannelInteraction,\x20%s,\x20%s','OpenchannelInteraction','update','body','options','where','attributes','limit','UpdateOpenchannelInteraction','stringify','catch','AddTagsToOpenchannelInteraction','find','ids','omit','AddTags'];(function(_0x556dcd,_0x589963){var _0x3bd95b=function(_0x4a791f){while(--_0x4a791f){_0x556dcd['push'](_0x556dcd['shift']());}};_0x3bd95b(++_0x589963);}(_0x878f,0x1ee));var _0xf878=function(_0x2fc63a,_0x108859){_0x2fc63a=_0x2fc63a-0x0;var _0x5a49b7=_0x878f[_0x2fc63a];return _0x5a49b7;};'use strict';var _=require(_0xf878('0x0'));var util=require(_0xf878('0x1'));var moment=require('moment');var BPromise=require(_0xf878('0x2'));var rs=require(_0xf878('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf878('0x4'));var logger=require(_0xf878('0x5'))(_0xf878('0x6'));var config=require(_0xf878('0x7'));var jayson=require(_0xf878('0x8'));var client=jayson['client'][_0xf878('0x9')]({'port':0x232a});config[_0xf878('0xa')]=_['defaults'](config['redis'],{'host':_0xf878('0xb'),'port':0x18eb});var socket=require(_0xf878('0xc'))(new Redis(config[_0xf878('0xa')]));require(_0xf878('0xd'))['register'](socket);function respondWithRpcPromise(_0x173316,_0x2a3341,_0x1984ea){return new BPromise(function(_0xdf939e,_0x19f90a){return client['request'](_0x173316,_0x1984ea)[_0xf878('0xe')](function(_0x1ea4d0){logger[_0xf878('0xf')]('OpenchannelInteraction,\x20%s,\x20%s',_0x2a3341,_0xf878('0x10'));logger[_0xf878('0x11')](_0xf878('0x12'),_0x2a3341,_0xf878('0x10'),JSON['stringify'](_0x1ea4d0));if(_0x1ea4d0[_0xf878('0x13')]){if(_0x1ea4d0['error'][_0xf878('0x14')]===0x1f4){logger[_0xf878('0x13')]('OpenchannelInteraction,\x20%s,\x20%s',_0x2a3341,_0x1ea4d0[_0xf878('0x13')][_0xf878('0x15')]);return _0x19f90a(_0x1ea4d0[_0xf878('0x13')][_0xf878('0x15')]);}logger[_0xf878('0x13')](_0xf878('0x16'),_0x2a3341,_0x1ea4d0[_0xf878('0x13')][_0xf878('0x15')]);return _0xdf939e(_0x1ea4d0[_0xf878('0x13')]['message']);}else{logger['info']('OpenchannelInteraction,\x20%s,\x20%s',_0x2a3341,_0xf878('0x10'));_0xdf939e(_0x1ea4d0['result'][_0xf878('0x15')]);}})['catch'](function(_0x4d5ee3){logger[_0xf878('0x13')](_0xf878('0x16'),_0x2a3341,_0x4d5ee3);_0x19f90a(_0x4d5ee3);});});}exports['UpdateOpenchannelInteraction']=function(_0x1cdd90){var _0x3a7ad3=this;return new Promise(function(_0x5c13c9,_0x18d474){return db[_0xf878('0x17')][_0xf878('0x18')](_0x1cdd90[_0xf878('0x19')],{'raw':_0x1cdd90['options']?_0x1cdd90['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1cdd90[_0xf878('0x1a')]?_0x1cdd90[_0xf878('0x1a')][_0xf878('0x1b')]||null:null,'attributes':_0x1cdd90[_0xf878('0x1a')]?_0x1cdd90[_0xf878('0x1a')][_0xf878('0x1c')]||null:null,'limit':_0x1cdd90[_0xf878('0x1a')]?_0x1cdd90[_0xf878('0x1a')][_0xf878('0x1d')]||null:null})[_0xf878('0xe')](function(_0x493ee5){logger[_0xf878('0xf')](_0xf878('0x1e'),_0x1cdd90);logger[_0xf878('0x11')](_0xf878('0x1e'),_0x1cdd90,JSON[_0xf878('0x1f')](_0x493ee5));_0x5c13c9(_0x493ee5);})[_0xf878('0x20')](function(_0x1726fa){logger[_0xf878('0x13')](_0xf878('0x1e'),_0x1726fa['message'],_0x1cdd90);_0x18d474(_0x3a7ad3[_0xf878('0x13')](0x1f4,_0x1726fa[_0xf878('0x15')]));});});};exports[_0xf878('0x21')]=function(_0x2ca660){return new Promise(function(_0x114384,_0x45f297){return db[_0xf878('0x17')][_0xf878('0x22')]({'where':_0x2ca660['options']?_0x2ca660[_0xf878('0x1a')][_0xf878('0x1b')]||null:null})[_0xf878('0xe')](function(_0x5a565e){if(_0x5a565e){return _0x5a565e['addTags'](_0x2ca660['body'][_0xf878('0x23')],_[_0xf878('0x24')](_0x2ca660['body'],['ids','id'])||{});}})['spread'](function(_0x32c9b1){logger['info']('AddTags',_0x2ca660);logger[_0xf878('0x11')](_0xf878('0x25'),_0x2ca660,JSON[_0xf878('0x1f')](_0x32c9b1));_0x114384(_0x32c9b1);})[_0xf878('0x20')](function(_0x437ab7){logger[_0xf878('0x13')](_0xf878('0x25'),_0x437ab7[_0xf878('0x15')],_0x2ca660);_0x45f297(_this[_0xf878('0x13')](0x1f4,_0x437ab7[_0xf878('0x15')]));});});}; \ No newline at end of file +var _0x5b4e=['catch','UpdateOpenchannelInteraction','OpenchannelInteraction','body','options','raw','attributes','limit','stringify','AddTagsToOpenchannelInteraction','where','ids','omit','spread','AddTags','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','./openchannelInteraction.socket','register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result'];(function(_0x52fa1e,_0x39a40f){var _0x26849d=function(_0x4e52c3){while(--_0x4e52c3){_0x52fa1e['push'](_0x52fa1e['shift']());}};_0x26849d(++_0x39a40f);}(_0x5b4e,0x1b1));var _0xe5b4=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x5b4e[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0xe5b4('0x0'));var moment=require(_0xe5b4('0x1'));var BPromise=require(_0xe5b4('0x2'));var rs=require(_0xe5b4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe5b4('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xe5b4('0x5'))('rpc');var config=require(_0xe5b4('0x6'));var jayson=require(_0xe5b4('0x7'));var client=jayson[_0xe5b4('0x8')][_0xe5b4('0x9')]({'port':0x232a});config['redis']=_[_0xe5b4('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xe5b4('0xb'))[_0xe5b4('0xc')](socket);function respondWithRpcPromise(_0x143eac,_0x126a78,_0x42309c){return new BPromise(function(_0x92137b,_0x5e7688){return client[_0xe5b4('0xd')](_0x143eac,_0x42309c)[_0xe5b4('0xe')](function(_0x4151e7){logger[_0xe5b4('0xf')](_0xe5b4('0x10'),_0x126a78,_0xe5b4('0x11'));logger[_0xe5b4('0x12')]('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x126a78,_0xe5b4('0x11'),JSON['stringify'](_0x4151e7));if(_0x4151e7[_0xe5b4('0x13')]){if(_0x4151e7['error'][_0xe5b4('0x14')]===0x1f4){logger[_0xe5b4('0x13')](_0xe5b4('0x10'),_0x126a78,_0x4151e7[_0xe5b4('0x13')][_0xe5b4('0x15')]);return _0x5e7688(_0x4151e7[_0xe5b4('0x13')][_0xe5b4('0x15')]);}logger[_0xe5b4('0x13')](_0xe5b4('0x10'),_0x126a78,_0x4151e7[_0xe5b4('0x13')][_0xe5b4('0x15')]);return _0x92137b(_0x4151e7[_0xe5b4('0x13')][_0xe5b4('0x15')]);}else{logger['info'](_0xe5b4('0x10'),_0x126a78,_0xe5b4('0x11'));_0x92137b(_0x4151e7[_0xe5b4('0x16')][_0xe5b4('0x15')]);}})[_0xe5b4('0x17')](function(_0x24171f){logger[_0xe5b4('0x13')](_0xe5b4('0x10'),_0x126a78,_0x24171f);_0x5e7688(_0x24171f);});});}exports[_0xe5b4('0x18')]=function(_0x141658){var _0x18a6b0=this;return new Promise(function(_0x490fa9,_0x51563d){return db[_0xe5b4('0x19')]['update'](_0x141658[_0xe5b4('0x1a')],{'raw':_0x141658[_0xe5b4('0x1b')]?_0x141658['options'][_0xe5b4('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x141658[_0xe5b4('0x1b')]?_0x141658['options']['where']||null:null,'attributes':_0x141658[_0xe5b4('0x1b')]?_0x141658[_0xe5b4('0x1b')][_0xe5b4('0x1d')]||null:null,'limit':_0x141658['options']?_0x141658[_0xe5b4('0x1b')][_0xe5b4('0x1e')]||null:null})[_0xe5b4('0xe')](function(_0x17e6c6){logger[_0xe5b4('0xf')](_0xe5b4('0x18'),_0x141658);logger[_0xe5b4('0x12')]('UpdateOpenchannelInteraction',_0x141658,JSON[_0xe5b4('0x1f')](_0x17e6c6));_0x490fa9(_0x17e6c6);})['catch'](function(_0x1c94b2){logger[_0xe5b4('0x13')](_0xe5b4('0x18'),_0x1c94b2['message'],_0x141658);_0x51563d(_0x18a6b0['error'](0x1f4,_0x1c94b2['message']));});});};exports[_0xe5b4('0x20')]=function(_0x1176fc){return new Promise(function(_0x2f4dbe,_0x559cee){return db[_0xe5b4('0x19')]['find']({'where':_0x1176fc['options']?_0x1176fc[_0xe5b4('0x1b')][_0xe5b4('0x21')]||null:null})['then'](function(_0x4167c5){if(_0x4167c5){return _0x4167c5['addTags'](_0x1176fc[_0xe5b4('0x1a')][_0xe5b4('0x22')],_[_0xe5b4('0x23')](_0x1176fc['body'],[_0xe5b4('0x22'),'id'])||{});}})[_0xe5b4('0x24')](function(_0x3256da){logger[_0xe5b4('0xf')](_0xe5b4('0x25'),_0x1176fc);logger[_0xe5b4('0x12')](_0xe5b4('0x25'),_0x1176fc,JSON[_0xe5b4('0x1f')](_0x3256da));_0x2f4dbe(_0x3256da);})[_0xe5b4('0x17')](function(_0x1749c6){logger['error'](_0xe5b4('0x25'),_0x1749c6['message'],_0x1176fc);_0x559cee(_this[_0xe5b4('0x13')](0x1f4,_0x1749c6[_0xe5b4('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 19eae0b..84ded6b 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 _0xafd2=['openchannelInteraction:','./openchannelInteraction.events','emit'];(function(_0x361d10,_0x1c4634){var _0x1f6d80=function(_0x12744c){while(--_0x12744c){_0x361d10['push'](_0x361d10['shift']());}};_0x1f6d80(++_0x1c4634);}(_0xafd2,0x15d));var _0x2afd=function(_0x1a8d37,_0xc8baf2){_0x1a8d37=_0x1a8d37-0x0;var _0x249f3e=_0xafd2[_0x1a8d37];return _0x249f3e;};'use strict';var OpenchannelInteractionEvents=require(_0x2afd('0x0'));var events=['save','remove','update'];function createListener(_0x3a80e6,_0x248625){return function(_0x539832){_0x248625[_0x2afd('0x1')](_0x3a80e6,_0x539832);};}function removeListener(_0xc0e973,_0x1eab35){return function(){OpenchannelInteractionEvents['removeListener'](_0xc0e973,_0x1eab35);};}exports['register']=function(_0x2bc188){for(var _0x399087=0x0,_0x30755a=events['length'];_0x399087<_0x30755a;_0x399087++){var _0x5c7145=events[_0x399087];var _0x3a6f7d=createListener(_0x2afd('0x2')+_0x5c7145,_0x2bc188);OpenchannelInteractionEvents['on'](_0x5c7145,_0x3a6f7d);}}; \ No newline at end of file +var _0xc920=['remove','update','emit','removeListener','register','length','openchannelInteraction:','./openchannelInteraction.events','save'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xc920,0x1c9));var _0x0c92=function(_0x255caf,_0x2f893b){_0x255caf=_0x255caf-0x0;var _0x25e862=_0xc920[_0x255caf];return _0x25e862;};'use strict';var OpenchannelInteractionEvents=require(_0x0c92('0x0'));var events=[_0x0c92('0x1'),_0x0c92('0x2'),_0x0c92('0x3')];function createListener(_0x1c2c71,_0x3c0814){return function(_0x112e44){_0x3c0814[_0x0c92('0x4')](_0x1c2c71,_0x112e44);};}function removeListener(_0x54fc71,_0x7ec041){return function(){OpenchannelInteractionEvents[_0x0c92('0x5')](_0x54fc71,_0x7ec041);};}exports[_0x0c92('0x6')]=function(_0x140c07){for(var _0x16383b=0x0,_0x530c31=events[_0x0c92('0x7')];_0x16383b<_0x530c31;_0x16383b++){var _0x5c3825=events[_0x16383b];var _0x39d9d8=createListener(_0x0c92('0x8')+_0x5c3825,_0x140c07);OpenchannelInteractionEvents['on'](_0x5c3825,_0x39d9d8);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 51c0297..63b59bf 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','tracked','openchannel','openchannelmessage:create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','util'];(function(_0x97ec0e,_0x10eb67){var _0x1fd9dd=function(_0x187652){while(--_0x187652){_0x97ec0e['push'](_0x97ec0e['shift']());}};_0x1fd9dd(++_0x10eb67);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./openchannelMessage.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),interaction[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x0d8b('0x10')),controller['create']);router[_0x0d8b('0x11')]('/:id',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x12')]);router[_0x0d8b('0x11')](_0x0d8b('0x13'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x14')]);router[_0x0d8b('0x11')](_0x0d8b('0x15'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x16')]);router[_0x0d8b('0x17')](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x18')]);module['exports']=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','tracked','openchannel','openchannelmessage:create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','util'];(function(_0x120564,_0x3c18cf){var _0x579980=function(_0x108c13){while(--_0x108c13){_0x120564['push'](_0x120564['shift']());}};_0x579980(++_0x3c18cf);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./openchannelMessage.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),interaction[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x0d8b('0x10')),controller['create']);router[_0x0d8b('0x11')]('/:id',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x12')]);router[_0x0d8b('0x11')](_0x0d8b('0x13'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x14')]);router[_0x0d8b('0x11')](_0x0d8b('0x15'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x16')]);router[_0x0d8b('0x17')](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 5503f6e..3e57fcd 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 _0xb10b=['DATE','STRING','sequelize','TEXT','medium','BOOLEAN','ENUM','out'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xb10b,0x12a));var _0xbb10=function(_0x481366,_0x41e46b){_0x481366=_0x481366-0x0;var _0x229649=_0xb10b[_0x481366];return _0x229649;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'body':{'type':Sequelize[_0xbb10('0x1')](_0xbb10('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xbb10('0x3')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xbb10('0x4')]('in',_0xbb10('0x5')),'defaultValue':_0xbb10('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0xbb10('0x6')]},'providerName':{'type':Sequelize[_0xbb10('0x7')]},'providerResponse':{'type':Sequelize[_0xbb10('0x1')]}}; \ No newline at end of file +var _0xd4dc=['ENUM','out','STRING','sequelize','TEXT','medium','BOOLEAN'];(function(_0xbae489,_0x59368c){var _0x1b2b2c=function(_0x3fb66b){while(--_0x3fb66b){_0xbae489['push'](_0xbae489['shift']());}};_0x1b2b2c(++_0x59368c);}(_0xd4dc,0xff));var _0xcd4d=function(_0x4ed520,_0x21be63){_0x4ed520=_0x4ed520-0x0;var _0x4415a6=_0xd4dc[_0x4ed520];return _0x4415a6;};'use strict';var Sequelize=require(_0xcd4d('0x0'));module['exports']={'body':{'type':Sequelize[_0xcd4d('0x1')](_0xcd4d('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xcd4d('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0xcd4d('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xcd4d('0x4')]('in',_0xcd4d('0x5')),'defaultValue':_0xcd4d('0x5'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0xcd4d('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 12525d4..0eb5f33 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 _0x1a0b=['SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','OpenchannelInteractionId','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','contact','interface','rejectmessage','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','client','http','request','then','error','code','message','OpenchannelMessage,\x20%s,\x20%s','result','catch','end','status','offset','undefined','limit','count','set','reject','save','update','destroy','sendStatus','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','pick','filter','merge','where','VIRTUAL','options','includeAll','include','OpenchannelMessage','findAll','rows','find','create','body','params','describe','openchannel-interactions','accept','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','OpenchannelInteraction','isNil','read1stAt','info','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','stringify','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','User','agent','fullname','internal'];(function(_0x45fe84,_0xa0c882){var _0x2e7fba=function(_0x2f1b29){while(--_0x2f1b29){_0x45fe84['push'](_0x45fe84['shift']());}};_0x2e7fba(++_0xa0c882);}(_0x1a0b,0x18f));var _0xb1a0=function(_0x382672,_0x19b4f5){_0x382672=_0x382672-0x0;var _0x36c2cd=_0x1a0b[_0x382672];return _0x36c2cd;};'use strict';var emlformat=require(_0xb1a0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb1a0('0x1'));var jsonpatch=require(_0xb1a0('0x2'));var rp=require(_0xb1a0('0x3'));var moment=require(_0xb1a0('0x4'));var BPromise=require(_0xb1a0('0x5'));var Mustache=require(_0xb1a0('0x6'));var util=require(_0xb1a0('0x7'));var path=require(_0xb1a0('0x8'));var sox=require(_0xb1a0('0x9'));var csv=require(_0xb1a0('0xa'));var ejs=require(_0xb1a0('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb1a0('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xb1a0('0xd'));var toCsv=require(_0xb1a0('0xa'));var querystring=require(_0xb1a0('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb1a0('0xf'));var qs=require(_0xb1a0('0x10'));var as=require(_0xb1a0('0x11'));var hardwareService=require(_0xb1a0('0x12'));var logger=require(_0xb1a0('0x13'))(_0xb1a0('0x14'));var utils=require('../../config/utils');var config=require(_0xb1a0('0x15'));var licenseUtil=require(_0xb1a0('0x16'));var db=require(_0xb1a0('0x17'))['db'];config['redis']=_[_0xb1a0('0x18')](config[_0xb1a0('0x19')],{'host':_0xb1a0('0x1a'),'port':0x18eb});var socket=require(_0xb1a0('0x1b'))(new Redis(config['redis']));require(_0xb1a0('0x1c'))[_0xb1a0('0x1d')](socket);var jayson=require(_0xb1a0('0x1e'));var client=jayson[_0xb1a0('0x1f')][_0xb1a0('0x20')]({'port':0x232c});var client9002=jayson[_0xb1a0('0x1f')][_0xb1a0('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x44c05d,_0x393c2e,_0x437d8a,_0x104389){return new BPromise(function(_0x65f9b3,_0x2bbb14){var _0x3e6d71=_0x104389||client;return _0x3e6d71[_0xb1a0('0x21')](_0x44c05d,_0x437d8a)[_0xb1a0('0x22')](function(_0x2c3d0e){logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x393c2e,'request\x20sent');logger['debug']('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x393c2e,'request\x20sent',JSON['stringify'](_0x2c3d0e));if(_0x2c3d0e['error']){if(_0x2c3d0e[_0xb1a0('0x23')][_0xb1a0('0x24')]===0x1f4){logger[_0xb1a0('0x23')]('OpenchannelMessage,\x20%s,\x20%s',_0x393c2e,_0x2c3d0e[_0xb1a0('0x23')][_0xb1a0('0x25')]);return _0x2bbb14(_0x2c3d0e[_0xb1a0('0x23')]['message']);}logger[_0xb1a0('0x23')]('OpenchannelMessage,\x20%s,\x20%s',_0x393c2e,_0x2c3d0e[_0xb1a0('0x23')][_0xb1a0('0x25')]);return _0x65f9b3(_0x2c3d0e[_0xb1a0('0x23')][_0xb1a0('0x25')]);}else{logger['info'](_0xb1a0('0x26'),_0x393c2e,'request\x20sent');_0x65f9b3(_0x2c3d0e[_0xb1a0('0x27')][_0xb1a0('0x25')]);}})[_0xb1a0('0x28')](function(_0x10e675){logger[_0xb1a0('0x23')](_0xb1a0('0x26'),_0x393c2e,_0x10e675);_0x2bbb14(_0x10e675);});});}function respondWithStatusCode(_0xb64c7d,_0x282119){_0x282119=_0x282119||0xcc;return function(_0x2e4630){if(_0x2e4630){return _0xb64c7d['sendStatus'](_0x282119);}return _0xb64c7d['status'](_0x282119)[_0xb1a0('0x29')]();};}function respondWithResult(_0x1006dc,_0x3b8900){_0x3b8900=_0x3b8900||0xc8;return function(_0x480854){if(_0x480854){return _0x1006dc[_0xb1a0('0x2a')](_0x3b8900)['json'](_0x480854);}};}function respondWithFilteredResult(_0x3fff58,_0x5a809f){return function(_0x38eab3){if(_0x38eab3){var _0x1d5ec7=typeof _0x5a809f[_0xb1a0('0x2b')]===_0xb1a0('0x2c')&&typeof _0x5a809f[_0xb1a0('0x2d')]===_0xb1a0('0x2c');var _0x320e38=_0x38eab3[_0xb1a0('0x2e')];var _0x1abda5=_0x1d5ec7?0x0:_0x5a809f['offset'];var _0x19b4e4=_0x1d5ec7?_0x38eab3[_0xb1a0('0x2e')]:_0x5a809f[_0xb1a0('0x2b')]+_0x5a809f[_0xb1a0('0x2d')];var _0x3953b2;if(_0x19b4e4>=_0x320e38){_0x19b4e4=_0x320e38;_0x3953b2=0xc8;}else{_0x3953b2=0xce;}_0x3fff58[_0xb1a0('0x2a')](_0x3953b2);return _0x3fff58[_0xb1a0('0x2f')]('Content-Range',_0x1abda5+'-'+_0x19b4e4+'/'+_0x320e38)['json'](_0x38eab3);}return null;};}function patchUpdates(_0xa038bc){return function(_0x1826c3){try{jsonpatch['apply'](_0x1826c3,_0xa038bc,!![]);}catch(_0x42008f){return BPromise[_0xb1a0('0x30')](_0x42008f);}return _0x1826c3[_0xb1a0('0x31')]();};}function saveUpdates(_0x25f44f,_0x69ef32){return function(_0x1822d9){if(_0x1822d9){return _0x1822d9[_0xb1a0('0x32')](_0x25f44f)[_0xb1a0('0x22')](function(_0x39e4f2){return _0x39e4f2;});}return null;};}function removeEntity(_0x357e23,_0x12ef87){return function(_0x1a0e11){if(_0x1a0e11){return _0x1a0e11[_0xb1a0('0x33')]()[_0xb1a0('0x22')](function(){_0x357e23[_0xb1a0('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x297e1d,_0x2bec57){return function(_0x3732fb){if(!_0x3732fb){_0x297e1d[_0xb1a0('0x34')](0x194);}return _0x3732fb;};}function handleError(_0x37da51,_0x52e481){_0x52e481=_0x52e481||0x1f4;return function(_0x5e5f88){logger[_0xb1a0('0x23')](_0x5e5f88[_0xb1a0('0x35')]);if(_0x5e5f88[_0xb1a0('0x36')]){delete _0x5e5f88[_0xb1a0('0x36')];}_0x37da51[_0xb1a0('0x2a')](_0x52e481)[_0xb1a0('0x37')](_0x5e5f88);};}exports['index']=function(_0x21ba57,_0x466dda){var _0x520639={},_0x49baab={},_0x5a6617={'count':0x0,'rows':[]};var _0x581962=_[_0xb1a0('0x38')](db['OpenchannelMessage'][_0xb1a0('0x39')],function(_0x33efbd){return{'name':_0x33efbd[_0xb1a0('0x3a')],'type':_0x33efbd[_0xb1a0('0x3b')][_0xb1a0('0x3c')]};});_0x49baab[_0xb1a0('0x3d')]=_[_0xb1a0('0x38')](_0x581962,_0xb1a0('0x36'));_0x49baab[_0xb1a0('0x3e')]=_[_0xb1a0('0x3f')](_0x21ba57[_0xb1a0('0x3e')]);_0x49baab[_0xb1a0('0x40')]=_[_0xb1a0('0x41')](_0x49baab[_0xb1a0('0x3d')],_0x49baab['query']);_0x520639['attributes']=_[_0xb1a0('0x41')](_0x49baab[_0xb1a0('0x3d')],qs[_0xb1a0('0x42')](_0x21ba57['query']['fields']));_0x520639[_0xb1a0('0x43')]=_0x520639[_0xb1a0('0x43')][_0xb1a0('0x44')]?_0x520639[_0xb1a0('0x43')]:_0x49baab[_0xb1a0('0x3d')];if(!_0x21ba57[_0xb1a0('0x3e')][_0xb1a0('0x45')](_0xb1a0('0x46'))){_0x520639['limit']=qs[_0xb1a0('0x2d')](_0x21ba57['query'][_0xb1a0('0x2d')]);_0x520639['offset']=qs[_0xb1a0('0x2b')](_0x21ba57[_0xb1a0('0x3e')][_0xb1a0('0x2b')]);}_0x520639[_0xb1a0('0x47')]=qs['sort'](_0x21ba57['query']['sort']);_0x520639['where']=qs['filters'](_[_0xb1a0('0x48')](_0x21ba57[_0xb1a0('0x3e')],_0x49baab[_0xb1a0('0x40')]),_0x581962);if(_0x21ba57[_0xb1a0('0x3e')][_0xb1a0('0x49')]){_0x520639['where']=_[_0xb1a0('0x4a')](_0x520639[_0xb1a0('0x4b')],{'$or':_[_0xb1a0('0x38')](_0x581962,function(_0x32d414){if(_0x32d414[_0xb1a0('0x3b')]!==_0xb1a0('0x4c')){var _0x4b41bc={};_0x4b41bc[_0x32d414[_0xb1a0('0x36')]]={'$like':'%'+_0x21ba57[_0xb1a0('0x3e')]['filter']+'%'};return _0x4b41bc;}})});}_0x520639=_[_0xb1a0('0x4a')]({},_0x520639,_0x21ba57[_0xb1a0('0x4d')]);var _0x265250={'where':_0x520639['where']};return db['OpenchannelMessage'][_0xb1a0('0x2e')](_0x265250)[_0xb1a0('0x22')](function(_0x54c080){_0x5a6617[_0xb1a0('0x2e')]=_0x54c080;if(_0x21ba57[_0xb1a0('0x3e')][_0xb1a0('0x4e')]){_0x520639[_0xb1a0('0x4f')]=[{'all':!![]}];}return db[_0xb1a0('0x50')][_0xb1a0('0x51')](_0x520639);})[_0xb1a0('0x22')](function(_0x924766){_0x5a6617[_0xb1a0('0x52')]=_0x924766;return _0x5a6617;})[_0xb1a0('0x22')](respondWithFilteredResult(_0x466dda,_0x520639))[_0xb1a0('0x28')](handleError(_0x466dda,null));};exports['show']=function(_0x40fe1a,_0x494f40){var _0x1ced1e={'raw':!![],'where':{'id':_0x40fe1a['params']['id']}},_0x3d2cf6={};_0x3d2cf6[_0xb1a0('0x3d')]=_[_0xb1a0('0x3f')](db[_0xb1a0('0x50')][_0xb1a0('0x39')]);_0x3d2cf6[_0xb1a0('0x3e')]=_[_0xb1a0('0x3f')](_0x40fe1a[_0xb1a0('0x3e')]);_0x3d2cf6[_0xb1a0('0x40')]=_[_0xb1a0('0x41')](_0x3d2cf6[_0xb1a0('0x3d')],_0x3d2cf6['query']);_0x1ced1e['attributes']=_[_0xb1a0('0x41')](_0x3d2cf6['model'],qs['fields'](_0x40fe1a[_0xb1a0('0x3e')][_0xb1a0('0x42')]));_0x1ced1e[_0xb1a0('0x43')]=_0x1ced1e[_0xb1a0('0x43')][_0xb1a0('0x44')]?_0x1ced1e[_0xb1a0('0x43')]:_0x3d2cf6['model'];if(_0x40fe1a['query'][_0xb1a0('0x4e')]){_0x1ced1e[_0xb1a0('0x4f')]=[{'all':!![]}];}_0x1ced1e=_[_0xb1a0('0x4a')]({},_0x1ced1e,_0x40fe1a[_0xb1a0('0x4d')]);return db[_0xb1a0('0x50')][_0xb1a0('0x53')](_0x1ced1e)[_0xb1a0('0x22')](handleEntityNotFound(_0x494f40,null))[_0xb1a0('0x22')](respondWithResult(_0x494f40,null))[_0xb1a0('0x28')](handleError(_0x494f40,null));};exports[_0xb1a0('0x54')]=function(_0x543476,_0x3885b1){return db[_0xb1a0('0x50')][_0xb1a0('0x54')](_0x543476[_0xb1a0('0x55')],{})[_0xb1a0('0x22')](respondWithResult(_0x3885b1,0xc9))[_0xb1a0('0x28')](handleError(_0x3885b1,null));};exports[_0xb1a0('0x32')]=function(_0x1fc500,_0x1354e6){if(_0x1fc500['body']['id']){delete _0x1fc500['body']['id'];}return db[_0xb1a0('0x50')][_0xb1a0('0x53')]({'where':{'id':_0x1fc500[_0xb1a0('0x56')]['id']}})[_0xb1a0('0x22')](handleEntityNotFound(_0x1354e6,null))[_0xb1a0('0x22')](saveUpdates(_0x1fc500[_0xb1a0('0x55')],null))[_0xb1a0('0x22')](respondWithResult(_0x1354e6,null))[_0xb1a0('0x28')](handleError(_0x1354e6,null));};exports[_0xb1a0('0x33')]=function(_0x56239e,_0x4af78c){return db['OpenchannelMessage'][_0xb1a0('0x53')]({'where':{'id':_0x56239e[_0xb1a0('0x56')]['id']}})[_0xb1a0('0x22')](handleEntityNotFound(_0x4af78c,null))['then'](removeEntity(_0x4af78c,null))[_0xb1a0('0x28')](handleError(_0x4af78c,null));};exports['describe']=function(_0x5acfb9,_0x2b4708){return db[_0xb1a0('0x50')][_0xb1a0('0x57')]()['then'](respondWithResult(_0x2b4708,null))[_0xb1a0('0x28')](handleError(_0x2b4708,null));};var interaction_log=require('../../config/logger')(_0xb1a0('0x58'));exports[_0xb1a0('0x59')]=function(_0xa8e23b,_0x4bbc68,_0x1a9691){var _0x3a31c4={'agent':{},'channel':_0xb1a0('0x5a')};if(_0xa8e23b[_0xb1a0('0x55')]['id']){delete _0xa8e23b[_0xb1a0('0x55')]['id'];}_0xa8e23b['body'][_0xb1a0('0x5b')]=!![];_0xa8e23b['body'][_0xb1a0('0x5c')]=moment()[_0xb1a0('0x5d')](_0xb1a0('0x5e'));_0xa8e23b[_0xb1a0('0x55')]['UserId']=_0xa8e23b['body'][_0xb1a0('0x5f')]||_0xa8e23b[_0xb1a0('0x60')]['id'];_0x3a31c4['agent']['id']=_0xa8e23b[_0xb1a0('0x55')][_0xb1a0('0x5f')];return db[_0xb1a0('0x50')][_0xb1a0('0x53')]({'where':{'id':_0xa8e23b[_0xb1a0('0x56')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x4bbc68,null))[_0xb1a0('0x22')](saveUpdates(_0xa8e23b[_0xb1a0('0x55')],null))[_0xb1a0('0x22')](function(_0xc9fbf2){if(_0xc9fbf2){_0x3a31c4[_0xb1a0('0x25')]=_0xc9fbf2[_0xb1a0('0x61')]({'plain':!![]});return db[_0xb1a0('0x62')][_0xb1a0('0x53')]({'where':{'id':_0xc9fbf2['OpenchannelInteractionId']}});}return null;})[_0xb1a0('0x22')](handleEntityNotFound(_0x4bbc68,null))['then'](function(_0x1928fc){if(_0x1928fc){return _0x1928fc['update']({'UserId':_0xa8e23b[_0xb1a0('0x55')][_0xb1a0('0x5f')],'read1stAt':_[_0xb1a0('0x63')](_0x1928fc[_0xb1a0('0x64')])?moment()[_0xb1a0('0x5d')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xb1a0('0x22')](function(_0x23d8b2){if(_0x23d8b2){_0x3a31c4['interaction']=_0x23d8b2[_0xb1a0('0x61')]({'plain':!![]});interaction_log[_0xb1a0('0x65')](_0xb1a0('0x66'),_0xa8e23b[_0xb1a0('0x60')]['id'],_0xa8e23b[_0xb1a0('0x60')][_0xb1a0('0x36')],_0xa8e23b[_0xb1a0('0x60')][_0xb1a0('0x67')],_0x3a31c4[_0xb1a0('0x68')]['id'],_0xa8e23b[_0xb1a0('0x55')]?JSON[_0xb1a0('0x69')](_0xa8e23b[_0xb1a0('0x55')]):'null');return respondWithRpcPromise(_0xb1a0('0x6a'),_0xb1a0('0x6b'),_0x3a31c4);}return null;})['then'](function(_0x2a97ab){var _0x5395ea=_0xb1a0('0x6c')+_0x2a97ab['message'][_0xb1a0('0x6d')];return db[_0xb1a0('0x6e')][_0xb1a0('0x3e')](_0x5395ea,{'type':db[_0xb1a0('0x6f')]['QueryTypes'][_0xb1a0('0x70')],'raw':!![]})[_0xb1a0('0x22')](function(_0x1ec0fa){return _0x1ec0fa;});})[_0xb1a0('0x22')](function(_0x2e5886){if(_0x2e5886){_0x3a31c4[_0xb1a0('0x25')]['contact']=_0x2e5886[0x0];if(!_0xa8e23b['body']['UserId'])return;return db[_0xb1a0('0x71')][_0xb1a0('0x53')]({'where':{'id':_0xa8e23b[_0xb1a0('0x55')][_0xb1a0('0x5f')],'role':_0xb1a0('0x72')},'attributes':['id',_0xb1a0('0x36'),_0xb1a0('0x73'),'email',_0xb1a0('0x74')],'raw':!![]});}return null;})['then'](function(_0x2af367){if(!_0x2af367)return null;_0x3a31c4['message']['agent']=_0x2af367;return _0x3a31c4;})[_0xb1a0('0x22')](function(_0x199583){if(_0x199583){if(_0xa8e23b[_0xb1a0('0x55')]['manual']){_0x3a31c4['message']['interface']=util[_0xb1a0('0x5d')](_0xb1a0('0x75'),_0xa8e23b[_0xb1a0('0x60')][_0xb1a0('0x36')]);_0x3a31c4[_0xb1a0('0x25')][_0xb1a0('0x76')]=_0x3a31c4[_0xb1a0('0x76')];_0x3a31c4[_0xb1a0('0x25')][_0xb1a0('0x77')]=_0x3a31c4[_0xb1a0('0x76')];_0x3a31c4[_0xb1a0('0x25')][_0xb1a0('0x78')]='accept';return respondWithRpcPromise('EventManager',_0xb1a0('0x79'),{'event':_0xb1a0('0x7a'),'message':_0x3a31c4[_0xb1a0('0x25')]},client9002)[_0xb1a0('0x22')](function(){return _0x3a31c4;});}return _0x3a31c4;}return null;})[_0xb1a0('0x22')](respondWithResult(_0x4bbc68,null))['catch'](handleError(_0x4bbc68,null));};var interaction_log=require(_0xb1a0('0x13'))('openchannel-interactions');exports['reject']=function(_0x5a06f7,_0x47d338,_0x5d9b99){var _0x28ba9d={'agent':{},'channel':_0xb1a0('0x5a')};if(_0x5a06f7['body']['id']){delete _0x5a06f7[_0xb1a0('0x55')]['id'];}_0x5a06f7[_0xb1a0('0x55')][_0xb1a0('0x5f')]=_0x5a06f7[_0xb1a0('0x55')][_0xb1a0('0x5f')]||_0x5a06f7['user']['id'];_0x28ba9d[_0xb1a0('0x72')]['id']=_0x5a06f7[_0xb1a0('0x55')][_0xb1a0('0x5f')];return db[_0xb1a0('0x50')][_0xb1a0('0x53')]({'where':{'id':_0x5a06f7['params']['id'],'UserId':null}})[_0xb1a0('0x22')](handleEntityNotFound(_0x47d338,null))['then'](function(_0x27e0a2){if(_0x27e0a2){_0x28ba9d['message']=_0x27e0a2[_0xb1a0('0x61')]({'plain':!![]});return db[_0xb1a0('0x62')][_0xb1a0('0x53')]({'where':{'id':_0x27e0a2[_0xb1a0('0x7b')]}});}return null;})[_0xb1a0('0x22')](handleEntityNotFound(_0x47d338,null))[_0xb1a0('0x22')](function(_0x4187bc){if(_0x4187bc){_0x28ba9d[_0xb1a0('0x68')]=_0x4187bc['get']({'plain':!![]});interaction_log[_0xb1a0('0x65')](_0xb1a0('0x7c'),_0x5a06f7['user']['id'],_0x5a06f7['user']['name'],_0x5a06f7[_0xb1a0('0x60')][_0xb1a0('0x67')],_0x28ba9d[_0xb1a0('0x68')]['id'],_0x5a06f7[_0xb1a0('0x55')]?JSON[_0xb1a0('0x69')](_0x5a06f7[_0xb1a0('0x55')]):'null');return respondWithRpcPromise(_0xb1a0('0x7d'),'rejectMessage',_0x28ba9d);}return null;})[_0xb1a0('0x22')](function(_0x111546){var _0x14189d=_0xb1a0('0x6c')+_0x111546[_0xb1a0('0x25')][_0xb1a0('0x6d')];return db[_0xb1a0('0x6e')][_0xb1a0('0x3e')](_0x14189d,{'type':db[_0xb1a0('0x6f')]['QueryTypes'][_0xb1a0('0x70')],'raw':!![]})[_0xb1a0('0x22')](function(_0xd7009c){return _0xd7009c;});})[_0xb1a0('0x22')](function(_0x44e00c){if(_0x44e00c){_0x28ba9d[_0xb1a0('0x25')][_0xb1a0('0x7e')]=_0x44e00c[0x0];if(!_0x5a06f7[_0xb1a0('0x55')][_0xb1a0('0x5f')])return;return db['User'][_0xb1a0('0x53')]({'where':{'id':_0x5a06f7[_0xb1a0('0x55')][_0xb1a0('0x5f')],'role':_0xb1a0('0x72')},'attributes':['id',_0xb1a0('0x36'),_0xb1a0('0x73'),'email',_0xb1a0('0x74')],'raw':!![]});}return null;})[_0xb1a0('0x22')](function(_0x1633f1){if(!_0x1633f1)return null;_0x28ba9d[_0xb1a0('0x25')][_0xb1a0('0x72')]=_0x1633f1;return _0x28ba9d;})[_0xb1a0('0x22')](function(_0x49bf5c){if(_0x49bf5c){_0x49bf5c[_0xb1a0('0x25')][_0xb1a0('0x7f')]=util[_0xb1a0('0x5d')](_0xb1a0('0x75'),_0x5a06f7[_0xb1a0('0x60')][_0xb1a0('0x36')]);_0x49bf5c[_0xb1a0('0x25')][_0xb1a0('0x76')]=_0x28ba9d[_0xb1a0('0x76')];_0x49bf5c[_0xb1a0('0x25')][_0xb1a0('0x77')]=_0x28ba9d[_0xb1a0('0x76')];_0x49bf5c[_0xb1a0('0x25')]['event']=_0xb1a0('0x30');respondWithRpcPromise(_0xb1a0('0x79'),_0xb1a0('0x79'),{'event':_0xb1a0('0x80'),'message':_0x49bf5c['message']},client9002);return _0x28ba9d;}return null;})[_0xb1a0('0x22')](respondWithResult(_0x47d338,null))[_0xb1a0('0x28')](handleError(_0x47d338,null));}; \ No newline at end of file +var _0x72d6=['model','query','keys','filters','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','options','OpenchannelMessage','includeAll','findAll','rows','catch','show','params','intersection','include','find','create','body','describe','openchannel-interactions','accept','read','readAt','format','UserId','user','agent','update','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','get','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','openchannel','OpenchannelInteraction','OpenchannelInteractionId','role','RejectMessage','rejectMessage','internal','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','./openchannelMessage.socket','register','http','client','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','destroy','name','index','map','rawAttributes','type','key'];(function(_0x2b3d5d,_0xbb26ad){var _0x86cf07=function(_0x2f1b07){while(--_0x2f1b07){_0x2b3d5d['push'](_0x2b3d5d['shift']());}};_0x86cf07(++_0xbb26ad);}(_0x72d6,0x1bf));var _0x672d=function(_0x4d8c7b,_0x20b79b){_0x4d8c7b=_0x4d8c7b-0x0;var _0x5d4b8c=_0x72d6[_0x4d8c7b];return _0x5d4b8c;};'use strict';var emlformat=require(_0x672d('0x0'));var rimraf=require(_0x672d('0x1'));var zipdir=require(_0x672d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x672d('0x3'));var moment=require(_0x672d('0x4'));var BPromise=require(_0x672d('0x5'));var Mustache=require('mustache');var util=require(_0x672d('0x6'));var path=require(_0x672d('0x7'));var sox=require(_0x672d('0x8'));var csv=require('to-csv');var ejs=require(_0x672d('0x9'));var fs=require('fs');var fs_extra=require(_0x672d('0xa'));var _=require(_0x672d('0xb'));var squel=require(_0x672d('0xc'));var crypto=require(_0x672d('0xd'));var jsforce=require(_0x672d('0xe'));var deskjs=require(_0x672d('0xf'));var toCsv=require('to-csv');var querystring=require(_0x672d('0x10'));var Papa=require('papaparse');var Redis=require(_0x672d('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x672d('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x672d('0x13'));var logger=require(_0x672d('0x14'))(_0x672d('0x15'));var utils=require(_0x672d('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x672d('0x17'));var db=require(_0x672d('0x18'))['db'];config[_0x672d('0x19')]=_['defaults'](config[_0x672d('0x19')],{'host':_0x672d('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x672d('0x19')]));require(_0x672d('0x1b'))[_0x672d('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x672d('0x1d')]({'port':0x232c});var client9002=jayson[_0x672d('0x1e')][_0x672d('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x258e4b,_0x32ce02,_0x398e82,_0x44e4cb){return new BPromise(function(_0x316ffb,_0x2bd503){var _0x5175a8=_0x44e4cb||client;return _0x5175a8['request'](_0x258e4b,_0x398e82)[_0x672d('0x1f')](function(_0x41e635){logger[_0x672d('0x20')](_0x672d('0x21'),_0x32ce02,_0x672d('0x22'));logger[_0x672d('0x23')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x32ce02,'request\x20sent',JSON[_0x672d('0x24')](_0x41e635));if(_0x41e635[_0x672d('0x25')]){if(_0x41e635['error']['code']===0x1f4){logger[_0x672d('0x25')]('OpenchannelMessage,\x20%s,\x20%s',_0x32ce02,_0x41e635[_0x672d('0x25')][_0x672d('0x26')]);return _0x2bd503(_0x41e635[_0x672d('0x25')]['message']);}logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x32ce02,_0x41e635[_0x672d('0x25')][_0x672d('0x26')]);return _0x316ffb(_0x41e635['error'][_0x672d('0x26')]);}else{logger['info'](_0x672d('0x21'),_0x32ce02,_0x672d('0x22'));_0x316ffb(_0x41e635['result']['message']);}})['catch'](function(_0x1aa0b8){logger[_0x672d('0x25')](_0x672d('0x21'),_0x32ce02,_0x1aa0b8);_0x2bd503(_0x1aa0b8);});});}function respondWithStatusCode(_0x14fcf6,_0x557739){_0x557739=_0x557739||0xcc;return function(_0x164b74){if(_0x164b74){return _0x14fcf6[_0x672d('0x27')](_0x557739);}return _0x14fcf6[_0x672d('0x28')](_0x557739)[_0x672d('0x29')]();};}function respondWithResult(_0x4f1374,_0x3a92ce){_0x3a92ce=_0x3a92ce||0xc8;return function(_0x111533){if(_0x111533){return _0x4f1374[_0x672d('0x28')](_0x3a92ce)[_0x672d('0x2a')](_0x111533);}};}function respondWithFilteredResult(_0x1fb1d2,_0x3233f2){return function(_0x2696d8){if(_0x2696d8){var _0x5a156f=typeof _0x3233f2[_0x672d('0x2b')]===_0x672d('0x2c')&&typeof _0x3233f2[_0x672d('0x2d')]==='undefined';var _0x1c459d=_0x2696d8[_0x672d('0x2e')];var _0x28acee=_0x5a156f?0x0:_0x3233f2[_0x672d('0x2b')];var _0x594f36=_0x5a156f?_0x2696d8[_0x672d('0x2e')]:_0x3233f2[_0x672d('0x2b')]+_0x3233f2[_0x672d('0x2d')];var _0x5b8695;if(_0x594f36>=_0x1c459d){_0x594f36=_0x1c459d;_0x5b8695=0xc8;}else{_0x5b8695=0xce;}_0x1fb1d2[_0x672d('0x28')](_0x5b8695);return _0x1fb1d2['set'](_0x672d('0x2f'),_0x28acee+'-'+_0x594f36+'/'+_0x1c459d)[_0x672d('0x2a')](_0x2696d8);}return null;};}function patchUpdates(_0x2b59c3){return function(_0x37d228){try{jsonpatch[_0x672d('0x30')](_0x37d228,_0x2b59c3,!![]);}catch(_0x56ce9a){return BPromise[_0x672d('0x31')](_0x56ce9a);}return _0x37d228['save']();};}function saveUpdates(_0x1301db,_0x50895b){return function(_0x596b8d){if(_0x596b8d){return _0x596b8d['update'](_0x1301db)['then'](function(_0x593e6){return _0x593e6;});}return null;};}function removeEntity(_0x5787d0,_0x3d1f7c){return function(_0x171f3d){if(_0x171f3d){return _0x171f3d[_0x672d('0x32')]()['then'](function(){_0x5787d0[_0x672d('0x28')](0xcc)[_0x672d('0x29')]();});}};}function handleEntityNotFound(_0x138537,_0x296c87){return function(_0x3e4cfa){if(!_0x3e4cfa){_0x138537['sendStatus'](0x194);}return _0x3e4cfa;};}function handleError(_0x5599f7,_0x378ab0){_0x378ab0=_0x378ab0||0x1f4;return function(_0x3ea1dd){logger[_0x672d('0x25')](_0x3ea1dd['stack']);if(_0x3ea1dd[_0x672d('0x33')]){delete _0x3ea1dd[_0x672d('0x33')];}_0x5599f7[_0x672d('0x28')](_0x378ab0)['send'](_0x3ea1dd);};}exports[_0x672d('0x34')]=function(_0x472313,_0x4753af){var _0x5719d2={},_0x53c3f7={},_0x399745={'count':0x0,'rows':[]};var _0x2a8887=_[_0x672d('0x35')](db['OpenchannelMessage'][_0x672d('0x36')],function(_0x585c51){return{'name':_0x585c51['fieldName'],'type':_0x585c51[_0x672d('0x37')][_0x672d('0x38')]};});_0x53c3f7[_0x672d('0x39')]=_['map'](_0x2a8887,_0x672d('0x33'));_0x53c3f7[_0x672d('0x3a')]=_[_0x672d('0x3b')](_0x472313[_0x672d('0x3a')]);_0x53c3f7[_0x672d('0x3c')]=_['intersection'](_0x53c3f7[_0x672d('0x39')],_0x53c3f7[_0x672d('0x3a')]);_0x5719d2[_0x672d('0x3d')]=_['intersection'](_0x53c3f7[_0x672d('0x39')],qs['fields'](_0x472313[_0x672d('0x3a')][_0x672d('0x3e')]));_0x5719d2[_0x672d('0x3d')]=_0x5719d2[_0x672d('0x3d')][_0x672d('0x3f')]?_0x5719d2[_0x672d('0x3d')]:_0x53c3f7[_0x672d('0x39')];if(!_0x472313[_0x672d('0x3a')]['hasOwnProperty'](_0x672d('0x40'))){_0x5719d2['limit']=qs[_0x672d('0x2d')](_0x472313[_0x672d('0x3a')][_0x672d('0x2d')]);_0x5719d2['offset']=qs[_0x672d('0x2b')](_0x472313['query']['offset']);}_0x5719d2[_0x672d('0x41')]=qs[_0x672d('0x42')](_0x472313[_0x672d('0x3a')][_0x672d('0x42')]);_0x5719d2[_0x672d('0x43')]=qs[_0x672d('0x3c')](_[_0x672d('0x44')](_0x472313[_0x672d('0x3a')],_0x53c3f7[_0x672d('0x3c')]),_0x2a8887);if(_0x472313['query']['filter']){_0x5719d2[_0x672d('0x43')]=_['merge'](_0x5719d2['where'],{'$or':_[_0x672d('0x35')](_0x2a8887,function(_0x47532d){if(_0x47532d[_0x672d('0x37')]!=='VIRTUAL'){var _0x577255={};_0x577255[_0x47532d[_0x672d('0x33')]]={'$like':'%'+_0x472313['query'][_0x672d('0x45')]+'%'};return _0x577255;}})});}_0x5719d2=_[_0x672d('0x46')]({},_0x5719d2,_0x472313[_0x672d('0x47')]);var _0x244594={'where':_0x5719d2[_0x672d('0x43')]};return db[_0x672d('0x48')]['count'](_0x244594)['then'](function(_0x405e1b){_0x399745['count']=_0x405e1b;if(_0x472313[_0x672d('0x3a')][_0x672d('0x49')]){_0x5719d2['include']=[{'all':!![]}];}return db[_0x672d('0x48')][_0x672d('0x4a')](_0x5719d2);})[_0x672d('0x1f')](function(_0x31b13c){_0x399745[_0x672d('0x4b')]=_0x31b13c;return _0x399745;})['then'](respondWithFilteredResult(_0x4753af,_0x5719d2))[_0x672d('0x4c')](handleError(_0x4753af,null));};exports[_0x672d('0x4d')]=function(_0x599927,_0x136c96){var _0x154fae={'raw':!![],'where':{'id':_0x599927[_0x672d('0x4e')]['id']}},_0x13b56a={};_0x13b56a['model']=_[_0x672d('0x3b')](db[_0x672d('0x48')][_0x672d('0x36')]);_0x13b56a[_0x672d('0x3a')]=_[_0x672d('0x3b')](_0x599927[_0x672d('0x3a')]);_0x13b56a['filters']=_[_0x672d('0x4f')](_0x13b56a['model'],_0x13b56a[_0x672d('0x3a')]);_0x154fae[_0x672d('0x3d')]=_['intersection'](_0x13b56a[_0x672d('0x39')],qs['fields'](_0x599927[_0x672d('0x3a')]['fields']));_0x154fae['attributes']=_0x154fae[_0x672d('0x3d')][_0x672d('0x3f')]?_0x154fae[_0x672d('0x3d')]:_0x13b56a[_0x672d('0x39')];if(_0x599927['query']['includeAll']){_0x154fae[_0x672d('0x50')]=[{'all':!![]}];}_0x154fae=_[_0x672d('0x46')]({},_0x154fae,_0x599927[_0x672d('0x47')]);return db[_0x672d('0x48')][_0x672d('0x51')](_0x154fae)[_0x672d('0x1f')](handleEntityNotFound(_0x136c96,null))['then'](respondWithResult(_0x136c96,null))[_0x672d('0x4c')](handleError(_0x136c96,null));};exports[_0x672d('0x52')]=function(_0x311e2a,_0x168f32){return db[_0x672d('0x48')][_0x672d('0x52')](_0x311e2a[_0x672d('0x53')],{})[_0x672d('0x1f')](respondWithResult(_0x168f32,0xc9))['catch'](handleError(_0x168f32,null));};exports['update']=function(_0x37220a,_0x35daca){if(_0x37220a[_0x672d('0x53')]['id']){delete _0x37220a[_0x672d('0x53')]['id'];}return db['OpenchannelMessage'][_0x672d('0x51')]({'where':{'id':_0x37220a['params']['id']}})[_0x672d('0x1f')](handleEntityNotFound(_0x35daca,null))[_0x672d('0x1f')](saveUpdates(_0x37220a[_0x672d('0x53')],null))[_0x672d('0x1f')](respondWithResult(_0x35daca,null))[_0x672d('0x4c')](handleError(_0x35daca,null));};exports[_0x672d('0x32')]=function(_0x2ab61c,_0x3dcfa7){return db['OpenchannelMessage'][_0x672d('0x51')]({'where':{'id':_0x2ab61c[_0x672d('0x4e')]['id']}})[_0x672d('0x1f')](handleEntityNotFound(_0x3dcfa7,null))[_0x672d('0x1f')](removeEntity(_0x3dcfa7,null))['catch'](handleError(_0x3dcfa7,null));};exports['describe']=function(_0x74fbbd,_0x3041dc){return db[_0x672d('0x48')][_0x672d('0x54')]()[_0x672d('0x1f')](respondWithResult(_0x3041dc,null))[_0x672d('0x4c')](handleError(_0x3041dc,null));};var interaction_log=require(_0x672d('0x14'))(_0x672d('0x55'));exports[_0x672d('0x56')]=function(_0x50deeb,_0x32afdc,_0x1670dc){var _0x1f1b16={'agent':{},'channel':'openchannel'};if(_0x50deeb[_0x672d('0x53')]['id']){delete _0x50deeb[_0x672d('0x53')]['id'];}_0x50deeb[_0x672d('0x53')][_0x672d('0x57')]=!![];_0x50deeb[_0x672d('0x53')][_0x672d('0x58')]=moment()[_0x672d('0x59')]('YYYY-MM-DD\x20HH:mm:ss');_0x50deeb[_0x672d('0x53')][_0x672d('0x5a')]=_0x50deeb[_0x672d('0x53')][_0x672d('0x5a')]||_0x50deeb[_0x672d('0x5b')]['id'];_0x1f1b16[_0x672d('0x5c')]['id']=_0x50deeb[_0x672d('0x53')][_0x672d('0x5a')];return db['OpenchannelMessage']['find']({'where':{'id':_0x50deeb[_0x672d('0x4e')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x32afdc,null))[_0x672d('0x1f')](saveUpdates(_0x50deeb['body'],null))['then'](function(_0x53e484){if(_0x53e484){_0x1f1b16[_0x672d('0x26')]=_0x53e484['get']({'plain':!![]});return db['OpenchannelInteraction'][_0x672d('0x51')]({'where':{'id':_0x53e484['OpenchannelInteractionId']}});}return null;})[_0x672d('0x1f')](handleEntityNotFound(_0x32afdc,null))[_0x672d('0x1f')](function(_0x4a6870){if(_0x4a6870){return _0x4a6870[_0x672d('0x5d')]({'UserId':_0x50deeb[_0x672d('0x53')][_0x672d('0x5a')],'read1stAt':_[_0x672d('0x5e')](_0x4a6870[_0x672d('0x5f')])?moment()[_0x672d('0x59')](_0x672d('0x60')):undefined});}return null;})[_0x672d('0x1f')](function(_0x34b734){if(_0x34b734){_0x1f1b16[_0x672d('0x61')]=_0x34b734[_0x672d('0x62')]({'plain':!![]});interaction_log[_0x672d('0x20')](_0x672d('0x63'),_0x50deeb[_0x672d('0x5b')]['id'],_0x50deeb[_0x672d('0x5b')][_0x672d('0x33')],_0x50deeb[_0x672d('0x5b')]['role'],_0x1f1b16[_0x672d('0x61')]['id'],_0x50deeb['body']?JSON[_0x672d('0x24')](_0x50deeb['body']):_0x672d('0x64'));return respondWithRpcPromise('AcceptMessage',_0x672d('0x65'),_0x1f1b16);}return null;})[_0x672d('0x1f')](function(_0xcee374){var _0x6860af=_0x672d('0x66')+_0xcee374[_0x672d('0x26')][_0x672d('0x67')];return db[_0x672d('0x68')][_0x672d('0x3a')](_0x6860af,{'type':db[_0x672d('0x69')][_0x672d('0x6a')][_0x672d('0x6b')],'raw':!![]})[_0x672d('0x1f')](function(_0x24ac17){return _0x24ac17;});})['then'](function(_0x415c52){if(_0x415c52){_0x1f1b16[_0x672d('0x26')][_0x672d('0x6c')]=_0x415c52[0x0];if(!_0x50deeb[_0x672d('0x53')][_0x672d('0x5a')])return;return db[_0x672d('0x6d')][_0x672d('0x51')]({'where':{'id':_0x50deeb[_0x672d('0x53')][_0x672d('0x5a')],'role':_0x672d('0x5c')},'attributes':['id',_0x672d('0x33'),_0x672d('0x6e'),_0x672d('0x6f'),'internal'],'raw':!![]});}return null;})['then'](function(_0x3a267f){if(!_0x3a267f)return null;_0x1f1b16[_0x672d('0x26')]['agent']=_0x3a267f;return _0x1f1b16;})[_0x672d('0x1f')](function(_0x36d729){if(_0x36d729){if(_0x50deeb['body']['manual']){_0x1f1b16[_0x672d('0x26')][_0x672d('0x70')]=util[_0x672d('0x59')](_0x672d('0x71'),_0x50deeb[_0x672d('0x5b')][_0x672d('0x33')]);_0x1f1b16[_0x672d('0x26')][_0x672d('0x72')]=_0x1f1b16[_0x672d('0x72')];_0x1f1b16['message'][_0x672d('0x73')]=_0x1f1b16['channel'];_0x1f1b16['message'][_0x672d('0x74')]='accept';return respondWithRpcPromise('EventManager',_0x672d('0x75'),{'event':_0x672d('0x76'),'message':_0x1f1b16[_0x672d('0x26')]},client9002)[_0x672d('0x1f')](function(){return _0x1f1b16;});}return _0x1f1b16;}return null;})[_0x672d('0x1f')](respondWithResult(_0x32afdc,null))[_0x672d('0x4c')](handleError(_0x32afdc,null));};var interaction_log=require(_0x672d('0x14'))(_0x672d('0x55'));exports[_0x672d('0x31')]=function(_0x3db057,_0x4080c6,_0x16c720){var _0x283256={'agent':{},'channel':_0x672d('0x77')};if(_0x3db057[_0x672d('0x53')]['id']){delete _0x3db057['body']['id'];}_0x3db057[_0x672d('0x53')][_0x672d('0x5a')]=_0x3db057[_0x672d('0x53')][_0x672d('0x5a')]||_0x3db057[_0x672d('0x5b')]['id'];_0x283256[_0x672d('0x5c')]['id']=_0x3db057[_0x672d('0x53')][_0x672d('0x5a')];return db[_0x672d('0x48')][_0x672d('0x51')]({'where':{'id':_0x3db057['params']['id'],'UserId':null}})[_0x672d('0x1f')](handleEntityNotFound(_0x4080c6,null))[_0x672d('0x1f')](function(_0x1fc7b5){if(_0x1fc7b5){_0x283256[_0x672d('0x26')]=_0x1fc7b5[_0x672d('0x62')]({'plain':!![]});return db[_0x672d('0x78')][_0x672d('0x51')]({'where':{'id':_0x1fc7b5[_0x672d('0x79')]}});}return null;})['then'](handleEntityNotFound(_0x4080c6,null))[_0x672d('0x1f')](function(_0x3aab7d){if(_0x3aab7d){_0x283256[_0x672d('0x61')]=_0x3aab7d['get']({'plain':!![]});interaction_log[_0x672d('0x20')]('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3db057[_0x672d('0x5b')]['id'],_0x3db057[_0x672d('0x5b')]['name'],_0x3db057[_0x672d('0x5b')][_0x672d('0x7a')],_0x283256[_0x672d('0x61')]['id'],_0x3db057[_0x672d('0x53')]?JSON['stringify'](_0x3db057[_0x672d('0x53')]):'null');return respondWithRpcPromise(_0x672d('0x7b'),_0x672d('0x7c'),_0x283256);}return null;})['then'](function(_0x350cb8){var _0x3e209f=_0x672d('0x66')+_0x350cb8[_0x672d('0x26')][_0x672d('0x67')];return db['sequelize']['query'](_0x3e209f,{'type':db[_0x672d('0x69')]['QueryTypes'][_0x672d('0x6b')],'raw':!![]})[_0x672d('0x1f')](function(_0x57e4a4){return _0x57e4a4;});})[_0x672d('0x1f')](function(_0x348305){if(_0x348305){_0x283256[_0x672d('0x26')][_0x672d('0x6c')]=_0x348305[0x0];if(!_0x3db057['body']['UserId'])return;return db[_0x672d('0x6d')]['find']({'where':{'id':_0x3db057[_0x672d('0x53')][_0x672d('0x5a')],'role':_0x672d('0x5c')},'attributes':['id','name',_0x672d('0x6e'),_0x672d('0x6f'),_0x672d('0x7d')],'raw':!![]});}return null;})[_0x672d('0x1f')](function(_0x2a7b17){if(!_0x2a7b17)return null;_0x283256[_0x672d('0x26')][_0x672d('0x5c')]=_0x2a7b17;return _0x283256;})[_0x672d('0x1f')](function(_0x137b7a){if(_0x137b7a){_0x137b7a['message'][_0x672d('0x70')]=util['format'](_0x672d('0x71'),_0x3db057['user'][_0x672d('0x33')]);_0x137b7a['message'][_0x672d('0x72')]=_0x283256['channel'];_0x137b7a[_0x672d('0x26')][_0x672d('0x73')]=_0x283256['channel'];_0x137b7a[_0x672d('0x26')][_0x672d('0x74')]='reject';respondWithRpcPromise(_0x672d('0x75'),_0x672d('0x75'),{'event':'rejectmessage','message':_0x137b7a[_0x672d('0x26')]},client9002);return _0x283256;}return null;})[_0x672d('0x1f')](respondWithResult(_0x4080c6,null))['catch'](handleError(_0x4080c6,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index a552349..9ad7df3 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 _0x8866=['hasOwnProperty','exports','events','../../mysqldb','OpenchannelMessage','setMaxListeners','update','remove','emit'];(function(_0x580647,_0x43d2c3){var _0x5f0792=function(_0x386cef){while(--_0x386cef){_0x580647['push'](_0x580647['shift']());}};_0x5f0792(++_0x43d2c3);}(_0x8866,0x6e));var _0x6886=function(_0x44ebef,_0x56306f){_0x44ebef=_0x44ebef-0x0;var _0x46733f=_0x8866[_0x44ebef];return _0x46733f;};'use strict';var EventEmitter=require(_0x6886('0x0'));var OpenchannelMessage=require(_0x6886('0x1'))['db'][_0x6886('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x6886('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6886('0x4'),'afterDestroy':_0x6886('0x5')};function emitEvent(_0x2cbc78){return function(_0x34fdfd,_0x9e4bd9,_0xc5848a){OpenchannelMessageEvents['emit'](_0x2cbc78+':'+_0x34fdfd['id'],_0x34fdfd);OpenchannelMessageEvents[_0x6886('0x6')](_0x2cbc78,_0x34fdfd);_0xc5848a(null);};}for(var e in events){if(events[_0x6886('0x7')](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module[_0x6886('0x8')]=OpenchannelMessageEvents; \ No newline at end of file +var _0x717d=['hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update','remove','emit'];(function(_0xcad01d,_0xef9abc){var _0x76a4a6=function(_0x15b2a4){while(--_0x15b2a4){_0xcad01d['push'](_0xcad01d['shift']());}};_0x76a4a6(++_0xef9abc);}(_0x717d,0xdf));var _0xd717=function(_0x3fb030,_0x12aebe){_0x3fb030=_0x3fb030-0x0;var _0xd6899b=_0x717d[_0x3fb030];return _0xd6899b;};'use strict';var EventEmitter=require(_0xd717('0x0'));var OpenchannelMessage=require(_0xd717('0x1'))['db'][_0xd717('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xd717('0x3')](0x0);var events={'afterCreate':_0xd717('0x4'),'afterUpdate':_0xd717('0x5'),'afterDestroy':_0xd717('0x6')};function emitEvent(_0x490158){return function(_0x35b238,_0x416c77,_0x2dbf62){OpenchannelMessageEvents[_0xd717('0x7')](_0x490158+':'+_0x35b238['id'],_0x35b238);OpenchannelMessageEvents[_0xd717('0x7')](_0x490158,_0x35b238);_0x2dbf62(null);};}for(var e in events){if(events[_0xd717('0x8')](e)){var event=events[e];OpenchannelMessage[_0xd717('0x9')](e,emitEvent(event));}}module[_0xd717('0xa')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index e25ae31..c9cdcfd 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 _0x9b7a=['Contact','info','OpenchannelMessage,\x20%s,\x20%s','Forwarding\x20message\x20%d\x20to\x20%s','replyUri','length','Interaction','omit','POST','method','afterCreate','format','threadId','utf8mb4_unicode_ci','lodash','util','api','request-promise','path','rimraf','exports','define','OpenchannelMessage','fti_openchannel_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','UserId','OpenchannelInteraction','findOne','then','update','createdAt','catch','error','describe','OpenchannelAccount','OpenchannelAccountId','Interactions','OpenchannelInteractionId','CmContact'];(function(_0x946518,_0x22816f){var _0x909b69=function(_0x2fa5a4){while(--_0x2fa5a4){_0x946518['push'](_0x946518['shift']());}};_0x909b69(++_0x22816f);}(_0x9b7a,0x6a));var _0xa9b7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9b7a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xa9b7('0x0'));var util=require(_0xa9b7('0x1'));var logger=require('../../config/logger')(_0xa9b7('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa9b7('0x3'));var fs=require('fs');var path=require(_0xa9b7('0x4'));var rimraf=require(_0xa9b7('0x5'));var config=require('../../config/environment');var attributes=require('./openchannelMessage.attributes');module[_0xa9b7('0x6')]=function(_0x53512d,_0x373a63){return _0x53512d[_0xa9b7('0x7')](_0xa9b7('0x8'),attributes,{'tableName':'openchannel_messages','paranoid':![],'indexes':[{'name':_0xa9b7('0x9'),'fields':[_0xa9b7('0xa')],'type':_0xa9b7('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x177389,_0x4e9234,_0x3c9f8b){var _0x52714d=_0x53512d[_0xa9b7('0xc')];var _0x258625=_0x177389[_0xa9b7('0xd')]({'plain':!![]});if(_0x258625[_0xa9b7('0xe')][_0xa9b7('0xf')]()==='in'||_0x258625[_0xa9b7('0xe')]['toLowerCase']()===_0xa9b7('0x10')&&!_0x258625[_0xa9b7('0x11')]&&!_['isNil'](_0x258625[_0xa9b7('0x12')])){_0x52714d[_0xa9b7('0x13')][_0xa9b7('0x14')]({'where':{'id':_0x258625['OpenchannelInteractionId']}})[_0xa9b7('0x15')](function(_0x4ad1ef){if(_0x4ad1ef){_0x4ad1ef[_0xa9b7('0x16')]({'lastMsgAt':_0x258625[_0xa9b7('0x17')],'lastMsgDirection':_0x258625[_0xa9b7('0xe')][_0xa9b7('0xf')]()});}})[_0xa9b7('0x18')](function(_0x446fa5){console[_0xa9b7('0x19')](_0x446fa5);});}if(_0x258625[_0xa9b7('0xe')]==='out'&&!_0x258625[_0xa9b7('0x11')]){var _0x273945;_0x52714d['CmContact'][_0xa9b7('0x1a')]()[_0xa9b7('0x15')](function(_0x3969a5){return _0x52714d[_0xa9b7('0x1b')]['find']({'where':{'id':_0x258625[_0xa9b7('0x1c')]},'include':[{'model':_0x52714d[_0xa9b7('0x13')],'as':_0xa9b7('0x1d'),'where':{'id':_0x258625[_0xa9b7('0x1e')]},'limit':0x1,'include':[{'model':_0x52714d[_0xa9b7('0x1f')],'as':_0xa9b7('0x20'),'attributes':_['keys'](_0x3969a5)}]}]});})['then'](function(_0x29fce7){_0x273945=_0x29fce7['get']({'plain':!![]});if(_0x273945&&_0x273945['replyUri']){logger[_0xa9b7('0x21')](_0xa9b7('0x22'),'afterCreate',util['format'](_0xa9b7('0x23'),_0x258625['id'],_0x273945[_0xa9b7('0x24')]));if(_0x273945[_0xa9b7('0x1d')]&&_0x273945[_0xa9b7('0x1d')][_0xa9b7('0x25')]){_0x258625[_0xa9b7('0x26')]=_[_0xa9b7('0x27')](_0x273945[_0xa9b7('0x1d')][0x0],'Contact');_0x258625['Contact']=_0x273945['Interactions'][0x0][_0xa9b7('0x20')];}var _0x4e9234={'method':_0xa9b7('0x28'),'uri':encodeURI(_0x273945[_0xa9b7('0x24')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x4e9234[_0xa9b7('0x29')]){case'GET':_0x4e9234['qs']=_0x258625;break;case _0xa9b7('0x28'):_0x4e9234[_0xa9b7('0xa')]=_0x258625;break;}return rp(_0x4e9234)[_0xa9b7('0x15')](function(_0x173a2e){logger[_0xa9b7('0x21')](_0xa9b7('0x22'),_0xa9b7('0x2a'),util[_0xa9b7('0x2b')]('Message\x20%d\x20forwarded\x20to\x20%s',_0x258625['id'],_0x273945[_0xa9b7('0x24')]));if(_0x173a2e['body'][_0xa9b7('0x2c')]&&_0x173a2e[_0xa9b7('0xa')][_0xa9b7('0x2c')]!=_0x258625['Interaction'][_0xa9b7('0x2c')]){return _0x52714d[_0xa9b7('0x13')][_0xa9b7('0x16')]({'threadId':_0x173a2e[_0xa9b7('0xa')][_0xa9b7('0x2c')]},{'where':{'id':_0x258625[_0xa9b7('0x26')]['id']}});}else{return;}})[_0xa9b7('0x15')](function(){return _0x177389['update']({'read':!![]});})[_0xa9b7('0x18')](function(_0x37442b){logger[_0xa9b7('0x19')](_0xa9b7('0x22'),_0xa9b7('0x2a'),util['inspect'](_0x37442b,{'showHidden':![],'depth':null}));_0x3c9f8b();});}else{_0x3c9f8b();}})['finally'](function(){_0x3c9f8b();});}else{_0x3c9f8b();}}},'charset':'utf8mb4','collate':_0xa9b7('0x2d')});}; \ No newline at end of file +var _0x64ff=['fti_openchannel_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','OpenchannelInteraction','then','update','createdAt','CmContact','describe','OpenchannelAccount','find','OpenchannelAccountId','Interactions','OpenchannelInteractionId','Contact','keys','replyUri','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','length','Interaction','POST','method','info','Message\x20%d\x20forwarded\x20to\x20%s','threadId','catch','error','inspect','finally','lodash','api','moment','request-promise','path','rimraf','../../config/environment','define'];(function(_0xe5bfa4,_0x5839d1){var _0x43efc8=function(_0x8f8ccd){while(--_0x8f8ccd){_0xe5bfa4['push'](_0xe5bfa4['shift']());}};_0x43efc8(++_0x5839d1);}(_0x64ff,0x178));var _0xf64f=function(_0x199b04,_0x4816ec){_0x199b04=_0x199b04-0x0;var _0x50e2cc=_0x64ff[_0x199b04];return _0x50e2cc;};'use strict';var _=require(_0xf64f('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf64f('0x1'));var moment=require(_0xf64f('0x2'));var BPromise=require('bluebird');var rp=require(_0xf64f('0x3'));var fs=require('fs');var path=require(_0xf64f('0x4'));var rimraf=require(_0xf64f('0x5'));var config=require(_0xf64f('0x6'));var attributes=require('./openchannelMessage.attributes');module['exports']=function(_0x3cbed9,_0x3240f){return _0x3cbed9[_0xf64f('0x7')]('OpenchannelMessage',attributes,{'tableName':'openchannel_messages','paranoid':![],'indexes':[{'name':_0xf64f('0x8'),'fields':[_0xf64f('0x9')],'type':_0xf64f('0xa')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x925067,_0x4c1d42,_0x2cd108){var _0x11628f=_0x3cbed9[_0xf64f('0xb')];var _0xb86889=_0x925067[_0xf64f('0xc')]({'plain':!![]});if(_0xb86889[_0xf64f('0xd')][_0xf64f('0xe')]()==='in'||_0xb86889[_0xf64f('0xd')]['toLowerCase']()===_0xf64f('0xf')&&!_0xb86889[_0xf64f('0x10')]&&!_[_0xf64f('0x11')](_0xb86889[_0xf64f('0x12')])){_0x11628f[_0xf64f('0x13')]['findOne']({'where':{'id':_0xb86889['OpenchannelInteractionId']}})[_0xf64f('0x14')](function(_0x1d6e16){if(_0x1d6e16){_0x1d6e16[_0xf64f('0x15')]({'lastMsgAt':_0xb86889[_0xf64f('0x16')],'lastMsgDirection':_0xb86889[_0xf64f('0xd')][_0xf64f('0xe')]()});}})['catch'](function(_0x9a3a5f){console['error'](_0x9a3a5f);});}if(_0xb86889[_0xf64f('0xd')]==='out'&&!_0xb86889[_0xf64f('0x10')]){var _0x5d6ae2;_0x11628f[_0xf64f('0x17')][_0xf64f('0x18')]()[_0xf64f('0x14')](function(_0x6b5509){return _0x11628f[_0xf64f('0x19')][_0xf64f('0x1a')]({'where':{'id':_0xb86889[_0xf64f('0x1b')]},'include':[{'model':_0x11628f[_0xf64f('0x13')],'as':_0xf64f('0x1c'),'where':{'id':_0xb86889[_0xf64f('0x1d')]},'limit':0x1,'include':[{'model':_0x11628f[_0xf64f('0x17')],'as':_0xf64f('0x1e'),'attributes':_[_0xf64f('0x1f')](_0x6b5509)}]}]});})[_0xf64f('0x14')](function(_0x2884ae){_0x5d6ae2=_0x2884ae['get']({'plain':!![]});if(_0x5d6ae2&&_0x5d6ae2[_0xf64f('0x20')]){logger['info'](_0xf64f('0x21'),_0xf64f('0x22'),util[_0xf64f('0x23')](_0xf64f('0x24'),_0xb86889['id'],_0x5d6ae2[_0xf64f('0x20')]));if(_0x5d6ae2[_0xf64f('0x1c')]&&_0x5d6ae2[_0xf64f('0x1c')][_0xf64f('0x25')]){_0xb86889[_0xf64f('0x26')]=_['omit'](_0x5d6ae2[_0xf64f('0x1c')][0x0],_0xf64f('0x1e'));_0xb86889['Contact']=_0x5d6ae2[_0xf64f('0x1c')][0x0][_0xf64f('0x1e')];}var _0x4c1d42={'method':_0xf64f('0x27'),'uri':encodeURI(_0x5d6ae2[_0xf64f('0x20')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x4c1d42[_0xf64f('0x28')]){case'GET':_0x4c1d42['qs']=_0xb86889;break;case _0xf64f('0x27'):_0x4c1d42[_0xf64f('0x9')]=_0xb86889;break;}return rp(_0x4c1d42)['then'](function(_0x1d5c6a){logger[_0xf64f('0x29')](_0xf64f('0x21'),_0xf64f('0x22'),util[_0xf64f('0x23')](_0xf64f('0x2a'),_0xb86889['id'],_0x5d6ae2[_0xf64f('0x20')]));if(_0x1d5c6a[_0xf64f('0x9')]['threadId']&&_0x1d5c6a[_0xf64f('0x9')][_0xf64f('0x2b')]!=_0xb86889[_0xf64f('0x26')][_0xf64f('0x2b')]){return _0x11628f[_0xf64f('0x13')][_0xf64f('0x15')]({'threadId':_0x1d5c6a[_0xf64f('0x9')]['threadId']},{'where':{'id':_0xb86889[_0xf64f('0x26')]['id']}});}else{return;}})[_0xf64f('0x14')](function(){return _0x925067[_0xf64f('0x15')]({'read':!![]});})[_0xf64f('0x2c')](function(_0x41f10d){logger[_0xf64f('0x2d')](_0xf64f('0x21'),'afterCreate',util[_0xf64f('0x2e')](_0x41f10d,{'showHidden':![],'depth':null}));_0x2cd108();});}else{_0x2cd108();}})[_0xf64f('0x2f')](function(){_0x2cd108();});}else{_0x2cd108();}}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 9c7a72d..9a6cc69 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 _0xdb28=['then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','CreateOpenchannelMessage','OpenchannelMessage','create','body','options','raw','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./openchannelMessage.socket','register','request'];(function(_0x2e0ffa,_0x451f12){var _0x24d627=function(_0x4d0f09){while(--_0x4d0f09){_0x2e0ffa['push'](_0x2e0ffa['shift']());}};_0x24d627(++_0x451f12);}(_0xdb28,0x106));var _0x8db2=function(_0x5a980b,_0x4bcabc){_0x5a980b=_0x5a980b-0x0;var _0x1f9925=_0xdb28[_0x5a980b];return _0x1f9925;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});config['redis']=_[_0x8db2('0xb')](config[_0x8db2('0xc')],{'host':_0x8db2('0xd'),'port':0x18eb});var socket=require(_0x8db2('0xe'))(new Redis(config[_0x8db2('0xc')]));require(_0x8db2('0xf'))[_0x8db2('0x10')](socket);function respondWithRpcPromise(_0x4ba340,_0x30dc90,_0x476216){return new BPromise(function(_0x1f62af,_0x57015f){return client[_0x8db2('0x11')](_0x4ba340,_0x476216)[_0x8db2('0x12')](function(_0x576475){logger[_0x8db2('0x13')](_0x8db2('0x14'),_0x30dc90,_0x8db2('0x15'));logger[_0x8db2('0x16')](_0x8db2('0x17'),_0x30dc90,'request\x20sent',JSON['stringify'](_0x576475));if(_0x576475[_0x8db2('0x18')]){if(_0x576475[_0x8db2('0x18')][_0x8db2('0x19')]===0x1f4){logger[_0x8db2('0x18')](_0x8db2('0x14'),_0x30dc90,_0x576475[_0x8db2('0x18')][_0x8db2('0x1a')]);return _0x57015f(_0x576475[_0x8db2('0x18')][_0x8db2('0x1a')]);}logger[_0x8db2('0x18')]('OpenchannelMessage,\x20%s,\x20%s',_0x30dc90,_0x576475[_0x8db2('0x18')][_0x8db2('0x1a')]);return _0x1f62af(_0x576475['error'][_0x8db2('0x1a')]);}else{logger[_0x8db2('0x13')](_0x8db2('0x14'),_0x30dc90,_0x8db2('0x15'));_0x1f62af(_0x576475[_0x8db2('0x1b')][_0x8db2('0x1a')]);}})['catch'](function(_0x5df464){logger[_0x8db2('0x18')](_0x8db2('0x14'),_0x30dc90,_0x5df464);_0x57015f(_0x5df464);});});}exports[_0x8db2('0x1c')]=function(_0x1b64e4){var _0x58562e=this;return new Promise(function(_0x431d60,_0x36a9ff){return db[_0x8db2('0x1d')][_0x8db2('0x1e')](_0x1b64e4[_0x8db2('0x1f')],{'raw':_0x1b64e4['options']?_0x1b64e4[_0x8db2('0x20')][_0x8db2('0x21')]===undefined?!![]:![]:!![]})[_0x8db2('0x12')](function(_0x125be2){logger[_0x8db2('0x13')](_0x8db2('0x1c'),_0x1b64e4);logger[_0x8db2('0x16')]('CreateOpenchannelMessage',_0x1b64e4,JSON[_0x8db2('0x22')](_0x125be2));_0x431d60(_0x125be2);})['catch'](function(_0x5725f0){logger['error']('CreateOpenchannelMessage',_0x5725f0[_0x8db2('0x1a')],_0x1b64e4);_0x36a9ff(_0x58562e[_0x8db2('0x18')](0x1f4,_0x5725f0[_0x8db2('0x1a')]));});});}; \ No newline at end of file +var _0x7a54=['../../config/environment','jayson/promise','http','defaults','redis','socket.io-emitter','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateOpenchannelMessage','OpenchannelMessage','body','options','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x56a313,_0x13d3c0){var _0x357bb7=function(_0xdd9619){while(--_0xdd9619){_0x56a313['push'](_0x56a313['shift']());}};_0x357bb7(++_0x13d3c0);}(_0x7a54,0x106));var _0x47a5=function(_0x35973e,_0x5ecdb7){_0x35973e=_0x35973e-0x0;var _0x5ce28c=_0x7a54[_0x35973e];return _0x5ce28c;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});config['redis']=_[_0x47a5('0xb')](config[_0x47a5('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x47a5('0xd'))(new Redis(config['redis']));require('./openchannelMessage.socket')['register'](socket);function respondWithRpcPromise(_0x2a0e98,_0x2baee7,_0x5e31dd){return new BPromise(function(_0x2eb0dd,_0x49e844){return client['request'](_0x2a0e98,_0x5e31dd)[_0x47a5('0xe')](function(_0x69e4d4){logger[_0x47a5('0xf')](_0x47a5('0x10'),_0x2baee7,_0x47a5('0x11'));logger[_0x47a5('0x12')](_0x47a5('0x13'),_0x2baee7,'request\x20sent',JSON[_0x47a5('0x14')](_0x69e4d4));if(_0x69e4d4[_0x47a5('0x15')]){if(_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x16')]===0x1f4){logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x17')]);return _0x49e844(_0x69e4d4['error'][_0x47a5('0x17')]);}logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x17')]);return _0x2eb0dd(_0x69e4d4['error']['message']);}else{logger[_0x47a5('0xf')]('OpenchannelMessage,\x20%s,\x20%s',_0x2baee7,'request\x20sent');_0x2eb0dd(_0x69e4d4[_0x47a5('0x18')][_0x47a5('0x17')]);}})[_0x47a5('0x19')](function(_0x1ef371){logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x1ef371);_0x49e844(_0x1ef371);});});}exports[_0x47a5('0x1a')]=function(_0xe3c618){var _0x3aed38=this;return new Promise(function(_0x4a9fcb,_0x1570bc){return db[_0x47a5('0x1b')]['create'](_0xe3c618[_0x47a5('0x1c')],{'raw':_0xe3c618[_0x47a5('0x1d')]?_0xe3c618[_0x47a5('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x47a5('0xe')](function(_0x2f142b){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xe3c618);logger['debug'](_0x47a5('0x1a'),_0xe3c618,JSON[_0x47a5('0x14')](_0x2f142b));_0x4a9fcb(_0x2f142b);})['catch'](function(_0x28747d){logger[_0x47a5('0x15')](_0x47a5('0x1a'),_0x28747d[_0x47a5('0x17')],_0xe3c618);_0x1570bc(_0x3aed38[_0x47a5('0x15')](0x1f4,_0x28747d['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 8493c3d..0d764ad 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 _0x723e=['remove','update','emit','removeListener','length','openchannelMessage:','save'];(function(_0x54c3cb,_0x147694){var _0x3edb09=function(_0x2afa48){while(--_0x2afa48){_0x54c3cb['push'](_0x54c3cb['shift']());}};_0x3edb09(++_0x147694);}(_0x723e,0x179));var _0xe723=function(_0xa9071b,_0x45e375){_0xa9071b=_0xa9071b-0x0;var _0x32d5c3=_0x723e[_0xa9071b];return _0x32d5c3;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=[_0xe723('0x0'),_0xe723('0x1'),_0xe723('0x2')];function createListener(_0x161d6b,_0x2801c5){return function(_0xab58a8){_0x2801c5[_0xe723('0x3')](_0x161d6b,_0xab58a8);};}function removeListener(_0x1da20f,_0x8f78b2){return function(){OpenchannelMessageEvents[_0xe723('0x4')](_0x1da20f,_0x8f78b2);};}exports['register']=function(_0x32d689){for(var _0x20c13b=0x0,_0x1335cd=events[_0xe723('0x5')];_0x20c13b<_0x1335cd;_0x20c13b++){var _0x2aebbd=events[_0x20c13b];var _0xe50f7=createListener(_0xe723('0x6')+_0x2aebbd,_0x32d689);OpenchannelMessageEvents['on'](_0x2aebbd,_0xe50f7);}}; \ No newline at end of file +var _0x52a8=['length','update','emit','removeListener','register'];(function(_0x336cac,_0x138b35){var _0x36d63a=function(_0x13f0d7){while(--_0x13f0d7){_0x336cac['push'](_0x336cac['shift']());}};_0x36d63a(++_0x138b35);}(_0x52a8,0x141));var _0x852a=function(_0x1b55f7,_0x2aa4cb){_0x1b55f7=_0x1b55f7-0x0;var _0xc9fab9=_0x52a8[_0x1b55f7];return _0xc9fab9;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=['save','remove',_0x852a('0x0')];function createListener(_0x54cdc8,_0x2662ef){return function(_0x1a71fc){_0x2662ef[_0x852a('0x1')](_0x54cdc8,_0x1a71fc);};}function removeListener(_0x466ffd,_0x1846eb){return function(){OpenchannelMessageEvents[_0x852a('0x2')](_0x466ffd,_0x1846eb);};}exports[_0x852a('0x3')]=function(_0x2c5580){for(var _0x36d165=0x0,_0x36cbaf=events[_0x852a('0x4')];_0x36d165<_0x36cbaf;_0x36d165++){var _0x1f9fe0=events[_0x36d165];var _0x5611ac=createListener('openchannelMessage:'+_0x1f9fe0,_0x2c5580);OpenchannelMessageEvents['on'](_0x1f9fe0,_0x5611ac);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 64435bc..440c42c 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 _0x09ca=['put','update','delete','destroy','/:id/teams','removeTeams','exports','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelQueue.controller','get','isAuthenticated','index','describe','/:id','show','/:id/members','getTeams','post','create','addTeams','/:id/users'];(function(_0x2fa3ac,_0x246e51){var _0x32b9b1=function(_0x5bdaf9){while(--_0x5bdaf9){_0x2fa3ac['push'](_0x2fa3ac['shift']());}};_0x32b9b1(++_0x246e51);}(_0x09ca,0x10b));var _0xa09c=function(_0x28509e,_0x7c5503){_0x28509e=_0x28509e-0x0;var _0x2229ec=_0x09ca[_0x28509e];return _0x2229ec;};'use strict';var multer=require(_0xa09c('0x0'));var util=require('util');var path=require(_0xa09c('0x1'));var timeout=require(_0xa09c('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xa09c('0x3'));var auth=require(_0xa09c('0x4'));var interaction=require(_0xa09c('0x5'));var config=require('../../config/environment');var controller=require(_0xa09c('0x6'));router[_0xa09c('0x7')]('/',auth[_0xa09c('0x8')](),controller[_0xa09c('0x9')]);router[_0xa09c('0x7')]('/describe',auth[_0xa09c('0x8')](),controller[_0xa09c('0xa')]);router['get'](_0xa09c('0xb'),auth[_0xa09c('0x8')](),controller[_0xa09c('0xc')]);router['get'](_0xa09c('0xd'),auth[_0xa09c('0x8')](),controller['getMembers']);router[_0xa09c('0x7')]('/:id/teams',auth[_0xa09c('0x8')](),controller[_0xa09c('0xe')]);router[_0xa09c('0x7')]('/:id/users',auth[_0xa09c('0x8')](),controller['getAgents']);router[_0xa09c('0xf')]('/',auth[_0xa09c('0x8')](),controller[_0xa09c('0x10')]);router['post']('/:id/teams',auth[_0xa09c('0x8')](),controller[_0xa09c('0x11')]);router['post'](_0xa09c('0x12'),auth['isAuthenticated'](),controller['addAgents']);router[_0xa09c('0x13')](_0xa09c('0xb'),auth[_0xa09c('0x8')](),controller[_0xa09c('0x14')]);router[_0xa09c('0x15')]('/:id',auth['isAuthenticated'](),controller[_0xa09c('0x16')]);router[_0xa09c('0x15')](_0xa09c('0x17'),auth[_0xa09c('0x8')](),controller[_0xa09c('0x18')]);router['delete'](_0xa09c('0x12'),auth[_0xa09c('0x8')](),controller['removeAgents']);module[_0xa09c('0x19')]=router; \ No newline at end of file +var _0x5cc4=['index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addAgents','put','update','delete','destroy','removeAgents','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated'];(function(_0x287cf0,_0x2f90cf){var _0x1ce6c5=function(_0x6e532a){while(--_0x6e532a){_0x287cf0['push'](_0x287cf0['shift']());}};_0x1ce6c5(++_0x2f90cf);}(_0x5cc4,0xb4));var _0x45cc=function(_0x46efd7,_0x43f84d){_0x46efd7=_0x46efd7-0x0;var _0x5637e4=_0x5cc4[_0x46efd7];return _0x5637e4;};'use strict';var multer=require(_0x45cc('0x0'));var util=require(_0x45cc('0x1'));var path=require(_0x45cc('0x2'));var timeout=require(_0x45cc('0x3'));var express=require(_0x45cc('0x4'));var router=express['Router']();var fs_extra=require(_0x45cc('0x5'));var auth=require(_0x45cc('0x6'));var interaction=require(_0x45cc('0x7'));var config=require(_0x45cc('0x8'));var controller=require(_0x45cc('0x9'));router[_0x45cc('0xa')]('/',auth[_0x45cc('0xb')](),controller[_0x45cc('0xc')]);router['get'](_0x45cc('0xd'),auth[_0x45cc('0xb')](),controller[_0x45cc('0xe')]);router[_0x45cc('0xa')](_0x45cc('0xf'),auth[_0x45cc('0xb')](),controller[_0x45cc('0x10')]);router[_0x45cc('0xa')](_0x45cc('0x11'),auth[_0x45cc('0xb')](),controller[_0x45cc('0x12')]);router[_0x45cc('0xa')](_0x45cc('0x13'),auth[_0x45cc('0xb')](),controller[_0x45cc('0x14')]);router['get'](_0x45cc('0x15'),auth[_0x45cc('0xb')](),controller[_0x45cc('0x16')]);router[_0x45cc('0x17')]('/',auth[_0x45cc('0xb')](),controller[_0x45cc('0x18')]);router[_0x45cc('0x17')](_0x45cc('0x13'),auth[_0x45cc('0xb')](),controller['addTeams']);router[_0x45cc('0x17')](_0x45cc('0x15'),auth[_0x45cc('0xb')](),controller[_0x45cc('0x19')]);router[_0x45cc('0x1a')](_0x45cc('0xf'),auth[_0x45cc('0xb')](),controller[_0x45cc('0x1b')]);router[_0x45cc('0x1c')](_0x45cc('0xf'),auth[_0x45cc('0xb')](),controller[_0x45cc('0x1d')]);router[_0x45cc('0x1c')](_0x45cc('0x13'),auth[_0x45cc('0xb')](),controller['removeTeams']);router[_0x45cc('0x1c')](_0x45cc('0x15'),auth[_0x45cc('0xb')](),controller[_0x45cc('0x1e')]);module[_0x45cc('0x1f')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index ddc32fe..7106fd3 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 _0x477f=['exports','name','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize'];(function(_0x11439d,_0x2cde2e){var _0x3018de=function(_0x321457){while(--_0x321457){_0x11439d['push'](_0x11439d['shift']());}};_0x3018de(++_0x2cde2e);}(_0x477f,0x187));var _0xf477=function(_0xb601da,_0x57e20a){_0xb601da=_0xb601da-0x0;var _0x2ad00d=_0x477f[_0xb601da];return _0x2ad00d;};'use strict';var Sequelize=require(_0xf477('0x0'));module[_0xf477('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xf477('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xf477('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xf477('0x4')](_0xf477('0x5'),_0xf477('0x6'),_0xf477('0x7'))}}; \ No newline at end of file +var _0x418d=['ENUM','rrmemory','beepall','exports','name','INTEGER'];(function(_0x595d06,_0x39fbe6){var _0x134572=function(_0x1e82da){while(--_0x1e82da){_0x595d06['push'](_0x595d06['shift']());}};_0x134572(++_0x39fbe6);}(_0x418d,0x15f));var _0xd418=function(_0x460438,_0x4ba826){_0x460438=_0x460438-0x0;var _0x481317=_0x418d[_0x460438];return _0x481317;};'use strict';var Sequelize=require('sequelize');module[_0xd418('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xd418('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xd418('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xd418('0x3')](_0xd418('0x4'),_0xd418('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 d75fba6..8c51f65 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 _0x9931=['util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','redis','localhost','socket.io-emitter','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','OpenchannelQueues','UserProfileResource','destroy','sendStatus','error','stack','name','index','OpenchannelQueue','rawAttributes','fieldName','type','key','getOptions','where','include','query','rows','catch','show','params','keys','filters','intersection','attributes','model','fields','length','includeAll','merge','options','create','body','get','UserProfileSection','find','autoAssociation','describe','getMembers','findOne','hasOwnProperty','nolimit','order','sort','pick','OpenchannelQueueId','filter','map','UserOpenchannelQueue','findAll','User','findAndCountAll','UserId','updatedAt','%s/%s','SIP','openchannelPause','createdAt','getTeams','Team','addTeams','ids','online','voicePause','interface','sequelize','findOrCreate','forEach','userOpenchannelQueue:save','removeTeams','Agents','select','field','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','includes','value','transaction','isEmpty','removeAgents','emit','userOpenchannelQueue:remove','addAgents','omit','spread','isArray','getAgents','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9931,0x15b));var _0x1993=function(_0x3b25ef,_0x5429b3){_0x3b25ef=_0x3b25ef-0x0;var _0x1b3158=_0x9931[_0x3b25ef];return _0x1b3158;};'use strict';var BPromise=require(_0x1993('0x0'));var util=require(_0x1993('0x1'));var _=require(_0x1993('0x2'));var squel=require(_0x1993('0x3'));var Redis=require(_0x1993('0x4'));var qs=require(_0x1993('0x5'));var logger=require(_0x1993('0x6'))('api');var config=require(_0x1993('0x7'));var db=require('../../mysqldb')['db'];config[_0x1993('0x8')]=_['defaults'](config[_0x1993('0x8')],{'host':_0x1993('0x9'),'port':0x18eb});var socket=require(_0x1993('0xa'))(new Redis(config['redis']));require('./openchannelQueue.socket')['register'](socket);function respondWithStatusCode(_0x5616e4,_0x4704f1){_0x4704f1=_0x4704f1||0xcc;return function(_0x293fd5){if(_0x293fd5){return _0x5616e4['sendStatus'](_0x4704f1);}return _0x5616e4[_0x1993('0xb')](_0x4704f1)[_0x1993('0xc')]();};}function respondWithResult(_0x1e8ef3,_0x352a8b){_0x352a8b=_0x352a8b||0xc8;return function(_0x35808b){if(_0x35808b){return _0x1e8ef3[_0x1993('0xb')](_0x352a8b)[_0x1993('0xd')](_0x35808b);}};}function respondWithFilteredResult(_0x209c5b,_0x3eda82){return function(_0x7147fc){if(_0x7147fc){var _0x1e26c4=typeof _0x3eda82[_0x1993('0xe')]===_0x1993('0xf')&&typeof _0x3eda82[_0x1993('0x10')]==='undefined';var _0x5d260d=_0x7147fc[_0x1993('0x11')];var _0xc08374=_0x1e26c4?0x0:_0x3eda82['offset'];var _0x24b157=_0x1e26c4?_0x7147fc['count']:_0x3eda82[_0x1993('0xe')]+_0x3eda82[_0x1993('0x10')];var _0x15eb92;if(_0x24b157>=_0x5d260d){_0x24b157=_0x5d260d;_0x15eb92=0xc8;}else{_0x15eb92=0xce;}_0x209c5b[_0x1993('0xb')](_0x15eb92);return _0x209c5b[_0x1993('0x12')](_0x1993('0x13'),_0xc08374+'-'+_0x24b157+'/'+_0x5d260d)['json'](_0x7147fc);}return null;};}function saveUpdates(_0x2f55de){return function(_0x36925a){if(_0x36925a){return _0x36925a[_0x1993('0x14')](_0x2f55de)['then'](function(_0x178c17){return _0x178c17;});}return null;};}function removeEntity(_0x13de44){return function(_0x22bbf2){if(_0x22bbf2){return _0x22bbf2['destroy']()[_0x1993('0x15')](function(){var _0x463f1f=_0x22bbf2['get']({'plain':!![]});var _0x41f407=_0x1993('0x16');return db[_0x1993('0x17')][_0x1993('0x18')]({'where':{'type':_0x41f407,'resourceId':_0x463f1f['id']}})[_0x1993('0x15')](function(){return _0x22bbf2;});})[_0x1993('0x15')](function(){_0x13de44[_0x1993('0xb')](0xcc)[_0x1993('0xc')]();});}};}function handleEntityNotFound(_0x4e2390){return function(_0x22b67f){if(!_0x22b67f){_0x4e2390[_0x1993('0x19')](0x194);}return _0x22b67f;};}function handleError(_0x5196bb,_0x1c313c){_0x1c313c=_0x1c313c||0x1f4;return function(_0x3f9210){logger[_0x1993('0x1a')](_0x3f9210[_0x1993('0x1b')]);if(_0x3f9210['name']){delete _0x3f9210[_0x1993('0x1c')];}_0x5196bb[_0x1993('0xb')](_0x1c313c)['send'](_0x3f9210);};}exports[_0x1993('0x1d')]=function(_0x34b439,_0x241d16){var _0x27d83c={};var _0x998037={'count':0x0,'rows':[]};var _0xedf405=_['map'](db[_0x1993('0x1e')][_0x1993('0x1f')],function(_0x1fe164){return{'name':_0x1fe164[_0x1993('0x20')],'type':_0x1fe164[_0x1993('0x21')][_0x1993('0x22')]};});_0x27d83c=qs[_0x1993('0x23')](_0xedf405,_0x34b439);var _0x18ab6d={'where':_0x27d83c[_0x1993('0x24')]};return db[_0x1993('0x1e')][_0x1993('0x11')](_0x18ab6d)[_0x1993('0x15')](function(_0x19170d){_0x998037[_0x1993('0x11')]=_0x19170d;_0x27d83c[_0x1993('0x25')]=qs[_0x1993('0x25')](_0x34b439[_0x1993('0x26')]);return db['OpenchannelQueue']['findAll'](_0x27d83c);})[_0x1993('0x15')](function(_0xc66eb9){_0x998037[_0x1993('0x27')]=_0xc66eb9;return _0x998037;})[_0x1993('0x15')](respondWithFilteredResult(_0x241d16,_0x27d83c))[_0x1993('0x28')](handleError(_0x241d16,null));};exports[_0x1993('0x29')]=function(_0x443c09,_0x53759f){var _0x550ae5={'raw':!![],'where':{'id':_0x443c09[_0x1993('0x2a')]['id']}},_0x303eb2={};_0x303eb2['model']=_[_0x1993('0x2b')](db[_0x1993('0x1e')][_0x1993('0x1f')]);_0x303eb2['query']=_[_0x1993('0x2b')](_0x443c09['query']);_0x303eb2[_0x1993('0x2c')]=_[_0x1993('0x2d')](_0x303eb2['model'],_0x303eb2[_0x1993('0x26')]);_0x550ae5[_0x1993('0x2e')]=_[_0x1993('0x2d')](_0x303eb2[_0x1993('0x2f')],qs['fields'](_0x443c09['query'][_0x1993('0x30')]));_0x550ae5[_0x1993('0x2e')]=_0x550ae5[_0x1993('0x2e')][_0x1993('0x31')]?_0x550ae5[_0x1993('0x2e')]:_0x303eb2[_0x1993('0x2f')];if(_0x443c09[_0x1993('0x26')][_0x1993('0x32')]){_0x550ae5[_0x1993('0x25')]=[{'all':!![]}];}_0x550ae5=_[_0x1993('0x33')]({},_0x550ae5,_0x443c09[_0x1993('0x34')]);return db[_0x1993('0x1e')]['find'](_0x550ae5)[_0x1993('0x15')](handleEntityNotFound(_0x53759f,null))[_0x1993('0x15')](respondWithResult(_0x53759f,null))[_0x1993('0x28')](handleError(_0x53759f,null));};exports['create']=function(_0x50bd1e,_0x497678){return db['OpenchannelQueue'][_0x1993('0x35')](_0x50bd1e[_0x1993('0x36')],{})[_0x1993('0x15')](function(_0x43178d){var _0x583ede=_0x50bd1e['user'][_0x1993('0x37')]({'plain':!![]});if(!_0x583ede)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x583ede['role']==='user'){var _0x39c914=_0x43178d['get']({'plain':!![]});var _0x1d363c='OpenchannelQueues';return db[_0x1993('0x38')][_0x1993('0x39')]({'where':{'name':_0x1d363c,'userProfileId':_0x583ede['userProfileId']},'raw':!![]})[_0x1993('0x15')](function(_0x1f078d){if(_0x1f078d&&_0x1f078d[_0x1993('0x3a')]===0x0){return db[_0x1993('0x17')]['create']({'name':_0x39c914['name'],'resourceId':_0x39c914['id'],'type':_0x1f078d[_0x1993('0x1c')],'sectionId':_0x1f078d['id']},{})[_0x1993('0x15')](function(){return _0x43178d;});}else{return _0x43178d;}})[_0x1993('0x28')](function(_0x3d7788){logger[_0x1993('0x1a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3d7788);throw _0x3d7788;});}return _0x43178d;})[_0x1993('0x15')](respondWithResult(_0x497678,0xc9))[_0x1993('0x28')](handleError(_0x497678,null));};exports['update']=function(_0x264f8c,_0x437342){if(_0x264f8c[_0x1993('0x36')]['id']){delete _0x264f8c[_0x1993('0x36')]['id'];}return db[_0x1993('0x1e')][_0x1993('0x39')]({'where':{'id':_0x264f8c[_0x1993('0x2a')]['id']}})[_0x1993('0x15')](handleEntityNotFound(_0x437342,null))['then'](saveUpdates(_0x264f8c[_0x1993('0x36')],null))[_0x1993('0x15')](respondWithResult(_0x437342,null))[_0x1993('0x28')](handleError(_0x437342,null));};exports[_0x1993('0x18')]=function(_0x5a754b,_0x282123){return db[_0x1993('0x1e')][_0x1993('0x39')]({'where':{'id':_0x5a754b[_0x1993('0x2a')]['id']}})[_0x1993('0x15')](handleEntityNotFound(_0x282123,null))[_0x1993('0x15')](removeEntity(_0x282123,null))[_0x1993('0x28')](handleError(_0x282123,null));};exports['describe']=function(_0x3e8cab,_0x1b0061){return db[_0x1993('0x1e')][_0x1993('0x3b')]()[_0x1993('0x15')](respondWithResult(_0x1b0061,null))[_0x1993('0x28')](handleError(_0x1b0061,null));};exports[_0x1993('0x3c')]=function(_0x29acfb,_0x5ba75b){var _0x52ec91={'raw':!![],'where':{}},_0x2be955={},_0x5493a4;return db['OpenchannelQueue'][_0x1993('0x3d')]({'where':{'id':_0x29acfb['params']['id']}})['then'](handleEntityNotFound(_0x5ba75b,null))[_0x1993('0x15')](function(_0x4c7e3a){if(_0x4c7e3a){_0x5493a4=_0x4c7e3a['get']({'plain':!![]});_0x2be955[_0x1993('0x2f')]=_[_0x1993('0x2b')](db['UserOpenchannelQueue'][_0x1993('0x1f')]);_0x2be955['query']=_[_0x1993('0x2b')](_0x29acfb['query']);_0x2be955['filters']=_[_0x1993('0x2d')](_0x2be955[_0x1993('0x2f')],_0x2be955[_0x1993('0x26')]);_0x52ec91[_0x1993('0x2e')]=_['intersection'](_0x2be955['model'],qs[_0x1993('0x30')](_0x29acfb[_0x1993('0x26')][_0x1993('0x30')]));_0x52ec91[_0x1993('0x2e')]=_0x52ec91['attributes'][_0x1993('0x31')]?_0x52ec91[_0x1993('0x2e')]:_0x2be955[_0x1993('0x2f')];if(!_0x29acfb['query'][_0x1993('0x3e')](_0x1993('0x3f'))){_0x52ec91[_0x1993('0x10')]=qs[_0x1993('0x10')](_0x29acfb[_0x1993('0x26')]['limit']);_0x52ec91[_0x1993('0xe')]=qs[_0x1993('0xe')](_0x29acfb[_0x1993('0x26')][_0x1993('0xe')]);}_0x52ec91[_0x1993('0x40')]=qs[_0x1993('0x41')](_0x29acfb['query'][_0x1993('0x41')]);_0x52ec91[_0x1993('0x24')]=qs[_0x1993('0x2c')](_[_0x1993('0x42')](_0x29acfb[_0x1993('0x26')],_0x2be955[_0x1993('0x2c')]));_0x52ec91[_0x1993('0x24')][_0x1993('0x43')]=_0x4c7e3a['id'];if(_0x29acfb[_0x1993('0x26')][_0x1993('0x44')]){_0x52ec91[_0x1993('0x24')]=_[_0x1993('0x33')](_0x52ec91['where'],{'$or':_[_0x1993('0x45')](_0x52ec91[_0x1993('0x2e')],function(_0x24f67d){var _0x119b75={};_0x119b75[_0x24f67d]={'$like':'%'+_0x29acfb['query']['filter']+'%'};return _0x119b75;})});}_0x52ec91=_[_0x1993('0x33')]({},_0x52ec91,_0x29acfb[_0x1993('0x34')]);return db[_0x1993('0x46')][_0x1993('0x47')](_0x52ec91);}})[_0x1993('0x15')](function(_0x4a99d8){if(_0x4a99d8){return db[_0x1993('0x48')][_0x1993('0x49')]({'where':{'id':_[_0x1993('0x45')](_0x4a99d8,_0x1993('0x4a')),'role':'agent'},'attributes':['id',_0x1993('0x1c'),'openchannelPause',_0x1993('0x4b'),'createdAt']});}})[_0x1993('0x15')](function(_0x4115e9){if(_0x4115e9){return{'count':_0x4115e9[_0x1993('0x11')],'rows':_[_0x1993('0x45')](_0x4115e9['rows'],function(_0x5ab896){return{'membername':_0x5ab896['name'],'UserId':_0x5ab896['id'],'queue_name':_0x5493a4[_0x1993('0x1c')],'OpenchannelQueueId':_0x5493a4['id'],'interface':util['format'](_0x1993('0x4c'),_0x1993('0x4d'),_0x5ab896['name']),'penalty':0x0,'paused':_0x5ab896[_0x1993('0x4e')],'createdAt':_0x5ab896[_0x1993('0x4f')],'updatedAt':_0x5ab896[_0x1993('0x4b')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x1993('0x15')](respondWithFilteredResult(_0x5ba75b,_0x52ec91))['catch'](handleError(_0x5ba75b,null));};exports[_0x1993('0x50')]=function(_0x5d6180,_0x50c1eb){var _0x1e8213={};var _0x4d0d5a={};var _0x2be529;var _0x51d7bd;return db['OpenchannelQueue']['findOne']({'where':{'id':_0x5d6180[_0x1993('0x2a')]['id']}})['then'](handleEntityNotFound(_0x50c1eb,null))[_0x1993('0x15')](function(_0x39ab91){if(_0x39ab91){_0x2be529=_0x39ab91;_0x4d0d5a[_0x1993('0x2f')]=_[_0x1993('0x2b')](db[_0x1993('0x51')][_0x1993('0x1f')]);_0x4d0d5a[_0x1993('0x26')]=_[_0x1993('0x2b')](_0x5d6180[_0x1993('0x26')]);_0x4d0d5a[_0x1993('0x2c')]=_['intersection'](_0x4d0d5a[_0x1993('0x2f')],_0x4d0d5a[_0x1993('0x26')]);_0x1e8213['attributes']=_[_0x1993('0x2d')](_0x4d0d5a[_0x1993('0x2f')],qs[_0x1993('0x30')](_0x5d6180['query'][_0x1993('0x30')]));_0x1e8213['attributes']=_0x1e8213[_0x1993('0x2e')][_0x1993('0x31')]?_0x1e8213[_0x1993('0x2e')]:_0x4d0d5a['model'];_0x1e8213[_0x1993('0x40')]=qs[_0x1993('0x41')](_0x5d6180['query'][_0x1993('0x41')]);_0x1e8213[_0x1993('0x24')]=qs['filters'](_[_0x1993('0x42')](_0x5d6180[_0x1993('0x26')],_0x4d0d5a['filters']));if(_0x5d6180['query'][_0x1993('0x44')]){_0x1e8213[_0x1993('0x24')]=_[_0x1993('0x33')](_0x1e8213[_0x1993('0x24')],{'$or':_[_0x1993('0x45')](_0x1e8213[_0x1993('0x2e')],function(_0x329baf){var _0x167ccf={};_0x167ccf[_0x329baf]={'$like':'%'+_0x5d6180[_0x1993('0x26')][_0x1993('0x44')]+'%'};return _0x167ccf;})});}_0x1e8213=_[_0x1993('0x33')]({},_0x1e8213,_0x5d6180[_0x1993('0x34')]);return _0x2be529[_0x1993('0x50')](_0x1e8213);}})[_0x1993('0x15')](function(_0x373e3a){if(_0x373e3a){_0x51d7bd=_0x373e3a[_0x1993('0x31')];if(!_0x5d6180[_0x1993('0x26')]['hasOwnProperty'](_0x1993('0x3f'))){_0x1e8213[_0x1993('0x10')]=qs[_0x1993('0x10')](_0x5d6180[_0x1993('0x26')]['limit']);_0x1e8213[_0x1993('0xe')]=qs['offset'](_0x5d6180['query'][_0x1993('0xe')]);}return _0x2be529[_0x1993('0x50')](_0x1e8213);}})[_0x1993('0x15')](function(_0x5f342f){if(_0x5f342f){return _0x5f342f?{'count':_0x51d7bd,'rows':_0x5f342f}:null;}})[_0x1993('0x15')](respondWithResult(_0x50c1eb,null))[_0x1993('0x28')](handleError(_0x50c1eb,null));};exports[_0x1993('0x52')]=function(_0x28aeac,_0x314100){var _0x25489d=_0x28aeac[_0x1993('0x36')][_0x1993('0x53')];return db[_0x1993('0x51')][_0x1993('0x47')]({'where':{'id':_0x25489d},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id','name',_0x1993('0x54'),_0x1993('0x55'),_0x1993('0x56')],'raw':!![]}]})['then'](function(_0x51afb7){if(_0x51afb7){var _0x54770a=_['flatMap'](_0x51afb7,function(_0x202d86){var _0x42ed34=_0x202d86[_0x1993('0x37')]({'plain':!![]});return _0x42ed34['Agents'];});return db['OpenchannelQueue'][_0x1993('0x39')]({'where':{'id':_0x28aeac[_0x1993('0x2a')]['id']}})[_0x1993('0x15')](function(_0x560c7f){return db[_0x1993('0x57')]['transaction'](function(_0x365466){return _0x560c7f[_0x1993('0x52')](_0x25489d,{'transaction':_0x365466})[_0x1993('0x15')](function(){return BPromise['each'](_0x54770a,function(_0x5be5ff){return db[_0x1993('0x46')][_0x1993('0x58')]({'where':{'UserId':_0x5be5ff['id'],'OpenchannelQueueId':_0x28aeac[_0x1993('0x2a')]['id']},'transaction':_0x365466});});})['then'](function(){_0x54770a[_0x1993('0x59')](function(_0x26176f){socket['emit'](_0x1993('0x5a'),{'UserId':_0x26176f['id'],'OpenchannelQueueId':_0x560c7f['id']});});});});});}})[_0x1993('0x15')](respondWithStatusCode(_0x314100,null))['catch'](handleError(_0x314100,null));};exports[_0x1993('0x5b')]=function(_0x4aca41,_0x2d82dd){return db[_0x1993('0x51')][_0x1993('0x47')]({'where':{'id':_0x4aca41[_0x1993('0x26')][_0x1993('0x53')]},'attributes':['id'],'include':[{'model':db[_0x1993('0x48')],'as':_0x1993('0x5c'),'attributes':['id'],'raw':!![]}]})[_0x1993('0x15')](handleEntityNotFound(_0x2d82dd,null))[_0x1993('0x15')](function(_0x3b7a0c){var _0x456f3a=_[_0x1993('0x45')](_0x3b7a0c,'id');var _0x1a5e0c=[];var _0x5ffe70=[];var _0xbcb694=squel[_0x1993('0x5d')]();_0xbcb694[_0x1993('0x5e')]('tq.TeamId')['from']('team_has_openchannel_queues','tq')[_0x1993('0x5f')](_0x1993('0x60'),'ut',_0x1993('0x61'))[_0x1993('0x24')](_0x1993('0x62'),_0x4aca41['params']['id']);for(var _0x38424a=0x0;_0x38424a<_0x3b7a0c['length'];_0x38424a+=0x1){let _0x26b5ce=_0x3b7a0c[_0x38424a];for(var _0x286363=0x0;_0x286363<_0x26b5ce[_0x1993('0x5c')]['length'];_0x286363+=0x1){let _0xb2fb85=_0x26b5ce[_0x1993('0x5c')][_0x286363];var _0x2a7011=_0xbcb694['clone']();_0x2a7011[_0x1993('0x24')](_0x1993('0x63'),_0xb2fb85['id']);_0x5ffe70['push'](db[_0x1993('0x57')][_0x1993('0x26')](_0x2a7011[_0x1993('0x64')](),{'type':db[_0x1993('0x57')][_0x1993('0x65')][_0x1993('0x66')]})['then'](function(_0x26a8f6){if(_0x26a8f6[_0x1993('0x31')]===0x1){return _0xb2fb85['id'];}else{var _0x11ac33=_[_0x1993('0x67')](_[_0x1993('0x45')](_0x26a8f6,'TeamId'),function(_0x507cde){return _[_0x1993('0x68')](_0x456f3a,_0x507cde);});if(_0x11ac33){return _0xb2fb85['id'];}}}));}}return BPromise['all'](_0x5ffe70)[_0x1993('0x15')](function(_0x327b22){_0x1a5e0c=_(_0x1a5e0c)['union'](_0x327b22)['compact']()[_0x1993('0x69')]();return db[_0x1993('0x1e')][_0x1993('0x39')]({'where':{'id':_0x4aca41['params']['id']}})[_0x1993('0x15')](function(_0x2b2f0a){return db[_0x1993('0x57')][_0x1993('0x6a')](function(_0x416225){return _0x2b2f0a[_0x1993('0x5b')](_0x4aca41[_0x1993('0x26')][_0x1993('0x53')],{'transaction':_0x416225})[_0x1993('0x15')](function(){if(!_[_0x1993('0x6b')](_0x1a5e0c)){return _0x2b2f0a[_0x1993('0x6c')](_0x1a5e0c,{'transaction':_0x416225});}})[_0x1993('0x15')](function(){_0x1a5e0c[_0x1993('0x59')](function(_0xa30c20){socket[_0x1993('0x6d')](_0x1993('0x6e'),{'UserId':_0xa30c20,'OpenchannelQueueId':_0x2b2f0a['id']});});});});});});})[_0x1993('0x15')](respondWithStatusCode(_0x2d82dd,null))[_0x1993('0x28')](handleError(_0x2d82dd,null));};exports[_0x1993('0x6f')]=function(_0x2e8552,_0x8c1a26){return db[_0x1993('0x1e')][_0x1993('0x39')]({'where':{'id':_0x2e8552[_0x1993('0x2a')]['id']}})[_0x1993('0x15')](handleEntityNotFound(_0x8c1a26,null))[_0x1993('0x15')](function(_0x3eb912){if(_0x3eb912){return _0x3eb912[_0x1993('0x6f')](_0x2e8552[_0x1993('0x36')][_0x1993('0x53')],_[_0x1993('0x70')](_0x2e8552[_0x1993('0x36')],['ids','id'])||{})[_0x1993('0x71')](function(_0x4fa154){for(var _0x57134e=0x0;_0x57134e<_0x2e8552[_0x1993('0x36')][_0x1993('0x53')][_0x1993('0x31')];_0x57134e+=0x1){socket[_0x1993('0x6d')](_0x1993('0x5a'),{'UserId':Number(_0x2e8552[_0x1993('0x36')][_0x1993('0x53')][_0x57134e]),'OpenchannelQueueId':Number(_0x2e8552[_0x1993('0x2a')]['id'])});}return _0x4fa154;});}})[_0x1993('0x15')](respondWithResult(_0x8c1a26,null))[_0x1993('0x28')](handleError(_0x8c1a26,null));};exports['removeAgents']=function(_0x414110,_0xfadba4){return db[_0x1993('0x1e')]['find']({'where':{'id':_0x414110[_0x1993('0x2a')]['id']}})[_0x1993('0x15')](handleEntityNotFound(_0xfadba4,null))[_0x1993('0x15')](function(_0x479b96){if(_0x479b96){return _0x479b96[_0x1993('0x6c')](_0x414110['query'][_0x1993('0x53')])['then'](function(){if(_[_0x1993('0x72')](_0x414110[_0x1993('0x26')][_0x1993('0x53')])){for(var _0xa95292=0x0;_0xa95292<_0x414110['query'][_0x1993('0x53')]['length'];_0xa95292+=0x1){socket[_0x1993('0x6d')]('userOpenchannelQueue:remove',{'UserId':Number(_0x414110[_0x1993('0x26')]['ids'][_0xa95292]),'OpenchannelQueueId':Number(_0x414110[_0x1993('0x2a')]['id'])});}}else{socket[_0x1993('0x6d')]('userOpenchannelQueue:remove',{'UserId':Number(_0x414110[_0x1993('0x26')]['ids']),'OpenchannelQueueId':Number(_0x414110[_0x1993('0x2a')]['id'])});}});}})[_0x1993('0x15')](respondWithStatusCode(_0xfadba4,null))[_0x1993('0x28')](handleError(_0xfadba4,null));};exports[_0x1993('0x73')]=function(_0x3ea52f,_0x3e9316){var _0x37f1e1={};var _0x5e10fe={};var _0x1dfd11;var _0x236611;return db[_0x1993('0x1e')]['findOne']({'where':{'id':_0x3ea52f[_0x1993('0x2a')]['id']}})['then'](handleEntityNotFound(_0x3e9316,null))[_0x1993('0x15')](function(_0x1d9d68){if(_0x1d9d68){_0x1dfd11=_0x1d9d68;_0x5e10fe[_0x1993('0x2f')]=_[_0x1993('0x2b')](db['User'][_0x1993('0x1f')]);_0x5e10fe[_0x1993('0x26')]=_[_0x1993('0x2b')](_0x3ea52f[_0x1993('0x26')]);_0x5e10fe[_0x1993('0x2c')]=_[_0x1993('0x2d')](_0x5e10fe[_0x1993('0x2f')],_0x5e10fe[_0x1993('0x26')]);_0x37f1e1[_0x1993('0x2e')]=_['intersection'](_0x5e10fe['model'],qs[_0x1993('0x30')](_0x3ea52f[_0x1993('0x26')][_0x1993('0x30')]));_0x37f1e1[_0x1993('0x2e')]=_0x37f1e1[_0x1993('0x2e')]['length']?_0x37f1e1[_0x1993('0x2e')]:_0x5e10fe[_0x1993('0x2f')];_0x37f1e1[_0x1993('0x40')]=qs[_0x1993('0x41')](_0x3ea52f[_0x1993('0x26')][_0x1993('0x41')]);_0x37f1e1[_0x1993('0x24')]=qs['filters'](_['pick'](_0x3ea52f[_0x1993('0x26')],_0x5e10fe[_0x1993('0x2c')]));if(_0x3ea52f['query'][_0x1993('0x44')]){_0x37f1e1[_0x1993('0x24')]=_[_0x1993('0x33')](_0x37f1e1[_0x1993('0x24')],{'$or':_['map'](_0x37f1e1[_0x1993('0x2e')],function(_0x17b920){var _0x4555e2={};_0x4555e2[_0x17b920]={'$like':'%'+_0x3ea52f[_0x1993('0x26')][_0x1993('0x44')]+'%'};return _0x4555e2;})});}_0x37f1e1=_[_0x1993('0x33')]({},_0x37f1e1,_0x3ea52f[_0x1993('0x34')]);return _0x1dfd11[_0x1993('0x73')](_0x37f1e1);}})[_0x1993('0x15')](function(_0x4cb14f){if(_0x4cb14f){_0x236611=_0x4cb14f['length'];if(!_0x3ea52f[_0x1993('0x26')]['hasOwnProperty'](_0x1993('0x3f'))){_0x37f1e1[_0x1993('0x10')]=qs[_0x1993('0x10')](_0x3ea52f[_0x1993('0x26')]['limit']);_0x37f1e1[_0x1993('0xe')]=qs['offset'](_0x3ea52f['query']['offset']);}return _0x1dfd11[_0x1993('0x73')](_0x37f1e1);}})[_0x1993('0x15')](function(_0x21eb89){if(_0x21eb89){return _0x21eb89?{'count':_0x236611,'rows':_0x21eb89}:null;}})['then'](respondWithResult(_0x3e9316,null))['catch'](handleError(_0x3e9316,null));}; \ No newline at end of file +var _0xd367=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','findOne','UserOpenchannelQueue','hasOwnProperty','nolimit','order','sort','pick','OpenchannelQueueId','filter','merge','findAll','User','findAndCountAll','UserId','agent','createdAt','format','%s/%s','SIP','openchannelPause','updatedAt','getTeams','Team','addTeams','ids','Agents','online','flatMap','sequelize','each','findOrCreate','emit','userOpenchannelQueue:save','removeTeams','tq.TeamId','from','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','includes','all','union','isEmpty','userOpenchannelQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','bluebird','util','lodash','squel','../../components/parsers/qs','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','update','then','destroy','get','OpenchannelQueues','UserProfileResource','error','name','index','map','OpenchannelQueue','rawAttributes','fieldName','type','key','getOptions','where','include','query','rows','catch','show','params','model','keys','filters','intersection','attributes','fields','length','includeAll','options','create','user','UserProfileSection','find','userProfileId','autoAssociation'];(function(_0x46eb0e,_0x296d16){var _0x523297=function(_0x1e0dbb){while(--_0x1e0dbb){_0x46eb0e['push'](_0x46eb0e['shift']());}};_0x523297(++_0x296d16);}(_0xd367,0x1a4));var _0x7d36=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd367[_0xa464c9];return _0x3d73c4;};'use strict';var BPromise=require(_0x7d36('0x0'));var util=require(_0x7d36('0x1'));var _=require(_0x7d36('0x2'));var squel=require(_0x7d36('0x3'));var Redis=require('ioredis');var qs=require(_0x7d36('0x4'));var logger=require('../../config/logger')(_0x7d36('0x5'));var config=require(_0x7d36('0x6'));var db=require('../../mysqldb')['db'];config[_0x7d36('0x7')]=_[_0x7d36('0x8')](config[_0x7d36('0x7')],{'host':_0x7d36('0x9'),'port':0x18eb});var socket=require(_0x7d36('0xa'))(new Redis(config[_0x7d36('0x7')]));require(_0x7d36('0xb'))[_0x7d36('0xc')](socket);function respondWithStatusCode(_0x134fd2,_0x1adc6e){_0x1adc6e=_0x1adc6e||0xcc;return function(_0x2a1b1b){if(_0x2a1b1b){return _0x134fd2[_0x7d36('0xd')](_0x1adc6e);}return _0x134fd2[_0x7d36('0xe')](_0x1adc6e)[_0x7d36('0xf')]();};}function respondWithResult(_0x45dd3d,_0x4fbe8e){_0x4fbe8e=_0x4fbe8e||0xc8;return function(_0x5bf6c2){if(_0x5bf6c2){return _0x45dd3d[_0x7d36('0xe')](_0x4fbe8e)['json'](_0x5bf6c2);}};}function respondWithFilteredResult(_0x3081c8,_0x11bcc1){return function(_0x33faf9){if(_0x33faf9){var _0x3fd2b4=typeof _0x11bcc1[_0x7d36('0x10')]===_0x7d36('0x11')&&typeof _0x11bcc1[_0x7d36('0x12')]===_0x7d36('0x11');var _0x4ec2a4=_0x33faf9[_0x7d36('0x13')];var _0xb54c97=_0x3fd2b4?0x0:_0x11bcc1[_0x7d36('0x10')];var _0xbb50b0=_0x3fd2b4?_0x33faf9[_0x7d36('0x13')]:_0x11bcc1[_0x7d36('0x10')]+_0x11bcc1[_0x7d36('0x12')];var _0x41c84c;if(_0xbb50b0>=_0x4ec2a4){_0xbb50b0=_0x4ec2a4;_0x41c84c=0xc8;}else{_0x41c84c=0xce;}_0x3081c8[_0x7d36('0xe')](_0x41c84c);return _0x3081c8['set'](_0x7d36('0x14'),_0xb54c97+'-'+_0xbb50b0+'/'+_0x4ec2a4)[_0x7d36('0x15')](_0x33faf9);}return null;};}function saveUpdates(_0x46bd09){return function(_0x4f2563){if(_0x4f2563){return _0x4f2563[_0x7d36('0x16')](_0x46bd09)[_0x7d36('0x17')](function(_0x37cdfe){return _0x37cdfe;});}return null;};}function removeEntity(_0x2d3074){return function(_0x3a9f00){if(_0x3a9f00){return _0x3a9f00[_0x7d36('0x18')]()[_0x7d36('0x17')](function(){var _0x9fefaf=_0x3a9f00[_0x7d36('0x19')]({'plain':!![]});var _0x4c5b18=_0x7d36('0x1a');return db[_0x7d36('0x1b')]['destroy']({'where':{'type':_0x4c5b18,'resourceId':_0x9fefaf['id']}})[_0x7d36('0x17')](function(){return _0x3a9f00;});})[_0x7d36('0x17')](function(){_0x2d3074[_0x7d36('0xe')](0xcc)[_0x7d36('0xf')]();});}};}function handleEntityNotFound(_0x5ee30a){return function(_0x5111bb){if(!_0x5111bb){_0x5ee30a[_0x7d36('0xd')](0x194);}return _0x5111bb;};}function handleError(_0x1b3a41,_0x4e4a09){_0x4e4a09=_0x4e4a09||0x1f4;return function(_0x8001b1){logger[_0x7d36('0x1c')](_0x8001b1['stack']);if(_0x8001b1[_0x7d36('0x1d')]){delete _0x8001b1[_0x7d36('0x1d')];}_0x1b3a41[_0x7d36('0xe')](_0x4e4a09)['send'](_0x8001b1);};}exports[_0x7d36('0x1e')]=function(_0x272c5a,_0x56273f){var _0x297279={};var _0x445a2c={'count':0x0,'rows':[]};var _0x49b2bd=_[_0x7d36('0x1f')](db[_0x7d36('0x20')][_0x7d36('0x21')],function(_0x238338){return{'name':_0x238338[_0x7d36('0x22')],'type':_0x238338[_0x7d36('0x23')][_0x7d36('0x24')]};});_0x297279=qs[_0x7d36('0x25')](_0x49b2bd,_0x272c5a);var _0x44ba44={'where':_0x297279[_0x7d36('0x26')]};return db[_0x7d36('0x20')][_0x7d36('0x13')](_0x44ba44)[_0x7d36('0x17')](function(_0x51b715){_0x445a2c[_0x7d36('0x13')]=_0x51b715;_0x297279[_0x7d36('0x27')]=qs['include'](_0x272c5a[_0x7d36('0x28')]);return db['OpenchannelQueue']['findAll'](_0x297279);})[_0x7d36('0x17')](function(_0x94da02){_0x445a2c[_0x7d36('0x29')]=_0x94da02;return _0x445a2c;})['then'](respondWithFilteredResult(_0x56273f,_0x297279))[_0x7d36('0x2a')](handleError(_0x56273f,null));};exports[_0x7d36('0x2b')]=function(_0x174b7b,_0x334ad8){var _0x1a1547={'raw':!![],'where':{'id':_0x174b7b[_0x7d36('0x2c')]['id']}},_0x59a92a={};_0x59a92a[_0x7d36('0x2d')]=_[_0x7d36('0x2e')](db[_0x7d36('0x20')][_0x7d36('0x21')]);_0x59a92a['query']=_[_0x7d36('0x2e')](_0x174b7b[_0x7d36('0x28')]);_0x59a92a[_0x7d36('0x2f')]=_[_0x7d36('0x30')](_0x59a92a[_0x7d36('0x2d')],_0x59a92a[_0x7d36('0x28')]);_0x1a1547[_0x7d36('0x31')]=_['intersection'](_0x59a92a[_0x7d36('0x2d')],qs[_0x7d36('0x32')](_0x174b7b['query']['fields']));_0x1a1547[_0x7d36('0x31')]=_0x1a1547[_0x7d36('0x31')][_0x7d36('0x33')]?_0x1a1547['attributes']:_0x59a92a[_0x7d36('0x2d')];if(_0x174b7b['query'][_0x7d36('0x34')]){_0x1a1547[_0x7d36('0x27')]=[{'all':!![]}];}_0x1a1547=_['merge']({},_0x1a1547,_0x174b7b[_0x7d36('0x35')]);return db['OpenchannelQueue']['find'](_0x1a1547)[_0x7d36('0x17')](handleEntityNotFound(_0x334ad8,null))[_0x7d36('0x17')](respondWithResult(_0x334ad8,null))[_0x7d36('0x2a')](handleError(_0x334ad8,null));};exports[_0x7d36('0x36')]=function(_0x5a185c,_0x54c02b){return db[_0x7d36('0x20')][_0x7d36('0x36')](_0x5a185c['body'],{})[_0x7d36('0x17')](function(_0x35cf1f){var _0x17c1d7=_0x5a185c[_0x7d36('0x37')][_0x7d36('0x19')]({'plain':!![]});if(!_0x17c1d7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x17c1d7['role']==='user'){var _0x174adc=_0x35cf1f[_0x7d36('0x19')]({'plain':!![]});var _0x24d48f='OpenchannelQueues';return db[_0x7d36('0x38')][_0x7d36('0x39')]({'where':{'name':_0x24d48f,'userProfileId':_0x17c1d7[_0x7d36('0x3a')]},'raw':!![]})[_0x7d36('0x17')](function(_0x3f619b){if(_0x3f619b&&_0x3f619b[_0x7d36('0x3b')]===0x0){return db[_0x7d36('0x1b')][_0x7d36('0x36')]({'name':_0x174adc[_0x7d36('0x1d')],'resourceId':_0x174adc['id'],'type':_0x3f619b['name'],'sectionId':_0x3f619b['id']},{})[_0x7d36('0x17')](function(){return _0x35cf1f;});}else{return _0x35cf1f;}})[_0x7d36('0x2a')](function(_0x2016c3){logger['error'](_0x7d36('0x3c'),_0x2016c3);throw _0x2016c3;});}return _0x35cf1f;})['then'](respondWithResult(_0x54c02b,0xc9))[_0x7d36('0x2a')](handleError(_0x54c02b,null));};exports['update']=function(_0x457099,_0x5e7ce1){if(_0x457099['body']['id']){delete _0x457099[_0x7d36('0x3d')]['id'];}return db['OpenchannelQueue'][_0x7d36('0x39')]({'where':{'id':_0x457099[_0x7d36('0x2c')]['id']}})[_0x7d36('0x17')](handleEntityNotFound(_0x5e7ce1,null))[_0x7d36('0x17')](saveUpdates(_0x457099[_0x7d36('0x3d')],null))[_0x7d36('0x17')](respondWithResult(_0x5e7ce1,null))[_0x7d36('0x2a')](handleError(_0x5e7ce1,null));};exports[_0x7d36('0x18')]=function(_0x4ffbfe,_0x5eea99){return db[_0x7d36('0x20')][_0x7d36('0x39')]({'where':{'id':_0x4ffbfe[_0x7d36('0x2c')]['id']}})[_0x7d36('0x17')](handleEntityNotFound(_0x5eea99,null))['then'](removeEntity(_0x5eea99,null))[_0x7d36('0x2a')](handleError(_0x5eea99,null));};exports[_0x7d36('0x3e')]=function(_0x5a6bab,_0x1dd7a4){return db['OpenchannelQueue']['describe']()[_0x7d36('0x17')](respondWithResult(_0x1dd7a4,null))[_0x7d36('0x2a')](handleError(_0x1dd7a4,null));};exports['getMembers']=function(_0xc77855,_0xdd98fb){var _0x4b2a3e={'raw':!![],'where':{}},_0x5af8f1={},_0x542095;return db[_0x7d36('0x20')][_0x7d36('0x3f')]({'where':{'id':_0xc77855[_0x7d36('0x2c')]['id']}})['then'](handleEntityNotFound(_0xdd98fb,null))[_0x7d36('0x17')](function(_0x4e5394){if(_0x4e5394){_0x542095=_0x4e5394[_0x7d36('0x19')]({'plain':!![]});_0x5af8f1['model']=_['keys'](db[_0x7d36('0x40')]['rawAttributes']);_0x5af8f1[_0x7d36('0x28')]=_[_0x7d36('0x2e')](_0xc77855[_0x7d36('0x28')]);_0x5af8f1['filters']=_[_0x7d36('0x30')](_0x5af8f1['model'],_0x5af8f1[_0x7d36('0x28')]);_0x4b2a3e[_0x7d36('0x31')]=_[_0x7d36('0x30')](_0x5af8f1[_0x7d36('0x2d')],qs['fields'](_0xc77855[_0x7d36('0x28')][_0x7d36('0x32')]));_0x4b2a3e[_0x7d36('0x31')]=_0x4b2a3e[_0x7d36('0x31')][_0x7d36('0x33')]?_0x4b2a3e[_0x7d36('0x31')]:_0x5af8f1[_0x7d36('0x2d')];if(!_0xc77855[_0x7d36('0x28')][_0x7d36('0x41')](_0x7d36('0x42'))){_0x4b2a3e['limit']=qs[_0x7d36('0x12')](_0xc77855[_0x7d36('0x28')][_0x7d36('0x12')]);_0x4b2a3e[_0x7d36('0x10')]=qs[_0x7d36('0x10')](_0xc77855[_0x7d36('0x28')][_0x7d36('0x10')]);}_0x4b2a3e[_0x7d36('0x43')]=qs[_0x7d36('0x44')](_0xc77855['query'][_0x7d36('0x44')]);_0x4b2a3e[_0x7d36('0x26')]=qs[_0x7d36('0x2f')](_[_0x7d36('0x45')](_0xc77855[_0x7d36('0x28')],_0x5af8f1[_0x7d36('0x2f')]));_0x4b2a3e[_0x7d36('0x26')][_0x7d36('0x46')]=_0x4e5394['id'];if(_0xc77855['query'][_0x7d36('0x47')]){_0x4b2a3e[_0x7d36('0x26')]=_[_0x7d36('0x48')](_0x4b2a3e[_0x7d36('0x26')],{'$or':_[_0x7d36('0x1f')](_0x4b2a3e[_0x7d36('0x31')],function(_0x415011){var _0x218802={};_0x218802[_0x415011]={'$like':'%'+_0xc77855[_0x7d36('0x28')][_0x7d36('0x47')]+'%'};return _0x218802;})});}_0x4b2a3e=_[_0x7d36('0x48')]({},_0x4b2a3e,_0xc77855[_0x7d36('0x35')]);return db['UserOpenchannelQueue'][_0x7d36('0x49')](_0x4b2a3e);}})[_0x7d36('0x17')](function(_0x2bb21b){if(_0x2bb21b){return db[_0x7d36('0x4a')][_0x7d36('0x4b')]({'where':{'id':_[_0x7d36('0x1f')](_0x2bb21b,_0x7d36('0x4c')),'role':_0x7d36('0x4d')},'attributes':['id',_0x7d36('0x1d'),'openchannelPause','updatedAt',_0x7d36('0x4e')]});}})['then'](function(_0x3d5fbd){if(_0x3d5fbd){return{'count':_0x3d5fbd['count'],'rows':_['map'](_0x3d5fbd[_0x7d36('0x29')],function(_0x55e2dd){return{'membername':_0x55e2dd['name'],'UserId':_0x55e2dd['id'],'queue_name':_0x542095['name'],'OpenchannelQueueId':_0x542095['id'],'interface':util[_0x7d36('0x4f')](_0x7d36('0x50'),_0x7d36('0x51'),_0x55e2dd[_0x7d36('0x1d')]),'penalty':0x0,'paused':_0x55e2dd[_0x7d36('0x52')],'createdAt':_0x55e2dd['createdAt'],'updatedAt':_0x55e2dd[_0x7d36('0x53')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x7d36('0x17')](respondWithFilteredResult(_0xdd98fb,_0x4b2a3e))[_0x7d36('0x2a')](handleError(_0xdd98fb,null));};exports[_0x7d36('0x54')]=function(_0x247939,_0x125b6d){var _0x5d4791={};var _0x36c0cc={};var _0x44c8b1;var _0x309410;return db[_0x7d36('0x20')][_0x7d36('0x3f')]({'where':{'id':_0x247939[_0x7d36('0x2c')]['id']}})['then'](handleEntityNotFound(_0x125b6d,null))['then'](function(_0x3c31ad){if(_0x3c31ad){_0x44c8b1=_0x3c31ad;_0x36c0cc[_0x7d36('0x2d')]=_[_0x7d36('0x2e')](db[_0x7d36('0x55')][_0x7d36('0x21')]);_0x36c0cc['query']=_[_0x7d36('0x2e')](_0x247939[_0x7d36('0x28')]);_0x36c0cc[_0x7d36('0x2f')]=_['intersection'](_0x36c0cc['model'],_0x36c0cc['query']);_0x5d4791[_0x7d36('0x31')]=_[_0x7d36('0x30')](_0x36c0cc[_0x7d36('0x2d')],qs[_0x7d36('0x32')](_0x247939[_0x7d36('0x28')][_0x7d36('0x32')]));_0x5d4791[_0x7d36('0x31')]=_0x5d4791['attributes'][_0x7d36('0x33')]?_0x5d4791[_0x7d36('0x31')]:_0x36c0cc[_0x7d36('0x2d')];_0x5d4791[_0x7d36('0x43')]=qs['sort'](_0x247939['query'][_0x7d36('0x44')]);_0x5d4791[_0x7d36('0x26')]=qs[_0x7d36('0x2f')](_[_0x7d36('0x45')](_0x247939['query'],_0x36c0cc[_0x7d36('0x2f')]));if(_0x247939[_0x7d36('0x28')][_0x7d36('0x47')]){_0x5d4791[_0x7d36('0x26')]=_['merge'](_0x5d4791[_0x7d36('0x26')],{'$or':_[_0x7d36('0x1f')](_0x5d4791['attributes'],function(_0x5a7c0a){var _0x51ecf0={};_0x51ecf0[_0x5a7c0a]={'$like':'%'+_0x247939[_0x7d36('0x28')]['filter']+'%'};return _0x51ecf0;})});}_0x5d4791=_[_0x7d36('0x48')]({},_0x5d4791,_0x247939[_0x7d36('0x35')]);return _0x44c8b1[_0x7d36('0x54')](_0x5d4791);}})['then'](function(_0x4cc808){if(_0x4cc808){_0x309410=_0x4cc808[_0x7d36('0x33')];if(!_0x247939['query']['hasOwnProperty']('nolimit')){_0x5d4791[_0x7d36('0x12')]=qs['limit'](_0x247939[_0x7d36('0x28')][_0x7d36('0x12')]);_0x5d4791[_0x7d36('0x10')]=qs[_0x7d36('0x10')](_0x247939[_0x7d36('0x28')][_0x7d36('0x10')]);}return _0x44c8b1[_0x7d36('0x54')](_0x5d4791);}})[_0x7d36('0x17')](function(_0x9ffa03){if(_0x9ffa03){return _0x9ffa03?{'count':_0x309410,'rows':_0x9ffa03}:null;}})[_0x7d36('0x17')](respondWithResult(_0x125b6d,null))[_0x7d36('0x2a')](handleError(_0x125b6d,null));};exports[_0x7d36('0x56')]=function(_0x3d722c,_0x7e5f9){var _0x27aec9=_0x3d722c[_0x7d36('0x3d')][_0x7d36('0x57')];return db['Team'][_0x7d36('0x49')]({'where':{'id':_0x27aec9},'attributes':['id'],'include':[{'model':db[_0x7d36('0x4a')],'as':_0x7d36('0x58'),'attributes':['id',_0x7d36('0x1d'),_0x7d36('0x59'),'voicePause','interface'],'raw':!![]}]})[_0x7d36('0x17')](function(_0x10c521){if(_0x10c521){var _0x55ac97=_[_0x7d36('0x5a')](_0x10c521,function(_0x43758d){var _0xe083c1=_0x43758d[_0x7d36('0x19')]({'plain':!![]});return _0xe083c1[_0x7d36('0x58')];});return db[_0x7d36('0x20')][_0x7d36('0x39')]({'where':{'id':_0x3d722c[_0x7d36('0x2c')]['id']}})[_0x7d36('0x17')](function(_0x6a5605){return db[_0x7d36('0x5b')]['transaction'](function(_0x2134e7){return _0x6a5605[_0x7d36('0x56')](_0x27aec9,{'transaction':_0x2134e7})[_0x7d36('0x17')](function(){return BPromise[_0x7d36('0x5c')](_0x55ac97,function(_0xcfe575){return db[_0x7d36('0x40')][_0x7d36('0x5d')]({'where':{'UserId':_0xcfe575['id'],'OpenchannelQueueId':_0x3d722c[_0x7d36('0x2c')]['id']},'transaction':_0x2134e7});});})[_0x7d36('0x17')](function(){_0x55ac97['forEach'](function(_0x5ba2a5){socket[_0x7d36('0x5e')](_0x7d36('0x5f'),{'UserId':_0x5ba2a5['id'],'OpenchannelQueueId':_0x6a5605['id']});});});});});}})[_0x7d36('0x17')](respondWithStatusCode(_0x7e5f9,null))[_0x7d36('0x2a')](handleError(_0x7e5f9,null));};exports[_0x7d36('0x60')]=function(_0xb1153f,_0x4bbbbe){return db[_0x7d36('0x55')][_0x7d36('0x49')]({'where':{'id':_0xb1153f[_0x7d36('0x28')][_0x7d36('0x57')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x7d36('0x58'),'attributes':['id'],'raw':!![]}]})[_0x7d36('0x17')](handleEntityNotFound(_0x4bbbbe,null))[_0x7d36('0x17')](function(_0x1dab45){var _0x451e0b=_[_0x7d36('0x1f')](_0x1dab45,'id');var _0x422009=[];var _0x2fcbfa=[];var _0x4febf1=squel['select']();_0x4febf1['field'](_0x7d36('0x61'))[_0x7d36('0x62')]('team_has_openchannel_queues','tq')['join'](_0x7d36('0x63'),'ut',_0x7d36('0x64'))[_0x7d36('0x26')](_0x7d36('0x65'),_0xb1153f['params']['id']);for(var _0x2cb5ab=0x0;_0x2cb5ab<_0x1dab45[_0x7d36('0x33')];_0x2cb5ab+=0x1){let _0x4ec313=_0x1dab45[_0x2cb5ab];for(var _0x51f106=0x0;_0x51f106<_0x4ec313[_0x7d36('0x58')][_0x7d36('0x33')];_0x51f106+=0x1){let _0x577c8b=_0x4ec313['Agents'][_0x51f106];var _0x328997=_0x4febf1[_0x7d36('0x66')]();_0x328997['where'](_0x7d36('0x67'),_0x577c8b['id']);_0x2fcbfa[_0x7d36('0x68')](db[_0x7d36('0x5b')][_0x7d36('0x28')](_0x328997[_0x7d36('0x69')](),{'type':db[_0x7d36('0x5b')][_0x7d36('0x6a')][_0x7d36('0x6b')]})['then'](function(_0x1fa0e8){if(_0x1fa0e8['length']===0x1){return _0x577c8b['id'];}else{var _0x6b09e7=_['every'](_['map'](_0x1fa0e8,_0x7d36('0x6c')),function(_0x28ee0a){return _[_0x7d36('0x6d')](_0x451e0b,_0x28ee0a);});if(_0x6b09e7){return _0x577c8b['id'];}}}));}}return BPromise[_0x7d36('0x6e')](_0x2fcbfa)[_0x7d36('0x17')](function(_0x1f65c9){_0x422009=_(_0x422009)[_0x7d36('0x6f')](_0x1f65c9)['compact']()['value']();return db[_0x7d36('0x20')][_0x7d36('0x39')]({'where':{'id':_0xb1153f[_0x7d36('0x2c')]['id']}})[_0x7d36('0x17')](function(_0x5e59f3){return db['sequelize']['transaction'](function(_0x31acc3){return _0x5e59f3[_0x7d36('0x60')](_0xb1153f[_0x7d36('0x28')][_0x7d36('0x57')],{'transaction':_0x31acc3})[_0x7d36('0x17')](function(){if(!_[_0x7d36('0x70')](_0x422009)){return _0x5e59f3['removeAgents'](_0x422009,{'transaction':_0x31acc3});}})[_0x7d36('0x17')](function(){_0x422009['forEach'](function(_0x5a9dde){socket[_0x7d36('0x5e')](_0x7d36('0x71'),{'UserId':_0x5a9dde,'OpenchannelQueueId':_0x5e59f3['id']});});});});});});})[_0x7d36('0x17')](respondWithStatusCode(_0x4bbbbe,null))[_0x7d36('0x2a')](handleError(_0x4bbbbe,null));};exports[_0x7d36('0x72')]=function(_0x5bd608,_0x2984b2){return db[_0x7d36('0x20')][_0x7d36('0x39')]({'where':{'id':_0x5bd608[_0x7d36('0x2c')]['id']}})[_0x7d36('0x17')](handleEntityNotFound(_0x2984b2,null))['then'](function(_0x477a97){if(_0x477a97){return _0x477a97[_0x7d36('0x72')](_0x5bd608[_0x7d36('0x3d')][_0x7d36('0x57')],_[_0x7d36('0x73')](_0x5bd608[_0x7d36('0x3d')],[_0x7d36('0x57'),'id'])||{})[_0x7d36('0x74')](function(_0x24733c){for(var _0x39f3d4=0x0;_0x39f3d4<_0x5bd608[_0x7d36('0x3d')][_0x7d36('0x57')][_0x7d36('0x33')];_0x39f3d4+=0x1){socket[_0x7d36('0x5e')](_0x7d36('0x5f'),{'UserId':Number(_0x5bd608[_0x7d36('0x3d')][_0x7d36('0x57')][_0x39f3d4]),'OpenchannelQueueId':Number(_0x5bd608[_0x7d36('0x2c')]['id'])});}return _0x24733c;});}})[_0x7d36('0x17')](respondWithResult(_0x2984b2,null))[_0x7d36('0x2a')](handleError(_0x2984b2,null));};exports[_0x7d36('0x75')]=function(_0x3ee10e,_0x351994){return db[_0x7d36('0x20')][_0x7d36('0x39')]({'where':{'id':_0x3ee10e[_0x7d36('0x2c')]['id']}})[_0x7d36('0x17')](handleEntityNotFound(_0x351994,null))[_0x7d36('0x17')](function(_0x3c805b){if(_0x3c805b){return _0x3c805b['removeAgents'](_0x3ee10e[_0x7d36('0x28')]['ids'])[_0x7d36('0x17')](function(){if(_[_0x7d36('0x76')](_0x3ee10e[_0x7d36('0x28')][_0x7d36('0x57')])){for(var _0x325d00=0x0;_0x325d00<_0x3ee10e['query'][_0x7d36('0x57')][_0x7d36('0x33')];_0x325d00+=0x1){socket[_0x7d36('0x5e')](_0x7d36('0x71'),{'UserId':Number(_0x3ee10e[_0x7d36('0x28')]['ids'][_0x325d00]),'OpenchannelQueueId':Number(_0x3ee10e[_0x7d36('0x2c')]['id'])});}}else{socket[_0x7d36('0x5e')](_0x7d36('0x71'),{'UserId':Number(_0x3ee10e['query'][_0x7d36('0x57')]),'OpenchannelQueueId':Number(_0x3ee10e[_0x7d36('0x2c')]['id'])});}});}})[_0x7d36('0x17')](respondWithStatusCode(_0x351994,null))[_0x7d36('0x2a')](handleError(_0x351994,null));};exports[_0x7d36('0x77')]=function(_0x5153c8,_0x4dcb90){var _0x1e7089={};var _0x25e31f={};var _0x231e1b;var _0x2c262d;return db['OpenchannelQueue']['findOne']({'where':{'id':_0x5153c8['params']['id']}})['then'](handleEntityNotFound(_0x4dcb90,null))[_0x7d36('0x17')](function(_0x3f0709){if(_0x3f0709){_0x231e1b=_0x3f0709;_0x25e31f['model']=_[_0x7d36('0x2e')](db[_0x7d36('0x4a')][_0x7d36('0x21')]);_0x25e31f[_0x7d36('0x28')]=_[_0x7d36('0x2e')](_0x5153c8[_0x7d36('0x28')]);_0x25e31f[_0x7d36('0x2f')]=_[_0x7d36('0x30')](_0x25e31f['model'],_0x25e31f[_0x7d36('0x28')]);_0x1e7089[_0x7d36('0x31')]=_['intersection'](_0x25e31f[_0x7d36('0x2d')],qs[_0x7d36('0x32')](_0x5153c8['query'][_0x7d36('0x32')]));_0x1e7089[_0x7d36('0x31')]=_0x1e7089[_0x7d36('0x31')][_0x7d36('0x33')]?_0x1e7089[_0x7d36('0x31')]:_0x25e31f[_0x7d36('0x2d')];_0x1e7089['order']=qs[_0x7d36('0x44')](_0x5153c8[_0x7d36('0x28')][_0x7d36('0x44')]);_0x1e7089[_0x7d36('0x26')]=qs[_0x7d36('0x2f')](_[_0x7d36('0x45')](_0x5153c8['query'],_0x25e31f[_0x7d36('0x2f')]));if(_0x5153c8[_0x7d36('0x28')]['filter']){_0x1e7089[_0x7d36('0x26')]=_[_0x7d36('0x48')](_0x1e7089[_0x7d36('0x26')],{'$or':_['map'](_0x1e7089[_0x7d36('0x31')],function(_0x5dc2de){var _0xd0624b={};_0xd0624b[_0x5dc2de]={'$like':'%'+_0x5153c8[_0x7d36('0x28')]['filter']+'%'};return _0xd0624b;})});}_0x1e7089=_['merge']({},_0x1e7089,_0x5153c8[_0x7d36('0x35')]);return _0x231e1b[_0x7d36('0x77')](_0x1e7089);}})[_0x7d36('0x17')](function(_0xc2f49f){if(_0xc2f49f){_0x2c262d=_0xc2f49f[_0x7d36('0x33')];if(!_0x5153c8[_0x7d36('0x28')][_0x7d36('0x41')](_0x7d36('0x42'))){_0x1e7089['limit']=qs['limit'](_0x5153c8[_0x7d36('0x28')][_0x7d36('0x12')]);_0x1e7089['offset']=qs[_0x7d36('0x10')](_0x5153c8[_0x7d36('0x28')]['offset']);}return _0x231e1b[_0x7d36('0x77')](_0x1e7089);}})[_0x7d36('0x17')](function(_0x3af795){if(_0x3af795){return _0x3af795?{'count':_0x2c262d,'rows':_0x3af795}:null;}})[_0x7d36('0x17')](respondWithResult(_0x4dcb90,null))['catch'](handleError(_0x4dcb90,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 0d154a7..cb412f0 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 _0x50db=['save','update','remove','emit','hasOwnProperty','events','../../mysqldb'];(function(_0x3fd694,_0xdf5397){var _0x343506=function(_0x20619c){while(--_0x20619c){_0x3fd694['push'](_0x3fd694['shift']());}};_0x343506(++_0xdf5397);}(_0x50db,0x139));var _0xb50d=function(_0x34335e,_0x53a4f4){_0x34335e=_0x34335e-0x0;var _0x18a519=_0x50db[_0x34335e];return _0x18a519;};'use strict';var EventEmitter=require(_0xb50d('0x0'));var OpenchannelQueue=require(_0xb50d('0x1'))['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb50d('0x2'),'afterUpdate':_0xb50d('0x3'),'afterDestroy':_0xb50d('0x4')};function emitEvent(_0xb09ced){return function(_0x31965d,_0x44a64f,_0x17bee7){OpenchannelQueueEvents['emit'](_0xb09ced+':'+_0x31965d['id'],_0x31965d);OpenchannelQueueEvents[_0xb50d('0x5')](_0xb09ced,_0x31965d);_0x17bee7(null);};}for(var e in events){if(events[_0xb50d('0x6')](e)){var event=events[e];OpenchannelQueue['hook'](e,emitEvent(event));}}module['exports']=OpenchannelQueueEvents; \ No newline at end of file +var _0xd1a5=['hook','events','../../mysqldb','OpenchannelQueue','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x3337b6,_0x42c7f9){var _0x568270=function(_0x56e5df){while(--_0x56e5df){_0x3337b6['push'](_0x3337b6['shift']());}};_0x568270(++_0x42c7f9);}(_0xd1a5,0xf4));var _0x5d1a=function(_0x26462c,_0xd20a35){_0x26462c=_0x26462c-0x0;var _0x509a42=_0xd1a5[_0x26462c];return _0x509a42;};'use strict';var EventEmitter=require(_0x5d1a('0x0'));var OpenchannelQueue=require(_0x5d1a('0x1'))['db'][_0x5d1a('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x5d1a('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x5d1a('0x4'),'afterDestroy':_0x5d1a('0x5')};function emitEvent(_0x447665){return function(_0x1b9ae9,_0x5252ef,_0x31850f){OpenchannelQueueEvents['emit'](_0x447665+':'+_0x1b9ae9['id'],_0x1b9ae9);OpenchannelQueueEvents[_0x5d1a('0x6')](_0x447665,_0x1b9ae9);_0x31850f(null);};}for(var e in events){if(events[_0x5d1a('0x7')](e)){var event=events[e];OpenchannelQueue[_0x5d1a('0x8')](e,emitEvent(event));}}module['exports']=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index dcbfbe4..9f2f1d5 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 _0x45a1=['define','OpenchannelQueue','openchannel_queues','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./openchannelQueue.attributes','exports'];(function(_0x3ba9ec,_0x49c244){var _0x39f681=function(_0x5da9c0){while(--_0x5da9c0){_0x3ba9ec['push'](_0x3ba9ec['shift']());}};_0x39f681(++_0x49c244);}(_0x45a1,0x161));var _0x145a=function(_0x1adf53,_0x118d70){_0x1adf53=_0x1adf53-0x0;var _0x36927c=_0x45a1[_0x1adf53];return _0x36927c;};'use strict';var _=require(_0x145a('0x0'));var util=require(_0x145a('0x1'));var logger=require(_0x145a('0x2'))(_0x145a('0x3'));var moment=require(_0x145a('0x4'));var BPromise=require('bluebird');var rp=require(_0x145a('0x5'));var fs=require('fs');var path=require(_0x145a('0x6'));var rimraf=require(_0x145a('0x7'));var config=require(_0x145a('0x8'));var attributes=require(_0x145a('0x9'));module[_0x145a('0xa')]=function(_0x42880,_0x498797){return _0x42880[_0x145a('0xb')](_0x145a('0xc'),attributes,{'tableName':_0x145a('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x546d=['define','openchannel_queues','lodash','../../config/logger','request-promise','path','../../config/environment','./openchannelQueue.attributes','exports'];(function(_0x7d26e5,_0x30970a){var _0x4cf5d7=function(_0x28854b){while(--_0x28854b){_0x7d26e5['push'](_0x7d26e5['shift']());}};_0x4cf5d7(++_0x30970a);}(_0x546d,0xda));var _0xd546=function(_0x166b8e,_0xd78e16){_0x166b8e=_0x166b8e-0x0;var _0x4fc88f=_0x546d[_0x166b8e];return _0x4fc88f;};'use strict';var _=require(_0xd546('0x0'));var util=require('util');var logger=require(_0xd546('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd546('0x2'));var fs=require('fs');var path=require(_0xd546('0x3'));var rimraf=require('rimraf');var config=require(_0xd546('0x4'));var attributes=require(_0xd546('0x5'));module[_0xd546('0x6')]=function(_0x456c52,_0x2f372f){return _0x456c52[_0xd546('0x7')]('OpenchannelQueue',attributes,{'tableName':_0xd546('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.rpc.js b/server/api/openchannelQueue/openchannelQueue.rpc.js index 9ddc168..173673d 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 _0xc04b=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','register','request','then','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','OpenchannelQueue,\x20%s,\x20%s','message','info','result','findAll','options','raw','where','attributes','limit','map','include','model','GetOpenchannelQueue','ShowOpenchannelQueue','OpenchannelQueue','find','catch','lodash','moment','bluebird','randomstring'];(function(_0x5400a1,_0x2275aa){var _0x4006c7=function(_0x5002dc){while(--_0x5002dc){_0x5400a1['push'](_0x5400a1['shift']());}};_0x4006c7(++_0x2275aa);}(_0xc04b,0x1bf));var _0xbc04=function(_0x52e299,_0x2b6073){_0x52e299=_0x52e299-0x0;var _0x2bda80=_0xc04b[_0x52e299];return _0x2bda80;};'use strict';var _=require(_0xbc04('0x0'));var util=require('util');var moment=require(_0xbc04('0x1'));var BPromise=require(_0xbc04('0x2'));var rs=require(_0xbc04('0x3'));var fs=require('fs');var Redis=require(_0xbc04('0x4'));var db=require(_0xbc04('0x5'))['db'];var utils=require(_0xbc04('0x6'));var logger=require(_0xbc04('0x7'))(_0xbc04('0x8'));var config=require(_0xbc04('0x9'));var jayson=require(_0xbc04('0xa'));var client=jayson['client'][_0xbc04('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0xbc04('0xc')],{'host':_0xbc04('0xd'),'port':0x18eb});var socket=require(_0xbc04('0xe'))(new Redis(config[_0xbc04('0xc')]));require('./openchannelQueue.socket')[_0xbc04('0xf')](socket);function respondWithRpcPromise(_0xbf00b3,_0x19e602,_0x2548ec){return new BPromise(function(_0x3e828e,_0x448e31){return client[_0xbc04('0x10')](_0xbf00b3,_0x2548ec)[_0xbc04('0x11')](function(_0x29eff0){logger['info']('OpenchannelQueue,\x20%s,\x20%s',_0x19e602,'request\x20sent');logger[_0xbc04('0x12')](_0xbc04('0x13'),_0x19e602,_0xbc04('0x14'),JSON[_0xbc04('0x15')](_0x29eff0));if(_0x29eff0[_0xbc04('0x16')]){if(_0x29eff0['error']['code']===0x1f4){logger['error'](_0xbc04('0x17'),_0x19e602,_0x29eff0[_0xbc04('0x16')][_0xbc04('0x18')]);return _0x448e31(_0x29eff0[_0xbc04('0x16')]['message']);}logger[_0xbc04('0x16')](_0xbc04('0x17'),_0x19e602,_0x29eff0[_0xbc04('0x16')][_0xbc04('0x18')]);return _0x3e828e(_0x29eff0[_0xbc04('0x16')]['message']);}else{logger[_0xbc04('0x19')](_0xbc04('0x17'),_0x19e602,'request\x20sent');_0x3e828e(_0x29eff0[_0xbc04('0x1a')][_0xbc04('0x18')]);}})['catch'](function(_0x451f8c){logger[_0xbc04('0x16')](_0xbc04('0x17'),_0x19e602,_0x451f8c);_0x448e31(_0x451f8c);});});}exports['GetOpenchannelQueue']=function(_0x400248){var _0x46b736=this;return new Promise(function(_0x15519c,_0x11bc20){return db['OpenchannelQueue'][_0xbc04('0x1b')]({'raw':_0x400248[_0xbc04('0x1c')]?_0x400248[_0xbc04('0x1c')][_0xbc04('0x1d')]===undefined?!![]:![]:!![],'where':_0x400248[_0xbc04('0x1c')]?_0x400248['options'][_0xbc04('0x1e')]||null:null,'attributes':_0x400248[_0xbc04('0x1c')]?_0x400248[_0xbc04('0x1c')][_0xbc04('0x1f')]||null:null,'limit':_0x400248[_0xbc04('0x1c')]?_0x400248['options'][_0xbc04('0x20')]||null:null,'include':_0x400248['options']?_0x400248['options']['include']?_[_0xbc04('0x21')](_0x400248[_0xbc04('0x1c')][_0xbc04('0x22')],function(_0x375906){return{'model':db[_0x375906[_0xbc04('0x23')]],'as':_0x375906['as'],'attributes':_0x375906[_0xbc04('0x1f')],'include':_0x375906['include']?_[_0xbc04('0x21')](_0x375906[_0xbc04('0x22')],function(_0x4b59fb){return{'model':db[_0x4b59fb[_0xbc04('0x23')]],'as':_0x4b59fb['as'],'attributes':_0x4b59fb[_0xbc04('0x1f')],'include':_0x4b59fb[_0xbc04('0x22')]?_['map'](_0x4b59fb[_0xbc04('0x22')],function(_0x5ad565){return{'model':db[_0x5ad565['model']],'as':_0x5ad565['as'],'attributes':_0x5ad565['attributes']};}):[]};}):[]};}):[]:[]})[_0xbc04('0x11')](function(_0x5120fd){logger[_0xbc04('0x19')](_0xbc04('0x24'),_0x400248);logger[_0xbc04('0x12')](_0xbc04('0x24'),_0x400248,JSON[_0xbc04('0x15')](_0x5120fd));_0x15519c(_0x5120fd);})['catch'](function(_0x101e8c){logger[_0xbc04('0x16')](_0xbc04('0x24'),_0x101e8c['message'],_0x400248);_0x11bc20(_0x46b736[_0xbc04('0x16')](0x1f4,_0x101e8c[_0xbc04('0x18')]));});});};exports[_0xbc04('0x25')]=function(_0x3b05cb){var _0x10e8fd=this;return new Promise(function(_0x1f1d9c,_0x3c24ac){return db[_0xbc04('0x26')][_0xbc04('0x27')]({'raw':_0x3b05cb[_0xbc04('0x1c')]?_0x3b05cb[_0xbc04('0x1c')][_0xbc04('0x1d')]===undefined?!![]:![]:!![],'where':_0x3b05cb[_0xbc04('0x1c')]?_0x3b05cb[_0xbc04('0x1c')][_0xbc04('0x1e')]||null:null,'attributes':_0x3b05cb[_0xbc04('0x1c')]?_0x3b05cb['options'][_0xbc04('0x1f')]||null:null,'include':_0x3b05cb[_0xbc04('0x1c')]?_0x3b05cb['options']['include']?_[_0xbc04('0x21')](_0x3b05cb[_0xbc04('0x1c')]['include'],function(_0x5e74b8){return{'model':db[_0x5e74b8[_0xbc04('0x23')]],'as':_0x5e74b8['as'],'attributes':_0x5e74b8['attributes'],'include':_0x5e74b8['include']?_['map'](_0x5e74b8[_0xbc04('0x22')],function(_0x100568){return{'model':db[_0x100568[_0xbc04('0x23')]],'as':_0x100568['as'],'attributes':_0x100568[_0xbc04('0x1f')],'include':_0x100568['include']?_[_0xbc04('0x21')](_0x100568['include'],function(_0x3c9c27){return{'model':db[_0x3c9c27['model']],'as':_0x3c9c27['as'],'attributes':_0x3c9c27[_0xbc04('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xbc04('0x11')](function(_0x3cc4ca){logger['info']('ShowOpenchannelQueue',_0x3b05cb);logger[_0xbc04('0x12')](_0xbc04('0x25'),_0x3b05cb,JSON['stringify'](_0x3cc4ca));_0x1f1d9c(_0x3cc4ca);})[_0xbc04('0x28')](function(_0x51abce){logger[_0xbc04('0x16')]('ShowOpenchannelQueue',_0x51abce[_0xbc04('0x18')],_0x3b05cb);_0x3c24ac(_0x10e8fd[_0xbc04('0x16')](0x1f4,_0x51abce['message']));});});}; \ No newline at end of file +var _0xdeec=['OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','attributes','include','map','model','ShowOpenchannelQueue','where','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','./openchannelQueue.socket','register','request','then','info'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0xdeec,0xd7));var _0xcdee=function(_0x5a7c7d,_0x1628e9){_0x5a7c7d=_0x5a7c7d-0x0;var _0x11461f=_0xdeec[_0x5a7c7d];return _0x11461f;};'use strict';var _=require(_0xcdee('0x0'));var util=require(_0xcdee('0x1'));var moment=require(_0xcdee('0x2'));var BPromise=require(_0xcdee('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcdee('0x4'));var db=require(_0xcdee('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xcdee('0x6'))(_0xcdee('0x7'));var config=require('../../config/environment');var jayson=require(_0xcdee('0x8'));var client=jayson[_0xcdee('0x9')][_0xcdee('0xa')]({'port':0x232a});config[_0xcdee('0xb')]=_[_0xcdee('0xc')](config[_0xcdee('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xcdee('0xd'))(new Redis(config[_0xcdee('0xb')]));require(_0xcdee('0xe'))[_0xcdee('0xf')](socket);function respondWithRpcPromise(_0x34861d,_0xde3bc9,_0x4e8159){return new BPromise(function(_0x4bc767,_0x3f00b3){return client[_0xcdee('0x10')](_0x34861d,_0x4e8159)[_0xcdee('0x11')](function(_0xa2407c){logger[_0xcdee('0x12')](_0xcdee('0x13'),_0xde3bc9,_0xcdee('0x14'));logger[_0xcdee('0x15')]('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0xde3bc9,_0xcdee('0x14'),JSON[_0xcdee('0x16')](_0xa2407c));if(_0xa2407c['error']){if(_0xa2407c['error'][_0xcdee('0x17')]===0x1f4){logger[_0xcdee('0x18')](_0xcdee('0x13'),_0xde3bc9,_0xa2407c[_0xcdee('0x18')]['message']);return _0x3f00b3(_0xa2407c[_0xcdee('0x18')][_0xcdee('0x19')]);}logger['error'](_0xcdee('0x13'),_0xde3bc9,_0xa2407c['error'][_0xcdee('0x19')]);return _0x4bc767(_0xa2407c[_0xcdee('0x18')][_0xcdee('0x19')]);}else{logger[_0xcdee('0x12')](_0xcdee('0x13'),_0xde3bc9,_0xcdee('0x14'));_0x4bc767(_0xa2407c[_0xcdee('0x1a')][_0xcdee('0x19')]);}})[_0xcdee('0x1b')](function(_0x3203e8){logger[_0xcdee('0x18')](_0xcdee('0x13'),_0xde3bc9,_0x3203e8);_0x3f00b3(_0x3203e8);});});}exports[_0xcdee('0x1c')]=function(_0x59b663){var _0x5de563=this;return new Promise(function(_0x5cedbe,_0x47dea2){return db[_0xcdee('0x1d')][_0xcdee('0x1e')]({'raw':_0x59b663[_0xcdee('0x1f')]?_0x59b663['options'][_0xcdee('0x20')]===undefined?!![]:![]:!![],'where':_0x59b663['options']?_0x59b663[_0xcdee('0x1f')]['where']||null:null,'attributes':_0x59b663['options']?_0x59b663[_0xcdee('0x1f')][_0xcdee('0x21')]||null:null,'limit':_0x59b663[_0xcdee('0x1f')]?_0x59b663['options']['limit']||null:null,'include':_0x59b663[_0xcdee('0x1f')]?_0x59b663[_0xcdee('0x1f')][_0xcdee('0x22')]?_[_0xcdee('0x23')](_0x59b663['options']['include'],function(_0x432251){return{'model':db[_0x432251[_0xcdee('0x24')]],'as':_0x432251['as'],'attributes':_0x432251[_0xcdee('0x21')],'include':_0x432251[_0xcdee('0x22')]?_[_0xcdee('0x23')](_0x432251[_0xcdee('0x22')],function(_0x4f1da2){return{'model':db[_0x4f1da2[_0xcdee('0x24')]],'as':_0x4f1da2['as'],'attributes':_0x4f1da2[_0xcdee('0x21')],'include':_0x4f1da2[_0xcdee('0x22')]?_[_0xcdee('0x23')](_0x4f1da2[_0xcdee('0x22')],function(_0xb0984b){return{'model':db[_0xb0984b[_0xcdee('0x24')]],'as':_0xb0984b['as'],'attributes':_0xb0984b[_0xcdee('0x21')]};}):[]};}):[]};}):[]:[]})[_0xcdee('0x11')](function(_0x49f6c0){logger[_0xcdee('0x12')](_0xcdee('0x1c'),_0x59b663);logger[_0xcdee('0x15')](_0xcdee('0x1c'),_0x59b663,JSON[_0xcdee('0x16')](_0x49f6c0));_0x5cedbe(_0x49f6c0);})[_0xcdee('0x1b')](function(_0x5becbb){logger[_0xcdee('0x18')](_0xcdee('0x1c'),_0x5becbb['message'],_0x59b663);_0x47dea2(_0x5de563[_0xcdee('0x18')](0x1f4,_0x5becbb[_0xcdee('0x19')]));});});};exports[_0xcdee('0x25')]=function(_0x22072b){var _0x789443=this;return new Promise(function(_0x4a9390,_0x542796){return db['OpenchannelQueue']['find']({'raw':_0x22072b[_0xcdee('0x1f')]?_0x22072b[_0xcdee('0x1f')][_0xcdee('0x20')]===undefined?!![]:![]:!![],'where':_0x22072b[_0xcdee('0x1f')]?_0x22072b[_0xcdee('0x1f')][_0xcdee('0x26')]||null:null,'attributes':_0x22072b[_0xcdee('0x1f')]?_0x22072b[_0xcdee('0x1f')][_0xcdee('0x21')]||null:null,'include':_0x22072b['options']?_0x22072b['options'][_0xcdee('0x22')]?_[_0xcdee('0x23')](_0x22072b[_0xcdee('0x1f')]['include'],function(_0x553b9e){return{'model':db[_0x553b9e[_0xcdee('0x24')]],'as':_0x553b9e['as'],'attributes':_0x553b9e['attributes'],'include':_0x553b9e[_0xcdee('0x22')]?_[_0xcdee('0x23')](_0x553b9e[_0xcdee('0x22')],function(_0x320dfb){return{'model':db[_0x320dfb[_0xcdee('0x24')]],'as':_0x320dfb['as'],'attributes':_0x320dfb['attributes'],'include':_0x320dfb[_0xcdee('0x22')]?_['map'](_0x320dfb[_0xcdee('0x22')],function(_0x529937){return{'model':db[_0x529937['model']],'as':_0x529937['as'],'attributes':_0x529937[_0xcdee('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1e0c32){logger[_0xcdee('0x12')](_0xcdee('0x25'),_0x22072b);logger[_0xcdee('0x15')](_0xcdee('0x25'),_0x22072b,JSON[_0xcdee('0x16')](_0x1e0c32));_0x4a9390(_0x1e0c32);})[_0xcdee('0x1b')](function(_0x515428){logger[_0xcdee('0x18')](_0xcdee('0x25'),_0x515428[_0xcdee('0x19')],_0x22072b);_0x542796(_0x789443[_0xcdee('0x18')](0x1f4,_0x515428[_0xcdee('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index f51079a..54ccfac 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 _0xc710=['emit','removeListener','register','length','openchannelQueue:','./openchannelQueue.events','remove'];(function(_0x368ad9,_0x12f7f9){var _0x13cf87=function(_0x457b62){while(--_0x457b62){_0x368ad9['push'](_0x368ad9['shift']());}};_0x13cf87(++_0x12f7f9);}(_0xc710,0x163));var _0x0c71=function(_0x5ce501,_0x1e773e){_0x5ce501=_0x5ce501-0x0;var _0x21a447=_0xc710[_0x5ce501];return _0x21a447;};'use strict';var OpenchannelQueueEvents=require(_0x0c71('0x0'));var events=['save',_0x0c71('0x1'),'update'];function createListener(_0x234571,_0x51f647){return function(_0x3a87e0){_0x51f647[_0x0c71('0x2')](_0x234571,_0x3a87e0);};}function removeListener(_0x140498,_0x294a28){return function(){OpenchannelQueueEvents[_0x0c71('0x3')](_0x140498,_0x294a28);};}exports[_0x0c71('0x4')]=function(_0x4e295a){for(var _0x19d30b=0x0,_0xe8eedc=events[_0x0c71('0x5')];_0x19d30b<_0xe8eedc;_0x19d30b++){var _0x5e44b3=events[_0x19d30b];var _0x52c58a=createListener(_0x0c71('0x6')+_0x5e44b3,_0x4e295a);OpenchannelQueueEvents['on'](_0x5e44b3,_0x52c58a);}}; \ No newline at end of file +var _0x5215=['register','openchannelQueue:','emit'];(function(_0x5db349,_0x4e57cb){var _0x5a4d42=function(_0x3a93f7){while(--_0x3a93f7){_0x5db349['push'](_0x5db349['shift']());}};_0x5a4d42(++_0x4e57cb);}(_0x5215,0x1c7));var _0x5521=function(_0x4cbd79,_0x231cd9){_0x4cbd79=_0x4cbd79-0x0;var _0x57eb7d=_0x5215[_0x4cbd79];return _0x57eb7d;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=['save','remove','update'];function createListener(_0x27660c,_0x30be9f){return function(_0x48e76f){_0x30be9f[_0x5521('0x0')](_0x27660c,_0x48e76f);};}function removeListener(_0x453038,_0x35be9f){return function(){OpenchannelQueueEvents['removeListener'](_0x453038,_0x35be9f);};}exports[_0x5521('0x1')]=function(_0x45809e){for(var _0x5b59ab=0x0,_0x53b02b=events['length'];_0x5b59ab<_0x53b02b;_0x5b59ab++){var _0x2d1bb6=events[_0x5b59ab];var _0x542e97=createListener(_0x5521('0x2')+_0x2d1bb6,_0x45809e);OpenchannelQueueEvents['on'](_0x2d1bb6,_0x542e97);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index d068345..1a68fd0 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 _0x07d4=['../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','isAuthenticated','get','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','express','Router'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x07d4,0x1f4));var _0x407d=function(_0xd0c4d9,_0x3d556c){_0xd0c4d9=_0xd0c4d9-0x0;var _0x589970=_0x07d4[_0xd0c4d9];return _0x589970;};'use strict';var multer=require(_0x407d('0x0'));var util=require(_0x407d('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x407d('0x2'));var router=express[_0x407d('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x407d('0x4'));var config=require(_0x407d('0x5'));var controller=require(_0x407d('0x6'));router['get']('/',auth[_0x407d('0x7')](),controller['index']);router[_0x407d('0x8')]('/describe',auth[_0x407d('0x7')](),controller['describe']);router[_0x407d('0x8')](_0x407d('0x9'),auth['isAuthenticated'](),controller[_0x407d('0xa')]);router[_0x407d('0xb')]('/',auth[_0x407d('0x7')](),controller[_0x407d('0xc')]);router[_0x407d('0xd')]('/:id',auth[_0x407d('0x7')](),controller[_0x407d('0xe')]);router[_0x407d('0xf')](_0x407d('0x9'),auth[_0x407d('0x7')](),controller[_0x407d('0x10')]);module[_0x407d('0x11')]=router; \ No newline at end of file +var _0x6a97=['../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','post','create','put','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service'];(function(_0x18e24e,_0x12c97f){var _0x4442d9=function(_0x1f47a6){while(--_0x1f47a6){_0x18e24e['push'](_0x18e24e['shift']());}};_0x4442d9(++_0x12c97f);}(_0x6a97,0x13d));var _0x76a9=function(_0x1fc18b,_0x13d27d){_0x1fc18b=_0x1fc18b-0x0;var _0x16a351=_0x6a97[_0x1fc18b];return _0x16a351;};'use strict';var multer=require(_0x76a9('0x0'));var util=require(_0x76a9('0x1'));var path=require(_0x76a9('0x2'));var timeout=require('connect-timeout');var express=require(_0x76a9('0x3'));var router=express[_0x76a9('0x4')]();var fs_extra=require(_0x76a9('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x76a9('0x6'));var config=require(_0x76a9('0x7'));var controller=require('./openchannelQueueReport.controller');router[_0x76a9('0x8')]('/',auth[_0x76a9('0x9')](),controller['index']);router[_0x76a9('0x8')](_0x76a9('0xa'),auth[_0x76a9('0x9')](),controller[_0x76a9('0xb')]);router[_0x76a9('0x8')](_0x76a9('0xc'),auth[_0x76a9('0x9')](),controller[_0x76a9('0xd')]);router[_0x76a9('0xe')]('/',auth[_0x76a9('0x9')](),controller[_0x76a9('0xf')]);router[_0x76a9('0x10')](_0x76a9('0xc'),auth[_0x76a9('0x9')](),controller['update']);router['delete'](_0x76a9('0xc'),auth[_0x76a9('0x9')](),controller['destroy']);module[_0x76a9('0x11')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 08bf0e2..0382980 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 _0x41c5=['DATE','moment','sequelize','exports','STRING'];(function(_0x1f4ace,_0x14b9c8){var _0x8e0adc=function(_0x5bacd2){while(--_0x5bacd2){_0x1f4ace['push'](_0x1f4ace['shift']());}};_0x8e0adc(++_0x14b9c8);}(_0x41c5,0x146));var _0x541c=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x41c5[_0x40a045];return _0x1a687c;};'use strict';var moment=require(_0x541c('0x0'));var Sequelize=require(_0x541c('0x1'));module[_0x541c('0x2')]={'uniqueid':{'type':Sequelize[_0x541c('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x541c('0x4')]},'leaveAt':{'type':Sequelize[_0x541c('0x4')]},'acceptAt':{'type':Sequelize[_0x541c('0x4')]},'exitAt':{'type':Sequelize[_0x541c('0x4')]},'reason':{'type':Sequelize[_0x541c('0x3')]}}; \ No newline at end of file +var _0xbe25=['sequelize','exports','STRING','moment'];(function(_0x2f430a,_0x46d370){var _0x10def3=function(_0x347eaa){while(--_0x347eaa){_0x2f430a['push'](_0x2f430a['shift']());}};_0x10def3(++_0x46d370);}(_0xbe25,0x1ab));var _0x5be2=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xbe25[_0x20a584];return _0x4b41a8;};'use strict';var moment=require(_0x5be2('0x0'));var Sequelize=require(_0x5be2('0x1'));module[_0x5be2('0x2')]={'uniqueid':{'type':Sequelize[_0x5be2('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x5be2('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x5be2('0x3')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index ae42bf5..7e3f8d1 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 _0xfd46=['intersection','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','OpenchannelQueueReport','includeAll','include','findAll','rows','show','fields','find','create','body','catch','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','undefined','offset','count','limit','status','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','model','keys','query','filters'];(function(_0x5678b5,_0x1c4aa8){var _0x4c09a5=function(_0x2aa89a){while(--_0x2aa89a){_0x5678b5['push'](_0x5678b5['shift']());}};_0x4c09a5(++_0x1c4aa8);}(_0xfd46,0x161));var _0x6fd4=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0xfd46[_0x8c43de];return _0xa6591b;};'use strict';var emlformat=require(_0x6fd4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6fd4('0x1'));var jsonpatch=require(_0x6fd4('0x2'));var rp=require(_0x6fd4('0x3'));var moment=require(_0x6fd4('0x4'));var BPromise=require(_0x6fd4('0x5'));var Mustache=require(_0x6fd4('0x6'));var util=require(_0x6fd4('0x7'));var path=require('path');var sox=require(_0x6fd4('0x8'));var csv=require(_0x6fd4('0x9'));var ejs=require(_0x6fd4('0xa'));var fs=require('fs');var fs_extra=require(_0x6fd4('0xb'));var _=require(_0x6fd4('0xc'));var squel=require(_0x6fd4('0xd'));var crypto=require('crypto');var jsforce=require(_0x6fd4('0xe'));var deskjs=require(_0x6fd4('0xf'));var toCsv=require('to-csv');var querystring=require(_0x6fd4('0x10'));var Papa=require(_0x6fd4('0x11'));var Redis=require(_0x6fd4('0x12'));var authService=require(_0x6fd4('0x13'));var qs=require(_0x6fd4('0x14'));var as=require(_0x6fd4('0x15'));var hardwareService=require(_0x6fd4('0x16'));var logger=require(_0x6fd4('0x17'))(_0x6fd4('0x18'));var utils=require(_0x6fd4('0x19'));var config=require(_0x6fd4('0x1a'));var licenseUtil=require(_0x6fd4('0x1b'));var db=require(_0x6fd4('0x1c'))['db'];function respondWithStatusCode(_0x5a28d3,_0x36d6bf){_0x36d6bf=_0x36d6bf||0xcc;return function(_0x58e79c){if(_0x58e79c){return _0x5a28d3[_0x6fd4('0x1d')](_0x36d6bf);}return _0x5a28d3['status'](_0x36d6bf)[_0x6fd4('0x1e')]();};}function respondWithResult(_0x21cc03,_0x2c729e){_0x2c729e=_0x2c729e||0xc8;return function(_0x1024bc){if(_0x1024bc){return _0x21cc03['status'](_0x2c729e)['json'](_0x1024bc);}};}function respondWithFilteredResult(_0x1acc07,_0x4f702e){return function(_0xeb80cc){if(_0xeb80cc){var _0x42627e=typeof _0x4f702e['offset']===_0x6fd4('0x1f')&&typeof _0x4f702e['limit']==='undefined';var _0x423966=_0xeb80cc['count'];var _0x1e4d45=_0x42627e?0x0:_0x4f702e[_0x6fd4('0x20')];var _0x326366=_0x42627e?_0xeb80cc[_0x6fd4('0x21')]:_0x4f702e['offset']+_0x4f702e[_0x6fd4('0x22')];var _0xdf92b0;if(_0x326366>=_0x423966){_0x326366=_0x423966;_0xdf92b0=0xc8;}else{_0xdf92b0=0xce;}_0x1acc07[_0x6fd4('0x23')](_0xdf92b0);return _0x1acc07[_0x6fd4('0x24')](_0x6fd4('0x25'),_0x1e4d45+'-'+_0x326366+'/'+_0x423966)[_0x6fd4('0x26')](_0xeb80cc);}return null;};}function patchUpdates(_0x48bf0e){return function(_0x4008ac){try{jsonpatch[_0x6fd4('0x27')](_0x4008ac,_0x48bf0e,!![]);}catch(_0x5d49d3){return BPromise[_0x6fd4('0x28')](_0x5d49d3);}return _0x4008ac[_0x6fd4('0x29')]();};}function saveUpdates(_0x156a6a,_0x1c2d14){return function(_0x544740){if(_0x544740){return _0x544740[_0x6fd4('0x2a')](_0x156a6a)[_0x6fd4('0x2b')](function(_0x10b18e){return _0x10b18e;});}return null;};}function removeEntity(_0x3edb2b,_0x21b471){return function(_0x15f65a){if(_0x15f65a){return _0x15f65a[_0x6fd4('0x2c')]()[_0x6fd4('0x2b')](function(){_0x3edb2b[_0x6fd4('0x23')](0xcc)[_0x6fd4('0x1e')]();});}};}function handleEntityNotFound(_0x278820,_0x3b8693){return function(_0x2d1a60){if(!_0x2d1a60){_0x278820[_0x6fd4('0x1d')](0x194);}return _0x2d1a60;};}function handleError(_0x202bdf,_0x30fe06){_0x30fe06=_0x30fe06||0x1f4;return function(_0x37e85d){logger[_0x6fd4('0x2d')](_0x37e85d[_0x6fd4('0x2e')]);if(_0x37e85d[_0x6fd4('0x2f')]){delete _0x37e85d[_0x6fd4('0x2f')];}_0x202bdf[_0x6fd4('0x23')](_0x30fe06)[_0x6fd4('0x30')](_0x37e85d);};}exports['index']=function(_0x38ad0a,_0x2c85e4){var _0x3ca676={},_0x1779be={},_0x43c650={'count':0x0,'rows':[]};var _0x261f45=_[_0x6fd4('0x31')](db['OpenchannelQueueReport'][_0x6fd4('0x32')],function(_0x7cbe81){return{'name':_0x7cbe81[_0x6fd4('0x33')],'type':_0x7cbe81[_0x6fd4('0x34')]['key']};});_0x1779be[_0x6fd4('0x35')]=_[_0x6fd4('0x31')](_0x261f45,_0x6fd4('0x2f'));_0x1779be['query']=_[_0x6fd4('0x36')](_0x38ad0a[_0x6fd4('0x37')]);_0x1779be[_0x6fd4('0x38')]=_[_0x6fd4('0x39')](_0x1779be[_0x6fd4('0x35')],_0x1779be[_0x6fd4('0x37')]);_0x3ca676[_0x6fd4('0x3a')]=_[_0x6fd4('0x39')](_0x1779be['model'],qs['fields'](_0x38ad0a[_0x6fd4('0x37')]['fields']));_0x3ca676[_0x6fd4('0x3a')]=_0x3ca676[_0x6fd4('0x3a')][_0x6fd4('0x3b')]?_0x3ca676[_0x6fd4('0x3a')]:_0x1779be[_0x6fd4('0x35')];if(!_0x38ad0a[_0x6fd4('0x37')][_0x6fd4('0x3c')]('nolimit')){_0x3ca676[_0x6fd4('0x22')]=qs[_0x6fd4('0x22')](_0x38ad0a['query'][_0x6fd4('0x22')]);_0x3ca676[_0x6fd4('0x20')]=qs[_0x6fd4('0x20')](_0x38ad0a[_0x6fd4('0x37')][_0x6fd4('0x20')]);}_0x3ca676[_0x6fd4('0x3d')]=qs[_0x6fd4('0x3e')](_0x38ad0a[_0x6fd4('0x37')][_0x6fd4('0x3e')]);_0x3ca676[_0x6fd4('0x3f')]=qs['filters'](_[_0x6fd4('0x40')](_0x38ad0a['query'],_0x1779be[_0x6fd4('0x38')]),_0x261f45);if(_0x38ad0a['query'][_0x6fd4('0x41')]){_0x3ca676['where']=_[_0x6fd4('0x42')](_0x3ca676[_0x6fd4('0x3f')],{'$or':_[_0x6fd4('0x31')](_0x261f45,function(_0x59bce6){if(_0x59bce6[_0x6fd4('0x34')]!==_0x6fd4('0x43')){var _0x57ea5b={};_0x57ea5b[_0x59bce6[_0x6fd4('0x2f')]]={'$like':'%'+_0x38ad0a[_0x6fd4('0x37')][_0x6fd4('0x41')]+'%'};return _0x57ea5b;}})});}_0x3ca676=_[_0x6fd4('0x42')]({},_0x3ca676,_0x38ad0a[_0x6fd4('0x44')]);var _0x42c281={'where':_0x3ca676[_0x6fd4('0x3f')]};return db[_0x6fd4('0x45')][_0x6fd4('0x21')](_0x42c281)[_0x6fd4('0x2b')](function(_0x30dcc9){_0x43c650[_0x6fd4('0x21')]=_0x30dcc9;if(_0x38ad0a[_0x6fd4('0x37')][_0x6fd4('0x46')]){_0x3ca676[_0x6fd4('0x47')]=[{'all':!![]}];}return db[_0x6fd4('0x45')][_0x6fd4('0x48')](_0x3ca676);})['then'](function(_0x473899){_0x43c650[_0x6fd4('0x49')]=_0x473899;return _0x43c650;})[_0x6fd4('0x2b')](respondWithFilteredResult(_0x2c85e4,_0x3ca676))['catch'](handleError(_0x2c85e4,null));};exports[_0x6fd4('0x4a')]=function(_0x180e74,_0x24a701){var _0x148e41={'raw':!![],'where':{'id':_0x180e74['params']['id']}},_0x34a38c={};_0x34a38c[_0x6fd4('0x35')]=_['keys'](db[_0x6fd4('0x45')]['rawAttributes']);_0x34a38c['query']=_[_0x6fd4('0x36')](_0x180e74[_0x6fd4('0x37')]);_0x34a38c['filters']=_[_0x6fd4('0x39')](_0x34a38c[_0x6fd4('0x35')],_0x34a38c[_0x6fd4('0x37')]);_0x148e41[_0x6fd4('0x3a')]=_[_0x6fd4('0x39')](_0x34a38c[_0x6fd4('0x35')],qs['fields'](_0x180e74[_0x6fd4('0x37')][_0x6fd4('0x4b')]));_0x148e41[_0x6fd4('0x3a')]=_0x148e41[_0x6fd4('0x3a')][_0x6fd4('0x3b')]?_0x148e41[_0x6fd4('0x3a')]:_0x34a38c[_0x6fd4('0x35')];if(_0x180e74[_0x6fd4('0x37')][_0x6fd4('0x46')]){_0x148e41[_0x6fd4('0x47')]=[{'all':!![]}];}_0x148e41=_[_0x6fd4('0x42')]({},_0x148e41,_0x180e74[_0x6fd4('0x44')]);return db['OpenchannelQueueReport'][_0x6fd4('0x4c')](_0x148e41)['then'](handleEntityNotFound(_0x24a701,null))['then'](respondWithResult(_0x24a701,null))['catch'](handleError(_0x24a701,null));};exports[_0x6fd4('0x4d')]=function(_0x860ef9,_0xc0755c){return db[_0x6fd4('0x45')][_0x6fd4('0x4d')](_0x860ef9[_0x6fd4('0x4e')],{})['then'](respondWithResult(_0xc0755c,0xc9))[_0x6fd4('0x4f')](handleError(_0xc0755c,null));};exports[_0x6fd4('0x2a')]=function(_0x3532c2,_0x38e935){if(_0x3532c2[_0x6fd4('0x4e')]['id']){delete _0x3532c2['body']['id'];}return db[_0x6fd4('0x45')][_0x6fd4('0x4c')]({'where':{'id':_0x3532c2[_0x6fd4('0x50')]['id']}})[_0x6fd4('0x2b')](handleEntityNotFound(_0x38e935,null))[_0x6fd4('0x2b')](saveUpdates(_0x3532c2[_0x6fd4('0x4e')],null))['then'](respondWithResult(_0x38e935,null))[_0x6fd4('0x4f')](handleError(_0x38e935,null));};exports[_0x6fd4('0x2c')]=function(_0x1a69f7,_0x396426){return db['OpenchannelQueueReport'][_0x6fd4('0x4c')]({'where':{'id':_0x1a69f7[_0x6fd4('0x50')]['id']}})[_0x6fd4('0x2b')](handleEntityNotFound(_0x396426,null))[_0x6fd4('0x2b')](removeEntity(_0x396426,null))[_0x6fd4('0x4f')](handleError(_0x396426,null));};exports[_0x6fd4('0x51')]=function(_0x15f43c,_0x21e5e8){return db[_0x6fd4('0x45')][_0x6fd4('0x51')]()['then'](respondWithResult(_0x21e5e8,null))['catch'](handleError(_0x21e5e8,null));}; \ No newline at end of file +var _0xb38f=['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/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','error','stack','name','send','map','OpenchannelQueueReport','rawAttributes','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','ejs'];(function(_0x4f267a,_0x4d3149){var _0x3eafdf=function(_0x36ed16){while(--_0x36ed16){_0x4f267a['push'](_0x4f267a['shift']());}};_0x3eafdf(++_0x4d3149);}(_0xb38f,0x13e));var _0xfb38=function(_0x1ec8f9,_0x22f5e7){_0x1ec8f9=_0x1ec8f9-0x0;var _0x17cd3d=_0xb38f[_0x1ec8f9];return _0x17cd3d;};'use strict';var emlformat=require(_0xfb38('0x0'));var rimraf=require(_0xfb38('0x1'));var zipdir=require(_0xfb38('0x2'));var jsonpatch=require(_0xfb38('0x3'));var rp=require('request-promise');var moment=require(_0xfb38('0x4'));var BPromise=require(_0xfb38('0x5'));var Mustache=require('mustache');var util=require(_0xfb38('0x6'));var path=require(_0xfb38('0x7'));var sox=require(_0xfb38('0x8'));var csv=require('to-csv');var ejs=require(_0xfb38('0x9'));var fs=require('fs');var fs_extra=require(_0xfb38('0xa'));var _=require(_0xfb38('0xb'));var squel=require(_0xfb38('0xc'));var crypto=require(_0xfb38('0xd'));var jsforce=require(_0xfb38('0xe'));var deskjs=require(_0xfb38('0xf'));var toCsv=require(_0xfb38('0x10'));var querystring=require(_0xfb38('0x11'));var Papa=require(_0xfb38('0x12'));var Redis=require(_0xfb38('0x13'));var authService=require(_0xfb38('0x14'));var qs=require(_0xfb38('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfb38('0x16'));var logger=require(_0xfb38('0x17'))(_0xfb38('0x18'));var utils=require(_0xfb38('0x19'));var config=require(_0xfb38('0x1a'));var licenseUtil=require(_0xfb38('0x1b'));var db=require(_0xfb38('0x1c'))['db'];function respondWithStatusCode(_0x3582a4,_0x5521e3){_0x5521e3=_0x5521e3||0xcc;return function(_0x5eb666){if(_0x5eb666){return _0x3582a4[_0xfb38('0x1d')](_0x5521e3);}return _0x3582a4[_0xfb38('0x1e')](_0x5521e3)[_0xfb38('0x1f')]();};}function respondWithResult(_0x56934b,_0x2b3096){_0x2b3096=_0x2b3096||0xc8;return function(_0x30e674){if(_0x30e674){return _0x56934b[_0xfb38('0x1e')](_0x2b3096)[_0xfb38('0x20')](_0x30e674);}};}function respondWithFilteredResult(_0x5465bc,_0x96a36c){return function(_0x3f9d86){if(_0x3f9d86){var _0x3e7275=typeof _0x96a36c[_0xfb38('0x21')]===_0xfb38('0x22')&&typeof _0x96a36c['limit']==='undefined';var _0x56ae35=_0x3f9d86[_0xfb38('0x23')];var _0x4de4f7=_0x3e7275?0x0:_0x96a36c[_0xfb38('0x21')];var _0x32e0a4=_0x3e7275?_0x3f9d86['count']:_0x96a36c[_0xfb38('0x21')]+_0x96a36c[_0xfb38('0x24')];var _0x55ab92;if(_0x32e0a4>=_0x56ae35){_0x32e0a4=_0x56ae35;_0x55ab92=0xc8;}else{_0x55ab92=0xce;}_0x5465bc[_0xfb38('0x1e')](_0x55ab92);return _0x5465bc[_0xfb38('0x25')](_0xfb38('0x26'),_0x4de4f7+'-'+_0x32e0a4+'/'+_0x56ae35)[_0xfb38('0x20')](_0x3f9d86);}return null;};}function patchUpdates(_0x128367){return function(_0x4cb304){try{jsonpatch[_0xfb38('0x27')](_0x4cb304,_0x128367,!![]);}catch(_0x6b026c){return BPromise[_0xfb38('0x28')](_0x6b026c);}return _0x4cb304['save']();};}function saveUpdates(_0x278dfa,_0x439ee5){return function(_0x90528e){if(_0x90528e){return _0x90528e[_0xfb38('0x29')](_0x278dfa)[_0xfb38('0x2a')](function(_0x50147c){return _0x50147c;});}return null;};}function removeEntity(_0x6dffa8,_0x40aaa9){return function(_0x1f13e4){if(_0x1f13e4){return _0x1f13e4['destroy']()[_0xfb38('0x2a')](function(){_0x6dffa8[_0xfb38('0x1e')](0xcc)[_0xfb38('0x1f')]();});}};}function handleEntityNotFound(_0x3162b6,_0x300d98){return function(_0x2aa394){if(!_0x2aa394){_0x3162b6[_0xfb38('0x1d')](0x194);}return _0x2aa394;};}function handleError(_0x180301,_0x20dd36){_0x20dd36=_0x20dd36||0x1f4;return function(_0x16d6e7){logger[_0xfb38('0x2b')](_0x16d6e7[_0xfb38('0x2c')]);if(_0x16d6e7['name']){delete _0x16d6e7[_0xfb38('0x2d')];}_0x180301[_0xfb38('0x1e')](_0x20dd36)[_0xfb38('0x2e')](_0x16d6e7);};}exports['index']=function(_0x414be2,_0x2054ff){var _0x2a7128={},_0x32780f={},_0x6e1274={'count':0x0,'rows':[]};var _0x14b882=_[_0xfb38('0x2f')](db[_0xfb38('0x30')][_0xfb38('0x31')],function(_0x31585b){return{'name':_0x31585b['fieldName'],'type':_0x31585b['type'][_0xfb38('0x32')]};});_0x32780f[_0xfb38('0x33')]=_[_0xfb38('0x2f')](_0x14b882,'name');_0x32780f[_0xfb38('0x34')]=_[_0xfb38('0x35')](_0x414be2[_0xfb38('0x34')]);_0x32780f['filters']=_[_0xfb38('0x36')](_0x32780f[_0xfb38('0x33')],_0x32780f[_0xfb38('0x34')]);_0x2a7128['attributes']=_[_0xfb38('0x36')](_0x32780f[_0xfb38('0x33')],qs[_0xfb38('0x37')](_0x414be2[_0xfb38('0x34')][_0xfb38('0x37')]));_0x2a7128[_0xfb38('0x38')]=_0x2a7128[_0xfb38('0x38')][_0xfb38('0x39')]?_0x2a7128[_0xfb38('0x38')]:_0x32780f[_0xfb38('0x33')];if(!_0x414be2['query'][_0xfb38('0x3a')](_0xfb38('0x3b'))){_0x2a7128['limit']=qs[_0xfb38('0x24')](_0x414be2['query'][_0xfb38('0x24')]);_0x2a7128['offset']=qs[_0xfb38('0x21')](_0x414be2[_0xfb38('0x34')]['offset']);}_0x2a7128[_0xfb38('0x3c')]=qs[_0xfb38('0x3d')](_0x414be2[_0xfb38('0x34')][_0xfb38('0x3d')]);_0x2a7128[_0xfb38('0x3e')]=qs['filters'](_[_0xfb38('0x3f')](_0x414be2[_0xfb38('0x34')],_0x32780f[_0xfb38('0x40')]),_0x14b882);if(_0x414be2[_0xfb38('0x34')][_0xfb38('0x41')]){_0x2a7128[_0xfb38('0x3e')]=_[_0xfb38('0x42')](_0x2a7128[_0xfb38('0x3e')],{'$or':_[_0xfb38('0x2f')](_0x14b882,function(_0x151525){if(_0x151525[_0xfb38('0x43')]!==_0xfb38('0x44')){var _0x1794fb={};_0x1794fb[_0x151525[_0xfb38('0x2d')]]={'$like':'%'+_0x414be2[_0xfb38('0x34')]['filter']+'%'};return _0x1794fb;}})});}_0x2a7128=_['merge']({},_0x2a7128,_0x414be2[_0xfb38('0x45')]);var _0x1483b9={'where':_0x2a7128[_0xfb38('0x3e')]};return db[_0xfb38('0x30')][_0xfb38('0x23')](_0x1483b9)[_0xfb38('0x2a')](function(_0x5e0ac8){_0x6e1274[_0xfb38('0x23')]=_0x5e0ac8;if(_0x414be2[_0xfb38('0x34')][_0xfb38('0x46')]){_0x2a7128[_0xfb38('0x47')]=[{'all':!![]}];}return db['OpenchannelQueueReport'][_0xfb38('0x48')](_0x2a7128);})['then'](function(_0x253f4a){_0x6e1274[_0xfb38('0x49')]=_0x253f4a;return _0x6e1274;})[_0xfb38('0x2a')](respondWithFilteredResult(_0x2054ff,_0x2a7128))[_0xfb38('0x4a')](handleError(_0x2054ff,null));};exports[_0xfb38('0x4b')]=function(_0x4ef79c,_0x533e46){var _0x1b1940={'raw':!![],'where':{'id':_0x4ef79c[_0xfb38('0x4c')]['id']}},_0x39af4a={};_0x39af4a[_0xfb38('0x33')]=_[_0xfb38('0x35')](db[_0xfb38('0x30')][_0xfb38('0x31')]);_0x39af4a['query']=_['keys'](_0x4ef79c['query']);_0x39af4a[_0xfb38('0x40')]=_['intersection'](_0x39af4a[_0xfb38('0x33')],_0x39af4a['query']);_0x1b1940[_0xfb38('0x38')]=_[_0xfb38('0x36')](_0x39af4a[_0xfb38('0x33')],qs['fields'](_0x4ef79c[_0xfb38('0x34')][_0xfb38('0x37')]));_0x1b1940[_0xfb38('0x38')]=_0x1b1940['attributes'][_0xfb38('0x39')]?_0x1b1940[_0xfb38('0x38')]:_0x39af4a['model'];if(_0x4ef79c['query']['includeAll']){_0x1b1940[_0xfb38('0x47')]=[{'all':!![]}];}_0x1b1940=_[_0xfb38('0x42')]({},_0x1b1940,_0x4ef79c['options']);return db['OpenchannelQueueReport'][_0xfb38('0x4d')](_0x1b1940)[_0xfb38('0x2a')](handleEntityNotFound(_0x533e46,null))['then'](respondWithResult(_0x533e46,null))['catch'](handleError(_0x533e46,null));};exports[_0xfb38('0x4e')]=function(_0x4360da,_0x1a6dc4){return db[_0xfb38('0x30')][_0xfb38('0x4e')](_0x4360da[_0xfb38('0x4f')],{})[_0xfb38('0x2a')](respondWithResult(_0x1a6dc4,0xc9))[_0xfb38('0x4a')](handleError(_0x1a6dc4,null));};exports[_0xfb38('0x29')]=function(_0x1e9f00,_0x502ebc){if(_0x1e9f00[_0xfb38('0x4f')]['id']){delete _0x1e9f00[_0xfb38('0x4f')]['id'];}return db['OpenchannelQueueReport'][_0xfb38('0x4d')]({'where':{'id':_0x1e9f00[_0xfb38('0x4c')]['id']}})[_0xfb38('0x2a')](handleEntityNotFound(_0x502ebc,null))[_0xfb38('0x2a')](saveUpdates(_0x1e9f00[_0xfb38('0x4f')],null))[_0xfb38('0x2a')](respondWithResult(_0x502ebc,null))[_0xfb38('0x4a')](handleError(_0x502ebc,null));};exports[_0xfb38('0x50')]=function(_0x37cb06,_0x4034ad){return db['OpenchannelQueueReport'][_0xfb38('0x4d')]({'where':{'id':_0x37cb06[_0xfb38('0x4c')]['id']}})[_0xfb38('0x2a')](handleEntityNotFound(_0x4034ad,null))[_0xfb38('0x2a')](removeEntity(_0x4034ad,null))[_0xfb38('0x4a')](handleError(_0x4034ad,null));};exports[_0xfb38('0x51')]=function(_0x76e8a2,_0x430c5c){return db[_0xfb38('0x30')][_0xfb38('0x51')]()[_0xfb38('0x2a')](respondWithResult(_0x430c5c,null))['catch'](handleError(_0x430c5c,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index d833019..b589266 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 _0xe14b=['bluebird','path','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','lodash','util','moment'];(function(_0x3c283d,_0x257db4){var _0x532c2a=function(_0x41a3ca){while(--_0x41a3ca){_0x3c283d['push'](_0x3c283d['shift']());}};_0x532c2a(++_0x257db4);}(_0xe14b,0x93));var _0xbe14=function(_0x466fe9,_0x5d6dbb){_0x466fe9=_0x466fe9-0x0;var _0x2cbc6b=_0xe14b[_0x466fe9];return _0x2cbc6b;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbe14('0x2'));var BPromise=require(_0xbe14('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe14('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbe14('0x5'));module[_0xbe14('0x6')]=function(_0x1fe204,_0x1ff100){return _0x1fe204[_0xbe14('0x7')](_0xbe14('0x8'),attributes,{'tableName':_0xbe14('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x326f=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash'];(function(_0x47e99d,_0x469344){var _0x449051=function(_0x2e8fbe){while(--_0x2e8fbe){_0x47e99d['push'](_0x47e99d['shift']());}};_0x449051(++_0x469344);}(_0x326f,0xd1));var _0xf326=function(_0x1b73de,_0x482ff3){_0x1b73de=_0x1b73de-0x0;var _0x14befb=_0x326f[_0x1b73de];return _0x14befb;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf326('0x1'));var moment=require(_0xf326('0x2'));var BPromise=require(_0xf326('0x3'));var rp=require(_0xf326('0x4'));var fs=require('fs');var path=require(_0xf326('0x5'));var rimraf=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var attributes=require(_0xf326('0x8'));module[_0xf326('0x9')]=function(_0x3ace29,_0x4c2249){return _0x3ace29[_0xf326('0xa')](_0xf326('0xb'),attributes,{'tableName':_0xf326('0xc'),'paranoid':![],'indexes':[{'name':_0xf326('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 318421b..4bc56cc 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 _0x8f59=['raw','where','attributes','limit','UpdateOpenchannelQueueReport','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','error','message','result','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','then','debug','stringify','catch','update'];(function(_0x52c684,_0xd0c7b1){var _0x49ece6=function(_0x25092e){while(--_0x25092e){_0x52c684['push'](_0x52c684['shift']());}};_0x49ece6(++_0xd0c7b1);}(_0x8f59,0x11d));var _0x98f5=function(_0x2f0057,_0x448b27){_0x2f0057=_0x2f0057-0x0;var _0x17f2c3=_0x8f59[_0x2f0057];return _0x17f2c3;};'use strict';var _=require(_0x98f5('0x0'));var util=require(_0x98f5('0x1'));var moment=require(_0x98f5('0x2'));var BPromise=require(_0x98f5('0x3'));var rs=require(_0x98f5('0x4'));var fs=require('fs');var Redis=require(_0x98f5('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x98f5('0x6'));var logger=require(_0x98f5('0x7'))(_0x98f5('0x8'));var config=require(_0x98f5('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x98f5('0xa')][_0x98f5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2e2acf,_0x5869ee,_0x5e91b3){return new BPromise(function(_0x109417,_0x1cd8a8){return client[_0x98f5('0xc')](_0x2e2acf,_0x5e91b3)['then'](function(_0x456329){logger[_0x98f5('0xd')](_0x98f5('0xe'),_0x5869ee,_0x98f5('0xf'));logger['debug'](_0x98f5('0x10'),_0x5869ee,'request\x20sent',JSON['stringify'](_0x456329));if(_0x456329[_0x98f5('0x11')]){if(_0x456329[_0x98f5('0x11')]['code']===0x1f4){logger[_0x98f5('0x11')](_0x98f5('0xe'),_0x5869ee,_0x456329[_0x98f5('0x11')][_0x98f5('0x12')]);return _0x1cd8a8(_0x456329[_0x98f5('0x11')][_0x98f5('0x12')]);}logger['error'](_0x98f5('0xe'),_0x5869ee,_0x456329[_0x98f5('0x11')]['message']);return _0x109417(_0x456329[_0x98f5('0x11')][_0x98f5('0x12')]);}else{logger[_0x98f5('0xd')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x5869ee,_0x98f5('0xf'));_0x109417(_0x456329[_0x98f5('0x13')][_0x98f5('0x12')]);}})['catch'](function(_0x440cfa){logger[_0x98f5('0x11')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x5869ee,_0x440cfa);_0x1cd8a8(_0x440cfa);});});}exports[_0x98f5('0x14')]=function(_0x51a567){var _0x10c57c=this;return new Promise(function(_0x9e42dd,_0x2291d5){return db[_0x98f5('0x15')][_0x98f5('0x16')](_0x51a567[_0x98f5('0x17')],{'raw':_0x51a567['options']?_0x51a567[_0x98f5('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x98f5('0x19')](function(_0x191f23){logger['info'](_0x98f5('0x14'),_0x51a567);logger[_0x98f5('0x1a')](_0x98f5('0x14'),_0x51a567,JSON[_0x98f5('0x1b')](_0x191f23));_0x9e42dd(_0x191f23);})[_0x98f5('0x1c')](function(_0x3dc7c2){logger[_0x98f5('0x11')]('CreateOpenchannelQueueReport',_0x3dc7c2[_0x98f5('0x12')],_0x51a567);_0x2291d5(_0x10c57c['error'](0x1f4,_0x3dc7c2[_0x98f5('0x12')]));});});};exports['UpdateOpenchannelQueueReport']=function(_0x44bfbb){var _0x40c69b=this;return new Promise(function(_0x106b24,_0x5c64e){return db[_0x98f5('0x15')][_0x98f5('0x1d')](_0x44bfbb[_0x98f5('0x17')],{'raw':_0x44bfbb['options']?_0x44bfbb[_0x98f5('0x18')][_0x98f5('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x44bfbb['options']?_0x44bfbb[_0x98f5('0x18')][_0x98f5('0x1f')]||null:null,'attributes':_0x44bfbb[_0x98f5('0x18')]?_0x44bfbb[_0x98f5('0x18')][_0x98f5('0x20')]||null:null,'limit':_0x44bfbb[_0x98f5('0x18')]?_0x44bfbb[_0x98f5('0x18')][_0x98f5('0x21')]||null:null})['then'](function(_0x4c10b8){logger[_0x98f5('0xd')](_0x98f5('0x22'),_0x44bfbb);logger[_0x98f5('0x1a')](_0x98f5('0x22'),_0x44bfbb,JSON[_0x98f5('0x1b')](_0x4c10b8));_0x106b24(_0x4c10b8);})[_0x98f5('0x1c')](function(_0x5e9d73){logger[_0x98f5('0x11')](_0x98f5('0x22'),_0x5e9d73[_0x98f5('0x12')],_0x44bfbb);_0x5c64e(_0x40c69b[_0x98f5('0x11')](0x1f4,_0x5e9d73[_0x98f5('0x12')]));});});}; \ No newline at end of file +var _0xd070=['catch','create','options','CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','update','body','where','attributes','limit','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result'];(function(_0x54b82a,_0xa88a0b){var _0x20a5f2=function(_0x30d121){while(--_0x30d121){_0x54b82a['push'](_0x54b82a['shift']());}};_0x20a5f2(++_0xa88a0b);}(_0xd070,0x8e));var _0x0d07=function(_0x4480a0,_0x34513f){_0x4480a0=_0x4480a0-0x0;var _0x30de73=_0xd070[_0x4480a0];return _0x30de73;};'use strict';var _=require(_0x0d07('0x0'));var util=require('util');var moment=require(_0x0d07('0x1'));var BPromise=require(_0x0d07('0x2'));var rs=require(_0x0d07('0x3'));var fs=require('fs');var Redis=require(_0x0d07('0x4'));var db=require(_0x0d07('0x5'))['db'];var utils=require(_0x0d07('0x6'));var logger=require(_0x0d07('0x7'))(_0x0d07('0x8'));var config=require(_0x0d07('0x9'));var jayson=require(_0x0d07('0xa'));var client=jayson[_0x0d07('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x13d75a,_0x5a4366,_0x20fd56){return new BPromise(function(_0x8c16d8,_0x1f989e){return client[_0x0d07('0xc')](_0x13d75a,_0x20fd56)[_0x0d07('0xd')](function(_0xc5b04d){logger[_0x0d07('0xe')](_0x0d07('0xf'),_0x5a4366,_0x0d07('0x10'));logger[_0x0d07('0x11')]('OpenchannelQueueReport,\x20%s,\x20%s,\x20%s',_0x5a4366,'request\x20sent',JSON[_0x0d07('0x12')](_0xc5b04d));if(_0xc5b04d[_0x0d07('0x13')]){if(_0xc5b04d['error'][_0x0d07('0x14')]===0x1f4){logger['error'](_0x0d07('0xf'),_0x5a4366,_0xc5b04d[_0x0d07('0x13')]['message']);return _0x1f989e(_0xc5b04d[_0x0d07('0x13')][_0x0d07('0x15')]);}logger[_0x0d07('0x13')](_0x0d07('0xf'),_0x5a4366,_0xc5b04d[_0x0d07('0x13')][_0x0d07('0x15')]);return _0x8c16d8(_0xc5b04d['error'][_0x0d07('0x15')]);}else{logger['info']('OpenchannelQueueReport,\x20%s,\x20%s',_0x5a4366,_0x0d07('0x10'));_0x8c16d8(_0xc5b04d[_0x0d07('0x16')][_0x0d07('0x15')]);}})[_0x0d07('0x17')](function(_0x220203){logger['error']('OpenchannelQueueReport,\x20%s,\x20%s',_0x5a4366,_0x220203);_0x1f989e(_0x220203);});});}exports['CreateOpenchannelQueueReport']=function(_0x187df2){var _0x312015=this;return new Promise(function(_0x52cb4b,_0x410ad2){return db['OpenchannelQueueReport'][_0x0d07('0x18')](_0x187df2['body'],{'raw':_0x187df2['options']?_0x187df2[_0x0d07('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x0d07('0xd')](function(_0x54790f){logger[_0x0d07('0xe')]('CreateOpenchannelQueueReport',_0x187df2);logger['debug'](_0x0d07('0x1a'),_0x187df2,JSON[_0x0d07('0x12')](_0x54790f));_0x52cb4b(_0x54790f);})[_0x0d07('0x17')](function(_0x57e997){logger[_0x0d07('0x13')]('CreateOpenchannelQueueReport',_0x57e997['message'],_0x187df2);_0x410ad2(_0x312015[_0x0d07('0x13')](0x1f4,_0x57e997[_0x0d07('0x15')]));});});};exports[_0x0d07('0x1b')]=function(_0x19f82f){var _0x4e0c97=this;return new Promise(function(_0x5898db,_0x9d9bfd){return db['OpenchannelQueueReport'][_0x0d07('0x1c')](_0x19f82f[_0x0d07('0x1d')],{'raw':_0x19f82f['options']?_0x19f82f[_0x0d07('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x19f82f['options']?_0x19f82f['options'][_0x0d07('0x1e')]||null:null,'attributes':_0x19f82f[_0x0d07('0x19')]?_0x19f82f[_0x0d07('0x19')][_0x0d07('0x1f')]||null:null,'limit':_0x19f82f[_0x0d07('0x19')]?_0x19f82f[_0x0d07('0x19')][_0x0d07('0x20')]||null:null})[_0x0d07('0xd')](function(_0x4c68d7){logger['info'](_0x0d07('0x1b'),_0x19f82f);logger[_0x0d07('0x11')](_0x0d07('0x1b'),_0x19f82f,JSON[_0x0d07('0x12')](_0x4c68d7));_0x5898db(_0x4c68d7);})[_0x0d07('0x17')](function(_0xb7d4d){logger[_0x0d07('0x13')](_0x0d07('0x1b'),_0xb7d4d[_0x0d07('0x15')],_0x19f82f);_0x9d9bfd(_0x4e0c97[_0x0d07('0x13')](0x1f4,_0xb7d4d[_0x0d07('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index cc108b4..7d85d47 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 _0x8d2a=['/:id','show','create','update','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','index','/describe'];(function(_0x1c0f41,_0x26d95d){var _0x369a9f=function(_0x251234){while(--_0x251234){_0x1c0f41['push'](_0x1c0f41['shift']());}};_0x369a9f(++_0x26d95d);}(_0x8d2a,0xf0));var _0xa8d2=function(_0x3695b1,_0x120fc7){_0x3695b1=_0x3695b1-0x0;var _0x1f8b0a=_0x8d2a[_0x3695b1];return _0x1f8b0a;};'use strict';var multer=require(_0xa8d2('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xa8d2('0x1'));var express=require(_0xa8d2('0x2'));var router=express[_0xa8d2('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xa8d2('0x4'));var interaction=require(_0xa8d2('0x5'));var config=require(_0xa8d2('0x6'));var controller=require(_0xa8d2('0x7'));router[_0xa8d2('0x8')]('/',auth[_0xa8d2('0x9')](),controller[_0xa8d2('0xa')]);router[_0xa8d2('0x8')](_0xa8d2('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0xa8d2('0x8')](_0xa8d2('0xc'),auth['isAuthenticated'](),controller[_0xa8d2('0xd')]);router['post']('/',auth[_0xa8d2('0x9')](),controller[_0xa8d2('0xe')]);router['put'](_0xa8d2('0xc'),auth['isAuthenticated'](),controller[_0xa8d2('0xf')]);router['delete'](_0xa8d2('0xc'),auth[_0xa8d2('0x9')](),controller[_0xa8d2('0x10')]);module[_0xa8d2('0x11')]=router; \ No newline at end of file +var _0x2c65=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show','post','create','put','update','delete','/:id','multer'];(function(_0x1aab74,_0x38a57b){var _0x396af2=function(_0x1c2e0d){while(--_0x1c2e0d){_0x1aab74['push'](_0x1aab74['shift']());}};_0x396af2(++_0x38a57b);}(_0x2c65,0x11c));var _0x52c6=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x2c65[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0x52c6('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x52c6('0x1'));var express=require('express');var router=express[_0x52c6('0x2')]();var fs_extra=require(_0x52c6('0x3'));var auth=require(_0x52c6('0x4'));var interaction=require(_0x52c6('0x5'));var config=require(_0x52c6('0x6'));var controller=require('./openchannelTransferReport.controller');router[_0x52c6('0x7')]('/',auth[_0x52c6('0x8')](),controller[_0x52c6('0x9')]);router[_0x52c6('0x7')](_0x52c6('0xa'),auth['isAuthenticated'](),controller[_0x52c6('0xb')]);router['get']('/:id',auth[_0x52c6('0x8')](),controller[_0x52c6('0xc')]);router[_0x52c6('0xd')]('/',auth[_0x52c6('0x8')](),controller[_0x52c6('0xe')]);router[_0x52c6('0xf')]('/:id',auth[_0x52c6('0x8')](),controller[_0x52c6('0x10')]);router[_0x52c6('0x11')](_0x52c6('0x12'),auth[_0x52c6('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index ef1ca7a..244460a 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 _0x34e8=['queue','DATE','NOW','moment','sequelize','exports','STRING','account','agent'];(function(_0x122481,_0x4ab9ec){var _0x8f8026=function(_0x146f26){while(--_0x146f26){_0x122481['push'](_0x122481['shift']());}};_0x8f8026(++_0x4ab9ec);}(_0x34e8,0x12c));var _0x834e=function(_0x2fd60,_0x3f6c60){_0x2fd60=_0x2fd60-0x0;var _0x197000=_0x34e8[_0x2fd60];return _0x197000;};'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 +var _0xcb91=['STRING','ENUM','account','queue','NOW','exports'];(function(_0x47aaae,_0x44b14c){var _0x3a087b=function(_0x3914be){while(--_0x3914be){_0x47aaae['push'](_0x47aaae['shift']());}};_0x3a087b(++_0x44b14c);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x946518,_0x22816f){_0x946518=_0x946518-0x0;var _0x909b69=_0xcb91[_0x946518];return _0x909b69;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x1cb9('0x0')]={'uniqueid':{'type':Sequelize[_0x1cb9('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x1cb9('0x2')](_0x1cb9('0x3'),'agent',_0x1cb9('0x4')),'allowNull':![],'defaultValue':_0x1cb9('0x4')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x1cb9('0x5')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index d47c302..1cdd216 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 _0xc23f=['filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','filter','OpenchannelTransferReport','findAll','catch','show','params','includeAll','include','options','find','create','body','update','describe','eml-format','rimraf','bluebird','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','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','offset','undefined','limit','count','status','set','Content-Range','json','apply','reject','save','then','destroy','error','stack','name','send','index','rawAttributes','fieldName','type','key','map','keys','query'];(function(_0x11b64b,_0x3938ec){var _0x26ab80=function(_0x1d80a4){while(--_0x1d80a4){_0x11b64b['push'](_0x11b64b['shift']());}};_0x26ab80(++_0x3938ec);}(_0xc23f,0x1e8));var _0xfc23=function(_0x16f8a7,_0x59c3db){_0x16f8a7=_0x16f8a7-0x0;var _0x31d828=_0xc23f[_0x16f8a7];return _0x31d828;};'use strict';var emlformat=require(_0xfc23('0x0'));var rimraf=require(_0xfc23('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xfc23('0x2'));var Mustache=require('mustache');var util=require(_0xfc23('0x3'));var path=require(_0xfc23('0x4'));var sox=require(_0xfc23('0x5'));var csv=require(_0xfc23('0x6'));var ejs=require(_0xfc23('0x7'));var fs=require('fs');var fs_extra=require(_0xfc23('0x8'));var _=require(_0xfc23('0x9'));var squel=require(_0xfc23('0xa'));var crypto=require('crypto');var jsforce=require(_0xfc23('0xb'));var deskjs=require(_0xfc23('0xc'));var toCsv=require(_0xfc23('0x6'));var querystring=require(_0xfc23('0xd'));var Papa=require(_0xfc23('0xe'));var Redis=require(_0xfc23('0xf'));var authService=require(_0xfc23('0x10'));var qs=require(_0xfc23('0x11'));var as=require(_0xfc23('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xfc23('0x13'));var utils=require(_0xfc23('0x14'));var config=require(_0xfc23('0x15'));var licenseUtil=require(_0xfc23('0x16'));var db=require(_0xfc23('0x17'))['db'];function respondWithStatusCode(_0x358c3b,_0x281c73){_0x281c73=_0x281c73||0xcc;return function(_0x566990){if(_0x566990){return _0x358c3b[_0xfc23('0x18')](_0x281c73);}return _0x358c3b['status'](_0x281c73)[_0xfc23('0x19')]();};}function respondWithResult(_0x2d407b,_0xe25228){_0xe25228=_0xe25228||0xc8;return function(_0x4509ae){if(_0x4509ae){return _0x2d407b['status'](_0xe25228)['json'](_0x4509ae);}};}function respondWithFilteredResult(_0x380e74,_0x9f493f){return function(_0x3da2bd){if(_0x3da2bd){var _0x296c7d=typeof _0x9f493f[_0xfc23('0x1a')]===_0xfc23('0x1b')&&typeof _0x9f493f[_0xfc23('0x1c')]===_0xfc23('0x1b');var _0x1dc973=_0x3da2bd[_0xfc23('0x1d')];var _0x59a2b6=_0x296c7d?0x0:_0x9f493f[_0xfc23('0x1a')];var _0x3c219c=_0x296c7d?_0x3da2bd[_0xfc23('0x1d')]:_0x9f493f[_0xfc23('0x1a')]+_0x9f493f[_0xfc23('0x1c')];var _0x39304b;if(_0x3c219c>=_0x1dc973){_0x3c219c=_0x1dc973;_0x39304b=0xc8;}else{_0x39304b=0xce;}_0x380e74[_0xfc23('0x1e')](_0x39304b);return _0x380e74[_0xfc23('0x1f')](_0xfc23('0x20'),_0x59a2b6+'-'+_0x3c219c+'/'+_0x1dc973)[_0xfc23('0x21')](_0x3da2bd);}return null;};}function patchUpdates(_0x4062b0){return function(_0x164632){try{jsonpatch[_0xfc23('0x22')](_0x164632,_0x4062b0,!![]);}catch(_0xd2d979){return BPromise[_0xfc23('0x23')](_0xd2d979);}return _0x164632[_0xfc23('0x24')]();};}function saveUpdates(_0x1ba65f,_0x3b66f6){return function(_0x3303a8){if(_0x3303a8){return _0x3303a8['update'](_0x1ba65f)[_0xfc23('0x25')](function(_0x3ffbf2){return _0x3ffbf2;});}return null;};}function removeEntity(_0x54bbed,_0x3d7c32){return function(_0x298986){if(_0x298986){return _0x298986[_0xfc23('0x26')]()[_0xfc23('0x25')](function(){_0x54bbed[_0xfc23('0x1e')](0xcc)[_0xfc23('0x19')]();});}};}function handleEntityNotFound(_0x3ac9f8,_0x590089){return function(_0x48bde7){if(!_0x48bde7){_0x3ac9f8['sendStatus'](0x194);}return _0x48bde7;};}function handleError(_0x2a78b2,_0x122917){_0x122917=_0x122917||0x1f4;return function(_0x7358c1){logger[_0xfc23('0x27')](_0x7358c1[_0xfc23('0x28')]);if(_0x7358c1[_0xfc23('0x29')]){delete _0x7358c1['name'];}_0x2a78b2['status'](_0x122917)[_0xfc23('0x2a')](_0x7358c1);};}exports[_0xfc23('0x2b')]=function(_0x7ce40e,_0x267d06){var _0x3be98b={},_0x3d760f={},_0x3f86d9={'count':0x0,'rows':[]};var _0x34c608=_['map'](db['OpenchannelTransferReport'][_0xfc23('0x2c')],function(_0x2d251d){return{'name':_0x2d251d[_0xfc23('0x2d')],'type':_0x2d251d[_0xfc23('0x2e')][_0xfc23('0x2f')]};});_0x3d760f['model']=_[_0xfc23('0x30')](_0x34c608,'name');_0x3d760f['query']=_[_0xfc23('0x31')](_0x7ce40e[_0xfc23('0x32')]);_0x3d760f[_0xfc23('0x33')]=_[_0xfc23('0x34')](_0x3d760f[_0xfc23('0x35')],_0x3d760f[_0xfc23('0x32')]);_0x3be98b[_0xfc23('0x36')]=_[_0xfc23('0x34')](_0x3d760f['model'],qs[_0xfc23('0x37')](_0x7ce40e[_0xfc23('0x32')]['fields']));_0x3be98b[_0xfc23('0x36')]=_0x3be98b['attributes'][_0xfc23('0x38')]?_0x3be98b[_0xfc23('0x36')]:_0x3d760f[_0xfc23('0x35')];if(!_0x7ce40e[_0xfc23('0x32')][_0xfc23('0x39')](_0xfc23('0x3a'))){_0x3be98b[_0xfc23('0x1c')]=qs[_0xfc23('0x1c')](_0x7ce40e[_0xfc23('0x32')]['limit']);_0x3be98b['offset']=qs[_0xfc23('0x1a')](_0x7ce40e[_0xfc23('0x32')][_0xfc23('0x1a')]);}_0x3be98b['order']=qs['sort'](_0x7ce40e[_0xfc23('0x32')][_0xfc23('0x3b')]);_0x3be98b[_0xfc23('0x3c')]=qs[_0xfc23('0x33')](_[_0xfc23('0x3d')](_0x7ce40e['query'],_0x3d760f['filters']),_0x34c608);if(_0x7ce40e[_0xfc23('0x32')]['filter']){_0x3be98b[_0xfc23('0x3c')]=_[_0xfc23('0x3e')](_0x3be98b[_0xfc23('0x3c')],{'$or':_['map'](_0x34c608,function(_0x26d87c){if(_0x26d87c[_0xfc23('0x2e')]!=='VIRTUAL'){var _0x4e6afe={};_0x4e6afe[_0x26d87c[_0xfc23('0x29')]]={'$like':'%'+_0x7ce40e[_0xfc23('0x32')][_0xfc23('0x3f')]+'%'};return _0x4e6afe;}})});}_0x3be98b=_[_0xfc23('0x3e')]({},_0x3be98b,_0x7ce40e['options']);var _0x352798={'where':_0x3be98b['where']};return db[_0xfc23('0x40')]['count'](_0x352798)[_0xfc23('0x25')](function(_0x38c239){_0x3f86d9[_0xfc23('0x1d')]=_0x38c239;if(_0x7ce40e[_0xfc23('0x32')]['includeAll']){_0x3be98b['include']=[{'all':!![]}];}return db['OpenchannelTransferReport'][_0xfc23('0x41')](_0x3be98b);})['then'](function(_0x4a8638){_0x3f86d9['rows']=_0x4a8638;return _0x3f86d9;})['then'](respondWithFilteredResult(_0x267d06,_0x3be98b))[_0xfc23('0x42')](handleError(_0x267d06,null));};exports[_0xfc23('0x43')]=function(_0x131b8d,_0x1d45c4){var _0x1b90df={'raw':!![],'where':{'id':_0x131b8d[_0xfc23('0x44')]['id']}},_0x5ae988={};_0x5ae988['model']=_[_0xfc23('0x31')](db[_0xfc23('0x40')][_0xfc23('0x2c')]);_0x5ae988['query']=_[_0xfc23('0x31')](_0x131b8d[_0xfc23('0x32')]);_0x5ae988[_0xfc23('0x33')]=_['intersection'](_0x5ae988['model'],_0x5ae988[_0xfc23('0x32')]);_0x1b90df['attributes']=_[_0xfc23('0x34')](_0x5ae988[_0xfc23('0x35')],qs['fields'](_0x131b8d[_0xfc23('0x32')][_0xfc23('0x37')]));_0x1b90df['attributes']=_0x1b90df[_0xfc23('0x36')][_0xfc23('0x38')]?_0x1b90df[_0xfc23('0x36')]:_0x5ae988[_0xfc23('0x35')];if(_0x131b8d[_0xfc23('0x32')][_0xfc23('0x45')]){_0x1b90df[_0xfc23('0x46')]=[{'all':!![]}];}_0x1b90df=_[_0xfc23('0x3e')]({},_0x1b90df,_0x131b8d[_0xfc23('0x47')]);return db['OpenchannelTransferReport'][_0xfc23('0x48')](_0x1b90df)['then'](handleEntityNotFound(_0x1d45c4,null))[_0xfc23('0x25')](respondWithResult(_0x1d45c4,null))[_0xfc23('0x42')](handleError(_0x1d45c4,null));};exports[_0xfc23('0x49')]=function(_0x5f363b,_0x431bd9){return db[_0xfc23('0x40')][_0xfc23('0x49')](_0x5f363b[_0xfc23('0x4a')],{})['then'](respondWithResult(_0x431bd9,0xc9))[_0xfc23('0x42')](handleError(_0x431bd9,null));};exports[_0xfc23('0x4b')]=function(_0x58c118,_0x35d55f){if(_0x58c118[_0xfc23('0x4a')]['id']){delete _0x58c118[_0xfc23('0x4a')]['id'];}return db['OpenchannelTransferReport'][_0xfc23('0x48')]({'where':{'id':_0x58c118[_0xfc23('0x44')]['id']}})[_0xfc23('0x25')](handleEntityNotFound(_0x35d55f,null))[_0xfc23('0x25')](saveUpdates(_0x58c118[_0xfc23('0x4a')],null))[_0xfc23('0x25')](respondWithResult(_0x35d55f,null))[_0xfc23('0x42')](handleError(_0x35d55f,null));};exports[_0xfc23('0x26')]=function(_0x57bb01,_0x4a5021){return db[_0xfc23('0x40')][_0xfc23('0x48')]({'where':{'id':_0x57bb01[_0xfc23('0x44')]['id']}})['then'](handleEntityNotFound(_0x4a5021,null))[_0xfc23('0x25')](removeEntity(_0x4a5021,null))[_0xfc23('0x42')](handleError(_0x4a5021,null));};exports[_0xfc23('0x4c')]=function(_0x59dad4,_0x34402d){return db['OpenchannelTransferReport']['describe']()[_0xfc23('0x25')](respondWithResult(_0x34402d,null))[_0xfc23('0x42')](handleError(_0x34402d,null));}; \ No newline at end of file +var _0xfda4=['type','VIRTUAL','options','findAll','catch','show','includeAll','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','stack','name','index','map','OpenchannelTransferReport','rawAttributes','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','filters','pick','where','merge'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xfda4,0x174));var _0x4fda=function(_0x163691,_0x3d10c4){_0x163691=_0x163691-0x0;var _0x543ae5=_0xfda4[_0x163691];return _0x543ae5;};'use strict';var emlformat=require(_0x4fda('0x0'));var rimraf=require(_0x4fda('0x1'));var zipdir=require(_0x4fda('0x2'));var jsonpatch=require(_0x4fda('0x3'));var rp=require(_0x4fda('0x4'));var moment=require(_0x4fda('0x5'));var BPromise=require(_0x4fda('0x6'));var Mustache=require(_0x4fda('0x7'));var util=require('util');var path=require(_0x4fda('0x8'));var sox=require('sox');var csv=require(_0x4fda('0x9'));var ejs=require(_0x4fda('0xa'));var fs=require('fs');var fs_extra=require(_0x4fda('0xb'));var _=require('lodash');var squel=require(_0x4fda('0xc'));var crypto=require('crypto');var jsforce=require(_0x4fda('0xd'));var deskjs=require(_0x4fda('0xe'));var toCsv=require('to-csv');var querystring=require(_0x4fda('0xf'));var Papa=require(_0x4fda('0x10'));var Redis=require(_0x4fda('0x11'));var authService=require(_0x4fda('0x12'));var qs=require(_0x4fda('0x13'));var as=require(_0x4fda('0x14'));var hardwareService=require(_0x4fda('0x15'));var logger=require(_0x4fda('0x16'))(_0x4fda('0x17'));var utils=require('../../config/utils');var config=require(_0x4fda('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x4fda('0x19'))['db'];function respondWithStatusCode(_0x8e5418,_0x414de0){_0x414de0=_0x414de0||0xcc;return function(_0x10044){if(_0x10044){return _0x8e5418[_0x4fda('0x1a')](_0x414de0);}return _0x8e5418[_0x4fda('0x1b')](_0x414de0)[_0x4fda('0x1c')]();};}function respondWithResult(_0x5ecb2a,_0xfa1a46){_0xfa1a46=_0xfa1a46||0xc8;return function(_0x4ec02a){if(_0x4ec02a){return _0x5ecb2a[_0x4fda('0x1b')](_0xfa1a46)[_0x4fda('0x1d')](_0x4ec02a);}};}function respondWithFilteredResult(_0x4733d6,_0x59cfdf){return function(_0xc6f850){if(_0xc6f850){var _0x44777e=typeof _0x59cfdf[_0x4fda('0x1e')]===_0x4fda('0x1f')&&typeof _0x59cfdf[_0x4fda('0x20')]===_0x4fda('0x1f');var _0x2aee8b=_0xc6f850['count'];var _0x5ac3ff=_0x44777e?0x0:_0x59cfdf['offset'];var _0x47837e=_0x44777e?_0xc6f850[_0x4fda('0x21')]:_0x59cfdf[_0x4fda('0x1e')]+_0x59cfdf['limit'];var _0x5dc600;if(_0x47837e>=_0x2aee8b){_0x47837e=_0x2aee8b;_0x5dc600=0xc8;}else{_0x5dc600=0xce;}_0x4733d6[_0x4fda('0x1b')](_0x5dc600);return _0x4733d6[_0x4fda('0x22')]('Content-Range',_0x5ac3ff+'-'+_0x47837e+'/'+_0x2aee8b)[_0x4fda('0x1d')](_0xc6f850);}return null;};}function patchUpdates(_0x37795d){return function(_0x273a60){try{jsonpatch[_0x4fda('0x23')](_0x273a60,_0x37795d,!![]);}catch(_0x523197){return BPromise['reject'](_0x523197);}return _0x273a60[_0x4fda('0x24')]();};}function saveUpdates(_0x4c7416,_0x4249ce){return function(_0x12de79){if(_0x12de79){return _0x12de79[_0x4fda('0x25')](_0x4c7416)[_0x4fda('0x26')](function(_0x409730){return _0x409730;});}return null;};}function removeEntity(_0x105dad,_0x1a4ec7){return function(_0x4c0168){if(_0x4c0168){return _0x4c0168[_0x4fda('0x27')]()[_0x4fda('0x26')](function(){_0x105dad[_0x4fda('0x1b')](0xcc)[_0x4fda('0x1c')]();});}};}function handleEntityNotFound(_0x23ddff,_0x20d556){return function(_0x2ea5f0){if(!_0x2ea5f0){_0x23ddff['sendStatus'](0x194);}return _0x2ea5f0;};}function handleError(_0x474ab3,_0x2acccd){_0x2acccd=_0x2acccd||0x1f4;return function(_0x4701ce){logger['error'](_0x4701ce[_0x4fda('0x28')]);if(_0x4701ce[_0x4fda('0x29')]){delete _0x4701ce[_0x4fda('0x29')];}_0x474ab3[_0x4fda('0x1b')](_0x2acccd)['send'](_0x4701ce);};}exports[_0x4fda('0x2a')]=function(_0x403ad7,_0xa4b325){var _0x122b9b={},_0x446063={},_0x2890d9={'count':0x0,'rows':[]};var _0x29ffb3=_[_0x4fda('0x2b')](db[_0x4fda('0x2c')][_0x4fda('0x2d')],function(_0x531666){return{'name':_0x531666['fieldName'],'type':_0x531666['type'][_0x4fda('0x2e')]};});_0x446063[_0x4fda('0x2f')]=_[_0x4fda('0x2b')](_0x29ffb3,_0x4fda('0x29'));_0x446063[_0x4fda('0x30')]=_[_0x4fda('0x31')](_0x403ad7[_0x4fda('0x30')]);_0x446063['filters']=_[_0x4fda('0x32')](_0x446063[_0x4fda('0x2f')],_0x446063[_0x4fda('0x30')]);_0x122b9b[_0x4fda('0x33')]=_[_0x4fda('0x32')](_0x446063[_0x4fda('0x2f')],qs[_0x4fda('0x34')](_0x403ad7[_0x4fda('0x30')][_0x4fda('0x34')]));_0x122b9b[_0x4fda('0x33')]=_0x122b9b['attributes']['length']?_0x122b9b[_0x4fda('0x33')]:_0x446063[_0x4fda('0x2f')];if(!_0x403ad7[_0x4fda('0x30')][_0x4fda('0x35')]('nolimit')){_0x122b9b['limit']=qs['limit'](_0x403ad7[_0x4fda('0x30')]['limit']);_0x122b9b['offset']=qs[_0x4fda('0x1e')](_0x403ad7[_0x4fda('0x30')][_0x4fda('0x1e')]);}_0x122b9b[_0x4fda('0x36')]=qs[_0x4fda('0x37')](_0x403ad7[_0x4fda('0x30')][_0x4fda('0x37')]);_0x122b9b['where']=qs[_0x4fda('0x38')](_[_0x4fda('0x39')](_0x403ad7[_0x4fda('0x30')],_0x446063[_0x4fda('0x38')]),_0x29ffb3);if(_0x403ad7[_0x4fda('0x30')]['filter']){_0x122b9b[_0x4fda('0x3a')]=_[_0x4fda('0x3b')](_0x122b9b[_0x4fda('0x3a')],{'$or':_[_0x4fda('0x2b')](_0x29ffb3,function(_0x55931a){if(_0x55931a[_0x4fda('0x3c')]!==_0x4fda('0x3d')){var _0x2f32f2={};_0x2f32f2[_0x55931a['name']]={'$like':'%'+_0x403ad7['query']['filter']+'%'};return _0x2f32f2;}})});}_0x122b9b=_['merge']({},_0x122b9b,_0x403ad7[_0x4fda('0x3e')]);var _0x4f7d90={'where':_0x122b9b[_0x4fda('0x3a')]};return db[_0x4fda('0x2c')][_0x4fda('0x21')](_0x4f7d90)[_0x4fda('0x26')](function(_0x3ee265){_0x2890d9[_0x4fda('0x21')]=_0x3ee265;if(_0x403ad7[_0x4fda('0x30')]['includeAll']){_0x122b9b['include']=[{'all':!![]}];}return db[_0x4fda('0x2c')][_0x4fda('0x3f')](_0x122b9b);})[_0x4fda('0x26')](function(_0x2172e8){_0x2890d9['rows']=_0x2172e8;return _0x2890d9;})[_0x4fda('0x26')](respondWithFilteredResult(_0xa4b325,_0x122b9b))[_0x4fda('0x40')](handleError(_0xa4b325,null));};exports[_0x4fda('0x41')]=function(_0x494e39,_0x3eaf06){var _0x1ca1cf={'raw':!![],'where':{'id':_0x494e39['params']['id']}},_0x517e7f={};_0x517e7f['model']=_[_0x4fda('0x31')](db[_0x4fda('0x2c')][_0x4fda('0x2d')]);_0x517e7f['query']=_[_0x4fda('0x31')](_0x494e39[_0x4fda('0x30')]);_0x517e7f[_0x4fda('0x38')]=_[_0x4fda('0x32')](_0x517e7f[_0x4fda('0x2f')],_0x517e7f[_0x4fda('0x30')]);_0x1ca1cf[_0x4fda('0x33')]=_[_0x4fda('0x32')](_0x517e7f['model'],qs['fields'](_0x494e39[_0x4fda('0x30')][_0x4fda('0x34')]));_0x1ca1cf[_0x4fda('0x33')]=_0x1ca1cf[_0x4fda('0x33')]['length']?_0x1ca1cf[_0x4fda('0x33')]:_0x517e7f[_0x4fda('0x2f')];if(_0x494e39[_0x4fda('0x30')][_0x4fda('0x42')]){_0x1ca1cf['include']=[{'all':!![]}];}_0x1ca1cf=_['merge']({},_0x1ca1cf,_0x494e39[_0x4fda('0x3e')]);return db[_0x4fda('0x2c')][_0x4fda('0x43')](_0x1ca1cf)[_0x4fda('0x26')](handleEntityNotFound(_0x3eaf06,null))[_0x4fda('0x26')](respondWithResult(_0x3eaf06,null))[_0x4fda('0x40')](handleError(_0x3eaf06,null));};exports[_0x4fda('0x44')]=function(_0x390d86,_0x1f0854){return db[_0x4fda('0x2c')]['create'](_0x390d86[_0x4fda('0x45')],{})['then'](respondWithResult(_0x1f0854,0xc9))[_0x4fda('0x40')](handleError(_0x1f0854,null));};exports[_0x4fda('0x25')]=function(_0x2d1115,_0x1f3def){if(_0x2d1115[_0x4fda('0x45')]['id']){delete _0x2d1115['body']['id'];}return db[_0x4fda('0x2c')][_0x4fda('0x43')]({'where':{'id':_0x2d1115[_0x4fda('0x46')]['id']}})['then'](handleEntityNotFound(_0x1f3def,null))[_0x4fda('0x26')](saveUpdates(_0x2d1115[_0x4fda('0x45')],null))[_0x4fda('0x26')](respondWithResult(_0x1f3def,null))[_0x4fda('0x40')](handleError(_0x1f3def,null));};exports[_0x4fda('0x27')]=function(_0xd6c60b,_0xd5e704){return db[_0x4fda('0x2c')][_0x4fda('0x43')]({'where':{'id':_0xd6c60b['params']['id']}})[_0x4fda('0x26')](handleEntityNotFound(_0xd5e704,null))['then'](removeEntity(_0xd5e704,null))[_0x4fda('0x40')](handleError(_0xd5e704,null));};exports[_0x4fda('0x47')]=function(_0x43d068,_0xf91266){return db[_0x4fda('0x2c')][_0x4fda('0x47')]()[_0x4fda('0x26')](respondWithResult(_0xf91266,null))[_0x4fda('0x40')](handleError(_0xf91266,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index b56683a..1d58be6 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 _0x88e9=['report_openchannel_transfer','uniqueid','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x4b4023,_0x2e2076){var _0x1eca57=function(_0x38589b){while(--_0x38589b){_0x4b4023['push'](_0x4b4023['shift']());}};_0x1eca57(++_0x2e2076);}(_0x88e9,0x1f1));var _0x988e=function(_0xf1ea49,_0x3b6920){_0xf1ea49=_0xf1ea49-0x0;var _0x183fc8=_0x88e9[_0xf1ea49];return _0x183fc8;};'use strict';var _=require(_0x988e('0x0'));var util=require('util');var logger=require(_0x988e('0x1'))(_0x988e('0x2'));var moment=require('moment');var BPromise=require(_0x988e('0x3'));var rp=require(_0x988e('0x4'));var fs=require('fs');var path=require(_0x988e('0x5'));var rimraf=require(_0x988e('0x6'));var config=require(_0x988e('0x7'));var attributes=require('./openchannelTransferReport.attributes');module[_0x988e('0x8')]=function(_0x5399db,_0xd9ef1a){return _0x5399db['define']('OpenchannelTransferReport',attributes,{'tableName':_0x988e('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x988e('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe5b6=['uniqueid','lodash','../../config/logger','api','moment','bluebird','path','../../config/environment','exports','OpenchannelTransferReport','report_openchannel_transfer'];(function(_0x370c99,_0x266246){var _0x4f0d90=function(_0x156daa){while(--_0x156daa){_0x370c99['push'](_0x370c99['shift']());}};_0x4f0d90(++_0x266246);}(_0xe5b6,0x12a));var _0x6e5b=function(_0x13d959,_0x3ec938){_0x13d959=_0x13d959-0x0;var _0x4296cb=_0xe5b6[_0x13d959];return _0x4296cb;};'use strict';var _=require(_0x6e5b('0x0'));var util=require('util');var logger=require(_0x6e5b('0x1'))(_0x6e5b('0x2'));var moment=require(_0x6e5b('0x3'));var BPromise=require(_0x6e5b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6e5b('0x5'));var rimraf=require('rimraf');var config=require(_0x6e5b('0x6'));var attributes=require('./openchannelTransferReport.attributes');module[_0x6e5b('0x7')]=function(_0x51e30b,_0x5854c2){return _0x51e30b['define'](_0x6e5b('0x8'),attributes,{'tableName':_0x6e5b('0x9'),'paranoid':![],'indexes':[{'name':_0x6e5b('0xa'),'fields':[_0x6e5b('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 4868483..81e80b4 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 _0x3148=['then','info','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','OpenchannelTransferReport,\x20%s,\x20%s','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x526140,_0x406549){var _0x2c6cd6=function(_0x110957){while(--_0x110957){_0x526140['push'](_0x526140['shift']());}};_0x2c6cd6(++_0x406549);}(_0x3148,0x1d3));var _0x8314=function(_0x11c913,_0x1c6f22){_0x11c913=_0x11c913-0x0;var _0x5ba6eb=_0x3148[_0x11c913];return _0x5ba6eb;};'use strict';var _=require(_0x8314('0x0'));var util=require(_0x8314('0x1'));var moment=require('moment');var BPromise=require(_0x8314('0x2'));var rs=require(_0x8314('0x3'));var fs=require('fs');var Redis=require(_0x8314('0x4'));var db=require(_0x8314('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8314('0x6'))(_0x8314('0x7'));var config=require(_0x8314('0x8'));var jayson=require(_0x8314('0x9'));var client=jayson[_0x8314('0xa')][_0x8314('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1bd913,_0x4dd36d,_0x837c1f){return new BPromise(function(_0x4df2b0,_0x35b464){return client[_0x8314('0xc')](_0x1bd913,_0x837c1f)[_0x8314('0xd')](function(_0x357031){logger[_0x8314('0xe')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x4dd36d,'request\x20sent');logger[_0x8314('0xf')](_0x8314('0x10'),_0x4dd36d,_0x8314('0x11'),JSON[_0x8314('0x12')](_0x357031));if(_0x357031['error']){if(_0x357031[_0x8314('0x13')][_0x8314('0x14')]===0x1f4){logger['error'](_0x8314('0x15'),_0x4dd36d,_0x357031['error']['message']);return _0x35b464(_0x357031[_0x8314('0x13')][_0x8314('0x16')]);}logger[_0x8314('0x13')](_0x8314('0x15'),_0x4dd36d,_0x357031['error'][_0x8314('0x16')]);return _0x4df2b0(_0x357031[_0x8314('0x13')][_0x8314('0x16')]);}else{logger[_0x8314('0xe')](_0x8314('0x15'),_0x4dd36d,_0x8314('0x11'));_0x4df2b0(_0x357031['result']['message']);}})[_0x8314('0x17')](function(_0xf0ad31){logger[_0x8314('0x13')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x4dd36d,_0xf0ad31);_0x35b464(_0xf0ad31);});});} \ No newline at end of file +var _0x0bde=['request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0xf7cf9b,_0x1dc1d2){var _0x350a5d=function(_0x37a74e){while(--_0x37a74e){_0xf7cf9b['push'](_0xf7cf9b['shift']());}};_0x350a5d(++_0x1dc1d2);}(_0x0bde,0xe7));var _0xe0bd=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x0bde[_0x122ef9];return _0x42fba0;};'use strict';var _=require('lodash');var util=require(_0xe0bd('0x0'));var moment=require('moment');var BPromise=require(_0xe0bd('0x1'));var rs=require(_0xe0bd('0x2'));var fs=require('fs');var Redis=require(_0xe0bd('0x3'));var db=require(_0xe0bd('0x4'))['db'];var utils=require(_0xe0bd('0x5'));var logger=require('../../config/logger')(_0xe0bd('0x6'));var config=require(_0xe0bd('0x7'));var jayson=require(_0xe0bd('0x8'));var client=jayson[_0xe0bd('0x9')][_0xe0bd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x26393f,_0x217145,_0x491dc7){return new BPromise(function(_0x40b36a,_0x44cb0b){return client[_0xe0bd('0xb')](_0x26393f,_0x491dc7)[_0xe0bd('0xc')](function(_0x393379){logger[_0xe0bd('0xd')](_0xe0bd('0xe'),_0x217145,_0xe0bd('0xf'));logger['debug']('OpenchannelTransferReport,\x20%s,\x20%s,\x20%s',_0x217145,'request\x20sent',JSON[_0xe0bd('0x10')](_0x393379));if(_0x393379['error']){if(_0x393379['error'][_0xe0bd('0x11')]===0x1f4){logger[_0xe0bd('0x12')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x217145,_0x393379[_0xe0bd('0x12')]['message']);return _0x44cb0b(_0x393379[_0xe0bd('0x12')][_0xe0bd('0x13')]);}logger[_0xe0bd('0x12')](_0xe0bd('0xe'),_0x217145,_0x393379[_0xe0bd('0x12')][_0xe0bd('0x13')]);return _0x40b36a(_0x393379[_0xe0bd('0x12')][_0xe0bd('0x13')]);}else{logger['info']('OpenchannelTransferReport,\x20%s,\x20%s',_0x217145,'request\x20sent');_0x40b36a(_0x393379[_0xe0bd('0x14')][_0xe0bd('0x13')]);}})[_0xe0bd('0x15')](function(_0x379ea2){logger[_0xe0bd('0x12')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x217145,_0x379ea2);_0x44cb0b(_0x379ea2);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index f766115..086c513 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 _0xd526=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','get','index','isAuthenticated','post','put','/:id','update'];(function(_0x24cf91,_0x4d6967){var _0x240b64=function(_0x5bfb66){while(--_0x5bfb66){_0x24cf91['push'](_0x24cf91['shift']());}};_0x240b64(++_0x4d6967);}(_0xd526,0xee));var _0x6d52=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xd526[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0x6d52('0x0'));var util=require(_0x6d52('0x1'));var path=require(_0x6d52('0x2'));var timeout=require(_0x6d52('0x3'));var express=require(_0x6d52('0x4'));var router=express[_0x6d52('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x6d52('0x6'));var interaction=require(_0x6d52('0x7'));var config=require(_0x6d52('0x8'));var controller=require(_0x6d52('0x9'));router[_0x6d52('0xa')]('/',auth['isAuthenticated'](),controller[_0x6d52('0xb')]);router['get']('/:id',auth[_0x6d52('0xc')](),controller['show']);router[_0x6d52('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x6d52('0xe')](_0x6d52('0xf'),auth[_0x6d52('0xc')](),controller[_0x6d52('0x10')]);router['delete'](_0x6d52('0xf'),auth[_0x6d52('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x81df=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','post','put','update','delete','exports','multer'];(function(_0x4ba44d,_0x408d9f){var _0x3637eb=function(_0xa01a7c){while(--_0xa01a7c){_0x4ba44d['push'](_0x4ba44d['shift']());}};_0x3637eb(++_0x408d9f);}(_0x81df,0xb3));var _0xf81d=function(_0x3b4932,_0x1daf07){_0x3b4932=_0x3b4932-0x0;var _0x1fac48=_0x81df[_0x3b4932];return _0x1fac48;};'use strict';var multer=require(_0xf81d('0x0'));var util=require(_0xf81d('0x1'));var path=require(_0xf81d('0x2'));var timeout=require(_0xf81d('0x3'));var express=require(_0xf81d('0x4'));var router=express[_0xf81d('0x5')]();var fs_extra=require(_0xf81d('0x6'));var auth=require(_0xf81d('0x7'));var interaction=require(_0xf81d('0x8'));var config=require('../../config/environment');var controller=require('./pause.controller');router[_0xf81d('0x9')]('/',auth[_0xf81d('0xa')](),controller[_0xf81d('0xb')]);router['get'](_0xf81d('0xc'),auth[_0xf81d('0xa')](),controller['show']);router[_0xf81d('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xf81d('0xe')](_0xf81d('0xc'),auth[_0xf81d('0xa')](),controller[_0xf81d('0xf')]);router[_0xf81d('0x10')]('/:id',auth[_0xf81d('0xa')](),controller['destroy']);module[_0xf81d('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 171125d..2526a72 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 _0x4e02=['name','sequelize','STRING'];(function(_0x3db5b7,_0x3e0342){var _0x61516b=function(_0x3a1bcb){while(--_0x3a1bcb){_0x3db5b7['push'](_0x3db5b7['shift']());}};_0x61516b(++_0x3e0342);}(_0x4e02,0x91));var _0x24e0=function(_0x336ca2,_0x1a813a){_0x336ca2=_0x336ca2-0x0;var _0xda59a6=_0x4e02[_0x336ca2];return _0xda59a6;};'use strict';var Sequelize=require(_0x24e0('0x0'));module['exports']={'name':{'type':Sequelize[_0x24e0('0x1')],'unique':_0x24e0('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x24e0('0x1')]}}; \ No newline at end of file +var _0x5caa=['STRING'];(function(_0x32b1c0,_0x2396f){var _0x50bd24=function(_0x2717da){while(--_0x2717da){_0x32b1c0['push'](_0x32b1c0['shift']());}};_0x50bd24(++_0x2396f);}(_0x5caa,0x1e3));var _0xa5ca=function(_0x4f9d26,_0x641341){_0x4f9d26=_0x4f9d26-0x0;var _0x57debc=_0x5caa[_0x4f9d26];return _0x57debc;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xa5ca('0x0')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0xa5ca('0x0')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index fa1af77..349b709 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 _0xef16=['zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','get','UserProfileResource','error','stack','name','send','Pause','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','filter','includeAll','include','rows','show','params','keys','rawAttributes','options','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Pauses','userProfileId','eml-format','rimraf'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0xef16,0x1ea));var _0x6ef1=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0xef16[_0x2b7764];return _0x848dcb;};'use strict';var emlformat=require(_0x6ef1('0x0'));var rimraf=require(_0x6ef1('0x1'));var zipdir=require(_0x6ef1('0x2'));var jsonpatch=require(_0x6ef1('0x3'));var rp=require(_0x6ef1('0x4'));var moment=require(_0x6ef1('0x5'));var BPromise=require(_0x6ef1('0x6'));var Mustache=require('mustache');var util=require(_0x6ef1('0x7'));var path=require(_0x6ef1('0x8'));var sox=require('sox');var csv=require(_0x6ef1('0x9'));var ejs=require(_0x6ef1('0xa'));var fs=require('fs');var fs_extra=require(_0x6ef1('0xb'));var _=require(_0x6ef1('0xc'));var squel=require(_0x6ef1('0xd'));var crypto=require(_0x6ef1('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x6ef1('0xf'));var toCsv=require(_0x6ef1('0x9'));var querystring=require('querystring');var Papa=require(_0x6ef1('0x10'));var Redis=require('ioredis');var authService=require(_0x6ef1('0x11'));var qs=require(_0x6ef1('0x12'));var as=require(_0x6ef1('0x13'));var hardwareService=require(_0x6ef1('0x14'));var logger=require(_0x6ef1('0x15'))('api');var utils=require(_0x6ef1('0x16'));var config=require(_0x6ef1('0x17'));var licenseUtil=require(_0x6ef1('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5ceba6,_0x2ac64d){_0x2ac64d=_0x2ac64d||0xcc;return function(_0x5703fc){if(_0x5703fc){return _0x5ceba6[_0x6ef1('0x19')](_0x2ac64d);}return _0x5ceba6[_0x6ef1('0x1a')](_0x2ac64d)[_0x6ef1('0x1b')]();};}function respondWithResult(_0x5df78e,_0xa3be74){_0xa3be74=_0xa3be74||0xc8;return function(_0x4d0330){if(_0x4d0330){return _0x5df78e[_0x6ef1('0x1a')](_0xa3be74)[_0x6ef1('0x1c')](_0x4d0330);}};}function respondWithFilteredResult(_0x210d5c,_0x36e568){return function(_0xb7a64){if(_0xb7a64){var _0x5040b0=typeof _0x36e568[_0x6ef1('0x1d')]===_0x6ef1('0x1e')&&typeof _0x36e568['limit']===_0x6ef1('0x1e');var _0x1fae46=_0xb7a64[_0x6ef1('0x1f')];var _0x3b36d0=_0x5040b0?0x0:_0x36e568['offset'];var _0x1451cb=_0x5040b0?_0xb7a64[_0x6ef1('0x1f')]:_0x36e568[_0x6ef1('0x1d')]+_0x36e568[_0x6ef1('0x20')];var _0x2abcf6;if(_0x1451cb>=_0x1fae46){_0x1451cb=_0x1fae46;_0x2abcf6=0xc8;}else{_0x2abcf6=0xce;}_0x210d5c['status'](_0x2abcf6);return _0x210d5c[_0x6ef1('0x21')](_0x6ef1('0x22'),_0x3b36d0+'-'+_0x1451cb+'/'+_0x1fae46)[_0x6ef1('0x1c')](_0xb7a64);}return null;};}function patchUpdates(_0xef6559){return function(_0x50463f){try{jsonpatch[_0x6ef1('0x23')](_0x50463f,_0xef6559,!![]);}catch(_0x5a00a1){return BPromise[_0x6ef1('0x24')](_0x5a00a1);}return _0x50463f[_0x6ef1('0x25')]();};}function saveUpdates(_0x3c2fbf,_0x2fb431){return function(_0x20776d){if(_0x20776d){return _0x20776d['update'](_0x3c2fbf)[_0x6ef1('0x26')](function(_0x3d6486){return _0x3d6486;});}return null;};}function removeEntity(_0x5cd11f,_0x3f1c61){return function(_0x34c0e4){if(_0x34c0e4){return _0x34c0e4[_0x6ef1('0x27')]()[_0x6ef1('0x26')](function(){var _0x42dda9=_0x34c0e4[_0x6ef1('0x28')]({'plain':!![]});var _0x2c8547='Pauses';return db[_0x6ef1('0x29')][_0x6ef1('0x27')]({'where':{'type':_0x2c8547,'resourceId':_0x42dda9['id']}})[_0x6ef1('0x26')](function(){return _0x34c0e4;});})[_0x6ef1('0x26')](function(){_0x5cd11f[_0x6ef1('0x1a')](0xcc)[_0x6ef1('0x1b')]();});}};}function handleEntityNotFound(_0xbd7c02,_0x1b6016){return function(_0x219a87){if(!_0x219a87){_0xbd7c02[_0x6ef1('0x19')](0x194);}return _0x219a87;};}function handleError(_0x213a8b,_0x22f2d1){_0x22f2d1=_0x22f2d1||0x1f4;return function(_0x58e711){logger[_0x6ef1('0x2a')](_0x58e711[_0x6ef1('0x2b')]);if(_0x58e711['name']){delete _0x58e711[_0x6ef1('0x2c')];}_0x213a8b[_0x6ef1('0x1a')](_0x22f2d1)[_0x6ef1('0x2d')](_0x58e711);};}exports['index']=function(_0x2264ff,_0x67e92a){var _0x4a5cfa={},_0x52d7f6={},_0x30c79b={'count':0x0,'rows':[]};var _0x1c5aad=_['map'](db[_0x6ef1('0x2e')]['rawAttributes'],function(_0x1f75bb){return{'name':_0x1f75bb[_0x6ef1('0x2f')],'type':_0x1f75bb[_0x6ef1('0x30')][_0x6ef1('0x31')]};});_0x52d7f6[_0x6ef1('0x32')]=_[_0x6ef1('0x33')](_0x1c5aad,'name');_0x52d7f6[_0x6ef1('0x34')]=_['keys'](_0x2264ff['query']);_0x52d7f6[_0x6ef1('0x35')]=_[_0x6ef1('0x36')](_0x52d7f6[_0x6ef1('0x32')],_0x52d7f6[_0x6ef1('0x34')]);_0x4a5cfa[_0x6ef1('0x37')]=_[_0x6ef1('0x36')](_0x52d7f6['model'],qs[_0x6ef1('0x38')](_0x2264ff[_0x6ef1('0x34')][_0x6ef1('0x38')]));_0x4a5cfa[_0x6ef1('0x37')]=_0x4a5cfa[_0x6ef1('0x37')][_0x6ef1('0x39')]?_0x4a5cfa[_0x6ef1('0x37')]:_0x52d7f6['model'];if(!_0x2264ff[_0x6ef1('0x34')][_0x6ef1('0x3a')](_0x6ef1('0x3b'))){_0x4a5cfa['limit']=qs[_0x6ef1('0x20')](_0x2264ff[_0x6ef1('0x34')][_0x6ef1('0x20')]);_0x4a5cfa[_0x6ef1('0x1d')]=qs[_0x6ef1('0x1d')](_0x2264ff[_0x6ef1('0x34')][_0x6ef1('0x1d')]);}_0x4a5cfa[_0x6ef1('0x3c')]=qs[_0x6ef1('0x3d')](_0x2264ff[_0x6ef1('0x34')]['sort']);_0x4a5cfa['where']=qs[_0x6ef1('0x35')](_['pick'](_0x2264ff[_0x6ef1('0x34')],_0x52d7f6[_0x6ef1('0x35')]),_0x1c5aad);if(_0x2264ff['query']['filter']){_0x4a5cfa[_0x6ef1('0x3e')]=_[_0x6ef1('0x3f')](_0x4a5cfa[_0x6ef1('0x3e')],{'$or':_[_0x6ef1('0x33')](_0x1c5aad,function(_0x1956bd){if(_0x1956bd[_0x6ef1('0x30')]!=='VIRTUAL'){var _0x4a50c4={};_0x4a50c4[_0x1956bd[_0x6ef1('0x2c')]]={'$like':'%'+_0x2264ff[_0x6ef1('0x34')][_0x6ef1('0x40')]+'%'};return _0x4a50c4;}})});}_0x4a5cfa=_[_0x6ef1('0x3f')]({},_0x4a5cfa,_0x2264ff['options']);var _0x4a4edb={'where':_0x4a5cfa[_0x6ef1('0x3e')]};return db[_0x6ef1('0x2e')][_0x6ef1('0x1f')](_0x4a4edb)[_0x6ef1('0x26')](function(_0x5ea572){_0x30c79b[_0x6ef1('0x1f')]=_0x5ea572;if(_0x2264ff[_0x6ef1('0x34')][_0x6ef1('0x41')]){_0x4a5cfa[_0x6ef1('0x42')]=[{'all':!![]}];}return db[_0x6ef1('0x2e')]['findAll'](_0x4a5cfa);})['then'](function(_0x4748c3){_0x30c79b[_0x6ef1('0x43')]=_0x4748c3;return _0x30c79b;})[_0x6ef1('0x26')](respondWithFilteredResult(_0x67e92a,_0x4a5cfa))['catch'](handleError(_0x67e92a,null));};exports[_0x6ef1('0x44')]=function(_0x2b4f86,_0x107c96){var _0x1f5c68={'raw':!![],'where':{'id':_0x2b4f86[_0x6ef1('0x45')]['id']}},_0x3d2aee={};_0x3d2aee[_0x6ef1('0x32')]=_[_0x6ef1('0x46')](db[_0x6ef1('0x2e')][_0x6ef1('0x47')]);_0x3d2aee[_0x6ef1('0x34')]=_['keys'](_0x2b4f86[_0x6ef1('0x34')]);_0x3d2aee[_0x6ef1('0x35')]=_[_0x6ef1('0x36')](_0x3d2aee[_0x6ef1('0x32')],_0x3d2aee[_0x6ef1('0x34')]);_0x1f5c68[_0x6ef1('0x37')]=_[_0x6ef1('0x36')](_0x3d2aee['model'],qs[_0x6ef1('0x38')](_0x2b4f86[_0x6ef1('0x34')][_0x6ef1('0x38')]));_0x1f5c68[_0x6ef1('0x37')]=_0x1f5c68[_0x6ef1('0x37')]['length']?_0x1f5c68['attributes']:_0x3d2aee['model'];if(_0x2b4f86[_0x6ef1('0x34')][_0x6ef1('0x41')]){_0x1f5c68[_0x6ef1('0x42')]=[{'all':!![]}];}_0x1f5c68=_[_0x6ef1('0x3f')]({},_0x1f5c68,_0x2b4f86[_0x6ef1('0x48')]);return db[_0x6ef1('0x2e')][_0x6ef1('0x49')](_0x1f5c68)[_0x6ef1('0x26')](handleEntityNotFound(_0x107c96,null))['then'](respondWithResult(_0x107c96,null))[_0x6ef1('0x4a')](handleError(_0x107c96,null));};exports[_0x6ef1('0x4b')]=function(_0x1abee6,_0x7d4774){return db[_0x6ef1('0x2e')][_0x6ef1('0x4b')](_0x1abee6[_0x6ef1('0x4c')],{})['then'](function(_0x4fae80){var _0x32d7fd=_0x1abee6[_0x6ef1('0x4d')][_0x6ef1('0x28')]({'plain':!![]});if(!_0x32d7fd)throw new Error(_0x6ef1('0x4e'));if(_0x32d7fd[_0x6ef1('0x4f')]===_0x6ef1('0x4d')){var _0x5efcd0=_0x4fae80['get']({'plain':!![]});var _0x1765dc=_0x6ef1('0x50');return db['UserProfileSection'][_0x6ef1('0x49')]({'where':{'name':_0x1765dc,'userProfileId':_0x32d7fd[_0x6ef1('0x51')]},'raw':!![]})[_0x6ef1('0x26')](function(_0x5346f4){if(_0x5346f4&&_0x5346f4['autoAssociation']===0x0){return db[_0x6ef1('0x29')]['create']({'name':_0x5efcd0[_0x6ef1('0x2c')],'resourceId':_0x5efcd0['id'],'type':_0x5346f4['name'],'sectionId':_0x5346f4['id']},{})['then'](function(){return _0x4fae80;});}else{return _0x4fae80;}})[_0x6ef1('0x4a')](function(_0x418fd6){logger[_0x6ef1('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x418fd6);throw _0x418fd6;});}return _0x4fae80;})[_0x6ef1('0x26')](respondWithResult(_0x7d4774,0xc9))[_0x6ef1('0x4a')](handleError(_0x7d4774,null));};exports['update']=function(_0x16ec5c,_0x3b7f5f){if(_0x16ec5c[_0x6ef1('0x4c')]['id']){delete _0x16ec5c['body']['id'];}return db[_0x6ef1('0x2e')][_0x6ef1('0x49')]({'where':{'id':_0x16ec5c['params']['id']}})[_0x6ef1('0x26')](handleEntityNotFound(_0x3b7f5f,null))[_0x6ef1('0x26')](saveUpdates(_0x16ec5c[_0x6ef1('0x4c')],null))['then'](respondWithResult(_0x3b7f5f,null))[_0x6ef1('0x4a')](handleError(_0x3b7f5f,null));};exports['destroy']=function(_0x316e4d,_0x374b58){return db[_0x6ef1('0x2e')][_0x6ef1('0x49')]({'where':{'id':_0x316e4d[_0x6ef1('0x45')]['id']}})[_0x6ef1('0x26')](handleEntityNotFound(_0x374b58,null))['then'](removeEntity(_0x374b58,null))[_0x6ef1('0x4a')](handleError(_0x374b58,null));}; \ No newline at end of file +var _0xc42a=['catch','show','params','rawAttributes','length','includeAll','find','create','body','user','role','get','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','fast-json-patch','request-promise','moment','mustache','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','end','offset','limit','count','set','json','save','update','then','destroy','Pauses','UserProfileResource','sendStatus','error','name','map','Pause','type','key','model','query','filters','attributes','intersection','fields','nolimit','order','sort','where','filter','merge','include','rows'];(function(_0x5e6216,_0x38308b){var _0x3c7246=function(_0x3b94c2){while(--_0x3b94c2){_0x5e6216['push'](_0x5e6216['shift']());}};_0x3c7246(++_0x38308b);}(_0xc42a,0x98));var _0xac42=function(_0xf00413,_0x19bf28){_0xf00413=_0xf00413-0x0;var _0x128efc=_0xc42a[_0xf00413];return _0x128efc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xac42('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xac42('0x1'));var rp=require(_0xac42('0x2'));var moment=require(_0xac42('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xac42('0x4'));var util=require('util');var path=require(_0xac42('0x5'));var sox=require('sox');var csv=require(_0xac42('0x6'));var ejs=require(_0xac42('0x7'));var fs=require('fs');var fs_extra=require(_0xac42('0x8'));var _=require(_0xac42('0x9'));var squel=require(_0xac42('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xac42('0xb'));var toCsv=require(_0xac42('0x6'));var querystring=require(_0xac42('0xc'));var Papa=require(_0xac42('0xd'));var Redis=require('ioredis');var authService=require(_0xac42('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xac42('0xf'));var hardwareService=require(_0xac42('0x10'));var logger=require(_0xac42('0x11'))(_0xac42('0x12'));var utils=require(_0xac42('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xac42('0x14'))['db'];function respondWithStatusCode(_0x5811bb,_0x37a601){_0x37a601=_0x37a601||0xcc;return function(_0x5ed251){if(_0x5ed251){return _0x5811bb['sendStatus'](_0x37a601);}return _0x5811bb[_0xac42('0x15')](_0x37a601)[_0xac42('0x16')]();};}function respondWithResult(_0xdafd75,_0x54ea20){_0x54ea20=_0x54ea20||0xc8;return function(_0x4f2011){if(_0x4f2011){return _0xdafd75[_0xac42('0x15')](_0x54ea20)['json'](_0x4f2011);}};}function respondWithFilteredResult(_0x33f25f,_0x210e9f){return function(_0x288d8b){if(_0x288d8b){var _0x8bb3a9=typeof _0x210e9f[_0xac42('0x17')]==='undefined'&&typeof _0x210e9f[_0xac42('0x18')]==='undefined';var _0x2dd2dd=_0x288d8b[_0xac42('0x19')];var _0x4de32a=_0x8bb3a9?0x0:_0x210e9f['offset'];var _0x1893e6=_0x8bb3a9?_0x288d8b[_0xac42('0x19')]:_0x210e9f[_0xac42('0x17')]+_0x210e9f[_0xac42('0x18')];var _0x2f43e6;if(_0x1893e6>=_0x2dd2dd){_0x1893e6=_0x2dd2dd;_0x2f43e6=0xc8;}else{_0x2f43e6=0xce;}_0x33f25f[_0xac42('0x15')](_0x2f43e6);return _0x33f25f[_0xac42('0x1a')]('Content-Range',_0x4de32a+'-'+_0x1893e6+'/'+_0x2dd2dd)[_0xac42('0x1b')](_0x288d8b);}return null;};}function patchUpdates(_0x37cf31){return function(_0x57aaef){try{jsonpatch['apply'](_0x57aaef,_0x37cf31,!![]);}catch(_0x439739){return BPromise['reject'](_0x439739);}return _0x57aaef[_0xac42('0x1c')]();};}function saveUpdates(_0x501619,_0x47bf99){return function(_0x1c94f9){if(_0x1c94f9){return _0x1c94f9[_0xac42('0x1d')](_0x501619)[_0xac42('0x1e')](function(_0x211a55){return _0x211a55;});}return null;};}function removeEntity(_0x475825,_0x5e36df){return function(_0xe6b008){if(_0xe6b008){return _0xe6b008[_0xac42('0x1f')]()[_0xac42('0x1e')](function(){var _0x21b2ff=_0xe6b008['get']({'plain':!![]});var _0x3c15bc=_0xac42('0x20');return db[_0xac42('0x21')][_0xac42('0x1f')]({'where':{'type':_0x3c15bc,'resourceId':_0x21b2ff['id']}})[_0xac42('0x1e')](function(){return _0xe6b008;});})[_0xac42('0x1e')](function(){_0x475825[_0xac42('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ca9b3,_0x2db441){return function(_0x3145de){if(!_0x3145de){_0x3ca9b3[_0xac42('0x22')](0x194);}return _0x3145de;};}function handleError(_0x156b82,_0x6722c3){_0x6722c3=_0x6722c3||0x1f4;return function(_0x57d811){logger[_0xac42('0x23')](_0x57d811['stack']);if(_0x57d811['name']){delete _0x57d811[_0xac42('0x24')];}_0x156b82[_0xac42('0x15')](_0x6722c3)['send'](_0x57d811);};}exports['index']=function(_0x440dad,_0x2b0443){var _0x5b967b={},_0x1e36d6={},_0x4109f9={'count':0x0,'rows':[]};var _0x5914e0=_[_0xac42('0x25')](db[_0xac42('0x26')]['rawAttributes'],function(_0x4556be){return{'name':_0x4556be['fieldName'],'type':_0x4556be[_0xac42('0x27')][_0xac42('0x28')]};});_0x1e36d6[_0xac42('0x29')]=_[_0xac42('0x25')](_0x5914e0,_0xac42('0x24'));_0x1e36d6[_0xac42('0x2a')]=_['keys'](_0x440dad['query']);_0x1e36d6[_0xac42('0x2b')]=_['intersection'](_0x1e36d6[_0xac42('0x29')],_0x1e36d6[_0xac42('0x2a')]);_0x5b967b[_0xac42('0x2c')]=_[_0xac42('0x2d')](_0x1e36d6[_0xac42('0x29')],qs[_0xac42('0x2e')](_0x440dad[_0xac42('0x2a')][_0xac42('0x2e')]));_0x5b967b[_0xac42('0x2c')]=_0x5b967b[_0xac42('0x2c')]['length']?_0x5b967b[_0xac42('0x2c')]:_0x1e36d6[_0xac42('0x29')];if(!_0x440dad['query']['hasOwnProperty'](_0xac42('0x2f'))){_0x5b967b[_0xac42('0x18')]=qs[_0xac42('0x18')](_0x440dad[_0xac42('0x2a')][_0xac42('0x18')]);_0x5b967b[_0xac42('0x17')]=qs[_0xac42('0x17')](_0x440dad['query'][_0xac42('0x17')]);}_0x5b967b[_0xac42('0x30')]=qs[_0xac42('0x31')](_0x440dad[_0xac42('0x2a')][_0xac42('0x31')]);_0x5b967b[_0xac42('0x32')]=qs['filters'](_['pick'](_0x440dad[_0xac42('0x2a')],_0x1e36d6[_0xac42('0x2b')]),_0x5914e0);if(_0x440dad[_0xac42('0x2a')][_0xac42('0x33')]){_0x5b967b[_0xac42('0x32')]=_[_0xac42('0x34')](_0x5b967b[_0xac42('0x32')],{'$or':_['map'](_0x5914e0,function(_0x437882){if(_0x437882[_0xac42('0x27')]!=='VIRTUAL'){var _0x17796f={};_0x17796f[_0x437882['name']]={'$like':'%'+_0x440dad[_0xac42('0x2a')][_0xac42('0x33')]+'%'};return _0x17796f;}})});}_0x5b967b=_['merge']({},_0x5b967b,_0x440dad['options']);var _0x25688f={'where':_0x5b967b[_0xac42('0x32')]};return db[_0xac42('0x26')]['count'](_0x25688f)[_0xac42('0x1e')](function(_0x20282c){_0x4109f9[_0xac42('0x19')]=_0x20282c;if(_0x440dad[_0xac42('0x2a')]['includeAll']){_0x5b967b[_0xac42('0x35')]=[{'all':!![]}];}return db['Pause']['findAll'](_0x5b967b);})['then'](function(_0x1fa9b0){_0x4109f9[_0xac42('0x36')]=_0x1fa9b0;return _0x4109f9;})[_0xac42('0x1e')](respondWithFilteredResult(_0x2b0443,_0x5b967b))[_0xac42('0x37')](handleError(_0x2b0443,null));};exports[_0xac42('0x38')]=function(_0x54b766,_0x1924d0){var _0x369686={'raw':!![],'where':{'id':_0x54b766[_0xac42('0x39')]['id']}},_0x5b987c={};_0x5b987c[_0xac42('0x29')]=_['keys'](db['Pause'][_0xac42('0x3a')]);_0x5b987c['query']=_['keys'](_0x54b766[_0xac42('0x2a')]);_0x5b987c[_0xac42('0x2b')]=_[_0xac42('0x2d')](_0x5b987c[_0xac42('0x29')],_0x5b987c[_0xac42('0x2a')]);_0x369686[_0xac42('0x2c')]=_[_0xac42('0x2d')](_0x5b987c[_0xac42('0x29')],qs[_0xac42('0x2e')](_0x54b766[_0xac42('0x2a')][_0xac42('0x2e')]));_0x369686['attributes']=_0x369686[_0xac42('0x2c')][_0xac42('0x3b')]?_0x369686[_0xac42('0x2c')]:_0x5b987c[_0xac42('0x29')];if(_0x54b766[_0xac42('0x2a')][_0xac42('0x3c')]){_0x369686[_0xac42('0x35')]=[{'all':!![]}];}_0x369686=_[_0xac42('0x34')]({},_0x369686,_0x54b766['options']);return db[_0xac42('0x26')][_0xac42('0x3d')](_0x369686)[_0xac42('0x1e')](handleEntityNotFound(_0x1924d0,null))[_0xac42('0x1e')](respondWithResult(_0x1924d0,null))['catch'](handleError(_0x1924d0,null));};exports[_0xac42('0x3e')]=function(_0x359cf7,_0x55d7dc){return db[_0xac42('0x26')]['create'](_0x359cf7[_0xac42('0x3f')],{})[_0xac42('0x1e')](function(_0x1d2437){var _0x54ad96=_0x359cf7[_0xac42('0x40')]['get']({'plain':!![]});if(!_0x54ad96)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x54ad96[_0xac42('0x41')]===_0xac42('0x40')){var _0x117b36=_0x1d2437[_0xac42('0x42')]({'plain':!![]});var _0x1a1349=_0xac42('0x20');return db['UserProfileSection'][_0xac42('0x3d')]({'where':{'name':_0x1a1349,'userProfileId':_0x54ad96['userProfileId']},'raw':!![]})[_0xac42('0x1e')](function(_0x54d5a3){if(_0x54d5a3&&_0x54d5a3[_0xac42('0x43')]===0x0){return db['UserProfileResource']['create']({'name':_0x117b36[_0xac42('0x24')],'resourceId':_0x117b36['id'],'type':_0x54d5a3[_0xac42('0x24')],'sectionId':_0x54d5a3['id']},{})[_0xac42('0x1e')](function(){return _0x1d2437;});}else{return _0x1d2437;}})['catch'](function(_0x442db6){logger[_0xac42('0x23')](_0xac42('0x44'),_0x442db6);throw _0x442db6;});}return _0x1d2437;})[_0xac42('0x1e')](respondWithResult(_0x55d7dc,0xc9))[_0xac42('0x37')](handleError(_0x55d7dc,null));};exports['update']=function(_0x231cbf,_0x467faa){if(_0x231cbf[_0xac42('0x3f')]['id']){delete _0x231cbf[_0xac42('0x3f')]['id'];}return db[_0xac42('0x26')]['find']({'where':{'id':_0x231cbf[_0xac42('0x39')]['id']}})['then'](handleEntityNotFound(_0x467faa,null))['then'](saveUpdates(_0x231cbf[_0xac42('0x3f')],null))['then'](respondWithResult(_0x467faa,null))[_0xac42('0x37')](handleError(_0x467faa,null));};exports[_0xac42('0x1f')]=function(_0x32e5d7,_0x1fe871){return db[_0xac42('0x26')][_0xac42('0x3d')]({'where':{'id':_0x32e5d7[_0xac42('0x39')]['id']}})[_0xac42('0x1e')](handleEntityNotFound(_0x1fe871,null))[_0xac42('0x1e')](removeEntity(_0x1fe871,null))[_0xac42('0x37')](handleError(_0x1fe871,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index c5c8d4e..ccaf408 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 _0x9957=['exports','define','Pause','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./pause.attributes'];(function(_0x556bb1,_0x34830d){var _0x45455f=function(_0x13c6ba){while(--_0x13c6ba){_0x556bb1['push'](_0x556bb1['shift']());}};_0x45455f(++_0x34830d);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe14b=['bluebird','path','./pause.attributes','exports','define','Pause','tools_pauses','lodash','util','moment'];(function(_0x320917,_0x4f569a){var _0x3e98cc=function(_0x5e6f09){while(--_0x5e6f09){_0x320917['push'](_0x320917['shift']());}};_0x3e98cc(++_0x4f569a);}(_0xe14b,0x93));var _0xbe14=function(_0x5c376c,_0x31cf41){_0x5c376c=_0x5c376c-0x0;var _0x578699=_0xe14b[_0x5c376c];return _0x578699;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbe14('0x2'));var BPromise=require(_0xbe14('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe14('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbe14('0x5'));module[_0xbe14('0x6')]=function(_0x1fe204,_0x1ff100){return _0x1fe204[_0xbe14('0x7')](_0xbe14('0x8'),attributes,{'tableName':_0xbe14('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index c402527..bf8c30e 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(_0x5a3757,_0x3de90a){var _0x28e127=function(_0x5c434a){while(--_0x5c434a){_0x5a3757['push'](_0x5a3757['shift']());}};_0x28e127(++_0x3de90a);}(_0x7a54,0x106));var _0x47a5=function(_0x42ea88,_0x5e751b){_0x42ea88=_0x42ea88-0x0;var _0x387db8=_0x7a54[_0x42ea88];return _0x387db8;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Pause,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['ShowPause']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')]({'raw':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x18')]===undefined?!![]:![]:!![],'where':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x19')]||null:null,'attributes':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x1a')]||null:null,'include':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')]['include']?_[_0x47a5('0x1b')](_0x5247fd[_0x47a5('0x17')][_0x47a5('0x1c')],function(_0x7a9f9e){return{'model':db[_0x7a9f9e['model']],'as':_0x7a9f9e['as'],'attributes':_0x7a9f9e[_0x47a5('0x1a')],'include':_0x7a9f9e[_0x47a5('0x1c')]?_['map'](_0x7a9f9e[_0x47a5('0x1c')],function(_0xc4cd63){return{'model':db[_0xc4cd63[_0x47a5('0x1d')]],'as':_0xc4cd63['as'],'attributes':_0xc4cd63[_0x47a5('0x1a')],'include':_0xc4cd63[_0x47a5('0x1c')]?_['map'](_0xc4cd63['include'],function(_0x136745){return{'model':db[_0x136745['model']],'as':_0x136745['as'],'attributes':_0x136745[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23cb77){logger[_0x47a5('0xb')](_0x47a5('0x1e'),_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1e'),_0x5247fd,JSON[_0x47a5('0xe')](_0x23cb77));_0xaf70a6(_0x23cb77);})[_0x47a5('0x14')](function(_0x136b14){logger[_0x47a5('0xf')](_0x47a5('0x1e'),_0x136b14[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81[_0x47a5('0xf')](0x1f4,_0x136b14[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _0x7a54=['message','request\x20sent','result','catch','Pause','find','options','raw','where','attributes','map','include','model','ShowPause','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Pause,\x20%s,\x20%s','debug','stringify','error','code'];(function(_0x42341c,_0x37bc1a){var _0x1d045=function(_0x4beb64){while(--_0x4beb64){_0x42341c['push'](_0x42341c['shift']());}};_0x1d045(++_0x37bc1a);}(_0x7a54,0x106));var _0x47a5=function(_0x4a8eae,_0x3357d4){_0x4a8eae=_0x4a8eae-0x0;var _0x536dd3=_0x7a54[_0x4a8eae];return _0x536dd3;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Pause,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['ShowPause']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')]({'raw':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x18')]===undefined?!![]:![]:!![],'where':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x19')]||null:null,'attributes':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x1a')]||null:null,'include':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')]['include']?_[_0x47a5('0x1b')](_0x5247fd[_0x47a5('0x17')][_0x47a5('0x1c')],function(_0x7a9f9e){return{'model':db[_0x7a9f9e['model']],'as':_0x7a9f9e['as'],'attributes':_0x7a9f9e[_0x47a5('0x1a')],'include':_0x7a9f9e[_0x47a5('0x1c')]?_['map'](_0x7a9f9e[_0x47a5('0x1c')],function(_0xc4cd63){return{'model':db[_0xc4cd63[_0x47a5('0x1d')]],'as':_0xc4cd63['as'],'attributes':_0xc4cd63[_0x47a5('0x1a')],'include':_0xc4cd63[_0x47a5('0x1c')]?_['map'](_0xc4cd63['include'],function(_0x136745){return{'model':db[_0x136745['model']],'as':_0x136745['as'],'attributes':_0x136745[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23cb77){logger[_0x47a5('0xb')](_0x47a5('0x1e'),_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1e'),_0x5247fd,JSON[_0x47a5('0xe')](_0x23cb77));_0xaf70a6(_0x23cb77);})[_0x47a5('0x14')](function(_0x136b14){logger[_0x47a5('0xf')](_0x47a5('0x1e'),_0x136b14[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81[_0x47a5('0xf')](0x1f4,_0x136b14[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index cc6b83d..273f8bd 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 _0x5ad3=['webhookGet','/:id','show','download','root','server/files/plugins','replace','format','%s-%s%s','originalname','extname','now','post','single','file','/webhook','webhookPost','put','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','get','isAuthenticated','index'];(function(_0x3aa28b,_0x4142a0){var _0x11442b=function(_0x4a7385){while(--_0x4a7385){_0x3aa28b['push'](_0x3aa28b['shift']());}};_0x11442b(++_0x4142a0);}(_0x5ad3,0x1e2));var _0x35ad=function(_0x4ffa64,_0x271035){_0x4ffa64=_0x4ffa64-0x0;var _0x5da001=_0x5ad3[_0x4ffa64];return _0x5da001;};'use strict';var multer=require(_0x35ad('0x0'));var util=require(_0x35ad('0x1'));var path=require(_0x35ad('0x2'));var timeout=require(_0x35ad('0x3'));var express=require('express');var router=express[_0x35ad('0x4')]();var fs_extra=require(_0x35ad('0x5'));var auth=require(_0x35ad('0x6'));var interaction=require(_0x35ad('0x7'));var config=require(_0x35ad('0x8'));var controller=require(_0x35ad('0x9'));router[_0x35ad('0xa')]('/',auth[_0x35ad('0xb')](),controller[_0x35ad('0xc')]);router[_0x35ad('0xa')]('/webhook',controller[_0x35ad('0xd')]);router[_0x35ad('0xa')](_0x35ad('0xe'),auth['isAuthenticated'](),controller[_0x35ad('0xf')]);router['get']('/:id/download',auth[_0x35ad('0xb')](),controller[_0x35ad('0x10')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x34c2cb,_0x3a70a9,_0x4ad760){_0x4ad760(null,path['join'](config[_0x35ad('0x11')],_0x35ad('0x12')));},'filename':function(_0x4cf6bd,_0x3c4dd5,_0x33e2ec){_0x3c4dd5['originalname']=_0x3c4dd5['originalname'][_0x35ad('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x33e2ec(null,util[_0x35ad('0x14')](_0x35ad('0x15'),path['basename'](_0x3c4dd5[_0x35ad('0x16')],path[_0x35ad('0x17')](_0x3c4dd5['originalname'])),Date[_0x35ad('0x18')](),path['extname'](_0x3c4dd5['originalname'])));}})});router[_0x35ad('0x19')]('/',upload[_0x35ad('0x1a')](_0x35ad('0x1b')),controller['upload']);router[_0x35ad('0x19')](_0x35ad('0x1c'),controller[_0x35ad('0x1d')]);router[_0x35ad('0x1e')](_0x35ad('0xe'),auth[_0x35ad('0xb')](),controller['update']);router[_0x35ad('0x1f')](_0x35ad('0xe'),auth['isAuthenticated'](),controller['delete']);module[_0x35ad('0x20')]=router; \ No newline at end of file +var _0xdace=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/webhook','webhookGet','show','download','diskStorage','join','server/files/plugins','originalname','replace','format','%s-%s%s','basename','extname','now','single','upload','post','webhookPost','update','delete','/:id','exports','multer'];(function(_0x2bde55,_0x3bf01a){var _0x313885=function(_0x3e3ae2){while(--_0x3e3ae2){_0x2bde55['push'](_0x2bde55['shift']());}};_0x313885(++_0x3bf01a);}(_0xdace,0xc5));var _0xedac=function(_0x414655,_0x79d916){_0x414655=_0x414655-0x0;var _0x237884=_0xdace[_0x414655];return _0x237884;};'use strict';var multer=require(_0xedac('0x0'));var util=require('util');var path=require(_0xedac('0x1'));var timeout=require(_0xedac('0x2'));var express=require(_0xedac('0x3'));var router=express['Router']();var fs_extra=require(_0xedac('0x4'));var auth=require(_0xedac('0x5'));var interaction=require(_0xedac('0x6'));var config=require(_0xedac('0x7'));var controller=require('./plugin.controller');router[_0xedac('0x8')]('/',auth[_0xedac('0x9')](),controller[_0xedac('0xa')]);router['get'](_0xedac('0xb'),controller[_0xedac('0xc')]);router[_0xedac('0x8')]('/:id',auth[_0xedac('0x9')](),controller[_0xedac('0xd')]);router[_0xedac('0x8')]('/:id/download',auth['isAuthenticated'](),controller[_0xedac('0xe')]);var upload=multer({'storage':multer[_0xedac('0xf')]({'destination':function(_0x57e1bf,_0x4d6a29,_0x4db2ad){_0x4db2ad(null,path[_0xedac('0x10')](config['root'],_0xedac('0x11')));},'filename':function(_0x4fa1ac,_0x21c6ae,_0x1b0503){_0x21c6ae[_0xedac('0x12')]=_0x21c6ae[_0xedac('0x12')][_0xedac('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1b0503(null,util[_0xedac('0x14')](_0xedac('0x15'),path[_0xedac('0x16')](_0x21c6ae['originalname'],path[_0xedac('0x17')](_0x21c6ae[_0xedac('0x12')])),Date[_0xedac('0x18')](),path[_0xedac('0x17')](_0x21c6ae[_0xedac('0x12')])));}})});router['post']('/',upload[_0xedac('0x19')]('file'),controller[_0xedac('0x1a')]);router[_0xedac('0x1b')](_0xedac('0xb'),controller[_0xedac('0x1c')]);router['put']('/:id',auth[_0xedac('0x9')](),controller[_0xedac('0x1d')]);router[_0xedac('0x1e')](_0xedac('0x1f'),auth['isAuthenticated'](),controller['delete']);module[_0xedac('0x20')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index ced7c40..5111ef6 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 _0xdc25=['never','sequelize','exports','ENUM','html','script','TEXT','STRING','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','agentOnly'];(function(_0x4a8895,_0x1f7825){var _0x4f48da=function(_0x171298){while(--_0x171298){_0x4a8895['push'](_0x4a8895['shift']());}};_0x4f48da(++_0x1f7825);}(_0xdc25,0x1b1));var _0x5dc2=function(_0x5e4217,_0x236ae7){_0x5e4217=_0x5e4217-0x0;var _0x27fbc8=_0xdc25[_0x5e4217];return _0x27fbc8;};'use strict';var Sequelize=require(_0x5dc2('0x0'));module[_0x5dc2('0x1')]={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x5dc2('0x2')](_0x5dc2('0x3'),_0x5dc2('0x4'))},'description':{'type':Sequelize[_0x5dc2('0x5')]},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize[_0x5dc2('0x6')],'comment':_0x5dc2('0x7')},'active':{'type':Sequelize[_0x5dc2('0x8')],'defaultValue':0x0,'comment':_0x5dc2('0x9')},'sidebar':{'type':Sequelize[_0x5dc2('0x2')]('adminOnly',_0x5dc2('0xa'),'always',_0x5dc2('0xb')),'defaultValue':'always','comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize[_0x5dc2('0x6')]},'adminUrl':{'type':Sequelize[_0x5dc2('0x6')]},'agentUrl':{'type':Sequelize[_0x5dc2('0x6')]},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize[_0x5dc2('0x6')]}}; \ No newline at end of file +var _0xe462=['Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','STRING','html','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','ENUM','adminOnly','agentOnly','always','never'];(function(_0x4ee9cd,_0xd375b0){var _0x328a5b=function(_0x3ad1f4){while(--_0x3ad1f4){_0x4ee9cd['push'](_0x4ee9cd['shift']());}};_0x328a5b(++_0xd375b0);}(_0xe462,0xef));var _0x2e46=function(_0x191c44,_0x20a896){_0x191c44=_0x191c44-0x0;var _0x1086cd=_0xe462[_0x191c44];return _0x1086cd;};'use strict';var Sequelize=require(_0x2e46('0x0'));module[_0x2e46('0x1')]={'name':{'type':Sequelize[_0x2e46('0x2')]},'type':{'type':Sequelize['ENUM'](_0x2e46('0x3'),_0x2e46('0x4'))},'description':{'type':Sequelize[_0x2e46('0x5')]},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize[_0x2e46('0x2')],'comment':_0x2e46('0x6')},'active':{'type':Sequelize[_0x2e46('0x7')],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize[_0x2e46('0x8')](_0x2e46('0x9'),_0x2e46('0xa'),_0x2e46('0xb'),_0x2e46('0xc')),'defaultValue':'always','comment':_0x2e46('0xd')},'icon':{'type':Sequelize[_0x2e46('0x2')]},'adminUrl':{'type':Sequelize[_0x2e46('0x2')]},'agentUrl':{'type':Sequelize[_0x2e46('0x2')]},'scriptName':{'type':Sequelize[_0x2e46('0x2')]},'scriptPath':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 95dcbd8..5019430 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 _0xca2e=['../../mysqldb','redis','localhost','sendStatus','end','status','json','undefined','limit','count','Content-Range','reject','save','update','then','get','UserProfileResource','destroy','error','stack','name','send','map','Plugin','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty','offset','order','sort','where','pick','merge','type','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','root','server/files/plugins','format','%s.zip','createWriteStream','zip','warning','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','dirname','join','node_modules/**/*','basename','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','download','Error\x20while\x20downloading\x20the\x20plugin','Download\x20completed','info','Temporary\x20file\x20removed','upload','filename','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','Invalid\x20manifest:\x20type\x20missing','version','html','parameters','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20path\x20missing','description','always','icon','icon-apps','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','scriptPath','create','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Plugins','autoAssociation','unlinkSync','Zip\x20archive\x20removed','webhookGet','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','set','endsWith','statusCode','webhookPost','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','extract-zip','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xca2e,0x13a));var _0xeca2=function(_0x31a6ff,_0x450953){_0x31a6ff=_0x31a6ff-0x0;var _0x20a699=_0xca2e[_0x31a6ff];return _0x20a699;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xeca2('0x0'));var zipdir=require(_0xeca2('0x1'));var jsonpatch=require(_0xeca2('0x2'));var rp=require(_0xeca2('0x3'));var moment=require(_0xeca2('0x4'));var BPromise=require(_0xeca2('0x5'));var Mustache=require(_0xeca2('0x6'));var util=require(_0xeca2('0x7'));var path=require(_0xeca2('0x8'));var sox=require(_0xeca2('0x9'));var csv=require(_0xeca2('0xa'));var ejs=require(_0xeca2('0xb'));var fs=require('fs');var fs_extra=require(_0xeca2('0xc'));var _=require(_0xeca2('0xd'));var squel=require(_0xeca2('0xe'));var crypto=require('crypto');var jsforce=require(_0xeca2('0xf'));var deskjs=require(_0xeca2('0x10'));var toCsv=require(_0xeca2('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var extract=require(_0xeca2('0x11'));var rimraf=require(_0xeca2('0x0'));var archiver=require(_0xeca2('0x12'));var Redis=require(_0xeca2('0x13'));var authService=require(_0xeca2('0x14'));var qs=require(_0xeca2('0x15'));var as=require(_0xeca2('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xeca2('0x17'))(_0xeca2('0x18'));var utils=require(_0xeca2('0x19'));var config=require(_0xeca2('0x1a'));var licenseUtil=require(_0xeca2('0x1b'));var db=require(_0xeca2('0x1c'))['db'];config[_0xeca2('0x1d')]=_['defaults'](config[_0xeca2('0x1d')],{'host':_0xeca2('0x1e'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./plugin.socket')['register'](socket);function respondWithStatusCode(_0xe9c5d6,_0x408b2e){_0x408b2e=_0x408b2e||0xcc;return function(_0x538cab){if(_0x538cab){return _0xe9c5d6[_0xeca2('0x1f')](_0x408b2e);}return _0xe9c5d6['status'](_0x408b2e)[_0xeca2('0x20')]();};}function respondWithResult(_0x2ca11c,_0x2d2e50){_0x2d2e50=_0x2d2e50||0xc8;return function(_0x2385e3){if(_0x2385e3){return _0x2ca11c[_0xeca2('0x21')](_0x2d2e50)[_0xeca2('0x22')](_0x2385e3);}};}function respondWithFilteredResult(_0x4d22a2,_0x504934){return function(_0x1ef88a){if(_0x1ef88a){var _0x391d1c=typeof _0x504934['offset']===_0xeca2('0x23')&&typeof _0x504934[_0xeca2('0x24')]==='undefined';var _0x2cbabb=_0x1ef88a[_0xeca2('0x25')];var _0x14a769=_0x391d1c?0x0:_0x504934['offset'];var _0x8d8092=_0x391d1c?_0x1ef88a[_0xeca2('0x25')]:_0x504934['offset']+_0x504934[_0xeca2('0x24')];var _0x3a7dbe;if(_0x8d8092>=_0x2cbabb){_0x8d8092=_0x2cbabb;_0x3a7dbe=0xc8;}else{_0x3a7dbe=0xce;}_0x4d22a2[_0xeca2('0x21')](_0x3a7dbe);return _0x4d22a2['set'](_0xeca2('0x26'),_0x14a769+'-'+_0x8d8092+'/'+_0x2cbabb)[_0xeca2('0x22')](_0x1ef88a);}return null;};}function patchUpdates(_0x2a8055){return function(_0x333093){try{jsonpatch['apply'](_0x333093,_0x2a8055,!![]);}catch(_0x3f86b2){return BPromise[_0xeca2('0x27')](_0x3f86b2);}return _0x333093[_0xeca2('0x28')]();};}function saveUpdates(_0x51fbe0,_0x42012c){return function(_0x383a0c){if(_0x383a0c){return _0x383a0c[_0xeca2('0x29')](_0x51fbe0)[_0xeca2('0x2a')](function(_0x248f8a){return _0x248f8a;});}return null;};}function removeEntity(_0x91ecd9,_0x3ba72e){return function(_0x907725){if(_0x907725){return _0x907725['destroy']()[_0xeca2('0x2a')](function(){var _0x429b25=_0x907725[_0xeca2('0x2b')]({'plain':!![]});var _0x5acb55='Plugins';return db[_0xeca2('0x2c')][_0xeca2('0x2d')]({'where':{'type':_0x5acb55,'resourceId':_0x429b25['id']}})['then'](function(){return _0x907725;});})[_0xeca2('0x2a')](function(){_0x91ecd9[_0xeca2('0x21')](0xcc)[_0xeca2('0x20')]();});}};}function handleEntityNotFound(_0x3118a0,_0x2cc0ba){return function(_0xa61065){if(!_0xa61065){_0x3118a0['sendStatus'](0x194);}return _0xa61065;};}function handleError(_0x56c516,_0x14afc1){_0x14afc1=_0x14afc1||0x1f4;return function(_0x100b5b){logger[_0xeca2('0x2e')](_0x100b5b[_0xeca2('0x2f')]);if(_0x100b5b['name']){delete _0x100b5b[_0xeca2('0x30')];}_0x56c516['status'](_0x14afc1)[_0xeca2('0x31')](_0x100b5b);};}exports['index']=function(_0x2cb165,_0x2bef65){var _0xddfede={},_0x464462={},_0x2ee281={'count':0x0,'rows':[]};var _0xa56260=_[_0xeca2('0x32')](db[_0xeca2('0x33')][_0xeca2('0x34')],function(_0x15d0ab){return{'name':_0x15d0ab[_0xeca2('0x35')],'type':_0x15d0ab['type'][_0xeca2('0x36')]};});_0x464462[_0xeca2('0x37')]=_[_0xeca2('0x32')](_0xa56260,_0xeca2('0x30'));_0x464462[_0xeca2('0x38')]=_[_0xeca2('0x39')](_0x2cb165['query']);_0x464462[_0xeca2('0x3a')]=_[_0xeca2('0x3b')](_0x464462['model'],_0x464462[_0xeca2('0x38')]);_0xddfede['attributes']=_[_0xeca2('0x3b')](_0x464462[_0xeca2('0x37')],qs[_0xeca2('0x3c')](_0x2cb165[_0xeca2('0x38')][_0xeca2('0x3c')]));_0xddfede['attributes']=_0xddfede['attributes'][_0xeca2('0x3d')]?_0xddfede[_0xeca2('0x3e')]:_0x464462[_0xeca2('0x37')];if(!_0x2cb165[_0xeca2('0x38')][_0xeca2('0x3f')]('nolimit')){_0xddfede[_0xeca2('0x24')]=qs[_0xeca2('0x24')](_0x2cb165[_0xeca2('0x38')][_0xeca2('0x24')]);_0xddfede[_0xeca2('0x40')]=qs[_0xeca2('0x40')](_0x2cb165[_0xeca2('0x38')][_0xeca2('0x40')]);}_0xddfede[_0xeca2('0x41')]=qs['sort'](_0x2cb165[_0xeca2('0x38')][_0xeca2('0x42')]);_0xddfede[_0xeca2('0x43')]=qs[_0xeca2('0x3a')](_[_0xeca2('0x44')](_0x2cb165[_0xeca2('0x38')],_0x464462[_0xeca2('0x3a')]),_0xa56260);if(_0x2cb165['query']['filter']){_0xddfede[_0xeca2('0x43')]=_[_0xeca2('0x45')](_0xddfede['where'],{'$or':_[_0xeca2('0x32')](_0xa56260,function(_0x8e4bea){if(_0x8e4bea[_0xeca2('0x46')]!==_0xeca2('0x47')){var _0x58144a={};_0x58144a[_0x8e4bea[_0xeca2('0x30')]]={'$like':'%'+_0x2cb165[_0xeca2('0x38')]['filter']+'%'};return _0x58144a;}})});}_0xddfede=_[_0xeca2('0x45')]({},_0xddfede,_0x2cb165[_0xeca2('0x48')]);var _0x565ca8={'where':_0xddfede['where']};return db['Plugin'][_0xeca2('0x25')](_0x565ca8)[_0xeca2('0x2a')](function(_0x207ca3){_0x2ee281[_0xeca2('0x25')]=_0x207ca3;if(_0x2cb165[_0xeca2('0x38')][_0xeca2('0x49')]){_0xddfede[_0xeca2('0x4a')]=[{'all':!![]}];}return db[_0xeca2('0x33')]['findAll'](_0xddfede);})[_0xeca2('0x2a')](function(_0x3e41b8){_0x2ee281[_0xeca2('0x4b')]=_0x3e41b8;return _0x2ee281;})[_0xeca2('0x2a')](respondWithFilteredResult(_0x2bef65,_0xddfede))[_0xeca2('0x4c')](handleError(_0x2bef65,null));};exports[_0xeca2('0x4d')]=function(_0x3d6131,_0x348e22){var _0x587220={'raw':!![],'where':{'id':_0x3d6131[_0xeca2('0x4e')]['id']}},_0x1dff83={};_0x1dff83[_0xeca2('0x37')]=_[_0xeca2('0x39')](db[_0xeca2('0x33')]['rawAttributes']);_0x1dff83[_0xeca2('0x38')]=_[_0xeca2('0x39')](_0x3d6131[_0xeca2('0x38')]);_0x1dff83[_0xeca2('0x3a')]=_[_0xeca2('0x3b')](_0x1dff83[_0xeca2('0x37')],_0x1dff83['query']);_0x587220['attributes']=_[_0xeca2('0x3b')](_0x1dff83[_0xeca2('0x37')],qs[_0xeca2('0x3c')](_0x3d6131['query'][_0xeca2('0x3c')]));_0x587220[_0xeca2('0x3e')]=_0x587220[_0xeca2('0x3e')]['length']?_0x587220[_0xeca2('0x3e')]:_0x1dff83[_0xeca2('0x37')];if(_0x3d6131['query']['includeAll']){_0x587220[_0xeca2('0x4a')]=[{'all':!![]}];}_0x587220=_[_0xeca2('0x45')]({},_0x587220,_0x3d6131[_0xeca2('0x48')]);return db[_0xeca2('0x33')][_0xeca2('0x4f')](_0x587220)[_0xeca2('0x2a')](handleEntityNotFound(_0x348e22,null))[_0xeca2('0x2a')](respondWithResult(_0x348e22,null))['catch'](handleError(_0x348e22,null));};exports['download']=function(_0x561188,_0x5b7b11,_0x29238e){return db[_0xeca2('0x33')][_0xeca2('0x4f')]({'where':{'id':_0x561188[_0xeca2('0x4e')]['id']},'attributes':[_0xeca2('0x30'),_0xeca2('0x8')],'raw':!![]})[_0xeca2('0x2a')](handleEntityNotFound(_0x5b7b11,null))[_0xeca2('0x2a')](function(_0x128ac1){if(_0x128ac1){var _0x393374=path['join'](config[_0xeca2('0x50')],_0xeca2('0x51'),util[_0xeca2('0x52')](_0xeca2('0x53'),path['basename'](_0x128ac1[_0xeca2('0x8')])));var _0x42a413=fs[_0xeca2('0x54')](_0x393374);var _0x34e35f=archiver(_0xeca2('0x55'),{'zlib':{'level':0x9}});_0x34e35f['on'](_0xeca2('0x56'),function(_0x315a5c){if(_0x315a5c[_0xeca2('0x57')]===_0xeca2('0x58')){logger['error'](_0x315a5c);}else{throw new db[(_0xeca2('0x59'))][(_0xeca2('0x5a'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');}});_0x34e35f['on']('error',function(_0x233bcb){throw new db[(_0xeca2('0x59'))][(_0xeca2('0x5a'))](_0xeca2('0x5b'));});_0x34e35f[_0xeca2('0x5c')](_0x42a413);_0x34e35f[_0xeca2('0x5d')]('**/*',{'cwd':path['join'](config['root'],_0xeca2('0x51'),path[_0xeca2('0x5e')](_0x128ac1[_0xeca2('0x8')])),'ignore':[path[_0xeca2('0x5f')](path['basename'](_0x128ac1[_0xeca2('0x8')]),_0xeca2('0x60')),path[_0xeca2('0x5f')](path[_0xeca2('0x61')](_0x128ac1['path']),_0xeca2('0x62'))],'nodir':!![]})[_0xeca2('0x63')]();_0x42a413['on'](_0xeca2('0x64'),function(){if(!fs[_0xeca2('0x65')](_0x393374)){throw new db['Sequelize'][(_0xeca2('0x5a'))](_0xeca2('0x66'));}return _0x5b7b11[_0xeca2('0x67')](_0x393374,util[_0xeca2('0x52')](_0xeca2('0x53'),path[_0xeca2('0x61')](_0x128ac1[_0xeca2('0x8')])),function(_0x584c8c){if(_0x584c8c){throw new db['Sequelize'][(_0xeca2('0x5a'))](_0xeca2('0x68'));}fs['unlinkSync'](_0x393374);logger['info'](_0xeca2('0x69'));logger[_0xeca2('0x6a')](_0xeca2('0x6b'));});});}return null;})[_0xeca2('0x4c')](handleError(_0x5b7b11,null));};exports[_0xeca2('0x6c')]=function(_0x42560e,_0x53cf77,_0xe47443){var _0x6d0060=path['basename'](_0x42560e['file'][_0xeca2('0x6d')],path['extname'](_0x42560e['file']['filename']));var _0xd95121=path[_0xeca2('0x5f')](config['root'],_0xeca2('0x51'),_0x42560e['file'][_0xeca2('0x6d')]);var _0x19f235=path[_0xeca2('0x5f')](config[_0xeca2('0x50')],_0xeca2('0x51'),_0x6d0060);logger[_0xeca2('0x6a')](_0xeca2('0x6e'),_0xd95121);logger[_0xeca2('0x6a')](_0xeca2('0x6f'),_0x19f235);try{fs[_0xeca2('0x70')](_0xd95121,parseInt(_0xeca2('0x71'),0x8));extract(_0xd95121,{'dir':_0x19f235},function(_0x3e0ebd){if(_0x3e0ebd){logger[_0xeca2('0x2e')](_0x3e0ebd);handleError(_0x3e0ebd,!![]);};var _0x1b9305=fs[_0xeca2('0x72')](_0x19f235);if(_0x1b9305[_0xeca2('0x3d')]>0x1){removeReferences(_0xd95121,_0x19f235);logger[_0xeca2('0x2e')](_0xeca2('0x73'));return _0xe47443(new Error(_0xeca2('0x73')));}var _0x1ae8c7=fs[_0xeca2('0x74')](path['join'](_0x19f235,_0x1b9305[0x0]));if(_0x1ae8c7[_0xeca2('0x75')]()){removeReferences(_0xd95121,_0x19f235);logger[_0xeca2('0x2e')](_0xeca2('0x73'));return _0xe47443(new Error(_0xeca2('0x73')));}if(_0x1ae8c7[_0xeca2('0x76')]()){var _0x39bb0d=fs[_0xeca2('0x72')](path[_0xeca2('0x5f')](_0x19f235,_0x1b9305[0x0]));if(_0x39bb0d[_0xeca2('0x3d')]===0x0){removeReferences(_0xd95121,_0x19f235);logger[_0xeca2('0x2e')](_0xeca2('0x73'));return _0xe47443(new Error(_0xeca2('0x73')));}var _0x32f205=_0x39bb0d[_0xeca2('0x77')](function(_0x21e893){return _0x21e893===_0xeca2('0x78');});if(!_0x32f205){return _0xe47443(new Error(_0xeca2('0x79')));}var _0x5a556f=fs[_0xeca2('0x7a')](path['join'](_0x19f235,_0x1b9305[0x0],_0xeca2('0x78')));var _0x1a18e5=JSON[_0xeca2('0x7b')](_0x5a556f);if('undefined'==typeof _0x1a18e5[_0xeca2('0x30')]){return _0xe47443(new Error('Invalid\x20manifest:\x20name\x20missing'));}if(_0xeca2('0x23')==typeof _0x1a18e5[_0xeca2('0x46')]){return _0xe47443(new Error(_0xeca2('0x7c')));}if(_0xeca2('0x23')==typeof _0x1a18e5[_0xeca2('0x7d')]){return _0xe47443(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if('undefined'==typeof _0x1a18e5['parameters']){return _0xe47443(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x1a18e5[_0xeca2('0x46')]===_0xeca2('0x7e')){if(_0xeca2('0x23')==typeof _0x1a18e5[_0xeca2('0x7f')][_0xeca2('0x80')]){return _0xe47443(new Error(_0xeca2('0x81')));}if(_0xeca2('0x23')==typeof _0x1a18e5[_0xeca2('0x7f')][_0xeca2('0x80')][_0xeca2('0x82')]&&_0xeca2('0x23')==typeof _0x1a18e5[_0xeca2('0x7f')]['views'][_0xeca2('0x83')]){return _0xe47443(new Error(_0xeca2('0x84')));}}else if(_0x1a18e5[_0xeca2('0x46')]===_0xeca2('0x85')){if(_0xeca2('0x23')==typeof _0x1a18e5[_0xeca2('0x7f')][_0xeca2('0x86')]){return _0xe47443(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if(_0xeca2('0x23')==typeof _0x1a18e5[_0xeca2('0x7f')]['scriptPath']){return _0xe47443(new Error(_0xeca2('0x87')));}}else{return _0xe47443(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x34ed27=_0x1a18e5[_0xeca2('0x30')];var _0x480475=_0x1a18e5[_0xeca2('0x88')];var _0x40c61f=_0x1a18e5[_0xeca2('0x46')];var _0x4b88d7=_0x1a18e5['sidebar']?_0x1a18e5['sidebar']:_0xeca2('0x89');var _0x3f60b8=_0x1a18e5[_0xeca2('0x8a')]?_0x1a18e5[_0xeca2('0x8a')]:_0xeca2('0x8b');var _0x524cb6='';var _0x3acd7f='';var _0x2d0be3='';var _0x3defec='';var _0x52bd94=_0x1a18e5[_0xeca2('0x7d')];if(_0x40c61f===_0xeca2('0x7e')){if(_0xeca2('0x23')!=typeof _0x1a18e5[_0xeca2('0x7f')][_0xeca2('0x80')][_0xeca2('0x82')]){var _0x4a74eb=_0x1a18e5[_0xeca2('0x7f')][_0xeca2('0x80')][_0xeca2('0x82')];if(!/^(f|ht)tps?:\/\//i[_0xeca2('0x8c')](_0x4a74eb)){_0x524cb6=path[_0xeca2('0x5f')](_0xeca2('0x8d'),_0x6d0060,_0x1b9305[0x0],_0x4a74eb);}else{_0x524cb6=_0x4a74eb;}}else{logger['info'](_0xeca2('0x8e'));}if('undefined'!=typeof _0x1a18e5['parameters']['views']['agent']){var _0x256a58=_0x1a18e5[_0xeca2('0x7f')][_0xeca2('0x80')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0xeca2('0x8c')](_0x256a58)){_0x3acd7f=path['join'](_0xeca2('0x8d'),_0x6d0060,_0x1b9305[0x0],_0x256a58);}else{_0x3acd7f=_0x256a58;}}else{logger[_0xeca2('0x6a')](_0xeca2('0x8f'));}}else if(_0x40c61f===_0xeca2('0x85')){_0x2d0be3=_0x1a18e5[_0xeca2('0x7f')][_0xeca2('0x86')];_0x3defec=_0x1a18e5[_0xeca2('0x7f')][_0xeca2('0x90')];if(_0xeca2('0x23')!=typeof _0x1a18e5[_0xeca2('0x7f')][_0xeca2('0x80')]){if(_0xeca2('0x23')!=typeof _0x1a18e5['parameters'][_0xeca2('0x80')]['admin']){var _0x4a74eb=_0x1a18e5['parameters']['views']['admin'];if(!/^(f|ht)tps?:\/\//i['test'](_0x4a74eb)){_0x524cb6=path[_0xeca2('0x5f')](_0xeca2('0x8d'),_0x6d0060,_0x1b9305[0x0],_0x4a74eb);}else{_0x524cb6=_0x4a74eb;}}if('undefined'!=typeof _0x1a18e5[_0xeca2('0x7f')]['views'][_0xeca2('0x83')]){var _0x256a58=_0x1a18e5[_0xeca2('0x7f')][_0xeca2('0x80')][_0xeca2('0x83')];if(!/^(f|ht)tps?:\/\//i[_0xeca2('0x8c')](_0x256a58)){_0x3acd7f=path[_0xeca2('0x5f')](_0xeca2('0x8d'),_0x6d0060,_0x1b9305[0x0],_0x256a58);}else{_0x3acd7f=_0x256a58;}}}}var _0x2900e4={'name':_0x34ed27,'description':_0x480475,'path':path[_0xeca2('0x5f')](_0x6d0060,_0x1b9305[0x0]),'type':_0x40c61f,'sidebar':_0x4b88d7,'icon':_0x3f60b8,'adminUrl':_0x524cb6,'agentUrl':_0x3acd7f,'scriptName':_0x2d0be3,'scriptPath':_0x3defec,'version':_0x52bd94};removeReferences(_0xd95121,null);return db[_0xeca2('0x33')][_0xeca2('0x91')](_0x2900e4)[_0xeca2('0x2a')](function(_0xf56608){var _0x23c108={'role':_0x42560e[_0xeca2('0x92')]['role'],'userProfileId':_0x42560e[_0xeca2('0x92')][_0xeca2('0x93')]};if(!_0x23c108)throw new Error(_0xeca2('0x94'));if(_0x23c108[_0xeca2('0x95')]==='user'){var _0x181106=_0xf56608[_0xeca2('0x2b')]({'plain':!![]});return db[_0xeca2('0x96')][_0xeca2('0x4f')]({'where':{'name':_0xeca2('0x97'),'userProfileId':_0x23c108[_0xeca2('0x93')]},'raw':!![]})[_0xeca2('0x2a')](function(_0x2995c5){if(_0x2995c5&&_0x2995c5[_0xeca2('0x98')]===0x0){return db[_0xeca2('0x2c')][_0xeca2('0x91')]({'name':_0x181106['name'],'resourceId':_0x181106['id'],'type':_0x2995c5[_0xeca2('0x30')],'sectionId':_0x2995c5['id']},{})[_0xeca2('0x2a')](function(){return _0xf56608;});}else{return _0xf56608;}})[_0xeca2('0x4c')](function(_0x4415fb){logger[_0xeca2('0x2e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4415fb);throw _0x4415fb;});}return _0xf56608;})[_0xeca2('0x2a')](respondWithResult(_0x53cf77,null))[_0xeca2('0x4c')](handleError(_0x53cf77,null));}});}catch(_0x5681c1){_0x53cf77[_0xeca2('0x21')](0x1f4)[_0xeca2('0x31')](_0x5681c1);}};function removeReferences(_0x2a5951,_0x1ada77){try{if(_0x2a5951){fs[_0xeca2('0x99')](_0x2a5951);logger[_0xeca2('0x6a')](_0xeca2('0x9a'));}if(_0x1ada77){rimraf(_0x1ada77,function(){});logger[_0xeca2('0x6a')]('Extracted\x20folder\x20removed');}}catch(_0x39d8ea){logger[_0xeca2('0x2e')](_0x39d8ea);}}exports[_0xeca2('0x29')]=function(_0x2edd36,_0x5bed8c,_0x19e576){return db[_0xeca2('0x33')][_0xeca2('0x4f')]({'where':{'id':_0x2edd36['params']['id']}})['then'](handleEntityNotFound(_0x5bed8c,null))[_0xeca2('0x2a')](saveUpdates(_0x2edd36[_0xeca2('0x92')],null))['then'](respondWithResult(_0x5bed8c,null))[_0xeca2('0x4c')](handleError(_0x5bed8c,null));};exports['delete']=function(_0xfc5a21,_0x4580f4,_0x449f17){return db['Plugin']['find']({'where':{'id':_0xfc5a21['params']['id']}})['then'](function(_0x21f4a1){if(_0x21f4a1){return _0x21f4a1['destroy']();}})[_0xeca2('0x2a')](function(_0x5bdeb0){rimraf(path[_0xeca2('0x5f')](config[_0xeca2('0x50')],'server/files/plugins',path['dirname'](_0x5bdeb0['path'])),function(){});return _0x5bdeb0;})[_0xeca2('0x2a')](handleEntityNotFound(_0x4580f4,null))[_0xeca2('0x2a')](respondWithStatusCode(_0x4580f4,null))[_0xeca2('0x4c')](handleError(_0x4580f4,null));};exports[_0xeca2('0x9b')]=function(_0xe85ddc,_0xbea39c,_0x1f96d4){return BPromise['resolve']()[_0xeca2('0x2a')](function(){if(!_0xe85ddc[_0xeca2('0x38')][_0xeca2('0x8')]){throw new Error(_0xeca2('0x9c'));}if(!_0xe85ddc[_0xeca2('0x38')][_0xeca2('0x9d')]){throw new Error(_0xeca2('0x9e'));}var _0x317363=_0xe85ddc[_0xeca2('0x38')][_0xeca2('0x9f')]?_0xe85ddc[_0xeca2('0x38')]['hostname']+':'+_0xe85ddc['query'][_0xeca2('0x9d')]:_0xeca2('0xa0')+_0xe85ddc[_0xeca2('0x38')][_0xeca2('0x9d')];var _0x219dc7=_0xe85ddc[_0xeca2('0x38')]['json']?_0xe85ddc[_0xeca2('0x38')][_0xeca2('0x22')]:!![];var _0x1397ad=_0xe85ddc[_0xeca2('0x38')][_0xeca2('0xa1')]?_0xe85ddc[_0xeca2('0x38')][_0xeca2('0xa1')]:null;var _0x403460={'method':_0xe85ddc[_0xeca2('0xa2')],'uri':util[_0xeca2('0x52')](_0xeca2('0xa3'),_0x317363,_0xe85ddc[_0xeca2('0x38')][_0xeca2('0x8')]),'json':_0x219dc7,'resolveWithFullResponse':!![],'encoding':_0x1397ad,'qs':_0xe85ddc[_0xeca2('0x38')]};if(_0xe85ddc[_0xeca2('0xa4')]){_0x403460['headers']=_0xe85ddc[_0xeca2('0xa4')];if(_0x403460[_0xeca2('0xa4')][_0xeca2('0xa5')]){delete _0x403460[_0xeca2('0xa4')][_0xeca2('0xa5')];}}if(_0x403460[_0xeca2('0xa4')][_0xeca2('0xa6')]){delete _0x403460[_0xeca2('0xa4')][_0xeca2('0xa6')];}return rp(_0x403460);})[_0xeca2('0x2a')](function(_0x3caa41){if(_0x3caa41){_0xbea39c[_0xeca2('0xa7')](_0x3caa41[_0xeca2('0xa4')]);logger[_0xeca2('0x6a')](_0x3caa41[_0xeca2('0x92')]);if(_[_0xeca2('0xa8')](_0xe85ddc[_0xeca2('0x38')][_0xeca2('0x8')],_0xeca2('0x67'))&&_0x3caa41[_0xeca2('0xa9')]==0x1f4){return _0xbea39c[_0xeca2('0x1f')](_0x3caa41[_0xeca2('0xa9')]);}else{return _0xbea39c[_0xeca2('0x21')](_0x3caa41['statusCode'])[_0xeca2('0x31')](_0x3caa41['body']);}}else{return _0xbea39c['sendStatus'](0xc8);}})['catch'](handleError(_0xbea39c,null));};exports[_0xeca2('0xaa')]=function(_0x32d448,_0x338505,_0x32556e){return BPromise['resolve']()[_0xeca2('0x2a')](function(){if(!_0x32d448['query'][_0xeca2('0x8')]){throw new Error(_0xeca2('0x9c'));}if(!_0x32d448[_0xeca2('0x38')][_0xeca2('0x9d')]){throw new Error(_0xeca2('0x9e'));}var _0x22750d=_0x32d448[_0xeca2('0x38')]['hostname']?_0x32d448[_0xeca2('0x38')]['hostname']+':'+_0x32d448['query'][_0xeca2('0x9d')]:_0xeca2('0xa0')+_0x32d448[_0xeca2('0x38')]['port'];var _0x4dd689=_0x32d448[_0xeca2('0x38')][_0xeca2('0x22')]?_0x32d448[_0xeca2('0x38')][_0xeca2('0x22')]:!![];var _0xf02f46=_0x32d448['query'][_0xeca2('0xa1')]?_0x32d448[_0xeca2('0x38')][_0xeca2('0xa1')]:null;var _0x3d1a53={'method':_0x32d448[_0xeca2('0xa2')],'uri':util['format'](_0xeca2('0xa3'),_0x22750d,_0x32d448['query'][_0xeca2('0x8')]),'json':_0x4dd689,'resolveWithFullResponse':!![],'encoding':_0xf02f46,'body':_0x32d448[_0xeca2('0x92')]};if(_0x32d448[_0xeca2('0xa4')]){_0x3d1a53['headers']=_0x32d448['headers'];if(_0x3d1a53[_0xeca2('0xa4')][_0xeca2('0xa5')]){delete _0x3d1a53[_0xeca2('0xa4')]['content-length'];}}if(_0x3d1a53[_0xeca2('0xa4')][_0xeca2('0xa6')]){delete _0x3d1a53[_0xeca2('0xa4')]['content-type'];}return rp(_0x3d1a53);})[_0xeca2('0x2a')](function(_0xafc88e){if(_0xafc88e){_0x338505['set'](_0xafc88e[_0xeca2('0xa4')]);logger[_0xeca2('0x6a')](_0xafc88e['body']);return _0x338505[_0xeca2('0x21')](_0xafc88e[_0xeca2('0xa9')])[_0xeca2('0x31')](_0xafc88e[_0xeca2('0x92')]);}else{return _0x338505[_0xeca2('0x1f')](0xc8);}})[_0xeca2('0x4c')](handleError(_0x338505,null));}; \ No newline at end of file +var _0x09a8=['filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','count','includeAll','include','rows','catch','show','params','rawAttributes','download','find','join','format','basename','createWriteStream','zip','warning','code','error','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','server/files/plugins','dirname','path','node_modules/**/*','finalize','close','Error\x20while\x20downloading\x20the\x20plugin','Download\x20completed','info','Temporary\x20file\x20removed','upload','file','filename','extname','root','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','Plugin\x20manifest\x20missing','readFileSync','manifest.json','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','Invalid\x20manifest:\x20views\x20missing','views','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','icon','icon-apps','version','admin','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','test','create','body','role','userProfileId','user','UserProfileSection','autoAssociation','unlinkSync','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','update','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','set','endsWith','statusCode','webhookPost','send','eml-format','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','extract-zip','rimraf','archiver','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','redis','localhost','socket.io-emitter','./plugin.socket','register','sendStatus','status','end','json','undefined','limit','offset','Content-Range','apply','reject','save','then','get','Plugins','UserProfileResource','stack','name','index','map','Plugin','fieldName','key','query'];(function(_0x4e24e2,_0x4bf3cc){var _0x17975b=function(_0x11968a){while(--_0x11968a){_0x4e24e2['push'](_0x4e24e2['shift']());}};_0x17975b(++_0x4bf3cc);}(_0x09a8,0x12a));var _0x809a=function(_0x19c751,_0x1b9a64){_0x19c751=_0x19c751-0x0;var _0x217755=_0x09a8[_0x19c751];return _0x217755;};'use strict';var emlformat=require(_0x809a('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x809a('0x1'));var rp=require(_0x809a('0x2'));var moment=require(_0x809a('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x809a('0x4'));var util=require(_0x809a('0x5'));var path=require('path');var sox=require(_0x809a('0x6'));var csv=require(_0x809a('0x7'));var ejs=require(_0x809a('0x8'));var fs=require('fs');var fs_extra=require(_0x809a('0x9'));var _=require(_0x809a('0xa'));var squel=require(_0x809a('0xb'));var crypto=require(_0x809a('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x809a('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x809a('0xe'));var extract=require(_0x809a('0xf'));var rimraf=require(_0x809a('0x10'));var archiver=require(_0x809a('0x11'));var Redis=require('ioredis');var authService=require(_0x809a('0x12'));var qs=require(_0x809a('0x13'));var as=require(_0x809a('0x14'));var hardwareService=require(_0x809a('0x15'));var logger=require(_0x809a('0x16'))(_0x809a('0x17'));var utils=require(_0x809a('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x809a('0x19'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x809a('0x1a')],{'host':_0x809a('0x1b'),'port':0x18eb});var socket=require(_0x809a('0x1c'))(new Redis(config[_0x809a('0x1a')]));require(_0x809a('0x1d'))[_0x809a('0x1e')](socket);function respondWithStatusCode(_0x5b1b7a,_0x53c595){_0x53c595=_0x53c595||0xcc;return function(_0xd40807){if(_0xd40807){return _0x5b1b7a[_0x809a('0x1f')](_0x53c595);}return _0x5b1b7a[_0x809a('0x20')](_0x53c595)[_0x809a('0x21')]();};}function respondWithResult(_0x4bc31b,_0x57ef60){_0x57ef60=_0x57ef60||0xc8;return function(_0x1e898d){if(_0x1e898d){return _0x4bc31b[_0x809a('0x20')](_0x57ef60)[_0x809a('0x22')](_0x1e898d);}};}function respondWithFilteredResult(_0x28d9df,_0x5a71be){return function(_0x12b011){if(_0x12b011){var _0x354dd8=typeof _0x5a71be['offset']===_0x809a('0x23')&&typeof _0x5a71be[_0x809a('0x24')]===_0x809a('0x23');var _0x2d4e9f=_0x12b011['count'];var _0x4818df=_0x354dd8?0x0:_0x5a71be[_0x809a('0x25')];var _0x4a6e5a=_0x354dd8?_0x12b011['count']:_0x5a71be[_0x809a('0x25')]+_0x5a71be[_0x809a('0x24')];var _0x6feba3;if(_0x4a6e5a>=_0x2d4e9f){_0x4a6e5a=_0x2d4e9f;_0x6feba3=0xc8;}else{_0x6feba3=0xce;}_0x28d9df['status'](_0x6feba3);return _0x28d9df['set'](_0x809a('0x26'),_0x4818df+'-'+_0x4a6e5a+'/'+_0x2d4e9f)['json'](_0x12b011);}return null;};}function patchUpdates(_0x302832){return function(_0x3f182f){try{jsonpatch[_0x809a('0x27')](_0x3f182f,_0x302832,!![]);}catch(_0x49b956){return BPromise[_0x809a('0x28')](_0x49b956);}return _0x3f182f[_0x809a('0x29')]();};}function saveUpdates(_0xafad7b,_0x2f2232){return function(_0x5499ee){if(_0x5499ee){return _0x5499ee['update'](_0xafad7b)[_0x809a('0x2a')](function(_0x401390){return _0x401390;});}return null;};}function removeEntity(_0x1d2b03,_0x4f554c){return function(_0xd2e252){if(_0xd2e252){return _0xd2e252['destroy']()[_0x809a('0x2a')](function(){var _0x5f2b2d=_0xd2e252[_0x809a('0x2b')]({'plain':!![]});var _0x368611=_0x809a('0x2c');return db[_0x809a('0x2d')]['destroy']({'where':{'type':_0x368611,'resourceId':_0x5f2b2d['id']}})[_0x809a('0x2a')](function(){return _0xd2e252;});})[_0x809a('0x2a')](function(){_0x1d2b03['status'](0xcc)[_0x809a('0x21')]();});}};}function handleEntityNotFound(_0x2bc9eb,_0x552633){return function(_0x5780df){if(!_0x5780df){_0x2bc9eb['sendStatus'](0x194);}return _0x5780df;};}function handleError(_0x1b82b2,_0x1f2a41){_0x1f2a41=_0x1f2a41||0x1f4;return function(_0x346f7e){logger['error'](_0x346f7e[_0x809a('0x2e')]);if(_0x346f7e[_0x809a('0x2f')]){delete _0x346f7e[_0x809a('0x2f')];}_0x1b82b2[_0x809a('0x20')](_0x1f2a41)['send'](_0x346f7e);};}exports[_0x809a('0x30')]=function(_0x3dc043,_0x37b6a9){var _0x1adc5d={},_0x48be1e={},_0x3b477a={'count':0x0,'rows':[]};var _0x5ee5fb=_[_0x809a('0x31')](db[_0x809a('0x32')]['rawAttributes'],function(_0x5b0379){return{'name':_0x5b0379[_0x809a('0x33')],'type':_0x5b0379['type'][_0x809a('0x34')]};});_0x48be1e['model']=_[_0x809a('0x31')](_0x5ee5fb,_0x809a('0x2f'));_0x48be1e[_0x809a('0x35')]=_['keys'](_0x3dc043['query']);_0x48be1e[_0x809a('0x36')]=_[_0x809a('0x37')](_0x48be1e[_0x809a('0x38')],_0x48be1e[_0x809a('0x35')]);_0x1adc5d['attributes']=_[_0x809a('0x37')](_0x48be1e['model'],qs['fields'](_0x3dc043[_0x809a('0x35')][_0x809a('0x39')]));_0x1adc5d[_0x809a('0x3a')]=_0x1adc5d[_0x809a('0x3a')][_0x809a('0x3b')]?_0x1adc5d[_0x809a('0x3a')]:_0x48be1e['model'];if(!_0x3dc043[_0x809a('0x35')][_0x809a('0x3c')](_0x809a('0x3d'))){_0x1adc5d[_0x809a('0x24')]=qs[_0x809a('0x24')](_0x3dc043[_0x809a('0x35')][_0x809a('0x24')]);_0x1adc5d[_0x809a('0x25')]=qs[_0x809a('0x25')](_0x3dc043[_0x809a('0x35')][_0x809a('0x25')]);}_0x1adc5d[_0x809a('0x3e')]=qs[_0x809a('0x3f')](_0x3dc043['query'][_0x809a('0x3f')]);_0x1adc5d[_0x809a('0x40')]=qs[_0x809a('0x36')](_[_0x809a('0x41')](_0x3dc043['query'],_0x48be1e[_0x809a('0x36')]),_0x5ee5fb);if(_0x3dc043[_0x809a('0x35')][_0x809a('0x42')]){_0x1adc5d[_0x809a('0x40')]=_[_0x809a('0x43')](_0x1adc5d[_0x809a('0x40')],{'$or':_['map'](_0x5ee5fb,function(_0x2ef916){if(_0x2ef916[_0x809a('0x44')]!==_0x809a('0x45')){var _0x443b63={};_0x443b63[_0x2ef916[_0x809a('0x2f')]]={'$like':'%'+_0x3dc043[_0x809a('0x35')][_0x809a('0x42')]+'%'};return _0x443b63;}})});}_0x1adc5d=_['merge']({},_0x1adc5d,_0x3dc043[_0x809a('0x46')]);var _0x28f0d2={'where':_0x1adc5d[_0x809a('0x40')]};return db[_0x809a('0x32')]['count'](_0x28f0d2)['then'](function(_0x472efa){_0x3b477a[_0x809a('0x47')]=_0x472efa;if(_0x3dc043[_0x809a('0x35')][_0x809a('0x48')]){_0x1adc5d[_0x809a('0x49')]=[{'all':!![]}];}return db[_0x809a('0x32')]['findAll'](_0x1adc5d);})['then'](function(_0x416b65){_0x3b477a[_0x809a('0x4a')]=_0x416b65;return _0x3b477a;})[_0x809a('0x2a')](respondWithFilteredResult(_0x37b6a9,_0x1adc5d))[_0x809a('0x4b')](handleError(_0x37b6a9,null));};exports[_0x809a('0x4c')]=function(_0x4e3c44,_0x195a78){var _0x1888ca={'raw':!![],'where':{'id':_0x4e3c44[_0x809a('0x4d')]['id']}},_0x1587cf={};_0x1587cf[_0x809a('0x38')]=_['keys'](db[_0x809a('0x32')][_0x809a('0x4e')]);_0x1587cf[_0x809a('0x35')]=_['keys'](_0x4e3c44[_0x809a('0x35')]);_0x1587cf[_0x809a('0x36')]=_['intersection'](_0x1587cf[_0x809a('0x38')],_0x1587cf[_0x809a('0x35')]);_0x1888ca[_0x809a('0x3a')]=_[_0x809a('0x37')](_0x1587cf[_0x809a('0x38')],qs[_0x809a('0x39')](_0x4e3c44[_0x809a('0x35')][_0x809a('0x39')]));_0x1888ca[_0x809a('0x3a')]=_0x1888ca['attributes']['length']?_0x1888ca[_0x809a('0x3a')]:_0x1587cf[_0x809a('0x38')];if(_0x4e3c44['query'][_0x809a('0x48')]){_0x1888ca[_0x809a('0x49')]=[{'all':!![]}];}_0x1888ca=_[_0x809a('0x43')]({},_0x1888ca,_0x4e3c44[_0x809a('0x46')]);return db['Plugin']['find'](_0x1888ca)['then'](handleEntityNotFound(_0x195a78,null))[_0x809a('0x2a')](respondWithResult(_0x195a78,null))['catch'](handleError(_0x195a78,null));};exports[_0x809a('0x4f')]=function(_0xd9667a,_0x558c1e,_0x2dc185){return db['Plugin'][_0x809a('0x50')]({'where':{'id':_0xd9667a[_0x809a('0x4d')]['id']},'attributes':['name','path'],'raw':!![]})[_0x809a('0x2a')](handleEntityNotFound(_0x558c1e,null))['then'](function(_0x31b363){if(_0x31b363){var _0x46ca9d=path[_0x809a('0x51')](config['root'],'server/files/plugins',util[_0x809a('0x52')]('%s.zip',path[_0x809a('0x53')](_0x31b363['path'])));var _0x15820a=fs[_0x809a('0x54')](_0x46ca9d);var _0x1bd7a8=archiver(_0x809a('0x55'),{'zlib':{'level':0x9}});_0x1bd7a8['on'](_0x809a('0x56'),function(_0xb808ba){if(_0xb808ba[_0x809a('0x57')]==='ENOENT'){logger[_0x809a('0x58')](_0xb808ba);}else{throw new db[(_0x809a('0x59'))][(_0x809a('0x5a'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');}});_0x1bd7a8['on'](_0x809a('0x58'),function(_0x283ad8){throw new db['Sequelize'][(_0x809a('0x5a'))](_0x809a('0x5b'));});_0x1bd7a8[_0x809a('0x5c')](_0x15820a);_0x1bd7a8[_0x809a('0x5d')](_0x809a('0x5e'),{'cwd':path[_0x809a('0x51')](config['root'],_0x809a('0x5f'),path[_0x809a('0x60')](_0x31b363[_0x809a('0x61')])),'ignore':[path['join'](path[_0x809a('0x53')](_0x31b363[_0x809a('0x61')]),_0x809a('0x62')),path['join'](path[_0x809a('0x53')](_0x31b363[_0x809a('0x61')]),'attachments/**/*')],'nodir':!![]})[_0x809a('0x63')]();_0x15820a['on'](_0x809a('0x64'),function(){if(!fs['existsSync'](_0x46ca9d)){throw new db[(_0x809a('0x59'))][(_0x809a('0x5a'))]('Plugin\x20not\x20found');}return _0x558c1e[_0x809a('0x4f')](_0x46ca9d,util[_0x809a('0x52')]('%s.zip',path[_0x809a('0x53')](_0x31b363[_0x809a('0x61')])),function(_0x538279){if(_0x538279){throw new db['Sequelize'][(_0x809a('0x5a'))](_0x809a('0x65'));}fs['unlinkSync'](_0x46ca9d);logger['info'](_0x809a('0x66'));logger[_0x809a('0x67')](_0x809a('0x68'));});});}return null;})[_0x809a('0x4b')](handleError(_0x558c1e,null));};exports[_0x809a('0x69')]=function(_0x204142,_0x204f03,_0x24b4f8){var _0x37e7fc=path[_0x809a('0x53')](_0x204142[_0x809a('0x6a')][_0x809a('0x6b')],path[_0x809a('0x6c')](_0x204142[_0x809a('0x6a')]['filename']));var _0x4a8477=path['join'](config[_0x809a('0x6d')],_0x809a('0x5f'),_0x204142[_0x809a('0x6a')][_0x809a('0x6b')]);var _0x1f165b=path[_0x809a('0x51')](config[_0x809a('0x6d')],'server/files/plugins',_0x37e7fc);logger[_0x809a('0x67')]('Plugin\x20upload\x20filepath:\x20%s',_0x4a8477);logger[_0x809a('0x67')]('Plugin\x20upload\x20destination:\x20%s',_0x1f165b);try{fs[_0x809a('0x6e')](_0x4a8477,parseInt(_0x809a('0x6f'),0x8));extract(_0x4a8477,{'dir':_0x1f165b},function(_0x473442){if(_0x473442){logger[_0x809a('0x58')](_0x473442);handleError(_0x473442,!![]);};var _0xcdbe49=fs[_0x809a('0x70')](_0x1f165b);if(_0xcdbe49[_0x809a('0x3b')]>0x1){removeReferences(_0x4a8477,_0x1f165b);logger[_0x809a('0x58')](_0x809a('0x71'));return _0x24b4f8(new Error(_0x809a('0x71')));}var _0x486c53=fs[_0x809a('0x72')](path[_0x809a('0x51')](_0x1f165b,_0xcdbe49[0x0]));if(_0x486c53[_0x809a('0x73')]()){removeReferences(_0x4a8477,_0x1f165b);logger[_0x809a('0x58')](_0x809a('0x71'));return _0x24b4f8(new Error(_0x809a('0x71')));}if(_0x486c53[_0x809a('0x74')]()){var _0x6286b5=fs[_0x809a('0x70')](path[_0x809a('0x51')](_0x1f165b,_0xcdbe49[0x0]));if(_0x6286b5['length']===0x0){removeReferences(_0x4a8477,_0x1f165b);logger[_0x809a('0x58')]('Invalid\x20plugin\x20structure');return _0x24b4f8(new Error(_0x809a('0x71')));}var _0x43d26d=_0x6286b5[_0x809a('0x75')](function(_0x2bea87){return _0x2bea87==='manifest.json';});if(!_0x43d26d){return _0x24b4f8(new Error(_0x809a('0x76')));}var _0x162be2=fs[_0x809a('0x77')](path['join'](_0x1f165b,_0xcdbe49[0x0],_0x809a('0x78')));var _0x376e71=JSON[_0x809a('0x79')](_0x162be2);if(_0x809a('0x23')==typeof _0x376e71['name']){return _0x24b4f8(new Error(_0x809a('0x7a')));}if(_0x809a('0x23')==typeof _0x376e71[_0x809a('0x44')]){return _0x24b4f8(new Error(_0x809a('0x7b')));}if('undefined'==typeof _0x376e71['version']){return _0x24b4f8(new Error(_0x809a('0x7c')));}if(_0x809a('0x23')==typeof _0x376e71[_0x809a('0x7d')]){return _0x24b4f8(new Error(_0x809a('0x7e')));}if(_0x376e71[_0x809a('0x44')]===_0x809a('0x7f')){if(_0x809a('0x23')==typeof _0x376e71[_0x809a('0x7d')]['views']){return _0x24b4f8(new Error(_0x809a('0x80')));}if(_0x809a('0x23')==typeof _0x376e71['parameters']['views']['admin']&&_0x809a('0x23')==typeof _0x376e71[_0x809a('0x7d')][_0x809a('0x81')][_0x809a('0x82')]){return _0x24b4f8(new Error(_0x809a('0x83')));}}else if(_0x376e71[_0x809a('0x44')]===_0x809a('0x84')){if(_0x809a('0x23')==typeof _0x376e71['parameters']['scriptName']){return _0x24b4f8(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if('undefined'==typeof _0x376e71['parameters'][_0x809a('0x85')]){return _0x24b4f8(new Error(_0x809a('0x86')));}}else{return _0x24b4f8(new Error(_0x809a('0x87')));}var _0x3d52a5=_0x376e71[_0x809a('0x2f')];var _0x421185=_0x376e71[_0x809a('0x88')];var _0x4efaa8=_0x376e71[_0x809a('0x44')];var _0x362f72=_0x376e71[_0x809a('0x89')]?_0x376e71['sidebar']:'always';var _0x26732f=_0x376e71['icon']?_0x376e71[_0x809a('0x8a')]:_0x809a('0x8b');var _0x1ba2cc='';var _0x5c8c7c='';var _0x5f4909='';var _0x37c4e6='';var _0x661aa9=_0x376e71[_0x809a('0x8c')];if(_0x4efaa8===_0x809a('0x7f')){if('undefined'!=typeof _0x376e71[_0x809a('0x7d')][_0x809a('0x81')]['admin']){var _0x50e8d0=_0x376e71[_0x809a('0x7d')][_0x809a('0x81')][_0x809a('0x8d')];if(!/^(f|ht)tps?:\/\//i['test'](_0x50e8d0)){_0x1ba2cc=path['join'](_0x809a('0x8e'),_0x37e7fc,_0xcdbe49[0x0],_0x50e8d0);}else{_0x1ba2cc=_0x50e8d0;}}else{logger[_0x809a('0x67')](_0x809a('0x8f'));}if(_0x809a('0x23')!=typeof _0x376e71[_0x809a('0x7d')][_0x809a('0x81')]['agent']){var _0x59544f=_0x376e71[_0x809a('0x7d')][_0x809a('0x81')][_0x809a('0x82')];if(!/^(f|ht)tps?:\/\//i['test'](_0x59544f)){_0x5c8c7c=path[_0x809a('0x51')]('plugins',_0x37e7fc,_0xcdbe49[0x0],_0x59544f);}else{_0x5c8c7c=_0x59544f;}}else{logger[_0x809a('0x67')](_0x809a('0x90'));}}else if(_0x4efaa8==='script'){_0x5f4909=_0x376e71[_0x809a('0x7d')]['scriptName'];_0x37c4e6=_0x376e71['parameters']['scriptPath'];if(_0x809a('0x23')!=typeof _0x376e71[_0x809a('0x7d')]['views']){if(_0x809a('0x23')!=typeof _0x376e71['parameters']['views'][_0x809a('0x8d')]){var _0x50e8d0=_0x376e71['parameters'][_0x809a('0x81')][_0x809a('0x8d')];if(!/^(f|ht)tps?:\/\//i[_0x809a('0x91')](_0x50e8d0)){_0x1ba2cc=path[_0x809a('0x51')](_0x809a('0x8e'),_0x37e7fc,_0xcdbe49[0x0],_0x50e8d0);}else{_0x1ba2cc=_0x50e8d0;}}if(_0x809a('0x23')!=typeof _0x376e71[_0x809a('0x7d')]['views']['agent']){var _0x59544f=_0x376e71['parameters']['views'][_0x809a('0x82')];if(!/^(f|ht)tps?:\/\//i[_0x809a('0x91')](_0x59544f)){_0x5c8c7c=path[_0x809a('0x51')]('plugins',_0x37e7fc,_0xcdbe49[0x0],_0x59544f);}else{_0x5c8c7c=_0x59544f;}}}}var _0x5a93d8={'name':_0x3d52a5,'description':_0x421185,'path':path[_0x809a('0x51')](_0x37e7fc,_0xcdbe49[0x0]),'type':_0x4efaa8,'sidebar':_0x362f72,'icon':_0x26732f,'adminUrl':_0x1ba2cc,'agentUrl':_0x5c8c7c,'scriptName':_0x5f4909,'scriptPath':_0x37c4e6,'version':_0x661aa9};removeReferences(_0x4a8477,null);return db[_0x809a('0x32')][_0x809a('0x92')](_0x5a93d8)[_0x809a('0x2a')](function(_0x4ed8f3){var _0x5ddd1d={'role':_0x204142[_0x809a('0x93')][_0x809a('0x94')],'userProfileId':_0x204142[_0x809a('0x93')][_0x809a('0x95')]};if(!_0x5ddd1d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5ddd1d['role']===_0x809a('0x96')){var _0xc80baa=_0x4ed8f3[_0x809a('0x2b')]({'plain':!![]});return db[_0x809a('0x97')][_0x809a('0x50')]({'where':{'name':'Plugins','userProfileId':_0x5ddd1d[_0x809a('0x95')]},'raw':!![]})[_0x809a('0x2a')](function(_0x4c404c){if(_0x4c404c&&_0x4c404c[_0x809a('0x98')]===0x0){return db[_0x809a('0x2d')]['create']({'name':_0xc80baa[_0x809a('0x2f')],'resourceId':_0xc80baa['id'],'type':_0x4c404c[_0x809a('0x2f')],'sectionId':_0x4c404c['id']},{})[_0x809a('0x2a')](function(){return _0x4ed8f3;});}else{return _0x4ed8f3;}})[_0x809a('0x4b')](function(_0x5c0d1f){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5c0d1f);throw _0x5c0d1f;});}return _0x4ed8f3;})[_0x809a('0x2a')](respondWithResult(_0x204f03,null))['catch'](handleError(_0x204f03,null));}});}catch(_0x6d2dba){_0x204f03['status'](0x1f4)['send'](_0x6d2dba);}};function removeReferences(_0x9a4b2e,_0x120828){try{if(_0x9a4b2e){fs[_0x809a('0x99')](_0x9a4b2e);logger[_0x809a('0x67')](_0x809a('0x9a'));}if(_0x120828){rimraf(_0x120828,function(){});logger[_0x809a('0x67')](_0x809a('0x9b'));}}catch(_0x39aa8f){logger[_0x809a('0x58')](_0x39aa8f);}}exports[_0x809a('0x9c')]=function(_0x2bf04b,_0x3ba3a1,_0x4d7e33){return db[_0x809a('0x32')][_0x809a('0x50')]({'where':{'id':_0x2bf04b[_0x809a('0x4d')]['id']}})[_0x809a('0x2a')](handleEntityNotFound(_0x3ba3a1,null))[_0x809a('0x2a')](saveUpdates(_0x2bf04b[_0x809a('0x93')],null))[_0x809a('0x2a')](respondWithResult(_0x3ba3a1,null))[_0x809a('0x4b')](handleError(_0x3ba3a1,null));};exports[_0x809a('0x9d')]=function(_0x2d14e7,_0x3884c3,_0x928304){return db[_0x809a('0x32')]['find']({'where':{'id':_0x2d14e7[_0x809a('0x4d')]['id']}})['then'](function(_0x533d17){if(_0x533d17){return _0x533d17['destroy']();}})[_0x809a('0x2a')](function(_0x526362){rimraf(path[_0x809a('0x51')](config[_0x809a('0x6d')],_0x809a('0x5f'),path['dirname'](_0x526362[_0x809a('0x61')])),function(){});return _0x526362;})['then'](handleEntityNotFound(_0x3884c3,null))[_0x809a('0x2a')](respondWithStatusCode(_0x3884c3,null))[_0x809a('0x4b')](handleError(_0x3884c3,null));};exports[_0x809a('0x9e')]=function(_0x4011ea,_0x48aeb6,_0x4b538e){return BPromise[_0x809a('0x9f')]()[_0x809a('0x2a')](function(){if(!_0x4011ea['query'][_0x809a('0x61')]){throw new Error(_0x809a('0xa0'));}if(!_0x4011ea[_0x809a('0x35')][_0x809a('0xa1')]){throw new Error(_0x809a('0xa2'));}var _0xfd0601=_0x4011ea['query'][_0x809a('0xa3')]?_0x4011ea[_0x809a('0x35')][_0x809a('0xa3')]+':'+_0x4011ea['query'][_0x809a('0xa1')]:_0x809a('0xa4')+_0x4011ea[_0x809a('0x35')]['port'];var _0x1c089b=_0x4011ea[_0x809a('0x35')][_0x809a('0x22')]?_0x4011ea[_0x809a('0x35')][_0x809a('0x22')]:!![];var _0x10fac4=_0x4011ea[_0x809a('0x35')]['encoding']?_0x4011ea['query'][_0x809a('0xa5')]:null;var _0x21579d={'method':_0x4011ea[_0x809a('0xa6')],'uri':util[_0x809a('0x52')](_0x809a('0xa7'),_0xfd0601,_0x4011ea[_0x809a('0x35')][_0x809a('0x61')]),'json':_0x1c089b,'resolveWithFullResponse':!![],'encoding':_0x10fac4,'qs':_0x4011ea['query']};if(_0x4011ea[_0x809a('0xa8')]){_0x21579d['headers']=_0x4011ea['headers'];if(_0x21579d[_0x809a('0xa8')][_0x809a('0xa9')]){delete _0x21579d[_0x809a('0xa8')]['content-length'];}}if(_0x21579d['headers'][_0x809a('0xaa')]){delete _0x21579d[_0x809a('0xa8')]['content-type'];}return rp(_0x21579d);})[_0x809a('0x2a')](function(_0x2eeda6){if(_0x2eeda6){_0x48aeb6[_0x809a('0xab')](_0x2eeda6[_0x809a('0xa8')]);logger[_0x809a('0x67')](_0x2eeda6[_0x809a('0x93')]);if(_[_0x809a('0xac')](_0x4011ea['query'][_0x809a('0x61')],_0x809a('0x4f'))&&_0x2eeda6[_0x809a('0xad')]==0x1f4){return _0x48aeb6[_0x809a('0x1f')](_0x2eeda6[_0x809a('0xad')]);}else{return _0x48aeb6[_0x809a('0x20')](_0x2eeda6[_0x809a('0xad')])['send'](_0x2eeda6[_0x809a('0x93')]);}}else{return _0x48aeb6[_0x809a('0x1f')](0xc8);}})[_0x809a('0x4b')](handleError(_0x48aeb6,null));};exports[_0x809a('0xae')]=function(_0x4f88bb,_0x1f587a,_0xd27197){return BPromise['resolve']()['then'](function(){if(!_0x4f88bb[_0x809a('0x35')][_0x809a('0x61')]){throw new Error(_0x809a('0xa0'));}if(!_0x4f88bb[_0x809a('0x35')]['port']){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x5a692c=_0x4f88bb['query'][_0x809a('0xa3')]?_0x4f88bb[_0x809a('0x35')][_0x809a('0xa3')]+':'+_0x4f88bb[_0x809a('0x35')][_0x809a('0xa1')]:_0x809a('0xa4')+_0x4f88bb[_0x809a('0x35')]['port'];var _0x54d4d2=_0x4f88bb[_0x809a('0x35')][_0x809a('0x22')]?_0x4f88bb[_0x809a('0x35')][_0x809a('0x22')]:!![];var _0x2b4f81=_0x4f88bb[_0x809a('0x35')]['encoding']?_0x4f88bb['query'][_0x809a('0xa5')]:null;var _0x22a770={'method':_0x4f88bb[_0x809a('0xa6')],'uri':util['format'](_0x809a('0xa7'),_0x5a692c,_0x4f88bb['query'][_0x809a('0x61')]),'json':_0x54d4d2,'resolveWithFullResponse':!![],'encoding':_0x2b4f81,'body':_0x4f88bb[_0x809a('0x93')]};if(_0x4f88bb[_0x809a('0xa8')]){_0x22a770[_0x809a('0xa8')]=_0x4f88bb[_0x809a('0xa8')];if(_0x22a770[_0x809a('0xa8')]['content-length']){delete _0x22a770[_0x809a('0xa8')][_0x809a('0xa9')];}}if(_0x22a770[_0x809a('0xa8')]['content-type']){delete _0x22a770[_0x809a('0xa8')]['content-type'];}return rp(_0x22a770);})[_0x809a('0x2a')](function(_0x206b4f){if(_0x206b4f){_0x1f587a[_0x809a('0xab')](_0x206b4f[_0x809a('0xa8')]);logger[_0x809a('0x67')](_0x206b4f['body']);return _0x1f587a[_0x809a('0x20')](_0x206b4f['statusCode'])[_0x809a('0xaf')](_0x206b4f[_0x809a('0x93')]);}else{return _0x1f587a[_0x809a('0x1f')](0xc8);}})[_0x809a('0x4b')](handleError(_0x1f587a,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index f6d7774..b0bb9a8 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 _0x8ac9=['remove','emit','exports','events','../../mysqldb','Plugin','update'];(function(_0x1d7c29,_0x36682a){var _0x525823=function(_0x834784){while(--_0x834784){_0x1d7c29['push'](_0x1d7c29['shift']());}};_0x525823(++_0x36682a);}(_0x8ac9,0x199));var _0x98ac=function(_0xdc676a,_0x4c943b){_0xdc676a=_0xdc676a-0x0;var _0x468fac=_0x8ac9[_0xdc676a];return _0x468fac;};'use strict';var EventEmitter=require(_0x98ac('0x0'));var Plugin=require(_0x98ac('0x1'))['db'][_0x98ac('0x2')];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x98ac('0x3'),'afterDestroy':_0x98ac('0x4')};function emitEvent(_0xd555bb){return function(_0x59f76b,_0x4bac60,_0x18968a){PluginEvents[_0x98ac('0x5')](_0xd555bb+':'+_0x59f76b['id'],_0x59f76b);PluginEvents[_0x98ac('0x5')](_0xd555bb,_0x59f76b);_0x18968a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0x98ac('0x6')]=PluginEvents; \ No newline at end of file +var _0x5d58=['hook','update','remove','emit','hasOwnProperty'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x5d58,0x187));var _0x85d5=function(_0x36f5d5,_0xdbc597){_0x36f5d5=_0x36f5d5-0x0;var _0x54fb2e=_0x5d58[_0x36f5d5];return _0x54fb2e;};'use strict';var EventEmitter=require('events');var Plugin=require('../../mysqldb')['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x85d5('0x0'),'afterDestroy':_0x85d5('0x1')};function emitEvent(_0x53ca58){return function(_0x1469fc,_0x30bfe8,_0x54207b){PluginEvents[_0x85d5('0x2')](_0x53ca58+':'+_0x1469fc['id'],_0x1469fc);PluginEvents[_0x85d5('0x2')](_0x53ca58,_0x1469fc);_0x54207b(null);};}for(var e in events){if(events[_0x85d5('0x3')](e)){var event=events[e];Plugin[_0x85d5('0x4')](e,emitEvent(event));}}module['exports']=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index b8784dd..0af947d 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 _0x1c55=['path','rimraf','../../config/environment','exports','define','Plugin','plugins','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1c55,0x1e3));var _0x51c5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1c55[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x51c5('0x0'));var util=require(_0x51c5('0x1'));var logger=require(_0x51c5('0x2'))(_0x51c5('0x3'));var moment=require(_0x51c5('0x4'));var BPromise=require(_0x51c5('0x5'));var rp=require(_0x51c5('0x6'));var fs=require('fs');var path=require(_0x51c5('0x7'));var rimraf=require(_0x51c5('0x8'));var config=require(_0x51c5('0x9'));var attributes=require('./plugin.attributes');module[_0x51c5('0xa')]=function(_0x3e15a9,_0x1e75d7){return _0x3e15a9[_0x51c5('0xb')](_0x51c5('0xc'),attributes,{'tableName':_0x51c5('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8347=['lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./plugin.attributes','exports','define','Plugin','plugins'];(function(_0x1ca9e9,_0x1c4391){var _0x309f3c=function(_0x5ab318){while(--_0x5ab318){_0x1ca9e9['push'](_0x1ca9e9['shift']());}};_0x309f3c(++_0x1c4391);}(_0x8347,0xa9));var _0x7834=function(_0x5bc084,_0x2ef6ed){_0x5bc084=_0x5bc084-0x0;var _0x2a70de=_0x8347[_0x5bc084];return _0x2a70de;};'use strict';var _=require(_0x7834('0x0'));var util=require(_0x7834('0x1'));var logger=require('../../config/logger')(_0x7834('0x2'));var moment=require(_0x7834('0x3'));var BPromise=require(_0x7834('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7834('0x5'));var rimraf=require(_0x7834('0x6'));var config=require(_0x7834('0x7'));var attributes=require(_0x7834('0x8'));module[_0x7834('0x9')]=function(_0x4d061d,_0x5cc457){return _0x4d061d[_0x7834('0xa')](_0x7834('0xb'),attributes,{'tableName':_0x7834('0xc'),'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 75bc034..38cff18 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 _0xeabf=['body','options','raw','stringify','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','defaults','redis','localhost','./plugin.socket','request','then','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','error','code','message','catch','CreatePlugin','create'];(function(_0x1f2673,_0x51f7d5){var _0x295e29=function(_0x59ba46){while(--_0x59ba46){_0x1f2673['push'](_0x1f2673['shift']());}};_0x295e29(++_0x51f7d5);}(_0xeabf,0x159));var _0xfeab=function(_0x5d1f1b,_0x44127e){_0x5d1f1b=_0x5d1f1b-0x0;var _0x50b933=_0xeabf[_0x5d1f1b];return _0x50b933;};'use strict';var _=require(_0xfeab('0x0'));var util=require(_0xfeab('0x1'));var moment=require('moment');var BPromise=require(_0xfeab('0x2'));var rs=require(_0xfeab('0x3'));var fs=require('fs');var Redis=require(_0xfeab('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xfeab('0x5'));var logger=require(_0xfeab('0x6'))(_0xfeab('0x7'));var config=require('../../config/environment');var jayson=require(_0xfeab('0x8'));var client=jayson[_0xfeab('0x9')]['http']({'port':0x232a});config['redis']=_[_0xfeab('0xa')](config[_0xfeab('0xb')],{'host':_0xfeab('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xfeab('0xd'))['register'](socket);function respondWithRpcPromise(_0x56e665,_0x46d093,_0x161fc7){return new BPromise(function(_0x4db2db,_0x32393e){return client[_0xfeab('0xe')](_0x56e665,_0x161fc7)[_0xfeab('0xf')](function(_0x61ad1c){logger[_0xfeab('0x10')](_0xfeab('0x11'),_0x46d093,_0xfeab('0x12'));logger[_0xfeab('0x13')](_0xfeab('0x14'),_0x46d093,_0xfeab('0x12'),JSON['stringify'](_0x61ad1c));if(_0x61ad1c[_0xfeab('0x15')]){if(_0x61ad1c[_0xfeab('0x15')][_0xfeab('0x16')]===0x1f4){logger[_0xfeab('0x15')]('Plugin,\x20%s,\x20%s',_0x46d093,_0x61ad1c[_0xfeab('0x15')][_0xfeab('0x17')]);return _0x32393e(_0x61ad1c['error'][_0xfeab('0x17')]);}logger[_0xfeab('0x15')](_0xfeab('0x11'),_0x46d093,_0x61ad1c[_0xfeab('0x15')][_0xfeab('0x17')]);return _0x4db2db(_0x61ad1c[_0xfeab('0x15')][_0xfeab('0x17')]);}else{logger[_0xfeab('0x10')]('Plugin,\x20%s,\x20%s',_0x46d093,_0xfeab('0x12'));_0x4db2db(_0x61ad1c['result'][_0xfeab('0x17')]);}})[_0xfeab('0x18')](function(_0x474f15){logger[_0xfeab('0x15')](_0xfeab('0x11'),_0x46d093,_0x474f15);_0x32393e(_0x474f15);});});}exports[_0xfeab('0x19')]=function(_0xb32095){var _0x381d88=this;return new Promise(function(_0x1a375f,_0x40fb86){return db['Plugin'][_0xfeab('0x1a')](_0xb32095[_0xfeab('0x1b')],{'raw':_0xb32095[_0xfeab('0x1c')]?_0xb32095[_0xfeab('0x1c')][_0xfeab('0x1d')]===undefined?!![]:![]:!![]})[_0xfeab('0xf')](function(_0x595c70){logger[_0xfeab('0x10')](_0xfeab('0x19'),_0xb32095);logger['debug']('CreatePlugin',_0xb32095,JSON[_0xfeab('0x1e')](_0x595c70));_0x1a375f(_0x595c70);})[_0xfeab('0x18')](function(_0x231c8b){logger['error']('CreatePlugin',_0x231c8b[_0xfeab('0x17')],_0xb32095);_0x40fb86(_0x381d88['error'](0x1f4,_0x231c8b[_0xfeab('0x17')]));});});}; \ No newline at end of file +var _0xba6e=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','then','Plugin,\x20%s,\x20%s','request\x20sent','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','CreatePlugin','Plugin','create','body','options','raw','catch','lodash','util','moment','bluebird'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xba6e,0xb0));var _0xeba6=function(_0x16012d,_0x59eede){_0x16012d=_0x16012d-0x0;var _0x550b0c=_0xba6e[_0x16012d];return _0x550b0c;};'use strict';var _=require(_0xeba6('0x0'));var util=require(_0xeba6('0x1'));var moment=require(_0xeba6('0x2'));var BPromise=require(_0xeba6('0x3'));var rs=require(_0xeba6('0x4'));var fs=require('fs');var Redis=require(_0xeba6('0x5'));var db=require(_0xeba6('0x6'))['db'];var utils=require(_0xeba6('0x7'));var logger=require('../../config/logger')(_0xeba6('0x8'));var config=require(_0xeba6('0x9'));var jayson=require(_0xeba6('0xa'));var client=jayson[_0xeba6('0xb')][_0xeba6('0xc')]({'port':0x232a});config[_0xeba6('0xd')]=_[_0xeba6('0xe')](config[_0xeba6('0xd')],{'host':_0xeba6('0xf'),'port':0x18eb});var socket=require(_0xeba6('0x10'))(new Redis(config[_0xeba6('0xd')]));require(_0xeba6('0x11'))[_0xeba6('0x12')](socket);function respondWithRpcPromise(_0x122e89,_0x5b740b,_0x4c4cf8){return new BPromise(function(_0x5a00b6,_0x489c6f){return client['request'](_0x122e89,_0x4c4cf8)[_0xeba6('0x13')](function(_0x4438b9){logger['info'](_0xeba6('0x14'),_0x5b740b,_0xeba6('0x15'));logger['debug'](_0xeba6('0x16'),_0x5b740b,_0xeba6('0x15'),JSON[_0xeba6('0x17')](_0x4438b9));if(_0x4438b9[_0xeba6('0x18')]){if(_0x4438b9[_0xeba6('0x18')][_0xeba6('0x19')]===0x1f4){logger[_0xeba6('0x18')](_0xeba6('0x14'),_0x5b740b,_0x4438b9[_0xeba6('0x18')][_0xeba6('0x1a')]);return _0x489c6f(_0x4438b9[_0xeba6('0x18')][_0xeba6('0x1a')]);}logger['error'](_0xeba6('0x14'),_0x5b740b,_0x4438b9['error'][_0xeba6('0x1a')]);return _0x5a00b6(_0x4438b9['error'][_0xeba6('0x1a')]);}else{logger[_0xeba6('0x1b')]('Plugin,\x20%s,\x20%s',_0x5b740b,_0xeba6('0x15'));_0x5a00b6(_0x4438b9[_0xeba6('0x1c')]['message']);}})['catch'](function(_0x3eeadb){logger[_0xeba6('0x18')](_0xeba6('0x14'),_0x5b740b,_0x3eeadb);_0x489c6f(_0x3eeadb);});});}exports[_0xeba6('0x1d')]=function(_0xb186ad){var _0xc96129=this;return new Promise(function(_0xcfb763,_0xa85a2d){return db[_0xeba6('0x1e')][_0xeba6('0x1f')](_0xb186ad[_0xeba6('0x20')],{'raw':_0xb186ad[_0xeba6('0x21')]?_0xb186ad[_0xeba6('0x21')][_0xeba6('0x22')]===undefined?!![]:![]:!![]})[_0xeba6('0x13')](function(_0x1f7d7d){logger[_0xeba6('0x1b')](_0xeba6('0x1d'),_0xb186ad);logger['debug'](_0xeba6('0x1d'),_0xb186ad,JSON[_0xeba6('0x17')](_0x1f7d7d));_0xcfb763(_0x1f7d7d);})[_0xeba6('0x23')](function(_0x530eb3){logger[_0xeba6('0x18')](_0xeba6('0x1d'),_0x530eb3[_0xeba6('0x1a')],_0xb186ad);_0xa85a2d(_0xc96129['error'](0x1f4,_0x530eb3[_0xeba6('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 59310d2..536060a 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 _0xc48d=['./plugin.events','save','update','removeListener','length'];(function(_0xac151d,_0x4ea1d2){var _0x111dba=function(_0x13d7f4){while(--_0x13d7f4){_0xac151d['push'](_0xac151d['shift']());}};_0x111dba(++_0x4ea1d2);}(_0xc48d,0x10e));var _0xdc48=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0xc48d[_0x220dbb];return _0x2b77de;};'use strict';var PluginEvents=require(_0xdc48('0x0'));var events=[_0xdc48('0x1'),'remove',_0xdc48('0x2')];function createListener(_0x21c64c,_0x1c3e68){return function(_0x53a4d9){_0x1c3e68['emit'](_0x21c64c,_0x53a4d9);};}function removeListener(_0x43a120,_0xec63e0){return function(){PluginEvents[_0xdc48('0x3')](_0x43a120,_0xec63e0);};}exports['register']=function(_0x259bac){for(var _0x79fb10=0x0,_0x4b1cdd=events[_0xdc48('0x4')];_0x79fb10<_0x4b1cdd;_0x79fb10++){var _0x4c3e39=events[_0x79fb10];var _0x51609a=createListener('plugin:'+_0x4c3e39,_0x259bac);PluginEvents['on'](_0x4c3e39,_0x51609a);}}; \ No newline at end of file +var _0x3a7d=['remove','update','emit','removeListener','./plugin.events','save'];(function(_0x212635,_0x44f918){var _0x1ece89=function(_0x2f35b1){while(--_0x2f35b1){_0x212635['push'](_0x212635['shift']());}};_0x1ece89(++_0x44f918);}(_0x3a7d,0x136));var _0xd3a7=function(_0x5455b0,_0x5bd460){_0x5455b0=_0x5455b0-0x0;var _0x2d5aec=_0x3a7d[_0x5455b0];return _0x2d5aec;};'use strict';var PluginEvents=require(_0xd3a7('0x0'));var events=[_0xd3a7('0x1'),_0xd3a7('0x2'),_0xd3a7('0x3')];function createListener(_0x392908,_0x552192){return function(_0x3fa112){_0x552192[_0xd3a7('0x4')](_0x392908,_0x3fa112);};}function removeListener(_0x973d2e,_0x28f493){return function(){PluginEvents[_0xd3a7('0x5')](_0x973d2e,_0x28f493);};}exports['register']=function(_0x2120b4){for(var _0x985cbc=0x0,_0x279851=events['length'];_0x985cbc<_0x279851;_0x985cbc++){var _0x53b0d1=events[_0x985cbc];var _0x338b3b=createListener('plugin:'+_0x53b0d1,_0x2120b4);PluginEvents['on'](_0x53b0d1,_0x338b3b);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 1d52598..edeabd1 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(_0x576440,_0x4b6be3){var _0x692134=function(_0x5453b8){while(--_0x5453b8){_0x576440['push'](_0x576440['shift']());}};_0x692134(++_0x4b6be3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xa9e0[_0x55f8b4];return _0x2475f9;};'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(_0x41bf2,_0x3ea33b){var _0x3b8429=function(_0x437979){while(--_0x437979){_0x41bf2['push'](_0x41bf2['shift']());}};_0x3b8429(++_0x3ea33b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xa9e0[_0x5c351c];return _0x26f3b3;};'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 4ed31a1..6842cb6 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 _0xb58b=['Unknown\x20status','destroy','params','delete','Unknown\x20id','../../config/pm2','../../config/logger','api','child_process','exec','sendStatus','status','json','error','stack','name','npm\x20install','info','list','then','reject','motion2','length','describe','catch','create','body','join','../../files/plugins','script','cwd','chdir','dirname','start','dump','send','Missing\x20name\x20and/or\x20path','update','restart','stop','hasOwnProperty'];(function(_0x1599cb,_0x10cf03){var _0x1ebb6d=function(_0x44e8e2){while(--_0x44e8e2){_0x1599cb['push'](_0x1599cb['shift']());}};_0x1ebb6d(++_0x10cf03);}(_0xb58b,0x1f1));var _0xbb58=function(_0x5ca823,_0x3e56f1){_0x5ca823=_0x5ca823-0x0;var _0x59ba1a=_0xb58b[_0x5ca823];return _0x59ba1a;};'use strict';var _=require('lodash');var pm2=require(_0xbb58('0x0'));var logger=require(_0xbb58('0x1'))(_0xbb58('0x2'));var path=require('path');var exec=require(_0xbb58('0x3'))[_0xbb58('0x4')];var BPromise=require('bluebird');function handleEntityNotFound(_0x226363,_0x546510){return function(_0x2edb10){if(!_0x2edb10){_0x226363[_0xbb58('0x5')](0x194);;}return _0x2edb10;};}function respondWithResult(_0x33fe85,_0x5cf8b1){_0x5cf8b1=_0x5cf8b1||0xc8;return function(_0x27cbda){if(_0x27cbda){return _0x33fe85[_0xbb58('0x6')](_0x5cf8b1)[_0xbb58('0x7')](_0x27cbda);}return null;};}function handleError(_0x5d7fe8,_0xd94f1){_0xd94f1=_0xd94f1||0x1f4;return function(_0x3e3144){logger[_0xbb58('0x8')](_0x3e3144[_0xbb58('0x9')]);if(_0x3e3144[_0xbb58('0xa')]){delete _0x3e3144[_0xbb58('0xa')];}_0x5d7fe8[_0xbb58('0x6')](_0xd94f1)['send'](_0x3e3144);};}function execChildProcess(){return new BPromise(function(_0x80ab3a,_0x5c3bf7){exec(_0xbb58('0xb'),function(_0x440392,_0x26d8e6,_0x19d185){logger['info'](_0x26d8e6);logger[_0xbb58('0xc')](_0x19d185);if(_0x440392){logger[_0xbb58('0x8')](_0x440392);return _0x5c3bf7(_0x440392);}return _0x80ab3a(_0x26d8e6);});});}exports['index']=function(_0x132511,_0xdc68b9){return pm2[_0xbb58('0xd')]()[_0xbb58('0xe')](function(_0x19ceda){if(_0x19ceda){var _0x58245f=_[_0xbb58('0xf')](_0x19ceda,function(_0x23fd15){return _0x23fd15['name']==='express'||_0x23fd15[_0xbb58('0xa')]===_0xbb58('0x10');});return{'rows':_0x58245f,'count':_0x58245f[_0xbb58('0x11')]};}return null;})['then'](respondWithResult(_0xdc68b9,null))['catch'](handleError(_0xdc68b9,null));};exports['show']=function(_0x55156e,_0x28637b){return pm2[_0xbb58('0x12')](_0x55156e['params']['id'])[_0xbb58('0xe')](respondWithResult(_0x28637b,null))['then'](handleEntityNotFound(_0x28637b,null))[_0xbb58('0x13')](handleError(_0x28637b,null));};exports[_0xbb58('0x14')]=function(_0x3c33d9,_0xb8f982){if(_0x3c33d9[_0xbb58('0x15')][_0xbb58('0xa')]&&_0x3c33d9[_0xbb58('0x15')]['script']){var _0x84f34=path[_0xbb58('0x16')](__dirname,_0xbb58('0x17'),_0x3c33d9[_0xbb58('0x15')][_0xbb58('0x18')]);var _0x5d4a91=process[_0xbb58('0x19')]();process[_0xbb58('0x1a')](path[_0xbb58('0x1b')](_0x84f34));return execChildProcess()['then'](function(_0x27806d){process['chdir'](_0x5d4a91);return pm2[_0xbb58('0x1c')]({'name':_0x3c33d9[_0xbb58('0x15')][_0xbb58('0xa')],'script':_0x84f34});})[_0xbb58('0xe')](function(_0x2d111c){pm2[_0xbb58('0x1d')]();return _0x2d111c[0x0];})[_0xbb58('0xe')](respondWithResult(_0xb8f982,0xc9))[_0xbb58('0x13')](handleError(_0xb8f982,null));}else{return _0xb8f982['status'](0x1f4)[_0xbb58('0x1e')]({'message':_0xbb58('0x1f')});}};exports[_0xbb58('0x20')]=function(_0x129094,_0x8e9ed9){if(_0x129094[_0xbb58('0x15')]['id']){delete _0x129094[_0xbb58('0x15')]['id'];}var _0x2ce7c3={'online':_0xbb58('0x21'),'stopped':_0xbb58('0x22')};if(_0x2ce7c3[_0xbb58('0x23')](_0x129094[_0xbb58('0x15')][_0xbb58('0x6')])){return pm2[_0x2ce7c3[_0x129094[_0xbb58('0x15')][_0xbb58('0x6')]]](_0x129094['params']['id'])[_0xbb58('0xe')](respondWithResult(_0x8e9ed9,0xc8))[_0xbb58('0x13')](handleError(_0x8e9ed9,null));}else{return _0x8e9ed9[_0xbb58('0x6')](0x1f4)[_0xbb58('0x1e')]({'message':_0xbb58('0x24')});}};exports[_0xbb58('0x25')]=function(_0x1ba526,_0x643e0e){if(_0x1ba526[_0xbb58('0x15')]['id']){delete _0x1ba526['body']['id'];}if(_0x1ba526[_0xbb58('0x26')]['id']){return pm2[_0xbb58('0x27')](_0x1ba526[_0xbb58('0x26')]['id'])[_0xbb58('0xe')](function(_0xdbbe7b){pm2[_0xbb58('0x1d')]();return _0xdbbe7b[0x0];})[_0xbb58('0xe')](respondWithResult(_0x643e0e,null))[_0xbb58('0x13')](handleError(_0x643e0e,null));}else{return _0x643e0e[_0xbb58('0x6')](0x1f4)[_0xbb58('0x1e')]({'message':_0xbb58('0x28')});}}; \ No newline at end of file +var _0xf72b=['hasOwnProperty','Unknown\x20status','destroy','params','delete','lodash','../../config/logger','path','child_process','bluebird','sendStatus','status','json','stack','name','npm\x20install','info','index','then','express','motion2','length','catch','show','describe','create','body','script','join','../../files/plugins','cwd','dirname','start','dump','send','Missing\x20name\x20and/or\x20path','update','restart','stop'];(function(_0x13b02f,_0x462a53){var _0x12e9a6=function(_0x187d57){while(--_0x187d57){_0x13b02f['push'](_0x13b02f['shift']());}};_0x12e9a6(++_0x462a53);}(_0xf72b,0x1d9));var _0xbf72=function(_0x5230b2,_0x39207f){_0x5230b2=_0x5230b2-0x0;var _0xb890e2=_0xf72b[_0x5230b2];return _0xb890e2;};'use strict';var _=require(_0xbf72('0x0'));var pm2=require('../../config/pm2');var logger=require(_0xbf72('0x1'))('api');var path=require(_0xbf72('0x2'));var exec=require(_0xbf72('0x3'))['exec'];var BPromise=require(_0xbf72('0x4'));function handleEntityNotFound(_0x550a9e,_0x37afc8){return function(_0x3d3a6f){if(!_0x3d3a6f){_0x550a9e[_0xbf72('0x5')](0x194);;}return _0x3d3a6f;};}function respondWithResult(_0x2b8440,_0x5ee060){_0x5ee060=_0x5ee060||0xc8;return function(_0x41c11d){if(_0x41c11d){return _0x2b8440[_0xbf72('0x6')](_0x5ee060)[_0xbf72('0x7')](_0x41c11d);}return null;};}function handleError(_0xd0402c,_0xdd6177){_0xdd6177=_0xdd6177||0x1f4;return function(_0x1b6d38){logger['error'](_0x1b6d38[_0xbf72('0x8')]);if(_0x1b6d38['name']){delete _0x1b6d38[_0xbf72('0x9')];}_0xd0402c[_0xbf72('0x6')](_0xdd6177)['send'](_0x1b6d38);};}function execChildProcess(){return new BPromise(function(_0xaec095,_0x1c3453){exec(_0xbf72('0xa'),function(_0x145acb,_0x2957c5,_0x44ce73){logger[_0xbf72('0xb')](_0x2957c5);logger[_0xbf72('0xb')](_0x44ce73);if(_0x145acb){logger['error'](_0x145acb);return _0x1c3453(_0x145acb);}return _0xaec095(_0x2957c5);});});}exports[_0xbf72('0xc')]=function(_0x227a35,_0x57cccf){return pm2['list']()[_0xbf72('0xd')](function(_0x4f4fa5){if(_0x4f4fa5){var _0x5625b3=_['reject'](_0x4f4fa5,function(_0x32a0a5){return _0x32a0a5[_0xbf72('0x9')]===_0xbf72('0xe')||_0x32a0a5[_0xbf72('0x9')]===_0xbf72('0xf');});return{'rows':_0x5625b3,'count':_0x5625b3[_0xbf72('0x10')]};}return null;})['then'](respondWithResult(_0x57cccf,null))[_0xbf72('0x11')](handleError(_0x57cccf,null));};exports[_0xbf72('0x12')]=function(_0x2a8609,_0x3d4dea){return pm2[_0xbf72('0x13')](_0x2a8609['params']['id'])['then'](respondWithResult(_0x3d4dea,null))[_0xbf72('0xd')](handleEntityNotFound(_0x3d4dea,null))[_0xbf72('0x11')](handleError(_0x3d4dea,null));};exports[_0xbf72('0x14')]=function(_0x2584d9,_0x27e58e){if(_0x2584d9[_0xbf72('0x15')][_0xbf72('0x9')]&&_0x2584d9['body'][_0xbf72('0x16')]){var _0x42a193=path[_0xbf72('0x17')](__dirname,_0xbf72('0x18'),_0x2584d9[_0xbf72('0x15')]['script']);var _0x3cd181=process[_0xbf72('0x19')]();process['chdir'](path[_0xbf72('0x1a')](_0x42a193));return execChildProcess()[_0xbf72('0xd')](function(_0x267c41){process['chdir'](_0x3cd181);return pm2[_0xbf72('0x1b')]({'name':_0x2584d9[_0xbf72('0x15')][_0xbf72('0x9')],'script':_0x42a193});})[_0xbf72('0xd')](function(_0x4f4dc0){pm2[_0xbf72('0x1c')]();return _0x4f4dc0[0x0];})[_0xbf72('0xd')](respondWithResult(_0x27e58e,0xc9))[_0xbf72('0x11')](handleError(_0x27e58e,null));}else{return _0x27e58e['status'](0x1f4)[_0xbf72('0x1d')]({'message':_0xbf72('0x1e')});}};exports[_0xbf72('0x1f')]=function(_0x1a2f55,_0x15d60d){if(_0x1a2f55[_0xbf72('0x15')]['id']){delete _0x1a2f55[_0xbf72('0x15')]['id'];}var _0x25ecdf={'online':_0xbf72('0x20'),'stopped':_0xbf72('0x21')};if(_0x25ecdf[_0xbf72('0x22')](_0x1a2f55[_0xbf72('0x15')][_0xbf72('0x6')])){return pm2[_0x25ecdf[_0x1a2f55[_0xbf72('0x15')][_0xbf72('0x6')]]](_0x1a2f55['params']['id'])[_0xbf72('0xd')](respondWithResult(_0x15d60d,0xc8))[_0xbf72('0x11')](handleError(_0x15d60d,null));}else{return _0x15d60d[_0xbf72('0x6')](0x1f4)[_0xbf72('0x1d')]({'message':_0xbf72('0x23')});}};exports[_0xbf72('0x24')]=function(_0x35ecdc,_0x209b2b){if(_0x35ecdc[_0xbf72('0x15')]['id']){delete _0x35ecdc[_0xbf72('0x15')]['id'];}if(_0x35ecdc[_0xbf72('0x25')]['id']){return pm2[_0xbf72('0x26')](_0x35ecdc[_0xbf72('0x25')]['id'])[_0xbf72('0xd')](function(_0x4e2472){pm2[_0xbf72('0x1c')]();return _0x4e2472[0x0];})[_0xbf72('0xd')](respondWithResult(_0x209b2b,null))[_0xbf72('0x11')](handleError(_0x209b2b,null));}else{return _0x209b2b['status'](0x1f4)['send']({'message':'Unknown\x20id'});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index eac717a..32adf28 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 _0x9107=['/queues','getQueues','express','Router','../../components/auth/service','get','isAuthenticated','getAgents'];(function(_0x192703,_0x4f0882){var _0x2ff606=function(_0x473e94){while(--_0x473e94){_0x192703['push'](_0x192703['shift']());}};_0x2ff606(++_0x4f0882);}(_0x9107,0xaa));var _0x7910=function(_0x3bd4ad,_0x4eda97){_0x3bd4ad=_0x3bd4ad-0x0;var _0x455416=_0x9107[_0x3bd4ad];return _0x455416;};'use strict';var express=require(_0x7910('0x0'));var router=express[_0x7910('0x1')]();var auth=require(_0x7910('0x2'));var controller=require('./realtime.controller');router[_0x7910('0x3')]('/agents',auth[_0x7910('0x4')](),controller[_0x7910('0x5')]);router['get'](_0x7910('0x6'),auth[_0x7910('0x4')](),controller[_0x7910('0x7')]);module['exports']=router; \ No newline at end of file +var _0x85a1=['/agents','isAuthenticated','getAgents','/queues','exports','express','./realtime.controller','get'];(function(_0x446f00,_0x19769e){var _0x35fff3=function(_0x3c5308){while(--_0x3c5308){_0x446f00['push'](_0x446f00['shift']());}};_0x35fff3(++_0x19769e);}(_0x85a1,0x145));var _0x185a=function(_0x21632a,_0x28f971){_0x21632a=_0x21632a-0x0;var _0x30b01d=_0x85a1[_0x21632a];return _0x30b01d;};'use strict';var express=require(_0x185a('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0x185a('0x1'));router[_0x185a('0x2')](_0x185a('0x3'),auth[_0x185a('0x4')](),controller[_0x185a('0x5')]);router[_0x185a('0x2')](_0x185a('0x6'),auth['isAuthenticated'](),controller['getQueues']);module[_0x185a('0x7')]=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index 487050d..3aba174 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 _0x61d8=['../../errors/api','APIBadRequestError','offset','undefined','limit','count','status','Content-Range','json','getAgents','getChannels','query','globalStatusFilter','pauseTypeFilter','*pause','channel','isValidChannel','format','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','sort','validateSortParameter','getUpdatedSortOptions','order','then','getAgentIdsByQueues','getRealtimeAgents','getSortedAgentsIdsByStatus','getAgentIdsByStatus','fieldName','type','key','role','agent','getOptions','length','push','sequelize','FIELD(id,','forEach','Pause','where','merge','user','userProfileId','Agents','online','extraQueryConditions','assign','UserProfile','getResources','User','findAndCountAll','map','globalStatus','includes','pause','voice','voiceStatus','talking','Status','sortAgentsByStatus','getRealtimeAgentsQueryFields','rows','catch','getQueues','resolve','startCase','Queue','name','outbound','dialActive','dialMethod','join','QueueCampaigns','Queues','filter','getRealtimeQueues','lodash','util','../../components/realtime/agents','../../components/realtime/queues','../../components/parsers/qs','../../mysqldb'];(function(_0x2f70ff,_0x4e8a69){var _0x310b5b=function(_0x46fa3b){while(--_0x46fa3b){_0x2f70ff['push'](_0x2f70ff['shift']());}};_0x310b5b(++_0x4e8a69);}(_0x61d8,0xa2));var _0x861d=function(_0x17720a,_0x3eb653){_0x17720a=_0x17720a-0x0;var _0x266afa=_0x61d8[_0x17720a];return _0x266afa;};'use strict';var _=require(_0x861d('0x0'));var util=require(_0x861d('0x1'));var rta=require(_0x861d('0x2'));var rtq=require(_0x861d('0x3'));var qs=require(_0x861d('0x4'));var utils=require('../../config/utils');var db=require(_0x861d('0x5'))['db'];var APIBadRequestError=require(_0x861d('0x6'))[_0x861d('0x7')];var APIHandleError=require(_0x861d('0x6'))['handleError'];function respondWithFilteredResult(_0x338b50,_0x1db5d4){return function(_0x276ff3){if(_0x276ff3){var _0xb8a1b=typeof _0x1db5d4[_0x861d('0x8')]===_0x861d('0x9')&&typeof _0x1db5d4[_0x861d('0xa')]==='undefined';var _0x633e49=_0x276ff3[_0x861d('0xb')];var _0x3df2d9=_0xb8a1b?0x0:_0x1db5d4[_0x861d('0x8')];var _0x59cc93=_0xb8a1b?_0x276ff3['count']:_0x1db5d4[_0x861d('0x8')]+_0x1db5d4['limit'];var _0x72b624;if(_0x59cc93>=_0x633e49){_0x59cc93=_0x633e49;_0x72b624=0xc8;}else{_0x72b624=0xce;}_0x338b50[_0x861d('0xc')](_0x72b624);return _0x338b50['set'](_0x861d('0xd'),_0x3df2d9+'-'+_0x59cc93+'/'+_0x633e49)[_0x861d('0xe')](_0x276ff3);}return null;};}exports[_0x861d('0xf')]=function(_0x25152a,_0xeb29ed){var _0x491a36={'count':0x0,'rows':[]};var _0x576729={};var _0x5a2530;var _0x434c53=utils[_0x861d('0x10')]();var _0x2baf69;var _0x21202f;var _0x2230b4=_0x25152a['query']['globalQueueFilter'];var _0x18775c=_0x25152a[_0x861d('0x11')][_0x861d('0x12')];var _0x39666d=_0x25152a['query'][_0x861d('0x13')];var _0x5e88a3=_0x18775c==='pause'||_0x18775c===_0x861d('0x14')?!![]:![];var _0x22120b=[];var _0x44c16f;var _0x21f469;Promise['resolve']()['then'](function(){if(_0x25152a[_0x861d('0x11')][_0x861d('0x15')]){if(!utils[_0x861d('0x16')](_0x25152a[_0x861d('0x11')]['channel'])){throw new APIBadRequestError(util[_0x861d('0x17')](_0x861d('0x18'),_0x25152a[_0x861d('0x11')][_0x861d('0x15')]));}_0x5a2530=_0x25152a[_0x861d('0x11')][_0x861d('0x15')][_0x861d('0x19')]();}if(!_0x25152a[_0x861d('0x11')][_0x861d('0x1a')]||!_0x25152a['query'][_0x861d('0x1a')]['includes']('globalStatus')){_0x25152a[_0x861d('0x11')]['sort']=rta[_0x861d('0x1b')](_0x25152a[_0x861d('0x11')][_0x861d('0x1a')]);return;}var _0x20c878=rta[_0x861d('0x1c')](_0x25152a[_0x861d('0x11')][_0x861d('0x1a')]);_0x25152a[_0x861d('0x11')]['sort']=_0x20c878['fields']['join'](',');_0x44c16f=_0x20c878[_0x861d('0x1d')];})[_0x861d('0x1e')](function(){if(!_0x2230b4){return[];}return rta[_0x861d('0x1f')](_0x2230b4,_0x5a2530);})[_0x861d('0x1e')](function(_0x1e0a98){_0x22120b=_0x1e0a98;return rta[_0x861d('0x20')]();})['then'](function(_0xe38a28){_0x21202f=_0xe38a28['rows'];if((!_0x18775c||_0x5e88a3)&&!_0x44c16f){return _0x22120b;}if(_0x44c16f&&!_0x18775c){return rta[_0x861d('0x21')](_0x21202f,_0x22120b,_0x44c16f);}else{return rta[_0x861d('0x22')](_0x21202f,_0x22120b,_0x18775c);}})[_0x861d('0x1e')](function(_0x56203c){_0x22120b=_0x56203c;var _0x2ed0ea=![];if(_0x22120b['length']===0x0){if(_0x2230b4||_0x18775c){_0x2ed0ea=!![];}if(_0x5e88a3){_0x2ed0ea=![];}}if(_0x2ed0ea){return _0x491a36;}var _0x46653f=_['map'](db['User']['rawAttributes'],function(_0x3d5758){return{'name':_0x3d5758[_0x861d('0x23')],'type':_0x3d5758[_0x861d('0x24')][_0x861d('0x25')]};});_0x25152a['query'][_0x861d('0x26')]=_0x861d('0x27');_0x576729=qs[_0x861d('0x28')](_0x46653f,_0x25152a);_0x576729['raw']=!![];var _0x5d8fae=[];if(_0x22120b[_0x861d('0x29')]>0x0){_0x5d8fae[_0x861d('0x2a')]({'id':{'$in':_0x22120b}});if(_0x44c16f&&!_0x18775c){_0x21f469=[db[_0x861d('0x2b')]['literal'](_0x861d('0x2c')+_0x22120b+')')];_0x576729[_0x861d('0x1d')]=_0x21f469;}}if(_0x5e88a3){_0x434c53[_0x861d('0x2d')](function(_0x405f2b){var _0x32f9ed=!![];if(_0x18775c==='*pause'&&_0x5a2530!==_0x405f2b){_0x32f9ed=![];}_0x5d8fae[_0x861d('0x2a')]({[_0x405f2b+_0x861d('0x2e')]:_0x32f9ed});});if(_0x39666d){_0x5d8fae['push']({'pauseType':_0x39666d});}}else if(_0x18775c){_0x434c53[_0x861d('0x2d')](function(_0x17f330){_0x5d8fae[_0x861d('0x2a')]({[_0x17f330+_0x861d('0x2e')]:![]});});}_0x576729[_0x861d('0x2f')]=_[_0x861d('0x30')](_0x576729[_0x861d('0x2f')],{'$and':_0x5d8fae});if(_0x25152a[_0x861d('0x31')][_0x861d('0x26')]===_0x861d('0x31')){var _0x2eb7b6={'params':{'id':_0x25152a[_0x861d('0x31')][_0x861d('0x32')]},'query':{'section':_0x861d('0x33'),'role':'agent','raw':!![],'ids':_0x22120b,'customSorting':_0x21f469}};if(_0x25152a['query']['online']){_0x2eb7b6[_0x861d('0x11')][_0x861d('0x34')]=!![];}if(_0x5e88a3){_0x2eb7b6['query'][_0x861d('0x35')]=_0x5d8fae;}_0x2eb7b6[_0x861d('0x11')]=Object[_0x861d('0x36')](_0x2eb7b6[_0x861d('0x11')],_0x25152a['query']);return db[_0x861d('0x37')][_0x861d('0x38')](_0x2eb7b6);}return db[_0x861d('0x39')][_0x861d('0x3a')](_0x576729);})[_0x861d('0x1e')](function(_0x355dce){_0x491a36['count']=_0x355dce[_0x861d('0xb')];_0x2baf69=_0x355dce['rows'];return _0x2baf69[_0x861d('0x3b')](function(_0xa0a12a){var _0x14b251=_['find'](_0x21202f,['id',_0xa0a12a['id']]);if(_0x14b251){var _0x45ab72=rta['filterAgentAttributes'](_0x14b251);_[_0x861d('0x30')](_0xa0a12a,_0x45ab72);}_0xa0a12a[_0x861d('0x3c')]=rta['getAgentStatus'](_0xa0a12a);if(_0xa0a12a[_0x861d('0x3c')][_0x861d('0x3d')](_0x861d('0x3e'))){_0x434c53[_0x861d('0x2d')](function(_0x303dd2){if(_0xa0a12a[_0x303dd2+_0x861d('0x2e')]){if(_0x303dd2===_0x861d('0x3f')){if(_0xa0a12a[_0x861d('0x40')]!==_0x861d('0x41')){_0xa0a12a[_0x861d('0x40')]=_0x861d('0x3e');}}else{_0xa0a12a[_0x303dd2+_0x861d('0x42')]=_0x861d('0x3e');}}});}return _0xa0a12a;});})[_0x861d('0x1e')](function(_0x595857){if(!_0x44c16f||_0x21f469){return _0x595857;}return rta[_0x861d('0x43')](_0x595857,_0x44c16f);})[_0x861d('0x1e')](function(_0x1a1bb7){var _0x487c87=rta[_0x861d('0x44')]();_0x491a36[_0x861d('0x45')]=_0x1a1bb7[_0x861d('0x3b')](function(_0x17924f){return _['pick'](_0x17924f,_0x487c87);});return _0x491a36;})['then'](respondWithFilteredResult(_0xeb29ed,_0x576729))[_0x861d('0x46')](APIHandleError(_0xeb29ed));};exports[_0x861d('0x47')]=function(_0xbd2e05,_0x3b50ec){var _0x5a8232={'count':0x0,'rows':[]};var _0x39c18d={};var _0x31df5b;var _0x1e7209;var _0x4b6a1a;Promise[_0x861d('0x48')]()[_0x861d('0x1e')](function(){if(_0xbd2e05[_0x861d('0x11')][_0x861d('0x15')]){if(!utils['isValidChannel'](_0xbd2e05['query'][_0x861d('0x15')])){throw new APIBadRequestError(util['format'](_0x861d('0x18'),_0xbd2e05[_0x861d('0x11')]['channel']));}_0x31df5b=_0xbd2e05['query'][_0x861d('0x15')][_0x861d('0x19')]();}var _0x1f15c4=_[_0x861d('0x49')](_0x31df5b)+_0x861d('0x4a');var _0x1f4a78=_[_0x861d('0x3b')](db[_0x1f15c4]['rawAttributes'],function(_0x1ecf28){return{'name':_0x1ecf28[_0x861d('0x23')],'type':_0x1ecf28['type'][_0x861d('0x25')]};});if(!_0xbd2e05[_0x861d('0x11')]['fields']){var _0x3e269e=['id',_0x861d('0x4b')];if(_0x31df5b==='voice'){_0x3e269e[_0x861d('0x2a')](_0x861d('0x24'));if(_0xbd2e05[_0x861d('0x11')]['type']===_0x861d('0x4c')){_0x3e269e[_0x861d('0x2a')]([_0x861d('0x4d'),_0x861d('0x4e')]);}}_0xbd2e05[_0x861d('0x11')]['fields']=_0x3e269e[_0x861d('0x4f')](',');}_0x39c18d=qs[_0x861d('0x28')](_0x1f4a78,_0xbd2e05);if(_0xbd2e05[_0x861d('0x31')][_0x861d('0x26')]==='user'){var _0x1896db={'params':{'id':_0xbd2e05['user'][_0x861d('0x32')]},'query':{'section':_0x31df5b===_0x861d('0x3f')&&_0xbd2e05[_0x861d('0x11')][_0x861d('0x24')]===_0x861d('0x4c')?_0x861d('0x50'):_['startCase'](_0x31df5b)+_0x861d('0x51'),'type':_0xbd2e05[_0x861d('0x11')]['type'],'nolimit':!![],'sort':_0x861d('0x4b'),'filter':_0xbd2e05[_0x861d('0x11')][_0x861d('0x52')]}};_0x1896db[_0x861d('0x11')]=Object[_0x861d('0x36')](_0x1896db['query'],_0xbd2e05['query']);delete _0x1896db[_0x861d('0x11')]['id'];return db[_0x861d('0x37')][_0x861d('0x38')](_0x1896db);}return db[_0x1f15c4][_0x861d('0x3a')](_0x39c18d);})[_0x861d('0x1e')](function(_0x3937cd){_0x5a8232['count']=_0x3937cd['count'];_0x1e7209=_0x3937cd['rows'];return rtq[_0x861d('0x53')](_0xbd2e05,_0x31df5b);})[_0x861d('0x1e')](function(_0x2ca51f){_0x4b6a1a=_0x2ca51f[_0x861d('0x45')];return rtq['initializeQueues'](_0x1e7209,_0x4b6a1a,_0x31df5b,_0xbd2e05['query'][_0x861d('0x24')]);})['then'](function(_0x11b7c6){_0x5a8232[_0x861d('0x45')]=_0x11b7c6;return _0x5a8232;})[_0x861d('0x1e')](respondWithFilteredResult(_0x3b50ec,_0x39c18d))[_0x861d('0x46')](APIHandleError(_0x3b50ec));}; \ No newline at end of file +var _0xd2ce=['order','push','Pause','where','merge','user','role','userProfileId','online','extraQueryConditions','assign','getResources','User','findAndCountAll','map','find','filterAgentAttributes','getAgentStatus','includes','voice','voiceStatus','talking','sortAgentsByStatus','getRealtimeAgentsQueryFields','pick','catch','getQueues','format','startCase','fieldName','key','outbound','dialActive','dialMethod','QueueCampaigns','filter','getRealtimeQueues','util','../../components/realtime/agents','../../components/realtime/queues','../../components/parsers/qs','../../config/utils','../../mysqldb','../../errors/api','undefined','limit','count','offset','status','set','Content-Range','json','getAgents','getChannels','globalQueueFilter','query','globalStatusFilter','pauseTypeFilter','pause','*pause','resolve','then','channel','isValidChannel','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','sort','globalStatus','validateSortParameter','getUpdatedSortOptions','fields','join','getAgentIdsByQueues','getRealtimeAgents','rows','getSortedAgentsIdsByStatus','getAgentIdsByStatus','length','rawAttributes','type','getOptions','FIELD(id,'];(function(_0x4450b1,_0x214ace){var _0x399b0b=function(_0x2197df){while(--_0x2197df){_0x4450b1['push'](_0x4450b1['shift']());}};_0x399b0b(++_0x214ace);}(_0xd2ce,0x16d));var _0xed2c=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xd2ce[_0x5b644e];return _0x49c6bf;};'use strict';var _=require('lodash');var util=require(_0xed2c('0x0'));var rta=require(_0xed2c('0x1'));var rtq=require(_0xed2c('0x2'));var qs=require(_0xed2c('0x3'));var utils=require(_0xed2c('0x4'));var db=require(_0xed2c('0x5'))['db'];var APIBadRequestError=require(_0xed2c('0x6'))['APIBadRequestError'];var APIHandleError=require('../../errors/api')['handleError'];function respondWithFilteredResult(_0x397df5,_0x5edc8e){return function(_0x5ca85e){if(_0x5ca85e){var _0x937158=typeof _0x5edc8e['offset']===_0xed2c('0x7')&&typeof _0x5edc8e[_0xed2c('0x8')]===_0xed2c('0x7');var _0x23a5f2=_0x5ca85e[_0xed2c('0x9')];var _0x3ffb0d=_0x937158?0x0:_0x5edc8e[_0xed2c('0xa')];var _0x5c49e4=_0x937158?_0x5ca85e[_0xed2c('0x9')]:_0x5edc8e[_0xed2c('0xa')]+_0x5edc8e[_0xed2c('0x8')];var _0x28bd7b;if(_0x5c49e4>=_0x23a5f2){_0x5c49e4=_0x23a5f2;_0x28bd7b=0xc8;}else{_0x28bd7b=0xce;}_0x397df5[_0xed2c('0xb')](_0x28bd7b);return _0x397df5[_0xed2c('0xc')](_0xed2c('0xd'),_0x3ffb0d+'-'+_0x5c49e4+'/'+_0x23a5f2)[_0xed2c('0xe')](_0x5ca85e);}return null;};}exports[_0xed2c('0xf')]=function(_0x18f79d,_0xcc704d){var _0x4f5621={'count':0x0,'rows':[]};var _0x465f49={};var _0x3e42e7;var _0x3e3acf=utils[_0xed2c('0x10')]();var _0x16f89d;var _0x5449ea;var _0x882656=_0x18f79d['query'][_0xed2c('0x11')];var _0x264f30=_0x18f79d[_0xed2c('0x12')][_0xed2c('0x13')];var _0x1f4b60=_0x18f79d['query'][_0xed2c('0x14')];var _0x384084=_0x264f30===_0xed2c('0x15')||_0x264f30===_0xed2c('0x16')?!![]:![];var _0x2748fb=[];var _0x144d2e;var _0x376117;Promise[_0xed2c('0x17')]()[_0xed2c('0x18')](function(){if(_0x18f79d[_0xed2c('0x12')][_0xed2c('0x19')]){if(!utils[_0xed2c('0x1a')](_0x18f79d[_0xed2c('0x12')][_0xed2c('0x19')])){throw new APIBadRequestError(util['format'](_0xed2c('0x1b'),_0x18f79d['query'][_0xed2c('0x19')]));}_0x3e42e7=_0x18f79d[_0xed2c('0x12')][_0xed2c('0x19')][_0xed2c('0x1c')]();}if(!_0x18f79d[_0xed2c('0x12')][_0xed2c('0x1d')]||!_0x18f79d[_0xed2c('0x12')][_0xed2c('0x1d')]['includes'](_0xed2c('0x1e'))){_0x18f79d[_0xed2c('0x12')]['sort']=rta[_0xed2c('0x1f')](_0x18f79d['query'][_0xed2c('0x1d')]);return;}var _0x1946f1=rta[_0xed2c('0x20')](_0x18f79d[_0xed2c('0x12')][_0xed2c('0x1d')]);_0x18f79d[_0xed2c('0x12')][_0xed2c('0x1d')]=_0x1946f1[_0xed2c('0x21')][_0xed2c('0x22')](',');_0x144d2e=_0x1946f1['order'];})[_0xed2c('0x18')](function(){if(!_0x882656){return[];}return rta[_0xed2c('0x23')](_0x882656,_0x3e42e7);})['then'](function(_0x4efa4b){_0x2748fb=_0x4efa4b;return rta[_0xed2c('0x24')]();})[_0xed2c('0x18')](function(_0x1025bc){_0x5449ea=_0x1025bc[_0xed2c('0x25')];if((!_0x264f30||_0x384084)&&!_0x144d2e){return _0x2748fb;}if(_0x144d2e&&!_0x264f30){return rta[_0xed2c('0x26')](_0x5449ea,_0x2748fb,_0x144d2e);}else{return rta[_0xed2c('0x27')](_0x5449ea,_0x2748fb,_0x264f30);}})[_0xed2c('0x18')](function(_0x3dd83d){_0x2748fb=_0x3dd83d;var _0xb0f188=![];if(_0x2748fb[_0xed2c('0x28')]===0x0){if(_0x882656||_0x264f30){_0xb0f188=!![];}if(_0x384084){_0xb0f188=![];}}if(_0xb0f188){return _0x4f5621;}var _0x3342cf=_['map'](db['User'][_0xed2c('0x29')],function(_0x15bc96){return{'name':_0x15bc96['fieldName'],'type':_0x15bc96[_0xed2c('0x2a')]['key']};});_0x18f79d['query']['role']='agent';_0x465f49=qs[_0xed2c('0x2b')](_0x3342cf,_0x18f79d);_0x465f49['raw']=!![];var _0x2d24e9=[];if(_0x2748fb[_0xed2c('0x28')]>0x0){_0x2d24e9['push']({'id':{'$in':_0x2748fb}});if(_0x144d2e&&!_0x264f30){_0x376117=[db['sequelize']['literal'](_0xed2c('0x2c')+_0x2748fb+')')];_0x465f49[_0xed2c('0x2d')]=_0x376117;}}if(_0x384084){_0x3e3acf['forEach'](function(_0x4491fe){var _0x25b0d0=!![];if(_0x264f30===_0xed2c('0x16')&&_0x3e42e7!==_0x4491fe){_0x25b0d0=![];}_0x2d24e9[_0xed2c('0x2e')]({[_0x4491fe+_0xed2c('0x2f')]:_0x25b0d0});});if(_0x1f4b60){_0x2d24e9[_0xed2c('0x2e')]({'pauseType':_0x1f4b60});}}else if(_0x264f30){_0x3e3acf['forEach'](function(_0x3303ba){_0x2d24e9['push']({[_0x3303ba+_0xed2c('0x2f')]:![]});});}_0x465f49[_0xed2c('0x30')]=_[_0xed2c('0x31')](_0x465f49[_0xed2c('0x30')],{'$and':_0x2d24e9});if(_0x18f79d[_0xed2c('0x32')][_0xed2c('0x33')]===_0xed2c('0x32')){var _0x5373e6={'params':{'id':_0x18f79d[_0xed2c('0x32')][_0xed2c('0x34')]},'query':{'section':'Agents','role':'agent','raw':!![],'ids':_0x2748fb,'customSorting':_0x376117}};if(_0x18f79d[_0xed2c('0x12')][_0xed2c('0x35')]){_0x5373e6['query'][_0xed2c('0x35')]=!![];}if(_0x384084){_0x5373e6[_0xed2c('0x12')][_0xed2c('0x36')]=_0x2d24e9;}_0x5373e6[_0xed2c('0x12')]=Object[_0xed2c('0x37')](_0x5373e6[_0xed2c('0x12')],_0x18f79d[_0xed2c('0x12')]);return db['UserProfile'][_0xed2c('0x38')](_0x5373e6);}return db[_0xed2c('0x39')][_0xed2c('0x3a')](_0x465f49);})[_0xed2c('0x18')](function(_0x5b46e9){_0x4f5621[_0xed2c('0x9')]=_0x5b46e9[_0xed2c('0x9')];_0x16f89d=_0x5b46e9[_0xed2c('0x25')];return _0x16f89d[_0xed2c('0x3b')](function(_0x499d37){var _0x9b18b1=_[_0xed2c('0x3c')](_0x5449ea,['id',_0x499d37['id']]);if(_0x9b18b1){var _0x30980a=rta[_0xed2c('0x3d')](_0x9b18b1);_[_0xed2c('0x31')](_0x499d37,_0x30980a);}_0x499d37[_0xed2c('0x1e')]=rta[_0xed2c('0x3e')](_0x499d37);if(_0x499d37[_0xed2c('0x1e')][_0xed2c('0x3f')](_0xed2c('0x15'))){_0x3e3acf['forEach'](function(_0x439b46){if(_0x499d37[_0x439b46+_0xed2c('0x2f')]){if(_0x439b46===_0xed2c('0x40')){if(_0x499d37[_0xed2c('0x41')]!==_0xed2c('0x42')){_0x499d37[_0xed2c('0x41')]=_0xed2c('0x15');}}else{_0x499d37[_0x439b46+'Status']='pause';}}});}return _0x499d37;});})[_0xed2c('0x18')](function(_0x477292){if(!_0x144d2e||_0x376117){return _0x477292;}return rta[_0xed2c('0x43')](_0x477292,_0x144d2e);})['then'](function(_0x5d6367){var _0x52ff45=rta[_0xed2c('0x44')]();_0x4f5621[_0xed2c('0x25')]=_0x5d6367[_0xed2c('0x3b')](function(_0x1624e9){return _[_0xed2c('0x45')](_0x1624e9,_0x52ff45);});return _0x4f5621;})[_0xed2c('0x18')](respondWithFilteredResult(_0xcc704d,_0x465f49))[_0xed2c('0x46')](APIHandleError(_0xcc704d));};exports[_0xed2c('0x47')]=function(_0x3ffe4e,_0x1661b5){var _0x29425d={'count':0x0,'rows':[]};var _0x15ffca={};var _0x411cd8;var _0x4ddaff;var _0x52432d;Promise[_0xed2c('0x17')]()[_0xed2c('0x18')](function(){if(_0x3ffe4e[_0xed2c('0x12')][_0xed2c('0x19')]){if(!utils[_0xed2c('0x1a')](_0x3ffe4e[_0xed2c('0x12')][_0xed2c('0x19')])){throw new APIBadRequestError(util[_0xed2c('0x48')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x3ffe4e['query']['channel']));}_0x411cd8=_0x3ffe4e[_0xed2c('0x12')][_0xed2c('0x19')][_0xed2c('0x1c')]();}var _0x928a4=_[_0xed2c('0x49')](_0x411cd8)+'Queue';var _0x1174da=_[_0xed2c('0x3b')](db[_0x928a4]['rawAttributes'],function(_0x1a702b){return{'name':_0x1a702b[_0xed2c('0x4a')],'type':_0x1a702b[_0xed2c('0x2a')][_0xed2c('0x4b')]};});if(!_0x3ffe4e[_0xed2c('0x12')]['fields']){var _0x36b1c0=['id','name'];if(_0x411cd8===_0xed2c('0x40')){_0x36b1c0[_0xed2c('0x2e')](_0xed2c('0x2a'));if(_0x3ffe4e['query']['type']===_0xed2c('0x4c')){_0x36b1c0[_0xed2c('0x2e')]([_0xed2c('0x4d'),_0xed2c('0x4e')]);}}_0x3ffe4e['query']['fields']=_0x36b1c0[_0xed2c('0x22')](',');}_0x15ffca=qs[_0xed2c('0x2b')](_0x1174da,_0x3ffe4e);if(_0x3ffe4e['user'][_0xed2c('0x33')]===_0xed2c('0x32')){var _0x5cd8c5={'params':{'id':_0x3ffe4e[_0xed2c('0x32')][_0xed2c('0x34')]},'query':{'section':_0x411cd8===_0xed2c('0x40')&&_0x3ffe4e[_0xed2c('0x12')][_0xed2c('0x2a')]===_0xed2c('0x4c')?_0xed2c('0x4f'):_[_0xed2c('0x49')](_0x411cd8)+'Queues','type':_0x3ffe4e[_0xed2c('0x12')][_0xed2c('0x2a')],'nolimit':!![],'sort':'name','filter':_0x3ffe4e['query'][_0xed2c('0x50')]}};_0x5cd8c5[_0xed2c('0x12')]=Object[_0xed2c('0x37')](_0x5cd8c5[_0xed2c('0x12')],_0x3ffe4e['query']);delete _0x5cd8c5[_0xed2c('0x12')]['id'];return db['UserProfile'][_0xed2c('0x38')](_0x5cd8c5);}return db[_0x928a4]['findAndCountAll'](_0x15ffca);})[_0xed2c('0x18')](function(_0x22431b){_0x29425d[_0xed2c('0x9')]=_0x22431b[_0xed2c('0x9')];_0x4ddaff=_0x22431b[_0xed2c('0x25')];return rtq[_0xed2c('0x51')](_0x3ffe4e,_0x411cd8);})[_0xed2c('0x18')](function(_0x376f94){_0x52432d=_0x376f94[_0xed2c('0x25')];return rtq['initializeQueues'](_0x4ddaff,_0x52432d,_0x411cd8,_0x3ffe4e[_0xed2c('0x12')]['type']);})[_0xed2c('0x18')](function(_0x27bef1){_0x29425d[_0xed2c('0x25')]=_0x27bef1;return _0x29425d;})[_0xed2c('0x18')](respondWithFilteredResult(_0x1661b5,_0x15ffca))[_0xed2c('0x46')](APIHandleError(_0x1661b5));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 98e5792..faa7d0a 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x368c85,_0x586b0a){var _0x3477c2=function(_0x3ef6d9){while(--_0x3ef6d9){_0x368c85['push'](_0x368c85['shift']());}};_0x3477c2(++_0x586b0a);}(_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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x44f280,_0x4a1dad){var _0x4ee19d=function(_0xc02f51){while(--_0xc02f51){_0x44f280['push'](_0x44f280['shift']());}};_0x4ee19d(++_0x4a1dad);}(_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 diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 73a6115..6442944 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 _0xe14b=['exports','DATE','STRING','sequelize'];(function(_0x454bd3,_0x3e4d94){var _0x4eb066=function(_0x4478fa){while(--_0x4478fa){_0x454bd3['push'](_0x454bd3['shift']());}};_0x4eb066(++_0x3e4d94);}(_0xe14b,0x93));var _0xbe14=function(_0x4b9354,_0xa17500){_0x4b9354=_0x4b9354-0x0;var _0x2074b3=_0xe14b[_0x4b9354];return _0x2074b3;};'use strict';var Sequelize=require(_0xbe14('0x0'));module[_0xbe14('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0xbe14('0x2')]},'uniqueid':{'type':Sequelize[_0xbe14('0x3')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0xbe14('0x2')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0xbe14('0x3')]},'membername':{'type':Sequelize[_0xbe14('0x3')]}}; \ No newline at end of file +var _0x3d49=['DATE','exports','INTEGER','STRING'];(function(_0x6b9481,_0x5061ec){var _0x5e161f=function(_0x3ab4e3){while(--_0x3ab4e3){_0x6b9481['push'](_0x6b9481['shift']());}};_0x5e161f(++_0x5061ec);}(_0x3d49,0x151));var _0x93d4=function(_0x26bcec,_0xe13f50){_0x26bcec=_0x26bcec-0x0;var _0x1049dc=_0x3d49[_0x26bcec];return _0x1049dc;};'use strict';var Sequelize=require('sequelize');module[_0x93d4('0x0')]={'state':{'type':Sequelize[_0x93d4('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x93d4('0x2')]},'scheduledat':{'type':Sequelize[_0x93d4('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x93d4('0x3')]},'responsetime':{'type':Sequelize[_0x93d4('0x3')]},'ringtime':{'type':Sequelize[_0x93d4('0x1')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x93d4('0x2')]},'campaigntype':{'type':Sequelize[_0x93d4('0x2')]},'membername':{'type':Sequelize[_0x93d4('0x2')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index d5c3c07..9f93383 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 _0x0f15=['define','report_agent_preview','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./reportAgentPreview.attributes','exports'];(function(_0x3cf9f5,_0x316df1){var _0x38f98c=function(_0x265359){while(--_0x265359){_0x3cf9f5['push'](_0x3cf9f5['shift']());}};_0x38f98c(++_0x316df1);}(_0x0f15,0x1ee));var _0x50f1=function(_0x1f0714,_0xde0530){_0x1f0714=_0x1f0714-0x0;var _0x33669d=_0x0f15[_0x1f0714];return _0x33669d;};'use strict';var _=require(_0x50f1('0x0'));var util=require(_0x50f1('0x1'));var logger=require(_0x50f1('0x2'))('api');var moment=require(_0x50f1('0x3'));var BPromise=require(_0x50f1('0x4'));var rp=require(_0x50f1('0x5'));var fs=require('fs');var path=require(_0x50f1('0x6'));var rimraf=require('rimraf');var config=require(_0x50f1('0x7'));var attributes=require(_0x50f1('0x8'));module[_0x50f1('0x9')]=function(_0x4d2506,_0x2e66dd){return _0x4d2506[_0x50f1('0xa')]('ReportAgentPreview',attributes,{'tableName':_0x50f1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9ae3=['exports','lodash','moment','request-promise','path','rimraf','../../config/environment','./reportAgentPreview.attributes'];(function(_0xfacee2,_0x29c3b0){var _0x4cc9ea=function(_0x26ed31){while(--_0x26ed31){_0xfacee2['push'](_0xfacee2['shift']());}};_0x4cc9ea(++_0x29c3b0);}(_0x9ae3,0x199));var _0x39ae=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x9ae3[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x39ae('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x39ae('0x1'));var BPromise=require('bluebird');var rp=require(_0x39ae('0x2'));var fs=require('fs');var path=require(_0x39ae('0x3'));var rimraf=require(_0x39ae('0x4'));var config=require(_0x39ae('0x5'));var attributes=require(_0x39ae('0x6'));module[_0x39ae('0x7')]=function(_0x5c186d,_0x3ca680){return _0x5c186d['define']('ReportAgentPreview',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 7bb19a5..54b3d55 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 _0xed04=['error','code','message','CreateReportAgentPreview','body','options','raw','then','debug','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x341e0f,_0x4a09d0){var _0x59555a=function(_0x4343a8){while(--_0x4343a8){_0x341e0f['push'](_0x341e0f['shift']());}};_0x59555a(++_0x4a09d0);}(_0xed04,0x176));var _0x4ed0=function(_0x4f7a03,_0x56011b){_0x4f7a03=_0x4f7a03-0x0;var _0x536f91=_0xed04[_0x4f7a03];return _0x536f91;};'use strict';var _=require('lodash');var util=require(_0x4ed0('0x0'));var moment=require(_0x4ed0('0x1'));var BPromise=require(_0x4ed0('0x2'));var rs=require(_0x4ed0('0x3'));var fs=require('fs');var Redis=require(_0x4ed0('0x4'));var db=require(_0x4ed0('0x5'))['db'];var utils=require(_0x4ed0('0x6'));var logger=require('../../config/logger')(_0x4ed0('0x7'));var config=require(_0x4ed0('0x8'));var jayson=require(_0x4ed0('0x9'));var client=jayson[_0x4ed0('0xa')][_0x4ed0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x40ca3f,_0x5cbe59,_0x431f3f){return new BPromise(function(_0x2e5003,_0x27f154){return client[_0x4ed0('0xc')](_0x40ca3f,_0x431f3f)['then'](function(_0x3c9a57){logger[_0x4ed0('0xd')](_0x4ed0('0xe'),_0x5cbe59,_0x4ed0('0xf'));logger['debug'](_0x4ed0('0x10'),_0x5cbe59,'request\x20sent',JSON[_0x4ed0('0x11')](_0x3c9a57));if(_0x3c9a57[_0x4ed0('0x12')]){if(_0x3c9a57['error'][_0x4ed0('0x13')]===0x1f4){logger[_0x4ed0('0x12')](_0x4ed0('0xe'),_0x5cbe59,_0x3c9a57[_0x4ed0('0x12')]['message']);return _0x27f154(_0x3c9a57[_0x4ed0('0x12')][_0x4ed0('0x14')]);}logger[_0x4ed0('0x12')]('ReportAgentPreview,\x20%s,\x20%s',_0x5cbe59,_0x3c9a57[_0x4ed0('0x12')][_0x4ed0('0x14')]);return _0x2e5003(_0x3c9a57[_0x4ed0('0x12')][_0x4ed0('0x14')]);}else{logger['info'](_0x4ed0('0xe'),_0x5cbe59,'request\x20sent');_0x2e5003(_0x3c9a57['result']['message']);}})['catch'](function(_0x265596){logger[_0x4ed0('0x12')](_0x4ed0('0xe'),_0x5cbe59,_0x265596);_0x27f154(_0x265596);});});}exports[_0x4ed0('0x15')]=function(_0x268aba){var _0x1b5431=this;return new Promise(function(_0x32baa7,_0x10c50f){return db['ReportAgentPreview']['create'](_0x268aba[_0x4ed0('0x16')],{'raw':_0x268aba[_0x4ed0('0x17')]?_0x268aba['options'][_0x4ed0('0x18')]===undefined?!![]:![]:!![]})[_0x4ed0('0x19')](function(_0x17d8dc){logger[_0x4ed0('0xd')]('CreateReportAgentPreview',_0x268aba);logger[_0x4ed0('0x1a')](_0x4ed0('0x15'),_0x268aba,JSON['stringify'](_0x17d8dc));_0x32baa7(_0x17d8dc);})[_0x4ed0('0x1b')](function(_0x21fc64){logger[_0x4ed0('0x12')](_0x4ed0('0x15'),_0x21fc64[_0x4ed0('0x14')],_0x268aba);_0x10c50f(_0x1b5431[_0x4ed0('0x12')](0x1f4,_0x21fc64[_0x4ed0('0x14')]));});});}; \ No newline at end of file +var _0xdeed=['ioredis','../../mysqldb','../../config/utils','rpc','client','http','request','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateReportAgentPreview','create','body','options','moment','bluebird'];(function(_0x4bdee9,_0x5eaf4d){var _0x31d570=function(_0x4f394a){while(--_0x4f394a){_0x4bdee9['push'](_0x4bdee9['shift']());}};_0x31d570(++_0x5eaf4d);}(_0xdeed,0x106));var _0xddee=function(_0x1bb3df,_0x64e429){_0x1bb3df=_0x1bb3df-0x0;var _0x4e78dc=_0xdeed[_0x1bb3df];return _0x4e78dc;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xddee('0x0'));var BPromise=require(_0xddee('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xddee('0x2'));var db=require(_0xddee('0x3'))['db'];var utils=require(_0xddee('0x4'));var logger=require('../../config/logger')(_0xddee('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xddee('0x6')][_0xddee('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3fe515,_0x1c4aa4,_0x153d6d){return new BPromise(function(_0x1e9c28,_0x498e07){return client[_0xddee('0x8')](_0x3fe515,_0x153d6d)[_0xddee('0x9')](function(_0x49a5ed){logger[_0xddee('0xa')](_0xddee('0xb'),_0x1c4aa4,_0xddee('0xc'));logger[_0xddee('0xd')](_0xddee('0xe'),_0x1c4aa4,'request\x20sent',JSON[_0xddee('0xf')](_0x49a5ed));if(_0x49a5ed[_0xddee('0x10')]){if(_0x49a5ed['error'][_0xddee('0x11')]===0x1f4){logger[_0xddee('0x10')]('ReportAgentPreview,\x20%s,\x20%s',_0x1c4aa4,_0x49a5ed[_0xddee('0x10')][_0xddee('0x12')]);return _0x498e07(_0x49a5ed[_0xddee('0x10')][_0xddee('0x12')]);}logger[_0xddee('0x10')](_0xddee('0xb'),_0x1c4aa4,_0x49a5ed[_0xddee('0x10')][_0xddee('0x12')]);return _0x1e9c28(_0x49a5ed['error']['message']);}else{logger[_0xddee('0xa')](_0xddee('0xb'),_0x1c4aa4,'request\x20sent');_0x1e9c28(_0x49a5ed['result'][_0xddee('0x12')]);}})[_0xddee('0x13')](function(_0x12b11e){logger[_0xddee('0x10')](_0xddee('0xb'),_0x1c4aa4,_0x12b11e);_0x498e07(_0x12b11e);});});}exports[_0xddee('0x14')]=function(_0x118b60){var _0xc1cbe2=this;return new Promise(function(_0x17845,_0x82aa07){return db['ReportAgentPreview'][_0xddee('0x15')](_0x118b60[_0xddee('0x16')],{'raw':_0x118b60[_0xddee('0x17')]?_0x118b60[_0xddee('0x17')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0xc45ba){logger[_0xddee('0xa')](_0xddee('0x14'),_0x118b60);logger[_0xddee('0xd')](_0xddee('0x14'),_0x118b60,JSON[_0xddee('0xf')](_0xc45ba));_0x17845(_0xc45ba);})[_0xddee('0x13')](function(_0x5c0117){logger[_0xddee('0x10')](_0xddee('0x14'),_0x5c0117['message'],_0x118b60);_0x82aa07(_0xc1cbe2[_0xddee('0x10')](0x1f4,_0x5c0117[_0xddee('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 3def0ca..72a8610 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 _0x8383=['voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/queues','/chat/queues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/:id','showVoiceQueues','put','updateVoiceQueue','/outbound','outbound','outboundChannels','/agents','/telephones','telephones','/trunks','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/mail/queues/waitinginteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','queueNotify','mail','showMailQueues','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','/whatsapp/queues/:id/notify','/sms/queues/:id','/whatsapp/queues/:id','showWhatsappQueues','agentNotify','exports','multer','express','Router','../../components/auth/service','./rpc.controller','get','/voice/channels','isAuthenticated'];(function(_0x1d5de3,_0xf8bd28){var _0x3d1381=function(_0x29d416){while(--_0x29d416){_0x1d5de3['push'](_0x1d5de3['shift']());}};_0x3d1381(++_0xf8bd28);}(_0x8383,0x98));var _0x3838=function(_0x37e5f7,_0x3c2cb2){_0x37e5f7=_0x37e5f7-0x0;var _0xc63482=_0x8383[_0x37e5f7];return _0xc63482;};'use strict';var multer=require(_0x3838('0x0'));var util=require('util');var path=require('path');var express=require(_0x3838('0x1'));var router=express[_0x3838('0x2')]();var auth=require(_0x3838('0x3'));var controller=require(_0x3838('0x4'));router[_0x3838('0x5')](_0x3838('0x6'),auth[_0x3838('0x7')](),controller[_0x3838('0x8')]);router[_0x3838('0x5')](_0x3838('0x9'),auth['isAuthenticated'](),controller[_0x3838('0xa')]);router[_0x3838('0x5')]('/voice/channels/:uniqueid/stopmixmonitor',auth[_0x3838('0x7')](),controller['voiceChannelStopMixMonitor']);router[_0x3838('0x5')](_0x3838('0xb'),auth[_0x3838('0x7')](),controller['voiceQueues']);router[_0x3838('0x5')](_0x3838('0xc'),auth[_0x3838('0x7')](),controller['chatQueues']);router[_0x3838('0x5')](_0x3838('0xd'),auth[_0x3838('0x7')](),controller[_0x3838('0xe')]);router['get'](_0x3838('0xf'),auth[_0x3838('0x7')](),controller[_0x3838('0x10')]);router['get'](_0x3838('0x11'),auth['isAuthenticated'](),controller[_0x3838('0x12')]);router[_0x3838('0x5')](_0x3838('0x13'),auth[_0x3838('0x7')](),controller[_0x3838('0x14')]);router['get'](_0x3838('0x15'),auth[_0x3838('0x7')](),controller[_0x3838('0x16')]);router[_0x3838('0x5')](_0x3838('0x17'),auth['isAuthenticated'](),controller[_0x3838('0x18')]);router[_0x3838('0x5')](_0x3838('0x19'),auth['isAuthenticated'](),controller[_0x3838('0x1a')]);router[_0x3838('0x5')]('/voice/queues/channels',auth[_0x3838('0x7')](),controller[_0x3838('0x1b')]);router['get'](_0x3838('0x1c'),auth['isAuthenticated'](),controller[_0x3838('0x1d')]);router[_0x3838('0x5')](_0x3838('0x1e'),auth[_0x3838('0x7')](),controller[_0x3838('0x1f')]);router['get']('/voice/queues/channels/:uniqueid/redirect/:exten',auth[_0x3838('0x7')](),controller['voiceQueuesChannelRedirect']);router[_0x3838('0x5')](_0x3838('0x20'),auth[_0x3838('0x7')](),controller[_0x3838('0x21')]);router[_0x3838('0x22')](_0x3838('0x20'),auth[_0x3838('0x7')](),controller[_0x3838('0x23')]);router['get'](_0x3838('0x24'),auth['isAuthenticated'](),controller[_0x3838('0x25')]);router[_0x3838('0x5')]('/outbound/channels',auth[_0x3838('0x7')](),controller[_0x3838('0x26')]);router['get'](_0x3838('0x27'),auth[_0x3838('0x7')](),controller['agents']);router[_0x3838('0x22')]('/agents/:id/capacity',auth[_0x3838('0x7')](),controller['agentCapacity']);router['get'](_0x3838('0x28'),auth[_0x3838('0x7')](),controller[_0x3838('0x29')]);router[_0x3838('0x5')](_0x3838('0x2a'),auth['isAuthenticated'](),controller[_0x3838('0x2b')]);router[_0x3838('0x5')](_0x3838('0x2c'),auth['isAuthenticated'](),controller[_0x3838('0x2d')]);router['get'](_0x3838('0x2e'),auth['isAuthenticated'](),controller[_0x3838('0x2f')]);router[_0x3838('0x5')]('/chat/queues/waitinginteractions',auth[_0x3838('0x7')](),controller['chatQueuesWaitingInteractions']);router['get'](_0x3838('0x30'),auth[_0x3838('0x7')](),controller['mailQueuesWaitingInteractions']);router['get'](_0x3838('0x31'),auth['isAuthenticated'](),controller[_0x3838('0x32')]);router[_0x3838('0x5')](_0x3838('0x33'),auth[_0x3838('0x7')](),controller[_0x3838('0x34')]);router[_0x3838('0x5')]('/sms/queues/waitinginteractions',auth[_0x3838('0x7')](),controller[_0x3838('0x35')]);router[_0x3838('0x5')](_0x3838('0x36'),auth[_0x3838('0x7')](),controller[_0x3838('0x37')]);router[_0x3838('0x5')](_0x3838('0x38'),auth[_0x3838('0x7')](),controller[_0x3838('0x39')]);router[_0x3838('0x3a')]('/mail/queues/:id/notify',auth[_0x3838('0x7')](),controller[_0x3838('0x3b')](_0x3838('0x3c')));router[_0x3838('0x5')]('/mail/queues/:id',auth[_0x3838('0x7')](),controller[_0x3838('0x3d')]);router[_0x3838('0x3a')](_0x3838('0x3e'),auth['isAuthenticated'](),controller[_0x3838('0x3b')](_0x3838('0x3f')));router[_0x3838('0x5')](_0x3838('0x40'),auth['isAuthenticated'](),controller[_0x3838('0x41')]);router[_0x3838('0x3a')](_0x3838('0x42'),auth['isAuthenticated'](),controller['queueNotify'](_0x3838('0x43')));router[_0x3838('0x5')](_0x3838('0x44'),auth[_0x3838('0x7')](),controller[_0x3838('0x45')]);router[_0x3838('0x3a')](_0x3838('0x46'),auth[_0x3838('0x7')](),controller[_0x3838('0x3b')]('openchannel'));router[_0x3838('0x5')](_0x3838('0x47'),auth[_0x3838('0x7')](),controller[_0x3838('0x48')]);router[_0x3838('0x3a')](_0x3838('0x49'),auth[_0x3838('0x7')](),controller[_0x3838('0x3b')]('sms'));router[_0x3838('0x3a')](_0x3838('0x4a'),auth['isAuthenticated'](),controller[_0x3838('0x3b')]('whatsapp'));router[_0x3838('0x5')](_0x3838('0x4b'),auth['isAuthenticated'](),controller['showSmsQueues']);router['get'](_0x3838('0x4c'),auth[_0x3838('0x7')](),controller[_0x3838('0x4d')]);router[_0x3838('0x3a')]('/agents/:id/notify',auth[_0x3838('0x7')](),controller[_0x3838('0x4e')]);module[_0x3838('0x4f')]=router; \ No newline at end of file +var _0xf801=['/mail/accounts','mailAccounts','openchannelQueues','/sms/queues','smsQueues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','voiceQueuesChannels','/voice/queues/channels/:uniqueid','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','showVoiceQueues','put','/voice/queues/:id','updateVoiceQueue','/outbound','outbound','/outbound/channels','/agents','agents','/agents/:id/capacity','agentCapacity','/telephones','telephones','/trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','chatQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','showOpenchannelQueues','/sms/queues/:id/notify','sms','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','multer','util','path','express','../../components/auth/service','./rpc.controller','/voice/channels','isAuthenticated','voiceChannels','get','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','chatQueues','/mail/queues','mailQueues'];(function(_0x28aa1a,_0x27e74f){var _0x2f669a=function(_0x28cc20){while(--_0x28cc20){_0x28aa1a['push'](_0x28aa1a['shift']());}};_0x2f669a(++_0x27e74f);}(_0xf801,0x96));var _0x1f80=function(_0x459c2b,_0x44b2d9){_0x459c2b=_0x459c2b-0x0;var _0x26bc62=_0xf801[_0x459c2b];return _0x26bc62;};'use strict';var multer=require(_0x1f80('0x0'));var util=require(_0x1f80('0x1'));var path=require(_0x1f80('0x2'));var express=require(_0x1f80('0x3'));var router=express['Router']();var auth=require(_0x1f80('0x4'));var controller=require(_0x1f80('0x5'));router['get'](_0x1f80('0x6'),auth[_0x1f80('0x7')](),controller[_0x1f80('0x8')]);router[_0x1f80('0x9')]('/voice/channels/:uniqueid/mixmonitor',auth['isAuthenticated'](),controller[_0x1f80('0xa')]);router['get'](_0x1f80('0xb'),auth[_0x1f80('0x7')](),controller[_0x1f80('0xc')]);router[_0x1f80('0x9')](_0x1f80('0xd'),auth[_0x1f80('0x7')](),controller[_0x1f80('0xe')]);router[_0x1f80('0x9')]('/chat/queues',auth['isAuthenticated'](),controller[_0x1f80('0xf')]);router['get'](_0x1f80('0x10'),auth['isAuthenticated'](),controller[_0x1f80('0x11')]);router['get'](_0x1f80('0x12'),auth[_0x1f80('0x7')](),controller[_0x1f80('0x13')]);router[_0x1f80('0x9')]('/openchannel/queues',auth[_0x1f80('0x7')](),controller[_0x1f80('0x14')]);router[_0x1f80('0x9')](_0x1f80('0x15'),auth['isAuthenticated'](),controller[_0x1f80('0x16')]);router[_0x1f80('0x9')]('/whatsapp/queues',auth[_0x1f80('0x7')](),controller[_0x1f80('0x17')]);router['get'](_0x1f80('0x18'),auth[_0x1f80('0x7')](),controller[_0x1f80('0x19')]);router['get'](_0x1f80('0x1a'),auth[_0x1f80('0x7')](),controller[_0x1f80('0x1b')]);router[_0x1f80('0x9')]('/voice/queues/channels',auth[_0x1f80('0x7')](),controller[_0x1f80('0x1c')]);router[_0x1f80('0x9')](_0x1f80('0x1d'),auth[_0x1f80('0x7')](),controller['voiceQueuesChannel']);router[_0x1f80('0x9')](_0x1f80('0x1e'),auth['isAuthenticated'](),controller[_0x1f80('0x1f')]);router[_0x1f80('0x9')](_0x1f80('0x20'),auth[_0x1f80('0x7')](),controller[_0x1f80('0x21')]);router[_0x1f80('0x9')]('/voice/queues/:id',auth[_0x1f80('0x7')](),controller[_0x1f80('0x22')]);router[_0x1f80('0x23')](_0x1f80('0x24'),auth['isAuthenticated'](),controller[_0x1f80('0x25')]);router[_0x1f80('0x9')](_0x1f80('0x26'),auth[_0x1f80('0x7')](),controller[_0x1f80('0x27')]);router[_0x1f80('0x9')](_0x1f80('0x28'),auth['isAuthenticated'](),controller['outboundChannels']);router[_0x1f80('0x9')](_0x1f80('0x29'),auth[_0x1f80('0x7')](),controller[_0x1f80('0x2a')]);router[_0x1f80('0x23')](_0x1f80('0x2b'),auth[_0x1f80('0x7')](),controller[_0x1f80('0x2c')]);router[_0x1f80('0x9')](_0x1f80('0x2d'),auth[_0x1f80('0x7')](),controller[_0x1f80('0x2e')]);router['get'](_0x1f80('0x2f'),auth[_0x1f80('0x7')](),controller['trunks']);router[_0x1f80('0x9')](_0x1f80('0x30'),auth['isAuthenticated'](),controller[_0x1f80('0x31')]);router['get'](_0x1f80('0x32'),auth[_0x1f80('0x7')](),controller[_0x1f80('0x33')]);router[_0x1f80('0x9')]('/chat/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0x1f80('0x34')]);router['get']('/mail/queues/waitinginteractions',auth[_0x1f80('0x7')](),controller['mailQueuesWaitingInteractions']);router[_0x1f80('0x9')]('/openchannel/queues/waitinginteractions',auth[_0x1f80('0x7')](),controller[_0x1f80('0x35')]);router[_0x1f80('0x9')](_0x1f80('0x36'),auth['isAuthenticated'](),controller[_0x1f80('0x37')]);router[_0x1f80('0x9')](_0x1f80('0x38'),auth[_0x1f80('0x7')](),controller[_0x1f80('0x39')]);router[_0x1f80('0x9')](_0x1f80('0x3a'),auth[_0x1f80('0x7')](),controller[_0x1f80('0x3b')]);router['get'](_0x1f80('0x3c'),auth['isAuthenticated'](),controller['faxQueuesWaitingInteractions']);router[_0x1f80('0x3d')](_0x1f80('0x3e'),auth[_0x1f80('0x7')](),controller[_0x1f80('0x3f')](_0x1f80('0x40')));router[_0x1f80('0x9')](_0x1f80('0x41'),auth[_0x1f80('0x7')](),controller[_0x1f80('0x42')]);router[_0x1f80('0x3d')](_0x1f80('0x43'),auth[_0x1f80('0x7')](),controller['queueNotify'](_0x1f80('0x44')));router['get'](_0x1f80('0x45'),auth['isAuthenticated'](),controller[_0x1f80('0x46')]);router[_0x1f80('0x3d')]('/fax/queues/:id/notify',auth[_0x1f80('0x7')](),controller[_0x1f80('0x3f')]('fax'));router[_0x1f80('0x9')](_0x1f80('0x47'),auth['isAuthenticated'](),controller[_0x1f80('0x48')]);router[_0x1f80('0x3d')](_0x1f80('0x49'),auth[_0x1f80('0x7')](),controller[_0x1f80('0x3f')](_0x1f80('0x4a')));router[_0x1f80('0x9')]('/openchannel/queues/:id',auth[_0x1f80('0x7')](),controller[_0x1f80('0x4b')]);router[_0x1f80('0x3d')](_0x1f80('0x4c'),auth[_0x1f80('0x7')](),controller[_0x1f80('0x3f')](_0x1f80('0x4d')));router[_0x1f80('0x3d')]('/whatsapp/queues/:id/notify',auth['isAuthenticated'](),controller[_0x1f80('0x3f')]('whatsapp'));router[_0x1f80('0x9')]('/sms/queues/:id',auth['isAuthenticated'](),controller[_0x1f80('0x4e')]);router[_0x1f80('0x9')](_0x1f80('0x4f'),auth['isAuthenticated'](),controller[_0x1f80('0x50')]);router['post'](_0x1f80('0x51'),auth[_0x1f80('0x7')](),controller[_0x1f80('0x52')]);module[_0x1f80('0x53')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 3ff3ba5..81e4cc9 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 _0xbaf0=['MailQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','map','queue_id','value','indexOf','smsQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Queue','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','Account','\x20Message\x20not\x20found','update','queue','From','QueueId','TransferReport','create','Start','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','Website','Agent\x20not\x20found','InteractionId','agentTransferTimeout','moment','lodash','util','../../mysqldb','../../config/logger','api','client','http','request','then','error','code','message','result','status','sendStatus','stack','name','isNil','rows','voiceChannels','VoiceChannels','catch','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','query','params','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','updateVoiceQueue','UpdateVoiceQueue','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','body','interaction','user','hasOwnProperty','MemberReport','findAll','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','interface','SIP/%s','agent','internal','AgentCapacity','capacity','telephones','Telephones','trunks','Campaigns','chatQueues','ChatQueues','showChatQueues','MailQueues','showMailQueues','mailAccounts','openchannelQueues','OpenchannelQueues','smsQueues','showSmsQueues','WhatsappQueues','showWhatsappQueues','faxQueues','showFaxQueues','FaxQueues','faxAccounts','FaxAccounts','mailQueuesWaitingInteractions'];(function(_0xd87958,_0x2bc10d){var _0x21827f=function(_0x2085fa){while(--_0x2085fa){_0xd87958['push'](_0xd87958['shift']());}};_0x21827f(++_0x2bc10d);}(_0xbaf0,0x12a));var _0x0baf=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xbaf0[_0x432682];return _0x463d05;};'use strict';var BPromise=require('bluebird');var moment=require(_0x0baf('0x0'));var _=require(_0x0baf('0x1'));var util=require(_0x0baf('0x2'));var db=require(_0x0baf('0x3'))['db'];var logger=require(_0x0baf('0x4'))(_0x0baf('0x5'));var jayson=require('jayson/promise');var amiClient=jayson[_0x0baf('0x6')][_0x0baf('0x7')]({'port':0x232a});var mailClient=jayson[_0x0baf('0x6')][_0x0baf('0x7')]({'port':0x232b});var routingClient=jayson[_0x0baf('0x6')][_0x0baf('0x7')]({'port':0x232c});function respondWithRpcPromise(_0x1a10b1,_0x2dcaac,_0x1d0a0d){return new BPromise(function(_0x5f5030,_0x11b947){var _0x5f20aa=_0x1d0a0d?_0x1d0a0d:amiClient;return _0x5f20aa[_0x0baf('0x8')](_0x1a10b1,_0x2dcaac)[_0x0baf('0x9')](function(_0x465528){if(_0x465528[_0x0baf('0xa')]){if(_0x465528[_0x0baf('0xa')][_0x0baf('0xb')]===0x1f4){return _0x11b947(_0x465528[_0x0baf('0xa')][_0x0baf('0xc')]);}return _0x5f5030(_0x465528[_0x0baf('0xa')][_0x0baf('0xc')]);}else{_0x5f5030(_0x465528[_0x0baf('0xd')]);}})['catch'](function(_0x5a53e2){_0x11b947(_0x5a53e2);});});}function respondWithResult(_0x465dd7,_0xe4378c){_0xe4378c=_0xe4378c||0xc8;return function(_0x5db689){if(_0x5db689){return _0x465dd7[_0x0baf('0xe')](_0xe4378c)['json'](_0x5db689);}return _0x465dd7[_0x0baf('0xf')](0x194);};}function handleError(_0x49e44b,_0x1c76a8){_0x1c76a8=_0x1c76a8||0x1f4;return function(_0x1f50c3){logger[_0x0baf('0xa')](_0x1f50c3[_0x0baf('0x10')]);if(_0x1f50c3[_0x0baf('0x11')]){delete _0x1f50c3[_0x0baf('0x11')];}_0x49e44b['status'](_0x1c76a8)['send'](_0x1f50c3);};}function findById(_0x2312c7){return function(_0x38395b){if(!_[_0x0baf('0x12')](_0x2312c7)&&!_[_0x0baf('0x12')](_0x38395b)&&!_[_0x0baf('0x12')](_0x38395b[_0x0baf('0x13')])){return _['find'](_0x38395b[_0x0baf('0x13')],function(_0xfbecec){return _0xfbecec['id']==_0x2312c7;});}return null;};}exports[_0x0baf('0x14')]=function(_0x3e9cb4,_0x47070d){return respondWithRpcPromise(_0x0baf('0x15'),_0x3e9cb4['query'])['then'](respondWithResult(_0x47070d,null))[_0x0baf('0x16')](handleError(_0x47070d,null));};exports[_0x0baf('0x17')]=function(_0x32e839,_0x1848e8){return respondWithRpcPromise(_0x0baf('0x18'),_[_0x0baf('0x19')](_0x32e839[_0x0baf('0x1a')],_0x32e839[_0x0baf('0x1b')]))[_0x0baf('0x9')](respondWithResult(_0x1848e8,null))[_0x0baf('0x16')](handleError(_0x1848e8,null));};exports['voiceChannelStopMixMonitor']=function(_0x334bd6,_0x482522){return respondWithRpcPromise(_0x0baf('0x1c'),_['merge'](_0x334bd6['query'],_0x334bd6[_0x0baf('0x1b')]))['then'](respondWithResult(_0x482522,null))['catch'](handleError(_0x482522,null));};exports[_0x0baf('0x1d')]=function(_0x27b59c,_0x34e264){return respondWithRpcPromise(_0x0baf('0x1e'),_0x27b59c[_0x0baf('0x1a')])['then'](respondWithResult(_0x34e264,null))[_0x0baf('0x16')](handleError(_0x34e264,null));};exports[_0x0baf('0x1f')]=function(_0x1ca35a,_0x366e71){return respondWithRpcPromise(_0x0baf('0x1e'),_0x1ca35a[_0x0baf('0x1a')])[_0x0baf('0x9')](findById(_0x1ca35a['params']['id']))[_0x0baf('0x9')](respondWithResult(_0x366e71,null))[_0x0baf('0x16')](handleError(_0x366e71,null));};exports[_0x0baf('0x20')]=function(_0x265915,_0x55c715){return respondWithRpcPromise(_0x0baf('0x21'),_[_0x0baf('0x19')](_0x265915['body'],_0x265915[_0x0baf('0x1b')]))[_0x0baf('0x9')](respondWithResult(_0x55c715,null))[_0x0baf('0x16')](handleError(_0x55c715,null));};exports[_0x0baf('0x22')]=function(_0xd14f0f,_0x366924){return respondWithRpcPromise(_0x0baf('0x23'),_['merge'](_0xd14f0f[_0x0baf('0x1a')],_0xd14f0f[_0x0baf('0x1b')]))[_0x0baf('0x9')](respondWithResult(_0x366924,null))[_0x0baf('0x16')](handleError(_0x366924,null));};exports[_0x0baf('0x24')]=function(_0x275ea1,_0x2fc983){return respondWithRpcPromise(_0x0baf('0x25'),_0x275ea1[_0x0baf('0x1a')])[_0x0baf('0x9')](respondWithResult(_0x2fc983,null))[_0x0baf('0x16')](handleError(_0x2fc983,null));};exports[_0x0baf('0x26')]=function(_0x45294a,_0x3a3353){return respondWithRpcPromise('VoiceQueuesChannel',_[_0x0baf('0x19')](_0x45294a['query'],_0x45294a[_0x0baf('0x1b')]))[_0x0baf('0x9')](respondWithResult(_0x3a3353,null))[_0x0baf('0x16')](handleError(_0x3a3353,null));};exports[_0x0baf('0x27')]=function(_0x5300a5,_0x1a2b03){return respondWithRpcPromise(_0x0baf('0x28'),_['merge'](_0x5300a5[_0x0baf('0x1a')],_0x5300a5[_0x0baf('0x1b')]))[_0x0baf('0x9')](respondWithResult(_0x1a2b03,null))[_0x0baf('0x16')](handleError(_0x1a2b03,null));};exports[_0x0baf('0x29')]=function(_0x1b0991,_0xe03d82){return respondWithRpcPromise(_0x0baf('0x2a'),_['merge'](_0x1b0991[_0x0baf('0x1a')],_0x1b0991[_0x0baf('0x1b')]))['then'](respondWithResult(_0xe03d82,null))[_0x0baf('0x16')](handleError(_0xe03d82,null));};exports['outbound']=function(_0x5c545f,_0x11bc49){return respondWithRpcPromise(_0x0baf('0x2b'),_0x5c545f['query'])['then'](respondWithResult(_0x11bc49,null))[_0x0baf('0x16')](handleError(_0x11bc49,null));};exports[_0x0baf('0x2c')]=function(_0x3412bc,_0xb2d9ab){return respondWithRpcPromise(_0x0baf('0x2d'),_0x3412bc[_0x0baf('0x1a')])[_0x0baf('0x9')](respondWithResult(_0xb2d9ab,null))[_0x0baf('0x16')](handleError(_0xb2d9ab,null));};exports[_0x0baf('0x2e')]=function(_0x36c6d2,_0x200864){var _0x148540;return respondWithRpcPromise(_0x0baf('0x2f'),_0x36c6d2[_0x0baf('0x1a')])['then'](function(_0x3573ce){_0x148540=_0x3573ce;return respondWithRpcPromise(_0x0baf('0x2f'),_0x36c6d2['query'],routingClient);})[_0x0baf('0x9')](function(_0x324369){return _[_0x0baf('0x19')]({},_0x324369,_0x148540);})[_0x0baf('0x9')](respondWithResult(_0x200864,null))[_0x0baf('0x16')](handleError(_0x200864,null));};exports[_0x0baf('0x30')]=function(_0x57b581,_0x23ad34){if(_0x57b581[_0x0baf('0x31')]&&_0x57b581['body'][_0x0baf('0x32')]&&_0x57b581[_0x0baf('0x33')]&&_0x57b581[_0x0baf('0x33')][_0x0baf('0x11')]){for(var _0x504031 in _0x57b581[_0x0baf('0x31')][_0x0baf('0x32')]){if(_0x57b581[_0x0baf('0x31')][_0x0baf('0x32')][_0x0baf('0x34')](_0x504031)){db[_0x0baf('0x35')][_0x0baf('0x36')]({'where':{'channel':_0x504031,'membername':_0x57b581[_0x0baf('0x33')][_0x0baf('0x11')],'type':_0x0baf('0x37'),'exitAt':null,'uniqueid':_0x57b581['body'][_0x0baf('0x32')][_0x504031]&&_0x57b581[_0x0baf('0x31')][_0x0baf('0x32')][_0x504031][_0x0baf('0x38')]?{'$notIn':_0x57b581[_0x0baf('0x31')]['interaction'][_0x504031]}:{'$ne':null}}})[_0x0baf('0x9')](function(_0x310240){var _0x27c3ee=moment()[_0x0baf('0x39')](_0x0baf('0x3a'));for(var _0x54ed41=0x0,_0x2a0924=_0x310240[_0x0baf('0x38')];_0x54ed41<_0x2a0924;_0x54ed41+=0x1){_0x310240[_0x54ed41][_0x0baf('0x3b')]({'exitAt':_0x27c3ee});}});for(var _0x1522b0=0x0;_0x1522b0<_0x57b581[_0x0baf('0x31')][_0x0baf('0x32')][_0x504031][_0x0baf('0x38')];_0x1522b0+=0x1){db['MemberReport'][_0x0baf('0x3c')]({'where':{'channel':_0x504031,'membername':_0x57b581[_0x0baf('0x33')][_0x0baf('0x11')],'type':'INTERACTION','uniqueid':_0x57b581[_0x0baf('0x31')][_0x0baf('0x32')][_0x504031][_0x1522b0],'exitAt':null},'defaults':{'channel':_0x504031,'membername':_0x57b581[_0x0baf('0x33')][_0x0baf('0x11')],'interface':_[_0x0baf('0x12')](_0x57b581[_0x0baf('0x33')][_0x0baf('0x3d')])?util['format'](_0x0baf('0x3e'),_0x57b581[_0x0baf('0x33')][_0x0baf('0x11')]):_0x57b581[_0x0baf('0x33')][_0x0baf('0x3d')],'type':_0x0baf('0x37'),'enterAt':moment()[_0x0baf('0x39')](_0x0baf('0x3a')),'role':_0x0baf('0x3f'),'internal':_0x57b581[_0x0baf('0x33')][_0x0baf('0x40')],'uniqueid':_0x57b581['body']['interaction'][_0x504031][_0x1522b0]}});}}}}return respondWithRpcPromise(_0x0baf('0x41'),{'id':_0x57b581[_0x0baf('0x1b')]['id'],'capacity':_0x57b581[_0x0baf('0x31')][_0x0baf('0x42')]},routingClient)[_0x0baf('0x9')](respondWithResult(_0x23ad34,null))[_0x0baf('0x16')](handleError(_0x23ad34,null));};exports[_0x0baf('0x43')]=function(_0x4b492c,_0x3fe534){return respondWithRpcPromise(_0x0baf('0x44'),_0x4b492c[_0x0baf('0x1a')])[_0x0baf('0x9')](respondWithResult(_0x3fe534,null))[_0x0baf('0x16')](handleError(_0x3fe534,null));};exports[_0x0baf('0x45')]=function(_0x5e1849,_0x3eebe5){return respondWithRpcPromise('Trunks',_0x5e1849[_0x0baf('0x1a')])['then'](respondWithResult(_0x3eebe5,null))[_0x0baf('0x16')](handleError(_0x3eebe5,null));};exports['campaigns']=function(_0x35b1a5,_0x4c035b){return respondWithRpcPromise(_0x0baf('0x46'),_0x35b1a5[_0x0baf('0x1a')])[_0x0baf('0x9')](respondWithResult(_0x4c035b,null))[_0x0baf('0x16')](handleError(_0x4c035b,null));};exports[_0x0baf('0x47')]=function(_0x576475,_0x21f179){return respondWithRpcPromise(_0x0baf('0x48'),_0x576475[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x21f179,null))[_0x0baf('0x16')](handleError(_0x21f179,null));};exports[_0x0baf('0x49')]=function(_0x480834,_0x402f4d){return respondWithRpcPromise(_0x0baf('0x48'),_0x480834[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](findById(_0x480834[_0x0baf('0x1b')]['id']))[_0x0baf('0x9')](respondWithResult(_0x402f4d,null))[_0x0baf('0x16')](handleError(_0x402f4d,null));};exports['mailQueues']=function(_0x48e855,_0x23f6ea){return respondWithRpcPromise(_0x0baf('0x4a'),_0x48e855[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x23f6ea,null))[_0x0baf('0x16')](handleError(_0x23f6ea,null));};exports[_0x0baf('0x4b')]=function(_0xaa4293,_0x14a667){return respondWithRpcPromise(_0x0baf('0x4a'),_0xaa4293['query'],routingClient)[_0x0baf('0x9')](findById(_0xaa4293[_0x0baf('0x1b')]['id']))[_0x0baf('0x9')](respondWithResult(_0x14a667,null))[_0x0baf('0x16')](handleError(_0x14a667,null));};exports[_0x0baf('0x4c')]=function(_0xebfc0c,_0x26f5c9){return respondWithRpcPromise('MailAccounts',_0xebfc0c[_0x0baf('0x1a')],mailClient)[_0x0baf('0x9')](respondWithResult(_0x26f5c9,null))[_0x0baf('0x16')](handleError(_0x26f5c9,null));};exports[_0x0baf('0x4d')]=function(_0x1c7d88,_0x1a6d22){return respondWithRpcPromise(_0x0baf('0x4e'),_0x1c7d88[_0x0baf('0x1a')],routingClient)['then'](respondWithResult(_0x1a6d22,null))[_0x0baf('0x16')](handleError(_0x1a6d22,null));};exports['showOpenchannelQueues']=function(_0x3c00e7,_0x5f2fbe){return respondWithRpcPromise('OpenchannelQueues',_0x3c00e7[_0x0baf('0x1a')],routingClient)['then'](findById(_0x3c00e7[_0x0baf('0x1b')]['id']))[_0x0baf('0x9')](respondWithResult(_0x5f2fbe,null))['catch'](handleError(_0x5f2fbe,null));};exports[_0x0baf('0x4f')]=function(_0xfb6708,_0x156572){return respondWithRpcPromise('SmsQueues',_0xfb6708['query'],routingClient)[_0x0baf('0x9')](respondWithResult(_0x156572,null))[_0x0baf('0x16')](handleError(_0x156572,null));};exports[_0x0baf('0x50')]=function(_0x7f49e,_0x784e1a){return respondWithRpcPromise('SmsQueues',_0x7f49e[_0x0baf('0x1a')],routingClient)['then'](findById(_0x7f49e['params']['id']))['then'](respondWithResult(_0x784e1a,null))[_0x0baf('0x16')](handleError(_0x784e1a,null));};exports['whatsappQueues']=function(_0x4946d4,_0x11a81e){return respondWithRpcPromise(_0x0baf('0x51'),_0x4946d4[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x11a81e,null))[_0x0baf('0x16')](handleError(_0x11a81e,null));};exports[_0x0baf('0x52')]=function(_0x4c05d6,_0xec3b32){return respondWithRpcPromise(_0x0baf('0x51'),_0x4c05d6[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](findById(_0x4c05d6[_0x0baf('0x1b')]['id']))[_0x0baf('0x9')](respondWithResult(_0xec3b32,null))['catch'](handleError(_0xec3b32,null));};exports[_0x0baf('0x53')]=function(_0x468363,_0x29fd46){return respondWithRpcPromise('FaxQueues',_0x468363[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x29fd46,null))[_0x0baf('0x16')](handleError(_0x29fd46,null));};exports[_0x0baf('0x54')]=function(_0x125906,_0x27a959){return respondWithRpcPromise(_0x0baf('0x55'),_0x125906['query'],routingClient)['then'](findById(_0x125906['params']['id']))[_0x0baf('0x9')](respondWithResult(_0x27a959,null))[_0x0baf('0x16')](handleError(_0x27a959,null));};exports[_0x0baf('0x56')]=function(_0x12b9b5,_0x3e65d4){return respondWithRpcPromise(_0x0baf('0x57'),_0x12b9b5['query'])['then'](respondWithResult(_0x3e65d4,null))[_0x0baf('0x16')](handleError(_0x3e65d4,null));};exports['chatQueuesWaitingInteractions']=function(_0x22cd07,_0x3e9b79){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x22cd07[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x3e9b79,null))[_0x0baf('0x16')](handleError(_0x3e9b79,null));};exports[_0x0baf('0x58')]=function(_0x115ff5,_0x33a5af){return respondWithRpcPromise(_0x0baf('0x59'),_0x115ff5[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x33a5af,null))['catch'](handleError(_0x33a5af,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x58a079,_0x493784){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x58a079[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x493784,null))[_0x0baf('0x16')](handleError(_0x493784,null));};exports[_0x0baf('0x5a')]=function(_0x5093f5,_0x1be7f2){return respondWithRpcPromise(_0x0baf('0x5b'),_0x5093f5['query'],routingClient)['then'](function(_0x43aecd){if(_0x5093f5[_0x0baf('0x1a')][_0x0baf('0x5c')]!==undefined){var _0x442e5f=_(_0x43aecd[_0x0baf('0x13')])[_0x0baf('0x5d')]([_0x5093f5[_0x0baf('0x1a')][_0x0baf('0x5c')],_0x5093f5['params']['id']])[_0x0baf('0x5e')](_0x0baf('0x5f'))['uniq']()[_0x0baf('0x60')]();return _0x43aecd[_0x0baf('0x13')]['filter'](function(_0x97d385){return _0x442e5f[_0x0baf('0x61')](_0x97d385[_0x0baf('0x5f')])>-0x1;});}else{return _0x43aecd[_0x0baf('0x13')][_0x0baf('0x5d')](function(_0x4fc5af){return _0x4fc5af['queue_id']===parseInt(_0x5093f5[_0x0baf('0x1b')]['id']);});}})[_0x0baf('0x9')](respondWithResult(_0x1be7f2,null))['catch'](handleError(_0x1be7f2,null));};exports[_0x0baf('0x62')]=function(_0x59dad5,_0x21ad25){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x59dad5[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x21ad25,null))[_0x0baf('0x16')](handleError(_0x21ad25,null));};exports['whatsappQueuesWaitingInteractions']=function(_0x3c2bc1,_0x5008c5){return respondWithRpcPromise(_0x0baf('0x63'),_0x3c2bc1[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x5008c5,null))[_0x0baf('0x16')](handleError(_0x5008c5,null));};exports[_0x0baf('0x64')]=function(_0x52e845,_0x866e6e){return respondWithRpcPromise(_0x0baf('0x65'),_0x52e845['query'],routingClient)[_0x0baf('0x9')](respondWithResult(_0x866e6e,null))[_0x0baf('0x16')](handleError(_0x866e6e,null));};exports[_0x0baf('0x66')]=function(_0x379c54){return function(_0x1cbbcc,_0x250df2){var _0xa4fd1b,_0x1cda78;var _0x44ef57=_[_0x0baf('0x67')](_0x379c54);var _0x3b7abf=_0x379c54===_0x0baf('0x68')?'Website':'Account';return db[_0x44ef57+_0x0baf('0x69')][_0x0baf('0x6a')]({'raw':!![],'where':{'id':_0x1cbbcc[_0x0baf('0x1b')]['id']}})['then'](function(_0x507783){if(_[_0x0baf('0x12')](_0x507783)){throw new Error(_0x44ef57+_0x0baf('0x6b'));}_0xa4fd1b=_0x507783;return db[_0x44ef57+_0x0baf('0x6c')][_0x0baf('0x6a')]({'where':{'id':_0x1cbbcc[_0x0baf('0x31')][_0x0baf('0x6d')]},'include':[{'model':db[_0x44ef57+_0x0baf('0x6e')],'as':_0x0baf('0x6e')},{'model':db[_0x44ef57+_0x3b7abf],'as':_0x0baf('0x6f')}]});})['then'](function(_0x1590a5){if(_[_0x0baf('0x12')](_0x1590a5)){throw new Error(_0x44ef57+_0x0baf('0x70'));}_0x1cda78=_0x1590a5;return _0x1590a5[_0x0baf('0x71')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x5d26e6={'uniqueid':_0x379c54+'.'+_0x1cda78['id']+'.'+_0x1cda78['Interaction']['id'],'FromUserId':_0x1cbbcc[_0x0baf('0x33')]['id'],'type':_0x0baf('0x72')};_0x5d26e6[_0x44ef57+'MessageId']=_0x1cda78['id'];_0x5d26e6[_0x44ef57+'InteractionId']=_0x1cda78[_0x0baf('0x6e')]['id'];_0x5d26e6[_0x0baf('0x73')+_0x44ef57+_0x3b7abf+'Id']=_0x1cda78['Account']['id'];_0x5d26e6['To'+_0x44ef57+_0x0baf('0x74')]=_0xa4fd1b['id'];return db[_0x44ef57+_0x0baf('0x75')][_0x0baf('0x76')](_0x5d26e6);})[_0x0baf('0x9')](function(){return respondWithRpcPromise(_0x0baf('0x77'),{'channel':_0x379c54,'interaction':_0x1cda78[_0x0baf('0x6e')],'message':_0x1cda78,'account':_0x1cda78[_0x0baf('0x6f')],'applications':[{'id':0x0,'priority':0x1,'app':_0x0baf('0x72'),'appdata':_0xa4fd1b[_0x0baf('0x11')]+','+(_0x1cda78[_0x0baf('0x6f')][_0x0baf('0x78')]||0x12c),'interval':_0x0baf('0x79')}],'transfer':!![]},routingClient);})['then'](respondWithResult(_0x250df2,null))[_0x0baf('0x16')](handleError(_0x250df2,null));};};exports[_0x0baf('0x7a')]=function(_0x1e1adb,_0x3bd15b){var _0x3c37b4,_0x195303;if(_['isNil'](_0x1e1adb[_0x0baf('0x31')][_0x0baf('0x7b')])){throw new Error(_0x0baf('0x7c'));}var _0x457ae8=_0x1e1adb[_0x0baf('0x31')]['channel'];var _0x3761b5=_[_0x0baf('0x67')](_0x457ae8);var _0x2eae1b=_0x457ae8===_0x0baf('0x68')?_0x0baf('0x7d'):'Account';return db['User'][_0x0baf('0x6a')]({'raw':!![],'where':{'id':_0x1e1adb['params']['id'],'role':_0x0baf('0x3f')}})['then'](function(_0x32d8b6){if(_[_0x0baf('0x12')](_0x32d8b6)){throw new Error(_0x0baf('0x7e'));}_0x3c37b4=_0x32d8b6;return db[_0x3761b5+_0x0baf('0x6c')]['findOne']({'where':{'id':_0x1e1adb[_0x0baf('0x31')][_0x0baf('0x6d')]},'include':[{'model':db[_0x3761b5+_0x0baf('0x6e')],'as':'Interaction'},{'model':db[_0x3761b5+_0x2eae1b],'as':'Account'}]});})['then'](function(_0x4d4884){if(_[_0x0baf('0x12')](_0x4d4884)){throw new Error(_0x3761b5+_0x0baf('0x70'));}_0x195303=_0x4d4884;return _0x4d4884[_0x0baf('0x71')]({'read':0x0,'readAt':null,'UserId':null});})[_0x0baf('0x9')](function(){var _0x597830={'uniqueid':_0x457ae8+'.'+_0x195303['id']+'.'+_0x195303[_0x0baf('0x6e')]['id'],'FromUserId':_0x1e1adb[_0x0baf('0x33')]['id'],'type':_0x0baf('0x3f'),'ToUserId':_0x3c37b4['id']};_0x597830[_0x3761b5+'MessageId']=_0x195303['id'];_0x597830[_0x3761b5+_0x0baf('0x7f')]=_0x195303[_0x0baf('0x6e')]['id'];_0x597830['From'+_0x3761b5+_0x2eae1b+'Id']=_0x195303[_0x0baf('0x6f')]['id'];return db[_0x3761b5+'TransferReport'][_0x0baf('0x76')](_0x597830);})[_0x0baf('0x9')](function(){return respondWithRpcPromise(_0x0baf('0x77'),{'channel':_0x457ae8,'interaction':_0x195303[_0x0baf('0x6e')],'message':_0x195303,'account':_0x195303['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x3c37b4[_0x0baf('0x11')]+','+(_0x195303['Account'][_0x0baf('0x80')]||0x12c),'interval':_0x0baf('0x79')}],'transfer':!![]},routingClient);})[_0x0baf('0x9')](respondWithResult(_0x3bd15b,null))[_0x0baf('0x16')](handleError(_0x3bd15b,null));}; \ No newline at end of file +var _0xbaf0=['MailQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','map','queue_id','value','indexOf','smsQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Queue','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','Account','\x20Message\x20not\x20found','update','queue','From','QueueId','TransferReport','create','Start','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','Website','Agent\x20not\x20found','InteractionId','agentTransferTimeout','moment','lodash','util','../../mysqldb','../../config/logger','api','client','http','request','then','error','code','message','result','status','sendStatus','stack','name','isNil','rows','voiceChannels','VoiceChannels','catch','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','query','params','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','updateVoiceQueue','UpdateVoiceQueue','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','body','interaction','user','hasOwnProperty','MemberReport','findAll','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','interface','SIP/%s','agent','internal','AgentCapacity','capacity','telephones','Telephones','trunks','Campaigns','chatQueues','ChatQueues','showChatQueues','MailQueues','showMailQueues','mailAccounts','openchannelQueues','OpenchannelQueues','smsQueues','showSmsQueues','WhatsappQueues','showWhatsappQueues','faxQueues','showFaxQueues','FaxQueues','faxAccounts','FaxAccounts','mailQueuesWaitingInteractions'];(function(_0x17fa8d,_0x1225dc){var _0x2b4ae5=function(_0x1230da){while(--_0x1230da){_0x17fa8d['push'](_0x17fa8d['shift']());}};_0x2b4ae5(++_0x1225dc);}(_0xbaf0,0x12a));var _0x0baf=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xbaf0[_0x465028];return _0xb783d4;};'use strict';var BPromise=require('bluebird');var moment=require(_0x0baf('0x0'));var _=require(_0x0baf('0x1'));var util=require(_0x0baf('0x2'));var db=require(_0x0baf('0x3'))['db'];var logger=require(_0x0baf('0x4'))(_0x0baf('0x5'));var jayson=require('jayson/promise');var amiClient=jayson[_0x0baf('0x6')][_0x0baf('0x7')]({'port':0x232a});var mailClient=jayson[_0x0baf('0x6')][_0x0baf('0x7')]({'port':0x232b});var routingClient=jayson[_0x0baf('0x6')][_0x0baf('0x7')]({'port':0x232c});function respondWithRpcPromise(_0x1a10b1,_0x2dcaac,_0x1d0a0d){return new BPromise(function(_0x5f5030,_0x11b947){var _0x5f20aa=_0x1d0a0d?_0x1d0a0d:amiClient;return _0x5f20aa[_0x0baf('0x8')](_0x1a10b1,_0x2dcaac)[_0x0baf('0x9')](function(_0x465528){if(_0x465528[_0x0baf('0xa')]){if(_0x465528[_0x0baf('0xa')][_0x0baf('0xb')]===0x1f4){return _0x11b947(_0x465528[_0x0baf('0xa')][_0x0baf('0xc')]);}return _0x5f5030(_0x465528[_0x0baf('0xa')][_0x0baf('0xc')]);}else{_0x5f5030(_0x465528[_0x0baf('0xd')]);}})['catch'](function(_0x5a53e2){_0x11b947(_0x5a53e2);});});}function respondWithResult(_0x465dd7,_0xe4378c){_0xe4378c=_0xe4378c||0xc8;return function(_0x5db689){if(_0x5db689){return _0x465dd7[_0x0baf('0xe')](_0xe4378c)['json'](_0x5db689);}return _0x465dd7[_0x0baf('0xf')](0x194);};}function handleError(_0x49e44b,_0x1c76a8){_0x1c76a8=_0x1c76a8||0x1f4;return function(_0x1f50c3){logger[_0x0baf('0xa')](_0x1f50c3[_0x0baf('0x10')]);if(_0x1f50c3[_0x0baf('0x11')]){delete _0x1f50c3[_0x0baf('0x11')];}_0x49e44b['status'](_0x1c76a8)['send'](_0x1f50c3);};}function findById(_0x2312c7){return function(_0x38395b){if(!_[_0x0baf('0x12')](_0x2312c7)&&!_[_0x0baf('0x12')](_0x38395b)&&!_[_0x0baf('0x12')](_0x38395b[_0x0baf('0x13')])){return _['find'](_0x38395b[_0x0baf('0x13')],function(_0xfbecec){return _0xfbecec['id']==_0x2312c7;});}return null;};}exports[_0x0baf('0x14')]=function(_0x3e9cb4,_0x47070d){return respondWithRpcPromise(_0x0baf('0x15'),_0x3e9cb4['query'])['then'](respondWithResult(_0x47070d,null))[_0x0baf('0x16')](handleError(_0x47070d,null));};exports[_0x0baf('0x17')]=function(_0x32e839,_0x1848e8){return respondWithRpcPromise(_0x0baf('0x18'),_[_0x0baf('0x19')](_0x32e839[_0x0baf('0x1a')],_0x32e839[_0x0baf('0x1b')]))[_0x0baf('0x9')](respondWithResult(_0x1848e8,null))[_0x0baf('0x16')](handleError(_0x1848e8,null));};exports['voiceChannelStopMixMonitor']=function(_0x334bd6,_0x482522){return respondWithRpcPromise(_0x0baf('0x1c'),_['merge'](_0x334bd6['query'],_0x334bd6[_0x0baf('0x1b')]))['then'](respondWithResult(_0x482522,null))['catch'](handleError(_0x482522,null));};exports[_0x0baf('0x1d')]=function(_0x27b59c,_0x34e264){return respondWithRpcPromise(_0x0baf('0x1e'),_0x27b59c[_0x0baf('0x1a')])['then'](respondWithResult(_0x34e264,null))[_0x0baf('0x16')](handleError(_0x34e264,null));};exports[_0x0baf('0x1f')]=function(_0x1ca35a,_0x366e71){return respondWithRpcPromise(_0x0baf('0x1e'),_0x1ca35a[_0x0baf('0x1a')])[_0x0baf('0x9')](findById(_0x1ca35a['params']['id']))[_0x0baf('0x9')](respondWithResult(_0x366e71,null))[_0x0baf('0x16')](handleError(_0x366e71,null));};exports[_0x0baf('0x20')]=function(_0x265915,_0x55c715){return respondWithRpcPromise(_0x0baf('0x21'),_[_0x0baf('0x19')](_0x265915['body'],_0x265915[_0x0baf('0x1b')]))[_0x0baf('0x9')](respondWithResult(_0x55c715,null))[_0x0baf('0x16')](handleError(_0x55c715,null));};exports[_0x0baf('0x22')]=function(_0xd14f0f,_0x366924){return respondWithRpcPromise(_0x0baf('0x23'),_['merge'](_0xd14f0f[_0x0baf('0x1a')],_0xd14f0f[_0x0baf('0x1b')]))[_0x0baf('0x9')](respondWithResult(_0x366924,null))[_0x0baf('0x16')](handleError(_0x366924,null));};exports[_0x0baf('0x24')]=function(_0x275ea1,_0x2fc983){return respondWithRpcPromise(_0x0baf('0x25'),_0x275ea1[_0x0baf('0x1a')])[_0x0baf('0x9')](respondWithResult(_0x2fc983,null))[_0x0baf('0x16')](handleError(_0x2fc983,null));};exports[_0x0baf('0x26')]=function(_0x45294a,_0x3a3353){return respondWithRpcPromise('VoiceQueuesChannel',_[_0x0baf('0x19')](_0x45294a['query'],_0x45294a[_0x0baf('0x1b')]))[_0x0baf('0x9')](respondWithResult(_0x3a3353,null))[_0x0baf('0x16')](handleError(_0x3a3353,null));};exports[_0x0baf('0x27')]=function(_0x5300a5,_0x1a2b03){return respondWithRpcPromise(_0x0baf('0x28'),_['merge'](_0x5300a5[_0x0baf('0x1a')],_0x5300a5[_0x0baf('0x1b')]))[_0x0baf('0x9')](respondWithResult(_0x1a2b03,null))[_0x0baf('0x16')](handleError(_0x1a2b03,null));};exports[_0x0baf('0x29')]=function(_0x1b0991,_0xe03d82){return respondWithRpcPromise(_0x0baf('0x2a'),_['merge'](_0x1b0991[_0x0baf('0x1a')],_0x1b0991[_0x0baf('0x1b')]))['then'](respondWithResult(_0xe03d82,null))[_0x0baf('0x16')](handleError(_0xe03d82,null));};exports['outbound']=function(_0x5c545f,_0x11bc49){return respondWithRpcPromise(_0x0baf('0x2b'),_0x5c545f['query'])['then'](respondWithResult(_0x11bc49,null))[_0x0baf('0x16')](handleError(_0x11bc49,null));};exports[_0x0baf('0x2c')]=function(_0x3412bc,_0xb2d9ab){return respondWithRpcPromise(_0x0baf('0x2d'),_0x3412bc[_0x0baf('0x1a')])[_0x0baf('0x9')](respondWithResult(_0xb2d9ab,null))[_0x0baf('0x16')](handleError(_0xb2d9ab,null));};exports[_0x0baf('0x2e')]=function(_0x36c6d2,_0x200864){var _0x148540;return respondWithRpcPromise(_0x0baf('0x2f'),_0x36c6d2[_0x0baf('0x1a')])['then'](function(_0x3573ce){_0x148540=_0x3573ce;return respondWithRpcPromise(_0x0baf('0x2f'),_0x36c6d2['query'],routingClient);})[_0x0baf('0x9')](function(_0x324369){return _[_0x0baf('0x19')]({},_0x324369,_0x148540);})[_0x0baf('0x9')](respondWithResult(_0x200864,null))[_0x0baf('0x16')](handleError(_0x200864,null));};exports[_0x0baf('0x30')]=function(_0x57b581,_0x23ad34){if(_0x57b581[_0x0baf('0x31')]&&_0x57b581['body'][_0x0baf('0x32')]&&_0x57b581[_0x0baf('0x33')]&&_0x57b581[_0x0baf('0x33')][_0x0baf('0x11')]){for(var _0x504031 in _0x57b581[_0x0baf('0x31')][_0x0baf('0x32')]){if(_0x57b581[_0x0baf('0x31')][_0x0baf('0x32')][_0x0baf('0x34')](_0x504031)){db[_0x0baf('0x35')][_0x0baf('0x36')]({'where':{'channel':_0x504031,'membername':_0x57b581[_0x0baf('0x33')][_0x0baf('0x11')],'type':_0x0baf('0x37'),'exitAt':null,'uniqueid':_0x57b581['body'][_0x0baf('0x32')][_0x504031]&&_0x57b581[_0x0baf('0x31')][_0x0baf('0x32')][_0x504031][_0x0baf('0x38')]?{'$notIn':_0x57b581[_0x0baf('0x31')]['interaction'][_0x504031]}:{'$ne':null}}})[_0x0baf('0x9')](function(_0x310240){var _0x27c3ee=moment()[_0x0baf('0x39')](_0x0baf('0x3a'));for(var _0x54ed41=0x0,_0x2a0924=_0x310240[_0x0baf('0x38')];_0x54ed41<_0x2a0924;_0x54ed41+=0x1){_0x310240[_0x54ed41][_0x0baf('0x3b')]({'exitAt':_0x27c3ee});}});for(var _0x1522b0=0x0;_0x1522b0<_0x57b581[_0x0baf('0x31')][_0x0baf('0x32')][_0x504031][_0x0baf('0x38')];_0x1522b0+=0x1){db['MemberReport'][_0x0baf('0x3c')]({'where':{'channel':_0x504031,'membername':_0x57b581[_0x0baf('0x33')][_0x0baf('0x11')],'type':'INTERACTION','uniqueid':_0x57b581[_0x0baf('0x31')][_0x0baf('0x32')][_0x504031][_0x1522b0],'exitAt':null},'defaults':{'channel':_0x504031,'membername':_0x57b581[_0x0baf('0x33')][_0x0baf('0x11')],'interface':_[_0x0baf('0x12')](_0x57b581[_0x0baf('0x33')][_0x0baf('0x3d')])?util['format'](_0x0baf('0x3e'),_0x57b581[_0x0baf('0x33')][_0x0baf('0x11')]):_0x57b581[_0x0baf('0x33')][_0x0baf('0x3d')],'type':_0x0baf('0x37'),'enterAt':moment()[_0x0baf('0x39')](_0x0baf('0x3a')),'role':_0x0baf('0x3f'),'internal':_0x57b581[_0x0baf('0x33')][_0x0baf('0x40')],'uniqueid':_0x57b581['body']['interaction'][_0x504031][_0x1522b0]}});}}}}return respondWithRpcPromise(_0x0baf('0x41'),{'id':_0x57b581[_0x0baf('0x1b')]['id'],'capacity':_0x57b581[_0x0baf('0x31')][_0x0baf('0x42')]},routingClient)[_0x0baf('0x9')](respondWithResult(_0x23ad34,null))[_0x0baf('0x16')](handleError(_0x23ad34,null));};exports[_0x0baf('0x43')]=function(_0x4b492c,_0x3fe534){return respondWithRpcPromise(_0x0baf('0x44'),_0x4b492c[_0x0baf('0x1a')])[_0x0baf('0x9')](respondWithResult(_0x3fe534,null))[_0x0baf('0x16')](handleError(_0x3fe534,null));};exports[_0x0baf('0x45')]=function(_0x5e1849,_0x3eebe5){return respondWithRpcPromise('Trunks',_0x5e1849[_0x0baf('0x1a')])['then'](respondWithResult(_0x3eebe5,null))[_0x0baf('0x16')](handleError(_0x3eebe5,null));};exports['campaigns']=function(_0x35b1a5,_0x4c035b){return respondWithRpcPromise(_0x0baf('0x46'),_0x35b1a5[_0x0baf('0x1a')])[_0x0baf('0x9')](respondWithResult(_0x4c035b,null))[_0x0baf('0x16')](handleError(_0x4c035b,null));};exports[_0x0baf('0x47')]=function(_0x576475,_0x21f179){return respondWithRpcPromise(_0x0baf('0x48'),_0x576475[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x21f179,null))[_0x0baf('0x16')](handleError(_0x21f179,null));};exports[_0x0baf('0x49')]=function(_0x480834,_0x402f4d){return respondWithRpcPromise(_0x0baf('0x48'),_0x480834[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](findById(_0x480834[_0x0baf('0x1b')]['id']))[_0x0baf('0x9')](respondWithResult(_0x402f4d,null))[_0x0baf('0x16')](handleError(_0x402f4d,null));};exports['mailQueues']=function(_0x48e855,_0x23f6ea){return respondWithRpcPromise(_0x0baf('0x4a'),_0x48e855[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x23f6ea,null))[_0x0baf('0x16')](handleError(_0x23f6ea,null));};exports[_0x0baf('0x4b')]=function(_0xaa4293,_0x14a667){return respondWithRpcPromise(_0x0baf('0x4a'),_0xaa4293['query'],routingClient)[_0x0baf('0x9')](findById(_0xaa4293[_0x0baf('0x1b')]['id']))[_0x0baf('0x9')](respondWithResult(_0x14a667,null))[_0x0baf('0x16')](handleError(_0x14a667,null));};exports[_0x0baf('0x4c')]=function(_0xebfc0c,_0x26f5c9){return respondWithRpcPromise('MailAccounts',_0xebfc0c[_0x0baf('0x1a')],mailClient)[_0x0baf('0x9')](respondWithResult(_0x26f5c9,null))[_0x0baf('0x16')](handleError(_0x26f5c9,null));};exports[_0x0baf('0x4d')]=function(_0x1c7d88,_0x1a6d22){return respondWithRpcPromise(_0x0baf('0x4e'),_0x1c7d88[_0x0baf('0x1a')],routingClient)['then'](respondWithResult(_0x1a6d22,null))[_0x0baf('0x16')](handleError(_0x1a6d22,null));};exports['showOpenchannelQueues']=function(_0x3c00e7,_0x5f2fbe){return respondWithRpcPromise('OpenchannelQueues',_0x3c00e7[_0x0baf('0x1a')],routingClient)['then'](findById(_0x3c00e7[_0x0baf('0x1b')]['id']))[_0x0baf('0x9')](respondWithResult(_0x5f2fbe,null))['catch'](handleError(_0x5f2fbe,null));};exports[_0x0baf('0x4f')]=function(_0xfb6708,_0x156572){return respondWithRpcPromise('SmsQueues',_0xfb6708['query'],routingClient)[_0x0baf('0x9')](respondWithResult(_0x156572,null))[_0x0baf('0x16')](handleError(_0x156572,null));};exports[_0x0baf('0x50')]=function(_0x7f49e,_0x784e1a){return respondWithRpcPromise('SmsQueues',_0x7f49e[_0x0baf('0x1a')],routingClient)['then'](findById(_0x7f49e['params']['id']))['then'](respondWithResult(_0x784e1a,null))[_0x0baf('0x16')](handleError(_0x784e1a,null));};exports['whatsappQueues']=function(_0x4946d4,_0x11a81e){return respondWithRpcPromise(_0x0baf('0x51'),_0x4946d4[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x11a81e,null))[_0x0baf('0x16')](handleError(_0x11a81e,null));};exports[_0x0baf('0x52')]=function(_0x4c05d6,_0xec3b32){return respondWithRpcPromise(_0x0baf('0x51'),_0x4c05d6[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](findById(_0x4c05d6[_0x0baf('0x1b')]['id']))[_0x0baf('0x9')](respondWithResult(_0xec3b32,null))['catch'](handleError(_0xec3b32,null));};exports[_0x0baf('0x53')]=function(_0x468363,_0x29fd46){return respondWithRpcPromise('FaxQueues',_0x468363[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x29fd46,null))[_0x0baf('0x16')](handleError(_0x29fd46,null));};exports[_0x0baf('0x54')]=function(_0x125906,_0x27a959){return respondWithRpcPromise(_0x0baf('0x55'),_0x125906['query'],routingClient)['then'](findById(_0x125906['params']['id']))[_0x0baf('0x9')](respondWithResult(_0x27a959,null))[_0x0baf('0x16')](handleError(_0x27a959,null));};exports[_0x0baf('0x56')]=function(_0x12b9b5,_0x3e65d4){return respondWithRpcPromise(_0x0baf('0x57'),_0x12b9b5['query'])['then'](respondWithResult(_0x3e65d4,null))[_0x0baf('0x16')](handleError(_0x3e65d4,null));};exports['chatQueuesWaitingInteractions']=function(_0x22cd07,_0x3e9b79){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x22cd07[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x3e9b79,null))[_0x0baf('0x16')](handleError(_0x3e9b79,null));};exports[_0x0baf('0x58')]=function(_0x115ff5,_0x33a5af){return respondWithRpcPromise(_0x0baf('0x59'),_0x115ff5[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x33a5af,null))['catch'](handleError(_0x33a5af,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x58a079,_0x493784){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x58a079[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x493784,null))[_0x0baf('0x16')](handleError(_0x493784,null));};exports[_0x0baf('0x5a')]=function(_0x5093f5,_0x1be7f2){return respondWithRpcPromise(_0x0baf('0x5b'),_0x5093f5['query'],routingClient)['then'](function(_0x43aecd){if(_0x5093f5[_0x0baf('0x1a')][_0x0baf('0x5c')]!==undefined){var _0x442e5f=_(_0x43aecd[_0x0baf('0x13')])[_0x0baf('0x5d')]([_0x5093f5[_0x0baf('0x1a')][_0x0baf('0x5c')],_0x5093f5['params']['id']])[_0x0baf('0x5e')](_0x0baf('0x5f'))['uniq']()[_0x0baf('0x60')]();return _0x43aecd[_0x0baf('0x13')]['filter'](function(_0x97d385){return _0x442e5f[_0x0baf('0x61')](_0x97d385[_0x0baf('0x5f')])>-0x1;});}else{return _0x43aecd[_0x0baf('0x13')][_0x0baf('0x5d')](function(_0x4fc5af){return _0x4fc5af['queue_id']===parseInt(_0x5093f5[_0x0baf('0x1b')]['id']);});}})[_0x0baf('0x9')](respondWithResult(_0x1be7f2,null))['catch'](handleError(_0x1be7f2,null));};exports[_0x0baf('0x62')]=function(_0x59dad5,_0x21ad25){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x59dad5[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x21ad25,null))[_0x0baf('0x16')](handleError(_0x21ad25,null));};exports['whatsappQueuesWaitingInteractions']=function(_0x3c2bc1,_0x5008c5){return respondWithRpcPromise(_0x0baf('0x63'),_0x3c2bc1[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x5008c5,null))[_0x0baf('0x16')](handleError(_0x5008c5,null));};exports[_0x0baf('0x64')]=function(_0x52e845,_0x866e6e){return respondWithRpcPromise(_0x0baf('0x65'),_0x52e845['query'],routingClient)[_0x0baf('0x9')](respondWithResult(_0x866e6e,null))[_0x0baf('0x16')](handleError(_0x866e6e,null));};exports[_0x0baf('0x66')]=function(_0x379c54){return function(_0x1cbbcc,_0x250df2){var _0xa4fd1b,_0x1cda78;var _0x44ef57=_[_0x0baf('0x67')](_0x379c54);var _0x3b7abf=_0x379c54===_0x0baf('0x68')?'Website':'Account';return db[_0x44ef57+_0x0baf('0x69')][_0x0baf('0x6a')]({'raw':!![],'where':{'id':_0x1cbbcc[_0x0baf('0x1b')]['id']}})['then'](function(_0x507783){if(_[_0x0baf('0x12')](_0x507783)){throw new Error(_0x44ef57+_0x0baf('0x6b'));}_0xa4fd1b=_0x507783;return db[_0x44ef57+_0x0baf('0x6c')][_0x0baf('0x6a')]({'where':{'id':_0x1cbbcc[_0x0baf('0x31')][_0x0baf('0x6d')]},'include':[{'model':db[_0x44ef57+_0x0baf('0x6e')],'as':_0x0baf('0x6e')},{'model':db[_0x44ef57+_0x3b7abf],'as':_0x0baf('0x6f')}]});})['then'](function(_0x1590a5){if(_[_0x0baf('0x12')](_0x1590a5)){throw new Error(_0x44ef57+_0x0baf('0x70'));}_0x1cda78=_0x1590a5;return _0x1590a5[_0x0baf('0x71')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x5d26e6={'uniqueid':_0x379c54+'.'+_0x1cda78['id']+'.'+_0x1cda78['Interaction']['id'],'FromUserId':_0x1cbbcc[_0x0baf('0x33')]['id'],'type':_0x0baf('0x72')};_0x5d26e6[_0x44ef57+'MessageId']=_0x1cda78['id'];_0x5d26e6[_0x44ef57+'InteractionId']=_0x1cda78[_0x0baf('0x6e')]['id'];_0x5d26e6[_0x0baf('0x73')+_0x44ef57+_0x3b7abf+'Id']=_0x1cda78['Account']['id'];_0x5d26e6['To'+_0x44ef57+_0x0baf('0x74')]=_0xa4fd1b['id'];return db[_0x44ef57+_0x0baf('0x75')][_0x0baf('0x76')](_0x5d26e6);})[_0x0baf('0x9')](function(){return respondWithRpcPromise(_0x0baf('0x77'),{'channel':_0x379c54,'interaction':_0x1cda78[_0x0baf('0x6e')],'message':_0x1cda78,'account':_0x1cda78[_0x0baf('0x6f')],'applications':[{'id':0x0,'priority':0x1,'app':_0x0baf('0x72'),'appdata':_0xa4fd1b[_0x0baf('0x11')]+','+(_0x1cda78[_0x0baf('0x6f')][_0x0baf('0x78')]||0x12c),'interval':_0x0baf('0x79')}],'transfer':!![]},routingClient);})['then'](respondWithResult(_0x250df2,null))[_0x0baf('0x16')](handleError(_0x250df2,null));};};exports[_0x0baf('0x7a')]=function(_0x1e1adb,_0x3bd15b){var _0x3c37b4,_0x195303;if(_['isNil'](_0x1e1adb[_0x0baf('0x31')][_0x0baf('0x7b')])){throw new Error(_0x0baf('0x7c'));}var _0x457ae8=_0x1e1adb[_0x0baf('0x31')]['channel'];var _0x3761b5=_[_0x0baf('0x67')](_0x457ae8);var _0x2eae1b=_0x457ae8===_0x0baf('0x68')?_0x0baf('0x7d'):'Account';return db['User'][_0x0baf('0x6a')]({'raw':!![],'where':{'id':_0x1e1adb['params']['id'],'role':_0x0baf('0x3f')}})['then'](function(_0x32d8b6){if(_[_0x0baf('0x12')](_0x32d8b6)){throw new Error(_0x0baf('0x7e'));}_0x3c37b4=_0x32d8b6;return db[_0x3761b5+_0x0baf('0x6c')]['findOne']({'where':{'id':_0x1e1adb[_0x0baf('0x31')][_0x0baf('0x6d')]},'include':[{'model':db[_0x3761b5+_0x0baf('0x6e')],'as':'Interaction'},{'model':db[_0x3761b5+_0x2eae1b],'as':'Account'}]});})['then'](function(_0x4d4884){if(_[_0x0baf('0x12')](_0x4d4884)){throw new Error(_0x3761b5+_0x0baf('0x70'));}_0x195303=_0x4d4884;return _0x4d4884[_0x0baf('0x71')]({'read':0x0,'readAt':null,'UserId':null});})[_0x0baf('0x9')](function(){var _0x597830={'uniqueid':_0x457ae8+'.'+_0x195303['id']+'.'+_0x195303[_0x0baf('0x6e')]['id'],'FromUserId':_0x1e1adb[_0x0baf('0x33')]['id'],'type':_0x0baf('0x3f'),'ToUserId':_0x3c37b4['id']};_0x597830[_0x3761b5+'MessageId']=_0x195303['id'];_0x597830[_0x3761b5+_0x0baf('0x7f')]=_0x195303[_0x0baf('0x6e')]['id'];_0x597830['From'+_0x3761b5+_0x2eae1b+'Id']=_0x195303[_0x0baf('0x6f')]['id'];return db[_0x3761b5+'TransferReport'][_0x0baf('0x76')](_0x597830);})[_0x0baf('0x9')](function(){return respondWithRpcPromise(_0x0baf('0x77'),{'channel':_0x457ae8,'interaction':_0x195303[_0x0baf('0x6e')],'message':_0x195303,'account':_0x195303['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x3c37b4[_0x0baf('0x11')]+','+(_0x195303['Account'][_0x0baf('0x80')]||0x12c),'interval':_0x0baf('0x79')}],'transfer':!![]},routingClient);})[_0x0baf('0x9')](respondWithResult(_0x3bd15b,null))[_0x0baf('0x16')](handleError(_0x3bd15b,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 8b9462f..e2bfaa9 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 _0x6933=['multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','get','isAuthenticated','index','/:id/run','run','post','put','/:id','update','destroy'];(function(_0xae61c6,_0x843a62){var _0x3ece46=function(_0x243771){while(--_0x243771){_0xae61c6['push'](_0xae61c6['shift']());}};_0x3ece46(++_0x843a62);}(_0x6933,0x1b5));var _0x3693=function(_0x3d829d,_0x5af899){_0x3d829d=_0x3d829d-0x0;var _0x318701=_0x6933[_0x3d829d];return _0x318701;};'use strict';var multer=require(_0x3693('0x0'));var util=require(_0x3693('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x3693('0x2'));var router=express[_0x3693('0x3')]();var fs_extra=require(_0x3693('0x4'));var auth=require(_0x3693('0x5'));var interaction=require(_0x3693('0x6'));var config=require(_0x3693('0x7'));var controller=require(_0x3693('0x8'));router[_0x3693('0x9')]('/',auth[_0x3693('0xa')](),controller[_0x3693('0xb')]);router['get']('/:id',auth[_0x3693('0xa')](),controller['show']);router[_0x3693('0x9')](_0x3693('0xc'),auth[_0x3693('0xa')](),controller[_0x3693('0xd')]);router[_0x3693('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x3693('0xf')](_0x3693('0x10'),auth[_0x3693('0xa')](),controller[_0x3693('0x11')]);router['delete'](_0x3693('0x10'),auth[_0x3693('0xa')](),controller[_0x3693('0x12')]);module['exports']=router; \ No newline at end of file +var _0x352e=['../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','/:id/run','post','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra'];(function(_0x33b5b3,_0x113f0a){var _0x51949d=function(_0x2e334f){while(--_0x2e334f){_0x33b5b3['push'](_0x33b5b3['shift']());}};_0x51949d(++_0x113f0a);}(_0x352e,0x13a));var _0xe352=function(_0x250e08,_0x55be8a){_0x250e08=_0x250e08-0x0;var _0xe236ee=_0x352e[_0x250e08];return _0xe236ee;};'use strict';var multer=require(_0xe352('0x0'));var util=require(_0xe352('0x1'));var path=require(_0xe352('0x2'));var timeout=require('connect-timeout');var express=require(_0xe352('0x3'));var router=express[_0xe352('0x4')]();var fs_extra=require(_0xe352('0x5'));var auth=require(_0xe352('0x6'));var interaction=require(_0xe352('0x7'));var config=require('../../config/environment');var controller=require('./schedule.controller');router[_0xe352('0x8')]('/',auth[_0xe352('0x9')](),controller[_0xe352('0xa')]);router[_0xe352('0x8')](_0xe352('0xb'),auth[_0xe352('0x9')](),controller[_0xe352('0xc')]);router[_0xe352('0x8')](_0xe352('0xd'),auth[_0xe352('0x9')](),controller['run']);router[_0xe352('0xe')]('/',auth[_0xe352('0x9')](),controller['create']);router[_0xe352('0xf')](_0xe352('0xb'),auth[_0xe352('0x9')](),controller[_0xe352('0x10')]);router[_0xe352('0x11')](_0xe352('0xb'),auth['isAuthenticated'](),controller[_0xe352('0x12')]);module[_0xe352('0x13')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index c7777ee..dbbe51e 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 _0x0bc2=['DATE','INTEGER','ENUM','years','hours','csv','pdf','custom','TEXT','sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x0bc2,0xa3));var _0x20bc=function(_0xec34d4,_0x46d527){_0xec34d4=_0xec34d4-0x0;var _0x435307=_0x0bc2[_0xec34d4];return _0x435307;};'use strict';var Sequelize=require(_0x20bc('0x0'));module[_0x20bc('0x1')]={'name':{'type':Sequelize[_0x20bc('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x20bc('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x20bc('0x4')},'startAt':{'type':Sequelize[_0x20bc('0x5')],'allowNull':![]},'endAt':{'type':Sequelize[_0x20bc('0x5')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x20bc('0x6')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x20bc('0x7')](_0x20bc('0x8'),'quarters','months','weeks','days',_0x20bc('0x9'),'minutes'),'allowNull':![],'defaultValue':'days'},'output':{'type':Sequelize['ENUM'](_0x20bc('0xa'),_0x20bc('0xb'),'xlsx'),'allowNull':![],'defaultValue':_0x20bc('0xa')},'type':{'type':Sequelize[_0x20bc('0x7')](_0x20bc('0xc'),'default'),'allowNull':![],'defaultValue':_0x20bc('0xc')},'sendMail':{'type':Sequelize[_0x20bc('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x20bc('0x2')]},'cc':{'type':Sequelize[_0x20bc('0xd')]},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x91c0=['DATE','ENUM','years','quarters','weeks','hours','days','csv','xlsx','custom','default','TEXT','sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*'];(function(_0x2323fe,_0x2f5b88){var _0x2d123c=function(_0x28bdfa){while(--_0x28bdfa){_0x2323fe['push'](_0x2323fe['shift']());}};_0x2d123c(++_0x2f5b88);}(_0x91c0,0xb6));var _0x091c=function(_0x5d2a22,_0x38b102){_0x5d2a22=_0x5d2a22-0x0;var _0x35490e=_0x91c0[_0x5d2a22];return _0x35490e;};'use strict';var Sequelize=require(_0x091c('0x0'));module[_0x091c('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x091c('0x2')]},'active':{'type':Sequelize[_0x091c('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x091c('0x4')},'startAt':{'type':Sequelize[_0x091c('0x5')],'allowNull':![]},'endAt':{'type':Sequelize[_0x091c('0x5')],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x091c('0x6')](_0x091c('0x7'),_0x091c('0x8'),'months',_0x091c('0x9'),'days',_0x091c('0xa'),'minutes'),'allowNull':![],'defaultValue':_0x091c('0xb')},'output':{'type':Sequelize['ENUM'](_0x091c('0xc'),'pdf',_0x091c('0xd')),'allowNull':![],'defaultValue':_0x091c('0xc')},'type':{'type':Sequelize[_0x091c('0x6')](_0x091c('0xe'),_0x091c('0xf')),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize[_0x091c('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x091c('0x2')]},'cc':{'type':Sequelize[_0x091c('0x10')]},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize[_0x091c('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 41cd06d..7fb944f 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 _0xf498=['fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','destroy','then','get','Scheduler','sendStatus','error','name','index','Schedule','rawAttributes','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','rows','catch','show','params','includeAll','include','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','run','eml-format','zip-dir'];(function(_0x44d9ab,_0x76bc69){var _0x31485e=function(_0x1e44ce){while(--_0x1e44ce){_0x44d9ab['push'](_0x44d9ab['shift']());}};_0x31485e(++_0x76bc69);}(_0xf498,0x9c));var _0x8f49=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0xf498[_0x164eca];return _0x2ce562;};'use strict';var emlformat=require(_0x8f49('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8f49('0x1'));var jsonpatch=require(_0x8f49('0x2'));var rp=require(_0x8f49('0x3'));var moment=require(_0x8f49('0x4'));var BPromise=require(_0x8f49('0x5'));var Mustache=require(_0x8f49('0x6'));var util=require('util');var path=require(_0x8f49('0x7'));var sox=require('sox');var csv=require(_0x8f49('0x8'));var ejs=require(_0x8f49('0x9'));var fs=require('fs');var fs_extra=require(_0x8f49('0xa'));var _=require(_0x8f49('0xb'));var squel=require(_0x8f49('0xc'));var crypto=require(_0x8f49('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8f49('0x8'));var querystring=require(_0x8f49('0xe'));var Papa=require(_0x8f49('0xf'));var Redis=require(_0x8f49('0x10'));var authService=require(_0x8f49('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x8f49('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x8f49('0x13'));var db=require(_0x8f49('0x14'))['db'];function respondWithStatusCode(_0x59abb1,_0x5c1fc9){_0x5c1fc9=_0x5c1fc9||0xcc;return function(_0x5ec6c2){if(_0x5ec6c2){return _0x59abb1['sendStatus'](_0x5c1fc9);}return _0x59abb1[_0x8f49('0x15')](_0x5c1fc9)[_0x8f49('0x16')]();};}function respondWithResult(_0x5b195f,_0x3969ae){_0x3969ae=_0x3969ae||0xc8;return function(_0x41d0ea){if(_0x41d0ea){return _0x5b195f[_0x8f49('0x15')](_0x3969ae)[_0x8f49('0x17')](_0x41d0ea);}};}function respondWithFilteredResult(_0x262f92,_0x5d59cf){return function(_0xf93eb3){if(_0xf93eb3){var _0x145541=typeof _0x5d59cf[_0x8f49('0x18')]===_0x8f49('0x19')&&typeof _0x5d59cf['limit']==='undefined';var _0x12a9d1=_0xf93eb3[_0x8f49('0x1a')];var _0x5796b4=_0x145541?0x0:_0x5d59cf[_0x8f49('0x18')];var _0x57b4ee=_0x145541?_0xf93eb3[_0x8f49('0x1a')]:_0x5d59cf['offset']+_0x5d59cf[_0x8f49('0x1b')];var _0x484280;if(_0x57b4ee>=_0x12a9d1){_0x57b4ee=_0x12a9d1;_0x484280=0xc8;}else{_0x484280=0xce;}_0x262f92[_0x8f49('0x15')](_0x484280);return _0x262f92[_0x8f49('0x1c')](_0x8f49('0x1d'),_0x5796b4+'-'+_0x57b4ee+'/'+_0x12a9d1)[_0x8f49('0x17')](_0xf93eb3);}return null;};}function patchUpdates(_0x36ca79){return function(_0x3f29d4){try{jsonpatch[_0x8f49('0x1e')](_0x3f29d4,_0x36ca79,!![]);}catch(_0x1f2495){return BPromise[_0x8f49('0x1f')](_0x1f2495);}return _0x3f29d4['save']();};}function saveUpdates(_0x42a3d4,_0x26b397){return function(_0x2f4305){if(_0x2f4305){return _0x2f4305['update'](_0x42a3d4)['then'](function(_0x131b63){return _0x131b63;});}return null;};}function removeEntity(_0xde66b6,_0x1035b8){return function(_0x2fd980){if(_0x2fd980){return _0x2fd980[_0x8f49('0x20')]()[_0x8f49('0x21')](function(){var _0x200015=_0x2fd980[_0x8f49('0x22')]({'plain':!![]});var _0x508015=_0x8f49('0x23');return db['UserProfileResource'][_0x8f49('0x20')]({'where':{'type':_0x508015,'resourceId':_0x200015['id']}})['then'](function(){return _0x2fd980;});})[_0x8f49('0x21')](function(){_0xde66b6[_0x8f49('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x40abcf,_0x56d19a){return function(_0xe7e07a){if(!_0xe7e07a){_0x40abcf[_0x8f49('0x24')](0x194);}return _0xe7e07a;};}function handleError(_0x396620,_0x16968f){_0x16968f=_0x16968f||0x1f4;return function(_0x35fb57){logger[_0x8f49('0x25')](_0x35fb57['stack']);if(_0x35fb57[_0x8f49('0x26')]){delete _0x35fb57[_0x8f49('0x26')];}_0x396620['status'](_0x16968f)['send'](_0x35fb57);};}exports[_0x8f49('0x27')]=function(_0x5394c0,_0x5d2923){var _0x1a3885={},_0xbbfc92={},_0x297eae={'count':0x0,'rows':[]};var _0x2ec1ec=_['map'](db[_0x8f49('0x28')][_0x8f49('0x29')],function(_0x3a751a){return{'name':_0x3a751a[_0x8f49('0x2a')],'type':_0x3a751a[_0x8f49('0x2b')][_0x8f49('0x2c')]};});_0xbbfc92[_0x8f49('0x2d')]=_[_0x8f49('0x2e')](_0x2ec1ec,_0x8f49('0x26'));_0xbbfc92['query']=_[_0x8f49('0x2f')](_0x5394c0['query']);_0xbbfc92[_0x8f49('0x30')]=_[_0x8f49('0x31')](_0xbbfc92['model'],_0xbbfc92[_0x8f49('0x32')]);_0x1a3885[_0x8f49('0x33')]=_['intersection'](_0xbbfc92['model'],qs[_0x8f49('0x34')](_0x5394c0[_0x8f49('0x32')][_0x8f49('0x34')]));_0x1a3885[_0x8f49('0x33')]=_0x1a3885[_0x8f49('0x33')][_0x8f49('0x35')]?_0x1a3885[_0x8f49('0x33')]:_0xbbfc92['model'];if(!_0x5394c0['query'][_0x8f49('0x36')](_0x8f49('0x37'))){_0x1a3885[_0x8f49('0x1b')]=qs[_0x8f49('0x1b')](_0x5394c0['query'][_0x8f49('0x1b')]);_0x1a3885[_0x8f49('0x18')]=qs[_0x8f49('0x18')](_0x5394c0['query'][_0x8f49('0x18')]);}_0x1a3885[_0x8f49('0x38')]=qs[_0x8f49('0x39')](_0x5394c0[_0x8f49('0x32')][_0x8f49('0x39')]);_0x1a3885[_0x8f49('0x3a')]=qs['filters'](_[_0x8f49('0x3b')](_0x5394c0[_0x8f49('0x32')],_0xbbfc92[_0x8f49('0x30')]),_0x2ec1ec);if(_0x5394c0[_0x8f49('0x32')]['filter']){_0x1a3885[_0x8f49('0x3a')]=_[_0x8f49('0x3c')](_0x1a3885['where'],{'$or':_['map'](_0x2ec1ec,function(_0xa6535f){if(_0xa6535f['type']!=='VIRTUAL'){var _0x13bc41={};_0x13bc41[_0xa6535f[_0x8f49('0x26')]]={'$like':'%'+_0x5394c0[_0x8f49('0x32')][_0x8f49('0x3d')]+'%'};return _0x13bc41;}})});}_0x1a3885=_[_0x8f49('0x3c')]({},_0x1a3885,_0x5394c0[_0x8f49('0x3e')]);var _0x508151={'where':_0x1a3885[_0x8f49('0x3a')]};return db[_0x8f49('0x28')][_0x8f49('0x1a')](_0x508151)['then'](function(_0x48ee96){_0x297eae[_0x8f49('0x1a')]=_0x48ee96;if(_0x5394c0[_0x8f49('0x32')]['includeAll']){_0x1a3885['include']=[{'all':!![]}];}return db[_0x8f49('0x28')]['findAll'](_0x1a3885);})[_0x8f49('0x21')](function(_0x430780){_0x297eae[_0x8f49('0x3f')]=_0x430780;return _0x297eae;})[_0x8f49('0x21')](respondWithFilteredResult(_0x5d2923,_0x1a3885))[_0x8f49('0x40')](handleError(_0x5d2923,null));};exports[_0x8f49('0x41')]=function(_0x3eb1f4,_0x278343){var _0x3b16e0={'raw':![],'where':{'id':_0x3eb1f4[_0x8f49('0x42')]['id']}},_0x59b897={};_0x59b897[_0x8f49('0x2d')]=_['keys'](db[_0x8f49('0x28')][_0x8f49('0x29')]);_0x59b897['query']=_[_0x8f49('0x2f')](_0x3eb1f4[_0x8f49('0x32')]);_0x59b897[_0x8f49('0x30')]=_[_0x8f49('0x31')](_0x59b897[_0x8f49('0x2d')],_0x59b897[_0x8f49('0x32')]);_0x3b16e0[_0x8f49('0x33')]=_[_0x8f49('0x31')](_0x59b897[_0x8f49('0x2d')],qs[_0x8f49('0x34')](_0x3eb1f4[_0x8f49('0x32')][_0x8f49('0x34')]));_0x3b16e0[_0x8f49('0x33')]=_0x3b16e0[_0x8f49('0x33')][_0x8f49('0x35')]?_0x3b16e0[_0x8f49('0x33')]:_0x59b897[_0x8f49('0x2d')];if(_0x3eb1f4[_0x8f49('0x32')][_0x8f49('0x43')]){_0x3b16e0[_0x8f49('0x44')]=[{'all':!![]}];}_0x3b16e0=_['merge']({},_0x3b16e0,_0x3eb1f4['options']);return db[_0x8f49('0x28')]['find'](_0x3b16e0)['then'](handleEntityNotFound(_0x278343,null))[_0x8f49('0x21')](respondWithResult(_0x278343,null))[_0x8f49('0x40')](handleError(_0x278343,null));};exports[_0x8f49('0x45')]=function(_0x1b0566,_0x3644c4){return db[_0x8f49('0x28')][_0x8f49('0x45')](_0x1b0566['body'],{})[_0x8f49('0x21')](function(_0x20d756){var _0x25c1b7=_0x1b0566['user']['get']({'plain':!![]});if(!_0x25c1b7)throw new Error(_0x8f49('0x46'));if(_0x25c1b7['role']==='user'){var _0x5be9d2=_0x20d756[_0x8f49('0x22')]({'plain':!![]});var _0x4dd5b5=_0x8f49('0x23');return db['UserProfileSection'][_0x8f49('0x47')]({'where':{'name':_0x4dd5b5,'userProfileId':_0x25c1b7[_0x8f49('0x48')]},'raw':!![]})[_0x8f49('0x21')](function(_0x3c4175){if(_0x3c4175&&_0x3c4175[_0x8f49('0x49')]===0x0){return db[_0x8f49('0x4a')][_0x8f49('0x45')]({'name':_0x5be9d2[_0x8f49('0x26')],'resourceId':_0x5be9d2['id'],'type':_0x3c4175[_0x8f49('0x26')],'sectionId':_0x3c4175['id']},{})['then'](function(){return _0x20d756;});}else{return _0x20d756;}})['catch'](function(_0x378193){logger[_0x8f49('0x25')](_0x8f49('0x4b'),_0x378193);throw _0x378193;});}return _0x20d756;})[_0x8f49('0x21')](respondWithResult(_0x3644c4,0xc9))[_0x8f49('0x40')](handleError(_0x3644c4,null));};exports[_0x8f49('0x4c')]=function(_0x17c7e0,_0x5ddf36){if(_0x17c7e0[_0x8f49('0x4d')]['id']){delete _0x17c7e0[_0x8f49('0x4d')]['id'];}return db['Schedule']['find']({'where':{'id':_0x17c7e0['params']['id']}})['then'](handleEntityNotFound(_0x5ddf36,null))[_0x8f49('0x21')](saveUpdates(_0x17c7e0['body'],null))['then'](respondWithResult(_0x5ddf36,null))[_0x8f49('0x40')](handleError(_0x5ddf36,null));};exports[_0x8f49('0x20')]=function(_0x5e4fe7,_0xe9746d){return db[_0x8f49('0x28')][_0x8f49('0x47')]({'where':{'id':_0x5e4fe7[_0x8f49('0x42')]['id']}})[_0x8f49('0x21')](handleEntityNotFound(_0xe9746d,null))['then'](removeEntity(_0xe9746d,null))['catch'](handleError(_0xe9746d,null));};exports[_0x8f49('0x4e')]=function(_0x3fbaa1,_0x31f877,_0x36541e){var _0x3eba47=require('../../config/schedule');return db[_0x8f49('0x28')][_0x8f49('0x47')]({'where':{'id':_0x3fbaa1[_0x8f49('0x42')]['id']},'raw':!![]})[_0x8f49('0x21')](handleEntityNotFound(_0x31f877,null))[_0x8f49('0x21')](function(){_0x3eba47[_0x8f49('0x4e')](_0x3fbaa1[_0x8f49('0x42')]['id']);})['then'](respondWithStatusCode(_0x31f877,null))[_0x8f49('0x40')](handleError(_0x31f877,null));}; \ No newline at end of file +var _0xf6b8=['../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','get','Scheduler','destroy','end','error','stack','name','send','index','Schedule','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','merge','type','VIRTUAL','options','includeAll','rows','show','params','find','create','body','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','../../config/schedule','run','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x39b316,_0x3def1e){var _0x182ab1=function(_0x3e4f10){while(--_0x3e4f10){_0x39b316['push'](_0x39b316['shift']());}};_0x182ab1(++_0x3def1e);}(_0xf6b8,0x1e6));var _0x8f6b=function(_0x278648,_0x23be73){_0x278648=_0x278648-0x0;var _0x10d2e5=_0xf6b8[_0x278648];return _0x10d2e5;};'use strict';var emlformat=require(_0x8f6b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8f6b('0x1'));var jsonpatch=require(_0x8f6b('0x2'));var rp=require(_0x8f6b('0x3'));var moment=require('moment');var BPromise=require(_0x8f6b('0x4'));var Mustache=require(_0x8f6b('0x5'));var util=require(_0x8f6b('0x6'));var path=require(_0x8f6b('0x7'));var sox=require(_0x8f6b('0x8'));var csv=require(_0x8f6b('0x9'));var ejs=require(_0x8f6b('0xa'));var fs=require('fs');var fs_extra=require(_0x8f6b('0xb'));var _=require(_0x8f6b('0xc'));var squel=require(_0x8f6b('0xd'));var crypto=require(_0x8f6b('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x8f6b('0xf'));var toCsv=require(_0x8f6b('0x9'));var querystring=require(_0x8f6b('0x10'));var Papa=require(_0x8f6b('0x11'));var Redis=require('ioredis');var authService=require(_0x8f6b('0x12'));var qs=require(_0x8f6b('0x13'));var as=require(_0x8f6b('0x14'));var hardwareService=require(_0x8f6b('0x15'));var logger=require(_0x8f6b('0x16'))(_0x8f6b('0x17'));var utils=require(_0x8f6b('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x8f6b('0x19'));var db=require(_0x8f6b('0x1a'))['db'];function respondWithStatusCode(_0xa24424,_0x5080e){_0x5080e=_0x5080e||0xcc;return function(_0x2d8eb0){if(_0x2d8eb0){return _0xa24424[_0x8f6b('0x1b')](_0x5080e);}return _0xa24424[_0x8f6b('0x1c')](_0x5080e)['end']();};}function respondWithResult(_0x15da62,_0x5871cd){_0x5871cd=_0x5871cd||0xc8;return function(_0x594bfc){if(_0x594bfc){return _0x15da62[_0x8f6b('0x1c')](_0x5871cd)['json'](_0x594bfc);}};}function respondWithFilteredResult(_0x460222,_0x1ac053){return function(_0x23a954){if(_0x23a954){var _0x1bbe99=typeof _0x1ac053[_0x8f6b('0x1d')]===_0x8f6b('0x1e')&&typeof _0x1ac053[_0x8f6b('0x1f')]===_0x8f6b('0x1e');var _0x1a6bed=_0x23a954[_0x8f6b('0x20')];var _0x53cb03=_0x1bbe99?0x0:_0x1ac053[_0x8f6b('0x1d')];var _0x555b22=_0x1bbe99?_0x23a954[_0x8f6b('0x20')]:_0x1ac053[_0x8f6b('0x1d')]+_0x1ac053['limit'];var _0x1e2758;if(_0x555b22>=_0x1a6bed){_0x555b22=_0x1a6bed;_0x1e2758=0xc8;}else{_0x1e2758=0xce;}_0x460222[_0x8f6b('0x1c')](_0x1e2758);return _0x460222[_0x8f6b('0x21')](_0x8f6b('0x22'),_0x53cb03+'-'+_0x555b22+'/'+_0x1a6bed)[_0x8f6b('0x23')](_0x23a954);}return null;};}function patchUpdates(_0x591f29){return function(_0x534a81){try{jsonpatch[_0x8f6b('0x24')](_0x534a81,_0x591f29,!![]);}catch(_0x383d8b){return BPromise[_0x8f6b('0x25')](_0x383d8b);}return _0x534a81[_0x8f6b('0x26')]();};}function saveUpdates(_0x45fb00,_0x491e72){return function(_0x223979){if(_0x223979){return _0x223979['update'](_0x45fb00)[_0x8f6b('0x27')](function(_0x32ce38){return _0x32ce38;});}return null;};}function removeEntity(_0x5579c6,_0x39993b){return function(_0x52342d){if(_0x52342d){return _0x52342d['destroy']()[_0x8f6b('0x27')](function(){var _0x232c83=_0x52342d[_0x8f6b('0x28')]({'plain':!![]});var _0x5b9008=_0x8f6b('0x29');return db['UserProfileResource'][_0x8f6b('0x2a')]({'where':{'type':_0x5b9008,'resourceId':_0x232c83['id']}})['then'](function(){return _0x52342d;});})[_0x8f6b('0x27')](function(){_0x5579c6[_0x8f6b('0x1c')](0xcc)[_0x8f6b('0x2b')]();});}};}function handleEntityNotFound(_0x231bdf,_0x3a6cfe){return function(_0x3a7bd1){if(!_0x3a7bd1){_0x231bdf[_0x8f6b('0x1b')](0x194);}return _0x3a7bd1;};}function handleError(_0x4e0804,_0x5f4a46){_0x5f4a46=_0x5f4a46||0x1f4;return function(_0x12fe3e){logger[_0x8f6b('0x2c')](_0x12fe3e[_0x8f6b('0x2d')]);if(_0x12fe3e[_0x8f6b('0x2e')]){delete _0x12fe3e[_0x8f6b('0x2e')];}_0x4e0804['status'](_0x5f4a46)[_0x8f6b('0x2f')](_0x12fe3e);};}exports[_0x8f6b('0x30')]=function(_0x401bfa,_0x4e28f6){var _0x144b7b={},_0x5349e4={},_0x24c113={'count':0x0,'rows':[]};var _0x1ff01e=_['map'](db[_0x8f6b('0x31')]['rawAttributes'],function(_0x44f98c){return{'name':_0x44f98c[_0x8f6b('0x32')],'type':_0x44f98c['type'][_0x8f6b('0x33')]};});_0x5349e4[_0x8f6b('0x34')]=_[_0x8f6b('0x35')](_0x1ff01e,_0x8f6b('0x2e'));_0x5349e4[_0x8f6b('0x36')]=_[_0x8f6b('0x37')](_0x401bfa[_0x8f6b('0x36')]);_0x5349e4[_0x8f6b('0x38')]=_[_0x8f6b('0x39')](_0x5349e4[_0x8f6b('0x34')],_0x5349e4['query']);_0x144b7b['attributes']=_['intersection'](_0x5349e4['model'],qs[_0x8f6b('0x3a')](_0x401bfa[_0x8f6b('0x36')][_0x8f6b('0x3a')]));_0x144b7b[_0x8f6b('0x3b')]=_0x144b7b[_0x8f6b('0x3b')][_0x8f6b('0x3c')]?_0x144b7b['attributes']:_0x5349e4[_0x8f6b('0x34')];if(!_0x401bfa[_0x8f6b('0x36')][_0x8f6b('0x3d')](_0x8f6b('0x3e'))){_0x144b7b[_0x8f6b('0x1f')]=qs['limit'](_0x401bfa[_0x8f6b('0x36')][_0x8f6b('0x1f')]);_0x144b7b['offset']=qs[_0x8f6b('0x1d')](_0x401bfa[_0x8f6b('0x36')][_0x8f6b('0x1d')]);}_0x144b7b['order']=qs[_0x8f6b('0x3f')](_0x401bfa[_0x8f6b('0x36')][_0x8f6b('0x3f')]);_0x144b7b['where']=qs['filters'](_['pick'](_0x401bfa[_0x8f6b('0x36')],_0x5349e4['filters']),_0x1ff01e);if(_0x401bfa[_0x8f6b('0x36')]['filter']){_0x144b7b[_0x8f6b('0x40')]=_[_0x8f6b('0x41')](_0x144b7b[_0x8f6b('0x40')],{'$or':_['map'](_0x1ff01e,function(_0x50cad4){if(_0x50cad4[_0x8f6b('0x42')]!==_0x8f6b('0x43')){var _0x69c97d={};_0x69c97d[_0x50cad4['name']]={'$like':'%'+_0x401bfa['query']['filter']+'%'};return _0x69c97d;}})});}_0x144b7b=_[_0x8f6b('0x41')]({},_0x144b7b,_0x401bfa[_0x8f6b('0x44')]);var _0x4ae023={'where':_0x144b7b[_0x8f6b('0x40')]};return db[_0x8f6b('0x31')][_0x8f6b('0x20')](_0x4ae023)['then'](function(_0x5cd18f){_0x24c113['count']=_0x5cd18f;if(_0x401bfa['query'][_0x8f6b('0x45')]){_0x144b7b['include']=[{'all':!![]}];}return db[_0x8f6b('0x31')]['findAll'](_0x144b7b);})[_0x8f6b('0x27')](function(_0x4ae803){_0x24c113[_0x8f6b('0x46')]=_0x4ae803;return _0x24c113;})['then'](respondWithFilteredResult(_0x4e28f6,_0x144b7b))['catch'](handleError(_0x4e28f6,null));};exports[_0x8f6b('0x47')]=function(_0x11f5ed,_0x4b7086){var _0x2691ff={'raw':![],'where':{'id':_0x11f5ed[_0x8f6b('0x48')]['id']}},_0xb4488={};_0xb4488[_0x8f6b('0x34')]=_[_0x8f6b('0x37')](db['Schedule']['rawAttributes']);_0xb4488[_0x8f6b('0x36')]=_[_0x8f6b('0x37')](_0x11f5ed[_0x8f6b('0x36')]);_0xb4488['filters']=_[_0x8f6b('0x39')](_0xb4488[_0x8f6b('0x34')],_0xb4488[_0x8f6b('0x36')]);_0x2691ff['attributes']=_['intersection'](_0xb4488[_0x8f6b('0x34')],qs[_0x8f6b('0x3a')](_0x11f5ed[_0x8f6b('0x36')][_0x8f6b('0x3a')]));_0x2691ff[_0x8f6b('0x3b')]=_0x2691ff[_0x8f6b('0x3b')]['length']?_0x2691ff['attributes']:_0xb4488[_0x8f6b('0x34')];if(_0x11f5ed['query'][_0x8f6b('0x45')]){_0x2691ff['include']=[{'all':!![]}];}_0x2691ff=_[_0x8f6b('0x41')]({},_0x2691ff,_0x11f5ed['options']);return db[_0x8f6b('0x31')][_0x8f6b('0x49')](_0x2691ff)['then'](handleEntityNotFound(_0x4b7086,null))[_0x8f6b('0x27')](respondWithResult(_0x4b7086,null))['catch'](handleError(_0x4b7086,null));};exports[_0x8f6b('0x4a')]=function(_0x303e55,_0x5bef87){return db['Schedule'][_0x8f6b('0x4a')](_0x303e55[_0x8f6b('0x4b')],{})[_0x8f6b('0x27')](function(_0x5bce14){var _0x1c298e=_0x303e55[_0x8f6b('0x4c')][_0x8f6b('0x28')]({'plain':!![]});if(!_0x1c298e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1c298e['role']===_0x8f6b('0x4c')){var _0x59623b=_0x5bce14[_0x8f6b('0x28')]({'plain':!![]});var _0x790198='Scheduler';return db[_0x8f6b('0x4d')][_0x8f6b('0x49')]({'where':{'name':_0x790198,'userProfileId':_0x1c298e[_0x8f6b('0x4e')]},'raw':!![]})['then'](function(_0x1cc586){if(_0x1cc586&&_0x1cc586[_0x8f6b('0x4f')]===0x0){return db[_0x8f6b('0x50')][_0x8f6b('0x4a')]({'name':_0x59623b['name'],'resourceId':_0x59623b['id'],'type':_0x1cc586[_0x8f6b('0x2e')],'sectionId':_0x1cc586['id']},{})['then'](function(){return _0x5bce14;});}else{return _0x5bce14;}})[_0x8f6b('0x51')](function(_0x45f470){logger[_0x8f6b('0x2c')](_0x8f6b('0x52'),_0x45f470);throw _0x45f470;});}return _0x5bce14;})[_0x8f6b('0x27')](respondWithResult(_0x5bef87,0xc9))[_0x8f6b('0x51')](handleError(_0x5bef87,null));};exports['update']=function(_0x37f1d7,_0x49f89b){if(_0x37f1d7['body']['id']){delete _0x37f1d7['body']['id'];}return db[_0x8f6b('0x31')][_0x8f6b('0x49')]({'where':{'id':_0x37f1d7['params']['id']}})[_0x8f6b('0x27')](handleEntityNotFound(_0x49f89b,null))['then'](saveUpdates(_0x37f1d7[_0x8f6b('0x4b')],null))['then'](respondWithResult(_0x49f89b,null))[_0x8f6b('0x51')](handleError(_0x49f89b,null));};exports[_0x8f6b('0x2a')]=function(_0x75c117,_0x5efa2b){return db[_0x8f6b('0x31')][_0x8f6b('0x49')]({'where':{'id':_0x75c117[_0x8f6b('0x48')]['id']}})[_0x8f6b('0x27')](handleEntityNotFound(_0x5efa2b,null))['then'](removeEntity(_0x5efa2b,null))[_0x8f6b('0x51')](handleError(_0x5efa2b,null));};exports['run']=function(_0x5c759a,_0x52f00e,_0x8bdca4){var _0x2706e1=require(_0x8f6b('0x53'));return db['Schedule'][_0x8f6b('0x49')]({'where':{'id':_0x5c759a[_0x8f6b('0x48')]['id']},'raw':!![]})[_0x8f6b('0x27')](handleEntityNotFound(_0x52f00e,null))[_0x8f6b('0x27')](function(){_0x2706e1[_0x8f6b('0x54')](_0x5c759a['params']['id']);})[_0x8f6b('0x27')](respondWithStatusCode(_0x52f00e,null))[_0x8f6b('0x51')](handleError(_0x52f00e,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 30ae42d..567689f 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 _0xff01=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','exports'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0xff01,0x6c));var _0x1ff0=function(_0x3d2331,_0x557e21){_0x3d2331=_0x3d2331-0x0;var _0x16fa20=_0xff01[_0x3d2331];return _0x16fa20;};'use strict';var _=require(_0x1ff0('0x0'));var util=require(_0x1ff0('0x1'));var logger=require(_0x1ff0('0x2'))(_0x1ff0('0x3'));var moment=require(_0x1ff0('0x4'));var BPromise=require(_0x1ff0('0x5'));var rp=require(_0x1ff0('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1ff0('0x7'));var config=require('../../config/environment');var attributes=require('./schedule.attributes');module[_0x1ff0('0x8')]=function(_0x4e88cf,_0x5b4d10){return _0x4e88cf['define']('Schedule',attributes,{'tableName':'tools_schedules','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc82e=['tools_schedules','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./schedule.attributes','define','Schedule'];(function(_0x2e11ab,_0x4e146e){var _0x1dd724=function(_0x4c6abb){while(--_0x4c6abb){_0x2e11ab['push'](_0x2e11ab['shift']());}};_0x1dd724(++_0x4e146e);}(_0xc82e,0x12d));var _0xec82=function(_0x2e44f3,_0x186488){_0x2e44f3=_0x2e44f3-0x0;var _0x233656=_0xc82e[_0x2e44f3];return _0x233656;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xec82('0x0'))(_0xec82('0x1'));var moment=require(_0xec82('0x2'));var BPromise=require('bluebird');var rp=require(_0xec82('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xec82('0x4'));var config=require(_0xec82('0x5'));var attributes=require(_0xec82('0x6'));module['exports']=function(_0x3f11fa,_0x54d7f6){return _0x3f11fa[_0xec82('0x7')](_0xec82('0x8'),attributes,{'tableName':_0xec82('0x9'),'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 cea5449..67a3107 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 _0x376f=['../../config/utils','rpc','client','http','request','then','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Schedule,\x20%s,\x20%s','info','catch','lodash','util','bluebird','randomstring'];(function(_0x3beadf,_0x20f1bf){var _0x3595c3=function(_0xa15811){while(--_0xa15811){_0x3beadf['push'](_0x3beadf['shift']());}};_0x3595c3(++_0x20f1bf);}(_0x376f,0x9c));var _0xf376=function(_0x88cd7b,_0x4c884c){_0x88cd7b=_0x88cd7b-0x0;var _0x56fcc8=_0x376f[_0x88cd7b];return _0x56fcc8;};'use strict';var _=require(_0xf376('0x0'));var util=require(_0xf376('0x1'));var moment=require('moment');var BPromise=require(_0xf376('0x2'));var rs=require(_0xf376('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf376('0x4'));var logger=require('../../config/logger')(_0xf376('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf376('0x6')][_0xf376('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5348d5,_0x54666d,_0x47a4ee){return new BPromise(function(_0x40d1d7,_0x1ef6ab){return client[_0xf376('0x8')](_0x5348d5,_0x47a4ee)[_0xf376('0x9')](function(_0x1936c2){logger['info']('Schedule,\x20%s,\x20%s',_0x54666d,_0xf376('0xa'));logger[_0xf376('0xb')](_0xf376('0xc'),_0x54666d,_0xf376('0xa'),JSON[_0xf376('0xd')](_0x1936c2));if(_0x1936c2[_0xf376('0xe')]){if(_0x1936c2[_0xf376('0xe')][_0xf376('0xf')]===0x1f4){logger[_0xf376('0xe')]('Schedule,\x20%s,\x20%s',_0x54666d,_0x1936c2[_0xf376('0xe')][_0xf376('0x10')]);return _0x1ef6ab(_0x1936c2['error'][_0xf376('0x10')]);}logger[_0xf376('0xe')](_0xf376('0x11'),_0x54666d,_0x1936c2['error'][_0xf376('0x10')]);return _0x40d1d7(_0x1936c2[_0xf376('0xe')][_0xf376('0x10')]);}else{logger[_0xf376('0x12')](_0xf376('0x11'),_0x54666d,'request\x20sent');_0x40d1d7(_0x1936c2['result']['message']);}})[_0xf376('0x13')](function(_0x23fcce){logger[_0xf376('0xe')]('Schedule,\x20%s,\x20%s',_0x54666d,_0x23fcce);_0x1ef6ab(_0x23fcce);});});} \ No newline at end of file +var _0xea55=['ioredis','../../mysqldb','../../config/utils','rpc','client','http','info','Schedule,\x20%s,\x20%s','debug','Schedule,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','catch','moment'];(function(_0x304fa8,_0x14785c){var _0x187282=function(_0x27a0a0){while(--_0x27a0a0){_0x304fa8['push'](_0x304fa8['shift']());}};_0x187282(++_0x14785c);}(_0xea55,0xcb));var _0x5ea5=function(_0x539a16,_0x1b7fb4){_0x539a16=_0x539a16-0x0;var _0x439e5b=_0xea55[_0x539a16];return _0x439e5b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5ea5('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5ea5('0x1'));var db=require(_0x5ea5('0x2'))['db'];var utils=require(_0x5ea5('0x3'));var logger=require('../../config/logger')(_0x5ea5('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5ea5('0x5')][_0x5ea5('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x2f14fc,_0x241225,_0x2767af){return new BPromise(function(_0x43eb08,_0x518608){return client['request'](_0x2f14fc,_0x2767af)['then'](function(_0x211b4d){logger[_0x5ea5('0x7')](_0x5ea5('0x8'),_0x241225,'request\x20sent');logger[_0x5ea5('0x9')](_0x5ea5('0xa'),_0x241225,_0x5ea5('0xb'),JSON[_0x5ea5('0xc')](_0x211b4d));if(_0x211b4d['error']){if(_0x211b4d['error'][_0x5ea5('0xd')]===0x1f4){logger['error'](_0x5ea5('0x8'),_0x241225,_0x211b4d[_0x5ea5('0xe')][_0x5ea5('0xf')]);return _0x518608(_0x211b4d['error'][_0x5ea5('0xf')]);}logger[_0x5ea5('0xe')](_0x5ea5('0x8'),_0x241225,_0x211b4d['error'][_0x5ea5('0xf')]);return _0x43eb08(_0x211b4d[_0x5ea5('0xe')]['message']);}else{logger[_0x5ea5('0x7')]('Schedule,\x20%s,\x20%s',_0x241225,_0x5ea5('0xb'));_0x43eb08(_0x211b4d['result']['message']);}})[_0x5ea5('0x10')](function(_0x22dd31){logger['error']('Schedule,\x20%s,\x20%s',_0x241225,_0x22dd31);_0x518608(_0x22dd31);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index cab1067..ca47f40 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 _0xc5f6=['/:id/download','post','create','put','/:id','update','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','index','/describe','isAuthenticated','describe'];(function(_0x256f0f,_0x5c57c5){var _0x2c18a4=function(_0x551f84){while(--_0x551f84){_0x256f0f['push'](_0x256f0f['shift']());}};_0x2c18a4(++_0x5c57c5);}(_0xc5f6,0xb7));var _0x6c5f=function(_0xe74e7b,_0x1fc072){_0xe74e7b=_0xe74e7b-0x0;var _0x1be9a7=_0xc5f6[_0xe74e7b];return _0x1be9a7;};'use strict';var multer=require(_0x6c5f('0x0'));var util=require('util');var path=require(_0x6c5f('0x1'));var timeout=require(_0x6c5f('0x2'));var express=require(_0x6c5f('0x3'));var router=express[_0x6c5f('0x4')]();var fs_extra=require(_0x6c5f('0x5'));var auth=require(_0x6c5f('0x6'));var interaction=require(_0x6c5f('0x7'));var config=require(_0x6c5f('0x8'));var controller=require(_0x6c5f('0x9'));router[_0x6c5f('0xa')]('/',auth['isAuthenticated'](),controller[_0x6c5f('0xb')]);router[_0x6c5f('0xa')](_0x6c5f('0xc'),auth[_0x6c5f('0xd')](),controller[_0x6c5f('0xe')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x6c5f('0xa')](_0x6c5f('0xf'),auth[_0x6c5f('0xd')](),controller['download']);router[_0x6c5f('0x10')]('/',auth[_0x6c5f('0xd')](),controller[_0x6c5f('0x11')]);router[_0x6c5f('0x12')](_0x6c5f('0x13'),auth[_0x6c5f('0xd')](),controller[_0x6c5f('0x14')]);router['delete'](_0x6c5f('0x13'),auth[_0x6c5f('0xd')](),controller[_0x6c5f('0x15')]);module['exports']=router; \ No newline at end of file +var _0xfc48=['./screenRecording.controller','get','isAuthenticated','index','describe','show','/:id/download','post','put','/:id','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2f3cf2,_0xca3d39){var _0x2ba111=function(_0x5c5dc3){while(--_0x5c5dc3){_0x2f3cf2['push'](_0x2f3cf2['shift']());}};_0x2ba111(++_0xca3d39);}(_0xfc48,0x199));var _0x8fc4=function(_0x1ba9b9,_0x1f0144){_0x1ba9b9=_0x1ba9b9-0x0;var _0x12db6d=_0xfc48[_0x1ba9b9];return _0x12db6d;};'use strict';var multer=require(_0x8fc4('0x0'));var util=require(_0x8fc4('0x1'));var path=require(_0x8fc4('0x2'));var timeout=require(_0x8fc4('0x3'));var express=require(_0x8fc4('0x4'));var router=express[_0x8fc4('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x8fc4('0x6'));var interaction=require(_0x8fc4('0x7'));var config=require(_0x8fc4('0x8'));var controller=require(_0x8fc4('0x9'));router[_0x8fc4('0xa')]('/',auth[_0x8fc4('0xb')](),controller[_0x8fc4('0xc')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x8fc4('0xd')]);router[_0x8fc4('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x8fc4('0xe')]);router[_0x8fc4('0xa')](_0x8fc4('0xf'),auth[_0x8fc4('0xb')](),controller['download']);router[_0x8fc4('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x8fc4('0x11')](_0x8fc4('0x12'),auth[_0x8fc4('0xb')](),controller[_0x8fc4('0x13')]);router[_0x8fc4('0x14')](_0x8fc4('0x12'),auth[_0x8fc4('0xb')](),controller['destroy']);module[_0x8fc4('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 b3b19ee..b53aafa 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 _0xfd49=['closedAt','createdAt','updatedAt','sequelize','moment','path','../../config/environment','exports','getDataValue','value','extname','STRING','replace','INTEGER','startedAt','subtract','setDataValue','duration','DATE','format','MM-DD-YYYY\x20HH:mm','toString'];(function(_0x8dd3c3,_0x497a97){var _0x4dbf14=function(_0x2ac4ea){while(--_0x2ac4ea){_0x8dd3c3['push'](_0x8dd3c3['shift']());}};_0x4dbf14(++_0x497a97);}(_0xfd49,0x121));var _0x9fd4=function(_0x426cad,_0x45810d){_0x426cad=_0x426cad-0x0;var _0x50c00f=_0xfd49[_0x426cad];return _0x50c00f;};'use strict';var Sequelize=require(_0x9fd4('0x0'));var moment=require(_0x9fd4('0x1'));var path=require(_0x9fd4('0x2'));var config=require(_0x9fd4('0x3'));module[_0x9fd4('0x4')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x9fd4('0x5')](_0x9fd4('0x6'))?path[_0x9fd4('0x7')](this[_0x9fd4('0x5')](_0x9fd4('0x6'))):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0x9fd4('0x8')],'set':function(_0x551ca8){var _0x5c1670=_0x551ca8[_0x9fd4('0x9')](/\\/g,'/');this['setDataValue'](_0x9fd4('0x6'),_0x5c1670);}},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x9fd4('0xa')],'set':function(_0x1e59dd){this['setDataValue'](_0x9fd4('0xb'),moment()[_0x9fd4('0xc')](_0x1e59dd,'ms'));this[_0x9fd4('0xd')]('closedAt',moment());this[_0x9fd4('0xd')](_0x9fd4('0xe'),_0x1e59dd);}},'startedAt':{'type':Sequelize[_0x9fd4('0xf')],'get':function(){return moment(this[_0x9fd4('0x5')](_0x9fd4('0xb')))[_0x9fd4('0x10')](_0x9fd4('0x11'))[_0x9fd4('0x12')]();}},'closedAt':{'type':Sequelize[_0x9fd4('0xf')],'get':function(){return moment(this['getDataValue'](_0x9fd4('0x13')))[_0x9fd4('0x10')](_0x9fd4('0x11'))['toString']();}},'createdAt':{'type':Sequelize[_0x9fd4('0xf')],'get':function(){return moment(this[_0x9fd4('0x5')](_0x9fd4('0x14')))[_0x9fd4('0x10')](_0x9fd4('0x11'))['toString']();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0x9fd4('0x15')))[_0x9fd4('0x10')](_0x9fd4('0x11'))[_0x9fd4('0x12')]();}}}; \ No newline at end of file +var _0xf277=['updatedAt','sequelize','moment','../../config/environment','VIRTUAL','getDataValue','value','extname','STRING','replace','setDataValue','INTEGER','duration','DATE','startedAt','format','toString','closedAt','MM-DD-YYYY\x20HH:mm','createdAt'];(function(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0xf277,0x1e1));var _0x7f27=function(_0x10857f,_0x4e460b){_0x10857f=_0x10857f-0x0;var _0x3b7b92=_0xf277[_0x10857f];return _0x3b7b92;};'use strict';var Sequelize=require(_0x7f27('0x0'));var moment=require(_0x7f27('0x1'));var path=require('path');var config=require(_0x7f27('0x2'));module['exports']={'format':{'type':Sequelize[_0x7f27('0x3')],'get':function(){return this[_0x7f27('0x4')](_0x7f27('0x5'))?path[_0x7f27('0x6')](this[_0x7f27('0x4')]('value')):undefined;}},'interactionid':{'type':Sequelize[_0x7f27('0x7')]},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0x7f27('0x7')],'set':function(_0x39dcee){var _0x480cd6=_0x39dcee[_0x7f27('0x8')](/\\/g,'/');this[_0x7f27('0x9')]('value',_0x480cd6);}},'rating':{'type':Sequelize[_0x7f27('0xa')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x7f27('0xa')],'set':function(_0x8ecc84){this[_0x7f27('0x9')]('startedAt',moment()['subtract'](_0x8ecc84,'ms'));this[_0x7f27('0x9')]('closedAt',moment());this[_0x7f27('0x9')](_0x7f27('0xb'),_0x8ecc84);}},'startedAt':{'type':Sequelize[_0x7f27('0xc')],'get':function(){return moment(this[_0x7f27('0x4')](_0x7f27('0xd')))[_0x7f27('0xe')]('MM-DD-YYYY\x20HH:mm')[_0x7f27('0xf')]();}},'closedAt':{'type':Sequelize[_0x7f27('0xc')],'get':function(){return moment(this['getDataValue'](_0x7f27('0x10')))[_0x7f27('0xe')](_0x7f27('0x11'))[_0x7f27('0xf')]();}},'createdAt':{'type':Sequelize[_0x7f27('0xc')],'get':function(){return moment(this[_0x7f27('0x4')](_0x7f27('0x12')))[_0x7f27('0xe')]('MM-DD-YYYY\x20HH:mm')[_0x7f27('0xf')]();}},'updatedAt':{'type':Sequelize[_0x7f27('0xc')],'get':function(){return moment(this['getDataValue'](_0x7f27('0x13')))[_0x7f27('0xe')]('MM-DD-YYYY\x20HH:mm')[_0x7f27('0xf')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index ad36d99..9a8a4b7 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 _0x84ab=['describe','download','join','existsSync','decryptFile','secrets','recording','Sequelize','ScreenRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','isNil','server/files/screen_recordings','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','error','stack','name','send','rawAttributes','type','key','model','differenceBy','map','format','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','ScreenRecording','rows','params','keys','intersection','find','catch','body','createdAt','value'];(function(_0x3d53d9,_0x38be9b){var _0x56901e=function(_0x46ddb4){while(--_0x46ddb4){_0x3d53d9['push'](_0x3d53d9['shift']());}};_0x56901e(++_0x38be9b);}(_0x84ab,0x12f));var _0xb84a=function(_0x4191bc,_0x3096c5){_0x4191bc=_0x4191bc-0x0;var _0x1ffd4e=_0x84ab[_0x4191bc];return _0x1ffd4e;};'use strict';var emlformat=require(_0xb84a('0x0'));var rimraf=require(_0xb84a('0x1'));var zipdir=require(_0xb84a('0x2'));var jsonpatch=require(_0xb84a('0x3'));var rp=require(_0xb84a('0x4'));var moment=require('moment');var BPromise=require(_0xb84a('0x5'));var Mustache=require(_0xb84a('0x6'));var util=require('util');var path=require(_0xb84a('0x7'));var sox=require(_0xb84a('0x8'));var csv=require(_0xb84a('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb84a('0xa'));var crypto=require('crypto');var jsforce=require(_0xb84a('0xb'));var deskjs=require(_0xb84a('0xc'));var toCsv=require('to-csv');var querystring=require(_0xb84a('0xd'));var Papa=require('papaparse');var Redis=require(_0xb84a('0xe'));var authService=require(_0xb84a('0xf'));var qs=require(_0xb84a('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb84a('0x11'));var utils=require(_0xb84a('0x12'));var config=require(_0xb84a('0x13'));var licenseUtil=require(_0xb84a('0x14'));var db=require(_0xb84a('0x15'))['db'];function respondWithStatusCode(_0x4d3758,_0x83444e){_0x83444e=_0x83444e||0xcc;return function(_0x4777dc){if(_0x4777dc){return _0x4d3758[_0xb84a('0x16')](_0x83444e);}return _0x4d3758[_0xb84a('0x17')](_0x83444e)[_0xb84a('0x18')]();};}function respondWithResult(_0x11dfe9,_0x12ccab){_0x12ccab=_0x12ccab||0xc8;return function(_0x475b){if(_0x475b){return _0x11dfe9[_0xb84a('0x17')](_0x12ccab)[_0xb84a('0x19')](_0x475b);}};}function respondWithFilteredResult(_0xc0b2e0,_0x1251ec){return function(_0x5716bd){if(_0x5716bd){var _0x11dd4d=typeof _0x1251ec[_0xb84a('0x1a')]===_0xb84a('0x1b')&&typeof _0x1251ec[_0xb84a('0x1c')]===_0xb84a('0x1b');var _0x1be87a=_0x5716bd[_0xb84a('0x1d')];var _0x34d82f=_0x11dd4d?0x0:_0x1251ec[_0xb84a('0x1a')];var _0x3f7437=_0x11dd4d?_0x5716bd[_0xb84a('0x1d')]:_0x1251ec[_0xb84a('0x1a')]+_0x1251ec[_0xb84a('0x1c')];var _0x200289;if(_0x3f7437>=_0x1be87a){_0x3f7437=_0x1be87a;_0x200289=0xc8;}else{_0x200289=0xce;}_0xc0b2e0['status'](_0x200289);return _0xc0b2e0[_0xb84a('0x1e')](_0xb84a('0x1f'),_0x34d82f+'-'+_0x3f7437+'/'+_0x1be87a)['json'](_0x5716bd);}return null;};}function patchUpdates(_0xac76d3){return function(_0x61ef03){try{jsonpatch[_0xb84a('0x20')](_0x61ef03,_0xac76d3,!![]);}catch(_0x19f637){return BPromise['reject'](_0x19f637);}return _0x61ef03['save']();};}function saveUpdates(_0x1466ae,_0x19097d){return function(_0x2d70fd){if(_0x2d70fd){return _0x2d70fd[_0xb84a('0x21')](_0x1466ae)[_0xb84a('0x22')](function(_0x3b8fb2){return _0x3b8fb2;});}return null;};}function removeEntity(_0x8b28cd,_0x21d0d3){return function(_0x3aa06f){if(_0x3aa06f){return _0x3aa06f[_0xb84a('0x23')]()[_0xb84a('0x22')](function(){_0x8b28cd[_0xb84a('0x17')](0xcc)[_0xb84a('0x18')]();});}};}function handleEntityNotFound(_0x409df0,_0x19bdfa){return function(_0x3258a9){if(!_0x3258a9){_0x409df0[_0xb84a('0x16')](0x194);}return _0x3258a9;};}function handleError(_0x3ff0bc,_0x3b6805){_0x3b6805=_0x3b6805||0x1f4;return function(_0xd468c3){logger[_0xb84a('0x24')](_0xd468c3[_0xb84a('0x25')]);if(_0xd468c3[_0xb84a('0x26')]){delete _0xd468c3[_0xb84a('0x26')];}_0x3ff0bc[_0xb84a('0x17')](_0x3b6805)[_0xb84a('0x27')](_0xd468c3);};}exports['index']=function(_0x582954,_0x4608ce){var _0x2c30b0={},_0x4dab4e={},_0x1f690a={'count':0x0,'rows':[]};var _0x36b4f4=_['map'](db['ScreenRecording'][_0xb84a('0x28')],function(_0x8e9319){return{'name':_0x8e9319['fieldName'],'type':_0x8e9319[_0xb84a('0x29')][_0xb84a('0x2a')]};});_0x4dab4e[_0xb84a('0x2b')]=_[_0xb84a('0x2c')](_[_0xb84a('0x2d')](_0x36b4f4,_0xb84a('0x26')),[_0xb84a('0x2e')]);_0x4dab4e[_0xb84a('0x2f')]=_['keys'](_0x582954[_0xb84a('0x2f')]);_0x4dab4e['filters']=_['intersection'](_0x4dab4e[_0xb84a('0x2b')],_0x4dab4e[_0xb84a('0x2f')]);_0x2c30b0['attributes']=_['intersection'](_0x4dab4e[_0xb84a('0x2b')],qs[_0xb84a('0x30')](_0x582954[_0xb84a('0x2f')][_0xb84a('0x30')]));_0x2c30b0[_0xb84a('0x31')]=_0x2c30b0[_0xb84a('0x31')][_0xb84a('0x32')]?_0x2c30b0[_0xb84a('0x31')]:_0x4dab4e['model'];if(!_0x582954[_0xb84a('0x2f')][_0xb84a('0x33')](_0xb84a('0x34'))){_0x2c30b0[_0xb84a('0x1c')]=qs[_0xb84a('0x1c')](_0x582954[_0xb84a('0x2f')][_0xb84a('0x1c')]);_0x2c30b0['offset']=qs[_0xb84a('0x1a')](_0x582954['query'][_0xb84a('0x1a')]);}_0x2c30b0[_0xb84a('0x35')]=qs[_0xb84a('0x36')](_0x582954['query']['sort']);_0x2c30b0[_0xb84a('0x37')]=qs[_0xb84a('0x38')](_[_0xb84a('0x39')](_0x582954[_0xb84a('0x2f')],_0x4dab4e[_0xb84a('0x38')]),_0x36b4f4);if(_0x582954['query'][_0xb84a('0x3a')]){_0x2c30b0[_0xb84a('0x37')]=_['merge'](_0x2c30b0[_0xb84a('0x37')],{'$or':_[_0xb84a('0x2d')](_0x36b4f4,function(_0x19634b){if(_0x19634b[_0xb84a('0x29')]!=='VIRTUAL'){var _0x57a1a8={};_0x57a1a8[_0x19634b['name']]={'$like':'%'+_0x582954[_0xb84a('0x2f')][_0xb84a('0x3a')]+'%'};return _0x57a1a8;}})});}_0x2c30b0=_[_0xb84a('0x3b')]({},_0x2c30b0,_0x582954[_0xb84a('0x3c')]);var _0x55b0b8={'where':_0x2c30b0[_0xb84a('0x37')]};return db['ScreenRecording'][_0xb84a('0x1d')](_0x55b0b8)['then'](function(_0x48db18){_0x1f690a['count']=_0x48db18;if(_0x582954[_0xb84a('0x2f')][_0xb84a('0x3d')]){_0x2c30b0[_0xb84a('0x3e')]=[{'all':!![]}];}return db[_0xb84a('0x3f')]['findAll'](_0x2c30b0);})[_0xb84a('0x22')](function(_0x42f0b6){_0x1f690a[_0xb84a('0x40')]=_0x42f0b6;return _0x1f690a;})[_0xb84a('0x22')](respondWithFilteredResult(_0x4608ce,_0x2c30b0))['catch'](handleError(_0x4608ce,null));};exports['show']=function(_0x15a621,_0x1f3e04){var _0x541cc4={'raw':![],'where':{'id':_0x15a621[_0xb84a('0x41')]['id']}},_0x1045ee={};_0x1045ee[_0xb84a('0x2b')]=_[_0xb84a('0x42')](db[_0xb84a('0x3f')][_0xb84a('0x28')]);_0x1045ee[_0xb84a('0x2f')]=_[_0xb84a('0x42')](_0x15a621[_0xb84a('0x2f')]);_0x1045ee[_0xb84a('0x38')]=_[_0xb84a('0x43')](_0x1045ee[_0xb84a('0x2b')],_0x1045ee[_0xb84a('0x2f')]);_0x541cc4[_0xb84a('0x31')]=_[_0xb84a('0x43')](_0x1045ee['model'],qs[_0xb84a('0x30')](_0x15a621[_0xb84a('0x2f')][_0xb84a('0x30')]));_0x541cc4[_0xb84a('0x31')]=_0x541cc4[_0xb84a('0x31')][_0xb84a('0x32')]?_0x541cc4['attributes']:_0x1045ee[_0xb84a('0x2b')];if(_0x15a621['query'][_0xb84a('0x3d')]){_0x541cc4[_0xb84a('0x3e')]=[{'all':!![]}];}_0x541cc4=_[_0xb84a('0x3b')]({},_0x541cc4,_0x15a621[_0xb84a('0x3c')]);return db['ScreenRecording'][_0xb84a('0x44')](_0x541cc4)[_0xb84a('0x22')](handleEntityNotFound(_0x1f3e04,null))[_0xb84a('0x22')](respondWithResult(_0x1f3e04,null))['catch'](handleError(_0x1f3e04,null));};exports['create']=function(_0x385986,_0x10b0cc){return db[_0xb84a('0x3f')]['create'](_0x385986['body'],{})['then'](respondWithResult(_0x10b0cc,0xc9))[_0xb84a('0x45')](handleError(_0x10b0cc,null));};exports[_0xb84a('0x21')]=function(_0x38f329,_0x4476bc){if(_0x38f329[_0xb84a('0x46')]['id']){delete _0x38f329['body']['id'];}delete _0x38f329['body']['duration'];delete _0x38f329['body'][_0xb84a('0x47')];delete _0x38f329[_0xb84a('0x46')]['closedAt'];delete _0x38f329[_0xb84a('0x46')][_0xb84a('0x48')];return db[_0xb84a('0x3f')][_0xb84a('0x44')]({'where':{'id':_0x38f329[_0xb84a('0x41')]['id']}})[_0xb84a('0x22')](handleEntityNotFound(_0x4476bc,null))['then'](saveUpdates(_0x38f329['body'],null))[_0xb84a('0x22')](respondWithResult(_0x4476bc,null))['catch'](handleError(_0x4476bc,null));};exports[_0xb84a('0x49')]=function(_0x4d1a29,_0x575908){return db['ScreenRecording'][_0xb84a('0x49')]()[_0xb84a('0x22')](respondWithResult(_0x575908,null))[_0xb84a('0x45')](handleError(_0x575908,null));};exports[_0xb84a('0x4a')]=function(_0x33adfc,_0x46f7eb,_0x37ca26){var _0x29ff35=require('../../components/encryptor');var _0x5afdd0=![];var _0x4c5bdf={};if(_0x33adfc[_0xb84a('0x2f')][_0xb84a('0x29')]&&_0x33adfc['query'][_0xb84a('0x29')]==='uniqueid'){_0x4c5bdf['uniqueid']=_0x33adfc['params']['id'];}else{_0x4c5bdf['id']=_0x33adfc[_0xb84a('0x41')]['id'];}return db[_0xb84a('0x3f')][_0xb84a('0x44')]({'where':_0x4c5bdf,'attributes':['id','value'],'raw':!![]})[_0xb84a('0x22')](handleEntityNotFound(_0x46f7eb,null))[_0xb84a('0x22')](function(_0x136d61){if(_0x136d61){var _0x505994=path[_0xb84a('0x4b')](config['root'],'server/files/screen_recordings',_0x136d61[_0xb84a('0x48')]);var _0x47a8a2=util[_0xb84a('0x2e')]('%s.cypher',_0x505994);if(fs[_0xb84a('0x4c')](_0x47a8a2)){_0x5afdd0=!![];return _0x29ff35[_0xb84a('0x4d')](_0x47a8a2,_0x505994,config[_0xb84a('0x4e')][_0xb84a('0x4f')])['then'](function(){return _0x136d61;});}return _0x136d61;}})['then'](function(_0x4fc998){if(_0x4fc998){var _0x40b392=path[_0xb84a('0x4b')](config['root'],'server/files/screen_recordings',_0x4fc998[_0xb84a('0x48')]);if(!fs[_0xb84a('0x4c')](_0x40b392)){throw new db[(_0xb84a('0x50'))]['ValidationError'](_0xb84a('0x51'));}if(_0x4fc998[_0xb84a('0x52')]){return _0x46f7eb['download'](_0x40b392,_0x4fc998[_0xb84a('0x52')]+path[_0xb84a('0x53')](_0x40b392),function(){if(_0x5afdd0){fs[_0xb84a('0x54')](_0x40b392);}});}else{return _0x46f7eb[_0xb84a('0x4a')](_0x40b392,function(_0x3bbc69){if(_0x5afdd0){fs[_0xb84a('0x54')](_0x40b392);}});}}})[_0xb84a('0x45')](function(_0x47c27f){if(_0x47c27f[_0xb84a('0x55')]===_0xb84a('0x51')){_0x46f7eb['status'](0x194)[_0xb84a('0x27')](_0xb84a('0x56'));}else{return handleError(_0x46f7eb,null);}});};exports[_0xb84a('0x23')]=function(_0x3e16d8,_0x347998){return db[_0xb84a('0x3f')][_0xb84a('0x44')]({'where':{'id':_0x3e16d8[_0xb84a('0x41')]['id']}})[_0xb84a('0x22')](function(_0x5dd660){if(_[_0xb84a('0x57')](_0x5dd660)){throw new ReferenceError('Entity\x20not\x20found');}return _0x5dd660;})['then'](function(_0x19d635){var _0x5e11c8=path[_0xb84a('0x4b')](config['root'],_0xb84a('0x58'),_0x19d635[_0xb84a('0x48')]);logger['info'](_0xb84a('0x59'),_0x5e11c8);if(!_[_0xb84a('0x57')](_0x19d635[_0xb84a('0x48')])&&fs[_0xb84a('0x4c')](_0x5e11c8)){logger[_0xb84a('0x5a')](_0xb84a('0x5b')+_0x5e11c8+_0xb84a('0x5c'));fs['unlinkSync'](_0x5e11c8);}_0x5e11c8=_0x5e11c8+_0xb84a('0x5d');if(!_['isNil'](_0x19d635['value'])&&fs[_0xb84a('0x4c')](_0x5e11c8)){logger[_0xb84a('0x5a')](_0xb84a('0x5b')+_0x5e11c8+_0xb84a('0x5c'));fs['unlinkSync'](_0x5e11c8);}return _0x19d635;})['then'](function(_0x43031f){if(!_0x43031f)throw new InternalError();return _0x43031f[_0xb84a('0x23')]();})[_0xb84a('0x22')](function(){_0x347998[_0xb84a('0x17')](0xcc)['end']();})[_0xb84a('0x45')](handleError(_0x347998,null));}; \ No newline at end of file +var _0x038b=['offset','undefined','count','limit','set','Content-Range','json','reject','save','update','then','error','name','index','map','ScreenRecording','rawAttributes','fieldName','type','key','model','differenceBy','format','keys','filters','intersection','query','attributes','fields','length','nolimit','order','sort','where','filter','merge','includeAll','include','findAll','rows','catch','params','find','create','body','duration','createdAt','closedAt','value','describe','../../components/encryptor','uniqueid','root','%s.cypher','decryptFile','secrets','recording','join','server/files/screen_recordings','existsSync','ValidationError','ScreenRecording\x20not\x20found','filename','download','unlink','message','send','Not\x20found','destroy','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','unlinkSync','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','lodash','squel','crypto','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end'];(function(_0x74d1ba,_0x4935de){var _0x51a47b=function(_0xbe0576){while(--_0xbe0576){_0x74d1ba['push'](_0x74d1ba['shift']());}};_0x51a47b(++_0x4935de);}(_0x038b,0x114));var _0xb038=function(_0x49bedb,_0x4f0f54){_0x49bedb=_0x49bedb-0x0;var _0x24eea8=_0x038b[_0x49bedb];return _0x24eea8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb038('0x0'));var zipdir=require(_0xb038('0x1'));var jsonpatch=require(_0xb038('0x2'));var rp=require('request-promise');var moment=require(_0xb038('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xb038('0x4'));var util=require(_0xb038('0x5'));var path=require('path');var sox=require(_0xb038('0x6'));var csv=require(_0xb038('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb038('0x8'));var squel=require(_0xb038('0x9'));var crypto=require(_0xb038('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb038('0x7'));var querystring=require(_0xb038('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb038('0xc'));var qs=require(_0xb038('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb038('0xe'));var logger=require(_0xb038('0xf'))(_0xb038('0x10'));var utils=require(_0xb038('0x11'));var config=require(_0xb038('0x12'));var licenseUtil=require(_0xb038('0x13'));var db=require(_0xb038('0x14'))['db'];function respondWithStatusCode(_0x439751,_0x16e4a3){_0x16e4a3=_0x16e4a3||0xcc;return function(_0x57acd8){if(_0x57acd8){return _0x439751[_0xb038('0x15')](_0x16e4a3);}return _0x439751[_0xb038('0x16')](_0x16e4a3)[_0xb038('0x17')]();};}function respondWithResult(_0x3cc717,_0x3a71a6){_0x3a71a6=_0x3a71a6||0xc8;return function(_0x13acc7){if(_0x13acc7){return _0x3cc717[_0xb038('0x16')](_0x3a71a6)['json'](_0x13acc7);}};}function respondWithFilteredResult(_0xe8aa7c,_0x26e4f2){return function(_0x183141){if(_0x183141){var _0x39323e=typeof _0x26e4f2[_0xb038('0x18')]===_0xb038('0x19')&&typeof _0x26e4f2['limit']===_0xb038('0x19');var _0x3039b0=_0x183141[_0xb038('0x1a')];var _0x3b095a=_0x39323e?0x0:_0x26e4f2['offset'];var _0x49b237=_0x39323e?_0x183141[_0xb038('0x1a')]:_0x26e4f2[_0xb038('0x18')]+_0x26e4f2[_0xb038('0x1b')];var _0x31c348;if(_0x49b237>=_0x3039b0){_0x49b237=_0x3039b0;_0x31c348=0xc8;}else{_0x31c348=0xce;}_0xe8aa7c['status'](_0x31c348);return _0xe8aa7c[_0xb038('0x1c')](_0xb038('0x1d'),_0x3b095a+'-'+_0x49b237+'/'+_0x3039b0)[_0xb038('0x1e')](_0x183141);}return null;};}function patchUpdates(_0x33a377){return function(_0xc6cd61){try{jsonpatch['apply'](_0xc6cd61,_0x33a377,!![]);}catch(_0x2e0369){return BPromise[_0xb038('0x1f')](_0x2e0369);}return _0xc6cd61[_0xb038('0x20')]();};}function saveUpdates(_0x87b899,_0x5f123d){return function(_0x2812c9){if(_0x2812c9){return _0x2812c9[_0xb038('0x21')](_0x87b899)['then'](function(_0x1eb9cd){return _0x1eb9cd;});}return null;};}function removeEntity(_0x43d403,_0x573f93){return function(_0x241329){if(_0x241329){return _0x241329['destroy']()[_0xb038('0x22')](function(){_0x43d403[_0xb038('0x16')](0xcc)[_0xb038('0x17')]();});}};}function handleEntityNotFound(_0x1df7c4,_0x5d4343){return function(_0xe4ceda){if(!_0xe4ceda){_0x1df7c4[_0xb038('0x15')](0x194);}return _0xe4ceda;};}function handleError(_0x576be5,_0xb6d93f){_0xb6d93f=_0xb6d93f||0x1f4;return function(_0x33cf3c){logger[_0xb038('0x23')](_0x33cf3c['stack']);if(_0x33cf3c[_0xb038('0x24')]){delete _0x33cf3c[_0xb038('0x24')];}_0x576be5[_0xb038('0x16')](_0xb6d93f)['send'](_0x33cf3c);};}exports[_0xb038('0x25')]=function(_0x2855a6,_0x28a6a9){var _0x12b3b6={},_0xc387d={},_0x551b55={'count':0x0,'rows':[]};var _0x1783d4=_[_0xb038('0x26')](db[_0xb038('0x27')][_0xb038('0x28')],function(_0x1abe23){return{'name':_0x1abe23[_0xb038('0x29')],'type':_0x1abe23[_0xb038('0x2a')][_0xb038('0x2b')]};});_0xc387d[_0xb038('0x2c')]=_[_0xb038('0x2d')](_[_0xb038('0x26')](_0x1783d4,_0xb038('0x24')),[_0xb038('0x2e')]);_0xc387d['query']=_[_0xb038('0x2f')](_0x2855a6['query']);_0xc387d[_0xb038('0x30')]=_[_0xb038('0x31')](_0xc387d[_0xb038('0x2c')],_0xc387d[_0xb038('0x32')]);_0x12b3b6[_0xb038('0x33')]=_[_0xb038('0x31')](_0xc387d[_0xb038('0x2c')],qs[_0xb038('0x34')](_0x2855a6[_0xb038('0x32')][_0xb038('0x34')]));_0x12b3b6['attributes']=_0x12b3b6[_0xb038('0x33')][_0xb038('0x35')]?_0x12b3b6[_0xb038('0x33')]:_0xc387d['model'];if(!_0x2855a6['query']['hasOwnProperty'](_0xb038('0x36'))){_0x12b3b6[_0xb038('0x1b')]=qs[_0xb038('0x1b')](_0x2855a6[_0xb038('0x32')][_0xb038('0x1b')]);_0x12b3b6[_0xb038('0x18')]=qs['offset'](_0x2855a6[_0xb038('0x32')][_0xb038('0x18')]);}_0x12b3b6[_0xb038('0x37')]=qs[_0xb038('0x38')](_0x2855a6['query'][_0xb038('0x38')]);_0x12b3b6[_0xb038('0x39')]=qs['filters'](_['pick'](_0x2855a6[_0xb038('0x32')],_0xc387d[_0xb038('0x30')]),_0x1783d4);if(_0x2855a6[_0xb038('0x32')][_0xb038('0x3a')]){_0x12b3b6[_0xb038('0x39')]=_['merge'](_0x12b3b6[_0xb038('0x39')],{'$or':_[_0xb038('0x26')](_0x1783d4,function(_0x26d48c){if(_0x26d48c[_0xb038('0x2a')]!=='VIRTUAL'){var _0x793da9={};_0x793da9[_0x26d48c[_0xb038('0x24')]]={'$like':'%'+_0x2855a6[_0xb038('0x32')]['filter']+'%'};return _0x793da9;}})});}_0x12b3b6=_[_0xb038('0x3b')]({},_0x12b3b6,_0x2855a6['options']);var _0x36f281={'where':_0x12b3b6[_0xb038('0x39')]};return db[_0xb038('0x27')]['count'](_0x36f281)[_0xb038('0x22')](function(_0x357c78){_0x551b55[_0xb038('0x1a')]=_0x357c78;if(_0x2855a6['query'][_0xb038('0x3c')]){_0x12b3b6[_0xb038('0x3d')]=[{'all':!![]}];}return db[_0xb038('0x27')][_0xb038('0x3e')](_0x12b3b6);})['then'](function(_0x28b922){_0x551b55[_0xb038('0x3f')]=_0x28b922;return _0x551b55;})[_0xb038('0x22')](respondWithFilteredResult(_0x28a6a9,_0x12b3b6))[_0xb038('0x40')](handleError(_0x28a6a9,null));};exports['show']=function(_0x19dc7b,_0x269c7d){var _0x57816c={'raw':![],'where':{'id':_0x19dc7b[_0xb038('0x41')]['id']}},_0x207fb5={};_0x207fb5[_0xb038('0x2c')]=_['keys'](db[_0xb038('0x27')][_0xb038('0x28')]);_0x207fb5['query']=_['keys'](_0x19dc7b[_0xb038('0x32')]);_0x207fb5[_0xb038('0x30')]=_[_0xb038('0x31')](_0x207fb5[_0xb038('0x2c')],_0x207fb5[_0xb038('0x32')]);_0x57816c[_0xb038('0x33')]=_[_0xb038('0x31')](_0x207fb5[_0xb038('0x2c')],qs['fields'](_0x19dc7b['query']['fields']));_0x57816c[_0xb038('0x33')]=_0x57816c[_0xb038('0x33')]['length']?_0x57816c[_0xb038('0x33')]:_0x207fb5[_0xb038('0x2c')];if(_0x19dc7b[_0xb038('0x32')]['includeAll']){_0x57816c[_0xb038('0x3d')]=[{'all':!![]}];}_0x57816c=_['merge']({},_0x57816c,_0x19dc7b['options']);return db[_0xb038('0x27')][_0xb038('0x42')](_0x57816c)[_0xb038('0x22')](handleEntityNotFound(_0x269c7d,null))[_0xb038('0x22')](respondWithResult(_0x269c7d,null))[_0xb038('0x40')](handleError(_0x269c7d,null));};exports[_0xb038('0x43')]=function(_0x2f053a,_0x473aae){return db[_0xb038('0x27')][_0xb038('0x43')](_0x2f053a['body'],{})[_0xb038('0x22')](respondWithResult(_0x473aae,0xc9))[_0xb038('0x40')](handleError(_0x473aae,null));};exports['update']=function(_0x906c9c,_0x19ab72){if(_0x906c9c['body']['id']){delete _0x906c9c[_0xb038('0x44')]['id'];}delete _0x906c9c[_0xb038('0x44')][_0xb038('0x45')];delete _0x906c9c[_0xb038('0x44')][_0xb038('0x46')];delete _0x906c9c[_0xb038('0x44')][_0xb038('0x47')];delete _0x906c9c[_0xb038('0x44')][_0xb038('0x48')];return db['ScreenRecording'][_0xb038('0x42')]({'where':{'id':_0x906c9c[_0xb038('0x41')]['id']}})[_0xb038('0x22')](handleEntityNotFound(_0x19ab72,null))[_0xb038('0x22')](saveUpdates(_0x906c9c[_0xb038('0x44')],null))[_0xb038('0x22')](respondWithResult(_0x19ab72,null))['catch'](handleError(_0x19ab72,null));};exports[_0xb038('0x49')]=function(_0x2f3622,_0x2b2b4d){return db[_0xb038('0x27')][_0xb038('0x49')]()[_0xb038('0x22')](respondWithResult(_0x2b2b4d,null))[_0xb038('0x40')](handleError(_0x2b2b4d,null));};exports['download']=function(_0x3abe7a,_0x5c4a79,_0x77f211){var _0x1ea8ad=require(_0xb038('0x4a'));var _0x998fe3=![];var _0x1518c4={};if(_0x3abe7a['query']['type']&&_0x3abe7a['query'][_0xb038('0x2a')]===_0xb038('0x4b')){_0x1518c4[_0xb038('0x4b')]=_0x3abe7a[_0xb038('0x41')]['id'];}else{_0x1518c4['id']=_0x3abe7a[_0xb038('0x41')]['id'];}return db[_0xb038('0x27')]['find']({'where':_0x1518c4,'attributes':['id',_0xb038('0x48')],'raw':!![]})[_0xb038('0x22')](handleEntityNotFound(_0x5c4a79,null))['then'](function(_0x5b27d3){if(_0x5b27d3){var _0xf2907b=path['join'](config[_0xb038('0x4c')],'server/files/screen_recordings',_0x5b27d3[_0xb038('0x48')]);var _0x4677b8=util[_0xb038('0x2e')](_0xb038('0x4d'),_0xf2907b);if(fs['existsSync'](_0x4677b8)){_0x998fe3=!![];return _0x1ea8ad[_0xb038('0x4e')](_0x4677b8,_0xf2907b,config[_0xb038('0x4f')][_0xb038('0x50')])[_0xb038('0x22')](function(){return _0x5b27d3;});}return _0x5b27d3;}})[_0xb038('0x22')](function(_0x1246c8){if(_0x1246c8){var _0x14a553=path[_0xb038('0x51')](config[_0xb038('0x4c')],_0xb038('0x52'),_0x1246c8[_0xb038('0x48')]);if(!fs[_0xb038('0x53')](_0x14a553)){throw new db['Sequelize'][(_0xb038('0x54'))](_0xb038('0x55'));}if(_0x1246c8[_0xb038('0x56')]){return _0x5c4a79[_0xb038('0x57')](_0x14a553,_0x1246c8[_0xb038('0x56')]+path['extname'](_0x14a553),function(){if(_0x998fe3){fs[_0xb038('0x58')](_0x14a553);}});}else{return _0x5c4a79['download'](_0x14a553,function(_0xfb3ce6){if(_0x998fe3){fs[_0xb038('0x58')](_0x14a553);}});}}})['catch'](function(_0x15d61c){if(_0x15d61c[_0xb038('0x59')]===_0xb038('0x55')){_0x5c4a79[_0xb038('0x16')](0x194)[_0xb038('0x5a')](_0xb038('0x5b'));}else{return handleError(_0x5c4a79,null);}});};exports[_0xb038('0x5c')]=function(_0xe275b8,_0x769f1e){return db[_0xb038('0x27')]['find']({'where':{'id':_0xe275b8[_0xb038('0x41')]['id']}})['then'](function(_0x189894){if(_[_0xb038('0x5d')](_0x189894)){throw new ReferenceError(_0xb038('0x5e'));}return _0x189894;})[_0xb038('0x22')](function(_0x1f5f3f){var _0x23fb92=path[_0xb038('0x51')](config['root'],'server/files/screen_recordings',_0x1f5f3f[_0xb038('0x48')]);logger[_0xb038('0x5f')](_0xb038('0x60'),_0x23fb92);if(!_['isNil'](_0x1f5f3f['value'])&&fs[_0xb038('0x53')](_0x23fb92)){logger['info'](_0xb038('0x61')+_0x23fb92+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xb038('0x62')](_0x23fb92);}_0x23fb92=_0x23fb92+'.cypher';if(!_[_0xb038('0x5d')](_0x1f5f3f[_0xb038('0x48')])&&fs[_0xb038('0x53')](_0x23fb92)){logger[_0xb038('0x5f')](_0xb038('0x61')+_0x23fb92+_0xb038('0x63'));fs['unlinkSync'](_0x23fb92);}return _0x1f5f3f;})['then'](function(_0x45e628){if(!_0x45e628)throw new InternalError();return _0x45e628['destroy']();})[_0xb038('0x22')](function(){_0x769f1e[_0xb038('0x16')](0xcc)[_0xb038('0x17')]();})['catch'](handleError(_0x769f1e,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 68176a9..114a79c 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 _0x8dd4=['rimraf','../../config/environment','./screenRecording.attributes','exports','define','ScreenRecording','interactionid','util','api','moment','request-promise','path'];(function(_0x11bb60,_0x3dc734){var _0x37357e=function(_0x1b6a33){while(--_0x1b6a33){_0x11bb60['push'](_0x11bb60['shift']());}};_0x37357e(++_0x3dc734);}(_0x8dd4,0x11b));var _0x48dd=function(_0x362ca4,_0x4ba252){_0x362ca4=_0x362ca4-0x0;var _0x3fa0fc=_0x8dd4[_0x362ca4];return _0x3fa0fc;};'use strict';var _=require('lodash');var util=require(_0x48dd('0x0'));var logger=require('../../config/logger')(_0x48dd('0x1'));var moment=require(_0x48dd('0x2'));var BPromise=require('bluebird');var rp=require(_0x48dd('0x3'));var fs=require('fs');var path=require(_0x48dd('0x4'));var rimraf=require(_0x48dd('0x5'));var config=require(_0x48dd('0x6'));var attributes=require(_0x48dd('0x7'));module[_0x48dd('0x8')]=function(_0x15102d,_0x272cda){return _0x15102d[_0x48dd('0x9')](_0x48dd('0xa'),attributes,{'tableName':'screen_recordings','paranoid':![],'indexes':[{'name':_0x48dd('0xb'),'fields':[_0x48dd('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd537=['define','screen_recordings','interactionid','../../config/logger','moment','bluebird','request-promise','rimraf','./screenRecording.attributes'];(function(_0x15b380,_0x1a3c5f){var _0x232c5c=function(_0x12f8e0){while(--_0x12f8e0){_0x15b380['push'](_0x15b380['shift']());}};_0x232c5c(++_0x1a3c5f);}(_0xd537,0x159));var _0x7d53=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0xd537[_0x2d2c16];return _0x53f2fb;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7d53('0x0'))('api');var moment=require(_0x7d53('0x1'));var BPromise=require(_0x7d53('0x2'));var rp=require(_0x7d53('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7d53('0x4'));var config=require('../../config/environment');var attributes=require(_0x7d53('0x5'));module['exports']=function(_0x11b6a7,_0x5126e4){return _0x11b6a7[_0x7d53('0x6')]('ScreenRecording',attributes,{'tableName':_0x7d53('0x7'),'paranoid':![],'indexes':[{'name':'interactionid','fields':[_0x7d53('0x8')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 13c1cbb..55f70c5 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 _0xdb77=['message','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','request','then','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0xba11f0,_0x202c57){var _0x555cf9=function(_0x185f6e){while(--_0x185f6e){_0xba11f0['push'](_0xba11f0['shift']());}};_0x555cf9(++_0x202c57);}(_0xdb77,0x141));var _0x7db7=function(_0x3e3a66,_0x1e1e25){_0x3e3a66=_0x3e3a66-0x0;var _0x46d3cf=_0xdb77[_0x3e3a66];return _0x46d3cf;};'use strict';var _=require(_0x7db7('0x0'));var util=require('util');var moment=require(_0x7db7('0x1'));var BPromise=require(_0x7db7('0x2'));var rs=require(_0x7db7('0x3'));var fs=require('fs');var Redis=require(_0x7db7('0x4'));var db=require(_0x7db7('0x5'))['db'];var utils=require(_0x7db7('0x6'));var logger=require(_0x7db7('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7db7('0x8'));var client=jayson[_0x7db7('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2f4ef9,_0x37f618,_0x21b4d1){return new BPromise(function(_0x1260fd,_0x3608f6){return client[_0x7db7('0xa')](_0x2f4ef9,_0x21b4d1)[_0x7db7('0xb')](function(_0x1b57ff){logger[_0x7db7('0xc')](_0x7db7('0xd'),_0x37f618,_0x7db7('0xe'));logger[_0x7db7('0xf')]('ScreenRecording,\x20%s,\x20%s,\x20%s',_0x37f618,_0x7db7('0xe'),JSON[_0x7db7('0x10')](_0x1b57ff));if(_0x1b57ff[_0x7db7('0x11')]){if(_0x1b57ff['error'][_0x7db7('0x12')]===0x1f4){logger[_0x7db7('0x11')]('ScreenRecording,\x20%s,\x20%s',_0x37f618,_0x1b57ff['error'][_0x7db7('0x13')]);return _0x3608f6(_0x1b57ff['error'][_0x7db7('0x13')]);}logger[_0x7db7('0x11')](_0x7db7('0xd'),_0x37f618,_0x1b57ff[_0x7db7('0x11')][_0x7db7('0x13')]);return _0x1260fd(_0x1b57ff[_0x7db7('0x11')][_0x7db7('0x13')]);}else{logger[_0x7db7('0xc')](_0x7db7('0xd'),_0x37f618,'request\x20sent');_0x1260fd(_0x1b57ff['result'][_0x7db7('0x13')]);}})['catch'](function(_0x59173f){logger['error']('ScreenRecording,\x20%s,\x20%s',_0x37f618,_0x59173f);_0x3608f6(_0x59173f);});});} \ No newline at end of file +var _0xa96d=['debug','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','ScreenRecording,\x20%s,\x20%s','request\x20sent'];(function(_0x441a9e,_0x1d1ed5){var _0x238c72=function(_0x100fab){while(--_0x100fab){_0x441a9e['push'](_0x441a9e['shift']());}};_0x238c72(++_0x1d1ed5);}(_0xa96d,0x18f));var _0xda96=function(_0x5cd7a3,_0x1aa14f){_0x5cd7a3=_0x5cd7a3-0x0;var _0x21235d=_0xa96d[_0x5cd7a3];return _0x21235d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xda96('0x0'));var BPromise=require(_0xda96('0x1'));var rs=require(_0xda96('0x2'));var fs=require('fs');var Redis=require(_0xda96('0x3'));var db=require(_0xda96('0x4'))['db'];var utils=require(_0xda96('0x5'));var logger=require(_0xda96('0x6'))(_0xda96('0x7'));var config=require('../../config/environment');var jayson=require(_0xda96('0x8'));var client=jayson['client'][_0xda96('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5e1b7e,_0x2c36f3,_0x164029){return new BPromise(function(_0x4ee04f,_0x1e4a7b){return client[_0xda96('0xa')](_0x5e1b7e,_0x164029)[_0xda96('0xb')](function(_0x4534a3){logger[_0xda96('0xc')](_0xda96('0xd'),_0x2c36f3,_0xda96('0xe'));logger[_0xda96('0xf')](_0xda96('0x10'),_0x2c36f3,_0xda96('0xe'),JSON[_0xda96('0x11')](_0x4534a3));if(_0x4534a3[_0xda96('0x12')]){if(_0x4534a3[_0xda96('0x12')][_0xda96('0x13')]===0x1f4){logger['error']('ScreenRecording,\x20%s,\x20%s',_0x2c36f3,_0x4534a3[_0xda96('0x12')][_0xda96('0x14')]);return _0x1e4a7b(_0x4534a3['error']['message']);}logger[_0xda96('0x12')](_0xda96('0xd'),_0x2c36f3,_0x4534a3['error']['message']);return _0x4ee04f(_0x4534a3[_0xda96('0x12')][_0xda96('0x14')]);}else{logger[_0xda96('0xc')](_0xda96('0xd'),_0x2c36f3,_0xda96('0xe'));_0x4ee04f(_0x4534a3[_0xda96('0x15')][_0xda96('0x14')]);}})[_0xda96('0x16')](function(_0x3f26c0){logger['error']('ScreenRecording,\x20%s,\x20%s',_0x2c36f3,_0x3f26c0);_0x1e4a7b(_0x3f26c0);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 7a99cda..cc52116 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 _0x0558=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','get','getDate','/:id','show','/:id/logo','/:id/logo_login','/:id/gdpr','getPreferred','/:id/favicon','getFavicon','diskStorage','server/files/images/logos/','format','%s%s','logo','extname','originalname','post','single','file','addLogo','join','logologin','addLogoLogin','/:id/preferred','addPreferred','root','put','isAuthenticated','update','exports','multer','util','path','connect-timeout'];(function(_0x5db313,_0x3c8f0c){var _0x36d503=function(_0x5d1ff6){while(--_0x5d1ff6){_0x5db313['push'](_0x5db313['shift']());}};_0x36d503(++_0x3c8f0c);}(_0x0558,0xa4));var _0x8055=function(_0x3dc089,_0x5ccb0d){_0x3dc089=_0x3dc089-0x0;var _0x34d9d3=_0x0558[_0x3dc089];return _0x34d9d3;};'use strict';var multer=require(_0x8055('0x0'));var util=require(_0x8055('0x1'));var path=require(_0x8055('0x2'));var timeout=require(_0x8055('0x3'));var express=require(_0x8055('0x4'));var router=express[_0x8055('0x5')]();var fs_extra=require(_0x8055('0x6'));var auth=require(_0x8055('0x7'));var interaction=require(_0x8055('0x8'));var config=require(_0x8055('0x9'));var controller=require(_0x8055('0xa'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x8055('0xb')]('/now',controller[_0x8055('0xc')]);router[_0x8055('0xb')](_0x8055('0xd'),controller[_0x8055('0xe')]);router[_0x8055('0xb')](_0x8055('0xf'),controller['getLogo']);router[_0x8055('0xb')](_0x8055('0x10'),controller['getLogoLogin']);router[_0x8055('0xb')](_0x8055('0x11'),controller['gdpr']);router['get']('/:id/preferred',controller[_0x8055('0x12')]);router[_0x8055('0xb')](_0x8055('0x13'),controller[_0x8055('0x14')]);var upload=multer({'storage':multer[_0x8055('0x15')]({'destination':function(_0x25ef70,_0x2771a2,_0x508b83){_0x508b83(null,path['join'](config['root'],_0x8055('0x16')));},'filename':function(_0x4d33e9,_0x2f5760,_0x189976){_0x189976(null,util[_0x8055('0x17')](_0x8055('0x18'),_0x8055('0x19'),path[_0x8055('0x1a')](_0x2f5760[_0x8055('0x1b')])));}})});router[_0x8055('0x1c')]('/:id/logo',upload[_0x8055('0x1d')](_0x8055('0x1e')),controller[_0x8055('0x1f')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x505f02,_0x17eb4a,_0x156a0e){_0x156a0e(null,path[_0x8055('0x20')](config['root'],_0x8055('0x16')));},'filename':function(_0x291aa1,_0x34df33,_0x1d80a1){_0x1d80a1(null,util['format']('%s%s',_0x8055('0x21'),path[_0x8055('0x1a')](_0x34df33[_0x8055('0x1b')])));}})});router['post'](_0x8055('0x10'),upload[_0x8055('0x1d')](_0x8055('0x1e')),controller[_0x8055('0x22')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x13e55d,_0x4eaf61,_0x39d595){_0x39d595(null,path[_0x8055('0x20')](config['root'],_0x8055('0x16')));},'filename':function(_0x475c54,_0x378969,_0x1ca4ef){_0x1ca4ef(null,util[_0x8055('0x17')]('%s%s','preferred',path[_0x8055('0x1a')](_0x378969[_0x8055('0x1b')])));}})});router[_0x8055('0x1c')](_0x8055('0x23'),upload[_0x8055('0x1d')]('file'),controller[_0x8055('0x24')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x160396,_0x46fb25,_0x579bdc){_0x579bdc(null,path[_0x8055('0x20')](config[_0x8055('0x25')],_0x8055('0x16')));},'filename':function(_0x5c18de,_0x59af90,_0x1b0d0b){_0x1b0d0b(null,util[_0x8055('0x17')]('%s%s','favicon',path[_0x8055('0x1a')](_0x59af90[_0x8055('0x1b')])));}})});router[_0x8055('0x1c')](_0x8055('0x13'),upload[_0x8055('0x1d')](_0x8055('0x1e')),controller['addFavicon']);router[_0x8055('0x26')](_0x8055('0xd'),auth[_0x8055('0x27')](),controller[_0x8055('0x28')]);module[_0x8055('0x29')]=router; \ No newline at end of file +var _0x1247=['getPreferred','/:id/favicon','getFavicon','diskStorage','server/files/images/logos/','format','%s%s','logo','extname','originalname','post','file','addLogo','addLogoLogin','root','preferred','addPreferred','join','single','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/now','getDate','/:id','show','/:id/logo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred'];(function(_0x148f1a,_0x38eadd){var _0x47da7f=function(_0x46ed20){while(--_0x46ed20){_0x148f1a['push'](_0x148f1a['shift']());}};_0x47da7f(++_0x38eadd);}(_0x1247,0x117));var _0x7124=function(_0x3c4dad,_0x25ffd5){_0x3c4dad=_0x3c4dad-0x0;var _0x1a4f49=_0x1247[_0x3c4dad];return _0x1a4f49;};'use strict';var multer=require(_0x7124('0x0'));var util=require(_0x7124('0x1'));var path=require(_0x7124('0x2'));var timeout=require(_0x7124('0x3'));var express=require(_0x7124('0x4'));var router=express[_0x7124('0x5')]();var fs_extra=require(_0x7124('0x6'));var auth=require(_0x7124('0x7'));var interaction=require(_0x7124('0x8'));var config=require(_0x7124('0x9'));var controller=require('./setting.controller');router['get']('/',auth[_0x7124('0xa')](),controller['index']);router[_0x7124('0xb')](_0x7124('0xc'),controller[_0x7124('0xd')]);router[_0x7124('0xb')](_0x7124('0xe'),controller[_0x7124('0xf')]);router[_0x7124('0xb')](_0x7124('0x10'),controller['getLogo']);router[_0x7124('0xb')](_0x7124('0x11'),controller[_0x7124('0x12')]);router[_0x7124('0xb')](_0x7124('0x13'),controller[_0x7124('0x14')]);router['get'](_0x7124('0x15'),controller[_0x7124('0x16')]);router[_0x7124('0xb')](_0x7124('0x17'),controller[_0x7124('0x18')]);var upload=multer({'storage':multer[_0x7124('0x19')]({'destination':function(_0x3b3490,_0x3c079d,_0x4d6dc5){_0x4d6dc5(null,path['join'](config['root'],_0x7124('0x1a')));},'filename':function(_0x214e51,_0x4ac3b1,_0x272df9){_0x272df9(null,util[_0x7124('0x1b')](_0x7124('0x1c'),_0x7124('0x1d'),path[_0x7124('0x1e')](_0x4ac3b1[_0x7124('0x1f')])));}})});router[_0x7124('0x20')]('/:id/logo',upload['single'](_0x7124('0x21')),controller[_0x7124('0x22')]);var upload=multer({'storage':multer[_0x7124('0x19')]({'destination':function(_0x5e042e,_0x235ca2,_0x14327d){_0x14327d(null,path['join'](config['root'],_0x7124('0x1a')));},'filename':function(_0x3396f7,_0x6978a6,_0x38beaa){_0x38beaa(null,util[_0x7124('0x1b')](_0x7124('0x1c'),'logologin',path['extname'](_0x6978a6[_0x7124('0x1f')])));}})});router['post'](_0x7124('0x11'),upload['single']('file'),controller[_0x7124('0x23')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x169e20,_0x71a8f8,_0x5ebaa0){_0x5ebaa0(null,path['join'](config[_0x7124('0x24')],_0x7124('0x1a')));},'filename':function(_0x4ce2b8,_0x5566d9,_0x13c357){_0x13c357(null,util[_0x7124('0x1b')](_0x7124('0x1c'),_0x7124('0x25'),path[_0x7124('0x1e')](_0x5566d9[_0x7124('0x1f')])));}})});router[_0x7124('0x20')]('/:id/preferred',upload['single'](_0x7124('0x21')),controller[_0x7124('0x26')]);var upload=multer({'storage':multer[_0x7124('0x19')]({'destination':function(_0x1ed532,_0x467eea,_0x219029){_0x219029(null,path[_0x7124('0x27')](config['root'],_0x7124('0x1a')));},'filename':function(_0x39563e,_0x414d36,_0x20a6d7){_0x20a6d7(null,util[_0x7124('0x1b')](_0x7124('0x1c'),'favicon',path[_0x7124('0x1e')](_0x414d36[_0x7124('0x1f')])));}})});router['post'](_0x7124('0x17'),upload[_0x7124('0x28')](_0x7124('0x21')),controller['addFavicon']);router['put'](_0x7124('0xe'),auth['isAuthenticated'](),controller[_0x7124('0x29')]);module[_0x7124('0x2a')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index a8d8ee9..f33c5f7 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 _0xa9e0=['BOOLEAN','alternate','UNSIGNED','sequelize','exports','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted'];(function(_0x3efff,_0x345f59){var _0x1976b7=function(_0x252f4b){while(--_0x252f4b){_0x3efff['push'](_0x3efff['shift']());}};_0x1976b7(++_0x345f59);}(_0xa9e0,0x123));var _0x0a9e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'min_internal':{'type':Sequelize[_0x0a9e('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x0a9e('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x5')},'logo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLogo':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x0a9e('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x0a9e('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x0a9e('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x0a9e('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x7')},'chatTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x0a9e('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x0a9e('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x0a9e('0x4')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x0a9e('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x4')]},'bucket':{'type':Sequelize[_0x0a9e('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x0a9e('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x14}}; \ No newline at end of file +var _0xa9e0=['BOOLEAN','alternate','UNSIGNED','sequelize','exports','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted'];(function(_0x2bd40e,_0x27a313){var _0x492c82=function(_0x592235){while(--_0x592235){_0x2bd40e['push'](_0x2bd40e['shift']());}};_0x492c82(++_0x27a313);}(_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')]={'min_internal':{'type':Sequelize[_0x0a9e('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x0a9e('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x5')},'logo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLogo':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x0a9e('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x0a9e('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x0a9e('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x0a9e('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x7')},'chatTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x0a9e('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x0a9e('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x0a9e('0x4')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x0a9e('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x4')]},'bucket':{'type':Sequelize[_0x0a9e('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x0a9e('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x14}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index eaf65cd..6183f38 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 _0x9658=['key','model','query','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','map','Setting','rows','catch','show','keys','rawAttributes','length','includeAll','include','options','find','body','params','file','filename','addLogoLogin','loginLogo','getLogo','getLicense','logo','preferred','favicon','defaultLogo','defaultLoginLogo','defaultFavicon','existsSync','root','toLower','default_logo.svg','default','custom','join','ValidationError','upperFirst','\x20not\x20found','getLogoLogin','server/files/images/logos','default_loginLogo.svg','Sequelize','download','gdpr','securePassword','addPreferred','getPreferred','defaultPreferred','default_preferred.png','getFavicon','default_favicon.ico','getDate','utcOffset','now','format','eml-format','rimraf','zip-dir','fast-json-patch','util','sox','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','client','http','request','then','info','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','Setting,\x20%s,\x20%s','message','result','sendStatus','end','status','json','offset','limit','count','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','fieldName','type'];(function(_0x17e4a7,_0x248280){var _0x3c2d66=function(_0x7c398c){while(--_0x7c398c){_0x17e4a7['push'](_0x17e4a7['shift']());}};_0x3c2d66(++_0x248280);}(_0x9658,0xba));var _0x8965=function(_0x3adb8e,_0x247ca2){_0x3adb8e=_0x3adb8e-0x0;var _0x3eacdb=_0x9658[_0x3adb8e];return _0x3eacdb;};'use strict';var emlformat=require(_0x8965('0x0'));var rimraf=require(_0x8965('0x1'));var zipdir=require(_0x8965('0x2'));var jsonpatch=require(_0x8965('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x8965('0x4'));var path=require('path');var sox=require(_0x8965('0x5'));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(_0x8965('0x6'));var crypto=require(_0x8965('0x7'));var jsforce=require(_0x8965('0x8'));var deskjs=require(_0x8965('0x9'));var toCsv=require('to-csv');var querystring=require(_0x8965('0xa'));var Papa=require('papaparse');var Redis=require(_0x8965('0xb'));var authService=require(_0x8965('0xc'));var qs=require(_0x8965('0xd'));var as=require(_0x8965('0xe'));var hardwareService=require(_0x8965('0xf'));var logger=require('../../config/logger')(_0x8965('0x10'));var utils=require(_0x8965('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x8965('0x12'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0x8965('0x13')][_0x8965('0x14')]({'port':0x232a});function respondWithRpcPromise(_0x39788d,_0x4ad849,_0x34edc4,_0x172949){return new BPromise(function(_0x47a1cb,_0x5ed325){var _0x301a90=_0x172949||client;return _0x301a90[_0x8965('0x15')](_0x39788d,_0x34edc4)[_0x8965('0x16')](function(_0x306611){logger[_0x8965('0x17')]('Setting,\x20%s,\x20%s',_0x4ad849,_0x8965('0x18'));logger[_0x8965('0x19')](_0x8965('0x1a'),_0x4ad849,'request\x20sent',JSON[_0x8965('0x1b')](_0x306611));if(_0x306611[_0x8965('0x1c')]){if(_0x306611[_0x8965('0x1c')]['code']===0x1f4){logger[_0x8965('0x1c')](_0x8965('0x1d'),_0x4ad849,_0x306611[_0x8965('0x1c')][_0x8965('0x1e')]);return _0x5ed325(_0x306611[_0x8965('0x1c')]['message']);}logger['error'](_0x8965('0x1d'),_0x4ad849,_0x306611[_0x8965('0x1c')][_0x8965('0x1e')]);return _0x47a1cb(_0x306611[_0x8965('0x1c')][_0x8965('0x1e')]);}else{logger[_0x8965('0x17')](_0x8965('0x1d'),_0x4ad849,_0x8965('0x18'));_0x47a1cb(_0x306611[_0x8965('0x1f')]['message']);}})['catch'](function(_0x482246){logger['error'](_0x8965('0x1d'),_0x4ad849,_0x482246);_0x5ed325(_0x482246);});});}function respondWithStatusCode(_0x208555,_0x1bba3a){_0x1bba3a=_0x1bba3a||0xcc;return function(_0x11deb3){if(_0x11deb3){return _0x208555[_0x8965('0x20')](_0x1bba3a);}return _0x208555['status'](_0x1bba3a)[_0x8965('0x21')]();};}function respondWithResult(_0x3f5197,_0x2eb0ef){_0x2eb0ef=_0x2eb0ef||0xc8;return function(_0x404c55){if(_0x404c55){return _0x3f5197[_0x8965('0x22')](_0x2eb0ef)[_0x8965('0x23')](_0x404c55);}};}function respondWithFilteredResult(_0x39c924,_0x5a7c41){return function(_0x2049de){if(_0x2049de){var _0x2228b4=typeof _0x5a7c41[_0x8965('0x24')]==='undefined'&&typeof _0x5a7c41[_0x8965('0x25')]==='undefined';var _0x578e0e=_0x2049de[_0x8965('0x26')];var _0x1c4215=_0x2228b4?0x0:_0x5a7c41[_0x8965('0x24')];var _0x396812=_0x2228b4?_0x2049de[_0x8965('0x26')]:_0x5a7c41[_0x8965('0x24')]+_0x5a7c41['limit'];var _0x4feca9;if(_0x396812>=_0x578e0e){_0x396812=_0x578e0e;_0x4feca9=0xc8;}else{_0x4feca9=0xce;}_0x39c924['status'](_0x4feca9);return _0x39c924[_0x8965('0x27')](_0x8965('0x28'),_0x1c4215+'-'+_0x396812+'/'+_0x578e0e)[_0x8965('0x23')](_0x2049de);}return null;};}function patchUpdates(_0x21a356){return function(_0x30a046){try{jsonpatch[_0x8965('0x29')](_0x30a046,_0x21a356,!![]);}catch(_0x1b4314){return BPromise[_0x8965('0x2a')](_0x1b4314);}return _0x30a046[_0x8965('0x2b')]();};}function saveUpdates(_0x3ac3d8,_0x3f57aa){return function(_0x29aec9){if(_0x29aec9){return _0x29aec9[_0x8965('0x2c')](_0x3ac3d8)[_0x8965('0x16')](function(_0x1d1f42){return _0x1d1f42;});}return null;};}function removeEntity(_0x3cde99,_0x4f5f47){return function(_0x5e12d7){if(_0x5e12d7){return _0x5e12d7[_0x8965('0x2d')]()[_0x8965('0x16')](function(){_0x3cde99['status'](0xcc)[_0x8965('0x21')]();});}};}function handleEntityNotFound(_0x3be773,_0x541b4c){return function(_0x748e01){if(!_0x748e01){_0x3be773['sendStatus'](0x194);}return _0x748e01;};}function handleError(_0x179245,_0xff35d7){_0xff35d7=_0xff35d7||0x1f4;return function(_0x41e11c){logger['error'](_0x41e11c[_0x8965('0x2e')]);if(_0x41e11c[_0x8965('0x2f')]){delete _0x41e11c[_0x8965('0x2f')];}_0x179245[_0x8965('0x22')](_0xff35d7)[_0x8965('0x30')](_0x41e11c);};}exports[_0x8965('0x31')]=function(_0x1bc564,_0x556a4d){var _0x389347={},_0x189ea5={},_0x3e1b2d={'count':0x0,'rows':[]};var _0x561a17=_['map'](db['Setting']['rawAttributes'],function(_0x1cd2d0){return{'name':_0x1cd2d0[_0x8965('0x32')],'type':_0x1cd2d0[_0x8965('0x33')][_0x8965('0x34')]};});_0x189ea5[_0x8965('0x35')]=_['map'](_0x561a17,_0x8965('0x2f'));_0x189ea5[_0x8965('0x36')]=_['keys'](_0x1bc564['query']);_0x189ea5['filters']=_[_0x8965('0x37')](_0x189ea5['model'],_0x189ea5[_0x8965('0x36')]);_0x389347['attributes']=_[_0x8965('0x37')](_0x189ea5[_0x8965('0x35')],qs[_0x8965('0x38')](_0x1bc564['query'][_0x8965('0x38')]));_0x389347['attributes']=_0x389347[_0x8965('0x39')]['length']?_0x389347[_0x8965('0x39')]:_0x189ea5[_0x8965('0x35')];if(!_0x1bc564[_0x8965('0x36')][_0x8965('0x3a')](_0x8965('0x3b'))){_0x389347[_0x8965('0x25')]=qs[_0x8965('0x25')](_0x1bc564[_0x8965('0x36')][_0x8965('0x25')]);_0x389347['offset']=qs[_0x8965('0x24')](_0x1bc564[_0x8965('0x36')][_0x8965('0x24')]);}_0x389347[_0x8965('0x3c')]=qs[_0x8965('0x3d')](_0x1bc564['query'][_0x8965('0x3d')]);_0x389347[_0x8965('0x3e')]=qs[_0x8965('0x3f')](_['pick'](_0x1bc564[_0x8965('0x36')],_0x189ea5['filters']),_0x561a17);if(_0x1bc564['query'][_0x8965('0x40')]){_0x389347['where']=_[_0x8965('0x41')](_0x389347[_0x8965('0x3e')],{'$or':_[_0x8965('0x42')](_0x561a17,function(_0x212735){if(_0x212735[_0x8965('0x33')]!=='VIRTUAL'){var _0x16b5db={};_0x16b5db[_0x212735['name']]={'$like':'%'+_0x1bc564[_0x8965('0x36')]['filter']+'%'};return _0x16b5db;}})});}_0x389347=_[_0x8965('0x41')]({},_0x389347,_0x1bc564['options']);var _0x48ce92={'where':_0x389347[_0x8965('0x3e')]};return db['Setting']['count'](_0x48ce92)[_0x8965('0x16')](function(_0x22d8c4){_0x3e1b2d[_0x8965('0x26')]=_0x22d8c4;if(_0x1bc564[_0x8965('0x36')]['includeAll']){_0x389347['include']=[{'all':!![]}];}return db[_0x8965('0x43')]['findAll'](_0x389347);})[_0x8965('0x16')](function(_0x1692fc){_0x3e1b2d[_0x8965('0x44')]=_0x1692fc;return _0x3e1b2d;})['then'](respondWithFilteredResult(_0x556a4d,_0x389347))[_0x8965('0x45')](handleError(_0x556a4d,null));};exports[_0x8965('0x46')]=function(_0x1693c3,_0x43afa1){var _0x3307a3={'raw':![],'where':{'id':_0x1693c3['params']['id']}},_0x2240b3={};_0x2240b3[_0x8965('0x35')]=_[_0x8965('0x47')](db[_0x8965('0x43')][_0x8965('0x48')]);_0x2240b3[_0x8965('0x36')]=_[_0x8965('0x47')](_0x1693c3[_0x8965('0x36')]);_0x2240b3['filters']=_[_0x8965('0x37')](_0x2240b3[_0x8965('0x35')],_0x2240b3['query']);_0x3307a3['attributes']=_['intersection'](_0x2240b3[_0x8965('0x35')],qs[_0x8965('0x38')](_0x1693c3[_0x8965('0x36')][_0x8965('0x38')]));_0x3307a3['attributes']=_0x3307a3['attributes'][_0x8965('0x49')]?_0x3307a3[_0x8965('0x39')]:_0x2240b3[_0x8965('0x35')];if(_0x1693c3[_0x8965('0x36')][_0x8965('0x4a')]){_0x3307a3[_0x8965('0x4b')]=[{'all':!![]}];}_0x3307a3=_[_0x8965('0x41')]({},_0x3307a3,_0x1693c3[_0x8965('0x4c')]);return db['Setting'][_0x8965('0x4d')](_0x3307a3)['then'](handleEntityNotFound(_0x43afa1,null))[_0x8965('0x16')](respondWithResult(_0x43afa1,null))[_0x8965('0x45')](handleError(_0x43afa1,null));};exports['update']=function(_0x3e9467,_0x39d3e0){if(_0x3e9467[_0x8965('0x4e')]['id']){delete _0x3e9467[_0x8965('0x4e')]['id'];}return db['Setting'][_0x8965('0x4d')]({'where':{'id':_0x3e9467[_0x8965('0x4f')]['id']}})[_0x8965('0x16')](handleEntityNotFound(_0x39d3e0,null))[_0x8965('0x16')](saveUpdates(_0x3e9467['body'],null))['then'](respondWithResult(_0x39d3e0,null))[_0x8965('0x45')](handleError(_0x39d3e0,null));};exports['addLogo']=function(_0x563f92,_0x70774f,_0x5c1600){if(_0x563f92[_0x8965('0x50')]&&_0x563f92[_0x8965('0x50')][_0x8965('0x51')]){_0x563f92[_0x8965('0x4e')]['logo']=_0x563f92['file'][_0x8965('0x51')];}return db['Setting'][_0x8965('0x4d')]({'where':{'id':_0x563f92[_0x8965('0x4f')]['id']}})[_0x8965('0x16')](handleEntityNotFound(_0x70774f,null))['then'](saveUpdates(_0x563f92['body'],null))[_0x8965('0x16')](respondWithResult(_0x70774f,null))['catch'](handleError(_0x70774f,null));};exports[_0x8965('0x52')]=function(_0x77798,_0x3c1644,_0x40acd8){if(_0x77798[_0x8965('0x50')]&&_0x77798[_0x8965('0x50')][_0x8965('0x51')]){_0x77798[_0x8965('0x4e')][_0x8965('0x53')]=_0x77798[_0x8965('0x50')][_0x8965('0x51')];}return db[_0x8965('0x43')]['find']({'where':{'id':_0x77798[_0x8965('0x4f')]['id']}})[_0x8965('0x16')](handleEntityNotFound(_0x3c1644,null))[_0x8965('0x16')](saveUpdates(_0x77798['body'],null))[_0x8965('0x16')](respondWithResult(_0x3c1644,null))[_0x8965('0x45')](handleError(_0x3c1644,null));};var utilLicense=require(_0x8965('0x12'));exports[_0x8965('0x54')]=function(_0x1a5f8b,_0x2dfa4c,_0x23cb64){var _0x521a2d='server/files/images/logos';var _0x4753d5={'custom':![]};return utilLicense[_0x8965('0x55')]()[_0x8965('0x16')](function(_0x56ca9a){if(_0x56ca9a){_0x4753d5=_0x56ca9a;}return db['Setting'][_0x8965('0x4d')]({'where':{'id':_0x1a5f8b[_0x8965('0x4f')]['id']},'attributes':[_0x8965('0x56'),'loginLogo',_0x8965('0x57'),_0x8965('0x58'),_0x8965('0x59'),_0x8965('0x5a'),'defaultPreferred',_0x8965('0x5b')],'raw':!![]});})[_0x8965('0x16')](handleEntityNotFound(_0x2dfa4c,null))[_0x8965('0x16')](function(_0x546c20){if(_0x546c20){var _0x224474=_0x546c20['logo']&&fs[_0x8965('0x5c')](path['join'](config[_0x8965('0x5d')],_0x521a2d,_[_0x8965('0x5e')](_0x546c20[_0x8965('0x56')])))?path['join'](config['root'],_0x521a2d,_[_0x8965('0x5e')](_0x546c20[_0x8965('0x56')])):path['join'](config['root'],_0x521a2d,_[_0x8965('0x5e')](_0x8965('0x5f')));var _0x29e727=_0x8965('0x60')+_['upperFirst'](_0x8965('0x56'));if(_0x546c20[_0x29e727]||!_0x4753d5[_0x8965('0x61')]){_0x224474=path[_0x8965('0x62')](config['root'],_0x521a2d,_[_0x8965('0x5e')](_0x8965('0x5f')));}if(!fs[_0x8965('0x5c')](_0x224474)){throw new db['Sequelize'][(_0x8965('0x63'))](_[_0x8965('0x64')](_0x8965('0x56'))+_0x8965('0x65'));}return _0x2dfa4c['download'](_0x224474);}})[_0x8965('0x45')](handleError(_0x2dfa4c,null));};var utilLicense=require(_0x8965('0x12'));exports[_0x8965('0x66')]=function(_0x155274,_0x22e35e,_0xb5d7a1){var _0x593a01=_0x8965('0x67');var _0x303a4c={'custom':![]};return utilLicense[_0x8965('0x55')]()[_0x8965('0x16')](function(_0x2102f8){if(_0x2102f8){_0x303a4c=_0x2102f8;}return db[_0x8965('0x43')][_0x8965('0x4d')]({'where':{'id':_0x155274[_0x8965('0x4f')]['id']},'attributes':[_0x8965('0x56'),_0x8965('0x53'),'preferred',_0x8965('0x58'),_0x8965('0x59'),_0x8965('0x5a'),'defaultPreferred',_0x8965('0x5b')],'raw':!![]});})[_0x8965('0x16')](handleEntityNotFound(_0x22e35e,null))[_0x8965('0x16')](function(_0x48f06d){if(_0x48f06d){var _0x190289=_0x48f06d[_0x8965('0x53')]&&fs[_0x8965('0x5c')](path[_0x8965('0x62')](config[_0x8965('0x5d')],_0x593a01,_['toLower'](_0x48f06d['loginLogo'])))?path[_0x8965('0x62')](config[_0x8965('0x5d')],_0x593a01,_[_0x8965('0x5e')](_0x48f06d['loginLogo'])):path['join'](config[_0x8965('0x5d')],_0x593a01,_['toLower'](_0x8965('0x68')));var _0x2bf9e9=_0x8965('0x60')+_[_0x8965('0x64')](_0x8965('0x53'));if(_0x48f06d[_0x2bf9e9]||!_0x303a4c['custom']){_0x190289=path['join'](config['root'],_0x593a01,_[_0x8965('0x5e')]('default_loginLogo.svg'));}if(!fs[_0x8965('0x5c')](_0x190289)){throw new db[(_0x8965('0x69'))]['ValidationError'](_[_0x8965('0x64')](_0x8965('0x53'))+_0x8965('0x65'));}return _0x22e35e[_0x8965('0x6a')](_0x190289);}})[_0x8965('0x45')](handleError(_0x22e35e,null));};exports[_0x8965('0x6b')]=function(_0x4624c0,_0x504f43){return db['Setting']['find']({'where':{'id':_0x4624c0[_0x8965('0x4f')]['id']},'attributes':[_0x8965('0x6c')]})['then'](respondWithResult(_0x504f43,null))[_0x8965('0x45')](handleError(_0x504f43,null));};exports[_0x8965('0x6d')]=function(_0x3603ce,_0x4d6a40,_0x3d0e8f){if(_0x3603ce[_0x8965('0x50')]&&_0x3603ce[_0x8965('0x50')][_0x8965('0x51')]){_0x3603ce[_0x8965('0x4e')][_0x8965('0x57')]=_0x3603ce[_0x8965('0x50')][_0x8965('0x51')];}return db['Setting'][_0x8965('0x4d')]({'where':{'id':_0x3603ce[_0x8965('0x4f')]['id']}})['then'](handleEntityNotFound(_0x4d6a40,null))[_0x8965('0x16')](saveUpdates(_0x3603ce['body'],null))[_0x8965('0x16')](respondWithResult(_0x4d6a40,null))['catch'](handleError(_0x4d6a40,null));};var utilLicense=require(_0x8965('0x12'));exports[_0x8965('0x6e')]=function(_0x570e0b,_0x30977f,_0x13f026){var _0x432bfe='server/files/images/logos';var _0x438a3c={'custom':![]};return utilLicense[_0x8965('0x55')]()['then'](function(_0x30b08c){if(_0x30b08c){_0x438a3c=_0x30b08c;}return db['Setting'][_0x8965('0x4d')]({'where':{'id':_0x570e0b[_0x8965('0x4f')]['id']},'attributes':[_0x8965('0x56'),_0x8965('0x53'),_0x8965('0x57'),_0x8965('0x58'),_0x8965('0x59'),_0x8965('0x5a'),_0x8965('0x6f'),_0x8965('0x5b')],'raw':!![]});})[_0x8965('0x16')](handleEntityNotFound(_0x30977f,null))[_0x8965('0x16')](function(_0x23b634){if(_0x23b634){var _0xdac169=_0x23b634[_0x8965('0x57')]&&fs[_0x8965('0x5c')](path[_0x8965('0x62')](config[_0x8965('0x5d')],_0x432bfe,_[_0x8965('0x5e')](_0x23b634[_0x8965('0x57')])))?path['join'](config['root'],_0x432bfe,_[_0x8965('0x5e')](_0x23b634['preferred'])):path[_0x8965('0x62')](config[_0x8965('0x5d')],_0x432bfe,_['toLower']('default_preferred.png'));var _0x2abb9a=_0x8965('0x60')+_[_0x8965('0x64')]('preferred');if(_0x23b634[_0x2abb9a]||!_0x438a3c[_0x8965('0x61')]||!_0x438a3c[_0x8965('0x57')]){_0xdac169=path['join'](config[_0x8965('0x5d')],_0x432bfe,_['toLower'](_0x8965('0x70')));}if(!fs['existsSync'](_0xdac169)){throw new db[(_0x8965('0x69'))][(_0x8965('0x63'))](_[_0x8965('0x64')]('preferred')+_0x8965('0x65'));}return _0x30977f[_0x8965('0x6a')](_0xdac169);}})[_0x8965('0x45')](handleError(_0x30977f,null));};exports['addFavicon']=function(_0x2e7fa0,_0x4b5fbc,_0x487b66){if(_0x2e7fa0[_0x8965('0x50')]&&_0x2e7fa0[_0x8965('0x50')]['filename']){_0x2e7fa0['body']['favicon']=_0x2e7fa0['file']['filename'];}return db[_0x8965('0x43')]['find']({'where':{'id':_0x2e7fa0[_0x8965('0x4f')]['id']}})['then'](handleEntityNotFound(_0x4b5fbc,null))[_0x8965('0x16')](saveUpdates(_0x2e7fa0[_0x8965('0x4e')],null))[_0x8965('0x16')](respondWithResult(_0x4b5fbc,null))[_0x8965('0x45')](handleError(_0x4b5fbc,null));};var utilLicense=require(_0x8965('0x12'));exports[_0x8965('0x71')]=function(_0x157d94,_0x57d0da,_0x12fc2c){var _0x47c309=_0x8965('0x67');var _0x532fde={'custom':![]};return utilLicense[_0x8965('0x55')]()[_0x8965('0x16')](function(_0x1b2376){if(_0x1b2376){_0x532fde=_0x1b2376;}return db[_0x8965('0x43')]['find']({'where':{'id':_0x157d94[_0x8965('0x4f')]['id']},'attributes':['logo',_0x8965('0x53'),_0x8965('0x57'),_0x8965('0x58'),_0x8965('0x59'),_0x8965('0x5a'),_0x8965('0x6f'),'defaultFavicon'],'raw':!![]});})[_0x8965('0x16')](handleEntityNotFound(_0x57d0da,null))[_0x8965('0x16')](function(_0x30b3bb){if(_0x30b3bb){var _0x413a27=_0x30b3bb[_0x8965('0x58')]&&fs[_0x8965('0x5c')](path[_0x8965('0x62')](config[_0x8965('0x5d')],_0x47c309,_[_0x8965('0x5e')](_0x30b3bb[_0x8965('0x58')])))?path[_0x8965('0x62')](config[_0x8965('0x5d')],_0x47c309,_[_0x8965('0x5e')](_0x30b3bb['favicon'])):path['join'](config[_0x8965('0x5d')],_0x47c309,_['toLower'](_0x8965('0x72')));var _0x3f0de8=_0x8965('0x60')+_[_0x8965('0x64')](_0x8965('0x58'));if(_0x30b3bb[_0x3f0de8]||!_0x532fde['custom']){_0x413a27=path[_0x8965('0x62')](config[_0x8965('0x5d')],_0x47c309,_[_0x8965('0x5e')](_0x8965('0x72')));}if(!fs['existsSync'](_0x413a27)){throw new db[(_0x8965('0x69'))][(_0x8965('0x63'))](_['upperFirst'](_0x8965('0x58'))+_0x8965('0x65'));}return _0x57d0da[_0x8965('0x6a')](_0x413a27);}})['catch'](handleError(_0x57d0da,null));};exports[_0x8965('0x73')]=function(_0x489e86,_0x37b064){var _0x2a336a={'offset':moment()[_0x8965('0x74')]()};_0x2a336a[_0x8965('0x75')]=moment()[_0x8965('0x74')](_0x2a336a[_0x8965('0x24')])[_0x8965('0x76')]('YYYY-MM-DD\x20HH:mm:ss:SSS');return _0x37b064['status'](0xc8)[_0x8965('0x30')](_0x2a336a);}; \ No newline at end of file +var _0xdc0d=['../../config/license/util','../../mysqldb','client','http','request','info','Setting,\x20%s,\x20%s','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','then','end','name','send','index','Setting','rawAttributes','fieldName','type','key','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','show','params','update','body','find','file','filename','logo','loginLogo','preferred','favicon','defaultLogo','defaultFavicon','existsSync','join','root','toLower','default_logo.svg','Sequelize','ValidationError','upperFirst','\x20not\x20found','download','getLogoLogin','defaultLoginLogo','defaultPreferred','default_loginLogo.svg','custom','gdpr','securePassword','addPreferred','getPreferred','getLicense','default','default_preferred.png','addFavicon','default_favicon.ico','getDate','utcOffset','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x2033c6,_0x27015c){var _0x508b4c=function(_0x48445a){while(--_0x48445a){_0x2033c6['push'](_0x2033c6['shift']());}};_0x508b4c(++_0x27015c);}(_0xdc0d,0x1db));var _0xddc0=function(_0x199e57,_0x9396b0){_0x199e57=_0x199e57-0x0;var _0x31ce5f=_0xdc0d[_0x199e57];return _0x31ce5f;};'use strict';var emlformat=require(_0xddc0('0x0'));var rimraf=require(_0xddc0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xddc0('0x2'));var rp=require('request-promise');var moment=require(_0xddc0('0x3'));var BPromise=require(_0xddc0('0x4'));var Mustache=require(_0xddc0('0x5'));var util=require(_0xddc0('0x6'));var path=require(_0xddc0('0x7'));var sox=require(_0xddc0('0x8'));var csv=require(_0xddc0('0x9'));var ejs=require(_0xddc0('0xa'));var fs=require('fs');var fs_extra=require(_0xddc0('0xb'));var _=require('lodash');var squel=require(_0xddc0('0xc'));var crypto=require(_0xddc0('0xd'));var jsforce=require(_0xddc0('0xe'));var deskjs=require(_0xddc0('0xf'));var toCsv=require(_0xddc0('0x9'));var querystring=require(_0xddc0('0x10'));var Papa=require('papaparse');var Redis=require(_0xddc0('0x11'));var authService=require(_0xddc0('0x12'));var qs=require(_0xddc0('0x13'));var as=require(_0xddc0('0x14'));var hardwareService=require(_0xddc0('0x15'));var logger=require(_0xddc0('0x16'))(_0xddc0('0x17'));var utils=require(_0xddc0('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xddc0('0x19'));var db=require(_0xddc0('0x1a'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xddc0('0x1b')][_0xddc0('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0xde1081,_0x39d44c,_0x2faa0d,_0x53fb88){return new BPromise(function(_0xd08dd7,_0x28d771){var _0x523089=_0x53fb88||client;return _0x523089[_0xddc0('0x1d')](_0xde1081,_0x2faa0d)['then'](function(_0x387bb7){logger[_0xddc0('0x1e')](_0xddc0('0x1f'),_0x39d44c,'request\x20sent');logger['debug'](_0xddc0('0x20'),_0x39d44c,_0xddc0('0x21'),JSON[_0xddc0('0x22')](_0x387bb7));if(_0x387bb7[_0xddc0('0x23')]){if(_0x387bb7['error'][_0xddc0('0x24')]===0x1f4){logger[_0xddc0('0x23')](_0xddc0('0x1f'),_0x39d44c,_0x387bb7[_0xddc0('0x23')]['message']);return _0x28d771(_0x387bb7[_0xddc0('0x23')][_0xddc0('0x25')]);}logger[_0xddc0('0x23')]('Setting,\x20%s,\x20%s',_0x39d44c,_0x387bb7[_0xddc0('0x23')]['message']);return _0xd08dd7(_0x387bb7[_0xddc0('0x23')][_0xddc0('0x25')]);}else{logger['info'](_0xddc0('0x1f'),_0x39d44c,_0xddc0('0x21'));_0xd08dd7(_0x387bb7[_0xddc0('0x26')]['message']);}})[_0xddc0('0x27')](function(_0x4d8582){logger[_0xddc0('0x23')]('Setting,\x20%s,\x20%s',_0x39d44c,_0x4d8582);_0x28d771(_0x4d8582);});});}function respondWithStatusCode(_0x1f08f4,_0x4ce667){_0x4ce667=_0x4ce667||0xcc;return function(_0x22d48e){if(_0x22d48e){return _0x1f08f4[_0xddc0('0x28')](_0x4ce667);}return _0x1f08f4[_0xddc0('0x29')](_0x4ce667)['end']();};}function respondWithResult(_0x202964,_0x1211f0){_0x1211f0=_0x1211f0||0xc8;return function(_0x196dd2){if(_0x196dd2){return _0x202964['status'](_0x1211f0)[_0xddc0('0x2a')](_0x196dd2);}};}function respondWithFilteredResult(_0x3b9762,_0x41342e){return function(_0x344a0a){if(_0x344a0a){var _0x129dae=typeof _0x41342e['offset']===_0xddc0('0x2b')&&typeof _0x41342e['limit']==='undefined';var _0x5a8429=_0x344a0a[_0xddc0('0x2c')];var _0x41cef6=_0x129dae?0x0:_0x41342e[_0xddc0('0x2d')];var _0x3ab930=_0x129dae?_0x344a0a[_0xddc0('0x2c')]:_0x41342e[_0xddc0('0x2d')]+_0x41342e[_0xddc0('0x2e')];var _0x3ddda7;if(_0x3ab930>=_0x5a8429){_0x3ab930=_0x5a8429;_0x3ddda7=0xc8;}else{_0x3ddda7=0xce;}_0x3b9762[_0xddc0('0x29')](_0x3ddda7);return _0x3b9762[_0xddc0('0x2f')](_0xddc0('0x30'),_0x41cef6+'-'+_0x3ab930+'/'+_0x5a8429)[_0xddc0('0x2a')](_0x344a0a);}return null;};}function patchUpdates(_0x487055){return function(_0x1e3be8){try{jsonpatch[_0xddc0('0x31')](_0x1e3be8,_0x487055,!![]);}catch(_0x2eb265){return BPromise[_0xddc0('0x32')](_0x2eb265);}return _0x1e3be8[_0xddc0('0x33')]();};}function saveUpdates(_0x459390,_0x3e1eb9){return function(_0x101778){if(_0x101778){return _0x101778['update'](_0x459390)[_0xddc0('0x34')](function(_0x2ab5b0){return _0x2ab5b0;});}return null;};}function removeEntity(_0x3c37a6,_0x401278){return function(_0x162512){if(_0x162512){return _0x162512['destroy']()['then'](function(){_0x3c37a6[_0xddc0('0x29')](0xcc)[_0xddc0('0x35')]();});}};}function handleEntityNotFound(_0x56e1cb,_0xe784e){return function(_0x614f06){if(!_0x614f06){_0x56e1cb['sendStatus'](0x194);}return _0x614f06;};}function handleError(_0x5b983e,_0x4326a6){_0x4326a6=_0x4326a6||0x1f4;return function(_0x134dc8){logger[_0xddc0('0x23')](_0x134dc8['stack']);if(_0x134dc8['name']){delete _0x134dc8[_0xddc0('0x36')];}_0x5b983e[_0xddc0('0x29')](_0x4326a6)[_0xddc0('0x37')](_0x134dc8);};}exports[_0xddc0('0x38')]=function(_0x1dcadc,_0x4e10ab){var _0x44c237={},_0x5d6dfa={},_0x349542={'count':0x0,'rows':[]};var _0x593d35=_['map'](db[_0xddc0('0x39')][_0xddc0('0x3a')],function(_0x1161c7){return{'name':_0x1161c7[_0xddc0('0x3b')],'type':_0x1161c7[_0xddc0('0x3c')][_0xddc0('0x3d')]};});_0x5d6dfa['model']=_['map'](_0x593d35,_0xddc0('0x36'));_0x5d6dfa[_0xddc0('0x3e')]=_[_0xddc0('0x3f')](_0x1dcadc['query']);_0x5d6dfa['filters']=_['intersection'](_0x5d6dfa[_0xddc0('0x40')],_0x5d6dfa['query']);_0x44c237[_0xddc0('0x41')]=_[_0xddc0('0x42')](_0x5d6dfa[_0xddc0('0x40')],qs['fields'](_0x1dcadc[_0xddc0('0x3e')][_0xddc0('0x43')]));_0x44c237[_0xddc0('0x41')]=_0x44c237[_0xddc0('0x41')][_0xddc0('0x44')]?_0x44c237['attributes']:_0x5d6dfa[_0xddc0('0x40')];if(!_0x1dcadc[_0xddc0('0x3e')][_0xddc0('0x45')](_0xddc0('0x46'))){_0x44c237['limit']=qs['limit'](_0x1dcadc[_0xddc0('0x3e')][_0xddc0('0x2e')]);_0x44c237[_0xddc0('0x2d')]=qs[_0xddc0('0x2d')](_0x1dcadc[_0xddc0('0x3e')]['offset']);}_0x44c237[_0xddc0('0x47')]=qs[_0xddc0('0x48')](_0x1dcadc[_0xddc0('0x3e')][_0xddc0('0x48')]);_0x44c237[_0xddc0('0x49')]=qs['filters'](_[_0xddc0('0x4a')](_0x1dcadc['query'],_0x5d6dfa[_0xddc0('0x4b')]),_0x593d35);if(_0x1dcadc[_0xddc0('0x3e')][_0xddc0('0x4c')]){_0x44c237[_0xddc0('0x49')]=_[_0xddc0('0x4d')](_0x44c237['where'],{'$or':_[_0xddc0('0x4e')](_0x593d35,function(_0x1d3122){if(_0x1d3122['type']!==_0xddc0('0x4f')){var _0xbd5833={};_0xbd5833[_0x1d3122[_0xddc0('0x36')]]={'$like':'%'+_0x1dcadc[_0xddc0('0x3e')][_0xddc0('0x4c')]+'%'};return _0xbd5833;}})});}_0x44c237=_['merge']({},_0x44c237,_0x1dcadc[_0xddc0('0x50')]);var _0x5cd760={'where':_0x44c237[_0xddc0('0x49')]};return db['Setting'][_0xddc0('0x2c')](_0x5cd760)[_0xddc0('0x34')](function(_0x477e10){_0x349542['count']=_0x477e10;if(_0x1dcadc[_0xddc0('0x3e')][_0xddc0('0x51')]){_0x44c237[_0xddc0('0x52')]=[{'all':!![]}];}return db['Setting'][_0xddc0('0x53')](_0x44c237);})[_0xddc0('0x34')](function(_0x17cd54){_0x349542[_0xddc0('0x54')]=_0x17cd54;return _0x349542;})[_0xddc0('0x34')](respondWithFilteredResult(_0x4e10ab,_0x44c237))[_0xddc0('0x27')](handleError(_0x4e10ab,null));};exports[_0xddc0('0x55')]=function(_0x356eeb,_0x584122){var _0x41e2ca={'raw':![],'where':{'id':_0x356eeb[_0xddc0('0x56')]['id']}},_0x2072b9={};_0x2072b9[_0xddc0('0x40')]=_[_0xddc0('0x3f')](db[_0xddc0('0x39')][_0xddc0('0x3a')]);_0x2072b9[_0xddc0('0x3e')]=_[_0xddc0('0x3f')](_0x356eeb[_0xddc0('0x3e')]);_0x2072b9[_0xddc0('0x4b')]=_['intersection'](_0x2072b9[_0xddc0('0x40')],_0x2072b9[_0xddc0('0x3e')]);_0x41e2ca[_0xddc0('0x41')]=_[_0xddc0('0x42')](_0x2072b9['model'],qs[_0xddc0('0x43')](_0x356eeb[_0xddc0('0x3e')][_0xddc0('0x43')]));_0x41e2ca['attributes']=_0x41e2ca[_0xddc0('0x41')][_0xddc0('0x44')]?_0x41e2ca['attributes']:_0x2072b9[_0xddc0('0x40')];if(_0x356eeb[_0xddc0('0x3e')][_0xddc0('0x51')]){_0x41e2ca[_0xddc0('0x52')]=[{'all':!![]}];}_0x41e2ca=_[_0xddc0('0x4d')]({},_0x41e2ca,_0x356eeb[_0xddc0('0x50')]);return db[_0xddc0('0x39')]['find'](_0x41e2ca)[_0xddc0('0x34')](handleEntityNotFound(_0x584122,null))['then'](respondWithResult(_0x584122,null))['catch'](handleError(_0x584122,null));};exports[_0xddc0('0x57')]=function(_0x52a267,_0x9ad54c){if(_0x52a267[_0xddc0('0x58')]['id']){delete _0x52a267[_0xddc0('0x58')]['id'];}return db[_0xddc0('0x39')][_0xddc0('0x59')]({'where':{'id':_0x52a267[_0xddc0('0x56')]['id']}})[_0xddc0('0x34')](handleEntityNotFound(_0x9ad54c,null))[_0xddc0('0x34')](saveUpdates(_0x52a267[_0xddc0('0x58')],null))[_0xddc0('0x34')](respondWithResult(_0x9ad54c,null))[_0xddc0('0x27')](handleError(_0x9ad54c,null));};exports['addLogo']=function(_0x168aec,_0x509cd0,_0x552bb2){if(_0x168aec[_0xddc0('0x5a')]&&_0x168aec['file'][_0xddc0('0x5b')]){_0x168aec['body'][_0xddc0('0x5c')]=_0x168aec['file']['filename'];}return db[_0xddc0('0x39')][_0xddc0('0x59')]({'where':{'id':_0x168aec['params']['id']}})[_0xddc0('0x34')](handleEntityNotFound(_0x509cd0,null))[_0xddc0('0x34')](saveUpdates(_0x168aec[_0xddc0('0x58')],null))[_0xddc0('0x34')](respondWithResult(_0x509cd0,null))['catch'](handleError(_0x509cd0,null));};exports['addLogoLogin']=function(_0x59160f,_0x2647fa,_0xf2fa30){if(_0x59160f[_0xddc0('0x5a')]&&_0x59160f['file']['filename']){_0x59160f['body'][_0xddc0('0x5d')]=_0x59160f[_0xddc0('0x5a')][_0xddc0('0x5b')];}return db['Setting'][_0xddc0('0x59')]({'where':{'id':_0x59160f[_0xddc0('0x56')]['id']}})[_0xddc0('0x34')](handleEntityNotFound(_0x2647fa,null))[_0xddc0('0x34')](saveUpdates(_0x59160f['body'],null))[_0xddc0('0x34')](respondWithResult(_0x2647fa,null))['catch'](handleError(_0x2647fa,null));};var utilLicense=require(_0xddc0('0x19'));exports['getLogo']=function(_0xda8a6f,_0x5cad0a,_0x56f6c9){var _0x52e089='server/files/images/logos';var _0x2585a6={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x304c9b){if(_0x304c9b){_0x2585a6=_0x304c9b;}return db[_0xddc0('0x39')][_0xddc0('0x59')]({'where':{'id':_0xda8a6f[_0xddc0('0x56')]['id']},'attributes':[_0xddc0('0x5c'),_0xddc0('0x5d'),_0xddc0('0x5e'),_0xddc0('0x5f'),_0xddc0('0x60'),'defaultLoginLogo','defaultPreferred',_0xddc0('0x61')],'raw':!![]});})['then'](handleEntityNotFound(_0x5cad0a,null))[_0xddc0('0x34')](function(_0x47d4ec){if(_0x47d4ec){var _0x5dd5e2=_0x47d4ec[_0xddc0('0x5c')]&&fs[_0xddc0('0x62')](path[_0xddc0('0x63')](config[_0xddc0('0x64')],_0x52e089,_[_0xddc0('0x65')](_0x47d4ec['logo'])))?path[_0xddc0('0x63')](config[_0xddc0('0x64')],_0x52e089,_['toLower'](_0x47d4ec[_0xddc0('0x5c')])):path[_0xddc0('0x63')](config[_0xddc0('0x64')],_0x52e089,_[_0xddc0('0x65')](_0xddc0('0x66')));var _0x5b9034='default'+_['upperFirst'](_0xddc0('0x5c'));if(_0x47d4ec[_0x5b9034]||!_0x2585a6['custom']){_0x5dd5e2=path[_0xddc0('0x63')](config[_0xddc0('0x64')],_0x52e089,_['toLower'](_0xddc0('0x66')));}if(!fs['existsSync'](_0x5dd5e2)){throw new db[(_0xddc0('0x67'))][(_0xddc0('0x68'))](_[_0xddc0('0x69')](_0xddc0('0x5c'))+_0xddc0('0x6a'));}return _0x5cad0a[_0xddc0('0x6b')](_0x5dd5e2);}})[_0xddc0('0x27')](handleError(_0x5cad0a,null));};var utilLicense=require(_0xddc0('0x19'));exports[_0xddc0('0x6c')]=function(_0x535bc4,_0x7a3981,_0x362c36){var _0x5ee385='server/files/images/logos';var _0xb00109={'custom':![]};return utilLicense['getLicense']()[_0xddc0('0x34')](function(_0x3a3f6e){if(_0x3a3f6e){_0xb00109=_0x3a3f6e;}return db[_0xddc0('0x39')][_0xddc0('0x59')]({'where':{'id':_0x535bc4[_0xddc0('0x56')]['id']},'attributes':[_0xddc0('0x5c'),_0xddc0('0x5d'),_0xddc0('0x5e'),_0xddc0('0x5f'),_0xddc0('0x60'),_0xddc0('0x6d'),_0xddc0('0x6e'),_0xddc0('0x61')],'raw':!![]});})['then'](handleEntityNotFound(_0x7a3981,null))['then'](function(_0xb520d){if(_0xb520d){var _0x36383f=_0xb520d[_0xddc0('0x5d')]&&fs['existsSync'](path[_0xddc0('0x63')](config['root'],_0x5ee385,_[_0xddc0('0x65')](_0xb520d['loginLogo'])))?path[_0xddc0('0x63')](config[_0xddc0('0x64')],_0x5ee385,_[_0xddc0('0x65')](_0xb520d[_0xddc0('0x5d')])):path[_0xddc0('0x63')](config[_0xddc0('0x64')],_0x5ee385,_['toLower'](_0xddc0('0x6f')));var _0x375303='default'+_['upperFirst'](_0xddc0('0x5d'));if(_0xb520d[_0x375303]||!_0xb00109[_0xddc0('0x70')]){_0x36383f=path[_0xddc0('0x63')](config[_0xddc0('0x64')],_0x5ee385,_['toLower'](_0xddc0('0x6f')));}if(!fs[_0xddc0('0x62')](_0x36383f)){throw new db[(_0xddc0('0x67'))][(_0xddc0('0x68'))](_[_0xddc0('0x69')](_0xddc0('0x5d'))+_0xddc0('0x6a'));}return _0x7a3981[_0xddc0('0x6b')](_0x36383f);}})[_0xddc0('0x27')](handleError(_0x7a3981,null));};exports[_0xddc0('0x71')]=function(_0x1c9850,_0x38d370){return db[_0xddc0('0x39')][_0xddc0('0x59')]({'where':{'id':_0x1c9850[_0xddc0('0x56')]['id']},'attributes':[_0xddc0('0x72')]})['then'](respondWithResult(_0x38d370,null))['catch'](handleError(_0x38d370,null));};exports[_0xddc0('0x73')]=function(_0x3af6b7,_0x74e9b0,_0x38a572){if(_0x3af6b7['file']&&_0x3af6b7[_0xddc0('0x5a')][_0xddc0('0x5b')]){_0x3af6b7['body']['preferred']=_0x3af6b7[_0xddc0('0x5a')]['filename'];}return db['Setting'][_0xddc0('0x59')]({'where':{'id':_0x3af6b7[_0xddc0('0x56')]['id']}})['then'](handleEntityNotFound(_0x74e9b0,null))['then'](saveUpdates(_0x3af6b7[_0xddc0('0x58')],null))[_0xddc0('0x34')](respondWithResult(_0x74e9b0,null))[_0xddc0('0x27')](handleError(_0x74e9b0,null));};var utilLicense=require('../../config/license/util');exports[_0xddc0('0x74')]=function(_0x27dd93,_0x22c8fa,_0x1605f6){var _0x45dcdf='server/files/images/logos';var _0x23d17d={'custom':![]};return utilLicense[_0xddc0('0x75')]()[_0xddc0('0x34')](function(_0x597194){if(_0x597194){_0x23d17d=_0x597194;}return db[_0xddc0('0x39')][_0xddc0('0x59')]({'where':{'id':_0x27dd93[_0xddc0('0x56')]['id']},'attributes':[_0xddc0('0x5c'),_0xddc0('0x5d'),_0xddc0('0x5e'),'favicon',_0xddc0('0x60'),_0xddc0('0x6d'),_0xddc0('0x6e'),_0xddc0('0x61')],'raw':!![]});})['then'](handleEntityNotFound(_0x22c8fa,null))[_0xddc0('0x34')](function(_0x6fc0a2){if(_0x6fc0a2){var _0x6c3309=_0x6fc0a2[_0xddc0('0x5e')]&&fs[_0xddc0('0x62')](path[_0xddc0('0x63')](config[_0xddc0('0x64')],_0x45dcdf,_['toLower'](_0x6fc0a2['preferred'])))?path[_0xddc0('0x63')](config[_0xddc0('0x64')],_0x45dcdf,_[_0xddc0('0x65')](_0x6fc0a2[_0xddc0('0x5e')])):path[_0xddc0('0x63')](config[_0xddc0('0x64')],_0x45dcdf,_['toLower']('default_preferred.png'));var _0x411088=_0xddc0('0x76')+_['upperFirst'](_0xddc0('0x5e'));if(_0x6fc0a2[_0x411088]||!_0x23d17d['custom']||!_0x23d17d[_0xddc0('0x5e')]){_0x6c3309=path[_0xddc0('0x63')](config[_0xddc0('0x64')],_0x45dcdf,_[_0xddc0('0x65')](_0xddc0('0x77')));}if(!fs[_0xddc0('0x62')](_0x6c3309)){throw new db[(_0xddc0('0x67'))][(_0xddc0('0x68'))](_['upperFirst'](_0xddc0('0x5e'))+'\x20not\x20found');}return _0x22c8fa['download'](_0x6c3309);}})[_0xddc0('0x27')](handleError(_0x22c8fa,null));};exports[_0xddc0('0x78')]=function(_0x10cf19,_0x1a68af,_0x2356f2){if(_0x10cf19[_0xddc0('0x5a')]&&_0x10cf19[_0xddc0('0x5a')][_0xddc0('0x5b')]){_0x10cf19[_0xddc0('0x58')][_0xddc0('0x5f')]=_0x10cf19[_0xddc0('0x5a')][_0xddc0('0x5b')];}return db['Setting'][_0xddc0('0x59')]({'where':{'id':_0x10cf19['params']['id']}})['then'](handleEntityNotFound(_0x1a68af,null))[_0xddc0('0x34')](saveUpdates(_0x10cf19[_0xddc0('0x58')],null))['then'](respondWithResult(_0x1a68af,null))['catch'](handleError(_0x1a68af,null));};var utilLicense=require(_0xddc0('0x19'));exports['getFavicon']=function(_0x2aa946,_0x316b25,_0x145d1e){var _0x1a61ed='server/files/images/logos';var _0x23e1d1={'custom':![]};return utilLicense[_0xddc0('0x75')]()[_0xddc0('0x34')](function(_0x371426){if(_0x371426){_0x23e1d1=_0x371426;}return db['Setting'][_0xddc0('0x59')]({'where':{'id':_0x2aa946[_0xddc0('0x56')]['id']},'attributes':[_0xddc0('0x5c'),_0xddc0('0x5d'),_0xddc0('0x5e'),'favicon',_0xddc0('0x60'),_0xddc0('0x6d'),'defaultPreferred',_0xddc0('0x61')],'raw':!![]});})[_0xddc0('0x34')](handleEntityNotFound(_0x316b25,null))[_0xddc0('0x34')](function(_0xfc7870){if(_0xfc7870){var _0x4c8a87=_0xfc7870[_0xddc0('0x5f')]&&fs[_0xddc0('0x62')](path['join'](config['root'],_0x1a61ed,_['toLower'](_0xfc7870[_0xddc0('0x5f')])))?path[_0xddc0('0x63')](config[_0xddc0('0x64')],_0x1a61ed,_['toLower'](_0xfc7870[_0xddc0('0x5f')])):path[_0xddc0('0x63')](config[_0xddc0('0x64')],_0x1a61ed,_[_0xddc0('0x65')](_0xddc0('0x79')));var _0x304f7a='default'+_[_0xddc0('0x69')](_0xddc0('0x5f'));if(_0xfc7870[_0x304f7a]||!_0x23e1d1[_0xddc0('0x70')]){_0x4c8a87=path['join'](config['root'],_0x1a61ed,_[_0xddc0('0x65')]('default_favicon.ico'));}if(!fs[_0xddc0('0x62')](_0x4c8a87)){throw new db[(_0xddc0('0x67'))][(_0xddc0('0x68'))](_[_0xddc0('0x69')](_0xddc0('0x5f'))+'\x20not\x20found');}return _0x316b25['download'](_0x4c8a87);}})['catch'](handleError(_0x316b25,null));};exports[_0xddc0('0x7a')]=function(_0x1e0ac4,_0x25724d){var _0x250649={'offset':moment()['utcOffset']()};_0x250649['now']=moment()[_0xddc0('0x7b')](_0x250649[_0xddc0('0x2d')])['format'](_0xddc0('0x7c'));return _0x25724d['status'](0xc8)[_0xddc0('0x37')](_0x250649);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index df11d76..96a46e5 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(_0x86bb6f,_0x599672){var _0x40749b=function(_0x3edb99){while(--_0x3edb99){_0x86bb6f['push'](_0x86bb6f['shift']());}};_0x40749b(++_0x599672);}(_0xedd9,0xfc));var _0x9edd=function(_0x45b7eb,_0x1a4535){_0x45b7eb=_0x45b7eb-0x0;var _0x33678b=_0xedd9[_0x45b7eb];return _0x33678b;};'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(_0x54c695,_0x5d6677){var _0x3ce06b=function(_0x55bdf1){while(--_0x55bdf1){_0x54c695['push'](_0x54c695['shift']());}};_0x3ce06b(++_0x5d6677);}(_0x7217,0x19e));var _0x7721=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0x7217[_0x4fc9e6];return _0x551d28;};'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 eaa49de..9b421da 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 _0x5f51=['attributes','map','include','model','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/environment','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','ShowSetting','Setting','find','options','where'];(function(_0x5c194a,_0x43c97a){var _0x42f34e=function(_0x1458e2){while(--_0x1458e2){_0x5c194a['push'](_0x5c194a['shift']());}};_0x42f34e(++_0x43c97a);}(_0x5f51,0xb9));var _0x15f5=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x5f51[_0x2b4411];return _0x8e41ef;};'use strict';var _=require(_0x15f5('0x0'));var util=require(_0x15f5('0x1'));var moment=require(_0x15f5('0x2'));var BPromise=require(_0x15f5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x15f5('0x4'));var db=require(_0x15f5('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x15f5('0x6'));var jayson=require(_0x15f5('0x7'));var client=jayson[_0x15f5('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x51ce64,_0x44a808,_0x41284d){return new BPromise(function(_0x559c51,_0x38ee7d){return client[_0x15f5('0x9')](_0x51ce64,_0x41284d)[_0x15f5('0xa')](function(_0x3f6941){logger[_0x15f5('0xb')](_0x15f5('0xc'),_0x44a808,_0x15f5('0xd'));logger[_0x15f5('0xe')](_0x15f5('0xf'),_0x44a808,'request\x20sent',JSON[_0x15f5('0x10')](_0x3f6941));if(_0x3f6941[_0x15f5('0x11')]){if(_0x3f6941[_0x15f5('0x11')][_0x15f5('0x12')]===0x1f4){logger[_0x15f5('0x11')](_0x15f5('0xc'),_0x44a808,_0x3f6941[_0x15f5('0x11')][_0x15f5('0x13')]);return _0x38ee7d(_0x3f6941[_0x15f5('0x11')][_0x15f5('0x13')]);}logger[_0x15f5('0x11')](_0x15f5('0xc'),_0x44a808,_0x3f6941['error'][_0x15f5('0x13')]);return _0x559c51(_0x3f6941[_0x15f5('0x11')][_0x15f5('0x13')]);}else{logger[_0x15f5('0xb')](_0x15f5('0xc'),_0x44a808,_0x15f5('0xd'));_0x559c51(_0x3f6941['result'][_0x15f5('0x13')]);}})['catch'](function(_0x58fb1d){logger[_0x15f5('0x11')]('Setting,\x20%s,\x20%s',_0x44a808,_0x58fb1d);_0x38ee7d(_0x58fb1d);});});}exports[_0x15f5('0x14')]=function(_0x5d62af){var _0x140630=this;return new Promise(function(_0x132bd8,_0x4c1870){return db[_0x15f5('0x15')][_0x15f5('0x16')]({'raw':_0x5d62af['options']?_0x5d62af[_0x15f5('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x5d62af['options']?_0x5d62af[_0x15f5('0x17')][_0x15f5('0x18')]||null:null,'attributes':_0x5d62af[_0x15f5('0x17')]?_0x5d62af[_0x15f5('0x17')][_0x15f5('0x19')]||null:null,'include':_0x5d62af['options']?_0x5d62af[_0x15f5('0x17')]['include']?_[_0x15f5('0x1a')](_0x5d62af[_0x15f5('0x17')][_0x15f5('0x1b')],function(_0x2b7f84){return{'model':db[_0x2b7f84[_0x15f5('0x1c')]],'as':_0x2b7f84['as'],'attributes':_0x2b7f84[_0x15f5('0x19')],'include':_0x2b7f84[_0x15f5('0x1b')]?_['map'](_0x2b7f84[_0x15f5('0x1b')],function(_0x8b38c0){return{'model':db[_0x8b38c0[_0x15f5('0x1c')]],'as':_0x8b38c0['as'],'attributes':_0x8b38c0[_0x15f5('0x19')],'include':_0x8b38c0['include']?_[_0x15f5('0x1a')](_0x8b38c0['include'],function(_0x17d60d){return{'model':db[_0x17d60d[_0x15f5('0x1c')]],'as':_0x17d60d['as'],'attributes':_0x17d60d[_0x15f5('0x19')]};}):[]};}):[]};}):[]:[]})[_0x15f5('0xa')](function(_0x197cb1){logger[_0x15f5('0xb')]('ShowSetting',_0x5d62af);logger[_0x15f5('0xe')](_0x15f5('0x14'),_0x5d62af,JSON[_0x15f5('0x10')](_0x197cb1));_0x132bd8(_0x197cb1);})[_0x15f5('0x1d')](function(_0x2260f7){logger['error'](_0x15f5('0x14'),_0x2260f7[_0x15f5('0x13')],_0x5d62af);_0x4c1870(_0x140630[_0x15f5('0x11')](0x1f4,_0x2260f7[_0x15f5('0x13')]));});});}; \ No newline at end of file +var _0x88d8=['rpc','client','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSetting','Setting','find','options','attributes','include','model','map','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0x88d8,0xbd));var _0x888d=function(_0x2ee6d9,_0x196d2a){_0x2ee6d9=_0x2ee6d9-0x0;var _0x2745d7=_0x88d8[_0x2ee6d9];return _0x2745d7;};'use strict';var _=require(_0x888d('0x0'));var util=require(_0x888d('0x1'));var moment=require(_0x888d('0x2'));var BPromise=require(_0x888d('0x3'));var rs=require(_0x888d('0x4'));var fs=require('fs');var Redis=require(_0x888d('0x5'));var db=require(_0x888d('0x6'))['db'];var utils=require(_0x888d('0x7'));var logger=require(_0x888d('0x8'))(_0x888d('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x888d('0xa')][_0x888d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3682e8,_0x20d3ff,_0x245d90){return new BPromise(function(_0x541b0d,_0x4d61d6){return client[_0x888d('0xc')](_0x3682e8,_0x245d90)[_0x888d('0xd')](function(_0x46474d){logger[_0x888d('0xe')](_0x888d('0xf'),_0x20d3ff,_0x888d('0x10'));logger[_0x888d('0x11')](_0x888d('0x12'),_0x20d3ff,_0x888d('0x10'),JSON[_0x888d('0x13')](_0x46474d));if(_0x46474d[_0x888d('0x14')]){if(_0x46474d[_0x888d('0x14')][_0x888d('0x15')]===0x1f4){logger['error'](_0x888d('0xf'),_0x20d3ff,_0x46474d['error'][_0x888d('0x16')]);return _0x4d61d6(_0x46474d[_0x888d('0x14')][_0x888d('0x16')]);}logger['error'](_0x888d('0xf'),_0x20d3ff,_0x46474d[_0x888d('0x14')][_0x888d('0x16')]);return _0x541b0d(_0x46474d[_0x888d('0x14')][_0x888d('0x16')]);}else{logger[_0x888d('0xe')](_0x888d('0xf'),_0x20d3ff,'request\x20sent');_0x541b0d(_0x46474d[_0x888d('0x17')][_0x888d('0x16')]);}})[_0x888d('0x18')](function(_0x4c8cd6){logger[_0x888d('0x14')](_0x888d('0xf'),_0x20d3ff,_0x4c8cd6);_0x4d61d6(_0x4c8cd6);});});}exports[_0x888d('0x19')]=function(_0x29a550){var _0x134165=this;return new Promise(function(_0x3ac0f9,_0x2f8839){return db[_0x888d('0x1a')][_0x888d('0x1b')]({'raw':_0x29a550[_0x888d('0x1c')]?_0x29a550[_0x888d('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x29a550['options']?_0x29a550[_0x888d('0x1c')]['where']||null:null,'attributes':_0x29a550[_0x888d('0x1c')]?_0x29a550[_0x888d('0x1c')][_0x888d('0x1d')]||null:null,'include':_0x29a550['options']?_0x29a550['options'][_0x888d('0x1e')]?_['map'](_0x29a550[_0x888d('0x1c')][_0x888d('0x1e')],function(_0x4ebdee){return{'model':db[_0x4ebdee[_0x888d('0x1f')]],'as':_0x4ebdee['as'],'attributes':_0x4ebdee[_0x888d('0x1d')],'include':_0x4ebdee[_0x888d('0x1e')]?_[_0x888d('0x20')](_0x4ebdee[_0x888d('0x1e')],function(_0x32c7ca){return{'model':db[_0x32c7ca['model']],'as':_0x32c7ca['as'],'attributes':_0x32c7ca[_0x888d('0x1d')],'include':_0x32c7ca['include']?_['map'](_0x32c7ca[_0x888d('0x1e')],function(_0x3e4b58){return{'model':db[_0x3e4b58[_0x888d('0x1f')]],'as':_0x3e4b58['as'],'attributes':_0x3e4b58['attributes']};}):[]};}):[]};}):[]:[]})[_0x888d('0xd')](function(_0x481350){logger[_0x888d('0xe')]('ShowSetting',_0x29a550);logger['debug']('ShowSetting',_0x29a550,JSON['stringify'](_0x481350));_0x3ac0f9(_0x481350);})[_0x888d('0x18')](function(_0x2aa8aa){logger[_0x888d('0x14')](_0x888d('0x19'),_0x2aa8aa[_0x888d('0x16')],_0x29a550);_0x2f8839(_0x134165[_0x888d('0x14')](0x1f4,_0x2aa8aa[_0x888d('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index f7bf89d..670dfa7 100644 --- a/server/api/smsAccount/index.js +++ b/server/api/smsAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['getInteractions','statusGet','/:id/users','getAgents','post','create','addDisposition','/:id/canned_answers','addAnswer','addApplications','/:id/status','status','addAgents','/:id','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsAccount.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications','/:id/interactions'];(function(_0x5e5218,_0x4226ef){var _0x2dcd35=function(_0x11049f){while(--_0x11049f){_0x5e5218['push'](_0x5e5218['shift']());}};_0x2dcd35(++_0x4226ef);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/canned_answers',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x9')](_0x7995('0x14'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router['get']('/:id/status',controller[_0x7995('0x16')]);router[_0x7995('0x9')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x18')]);router[_0x7995('0x19')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x1a')]);router['post'](_0x7995('0xf'),auth['isAuthenticated'](),controller[_0x7995('0x1b')]);router[_0x7995('0x19')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x1d')]);router[_0x7995('0x19')]('/:id/notify',controller['notify']);router[_0x7995('0x19')]('/:id/applications',auth['isAuthenticated'](),controller[_0x7995('0x1e')]);router[_0x7995('0x19')]('/:id/send',auth[_0x7995('0xa')](),controller['send']);router['post'](_0x7995('0x1f'),controller[_0x7995('0x20')]);router[_0x7995('0x19')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x21')]);router['put'](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x23')]);router[_0x7995('0x24')](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x25')]);router[_0x7995('0x24')]('/:id/dispositions',auth[_0x7995('0xa')](),controller[_0x7995('0x26')]);router[_0x7995('0x24')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x27')]);router['delete'](_0x7995('0x17'),auth['isAuthenticated'](),controller[_0x7995('0x28')]);module[_0x7995('0x29')]=router; \ No newline at end of file +var _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(_0x9a3c82,_0x39b592){var _0x52a746=function(_0x493ed5){while(--_0x493ed5){_0x9a3c82['push'](_0x9a3c82['shift']());}};_0x52a746(++_0x39b592);}(_0x7a54,0x106));var _0x47a5=function(_0x5f9710,_0x5def89){_0x5f9710=_0x5f9710-0x0;var _0x159593=_0x7a54[_0x5f9710];return _0x159593;};'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 2731534..66130e9 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 _0xe02f=['randomstring','exports','name','STRING','generate','ENUM','twilio','skebby','connectel','clicksend','plivo','bandwidth','csc','infobip','intelepeer','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId'];(function(_0x2cb08e,_0x48f58a){var _0x3b5f48=function(_0x41c7bf){while(--_0x41c7bf){_0x2cb08e['push'](_0x2cb08e['shift']());}};_0x3b5f48(++_0x48f58a);}(_0xe02f,0xdc));var _0xfe02=function(_0x5cb05f,_0x1e1259){_0x5cb05f=_0x5cb05f-0x0;var _0x487edc=_0xe02f[_0x5cb05f];return _0x487edc;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xfe02('0x0'));module[_0xfe02('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xfe02('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0xfe02('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0xfe02('0x3')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xfe02('0x4')]();}},'phone':{'type':Sequelize[_0xfe02('0x3')]},'type':{'type':Sequelize[_0xfe02('0x5')](_0xfe02('0x6'),_0xfe02('0x7'),_0xfe02('0x8'),_0xfe02('0x9'),_0xfe02('0xa'),'clickatell',_0xfe02('0xb'),_0xfe02('0xc'),_0xfe02('0xd'),_0xfe02('0xe'))},'accountSid':{'type':Sequelize[_0xfe02('0x3')]},'authId':{'type':Sequelize[_0xfe02('0x3')]},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize[_0xfe02('0x3')]},'password':{'type':Sequelize[_0xfe02('0x3')]},'apiKey':{'type':Sequelize[_0xfe02('0x3')]},'applicationId':{'type':Sequelize[_0xfe02('0x3')]},'accountId':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize[_0xfe02('0x3')]},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0xfe02('0x3')]},'notificationTemplate':{'type':Sequelize[_0xfe02('0xf')],'defaultValue':function(){return _0xfe02('0x10');}},'notificationSound':{'type':Sequelize[_0xfe02('0x11')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xfe02('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xfe02('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xfe02('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xfe02('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xfe02('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xfe02('0x12')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xfe02('0x13'),'set':function(_0x110718){if(!_0x110718)this[_0xfe02('0x14')](_0xfe02('0x15'),null);this['setDataValue']('mandatoryDisposition',_0x110718);}}}; \ No newline at end of file +var _0x34b5=['BOOLEAN','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','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','generate','ENUM','twilio','skebby','connectel','clicksend','plivo','clickatell','bandwidth','csc'];(function(_0x218984,_0x38651e){var _0x3498ee=function(_0x266da5){while(--_0x266da5){_0x218984['push'](_0x218984['shift']());}};_0x3498ee(++_0x38651e);}(_0x34b5,0x1d5));var _0x534b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x34b5[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x534b('0x0'));var rs=require(_0x534b('0x1'));module[_0x534b('0x2')]={'name':{'type':Sequelize[_0x534b('0x3')],'unique':_0x534b('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x534b('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x534b('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x534b('0x3')],'defaultValue':function(){return rs[_0x534b('0x5')]();}},'phone':{'type':Sequelize[_0x534b('0x3')]},'type':{'type':Sequelize[_0x534b('0x6')](_0x534b('0x7'),_0x534b('0x8'),_0x534b('0x9'),_0x534b('0xa'),_0x534b('0xb'),_0x534b('0xc'),_0x534b('0xd'),_0x534b('0xe'),'infobip','intelepeer')},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize[_0x534b('0x3')]},'authToken':{'type':Sequelize[_0x534b('0x3')]},'smsMethod':{'type':Sequelize[_0x534b('0x6')]('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x534b('0x3')]},'apiKey':{'type':Sequelize[_0x534b('0x3')]},'applicationId':{'type':Sequelize[_0x534b('0x3')]},'accountId':{'type':Sequelize[_0x534b('0x3')]},'senderString':{'type':Sequelize[_0x534b('0x3')]},'deliveryReport':{'type':Sequelize[_0x534b('0xf')],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x534b('0x10');}},'notificationSound':{'type':Sequelize[_0x534b('0xf')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x534b('0xf')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x534b('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x534b('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x534b('0xf')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x534b('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x534b('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x534b('0x11')],'comment':_0x534b('0x12')},'mandatoryDisposition':{'type':Sequelize[_0x534b('0xf')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x5cdd84){if(!_0x5cdd84)this[_0x534b('0x13')](_0x534b('0x14'),null);this[_0x534b('0x13')](_0x534b('0x15'),_0x5cdd84);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index aa0fc7a..99afb12 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 _0xa843=['bulkCreate','findAndCountAll','finally','getApplications','getInteractions','CmContact','Contact','Owner','fullname','internal','Tag','Tags','tag','to\x20is\x20mandatory','List','out','Messages','dataValues','received\x20delivery\x20report\x20from','skebby_dispatch_id','requestid','statusInt','status_code','groupName','DELIVERED','intelepeer','redif','inspect','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','DELIVRD','statusGet','state','message-id','addAgents','ids','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','client','http','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','error','message','result','catch','sendStatus','end','json','offset','undefined','limit','count','status','set','apply','reject','save','update','destroy','get','SmsAccounts','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','SmsAccount','fieldName','type','key','query','model','intersection','fields','attributes','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','rawAttributes','length','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','SmsAccountId','getDispositions','findOne','nolimit','Disposition','removeDispositions','CannedAnswer','hasOwnProperty','removeAnswers','notify','sms','SmsApplication','Applications','account','applications','priority','asc','Sequelize','ValidationError','no\x20available\x20attributes','updatedAt','difference','ListId','twilio','Body','messageId','MessageSid','skebby','from','sender','text','connectel','clicksend','message_id','plivo','From','Text','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','replyMessageId','bandwidth','refid','isNil','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','DESC','list','omit','contact','SmsInteraction','spread','interaction','created','autoclose','push','close','unmanaged','SmsMessage','ContactId','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','queueId','waitForTheAssignedQueue','*,*,*,*','Start','startRouting','entity\x20found','debug','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify','Content-Type','text/xml','\x0a','addApplications','sequelize','ISOLATION_LEVELS','READ_COMMITTED'];(function(_0x2cfa89,_0x2d9078){var _0x5c74b0=function(_0x12ebbe){while(--_0x12ebbe){_0x2cfa89['push'](_0x2cfa89['shift']());}};_0x5c74b0(++_0x2d9078);}(_0xa843,0x11e));var _0x3a84=function(_0xe3648d,_0x1f2e24){_0xe3648d=_0xe3648d-0x0;var _0x5ed0c5=_0xa843[_0xe3648d];return _0x5ed0c5;};'use strict';var emlformat=require(_0x3a84('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3a84('0x1'));var jsonpatch=require(_0x3a84('0x2'));var rp=require(_0x3a84('0x3'));var moment=require(_0x3a84('0x4'));var BPromise=require(_0x3a84('0x5'));var Mustache=require('mustache');var util=require(_0x3a84('0x6'));var path=require(_0x3a84('0x7'));var sox=require('sox');var csv=require(_0x3a84('0x8'));var ejs=require(_0x3a84('0x9'));var fs=require('fs');var fs_extra=require(_0x3a84('0xa'));var _=require(_0x3a84('0xb'));var squel=require(_0x3a84('0xc'));var crypto=require(_0x3a84('0xd'));var jsforce=require(_0x3a84('0xe'));var deskjs=require(_0x3a84('0xf'));var toCsv=require('to-csv');var querystring=require(_0x3a84('0x10'));var Papa=require(_0x3a84('0x11'));var Redis=require(_0x3a84('0x12'));var authService=require(_0x3a84('0x13'));var qs=require(_0x3a84('0x14'));var as=require(_0x3a84('0x15'));var hardwareService=require(_0x3a84('0x16'));var logger=require(_0x3a84('0x17'))(_0x3a84('0x18'));var utils=require(_0x3a84('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x3a84('0x1a'));var db=require(_0x3a84('0x1b'))['db'];config[_0x3a84('0x1c')]=_[_0x3a84('0x1d')](config[_0x3a84('0x1c')],{'host':_0x3a84('0x1e'),'port':0x18eb});var socket=require(_0x3a84('0x1f'))(new Redis(config[_0x3a84('0x1c')]));require(_0x3a84('0x20'))[_0x3a84('0x21')](socket);var jayson=require('jayson/promise');var client=jayson[_0x3a84('0x22')][_0x3a84('0x23')]({'port':0x232c});function respondWithRpcPromise(_0x401848,_0x1b031b,_0x87c526,_0x15b81b){return new BPromise(function(_0x30c304,_0x1810a6){var _0xcaab74=_0x15b81b||client;return _0xcaab74['request'](_0x401848,_0x87c526)[_0x3a84('0x24')](function(_0x1950d0){logger[_0x3a84('0x25')](_0x3a84('0x26'),_0x1b031b,_0x3a84('0x27'));logger['debug'](_0x3a84('0x28'),_0x1b031b,_0x3a84('0x27'),JSON['stringify'](_0x1950d0));if(_0x1950d0[_0x3a84('0x29')]){if(_0x1950d0[_0x3a84('0x29')]['code']===0x1f4){logger[_0x3a84('0x29')](_0x3a84('0x26'),_0x1b031b,_0x1950d0['error'][_0x3a84('0x2a')]);return _0x1810a6(_0x1950d0[_0x3a84('0x29')][_0x3a84('0x2a')]);}logger[_0x3a84('0x29')](_0x3a84('0x26'),_0x1b031b,_0x1950d0[_0x3a84('0x29')]['message']);return _0x30c304(_0x1950d0[_0x3a84('0x29')][_0x3a84('0x2a')]);}else{logger[_0x3a84('0x25')](_0x3a84('0x26'),_0x1b031b,_0x3a84('0x27'));_0x30c304(_0x1950d0[_0x3a84('0x2b')][_0x3a84('0x2a')]);}})[_0x3a84('0x2c')](function(_0x29bbb4){logger[_0x3a84('0x29')]('SmsAccount,\x20%s,\x20%s',_0x1b031b,_0x29bbb4);_0x1810a6(_0x29bbb4);});});}function respondWithStatusCode(_0x136180,_0x208e0a){_0x208e0a=_0x208e0a||0xcc;return function(_0x47a000){if(_0x47a000){return _0x136180[_0x3a84('0x2d')](_0x208e0a);}return _0x136180['status'](_0x208e0a)[_0x3a84('0x2e')]();};}function respondWithResult(_0x5a47a5,_0x28dab2){_0x28dab2=_0x28dab2||0xc8;return function(_0x269de2){if(_0x269de2){return _0x5a47a5['status'](_0x28dab2)[_0x3a84('0x2f')](_0x269de2);}};}function respondWithFilteredResult(_0x2ee1aa,_0x1242eb){return function(_0x10c2c2){if(_0x10c2c2){var _0x56d5de=typeof _0x1242eb[_0x3a84('0x30')]===_0x3a84('0x31')&&typeof _0x1242eb[_0x3a84('0x32')]===_0x3a84('0x31');var _0x2c8623=_0x10c2c2[_0x3a84('0x33')];var _0x55a171=_0x56d5de?0x0:_0x1242eb[_0x3a84('0x30')];var _0x15875a=_0x56d5de?_0x10c2c2[_0x3a84('0x33')]:_0x1242eb[_0x3a84('0x30')]+_0x1242eb[_0x3a84('0x32')];var _0x3ea41c;if(_0x15875a>=_0x2c8623){_0x15875a=_0x2c8623;_0x3ea41c=0xc8;}else{_0x3ea41c=0xce;}_0x2ee1aa[_0x3a84('0x34')](_0x3ea41c);return _0x2ee1aa[_0x3a84('0x35')]('Content-Range',_0x55a171+'-'+_0x15875a+'/'+_0x2c8623)[_0x3a84('0x2f')](_0x10c2c2);}return null;};}function patchUpdates(_0x81f61c){return function(_0x11cdb3){try{jsonpatch[_0x3a84('0x36')](_0x11cdb3,_0x81f61c,!![]);}catch(_0x5c76c4){return BPromise[_0x3a84('0x37')](_0x5c76c4);}return _0x11cdb3[_0x3a84('0x38')]();};}function saveUpdates(_0x475836,_0x21f530){return function(_0x411abf){if(_0x411abf){return _0x411abf[_0x3a84('0x39')](_0x475836)[_0x3a84('0x24')](function(_0x59e78c){return _0x59e78c;});}return null;};}function removeEntity(_0x341317,_0x3dae6c){return function(_0x80459e){if(_0x80459e){return _0x80459e[_0x3a84('0x3a')]()[_0x3a84('0x24')](function(){var _0x2a17c0=_0x80459e[_0x3a84('0x3b')]({'plain':!![]});var _0x1c1137=_0x3a84('0x3c');return db[_0x3a84('0x3d')][_0x3a84('0x3a')]({'where':{'type':_0x1c1137,'resourceId':_0x2a17c0['id']}})[_0x3a84('0x24')](function(){return _0x80459e;});})['then'](function(){_0x341317[_0x3a84('0x34')](0xcc)['end']();});}};}function handleEntityNotFound(_0x35a895,_0x4788e5){return function(_0x364016){if(!_0x364016){_0x35a895['sendStatus'](0x194);}return _0x364016;};}function handleError(_0x5e1e38,_0x40bfff){_0x40bfff=_0x40bfff||0x1f4;return function(_0x3684ee){logger[_0x3a84('0x29')](_0x3684ee[_0x3a84('0x3e')]);if(_0x3684ee[_0x3a84('0x3f')]){delete _0x3684ee[_0x3a84('0x3f')];}_0x5e1e38[_0x3a84('0x34')](_0x40bfff)[_0x3a84('0x40')](_0x3684ee);};}exports[_0x3a84('0x41')]=function(_0x5c48d6,_0x55d453){var _0xaeb197={'include':[{'model':db[_0x3a84('0x42')],'as':_0x3a84('0x43')}]},_0x3b87a6={},_0x181f8b={'count':0x0,'rows':[]};var _0x5ba9d4=_[_0x3a84('0x44')](db[_0x3a84('0x45')]['rawAttributes'],function(_0x4bce0e){return{'name':_0x4bce0e[_0x3a84('0x46')],'type':_0x4bce0e[_0x3a84('0x47')][_0x3a84('0x48')]};});_0x3b87a6['model']=_[_0x3a84('0x44')](_0x5ba9d4,'name');_0x3b87a6[_0x3a84('0x49')]=_['keys'](_0x5c48d6[_0x3a84('0x49')]);_0x3b87a6['filters']=_['intersection'](_0x3b87a6[_0x3a84('0x4a')],_0x3b87a6[_0x3a84('0x49')]);_0xaeb197['attributes']=_[_0x3a84('0x4b')](_0x3b87a6[_0x3a84('0x4a')],qs[_0x3a84('0x4c')](_0x5c48d6['query'][_0x3a84('0x4c')]));_0xaeb197[_0x3a84('0x4d')]=_0xaeb197[_0x3a84('0x4d')]['length']?_0xaeb197[_0x3a84('0x4d')]:_0x3b87a6[_0x3a84('0x4a')];if(!_0x5c48d6[_0x3a84('0x49')]['hasOwnProperty']('nolimit')){_0xaeb197['limit']=qs[_0x3a84('0x32')](_0x5c48d6[_0x3a84('0x49')][_0x3a84('0x32')]);_0xaeb197[_0x3a84('0x30')]=qs[_0x3a84('0x30')](_0x5c48d6[_0x3a84('0x49')][_0x3a84('0x30')]);}_0xaeb197[_0x3a84('0x4e')]=qs['sort'](_0x5c48d6['query'][_0x3a84('0x4f')]);_0xaeb197[_0x3a84('0x50')]=qs[_0x3a84('0x51')](_[_0x3a84('0x52')](_0x5c48d6[_0x3a84('0x49')],_0x3b87a6[_0x3a84('0x51')]),_0x5ba9d4);if(_0x5c48d6[_0x3a84('0x49')][_0x3a84('0x53')]){_0xaeb197['where']=_[_0x3a84('0x54')](_0xaeb197['where'],{'$or':_[_0x3a84('0x44')](_0x5ba9d4,function(_0x44815b){if(_0x44815b[_0x3a84('0x47')]!==_0x3a84('0x55')){var _0x4312eb={};_0x4312eb[_0x44815b[_0x3a84('0x3f')]]={'$like':'%'+_0x5c48d6[_0x3a84('0x49')][_0x3a84('0x53')]+'%'};return _0x4312eb;}})});}_0xaeb197=_[_0x3a84('0x54')]({},_0xaeb197,_0x5c48d6[_0x3a84('0x56')]);var _0x13a113={'where':_0xaeb197['where']};return db['SmsAccount']['count'](_0x13a113)[_0x3a84('0x24')](function(_0x398e6c){_0x181f8b[_0x3a84('0x33')]=_0x398e6c;if(_0x5c48d6[_0x3a84('0x49')][_0x3a84('0x57')]){_0xaeb197[_0x3a84('0x58')]=[{'all':!![]}];}return db['SmsAccount'][_0x3a84('0x59')](_0xaeb197);})[_0x3a84('0x24')](function(_0x48a409){_0x181f8b[_0x3a84('0x5a')]=_0x48a409;return _0x181f8b;})[_0x3a84('0x24')](respondWithFilteredResult(_0x55d453,_0xaeb197))[_0x3a84('0x2c')](handleError(_0x55d453,null));};exports[_0x3a84('0x5b')]=function(_0x21ecfa,_0x1cb2c3){var _0xb790f0={'raw':![],'where':{'id':_0x21ecfa[_0x3a84('0x5c')]['id']},'include':[{'model':db[_0x3a84('0x42')],'as':_0x3a84('0x43')}]},_0x4d8905={};_0x4d8905[_0x3a84('0x4a')]=_[_0x3a84('0x5d')](db['SmsAccount'][_0x3a84('0x5e')]);_0x4d8905['query']=_[_0x3a84('0x5d')](_0x21ecfa['query']);_0x4d8905[_0x3a84('0x51')]=_['intersection'](_0x4d8905[_0x3a84('0x4a')],_0x4d8905[_0x3a84('0x49')]);_0xb790f0[_0x3a84('0x4d')]=_[_0x3a84('0x4b')](_0x4d8905[_0x3a84('0x4a')],qs[_0x3a84('0x4c')](_0x21ecfa[_0x3a84('0x49')][_0x3a84('0x4c')]));_0xb790f0[_0x3a84('0x4d')]=_0xb790f0[_0x3a84('0x4d')][_0x3a84('0x5f')]?_0xb790f0[_0x3a84('0x4d')]:_0x4d8905[_0x3a84('0x4a')];if(_0x21ecfa[_0x3a84('0x49')]['includeAll']){_0xb790f0['include']=[{'all':!![]}];}_0xb790f0=_[_0x3a84('0x54')]({},_0xb790f0,_0x21ecfa[_0x3a84('0x56')]);return db[_0x3a84('0x45')][_0x3a84('0x60')](_0xb790f0)[_0x3a84('0x24')](handleEntityNotFound(_0x1cb2c3,null))[_0x3a84('0x24')](respondWithResult(_0x1cb2c3,null))['catch'](handleError(_0x1cb2c3,null));};exports[_0x3a84('0x61')]=function(_0x3b1383,_0x268e70){return db[_0x3a84('0x45')]['create'](_0x3b1383[_0x3a84('0x62')],{})[_0x3a84('0x24')](function(_0x2ba721){var _0x1290b5=_0x3b1383[_0x3a84('0x63')]['get']({'plain':!![]});if(!_0x1290b5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1290b5[_0x3a84('0x64')]===_0x3a84('0x63')){var _0x50fe63=_0x2ba721[_0x3a84('0x3b')]({'plain':!![]});var _0x37d323=_0x3a84('0x3c');return db[_0x3a84('0x65')]['find']({'where':{'name':_0x37d323,'userProfileId':_0x1290b5[_0x3a84('0x66')]},'raw':!![]})['then'](function(_0x547b76){if(_0x547b76&&_0x547b76[_0x3a84('0x67')]===0x0){return db['UserProfileResource'][_0x3a84('0x61')]({'name':_0x50fe63[_0x3a84('0x3f')],'resourceId':_0x50fe63['id'],'type':_0x547b76['name'],'sectionId':_0x547b76['id']},{})[_0x3a84('0x24')](function(){return _0x2ba721;});}else{return _0x2ba721;}})['catch'](function(_0x5cc830){logger[_0x3a84('0x29')](_0x3a84('0x68'),_0x5cc830);throw _0x5cc830;});}return _0x2ba721;})[_0x3a84('0x24')](respondWithResult(_0x268e70,0xc9))[_0x3a84('0x2c')](handleError(_0x268e70,null));};exports['update']=function(_0x49d8fc,_0x44e42d){if(_0x49d8fc['body']['id']){delete _0x49d8fc['body']['id'];}return db[_0x3a84('0x45')][_0x3a84('0x60')]({'where':{'id':_0x49d8fc[_0x3a84('0x5c')]['id']},'include':[{'model':db[_0x3a84('0x42')],'as':_0x3a84('0x43')}]})[_0x3a84('0x24')](handleEntityNotFound(_0x44e42d,null))[_0x3a84('0x24')](saveUpdates(_0x49d8fc[_0x3a84('0x62')],null))[_0x3a84('0x24')](respondWithResult(_0x44e42d,null))[_0x3a84('0x2c')](handleError(_0x44e42d,null));};exports['destroy']=function(_0x37130c,_0x3704a4){return db[_0x3a84('0x45')][_0x3a84('0x60')]({'where':{'id':_0x37130c[_0x3a84('0x5c')]['id']}})[_0x3a84('0x24')](handleEntityNotFound(_0x3704a4,null))[_0x3a84('0x24')](removeEntity(_0x3704a4,null))['catch'](handleError(_0x3704a4,null));};exports[_0x3a84('0x69')]=function(_0x6dfc68,_0x57d46b){return db['SmsAccount'][_0x3a84('0x69')]()['then'](respondWithResult(_0x57d46b,null))[_0x3a84('0x2c')](handleError(_0x57d46b,null));};exports[_0x3a84('0x6a')]=function(_0x5a13b0,_0x2bb2ae,_0x468d44){if(_0x5a13b0[_0x3a84('0x62')]['id']){delete _0x5a13b0[_0x3a84('0x62')]['id'];}return db[_0x3a84('0x45')][_0x3a84('0x60')]({'where':{'id':_0x5a13b0[_0x3a84('0x5c')]['id']}})[_0x3a84('0x24')](handleEntityNotFound(_0x2bb2ae,null))[_0x3a84('0x24')](function(_0x20e0f8){if(_0x20e0f8){_0x5a13b0[_0x3a84('0x62')][_0x3a84('0x6b')]=_0x20e0f8['id'];return db['Disposition'][_0x3a84('0x61')](_0x5a13b0[_0x3a84('0x62')]);}})[_0x3a84('0x24')](respondWithResult(_0x2bb2ae,null))[_0x3a84('0x2c')](handleError(_0x2bb2ae,null));};exports[_0x3a84('0x6c')]=function(_0x38168b,_0x4be96a,_0x21977f){var _0xfca746={'raw':![],'where':{}};var _0x148959={};var _0x5f4d25={'count':0x0,'rows':[]};return db[_0x3a84('0x45')][_0x3a84('0x6d')]({'where':{'id':_0x38168b[_0x3a84('0x5c')]['id']}})[_0x3a84('0x24')](handleEntityNotFound(_0x4be96a,null))[_0x3a84('0x24')](function(_0x4f4d77){if(_0x4f4d77){_0x148959[_0x3a84('0x4a')]=_['keys'](db['Disposition'][_0x3a84('0x5e')]);_0x148959[_0x3a84('0x49')]=_[_0x3a84('0x5d')](_0x38168b[_0x3a84('0x49')]);_0x148959[_0x3a84('0x51')]=_[_0x3a84('0x4b')](_0x148959[_0x3a84('0x4a')],_0x148959[_0x3a84('0x49')]);_0xfca746[_0x3a84('0x4d')]=_[_0x3a84('0x4b')](_0x148959[_0x3a84('0x4a')],qs[_0x3a84('0x4c')](_0x38168b['query']['fields']));_0xfca746[_0x3a84('0x4d')]=_0xfca746[_0x3a84('0x4d')][_0x3a84('0x5f')]?_0xfca746[_0x3a84('0x4d')]:_0x148959['model'];if(!_0x38168b[_0x3a84('0x49')]['hasOwnProperty'](_0x3a84('0x6e'))){_0xfca746[_0x3a84('0x32')]=qs[_0x3a84('0x32')](_0x38168b[_0x3a84('0x49')][_0x3a84('0x32')]);_0xfca746['offset']=qs['offset'](_0x38168b[_0x3a84('0x49')][_0x3a84('0x30')]);}_0xfca746['order']=qs[_0x3a84('0x4f')](_0x38168b['query']['sort']);_0xfca746[_0x3a84('0x50')]=qs[_0x3a84('0x51')](_['pick'](_0x38168b[_0x3a84('0x49')],_0x148959['filters']));_0xfca746[_0x3a84('0x50')][_0x3a84('0x6b')]=_0x4f4d77['id'];if(_0x38168b[_0x3a84('0x49')][_0x3a84('0x53')]){_0xfca746[_0x3a84('0x50')]=_['merge'](_0xfca746['where'],{'$or':_[_0x3a84('0x44')](_0xfca746[_0x3a84('0x4d')],function(_0x4d1c78){var _0x3aaa20={};_0x3aaa20[_0x4d1c78]={'$like':'%'+_0x38168b[_0x3a84('0x49')][_0x3a84('0x53')]+'%'};return _0x3aaa20;})});}_0xfca746=_[_0x3a84('0x54')]({},_0xfca746,_0x38168b['options']);return db[_0x3a84('0x6f')][_0x3a84('0x33')]({'where':_0xfca746[_0x3a84('0x50')]})[_0x3a84('0x24')](function(_0x233d21){_0x5f4d25[_0x3a84('0x33')]=_0x233d21;if(_0x38168b[_0x3a84('0x49')][_0x3a84('0x57')]){_0xfca746[_0x3a84('0x58')]=[{'all':!![]}];}return db[_0x3a84('0x6f')][_0x3a84('0x59')](_0xfca746);})[_0x3a84('0x24')](function(_0x4de469){_0x5f4d25[_0x3a84('0x5a')]=_0x4de469;return _0x5f4d25;});}})[_0x3a84('0x24')](respondWithFilteredResult(_0x4be96a,_0xfca746))[_0x3a84('0x2c')](handleError(_0x4be96a,null));};exports[_0x3a84('0x70')]=function(_0x2cbdd8,_0xcf9658,_0x486240){return db['SmsAccount'][_0x3a84('0x60')]({'where':{'id':_0x2cbdd8[_0x3a84('0x5c')]['id']}})[_0x3a84('0x24')](handleEntityNotFound(_0xcf9658,null))['then'](function(_0x32a2c9){if(_0x32a2c9){return _0x32a2c9[_0x3a84('0x70')](_0x2cbdd8['query']['ids']);}})[_0x3a84('0x24')](respondWithStatusCode(_0xcf9658,null))[_0x3a84('0x2c')](handleError(_0xcf9658,null));};exports['addAnswer']=function(_0x5d4d09,_0x50e22e,_0x377b17){if(_0x5d4d09[_0x3a84('0x62')]['id']){delete _0x5d4d09[_0x3a84('0x62')]['id'];}return db[_0x3a84('0x45')][_0x3a84('0x60')]({'where':{'id':_0x5d4d09[_0x3a84('0x5c')]['id']}})[_0x3a84('0x24')](handleEntityNotFound(_0x50e22e,null))[_0x3a84('0x24')](function(_0x2684ac){if(_0x2684ac){_0x5d4d09[_0x3a84('0x62')][_0x3a84('0x6b')]=_0x2684ac['id'];return db[_0x3a84('0x71')][_0x3a84('0x61')](_0x5d4d09['body']);}})[_0x3a84('0x24')](respondWithResult(_0x50e22e,null))['catch'](handleError(_0x50e22e,null));};exports['getAnswers']=function(_0x41dea7,_0x5a11c9,_0x338da4){var _0x2230d9={'raw':![],'where':{}};var _0x2219e0={};var _0x1b97d5={'count':0x0,'rows':[]};return db['SmsAccount'][_0x3a84('0x6d')]({'where':{'id':_0x41dea7[_0x3a84('0x5c')]['id']}})['then'](handleEntityNotFound(_0x5a11c9,null))[_0x3a84('0x24')](function(_0x5eb40e){if(_0x5eb40e){_0x2219e0[_0x3a84('0x4a')]=_[_0x3a84('0x5d')](db['CannedAnswer'][_0x3a84('0x5e')]);_0x2219e0[_0x3a84('0x49')]=_[_0x3a84('0x5d')](_0x41dea7[_0x3a84('0x49')]);_0x2219e0['filters']=_['intersection'](_0x2219e0[_0x3a84('0x4a')],_0x2219e0[_0x3a84('0x49')]);_0x2230d9[_0x3a84('0x4d')]=_[_0x3a84('0x4b')](_0x2219e0[_0x3a84('0x4a')],qs[_0x3a84('0x4c')](_0x41dea7['query'][_0x3a84('0x4c')]));_0x2230d9[_0x3a84('0x4d')]=_0x2230d9[_0x3a84('0x4d')]['length']?_0x2230d9[_0x3a84('0x4d')]:_0x2219e0['model'];if(!_0x41dea7[_0x3a84('0x49')][_0x3a84('0x72')]('nolimit')){_0x2230d9['limit']=qs[_0x3a84('0x32')](_0x41dea7[_0x3a84('0x49')][_0x3a84('0x32')]);_0x2230d9['offset']=qs[_0x3a84('0x30')](_0x41dea7['query']['offset']);}_0x2230d9[_0x3a84('0x4e')]=qs[_0x3a84('0x4f')](_0x41dea7[_0x3a84('0x49')][_0x3a84('0x4f')]);_0x2230d9['where']=qs[_0x3a84('0x51')](_[_0x3a84('0x52')](_0x41dea7[_0x3a84('0x49')],_0x2219e0[_0x3a84('0x51')]));_0x2230d9[_0x3a84('0x50')]['SmsAccountId']=_0x5eb40e['id'];if(_0x41dea7[_0x3a84('0x49')][_0x3a84('0x53')]){_0x2230d9[_0x3a84('0x50')]=_['merge'](_0x2230d9[_0x3a84('0x50')],{'$or':_[_0x3a84('0x44')](_0x2230d9[_0x3a84('0x4d')],function(_0x29db50){var _0x1abbc1={};_0x1abbc1[_0x29db50]={'$like':'%'+_0x41dea7['query'][_0x3a84('0x53')]+'%'};return _0x1abbc1;})});}_0x2230d9=_[_0x3a84('0x54')]({},_0x2230d9,_0x41dea7['options']);return db['CannedAnswer']['count']({'where':_0x2230d9[_0x3a84('0x50')]})['then'](function(_0x39e6b3){_0x1b97d5[_0x3a84('0x33')]=_0x39e6b3;if(_0x41dea7[_0x3a84('0x49')][_0x3a84('0x57')]){_0x2230d9[_0x3a84('0x58')]=[{'all':!![]}];}return db['CannedAnswer'][_0x3a84('0x59')](_0x2230d9);})[_0x3a84('0x24')](function(_0xd13863){_0x1b97d5[_0x3a84('0x5a')]=_0xd13863;return _0x1b97d5;});}})[_0x3a84('0x24')](respondWithFilteredResult(_0x5a11c9,_0x2230d9))[_0x3a84('0x2c')](handleError(_0x5a11c9,null));};exports['removeAnswers']=function(_0x13a9f3,_0x7f1852,_0x413809){return db[_0x3a84('0x45')][_0x3a84('0x60')]({'where':{'id':_0x13a9f3['params']['id']}})[_0x3a84('0x24')](handleEntityNotFound(_0x7f1852,null))['then'](function(_0x40a80d){if(_0x40a80d){return _0x40a80d[_0x3a84('0x73')](_0x13a9f3[_0x3a84('0x49')]['ids']);}})[_0x3a84('0x24')](respondWithStatusCode(_0x7f1852,null))['catch'](handleError(_0x7f1852,null));};exports[_0x3a84('0x74')]=function(_0x310aa9,_0x397ac0,_0x519f16){var _0x3c112a={'channel':_0x3a84('0x75')};var _0x57adf8=[];var _0x21182f=[];var _0xf8c5e3={};return db[_0x3a84('0x45')]['find']({'where':{'id':_0x310aa9['params']['id']},'include':[{'model':db[_0x3a84('0x76')],'as':_0x3a84('0x77')}]})[_0x3a84('0x24')](handleEntityNotFound(_0x397ac0,null))['then'](function(_0x539d0){_0x3c112a[_0x3a84('0x78')]=_0x539d0;_0x3c112a[_0x3a84('0x79')]=_['orderBy'](_0x539d0['Applications'],[_0x3a84('0x7a')],[_0x3a84('0x7b')]);if(_0x3c112a['account'][_0x3a84('0x77')]){delete _0x3c112a[_0x3a84('0x78')]['Applications'];}return db['CmContact'][_0x3a84('0x69')]();})[_0x3a84('0x24')](function(_0x1d2bd6){if(!_0x1d2bd6){throw new db[(_0x3a84('0x7c'))][(_0x3a84('0x7d'))](_0x3a84('0x7e'));}_0x57adf8=_['difference'](_[_0x3a84('0x5d')](_0x1d2bd6),['createdAt',_0x3a84('0x7f')]);_0x21182f=_[_0x3a84('0x80')](_['keys'](_0x1d2bd6),['createdAt',_0x3a84('0x7f'),'CompanyId',_0x3a84('0x81')]);_0x3c112a['body']={'mapKey':'mobile'};if(_0x3c112a[_0x3a84('0x78')]['type']){switch(_0x3c112a[_0x3a84('0x78')][_0x3a84('0x47')]){case _0x3a84('0x82'):_0x3c112a[_0x3a84('0x62')]['from']=_0x310aa9['body']['From'];_0x3c112a['body'][_0x3a84('0x62')]=_0x310aa9[_0x3a84('0x62')][_0x3a84('0x83')];_0x3c112a[_0x3a84('0x62')][_0x3a84('0x84')]=_0x310aa9[_0x3a84('0x62')][_0x3a84('0x85')];break;case _0x3a84('0x86'):_0x3c112a[_0x3a84('0x62')][_0x3a84('0x87')]='+'+_0x310aa9[_0x3a84('0x62')][_0x3a84('0x88')];_0x3c112a[_0x3a84('0x62')][_0x3a84('0x62')]=_0x310aa9[_0x3a84('0x62')][_0x3a84('0x89')];break;case _0x3a84('0x8a'):_0x3c112a[_0x3a84('0x62')][_0x3a84('0x87')]=_0x310aa9[_0x3a84('0x62')][_0x3a84('0x87')];_0x3c112a[_0x3a84('0x62')][_0x3a84('0x62')]=_0x310aa9[_0x3a84('0x62')][_0x3a84('0x2a')];break;case _0x3a84('0x8b'):_0x3c112a['body'][_0x3a84('0x87')]=_0x310aa9[_0x3a84('0x62')]['from'];_0x3c112a[_0x3a84('0x62')]['body']=_0x310aa9[_0x3a84('0x62')]['body'];_0x3c112a[_0x3a84('0x62')][_0x3a84('0x84')]=_0x310aa9['body'][_0x3a84('0x8c')];break;case _0x3a84('0x8d'):_0x3c112a['body'][_0x3a84('0x87')]=_0x310aa9['body'][_0x3a84('0x8e')];_0x3c112a[_0x3a84('0x62')]['body']=_0x310aa9[_0x3a84('0x62')][_0x3a84('0x8f')];_0x3c112a['body'][_0x3a84('0x84')]=_0x310aa9[_0x3a84('0x62')][_0x3a84('0x90')];break;case _0x3a84('0x91'):_0x3c112a[_0x3a84('0x62')]['from']='+'+_0x310aa9[_0x3a84('0x62')][_0x3a84('0x92')][0x0][_0x3a84('0x87')];_0x3c112a['body'][_0x3a84('0x62')]=_0x310aa9[_0x3a84('0x62')][_0x3a84('0x92')][0x0][_0x3a84('0x89')];_0x3c112a['body']['messageId']=_0x310aa9['body'][_0x3a84('0x92')][0x0][_0x3a84('0x84')];break;case _0x3a84('0x93'):_0x3c112a[_0x3a84('0x62')][_0x3a84('0x87')]=_0x310aa9[_0x3a84('0x62')][_0x3a84('0x94')];_0x3c112a[_0x3a84('0x62')][_0x3a84('0x62')]=_0x310aa9[_0x3a84('0x62')][_0x3a84('0x95')][_0x3a84('0x2a')];break;case _0x3a84('0x96'):_0x3c112a[_0x3a84('0x62')]['from']=_0x310aa9[_0x3a84('0x62')][_0x3a84('0x97')];_0x3c112a[_0x3a84('0x62')][_0x3a84('0x62')]=_0x310aa9['body'][_0x3a84('0x89')];_0x3c112a[_0x3a84('0x62')][_0x3a84('0x84')]=_0x310aa9[_0x3a84('0x62')][_0x3a84('0x98')];break;case _0x3a84('0x99'):_0x3c112a[_0x3a84('0x62')][_0x3a84('0x84')]=_0x310aa9['body'][0x0][_0x3a84('0x2a')]['id'];_0x3c112a['body'][_0x3a84('0x87')]=_0x310aa9[_0x3a84('0x62')][0x0][_0x3a84('0x2a')][_0x3a84('0x87')];_0x3c112a['body']['body']=_0x310aa9[_0x3a84('0x62')][0x0][_0x3a84('0x2a')]['text'];break;case'intelepeer':_0x3c112a[_0x3a84('0x62')][_0x3a84('0x87')]=_0x310aa9['body']['from'];_0x3c112a['body'][_0x3a84('0x62')]=_0x310aa9[_0x3a84('0x62')][_0x3a84('0x2a')];_0x3c112a[_0x3a84('0x62')][_0x3a84('0x84')]=_0x310aa9['body'][_0x3a84('0x9a')];break;}}if(_0x3c112a[_0x3a84('0x62')]['id']){delete _0x3c112a['body']['id'];}if(_[_0x3a84('0x9b')](_0x3c112a[_0x3a84('0x62')][_0x3a84('0x87')])){throw new db[(_0x3a84('0x7c'))][(_0x3a84('0x7d'))](_0x3a84('0x9c'));}if(_['isNil'](_0x3c112a[_0x3a84('0x62')]['body'])||_0x3c112a[_0x3a84('0x62')]['body']===''){throw new db[(_0x3a84('0x7c'))][(_0x3a84('0x7d'))](_0x3a84('0x9d'));}if(_[_0x3a84('0x9b')](_0x3c112a[_0x3a84('0x62')][_0x3a84('0x9e')])){throw new db['Sequelize'][(_0x3a84('0x7d'))](_0x3a84('0x9f')+_0x21182f);}if(!_[_0x3a84('0xa0')](_0x21182f,_0x3c112a[_0x3a84('0x62')][_0x3a84('0x9e')])){throw new db[(_0x3a84('0x7c'))][(_0x3a84('0x7d'))](_0x3a84('0xa1')+_0x21182f);}_0xf8c5e3[_0x3c112a[_0x3a84('0x62')][_0x3a84('0x9e')]]=_0x3c112a[_0x3a84('0x62')]['from'];return db[_0x3a84('0xa2')][_0x3a84('0x60')]({'where':{'id':_0x3c112a[_0x3a84('0x78')][_0x3a84('0x81')]},'include':[{'model':db['CmContact'],'as':_0x3a84('0xa3'),'where':_0xf8c5e3,'limit':0x1,'order':[['updatedAt',_0x3a84('0xa4')]]}]});})[_0x3a84('0x24')](handleEntityNotFound(_0x397ac0,null))[_0x3a84('0x24')](function(_0x22340b){if(_0x22340b){_0x3c112a[_0x3a84('0xa5')]=_[_0x3a84('0xa6')](_0x22340b,[_0x3a84('0xa3')]);if(_0x22340b[_0x3a84('0xa3')][_0x3a84('0x5f')]){return _0x22340b['Contacts'][0x0];}var _0x968e85=_[_0x3a84('0x1d')](_0x3c112a[_0x3a84('0x62')],{'firstName':_0x3c112a[_0x3a84('0x62')][_0x3a84('0x87')],'ListId':_0x22340b['id']});_0x968e85[_0x3c112a[_0x3a84('0x62')][_0x3a84('0x9e')]]=_0x3c112a[_0x3a84('0x62')][_0x3a84('0x87')];return db['CmContact'][_0x3a84('0x61')](_0x968e85,{'fields':_0x57adf8,'raw':!![]});}})[_0x3a84('0x24')](handleEntityNotFound(_0x397ac0,null))[_0x3a84('0x24')](function(_0x458ffc){if(_0x458ffc){_0x3c112a[_0x3a84('0xa7')]=_0x458ffc;var _0x11933e={'ContactId':_0x458ffc['id'],'phone':_0x3c112a['body'][_0x3a84('0x87')],'SmsAccountId':_0x310aa9[_0x3a84('0x5c')]['id']};var _0x5b86d6={'ContactId':_0x458ffc['id'],'SmsAccountId':_0x310aa9[_0x3a84('0x5c')]['id'],'closed':![]};return db[_0x3a84('0xa8')]['find']({'where':_0x5b86d6})[_0x3a84('0x24')](function(_0x2892e6){if(_0x2892e6){return[_0x2892e6,![]];}return db[_0x3a84('0xa8')]['create'](_0x11933e)[_0x3a84('0x24')](function(_0x2d984c){return[_0x2d984c,!![]];});});}})[_0x3a84('0xa9')](function(_0xfa79cd,_0x2ecfae){_0x3c112a['interaction']=_0xfa79cd['get']({'plain':!![]});_0x3c112a[_0x3a84('0xaa')][_0x3a84('0xab')]=![];if(_0x2ecfae){if(_0x3c112a[_0x3a84('0x78')][_0x3a84('0xac')]){_0x3c112a['applications'][_0x3a84('0xad')]({'id':0x0,'priority':_0x3c112a[_0x3a84('0x79')]['length']+0x1,'app':_0x3a84('0xae'),'appdata':_0x3a84('0xaf'),'interval':'*,*,*,*'});}_0x3c112a['interaction'][_0x3a84('0xab')]=!![];}return db[_0x3a84('0xb0')]['create']({'phone':_0x3c112a[_0x3a84('0x62')][_0x3a84('0x87')],'messageId':_0x3c112a['body'][_0x3a84('0x84')],'body':_0x3c112a[_0x3a84('0x62')][_0x3a84('0x62')],'SmsAccountId':_0x310aa9['params']['id'],'SmsInteractionId':_0xfa79cd['id'],'direction':'in','ContactId':_0xfa79cd[_0x3a84('0xb1')],'AttachmentId':_0x3c112a[_0x3a84('0x62')][_0x3a84('0xb2')]});})[_0x3a84('0x24')](function(_0x2dc37d){_0x3c112a[_0x3a84('0x2a')]=_0x2dc37d;if(!_0x3c112a['interaction'][_0x3a84('0xb3')])return;return db[_0x3a84('0xb4')][_0x3a84('0x60')]({'attributes':['id',_0x3a84('0x3f')],'where':{'id':_0x3c112a['interaction'][_0x3a84('0xb3')]}});})[_0x3a84('0x24')](function(_0x458f7a){if(_0x458f7a){_0x3c112a[_0x3a84('0x79')][_0x3a84('0xb5')]({'id':0x0,'priority':0x0,'app':_0x3a84('0xb6'),'appdata':_0x458f7a[_0x3a84('0x3f')]+','+(_0x3c112a[_0x3a84('0x78')][_0x3a84('0xb7')]||0xa),'interval':'*,*,*,*'});}if(!_0x3c112a['interaction'][_0x3a84('0xb8')])return;return db['SmsQueue']['find']({'attributes':['id',_0x3a84('0x3f')],'where':{'id':_0x3c112a[_0x3a84('0xaa')]['queueId']}});})[_0x3a84('0x24')](function(_0x49ac88){if(_0x49ac88){_0x3c112a['applications'][_0x3a84('0xb5')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x49ac88[_0x3a84('0x3f')]+','+(_0x3c112a[_0x3a84('0x78')][_0x3a84('0xb9')]||0x12c),'interval':_0x3a84('0xba')});}return respondWithRpcPromise(_0x3a84('0xbb'),_0x3a84('0xbc'),_0x3c112a);})[_0x3a84('0x24')](function(_0x177982){if(_0x177982){var _0x12dbec=0xc8;var _0x3fee34='receiveMessage';logger[_0x3a84('0x25')](_0x3a84('0x28'),_0x3fee34,_0x12dbec,_0x3a84('0xbd'));logger[_0x3a84('0xbe')](_0x3a84('0xbf'),_0x3fee34,_0x12dbec,_0x3a84('0xbd'),JSON[_0x3a84('0xc0')](_0x177982));if(_0x3c112a[_0x3a84('0x78')][_0x3a84('0x47')]===_0x3a84('0x82')){return _0x397ac0[_0x3a84('0x34')](_0x12dbec)[_0x3a84('0x35')](_0x3a84('0xc1'),_0x3a84('0xc2'))[_0x3a84('0x40')](_0x3a84('0xc3'));}else{return _0x397ac0[_0x3a84('0x34')](_0x12dbec)['json'](_0x177982);}}})[_0x3a84('0x2c')](handleError(_0x397ac0,null));};exports[_0x3a84('0xc4')]=function(_0x355dbd,_0x4c7ee9){var _0x4ef4d0=_0x355dbd[_0x3a84('0x5c')]['id'];var _0x384e8f=_0x355dbd[_0x3a84('0x62')];var _0x4f62d7=0xc8;var _0xacaada=null;return db[_0x3a84('0xc5')]['transaction']({'isolationLevel':db[_0x3a84('0xc5')]['Transaction'][_0x3a84('0xc6')][_0x3a84('0xc7')]},function(_0x3de37e){return db[_0x3a84('0x45')][_0x3a84('0x6d')]({'where':{'id':_0x4ef4d0},'transaction':_0x3de37e})[_0x3a84('0x24')](function(_0x316983){if(_0x316983){return db['SmsApplication'][_0x3a84('0x3a')]({'where':{'SmsAccountId':_0x4ef4d0},'transaction':_0x3de37e})[_0x3a84('0x24')](function(){var _0x3f488e=_[_0x3a84('0x44')](_0x384e8f,function(_0x1018f8){_0x1018f8[_0x3a84('0x6b')]=_0x4ef4d0;return _0x1018f8;});return db[_0x3a84('0x76')][_0x3a84('0xc8')](_0x3f488e,{'transaction':_0x3de37e});});}else{_0x4f62d7=0x194;_0xacaada=[];}});})[_0x3a84('0x24')](function(){if(_0x4f62d7!==0x194){return db[_0x3a84('0x76')][_0x3a84('0xc9')]({'where':{'SmsAccountId':_0x4ef4d0},'order':'priority'})[_0x3a84('0x24')](function(_0x1455a6){_0xacaada=_0x1455a6;});}})[_0x3a84('0x2c')](function(_0x1d8d32){_0x4f62d7=0x1f4;logger['error'](_0x1d8d32[_0x3a84('0x3e')]);if(_0x1d8d32['name']){delete _0x1d8d32[_0x3a84('0x3f')];}_0xacaada=_0x1d8d32;})[_0x3a84('0xca')](function(){if(_0xacaada===null){_0x4c7ee9[_0x3a84('0x2d')](_0x4f62d7);}else{if(_0x4f62d7===0x1f4){_0x4c7ee9[_0x3a84('0x34')](_0x4f62d7)[_0x3a84('0x40')](_0xacaada);}else{_0x4c7ee9[_0x3a84('0x34')](_0x4f62d7)['json'](_0xacaada);}}});};exports[_0x3a84('0xcb')]=function(_0x5d8c1e,_0x13fe02,_0x17d138){var _0xd81be9={};var _0x305820={};var _0x3bc227;var _0x58c1eb;return db[_0x3a84('0x45')][_0x3a84('0x6d')]({'where':{'id':_0x5d8c1e[_0x3a84('0x5c')]['id']}})[_0x3a84('0x24')](handleEntityNotFound(_0x13fe02,null))[_0x3a84('0x24')](function(_0x541aaf){if(_0x541aaf){_0x3bc227=_0x541aaf;_0x305820[_0x3a84('0x4a')]=_['keys'](db['SmsApplication'][_0x3a84('0x5e')]);_0x305820[_0x3a84('0x49')]=_[_0x3a84('0x5d')](_0x5d8c1e[_0x3a84('0x49')]);_0x305820[_0x3a84('0x51')]=_[_0x3a84('0x4b')](_0x305820[_0x3a84('0x4a')],_0x305820[_0x3a84('0x49')]);_0xd81be9[_0x3a84('0x4d')]=_[_0x3a84('0x4b')](_0x305820[_0x3a84('0x4a')],qs[_0x3a84('0x4c')](_0x5d8c1e[_0x3a84('0x49')][_0x3a84('0x4c')]));_0xd81be9[_0x3a84('0x4d')]=_0xd81be9[_0x3a84('0x4d')][_0x3a84('0x5f')]?_0xd81be9[_0x3a84('0x4d')]:_0x305820[_0x3a84('0x4a')];_0xd81be9[_0x3a84('0x4e')]=qs[_0x3a84('0x4f')](_0x5d8c1e[_0x3a84('0x49')]['sort']);_0xd81be9['where']=qs[_0x3a84('0x51')](_['pick'](_0x5d8c1e[_0x3a84('0x49')],_0x305820[_0x3a84('0x51')]));if(_0x5d8c1e['query']['filter']){_0xd81be9[_0x3a84('0x50')]=_[_0x3a84('0x54')](_0xd81be9['where'],{'$or':_[_0x3a84('0x44')](_0xd81be9[_0x3a84('0x4d')],function(_0x2e80b2){var _0x13c4d4={};_0x13c4d4[_0x2e80b2]={'$like':'%'+_0x5d8c1e[_0x3a84('0x49')][_0x3a84('0x53')]+'%'};return _0x13c4d4;})});}_0xd81be9=_['merge']({},_0xd81be9,_0x5d8c1e[_0x3a84('0x56')]);return _0x3bc227[_0x3a84('0xcb')](_0xd81be9);}})[_0x3a84('0x24')](function(_0x912833){if(_0x912833){_0x58c1eb=_0x912833[_0x3a84('0x5f')];if(!_0x5d8c1e[_0x3a84('0x49')]['hasOwnProperty'](_0x3a84('0x6e'))){_0xd81be9[_0x3a84('0x32')]=qs[_0x3a84('0x32')](_0x5d8c1e['query'][_0x3a84('0x32')]);_0xd81be9[_0x3a84('0x30')]=qs['offset'](_0x5d8c1e['query'][_0x3a84('0x30')]);}return _0x3bc227['getApplications'](_0xd81be9);}})[_0x3a84('0x24')](function(_0x53aa0d){if(_0x53aa0d){return _0x53aa0d?{'count':_0x58c1eb,'rows':_0x53aa0d}:null;}})['then'](respondWithResult(_0x13fe02,null))[_0x3a84('0x2c')](handleError(_0x13fe02,null));};exports[_0x3a84('0xcc')]=function(_0x501066,_0x2dd816,_0x15c3d4){var _0x15beda={'raw':![],'where':{}};var _0x11ce6a={};var _0x2d7981={'count':0x0,'rows':[]};return db['SmsAccount'][_0x3a84('0x6d')]({'where':{'id':_0x501066['params']['id']}})[_0x3a84('0x24')](handleEntityNotFound(_0x2dd816,null))[_0x3a84('0x24')](function(_0x5df1e4){if(_0x5df1e4){_0x11ce6a['model']=_[_0x3a84('0x5d')](db[_0x3a84('0xa8')]['rawAttributes']);_0x11ce6a[_0x3a84('0x49')]=_['keys'](_0x501066['query']);_0x11ce6a[_0x3a84('0x51')]=_[_0x3a84('0x4b')](_0x11ce6a[_0x3a84('0x4a')],_0x11ce6a[_0x3a84('0x49')]);_0x15beda[_0x3a84('0x4d')]=_['intersection'](_0x11ce6a[_0x3a84('0x4a')],qs[_0x3a84('0x4c')](_0x501066[_0x3a84('0x49')][_0x3a84('0x4c')]));_0x15beda[_0x3a84('0x4d')]=_0x15beda[_0x3a84('0x4d')]['length']?_0x15beda[_0x3a84('0x4d')]:_0x11ce6a['model'];if(!_0x501066['query'][_0x3a84('0x72')](_0x3a84('0x6e'))){_0x15beda[_0x3a84('0x32')]=qs[_0x3a84('0x32')](_0x501066[_0x3a84('0x49')]['limit']);_0x15beda[_0x3a84('0x30')]=qs[_0x3a84('0x30')](_0x501066[_0x3a84('0x49')][_0x3a84('0x30')]);}_0x15beda[_0x3a84('0x4e')]=qs[_0x3a84('0x4f')](_0x501066['query']['sort']);_0x15beda[_0x3a84('0x50')]=qs[_0x3a84('0x51')](_[_0x3a84('0x52')](_0x501066[_0x3a84('0x49')],_0x11ce6a[_0x3a84('0x51')]));_0x15beda[_0x3a84('0x50')]['SmsAccountId']=_0x5df1e4['id'];if(_0x501066[_0x3a84('0x49')]['filter']){_0x15beda[_0x3a84('0x50')]=_['merge'](_0x15beda['where'],{'$or':_[_0x3a84('0x44')](_0x15beda[_0x3a84('0x4d')],function(_0x594249){var _0x1c4b62={};_0x1c4b62[_0x594249]={'$like':'%'+_0x501066[_0x3a84('0x49')][_0x3a84('0x53')]+'%'};return _0x1c4b62;})});}_0x15beda=_[_0x3a84('0x54')]({},_0x15beda,_0x501066[_0x3a84('0x56')]);return db[_0x3a84('0xa8')][_0x3a84('0x33')]({'where':_0x15beda[_0x3a84('0x50')]})[_0x3a84('0x24')](function(_0x5a7e1b){_0x2d7981[_0x3a84('0x33')]=_0x5a7e1b;if(_0x501066['query'][_0x3a84('0x57')]){_0x15beda[_0x3a84('0x58')]=[{'model':db[_0x3a84('0xcd')],'as':_0x3a84('0xce'),'required':![]},{'model':db[_0x3a84('0xb4')],'as':_0x3a84('0xcf'),'attributes':[_0x3a84('0x3f'),_0x3a84('0xd0'),_0x3a84('0xd1')],'required':![]},{'model':db[_0x3a84('0xd2')],'as':_0x3a84('0xd3'),'attributes':['id',_0x3a84('0x3f'),'color'],'where':_0x501066[_0x3a84('0x49')]['tag']?{'id':_0x501066[_0x3a84('0x49')][_0x3a84('0xd4')]}:undefined,'required':_0x501066['query'][_0x3a84('0xd4')]?!![]:![]}];}return db[_0x3a84('0xa8')]['findAll'](_0x15beda);})[_0x3a84('0x24')](function(_0x440cc0){_0x2d7981[_0x3a84('0x5a')]=_0x440cc0;return _0x2d7981;});}})[_0x3a84('0x24')](respondWithFilteredResult(_0x2dd816,_0x15beda))[_0x3a84('0x2c')](handleError(_0x2dd816,null));};exports[_0x3a84('0x40')]=function(_0x53640e,_0x43bec4,_0x47ff1f){var _0x2de847,_0x27b166,_0x24d0e6;if(_[_0x3a84('0x9b')](_0x53640e[_0x3a84('0x62')][_0x3a84('0x62')])||_0x53640e[_0x3a84('0x62')][_0x3a84('0x62')]===''){throw new db[(_0x3a84('0x7c'))]['ValidationError'](_0x3a84('0x9d'));}if(_['isNil'](_0x53640e['body']['to'])){throw new db['Sequelize'][(_0x3a84('0x7d'))](_0x3a84('0xd5'));}_0x2de847=_0x53640e[_0x3a84('0x62')]['to'];return db[_0x3a84('0x45')][_0x3a84('0x60')]({'where':{'id':_0x53640e[_0x3a84('0x5c')]['id']},'include':[{'model':db[_0x3a84('0xa2')],'as':_0x3a84('0xd6'),'include':[{'model':db['CmContact'],'as':'Contacts','where':{'mobile':_0x2de847},'limit':0x1,'order':[['updatedAt',_0x3a84('0xa4')]]}]}]})[_0x3a84('0x24')](handleEntityNotFound(_0x43bec4,null))[_0x3a84('0x24')](function(_0x442933){if(_0x442933&&_0x442933[_0x3a84('0xd6')]){_0x27b166=_0x442933[_0x3a84('0x3b')]({'plain':!![]});if(_0x27b166[_0x3a84('0xd6')]&&_0x27b166[_0x3a84('0xd6')][_0x3a84('0xa3')][_0x3a84('0x5f')]){return _0x27b166[_0x3a84('0xd6')][_0x3a84('0xa3')][0x0];}return db[_0x3a84('0xcd')][_0x3a84('0x61')](_[_0x3a84('0x1d')](_0x53640e[_0x3a84('0x62')],{'firstName':_0x2de847,'mobile':_0x2de847,'phone':_0x2de847,'ListId':_0x27b166[_0x3a84('0x81')]}));}})[_0x3a84('0x24')](handleEntityNotFound(_0x43bec4,null))['then'](function(_0x36c921){if(_0x36c921){_0x24d0e6=_0x36c921;return db[_0x3a84('0xa8')][_0x3a84('0x60')]({'where':{'ContactId':_0x24d0e6['id'],'closed':![],'SmsAccountId':_0x27b166['id']}})[_0x3a84('0x24')](function(_0x53e908){if(_0x53e908){return[_0x53e908,![]];}return db[_0x3a84('0xa8')][_0x3a84('0x61')]({'UserId':_0x53640e[_0x3a84('0x63')]['id'],'ContactId':_0x24d0e6['id'],'SmsAccountId':_0x27b166['id'],'phone':_0x2de847,'firstMsgDirection':_0x3a84('0xd7'),'Messages':[_[_0x3a84('0x54')](_0x53640e[_0x3a84('0x62')],{'read':![],'body':_0x53640e['body'][_0x3a84('0x62')],'phone':_0x2de847,'SmsAccountId':_0x27b166['id'],'UserId':_0x53640e[_0x3a84('0x63')]['id'],'ContactId':_0x24d0e6['id']})]},{'include':[{'model':db['SmsMessage'],'as':_0x3a84('0xd8')}]})['then'](function(_0x49a4bd){return[_0x49a4bd,!![]];});});}})[_0x3a84('0xa9')](function(_0x2a001b,_0x326971){if(_0x326971){return _0x2a001b;}return db['SmsMessage'][_0x3a84('0x61')](_[_0x3a84('0x54')](_0x53640e[_0x3a84('0x62')],{'read':![],'body':_0x53640e[_0x3a84('0x62')][_0x3a84('0x62')],'phone':_0x2de847,'SmsAccountId':_0x27b166['id'],'SmsInteractionId':_0x2a001b['id'],'UserId':_0x53640e[_0x3a84('0x63')]['id'],'ContactId':_0x24d0e6['id']}))[_0x3a84('0x24')](function(_0x587ccf){_0x2a001b[_0x3a84('0xd9')]['Messages']=[];_0x2a001b[_0x3a84('0xd9')][_0x3a84('0xd8')]['push'](_0x587ccf[_0x3a84('0xd9')]);return _0x2a001b;});})[_0x3a84('0x24')](respondWithResult(_0x43bec4,null))[_0x3a84('0x2c')](handleError(_0x43bec4,null));};exports[_0x3a84('0x34')]=function(_0x4d5f8d,_0x8ecc45,_0x4ee709){if(_0x4d5f8d['body']['id']){delete _0x4d5f8d[_0x3a84('0x62')]['id'];}var _0x4396c0,_0x20dac3,_0x2f06b6;return db['SmsAccount'][_0x3a84('0x60')]({'where':{'id':_0x4d5f8d['params']['id']}})[_0x3a84('0x24')](handleEntityNotFound(_0x8ecc45,null))[_0x3a84('0x24')](function(_0x12af74){if(_0x12af74){_0x2f06b6=_0x12af74;logger[_0x3a84('0xbe')](_0x3a84('0x28'),_0x3a84('0x34'),_0x3a84('0xda'),_0x12af74['type'],util['inspect'](_0x4d5f8d[_0x3a84('0x62')],{'showHidden':![],'depth':null}));switch(_0x12af74[_0x3a84('0x47')]){case _0x3a84('0x86'):if(_0x4d5f8d[_0x3a84('0x62')][_0x3a84('0xdb')]&&_0x4d5f8d['body']['status']){_0x20dac3=_0x4d5f8d[_0x3a84('0x62')][_0x3a84('0x34')];return db[_0x3a84('0xb0')][_0x3a84('0x60')]({'where':{'messageId':_0x4d5f8d['body'][_0x3a84('0xdb')]}});}break;case _0x3a84('0x8a'):if(_0x4d5f8d[_0x3a84('0x62')][_0x3a84('0xdc')]&&_0x4d5f8d[_0x3a84('0x62')][_0x3a84('0xdd')]){_0x20dac3=_0x4d5f8d[_0x3a84('0x62')][_0x3a84('0xdd')];return db[_0x3a84('0xb0')][_0x3a84('0x60')]({'where':{'messageId':_0x4d5f8d['body'][_0x3a84('0xdc')]}});}break;case'clicksend':if(_0x4d5f8d[_0x3a84('0x62')][_0x3a84('0x8c')]&&_0x4d5f8d[_0x3a84('0x62')][_0x3a84('0xde')]){_0x20dac3=_0x4d5f8d[_0x3a84('0x62')]['status_code'];return db[_0x3a84('0xb0')][_0x3a84('0x60')]({'where':{'messageId':_0x4d5f8d[_0x3a84('0x62')][_0x3a84('0x8c')]}});}break;case'infobip':var _0x12e43b=_0x4d5f8d[_0x3a84('0x62')][_0x3a84('0x92')][0x0];if(_0x12e43b[_0x3a84('0x84')]&&_0x12e43b['status'][_0x3a84('0xdf')]===_0x3a84('0xe0')){_0x20dac3=_0x12e43b[_0x3a84('0x34')][_0x3a84('0xdf')];return db['SmsMessage'][_0x3a84('0x60')]({'where':{'messageId':_0x12e43b[_0x3a84('0x84')]}});}break;case _0x3a84('0x96'):if(_0x4d5f8d[_0x3a84('0x62')][_0x3a84('0x84')]&&_0x4d5f8d[_0x3a84('0x62')]['status']){_0x20dac3=_0x4d5f8d[_0x3a84('0x62')][_0x3a84('0x34')];return db[_0x3a84('0xb0')]['find']({'where':{'messageId':_0x4d5f8d[_0x3a84('0x62')][_0x3a84('0x84')]}});}break;case'bandwidth':if(_0x4d5f8d[_0x3a84('0x62')][0x0][_0x3a84('0x2a')]['id']){_0x20dac3=_0x4d5f8d[_0x3a84('0x62')][0x0]['type'];return db[_0x3a84('0xb0')][_0x3a84('0x60')]({'where':{'messageId':_0x4d5f8d[_0x3a84('0x62')][0x0][_0x3a84('0x2a')]['id']}});}break;case _0x3a84('0xe1'):if(_0x4d5f8d[_0x3a84('0x62')]['redif']&&_0x4d5f8d[_0x3a84('0x62')][_0x3a84('0x34')]){_0x20dac3=_0x4d5f8d[_0x3a84('0x62')][_0x3a84('0x34')];return db['SmsMessage'][_0x3a84('0x60')]({'where':{'messageId':_0x4d5f8d['body'][_0x3a84('0xe2')]}});}break;}}})[_0x3a84('0x24')](handleEntityNotFound(_0x8ecc45,null))['then'](function(_0x5574fa){if(_0x5574fa){_0x4396c0=_0x5574fa;switch(_0x2f06b6[_0x3a84('0x47')]){case _0x3a84('0x86'):if(_0x20dac3===_0x3a84('0xe0')){return _0x4396c0[_0x3a84('0x39')]({'read':!![]});}else{logger['error'](_0x3a84('0x28'),_0x3a84('0x34'),_0x3a84('0x86'),util[_0x3a84('0xe3')](_0x4d5f8d[_0x3a84('0x62')],{'showHidden':![],'depth':null}));}break;case _0x3a84('0x8a'):if(_0x20dac3==='1'){return _0x4396c0[_0x3a84('0x39')]({'read':!![]});}else{logger[_0x3a84('0x29')](_0x3a84('0x28'),_0x3a84('0x34'),'skebby',util[_0x3a84('0xe3')](_0x4d5f8d[_0x3a84('0x62')],{'showHidden':![],'depth':null}));}break;case _0x3a84('0x8b'):if(!_0x4d5f8d['body'][_0x3a84('0xe4')]&&_0x20dac3>=0xc8&&_0x20dac3<=0xce){return _0x4396c0[_0x3a84('0x39')]({'read':!![]});}else{logger[_0x3a84('0x29')](_0x3a84('0x28'),_0x3a84('0x34'),'clicksend',util[_0x3a84('0xe3')](_0x4d5f8d[_0x3a84('0x62')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x5e22ad=_0x4d5f8d[_0x3a84('0x62')][_0x3a84('0x92')][0x0];if(_0x5e22ad[_0x3a84('0x34')][_0x3a84('0xdf')]===_0x3a84('0xe0')){return _0x4396c0[_0x3a84('0x39')]({'read':!![]});}else{logger[_0x3a84('0x29')](_0x3a84('0x28'),_0x3a84('0x34'),_0x3a84('0x91'),util['inspect'](_0x4d5f8d[_0x3a84('0x62')],{'showHidden':![],'depth':null}));}break;case _0x3a84('0x96'):if(_0x20dac3==_0x3a84('0xe5')||_0x20dac3==_0x3a84('0xe6')){return _0x4396c0['update']({'read':!![]});}else{logger[_0x3a84('0x29')](_0x3a84('0x28'),_0x3a84('0x34'),'clickatell',util[_0x3a84('0xe3')](_0x4d5f8d[_0x3a84('0x62')],{'showHidden':![],'depth':null}));}break;case'bandwidth':if(_0x20dac3=='message-delivered'){return _0x4396c0[_0x3a84('0x39')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x3a84('0x99'),util[_0x3a84('0xe3')](_0x4d5f8d[_0x3a84('0x62')],{'showHidden':![],'depth':null}));}break;case _0x3a84('0xe1'):if(_0x20dac3===_0x3a84('0xe7')||_0x20dac3==='ACCEPTD'){return _0x4396c0['update']({'read':!![]});}else{logger[_0x3a84('0x29')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x3a84('0x34'),_0x3a84('0xe1'),util[_0x3a84('0xe3')](_0x4d5f8d[_0x3a84('0x62')],{'showHidden':![],'depth':null}));}break;}return _0x4396c0;}})[_0x3a84('0x24')](respondWithResult(_0x8ecc45,null))[_0x3a84('0x2c')](handleError(_0x8ecc45,null));};exports[_0x3a84('0xe8')]=function(_0x57607c,_0x1c5740,_0x51cb3e){var _0x46559d,_0x5eb8c6,_0x57d7c0;return db['SmsAccount'][_0x3a84('0x60')]({'where':{'id':_0x57607c['params']['id']}})[_0x3a84('0x24')](handleEntityNotFound(_0x1c5740,null))['then'](function(_0x198a50){if(_0x198a50){_0x57d7c0=_0x198a50;logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x3a84('0x34'),_0x3a84('0xda'),_0x198a50[_0x3a84('0x47')],util['inspect'](_0x57607c[_0x3a84('0x49')],{'showHidden':![],'depth':null}));switch(_0x198a50[_0x3a84('0x47')]){case'csc':if(_0x57607c[_0x3a84('0x49')]['message-id']&&_0x57607c[_0x3a84('0x49')][_0x3a84('0xe9')]){_0x5eb8c6=_0x57607c[_0x3a84('0x49')][_0x3a84('0xe9')];return db[_0x3a84('0xb0')][_0x3a84('0x60')]({'where':{'messageId':_0x57607c[_0x3a84('0x49')][_0x3a84('0xea')]}});}break;}}})['then'](handleEntityNotFound(_0x1c5740,null))['then'](function(_0x4d88bd){if(_0x4d88bd){_0x46559d=_0x4d88bd;switch(_0x57d7c0['type']){case'csc':if(_0x5eb8c6==='2'||_0x5eb8c6==='6'){return _0x46559d[_0x3a84('0x39')]({'read':!![]});}else{logger[_0x3a84('0x29')](_0x3a84('0x28'),_0x3a84('0x34'),_0x3a84('0x93'),util[_0x3a84('0xe3')](_0x57607c[_0x3a84('0x49')],{'showHidden':![],'depth':null}));};break;}return _0x46559d;}})[_0x3a84('0x24')](respondWithResult(_0x1c5740,null))[_0x3a84('0x2c')](handleError(_0x1c5740,null));};exports[_0x3a84('0xeb')]=function(_0x3e8d51,_0x4c8019,_0x59b6df){return db[_0x3a84('0x45')][_0x3a84('0x60')]({'where':{'id':_0x3e8d51[_0x3a84('0x5c')]['id']}})[_0x3a84('0x24')](handleEntityNotFound(_0x4c8019,null))['then'](function(_0x2485b5){if(_0x2485b5){return _0x2485b5[_0x3a84('0xeb')](_0x3e8d51['body'][_0x3a84('0xec')],_[_0x3a84('0xa6')](_0x3e8d51[_0x3a84('0x62')],[_0x3a84('0xec'),'id'])||{})[_0x3a84('0xa9')](function(_0x400368){for(var _0x450f2a=0x0;_0x450f2a<_0x3e8d51['body'][_0x3a84('0xec')][_0x3a84('0x5f')];_0x450f2a+=0x1){socket[_0x3a84('0xed')](_0x3a84('0xee'),{'UserId':Number(_0x3e8d51[_0x3a84('0x62')][_0x3a84('0xec')][_0x450f2a]),'SmsAccountId':Number(_0x3e8d51[_0x3a84('0x5c')]['id'])});}return _0x400368;});}})[_0x3a84('0x24')](respondWithResult(_0x4c8019,null))[_0x3a84('0x2c')](handleError(_0x4c8019,null));};exports[_0x3a84('0xef')]=function(_0x3f4898,_0x35adc1,_0x861583){return db[_0x3a84('0x45')][_0x3a84('0x60')]({'where':{'id':_0x3f4898['params']['id']}})[_0x3a84('0x24')](handleEntityNotFound(_0x35adc1,null))[_0x3a84('0x24')](function(_0x12d292){if(_0x12d292){return _0x12d292[_0x3a84('0xef')](_0x3f4898[_0x3a84('0x49')][_0x3a84('0xec')])[_0x3a84('0x24')](function(){if(_[_0x3a84('0xf0')](_0x3f4898[_0x3a84('0x49')]['ids'])){for(var _0x465d58=0x0;_0x465d58<_0x3f4898[_0x3a84('0x49')][_0x3a84('0xec')][_0x3a84('0x5f')];_0x465d58+=0x1){socket['emit'](_0x3a84('0xf1'),{'UserId':Number(_0x3f4898['query'][_0x3a84('0xec')][_0x465d58]),'SmsAccountId':Number(_0x3f4898[_0x3a84('0x5c')]['id'])});}}else{socket[_0x3a84('0xed')](_0x3a84('0xf1'),{'UserId':Number(_0x3f4898[_0x3a84('0x49')][_0x3a84('0xec')]),'SmsAccountId':Number(_0x3f4898[_0x3a84('0x5c')]['id'])});}});}})[_0x3a84('0x24')](respondWithStatusCode(_0x35adc1,null))[_0x3a84('0x2c')](handleError(_0x35adc1,null));};exports[_0x3a84('0xf2')]=function(_0x2f52f1,_0x487341,_0xac97eb){var _0x2d1469={};var _0x2a47c4={};var _0x5dceb8;var _0xc4b546;return db[_0x3a84('0x45')][_0x3a84('0x6d')]({'where':{'id':_0x2f52f1[_0x3a84('0x5c')]['id']}})[_0x3a84('0x24')](handleEntityNotFound(_0x487341,null))[_0x3a84('0x24')](function(_0x2c6dbb){if(_0x2c6dbb){_0x5dceb8=_0x2c6dbb;_0x2a47c4[_0x3a84('0x4a')]=_[_0x3a84('0x5d')](db[_0x3a84('0xb4')][_0x3a84('0x5e')]);_0x2a47c4['query']=_['keys'](_0x2f52f1['query']);_0x2a47c4[_0x3a84('0x51')]=_['intersection'](_0x2a47c4[_0x3a84('0x4a')],_0x2a47c4['query']);_0x2d1469[_0x3a84('0x4d')]=_[_0x3a84('0x4b')](_0x2a47c4[_0x3a84('0x4a')],qs[_0x3a84('0x4c')](_0x2f52f1[_0x3a84('0x49')][_0x3a84('0x4c')]));_0x2d1469[_0x3a84('0x4d')]=_0x2d1469[_0x3a84('0x4d')][_0x3a84('0x5f')]?_0x2d1469[_0x3a84('0x4d')]:_0x2a47c4[_0x3a84('0x4a')];_0x2d1469[_0x3a84('0x4e')]=qs[_0x3a84('0x4f')](_0x2f52f1[_0x3a84('0x49')][_0x3a84('0x4f')]);_0x2d1469[_0x3a84('0x50')]=qs['filters'](_['pick'](_0x2f52f1[_0x3a84('0x49')],_0x2a47c4[_0x3a84('0x51')]));if(_0x2f52f1['query'][_0x3a84('0x53')]){_0x2d1469[_0x3a84('0x50')]=_['merge'](_0x2d1469[_0x3a84('0x50')],{'$or':_['map'](_0x2d1469[_0x3a84('0x4d')],function(_0x310c6f){var _0x4901a6={};_0x4901a6[_0x310c6f]={'$like':'%'+_0x2f52f1[_0x3a84('0x49')][_0x3a84('0x53')]+'%'};return _0x4901a6;})});}_0x2d1469=_['merge']({},_0x2d1469,_0x2f52f1['options']);return _0x5dceb8['getAgents'](_0x2d1469);}})['then'](function(_0x185be1){if(_0x185be1){_0xc4b546=_0x185be1[_0x3a84('0x5f')];if(!_0x2f52f1[_0x3a84('0x49')]['hasOwnProperty'](_0x3a84('0x6e'))){_0x2d1469[_0x3a84('0x32')]=qs['limit'](_0x2f52f1[_0x3a84('0x49')][_0x3a84('0x32')]);_0x2d1469[_0x3a84('0x30')]=qs[_0x3a84('0x30')](_0x2f52f1['query']['offset']);}return _0x5dceb8['getAgents'](_0x2d1469);}})[_0x3a84('0x24')](function(_0x4ff334){if(_0x4ff334){return _0x4ff334?{'count':_0xc4b546,'rows':_0x4ff334}:null;}})[_0x3a84('0x24')](respondWithResult(_0x487341,null))[_0x3a84('0x2c')](handleError(_0x487341,null));}; \ No newline at end of file +var _0xc922=['options','SmsAccount','findAll','show','params','length','includeAll','find','create','body','user','role','SmsAccounts','userProfileId','describe','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','order','filter','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','sms','SmsApplication','Applications','account','applications','orderBy','priority','asc','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','twilio','from','From','messageId','skebby','sender','text','connectel','clicksend','message_id','plivo','Text','MessageUUID','results','csc','segmentedMessage','clickatell','fromNumber','replyMessageId','bandwidth','intelepeer','refid','isNil','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','ListId','Contacts','list','omit','defaults','contact','SmsInteraction','spread','interaction','created','close','unmanaged','*,*,*,*','ContactId','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','queueId','SmsQueue','waitForTheAssignedQueue','Start','startRouting','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','entity\x20found','Content-Type','text/xml','\x0a','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','finally','getApplications','Contact','Owner','fullname','internal','Tags','color','tag','to\x20is\x20mandatory','CmList','List','DESC','SmsMessage','Messages','dataValues','push','SmsAccount,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','skebby_dispatch_id','requestid','statusInt','status_code','infobip','groupName','redif','DELIVERED','inspect','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','ACCEPTD','statusGet','message-id','state','addAgents','emit','removeAgents','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','api','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./smsAccount.socket','register','jayson/promise','client','http','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','get','UserProfileResource','end','stack','name','send','index','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL'];(function(_0x2df4cc,_0x1233c6){var _0x40af8d=function(_0x5e0f2a){while(--_0x5e0f2a){_0x2df4cc['push'](_0x2df4cc['shift']());}};_0x40af8d(++_0x1233c6);}(_0xc922,0x96));var _0x2c92=function(_0x6028a9,_0x2811bf){_0x6028a9=_0x6028a9-0x0;var _0x2af623=_0xc922[_0x6028a9];return _0x2af623;};'use strict';var emlformat=require(_0x2c92('0x0'));var rimraf=require(_0x2c92('0x1'));var zipdir=require(_0x2c92('0x2'));var jsonpatch=require(_0x2c92('0x3'));var rp=require(_0x2c92('0x4'));var moment=require(_0x2c92('0x5'));var BPromise=require(_0x2c92('0x6'));var Mustache=require(_0x2c92('0x7'));var util=require(_0x2c92('0x8'));var path=require(_0x2c92('0x9'));var sox=require(_0x2c92('0xa'));var csv=require(_0x2c92('0xb'));var ejs=require(_0x2c92('0xc'));var fs=require('fs');var fs_extra=require(_0x2c92('0xd'));var _=require(_0x2c92('0xe'));var squel=require(_0x2c92('0xf'));var crypto=require(_0x2c92('0x10'));var jsforce=require(_0x2c92('0x11'));var deskjs=require(_0x2c92('0x12'));var toCsv=require(_0x2c92('0xb'));var querystring=require('querystring');var Papa=require(_0x2c92('0x13'));var Redis=require(_0x2c92('0x14'));var authService=require('../../components/auth/service');var qs=require(_0x2c92('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2c92('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x2c92('0x17'));var db=require(_0x2c92('0x18'))['db'];config[_0x2c92('0x19')]=_['defaults'](config[_0x2c92('0x19')],{'host':_0x2c92('0x1a'),'port':0x18eb});var socket=require(_0x2c92('0x1b'))(new Redis(config[_0x2c92('0x19')]));require(_0x2c92('0x1c'))[_0x2c92('0x1d')](socket);var jayson=require(_0x2c92('0x1e'));var client=jayson[_0x2c92('0x1f')][_0x2c92('0x20')]({'port':0x232c});function respondWithRpcPromise(_0x49df78,_0x4a70ad,_0x5abb43,_0x1f7ffd){return new BPromise(function(_0x4fe88b,_0x458db8){var _0x2a7811=_0x1f7ffd||client;return _0x2a7811[_0x2c92('0x21')](_0x49df78,_0x5abb43)[_0x2c92('0x22')](function(_0x158aef){logger[_0x2c92('0x23')](_0x2c92('0x24'),_0x4a70ad,_0x2c92('0x25'));logger[_0x2c92('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x4a70ad,_0x2c92('0x25'),JSON[_0x2c92('0x27')](_0x158aef));if(_0x158aef[_0x2c92('0x28')]){if(_0x158aef[_0x2c92('0x28')][_0x2c92('0x29')]===0x1f4){logger[_0x2c92('0x28')](_0x2c92('0x24'),_0x4a70ad,_0x158aef[_0x2c92('0x28')][_0x2c92('0x2a')]);return _0x458db8(_0x158aef[_0x2c92('0x28')][_0x2c92('0x2a')]);}logger[_0x2c92('0x28')]('SmsAccount,\x20%s,\x20%s',_0x4a70ad,_0x158aef[_0x2c92('0x28')][_0x2c92('0x2a')]);return _0x4fe88b(_0x158aef[_0x2c92('0x28')]['message']);}else{logger[_0x2c92('0x23')](_0x2c92('0x24'),_0x4a70ad,_0x2c92('0x25'));_0x4fe88b(_0x158aef[_0x2c92('0x2b')][_0x2c92('0x2a')]);}})[_0x2c92('0x2c')](function(_0x6e8000){logger[_0x2c92('0x28')](_0x2c92('0x24'),_0x4a70ad,_0x6e8000);_0x458db8(_0x6e8000);});});}function respondWithStatusCode(_0x48b007,_0x363f15){_0x363f15=_0x363f15||0xcc;return function(_0x2fb525){if(_0x2fb525){return _0x48b007[_0x2c92('0x2d')](_0x363f15);}return _0x48b007['status'](_0x363f15)['end']();};}function respondWithResult(_0x66f9ff,_0xfd2861){_0xfd2861=_0xfd2861||0xc8;return function(_0x2ff620){if(_0x2ff620){return _0x66f9ff[_0x2c92('0x2e')](_0xfd2861)[_0x2c92('0x2f')](_0x2ff620);}};}function respondWithFilteredResult(_0x40a54c,_0x2307f1){return function(_0x37a47e){if(_0x37a47e){var _0x19080f=typeof _0x2307f1[_0x2c92('0x30')]===_0x2c92('0x31')&&typeof _0x2307f1[_0x2c92('0x32')]===_0x2c92('0x31');var _0x2a8729=_0x37a47e[_0x2c92('0x33')];var _0x4f8bd9=_0x19080f?0x0:_0x2307f1[_0x2c92('0x30')];var _0x3173bc=_0x19080f?_0x37a47e[_0x2c92('0x33')]:_0x2307f1['offset']+_0x2307f1[_0x2c92('0x32')];var _0x5738ce;if(_0x3173bc>=_0x2a8729){_0x3173bc=_0x2a8729;_0x5738ce=0xc8;}else{_0x5738ce=0xce;}_0x40a54c[_0x2c92('0x2e')](_0x5738ce);return _0x40a54c['set'](_0x2c92('0x34'),_0x4f8bd9+'-'+_0x3173bc+'/'+_0x2a8729)[_0x2c92('0x2f')](_0x37a47e);}return null;};}function patchUpdates(_0x2df983){return function(_0x17ef8c){try{jsonpatch[_0x2c92('0x35')](_0x17ef8c,_0x2df983,!![]);}catch(_0x1c3b9c){return BPromise[_0x2c92('0x36')](_0x1c3b9c);}return _0x17ef8c[_0x2c92('0x37')]();};}function saveUpdates(_0xd6055c,_0x46efa0){return function(_0x2c1f49){if(_0x2c1f49){return _0x2c1f49[_0x2c92('0x38')](_0xd6055c)[_0x2c92('0x22')](function(_0x1b353e){return _0x1b353e;});}return null;};}function removeEntity(_0x286eef,_0x9cc052){return function(_0x1cc9f3){if(_0x1cc9f3){return _0x1cc9f3[_0x2c92('0x39')]()[_0x2c92('0x22')](function(){var _0xde7fa3=_0x1cc9f3[_0x2c92('0x3a')]({'plain':!![]});var _0x861be6='SmsAccounts';return db[_0x2c92('0x3b')]['destroy']({'where':{'type':_0x861be6,'resourceId':_0xde7fa3['id']}})[_0x2c92('0x22')](function(){return _0x1cc9f3;});})[_0x2c92('0x22')](function(){_0x286eef[_0x2c92('0x2e')](0xcc)[_0x2c92('0x3c')]();});}};}function handleEntityNotFound(_0x267094,_0x1f3c1d){return function(_0x19298b){if(!_0x19298b){_0x267094[_0x2c92('0x2d')](0x194);}return _0x19298b;};}function handleError(_0x21ca32,_0x312794){_0x312794=_0x312794||0x1f4;return function(_0x2fe2af){logger[_0x2c92('0x28')](_0x2fe2af[_0x2c92('0x3d')]);if(_0x2fe2af[_0x2c92('0x3e')]){delete _0x2fe2af[_0x2c92('0x3e')];}_0x21ca32[_0x2c92('0x2e')](_0x312794)[_0x2c92('0x3f')](_0x2fe2af);};}exports[_0x2c92('0x40')]=function(_0xe33311,_0x322cc8){var _0x4432f8={'include':[{'model':db[_0x2c92('0x41')],'as':_0x2c92('0x42')}]},_0x581800={},_0x22cdce={'count':0x0,'rows':[]};var _0xda04ad=_[_0x2c92('0x43')](db['SmsAccount'][_0x2c92('0x44')],function(_0x2fb977){return{'name':_0x2fb977[_0x2c92('0x45')],'type':_0x2fb977[_0x2c92('0x46')][_0x2c92('0x47')]};});_0x581800[_0x2c92('0x48')]=_['map'](_0xda04ad,_0x2c92('0x3e'));_0x581800[_0x2c92('0x49')]=_[_0x2c92('0x4a')](_0xe33311['query']);_0x581800[_0x2c92('0x4b')]=_[_0x2c92('0x4c')](_0x581800['model'],_0x581800[_0x2c92('0x49')]);_0x4432f8[_0x2c92('0x4d')]=_[_0x2c92('0x4c')](_0x581800[_0x2c92('0x48')],qs['fields'](_0xe33311[_0x2c92('0x49')][_0x2c92('0x4e')]));_0x4432f8['attributes']=_0x4432f8['attributes']['length']?_0x4432f8[_0x2c92('0x4d')]:_0x581800[_0x2c92('0x48')];if(!_0xe33311[_0x2c92('0x49')][_0x2c92('0x4f')](_0x2c92('0x50'))){_0x4432f8['limit']=qs[_0x2c92('0x32')](_0xe33311[_0x2c92('0x49')][_0x2c92('0x32')]);_0x4432f8[_0x2c92('0x30')]=qs[_0x2c92('0x30')](_0xe33311[_0x2c92('0x49')][_0x2c92('0x30')]);}_0x4432f8['order']=qs[_0x2c92('0x51')](_0xe33311['query']['sort']);_0x4432f8[_0x2c92('0x52')]=qs['filters'](_[_0x2c92('0x53')](_0xe33311[_0x2c92('0x49')],_0x581800['filters']),_0xda04ad);if(_0xe33311[_0x2c92('0x49')]['filter']){_0x4432f8[_0x2c92('0x52')]=_[_0x2c92('0x54')](_0x4432f8[_0x2c92('0x52')],{'$or':_[_0x2c92('0x43')](_0xda04ad,function(_0x18c4c5){if(_0x18c4c5['type']!==_0x2c92('0x55')){var _0xda9f07={};_0xda9f07[_0x18c4c5[_0x2c92('0x3e')]]={'$like':'%'+_0xe33311[_0x2c92('0x49')]['filter']+'%'};return _0xda9f07;}})});}_0x4432f8=_['merge']({},_0x4432f8,_0xe33311[_0x2c92('0x56')]);var _0x56346a={'where':_0x4432f8[_0x2c92('0x52')]};return db[_0x2c92('0x57')][_0x2c92('0x33')](_0x56346a)[_0x2c92('0x22')](function(_0x467144){_0x22cdce['count']=_0x467144;if(_0xe33311[_0x2c92('0x49')]['includeAll']){_0x4432f8['include']=[{'all':!![]}];}return db[_0x2c92('0x57')][_0x2c92('0x58')](_0x4432f8);})[_0x2c92('0x22')](function(_0xe5b7dd){_0x22cdce['rows']=_0xe5b7dd;return _0x22cdce;})['then'](respondWithFilteredResult(_0x322cc8,_0x4432f8))[_0x2c92('0x2c')](handleError(_0x322cc8,null));};exports[_0x2c92('0x59')]=function(_0x419c39,_0x12418c){var _0x10caba={'raw':![],'where':{'id':_0x419c39[_0x2c92('0x5a')]['id']},'include':[{'model':db['Pause'],'as':_0x2c92('0x42')}]},_0x50f58e={};_0x50f58e[_0x2c92('0x48')]=_['keys'](db[_0x2c92('0x57')][_0x2c92('0x44')]);_0x50f58e[_0x2c92('0x49')]=_[_0x2c92('0x4a')](_0x419c39[_0x2c92('0x49')]);_0x50f58e['filters']=_[_0x2c92('0x4c')](_0x50f58e[_0x2c92('0x48')],_0x50f58e[_0x2c92('0x49')]);_0x10caba[_0x2c92('0x4d')]=_['intersection'](_0x50f58e['model'],qs[_0x2c92('0x4e')](_0x419c39['query'][_0x2c92('0x4e')]));_0x10caba[_0x2c92('0x4d')]=_0x10caba[_0x2c92('0x4d')][_0x2c92('0x5b')]?_0x10caba['attributes']:_0x50f58e[_0x2c92('0x48')];if(_0x419c39['query'][_0x2c92('0x5c')]){_0x10caba['include']=[{'all':!![]}];}_0x10caba=_['merge']({},_0x10caba,_0x419c39['options']);return db[_0x2c92('0x57')][_0x2c92('0x5d')](_0x10caba)[_0x2c92('0x22')](handleEntityNotFound(_0x12418c,null))[_0x2c92('0x22')](respondWithResult(_0x12418c,null))['catch'](handleError(_0x12418c,null));};exports[_0x2c92('0x5e')]=function(_0x2163e7,_0x255266){return db[_0x2c92('0x57')][_0x2c92('0x5e')](_0x2163e7[_0x2c92('0x5f')],{})[_0x2c92('0x22')](function(_0x519ce8){var _0x5eff0f=_0x2163e7[_0x2c92('0x60')][_0x2c92('0x3a')]({'plain':!![]});if(!_0x5eff0f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5eff0f[_0x2c92('0x61')]===_0x2c92('0x60')){var _0x5ee7ef=_0x519ce8[_0x2c92('0x3a')]({'plain':!![]});var _0x26094c=_0x2c92('0x62');return db['UserProfileSection'][_0x2c92('0x5d')]({'where':{'name':_0x26094c,'userProfileId':_0x5eff0f[_0x2c92('0x63')]},'raw':!![]})['then'](function(_0x3105a0){if(_0x3105a0&&_0x3105a0['autoAssociation']===0x0){return db[_0x2c92('0x3b')][_0x2c92('0x5e')]({'name':_0x5ee7ef['name'],'resourceId':_0x5ee7ef['id'],'type':_0x3105a0[_0x2c92('0x3e')],'sectionId':_0x3105a0['id']},{})[_0x2c92('0x22')](function(){return _0x519ce8;});}else{return _0x519ce8;}})[_0x2c92('0x2c')](function(_0x1c2774){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1c2774);throw _0x1c2774;});}return _0x519ce8;})[_0x2c92('0x22')](respondWithResult(_0x255266,0xc9))[_0x2c92('0x2c')](handleError(_0x255266,null));};exports['update']=function(_0x3fbbdd,_0x40d8d6){if(_0x3fbbdd[_0x2c92('0x5f')]['id']){delete _0x3fbbdd['body']['id'];}return db[_0x2c92('0x57')][_0x2c92('0x5d')]({'where':{'id':_0x3fbbdd['params']['id']},'include':[{'model':db[_0x2c92('0x41')],'as':_0x2c92('0x42')}]})['then'](handleEntityNotFound(_0x40d8d6,null))[_0x2c92('0x22')](saveUpdates(_0x3fbbdd[_0x2c92('0x5f')],null))[_0x2c92('0x22')](respondWithResult(_0x40d8d6,null))['catch'](handleError(_0x40d8d6,null));};exports['destroy']=function(_0x464cdf,_0x2cb35a){return db['SmsAccount'][_0x2c92('0x5d')]({'where':{'id':_0x464cdf[_0x2c92('0x5a')]['id']}})[_0x2c92('0x22')](handleEntityNotFound(_0x2cb35a,null))[_0x2c92('0x22')](removeEntity(_0x2cb35a,null))['catch'](handleError(_0x2cb35a,null));};exports[_0x2c92('0x64')]=function(_0x7adf3c,_0x3f2ef9){return db[_0x2c92('0x57')][_0x2c92('0x64')]()['then'](respondWithResult(_0x3f2ef9,null))[_0x2c92('0x2c')](handleError(_0x3f2ef9,null));};exports[_0x2c92('0x65')]=function(_0x213317,_0x258236,_0x4a0408){if(_0x213317['body']['id']){delete _0x213317['body']['id'];}return db['SmsAccount'][_0x2c92('0x5d')]({'where':{'id':_0x213317[_0x2c92('0x5a')]['id']}})[_0x2c92('0x22')](handleEntityNotFound(_0x258236,null))[_0x2c92('0x22')](function(_0x828981){if(_0x828981){_0x213317[_0x2c92('0x5f')][_0x2c92('0x66')]=_0x828981['id'];return db[_0x2c92('0x67')]['create'](_0x213317[_0x2c92('0x5f')]);}})[_0x2c92('0x22')](respondWithResult(_0x258236,null))['catch'](handleError(_0x258236,null));};exports[_0x2c92('0x68')]=function(_0x21bda5,_0x1d28b1,_0x3ccfa4){var _0x29b77f={'raw':![],'where':{}};var _0x54efcf={};var _0x23eec3={'count':0x0,'rows':[]};return db[_0x2c92('0x57')][_0x2c92('0x69')]({'where':{'id':_0x21bda5[_0x2c92('0x5a')]['id']}})['then'](handleEntityNotFound(_0x1d28b1,null))[_0x2c92('0x22')](function(_0xe06008){if(_0xe06008){_0x54efcf[_0x2c92('0x48')]=_['keys'](db[_0x2c92('0x67')]['rawAttributes']);_0x54efcf[_0x2c92('0x49')]=_[_0x2c92('0x4a')](_0x21bda5[_0x2c92('0x49')]);_0x54efcf[_0x2c92('0x4b')]=_[_0x2c92('0x4c')](_0x54efcf[_0x2c92('0x48')],_0x54efcf[_0x2c92('0x49')]);_0x29b77f['attributes']=_[_0x2c92('0x4c')](_0x54efcf[_0x2c92('0x48')],qs[_0x2c92('0x4e')](_0x21bda5['query'][_0x2c92('0x4e')]));_0x29b77f['attributes']=_0x29b77f[_0x2c92('0x4d')][_0x2c92('0x5b')]?_0x29b77f[_0x2c92('0x4d')]:_0x54efcf['model'];if(!_0x21bda5['query'][_0x2c92('0x4f')](_0x2c92('0x50'))){_0x29b77f[_0x2c92('0x32')]=qs['limit'](_0x21bda5[_0x2c92('0x49')][_0x2c92('0x32')]);_0x29b77f['offset']=qs[_0x2c92('0x30')](_0x21bda5[_0x2c92('0x49')]['offset']);}_0x29b77f[_0x2c92('0x6a')]=qs['sort'](_0x21bda5[_0x2c92('0x49')]['sort']);_0x29b77f[_0x2c92('0x52')]=qs[_0x2c92('0x4b')](_['pick'](_0x21bda5[_0x2c92('0x49')],_0x54efcf[_0x2c92('0x4b')]));_0x29b77f[_0x2c92('0x52')][_0x2c92('0x66')]=_0xe06008['id'];if(_0x21bda5[_0x2c92('0x49')][_0x2c92('0x6b')]){_0x29b77f[_0x2c92('0x52')]=_[_0x2c92('0x54')](_0x29b77f[_0x2c92('0x52')],{'$or':_[_0x2c92('0x43')](_0x29b77f[_0x2c92('0x4d')],function(_0x5467b1){var _0x233830={};_0x233830[_0x5467b1]={'$like':'%'+_0x21bda5[_0x2c92('0x49')][_0x2c92('0x6b')]+'%'};return _0x233830;})});}_0x29b77f=_['merge']({},_0x29b77f,_0x21bda5['options']);return db[_0x2c92('0x67')][_0x2c92('0x33')]({'where':_0x29b77f[_0x2c92('0x52')]})[_0x2c92('0x22')](function(_0x5aa313){_0x23eec3[_0x2c92('0x33')]=_0x5aa313;if(_0x21bda5[_0x2c92('0x49')][_0x2c92('0x5c')]){_0x29b77f['include']=[{'all':!![]}];}return db['Disposition'][_0x2c92('0x58')](_0x29b77f);})[_0x2c92('0x22')](function(_0x4f000a){_0x23eec3[_0x2c92('0x6c')]=_0x4f000a;return _0x23eec3;});}})[_0x2c92('0x22')](respondWithFilteredResult(_0x1d28b1,_0x29b77f))[_0x2c92('0x2c')](handleError(_0x1d28b1,null));};exports[_0x2c92('0x6d')]=function(_0x332f05,_0x1aef29,_0x239eff){return db[_0x2c92('0x57')][_0x2c92('0x5d')]({'where':{'id':_0x332f05['params']['id']}})['then'](handleEntityNotFound(_0x1aef29,null))['then'](function(_0x2ecbc8){if(_0x2ecbc8){return _0x2ecbc8[_0x2c92('0x6d')](_0x332f05[_0x2c92('0x49')][_0x2c92('0x6e')]);}})[_0x2c92('0x22')](respondWithStatusCode(_0x1aef29,null))['catch'](handleError(_0x1aef29,null));};exports[_0x2c92('0x6f')]=function(_0x15fae5,_0x5aa094,_0x1d3b2c){if(_0x15fae5[_0x2c92('0x5f')]['id']){delete _0x15fae5[_0x2c92('0x5f')]['id'];}return db[_0x2c92('0x57')]['find']({'where':{'id':_0x15fae5[_0x2c92('0x5a')]['id']}})[_0x2c92('0x22')](handleEntityNotFound(_0x5aa094,null))[_0x2c92('0x22')](function(_0x1300ca){if(_0x1300ca){_0x15fae5['body']['SmsAccountId']=_0x1300ca['id'];return db[_0x2c92('0x70')][_0x2c92('0x5e')](_0x15fae5[_0x2c92('0x5f')]);}})['then'](respondWithResult(_0x5aa094,null))[_0x2c92('0x2c')](handleError(_0x5aa094,null));};exports[_0x2c92('0x71')]=function(_0xe6b7c,_0x9dae94,_0x66bb1d){var _0x4b3189={'raw':![],'where':{}};var _0x562664={};var _0x5afe34={'count':0x0,'rows':[]};return db[_0x2c92('0x57')][_0x2c92('0x69')]({'where':{'id':_0xe6b7c[_0x2c92('0x5a')]['id']}})[_0x2c92('0x22')](handleEntityNotFound(_0x9dae94,null))['then'](function(_0x2a69d8){if(_0x2a69d8){_0x562664[_0x2c92('0x48')]=_[_0x2c92('0x4a')](db[_0x2c92('0x70')][_0x2c92('0x44')]);_0x562664[_0x2c92('0x49')]=_['keys'](_0xe6b7c[_0x2c92('0x49')]);_0x562664[_0x2c92('0x4b')]=_[_0x2c92('0x4c')](_0x562664[_0x2c92('0x48')],_0x562664[_0x2c92('0x49')]);_0x4b3189[_0x2c92('0x4d')]=_[_0x2c92('0x4c')](_0x562664[_0x2c92('0x48')],qs[_0x2c92('0x4e')](_0xe6b7c[_0x2c92('0x49')][_0x2c92('0x4e')]));_0x4b3189[_0x2c92('0x4d')]=_0x4b3189[_0x2c92('0x4d')][_0x2c92('0x5b')]?_0x4b3189[_0x2c92('0x4d')]:_0x562664['model'];if(!_0xe6b7c[_0x2c92('0x49')][_0x2c92('0x4f')](_0x2c92('0x50'))){_0x4b3189[_0x2c92('0x32')]=qs['limit'](_0xe6b7c[_0x2c92('0x49')]['limit']);_0x4b3189['offset']=qs[_0x2c92('0x30')](_0xe6b7c[_0x2c92('0x49')]['offset']);}_0x4b3189[_0x2c92('0x6a')]=qs['sort'](_0xe6b7c[_0x2c92('0x49')][_0x2c92('0x51')]);_0x4b3189['where']=qs[_0x2c92('0x4b')](_['pick'](_0xe6b7c[_0x2c92('0x49')],_0x562664[_0x2c92('0x4b')]));_0x4b3189['where']['SmsAccountId']=_0x2a69d8['id'];if(_0xe6b7c[_0x2c92('0x49')][_0x2c92('0x6b')]){_0x4b3189[_0x2c92('0x52')]=_[_0x2c92('0x54')](_0x4b3189[_0x2c92('0x52')],{'$or':_[_0x2c92('0x43')](_0x4b3189[_0x2c92('0x4d')],function(_0x35fcf4){var _0x4d75b4={};_0x4d75b4[_0x35fcf4]={'$like':'%'+_0xe6b7c[_0x2c92('0x49')][_0x2c92('0x6b')]+'%'};return _0x4d75b4;})});}_0x4b3189=_[_0x2c92('0x54')]({},_0x4b3189,_0xe6b7c[_0x2c92('0x56')]);return db[_0x2c92('0x70')][_0x2c92('0x33')]({'where':_0x4b3189['where']})[_0x2c92('0x22')](function(_0x511999){_0x5afe34[_0x2c92('0x33')]=_0x511999;if(_0xe6b7c[_0x2c92('0x49')][_0x2c92('0x5c')]){_0x4b3189['include']=[{'all':!![]}];}return db[_0x2c92('0x70')]['findAll'](_0x4b3189);})[_0x2c92('0x22')](function(_0x36b0bb){_0x5afe34[_0x2c92('0x6c')]=_0x36b0bb;return _0x5afe34;});}})[_0x2c92('0x22')](respondWithFilteredResult(_0x9dae94,_0x4b3189))[_0x2c92('0x2c')](handleError(_0x9dae94,null));};exports['removeAnswers']=function(_0x5578d2,_0x279c72,_0x279d43){return db[_0x2c92('0x57')][_0x2c92('0x5d')]({'where':{'id':_0x5578d2[_0x2c92('0x5a')]['id']}})['then'](handleEntityNotFound(_0x279c72,null))[_0x2c92('0x22')](function(_0x521305){if(_0x521305){return _0x521305[_0x2c92('0x72')](_0x5578d2[_0x2c92('0x49')][_0x2c92('0x6e')]);}})[_0x2c92('0x22')](respondWithStatusCode(_0x279c72,null))[_0x2c92('0x2c')](handleError(_0x279c72,null));};exports[_0x2c92('0x73')]=function(_0x4052cd,_0x2d32b0,_0x1dbcbe){var _0x558ee2={'channel':_0x2c92('0x74')};var _0x287b63=[];var _0x256bdf=[];var _0x290ca4={};return db[_0x2c92('0x57')][_0x2c92('0x5d')]({'where':{'id':_0x4052cd['params']['id']},'include':[{'model':db[_0x2c92('0x75')],'as':_0x2c92('0x76')}]})[_0x2c92('0x22')](handleEntityNotFound(_0x2d32b0,null))[_0x2c92('0x22')](function(_0x3551b1){_0x558ee2[_0x2c92('0x77')]=_0x3551b1;_0x558ee2[_0x2c92('0x78')]=_[_0x2c92('0x79')](_0x3551b1[_0x2c92('0x76')],[_0x2c92('0x7a')],[_0x2c92('0x7b')]);if(_0x558ee2[_0x2c92('0x77')][_0x2c92('0x76')]){delete _0x558ee2[_0x2c92('0x77')]['Applications'];}return db[_0x2c92('0x7c')][_0x2c92('0x64')]();})[_0x2c92('0x22')](function(_0x5c71c2){if(!_0x5c71c2){throw new db[(_0x2c92('0x7d'))]['ValidationError'](_0x2c92('0x7e'));}_0x287b63=_[_0x2c92('0x7f')](_[_0x2c92('0x4a')](_0x5c71c2),[_0x2c92('0x80'),_0x2c92('0x81')]);_0x256bdf=_[_0x2c92('0x7f')](_[_0x2c92('0x4a')](_0x5c71c2),[_0x2c92('0x80'),_0x2c92('0x81'),_0x2c92('0x82'),'ListId']);_0x558ee2[_0x2c92('0x5f')]={'mapKey':'mobile'};if(_0x558ee2[_0x2c92('0x77')][_0x2c92('0x46')]){switch(_0x558ee2['account']['type']){case _0x2c92('0x83'):_0x558ee2[_0x2c92('0x5f')][_0x2c92('0x84')]=_0x4052cd['body'][_0x2c92('0x85')];_0x558ee2[_0x2c92('0x5f')][_0x2c92('0x5f')]=_0x4052cd['body']['Body'];_0x558ee2['body'][_0x2c92('0x86')]=_0x4052cd[_0x2c92('0x5f')]['MessageSid'];break;case _0x2c92('0x87'):_0x558ee2[_0x2c92('0x5f')][_0x2c92('0x84')]='+'+_0x4052cd[_0x2c92('0x5f')][_0x2c92('0x88')];_0x558ee2[_0x2c92('0x5f')]['body']=_0x4052cd[_0x2c92('0x5f')][_0x2c92('0x89')];break;case _0x2c92('0x8a'):_0x558ee2[_0x2c92('0x5f')][_0x2c92('0x84')]=_0x4052cd[_0x2c92('0x5f')][_0x2c92('0x84')];_0x558ee2[_0x2c92('0x5f')]['body']=_0x4052cd[_0x2c92('0x5f')][_0x2c92('0x2a')];break;case _0x2c92('0x8b'):_0x558ee2['body']['from']=_0x4052cd[_0x2c92('0x5f')][_0x2c92('0x84')];_0x558ee2[_0x2c92('0x5f')][_0x2c92('0x5f')]=_0x4052cd['body'][_0x2c92('0x5f')];_0x558ee2[_0x2c92('0x5f')][_0x2c92('0x86')]=_0x4052cd['body'][_0x2c92('0x8c')];break;case _0x2c92('0x8d'):_0x558ee2['body'][_0x2c92('0x84')]=_0x4052cd[_0x2c92('0x5f')][_0x2c92('0x85')];_0x558ee2[_0x2c92('0x5f')][_0x2c92('0x5f')]=_0x4052cd[_0x2c92('0x5f')][_0x2c92('0x8e')];_0x558ee2[_0x2c92('0x5f')][_0x2c92('0x86')]=_0x4052cd['body'][_0x2c92('0x8f')];break;case'infobip':_0x558ee2[_0x2c92('0x5f')][_0x2c92('0x84')]='+'+_0x4052cd[_0x2c92('0x5f')][_0x2c92('0x90')][0x0][_0x2c92('0x84')];_0x558ee2[_0x2c92('0x5f')][_0x2c92('0x5f')]=_0x4052cd[_0x2c92('0x5f')][_0x2c92('0x90')][0x0][_0x2c92('0x89')];_0x558ee2[_0x2c92('0x5f')][_0x2c92('0x86')]=_0x4052cd[_0x2c92('0x5f')][_0x2c92('0x90')][0x0][_0x2c92('0x86')];break;case _0x2c92('0x91'):_0x558ee2[_0x2c92('0x5f')][_0x2c92('0x84')]=_0x4052cd[_0x2c92('0x5f')]['originatingAddress'];_0x558ee2[_0x2c92('0x5f')][_0x2c92('0x5f')]=_0x4052cd[_0x2c92('0x5f')][_0x2c92('0x92')][_0x2c92('0x2a')];break;case _0x2c92('0x93'):_0x558ee2[_0x2c92('0x5f')][_0x2c92('0x84')]=_0x4052cd[_0x2c92('0x5f')][_0x2c92('0x94')];_0x558ee2[_0x2c92('0x5f')][_0x2c92('0x5f')]=_0x4052cd[_0x2c92('0x5f')][_0x2c92('0x89')];_0x558ee2[_0x2c92('0x5f')][_0x2c92('0x86')]=_0x4052cd[_0x2c92('0x5f')][_0x2c92('0x95')];break;case _0x2c92('0x96'):_0x558ee2[_0x2c92('0x5f')]['messageId']=_0x4052cd[_0x2c92('0x5f')][0x0][_0x2c92('0x2a')]['id'];_0x558ee2[_0x2c92('0x5f')]['from']=_0x4052cd[_0x2c92('0x5f')][0x0][_0x2c92('0x2a')][_0x2c92('0x84')];_0x558ee2[_0x2c92('0x5f')][_0x2c92('0x5f')]=_0x4052cd['body'][0x0]['message'][_0x2c92('0x89')];break;case _0x2c92('0x97'):_0x558ee2['body'][_0x2c92('0x84')]=_0x4052cd[_0x2c92('0x5f')][_0x2c92('0x84')];_0x558ee2['body'][_0x2c92('0x5f')]=_0x4052cd['body'][_0x2c92('0x2a')];_0x558ee2['body']['messageId']=_0x4052cd['body'][_0x2c92('0x98')];break;}}if(_0x558ee2[_0x2c92('0x5f')]['id']){delete _0x558ee2[_0x2c92('0x5f')]['id'];}if(_[_0x2c92('0x99')](_0x558ee2[_0x2c92('0x5f')][_0x2c92('0x84')])){throw new db[(_0x2c92('0x7d'))][(_0x2c92('0x9a'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x558ee2[_0x2c92('0x5f')][_0x2c92('0x5f')])||_0x558ee2[_0x2c92('0x5f')][_0x2c92('0x5f')]===''){throw new db['Sequelize'][(_0x2c92('0x9a'))](_0x2c92('0x9b'));}if(_[_0x2c92('0x99')](_0x558ee2[_0x2c92('0x5f')][_0x2c92('0x9c')])){throw new db[(_0x2c92('0x7d'))][(_0x2c92('0x9a'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x256bdf);}if(!_[_0x2c92('0x9d')](_0x256bdf,_0x558ee2[_0x2c92('0x5f')][_0x2c92('0x9c')])){throw new db[(_0x2c92('0x7d'))]['ValidationError'](_0x2c92('0x9e')+_0x256bdf);}_0x290ca4[_0x558ee2[_0x2c92('0x5f')][_0x2c92('0x9c')]]=_0x558ee2[_0x2c92('0x5f')]['from'];return db['CmList']['find']({'where':{'id':_0x558ee2[_0x2c92('0x77')][_0x2c92('0x9f')]},'include':[{'model':db['CmContact'],'as':_0x2c92('0xa0'),'where':_0x290ca4,'limit':0x1,'order':[[_0x2c92('0x81'),'DESC']]}]});})[_0x2c92('0x22')](handleEntityNotFound(_0x2d32b0,null))[_0x2c92('0x22')](function(_0x2c3df1){if(_0x2c3df1){_0x558ee2[_0x2c92('0xa1')]=_[_0x2c92('0xa2')](_0x2c3df1,[_0x2c92('0xa0')]);if(_0x2c3df1[_0x2c92('0xa0')][_0x2c92('0x5b')]){return _0x2c3df1[_0x2c92('0xa0')][0x0];}var _0x35e9a2=_[_0x2c92('0xa3')](_0x558ee2[_0x2c92('0x5f')],{'firstName':_0x558ee2[_0x2c92('0x5f')]['from'],'ListId':_0x2c3df1['id']});_0x35e9a2[_0x558ee2[_0x2c92('0x5f')][_0x2c92('0x9c')]]=_0x558ee2[_0x2c92('0x5f')][_0x2c92('0x84')];return db['CmContact'][_0x2c92('0x5e')](_0x35e9a2,{'fields':_0x287b63,'raw':!![]});}})[_0x2c92('0x22')](handleEntityNotFound(_0x2d32b0,null))[_0x2c92('0x22')](function(_0x2a1e77){if(_0x2a1e77){_0x558ee2[_0x2c92('0xa4')]=_0x2a1e77;var _0x39c395={'ContactId':_0x2a1e77['id'],'phone':_0x558ee2['body'][_0x2c92('0x84')],'SmsAccountId':_0x4052cd['params']['id']};var _0x96945b={'ContactId':_0x2a1e77['id'],'SmsAccountId':_0x4052cd['params']['id'],'closed':![]};return db[_0x2c92('0xa5')][_0x2c92('0x5d')]({'where':_0x96945b})[_0x2c92('0x22')](function(_0x4e684d){if(_0x4e684d){return[_0x4e684d,![]];}return db['SmsInteraction'][_0x2c92('0x5e')](_0x39c395)['then'](function(_0x2a3db6){return[_0x2a3db6,!![]];});});}})[_0x2c92('0xa6')](function(_0x7bc562,_0x157c56){_0x558ee2[_0x2c92('0xa7')]=_0x7bc562['get']({'plain':!![]});_0x558ee2['interaction'][_0x2c92('0xa8')]=![];if(_0x157c56){if(_0x558ee2[_0x2c92('0x77')]['autoclose']){_0x558ee2[_0x2c92('0x78')]['push']({'id':0x0,'priority':_0x558ee2['applications'][_0x2c92('0x5b')]+0x1,'app':_0x2c92('0xa9'),'appdata':_0x2c92('0xaa'),'interval':_0x2c92('0xab')});}_0x558ee2['interaction'][_0x2c92('0xa8')]=!![];}return db['SmsMessage'][_0x2c92('0x5e')]({'phone':_0x558ee2[_0x2c92('0x5f')][_0x2c92('0x84')],'messageId':_0x558ee2[_0x2c92('0x5f')][_0x2c92('0x86')],'body':_0x558ee2[_0x2c92('0x5f')][_0x2c92('0x5f')],'SmsAccountId':_0x4052cd[_0x2c92('0x5a')]['id'],'SmsInteractionId':_0x7bc562['id'],'direction':'in','ContactId':_0x7bc562[_0x2c92('0xac')],'AttachmentId':_0x558ee2[_0x2c92('0x5f')][_0x2c92('0xad')]});})[_0x2c92('0x22')](function(_0x5e3d33){_0x558ee2['message']=_0x5e3d33;if(!_0x558ee2['interaction'][_0x2c92('0xae')])return;return db[_0x2c92('0xaf')][_0x2c92('0x5d')]({'attributes':['id','name'],'where':{'id':_0x558ee2[_0x2c92('0xa7')][_0x2c92('0xae')]}});})[_0x2c92('0x22')](function(_0x10edf9){if(_0x10edf9){_0x558ee2[_0x2c92('0x78')][_0x2c92('0xb0')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x10edf9['name']+','+(_0x558ee2[_0x2c92('0x77')][_0x2c92('0xb1')]||0xa),'interval':'*,*,*,*'});}if(!_0x558ee2[_0x2c92('0xa7')][_0x2c92('0xb2')])return;return db[_0x2c92('0xb3')][_0x2c92('0x5d')]({'attributes':['id',_0x2c92('0x3e')],'where':{'id':_0x558ee2[_0x2c92('0xa7')][_0x2c92('0xb2')]}});})[_0x2c92('0x22')](function(_0x11e306){if(_0x11e306){_0x558ee2[_0x2c92('0x78')]['unshift']({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x11e306[_0x2c92('0x3e')]+','+(_0x558ee2[_0x2c92('0x77')][_0x2c92('0xb4')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x2c92('0xb5'),_0x2c92('0xb6'),_0x558ee2);})['then'](function(_0x318587){if(_0x318587){var _0xca27b=0xc8;var _0x10eb25='receiveMessage';logger[_0x2c92('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x10eb25,_0xca27b,'entity\x20found');logger[_0x2c92('0x26')](_0x2c92('0xb7'),_0x10eb25,_0xca27b,_0x2c92('0xb8'),JSON[_0x2c92('0x27')](_0x318587));if(_0x558ee2[_0x2c92('0x77')][_0x2c92('0x46')]===_0x2c92('0x83')){return _0x2d32b0[_0x2c92('0x2e')](_0xca27b)['set'](_0x2c92('0xb9'),_0x2c92('0xba'))[_0x2c92('0x3f')](_0x2c92('0xbb'));}else{return _0x2d32b0[_0x2c92('0x2e')](_0xca27b)[_0x2c92('0x2f')](_0x318587);}}})['catch'](handleError(_0x2d32b0,null));};exports['addApplications']=function(_0x4398ae,_0x273357){var _0x2235f9=_0x4398ae['params']['id'];var _0x35086e=_0x4398ae[_0x2c92('0x5f')];var _0x2b3089=0xc8;var _0x13d4e8=null;return db[_0x2c92('0xbc')][_0x2c92('0xbd')]({'isolationLevel':db[_0x2c92('0xbc')][_0x2c92('0xbe')][_0x2c92('0xbf')][_0x2c92('0xc0')]},function(_0x5959f6){return db['SmsAccount'][_0x2c92('0x69')]({'where':{'id':_0x2235f9},'transaction':_0x5959f6})['then'](function(_0x5973b9){if(_0x5973b9){return db[_0x2c92('0x75')]['destroy']({'where':{'SmsAccountId':_0x2235f9},'transaction':_0x5959f6})['then'](function(){var _0x37d99a=_['map'](_0x35086e,function(_0x1f41b0){_0x1f41b0['SmsAccountId']=_0x2235f9;return _0x1f41b0;});return db['SmsApplication'][_0x2c92('0xc1')](_0x37d99a,{'transaction':_0x5959f6});});}else{_0x2b3089=0x194;_0x13d4e8=[];}});})[_0x2c92('0x22')](function(){if(_0x2b3089!==0x194){return db[_0x2c92('0x75')]['findAndCountAll']({'where':{'SmsAccountId':_0x2235f9},'order':_0x2c92('0x7a')})[_0x2c92('0x22')](function(_0x2cf040){_0x13d4e8=_0x2cf040;});}})[_0x2c92('0x2c')](function(_0x283c5c){_0x2b3089=0x1f4;logger[_0x2c92('0x28')](_0x283c5c[_0x2c92('0x3d')]);if(_0x283c5c[_0x2c92('0x3e')]){delete _0x283c5c[_0x2c92('0x3e')];}_0x13d4e8=_0x283c5c;})[_0x2c92('0xc2')](function(){if(_0x13d4e8===null){_0x273357['sendStatus'](_0x2b3089);}else{if(_0x2b3089===0x1f4){_0x273357[_0x2c92('0x2e')](_0x2b3089)[_0x2c92('0x3f')](_0x13d4e8);}else{_0x273357['status'](_0x2b3089)[_0x2c92('0x2f')](_0x13d4e8);}}});};exports[_0x2c92('0xc3')]=function(_0x68157c,_0x451df2,_0x498a31){var _0x22a17a={};var _0x4d4823={};var _0x43a5f1;var _0x33b130;return db[_0x2c92('0x57')][_0x2c92('0x69')]({'where':{'id':_0x68157c[_0x2c92('0x5a')]['id']}})[_0x2c92('0x22')](handleEntityNotFound(_0x451df2,null))[_0x2c92('0x22')](function(_0x423b3e){if(_0x423b3e){_0x43a5f1=_0x423b3e;_0x4d4823['model']=_[_0x2c92('0x4a')](db[_0x2c92('0x75')][_0x2c92('0x44')]);_0x4d4823[_0x2c92('0x49')]=_['keys'](_0x68157c[_0x2c92('0x49')]);_0x4d4823['filters']=_[_0x2c92('0x4c')](_0x4d4823[_0x2c92('0x48')],_0x4d4823[_0x2c92('0x49')]);_0x22a17a[_0x2c92('0x4d')]=_['intersection'](_0x4d4823[_0x2c92('0x48')],qs[_0x2c92('0x4e')](_0x68157c[_0x2c92('0x49')][_0x2c92('0x4e')]));_0x22a17a['attributes']=_0x22a17a[_0x2c92('0x4d')]['length']?_0x22a17a[_0x2c92('0x4d')]:_0x4d4823[_0x2c92('0x48')];_0x22a17a[_0x2c92('0x6a')]=qs[_0x2c92('0x51')](_0x68157c[_0x2c92('0x49')]['sort']);_0x22a17a['where']=qs[_0x2c92('0x4b')](_['pick'](_0x68157c['query'],_0x4d4823['filters']));if(_0x68157c[_0x2c92('0x49')][_0x2c92('0x6b')]){_0x22a17a[_0x2c92('0x52')]=_['merge'](_0x22a17a[_0x2c92('0x52')],{'$or':_[_0x2c92('0x43')](_0x22a17a['attributes'],function(_0x3959b4){var _0xc2d715={};_0xc2d715[_0x3959b4]={'$like':'%'+_0x68157c['query'][_0x2c92('0x6b')]+'%'};return _0xc2d715;})});}_0x22a17a=_['merge']({},_0x22a17a,_0x68157c[_0x2c92('0x56')]);return _0x43a5f1['getApplications'](_0x22a17a);}})[_0x2c92('0x22')](function(_0x1ce722){if(_0x1ce722){_0x33b130=_0x1ce722[_0x2c92('0x5b')];if(!_0x68157c[_0x2c92('0x49')][_0x2c92('0x4f')](_0x2c92('0x50'))){_0x22a17a['limit']=qs['limit'](_0x68157c['query']['limit']);_0x22a17a['offset']=qs[_0x2c92('0x30')](_0x68157c['query']['offset']);}return _0x43a5f1[_0x2c92('0xc3')](_0x22a17a);}})[_0x2c92('0x22')](function(_0x459d76){if(_0x459d76){return _0x459d76?{'count':_0x33b130,'rows':_0x459d76}:null;}})[_0x2c92('0x22')](respondWithResult(_0x451df2,null))['catch'](handleError(_0x451df2,null));};exports['getInteractions']=function(_0x2a2d61,_0x50e09b,_0x3edd82){var _0x17aaba={'raw':![],'where':{}};var _0x428fc8={};var _0x4ff498={'count':0x0,'rows':[]};return db[_0x2c92('0x57')][_0x2c92('0x69')]({'where':{'id':_0x2a2d61['params']['id']}})[_0x2c92('0x22')](handleEntityNotFound(_0x50e09b,null))[_0x2c92('0x22')](function(_0x2717ff){if(_0x2717ff){_0x428fc8['model']=_[_0x2c92('0x4a')](db[_0x2c92('0xa5')][_0x2c92('0x44')]);_0x428fc8['query']=_['keys'](_0x2a2d61[_0x2c92('0x49')]);_0x428fc8[_0x2c92('0x4b')]=_[_0x2c92('0x4c')](_0x428fc8[_0x2c92('0x48')],_0x428fc8['query']);_0x17aaba[_0x2c92('0x4d')]=_[_0x2c92('0x4c')](_0x428fc8[_0x2c92('0x48')],qs[_0x2c92('0x4e')](_0x2a2d61[_0x2c92('0x49')][_0x2c92('0x4e')]));_0x17aaba[_0x2c92('0x4d')]=_0x17aaba[_0x2c92('0x4d')][_0x2c92('0x5b')]?_0x17aaba['attributes']:_0x428fc8[_0x2c92('0x48')];if(!_0x2a2d61[_0x2c92('0x49')][_0x2c92('0x4f')](_0x2c92('0x50'))){_0x17aaba['limit']=qs['limit'](_0x2a2d61[_0x2c92('0x49')][_0x2c92('0x32')]);_0x17aaba[_0x2c92('0x30')]=qs[_0x2c92('0x30')](_0x2a2d61[_0x2c92('0x49')]['offset']);}_0x17aaba[_0x2c92('0x6a')]=qs[_0x2c92('0x51')](_0x2a2d61[_0x2c92('0x49')][_0x2c92('0x51')]);_0x17aaba[_0x2c92('0x52')]=qs[_0x2c92('0x4b')](_['pick'](_0x2a2d61[_0x2c92('0x49')],_0x428fc8[_0x2c92('0x4b')]));_0x17aaba[_0x2c92('0x52')][_0x2c92('0x66')]=_0x2717ff['id'];if(_0x2a2d61[_0x2c92('0x49')]['filter']){_0x17aaba['where']=_['merge'](_0x17aaba[_0x2c92('0x52')],{'$or':_[_0x2c92('0x43')](_0x17aaba[_0x2c92('0x4d')],function(_0x23f4bc){var _0x3def66={};_0x3def66[_0x23f4bc]={'$like':'%'+_0x2a2d61[_0x2c92('0x49')][_0x2c92('0x6b')]+'%'};return _0x3def66;})});}_0x17aaba=_['merge']({},_0x17aaba,_0x2a2d61[_0x2c92('0x56')]);return db[_0x2c92('0xa5')]['count']({'where':_0x17aaba[_0x2c92('0x52')]})['then'](function(_0x3a5f02){_0x4ff498[_0x2c92('0x33')]=_0x3a5f02;if(_0x2a2d61['query']['includeAll']){_0x17aaba['include']=[{'model':db['CmContact'],'as':_0x2c92('0xc4'),'required':![]},{'model':db[_0x2c92('0xaf')],'as':_0x2c92('0xc5'),'attributes':['name',_0x2c92('0xc6'),_0x2c92('0xc7')],'required':![]},{'model':db['Tag'],'as':_0x2c92('0xc8'),'attributes':['id',_0x2c92('0x3e'),_0x2c92('0xc9')],'where':_0x2a2d61[_0x2c92('0x49')][_0x2c92('0xca')]?{'id':_0x2a2d61[_0x2c92('0x49')][_0x2c92('0xca')]}:undefined,'required':_0x2a2d61['query']['tag']?!![]:![]}];}return db[_0x2c92('0xa5')][_0x2c92('0x58')](_0x17aaba);})[_0x2c92('0x22')](function(_0x4dc2c7){_0x4ff498[_0x2c92('0x6c')]=_0x4dc2c7;return _0x4ff498;});}})[_0x2c92('0x22')](respondWithFilteredResult(_0x50e09b,_0x17aaba))[_0x2c92('0x2c')](handleError(_0x50e09b,null));};exports[_0x2c92('0x3f')]=function(_0x3815ab,_0x49258f,_0x3e6db2){var _0x4a2215,_0x3805a7,_0x3b962d;if(_[_0x2c92('0x99')](_0x3815ab[_0x2c92('0x5f')]['body'])||_0x3815ab['body'][_0x2c92('0x5f')]===''){throw new db[(_0x2c92('0x7d'))][(_0x2c92('0x9a'))](_0x2c92('0x9b'));}if(_[_0x2c92('0x99')](_0x3815ab['body']['to'])){throw new db[(_0x2c92('0x7d'))][(_0x2c92('0x9a'))](_0x2c92('0xcb'));}_0x4a2215=_0x3815ab[_0x2c92('0x5f')]['to'];return db[_0x2c92('0x57')]['find']({'where':{'id':_0x3815ab['params']['id']},'include':[{'model':db[_0x2c92('0xcc')],'as':_0x2c92('0xcd'),'include':[{'model':db[_0x2c92('0x7c')],'as':_0x2c92('0xa0'),'where':{'mobile':_0x4a2215},'limit':0x1,'order':[[_0x2c92('0x81'),_0x2c92('0xce')]]}]}]})['then'](handleEntityNotFound(_0x49258f,null))[_0x2c92('0x22')](function(_0x3a6b06){if(_0x3a6b06&&_0x3a6b06[_0x2c92('0xcd')]){_0x3805a7=_0x3a6b06[_0x2c92('0x3a')]({'plain':!![]});if(_0x3805a7['List']&&_0x3805a7['List']['Contacts'][_0x2c92('0x5b')]){return _0x3805a7[_0x2c92('0xcd')][_0x2c92('0xa0')][0x0];}return db[_0x2c92('0x7c')][_0x2c92('0x5e')](_[_0x2c92('0xa3')](_0x3815ab[_0x2c92('0x5f')],{'firstName':_0x4a2215,'mobile':_0x4a2215,'phone':_0x4a2215,'ListId':_0x3805a7['ListId']}));}})[_0x2c92('0x22')](handleEntityNotFound(_0x49258f,null))['then'](function(_0x266dc4){if(_0x266dc4){_0x3b962d=_0x266dc4;return db[_0x2c92('0xa5')]['find']({'where':{'ContactId':_0x3b962d['id'],'closed':![],'SmsAccountId':_0x3805a7['id']}})[_0x2c92('0x22')](function(_0x21d626){if(_0x21d626){return[_0x21d626,![]];}return db[_0x2c92('0xa5')][_0x2c92('0x5e')]({'UserId':_0x3815ab[_0x2c92('0x60')]['id'],'ContactId':_0x3b962d['id'],'SmsAccountId':_0x3805a7['id'],'phone':_0x4a2215,'firstMsgDirection':'out','Messages':[_[_0x2c92('0x54')](_0x3815ab[_0x2c92('0x5f')],{'read':![],'body':_0x3815ab[_0x2c92('0x5f')][_0x2c92('0x5f')],'phone':_0x4a2215,'SmsAccountId':_0x3805a7['id'],'UserId':_0x3815ab[_0x2c92('0x60')]['id'],'ContactId':_0x3b962d['id']})]},{'include':[{'model':db[_0x2c92('0xcf')],'as':_0x2c92('0xd0')}]})[_0x2c92('0x22')](function(_0x2f6fa0){return[_0x2f6fa0,!![]];});});}})[_0x2c92('0xa6')](function(_0x3ad0a6,_0x34961a){if(_0x34961a){return _0x3ad0a6;}return db[_0x2c92('0xcf')][_0x2c92('0x5e')](_['merge'](_0x3815ab[_0x2c92('0x5f')],{'read':![],'body':_0x3815ab[_0x2c92('0x5f')]['body'],'phone':_0x4a2215,'SmsAccountId':_0x3805a7['id'],'SmsInteractionId':_0x3ad0a6['id'],'UserId':_0x3815ab['user']['id'],'ContactId':_0x3b962d['id']}))[_0x2c92('0x22')](function(_0xeae792){_0x3ad0a6[_0x2c92('0xd1')][_0x2c92('0xd0')]=[];_0x3ad0a6['dataValues'][_0x2c92('0xd0')][_0x2c92('0xd2')](_0xeae792[_0x2c92('0xd1')]);return _0x3ad0a6;});})[_0x2c92('0x22')](respondWithResult(_0x49258f,null))[_0x2c92('0x2c')](handleError(_0x49258f,null));};exports[_0x2c92('0x2e')]=function(_0x315e2a,_0x33d6c2,_0x1e1546){if(_0x315e2a['body']['id']){delete _0x315e2a[_0x2c92('0x5f')]['id'];}var _0x32b423,_0x402ec8,_0xa1fb4d;return db[_0x2c92('0x57')][_0x2c92('0x5d')]({'where':{'id':_0x315e2a['params']['id']}})[_0x2c92('0x22')](handleEntityNotFound(_0x33d6c2,null))[_0x2c92('0x22')](function(_0x46b1be){if(_0x46b1be){_0xa1fb4d=_0x46b1be;logger[_0x2c92('0x26')](_0x2c92('0xd3'),_0x2c92('0x2e'),_0x2c92('0xd4'),_0x46b1be['type'],util['inspect'](_0x315e2a[_0x2c92('0x5f')],{'showHidden':![],'depth':null}));switch(_0x46b1be['type']){case _0x2c92('0x87'):if(_0x315e2a[_0x2c92('0x5f')][_0x2c92('0xd5')]&&_0x315e2a['body'][_0x2c92('0x2e')]){_0x402ec8=_0x315e2a[_0x2c92('0x5f')]['status'];return db[_0x2c92('0xcf')][_0x2c92('0x5d')]({'where':{'messageId':_0x315e2a['body'][_0x2c92('0xd5')]}});}break;case _0x2c92('0x8a'):if(_0x315e2a[_0x2c92('0x5f')][_0x2c92('0xd6')]&&_0x315e2a[_0x2c92('0x5f')][_0x2c92('0xd7')]){_0x402ec8=_0x315e2a[_0x2c92('0x5f')][_0x2c92('0xd7')];return db['SmsMessage']['find']({'where':{'messageId':_0x315e2a['body'][_0x2c92('0xd6')]}});}break;case _0x2c92('0x8b'):if(_0x315e2a[_0x2c92('0x5f')][_0x2c92('0x8c')]&&_0x315e2a[_0x2c92('0x5f')][_0x2c92('0xd8')]){_0x402ec8=_0x315e2a[_0x2c92('0x5f')][_0x2c92('0xd8')];return db['SmsMessage'][_0x2c92('0x5d')]({'where':{'messageId':_0x315e2a[_0x2c92('0x5f')][_0x2c92('0x8c')]}});}break;case _0x2c92('0xd9'):var _0x4329ff=_0x315e2a[_0x2c92('0x5f')]['results'][0x0];if(_0x4329ff['messageId']&&_0x4329ff[_0x2c92('0x2e')]['groupName']==='DELIVERED'){_0x402ec8=_0x4329ff['status'][_0x2c92('0xda')];return db[_0x2c92('0xcf')][_0x2c92('0x5d')]({'where':{'messageId':_0x4329ff[_0x2c92('0x86')]}});}break;case _0x2c92('0x93'):if(_0x315e2a[_0x2c92('0x5f')][_0x2c92('0x86')]&&_0x315e2a[_0x2c92('0x5f')][_0x2c92('0x2e')]){_0x402ec8=_0x315e2a['body'][_0x2c92('0x2e')];return db[_0x2c92('0xcf')]['find']({'where':{'messageId':_0x315e2a[_0x2c92('0x5f')][_0x2c92('0x86')]}});}break;case _0x2c92('0x96'):if(_0x315e2a[_0x2c92('0x5f')][0x0][_0x2c92('0x2a')]['id']){_0x402ec8=_0x315e2a['body'][0x0]['type'];return db['SmsMessage'][_0x2c92('0x5d')]({'where':{'messageId':_0x315e2a['body'][0x0][_0x2c92('0x2a')]['id']}});}break;case _0x2c92('0x97'):if(_0x315e2a[_0x2c92('0x5f')][_0x2c92('0xdb')]&&_0x315e2a[_0x2c92('0x5f')][_0x2c92('0x2e')]){_0x402ec8=_0x315e2a[_0x2c92('0x5f')][_0x2c92('0x2e')];return db[_0x2c92('0xcf')]['find']({'where':{'messageId':_0x315e2a[_0x2c92('0x5f')][_0x2c92('0xdb')]}});}break;}}})['then'](handleEntityNotFound(_0x33d6c2,null))[_0x2c92('0x22')](function(_0x435da6){if(_0x435da6){_0x32b423=_0x435da6;switch(_0xa1fb4d['type']){case'skebby':if(_0x402ec8===_0x2c92('0xdc')){return _0x32b423[_0x2c92('0x38')]({'read':!![]});}else{logger[_0x2c92('0x28')](_0x2c92('0xd3'),'status','skebby',util[_0x2c92('0xdd')](_0x315e2a[_0x2c92('0x5f')],{'showHidden':![],'depth':null}));}break;case _0x2c92('0x8a'):if(_0x402ec8==='1'){return _0x32b423[_0x2c92('0x38')]({'read':!![]});}else{logger[_0x2c92('0x28')](_0x2c92('0xd3'),_0x2c92('0x2e'),_0x2c92('0x87'),util[_0x2c92('0xdd')](_0x315e2a[_0x2c92('0x5f')],{'showHidden':![],'depth':null}));}break;case _0x2c92('0x8b'):if(!_0x315e2a[_0x2c92('0x5f')][_0x2c92('0xde')]&&_0x402ec8>=0xc8&&_0x402ec8<=0xce){return _0x32b423[_0x2c92('0x38')]({'read':!![]});}else{logger[_0x2c92('0x28')](_0x2c92('0xd3'),'status',_0x2c92('0x8b'),util[_0x2c92('0xdd')](_0x315e2a[_0x2c92('0x5f')],{'showHidden':![],'depth':null}));}break;case _0x2c92('0xd9'):var _0x591c99=_0x315e2a[_0x2c92('0x5f')][_0x2c92('0x90')][0x0];if(_0x591c99['status'][_0x2c92('0xda')]===_0x2c92('0xdc')){return _0x32b423[_0x2c92('0x38')]({'read':!![]});}else{logger['error'](_0x2c92('0xd3'),_0x2c92('0x2e'),_0x2c92('0xd9'),util[_0x2c92('0xdd')](_0x315e2a[_0x2c92('0x5f')],{'showHidden':![],'depth':null}));}break;case _0x2c92('0x93'):if(_0x402ec8==_0x2c92('0xdf')||_0x402ec8==_0x2c92('0xe0')){return _0x32b423[_0x2c92('0x38')]({'read':!![]});}else{logger[_0x2c92('0x28')](_0x2c92('0xd3'),_0x2c92('0x2e'),_0x2c92('0x93'),util[_0x2c92('0xdd')](_0x315e2a[_0x2c92('0x5f')],{'showHidden':![],'depth':null}));}break;case _0x2c92('0x96'):if(_0x402ec8==_0x2c92('0xe1')){return _0x32b423[_0x2c92('0x38')]({'read':!![]});}else{logger[_0x2c92('0x28')](_0x2c92('0xd3'),'status',_0x2c92('0x96'),util[_0x2c92('0xdd')](_0x315e2a[_0x2c92('0x5f')],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0x402ec8===_0x2c92('0xe2')||_0x402ec8===_0x2c92('0xe3')){return _0x32b423[_0x2c92('0x38')]({'read':!![]});}else{logger[_0x2c92('0x28')](_0x2c92('0xd3'),_0x2c92('0x2e'),_0x2c92('0x97'),util[_0x2c92('0xdd')](_0x315e2a[_0x2c92('0x5f')],{'showHidden':![],'depth':null}));}break;}return _0x32b423;}})[_0x2c92('0x22')](respondWithResult(_0x33d6c2,null))[_0x2c92('0x2c')](handleError(_0x33d6c2,null));};exports[_0x2c92('0xe4')]=function(_0x4fcf67,_0x2c4213,_0x2ee38a){var _0x219812,_0x1d1ea6,_0x3d319a;return db[_0x2c92('0x57')][_0x2c92('0x5d')]({'where':{'id':_0x4fcf67['params']['id']}})[_0x2c92('0x22')](handleEntityNotFound(_0x2c4213,null))[_0x2c92('0x22')](function(_0x489c69){if(_0x489c69){_0x3d319a=_0x489c69;logger[_0x2c92('0x26')](_0x2c92('0xd3'),_0x2c92('0x2e'),'received\x20delivery\x20report\x20from',_0x489c69[_0x2c92('0x46')],util[_0x2c92('0xdd')](_0x4fcf67[_0x2c92('0x49')],{'showHidden':![],'depth':null}));switch(_0x489c69['type']){case _0x2c92('0x91'):if(_0x4fcf67[_0x2c92('0x49')][_0x2c92('0xe5')]&&_0x4fcf67[_0x2c92('0x49')][_0x2c92('0xe6')]){_0x1d1ea6=_0x4fcf67['query'][_0x2c92('0xe6')];return db[_0x2c92('0xcf')][_0x2c92('0x5d')]({'where':{'messageId':_0x4fcf67[_0x2c92('0x49')][_0x2c92('0xe5')]}});}break;}}})['then'](handleEntityNotFound(_0x2c4213,null))[_0x2c92('0x22')](function(_0x40649f){if(_0x40649f){_0x219812=_0x40649f;switch(_0x3d319a['type']){case _0x2c92('0x91'):if(_0x1d1ea6==='2'||_0x1d1ea6==='6'){return _0x219812[_0x2c92('0x38')]({'read':!![]});}else{logger[_0x2c92('0x28')](_0x2c92('0xd3'),'status','csc',util['inspect'](_0x4fcf67[_0x2c92('0x49')],{'showHidden':![],'depth':null}));};break;}return _0x219812;}})['then'](respondWithResult(_0x2c4213,null))['catch'](handleError(_0x2c4213,null));};exports[_0x2c92('0xe7')]=function(_0x1bd427,_0x326b0f,_0x3b92e4){return db[_0x2c92('0x57')][_0x2c92('0x5d')]({'where':{'id':_0x1bd427['params']['id']}})['then'](handleEntityNotFound(_0x326b0f,null))['then'](function(_0x36a37e){if(_0x36a37e){return _0x36a37e['addAgents'](_0x1bd427[_0x2c92('0x5f')][_0x2c92('0x6e')],_[_0x2c92('0xa2')](_0x1bd427[_0x2c92('0x5f')],[_0x2c92('0x6e'),'id'])||{})[_0x2c92('0xa6')](function(_0x549b47){for(var _0x1892e7=0x0;_0x1892e7<_0x1bd427['body'][_0x2c92('0x6e')]['length'];_0x1892e7+=0x1){socket[_0x2c92('0xe8')]('userSmsAccount:save',{'UserId':Number(_0x1bd427[_0x2c92('0x5f')][_0x2c92('0x6e')][_0x1892e7]),'SmsAccountId':Number(_0x1bd427[_0x2c92('0x5a')]['id'])});}return _0x549b47;});}})[_0x2c92('0x22')](respondWithResult(_0x326b0f,null))[_0x2c92('0x2c')](handleError(_0x326b0f,null));};exports['removeAgents']=function(_0x15c958,_0x521f47,_0x2ce903){return db[_0x2c92('0x57')]['find']({'where':{'id':_0x15c958[_0x2c92('0x5a')]['id']}})['then'](handleEntityNotFound(_0x521f47,null))[_0x2c92('0x22')](function(_0x5a1a23){if(_0x5a1a23){return _0x5a1a23[_0x2c92('0xe9')](_0x15c958[_0x2c92('0x49')][_0x2c92('0x6e')])[_0x2c92('0x22')](function(){if(_['isArray'](_0x15c958['query'][_0x2c92('0x6e')])){for(var _0x454b92=0x0;_0x454b92<_0x15c958[_0x2c92('0x49')]['ids'][_0x2c92('0x5b')];_0x454b92+=0x1){socket[_0x2c92('0xe8')]('userSmsAccount:remove',{'UserId':Number(_0x15c958['query'][_0x2c92('0x6e')][_0x454b92]),'SmsAccountId':Number(_0x15c958['params']['id'])});}}else{socket[_0x2c92('0xe8')](_0x2c92('0xea'),{'UserId':Number(_0x15c958['query'][_0x2c92('0x6e')]),'SmsAccountId':Number(_0x15c958['params']['id'])});}});}})[_0x2c92('0x22')](respondWithStatusCode(_0x521f47,null))[_0x2c92('0x2c')](handleError(_0x521f47,null));};exports[_0x2c92('0xeb')]=function(_0x1f2ee1,_0x294b7e,_0x439444){var _0x2d1981={};var _0x265f7f={};var _0x5bbe78;var _0x407fbb;return db['SmsAccount'][_0x2c92('0x69')]({'where':{'id':_0x1f2ee1['params']['id']}})[_0x2c92('0x22')](handleEntityNotFound(_0x294b7e,null))[_0x2c92('0x22')](function(_0x37466b){if(_0x37466b){_0x5bbe78=_0x37466b;_0x265f7f[_0x2c92('0x48')]=_[_0x2c92('0x4a')](db['User'][_0x2c92('0x44')]);_0x265f7f['query']=_[_0x2c92('0x4a')](_0x1f2ee1[_0x2c92('0x49')]);_0x265f7f['filters']=_[_0x2c92('0x4c')](_0x265f7f[_0x2c92('0x48')],_0x265f7f[_0x2c92('0x49')]);_0x2d1981[_0x2c92('0x4d')]=_['intersection'](_0x265f7f[_0x2c92('0x48')],qs[_0x2c92('0x4e')](_0x1f2ee1['query']['fields']));_0x2d1981['attributes']=_0x2d1981[_0x2c92('0x4d')][_0x2c92('0x5b')]?_0x2d1981[_0x2c92('0x4d')]:_0x265f7f[_0x2c92('0x48')];_0x2d1981[_0x2c92('0x6a')]=qs[_0x2c92('0x51')](_0x1f2ee1['query']['sort']);_0x2d1981[_0x2c92('0x52')]=qs[_0x2c92('0x4b')](_[_0x2c92('0x53')](_0x1f2ee1[_0x2c92('0x49')],_0x265f7f[_0x2c92('0x4b')]));if(_0x1f2ee1[_0x2c92('0x49')][_0x2c92('0x6b')]){_0x2d1981[_0x2c92('0x52')]=_['merge'](_0x2d1981['where'],{'$or':_['map'](_0x2d1981[_0x2c92('0x4d')],function(_0x3730a9){var _0x295808={};_0x295808[_0x3730a9]={'$like':'%'+_0x1f2ee1[_0x2c92('0x49')]['filter']+'%'};return _0x295808;})});}_0x2d1981=_[_0x2c92('0x54')]({},_0x2d1981,_0x1f2ee1['options']);return _0x5bbe78[_0x2c92('0xeb')](_0x2d1981);}})[_0x2c92('0x22')](function(_0x4dacc3){if(_0x4dacc3){_0x407fbb=_0x4dacc3[_0x2c92('0x5b')];if(!_0x1f2ee1['query'][_0x2c92('0x4f')](_0x2c92('0x50'))){_0x2d1981['limit']=qs[_0x2c92('0x32')](_0x1f2ee1[_0x2c92('0x49')][_0x2c92('0x32')]);_0x2d1981[_0x2c92('0x30')]=qs['offset'](_0x1f2ee1['query']['offset']);}return _0x5bbe78[_0x2c92('0xeb')](_0x2d1981);}})[_0x2c92('0x22')](function(_0x3bfd2d){if(_0x3bfd2d){return _0x3bfd2d?{'count':_0x407fbb,'rows':_0x3bfd2d}:null;}})[_0x2c92('0x22')](respondWithResult(_0x294b7e,null))['catch'](handleError(_0x294b7e,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 07b10dc..aaa25d9 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 _0xaba6=['save','update','remove','emit','hook','events','../../mysqldb','SmsAccount','setMaxListeners'];(function(_0x4c8833,_0x14e755){var _0x30df54=function(_0x197811){while(--_0x197811){_0x4c8833['push'](_0x4c8833['shift']());}};_0x30df54(++_0x14e755);}(_0xaba6,0x1e2));var _0x6aba=function(_0x537501,_0x1509e4){_0x537501=_0x537501-0x0;var _0x54bfc2=_0xaba6[_0x537501];return _0x54bfc2;};'use strict';var EventEmitter=require(_0x6aba('0x0'));var SmsAccount=require(_0x6aba('0x1'))['db'][_0x6aba('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x6aba('0x3')](0x0);var events={'afterCreate':_0x6aba('0x4'),'afterUpdate':_0x6aba('0x5'),'afterDestroy':_0x6aba('0x6')};function emitEvent(_0xf5bb76){return function(_0x3dc2cc,_0x44ccda,_0x2d4517){SmsAccountEvents['emit'](_0xf5bb76+':'+_0x3dc2cc['id'],_0x3dc2cc);SmsAccountEvents[_0x6aba('0x7')](_0xf5bb76,_0x3dc2cc);_0x2d4517(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount[_0x6aba('0x8')](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file +var _0x6e60=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsAccount'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x6e60,0x105));var _0x06e6=function(_0x57ba8c,_0x27fe76){_0x57ba8c=_0x57ba8c-0x0;var _0x26fa08=_0x6e60[_0x57ba8c];return _0x26fa08;};'use strict';var EventEmitter=require(_0x06e6('0x0'));var SmsAccount=require(_0x06e6('0x1'))['db'][_0x06e6('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x06e6('0x3')](0x0);var events={'afterCreate':_0x06e6('0x4'),'afterUpdate':_0x06e6('0x5'),'afterDestroy':_0x06e6('0x6')};function emitEvent(_0x279bfd){return function(_0x125ed5,_0x12a31b,_0x1e7364){SmsAccountEvents[_0x06e6('0x7')](_0x279bfd+':'+_0x125ed5['id'],_0x125ed5);SmsAccountEvents[_0x06e6('0x7')](_0x279bfd,_0x125ed5);_0x1e7364(null);};}for(var e in events){if(events[_0x06e6('0x8')](e)){var event=events[e];SmsAccount[_0x06e6('0x9')](e,emitEvent(event));}}module[_0x06e6('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 16c5b86..d83950f 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 _0x1b36=['bluebird','../../config/environment','./smsAccount.attributes','exports','sms_accounts','lodash','util','../../config/logger','moment'];(function(_0x44a0e9,_0x959f63){var _0x3b8e8c=function(_0x11b3e1){while(--_0x11b3e1){_0x44a0e9['push'](_0x44a0e9['shift']());}};_0x3b8e8c(++_0x959f63);}(_0x1b36,0xd4));var _0x61b3=function(_0x398537,_0x33a3d4){_0x398537=_0x398537-0x0;var _0x14b196=_0x1b36[_0x398537];return _0x14b196;};'use strict';var _=require(_0x61b3('0x0'));var util=require(_0x61b3('0x1'));var logger=require(_0x61b3('0x2'))('api');var moment=require(_0x61b3('0x3'));var BPromise=require(_0x61b3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x61b3('0x5'));var attributes=require(_0x61b3('0x6'));module[_0x61b3('0x7')]=function(_0x1cf06c,_0x120a87){return _0x1cf06c['define']('SmsAccount',attributes,{'tableName':_0x61b3('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4db9=['bluebird','request-promise','rimraf','./smsAccount.attributes','SmsAccount','lodash','util','../../config/logger','api'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x4db9,0x1d9));var _0x94db=function(_0x151721,_0x20d5bc){_0x151721=_0x151721-0x0;var _0x2deaa7=_0x4db9[_0x151721];return _0x2deaa7;};'use strict';var _=require(_0x94db('0x0'));var util=require(_0x94db('0x1'));var logger=require(_0x94db('0x2'))(_0x94db('0x3'));var moment=require('moment');var BPromise=require(_0x94db('0x4'));var rp=require(_0x94db('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x94db('0x6'));var config=require('../../config/environment');var attributes=require(_0x94db('0x7'));module['exports']=function(_0x4630b3,_0x442158){return _0x4630b3['define'](_0x94db('0x8'),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 f993a70..028fb62 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 _0xd8ff=['register','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSmsAccount','find','raw','options','where','attributes','include','map','model','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./smsAccount.socket'];(function(_0x309e57,_0xe1c277){var _0x313c98=function(_0x2e6cd6){while(--_0x2e6cd6){_0x309e57['push'](_0x309e57['shift']());}};_0x313c98(++_0xe1c277);}(_0xd8ff,0x1a2));var _0xfd8f=function(_0x2aaa29,_0x4f017c){_0x2aaa29=_0x2aaa29-0x0;var _0x41c7b4=_0xd8ff[_0x2aaa29];return _0x41c7b4;};'use strict';var _=require(_0xfd8f('0x0'));var util=require(_0xfd8f('0x1'));var moment=require(_0xfd8f('0x2'));var BPromise=require('bluebird');var rs=require(_0xfd8f('0x3'));var fs=require('fs');var Redis=require(_0xfd8f('0x4'));var db=require(_0xfd8f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xfd8f('0x6'))('rpc');var config=require(_0xfd8f('0x7'));var jayson=require(_0xfd8f('0x8'));var client=jayson[_0xfd8f('0x9')]['http']({'port':0x232a});config[_0xfd8f('0xa')]=_[_0xfd8f('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xfd8f('0xc'))(new Redis(config[_0xfd8f('0xa')]));require(_0xfd8f('0xd'))[_0xfd8f('0xe')](socket);function respondWithRpcPromise(_0x46db36,_0x33a606,_0x2ab363){return new BPromise(function(_0x1e33f8,_0x313c7d){return client['request'](_0x46db36,_0x2ab363)[_0xfd8f('0xf')](function(_0x43380f){logger[_0xfd8f('0x10')](_0xfd8f('0x11'),_0x33a606,_0xfd8f('0x12'));logger[_0xfd8f('0x13')](_0xfd8f('0x14'),_0x33a606,_0xfd8f('0x12'),JSON[_0xfd8f('0x15')](_0x43380f));if(_0x43380f[_0xfd8f('0x16')]){if(_0x43380f[_0xfd8f('0x16')][_0xfd8f('0x17')]===0x1f4){logger[_0xfd8f('0x16')](_0xfd8f('0x11'),_0x33a606,_0x43380f[_0xfd8f('0x16')][_0xfd8f('0x18')]);return _0x313c7d(_0x43380f['error']['message']);}logger[_0xfd8f('0x16')](_0xfd8f('0x11'),_0x33a606,_0x43380f[_0xfd8f('0x16')][_0xfd8f('0x18')]);return _0x1e33f8(_0x43380f[_0xfd8f('0x16')][_0xfd8f('0x18')]);}else{logger[_0xfd8f('0x10')](_0xfd8f('0x11'),_0x33a606,_0xfd8f('0x12'));_0x1e33f8(_0x43380f[_0xfd8f('0x19')]['message']);}})[_0xfd8f('0x1a')](function(_0x376f4e){logger[_0xfd8f('0x16')](_0xfd8f('0x11'),_0x33a606,_0x376f4e);_0x313c7d(_0x376f4e);});});}exports[_0xfd8f('0x1b')]=function(_0x3cece2){var _0x45a620=this;return new Promise(function(_0x21df49,_0x2a71d1){return db['SmsAccount'][_0xfd8f('0x1c')]({'raw':_0x3cece2['options']?_0x3cece2['options'][_0xfd8f('0x1d')]===undefined?!![]:![]:!![],'where':_0x3cece2[_0xfd8f('0x1e')]?_0x3cece2[_0xfd8f('0x1e')][_0xfd8f('0x1f')]||null:null,'attributes':_0x3cece2[_0xfd8f('0x1e')]?_0x3cece2[_0xfd8f('0x1e')][_0xfd8f('0x20')]||null:null,'include':_0x3cece2['options']?_0x3cece2[_0xfd8f('0x1e')][_0xfd8f('0x21')]?_[_0xfd8f('0x22')](_0x3cece2[_0xfd8f('0x1e')][_0xfd8f('0x21')],function(_0x5a9c15){return{'model':db[_0x5a9c15[_0xfd8f('0x23')]],'as':_0x5a9c15['as'],'attributes':_0x5a9c15[_0xfd8f('0x20')],'include':_0x5a9c15[_0xfd8f('0x21')]?_[_0xfd8f('0x22')](_0x5a9c15[_0xfd8f('0x21')],function(_0x579f43){return{'model':db[_0x579f43[_0xfd8f('0x23')]],'as':_0x579f43['as'],'attributes':_0x579f43[_0xfd8f('0x20')],'include':_0x579f43[_0xfd8f('0x21')]?_[_0xfd8f('0x22')](_0x579f43[_0xfd8f('0x21')],function(_0x5bf7ad){return{'model':db[_0x5bf7ad[_0xfd8f('0x23')]],'as':_0x5bf7ad['as'],'attributes':_0x5bf7ad['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4974a7){logger['info']('ShowSmsAccount',_0x3cece2);logger[_0xfd8f('0x13')]('ShowSmsAccount',_0x3cece2,JSON[_0xfd8f('0x15')](_0x4974a7));_0x21df49(_0x4974a7);})[_0xfd8f('0x1a')](function(_0x1d8fd6){logger[_0xfd8f('0x16')](_0xfd8f('0x1b'),_0x1d8fd6['message'],_0x3cece2);_0x2a71d1(_0x45a620[_0xfd8f('0x16')](0x1f4,_0x1d8fd6[_0xfd8f('0x18')]));});});}; \ No newline at end of file +var _0xdaaf=['include','attributes','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','defaults','socket.io-emitter','redis','./smsAccount.socket','register','request','then','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','ShowSmsAccount','SmsAccount','find','options','raw','map'];(function(_0x341519,_0x5c2df4){var _0x308e6c=function(_0x29ca8e){while(--_0x29ca8e){_0x341519['push'](_0x341519['shift']());}};_0x308e6c(++_0x5c2df4);}(_0xdaaf,0x1af));var _0xfdaa=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xdaaf[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0xfdaa('0x0'));var util=require('util');var moment=require(_0xfdaa('0x1'));var BPromise=require('bluebird');var rs=require(_0xfdaa('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfdaa('0x3'))['db'];var utils=require(_0xfdaa('0x4'));var logger=require(_0xfdaa('0x5'))('rpc');var config=require(_0xfdaa('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xfdaa('0x7')]({'port':0x232a});config['redis']=_[_0xfdaa('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xfdaa('0x9'))(new Redis(config[_0xfdaa('0xa')]));require(_0xfdaa('0xb'))[_0xfdaa('0xc')](socket);function respondWithRpcPromise(_0x5618fe,_0x41462c,_0x30d434){return new BPromise(function(_0x38a239,_0x1b03cf){return client[_0xfdaa('0xd')](_0x5618fe,_0x30d434)[_0xfdaa('0xe')](function(_0x593685){logger['info'](_0xfdaa('0xf'),_0x41462c,_0xfdaa('0x10'));logger[_0xfdaa('0x11')](_0xfdaa('0x12'),_0x41462c,_0xfdaa('0x10'),JSON[_0xfdaa('0x13')](_0x593685));if(_0x593685[_0xfdaa('0x14')]){if(_0x593685[_0xfdaa('0x14')]['code']===0x1f4){logger[_0xfdaa('0x14')](_0xfdaa('0xf'),_0x41462c,_0x593685['error'][_0xfdaa('0x15')]);return _0x1b03cf(_0x593685[_0xfdaa('0x14')]['message']);}logger[_0xfdaa('0x14')]('SmsAccount,\x20%s,\x20%s',_0x41462c,_0x593685[_0xfdaa('0x14')][_0xfdaa('0x15')]);return _0x38a239(_0x593685[_0xfdaa('0x14')][_0xfdaa('0x15')]);}else{logger[_0xfdaa('0x16')]('SmsAccount,\x20%s,\x20%s',_0x41462c,_0xfdaa('0x10'));_0x38a239(_0x593685[_0xfdaa('0x17')][_0xfdaa('0x15')]);}})[_0xfdaa('0x18')](function(_0x3f333f){logger[_0xfdaa('0x14')](_0xfdaa('0xf'),_0x41462c,_0x3f333f);_0x1b03cf(_0x3f333f);});});}exports[_0xfdaa('0x19')]=function(_0x5d37fa){var _0x5342c6=this;return new Promise(function(_0x2243c1,_0x6e2de1){return db[_0xfdaa('0x1a')][_0xfdaa('0x1b')]({'raw':_0x5d37fa[_0xfdaa('0x1c')]?_0x5d37fa[_0xfdaa('0x1c')][_0xfdaa('0x1d')]===undefined?!![]:![]:!![],'where':_0x5d37fa[_0xfdaa('0x1c')]?_0x5d37fa[_0xfdaa('0x1c')]['where']||null:null,'attributes':_0x5d37fa['options']?_0x5d37fa['options']['attributes']||null:null,'include':_0x5d37fa['options']?_0x5d37fa['options']['include']?_[_0xfdaa('0x1e')](_0x5d37fa[_0xfdaa('0x1c')][_0xfdaa('0x1f')],function(_0x1d393f){return{'model':db[_0x1d393f['model']],'as':_0x1d393f['as'],'attributes':_0x1d393f[_0xfdaa('0x20')],'include':_0x1d393f[_0xfdaa('0x1f')]?_[_0xfdaa('0x1e')](_0x1d393f[_0xfdaa('0x1f')],function(_0x151e95){return{'model':db[_0x151e95['model']],'as':_0x151e95['as'],'attributes':_0x151e95[_0xfdaa('0x20')],'include':_0x151e95[_0xfdaa('0x1f')]?_['map'](_0x151e95[_0xfdaa('0x1f')],function(_0x3ca9ad){return{'model':db[_0x3ca9ad['model']],'as':_0x3ca9ad['as'],'attributes':_0x3ca9ad[_0xfdaa('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x122fdc){logger[_0xfdaa('0x16')](_0xfdaa('0x19'),_0x5d37fa);logger[_0xfdaa('0x11')]('ShowSmsAccount',_0x5d37fa,JSON[_0xfdaa('0x13')](_0x122fdc));_0x2243c1(_0x122fdc);})['catch'](function(_0xe75e2f){logger[_0xfdaa('0x14')](_0xfdaa('0x19'),_0xe75e2f[_0xfdaa('0x15')],_0x5d37fa);_0x6e2de1(_0x5342c6[_0xfdaa('0x14')](0x1f4,_0xe75e2f[_0xfdaa('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 0f6ff64..ae0d4e1 100644 --- a/server/api/smsAccount/smsAccount.socket.js +++ b/server/api/smsAccount/smsAccount.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'use strict';var SmsAccountEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){SmsAccountEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);SmsAccountEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file +var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xa9e0[_0x5e3b04];return _0x1fc44d;};'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 5a59dfe..0f12146 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 _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(_0x4dbaad,_0x730318){var _0x226c72=function(_0x501972){while(--_0x501972){_0x4dbaad['push'](_0x4dbaad['shift']());}};_0x226c72(++_0x730318);}(_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('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 _0x3e74=['path','connect-timeout','express','../../components/auth/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','exports','multer'];(function(_0x4cca27,_0x18e06f){var _0x3d8219=function(_0x2ba31b){while(--_0x2ba31b){_0x4cca27['push'](_0x4cca27['shift']());}};_0x3d8219(++_0x18e06f);}(_0x3e74,0x175));var _0x43e7=function(_0x3ead8a,_0x345299){_0x3ead8a=_0x3ead8a-0x0;var _0x2be942=_0x3e74[_0x3ead8a];return _0x2be942;};'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 diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 1973093..1c575df 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 _0x4a44=['STRING','*,*,*,*','INTEGER','noop','TEXT'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x4a44,0x93));var _0x44a4=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x4a44[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0x44a4('0x0')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x44a4('0x1')},'appdata':{'type':Sequelize[_0x44a4('0x2')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x44a4('0x3')],'defaultValue':_0x44a4('0x4')}}; \ No newline at end of file +var _0xd2af=['noop','TEXT','*,*,*,*','sequelize','exports','STRING'];(function(_0x4c08c5,_0x47bba6){var _0x311d93=function(_0x5f28c6){while(--_0x5f28c6){_0x4c08c5['push'](_0x4c08c5['shift']());}};_0x311d93(++_0x47bba6);}(_0xd2af,0x1c5));var _0xfd2a=function(_0x3f25db,_0x1d3686){_0x3f25db=_0x3f25db-0x0;var _0x54f29d=_0xd2af[_0x3f25db];return _0x54f29d;};'use strict';var Sequelize=require(_0xfd2a('0x0'));module[_0xfd2a('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xfd2a('0x2')],'allowNull':![],'defaultValue':_0xfd2a('0x3')},'appdata':{'type':Sequelize[_0xfd2a('0x4')]()},'description':{'type':Sequelize[_0xfd2a('0x2')]},'interval':{'type':Sequelize[_0xfd2a('0x2')],'defaultValue':_0xfd2a('0x5')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 65d4b0c..b1c5a04 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 _0xe74f=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','SmsApplication','fieldName','key','model','keys','query','filters','attributes','intersection','length','hasOwnProperty','nolimit','order','where','pick','merge','type','VIRTUAL','filter','options','include','findAll','rows','catch','params','rawAttributes','fields','includeAll','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse'];(function(_0x23e33d,_0x31c8c8){var _0x818fc=function(_0x19f33e){while(--_0x19f33e){_0x23e33d['push'](_0x23e33d['shift']());}};_0x818fc(++_0x31c8c8);}(_0xe74f,0x8c));var _0xfe74=function(_0x2c0dc0,_0x19900d){_0x2c0dc0=_0x2c0dc0-0x0;var _0x4c0990=_0xe74f[_0x2c0dc0];return _0x4c0990;};'use strict';var emlformat=require(_0xfe74('0x0'));var rimraf=require(_0xfe74('0x1'));var zipdir=require(_0xfe74('0x2'));var jsonpatch=require(_0xfe74('0x3'));var rp=require(_0xfe74('0x4'));var moment=require('moment');var BPromise=require(_0xfe74('0x5'));var Mustache=require(_0xfe74('0x6'));var util=require('util');var path=require(_0xfe74('0x7'));var sox=require('sox');var csv=require(_0xfe74('0x8'));var ejs=require(_0xfe74('0x9'));var fs=require('fs');var fs_extra=require(_0xfe74('0xa'));var _=require('lodash');var squel=require(_0xfe74('0xb'));var crypto=require(_0xfe74('0xc'));var jsforce=require(_0xfe74('0xd'));var deskjs=require(_0xfe74('0xe'));var toCsv=require(_0xfe74('0x8'));var querystring=require('querystring');var Papa=require(_0xfe74('0xf'));var Redis=require(_0xfe74('0x10'));var authService=require(_0xfe74('0x11'));var qs=require(_0xfe74('0x12'));var as=require(_0xfe74('0x13'));var hardwareService=require(_0xfe74('0x14'));var logger=require('../../config/logger')(_0xfe74('0x15'));var utils=require(_0xfe74('0x16'));var config=require(_0xfe74('0x17'));var licenseUtil=require(_0xfe74('0x18'));var db=require(_0xfe74('0x19'))['db'];function respondWithStatusCode(_0x1c6ed1,_0x350ec8){_0x350ec8=_0x350ec8||0xcc;return function(_0x447eaf){if(_0x447eaf){return _0x1c6ed1[_0xfe74('0x1a')](_0x350ec8);}return _0x1c6ed1[_0xfe74('0x1b')](_0x350ec8)[_0xfe74('0x1c')]();};}function respondWithResult(_0x58210d,_0x158793){_0x158793=_0x158793||0xc8;return function(_0x544062){if(_0x544062){return _0x58210d['status'](_0x158793)[_0xfe74('0x1d')](_0x544062);}};}function respondWithFilteredResult(_0x3ecfd5,_0xdaa111){return function(_0x25faf2){if(_0x25faf2){var _0x78e8c3=typeof _0xdaa111['offset']===_0xfe74('0x1e')&&typeof _0xdaa111[_0xfe74('0x1f')]==='undefined';var _0x8aae2a=_0x25faf2[_0xfe74('0x20')];var _0x4868c7=_0x78e8c3?0x0:_0xdaa111[_0xfe74('0x21')];var _0x405749=_0x78e8c3?_0x25faf2[_0xfe74('0x20')]:_0xdaa111[_0xfe74('0x21')]+_0xdaa111['limit'];var _0x149753;if(_0x405749>=_0x8aae2a){_0x405749=_0x8aae2a;_0x149753=0xc8;}else{_0x149753=0xce;}_0x3ecfd5[_0xfe74('0x1b')](_0x149753);return _0x3ecfd5[_0xfe74('0x22')](_0xfe74('0x23'),_0x4868c7+'-'+_0x405749+'/'+_0x8aae2a)[_0xfe74('0x1d')](_0x25faf2);}return null;};}function patchUpdates(_0xc846b9){return function(_0x179cde){try{jsonpatch['apply'](_0x179cde,_0xc846b9,!![]);}catch(_0x3909e2){return BPromise[_0xfe74('0x24')](_0x3909e2);}return _0x179cde[_0xfe74('0x25')]();};}function saveUpdates(_0x524208,_0x16a09a){return function(_0x35e6a3){if(_0x35e6a3){return _0x35e6a3[_0xfe74('0x26')](_0x524208)[_0xfe74('0x27')](function(_0x5c0249){return _0x5c0249;});}return null;};}function removeEntity(_0x18086d,_0x49e051){return function(_0x12f337){if(_0x12f337){return _0x12f337[_0xfe74('0x28')]()['then'](function(){_0x18086d[_0xfe74('0x1b')](0xcc)[_0xfe74('0x1c')]();});}};}function handleEntityNotFound(_0x515b67,_0x29f44e){return function(_0x1bef77){if(!_0x1bef77){_0x515b67[_0xfe74('0x1a')](0x194);}return _0x1bef77;};}function handleError(_0x1cb6a3,_0x135c76){_0x135c76=_0x135c76||0x1f4;return function(_0x2ef96b){logger[_0xfe74('0x29')](_0x2ef96b[_0xfe74('0x2a')]);if(_0x2ef96b[_0xfe74('0x2b')]){delete _0x2ef96b[_0xfe74('0x2b')];}_0x1cb6a3[_0xfe74('0x1b')](_0x135c76)[_0xfe74('0x2c')](_0x2ef96b);};}exports[_0xfe74('0x2d')]=function(_0x24826e,_0x23c500){var _0x14d73f={},_0x4c39fd={},_0x4131df={'count':0x0,'rows':[]};var _0x20108c=_[_0xfe74('0x2e')](db[_0xfe74('0x2f')]['rawAttributes'],function(_0x895b1f){return{'name':_0x895b1f[_0xfe74('0x30')],'type':_0x895b1f['type'][_0xfe74('0x31')]};});_0x4c39fd[_0xfe74('0x32')]=_[_0xfe74('0x2e')](_0x20108c,_0xfe74('0x2b'));_0x4c39fd['query']=_[_0xfe74('0x33')](_0x24826e[_0xfe74('0x34')]);_0x4c39fd[_0xfe74('0x35')]=_['intersection'](_0x4c39fd['model'],_0x4c39fd['query']);_0x14d73f[_0xfe74('0x36')]=_[_0xfe74('0x37')](_0x4c39fd[_0xfe74('0x32')],qs['fields'](_0x24826e[_0xfe74('0x34')]['fields']));_0x14d73f[_0xfe74('0x36')]=_0x14d73f[_0xfe74('0x36')][_0xfe74('0x38')]?_0x14d73f[_0xfe74('0x36')]:_0x4c39fd[_0xfe74('0x32')];if(!_0x24826e['query'][_0xfe74('0x39')](_0xfe74('0x3a'))){_0x14d73f[_0xfe74('0x1f')]=qs['limit'](_0x24826e['query'][_0xfe74('0x1f')]);_0x14d73f[_0xfe74('0x21')]=qs[_0xfe74('0x21')](_0x24826e[_0xfe74('0x34')][_0xfe74('0x21')]);}_0x14d73f[_0xfe74('0x3b')]=qs['sort'](_0x24826e[_0xfe74('0x34')]['sort']);_0x14d73f[_0xfe74('0x3c')]=qs[_0xfe74('0x35')](_[_0xfe74('0x3d')](_0x24826e[_0xfe74('0x34')],_0x4c39fd[_0xfe74('0x35')]),_0x20108c);if(_0x24826e[_0xfe74('0x34')]['filter']){_0x14d73f['where']=_[_0xfe74('0x3e')](_0x14d73f[_0xfe74('0x3c')],{'$or':_['map'](_0x20108c,function(_0xa45fd2){if(_0xa45fd2[_0xfe74('0x3f')]!==_0xfe74('0x40')){var _0x1e6631={};_0x1e6631[_0xa45fd2['name']]={'$like':'%'+_0x24826e[_0xfe74('0x34')][_0xfe74('0x41')]+'%'};return _0x1e6631;}})});}_0x14d73f=_[_0xfe74('0x3e')]({},_0x14d73f,_0x24826e[_0xfe74('0x42')]);var _0x45dc8f={'where':_0x14d73f[_0xfe74('0x3c')]};return db['SmsApplication'][_0xfe74('0x20')](_0x45dc8f)[_0xfe74('0x27')](function(_0x28f16d){_0x4131df[_0xfe74('0x20')]=_0x28f16d;if(_0x24826e[_0xfe74('0x34')]['includeAll']){_0x14d73f[_0xfe74('0x43')]=[{'all':!![]}];}return db['SmsApplication'][_0xfe74('0x44')](_0x14d73f);})['then'](function(_0x3f1994){_0x4131df[_0xfe74('0x45')]=_0x3f1994;return _0x4131df;})[_0xfe74('0x27')](respondWithFilteredResult(_0x23c500,_0x14d73f))[_0xfe74('0x46')](handleError(_0x23c500,null));};exports['show']=function(_0x39bbba,_0x1ea572){var _0x552b0c={'raw':!![],'where':{'id':_0x39bbba[_0xfe74('0x47')]['id']}},_0x29e82d={};_0x29e82d[_0xfe74('0x32')]=_[_0xfe74('0x33')](db[_0xfe74('0x2f')][_0xfe74('0x48')]);_0x29e82d[_0xfe74('0x34')]=_[_0xfe74('0x33')](_0x39bbba[_0xfe74('0x34')]);_0x29e82d['filters']=_[_0xfe74('0x37')](_0x29e82d[_0xfe74('0x32')],_0x29e82d[_0xfe74('0x34')]);_0x552b0c[_0xfe74('0x36')]=_[_0xfe74('0x37')](_0x29e82d[_0xfe74('0x32')],qs[_0xfe74('0x49')](_0x39bbba[_0xfe74('0x34')][_0xfe74('0x49')]));_0x552b0c[_0xfe74('0x36')]=_0x552b0c['attributes'][_0xfe74('0x38')]?_0x552b0c['attributes']:_0x29e82d['model'];if(_0x39bbba['query'][_0xfe74('0x4a')]){_0x552b0c[_0xfe74('0x43')]=[{'all':!![]}];}_0x552b0c=_[_0xfe74('0x3e')]({},_0x552b0c,_0x39bbba['options']);return db['SmsApplication']['find'](_0x552b0c)[_0xfe74('0x27')](handleEntityNotFound(_0x1ea572,null))[_0xfe74('0x27')](respondWithResult(_0x1ea572,null))[_0xfe74('0x46')](handleError(_0x1ea572,null));};exports[_0xfe74('0x4b')]=function(_0x4cf30a,_0x4db39e){return db[_0xfe74('0x2f')]['create'](_0x4cf30a[_0xfe74('0x4c')],{})['then'](respondWithResult(_0x4db39e,0xc9))[_0xfe74('0x46')](handleError(_0x4db39e,null));};exports[_0xfe74('0x26')]=function(_0x39504,_0x53f938){if(_0x39504['body']['id']){delete _0x39504[_0xfe74('0x4c')]['id'];}return db[_0xfe74('0x2f')][_0xfe74('0x4d')]({'where':{'id':_0x39504['params']['id']}})['then'](handleEntityNotFound(_0x53f938,null))['then'](saveUpdates(_0x39504[_0xfe74('0x4c')],null))[_0xfe74('0x27')](respondWithResult(_0x53f938,null))[_0xfe74('0x46')](handleError(_0x53f938,null));};exports[_0xfe74('0x28')]=function(_0x1d4141,_0x2cc635){return db[_0xfe74('0x2f')][_0xfe74('0x4d')]({'where':{'id':_0x1d4141[_0xfe74('0x47')]['id']}})[_0xfe74('0x27')](handleEntityNotFound(_0x2cc635,null))[_0xfe74('0x27')](removeEntity(_0x2cc635,null))[_0xfe74('0x46')](handleError(_0x2cc635,null));}; \ No newline at end of file +var _0x5d42=['mustache','util','path','sox','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','end','status','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','SmsApplication','then','includeAll','include','findAll','rows','catch','show','params','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird'];(function(_0x11df49,_0x31ab0b){var _0x299835=function(_0x46c3a8){while(--_0x46c3a8){_0x11df49['push'](_0x11df49['shift']());}};_0x299835(++_0x31ab0b);}(_0x5d42,0x13a));var _0x25d4=function(_0x5c320e,_0x33b919){_0x5c320e=_0x5c320e-0x0;var _0x1bcd2d=_0x5d42[_0x5c320e];return _0x1bcd2d;};'use strict';var emlformat=require(_0x25d4('0x0'));var rimraf=require(_0x25d4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x25d4('0x2'));var rp=require(_0x25d4('0x3'));var moment=require(_0x25d4('0x4'));var BPromise=require(_0x25d4('0x5'));var Mustache=require(_0x25d4('0x6'));var util=require(_0x25d4('0x7'));var path=require(_0x25d4('0x8'));var sox=require(_0x25d4('0x9'));var csv=require(_0x25d4('0xa'));var ejs=require(_0x25d4('0xb'));var fs=require('fs');var fs_extra=require(_0x25d4('0xc'));var _=require(_0x25d4('0xd'));var squel=require(_0x25d4('0xe'));var crypto=require('crypto');var jsforce=require(_0x25d4('0xf'));var deskjs=require(_0x25d4('0x10'));var toCsv=require(_0x25d4('0xa'));var querystring=require(_0x25d4('0x11'));var Papa=require('papaparse');var Redis=require(_0x25d4('0x12'));var authService=require(_0x25d4('0x13'));var qs=require(_0x25d4('0x14'));var as=require(_0x25d4('0x15'));var hardwareService=require(_0x25d4('0x16'));var logger=require(_0x25d4('0x17'))(_0x25d4('0x18'));var utils=require('../../config/utils');var config=require(_0x25d4('0x19'));var licenseUtil=require(_0x25d4('0x1a'));var db=require(_0x25d4('0x1b'))['db'];function respondWithStatusCode(_0xf6b4aa,_0x44bb81){_0x44bb81=_0x44bb81||0xcc;return function(_0x4284d5){if(_0x4284d5){return _0xf6b4aa['sendStatus'](_0x44bb81);}return _0xf6b4aa['status'](_0x44bb81)[_0x25d4('0x1c')]();};}function respondWithResult(_0x11a319,_0x5e0b19){_0x5e0b19=_0x5e0b19||0xc8;return function(_0x515bef){if(_0x515bef){return _0x11a319[_0x25d4('0x1d')](_0x5e0b19)[_0x25d4('0x1e')](_0x515bef);}};}function respondWithFilteredResult(_0x58fa94,_0x12a3d4){return function(_0x425cd3){if(_0x425cd3){var _0x53352d=typeof _0x12a3d4[_0x25d4('0x1f')]===_0x25d4('0x20')&&typeof _0x12a3d4['limit']===_0x25d4('0x20');var _0x45e141=_0x425cd3[_0x25d4('0x21')];var _0x507313=_0x53352d?0x0:_0x12a3d4[_0x25d4('0x1f')];var _0x2076d7=_0x53352d?_0x425cd3[_0x25d4('0x21')]:_0x12a3d4['offset']+_0x12a3d4[_0x25d4('0x22')];var _0x907f63;if(_0x2076d7>=_0x45e141){_0x2076d7=_0x45e141;_0x907f63=0xc8;}else{_0x907f63=0xce;}_0x58fa94[_0x25d4('0x1d')](_0x907f63);return _0x58fa94[_0x25d4('0x23')](_0x25d4('0x24'),_0x507313+'-'+_0x2076d7+'/'+_0x45e141)[_0x25d4('0x1e')](_0x425cd3);}return null;};}function patchUpdates(_0xc1fc5c){return function(_0x4aeb95){try{jsonpatch['apply'](_0x4aeb95,_0xc1fc5c,!![]);}catch(_0x968b18){return BPromise[_0x25d4('0x25')](_0x968b18);}return _0x4aeb95[_0x25d4('0x26')]();};}function saveUpdates(_0xbbc1d6,_0x36c374){return function(_0x53ab67){if(_0x53ab67){return _0x53ab67[_0x25d4('0x27')](_0xbbc1d6)['then'](function(_0x5e466d){return _0x5e466d;});}return null;};}function removeEntity(_0x366543,_0x1a16ce){return function(_0x46804c){if(_0x46804c){return _0x46804c[_0x25d4('0x28')]()['then'](function(){_0x366543[_0x25d4('0x1d')](0xcc)[_0x25d4('0x1c')]();});}};}function handleEntityNotFound(_0x215e51,_0x5a73af){return function(_0x540a45){if(!_0x540a45){_0x215e51[_0x25d4('0x29')](0x194);}return _0x540a45;};}function handleError(_0x469a37,_0x2514a9){_0x2514a9=_0x2514a9||0x1f4;return function(_0x29de0e){logger[_0x25d4('0x2a')](_0x29de0e[_0x25d4('0x2b')]);if(_0x29de0e[_0x25d4('0x2c')]){delete _0x29de0e['name'];}_0x469a37['status'](_0x2514a9)[_0x25d4('0x2d')](_0x29de0e);};}exports[_0x25d4('0x2e')]=function(_0x422ae9,_0x734467){var _0x23d86d={},_0x2660a3={},_0x48d557={'count':0x0,'rows':[]};var _0x5d2530=_[_0x25d4('0x2f')](db['SmsApplication'][_0x25d4('0x30')],function(_0x18a021){return{'name':_0x18a021[_0x25d4('0x31')],'type':_0x18a021[_0x25d4('0x32')]['key']};});_0x2660a3[_0x25d4('0x33')]=_[_0x25d4('0x2f')](_0x5d2530,_0x25d4('0x2c'));_0x2660a3[_0x25d4('0x34')]=_[_0x25d4('0x35')](_0x422ae9[_0x25d4('0x34')]);_0x2660a3[_0x25d4('0x36')]=_[_0x25d4('0x37')](_0x2660a3[_0x25d4('0x33')],_0x2660a3[_0x25d4('0x34')]);_0x23d86d['attributes']=_['intersection'](_0x2660a3['model'],qs['fields'](_0x422ae9[_0x25d4('0x34')][_0x25d4('0x38')]));_0x23d86d[_0x25d4('0x39')]=_0x23d86d[_0x25d4('0x39')][_0x25d4('0x3a')]?_0x23d86d[_0x25d4('0x39')]:_0x2660a3[_0x25d4('0x33')];if(!_0x422ae9['query'][_0x25d4('0x3b')]('nolimit')){_0x23d86d[_0x25d4('0x22')]=qs[_0x25d4('0x22')](_0x422ae9[_0x25d4('0x34')][_0x25d4('0x22')]);_0x23d86d[_0x25d4('0x1f')]=qs[_0x25d4('0x1f')](_0x422ae9[_0x25d4('0x34')][_0x25d4('0x1f')]);}_0x23d86d[_0x25d4('0x3c')]=qs[_0x25d4('0x3d')](_0x422ae9['query'][_0x25d4('0x3d')]);_0x23d86d[_0x25d4('0x3e')]=qs['filters'](_[_0x25d4('0x3f')](_0x422ae9[_0x25d4('0x34')],_0x2660a3[_0x25d4('0x36')]),_0x5d2530);if(_0x422ae9[_0x25d4('0x34')][_0x25d4('0x40')]){_0x23d86d[_0x25d4('0x3e')]=_[_0x25d4('0x41')](_0x23d86d[_0x25d4('0x3e')],{'$or':_['map'](_0x5d2530,function(_0x5c14ec){if(_0x5c14ec[_0x25d4('0x32')]!==_0x25d4('0x42')){var _0x574d1c={};_0x574d1c[_0x5c14ec[_0x25d4('0x2c')]]={'$like':'%'+_0x422ae9[_0x25d4('0x34')]['filter']+'%'};return _0x574d1c;}})});}_0x23d86d=_['merge']({},_0x23d86d,_0x422ae9[_0x25d4('0x43')]);var _0x337eb3={'where':_0x23d86d['where']};return db[_0x25d4('0x44')][_0x25d4('0x21')](_0x337eb3)[_0x25d4('0x45')](function(_0x40f57a){_0x48d557[_0x25d4('0x21')]=_0x40f57a;if(_0x422ae9[_0x25d4('0x34')][_0x25d4('0x46')]){_0x23d86d[_0x25d4('0x47')]=[{'all':!![]}];}return db[_0x25d4('0x44')][_0x25d4('0x48')](_0x23d86d);})[_0x25d4('0x45')](function(_0x299074){_0x48d557[_0x25d4('0x49')]=_0x299074;return _0x48d557;})[_0x25d4('0x45')](respondWithFilteredResult(_0x734467,_0x23d86d))[_0x25d4('0x4a')](handleError(_0x734467,null));};exports[_0x25d4('0x4b')]=function(_0x177e76,_0x5a8d5d){var _0x24a20c={'raw':!![],'where':{'id':_0x177e76[_0x25d4('0x4c')]['id']}},_0x19a465={};_0x19a465[_0x25d4('0x33')]=_[_0x25d4('0x35')](db[_0x25d4('0x44')][_0x25d4('0x30')]);_0x19a465[_0x25d4('0x34')]=_[_0x25d4('0x35')](_0x177e76['query']);_0x19a465[_0x25d4('0x36')]=_[_0x25d4('0x37')](_0x19a465['model'],_0x19a465[_0x25d4('0x34')]);_0x24a20c['attributes']=_[_0x25d4('0x37')](_0x19a465[_0x25d4('0x33')],qs[_0x25d4('0x38')](_0x177e76['query'][_0x25d4('0x38')]));_0x24a20c['attributes']=_0x24a20c[_0x25d4('0x39')][_0x25d4('0x3a')]?_0x24a20c[_0x25d4('0x39')]:_0x19a465['model'];if(_0x177e76[_0x25d4('0x34')]['includeAll']){_0x24a20c[_0x25d4('0x47')]=[{'all':!![]}];}_0x24a20c=_[_0x25d4('0x41')]({},_0x24a20c,_0x177e76[_0x25d4('0x43')]);return db[_0x25d4('0x44')][_0x25d4('0x4d')](_0x24a20c)['then'](handleEntityNotFound(_0x5a8d5d,null))[_0x25d4('0x45')](respondWithResult(_0x5a8d5d,null))['catch'](handleError(_0x5a8d5d,null));};exports['create']=function(_0x162d76,_0x1cdf72){return db[_0x25d4('0x44')][_0x25d4('0x4e')](_0x162d76[_0x25d4('0x4f')],{})[_0x25d4('0x45')](respondWithResult(_0x1cdf72,0xc9))[_0x25d4('0x4a')](handleError(_0x1cdf72,null));};exports[_0x25d4('0x27')]=function(_0x3fc1a2,_0x24daa3){if(_0x3fc1a2[_0x25d4('0x4f')]['id']){delete _0x3fc1a2[_0x25d4('0x4f')]['id'];}return db[_0x25d4('0x44')][_0x25d4('0x4d')]({'where':{'id':_0x3fc1a2[_0x25d4('0x4c')]['id']}})[_0x25d4('0x45')](handleEntityNotFound(_0x24daa3,null))['then'](saveUpdates(_0x3fc1a2[_0x25d4('0x4f')],null))[_0x25d4('0x45')](respondWithResult(_0x24daa3,null))['catch'](handleError(_0x24daa3,null));};exports['destroy']=function(_0x8e0a23,_0x3b46a8){return db['SmsApplication'][_0x25d4('0x4d')]({'where':{'id':_0x8e0a23[_0x25d4('0x4c')]['id']}})[_0x25d4('0x45')](handleEntityNotFound(_0x3b46a8,null))[_0x25d4('0x45')](removeEntity(_0x3b46a8,null))[_0x25d4('0x4a')](handleError(_0x3b46a8,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index be160e2..2bf0126 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 _0x05a6=['api','bluebird','request-promise','path','rimraf','exports','define','sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x5e9d0f,_0x3a69a6){var _0x47cdb6=function(_0x2ed3b4){while(--_0x2ed3b4){_0x5e9d0f['push'](_0x5e9d0f['shift']());}};_0x47cdb6(++_0x3a69a6);}(_0x05a6,0x8c));var _0x605a=function(_0x47cfa0,_0x176b87){_0x47cfa0=_0x47cfa0-0x0;var _0x386b1d=_0x05a6[_0x47cfa0];return _0x386b1d;};'use strict';var _=require(_0x605a('0x0'));var util=require(_0x605a('0x1'));var logger=require(_0x605a('0x2'))(_0x605a('0x3'));var moment=require('moment');var BPromise=require(_0x605a('0x4'));var rp=require(_0x605a('0x5'));var fs=require('fs');var path=require(_0x605a('0x6'));var rimraf=require(_0x605a('0x7'));var config=require('../../config/environment');var attributes=require('./smsApplication.attributes');module[_0x605a('0x8')]=function(_0x4be693,_0x1be26e){return _0x4be693[_0x605a('0x9')]('SmsApplication',attributes,{'tableName':_0x605a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x605a('0xb'),'collate':_0x605a('0xc')});}; \ No newline at end of file +var _0xd3fe=['utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsApplication.attributes','exports','define','SmsApplication','sms_applications'];(function(_0x56a871,_0x18b7fe){var _0x124954=function(_0x39b7a1){while(--_0x39b7a1){_0x56a871['push'](_0x56a871['shift']());}};_0x124954(++_0x18b7fe);}(_0xd3fe,0xb2));var _0xed3f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd3fe[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xed3f('0x0'));var logger=require(_0xed3f('0x1'))(_0xed3f('0x2'));var moment=require(_0xed3f('0x3'));var BPromise=require(_0xed3f('0x4'));var rp=require(_0xed3f('0x5'));var fs=require('fs');var path=require(_0xed3f('0x6'));var rimraf=require(_0xed3f('0x7'));var config=require(_0xed3f('0x8'));var attributes=require(_0xed3f('0x9'));module[_0xed3f('0xa')]=function(_0xe6f2d6,_0x5b42ee){return _0xe6f2d6[_0xed3f('0xb')](_0xed3f('0xc'),attributes,{'tableName':_0xed3f('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xed3f('0xe'),'collate':_0xed3f('0xf')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 91f8dbe..610d273 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 _0x084b=['message','result','catch','lodash','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x4bcd9e,_0xf90ab6){var _0x54d358=function(_0x34fa2e){while(--_0x34fa2e){_0x4bcd9e['push'](_0x4bcd9e['shift']());}};_0x54d358(++_0xf90ab6);}(_0x084b,0xd5));var _0xb084=function(_0x325ba1,_0x4ae054){_0x325ba1=_0x325ba1-0x0;var _0x326dc7=_0x084b[_0x325ba1];return _0x326dc7;};'use strict';var _=require(_0xb084('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb084('0x1'));var fs=require('fs');var Redis=require(_0xb084('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xb084('0x3'));var logger=require(_0xb084('0x4'))(_0xb084('0x5'));var config=require('../../config/environment');var jayson=require(_0xb084('0x6'));var client=jayson['client'][_0xb084('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x449c7a,_0x275c8c,_0x4b69ad){return new BPromise(function(_0x4f45d2,_0x18a300){return client[_0xb084('0x8')](_0x449c7a,_0x4b69ad)[_0xb084('0x9')](function(_0xec1e0d){logger[_0xb084('0xa')](_0xb084('0xb'),_0x275c8c,_0xb084('0xc'));logger[_0xb084('0xd')](_0xb084('0xe'),_0x275c8c,_0xb084('0xc'),JSON[_0xb084('0xf')](_0xec1e0d));if(_0xec1e0d[_0xb084('0x10')]){if(_0xec1e0d[_0xb084('0x10')][_0xb084('0x11')]===0x1f4){logger['error']('SmsApplication,\x20%s,\x20%s',_0x275c8c,_0xec1e0d[_0xb084('0x10')]['message']);return _0x18a300(_0xec1e0d['error'][_0xb084('0x12')]);}logger[_0xb084('0x10')]('SmsApplication,\x20%s,\x20%s',_0x275c8c,_0xec1e0d['error'][_0xb084('0x12')]);return _0x4f45d2(_0xec1e0d[_0xb084('0x10')][_0xb084('0x12')]);}else{logger[_0xb084('0xa')](_0xb084('0xb'),_0x275c8c,'request\x20sent');_0x4f45d2(_0xec1e0d[_0xb084('0x13')][_0xb084('0x12')]);}})[_0xb084('0x14')](function(_0xbcdb1f){logger[_0xb084('0x10')](_0xb084('0xb'),_0x275c8c,_0xbcdb1f);_0x18a300(_0xbcdb1f);});});} \ No newline at end of file +var _0x806d=['code','SmsApplication,\x20%s,\x20%s','message','result','catch','lodash','util','moment','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','request\x20sent','SmsApplication,\x20%s,\x20%s,\x20%s','error'];(function(_0xd307d9,_0x50e8e0){var _0x209bf8=function(_0x335069){while(--_0x335069){_0xd307d9['push'](_0xd307d9['shift']());}};_0x209bf8(++_0x50e8e0);}(_0x806d,0x131));var _0xd806=function(_0x543662,_0x1d196a){_0x543662=_0x543662-0x0;var _0x4b40bb=_0x806d[_0x543662];return _0x4b40bb;};'use strict';var _=require(_0xd806('0x0'));var util=require(_0xd806('0x1'));var moment=require(_0xd806('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd806('0x3'))['db'];var utils=require(_0xd806('0x4'));var logger=require('../../config/logger')(_0xd806('0x5'));var config=require('../../config/environment');var jayson=require(_0xd806('0x6'));var client=jayson[_0xd806('0x7')][_0xd806('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x26135a,_0x3a3446,_0x3873bf){return new BPromise(function(_0x1c1932,_0x4c8dea){return client[_0xd806('0x9')](_0x26135a,_0x3873bf)[_0xd806('0xa')](function(_0x902695){logger[_0xd806('0xb')]('SmsApplication,\x20%s,\x20%s',_0x3a3446,_0xd806('0xc'));logger['debug'](_0xd806('0xd'),_0x3a3446,_0xd806('0xc'),JSON['stringify'](_0x902695));if(_0x902695[_0xd806('0xe')]){if(_0x902695[_0xd806('0xe')][_0xd806('0xf')]===0x1f4){logger[_0xd806('0xe')](_0xd806('0x10'),_0x3a3446,_0x902695[_0xd806('0xe')][_0xd806('0x11')]);return _0x4c8dea(_0x902695[_0xd806('0xe')][_0xd806('0x11')]);}logger[_0xd806('0xe')](_0xd806('0x10'),_0x3a3446,_0x902695['error'][_0xd806('0x11')]);return _0x1c1932(_0x902695[_0xd806('0xe')][_0xd806('0x11')]);}else{logger['info'](_0xd806('0x10'),_0x3a3446,'request\x20sent');_0x1c1932(_0x902695[_0xd806('0x12')][_0xd806('0x11')]);}})[_0xd806('0x13')](function(_0x138725){logger[_0xd806('0xe')](_0xd806('0x10'),_0x3a3446,_0x138725);_0x4c8dea(_0x138725);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index ff6f6be..36b3bb4 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 _0x7916=['smsinteraction:update','update','sms','destroy','delete','/:id/tags','removeTags','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsInteraction.controller','isAuthenticated','index','/describe','describe','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','tracked','smsinteraction:addtags','put','/:id'];(function(_0x35acf5,_0x4577af){var _0x3ffed3=function(_0x58d47c){while(--_0x58d47c){_0x35acf5['push'](_0x35acf5['shift']());}};_0x3ffed3(++_0x4577af);}(_0x7916,0x128));var _0x6791=function(_0x462c5d,_0x128b64){_0x462c5d=_0x462c5d-0x0;var _0x1282c8=_0x7916[_0x462c5d];return _0x1282c8;};'use strict';var multer=require(_0x6791('0x0'));var util=require('util');var path=require(_0x6791('0x1'));var timeout=require(_0x6791('0x2'));var express=require('express');var router=express[_0x6791('0x3')]();var fs_extra=require(_0x6791('0x4'));var auth=require(_0x6791('0x5'));var interaction=require(_0x6791('0x6'));var config=require('../../config/environment');var controller=require(_0x6791('0x7'));router['get']('/',auth[_0x6791('0x8')](),controller[_0x6791('0x9')]);router['get'](_0x6791('0xa'),auth['isAuthenticated'](),controller[_0x6791('0xb')]);router['get']('/:id',auth[_0x6791('0x8')](),controller[_0x6791('0xc')]);router['get'](_0x6791('0xd'),auth[_0x6791('0x8')](),controller[_0x6791('0xe')]);router['get'](_0x6791('0xf'),auth[_0x6791('0x8')](),controller[_0x6791('0x10')]);router[_0x6791('0x11')]('/',auth[_0x6791('0x8')](),controller[_0x6791('0x12')]);router[_0x6791('0x11')](_0x6791('0xd'),auth[_0x6791('0x8')](),controller[_0x6791('0x13')]);router[_0x6791('0x11')]('/:id/tags',auth['isAuthenticated'](),interaction[_0x6791('0x14')]('sms',_0x6791('0x15')),controller['addTags']);router[_0x6791('0x16')](_0x6791('0x17'),auth['isAuthenticated'](),interaction[_0x6791('0x14')]('sms',_0x6791('0x18')),controller[_0x6791('0x19')]);router['delete'](_0x6791('0x17'),auth[_0x6791('0x8')](),interaction['tracked'](_0x6791('0x1a'),'smsinteraction:destroy'),controller[_0x6791('0x1b')]);router[_0x6791('0x1c')](_0x6791('0x1d'),auth[_0x6791('0x8')](),controller[_0x6791('0x1e')]);module[_0x6791('0x1f')]=router; \ No newline at end of file +var _0xb03e=['exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags','addTags','smsinteraction:update','update','delete','smsinteraction:destroy','destroy','removeTags'];(function(_0x462577,_0x3a25c1){var _0x238cca=function(_0xe6f466){while(--_0xe6f466){_0x462577['push'](_0x462577['shift']());}};_0x238cca(++_0x3a25c1);}(_0xb03e,0x1eb));var _0xeb03=function(_0x26b618,_0x105811){_0x26b618=_0x26b618-0x0;var _0x78475b=_0xb03e[_0x26b618];return _0x78475b;};'use strict';var multer=require('multer');var util=require(_0xeb03('0x0'));var path=require(_0xeb03('0x1'));var timeout=require(_0xeb03('0x2'));var express=require(_0xeb03('0x3'));var router=express[_0xeb03('0x4')]();var fs_extra=require(_0xeb03('0x5'));var auth=require(_0xeb03('0x6'));var interaction=require(_0xeb03('0x7'));var config=require(_0xeb03('0x8'));var controller=require(_0xeb03('0x9'));router[_0xeb03('0xa')]('/',auth[_0xeb03('0xb')](),controller['index']);router[_0xeb03('0xa')](_0xeb03('0xc'),auth[_0xeb03('0xb')](),controller[_0xeb03('0xd')]);router[_0xeb03('0xa')](_0xeb03('0xe'),auth['isAuthenticated'](),controller[_0xeb03('0xf')]);router[_0xeb03('0xa')](_0xeb03('0x10'),auth['isAuthenticated'](),controller[_0xeb03('0x11')]);router['get'](_0xeb03('0x12'),auth[_0xeb03('0xb')](),controller[_0xeb03('0x13')]);router[_0xeb03('0x14')]('/',auth[_0xeb03('0xb')](),controller[_0xeb03('0x15')]);router[_0xeb03('0x14')](_0xeb03('0x10'),auth[_0xeb03('0xb')](),controller[_0xeb03('0x16')]);router[_0xeb03('0x14')](_0xeb03('0x17'),auth['isAuthenticated'](),interaction[_0xeb03('0x18')](_0xeb03('0x19'),_0xeb03('0x1a')),controller[_0xeb03('0x1b')]);router['put'](_0xeb03('0xe'),auth[_0xeb03('0xb')](),interaction[_0xeb03('0x18')]('sms',_0xeb03('0x1c')),controller[_0xeb03('0x1d')]);router[_0xeb03('0x1e')](_0xeb03('0xe'),auth[_0xeb03('0xb')](),interaction[_0xeb03('0x18')](_0xeb03('0x19'),_0xeb03('0x1f')),controller[_0xeb03('0x20')]);router[_0xeb03('0x1e')](_0xeb03('0x17'),auth[_0xeb03('0xb')](),controller[_0xeb03('0x21')]);module[_0xeb03('0x22')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index d1b4abe..dd35cb5 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 _0x50a5=['INTEGER','sequelize','moment','STRING','DATE','ENUM','out','BOOLEAN'];(function(_0x38bb7f,_0x2bd8eb){var _0x4179a3=function(_0x3b613b){while(--_0x3b613b){_0x38bb7f['push'](_0x38bb7f['shift']());}};_0x4179a3(++_0x2bd8eb);}(_0x50a5,0xd1));var _0x550a=function(_0x162be3,_0x2447bc){_0x162be3=_0x162be3-0x0;var _0x235805=_0x50a5[_0x162be3];return _0x235805;};'use strict';var Sequelize=require(_0x550a('0x0'));var moment=require(_0x550a('0x1'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x550a('0x2')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x550a('0x2')]},'phone':{'type':Sequelize[_0x550a('0x2')]},'read1stAt':{'type':Sequelize[_0x550a('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x550a('0x4')]('in',_0x550a('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x550a('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x550a('0x4')]('in',_0x550a('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x550a('0x6')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x550a('0x7')]}}; \ No newline at end of file +var _0x19cb=['DATE','STRING','ENUM','out','BOOLEAN','INTEGER','moment','exports'];(function(_0x32bffb,_0x2d7bbe){var _0x54b297=function(_0x4aebfb){while(--_0x4aebfb){_0x32bffb['push'](_0x32bffb['shift']());}};_0x54b297(++_0x2d7bbe);}(_0x19cb,0x146));var _0xb19c=function(_0x1283cd,_0xf058c7){_0x1283cd=_0x1283cd-0x0;var _0x56b10b=_0x19cb[_0x1283cd];return _0x56b10b;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xb19c('0x0'));module[_0xb19c('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xb19c('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xb19c('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xb19c('0x2')]},'firstMsgDirection':{'type':Sequelize[_0xb19c('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xb19c('0x4')]('in',_0xb19c('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xb19c('0x6')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xb19c('0x7')]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 35dc371..d83711b 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 _0x1979=['direction','read','SmsAccount','Account','Owner','get','mkdirSync','Sms','N.A.','closed','closedAt','disposition','out','lastName','secret','value','renderFile','views','transcript-','createPdfFromHTML','log','unlinkSync','rimraf','moment','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','../../config/environment','../../mysqldb','defaults','socket.io-emitter','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','error','name','map','rawAttributes','fieldName','type','key','getOptions','findAll','sms','query','user','show','params','model','SmsInteraction','keys','filters','intersection','attributes','includeAll','merge','options','find','catch','create','body','describe','addMessage','SmsMessage','ids','omit','getMessages','findOne','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','SmsInteractionId','filter','split','format','YYYY-MM-DD\x20HH:mm:ss','include','addTags','color','emit','smsInteractionTags:save','removeTags','download','unix','toString','root','server','files','join','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','firstName','Messages','createdAt'];(function(_0x257b0e,_0x563d7e){var _0x27ac2a=function(_0x3a4bbc){while(--_0x3a4bbc){_0x257b0e['push'](_0x257b0e['shift']());}};_0x27ac2a(++_0x563d7e);}(_0x1979,0x8b));var _0x9197=function(_0x3cb30b,_0x504b3e){_0x3cb30b=_0x3cb30b-0x0;var _0x2ca717=_0x1979[_0x3cb30b];return _0x2ca717;};'use strict';var rimraf=require(_0x9197('0x0'));var zipdir=require('zip-dir');var moment=require(_0x9197('0x1'));var BPromise=require('bluebird');var util=require('util');var path=require('path');var ejs=require(_0x9197('0x2'));var fs=require('fs');var _=require(_0x9197('0x3'));var Redis=require(_0x9197('0x4'));var interaction=require(_0x9197('0x5'));var qs=require(_0x9197('0x6'));var pdf=require(_0x9197('0x7'));var logger=require(_0x9197('0x8'))('api');var config=require(_0x9197('0x9'));var db=require(_0x9197('0xa'))['db'];config['redis']=_[_0x9197('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x9197('0xc'))(new Redis(config['redis']));require('./smsInteraction.socket')['register'](socket);function respondWithStatusCode(_0x96f40f,_0x2e3295){_0x2e3295=_0x2e3295||0xcc;return function(_0x595fa4){if(_0x595fa4){return _0x96f40f[_0x9197('0xd')](_0x2e3295);}return _0x96f40f[_0x9197('0xe')](_0x2e3295)[_0x9197('0xf')]();};}function respondWithResult(_0x34c96b,_0x2c413f){_0x2c413f=_0x2c413f||0xc8;return function(_0x39c3c2){if(_0x39c3c2){return _0x34c96b[_0x9197('0xe')](_0x2c413f)[_0x9197('0x10')](_0x39c3c2);}};}function respondWithFilteredResult(_0x2d5eeb,_0x201827){return function(_0x149066){if(_0x149066){var _0x2c8cd9=typeof _0x201827[_0x9197('0x11')]===_0x9197('0x12')&&typeof _0x201827[_0x9197('0x13')]===_0x9197('0x12');var _0xe63edb=_0x149066[_0x9197('0x14')];var _0x1e53cf=_0x2c8cd9?0x0:_0x201827['offset'];var _0x1c587e=_0x2c8cd9?_0x149066[_0x9197('0x14')]:_0x201827[_0x9197('0x11')]+_0x201827[_0x9197('0x13')];var _0x3f6f92;if(_0x1c587e>=_0xe63edb){_0x1c587e=_0xe63edb;_0x3f6f92=0xc8;}else{_0x3f6f92=0xce;}_0x2d5eeb['status'](_0x3f6f92);return _0x2d5eeb[_0x9197('0x15')](_0x9197('0x16'),_0x1e53cf+'-'+_0x1c587e+'/'+_0xe63edb)[_0x9197('0x10')](_0x149066);}return null;};}function saveUpdates(_0xd3f153){return function(_0x2771b4){if(_0x2771b4){return _0x2771b4[_0x9197('0x17')](_0xd3f153)[_0x9197('0x18')](function(_0x3e726e){return _0x3e726e;});}return null;};}function removeEntity(_0x44dab2){return function(_0x21eb81){if(_0x21eb81){return _0x21eb81[_0x9197('0x19')]()[_0x9197('0x18')](function(){_0x44dab2[_0x9197('0xe')](0xcc)[_0x9197('0xf')]();});}};}function handleEntityNotFound(_0x3b38a0){return function(_0x7b9301){if(!_0x7b9301){_0x3b38a0[_0x9197('0xd')](0x194);}return _0x7b9301;};}function handleError(_0x403769,_0x5a8568){_0x5a8568=_0x5a8568||0x1f4;return function(_0x26957b){logger[_0x9197('0x1a')](_0x26957b['stack']);if(_0x26957b['name']){delete _0x26957b[_0x9197('0x1b')];}_0x403769[_0x9197('0xe')](_0x5a8568)['send'](_0x26957b);};}exports['index']=function(_0x4866d9,_0x52fcfc){var _0x5390a8={};var _0x278479=_[_0x9197('0x1c')](db['SmsInteraction'][_0x9197('0x1d')],function(_0x11f9e3){return{'name':_0x11f9e3[_0x9197('0x1e')],'type':_0x11f9e3[_0x9197('0x1f')][_0x9197('0x20')]};});_0x5390a8=qs[_0x9197('0x21')](_0x278479,_0x4866d9);return interaction[_0x9197('0x22')](_0x9197('0x23'),_0x4866d9[_0x9197('0x24')],_0x4866d9[_0x9197('0x25')],_0x5390a8,_0x278479)[_0x9197('0x18')](respondWithFilteredResult(_0x52fcfc,_0x5390a8))['catch'](handleError(_0x52fcfc,null));};exports[_0x9197('0x26')]=function(_0x2aa816,_0x5985d8){var _0x348391={'raw':![],'where':{'id':_0x2aa816[_0x9197('0x27')]['id']}},_0x52f94d={};_0x52f94d[_0x9197('0x28')]=_['keys'](db[_0x9197('0x29')][_0x9197('0x1d')]);_0x52f94d[_0x9197('0x24')]=_[_0x9197('0x2a')](_0x2aa816[_0x9197('0x24')]);_0x52f94d[_0x9197('0x2b')]=_[_0x9197('0x2c')](_0x52f94d[_0x9197('0x28')],_0x52f94d[_0x9197('0x24')]);_0x348391[_0x9197('0x2d')]=_[_0x9197('0x2c')](_0x52f94d[_0x9197('0x28')],qs['fields'](_0x2aa816[_0x9197('0x24')]['fields']));_0x348391[_0x9197('0x2d')]=_0x348391[_0x9197('0x2d')]['length']?_0x348391[_0x9197('0x2d')]:_0x52f94d[_0x9197('0x28')];if(_0x2aa816[_0x9197('0x24')][_0x9197('0x2e')]){_0x348391['include']=[{'all':!![]}];}_0x348391=_[_0x9197('0x2f')]({},_0x348391,_0x2aa816[_0x9197('0x30')]);return db[_0x9197('0x29')][_0x9197('0x31')](_0x348391)[_0x9197('0x18')](handleEntityNotFound(_0x5985d8,null))[_0x9197('0x18')](respondWithResult(_0x5985d8,null))[_0x9197('0x32')](handleError(_0x5985d8,null));};exports[_0x9197('0x33')]=function(_0x4adcb8,_0x136058){return db['SmsInteraction']['create'](_0x4adcb8['body'],{})[_0x9197('0x18')](respondWithResult(_0x136058,0xc9))[_0x9197('0x32')](handleError(_0x136058,null));};exports['update']=function(_0x2686ac,_0x82496){if(_0x2686ac[_0x9197('0x34')]['id']){delete _0x2686ac[_0x9197('0x34')]['id'];}return db[_0x9197('0x29')][_0x9197('0x31')]({'where':{'id':_0x2686ac['params']['id']}})[_0x9197('0x18')](handleEntityNotFound(_0x82496,null))[_0x9197('0x18')](saveUpdates(_0x2686ac['body'],null))['then'](respondWithResult(_0x82496,null))[_0x9197('0x32')](handleError(_0x82496,null));};exports['destroy']=function(_0x3e21b9,_0x432415){return db['SmsInteraction'][_0x9197('0x31')]({'where':{'id':_0x3e21b9[_0x9197('0x27')]['id']}})['then'](handleEntityNotFound(_0x432415,null))[_0x9197('0x18')](removeEntity(_0x432415,null))[_0x9197('0x32')](handleError(_0x432415,null));};exports['describe']=function(_0x3ae1c1,_0x2c8fa2){return db['SmsInteraction'][_0x9197('0x35')]()['then'](respondWithResult(_0x2c8fa2,null))[_0x9197('0x32')](handleError(_0x2c8fa2,null));};exports[_0x9197('0x36')]=function(_0x2fccbf,_0xca89ba){return db[_0x9197('0x37')][_0x9197('0x31')]({'where':{'id':_0x2fccbf[_0x9197('0x27')]['id']}})[_0x9197('0x18')](handleEntityNotFound(_0xca89ba,null))[_0x9197('0x18')](function(_0x4a6b97){if(_0x4a6b97){return _0x4a6b97[_0x9197('0x36')](_0x2fccbf[_0x9197('0x34')][_0x9197('0x38')],_[_0x9197('0x39')](_0x2fccbf['body'],[_0x9197('0x38'),'id'])||{});}})['then'](respondWithResult(_0xca89ba,null))['catch'](handleError(_0xca89ba,null));};exports[_0x9197('0x3a')]=function(_0x2ce332,_0x1e3f59){var _0x477319={'raw':![],'where':{}};var _0x581397={};var _0x3a0a93={'count':0x0,'rows':[]};return db[_0x9197('0x29')][_0x9197('0x3b')]({'where':{'id':_0x2ce332[_0x9197('0x27')]['id']}})[_0x9197('0x18')](handleEntityNotFound(_0x1e3f59,null))[_0x9197('0x18')](function(_0x3448bb){if(_0x3448bb){_0x581397[_0x9197('0x28')]=_[_0x9197('0x2a')](db[_0x9197('0x37')][_0x9197('0x1d')]);_0x581397[_0x9197('0x24')]=_[_0x9197('0x2a')](_0x2ce332[_0x9197('0x24')]);_0x581397[_0x9197('0x2b')]=_[_0x9197('0x2c')](_0x581397[_0x9197('0x28')],_0x581397[_0x9197('0x24')]);_0x477319[_0x9197('0x2d')]=_[_0x9197('0x2c')](_0x581397[_0x9197('0x28')],qs[_0x9197('0x3c')](_0x2ce332['query'][_0x9197('0x3c')]));_0x477319['attributes']=_0x477319['attributes'][_0x9197('0x3d')]?_0x477319['attributes']:_0x581397[_0x9197('0x28')];if(!_0x2ce332[_0x9197('0x24')][_0x9197('0x3e')](_0x9197('0x3f'))){_0x477319['limit']=qs[_0x9197('0x13')](_0x2ce332[_0x9197('0x24')]['limit']);_0x477319[_0x9197('0x11')]=qs[_0x9197('0x11')](_0x2ce332[_0x9197('0x24')][_0x9197('0x11')]);}_0x477319[_0x9197('0x40')]=qs[_0x9197('0x41')](_0x2ce332[_0x9197('0x24')][_0x9197('0x41')]);_0x477319[_0x9197('0x42')]=qs[_0x9197('0x2b')](_[_0x9197('0x43')](_0x2ce332['query'],_0x581397[_0x9197('0x2b')]));_0x477319['where'][_0x9197('0x44')]=_0x3448bb['id'];if(_0x2ce332[_0x9197('0x24')][_0x9197('0x45')]){_0x477319[_0x9197('0x42')]=_[_0x9197('0x2f')](_0x477319[_0x9197('0x42')],{'$or':_[_0x9197('0x1c')](_0x477319[_0x9197('0x2d')],function(_0x57c4e5){var _0x50fced={};_0x50fced[_0x57c4e5]={'$like':'%'+_0x2ce332[_0x9197('0x24')][_0x9197('0x45')]+'%'};return _0x50fced;})});}if(_0x2ce332['query']['$gte']){var _0x29a6f5=_0x2ce332[_0x9197('0x24')]['$gte'][_0x9197('0x46')](',');var _0x25e6d7={};_0x25e6d7[_0x29a6f5[0x0]]={'$gte':moment(_0x29a6f5[0x1])[_0x9197('0x47')](_0x9197('0x48'))};_0x477319[_0x9197('0x42')]=_[_0x9197('0x2f')](_0x477319[_0x9197('0x42')],_0x25e6d7);}_0x477319=_[_0x9197('0x2f')]({},_0x477319,_0x2ce332[_0x9197('0x30')]);return db['SmsMessage'][_0x9197('0x14')]({'where':_0x477319[_0x9197('0x42')]})[_0x9197('0x18')](function(_0x4b607e){_0x3a0a93['count']=_0x4b607e;if(_0x2ce332[_0x9197('0x24')][_0x9197('0x2e')]){_0x477319[_0x9197('0x49')]=[{'all':!![]}];}return db[_0x9197('0x37')][_0x9197('0x22')](_0x477319);})['then'](function(_0x14d181){_0x3a0a93['rows']=_0x14d181;return _0x3a0a93;});}})[_0x9197('0x18')](respondWithFilteredResult(_0x1e3f59,_0x477319))[_0x9197('0x32')](handleError(_0x1e3f59,null));};exports[_0x9197('0x4a')]=function(_0x15697d,_0x5aec22){return db[_0x9197('0x29')][_0x9197('0x31')]({'where':{'id':_0x15697d[_0x9197('0x27')]['id']}})[_0x9197('0x18')](handleEntityNotFound(_0x5aec22,null))[_0x9197('0x18')](function(_0xb20df4){if(_0xb20df4){return _0xb20df4['setTags'](_0x15697d['body'][_0x9197('0x38')],_[_0x9197('0x39')](_0x15697d[_0x9197('0x34')],[_0x9197('0x38'),'id'])||{})['spread'](function(){return db['Tag'][_0x9197('0x22')]({'attributes':['id','name',_0x9197('0x4b')],'where':{'id':_0x15697d[_0x9197('0x34')]['ids']}});})[_0x9197('0x18')](function(_0x8704f1){socket[_0x9197('0x4c')](_0x9197('0x4d'),{'id':Number(_0x15697d['params']['id']),'tags':_0x8704f1||[]});return{'id':Number(_0x15697d[_0x9197('0x27')]['id']),'tags':_0x8704f1||[]};});}})[_0x9197('0x18')](respondWithResult(_0x5aec22,null))[_0x9197('0x32')](handleError(_0x5aec22,null));};exports[_0x9197('0x4e')]=function(_0x5eb63d,_0x7fedb0){return db[_0x9197('0x29')][_0x9197('0x31')]({'where':{'id':_0x5eb63d['params']['id']}})[_0x9197('0x18')](handleEntityNotFound(_0x7fedb0,null))[_0x9197('0x18')](function(_0x156686){if(_0x156686){return _0x156686[_0x9197('0x4e')](_0x5eb63d[_0x9197('0x24')][_0x9197('0x38')]);}})[_0x9197('0x18')](respondWithStatusCode(_0x7fedb0,null))['catch'](handleError(_0x7fedb0,null));};exports[_0x9197('0x4f')]=function(_0x3e0984,_0x323f34){var _0x478b07=moment()[_0x9197('0x50')]()[_0x9197('0x51')]();var _0x2d3980=path['join'](config[_0x9197('0x52')],_0x9197('0x53'),_0x9197('0x54'),'tmp');var _0x343b92=path[_0x9197('0x55')](_0x2d3980,_0x478b07);var _0xe5cb1d=util['format'](_0x9197('0x56'),_0x3e0984[_0x9197('0x27')]['id'],_0x478b07);var _0x423ac8=path[_0x9197('0x55')](_0x2d3980,_0xe5cb1d);var _0x1c1cc8=[];_0x1c1cc8[_0x9197('0x57')]({'model':db[_0x9197('0x58')],'as':'User','attributes':['id',_0x9197('0x59')],'raw':!![]});_0x1c1cc8['push']({'model':db[_0x9197('0x5a')],'as':_0x9197('0x5b'),'attributes':['id',_0x9197('0x5c'),'lastName'],'raw':!![]});var _0x177784=[{'model':db[_0x9197('0x37')],'as':_0x9197('0x5d'),'attributes':['id',_0x9197('0x34'),_0x9197('0x5e'),_0x9197('0x5f'),'secret',_0x9197('0x60')],'include':_0x1c1cc8}];_0x177784[_0x9197('0x57')]({'model':db[_0x9197('0x61')],'as':_0x9197('0x62'),'attributes':['id',_0x9197('0x1b')]});_0x177784[_0x9197('0x57')]({'model':db['User'],'as':_0x9197('0x63'),'attributes':['id',_0x9197('0x59')]});return db[_0x9197('0x29')]['find']({'where':{'id':_0x3e0984['params']['id']},'include':_0x177784})[_0x9197('0x18')](handleEntityNotFound(_0x323f34,null))[_0x9197('0x18')](function(_0x410f90){if(_0x410f90){var _0x8710e5=_0x410f90[_0x9197('0x64')]({'plain':!![]});fs[_0x9197('0x65')](_0x343b92);var _0x47cd57={'channel':_0x9197('0x66'),'account':_0x8710e5[_0x9197('0x62')]['name'],'agent':_0x8710e5[_0x9197('0x63')]?_0x8710e5[_0x9197('0x63')]['fullname']:_0x9197('0x67'),'createdAt':moment(_0x8710e5[_0x9197('0x5e')])[_0x9197('0x47')](_0x9197('0x48'))[_0x9197('0x51')](),'closedAt':_0x8710e5[_0x9197('0x68')]?moment(_0x8710e5[_0x9197('0x69')])['format'](_0x9197('0x48'))['toString']():'','disposition':_0x8710e5[_0x9197('0x6a')],'messages':_(_0x8710e5[_0x9197('0x5d')])['filter']({'secret':![]})[_0x9197('0x1c')](function(_0x16377c){return{'date':moment(_0x16377c[_0x9197('0x5e')])[_0x9197('0x47')]('YYYY-MM-DD\x20HH:mm:ss')[_0x9197('0x51')](),'sender':_0x16377c[_0x9197('0x5f')]===_0x9197('0x6b')?_0x16377c[_0x9197('0x58')]?_0x16377c[_0x9197('0x58')][_0x9197('0x59')]:'System':_0x16377c[_0x9197('0x5b')][_0x9197('0x5c')]+(_0x16377c[_0x9197('0x5b')][_0x9197('0x6c')]?'\x20'+_0x16377c[_0x9197('0x5b')]['lastName']:''),'body':_0x16377c['body'],'direction':_0x16377c[_0x9197('0x5f')]===_0x9197('0x6b')?'A':'C','secret':_0x16377c[_0x9197('0x6d')],'read':_0x16377c[_0x9197('0x60')]};})[_0x9197('0x6e')]()};return ejs[_0x9197('0x6f')](path['join'](config[_0x9197('0x52')],_0x9197('0x53'),_0x9197('0x70'),'downloadInteraction.ejs'),{'interaction':_0x47cd57})[_0x9197('0x18')](function(_0x1870cf){var _0x4c5418=path[_0x9197('0x55')](_0x343b92,_0x9197('0x71')+_0x8710e5['id']+'-'+_0x478b07+'.pdf');var _0x549a89={'path':_0x4c5418,'channel':_0x9197('0x66'),'interactionId':_0x8710e5['id']};return pdf[_0x9197('0x72')](_0x1870cf,_0x549a89);})[_0x9197('0x18')](function(){return new BPromise(function(_0x385bea,_0x479bc2){zipdir(_0x343b92,{'saveTo':_0x423ac8},function(_0x158d09,_0x24234e){if(_0x158d09)return _0x479bc2(_0x158d09);return _0x385bea(_0x24234e);});})[_0x9197('0x18')](function(){return new BPromise(function(_0x568485,_0x4086e0){rimraf(_0x343b92,function(_0x12bcbe){if(_0x12bcbe)_0x4086e0(_0x12bcbe);return _0x568485();});});})[_0x9197('0x18')](function(){return _0x323f34[_0x9197('0x4f')](_0x423ac8,_0xe5cb1d,function(_0xd327a){if(_0xd327a){console[_0x9197('0x73')]('err',_0xd327a);}else{fs[_0x9197('0x74')](_0x423ac8);}});});});}else{return _0x323f34['sendStatus'](0xc8);}})['catch'](handleError(_0x323f34,null));}; \ No newline at end of file +var _0x6ced=['addTags','setTags','spread','emit','smsInteractionTags:save','removeTags','download','toString','join','server','tmp','transcript-%d-%s.zip','push','User','CmContact','Contact','firstName','createdAt','direction','secret','read','Account','name','Owner','fullname','get','Sms','N.A.','closed','closedAt','disposition','Messages','out','System','lastName','value','root','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','err','unlinkSync','moment','bluebird','ejs','ioredis','../../components/interaction/service','../../components/export/pdf','../../config/logger','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','then','destroy','error','send','map','SmsInteraction','fieldName','type','key','getOptions','findAll','query','user','catch','show','params','model','rawAttributes','keys','filters','intersection','attributes','fields','length','include','merge','create','body','update','find','describe','addMessage','SmsMessage','ids','omit','getMessages','findOne','hasOwnProperty','nolimit','order','sort','where','pick','SmsInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','options','rows'];(function(_0x568c76,_0x308d4b){var _0x46736f=function(_0x2a6582){while(--_0x2a6582){_0x568c76['push'](_0x568c76['shift']());}};_0x46736f(++_0x308d4b);}(_0x6ced,0x116));var _0xd6ce=function(_0x1f3a13,_0x1a6962){_0x1f3a13=_0x1f3a13-0x0;var _0x1bce83=_0x6ced[_0x1f3a13];return _0x1bce83;};'use strict';var rimraf=require('rimraf');var zipdir=require('zip-dir');var moment=require(_0xd6ce('0x0'));var BPromise=require(_0xd6ce('0x1'));var util=require('util');var path=require('path');var ejs=require(_0xd6ce('0x2'));var fs=require('fs');var _=require('lodash');var Redis=require(_0xd6ce('0x3'));var interaction=require(_0xd6ce('0x4'));var qs=require('../../components/parsers/qs');var pdf=require(_0xd6ce('0x5'));var logger=require(_0xd6ce('0x6'))('api');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xd6ce('0x7')]=_[_0xd6ce('0x8')](config['redis'],{'host':_0xd6ce('0x9'),'port':0x18eb});var socket=require(_0xd6ce('0xa'))(new Redis(config[_0xd6ce('0x7')]));require(_0xd6ce('0xb'))['register'](socket);function respondWithStatusCode(_0x289b26,_0x2303ed){_0x2303ed=_0x2303ed||0xcc;return function(_0x43ff8e){if(_0x43ff8e){return _0x289b26[_0xd6ce('0xc')](_0x2303ed);}return _0x289b26['status'](_0x2303ed)[_0xd6ce('0xd')]();};}function respondWithResult(_0x411f5e,_0xe250f1){_0xe250f1=_0xe250f1||0xc8;return function(_0x51630f){if(_0x51630f){return _0x411f5e[_0xd6ce('0xe')](_0xe250f1)['json'](_0x51630f);}};}function respondWithFilteredResult(_0x4611bb,_0xc4b12b){return function(_0x53da1c){if(_0x53da1c){var _0x768717=typeof _0xc4b12b[_0xd6ce('0xf')]===_0xd6ce('0x10')&&typeof _0xc4b12b[_0xd6ce('0x11')]===_0xd6ce('0x10');var _0x5bf6b9=_0x53da1c[_0xd6ce('0x12')];var _0x4d32f9=_0x768717?0x0:_0xc4b12b[_0xd6ce('0xf')];var _0x477bcc=_0x768717?_0x53da1c['count']:_0xc4b12b[_0xd6ce('0xf')]+_0xc4b12b[_0xd6ce('0x11')];var _0x5a0978;if(_0x477bcc>=_0x5bf6b9){_0x477bcc=_0x5bf6b9;_0x5a0978=0xc8;}else{_0x5a0978=0xce;}_0x4611bb[_0xd6ce('0xe')](_0x5a0978);return _0x4611bb[_0xd6ce('0x13')](_0xd6ce('0x14'),_0x4d32f9+'-'+_0x477bcc+'/'+_0x5bf6b9)[_0xd6ce('0x15')](_0x53da1c);}return null;};}function saveUpdates(_0x421d9b){return function(_0x5d007a){if(_0x5d007a){return _0x5d007a['update'](_0x421d9b)[_0xd6ce('0x16')](function(_0x5175cc){return _0x5175cc;});}return null;};}function removeEntity(_0x2ddc24){return function(_0x21548e){if(_0x21548e){return _0x21548e[_0xd6ce('0x17')]()['then'](function(){_0x2ddc24['status'](0xcc)[_0xd6ce('0xd')]();});}};}function handleEntityNotFound(_0x9d5e15){return function(_0x20edf4){if(!_0x20edf4){_0x9d5e15['sendStatus'](0x194);}return _0x20edf4;};}function handleError(_0x6d8b8c,_0x1e2db3){_0x1e2db3=_0x1e2db3||0x1f4;return function(_0x8fb6ac){logger[_0xd6ce('0x18')](_0x8fb6ac['stack']);if(_0x8fb6ac['name']){delete _0x8fb6ac['name'];}_0x6d8b8c[_0xd6ce('0xe')](_0x1e2db3)[_0xd6ce('0x19')](_0x8fb6ac);};}exports['index']=function(_0x1f3324,_0x24d69b){var _0x5afb62={};var _0x4fa841=_[_0xd6ce('0x1a')](db[_0xd6ce('0x1b')]['rawAttributes'],function(_0x5e755b){return{'name':_0x5e755b[_0xd6ce('0x1c')],'type':_0x5e755b[_0xd6ce('0x1d')][_0xd6ce('0x1e')]};});_0x5afb62=qs[_0xd6ce('0x1f')](_0x4fa841,_0x1f3324);return interaction[_0xd6ce('0x20')]('sms',_0x1f3324[_0xd6ce('0x21')],_0x1f3324[_0xd6ce('0x22')],_0x5afb62,_0x4fa841)[_0xd6ce('0x16')](respondWithFilteredResult(_0x24d69b,_0x5afb62))[_0xd6ce('0x23')](handleError(_0x24d69b,null));};exports[_0xd6ce('0x24')]=function(_0x40c244,_0x1c2721){var _0x7b3fd5={'raw':![],'where':{'id':_0x40c244[_0xd6ce('0x25')]['id']}},_0x13ef26={};_0x13ef26[_0xd6ce('0x26')]=_['keys'](db[_0xd6ce('0x1b')][_0xd6ce('0x27')]);_0x13ef26[_0xd6ce('0x21')]=_[_0xd6ce('0x28')](_0x40c244[_0xd6ce('0x21')]);_0x13ef26[_0xd6ce('0x29')]=_[_0xd6ce('0x2a')](_0x13ef26['model'],_0x13ef26['query']);_0x7b3fd5[_0xd6ce('0x2b')]=_[_0xd6ce('0x2a')](_0x13ef26['model'],qs['fields'](_0x40c244[_0xd6ce('0x21')][_0xd6ce('0x2c')]));_0x7b3fd5[_0xd6ce('0x2b')]=_0x7b3fd5[_0xd6ce('0x2b')][_0xd6ce('0x2d')]?_0x7b3fd5[_0xd6ce('0x2b')]:_0x13ef26[_0xd6ce('0x26')];if(_0x40c244[_0xd6ce('0x21')]['includeAll']){_0x7b3fd5[_0xd6ce('0x2e')]=[{'all':!![]}];}_0x7b3fd5=_[_0xd6ce('0x2f')]({},_0x7b3fd5,_0x40c244['options']);return db[_0xd6ce('0x1b')]['find'](_0x7b3fd5)[_0xd6ce('0x16')](handleEntityNotFound(_0x1c2721,null))[_0xd6ce('0x16')](respondWithResult(_0x1c2721,null))[_0xd6ce('0x23')](handleError(_0x1c2721,null));};exports[_0xd6ce('0x30')]=function(_0x38bc6f,_0x4630f5){return db['SmsInteraction']['create'](_0x38bc6f[_0xd6ce('0x31')],{})['then'](respondWithResult(_0x4630f5,0xc9))['catch'](handleError(_0x4630f5,null));};exports[_0xd6ce('0x32')]=function(_0x356029,_0x578e){if(_0x356029[_0xd6ce('0x31')]['id']){delete _0x356029[_0xd6ce('0x31')]['id'];}return db[_0xd6ce('0x1b')]['find']({'where':{'id':_0x356029[_0xd6ce('0x25')]['id']}})['then'](handleEntityNotFound(_0x578e,null))[_0xd6ce('0x16')](saveUpdates(_0x356029[_0xd6ce('0x31')],null))[_0xd6ce('0x16')](respondWithResult(_0x578e,null))[_0xd6ce('0x23')](handleError(_0x578e,null));};exports[_0xd6ce('0x17')]=function(_0x5cb790,_0x157a2a){return db[_0xd6ce('0x1b')][_0xd6ce('0x33')]({'where':{'id':_0x5cb790[_0xd6ce('0x25')]['id']}})[_0xd6ce('0x16')](handleEntityNotFound(_0x157a2a,null))[_0xd6ce('0x16')](removeEntity(_0x157a2a,null))['catch'](handleError(_0x157a2a,null));};exports[_0xd6ce('0x34')]=function(_0x3979c7,_0x235e24){return db[_0xd6ce('0x1b')][_0xd6ce('0x34')]()[_0xd6ce('0x16')](respondWithResult(_0x235e24,null))[_0xd6ce('0x23')](handleError(_0x235e24,null));};exports[_0xd6ce('0x35')]=function(_0x2310bb,_0x527fa5){return db[_0xd6ce('0x36')][_0xd6ce('0x33')]({'where':{'id':_0x2310bb[_0xd6ce('0x25')]['id']}})[_0xd6ce('0x16')](handleEntityNotFound(_0x527fa5,null))[_0xd6ce('0x16')](function(_0x1e5ea0){if(_0x1e5ea0){return _0x1e5ea0[_0xd6ce('0x35')](_0x2310bb[_0xd6ce('0x31')][_0xd6ce('0x37')],_[_0xd6ce('0x38')](_0x2310bb[_0xd6ce('0x31')],[_0xd6ce('0x37'),'id'])||{});}})[_0xd6ce('0x16')](respondWithResult(_0x527fa5,null))[_0xd6ce('0x23')](handleError(_0x527fa5,null));};exports[_0xd6ce('0x39')]=function(_0x3cdc80,_0x4a8acb){var _0x5f29d4={'raw':![],'where':{}};var _0x336405={};var _0x20d531={'count':0x0,'rows':[]};return db['SmsInteraction'][_0xd6ce('0x3a')]({'where':{'id':_0x3cdc80[_0xd6ce('0x25')]['id']}})[_0xd6ce('0x16')](handleEntityNotFound(_0x4a8acb,null))[_0xd6ce('0x16')](function(_0x170f38){if(_0x170f38){_0x336405[_0xd6ce('0x26')]=_[_0xd6ce('0x28')](db['SmsMessage'][_0xd6ce('0x27')]);_0x336405[_0xd6ce('0x21')]=_[_0xd6ce('0x28')](_0x3cdc80[_0xd6ce('0x21')]);_0x336405['filters']=_['intersection'](_0x336405[_0xd6ce('0x26')],_0x336405[_0xd6ce('0x21')]);_0x5f29d4[_0xd6ce('0x2b')]=_[_0xd6ce('0x2a')](_0x336405[_0xd6ce('0x26')],qs['fields'](_0x3cdc80[_0xd6ce('0x21')][_0xd6ce('0x2c')]));_0x5f29d4['attributes']=_0x5f29d4['attributes']['length']?_0x5f29d4[_0xd6ce('0x2b')]:_0x336405[_0xd6ce('0x26')];if(!_0x3cdc80[_0xd6ce('0x21')][_0xd6ce('0x3b')](_0xd6ce('0x3c'))){_0x5f29d4[_0xd6ce('0x11')]=qs[_0xd6ce('0x11')](_0x3cdc80[_0xd6ce('0x21')]['limit']);_0x5f29d4['offset']=qs['offset'](_0x3cdc80[_0xd6ce('0x21')][_0xd6ce('0xf')]);}_0x5f29d4[_0xd6ce('0x3d')]=qs[_0xd6ce('0x3e')](_0x3cdc80[_0xd6ce('0x21')][_0xd6ce('0x3e')]);_0x5f29d4[_0xd6ce('0x3f')]=qs['filters'](_[_0xd6ce('0x40')](_0x3cdc80[_0xd6ce('0x21')],_0x336405[_0xd6ce('0x29')]));_0x5f29d4[_0xd6ce('0x3f')][_0xd6ce('0x41')]=_0x170f38['id'];if(_0x3cdc80[_0xd6ce('0x21')][_0xd6ce('0x42')]){_0x5f29d4[_0xd6ce('0x3f')]=_['merge'](_0x5f29d4[_0xd6ce('0x3f')],{'$or':_[_0xd6ce('0x1a')](_0x5f29d4[_0xd6ce('0x2b')],function(_0x320af7){var _0x46148e={};_0x46148e[_0x320af7]={'$like':'%'+_0x3cdc80['query']['filter']+'%'};return _0x46148e;})});}if(_0x3cdc80[_0xd6ce('0x21')][_0xd6ce('0x43')]){var _0x9df78c=_0x3cdc80['query'][_0xd6ce('0x43')][_0xd6ce('0x44')](',');var _0x4eb52f={};_0x4eb52f[_0x9df78c[0x0]]={'$gte':moment(_0x9df78c[0x1])[_0xd6ce('0x45')](_0xd6ce('0x46'))};_0x5f29d4['where']=_[_0xd6ce('0x2f')](_0x5f29d4[_0xd6ce('0x3f')],_0x4eb52f);}_0x5f29d4=_[_0xd6ce('0x2f')]({},_0x5f29d4,_0x3cdc80[_0xd6ce('0x47')]);return db[_0xd6ce('0x36')][_0xd6ce('0x12')]({'where':_0x5f29d4[_0xd6ce('0x3f')]})[_0xd6ce('0x16')](function(_0x4265a5){_0x20d531['count']=_0x4265a5;if(_0x3cdc80[_0xd6ce('0x21')]['includeAll']){_0x5f29d4[_0xd6ce('0x2e')]=[{'all':!![]}];}return db['SmsMessage'][_0xd6ce('0x20')](_0x5f29d4);})[_0xd6ce('0x16')](function(_0x3d8fb2){_0x20d531[_0xd6ce('0x48')]=_0x3d8fb2;return _0x20d531;});}})['then'](respondWithFilteredResult(_0x4a8acb,_0x5f29d4))[_0xd6ce('0x23')](handleError(_0x4a8acb,null));};exports[_0xd6ce('0x49')]=function(_0x48457b,_0x2a7099){return db[_0xd6ce('0x1b')][_0xd6ce('0x33')]({'where':{'id':_0x48457b['params']['id']}})[_0xd6ce('0x16')](handleEntityNotFound(_0x2a7099,null))['then'](function(_0x57f91f){if(_0x57f91f){return _0x57f91f[_0xd6ce('0x4a')](_0x48457b[_0xd6ce('0x31')][_0xd6ce('0x37')],_[_0xd6ce('0x38')](_0x48457b[_0xd6ce('0x31')],['ids','id'])||{})[_0xd6ce('0x4b')](function(){return db['Tag']['findAll']({'attributes':['id','name','color'],'where':{'id':_0x48457b['body'][_0xd6ce('0x37')]}});})[_0xd6ce('0x16')](function(_0x3fe8df){socket[_0xd6ce('0x4c')](_0xd6ce('0x4d'),{'id':Number(_0x48457b[_0xd6ce('0x25')]['id']),'tags':_0x3fe8df||[]});return{'id':Number(_0x48457b[_0xd6ce('0x25')]['id']),'tags':_0x3fe8df||[]};});}})[_0xd6ce('0x16')](respondWithResult(_0x2a7099,null))[_0xd6ce('0x23')](handleError(_0x2a7099,null));};exports[_0xd6ce('0x4e')]=function(_0x19b23a,_0xe4d0b){return db[_0xd6ce('0x1b')][_0xd6ce('0x33')]({'where':{'id':_0x19b23a[_0xd6ce('0x25')]['id']}})[_0xd6ce('0x16')](handleEntityNotFound(_0xe4d0b,null))['then'](function(_0x578600){if(_0x578600){return _0x578600[_0xd6ce('0x4e')](_0x19b23a['query'][_0xd6ce('0x37')]);}})[_0xd6ce('0x16')](respondWithStatusCode(_0xe4d0b,null))[_0xd6ce('0x23')](handleError(_0xe4d0b,null));};exports[_0xd6ce('0x4f')]=function(_0x113646,_0x2d9153){var _0x39be5b=moment()['unix']()[_0xd6ce('0x50')]();var _0x16c1dd=path[_0xd6ce('0x51')](config['root'],_0xd6ce('0x52'),'files',_0xd6ce('0x53'));var _0x1579b2=path[_0xd6ce('0x51')](_0x16c1dd,_0x39be5b);var _0x5640a9=util[_0xd6ce('0x45')](_0xd6ce('0x54'),_0x113646[_0xd6ce('0x25')]['id'],_0x39be5b);var _0xce385f=path[_0xd6ce('0x51')](_0x16c1dd,_0x5640a9);var _0xd016f6=[];_0xd016f6[_0xd6ce('0x55')]({'model':db['User'],'as':_0xd6ce('0x56'),'attributes':['id','fullname'],'raw':!![]});_0xd016f6[_0xd6ce('0x55')]({'model':db[_0xd6ce('0x57')],'as':_0xd6ce('0x58'),'attributes':['id',_0xd6ce('0x59'),'lastName'],'raw':!![]});var _0x285108=[{'model':db[_0xd6ce('0x36')],'as':'Messages','attributes':['id',_0xd6ce('0x31'),_0xd6ce('0x5a'),_0xd6ce('0x5b'),_0xd6ce('0x5c'),_0xd6ce('0x5d')],'include':_0xd016f6}];_0x285108['push']({'model':db['SmsAccount'],'as':_0xd6ce('0x5e'),'attributes':['id',_0xd6ce('0x5f')]});_0x285108[_0xd6ce('0x55')]({'model':db[_0xd6ce('0x56')],'as':_0xd6ce('0x60'),'attributes':['id',_0xd6ce('0x61')]});return db['SmsInteraction'][_0xd6ce('0x33')]({'where':{'id':_0x113646[_0xd6ce('0x25')]['id']},'include':_0x285108})['then'](handleEntityNotFound(_0x2d9153,null))['then'](function(_0x3b91dd){if(_0x3b91dd){var _0x5401fd=_0x3b91dd[_0xd6ce('0x62')]({'plain':!![]});fs['mkdirSync'](_0x1579b2);var _0x4a546f={'channel':_0xd6ce('0x63'),'account':_0x5401fd['Account'][_0xd6ce('0x5f')],'agent':_0x5401fd[_0xd6ce('0x60')]?_0x5401fd['Owner'][_0xd6ce('0x61')]:_0xd6ce('0x64'),'createdAt':moment(_0x5401fd[_0xd6ce('0x5a')])[_0xd6ce('0x45')]('YYYY-MM-DD\x20HH:mm:ss')[_0xd6ce('0x50')](),'closedAt':_0x5401fd[_0xd6ce('0x65')]?moment(_0x5401fd[_0xd6ce('0x66')])['format'](_0xd6ce('0x46'))[_0xd6ce('0x50')]():'','disposition':_0x5401fd[_0xd6ce('0x67')],'messages':_(_0x5401fd[_0xd6ce('0x68')])[_0xd6ce('0x42')]({'secret':![]})[_0xd6ce('0x1a')](function(_0x1ba08b){return{'date':moment(_0x1ba08b[_0xd6ce('0x5a')])[_0xd6ce('0x45')]('YYYY-MM-DD\x20HH:mm:ss')[_0xd6ce('0x50')](),'sender':_0x1ba08b[_0xd6ce('0x5b')]===_0xd6ce('0x69')?_0x1ba08b[_0xd6ce('0x56')]?_0x1ba08b[_0xd6ce('0x56')][_0xd6ce('0x61')]:_0xd6ce('0x6a'):_0x1ba08b[_0xd6ce('0x58')][_0xd6ce('0x59')]+(_0x1ba08b[_0xd6ce('0x58')][_0xd6ce('0x6b')]?'\x20'+_0x1ba08b[_0xd6ce('0x58')][_0xd6ce('0x6b')]:''),'body':_0x1ba08b[_0xd6ce('0x31')],'direction':_0x1ba08b['direction']===_0xd6ce('0x69')?'A':'C','secret':_0x1ba08b[_0xd6ce('0x5c')],'read':_0x1ba08b[_0xd6ce('0x5d')]};})[_0xd6ce('0x6c')]()};return ejs['renderFile'](path['join'](config[_0xd6ce('0x6d')],_0xd6ce('0x52'),'views',_0xd6ce('0x6e')),{'interaction':_0x4a546f})['then'](function(_0x334e50){var _0x14b7ee=path[_0xd6ce('0x51')](_0x1579b2,_0xd6ce('0x6f')+_0x5401fd['id']+'-'+_0x39be5b+_0xd6ce('0x70'));var _0xe45308={'path':_0x14b7ee,'channel':_0xd6ce('0x63'),'interactionId':_0x5401fd['id']};return pdf[_0xd6ce('0x71')](_0x334e50,_0xe45308);})[_0xd6ce('0x16')](function(){return new BPromise(function(_0x134cd2,_0x565ad5){zipdir(_0x1579b2,{'saveTo':_0xce385f},function(_0x6df034,_0x5a23fa){if(_0x6df034)return _0x565ad5(_0x6df034);return _0x134cd2(_0x5a23fa);});})[_0xd6ce('0x16')](function(){return new BPromise(function(_0x33efab,_0x38ef7a){rimraf(_0x1579b2,function(_0x16c33f){if(_0x16c33f)_0x38ef7a(_0x16c33f);return _0x33efab();});});})[_0xd6ce('0x16')](function(){return _0x2d9153['download'](_0xce385f,_0x5640a9,function(_0x1c4713){if(_0x1c4713){console[_0xd6ce('0x72')](_0xd6ce('0x73'),_0x1c4713);}else{fs[_0xd6ce('0x74')](_0xce385f);}});});});}else{return _0x2d9153['sendStatus'](0xc8);}})[_0xd6ce('0x23')](handleError(_0x2d9153,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 79f2d2b..ab33ddb 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 _0xf2e3=['save','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','events','SmsInteraction','../../mysqldb','SmsMessage','setMaxListeners'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0xf2e3,0x9b));var _0x3f2e=function(_0xfa634c,_0x414e0e){_0xfa634c=_0xfa634c-0x0;var _0x73e478=_0xf2e3[_0xfa634c];return _0x73e478;};'use strict';var EventEmitter=require(_0x3f2e('0x0'));var SmsInteraction=require('../../mysqldb')['db'][_0x3f2e('0x1')];var SmsMessage=require(_0x3f2e('0x2'))['db'][_0x3f2e('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x3f2e('0x4')](0x0);var events={'afterCreate':_0x3f2e('0x5'),'afterUpdate':_0x3f2e('0x6'),'afterDestroy':_0x3f2e('0x7')};function emitEvent(_0xabcf5c){return function(_0x216b26,_0x5f254a,_0x33a3b7){_0x216b26[_0x3f2e('0x8')]({'attributes':['id'],'raw':!![]})[_0x3f2e('0x9')](function(_0xdf499f){_0x216b26[_0x3f2e('0xa')](_0x3f2e('0xb'),_0xdf499f[_0x3f2e('0xc')](function(_0x434e0c){return{'id':_0x434e0c['id']};}));return SmsMessage[_0x3f2e('0xd')]({'where':{'SmsInteractionId':_0x216b26['id'],'direction':'in','read':![]},'raw':!![]});})[_0x3f2e('0x9')](function(_0x21f22b){_0x216b26[_0x3f2e('0xa')](_0x3f2e('0xe'),_0x21f22b[_0x3f2e('0xf')]);SmsInteractionEvents[_0x3f2e('0x10')](_0xabcf5c+':'+_0x216b26['id'],_0x216b26);SmsInteractionEvents[_0x3f2e('0x10')](_0xabcf5c,_0x216b26);_0x33a3b7(null);})[_0x3f2e('0x11')](_0x33a3b7(null));};}for(var e in events){if(events[_0x3f2e('0x12')](e)){var event=events[e];SmsInteraction[_0x3f2e('0x13')](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file +var _0x5204=['hook','exports','events','../../mysqldb','SmsMessage','setMaxListeners','save','update','getUsers','then','setDataValue','Users','unreadMessages','length','emit','catch','hasOwnProperty'];(function(_0x4e534d,_0x4a311a){var _0x562655=function(_0x142320){while(--_0x142320){_0x4e534d['push'](_0x4e534d['shift']());}};_0x562655(++_0x4a311a);}(_0x5204,0xdf));var _0x4520=function(_0x1283d4,_0x36b6f1){_0x1283d4=_0x1283d4-0x0;var _0x433643=_0x5204[_0x1283d4];return _0x433643;};'use strict';var EventEmitter=require(_0x4520('0x0'));var SmsInteraction=require(_0x4520('0x1'))['db']['SmsInteraction'];var SmsMessage=require(_0x4520('0x1'))['db'][_0x4520('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x4520('0x3')](0x0);var events={'afterCreate':_0x4520('0x4'),'afterUpdate':_0x4520('0x5'),'afterDestroy':'remove'};function emitEvent(_0x41d89c){return function(_0x58b8a8,_0x180174,_0x209381){_0x58b8a8[_0x4520('0x6')]({'attributes':['id'],'raw':!![]})[_0x4520('0x7')](function(_0x396d29){_0x58b8a8[_0x4520('0x8')](_0x4520('0x9'),_0x396d29['map'](function(_0x297f0a){return{'id':_0x297f0a['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x58b8a8['id'],'direction':'in','read':![]},'raw':!![]});})[_0x4520('0x7')](function(_0x37a617){_0x58b8a8[_0x4520('0x8')](_0x4520('0xa'),_0x37a617[_0x4520('0xb')]);SmsInteractionEvents[_0x4520('0xc')](_0x41d89c+':'+_0x58b8a8['id'],_0x58b8a8);SmsInteractionEvents[_0x4520('0xc')](_0x41d89c,_0x58b8a8);_0x209381(null);})[_0x4520('0xd')](_0x209381(null));};}for(var e in events){if(events[_0x4520('0xe')](e)){var event=events[e];SmsInteraction[_0x4520('0xf')](e,emitEvent(event));}}module[_0x4520('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 6a3c7ed..7a55fa8 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 _0x8002=['format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','SmsInteraction','sms_interactions','changed','closed'];(function(_0xe8b420,_0x1a892d){var _0x50f7b7=function(_0x2211ed){while(--_0x2211ed){_0xe8b420['push'](_0xe8b420['shift']());}};_0x50f7b7(++_0x1a892d);}(_0x8002,0x1e2));var _0x2800=function(_0x26af68,_0xd69f80){_0x26af68=_0x26af68-0x0;var _0x356d89=_0x8002[_0x26af68];return _0x356d89;};'use strict';var _=require(_0x2800('0x0'));var util=require('util');var logger=require(_0x2800('0x1'))(_0x2800('0x2'));var moment=require(_0x2800('0x3'));var BPromise=require(_0x2800('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2800('0x5'));var rimraf=require(_0x2800('0x6'));var config=require(_0x2800('0x7'));var attributes=require('./smsInteraction.attributes');module[_0x2800('0x8')]=function(_0x401c14,_0x3c8f1e){return _0x401c14[_0x2800('0x9')](_0x2800('0xa'),attributes,{'tableName':_0x2800('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x345457,_0x328747,_0x48252f){if(_0x345457[_0x2800('0xc')](_0x2800('0xd'))){_0x345457['closedAt']=moment()[_0x2800('0xe')](_0x2800('0xf'));}_0x48252f(null,_0x345457);}}});}; \ No newline at end of file +var _0x208a=['./smsInteraction.attributes','exports','define','SmsInteraction','sms_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment'];(function(_0x30fe6d,_0x4c7ab6){var _0xde954c=function(_0x265b13){while(--_0x265b13){_0x30fe6d['push'](_0x30fe6d['shift']());}};_0xde954c(++_0x4c7ab6);}(_0x208a,0x1de));var _0xa208=function(_0x59ea7a,_0x396b92){_0x59ea7a=_0x59ea7a-0x0;var _0x2ac10f=_0x208a[_0x59ea7a];return _0x2ac10f;};'use strict';var _=require(_0xa208('0x0'));var util=require(_0xa208('0x1'));var logger=require(_0xa208('0x2'))(_0xa208('0x3'));var moment=require(_0xa208('0x4'));var BPromise=require('bluebird');var rp=require(_0xa208('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa208('0x6'));var config=require(_0xa208('0x7'));var attributes=require(_0xa208('0x8'));module[_0xa208('0x9')]=function(_0x78aa6b,_0x4989b7){return _0x78aa6b[_0xa208('0xa')](_0xa208('0xb'),attributes,{'tableName':_0xa208('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2401b5,_0x4c26af,_0x38b0d7){if(_0x2401b5[_0xa208('0xd')](_0xa208('0xe'))){_0x2401b5[_0xa208('0xf')]=moment()[_0xa208('0x10')](_0xa208('0x11'));}_0x38b0d7(null,_0x2401b5);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 4aec4ca..d2228c8 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 _0xfb8d=['options','raw','limit','stringify','find','where','addTags','ids','omit','spread','AddTags','lodash','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','./smsInteraction.socket','request','then','info','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','error','SmsInteraction,\x20%s,\x20%s','message','result','catch','UpdateSmsInteraction','SmsInteraction','update','body'];(function(_0x8d0bf4,_0x1b0290){var _0x3f23eb=function(_0xe1be80){while(--_0xe1be80){_0x8d0bf4['push'](_0x8d0bf4['shift']());}};_0x3f23eb(++_0x1b0290);}(_0xfb8d,0xc9));var _0xdfb8=function(_0x48c9b5,_0x5d54de){_0x48c9b5=_0x48c9b5-0x0;var _0x42cdd9=_0xfb8d[_0x48c9b5];return _0x42cdd9;};'use strict';var _=require(_0xdfb8('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xdfb8('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdfb8('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xdfb8('0x3'));var logger=require(_0xdfb8('0x4'))('rpc');var config=require(_0xdfb8('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xdfb8('0x6')][_0xdfb8('0x7')]({'port':0x232a});config[_0xdfb8('0x8')]=_[_0xdfb8('0x9')](config[_0xdfb8('0x8')],{'host':_0xdfb8('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xdfb8('0xb'))['register'](socket);function respondWithRpcPromise(_0x3de961,_0x2211c8,_0x2877e6){return new BPromise(function(_0x5cd904,_0x5ecc57){return client[_0xdfb8('0xc')](_0x3de961,_0x2877e6)[_0xdfb8('0xd')](function(_0x905c0b){logger[_0xdfb8('0xe')]('SmsInteraction,\x20%s,\x20%s',_0x2211c8,_0xdfb8('0xf'));logger[_0xdfb8('0x10')](_0xdfb8('0x11'),_0x2211c8,_0xdfb8('0xf'),JSON['stringify'](_0x905c0b));if(_0x905c0b[_0xdfb8('0x12')]){if(_0x905c0b[_0xdfb8('0x12')]['code']===0x1f4){logger[_0xdfb8('0x12')](_0xdfb8('0x13'),_0x2211c8,_0x905c0b[_0xdfb8('0x12')]['message']);return _0x5ecc57(_0x905c0b[_0xdfb8('0x12')][_0xdfb8('0x14')]);}logger[_0xdfb8('0x12')](_0xdfb8('0x13'),_0x2211c8,_0x905c0b[_0xdfb8('0x12')]['message']);return _0x5cd904(_0x905c0b[_0xdfb8('0x12')][_0xdfb8('0x14')]);}else{logger['info'](_0xdfb8('0x13'),_0x2211c8,_0xdfb8('0xf'));_0x5cd904(_0x905c0b[_0xdfb8('0x15')][_0xdfb8('0x14')]);}})[_0xdfb8('0x16')](function(_0x2fbecd){logger[_0xdfb8('0x12')](_0xdfb8('0x13'),_0x2211c8,_0x2fbecd);_0x5ecc57(_0x2fbecd);});});}exports[_0xdfb8('0x17')]=function(_0xfc2021){var _0x2cfdb7=this;return new Promise(function(_0x17c750,_0x51388f){return db[_0xdfb8('0x18')][_0xdfb8('0x19')](_0xfc2021[_0xdfb8('0x1a')],{'raw':_0xfc2021[_0xdfb8('0x1b')]?_0xfc2021[_0xdfb8('0x1b')][_0xdfb8('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xfc2021[_0xdfb8('0x1b')]?_0xfc2021[_0xdfb8('0x1b')]['where']||null:null,'attributes':_0xfc2021[_0xdfb8('0x1b')]?_0xfc2021[_0xdfb8('0x1b')]['attributes']||null:null,'limit':_0xfc2021[_0xdfb8('0x1b')]?_0xfc2021['options'][_0xdfb8('0x1d')]||null:null})[_0xdfb8('0xd')](function(_0x51284c){logger[_0xdfb8('0xe')](_0xdfb8('0x17'),_0xfc2021);logger[_0xdfb8('0x10')]('UpdateSmsInteraction',_0xfc2021,JSON[_0xdfb8('0x1e')](_0x51284c));_0x17c750(_0x51284c);})[_0xdfb8('0x16')](function(_0x232c56){logger[_0xdfb8('0x12')](_0xdfb8('0x17'),_0x232c56['message'],_0xfc2021);_0x51388f(_0x2cfdb7[_0xdfb8('0x12')](0x1f4,_0x232c56[_0xdfb8('0x14')]));});});};exports['AddTagsToSmsInteraction']=function(_0x24851e){return new Promise(function(_0x430670,_0x455b81){return db[_0xdfb8('0x18')][_0xdfb8('0x1f')]({'where':_0x24851e[_0xdfb8('0x1b')]?_0x24851e[_0xdfb8('0x1b')][_0xdfb8('0x20')]||null:null})[_0xdfb8('0xd')](function(_0x15d365){if(_0x15d365){return _0x15d365[_0xdfb8('0x21')](_0x24851e[_0xdfb8('0x1a')][_0xdfb8('0x22')],_[_0xdfb8('0x23')](_0x24851e['body'],[_0xdfb8('0x22'),'id'])||{});}})[_0xdfb8('0x24')](function(_0x52dca2){logger[_0xdfb8('0xe')]('AddTags',_0x24851e);logger['debug']('AddTags',_0x24851e,JSON[_0xdfb8('0x1e')](_0x52dca2));_0x430670(_0x52dca2);})[_0xdfb8('0x16')](function(_0x1d9b6b){logger['error'](_0xdfb8('0x25'),_0x1d9b6b[_0xdfb8('0x14')],_0x24851e);_0x455b81(_this['error'](0x1f4,_0x1d9b6b['message']));});});}; \ No newline at end of file +var _0x4559=['./smsInteraction.socket','register','request','info','SmsInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','SmsInteraction,\x20%s,\x20%s','message','catch','UpdateSmsInteraction','update','body','options','raw','where','attributes','limit','then','debug','stringify','AddTagsToSmsInteraction','addTags','ids','spread','AddTags','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter'];(function(_0x4207f4,_0x1f778b){var _0x29a621=function(_0xa6f5b7){while(--_0xa6f5b7){_0x4207f4['push'](_0x4207f4['shift']());}};_0x29a621(++_0x1f778b);}(_0x4559,0x141));var _0x9455=function(_0x60df74,_0x458e29){_0x60df74=_0x60df74-0x0;var _0x5ee872=_0x4559[_0x60df74];return _0x5ee872;};'use strict';var _=require(_0x9455('0x0'));var util=require(_0x9455('0x1'));var moment=require('moment');var BPromise=require(_0x9455('0x2'));var rs=require(_0x9455('0x3'));var fs=require('fs');var Redis=require(_0x9455('0x4'));var db=require(_0x9455('0x5'))['db'];var utils=require(_0x9455('0x6'));var logger=require(_0x9455('0x7'))(_0x9455('0x8'));var config=require('../../config/environment');var jayson=require(_0x9455('0x9'));var client=jayson[_0x9455('0xa')][_0x9455('0xb')]({'port':0x232a});config[_0x9455('0xc')]=_[_0x9455('0xd')](config[_0x9455('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x9455('0xe'))(new Redis(config[_0x9455('0xc')]));require(_0x9455('0xf'))[_0x9455('0x10')](socket);function respondWithRpcPromise(_0x21d77c,_0x3d8000,_0x694f6d){return new BPromise(function(_0x7934c1,_0x3af3ba){return client[_0x9455('0x11')](_0x21d77c,_0x694f6d)['then'](function(_0x5f9e9b){logger[_0x9455('0x12')]('SmsInteraction,\x20%s,\x20%s',_0x3d8000,'request\x20sent');logger['debug'](_0x9455('0x13'),_0x3d8000,_0x9455('0x14'),JSON['stringify'](_0x5f9e9b));if(_0x5f9e9b[_0x9455('0x15')]){if(_0x5f9e9b[_0x9455('0x15')][_0x9455('0x16')]===0x1f4){logger[_0x9455('0x15')](_0x9455('0x17'),_0x3d8000,_0x5f9e9b[_0x9455('0x15')][_0x9455('0x18')]);return _0x3af3ba(_0x5f9e9b[_0x9455('0x15')]['message']);}logger[_0x9455('0x15')]('SmsInteraction,\x20%s,\x20%s',_0x3d8000,_0x5f9e9b[_0x9455('0x15')][_0x9455('0x18')]);return _0x7934c1(_0x5f9e9b[_0x9455('0x15')][_0x9455('0x18')]);}else{logger[_0x9455('0x12')](_0x9455('0x17'),_0x3d8000,_0x9455('0x14'));_0x7934c1(_0x5f9e9b['result'][_0x9455('0x18')]);}})[_0x9455('0x19')](function(_0x569460){logger['error'](_0x9455('0x17'),_0x3d8000,_0x569460);_0x3af3ba(_0x569460);});});}exports[_0x9455('0x1a')]=function(_0x2650ab){var _0x396b07=this;return new Promise(function(_0x3937c8,_0xf1ed7e){return db['SmsInteraction'][_0x9455('0x1b')](_0x2650ab[_0x9455('0x1c')],{'raw':_0x2650ab[_0x9455('0x1d')]?_0x2650ab['options'][_0x9455('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2650ab[_0x9455('0x1d')]?_0x2650ab[_0x9455('0x1d')][_0x9455('0x1f')]||null:null,'attributes':_0x2650ab['options']?_0x2650ab[_0x9455('0x1d')][_0x9455('0x20')]||null:null,'limit':_0x2650ab[_0x9455('0x1d')]?_0x2650ab[_0x9455('0x1d')][_0x9455('0x21')]||null:null})[_0x9455('0x22')](function(_0x283748){logger[_0x9455('0x12')]('UpdateSmsInteraction',_0x2650ab);logger[_0x9455('0x23')](_0x9455('0x1a'),_0x2650ab,JSON[_0x9455('0x24')](_0x283748));_0x3937c8(_0x283748);})['catch'](function(_0x3e6c75){logger[_0x9455('0x15')]('UpdateSmsInteraction',_0x3e6c75[_0x9455('0x18')],_0x2650ab);_0xf1ed7e(_0x396b07[_0x9455('0x15')](0x1f4,_0x3e6c75['message']));});});};exports[_0x9455('0x25')]=function(_0x34e9ca){return new Promise(function(_0x19e716,_0x414e62){return db['SmsInteraction']['find']({'where':_0x34e9ca[_0x9455('0x1d')]?_0x34e9ca[_0x9455('0x1d')][_0x9455('0x1f')]||null:null})['then'](function(_0x5cab38){if(_0x5cab38){return _0x5cab38[_0x9455('0x26')](_0x34e9ca[_0x9455('0x1c')][_0x9455('0x27')],_['omit'](_0x34e9ca['body'],[_0x9455('0x27'),'id'])||{});}})[_0x9455('0x28')](function(_0x377b55){logger['info'](_0x9455('0x29'),_0x34e9ca);logger[_0x9455('0x23')](_0x9455('0x29'),_0x34e9ca,JSON[_0x9455('0x24')](_0x377b55));_0x19e716(_0x377b55);})['catch'](function(_0x1409d0){logger[_0x9455('0x15')](_0x9455('0x29'),_0x1409d0['message'],_0x34e9ca);_0x414e62(_this[_0x9455('0x15')](0x1f4,_0x1409d0[_0x9455('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 5848643..3c71cd8 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 _0x8686=['length','update','emit','removeListener'];(function(_0x535bdc,_0x434176){var _0x3a643a=function(_0xec7740){while(--_0xec7740){_0x535bdc['push'](_0x535bdc['shift']());}};_0x3a643a(++_0x434176);}(_0x8686,0xd9));var _0x6868=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x8686[_0x53ccf2];return _0x5a2964;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=['save','remove',_0x6868('0x0')];function createListener(_0x3b753e,_0x3b9006){return function(_0x409e31){_0x3b9006[_0x6868('0x1')](_0x3b753e,_0x409e31);};}function removeListener(_0x5b72c5,_0x4d25f8){return function(){SmsInteractionEvents[_0x6868('0x2')](_0x5b72c5,_0x4d25f8);};}exports['register']=function(_0x2c8c53){for(var _0x1f9d59=0x0,_0x510780=events[_0x6868('0x3')];_0x1f9d59<_0x510780;_0x1f9d59++){var _0x13e055=events[_0x1f9d59];var _0x2a2e90=createListener('smsInteraction:'+_0x13e055,_0x2c8c53);SmsInteractionEvents['on'](_0x13e055,_0x2a2e90);}}; \ No newline at end of file +var _0x2930=['length','save','remove','update','emit','removeListener','register'];(function(_0x3fe0c2,_0x3fe93e){var _0x4cd1d8=function(_0x485456){while(--_0x485456){_0x3fe0c2['push'](_0x3fe0c2['shift']());}};_0x4cd1d8(++_0x3fe93e);}(_0x2930,0x7f));var _0x0293=function(_0xdf529e,_0x59db47){_0xdf529e=_0xdf529e-0x0;var _0x3c58ba=_0x2930[_0xdf529e];return _0x3c58ba;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0x0293('0x0'),_0x0293('0x1'),_0x0293('0x2')];function createListener(_0xf050c0,_0x156332){return function(_0x1b3ac7){_0x156332[_0x0293('0x3')](_0xf050c0,_0x1b3ac7);};}function removeListener(_0x9de0c,_0x4b5e4b){return function(){SmsInteractionEvents[_0x0293('0x4')](_0x9de0c,_0x4b5e4b);};}exports[_0x0293('0x5')]=function(_0x3af89c){for(var _0x517815=0x0,_0x48a433=events[_0x0293('0x6')];_0x517815<_0x48a433;_0x517815++){var _0x37c88d=events[_0x517815];var _0x3db8e7=createListener('smsInteraction:'+_0x37c88d,_0x3af89c);SmsInteractionEvents['on'](_0x37c88d,_0x3db8e7);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index e4b156b..ee207c3 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 _0x4b4b=['/describe','describe','show','post','tracked','sms','create','status','put','/:id','update','/:id/accept','/:id/reject','reject','delete','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','index'];(function(_0x35d823,_0x9effeb){var _0x4cceea=function(_0x176c94){while(--_0x176c94){_0x35d823['push'](_0x35d823['shift']());}};_0x4cceea(++_0x9effeb);}(_0x4b4b,0x96));var _0xb4b4=function(_0x58fac8,_0x5ec989){_0x58fac8=_0x58fac8-0x0;var _0x4a560e=_0x4b4b[_0x58fac8];return _0x4a560e;};'use strict';var multer=require(_0xb4b4('0x0'));var util=require('util');var path=require(_0xb4b4('0x1'));var timeout=require('connect-timeout');var express=require(_0xb4b4('0x2'));var router=express[_0xb4b4('0x3')]();var fs_extra=require(_0xb4b4('0x4'));var auth=require(_0xb4b4('0x5'));var interaction=require(_0xb4b4('0x6'));var config=require(_0xb4b4('0x7'));var controller=require(_0xb4b4('0x8'));router[_0xb4b4('0x9')]('/',auth[_0xb4b4('0xa')](),controller[_0xb4b4('0xb')]);router[_0xb4b4('0x9')](_0xb4b4('0xc'),auth[_0xb4b4('0xa')](),controller[_0xb4b4('0xd')]);router['get']('/:id',auth[_0xb4b4('0xa')](),controller[_0xb4b4('0xe')]);router[_0xb4b4('0xf')]('/',auth[_0xb4b4('0xa')](),interaction[_0xb4b4('0x10')](_0xb4b4('0x11'),'smsmessage:create'),controller[_0xb4b4('0x12')]);router[_0xb4b4('0xf')]('/:id/status',controller[_0xb4b4('0x13')]);router[_0xb4b4('0x14')](_0xb4b4('0x15'),auth[_0xb4b4('0xa')](),controller[_0xb4b4('0x16')]);router[_0xb4b4('0x14')](_0xb4b4('0x17'),auth['isAuthenticated'](),controller['accept']);router['put'](_0xb4b4('0x18'),auth['isAuthenticated'](),controller[_0xb4b4('0x19')]);router[_0xb4b4('0x1a')](_0xb4b4('0x15'),auth[_0xb4b4('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xbeb2=['exports','util','path','fs-extra','../../components/auth/service','./smsMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','sms','smsmessage:create','create','/:id/status','put','accept','delete'];(function(_0x215c73,_0x272244){var _0x3287b2=function(_0x59c9bc){while(--_0x59c9bc){_0x215c73['push'](_0x215c73['shift']());}};_0x3287b2(++_0x272244);}(_0xbeb2,0x1ba));var _0x2beb=function(_0x1ca86e,_0x17f5a8){_0x1ca86e=_0x1ca86e-0x0;var _0x2cae6d=_0xbeb2[_0x1ca86e];return _0x2cae6d;};'use strict';var multer=require('multer');var util=require(_0x2beb('0x0'));var path=require(_0x2beb('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x2beb('0x2'));var auth=require(_0x2beb('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x2beb('0x4'));router[_0x2beb('0x5')]('/',auth[_0x2beb('0x6')](),controller[_0x2beb('0x7')]);router[_0x2beb('0x5')](_0x2beb('0x8'),auth[_0x2beb('0x6')](),controller[_0x2beb('0x9')]);router[_0x2beb('0x5')](_0x2beb('0xa'),auth[_0x2beb('0x6')](),controller[_0x2beb('0xb')]);router[_0x2beb('0xc')]('/',auth[_0x2beb('0x6')](),interaction['tracked'](_0x2beb('0xd'),_0x2beb('0xe')),controller[_0x2beb('0xf')]);router['post'](_0x2beb('0x10'),controller['status']);router['put'](_0x2beb('0xa'),auth[_0x2beb('0x6')](),controller['update']);router[_0x2beb('0x11')]('/:id/accept',auth[_0x2beb('0x6')](),controller[_0x2beb('0x12')]);router[_0x2beb('0x11')]('/:id/reject',auth[_0x2beb('0x6')](),controller['reject']);router[_0x2beb('0x13')]('/:id',auth[_0x2beb('0x6')](),controller['destroy']);module[_0x2beb('0x14')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index fef78af..f3afc20 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 _0x1433=['TEXT','sequelize','exports','medium','BOOLEAN','ENUM','out','STRING','DATE'];(function(_0x5ca52d,_0x3a4a22){var _0x89e54e=function(_0x54bdf4){while(--_0x54bdf4){_0x5ca52d['push'](_0x5ca52d['shift']());}};_0x89e54e(++_0x3a4a22);}(_0x1433,0x121));var _0x3143=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x1433[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0x3143('0x0'));module[_0x3143('0x1')]={'body':{'type':Sequelize['TEXT'](_0x3143('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x3143('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x3143('0x4')]('in',_0x3143('0x5')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0x3143('0x6')]},'readAt':{'type':Sequelize[_0x3143('0x7')]},'secret':{'type':Sequelize[_0x3143('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x3143('0x6')]},'providerResponse':{'type':Sequelize[_0x3143('0x8')]}}; \ No newline at end of file +var _0x842d=['DATE','sequelize','exports','TEXT','out','STRING'];(function(_0x109532,_0x42e59f){var _0x23fd8f=function(_0x1e1f69){while(--_0x1e1f69){_0x109532['push'](_0x109532['shift']());}};_0x23fd8f(++_0x42e59f);}(_0x842d,0x12d));var _0xd842=function(_0x16e5d1,_0x9cf085){_0x16e5d1=_0x16e5d1-0x0;var _0x3f72e6=_0x842d[_0x16e5d1];return _0x3f72e6;};'use strict';var Sequelize=require(_0xd842('0x0'));module[_0xd842('0x1')]={'body':{'type':Sequelize[_0xd842('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xd842('0x3')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0xd842('0x4')](0xbe)},'phone':{'type':Sequelize[_0xd842('0x4')]},'readAt':{'type':Sequelize[_0xd842('0x5')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0xd842('0x4')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 3bc9674..29058f7 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 _0x32b6=['SIP/%s','channel','motionChannel','sms-interactions','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','Sequelize','contact','email','internal','event','EventManager','rejectmessage','SmsAccount','received\x20delivery\x20report\x20from','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','inspect','plivo','MessageUUID','sent','delivered','Status','plivio','results','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','redis','defaults','socket.io-emitter','./smsMessage.socket','jayson/promise','client','http','request','then','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','stack','name','index','map','SmsMessage','rawAttributes','fieldName','type','key','model','query','keys','attributes','fields','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','includeAll','findAll','rows','catch','params','length','include','options','find','create','body','describe','accept','sms','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','SmsInteraction','SmsInteractionId','isNil','read1stAt','format','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','SELECT','User','fullname','manual','interface'];(function(_0x919bbb,_0x55ef48){var _0x40971a=function(_0xc823b6){while(--_0xc823b6){_0x919bbb['push'](_0x919bbb['shift']());}};_0x40971a(++_0x55ef48);}(_0x32b6,0x1d1));var _0x632b=function(_0x16bd4a,_0x240c20){_0x16bd4a=_0x16bd4a-0x0;var _0x5d43c5=_0x32b6[_0x16bd4a];return _0x5d43c5;};'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'];config[_0x632b('0x18')]=_[_0x632b('0x19')](config[_0x632b('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x632b('0x1a'))(new Redis(config[_0x632b('0x18')]));require(_0x632b('0x1b'))['register'](socket);var jayson=require(_0x632b('0x1c'));var client=jayson[_0x632b('0x1d')][_0x632b('0x1e')]({'port':0x232c});var client9002=jayson[_0x632b('0x1d')][_0x632b('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x21cdd3,_0x4efe39,_0x17ddc5,_0x52f353){return new BPromise(function(_0x4fdef2,_0x1109d5){var _0x5afa1e=_0x52f353||client;return _0x5afa1e[_0x632b('0x1f')](_0x21cdd3,_0x17ddc5)[_0x632b('0x20')](function(_0x28c472){logger['info'](_0x632b('0x21'),_0x4efe39,_0x632b('0x22'));logger[_0x632b('0x23')](_0x632b('0x24'),_0x4efe39,'request\x20sent',JSON[_0x632b('0x25')](_0x28c472));if(_0x28c472[_0x632b('0x26')]){if(_0x28c472['error'][_0x632b('0x27')]===0x1f4){logger['error']('SmsMessage,\x20%s,\x20%s',_0x4efe39,_0x28c472[_0x632b('0x26')]['message']);return _0x1109d5(_0x28c472[_0x632b('0x26')][_0x632b('0x28')]);}logger[_0x632b('0x26')]('SmsMessage,\x20%s,\x20%s',_0x4efe39,_0x28c472[_0x632b('0x26')][_0x632b('0x28')]);return _0x4fdef2(_0x28c472['error'][_0x632b('0x28')]);}else{logger[_0x632b('0x29')](_0x632b('0x21'),_0x4efe39,_0x632b('0x22'));_0x4fdef2(_0x28c472[_0x632b('0x2a')][_0x632b('0x28')]);}})['catch'](function(_0x5e7b20){logger[_0x632b('0x26')]('SmsMessage,\x20%s,\x20%s',_0x4efe39,_0x5e7b20);_0x1109d5(_0x5e7b20);});});}function respondWithStatusCode(_0x4ebd26,_0x954fa0){_0x954fa0=_0x954fa0||0xcc;return function(_0x5d6855){if(_0x5d6855){return _0x4ebd26[_0x632b('0x2b')](_0x954fa0);}return _0x4ebd26[_0x632b('0x2c')](_0x954fa0)[_0x632b('0x2d')]();};}function respondWithResult(_0x18dc8c,_0x4728a8){_0x4728a8=_0x4728a8||0xc8;return function(_0x515d74){if(_0x515d74){return _0x18dc8c[_0x632b('0x2c')](_0x4728a8)[_0x632b('0x2e')](_0x515d74);}};}function respondWithFilteredResult(_0x33a625,_0x4f8410){return function(_0x1bb484){if(_0x1bb484){var _0x35348e=typeof _0x4f8410[_0x632b('0x2f')]===_0x632b('0x30')&&typeof _0x4f8410[_0x632b('0x31')]===_0x632b('0x30');var _0x3c5dc9=_0x1bb484[_0x632b('0x32')];var _0x1ace1b=_0x35348e?0x0:_0x4f8410[_0x632b('0x2f')];var _0x417793=_0x35348e?_0x1bb484[_0x632b('0x32')]:_0x4f8410[_0x632b('0x2f')]+_0x4f8410[_0x632b('0x31')];var _0x227497;if(_0x417793>=_0x3c5dc9){_0x417793=_0x3c5dc9;_0x227497=0xc8;}else{_0x227497=0xce;}_0x33a625[_0x632b('0x2c')](_0x227497);return _0x33a625[_0x632b('0x33')](_0x632b('0x34'),_0x1ace1b+'-'+_0x417793+'/'+_0x3c5dc9)[_0x632b('0x2e')](_0x1bb484);}return null;};}function patchUpdates(_0x12f00){return function(_0x4899b0){try{jsonpatch[_0x632b('0x35')](_0x4899b0,_0x12f00,!![]);}catch(_0x4401dc){return BPromise[_0x632b('0x36')](_0x4401dc);}return _0x4899b0[_0x632b('0x37')]();};}function saveUpdates(_0x5857e4,_0x387677){return function(_0x4ebef2){if(_0x4ebef2){return _0x4ebef2[_0x632b('0x38')](_0x5857e4)[_0x632b('0x20')](function(_0x4ffe00){return _0x4ffe00;});}return null;};}function removeEntity(_0x2265aa,_0xa228ed){return function(_0x11f450){if(_0x11f450){return _0x11f450[_0x632b('0x39')]()[_0x632b('0x20')](function(){_0x2265aa[_0x632b('0x2c')](0xcc)[_0x632b('0x2d')]();});}};}function handleEntityNotFound(_0x300b60,_0x4d374f){return function(_0x5b2c41){if(!_0x5b2c41){_0x300b60[_0x632b('0x2b')](0x194);}return _0x5b2c41;};}function handleError(_0x18e484,_0x52872a){_0x52872a=_0x52872a||0x1f4;return function(_0x2a723a){logger[_0x632b('0x26')](_0x2a723a[_0x632b('0x3a')]);if(_0x2a723a[_0x632b('0x3b')]){delete _0x2a723a[_0x632b('0x3b')];}_0x18e484['status'](_0x52872a)['send'](_0x2a723a);};}exports[_0x632b('0x3c')]=function(_0x581b92,_0x3a416c){var _0x31f7bb={},_0x3d6199={},_0x3c66a8={'count':0x0,'rows':[]};var _0x3cc0ac=_[_0x632b('0x3d')](db[_0x632b('0x3e')][_0x632b('0x3f')],function(_0x2730c2){return{'name':_0x2730c2[_0x632b('0x40')],'type':_0x2730c2[_0x632b('0x41')][_0x632b('0x42')]};});_0x3d6199[_0x632b('0x43')]=_[_0x632b('0x3d')](_0x3cc0ac,_0x632b('0x3b'));_0x3d6199[_0x632b('0x44')]=_[_0x632b('0x45')](_0x581b92['query']);_0x3d6199['filters']=_['intersection'](_0x3d6199['model'],_0x3d6199['query']);_0x31f7bb[_0x632b('0x46')]=_['intersection'](_0x3d6199['model'],qs['fields'](_0x581b92[_0x632b('0x44')][_0x632b('0x47')]));_0x31f7bb[_0x632b('0x46')]=_0x31f7bb[_0x632b('0x46')]['length']?_0x31f7bb[_0x632b('0x46')]:_0x3d6199[_0x632b('0x43')];if(!_0x581b92[_0x632b('0x44')]['hasOwnProperty'](_0x632b('0x48'))){_0x31f7bb[_0x632b('0x31')]=qs[_0x632b('0x31')](_0x581b92[_0x632b('0x44')][_0x632b('0x31')]);_0x31f7bb[_0x632b('0x2f')]=qs['offset'](_0x581b92[_0x632b('0x44')][_0x632b('0x2f')]);}_0x31f7bb[_0x632b('0x49')]=qs[_0x632b('0x4a')](_0x581b92['query']['sort']);_0x31f7bb[_0x632b('0x4b')]=qs[_0x632b('0x4c')](_[_0x632b('0x4d')](_0x581b92[_0x632b('0x44')],_0x3d6199[_0x632b('0x4c')]),_0x3cc0ac);if(_0x581b92[_0x632b('0x44')]['filter']){_0x31f7bb[_0x632b('0x4b')]=_[_0x632b('0x4e')](_0x31f7bb[_0x632b('0x4b')],{'$or':_[_0x632b('0x3d')](_0x3cc0ac,function(_0x2306b1){if(_0x2306b1[_0x632b('0x41')]!==_0x632b('0x4f')){var _0x110f4={};_0x110f4[_0x2306b1['name']]={'$like':'%'+_0x581b92[_0x632b('0x44')]['filter']+'%'};return _0x110f4;}})});}_0x31f7bb=_[_0x632b('0x4e')]({},_0x31f7bb,_0x581b92['options']);var _0x252ef0={'where':_0x31f7bb[_0x632b('0x4b')]};return db[_0x632b('0x3e')][_0x632b('0x32')](_0x252ef0)[_0x632b('0x20')](function(_0x57a580){_0x3c66a8[_0x632b('0x32')]=_0x57a580;if(_0x581b92[_0x632b('0x44')][_0x632b('0x50')]){_0x31f7bb['include']=[{'all':!![]}];}return db[_0x632b('0x3e')][_0x632b('0x51')](_0x31f7bb);})[_0x632b('0x20')](function(_0x35f25a){_0x3c66a8[_0x632b('0x52')]=_0x35f25a;return _0x3c66a8;})['then'](respondWithFilteredResult(_0x3a416c,_0x31f7bb))[_0x632b('0x53')](handleError(_0x3a416c,null));};exports['show']=function(_0x33da2b,_0x369cdc){var _0x3ccf17={'raw':!![],'where':{'id':_0x33da2b[_0x632b('0x54')]['id']}},_0x465566={};_0x465566['model']=_['keys'](db[_0x632b('0x3e')][_0x632b('0x3f')]);_0x465566[_0x632b('0x44')]=_[_0x632b('0x45')](_0x33da2b[_0x632b('0x44')]);_0x465566[_0x632b('0x4c')]=_['intersection'](_0x465566[_0x632b('0x43')],_0x465566[_0x632b('0x44')]);_0x3ccf17[_0x632b('0x46')]=_['intersection'](_0x465566[_0x632b('0x43')],qs[_0x632b('0x47')](_0x33da2b[_0x632b('0x44')][_0x632b('0x47')]));_0x3ccf17['attributes']=_0x3ccf17[_0x632b('0x46')][_0x632b('0x55')]?_0x3ccf17[_0x632b('0x46')]:_0x465566[_0x632b('0x43')];if(_0x33da2b[_0x632b('0x44')]['includeAll']){_0x3ccf17[_0x632b('0x56')]=[{'all':!![]}];}_0x3ccf17=_[_0x632b('0x4e')]({},_0x3ccf17,_0x33da2b[_0x632b('0x57')]);return db[_0x632b('0x3e')][_0x632b('0x58')](_0x3ccf17)['then'](handleEntityNotFound(_0x369cdc,null))[_0x632b('0x20')](respondWithResult(_0x369cdc,null))[_0x632b('0x53')](handleError(_0x369cdc,null));};exports[_0x632b('0x59')]=function(_0x360516,_0x1f5fdf){return db[_0x632b('0x3e')][_0x632b('0x59')](_0x360516[_0x632b('0x5a')],{})[_0x632b('0x20')](respondWithResult(_0x1f5fdf,0xc9))[_0x632b('0x53')](handleError(_0x1f5fdf,null));};exports[_0x632b('0x38')]=function(_0x5ca000,_0x10f174){if(_0x5ca000[_0x632b('0x5a')]['id']){delete _0x5ca000[_0x632b('0x5a')]['id'];}return db[_0x632b('0x3e')][_0x632b('0x58')]({'where':{'id':_0x5ca000['params']['id']}})[_0x632b('0x20')](handleEntityNotFound(_0x10f174,null))[_0x632b('0x20')](saveUpdates(_0x5ca000[_0x632b('0x5a')],null))[_0x632b('0x20')](respondWithResult(_0x10f174,null))[_0x632b('0x53')](handleError(_0x10f174,null));};exports[_0x632b('0x39')]=function(_0x3e14d0,_0x4ffa35){return db[_0x632b('0x3e')]['find']({'where':{'id':_0x3e14d0[_0x632b('0x54')]['id']}})['then'](handleEntityNotFound(_0x4ffa35,null))[_0x632b('0x20')](removeEntity(_0x4ffa35,null))['catch'](handleError(_0x4ffa35,null));};exports[_0x632b('0x5b')]=function(_0x18ee82,_0x579fe1){return db['SmsMessage'][_0x632b('0x5b')]()[_0x632b('0x20')](respondWithResult(_0x579fe1,null))[_0x632b('0x53')](handleError(_0x579fe1,null));};var interaction_log=require(_0x632b('0x12'))('sms-interactions');exports[_0x632b('0x5c')]=function(_0x20672b,_0x5abf95,_0x39a87c){var _0x5b2b8f={'agent':{},'channel':_0x632b('0x5d')};if(_0x20672b[_0x632b('0x5a')]['id']){delete _0x20672b['body']['id'];}_0x20672b[_0x632b('0x5a')][_0x632b('0x5e')]=!![];_0x20672b[_0x632b('0x5a')][_0x632b('0x5f')]=moment()['format'](_0x632b('0x60'));_0x20672b[_0x632b('0x5a')][_0x632b('0x61')]=_0x20672b[_0x632b('0x5a')]['UserId']||_0x20672b[_0x632b('0x62')]['id'];_0x5b2b8f[_0x632b('0x63')]['id']=_0x20672b[_0x632b('0x5a')][_0x632b('0x61')];return db[_0x632b('0x3e')][_0x632b('0x58')]({'where':{'id':_0x20672b['params']['id'],'UserId':null}})[_0x632b('0x20')](handleEntityNotFound(_0x5abf95,null))[_0x632b('0x20')](saveUpdates(_0x20672b[_0x632b('0x5a')],null))['then'](function(_0x518fa7){if(_0x518fa7){_0x5b2b8f[_0x632b('0x28')]=_0x518fa7[_0x632b('0x64')]({'plain':!![]});return db[_0x632b('0x65')][_0x632b('0x58')]({'where':{'id':_0x518fa7[_0x632b('0x66')]}});}return null;})[_0x632b('0x20')](handleEntityNotFound(_0x5abf95,null))[_0x632b('0x20')](function(_0x52c080){if(_0x52c080){return _0x52c080[_0x632b('0x38')]({'UserId':_0x20672b[_0x632b('0x5a')][_0x632b('0x61')],'read1stAt':_[_0x632b('0x67')](_0x52c080[_0x632b('0x68')])?moment()[_0x632b('0x69')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x632b('0x20')](function(_0x39d33d){if(_0x39d33d){_0x5b2b8f[_0x632b('0x6a')]=_0x39d33d[_0x632b('0x64')]({'plain':!![]});interaction_log['info'](_0x632b('0x6b'),_0x20672b[_0x632b('0x62')]['id'],_0x20672b[_0x632b('0x62')]['name'],_0x20672b[_0x632b('0x62')][_0x632b('0x6c')],_0x5b2b8f[_0x632b('0x6a')]['id'],_0x20672b[_0x632b('0x5a')]?JSON[_0x632b('0x25')](_0x20672b[_0x632b('0x5a')]):'null');return respondWithRpcPromise(_0x632b('0x6d'),_0x632b('0x6e'),_0x5b2b8f);}return null;})['then'](function(_0x4ad866){var _0x539502=_0x632b('0x6f')+_0x4ad866[_0x632b('0x28')][_0x632b('0x70')];return db[_0x632b('0x71')][_0x632b('0x44')](_0x539502,{'type':db['Sequelize']['QueryTypes'][_0x632b('0x72')],'raw':!![]})[_0x632b('0x20')](function(_0x5c591c){return _0x5c591c;});})['then'](function(_0x11cc11){if(_0x11cc11){_0x5b2b8f[_0x632b('0x28')]['contact']=_0x11cc11[0x0];if(!_0x20672b[_0x632b('0x5a')][_0x632b('0x61')])return;return db[_0x632b('0x73')]['find']({'where':{'id':_0x20672b['body']['UserId'],'role':_0x632b('0x63')},'attributes':['id',_0x632b('0x3b'),_0x632b('0x74'),'email','internal'],'raw':!![]});}return null;})['then'](function(_0x38190c){if(!_0x38190c)return null;_0x5b2b8f['message'][_0x632b('0x63')]=_0x38190c;return _0x5b2b8f;})[_0x632b('0x20')](function(_0x582fdc){if(_0x582fdc){if(_0x20672b[_0x632b('0x5a')][_0x632b('0x75')]){_0x5b2b8f[_0x632b('0x28')][_0x632b('0x76')]=util[_0x632b('0x69')](_0x632b('0x77'),_0x20672b[_0x632b('0x62')]['name']);_0x5b2b8f['message'][_0x632b('0x78')]=_0x5b2b8f['channel'];_0x5b2b8f[_0x632b('0x28')][_0x632b('0x79')]=_0x5b2b8f[_0x632b('0x78')];_0x5b2b8f[_0x632b('0x28')]['event']=_0x632b('0x5c');return respondWithRpcPromise('EventManager','EventManager',{'event':'acceptmessage','message':_0x5b2b8f[_0x632b('0x28')]},client9002)['then'](function(){return _0x5b2b8f;});}return _0x5b2b8f;}return null;})[_0x632b('0x20')](respondWithResult(_0x5abf95,null))[_0x632b('0x53')](handleError(_0x5abf95,null));};var interaction_log=require(_0x632b('0x12'))(_0x632b('0x7a'));exports[_0x632b('0x36')]=function(_0x53d9f5,_0x47e2a6,_0x1c44dc){var _0x210b8b={'agent':{},'channel':_0x632b('0x5d')};if(_0x53d9f5[_0x632b('0x5a')]['id']){delete _0x53d9f5[_0x632b('0x5a')]['id'];}_0x53d9f5[_0x632b('0x5a')][_0x632b('0x61')]=_0x53d9f5['body'][_0x632b('0x61')]||_0x53d9f5[_0x632b('0x62')]['id'];_0x210b8b['agent']['id']=_0x53d9f5['body'][_0x632b('0x61')];return db['SmsMessage']['find']({'where':{'id':_0x53d9f5[_0x632b('0x54')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x47e2a6,null))[_0x632b('0x20')](function(_0x521d15){if(_0x521d15){_0x210b8b[_0x632b('0x28')]=_0x521d15['get']({'plain':!![]});return db[_0x632b('0x65')][_0x632b('0x58')]({'where':{'id':_0x521d15['SmsInteractionId']}});}return null;})[_0x632b('0x20')](handleEntityNotFound(_0x47e2a6,null))[_0x632b('0x20')](function(_0x1e07da){if(_0x1e07da){_0x210b8b[_0x632b('0x6a')]=_0x1e07da[_0x632b('0x64')]({'plain':!![]});interaction_log[_0x632b('0x29')](_0x632b('0x7b'),_0x53d9f5[_0x632b('0x62')]['id'],_0x53d9f5['user']['name'],_0x53d9f5[_0x632b('0x62')][_0x632b('0x6c')],_0x210b8b[_0x632b('0x6a')]['id'],_0x53d9f5[_0x632b('0x5a')]?JSON[_0x632b('0x25')](_0x53d9f5[_0x632b('0x5a')]):'null');return respondWithRpcPromise(_0x632b('0x7c'),'rejectMessage',_0x210b8b);}return null;})[_0x632b('0x20')](function(_0x54d69c){var _0x362e71=_0x632b('0x6f')+_0x54d69c[_0x632b('0x28')][_0x632b('0x70')];return db['sequelize'][_0x632b('0x44')](_0x362e71,{'type':db[_0x632b('0x7d')]['QueryTypes'][_0x632b('0x72')],'raw':!![]})[_0x632b('0x20')](function(_0x2bbfef){return _0x2bbfef;});})[_0x632b('0x20')](function(_0x132eac){if(_0x132eac){_0x210b8b['message'][_0x632b('0x7e')]=_0x132eac[0x0];if(!_0x53d9f5[_0x632b('0x5a')]['UserId'])return;return db[_0x632b('0x73')]['find']({'where':{'id':_0x53d9f5[_0x632b('0x5a')]['UserId'],'role':_0x632b('0x63')},'attributes':['id','name',_0x632b('0x74'),_0x632b('0x7f'),_0x632b('0x80')],'raw':!![]});}return null;})[_0x632b('0x20')](function(_0x405b3c){if(!_0x405b3c)return null;_0x210b8b['message'][_0x632b('0x63')]=_0x405b3c;return _0x210b8b;})[_0x632b('0x20')](function(_0x58a5fd){if(_0x58a5fd){_0x58a5fd[_0x632b('0x28')]['interface']=util[_0x632b('0x69')]('SIP/%s',_0x53d9f5[_0x632b('0x62')]['name']);_0x58a5fd[_0x632b('0x28')][_0x632b('0x78')]=_0x210b8b[_0x632b('0x78')];_0x58a5fd['message'][_0x632b('0x79')]=_0x210b8b[_0x632b('0x78')];_0x58a5fd[_0x632b('0x28')][_0x632b('0x81')]=_0x632b('0x36');respondWithRpcPromise(_0x632b('0x82'),_0x632b('0x82'),{'event':_0x632b('0x83'),'message':_0x58a5fd[_0x632b('0x28')]},client9002);return _0x210b8b;}return null;})[_0x632b('0x20')](respondWithResult(_0x47e2a6,null))[_0x632b('0x53')](handleError(_0x47e2a6,null));};exports[_0x632b('0x2c')]=function(_0x1fcb2a,_0x55c36d,_0x23385d){if(_0x1fcb2a[_0x632b('0x5a')]['id']){delete _0x1fcb2a[_0x632b('0x5a')]['id'];}var _0x3293be;return db[_0x632b('0x3e')][_0x632b('0x58')]({'where':{'id':_0x1fcb2a[_0x632b('0x54')]['id']}})[_0x632b('0x20')](handleEntityNotFound(_0x55c36d,null))[_0x632b('0x20')](function(_0x40fb13){if(_0x40fb13){_0x3293be=_0x40fb13;return db[_0x632b('0x84')][_0x632b('0x58')]({'where':{'id':_0x40fb13['SmsAccountId']}});}})[_0x632b('0x20')](handleEntityNotFound(_0x55c36d,null))[_0x632b('0x20')](function(_0x13723c){if(_0x13723c){logger[_0x632b('0x23')](_0x632b('0x24'),_0x632b('0x2c'),_0x632b('0x85'),_0x13723c[_0x632b('0x41')],util['inspect'](_0x1fcb2a[_0x632b('0x5a')],{'showHidden':![],'depth':null}));switch(_0x13723c[_0x632b('0x41')]){case _0x632b('0x86'):if(_0x1fcb2a[_0x632b('0x5a')][_0x632b('0x87')]&&_0x1fcb2a[_0x632b('0x5a')][_0x632b('0x87')]===_0x3293be[_0x632b('0x88')]){return _0x3293be[_0x632b('0x38')]({'read':!![]});}else{logger['error'](_0x632b('0x89'),_0x632b('0x2c'),_0x632b('0x86'),util[_0x632b('0x8a')](_0x1fcb2a[_0x632b('0x5a')],{'showHidden':![],'depth':null}));}break;case _0x632b('0x8b'):if(_0x1fcb2a['body'][_0x632b('0x8c')]&&_0x1fcb2a[_0x632b('0x5a')][_0x632b('0x8c')]===_0x3293be['messageId']&&_['indexOf']([_0x632b('0x8d'),_0x632b('0x8e')],_0x1fcb2a[_0x632b('0x5a')][_0x632b('0x8f')])>=0x0){return _0x3293be[_0x632b('0x38')]({'read':!![]});}else{logger[_0x632b('0x26')](_0x632b('0x89'),'status',_0x632b('0x90'),util['inspect'](_0x1fcb2a[_0x632b('0x5a')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x4d3bb7=_0x1fcb2a[_0x632b('0x5a')][_0x632b('0x91')][0x0];if(_0x4d3bb7[_0x632b('0x2c')]['groupName']==='DELIVERED'){return _0x3293be[_0x632b('0x38')]({'read':!![]});}else{logger[_0x632b('0x26')](_0x632b('0x89'),'status','infobip',util[_0x632b('0x8a')](_0x1fcb2a[_0x632b('0x5a')],{'showHidden':![],'depth':null}));}break;}return _0x3293be;}})[_0x632b('0x20')](respondWithResult(_0x55c36d,null))[_0x632b('0x53')](handleError(_0x55c36d,null));}; \ No newline at end of file +var _0xb955=['mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','./smsMessage.socket','register','client','http','info','SmsMessage,\x20%s,\x20%s','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','save','update','then','destroy','name','send','index','map','SmsMessage','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','find','catch','create','body','describe','../../config/logger','sms-interactions','accept','sms','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','SmsInteraction','SmsInteractionId','isNil','read1stAt','interaction','role','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','agent','fullname','internal','manual','interface','SIP/%s','channel','motionChannel','EventManager','acceptmessage','reject','RejectMessage','rejectMessage','User','email','event','rejectmessage','SmsAccount','debug','received\x20delivery\x20report\x20from','twilio','MessageSid','messageId','inspect','plivo','MessageUUID','indexOf','delivered','Status','SmsAccount,\x20%s,\x20%s,\x20%s','plivio','infobip','groupName','eml-format','rimraf','zip-dir','moment','bluebird'];(function(_0x213ef2,_0x4d3278){var _0x3650a4=function(_0x5908b0){while(--_0x5908b0){_0x213ef2['push'](_0x213ef2['shift']());}};_0x3650a4(++_0x4d3278);}(_0xb955,0x123));var _0x5b95=function(_0x139c09,_0x30463f){_0x139c09=_0x139c09-0x0;var _0x394f8e=_0xb955[_0x139c09];return _0x394f8e;};'use strict';var emlformat=require(_0x5b95('0x0'));var rimraf=require(_0x5b95('0x1'));var zipdir=require(_0x5b95('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5b95('0x3'));var BPromise=require(_0x5b95('0x4'));var Mustache=require(_0x5b95('0x5'));var util=require(_0x5b95('0x6'));var path=require(_0x5b95('0x7'));var sox=require(_0x5b95('0x8'));var csv=require(_0x5b95('0x9'));var ejs=require(_0x5b95('0xa'));var fs=require('fs');var fs_extra=require(_0x5b95('0xb'));var _=require(_0x5b95('0xc'));var squel=require('squel');var crypto=require(_0x5b95('0xd'));var jsforce=require(_0x5b95('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5b95('0xf'));var Papa=require(_0x5b95('0x10'));var Redis=require(_0x5b95('0x11'));var authService=require(_0x5b95('0x12'));var qs=require(_0x5b95('0x13'));var as=require(_0x5b95('0x14'));var hardwareService=require(_0x5b95('0x15'));var logger=require('../../config/logger')(_0x5b95('0x16'));var utils=require('../../config/utils');var config=require(_0x5b95('0x17'));var licenseUtil=require(_0x5b95('0x18'));var db=require(_0x5b95('0x19'))['db'];config['redis']=_[_0x5b95('0x1a')](config[_0x5b95('0x1b')],{'host':_0x5b95('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5b95('0x1b')]));require(_0x5b95('0x1d'))[_0x5b95('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson[_0x5b95('0x1f')][_0x5b95('0x20')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2bbc72,_0x4f614b,_0x363a31,_0x1d38e8){return new BPromise(function(_0x79abc5,_0x34abe4){var _0x461859=_0x1d38e8||client;return _0x461859['request'](_0x2bbc72,_0x363a31)['then'](function(_0x1be1fe){logger[_0x5b95('0x21')](_0x5b95('0x22'),_0x4f614b,_0x5b95('0x23'));logger['debug'](_0x5b95('0x24'),_0x4f614b,'request\x20sent',JSON[_0x5b95('0x25')](_0x1be1fe));if(_0x1be1fe[_0x5b95('0x26')]){if(_0x1be1fe['error'][_0x5b95('0x27')]===0x1f4){logger[_0x5b95('0x26')](_0x5b95('0x22'),_0x4f614b,_0x1be1fe[_0x5b95('0x26')]['message']);return _0x34abe4(_0x1be1fe[_0x5b95('0x26')][_0x5b95('0x28')]);}logger['error']('SmsMessage,\x20%s,\x20%s',_0x4f614b,_0x1be1fe[_0x5b95('0x26')][_0x5b95('0x28')]);return _0x79abc5(_0x1be1fe[_0x5b95('0x26')][_0x5b95('0x28')]);}else{logger[_0x5b95('0x21')](_0x5b95('0x22'),_0x4f614b,_0x5b95('0x23'));_0x79abc5(_0x1be1fe[_0x5b95('0x29')][_0x5b95('0x28')]);}})['catch'](function(_0x533aa4){logger[_0x5b95('0x26')](_0x5b95('0x22'),_0x4f614b,_0x533aa4);_0x34abe4(_0x533aa4);});});}function respondWithStatusCode(_0x202331,_0x1ee5ed){_0x1ee5ed=_0x1ee5ed||0xcc;return function(_0x1ba1eb){if(_0x1ba1eb){return _0x202331[_0x5b95('0x2a')](_0x1ee5ed);}return _0x202331[_0x5b95('0x2b')](_0x1ee5ed)[_0x5b95('0x2c')]();};}function respondWithResult(_0x58433c,_0x3b2aaa){_0x3b2aaa=_0x3b2aaa||0xc8;return function(_0x47a584){if(_0x47a584){return _0x58433c[_0x5b95('0x2b')](_0x3b2aaa)[_0x5b95('0x2d')](_0x47a584);}};}function respondWithFilteredResult(_0x533d70,_0x1ec3f6){return function(_0x1aa6f0){if(_0x1aa6f0){var _0x5329bf=typeof _0x1ec3f6['offset']===_0x5b95('0x2e')&&typeof _0x1ec3f6[_0x5b95('0x2f')]===_0x5b95('0x2e');var _0x4f8001=_0x1aa6f0[_0x5b95('0x30')];var _0xc7ccf8=_0x5329bf?0x0:_0x1ec3f6[_0x5b95('0x31')];var _0x16a54a=_0x5329bf?_0x1aa6f0[_0x5b95('0x30')]:_0x1ec3f6[_0x5b95('0x31')]+_0x1ec3f6['limit'];var _0x453644;if(_0x16a54a>=_0x4f8001){_0x16a54a=_0x4f8001;_0x453644=0xc8;}else{_0x453644=0xce;}_0x533d70[_0x5b95('0x2b')](_0x453644);return _0x533d70[_0x5b95('0x32')](_0x5b95('0x33'),_0xc7ccf8+'-'+_0x16a54a+'/'+_0x4f8001)[_0x5b95('0x2d')](_0x1aa6f0);}return null;};}function patchUpdates(_0x248cef){return function(_0x4531c3){try{jsonpatch['apply'](_0x4531c3,_0x248cef,!![]);}catch(_0x3615be){return BPromise['reject'](_0x3615be);}return _0x4531c3[_0x5b95('0x34')]();};}function saveUpdates(_0x4dfe6e,_0x1ed611){return function(_0x1a491d){if(_0x1a491d){return _0x1a491d[_0x5b95('0x35')](_0x4dfe6e)[_0x5b95('0x36')](function(_0x2f673d){return _0x2f673d;});}return null;};}function removeEntity(_0x11ca8e,_0x46d5d5){return function(_0x103f77){if(_0x103f77){return _0x103f77[_0x5b95('0x37')]()[_0x5b95('0x36')](function(){_0x11ca8e[_0x5b95('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x309869,_0x2b491c){return function(_0x4cf916){if(!_0x4cf916){_0x309869[_0x5b95('0x2a')](0x194);}return _0x4cf916;};}function handleError(_0x1f5c10,_0x281950){_0x281950=_0x281950||0x1f4;return function(_0x3b9113){logger['error'](_0x3b9113['stack']);if(_0x3b9113['name']){delete _0x3b9113[_0x5b95('0x38')];}_0x1f5c10['status'](_0x281950)[_0x5b95('0x39')](_0x3b9113);};}exports[_0x5b95('0x3a')]=function(_0x243317,_0x2d6732){var _0x20de24={},_0x4a6d15={},_0x4ef7b7={'count':0x0,'rows':[]};var _0x34d626=_[_0x5b95('0x3b')](db[_0x5b95('0x3c')][_0x5b95('0x3d')],function(_0x300f89){return{'name':_0x300f89[_0x5b95('0x3e')],'type':_0x300f89[_0x5b95('0x3f')][_0x5b95('0x40')]};});_0x4a6d15[_0x5b95('0x41')]=_[_0x5b95('0x3b')](_0x34d626,_0x5b95('0x38'));_0x4a6d15[_0x5b95('0x42')]=_['keys'](_0x243317[_0x5b95('0x42')]);_0x4a6d15[_0x5b95('0x43')]=_[_0x5b95('0x44')](_0x4a6d15[_0x5b95('0x41')],_0x4a6d15[_0x5b95('0x42')]);_0x20de24[_0x5b95('0x45')]=_[_0x5b95('0x44')](_0x4a6d15['model'],qs[_0x5b95('0x46')](_0x243317['query'][_0x5b95('0x46')]));_0x20de24[_0x5b95('0x45')]=_0x20de24[_0x5b95('0x45')][_0x5b95('0x47')]?_0x20de24[_0x5b95('0x45')]:_0x4a6d15[_0x5b95('0x41')];if(!_0x243317['query']['hasOwnProperty'](_0x5b95('0x48'))){_0x20de24[_0x5b95('0x2f')]=qs[_0x5b95('0x2f')](_0x243317[_0x5b95('0x42')][_0x5b95('0x2f')]);_0x20de24[_0x5b95('0x31')]=qs['offset'](_0x243317[_0x5b95('0x42')][_0x5b95('0x31')]);}_0x20de24['order']=qs[_0x5b95('0x49')](_0x243317[_0x5b95('0x42')][_0x5b95('0x49')]);_0x20de24[_0x5b95('0x4a')]=qs[_0x5b95('0x43')](_[_0x5b95('0x4b')](_0x243317['query'],_0x4a6d15[_0x5b95('0x43')]),_0x34d626);if(_0x243317[_0x5b95('0x42')][_0x5b95('0x4c')]){_0x20de24[_0x5b95('0x4a')]=_[_0x5b95('0x4d')](_0x20de24[_0x5b95('0x4a')],{'$or':_[_0x5b95('0x3b')](_0x34d626,function(_0x3ffa8c){if(_0x3ffa8c[_0x5b95('0x3f')]!==_0x5b95('0x4e')){var _0x3ff591={};_0x3ff591[_0x3ffa8c[_0x5b95('0x38')]]={'$like':'%'+_0x243317['query']['filter']+'%'};return _0x3ff591;}})});}_0x20de24=_[_0x5b95('0x4d')]({},_0x20de24,_0x243317[_0x5b95('0x4f')]);var _0xb170dd={'where':_0x20de24[_0x5b95('0x4a')]};return db[_0x5b95('0x3c')][_0x5b95('0x30')](_0xb170dd)[_0x5b95('0x36')](function(_0x47f26a){_0x4ef7b7['count']=_0x47f26a;if(_0x243317[_0x5b95('0x42')][_0x5b95('0x50')]){_0x20de24[_0x5b95('0x51')]=[{'all':!![]}];}return db[_0x5b95('0x3c')][_0x5b95('0x52')](_0x20de24);})[_0x5b95('0x36')](function(_0x4cfb36){_0x4ef7b7[_0x5b95('0x53')]=_0x4cfb36;return _0x4ef7b7;})[_0x5b95('0x36')](respondWithFilteredResult(_0x2d6732,_0x20de24))['catch'](handleError(_0x2d6732,null));};exports[_0x5b95('0x54')]=function(_0xb9a363,_0x392859){var _0x245103={'raw':!![],'where':{'id':_0xb9a363[_0x5b95('0x55')]['id']}},_0x3fc042={};_0x3fc042[_0x5b95('0x41')]=_['keys'](db[_0x5b95('0x3c')][_0x5b95('0x3d')]);_0x3fc042['query']=_[_0x5b95('0x56')](_0xb9a363[_0x5b95('0x42')]);_0x3fc042[_0x5b95('0x43')]=_['intersection'](_0x3fc042[_0x5b95('0x41')],_0x3fc042[_0x5b95('0x42')]);_0x245103['attributes']=_[_0x5b95('0x44')](_0x3fc042[_0x5b95('0x41')],qs['fields'](_0xb9a363[_0x5b95('0x42')][_0x5b95('0x46')]));_0x245103[_0x5b95('0x45')]=_0x245103['attributes'][_0x5b95('0x47')]?_0x245103[_0x5b95('0x45')]:_0x3fc042[_0x5b95('0x41')];if(_0xb9a363[_0x5b95('0x42')][_0x5b95('0x50')]){_0x245103[_0x5b95('0x51')]=[{'all':!![]}];}_0x245103=_[_0x5b95('0x4d')]({},_0x245103,_0xb9a363[_0x5b95('0x4f')]);return db[_0x5b95('0x3c')][_0x5b95('0x57')](_0x245103)['then'](handleEntityNotFound(_0x392859,null))[_0x5b95('0x36')](respondWithResult(_0x392859,null))[_0x5b95('0x58')](handleError(_0x392859,null));};exports[_0x5b95('0x59')]=function(_0x53e25e,_0x36d20c){return db[_0x5b95('0x3c')]['create'](_0x53e25e[_0x5b95('0x5a')],{})[_0x5b95('0x36')](respondWithResult(_0x36d20c,0xc9))['catch'](handleError(_0x36d20c,null));};exports[_0x5b95('0x35')]=function(_0x9208a8,_0x5acd11){if(_0x9208a8[_0x5b95('0x5a')]['id']){delete _0x9208a8[_0x5b95('0x5a')]['id'];}return db[_0x5b95('0x3c')][_0x5b95('0x57')]({'where':{'id':_0x9208a8[_0x5b95('0x55')]['id']}})[_0x5b95('0x36')](handleEntityNotFound(_0x5acd11,null))[_0x5b95('0x36')](saveUpdates(_0x9208a8['body'],null))['then'](respondWithResult(_0x5acd11,null))[_0x5b95('0x58')](handleError(_0x5acd11,null));};exports[_0x5b95('0x37')]=function(_0x2cd350,_0x30b601){return db[_0x5b95('0x3c')]['find']({'where':{'id':_0x2cd350[_0x5b95('0x55')]['id']}})['then'](handleEntityNotFound(_0x30b601,null))['then'](removeEntity(_0x30b601,null))[_0x5b95('0x58')](handleError(_0x30b601,null));};exports[_0x5b95('0x5b')]=function(_0x915fe8,_0x43099f){return db[_0x5b95('0x3c')][_0x5b95('0x5b')]()[_0x5b95('0x36')](respondWithResult(_0x43099f,null))[_0x5b95('0x58')](handleError(_0x43099f,null));};var interaction_log=require(_0x5b95('0x5c'))(_0x5b95('0x5d'));exports[_0x5b95('0x5e')]=function(_0x11109f,_0x9adb83,_0x29fc91){var _0x3c4b04={'agent':{},'channel':_0x5b95('0x5f')};if(_0x11109f[_0x5b95('0x5a')]['id']){delete _0x11109f[_0x5b95('0x5a')]['id'];}_0x11109f[_0x5b95('0x5a')][_0x5b95('0x60')]=!![];_0x11109f[_0x5b95('0x5a')]['readAt']=moment()[_0x5b95('0x61')](_0x5b95('0x62'));_0x11109f['body'][_0x5b95('0x63')]=_0x11109f['body']['UserId']||_0x11109f[_0x5b95('0x64')]['id'];_0x3c4b04['agent']['id']=_0x11109f['body'][_0x5b95('0x63')];return db['SmsMessage'][_0x5b95('0x57')]({'where':{'id':_0x11109f[_0x5b95('0x55')]['id'],'UserId':null}})[_0x5b95('0x36')](handleEntityNotFound(_0x9adb83,null))[_0x5b95('0x36')](saveUpdates(_0x11109f[_0x5b95('0x5a')],null))[_0x5b95('0x36')](function(_0xc2c461){if(_0xc2c461){_0x3c4b04['message']=_0xc2c461[_0x5b95('0x65')]({'plain':!![]});return db[_0x5b95('0x66')][_0x5b95('0x57')]({'where':{'id':_0xc2c461[_0x5b95('0x67')]}});}return null;})[_0x5b95('0x36')](handleEntityNotFound(_0x9adb83,null))['then'](function(_0xeb5ac){if(_0xeb5ac){return _0xeb5ac[_0x5b95('0x35')]({'UserId':_0x11109f['body']['UserId'],'read1stAt':_[_0x5b95('0x68')](_0xeb5ac[_0x5b95('0x69')])?moment()[_0x5b95('0x61')](_0x5b95('0x62')):undefined});}return null;})[_0x5b95('0x36')](function(_0x975664){if(_0x975664){_0x3c4b04[_0x5b95('0x6a')]=_0x975664[_0x5b95('0x65')]({'plain':!![]});interaction_log['info']('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x11109f['user']['id'],_0x11109f[_0x5b95('0x64')]['name'],_0x11109f[_0x5b95('0x64')][_0x5b95('0x6b')],_0x3c4b04['interaction']['id'],_0x11109f['body']?JSON[_0x5b95('0x25')](_0x11109f['body']):_0x5b95('0x6c'));return respondWithRpcPromise(_0x5b95('0x6d'),'acceptMessage',_0x3c4b04);}return null;})['then'](function(_0x344937){var _0x326e72=_0x5b95('0x6e')+_0x344937[_0x5b95('0x28')][_0x5b95('0x6f')];return db[_0x5b95('0x70')][_0x5b95('0x42')](_0x326e72,{'type':db[_0x5b95('0x71')]['QueryTypes'][_0x5b95('0x72')],'raw':!![]})[_0x5b95('0x36')](function(_0x187d99){return _0x187d99;});})[_0x5b95('0x36')](function(_0x235696){if(_0x235696){_0x3c4b04[_0x5b95('0x28')]['contact']=_0x235696[0x0];if(!_0x11109f[_0x5b95('0x5a')][_0x5b95('0x63')])return;return db['User'][_0x5b95('0x57')]({'where':{'id':_0x11109f[_0x5b95('0x5a')][_0x5b95('0x63')],'role':_0x5b95('0x73')},'attributes':['id',_0x5b95('0x38'),_0x5b95('0x74'),'email',_0x5b95('0x75')],'raw':!![]});}return null;})[_0x5b95('0x36')](function(_0x1d5ec8){if(!_0x1d5ec8)return null;_0x3c4b04[_0x5b95('0x28')]['agent']=_0x1d5ec8;return _0x3c4b04;})[_0x5b95('0x36')](function(_0x4a3818){if(_0x4a3818){if(_0x11109f['body'][_0x5b95('0x76')]){_0x3c4b04[_0x5b95('0x28')][_0x5b95('0x77')]=util[_0x5b95('0x61')](_0x5b95('0x78'),_0x11109f[_0x5b95('0x64')]['name']);_0x3c4b04['message'][_0x5b95('0x79')]=_0x3c4b04[_0x5b95('0x79')];_0x3c4b04['message'][_0x5b95('0x7a')]=_0x3c4b04[_0x5b95('0x79')];_0x3c4b04['message']['event']='accept';return respondWithRpcPromise(_0x5b95('0x7b'),_0x5b95('0x7b'),{'event':_0x5b95('0x7c'),'message':_0x3c4b04[_0x5b95('0x28')]},client9002)['then'](function(){return _0x3c4b04;});}return _0x3c4b04;}return null;})[_0x5b95('0x36')](respondWithResult(_0x9adb83,null))['catch'](handleError(_0x9adb83,null));};var interaction_log=require(_0x5b95('0x5c'))(_0x5b95('0x5d'));exports[_0x5b95('0x7d')]=function(_0x8c0c91,_0x83132,_0x4c3375){var _0x1f5de4={'agent':{},'channel':_0x5b95('0x5f')};if(_0x8c0c91[_0x5b95('0x5a')]['id']){delete _0x8c0c91['body']['id'];}_0x8c0c91[_0x5b95('0x5a')]['UserId']=_0x8c0c91[_0x5b95('0x5a')]['UserId']||_0x8c0c91[_0x5b95('0x64')]['id'];_0x1f5de4['agent']['id']=_0x8c0c91['body'][_0x5b95('0x63')];return db[_0x5b95('0x3c')][_0x5b95('0x57')]({'where':{'id':_0x8c0c91['params']['id'],'UserId':null}})[_0x5b95('0x36')](handleEntityNotFound(_0x83132,null))[_0x5b95('0x36')](function(_0x3d3b67){if(_0x3d3b67){_0x1f5de4[_0x5b95('0x28')]=_0x3d3b67[_0x5b95('0x65')]({'plain':!![]});return db['SmsInteraction'][_0x5b95('0x57')]({'where':{'id':_0x3d3b67[_0x5b95('0x67')]}});}return null;})[_0x5b95('0x36')](handleEntityNotFound(_0x83132,null))[_0x5b95('0x36')](function(_0x861e6b){if(_0x861e6b){_0x1f5de4[_0x5b95('0x6a')]=_0x861e6b['get']({'plain':!![]});interaction_log[_0x5b95('0x21')]('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x8c0c91['user']['id'],_0x8c0c91[_0x5b95('0x64')][_0x5b95('0x38')],_0x8c0c91[_0x5b95('0x64')]['role'],_0x1f5de4[_0x5b95('0x6a')]['id'],_0x8c0c91[_0x5b95('0x5a')]?JSON[_0x5b95('0x25')](_0x8c0c91[_0x5b95('0x5a')]):'null');return respondWithRpcPromise(_0x5b95('0x7e'),_0x5b95('0x7f'),_0x1f5de4);}return null;})[_0x5b95('0x36')](function(_0x3012f7){var _0x1a2000=_0x5b95('0x6e')+_0x3012f7[_0x5b95('0x28')][_0x5b95('0x6f')];return db[_0x5b95('0x70')][_0x5b95('0x42')](_0x1a2000,{'type':db[_0x5b95('0x71')]['QueryTypes'][_0x5b95('0x72')],'raw':!![]})['then'](function(_0x2d2fed){return _0x2d2fed;});})[_0x5b95('0x36')](function(_0x5ba919){if(_0x5ba919){_0x1f5de4['message']['contact']=_0x5ba919[0x0];if(!_0x8c0c91[_0x5b95('0x5a')]['UserId'])return;return db[_0x5b95('0x80')][_0x5b95('0x57')]({'where':{'id':_0x8c0c91[_0x5b95('0x5a')]['UserId'],'role':_0x5b95('0x73')},'attributes':['id',_0x5b95('0x38'),_0x5b95('0x74'),_0x5b95('0x81'),_0x5b95('0x75')],'raw':!![]});}return null;})[_0x5b95('0x36')](function(_0x446a41){if(!_0x446a41)return null;_0x1f5de4[_0x5b95('0x28')]['agent']=_0x446a41;return _0x1f5de4;})['then'](function(_0x4ac76f){if(_0x4ac76f){_0x4ac76f[_0x5b95('0x28')][_0x5b95('0x77')]=util['format'](_0x5b95('0x78'),_0x8c0c91[_0x5b95('0x64')][_0x5b95('0x38')]);_0x4ac76f[_0x5b95('0x28')][_0x5b95('0x79')]=_0x1f5de4[_0x5b95('0x79')];_0x4ac76f[_0x5b95('0x28')][_0x5b95('0x7a')]=_0x1f5de4[_0x5b95('0x79')];_0x4ac76f[_0x5b95('0x28')][_0x5b95('0x82')]=_0x5b95('0x7d');respondWithRpcPromise(_0x5b95('0x7b'),_0x5b95('0x7b'),{'event':_0x5b95('0x83'),'message':_0x4ac76f[_0x5b95('0x28')]},client9002);return _0x1f5de4;}return null;})[_0x5b95('0x36')](respondWithResult(_0x83132,null))[_0x5b95('0x58')](handleError(_0x83132,null));};exports['status']=function(_0x2b2771,_0x3480fe,_0x446d75){if(_0x2b2771[_0x5b95('0x5a')]['id']){delete _0x2b2771['body']['id'];}var _0x10bb16;return db[_0x5b95('0x3c')][_0x5b95('0x57')]({'where':{'id':_0x2b2771[_0x5b95('0x55')]['id']}})[_0x5b95('0x36')](handleEntityNotFound(_0x3480fe,null))[_0x5b95('0x36')](function(_0x1b5750){if(_0x1b5750){_0x10bb16=_0x1b5750;return db[_0x5b95('0x84')]['find']({'where':{'id':_0x1b5750['SmsAccountId']}});}})[_0x5b95('0x36')](handleEntityNotFound(_0x3480fe,null))[_0x5b95('0x36')](function(_0x54c63a){if(_0x54c63a){logger[_0x5b95('0x85')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5b95('0x2b'),_0x5b95('0x86'),_0x54c63a[_0x5b95('0x3f')],util['inspect'](_0x2b2771[_0x5b95('0x5a')],{'showHidden':![],'depth':null}));switch(_0x54c63a[_0x5b95('0x3f')]){case _0x5b95('0x87'):if(_0x2b2771[_0x5b95('0x5a')][_0x5b95('0x88')]&&_0x2b2771[_0x5b95('0x5a')][_0x5b95('0x88')]===_0x10bb16[_0x5b95('0x89')]){return _0x10bb16[_0x5b95('0x35')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x5b95('0x2b'),_0x5b95('0x87'),util[_0x5b95('0x8a')](_0x2b2771['body'],{'showHidden':![],'depth':null}));}break;case _0x5b95('0x8b'):if(_0x2b2771[_0x5b95('0x5a')]['MessageUUID']&&_0x2b2771[_0x5b95('0x5a')][_0x5b95('0x8c')]===_0x10bb16['messageId']&&_[_0x5b95('0x8d')](['sent',_0x5b95('0x8e')],_0x2b2771[_0x5b95('0x5a')][_0x5b95('0x8f')])>=0x0){return _0x10bb16[_0x5b95('0x35')]({'read':!![]});}else{logger[_0x5b95('0x26')](_0x5b95('0x90'),_0x5b95('0x2b'),_0x5b95('0x91'),util['inspect'](_0x2b2771['body'],{'showHidden':![],'depth':null}));}break;case _0x5b95('0x92'):var _0x42a553=_0x2b2771[_0x5b95('0x5a')]['results'][0x0];if(_0x42a553[_0x5b95('0x2b')][_0x5b95('0x93')]==='DELIVERED'){return _0x10bb16['update']({'read':!![]});}else{logger[_0x5b95('0x26')](_0x5b95('0x90'),'status','infobip',util[_0x5b95('0x8a')](_0x2b2771[_0x5b95('0x5a')],{'showHidden':![],'depth':null}));}break;}return _0x10bb16;}})[_0x5b95('0x36')](respondWithResult(_0x3480fe,null))['catch'](handleError(_0x3480fe,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 1b5a2fa..35658dc 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 _0x56d4=['update','remove','emit','hasOwnProperty','events','../../mysqldb','SmsMessage','save'];(function(_0x57f16c,_0x2b5a8e){var _0x15bec8=function(_0x5608f7){while(--_0x5608f7){_0x57f16c['push'](_0x57f16c['shift']());}};_0x15bec8(++_0x2b5a8e);}(_0x56d4,0xac));var _0x456d=function(_0x2d8225,_0x1ce3e1){_0x2d8225=_0x2d8225-0x0;var _0x38329f=_0x56d4[_0x2d8225];return _0x38329f;};'use strict';var EventEmitter=require(_0x456d('0x0'));var SmsMessage=require(_0x456d('0x1'))['db'][_0x456d('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x456d('0x3'),'afterUpdate':_0x456d('0x4'),'afterDestroy':_0x456d('0x5')};function emitEvent(_0x376f79){return function(_0x55f57d,_0x5999bd,_0x1b9fe){SmsMessageEvents[_0x456d('0x6')](_0x376f79+':'+_0x55f57d['id'],_0x55f57d);SmsMessageEvents[_0x456d('0x6')](_0x376f79,_0x55f57d);_0x1b9fe(null);};}for(var e in events){if(events[_0x456d('0x7')](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file +var _0x4342=['hook','exports','setMaxListeners','save','update','remove','emit'];(function(_0x39cbe4,_0x4a7958){var _0xe76ba7=function(_0x332a08){while(--_0x332a08){_0x39cbe4['push'](_0x39cbe4['shift']());}};_0xe76ba7(++_0x4a7958);}(_0x4342,0x167));var _0x2434=function(_0x5c3c9f,_0x2b6352){_0x5c3c9f=_0x5c3c9f-0x0;var _0x53f7e9=_0x4342[_0x5c3c9f];return _0x53f7e9;};'use strict';var EventEmitter=require('events');var SmsMessage=require('../../mysqldb')['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x2434('0x0')](0x0);var events={'afterCreate':_0x2434('0x1'),'afterUpdate':_0x2434('0x2'),'afterDestroy':_0x2434('0x3')};function emitEvent(_0x4fc329){return function(_0x5355d3,_0x357c03,_0x17edcd){SmsMessageEvents[_0x2434('0x4')](_0x4fc329+':'+_0x5355d3['id'],_0x5355d3);SmsMessageEvents[_0x2434('0x4')](_0x4fc329,_0x5355d3);_0x17edcd(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage[_0x2434('0x5')](e,emitEvent(event));}}module[_0x2434('0x6')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index 0fcf1ae..871247b 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 _0x5f3d=['messages','message_id','clickSend','plivo','authId','https://api.plivo.com/v1/Account/%s/Message/','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','login','text','timestamp','sort','length','createHash','md5','digest','hex','/external/get/send.php?','keys','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','apiMessageId','bandwidth','accountId','/messages','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','status','refid','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','request-promise','rimraf','./smsMessage.attributes','exports','define','SmsMessage','sms_messages','messageId','body','FULLTEXT','get','direction','toLowerCase','out','secret','isNil','SmsInteractionId','findOne','then','update','createdAt','catch','find','SmsAccountId','type','twilio','accountSid','authToken','phone','create','remote','/api/sms/messages/','/status?token=','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','&password=','GET','split','POST','user_key','session_key','total_sent','internal_order_id','deliveryReport','read','error','skebby','Missing\x20parameters:\x20username,\x20password','connectel','Missing\x20parameters:\x20authToken','senderString','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','data','queued_count','head'];(function(_0x873a46,_0x3ecd08){var _0x44fd26=function(_0x52f8dd){while(--_0x52f8dd){_0x873a46['push'](_0x873a46['shift']());}};_0x44fd26(++_0x3ecd08);}(_0x5f3d,0x192));var _0xd5f3=function(_0x3c3edc,_0x2f7ba0){_0x3c3edc=_0x3c3edc-0x0;var _0x581465=_0x5f3d[_0x3c3edc];return _0x581465;};'use strict';var _=require(_0xd5f3('0x0'));var util=require(_0xd5f3('0x1'));var logger=require('../../config/logger')(_0xd5f3('0x2'));var moment=require(_0xd5f3('0x3'));var BPromise=require('bluebird');var rp=require(_0xd5f3('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd5f3('0x5'));var config=require('../../config/environment');var attributes=require(_0xd5f3('0x6'));module[_0xd5f3('0x7')]=function(_0x7838d6,_0x42476b){return _0x7838d6[_0xd5f3('0x8')](_0xd5f3('0x9'),attributes,{'tableName':_0xd5f3('0xa'),'paranoid':![],'indexes':[{'name':_0xd5f3('0xb'),'fields':[_0xd5f3('0xb')]},{'name':'fti_sms_messages','fields':[_0xd5f3('0xc')],'type':_0xd5f3('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x33db26,_0x343895,_0xbd493d){var _0x12ddea=_0x7838d6['models'];var _0x46b320=_0x33db26[_0xd5f3('0xe')]({'plain':!![]});if(_0x46b320[_0xd5f3('0xf')][_0xd5f3('0x10')]()==='in'||_0x46b320[_0xd5f3('0xf')][_0xd5f3('0x10')]()===_0xd5f3('0x11')&&!_0x46b320[_0xd5f3('0x12')]&&!_[_0xd5f3('0x13')](_0x46b320['UserId'])&&!_['isNil'](_0x46b320[_0xd5f3('0x14')])){_0x12ddea['SmsInteraction'][_0xd5f3('0x15')]({'where':{'id':_0x46b320[_0xd5f3('0x14')]}})[_0xd5f3('0x16')](function(_0x13a2f6){if(_0x13a2f6){_0x13a2f6[_0xd5f3('0x17')]({'lastMsgAt':_0x46b320[_0xd5f3('0x18')],'lastMsgDirection':_0x46b320[_0xd5f3('0xf')][_0xd5f3('0x10')]()});}})[_0xd5f3('0x19')](function(_0x410320){console['error'](_0x410320);});}if(_0x46b320[_0xd5f3('0xf')]===_0xd5f3('0x11')&&!_0x46b320['secret']){var _0x473e39;_0x12ddea['SmsAccount'][_0xd5f3('0x1a')]({'where':{'id':_0x46b320[_0xd5f3('0x1b')]},'raw':!![]})[_0xd5f3('0x16')](function(_0x19f998){_0x473e39=_0x19f998;if(_0x473e39&&_0x473e39[_0xd5f3('0x1c')]){switch(_0x473e39[_0xd5f3('0x1c')]){case _0xd5f3('0x1d'):var _0xd80a70=require(_0xd5f3('0x1d'));if(_0x473e39[_0xd5f3('0x1e')]&&_0x473e39[_0xd5f3('0x1f')]&&_0x473e39[_0xd5f3('0x20')]){var _0x3f851e=new _0xd80a70(_0x473e39[_0xd5f3('0x1e')],_0x473e39[_0xd5f3('0x1f')]);_0x3f851e['messages'][_0xd5f3('0x21')]({'body':_0x46b320[_0xd5f3('0xc')],'to':_0x46b320[_0xd5f3('0x20')],'from':_0x473e39['phone'],'statusCallback':_0x473e39[_0xd5f3('0x22')]+_0xd5f3('0x23')+_0x46b320['id']+_0xd5f3('0x24')+_0x473e39[_0xd5f3('0x25')]})['then'](function(_0x14690d){if(_0x14690d['sid']){return _0x33db26[_0xd5f3('0x17')]({'messageId':_0x14690d[_0xd5f3('0x26')]});}})[_0xd5f3('0x19')](function(_0x26e952){logger['error'](_0xd5f3('0x27'),_0xd5f3('0x28'),_0xd5f3('0x1d'),util[_0xd5f3('0x29')](_0x26e952,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xd5f3('0x27'),_0xd5f3('0x28'),'twilio',_0xd5f3('0x2a'));}break;case'skebby':var _0x4be5d1=_0xd5f3('0x2b');if(_0x473e39[_0xd5f3('0x2c')]&&_0x473e39[_0xd5f3('0x2d')]){var _0x4b0eef={'recipient':[_0x46b320[_0xd5f3('0x20')]],'message':_0x46b320[_0xd5f3('0xc')],'message_type':_0x473e39['smsMethod']};if(_0x473e39['smsMethod']&&_0x473e39[_0xd5f3('0x2e')]!=='SI'){_0x4b0eef[_0xd5f3('0x2f')]=_0x473e39[_0xd5f3('0x20')];}var _0x29b2ca={'url':_0x4be5d1+'login?username='+_0x473e39[_0xd5f3('0x2c')]+_0xd5f3('0x30')+_0x473e39['password'],'method':_0xd5f3('0x31')};rp(_0x29b2ca)[_0xd5f3('0x16')](function(_0xb401ef){var _0x1a89f3=_0xb401ef[_0xd5f3('0x32')](';');var _0x350890={'user_key':_0x1a89f3[0x0],'session_key':_0x1a89f3[0x1]};_0x29b2ca={'url':_0x4be5d1+'sms','method':_0xd5f3('0x33'),'headers':{'user_key':_0x350890[_0xd5f3('0x34')],'Session_key':_0x350890[_0xd5f3('0x35')]},'json':!![],'body':_0x4b0eef};return rp(_0x29b2ca);})['then'](function(_0x3a4219){if(_0x3a4219[_0xd5f3('0x36')]>=0x1){var _0x516a27={'messageId':_0x3a4219[_0xd5f3('0x37')]};if(_0x473e39[_0xd5f3('0x2e')]!=='GP'||!_0x473e39[_0xd5f3('0x38')]){_0x516a27[_0xd5f3('0x39')]=!![];}return _0x33db26[_0xd5f3('0x17')](_0x516a27);}else{return logger[_0xd5f3('0x3a')](_0xd5f3('0x27'),_0xd5f3('0x28'),_0xd5f3('0x3b'),util[_0xd5f3('0x29')](_0x3a4219,{'showHidden':![],'depth':null}));}})[_0xd5f3('0x19')](function(_0x2cab6f){return logger[_0xd5f3('0x3a')](_0xd5f3('0x27'),'afterCreate',_0xd5f3('0x3b'),util['inspect'](_0x2cab6f,{'showHidden':![],'depth':null}));});}else{logger[_0xd5f3('0x3a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd5f3('0x28'),'skebby',_0xd5f3('0x3c'));}break;case _0xd5f3('0x3d'):if(_0x473e39[_0xd5f3('0x1f')]){var _0x4f81a6={'recipient':_0x46b320['phone'],'message':_0x46b320['body'],'sender':_0x473e39['senderString']||_0x473e39[_0xd5f3('0x20')],'authorization':_0x473e39[_0xd5f3('0x1f')]};var _0x343895={'method':_0xd5f3('0x33'),'uri':'https://smsapi.connectel.se/api/v2/send/','body':_0x4f81a6,'json':!![]};rp(_0x343895)['then'](function(_0x13beb0){var _0x4cfea4={'messageId':_0x13beb0['requestid']};if(!_0x473e39[_0xd5f3('0x38')]){_0x4cfea4[_0xd5f3('0x39')]=!![];}return _0x33db26[_0xd5f3('0x17')](_0x4cfea4);})['catch'](function(_0x1af5d1){logger[_0xd5f3('0x3a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd5f3('0x28'),_0xd5f3('0x3d'),util[_0xd5f3('0x29')](_0x1af5d1,{'showHidden':![],'depth':null}));});}else{logger[_0xd5f3('0x3a')](_0xd5f3('0x27'),_0xd5f3('0x28'),_0xd5f3('0x3d'),_0xd5f3('0x3e'));}break;case'clicksend':if(_0x473e39['username']&&_0x473e39[_0xd5f3('0x2d')]){var _0x4f81a6={'messages':[{'source':'xCALLY\x20Motion','to':_0x46b320[_0xd5f3('0x20')],'body':_0x46b320[_0xd5f3('0xc')],'from':_0x473e39[_0xd5f3('0x3f')]||_0x473e39[_0xd5f3('0x20')]}]};var _0x4f93ad=util[_0xd5f3('0x40')](_0xd5f3('0x41'),_0x473e39[_0xd5f3('0x2c')],_0x473e39[_0xd5f3('0x2d')]);var _0x343895={'method':_0xd5f3('0x33'),'uri':_0xd5f3('0x42'),'body':_0x4f81a6,'headers':{'Authorization':util[_0xd5f3('0x40')](_0xd5f3('0x43'),new Buffer(_0x4f93ad)[_0xd5f3('0x44')](_0xd5f3('0x45')))},'json':!![]};rp(_0x343895)[_0xd5f3('0x16')](function(_0x15d172){if(_0x15d172[_0xd5f3('0x46')]>=0xc8&&_0x15d172[_0xd5f3('0x46')]<=0xce){if(_0x15d172[_0xd5f3('0x47')]&&_0x15d172['data'][_0xd5f3('0x48')]>0x0){var _0x404046=_[_0xd5f3('0x49')](_0x15d172[_0xd5f3('0x47')][_0xd5f3('0x4a')]);var _0x52e5c7={'messageId':_0x404046[_0xd5f3('0x4b')]};if(!_0x473e39[_0xd5f3('0x38')]){_0x52e5c7[_0xd5f3('0x39')]=!![];}return _0x33db26[_0xd5f3('0x17')](_0x52e5c7);}else{logger[_0xd5f3('0x3a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd5f3('0x28'),_0xd5f3('0x4c'),util[_0xd5f3('0x29')](_0x15d172,{'showHidden':![],'depth':null}));}}else{logger['error'](_0xd5f3('0x27'),_0xd5f3('0x28'),'clickSend',util[_0xd5f3('0x29')](_0x15d172,{'showHidden':![],'depth':null}));}})[_0xd5f3('0x19')](function(_0x3d8ba5){logger[_0xd5f3('0x3a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd5f3('0x28'),'clickSend',util[_0xd5f3('0x29')](_0x3d8ba5,{'showHidden':![],'depth':null}));});}else{logger[_0xd5f3('0x3a')](_0xd5f3('0x27'),'afterCreate',_0xd5f3('0x4c'),_0xd5f3('0x3c'));}break;case _0xd5f3('0x4d'):if(_0x473e39['authId']&&_0x473e39['authToken']){var _0x4f81a6={'dst':_0x46b320[_0xd5f3('0x20')],'text':_0x46b320[_0xd5f3('0xc')],'src':_0x473e39['senderString']||_0x473e39[_0xd5f3('0x20')],'url':_0x473e39[_0xd5f3('0x22')]+_0xd5f3('0x23')+_0x46b320['id']+'/status?token='+_0x473e39['token']};var _0x4f93ad=util['format'](_0xd5f3('0x41'),_0x473e39[_0xd5f3('0x4e')],_0x473e39[_0xd5f3('0x1f')]);var _0x343895={'method':_0xd5f3('0x33'),'uri':util['format'](_0xd5f3('0x4f'),_0x473e39[_0xd5f3('0x4e')]),'body':_0x4f81a6,'headers':{'Authorization':util[_0xd5f3('0x40')](_0xd5f3('0x43'),new Buffer(_0x4f93ad)['toString'](_0xd5f3('0x45')))},'json':!![]};rp(_0x343895)['then'](function(_0x3ee452){var _0x5a3bae={'messageId':_0x3ee452['message_uuid'][0x0]};return _0x33db26[_0xd5f3('0x17')](_0x5a3bae);})['catch'](function(_0x33eafc){logger[_0xd5f3('0x3a')](_0xd5f3('0x27'),'afterCreate',_0xd5f3('0x4d'),util[_0xd5f3('0x29')](_0x33eafc,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xd5f3('0x27'),_0xd5f3('0x28'),'plivo','Missing\x20parameters:\x20authId,\x20authToken');}break;case _0xd5f3('0x50'):if(_0x473e39[_0xd5f3('0x2c')]&&_0x473e39[_0xd5f3('0x2d')]){if(_0x473e39[_0xd5f3('0x51')]){var _0x5bb4fb={'method':_0xd5f3('0x33'),'uri':_0x473e39[_0xd5f3('0x51')]+_0xd5f3('0x52'),'body':{'username':_0x473e39[_0xd5f3('0x2c')],'password':_0x473e39[_0xd5f3('0x2d')]},'json':!![]};return rp(_0x5bb4fb)[_0xd5f3('0x16')](function(_0xc4a036){var _0xd51810={'method':_0xd5f3('0x33'),'uri':_0x473e39[_0xd5f3('0x51')]+_0xd5f3('0x53'),'body':{'messages':[{'from':_0x473e39['phone'],'destinations':[{'to':_0x46b320[_0xd5f3('0x20')]}],'text':_0x46b320[_0xd5f3('0xc')],'notifyUrl':_0x473e39['remote']+'/api/sms/messages/'+_0x46b320['id']+_0xd5f3('0x24')+_0x473e39[_0xd5f3('0x25')],'notifyContentType':_0xd5f3('0x54'),'callbackData':_0x473e39[_0xd5f3('0x20')]+';'+_0x46b320['body']}]},'headers':{'Authorization':_0xd5f3('0x55')+_0xc4a036[_0xd5f3('0x25')]},'json':!![]};return rp(_0xd51810)[_0xd5f3('0x16')](function(_0x38574d){if(_0x38574d[_0xd5f3('0x4a')]){var _0x461de9={'messageId':_0x38574d[_0xd5f3('0x4a')][0x0]['messageId']};if(!_0x473e39[_0xd5f3('0x38')]){_0x461de9[_0xd5f3('0x39')]=!![];}return _0x33db26['update'](_0x461de9);}else{return logger[_0xd5f3('0x3a')](_0xd5f3('0x27'),'afterCreate',_0xd5f3('0x50'),util['inspect'](_0x38574d,{'showHidden':![],'depth':null}));}});})['catch'](function(_0x475dc1){return logger[_0xd5f3('0x3a')](_0xd5f3('0x27'),_0xd5f3('0x28'),_0xd5f3('0x50'),util[_0xd5f3('0x29')](_0x475dc1,{'showHidden':![],'depth':null}));});}else{logger[_0xd5f3('0x3a')](_0xd5f3('0x27'),_0xd5f3('0x28'),_0xd5f3('0x50'),_0xd5f3('0x56'));}}else{logger[_0xd5f3('0x3a')](_0xd5f3('0x27'),_0xd5f3('0x28'),'infobip','Missing\x20parameters:\x20username,\x20password');}break;case _0xd5f3('0x57'):var _0x805d62=require(_0xd5f3('0x58'));if(_0x473e39[_0xd5f3('0x59')]){var _0x1215c2={};_0x1215c2[_0xd5f3('0x5a')]=_0x473e39[_0xd5f3('0x2c')];_0x1215c2[_0xd5f3('0x20')]=_0x46b320[_0xd5f3('0x20')];_0x1215c2['sender']=_0x473e39[_0xd5f3('0x20')];_0x1215c2[_0xd5f3('0x5b')]=_0x46b320[_0xd5f3('0xc')];_0x1215c2[_0xd5f3('0x5c')]=+new Date();var _0x5f0aba='';var _0x276098='';var _0x5b733e=Object['keys'](_0x1215c2);_0x5b733e[_0xd5f3('0x5d')]();for(var _0x5e20ae=0x0;_0x5e20ae<_0x5b733e[_0xd5f3('0x5e')];_0x5e20ae++){if(_0x5f0aba!=''){_0x5f0aba+='&';}_0x5f0aba+=_0x5b733e[_0x5e20ae]+'='+encodeURIComponent(_0x1215c2[_0x5b733e[_0x5e20ae]]);_0x276098+=_0x1215c2[_0x5b733e[_0x5e20ae]];}_0x276098+=_0x473e39[_0xd5f3('0x59')];_0x276098=_0x805d62[_0xd5f3('0x5f')](_0xd5f3('0x60'))[_0xd5f3('0x17')](_0x276098)[_0xd5f3('0x61')](_0xd5f3('0x62'));if(_0x5f0aba!==''){_0x5f0aba+='&';}_0x5f0aba+='signature='+_0x276098;var _0x29b2ca={'method':_0xd5f3('0x31'),'uri':_0x473e39[_0xd5f3('0x51')]+_0xd5f3('0x63')+_0x5f0aba,'json':!![]};return rp(_0x29b2ca)[_0xd5f3('0x16')](function(_0x3722ca){var _0x1370be=Object[_0xd5f3('0x64')](_0x3722ca);if(_0x3722ca[_0x1370be[0x0]][_0xd5f3('0x3a')]&&parseInt(_0x3722ca[_0x1370be[0x0]]['error'])===0x0){var _0x2b92d5={'messageId':_0x3722ca[_0x1370be[0x0]]['id_sms']};if(!_0x473e39['deliveryReport']){_0x2b92d5[_0xd5f3('0x39')]=!![];}return _0x33db26[_0xd5f3('0x17')](_0x2b92d5);}else{return logger[_0xd5f3('0x3a')](_0xd5f3('0x27'),_0xd5f3('0x28'),'csc',util[_0xd5f3('0x29')](_0x3722ca['error'],{'showHidden':![],'depth':null}));}})[_0xd5f3('0x19')](function(_0x562640){return logger[_0xd5f3('0x3a')](_0xd5f3('0x27'),_0xd5f3('0x28'),_0xd5f3('0x57'),util[_0xd5f3('0x29')](_0x562640,{'showHidden':![],'depth':null}));});}else{logger[_0xd5f3('0x3a')](_0xd5f3('0x27'),_0xd5f3('0x28'),'csc',_0xd5f3('0x65'));}break;case _0xd5f3('0x66'):if(_0x473e39['apiKey']){var _0x12d780={'method':_0xd5f3('0x33'),'uri':_0xd5f3('0x67'),'headers':{'Authorization':_0x473e39[_0xd5f3('0x59')]},'body':{'content':_0x46b320['body'],'to':[_0x46b320[_0xd5f3('0x20')]],'from':_0x473e39['phone'],'binary':![],'clientMessageId':_0xd5f3('0x68'),'charset':'UTF-8'},'json':!![]};rp(_0x12d780)[_0xd5f3('0x16')](function(_0x11b153){if(!_0x11b153[_0xd5f3('0x3a')]){var _0x227214={'messageId':_0x11b153[_0xd5f3('0x4a')][0x0][_0xd5f3('0x69')]};if(!_0x473e39[_0xd5f3('0x38')]){_0x227214[_0xd5f3('0x39')]=!![];}return _0x33db26['update'](_0x227214);}else{return logger['error'](_0xd5f3('0x27'),_0xd5f3('0x28'),_0xd5f3('0x66'),util[_0xd5f3('0x29')](_0x11b153['error'],{'showHidden':![],'depth':null}));}})[_0xd5f3('0x19')](function(_0x3d6c06){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xd5f3('0x66'),util[_0xd5f3('0x29')](_0x3d6c06,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xd5f3('0x27'),_0xd5f3('0x28'),_0xd5f3('0x66'),_0xd5f3('0x65'));}break;case _0xd5f3('0x6a'):if(_0x473e39['username']&&_0x473e39['password']){var _0x4f93ad=util['format'](_0xd5f3('0x41'),_0x473e39['username'],_0x473e39['password']);var _0x343895={'method':_0xd5f3('0x33'),'uri':'https://messaging.bandwidth.com/api/v2/users/'+_0x473e39[_0xd5f3('0x6b')]+_0xd5f3('0x6c'),'body':{'to':[_0x46b320['phone']],'text':_0x46b320['body'],'from':_0x473e39['phone'],'applicationId':_0x473e39['applicationId']},'headers':{'Authorization':util[_0xd5f3('0x40')](_0xd5f3('0x43'),new Buffer(_0x4f93ad)[_0xd5f3('0x44')](_0xd5f3('0x45')))},'json':!![]};rp(_0x343895)['then'](function(_0x5dbfc6){if(_0x5dbfc6['id']){var _0x35892f={'messageId':_0x5dbfc6['id']};return _0x33db26[_0xd5f3('0x17')](_0x35892f);}else{logger['error'](_0xd5f3('0x27'),'afterCreate',_0xd5f3('0x6a'),util[_0xd5f3('0x29')](_0x5dbfc6,{'showHidden':![],'depth':null}));}})[_0xd5f3('0x19')](function(_0x2b91cb){logger['error'](_0xd5f3('0x27'),'afterCreate',_0xd5f3('0x6a'),util[_0xd5f3('0x29')](_0x2b91cb,{'showHidden':![],'depth':null}));});}else{logger[_0xd5f3('0x3a')](_0xd5f3('0x27'),'afterCreate',_0xd5f3('0x6a'),_0xd5f3('0x3c'));}break;case _0xd5f3('0x6d'):if(_0x473e39[_0xd5f3('0x59')]){var _0x5b05b6={};var _0x29b2ca={'method':_0xd5f3('0x33'),'uri':_0xd5f3('0x6e'),'headers':{'Authorization':_0xd5f3('0x6f')+_0x473e39['apiKey'],'Content-Type':_0xd5f3('0x54')},'body':{'from':_0x473e39[_0xd5f3('0x20')],'to':_0x46b320[_0xd5f3('0x20')],'text':_0x46b320[_0xd5f3('0xc')]},'json':!![]};return rp(_0x29b2ca)[_0xd5f3('0x16')](function(_0x2badfc){if(_0x2badfc[_0xd5f3('0x70')]==0xca){_0x5b05b6[_0xd5f3('0x71')]=_0x2badfc;var _0x365175={'method':_0xd5f3('0x33'),'uri':_0xd5f3('0x72'),'headers':{'Authorization':'Bearer\x20'+_0x473e39[_0xd5f3('0x59')],'Content-Type':_0xd5f3('0x54')},'body':{'refid':_0x5b05b6['message']['refid']},'json':!![]};return rp(_0x365175)[_0xd5f3('0x16')](function(_0x8b3897){_0x5b05b6[_0xd5f3('0x73')]=_0x8b3897;var _0xd4ad1c={'messageId':_0x5b05b6[_0xd5f3('0x71')][_0xd5f3('0x74')],'read':!![]};return _0x33db26[_0xd5f3('0x17')](_0xd4ad1c);});}else{return logger[_0xd5f3('0x3a')](_0xd5f3('0x27'),'afterCreate',_0xd5f3('0x6d'),util[_0xd5f3('0x29')](_0x2badfc,{'showHidden':![],'depth':null}));}})[_0xd5f3('0x19')](function(_0x1f291c){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd5f3('0x28'),'intelepeer',util[_0xd5f3('0x29')](_0x1f291c,{'showHidden':![],'depth':null}));});}else{return logger[_0xd5f3('0x3a')](_0xd5f3('0x27'),'afterCreate','intelepeer','Token\x20not\x20received');}break;}}})['finally'](function(){_0xbd493d();});}else{_0xbd493d();}}},'charset':_0xd5f3('0x75'),'collate':_0xd5f3('0x76')});}; \ No newline at end of file +var _0x808e=['https://api.intelepeer.com/_rest/v4/app/sms/send','code','message','Bearer\x20','refid','Token\x20not\x20received','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','exports','SmsMessage','sms_messages','messageId','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','SmsInteractionId','SmsInteraction','findOne','update','createdAt','catch','error','SmsAccountId','type','twilio','accountSid','phone','authToken','messages','create','remote','/api/sms/messages/','/status?token=','token','then','sid','afterCreate','SmsMessage,\x20%s,\x20%s,\x20%s','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','login?username=','&password=','split','sms','POST','user_key','total_sent','internal_order_id','deliveryReport','read','inspect','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','Missing\x20parameters:\x20authToken','clicksend','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','data','queued_count','head','message_id','clickSend','plivo','authId','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','login','text','timestamp','sort','createHash','md5','digest','hex','signature=','/external/get/send.php?','keys','id_sms','https://platform.clickatell.com/messages','uuid','UTF-8','clickatell','Missing\x20parameters:\x20apiKey','bandwidth','https://messaging.bandwidth.com/api/v2/users/','applicationId','intelepeer'];(function(_0x42bf29,_0x1b06cc){var _0x50f61e=function(_0x6ddb53){while(--_0x6ddb53){_0x42bf29['push'](_0x42bf29['shift']());}};_0x50f61e(++_0x1b06cc);}(_0x808e,0x1f4));var _0xe808=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0x808e[_0x2b7764];return _0x848dcb;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe808('0x0'))(_0xe808('0x1'));var moment=require(_0xe808('0x2'));var BPromise=require('bluebird');var rp=require(_0xe808('0x3'));var fs=require('fs');var path=require(_0xe808('0x4'));var rimraf=require(_0xe808('0x5'));var config=require(_0xe808('0x6'));var attributes=require(_0xe808('0x7'));module[_0xe808('0x8')]=function(_0x1455da,_0x25de63){return _0x1455da['define'](_0xe808('0x9'),attributes,{'tableName':_0xe808('0xa'),'paranoid':![],'indexes':[{'name':_0xe808('0xb'),'fields':['messageId']},{'name':'fti_sms_messages','fields':[_0xe808('0xc')],'type':_0xe808('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x263344,_0x236f4b,_0x3e6967){var _0x358feb=_0x1455da[_0xe808('0xe')];var _0x40b7c3=_0x263344[_0xe808('0xf')]({'plain':!![]});if(_0x40b7c3[_0xe808('0x10')][_0xe808('0x11')]()==='in'||_0x40b7c3[_0xe808('0x10')][_0xe808('0x11')]()===_0xe808('0x12')&&!_0x40b7c3[_0xe808('0x13')]&&!_[_0xe808('0x14')](_0x40b7c3[_0xe808('0x15')])&&!_[_0xe808('0x14')](_0x40b7c3[_0xe808('0x16')])){_0x358feb[_0xe808('0x17')][_0xe808('0x18')]({'where':{'id':_0x40b7c3[_0xe808('0x16')]}})['then'](function(_0x2e8e57){if(_0x2e8e57){_0x2e8e57[_0xe808('0x19')]({'lastMsgAt':_0x40b7c3[_0xe808('0x1a')],'lastMsgDirection':_0x40b7c3[_0xe808('0x10')][_0xe808('0x11')]()});}})[_0xe808('0x1b')](function(_0x3279b1){console[_0xe808('0x1c')](_0x3279b1);});}if(_0x40b7c3[_0xe808('0x10')]===_0xe808('0x12')&&!_0x40b7c3[_0xe808('0x13')]){var _0x25a5b2;_0x358feb['SmsAccount']['find']({'where':{'id':_0x40b7c3[_0xe808('0x1d')]},'raw':!![]})['then'](function(_0x40005d){_0x25a5b2=_0x40005d;if(_0x25a5b2&&_0x25a5b2[_0xe808('0x1e')]){switch(_0x25a5b2['type']){case _0xe808('0x1f'):var _0x262310=require(_0xe808('0x1f'));if(_0x25a5b2[_0xe808('0x20')]&&_0x25a5b2['authToken']&&_0x25a5b2[_0xe808('0x21')]){var _0x3029af=new _0x262310(_0x25a5b2[_0xe808('0x20')],_0x25a5b2[_0xe808('0x22')]);_0x3029af[_0xe808('0x23')][_0xe808('0x24')]({'body':_0x40b7c3[_0xe808('0xc')],'to':_0x40b7c3[_0xe808('0x21')],'from':_0x25a5b2[_0xe808('0x21')],'statusCallback':_0x25a5b2[_0xe808('0x25')]+_0xe808('0x26')+_0x40b7c3['id']+_0xe808('0x27')+_0x25a5b2[_0xe808('0x28')]})[_0xe808('0x29')](function(_0x5dd4b3){if(_0x5dd4b3[_0xe808('0x2a')]){return _0x263344[_0xe808('0x19')]({'messageId':_0x5dd4b3[_0xe808('0x2a')]});}})[_0xe808('0x1b')](function(_0x3d5e69){logger[_0xe808('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe808('0x2b'),_0xe808('0x1f'),util['inspect'](_0x3d5e69,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xe808('0x2c'),_0xe808('0x2b'),_0xe808('0x1f'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0xe808('0x2d'):var _0x1af9d8=_0xe808('0x2e');if(_0x25a5b2[_0xe808('0x2f')]&&_0x25a5b2[_0xe808('0x30')]){var _0x1e0068={'recipient':[_0x40b7c3[_0xe808('0x21')]],'message':_0x40b7c3[_0xe808('0xc')],'message_type':_0x25a5b2[_0xe808('0x31')]};if(_0x25a5b2['smsMethod']&&_0x25a5b2[_0xe808('0x31')]!=='SI'){_0x1e0068['sender']=_0x25a5b2[_0xe808('0x21')];}var _0x457a11={'url':_0x1af9d8+_0xe808('0x32')+_0x25a5b2[_0xe808('0x2f')]+_0xe808('0x33')+_0x25a5b2[_0xe808('0x30')],'method':'GET'};rp(_0x457a11)[_0xe808('0x29')](function(_0x50df2d){var _0x81dd8d=_0x50df2d[_0xe808('0x34')](';');var _0x575322={'user_key':_0x81dd8d[0x0],'session_key':_0x81dd8d[0x1]};_0x457a11={'url':_0x1af9d8+_0xe808('0x35'),'method':_0xe808('0x36'),'headers':{'user_key':_0x575322[_0xe808('0x37')],'Session_key':_0x575322['session_key']},'json':!![],'body':_0x1e0068};return rp(_0x457a11);})['then'](function(_0x57d28d){if(_0x57d28d[_0xe808('0x38')]>=0x1){var _0x57db81={'messageId':_0x57d28d[_0xe808('0x39')]};if(_0x25a5b2[_0xe808('0x31')]!=='GP'||!_0x25a5b2[_0xe808('0x3a')]){_0x57db81[_0xe808('0x3b')]=!![];}return _0x263344[_0xe808('0x19')](_0x57db81);}else{return logger[_0xe808('0x1c')](_0xe808('0x2c'),_0xe808('0x2b'),'skebby',util[_0xe808('0x3c')](_0x57d28d,{'showHidden':![],'depth':null}));}})[_0xe808('0x1b')](function(_0x5e51b3){return logger[_0xe808('0x1c')](_0xe808('0x2c'),_0xe808('0x2b'),'skebby',util[_0xe808('0x3c')](_0x5e51b3,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xe808('0x2c'),_0xe808('0x2b'),_0xe808('0x2d'),_0xe808('0x3d'));}break;case _0xe808('0x3e'):if(_0x25a5b2[_0xe808('0x22')]){var _0x432ece={'recipient':_0x40b7c3[_0xe808('0x21')],'message':_0x40b7c3[_0xe808('0xc')],'sender':_0x25a5b2[_0xe808('0x3f')]||_0x25a5b2[_0xe808('0x21')],'authorization':_0x25a5b2[_0xe808('0x22')]};var _0x236f4b={'method':'POST','uri':_0xe808('0x40'),'body':_0x432ece,'json':!![]};rp(_0x236f4b)[_0xe808('0x29')](function(_0x54d67b){var _0x10be7b={'messageId':_0x54d67b[_0xe808('0x41')]};if(!_0x25a5b2[_0xe808('0x3a')]){_0x10be7b[_0xe808('0x3b')]=!![];}return _0x263344[_0xe808('0x19')](_0x10be7b);})[_0xe808('0x1b')](function(_0x2dcf9b){logger[_0xe808('0x1c')](_0xe808('0x2c'),_0xe808('0x2b'),_0xe808('0x3e'),util[_0xe808('0x3c')](_0x2dcf9b,{'showHidden':![],'depth':null}));});}else{logger[_0xe808('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe808('0x2b'),'connectel',_0xe808('0x42'));}break;case _0xe808('0x43'):if(_0x25a5b2[_0xe808('0x2f')]&&_0x25a5b2[_0xe808('0x30')]){var _0x432ece={'messages':[{'source':'xCALLY\x20Motion','to':_0x40b7c3[_0xe808('0x21')],'body':_0x40b7c3[_0xe808('0xc')],'from':_0x25a5b2['senderString']||_0x25a5b2[_0xe808('0x21')]}]};var _0x8e0cf9=util[_0xe808('0x44')](_0xe808('0x45'),_0x25a5b2[_0xe808('0x2f')],_0x25a5b2['password']);var _0x236f4b={'method':_0xe808('0x36'),'uri':_0xe808('0x46'),'body':_0x432ece,'headers':{'Authorization':util['format'](_0xe808('0x47'),new Buffer(_0x8e0cf9)[_0xe808('0x48')](_0xe808('0x49')))},'json':!![]};rp(_0x236f4b)[_0xe808('0x29')](function(_0x1e02f2){if(_0x1e02f2[_0xe808('0x4a')]>=0xc8&&_0x1e02f2[_0xe808('0x4a')]<=0xce){if(_0x1e02f2[_0xe808('0x4b')]&&_0x1e02f2[_0xe808('0x4b')][_0xe808('0x4c')]>0x0){var _0x5adee7=_[_0xe808('0x4d')](_0x1e02f2['data']['messages']);var _0x49b6c9={'messageId':_0x5adee7[_0xe808('0x4e')]};if(!_0x25a5b2[_0xe808('0x3a')]){_0x49b6c9['read']=!![];}return _0x263344[_0xe808('0x19')](_0x49b6c9);}else{logger[_0xe808('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe808('0x2b'),'clickSend',util[_0xe808('0x3c')](_0x1e02f2,{'showHidden':![],'depth':null}));}}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe808('0x2b'),'clickSend',util[_0xe808('0x3c')](_0x1e02f2,{'showHidden':![],'depth':null}));}})[_0xe808('0x1b')](function(_0x2638a9){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe808('0x2b'),_0xe808('0x4f'),util[_0xe808('0x3c')](_0x2638a9,{'showHidden':![],'depth':null}));});}else{logger[_0xe808('0x1c')](_0xe808('0x2c'),_0xe808('0x2b'),'clickSend',_0xe808('0x3d'));}break;case _0xe808('0x50'):if(_0x25a5b2[_0xe808('0x51')]&&_0x25a5b2[_0xe808('0x22')]){var _0x432ece={'dst':_0x40b7c3[_0xe808('0x21')],'text':_0x40b7c3[_0xe808('0xc')],'src':_0x25a5b2['senderString']||_0x25a5b2[_0xe808('0x21')],'url':_0x25a5b2[_0xe808('0x25')]+_0xe808('0x26')+_0x40b7c3['id']+_0xe808('0x27')+_0x25a5b2[_0xe808('0x28')]};var _0x8e0cf9=util[_0xe808('0x44')](_0xe808('0x45'),_0x25a5b2[_0xe808('0x51')],_0x25a5b2[_0xe808('0x22')]);var _0x236f4b={'method':'POST','uri':util[_0xe808('0x44')](_0xe808('0x52'),_0x25a5b2['authId']),'body':_0x432ece,'headers':{'Authorization':util[_0xe808('0x44')](_0xe808('0x47'),new Buffer(_0x8e0cf9)[_0xe808('0x48')]('base64'))},'json':!![]};rp(_0x236f4b)[_0xe808('0x29')](function(_0x124946){var _0xbcac03={'messageId':_0x124946[_0xe808('0x53')][0x0]};return _0x263344[_0xe808('0x19')](_0xbcac03);})['catch'](function(_0x518b71){logger[_0xe808('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe808('0x2b'),'plivo',util[_0xe808('0x3c')](_0x518b71,{'showHidden':![],'depth':null}));});}else{logger[_0xe808('0x1c')](_0xe808('0x2c'),_0xe808('0x2b'),'plivo',_0xe808('0x54'));}break;case _0xe808('0x55'):if(_0x25a5b2[_0xe808('0x2f')]&&_0x25a5b2['password']){if(_0x25a5b2[_0xe808('0x56')]){var _0x8770f2={'method':'POST','uri':_0x25a5b2[_0xe808('0x56')]+_0xe808('0x57'),'body':{'username':_0x25a5b2[_0xe808('0x2f')],'password':_0x25a5b2[_0xe808('0x30')]},'json':!![]};return rp(_0x8770f2)['then'](function(_0x344000){var _0x585ad3={'method':_0xe808('0x36'),'uri':_0x25a5b2[_0xe808('0x56')]+_0xe808('0x58'),'body':{'messages':[{'from':_0x25a5b2[_0xe808('0x21')],'destinations':[{'to':_0x40b7c3[_0xe808('0x21')]}],'text':_0x40b7c3['body'],'notifyUrl':_0x25a5b2[_0xe808('0x25')]+'/api/sms/messages/'+_0x40b7c3['id']+_0xe808('0x27')+_0x25a5b2[_0xe808('0x28')],'notifyContentType':_0xe808('0x59'),'callbackData':_0x25a5b2[_0xe808('0x21')]+';'+_0x40b7c3[_0xe808('0xc')]}]},'headers':{'Authorization':'IBSSO\x20'+_0x344000[_0xe808('0x28')]},'json':!![]};return rp(_0x585ad3)[_0xe808('0x29')](function(_0x4b30a1){if(_0x4b30a1['messages']){var _0x2473bc={'messageId':_0x4b30a1[_0xe808('0x23')][0x0][_0xe808('0xb')]};if(!_0x25a5b2['deliveryReport']){_0x2473bc[_0xe808('0x3b')]=!![];}return _0x263344['update'](_0x2473bc);}else{return logger[_0xe808('0x1c')](_0xe808('0x2c'),_0xe808('0x2b'),_0xe808('0x55'),util[_0xe808('0x3c')](_0x4b30a1,{'showHidden':![],'depth':null}));}});})['catch'](function(_0x3bdfd6){return logger[_0xe808('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe808('0x2b'),_0xe808('0x55'),util[_0xe808('0x3c')](_0x3bdfd6,{'showHidden':![],'depth':null}));});}else{logger[_0xe808('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe808('0x2b'),_0xe808('0x55'),_0xe808('0x5a'));}}else{logger[_0xe808('0x1c')](_0xe808('0x2c'),'afterCreate',_0xe808('0x55'),_0xe808('0x3d'));}break;case _0xe808('0x5b'):var _0x485060=require(_0xe808('0x5c'));if(_0x25a5b2[_0xe808('0x5d')]){var _0x26c93e={};_0x26c93e[_0xe808('0x5e')]=_0x25a5b2['username'];_0x26c93e[_0xe808('0x21')]=_0x40b7c3[_0xe808('0x21')];_0x26c93e['sender']=_0x25a5b2['phone'];_0x26c93e[_0xe808('0x5f')]=_0x40b7c3[_0xe808('0xc')];_0x26c93e[_0xe808('0x60')]=+new Date();var _0x2d415c='';var _0x23b59c='';var _0x238d57=Object['keys'](_0x26c93e);_0x238d57[_0xe808('0x61')]();for(var _0x444652=0x0;_0x444652<_0x238d57['length'];_0x444652++){if(_0x2d415c!=''){_0x2d415c+='&';}_0x2d415c+=_0x238d57[_0x444652]+'='+encodeURIComponent(_0x26c93e[_0x238d57[_0x444652]]);_0x23b59c+=_0x26c93e[_0x238d57[_0x444652]];}_0x23b59c+=_0x25a5b2['apiKey'];_0x23b59c=_0x485060[_0xe808('0x62')](_0xe808('0x63'))[_0xe808('0x19')](_0x23b59c)[_0xe808('0x64')](_0xe808('0x65'));if(_0x2d415c!==''){_0x2d415c+='&';}_0x2d415c+=_0xe808('0x66')+_0x23b59c;var _0x457a11={'method':'GET','uri':_0x25a5b2['baseUrl']+_0xe808('0x67')+_0x2d415c,'json':!![]};return rp(_0x457a11)['then'](function(_0x16a40d){var _0x45b725=Object[_0xe808('0x68')](_0x16a40d);if(_0x16a40d[_0x45b725[0x0]][_0xe808('0x1c')]&&parseInt(_0x16a40d[_0x45b725[0x0]]['error'])===0x0){var _0x393474={'messageId':_0x16a40d[_0x45b725[0x0]][_0xe808('0x69')]};if(!_0x25a5b2[_0xe808('0x3a')]){_0x393474[_0xe808('0x3b')]=!![];}return _0x263344[_0xe808('0x19')](_0x393474);}else{return logger[_0xe808('0x1c')](_0xe808('0x2c'),_0xe808('0x2b'),'csc',util['inspect'](_0x16a40d['error'],{'showHidden':![],'depth':null}));}})['catch'](function(_0x8646b8){return logger[_0xe808('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe808('0x2b'),_0xe808('0x5b'),util['inspect'](_0x8646b8,{'showHidden':![],'depth':null}));});}else{logger[_0xe808('0x1c')](_0xe808('0x2c'),'afterCreate',_0xe808('0x5b'),'Missing\x20parameters:\x20apiKey');}break;case'clickatell':if(_0x25a5b2[_0xe808('0x5d')]){var _0x275c1c={'method':_0xe808('0x36'),'uri':_0xe808('0x6a'),'headers':{'Authorization':_0x25a5b2[_0xe808('0x5d')]},'body':{'content':_0x40b7c3['body'],'to':[_0x40b7c3[_0xe808('0x21')]],'from':_0x25a5b2['phone'],'binary':![],'clientMessageId':_0xe808('0x6b'),'charset':_0xe808('0x6c')},'json':!![]};rp(_0x275c1c)[_0xe808('0x29')](function(_0x1e94e5){if(!_0x1e94e5[_0xe808('0x1c')]){var _0x3555b8={'messageId':_0x1e94e5[_0xe808('0x23')][0x0]['apiMessageId']};if(!_0x25a5b2[_0xe808('0x3a')]){_0x3555b8[_0xe808('0x3b')]=!![];}return _0x263344[_0xe808('0x19')](_0x3555b8);}else{return logger[_0xe808('0x1c')](_0xe808('0x2c'),'afterCreate',_0xe808('0x6d'),util[_0xe808('0x3c')](_0x1e94e5[_0xe808('0x1c')],{'showHidden':![],'depth':null}));}})[_0xe808('0x1b')](function(_0x23f9ae){return logger[_0xe808('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe808('0x2b'),_0xe808('0x6d'),util[_0xe808('0x3c')](_0x23f9ae,{'showHidden':![],'depth':null}));});}else{logger[_0xe808('0x1c')](_0xe808('0x2c'),_0xe808('0x2b'),'clickatell',_0xe808('0x6e'));}break;case _0xe808('0x6f'):if(_0x25a5b2[_0xe808('0x2f')]&&_0x25a5b2[_0xe808('0x30')]){var _0x8e0cf9=util[_0xe808('0x44')](_0xe808('0x45'),_0x25a5b2['username'],_0x25a5b2[_0xe808('0x30')]);var _0x236f4b={'method':'POST','uri':_0xe808('0x70')+_0x25a5b2['accountId']+'/messages','body':{'to':[_0x40b7c3[_0xe808('0x21')]],'text':_0x40b7c3[_0xe808('0xc')],'from':_0x25a5b2[_0xe808('0x21')],'applicationId':_0x25a5b2[_0xe808('0x71')]},'headers':{'Authorization':util[_0xe808('0x44')](_0xe808('0x47'),new Buffer(_0x8e0cf9)['toString'](_0xe808('0x49')))},'json':!![]};rp(_0x236f4b)[_0xe808('0x29')](function(_0xb6e4ce){if(_0xb6e4ce['id']){var _0x23a548={'messageId':_0xb6e4ce['id']};return _0x263344[_0xe808('0x19')](_0x23a548);}else{logger[_0xe808('0x1c')](_0xe808('0x2c'),_0xe808('0x2b'),_0xe808('0x6f'),util[_0xe808('0x3c')](_0xb6e4ce,{'showHidden':![],'depth':null}));}})[_0xe808('0x1b')](function(_0x2deb7d){logger['error'](_0xe808('0x2c'),_0xe808('0x2b'),_0xe808('0x6f'),util[_0xe808('0x3c')](_0x2deb7d,{'showHidden':![],'depth':null}));});}else{logger[_0xe808('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe808('0x2b'),_0xe808('0x6f'),'Missing\x20parameters:\x20username,\x20password');}break;case _0xe808('0x72'):if(_0x25a5b2['apiKey']){var _0x2416de={};var _0x457a11={'method':_0xe808('0x36'),'uri':_0xe808('0x73'),'headers':{'Authorization':'Bearer\x20'+_0x25a5b2[_0xe808('0x5d')],'Content-Type':_0xe808('0x59')},'body':{'from':_0x25a5b2[_0xe808('0x21')],'to':_0x40b7c3['phone'],'text':_0x40b7c3[_0xe808('0xc')]},'json':!![]};return rp(_0x457a11)['then'](function(_0x3a4eec){if(_0x3a4eec[_0xe808('0x74')]==0xca){_0x2416de[_0xe808('0x75')]=_0x3a4eec;var _0x4a4acd={'method':'POST','uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':_0xe808('0x76')+_0x25a5b2[_0xe808('0x5d')],'Content-Type':'application/json'},'body':{'refid':_0x2416de[_0xe808('0x75')]['refid']},'json':!![]};return rp(_0x4a4acd)[_0xe808('0x29')](function(_0x4dbe33){_0x2416de['status']=_0x4dbe33;var _0x36b4ee={'messageId':_0x2416de[_0xe808('0x75')][_0xe808('0x77')],'read':!![]};return _0x263344[_0xe808('0x19')](_0x36b4ee);});}else{return logger[_0xe808('0x1c')](_0xe808('0x2c'),_0xe808('0x2b'),'intelepeer',util[_0xe808('0x3c')](_0x3a4eec,{'showHidden':![],'depth':null}));}})[_0xe808('0x1b')](function(_0x4b0553){return logger['error'](_0xe808('0x2c'),'afterCreate','intelepeer',util[_0xe808('0x3c')](_0x4b0553,{'showHidden':![],'depth':null}));});}else{return logger[_0xe808('0x1c')](_0xe808('0x2c'),_0xe808('0x2b'),_0xe808('0x72'),_0xe808('0x78'));}break;}}})['finally'](function(){_0x3e6967();});}else{_0x3e6967();}}},'charset':_0xe808('0x79'),'collate':_0xe808('0x7a')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 5c43ccd..2a821e3 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 _0xc82a=['redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','request','then','info','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsMessage,\x20%s,\x20%s','message','result','catch','CreateSmsMessage','create','body','options','raw','lodash','moment','bluebird','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc82a,0xd0));var _0xac82=function(_0x1501e2,_0x271210){_0x1501e2=_0x1501e2-0x0;var _0xfce8c5=_0xc82a[_0x1501e2];return _0xfce8c5;};'use strict';var _=require(_0xac82('0x0'));var util=require('util');var moment=require(_0xac82('0x1'));var BPromise=require(_0xac82('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xac82('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xac82('0x4'))(_0xac82('0x5'));var config=require('../../config/environment');var jayson=require(_0xac82('0x6'));var client=jayson[_0xac82('0x7')][_0xac82('0x8')]({'port':0x232a});config[_0xac82('0x9')]=_[_0xac82('0xa')](config[_0xac82('0x9')],{'host':_0xac82('0xb'),'port':0x18eb});var socket=require(_0xac82('0xc'))(new Redis(config['redis']));require(_0xac82('0xd'))['register'](socket);function respondWithRpcPromise(_0x1d262a,_0x37a99b,_0x3f3009){return new BPromise(function(_0x34fb81,_0x3b826f){return client[_0xac82('0xe')](_0x1d262a,_0x3f3009)[_0xac82('0xf')](function(_0x23510d){logger[_0xac82('0x10')]('SmsMessage,\x20%s,\x20%s',_0x37a99b,_0xac82('0x11'));logger['debug'](_0xac82('0x12'),_0x37a99b,_0xac82('0x11'),JSON[_0xac82('0x13')](_0x23510d));if(_0x23510d[_0xac82('0x14')]){if(_0x23510d[_0xac82('0x14')][_0xac82('0x15')]===0x1f4){logger['error'](_0xac82('0x16'),_0x37a99b,_0x23510d[_0xac82('0x14')][_0xac82('0x17')]);return _0x3b826f(_0x23510d[_0xac82('0x14')][_0xac82('0x17')]);}logger[_0xac82('0x14')](_0xac82('0x16'),_0x37a99b,_0x23510d['error']['message']);return _0x34fb81(_0x23510d[_0xac82('0x14')][_0xac82('0x17')]);}else{logger['info']('SmsMessage,\x20%s,\x20%s',_0x37a99b,_0xac82('0x11'));_0x34fb81(_0x23510d[_0xac82('0x18')][_0xac82('0x17')]);}})[_0xac82('0x19')](function(_0x5100bf){logger['error']('SmsMessage,\x20%s,\x20%s',_0x37a99b,_0x5100bf);_0x3b826f(_0x5100bf);});});}exports[_0xac82('0x1a')]=function(_0x49cfec){var _0x119e17=this;return new Promise(function(_0x2fca56,_0x4d3543){return db['SmsMessage'][_0xac82('0x1b')](_0x49cfec[_0xac82('0x1c')],{'raw':_0x49cfec[_0xac82('0x1d')]?_0x49cfec[_0xac82('0x1d')][_0xac82('0x1e')]===undefined?!![]:![]:!![]})[_0xac82('0xf')](function(_0x56abb2){logger[_0xac82('0x10')](_0xac82('0x1a'),_0x49cfec);logger['debug'](_0xac82('0x1a'),_0x49cfec,JSON[_0xac82('0x13')](_0x56abb2));_0x2fca56(_0x56abb2);})[_0xac82('0x19')](function(_0x2e9452){logger['error'](_0xac82('0x1a'),_0x2e9452[_0xac82('0x17')],_0x49cfec);_0x4d3543(_0x119e17['error'](0x1f4,_0x2e9452['message']));});});}; \ No newline at end of file +var _0x5d97=['jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./smsMessage.socket','register','request','then','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','CreateSmsMessage','SmsMessage','create','body','options','raw','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment'];(function(_0x5cadab,_0x1dadcb){var _0x2a6d2b=function(_0x1c226a){while(--_0x1c226a){_0x5cadab['push'](_0x5cadab['shift']());}};_0x2a6d2b(++_0x1dadcb);}(_0x5d97,0x19c));var _0x75d9=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0x5d97[_0x2e4aa2];return _0x5e6092;};'use strict';var _=require(_0x75d9('0x0'));var util=require(_0x75d9('0x1'));var moment=require(_0x75d9('0x2'));var BPromise=require(_0x75d9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x75d9('0x4'));var db=require(_0x75d9('0x5'))['db'];var utils=require(_0x75d9('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x75d9('0x7'));var jayson=require(_0x75d9('0x8'));var client=jayson[_0x75d9('0x9')][_0x75d9('0xa')]({'port':0x232a});config['redis']=_[_0x75d9('0xb')](config[_0x75d9('0xc')],{'host':_0x75d9('0xd'),'port':0x18eb});var socket=require(_0x75d9('0xe'))(new Redis(config[_0x75d9('0xc')]));require(_0x75d9('0xf'))[_0x75d9('0x10')](socket);function respondWithRpcPromise(_0x42a363,_0x2db0c5,_0xbccc9d){return new BPromise(function(_0x566d4f,_0x3388e6){return client[_0x75d9('0x11')](_0x42a363,_0xbccc9d)[_0x75d9('0x12')](function(_0x2c33f8){logger['info'](_0x75d9('0x13'),_0x2db0c5,_0x75d9('0x14'));logger[_0x75d9('0x15')](_0x75d9('0x16'),_0x2db0c5,'request\x20sent',JSON[_0x75d9('0x17')](_0x2c33f8));if(_0x2c33f8['error']){if(_0x2c33f8[_0x75d9('0x18')]['code']===0x1f4){logger[_0x75d9('0x18')](_0x75d9('0x13'),_0x2db0c5,_0x2c33f8[_0x75d9('0x18')][_0x75d9('0x19')]);return _0x3388e6(_0x2c33f8[_0x75d9('0x18')][_0x75d9('0x19')]);}logger[_0x75d9('0x18')](_0x75d9('0x13'),_0x2db0c5,_0x2c33f8[_0x75d9('0x18')][_0x75d9('0x19')]);return _0x566d4f(_0x2c33f8['error']['message']);}else{logger[_0x75d9('0x1a')](_0x75d9('0x13'),_0x2db0c5,'request\x20sent');_0x566d4f(_0x2c33f8[_0x75d9('0x1b')][_0x75d9('0x19')]);}})[_0x75d9('0x1c')](function(_0x26aa75){logger['error'](_0x75d9('0x13'),_0x2db0c5,_0x26aa75);_0x3388e6(_0x26aa75);});});}exports[_0x75d9('0x1d')]=function(_0xb3ecc1){var _0x25ba8b=this;return new Promise(function(_0x51a58d,_0x15ab4c){return db[_0x75d9('0x1e')][_0x75d9('0x1f')](_0xb3ecc1[_0x75d9('0x20')],{'raw':_0xb3ecc1['options']?_0xb3ecc1[_0x75d9('0x21')][_0x75d9('0x22')]===undefined?!![]:![]:!![]})['then'](function(_0x403013){logger['info'](_0x75d9('0x1d'),_0xb3ecc1);logger['debug'](_0x75d9('0x1d'),_0xb3ecc1,JSON[_0x75d9('0x17')](_0x403013));_0x51a58d(_0x403013);})[_0x75d9('0x1c')](function(_0x49cf02){logger['error'](_0x75d9('0x1d'),_0x49cf02[_0x75d9('0x19')],_0xb3ecc1);_0x15ab4c(_0x25ba8b[_0x75d9('0x18')](0x1f4,_0x49cf02[_0x75d9('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 1978f23..13a7607 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 _0x5aa2=['emit','removeListener','register','length','./smsMessage.events','remove','update'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0x5aa2,0x1a1));var _0x25aa=function(_0x1cceca,_0x298aef){_0x1cceca=_0x1cceca-0x0;var _0x342195=_0x5aa2[_0x1cceca];return _0x342195;};'use strict';var SmsMessageEvents=require(_0x25aa('0x0'));var events=['save',_0x25aa('0x1'),_0x25aa('0x2')];function createListener(_0x5ec0d0,_0x105ece){return function(_0x75d5bc){_0x105ece[_0x25aa('0x3')](_0x5ec0d0,_0x75d5bc);};}function removeListener(_0x234f11,_0x59b506){return function(){SmsMessageEvents[_0x25aa('0x4')](_0x234f11,_0x59b506);};}exports[_0x25aa('0x5')]=function(_0x485144){for(var _0x4a956d=0x0,_0x3e3695=events[_0x25aa('0x6')];_0x4a956d<_0x3e3695;_0x4a956d++){var _0x16e980=events[_0x4a956d];var _0x4fd1ea=createListener('smsMessage:'+_0x16e980,_0x485144);SmsMessageEvents['on'](_0x16e980,_0x4fd1ea);}}; \ No newline at end of file +var _0x54da=['register','length','save','remove','emit','removeListener'];(function(_0x111f22,_0x5ba1ec){var _0x2b8ba3=function(_0x2ae8ed){while(--_0x2ae8ed){_0x111f22['push'](_0x111f22['shift']());}};_0x2b8ba3(++_0x5ba1ec);}(_0x54da,0x176));var _0xa54d=function(_0x195270,_0x412abb){_0x195270=_0x195270-0x0;var _0x5398dd=_0x54da[_0x195270];return _0x5398dd;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=[_0xa54d('0x0'),_0xa54d('0x1'),'update'];function createListener(_0x48583a,_0x4ae73a){return function(_0x11b832){_0x4ae73a[_0xa54d('0x2')](_0x48583a,_0x11b832);};}function removeListener(_0x55f2ca,_0x5b9590){return function(){SmsMessageEvents[_0xa54d('0x3')](_0x55f2ca,_0x5b9590);};}exports[_0xa54d('0x4')]=function(_0x25f7dd){for(var _0xc7bfc8=0x0,_0x586f0a=events[_0xa54d('0x5')];_0xc7bfc8<_0x586f0a;_0xc7bfc8++){var _0x5b9456=events[_0xc7bfc8];var _0x3ab2a8=createListener('smsMessage:'+_0x5b9456,_0x25f7dd);SmsMessageEvents['on'](_0x5b9456,_0x3ab2a8);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 8fd8121..a3ddf49 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 _0xfc95=['/describe','show','/:id/members','getMembers','getTeams','/:id/users','post','create','/:id/teams','addTeams','addAgents','put','/:id','delete','removeTeams','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','./smsQueue.controller','get','isAuthenticated','index'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xfc95,0x196));var _0x5fc9=function(_0x2d4421,_0x15a84f){_0x2d4421=_0x2d4421-0x0;var _0x2d3b01=_0xfc95[_0x2d4421];return _0x2d3b01;};'use strict';var multer=require('multer');var util=require(_0x5fc9('0x0'));var path=require(_0x5fc9('0x1'));var timeout=require(_0x5fc9('0x2'));var express=require('express');var router=express[_0x5fc9('0x3')]();var fs_extra=require(_0x5fc9('0x4'));var auth=require(_0x5fc9('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5fc9('0x6'));router[_0x5fc9('0x7')]('/',auth[_0x5fc9('0x8')](),controller[_0x5fc9('0x9')]);router['get'](_0x5fc9('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x5fc9('0x7')]('/:id',auth[_0x5fc9('0x8')](),controller[_0x5fc9('0xb')]);router['get'](_0x5fc9('0xc'),auth['isAuthenticated'](),controller[_0x5fc9('0xd')]);router[_0x5fc9('0x7')]('/:id/teams',auth[_0x5fc9('0x8')](),controller[_0x5fc9('0xe')]);router[_0x5fc9('0x7')](_0x5fc9('0xf'),auth['isAuthenticated'](),controller['getAgents']);router[_0x5fc9('0x10')]('/',auth[_0x5fc9('0x8')](),controller[_0x5fc9('0x11')]);router['post'](_0x5fc9('0x12'),auth[_0x5fc9('0x8')](),controller[_0x5fc9('0x13')]);router[_0x5fc9('0x10')](_0x5fc9('0xf'),auth[_0x5fc9('0x8')](),controller[_0x5fc9('0x14')]);router[_0x5fc9('0x15')](_0x5fc9('0x16'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x5fc9('0x16'),auth[_0x5fc9('0x8')](),controller['destroy']);router[_0x5fc9('0x17')](_0x5fc9('0x12'),auth[_0x5fc9('0x8')](),controller[_0x5fc9('0x18')]);router[_0x5fc9('0x17')]('/:id/users',auth[_0x5fc9('0x8')](),controller['removeAgents']);module[_0x5fc9('0x19')]=router; \ No newline at end of file +var _0x92b9=['isAuthenticated','/describe','describe','/:id','show','/:id/members','getMembers','getTeams','getAgents','post','create','/:id/teams','addTeams','/:id/users','addAgents','put','update','delete','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./smsQueue.controller','get'];(function(_0x3aef1e,_0x2da550){var _0xdef669=function(_0xd937d){while(--_0xd937d){_0x3aef1e['push'](_0x3aef1e['shift']());}};_0xdef669(++_0x2da550);}(_0x92b9,0x14b));var _0x992b=function(_0x5b77ae,_0x1a62fd){_0x5b77ae=_0x5b77ae-0x0;var _0x1b2c49=_0x92b9[_0x5b77ae];return _0x1b2c49;};'use strict';var multer=require(_0x992b('0x0'));var util=require(_0x992b('0x1'));var path=require(_0x992b('0x2'));var timeout=require(_0x992b('0x3'));var express=require(_0x992b('0x4'));var router=express['Router']();var fs_extra=require(_0x992b('0x5'));var auth=require(_0x992b('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x992b('0x7'));var controller=require(_0x992b('0x8'));router[_0x992b('0x9')]('/',auth[_0x992b('0xa')](),controller['index']);router['get'](_0x992b('0xb'),auth[_0x992b('0xa')](),controller[_0x992b('0xc')]);router[_0x992b('0x9')](_0x992b('0xd'),auth['isAuthenticated'](),controller[_0x992b('0xe')]);router[_0x992b('0x9')](_0x992b('0xf'),auth[_0x992b('0xa')](),controller[_0x992b('0x10')]);router['get']('/:id/teams',auth[_0x992b('0xa')](),controller[_0x992b('0x11')]);router['get']('/:id/users',auth[_0x992b('0xa')](),controller[_0x992b('0x12')]);router[_0x992b('0x13')]('/',auth[_0x992b('0xa')](),controller[_0x992b('0x14')]);router[_0x992b('0x13')](_0x992b('0x15'),auth[_0x992b('0xa')](),controller[_0x992b('0x16')]);router['post'](_0x992b('0x17'),auth[_0x992b('0xa')](),controller[_0x992b('0x18')]);router[_0x992b('0x19')](_0x992b('0xd'),auth[_0x992b('0xa')](),controller[_0x992b('0x1a')]);router['delete']('/:id',auth[_0x992b('0xa')](),controller['destroy']);router[_0x992b('0x1b')](_0x992b('0x15'),auth[_0x992b('0xa')](),controller[_0x992b('0x1c')]);router[_0x992b('0x1b')](_0x992b('0x17'),auth[_0x992b('0xa')](),controller[_0x992b('0x1d')]);module[_0x992b('0x1e')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 52ee7fa..72e7e62 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 _0x7114=['STRING','name','INTEGER','ENUM','beepall','roundrobin','sequelize'];(function(_0x4641dd,_0x5d68b3){var _0x34b092=function(_0x486d30){while(--_0x486d30){_0x4641dd['push'](_0x4641dd['shift']());}};_0x34b092(++_0x5d68b3);}(_0x7114,0x148));var _0x4711=function(_0x50e85d,_0x42e4dc){_0x50e85d=_0x50e85d-0x0;var _0x384dc6=_0x7114[_0x50e85d];return _0x384dc6;};'use strict';var Sequelize=require(_0x4711('0x0'));module['exports']={'name':{'type':Sequelize[_0x4711('0x1')],'unique':_0x4711('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x4711('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x4711('0x4')]('rrmemory',_0x4711('0x5'),_0x4711('0x6'))}}; \ No newline at end of file +var _0x7e38=['rrmemory','beepall','roundrobin','exports','name','STRING','INTEGER'];(function(_0x347826,_0x57f63c){var _0x1696de=function(_0x257081){while(--_0x257081){_0x347826['push'](_0x347826['shift']());}};_0x1696de(++_0x57f63c);}(_0x7e38,0xe3));var _0x87e3=function(_0x470ea4,_0x76804f){_0x470ea4=_0x470ea4-0x0;var _0x9c7b1a=_0x7e38[_0x470ea4];return _0x9c7b1a;};'use strict';var Sequelize=require('sequelize');module[_0x87e3('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x87e3('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x87e3('0x2')]},'timeout':{'type':Sequelize[_0x87e3('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x87e3('0x4'),_0x87e3('0x5'),_0x87e3('0x6'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index d4c12c6..fa2149b 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 _0xdb28=['userSmsQueue:save','removeTeams','select','field','from','team_has_sms_queues','join','SmsQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','QueryTypes','TeamId','includes','all','union','value','isEmpty','removeAgents','forEach','addAgents','omit','spread','userSmsQueue:remove','getAgents','bluebird','util','lodash','squel','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','./smsQueue.socket','register','sendStatus','end','status','json','offset','undefined','count','limit','Content-Range','update','then','get','SmsQueues','destroy','error','stack','name','map','SmsQueue','fieldName','type','key','where','include','rows','show','keys','query','filters','intersection','model','attributes','fields','length','includeAll','merge','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','catch','body','params','describe','getMembers','findOne','UserSmsQueue','rawAttributes','hasOwnProperty','nolimit','order','sort','SmsQueueId','filter','findAll','User','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','format','%s/%s','getTeams','Team','pick','ids','Agents','online','voicePause','interface','sequelize','transaction','addTeams','each','emit'];(function(_0x2c18e7,_0x3f8c4c){var _0x14dba0=function(_0x41b193){while(--_0x41b193){_0x2c18e7['push'](_0x2c18e7['shift']());}};_0x14dba0(++_0x3f8c4c);}(_0xdb28,0x106));var _0x8db2=function(_0x1ef790,_0x209c7d){_0x1ef790=_0x1ef790-0x0;var _0x29d467=_0xdb28[_0x1ef790];return _0x29d467;};'use strict';var BPromise=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var _=require(_0x8db2('0x2'));var squel=require(_0x8db2('0x3'));var Redis=require('ioredis');var qs=require(_0x8db2('0x4'));var logger=require(_0x8db2('0x5'))(_0x8db2('0x6'));var config=require(_0x8db2('0x7'));var db=require(_0x8db2('0x8'))['db'];config['redis']=_[_0x8db2('0x9')](config[_0x8db2('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8db2('0xa')]));require(_0x8db2('0xb'))[_0x8db2('0xc')](socket);function respondWithStatusCode(_0x29f698,_0x2f3f2f){_0x2f3f2f=_0x2f3f2f||0xcc;return function(_0x1ff362){if(_0x1ff362){return _0x29f698[_0x8db2('0xd')](_0x2f3f2f);}return _0x29f698['status'](_0x2f3f2f)[_0x8db2('0xe')]();};}function respondWithResult(_0x476216,_0x1f62af){_0x1f62af=_0x1f62af||0xc8;return function(_0x57015f){if(_0x57015f){return _0x476216[_0x8db2('0xf')](_0x1f62af)[_0x8db2('0x10')](_0x57015f);}};}function respondWithFilteredResult(_0x576475,_0x41beda){return function(_0x3b2faa){if(_0x3b2faa){var _0x1349f6=typeof _0x41beda[_0x8db2('0x11')]===_0x8db2('0x12')&&typeof _0x41beda['limit']==='undefined';var _0x15070d=_0x3b2faa[_0x8db2('0x13')];var _0x350d61=_0x1349f6?0x0:_0x41beda[_0x8db2('0x11')];var _0x227355=_0x1349f6?_0x3b2faa[_0x8db2('0x13')]:_0x41beda[_0x8db2('0x11')]+_0x41beda[_0x8db2('0x14')];var _0x131252;if(_0x227355>=_0x15070d){_0x227355=_0x15070d;_0x131252=0xc8;}else{_0x131252=0xce;}_0x576475[_0x8db2('0xf')](_0x131252);return _0x576475['set'](_0x8db2('0x15'),_0x350d61+'-'+_0x227355+'/'+_0x15070d)[_0x8db2('0x10')](_0x3b2faa);}return null;};}function saveUpdates(_0x48101e){return function(_0x2b3f73){if(_0x2b3f73){return _0x2b3f73[_0x8db2('0x16')](_0x48101e)[_0x8db2('0x17')](function(_0x3fddc2){return _0x3fddc2;});}return null;};}function removeEntity(_0x2efd06){return function(_0x46ce14){if(_0x46ce14){return _0x46ce14['destroy']()['then'](function(){var _0x77789=_0x46ce14[_0x8db2('0x18')]({'plain':!![]});var _0x1310d3=_0x8db2('0x19');return db['UserProfileResource'][_0x8db2('0x1a')]({'where':{'type':_0x1310d3,'resourceId':_0x77789['id']}})[_0x8db2('0x17')](function(){return _0x46ce14;});})[_0x8db2('0x17')](function(){_0x2efd06[_0x8db2('0xf')](0xcc)[_0x8db2('0xe')]();});}};}function handleEntityNotFound(_0x597260){return function(_0x124467){if(!_0x124467){_0x597260[_0x8db2('0xd')](0x194);}return _0x124467;};}function handleError(_0x18f69c,_0x125be2){_0x125be2=_0x125be2||0x1f4;return function(_0x2260d8){logger[_0x8db2('0x1b')](_0x2260d8[_0x8db2('0x1c')]);if(_0x2260d8['name']){delete _0x2260d8[_0x8db2('0x1d')];}_0x18f69c['status'](_0x125be2)['send'](_0x2260d8);};}exports['index']=function(_0x4d923c,_0xec8cd2){var _0x29b5cd={};var _0x3be281={'count':0x0,'rows':[]};var _0x2baed0=_[_0x8db2('0x1e')](db[_0x8db2('0x1f')]['rawAttributes'],function(_0x3544ba){return{'name':_0x3544ba[_0x8db2('0x20')],'type':_0x3544ba[_0x8db2('0x21')][_0x8db2('0x22')]};});_0x29b5cd=qs['getOptions'](_0x2baed0,_0x4d923c);var _0x2e0691={'where':_0x29b5cd[_0x8db2('0x23')]};return db[_0x8db2('0x1f')][_0x8db2('0x13')](_0x2e0691)[_0x8db2('0x17')](function(_0x21bae5){_0x3be281[_0x8db2('0x13')]=_0x21bae5;_0x29b5cd[_0x8db2('0x24')]=qs[_0x8db2('0x24')](_0x4d923c['query']);return db[_0x8db2('0x1f')]['findAll'](_0x29b5cd);})['then'](function(_0x302188){_0x3be281[_0x8db2('0x25')]=_0x302188;return _0x3be281;})[_0x8db2('0x17')](respondWithFilteredResult(_0xec8cd2,_0x29b5cd))['catch'](handleError(_0xec8cd2,null));};exports[_0x8db2('0x26')]=function(_0x56b71a,_0x3f7aac){var _0x2b653b={'raw':!![],'where':{'id':_0x56b71a['params']['id']}},_0x14bd12={};_0x14bd12['model']=_[_0x8db2('0x27')](db[_0x8db2('0x1f')]['rawAttributes']);_0x14bd12['query']=_[_0x8db2('0x27')](_0x56b71a[_0x8db2('0x28')]);_0x14bd12[_0x8db2('0x29')]=_[_0x8db2('0x2a')](_0x14bd12[_0x8db2('0x2b')],_0x14bd12[_0x8db2('0x28')]);_0x2b653b[_0x8db2('0x2c')]=_[_0x8db2('0x2a')](_0x14bd12[_0x8db2('0x2b')],qs[_0x8db2('0x2d')](_0x56b71a['query'][_0x8db2('0x2d')]));_0x2b653b[_0x8db2('0x2c')]=_0x2b653b['attributes'][_0x8db2('0x2e')]?_0x2b653b[_0x8db2('0x2c')]:_0x14bd12['model'];if(_0x56b71a['query'][_0x8db2('0x2f')]){_0x2b653b['include']=[{'all':!![]}];}_0x2b653b=_[_0x8db2('0x30')]({},_0x2b653b,_0x56b71a[_0x8db2('0x31')]);return db[_0x8db2('0x1f')][_0x8db2('0x32')](_0x2b653b)['then'](handleEntityNotFound(_0x3f7aac,null))[_0x8db2('0x17')](respondWithResult(_0x3f7aac,null))['catch'](handleError(_0x3f7aac,null));};exports[_0x8db2('0x33')]=function(_0xd550ae,_0x2c8bc9){return db[_0x8db2('0x1f')]['create'](_0xd550ae['body'],{})[_0x8db2('0x17')](function(_0x2c0507){var _0x5dc2b4=_0xd550ae[_0x8db2('0x34')][_0x8db2('0x18')]({'plain':!![]});if(!_0x5dc2b4)throw new Error(_0x8db2('0x35'));if(_0x5dc2b4['role']===_0x8db2('0x34')){var _0x149186=_0x2c0507[_0x8db2('0x18')]({'plain':!![]});var _0x279e74=_0x8db2('0x19');return db[_0x8db2('0x36')][_0x8db2('0x32')]({'where':{'name':_0x279e74,'userProfileId':_0x5dc2b4[_0x8db2('0x37')]},'raw':!![]})[_0x8db2('0x17')](function(_0x63c561){if(_0x63c561&&_0x63c561[_0x8db2('0x38')]===0x0){return db[_0x8db2('0x39')][_0x8db2('0x33')]({'name':_0x149186['name'],'resourceId':_0x149186['id'],'type':_0x63c561[_0x8db2('0x1d')],'sectionId':_0x63c561['id']},{})[_0x8db2('0x17')](function(){return _0x2c0507;});}else{return _0x2c0507;}})['catch'](function(_0x49a7ae){logger[_0x8db2('0x1b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x49a7ae);throw _0x49a7ae;});}return _0x2c0507;})[_0x8db2('0x17')](respondWithResult(_0x2c8bc9,0xc9))[_0x8db2('0x3a')](handleError(_0x2c8bc9,null));};exports[_0x8db2('0x16')]=function(_0x307783,_0xb4fe2c){if(_0x307783[_0x8db2('0x3b')]['id']){delete _0x307783[_0x8db2('0x3b')]['id'];}return db['SmsQueue'][_0x8db2('0x32')]({'where':{'id':_0x307783[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0xb4fe2c,null))[_0x8db2('0x17')](saveUpdates(_0x307783['body'],null))[_0x8db2('0x17')](respondWithResult(_0xb4fe2c,null))[_0x8db2('0x3a')](handleError(_0xb4fe2c,null));};exports[_0x8db2('0x1a')]=function(_0x2c47cc,_0x5427af){return db[_0x8db2('0x1f')]['find']({'where':{'id':_0x2c47cc[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0x5427af,null))[_0x8db2('0x17')](removeEntity(_0x5427af,null))['catch'](handleError(_0x5427af,null));};exports['describe']=function(_0x1ec3d0,_0x47c556){return db[_0x8db2('0x1f')][_0x8db2('0x3d')]()[_0x8db2('0x17')](respondWithResult(_0x47c556,null))[_0x8db2('0x3a')](handleError(_0x47c556,null));};exports[_0x8db2('0x3e')]=function(_0x40c6e6,_0x4355e2){var _0xab6bdd={'raw':!![],'where':{}},_0x4291e3={},_0x12a1ef;return db[_0x8db2('0x1f')][_0x8db2('0x3f')]({'where':{'id':_0x40c6e6['params']['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0x4355e2,null))[_0x8db2('0x17')](function(_0xdbba64){if(_0xdbba64){_0x12a1ef=_0xdbba64[_0x8db2('0x18')]({'plain':!![]});_0x4291e3['model']=_['keys'](db[_0x8db2('0x40')][_0x8db2('0x41')]);_0x4291e3[_0x8db2('0x28')]=_['keys'](_0x40c6e6['query']);_0x4291e3['filters']=_[_0x8db2('0x2a')](_0x4291e3[_0x8db2('0x2b')],_0x4291e3[_0x8db2('0x28')]);_0xab6bdd[_0x8db2('0x2c')]=_[_0x8db2('0x2a')](_0x4291e3[_0x8db2('0x2b')],qs[_0x8db2('0x2d')](_0x40c6e6['query']['fields']));_0xab6bdd[_0x8db2('0x2c')]=_0xab6bdd[_0x8db2('0x2c')][_0x8db2('0x2e')]?_0xab6bdd[_0x8db2('0x2c')]:_0x4291e3[_0x8db2('0x2b')];if(!_0x40c6e6[_0x8db2('0x28')][_0x8db2('0x42')](_0x8db2('0x43'))){_0xab6bdd[_0x8db2('0x14')]=qs[_0x8db2('0x14')](_0x40c6e6[_0x8db2('0x28')][_0x8db2('0x14')]);_0xab6bdd[_0x8db2('0x11')]=qs[_0x8db2('0x11')](_0x40c6e6[_0x8db2('0x28')]['offset']);}_0xab6bdd[_0x8db2('0x44')]=qs[_0x8db2('0x45')](_0x40c6e6['query'][_0x8db2('0x45')]);_0xab6bdd[_0x8db2('0x23')]=qs[_0x8db2('0x29')](_['pick'](_0x40c6e6[_0x8db2('0x28')],_0x4291e3[_0x8db2('0x29')]));_0xab6bdd[_0x8db2('0x23')][_0x8db2('0x46')]=_0xdbba64['id'];if(_0x40c6e6[_0x8db2('0x28')]['filter']){_0xab6bdd[_0x8db2('0x23')]=_[_0x8db2('0x30')](_0xab6bdd[_0x8db2('0x23')],{'$or':_['map'](_0xab6bdd[_0x8db2('0x2c')],function(_0x18cc13){var _0x33dddd={};_0x33dddd[_0x18cc13]={'$like':'%'+_0x40c6e6[_0x8db2('0x28')][_0x8db2('0x47')]+'%'};return _0x33dddd;})});}_0xab6bdd=_[_0x8db2('0x30')]({},_0xab6bdd,_0x40c6e6[_0x8db2('0x31')]);return db['UserSmsQueue'][_0x8db2('0x48')](_0xab6bdd);}})[_0x8db2('0x17')](function(_0x4d3c19){if(_0x4d3c19){return db[_0x8db2('0x49')][_0x8db2('0x4a')]({'where':{'id':_['map'](_0x4d3c19,_0x8db2('0x4b')),'role':_0x8db2('0x4c')},'attributes':['id',_0x8db2('0x1d'),_0x8db2('0x4d'),_0x8db2('0x4e'),_0x8db2('0x4f')]});}})[_0x8db2('0x17')](function(_0x33a600){if(_0x33a600){return{'count':_0x33a600[_0x8db2('0x13')],'rows':_[_0x8db2('0x1e')](_0x33a600[_0x8db2('0x25')],function(_0x447a47){return{'membername':_0x447a47[_0x8db2('0x1d')],'UserId':_0x447a47['id'],'queue_name':_0x12a1ef[_0x8db2('0x1d')],'SmsQueueId':_0x12a1ef['id'],'interface':util[_0x8db2('0x50')](_0x8db2('0x51'),'SIP',_0x447a47[_0x8db2('0x1d')]),'penalty':0x0,'paused':_0x447a47[_0x8db2('0x4d')],'createdAt':_0x447a47[_0x8db2('0x4f')],'updatedAt':_0x447a47[_0x8db2('0x4e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x8db2('0x17')](respondWithFilteredResult(_0x4355e2,_0xab6bdd))['catch'](handleError(_0x4355e2,null));};exports[_0x8db2('0x52')]=function(_0x2c3087,_0x3ab670){var _0x1e1c0d={};var _0x2ad70f={};var _0x348da8;var _0x17341d;return db[_0x8db2('0x1f')][_0x8db2('0x3f')]({'where':{'id':_0x2c3087[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0x3ab670,null))[_0x8db2('0x17')](function(_0x170a72){if(_0x170a72){_0x348da8=_0x170a72;_0x2ad70f[_0x8db2('0x2b')]=_[_0x8db2('0x27')](db[_0x8db2('0x53')][_0x8db2('0x41')]);_0x2ad70f[_0x8db2('0x28')]=_['keys'](_0x2c3087[_0x8db2('0x28')]);_0x2ad70f['filters']=_[_0x8db2('0x2a')](_0x2ad70f['model'],_0x2ad70f[_0x8db2('0x28')]);_0x1e1c0d[_0x8db2('0x2c')]=_[_0x8db2('0x2a')](_0x2ad70f[_0x8db2('0x2b')],qs[_0x8db2('0x2d')](_0x2c3087['query']['fields']));_0x1e1c0d[_0x8db2('0x2c')]=_0x1e1c0d[_0x8db2('0x2c')][_0x8db2('0x2e')]?_0x1e1c0d[_0x8db2('0x2c')]:_0x2ad70f[_0x8db2('0x2b')];_0x1e1c0d[_0x8db2('0x44')]=qs[_0x8db2('0x45')](_0x2c3087[_0x8db2('0x28')]['sort']);_0x1e1c0d[_0x8db2('0x23')]=qs[_0x8db2('0x29')](_[_0x8db2('0x54')](_0x2c3087[_0x8db2('0x28')],_0x2ad70f[_0x8db2('0x29')]));if(_0x2c3087[_0x8db2('0x28')][_0x8db2('0x47')]){_0x1e1c0d[_0x8db2('0x23')]=_['merge'](_0x1e1c0d['where'],{'$or':_[_0x8db2('0x1e')](_0x1e1c0d[_0x8db2('0x2c')],function(_0x1d2dfc){var _0x27f4cd={};_0x27f4cd[_0x1d2dfc]={'$like':'%'+_0x2c3087[_0x8db2('0x28')]['filter']+'%'};return _0x27f4cd;})});}_0x1e1c0d=_['merge']({},_0x1e1c0d,_0x2c3087[_0x8db2('0x31')]);return _0x348da8[_0x8db2('0x52')](_0x1e1c0d);}})['then'](function(_0xa698bd){if(_0xa698bd){_0x17341d=_0xa698bd[_0x8db2('0x2e')];if(!_0x2c3087[_0x8db2('0x28')]['hasOwnProperty'](_0x8db2('0x43'))){_0x1e1c0d[_0x8db2('0x14')]=qs[_0x8db2('0x14')](_0x2c3087['query'][_0x8db2('0x14')]);_0x1e1c0d[_0x8db2('0x11')]=qs[_0x8db2('0x11')](_0x2c3087[_0x8db2('0x28')][_0x8db2('0x11')]);}return _0x348da8['getTeams'](_0x1e1c0d);}})[_0x8db2('0x17')](function(_0x3023fe){if(_0x3023fe){return _0x3023fe?{'count':_0x17341d,'rows':_0x3023fe}:null;}})[_0x8db2('0x17')](respondWithResult(_0x3ab670,null))['catch'](handleError(_0x3ab670,null));};exports['addTeams']=function(_0x2cdf3c,_0xbe05ca){var _0x487dcb=_0x2cdf3c[_0x8db2('0x3b')][_0x8db2('0x55')];return db[_0x8db2('0x53')][_0x8db2('0x48')]({'where':{'id':_0x487dcb},'attributes':['id'],'include':[{'model':db[_0x8db2('0x49')],'as':_0x8db2('0x56'),'attributes':['id',_0x8db2('0x1d'),_0x8db2('0x57'),_0x8db2('0x58'),_0x8db2('0x59')],'raw':!![]}]})[_0x8db2('0x17')](function(_0x3e1478){if(_0x3e1478){var _0x24a52d=_['flatMap'](_0x3e1478,function(_0x2ba42d){var _0x4f29f1=_0x2ba42d[_0x8db2('0x18')]({'plain':!![]});return _0x4f29f1[_0x8db2('0x56')];});return db['SmsQueue'][_0x8db2('0x32')]({'where':{'id':_0x2cdf3c[_0x8db2('0x3c')]['id']}})['then'](function(_0x2159c4){return db[_0x8db2('0x5a')][_0x8db2('0x5b')](function(_0x25a3ab){return _0x2159c4[_0x8db2('0x5c')](_0x487dcb,{'transaction':_0x25a3ab})[_0x8db2('0x17')](function(){return BPromise[_0x8db2('0x5d')](_0x24a52d,function(_0x3ac0fa){return db[_0x8db2('0x40')]['findOrCreate']({'where':{'UserId':_0x3ac0fa['id'],'SmsQueueId':_0x2cdf3c['params']['id']},'transaction':_0x25a3ab});});})[_0x8db2('0x17')](function(){_0x24a52d['forEach'](function(_0xf8afa5){socket[_0x8db2('0x5e')](_0x8db2('0x5f'),{'UserId':_0xf8afa5['id'],'SmsQueueId':_0x2159c4['id']});});});});});}})['then'](respondWithStatusCode(_0xbe05ca,null))[_0x8db2('0x3a')](handleError(_0xbe05ca,null));};exports[_0x8db2('0x60')]=function(_0x3e37e7,_0x591c5d){return db[_0x8db2('0x53')][_0x8db2('0x48')]({'where':{'id':_0x3e37e7[_0x8db2('0x28')][_0x8db2('0x55')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x8db2('0x56'),'attributes':['id'],'raw':!![]}]})[_0x8db2('0x17')](handleEntityNotFound(_0x591c5d,null))[_0x8db2('0x17')](function(_0x1edb1a){var _0xcf1c42=_[_0x8db2('0x1e')](_0x1edb1a,'id');var _0x1aadfb=[];var _0x3682bf=[];var _0x358f48=squel[_0x8db2('0x61')]();_0x358f48[_0x8db2('0x62')]('tq.TeamId')[_0x8db2('0x63')](_0x8db2('0x64'),'tq')[_0x8db2('0x65')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x8db2('0x66'),_0x3e37e7[_0x8db2('0x3c')]['id']);for(var _0x3191c8=0x0;_0x3191c8<_0x1edb1a[_0x8db2('0x2e')];_0x3191c8+=0x1){let _0x2ad024=_0x1edb1a[_0x3191c8];for(var _0x313918=0x0;_0x313918<_0x2ad024[_0x8db2('0x56')][_0x8db2('0x2e')];_0x313918+=0x1){let _0x3b1929=_0x2ad024[_0x8db2('0x56')][_0x313918];var _0x46eb80=_0x358f48['clone']();_0x46eb80[_0x8db2('0x23')](_0x8db2('0x67'),_0x3b1929['id']);_0x3682bf[_0x8db2('0x68')](db[_0x8db2('0x5a')]['query'](_0x46eb80['toString'](),{'type':db[_0x8db2('0x5a')][_0x8db2('0x69')]['SELECT']})[_0x8db2('0x17')](function(_0x121f31){if(_0x121f31[_0x8db2('0x2e')]===0x1){return _0x3b1929['id'];}else{var _0x5f2ece=_['every'](_['map'](_0x121f31,_0x8db2('0x6a')),function(_0x18b4a6){return _[_0x8db2('0x6b')](_0xcf1c42,_0x18b4a6);});if(_0x5f2ece){return _0x3b1929['id'];}}}));}}return BPromise[_0x8db2('0x6c')](_0x3682bf)[_0x8db2('0x17')](function(_0x4e8aac){_0x1aadfb=_(_0x1aadfb)[_0x8db2('0x6d')](_0x4e8aac)['compact']()[_0x8db2('0x6e')]();return db[_0x8db2('0x1f')][_0x8db2('0x32')]({'where':{'id':_0x3e37e7[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](function(_0x5d5380){return db['sequelize'][_0x8db2('0x5b')](function(_0x51afcf){return _0x5d5380[_0x8db2('0x60')](_0x3e37e7[_0x8db2('0x28')][_0x8db2('0x55')],{'transaction':_0x51afcf})[_0x8db2('0x17')](function(){if(!_[_0x8db2('0x6f')](_0x1aadfb)){return _0x5d5380[_0x8db2('0x70')](_0x1aadfb,{'transaction':_0x51afcf});}})['then'](function(){_0x1aadfb[_0x8db2('0x71')](function(_0x222ea2){socket[_0x8db2('0x5e')]('userSmsQueue:remove',{'UserId':_0x222ea2,'SmsQueueId':_0x5d5380['id']});});});});});});})[_0x8db2('0x17')](respondWithStatusCode(_0x591c5d,null))[_0x8db2('0x3a')](handleError(_0x591c5d,null));};exports['addAgents']=function(_0x2d7abf,_0x7cb97d){return db[_0x8db2('0x1f')][_0x8db2('0x32')]({'where':{'id':_0x2d7abf[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0x7cb97d,null))[_0x8db2('0x17')](function(_0x19e25b){if(_0x19e25b){return _0x19e25b[_0x8db2('0x72')](_0x2d7abf['body'][_0x8db2('0x55')],_[_0x8db2('0x73')](_0x2d7abf[_0x8db2('0x3b')],[_0x8db2('0x55'),'id'])||{})[_0x8db2('0x74')](function(_0x345ff9){for(var _0x16d1c5=0x0;_0x16d1c5<_0x2d7abf[_0x8db2('0x3b')][_0x8db2('0x55')][_0x8db2('0x2e')];_0x16d1c5+=0x1){socket['emit'](_0x8db2('0x5f'),{'UserId':Number(_0x2d7abf[_0x8db2('0x3b')][_0x8db2('0x55')][_0x16d1c5]),'SmsQueueId':Number(_0x2d7abf[_0x8db2('0x3c')]['id'])});}return _0x345ff9;});}})['then'](respondWithResult(_0x7cb97d,null))[_0x8db2('0x3a')](handleError(_0x7cb97d,null));};exports[_0x8db2('0x70')]=function(_0x46476e,_0x4f653e){return db['SmsQueue'][_0x8db2('0x32')]({'where':{'id':_0x46476e[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0x4f653e,null))[_0x8db2('0x17')](function(_0x4f9ce4){if(_0x4f9ce4){return _0x4f9ce4[_0x8db2('0x70')](_0x46476e[_0x8db2('0x28')][_0x8db2('0x55')])[_0x8db2('0x17')](function(){if(_['isArray'](_0x46476e[_0x8db2('0x28')][_0x8db2('0x55')])){for(var _0x3e7b24=0x0;_0x3e7b24<_0x46476e['query']['ids']['length'];_0x3e7b24+=0x1){socket[_0x8db2('0x5e')](_0x8db2('0x75'),{'UserId':Number(_0x46476e[_0x8db2('0x28')][_0x8db2('0x55')][_0x3e7b24]),'SmsQueueId':Number(_0x46476e['params']['id'])});}}else{socket['emit'](_0x8db2('0x75'),{'UserId':Number(_0x46476e[_0x8db2('0x28')][_0x8db2('0x55')]),'SmsQueueId':Number(_0x46476e[_0x8db2('0x3c')]['id'])});}});}})[_0x8db2('0x17')](respondWithStatusCode(_0x4f653e,null))[_0x8db2('0x3a')](handleError(_0x4f653e,null));};exports['getAgents']=function(_0x2942eb,_0x5f32ce){var _0x432780={};var _0x23457b={};var _0x1ef898;var _0x39f2d3;return db[_0x8db2('0x1f')]['findOne']({'where':{'id':_0x2942eb[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0x5f32ce,null))['then'](function(_0x28beec){if(_0x28beec){_0x1ef898=_0x28beec;_0x23457b[_0x8db2('0x2b')]=_[_0x8db2('0x27')](db[_0x8db2('0x49')]['rawAttributes']);_0x23457b[_0x8db2('0x28')]=_['keys'](_0x2942eb['query']);_0x23457b[_0x8db2('0x29')]=_[_0x8db2('0x2a')](_0x23457b[_0x8db2('0x2b')],_0x23457b[_0x8db2('0x28')]);_0x432780[_0x8db2('0x2c')]=_[_0x8db2('0x2a')](_0x23457b[_0x8db2('0x2b')],qs['fields'](_0x2942eb[_0x8db2('0x28')]['fields']));_0x432780['attributes']=_0x432780[_0x8db2('0x2c')]['length']?_0x432780['attributes']:_0x23457b[_0x8db2('0x2b')];_0x432780[_0x8db2('0x44')]=qs[_0x8db2('0x45')](_0x2942eb['query'][_0x8db2('0x45')]);_0x432780[_0x8db2('0x23')]=qs[_0x8db2('0x29')](_['pick'](_0x2942eb[_0x8db2('0x28')],_0x23457b[_0x8db2('0x29')]));if(_0x2942eb[_0x8db2('0x28')][_0x8db2('0x47')]){_0x432780[_0x8db2('0x23')]=_[_0x8db2('0x30')](_0x432780[_0x8db2('0x23')],{'$or':_[_0x8db2('0x1e')](_0x432780['attributes'],function(_0xa7b208){var _0x3cb456={};_0x3cb456[_0xa7b208]={'$like':'%'+_0x2942eb[_0x8db2('0x28')][_0x8db2('0x47')]+'%'};return _0x3cb456;})});}_0x432780=_[_0x8db2('0x30')]({},_0x432780,_0x2942eb[_0x8db2('0x31')]);return _0x1ef898[_0x8db2('0x76')](_0x432780);}})[_0x8db2('0x17')](function(_0x3a53e2){if(_0x3a53e2){_0x39f2d3=_0x3a53e2[_0x8db2('0x2e')];if(!_0x2942eb[_0x8db2('0x28')]['hasOwnProperty'](_0x8db2('0x43'))){_0x432780[_0x8db2('0x14')]=qs[_0x8db2('0x14')](_0x2942eb['query'][_0x8db2('0x14')]);_0x432780[_0x8db2('0x11')]=qs[_0x8db2('0x11')](_0x2942eb['query']['offset']);}return _0x1ef898[_0x8db2('0x76')](_0x432780);}})[_0x8db2('0x17')](function(_0x296966){if(_0x296966){return _0x296966?{'count':_0x39f2d3,'rows':_0x296966}:null;}})[_0x8db2('0x17')](respondWithResult(_0x5f32ce,null))[_0x8db2('0x3a')](handleError(_0x5f32ce,null));}; \ No newline at end of file +var _0x0b0e=['userSmsQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_sms_queues','join','clone','ut.UserId\x20=\x20?','push','QueryTypes','every','TeamId','union','value','removeAgents','forEach','userSmsQueue:remove','addAgents','omit','spread','isArray','getAgents','hasOwnProperty','bluebird','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','end','json','offset','undefined','limit','count','set','update','SmsQueues','destroy','then','error','stack','name','send','SmsQueue','fieldName','type','key','getOptions','include','query','findAll','rows','show','model','keys','rawAttributes','filters','intersection','attributes','fields','length','includeAll','merge','options','find','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','create','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','params','nolimit','order','sort','where','SmsQueueId','filter','map','UserSmsQueue','User','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','%s/%s','SIP','findOne','Team','pick','getTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','emit'];(function(_0x1b349a,_0x22222c){var _0x5d1f7c=function(_0x368d7c){while(--_0x368d7c){_0x1b349a['push'](_0x1b349a['shift']());}};_0x5d1f7c(++_0x22222c);}(_0x0b0e,0x187));var _0xe0b0=function(_0x55e1d1,_0x3c9376){_0x55e1d1=_0x55e1d1-0x0;var _0x1165db=_0x0b0e[_0x55e1d1];return _0x1165db;};'use strict';var BPromise=require(_0xe0b0('0x0'));var util=require('util');var _=require(_0xe0b0('0x1'));var squel=require('squel');var Redis=require(_0xe0b0('0x2'));var qs=require(_0xe0b0('0x3'));var logger=require(_0xe0b0('0x4'))(_0xe0b0('0x5'));var config=require(_0xe0b0('0x6'));var db=require(_0xe0b0('0x7'))['db'];config[_0xe0b0('0x8')]=_[_0xe0b0('0x9')](config[_0xe0b0('0x8')],{'host':_0xe0b0('0xa'),'port':0x18eb});var socket=require(_0xe0b0('0xb'))(new Redis(config['redis']));require('./smsQueue.socket')[_0xe0b0('0xc')](socket);function respondWithStatusCode(_0x435060,_0xc4a085){_0xc4a085=_0xc4a085||0xcc;return function(_0x2ac27e){if(_0x2ac27e){return _0x435060['sendStatus'](_0xc4a085);}return _0x435060[_0xe0b0('0xd')](_0xc4a085)[_0xe0b0('0xe')]();};}function respondWithResult(_0x553d4f,_0x1fef28){_0x1fef28=_0x1fef28||0xc8;return function(_0x2f32b6){if(_0x2f32b6){return _0x553d4f['status'](_0x1fef28)[_0xe0b0('0xf')](_0x2f32b6);}};}function respondWithFilteredResult(_0x2cdad2,_0x39b1c2){return function(_0x585615){if(_0x585615){var _0x3068c0=typeof _0x39b1c2[_0xe0b0('0x10')]===_0xe0b0('0x11')&&typeof _0x39b1c2[_0xe0b0('0x12')]===_0xe0b0('0x11');var _0x4d2bf7=_0x585615[_0xe0b0('0x13')];var _0x154de6=_0x3068c0?0x0:_0x39b1c2[_0xe0b0('0x10')];var _0x24babd=_0x3068c0?_0x585615[_0xe0b0('0x13')]:_0x39b1c2['offset']+_0x39b1c2[_0xe0b0('0x12')];var _0x5adb01;if(_0x24babd>=_0x4d2bf7){_0x24babd=_0x4d2bf7;_0x5adb01=0xc8;}else{_0x5adb01=0xce;}_0x2cdad2[_0xe0b0('0xd')](_0x5adb01);return _0x2cdad2[_0xe0b0('0x14')]('Content-Range',_0x154de6+'-'+_0x24babd+'/'+_0x4d2bf7)[_0xe0b0('0xf')](_0x585615);}return null;};}function saveUpdates(_0x4a4cc0){return function(_0x2d6fb6){if(_0x2d6fb6){return _0x2d6fb6[_0xe0b0('0x15')](_0x4a4cc0)['then'](function(_0x54a3eb){return _0x54a3eb;});}return null;};}function removeEntity(_0x46bb44){return function(_0x50a441){if(_0x50a441){return _0x50a441['destroy']()['then'](function(){var _0x1920ee=_0x50a441['get']({'plain':!![]});var _0x52598b=_0xe0b0('0x16');return db['UserProfileResource'][_0xe0b0('0x17')]({'where':{'type':_0x52598b,'resourceId':_0x1920ee['id']}})['then'](function(){return _0x50a441;});})[_0xe0b0('0x18')](function(){_0x46bb44[_0xe0b0('0xd')](0xcc)[_0xe0b0('0xe')]();});}};}function handleEntityNotFound(_0x310a6d){return function(_0x2cf6a1){if(!_0x2cf6a1){_0x310a6d['sendStatus'](0x194);}return _0x2cf6a1;};}function handleError(_0x4cae54,_0x2fa820){_0x2fa820=_0x2fa820||0x1f4;return function(_0x5512bb){logger[_0xe0b0('0x19')](_0x5512bb[_0xe0b0('0x1a')]);if(_0x5512bb['name']){delete _0x5512bb[_0xe0b0('0x1b')];}_0x4cae54['status'](_0x2fa820)[_0xe0b0('0x1c')](_0x5512bb);};}exports['index']=function(_0x28586d,_0x576352){var _0x3e5c88={};var _0x4de537={'count':0x0,'rows':[]};var _0x4700cc=_['map'](db[_0xe0b0('0x1d')]['rawAttributes'],function(_0x362aba){return{'name':_0x362aba[_0xe0b0('0x1e')],'type':_0x362aba[_0xe0b0('0x1f')][_0xe0b0('0x20')]};});_0x3e5c88=qs[_0xe0b0('0x21')](_0x4700cc,_0x28586d);var _0x10745d={'where':_0x3e5c88['where']};return db[_0xe0b0('0x1d')][_0xe0b0('0x13')](_0x10745d)['then'](function(_0x15e13b){_0x4de537[_0xe0b0('0x13')]=_0x15e13b;_0x3e5c88[_0xe0b0('0x22')]=qs[_0xe0b0('0x22')](_0x28586d[_0xe0b0('0x23')]);return db[_0xe0b0('0x1d')][_0xe0b0('0x24')](_0x3e5c88);})['then'](function(_0x1854b8){_0x4de537[_0xe0b0('0x25')]=_0x1854b8;return _0x4de537;})['then'](respondWithFilteredResult(_0x576352,_0x3e5c88))['catch'](handleError(_0x576352,null));};exports[_0xe0b0('0x26')]=function(_0x33e672,_0x422575){var _0x3f81d5={'raw':!![],'where':{'id':_0x33e672['params']['id']}},_0x2ab1b1={};_0x2ab1b1[_0xe0b0('0x27')]=_[_0xe0b0('0x28')](db[_0xe0b0('0x1d')][_0xe0b0('0x29')]);_0x2ab1b1[_0xe0b0('0x23')]=_['keys'](_0x33e672[_0xe0b0('0x23')]);_0x2ab1b1[_0xe0b0('0x2a')]=_[_0xe0b0('0x2b')](_0x2ab1b1[_0xe0b0('0x27')],_0x2ab1b1[_0xe0b0('0x23')]);_0x3f81d5[_0xe0b0('0x2c')]=_[_0xe0b0('0x2b')](_0x2ab1b1[_0xe0b0('0x27')],qs[_0xe0b0('0x2d')](_0x33e672[_0xe0b0('0x23')][_0xe0b0('0x2d')]));_0x3f81d5[_0xe0b0('0x2c')]=_0x3f81d5[_0xe0b0('0x2c')][_0xe0b0('0x2e')]?_0x3f81d5[_0xe0b0('0x2c')]:_0x2ab1b1['model'];if(_0x33e672[_0xe0b0('0x23')][_0xe0b0('0x2f')]){_0x3f81d5[_0xe0b0('0x22')]=[{'all':!![]}];}_0x3f81d5=_[_0xe0b0('0x30')]({},_0x3f81d5,_0x33e672[_0xe0b0('0x31')]);return db[_0xe0b0('0x1d')][_0xe0b0('0x32')](_0x3f81d5)['then'](handleEntityNotFound(_0x422575,null))['then'](respondWithResult(_0x422575,null))['catch'](handleError(_0x422575,null));};exports['create']=function(_0x26137c,_0xc3d967){return db[_0xe0b0('0x1d')]['create'](_0x26137c[_0xe0b0('0x33')],{})[_0xe0b0('0x18')](function(_0x1cd705){var _0x297c64=_0x26137c['user'][_0xe0b0('0x34')]({'plain':!![]});if(!_0x297c64)throw new Error(_0xe0b0('0x35'));if(_0x297c64[_0xe0b0('0x36')]===_0xe0b0('0x37')){var _0x4265e3=_0x1cd705[_0xe0b0('0x34')]({'plain':!![]});var _0x8b745=_0xe0b0('0x16');return db[_0xe0b0('0x38')]['find']({'where':{'name':_0x8b745,'userProfileId':_0x297c64[_0xe0b0('0x39')]},'raw':!![]})['then'](function(_0x34178d){if(_0x34178d&&_0x34178d[_0xe0b0('0x3a')]===0x0){return db[_0xe0b0('0x3b')][_0xe0b0('0x3c')]({'name':_0x4265e3['name'],'resourceId':_0x4265e3['id'],'type':_0x34178d[_0xe0b0('0x1b')],'sectionId':_0x34178d['id']},{})[_0xe0b0('0x18')](function(){return _0x1cd705;});}else{return _0x1cd705;}})[_0xe0b0('0x3d')](function(_0x402a0e){logger[_0xe0b0('0x19')](_0xe0b0('0x3e'),_0x402a0e);throw _0x402a0e;});}return _0x1cd705;})[_0xe0b0('0x18')](respondWithResult(_0xc3d967,0xc9))[_0xe0b0('0x3d')](handleError(_0xc3d967,null));};exports['update']=function(_0x2aad80,_0x309bbf){if(_0x2aad80['body']['id']){delete _0x2aad80['body']['id'];}return db[_0xe0b0('0x1d')][_0xe0b0('0x32')]({'where':{'id':_0x2aad80['params']['id']}})[_0xe0b0('0x18')](handleEntityNotFound(_0x309bbf,null))[_0xe0b0('0x18')](saveUpdates(_0x2aad80[_0xe0b0('0x33')],null))[_0xe0b0('0x18')](respondWithResult(_0x309bbf,null))[_0xe0b0('0x3d')](handleError(_0x309bbf,null));};exports['destroy']=function(_0x5d2fa2,_0x51c580){return db[_0xe0b0('0x1d')][_0xe0b0('0x32')]({'where':{'id':_0x5d2fa2['params']['id']}})[_0xe0b0('0x18')](handleEntityNotFound(_0x51c580,null))[_0xe0b0('0x18')](removeEntity(_0x51c580,null))[_0xe0b0('0x3d')](handleError(_0x51c580,null));};exports[_0xe0b0('0x3f')]=function(_0x16ccca,_0x5c6f94){return db['SmsQueue'][_0xe0b0('0x3f')]()[_0xe0b0('0x18')](respondWithResult(_0x5c6f94,null))[_0xe0b0('0x3d')](handleError(_0x5c6f94,null));};exports[_0xe0b0('0x40')]=function(_0x1bf77d,_0x575c7d){var _0x3b1474={'raw':!![],'where':{}},_0x11d4fd={},_0x534340;return db['SmsQueue']['findOne']({'where':{'id':_0x1bf77d[_0xe0b0('0x41')]['id']}})[_0xe0b0('0x18')](handleEntityNotFound(_0x575c7d,null))[_0xe0b0('0x18')](function(_0x364877){if(_0x364877){_0x534340=_0x364877['get']({'plain':!![]});_0x11d4fd[_0xe0b0('0x27')]=_[_0xe0b0('0x28')](db['UserSmsQueue']['rawAttributes']);_0x11d4fd[_0xe0b0('0x23')]=_[_0xe0b0('0x28')](_0x1bf77d['query']);_0x11d4fd[_0xe0b0('0x2a')]=_[_0xe0b0('0x2b')](_0x11d4fd['model'],_0x11d4fd['query']);_0x3b1474[_0xe0b0('0x2c')]=_['intersection'](_0x11d4fd[_0xe0b0('0x27')],qs[_0xe0b0('0x2d')](_0x1bf77d[_0xe0b0('0x23')][_0xe0b0('0x2d')]));_0x3b1474[_0xe0b0('0x2c')]=_0x3b1474[_0xe0b0('0x2c')]['length']?_0x3b1474['attributes']:_0x11d4fd[_0xe0b0('0x27')];if(!_0x1bf77d['query']['hasOwnProperty'](_0xe0b0('0x42'))){_0x3b1474[_0xe0b0('0x12')]=qs['limit'](_0x1bf77d['query'][_0xe0b0('0x12')]);_0x3b1474[_0xe0b0('0x10')]=qs[_0xe0b0('0x10')](_0x1bf77d[_0xe0b0('0x23')][_0xe0b0('0x10')]);}_0x3b1474[_0xe0b0('0x43')]=qs[_0xe0b0('0x44')](_0x1bf77d['query'][_0xe0b0('0x44')]);_0x3b1474['where']=qs[_0xe0b0('0x2a')](_['pick'](_0x1bf77d['query'],_0x11d4fd[_0xe0b0('0x2a')]));_0x3b1474[_0xe0b0('0x45')][_0xe0b0('0x46')]=_0x364877['id'];if(_0x1bf77d[_0xe0b0('0x23')][_0xe0b0('0x47')]){_0x3b1474[_0xe0b0('0x45')]=_[_0xe0b0('0x30')](_0x3b1474[_0xe0b0('0x45')],{'$or':_[_0xe0b0('0x48')](_0x3b1474['attributes'],function(_0x253ab0){var _0x57ccc9={};_0x57ccc9[_0x253ab0]={'$like':'%'+_0x1bf77d[_0xe0b0('0x23')][_0xe0b0('0x47')]+'%'};return _0x57ccc9;})});}_0x3b1474=_[_0xe0b0('0x30')]({},_0x3b1474,_0x1bf77d[_0xe0b0('0x31')]);return db[_0xe0b0('0x49')][_0xe0b0('0x24')](_0x3b1474);}})['then'](function(_0x1a057c){if(_0x1a057c){return db[_0xe0b0('0x4a')][_0xe0b0('0x4b')]({'where':{'id':_[_0xe0b0('0x48')](_0x1a057c,_0xe0b0('0x4c')),'role':_0xe0b0('0x4d')},'attributes':['id',_0xe0b0('0x1b'),_0xe0b0('0x4e'),_0xe0b0('0x4f'),_0xe0b0('0x50')]});}})[_0xe0b0('0x18')](function(_0x18ab99){if(_0x18ab99){return{'count':_0x18ab99[_0xe0b0('0x13')],'rows':_[_0xe0b0('0x48')](_0x18ab99[_0xe0b0('0x25')],function(_0x34c642){return{'membername':_0x34c642[_0xe0b0('0x1b')],'UserId':_0x34c642['id'],'queue_name':_0x534340[_0xe0b0('0x1b')],'SmsQueueId':_0x534340['id'],'interface':util['format'](_0xe0b0('0x51'),_0xe0b0('0x52'),_0x34c642[_0xe0b0('0x1b')]),'penalty':0x0,'paused':_0x34c642[_0xe0b0('0x4e')],'createdAt':_0x34c642[_0xe0b0('0x50')],'updatedAt':_0x34c642[_0xe0b0('0x4f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xe0b0('0x18')](respondWithFilteredResult(_0x575c7d,_0x3b1474))['catch'](handleError(_0x575c7d,null));};exports['getTeams']=function(_0x139014,_0x2a0415){var _0x157556={};var _0x47ecc1={};var _0x117d20;var _0x13fb4b;return db[_0xe0b0('0x1d')][_0xe0b0('0x53')]({'where':{'id':_0x139014[_0xe0b0('0x41')]['id']}})['then'](handleEntityNotFound(_0x2a0415,null))[_0xe0b0('0x18')](function(_0x242120){if(_0x242120){_0x117d20=_0x242120;_0x47ecc1[_0xe0b0('0x27')]=_['keys'](db[_0xe0b0('0x54')][_0xe0b0('0x29')]);_0x47ecc1['query']=_[_0xe0b0('0x28')](_0x139014['query']);_0x47ecc1['filters']=_[_0xe0b0('0x2b')](_0x47ecc1['model'],_0x47ecc1['query']);_0x157556[_0xe0b0('0x2c')]=_[_0xe0b0('0x2b')](_0x47ecc1[_0xe0b0('0x27')],qs[_0xe0b0('0x2d')](_0x139014['query'][_0xe0b0('0x2d')]));_0x157556[_0xe0b0('0x2c')]=_0x157556[_0xe0b0('0x2c')][_0xe0b0('0x2e')]?_0x157556[_0xe0b0('0x2c')]:_0x47ecc1[_0xe0b0('0x27')];_0x157556[_0xe0b0('0x43')]=qs[_0xe0b0('0x44')](_0x139014['query']['sort']);_0x157556[_0xe0b0('0x45')]=qs[_0xe0b0('0x2a')](_[_0xe0b0('0x55')](_0x139014['query'],_0x47ecc1['filters']));if(_0x139014[_0xe0b0('0x23')][_0xe0b0('0x47')]){_0x157556['where']=_['merge'](_0x157556[_0xe0b0('0x45')],{'$or':_[_0xe0b0('0x48')](_0x157556[_0xe0b0('0x2c')],function(_0x29175a){var _0x3b263f={};_0x3b263f[_0x29175a]={'$like':'%'+_0x139014[_0xe0b0('0x23')][_0xe0b0('0x47')]+'%'};return _0x3b263f;})});}_0x157556=_[_0xe0b0('0x30')]({},_0x157556,_0x139014['options']);return _0x117d20[_0xe0b0('0x56')](_0x157556);}})[_0xe0b0('0x18')](function(_0x1673bc){if(_0x1673bc){_0x13fb4b=_0x1673bc['length'];if(!_0x139014['query']['hasOwnProperty']('nolimit')){_0x157556['limit']=qs['limit'](_0x139014[_0xe0b0('0x23')]['limit']);_0x157556['offset']=qs[_0xe0b0('0x10')](_0x139014[_0xe0b0('0x23')][_0xe0b0('0x10')]);}return _0x117d20[_0xe0b0('0x56')](_0x157556);}})[_0xe0b0('0x18')](function(_0xd0629e){if(_0xd0629e){return _0xd0629e?{'count':_0x13fb4b,'rows':_0xd0629e}:null;}})[_0xe0b0('0x18')](respondWithResult(_0x2a0415,null))[_0xe0b0('0x3d')](handleError(_0x2a0415,null));};exports['addTeams']=function(_0x3097fb,_0x5da8fd){var _0x86e90=_0x3097fb[_0xe0b0('0x33')][_0xe0b0('0x57')];return db[_0xe0b0('0x54')][_0xe0b0('0x24')]({'where':{'id':_0x86e90},'attributes':['id'],'include':[{'model':db['User'],'as':_0xe0b0('0x58'),'attributes':['id','name',_0xe0b0('0x59'),_0xe0b0('0x5a'),_0xe0b0('0x5b')],'raw':!![]}]})[_0xe0b0('0x18')](function(_0x4a78f8){if(_0x4a78f8){var _0x311f79=_[_0xe0b0('0x5c')](_0x4a78f8,function(_0x49deef){var _0x4cf60a=_0x49deef[_0xe0b0('0x34')]({'plain':!![]});return _0x4cf60a[_0xe0b0('0x58')];});return db[_0xe0b0('0x1d')][_0xe0b0('0x32')]({'where':{'id':_0x3097fb[_0xe0b0('0x41')]['id']}})[_0xe0b0('0x18')](function(_0x34f4ff){return db[_0xe0b0('0x5d')][_0xe0b0('0x5e')](function(_0x24571b){return _0x34f4ff['addTeams'](_0x86e90,{'transaction':_0x24571b})['then'](function(){return BPromise[_0xe0b0('0x5f')](_0x311f79,function(_0x4880d5){return db['UserSmsQueue']['findOrCreate']({'where':{'UserId':_0x4880d5['id'],'SmsQueueId':_0x3097fb['params']['id']},'transaction':_0x24571b});});})[_0xe0b0('0x18')](function(){_0x311f79['forEach'](function(_0x654d2b){socket[_0xe0b0('0x60')](_0xe0b0('0x61'),{'UserId':_0x654d2b['id'],'SmsQueueId':_0x34f4ff['id']});});});});});}})[_0xe0b0('0x18')](respondWithStatusCode(_0x5da8fd,null))['catch'](handleError(_0x5da8fd,null));};exports[_0xe0b0('0x62')]=function(_0x948708,_0x5a0817){return db[_0xe0b0('0x54')][_0xe0b0('0x24')]({'where':{'id':_0x948708[_0xe0b0('0x23')][_0xe0b0('0x57')]},'attributes':['id'],'include':[{'model':db[_0xe0b0('0x4a')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x5a0817,null))['then'](function(_0x545694){var _0x5c258b=_[_0xe0b0('0x48')](_0x545694,'id');var _0x567e1a=[];var _0x3c09af=[];var _0x5f4aaf=squel[_0xe0b0('0x63')]();_0x5f4aaf[_0xe0b0('0x64')](_0xe0b0('0x65'))[_0xe0b0('0x66')](_0xe0b0('0x67'),'tq')[_0xe0b0('0x68')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')['where']('SmsQueueId\x20=\x20?',_0x948708[_0xe0b0('0x41')]['id']);for(var _0x261381=0x0;_0x261381<_0x545694[_0xe0b0('0x2e')];_0x261381+=0x1){let _0x4377f7=_0x545694[_0x261381];for(var _0x2c1149=0x0;_0x2c1149<_0x4377f7['Agents'][_0xe0b0('0x2e')];_0x2c1149+=0x1){let _0x39a07b=_0x4377f7[_0xe0b0('0x58')][_0x2c1149];var _0xc6090e=_0x5f4aaf[_0xe0b0('0x69')]();_0xc6090e[_0xe0b0('0x45')](_0xe0b0('0x6a'),_0x39a07b['id']);_0x3c09af[_0xe0b0('0x6b')](db[_0xe0b0('0x5d')]['query'](_0xc6090e['toString'](),{'type':db[_0xe0b0('0x5d')][_0xe0b0('0x6c')]['SELECT']})[_0xe0b0('0x18')](function(_0x4593f1){if(_0x4593f1[_0xe0b0('0x2e')]===0x1){return _0x39a07b['id'];}else{var _0x3fcffd=_[_0xe0b0('0x6d')](_[_0xe0b0('0x48')](_0x4593f1,_0xe0b0('0x6e')),function(_0xc8eba3){return _['includes'](_0x5c258b,_0xc8eba3);});if(_0x3fcffd){return _0x39a07b['id'];}}}));}}return BPromise['all'](_0x3c09af)['then'](function(_0xc19743){_0x567e1a=_(_0x567e1a)[_0xe0b0('0x6f')](_0xc19743)['compact']()[_0xe0b0('0x70')]();return db[_0xe0b0('0x1d')][_0xe0b0('0x32')]({'where':{'id':_0x948708[_0xe0b0('0x41')]['id']}})['then'](function(_0x56c4b9){return db['sequelize'][_0xe0b0('0x5e')](function(_0x266835){return _0x56c4b9['removeTeams'](_0x948708[_0xe0b0('0x23')][_0xe0b0('0x57')],{'transaction':_0x266835})['then'](function(){if(!_['isEmpty'](_0x567e1a)){return _0x56c4b9[_0xe0b0('0x71')](_0x567e1a,{'transaction':_0x266835});}})['then'](function(){_0x567e1a[_0xe0b0('0x72')](function(_0x5f06c0){socket[_0xe0b0('0x60')](_0xe0b0('0x73'),{'UserId':_0x5f06c0,'SmsQueueId':_0x56c4b9['id']});});});});});});})[_0xe0b0('0x18')](respondWithStatusCode(_0x5a0817,null))[_0xe0b0('0x3d')](handleError(_0x5a0817,null));};exports[_0xe0b0('0x74')]=function(_0x1ec7c2,_0x434dfa){return db[_0xe0b0('0x1d')][_0xe0b0('0x32')]({'where':{'id':_0x1ec7c2['params']['id']}})[_0xe0b0('0x18')](handleEntityNotFound(_0x434dfa,null))[_0xe0b0('0x18')](function(_0x2b40eb){if(_0x2b40eb){return _0x2b40eb['addAgents'](_0x1ec7c2[_0xe0b0('0x33')]['ids'],_[_0xe0b0('0x75')](_0x1ec7c2[_0xe0b0('0x33')],['ids','id'])||{})[_0xe0b0('0x76')](function(_0x4e4b45){for(var _0x528932=0x0;_0x528932<_0x1ec7c2[_0xe0b0('0x33')]['ids']['length'];_0x528932+=0x1){socket[_0xe0b0('0x60')](_0xe0b0('0x61'),{'UserId':Number(_0x1ec7c2[_0xe0b0('0x33')][_0xe0b0('0x57')][_0x528932]),'SmsQueueId':Number(_0x1ec7c2[_0xe0b0('0x41')]['id'])});}return _0x4e4b45;});}})[_0xe0b0('0x18')](respondWithResult(_0x434dfa,null))['catch'](handleError(_0x434dfa,null));};exports[_0xe0b0('0x71')]=function(_0x4609d5,_0x421b3b){return db['SmsQueue'][_0xe0b0('0x32')]({'where':{'id':_0x4609d5[_0xe0b0('0x41')]['id']}})['then'](handleEntityNotFound(_0x421b3b,null))['then'](function(_0x33f89a){if(_0x33f89a){return _0x33f89a['removeAgents'](_0x4609d5[_0xe0b0('0x23')][_0xe0b0('0x57')])[_0xe0b0('0x18')](function(){if(_[_0xe0b0('0x77')](_0x4609d5[_0xe0b0('0x23')][_0xe0b0('0x57')])){for(var _0x3d70d7=0x0;_0x3d70d7<_0x4609d5['query'][_0xe0b0('0x57')][_0xe0b0('0x2e')];_0x3d70d7+=0x1){socket[_0xe0b0('0x60')](_0xe0b0('0x73'),{'UserId':Number(_0x4609d5[_0xe0b0('0x23')]['ids'][_0x3d70d7]),'SmsQueueId':Number(_0x4609d5['params']['id'])});}}else{socket[_0xe0b0('0x60')](_0xe0b0('0x73'),{'UserId':Number(_0x4609d5[_0xe0b0('0x23')][_0xe0b0('0x57')]),'SmsQueueId':Number(_0x4609d5[_0xe0b0('0x41')]['id'])});}});}})[_0xe0b0('0x18')](respondWithStatusCode(_0x421b3b,null))[_0xe0b0('0x3d')](handleError(_0x421b3b,null));};exports[_0xe0b0('0x78')]=function(_0x932e,_0x1b3f4d){var _0x4fe048={};var _0xac45e6={};var _0x401c4b;var _0x3e18a3;return db[_0xe0b0('0x1d')]['findOne']({'where':{'id':_0x932e[_0xe0b0('0x41')]['id']}})[_0xe0b0('0x18')](handleEntityNotFound(_0x1b3f4d,null))[_0xe0b0('0x18')](function(_0x116c16){if(_0x116c16){_0x401c4b=_0x116c16;_0xac45e6[_0xe0b0('0x27')]=_['keys'](db[_0xe0b0('0x4a')]['rawAttributes']);_0xac45e6[_0xe0b0('0x23')]=_[_0xe0b0('0x28')](_0x932e[_0xe0b0('0x23')]);_0xac45e6[_0xe0b0('0x2a')]=_[_0xe0b0('0x2b')](_0xac45e6['model'],_0xac45e6['query']);_0x4fe048[_0xe0b0('0x2c')]=_['intersection'](_0xac45e6[_0xe0b0('0x27')],qs['fields'](_0x932e[_0xe0b0('0x23')][_0xe0b0('0x2d')]));_0x4fe048[_0xe0b0('0x2c')]=_0x4fe048[_0xe0b0('0x2c')][_0xe0b0('0x2e')]?_0x4fe048[_0xe0b0('0x2c')]:_0xac45e6[_0xe0b0('0x27')];_0x4fe048['order']=qs['sort'](_0x932e[_0xe0b0('0x23')][_0xe0b0('0x44')]);_0x4fe048[_0xe0b0('0x45')]=qs[_0xe0b0('0x2a')](_[_0xe0b0('0x55')](_0x932e[_0xe0b0('0x23')],_0xac45e6[_0xe0b0('0x2a')]));if(_0x932e[_0xe0b0('0x23')][_0xe0b0('0x47')]){_0x4fe048[_0xe0b0('0x45')]=_['merge'](_0x4fe048['where'],{'$or':_[_0xe0b0('0x48')](_0x4fe048[_0xe0b0('0x2c')],function(_0x187465){var _0x3f9e6b={};_0x3f9e6b[_0x187465]={'$like':'%'+_0x932e[_0xe0b0('0x23')][_0xe0b0('0x47')]+'%'};return _0x3f9e6b;})});}_0x4fe048=_[_0xe0b0('0x30')]({},_0x4fe048,_0x932e['options']);return _0x401c4b['getAgents'](_0x4fe048);}})[_0xe0b0('0x18')](function(_0x1ea4d5){if(_0x1ea4d5){_0x3e18a3=_0x1ea4d5[_0xe0b0('0x2e')];if(!_0x932e[_0xe0b0('0x23')][_0xe0b0('0x79')](_0xe0b0('0x42'))){_0x4fe048[_0xe0b0('0x12')]=qs[_0xe0b0('0x12')](_0x932e[_0xe0b0('0x23')][_0xe0b0('0x12')]);_0x4fe048['offset']=qs[_0xe0b0('0x10')](_0x932e[_0xe0b0('0x23')]['offset']);}return _0x401c4b[_0xe0b0('0x78')](_0x4fe048);}})[_0xe0b0('0x18')](function(_0x3615f9){if(_0x3615f9){return _0x3615f9?{'count':_0x3e18a3,'rows':_0x3615f9}:null;}})[_0xe0b0('0x18')](respondWithResult(_0x1b3f4d,null))[_0xe0b0('0x3d')](handleError(_0x1b3f4d,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index b9b014c..d3ce5a9 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 _0x6f04=['events','SmsQueue','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x4fc9e6,_0xc51915){var _0x551d28=function(_0x1a603b){while(--_0x1a603b){_0x4fc9e6['push'](_0x4fc9e6['shift']());}};_0x551d28(++_0xc51915);}(_0x6f04,0x1b9));var _0x46f0=function(_0x13e8a1,_0x244524){_0x13e8a1=_0x13e8a1-0x0;var _0x3ae888=_0x6f04[_0x13e8a1];return _0x3ae888;};'use strict';var EventEmitter=require(_0x46f0('0x0'));var SmsQueue=require('../../mysqldb')['db'][_0x46f0('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x46f0('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x46f0('0x3'),'afterDestroy':_0x46f0('0x4')};function emitEvent(_0x9e3449){return function(_0x51e3d1,_0x44a6bf,_0x1b64c9){SmsQueueEvents['emit'](_0x9e3449+':'+_0x51e3d1['id'],_0x51e3d1);SmsQueueEvents[_0x46f0('0x5')](_0x9e3449,_0x51e3d1);_0x1b64c9(null);};}for(var e in events){if(events[_0x46f0('0x6')](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file +var _0x2cb1=['hasOwnProperty','hook','exports','events','SmsQueue','setMaxListeners','save','update','remove','emit'];(function(_0x2d0382,_0x156114){var _0x30814e=function(_0x4d008b){while(--_0x4d008b){_0x2d0382['push'](_0x2d0382['shift']());}};_0x30814e(++_0x156114);}(_0x2cb1,0x1cf));var _0x12cb=function(_0x47f9da,_0x4f99e7){_0x47f9da=_0x47f9da-0x0;var _0x3acb09=_0x2cb1[_0x47f9da];return _0x3acb09;};'use strict';var EventEmitter=require(_0x12cb('0x0'));var SmsQueue=require('../../mysqldb')['db'][_0x12cb('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x12cb('0x2')](0x0);var events={'afterCreate':_0x12cb('0x3'),'afterUpdate':_0x12cb('0x4'),'afterDestroy':_0x12cb('0x5')};function emitEvent(_0x18f588){return function(_0x56ca38,_0x3d3be4,_0x253e22){SmsQueueEvents[_0x12cb('0x6')](_0x18f588+':'+_0x56ca38['id'],_0x56ca38);SmsQueueEvents[_0x12cb('0x6')](_0x18f588,_0x56ca38);_0x253e22(null);};}for(var e in events){if(events[_0x12cb('0x7')](e)){var event=events[e];SmsQueue[_0x12cb('0x8')](e,emitEvent(event));}}module[_0x12cb('0x9')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index d8477c1..79a18cd 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 _0x8503=['./smsQueue.attributes','define','sms_queues','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x5bb14f,_0x1fae4e){var _0x5654d0=function(_0x437388){while(--_0x437388){_0x5bb14f['push'](_0x5bb14f['shift']());}};_0x5654d0(++_0x1fae4e);}(_0x8503,0x11b));var _0x3850=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0x8503[_0x134c2e];return _0x2825db;};'use strict';var _=require(_0x3850('0x0'));var util=require(_0x3850('0x1'));var logger=require(_0x3850('0x2'))(_0x3850('0x3'));var moment=require(_0x3850('0x4'));var BPromise=require('bluebird');var rp=require(_0x3850('0x5'));var fs=require('fs');var path=require(_0x3850('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3850('0x7'));module['exports']=function(_0x2f3ff1,_0x3ee78b){return _0x2f3ff1[_0x3850('0x8')]('SmsQueue',attributes,{'tableName':_0x3850('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1b0a=['sms_queues','lodash','util','../../config/logger','api','moment','bluebird','rimraf','exports','define'];(function(_0x1f3267,_0x5a314c){var _0x1e17de=function(_0x298fcc){while(--_0x298fcc){_0x1f3267['push'](_0x1f3267['shift']());}};_0x1e17de(++_0x5a314c);}(_0x1b0a,0x97));var _0xa1b0=function(_0x49278b,_0x30fca1){_0x49278b=_0x49278b-0x0;var _0x1f79e2=_0x1b0a[_0x49278b];return _0x1f79e2;};'use strict';var _=require(_0xa1b0('0x0'));var util=require(_0xa1b0('0x1'));var logger=require(_0xa1b0('0x2'))(_0xa1b0('0x3'));var moment=require(_0xa1b0('0x4'));var BPromise=require(_0xa1b0('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa1b0('0x6'));var config=require('../../config/environment');var attributes=require('./smsQueue.attributes');module[_0xa1b0('0x7')]=function(_0x41e5ac,_0x485bd1){return _0x41e5ac[_0xa1b0('0x8')]('SmsQueue',attributes,{'tableName':_0xa1b0('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 94f5f20..ca5cb63 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 _0x5275=['catch','ShowSmsQueue','SmsQueue','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','request','then','request\x20sent','debug','stringify','error','code','SmsQueue,\x20%s,\x20%s','message','info','result','GetSmsQueue','findAll','options','raw','where','limit','include','map','model','attributes'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5275,0xf3));var _0x5527=function(_0x160cd7,_0x315362){_0x160cd7=_0x160cd7-0x0;var _0x4c34f2=_0x5275[_0x160cd7];return _0x4c34f2;};'use strict';var _=require(_0x5527('0x0'));var util=require('util');var moment=require(_0x5527('0x1'));var BPromise=require(_0x5527('0x2'));var rs=require(_0x5527('0x3'));var fs=require('fs');var Redis=require(_0x5527('0x4'));var db=require(_0x5527('0x5'))['db'];var utils=require(_0x5527('0x6'));var logger=require(_0x5527('0x7'))(_0x5527('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5527('0x9')]['http']({'port':0x232a});config[_0x5527('0xa')]=_[_0x5527('0xb')](config[_0x5527('0xa')],{'host':_0x5527('0xc'),'port':0x18eb});var socket=require(_0x5527('0xd'))(new Redis(config['redis']));require(_0x5527('0xe'))[_0x5527('0xf')](socket);function respondWithRpcPromise(_0x5b1fcc,_0x234b86,_0x2d6e54){return new BPromise(function(_0x4da2c6,_0x47dd96){return client[_0x5527('0x10')](_0x5b1fcc,_0x2d6e54)[_0x5527('0x11')](function(_0x2f0809){logger['info']('SmsQueue,\x20%s,\x20%s',_0x234b86,_0x5527('0x12'));logger[_0x5527('0x13')]('SmsQueue,\x20%s,\x20%s,\x20%s',_0x234b86,_0x5527('0x12'),JSON[_0x5527('0x14')](_0x2f0809));if(_0x2f0809[_0x5527('0x15')]){if(_0x2f0809[_0x5527('0x15')][_0x5527('0x16')]===0x1f4){logger[_0x5527('0x15')](_0x5527('0x17'),_0x234b86,_0x2f0809[_0x5527('0x15')][_0x5527('0x18')]);return _0x47dd96(_0x2f0809['error']['message']);}logger[_0x5527('0x15')](_0x5527('0x17'),_0x234b86,_0x2f0809[_0x5527('0x15')]['message']);return _0x4da2c6(_0x2f0809['error'][_0x5527('0x18')]);}else{logger[_0x5527('0x19')]('SmsQueue,\x20%s,\x20%s',_0x234b86,_0x5527('0x12'));_0x4da2c6(_0x2f0809[_0x5527('0x1a')][_0x5527('0x18')]);}})['catch'](function(_0x185b07){logger[_0x5527('0x15')](_0x5527('0x17'),_0x234b86,_0x185b07);_0x47dd96(_0x185b07);});});}exports[_0x5527('0x1b')]=function(_0x61d82f){var _0x5ac16b=this;return new Promise(function(_0x53226a,_0x3fd6d1){return db['SmsQueue'][_0x5527('0x1c')]({'raw':_0x61d82f[_0x5527('0x1d')]?_0x61d82f['options'][_0x5527('0x1e')]===undefined?!![]:![]:!![],'where':_0x61d82f[_0x5527('0x1d')]?_0x61d82f['options'][_0x5527('0x1f')]||null:null,'attributes':_0x61d82f[_0x5527('0x1d')]?_0x61d82f['options']['attributes']||null:null,'limit':_0x61d82f[_0x5527('0x1d')]?_0x61d82f[_0x5527('0x1d')][_0x5527('0x20')]||null:null,'include':_0x61d82f['options']?_0x61d82f[_0x5527('0x1d')][_0x5527('0x21')]?_[_0x5527('0x22')](_0x61d82f['options'][_0x5527('0x21')],function(_0x405d4d){return{'model':db[_0x405d4d[_0x5527('0x23')]],'as':_0x405d4d['as'],'attributes':_0x405d4d[_0x5527('0x24')],'include':_0x405d4d['include']?_['map'](_0x405d4d[_0x5527('0x21')],function(_0x218b1e){return{'model':db[_0x218b1e[_0x5527('0x23')]],'as':_0x218b1e['as'],'attributes':_0x218b1e['attributes'],'include':_0x218b1e[_0x5527('0x21')]?_[_0x5527('0x22')](_0x218b1e[_0x5527('0x21')],function(_0x1a3d48){return{'model':db[_0x1a3d48['model']],'as':_0x1a3d48['as'],'attributes':_0x1a3d48[_0x5527('0x24')]};}):[]};}):[]};}):[]:[]})[_0x5527('0x11')](function(_0x45a6b1){logger[_0x5527('0x19')](_0x5527('0x1b'),_0x61d82f);logger['debug']('GetSmsQueue',_0x61d82f,JSON[_0x5527('0x14')](_0x45a6b1));_0x53226a(_0x45a6b1);})[_0x5527('0x25')](function(_0x42e081){logger[_0x5527('0x15')]('GetSmsQueue',_0x42e081[_0x5527('0x18')],_0x61d82f);_0x3fd6d1(_0x5ac16b[_0x5527('0x15')](0x1f4,_0x42e081[_0x5527('0x18')]));});});};exports[_0x5527('0x26')]=function(_0x40af6e){var _0x4ed40f=this;return new Promise(function(_0x538782,_0x410a6d){return db[_0x5527('0x27')]['find']({'raw':_0x40af6e['options']?_0x40af6e[_0x5527('0x1d')][_0x5527('0x1e')]===undefined?!![]:![]:!![],'where':_0x40af6e['options']?_0x40af6e[_0x5527('0x1d')][_0x5527('0x1f')]||null:null,'attributes':_0x40af6e[_0x5527('0x1d')]?_0x40af6e['options']['attributes']||null:null,'include':_0x40af6e[_0x5527('0x1d')]?_0x40af6e[_0x5527('0x1d')][_0x5527('0x21')]?_[_0x5527('0x22')](_0x40af6e[_0x5527('0x1d')][_0x5527('0x21')],function(_0x35dffa){return{'model':db[_0x35dffa['model']],'as':_0x35dffa['as'],'attributes':_0x35dffa['attributes'],'include':_0x35dffa[_0x5527('0x21')]?_[_0x5527('0x22')](_0x35dffa['include'],function(_0x7948ba){return{'model':db[_0x7948ba['model']],'as':_0x7948ba['as'],'attributes':_0x7948ba['attributes'],'include':_0x7948ba[_0x5527('0x21')]?_['map'](_0x7948ba[_0x5527('0x21')],function(_0x637bdd){return{'model':db[_0x637bdd[_0x5527('0x23')]],'as':_0x637bdd['as'],'attributes':_0x637bdd[_0x5527('0x24')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x26f423){logger[_0x5527('0x19')](_0x5527('0x26'),_0x40af6e);logger[_0x5527('0x13')](_0x5527('0x26'),_0x40af6e,JSON['stringify'](_0x26f423));_0x538782(_0x26f423);})[_0x5527('0x25')](function(_0xa6f459){logger[_0x5527('0x15')](_0x5527('0x26'),_0xa6f459[_0x5527('0x18')],_0x40af6e);_0x410a6d(_0x4ed40f[_0x5527('0x15')](0x1f4,_0xa6f459[_0x5527('0x18')]));});});}; \ No newline at end of file +var _0x627a=['error','code','message','result','SmsQueue','findAll','options','raw','where','attributes','include','model','map','GetSmsQueue','catch','ShowSmsQueue','find','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./smsQueue.socket','register','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify'];(function(_0xf34895,_0x21fb70){var _0x143f44=function(_0x2e7730){while(--_0x2e7730){_0xf34895['push'](_0xf34895['shift']());}};_0x143f44(++_0x21fb70);}(_0x627a,0x1df));var _0xa627=function(_0x355ea3,_0x3a9f08){_0x355ea3=_0x355ea3-0x0;var _0x25aba6=_0x627a[_0x355ea3];return _0x25aba6;};'use strict';var _=require(_0xa627('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xa627('0x1'));var rs=require(_0xa627('0x2'));var fs=require('fs');var Redis=require(_0xa627('0x3'));var db=require(_0xa627('0x4'))['db'];var utils=require(_0xa627('0x5'));var logger=require(_0xa627('0x6'))(_0xa627('0x7'));var config=require(_0xa627('0x8'));var jayson=require(_0xa627('0x9'));var client=jayson[_0xa627('0xa')]['http']({'port':0x232a});config['redis']=_[_0xa627('0xb')](config[_0xa627('0xc')],{'host':_0xa627('0xd'),'port':0x18eb});var socket=require(_0xa627('0xe'))(new Redis(config[_0xa627('0xc')]));require(_0xa627('0xf'))[_0xa627('0x10')](socket);function respondWithRpcPromise(_0x3eee5c,_0x55875f,_0x1c5c76){return new BPromise(function(_0x8f5fbb,_0x2af8b3){return client[_0xa627('0x11')](_0x3eee5c,_0x1c5c76)[_0xa627('0x12')](function(_0x27f156){logger[_0xa627('0x13')](_0xa627('0x14'),_0x55875f,_0xa627('0x15'));logger[_0xa627('0x16')](_0xa627('0x17'),_0x55875f,_0xa627('0x15'),JSON[_0xa627('0x18')](_0x27f156));if(_0x27f156[_0xa627('0x19')]){if(_0x27f156[_0xa627('0x19')][_0xa627('0x1a')]===0x1f4){logger[_0xa627('0x19')](_0xa627('0x14'),_0x55875f,_0x27f156['error'][_0xa627('0x1b')]);return _0x2af8b3(_0x27f156['error']['message']);}logger[_0xa627('0x19')]('SmsQueue,\x20%s,\x20%s',_0x55875f,_0x27f156[_0xa627('0x19')][_0xa627('0x1b')]);return _0x8f5fbb(_0x27f156[_0xa627('0x19')][_0xa627('0x1b')]);}else{logger['info'](_0xa627('0x14'),_0x55875f,_0xa627('0x15'));_0x8f5fbb(_0x27f156[_0xa627('0x1c')][_0xa627('0x1b')]);}})['catch'](function(_0x5ccf63){logger[_0xa627('0x19')](_0xa627('0x14'),_0x55875f,_0x5ccf63);_0x2af8b3(_0x5ccf63);});});}exports['GetSmsQueue']=function(_0x387506){var _0x178613=this;return new Promise(function(_0x52345c,_0x5c1ed4){return db[_0xa627('0x1d')][_0xa627('0x1e')]({'raw':_0x387506[_0xa627('0x1f')]?_0x387506[_0xa627('0x1f')][_0xa627('0x20')]===undefined?!![]:![]:!![],'where':_0x387506['options']?_0x387506[_0xa627('0x1f')][_0xa627('0x21')]||null:null,'attributes':_0x387506[_0xa627('0x1f')]?_0x387506['options'][_0xa627('0x22')]||null:null,'limit':_0x387506[_0xa627('0x1f')]?_0x387506['options']['limit']||null:null,'include':_0x387506[_0xa627('0x1f')]?_0x387506[_0xa627('0x1f')][_0xa627('0x23')]?_['map'](_0x387506[_0xa627('0x1f')][_0xa627('0x23')],function(_0xd4cc75){return{'model':db[_0xd4cc75[_0xa627('0x24')]],'as':_0xd4cc75['as'],'attributes':_0xd4cc75[_0xa627('0x22')],'include':_0xd4cc75[_0xa627('0x23')]?_[_0xa627('0x25')](_0xd4cc75['include'],function(_0x3ed358){return{'model':db[_0x3ed358[_0xa627('0x24')]],'as':_0x3ed358['as'],'attributes':_0x3ed358[_0xa627('0x22')],'include':_0x3ed358[_0xa627('0x23')]?_[_0xa627('0x25')](_0x3ed358['include'],function(_0x18f181){return{'model':db[_0x18f181[_0xa627('0x24')]],'as':_0x18f181['as'],'attributes':_0x18f181[_0xa627('0x22')]};}):[]};}):[]};}):[]:[]})[_0xa627('0x12')](function(_0x147b4b){logger['info'](_0xa627('0x26'),_0x387506);logger[_0xa627('0x16')](_0xa627('0x26'),_0x387506,JSON[_0xa627('0x18')](_0x147b4b));_0x52345c(_0x147b4b);})[_0xa627('0x27')](function(_0x12569e){logger['error'](_0xa627('0x26'),_0x12569e[_0xa627('0x1b')],_0x387506);_0x5c1ed4(_0x178613[_0xa627('0x19')](0x1f4,_0x12569e[_0xa627('0x1b')]));});});};exports[_0xa627('0x28')]=function(_0x424fba){var _0x5dbc1b=this;return new Promise(function(_0x1ca1bd,_0x130af6){return db['SmsQueue'][_0xa627('0x29')]({'raw':_0x424fba['options']?_0x424fba[_0xa627('0x1f')][_0xa627('0x20')]===undefined?!![]:![]:!![],'where':_0x424fba[_0xa627('0x1f')]?_0x424fba[_0xa627('0x1f')]['where']||null:null,'attributes':_0x424fba[_0xa627('0x1f')]?_0x424fba[_0xa627('0x1f')]['attributes']||null:null,'include':_0x424fba[_0xa627('0x1f')]?_0x424fba[_0xa627('0x1f')][_0xa627('0x23')]?_[_0xa627('0x25')](_0x424fba[_0xa627('0x1f')][_0xa627('0x23')],function(_0x23e4af){return{'model':db[_0x23e4af[_0xa627('0x24')]],'as':_0x23e4af['as'],'attributes':_0x23e4af['attributes'],'include':_0x23e4af[_0xa627('0x23')]?_[_0xa627('0x25')](_0x23e4af['include'],function(_0x314487){return{'model':db[_0x314487[_0xa627('0x24')]],'as':_0x314487['as'],'attributes':_0x314487[_0xa627('0x22')],'include':_0x314487[_0xa627('0x23')]?_['map'](_0x314487[_0xa627('0x23')],function(_0x13c7fd){return{'model':db[_0x13c7fd[_0xa627('0x24')]],'as':_0x13c7fd['as'],'attributes':_0x13c7fd['attributes']};}):[]};}):[]};}):[]:[]})[_0xa627('0x12')](function(_0x5c0e6e){logger['info'](_0xa627('0x28'),_0x424fba);logger[_0xa627('0x16')](_0xa627('0x28'),_0x424fba,JSON[_0xa627('0x18')](_0x5c0e6e));_0x1ca1bd(_0x5c0e6e);})[_0xa627('0x27')](function(_0x3f2e2d){logger[_0xa627('0x19')](_0xa627('0x28'),_0x3f2e2d['message'],_0x424fba);_0x130af6(_0x5dbc1b[_0xa627('0x19')](0x1f4,_0x3f2e2d[_0xa627('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 2acc2ef..ac1eabe 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 _0x3362=['register','length','smsQueue:','./smsQueue.events','save','remove','update','emit','removeListener'];(function(_0x3cfaca,_0x304e44){var _0x2e4e6c=function(_0x451d6b){while(--_0x451d6b){_0x3cfaca['push'](_0x3cfaca['shift']());}};_0x2e4e6c(++_0x304e44);}(_0x3362,0x123));var _0x2336=function(_0x551fc8,_0xef12e0){_0x551fc8=_0x551fc8-0x0;var _0x27940c=_0x3362[_0x551fc8];return _0x27940c;};'use strict';var SmsQueueEvents=require(_0x2336('0x0'));var events=[_0x2336('0x1'),_0x2336('0x2'),_0x2336('0x3')];function createListener(_0x1d6d77,_0x520a87){return function(_0x41b622){_0x520a87[_0x2336('0x4')](_0x1d6d77,_0x41b622);};}function removeListener(_0x4095cd,_0x42ed66){return function(){SmsQueueEvents[_0x2336('0x5')](_0x4095cd,_0x42ed66);};}exports[_0x2336('0x6')]=function(_0x248072){for(var _0x33167e=0x0,_0x51a862=events[_0x2336('0x7')];_0x33167e<_0x51a862;_0x33167e++){var _0x1d29ad=events[_0x33167e];var _0x1b19e7=createListener(_0x2336('0x8')+_0x1d29ad,_0x248072);SmsQueueEvents['on'](_0x1d29ad,_0x1b19e7);}}; \ No newline at end of file +var _0x86fc=['update','emit','register','length','smsQueue:','./smsQueue.events','save','remove'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x86fc,0x9d));var _0xc86f=function(_0x53f531,_0x202e60){_0x53f531=_0x53f531-0x0;var _0x312f00=_0x86fc[_0x53f531];return _0x312f00;};'use strict';var SmsQueueEvents=require(_0xc86f('0x0'));var events=[_0xc86f('0x1'),_0xc86f('0x2'),_0xc86f('0x3')];function createListener(_0x3be02e,_0x1a62e2){return function(_0x19e781){_0x1a62e2[_0xc86f('0x4')](_0x3be02e,_0x19e781);};}function removeListener(_0x42dcce,_0x119323){return function(){SmsQueueEvents['removeListener'](_0x42dcce,_0x119323);};}exports[_0xc86f('0x5')]=function(_0x409fe1){for(var _0x267fde=0x0,_0x3848c1=events[_0xc86f('0x6')];_0x267fde<_0x3848c1;_0x267fde++){var _0x1c6810=events[_0x267fde];var _0x274b55=createListener(_0xc86f('0x7')+_0x1c6810,_0x409fe1);SmsQueueEvents['on'](_0x1c6810,_0x274b55);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index cb84f30..258089d 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 _0x6078=['../../config/environment','./smsQueueReport.controller','index','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x2d632b,_0xe796a0){var _0x11d17e=function(_0x2df382){while(--_0x2df382){_0x2d632b['push'](_0x2d632b['shift']());}};_0x11d17e(++_0xe796a0);}(_0x6078,0x161));var _0x8607=function(_0x3a2b7d,_0x1f50dd){_0x3a2b7d=_0x3a2b7d-0x0;var _0xf82ee1=_0x6078[_0x3a2b7d];return _0xf82ee1;};'use strict';var multer=require('multer');var util=require(_0x8607('0x0'));var path=require(_0x8607('0x1'));var timeout=require(_0x8607('0x2'));var express=require(_0x8607('0x3'));var router=express[_0x8607('0x4')]();var fs_extra=require(_0x8607('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8607('0x6'));var config=require(_0x8607('0x7'));var controller=require(_0x8607('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x8607('0x9')]);router[_0x8607('0xa')]('/describe',auth[_0x8607('0xb')](),controller['describe']);router[_0x8607('0xa')](_0x8607('0xc'),auth[_0x8607('0xb')](),controller[_0x8607('0xd')]);router[_0x8607('0xe')]('/',auth[_0x8607('0xb')](),controller[_0x8607('0xf')]);router[_0x8607('0x10')](_0x8607('0xc'),auth[_0x8607('0xb')](),controller[_0x8607('0x11')]);router[_0x8607('0x12')](_0x8607('0xc'),auth[_0x8607('0xb')](),controller[_0x8607('0x13')]);module['exports']=router; \ No newline at end of file +var _0x180d=['./smsQueueReport.controller','isAuthenticated','index','get','describe','show','post','create','put','/:id','update','delete','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x40d5cc,_0xf9d2c7){var _0x6950af=function(_0x295221){while(--_0x295221){_0x40d5cc['push'](_0x40d5cc['shift']());}};_0x6950af(++_0xf9d2c7);}(_0x180d,0x19c));var _0xd180=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0x180d[_0x2ec461];return _0x28603d;};'use strict';var multer=require(_0xd180('0x0'));var util=require(_0xd180('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xd180('0x2'));var router=express[_0xd180('0x3')]();var fs_extra=require(_0xd180('0x4'));var auth=require(_0xd180('0x5'));var interaction=require(_0xd180('0x6'));var config=require(_0xd180('0x7'));var controller=require(_0xd180('0x8'));router['get']('/',auth[_0xd180('0x9')](),controller[_0xd180('0xa')]);router[_0xd180('0xb')]('/describe',auth[_0xd180('0x9')](),controller[_0xd180('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xd180('0xd')]);router[_0xd180('0xe')]('/',auth[_0xd180('0x9')](),controller[_0xd180('0xf')]);router[_0xd180('0x10')](_0xd180('0x11'),auth[_0xd180('0x9')](),controller[_0xd180('0x12')]);router[_0xd180('0x13')](_0xd180('0x11'),auth[_0xd180('0x9')](),controller['destroy']);module[_0xd180('0x14')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 1256ed9..6bebf3e 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 _0xefbd=['STRING','DATE','moment','sequelize'];(function(_0x52c360,_0x3d6dac){var _0x2ec8da=function(_0x4a5655){while(--_0x4a5655){_0x52c360['push'](_0x52c360['shift']());}};_0x2ec8da(++_0x3d6dac);}(_0xefbd,0x15a));var _0xdefb=function(_0x7c60e,_0x2edc28){_0x7c60e=_0x7c60e-0x0;var _0x36aa3e=_0xefbd[_0x7c60e];return _0x36aa3e;};'use strict';var moment=require(_0xdefb('0x0'));var Sequelize=require(_0xdefb('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xdefb('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xdefb('0x3')]},'leaveAt':{'type':Sequelize[_0xdefb('0x3')]},'acceptAt':{'type':Sequelize[_0xdefb('0x3')]},'exitAt':{'type':Sequelize[_0xdefb('0x3')]},'reason':{'type':Sequelize[_0xdefb('0x2')]}}; \ No newline at end of file +var _0x8218=['sequelize','exports','STRING','DATE','moment'];(function(_0x12d38e,_0x4db2db){var _0x379569=function(_0x359b84){while(--_0x359b84){_0x12d38e['push'](_0x12d38e['shift']());}};_0x379569(++_0x4db2db);}(_0x8218,0xb3));var _0x8821=function(_0x41fa87,_0x119133){_0x41fa87=_0x41fa87-0x0;var _0x2f4ad1=_0x8218[_0x41fa87];return _0x2f4ad1;};'use strict';var moment=require(_0x8821('0x0'));var Sequelize=require(_0x8821('0x1'));module[_0x8821('0x2')]={'uniqueid':{'type':Sequelize[_0x8821('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x8821('0x4')]},'reason':{'type':Sequelize[_0x8821('0x3')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 1c2a2a0..d0ca404 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 _0x717a=['sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','json','undefined','limit','count','offset','set','Content-Range','reject','save','then','end','sendStatus','error','stack','name','send','index','map','SmsQueueReport','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','keys','find','create','body','update','destroy','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path'];(function(_0x378dfd,_0x423c99){var _0x537e01=function(_0x1eeb04){while(--_0x1eeb04){_0x378dfd['push'](_0x378dfd['shift']());}};_0x537e01(++_0x423c99);}(_0x717a,0x130));var _0xa717=function(_0x57d13b,_0x52d8cb){_0x57d13b=_0x57d13b-0x0;var _0x467696=_0x717a[_0x57d13b];return _0x467696;};'use strict';var emlformat=require(_0xa717('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa717('0x1'));var jsonpatch=require(_0xa717('0x2'));var rp=require('request-promise');var moment=require(_0xa717('0x3'));var BPromise=require(_0xa717('0x4'));var Mustache=require(_0xa717('0x5'));var util=require(_0xa717('0x6'));var path=require(_0xa717('0x7'));var sox=require(_0xa717('0x8'));var csv=require(_0xa717('0x9'));var ejs=require(_0xa717('0xa'));var fs=require('fs');var fs_extra=require(_0xa717('0xb'));var _=require(_0xa717('0xc'));var squel=require(_0xa717('0xd'));var crypto=require('crypto');var jsforce=require(_0xa717('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xa717('0xf'));var Papa=require(_0xa717('0x10'));var Redis=require(_0xa717('0x11'));var authService=require(_0xa717('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xa717('0x13'));var hardwareService=require(_0xa717('0x14'));var logger=require(_0xa717('0x15'))(_0xa717('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xa717('0x17'));var db=require(_0xa717('0x18'))['db'];function respondWithStatusCode(_0x300126,_0x51b7b8){_0x51b7b8=_0x51b7b8||0xcc;return function(_0x4361bd){if(_0x4361bd){return _0x300126['sendStatus'](_0x51b7b8);}return _0x300126[_0xa717('0x19')](_0x51b7b8)['end']();};}function respondWithResult(_0x5ae5db,_0x382eb0){_0x382eb0=_0x382eb0||0xc8;return function(_0x5b915c){if(_0x5b915c){return _0x5ae5db[_0xa717('0x19')](_0x382eb0)[_0xa717('0x1a')](_0x5b915c);}};}function respondWithFilteredResult(_0x8f45e6,_0x1fabee){return function(_0x19cfef){if(_0x19cfef){var _0x36f055=typeof _0x1fabee['offset']===_0xa717('0x1b')&&typeof _0x1fabee[_0xa717('0x1c')]===_0xa717('0x1b');var _0x1b28d2=_0x19cfef[_0xa717('0x1d')];var _0x500de5=_0x36f055?0x0:_0x1fabee[_0xa717('0x1e')];var _0x3358af=_0x36f055?_0x19cfef['count']:_0x1fabee[_0xa717('0x1e')]+_0x1fabee[_0xa717('0x1c')];var _0x50884b;if(_0x3358af>=_0x1b28d2){_0x3358af=_0x1b28d2;_0x50884b=0xc8;}else{_0x50884b=0xce;}_0x8f45e6[_0xa717('0x19')](_0x50884b);return _0x8f45e6[_0xa717('0x1f')](_0xa717('0x20'),_0x500de5+'-'+_0x3358af+'/'+_0x1b28d2)[_0xa717('0x1a')](_0x19cfef);}return null;};}function patchUpdates(_0x4c000d){return function(_0x1e9243){try{jsonpatch['apply'](_0x1e9243,_0x4c000d,!![]);}catch(_0x3e7b99){return BPromise[_0xa717('0x21')](_0x3e7b99);}return _0x1e9243[_0xa717('0x22')]();};}function saveUpdates(_0x2082e9,_0x23771b){return function(_0x212711){if(_0x212711){return _0x212711['update'](_0x2082e9)[_0xa717('0x23')](function(_0x53c83f){return _0x53c83f;});}return null;};}function removeEntity(_0x2fb95d,_0x681fad){return function(_0x13dd71){if(_0x13dd71){return _0x13dd71['destroy']()[_0xa717('0x23')](function(){_0x2fb95d[_0xa717('0x19')](0xcc)[_0xa717('0x24')]();});}};}function handleEntityNotFound(_0xd229f0,_0x2d0f0e){return function(_0x1459af){if(!_0x1459af){_0xd229f0[_0xa717('0x25')](0x194);}return _0x1459af;};}function handleError(_0x408f17,_0x545b2f){_0x545b2f=_0x545b2f||0x1f4;return function(_0x5d90cc){logger[_0xa717('0x26')](_0x5d90cc[_0xa717('0x27')]);if(_0x5d90cc[_0xa717('0x28')]){delete _0x5d90cc[_0xa717('0x28')];}_0x408f17['status'](_0x545b2f)[_0xa717('0x29')](_0x5d90cc);};}exports[_0xa717('0x2a')]=function(_0x3061be,_0x37ed26){var _0x2b111c={},_0x213389={},_0x5a1929={'count':0x0,'rows':[]};var _0x350ef3=_[_0xa717('0x2b')](db[_0xa717('0x2c')][_0xa717('0x2d')],function(_0x2920d0){return{'name':_0x2920d0[_0xa717('0x2e')],'type':_0x2920d0['type'][_0xa717('0x2f')]};});_0x213389[_0xa717('0x30')]=_[_0xa717('0x2b')](_0x350ef3,'name');_0x213389[_0xa717('0x31')]=_['keys'](_0x3061be[_0xa717('0x31')]);_0x213389[_0xa717('0x32')]=_[_0xa717('0x33')](_0x213389[_0xa717('0x30')],_0x213389[_0xa717('0x31')]);_0x2b111c[_0xa717('0x34')]=_[_0xa717('0x33')](_0x213389[_0xa717('0x30')],qs[_0xa717('0x35')](_0x3061be['query'][_0xa717('0x35')]));_0x2b111c[_0xa717('0x34')]=_0x2b111c['attributes'][_0xa717('0x36')]?_0x2b111c[_0xa717('0x34')]:_0x213389[_0xa717('0x30')];if(!_0x3061be[_0xa717('0x31')][_0xa717('0x37')](_0xa717('0x38'))){_0x2b111c['limit']=qs[_0xa717('0x1c')](_0x3061be['query'][_0xa717('0x1c')]);_0x2b111c[_0xa717('0x1e')]=qs[_0xa717('0x1e')](_0x3061be[_0xa717('0x31')][_0xa717('0x1e')]);}_0x2b111c[_0xa717('0x39')]=qs['sort'](_0x3061be['query'][_0xa717('0x3a')]);_0x2b111c[_0xa717('0x3b')]=qs[_0xa717('0x32')](_[_0xa717('0x3c')](_0x3061be[_0xa717('0x31')],_0x213389[_0xa717('0x32')]),_0x350ef3);if(_0x3061be['query'][_0xa717('0x3d')]){_0x2b111c['where']=_[_0xa717('0x3e')](_0x2b111c['where'],{'$or':_[_0xa717('0x2b')](_0x350ef3,function(_0x107fc0){if(_0x107fc0['type']!==_0xa717('0x3f')){var _0x3d2e57={};_0x3d2e57[_0x107fc0['name']]={'$like':'%'+_0x3061be['query']['filter']+'%'};return _0x3d2e57;}})});}_0x2b111c=_[_0xa717('0x3e')]({},_0x2b111c,_0x3061be[_0xa717('0x40')]);var _0x41c59e={'where':_0x2b111c['where']};return db[_0xa717('0x2c')]['count'](_0x41c59e)[_0xa717('0x23')](function(_0x3a0491){_0x5a1929[_0xa717('0x1d')]=_0x3a0491;if(_0x3061be[_0xa717('0x31')]['includeAll']){_0x2b111c[_0xa717('0x41')]=[{'all':!![]}];}return db[_0xa717('0x2c')][_0xa717('0x42')](_0x2b111c);})[_0xa717('0x23')](function(_0x45c96f){_0x5a1929[_0xa717('0x43')]=_0x45c96f;return _0x5a1929;})[_0xa717('0x23')](respondWithFilteredResult(_0x37ed26,_0x2b111c))[_0xa717('0x44')](handleError(_0x37ed26,null));};exports[_0xa717('0x45')]=function(_0x4d8af6,_0x41f99f){var _0x573d46={'raw':!![],'where':{'id':_0x4d8af6[_0xa717('0x46')]['id']}},_0x4eede7={};_0x4eede7[_0xa717('0x30')]=_[_0xa717('0x47')](db[_0xa717('0x2c')]['rawAttributes']);_0x4eede7[_0xa717('0x31')]=_['keys'](_0x4d8af6[_0xa717('0x31')]);_0x4eede7[_0xa717('0x32')]=_[_0xa717('0x33')](_0x4eede7[_0xa717('0x30')],_0x4eede7[_0xa717('0x31')]);_0x573d46[_0xa717('0x34')]=_[_0xa717('0x33')](_0x4eede7['model'],qs[_0xa717('0x35')](_0x4d8af6['query']['fields']));_0x573d46[_0xa717('0x34')]=_0x573d46[_0xa717('0x34')][_0xa717('0x36')]?_0x573d46[_0xa717('0x34')]:_0x4eede7['model'];if(_0x4d8af6[_0xa717('0x31')]['includeAll']){_0x573d46[_0xa717('0x41')]=[{'all':!![]}];}_0x573d46=_[_0xa717('0x3e')]({},_0x573d46,_0x4d8af6[_0xa717('0x40')]);return db[_0xa717('0x2c')][_0xa717('0x48')](_0x573d46)[_0xa717('0x23')](handleEntityNotFound(_0x41f99f,null))['then'](respondWithResult(_0x41f99f,null))['catch'](handleError(_0x41f99f,null));};exports[_0xa717('0x49')]=function(_0x3b6789,_0x22014b){return db[_0xa717('0x2c')][_0xa717('0x49')](_0x3b6789[_0xa717('0x4a')],{})[_0xa717('0x23')](respondWithResult(_0x22014b,0xc9))['catch'](handleError(_0x22014b,null));};exports[_0xa717('0x4b')]=function(_0x46a8d1,_0x593f8d){if(_0x46a8d1['body']['id']){delete _0x46a8d1['body']['id'];}return db['SmsQueueReport'][_0xa717('0x48')]({'where':{'id':_0x46a8d1[_0xa717('0x46')]['id']}})[_0xa717('0x23')](handleEntityNotFound(_0x593f8d,null))[_0xa717('0x23')](saveUpdates(_0x46a8d1[_0xa717('0x4a')],null))[_0xa717('0x23')](respondWithResult(_0x593f8d,null))[_0xa717('0x44')](handleError(_0x593f8d,null));};exports[_0xa717('0x4c')]=function(_0x44939b,_0x18dc0){return db['SmsQueueReport'][_0xa717('0x48')]({'where':{'id':_0x44939b[_0xa717('0x46')]['id']}})[_0xa717('0x23')](handleEntityNotFound(_0x18dc0,null))[_0xa717('0x23')](removeEntity(_0x18dc0,null))[_0xa717('0x44')](handleError(_0x18dc0,null));};exports[_0xa717('0x4d')]=function(_0x414734,_0x48c1ad){return db[_0xa717('0x2c')][_0xa717('0x4d')]()['then'](respondWithResult(_0x48c1ad,null))['catch'](handleError(_0x48c1ad,null));}; \ No newline at end of file +var _0x5b3a=['path','sox','to-csv','ejs','fs-extra','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','Content-Range','json','apply','update','destroy','error','name','send','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','length','hasOwnProperty','order','sort','where','filters','pick','filter','VIRTUAL','then','SmsQueueReport','findAll','rows','show','includeAll','include','options','find','catch','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x4c5af1,_0x2436de){var _0x4e3c6e=function(_0x446aba){while(--_0x446aba){_0x4c5af1['push'](_0x4c5af1['shift']());}};_0x4e3c6e(++_0x2436de);}(_0x5b3a,0x164));var _0xa5b3=function(_0x73a211,_0xbc1dd8){_0x73a211=_0x73a211-0x0;var _0xf6602a=_0x5b3a[_0x73a211];return _0xf6602a;};'use strict';var emlformat=require(_0xa5b3('0x0'));var rimraf=require(_0xa5b3('0x1'));var zipdir=require(_0xa5b3('0x2'));var jsonpatch=require(_0xa5b3('0x3'));var rp=require(_0xa5b3('0x4'));var moment=require(_0xa5b3('0x5'));var BPromise=require(_0xa5b3('0x6'));var Mustache=require(_0xa5b3('0x7'));var util=require(_0xa5b3('0x8'));var path=require(_0xa5b3('0x9'));var sox=require(_0xa5b3('0xa'));var csv=require(_0xa5b3('0xb'));var ejs=require(_0xa5b3('0xc'));var fs=require('fs');var fs_extra=require(_0xa5b3('0xd'));var _=require('lodash');var squel=require(_0xa5b3('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa5b3('0xf'));var toCsv=require(_0xa5b3('0xb'));var querystring=require('querystring');var Papa=require(_0xa5b3('0x10'));var Redis=require(_0xa5b3('0x11'));var authService=require(_0xa5b3('0x12'));var qs=require(_0xa5b3('0x13'));var as=require(_0xa5b3('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa5b3('0x15'))(_0xa5b3('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xa5b3('0x17'));var db=require(_0xa5b3('0x18'))['db'];function respondWithStatusCode(_0x46be47,_0x3f5579){_0x3f5579=_0x3f5579||0xcc;return function(_0x51681f){if(_0x51681f){return _0x46be47[_0xa5b3('0x19')](_0x3f5579);}return _0x46be47[_0xa5b3('0x1a')](_0x3f5579)[_0xa5b3('0x1b')]();};}function respondWithResult(_0x454e4d,_0x555034){_0x555034=_0x555034||0xc8;return function(_0x2ccd8a){if(_0x2ccd8a){return _0x454e4d['status'](_0x555034)['json'](_0x2ccd8a);}};}function respondWithFilteredResult(_0x32c92f,_0x1a3cf6){return function(_0x8d332e){if(_0x8d332e){var _0x1b802d=typeof _0x1a3cf6[_0xa5b3('0x1c')]===_0xa5b3('0x1d')&&typeof _0x1a3cf6['limit']===_0xa5b3('0x1d');var _0x58a817=_0x8d332e[_0xa5b3('0x1e')];var _0x1fe609=_0x1b802d?0x0:_0x1a3cf6[_0xa5b3('0x1c')];var _0x4101f8=_0x1b802d?_0x8d332e[_0xa5b3('0x1e')]:_0x1a3cf6['offset']+_0x1a3cf6[_0xa5b3('0x1f')];var _0x25e219;if(_0x4101f8>=_0x58a817){_0x4101f8=_0x58a817;_0x25e219=0xc8;}else{_0x25e219=0xce;}_0x32c92f[_0xa5b3('0x1a')](_0x25e219);return _0x32c92f['set'](_0xa5b3('0x20'),_0x1fe609+'-'+_0x4101f8+'/'+_0x58a817)[_0xa5b3('0x21')](_0x8d332e);}return null;};}function patchUpdates(_0x597284){return function(_0x41226e){try{jsonpatch[_0xa5b3('0x22')](_0x41226e,_0x597284,!![]);}catch(_0x88a720){return BPromise['reject'](_0x88a720);}return _0x41226e['save']();};}function saveUpdates(_0x57aa08,_0x402178){return function(_0xacda5){if(_0xacda5){return _0xacda5[_0xa5b3('0x23')](_0x57aa08)['then'](function(_0x3cf252){return _0x3cf252;});}return null;};}function removeEntity(_0x1c60e7,_0x338142){return function(_0x2cbab8){if(_0x2cbab8){return _0x2cbab8[_0xa5b3('0x24')]()['then'](function(){_0x1c60e7[_0xa5b3('0x1a')](0xcc)[_0xa5b3('0x1b')]();});}};}function handleEntityNotFound(_0x58588a,_0x278ec2){return function(_0x40f355){if(!_0x40f355){_0x58588a[_0xa5b3('0x19')](0x194);}return _0x40f355;};}function handleError(_0x3a8c0b,_0x72382b){_0x72382b=_0x72382b||0x1f4;return function(_0x4ea0bb){logger[_0xa5b3('0x25')](_0x4ea0bb['stack']);if(_0x4ea0bb[_0xa5b3('0x26')]){delete _0x4ea0bb['name'];}_0x3a8c0b[_0xa5b3('0x1a')](_0x72382b)[_0xa5b3('0x27')](_0x4ea0bb);};}exports['index']=function(_0x126481,_0x2660f4){var _0x11b602={},_0x31789={},_0x594886={'count':0x0,'rows':[]};var _0x365f03=_['map'](db['SmsQueueReport'][_0xa5b3('0x28')],function(_0x2d25ea){return{'name':_0x2d25ea[_0xa5b3('0x29')],'type':_0x2d25ea[_0xa5b3('0x2a')][_0xa5b3('0x2b')]};});_0x31789[_0xa5b3('0x2c')]=_[_0xa5b3('0x2d')](_0x365f03,'name');_0x31789[_0xa5b3('0x2e')]=_[_0xa5b3('0x2f')](_0x126481['query']);_0x31789['filters']=_[_0xa5b3('0x30')](_0x31789[_0xa5b3('0x2c')],_0x31789[_0xa5b3('0x2e')]);_0x11b602[_0xa5b3('0x31')]=_[_0xa5b3('0x30')](_0x31789[_0xa5b3('0x2c')],qs['fields'](_0x126481[_0xa5b3('0x2e')]['fields']));_0x11b602[_0xa5b3('0x31')]=_0x11b602[_0xa5b3('0x31')][_0xa5b3('0x32')]?_0x11b602[_0xa5b3('0x31')]:_0x31789['model'];if(!_0x126481[_0xa5b3('0x2e')][_0xa5b3('0x33')]('nolimit')){_0x11b602[_0xa5b3('0x1f')]=qs[_0xa5b3('0x1f')](_0x126481[_0xa5b3('0x2e')][_0xa5b3('0x1f')]);_0x11b602[_0xa5b3('0x1c')]=qs[_0xa5b3('0x1c')](_0x126481['query'][_0xa5b3('0x1c')]);}_0x11b602[_0xa5b3('0x34')]=qs[_0xa5b3('0x35')](_0x126481[_0xa5b3('0x2e')][_0xa5b3('0x35')]);_0x11b602[_0xa5b3('0x36')]=qs[_0xa5b3('0x37')](_[_0xa5b3('0x38')](_0x126481[_0xa5b3('0x2e')],_0x31789['filters']),_0x365f03);if(_0x126481[_0xa5b3('0x2e')][_0xa5b3('0x39')]){_0x11b602[_0xa5b3('0x36')]=_['merge'](_0x11b602['where'],{'$or':_[_0xa5b3('0x2d')](_0x365f03,function(_0x52b1dd){if(_0x52b1dd['type']!==_0xa5b3('0x3a')){var _0x302d26={};_0x302d26[_0x52b1dd[_0xa5b3('0x26')]]={'$like':'%'+_0x126481[_0xa5b3('0x2e')]['filter']+'%'};return _0x302d26;}})});}_0x11b602=_['merge']({},_0x11b602,_0x126481['options']);var _0x2e5465={'where':_0x11b602[_0xa5b3('0x36')]};return db['SmsQueueReport'][_0xa5b3('0x1e')](_0x2e5465)[_0xa5b3('0x3b')](function(_0x3fa1da){_0x594886['count']=_0x3fa1da;if(_0x126481['query']['includeAll']){_0x11b602['include']=[{'all':!![]}];}return db[_0xa5b3('0x3c')][_0xa5b3('0x3d')](_0x11b602);})[_0xa5b3('0x3b')](function(_0xc41040){_0x594886[_0xa5b3('0x3e')]=_0xc41040;return _0x594886;})['then'](respondWithFilteredResult(_0x2660f4,_0x11b602))['catch'](handleError(_0x2660f4,null));};exports[_0xa5b3('0x3f')]=function(_0x4f1417,_0x4369df){var _0x5be12f={'raw':!![],'where':{'id':_0x4f1417['params']['id']}},_0x4aa771={};_0x4aa771['model']=_[_0xa5b3('0x2f')](db['SmsQueueReport'][_0xa5b3('0x28')]);_0x4aa771[_0xa5b3('0x2e')]=_['keys'](_0x4f1417[_0xa5b3('0x2e')]);_0x4aa771[_0xa5b3('0x37')]=_['intersection'](_0x4aa771['model'],_0x4aa771[_0xa5b3('0x2e')]);_0x5be12f[_0xa5b3('0x31')]=_[_0xa5b3('0x30')](_0x4aa771[_0xa5b3('0x2c')],qs['fields'](_0x4f1417['query']['fields']));_0x5be12f['attributes']=_0x5be12f['attributes'][_0xa5b3('0x32')]?_0x5be12f['attributes']:_0x4aa771[_0xa5b3('0x2c')];if(_0x4f1417[_0xa5b3('0x2e')][_0xa5b3('0x40')]){_0x5be12f[_0xa5b3('0x41')]=[{'all':!![]}];}_0x5be12f=_['merge']({},_0x5be12f,_0x4f1417[_0xa5b3('0x42')]);return db[_0xa5b3('0x3c')][_0xa5b3('0x43')](_0x5be12f)[_0xa5b3('0x3b')](handleEntityNotFound(_0x4369df,null))['then'](respondWithResult(_0x4369df,null))[_0xa5b3('0x44')](handleError(_0x4369df,null));};exports[_0xa5b3('0x45')]=function(_0x18434e,_0x15254e){return db[_0xa5b3('0x3c')]['create'](_0x18434e[_0xa5b3('0x46')],{})['then'](respondWithResult(_0x15254e,0xc9))['catch'](handleError(_0x15254e,null));};exports[_0xa5b3('0x23')]=function(_0x139008,_0x4ecc59){if(_0x139008[_0xa5b3('0x46')]['id']){delete _0x139008[_0xa5b3('0x46')]['id'];}return db[_0xa5b3('0x3c')][_0xa5b3('0x43')]({'where':{'id':_0x139008[_0xa5b3('0x47')]['id']}})[_0xa5b3('0x3b')](handleEntityNotFound(_0x4ecc59,null))[_0xa5b3('0x3b')](saveUpdates(_0x139008[_0xa5b3('0x46')],null))[_0xa5b3('0x3b')](respondWithResult(_0x4ecc59,null))[_0xa5b3('0x44')](handleError(_0x4ecc59,null));};exports['destroy']=function(_0x2e7ef8,_0x569d66){return db[_0xa5b3('0x3c')]['find']({'where':{'id':_0x2e7ef8[_0xa5b3('0x47')]['id']}})[_0xa5b3('0x3b')](handleEntityNotFound(_0x569d66,null))[_0xa5b3('0x3b')](removeEntity(_0x569d66,null))['catch'](handleError(_0x569d66,null));};exports[_0xa5b3('0x48')]=function(_0x2a6822,_0x471df3){return db[_0xa5b3('0x3c')]['describe']()['then'](respondWithResult(_0x471df3,null))['catch'](handleError(_0x471df3,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 561fda4..934cec7 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(_0x2e16cf,_0x1c316a){var _0xee07d=function(_0x46799c){while(--_0x46799c){_0x2e16cf['push'](_0x2e16cf['shift']());}};_0xee07d(++_0x1c316a);}(_0xbaf0,0x12a));var _0x0baf=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xbaf0[_0x5ddb1c];return _0x354adc;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));module[_0x0baf('0x9')]=function(_0xe4c3c4,_0x335e24){return _0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb'),attributes,{'tableName':_0x0baf('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0baf('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb7e7=['../../config/logger','moment','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','define','SmsQueueReport','uniqueid','lodash'];(function(_0x4f260d,_0x19f7d9){var _0x355d2a=function(_0xcacd19){while(--_0xcacd19){_0x4f260d['push'](_0x4f260d['shift']());}};_0x355d2a(++_0x19f7d9);}(_0xb7e7,0x121));var _0x7b7e=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0xb7e7[_0x4b2863];return _0x567d67;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));module['exports']=function(_0x53ed64,_0x333fa4){return _0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x8'),attributes,{'tableName':'report_sms_queue','paranoid':![],'indexes':[{'name':_0x7b7e('0x9'),'fields':[_0x7b7e('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index db71726..21d37b2 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 _0x9c4a=['SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateSmsQueueReport','SmsQueueReport','create','body','options','raw','stringify','update','where','attributes','limit','UpdateSmsQueueReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info'];(function(_0x590b63,_0x14debb){var _0x3c9380=function(_0x58fc67){while(--_0x58fc67){_0x590b63['push'](_0x590b63['shift']());}};_0x3c9380(++_0x14debb);}(_0x9c4a,0x1ac));var _0xa9c4=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0x9c4a[_0x29d94e];return _0x106237;};'use strict';var _=require(_0xa9c4('0x0'));var util=require(_0xa9c4('0x1'));var moment=require(_0xa9c4('0x2'));var BPromise=require(_0xa9c4('0x3'));var rs=require(_0xa9c4('0x4'));var fs=require('fs');var Redis=require(_0xa9c4('0x5'));var db=require(_0xa9c4('0x6'))['db'];var utils=require(_0xa9c4('0x7'));var logger=require(_0xa9c4('0x8'))(_0xa9c4('0x9'));var config=require(_0xa9c4('0xa'));var jayson=require(_0xa9c4('0xb'));var client=jayson[_0xa9c4('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5b4a0b,_0x488523,_0x2ce4fa){return new BPromise(function(_0xe08142,_0x5d2c37){return client[_0xa9c4('0xd')](_0x5b4a0b,_0x2ce4fa)[_0xa9c4('0xe')](function(_0x478c3d){logger[_0xa9c4('0xf')](_0xa9c4('0x10'),_0x488523,_0xa9c4('0x11'));logger[_0xa9c4('0x12')](_0xa9c4('0x13'),_0x488523,_0xa9c4('0x11'),JSON['stringify'](_0x478c3d));if(_0x478c3d['error']){if(_0x478c3d[_0xa9c4('0x14')][_0xa9c4('0x15')]===0x1f4){logger['error'](_0xa9c4('0x10'),_0x488523,_0x478c3d[_0xa9c4('0x14')][_0xa9c4('0x16')]);return _0x5d2c37(_0x478c3d['error'][_0xa9c4('0x16')]);}logger[_0xa9c4('0x14')](_0xa9c4('0x10'),_0x488523,_0x478c3d[_0xa9c4('0x14')][_0xa9c4('0x16')]);return _0xe08142(_0x478c3d[_0xa9c4('0x14')][_0xa9c4('0x16')]);}else{logger[_0xa9c4('0xf')](_0xa9c4('0x10'),_0x488523,_0xa9c4('0x11'));_0xe08142(_0x478c3d[_0xa9c4('0x17')][_0xa9c4('0x16')]);}})[_0xa9c4('0x18')](function(_0xae01a8){logger[_0xa9c4('0x14')](_0xa9c4('0x10'),_0x488523,_0xae01a8);_0x5d2c37(_0xae01a8);});});}exports[_0xa9c4('0x19')]=function(_0x67da54){var _0x8131c0=this;return new Promise(function(_0x49022d,_0x515efe){return db[_0xa9c4('0x1a')][_0xa9c4('0x1b')](_0x67da54[_0xa9c4('0x1c')],{'raw':_0x67da54[_0xa9c4('0x1d')]?_0x67da54[_0xa9c4('0x1d')][_0xa9c4('0x1e')]===undefined?!![]:![]:!![]})[_0xa9c4('0xe')](function(_0x1b54bf){logger['info'](_0xa9c4('0x19'),_0x67da54);logger['debug']('CreateSmsQueueReport',_0x67da54,JSON[_0xa9c4('0x1f')](_0x1b54bf));_0x49022d(_0x1b54bf);})['catch'](function(_0x36d6f3){logger[_0xa9c4('0x14')](_0xa9c4('0x19'),_0x36d6f3[_0xa9c4('0x16')],_0x67da54);_0x515efe(_0x8131c0[_0xa9c4('0x14')](0x1f4,_0x36d6f3[_0xa9c4('0x16')]));});});};exports['UpdateSmsQueueReport']=function(_0x41ccf9){var _0x2567b8=this;return new Promise(function(_0x5adbd9,_0xadb8d){return db['SmsQueueReport'][_0xa9c4('0x20')](_0x41ccf9[_0xa9c4('0x1c')],{'raw':_0x41ccf9[_0xa9c4('0x1d')]?_0x41ccf9[_0xa9c4('0x1d')][_0xa9c4('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x41ccf9[_0xa9c4('0x1d')]?_0x41ccf9['options'][_0xa9c4('0x21')]||null:null,'attributes':_0x41ccf9['options']?_0x41ccf9[_0xa9c4('0x1d')][_0xa9c4('0x22')]||null:null,'limit':_0x41ccf9['options']?_0x41ccf9[_0xa9c4('0x1d')][_0xa9c4('0x23')]||null:null})[_0xa9c4('0xe')](function(_0x475be4){logger['info'](_0xa9c4('0x24'),_0x41ccf9);logger[_0xa9c4('0x12')](_0xa9c4('0x24'),_0x41ccf9,JSON[_0xa9c4('0x1f')](_0x475be4));_0x5adbd9(_0x475be4);})[_0xa9c4('0x18')](function(_0xd4f175){logger[_0xa9c4('0x14')](_0xa9c4('0x24'),_0xd4f175[_0xa9c4('0x16')],_0x41ccf9);_0xadb8d(_0x2567b8[_0xa9c4('0x14')](0x1f4,_0xd4f175[_0xa9c4('0x16')]));});});}; \ No newline at end of file +var _0x06f5=['error','code','SmsQueueReport,\x20%s,\x20%s','message','CreateSmsQueueReport','SmsQueueReport','create','body','options','raw','catch','UpdateSmsQueueReport','where','attributes','limit','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4d0be9,_0x37184c){var _0x1de2c7=function(_0x32b7ea){while(--_0x32b7ea){_0x4d0be9['push'](_0x4d0be9['shift']());}};_0x1de2c7(++_0x37184c);}(_0x06f5,0x93));var _0x506f=function(_0x575cf7,_0x1180cf){_0x575cf7=_0x575cf7-0x0;var _0x2e5e54=_0x06f5[_0x575cf7];return _0x2e5e54;};'use strict';var _=require(_0x506f('0x0'));var util=require('util');var moment=require(_0x506f('0x1'));var BPromise=require('bluebird');var rs=require(_0x506f('0x2'));var fs=require('fs');var Redis=require(_0x506f('0x3'));var db=require(_0x506f('0x4'))['db'];var utils=require(_0x506f('0x5'));var logger=require(_0x506f('0x6'))(_0x506f('0x7'));var config=require(_0x506f('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x506f('0x9')][_0x506f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d47e3,_0x38457b,_0x178d4a){return new BPromise(function(_0x1627ce,_0x16f3f7){return client[_0x506f('0xb')](_0x1d47e3,_0x178d4a)[_0x506f('0xc')](function(_0x9e7232){logger[_0x506f('0xd')]('SmsQueueReport,\x20%s,\x20%s',_0x38457b,_0x506f('0xe'));logger[_0x506f('0xf')](_0x506f('0x10'),_0x38457b,'request\x20sent',JSON[_0x506f('0x11')](_0x9e7232));if(_0x9e7232[_0x506f('0x12')]){if(_0x9e7232[_0x506f('0x12')][_0x506f('0x13')]===0x1f4){logger[_0x506f('0x12')](_0x506f('0x14'),_0x38457b,_0x9e7232[_0x506f('0x12')][_0x506f('0x15')]);return _0x16f3f7(_0x9e7232[_0x506f('0x12')]['message']);}logger['error'](_0x506f('0x14'),_0x38457b,_0x9e7232['error'][_0x506f('0x15')]);return _0x1627ce(_0x9e7232[_0x506f('0x12')][_0x506f('0x15')]);}else{logger[_0x506f('0xd')]('SmsQueueReport,\x20%s,\x20%s',_0x38457b,_0x506f('0xe'));_0x1627ce(_0x9e7232['result'][_0x506f('0x15')]);}})['catch'](function(_0x5b7762){logger['error'](_0x506f('0x14'),_0x38457b,_0x5b7762);_0x16f3f7(_0x5b7762);});});}exports[_0x506f('0x16')]=function(_0x4a16ca){var _0x53122d=this;return new Promise(function(_0x46a348,_0x5503de){return db[_0x506f('0x17')][_0x506f('0x18')](_0x4a16ca[_0x506f('0x19')],{'raw':_0x4a16ca['options']?_0x4a16ca[_0x506f('0x1a')][_0x506f('0x1b')]===undefined?!![]:![]:!![]})[_0x506f('0xc')](function(_0x151421){logger['info']('CreateSmsQueueReport',_0x4a16ca);logger[_0x506f('0xf')](_0x506f('0x16'),_0x4a16ca,JSON[_0x506f('0x11')](_0x151421));_0x46a348(_0x151421);})[_0x506f('0x1c')](function(_0x353340){logger['error'](_0x506f('0x16'),_0x353340[_0x506f('0x15')],_0x4a16ca);_0x5503de(_0x53122d[_0x506f('0x12')](0x1f4,_0x353340[_0x506f('0x15')]));});});};exports[_0x506f('0x1d')]=function(_0x236e79){var _0xc14da1=this;return new Promise(function(_0x122f62,_0x2c23d1){return db[_0x506f('0x17')]['update'](_0x236e79[_0x506f('0x19')],{'raw':_0x236e79[_0x506f('0x1a')]?_0x236e79[_0x506f('0x1a')][_0x506f('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x236e79[_0x506f('0x1a')]?_0x236e79[_0x506f('0x1a')][_0x506f('0x1e')]||null:null,'attributes':_0x236e79['options']?_0x236e79[_0x506f('0x1a')][_0x506f('0x1f')]||null:null,'limit':_0x236e79[_0x506f('0x1a')]?_0x236e79[_0x506f('0x1a')][_0x506f('0x20')]||null:null})[_0x506f('0xc')](function(_0x54b7bd){logger[_0x506f('0xd')](_0x506f('0x1d'),_0x236e79);logger[_0x506f('0xf')](_0x506f('0x1d'),_0x236e79,JSON[_0x506f('0x11')](_0x54b7bd));_0x122f62(_0x54b7bd);})[_0x506f('0x1c')](function(_0x4180ff){logger[_0x506f('0x12')]('UpdateSmsQueueReport',_0x4180ff['message'],_0x236e79);_0x2c23d1(_0xc14da1[_0x506f('0x12')](0x1f4,_0x4180ff[_0x506f('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 16a70d4..a9276fe 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 _0xf767=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','isAuthenticated','index','get','/describe','/:id','show','put','update','delete','destroy','exports','util','path'];(function(_0x38ced4,_0x24263f){var _0x547c07=function(_0x279fc4){while(--_0x279fc4){_0x38ced4['push'](_0x38ced4['shift']());}};_0x547c07(++_0x24263f);}(_0xf767,0x76));var _0x7f76=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xf767[_0x45e98e];return _0x374dba;};'use strict';var multer=require('multer');var util=require(_0x7f76('0x0'));var path=require(_0x7f76('0x1'));var timeout=require(_0x7f76('0x2'));var express=require(_0x7f76('0x3'));var router=express[_0x7f76('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x7f76('0x5'));var interaction=require(_0x7f76('0x6'));var config=require(_0x7f76('0x7'));var controller=require(_0x7f76('0x8'));router['get']('/',auth[_0x7f76('0x9')](),controller[_0x7f76('0xa')]);router[_0x7f76('0xb')](_0x7f76('0xc'),auth[_0x7f76('0x9')](),controller['describe']);router[_0x7f76('0xb')](_0x7f76('0xd'),auth[_0x7f76('0x9')](),controller[_0x7f76('0xe')]);router['post']('/',auth[_0x7f76('0x9')](),controller['create']);router[_0x7f76('0xf')](_0x7f76('0xd'),auth[_0x7f76('0x9')](),controller[_0x7f76('0x10')]);router[_0x7f76('0x11')](_0x7f76('0xd'),auth['isAuthenticated'](),controller[_0x7f76('0x12')]);module[_0x7f76('0x13')]=router; \ No newline at end of file +var _0xcb66=['../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get','/describe','isAuthenticated','describe','/:id','show','post','create','put','destroy','exports','util','path','connect-timeout','express','Router'];(function(_0x25d022,_0x560323){var _0x3593d5=function(_0x1152b6){while(--_0x1152b6){_0x25d022['push'](_0x25d022['shift']());}};_0x3593d5(++_0x560323);}(_0xcb66,0x19f));var _0x6cb6=function(_0x9b7a64,_0x38d4a8){_0x9b7a64=_0x9b7a64-0x0;var _0x33fd98=_0xcb66[_0x9b7a64];return _0x33fd98;};'use strict';var multer=require('multer');var util=require(_0x6cb6('0x0'));var path=require(_0x6cb6('0x1'));var timeout=require(_0x6cb6('0x2'));var express=require(_0x6cb6('0x3'));var router=express[_0x6cb6('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x6cb6('0x5'));var interaction=require(_0x6cb6('0x6'));var config=require(_0x6cb6('0x7'));var controller=require(_0x6cb6('0x8'));router[_0x6cb6('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x6cb6('0x9')](_0x6cb6('0xa'),auth[_0x6cb6('0xb')](),controller[_0x6cb6('0xc')]);router[_0x6cb6('0x9')](_0x6cb6('0xd'),auth[_0x6cb6('0xb')](),controller[_0x6cb6('0xe')]);router[_0x6cb6('0xf')]('/',auth[_0x6cb6('0xb')](),controller[_0x6cb6('0x10')]);router[_0x6cb6('0x11')](_0x6cb6('0xd'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x6cb6('0xb')](),controller[_0x6cb6('0x12')]);module[_0x6cb6('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 0f3576c..b1977f0 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 _0x54ef=['agent','queue','DATE','NOW','moment','sequelize','exports','ENUM','account'];(function(_0x36b2c5,_0x5eaf9a){var _0x919462=function(_0x54bbbf){while(--_0x54bbbf){_0x36b2c5['push'](_0x36b2c5['shift']());}};_0x919462(++_0x5eaf9a);}(_0x54ef,0x112));var _0xf54e=function(_0x3bdf42,_0x22a816){_0x3bdf42=_0x3bdf42-0x0;var _0x457fff=_0x54ef[_0x3bdf42];return _0x457fff;};'use strict';var moment=require(_0xf54e('0x0'));var Sequelize=require(_0xf54e('0x1'));module[_0xf54e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xf54e('0x3')](_0xf54e('0x4'),_0xf54e('0x5'),_0xf54e('0x6')),'allowNull':![],'defaultValue':_0xf54e('0x6')},'transferredAt':{'type':Sequelize[_0xf54e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xf54e('0x8')]}}; \ No newline at end of file +var _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x432259,_0x23fdba){var _0x47b232=function(_0x57f178){while(--_0x57f178){_0x432259['push'](_0x432259['shift']());}};_0x47b232(++_0x23fdba);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xa9e0[_0x5e3b04];return _0x1fc44d;};'use strict';var moment=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'agent',_0x0a9e('0x4')),'allowNull':![],'defaultValue':_0x0a9e('0x4')},'transferredAt':{'type':Sequelize[_0x0a9e('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x0a9e('0x6')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 814d0e4..05152a2 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 _0xd038=['path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','error','name','index','SmsTransferReport','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','options','include','findAll','includeAll','find','catch','create','body','params','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util'];(function(_0x2bfd90,_0x102539){var _0x33e709=function(_0x198f74){while(--_0x198f74){_0x2bfd90['push'](_0x2bfd90['shift']());}};_0x33e709(++_0x102539);}(_0xd038,0x166));var _0x8d03=function(_0x151381,_0x97b314){_0x151381=_0x151381-0x0;var _0x2afab6=_0xd038[_0x151381];return _0x2afab6;};'use strict';var emlformat=require(_0x8d03('0x0'));var rimraf=require(_0x8d03('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8d03('0x2'));var rp=require(_0x8d03('0x3'));var moment=require(_0x8d03('0x4'));var BPromise=require(_0x8d03('0x5'));var Mustache=require('mustache');var util=require(_0x8d03('0x6'));var path=require(_0x8d03('0x7'));var sox=require('sox');var csv=require(_0x8d03('0x8'));var ejs=require(_0x8d03('0x9'));var fs=require('fs');var fs_extra=require(_0x8d03('0xa'));var _=require(_0x8d03('0xb'));var squel=require('squel');var crypto=require(_0x8d03('0xc'));var jsforce=require(_0x8d03('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x8d03('0x8'));var querystring=require(_0x8d03('0xe'));var Papa=require(_0x8d03('0xf'));var Redis=require(_0x8d03('0x10'));var authService=require(_0x8d03('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x8d03('0x12'));var hardwareService=require(_0x8d03('0x13'));var logger=require(_0x8d03('0x14'))(_0x8d03('0x15'));var utils=require(_0x8d03('0x16'));var config=require(_0x8d03('0x17'));var licenseUtil=require(_0x8d03('0x18'));var db=require(_0x8d03('0x19'))['db'];function respondWithStatusCode(_0x4cf924,_0x3ff863){_0x3ff863=_0x3ff863||0xcc;return function(_0x12142d){if(_0x12142d){return _0x4cf924['sendStatus'](_0x3ff863);}return _0x4cf924[_0x8d03('0x1a')](_0x3ff863)['end']();};}function respondWithResult(_0x37d2ca,_0x5f0f8d){_0x5f0f8d=_0x5f0f8d||0xc8;return function(_0x21aaad){if(_0x21aaad){return _0x37d2ca[_0x8d03('0x1a')](_0x5f0f8d)[_0x8d03('0x1b')](_0x21aaad);}};}function respondWithFilteredResult(_0x234743,_0x57395e){return function(_0x4f782d){if(_0x4f782d){var _0x37a12a=typeof _0x57395e[_0x8d03('0x1c')]==='undefined'&&typeof _0x57395e[_0x8d03('0x1d')]===_0x8d03('0x1e');var _0x109577=_0x4f782d['count'];var _0x4ca704=_0x37a12a?0x0:_0x57395e['offset'];var _0x620f87=_0x37a12a?_0x4f782d[_0x8d03('0x1f')]:_0x57395e[_0x8d03('0x1c')]+_0x57395e[_0x8d03('0x1d')];var _0x45cedd;if(_0x620f87>=_0x109577){_0x620f87=_0x109577;_0x45cedd=0xc8;}else{_0x45cedd=0xce;}_0x234743[_0x8d03('0x1a')](_0x45cedd);return _0x234743[_0x8d03('0x20')](_0x8d03('0x21'),_0x4ca704+'-'+_0x620f87+'/'+_0x109577)['json'](_0x4f782d);}return null;};}function patchUpdates(_0x3aeb00){return function(_0x3cecef){try{jsonpatch[_0x8d03('0x22')](_0x3cecef,_0x3aeb00,!![]);}catch(_0x16868f){return BPromise[_0x8d03('0x23')](_0x16868f);}return _0x3cecef[_0x8d03('0x24')]();};}function saveUpdates(_0x4fe82e,_0x6ff3fb){return function(_0x34c012){if(_0x34c012){return _0x34c012[_0x8d03('0x25')](_0x4fe82e)['then'](function(_0xe867ee){return _0xe867ee;});}return null;};}function removeEntity(_0x3b8ac8,_0x1d9e18){return function(_0xa19eeb){if(_0xa19eeb){return _0xa19eeb[_0x8d03('0x26')]()[_0x8d03('0x27')](function(){_0x3b8ac8[_0x8d03('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x6a6adc,_0x1c801c){return function(_0x53cb7a){if(!_0x53cb7a){_0x6a6adc[_0x8d03('0x28')](0x194);}return _0x53cb7a;};}function handleError(_0x5396c6,_0x2d82f1){_0x2d82f1=_0x2d82f1||0x1f4;return function(_0x6e8443){logger[_0x8d03('0x29')](_0x6e8443['stack']);if(_0x6e8443[_0x8d03('0x2a')]){delete _0x6e8443[_0x8d03('0x2a')];}_0x5396c6['status'](_0x2d82f1)['send'](_0x6e8443);};}exports[_0x8d03('0x2b')]=function(_0x2f0646,_0x4ec4b4){var _0x3b4512={},_0x37b3fd={},_0xde7dfc={'count':0x0,'rows':[]};var _0x52b961=_['map'](db[_0x8d03('0x2c')]['rawAttributes'],function(_0x512be7){return{'name':_0x512be7[_0x8d03('0x2d')],'type':_0x512be7[_0x8d03('0x2e')][_0x8d03('0x2f')]};});_0x37b3fd[_0x8d03('0x30')]=_[_0x8d03('0x31')](_0x52b961,_0x8d03('0x2a'));_0x37b3fd[_0x8d03('0x32')]=_[_0x8d03('0x33')](_0x2f0646[_0x8d03('0x32')]);_0x37b3fd[_0x8d03('0x34')]=_[_0x8d03('0x35')](_0x37b3fd['model'],_0x37b3fd[_0x8d03('0x32')]);_0x3b4512[_0x8d03('0x36')]=_[_0x8d03('0x35')](_0x37b3fd[_0x8d03('0x30')],qs['fields'](_0x2f0646[_0x8d03('0x32')][_0x8d03('0x37')]));_0x3b4512[_0x8d03('0x36')]=_0x3b4512[_0x8d03('0x36')][_0x8d03('0x38')]?_0x3b4512[_0x8d03('0x36')]:_0x37b3fd['model'];if(!_0x2f0646['query'][_0x8d03('0x39')](_0x8d03('0x3a'))){_0x3b4512[_0x8d03('0x1d')]=qs[_0x8d03('0x1d')](_0x2f0646[_0x8d03('0x32')][_0x8d03('0x1d')]);_0x3b4512[_0x8d03('0x1c')]=qs[_0x8d03('0x1c')](_0x2f0646[_0x8d03('0x32')][_0x8d03('0x1c')]);}_0x3b4512['order']=qs[_0x8d03('0x3b')](_0x2f0646['query'][_0x8d03('0x3b')]);_0x3b4512['where']=qs['filters'](_['pick'](_0x2f0646[_0x8d03('0x32')],_0x37b3fd['filters']),_0x52b961);if(_0x2f0646[_0x8d03('0x32')]['filter']){_0x3b4512[_0x8d03('0x3c')]=_[_0x8d03('0x3d')](_0x3b4512[_0x8d03('0x3c')],{'$or':_[_0x8d03('0x31')](_0x52b961,function(_0x3b489b){if(_0x3b489b['type']!==_0x8d03('0x3e')){var _0x4e2133={};_0x4e2133[_0x3b489b[_0x8d03('0x2a')]]={'$like':'%'+_0x2f0646[_0x8d03('0x32')]['filter']+'%'};return _0x4e2133;}})});}_0x3b4512=_[_0x8d03('0x3d')]({},_0x3b4512,_0x2f0646[_0x8d03('0x3f')]);var _0x49667f={'where':_0x3b4512[_0x8d03('0x3c')]};return db[_0x8d03('0x2c')]['count'](_0x49667f)[_0x8d03('0x27')](function(_0x267c67){_0xde7dfc[_0x8d03('0x1f')]=_0x267c67;if(_0x2f0646[_0x8d03('0x32')]['includeAll']){_0x3b4512[_0x8d03('0x40')]=[{'all':!![]}];}return db[_0x8d03('0x2c')][_0x8d03('0x41')](_0x3b4512);})[_0x8d03('0x27')](function(_0x4fa4ba){_0xde7dfc['rows']=_0x4fa4ba;return _0xde7dfc;})[_0x8d03('0x27')](respondWithFilteredResult(_0x4ec4b4,_0x3b4512))['catch'](handleError(_0x4ec4b4,null));};exports['show']=function(_0x3cb593,_0x33766d){var _0x37e3a4={'raw':!![],'where':{'id':_0x3cb593['params']['id']}},_0x2a48d5={};_0x2a48d5[_0x8d03('0x30')]=_[_0x8d03('0x33')](db[_0x8d03('0x2c')]['rawAttributes']);_0x2a48d5[_0x8d03('0x32')]=_[_0x8d03('0x33')](_0x3cb593['query']);_0x2a48d5[_0x8d03('0x34')]=_[_0x8d03('0x35')](_0x2a48d5['model'],_0x2a48d5[_0x8d03('0x32')]);_0x37e3a4[_0x8d03('0x36')]=_['intersection'](_0x2a48d5['model'],qs[_0x8d03('0x37')](_0x3cb593[_0x8d03('0x32')][_0x8d03('0x37')]));_0x37e3a4[_0x8d03('0x36')]=_0x37e3a4[_0x8d03('0x36')][_0x8d03('0x38')]?_0x37e3a4[_0x8d03('0x36')]:_0x2a48d5[_0x8d03('0x30')];if(_0x3cb593[_0x8d03('0x32')][_0x8d03('0x42')]){_0x37e3a4[_0x8d03('0x40')]=[{'all':!![]}];}_0x37e3a4=_[_0x8d03('0x3d')]({},_0x37e3a4,_0x3cb593[_0x8d03('0x3f')]);return db[_0x8d03('0x2c')][_0x8d03('0x43')](_0x37e3a4)['then'](handleEntityNotFound(_0x33766d,null))[_0x8d03('0x27')](respondWithResult(_0x33766d,null))[_0x8d03('0x44')](handleError(_0x33766d,null));};exports[_0x8d03('0x45')]=function(_0x691451,_0x1135fa){return db[_0x8d03('0x2c')][_0x8d03('0x45')](_0x691451['body'],{})['then'](respondWithResult(_0x1135fa,0xc9))[_0x8d03('0x44')](handleError(_0x1135fa,null));};exports[_0x8d03('0x25')]=function(_0x5c3040,_0x1eabb4){if(_0x5c3040['body']['id']){delete _0x5c3040[_0x8d03('0x46')]['id'];}return db['SmsTransferReport']['find']({'where':{'id':_0x5c3040['params']['id']}})[_0x8d03('0x27')](handleEntityNotFound(_0x1eabb4,null))[_0x8d03('0x27')](saveUpdates(_0x5c3040[_0x8d03('0x46')],null))[_0x8d03('0x27')](respondWithResult(_0x1eabb4,null))[_0x8d03('0x44')](handleError(_0x1eabb4,null));};exports['destroy']=function(_0x4cb185,_0x16d294){return db[_0x8d03('0x2c')][_0x8d03('0x43')]({'where':{'id':_0x4cb185[_0x8d03('0x47')]['id']}})[_0x8d03('0x27')](handleEntityNotFound(_0x16d294,null))[_0x8d03('0x27')](removeEntity(_0x16d294,null))[_0x8d03('0x44')](handleError(_0x16d294,null));};exports[_0x8d03('0x48')]=function(_0x5125c5,_0x177562){return db[_0x8d03('0x2c')][_0x8d03('0x48')]()['then'](respondWithResult(_0x177562,null))['catch'](handleError(_0x177562,null));}; \ No newline at end of file +var _0x07ea=['hasOwnProperty','nolimit','sort','where','pick','merge','map','include','findAll','rows','catch','show','rawAttributes','length','includeAll','create','body','find','params','describe','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','to-csv','ejs','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','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','then','destroy','stack','name','send','index','SmsTransferReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields'];(function(_0x375d6f,_0x27308e){var _0x598dd7=function(_0x2f4523){while(--_0x2f4523){_0x375d6f['push'](_0x375d6f['shift']());}};_0x598dd7(++_0x27308e);}(_0x07ea,0x177));var _0xa07e=function(_0x55253a,_0x711a4f){_0x55253a=_0x55253a-0x0;var _0x1bc913=_0x07ea[_0x55253a];return _0x1bc913;};'use strict';var emlformat=require(_0xa07e('0x0'));var rimraf=require(_0xa07e('0x1'));var zipdir=require(_0xa07e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa07e('0x3'));var BPromise=require(_0xa07e('0x4'));var Mustache=require(_0xa07e('0x5'));var util=require(_0xa07e('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xa07e('0x7'));var ejs=require(_0xa07e('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa07e('0x9'));var squel=require(_0xa07e('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa07e('0x7'));var querystring=require(_0xa07e('0xb'));var Papa=require(_0xa07e('0xc'));var Redis=require(_0xa07e('0xd'));var authService=require(_0xa07e('0xe'));var qs=require(_0xa07e('0xf'));var as=require(_0xa07e('0x10'));var hardwareService=require(_0xa07e('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0xa07e('0x12'));var config=require(_0xa07e('0x13'));var licenseUtil=require(_0xa07e('0x14'));var db=require(_0xa07e('0x15'))['db'];function respondWithStatusCode(_0x37facf,_0x4f0033){_0x4f0033=_0x4f0033||0xcc;return function(_0x2e2d45){if(_0x2e2d45){return _0x37facf[_0xa07e('0x16')](_0x4f0033);}return _0x37facf[_0xa07e('0x17')](_0x4f0033)[_0xa07e('0x18')]();};}function respondWithResult(_0x14c595,_0x409ee1){_0x409ee1=_0x409ee1||0xc8;return function(_0x2f0860){if(_0x2f0860){return _0x14c595[_0xa07e('0x17')](_0x409ee1)[_0xa07e('0x19')](_0x2f0860);}};}function respondWithFilteredResult(_0x42250e,_0x5f003a){return function(_0x288d47){if(_0x288d47){var _0x5900f4=typeof _0x5f003a[_0xa07e('0x1a')]===_0xa07e('0x1b')&&typeof _0x5f003a[_0xa07e('0x1c')]===_0xa07e('0x1b');var _0x2320e=_0x288d47[_0xa07e('0x1d')];var _0x51430d=_0x5900f4?0x0:_0x5f003a[_0xa07e('0x1a')];var _0x42e36b=_0x5900f4?_0x288d47[_0xa07e('0x1d')]:_0x5f003a[_0xa07e('0x1a')]+_0x5f003a[_0xa07e('0x1c')];var _0x4e3c90;if(_0x42e36b>=_0x2320e){_0x42e36b=_0x2320e;_0x4e3c90=0xc8;}else{_0x4e3c90=0xce;}_0x42250e[_0xa07e('0x17')](_0x4e3c90);return _0x42250e[_0xa07e('0x1e')](_0xa07e('0x1f'),_0x51430d+'-'+_0x42e36b+'/'+_0x2320e)[_0xa07e('0x19')](_0x288d47);}return null;};}function patchUpdates(_0x56268){return function(_0x27a9d0){try{jsonpatch['apply'](_0x27a9d0,_0x56268,!![]);}catch(_0x4f76f2){return BPromise['reject'](_0x4f76f2);}return _0x27a9d0[_0xa07e('0x20')]();};}function saveUpdates(_0xc1de3b,_0x52513f){return function(_0x513e97){if(_0x513e97){return _0x513e97[_0xa07e('0x21')](_0xc1de3b)[_0xa07e('0x22')](function(_0x43fba6){return _0x43fba6;});}return null;};}function removeEntity(_0xc1e2b,_0x5708a2){return function(_0x4f2cb9){if(_0x4f2cb9){return _0x4f2cb9[_0xa07e('0x23')]()[_0xa07e('0x22')](function(){_0xc1e2b['status'](0xcc)[_0xa07e('0x18')]();});}};}function handleEntityNotFound(_0x1fb9bf,_0x50c6eb){return function(_0x1508e8){if(!_0x1508e8){_0x1fb9bf[_0xa07e('0x16')](0x194);}return _0x1508e8;};}function handleError(_0x1336ab,_0x25c3fa){_0x25c3fa=_0x25c3fa||0x1f4;return function(_0x140f20){logger['error'](_0x140f20[_0xa07e('0x24')]);if(_0x140f20['name']){delete _0x140f20[_0xa07e('0x25')];}_0x1336ab[_0xa07e('0x17')](_0x25c3fa)[_0xa07e('0x26')](_0x140f20);};}exports[_0xa07e('0x27')]=function(_0x1c8611,_0x420daf){var _0x34b32d={},_0x130406={},_0x31da01={'count':0x0,'rows':[]};var _0x200a5a=_['map'](db[_0xa07e('0x28')]['rawAttributes'],function(_0x55053d){return{'name':_0x55053d[_0xa07e('0x29')],'type':_0x55053d[_0xa07e('0x2a')][_0xa07e('0x2b')]};});_0x130406[_0xa07e('0x2c')]=_['map'](_0x200a5a,_0xa07e('0x25'));_0x130406[_0xa07e('0x2d')]=_[_0xa07e('0x2e')](_0x1c8611[_0xa07e('0x2d')]);_0x130406[_0xa07e('0x2f')]=_[_0xa07e('0x30')](_0x130406[_0xa07e('0x2c')],_0x130406[_0xa07e('0x2d')]);_0x34b32d[_0xa07e('0x31')]=_[_0xa07e('0x30')](_0x130406[_0xa07e('0x2c')],qs[_0xa07e('0x32')](_0x1c8611[_0xa07e('0x2d')][_0xa07e('0x32')]));_0x34b32d[_0xa07e('0x31')]=_0x34b32d[_0xa07e('0x31')]['length']?_0x34b32d[_0xa07e('0x31')]:_0x130406[_0xa07e('0x2c')];if(!_0x1c8611['query'][_0xa07e('0x33')](_0xa07e('0x34'))){_0x34b32d['limit']=qs[_0xa07e('0x1c')](_0x1c8611[_0xa07e('0x2d')][_0xa07e('0x1c')]);_0x34b32d['offset']=qs[_0xa07e('0x1a')](_0x1c8611[_0xa07e('0x2d')]['offset']);}_0x34b32d['order']=qs[_0xa07e('0x35')](_0x1c8611[_0xa07e('0x2d')][_0xa07e('0x35')]);_0x34b32d[_0xa07e('0x36')]=qs[_0xa07e('0x2f')](_[_0xa07e('0x37')](_0x1c8611[_0xa07e('0x2d')],_0x130406[_0xa07e('0x2f')]),_0x200a5a);if(_0x1c8611['query']['filter']){_0x34b32d['where']=_[_0xa07e('0x38')](_0x34b32d[_0xa07e('0x36')],{'$or':_[_0xa07e('0x39')](_0x200a5a,function(_0xb48a44){if(_0xb48a44['type']!=='VIRTUAL'){var _0x3b346a={};_0x3b346a[_0xb48a44[_0xa07e('0x25')]]={'$like':'%'+_0x1c8611[_0xa07e('0x2d')]['filter']+'%'};return _0x3b346a;}})});}_0x34b32d=_[_0xa07e('0x38')]({},_0x34b32d,_0x1c8611['options']);var _0x310386={'where':_0x34b32d['where']};return db[_0xa07e('0x28')][_0xa07e('0x1d')](_0x310386)[_0xa07e('0x22')](function(_0x3d4172){_0x31da01[_0xa07e('0x1d')]=_0x3d4172;if(_0x1c8611[_0xa07e('0x2d')]['includeAll']){_0x34b32d[_0xa07e('0x3a')]=[{'all':!![]}];}return db[_0xa07e('0x28')][_0xa07e('0x3b')](_0x34b32d);})[_0xa07e('0x22')](function(_0x309635){_0x31da01[_0xa07e('0x3c')]=_0x309635;return _0x31da01;})[_0xa07e('0x22')](respondWithFilteredResult(_0x420daf,_0x34b32d))[_0xa07e('0x3d')](handleError(_0x420daf,null));};exports[_0xa07e('0x3e')]=function(_0x42c981,_0x46a796){var _0x5996ca={'raw':!![],'where':{'id':_0x42c981['params']['id']}},_0xcafe4c={};_0xcafe4c[_0xa07e('0x2c')]=_[_0xa07e('0x2e')](db[_0xa07e('0x28')][_0xa07e('0x3f')]);_0xcafe4c[_0xa07e('0x2d')]=_[_0xa07e('0x2e')](_0x42c981['query']);_0xcafe4c[_0xa07e('0x2f')]=_[_0xa07e('0x30')](_0xcafe4c['model'],_0xcafe4c[_0xa07e('0x2d')]);_0x5996ca[_0xa07e('0x31')]=_[_0xa07e('0x30')](_0xcafe4c[_0xa07e('0x2c')],qs[_0xa07e('0x32')](_0x42c981[_0xa07e('0x2d')][_0xa07e('0x32')]));_0x5996ca[_0xa07e('0x31')]=_0x5996ca[_0xa07e('0x31')][_0xa07e('0x40')]?_0x5996ca[_0xa07e('0x31')]:_0xcafe4c[_0xa07e('0x2c')];if(_0x42c981['query'][_0xa07e('0x41')]){_0x5996ca[_0xa07e('0x3a')]=[{'all':!![]}];}_0x5996ca=_[_0xa07e('0x38')]({},_0x5996ca,_0x42c981['options']);return db[_0xa07e('0x28')]['find'](_0x5996ca)[_0xa07e('0x22')](handleEntityNotFound(_0x46a796,null))[_0xa07e('0x22')](respondWithResult(_0x46a796,null))[_0xa07e('0x3d')](handleError(_0x46a796,null));};exports[_0xa07e('0x42')]=function(_0x2d135e,_0x3fb02){return db[_0xa07e('0x28')]['create'](_0x2d135e[_0xa07e('0x43')],{})[_0xa07e('0x22')](respondWithResult(_0x3fb02,0xc9))[_0xa07e('0x3d')](handleError(_0x3fb02,null));};exports[_0xa07e('0x21')]=function(_0x90a846,_0x767e30){if(_0x90a846[_0xa07e('0x43')]['id']){delete _0x90a846[_0xa07e('0x43')]['id'];}return db[_0xa07e('0x28')][_0xa07e('0x44')]({'where':{'id':_0x90a846[_0xa07e('0x45')]['id']}})[_0xa07e('0x22')](handleEntityNotFound(_0x767e30,null))['then'](saveUpdates(_0x90a846['body'],null))['then'](respondWithResult(_0x767e30,null))['catch'](handleError(_0x767e30,null));};exports[_0xa07e('0x23')]=function(_0x1f2e8a,_0x42b15d){return db[_0xa07e('0x28')][_0xa07e('0x44')]({'where':{'id':_0x1f2e8a[_0xa07e('0x45')]['id']}})[_0xa07e('0x22')](handleEntityNotFound(_0x42b15d,null))[_0xa07e('0x22')](removeEntity(_0x42b15d,null))[_0xa07e('0x3d')](handleError(_0x42b15d,null));};exports[_0xa07e('0x46')]=function(_0x11b38b,_0x226ba3){return db[_0xa07e('0x28')][_0xa07e('0x46')]()['then'](respondWithResult(_0x226ba3,null))[_0xa07e('0x3d')](handleError(_0x226ba3,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index bd85173..6e8be95 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 _0xa6d3=['api','bluebird','path','rimraf','../../config/environment','./smsTransferReport.attributes','exports','define','SmsTransferReport','report_sms_transfer','uniqueid','util','../../config/logger'];(function(_0x33fa4e,_0x46dd68){var _0x1579b3=function(_0x339de2){while(--_0x339de2){_0x33fa4e['push'](_0x33fa4e['shift']());}};_0x1579b3(++_0x46dd68);}(_0xa6d3,0x1ec));var _0x3a6d=function(_0x5d07a7,_0x43ff2e){_0x5d07a7=_0x5d07a7-0x0;var _0x95d216=_0xa6d3[_0x5d07a7];return _0x95d216;};'use strict';var _=require('lodash');var util=require(_0x3a6d('0x0'));var logger=require(_0x3a6d('0x1'))(_0x3a6d('0x2'));var moment=require('moment');var BPromise=require(_0x3a6d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3a6d('0x4'));var rimraf=require(_0x3a6d('0x5'));var config=require(_0x3a6d('0x6'));var attributes=require(_0x3a6d('0x7'));module[_0x3a6d('0x8')]=function(_0x151868,_0x5dd47a){return _0x151868[_0x3a6d('0x9')](_0x3a6d('0xa'),attributes,{'tableName':_0x3a6d('0xb'),'paranoid':![],'indexes':[{'name':_0x3a6d('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x94cf=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./smsTransferReport.attributes','exports','SmsTransferReport','report_sms_transfer','uniqueid','util'];(function(_0x327d3f,_0x1ebe0b){var _0x2449b5=function(_0x11ab6b){while(--_0x11ab6b){_0x327d3f['push'](_0x327d3f['shift']());}};_0x2449b5(++_0x1ebe0b);}(_0x94cf,0xc2));var _0xf94c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x94cf[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xf94c('0x0'));var logger=require(_0xf94c('0x1'))(_0xf94c('0x2'));var moment=require('moment');var BPromise=require(_0xf94c('0x3'));var rp=require(_0xf94c('0x4'));var fs=require('fs');var path=require(_0xf94c('0x5'));var rimraf=require(_0xf94c('0x6'));var config=require(_0xf94c('0x7'));var attributes=require(_0xf94c('0x8'));module[_0xf94c('0x9')]=function(_0x1c0879,_0x139ac3){return _0x1c0879['define'](_0xf94c('0xa'),attributes,{'tableName':_0xf94c('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xf94c('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index a4bf860..2bc0de0 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 _0x0689=['catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result'];(function(_0x151b1a,_0x468715){var _0x208bc7=function(_0x5778da){while(--_0x5778da){_0x151b1a['push'](_0x151b1a['shift']());}};_0x208bc7(++_0x468715);}(_0x0689,0x161));var _0x9068=function(_0x477598,_0x4dab5c){_0x477598=_0x477598-0x0;var _0x4c7ffb=_0x0689[_0x477598];return _0x4c7ffb;};'use strict';var _=require('lodash');var util=require(_0x9068('0x0'));var moment=require('moment');var BPromise=require(_0x9068('0x1'));var rs=require(_0x9068('0x2'));var fs=require('fs');var Redis=require(_0x9068('0x3'));var db=require(_0x9068('0x4'))['db'];var utils=require(_0x9068('0x5'));var logger=require(_0x9068('0x6'))(_0x9068('0x7'));var config=require(_0x9068('0x8'));var jayson=require(_0x9068('0x9'));var client=jayson[_0x9068('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x34cb67,_0x5c833f,_0x4bdd1b){return new BPromise(function(_0x17bc63,_0x184746){return client[_0x9068('0xb')](_0x34cb67,_0x4bdd1b)[_0x9068('0xc')](function(_0x1c63d2){logger[_0x9068('0xd')](_0x9068('0xe'),_0x5c833f,_0x9068('0xf'));logger[_0x9068('0x10')]('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x5c833f,_0x9068('0xf'),JSON[_0x9068('0x11')](_0x1c63d2));if(_0x1c63d2[_0x9068('0x12')]){if(_0x1c63d2[_0x9068('0x12')]['code']===0x1f4){logger[_0x9068('0x12')](_0x9068('0xe'),_0x5c833f,_0x1c63d2[_0x9068('0x12')]['message']);return _0x184746(_0x1c63d2[_0x9068('0x12')][_0x9068('0x13')]);}logger[_0x9068('0x12')]('SmsTransferReport,\x20%s,\x20%s',_0x5c833f,_0x1c63d2[_0x9068('0x12')][_0x9068('0x13')]);return _0x17bc63(_0x1c63d2['error'][_0x9068('0x13')]);}else{logger[_0x9068('0xd')]('SmsTransferReport,\x20%s,\x20%s',_0x5c833f,_0x9068('0xf'));_0x17bc63(_0x1c63d2[_0x9068('0x14')][_0x9068('0x13')]);}})[_0x9068('0x15')](function(_0x576b34){logger[_0x9068('0x12')](_0x9068('0xe'),_0x5c833f,_0x576b34);_0x184746(_0x576b34);});});} \ No newline at end of file +var _0x0ec6=['client','http','request','then','info','SmsTransferReport,\x20%s,\x20%s','SmsTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x4c5855,_0x2049fd){var _0x34bf92=function(_0x615723){while(--_0x615723){_0x4c5855['push'](_0x4c5855['shift']());}};_0x34bf92(++_0x2049fd);}(_0x0ec6,0x1f1));var _0x60ec=function(_0x450940,_0xc87bbe){_0x450940=_0x450940-0x0;var _0x3f498d=_0x0ec6[_0x450940];return _0x3f498d;};'use strict';var _=require(_0x60ec('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x60ec('0x1'));var rs=require(_0x60ec('0x2'));var fs=require('fs');var Redis=require(_0x60ec('0x3'));var db=require(_0x60ec('0x4'))['db'];var utils=require(_0x60ec('0x5'));var logger=require(_0x60ec('0x6'))(_0x60ec('0x7'));var config=require('../../config/environment');var jayson=require(_0x60ec('0x8'));var client=jayson[_0x60ec('0x9')][_0x60ec('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x74adc4,_0x5d4cba,_0xcb974c){return new BPromise(function(_0x488ab8,_0x2c4a14){return client[_0x60ec('0xb')](_0x74adc4,_0xcb974c)[_0x60ec('0xc')](function(_0x1363c2){logger[_0x60ec('0xd')](_0x60ec('0xe'),_0x5d4cba,'request\x20sent');logger['debug'](_0x60ec('0xf'),_0x5d4cba,_0x60ec('0x10'),JSON[_0x60ec('0x11')](_0x1363c2));if(_0x1363c2[_0x60ec('0x12')]){if(_0x1363c2[_0x60ec('0x12')]['code']===0x1f4){logger['error'](_0x60ec('0xe'),_0x5d4cba,_0x1363c2[_0x60ec('0x12')][_0x60ec('0x13')]);return _0x2c4a14(_0x1363c2[_0x60ec('0x12')][_0x60ec('0x13')]);}logger['error'](_0x60ec('0xe'),_0x5d4cba,_0x1363c2[_0x60ec('0x12')][_0x60ec('0x13')]);return _0x488ab8(_0x1363c2[_0x60ec('0x12')][_0x60ec('0x13')]);}else{logger[_0x60ec('0xd')](_0x60ec('0xe'),_0x5d4cba,_0x60ec('0x10'));_0x488ab8(_0x1363c2[_0x60ec('0x14')]['message']);}})[_0x60ec('0x15')](function(_0x2778dd){logger[_0x60ec('0x12')](_0x60ec('0xe'),_0x5d4cba,_0x2778dd);_0x2c4a14(_0x2778dd);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 7e65a80..34f9ebc 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 _0xa13f=['isAuthenticated','index','/:id','/:id/download','download','root','server/files/sounds/original/','originalname','replace','format','%s-%s%s','basename','extname','now','post','file','delete','exports','path','express','Router','../../components/auth/service','../../config/environment','get'];(function(_0x111828,_0x1cdb50){var _0x26c292=function(_0x56b054){while(--_0x56b054){_0x111828['push'](_0x111828['shift']());}};_0x26c292(++_0x1cdb50);}(_0xa13f,0x132));var _0xfa13=function(_0xdfa33b,_0x132df2){_0xdfa33b=_0xdfa33b-0x0;var _0x273a78=_0xa13f[_0xdfa33b];return _0x273a78;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xfa13('0x0'));var timeout=require('connect-timeout');var express=require(_0xfa13('0x1'));var router=express[_0xfa13('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xfa13('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xfa13('0x4'));var controller=require('./sound.controller');router[_0xfa13('0x5')]('/',auth[_0xfa13('0x6')](),controller[_0xfa13('0x7')]);router[_0xfa13('0x5')](_0xfa13('0x8'),auth['isAuthenticated'](),controller['show']);router['get'](_0xfa13('0x9'),auth[_0xfa13('0x6')](),controller[_0xfa13('0xa')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2b15d0,_0x322834,_0x1b9ae2){_0x1b9ae2(null,path['join'](config[_0xfa13('0xb')],_0xfa13('0xc')));},'filename':function(_0x5c0d35,_0x5bab8f,_0x3f25cd){_0x5bab8f[_0xfa13('0xd')]=_0x5bab8f['originalname'][_0xfa13('0xe')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3f25cd(null,util[_0xfa13('0xf')](_0xfa13('0x10'),path[_0xfa13('0x11')](_0x5bab8f[_0xfa13('0xd')],path[_0xfa13('0x12')](_0x5bab8f[_0xfa13('0xd')])),Date[_0xfa13('0x13')](),path[_0xfa13('0x12')](_0x5bab8f[_0xfa13('0xd')])));}})});router[_0xfa13('0x14')]('/',upload['single'](_0xfa13('0x15')),controller['create']);router['put'](_0xfa13('0x8'),auth[_0xfa13('0x6')](),controller['update']);router[_0xfa13('0x16')]('/:id',auth[_0xfa13('0x6')](),controller[_0xfa13('0x16')]);module[_0xfa13('0x17')]=router; \ No newline at end of file +var _0xa09f=['exports','multer','util','connect-timeout','express','Router','fs-extra','get','index','/:id','isAuthenticated','show','download','diskStorage','join','root','server/files/sounds/original/','originalname','replace','%s-%s%s','basename','single','file','create','put','delete'];(function(_0x3fbd88,_0xf6d86c){var _0x4d95bc=function(_0x10ed43){while(--_0x10ed43){_0x3fbd88['push'](_0x3fbd88['shift']());}};_0x4d95bc(++_0xf6d86c);}(_0xa09f,0x139));var _0xfa09=function(_0x38887b,_0x217c73){_0x38887b=_0x38887b-0x0;var _0x2a6d19=_0xa09f[_0x38887b];return _0x2a6d19;};'use strict';var multer=require(_0xfa09('0x0'));var util=require(_0xfa09('0x1'));var path=require('path');var timeout=require(_0xfa09('0x2'));var express=require(_0xfa09('0x3'));var router=express[_0xfa09('0x4')]();var fs_extra=require(_0xfa09('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./sound.controller');router[_0xfa09('0x6')]('/',auth['isAuthenticated'](),controller[_0xfa09('0x7')]);router[_0xfa09('0x6')](_0xfa09('0x8'),auth[_0xfa09('0x9')](),controller[_0xfa09('0xa')]);router['get']('/:id/download',auth[_0xfa09('0x9')](),controller[_0xfa09('0xb')]);var upload=multer({'storage':multer[_0xfa09('0xc')]({'destination':function(_0x5983fc,_0x56b081,_0x3478d8){_0x3478d8(null,path[_0xfa09('0xd')](config[_0xfa09('0xe')],_0xfa09('0xf')));},'filename':function(_0x3e3db5,_0x4f6dab,_0x1fca56){_0x4f6dab['originalname']=_0x4f6dab[_0xfa09('0x10')][_0xfa09('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1fca56(null,util['format'](_0xfa09('0x12'),path[_0xfa09('0x13')](_0x4f6dab[_0xfa09('0x10')],path['extname'](_0x4f6dab[_0xfa09('0x10')])),Date['now'](),path['extname'](_0x4f6dab['originalname'])));}})});router['post']('/',upload[_0xfa09('0x14')](_0xfa09('0x15')),controller[_0xfa09('0x16')]);router[_0xfa09('0x17')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xfa09('0x18')](_0xfa09('0x8'),auth[_0xfa09('0x9')](),controller[_0xfa09('0x18')]);module[_0xfa09('0x19')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index f3f421e..59d7c3c 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 _0x7771=['STRING','name','INTEGER','BIGINT','FLOAT','sequelize','exports'];(function(_0x3c1645,_0x3345ac){var _0x463110=function(_0x5e335e){while(--_0x5e335e){_0x3c1645['push'](_0x3c1645['shift']());}};_0x463110(++_0x3345ac);}(_0x7771,0x15c));var _0x1777=function(_0x44044a,_0x3a0097){_0x44044a=_0x44044a-0x0;var _0x43bb6e=_0x7771[_0x44044a];return _0x43bb6e;};'use strict';var Sequelize=require(_0x1777('0x0'));module[_0x1777('0x1')]={'name':{'type':Sequelize[_0x1777('0x2')],'unique':_0x1777('0x3'),'allowNull':![]},'save_name':{'type':Sequelize[_0x1777('0x2')]},'display_name':{'type':Sequelize[_0x1777('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0x1777('0x2')]},'original_format':{'type':Sequelize[_0x1777('0x2')]},'original_duration':{'type':Sequelize['FLOAT']},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize[_0x1777('0x4')]},'original_bitRate':{'type':Sequelize[_0x1777('0x5')]},'original_sampleRate':{'type':Sequelize[_0x1777('0x4')]},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize[_0x1777('0x6')]},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize[_0x1777('0x4')]},'converted_bitRate':{'type':Sequelize[_0x1777('0x5')]},'converted_sampleRate':{'type':Sequelize[_0x1777('0x4')]}}; \ No newline at end of file +var _0x0851=['STRING','name','FLOAT','BIGINT','INTEGER','sequelize','exports'];(function(_0x5d225a,_0x2debe9){var _0x1e7761=function(_0x491dc2){while(--_0x491dc2){_0x5d225a['push'](_0x5d225a['shift']());}};_0x1e7761(++_0x2debe9);}(_0x0851,0x8a));var _0x1085=function(_0x2b18c9,_0x49659f){_0x2b18c9=_0x2b18c9-0x0;var _0x8b913c=_0x0851[_0x2b18c9];return _0x8b913c;};'use strict';var Sequelize=require(_0x1085('0x0'));module[_0x1085('0x1')]={'name':{'type':Sequelize[_0x1085('0x2')],'unique':_0x1085('0x3'),'allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize[_0x1085('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0x1085('0x2')]},'original_format':{'type':Sequelize[_0x1085('0x2')]},'original_duration':{'type':Sequelize[_0x1085('0x4')]},'original_sampleCount':{'type':Sequelize[_0x1085('0x5')]},'original_channelCount':{'type':Sequelize[_0x1085('0x6')]},'original_bitRate':{'type':Sequelize[_0x1085('0x5')]},'original_sampleRate':{'type':Sequelize[_0x1085('0x6')]},'converted_format':{'type':Sequelize[_0x1085('0x2')]},'converted_duration':{'type':Sequelize[_0x1085('0x4')]},'converted_sampleCount':{'type':Sequelize[_0x1085('0x5')]},'converted_channelCount':{'type':Sequelize[_0x1085('0x6')]},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index d4910e0..eee4263 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 _0xc0f6=['basename','file','originalname','extname','filename','substring','wav','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','unlinkSync','src','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_channelCount','converted_bitRate','body','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','description','delete','rimraf','fast-json-patch','moment','bluebird','sox','ejs','fs-extra','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','get','Sounds','UserProfileResource','destroy','error','stack','name','send','index','map','Sound','rawAttributes','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','merge','where','type','VIRTUAL','options','includeAll','findAll','show','params','find','catch','download','converted_format','existsSync','join','root','server/files/sounds/converted','Sequelize','ValidationError','Sound\x20not\x20found','format','%s.%s','save_name','create'];(function(_0xb3989f,_0x11cf51){var _0x52cfd3=function(_0x538114){while(--_0x538114){_0xb3989f['push'](_0xb3989f['shift']());}};_0x52cfd3(++_0x11cf51);}(_0xc0f6,0x9c));var _0x6c0f=function(_0x3902c1,_0x1c9eb2){_0x3902c1=_0x3902c1-0x0;var _0x1266cc=_0xc0f6[_0x3902c1];return _0x1266cc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6c0f('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6c0f('0x1'));var rp=require('request-promise');var moment=require(_0x6c0f('0x2'));var BPromise=require(_0x6c0f('0x3'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x6c0f('0x4'));var csv=require('to-csv');var ejs=require(_0x6c0f('0x5'));var fs=require('fs');var fs_extra=require(_0x6c0f('0x6'));var _=require('lodash');var squel=require(_0x6c0f('0x7'));var crypto=require('crypto');var jsforce=require(_0x6c0f('0x8'));var deskjs=require(_0x6c0f('0x9'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6c0f('0xa'));var authService=require(_0x6c0f('0xb'));var qs=require(_0x6c0f('0xc'));var as=require(_0x6c0f('0xd'));var hardwareService=require(_0x6c0f('0xe'));var logger=require(_0x6c0f('0xf'))('api');var utils=require(_0x6c0f('0x10'));var config=require(_0x6c0f('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0x6c0f('0x12'))['db'];function respondWithStatusCode(_0x2569a2,_0x23bf61){_0x23bf61=_0x23bf61||0xcc;return function(_0x3cf4f8){if(_0x3cf4f8){return _0x2569a2[_0x6c0f('0x13')](_0x23bf61);}return _0x2569a2[_0x6c0f('0x14')](_0x23bf61)['end']();};}function respondWithResult(_0x34f32f,_0x265918){_0x265918=_0x265918||0xc8;return function(_0x432613){if(_0x432613){return _0x34f32f[_0x6c0f('0x14')](_0x265918)['json'](_0x432613);}};}function respondWithFilteredResult(_0x33a715,_0x262b02){return function(_0x4ae8b8){if(_0x4ae8b8){var _0x3b203e=typeof _0x262b02[_0x6c0f('0x15')]===_0x6c0f('0x16')&&typeof _0x262b02[_0x6c0f('0x17')]===_0x6c0f('0x16');var _0x4382d0=_0x4ae8b8[_0x6c0f('0x18')];var _0x2a2ab1=_0x3b203e?0x0:_0x262b02[_0x6c0f('0x15')];var _0xa06482=_0x3b203e?_0x4ae8b8[_0x6c0f('0x18')]:_0x262b02[_0x6c0f('0x15')]+_0x262b02[_0x6c0f('0x17')];var _0x2d2ac3;if(_0xa06482>=_0x4382d0){_0xa06482=_0x4382d0;_0x2d2ac3=0xc8;}else{_0x2d2ac3=0xce;}_0x33a715[_0x6c0f('0x14')](_0x2d2ac3);return _0x33a715[_0x6c0f('0x19')](_0x6c0f('0x1a'),_0x2a2ab1+'-'+_0xa06482+'/'+_0x4382d0)[_0x6c0f('0x1b')](_0x4ae8b8);}return null;};}function patchUpdates(_0x2f75e3){return function(_0x426a24){try{jsonpatch[_0x6c0f('0x1c')](_0x426a24,_0x2f75e3,!![]);}catch(_0x3b30a4){return BPromise[_0x6c0f('0x1d')](_0x3b30a4);}return _0x426a24[_0x6c0f('0x1e')]();};}function saveUpdates(_0x1dd8f3,_0x15a837){return function(_0x2491a4){if(_0x2491a4){return _0x2491a4[_0x6c0f('0x1f')](_0x1dd8f3)[_0x6c0f('0x20')](function(_0x21710b){return _0x21710b;});}return null;};}function removeEntity(_0x2a78d8,_0x402a11){return function(_0x57bf06){if(_0x57bf06){return _0x57bf06['destroy']()[_0x6c0f('0x20')](function(){var _0x38eeb4=_0x57bf06[_0x6c0f('0x21')]({'plain':!![]});var _0x1b60d0=_0x6c0f('0x22');return db[_0x6c0f('0x23')][_0x6c0f('0x24')]({'where':{'type':_0x1b60d0,'resourceId':_0x38eeb4['id']}})[_0x6c0f('0x20')](function(){return _0x57bf06;});})[_0x6c0f('0x20')](function(){_0x2a78d8[_0x6c0f('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe24ec1,_0x47ba48){return function(_0x3ecd7f){if(!_0x3ecd7f){_0xe24ec1[_0x6c0f('0x13')](0x194);}return _0x3ecd7f;};}function handleError(_0x5692cf,_0xa4a3cd){_0xa4a3cd=_0xa4a3cd||0x1f4;return function(_0x1b108f){logger[_0x6c0f('0x25')](_0x1b108f[_0x6c0f('0x26')]);if(_0x1b108f[_0x6c0f('0x27')]){delete _0x1b108f[_0x6c0f('0x27')];}_0x5692cf['status'](_0xa4a3cd)[_0x6c0f('0x28')](_0x1b108f);};}exports[_0x6c0f('0x29')]=function(_0x46c717,_0x466274){var _0x21960c={},_0x458d9b={},_0x9bdc98={'count':0x0,'rows':[]};var _0x4f7daa=_[_0x6c0f('0x2a')](db[_0x6c0f('0x2b')][_0x6c0f('0x2c')],function(_0x49abfe){return{'name':_0x49abfe['fieldName'],'type':_0x49abfe['type']['key']};});_0x458d9b[_0x6c0f('0x2d')]=_['map'](_0x4f7daa,_0x6c0f('0x27'));_0x458d9b['query']=_[_0x6c0f('0x2e')](_0x46c717[_0x6c0f('0x2f')]);_0x458d9b[_0x6c0f('0x30')]=_[_0x6c0f('0x31')](_0x458d9b[_0x6c0f('0x2d')],_0x458d9b[_0x6c0f('0x2f')]);_0x21960c['attributes']=_[_0x6c0f('0x31')](_0x458d9b[_0x6c0f('0x2d')],qs[_0x6c0f('0x32')](_0x46c717[_0x6c0f('0x2f')]['fields']));_0x21960c[_0x6c0f('0x33')]=_0x21960c[_0x6c0f('0x33')][_0x6c0f('0x34')]?_0x21960c[_0x6c0f('0x33')]:_0x458d9b[_0x6c0f('0x2d')];if(!_0x46c717[_0x6c0f('0x2f')][_0x6c0f('0x35')](_0x6c0f('0x36'))){_0x21960c[_0x6c0f('0x17')]=qs['limit'](_0x46c717[_0x6c0f('0x2f')]['limit']);_0x21960c[_0x6c0f('0x15')]=qs[_0x6c0f('0x15')](_0x46c717[_0x6c0f('0x2f')]['offset']);}_0x21960c['order']=qs[_0x6c0f('0x37')](_0x46c717[_0x6c0f('0x2f')][_0x6c0f('0x37')]);_0x21960c['where']=qs['filters'](_[_0x6c0f('0x38')](_0x46c717[_0x6c0f('0x2f')],_0x458d9b[_0x6c0f('0x30')]),_0x4f7daa);if(_0x46c717['query'][_0x6c0f('0x39')]){_0x21960c['where']=_[_0x6c0f('0x3a')](_0x21960c[_0x6c0f('0x3b')],{'$or':_[_0x6c0f('0x2a')](_0x4f7daa,function(_0x4456b3){if(_0x4456b3[_0x6c0f('0x3c')]!==_0x6c0f('0x3d')){var _0x1ba597={};_0x1ba597[_0x4456b3[_0x6c0f('0x27')]]={'$like':'%'+_0x46c717[_0x6c0f('0x2f')][_0x6c0f('0x39')]+'%'};return _0x1ba597;}})});}_0x21960c=_[_0x6c0f('0x3a')]({},_0x21960c,_0x46c717[_0x6c0f('0x3e')]);var _0x48be4c={'where':_0x21960c[_0x6c0f('0x3b')]};return db['Sound']['count'](_0x48be4c)[_0x6c0f('0x20')](function(_0x3624ce){_0x9bdc98['count']=_0x3624ce;if(_0x46c717[_0x6c0f('0x2f')][_0x6c0f('0x3f')]){_0x21960c['include']=[{'all':!![]}];}return db[_0x6c0f('0x2b')][_0x6c0f('0x40')](_0x21960c);})[_0x6c0f('0x20')](function(_0x4f57dc){_0x9bdc98['rows']=_0x4f57dc;return _0x9bdc98;})[_0x6c0f('0x20')](respondWithFilteredResult(_0x466274,_0x21960c))['catch'](handleError(_0x466274,null));};exports[_0x6c0f('0x41')]=function(_0x4d1677,_0x47d253){var _0x24cb55={'raw':!![],'where':{'id':_0x4d1677[_0x6c0f('0x42')]['id']}},_0x1d0c1b={};_0x1d0c1b[_0x6c0f('0x2d')]=_[_0x6c0f('0x2e')](db[_0x6c0f('0x2b')][_0x6c0f('0x2c')]);_0x1d0c1b[_0x6c0f('0x2f')]=_[_0x6c0f('0x2e')](_0x4d1677['query']);_0x1d0c1b[_0x6c0f('0x30')]=_[_0x6c0f('0x31')](_0x1d0c1b[_0x6c0f('0x2d')],_0x1d0c1b['query']);_0x24cb55['attributes']=_['intersection'](_0x1d0c1b['model'],qs[_0x6c0f('0x32')](_0x4d1677['query'][_0x6c0f('0x32')]));_0x24cb55[_0x6c0f('0x33')]=_0x24cb55[_0x6c0f('0x33')]['length']?_0x24cb55[_0x6c0f('0x33')]:_0x1d0c1b[_0x6c0f('0x2d')];if(_0x4d1677[_0x6c0f('0x2f')]['includeAll']){_0x24cb55['include']=[{'all':!![]}];}_0x24cb55=_[_0x6c0f('0x3a')]({},_0x24cb55,_0x4d1677['options']);return db[_0x6c0f('0x2b')][_0x6c0f('0x43')](_0x24cb55)[_0x6c0f('0x20')](handleEntityNotFound(_0x47d253,null))[_0x6c0f('0x20')](respondWithResult(_0x47d253,null))[_0x6c0f('0x44')](handleError(_0x47d253,null));};exports[_0x6c0f('0x45')]=function(_0x1da75e,_0x582ece,_0x4cbce3){return db[_0x6c0f('0x2b')][_0x6c0f('0x43')]({'where':{'id':_0x1da75e[_0x6c0f('0x42')]['id']},'attributes':['name','save_name',_0x6c0f('0x46')],'raw':!![]})[_0x6c0f('0x20')](handleEntityNotFound(_0x582ece,null))[_0x6c0f('0x20')](function(_0x72c82e){if(_0x72c82e){if(!fs[_0x6c0f('0x47')](path[_0x6c0f('0x48')](config[_0x6c0f('0x49')],_0x6c0f('0x4a'),_0x72c82e['save_name']+'.'+_0x72c82e[_0x6c0f('0x46')]))){throw new db[(_0x6c0f('0x4b'))][(_0x6c0f('0x4c'))](_0x6c0f('0x4d'));}return _0x582ece['download'](path[_0x6c0f('0x48')](config[_0x6c0f('0x49')],_0x6c0f('0x4a'),util[_0x6c0f('0x4e')](_0x6c0f('0x4f'),_0x72c82e[_0x6c0f('0x50')],_0x72c82e[_0x6c0f('0x46')])),util[_0x6c0f('0x4e')](_0x6c0f('0x4f'),_0x72c82e['name'],_0x72c82e[_0x6c0f('0x46')]));}return null;})[_0x6c0f('0x44')](handleError(_0x582ece,null));};exports[_0x6c0f('0x51')]=function(_0x141aa5,_0x426f73,_0x6bf45b){var _0x1d65b3={'name':path[_0x6c0f('0x52')](_0x141aa5[_0x6c0f('0x53')][_0x6c0f('0x54')],path[_0x6c0f('0x55')](_0x141aa5[_0x6c0f('0x53')][_0x6c0f('0x54')])),'save_name':path[_0x6c0f('0x52')](_0x141aa5[_0x6c0f('0x53')]['filename'],path[_0x6c0f('0x55')](_0x141aa5[_0x6c0f('0x53')][_0x6c0f('0x56')])),'original_format':path[_0x6c0f('0x55')](_0x141aa5[_0x6c0f('0x53')][_0x6c0f('0x54')])[_0x6c0f('0x57')](0x1),'converted_format':_0x6c0f('0x58')};var _0x497970=path[_0x6c0f('0x48')](config[_0x6c0f('0x49')],_0x6c0f('0x59'),_0x141aa5[_0x6c0f('0x53')][_0x6c0f('0x56')]);var _0x2c1950=path[_0x6c0f('0x48')](config[_0x6c0f('0x49')],_0x6c0f('0x4a'),util['format'](_0x6c0f('0x4f'),path[_0x6c0f('0x52')](_0x141aa5[_0x6c0f('0x53')]['filename'],path[_0x6c0f('0x55')](_0x141aa5['file'][_0x6c0f('0x56')])),_0x1d65b3['converted_format']));logger[_0x6c0f('0x5a')](_0x6c0f('0x5b'),_0x497970);logger[_0x6c0f('0x5a')](_0x6c0f('0x5c'),_0x2c1950);try{fs[_0x6c0f('0x5d')](_0x497970,parseInt(_0x6c0f('0x5e'),0x8));var _0x414bdf=sox[_0x6c0f('0x5f')](_0x497970,_0x2c1950,{'sampleRate':0x1f40,'format':_0x6c0f('0x58'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x414bdf['on'](_0x6c0f('0x25'),function(_0x38aa68){fs[_0x6c0f('0x60')](_0x497970);_0x426f73[_0x6c0f('0x14')](0x1f4)[_0x6c0f('0x28')](_0x38aa68);});_0x414bdf['on'](_0x6c0f('0x61'),function(_0xdd9f9a){_0x1d65b3['original_duration']=isNaN(_0xdd9f9a[_0x6c0f('0x62')])?null:_0xdd9f9a['duration']*0x3e8;_0x1d65b3[_0x6c0f('0x63')]=isNaN(_0xdd9f9a[_0x6c0f('0x64')])?null:_0xdd9f9a['sampleCount'];_0x1d65b3[_0x6c0f('0x65')]=isNaN(_0xdd9f9a['channelCount'])?null:_0xdd9f9a[_0x6c0f('0x66')];_0x1d65b3[_0x6c0f('0x67')]=isNaN(_0xdd9f9a[_0x6c0f('0x68')])?null:_0xdd9f9a[_0x6c0f('0x68')];_0x1d65b3[_0x6c0f('0x69')]=isNaN(_0xdd9f9a[_0x6c0f('0x6a')])?null:_0xdd9f9a[_0x6c0f('0x6a')];});_0x414bdf['on'](_0x6c0f('0x6b'),function(_0x1464f3){_0x1d65b3[_0x6c0f('0x6c')]=isNaN(_0x1464f3[_0x6c0f('0x62')])?null:_0x1464f3[_0x6c0f('0x62')]*0x3e8;_0x1d65b3['converted_sampleCount']=isNaN(_0x1464f3['sampleCount'])?null:_0x1464f3[_0x6c0f('0x64')];_0x1d65b3[_0x6c0f('0x6d')]=isNaN(_0x1464f3[_0x6c0f('0x66')])?null:_0x1464f3[_0x6c0f('0x66')];_0x1d65b3[_0x6c0f('0x6e')]=isNaN(_0x1464f3[_0x6c0f('0x68')])?null:_0x1464f3[_0x6c0f('0x68')];_0x1d65b3['converted_sampleRate']=isNaN(_0x1464f3['sampleRate'])?null:_0x1464f3[_0x6c0f('0x6a')];});_0x414bdf['on']('end',function(){fs[_0x6c0f('0x5d')](_0x2c1950,parseInt(_0x6c0f('0x5e'),0x8));return db[_0x6c0f('0x2b')][_0x6c0f('0x51')](_0x1d65b3)[_0x6c0f('0x20')](function(_0x38b84b){var _0x22f1d0={'role':_0x141aa5['body']['role'],'userProfileId':_0x141aa5[_0x6c0f('0x6f')]['userProfileId']};if(!_0x22f1d0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x22f1d0['role']==='user'){var _0x344f32=_0x38b84b[_0x6c0f('0x21')]({'plain':!![]});return db[_0x6c0f('0x70')][_0x6c0f('0x43')]({'where':{'name':'Sounds','userProfileId':_0x22f1d0[_0x6c0f('0x71')]},'raw':!![]})[_0x6c0f('0x20')](function(_0x21bbeb){if(_0x21bbeb&&_0x21bbeb[_0x6c0f('0x72')]===0x0){return db[_0x6c0f('0x23')]['create']({'name':_0x344f32[_0x6c0f('0x27')],'resourceId':_0x344f32['id'],'type':_0x21bbeb['name'],'sectionId':_0x21bbeb['id']},{})[_0x6c0f('0x20')](function(){return _0x38b84b;});}else{return _0x38b84b;}})[_0x6c0f('0x44')](function(_0x1f9461){logger['error'](_0x6c0f('0x73'),_0x1f9461);throw _0x1f9461;});}return _0x38b84b;})[_0x6c0f('0x20')](respondWithResult(_0x426f73,null))['catch'](handleError(_0x426f73,null));});_0x414bdf[_0x6c0f('0x74')]();}catch(_0x300d34){_0x426f73[_0x6c0f('0x14')](0x1f4)['send'](_0x300d34);}};exports['update']=function(_0x26b6dc,_0x2a4fba,_0x30db2f){return db[_0x6c0f('0x2b')][_0x6c0f('0x43')]({'where':{'id':_0x26b6dc[_0x6c0f('0x42')]['id']}})['then'](handleEntityNotFound(_0x2a4fba,null))['then'](saveUpdates(_['pick'](_0x26b6dc[_0x6c0f('0x6f')],[_0x6c0f('0x27'),_0x6c0f('0x75')]),null))[_0x6c0f('0x20')](respondWithResult(_0x2a4fba,null))[_0x6c0f('0x44')](handleError(_0x2a4fba,null));};exports[_0x6c0f('0x76')]=function(_0x1ad288,_0x11ada6,_0x8937d){return db['Sound'][_0x6c0f('0x43')]({'where':{'id':_0x1ad288[_0x6c0f('0x42')]['id']}})[_0x6c0f('0x20')](function(_0x55cc08){if(_0x55cc08){return _0x55cc08[_0x6c0f('0x24')]();}})['then'](function(_0x391f90){var _0x53fd45=path['join'](config[_0x6c0f('0x49')],'server/files/sounds/original',util[_0x6c0f('0x4e')]('%s.%s',_0x391f90[_0x6c0f('0x50')],_0x391f90['original_format']));var _0x2f39b7=path[_0x6c0f('0x48')](config[_0x6c0f('0x49')],_0x6c0f('0x4a'),util[_0x6c0f('0x4e')]('%s.%s',_0x391f90['save_name'],_0x391f90[_0x6c0f('0x46')]));fs['unlinkSync'](_0x53fd45);fs[_0x6c0f('0x60')](_0x2f39b7);return _0x391f90;})[_0x6c0f('0x20')](function(_0x3aa04d){if(_0x3aa04d){return _0x11ada6[_0x6c0f('0x14')](0xcc)['end']();}})[_0x6c0f('0x20')](handleEntityNotFound(_0x11ada6,null))[_0x6c0f('0x44')](handleError(_0x11ada6,null));}; \ No newline at end of file +var _0xaafb=['converted_sampleRate','role','userProfileId','user','UserProfileSection','Sounds','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','body','original_format','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','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','apply','save','update','then','destroy','get','UserProfileResource','error','name','send','index','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','Sound','count','include','findAll','rows','show','params','length','includeAll','find','download','save_name','converted_format','existsSync','join','root','server/files/sounds/converted','Sequelize','format','%s.%s','catch','create','basename','file','originalname','extname','filename','server/files/sounds/original','info','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','unlinkSync','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_sampleCount','converted_channelCount'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0xaafb,0x182));var _0xbaaf=function(_0x2fd03e,_0x3594c8){_0x2fd03e=_0x2fd03e-0x0;var _0x3ff2d5=_0xaafb[_0x2fd03e];return _0x3ff2d5;};'use strict';var emlformat=require(_0xbaaf('0x0'));var rimraf=require(_0xbaaf('0x1'));var zipdir=require(_0xbaaf('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbaaf('0x3'));var moment=require(_0xbaaf('0x4'));var BPromise=require(_0xbaaf('0x5'));var Mustache=require(_0xbaaf('0x6'));var util=require('util');var path=require(_0xbaaf('0x7'));var sox=require(_0xbaaf('0x8'));var csv=require(_0xbaaf('0x9'));var ejs=require(_0xbaaf('0xa'));var fs=require('fs');var fs_extra=require(_0xbaaf('0xb'));var _=require(_0xbaaf('0xc'));var squel=require(_0xbaaf('0xd'));var crypto=require(_0xbaaf('0xe'));var jsforce=require(_0xbaaf('0xf'));var deskjs=require(_0xbaaf('0x10'));var toCsv=require(_0xbaaf('0x9'));var querystring=require(_0xbaaf('0x11'));var Papa=require(_0xbaaf('0x12'));var Redis=require('ioredis');var authService=require(_0xbaaf('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbaaf('0x14'));var logger=require(_0xbaaf('0x15'))(_0xbaaf('0x16'));var utils=require(_0xbaaf('0x17'));var config=require(_0xbaaf('0x18'));var licenseUtil=require(_0xbaaf('0x19'));var db=require(_0xbaaf('0x1a'))['db'];function respondWithStatusCode(_0x2ac77d,_0x394893){_0x394893=_0x394893||0xcc;return function(_0x472852){if(_0x472852){return _0x2ac77d[_0xbaaf('0x1b')](_0x394893);}return _0x2ac77d[_0xbaaf('0x1c')](_0x394893)[_0xbaaf('0x1d')]();};}function respondWithResult(_0x48fe9b,_0x4df207){_0x4df207=_0x4df207||0xc8;return function(_0x24a94e){if(_0x24a94e){return _0x48fe9b['status'](_0x4df207)[_0xbaaf('0x1e')](_0x24a94e);}};}function respondWithFilteredResult(_0x1e1a61,_0x2d1721){return function(_0x259fcf){if(_0x259fcf){var _0x5f5b8d=typeof _0x2d1721[_0xbaaf('0x1f')]===_0xbaaf('0x20')&&typeof _0x2d1721[_0xbaaf('0x21')]===_0xbaaf('0x20');var _0x3b8a2a=_0x259fcf['count'];var _0x35b550=_0x5f5b8d?0x0:_0x2d1721['offset'];var _0x3530d8=_0x5f5b8d?_0x259fcf['count']:_0x2d1721[_0xbaaf('0x1f')]+_0x2d1721['limit'];var _0x125d31;if(_0x3530d8>=_0x3b8a2a){_0x3530d8=_0x3b8a2a;_0x125d31=0xc8;}else{_0x125d31=0xce;}_0x1e1a61[_0xbaaf('0x1c')](_0x125d31);return _0x1e1a61['set']('Content-Range',_0x35b550+'-'+_0x3530d8+'/'+_0x3b8a2a)['json'](_0x259fcf);}return null;};}function patchUpdates(_0x41b6b4){return function(_0x1866bc){try{jsonpatch[_0xbaaf('0x22')](_0x1866bc,_0x41b6b4,!![]);}catch(_0x5c319e){return BPromise['reject'](_0x5c319e);}return _0x1866bc[_0xbaaf('0x23')]();};}function saveUpdates(_0x170b63,_0x5110c8){return function(_0x38bea1){if(_0x38bea1){return _0x38bea1[_0xbaaf('0x24')](_0x170b63)[_0xbaaf('0x25')](function(_0x2faac8){return _0x2faac8;});}return null;};}function removeEntity(_0xf9021f,_0x4e0dde){return function(_0x592368){if(_0x592368){return _0x592368[_0xbaaf('0x26')]()[_0xbaaf('0x25')](function(){var _0x2d64db=_0x592368[_0xbaaf('0x27')]({'plain':!![]});var _0x566c42='Sounds';return db[_0xbaaf('0x28')][_0xbaaf('0x26')]({'where':{'type':_0x566c42,'resourceId':_0x2d64db['id']}})['then'](function(){return _0x592368;});})[_0xbaaf('0x25')](function(){_0xf9021f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x39511f,_0x1132a7){return function(_0x4ecab6){if(!_0x4ecab6){_0x39511f[_0xbaaf('0x1b')](0x194);}return _0x4ecab6;};}function handleError(_0x5ad909,_0x3bb1db){_0x3bb1db=_0x3bb1db||0x1f4;return function(_0xe8c04a){logger[_0xbaaf('0x29')](_0xe8c04a['stack']);if(_0xe8c04a[_0xbaaf('0x2a')]){delete _0xe8c04a[_0xbaaf('0x2a')];}_0x5ad909[_0xbaaf('0x1c')](_0x3bb1db)[_0xbaaf('0x2b')](_0xe8c04a);};}exports[_0xbaaf('0x2c')]=function(_0x361550,_0x5311a9){var _0x109b9={},_0x5b910f={},_0x16d10b={'count':0x0,'rows':[]};var _0x97b506=_['map'](db['Sound'][_0xbaaf('0x2d')],function(_0x17b780){return{'name':_0x17b780[_0xbaaf('0x2e')],'type':_0x17b780[_0xbaaf('0x2f')][_0xbaaf('0x30')]};});_0x5b910f[_0xbaaf('0x31')]=_[_0xbaaf('0x32')](_0x97b506,_0xbaaf('0x2a'));_0x5b910f['query']=_[_0xbaaf('0x33')](_0x361550[_0xbaaf('0x34')]);_0x5b910f[_0xbaaf('0x35')]=_['intersection'](_0x5b910f['model'],_0x5b910f[_0xbaaf('0x34')]);_0x109b9['attributes']=_[_0xbaaf('0x36')](_0x5b910f[_0xbaaf('0x31')],qs[_0xbaaf('0x37')](_0x361550[_0xbaaf('0x34')]['fields']));_0x109b9[_0xbaaf('0x38')]=_0x109b9['attributes']['length']?_0x109b9['attributes']:_0x5b910f[_0xbaaf('0x31')];if(!_0x361550[_0xbaaf('0x34')][_0xbaaf('0x39')](_0xbaaf('0x3a'))){_0x109b9[_0xbaaf('0x21')]=qs[_0xbaaf('0x21')](_0x361550[_0xbaaf('0x34')]['limit']);_0x109b9[_0xbaaf('0x1f')]=qs['offset'](_0x361550[_0xbaaf('0x34')][_0xbaaf('0x1f')]);}_0x109b9['order']=qs[_0xbaaf('0x3b')](_0x361550[_0xbaaf('0x34')][_0xbaaf('0x3b')]);_0x109b9[_0xbaaf('0x3c')]=qs['filters'](_[_0xbaaf('0x3d')](_0x361550[_0xbaaf('0x34')],_0x5b910f[_0xbaaf('0x35')]),_0x97b506);if(_0x361550['query'][_0xbaaf('0x3e')]){_0x109b9['where']=_['merge'](_0x109b9['where'],{'$or':_[_0xbaaf('0x32')](_0x97b506,function(_0x41033c){if(_0x41033c[_0xbaaf('0x2f')]!==_0xbaaf('0x3f')){var _0x21c950={};_0x21c950[_0x41033c[_0xbaaf('0x2a')]]={'$like':'%'+_0x361550['query'][_0xbaaf('0x3e')]+'%'};return _0x21c950;}})});}_0x109b9=_[_0xbaaf('0x40')]({},_0x109b9,_0x361550[_0xbaaf('0x41')]);var _0x314c1a={'where':_0x109b9[_0xbaaf('0x3c')]};return db[_0xbaaf('0x42')][_0xbaaf('0x43')](_0x314c1a)[_0xbaaf('0x25')](function(_0xf88c24){_0x16d10b[_0xbaaf('0x43')]=_0xf88c24;if(_0x361550[_0xbaaf('0x34')]['includeAll']){_0x109b9[_0xbaaf('0x44')]=[{'all':!![]}];}return db[_0xbaaf('0x42')][_0xbaaf('0x45')](_0x109b9);})['then'](function(_0xa20171){_0x16d10b[_0xbaaf('0x46')]=_0xa20171;return _0x16d10b;})[_0xbaaf('0x25')](respondWithFilteredResult(_0x5311a9,_0x109b9))['catch'](handleError(_0x5311a9,null));};exports[_0xbaaf('0x47')]=function(_0x36df9b,_0x276128){var _0x1b717a={'raw':!![],'where':{'id':_0x36df9b[_0xbaaf('0x48')]['id']}},_0x2ef4={};_0x2ef4[_0xbaaf('0x31')]=_[_0xbaaf('0x33')](db['Sound'][_0xbaaf('0x2d')]);_0x2ef4['query']=_['keys'](_0x36df9b[_0xbaaf('0x34')]);_0x2ef4['filters']=_[_0xbaaf('0x36')](_0x2ef4[_0xbaaf('0x31')],_0x2ef4[_0xbaaf('0x34')]);_0x1b717a[_0xbaaf('0x38')]=_[_0xbaaf('0x36')](_0x2ef4[_0xbaaf('0x31')],qs[_0xbaaf('0x37')](_0x36df9b['query'][_0xbaaf('0x37')]));_0x1b717a[_0xbaaf('0x38')]=_0x1b717a[_0xbaaf('0x38')][_0xbaaf('0x49')]?_0x1b717a['attributes']:_0x2ef4[_0xbaaf('0x31')];if(_0x36df9b[_0xbaaf('0x34')][_0xbaaf('0x4a')]){_0x1b717a[_0xbaaf('0x44')]=[{'all':!![]}];}_0x1b717a=_[_0xbaaf('0x40')]({},_0x1b717a,_0x36df9b[_0xbaaf('0x41')]);return db[_0xbaaf('0x42')][_0xbaaf('0x4b')](_0x1b717a)[_0xbaaf('0x25')](handleEntityNotFound(_0x276128,null))[_0xbaaf('0x25')](respondWithResult(_0x276128,null))['catch'](handleError(_0x276128,null));};exports[_0xbaaf('0x4c')]=function(_0x17b67b,_0x3c393d,_0x1515ac){return db[_0xbaaf('0x42')][_0xbaaf('0x4b')]({'where':{'id':_0x17b67b[_0xbaaf('0x48')]['id']},'attributes':[_0xbaaf('0x2a'),_0xbaaf('0x4d'),_0xbaaf('0x4e')],'raw':!![]})[_0xbaaf('0x25')](handleEntityNotFound(_0x3c393d,null))[_0xbaaf('0x25')](function(_0x2ff47a){if(_0x2ff47a){if(!fs[_0xbaaf('0x4f')](path[_0xbaaf('0x50')](config[_0xbaaf('0x51')],_0xbaaf('0x52'),_0x2ff47a['save_name']+'.'+_0x2ff47a[_0xbaaf('0x4e')]))){throw new db[(_0xbaaf('0x53'))]['ValidationError']('Sound\x20not\x20found');}return _0x3c393d['download'](path[_0xbaaf('0x50')](config['root'],_0xbaaf('0x52'),util[_0xbaaf('0x54')]('%s.%s',_0x2ff47a[_0xbaaf('0x4d')],_0x2ff47a[_0xbaaf('0x4e')])),util['format'](_0xbaaf('0x55'),_0x2ff47a[_0xbaaf('0x2a')],_0x2ff47a['converted_format']));}return null;})[_0xbaaf('0x56')](handleError(_0x3c393d,null));};exports[_0xbaaf('0x57')]=function(_0x462bab,_0x717f62,_0x452974){var _0x56fa44={'name':path[_0xbaaf('0x58')](_0x462bab[_0xbaaf('0x59')][_0xbaaf('0x5a')],path[_0xbaaf('0x5b')](_0x462bab[_0xbaaf('0x59')]['originalname'])),'save_name':path[_0xbaaf('0x58')](_0x462bab[_0xbaaf('0x59')][_0xbaaf('0x5c')],path[_0xbaaf('0x5b')](_0x462bab[_0xbaaf('0x59')][_0xbaaf('0x5c')])),'original_format':path[_0xbaaf('0x5b')](_0x462bab['file'][_0xbaaf('0x5a')])['substring'](0x1),'converted_format':'wav'};var _0x39200d=path['join'](config[_0xbaaf('0x51')],_0xbaaf('0x5d'),_0x462bab[_0xbaaf('0x59')][_0xbaaf('0x5c')]);var _0x409256=path[_0xbaaf('0x50')](config[_0xbaaf('0x51')],'server/files/sounds/converted',util['format'](_0xbaaf('0x55'),path[_0xbaaf('0x58')](_0x462bab[_0xbaaf('0x59')]['filename'],path['extname'](_0x462bab['file']['filename'])),_0x56fa44['converted_format']));logger[_0xbaaf('0x5e')]('Sound\x20upload\x20filepath:\x20%s',_0x39200d);logger[_0xbaaf('0x5e')](_0xbaaf('0x5f'),_0x409256);try{fs[_0xbaaf('0x60')](_0x39200d,parseInt(_0xbaaf('0x61'),0x8));var _0x50815c=sox[_0xbaaf('0x62')](_0x39200d,_0x409256,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x50815c['on']('error',function(_0x520735){fs[_0xbaaf('0x63')](_0x39200d);_0x717f62[_0xbaaf('0x1c')](0x1f4)[_0xbaaf('0x2b')](_0x520735);});_0x50815c['on'](_0xbaaf('0x64'),function(_0x4938d0){_0x56fa44[_0xbaaf('0x65')]=isNaN(_0x4938d0[_0xbaaf('0x66')])?null:_0x4938d0[_0xbaaf('0x66')]*0x3e8;_0x56fa44[_0xbaaf('0x67')]=isNaN(_0x4938d0[_0xbaaf('0x68')])?null:_0x4938d0[_0xbaaf('0x68')];_0x56fa44[_0xbaaf('0x69')]=isNaN(_0x4938d0[_0xbaaf('0x6a')])?null:_0x4938d0[_0xbaaf('0x6a')];_0x56fa44[_0xbaaf('0x6b')]=isNaN(_0x4938d0[_0xbaaf('0x6c')])?null:_0x4938d0['bitRate'];_0x56fa44[_0xbaaf('0x6d')]=isNaN(_0x4938d0[_0xbaaf('0x6e')])?null:_0x4938d0['sampleRate'];});_0x50815c['on'](_0xbaaf('0x6f'),function(_0x1686ce){_0x56fa44['converted_duration']=isNaN(_0x1686ce['duration'])?null:_0x1686ce['duration']*0x3e8;_0x56fa44[_0xbaaf('0x70')]=isNaN(_0x1686ce['sampleCount'])?null:_0x1686ce[_0xbaaf('0x68')];_0x56fa44[_0xbaaf('0x71')]=isNaN(_0x1686ce[_0xbaaf('0x6a')])?null:_0x1686ce[_0xbaaf('0x6a')];_0x56fa44['converted_bitRate']=isNaN(_0x1686ce[_0xbaaf('0x6c')])?null:_0x1686ce[_0xbaaf('0x6c')];_0x56fa44[_0xbaaf('0x72')]=isNaN(_0x1686ce[_0xbaaf('0x6e')])?null:_0x1686ce[_0xbaaf('0x6e')];});_0x50815c['on'](_0xbaaf('0x1d'),function(){fs[_0xbaaf('0x60')](_0x409256,parseInt('0777',0x8));return db[_0xbaaf('0x42')][_0xbaaf('0x57')](_0x56fa44)[_0xbaaf('0x25')](function(_0x16abe1){var _0x4e8a12={'role':_0x462bab['body'][_0xbaaf('0x73')],'userProfileId':_0x462bab['body'][_0xbaaf('0x74')]};if(!_0x4e8a12)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4e8a12[_0xbaaf('0x73')]===_0xbaaf('0x75')){var _0x3595c2=_0x16abe1[_0xbaaf('0x27')]({'plain':!![]});return db[_0xbaaf('0x76')]['find']({'where':{'name':_0xbaaf('0x77'),'userProfileId':_0x4e8a12[_0xbaaf('0x74')]},'raw':!![]})['then'](function(_0x1f4b48){if(_0x1f4b48&&_0x1f4b48[_0xbaaf('0x78')]===0x0){return db[_0xbaaf('0x28')][_0xbaaf('0x57')]({'name':_0x3595c2[_0xbaaf('0x2a')],'resourceId':_0x3595c2['id'],'type':_0x1f4b48[_0xbaaf('0x2a')],'sectionId':_0x1f4b48['id']},{})[_0xbaaf('0x25')](function(){return _0x16abe1;});}else{return _0x16abe1;}})[_0xbaaf('0x56')](function(_0x2bcb05){logger[_0xbaaf('0x29')](_0xbaaf('0x79'),_0x2bcb05);throw _0x2bcb05;});}return _0x16abe1;})['then'](respondWithResult(_0x717f62,null))[_0xbaaf('0x56')](handleError(_0x717f62,null));});_0x50815c[_0xbaaf('0x7a')]();}catch(_0x541b6a){_0x717f62['status'](0x1f4)[_0xbaaf('0x2b')](_0x541b6a);}};exports[_0xbaaf('0x24')]=function(_0x57fa23,_0x4ff5b5,_0x5a17db){return db[_0xbaaf('0x42')]['find']({'where':{'id':_0x57fa23['params']['id']}})[_0xbaaf('0x25')](handleEntityNotFound(_0x4ff5b5,null))['then'](saveUpdates(_['pick'](_0x57fa23[_0xbaaf('0x7b')],[_0xbaaf('0x2a'),'description']),null))[_0xbaaf('0x25')](respondWithResult(_0x4ff5b5,null))[_0xbaaf('0x56')](handleError(_0x4ff5b5,null));};exports['delete']=function(_0xf05c4d,_0x84b01a,_0x5038c0){return db[_0xbaaf('0x42')][_0xbaaf('0x4b')]({'where':{'id':_0xf05c4d[_0xbaaf('0x48')]['id']}})[_0xbaaf('0x25')](function(_0x103af2){if(_0x103af2){return _0x103af2[_0xbaaf('0x26')]();}})[_0xbaaf('0x25')](function(_0x404d3c){var _0x1871d2=path['join'](config[_0xbaaf('0x51')],_0xbaaf('0x5d'),util[_0xbaaf('0x54')](_0xbaaf('0x55'),_0x404d3c[_0xbaaf('0x4d')],_0x404d3c[_0xbaaf('0x7c')]));var _0x11017a=path[_0xbaaf('0x50')](config[_0xbaaf('0x51')],'server/files/sounds/converted',util['format'](_0xbaaf('0x55'),_0x404d3c[_0xbaaf('0x4d')],_0x404d3c[_0xbaaf('0x4e')]));fs[_0xbaaf('0x63')](_0x1871d2);fs[_0xbaaf('0x63')](_0x11017a);return _0x404d3c;})[_0xbaaf('0x25')](function(_0x4d50c3){if(_0x4d50c3){return _0x84b01a[_0xbaaf('0x1c')](0xcc)[_0xbaaf('0x1d')]();}})[_0xbaaf('0x25')](handleEntityNotFound(_0x84b01a,null))[_0xbaaf('0x56')](handleError(_0x84b01a,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index b8210eb..e0c8c91 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 _0x456b=['path','./sound.attributes','exports','Sound','tools_sounds','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x535749,_0x422592){var _0x3cf9c4=function(_0x3ee0c8){while(--_0x3ee0c8){_0x535749['push'](_0x535749['shift']());}};_0x3cf9c4(++_0x422592);}(_0x456b,0x19d));var _0xb456=function(_0x32e9b6,_0x1dc950){_0x32e9b6=_0x32e9b6-0x0;var _0x35ca84=_0x456b[_0x32e9b6];return _0x35ca84;};'use strict';var _=require(_0xb456('0x0'));var util=require(_0xb456('0x1'));var logger=require(_0xb456('0x2'))(_0xb456('0x3'));var moment=require(_0xb456('0x4'));var BPromise=require(_0xb456('0x5'));var rp=require(_0xb456('0x6'));var fs=require('fs');var path=require(_0xb456('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb456('0x8'));module[_0xb456('0x9')]=function(_0xf26491,_0xce2c64){return _0xf26491['define'](_0xb456('0xa'),attributes,{'tableName':_0xb456('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0feb=['define','Sound','tools_sounds','lodash','util','api','moment','bluebird','request-promise','../../config/environment','exports'];(function(_0x46c087,_0x3db911){var _0x3b0c0b=function(_0x37d1a1){while(--_0x37d1a1){_0x46c087['push'](_0x46c087['shift']());}};_0x3b0c0b(++_0x3db911);}(_0x0feb,0x1dc));var _0xb0fe=function(_0x2dc78c,_0x3f8259){_0x2dc78c=_0x2dc78c-0x0;var _0x2f0753=_0x0feb[_0x2dc78c];return _0x2f0753;};'use strict';var _=require(_0xb0fe('0x0'));var util=require(_0xb0fe('0x1'));var logger=require('../../config/logger')(_0xb0fe('0x2'));var moment=require(_0xb0fe('0x3'));var BPromise=require(_0xb0fe('0x4'));var rp=require(_0xb0fe('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb0fe('0x6'));var attributes=require('./sound.attributes');module[_0xb0fe('0x7')]=function(_0x1f4633,_0x59933e){return _0x1f4633[_0xb0fe('0x8')](_0xb0fe('0x9'),attributes,{'tableName':_0xb0fe('0xa'),'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 580874d..84283b3 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 _0x1148=['jayson/promise','client','http','request','then','info','Sound,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','ShowSound','Sound','find','options','raw','map','include','model','attributes','lodash','bluebird','../../mysqldb','../../config/logger','rpc'];(function(_0x506745,_0x4f0517){var _0x9da7b1=function(_0x366771){while(--_0x366771){_0x506745['push'](_0x506745['shift']());}};_0x9da7b1(++_0x4f0517);}(_0x1148,0x1d7));var _0x8114=function(_0x561a4a,_0x119b22){_0x561a4a=_0x561a4a-0x0;var _0x5e36b9=_0x1148[_0x561a4a];return _0x5e36b9;};'use strict';var _=require(_0x8114('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x8114('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8114('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x8114('0x3'))(_0x8114('0x4'));var config=require('../../config/environment');var jayson=require(_0x8114('0x5'));var client=jayson[_0x8114('0x6')][_0x8114('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x75719c,_0x4c4384,_0x2248e5){return new BPromise(function(_0x303047,_0x37f95f){return client[_0x8114('0x8')](_0x75719c,_0x2248e5)[_0x8114('0x9')](function(_0x519e06){logger[_0x8114('0xa')](_0x8114('0xb'),_0x4c4384,_0x8114('0xc'));logger[_0x8114('0xd')]('Sound,\x20%s,\x20%s,\x20%s',_0x4c4384,_0x8114('0xc'),JSON[_0x8114('0xe')](_0x519e06));if(_0x519e06[_0x8114('0xf')]){if(_0x519e06[_0x8114('0xf')]['code']===0x1f4){logger[_0x8114('0xf')](_0x8114('0xb'),_0x4c4384,_0x519e06[_0x8114('0xf')][_0x8114('0x10')]);return _0x37f95f(_0x519e06[_0x8114('0xf')][_0x8114('0x10')]);}logger[_0x8114('0xf')]('Sound,\x20%s,\x20%s',_0x4c4384,_0x519e06[_0x8114('0xf')][_0x8114('0x10')]);return _0x303047(_0x519e06[_0x8114('0xf')][_0x8114('0x10')]);}else{logger[_0x8114('0xa')]('Sound,\x20%s,\x20%s',_0x4c4384,'request\x20sent');_0x303047(_0x519e06[_0x8114('0x11')][_0x8114('0x10')]);}})[_0x8114('0x12')](function(_0x207822){logger[_0x8114('0xf')]('Sound,\x20%s,\x20%s',_0x4c4384,_0x207822);_0x37f95f(_0x207822);});});}exports[_0x8114('0x13')]=function(_0x4f7a81){var _0x437058=this;return new Promise(function(_0x38efbc,_0x24f1e8){return db[_0x8114('0x14')][_0x8114('0x15')]({'raw':_0x4f7a81[_0x8114('0x16')]?_0x4f7a81[_0x8114('0x16')][_0x8114('0x17')]===undefined?!![]:![]:!![],'where':_0x4f7a81[_0x8114('0x16')]?_0x4f7a81[_0x8114('0x16')]['where']||null:null,'attributes':_0x4f7a81[_0x8114('0x16')]?_0x4f7a81['options']['attributes']||null:null,'include':_0x4f7a81[_0x8114('0x16')]?_0x4f7a81['options']['include']?_[_0x8114('0x18')](_0x4f7a81['options'][_0x8114('0x19')],function(_0x48ec41){return{'model':db[_0x48ec41[_0x8114('0x1a')]],'as':_0x48ec41['as'],'attributes':_0x48ec41[_0x8114('0x1b')],'include':_0x48ec41['include']?_[_0x8114('0x18')](_0x48ec41[_0x8114('0x19')],function(_0x10def6){return{'model':db[_0x10def6['model']],'as':_0x10def6['as'],'attributes':_0x10def6[_0x8114('0x1b')],'include':_0x10def6['include']?_[_0x8114('0x18')](_0x10def6[_0x8114('0x19')],function(_0x5dfbfc){return{'model':db[_0x5dfbfc[_0x8114('0x1a')]],'as':_0x5dfbfc['as'],'attributes':_0x5dfbfc['attributes']};}):[]};}):[]};}):[]:[]})[_0x8114('0x9')](function(_0x5f3c35){logger['info'](_0x8114('0x13'),_0x4f7a81);logger[_0x8114('0xd')](_0x8114('0x13'),_0x4f7a81,JSON['stringify'](_0x5f3c35));_0x38efbc(_0x5f3c35);})[_0x8114('0x12')](function(_0x5cc881){logger['error'](_0x8114('0x13'),_0x5cc881[_0x8114('0x10')],_0x4f7a81);_0x24f1e8(_0x437058[_0x8114('0xf')](0x1f4,_0x5cc881[_0x8114('0x10')]));});});}; \ No newline at end of file +var _0x643b=['attributes','include','map','model','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','Sound,\x20%s,\x20%s','debug','Sound,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','ShowSound','Sound','find','options','raw','where'];(function(_0x4ad53c,_0x28e859){var _0x18c534=function(_0x2ff871){while(--_0x2ff871){_0x4ad53c['push'](_0x4ad53c['shift']());}};_0x18c534(++_0x28e859);}(_0x643b,0x11b));var _0xb643=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x643b[_0x42cae2];return _0x5f256f;};'use strict';var _=require('lodash');var util=require(_0xb643('0x0'));var moment=require(_0xb643('0x1'));var BPromise=require('bluebird');var rs=require(_0xb643('0x2'));var fs=require('fs');var Redis=require(_0xb643('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xb643('0x4'));var logger=require(_0xb643('0x5'))(_0xb643('0x6'));var config=require(_0xb643('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xb643('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x57598c,_0x41103d,_0x4b0516){return new BPromise(function(_0x2417d5,_0x2ea1dd){return client['request'](_0x57598c,_0x4b0516)[_0xb643('0x9')](function(_0x5462e2){logger[_0xb643('0xa')](_0xb643('0xb'),_0x41103d,'request\x20sent');logger[_0xb643('0xc')](_0xb643('0xd'),_0x41103d,_0xb643('0xe'),JSON[_0xb643('0xf')](_0x5462e2));if(_0x5462e2[_0xb643('0x10')]){if(_0x5462e2[_0xb643('0x10')][_0xb643('0x11')]===0x1f4){logger[_0xb643('0x10')]('Sound,\x20%s,\x20%s',_0x41103d,_0x5462e2[_0xb643('0x10')][_0xb643('0x12')]);return _0x2ea1dd(_0x5462e2[_0xb643('0x10')][_0xb643('0x12')]);}logger[_0xb643('0x10')]('Sound,\x20%s,\x20%s',_0x41103d,_0x5462e2[_0xb643('0x10')]['message']);return _0x2417d5(_0x5462e2['error'][_0xb643('0x12')]);}else{logger[_0xb643('0xa')](_0xb643('0xb'),_0x41103d,_0xb643('0xe'));_0x2417d5(_0x5462e2[_0xb643('0x13')][_0xb643('0x12')]);}})[_0xb643('0x14')](function(_0x5d6b56){logger['error'](_0xb643('0xb'),_0x41103d,_0x5d6b56);_0x2ea1dd(_0x5d6b56);});});}exports[_0xb643('0x15')]=function(_0x10b2d5){var _0x13a3aa=this;return new Promise(function(_0x1c8bd5,_0x5203b4){return db[_0xb643('0x16')][_0xb643('0x17')]({'raw':_0x10b2d5[_0xb643('0x18')]?_0x10b2d5['options'][_0xb643('0x19')]===undefined?!![]:![]:!![],'where':_0x10b2d5[_0xb643('0x18')]?_0x10b2d5['options'][_0xb643('0x1a')]||null:null,'attributes':_0x10b2d5['options']?_0x10b2d5[_0xb643('0x18')][_0xb643('0x1b')]||null:null,'include':_0x10b2d5[_0xb643('0x18')]?_0x10b2d5['options'][_0xb643('0x1c')]?_[_0xb643('0x1d')](_0x10b2d5[_0xb643('0x18')][_0xb643('0x1c')],function(_0x514133){return{'model':db[_0x514133[_0xb643('0x1e')]],'as':_0x514133['as'],'attributes':_0x514133[_0xb643('0x1b')],'include':_0x514133[_0xb643('0x1c')]?_[_0xb643('0x1d')](_0x514133[_0xb643('0x1c')],function(_0x9a5920){return{'model':db[_0x9a5920[_0xb643('0x1e')]],'as':_0x9a5920['as'],'attributes':_0x9a5920[_0xb643('0x1b')],'include':_0x9a5920[_0xb643('0x1c')]?_[_0xb643('0x1d')](_0x9a5920[_0xb643('0x1c')],function(_0x327091){return{'model':db[_0x327091[_0xb643('0x1e')]],'as':_0x327091['as'],'attributes':_0x327091[_0xb643('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xb643('0x9')](function(_0x23a25a){logger[_0xb643('0xa')](_0xb643('0x15'),_0x10b2d5);logger['debug'](_0xb643('0x15'),_0x10b2d5,JSON[_0xb643('0xf')](_0x23a25a));_0x1c8bd5(_0x23a25a);})['catch'](function(_0x37c299){logger[_0xb643('0x10')](_0xb643('0x15'),_0x37c299[_0xb643('0x12')],_0x10b2d5);_0x5203b4(_0x13a3aa[_0xb643('0x10')](0x1f4,_0x37c299[_0xb643('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 93b5096..66c342e 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 _0x0b0e=['./squareMessage.controller','get','isAuthenticated','index','show','post','create','/:id','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3984a6,_0x4adaba){var _0x2cc75f=function(_0x4a3849){while(--_0x4a3849){_0x3984a6['push'](_0x3984a6['shift']());}};_0x2cc75f(++_0x4adaba);}(_0x0b0e,0x187));var _0xe0b0=function(_0x51b0dc,_0x5307b7){_0x51b0dc=_0x51b0dc-0x0;var _0x13fa89=_0x0b0e[_0x51b0dc];return _0x13fa89;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var fs_extra=require(_0xe0b0('0x4'));var auth=require(_0xe0b0('0x5'));var interaction=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var controller=require(_0xe0b0('0x8'));router[_0xe0b0('0x9')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xb')]);router[_0xe0b0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0xd')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xe')]);router['put'](_0xe0b0('0xf'),auth[_0xe0b0('0xa')](),controller['update']);router[_0xe0b0('0x10')](_0xe0b0('0xf'),auth['isAuthenticated'](),controller[_0xe0b0('0x11')]);module[_0xe0b0('0x12')]=router; \ No newline at end of file +var _0xb7e7=['exports','multer','path','express','fs-extra','../../components/interaction/service','../../config/environment','./squareMessage.controller','index','get','/:id','show','post','isAuthenticated','create','put','delete','destroy'];(function(_0x17d4ae,_0x95fba7){var _0x54aa77=function(_0x4f4bdd){while(--_0x4f4bdd){_0x17d4ae['push'](_0x17d4ae['shift']());}};_0x54aa77(++_0x95fba7);}(_0xb7e7,0x121));var _0x7b7e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xb7e7[_0x38a7ac];return _0x53061a;};'use strict';var multer=require(_0x7b7e('0x0'));var util=require('util');var path=require(_0x7b7e('0x1'));var timeout=require('connect-timeout');var express=require(_0x7b7e('0x2'));var router=express['Router']();var fs_extra=require(_0x7b7e('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var controller=require(_0x7b7e('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x7b7e('0x7')]);router[_0x7b7e('0x8')](_0x7b7e('0x9'),auth['isAuthenticated'](),controller[_0x7b7e('0xa')]);router[_0x7b7e('0xb')]('/',auth[_0x7b7e('0xc')](),controller[_0x7b7e('0xd')]);router[_0x7b7e('0xe')](_0x7b7e('0x9'),auth[_0x7b7e('0xc')](),controller['update']);router[_0x7b7e('0xf')](_0x7b7e('0x9'),auth[_0x7b7e('0xc')](),controller[_0x7b7e('0x10')]);module[_0x7b7e('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index e9360f5..0749450 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 _0x049d=['TEXT','sequelize','exports','STRING','medium','ENUM','out'];(function(_0x3b62bf,_0x383b98){var _0x2e4fa5=function(_0x46bc4e){while(--_0x46bc4e){_0x3b62bf['push'](_0x3b62bf['shift']());}};_0x2e4fa5(++_0x383b98);}(_0x049d,0xc5));var _0xd049=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x049d[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xd049('0x0'));module[_0xd049('0x1')]={'uniqueid':{'type':Sequelize[_0xd049('0x2')]},'body':{'type':Sequelize['TEXT'](_0xd049('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0xd049('0x4')]('in',_0xd049('0x5')),'defaultValue':_0xd049('0x5'),'allowNull':![]},'providerName':{'type':Sequelize[_0xd049('0x2')]},'providerResponse':{'type':Sequelize[_0xd049('0x6')]}}; \ No newline at end of file +var _0x1b53=['sequelize','TEXT','medium','ENUM','out','STRING'];(function(_0x302416,_0x1b5caf){var _0x38d027=function(_0x15f8b0){while(--_0x15f8b0){_0x302416['push'](_0x302416['shift']());}};_0x38d027(++_0x1b5caf);}(_0x1b53,0x1da));var _0x31b5=function(_0x189194,_0xd7104d){_0x189194=_0x189194-0x0;var _0x352623=_0x1b53[_0x189194];return _0x352623;};'use strict';var Sequelize=require(_0x31b5('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize[_0x31b5('0x1')](_0x31b5('0x2')),'allowNull':![]},'direction':{'type':Sequelize[_0x31b5('0x3')]('in',_0x31b5('0x4')),'defaultValue':_0x31b5('0x4'),'allowNull':![]},'providerName':{'type':Sequelize[_0x31b5('0x5')]},'providerResponse':{'type':Sequelize[_0x31b5('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 8bbbcfb..c539bd1 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 _0x8824=['sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','then','destroy','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','SquareMessage','includeAll','rows','catch','show','params','include','find','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path'];(function(_0x49d42e,_0x4fd515){var _0x1cf764=function(_0x13b57c){while(--_0x13b57c){_0x49d42e['push'](_0x49d42e['shift']());}};_0x1cf764(++_0x4fd515);}(_0x8824,0xe0));var _0x4882=function(_0x45195e,_0x340304){_0x45195e=_0x45195e-0x0;var _0x2b0e47=_0x8824[_0x45195e];return _0x2b0e47;};'use strict';var emlformat=require(_0x4882('0x0'));var rimraf=require(_0x4882('0x1'));var zipdir=require(_0x4882('0x2'));var jsonpatch=require(_0x4882('0x3'));var rp=require(_0x4882('0x4'));var moment=require(_0x4882('0x5'));var BPromise=require(_0x4882('0x6'));var Mustache=require(_0x4882('0x7'));var util=require(_0x4882('0x8'));var path=require(_0x4882('0x9'));var sox=require(_0x4882('0xa'));var csv=require(_0x4882('0xb'));var ejs=require(_0x4882('0xc'));var fs=require('fs');var fs_extra=require(_0x4882('0xd'));var _=require(_0x4882('0xe'));var squel=require(_0x4882('0xf'));var crypto=require(_0x4882('0x10'));var jsforce=require(_0x4882('0x11'));var deskjs=require(_0x4882('0x12'));var toCsv=require(_0x4882('0xb'));var querystring=require(_0x4882('0x13'));var Papa=require(_0x4882('0x14'));var Redis=require('ioredis');var authService=require(_0x4882('0x15'));var qs=require(_0x4882('0x16'));var as=require(_0x4882('0x17'));var hardwareService=require(_0x4882('0x18'));var logger=require(_0x4882('0x19'))(_0x4882('0x1a'));var utils=require('../../config/utils');var config=require(_0x4882('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0x4882('0x1c'))['db'];function respondWithStatusCode(_0x527f5,_0x45547f){_0x45547f=_0x45547f||0xcc;return function(_0x4f5029){if(_0x4f5029){return _0x527f5[_0x4882('0x1d')](_0x45547f);}return _0x527f5[_0x4882('0x1e')](_0x45547f)[_0x4882('0x1f')]();};}function respondWithResult(_0x2ef6d1,_0x52d77b){_0x52d77b=_0x52d77b||0xc8;return function(_0x21dc93){if(_0x21dc93){return _0x2ef6d1[_0x4882('0x1e')](_0x52d77b)[_0x4882('0x20')](_0x21dc93);}};}function respondWithFilteredResult(_0x5a1e5a,_0x490d60){return function(_0x3f9850){if(_0x3f9850){var _0x56f00b=typeof _0x490d60[_0x4882('0x21')]==='undefined'&&typeof _0x490d60[_0x4882('0x22')]===_0x4882('0x23');var _0x68aa6d=_0x3f9850[_0x4882('0x24')];var _0x730bc7=_0x56f00b?0x0:_0x490d60['offset'];var _0x5c2c84=_0x56f00b?_0x3f9850['count']:_0x490d60[_0x4882('0x21')]+_0x490d60[_0x4882('0x22')];var _0x2755cd;if(_0x5c2c84>=_0x68aa6d){_0x5c2c84=_0x68aa6d;_0x2755cd=0xc8;}else{_0x2755cd=0xce;}_0x5a1e5a[_0x4882('0x1e')](_0x2755cd);return _0x5a1e5a[_0x4882('0x25')](_0x4882('0x26'),_0x730bc7+'-'+_0x5c2c84+'/'+_0x68aa6d)[_0x4882('0x20')](_0x3f9850);}return null;};}function patchUpdates(_0x37d45a){return function(_0x16d90d){try{jsonpatch[_0x4882('0x27')](_0x16d90d,_0x37d45a,!![]);}catch(_0x1017dd){return BPromise['reject'](_0x1017dd);}return _0x16d90d[_0x4882('0x28')]();};}function saveUpdates(_0x173b95,_0x4012b1){return function(_0x48e895){if(_0x48e895){return _0x48e895['update'](_0x173b95)[_0x4882('0x29')](function(_0x35cdbd){return _0x35cdbd;});}return null;};}function removeEntity(_0x5c8cb5,_0x133c70){return function(_0x559513){if(_0x559513){return _0x559513[_0x4882('0x2a')]()[_0x4882('0x29')](function(){_0x5c8cb5[_0x4882('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2956d6,_0x1652bf){return function(_0x16e7f2){if(!_0x16e7f2){_0x2956d6[_0x4882('0x1d')](0x194);}return _0x16e7f2;};}function handleError(_0x4c27da,_0x1183e8){_0x1183e8=_0x1183e8||0x1f4;return function(_0x14fb6d){logger[_0x4882('0x2b')](_0x14fb6d[_0x4882('0x2c')]);if(_0x14fb6d[_0x4882('0x2d')]){delete _0x14fb6d[_0x4882('0x2d')];}_0x4c27da[_0x4882('0x1e')](_0x1183e8)[_0x4882('0x2e')](_0x14fb6d);};}exports[_0x4882('0x2f')]=function(_0x210785,_0x42d1c3){var _0x47b636={},_0x5cfbe6={},_0x3a4ccc={'count':0x0,'rows':[]};var _0x35e71a=_['map'](db['SquareMessage'][_0x4882('0x30')],function(_0x247341){return{'name':_0x247341[_0x4882('0x31')],'type':_0x247341[_0x4882('0x32')][_0x4882('0x33')]};});_0x5cfbe6[_0x4882('0x34')]=_[_0x4882('0x35')](_0x35e71a,_0x4882('0x2d'));_0x5cfbe6[_0x4882('0x36')]=_[_0x4882('0x37')](_0x210785[_0x4882('0x36')]);_0x5cfbe6[_0x4882('0x38')]=_[_0x4882('0x39')](_0x5cfbe6[_0x4882('0x34')],_0x5cfbe6['query']);_0x47b636[_0x4882('0x3a')]=_['intersection'](_0x5cfbe6[_0x4882('0x34')],qs[_0x4882('0x3b')](_0x210785[_0x4882('0x36')]['fields']));_0x47b636[_0x4882('0x3a')]=_0x47b636[_0x4882('0x3a')][_0x4882('0x3c')]?_0x47b636[_0x4882('0x3a')]:_0x5cfbe6['model'];if(!_0x210785[_0x4882('0x36')]['hasOwnProperty'](_0x4882('0x3d'))){_0x47b636[_0x4882('0x22')]=qs[_0x4882('0x22')](_0x210785['query'][_0x4882('0x22')]);_0x47b636[_0x4882('0x21')]=qs['offset'](_0x210785['query'][_0x4882('0x21')]);}_0x47b636[_0x4882('0x3e')]=qs[_0x4882('0x3f')](_0x210785[_0x4882('0x36')]['sort']);_0x47b636[_0x4882('0x40')]=qs['filters'](_[_0x4882('0x41')](_0x210785[_0x4882('0x36')],_0x5cfbe6[_0x4882('0x38')]),_0x35e71a);if(_0x210785[_0x4882('0x36')][_0x4882('0x42')]){_0x47b636[_0x4882('0x40')]=_['merge'](_0x47b636[_0x4882('0x40')],{'$or':_[_0x4882('0x35')](_0x35e71a,function(_0x2edd9b){if(_0x2edd9b['type']!=='VIRTUAL'){var _0x14c213={};_0x14c213[_0x2edd9b[_0x4882('0x2d')]]={'$like':'%'+_0x210785['query'][_0x4882('0x42')]+'%'};return _0x14c213;}})});}_0x47b636=_[_0x4882('0x43')]({},_0x47b636,_0x210785['options']);var _0x2eac59={'where':_0x47b636[_0x4882('0x40')]};return db[_0x4882('0x44')][_0x4882('0x24')](_0x2eac59)[_0x4882('0x29')](function(_0x56267a){_0x3a4ccc[_0x4882('0x24')]=_0x56267a;if(_0x210785['query'][_0x4882('0x45')]){_0x47b636['include']=[{'all':!![]}];}return db[_0x4882('0x44')]['findAll'](_0x47b636);})[_0x4882('0x29')](function(_0x503bfe){_0x3a4ccc[_0x4882('0x46')]=_0x503bfe;return _0x3a4ccc;})['then'](respondWithFilteredResult(_0x42d1c3,_0x47b636))[_0x4882('0x47')](handleError(_0x42d1c3,null));};exports[_0x4882('0x48')]=function(_0x4ec575,_0x16c86a){var _0x4570e5={'raw':!![],'where':{'id':_0x4ec575[_0x4882('0x49')]['id']}},_0x50d977={};_0x50d977[_0x4882('0x34')]=_[_0x4882('0x37')](db[_0x4882('0x44')][_0x4882('0x30')]);_0x50d977[_0x4882('0x36')]=_[_0x4882('0x37')](_0x4ec575[_0x4882('0x36')]);_0x50d977[_0x4882('0x38')]=_[_0x4882('0x39')](_0x50d977['model'],_0x50d977[_0x4882('0x36')]);_0x4570e5[_0x4882('0x3a')]=_[_0x4882('0x39')](_0x50d977[_0x4882('0x34')],qs[_0x4882('0x3b')](_0x4ec575['query']['fields']));_0x4570e5['attributes']=_0x4570e5['attributes']['length']?_0x4570e5[_0x4882('0x3a')]:_0x50d977['model'];if(_0x4ec575['query'][_0x4882('0x45')]){_0x4570e5[_0x4882('0x4a')]=[{'all':!![]}];}_0x4570e5=_['merge']({},_0x4570e5,_0x4ec575['options']);return db['SquareMessage'][_0x4882('0x4b')](_0x4570e5)[_0x4882('0x29')](handleEntityNotFound(_0x16c86a,null))[_0x4882('0x29')](respondWithResult(_0x16c86a,null))['catch'](handleError(_0x16c86a,null));};exports['create']=function(_0x15e00c,_0x41292b){return db['SquareMessage']['create'](_0x15e00c[_0x4882('0x4c')],{})[_0x4882('0x29')](respondWithResult(_0x41292b,0xc9))[_0x4882('0x47')](handleError(_0x41292b,null));};exports[_0x4882('0x4d')]=function(_0x14e2ff,_0x17d4fe){if(_0x14e2ff[_0x4882('0x4c')]['id']){delete _0x14e2ff['body']['id'];}return db[_0x4882('0x44')][_0x4882('0x4b')]({'where':{'id':_0x14e2ff[_0x4882('0x49')]['id']}})[_0x4882('0x29')](handleEntityNotFound(_0x17d4fe,null))[_0x4882('0x29')](saveUpdates(_0x14e2ff[_0x4882('0x4c')],null))[_0x4882('0x29')](respondWithResult(_0x17d4fe,null))[_0x4882('0x47')](handleError(_0x17d4fe,null));};exports[_0x4882('0x2a')]=function(_0x120a0d,_0x56e919){return db[_0x4882('0x44')]['find']({'where':{'id':_0x120a0d[_0x4882('0x49')]['id']}})[_0x4882('0x29')](handleEntityNotFound(_0x56e919,null))[_0x4882('0x29')](removeEntity(_0x56e919,null))['catch'](handleError(_0x56e919,null));}; \ No newline at end of file +var _0x7c93=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','SquareMessage','includeAll','include','findAll','catch','show','params','find','body','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x2b41f0,_0x46f59b){var _0xf3365c=function(_0x1448cd){while(--_0x1448cd){_0x2b41f0['push'](_0x2b41f0['shift']());}};_0xf3365c(++_0x46f59b);}(_0x7c93,0x16e));var _0x37c9=function(_0x22423,_0x26bfb5){_0x22423=_0x22423-0x0;var _0x13989f=_0x7c93[_0x22423];return _0x13989f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x37c9('0x0'));var jsonpatch=require(_0x37c9('0x1'));var rp=require(_0x37c9('0x2'));var moment=require('moment');var BPromise=require(_0x37c9('0x3'));var Mustache=require(_0x37c9('0x4'));var util=require(_0x37c9('0x5'));var path=require(_0x37c9('0x6'));var sox=require(_0x37c9('0x7'));var csv=require(_0x37c9('0x8'));var ejs=require(_0x37c9('0x9'));var fs=require('fs');var fs_extra=require(_0x37c9('0xa'));var _=require(_0x37c9('0xb'));var squel=require(_0x37c9('0xc'));var crypto=require(_0x37c9('0xd'));var jsforce=require(_0x37c9('0xe'));var deskjs=require(_0x37c9('0xf'));var toCsv=require(_0x37c9('0x8'));var querystring=require(_0x37c9('0x10'));var Papa=require(_0x37c9('0x11'));var Redis=require(_0x37c9('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x37c9('0x13'));var as=require(_0x37c9('0x14'));var hardwareService=require(_0x37c9('0x15'));var logger=require(_0x37c9('0x16'))(_0x37c9('0x17'));var utils=require(_0x37c9('0x18'));var config=require(_0x37c9('0x19'));var licenseUtil=require(_0x37c9('0x1a'));var db=require(_0x37c9('0x1b'))['db'];function respondWithStatusCode(_0x317144,_0x146b8a){_0x146b8a=_0x146b8a||0xcc;return function(_0x8a8e03){if(_0x8a8e03){return _0x317144['sendStatus'](_0x146b8a);}return _0x317144[_0x37c9('0x1c')](_0x146b8a)[_0x37c9('0x1d')]();};}function respondWithResult(_0x28dc4f,_0x1a6553){_0x1a6553=_0x1a6553||0xc8;return function(_0x33c07c){if(_0x33c07c){return _0x28dc4f[_0x37c9('0x1c')](_0x1a6553)[_0x37c9('0x1e')](_0x33c07c);}};}function respondWithFilteredResult(_0x1377d4,_0x1181da){return function(_0x5adecd){if(_0x5adecd){var _0x3bf156=typeof _0x1181da[_0x37c9('0x1f')]==='undefined'&&typeof _0x1181da[_0x37c9('0x20')]===_0x37c9('0x21');var _0x35b72d=_0x5adecd[_0x37c9('0x22')];var _0x3b03c1=_0x3bf156?0x0:_0x1181da[_0x37c9('0x1f')];var _0x3938c2=_0x3bf156?_0x5adecd['count']:_0x1181da['offset']+_0x1181da[_0x37c9('0x20')];var _0x157350;if(_0x3938c2>=_0x35b72d){_0x3938c2=_0x35b72d;_0x157350=0xc8;}else{_0x157350=0xce;}_0x1377d4[_0x37c9('0x1c')](_0x157350);return _0x1377d4[_0x37c9('0x23')](_0x37c9('0x24'),_0x3b03c1+'-'+_0x3938c2+'/'+_0x35b72d)[_0x37c9('0x1e')](_0x5adecd);}return null;};}function patchUpdates(_0x1c78d5){return function(_0x7253f6){try{jsonpatch[_0x37c9('0x25')](_0x7253f6,_0x1c78d5,!![]);}catch(_0x9b63fd){return BPromise[_0x37c9('0x26')](_0x9b63fd);}return _0x7253f6[_0x37c9('0x27')]();};}function saveUpdates(_0x5a1ef5,_0x3aa32a){return function(_0x48f2fe){if(_0x48f2fe){return _0x48f2fe[_0x37c9('0x28')](_0x5a1ef5)[_0x37c9('0x29')](function(_0x1c0eaf){return _0x1c0eaf;});}return null;};}function removeEntity(_0x15dbeb,_0x3c9931){return function(_0x30b8e3){if(_0x30b8e3){return _0x30b8e3[_0x37c9('0x2a')]()['then'](function(){_0x15dbeb[_0x37c9('0x1c')](0xcc)[_0x37c9('0x1d')]();});}};}function handleEntityNotFound(_0x463213,_0x37eb03){return function(_0x440677){if(!_0x440677){_0x463213[_0x37c9('0x2b')](0x194);}return _0x440677;};}function handleError(_0x4a2ade,_0x1875c8){_0x1875c8=_0x1875c8||0x1f4;return function(_0x53c7a9){logger[_0x37c9('0x2c')](_0x53c7a9['stack']);if(_0x53c7a9[_0x37c9('0x2d')]){delete _0x53c7a9['name'];}_0x4a2ade[_0x37c9('0x1c')](_0x1875c8)['send'](_0x53c7a9);};}exports['index']=function(_0x2966f6,_0x23542b){var _0xc2b21e={},_0x4f9ab7={},_0x10663c={'count':0x0,'rows':[]};var _0x57fc0b=_[_0x37c9('0x2e')](db['SquareMessage'][_0x37c9('0x2f')],function(_0x12daa3){return{'name':_0x12daa3[_0x37c9('0x30')],'type':_0x12daa3[_0x37c9('0x31')][_0x37c9('0x32')]};});_0x4f9ab7[_0x37c9('0x33')]=_[_0x37c9('0x2e')](_0x57fc0b,'name');_0x4f9ab7[_0x37c9('0x34')]=_[_0x37c9('0x35')](_0x2966f6[_0x37c9('0x34')]);_0x4f9ab7['filters']=_[_0x37c9('0x36')](_0x4f9ab7[_0x37c9('0x33')],_0x4f9ab7[_0x37c9('0x34')]);_0xc2b21e[_0x37c9('0x37')]=_[_0x37c9('0x36')](_0x4f9ab7[_0x37c9('0x33')],qs[_0x37c9('0x38')](_0x2966f6['query']['fields']));_0xc2b21e[_0x37c9('0x37')]=_0xc2b21e[_0x37c9('0x37')][_0x37c9('0x39')]?_0xc2b21e[_0x37c9('0x37')]:_0x4f9ab7['model'];if(!_0x2966f6[_0x37c9('0x34')][_0x37c9('0x3a')](_0x37c9('0x3b'))){_0xc2b21e[_0x37c9('0x20')]=qs['limit'](_0x2966f6['query'][_0x37c9('0x20')]);_0xc2b21e['offset']=qs[_0x37c9('0x1f')](_0x2966f6['query'][_0x37c9('0x1f')]);}_0xc2b21e[_0x37c9('0x3c')]=qs[_0x37c9('0x3d')](_0x2966f6['query']['sort']);_0xc2b21e[_0x37c9('0x3e')]=qs['filters'](_[_0x37c9('0x3f')](_0x2966f6[_0x37c9('0x34')],_0x4f9ab7['filters']),_0x57fc0b);if(_0x2966f6[_0x37c9('0x34')]['filter']){_0xc2b21e[_0x37c9('0x3e')]=_[_0x37c9('0x40')](_0xc2b21e['where'],{'$or':_[_0x37c9('0x2e')](_0x57fc0b,function(_0x3093aa){if(_0x3093aa['type']!==_0x37c9('0x41')){var _0x12af74={};_0x12af74[_0x3093aa['name']]={'$like':'%'+_0x2966f6['query'][_0x37c9('0x42')]+'%'};return _0x12af74;}})});}_0xc2b21e=_[_0x37c9('0x40')]({},_0xc2b21e,_0x2966f6[_0x37c9('0x43')]);var _0x4892cd={'where':_0xc2b21e[_0x37c9('0x3e')]};return db[_0x37c9('0x44')]['count'](_0x4892cd)[_0x37c9('0x29')](function(_0x4bdfc5){_0x10663c[_0x37c9('0x22')]=_0x4bdfc5;if(_0x2966f6[_0x37c9('0x34')][_0x37c9('0x45')]){_0xc2b21e[_0x37c9('0x46')]=[{'all':!![]}];}return db[_0x37c9('0x44')][_0x37c9('0x47')](_0xc2b21e);})[_0x37c9('0x29')](function(_0x59b8b3){_0x10663c['rows']=_0x59b8b3;return _0x10663c;})[_0x37c9('0x29')](respondWithFilteredResult(_0x23542b,_0xc2b21e))[_0x37c9('0x48')](handleError(_0x23542b,null));};exports[_0x37c9('0x49')]=function(_0x5029b1,_0x205683){var _0x1e53b1={'raw':!![],'where':{'id':_0x5029b1[_0x37c9('0x4a')]['id']}},_0x4be10b={};_0x4be10b['model']=_['keys'](db[_0x37c9('0x44')][_0x37c9('0x2f')]);_0x4be10b['query']=_[_0x37c9('0x35')](_0x5029b1[_0x37c9('0x34')]);_0x4be10b['filters']=_[_0x37c9('0x36')](_0x4be10b[_0x37c9('0x33')],_0x4be10b['query']);_0x1e53b1[_0x37c9('0x37')]=_[_0x37c9('0x36')](_0x4be10b[_0x37c9('0x33')],qs['fields'](_0x5029b1[_0x37c9('0x34')]['fields']));_0x1e53b1[_0x37c9('0x37')]=_0x1e53b1[_0x37c9('0x37')][_0x37c9('0x39')]?_0x1e53b1[_0x37c9('0x37')]:_0x4be10b[_0x37c9('0x33')];if(_0x5029b1[_0x37c9('0x34')]['includeAll']){_0x1e53b1[_0x37c9('0x46')]=[{'all':!![]}];}_0x1e53b1=_[_0x37c9('0x40')]({},_0x1e53b1,_0x5029b1['options']);return db[_0x37c9('0x44')][_0x37c9('0x4b')](_0x1e53b1)[_0x37c9('0x29')](handleEntityNotFound(_0x205683,null))[_0x37c9('0x29')](respondWithResult(_0x205683,null))['catch'](handleError(_0x205683,null));};exports['create']=function(_0x278d7d,_0xa03c01){return db[_0x37c9('0x44')]['create'](_0x278d7d[_0x37c9('0x4c')],{})['then'](respondWithResult(_0xa03c01,0xc9))[_0x37c9('0x48')](handleError(_0xa03c01,null));};exports[_0x37c9('0x28')]=function(_0x4d40e4,_0x4b677b){if(_0x4d40e4[_0x37c9('0x4c')]['id']){delete _0x4d40e4[_0x37c9('0x4c')]['id'];}return db['SquareMessage'][_0x37c9('0x4b')]({'where':{'id':_0x4d40e4[_0x37c9('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4b677b,null))[_0x37c9('0x29')](saveUpdates(_0x4d40e4[_0x37c9('0x4c')],null))[_0x37c9('0x29')](respondWithResult(_0x4b677b,null))[_0x37c9('0x48')](handleError(_0x4b677b,null));};exports[_0x37c9('0x2a')]=function(_0x2befd1,_0x1594ce){return db[_0x37c9('0x44')][_0x37c9('0x4b')]({'where':{'id':_0x2befd1['params']['id']}})['then'](handleEntityNotFound(_0x1594ce,null))[_0x37c9('0x29')](removeEntity(_0x1594ce,null))[_0x37c9('0x48')](handleError(_0x1594ce,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 8f86c8f..7e4c798 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 _0x2c47=['square_messages','lodash','../../config/logger','bluebird','request-promise','../../config/environment'];(function(_0x2dcef1,_0x21f2d7){var _0x23ded6=function(_0x2d6ac1){while(--_0x2d6ac1){_0x2dcef1['push'](_0x2dcef1['shift']());}};_0x23ded6(++_0x21f2d7);}(_0x2c47,0x85));var _0x72c4=function(_0x5e773a,_0x407471){_0x5e773a=_0x5e773a-0x0;var _0x5d8ade=_0x2c47[_0x5e773a];return _0x5d8ade;};'use strict';var _=require(_0x72c4('0x0'));var util=require('util');var logger=require(_0x72c4('0x1'))('api');var moment=require('moment');var BPromise=require(_0x72c4('0x2'));var rp=require(_0x72c4('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x72c4('0x4'));var attributes=require('./squareMessage.attributes');module['exports']=function(_0xbef0b2,_0x3f8a2c){return _0xbef0b2['define']('SquareMessage',attributes,{'tableName':_0x72c4('0x5'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8ff6=['rimraf','../../config/environment','./squareMessage.attributes','exports','define','SquareMessage','square_messages','lodash','util','api','moment','bluebird'];(function(_0x3317d1,_0xc52ed){var _0xb1ed76=function(_0x47a88f){while(--_0x47a88f){_0x3317d1['push'](_0x3317d1['shift']());}};_0xb1ed76(++_0xc52ed);}(_0x8ff6,0x10f));var _0x68ff=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8ff6[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x68ff('0x0'));var util=require(_0x68ff('0x1'));var logger=require('../../config/logger')(_0x68ff('0x2'));var moment=require(_0x68ff('0x3'));var BPromise=require(_0x68ff('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x68ff('0x5'));var config=require(_0x68ff('0x6'));var attributes=require(_0x68ff('0x7'));module[_0x68ff('0x8')]=function(_0x18f409,_0x5eb699){return _0x18f409[_0x68ff('0x9')](_0x68ff('0xa'),attributes,{'tableName':_0x68ff('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.rpc.js b/server/api/squareMessage/squareMessage.rpc.js index 9e5eb05..b3bc87b 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 _0x8675=['catch','CreateSquareMessage','SquareMessage','create','body','options','raw','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x55ca44,_0x521b05){var _0x5e8ce8=function(_0x3f9e2c){while(--_0x3f9e2c){_0x55ca44['push'](_0x55ca44['shift']());}};_0x5e8ce8(++_0x521b05);}(_0x8675,0x1a7));var _0x5867=function(_0x180cd0,_0x386c6e){_0x180cd0=_0x180cd0-0x0;var _0x49fc32=_0x8675[_0x180cd0];return _0x49fc32;};'use strict';var _=require('lodash');var util=require(_0x5867('0x0'));var moment=require('moment');var BPromise=require(_0x5867('0x1'));var rs=require(_0x5867('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5867('0x3'))['db'];var utils=require(_0x5867('0x4'));var logger=require(_0x5867('0x5'))(_0x5867('0x6'));var config=require(_0x5867('0x7'));var jayson=require(_0x5867('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x176d17,_0x58d77d,_0x3be318){return new BPromise(function(_0x26b420,_0x3560c5){return client['request'](_0x176d17,_0x3be318)[_0x5867('0x9')](function(_0x437117){logger[_0x5867('0xa')](_0x5867('0xb'),_0x58d77d,_0x5867('0xc'));logger[_0x5867('0xd')](_0x5867('0xe'),_0x58d77d,'request\x20sent',JSON[_0x5867('0xf')](_0x437117));if(_0x437117[_0x5867('0x10')]){if(_0x437117['error'][_0x5867('0x11')]===0x1f4){logger[_0x5867('0x10')]('SquareMessage,\x20%s,\x20%s',_0x58d77d,_0x437117[_0x5867('0x10')][_0x5867('0x12')]);return _0x3560c5(_0x437117[_0x5867('0x10')][_0x5867('0x12')]);}logger[_0x5867('0x10')]('SquareMessage,\x20%s,\x20%s',_0x58d77d,_0x437117[_0x5867('0x10')]['message']);return _0x26b420(_0x437117['error']['message']);}else{logger['info']('SquareMessage,\x20%s,\x20%s',_0x58d77d,'request\x20sent');_0x26b420(_0x437117['result'][_0x5867('0x12')]);}})[_0x5867('0x13')](function(_0x565989){logger[_0x5867('0x10')](_0x5867('0xb'),_0x58d77d,_0x565989);_0x3560c5(_0x565989);});});}exports[_0x5867('0x14')]=function(_0x32025b){var _0x217d5b=this;return new Promise(function(_0x42e991,_0x367805){return db[_0x5867('0x15')][_0x5867('0x16')](_0x32025b[_0x5867('0x17')],{'raw':_0x32025b['options']?_0x32025b[_0x5867('0x18')][_0x5867('0x19')]===undefined?!![]:![]:!![]})[_0x5867('0x9')](function(_0x42a7f6){logger[_0x5867('0xa')]('CreateSquareMessage',_0x32025b);logger[_0x5867('0xd')]('CreateSquareMessage',_0x32025b,JSON[_0x5867('0xf')](_0x42a7f6));_0x42e991(_0x42a7f6);})[_0x5867('0x13')](function(_0x332ab5){logger[_0x5867('0x10')](_0x5867('0x14'),_0x332ab5[_0x5867('0x12')],_0x32025b);_0x367805(_0x217d5b[_0x5867('0x10')](0x1f4,_0x332ab5[_0x5867('0x12')]));});});}; \ No newline at end of file +var _0x085f=['result','catch','CreateSquareMessage','SquareMessage','create','options','raw','debug','lodash','util','randomstring','ioredis','../../config/logger','../../config/environment','client','http','request','then','info','SquareMessage,\x20%s,\x20%s','request\x20sent','SquareMessage,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x512171,_0x30f118){var _0x347b48=function(_0x1b578c){while(--_0x1b578c){_0x512171['push'](_0x512171['shift']());}};_0x347b48(++_0x30f118);}(_0x085f,0xe9));var _0xf085=function(_0x2e262e,_0x1525d4){_0x2e262e=_0x2e262e-0x0;var _0x33f175=_0x085f[_0x2e262e];return _0x33f175;};'use strict';var _=require(_0xf085('0x0'));var util=require(_0xf085('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf085('0x2'));var fs=require('fs');var Redis=require(_0xf085('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf085('0x4'))('rpc');var config=require(_0xf085('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xf085('0x6')][_0xf085('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x570981,_0xc286da,_0x42666d){return new BPromise(function(_0x7a4cfe,_0x5cc355){return client[_0xf085('0x8')](_0x570981,_0x42666d)[_0xf085('0x9')](function(_0x403d1a){logger[_0xf085('0xa')](_0xf085('0xb'),_0xc286da,_0xf085('0xc'));logger['debug'](_0xf085('0xd'),_0xc286da,_0xf085('0xc'),JSON['stringify'](_0x403d1a));if(_0x403d1a[_0xf085('0xe')]){if(_0x403d1a[_0xf085('0xe')][_0xf085('0xf')]===0x1f4){logger[_0xf085('0xe')]('SquareMessage,\x20%s,\x20%s',_0xc286da,_0x403d1a['error']['message']);return _0x5cc355(_0x403d1a['error'][_0xf085('0x10')]);}logger[_0xf085('0xe')](_0xf085('0xb'),_0xc286da,_0x403d1a[_0xf085('0xe')]['message']);return _0x7a4cfe(_0x403d1a[_0xf085('0xe')][_0xf085('0x10')]);}else{logger[_0xf085('0xa')](_0xf085('0xb'),_0xc286da,'request\x20sent');_0x7a4cfe(_0x403d1a[_0xf085('0x11')][_0xf085('0x10')]);}})[_0xf085('0x12')](function(_0x312f50){logger[_0xf085('0xe')](_0xf085('0xb'),_0xc286da,_0x312f50);_0x5cc355(_0x312f50);});});}exports[_0xf085('0x13')]=function(_0x4df9f7){var _0x6caa87=this;return new Promise(function(_0x14dabe,_0x395d88){return db[_0xf085('0x14')][_0xf085('0x15')](_0x4df9f7['body'],{'raw':_0x4df9f7[_0xf085('0x16')]?_0x4df9f7[_0xf085('0x16')][_0xf085('0x17')]===undefined?!![]:![]:!![]})[_0xf085('0x9')](function(_0x3fce8b){logger['info'](_0xf085('0x13'),_0x4df9f7);logger[_0xf085('0x18')](_0xf085('0x13'),_0x4df9f7,JSON['stringify'](_0x3fce8b));_0x14dabe(_0x3fce8b);})[_0xf085('0x12')](function(_0x38816b){logger['error'](_0xf085('0x13'),_0x38816b[_0xf085('0x10')],_0x4df9f7);_0x395d88(_0x6caa87[_0xf085('0xe')](0x1f4,_0x38816b['message']));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 1f5f554..18d174e 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 _0xc08a=['/:id/test','test','post','create','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','isAuthenticated','index','get','/:id','show'];(function(_0x34aeac,_0x5b6558){var _0x34cbdb=function(_0x5b72ba){while(--_0x5b72ba){_0x34aeac['push'](_0x34aeac['shift']());}};_0x34cbdb(++_0x5b6558);}(_0xc08a,0x1d4));var _0xac08=function(_0xdf55ca,_0x150ce5){_0xdf55ca=_0xdf55ca-0x0;var _0x136894=_0xc08a[_0xdf55ca];return _0x136894;};'use strict';var multer=require(_0xac08('0x0'));var util=require(_0xac08('0x1'));var path=require(_0xac08('0x2'));var timeout=require(_0xac08('0x3'));var express=require(_0xac08('0x4'));var router=express[_0xac08('0x5')]();var fs_extra=require(_0xac08('0x6'));var auth=require(_0xac08('0x7'));var interaction=require(_0xac08('0x8'));var config=require(_0xac08('0x9'));var controller=require(_0xac08('0xa'));router['get']('/',auth[_0xac08('0xb')](),controller[_0xac08('0xc')]);router[_0xac08('0xd')](_0xac08('0xe'),auth['isAuthenticated'](),controller[_0xac08('0xf')]);router[_0xac08('0xd')](_0xac08('0x10'),auth['isAuthenticated'](),timeout('15s'),controller[_0xac08('0x11')]);router[_0xac08('0x12')]('/',auth['isAuthenticated'](),controller[_0xac08('0x13')]);router['put'](_0xac08('0xe'),auth[_0xac08('0xb')](),controller[_0xac08('0x14')]);router['delete'](_0xac08('0xe'),auth[_0xac08('0xb')](),controller['destroy']);module[_0xac08('0x15')]=router; \ No newline at end of file +var _0x698d=['destroy','exports','multer','util','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','index','/:id','show','/:id/test','test','create','put','delete'];(function(_0x3e3ba6,_0x5e5ba1){var _0x1186e8=function(_0x1b6d19){while(--_0x1b6d19){_0x3e3ba6['push'](_0x3e3ba6['shift']());}};_0x1186e8(++_0x5e5ba1);}(_0x698d,0x158));var _0xd698=function(_0x2ab00c,_0x213a97){_0x2ab00c=_0x2ab00c-0x0;var _0x14f11c=_0x698d[_0x2ab00c];return _0x14f11c;};'use strict';var multer=require(_0xd698('0x0'));var util=require(_0xd698('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xd698('0x2'));var auth=require(_0xd698('0x3'));var interaction=require(_0xd698('0x4'));var config=require(_0xd698('0x5'));var controller=require(_0xd698('0x6'));router[_0xd698('0x7')]('/',auth[_0xd698('0x8')](),controller[_0xd698('0x9')]);router['get'](_0xd698('0xa'),auth['isAuthenticated'](),controller[_0xd698('0xb')]);router[_0xd698('0x7')](_0xd698('0xc'),auth[_0xd698('0x8')](),timeout('15s'),controller[_0xd698('0xd')]);router['post']('/',auth[_0xd698('0x8')](),controller[_0xd698('0xe')]);router[_0xd698('0xf')](_0xd698('0xa'),auth[_0xd698('0x8')](),controller['update']);router[_0xd698('0x10')](_0xd698('0xa'),auth[_0xd698('0x8')](),controller[_0xd698('0x11')]);module[_0xd698('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index ee315ac..fd37ffe 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 _0x2cd0=['exports','STRING','sequelize'];(function(_0x450afc,_0x6400ec){var _0x3f0855=function(_0x25bb3d){while(--_0x25bb3d){_0x450afc['push'](_0x450afc['shift']());}};_0x3f0855(++_0x6400ec);}(_0x2cd0,0x1a3));var _0x02cd=function(_0x214db9,_0x203265){_0x214db9=_0x214db9-0x0;var _0x59601c=_0x2cd0[_0x214db9];return _0x59601c;};'use strict';var Sequelize=require(_0x02cd('0x0'));module[_0x02cd('0x1')]={'name':{'type':Sequelize[_0x02cd('0x2')],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize[_0x02cd('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x89b1=['exports','STRING','name','sequelize'];(function(_0x1fcaf1,_0x21c3c2){var _0x55f464=function(_0x348eb3){while(--_0x348eb3){_0x1fcaf1['push'](_0x1fcaf1['shift']());}};_0x55f464(++_0x21c3c2);}(_0x89b1,0x1a7));var _0x189b=function(_0x328d59,_0x543156){_0x328d59=_0x328d59-0x0;var _0x312a9a=_0x89b1[_0x328d59];return _0x312a9a;};'use strict';var Sequelize=require(_0x189b('0x0'));module[_0x189b('0x1')]={'name':{'type':Sequelize[_0x189b('0x2')],'unique':_0x189b('0x3'),'allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x189b('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index a716732..8bd503f 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 _0x3e8e=['intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','merge','filter','options','where','include','findAll','catch','show','params','keys','includeAll','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','test','odbc','closeSync','eml-format','rimraf','zip-dir','request-promise','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','ODBC','UserProfileResource','then','error','stack','name','send','index','map','SquareOdbc','rawAttributes','fieldName','type','query','filters'];(function(_0x127c7b,_0x1f65e7){var _0x1708eb=function(_0x2033e5){while(--_0x2033e5){_0x127c7b['push'](_0x127c7b['shift']());}};_0x1708eb(++_0x1f65e7);}(_0x3e8e,0x6e));var _0xe3e8=function(_0x511566,_0x174556){_0x511566=_0x511566-0x0;var _0x1236b0=_0x3e8e[_0x511566];return _0x1236b0;};'use strict';var emlformat=require(_0xe3e8('0x0'));var rimraf=require(_0xe3e8('0x1'));var zipdir=require(_0xe3e8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe3e8('0x3'));var moment=require('moment');var BPromise=require(_0xe3e8('0x4'));var Mustache=require('mustache');var util=require(_0xe3e8('0x5'));var path=require('path');var sox=require(_0xe3e8('0x6'));var csv=require(_0xe3e8('0x7'));var ejs=require(_0xe3e8('0x8'));var fs=require('fs');var fs_extra=require(_0xe3e8('0x9'));var _=require(_0xe3e8('0xa'));var squel=require(_0xe3e8('0xb'));var crypto=require(_0xe3e8('0xc'));var jsforce=require(_0xe3e8('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xe3e8('0xe'));var Papa=require(_0xe3e8('0xf'));var Redis=require(_0xe3e8('0x10'));var authService=require(_0xe3e8('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe3e8('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xe3e8('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xe3e8('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4c22f8,_0x15c786){_0x15c786=_0x15c786||0xcc;return function(_0x4329a0){if(_0x4329a0){return _0x4c22f8[_0xe3e8('0x15')](_0x15c786);}return _0x4c22f8[_0xe3e8('0x16')](_0x15c786)[_0xe3e8('0x17')]();};}function respondWithResult(_0x4c0066,_0x4079a6){_0x4079a6=_0x4079a6||0xc8;return function(_0x8d25e1){if(_0x8d25e1){return _0x4c0066[_0xe3e8('0x16')](_0x4079a6)[_0xe3e8('0x18')](_0x8d25e1);}};}function respondWithFilteredResult(_0x55ae14,_0x4bc245){return function(_0x41d40d){if(_0x41d40d){var _0x145a2a=typeof _0x4bc245[_0xe3e8('0x19')]===_0xe3e8('0x1a')&&typeof _0x4bc245[_0xe3e8('0x1b')]==='undefined';var _0x2d1b3c=_0x41d40d['count'];var _0x2f7aa8=_0x145a2a?0x0:_0x4bc245[_0xe3e8('0x19')];var _0x247ded=_0x145a2a?_0x41d40d[_0xe3e8('0x1c')]:_0x4bc245[_0xe3e8('0x19')]+_0x4bc245[_0xe3e8('0x1b')];var _0x25018;if(_0x247ded>=_0x2d1b3c){_0x247ded=_0x2d1b3c;_0x25018=0xc8;}else{_0x25018=0xce;}_0x55ae14[_0xe3e8('0x16')](_0x25018);return _0x55ae14[_0xe3e8('0x1d')](_0xe3e8('0x1e'),_0x2f7aa8+'-'+_0x247ded+'/'+_0x2d1b3c)['json'](_0x41d40d);}return null;};}function patchUpdates(_0x41f379){return function(_0xf42c0f){try{jsonpatch['apply'](_0xf42c0f,_0x41f379,!![]);}catch(_0x341cc6){return BPromise[_0xe3e8('0x1f')](_0x341cc6);}return _0xf42c0f[_0xe3e8('0x20')]();};}function saveUpdates(_0x31b8ef,_0xc5c447){return function(_0x3a66e3){if(_0x3a66e3){return _0x3a66e3[_0xe3e8('0x21')](_0x31b8ef)['then'](function(_0x2e704b){return _0x2e704b;});}return null;};}function removeEntity(_0x18ebf7,_0x365d93){return function(_0x2155e5){if(_0x2155e5){return _0x2155e5[_0xe3e8('0x22')]()['then'](function(){var _0x5323ce=_0x2155e5['get']({'plain':!![]});var _0x56d606=_0xe3e8('0x23');return db[_0xe3e8('0x24')][_0xe3e8('0x22')]({'where':{'type':_0x56d606,'resourceId':_0x5323ce['id']}})[_0xe3e8('0x25')](function(){return _0x2155e5;});})[_0xe3e8('0x25')](function(){_0x18ebf7['status'](0xcc)[_0xe3e8('0x17')]();});}};}function handleEntityNotFound(_0x539d54,_0x4256ff){return function(_0x45433c){if(!_0x45433c){_0x539d54[_0xe3e8('0x15')](0x194);}return _0x45433c;};}function handleError(_0x1d7120,_0x59cc7f){_0x59cc7f=_0x59cc7f||0x1f4;return function(_0x2983d7){logger[_0xe3e8('0x26')](_0x2983d7[_0xe3e8('0x27')]);if(_0x2983d7['name']){delete _0x2983d7[_0xe3e8('0x28')];}_0x1d7120['status'](_0x59cc7f)[_0xe3e8('0x29')](_0x2983d7);};}exports[_0xe3e8('0x2a')]=function(_0x50105b,_0x47e899){var _0x16c430={},_0x55eb5b={},_0x44558a={'count':0x0,'rows':[]};var _0x1d33a8=_[_0xe3e8('0x2b')](db[_0xe3e8('0x2c')][_0xe3e8('0x2d')],function(_0x171a3e){return{'name':_0x171a3e[_0xe3e8('0x2e')],'type':_0x171a3e[_0xe3e8('0x2f')]['key']};});_0x55eb5b['model']=_[_0xe3e8('0x2b')](_0x1d33a8,_0xe3e8('0x28'));_0x55eb5b[_0xe3e8('0x30')]=_['keys'](_0x50105b[_0xe3e8('0x30')]);_0x55eb5b[_0xe3e8('0x31')]=_[_0xe3e8('0x32')](_0x55eb5b[_0xe3e8('0x33')],_0x55eb5b[_0xe3e8('0x30')]);_0x16c430[_0xe3e8('0x34')]=_[_0xe3e8('0x32')](_0x55eb5b['model'],qs[_0xe3e8('0x35')](_0x50105b[_0xe3e8('0x30')][_0xe3e8('0x35')]));_0x16c430[_0xe3e8('0x34')]=_0x16c430[_0xe3e8('0x34')][_0xe3e8('0x36')]?_0x16c430['attributes']:_0x55eb5b['model'];if(!_0x50105b[_0xe3e8('0x30')][_0xe3e8('0x37')](_0xe3e8('0x38'))){_0x16c430[_0xe3e8('0x1b')]=qs['limit'](_0x50105b[_0xe3e8('0x30')]['limit']);_0x16c430[_0xe3e8('0x19')]=qs[_0xe3e8('0x19')](_0x50105b[_0xe3e8('0x30')][_0xe3e8('0x19')]);}_0x16c430[_0xe3e8('0x39')]=qs[_0xe3e8('0x3a')](_0x50105b[_0xe3e8('0x30')]['sort']);_0x16c430['where']=qs[_0xe3e8('0x31')](_['pick'](_0x50105b[_0xe3e8('0x30')],_0x55eb5b[_0xe3e8('0x31')]),_0x1d33a8);if(_0x50105b['query']['filter']){_0x16c430['where']=_[_0xe3e8('0x3b')](_0x16c430['where'],{'$or':_[_0xe3e8('0x2b')](_0x1d33a8,function(_0x5b59fc){if(_0x5b59fc[_0xe3e8('0x2f')]!=='VIRTUAL'){var _0xfe7ab8={};_0xfe7ab8[_0x5b59fc[_0xe3e8('0x28')]]={'$like':'%'+_0x50105b[_0xe3e8('0x30')][_0xe3e8('0x3c')]+'%'};return _0xfe7ab8;}})});}_0x16c430=_[_0xe3e8('0x3b')]({},_0x16c430,_0x50105b[_0xe3e8('0x3d')]);var _0x5e3889={'where':_0x16c430[_0xe3e8('0x3e')]};return db['SquareOdbc'][_0xe3e8('0x1c')](_0x5e3889)[_0xe3e8('0x25')](function(_0x4e38e1){_0x44558a[_0xe3e8('0x1c')]=_0x4e38e1;if(_0x50105b[_0xe3e8('0x30')]['includeAll']){_0x16c430[_0xe3e8('0x3f')]=[{'all':!![]}];}return db['SquareOdbc'][_0xe3e8('0x40')](_0x16c430);})[_0xe3e8('0x25')](function(_0x22c438){_0x44558a['rows']=_0x22c438;return _0x44558a;})[_0xe3e8('0x25')](respondWithFilteredResult(_0x47e899,_0x16c430))[_0xe3e8('0x41')](handleError(_0x47e899,null));};exports[_0xe3e8('0x42')]=function(_0x21aa51,_0x3dcd2e){var _0x11ca07={'raw':!![],'where':{'id':_0x21aa51[_0xe3e8('0x43')]['id']}},_0x45e9a9={};_0x45e9a9['model']=_['keys'](db[_0xe3e8('0x2c')][_0xe3e8('0x2d')]);_0x45e9a9[_0xe3e8('0x30')]=_[_0xe3e8('0x44')](_0x21aa51[_0xe3e8('0x30')]);_0x45e9a9[_0xe3e8('0x31')]=_['intersection'](_0x45e9a9[_0xe3e8('0x33')],_0x45e9a9[_0xe3e8('0x30')]);_0x11ca07[_0xe3e8('0x34')]=_[_0xe3e8('0x32')](_0x45e9a9['model'],qs[_0xe3e8('0x35')](_0x21aa51[_0xe3e8('0x30')][_0xe3e8('0x35')]));_0x11ca07[_0xe3e8('0x34')]=_0x11ca07[_0xe3e8('0x34')][_0xe3e8('0x36')]?_0x11ca07[_0xe3e8('0x34')]:_0x45e9a9[_0xe3e8('0x33')];if(_0x21aa51['query'][_0xe3e8('0x45')]){_0x11ca07[_0xe3e8('0x3f')]=[{'all':!![]}];}_0x11ca07=_['merge']({},_0x11ca07,_0x21aa51[_0xe3e8('0x3d')]);return db[_0xe3e8('0x2c')][_0xe3e8('0x46')](_0x11ca07)[_0xe3e8('0x25')](handleEntityNotFound(_0x3dcd2e,null))[_0xe3e8('0x25')](respondWithResult(_0x3dcd2e,null))[_0xe3e8('0x41')](handleError(_0x3dcd2e,null));};exports[_0xe3e8('0x47')]=function(_0x217f6c,_0xebb58b){return db[_0xe3e8('0x2c')][_0xe3e8('0x47')](_0x217f6c[_0xe3e8('0x48')],{})[_0xe3e8('0x25')](function(_0x57e799){var _0x51779f=_0x217f6c[_0xe3e8('0x49')][_0xe3e8('0x4a')]({'plain':!![]});if(!_0x51779f)throw new Error(_0xe3e8('0x4b'));if(_0x51779f['role']===_0xe3e8('0x49')){var _0xb4cd75=_0x57e799[_0xe3e8('0x4a')]({'plain':!![]});var _0x55df72=_0xe3e8('0x23');return db['UserProfileSection']['find']({'where':{'name':_0x55df72,'userProfileId':_0x51779f['userProfileId']},'raw':!![]})[_0xe3e8('0x25')](function(_0x203f64){if(_0x203f64&&_0x203f64['autoAssociation']===0x0){return db[_0xe3e8('0x24')]['create']({'name':_0xb4cd75[_0xe3e8('0x28')],'resourceId':_0xb4cd75['id'],'type':_0x203f64[_0xe3e8('0x28')],'sectionId':_0x203f64['id']},{})[_0xe3e8('0x25')](function(){return _0x57e799;});}else{return _0x57e799;}})[_0xe3e8('0x41')](function(_0x597d3c){logger[_0xe3e8('0x26')](_0xe3e8('0x4c'),_0x597d3c);throw _0x597d3c;});}return _0x57e799;})['then'](respondWithResult(_0xebb58b,0xc9))[_0xe3e8('0x41')](handleError(_0xebb58b,null));};exports[_0xe3e8('0x21')]=function(_0x267208,_0x3ecd8f){if(_0x267208['body']['id']){delete _0x267208[_0xe3e8('0x48')]['id'];}return db[_0xe3e8('0x2c')][_0xe3e8('0x46')]({'where':{'id':_0x267208['params']['id']}})['then'](handleEntityNotFound(_0x3ecd8f,null))['then'](saveUpdates(_0x267208[_0xe3e8('0x48')],null))[_0xe3e8('0x25')](respondWithResult(_0x3ecd8f,null))[_0xe3e8('0x41')](handleError(_0x3ecd8f,null));};exports['destroy']=function(_0xa0bd6e,_0x244053){return db[_0xe3e8('0x2c')][_0xe3e8('0x46')]({'where':{'id':_0xa0bd6e[_0xe3e8('0x43')]['id']}})[_0xe3e8('0x25')](handleEntityNotFound(_0x244053,null))[_0xe3e8('0x25')](removeEntity(_0x244053,null))[_0xe3e8('0x41')](handleError(_0x244053,null));};exports[_0xe3e8('0x4d')]=function(_0x29dd19,_0x2ee77a,_0x3ab42a){var _0x2e45cd;return db[_0xe3e8('0x2c')][_0xe3e8('0x46')]({'where':{'id':_0x29dd19['params']['id']},'attributes':['id','dsn']})[_0xe3e8('0x25')](handleEntityNotFound(_0x2ee77a,null))['then'](function(_0x58f511){if(_0x58f511){var _0x2251af=require(_0xe3e8('0x4e'))();_0x2251af['openSync'](_0x58f511['dsn']);_0x2251af[_0xe3e8('0x4f')]();return _0x58f511;}})['then'](respondWithResult(_0x2ee77a,null))[_0xe3e8('0x41')](handleError(_0x2ee77a,null));}; \ No newline at end of file +var _0x4c32=['model','query','keys','attributes','fields','length','hasOwnProperty','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','intersection','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','test','dsn','odbc','openSync','closeSync','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','offset','undefined','limit','count','Content-Range','json','apply','reject','update','destroy','get','ODBC','then','error','stack','name','send','index','map','SquareOdbc','fieldName','type'];(function(_0x2bcd1f,_0x4f1972){var _0x2381ca=function(_0x51f935){while(--_0x51f935){_0x2bcd1f['push'](_0x2bcd1f['shift']());}};_0x2381ca(++_0x4f1972);}(_0x4c32,0x11d));var _0x24c3=function(_0x17928f,_0x4ad33f){_0x17928f=_0x17928f-0x0;var _0x500b63=_0x4c32[_0x17928f];return _0x500b63;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x24c3('0x0'));var zipdir=require(_0x24c3('0x1'));var jsonpatch=require(_0x24c3('0x2'));var rp=require(_0x24c3('0x3'));var moment=require('moment');var BPromise=require(_0x24c3('0x4'));var Mustache=require('mustache');var util=require(_0x24c3('0x5'));var path=require(_0x24c3('0x6'));var sox=require(_0x24c3('0x7'));var csv=require(_0x24c3('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x24c3('0x9'));var _=require(_0x24c3('0xa'));var squel=require(_0x24c3('0xb'));var crypto=require(_0x24c3('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x24c3('0x8'));var querystring=require(_0x24c3('0xd'));var Papa=require(_0x24c3('0xe'));var Redis=require(_0x24c3('0xf'));var authService=require(_0x24c3('0x10'));var qs=require(_0x24c3('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x24c3('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x24c3('0x13'));var config=require(_0x24c3('0x14'));var licenseUtil=require(_0x24c3('0x15'));var db=require(_0x24c3('0x16'))['db'];function respondWithStatusCode(_0x5b965c,_0x5362d3){_0x5362d3=_0x5362d3||0xcc;return function(_0x16ce73){if(_0x16ce73){return _0x5b965c[_0x24c3('0x17')](_0x5362d3);}return _0x5b965c['status'](_0x5362d3)[_0x24c3('0x18')]();};}function respondWithResult(_0x23fa17,_0x5d6a1a){_0x5d6a1a=_0x5d6a1a||0xc8;return function(_0x520518){if(_0x520518){return _0x23fa17['status'](_0x5d6a1a)['json'](_0x520518);}};}function respondWithFilteredResult(_0x42c243,_0x3cad06){return function(_0x5915b9){if(_0x5915b9){var _0x1c2523=typeof _0x3cad06[_0x24c3('0x19')]===_0x24c3('0x1a')&&typeof _0x3cad06[_0x24c3('0x1b')]===_0x24c3('0x1a');var _0x309a0b=_0x5915b9[_0x24c3('0x1c')];var _0xb935e3=_0x1c2523?0x0:_0x3cad06[_0x24c3('0x19')];var _0x3e3e76=_0x1c2523?_0x5915b9[_0x24c3('0x1c')]:_0x3cad06[_0x24c3('0x19')]+_0x3cad06[_0x24c3('0x1b')];var _0x3acdac;if(_0x3e3e76>=_0x309a0b){_0x3e3e76=_0x309a0b;_0x3acdac=0xc8;}else{_0x3acdac=0xce;}_0x42c243['status'](_0x3acdac);return _0x42c243['set'](_0x24c3('0x1d'),_0xb935e3+'-'+_0x3e3e76+'/'+_0x309a0b)[_0x24c3('0x1e')](_0x5915b9);}return null;};}function patchUpdates(_0x45f2e6){return function(_0x8bc162){try{jsonpatch[_0x24c3('0x1f')](_0x8bc162,_0x45f2e6,!![]);}catch(_0x56341d){return BPromise[_0x24c3('0x20')](_0x56341d);}return _0x8bc162['save']();};}function saveUpdates(_0x4e21ca,_0x3a9df3){return function(_0xa34f94){if(_0xa34f94){return _0xa34f94[_0x24c3('0x21')](_0x4e21ca)['then'](function(_0x554561){return _0x554561;});}return null;};}function removeEntity(_0x1c58a3,_0x42dd4b){return function(_0x176531){if(_0x176531){return _0x176531[_0x24c3('0x22')]()['then'](function(){var _0x4415a3=_0x176531[_0x24c3('0x23')]({'plain':!![]});var _0x2257e7=_0x24c3('0x24');return db['UserProfileResource'][_0x24c3('0x22')]({'where':{'type':_0x2257e7,'resourceId':_0x4415a3['id']}})[_0x24c3('0x25')](function(){return _0x176531;});})[_0x24c3('0x25')](function(){_0x1c58a3['status'](0xcc)[_0x24c3('0x18')]();});}};}function handleEntityNotFound(_0x4611c8,_0x5dd03e){return function(_0x1427bc){if(!_0x1427bc){_0x4611c8[_0x24c3('0x17')](0x194);}return _0x1427bc;};}function handleError(_0x33c5a6,_0x571141){_0x571141=_0x571141||0x1f4;return function(_0x528368){logger[_0x24c3('0x26')](_0x528368[_0x24c3('0x27')]);if(_0x528368[_0x24c3('0x28')]){delete _0x528368[_0x24c3('0x28')];}_0x33c5a6['status'](_0x571141)[_0x24c3('0x29')](_0x528368);};}exports[_0x24c3('0x2a')]=function(_0x2d71d2,_0x434fa6){var _0x53d990={},_0xd61ae7={},_0xa09096={'count':0x0,'rows':[]};var _0x1910ab=_[_0x24c3('0x2b')](db[_0x24c3('0x2c')]['rawAttributes'],function(_0xbfc10){return{'name':_0xbfc10[_0x24c3('0x2d')],'type':_0xbfc10[_0x24c3('0x2e')]['key']};});_0xd61ae7[_0x24c3('0x2f')]=_[_0x24c3('0x2b')](_0x1910ab,'name');_0xd61ae7[_0x24c3('0x30')]=_[_0x24c3('0x31')](_0x2d71d2[_0x24c3('0x30')]);_0xd61ae7['filters']=_['intersection'](_0xd61ae7[_0x24c3('0x2f')],_0xd61ae7[_0x24c3('0x30')]);_0x53d990[_0x24c3('0x32')]=_['intersection'](_0xd61ae7[_0x24c3('0x2f')],qs[_0x24c3('0x33')](_0x2d71d2[_0x24c3('0x30')]['fields']));_0x53d990[_0x24c3('0x32')]=_0x53d990[_0x24c3('0x32')][_0x24c3('0x34')]?_0x53d990[_0x24c3('0x32')]:_0xd61ae7[_0x24c3('0x2f')];if(!_0x2d71d2[_0x24c3('0x30')][_0x24c3('0x35')]('nolimit')){_0x53d990[_0x24c3('0x1b')]=qs['limit'](_0x2d71d2[_0x24c3('0x30')][_0x24c3('0x1b')]);_0x53d990[_0x24c3('0x19')]=qs[_0x24c3('0x19')](_0x2d71d2[_0x24c3('0x30')]['offset']);}_0x53d990[_0x24c3('0x36')]=qs[_0x24c3('0x37')](_0x2d71d2[_0x24c3('0x30')]['sort']);_0x53d990[_0x24c3('0x38')]=qs[_0x24c3('0x39')](_['pick'](_0x2d71d2['query'],_0xd61ae7[_0x24c3('0x39')]),_0x1910ab);if(_0x2d71d2[_0x24c3('0x30')][_0x24c3('0x3a')]){_0x53d990[_0x24c3('0x38')]=_[_0x24c3('0x3b')](_0x53d990[_0x24c3('0x38')],{'$or':_[_0x24c3('0x2b')](_0x1910ab,function(_0x4500f4){if(_0x4500f4[_0x24c3('0x2e')]!==_0x24c3('0x3c')){var _0x2ae82c={};_0x2ae82c[_0x4500f4['name']]={'$like':'%'+_0x2d71d2[_0x24c3('0x30')][_0x24c3('0x3a')]+'%'};return _0x2ae82c;}})});}_0x53d990=_[_0x24c3('0x3b')]({},_0x53d990,_0x2d71d2[_0x24c3('0x3d')]);var _0x4922c5={'where':_0x53d990['where']};return db[_0x24c3('0x2c')]['count'](_0x4922c5)['then'](function(_0x5d5c04){_0xa09096[_0x24c3('0x1c')]=_0x5d5c04;if(_0x2d71d2[_0x24c3('0x30')][_0x24c3('0x3e')]){_0x53d990[_0x24c3('0x3f')]=[{'all':!![]}];}return db[_0x24c3('0x2c')][_0x24c3('0x40')](_0x53d990);})[_0x24c3('0x25')](function(_0x11d676){_0xa09096[_0x24c3('0x41')]=_0x11d676;return _0xa09096;})[_0x24c3('0x25')](respondWithFilteredResult(_0x434fa6,_0x53d990))[_0x24c3('0x42')](handleError(_0x434fa6,null));};exports['show']=function(_0x47f268,_0x27b958){var _0x3d3726={'raw':!![],'where':{'id':_0x47f268[_0x24c3('0x43')]['id']}},_0x1e2563={};_0x1e2563[_0x24c3('0x2f')]=_[_0x24c3('0x31')](db[_0x24c3('0x2c')]['rawAttributes']);_0x1e2563[_0x24c3('0x30')]=_['keys'](_0x47f268[_0x24c3('0x30')]);_0x1e2563[_0x24c3('0x39')]=_[_0x24c3('0x44')](_0x1e2563['model'],_0x1e2563[_0x24c3('0x30')]);_0x3d3726[_0x24c3('0x32')]=_[_0x24c3('0x44')](_0x1e2563['model'],qs[_0x24c3('0x33')](_0x47f268['query'][_0x24c3('0x33')]));_0x3d3726[_0x24c3('0x32')]=_0x3d3726[_0x24c3('0x32')][_0x24c3('0x34')]?_0x3d3726[_0x24c3('0x32')]:_0x1e2563['model'];if(_0x47f268[_0x24c3('0x30')][_0x24c3('0x3e')]){_0x3d3726[_0x24c3('0x3f')]=[{'all':!![]}];}_0x3d3726=_['merge']({},_0x3d3726,_0x47f268[_0x24c3('0x3d')]);return db[_0x24c3('0x2c')]['find'](_0x3d3726)[_0x24c3('0x25')](handleEntityNotFound(_0x27b958,null))[_0x24c3('0x25')](respondWithResult(_0x27b958,null))[_0x24c3('0x42')](handleError(_0x27b958,null));};exports['create']=function(_0x5e0b2d,_0xb35ede){return db[_0x24c3('0x2c')][_0x24c3('0x45')](_0x5e0b2d[_0x24c3('0x46')],{})['then'](function(_0x2c1f20){var _0x1df3bc=_0x5e0b2d[_0x24c3('0x47')][_0x24c3('0x23')]({'plain':!![]});if(!_0x1df3bc)throw new Error(_0x24c3('0x48'));if(_0x1df3bc['role']===_0x24c3('0x47')){var _0x1bcaba=_0x2c1f20[_0x24c3('0x23')]({'plain':!![]});var _0x32605c='ODBC';return db[_0x24c3('0x49')][_0x24c3('0x4a')]({'where':{'name':_0x32605c,'userProfileId':_0x1df3bc[_0x24c3('0x4b')]},'raw':!![]})[_0x24c3('0x25')](function(_0x10dbfd){if(_0x10dbfd&&_0x10dbfd[_0x24c3('0x4c')]===0x0){return db['UserProfileResource'][_0x24c3('0x45')]({'name':_0x1bcaba[_0x24c3('0x28')],'resourceId':_0x1bcaba['id'],'type':_0x10dbfd['name'],'sectionId':_0x10dbfd['id']},{})[_0x24c3('0x25')](function(){return _0x2c1f20;});}else{return _0x2c1f20;}})[_0x24c3('0x42')](function(_0x5e9758){logger[_0x24c3('0x26')](_0x24c3('0x4d'),_0x5e9758);throw _0x5e9758;});}return _0x2c1f20;})[_0x24c3('0x25')](respondWithResult(_0xb35ede,0xc9))[_0x24c3('0x42')](handleError(_0xb35ede,null));};exports[_0x24c3('0x21')]=function(_0x55fba4,_0x1f05fa){if(_0x55fba4['body']['id']){delete _0x55fba4[_0x24c3('0x46')]['id'];}return db[_0x24c3('0x2c')][_0x24c3('0x4a')]({'where':{'id':_0x55fba4[_0x24c3('0x43')]['id']}})['then'](handleEntityNotFound(_0x1f05fa,null))[_0x24c3('0x25')](saveUpdates(_0x55fba4[_0x24c3('0x46')],null))[_0x24c3('0x25')](respondWithResult(_0x1f05fa,null))['catch'](handleError(_0x1f05fa,null));};exports[_0x24c3('0x22')]=function(_0x3a48cc,_0xc5b2d7){return db[_0x24c3('0x2c')][_0x24c3('0x4a')]({'where':{'id':_0x3a48cc[_0x24c3('0x43')]['id']}})[_0x24c3('0x25')](handleEntityNotFound(_0xc5b2d7,null))['then'](removeEntity(_0xc5b2d7,null))[_0x24c3('0x42')](handleError(_0xc5b2d7,null));};exports[_0x24c3('0x4e')]=function(_0x5c08af,_0x3b3c14,_0x3b7ce6){var _0x40cdb3;return db[_0x24c3('0x2c')][_0x24c3('0x4a')]({'where':{'id':_0x5c08af[_0x24c3('0x43')]['id']},'attributes':['id',_0x24c3('0x4f')]})[_0x24c3('0x25')](handleEntityNotFound(_0x3b3c14,null))[_0x24c3('0x25')](function(_0x301c22){if(_0x301c22){var _0x5bf811=require(_0x24c3('0x50'))();_0x5bf811[_0x24c3('0x51')](_0x301c22['dsn']);_0x5bf811[_0x24c3('0x52')]();return _0x301c22;}})[_0x24c3('0x25')](respondWithResult(_0x3b3c14,null))[_0x24c3('0x42')](handleError(_0x3b3c14,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 2005f97..adee988 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 _0x2ee6=['exports','SquareOdbc','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./squareOdbc.attributes'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x2ee6,0x115));var _0x62ee=function(_0x1db7f8,_0x3dac93){_0x1db7f8=_0x1db7f8-0x0;var _0x19a36d=_0x2ee6[_0x1db7f8];return _0x19a36d;};'use strict';var _=require(_0x62ee('0x0'));var util=require(_0x62ee('0x1'));var logger=require(_0x62ee('0x2'))(_0x62ee('0x3'));var moment=require(_0x62ee('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x62ee('0x5'));var rimraf=require(_0x62ee('0x6'));var config=require(_0x62ee('0x7'));var attributes=require(_0x62ee('0x8'));module[_0x62ee('0x9')]=function(_0x58212f,_0x17dc8d){return _0x58212f['define'](_0x62ee('0xa'),attributes,{'tableName':'square_odbc','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9a3d=['bluebird','request-promise','rimraf','../../config/environment','./squareOdbc.attributes','exports','define','SquareOdbc','square_odbc','util','../../config/logger','api','moment'];(function(_0x117eae,_0x40f89f){var _0x5cd499=function(_0x34e7a0){while(--_0x34e7a0){_0x117eae['push'](_0x117eae['shift']());}};_0x5cd499(++_0x40f89f);}(_0x9a3d,0x14e));var _0xd9a3=function(_0x7bb70d,_0x4e79dc){_0x7bb70d=_0x7bb70d-0x0;var _0x5c7a09=_0x9a3d[_0x7bb70d];return _0x5c7a09;};'use strict';var _=require('lodash');var util=require(_0xd9a3('0x0'));var logger=require(_0xd9a3('0x1'))(_0xd9a3('0x2'));var moment=require(_0xd9a3('0x3'));var BPromise=require(_0xd9a3('0x4'));var rp=require(_0xd9a3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd9a3('0x6'));var config=require(_0xd9a3('0x7'));var attributes=require(_0xd9a3('0x8'));module[_0xd9a3('0x9')]=function(_0x5355b8,_0x1ff64f){return _0x5355b8[_0xd9a3('0xa')](_0xd9a3('0xb'),attributes,{'tableName':_0xd9a3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.rpc.js b/server/api/squareOdbc/squareOdbc.rpc.js index 7996681..ddc16b1 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 _0xa5d1=['http','request','then','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','code','SquareOdbc,\x20%s,\x20%s','error','message','info','result','ShowSquareOdbc','SquareOdbc','options','attributes','include','map','model','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise'];(function(_0x177d06,_0x16308d){var _0x4f7e1d=function(_0xa8419c){while(--_0xa8419c){_0x177d06['push'](_0x177d06['shift']());}};_0x4f7e1d(++_0x16308d);}(_0xa5d1,0x105));var _0x1a5d=function(_0x4c94eb,_0x679a1e){_0x4c94eb=_0x4c94eb-0x0;var _0x59e3f3=_0xa5d1[_0x4c94eb];return _0x59e3f3;};'use strict';var _=require(_0x1a5d('0x0'));var util=require(_0x1a5d('0x1'));var moment=require(_0x1a5d('0x2'));var BPromise=require(_0x1a5d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1a5d('0x4'));var db=require(_0x1a5d('0x5'))['db'];var utils=require(_0x1a5d('0x6'));var logger=require(_0x1a5d('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x1a5d('0x8'));var client=jayson['client'][_0x1a5d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2a0a44,_0xc0e1e0,_0x3fd1f8){return new BPromise(function(_0x5de8ad,_0x6b3a5d){return client[_0x1a5d('0xa')](_0x2a0a44,_0x3fd1f8)[_0x1a5d('0xb')](function(_0x1d8acb){logger['info']('SquareOdbc,\x20%s,\x20%s',_0xc0e1e0,_0x1a5d('0xc'));logger[_0x1a5d('0xd')](_0x1a5d('0xe'),_0xc0e1e0,_0x1a5d('0xc'),JSON[_0x1a5d('0xf')](_0x1d8acb));if(_0x1d8acb['error']){if(_0x1d8acb['error'][_0x1a5d('0x10')]===0x1f4){logger['error'](_0x1a5d('0x11'),_0xc0e1e0,_0x1d8acb[_0x1a5d('0x12')][_0x1a5d('0x13')]);return _0x6b3a5d(_0x1d8acb[_0x1a5d('0x12')][_0x1a5d('0x13')]);}logger['error']('SquareOdbc,\x20%s,\x20%s',_0xc0e1e0,_0x1d8acb[_0x1a5d('0x12')][_0x1a5d('0x13')]);return _0x5de8ad(_0x1d8acb[_0x1a5d('0x12')][_0x1a5d('0x13')]);}else{logger[_0x1a5d('0x14')](_0x1a5d('0x11'),_0xc0e1e0,_0x1a5d('0xc'));_0x5de8ad(_0x1d8acb[_0x1a5d('0x15')][_0x1a5d('0x13')]);}})['catch'](function(_0x1ca67b){logger[_0x1a5d('0x12')](_0x1a5d('0x11'),_0xc0e1e0,_0x1ca67b);_0x6b3a5d(_0x1ca67b);});});}exports[_0x1a5d('0x16')]=function(_0x37584a){var _0xd831d0=this;return new Promise(function(_0x40c0c7,_0x1f19c8){return db[_0x1a5d('0x17')]['find']({'raw':_0x37584a[_0x1a5d('0x18')]?_0x37584a[_0x1a5d('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x37584a[_0x1a5d('0x18')]?_0x37584a[_0x1a5d('0x18')]['where']||null:null,'attributes':_0x37584a[_0x1a5d('0x18')]?_0x37584a[_0x1a5d('0x18')][_0x1a5d('0x19')]||null:null,'include':_0x37584a['options']?_0x37584a[_0x1a5d('0x18')][_0x1a5d('0x1a')]?_[_0x1a5d('0x1b')](_0x37584a['options'][_0x1a5d('0x1a')],function(_0x5ad0e9){return{'model':db[_0x5ad0e9[_0x1a5d('0x1c')]],'as':_0x5ad0e9['as'],'attributes':_0x5ad0e9[_0x1a5d('0x19')],'include':_0x5ad0e9['include']?_[_0x1a5d('0x1b')](_0x5ad0e9['include'],function(_0xc109d9){return{'model':db[_0xc109d9['model']],'as':_0xc109d9['as'],'attributes':_0xc109d9['attributes'],'include':_0xc109d9[_0x1a5d('0x1a')]?_[_0x1a5d('0x1b')](_0xc109d9[_0x1a5d('0x1a')],function(_0x2ada19){return{'model':db[_0x2ada19[_0x1a5d('0x1c')]],'as':_0x2ada19['as'],'attributes':_0x2ada19[_0x1a5d('0x19')]};}):[]};}):[]};}):[]:[]})[_0x1a5d('0xb')](function(_0x4d96c4){logger[_0x1a5d('0x14')](_0x1a5d('0x16'),_0x37584a);logger[_0x1a5d('0xd')](_0x1a5d('0x16'),_0x37584a,JSON['stringify'](_0x4d96c4));_0x40c0c7(_0x4d96c4);})[_0x1a5d('0x1d')](function(_0x221219){logger['error'](_0x1a5d('0x16'),_0x221219[_0x1a5d('0x13')],_0x37584a);_0x1f19c8(_0xd831d0[_0x1a5d('0x12')](0x1f4,_0x221219['message']));});});}; \ No newline at end of file +var _0x1665=['where','attributes','include','map','model','stringify','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','error','message','result','ShowSquareOdbc','SquareOdbc','options','raw'];(function(_0x52b24f,_0xca062d){var _0x46ea6b=function(_0x29f821){while(--_0x29f821){_0x52b24f['push'](_0x52b24f['shift']());}};_0x46ea6b(++_0xca062d);}(_0x1665,0x114));var _0x5166=function(_0x593f13,_0x4301b0){_0x593f13=_0x593f13-0x0;var _0x5e702c=_0x1665[_0x593f13];return _0x5e702c;};'use strict';var _=require(_0x5166('0x0'));var util=require(_0x5166('0x1'));var moment=require('moment');var BPromise=require(_0x5166('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5166('0x3'));var db=require(_0x5166('0x4'))['db'];var utils=require(_0x5166('0x5'));var logger=require('../../config/logger')(_0x5166('0x6'));var config=require('../../config/environment');var jayson=require(_0x5166('0x7'));var client=jayson[_0x5166('0x8')][_0x5166('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5d9aa3,_0x3047b8,_0x122167){return new BPromise(function(_0xd6ba06,_0x1a0d25){return client[_0x5166('0xa')](_0x5d9aa3,_0x122167)[_0x5166('0xb')](function(_0x4f25b1){logger[_0x5166('0xc')](_0x5166('0xd'),_0x3047b8,_0x5166('0xe'));logger[_0x5166('0xf')](_0x5166('0x10'),_0x3047b8,_0x5166('0xe'),JSON['stringify'](_0x4f25b1));if(_0x4f25b1['error']){if(_0x4f25b1[_0x5166('0x11')]['code']===0x1f4){logger[_0x5166('0x11')](_0x5166('0xd'),_0x3047b8,_0x4f25b1[_0x5166('0x11')][_0x5166('0x12')]);return _0x1a0d25(_0x4f25b1['error'][_0x5166('0x12')]);}logger['error'](_0x5166('0xd'),_0x3047b8,_0x4f25b1[_0x5166('0x11')][_0x5166('0x12')]);return _0xd6ba06(_0x4f25b1[_0x5166('0x11')][_0x5166('0x12')]);}else{logger[_0x5166('0xc')]('SquareOdbc,\x20%s,\x20%s',_0x3047b8,'request\x20sent');_0xd6ba06(_0x4f25b1[_0x5166('0x13')][_0x5166('0x12')]);}})['catch'](function(_0xfb5c69){logger[_0x5166('0x11')](_0x5166('0xd'),_0x3047b8,_0xfb5c69);_0x1a0d25(_0xfb5c69);});});}exports[_0x5166('0x14')]=function(_0x32457c){var _0x28a62b=this;return new Promise(function(_0x37b945,_0x326f16){return db[_0x5166('0x15')]['find']({'raw':_0x32457c[_0x5166('0x16')]?_0x32457c[_0x5166('0x16')][_0x5166('0x17')]===undefined?!![]:![]:!![],'where':_0x32457c[_0x5166('0x16')]?_0x32457c['options'][_0x5166('0x18')]||null:null,'attributes':_0x32457c[_0x5166('0x16')]?_0x32457c[_0x5166('0x16')][_0x5166('0x19')]||null:null,'include':_0x32457c[_0x5166('0x16')]?_0x32457c['options'][_0x5166('0x1a')]?_[_0x5166('0x1b')](_0x32457c['options']['include'],function(_0x5a17a2){return{'model':db[_0x5a17a2['model']],'as':_0x5a17a2['as'],'attributes':_0x5a17a2[_0x5166('0x19')],'include':_0x5a17a2[_0x5166('0x1a')]?_[_0x5166('0x1b')](_0x5a17a2[_0x5166('0x1a')],function(_0x905bc5){return{'model':db[_0x905bc5['model']],'as':_0x905bc5['as'],'attributes':_0x905bc5[_0x5166('0x19')],'include':_0x905bc5[_0x5166('0x1a')]?_[_0x5166('0x1b')](_0x905bc5['include'],function(_0x439165){return{'model':db[_0x439165[_0x5166('0x1c')]],'as':_0x439165['as'],'attributes':_0x439165[_0x5166('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2d2c0b){logger[_0x5166('0xc')](_0x5166('0x14'),_0x32457c);logger[_0x5166('0xf')](_0x5166('0x14'),_0x32457c,JSON[_0x5166('0x1d')](_0x2d2c0b));_0x37b945(_0x2d2c0b);})['catch'](function(_0x16e92e){logger[_0x5166('0x11')](_0x5166('0x14'),_0x16e92e['message'],_0x32457c);_0x326f16(_0x28a62b['error'](0x1f4,_0x16e92e['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 1f680fc..1a49e36 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 _0xc34c=['delete','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','get','isAuthenticated','post','create','put','/:id','update'];(function(_0x27573d,_0x14739e){var _0x2ed6ff=function(_0x221a81){while(--_0x221a81){_0x27573d['push'](_0x27573d['shift']());}};_0x2ed6ff(++_0x14739e);}(_0xc34c,0xbd));var _0xcc34=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xc34c[_0x5d6456];return _0x4d66c1;};'use strict';var multer=require(_0xcc34('0x0'));var util=require(_0xcc34('0x1'));var path=require(_0xcc34('0x2'));var timeout=require(_0xcc34('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xcc34('0x4'));var interaction=require(_0xcc34('0x5'));var config=require(_0xcc34('0x6'));var controller=require(_0xcc34('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xcc34('0x8')]('/:id',auth[_0xcc34('0x9')](),controller['show']);router[_0xcc34('0xa')]('/',auth[_0xcc34('0x9')](),controller[_0xcc34('0xb')]);router[_0xcc34('0xc')](_0xcc34('0xd'),auth[_0xcc34('0x9')](),controller[_0xcc34('0xe')]);router[_0xcc34('0xf')]('/:id',auth[_0xcc34('0x9')](),controller['destroy']);module[_0xcc34('0x10')]=router; \ No newline at end of file +var _0xa4fb=['../../components/interaction/service','../../config/environment','./squareProject.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy','multer','util','path','express','fs-extra','../../components/auth/service'];(function(_0x2e3fe3,_0xec368e){var _0x590ae1=function(_0x1a72a2){while(--_0x1a72a2){_0x2e3fe3['push'](_0x2e3fe3['shift']());}};_0x590ae1(++_0xec368e);}(_0xa4fb,0xea));var _0xba4f=function(_0x4715d2,_0x3371b2){_0x4715d2=_0x4715d2-0x0;var _0x141811=_0xa4fb[_0x4715d2];return _0x141811;};'use strict';var multer=require(_0xba4f('0x0'));var util=require(_0xba4f('0x1'));var path=require(_0xba4f('0x2'));var timeout=require('connect-timeout');var express=require(_0xba4f('0x3'));var router=express['Router']();var fs_extra=require(_0xba4f('0x4'));var auth=require(_0xba4f('0x5'));var interaction=require(_0xba4f('0x6'));var config=require(_0xba4f('0x7'));var controller=require(_0xba4f('0x8'));router[_0xba4f('0x9')]('/',auth[_0xba4f('0xa')](),controller[_0xba4f('0xb')]);router[_0xba4f('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xba4f('0xc')]);router[_0xba4f('0xd')]('/',auth[_0xba4f('0xa')](),controller[_0xba4f('0xe')]);router[_0xba4f('0xf')](_0xba4f('0x10'),auth[_0xba4f('0xa')](),controller[_0xba4f('0x11')]);router[_0xba4f('0x12')](_0xba4f('0x10'),auth[_0xba4f('0xa')](),controller[_0xba4f('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 2fcffb9..73ac471 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 _0xdaed=['preproduction','utf8','production','toString','DATE','exports','name','TEXT','BLOB','long','getDataValue'];(function(_0xbc4659,_0x578fba){var _0x5831f9=function(_0x5eb0eb){while(--_0x5eb0eb){_0xbc4659['push'](_0xbc4659['shift']());}};_0x5831f9(++_0x578fba);}(_0xdaed,0xcb));var _0xddae=function(_0x4a1122,_0x1144c8){_0x4a1122=_0x4a1122-0x0;var _0x7cfb19=_0xdaed[_0x4a1122];return _0x7cfb19;};'use strict';var Sequelize=require('sequelize');module[_0xddae('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xddae('0x1'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize[_0xddae('0x2')]},'preproduction':{'type':Sequelize[_0xddae('0x3')](_0xddae('0x4')),'get':function(){if(this[_0xddae('0x5')](_0xddae('0x6'))){return this[_0xddae('0x5')](_0xddae('0x6'))['toString'](_0xddae('0x7'));}}},'production':{'type':Sequelize[_0xddae('0x3')](_0xddae('0x4')),'get':function(){if(this[_0xddae('0x5')](_0xddae('0x8'))){return this[_0xddae('0x5')]('production')[_0xddae('0x9')](_0xddae('0x7'));}}},'savedAt':{'type':Sequelize[_0xddae('0xa')]},'publishedAt':{'type':Sequelize[_0xddae('0xa')]}}; \ No newline at end of file +var _0xa145=['long','production','toString','sequelize','exports','STRING','name','TEXT','BLOB','getDataValue','preproduction'];(function(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0xa145,0x1a5));var _0x5a14=function(_0x176329,_0x568c84){_0x176329=_0x176329-0x0;var _0x31997c=_0xa145[_0x176329];return _0x31997c;};'use strict';var Sequelize=require(_0x5a14('0x0'));module[_0x5a14('0x1')]={'name':{'type':Sequelize[_0x5a14('0x2')],'unique':_0x5a14('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x5a14('0x2')]},'notes':{'type':Sequelize[_0x5a14('0x4')]},'preproduction':{'type':Sequelize[_0x5a14('0x5')]('long'),'get':function(){if(this[_0x5a14('0x6')](_0x5a14('0x7'))){return this[_0x5a14('0x6')](_0x5a14('0x7'))['toString']('utf8');}}},'production':{'type':Sequelize['BLOB'](_0x5a14('0x8')),'get':function(){if(this[_0x5a14('0x6')](_0x5a14('0x9'))){return this[_0x5a14('0x6')]('production')[_0x5a14('0xa')]('utf8');}}},'savedAt':{'type':Sequelize['DATE']},'publishedAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 1c1aaee..4d291a5 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 _0x5261=['body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','agi','production','params','lodash','ioredis','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','status','json','undefined','count','offset','limit','set','Content-Range','update','destroy','then','get','SquareProjects','UserProfileResource','publish','stringify','error','name','send','index','SquareProject','rawAttributes','fieldName','key','model','keys','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','type','VIRTUAL','options','includeAll','include','show','intersection','find','catch'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x5261,0x11b));var _0x1526=function(_0x33c6fb,_0x410d2e){_0x33c6fb=_0x33c6fb-0x0;var _0x5020c3=_0x5261[_0x33c6fb];return _0x5020c3;};'use strict';var _=require(_0x1526('0x0'));var Redis=require(_0x1526('0x1'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')('api');var config=require('../../config/environment');var db=require(_0x1526('0x2'))['db'];config[_0x1526('0x3')]=_[_0x1526('0x4')](config[_0x1526('0x3')],{'host':_0x1526('0x5'),'port':0x18eb});var socket=require(_0x1526('0x6'))(new Redis(config['redis']));require(_0x1526('0x7'))['register'](socket);function respondWithResult(_0x22474a,_0xd6eaa3){_0xd6eaa3=_0xd6eaa3||0xc8;return function(_0x1c3389){if(_0x1c3389){return _0x22474a[_0x1526('0x8')](_0xd6eaa3)[_0x1526('0x9')](_0x1c3389);}};}function respondWithFilteredResult(_0xfad402,_0x19c8bf){return function(_0x2ac4b0){if(_0x2ac4b0){var _0x346ddf=typeof _0x19c8bf['offset']===_0x1526('0xa')&&typeof _0x19c8bf['limit']===_0x1526('0xa');var _0x5d316c=_0x2ac4b0[_0x1526('0xb')];var _0x55526a=_0x346ddf?0x0:_0x19c8bf[_0x1526('0xc')];var _0x2c1ae5=_0x346ddf?_0x2ac4b0[_0x1526('0xb')]:_0x19c8bf['offset']+_0x19c8bf[_0x1526('0xd')];var _0x1ffea3;if(_0x2c1ae5>=_0x5d316c){_0x2c1ae5=_0x5d316c;_0x1ffea3=0xc8;}else{_0x1ffea3=0xce;}_0xfad402[_0x1526('0x8')](_0x1ffea3);return _0xfad402[_0x1526('0xe')](_0x1526('0xf'),_0x55526a+'-'+_0x2c1ae5+'/'+_0x5d316c)[_0x1526('0x9')](_0x2ac4b0);}return null;};}function saveUpdates(_0x29e447){return function(_0x5b1673){if(_0x5b1673){return _0x5b1673[_0x1526('0x10')](_0x29e447)['then'](function(_0x4c6408){return _0x4c6408;});}return null;};}function removeEntity(_0x591202){return function(_0x163806){if(_0x163806){return _0x163806[_0x1526('0x11')]()[_0x1526('0x12')](function(){var _0x5006fd=_0x163806[_0x1526('0x13')]({'plain':!![]});var _0x2d8c3b=_0x1526('0x14');return db[_0x1526('0x15')]['destroy']({'where':{'type':_0x2d8c3b,'resourceId':_0x5006fd['id']}})[_0x1526('0x12')](function(){return _0x163806;});})[_0x1526('0x12')](function(){var _0x2c512b=new Redis(config['redis']);_0x2c512b[_0x1526('0x16')]('agi',JSON[_0x1526('0x17')]({'id':_0x163806['id'],'deleted':!![]}));})[_0x1526('0x12')](function(){_0x591202[_0x1526('0x8')](0xcc)['end']();});}};}function handleEntityNotFound(_0x92a2d2){return function(_0x59314f){if(!_0x59314f){_0x92a2d2['sendStatus'](0x194);}return _0x59314f;};}function handleError(_0xfdb8bc,_0x2f2e84){_0x2f2e84=_0x2f2e84||0x1f4;return function(_0x5cb5d3){logger[_0x1526('0x18')](_0x5cb5d3['stack']);if(_0x5cb5d3[_0x1526('0x19')]){delete _0x5cb5d3[_0x1526('0x19')];}_0xfdb8bc[_0x1526('0x8')](_0x2f2e84)[_0x1526('0x1a')](_0x5cb5d3);};}exports[_0x1526('0x1b')]=function(_0x2d0148,_0x269d1e){var _0x194741={},_0x26ef4e={},_0x1d30f4={'count':0x0,'rows':[]};var _0x583036=_['map'](db[_0x1526('0x1c')][_0x1526('0x1d')],function(_0x2c3df7){return{'name':_0x2c3df7[_0x1526('0x1e')],'type':_0x2c3df7['type'][_0x1526('0x1f')]};});_0x26ef4e[_0x1526('0x20')]=_['map'](_0x583036,_0x1526('0x19'));_0x26ef4e['query']=_[_0x1526('0x21')](_0x2d0148[_0x1526('0x22')]);_0x26ef4e[_0x1526('0x23')]=_['intersection'](_0x26ef4e[_0x1526('0x20')],_0x26ef4e[_0x1526('0x22')]);_0x194741[_0x1526('0x24')]=_['intersection'](_0x26ef4e[_0x1526('0x20')],qs[_0x1526('0x25')](_0x2d0148[_0x1526('0x22')][_0x1526('0x25')]));_0x194741[_0x1526('0x24')]=_0x194741[_0x1526('0x24')][_0x1526('0x26')]?_0x194741['attributes']:_0x26ef4e[_0x1526('0x20')];if(!_0x2d0148['query'][_0x1526('0x27')](_0x1526('0x28'))){_0x194741[_0x1526('0xd')]=qs[_0x1526('0xd')](_0x2d0148[_0x1526('0x22')]['limit']);_0x194741[_0x1526('0xc')]=qs[_0x1526('0xc')](_0x2d0148['query'][_0x1526('0xc')]);}_0x194741[_0x1526('0x29')]=qs['sort'](_0x2d0148[_0x1526('0x22')][_0x1526('0x2a')]);_0x194741[_0x1526('0x2b')]=qs[_0x1526('0x23')](_[_0x1526('0x2c')](_0x2d0148[_0x1526('0x22')],_0x26ef4e[_0x1526('0x23')]),_0x583036);if(_0x2d0148['query'][_0x1526('0x2d')]){_0x194741['where']=_[_0x1526('0x2e')](_0x194741['where'],{'$or':_[_0x1526('0x2f')](_0x583036,function(_0x5465a3){if(_0x5465a3[_0x1526('0x30')]!==_0x1526('0x31')){var _0x2441fa={};_0x2441fa[_0x5465a3[_0x1526('0x19')]]={'$like':'%'+_0x2d0148[_0x1526('0x22')][_0x1526('0x2d')]+'%'};return _0x2441fa;}})});}_0x194741=_[_0x1526('0x2e')]({},_0x194741,_0x2d0148[_0x1526('0x32')]);var _0xb0f07e={'where':_0x194741[_0x1526('0x2b')]};return db[_0x1526('0x1c')][_0x1526('0xb')](_0xb0f07e)[_0x1526('0x12')](function(_0x4617ef){_0x1d30f4['count']=_0x4617ef;if(_0x2d0148['query'][_0x1526('0x33')]){_0x194741[_0x1526('0x34')]=[{'all':!![]}];}return db['SquareProject']['findAll'](_0x194741);})[_0x1526('0x12')](function(_0x132dac){_0x1d30f4['rows']=_0x132dac;return _0x1d30f4;})['then'](respondWithFilteredResult(_0x269d1e,_0x194741))['catch'](handleError(_0x269d1e,null));};exports[_0x1526('0x35')]=function(_0x5e1af4,_0x32e6b7){var _0x22d547={'raw':![],'where':{'id':_0x5e1af4['params']['id']}},_0x26ff2e={};_0x26ff2e[_0x1526('0x20')]=_[_0x1526('0x21')](db[_0x1526('0x1c')][_0x1526('0x1d')]);_0x26ff2e[_0x1526('0x22')]=_[_0x1526('0x21')](_0x5e1af4[_0x1526('0x22')]);_0x26ff2e[_0x1526('0x23')]=_[_0x1526('0x36')](_0x26ff2e[_0x1526('0x20')],_0x26ff2e['query']);_0x22d547[_0x1526('0x24')]=_[_0x1526('0x36')](_0x26ff2e[_0x1526('0x20')],qs['fields'](_0x5e1af4[_0x1526('0x22')][_0x1526('0x25')]));_0x22d547[_0x1526('0x24')]=_0x22d547[_0x1526('0x24')][_0x1526('0x26')]?_0x22d547[_0x1526('0x24')]:_0x26ff2e[_0x1526('0x20')];if(_0x5e1af4['query'][_0x1526('0x33')]){_0x22d547['include']=[{'all':!![]}];}_0x22d547=_['merge']({},_0x22d547,_0x5e1af4['options']);return db['SquareProject'][_0x1526('0x37')](_0x22d547)[_0x1526('0x12')](handleEntityNotFound(_0x32e6b7,null))[_0x1526('0x12')](respondWithResult(_0x32e6b7,null))[_0x1526('0x38')](handleError(_0x32e6b7,null));};exports['create']=function(_0x48c546,_0x4fabfb){return db['SquareProject']['create'](_0x48c546[_0x1526('0x39')],{})['then'](function(_0x1706bc){var _0x61ffc2=_0x48c546[_0x1526('0x3a')][_0x1526('0x13')]({'plain':!![]});if(!_0x61ffc2)throw new Error(_0x1526('0x3b'));if(_0x61ffc2[_0x1526('0x3c')]===_0x1526('0x3a')){var _0x4998bc=_0x1706bc[_0x1526('0x13')]({'plain':!![]});var _0x1c3150=_0x1526('0x14');return db['UserProfileSection'][_0x1526('0x37')]({'where':{'name':_0x1c3150,'userProfileId':_0x61ffc2[_0x1526('0x3d')]},'raw':!![]})['then'](function(_0x5d767e){if(_0x5d767e&&_0x5d767e[_0x1526('0x3e')]===0x0){return db[_0x1526('0x15')][_0x1526('0x3f')]({'name':_0x4998bc[_0x1526('0x19')],'resourceId':_0x4998bc['id'],'type':_0x5d767e[_0x1526('0x19')],'sectionId':_0x5d767e['id']},{})[_0x1526('0x12')](function(){return _0x1706bc;});}else{return _0x1706bc;}})[_0x1526('0x38')](function(_0x2d24cd){logger[_0x1526('0x18')](_0x1526('0x40'),_0x2d24cd);throw _0x2d24cd;});}return _0x1706bc;})[_0x1526('0x12')](respondWithResult(_0x4fabfb,0xc9))['catch'](handleError(_0x4fabfb,null));};exports[_0x1526('0x10')]=function(_0x21a2b6,_0x1458b7){if(_0x21a2b6['body']['id']){delete _0x21a2b6[_0x1526('0x39')]['id'];}return db[_0x1526('0x1c')][_0x1526('0x37')]({'where':{'id':_0x21a2b6['params']['id']}})['then'](handleEntityNotFound(_0x1458b7,null))['then'](saveUpdates(_0x21a2b6[_0x1526('0x39')],null))['then'](function(_0x101bca){if(!_0x101bca)return;var _0xb5b621=_0x101bca[_0x1526('0x13')]({'plain':!![]});return _0xb5b621;})[_0x1526('0x12')](function(_0x1abf6f){var _0x56b154=new Redis(config['redis']);_0x56b154[_0x1526('0x16')](_0x1526('0x41'),JSON[_0x1526('0x17')](_[_0x1526('0x2c')](_0x1abf6f,['id',_0x1526('0x19'),_0x1526('0x42')])));return _0x1abf6f;})['then'](respondWithResult(_0x1458b7,null))[_0x1526('0x38')](handleError(_0x1458b7,null));};exports['destroy']=function(_0x2db28b,_0x1c864c){return db[_0x1526('0x1c')][_0x1526('0x37')]({'where':{'id':_0x2db28b[_0x1526('0x43')]['id']}})[_0x1526('0x12')](handleEntityNotFound(_0x1c864c,null))[_0x1526('0x12')](removeEntity(_0x1c864c,null))[_0x1526('0x38')](handleError(_0x1c864c,null));}; \ No newline at end of file +var _0x7c66=['offset','undefined','set','update','then','destroy','SquareProjects','UserProfileResource','publish','agi','stringify','end','sendStatus','error','name','send','index','map','SquareProject','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','count','includeAll','findAll','catch','show','params','length','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','autoAssociation','production','lodash','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','status','json'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7c66,0xc6));var _0x67c6=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x7c66[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x67c6('0x0'));var Redis=require(_0x67c6('0x1'));var qs=require(_0x67c6('0x2'));var logger=require('../../config/logger')(_0x67c6('0x3'));var config=require(_0x67c6('0x4'));var db=require(_0x67c6('0x5'))['db'];config[_0x67c6('0x6')]=_[_0x67c6('0x7')](config[_0x67c6('0x6')],{'host':_0x67c6('0x8'),'port':0x18eb});var socket=require(_0x67c6('0x9'))(new Redis(config[_0x67c6('0x6')]));require('./squareProject.socket')['register'](socket);function respondWithResult(_0x288d18,_0x4fbf6c){_0x4fbf6c=_0x4fbf6c||0xc8;return function(_0x234304){if(_0x234304){return _0x288d18[_0x67c6('0xa')](_0x4fbf6c)[_0x67c6('0xb')](_0x234304);}};}function respondWithFilteredResult(_0x4e092f,_0x124ece){return function(_0xc6be6f){if(_0xc6be6f){var _0x3d22f9=typeof _0x124ece[_0x67c6('0xc')]==='undefined'&&typeof _0x124ece['limit']===_0x67c6('0xd');var _0x2c7933=_0xc6be6f['count'];var _0x21a932=_0x3d22f9?0x0:_0x124ece[_0x67c6('0xc')];var _0x46a32f=_0x3d22f9?_0xc6be6f['count']:_0x124ece['offset']+_0x124ece['limit'];var _0x5d5c30;if(_0x46a32f>=_0x2c7933){_0x46a32f=_0x2c7933;_0x5d5c30=0xc8;}else{_0x5d5c30=0xce;}_0x4e092f[_0x67c6('0xa')](_0x5d5c30);return _0x4e092f[_0x67c6('0xe')]('Content-Range',_0x21a932+'-'+_0x46a32f+'/'+_0x2c7933)['json'](_0xc6be6f);}return null;};}function saveUpdates(_0x5c85eb){return function(_0x3127e5){if(_0x3127e5){return _0x3127e5[_0x67c6('0xf')](_0x5c85eb)[_0x67c6('0x10')](function(_0x551241){return _0x551241;});}return null;};}function removeEntity(_0x543505){return function(_0x2d7dc5){if(_0x2d7dc5){return _0x2d7dc5[_0x67c6('0x11')]()['then'](function(){var _0x35c6cb=_0x2d7dc5['get']({'plain':!![]});var _0x23350b=_0x67c6('0x12');return db[_0x67c6('0x13')][_0x67c6('0x11')]({'where':{'type':_0x23350b,'resourceId':_0x35c6cb['id']}})[_0x67c6('0x10')](function(){return _0x2d7dc5;});})[_0x67c6('0x10')](function(){var _0x15bcb2=new Redis(config[_0x67c6('0x6')]);_0x15bcb2[_0x67c6('0x14')](_0x67c6('0x15'),JSON[_0x67c6('0x16')]({'id':_0x2d7dc5['id'],'deleted':!![]}));})[_0x67c6('0x10')](function(){_0x543505['status'](0xcc)[_0x67c6('0x17')]();});}};}function handleEntityNotFound(_0x394fc3){return function(_0x566d8d){if(!_0x566d8d){_0x394fc3[_0x67c6('0x18')](0x194);}return _0x566d8d;};}function handleError(_0x38b10b,_0x2d7029){_0x2d7029=_0x2d7029||0x1f4;return function(_0xbadd18){logger[_0x67c6('0x19')](_0xbadd18['stack']);if(_0xbadd18[_0x67c6('0x1a')]){delete _0xbadd18[_0x67c6('0x1a')];}_0x38b10b[_0x67c6('0xa')](_0x2d7029)[_0x67c6('0x1b')](_0xbadd18);};}exports[_0x67c6('0x1c')]=function(_0xc33b7f,_0x18eb02){var _0x598e75={},_0x38cb09={},_0x2176ba={'count':0x0,'rows':[]};var _0x359c37=_[_0x67c6('0x1d')](db[_0x67c6('0x1e')][_0x67c6('0x1f')],function(_0x429bb1){return{'name':_0x429bb1[_0x67c6('0x20')],'type':_0x429bb1[_0x67c6('0x21')]['key']};});_0x38cb09['model']=_[_0x67c6('0x1d')](_0x359c37,_0x67c6('0x1a'));_0x38cb09[_0x67c6('0x22')]=_[_0x67c6('0x23')](_0xc33b7f[_0x67c6('0x22')]);_0x38cb09['filters']=_[_0x67c6('0x24')](_0x38cb09[_0x67c6('0x25')],_0x38cb09[_0x67c6('0x22')]);_0x598e75[_0x67c6('0x26')]=_['intersection'](_0x38cb09[_0x67c6('0x25')],qs[_0x67c6('0x27')](_0xc33b7f[_0x67c6('0x22')][_0x67c6('0x27')]));_0x598e75[_0x67c6('0x26')]=_0x598e75['attributes']['length']?_0x598e75[_0x67c6('0x26')]:_0x38cb09[_0x67c6('0x25')];if(!_0xc33b7f[_0x67c6('0x22')][_0x67c6('0x28')](_0x67c6('0x29'))){_0x598e75['limit']=qs[_0x67c6('0x2a')](_0xc33b7f[_0x67c6('0x22')][_0x67c6('0x2a')]);_0x598e75[_0x67c6('0xc')]=qs[_0x67c6('0xc')](_0xc33b7f['query'][_0x67c6('0xc')]);}_0x598e75[_0x67c6('0x2b')]=qs['sort'](_0xc33b7f['query'][_0x67c6('0x2c')]);_0x598e75[_0x67c6('0x2d')]=qs[_0x67c6('0x2e')](_[_0x67c6('0x2f')](_0xc33b7f[_0x67c6('0x22')],_0x38cb09['filters']),_0x359c37);if(_0xc33b7f[_0x67c6('0x22')][_0x67c6('0x30')]){_0x598e75[_0x67c6('0x2d')]=_['merge'](_0x598e75[_0x67c6('0x2d')],{'$or':_[_0x67c6('0x1d')](_0x359c37,function(_0x2df079){if(_0x2df079[_0x67c6('0x21')]!==_0x67c6('0x31')){var _0x2c46b1={};_0x2c46b1[_0x2df079[_0x67c6('0x1a')]]={'$like':'%'+_0xc33b7f[_0x67c6('0x22')][_0x67c6('0x30')]+'%'};return _0x2c46b1;}})});}_0x598e75=_[_0x67c6('0x32')]({},_0x598e75,_0xc33b7f[_0x67c6('0x33')]);var _0x4c5aff={'where':_0x598e75[_0x67c6('0x2d')]};return db['SquareProject'][_0x67c6('0x34')](_0x4c5aff)[_0x67c6('0x10')](function(_0x55be31){_0x2176ba[_0x67c6('0x34')]=_0x55be31;if(_0xc33b7f['query'][_0x67c6('0x35')]){_0x598e75['include']=[{'all':!![]}];}return db[_0x67c6('0x1e')][_0x67c6('0x36')](_0x598e75);})[_0x67c6('0x10')](function(_0xb2e17f){_0x2176ba['rows']=_0xb2e17f;return _0x2176ba;})['then'](respondWithFilteredResult(_0x18eb02,_0x598e75))[_0x67c6('0x37')](handleError(_0x18eb02,null));};exports[_0x67c6('0x38')]=function(_0x114cf5,_0x1387f5){var _0x50279c={'raw':![],'where':{'id':_0x114cf5[_0x67c6('0x39')]['id']}},_0x50fa1d={};_0x50fa1d['model']=_[_0x67c6('0x23')](db['SquareProject']['rawAttributes']);_0x50fa1d['query']=_['keys'](_0x114cf5['query']);_0x50fa1d['filters']=_[_0x67c6('0x24')](_0x50fa1d['model'],_0x50fa1d[_0x67c6('0x22')]);_0x50279c[_0x67c6('0x26')]=_[_0x67c6('0x24')](_0x50fa1d[_0x67c6('0x25')],qs[_0x67c6('0x27')](_0x114cf5['query'][_0x67c6('0x27')]));_0x50279c[_0x67c6('0x26')]=_0x50279c[_0x67c6('0x26')][_0x67c6('0x3a')]?_0x50279c[_0x67c6('0x26')]:_0x50fa1d['model'];if(_0x114cf5[_0x67c6('0x22')][_0x67c6('0x35')]){_0x50279c[_0x67c6('0x3b')]=[{'all':!![]}];}_0x50279c=_[_0x67c6('0x32')]({},_0x50279c,_0x114cf5[_0x67c6('0x33')]);return db[_0x67c6('0x1e')][_0x67c6('0x3c')](_0x50279c)[_0x67c6('0x10')](handleEntityNotFound(_0x1387f5,null))[_0x67c6('0x10')](respondWithResult(_0x1387f5,null))['catch'](handleError(_0x1387f5,null));};exports['create']=function(_0x54dd0f,_0x72dab0){return db[_0x67c6('0x1e')][_0x67c6('0x3d')](_0x54dd0f[_0x67c6('0x3e')],{})[_0x67c6('0x10')](function(_0x3e2b4b){var _0x54f612=_0x54dd0f[_0x67c6('0x3f')]['get']({'plain':!![]});if(!_0x54f612)throw new Error(_0x67c6('0x40'));if(_0x54f612[_0x67c6('0x41')]===_0x67c6('0x3f')){var _0xb01878=_0x3e2b4b[_0x67c6('0x42')]({'plain':!![]});var _0x53f942=_0x67c6('0x12');return db[_0x67c6('0x43')][_0x67c6('0x3c')]({'where':{'name':_0x53f942,'userProfileId':_0x54f612['userProfileId']},'raw':!![]})[_0x67c6('0x10')](function(_0x1faa20){if(_0x1faa20&&_0x1faa20[_0x67c6('0x44')]===0x0){return db[_0x67c6('0x13')][_0x67c6('0x3d')]({'name':_0xb01878[_0x67c6('0x1a')],'resourceId':_0xb01878['id'],'type':_0x1faa20[_0x67c6('0x1a')],'sectionId':_0x1faa20['id']},{})['then'](function(){return _0x3e2b4b;});}else{return _0x3e2b4b;}})[_0x67c6('0x37')](function(_0x4146d1){logger[_0x67c6('0x19')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4146d1);throw _0x4146d1;});}return _0x3e2b4b;})['then'](respondWithResult(_0x72dab0,0xc9))[_0x67c6('0x37')](handleError(_0x72dab0,null));};exports[_0x67c6('0xf')]=function(_0x564185,_0x108974){if(_0x564185[_0x67c6('0x3e')]['id']){delete _0x564185[_0x67c6('0x3e')]['id'];}return db[_0x67c6('0x1e')][_0x67c6('0x3c')]({'where':{'id':_0x564185[_0x67c6('0x39')]['id']}})[_0x67c6('0x10')](handleEntityNotFound(_0x108974,null))[_0x67c6('0x10')](saveUpdates(_0x564185[_0x67c6('0x3e')],null))['then'](function(_0x38440e){if(!_0x38440e)return;var _0x5940aa=_0x38440e[_0x67c6('0x42')]({'plain':!![]});return _0x5940aa;})[_0x67c6('0x10')](function(_0x19a056){var _0x128614=new Redis(config[_0x67c6('0x6')]);_0x128614[_0x67c6('0x14')]('agi',JSON[_0x67c6('0x16')](_['pick'](_0x19a056,['id',_0x67c6('0x1a'),_0x67c6('0x45')])));return _0x19a056;})[_0x67c6('0x10')](respondWithResult(_0x108974,null))[_0x67c6('0x37')](handleError(_0x108974,null));};exports[_0x67c6('0x11')]=function(_0x5cba71,_0x512dda){return db['SquareProject'][_0x67c6('0x3c')]({'where':{'id':_0x5cba71[_0x67c6('0x39')]['id']}})[_0x67c6('0x10')](handleEntityNotFound(_0x512dda,null))[_0x67c6('0x10')](removeEntity(_0x512dda,null))[_0x67c6('0x37')](handleError(_0x512dda,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index c152a21..b461788 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 _0x28c5=['hook','exports','../../mysqldb','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x2d5bf8,_0x4a934b){var _0x558e6f=function(_0x50f969){while(--_0x50f969){_0x2d5bf8['push'](_0x2d5bf8['shift']());}};_0x558e6f(++_0x4a934b);}(_0x28c5,0x182));var _0x528c=function(_0x32e01f,_0x22422a){_0x32e01f=_0x32e01f-0x0;var _0x3403e6=_0x28c5[_0x32e01f];return _0x3403e6;};'use strict';var EventEmitter=require('events');var SquareProject=require(_0x528c('0x0'))['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x528c('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x528c('0x2'),'afterDestroy':_0x528c('0x3')};function emitEvent(_0xeecdae){return function(_0x5c6cd0,_0x5596af,_0x33ef6b){SquareProjectEvents['emit'](_0xeecdae+':'+_0x5c6cd0['id'],_0x5c6cd0);SquareProjectEvents[_0x528c('0x4')](_0xeecdae,_0x5c6cd0);_0x33ef6b(null);};}for(var e in events){if(events[_0x528c('0x5')](e)){var event=events[e];SquareProject[_0x528c('0x6')](e,emitEvent(event));}}module[_0x528c('0x7')]=SquareProjectEvents; \ No newline at end of file +var _0xb5c6=['SquareProject','setMaxListeners','save','update','remove','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x498d5f,_0xcc0dc0){var _0x5b8176=function(_0x50b273){while(--_0x50b273){_0x498d5f['push'](_0x498d5f['shift']());}};_0x5b8176(++_0xcc0dc0);}(_0xb5c6,0xee));var _0x6b5c=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xb5c6[_0x5b644e];return _0x49c6bf;};'use strict';var EventEmitter=require(_0x6b5c('0x0'));var SquareProject=require(_0x6b5c('0x1'))['db'][_0x6b5c('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x6b5c('0x3')](0x0);var events={'afterCreate':_0x6b5c('0x4'),'afterUpdate':_0x6b5c('0x5'),'afterDestroy':_0x6b5c('0x6')};function emitEvent(_0x49ddd5){return function(_0x144265,_0x42d5f3,_0x201d99){SquareProjectEvents['emit'](_0x49ddd5+':'+_0x144265['id'],_0x144265);SquareProjectEvents['emit'](_0x49ddd5,_0x144265);_0x201d99(null);};}for(var e in events){if(events[_0x6b5c('0x7')](e)){var event=events[e];SquareProject[_0x6b5c('0x8')](e,emitEvent(event));}}module[_0x6b5c('0x9')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 02c4e26..dc1bf71 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 _0x6285=['../../config/environment','exports','define','SquareProject','square_projects','changed','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x134893,_0x1c1576){var _0x467e1e=function(_0x395cc5){while(--_0x395cc5){_0x134893['push'](_0x134893['shift']());}};_0x467e1e(++_0x1c1576);}(_0x6285,0x1c9));var _0x5628=function(_0x31058a,_0x2a6243){_0x31058a=_0x31058a-0x0;var _0xfb389c=_0x6285[_0x31058a];return _0xfb389c;};'use strict';var _=require('lodash');var util=require(_0x5628('0x0'));var logger=require(_0x5628('0x1'))(_0x5628('0x2'));var moment=require('moment');var BPromise=require(_0x5628('0x3'));var rp=require(_0x5628('0x4'));var fs=require('fs');var path=require(_0x5628('0x5'));var rimraf=require(_0x5628('0x6'));var config=require(_0x5628('0x7'));var attributes=require('./squareProject.attributes');module[_0x5628('0x8')]=function(_0x5494e9,_0x5898a5){return _0x5494e9[_0x5628('0x9')](_0x5628('0xa'),attributes,{'tableName':_0x5628('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x47b613,_0x3e094c,_0x39d261){if(_0x47b613[_0x5628('0xc')]('preproduction')){_0x47b613[_0x5628('0xd')]=moment()[_0x5628('0xe')](_0x5628('0xf'));}if(_0x47b613['changed']('production')){_0x47b613['publishedAt']=moment()[_0x5628('0xe')](_0x5628('0xf'));}_0x39d261(null,_0x47b613);}}});}; \ No newline at end of file +var _0x3b72=['rimraf','../../config/environment','./squareProject.attributes','exports','define','square_projects','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','changed','production','publishedAt','lodash','../../config/logger','api','bluebird','request-promise','path'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0x3b72,0x150));var _0x23b7=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x3b72[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x23b7('0x0'));var util=require('util');var logger=require(_0x23b7('0x1'))(_0x23b7('0x2'));var moment=require('moment');var BPromise=require(_0x23b7('0x3'));var rp=require(_0x23b7('0x4'));var fs=require('fs');var path=require(_0x23b7('0x5'));var rimraf=require(_0x23b7('0x6'));var config=require(_0x23b7('0x7'));var attributes=require(_0x23b7('0x8'));module[_0x23b7('0x9')]=function(_0x3c8a4d,_0x2b29bb){return _0x3c8a4d[_0x23b7('0xa')]('SquareProject',attributes,{'tableName':_0x23b7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1d593e,_0x54c371,_0x1ba2bd){if(_0x1d593e['changed']('preproduction')){_0x1d593e[_0x23b7('0xc')]=moment()[_0x23b7('0xd')](_0x23b7('0xe'));}if(_0x1d593e[_0x23b7('0xf')](_0x23b7('0x10'))){_0x1d593e[_0x23b7('0x11')]=moment()[_0x23b7('0xd')](_0x23b7('0xe'));}_0x1ba2bd(null,_0x1d593e);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 7bec224..f7d5651 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 _0x6bfe=['localhost','socket.io-emitter','./squareProject.socket','register','GetSquareProjects','SquareProject','findAll','options','raw','limit','include','map','model','attributes','debug','stringify','catch','error','message','ShowSquareProject','find','where','info','../../config/logger','rpc','../../config/environment','redis'];(function(_0x2ae012,_0x226d53){var _0x319128=function(_0x429393){while(--_0x429393){_0x2ae012['push'](_0x2ae012['shift']());}};_0x319128(++_0x226d53);}(_0x6bfe,0x1c7));var _0xe6bf=function(_0x1ad6a8,_0x4b0323){_0x1ad6a8=_0x1ad6a8-0x0;var _0x442f28=_0x6bfe[_0x1ad6a8];return _0x442f28;};'use strict';var _=require('lodash');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var logger=require(_0xe6bf('0x0'))(_0xe6bf('0x1'));var config=require(_0xe6bf('0x2'));config[_0xe6bf('0x3')]=_['defaults'](config[_0xe6bf('0x3')],{'host':_0xe6bf('0x4'),'port':0x18eb});var socket=require(_0xe6bf('0x5'))(new Redis(config[_0xe6bf('0x3')]));require(_0xe6bf('0x6'))[_0xe6bf('0x7')](socket);exports[_0xe6bf('0x8')]=function(_0x270b95){var _0x4530b3=this;return new Promise(function(_0x43e50c,_0x1c9a1e){return db[_0xe6bf('0x9')][_0xe6bf('0xa')]({'raw':_0x270b95[_0xe6bf('0xb')]?_0x270b95[_0xe6bf('0xb')][_0xe6bf('0xc')]===undefined?!![]:![]:!![],'where':_0x270b95['options']?_0x270b95[_0xe6bf('0xb')]['where']||null:null,'attributes':_0x270b95[_0xe6bf('0xb')]?_0x270b95[_0xe6bf('0xb')]['attributes']||null:null,'limit':_0x270b95[_0xe6bf('0xb')]?_0x270b95[_0xe6bf('0xb')][_0xe6bf('0xd')]||null:null,'include':_0x270b95[_0xe6bf('0xb')]?_0x270b95[_0xe6bf('0xb')][_0xe6bf('0xe')]?_[_0xe6bf('0xf')](_0x270b95[_0xe6bf('0xb')][_0xe6bf('0xe')],function(_0x343076){return{'model':db[_0x343076[_0xe6bf('0x10')]],'as':_0x343076['as'],'attributes':_0x343076[_0xe6bf('0x11')],'include':_0x343076[_0xe6bf('0xe')]?_[_0xe6bf('0xf')](_0x343076[_0xe6bf('0xe')],function(_0xcf3aa5){return{'model':db[_0xcf3aa5[_0xe6bf('0x10')]],'as':_0xcf3aa5['as'],'attributes':_0xcf3aa5['attributes'],'include':_0xcf3aa5[_0xe6bf('0xe')]?_[_0xe6bf('0xf')](_0xcf3aa5['include'],function(_0x2031d9){return{'model':db[_0x2031d9[_0xe6bf('0x10')]],'as':_0x2031d9['as'],'attributes':_0x2031d9[_0xe6bf('0x11')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x44a7a3){logger['info']('GetSquareProjects',_0x270b95);logger[_0xe6bf('0x12')](_0xe6bf('0x8'),_0x270b95,JSON[_0xe6bf('0x13')](_0x44a7a3));_0x43e50c(_0x44a7a3);})[_0xe6bf('0x14')](function(_0x4e8a1f){logger[_0xe6bf('0x15')](_0xe6bf('0x8'),_0x4e8a1f[_0xe6bf('0x16')],_0x270b95);_0x1c9a1e(_0x4530b3[_0xe6bf('0x15')](0x1f4,_0x4e8a1f[_0xe6bf('0x16')]));});});};exports[_0xe6bf('0x17')]=function(_0x2e39e8){var _0x24be88=this;return new Promise(function(_0x4ec9f5,_0xfa54e6){return db[_0xe6bf('0x9')][_0xe6bf('0x18')]({'raw':_0x2e39e8[_0xe6bf('0xb')]?_0x2e39e8['options'][_0xe6bf('0xc')]===undefined?!![]:![]:!![],'where':_0x2e39e8[_0xe6bf('0xb')]?_0x2e39e8[_0xe6bf('0xb')][_0xe6bf('0x19')]||null:null,'attributes':_0x2e39e8[_0xe6bf('0xb')]?_0x2e39e8[_0xe6bf('0xb')][_0xe6bf('0x11')]||null:null,'include':_0x2e39e8['options']?_0x2e39e8[_0xe6bf('0xb')][_0xe6bf('0xe')]?_[_0xe6bf('0xf')](_0x2e39e8[_0xe6bf('0xb')]['include'],function(_0x18f3f4){return{'model':db[_0x18f3f4[_0xe6bf('0x10')]],'as':_0x18f3f4['as'],'attributes':_0x18f3f4['attributes'],'include':_0x18f3f4[_0xe6bf('0xe')]?_[_0xe6bf('0xf')](_0x18f3f4['include'],function(_0x96ce0a){return{'model':db[_0x96ce0a[_0xe6bf('0x10')]],'as':_0x96ce0a['as'],'attributes':_0x96ce0a[_0xe6bf('0x11')],'include':_0x96ce0a['include']?_[_0xe6bf('0xf')](_0x96ce0a[_0xe6bf('0xe')],function(_0x11d04b){return{'model':db[_0x11d04b[_0xe6bf('0x10')]],'as':_0x11d04b['as'],'attributes':_0x11d04b[_0xe6bf('0x11')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3d364f){logger[_0xe6bf('0x1a')]('ShowSquareProject',_0x2e39e8);logger[_0xe6bf('0x12')]('ShowSquareProject',_0x2e39e8,JSON['stringify'](_0x3d364f));_0x4ec9f5(_0x3d364f);})['catch'](function(_0x13f94c){logger['error'](_0xe6bf('0x17'),_0x13f94c[_0xe6bf('0x16')],_0x2e39e8);_0xfa54e6(_0x24be88[_0xe6bf('0x15')](0x1f4,_0x13f94c[_0xe6bf('0x16')]));});});}; \ No newline at end of file +var _0x1cda=['raw','attributes','limit','include','map','model','then','info','debug','stringify','catch','error','message','ShowSquareProject','find','ioredis','../../mysqldb','../../config/logger','../../config/environment','redis','defaults','socket.io-emitter','./squareProject.socket','register','GetSquareProjects','SquareProject','findAll','options'];(function(_0x229092,_0x4989cc){var _0xfdb022=function(_0x10e0b3){while(--_0x10e0b3){_0x229092['push'](_0x229092['shift']());}};_0xfdb022(++_0x4989cc);}(_0x1cda,0x15f));var _0xa1cd=function(_0xd60285,_0x189cd3){_0xd60285=_0xd60285-0x0;var _0x13279d=_0x1cda[_0xd60285];return _0x13279d;};'use strict';var _=require('lodash');var Redis=require(_0xa1cd('0x0'));var db=require(_0xa1cd('0x1'))['db'];var logger=require(_0xa1cd('0x2'))('rpc');var config=require(_0xa1cd('0x3'));config[_0xa1cd('0x4')]=_[_0xa1cd('0x5')](config[_0xa1cd('0x4')],{'host':'localhost','port':0x18eb});var socket=require(_0xa1cd('0x6'))(new Redis(config[_0xa1cd('0x4')]));require(_0xa1cd('0x7'))[_0xa1cd('0x8')](socket);exports[_0xa1cd('0x9')]=function(_0xf6bde1){var _0x18211e=this;return new Promise(function(_0x1c702f,_0x4237af){return db[_0xa1cd('0xa')][_0xa1cd('0xb')]({'raw':_0xf6bde1[_0xa1cd('0xc')]?_0xf6bde1[_0xa1cd('0xc')][_0xa1cd('0xd')]===undefined?!![]:![]:!![],'where':_0xf6bde1['options']?_0xf6bde1['options']['where']||null:null,'attributes':_0xf6bde1['options']?_0xf6bde1[_0xa1cd('0xc')][_0xa1cd('0xe')]||null:null,'limit':_0xf6bde1[_0xa1cd('0xc')]?_0xf6bde1['options'][_0xa1cd('0xf')]||null:null,'include':_0xf6bde1['options']?_0xf6bde1[_0xa1cd('0xc')][_0xa1cd('0x10')]?_[_0xa1cd('0x11')](_0xf6bde1[_0xa1cd('0xc')][_0xa1cd('0x10')],function(_0xa2cc1){return{'model':db[_0xa2cc1[_0xa1cd('0x12')]],'as':_0xa2cc1['as'],'attributes':_0xa2cc1[_0xa1cd('0xe')],'include':_0xa2cc1['include']?_[_0xa1cd('0x11')](_0xa2cc1[_0xa1cd('0x10')],function(_0x456629){return{'model':db[_0x456629[_0xa1cd('0x12')]],'as':_0x456629['as'],'attributes':_0x456629[_0xa1cd('0xe')],'include':_0x456629[_0xa1cd('0x10')]?_[_0xa1cd('0x11')](_0x456629[_0xa1cd('0x10')],function(_0x2c0312){return{'model':db[_0x2c0312[_0xa1cd('0x12')]],'as':_0x2c0312['as'],'attributes':_0x2c0312[_0xa1cd('0xe')]};}):[]};}):[]};}):[]:[]})[_0xa1cd('0x13')](function(_0x5105ee){logger[_0xa1cd('0x14')](_0xa1cd('0x9'),_0xf6bde1);logger[_0xa1cd('0x15')]('GetSquareProjects',_0xf6bde1,JSON[_0xa1cd('0x16')](_0x5105ee));_0x1c702f(_0x5105ee);})[_0xa1cd('0x17')](function(_0x10e785){logger[_0xa1cd('0x18')](_0xa1cd('0x9'),_0x10e785[_0xa1cd('0x19')],_0xf6bde1);_0x4237af(_0x18211e[_0xa1cd('0x18')](0x1f4,_0x10e785[_0xa1cd('0x19')]));});});};exports[_0xa1cd('0x1a')]=function(_0x426c6c){var _0x21cfa9=this;return new Promise(function(_0x3c8356,_0xdf6022){return db[_0xa1cd('0xa')][_0xa1cd('0x1b')]({'raw':_0x426c6c[_0xa1cd('0xc')]?_0x426c6c[_0xa1cd('0xc')][_0xa1cd('0xd')]===undefined?!![]:![]:!![],'where':_0x426c6c[_0xa1cd('0xc')]?_0x426c6c[_0xa1cd('0xc')]['where']||null:null,'attributes':_0x426c6c[_0xa1cd('0xc')]?_0x426c6c[_0xa1cd('0xc')]['attributes']||null:null,'include':_0x426c6c[_0xa1cd('0xc')]?_0x426c6c['options']['include']?_['map'](_0x426c6c[_0xa1cd('0xc')][_0xa1cd('0x10')],function(_0x1b00a9){return{'model':db[_0x1b00a9[_0xa1cd('0x12')]],'as':_0x1b00a9['as'],'attributes':_0x1b00a9[_0xa1cd('0xe')],'include':_0x1b00a9[_0xa1cd('0x10')]?_[_0xa1cd('0x11')](_0x1b00a9[_0xa1cd('0x10')],function(_0x483df1){return{'model':db[_0x483df1['model']],'as':_0x483df1['as'],'attributes':_0x483df1[_0xa1cd('0xe')],'include':_0x483df1[_0xa1cd('0x10')]?_['map'](_0x483df1[_0xa1cd('0x10')],function(_0x44d0d5){return{'model':db[_0x44d0d5[_0xa1cd('0x12')]],'as':_0x44d0d5['as'],'attributes':_0x44d0d5[_0xa1cd('0xe')]};}):[]};}):[]};}):[]:[]})[_0xa1cd('0x13')](function(_0x34bcee){logger[_0xa1cd('0x14')](_0xa1cd('0x1a'),_0x426c6c);logger[_0xa1cd('0x15')]('ShowSquareProject',_0x426c6c,JSON[_0xa1cd('0x16')](_0x34bcee));_0x3c8356(_0x34bcee);})[_0xa1cd('0x17')](function(_0x2c7da1){logger[_0xa1cd('0x18')](_0xa1cd('0x1a'),_0x2c7da1[_0xa1cd('0x19')],_0x426c6c);_0xdf6022(_0x21cfa9['error'](0x1f4,_0x2c7da1[_0xa1cd('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index a38772a..eb52c1e 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 _0x3d44=['squareProject:','./squareProject.events','save','remove','update','emit','removeListener','register','length'];(function(_0x5b5a7b,_0x17de80){var _0x46ddad=function(_0x31d95b){while(--_0x31d95b){_0x5b5a7b['push'](_0x5b5a7b['shift']());}};_0x46ddad(++_0x17de80);}(_0x3d44,0x1c3));var _0x43d4=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0x3d44[_0x36eaaa];return _0x461349;};'use strict';var SquareProjectEvents=require(_0x43d4('0x0'));var events=[_0x43d4('0x1'),_0x43d4('0x2'),_0x43d4('0x3')];function createListener(_0x379c89,_0x143fc5){return function(_0x2fac25){_0x143fc5[_0x43d4('0x4')](_0x379c89,_0x2fac25);};}function removeListener(_0x40c1e2,_0x30aaef){return function(){SquareProjectEvents[_0x43d4('0x5')](_0x40c1e2,_0x30aaef);};}exports[_0x43d4('0x6')]=function(_0x316e91){for(var _0x5efb9f=0x0,_0x48bd93=events[_0x43d4('0x7')];_0x5efb9f<_0x48bd93;_0x5efb9f++){var _0x1f580d=events[_0x5efb9f];var _0x40949c=createListener(_0x43d4('0x8')+_0x1f580d,_0x316e91);SquareProjectEvents['on'](_0x1f580d,_0x40949c);}}; \ No newline at end of file +var _0xb9a3=['register','length','./squareProject.events','save','remove','update','emit'];(function(_0x51bb38,_0x4e57a0){var _0x51c09b=function(_0x3321e2){while(--_0x3321e2){_0x51bb38['push'](_0x51bb38['shift']());}};_0x51c09b(++_0x4e57a0);}(_0xb9a3,0x1f3));var _0x3b9a=function(_0x1086ce,_0x32ca26){_0x1086ce=_0x1086ce-0x0;var _0x12b0f6=_0xb9a3[_0x1086ce];return _0x12b0f6;};'use strict';var SquareProjectEvents=require(_0x3b9a('0x0'));var events=[_0x3b9a('0x1'),_0x3b9a('0x2'),_0x3b9a('0x3')];function createListener(_0x2277ea,_0x4bb8d9){return function(_0x5e1a67){_0x4bb8d9[_0x3b9a('0x4')](_0x2277ea,_0x5e1a67);};}function removeListener(_0x4c7334,_0x221c84){return function(){SquareProjectEvents['removeListener'](_0x4c7334,_0x221c84);};}exports[_0x3b9a('0x5')]=function(_0x1841c5){for(var _0x20c220=0x0,_0x46b47f=events[_0x3b9a('0x6')];_0x20c220<_0x46b47f;_0x20c220++){var _0x2fc844=events[_0x20c220];var _0x214a0f=createListener('squareProject:'+_0x2fc844,_0x1841c5);SquareProjectEvents['on'](_0x2fc844,_0x214a0f);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 75fc8a9..33a46a5 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 _0xe14b=['Router','../../components/auth/service','./squareRecording.controller','get','isAuthenticated','index','/:id','download','post','delete','destroy','exports','multer','util','express'];(function(_0x578660,_0x477f28){var _0x491826=function(_0x34d34a){while(--_0x34d34a){_0x578660['push'](_0x578660['shift']());}};_0x491826(++_0x477f28);}(_0xe14b,0x93));var _0xbe14=function(_0x1b2f83,_0x3d55ae){_0x1b2f83=_0x1b2f83-0x0;var _0x5c60ce=_0xe14b[_0x1b2f83];return _0x5c60ce;};'use strict';var multer=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbe14('0x2'));var router=express[_0xbe14('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbe14('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbe14('0x5'));router[_0xbe14('0x6')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x8')]);router[_0xbe14('0x6')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['show']);router['get']('/:id/download',auth[_0xbe14('0x7')](),controller[_0xbe14('0xa')]);router[_0xbe14('0xb')]('/',auth[_0xbe14('0x7')](),controller['create']);router['put'](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['update']);router[_0xbe14('0xc')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller[_0xbe14('0xd')]);module[_0xbe14('0xe')]=router; \ No newline at end of file +var _0x5fab=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','/:id','show','/:id/download','download','create','put','update','delete','destroy','multer','util','connect-timeout'];(function(_0x359935,_0x33d1af){var _0x22e402=function(_0x355057){while(--_0x355057){_0x359935['push'](_0x359935['shift']());}};_0x22e402(++_0x33d1af);}(_0x5fab,0x177));var _0xb5fa=function(_0x35b80e,_0x120fd7){_0x35b80e=_0x35b80e-0x0;var _0x363914=_0x5fab[_0x35b80e];return _0x363914;};'use strict';var multer=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var path=require('path');var timeout=require(_0xb5fa('0x2'));var express=require(_0xb5fa('0x3'));var router=express[_0xb5fa('0x4')]();var fs_extra=require(_0xb5fa('0x5'));var auth=require(_0xb5fa('0x6'));var interaction=require(_0xb5fa('0x7'));var config=require(_0xb5fa('0x8'));var controller=require(_0xb5fa('0x9'));router[_0xb5fa('0xa')]('/',auth[_0xb5fa('0xb')](),controller['index']);router['get'](_0xb5fa('0xc'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0xd')]);router['get'](_0xb5fa('0xe'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0xb5fa('0x10')]);router[_0xb5fa('0x11')](_0xb5fa('0xc'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x12')]);router[_0xb5fa('0x13')](_0xb5fa('0xc'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index da8ae99..d9125cf 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 _0x7dfd=['substring','lastIndexOf','sequelize','exports','STRING','VIRTUAL','savePath'];(function(_0x167a24,_0x99153f){var _0x3f467f=function(_0x5ee157){while(--_0x5ee157){_0x167a24['push'](_0x167a24['shift']());}};_0x3f467f(++_0x99153f);}(_0x7dfd,0x1c2));var _0xd7df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7dfd[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xd7df('0x0'));module[_0xd7df('0x1')]={'uniqueid':{'type':Sequelize[_0xd7df('0x2')]},'callerid':{'type':Sequelize[_0xd7df('0x2')]},'calleridname':{'type':Sequelize[_0xd7df('0x2')]},'context':{'type':Sequelize[_0xd7df('0x2')]},'extension':{'type':Sequelize[_0xd7df('0x2')]},'priority':{'type':Sequelize[_0xd7df('0x2')]},'accountcode':{'type':Sequelize[_0xd7df('0x2')]},'dnid':{'type':Sequelize[_0xd7df('0x2')]},'projectName':{'type':Sequelize[_0xd7df('0x2')]},'saveName':{'type':Sequelize[_0xd7df('0x2')]},'filename':{'type':Sequelize[_0xd7df('0x2')]},'savePath':{'type':Sequelize[_0xd7df('0x2')]},'format':{'type':Sequelize[_0xd7df('0x3')],'get':function(){var _0x16e50='';var _0x2c48a4=this['getDataValue'](_0xd7df('0x4'));if(_0x2c48a4){_0x16e50=_0x2c48a4[_0xd7df('0x5')](_0x2c48a4[_0xd7df('0x6')]('.'));}return _0x16e50;}}}; \ No newline at end of file +var _0x7c09=['exports','STRING','VIRTUAL','getDataValue','savePath','lastIndexOf'];(function(_0x174547,_0x1cd215){var _0x46cb79=function(_0x45fbbe){while(--_0x45fbbe){_0x174547['push'](_0x174547['shift']());}};_0x46cb79(++_0x1cd215);}(_0x7c09,0x102));var _0x97c0=function(_0x5339e4,_0x24fbf7){_0x5339e4=_0x5339e4-0x0;var _0x4f8abb=_0x7c09[_0x5339e4];return _0x4f8abb;};'use strict';var Sequelize=require('sequelize');module[_0x97c0('0x0')]={'uniqueid':{'type':Sequelize[_0x97c0('0x1')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x97c0('0x1')]},'context':{'type':Sequelize[_0x97c0('0x1')]},'extension':{'type':Sequelize[_0x97c0('0x1')]},'priority':{'type':Sequelize[_0x97c0('0x1')]},'accountcode':{'type':Sequelize[_0x97c0('0x1')]},'dnid':{'type':Sequelize[_0x97c0('0x1')]},'projectName':{'type':Sequelize[_0x97c0('0x1')]},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x97c0('0x2')],'get':function(){var _0x42c6c7='';var _0x2c19fa=this[_0x97c0('0x3')](_0x97c0('0x4'));if(_0x2c19fa){_0x42c6c7=_0x2c19fa['substring'](_0x2c19fa[_0x97c0('0x5')]('.'));}return _0x42c6c7;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 1321c19..3f5cef5 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 _0x4b64=['fields','includeAll','options','find','body','download','../../components/encryptor','uniqueid','savePath','filename','format','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','extname','unlink','message','SquareRecording\x20not\x20found','send','Not\x20found','destroy','isNil','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','end','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','stack','name','index','map','SquareRecording','rawAttributes','fieldName','type','model','keys','query','intersection','attributes','length','nolimit','order','sort','where','filters','pick','filter','merge','include','findAll','then','rows','catch','show','params'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0x4b64,0x80));var _0x44b6=function(_0x5c9f8a,_0x1561ea){_0x5c9f8a=_0x5c9f8a-0x0;var _0x2bdb45=_0x4b64[_0x5c9f8a];return _0x2bdb45;};'use strict';var emlformat=require(_0x44b6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x44b6('0x1'));var jsonpatch=require(_0x44b6('0x2'));var rp=require(_0x44b6('0x3'));var moment=require(_0x44b6('0x4'));var BPromise=require(_0x44b6('0x5'));var Mustache=require(_0x44b6('0x6'));var util=require(_0x44b6('0x7'));var path=require(_0x44b6('0x8'));var sox=require(_0x44b6('0x9'));var csv=require(_0x44b6('0xa'));var ejs=require(_0x44b6('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x44b6('0xc'));var crypto=require('crypto');var jsforce=require(_0x44b6('0xd'));var deskjs=require(_0x44b6('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x44b6('0xf'));var Redis=require(_0x44b6('0x10'));var authService=require(_0x44b6('0x11'));var qs=require(_0x44b6('0x12'));var as=require(_0x44b6('0x13'));var hardwareService=require(_0x44b6('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x44b6('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x44b6('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x30f3b7,_0x114ea1){_0x114ea1=_0x114ea1||0xcc;return function(_0x1efb52){if(_0x1efb52){return _0x30f3b7[_0x44b6('0x17')](_0x114ea1);}return _0x30f3b7[_0x44b6('0x18')](_0x114ea1)['end']();};}function respondWithResult(_0x3c0a2a,_0x5e527f){_0x5e527f=_0x5e527f||0xc8;return function(_0x1deb69){if(_0x1deb69){return _0x3c0a2a[_0x44b6('0x18')](_0x5e527f)[_0x44b6('0x19')](_0x1deb69);}};}function respondWithFilteredResult(_0x4a7f5e,_0xda0efe){return function(_0x215056){if(_0x215056){var _0x32efe5=typeof _0xda0efe[_0x44b6('0x1a')]===_0x44b6('0x1b')&&typeof _0xda0efe['limit']==='undefined';var _0x1563d0=_0x215056['count'];var _0x205819=_0x32efe5?0x0:_0xda0efe[_0x44b6('0x1a')];var _0xdc113=_0x32efe5?_0x215056[_0x44b6('0x1c')]:_0xda0efe[_0x44b6('0x1a')]+_0xda0efe[_0x44b6('0x1d')];var _0x58a6c3;if(_0xdc113>=_0x1563d0){_0xdc113=_0x1563d0;_0x58a6c3=0xc8;}else{_0x58a6c3=0xce;}_0x4a7f5e['status'](_0x58a6c3);return _0x4a7f5e[_0x44b6('0x1e')](_0x44b6('0x1f'),_0x205819+'-'+_0xdc113+'/'+_0x1563d0)['json'](_0x215056);}return null;};}function patchUpdates(_0x5d74c2){return function(_0x2bef67){try{jsonpatch[_0x44b6('0x20')](_0x2bef67,_0x5d74c2,!![]);}catch(_0x27a3fc){return BPromise['reject'](_0x27a3fc);}return _0x2bef67[_0x44b6('0x21')]();};}function saveUpdates(_0x369b0a,_0x4826f8){return function(_0x22aea6){if(_0x22aea6){return _0x22aea6[_0x44b6('0x22')](_0x369b0a)['then'](function(_0x28e3f5){return _0x28e3f5;});}return null;};}function removeEntity(_0x41dcab,_0x560dad){return function(_0x5595c9){if(_0x5595c9){return _0x5595c9['destroy']()['then'](function(){_0x41dcab[_0x44b6('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ccd1c,_0x152061){return function(_0x502b36){if(!_0x502b36){_0x1ccd1c[_0x44b6('0x17')](0x194);}return _0x502b36;};}function handleError(_0x41776f,_0x574196){_0x574196=_0x574196||0x1f4;return function(_0x2491e2){logger['error'](_0x2491e2[_0x44b6('0x23')]);if(_0x2491e2[_0x44b6('0x24')]){delete _0x2491e2['name'];}_0x41776f[_0x44b6('0x18')](_0x574196)['send'](_0x2491e2);};}exports[_0x44b6('0x25')]=function(_0x576150,_0x2af537){var _0x9dc598={},_0x563f86={},_0x404623={'count':0x0,'rows':[]};var _0x2adb0b=_[_0x44b6('0x26')](db[_0x44b6('0x27')][_0x44b6('0x28')],function(_0x4c309d){return{'name':_0x4c309d[_0x44b6('0x29')],'type':_0x4c309d[_0x44b6('0x2a')]['key']};});_0x563f86[_0x44b6('0x2b')]=_['map'](_0x2adb0b,_0x44b6('0x24'));_0x563f86['query']=_[_0x44b6('0x2c')](_0x576150[_0x44b6('0x2d')]);_0x563f86['filters']=_[_0x44b6('0x2e')](_0x563f86[_0x44b6('0x2b')],_0x563f86['query']);_0x9dc598[_0x44b6('0x2f')]=_['intersection'](_0x563f86[_0x44b6('0x2b')],qs['fields'](_0x576150[_0x44b6('0x2d')]['fields']));_0x9dc598['attributes']=_0x9dc598[_0x44b6('0x2f')][_0x44b6('0x30')]?_0x9dc598[_0x44b6('0x2f')]:_0x563f86[_0x44b6('0x2b')];if(!_0x576150[_0x44b6('0x2d')]['hasOwnProperty'](_0x44b6('0x31'))){_0x9dc598[_0x44b6('0x1d')]=qs[_0x44b6('0x1d')](_0x576150[_0x44b6('0x2d')][_0x44b6('0x1d')]);_0x9dc598[_0x44b6('0x1a')]=qs['offset'](_0x576150[_0x44b6('0x2d')]['offset']);}_0x9dc598[_0x44b6('0x32')]=qs[_0x44b6('0x33')](_0x576150[_0x44b6('0x2d')][_0x44b6('0x33')]);_0x9dc598[_0x44b6('0x34')]=qs[_0x44b6('0x35')](_[_0x44b6('0x36')](_0x576150[_0x44b6('0x2d')],_0x563f86[_0x44b6('0x35')]),_0x2adb0b);if(_0x576150[_0x44b6('0x2d')][_0x44b6('0x37')]){_0x9dc598[_0x44b6('0x34')]=_['merge'](_0x9dc598[_0x44b6('0x34')],{'$or':_['map'](_0x2adb0b,function(_0x2f7376){if(_0x2f7376[_0x44b6('0x2a')]!=='VIRTUAL'){var _0x3c9457={};_0x3c9457[_0x2f7376[_0x44b6('0x24')]]={'$like':'%'+_0x576150['query']['filter']+'%'};return _0x3c9457;}})});}_0x9dc598=_[_0x44b6('0x38')]({},_0x9dc598,_0x576150['options']);var _0x3a8233={'where':_0x9dc598['where']};return db['SquareRecording']['count'](_0x3a8233)['then'](function(_0x35d0d4){_0x404623[_0x44b6('0x1c')]=_0x35d0d4;if(_0x576150[_0x44b6('0x2d')]['includeAll']){_0x9dc598[_0x44b6('0x39')]=[{'all':!![]}];}return db[_0x44b6('0x27')][_0x44b6('0x3a')](_0x9dc598);})[_0x44b6('0x3b')](function(_0x5cc4d0){_0x404623[_0x44b6('0x3c')]=_0x5cc4d0;return _0x404623;})[_0x44b6('0x3b')](respondWithFilteredResult(_0x2af537,_0x9dc598))[_0x44b6('0x3d')](handleError(_0x2af537,null));};exports[_0x44b6('0x3e')]=function(_0x1967c7,_0xf70cf6){var _0x3c87b4={'raw':!![],'where':{'id':_0x1967c7[_0x44b6('0x3f')]['id']}},_0x48de3d={};_0x48de3d[_0x44b6('0x2b')]=_[_0x44b6('0x2c')](db[_0x44b6('0x27')]['rawAttributes']);_0x48de3d[_0x44b6('0x2d')]=_[_0x44b6('0x2c')](_0x1967c7['query']);_0x48de3d[_0x44b6('0x35')]=_[_0x44b6('0x2e')](_0x48de3d[_0x44b6('0x2b')],_0x48de3d[_0x44b6('0x2d')]);_0x3c87b4[_0x44b6('0x2f')]=_['intersection'](_0x48de3d['model'],qs[_0x44b6('0x40')](_0x1967c7['query'][_0x44b6('0x40')]));_0x3c87b4['attributes']=_0x3c87b4[_0x44b6('0x2f')]['length']?_0x3c87b4[_0x44b6('0x2f')]:_0x48de3d[_0x44b6('0x2b')];if(_0x1967c7[_0x44b6('0x2d')][_0x44b6('0x41')]){_0x3c87b4['include']=[{'all':!![]}];}_0x3c87b4=_[_0x44b6('0x38')]({},_0x3c87b4,_0x1967c7[_0x44b6('0x42')]);return db[_0x44b6('0x27')][_0x44b6('0x43')](_0x3c87b4)[_0x44b6('0x3b')](handleEntityNotFound(_0xf70cf6,null))[_0x44b6('0x3b')](respondWithResult(_0xf70cf6,null))[_0x44b6('0x3d')](handleError(_0xf70cf6,null));};exports['create']=function(_0x468f72,_0x202915){return db[_0x44b6('0x27')]['create'](_0x468f72[_0x44b6('0x44')],{})[_0x44b6('0x3b')](respondWithResult(_0x202915,0xc9))[_0x44b6('0x3d')](handleError(_0x202915,null));};exports[_0x44b6('0x22')]=function(_0x582560,_0x4bd236){if(_0x582560['body']['id']){delete _0x582560[_0x44b6('0x44')]['id'];}return db[_0x44b6('0x27')][_0x44b6('0x43')]({'where':{'id':_0x582560['params']['id']}})[_0x44b6('0x3b')](handleEntityNotFound(_0x4bd236,null))[_0x44b6('0x3b')](saveUpdates(_0x582560[_0x44b6('0x44')],null))[_0x44b6('0x3b')](respondWithResult(_0x4bd236,null))['catch'](handleError(_0x4bd236,null));};exports[_0x44b6('0x45')]=function(_0x3fdc82,_0x13d38c,_0x1e1b19){var _0x382da5=require(_0x44b6('0x46'));var _0x35b3c6=![];var _0x458d0d={};if(_0x3fdc82[_0x44b6('0x2d')][_0x44b6('0x2a')]&&_0x3fdc82[_0x44b6('0x2d')][_0x44b6('0x2a')]===_0x44b6('0x47')){_0x458d0d[_0x44b6('0x47')]=_0x3fdc82[_0x44b6('0x3f')]['id'];}else{_0x458d0d['id']=_0x3fdc82['params']['id'];}return db['SquareRecording'][_0x44b6('0x43')]({'where':_0x458d0d,'attributes':['id',_0x44b6('0x48'),_0x44b6('0x49')],'raw':!![]})['then'](handleEntityNotFound(_0x13d38c,null))['then'](function(_0x5f143e){if(_0x5f143e){var _0x9f4a33=_0x5f143e[_0x44b6('0x48')];var _0x206046=util[_0x44b6('0x4a')](_0x44b6('0x4b'),_0x9f4a33);if(fs[_0x44b6('0x4c')](_0x206046)){_0x35b3c6=!![];return _0x382da5[_0x44b6('0x4d')](_0x206046,_0x9f4a33,config[_0x44b6('0x4e')][_0x44b6('0x4f')])[_0x44b6('0x3b')](function(){return _0x5f143e;});}return _0x5f143e;}})['then'](function(_0x1d91c0){if(_0x1d91c0){var _0x25c3a2=_0x1d91c0[_0x44b6('0x48')];if(!fs[_0x44b6('0x4c')](_0x25c3a2)){throw new db[(_0x44b6('0x50'))][(_0x44b6('0x51'))]('SquareRecording\x20not\x20found');}if(_0x1d91c0[_0x44b6('0x49')]){return _0x13d38c[_0x44b6('0x45')](_0x25c3a2,_0x1d91c0[_0x44b6('0x49')]+path[_0x44b6('0x52')](_0x25c3a2),function(){if(_0x35b3c6){fs[_0x44b6('0x53')](_0x25c3a2);}});}else{return _0x13d38c[_0x44b6('0x45')](_0x25c3a2,function(_0x1d3af7){if(_0x35b3c6){fs[_0x44b6('0x53')](_0x25c3a2);}});}}})[_0x44b6('0x3d')](function(_0x49b3b7){if(_0x49b3b7[_0x44b6('0x54')]===_0x44b6('0x55')){_0x13d38c[_0x44b6('0x18')](0x194)[_0x44b6('0x56')](_0x44b6('0x57'));}else{return handleError(_0x13d38c,null);}});};exports[_0x44b6('0x58')]=function(_0x3ed174,_0x3d9573){return db[_0x44b6('0x27')][_0x44b6('0x43')]({'where':{'id':_0x3ed174[_0x44b6('0x3f')]['id']}})[_0x44b6('0x3b')](function(_0x571aff){if(_[_0x44b6('0x59')](_0x571aff)){throw new ReferenceError('Entity\x20not\x20found');}return _0x571aff;})['then'](function(_0x118536){var _0x5ad75f=_0x118536['savePath'];logger[_0x44b6('0x5a')](_0x44b6('0x5b'),_0x5ad75f);if(!_[_0x44b6('0x59')](_0x118536['savePath'])&&fs['existsSync'](_0x5ad75f)){logger[_0x44b6('0x5a')](_0x44b6('0x5c')+_0x5ad75f+_0x44b6('0x5d'));fs[_0x44b6('0x5e')](_0x5ad75f);}_0x5ad75f=_0x5ad75f+'.cypher';if(!_['isNil'](_0x118536['savePath'])&&fs[_0x44b6('0x4c')](_0x5ad75f)){logger[_0x44b6('0x5a')](_0x44b6('0x5c')+_0x5ad75f+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x44b6('0x5e')](_0x5ad75f);}return _0x118536;})[_0x44b6('0x3b')](function(_0x596fa5){if(!_0x596fa5)throw new InternalError();return _0x596fa5[_0x44b6('0x58')]();})[_0x44b6('0x3b')](function(){_0x3d9573['status'](0xcc)[_0x44b6('0x5f')]();})[_0x44b6('0x3d')](handleError(_0x3d9573,null));}; \ No newline at end of file +var _0x821b=['\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','File:\x20\x22','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','set','Content-Range','apply','reject','save','then','sendStatus','error','stack','name','send','index','map','SquareRecording','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','sort','where','pick','filter','merge','VIRTUAL','findAll','rows','catch','show','params','includeAll','include','options','find','create','body','update','download','../../components/encryptor','uniqueid','filename','savePath','format','%s.cypher','existsSync','decryptFile','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','extname','unlink','message','Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s'];(function(_0x34ab07,_0x4be6ba){var _0x2b394d=function(_0x29f044){while(--_0x29f044){_0x34ab07['push'](_0x34ab07['shift']());}};_0x2b394d(++_0x4be6ba);}(_0x821b,0x12d));var _0xb821=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x821b[_0x2641f9];return _0x585741;};'use strict';var emlformat=require(_0xb821('0x0'));var rimraf=require(_0xb821('0x1'));var zipdir=require(_0xb821('0x2'));var jsonpatch=require(_0xb821('0x3'));var rp=require(_0xb821('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xb821('0x5'));var path=require(_0xb821('0x6'));var sox=require('sox');var csv=require(_0xb821('0x7'));var ejs=require(_0xb821('0x8'));var fs=require('fs');var fs_extra=require(_0xb821('0x9'));var _=require(_0xb821('0xa'));var squel=require(_0xb821('0xb'));var crypto=require('crypto');var jsforce=require(_0xb821('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xb821('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb821('0xd'));var qs=require(_0xb821('0xe'));var as=require(_0xb821('0xf'));var hardwareService=require(_0xb821('0x10'));var logger=require(_0xb821('0x11'))(_0xb821('0x12'));var utils=require(_0xb821('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xb821('0x14'));var db=require(_0xb821('0x15'))['db'];function respondWithStatusCode(_0x592b0e,_0x1a05e5){_0x1a05e5=_0x1a05e5||0xcc;return function(_0x44d773){if(_0x44d773){return _0x592b0e['sendStatus'](_0x1a05e5);}return _0x592b0e[_0xb821('0x16')](_0x1a05e5)[_0xb821('0x17')]();};}function respondWithResult(_0x196210,_0x734843){_0x734843=_0x734843||0xc8;return function(_0x365180){if(_0x365180){return _0x196210['status'](_0x734843)[_0xb821('0x18')](_0x365180);}};}function respondWithFilteredResult(_0x41c503,_0x4d3c86){return function(_0x26f236){if(_0x26f236){var _0x14a29c=typeof _0x4d3c86['offset']===_0xb821('0x19')&&typeof _0x4d3c86[_0xb821('0x1a')]==='undefined';var _0x515982=_0x26f236[_0xb821('0x1b')];var _0x10ab13=_0x14a29c?0x0:_0x4d3c86['offset'];var _0x3d6287=_0x14a29c?_0x26f236[_0xb821('0x1b')]:_0x4d3c86['offset']+_0x4d3c86[_0xb821('0x1a')];var _0x208904;if(_0x3d6287>=_0x515982){_0x3d6287=_0x515982;_0x208904=0xc8;}else{_0x208904=0xce;}_0x41c503[_0xb821('0x16')](_0x208904);return _0x41c503[_0xb821('0x1c')](_0xb821('0x1d'),_0x10ab13+'-'+_0x3d6287+'/'+_0x515982)[_0xb821('0x18')](_0x26f236);}return null;};}function patchUpdates(_0x4b37af){return function(_0x4cb49e){try{jsonpatch[_0xb821('0x1e')](_0x4cb49e,_0x4b37af,!![]);}catch(_0x2d0057){return BPromise[_0xb821('0x1f')](_0x2d0057);}return _0x4cb49e[_0xb821('0x20')]();};}function saveUpdates(_0x30d802,_0x532bb7){return function(_0x110ae5){if(_0x110ae5){return _0x110ae5['update'](_0x30d802)[_0xb821('0x21')](function(_0xb27e1){return _0xb27e1;});}return null;};}function removeEntity(_0x5203d7,_0x1b57a6){return function(_0x279f10){if(_0x279f10){return _0x279f10['destroy']()[_0xb821('0x21')](function(){_0x5203d7[_0xb821('0x16')](0xcc)[_0xb821('0x17')]();});}};}function handleEntityNotFound(_0x3dea33,_0x5455d3){return function(_0x1763d0){if(!_0x1763d0){_0x3dea33[_0xb821('0x22')](0x194);}return _0x1763d0;};}function handleError(_0x5be6e6,_0x5e6099){_0x5e6099=_0x5e6099||0x1f4;return function(_0x5c6340){logger[_0xb821('0x23')](_0x5c6340[_0xb821('0x24')]);if(_0x5c6340[_0xb821('0x25')]){delete _0x5c6340[_0xb821('0x25')];}_0x5be6e6[_0xb821('0x16')](_0x5e6099)[_0xb821('0x26')](_0x5c6340);};}exports[_0xb821('0x27')]=function(_0x1404e5,_0x53aa66){var _0x268f0f={},_0x353444={},_0x4e00e6={'count':0x0,'rows':[]};var _0x542dbd=_[_0xb821('0x28')](db[_0xb821('0x29')][_0xb821('0x2a')],function(_0x4909cc){return{'name':_0x4909cc['fieldName'],'type':_0x4909cc[_0xb821('0x2b')][_0xb821('0x2c')]};});_0x353444[_0xb821('0x2d')]=_['map'](_0x542dbd,'name');_0x353444[_0xb821('0x2e')]=_[_0xb821('0x2f')](_0x1404e5[_0xb821('0x2e')]);_0x353444[_0xb821('0x30')]=_[_0xb821('0x31')](_0x353444[_0xb821('0x2d')],_0x353444[_0xb821('0x2e')]);_0x268f0f[_0xb821('0x32')]=_[_0xb821('0x31')](_0x353444['model'],qs[_0xb821('0x33')](_0x1404e5[_0xb821('0x2e')][_0xb821('0x33')]));_0x268f0f[_0xb821('0x32')]=_0x268f0f['attributes'][_0xb821('0x34')]?_0x268f0f['attributes']:_0x353444[_0xb821('0x2d')];if(!_0x1404e5[_0xb821('0x2e')][_0xb821('0x35')](_0xb821('0x36'))){_0x268f0f[_0xb821('0x1a')]=qs[_0xb821('0x1a')](_0x1404e5[_0xb821('0x2e')][_0xb821('0x1a')]);_0x268f0f[_0xb821('0x37')]=qs[_0xb821('0x37')](_0x1404e5['query'][_0xb821('0x37')]);}_0x268f0f['order']=qs[_0xb821('0x38')](_0x1404e5[_0xb821('0x2e')][_0xb821('0x38')]);_0x268f0f[_0xb821('0x39')]=qs['filters'](_[_0xb821('0x3a')](_0x1404e5[_0xb821('0x2e')],_0x353444[_0xb821('0x30')]),_0x542dbd);if(_0x1404e5[_0xb821('0x2e')][_0xb821('0x3b')]){_0x268f0f[_0xb821('0x39')]=_[_0xb821('0x3c')](_0x268f0f['where'],{'$or':_['map'](_0x542dbd,function(_0x3ef3e3){if(_0x3ef3e3[_0xb821('0x2b')]!==_0xb821('0x3d')){var _0x466896={};_0x466896[_0x3ef3e3[_0xb821('0x25')]]={'$like':'%'+_0x1404e5[_0xb821('0x2e')][_0xb821('0x3b')]+'%'};return _0x466896;}})});}_0x268f0f=_[_0xb821('0x3c')]({},_0x268f0f,_0x1404e5['options']);var _0x1adafa={'where':_0x268f0f[_0xb821('0x39')]};return db['SquareRecording']['count'](_0x1adafa)[_0xb821('0x21')](function(_0x47059d){_0x4e00e6[_0xb821('0x1b')]=_0x47059d;if(_0x1404e5[_0xb821('0x2e')]['includeAll']){_0x268f0f['include']=[{'all':!![]}];}return db['SquareRecording'][_0xb821('0x3e')](_0x268f0f);})[_0xb821('0x21')](function(_0x20f33c){_0x4e00e6[_0xb821('0x3f')]=_0x20f33c;return _0x4e00e6;})['then'](respondWithFilteredResult(_0x53aa66,_0x268f0f))[_0xb821('0x40')](handleError(_0x53aa66,null));};exports[_0xb821('0x41')]=function(_0x1548d7,_0x5dfce){var _0x493e97={'raw':!![],'where':{'id':_0x1548d7[_0xb821('0x42')]['id']}},_0xf32906={};_0xf32906[_0xb821('0x2d')]=_[_0xb821('0x2f')](db[_0xb821('0x29')][_0xb821('0x2a')]);_0xf32906[_0xb821('0x2e')]=_[_0xb821('0x2f')](_0x1548d7['query']);_0xf32906[_0xb821('0x30')]=_[_0xb821('0x31')](_0xf32906[_0xb821('0x2d')],_0xf32906['query']);_0x493e97['attributes']=_[_0xb821('0x31')](_0xf32906[_0xb821('0x2d')],qs['fields'](_0x1548d7['query']['fields']));_0x493e97['attributes']=_0x493e97['attributes'][_0xb821('0x34')]?_0x493e97[_0xb821('0x32')]:_0xf32906['model'];if(_0x1548d7[_0xb821('0x2e')][_0xb821('0x43')]){_0x493e97[_0xb821('0x44')]=[{'all':!![]}];}_0x493e97=_[_0xb821('0x3c')]({},_0x493e97,_0x1548d7[_0xb821('0x45')]);return db['SquareRecording'][_0xb821('0x46')](_0x493e97)[_0xb821('0x21')](handleEntityNotFound(_0x5dfce,null))[_0xb821('0x21')](respondWithResult(_0x5dfce,null))[_0xb821('0x40')](handleError(_0x5dfce,null));};exports[_0xb821('0x47')]=function(_0x42fe52,_0x4b7b66){return db[_0xb821('0x29')][_0xb821('0x47')](_0x42fe52[_0xb821('0x48')],{})[_0xb821('0x21')](respondWithResult(_0x4b7b66,0xc9))[_0xb821('0x40')](handleError(_0x4b7b66,null));};exports[_0xb821('0x49')]=function(_0x2ee970,_0x5cbda9){if(_0x2ee970[_0xb821('0x48')]['id']){delete _0x2ee970['body']['id'];}return db[_0xb821('0x29')][_0xb821('0x46')]({'where':{'id':_0x2ee970[_0xb821('0x42')]['id']}})[_0xb821('0x21')](handleEntityNotFound(_0x5cbda9,null))[_0xb821('0x21')](saveUpdates(_0x2ee970[_0xb821('0x48')],null))[_0xb821('0x21')](respondWithResult(_0x5cbda9,null))[_0xb821('0x40')](handleError(_0x5cbda9,null));};exports[_0xb821('0x4a')]=function(_0x81c458,_0x2ffd8d,_0x16b54f){var _0x23fa5b=require(_0xb821('0x4b'));var _0x9c98a7=![];var _0x1b2ba6={};if(_0x81c458['query'][_0xb821('0x2b')]&&_0x81c458[_0xb821('0x2e')][_0xb821('0x2b')]===_0xb821('0x4c')){_0x1b2ba6[_0xb821('0x4c')]=_0x81c458['params']['id'];}else{_0x1b2ba6['id']=_0x81c458['params']['id'];}return db[_0xb821('0x29')][_0xb821('0x46')]({'where':_0x1b2ba6,'attributes':['id','savePath',_0xb821('0x4d')],'raw':!![]})[_0xb821('0x21')](handleEntityNotFound(_0x2ffd8d,null))['then'](function(_0xc38ca2){if(_0xc38ca2){var _0xcf6b58=_0xc38ca2[_0xb821('0x4e')];var _0x406822=util[_0xb821('0x4f')](_0xb821('0x50'),_0xcf6b58);if(fs[_0xb821('0x51')](_0x406822)){_0x9c98a7=!![];return _0x23fa5b[_0xb821('0x52')](_0x406822,_0xcf6b58,config['secrets'][_0xb821('0x53')])[_0xb821('0x21')](function(){return _0xc38ca2;});}return _0xc38ca2;}})[_0xb821('0x21')](function(_0x109a77){if(_0x109a77){var _0x274fca=_0x109a77['savePath'];if(!fs[_0xb821('0x51')](_0x274fca)){throw new db[(_0xb821('0x54'))][(_0xb821('0x55'))](_0xb821('0x56'));}if(_0x109a77[_0xb821('0x4d')]){return _0x2ffd8d['download'](_0x274fca,_0x109a77[_0xb821('0x4d')]+path[_0xb821('0x57')](_0x274fca),function(){if(_0x9c98a7){fs[_0xb821('0x58')](_0x274fca);}});}else{return _0x2ffd8d[_0xb821('0x4a')](_0x274fca,function(_0x517606){if(_0x9c98a7){fs[_0xb821('0x58')](_0x274fca);}});}}})[_0xb821('0x40')](function(_0xac5c07){if(_0xac5c07[_0xb821('0x59')]===_0xb821('0x56')){_0x2ffd8d['status'](0x194)['send'](_0xb821('0x5a'));}else{return handleError(_0x2ffd8d,null);}});};exports['destroy']=function(_0x506bc4,_0x43cb2b){return db[_0xb821('0x29')][_0xb821('0x46')]({'where':{'id':_0x506bc4[_0xb821('0x42')]['id']}})[_0xb821('0x21')](function(_0x4d1772){if(_[_0xb821('0x5b')](_0x4d1772)){throw new ReferenceError(_0xb821('0x5c'));}return _0x4d1772;})[_0xb821('0x21')](function(_0x40a7ba){var _0xcf2860=_0x40a7ba['savePath'];logger[_0xb821('0x5d')](_0xb821('0x5e'),_0xcf2860);if(!_['isNil'](_0x40a7ba['savePath'])&&fs[_0xb821('0x51')](_0xcf2860)){logger['info']('File:\x20\x22'+_0xcf2860+_0xb821('0x5f'));fs[_0xb821('0x60')](_0xcf2860);}_0xcf2860=_0xcf2860+_0xb821('0x61');if(!_['isNil'](_0x40a7ba['savePath'])&&fs[_0xb821('0x51')](_0xcf2860)){logger[_0xb821('0x5d')](_0xb821('0x62')+_0xcf2860+_0xb821('0x5f'));fs[_0xb821('0x60')](_0xcf2860);}return _0x40a7ba;})['then'](function(_0x1ddb2f){if(!_0x1ddb2f)throw new InternalError();return _0x1ddb2f['destroy']();})['then'](function(){_0x43cb2b['status'](0xcc)[_0xb821('0x17')]();})['catch'](handleError(_0x43cb2b,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 0b52180..d62e47f 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 _0xf963=['../../config/environment','./squareRecording.attributes','define','SquareRecording','square_recordings','lodash','api','moment','path','rimraf'];(function(_0x585ab9,_0x599828){var _0x544b7d=function(_0x46b062){while(--_0x46b062){_0x585ab9['push'](_0x585ab9['shift']());}};_0x544b7d(++_0x599828);}(_0xf963,0x11d));var _0x3f96=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0xf963[_0x2d7f0e];return _0x110b07;};'use strict';var _=require(_0x3f96('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3f96('0x1'));var moment=require(_0x3f96('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3f96('0x3'));var rimraf=require(_0x3f96('0x4'));var config=require(_0x3f96('0x5'));var attributes=require(_0x3f96('0x6'));module['exports']=function(_0x2ecae8,_0x56c663){return _0x2ecae8[_0x3f96('0x7')](_0x3f96('0x8'),attributes,{'tableName':_0x3f96('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc029=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareRecording.attributes','exports','define','SquareRecording','square_recordings','lodash'];(function(_0x129edf,_0xfa7302){var _0x70563a=function(_0x549205){while(--_0x549205){_0x129edf['push'](_0x129edf['shift']());}};_0x70563a(++_0xfa7302);}(_0xc029,0x1df));var _0x9c02=function(_0x11dc4d,_0x45f353){_0x11dc4d=_0x11dc4d-0x0;var _0x125d12=_0xc029[_0x11dc4d];return _0x125d12;};'use strict';var _=require(_0x9c02('0x0'));var util=require(_0x9c02('0x1'));var logger=require(_0x9c02('0x2'))(_0x9c02('0x3'));var moment=require(_0x9c02('0x4'));var BPromise=require(_0x9c02('0x5'));var rp=require(_0x9c02('0x6'));var fs=require('fs');var path=require(_0x9c02('0x7'));var rimraf=require(_0x9c02('0x8'));var config=require(_0x9c02('0x9'));var attributes=require(_0x9c02('0xa'));module[_0x9c02('0xb')]=function(_0x18792d,_0x14c7f8){return _0x18792d[_0x9c02('0xc')](_0x9c02('0xd'),attributes,{'tableName':_0x9c02('0xe'),'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 10db5f8..b556b79 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 _0x1f83=['../../config/logger','rpc','../../config/environment','jayson/promise','client','SquareRecording,\x20%s,\x20%s','debug','SquareRecording,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','SquareRecording','create','body','options','then','info','CreateSquareRecording','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x4477c8,_0xf32123){var _0x17ee51=function(_0xf091ca){while(--_0xf091ca){_0x4477c8['push'](_0x4477c8['shift']());}};_0x17ee51(++_0xf32123);}(_0x1f83,0x1ce));var _0x31f8=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x1f83[_0x4b369d];return _0x571a98;};'use strict';var _=require('lodash');var util=require(_0x31f8('0x0'));var moment=require(_0x31f8('0x1'));var BPromise=require(_0x31f8('0x2'));var rs=require(_0x31f8('0x3'));var fs=require('fs');var Redis=require(_0x31f8('0x4'));var db=require(_0x31f8('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x31f8('0x6'))(_0x31f8('0x7'));var config=require(_0x31f8('0x8'));var jayson=require(_0x31f8('0x9'));var client=jayson[_0x31f8('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1cc47b,_0x313e17,_0x565b77){return new BPromise(function(_0x422fed,_0x574677){return client['request'](_0x1cc47b,_0x565b77)['then'](function(_0x52b2fe){logger['info'](_0x31f8('0xb'),_0x313e17,'request\x20sent');logger[_0x31f8('0xc')](_0x31f8('0xd'),_0x313e17,_0x31f8('0xe'),JSON['stringify'](_0x52b2fe));if(_0x52b2fe[_0x31f8('0xf')]){if(_0x52b2fe[_0x31f8('0xf')][_0x31f8('0x10')]===0x1f4){logger[_0x31f8('0xf')](_0x31f8('0xb'),_0x313e17,_0x52b2fe[_0x31f8('0xf')][_0x31f8('0x11')]);return _0x574677(_0x52b2fe[_0x31f8('0xf')][_0x31f8('0x11')]);}logger['error'](_0x31f8('0xb'),_0x313e17,_0x52b2fe[_0x31f8('0xf')]['message']);return _0x422fed(_0x52b2fe[_0x31f8('0xf')][_0x31f8('0x11')]);}else{logger['info']('SquareRecording,\x20%s,\x20%s',_0x313e17,'request\x20sent');_0x422fed(_0x52b2fe['result'][_0x31f8('0x11')]);}})[_0x31f8('0x12')](function(_0x1eb9f8){logger[_0x31f8('0xf')]('SquareRecording,\x20%s,\x20%s',_0x313e17,_0x1eb9f8);_0x574677(_0x1eb9f8);});});}exports['CreateSquareRecording']=function(_0x29fd66){var _0x24fa2b=this;return new Promise(function(_0x5bbaa9,_0x53e1ce){return db[_0x31f8('0x13')][_0x31f8('0x14')](_0x29fd66[_0x31f8('0x15')],{'raw':_0x29fd66[_0x31f8('0x16')]?_0x29fd66['options']['raw']===undefined?!![]:![]:!![]})[_0x31f8('0x17')](function(_0x473df6){logger[_0x31f8('0x18')](_0x31f8('0x19'),_0x29fd66);logger['debug'](_0x31f8('0x19'),_0x29fd66,JSON['stringify'](_0x473df6));_0x5bbaa9(_0x473df6);})[_0x31f8('0x12')](function(_0x2a7af7){logger[_0x31f8('0xf')](_0x31f8('0x19'),_0x2a7af7[_0x31f8('0x11')],_0x29fd66);_0x53e1ce(_0x24fa2b[_0x31f8('0xf')](0x1f4,_0x2a7af7['message']));});});}; \ No newline at end of file +var _0x70c1=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','SquareRecording,\x20%s,\x20%s','debug','SquareRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','CreateSquareRecording','SquareRecording','create','options','then'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x70c1,0x11e));var _0x170c=function(_0x41e435,_0x3dfb2a){_0x41e435=_0x41e435-0x0;var _0x26f689=_0x70c1[_0x41e435];return _0x26f689;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x170c('0x0'));var BPromise=require(_0x170c('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x170c('0x2'));var db=require(_0x170c('0x3'))['db'];var utils=require(_0x170c('0x4'));var logger=require(_0x170c('0x5'))(_0x170c('0x6'));var config=require(_0x170c('0x7'));var jayson=require(_0x170c('0x8'));var client=jayson['client'][_0x170c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x41a4af,_0x4264a1,_0x585b09){return new BPromise(function(_0x34df7b,_0x18df28){return client[_0x170c('0xa')](_0x41a4af,_0x585b09)['then'](function(_0x445720){logger[_0x170c('0xb')](_0x170c('0xc'),_0x4264a1,'request\x20sent');logger[_0x170c('0xd')](_0x170c('0xe'),_0x4264a1,_0x170c('0xf'),JSON[_0x170c('0x10')](_0x445720));if(_0x445720[_0x170c('0x11')]){if(_0x445720[_0x170c('0x11')]['code']===0x1f4){logger[_0x170c('0x11')](_0x170c('0xc'),_0x4264a1,_0x445720[_0x170c('0x11')][_0x170c('0x12')]);return _0x18df28(_0x445720[_0x170c('0x11')][_0x170c('0x12')]);}logger['error'](_0x170c('0xc'),_0x4264a1,_0x445720[_0x170c('0x11')][_0x170c('0x12')]);return _0x34df7b(_0x445720[_0x170c('0x11')][_0x170c('0x12')]);}else{logger[_0x170c('0xb')]('SquareRecording,\x20%s,\x20%s',_0x4264a1,_0x170c('0xf'));_0x34df7b(_0x445720[_0x170c('0x13')][_0x170c('0x12')]);}})[_0x170c('0x14')](function(_0x67ff01){logger[_0x170c('0x11')](_0x170c('0xc'),_0x4264a1,_0x67ff01);_0x18df28(_0x67ff01);});});}exports[_0x170c('0x15')]=function(_0x51ca7c){var _0x2025eb=this;return new Promise(function(_0x1e3a4f,_0x4205ed){return db[_0x170c('0x16')][_0x170c('0x17')](_0x51ca7c['body'],{'raw':_0x51ca7c[_0x170c('0x18')]?_0x51ca7c[_0x170c('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x170c('0x19')](function(_0x4998fb){logger['info'](_0x170c('0x15'),_0x51ca7c);logger[_0x170c('0xd')](_0x170c('0x15'),_0x51ca7c,JSON[_0x170c('0x10')](_0x4998fb));_0x1e3a4f(_0x4998fb);})[_0x170c('0x14')](function(_0x3607f6){logger[_0x170c('0x11')](_0x170c('0x15'),_0x3607f6['message'],_0x51ca7c);_0x4205ed(_0x2025eb['error'](0x1f4,_0x3607f6[_0x170c('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index b3ec4a2..4ed3ae6 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(_0x3b56c0,_0xe100d8){var _0x377efe=function(_0x181589){while(--_0x181589){_0x3b56c0['push'](_0x3b56c0['shift']());}};_0x377efe(++_0xe100d8);}(_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('./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 _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(_0x36cd93,_0x593481){var _0x10f6cd=function(_0x1c3aa3){while(--_0x1c3aa3){_0x36cd93['push'](_0x36cd93['shift']());}};_0x10f6cd(++_0x593481);}(_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('./squareReport.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index c740c8a..4273179 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 _0x2e82=['exports','STRING','DATE','BOOLEAN','sequelize'];(function(_0x21338f,_0x28ba94){var _0x56359b=function(_0x1ac767){while(--_0x1ac767){_0x21338f['push'](_0x21338f['shift']());}};_0x56359b(++_0x28ba94);}(_0x2e82,0x77));var _0x22e8=function(_0x54538a,_0x36fda4){_0x54538a=_0x54538a-0x0;var _0xbf3f79=_0x2e82[_0x54538a];return _0xbf3f79;};'use strict';var Sequelize=require(_0x22e8('0x0'));module[_0x22e8('0x1')]={'network':{'type':Sequelize[_0x22e8('0x2')]},'network_script':{'type':Sequelize[_0x22e8('0x2')]},'request':{'type':Sequelize[_0x22e8('0x2')]},'channel':{'type':Sequelize[_0x22e8('0x2')]},'language':{'type':Sequelize[_0x22e8('0x2')]},'type':{'type':Sequelize[_0x22e8('0x2')]},'uniqueid':{'type':Sequelize[_0x22e8('0x2')]},'version':{'type':Sequelize[_0x22e8('0x2')]},'callerid':{'type':Sequelize[_0x22e8('0x2')]},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize[_0x22e8('0x2')]},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize[_0x22e8('0x2')]},'callingtns':{'type':Sequelize[_0x22e8('0x2')]},'dnid':{'type':Sequelize[_0x22e8('0x2')]},'rdnis':{'type':Sequelize[_0x22e8('0x2')]},'context':{'type':Sequelize[_0x22e8('0x2')]},'extension':{'type':Sequelize[_0x22e8('0x2')]},'priority':{'type':Sequelize[_0x22e8('0x2')]},'enhanced':{'type':Sequelize[_0x22e8('0x2')]},'accountcode':{'type':Sequelize[_0x22e8('0x2')]},'threadid':{'type':Sequelize[_0x22e8('0x2')]},'project_name':{'type':Sequelize[_0x22e8('0x2')]},'joinAt':{'type':Sequelize[_0x22e8('0x3')]},'leaveAt':{'type':Sequelize[_0x22e8('0x3')]},'bot':{'type':Sequelize[_0x22e8('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0xeb8d=['DATE','BOOLEAN','sequelize','exports','STRING'];(function(_0x47fd36,_0x41535d){var _0x21a0fc=function(_0x44c07c){while(--_0x44c07c){_0x47fd36['push'](_0x47fd36['shift']());}};_0x21a0fc(++_0x41535d);}(_0xeb8d,0x89));var _0xdeb8=function(_0x2a863f,_0x3e7a74){_0x2a863f=_0x2a863f-0x0;var _0x525dac=_0xeb8d[_0x2a863f];return _0x525dac;};'use strict';var Sequelize=require(_0xdeb8('0x0'));module[_0xdeb8('0x1')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize[_0xdeb8('0x2')]},'channel':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xdeb8('0x2')]},'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xdeb8('0x2')]},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xdeb8('0x2')]},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize[_0xdeb8('0x2')]},'callingani2':{'type':Sequelize[_0xdeb8('0x2')]},'callington':{'type':Sequelize[_0xdeb8('0x2')]},'callingtns':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0xdeb8('0x2')]},'rdnis':{'type':Sequelize[_0xdeb8('0x2')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0xdeb8('0x2')]},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize[_0xdeb8('0x2')]},'accountcode':{'type':Sequelize[_0xdeb8('0x2')]},'threadid':{'type':Sequelize[_0xdeb8('0x2')]},'project_name':{'type':Sequelize[_0xdeb8('0x2')]},'joinAt':{'type':Sequelize[_0xdeb8('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize[_0xdeb8('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 efe2cba..8a8b88a 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 _0xec98=['destroy','error','stack','name','send','index','map','SquareReport','rawAttributes','fieldName','key','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','type','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','update','then'];(function(_0x132a67,_0x168ddb){var _0x587281=function(_0x1a0bfa){while(--_0x1a0bfa){_0x132a67['push'](_0x132a67['shift']());}};_0x587281(++_0x168ddb);}(_0xec98,0xc4));var _0x8ec9=function(_0x4ceed7,_0x1f4875){_0x4ceed7=_0x4ceed7-0x0;var _0x45953a=_0xec98[_0x4ceed7];return _0x45953a;};'use strict';var emlformat=require(_0x8ec9('0x0'));var rimraf=require(_0x8ec9('0x1'));var zipdir=require(_0x8ec9('0x2'));var jsonpatch=require(_0x8ec9('0x3'));var rp=require(_0x8ec9('0x4'));var moment=require('moment');var BPromise=require(_0x8ec9('0x5'));var Mustache=require('mustache');var util=require(_0x8ec9('0x6'));var path=require(_0x8ec9('0x7'));var sox=require(_0x8ec9('0x8'));var csv=require(_0x8ec9('0x9'));var ejs=require(_0x8ec9('0xa'));var fs=require('fs');var fs_extra=require(_0x8ec9('0xb'));var _=require(_0x8ec9('0xc'));var squel=require(_0x8ec9('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8ec9('0xe'));var toCsv=require('to-csv');var querystring=require(_0x8ec9('0xf'));var Papa=require(_0x8ec9('0x10'));var Redis=require(_0x8ec9('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x8ec9('0x12'));var as=require(_0x8ec9('0x13'));var hardwareService=require(_0x8ec9('0x14'));var logger=require(_0x8ec9('0x15'))('api');var utils=require(_0x8ec9('0x16'));var config=require(_0x8ec9('0x17'));var licenseUtil=require(_0x8ec9('0x18'));var db=require(_0x8ec9('0x19'))['db'];function respondWithStatusCode(_0x4f1368,_0x144be2){_0x144be2=_0x144be2||0xcc;return function(_0x2d463b){if(_0x2d463b){return _0x4f1368[_0x8ec9('0x1a')](_0x144be2);}return _0x4f1368[_0x8ec9('0x1b')](_0x144be2)[_0x8ec9('0x1c')]();};}function respondWithResult(_0x5ed9a0,_0x38610e){_0x38610e=_0x38610e||0xc8;return function(_0x4a18d1){if(_0x4a18d1){return _0x5ed9a0['status'](_0x38610e)[_0x8ec9('0x1d')](_0x4a18d1);}};}function respondWithFilteredResult(_0x23faec,_0x928bc){return function(_0x1d9a08){if(_0x1d9a08){var _0x97aa51=typeof _0x928bc[_0x8ec9('0x1e')]==='undefined'&&typeof _0x928bc[_0x8ec9('0x1f')]===_0x8ec9('0x20');var _0x4cf269=_0x1d9a08[_0x8ec9('0x21')];var _0x281a9d=_0x97aa51?0x0:_0x928bc[_0x8ec9('0x1e')];var _0xfd4ba=_0x97aa51?_0x1d9a08[_0x8ec9('0x21')]:_0x928bc[_0x8ec9('0x1e')]+_0x928bc['limit'];var _0x3beade;if(_0xfd4ba>=_0x4cf269){_0xfd4ba=_0x4cf269;_0x3beade=0xc8;}else{_0x3beade=0xce;}_0x23faec['status'](_0x3beade);return _0x23faec[_0x8ec9('0x22')](_0x8ec9('0x23'),_0x281a9d+'-'+_0xfd4ba+'/'+_0x4cf269)[_0x8ec9('0x1d')](_0x1d9a08);}return null;};}function patchUpdates(_0x1c0ced){return function(_0x35ae58){try{jsonpatch['apply'](_0x35ae58,_0x1c0ced,!![]);}catch(_0x51a8b1){return BPromise['reject'](_0x51a8b1);}return _0x35ae58['save']();};}function saveUpdates(_0x17681c,_0x4b6435){return function(_0x51b4fa){if(_0x51b4fa){return _0x51b4fa[_0x8ec9('0x24')](_0x17681c)[_0x8ec9('0x25')](function(_0x3870f5){return _0x3870f5;});}return null;};}function removeEntity(_0x5a8f36,_0x217d71){return function(_0x453497){if(_0x453497){return _0x453497[_0x8ec9('0x26')]()[_0x8ec9('0x25')](function(){_0x5a8f36[_0x8ec9('0x1b')](0xcc)[_0x8ec9('0x1c')]();});}};}function handleEntityNotFound(_0x375550,_0x1af328){return function(_0x374483){if(!_0x374483){_0x375550['sendStatus'](0x194);}return _0x374483;};}function handleError(_0x5d905a,_0x422466){_0x422466=_0x422466||0x1f4;return function(_0x45a3bf){logger[_0x8ec9('0x27')](_0x45a3bf[_0x8ec9('0x28')]);if(_0x45a3bf[_0x8ec9('0x29')]){delete _0x45a3bf[_0x8ec9('0x29')];}_0x5d905a[_0x8ec9('0x1b')](_0x422466)[_0x8ec9('0x2a')](_0x45a3bf);};}exports[_0x8ec9('0x2b')]=function(_0x58dbfe,_0x359726){var _0x50e4fc={},_0x2dbc31={},_0x43511a={'count':0x0,'rows':[]};var _0x58fb3d=_[_0x8ec9('0x2c')](db[_0x8ec9('0x2d')][_0x8ec9('0x2e')],function(_0x275250){return{'name':_0x275250[_0x8ec9('0x2f')],'type':_0x275250['type'][_0x8ec9('0x30')]};});_0x2dbc31[_0x8ec9('0x31')]=_[_0x8ec9('0x2c')](_0x58fb3d,_0x8ec9('0x29'));_0x2dbc31['query']=_[_0x8ec9('0x32')](_0x58dbfe[_0x8ec9('0x33')]);_0x2dbc31['filters']=_[_0x8ec9('0x34')](_0x2dbc31[_0x8ec9('0x31')],_0x2dbc31[_0x8ec9('0x33')]);_0x50e4fc['attributes']=_['intersection'](_0x2dbc31[_0x8ec9('0x31')],qs[_0x8ec9('0x35')](_0x58dbfe[_0x8ec9('0x33')][_0x8ec9('0x35')]));_0x50e4fc['attributes']=_0x50e4fc[_0x8ec9('0x36')][_0x8ec9('0x37')]?_0x50e4fc['attributes']:_0x2dbc31[_0x8ec9('0x31')];if(!_0x58dbfe[_0x8ec9('0x33')][_0x8ec9('0x38')](_0x8ec9('0x39'))){_0x50e4fc[_0x8ec9('0x1f')]=qs[_0x8ec9('0x1f')](_0x58dbfe['query'][_0x8ec9('0x1f')]);_0x50e4fc[_0x8ec9('0x1e')]=qs[_0x8ec9('0x1e')](_0x58dbfe['query'][_0x8ec9('0x1e')]);}_0x50e4fc[_0x8ec9('0x3a')]=qs['sort'](_0x58dbfe[_0x8ec9('0x33')][_0x8ec9('0x3b')]);_0x50e4fc[_0x8ec9('0x3c')]=qs[_0x8ec9('0x3d')](_[_0x8ec9('0x3e')](_0x58dbfe[_0x8ec9('0x33')],_0x2dbc31[_0x8ec9('0x3d')]),_0x58fb3d);if(_0x58dbfe[_0x8ec9('0x33')][_0x8ec9('0x3f')]){_0x50e4fc[_0x8ec9('0x3c')]=_['merge'](_0x50e4fc[_0x8ec9('0x3c')],{'$or':_[_0x8ec9('0x2c')](_0x58fb3d,function(_0x4e071c){if(_0x4e071c[_0x8ec9('0x40')]!=='VIRTUAL'){var _0x3ec6db={};_0x3ec6db[_0x4e071c[_0x8ec9('0x29')]]={'$like':'%'+_0x58dbfe[_0x8ec9('0x33')][_0x8ec9('0x3f')]+'%'};return _0x3ec6db;}})});}_0x50e4fc=_[_0x8ec9('0x41')]({},_0x50e4fc,_0x58dbfe[_0x8ec9('0x42')]);var _0x310f41={'where':_0x50e4fc[_0x8ec9('0x3c')]};return db[_0x8ec9('0x2d')][_0x8ec9('0x21')](_0x310f41)[_0x8ec9('0x25')](function(_0x32f783){_0x43511a['count']=_0x32f783;if(_0x58dbfe[_0x8ec9('0x33')][_0x8ec9('0x43')]){_0x50e4fc[_0x8ec9('0x44')]=[{'all':!![]}];}return db[_0x8ec9('0x2d')][_0x8ec9('0x45')](_0x50e4fc);})['then'](function(_0x512ec2){_0x43511a[_0x8ec9('0x46')]=_0x512ec2;return _0x43511a;})[_0x8ec9('0x25')](respondWithFilteredResult(_0x359726,_0x50e4fc))[_0x8ec9('0x47')](handleError(_0x359726,null));};exports[_0x8ec9('0x48')]=function(_0x2a2751,_0x1ab862){var _0x105a00={'raw':!![],'where':{'id':_0x2a2751[_0x8ec9('0x49')]['id']}},_0x4ba656={};_0x4ba656[_0x8ec9('0x31')]=_[_0x8ec9('0x32')](db['SquareReport']['rawAttributes']);_0x4ba656[_0x8ec9('0x33')]=_['keys'](_0x2a2751[_0x8ec9('0x33')]);_0x4ba656['filters']=_[_0x8ec9('0x34')](_0x4ba656[_0x8ec9('0x31')],_0x4ba656[_0x8ec9('0x33')]);_0x105a00[_0x8ec9('0x36')]=_[_0x8ec9('0x34')](_0x4ba656['model'],qs[_0x8ec9('0x35')](_0x2a2751[_0x8ec9('0x33')][_0x8ec9('0x35')]));_0x105a00['attributes']=_0x105a00[_0x8ec9('0x36')][_0x8ec9('0x37')]?_0x105a00[_0x8ec9('0x36')]:_0x4ba656[_0x8ec9('0x31')];if(_0x2a2751[_0x8ec9('0x33')][_0x8ec9('0x43')]){_0x105a00['include']=[{'all':!![]}];}_0x105a00=_[_0x8ec9('0x41')]({},_0x105a00,_0x2a2751[_0x8ec9('0x42')]);return db[_0x8ec9('0x2d')][_0x8ec9('0x4a')](_0x105a00)[_0x8ec9('0x25')](handleEntityNotFound(_0x1ab862,null))[_0x8ec9('0x25')](respondWithResult(_0x1ab862,null))[_0x8ec9('0x47')](handleError(_0x1ab862,null));};exports[_0x8ec9('0x4b')]=function(_0x3b0fc0,_0x2f0529){return db[_0x8ec9('0x2d')]['create'](_0x3b0fc0[_0x8ec9('0x4c')],{})[_0x8ec9('0x25')](respondWithResult(_0x2f0529,0xc9))['catch'](handleError(_0x2f0529,null));};exports['update']=function(_0x53ce3d,_0xf64a22){if(_0x53ce3d[_0x8ec9('0x4c')]['id']){delete _0x53ce3d[_0x8ec9('0x4c')]['id'];}return db['SquareReport'][_0x8ec9('0x4a')]({'where':{'id':_0x53ce3d[_0x8ec9('0x49')]['id']}})[_0x8ec9('0x25')](handleEntityNotFound(_0xf64a22,null))[_0x8ec9('0x25')](saveUpdates(_0x53ce3d[_0x8ec9('0x4c')],null))[_0x8ec9('0x25')](respondWithResult(_0xf64a22,null))[_0x8ec9('0x47')](handleError(_0xf64a22,null));};exports[_0x8ec9('0x26')]=function(_0x36376f,_0x656030){return db['SquareReport']['find']({'where':{'id':_0x36376f['params']['id']}})[_0x8ec9('0x25')](handleEntityNotFound(_0x656030,null))[_0x8ec9('0x25')](removeEntity(_0x656030,null))[_0x8ec9('0x47')](handleError(_0x656030,null));};exports[_0x8ec9('0x4d')]=function(_0x150b05,_0x54ed17){return db['SquareReport'][_0x8ec9('0x4d')]()[_0x8ec9('0x25')](respondWithResult(_0x54ed17,null))[_0x8ec9('0x47')](handleError(_0x54ed17,null));}; \ No newline at end of file +var _0x05ca=['send','index','map','SquareReport','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','rawAttributes','body','update','find','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','destroy','error','name'];(function(_0x41fe28,_0x5dfbad){var _0x190689=function(_0x35b203){while(--_0x35b203){_0x41fe28['push'](_0x41fe28['shift']());}};_0x190689(++_0x5dfbad);}(_0x05ca,0x199));var _0xa05c=function(_0x10ac4c,_0x137e61){_0x10ac4c=_0x10ac4c-0x0;var _0x56d383=_0x05ca[_0x10ac4c];return _0x56d383;};'use strict';var emlformat=require(_0xa05c('0x0'));var rimraf=require(_0xa05c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa05c('0x2'));var rp=require(_0xa05c('0x3'));var moment=require(_0xa05c('0x4'));var BPromise=require(_0xa05c('0x5'));var Mustache=require(_0xa05c('0x6'));var util=require(_0xa05c('0x7'));var path=require('path');var sox=require(_0xa05c('0x8'));var csv=require(_0xa05c('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa05c('0xa'));var _=require(_0xa05c('0xb'));var squel=require(_0xa05c('0xc'));var crypto=require(_0xa05c('0xd'));var jsforce=require(_0xa05c('0xe'));var deskjs=require(_0xa05c('0xf'));var toCsv=require(_0xa05c('0x9'));var querystring=require(_0xa05c('0x10'));var Papa=require(_0xa05c('0x11'));var Redis=require(_0xa05c('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa05c('0x13'));var hardwareService=require(_0xa05c('0x14'));var logger=require(_0xa05c('0x15'))('api');var utils=require(_0xa05c('0x16'));var config=require(_0xa05c('0x17'));var licenseUtil=require(_0xa05c('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xfdd0ac,_0x16b2b7){_0x16b2b7=_0x16b2b7||0xcc;return function(_0xbb9381){if(_0xbb9381){return _0xfdd0ac[_0xa05c('0x19')](_0x16b2b7);}return _0xfdd0ac[_0xa05c('0x1a')](_0x16b2b7)[_0xa05c('0x1b')]();};}function respondWithResult(_0x253d27,_0x26dd6d){_0x26dd6d=_0x26dd6d||0xc8;return function(_0x19d7f1){if(_0x19d7f1){return _0x253d27['status'](_0x26dd6d)[_0xa05c('0x1c')](_0x19d7f1);}};}function respondWithFilteredResult(_0x545411,_0x2628b5){return function(_0x5ac284){if(_0x5ac284){var _0x269aeb=typeof _0x2628b5[_0xa05c('0x1d')]===_0xa05c('0x1e')&&typeof _0x2628b5[_0xa05c('0x1f')]===_0xa05c('0x1e');var _0x696316=_0x5ac284[_0xa05c('0x20')];var _0x33ddd3=_0x269aeb?0x0:_0x2628b5[_0xa05c('0x1d')];var _0xab62ac=_0x269aeb?_0x5ac284[_0xa05c('0x20')]:_0x2628b5[_0xa05c('0x1d')]+_0x2628b5['limit'];var _0x279600;if(_0xab62ac>=_0x696316){_0xab62ac=_0x696316;_0x279600=0xc8;}else{_0x279600=0xce;}_0x545411['status'](_0x279600);return _0x545411[_0xa05c('0x21')](_0xa05c('0x22'),_0x33ddd3+'-'+_0xab62ac+'/'+_0x696316)['json'](_0x5ac284);}return null;};}function patchUpdates(_0x48620d){return function(_0x52dc4e){try{jsonpatch['apply'](_0x52dc4e,_0x48620d,!![]);}catch(_0x249aa1){return BPromise[_0xa05c('0x23')](_0x249aa1);}return _0x52dc4e[_0xa05c('0x24')]();};}function saveUpdates(_0xb5fc3c,_0x18493a){return function(_0x3e3e8b){if(_0x3e3e8b){return _0x3e3e8b['update'](_0xb5fc3c)[_0xa05c('0x25')](function(_0x16b832){return _0x16b832;});}return null;};}function removeEntity(_0xc0720e,_0x516b8b){return function(_0x15281b){if(_0x15281b){return _0x15281b[_0xa05c('0x26')]()[_0xa05c('0x25')](function(){_0xc0720e[_0xa05c('0x1a')](0xcc)[_0xa05c('0x1b')]();});}};}function handleEntityNotFound(_0x4021f5,_0x4132ed){return function(_0x44b204){if(!_0x44b204){_0x4021f5[_0xa05c('0x19')](0x194);}return _0x44b204;};}function handleError(_0xd3587d,_0x2bfb95){_0x2bfb95=_0x2bfb95||0x1f4;return function(_0x5ef299){logger[_0xa05c('0x27')](_0x5ef299['stack']);if(_0x5ef299[_0xa05c('0x28')]){delete _0x5ef299[_0xa05c('0x28')];}_0xd3587d[_0xa05c('0x1a')](_0x2bfb95)[_0xa05c('0x29')](_0x5ef299);};}exports[_0xa05c('0x2a')]=function(_0x4bc442,_0xb08dfc){var _0x5e2ecf={},_0x3351d4={},_0x107ad0={'count':0x0,'rows':[]};var _0x85f3db=_[_0xa05c('0x2b')](db[_0xa05c('0x2c')]['rawAttributes'],function(_0x5638d8){return{'name':_0x5638d8[_0xa05c('0x2d')],'type':_0x5638d8[_0xa05c('0x2e')][_0xa05c('0x2f')]};});_0x3351d4['model']=_[_0xa05c('0x2b')](_0x85f3db,'name');_0x3351d4['query']=_[_0xa05c('0x30')](_0x4bc442[_0xa05c('0x31')]);_0x3351d4[_0xa05c('0x32')]=_[_0xa05c('0x33')](_0x3351d4[_0xa05c('0x34')],_0x3351d4[_0xa05c('0x31')]);_0x5e2ecf[_0xa05c('0x35')]=_[_0xa05c('0x33')](_0x3351d4[_0xa05c('0x34')],qs[_0xa05c('0x36')](_0x4bc442[_0xa05c('0x31')][_0xa05c('0x36')]));_0x5e2ecf[_0xa05c('0x35')]=_0x5e2ecf[_0xa05c('0x35')][_0xa05c('0x37')]?_0x5e2ecf['attributes']:_0x3351d4['model'];if(!_0x4bc442[_0xa05c('0x31')]['hasOwnProperty'](_0xa05c('0x38'))){_0x5e2ecf[_0xa05c('0x1f')]=qs['limit'](_0x4bc442[_0xa05c('0x31')]['limit']);_0x5e2ecf[_0xa05c('0x1d')]=qs[_0xa05c('0x1d')](_0x4bc442[_0xa05c('0x31')]['offset']);}_0x5e2ecf['order']=qs[_0xa05c('0x39')](_0x4bc442[_0xa05c('0x31')]['sort']);_0x5e2ecf['where']=qs['filters'](_[_0xa05c('0x3a')](_0x4bc442[_0xa05c('0x31')],_0x3351d4[_0xa05c('0x32')]),_0x85f3db);if(_0x4bc442[_0xa05c('0x31')][_0xa05c('0x3b')]){_0x5e2ecf[_0xa05c('0x3c')]=_[_0xa05c('0x3d')](_0x5e2ecf['where'],{'$or':_[_0xa05c('0x2b')](_0x85f3db,function(_0x23458f){if(_0x23458f[_0xa05c('0x2e')]!==_0xa05c('0x3e')){var _0x383f28={};_0x383f28[_0x23458f[_0xa05c('0x28')]]={'$like':'%'+_0x4bc442[_0xa05c('0x31')][_0xa05c('0x3b')]+'%'};return _0x383f28;}})});}_0x5e2ecf=_[_0xa05c('0x3d')]({},_0x5e2ecf,_0x4bc442[_0xa05c('0x3f')]);var _0x432e8a={'where':_0x5e2ecf[_0xa05c('0x3c')]};return db['SquareReport'][_0xa05c('0x20')](_0x432e8a)[_0xa05c('0x25')](function(_0x10ef21){_0x107ad0['count']=_0x10ef21;if(_0x4bc442[_0xa05c('0x31')][_0xa05c('0x40')]){_0x5e2ecf[_0xa05c('0x41')]=[{'all':!![]}];}return db[_0xa05c('0x2c')][_0xa05c('0x42')](_0x5e2ecf);})[_0xa05c('0x25')](function(_0x29223b){_0x107ad0['rows']=_0x29223b;return _0x107ad0;})['then'](respondWithFilteredResult(_0xb08dfc,_0x5e2ecf))[_0xa05c('0x43')](handleError(_0xb08dfc,null));};exports[_0xa05c('0x44')]=function(_0x3f8140,_0x24fe4f){var _0x26ee38={'raw':!![],'where':{'id':_0x3f8140[_0xa05c('0x45')]['id']}},_0x1ad21a={};_0x1ad21a[_0xa05c('0x34')]=_[_0xa05c('0x30')](db[_0xa05c('0x2c')][_0xa05c('0x46')]);_0x1ad21a[_0xa05c('0x31')]=_['keys'](_0x3f8140['query']);_0x1ad21a[_0xa05c('0x32')]=_['intersection'](_0x1ad21a[_0xa05c('0x34')],_0x1ad21a[_0xa05c('0x31')]);_0x26ee38['attributes']=_[_0xa05c('0x33')](_0x1ad21a[_0xa05c('0x34')],qs[_0xa05c('0x36')](_0x3f8140['query']['fields']));_0x26ee38[_0xa05c('0x35')]=_0x26ee38[_0xa05c('0x35')][_0xa05c('0x37')]?_0x26ee38['attributes']:_0x1ad21a[_0xa05c('0x34')];if(_0x3f8140[_0xa05c('0x31')]['includeAll']){_0x26ee38['include']=[{'all':!![]}];}_0x26ee38=_[_0xa05c('0x3d')]({},_0x26ee38,_0x3f8140[_0xa05c('0x3f')]);return db[_0xa05c('0x2c')]['find'](_0x26ee38)['then'](handleEntityNotFound(_0x24fe4f,null))['then'](respondWithResult(_0x24fe4f,null))[_0xa05c('0x43')](handleError(_0x24fe4f,null));};exports['create']=function(_0xd2fde1,_0x144450){return db['SquareReport']['create'](_0xd2fde1[_0xa05c('0x47')],{})[_0xa05c('0x25')](respondWithResult(_0x144450,0xc9))[_0xa05c('0x43')](handleError(_0x144450,null));};exports[_0xa05c('0x48')]=function(_0x2c1594,_0x189aef){if(_0x2c1594[_0xa05c('0x47')]['id']){delete _0x2c1594[_0xa05c('0x47')]['id'];}return db['SquareReport']['find']({'where':{'id':_0x2c1594[_0xa05c('0x45')]['id']}})['then'](handleEntityNotFound(_0x189aef,null))[_0xa05c('0x25')](saveUpdates(_0x2c1594['body'],null))[_0xa05c('0x25')](respondWithResult(_0x189aef,null))[_0xa05c('0x43')](handleError(_0x189aef,null));};exports[_0xa05c('0x26')]=function(_0x54adc9,_0x48a5f5){return db[_0xa05c('0x2c')][_0xa05c('0x49')]({'where':{'id':_0x54adc9[_0xa05c('0x45')]['id']}})[_0xa05c('0x25')](handleEntityNotFound(_0x48a5f5,null))['then'](removeEntity(_0x48a5f5,null))[_0xa05c('0x43')](handleError(_0x48a5f5,null));};exports[_0xa05c('0x4a')]=function(_0x24bf55,_0xf66294){return db[_0xa05c('0x2c')]['describe']()[_0xa05c('0x25')](respondWithResult(_0xf66294,null))['catch'](handleError(_0xf66294,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 24e3898..107affc 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 _0xdc6d=['path','rimraf','./squareReport.attributes','exports','define','uid_pname','uniqueid','project_name','leaveAt','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x46740c,_0x4db040){var _0x59c290=function(_0x4cbea6){while(--_0x4cbea6){_0x46740c['push'](_0x46740c['shift']());}};_0x59c290(++_0x4db040);}(_0xdc6d,0x179));var _0xddc6=function(_0x41a58f,_0x44c016){_0x41a58f=_0x41a58f-0x0;var _0x4569b7=_0xdc6d[_0x41a58f];return _0x4569b7;};'use strict';var _=require(_0xddc6('0x0'));var util=require(_0xddc6('0x1'));var logger=require(_0xddc6('0x2'))(_0xddc6('0x3'));var moment=require(_0xddc6('0x4'));var BPromise=require(_0xddc6('0x5'));var rp=require(_0xddc6('0x6'));var fs=require('fs');var path=require(_0xddc6('0x7'));var rimraf=require(_0xddc6('0x8'));var config=require('../../config/environment');var attributes=require(_0xddc6('0x9'));module[_0xddc6('0xa')]=function(_0x173a17,_0x459194){return _0x173a17[_0xddc6('0xb')]('SquareReport',attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':_0xddc6('0xc'),'fields':[_0xddc6('0xd'),_0xddc6('0xe')]},{'name':'leaveAt','fields':[_0xddc6('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x71b7=['exports','define','SquareReport','uid_pname','uniqueid','leaveAt','../../config/logger','moment','bluebird','path','../../config/environment','./squareReport.attributes'];(function(_0x2b94d5,_0x3b8853){var _0x3217c0=function(_0x4720c2){while(--_0x4720c2){_0x2b94d5['push'](_0x2b94d5['shift']());}};_0x3217c0(++_0x3b8853);}(_0x71b7,0x1da));var _0x771b=function(_0x3d1244,_0x156028){_0x3d1244=_0x3d1244-0x0;var _0x5d6372=_0x71b7[_0x3d1244];return _0x5d6372;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x771b('0x0'))('api');var moment=require(_0x771b('0x1'));var BPromise=require(_0x771b('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x771b('0x3'));var rimraf=require('rimraf');var config=require(_0x771b('0x4'));var attributes=require(_0x771b('0x5'));module[_0x771b('0x6')]=function(_0xd05d6c,_0x48997c){return _0xd05d6c[_0x771b('0x7')](_0x771b('0x8'),attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':_0x771b('0x9'),'fields':[_0x771b('0xa'),'project_name']},{'name':_0x771b('0xb'),'fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index d9f9770..f66529b 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 _0x3da6=['raw','where','attributes','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','SquareReport,\x20%s,\x20%s','debug','SquareReport,\x20%s,\x20%s,\x20%s','error','code','message','info','request\x20sent','result','catch','CreateSquareReport','SquareReport','options','then','stringify','UpdateSquareReport','update','body'];(function(_0x57289d,_0x5db6fb){var _0x47e4ec=function(_0xcdb43){while(--_0xcdb43){_0x57289d['push'](_0x57289d['shift']());}};_0x47e4ec(++_0x5db6fb);}(_0x3da6,0x103));var _0x63da=function(_0x5d2207,_0x25c3db){_0x5d2207=_0x5d2207-0x0;var _0x3d320e=_0x3da6[_0x5d2207];return _0x3d320e;};'use strict';var _=require(_0x63da('0x0'));var util=require(_0x63da('0x1'));var moment=require('moment');var BPromise=require(_0x63da('0x2'));var rs=require(_0x63da('0x3'));var fs=require('fs');var Redis=require(_0x63da('0x4'));var db=require(_0x63da('0x5'))['db'];var utils=require(_0x63da('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x63da('0x7'));var jayson=require(_0x63da('0x8'));var client=jayson[_0x63da('0x9')][_0x63da('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5d9ca7,_0x306345,_0x46aa0e){return new BPromise(function(_0xdd3bea,_0x3f9344){return client['request'](_0x5d9ca7,_0x46aa0e)['then'](function(_0x5b95e8){logger['info'](_0x63da('0xb'),_0x306345,'request\x20sent');logger[_0x63da('0xc')](_0x63da('0xd'),_0x306345,'request\x20sent',JSON['stringify'](_0x5b95e8));if(_0x5b95e8['error']){if(_0x5b95e8[_0x63da('0xe')][_0x63da('0xf')]===0x1f4){logger[_0x63da('0xe')](_0x63da('0xb'),_0x306345,_0x5b95e8[_0x63da('0xe')][_0x63da('0x10')]);return _0x3f9344(_0x5b95e8['error'][_0x63da('0x10')]);}logger[_0x63da('0xe')](_0x63da('0xb'),_0x306345,_0x5b95e8[_0x63da('0xe')][_0x63da('0x10')]);return _0xdd3bea(_0x5b95e8[_0x63da('0xe')][_0x63da('0x10')]);}else{logger[_0x63da('0x11')](_0x63da('0xb'),_0x306345,_0x63da('0x12'));_0xdd3bea(_0x5b95e8[_0x63da('0x13')][_0x63da('0x10')]);}})[_0x63da('0x14')](function(_0xec85a4){logger[_0x63da('0xe')](_0x63da('0xb'),_0x306345,_0xec85a4);_0x3f9344(_0xec85a4);});});}exports[_0x63da('0x15')]=function(_0x4cabb3){var _0x1a9d84=this;return new Promise(function(_0x214ce1,_0x3bdf0f){return db[_0x63da('0x16')]['create'](_0x4cabb3['body'],{'raw':_0x4cabb3[_0x63da('0x17')]?_0x4cabb3[_0x63da('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x63da('0x18')](function(_0x444824){logger[_0x63da('0x11')](_0x63da('0x15'),_0x4cabb3);logger['debug'](_0x63da('0x15'),_0x4cabb3,JSON[_0x63da('0x19')](_0x444824));_0x214ce1(_0x444824);})[_0x63da('0x14')](function(_0x2f6018){logger[_0x63da('0xe')](_0x63da('0x15'),_0x2f6018['message'],_0x4cabb3);_0x3bdf0f(_0x1a9d84[_0x63da('0xe')](0x1f4,_0x2f6018[_0x63da('0x10')]));});});};exports[_0x63da('0x1a')]=function(_0x36c2f3){var _0x57dc71=this;return new Promise(function(_0x335482,_0x4915f6){return db[_0x63da('0x16')][_0x63da('0x1b')](_0x36c2f3[_0x63da('0x1c')],{'raw':_0x36c2f3[_0x63da('0x17')]?_0x36c2f3['options'][_0x63da('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x36c2f3[_0x63da('0x17')]?_0x36c2f3[_0x63da('0x17')][_0x63da('0x1e')]||null:null,'attributes':_0x36c2f3[_0x63da('0x17')]?_0x36c2f3['options'][_0x63da('0x1f')]||null:null,'limit':_0x36c2f3['options']?_0x36c2f3[_0x63da('0x17')]['limit']||null:null})[_0x63da('0x18')](function(_0x36ad6c){logger[_0x63da('0x11')](_0x63da('0x1a'),_0x36c2f3);logger[_0x63da('0xc')](_0x63da('0x1a'),_0x36c2f3,JSON[_0x63da('0x19')](_0x36ad6c));_0x335482(_0x36ad6c);})[_0x63da('0x14')](function(_0x5be6e1){logger[_0x63da('0xe')](_0x63da('0x1a'),_0x5be6e1[_0x63da('0x10')],_0x36c2f3);_0x4915f6(_0x57dc71[_0x63da('0xe')](0x1f4,_0x5be6e1[_0x63da('0x10')]));});});}; \ No newline at end of file +var _0x18e2=['UpdateSquareReport','update','body','options','where','limit','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','CreateSquareReport','SquareReport','create','raw'];(function(_0x1f2554,_0x3d2a14){var _0x216269=function(_0x511c4a){while(--_0x511c4a){_0x1f2554['push'](_0x1f2554['shift']());}};_0x216269(++_0x3d2a14);}(_0x18e2,0x1c0));var _0x218e=function(_0x534231,_0x55a338){_0x534231=_0x534231-0x0;var _0x195f36=_0x18e2[_0x534231];return _0x195f36;};'use strict';var _=require(_0x218e('0x0'));var util=require('util');var moment=require(_0x218e('0x1'));var BPromise=require(_0x218e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x218e('0x3'));var db=require(_0x218e('0x4'))['db'];var utils=require(_0x218e('0x5'));var logger=require(_0x218e('0x6'))(_0x218e('0x7'));var config=require('../../config/environment');var jayson=require(_0x218e('0x8'));var client=jayson[_0x218e('0x9')][_0x218e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3d7132,_0x4b7b32,_0x12389d){return new BPromise(function(_0x5b5c04,_0x1966f1){return client[_0x218e('0xb')](_0x3d7132,_0x12389d)[_0x218e('0xc')](function(_0x3e072e){logger[_0x218e('0xd')](_0x218e('0xe'),_0x4b7b32,_0x218e('0xf'));logger[_0x218e('0x10')](_0x218e('0x11'),_0x4b7b32,_0x218e('0xf'),JSON[_0x218e('0x12')](_0x3e072e));if(_0x3e072e['error']){if(_0x3e072e['error'][_0x218e('0x13')]===0x1f4){logger[_0x218e('0x14')](_0x218e('0xe'),_0x4b7b32,_0x3e072e['error'][_0x218e('0x15')]);return _0x1966f1(_0x3e072e[_0x218e('0x14')][_0x218e('0x15')]);}logger[_0x218e('0x14')](_0x218e('0xe'),_0x4b7b32,_0x3e072e[_0x218e('0x14')][_0x218e('0x15')]);return _0x5b5c04(_0x3e072e[_0x218e('0x14')][_0x218e('0x15')]);}else{logger['info'](_0x218e('0xe'),_0x4b7b32,_0x218e('0xf'));_0x5b5c04(_0x3e072e[_0x218e('0x16')][_0x218e('0x15')]);}})[_0x218e('0x17')](function(_0x3a0c00){logger[_0x218e('0x14')](_0x218e('0xe'),_0x4b7b32,_0x3a0c00);_0x1966f1(_0x3a0c00);});});}exports[_0x218e('0x18')]=function(_0x551e5c){var _0xb90da=this;return new Promise(function(_0x4a596d,_0x45b3d5){return db[_0x218e('0x19')][_0x218e('0x1a')](_0x551e5c['body'],{'raw':_0x551e5c['options']?_0x551e5c['options'][_0x218e('0x1b')]===undefined?!![]:![]:!![]})[_0x218e('0xc')](function(_0x26e307){logger[_0x218e('0xd')](_0x218e('0x18'),_0x551e5c);logger['debug'](_0x218e('0x18'),_0x551e5c,JSON[_0x218e('0x12')](_0x26e307));_0x4a596d(_0x26e307);})[_0x218e('0x17')](function(_0xad9684){logger[_0x218e('0x14')](_0x218e('0x18'),_0xad9684['message'],_0x551e5c);_0x45b3d5(_0xb90da[_0x218e('0x14')](0x1f4,_0xad9684['message']));});});};exports[_0x218e('0x1c')]=function(_0x59861f){var _0x2213b9=this;return new Promise(function(_0x241e44,_0x1d1dce){return db[_0x218e('0x19')][_0x218e('0x1d')](_0x59861f[_0x218e('0x1e')],{'raw':_0x59861f[_0x218e('0x1f')]?_0x59861f[_0x218e('0x1f')][_0x218e('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x59861f[_0x218e('0x1f')]?_0x59861f[_0x218e('0x1f')][_0x218e('0x20')]||null:null,'attributes':_0x59861f[_0x218e('0x1f')]?_0x59861f[_0x218e('0x1f')]['attributes']||null:null,'limit':_0x59861f[_0x218e('0x1f')]?_0x59861f['options'][_0x218e('0x21')]||null:null})[_0x218e('0xc')](function(_0x586a54){logger['info'](_0x218e('0x1c'),_0x59861f);logger[_0x218e('0x10')](_0x218e('0x1c'),_0x59861f,JSON[_0x218e('0x12')](_0x586a54));_0x241e44(_0x586a54);})[_0x218e('0x17')](function(_0x5557dc){logger[_0x218e('0x14')]('UpdateSquareReport',_0x5557dc['message'],_0x59861f);_0x1d1dce(_0x2213b9[_0x218e('0x14')](0x1f4,_0x5557dc[_0x218e('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 22e594f..b2a0fee 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 _0x2dbd=['util','path','express','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','get','/describe','describe','/:id','show','create','put','update','delete','destroy','multer'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0x2dbd,0xfb));var _0xd2db=function(_0x5094b6,_0x54a364){_0x5094b6=_0x5094b6-0x0;var _0xc86b59=_0x2dbd[_0x5094b6];return _0xc86b59;};'use strict';var multer=require(_0xd2db('0x0'));var util=require(_0xd2db('0x1'));var path=require(_0xd2db('0x2'));var timeout=require('connect-timeout');var express=require(_0xd2db('0x3'));var router=express['Router']();var fs_extra=require(_0xd2db('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xd2db('0x5'));var config=require(_0xd2db('0x6'));var controller=require('./squareReportDetail.controller');router['get']('/',auth[_0xd2db('0x7')](),controller['index']);router[_0xd2db('0x8')](_0xd2db('0x9'),auth[_0xd2db('0x7')](),controller[_0xd2db('0xa')]);router['get'](_0xd2db('0xb'),auth['isAuthenticated'](),controller[_0xd2db('0xc')]);router['post']('/',auth[_0xd2db('0x7')](),controller[_0xd2db('0xd')]);router[_0xd2db('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xd2db('0xf')]);router[_0xd2db('0x10')](_0xd2db('0xb'),auth[_0xd2db('0x7')](),controller[_0xd2db('0x11')]);module['exports']=router; \ No newline at end of file +var _0x42d0=['/describe','describe','/:id','show','post','create','update','destroy','exports','util','path','Router','../../components/auth/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated','index'];(function(_0x5e7b06,_0x48f427){var _0x3cd052=function(_0x3cb2a7){while(--_0x3cb2a7){_0x5e7b06['push'](_0x5e7b06['shift']());}};_0x3cd052(++_0x48f427);}(_0x42d0,0x105));var _0x042d=function(_0x186376,_0x5d988a){_0x186376=_0x186376-0x0;var _0x2dbdd9=_0x42d0[_0x186376];return _0x2dbdd9;};'use strict';var multer=require('multer');var util=require(_0x042d('0x0'));var path=require(_0x042d('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x042d('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x042d('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x042d('0x4'));var controller=require(_0x042d('0x5'));router[_0x042d('0x6')]('/',auth[_0x042d('0x7')](),controller[_0x042d('0x8')]);router[_0x042d('0x6')](_0x042d('0x9'),auth['isAuthenticated'](),controller[_0x042d('0xa')]);router['get'](_0x042d('0xb'),auth['isAuthenticated'](),controller[_0x042d('0xc')]);router[_0x042d('0xd')]('/',auth[_0x042d('0x7')](),controller[_0x042d('0xe')]);router['put'](_0x042d('0xb'),auth[_0x042d('0x7')](),controller[_0x042d('0xf')]);router['delete']('/:id',auth[_0x042d('0x7')](),controller[_0x042d('0x10')]);module[_0x042d('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 1722a59..677a9f9 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 _0xfa6a=['exports','STRING','TEXT','sequelize'];(function(_0x4d72c9,_0x519e4a){var _0x4f5143=function(_0x21be84){while(--_0x21be84){_0x4d72c9['push'](_0x4d72c9['shift']());}};_0x4f5143(++_0x519e4a);}(_0xfa6a,0x16f));var _0xafa6=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0xfa6a[_0x5c2e3e];return _0x53f64a;};'use strict';var Sequelize=require(_0xafa6('0x0'));module[_0xafa6('0x1')]={'uniqueid':{'type':Sequelize[_0xafa6('0x2')]},'node':{'type':Sequelize[_0xafa6('0x2')]},'application':{'type':Sequelize[_0xafa6('0x2')]},'data':{'type':Sequelize[_0xafa6('0x3')]},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xafa6('0x2')]}}; \ No newline at end of file +var _0xe4e4=['exports','STRING','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe4e4,0x17f));var _0x4e4e=function(_0x1fa0f9,_0x1e1ab0){_0x1fa0f9=_0x1fa0f9-0x0;var _0x466457=_0xe4e4[_0x1fa0f9];return _0x466457;};'use strict';var Sequelize=require(_0x4e4e('0x0'));module[_0x4e4e('0x1')]={'uniqueid':{'type':Sequelize[_0x4e4e('0x2')]},'node':{'type':Sequelize[_0x4e4e('0x2')]},'application':{'type':Sequelize[_0x4e4e('0x2')]},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x4e4e('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 2966579..f455868 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 _0x9e99=['end','offset','undefined','limit','count','Content-Range','reject','save','then','error','stack','name','index','map','SquareDetailsReport','rawAttributes','fieldName','type','key','query','keys','intersection','model','fields','attributes','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','catch','show','params','length','create','update','body','find','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x15019f,_0xc1e7b){var _0x493cde=function(_0x5058d2){while(--_0x5058d2){_0x15019f['push'](_0x15019f['shift']());}};_0x493cde(++_0xc1e7b);}(_0x9e99,0x162));var _0x99e9=function(_0x1f4a7d,_0x499f7d){_0x1f4a7d=_0x1f4a7d-0x0;var _0x2247b7=_0x9e99[_0x1f4a7d];return _0x2247b7;};'use strict';var emlformat=require(_0x99e9('0x0'));var rimraf=require(_0x99e9('0x1'));var zipdir=require(_0x99e9('0x2'));var jsonpatch=require(_0x99e9('0x3'));var rp=require(_0x99e9('0x4'));var moment=require('moment');var BPromise=require(_0x99e9('0x5'));var Mustache=require(_0x99e9('0x6'));var util=require(_0x99e9('0x7'));var path=require(_0x99e9('0x8'));var sox=require(_0x99e9('0x9'));var csv=require(_0x99e9('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x99e9('0xb'));var _=require(_0x99e9('0xc'));var squel=require(_0x99e9('0xd'));var crypto=require(_0x99e9('0xe'));var jsforce=require(_0x99e9('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x99e9('0xa'));var querystring=require(_0x99e9('0x10'));var Papa=require(_0x99e9('0x11'));var Redis=require(_0x99e9('0x12'));var authService=require(_0x99e9('0x13'));var qs=require(_0x99e9('0x14'));var as=require(_0x99e9('0x15'));var hardwareService=require(_0x99e9('0x16'));var logger=require(_0x99e9('0x17'))(_0x99e9('0x18'));var utils=require(_0x99e9('0x19'));var config=require(_0x99e9('0x1a'));var licenseUtil=require(_0x99e9('0x1b'));var db=require(_0x99e9('0x1c'))['db'];function respondWithStatusCode(_0x5c1b4c,_0x2ff2eb){_0x2ff2eb=_0x2ff2eb||0xcc;return function(_0x59f06b){if(_0x59f06b){return _0x5c1b4c[_0x99e9('0x1d')](_0x2ff2eb);}return _0x5c1b4c[_0x99e9('0x1e')](_0x2ff2eb)[_0x99e9('0x1f')]();};}function respondWithResult(_0x936b5b,_0x221884){_0x221884=_0x221884||0xc8;return function(_0x2355b8){if(_0x2355b8){return _0x936b5b[_0x99e9('0x1e')](_0x221884)['json'](_0x2355b8);}};}function respondWithFilteredResult(_0x17665d,_0x394c2f){return function(_0x503ce6){if(_0x503ce6){var _0x205402=typeof _0x394c2f[_0x99e9('0x20')]===_0x99e9('0x21')&&typeof _0x394c2f[_0x99e9('0x22')]===_0x99e9('0x21');var _0x281a5a=_0x503ce6[_0x99e9('0x23')];var _0x27b9f0=_0x205402?0x0:_0x394c2f[_0x99e9('0x20')];var _0x2aac64=_0x205402?_0x503ce6[_0x99e9('0x23')]:_0x394c2f[_0x99e9('0x20')]+_0x394c2f[_0x99e9('0x22')];var _0x1ddd61;if(_0x2aac64>=_0x281a5a){_0x2aac64=_0x281a5a;_0x1ddd61=0xc8;}else{_0x1ddd61=0xce;}_0x17665d[_0x99e9('0x1e')](_0x1ddd61);return _0x17665d['set'](_0x99e9('0x24'),_0x27b9f0+'-'+_0x2aac64+'/'+_0x281a5a)['json'](_0x503ce6);}return null;};}function patchUpdates(_0x11e01e){return function(_0x44822b){try{jsonpatch['apply'](_0x44822b,_0x11e01e,!![]);}catch(_0x12d879){return BPromise[_0x99e9('0x25')](_0x12d879);}return _0x44822b[_0x99e9('0x26')]();};}function saveUpdates(_0x27c422,_0x2981e5){return function(_0xf0b90){if(_0xf0b90){return _0xf0b90['update'](_0x27c422)[_0x99e9('0x27')](function(_0x1c24c6){return _0x1c24c6;});}return null;};}function removeEntity(_0x4c7817,_0x13f015){return function(_0x362e4b){if(_0x362e4b){return _0x362e4b['destroy']()['then'](function(){_0x4c7817['status'](0xcc)[_0x99e9('0x1f')]();});}};}function handleEntityNotFound(_0x684047,_0x47bd34){return function(_0x3c51e7){if(!_0x3c51e7){_0x684047[_0x99e9('0x1d')](0x194);}return _0x3c51e7;};}function handleError(_0xc66898,_0x36b7a3){_0x36b7a3=_0x36b7a3||0x1f4;return function(_0x9de9de){logger[_0x99e9('0x28')](_0x9de9de[_0x99e9('0x29')]);if(_0x9de9de[_0x99e9('0x2a')]){delete _0x9de9de[_0x99e9('0x2a')];}_0xc66898[_0x99e9('0x1e')](_0x36b7a3)['send'](_0x9de9de);};}exports[_0x99e9('0x2b')]=function(_0x33ef83,_0x1cf768){var _0x1499b0={},_0x569c57={},_0x2b971a={'count':0x0,'rows':[]};var _0x3be2e8=_[_0x99e9('0x2c')](db[_0x99e9('0x2d')][_0x99e9('0x2e')],function(_0x1622b6){return{'name':_0x1622b6[_0x99e9('0x2f')],'type':_0x1622b6[_0x99e9('0x30')][_0x99e9('0x31')]};});_0x569c57['model']=_[_0x99e9('0x2c')](_0x3be2e8,'name');_0x569c57[_0x99e9('0x32')]=_[_0x99e9('0x33')](_0x33ef83[_0x99e9('0x32')]);_0x569c57['filters']=_['intersection'](_0x569c57['model'],_0x569c57[_0x99e9('0x32')]);_0x1499b0['attributes']=_[_0x99e9('0x34')](_0x569c57[_0x99e9('0x35')],qs[_0x99e9('0x36')](_0x33ef83[_0x99e9('0x32')][_0x99e9('0x36')]));_0x1499b0[_0x99e9('0x37')]=_0x1499b0[_0x99e9('0x37')]['length']?_0x1499b0[_0x99e9('0x37')]:_0x569c57[_0x99e9('0x35')];if(!_0x33ef83[_0x99e9('0x32')]['hasOwnProperty'](_0x99e9('0x38'))){_0x1499b0['limit']=qs[_0x99e9('0x22')](_0x33ef83[_0x99e9('0x32')][_0x99e9('0x22')]);_0x1499b0[_0x99e9('0x20')]=qs[_0x99e9('0x20')](_0x33ef83[_0x99e9('0x32')][_0x99e9('0x20')]);}_0x1499b0[_0x99e9('0x39')]=qs[_0x99e9('0x3a')](_0x33ef83['query'][_0x99e9('0x3a')]);_0x1499b0[_0x99e9('0x3b')]=qs[_0x99e9('0x3c')](_[_0x99e9('0x3d')](_0x33ef83[_0x99e9('0x32')],_0x569c57['filters']),_0x3be2e8);if(_0x33ef83[_0x99e9('0x32')][_0x99e9('0x3e')]){_0x1499b0[_0x99e9('0x3b')]=_[_0x99e9('0x3f')](_0x1499b0['where'],{'$or':_[_0x99e9('0x2c')](_0x3be2e8,function(_0x5aaf6b){if(_0x5aaf6b[_0x99e9('0x30')]!=='VIRTUAL'){var _0x3bd7d0={};_0x3bd7d0[_0x5aaf6b['name']]={'$like':'%'+_0x33ef83['query'][_0x99e9('0x3e')]+'%'};return _0x3bd7d0;}})});}_0x1499b0=_[_0x99e9('0x3f')]({},_0x1499b0,_0x33ef83[_0x99e9('0x40')]);var _0x13bed2={'where':_0x1499b0[_0x99e9('0x3b')]};return db['SquareDetailsReport']['count'](_0x13bed2)[_0x99e9('0x27')](function(_0x36c3d6){_0x2b971a[_0x99e9('0x23')]=_0x36c3d6;if(_0x33ef83['query'][_0x99e9('0x41')]){_0x1499b0[_0x99e9('0x42')]=[{'all':!![]}];}return db[_0x99e9('0x2d')]['findAll'](_0x1499b0);})['then'](function(_0x19adb9){_0x2b971a['rows']=_0x19adb9;return _0x2b971a;})[_0x99e9('0x27')](respondWithFilteredResult(_0x1cf768,_0x1499b0))[_0x99e9('0x43')](handleError(_0x1cf768,null));};exports[_0x99e9('0x44')]=function(_0x32f8b6,_0x5c6cbb){var _0xa8d85d={'raw':!![],'where':{'id':_0x32f8b6[_0x99e9('0x45')]['id']}},_0x57b703={};_0x57b703[_0x99e9('0x35')]=_[_0x99e9('0x33')](db[_0x99e9('0x2d')]['rawAttributes']);_0x57b703['query']=_[_0x99e9('0x33')](_0x32f8b6['query']);_0x57b703[_0x99e9('0x3c')]=_['intersection'](_0x57b703[_0x99e9('0x35')],_0x57b703[_0x99e9('0x32')]);_0xa8d85d[_0x99e9('0x37')]=_['intersection'](_0x57b703[_0x99e9('0x35')],qs['fields'](_0x32f8b6[_0x99e9('0x32')][_0x99e9('0x36')]));_0xa8d85d[_0x99e9('0x37')]=_0xa8d85d[_0x99e9('0x37')][_0x99e9('0x46')]?_0xa8d85d['attributes']:_0x57b703[_0x99e9('0x35')];if(_0x32f8b6[_0x99e9('0x32')][_0x99e9('0x41')]){_0xa8d85d[_0x99e9('0x42')]=[{'all':!![]}];}_0xa8d85d=_[_0x99e9('0x3f')]({},_0xa8d85d,_0x32f8b6[_0x99e9('0x40')]);return db[_0x99e9('0x2d')]['find'](_0xa8d85d)[_0x99e9('0x27')](handleEntityNotFound(_0x5c6cbb,null))[_0x99e9('0x27')](respondWithResult(_0x5c6cbb,null))['catch'](handleError(_0x5c6cbb,null));};exports[_0x99e9('0x47')]=function(_0x46ab19,_0x271b77){return db['SquareDetailsReport'][_0x99e9('0x47')](_0x46ab19['body'],{})[_0x99e9('0x27')](respondWithResult(_0x271b77,0xc9))['catch'](handleError(_0x271b77,null));};exports[_0x99e9('0x48')]=function(_0x306714,_0x42577e){if(_0x306714['body']['id']){delete _0x306714[_0x99e9('0x49')]['id'];}return db[_0x99e9('0x2d')][_0x99e9('0x4a')]({'where':{'id':_0x306714['params']['id']}})[_0x99e9('0x27')](handleEntityNotFound(_0x42577e,null))[_0x99e9('0x27')](saveUpdates(_0x306714['body'],null))[_0x99e9('0x27')](respondWithResult(_0x42577e,null))[_0x99e9('0x43')](handleError(_0x42577e,null));};exports[_0x99e9('0x4b')]=function(_0x3c33ac,_0x2b500d){return db[_0x99e9('0x2d')][_0x99e9('0x4a')]({'where':{'id':_0x3c33ac[_0x99e9('0x45')]['id']}})['then'](handleEntityNotFound(_0x2b500d,null))[_0x99e9('0x27')](removeEntity(_0x2b500d,null))[_0x99e9('0x43')](handleError(_0x2b500d,null));};exports[_0x99e9('0x4c')]=function(_0x4e95dd,_0x570fa3){return db[_0x99e9('0x2d')][_0x99e9('0x4c')]()[_0x99e9('0x27')](respondWithResult(_0x570fa3,null))[_0x99e9('0x43')](handleError(_0x570fa3,null));}; \ No newline at end of file +var _0x8264=['../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','name','send','map','SquareDetailsReport','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','catch','show','params','include','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x53955a,_0x1177fd){var _0x146e46=function(_0x5b1535){while(--_0x5b1535){_0x53955a['push'](_0x53955a['shift']());}};_0x146e46(++_0x1177fd);}(_0x8264,0x1ae));var _0x4826=function(_0x4ba380,_0x259bee){_0x4ba380=_0x4ba380-0x0;var _0x4b111b=_0x8264[_0x4ba380];return _0x4b111b;};'use strict';var emlformat=require(_0x4826('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4826('0x1'));var jsonpatch=require(_0x4826('0x2'));var rp=require(_0x4826('0x3'));var moment=require(_0x4826('0x4'));var BPromise=require(_0x4826('0x5'));var Mustache=require(_0x4826('0x6'));var util=require(_0x4826('0x7'));var path=require(_0x4826('0x8'));var sox=require(_0x4826('0x9'));var csv=require(_0x4826('0xa'));var ejs=require(_0x4826('0xb'));var fs=require('fs');var fs_extra=require(_0x4826('0xc'));var _=require(_0x4826('0xd'));var squel=require(_0x4826('0xe'));var crypto=require(_0x4826('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4826('0xa'));var querystring=require(_0x4826('0x10'));var Papa=require('papaparse');var Redis=require(_0x4826('0x11'));var authService=require(_0x4826('0x12'));var qs=require(_0x4826('0x13'));var as=require(_0x4826('0x14'));var hardwareService=require(_0x4826('0x15'));var logger=require(_0x4826('0x16'))(_0x4826('0x17'));var utils=require(_0x4826('0x18'));var config=require(_0x4826('0x19'));var licenseUtil=require(_0x4826('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x13e2c1,_0x3fb8e4){_0x3fb8e4=_0x3fb8e4||0xcc;return function(_0x3ddfb1){if(_0x3ddfb1){return _0x13e2c1[_0x4826('0x1b')](_0x3fb8e4);}return _0x13e2c1[_0x4826('0x1c')](_0x3fb8e4)[_0x4826('0x1d')]();};}function respondWithResult(_0xcc1b2a,_0x5275a0){_0x5275a0=_0x5275a0||0xc8;return function(_0x363514){if(_0x363514){return _0xcc1b2a[_0x4826('0x1c')](_0x5275a0)[_0x4826('0x1e')](_0x363514);}};}function respondWithFilteredResult(_0x28a678,_0x4e503d){return function(_0x5d40fe){if(_0x5d40fe){var _0x29a97a=typeof _0x4e503d[_0x4826('0x1f')]===_0x4826('0x20')&&typeof _0x4e503d[_0x4826('0x21')]===_0x4826('0x20');var _0x351dd2=_0x5d40fe[_0x4826('0x22')];var _0x2e1c69=_0x29a97a?0x0:_0x4e503d['offset'];var _0x521192=_0x29a97a?_0x5d40fe[_0x4826('0x22')]:_0x4e503d[_0x4826('0x1f')]+_0x4e503d[_0x4826('0x21')];var _0x259d0f;if(_0x521192>=_0x351dd2){_0x521192=_0x351dd2;_0x259d0f=0xc8;}else{_0x259d0f=0xce;}_0x28a678[_0x4826('0x1c')](_0x259d0f);return _0x28a678[_0x4826('0x23')]('Content-Range',_0x2e1c69+'-'+_0x521192+'/'+_0x351dd2)[_0x4826('0x1e')](_0x5d40fe);}return null;};}function patchUpdates(_0x4d73ee){return function(_0xd53c3f){try{jsonpatch[_0x4826('0x24')](_0xd53c3f,_0x4d73ee,!![]);}catch(_0x529d24){return BPromise[_0x4826('0x25')](_0x529d24);}return _0xd53c3f[_0x4826('0x26')]();};}function saveUpdates(_0x27b10e,_0x371768){return function(_0x5ed3d0){if(_0x5ed3d0){return _0x5ed3d0[_0x4826('0x27')](_0x27b10e)[_0x4826('0x28')](function(_0x320ec5){return _0x320ec5;});}return null;};}function removeEntity(_0x5b6b9c,_0x871da9){return function(_0x2d92b1){if(_0x2d92b1){return _0x2d92b1[_0x4826('0x29')]()[_0x4826('0x28')](function(){_0x5b6b9c[_0x4826('0x1c')](0xcc)[_0x4826('0x1d')]();});}};}function handleEntityNotFound(_0x199c58,_0x130d6a){return function(_0x5a6704){if(!_0x5a6704){_0x199c58[_0x4826('0x1b')](0x194);}return _0x5a6704;};}function handleError(_0x5c9a01,_0x28153c){_0x28153c=_0x28153c||0x1f4;return function(_0xd4d5b4){logger[_0x4826('0x2a')](_0xd4d5b4['stack']);if(_0xd4d5b4[_0x4826('0x2b')]){delete _0xd4d5b4[_0x4826('0x2b')];}_0x5c9a01['status'](_0x28153c)[_0x4826('0x2c')](_0xd4d5b4);};}exports['index']=function(_0x250429,_0x154d87){var _0xeb5dbd={},_0x43fa35={},_0x483311={'count':0x0,'rows':[]};var _0x13df78=_[_0x4826('0x2d')](db[_0x4826('0x2e')][_0x4826('0x2f')],function(_0x1f250e){return{'name':_0x1f250e['fieldName'],'type':_0x1f250e[_0x4826('0x30')][_0x4826('0x31')]};});_0x43fa35[_0x4826('0x32')]=_[_0x4826('0x2d')](_0x13df78,_0x4826('0x2b'));_0x43fa35['query']=_[_0x4826('0x33')](_0x250429[_0x4826('0x34')]);_0x43fa35[_0x4826('0x35')]=_[_0x4826('0x36')](_0x43fa35['model'],_0x43fa35[_0x4826('0x34')]);_0xeb5dbd[_0x4826('0x37')]=_[_0x4826('0x36')](_0x43fa35[_0x4826('0x32')],qs[_0x4826('0x38')](_0x250429['query']['fields']));_0xeb5dbd[_0x4826('0x37')]=_0xeb5dbd[_0x4826('0x37')][_0x4826('0x39')]?_0xeb5dbd[_0x4826('0x37')]:_0x43fa35[_0x4826('0x32')];if(!_0x250429[_0x4826('0x34')][_0x4826('0x3a')](_0x4826('0x3b'))){_0xeb5dbd[_0x4826('0x21')]=qs['limit'](_0x250429[_0x4826('0x34')][_0x4826('0x21')]);_0xeb5dbd['offset']=qs[_0x4826('0x1f')](_0x250429[_0x4826('0x34')][_0x4826('0x1f')]);}_0xeb5dbd['order']=qs[_0x4826('0x3c')](_0x250429[_0x4826('0x34')][_0x4826('0x3c')]);_0xeb5dbd[_0x4826('0x3d')]=qs['filters'](_[_0x4826('0x3e')](_0x250429[_0x4826('0x34')],_0x43fa35['filters']),_0x13df78);if(_0x250429['query'][_0x4826('0x3f')]){_0xeb5dbd['where']=_[_0x4826('0x40')](_0xeb5dbd[_0x4826('0x3d')],{'$or':_[_0x4826('0x2d')](_0x13df78,function(_0xa718f9){if(_0xa718f9['type']!==_0x4826('0x41')){var _0x2a391a={};_0x2a391a[_0xa718f9[_0x4826('0x2b')]]={'$like':'%'+_0x250429[_0x4826('0x34')]['filter']+'%'};return _0x2a391a;}})});}_0xeb5dbd=_['merge']({},_0xeb5dbd,_0x250429['options']);var _0x4221a4={'where':_0xeb5dbd[_0x4826('0x3d')]};return db[_0x4826('0x2e')][_0x4826('0x22')](_0x4221a4)['then'](function(_0x2d04ab){_0x483311[_0x4826('0x22')]=_0x2d04ab;if(_0x250429[_0x4826('0x34')][_0x4826('0x42')]){_0xeb5dbd['include']=[{'all':!![]}];}return db[_0x4826('0x2e')][_0x4826('0x43')](_0xeb5dbd);})[_0x4826('0x28')](function(_0xd01961){_0x483311['rows']=_0xd01961;return _0x483311;})[_0x4826('0x28')](respondWithFilteredResult(_0x154d87,_0xeb5dbd))[_0x4826('0x44')](handleError(_0x154d87,null));};exports[_0x4826('0x45')]=function(_0x554a97,_0x2983b7){var _0x3745f4={'raw':!![],'where':{'id':_0x554a97[_0x4826('0x46')]['id']}},_0x3e6a38={};_0x3e6a38[_0x4826('0x32')]=_[_0x4826('0x33')](db[_0x4826('0x2e')][_0x4826('0x2f')]);_0x3e6a38[_0x4826('0x34')]=_[_0x4826('0x33')](_0x554a97[_0x4826('0x34')]);_0x3e6a38[_0x4826('0x35')]=_[_0x4826('0x36')](_0x3e6a38[_0x4826('0x32')],_0x3e6a38[_0x4826('0x34')]);_0x3745f4[_0x4826('0x37')]=_[_0x4826('0x36')](_0x3e6a38[_0x4826('0x32')],qs[_0x4826('0x38')](_0x554a97[_0x4826('0x34')][_0x4826('0x38')]));_0x3745f4[_0x4826('0x37')]=_0x3745f4[_0x4826('0x37')][_0x4826('0x39')]?_0x3745f4[_0x4826('0x37')]:_0x3e6a38[_0x4826('0x32')];if(_0x554a97[_0x4826('0x34')]['includeAll']){_0x3745f4[_0x4826('0x47')]=[{'all':!![]}];}_0x3745f4=_[_0x4826('0x40')]({},_0x3745f4,_0x554a97['options']);return db[_0x4826('0x2e')][_0x4826('0x48')](_0x3745f4)['then'](handleEntityNotFound(_0x2983b7,null))['then'](respondWithResult(_0x2983b7,null))[_0x4826('0x44')](handleError(_0x2983b7,null));};exports[_0x4826('0x49')]=function(_0x1dde14,_0x4cc9fe){return db[_0x4826('0x2e')][_0x4826('0x49')](_0x1dde14[_0x4826('0x4a')],{})[_0x4826('0x28')](respondWithResult(_0x4cc9fe,0xc9))['catch'](handleError(_0x4cc9fe,null));};exports[_0x4826('0x27')]=function(_0x30f6d2,_0x2cfe39){if(_0x30f6d2['body']['id']){delete _0x30f6d2['body']['id'];}return db[_0x4826('0x2e')][_0x4826('0x48')]({'where':{'id':_0x30f6d2[_0x4826('0x46')]['id']}})[_0x4826('0x28')](handleEntityNotFound(_0x2cfe39,null))[_0x4826('0x28')](saveUpdates(_0x30f6d2[_0x4826('0x4a')],null))[_0x4826('0x28')](respondWithResult(_0x2cfe39,null))[_0x4826('0x44')](handleError(_0x2cfe39,null));};exports[_0x4826('0x29')]=function(_0x1845ff,_0x1ad1ae){return db[_0x4826('0x2e')][_0x4826('0x48')]({'where':{'id':_0x1845ff[_0x4826('0x46')]['id']}})[_0x4826('0x28')](handleEntityNotFound(_0x1ad1ae,null))[_0x4826('0x28')](removeEntity(_0x1ad1ae,null))[_0x4826('0x44')](handleError(_0x1ad1ae,null));};exports['describe']=function(_0x2d5cf9,_0x139e1f){return db['SquareDetailsReport'][_0x4826('0x4b')]()[_0x4826('0x28')](respondWithResult(_0x139e1f,null))['catch'](handleError(_0x139e1f,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 78d1d8d..41f08ae 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 _0xe532=['util','../../config/logger','api','bluebird','request-promise','rimraf','./squareReportDetail.attributes','exports','define','SquareDetailsReport','report_square_details'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0xe532,0x1ef));var _0x2e53=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0xe532[_0x422905];return _0x33dc6c;};'use strict';var _=require('lodash');var util=require(_0x2e53('0x0'));var logger=require(_0x2e53('0x1'))(_0x2e53('0x2'));var moment=require('moment');var BPromise=require(_0x2e53('0x3'));var rp=require(_0x2e53('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2e53('0x5'));var config=require('../../config/environment');var attributes=require(_0x2e53('0x6'));module[_0x2e53('0x7')]=function(_0x1da59a,_0x1ee105){return _0x1da59a[_0x2e53('0x8')](_0x2e53('0x9'),attributes,{'tableName':_0x2e53('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3253=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','SquareDetailsReport','report_square_details','lodash'];(function(_0x5bd1a9,_0x313714){var _0x2ba345=function(_0x21b4af){while(--_0x21b4af){_0x5bd1a9['push'](_0x5bd1a9['shift']());}};_0x2ba345(++_0x313714);}(_0x3253,0x173));var _0x3325=function(_0x5fe69a,_0x5484f5){_0x5fe69a=_0x5fe69a-0x0;var _0x3f1aee=_0x3253[_0x5fe69a];return _0x3f1aee;};'use strict';var _=require(_0x3325('0x0'));var util=require(_0x3325('0x1'));var logger=require(_0x3325('0x2'))(_0x3325('0x3'));var moment=require(_0x3325('0x4'));var BPromise=require(_0x3325('0x5'));var rp=require(_0x3325('0x6'));var fs=require('fs');var path=require(_0x3325('0x7'));var rimraf=require(_0x3325('0x8'));var config=require('../../config/environment');var attributes=require('./squareReportDetail.attributes');module[_0x3325('0x9')]=function(_0x59f81e,_0x1cfbb9){return _0x59f81e['define'](_0x3325('0xa'),attributes,{'tableName':_0x3325('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.rpc.js b/server/api/squareReportDetail/squareReportDetail.rpc.js index f92ca8c..de951fa 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 _0xd824=['stringify','error','message','catch','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','raw','then','debug','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','SquareDetailsReport,\x20%s,\x20%s,\x20%s'];(function(_0xfa586c,_0x3e110a){var _0x3838c5=function(_0x27ec61){while(--_0x27ec61){_0xfa586c['push'](_0xfa586c['shift']());}};_0x3838c5(++_0x3e110a);}(_0xd824,0xc2));var _0x4d82=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd824[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x4d82('0x0'));var util=require(_0x4d82('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4d82('0x2'));var fs=require('fs');var Redis=require(_0x4d82('0x3'));var db=require(_0x4d82('0x4'))['db'];var utils=require(_0x4d82('0x5'));var logger=require(_0x4d82('0x6'))(_0x4d82('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4d82('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4b842f,_0x464caf,_0xb54db2){return new BPromise(function(_0x13d624,_0x5cccb6){return client[_0x4d82('0x9')](_0x4b842f,_0xb54db2)['then'](function(_0x5356cd){logger[_0x4d82('0xa')](_0x4d82('0xb'),_0x464caf,_0x4d82('0xc'));logger['debug'](_0x4d82('0xd'),_0x464caf,'request\x20sent',JSON[_0x4d82('0xe')](_0x5356cd));if(_0x5356cd[_0x4d82('0xf')]){if(_0x5356cd[_0x4d82('0xf')]['code']===0x1f4){logger['error'](_0x4d82('0xb'),_0x464caf,_0x5356cd[_0x4d82('0xf')][_0x4d82('0x10')]);return _0x5cccb6(_0x5356cd[_0x4d82('0xf')]['message']);}logger[_0x4d82('0xf')](_0x4d82('0xb'),_0x464caf,_0x5356cd[_0x4d82('0xf')]['message']);return _0x13d624(_0x5356cd[_0x4d82('0xf')]['message']);}else{logger[_0x4d82('0xa')]('SquareDetailsReport,\x20%s,\x20%s',_0x464caf,_0x4d82('0xc'));_0x13d624(_0x5356cd['result'][_0x4d82('0x10')]);}})[_0x4d82('0x11')](function(_0x461476){logger[_0x4d82('0xf')](_0x4d82('0xb'),_0x464caf,_0x461476);_0x5cccb6(_0x461476);});});}exports[_0x4d82('0x12')]=function(_0x258c59){var _0x217b72=this;return new Promise(function(_0x2f2127,_0x5ef783){return db[_0x4d82('0x13')][_0x4d82('0x14')](_0x258c59[_0x4d82('0x15')],{'raw':_0x258c59[_0x4d82('0x16')]?_0x258c59[_0x4d82('0x16')][_0x4d82('0x17')]===undefined?!![]:![]:!![]})[_0x4d82('0x18')](function(_0x64669c){logger[_0x4d82('0xa')](_0x4d82('0x12'),_0x258c59);logger[_0x4d82('0x19')]('CreateSquareDetailsReport',_0x258c59,JSON[_0x4d82('0xe')](_0x64669c));_0x2f2127(_0x64669c);})[_0x4d82('0x11')](function(_0x5e5bdf){logger[_0x4d82('0xf')](_0x4d82('0x12'),_0x5e5bdf[_0x4d82('0x10')],_0x258c59);_0x5ef783(_0x217b72[_0x4d82('0xf')](0x1f4,_0x5e5bdf[_0x4d82('0x10')]));});});}; \ No newline at end of file +var _0xefda=['SquareDetailsReport,\x20%s,\x20%s','message','info','result','catch','CreateSquareDetailsReport','create','body','options','raw','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x24703f,_0x2669d3){var _0x2dc703=function(_0x4b6b90){while(--_0x4b6b90){_0x24703f['push'](_0x24703f['shift']());}};_0x2dc703(++_0x2669d3);}(_0xefda,0x96));var _0xaefd=function(_0x2ca692,_0x19574a){_0x2ca692=_0x2ca692-0x0;var _0x151bbe=_0xefda[_0x2ca692];return _0x151bbe;};'use strict';var _=require(_0xaefd('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xaefd('0x1'));var rs=require(_0xaefd('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaefd('0x3'))['db'];var utils=require(_0xaefd('0x4'));var logger=require(_0xaefd('0x5'))(_0xaefd('0x6'));var config=require(_0xaefd('0x7'));var jayson=require(_0xaefd('0x8'));var client=jayson['client'][_0xaefd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3b9736,_0x24d10c,_0x1d76f3){return new BPromise(function(_0x4ce248,_0x15193c){return client[_0xaefd('0xa')](_0x3b9736,_0x1d76f3)[_0xaefd('0xb')](function(_0x4d44ed){logger['info']('SquareDetailsReport,\x20%s,\x20%s',_0x24d10c,_0xaefd('0xc'));logger[_0xaefd('0xd')](_0xaefd('0xe'),_0x24d10c,_0xaefd('0xc'),JSON[_0xaefd('0xf')](_0x4d44ed));if(_0x4d44ed[_0xaefd('0x10')]){if(_0x4d44ed[_0xaefd('0x10')][_0xaefd('0x11')]===0x1f4){logger[_0xaefd('0x10')](_0xaefd('0x12'),_0x24d10c,_0x4d44ed[_0xaefd('0x10')]['message']);return _0x15193c(_0x4d44ed[_0xaefd('0x10')]['message']);}logger[_0xaefd('0x10')](_0xaefd('0x12'),_0x24d10c,_0x4d44ed[_0xaefd('0x10')][_0xaefd('0x13')]);return _0x4ce248(_0x4d44ed['error'][_0xaefd('0x13')]);}else{logger[_0xaefd('0x14')](_0xaefd('0x12'),_0x24d10c,_0xaefd('0xc'));_0x4ce248(_0x4d44ed[_0xaefd('0x15')][_0xaefd('0x13')]);}})[_0xaefd('0x16')](function(_0x23d736){logger['error'](_0xaefd('0x12'),_0x24d10c,_0x23d736);_0x15193c(_0x23d736);});});}exports[_0xaefd('0x17')]=function(_0x9748f4){var _0x1737a1=this;return new Promise(function(_0x2db61b,_0x244956){return db['SquareDetailsReport'][_0xaefd('0x18')](_0x9748f4[_0xaefd('0x19')],{'raw':_0x9748f4[_0xaefd('0x1a')]?_0x9748f4[_0xaefd('0x1a')][_0xaefd('0x1b')]===undefined?!![]:![]:!![]})[_0xaefd('0xb')](function(_0x5282ed){logger[_0xaefd('0x14')](_0xaefd('0x17'),_0x9748f4);logger[_0xaefd('0xd')](_0xaefd('0x17'),_0x9748f4,JSON[_0xaefd('0xf')](_0x5282ed));_0x2db61b(_0x5282ed);})['catch'](function(_0x479486){logger['error'](_0xaefd('0x17'),_0x479486[_0xaefd('0x13')],_0x9748f4);_0x244956(_0x1737a1[_0xaefd('0x10')](0x1f4,_0x479486['message']));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index e8dbf49..ae5bea1 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 _0x0bb5=['exports','express','Router','../../components/auth/service','get','isAuthenticated','index','killProcess'];(function(_0x353c53,_0x2102c0){var _0x2c55da=function(_0x3fe2d5){while(--_0x3fe2d5){_0x353c53['push'](_0x353c53['shift']());}};_0x2c55da(++_0x2102c0);}(_0x0bb5,0x101));var _0x50bb=function(_0x28995a,_0x1e1975){_0x28995a=_0x28995a-0x0;var _0x338d7c=_0x0bb5[_0x28995a];return _0x338d7c;};'use strict';var express=require(_0x50bb('0x0'));var router=express[_0x50bb('0x1')]();var auth=require(_0x50bb('0x2'));var controller=require('./system.controller');router[_0x50bb('0x3')]('/',auth[_0x50bb('0x4')](),controller[_0x50bb('0x5')]);router[_0x50bb('0x3')]('/process/:pid/kill',auth['isAuthenticated'](),controller[_0x50bb('0x6')]);module[_0x50bb('0x7')]=router; \ No newline at end of file +var _0x49b0=['get','isAuthenticated','index','/process/:pid/kill','exports','express','Router','../../components/auth/service','./system.controller'];(function(_0x2a2631,_0x493162){var _0x30a716=function(_0x4b01ec){while(--_0x4b01ec){_0x2a2631['push'](_0x2a2631['shift']());}};_0x30a716(++_0x493162);}(_0x49b0,0x1be));var _0x049b=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x49b0[_0x4565bf];return _0x5610ba;};'use strict';var express=require(_0x049b('0x0'));var router=express[_0x049b('0x1')]();var auth=require(_0x049b('0x2'));var controller=require(_0x049b('0x3'));router[_0x049b('0x4')]('/',auth[_0x049b('0x5')](),controller[_0x049b('0x6')]);router[_0x049b('0x4')](_0x049b('0x7'),auth['isAuthenticated'](),controller['killProcess']);module[_0x049b('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 4c9628e..ef7dc91 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 _0x85b7=['pid','split','indexOf','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','exec','../../config/logger','api','util','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','send','index','getAllData','then','json','catch','killProcess','components/import/cm','format','params'];(function(_0x452feb,_0x219b08){var _0x332e3e=function(_0x5e2c4a){while(--_0x5e2c4a){_0x452feb['push'](_0x452feb['shift']());}};_0x332e3e(++_0x219b08);}(_0x85b7,0x92));var _0x785b=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x85b7[_0x138adb];return _0x1b27f2;};'use strict';var info=require(_0x785b('0x0'));var exec=require('child_process')[_0x785b('0x1')];var logger=require(_0x785b('0x2'))(_0x785b('0x3'));var util=require(_0x785b('0x4'));var BPromise=require(_0x785b('0x5'));var _=require(_0x785b('0x6'));function handleError(_0x29bde9,_0x3125a6,_0x3fd84b){_0x3125a6=_0x3125a6||0x1f4;return function(_0x3023da){logger[_0x785b('0x7')](_0x785b('0x8'),_0x3fd84b,_0x3125a6,util[_0x785b('0x9')](_0x3023da,{'showHidden':![],'depth':null}));delete _0x3023da[_0x785b('0xa')];_0x29bde9[_0x785b('0xb')](_0x3125a6)[_0x785b('0xc')](_0x3023da);};}exports[_0x785b('0xd')]=function(_0x2dffa0,_0x2b14a8){return info[_0x785b('0xe')]()[_0x785b('0xf')](function(_0x4b5a79){return _0x2b14a8[_0x785b('0xb')](0xc8)[_0x785b('0x10')](_0x4b5a79);})[_0x785b('0x11')](function(_0x489146){return _0x2b14a8[_0x785b('0xb')](0x1f4)[_0x785b('0x10')](_0x489146);});};exports[_0x785b('0x12')]=function(_0x30c3ec,_0x5d8bca){var _0x2348d1=[_0x785b('0x13')];return new BPromise(function(_0x1e4b84,_0x4cfa8b){return exec(util[_0x785b('0x14')]('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x30c3ec[_0x785b('0x15')][_0x785b('0x16')]),function(_0x3c3aa2,_0x463a6e,_0x4a954c){if(_0x3c3aa2){return _0x4cfa8b(_0x3c3aa2);}return _0x1e4b84(_0x463a6e);});})[_0x785b('0xf')](function(_0x186891){var _0x8f00a9=![];var _0x4f1af0=_0x186891[_0x785b('0x17')](/\n/);for(var _0x233888=0x0,_0x2183e4=_0x2348d1['length'];_0x233888<_0x2183e4,_0x8f00a9===![];_0x233888+=0x1){if(_0x186891[_0x785b('0x18')](_0x2348d1[_0x233888])>=0x0){_0x8f00a9=!![];}}if(!_0x8f00a9){throw new Error(util['format']('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x30c3ec[_0x785b('0x15')]['pid']));}process[_0x785b('0x19')](_0x30c3ec[_0x785b('0x15')][_0x785b('0x16')],_0x785b('0x1a'));return _0x5d8bca[_0x785b('0xb')](0xc8)['json']({'message':util[_0x785b('0x14')](_0x785b('0x1b'),_0x30c3ec[_0x785b('0x15')][_0x785b('0x16')])});})[_0x785b('0x11')](handleError(_0x5d8bca,null,_0x785b('0x12')));}; \ No newline at end of file +var _0xf6bb=['Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','exec','../../config/logger','api','util','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','index','getAllData','then','json','catch','killProcess','components/import/cm','format','params','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','pid','kill','SIGINT'];(function(_0x18dcdf,_0x41808c){var _0x34a6b4=function(_0x23c0f9){while(--_0x23c0f9){_0x18dcdf['push'](_0x18dcdf['shift']());}};_0x34a6b4(++_0x41808c);}(_0xf6bb,0x1e1));var _0xbf6b=function(_0x5f0501,_0x19196e){_0x5f0501=_0x5f0501-0x0;var _0x3c2c45=_0xf6bb[_0x5f0501];return _0x3c2c45;};'use strict';var info=require(_0xbf6b('0x0'));var exec=require(_0xbf6b('0x1'))[_0xbf6b('0x2')];var logger=require(_0xbf6b('0x3'))(_0xbf6b('0x4'));var util=require(_0xbf6b('0x5'));var BPromise=require(_0xbf6b('0x6'));var _=require(_0xbf6b('0x7'));function handleError(_0x5e8475,_0x45ec8f,_0x1d0041){_0x45ec8f=_0x45ec8f||0x1f4;return function(_0x32bc14){logger[_0xbf6b('0x8')](_0xbf6b('0x9'),_0x1d0041,_0x45ec8f,util[_0xbf6b('0xa')](_0x32bc14,{'showHidden':![],'depth':null}));delete _0x32bc14[_0xbf6b('0xb')];_0x5e8475[_0xbf6b('0xc')](_0x45ec8f)['send'](_0x32bc14);};}exports[_0xbf6b('0xd')]=function(_0x154e10,_0x17ad38){return info[_0xbf6b('0xe')]()[_0xbf6b('0xf')](function(_0x461334){return _0x17ad38[_0xbf6b('0xc')](0xc8)[_0xbf6b('0x10')](_0x461334);})[_0xbf6b('0x11')](function(_0x1ae35b){return _0x17ad38[_0xbf6b('0xc')](0x1f4)[_0xbf6b('0x10')](_0x1ae35b);});};exports[_0xbf6b('0x12')]=function(_0x4e1e8c,_0x3e7e48){var _0x5e2f28=[_0xbf6b('0x13')];return new BPromise(function(_0x3cd1a8,_0x6d1f06){return exec(util[_0xbf6b('0x14')]('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x4e1e8c[_0xbf6b('0x15')]['pid']),function(_0x1e7579,_0x16de7f,_0xab7505){if(_0x1e7579){return _0x6d1f06(_0x1e7579);}return _0x3cd1a8(_0x16de7f);});})[_0xbf6b('0xf')](function(_0xb194d4){var _0x1fa17e=![];var _0x1647fd=_0xb194d4[_0xbf6b('0x16')](/\n/);for(var _0x23afa8=0x0,_0x4286b3=_0x5e2f28[_0xbf6b('0x17')];_0x23afa8<_0x4286b3,_0x1fa17e===![];_0x23afa8+=0x1){if(_0xb194d4[_0xbf6b('0x18')](_0x5e2f28[_0x23afa8])>=0x0){_0x1fa17e=!![];}}if(!_0x1fa17e){throw new Error(util[_0xbf6b('0x14')](_0xbf6b('0x19'),_0x4e1e8c[_0xbf6b('0x15')][_0xbf6b('0x1a')]));}process[_0xbf6b('0x1b')](_0x4e1e8c[_0xbf6b('0x15')][_0xbf6b('0x1a')],_0xbf6b('0x1c'));return _0x3e7e48[_0xbf6b('0xc')](0xc8)['json']({'message':util['format'](_0xbf6b('0x1d'),_0x4e1e8c['params'][_0xbf6b('0x1a')])});})[_0xbf6b('0x11')](handleError(_0x3e7e48,null,_0xbf6b('0x12')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index babd927..5203051 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 _0x3823=['../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','delete','util','path','connect-timeout','Router'];(function(_0x5326ec,_0x2b7f6f){var _0x53094f=function(_0x3bac9c){while(--_0x3bac9c){_0x5326ec['push'](_0x5326ec['shift']());}};_0x53094f(++_0x2b7f6f);}(_0x3823,0xb0));var _0x3382=function(_0x7ae146,_0x595a40){_0x7ae146=_0x7ae146-0x0;var _0x265a49=_0x3823[_0x7ae146];return _0x265a49;};'use strict';var multer=require('multer');var util=require(_0x3382('0x0'));var path=require(_0x3382('0x1'));var timeout=require(_0x3382('0x2'));var express=require('express');var router=express[_0x3382('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x3382('0x4'));var interaction=require(_0x3382('0x5'));var config=require(_0x3382('0x6'));var controller=require(_0x3382('0x7'));router['get']('/',auth[_0x3382('0x8')](),controller[_0x3382('0x9')]);router[_0x3382('0xa')](_0x3382('0xb'),auth[_0x3382('0x8')](),controller[_0x3382('0xc')]);router[_0x3382('0xd')]('/',auth[_0x3382('0x8')](),controller[_0x3382('0xe')]);router[_0x3382('0xf')](_0x3382('0xb'),auth[_0x3382('0x8')](),controller[_0x3382('0x10')]);router[_0x3382('0x11')](_0x3382('0xb'),auth[_0x3382('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xc25d=['connect-timeout','express','fs-extra','../../components/interaction/service','./tag.controller','isAuthenticated','index','get','/:id','show','update','delete','exports'];(function(_0x128fcd,_0x59568f){var _0x4811ad=function(_0x12643a){while(--_0x12643a){_0x128fcd['push'](_0x128fcd['shift']());}};_0x4811ad(++_0x59568f);}(_0xc25d,0x1ee));var _0xdc25=function(_0xb725be,_0x45bd01){_0xb725be=_0xb725be-0x0;var _0x2f2424=_0xc25d[_0xb725be];return _0x2f2424;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xdc25('0x0'));var express=require(_0xdc25('0x1'));var router=express['Router']();var fs_extra=require(_0xdc25('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xdc25('0x3'));var config=require('../../config/environment');var controller=require(_0xdc25('0x4'));router['get']('/',auth[_0xdc25('0x5')](),controller[_0xdc25('0x6')]);router[_0xdc25('0x7')](_0xdc25('0x8'),auth[_0xdc25('0x5')](),controller[_0xdc25('0x9')]);router['post']('/',auth[_0xdc25('0x5')](),controller['create']);router['put'](_0xdc25('0x8'),auth[_0xdc25('0x5')](),controller[_0xdc25('0xa')]);router[_0xdc25('0xb')]('/:id',auth[_0xdc25('0x5')](),controller['destroy']);module[_0xdc25('0xc')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index a052b97..b9e6c35 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 _0xed3c=['name','#0091EA','sequelize','exports','STRING'];(function(_0xeee95d,_0x4a3ec3){var _0x4755de=function(_0x58ed01){while(--_0x58ed01){_0xeee95d['push'](_0xeee95d['shift']());}};_0x4755de(++_0x4a3ec3);}(_0xed3c,0x1a6));var _0xced3=function(_0x9e9ead,_0x1a7ff3){_0x9e9ead=_0x9e9ead-0x0;var _0x31ff57=_0xed3c[_0x9e9ead];return _0x31ff57;};'use strict';var Sequelize=require(_0xced3('0x0'));module[_0xced3('0x1')]={'name':{'type':Sequelize[_0xced3('0x2')],'unique':_0xced3('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':_0xced3('0x4')},'description':{'type':Sequelize[_0xced3('0x2')]}}; \ No newline at end of file +var _0x5c00=['STRING','sequelize','exports'];(function(_0x957193,_0x3fec8b){var _0x9473f8=function(_0x34b82b){while(--_0x34b82b){_0x957193['push'](_0x957193['shift']());}};_0x9473f8(++_0x3fec8b);}(_0x5c00,0x17e));var _0x05c0=function(_0x3eceb2,_0x509ff8){_0x3eceb2=_0x3eceb2-0x0;var _0x818bc4=_0x5c00[_0x3eceb2];return _0x818bc4;};'use strict';var Sequelize=require(_0x05c0('0x0'));module[_0x05c0('0x1')]={'name':{'type':Sequelize[_0x05c0('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x05c0('0x2')],'defaultValue':'#0091EA'},'description':{'type':Sequelize[_0x05c0('0x2')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 9e863f2..f75358a 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 _0xb28a=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range','json','apply','save','then','destroy','get','Tags','UserProfileResource','error','stack','name','send','index','rawAttributes','type','key','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','filter','merge','Tag','catch','show','include','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','rimraf','zip-dir','request-promise','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch'];(function(_0x6c7fbe,_0xef52ab){var _0xa097fc=function(_0x470b57){while(--_0x470b57){_0x6c7fbe['push'](_0x6c7fbe['shift']());}};_0xa097fc(++_0xef52ab);}(_0xb28a,0x166));var _0xab28=function(_0x17f9a8,_0xddb0a){_0x17f9a8=_0x17f9a8-0x0;var _0x351558=_0xb28a[_0x17f9a8];return _0x351558;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xab28('0x0'));var zipdir=require(_0xab28('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xab28('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xab28('0x3'));var path=require(_0xab28('0x4'));var sox=require(_0xab28('0x5'));var csv=require(_0xab28('0x6'));var ejs=require(_0xab28('0x7'));var fs=require('fs');var fs_extra=require(_0xab28('0x8'));var _=require(_0xab28('0x9'));var squel=require(_0xab28('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xab28('0xb'));var toCsv=require(_0xab28('0x6'));var querystring=require(_0xab28('0xc'));var Papa=require(_0xab28('0xd'));var Redis=require(_0xab28('0xe'));var authService=require(_0xab28('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xab28('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xab28('0x11'))(_0xab28('0x12'));var utils=require(_0xab28('0x13'));var config=require(_0xab28('0x14'));var licenseUtil=require(_0xab28('0x15'));var db=require(_0xab28('0x16'))['db'];function respondWithStatusCode(_0x3fd6f2,_0x1976a5){_0x1976a5=_0x1976a5||0xcc;return function(_0x5b32d6){if(_0x5b32d6){return _0x3fd6f2[_0xab28('0x17')](_0x1976a5);}return _0x3fd6f2[_0xab28('0x18')](_0x1976a5)[_0xab28('0x19')]();};}function respondWithResult(_0x389fc3,_0x2c05bc){_0x2c05bc=_0x2c05bc||0xc8;return function(_0x19029e){if(_0x19029e){return _0x389fc3['status'](_0x2c05bc)['json'](_0x19029e);}};}function respondWithFilteredResult(_0x7c1921,_0x3d133e){return function(_0x14e8b4){if(_0x14e8b4){var _0xaaeb24=typeof _0x3d133e['offset']===_0xab28('0x1a')&&typeof _0x3d133e['limit']===_0xab28('0x1a');var _0x54f79b=_0x14e8b4[_0xab28('0x1b')];var _0x2b0b5c=_0xaaeb24?0x0:_0x3d133e[_0xab28('0x1c')];var _0x4005fd=_0xaaeb24?_0x14e8b4[_0xab28('0x1b')]:_0x3d133e[_0xab28('0x1c')]+_0x3d133e[_0xab28('0x1d')];var _0x300cbd;if(_0x4005fd>=_0x54f79b){_0x4005fd=_0x54f79b;_0x300cbd=0xc8;}else{_0x300cbd=0xce;}_0x7c1921['status'](_0x300cbd);return _0x7c1921[_0xab28('0x1e')](_0xab28('0x1f'),_0x2b0b5c+'-'+_0x4005fd+'/'+_0x54f79b)[_0xab28('0x20')](_0x14e8b4);}return null;};}function patchUpdates(_0x170a80){return function(_0x2f6541){try{jsonpatch[_0xab28('0x21')](_0x2f6541,_0x170a80,!![]);}catch(_0x1b0fc6){return BPromise['reject'](_0x1b0fc6);}return _0x2f6541[_0xab28('0x22')]();};}function saveUpdates(_0x4ec564,_0x1db226){return function(_0x127e2b){if(_0x127e2b){return _0x127e2b['update'](_0x4ec564)[_0xab28('0x23')](function(_0x1829bd){return _0x1829bd;});}return null;};}function removeEntity(_0x3bef23,_0x46a24b){return function(_0x4549e6){if(_0x4549e6){return _0x4549e6[_0xab28('0x24')]()[_0xab28('0x23')](function(){var _0x56c6ef=_0x4549e6[_0xab28('0x25')]({'plain':!![]});var _0x50ae27=_0xab28('0x26');return db[_0xab28('0x27')]['destroy']({'where':{'type':_0x50ae27,'resourceId':_0x56c6ef['id']}})[_0xab28('0x23')](function(){return _0x4549e6;});})['then'](function(){_0x3bef23[_0xab28('0x18')](0xcc)[_0xab28('0x19')]();});}};}function handleEntityNotFound(_0x3d8c60,_0x4e3b93){return function(_0x24a692){if(!_0x24a692){_0x3d8c60[_0xab28('0x17')](0x194);}return _0x24a692;};}function handleError(_0x4a6435,_0x6a494e){_0x6a494e=_0x6a494e||0x1f4;return function(_0x46b19b){logger[_0xab28('0x28')](_0x46b19b[_0xab28('0x29')]);if(_0x46b19b['name']){delete _0x46b19b[_0xab28('0x2a')];}_0x4a6435[_0xab28('0x18')](_0x6a494e)[_0xab28('0x2b')](_0x46b19b);};}exports[_0xab28('0x2c')]=function(_0x376589,_0x4114fd){var _0x44f016={},_0x43362a={},_0x670c1f={'count':0x0,'rows':[]};var _0x383e05=_['map'](db['Tag'][_0xab28('0x2d')],function(_0x4cbc0b){return{'name':_0x4cbc0b['fieldName'],'type':_0x4cbc0b[_0xab28('0x2e')][_0xab28('0x2f')]};});_0x43362a[_0xab28('0x30')]=_[_0xab28('0x31')](_0x383e05,_0xab28('0x2a'));_0x43362a[_0xab28('0x32')]=_['keys'](_0x376589[_0xab28('0x32')]);_0x43362a[_0xab28('0x33')]=_[_0xab28('0x34')](_0x43362a['model'],_0x43362a[_0xab28('0x32')]);_0x44f016['attributes']=_[_0xab28('0x34')](_0x43362a[_0xab28('0x30')],qs['fields'](_0x376589[_0xab28('0x32')][_0xab28('0x35')]));_0x44f016[_0xab28('0x36')]=_0x44f016[_0xab28('0x36')][_0xab28('0x37')]?_0x44f016[_0xab28('0x36')]:_0x43362a['model'];if(!_0x376589[_0xab28('0x32')][_0xab28('0x38')]('nolimit')){_0x44f016[_0xab28('0x1d')]=qs[_0xab28('0x1d')](_0x376589[_0xab28('0x32')][_0xab28('0x1d')]);_0x44f016[_0xab28('0x1c')]=qs[_0xab28('0x1c')](_0x376589[_0xab28('0x32')][_0xab28('0x1c')]);}_0x44f016['order']=qs[_0xab28('0x39')](_0x376589[_0xab28('0x32')]['sort']);_0x44f016[_0xab28('0x3a')]=qs[_0xab28('0x33')](_['pick'](_0x376589[_0xab28('0x32')],_0x43362a[_0xab28('0x33')]),_0x383e05);if(_0x376589[_0xab28('0x32')][_0xab28('0x3b')]){_0x44f016[_0xab28('0x3a')]=_[_0xab28('0x3c')](_0x44f016[_0xab28('0x3a')],{'$or':_['map'](_0x383e05,function(_0x3a1a78){if(_0x3a1a78[_0xab28('0x2e')]!=='VIRTUAL'){var _0x1e59b8={};_0x1e59b8[_0x3a1a78[_0xab28('0x2a')]]={'$like':'%'+_0x376589[_0xab28('0x32')][_0xab28('0x3b')]+'%'};return _0x1e59b8;}})});}_0x44f016=_[_0xab28('0x3c')]({},_0x44f016,_0x376589['options']);var _0x16c441={'where':_0x44f016['where']};return db['Tag'][_0xab28('0x1b')](_0x16c441)[_0xab28('0x23')](function(_0x23ada2){_0x670c1f[_0xab28('0x1b')]=_0x23ada2;if(_0x376589[_0xab28('0x32')]['includeAll']){_0x44f016['include']=[{'all':!![]}];}return db[_0xab28('0x3d')]['findAll'](_0x44f016);})[_0xab28('0x23')](function(_0x47a122){_0x670c1f['rows']=_0x47a122;return _0x670c1f;})[_0xab28('0x23')](respondWithFilteredResult(_0x4114fd,_0x44f016))[_0xab28('0x3e')](handleError(_0x4114fd,null));};exports[_0xab28('0x3f')]=function(_0xb437c5,_0x415130){var _0x1aea9b={'raw':!![],'where':{'id':_0xb437c5['params']['id']}},_0x53c232={};_0x53c232[_0xab28('0x30')]=_['keys'](db[_0xab28('0x3d')]['rawAttributes']);_0x53c232[_0xab28('0x32')]=_['keys'](_0xb437c5['query']);_0x53c232[_0xab28('0x33')]=_['intersection'](_0x53c232['model'],_0x53c232['query']);_0x1aea9b[_0xab28('0x36')]=_['intersection'](_0x53c232[_0xab28('0x30')],qs[_0xab28('0x35')](_0xb437c5[_0xab28('0x32')][_0xab28('0x35')]));_0x1aea9b['attributes']=_0x1aea9b[_0xab28('0x36')][_0xab28('0x37')]?_0x1aea9b[_0xab28('0x36')]:_0x53c232[_0xab28('0x30')];if(_0xb437c5[_0xab28('0x32')]['includeAll']){_0x1aea9b[_0xab28('0x40')]=[{'all':!![]}];}_0x1aea9b=_[_0xab28('0x3c')]({},_0x1aea9b,_0xb437c5['options']);return db[_0xab28('0x3d')]['find'](_0x1aea9b)['then'](handleEntityNotFound(_0x415130,null))[_0xab28('0x23')](respondWithResult(_0x415130,null))[_0xab28('0x3e')](handleError(_0x415130,null));};exports['create']=function(_0x39a4ef,_0x52fa3a){return db[_0xab28('0x3d')][_0xab28('0x41')](_0x39a4ef[_0xab28('0x42')],{})[_0xab28('0x23')](function(_0x48f1e3){var _0x1e6513=_0x39a4ef['user']['get']({'plain':!![]});if(!_0x1e6513)throw new Error(_0xab28('0x43'));if(_0x1e6513['role']===_0xab28('0x44')){var _0x199734=_0x48f1e3['get']({'plain':!![]});var _0x3e037d=_0xab28('0x26');return db[_0xab28('0x45')][_0xab28('0x46')]({'where':{'name':_0x3e037d,'userProfileId':_0x1e6513['userProfileId']},'raw':!![]})[_0xab28('0x23')](function(_0x19a791){if(_0x19a791&&_0x19a791[_0xab28('0x47')]===0x0){return db[_0xab28('0x27')][_0xab28('0x41')]({'name':_0x199734[_0xab28('0x2a')],'resourceId':_0x199734['id'],'type':_0x19a791[_0xab28('0x2a')],'sectionId':_0x19a791['id']},{})[_0xab28('0x23')](function(){return _0x48f1e3;});}else{return _0x48f1e3;}})['catch'](function(_0x39c5b4){logger[_0xab28('0x28')](_0xab28('0x48'),_0x39c5b4);throw _0x39c5b4;});}return _0x48f1e3;})[_0xab28('0x23')](respondWithResult(_0x52fa3a,0xc9))[_0xab28('0x3e')](handleError(_0x52fa3a,null));};exports[_0xab28('0x49')]=function(_0x9bae23,_0x1f2a25){if(_0x9bae23[_0xab28('0x42')]['id']){delete _0x9bae23[_0xab28('0x42')]['id'];}return db[_0xab28('0x3d')]['find']({'where':{'id':_0x9bae23[_0xab28('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1f2a25,null))['then'](saveUpdates(_0x9bae23[_0xab28('0x42')],null))[_0xab28('0x23')](respondWithResult(_0x1f2a25,null))[_0xab28('0x3e')](handleError(_0x1f2a25,null));};exports['destroy']=function(_0x51da7f,_0x13265a){return db[_0xab28('0x3d')][_0xab28('0x46')]({'where':{'id':_0x51da7f[_0xab28('0x4a')]['id']}})[_0xab28('0x23')](handleEntityNotFound(_0x13265a,null))[_0xab28('0x23')](removeEntity(_0x13265a,null))[_0xab28('0x3e')](handleError(_0x13265a,null));}; \ No newline at end of file +var _0x9c44=['update','destroy','get','UserProfileResource','then','sendStatus','error','stack','name','send','index','Tag','rawAttributes','fieldName','type','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','keys','include','find','catch','create','body','user','Tags','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','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'];(function(_0x57f233,_0xfb0574){var _0x22ba63=function(_0x12d7f3){while(--_0x12d7f3){_0x57f233['push'](_0x57f233['shift']());}};_0x22ba63(++_0xfb0574);}(_0x9c44,0x178));var _0x49c4=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0x9c44[_0x5608a3];return _0x1ed50a;};'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(){var _0x5850f2=_0x26c640[_0x49c4('0x24')]({'plain':!![]});var _0x9cb797='Tags';return db[_0x49c4('0x25')][_0x49c4('0x23')]({'where':{'type':_0x9cb797,'resourceId':_0x5850f2['id']}})[_0x49c4('0x26')](function(){return _0x26c640;});})[_0x49c4('0x26')](function(){_0x2263ae['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x449960,_0x53c199){return function(_0x3800b7){if(!_0x3800b7){_0x449960[_0x49c4('0x27')](0x194);}return _0x3800b7;};}function handleError(_0x3f1708,_0x372a47){_0x372a47=_0x372a47||0x1f4;return function(_0x5987ae){logger[_0x49c4('0x28')](_0x5987ae[_0x49c4('0x29')]);if(_0x5987ae[_0x49c4('0x2a')]){delete _0x5987ae[_0x49c4('0x2a')];}_0x3f1708[_0x49c4('0x16')](_0x372a47)[_0x49c4('0x2b')](_0x5987ae);};}exports[_0x49c4('0x2c')]=function(_0x427b26,_0x17b50f){var _0x2cbd88={},_0x46f7ea={},_0x4ea6ea={'count':0x0,'rows':[]};var _0x4f4495=_['map'](db[_0x49c4('0x2d')][_0x49c4('0x2e')],function(_0x1eb035){return{'name':_0x1eb035[_0x49c4('0x2f')],'type':_0x1eb035[_0x49c4('0x30')]['key']};});_0x46f7ea[_0x49c4('0x31')]=_[_0x49c4('0x32')](_0x4f4495,_0x49c4('0x2a'));_0x46f7ea[_0x49c4('0x33')]=_['keys'](_0x427b26['query']);_0x46f7ea[_0x49c4('0x34')]=_[_0x49c4('0x35')](_0x46f7ea[_0x49c4('0x31')],_0x46f7ea[_0x49c4('0x33')]);_0x2cbd88[_0x49c4('0x36')]=_['intersection'](_0x46f7ea[_0x49c4('0x31')],qs[_0x49c4('0x37')](_0x427b26[_0x49c4('0x33')]['fields']));_0x2cbd88['attributes']=_0x2cbd88[_0x49c4('0x36')][_0x49c4('0x38')]?_0x2cbd88[_0x49c4('0x36')]:_0x46f7ea[_0x49c4('0x31')];if(!_0x427b26[_0x49c4('0x33')][_0x49c4('0x39')](_0x49c4('0x3a'))){_0x2cbd88[_0x49c4('0x1b')]=qs[_0x49c4('0x1b')](_0x427b26['query'][_0x49c4('0x1b')]);_0x2cbd88['offset']=qs[_0x49c4('0x19')](_0x427b26[_0x49c4('0x33')][_0x49c4('0x19')]);}_0x2cbd88[_0x49c4('0x3b')]=qs['sort'](_0x427b26[_0x49c4('0x33')][_0x49c4('0x3c')]);_0x2cbd88[_0x49c4('0x3d')]=qs['filters'](_[_0x49c4('0x3e')](_0x427b26[_0x49c4('0x33')],_0x46f7ea[_0x49c4('0x34')]),_0x4f4495);if(_0x427b26[_0x49c4('0x33')][_0x49c4('0x3f')]){_0x2cbd88[_0x49c4('0x3d')]=_[_0x49c4('0x40')](_0x2cbd88[_0x49c4('0x3d')],{'$or':_[_0x49c4('0x32')](_0x4f4495,function(_0x2f1105){if(_0x2f1105[_0x49c4('0x30')]!=='VIRTUAL'){var _0x2d2510={};_0x2d2510[_0x2f1105[_0x49c4('0x2a')]]={'$like':'%'+_0x427b26[_0x49c4('0x33')][_0x49c4('0x3f')]+'%'};return _0x2d2510;}})});}_0x2cbd88=_[_0x49c4('0x40')]({},_0x2cbd88,_0x427b26[_0x49c4('0x41')]);var _0x1be62d={'where':_0x2cbd88[_0x49c4('0x3d')]};return db[_0x49c4('0x2d')][_0x49c4('0x1c')](_0x1be62d)[_0x49c4('0x26')](function(_0xa3d59e){_0x4ea6ea[_0x49c4('0x1c')]=_0xa3d59e;if(_0x427b26['query'][_0x49c4('0x42')]){_0x2cbd88['include']=[{'all':!![]}];}return db[_0x49c4('0x2d')][_0x49c4('0x43')](_0x2cbd88);})[_0x49c4('0x26')](function(_0x1480da){_0x4ea6ea[_0x49c4('0x44')]=_0x1480da;return _0x4ea6ea;})[_0x49c4('0x26')](respondWithFilteredResult(_0x17b50f,_0x2cbd88))['catch'](handleError(_0x17b50f,null));};exports['show']=function(_0x20490b,_0x1e7bdc){var _0x38349b={'raw':!![],'where':{'id':_0x20490b['params']['id']}},_0x117151={};_0x117151[_0x49c4('0x31')]=_[_0x49c4('0x45')](db[_0x49c4('0x2d')][_0x49c4('0x2e')]);_0x117151[_0x49c4('0x33')]=_[_0x49c4('0x45')](_0x20490b[_0x49c4('0x33')]);_0x117151[_0x49c4('0x34')]=_[_0x49c4('0x35')](_0x117151['model'],_0x117151[_0x49c4('0x33')]);_0x38349b['attributes']=_[_0x49c4('0x35')](_0x117151[_0x49c4('0x31')],qs[_0x49c4('0x37')](_0x20490b[_0x49c4('0x33')][_0x49c4('0x37')]));_0x38349b['attributes']=_0x38349b[_0x49c4('0x36')][_0x49c4('0x38')]?_0x38349b[_0x49c4('0x36')]:_0x117151[_0x49c4('0x31')];if(_0x20490b[_0x49c4('0x33')][_0x49c4('0x42')]){_0x38349b[_0x49c4('0x46')]=[{'all':!![]}];}_0x38349b=_['merge']({},_0x38349b,_0x20490b[_0x49c4('0x41')]);return db['Tag'][_0x49c4('0x47')](_0x38349b)[_0x49c4('0x26')](handleEntityNotFound(_0x1e7bdc,null))[_0x49c4('0x26')](respondWithResult(_0x1e7bdc,null))[_0x49c4('0x48')](handleError(_0x1e7bdc,null));};exports[_0x49c4('0x49')]=function(_0x30bea5,_0x2c6be1){return db['Tag'][_0x49c4('0x49')](_0x30bea5[_0x49c4('0x4a')],{})['then'](function(_0x1e1ac4){var _0xaece5f=_0x30bea5[_0x49c4('0x4b')][_0x49c4('0x24')]({'plain':!![]});if(!_0xaece5f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xaece5f['role']===_0x49c4('0x4b')){var _0x4e8221=_0x1e1ac4[_0x49c4('0x24')]({'plain':!![]});var _0x1f941f=_0x49c4('0x4c');return db[_0x49c4('0x4d')][_0x49c4('0x47')]({'where':{'name':_0x1f941f,'userProfileId':_0xaece5f[_0x49c4('0x4e')]},'raw':!![]})[_0x49c4('0x26')](function(_0x563f0b){if(_0x563f0b&&_0x563f0b[_0x49c4('0x4f')]===0x0){return db[_0x49c4('0x25')][_0x49c4('0x49')]({'name':_0x4e8221[_0x49c4('0x2a')],'resourceId':_0x4e8221['id'],'type':_0x563f0b[_0x49c4('0x2a')],'sectionId':_0x563f0b['id']},{})[_0x49c4('0x26')](function(){return _0x1e1ac4;});}else{return _0x1e1ac4;}})[_0x49c4('0x48')](function(_0x25d174){logger[_0x49c4('0x28')](_0x49c4('0x50'),_0x25d174);throw _0x25d174;});}return _0x1e1ac4;})['then'](respondWithResult(_0x2c6be1,0xc9))['catch'](handleError(_0x2c6be1,null));};exports[_0x49c4('0x22')]=function(_0x3f9a9d,_0x527e74){if(_0x3f9a9d['body']['id']){delete _0x3f9a9d[_0x49c4('0x4a')]['id'];}return db['Tag']['find']({'where':{'id':_0x3f9a9d[_0x49c4('0x51')]['id']}})[_0x49c4('0x26')](handleEntityNotFound(_0x527e74,null))[_0x49c4('0x26')](saveUpdates(_0x3f9a9d[_0x49c4('0x4a')],null))[_0x49c4('0x26')](respondWithResult(_0x527e74,null))[_0x49c4('0x48')](handleError(_0x527e74,null));};exports[_0x49c4('0x23')]=function(_0x50798e,_0x859dde){return db[_0x49c4('0x2d')][_0x49c4('0x47')]({'where':{'id':_0x50798e[_0x49c4('0x51')]['id']}})[_0x49c4('0x26')](handleEntityNotFound(_0x859dde,null))[_0x49c4('0x26')](removeEntity(_0x859dde,null))['catch'](handleError(_0x859dde,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index a62d9ca..281fd0e 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 _0xdc52=['bluebird','rimraf','./tag.attributes','Tag','lodash','util','../../config/logger','api','moment'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0xdc52,0x1bd));var _0x2dc5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdc52[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2dc5('0x0'));var util=require(_0x2dc5('0x1'));var logger=require(_0x2dc5('0x2'))(_0x2dc5('0x3'));var moment=require(_0x2dc5('0x4'));var BPromise=require(_0x2dc5('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x2dc5('0x6'));var config=require('../../config/environment');var attributes=require(_0x2dc5('0x7'));module['exports']=function(_0x3801c8,_0x45c137){return _0x3801c8['define'](_0x2dc5('0x8'),attributes,{'tableName':'tools_tags','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd887=['rimraf','./tag.attributes','exports','define','tools_tags','lodash','util','api','bluebird','request-promise'];(function(_0x563692,_0x428494){var _0x78b79b=function(_0x3e94cf){while(--_0x3e94cf){_0x563692['push'](_0x563692['shift']());}};_0x78b79b(++_0x428494);}(_0xd887,0x131));var _0x7d88=function(_0x7430b4,_0x3526ec){_0x7430b4=_0x7430b4-0x0;var _0x44bbd5=_0xd887[_0x7430b4];return _0x44bbd5;};'use strict';var _=require(_0x7d88('0x0'));var util=require(_0x7d88('0x1'));var logger=require('../../config/logger')(_0x7d88('0x2'));var moment=require('moment');var BPromise=require(_0x7d88('0x3'));var rp=require(_0x7d88('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7d88('0x5'));var config=require('../../config/environment');var attributes=require(_0x7d88('0x6'));module[_0x7d88('0x7')]=function(_0x2a896d,_0x1456c6){return _0x2a896d[_0x7d88('0x8')]('Tag',attributes,{'tableName':_0x7d88('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 27e7ee2..b6bb2b2 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 _0x32ef=['util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Tag,\x20%s,\x20%s','debug','Tag,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash'];(function(_0x5954fb,_0x367540){var _0x43eee8=function(_0x2e308d){while(--_0x2e308d){_0x5954fb['push'](_0x5954fb['shift']());}};_0x43eee8(++_0x367540);}(_0x32ef,0xf9));var _0xf32e=function(_0x9858b,_0x511caf){_0x9858b=_0x9858b-0x0;var _0x47a210=_0x32ef[_0x9858b];return _0x47a210;};'use strict';var _=require(_0xf32e('0x0'));var util=require(_0xf32e('0x1'));var moment=require(_0xf32e('0x2'));var BPromise=require(_0xf32e('0x3'));var rs=require(_0xf32e('0x4'));var fs=require('fs');var Redis=require(_0xf32e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xf32e('0x6'));var logger=require(_0xf32e('0x7'))('rpc');var config=require(_0xf32e('0x8'));var jayson=require(_0xf32e('0x9'));var client=jayson[_0xf32e('0xa')][_0xf32e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xefc0a7,_0x899efc,_0x5aa5c8){return new BPromise(function(_0xdac5e,_0x5b3463){return client[_0xf32e('0xc')](_0xefc0a7,_0x5aa5c8)[_0xf32e('0xd')](function(_0xc37ea7){logger[_0xf32e('0xe')](_0xf32e('0xf'),_0x899efc,'request\x20sent');logger[_0xf32e('0x10')](_0xf32e('0x11'),_0x899efc,_0xf32e('0x12'),JSON[_0xf32e('0x13')](_0xc37ea7));if(_0xc37ea7[_0xf32e('0x14')]){if(_0xc37ea7[_0xf32e('0x14')][_0xf32e('0x15')]===0x1f4){logger[_0xf32e('0x14')](_0xf32e('0xf'),_0x899efc,_0xc37ea7[_0xf32e('0x14')][_0xf32e('0x16')]);return _0x5b3463(_0xc37ea7['error'][_0xf32e('0x16')]);}logger[_0xf32e('0x14')](_0xf32e('0xf'),_0x899efc,_0xc37ea7[_0xf32e('0x14')][_0xf32e('0x16')]);return _0xdac5e(_0xc37ea7[_0xf32e('0x14')]['message']);}else{logger[_0xf32e('0xe')](_0xf32e('0xf'),_0x899efc,_0xf32e('0x12'));_0xdac5e(_0xc37ea7[_0xf32e('0x17')][_0xf32e('0x16')]);}})[_0xf32e('0x18')](function(_0x6a0231){logger[_0xf32e('0x14')](_0xf32e('0xf'),_0x899efc,_0x6a0231);_0x5b3463(_0x6a0231);});});} \ No newline at end of file +var _0x89c3=['jayson/promise','request','then','info','Tag,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x89c3,0xff));var _0x389c=function(_0x4abffe,_0x1f961e){_0x4abffe=_0x4abffe-0x0;var _0x2b3c9c=_0x89c3[_0x4abffe];return _0x2b3c9c;};'use strict';var _=require(_0x389c('0x0'));var util=require(_0x389c('0x1'));var moment=require(_0x389c('0x2'));var BPromise=require(_0x389c('0x3'));var rs=require(_0x389c('0x4'));var fs=require('fs');var Redis=require(_0x389c('0x5'));var db=require(_0x389c('0x6'))['db'];var utils=require(_0x389c('0x7'));var logger=require('../../config/logger')(_0x389c('0x8'));var config=require('../../config/environment');var jayson=require(_0x389c('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2f3e3f,_0x4a83ab,_0x58bf11){return new BPromise(function(_0x33cb72,_0x41b63b){return client[_0x389c('0xa')](_0x2f3e3f,_0x58bf11)[_0x389c('0xb')](function(_0x41c92b){logger[_0x389c('0xc')](_0x389c('0xd'),_0x4a83ab,_0x389c('0xe'));logger[_0x389c('0xf')]('Tag,\x20%s,\x20%s,\x20%s',_0x4a83ab,_0x389c('0xe'),JSON[_0x389c('0x10')](_0x41c92b));if(_0x41c92b[_0x389c('0x11')]){if(_0x41c92b[_0x389c('0x11')][_0x389c('0x12')]===0x1f4){logger['error']('Tag,\x20%s,\x20%s',_0x4a83ab,_0x41c92b[_0x389c('0x11')][_0x389c('0x13')]);return _0x41b63b(_0x41c92b[_0x389c('0x11')]['message']);}logger[_0x389c('0x11')]('Tag,\x20%s,\x20%s',_0x4a83ab,_0x41c92b[_0x389c('0x11')][_0x389c('0x13')]);return _0x33cb72(_0x41c92b['error'][_0x389c('0x13')]);}else{logger[_0x389c('0xc')](_0x389c('0xd'),_0x4a83ab,'request\x20sent');_0x33cb72(_0x41c92b[_0x389c('0x14')][_0x389c('0x13')]);}})[_0x389c('0x15')](function(_0x3d6099){logger[_0x389c('0x11')]('Tag,\x20%s,\x20%s',_0x4a83ab,_0x3d6099);_0x41b63b(_0x3d6099);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 1947fb1..6ff2bf0 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(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xa9e0[_0x13ea00];return _0x1f7347;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['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(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0xa9e0[_0x1da04e];return _0xdd8c41;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['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 5cabb9d..4f75e2b 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 _0xe706=['STRING','sequelize','exports'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xe706,0xa3));var _0x6e70=function(_0x4a82ac,_0x1fb931){_0x4a82ac=_0x4a82ac-0x0;var _0x58ee97=_0xe706[_0x4a82ac];return _0x58ee97;};'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 _0x0713=['STRING','name'];(function(_0x9a9ce8,_0x391ac1){var _0x219a55=function(_0x263431){while(--_0x263431){_0x9a9ce8['push'](_0x9a9ce8['shift']());}};_0x219a55(++_0x391ac1);}(_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 diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index f21483c..565a2fa 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 _0xf693=['filter','where','VIRTUAL','options','includeAll','include','rows','catch','show','params','rawAttributes','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','destroy','sequelize','Sequelize','QueryTypes','SELECT','UserId','VoiceQueueId','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','UserSmsQueue','ChatQueueId','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','Teams','getQueues','channel','ValidationError','keys','capitalize','toLowerCase','Queue','order','merge','Queues','findOne','isValidChannel','add','ids','removeQueues','Unknown\x20channel','remove','addAgents','isArray','Chat','Mail','Sms','Fax','Openchannel','Whatsapp','transaction','QueueId','Voice','TeamVoiceQueue','penalty','findOrCreate','emit','Queue:save','User','online','interface','upsert','isNil','format','SIP/%s','voicePause','all','spread','removeAgents','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','fs-extra','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./team.socket','register','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','then','error','name','send','index','map','Team','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','pick'];(function(_0x4575e2,_0x261c32){var _0x8df84a=function(_0x42965c){while(--_0x42965c){_0x4575e2['push'](_0x4575e2['shift']());}};_0x8df84a(++_0x261c32);}(_0xf693,0xf6));var _0x3f69=function(_0x128819,_0x853b10){_0x128819=_0x128819-0x0;var _0x82624f=_0xf693[_0x128819];return _0x82624f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3f69('0x0'));var zipdir=require(_0x3f69('0x1'));var jsonpatch=require(_0x3f69('0x2'));var rp=require(_0x3f69('0x3'));var moment=require(_0x3f69('0x4'));var BPromise=require(_0x3f69('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x3f69('0x6'));var sox=require(_0x3f69('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3f69('0x8'));var _=require(_0x3f69('0x9'));var squel=require('squel');var crypto=require(_0x3f69('0xa'));var jsforce=require(_0x3f69('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x3f69('0xc'));var querystring=require(_0x3f69('0xd'));var Papa=require(_0x3f69('0xe'));var Redis=require(_0x3f69('0xf'));var authService=require(_0x3f69('0x10'));var qs=require(_0x3f69('0x11'));var as=require(_0x3f69('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3f69('0x13'))(_0x3f69('0x14'));var utils=require(_0x3f69('0x15'));var config=require(_0x3f69('0x16'));var licenseUtil=require(_0x3f69('0x17'));var db=require('../../mysqldb')['db'];config[_0x3f69('0x18')]=_[_0x3f69('0x19')](config[_0x3f69('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x3f69('0x1a'))(new Redis(config[_0x3f69('0x18')]));require(_0x3f69('0x1b'))[_0x3f69('0x1c')](socket);function respondWithStatusCode(_0x27e198,_0x225ff3){_0x225ff3=_0x225ff3||0xcc;return function(_0x44be21){if(_0x44be21){return _0x27e198[_0x3f69('0x1d')](_0x225ff3);}return _0x27e198[_0x3f69('0x1e')](_0x225ff3)[_0x3f69('0x1f')]();};}function respondWithResult(_0x1de2cf,_0x295640){_0x295640=_0x295640||0xc8;return function(_0x15556f){if(_0x15556f){return _0x1de2cf[_0x3f69('0x1e')](_0x295640)[_0x3f69('0x20')](_0x15556f);}};}function respondWithFilteredResult(_0x504517,_0xbe02e9){return function(_0x12fa77){if(_0x12fa77){var _0x3f0512=typeof _0xbe02e9['offset']===_0x3f69('0x21')&&typeof _0xbe02e9[_0x3f69('0x22')]===_0x3f69('0x21');var _0x671c23=_0x12fa77['count'];var _0x213197=_0x3f0512?0x0:_0xbe02e9[_0x3f69('0x23')];var _0x407e61=_0x3f0512?_0x12fa77[_0x3f69('0x24')]:_0xbe02e9[_0x3f69('0x23')]+_0xbe02e9[_0x3f69('0x22')];var _0x364546;if(_0x407e61>=_0x671c23){_0x407e61=_0x671c23;_0x364546=0xc8;}else{_0x364546=0xce;}_0x504517[_0x3f69('0x1e')](_0x364546);return _0x504517[_0x3f69('0x25')](_0x3f69('0x26'),_0x213197+'-'+_0x407e61+'/'+_0x671c23)[_0x3f69('0x20')](_0x12fa77);}return null;};}function patchUpdates(_0x3b69b6){return function(_0x1685ba){try{jsonpatch[_0x3f69('0x27')](_0x1685ba,_0x3b69b6,!![]);}catch(_0xe1cf47){return BPromise[_0x3f69('0x28')](_0xe1cf47);}return _0x1685ba[_0x3f69('0x29')]();};}function saveUpdates(_0x140bc8,_0x594298){return function(_0x47a179){if(_0x47a179){return _0x47a179['update'](_0x140bc8)[_0x3f69('0x2a')](function(_0x3ffd4e){return _0x3ffd4e;});}return null;};}function handleEntityNotFound(_0x22eeed,_0x5dbcbd){return function(_0x5e9734){if(!_0x5e9734){_0x22eeed['sendStatus'](0x194);}return _0x5e9734;};}function handleError(_0x141342,_0x36e95d){_0x36e95d=_0x36e95d||0x1f4;return function(_0x4c183b){logger[_0x3f69('0x2b')](_0x4c183b['stack']);if(_0x4c183b[_0x3f69('0x2c')]){delete _0x4c183b[_0x3f69('0x2c')];}_0x141342[_0x3f69('0x1e')](_0x36e95d)[_0x3f69('0x2d')](_0x4c183b);};}exports[_0x3f69('0x2e')]=function(_0x3eedd8,_0x1e1e4e){var _0x99d0ea={},_0x4a281e={},_0x6fcd0f={'count':0x0,'rows':[]};var _0x1db577=_[_0x3f69('0x2f')](db[_0x3f69('0x30')]['rawAttributes'],function(_0x15243b){return{'name':_0x15243b['fieldName'],'type':_0x15243b[_0x3f69('0x31')][_0x3f69('0x32')]};});_0x4a281e['model']=_['map'](_0x1db577,_0x3f69('0x2c'));_0x4a281e[_0x3f69('0x33')]=_['keys'](_0x3eedd8[_0x3f69('0x33')]);_0x4a281e[_0x3f69('0x34')]=_[_0x3f69('0x35')](_0x4a281e[_0x3f69('0x36')],_0x4a281e[_0x3f69('0x33')]);_0x99d0ea['attributes']=_['intersection'](_0x4a281e['model'],qs[_0x3f69('0x37')](_0x3eedd8[_0x3f69('0x33')][_0x3f69('0x37')]));_0x99d0ea[_0x3f69('0x38')]=_0x99d0ea[_0x3f69('0x38')][_0x3f69('0x39')]?_0x99d0ea[_0x3f69('0x38')]:_0x4a281e[_0x3f69('0x36')];if(!_0x3eedd8['query'][_0x3f69('0x3a')](_0x3f69('0x3b'))){_0x99d0ea[_0x3f69('0x22')]=qs[_0x3f69('0x22')](_0x3eedd8[_0x3f69('0x33')][_0x3f69('0x22')]);_0x99d0ea[_0x3f69('0x23')]=qs[_0x3f69('0x23')](_0x3eedd8['query']['offset']);}_0x99d0ea['order']=qs[_0x3f69('0x3c')](_0x3eedd8['query']['sort']);_0x99d0ea['where']=qs['filters'](_[_0x3f69('0x3d')](_0x3eedd8[_0x3f69('0x33')],_0x4a281e[_0x3f69('0x34')]),_0x1db577);if(_0x3eedd8[_0x3f69('0x33')][_0x3f69('0x3e')]){_0x99d0ea[_0x3f69('0x3f')]=_['merge'](_0x99d0ea['where'],{'$or':_['map'](_0x1db577,function(_0x53ac67){if(_0x53ac67[_0x3f69('0x31')]!==_0x3f69('0x40')){var _0x2c7fab={};_0x2c7fab[_0x53ac67[_0x3f69('0x2c')]]={'$like':'%'+_0x3eedd8[_0x3f69('0x33')][_0x3f69('0x3e')]+'%'};return _0x2c7fab;}})});}_0x99d0ea=_['merge']({},_0x99d0ea,_0x3eedd8[_0x3f69('0x41')]);var _0x22489f={'where':_0x99d0ea[_0x3f69('0x3f')]};return db['Team']['count'](_0x22489f)[_0x3f69('0x2a')](function(_0x339c15){_0x6fcd0f[_0x3f69('0x24')]=_0x339c15;if(_0x3eedd8['query'][_0x3f69('0x42')]){_0x99d0ea[_0x3f69('0x43')]=[{'all':!![]}];}return db[_0x3f69('0x30')]['findAll'](_0x99d0ea);})[_0x3f69('0x2a')](function(_0x23814a){_0x6fcd0f[_0x3f69('0x44')]=_0x23814a;return _0x6fcd0f;})['then'](respondWithFilteredResult(_0x1e1e4e,_0x99d0ea))[_0x3f69('0x45')](handleError(_0x1e1e4e,null));};exports[_0x3f69('0x46')]=function(_0x38f7c1,_0x22e587){var _0x5e237b={'raw':![],'where':{'id':_0x38f7c1[_0x3f69('0x47')]['id']}},_0x51ae9f={};_0x51ae9f[_0x3f69('0x36')]=_['keys'](db[_0x3f69('0x30')][_0x3f69('0x48')]);_0x51ae9f['query']=_['keys'](_0x38f7c1[_0x3f69('0x33')]);_0x51ae9f[_0x3f69('0x34')]=_[_0x3f69('0x35')](_0x51ae9f[_0x3f69('0x36')],_0x51ae9f[_0x3f69('0x33')]);_0x5e237b[_0x3f69('0x38')]=_[_0x3f69('0x35')](_0x51ae9f[_0x3f69('0x36')],qs[_0x3f69('0x37')](_0x38f7c1['query']['fields']));_0x5e237b[_0x3f69('0x38')]=_0x5e237b[_0x3f69('0x38')][_0x3f69('0x39')]?_0x5e237b[_0x3f69('0x38')]:_0x51ae9f[_0x3f69('0x36')];if(_0x38f7c1[_0x3f69('0x33')][_0x3f69('0x42')]){_0x5e237b['include']=[{'all':!![]}];}_0x5e237b=_['merge']({},_0x5e237b,_0x38f7c1[_0x3f69('0x41')]);return db['Team'][_0x3f69('0x49')](_0x5e237b)[_0x3f69('0x2a')](handleEntityNotFound(_0x22e587,null))[_0x3f69('0x2a')](respondWithResult(_0x22e587,null))[_0x3f69('0x45')](handleError(_0x22e587,null));};exports[_0x3f69('0x4a')]=function(_0x3f9fb5,_0x4dc616){return db[_0x3f69('0x30')][_0x3f69('0x4a')](_0x3f9fb5[_0x3f69('0x4b')],{})[_0x3f69('0x2a')](function(_0x2ab12d){var _0x2c9285=_0x3f9fb5[_0x3f69('0x4c')][_0x3f69('0x4d')]({'plain':!![]});if(!_0x2c9285)throw new Error(_0x3f69('0x4e'));if(_0x2c9285['role']===_0x3f69('0x4c')){var _0x4a0616=_0x2ab12d[_0x3f69('0x4d')]({'plain':!![]});var _0x16613f='Teams';return db[_0x3f69('0x4f')][_0x3f69('0x49')]({'where':{'name':_0x16613f,'userProfileId':_0x2c9285[_0x3f69('0x50')]},'raw':!![]})[_0x3f69('0x2a')](function(_0x4bd477){if(_0x4bd477&&_0x4bd477[_0x3f69('0x51')]===0x0){return db[_0x3f69('0x52')][_0x3f69('0x4a')]({'name':_0x4a0616['name'],'resourceId':_0x4a0616['id'],'type':_0x4bd477[_0x3f69('0x2c')],'sectionId':_0x4bd477['id']},{})['then'](function(){return _0x2ab12d;});}else{return _0x2ab12d;}})['catch'](function(_0x58fa57){logger[_0x3f69('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x58fa57);throw _0x58fa57;});}return _0x2ab12d;})[_0x3f69('0x2a')](respondWithResult(_0x4dc616,0xc9))['catch'](handleError(_0x4dc616,null));};exports['update']=function(_0x3251a0,_0x470cb8){if(_0x3251a0[_0x3f69('0x4b')]['id']){delete _0x3251a0[_0x3f69('0x4b')]['id'];}return db[_0x3f69('0x30')][_0x3f69('0x49')]({'where':{'id':_0x3251a0[_0x3f69('0x47')]['id']}})[_0x3f69('0x2a')](handleEntityNotFound(_0x470cb8,null))[_0x3f69('0x2a')](saveUpdates(_0x3251a0[_0x3f69('0x4b')],null))[_0x3f69('0x2a')](respondWithResult(_0x470cb8,null))[_0x3f69('0x45')](handleError(_0x470cb8,null));};exports[_0x3f69('0x53')]=function(_0x79164,_0x4f7003){var _0x4e3850=_0x79164[_0x3f69('0x47')]['id'];var _0x1b87e0=[];return db[_0x3f69('0x54')]['transaction'](function(_0x392808){var _0x28b9e6='SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20'+_0x4e3850;return db[_0x3f69('0x54')][_0x3f69('0x33')](_0x28b9e6,{'type':db[_0x3f69('0x55')][_0x3f69('0x56')][_0x3f69('0x57')],'raw':!![],'transaction':_0x392808})[_0x3f69('0x2a')](function(_0x51ee6d){_0x1b87e0=_[_0x3f69('0x2f')](_0x51ee6d,function(_0x3c0171){return Number(_0x3c0171[_0x3f69('0x58')]);});})[_0x3f69('0x2a')](function(){var _0x5414b2='SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20'+_0x4e3850;return db[_0x3f69('0x54')]['query'](_0x5414b2,{'type':db[_0x3f69('0x55')][_0x3f69('0x56')][_0x3f69('0x57')],'raw':!![],'transaction':_0x392808});})['then'](function(_0x3ac749){var _0x4e6d52=_[_0x3f69('0x2f')](_0x3ac749,function(_0x41a0a1){return Number(_0x41a0a1[_0x3f69('0x59')]);});return db[_0x3f69('0x5a')][_0x3f69('0x53')]({'where':{'UserId':{'$in':_0x1b87e0},'VoiceQueueId':{'$in':_0x4e6d52}},'transaction':_0x392808});})[_0x3f69('0x2a')](function(){var _0x745a2c=_0x3f69('0x5b')+_0x4e3850;return db['sequelize'][_0x3f69('0x33')](_0x745a2c,{'type':db[_0x3f69('0x55')][_0x3f69('0x56')]['SELECT'],'raw':!![],'transaction':_0x392808});})['then'](function(_0x18e893){var _0x57baae=_[_0x3f69('0x2f')](_0x18e893,function(_0x39392f){return Number(_0x39392f['MailQueueId']);});return db[_0x3f69('0x5c')][_0x3f69('0x53')]({'where':{'UserId':{'$in':_0x1b87e0},'MailQueueId':{'$in':_0x57baae}},'transaction':_0x392808});})[_0x3f69('0x2a')](function(){var _0x3c958b=_0x3f69('0x5d')+_0x4e3850;return db[_0x3f69('0x54')][_0x3f69('0x33')](_0x3c958b,{'type':db['Sequelize'][_0x3f69('0x56')]['SELECT'],'raw':!![],'transaction':_0x392808});})[_0x3f69('0x2a')](function(_0x2c6960){var _0x1975c1=_[_0x3f69('0x2f')](_0x2c6960,function(_0x1be8dd){return Number(_0x1be8dd[_0x3f69('0x5e')]);});return db[_0x3f69('0x5f')]['destroy']({'where':{'UserId':{'$in':_0x1b87e0},'SmsQueueId':{'$in':_0x1975c1}},'transaction':_0x392808});})[_0x3f69('0x2a')](function(){var _0x3d69f4='SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20'+_0x4e3850;return db[_0x3f69('0x54')][_0x3f69('0x33')](_0x3d69f4,{'type':db[_0x3f69('0x55')][_0x3f69('0x56')][_0x3f69('0x57')],'raw':!![],'transaction':_0x392808});})[_0x3f69('0x2a')](function(_0x102f41){var _0x280551=_['map'](_0x102f41,function(_0x3dc7aa){return Number(_0x3dc7aa[_0x3f69('0x60')]);});return db[_0x3f69('0x61')][_0x3f69('0x53')]({'where':{'UserId':{'$in':_0x1b87e0},'ChatQueueId':{'$in':_0x280551}},'transaction':_0x392808});})[_0x3f69('0x2a')](function(){var _0x1d47d1=_0x3f69('0x62')+_0x4e3850;return db[_0x3f69('0x54')]['query'](_0x1d47d1,{'type':db[_0x3f69('0x55')][_0x3f69('0x56')]['SELECT'],'raw':!![],'transaction':_0x392808});})[_0x3f69('0x2a')](function(_0x4a134d){var _0x3acfda=_[_0x3f69('0x2f')](_0x4a134d,function(_0x1cf34c){return Number(_0x1cf34c[_0x3f69('0x63')]);});return db[_0x3f69('0x64')]['destroy']({'where':{'UserId':{'$in':_0x1b87e0},'FaxQueueId':{'$in':_0x3acfda}},'transaction':_0x392808});})[_0x3f69('0x2a')](function(){var _0x1807de=_0x3f69('0x65')+_0x4e3850;return db[_0x3f69('0x54')][_0x3f69('0x33')](_0x1807de,{'type':db[_0x3f69('0x55')]['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x392808});})[_0x3f69('0x2a')](function(_0x34bf42){var _0xb6c528=_[_0x3f69('0x2f')](_0x34bf42,function(_0x1c6887){return Number(_0x1c6887['OpenchannelQueueId']);});return db['UserOpenchannelQueue'][_0x3f69('0x53')]({'where':{'UserId':{'$in':_0x1b87e0},'OpenchannelQueueId':{'$in':_0xb6c528}},'transaction':_0x392808});})[_0x3f69('0x2a')](function(){var _0x394e31=_0x3f69('0x66')+_0x4e3850;return db[_0x3f69('0x54')][_0x3f69('0x33')](_0x394e31,{'type':db['Sequelize']['QueryTypes'][_0x3f69('0x57')],'raw':!![],'transaction':_0x392808});})[_0x3f69('0x2a')](function(_0x8155d8){var _0x161d5c=_['map'](_0x8155d8,function(_0x2c8a65){return Number(_0x2c8a65[_0x3f69('0x67')]);});return db[_0x3f69('0x68')]['destroy']({'where':{'UserId':{'$in':_0x1b87e0},'WhatsappQueueId':{'$in':_0x161d5c}},'transaction':_0x392808});})[_0x3f69('0x2a')](function(){return db[_0x3f69('0x69')][_0x3f69('0x49')]({'where':{'TeamId':_0x4e3850}});})['then'](function(_0x23ac8f){if(_0x23ac8f===null){return;}return db[_0x3f69('0x6a')][_0x3f69('0x53')]({'where':{'UserId':{'$in':_0x1b87e0},'VoicePrefixId':_0x23ac8f[_0x3f69('0x6b')]},'transaction':_0x392808});})['then'](function(){return db[_0x3f69('0x30')][_0x3f69('0x53')]({'where':{'id':_0x4e3850},'cascade':!![],'transaction':_0x392808});})[_0x3f69('0x2a')](function(_0x35101c){if(_0x35101c===0x0){_0x4f7003[_0x3f69('0x1d')](0x194);}else{return db[_0x3f69('0x52')]['destroy']({'where':{'type':_0x3f69('0x6c'),'resourceId':_0x4e3850},'cascade':!![],'transaction':_0x392808})[_0x3f69('0x2a')](function(){_0x4f7003[_0x3f69('0x1e')](0xcc)[_0x3f69('0x1f')]();});}})['catch'](function(_0x44022b){_0x4f7003[_0x3f69('0x1e')](0x1f4)[_0x3f69('0x2d')](_0x44022b);});});};exports[_0x3f69('0x6d')]=function(_0x12e2ac,_0x54354f,_0x1acec4){return db[_0x3f69('0x30')]['findOne']({'where':{'id':_0x12e2ac['params']['id']}})['then'](handleEntityNotFound(_0x54354f,null))[_0x3f69('0x2a')](function(_0x51cb4c){if(!_0x12e2ac['query'][_0x3f69('0x6e')]||!utils['isValidChannel'](_0x12e2ac[_0x3f69('0x33')][_0x3f69('0x6e')])){throw new db[(_0x3f69('0x55'))][(_0x3f69('0x6f'))]('Unknown\x20channel');}var _0x2d6df8={};var _0x5188b3={};_0x5188b3[_0x3f69('0x36')]=_[_0x3f69('0x70')](db[_[_0x3f69('0x71')](_0x12e2ac[_0x3f69('0x33')][_0x3f69('0x6e')][_0x3f69('0x72')]())+_0x3f69('0x73')][_0x3f69('0x48')]);_0x5188b3['query']=_[_0x3f69('0x70')](_0x12e2ac[_0x3f69('0x33')]);_0x5188b3['filters']=_[_0x3f69('0x35')](_0x5188b3[_0x3f69('0x36')],_0x5188b3[_0x3f69('0x33')]);_0x2d6df8[_0x3f69('0x38')]=_[_0x3f69('0x35')](_0x5188b3[_0x3f69('0x36')],qs[_0x3f69('0x37')](_0x12e2ac['query'][_0x3f69('0x37')]));_0x2d6df8[_0x3f69('0x38')]=_0x2d6df8[_0x3f69('0x38')][_0x3f69('0x39')]?_0x2d6df8[_0x3f69('0x38')]:_0x5188b3[_0x3f69('0x36')];_0x2d6df8[_0x3f69('0x22')]=qs[_0x3f69('0x22')](_0x12e2ac[_0x3f69('0x33')]['limit']);_0x2d6df8[_0x3f69('0x23')]=qs['offset'](_0x12e2ac['query'][_0x3f69('0x23')]);_0x2d6df8[_0x3f69('0x74')]=qs['sort'](_0x12e2ac['query'][_0x3f69('0x3c')]);_0x2d6df8[_0x3f69('0x3f')]=qs[_0x3f69('0x34')](_[_0x3f69('0x3d')](_0x12e2ac[_0x3f69('0x33')],_0x5188b3[_0x3f69('0x34')]));_0x2d6df8=_[_0x3f69('0x75')]({},_0x2d6df8,_0x12e2ac[_0x3f69('0x41')]);return _0x51cb4c[_0x3f69('0x4d')+_['capitalize'](_0x12e2ac['query'][_0x3f69('0x6e')][_0x3f69('0x72')]())+_0x3f69('0x76')](_0x2d6df8);})['then'](respondWithResult(_0x54354f,null))['catch'](handleError(_0x54354f,null));};exports['addQueues']=function(_0x5f8662,_0x4fb4d0,_0x3ca580){return db[_0x3f69('0x30')][_0x3f69('0x77')]({'where':{'id':_0x5f8662[_0x3f69('0x47')]['id']}})['then'](function(_0x2dc937){if(_0x2dc937){if(!_0x5f8662['body'][_0x3f69('0x6e')]||!utils[_0x3f69('0x78')](_0x5f8662[_0x3f69('0x4b')]['channel'])){throw new db[(_0x3f69('0x55'))][(_0x3f69('0x6f'))]('Unknown\x20channel');}return _0x2dc937[_0x3f69('0x79')+_['capitalize'](_0x5f8662[_0x3f69('0x4b')][_0x3f69('0x6e')][_0x3f69('0x72')]())+_0x3f69('0x76')](_0x5f8662[_0x3f69('0x4b')][_0x3f69('0x7a')]);}return null;})[_0x3f69('0x2a')](handleEntityNotFound(_0x4fb4d0,null))[_0x3f69('0x2a')](respondWithStatusCode(_0x4fb4d0,null))[_0x3f69('0x45')](handleError(_0x4fb4d0,null));};exports[_0x3f69('0x7b')]=function(_0x3b4eb8,_0xe0d621,_0x5a7e39){return db[_0x3f69('0x30')]['findOne']({'where':{'id':_0x3b4eb8[_0x3f69('0x47')]['id']}})[_0x3f69('0x2a')](function(_0x26c7db){if(_0x26c7db){if(!_0x3b4eb8[_0x3f69('0x33')][_0x3f69('0x6e')]||!utils[_0x3f69('0x78')](_0x3b4eb8[_0x3f69('0x33')][_0x3f69('0x6e')])){throw new db[(_0x3f69('0x55'))]['ValidationError'](_0x3f69('0x7c'));}return _0x26c7db[_0x3f69('0x7d')+_['capitalize'](_0x3b4eb8[_0x3f69('0x33')][_0x3f69('0x6e')][_0x3f69('0x72')]())+_0x3f69('0x76')](_0x3b4eb8[_0x3f69('0x33')][_0x3f69('0x7a')]);}return null;})[_0x3f69('0x2a')](handleEntityNotFound(_0xe0d621,null))[_0x3f69('0x2a')](respondWithStatusCode(_0xe0d621,null))[_0x3f69('0x45')](handleError(_0xe0d621,null));};exports[_0x3f69('0x7e')]=function(_0x333ceb,_0x108909){var _0x1da847=_[_0x3f69('0x7f')](_0x333ceb[_0x3f69('0x4b')][_0x3f69('0x7a')])?_0x333ceb[_0x3f69('0x4b')]['ids']:[_0x333ceb['body'][_0x3f69('0x7a')]];var _0x315d05=_0x333ceb[_0x3f69('0x47')]['id'];return db[_0x3f69('0x30')]['find']({'where':{'id':_0x315d05}})[_0x3f69('0x2a')](handleEntityNotFound(_0x108909,null))[_0x3f69('0x2a')](function(_0x425e76){if(_0x425e76){var _0x28ca24=['Voice',_0x3f69('0x80'),_0x3f69('0x81'),_0x3f69('0x82'),_0x3f69('0x83'),_0x3f69('0x84'),_0x3f69('0x85')];return db[_0x3f69('0x54')][_0x3f69('0x86')](function(_0xa1106a){var _0x30acbf=_[_0x3f69('0x2f')](_0x28ca24,function(_0x40abae){var _0x5ea5b8={'attributes':['id','name']};if(_0x40abae==='Voice'){_0x5ea5b8['through']={'attributes':['penalty']};}return _0x425e76['get'+_0x40abae+_0x3f69('0x76')](_0x5ea5b8)[_0x3f69('0x2a')](function(_0x3ef32b){var _0x422f20=_[_0x3f69('0x2f')](_0x3ef32b,function(_0x1d8570){var _0x1ccf09=_[_0x3f69('0x2f')](_0x1da847,function(_0x54eb){var _0x2498dc={'where':{'UserId':_0x54eb,[_0x40abae+_0x3f69('0x87')]:_0x1d8570['id']},'transaction':_0xa1106a};if(_0x40abae===_0x3f69('0x88')){_0x2498dc['defaults']={'penalty':_0x1d8570[_0x3f69('0x89')][_0x3f69('0x8a')]};}return db['User'+_0x40abae+_0x3f69('0x73')][_0x3f69('0x8b')](_0x2498dc)[_0x3f69('0x2a')](function(){socket[_0x3f69('0x8c')]('user'+_0x40abae+_0x3f69('0x8d'),{'UserId':_0x54eb,[_0x40abae+_0x3f69('0x87')]:_0x1d8570['id']});if(_0x40abae!=='Voice'){return;}return db[_0x3f69('0x8e')]['findAll']({'where':{'id':_0x1da847,'online':0x1},'attributes':['id',_0x3f69('0x2c'),_0x3f69('0x8f'),'voicePause',_0x3f69('0x90')],'raw':!![]})[_0x3f69('0x2a')](function(_0x2c2af9){var _0x59111d=_[_0x3f69('0x2f')](_0x2c2af9,function(_0x1cfdef){return db['UserVoiceQueueRt'][_0x3f69('0x91')]({'membername':_0x1cfdef['name'],'UserId':_0x1cfdef['id'],'queue_name':_0x1d8570[_0x3f69('0x2c')],'VoiceQueueId':_0x1d8570['id'],'interface':_[_0x3f69('0x92')](_0x1cfdef[_0x3f69('0x90')])?util[_0x3f69('0x93')](_0x3f69('0x94'),_0x1cfdef[_0x3f69('0x2c')]):_0x1cfdef['interface'],'paused':_0x1cfdef[_0x3f69('0x95')]||![],'penalty':_0x1d8570[_0x3f69('0x89')]['penalty']},{'transaction':_0xa1106a});});return Promise[_0x3f69('0x96')](_0x59111d);});});});return Promise[_0x3f69('0x96')](_0x1ccf09);});return Promise['all'](_0x422f20);})[_0x3f69('0x2a')](function(){return db[_0x3f69('0x69')]['findOne']({'where':{'teamId':_0x315d05}})[_0x3f69('0x2a')](function(_0x6e5b16){if(_0x6e5b16){var _0x56b945=_[_0x3f69('0x2f')](_0x1da847,function(_0x481832){db[_0x3f69('0x6a')][_0x3f69('0x91')]({'UserId':_0x481832,'VoicePrefixId':_0x6e5b16[_0x3f69('0x6b')]});});return Promise[_0x3f69('0x96')](_0x56b945);}});});});return Promise[_0x3f69('0x96')](_0x30acbf)[_0x3f69('0x2a')](function(){return _0x425e76['addAgents'](_0x1da847,{'transaction':_0xa1106a})[_0x3f69('0x97')](function(_0x449f4b){return _0x449f4b;});});});}})[_0x3f69('0x2a')](respondWithResult(_0x108909,null))[_0x3f69('0x45')](handleError(_0x108909,null));};exports[_0x3f69('0x98')]=function(_0x30807b,_0x2cc26f){var _0x53320c=_[_0x3f69('0x7f')](_0x30807b[_0x3f69('0x33')][_0x3f69('0x7a')])?_0x30807b[_0x3f69('0x33')][_0x3f69('0x7a')]:[_0x30807b[_0x3f69('0x33')][_0x3f69('0x7a')]];var _0x2bb687=_0x30807b[_0x3f69('0x47')]['id'];return db[_0x3f69('0x30')]['find']({'where':{'id':_0x2bb687}})[_0x3f69('0x2a')](handleEntityNotFound(_0x2cc26f,null))[_0x3f69('0x2a')](function(_0x2f26f6){if(_0x2f26f6){var _0x20840a=[_0x3f69('0x88'),_0x3f69('0x80'),'Mail',_0x3f69('0x82'),_0x3f69('0x83'),'Openchannel',_0x3f69('0x85')];return db[_0x3f69('0x54')][_0x3f69('0x86')](function(_0x9ab6ca){var _0x230f7b=_[_0x3f69('0x2f')](_0x20840a,function(_0x5dc191){var _0x5d8226={'attributes':['id','name']};return _0x2f26f6[_0x3f69('0x4d')+_0x5dc191+_0x3f69('0x76')](_0x5d8226)[_0x3f69('0x2a')](function(_0xbb409d){var _0x165b11=_[_0x3f69('0x2f')](_0xbb409d,function(_0x3d8143){return _0x3d8143[_0x3f69('0x98')](_0x53320c,{'transaction':_0x9ab6ca})['then'](function(){var _0x330c70=_[_0x3f69('0x2f')](_0x53320c,function(_0x336387){socket[_0x3f69('0x8c')]('user'+_0x5dc191+'Queue:remove',{'UserId':Number(_0x336387),[_0x5dc191+_0x3f69('0x87')]:_0x3d8143['id']});if(_0x5dc191!=='Voice'){return;}return db['UserVoiceQueueRt'][_0x3f69('0x53')]({'where':{'VoiceQueueId':_0x3d8143['id'],'UserId':_0x336387},'transaction':_0x9ab6ca});});return Promise['all'](_0x330c70);});});return Promise[_0x3f69('0x96')](_0x165b11);});});return Promise[_0x3f69('0x96')](_0x230f7b)[_0x3f69('0x2a')](function(){return _0x2f26f6['removeAgents'](_0x53320c,{'transaction':_0x9ab6ca});})[_0x3f69('0x2a')](function(){return db['TeamVoicePrefix'][_0x3f69('0x77')]({'where':{'teamId':_0x2bb687}})[_0x3f69('0x2a')](function(_0x2e0ea5){if(_0x2e0ea5){var _0x3b3cc5=_[_0x3f69('0x2f')](_0x53320c,function(_0x577009){db[_0x3f69('0x6a')]['destroy']({'where':{'UserId':_0x577009,'VoicePrefixId':_0x2e0ea5[_0x3f69('0x6b')]}});});return Promise['all'](_0x3b3cc5);}});});});}})[_0x3f69('0x2a')](respondWithStatusCode(_0x2cc26f,null))[_0x3f69('0x45')](handleError(_0x2cc26f,null));};exports[_0x3f69('0x99')]=function(_0x2eb3ce,_0x4d6bef,_0xe7b078){var _0x298a1c={};var _0x4c18eb={};var _0x427078;var _0x433c7e;return db['Team'][_0x3f69('0x77')]({'where':{'id':_0x2eb3ce[_0x3f69('0x47')]['id']}})[_0x3f69('0x2a')](handleEntityNotFound(_0x4d6bef,null))['then'](function(_0xebe29f){if(_0xebe29f){_0x427078=_0xebe29f;_0x4c18eb[_0x3f69('0x36')]=_[_0x3f69('0x70')](db[_0x3f69('0x8e')]['rawAttributes']);_0x4c18eb[_0x3f69('0x33')]=_[_0x3f69('0x70')](_0x2eb3ce[_0x3f69('0x33')]);_0x4c18eb[_0x3f69('0x34')]=_[_0x3f69('0x35')](_0x4c18eb['model'],_0x4c18eb[_0x3f69('0x33')]);_0x298a1c[_0x3f69('0x38')]=_[_0x3f69('0x35')](_0x4c18eb['model'],qs[_0x3f69('0x37')](_0x2eb3ce[_0x3f69('0x33')][_0x3f69('0x37')]));_0x298a1c[_0x3f69('0x38')]=_0x298a1c[_0x3f69('0x38')][_0x3f69('0x39')]?_0x298a1c[_0x3f69('0x38')]:_0x4c18eb[_0x3f69('0x36')];_0x298a1c[_0x3f69('0x74')]=qs[_0x3f69('0x3c')](_0x2eb3ce['query']['sort']);_0x298a1c[_0x3f69('0x3f')]=qs[_0x3f69('0x34')](_[_0x3f69('0x3d')](_0x2eb3ce[_0x3f69('0x33')],_0x4c18eb[_0x3f69('0x34')]));if(_0x2eb3ce[_0x3f69('0x33')]['filter']){_0x298a1c[_0x3f69('0x3f')]=_[_0x3f69('0x75')](_0x298a1c[_0x3f69('0x3f')],{'$or':_['map'](_0x298a1c[_0x3f69('0x38')],function(_0x552679){var _0x40f726={};_0x40f726[_0x552679]={'$like':'%'+_0x2eb3ce['query'][_0x3f69('0x3e')]+'%'};return _0x40f726;})});}_0x298a1c=_['merge']({},_0x298a1c,_0x2eb3ce[_0x3f69('0x41')]);return _0x427078[_0x3f69('0x99')](_0x298a1c);}})['then'](function(_0x370539){if(_0x370539){_0x433c7e=_0x370539[_0x3f69('0x39')];if(!_0x2eb3ce['query']['hasOwnProperty'](_0x3f69('0x3b'))){_0x298a1c[_0x3f69('0x22')]=qs['limit'](_0x2eb3ce[_0x3f69('0x33')][_0x3f69('0x22')]);_0x298a1c[_0x3f69('0x23')]=qs[_0x3f69('0x23')](_0x2eb3ce['query'][_0x3f69('0x23')]);}return _0x427078[_0x3f69('0x99')](_0x298a1c);}})[_0x3f69('0x2a')](function(_0x8df405){if(_0x8df405){return _0x8df405?{'count':_0x433c7e,'rows':_0x8df405}:null;}})[_0x3f69('0x2a')](respondWithResult(_0x4d6bef,null))['catch'](handleError(_0x4d6bef,null));}; \ No newline at end of file +var _0xb867=['util','path','ejs','fs-extra','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','merge','VIRTUAL','Team','includeAll','include','findAll','rows','show','options','catch','create','body','role','Teams','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','sequelize','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','QueryTypes','SELECT','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','VoiceQueueId','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','destroy','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','getQueues','findOne','params','isValidChannel','channel','ValidationError','Unknown\x20channel','capitalize','Queue','pick','toLowerCase','Queues','addQueues','ids','removeQueues','remove','addAgents','Voice','Chat','Mail','Sms','Fax','Openchannel','Whatsapp','through','get','QueueId','TeamVoiceQueue','penalty','User','findOrCreate','emit','Queue:save','online','voicePause','interface','UserVoiceQueueRt','upsert','format','all','removeAgents','isArray','user','Queue:remove','filter','getAgents','hasOwnProperty','eml-format','rimraf','fast-json-patch','request-promise','moment'];(function(_0x3fe0ad,_0x3407b1){var _0x52de50=function(_0x1a2c6c){while(--_0x1a2c6c){_0x3fe0ad['push'](_0x3fe0ad['shift']());}};_0x52de50(++_0x3407b1);}(_0xb867,0x137));var _0x7b86=function(_0x37a2b9,_0x375682){_0x37a2b9=_0x37a2b9-0x0;var _0x1e6709=_0xb867[_0x37a2b9];return _0x1e6709;};'use strict';var emlformat=require(_0x7b86('0x0'));var rimraf=require(_0x7b86('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7b86('0x2'));var rp=require(_0x7b86('0x3'));var moment=require(_0x7b86('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7b86('0x5'));var path=require(_0x7b86('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7b86('0x7'));var fs=require('fs');var fs_extra=require(_0x7b86('0x8'));var _=require(_0x7b86('0x9'));var squel=require('squel');var crypto=require(_0x7b86('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x7b86('0xb'));var toCsv=require(_0x7b86('0xc'));var querystring=require(_0x7b86('0xd'));var Papa=require(_0x7b86('0xe'));var Redis=require(_0x7b86('0xf'));var authService=require(_0x7b86('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x7b86('0x11'));var hardwareService=require(_0x7b86('0x12'));var logger=require('../../config/logger')(_0x7b86('0x13'));var utils=require(_0x7b86('0x14'));var config=require(_0x7b86('0x15'));var licenseUtil=require(_0x7b86('0x16'));var db=require(_0x7b86('0x17'))['db'];config[_0x7b86('0x18')]=_[_0x7b86('0x19')](config['redis'],{'host':_0x7b86('0x1a'),'port':0x18eb});var socket=require(_0x7b86('0x1b'))(new Redis(config[_0x7b86('0x18')]));require('./team.socket')[_0x7b86('0x1c')](socket);function respondWithStatusCode(_0x30f2a5,_0x4c81af){_0x4c81af=_0x4c81af||0xcc;return function(_0x119c39){if(_0x119c39){return _0x30f2a5[_0x7b86('0x1d')](_0x4c81af);}return _0x30f2a5[_0x7b86('0x1e')](_0x4c81af)[_0x7b86('0x1f')]();};}function respondWithResult(_0x2cdd0b,_0x76c13f){_0x76c13f=_0x76c13f||0xc8;return function(_0x3ad169){if(_0x3ad169){return _0x2cdd0b['status'](_0x76c13f)['json'](_0x3ad169);}};}function respondWithFilteredResult(_0x5092c0,_0x160a17){return function(_0x1c3647){if(_0x1c3647){var _0x376947=typeof _0x160a17['offset']===_0x7b86('0x20')&&typeof _0x160a17[_0x7b86('0x21')]==='undefined';var _0x2b08ba=_0x1c3647[_0x7b86('0x22')];var _0x4a74e0=_0x376947?0x0:_0x160a17['offset'];var _0x516254=_0x376947?_0x1c3647[_0x7b86('0x22')]:_0x160a17[_0x7b86('0x23')]+_0x160a17[_0x7b86('0x21')];var _0x5a229c;if(_0x516254>=_0x2b08ba){_0x516254=_0x2b08ba;_0x5a229c=0xc8;}else{_0x5a229c=0xce;}_0x5092c0[_0x7b86('0x1e')](_0x5a229c);return _0x5092c0[_0x7b86('0x24')](_0x7b86('0x25'),_0x4a74e0+'-'+_0x516254+'/'+_0x2b08ba)[_0x7b86('0x26')](_0x1c3647);}return null;};}function patchUpdates(_0x183f82){return function(_0x3baded){try{jsonpatch[_0x7b86('0x27')](_0x3baded,_0x183f82,!![]);}catch(_0x1cc335){return BPromise[_0x7b86('0x28')](_0x1cc335);}return _0x3baded[_0x7b86('0x29')]();};}function saveUpdates(_0x430a11,_0x17002c){return function(_0x10b423){if(_0x10b423){return _0x10b423[_0x7b86('0x2a')](_0x430a11)[_0x7b86('0x2b')](function(_0x6bf3b3){return _0x6bf3b3;});}return null;};}function handleEntityNotFound(_0x558373,_0x7d4b1f){return function(_0x2d10d0){if(!_0x2d10d0){_0x558373['sendStatus'](0x194);}return _0x2d10d0;};}function handleError(_0x47d254,_0x335b3f){_0x335b3f=_0x335b3f||0x1f4;return function(_0x63e560){logger[_0x7b86('0x2c')](_0x63e560[_0x7b86('0x2d')]);if(_0x63e560[_0x7b86('0x2e')]){delete _0x63e560[_0x7b86('0x2e')];}_0x47d254['status'](_0x335b3f)[_0x7b86('0x2f')](_0x63e560);};}exports[_0x7b86('0x30')]=function(_0x59dc94,_0x4d4dff){var _0x193f91={},_0x55fc82={},_0x168fd3={'count':0x0,'rows':[]};var _0x4980a4=_[_0x7b86('0x31')](db['Team'][_0x7b86('0x32')],function(_0x16d05f){return{'name':_0x16d05f[_0x7b86('0x33')],'type':_0x16d05f['type'][_0x7b86('0x34')]};});_0x55fc82[_0x7b86('0x35')]=_[_0x7b86('0x31')](_0x4980a4,_0x7b86('0x2e'));_0x55fc82[_0x7b86('0x36')]=_[_0x7b86('0x37')](_0x59dc94[_0x7b86('0x36')]);_0x55fc82[_0x7b86('0x38')]=_['intersection'](_0x55fc82[_0x7b86('0x35')],_0x55fc82[_0x7b86('0x36')]);_0x193f91['attributes']=_[_0x7b86('0x39')](_0x55fc82['model'],qs[_0x7b86('0x3a')](_0x59dc94[_0x7b86('0x36')][_0x7b86('0x3a')]));_0x193f91[_0x7b86('0x3b')]=_0x193f91[_0x7b86('0x3b')][_0x7b86('0x3c')]?_0x193f91[_0x7b86('0x3b')]:_0x55fc82['model'];if(!_0x59dc94[_0x7b86('0x36')]['hasOwnProperty'](_0x7b86('0x3d'))){_0x193f91['limit']=qs[_0x7b86('0x21')](_0x59dc94[_0x7b86('0x36')][_0x7b86('0x21')]);_0x193f91[_0x7b86('0x23')]=qs[_0x7b86('0x23')](_0x59dc94[_0x7b86('0x36')][_0x7b86('0x23')]);}_0x193f91[_0x7b86('0x3e')]=qs[_0x7b86('0x3f')](_0x59dc94[_0x7b86('0x36')]['sort']);_0x193f91[_0x7b86('0x40')]=qs[_0x7b86('0x38')](_['pick'](_0x59dc94[_0x7b86('0x36')],_0x55fc82[_0x7b86('0x38')]),_0x4980a4);if(_0x59dc94[_0x7b86('0x36')]['filter']){_0x193f91[_0x7b86('0x40')]=_[_0x7b86('0x41')](_0x193f91[_0x7b86('0x40')],{'$or':_[_0x7b86('0x31')](_0x4980a4,function(_0x4918f2){if(_0x4918f2['type']!==_0x7b86('0x42')){var _0x182d56={};_0x182d56[_0x4918f2[_0x7b86('0x2e')]]={'$like':'%'+_0x59dc94[_0x7b86('0x36')]['filter']+'%'};return _0x182d56;}})});}_0x193f91=_[_0x7b86('0x41')]({},_0x193f91,_0x59dc94['options']);var _0x4fdfec={'where':_0x193f91[_0x7b86('0x40')]};return db[_0x7b86('0x43')][_0x7b86('0x22')](_0x4fdfec)[_0x7b86('0x2b')](function(_0xa23304){_0x168fd3['count']=_0xa23304;if(_0x59dc94[_0x7b86('0x36')][_0x7b86('0x44')]){_0x193f91[_0x7b86('0x45')]=[{'all':!![]}];}return db[_0x7b86('0x43')][_0x7b86('0x46')](_0x193f91);})[_0x7b86('0x2b')](function(_0x3812a2){_0x168fd3[_0x7b86('0x47')]=_0x3812a2;return _0x168fd3;})[_0x7b86('0x2b')](respondWithFilteredResult(_0x4d4dff,_0x193f91))['catch'](handleError(_0x4d4dff,null));};exports[_0x7b86('0x48')]=function(_0x143e49,_0x45d039){var _0x23c079={'raw':![],'where':{'id':_0x143e49['params']['id']}},_0x1bd40d={};_0x1bd40d[_0x7b86('0x35')]=_[_0x7b86('0x37')](db[_0x7b86('0x43')][_0x7b86('0x32')]);_0x1bd40d[_0x7b86('0x36')]=_['keys'](_0x143e49[_0x7b86('0x36')]);_0x1bd40d[_0x7b86('0x38')]=_[_0x7b86('0x39')](_0x1bd40d['model'],_0x1bd40d['query']);_0x23c079[_0x7b86('0x3b')]=_[_0x7b86('0x39')](_0x1bd40d[_0x7b86('0x35')],qs[_0x7b86('0x3a')](_0x143e49['query']['fields']));_0x23c079['attributes']=_0x23c079['attributes'][_0x7b86('0x3c')]?_0x23c079[_0x7b86('0x3b')]:_0x1bd40d[_0x7b86('0x35')];if(_0x143e49[_0x7b86('0x36')][_0x7b86('0x44')]){_0x23c079['include']=[{'all':!![]}];}_0x23c079=_[_0x7b86('0x41')]({},_0x23c079,_0x143e49[_0x7b86('0x49')]);return db[_0x7b86('0x43')]['find'](_0x23c079)[_0x7b86('0x2b')](handleEntityNotFound(_0x45d039,null))[_0x7b86('0x2b')](respondWithResult(_0x45d039,null))[_0x7b86('0x4a')](handleError(_0x45d039,null));};exports['create']=function(_0x39dcb7,_0x1c14bb){return db['Team'][_0x7b86('0x4b')](_0x39dcb7[_0x7b86('0x4c')],{})[_0x7b86('0x2b')](function(_0x5deb38){var _0x1e82f0=_0x39dcb7['user']['get']({'plain':!![]});if(!_0x1e82f0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1e82f0[_0x7b86('0x4d')]==='user'){var _0x1286a1=_0x5deb38['get']({'plain':!![]});var _0x3ce850=_0x7b86('0x4e');return db[_0x7b86('0x4f')]['find']({'where':{'name':_0x3ce850,'userProfileId':_0x1e82f0[_0x7b86('0x50')]},'raw':!![]})[_0x7b86('0x2b')](function(_0xd18b1b){if(_0xd18b1b&&_0xd18b1b[_0x7b86('0x51')]===0x0){return db[_0x7b86('0x52')]['create']({'name':_0x1286a1['name'],'resourceId':_0x1286a1['id'],'type':_0xd18b1b['name'],'sectionId':_0xd18b1b['id']},{})[_0x7b86('0x2b')](function(){return _0x5deb38;});}else{return _0x5deb38;}})['catch'](function(_0x82d284){logger['error'](_0x7b86('0x53'),_0x82d284);throw _0x82d284;});}return _0x5deb38;})[_0x7b86('0x2b')](respondWithResult(_0x1c14bb,0xc9))['catch'](handleError(_0x1c14bb,null));};exports[_0x7b86('0x2a')]=function(_0x336b32,_0xcb3395){if(_0x336b32[_0x7b86('0x4c')]['id']){delete _0x336b32['body']['id'];}return db['Team'][_0x7b86('0x54')]({'where':{'id':_0x336b32['params']['id']}})[_0x7b86('0x2b')](handleEntityNotFound(_0xcb3395,null))['then'](saveUpdates(_0x336b32[_0x7b86('0x4c')],null))[_0x7b86('0x2b')](respondWithResult(_0xcb3395,null))['catch'](handleError(_0xcb3395,null));};exports['destroy']=function(_0x10469f,_0x30428d){var _0x2ab19d=_0x10469f['params']['id'];var _0x23a630=[];return db[_0x7b86('0x55')][_0x7b86('0x56')](function(_0x457e74){var _0x409740=_0x7b86('0x57')+_0x2ab19d;return db[_0x7b86('0x55')]['query'](_0x409740,{'type':db[_0x7b86('0x58')][_0x7b86('0x59')][_0x7b86('0x5a')],'raw':!![],'transaction':_0x457e74})[_0x7b86('0x2b')](function(_0x2fa77f){_0x23a630=_[_0x7b86('0x31')](_0x2fa77f,function(_0x33477b){return Number(_0x33477b['UserId']);});})['then'](function(){var _0x3c40b5=_0x7b86('0x5b')+_0x2ab19d;return db[_0x7b86('0x55')][_0x7b86('0x36')](_0x3c40b5,{'type':db[_0x7b86('0x58')][_0x7b86('0x59')][_0x7b86('0x5a')],'raw':!![],'transaction':_0x457e74});})[_0x7b86('0x2b')](function(_0x27778d){var _0x97adaf=_[_0x7b86('0x31')](_0x27778d,function(_0x213f5e){return Number(_0x213f5e[_0x7b86('0x5c')]);});return db['UserVoiceQueue']['destroy']({'where':{'UserId':{'$in':_0x23a630},'VoiceQueueId':{'$in':_0x97adaf}},'transaction':_0x457e74});})[_0x7b86('0x2b')](function(){var _0x421eb0=_0x7b86('0x5d')+_0x2ab19d;return db[_0x7b86('0x55')]['query'](_0x421eb0,{'type':db[_0x7b86('0x58')][_0x7b86('0x59')][_0x7b86('0x5a')],'raw':!![],'transaction':_0x457e74});})[_0x7b86('0x2b')](function(_0x158a86){var _0xee0ac3=_[_0x7b86('0x31')](_0x158a86,function(_0xd53ea6){return Number(_0xd53ea6[_0x7b86('0x5e')]);});return db['UserMailQueue'][_0x7b86('0x5f')]({'where':{'UserId':{'$in':_0x23a630},'MailQueueId':{'$in':_0xee0ac3}},'transaction':_0x457e74});})['then'](function(){var _0x2e1dcf=_0x7b86('0x60')+_0x2ab19d;return db['sequelize']['query'](_0x2e1dcf,{'type':db[_0x7b86('0x58')]['QueryTypes'][_0x7b86('0x5a')],'raw':!![],'transaction':_0x457e74});})['then'](function(_0x1b9da1){var _0x320ba6=_[_0x7b86('0x31')](_0x1b9da1,function(_0x127401){return Number(_0x127401['SmsQueueId']);});return db[_0x7b86('0x61')]['destroy']({'where':{'UserId':{'$in':_0x23a630},'SmsQueueId':{'$in':_0x320ba6}},'transaction':_0x457e74});})[_0x7b86('0x2b')](function(){var _0x18b50c=_0x7b86('0x62')+_0x2ab19d;return db['sequelize']['query'](_0x18b50c,{'type':db[_0x7b86('0x58')][_0x7b86('0x59')][_0x7b86('0x5a')],'raw':!![],'transaction':_0x457e74});})[_0x7b86('0x2b')](function(_0x1c2e97){var _0x16c662=_['map'](_0x1c2e97,function(_0x5f2cfd){return Number(_0x5f2cfd['ChatQueueId']);});return db['UserChatQueue']['destroy']({'where':{'UserId':{'$in':_0x23a630},'ChatQueueId':{'$in':_0x16c662}},'transaction':_0x457e74});})[_0x7b86('0x2b')](function(){var _0x4d97a5=_0x7b86('0x63')+_0x2ab19d;return db[_0x7b86('0x55')][_0x7b86('0x36')](_0x4d97a5,{'type':db[_0x7b86('0x58')][_0x7b86('0x59')][_0x7b86('0x5a')],'raw':!![],'transaction':_0x457e74});})[_0x7b86('0x2b')](function(_0x3aa070){var _0x40afa2=_[_0x7b86('0x31')](_0x3aa070,function(_0x3aaf84){return Number(_0x3aaf84[_0x7b86('0x64')]);});return db[_0x7b86('0x65')][_0x7b86('0x5f')]({'where':{'UserId':{'$in':_0x23a630},'FaxQueueId':{'$in':_0x40afa2}},'transaction':_0x457e74});})[_0x7b86('0x2b')](function(){var _0x1b8f8e=_0x7b86('0x66')+_0x2ab19d;return db['sequelize'][_0x7b86('0x36')](_0x1b8f8e,{'type':db[_0x7b86('0x58')][_0x7b86('0x59')][_0x7b86('0x5a')],'raw':!![],'transaction':_0x457e74});})[_0x7b86('0x2b')](function(_0x1a68de){var _0x5e3b0f=_[_0x7b86('0x31')](_0x1a68de,function(_0x45a0ad){return Number(_0x45a0ad[_0x7b86('0x67')]);});return db[_0x7b86('0x68')]['destroy']({'where':{'UserId':{'$in':_0x23a630},'OpenchannelQueueId':{'$in':_0x5e3b0f}},'transaction':_0x457e74});})[_0x7b86('0x2b')](function(){var _0x5664b6=_0x7b86('0x69')+_0x2ab19d;return db[_0x7b86('0x55')]['query'](_0x5664b6,{'type':db[_0x7b86('0x58')][_0x7b86('0x59')][_0x7b86('0x5a')],'raw':!![],'transaction':_0x457e74});})['then'](function(_0xb2efd1){var _0xc7057a=_['map'](_0xb2efd1,function(_0x2aedd7){return Number(_0x2aedd7[_0x7b86('0x6a')]);});return db[_0x7b86('0x6b')][_0x7b86('0x5f')]({'where':{'UserId':{'$in':_0x23a630},'WhatsappQueueId':{'$in':_0xc7057a}},'transaction':_0x457e74});})['then'](function(){return db[_0x7b86('0x6c')][_0x7b86('0x54')]({'where':{'TeamId':_0x2ab19d}});})['then'](function(_0x5ce5fd){if(_0x5ce5fd===null){return;}return db[_0x7b86('0x6d')][_0x7b86('0x5f')]({'where':{'UserId':{'$in':_0x23a630},'VoicePrefixId':_0x5ce5fd[_0x7b86('0x6e')]},'transaction':_0x457e74});})['then'](function(){return db[_0x7b86('0x43')][_0x7b86('0x5f')]({'where':{'id':_0x2ab19d},'cascade':!![],'transaction':_0x457e74});})[_0x7b86('0x2b')](function(_0x152420){if(_0x152420===0x0){_0x30428d[_0x7b86('0x1d')](0x194);}else{return db[_0x7b86('0x52')][_0x7b86('0x5f')]({'where':{'type':_0x7b86('0x4e'),'resourceId':_0x2ab19d},'cascade':!![],'transaction':_0x457e74})['then'](function(){_0x30428d[_0x7b86('0x1e')](0xcc)[_0x7b86('0x1f')]();});}})['catch'](function(_0xe78356){_0x30428d[_0x7b86('0x1e')](0x1f4)['send'](_0xe78356);});});};exports[_0x7b86('0x6f')]=function(_0x5ce989,_0xf64a61,_0x5064d1){return db[_0x7b86('0x43')][_0x7b86('0x70')]({'where':{'id':_0x5ce989[_0x7b86('0x71')]['id']}})['then'](handleEntityNotFound(_0xf64a61,null))[_0x7b86('0x2b')](function(_0x3ed8fb){if(!_0x5ce989['query']['channel']||!utils[_0x7b86('0x72')](_0x5ce989[_0x7b86('0x36')][_0x7b86('0x73')])){throw new db[(_0x7b86('0x58'))][(_0x7b86('0x74'))](_0x7b86('0x75'));}var _0x35c542={};var _0x1f0707={};_0x1f0707[_0x7b86('0x35')]=_[_0x7b86('0x37')](db[_[_0x7b86('0x76')](_0x5ce989[_0x7b86('0x36')][_0x7b86('0x73')]['toLowerCase']())+_0x7b86('0x77')]['rawAttributes']);_0x1f0707[_0x7b86('0x36')]=_['keys'](_0x5ce989[_0x7b86('0x36')]);_0x1f0707[_0x7b86('0x38')]=_[_0x7b86('0x39')](_0x1f0707[_0x7b86('0x35')],_0x1f0707['query']);_0x35c542[_0x7b86('0x3b')]=_[_0x7b86('0x39')](_0x1f0707[_0x7b86('0x35')],qs['fields'](_0x5ce989[_0x7b86('0x36')][_0x7b86('0x3a')]));_0x35c542[_0x7b86('0x3b')]=_0x35c542['attributes'][_0x7b86('0x3c')]?_0x35c542[_0x7b86('0x3b')]:_0x1f0707['model'];_0x35c542[_0x7b86('0x21')]=qs[_0x7b86('0x21')](_0x5ce989[_0x7b86('0x36')][_0x7b86('0x21')]);_0x35c542[_0x7b86('0x23')]=qs[_0x7b86('0x23')](_0x5ce989[_0x7b86('0x36')][_0x7b86('0x23')]);_0x35c542[_0x7b86('0x3e')]=qs[_0x7b86('0x3f')](_0x5ce989[_0x7b86('0x36')][_0x7b86('0x3f')]);_0x35c542[_0x7b86('0x40')]=qs[_0x7b86('0x38')](_[_0x7b86('0x78')](_0x5ce989['query'],_0x1f0707[_0x7b86('0x38')]));_0x35c542=_[_0x7b86('0x41')]({},_0x35c542,_0x5ce989['options']);return _0x3ed8fb['get'+_['capitalize'](_0x5ce989[_0x7b86('0x36')][_0x7b86('0x73')][_0x7b86('0x79')]())+_0x7b86('0x7a')](_0x35c542);})['then'](respondWithResult(_0xf64a61,null))[_0x7b86('0x4a')](handleError(_0xf64a61,null));};exports[_0x7b86('0x7b')]=function(_0x39c507,_0x1c3ccd,_0x360ebc){return db[_0x7b86('0x43')][_0x7b86('0x70')]({'where':{'id':_0x39c507[_0x7b86('0x71')]['id']}})[_0x7b86('0x2b')](function(_0x2cb3d6){if(_0x2cb3d6){if(!_0x39c507['body'][_0x7b86('0x73')]||!utils[_0x7b86('0x72')](_0x39c507[_0x7b86('0x4c')][_0x7b86('0x73')])){throw new db[(_0x7b86('0x58'))][(_0x7b86('0x74'))]('Unknown\x20channel');}return _0x2cb3d6['add'+_[_0x7b86('0x76')](_0x39c507[_0x7b86('0x4c')][_0x7b86('0x73')][_0x7b86('0x79')]())+_0x7b86('0x7a')](_0x39c507[_0x7b86('0x4c')][_0x7b86('0x7c')]);}return null;})[_0x7b86('0x2b')](handleEntityNotFound(_0x1c3ccd,null))['then'](respondWithStatusCode(_0x1c3ccd,null))[_0x7b86('0x4a')](handleError(_0x1c3ccd,null));};exports[_0x7b86('0x7d')]=function(_0x3dd859,_0x380451,_0x20701e){return db[_0x7b86('0x43')][_0x7b86('0x70')]({'where':{'id':_0x3dd859['params']['id']}})['then'](function(_0x4ac64d){if(_0x4ac64d){if(!_0x3dd859[_0x7b86('0x36')]['channel']||!utils['isValidChannel'](_0x3dd859[_0x7b86('0x36')]['channel'])){throw new db[(_0x7b86('0x58'))][(_0x7b86('0x74'))]('Unknown\x20channel');}return _0x4ac64d[_0x7b86('0x7e')+_[_0x7b86('0x76')](_0x3dd859[_0x7b86('0x36')][_0x7b86('0x73')][_0x7b86('0x79')]())+_0x7b86('0x7a')](_0x3dd859[_0x7b86('0x36')][_0x7b86('0x7c')]);}return null;})[_0x7b86('0x2b')](handleEntityNotFound(_0x380451,null))[_0x7b86('0x2b')](respondWithStatusCode(_0x380451,null))[_0x7b86('0x4a')](handleError(_0x380451,null));};exports[_0x7b86('0x7f')]=function(_0x3b8dcf,_0x249ead){var _0x553894=_['isArray'](_0x3b8dcf[_0x7b86('0x4c')][_0x7b86('0x7c')])?_0x3b8dcf[_0x7b86('0x4c')][_0x7b86('0x7c')]:[_0x3b8dcf['body'][_0x7b86('0x7c')]];var _0x4ff288=_0x3b8dcf['params']['id'];return db[_0x7b86('0x43')][_0x7b86('0x54')]({'where':{'id':_0x4ff288}})[_0x7b86('0x2b')](handleEntityNotFound(_0x249ead,null))['then'](function(_0x146255){if(_0x146255){var _0x414309=[_0x7b86('0x80'),_0x7b86('0x81'),_0x7b86('0x82'),_0x7b86('0x83'),_0x7b86('0x84'),_0x7b86('0x85'),_0x7b86('0x86')];return db[_0x7b86('0x55')][_0x7b86('0x56')](function(_0x2d1759){var _0x330b9b=_[_0x7b86('0x31')](_0x414309,function(_0x5bcbd0){var _0x3489aa={'attributes':['id',_0x7b86('0x2e')]};if(_0x5bcbd0===_0x7b86('0x80')){_0x3489aa[_0x7b86('0x87')]={'attributes':['penalty']};}return _0x146255[_0x7b86('0x88')+_0x5bcbd0+_0x7b86('0x7a')](_0x3489aa)['then'](function(_0x3c8a36){var _0x290ecf=_[_0x7b86('0x31')](_0x3c8a36,function(_0x16f21e){var _0x57d32a=_[_0x7b86('0x31')](_0x553894,function(_0x100fb3){var _0x41d000={'where':{'UserId':_0x100fb3,[_0x5bcbd0+_0x7b86('0x89')]:_0x16f21e['id']},'transaction':_0x2d1759};if(_0x5bcbd0===_0x7b86('0x80')){_0x41d000[_0x7b86('0x19')]={'penalty':_0x16f21e[_0x7b86('0x8a')][_0x7b86('0x8b')]};}return db[_0x7b86('0x8c')+_0x5bcbd0+'Queue'][_0x7b86('0x8d')](_0x41d000)['then'](function(){socket[_0x7b86('0x8e')]('user'+_0x5bcbd0+_0x7b86('0x8f'),{'UserId':_0x100fb3,[_0x5bcbd0+_0x7b86('0x89')]:_0x16f21e['id']});if(_0x5bcbd0!==_0x7b86('0x80')){return;}return db[_0x7b86('0x8c')][_0x7b86('0x46')]({'where':{'id':_0x553894,'online':0x1},'attributes':['id',_0x7b86('0x2e'),_0x7b86('0x90'),_0x7b86('0x91'),_0x7b86('0x92')],'raw':!![]})[_0x7b86('0x2b')](function(_0x3fd8fe){var _0x2bb59=_['map'](_0x3fd8fe,function(_0x5a54bb){return db[_0x7b86('0x93')][_0x7b86('0x94')]({'membername':_0x5a54bb['name'],'UserId':_0x5a54bb['id'],'queue_name':_0x16f21e['name'],'VoiceQueueId':_0x16f21e['id'],'interface':_['isNil'](_0x5a54bb[_0x7b86('0x92')])?util[_0x7b86('0x95')]('SIP/%s',_0x5a54bb[_0x7b86('0x2e')]):_0x5a54bb[_0x7b86('0x92')],'paused':_0x5a54bb[_0x7b86('0x91')]||![],'penalty':_0x16f21e['TeamVoiceQueue']['penalty']},{'transaction':_0x2d1759});});return Promise[_0x7b86('0x96')](_0x2bb59);});});});return Promise['all'](_0x57d32a);});return Promise[_0x7b86('0x96')](_0x290ecf);})[_0x7b86('0x2b')](function(){return db[_0x7b86('0x6c')]['findOne']({'where':{'teamId':_0x4ff288}})['then'](function(_0x12a591){if(_0x12a591){var _0x5a7523=_[_0x7b86('0x31')](_0x553894,function(_0x4f8f62){db[_0x7b86('0x6d')][_0x7b86('0x94')]({'UserId':_0x4f8f62,'VoicePrefixId':_0x12a591[_0x7b86('0x6e')]});});return Promise[_0x7b86('0x96')](_0x5a7523);}});});});return Promise[_0x7b86('0x96')](_0x330b9b)['then'](function(){return _0x146255[_0x7b86('0x7f')](_0x553894,{'transaction':_0x2d1759})['spread'](function(_0x2c5e56){return _0x2c5e56;});});});}})[_0x7b86('0x2b')](respondWithResult(_0x249ead,null))['catch'](handleError(_0x249ead,null));};exports[_0x7b86('0x97')]=function(_0x560567,_0x33b7a9){var _0x35e9a2=_[_0x7b86('0x98')](_0x560567[_0x7b86('0x36')][_0x7b86('0x7c')])?_0x560567[_0x7b86('0x36')][_0x7b86('0x7c')]:[_0x560567[_0x7b86('0x36')][_0x7b86('0x7c')]];var _0x19a3ab=_0x560567[_0x7b86('0x71')]['id'];return db[_0x7b86('0x43')][_0x7b86('0x54')]({'where':{'id':_0x19a3ab}})[_0x7b86('0x2b')](handleEntityNotFound(_0x33b7a9,null))[_0x7b86('0x2b')](function(_0x4b6c09){if(_0x4b6c09){var _0x293fa4=[_0x7b86('0x80'),_0x7b86('0x81'),_0x7b86('0x82'),_0x7b86('0x83'),_0x7b86('0x84'),_0x7b86('0x85'),_0x7b86('0x86')];return db[_0x7b86('0x55')][_0x7b86('0x56')](function(_0x4c205f){var _0x25ee3e=_[_0x7b86('0x31')](_0x293fa4,function(_0xea0d4b){var _0x43b76c={'attributes':['id','name']};return _0x4b6c09[_0x7b86('0x88')+_0xea0d4b+_0x7b86('0x7a')](_0x43b76c)[_0x7b86('0x2b')](function(_0x29c642){var _0x46cec5=_[_0x7b86('0x31')](_0x29c642,function(_0x38f56c){return _0x38f56c[_0x7b86('0x97')](_0x35e9a2,{'transaction':_0x4c205f})[_0x7b86('0x2b')](function(){var _0x39d32c=_[_0x7b86('0x31')](_0x35e9a2,function(_0x22d55a){socket[_0x7b86('0x8e')](_0x7b86('0x99')+_0xea0d4b+_0x7b86('0x9a'),{'UserId':Number(_0x22d55a),[_0xea0d4b+'QueueId']:_0x38f56c['id']});if(_0xea0d4b!==_0x7b86('0x80')){return;}return db[_0x7b86('0x93')][_0x7b86('0x5f')]({'where':{'VoiceQueueId':_0x38f56c['id'],'UserId':_0x22d55a},'transaction':_0x4c205f});});return Promise[_0x7b86('0x96')](_0x39d32c);});});return Promise[_0x7b86('0x96')](_0x46cec5);});});return Promise['all'](_0x25ee3e)[_0x7b86('0x2b')](function(){return _0x4b6c09[_0x7b86('0x97')](_0x35e9a2,{'transaction':_0x4c205f});})[_0x7b86('0x2b')](function(){return db['TeamVoicePrefix'][_0x7b86('0x70')]({'where':{'teamId':_0x19a3ab}})[_0x7b86('0x2b')](function(_0x76cf1e){if(_0x76cf1e){var _0x45bd1b=_[_0x7b86('0x31')](_0x35e9a2,function(_0x3f41cb){db[_0x7b86('0x6d')]['destroy']({'where':{'UserId':_0x3f41cb,'VoicePrefixId':_0x76cf1e[_0x7b86('0x6e')]}});});return Promise['all'](_0x45bd1b);}});});});}})[_0x7b86('0x2b')](respondWithStatusCode(_0x33b7a9,null))[_0x7b86('0x4a')](handleError(_0x33b7a9,null));};exports['getAgents']=function(_0x5a403f,_0x5f50fc,_0x50e651){var _0x11e110={};var _0x6f819a={};var _0x1d5e34;var _0x2bfb6e;return db[_0x7b86('0x43')][_0x7b86('0x70')]({'where':{'id':_0x5a403f[_0x7b86('0x71')]['id']}})['then'](handleEntityNotFound(_0x5f50fc,null))[_0x7b86('0x2b')](function(_0x2facec){if(_0x2facec){_0x1d5e34=_0x2facec;_0x6f819a[_0x7b86('0x35')]=_[_0x7b86('0x37')](db[_0x7b86('0x8c')]['rawAttributes']);_0x6f819a[_0x7b86('0x36')]=_[_0x7b86('0x37')](_0x5a403f[_0x7b86('0x36')]);_0x6f819a[_0x7b86('0x38')]=_[_0x7b86('0x39')](_0x6f819a[_0x7b86('0x35')],_0x6f819a[_0x7b86('0x36')]);_0x11e110['attributes']=_[_0x7b86('0x39')](_0x6f819a['model'],qs['fields'](_0x5a403f['query']['fields']));_0x11e110[_0x7b86('0x3b')]=_0x11e110['attributes'][_0x7b86('0x3c')]?_0x11e110[_0x7b86('0x3b')]:_0x6f819a[_0x7b86('0x35')];_0x11e110['order']=qs[_0x7b86('0x3f')](_0x5a403f[_0x7b86('0x36')][_0x7b86('0x3f')]);_0x11e110[_0x7b86('0x40')]=qs[_0x7b86('0x38')](_[_0x7b86('0x78')](_0x5a403f[_0x7b86('0x36')],_0x6f819a[_0x7b86('0x38')]));if(_0x5a403f[_0x7b86('0x36')][_0x7b86('0x9b')]){_0x11e110[_0x7b86('0x40')]=_[_0x7b86('0x41')](_0x11e110[_0x7b86('0x40')],{'$or':_[_0x7b86('0x31')](_0x11e110[_0x7b86('0x3b')],function(_0x47c6ce){var _0x29044d={};_0x29044d[_0x47c6ce]={'$like':'%'+_0x5a403f[_0x7b86('0x36')][_0x7b86('0x9b')]+'%'};return _0x29044d;})});}_0x11e110=_['merge']({},_0x11e110,_0x5a403f[_0x7b86('0x49')]);return _0x1d5e34[_0x7b86('0x9c')](_0x11e110);}})[_0x7b86('0x2b')](function(_0x601d1d){if(_0x601d1d){_0x2bfb6e=_0x601d1d[_0x7b86('0x3c')];if(!_0x5a403f[_0x7b86('0x36')][_0x7b86('0x9d')](_0x7b86('0x3d'))){_0x11e110[_0x7b86('0x21')]=qs[_0x7b86('0x21')](_0x5a403f[_0x7b86('0x36')][_0x7b86('0x21')]);_0x11e110[_0x7b86('0x23')]=qs[_0x7b86('0x23')](_0x5a403f['query'][_0x7b86('0x23')]);}return _0x1d5e34[_0x7b86('0x9c')](_0x11e110);}})[_0x7b86('0x2b')](function(_0x1e3ca4){if(_0x1e3ca4){return _0x1e3ca4?{'count':_0x2bfb6e,'rows':_0x1e3ca4}:null;}})[_0x7b86('0x2b')](respondWithResult(_0x5f50fc,null))[_0x7b86('0x4a')](handleError(_0x5f50fc,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index f5b523b..b4eb66d 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 _0x5787=['events','Team','save','update','remove','emit','hook','exports'];(function(_0x59916e,_0x128b20){var _0x1ed3aa=function(_0x4df9e3){while(--_0x4df9e3){_0x59916e['push'](_0x59916e['shift']());}};_0x1ed3aa(++_0x128b20);}(_0x5787,0x98));var _0x7578=function(_0x3f2b7d,_0x504acb){_0x3f2b7d=_0x3f2b7d-0x0;var _0x3ff272=_0x5787[_0x3f2b7d];return _0x3ff272;};'use strict';var EventEmitter=require(_0x7578('0x0'));var Team=require('../../mysqldb')['db'][_0x7578('0x1')];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7578('0x2'),'afterUpdate':_0x7578('0x3'),'afterDestroy':_0x7578('0x4')};function emitEvent(_0x5726f7){return function(_0x15b257,_0x2e09d4,_0xe14f40){TeamEvents[_0x7578('0x5')](_0x5726f7+':'+_0x15b257['id'],_0x15b257);TeamEvents[_0x7578('0x5')](_0x5726f7,_0x15b257);_0xe14f40(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team[_0x7578('0x6')](e,emitEvent(event));}}module[_0x7578('0x7')]=TeamEvents; \ No newline at end of file +var _0x621f=['update','emit','exports','events','Team','setMaxListeners','save'];(function(_0x521204,_0x141bd9){var _0x28f5c5=function(_0x36f94c){while(--_0x36f94c){_0x521204['push'](_0x521204['shift']());}};_0x28f5c5(++_0x141bd9);}(_0x621f,0x137));var _0xf621=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x621f[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xf621('0x0'));var Team=require('../../mysqldb')['db'][_0xf621('0x1')];var TeamEvents=new EventEmitter();TeamEvents[_0xf621('0x2')](0x0);var events={'afterCreate':_0xf621('0x3'),'afterUpdate':_0xf621('0x4'),'afterDestroy':'remove'};function emitEvent(_0x515cec){return function(_0x46944a,_0x401059,_0x596288){TeamEvents[_0xf621('0x5')](_0x515cec+':'+_0x46944a['id'],_0x46944a);TeamEvents[_0xf621('0x5')](_0x515cec,_0x46944a);_0x596288(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module[_0xf621('0x6')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 38abe02..d5c8f18 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 _0xcb73=['lodash','./team.attributes','get','Queues','setDataValue','channel','exports','define','Team','teams','Fax','Mail','Openchannel','Sms','Whatsapp','then','map','all','catch'];(function(_0x1d1d09,_0x504d77){var _0x8827e=function(_0x4f3128){while(--_0x4f3128){_0x1d1d09['push'](_0x1d1d09['shift']());}};_0x8827e(++_0x504d77);}(_0xcb73,0x1a2));var _0x3cb7=function(_0x935f9c,_0x5c3ba2){_0x935f9c=_0x935f9c-0x0;var _0x5d9fbc=_0xcb73[_0x935f9c];return _0x5d9fbc;};'use strict';var _=require(_0x3cb7('0x0'));var attributes=require(_0x3cb7('0x1'));function getQueuesByChannel(_0x3b4645,_0xb4b2ae){var _0x20ffb7=_0x3cb7('0x2')+_0xb4b2ae+_0x3cb7('0x3');return _0x3b4645[_0x20ffb7]()['then'](function(_0x517b6f){return _['map'](_0x517b6f,function(_0x3a2f88){_0x3a2f88[_0x3cb7('0x4')](_0x3cb7('0x5'),_0xb4b2ae);return _0x3a2f88;});})['catch'](function(_0x5ccc92){throw _0x5ccc92;});}module[_0x3cb7('0x6')]=function(_0xa8c1b3){return _0xa8c1b3[_0x3cb7('0x7')](_0x3cb7('0x8'),attributes,{'tableName':_0x3cb7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x39f54e=this;var _0x4971ae=['Chat',_0x3cb7('0xa'),_0x3cb7('0xb'),_0x3cb7('0xc'),_0x3cb7('0xd'),'Voice',_0x3cb7('0xe')];return Promise['resolve']()[_0x3cb7('0xf')](function(){var _0x13ee1b=_[_0x3cb7('0x10')](_0x4971ae,function(_0x3537dd){return getQueuesByChannel(_0x39f54e,_0x3537dd);});return Promise[_0x3cb7('0x11')](_0x13ee1b);})[_0x3cb7('0x12')](function(_0x73a674){throw _0x73a674;});}}});}; \ No newline at end of file +var _0xddab=['Queues','map','channel','catch','exports','define','Team','Chat','Fax','Mail','Openchannel','Sms','then','all','lodash','./team.attributes','get'];(function(_0x5d77fb,_0x2616e8){var _0x270181=function(_0x3ab093){while(--_0x3ab093){_0x5d77fb['push'](_0x5d77fb['shift']());}};_0x270181(++_0x2616e8);}(_0xddab,0x195));var _0xbdda=function(_0x5bc534,_0xc39d1a){_0x5bc534=_0x5bc534-0x0;var _0x134075=_0xddab[_0x5bc534];return _0x134075;};'use strict';var _=require(_0xbdda('0x0'));var attributes=require(_0xbdda('0x1'));function getQueuesByChannel(_0x3e8e7c,_0x57d392){var _0x5bfcf0=_0xbdda('0x2')+_0x57d392+_0xbdda('0x3');return _0x3e8e7c[_0x5bfcf0]()['then'](function(_0x5968c2){return _[_0xbdda('0x4')](_0x5968c2,function(_0x4ab810){_0x4ab810['setDataValue'](_0xbdda('0x5'),_0x57d392);return _0x4ab810;});})[_0xbdda('0x6')](function(_0x16dfa4){throw _0x16dfa4;});}module[_0xbdda('0x7')]=function(_0x4cc98a){return _0x4cc98a[_0xbdda('0x8')](_0xbdda('0x9'),attributes,{'tableName':'teams','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x4a08d2=this;var _0x44bcbe=[_0xbdda('0xa'),_0xbdda('0xb'),_0xbdda('0xc'),_0xbdda('0xd'),_0xbdda('0xe'),'Voice','Whatsapp'];return Promise['resolve']()[_0xbdda('0xf')](function(){var _0x9f3fc4=_['map'](_0x44bcbe,function(_0x1bdf07){return getQueuesByChannel(_0x4a08d2,_0x1bdf07);});return Promise[_0xbdda('0x10')](_0x9f3fc4);})['catch'](function(_0x42afcb){throw _0x42afcb;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index d94b935..d0da812 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 _0xe80d=['util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./team.socket','register','request','then','info','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash'];(function(_0x17eb7c,_0x3bf5b5){var _0x394950=function(_0x525192){while(--_0x525192){_0x17eb7c['push'](_0x17eb7c['shift']());}};_0x394950(++_0x3bf5b5);}(_0xe80d,0xfb));var _0xde80=function(_0x31f23f,_0x421862){_0x31f23f=_0x31f23f-0x0;var _0x572b25=_0xe80d[_0x31f23f];return _0x572b25;};'use strict';var _=require(_0xde80('0x0'));var util=require(_0xde80('0x1'));var moment=require(_0xde80('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xde80('0x3'));var db=require(_0xde80('0x4'))['db'];var utils=require(_0xde80('0x5'));var logger=require(_0xde80('0x6'))('rpc');var config=require(_0xde80('0x7'));var jayson=require(_0xde80('0x8'));var client=jayson[_0xde80('0x9')]['http']({'port':0x232a});config['redis']=_[_0xde80('0xa')](config[_0xde80('0xb')],{'host':_0xde80('0xc'),'port':0x18eb});var socket=require(_0xde80('0xd'))(new Redis(config[_0xde80('0xb')]));require(_0xde80('0xe'))[_0xde80('0xf')](socket);function respondWithRpcPromise(_0x869384,_0x44dadc,_0x54fbf5){return new BPromise(function(_0x400a5d,_0x1c809d){return client[_0xde80('0x10')](_0x869384,_0x54fbf5)[_0xde80('0x11')](function(_0x145f2c){logger[_0xde80('0x12')](_0xde80('0x13'),_0x44dadc,_0xde80('0x14'));logger[_0xde80('0x15')](_0xde80('0x16'),_0x44dadc,_0xde80('0x14'),JSON[_0xde80('0x17')](_0x145f2c));if(_0x145f2c[_0xde80('0x18')]){if(_0x145f2c[_0xde80('0x18')][_0xde80('0x19')]===0x1f4){logger['error'](_0xde80('0x13'),_0x44dadc,_0x145f2c[_0xde80('0x18')][_0xde80('0x1a')]);return _0x1c809d(_0x145f2c[_0xde80('0x18')][_0xde80('0x1a')]);}logger[_0xde80('0x18')](_0xde80('0x13'),_0x44dadc,_0x145f2c[_0xde80('0x18')]['message']);return _0x400a5d(_0x145f2c[_0xde80('0x18')][_0xde80('0x1a')]);}else{logger[_0xde80('0x12')](_0xde80('0x13'),_0x44dadc,_0xde80('0x14'));_0x400a5d(_0x145f2c['result'][_0xde80('0x1a')]);}})[_0xde80('0x1b')](function(_0x97283a){logger['error'](_0xde80('0x13'),_0x44dadc,_0x97283a);_0x1c809d(_0x97283a);});});} \ No newline at end of file +var _0xb04c=['../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./team.socket','register','request','then','info','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','error','message','Team,\x20%s,\x20%s','result','catch','lodash','util','randomstring','ioredis','../../config/utils'];(function(_0x432bdc,_0x500534){var _0x44e665=function(_0x12ddc4){while(--_0x12ddc4){_0x432bdc['push'](_0x432bdc['shift']());}};_0x44e665(++_0x500534);}(_0xb04c,0x109));var _0xcb04=function(_0x41531f,_0x50fb91){_0x41531f=_0x41531f-0x0;var _0x11dbd1=_0xb04c[_0x41531f];return _0x11dbd1;};'use strict';var _=require(_0xcb04('0x0'));var util=require(_0xcb04('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xcb04('0x2'));var fs=require('fs');var Redis=require(_0xcb04('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xcb04('0x4'));var logger=require(_0xcb04('0x5'))(_0xcb04('0x6'));var config=require(_0xcb04('0x7'));var jayson=require(_0xcb04('0x8'));var client=jayson[_0xcb04('0x9')]['http']({'port':0x232a});config[_0xcb04('0xa')]=_[_0xcb04('0xb')](config['redis'],{'host':_0xcb04('0xc'),'port':0x18eb});var socket=require(_0xcb04('0xd'))(new Redis(config[_0xcb04('0xa')]));require(_0xcb04('0xe'))[_0xcb04('0xf')](socket);function respondWithRpcPromise(_0x3c1373,_0x385866,_0x380a97){return new BPromise(function(_0x57823b,_0x2379ad){return client[_0xcb04('0x10')](_0x3c1373,_0x380a97)[_0xcb04('0x11')](function(_0x474a11){logger[_0xcb04('0x12')]('Team,\x20%s,\x20%s',_0x385866,_0xcb04('0x13'));logger[_0xcb04('0x14')](_0xcb04('0x15'),_0x385866,_0xcb04('0x13'),JSON['stringify'](_0x474a11));if(_0x474a11[_0xcb04('0x16')]){if(_0x474a11[_0xcb04('0x16')]['code']===0x1f4){logger[_0xcb04('0x16')]('Team,\x20%s,\x20%s',_0x385866,_0x474a11[_0xcb04('0x16')]['message']);return _0x2379ad(_0x474a11[_0xcb04('0x16')][_0xcb04('0x17')]);}logger['error'](_0xcb04('0x18'),_0x385866,_0x474a11[_0xcb04('0x16')][_0xcb04('0x17')]);return _0x57823b(_0x474a11[_0xcb04('0x16')][_0xcb04('0x17')]);}else{logger[_0xcb04('0x12')](_0xcb04('0x18'),_0x385866,_0xcb04('0x13'));_0x57823b(_0x474a11[_0xcb04('0x19')][_0xcb04('0x17')]);}})[_0xcb04('0x1a')](function(_0x41c60b){logger[_0xcb04('0x16')]('Team,\x20%s,\x20%s',_0x385866,_0x41c60b);_0x2379ad(_0x41c60b);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index ba42260..635b436 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 _0x2a5c=['register','team:','./team.events','save','remove','update','emit'];(function(_0xf4a21e,_0x120e8e){var _0x2f6b05=function(_0x45e290){while(--_0x45e290){_0xf4a21e['push'](_0xf4a21e['shift']());}};_0x2f6b05(++_0x120e8e);}(_0x2a5c,0x1f3));var _0xc2a5=function(_0x4a6b01,_0x20b500){_0x4a6b01=_0x4a6b01-0x0;var _0x3e04ce=_0x2a5c[_0x4a6b01];return _0x3e04ce;};'use strict';var TeamEvents=require(_0xc2a5('0x0'));var events=[_0xc2a5('0x1'),_0xc2a5('0x2'),_0xc2a5('0x3')];function createListener(_0x438609,_0x53281f){return function(_0x3de54b){_0x53281f[_0xc2a5('0x4')](_0x438609,_0x3de54b);};}function removeListener(_0x247498,_0x98b693){return function(){TeamEvents['removeListener'](_0x247498,_0x98b693);};}exports[_0xc2a5('0x5')]=function(_0x4b84ea){for(var _0x106832=0x0,_0x350b2d=events['length'];_0x106832<_0x350b2d;_0x106832++){var _0x50de53=events[_0x106832];var _0x3a3cfb=createListener(_0xc2a5('0x6')+_0x50de53,_0x4b84ea);TeamEvents['on'](_0x50de53,_0x3a3cfb);}}; \ No newline at end of file +var _0xe3c9=['removeListener','length','team:','save','update','emit'];(function(_0x12d1ad,_0x13833b){var _0x433816=function(_0x5b45f4){while(--_0x5b45f4){_0x12d1ad['push'](_0x12d1ad['shift']());}};_0x433816(++_0x13833b);}(_0xe3c9,0x1ad));var _0x9e3c=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0xe3c9[_0x13e741];return _0x3f8bb3;};'use strict';var TeamEvents=require('./team.events');var events=[_0x9e3c('0x0'),'remove',_0x9e3c('0x1')];function createListener(_0x1a0602,_0x3b8dde){return function(_0x506a5a){_0x3b8dde[_0x9e3c('0x2')](_0x1a0602,_0x506a5a);};}function removeListener(_0x3532a7,_0x3dd874){return function(){TeamEvents[_0x9e3c('0x3')](_0x3532a7,_0x3dd874);};}exports['register']=function(_0x344bd1){for(var _0xd6e54e=0x0,_0x5347cb=events[_0x9e3c('0x4')];_0xd6e54e<_0x5347cb;_0xd6e54e++){var _0x335e99=events[_0xd6e54e];var _0x59a631=createListener(_0x9e3c('0x5')+_0x335e99,_0x344bd1);TeamEvents['on'](_0x335e99,_0x59a631);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index f079fc3..bb3b005 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 _0xb63f=['INTEGER'];(function(_0x1f1fb4,_0x15a561){var _0x12fa15=function(_0x5ecc9b){while(--_0x5ecc9b){_0x1f1fb4['push'](_0x1f1fb4['shift']());}};_0x12fa15(++_0x15a561);}(_0xb63f,0xa3));var _0xfb63=function(_0x2341c6,_0x3af092){_0x2341c6=_0x2341c6-0x0;var _0x54c34d=_0xb63f[_0x2341c6];return _0x54c34d;};'use strict';var Sequelize=require('sequelize');module['exports']={'TeamId':{'type':Sequelize[_0xfb63('0x0')]},'VoicePrefixId':{'type':Sequelize[_0xfb63('0x0')]}}; \ No newline at end of file +var _0x4e3c=['exports','INTEGER'];(function(_0x5ac0f0,_0xee4d98){var _0x4aceec=function(_0x3a9044){while(--_0x3a9044){_0x5ac0f0['push'](_0x5ac0f0['shift']());}};_0x4aceec(++_0xee4d98);}(_0x4e3c,0x1b4));var _0xc4e3=function(_0x1f5834,_0x421950){_0x1f5834=_0x1f5834-0x0;var _0x418e31=_0x4e3c[_0x1f5834];return _0x418e31;};'use strict';var Sequelize=require('sequelize');module[_0xc4e3('0x0')]={'TeamId':{'type':Sequelize[_0xc4e3('0x1')]},'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 911380f..9f7fbd6 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 _0xb515=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','TeamVoicePrefix','team_has_voice_prefixes','lodash','../../config/logger'];(function(_0x1fabf8,_0x2351a3){var _0x188709=function(_0x299aad){while(--_0x299aad){_0x1fabf8['push'](_0x1fabf8['shift']());}};_0x188709(++_0x2351a3);}(_0xb515,0x1b8));var _0x5b51=function(_0x423097,_0x8a09f4){_0x423097=_0x423097-0x0;var _0x3a73f1=_0xb515[_0x423097];return _0x3a73f1;};'use strict';var _=require(_0x5b51('0x0'));var util=require('util');var logger=require(_0x5b51('0x1'))(_0x5b51('0x2'));var moment=require(_0x5b51('0x3'));var BPromise=require(_0x5b51('0x4'));var rp=require(_0x5b51('0x5'));var fs=require('fs');var path=require(_0x5b51('0x6'));var rimraf=require(_0x5b51('0x7'));var config=require(_0x5b51('0x8'));var attributes=require('./teamVoicePrefix.attributes');module[_0x5b51('0x9')]=function(_0xf9e3ac,_0x3ef482){return _0xf9e3ac[_0x5b51('0xa')](_0x5b51('0xb'),attributes,{'tableName':_0x5b51('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xae60=['util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','TeamVoicePrefix','team_has_voice_prefixes','lodash'];(function(_0x473ab1,_0x546984){var _0x7e6eed=function(_0xcfb55f){while(--_0xcfb55f){_0x473ab1['push'](_0x473ab1['shift']());}};_0x7e6eed(++_0x546984);}(_0xae60,0x1c7));var _0x0ae6=function(_0x2e4e19,_0x493b50){_0x2e4e19=_0x2e4e19-0x0;var _0x9ba20b=_0xae60[_0x2e4e19];return _0x9ba20b;};'use strict';var _=require(_0x0ae6('0x0'));var util=require(_0x0ae6('0x1'));var logger=require(_0x0ae6('0x2'))('api');var moment=require(_0x0ae6('0x3'));var BPromise=require(_0x0ae6('0x4'));var rp=require(_0x0ae6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0ae6('0x6'));var config=require(_0x0ae6('0x7'));var attributes=require('./teamVoicePrefix.attributes');module[_0x0ae6('0x8')]=function(_0x25ac7c,_0x30e000){return _0x25ac7c[_0x0ae6('0x9')](_0x0ae6('0xa'),attributes,{'tableName':_0x0ae6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index 6e38cf1..ce14ad8 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x174570,_0x326c35){var _0x162b65=function(_0x456d18){while(--_0x456d18){_0x174570['push'](_0x174570['shift']());}};_0x162b65(++_0x326c35);}(_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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0xd0a847,_0x72562b){var _0x2536ec=function(_0x20e4db){while(--_0x20e4db){_0xd0a847['push'](_0xd0a847['shift']());}};_0x2536ec(++_0x72562b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xa9e0[_0x34bf97];return _0x292719;};'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/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index f328925..2f84736 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 _0x5570=['INTEGER'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x5570,0x122));var _0x0557=function(_0x4bf9aa,_0xafa1ec){_0x4bf9aa=_0x4bf9aa-0x0;var _0x1db38a=_0x5570[_0x4bf9aa];return _0x1db38a;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0x0557('0x0')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb828=['sequelize','INTEGER'];(function(_0x51ee5d,_0x2cb75d){var _0x57346c=function(_0x1969b8){while(--_0x1969b8){_0x51ee5d['push'](_0x51ee5d['shift']());}};_0x57346c(++_0x2cb75d);}(_0xb828,0x9e));var _0x8b82=function(_0x8c1005,_0x1f3f16){_0x8c1005=_0x8c1005-0x0;var _0x175354=_0xb828[_0x8c1005];return _0x175354;};'use strict';var Sequelize=require(_0x8b82('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x8b82('0x1')],'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 f7b9ec9..46f4bb4 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 _0xaf9b=['define','lodash','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./teamVoiceQueue.attributes','exports'];(function(_0x4fbef9,_0x96461b){var _0x434f60=function(_0x5692a2){while(--_0x5692a2){_0x4fbef9['push'](_0x4fbef9['shift']());}};_0x434f60(++_0x96461b);}(_0xaf9b,0x1d7));var _0xbaf9=function(_0x436995,_0x3ca230){_0x436995=_0x436995-0x0;var _0x5729bc=_0xaf9b[_0x436995];return _0x5729bc;};'use strict';var _=require(_0xbaf9('0x0'));var util=require('util');var logger=require(_0xbaf9('0x1'))('api');var moment=require(_0xbaf9('0x2'));var BPromise=require(_0xbaf9('0x3'));var rp=require(_0xbaf9('0x4'));var fs=require('fs');var path=require(_0xbaf9('0x5'));var rimraf=require('rimraf');var config=require(_0xbaf9('0x6'));var attributes=require(_0xbaf9('0x7'));module[_0xbaf9('0x8')]=function(_0x4b443e,_0x40b949){return _0x4b443e[_0xbaf9('0x9')]('TeamVoiceQueue',attributes,{'tableName':'team_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcf1c=['moment','bluebird','request-promise','./teamVoiceQueue.attributes','define','TeamVoiceQueue','team_has_voice_queues','lodash','util','api'];(function(_0x7d62cb,_0x7622c){var _0x3a6266=function(_0x1cc5fa){while(--_0x1cc5fa){_0x7d62cb['push'](_0x7d62cb['shift']());}};_0x3a6266(++_0x7622c);}(_0xcf1c,0x18d));var _0xccf1=function(_0x4e6eb2,_0x16a451){_0x4e6eb2=_0x4e6eb2-0x0;var _0x4e0c1c=_0xcf1c[_0x4e6eb2];return _0x4e0c1c;};'use strict';var _=require(_0xccf1('0x0'));var util=require(_0xccf1('0x1'));var logger=require('../../config/logger')(_0xccf1('0x2'));var moment=require(_0xccf1('0x3'));var BPromise=require(_0xccf1('0x4'));var rp=require(_0xccf1('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xccf1('0x6'));module['exports']=function(_0x17e358,_0x2ee316){return _0x17e358[_0xccf1('0x7')](_0xccf1('0x8'),attributes,{'tableName':_0xccf1('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js b/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js index 0ac2c72..057d12e 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 _0x984b=['TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','bluebird','randomstring','ioredis','../../config/logger','rpc','client','http','then','info'];(function(_0x5cc1f6,_0x375d52){var _0x105fb7=function(_0x3b895f){while(--_0x3b895f){_0x5cc1f6['push'](_0x5cc1f6['shift']());}};_0x105fb7(++_0x375d52);}(_0x984b,0xee));var _0xb984=function(_0x2b54b0,_0x22fec9){_0x2b54b0=_0x2b54b0-0x0;var _0x5b1dbd=_0x984b[_0x2b54b0];return _0x5b1dbd;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xb984('0x0'));var rs=require(_0xb984('0x1'));var fs=require('fs');var Redis=require(_0xb984('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb984('0x3'))(_0xb984('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb984('0x5')][_0xb984('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x5a605a,_0x7405cd,_0x1a00d6){return new BPromise(function(_0x4d72b7,_0x37fd36){return client['request'](_0x5a605a,_0x1a00d6)[_0xb984('0x7')](function(_0x42dfd9){logger[_0xb984('0x8')](_0xb984('0x9'),_0x7405cd,_0xb984('0xa'));logger[_0xb984('0xb')](_0xb984('0xc'),_0x7405cd,_0xb984('0xa'),JSON[_0xb984('0xd')](_0x42dfd9));if(_0x42dfd9[_0xb984('0xe')]){if(_0x42dfd9[_0xb984('0xe')][_0xb984('0xf')]===0x1f4){logger['error'](_0xb984('0x9'),_0x7405cd,_0x42dfd9['error'][_0xb984('0x10')]);return _0x37fd36(_0x42dfd9[_0xb984('0xe')]['message']);}logger[_0xb984('0xe')](_0xb984('0x9'),_0x7405cd,_0x42dfd9['error'][_0xb984('0x10')]);return _0x4d72b7(_0x42dfd9[_0xb984('0xe')]['message']);}else{logger[_0xb984('0x8')](_0xb984('0x9'),_0x7405cd,'request\x20sent');_0x4d72b7(_0x42dfd9[_0xb984('0x11')]['message']);}})[_0xb984('0x12')](function(_0x1dc4df){logger[_0xb984('0xe')](_0xb984('0x9'),_0x7405cd,_0x1dc4df);_0x37fd36(_0x1dc4df);});});} \ No newline at end of file +var _0x5afe=['jayson/promise','client','http','then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x33155a,_0x1c4a6e){var _0x31c14f=function(_0x5f2b51){while(--_0x5f2b51){_0x33155a['push'](_0x33155a['shift']());}};_0x31c14f(++_0x1c4a6e);}(_0x5afe,0x1ab));var _0xe5af=function(_0x2cf702,_0x333323){_0x2cf702=_0x2cf702-0x0;var _0x15f7a6=_0x5afe[_0x2cf702];return _0x15f7a6;};'use strict';var _=require(_0xe5af('0x0'));var util=require(_0xe5af('0x1'));var moment=require(_0xe5af('0x2'));var BPromise=require(_0xe5af('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe5af('0x4'));var db=require(_0xe5af('0x5'))['db'];var utils=require(_0xe5af('0x6'));var logger=require(_0xe5af('0x7'))(_0xe5af('0x8'));var config=require(_0xe5af('0x9'));var jayson=require(_0xe5af('0xa'));var client=jayson[_0xe5af('0xb')][_0xe5af('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4f5d82,_0x5737c2,_0x2161df){return new BPromise(function(_0x1cc1f3,_0x4876a3){return client['request'](_0x4f5d82,_0x2161df)[_0xe5af('0xd')](function(_0x7e621c){logger[_0xe5af('0xe')](_0xe5af('0xf'),_0x5737c2,_0xe5af('0x10'));logger[_0xe5af('0x11')](_0xe5af('0x12'),_0x5737c2,'request\x20sent',JSON['stringify'](_0x7e621c));if(_0x7e621c[_0xe5af('0x13')]){if(_0x7e621c[_0xe5af('0x13')][_0xe5af('0x14')]===0x1f4){logger[_0xe5af('0x13')](_0xe5af('0xf'),_0x5737c2,_0x7e621c[_0xe5af('0x13')][_0xe5af('0x15')]);return _0x4876a3(_0x7e621c['error'][_0xe5af('0x15')]);}logger[_0xe5af('0x13')](_0xe5af('0xf'),_0x5737c2,_0x7e621c[_0xe5af('0x13')][_0xe5af('0x15')]);return _0x1cc1f3(_0x7e621c[_0xe5af('0x13')][_0xe5af('0x15')]);}else{logger[_0xe5af('0xe')](_0xe5af('0xf'),_0x5737c2,'request\x20sent');_0x1cc1f3(_0x7e621c['result'][_0xe5af('0x15')]);}})[_0xe5af('0x16')](function(_0x305eda){logger[_0xe5af('0x13')](_0xe5af('0xf'),_0x5737c2,_0x305eda);_0x4876a3(_0x305eda);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index e01171f..307d289 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 _0x8af6=['post','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show'];(function(_0x21cb7f,_0x48cd16){var _0x5a079a=function(_0x569a4f){while(--_0x569a4f){_0x21cb7f['push'](_0x21cb7f['shift']());}};_0x5a079a(++_0x48cd16);}(_0x8af6,0x76));var _0x68af=function(_0x1a02a3,_0x9e0fc7){_0x1a02a3=_0x1a02a3-0x0;var _0x44bb59=_0x8af6[_0x1a02a3];return _0x44bb59;};'use strict';var multer=require(_0x68af('0x0'));var util=require(_0x68af('0x1'));var path=require(_0x68af('0x2'));var timeout=require(_0x68af('0x3'));var express=require(_0x68af('0x4'));var router=express[_0x68af('0x5')]();var fs_extra=require(_0x68af('0x6'));var auth=require(_0x68af('0x7'));var interaction=require(_0x68af('0x8'));var config=require(_0x68af('0x9'));var controller=require('./template.controller');router[_0x68af('0xa')]('/',auth['isAuthenticated'](),controller[_0x68af('0xb')]);router[_0x68af('0xa')](_0x68af('0xc'),auth[_0x68af('0xd')](),controller[_0x68af('0xe')]);router[_0x68af('0xf')]('/',auth[_0x68af('0xd')](),controller['create']);router['put'](_0x68af('0xc'),auth[_0x68af('0xd')](),controller['update']);router[_0x68af('0x10')](_0x68af('0xc'),auth[_0x68af('0xd')](),controller[_0x68af('0x11')]);module[_0x68af('0x12')]=router; \ No newline at end of file +var _0xb03e=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','get','isAuthenticated','/:id','show','post','put','delete','destroy','exports','util','path','connect-timeout'];(function(_0x1bae8b,_0x216db4){var _0x5a8751=function(_0x59eae3){while(--_0x59eae3){_0x1bae8b['push'](_0x1bae8b['shift']());}};_0x5a8751(++_0x216db4);}(_0xb03e,0x1eb));var _0xeb03=function(_0x19867d,_0x3e1f1f){_0x19867d=_0x19867d-0x0;var _0x359fb4=_0xb03e[_0x19867d];return _0x359fb4;};'use strict';var multer=require('multer');var util=require(_0xeb03('0x0'));var path=require(_0xeb03('0x1'));var timeout=require(_0xeb03('0x2'));var express=require(_0xeb03('0x3'));var router=express[_0xeb03('0x4')]();var fs_extra=require(_0xeb03('0x5'));var auth=require(_0xeb03('0x6'));var interaction=require(_0xeb03('0x7'));var config=require(_0xeb03('0x8'));var controller=require(_0xeb03('0x9'));router[_0xeb03('0xa')]('/',auth[_0xeb03('0xb')](),controller['index']);router[_0xeb03('0xa')](_0xeb03('0xc'),auth[_0xeb03('0xb')](),controller[_0xeb03('0xd')]);router[_0xeb03('0xe')]('/',auth[_0xeb03('0xb')](),controller['create']);router[_0xeb03('0xf')](_0xeb03('0xc'),auth[_0xeb03('0xb')](),controller['update']);router[_0xeb03('0x10')]('/:id',auth[_0xeb03('0xb')](),controller[_0xeb03('0x11')]);module[_0xeb03('0x12')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 42bd9c0..4297e79 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 _0x4fd9=['sequelize','STRING'];(function(_0x244862,_0x3da79e){var _0x2bce23=function(_0x235ae5){while(--_0x235ae5){_0x244862['push'](_0x244862['shift']());}};_0x2bce23(++_0x3da79e);}(_0x4fd9,0xc6));var _0x94fd=function(_0x38fe61,_0x22a33a){_0x38fe61=_0x38fe61-0x0;var _0x5a140f=_0x4fd9[_0x38fe61];return _0x5a140f;};'use strict';var Sequelize=require(_0x94fd('0x0'));module['exports']={'name':{'type':Sequelize[_0x94fd('0x1')]},'description':{'type':Sequelize[_0x94fd('0x1')]},'html':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x8476=['sequelize','exports','STRING'];(function(_0x38605b,_0x3a41fd){var _0x14c334=function(_0x31c9da){while(--_0x31c9da){_0x38605b['push'](_0x38605b['shift']());}};_0x14c334(++_0x3a41fd);}(_0x8476,0x1bf));var _0x6847=function(_0x50abc4,_0x558d64){_0x50abc4=_0x50abc4-0x0;var _0x5a745d=_0x8476[_0x50abc4];return _0x5a745d;};'use strict';var Sequelize=require(_0x6847('0x0'));module[_0x6847('0x1')]={'name':{'type':Sequelize[_0x6847('0x2')]},'description':{'type':Sequelize[_0x6847('0x2')]},'html':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index d840711..0820996 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 _0xfee6=['reject','save','then','destroy','Templates','UserProfileResource','stack','name','index','Template','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','attributes','fields','model','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','Content-Range','apply'];(function(_0x45f951,_0x2750c8){var _0x24756c=function(_0x31c931){while(--_0x31c931){_0x45f951['push'](_0x45f951['shift']());}};_0x24756c(++_0x2750c8);}(_0xfee6,0x1d6));var _0x6fee=function(_0x14b4a0,_0x23ccc3){_0x14b4a0=_0x14b4a0-0x0;var _0x22be64=_0xfee6[_0x14b4a0];return _0x22be64;};'use strict';var emlformat=require(_0x6fee('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x6fee('0x1'));var rp=require('request-promise');var moment=require(_0x6fee('0x2'));var BPromise=require(_0x6fee('0x3'));var Mustache=require(_0x6fee('0x4'));var util=require(_0x6fee('0x5'));var path=require(_0x6fee('0x6'));var sox=require(_0x6fee('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6fee('0x8'));var _=require(_0x6fee('0x9'));var squel=require(_0x6fee('0xa'));var crypto=require('crypto');var jsforce=require(_0x6fee('0xb'));var deskjs=require(_0x6fee('0xc'));var toCsv=require(_0x6fee('0xd'));var querystring=require(_0x6fee('0xe'));var Papa=require(_0x6fee('0xf'));var Redis=require(_0x6fee('0x10'));var authService=require(_0x6fee('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6fee('0x12'));var logger=require(_0x6fee('0x13'))(_0x6fee('0x14'));var utils=require(_0x6fee('0x15'));var config=require(_0x6fee('0x16'));var licenseUtil=require(_0x6fee('0x17'));var db=require(_0x6fee('0x18'))['db'];function respondWithStatusCode(_0x380f68,_0x22aa76){_0x22aa76=_0x22aa76||0xcc;return function(_0x51629c){if(_0x51629c){return _0x380f68[_0x6fee('0x19')](_0x22aa76);}return _0x380f68[_0x6fee('0x1a')](_0x22aa76)[_0x6fee('0x1b')]();};}function respondWithResult(_0x319c8a,_0x39c670){_0x39c670=_0x39c670||0xc8;return function(_0x44387e){if(_0x44387e){return _0x319c8a['status'](_0x39c670)['json'](_0x44387e);}};}function respondWithFilteredResult(_0x34c77c,_0x49e884){return function(_0x38ed32){if(_0x38ed32){var _0x1a2bd6=typeof _0x49e884[_0x6fee('0x1c')]===_0x6fee('0x1d')&&typeof _0x49e884['limit']===_0x6fee('0x1d');var _0x550e40=_0x38ed32[_0x6fee('0x1e')];var _0x2ec563=_0x1a2bd6?0x0:_0x49e884[_0x6fee('0x1c')];var _0x3d4ff2=_0x1a2bd6?_0x38ed32['count']:_0x49e884[_0x6fee('0x1c')]+_0x49e884[_0x6fee('0x1f')];var _0x3fe908;if(_0x3d4ff2>=_0x550e40){_0x3d4ff2=_0x550e40;_0x3fe908=0xc8;}else{_0x3fe908=0xce;}_0x34c77c[_0x6fee('0x1a')](_0x3fe908);return _0x34c77c['set'](_0x6fee('0x20'),_0x2ec563+'-'+_0x3d4ff2+'/'+_0x550e40)['json'](_0x38ed32);}return null;};}function patchUpdates(_0x219c92){return function(_0x3c3d50){try{jsonpatch[_0x6fee('0x21')](_0x3c3d50,_0x219c92,!![]);}catch(_0xb9db47){return BPromise[_0x6fee('0x22')](_0xb9db47);}return _0x3c3d50[_0x6fee('0x23')]();};}function saveUpdates(_0x32a939,_0xa05d49){return function(_0x4e84c3){if(_0x4e84c3){return _0x4e84c3['update'](_0x32a939)[_0x6fee('0x24')](function(_0x178a80){return _0x178a80;});}return null;};}function removeEntity(_0x5b20bf,_0x26c4af){return function(_0x141d51){if(_0x141d51){return _0x141d51[_0x6fee('0x25')]()[_0x6fee('0x24')](function(){var _0x49b0cd=_0x141d51['get']({'plain':!![]});var _0x57c86a=_0x6fee('0x26');return db[_0x6fee('0x27')]['destroy']({'where':{'type':_0x57c86a,'resourceId':_0x49b0cd['id']}})['then'](function(){return _0x141d51;});})['then'](function(){_0x5b20bf['status'](0xcc)[_0x6fee('0x1b')]();});}};}function handleEntityNotFound(_0x470ed2,_0x8fa534){return function(_0x28323e){if(!_0x28323e){_0x470ed2[_0x6fee('0x19')](0x194);}return _0x28323e;};}function handleError(_0x5b9174,_0x474dfe){_0x474dfe=_0x474dfe||0x1f4;return function(_0x5e9cea){logger['error'](_0x5e9cea[_0x6fee('0x28')]);if(_0x5e9cea[_0x6fee('0x29')]){delete _0x5e9cea[_0x6fee('0x29')];}_0x5b9174[_0x6fee('0x1a')](_0x474dfe)['send'](_0x5e9cea);};}exports[_0x6fee('0x2a')]=function(_0x39062e,_0x942206){var _0x2593b5={},_0x57b99e={},_0x49cb31={'count':0x0,'rows':[]};var _0xc9d527=_['map'](db[_0x6fee('0x2b')][_0x6fee('0x2c')],function(_0x557125){return{'name':_0x557125[_0x6fee('0x2d')],'type':_0x557125[_0x6fee('0x2e')][_0x6fee('0x2f')]};});_0x57b99e['model']=_[_0x6fee('0x30')](_0xc9d527,_0x6fee('0x29'));_0x57b99e[_0x6fee('0x31')]=_[_0x6fee('0x32')](_0x39062e[_0x6fee('0x31')]);_0x57b99e[_0x6fee('0x33')]=_[_0x6fee('0x34')](_0x57b99e['model'],_0x57b99e['query']);_0x2593b5[_0x6fee('0x35')]=_[_0x6fee('0x34')](_0x57b99e['model'],qs['fields'](_0x39062e[_0x6fee('0x31')][_0x6fee('0x36')]));_0x2593b5[_0x6fee('0x35')]=_0x2593b5[_0x6fee('0x35')]['length']?_0x2593b5[_0x6fee('0x35')]:_0x57b99e[_0x6fee('0x37')];if(!_0x39062e['query'][_0x6fee('0x38')](_0x6fee('0x39'))){_0x2593b5[_0x6fee('0x1f')]=qs[_0x6fee('0x1f')](_0x39062e[_0x6fee('0x31')][_0x6fee('0x1f')]);_0x2593b5['offset']=qs['offset'](_0x39062e[_0x6fee('0x31')][_0x6fee('0x1c')]);}_0x2593b5[_0x6fee('0x3a')]=qs[_0x6fee('0x3b')](_0x39062e[_0x6fee('0x31')][_0x6fee('0x3b')]);_0x2593b5['where']=qs[_0x6fee('0x33')](_[_0x6fee('0x3c')](_0x39062e['query'],_0x57b99e[_0x6fee('0x33')]),_0xc9d527);if(_0x39062e['query']['filter']){_0x2593b5[_0x6fee('0x3d')]=_[_0x6fee('0x3e')](_0x2593b5['where'],{'$or':_[_0x6fee('0x30')](_0xc9d527,function(_0x479deb){if(_0x479deb['type']!==_0x6fee('0x3f')){var _0x335bf5={};_0x335bf5[_0x479deb['name']]={'$like':'%'+_0x39062e[_0x6fee('0x31')]['filter']+'%'};return _0x335bf5;}})});}_0x2593b5=_['merge']({},_0x2593b5,_0x39062e[_0x6fee('0x40')]);var _0x152f37={'where':_0x2593b5[_0x6fee('0x3d')]};return db[_0x6fee('0x2b')]['count'](_0x152f37)[_0x6fee('0x24')](function(_0x77c242){_0x49cb31['count']=_0x77c242;if(_0x39062e[_0x6fee('0x31')][_0x6fee('0x41')]){_0x2593b5[_0x6fee('0x42')]=[{'all':!![]}];}return db['Template'][_0x6fee('0x43')](_0x2593b5);})['then'](function(_0x1340f6){_0x49cb31[_0x6fee('0x44')]=_0x1340f6;return _0x49cb31;})['then'](respondWithFilteredResult(_0x942206,_0x2593b5))[_0x6fee('0x45')](handleError(_0x942206,null));};exports[_0x6fee('0x46')]=function(_0x1f3e89,_0x449cce){var _0x1e0c73={'raw':!![],'where':{'id':_0x1f3e89[_0x6fee('0x47')]['id']}},_0x4b673b={};_0x4b673b[_0x6fee('0x37')]=_[_0x6fee('0x32')](db['Template']['rawAttributes']);_0x4b673b[_0x6fee('0x31')]=_[_0x6fee('0x32')](_0x1f3e89[_0x6fee('0x31')]);_0x4b673b[_0x6fee('0x33')]=_[_0x6fee('0x34')](_0x4b673b[_0x6fee('0x37')],_0x4b673b[_0x6fee('0x31')]);_0x1e0c73[_0x6fee('0x35')]=_['intersection'](_0x4b673b['model'],qs[_0x6fee('0x36')](_0x1f3e89['query'][_0x6fee('0x36')]));_0x1e0c73[_0x6fee('0x35')]=_0x1e0c73[_0x6fee('0x35')][_0x6fee('0x48')]?_0x1e0c73[_0x6fee('0x35')]:_0x4b673b['model'];if(_0x1f3e89[_0x6fee('0x31')][_0x6fee('0x41')]){_0x1e0c73[_0x6fee('0x42')]=[{'all':!![]}];}_0x1e0c73=_[_0x6fee('0x3e')]({},_0x1e0c73,_0x1f3e89[_0x6fee('0x40')]);return db[_0x6fee('0x2b')][_0x6fee('0x49')](_0x1e0c73)[_0x6fee('0x24')](handleEntityNotFound(_0x449cce,null))[_0x6fee('0x24')](respondWithResult(_0x449cce,null))['catch'](handleError(_0x449cce,null));};exports[_0x6fee('0x4a')]=function(_0x38d5fb,_0x28d6d1){return db[_0x6fee('0x2b')][_0x6fee('0x4a')](_0x38d5fb[_0x6fee('0x4b')],{})[_0x6fee('0x24')](function(_0x5e2b28){var _0x8c9b3e=_0x38d5fb[_0x6fee('0x4c')][_0x6fee('0x4d')]({'plain':!![]});if(!_0x8c9b3e)throw new Error(_0x6fee('0x4e'));if(_0x8c9b3e[_0x6fee('0x4f')]===_0x6fee('0x4c')){var _0x3ab831=_0x5e2b28[_0x6fee('0x4d')]({'plain':!![]});var _0x60fe95=_0x6fee('0x26');return db['UserProfileSection'][_0x6fee('0x49')]({'where':{'name':_0x60fe95,'userProfileId':_0x8c9b3e[_0x6fee('0x50')]},'raw':!![]})[_0x6fee('0x24')](function(_0x5e0da0){if(_0x5e0da0&&_0x5e0da0[_0x6fee('0x51')]===0x0){return db['UserProfileResource'][_0x6fee('0x4a')]({'name':_0x3ab831[_0x6fee('0x29')],'resourceId':_0x3ab831['id'],'type':_0x5e0da0[_0x6fee('0x29')],'sectionId':_0x5e0da0['id']},{})[_0x6fee('0x24')](function(){return _0x5e2b28;});}else{return _0x5e2b28;}})['catch'](function(_0x43839c){logger[_0x6fee('0x52')](_0x6fee('0x53'),_0x43839c);throw _0x43839c;});}return _0x5e2b28;})[_0x6fee('0x24')](respondWithResult(_0x28d6d1,0xc9))[_0x6fee('0x45')](handleError(_0x28d6d1,null));};exports['update']=function(_0x2cb9c7,_0x89ec64){if(_0x2cb9c7['body']['id']){delete _0x2cb9c7[_0x6fee('0x4b')]['id'];}return db[_0x6fee('0x2b')][_0x6fee('0x49')]({'where':{'id':_0x2cb9c7['params']['id']}})[_0x6fee('0x24')](handleEntityNotFound(_0x89ec64,null))['then'](saveUpdates(_0x2cb9c7[_0x6fee('0x4b')],null))[_0x6fee('0x24')](respondWithResult(_0x89ec64,null))[_0x6fee('0x45')](handleError(_0x89ec64,null));};exports[_0x6fee('0x25')]=function(_0x2ee14a,_0x5b1057){return db[_0x6fee('0x2b')][_0x6fee('0x49')]({'where':{'id':_0x2ee14a[_0x6fee('0x47')]['id']}})[_0x6fee('0x24')](handleEntityNotFound(_0x5b1057,null))[_0x6fee('0x24')](removeEntity(_0x5b1057,null))['catch'](handleError(_0x5b1057,null));}; \ No newline at end of file +var _0xc385=['lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','end','error','stack','name','send','index','map','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','merge','VIRTUAL','filter','options','where','Template','includeAll','include','findAll','rows','show','params','catch','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','create','find','eml-format','rimraf','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','fs-extra'];(function(_0x4d8fe1,_0x3ed474){var _0x46685e=function(_0x268c73){while(--_0x268c73){_0x4d8fe1['push'](_0x4d8fe1['shift']());}};_0x46685e(++_0x3ed474);}(_0xc385,0xa0));var _0x5c38=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0xc385[_0x5d2803];return _0xdcad2c;};'use strict';var emlformat=require(_0x5c38('0x0'));var rimraf=require(_0x5c38('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5c38('0x2'));var rp=require('request-promise');var moment=require(_0x5c38('0x3'));var BPromise=require(_0x5c38('0x4'));var Mustache=require('mustache');var util=require(_0x5c38('0x5'));var path=require('path');var sox=require(_0x5c38('0x6'));var csv=require(_0x5c38('0x7'));var ejs=require(_0x5c38('0x8'));var fs=require('fs');var fs_extra=require(_0x5c38('0x9'));var _=require(_0x5c38('0xa'));var squel=require('squel');var crypto=require(_0x5c38('0xb'));var jsforce=require(_0x5c38('0xc'));var deskjs=require(_0x5c38('0xd'));var toCsv=require(_0x5c38('0x7'));var querystring=require(_0x5c38('0xe'));var Papa=require(_0x5c38('0xf'));var Redis=require(_0x5c38('0x10'));var authService=require(_0x5c38('0x11'));var qs=require(_0x5c38('0x12'));var as=require(_0x5c38('0x13'));var hardwareService=require(_0x5c38('0x14'));var logger=require(_0x5c38('0x15'))(_0x5c38('0x16'));var utils=require('../../config/utils');var config=require(_0x5c38('0x17'));var licenseUtil=require(_0x5c38('0x18'));var db=require(_0x5c38('0x19'))['db'];function respondWithStatusCode(_0x5f3cf5,_0x4fd611){_0x4fd611=_0x4fd611||0xcc;return function(_0x30328a){if(_0x30328a){return _0x5f3cf5[_0x5c38('0x1a')](_0x4fd611);}return _0x5f3cf5[_0x5c38('0x1b')](_0x4fd611)['end']();};}function respondWithResult(_0x292a0a,_0x487b34){_0x487b34=_0x487b34||0xc8;return function(_0x298f4c){if(_0x298f4c){return _0x292a0a[_0x5c38('0x1b')](_0x487b34)[_0x5c38('0x1c')](_0x298f4c);}};}function respondWithFilteredResult(_0x1af090,_0x4852cb){return function(_0x3baed){if(_0x3baed){var _0x3ade09=typeof _0x4852cb[_0x5c38('0x1d')]===_0x5c38('0x1e')&&typeof _0x4852cb[_0x5c38('0x1f')]===_0x5c38('0x1e');var _0x29ab8d=_0x3baed['count'];var _0x2f0121=_0x3ade09?0x0:_0x4852cb[_0x5c38('0x1d')];var _0x37e100=_0x3ade09?_0x3baed[_0x5c38('0x20')]:_0x4852cb[_0x5c38('0x1d')]+_0x4852cb[_0x5c38('0x1f')];var _0x216d33;if(_0x37e100>=_0x29ab8d){_0x37e100=_0x29ab8d;_0x216d33=0xc8;}else{_0x216d33=0xce;}_0x1af090[_0x5c38('0x1b')](_0x216d33);return _0x1af090[_0x5c38('0x21')](_0x5c38('0x22'),_0x2f0121+'-'+_0x37e100+'/'+_0x29ab8d)['json'](_0x3baed);}return null;};}function patchUpdates(_0x10d402){return function(_0xca1d14){try{jsonpatch[_0x5c38('0x23')](_0xca1d14,_0x10d402,!![]);}catch(_0x4effbf){return BPromise[_0x5c38('0x24')](_0x4effbf);}return _0xca1d14[_0x5c38('0x25')]();};}function saveUpdates(_0x5bb2fb,_0x28c954){return function(_0x17248f){if(_0x17248f){return _0x17248f[_0x5c38('0x26')](_0x5bb2fb)[_0x5c38('0x27')](function(_0x12af4c){return _0x12af4c;});}return null;};}function removeEntity(_0x2b5e14,_0x560698){return function(_0x11313d){if(_0x11313d){return _0x11313d[_0x5c38('0x28')]()[_0x5c38('0x27')](function(){var _0x1b224a=_0x11313d[_0x5c38('0x29')]({'plain':!![]});var _0x8d25a9='Templates';return db[_0x5c38('0x2a')]['destroy']({'where':{'type':_0x8d25a9,'resourceId':_0x1b224a['id']}})[_0x5c38('0x27')](function(){return _0x11313d;});})[_0x5c38('0x27')](function(){_0x2b5e14[_0x5c38('0x1b')](0xcc)[_0x5c38('0x2b')]();});}};}function handleEntityNotFound(_0x247fd6,_0x2cb27a){return function(_0x1a8746){if(!_0x1a8746){_0x247fd6[_0x5c38('0x1a')](0x194);}return _0x1a8746;};}function handleError(_0xb41d85,_0x67d67d){_0x67d67d=_0x67d67d||0x1f4;return function(_0x16fdf3){logger[_0x5c38('0x2c')](_0x16fdf3[_0x5c38('0x2d')]);if(_0x16fdf3['name']){delete _0x16fdf3[_0x5c38('0x2e')];}_0xb41d85['status'](_0x67d67d)[_0x5c38('0x2f')](_0x16fdf3);};}exports[_0x5c38('0x30')]=function(_0x279e6e,_0x35611b){var _0x1f1f52={},_0x1c0ff2={},_0x1979df={'count':0x0,'rows':[]};var _0x55edd0=_[_0x5c38('0x31')](db['Template']['rawAttributes'],function(_0x21f02c){return{'name':_0x21f02c[_0x5c38('0x32')],'type':_0x21f02c[_0x5c38('0x33')][_0x5c38('0x34')]};});_0x1c0ff2[_0x5c38('0x35')]=_[_0x5c38('0x31')](_0x55edd0,_0x5c38('0x2e'));_0x1c0ff2[_0x5c38('0x36')]=_[_0x5c38('0x37')](_0x279e6e['query']);_0x1c0ff2[_0x5c38('0x38')]=_['intersection'](_0x1c0ff2[_0x5c38('0x35')],_0x1c0ff2[_0x5c38('0x36')]);_0x1f1f52['attributes']=_[_0x5c38('0x39')](_0x1c0ff2[_0x5c38('0x35')],qs[_0x5c38('0x3a')](_0x279e6e[_0x5c38('0x36')][_0x5c38('0x3a')]));_0x1f1f52[_0x5c38('0x3b')]=_0x1f1f52[_0x5c38('0x3b')][_0x5c38('0x3c')]?_0x1f1f52['attributes']:_0x1c0ff2['model'];if(!_0x279e6e['query'][_0x5c38('0x3d')](_0x5c38('0x3e'))){_0x1f1f52[_0x5c38('0x1f')]=qs[_0x5c38('0x1f')](_0x279e6e[_0x5c38('0x36')][_0x5c38('0x1f')]);_0x1f1f52[_0x5c38('0x1d')]=qs[_0x5c38('0x1d')](_0x279e6e[_0x5c38('0x36')][_0x5c38('0x1d')]);}_0x1f1f52[_0x5c38('0x3f')]=qs[_0x5c38('0x40')](_0x279e6e[_0x5c38('0x36')]['sort']);_0x1f1f52['where']=qs['filters'](_['pick'](_0x279e6e['query'],_0x1c0ff2[_0x5c38('0x38')]),_0x55edd0);if(_0x279e6e[_0x5c38('0x36')]['filter']){_0x1f1f52['where']=_[_0x5c38('0x41')](_0x1f1f52['where'],{'$or':_[_0x5c38('0x31')](_0x55edd0,function(_0x25a1c2){if(_0x25a1c2[_0x5c38('0x33')]!==_0x5c38('0x42')){var _0x3d6d91={};_0x3d6d91[_0x25a1c2['name']]={'$like':'%'+_0x279e6e[_0x5c38('0x36')][_0x5c38('0x43')]+'%'};return _0x3d6d91;}})});}_0x1f1f52=_['merge']({},_0x1f1f52,_0x279e6e[_0x5c38('0x44')]);var _0x4e02c8={'where':_0x1f1f52[_0x5c38('0x45')]};return db[_0x5c38('0x46')][_0x5c38('0x20')](_0x4e02c8)['then'](function(_0x13be7d){_0x1979df[_0x5c38('0x20')]=_0x13be7d;if(_0x279e6e[_0x5c38('0x36')][_0x5c38('0x47')]){_0x1f1f52[_0x5c38('0x48')]=[{'all':!![]}];}return db[_0x5c38('0x46')][_0x5c38('0x49')](_0x1f1f52);})[_0x5c38('0x27')](function(_0xc6ab98){_0x1979df[_0x5c38('0x4a')]=_0xc6ab98;return _0x1979df;})['then'](respondWithFilteredResult(_0x35611b,_0x1f1f52))['catch'](handleError(_0x35611b,null));};exports[_0x5c38('0x4b')]=function(_0x58fd1e,_0x1caa5a){var _0x1d658b={'raw':!![],'where':{'id':_0x58fd1e[_0x5c38('0x4c')]['id']}},_0x106333={};_0x106333[_0x5c38('0x35')]=_[_0x5c38('0x37')](db[_0x5c38('0x46')]['rawAttributes']);_0x106333[_0x5c38('0x36')]=_['keys'](_0x58fd1e[_0x5c38('0x36')]);_0x106333[_0x5c38('0x38')]=_['intersection'](_0x106333[_0x5c38('0x35')],_0x106333[_0x5c38('0x36')]);_0x1d658b[_0x5c38('0x3b')]=_[_0x5c38('0x39')](_0x106333[_0x5c38('0x35')],qs[_0x5c38('0x3a')](_0x58fd1e[_0x5c38('0x36')][_0x5c38('0x3a')]));_0x1d658b[_0x5c38('0x3b')]=_0x1d658b[_0x5c38('0x3b')][_0x5c38('0x3c')]?_0x1d658b[_0x5c38('0x3b')]:_0x106333[_0x5c38('0x35')];if(_0x58fd1e[_0x5c38('0x36')]['includeAll']){_0x1d658b['include']=[{'all':!![]}];}_0x1d658b=_[_0x5c38('0x41')]({},_0x1d658b,_0x58fd1e['options']);return db[_0x5c38('0x46')]['find'](_0x1d658b)['then'](handleEntityNotFound(_0x1caa5a,null))[_0x5c38('0x27')](respondWithResult(_0x1caa5a,null))[_0x5c38('0x4d')](handleError(_0x1caa5a,null));};exports['create']=function(_0x5771c7,_0x5dfcfc){return db['Template']['create'](_0x5771c7[_0x5c38('0x4e')],{})[_0x5c38('0x27')](function(_0x4881d5){var _0x32e5b6=_0x5771c7['user'][_0x5c38('0x29')]({'plain':!![]});if(!_0x32e5b6)throw new Error(_0x5c38('0x4f'));if(_0x32e5b6[_0x5c38('0x50')]==='user'){var _0x37140e=_0x4881d5[_0x5c38('0x29')]({'plain':!![]});var _0x32bb8c='Templates';return db[_0x5c38('0x51')]['find']({'where':{'name':_0x32bb8c,'userProfileId':_0x32e5b6['userProfileId']},'raw':!![]})[_0x5c38('0x27')](function(_0x2ea0fb){if(_0x2ea0fb&&_0x2ea0fb[_0x5c38('0x52')]===0x0){return db[_0x5c38('0x2a')][_0x5c38('0x53')]({'name':_0x37140e[_0x5c38('0x2e')],'resourceId':_0x37140e['id'],'type':_0x2ea0fb[_0x5c38('0x2e')],'sectionId':_0x2ea0fb['id']},{})['then'](function(){return _0x4881d5;});}else{return _0x4881d5;}})['catch'](function(_0x2f77d6){logger[_0x5c38('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2f77d6);throw _0x2f77d6;});}return _0x4881d5;})['then'](respondWithResult(_0x5dfcfc,0xc9))['catch'](handleError(_0x5dfcfc,null));};exports[_0x5c38('0x26')]=function(_0x4fad09,_0x492f24){if(_0x4fad09[_0x5c38('0x4e')]['id']){delete _0x4fad09[_0x5c38('0x4e')]['id'];}return db[_0x5c38('0x46')][_0x5c38('0x54')]({'where':{'id':_0x4fad09['params']['id']}})[_0x5c38('0x27')](handleEntityNotFound(_0x492f24,null))['then'](saveUpdates(_0x4fad09['body'],null))[_0x5c38('0x27')](respondWithResult(_0x492f24,null))[_0x5c38('0x4d')](handleError(_0x492f24,null));};exports[_0x5c38('0x28')]=function(_0x6fccba,_0x37d20c){return db[_0x5c38('0x46')][_0x5c38('0x54')]({'where':{'id':_0x6fccba[_0x5c38('0x4c')]['id']}})[_0x5c38('0x27')](handleEntityNotFound(_0x37d20c,null))[_0x5c38('0x27')](removeEntity(_0x37d20c,null))[_0x5c38('0x4d')](handleError(_0x37d20c,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index df5d644..a7b33d2 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 _0x3783=['exports','define','lodash','util','api','bluebird','request-promise','rimraf','../../config/environment','./template.attributes'];(function(_0x534155,_0x6d208c){var _0xb21989=function(_0x4b9e49){while(--_0x4b9e49){_0x534155['push'](_0x534155['shift']());}};_0xb21989(++_0x6d208c);}(_0x3783,0x17e));var _0x3378=function(_0xa540bd,_0x51e4c7){_0xa540bd=_0xa540bd-0x0;var _0x548781=_0x3783[_0xa540bd];return _0x548781;};'use strict';var _=require(_0x3378('0x0'));var util=require(_0x3378('0x1'));var logger=require('../../config/logger')(_0x3378('0x2'));var moment=require('moment');var BPromise=require(_0x3378('0x3'));var rp=require(_0x3378('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3378('0x5'));var config=require(_0x3378('0x6'));var attributes=require(_0x3378('0x7'));module[_0x3378('0x8')]=function(_0x7b45ec,_0x6dde75){return _0x7b45ec[_0x3378('0x9')]('Template',attributes,{'tableName':'tools_templates','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5e79=['rimraf','../../config/environment','./template.attributes','exports','define','Template','tools_templates','lodash','util','../../config/logger','api','moment'];(function(_0x2047b7,_0x4690fc){var _0x55bee6=function(_0x410d90){while(--_0x410d90){_0x2047b7['push'](_0x2047b7['shift']());}};_0x55bee6(++_0x4690fc);}(_0x5e79,0x1c3));var _0x95e7=function(_0x12e037,_0x5c8a8a){_0x12e037=_0x12e037-0x0;var _0x564f67=_0x5e79[_0x12e037];return _0x564f67;};'use strict';var _=require(_0x95e7('0x0'));var util=require(_0x95e7('0x1'));var logger=require(_0x95e7('0x2'))(_0x95e7('0x3'));var moment=require(_0x95e7('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x95e7('0x5'));var config=require(_0x95e7('0x6'));var attributes=require(_0x95e7('0x7'));module[_0x95e7('0x8')]=function(_0x164112,_0x374c9d){return _0x164112[_0x95e7('0x9')](_0x95e7('0xa'),attributes,{'tableName':_0x95e7('0xb'),'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 0cb08a1..3de3bac 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 _0xf014=['request','info','Template,\x20%s,\x20%s','debug','Template,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','findAll','raw','options','where','attributes','limit','map','include','model','then','GetTemplate','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x12c25f,_0xb29d51){var _0x979744=function(_0x39d977){while(--_0x39d977){_0x12c25f['push'](_0x12c25f['shift']());}};_0x979744(++_0xb29d51);}(_0xf014,0x126));var _0x4f01=function(_0x5c22b0,_0x330534){_0x5c22b0=_0x5c22b0-0x0;var _0x1d5a5b=_0xf014[_0x5c22b0];return _0x1d5a5b;};'use strict';var _=require(_0x4f01('0x0'));var util=require(_0x4f01('0x1'));var moment=require(_0x4f01('0x2'));var BPromise=require(_0x4f01('0x3'));var rs=require(_0x4f01('0x4'));var fs=require('fs');var Redis=require(_0x4f01('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x4f01('0x6'));var logger=require(_0x4f01('0x7'))(_0x4f01('0x8'));var config=require(_0x4f01('0x9'));var jayson=require(_0x4f01('0xa'));var client=jayson[_0x4f01('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x31833e,_0x1f45cb,_0x516ca2){return new BPromise(function(_0x314c04,_0xd85b44){return client[_0x4f01('0xc')](_0x31833e,_0x516ca2)['then'](function(_0x582fb0){logger[_0x4f01('0xd')](_0x4f01('0xe'),_0x1f45cb,'request\x20sent');logger[_0x4f01('0xf')](_0x4f01('0x10'),_0x1f45cb,_0x4f01('0x11'),JSON[_0x4f01('0x12')](_0x582fb0));if(_0x582fb0[_0x4f01('0x13')]){if(_0x582fb0[_0x4f01('0x13')][_0x4f01('0x14')]===0x1f4){logger[_0x4f01('0x13')](_0x4f01('0xe'),_0x1f45cb,_0x582fb0['error']['message']);return _0xd85b44(_0x582fb0[_0x4f01('0x13')][_0x4f01('0x15')]);}logger[_0x4f01('0x13')](_0x4f01('0xe'),_0x1f45cb,_0x582fb0[_0x4f01('0x13')]['message']);return _0x314c04(_0x582fb0['error'][_0x4f01('0x15')]);}else{logger['info'](_0x4f01('0xe'),_0x1f45cb,_0x4f01('0x11'));_0x314c04(_0x582fb0['result'][_0x4f01('0x15')]);}})[_0x4f01('0x16')](function(_0x422f4e){logger[_0x4f01('0x13')](_0x4f01('0xe'),_0x1f45cb,_0x422f4e);_0xd85b44(_0x422f4e);});});}exports['GetTemplate']=function(_0x2b5a9a){var _0x425548=this;return new Promise(function(_0x411c0d,_0x49d7a2){return db['Template'][_0x4f01('0x17')]({'raw':_0x2b5a9a['options']?_0x2b5a9a['options'][_0x4f01('0x18')]===undefined?!![]:![]:!![],'where':_0x2b5a9a[_0x4f01('0x19')]?_0x2b5a9a[_0x4f01('0x19')][_0x4f01('0x1a')]||null:null,'attributes':_0x2b5a9a[_0x4f01('0x19')]?_0x2b5a9a['options'][_0x4f01('0x1b')]||null:null,'limit':_0x2b5a9a[_0x4f01('0x19')]?_0x2b5a9a[_0x4f01('0x19')][_0x4f01('0x1c')]||null:null,'include':_0x2b5a9a[_0x4f01('0x19')]?_0x2b5a9a[_0x4f01('0x19')]['include']?_[_0x4f01('0x1d')](_0x2b5a9a['options'][_0x4f01('0x1e')],function(_0x3513a3){return{'model':db[_0x3513a3[_0x4f01('0x1f')]],'as':_0x3513a3['as'],'attributes':_0x3513a3[_0x4f01('0x1b')],'include':_0x3513a3['include']?_['map'](_0x3513a3[_0x4f01('0x1e')],function(_0x3fbfd4){return{'model':db[_0x3fbfd4[_0x4f01('0x1f')]],'as':_0x3fbfd4['as'],'attributes':_0x3fbfd4[_0x4f01('0x1b')],'include':_0x3fbfd4['include']?_[_0x4f01('0x1d')](_0x3fbfd4[_0x4f01('0x1e')],function(_0x5ee928){return{'model':db[_0x5ee928[_0x4f01('0x1f')]],'as':_0x5ee928['as'],'attributes':_0x5ee928['attributes']};}):[]};}):[]};}):[]:[]})[_0x4f01('0x20')](function(_0x297a1c){logger[_0x4f01('0xd')](_0x4f01('0x21'),_0x2b5a9a);logger[_0x4f01('0xf')](_0x4f01('0x21'),_0x2b5a9a,JSON[_0x4f01('0x12')](_0x297a1c));_0x411c0d(_0x297a1c);})['catch'](function(_0x257c8d){logger[_0x4f01('0x13')]('GetTemplate',_0x257c8d['message'],_0x2b5a9a);_0x49d7a2(_0x425548['error'](0x1f4,_0x257c8d[_0x4f01('0x15')]));});});}; \ No newline at end of file +var _0x2932=['client','http','request','then','info','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetTemplate','findAll','options','raw','where','attributes','limit','map','include','model','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x4c19cc,_0x24e1c4){var _0x2d9319=function(_0x3e6ec8){while(--_0x3e6ec8){_0x4c19cc['push'](_0x4c19cc['shift']());}};_0x2d9319(++_0x24e1c4);}(_0x2932,0x9c));var _0x2293=function(_0x1b95a1,_0x529852){_0x1b95a1=_0x1b95a1-0x0;var _0x57aef1=_0x2932[_0x1b95a1];return _0x57aef1;};'use strict';var _=require('lodash');var util=require(_0x2293('0x0'));var moment=require('moment');var BPromise=require(_0x2293('0x1'));var rs=require(_0x2293('0x2'));var fs=require('fs');var Redis=require(_0x2293('0x3'));var db=require(_0x2293('0x4'))['db'];var utils=require(_0x2293('0x5'));var logger=require(_0x2293('0x6'))(_0x2293('0x7'));var config=require('../../config/environment');var jayson=require(_0x2293('0x8'));var client=jayson[_0x2293('0x9')][_0x2293('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x36c4c0,_0x5b5daf,_0x248fcc){return new BPromise(function(_0xc2452a,_0x44907e){return client[_0x2293('0xb')](_0x36c4c0,_0x248fcc)[_0x2293('0xc')](function(_0x10a25a){logger[_0x2293('0xd')](_0x2293('0xe'),_0x5b5daf,_0x2293('0xf'));logger[_0x2293('0x10')](_0x2293('0x11'),_0x5b5daf,'request\x20sent',JSON[_0x2293('0x12')](_0x10a25a));if(_0x10a25a[_0x2293('0x13')]){if(_0x10a25a[_0x2293('0x13')][_0x2293('0x14')]===0x1f4){logger['error'](_0x2293('0xe'),_0x5b5daf,_0x10a25a[_0x2293('0x13')][_0x2293('0x15')]);return _0x44907e(_0x10a25a[_0x2293('0x13')][_0x2293('0x15')]);}logger[_0x2293('0x13')](_0x2293('0xe'),_0x5b5daf,_0x10a25a[_0x2293('0x13')][_0x2293('0x15')]);return _0xc2452a(_0x10a25a[_0x2293('0x13')][_0x2293('0x15')]);}else{logger[_0x2293('0xd')](_0x2293('0xe'),_0x5b5daf,_0x2293('0xf'));_0xc2452a(_0x10a25a['result']['message']);}})[_0x2293('0x16')](function(_0x196490){logger[_0x2293('0x13')]('Template,\x20%s,\x20%s',_0x5b5daf,_0x196490);_0x44907e(_0x196490);});});}exports[_0x2293('0x17')]=function(_0x5686cc){var _0xc16ce6=this;return new Promise(function(_0x2fafdd,_0x130d9d){return db['Template'][_0x2293('0x18')]({'raw':_0x5686cc[_0x2293('0x19')]?_0x5686cc[_0x2293('0x19')][_0x2293('0x1a')]===undefined?!![]:![]:!![],'where':_0x5686cc[_0x2293('0x19')]?_0x5686cc['options'][_0x2293('0x1b')]||null:null,'attributes':_0x5686cc['options']?_0x5686cc[_0x2293('0x19')][_0x2293('0x1c')]||null:null,'limit':_0x5686cc[_0x2293('0x19')]?_0x5686cc[_0x2293('0x19')][_0x2293('0x1d')]||null:null,'include':_0x5686cc[_0x2293('0x19')]?_0x5686cc[_0x2293('0x19')]['include']?_[_0x2293('0x1e')](_0x5686cc[_0x2293('0x19')][_0x2293('0x1f')],function(_0x4da585){return{'model':db[_0x4da585['model']],'as':_0x4da585['as'],'attributes':_0x4da585['attributes'],'include':_0x4da585[_0x2293('0x1f')]?_[_0x2293('0x1e')](_0x4da585[_0x2293('0x1f')],function(_0x356939){return{'model':db[_0x356939[_0x2293('0x20')]],'as':_0x356939['as'],'attributes':_0x356939[_0x2293('0x1c')],'include':_0x356939[_0x2293('0x1f')]?_[_0x2293('0x1e')](_0x356939[_0x2293('0x1f')],function(_0x154b7c){return{'model':db[_0x154b7c['model']],'as':_0x154b7c['as'],'attributes':_0x154b7c[_0x2293('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x303a72){logger[_0x2293('0xd')](_0x2293('0x17'),_0x5686cc);logger['debug'](_0x2293('0x17'),_0x5686cc,JSON[_0x2293('0x12')](_0x303a72));_0x2fafdd(_0x303a72);})['catch'](function(_0x3f5341){logger[_0x2293('0x13')](_0x2293('0x17'),_0x3f5341[_0x2293('0x15')],_0x5686cc);_0x130d9d(_0xc16ce6[_0x2293('0x13')](0x1f4,_0x3f5341[_0x2293('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 1cc6be3..59a41b5 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 _0x096b=['put','/:id','delete','destroy','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./trigger.controller','get','isAuthenticated','index','show','getAllConditions','/:id/any_conditions','getAnyConditions','getActions','post','create','/:id/all_conditions','/:id/actions','addAction'];(function(_0x26da89,_0x264785){var _0xc95b7b=function(_0x230e5b){while(--_0x230e5b){_0x26da89['push'](_0x26da89['shift']());}};_0xc95b7b(++_0x264785);}(_0x096b,0x1df));var _0xb096=function(_0x387146,_0x22a356){_0x387146=_0x387146-0x0;var _0x268cd5=_0x096b[_0x387146];return _0x268cd5;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb096('0x0'));var timeout=require(_0xb096('0x1'));var express=require(_0xb096('0x2'));var router=express[_0xb096('0x3')]();var fs_extra=require(_0xb096('0x4'));var auth=require(_0xb096('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xb096('0x6'));var controller=require(_0xb096('0x7'));router[_0xb096('0x8')]('/',auth[_0xb096('0x9')](),controller[_0xb096('0xa')]);router[_0xb096('0x8')]('/:id',auth[_0xb096('0x9')](),controller[_0xb096('0xb')]);router[_0xb096('0x8')]('/:id/all_conditions',auth[_0xb096('0x9')](),controller[_0xb096('0xc')]);router[_0xb096('0x8')](_0xb096('0xd'),auth[_0xb096('0x9')](),controller[_0xb096('0xe')]);router[_0xb096('0x8')]('/:id/actions',auth['isAuthenticated'](),controller[_0xb096('0xf')]);router[_0xb096('0x10')]('/',auth[_0xb096('0x9')](),controller[_0xb096('0x11')]);router[_0xb096('0x10')](_0xb096('0x12'),auth['isAuthenticated'](),controller['addAllCondition']);router[_0xb096('0x10')](_0xb096('0xd'),auth[_0xb096('0x9')](),controller['addAnyCondition']);router[_0xb096('0x10')](_0xb096('0x13'),auth[_0xb096('0x9')](),controller[_0xb096('0x14')]);router[_0xb096('0x15')](_0xb096('0x16'),auth['isAuthenticated'](),controller['update']);router[_0xb096('0x17')](_0xb096('0x16'),auth['isAuthenticated'](),controller[_0xb096('0x18')]);module['exports']=router; \ No newline at end of file +var _0xe672=['addAnyCondition','addAction','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../config/environment','./trigger.controller','get','isAuthenticated','/:id','show','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','getActions','post','/:id/all_conditions','addAllCondition'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe672,0x1e4));var _0x2e67=function(_0x35966c,_0x275c99){_0x35966c=_0x35966c-0x0;var _0x4056db=_0xe672[_0x35966c];return _0x4056db;};'use strict';var multer=require(_0x2e67('0x0'));var util=require('util');var path=require(_0x2e67('0x1'));var timeout=require(_0x2e67('0x2'));var express=require(_0x2e67('0x3'));var router=express[_0x2e67('0x4')]();var fs_extra=require(_0x2e67('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2e67('0x6'));var controller=require(_0x2e67('0x7'));router[_0x2e67('0x8')]('/',auth[_0x2e67('0x9')](),controller['index']);router['get'](_0x2e67('0xa'),auth[_0x2e67('0x9')](),controller[_0x2e67('0xb')]);router[_0x2e67('0x8')]('/:id/all_conditions',auth[_0x2e67('0x9')](),controller[_0x2e67('0xc')]);router[_0x2e67('0x8')](_0x2e67('0xd'),auth[_0x2e67('0x9')](),controller[_0x2e67('0xe')]);router[_0x2e67('0x8')](_0x2e67('0xf'),auth[_0x2e67('0x9')](),controller[_0x2e67('0x10')]);router[_0x2e67('0x11')]('/',auth[_0x2e67('0x9')](),controller['create']);router['post'](_0x2e67('0x12'),auth[_0x2e67('0x9')](),controller[_0x2e67('0x13')]);router[_0x2e67('0x11')](_0x2e67('0xd'),auth[_0x2e67('0x9')](),controller[_0x2e67('0x14')]);router[_0x2e67('0x11')]('/:id/actions',auth['isAuthenticated'](),controller[_0x2e67('0x15')]);router['put'](_0x2e67('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x2e67('0x16')](_0x2e67('0xa'),auth[_0x2e67('0x9')](),controller[_0x2e67('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 0819cf9..d8393e0 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 _0xb813=['sequelize','exports','STRING','BOOLEAN'];(function(_0x911c2c,_0x1bf5a0){var _0x16a5e5=function(_0x2bfdb9){while(--_0x2bfdb9){_0x911c2c['push'](_0x911c2c['shift']());}};_0x16a5e5(++_0x1bf5a0);}(_0xb813,0x15c));var _0x3b81=function(_0x55a747,_0x50c122){_0x55a747=_0x55a747-0x0;var _0x2136b3=_0xb813[_0x55a747];return _0x2136b3;};'use strict';var Sequelize=require(_0x3b81('0x0'));module[_0x3b81('0x1')]={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x3b81('0x2')]},'status':{'type':Sequelize[_0x3b81('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x337c=['BOOLEAN','sequelize','exports','STRING'];(function(_0x333c2b,_0x4bf3ce){var _0x52e2c0=function(_0x119867){while(--_0x119867){_0x333c2b['push'](_0x333c2b['shift']());}};_0x52e2c0(++_0x4bf3ce);}(_0x337c,0x10d));var _0xc337=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x337c[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xc337('0x0'));module[_0xc337('0x1')]={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xc337('0x2')]},'description':{'type':Sequelize[_0xc337('0x2')]},'status':{'type':Sequelize[_0xc337('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 d711125..a38e9db 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 _0x251b=['addAnyCondition','TriggerAnyId','findOne','order','filters','getAllConditions','getAnyConditions','Action','getActions','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','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','json','offset','undefined','limit','count','reject','save','update','then','destroy','get','Triggers','UserProfileResource','status','end','error','name','index','map','Trigger','rawAttributes','fieldName','type','key','query','keys','model','attributes','intersection','length','hasOwnProperty','nolimit','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','findAll','rows','show','params','fields','include','find','catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addAllCondition','TriggerAllId','Condition'];(function(_0x19e720,_0x179b77){var _0x254192=function(_0x381b12){while(--_0x381b12){_0x19e720['push'](_0x19e720['shift']());}};_0x254192(++_0x179b77);}(_0x251b,0x11a));var _0xb251=function(_0x218994,_0x2cf487){_0x218994=_0x218994-0x0;var _0x3f350b=_0x251b[_0x218994];return _0x3f350b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb251('0x0'));var jsonpatch=require(_0xb251('0x1'));var rp=require(_0xb251('0x2'));var moment=require('moment');var BPromise=require(_0xb251('0x3'));var Mustache=require(_0xb251('0x4'));var util=require(_0xb251('0x5'));var path=require('path');var sox=require(_0xb251('0x6'));var csv=require(_0xb251('0x7'));var ejs=require(_0xb251('0x8'));var fs=require('fs');var fs_extra=require(_0xb251('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xb251('0xa'));var jsforce=require(_0xb251('0xb'));var deskjs=require(_0xb251('0xc'));var toCsv=require(_0xb251('0x7'));var querystring=require(_0xb251('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb251('0xe'));var qs=require(_0xb251('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb251('0x10'));var logger=require(_0xb251('0x11'))(_0xb251('0x12'));var utils=require(_0xb251('0x13'));var config=require(_0xb251('0x14'));var licenseUtil=require(_0xb251('0x15'));var db=require(_0xb251('0x16'))['db'];function respondWithStatusCode(_0x11d5b8,_0x41fe83){_0x41fe83=_0x41fe83||0xcc;return function(_0x592b3){if(_0x592b3){return _0x11d5b8[_0xb251('0x17')](_0x41fe83);}return _0x11d5b8['status'](_0x41fe83)['end']();};}function respondWithResult(_0x505e70,_0x277dff){_0x277dff=_0x277dff||0xc8;return function(_0x4c164b){if(_0x4c164b){return _0x505e70['status'](_0x277dff)[_0xb251('0x18')](_0x4c164b);}};}function respondWithFilteredResult(_0x422085,_0x4d7f73){return function(_0x5d1c09){if(_0x5d1c09){var _0x6ad584=typeof _0x4d7f73[_0xb251('0x19')]===_0xb251('0x1a')&&typeof _0x4d7f73[_0xb251('0x1b')]===_0xb251('0x1a');var _0x5a0d08=_0x5d1c09['count'];var _0x241f05=_0x6ad584?0x0:_0x4d7f73['offset'];var _0x5aa0ad=_0x6ad584?_0x5d1c09[_0xb251('0x1c')]:_0x4d7f73[_0xb251('0x19')]+_0x4d7f73[_0xb251('0x1b')];var _0x20dead;if(_0x5aa0ad>=_0x5a0d08){_0x5aa0ad=_0x5a0d08;_0x20dead=0xc8;}else{_0x20dead=0xce;}_0x422085['status'](_0x20dead);return _0x422085['set']('Content-Range',_0x241f05+'-'+_0x5aa0ad+'/'+_0x5a0d08)[_0xb251('0x18')](_0x5d1c09);}return null;};}function patchUpdates(_0x49a1d7){return function(_0x439d6b){try{jsonpatch['apply'](_0x439d6b,_0x49a1d7,!![]);}catch(_0x36052d){return BPromise[_0xb251('0x1d')](_0x36052d);}return _0x439d6b[_0xb251('0x1e')]();};}function saveUpdates(_0x9bc534,_0x1c1dd2){return function(_0x3c60f0){if(_0x3c60f0){return _0x3c60f0[_0xb251('0x1f')](_0x9bc534)[_0xb251('0x20')](function(_0x183688){return _0x183688;});}return null;};}function removeEntity(_0x486009,_0x47f65e){return function(_0x2b8ddf){if(_0x2b8ddf){return _0x2b8ddf[_0xb251('0x21')]()[_0xb251('0x20')](function(){var _0x27d796=_0x2b8ddf[_0xb251('0x22')]({'plain':!![]});var _0x71a92e=_0xb251('0x23');return db[_0xb251('0x24')][_0xb251('0x21')]({'where':{'type':_0x71a92e,'resourceId':_0x27d796['id']}})[_0xb251('0x20')](function(){return _0x2b8ddf;});})[_0xb251('0x20')](function(){_0x486009[_0xb251('0x25')](0xcc)[_0xb251('0x26')]();});}};}function handleEntityNotFound(_0x5d665d,_0xbfc79d){return function(_0x1909c3){if(!_0x1909c3){_0x5d665d[_0xb251('0x17')](0x194);}return _0x1909c3;};}function handleError(_0x5b122b,_0x569644){_0x569644=_0x569644||0x1f4;return function(_0x67c197){logger[_0xb251('0x27')](_0x67c197['stack']);if(_0x67c197[_0xb251('0x28')]){delete _0x67c197['name'];}_0x5b122b[_0xb251('0x25')](_0x569644)['send'](_0x67c197);};}exports[_0xb251('0x29')]=function(_0xa58e04,_0x93a164){var _0x462e90={},_0x27e14d={},_0x2fd629={'count':0x0,'rows':[]};var _0x5739f8=_[_0xb251('0x2a')](db[_0xb251('0x2b')][_0xb251('0x2c')],function(_0x208afd){return{'name':_0x208afd[_0xb251('0x2d')],'type':_0x208afd[_0xb251('0x2e')][_0xb251('0x2f')]};});_0x27e14d['model']=_[_0xb251('0x2a')](_0x5739f8,_0xb251('0x28'));_0x27e14d[_0xb251('0x30')]=_[_0xb251('0x31')](_0xa58e04[_0xb251('0x30')]);_0x27e14d['filters']=_['intersection'](_0x27e14d[_0xb251('0x32')],_0x27e14d['query']);_0x462e90[_0xb251('0x33')]=_[_0xb251('0x34')](_0x27e14d['model'],qs['fields'](_0xa58e04[_0xb251('0x30')]['fields']));_0x462e90[_0xb251('0x33')]=_0x462e90['attributes'][_0xb251('0x35')]?_0x462e90[_0xb251('0x33')]:_0x27e14d[_0xb251('0x32')];if(!_0xa58e04[_0xb251('0x30')][_0xb251('0x36')](_0xb251('0x37'))){_0x462e90[_0xb251('0x1b')]=qs[_0xb251('0x1b')](_0xa58e04[_0xb251('0x30')][_0xb251('0x1b')]);_0x462e90[_0xb251('0x19')]=qs[_0xb251('0x19')](_0xa58e04['query'][_0xb251('0x19')]);}_0x462e90['order']=qs[_0xb251('0x38')](_0xa58e04[_0xb251('0x30')][_0xb251('0x38')]);_0x462e90['where']=qs['filters'](_[_0xb251('0x39')](_0xa58e04[_0xb251('0x30')],_0x27e14d['filters']),_0x5739f8);if(_0xa58e04['query'][_0xb251('0x3a')]){_0x462e90['where']=_[_0xb251('0x3b')](_0x462e90[_0xb251('0x3c')],{'$or':_[_0xb251('0x2a')](_0x5739f8,function(_0x2c905c){if(_0x2c905c[_0xb251('0x2e')]!==_0xb251('0x3d')){var _0xbf008={};_0xbf008[_0x2c905c[_0xb251('0x28')]]={'$like':'%'+_0xa58e04[_0xb251('0x30')][_0xb251('0x3a')]+'%'};return _0xbf008;}})});}_0x462e90=_['merge']({},_0x462e90,_0xa58e04[_0xb251('0x3e')]);var _0x4a5d27={'where':_0x462e90['where']};return db[_0xb251('0x2b')]['count'](_0x4a5d27)[_0xb251('0x20')](function(_0x344b91){_0x2fd629[_0xb251('0x1c')]=_0x344b91;if(_0xa58e04[_0xb251('0x30')][_0xb251('0x3f')]){_0x462e90['include']=[{'all':!![]}];}return db[_0xb251('0x2b')][_0xb251('0x40')](_0x462e90);})[_0xb251('0x20')](function(_0x6807fb){_0x2fd629[_0xb251('0x41')]=_0x6807fb;return _0x2fd629;})[_0xb251('0x20')](respondWithFilteredResult(_0x93a164,_0x462e90))['catch'](handleError(_0x93a164,null));};exports[_0xb251('0x42')]=function(_0x5d14da,_0x391e8e){var _0x5a7c91={'raw':![],'where':{'id':_0x5d14da[_0xb251('0x43')]['id']}},_0x2c8750={};_0x2c8750[_0xb251('0x32')]=_[_0xb251('0x31')](db[_0xb251('0x2b')]['rawAttributes']);_0x2c8750['query']=_[_0xb251('0x31')](_0x5d14da[_0xb251('0x30')]);_0x2c8750['filters']=_[_0xb251('0x34')](_0x2c8750[_0xb251('0x32')],_0x2c8750[_0xb251('0x30')]);_0x5a7c91[_0xb251('0x33')]=_[_0xb251('0x34')](_0x2c8750['model'],qs[_0xb251('0x44')](_0x5d14da[_0xb251('0x30')]['fields']));_0x5a7c91[_0xb251('0x33')]=_0x5a7c91[_0xb251('0x33')]['length']?_0x5a7c91['attributes']:_0x2c8750[_0xb251('0x32')];if(_0x5d14da['query']['includeAll']){_0x5a7c91[_0xb251('0x45')]=[{'all':!![]}];}_0x5a7c91=_[_0xb251('0x3b')]({},_0x5a7c91,_0x5d14da[_0xb251('0x3e')]);return db[_0xb251('0x2b')][_0xb251('0x46')](_0x5a7c91)[_0xb251('0x20')](handleEntityNotFound(_0x391e8e,null))[_0xb251('0x20')](respondWithResult(_0x391e8e,null))[_0xb251('0x47')](handleError(_0x391e8e,null));};exports[_0xb251('0x48')]=function(_0x4d3cc3,_0x279fe8){return db[_0xb251('0x2b')][_0xb251('0x48')](_0x4d3cc3['body'],{})[_0xb251('0x20')](function(_0x38d8cd){var _0x5c62cf=_0x4d3cc3['user'][_0xb251('0x22')]({'plain':!![]});if(!_0x5c62cf)throw new Error(_0xb251('0x49'));if(_0x5c62cf[_0xb251('0x4a')]===_0xb251('0x4b')){var _0x51a399=_0x38d8cd[_0xb251('0x22')]({'plain':!![]});var _0x3e85b8=_0xb251('0x23');return db[_0xb251('0x4c')][_0xb251('0x46')]({'where':{'name':_0x3e85b8,'userProfileId':_0x5c62cf['userProfileId']},'raw':!![]})[_0xb251('0x20')](function(_0x40f3f4){if(_0x40f3f4&&_0x40f3f4['autoAssociation']===0x0){return db[_0xb251('0x24')][_0xb251('0x48')]({'name':_0x51a399['name'],'resourceId':_0x51a399['id'],'type':_0x40f3f4['name'],'sectionId':_0x40f3f4['id']},{})[_0xb251('0x20')](function(){return _0x38d8cd;});}else{return _0x38d8cd;}})[_0xb251('0x47')](function(_0x8d08fb){logger[_0xb251('0x27')](_0xb251('0x4d'),_0x8d08fb);throw _0x8d08fb;});}return _0x38d8cd;})[_0xb251('0x20')](respondWithResult(_0x279fe8,0xc9))['catch'](handleError(_0x279fe8,null));};exports[_0xb251('0x1f')]=function(_0x33b2f7,_0x223240){if(_0x33b2f7[_0xb251('0x4e')]['id']){delete _0x33b2f7[_0xb251('0x4e')]['id'];}return db['Trigger'][_0xb251('0x46')]({'where':{'id':_0x33b2f7[_0xb251('0x43')]['id']}})[_0xb251('0x20')](handleEntityNotFound(_0x223240,null))[_0xb251('0x20')](saveUpdates(_0x33b2f7[_0xb251('0x4e')],null))[_0xb251('0x20')](respondWithResult(_0x223240,null))['catch'](handleError(_0x223240,null));};exports[_0xb251('0x21')]=function(_0x1b7274,_0x2177b7){return db[_0xb251('0x2b')]['find']({'where':{'id':_0x1b7274[_0xb251('0x43')]['id']}})[_0xb251('0x20')](handleEntityNotFound(_0x2177b7,null))[_0xb251('0x20')](removeEntity(_0x2177b7,null))[_0xb251('0x47')](handleError(_0x2177b7,null));};exports[_0xb251('0x4f')]=function(_0x16826f,_0x458b7c,_0x2e2709){if(_0x16826f[_0xb251('0x4e')]['id']){delete _0x16826f[_0xb251('0x4e')]['id'];}return db[_0xb251('0x2b')][_0xb251('0x46')]({'where':{'id':_0x16826f[_0xb251('0x43')]['id']}})[_0xb251('0x20')](handleEntityNotFound(_0x458b7c,null))[_0xb251('0x20')](function(_0x25d977){if(_0x25d977){_0x16826f[_0xb251('0x4e')][_0xb251('0x50')]=_0x25d977['id'];return db[_0xb251('0x51')][_0xb251('0x48')](_0x16826f[_0xb251('0x4e')]);}})['then'](respondWithResult(_0x458b7c,null))[_0xb251('0x47')](handleError(_0x458b7c,null));};exports[_0xb251('0x52')]=function(_0x35ef53,_0x4bd156,_0x317c63){if(_0x35ef53[_0xb251('0x4e')]['id']){delete _0x35ef53['body']['id'];}return db[_0xb251('0x2b')][_0xb251('0x46')]({'where':{'id':_0x35ef53[_0xb251('0x43')]['id']}})[_0xb251('0x20')](handleEntityNotFound(_0x4bd156,null))['then'](function(_0x47c87a){if(_0x47c87a){_0x35ef53['body'][_0xb251('0x53')]=_0x47c87a['id'];return db[_0xb251('0x51')][_0xb251('0x48')](_0x35ef53['body']);}})['then'](respondWithResult(_0x4bd156,null))[_0xb251('0x47')](handleError(_0x4bd156,null));};exports['getAllConditions']=function(_0x30acad,_0x9896a0,_0x4fa02e){var _0x490ad2={};var _0x20b567={};var _0x12a449;var _0x2c706e;return db[_0xb251('0x2b')][_0xb251('0x54')]({'where':{'id':_0x30acad['params']['id']}})[_0xb251('0x20')](handleEntityNotFound(_0x9896a0,null))[_0xb251('0x20')](function(_0x184331){if(_0x184331){_0x12a449=_0x184331;_0x20b567[_0xb251('0x32')]=_['keys'](db['Condition'][_0xb251('0x2c')]);_0x20b567[_0xb251('0x30')]=_[_0xb251('0x31')](_0x30acad[_0xb251('0x30')]);_0x20b567['filters']=_[_0xb251('0x34')](_0x20b567['model'],_0x20b567[_0xb251('0x30')]);_0x490ad2[_0xb251('0x33')]=_['intersection'](_0x20b567[_0xb251('0x32')],qs[_0xb251('0x44')](_0x30acad[_0xb251('0x30')]['fields']));_0x490ad2[_0xb251('0x33')]=_0x490ad2[_0xb251('0x33')][_0xb251('0x35')]?_0x490ad2[_0xb251('0x33')]:_0x20b567['model'];_0x490ad2[_0xb251('0x55')]=qs[_0xb251('0x38')](_0x30acad[_0xb251('0x30')][_0xb251('0x38')]);_0x490ad2[_0xb251('0x3c')]=qs[_0xb251('0x56')](_[_0xb251('0x39')](_0x30acad[_0xb251('0x30')],_0x20b567['filters']));if(_0x30acad['query'][_0xb251('0x3a')]){_0x490ad2[_0xb251('0x3c')]=_[_0xb251('0x3b')](_0x490ad2[_0xb251('0x3c')],{'$or':_[_0xb251('0x2a')](_0x490ad2[_0xb251('0x33')],function(_0x1eaaa3){var _0x3471a1={};_0x3471a1[_0x1eaaa3]={'$like':'%'+_0x30acad[_0xb251('0x30')][_0xb251('0x3a')]+'%'};return _0x3471a1;})});}_0x490ad2=_[_0xb251('0x3b')]({},_0x490ad2,_0x30acad['options']);return _0x12a449[_0xb251('0x57')](_0x490ad2);}})[_0xb251('0x20')](function(_0x1a6932){if(_0x1a6932){_0x2c706e=_0x1a6932[_0xb251('0x35')];if(!_0x30acad[_0xb251('0x30')][_0xb251('0x36')](_0xb251('0x37'))){_0x490ad2[_0xb251('0x1b')]=qs[_0xb251('0x1b')](_0x30acad['query'][_0xb251('0x1b')]);_0x490ad2[_0xb251('0x19')]=qs[_0xb251('0x19')](_0x30acad[_0xb251('0x30')][_0xb251('0x19')]);}return _0x12a449['getAllConditions'](_0x490ad2);}})[_0xb251('0x20')](function(_0x2436c8){if(_0x2436c8){return _0x2436c8?{'count':_0x2c706e,'rows':_0x2436c8}:null;}})['then'](respondWithResult(_0x9896a0,null))[_0xb251('0x47')](handleError(_0x9896a0,null));};exports[_0xb251('0x58')]=function(_0x50a194,_0x569795,_0x4be9a5){var _0x202e18={};var _0x59d249={};var _0x29f320;var _0x102fca;return db[_0xb251('0x2b')][_0xb251('0x54')]({'where':{'id':_0x50a194[_0xb251('0x43')]['id']}})[_0xb251('0x20')](handleEntityNotFound(_0x569795,null))['then'](function(_0xc14aa3){if(_0xc14aa3){_0x29f320=_0xc14aa3;_0x59d249[_0xb251('0x32')]=_[_0xb251('0x31')](db[_0xb251('0x51')]['rawAttributes']);_0x59d249[_0xb251('0x30')]=_[_0xb251('0x31')](_0x50a194[_0xb251('0x30')]);_0x59d249['filters']=_[_0xb251('0x34')](_0x59d249[_0xb251('0x32')],_0x59d249['query']);_0x202e18[_0xb251('0x33')]=_[_0xb251('0x34')](_0x59d249['model'],qs[_0xb251('0x44')](_0x50a194[_0xb251('0x30')][_0xb251('0x44')]));_0x202e18[_0xb251('0x33')]=_0x202e18[_0xb251('0x33')][_0xb251('0x35')]?_0x202e18[_0xb251('0x33')]:_0x59d249['model'];_0x202e18[_0xb251('0x55')]=qs[_0xb251('0x38')](_0x50a194['query']['sort']);_0x202e18['where']=qs[_0xb251('0x56')](_[_0xb251('0x39')](_0x50a194[_0xb251('0x30')],_0x59d249[_0xb251('0x56')]));if(_0x50a194[_0xb251('0x30')]['filter']){_0x202e18['where']=_[_0xb251('0x3b')](_0x202e18[_0xb251('0x3c')],{'$or':_[_0xb251('0x2a')](_0x202e18['attributes'],function(_0x15116a){var _0x3128d2={};_0x3128d2[_0x15116a]={'$like':'%'+_0x50a194[_0xb251('0x30')][_0xb251('0x3a')]+'%'};return _0x3128d2;})});}_0x202e18=_['merge']({},_0x202e18,_0x50a194[_0xb251('0x3e')]);return _0x29f320[_0xb251('0x58')](_0x202e18);}})[_0xb251('0x20')](function(_0x32471b){if(_0x32471b){_0x102fca=_0x32471b['length'];if(!_0x50a194[_0xb251('0x30')][_0xb251('0x36')](_0xb251('0x37'))){_0x202e18['limit']=qs[_0xb251('0x1b')](_0x50a194[_0xb251('0x30')][_0xb251('0x1b')]);_0x202e18['offset']=qs['offset'](_0x50a194['query'][_0xb251('0x19')]);}return _0x29f320[_0xb251('0x58')](_0x202e18);}})['then'](function(_0x2ab9dd){if(_0x2ab9dd){return _0x2ab9dd?{'count':_0x102fca,'rows':_0x2ab9dd}:null;}})[_0xb251('0x20')](respondWithResult(_0x569795,null))[_0xb251('0x47')](handleError(_0x569795,null));};exports['addAction']=function(_0x17cef7,_0x24597d,_0x5837a7){if(_0x17cef7['body']['id']){delete _0x17cef7[_0xb251('0x4e')]['id'];}return db[_0xb251('0x2b')][_0xb251('0x46')]({'where':{'id':_0x17cef7[_0xb251('0x43')]['id']}})['then'](handleEntityNotFound(_0x24597d,null))[_0xb251('0x20')](function(_0x2b4ee1){if(_0x2b4ee1){_0x17cef7[_0xb251('0x4e')]['TriggerId']=_0x2b4ee1['id'];return db[_0xb251('0x59')][_0xb251('0x48')](_0x17cef7[_0xb251('0x4e')]);}})[_0xb251('0x20')](respondWithResult(_0x24597d,null))[_0xb251('0x47')](handleError(_0x24597d,null));};exports[_0xb251('0x5a')]=function(_0xf72d22,_0x22fea1,_0x4e6cc6){var _0x208038={};var _0x557668={};var _0x1b8076;var _0x3db90d;return db['Trigger'][_0xb251('0x54')]({'where':{'id':_0xf72d22['params']['id']}})[_0xb251('0x20')](handleEntityNotFound(_0x22fea1,null))[_0xb251('0x20')](function(_0x1d8176){if(_0x1d8176){_0x1b8076=_0x1d8176;_0x557668[_0xb251('0x32')]=_[_0xb251('0x31')](db['Action'][_0xb251('0x2c')]);_0x557668[_0xb251('0x30')]=_['keys'](_0xf72d22['query']);_0x557668[_0xb251('0x56')]=_[_0xb251('0x34')](_0x557668[_0xb251('0x32')],_0x557668[_0xb251('0x30')]);_0x208038[_0xb251('0x33')]=_['intersection'](_0x557668[_0xb251('0x32')],qs[_0xb251('0x44')](_0xf72d22[_0xb251('0x30')][_0xb251('0x44')]));_0x208038['attributes']=_0x208038[_0xb251('0x33')][_0xb251('0x35')]?_0x208038['attributes']:_0x557668[_0xb251('0x32')];_0x208038[_0xb251('0x55')]=qs[_0xb251('0x38')](_0xf72d22[_0xb251('0x30')][_0xb251('0x38')]);_0x208038['where']=qs[_0xb251('0x56')](_[_0xb251('0x39')](_0xf72d22[_0xb251('0x30')],_0x557668['filters']));if(_0xf72d22['query'][_0xb251('0x3a')]){_0x208038['where']=_['merge'](_0x208038[_0xb251('0x3c')],{'$or':_['map'](_0x208038[_0xb251('0x33')],function(_0x2d1feb){var _0x1605c5={};_0x1605c5[_0x2d1feb]={'$like':'%'+_0xf72d22[_0xb251('0x30')][_0xb251('0x3a')]+'%'};return _0x1605c5;})});}_0x208038=_[_0xb251('0x3b')]({},_0x208038,_0xf72d22['options']);return _0x1b8076[_0xb251('0x5a')](_0x208038);}})[_0xb251('0x20')](function(_0x412644){if(_0x412644){_0x3db90d=_0x412644[_0xb251('0x35')];if(!_0xf72d22[_0xb251('0x30')]['hasOwnProperty'](_0xb251('0x37'))){_0x208038['limit']=qs[_0xb251('0x1b')](_0xf72d22[_0xb251('0x30')][_0xb251('0x1b')]);_0x208038['offset']=qs[_0xb251('0x19')](_0xf72d22[_0xb251('0x30')][_0xb251('0x19')]);}return _0x1b8076[_0xb251('0x5a')](_0x208038);}})[_0xb251('0x20')](function(_0x469596){if(_0x469596){return _0x469596?{'count':_0x3db90d,'rows':_0x469596}:null;}})[_0xb251('0x20')](respondWithResult(_0x22fea1,null))['catch'](handleError(_0x22fea1,null));}; \ No newline at end of file +var _0x51fb=['set','Content-Range','apply','reject','save','update','destroy','then','get','Triggers','UserProfileResource','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','order','sort','where','filters','pick','filter','merge','VIRTUAL','Trigger','includeAll','include','findAll','rows','keys','options','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','create','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addAllCondition','TriggerAllId','Condition','TriggerAnyId','getAllConditions','hasOwnProperty','nolimit','getAnyConditions','findOne','addAction','TriggerId','Action','getActions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','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','offset','undefined','limit','count'];(function(_0x26ff7f,_0x25bd10){var _0x4ff798=function(_0x585888){while(--_0x585888){_0x26ff7f['push'](_0x26ff7f['shift']());}};_0x4ff798(++_0x25bd10);}(_0x51fb,0x16c));var _0xb51f=function(_0x285387,_0x4a226d){_0x285387=_0x285387-0x0;var _0x3a18b6=_0x51fb[_0x285387];return _0x3a18b6;};'use strict';var emlformat=require(_0xb51f('0x0'));var rimraf=require(_0xb51f('0x1'));var zipdir=require(_0xb51f('0x2'));var jsonpatch=require(_0xb51f('0x3'));var rp=require(_0xb51f('0x4'));var moment=require(_0xb51f('0x5'));var BPromise=require(_0xb51f('0x6'));var Mustache=require(_0xb51f('0x7'));var util=require('util');var path=require(_0xb51f('0x8'));var sox=require('sox');var csv=require(_0xb51f('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb51f('0xa'));var squel=require(_0xb51f('0xb'));var crypto=require(_0xb51f('0xc'));var jsforce=require(_0xb51f('0xd'));var deskjs=require(_0xb51f('0xe'));var toCsv=require('to-csv');var querystring=require(_0xb51f('0xf'));var Papa=require(_0xb51f('0x10'));var Redis=require(_0xb51f('0x11'));var authService=require(_0xb51f('0x12'));var qs=require(_0xb51f('0x13'));var as=require(_0xb51f('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb51f('0x15'))('api');var utils=require(_0xb51f('0x16'));var config=require(_0xb51f('0x17'));var licenseUtil=require(_0xb51f('0x18'));var db=require(_0xb51f('0x19'))['db'];function respondWithStatusCode(_0x4b4cb3,_0x466d6f){_0x466d6f=_0x466d6f||0xcc;return function(_0xf70520){if(_0xf70520){return _0x4b4cb3[_0xb51f('0x1a')](_0x466d6f);}return _0x4b4cb3[_0xb51f('0x1b')](_0x466d6f)['end']();};}function respondWithResult(_0x1d6a2a,_0x443cd4){_0x443cd4=_0x443cd4||0xc8;return function(_0x3da4e9){if(_0x3da4e9){return _0x1d6a2a['status'](_0x443cd4)['json'](_0x3da4e9);}};}function respondWithFilteredResult(_0x53c008,_0xeceee){return function(_0x26231b){if(_0x26231b){var _0x3f0bb3=typeof _0xeceee[_0xb51f('0x1c')]===_0xb51f('0x1d')&&typeof _0xeceee[_0xb51f('0x1e')]===_0xb51f('0x1d');var _0x2d8a04=_0x26231b['count'];var _0x4eeda4=_0x3f0bb3?0x0:_0xeceee[_0xb51f('0x1c')];var _0x9eed63=_0x3f0bb3?_0x26231b[_0xb51f('0x1f')]:_0xeceee[_0xb51f('0x1c')]+_0xeceee['limit'];var _0x2812b6;if(_0x9eed63>=_0x2d8a04){_0x9eed63=_0x2d8a04;_0x2812b6=0xc8;}else{_0x2812b6=0xce;}_0x53c008[_0xb51f('0x1b')](_0x2812b6);return _0x53c008[_0xb51f('0x20')](_0xb51f('0x21'),_0x4eeda4+'-'+_0x9eed63+'/'+_0x2d8a04)['json'](_0x26231b);}return null;};}function patchUpdates(_0x51761d){return function(_0x5b2ca5){try{jsonpatch[_0xb51f('0x22')](_0x5b2ca5,_0x51761d,!![]);}catch(_0x2f2af9){return BPromise[_0xb51f('0x23')](_0x2f2af9);}return _0x5b2ca5[_0xb51f('0x24')]();};}function saveUpdates(_0x27235c,_0x377c43){return function(_0xd5a200){if(_0xd5a200){return _0xd5a200[_0xb51f('0x25')](_0x27235c)['then'](function(_0x13b4db){return _0x13b4db;});}return null;};}function removeEntity(_0x30171f,_0x3aa01b){return function(_0x37fef2){if(_0x37fef2){return _0x37fef2[_0xb51f('0x26')]()[_0xb51f('0x27')](function(){var _0x14ad3d=_0x37fef2[_0xb51f('0x28')]({'plain':!![]});var _0x5addbe=_0xb51f('0x29');return db[_0xb51f('0x2a')][_0xb51f('0x26')]({'where':{'type':_0x5addbe,'resourceId':_0x14ad3d['id']}})[_0xb51f('0x27')](function(){return _0x37fef2;});})[_0xb51f('0x27')](function(){_0x30171f[_0xb51f('0x1b')](0xcc)[_0xb51f('0x2b')]();});}};}function handleEntityNotFound(_0x282e4d,_0x121259){return function(_0x5c4447){if(!_0x5c4447){_0x282e4d['sendStatus'](0x194);}return _0x5c4447;};}function handleError(_0x34a51a,_0x5ade55){_0x5ade55=_0x5ade55||0x1f4;return function(_0x550759){logger[_0xb51f('0x2c')](_0x550759[_0xb51f('0x2d')]);if(_0x550759[_0xb51f('0x2e')]){delete _0x550759['name'];}_0x34a51a[_0xb51f('0x1b')](_0x5ade55)[_0xb51f('0x2f')](_0x550759);};}exports[_0xb51f('0x30')]=function(_0x5dba75,_0x540018){var _0x3f6563={},_0x7fb822={},_0x250890={'count':0x0,'rows':[]};var _0x2bda4e=_[_0xb51f('0x31')](db['Trigger'][_0xb51f('0x32')],function(_0x3de8d5){return{'name':_0x3de8d5[_0xb51f('0x33')],'type':_0x3de8d5[_0xb51f('0x34')][_0xb51f('0x35')]};});_0x7fb822[_0xb51f('0x36')]=_[_0xb51f('0x31')](_0x2bda4e,_0xb51f('0x2e'));_0x7fb822['query']=_['keys'](_0x5dba75[_0xb51f('0x37')]);_0x7fb822['filters']=_[_0xb51f('0x38')](_0x7fb822[_0xb51f('0x36')],_0x7fb822[_0xb51f('0x37')]);_0x3f6563['attributes']=_[_0xb51f('0x38')](_0x7fb822[_0xb51f('0x36')],qs[_0xb51f('0x39')](_0x5dba75['query'][_0xb51f('0x39')]));_0x3f6563[_0xb51f('0x3a')]=_0x3f6563['attributes'][_0xb51f('0x3b')]?_0x3f6563[_0xb51f('0x3a')]:_0x7fb822['model'];if(!_0x5dba75[_0xb51f('0x37')]['hasOwnProperty']('nolimit')){_0x3f6563[_0xb51f('0x1e')]=qs[_0xb51f('0x1e')](_0x5dba75[_0xb51f('0x37')][_0xb51f('0x1e')]);_0x3f6563[_0xb51f('0x1c')]=qs['offset'](_0x5dba75[_0xb51f('0x37')]['offset']);}_0x3f6563[_0xb51f('0x3c')]=qs[_0xb51f('0x3d')](_0x5dba75[_0xb51f('0x37')][_0xb51f('0x3d')]);_0x3f6563[_0xb51f('0x3e')]=qs[_0xb51f('0x3f')](_[_0xb51f('0x40')](_0x5dba75[_0xb51f('0x37')],_0x7fb822[_0xb51f('0x3f')]),_0x2bda4e);if(_0x5dba75['query'][_0xb51f('0x41')]){_0x3f6563['where']=_[_0xb51f('0x42')](_0x3f6563[_0xb51f('0x3e')],{'$or':_[_0xb51f('0x31')](_0x2bda4e,function(_0x57d8ac){if(_0x57d8ac['type']!==_0xb51f('0x43')){var _0x4119e7={};_0x4119e7[_0x57d8ac[_0xb51f('0x2e')]]={'$like':'%'+_0x5dba75[_0xb51f('0x37')][_0xb51f('0x41')]+'%'};return _0x4119e7;}})});}_0x3f6563=_['merge']({},_0x3f6563,_0x5dba75['options']);var _0x29fb89={'where':_0x3f6563[_0xb51f('0x3e')]};return db[_0xb51f('0x44')][_0xb51f('0x1f')](_0x29fb89)[_0xb51f('0x27')](function(_0x3b0a22){_0x250890[_0xb51f('0x1f')]=_0x3b0a22;if(_0x5dba75['query'][_0xb51f('0x45')]){_0x3f6563[_0xb51f('0x46')]=[{'all':!![]}];}return db['Trigger'][_0xb51f('0x47')](_0x3f6563);})[_0xb51f('0x27')](function(_0x39a1fa){_0x250890[_0xb51f('0x48')]=_0x39a1fa;return _0x250890;})[_0xb51f('0x27')](respondWithFilteredResult(_0x540018,_0x3f6563))['catch'](handleError(_0x540018,null));};exports['show']=function(_0x1704a4,_0xe106b8){var _0x3d8cf5={'raw':![],'where':{'id':_0x1704a4['params']['id']}},_0x15370d={};_0x15370d['model']=_[_0xb51f('0x49')](db[_0xb51f('0x44')]['rawAttributes']);_0x15370d['query']=_[_0xb51f('0x49')](_0x1704a4['query']);_0x15370d[_0xb51f('0x3f')]=_[_0xb51f('0x38')](_0x15370d[_0xb51f('0x36')],_0x15370d[_0xb51f('0x37')]);_0x3d8cf5[_0xb51f('0x3a')]=_[_0xb51f('0x38')](_0x15370d[_0xb51f('0x36')],qs[_0xb51f('0x39')](_0x1704a4[_0xb51f('0x37')]['fields']));_0x3d8cf5[_0xb51f('0x3a')]=_0x3d8cf5['attributes'][_0xb51f('0x3b')]?_0x3d8cf5[_0xb51f('0x3a')]:_0x15370d[_0xb51f('0x36')];if(_0x1704a4[_0xb51f('0x37')][_0xb51f('0x45')]){_0x3d8cf5[_0xb51f('0x46')]=[{'all':!![]}];}_0x3d8cf5=_[_0xb51f('0x42')]({},_0x3d8cf5,_0x1704a4[_0xb51f('0x4a')]);return db[_0xb51f('0x44')][_0xb51f('0x4b')](_0x3d8cf5)[_0xb51f('0x27')](handleEntityNotFound(_0xe106b8,null))[_0xb51f('0x27')](respondWithResult(_0xe106b8,null))['catch'](handleError(_0xe106b8,null));};exports['create']=function(_0x202738,_0xba2ecd){return db[_0xb51f('0x44')]['create'](_0x202738[_0xb51f('0x4c')],{})[_0xb51f('0x27')](function(_0x1f6b12){var _0x142de4=_0x202738[_0xb51f('0x4d')][_0xb51f('0x28')]({'plain':!![]});if(!_0x142de4)throw new Error(_0xb51f('0x4e'));if(_0x142de4['role']===_0xb51f('0x4d')){var _0x40967b=_0x1f6b12[_0xb51f('0x28')]({'plain':!![]});var _0x3b83cf='Triggers';return db[_0xb51f('0x4f')][_0xb51f('0x4b')]({'where':{'name':_0x3b83cf,'userProfileId':_0x142de4[_0xb51f('0x50')]},'raw':!![]})[_0xb51f('0x27')](function(_0x3c94c3){if(_0x3c94c3&&_0x3c94c3[_0xb51f('0x51')]===0x0){return db[_0xb51f('0x2a')][_0xb51f('0x52')]({'name':_0x40967b[_0xb51f('0x2e')],'resourceId':_0x40967b['id'],'type':_0x3c94c3[_0xb51f('0x2e')],'sectionId':_0x3c94c3['id']},{})[_0xb51f('0x27')](function(){return _0x1f6b12;});}else{return _0x1f6b12;}})[_0xb51f('0x53')](function(_0x2fbe93){logger[_0xb51f('0x2c')](_0xb51f('0x54'),_0x2fbe93);throw _0x2fbe93;});}return _0x1f6b12;})['then'](respondWithResult(_0xba2ecd,0xc9))[_0xb51f('0x53')](handleError(_0xba2ecd,null));};exports[_0xb51f('0x25')]=function(_0x162487,_0x1ce7ca){if(_0x162487[_0xb51f('0x4c')]['id']){delete _0x162487['body']['id'];}return db[_0xb51f('0x44')][_0xb51f('0x4b')]({'where':{'id':_0x162487[_0xb51f('0x55')]['id']}})[_0xb51f('0x27')](handleEntityNotFound(_0x1ce7ca,null))[_0xb51f('0x27')](saveUpdates(_0x162487['body'],null))[_0xb51f('0x27')](respondWithResult(_0x1ce7ca,null))['catch'](handleError(_0x1ce7ca,null));};exports[_0xb51f('0x26')]=function(_0x1a2a96,_0x452597){return db[_0xb51f('0x44')]['find']({'where':{'id':_0x1a2a96[_0xb51f('0x55')]['id']}})[_0xb51f('0x27')](handleEntityNotFound(_0x452597,null))['then'](removeEntity(_0x452597,null))[_0xb51f('0x53')](handleError(_0x452597,null));};exports[_0xb51f('0x56')]=function(_0x2a08b2,_0x4fbf78,_0x4c1b1f){if(_0x2a08b2['body']['id']){delete _0x2a08b2[_0xb51f('0x4c')]['id'];}return db[_0xb51f('0x44')]['find']({'where':{'id':_0x2a08b2[_0xb51f('0x55')]['id']}})[_0xb51f('0x27')](handleEntityNotFound(_0x4fbf78,null))[_0xb51f('0x27')](function(_0x23af5a){if(_0x23af5a){_0x2a08b2['body'][_0xb51f('0x57')]=_0x23af5a['id'];return db[_0xb51f('0x58')][_0xb51f('0x52')](_0x2a08b2[_0xb51f('0x4c')]);}})[_0xb51f('0x27')](respondWithResult(_0x4fbf78,null))[_0xb51f('0x53')](handleError(_0x4fbf78,null));};exports['addAnyCondition']=function(_0x347082,_0xf7182a,_0x248f35){if(_0x347082['body']['id']){delete _0x347082[_0xb51f('0x4c')]['id'];}return db[_0xb51f('0x44')]['find']({'where':{'id':_0x347082[_0xb51f('0x55')]['id']}})[_0xb51f('0x27')](handleEntityNotFound(_0xf7182a,null))[_0xb51f('0x27')](function(_0x51cce6){if(_0x51cce6){_0x347082[_0xb51f('0x4c')][_0xb51f('0x59')]=_0x51cce6['id'];return db[_0xb51f('0x58')][_0xb51f('0x52')](_0x347082[_0xb51f('0x4c')]);}})['then'](respondWithResult(_0xf7182a,null))[_0xb51f('0x53')](handleError(_0xf7182a,null));};exports[_0xb51f('0x5a')]=function(_0x1d4e9b,_0x3a8ac7,_0x796931){var _0xcf4049={};var _0x335980={};var _0x483dd4;var _0x4c698c;return db[_0xb51f('0x44')]['findOne']({'where':{'id':_0x1d4e9b[_0xb51f('0x55')]['id']}})[_0xb51f('0x27')](handleEntityNotFound(_0x3a8ac7,null))[_0xb51f('0x27')](function(_0x5db8e6){if(_0x5db8e6){_0x483dd4=_0x5db8e6;_0x335980[_0xb51f('0x36')]=_[_0xb51f('0x49')](db[_0xb51f('0x58')]['rawAttributes']);_0x335980[_0xb51f('0x37')]=_[_0xb51f('0x49')](_0x1d4e9b[_0xb51f('0x37')]);_0x335980[_0xb51f('0x3f')]=_['intersection'](_0x335980['model'],_0x335980[_0xb51f('0x37')]);_0xcf4049[_0xb51f('0x3a')]=_['intersection'](_0x335980[_0xb51f('0x36')],qs['fields'](_0x1d4e9b['query']['fields']));_0xcf4049[_0xb51f('0x3a')]=_0xcf4049['attributes'][_0xb51f('0x3b')]?_0xcf4049[_0xb51f('0x3a')]:_0x335980[_0xb51f('0x36')];_0xcf4049[_0xb51f('0x3c')]=qs[_0xb51f('0x3d')](_0x1d4e9b['query'][_0xb51f('0x3d')]);_0xcf4049[_0xb51f('0x3e')]=qs[_0xb51f('0x3f')](_[_0xb51f('0x40')](_0x1d4e9b[_0xb51f('0x37')],_0x335980['filters']));if(_0x1d4e9b[_0xb51f('0x37')][_0xb51f('0x41')]){_0xcf4049[_0xb51f('0x3e')]=_[_0xb51f('0x42')](_0xcf4049[_0xb51f('0x3e')],{'$or':_['map'](_0xcf4049[_0xb51f('0x3a')],function(_0x27f583){var _0x16462c={};_0x16462c[_0x27f583]={'$like':'%'+_0x1d4e9b['query'][_0xb51f('0x41')]+'%'};return _0x16462c;})});}_0xcf4049=_[_0xb51f('0x42')]({},_0xcf4049,_0x1d4e9b[_0xb51f('0x4a')]);return _0x483dd4[_0xb51f('0x5a')](_0xcf4049);}})[_0xb51f('0x27')](function(_0x429af9){if(_0x429af9){_0x4c698c=_0x429af9[_0xb51f('0x3b')];if(!_0x1d4e9b[_0xb51f('0x37')][_0xb51f('0x5b')](_0xb51f('0x5c'))){_0xcf4049[_0xb51f('0x1e')]=qs[_0xb51f('0x1e')](_0x1d4e9b[_0xb51f('0x37')][_0xb51f('0x1e')]);_0xcf4049[_0xb51f('0x1c')]=qs[_0xb51f('0x1c')](_0x1d4e9b[_0xb51f('0x37')][_0xb51f('0x1c')]);}return _0x483dd4['getAllConditions'](_0xcf4049);}})[_0xb51f('0x27')](function(_0x286ac2){if(_0x286ac2){return _0x286ac2?{'count':_0x4c698c,'rows':_0x286ac2}:null;}})['then'](respondWithResult(_0x3a8ac7,null))[_0xb51f('0x53')](handleError(_0x3a8ac7,null));};exports[_0xb51f('0x5d')]=function(_0x599b02,_0x427c9d,_0x1658ed){var _0x1048b9={};var _0x59f1ec={};var _0x5c52fb;var _0x2fc3f9;return db[_0xb51f('0x44')][_0xb51f('0x5e')]({'where':{'id':_0x599b02['params']['id']}})[_0xb51f('0x27')](handleEntityNotFound(_0x427c9d,null))[_0xb51f('0x27')](function(_0x3afc83){if(_0x3afc83){_0x5c52fb=_0x3afc83;_0x59f1ec[_0xb51f('0x36')]=_[_0xb51f('0x49')](db[_0xb51f('0x58')][_0xb51f('0x32')]);_0x59f1ec[_0xb51f('0x37')]=_[_0xb51f('0x49')](_0x599b02[_0xb51f('0x37')]);_0x59f1ec['filters']=_[_0xb51f('0x38')](_0x59f1ec[_0xb51f('0x36')],_0x59f1ec['query']);_0x1048b9['attributes']=_[_0xb51f('0x38')](_0x59f1ec[_0xb51f('0x36')],qs[_0xb51f('0x39')](_0x599b02[_0xb51f('0x37')][_0xb51f('0x39')]));_0x1048b9[_0xb51f('0x3a')]=_0x1048b9['attributes'][_0xb51f('0x3b')]?_0x1048b9[_0xb51f('0x3a')]:_0x59f1ec[_0xb51f('0x36')];_0x1048b9[_0xb51f('0x3c')]=qs[_0xb51f('0x3d')](_0x599b02[_0xb51f('0x37')][_0xb51f('0x3d')]);_0x1048b9['where']=qs['filters'](_['pick'](_0x599b02[_0xb51f('0x37')],_0x59f1ec[_0xb51f('0x3f')]));if(_0x599b02[_0xb51f('0x37')][_0xb51f('0x41')]){_0x1048b9[_0xb51f('0x3e')]=_[_0xb51f('0x42')](_0x1048b9[_0xb51f('0x3e')],{'$or':_[_0xb51f('0x31')](_0x1048b9[_0xb51f('0x3a')],function(_0x5e742a){var _0x185c5b={};_0x185c5b[_0x5e742a]={'$like':'%'+_0x599b02[_0xb51f('0x37')]['filter']+'%'};return _0x185c5b;})});}_0x1048b9=_['merge']({},_0x1048b9,_0x599b02['options']);return _0x5c52fb[_0xb51f('0x5d')](_0x1048b9);}})[_0xb51f('0x27')](function(_0x120d42){if(_0x120d42){_0x2fc3f9=_0x120d42['length'];if(!_0x599b02[_0xb51f('0x37')][_0xb51f('0x5b')](_0xb51f('0x5c'))){_0x1048b9['limit']=qs[_0xb51f('0x1e')](_0x599b02[_0xb51f('0x37')][_0xb51f('0x1e')]);_0x1048b9[_0xb51f('0x1c')]=qs[_0xb51f('0x1c')](_0x599b02[_0xb51f('0x37')][_0xb51f('0x1c')]);}return _0x5c52fb[_0xb51f('0x5d')](_0x1048b9);}})[_0xb51f('0x27')](function(_0x1cb4d4){if(_0x1cb4d4){return _0x1cb4d4?{'count':_0x2fc3f9,'rows':_0x1cb4d4}:null;}})[_0xb51f('0x27')](respondWithResult(_0x427c9d,null))[_0xb51f('0x53')](handleError(_0x427c9d,null));};exports[_0xb51f('0x5f')]=function(_0x369642,_0x19cfc8,_0x1ba692){if(_0x369642['body']['id']){delete _0x369642[_0xb51f('0x4c')]['id'];}return db['Trigger'][_0xb51f('0x4b')]({'where':{'id':_0x369642[_0xb51f('0x55')]['id']}})[_0xb51f('0x27')](handleEntityNotFound(_0x19cfc8,null))[_0xb51f('0x27')](function(_0x3bcc82){if(_0x3bcc82){_0x369642['body'][_0xb51f('0x60')]=_0x3bcc82['id'];return db[_0xb51f('0x61')][_0xb51f('0x52')](_0x369642[_0xb51f('0x4c')]);}})[_0xb51f('0x27')](respondWithResult(_0x19cfc8,null))[_0xb51f('0x53')](handleError(_0x19cfc8,null));};exports[_0xb51f('0x62')]=function(_0x57e35c,_0x244f40,_0x4f89e8){var _0x5db82b={};var _0x66f719={};var _0x4fe07a;var _0x524b77;return db[_0xb51f('0x44')][_0xb51f('0x5e')]({'where':{'id':_0x57e35c[_0xb51f('0x55')]['id']}})[_0xb51f('0x27')](handleEntityNotFound(_0x244f40,null))[_0xb51f('0x27')](function(_0x4f7498){if(_0x4f7498){_0x4fe07a=_0x4f7498;_0x66f719['model']=_[_0xb51f('0x49')](db[_0xb51f('0x61')][_0xb51f('0x32')]);_0x66f719[_0xb51f('0x37')]=_[_0xb51f('0x49')](_0x57e35c[_0xb51f('0x37')]);_0x66f719[_0xb51f('0x3f')]=_[_0xb51f('0x38')](_0x66f719[_0xb51f('0x36')],_0x66f719['query']);_0x5db82b[_0xb51f('0x3a')]=_[_0xb51f('0x38')](_0x66f719[_0xb51f('0x36')],qs[_0xb51f('0x39')](_0x57e35c[_0xb51f('0x37')][_0xb51f('0x39')]));_0x5db82b['attributes']=_0x5db82b[_0xb51f('0x3a')][_0xb51f('0x3b')]?_0x5db82b[_0xb51f('0x3a')]:_0x66f719['model'];_0x5db82b[_0xb51f('0x3c')]=qs[_0xb51f('0x3d')](_0x57e35c[_0xb51f('0x37')][_0xb51f('0x3d')]);_0x5db82b[_0xb51f('0x3e')]=qs[_0xb51f('0x3f')](_[_0xb51f('0x40')](_0x57e35c[_0xb51f('0x37')],_0x66f719[_0xb51f('0x3f')]));if(_0x57e35c['query'][_0xb51f('0x41')]){_0x5db82b['where']=_['merge'](_0x5db82b[_0xb51f('0x3e')],{'$or':_[_0xb51f('0x31')](_0x5db82b[_0xb51f('0x3a')],function(_0xc21345){var _0x2f5b74={};_0x2f5b74[_0xc21345]={'$like':'%'+_0x57e35c[_0xb51f('0x37')][_0xb51f('0x41')]+'%'};return _0x2f5b74;})});}_0x5db82b=_['merge']({},_0x5db82b,_0x57e35c[_0xb51f('0x4a')]);return _0x4fe07a[_0xb51f('0x62')](_0x5db82b);}})[_0xb51f('0x27')](function(_0x595319){if(_0x595319){_0x524b77=_0x595319['length'];if(!_0x57e35c['query'][_0xb51f('0x5b')](_0xb51f('0x5c'))){_0x5db82b[_0xb51f('0x1e')]=qs['limit'](_0x57e35c[_0xb51f('0x37')][_0xb51f('0x1e')]);_0x5db82b['offset']=qs['offset'](_0x57e35c[_0xb51f('0x37')][_0xb51f('0x1c')]);}return _0x4fe07a[_0xb51f('0x62')](_0x5db82b);}})[_0xb51f('0x27')](function(_0x4caeb7){if(_0x4caeb7){return _0x4caeb7?{'count':_0x524b77,'rows':_0x4caeb7}:null;}})['then'](respondWithResult(_0x244f40,null))['catch'](handleError(_0x244f40,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 8587b16..257aeb4 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 _0x668b=['tools_triggers','lodash','util','api','moment','request-promise','rimraf','../../config/environment','./trigger.attributes','define','Trigger'];(function(_0x43bd66,_0x27e9b3){var _0x5195cb=function(_0xe936f0){while(--_0xe936f0){_0x43bd66['push'](_0x43bd66['shift']());}};_0x5195cb(++_0x27e9b3);}(_0x668b,0x140));var _0xb668=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0x668b[_0x9df060];return _0x338dfe;};'use strict';var _=require(_0xb668('0x0'));var util=require(_0xb668('0x1'));var logger=require('../../config/logger')(_0xb668('0x2'));var moment=require(_0xb668('0x3'));var BPromise=require('bluebird');var rp=require(_0xb668('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb668('0x5'));var config=require(_0xb668('0x6'));var attributes=require(_0xb668('0x7'));module['exports']=function(_0x9b99a8,_0x296fa9){return _0x9b99a8[_0xb668('0x8')](_0xb668('0x9'),attributes,{'tableName':_0xb668('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0328=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./trigger.attributes','Trigger','tools_triggers','lodash','util'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x0328,0x172));var _0x8032=function(_0x62e5a,_0x380232){_0x62e5a=_0x62e5a-0x0;var _0x144048=_0x0328[_0x62e5a];return _0x144048;};'use strict';var _=require(_0x8032('0x0'));var util=require(_0x8032('0x1'));var logger=require(_0x8032('0x2'))(_0x8032('0x3'));var moment=require(_0x8032('0x4'));var BPromise=require(_0x8032('0x5'));var rp=require(_0x8032('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8032('0x7'));var config=require(_0x8032('0x8'));var attributes=require(_0x8032('0x9'));module['exports']=function(_0x7ccda3,_0x553c90){return _0x7ccda3['define'](_0x8032('0xa'),attributes,{'tableName':_0x8032('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 71c126f..dac6c75 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 _0xef1e=['include','map','model','ShowTrigger','Trigger','find','where','info','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','debug','Trigger,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Trigger,\x20%s,\x20%s','message','result','catch','GetTrigger','findAll','raw','options','attributes','limit'];(function(_0x2b9b7f,_0x4d47df){var _0x4ed19a=function(_0x72b5ff){while(--_0x72b5ff){_0x2b9b7f['push'](_0x2b9b7f['shift']());}};_0x4ed19a(++_0x4d47df);}(_0xef1e,0xa0));var _0xeef1=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xef1e[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xeef1('0x0'));var util=require(_0xeef1('0x1'));var moment=require('moment');var BPromise=require(_0xeef1('0x2'));var rs=require(_0xeef1('0x3'));var fs=require('fs');var Redis=require(_0xeef1('0x4'));var db=require(_0xeef1('0x5'))['db'];var utils=require(_0xeef1('0x6'));var logger=require(_0xeef1('0x7'))('rpc');var config=require(_0xeef1('0x8'));var jayson=require(_0xeef1('0x9'));var client=jayson[_0xeef1('0xa')][_0xeef1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4bbece,_0x573fb2,_0x4564b6){return new BPromise(function(_0x229037,_0x595c1c){return client[_0xeef1('0xc')](_0x4bbece,_0x4564b6)[_0xeef1('0xd')](function(_0x294ef6){logger['info']('Trigger,\x20%s,\x20%s',_0x573fb2,'request\x20sent');logger[_0xeef1('0xe')](_0xeef1('0xf'),_0x573fb2,_0xeef1('0x10'),JSON[_0xeef1('0x11')](_0x294ef6));if(_0x294ef6[_0xeef1('0x12')]){if(_0x294ef6['error'][_0xeef1('0x13')]===0x1f4){logger[_0xeef1('0x12')](_0xeef1('0x14'),_0x573fb2,_0x294ef6[_0xeef1('0x12')][_0xeef1('0x15')]);return _0x595c1c(_0x294ef6[_0xeef1('0x12')][_0xeef1('0x15')]);}logger[_0xeef1('0x12')](_0xeef1('0x14'),_0x573fb2,_0x294ef6[_0xeef1('0x12')][_0xeef1('0x15')]);return _0x229037(_0x294ef6['error'][_0xeef1('0x15')]);}else{logger['info'](_0xeef1('0x14'),_0x573fb2,_0xeef1('0x10'));_0x229037(_0x294ef6[_0xeef1('0x16')][_0xeef1('0x15')]);}})[_0xeef1('0x17')](function(_0x5e8bdb){logger[_0xeef1('0x12')]('Trigger,\x20%s,\x20%s',_0x573fb2,_0x5e8bdb);_0x595c1c(_0x5e8bdb);});});}exports[_0xeef1('0x18')]=function(_0x2f1922){var _0x1792c6=this;return new Promise(function(_0x2844eb,_0x678b11){return db['Trigger'][_0xeef1('0x19')]({'raw':_0x2f1922['options']?_0x2f1922['options'][_0xeef1('0x1a')]===undefined?!![]:![]:!![],'where':_0x2f1922[_0xeef1('0x1b')]?_0x2f1922[_0xeef1('0x1b')]['where']||null:null,'attributes':_0x2f1922[_0xeef1('0x1b')]?_0x2f1922[_0xeef1('0x1b')][_0xeef1('0x1c')]||null:null,'limit':_0x2f1922['options']?_0x2f1922[_0xeef1('0x1b')][_0xeef1('0x1d')]||null:null,'include':_0x2f1922[_0xeef1('0x1b')]?_0x2f1922['options'][_0xeef1('0x1e')]?_[_0xeef1('0x1f')](_0x2f1922[_0xeef1('0x1b')]['include'],function(_0x232642){return{'model':db[_0x232642[_0xeef1('0x20')]],'as':_0x232642['as'],'attributes':_0x232642[_0xeef1('0x1c')],'include':_0x232642[_0xeef1('0x1e')]?_[_0xeef1('0x1f')](_0x232642[_0xeef1('0x1e')],function(_0xac4091){return{'model':db[_0xac4091[_0xeef1('0x20')]],'as':_0xac4091['as'],'attributes':_0xac4091[_0xeef1('0x1c')],'include':_0xac4091[_0xeef1('0x1e')]?_[_0xeef1('0x1f')](_0xac4091[_0xeef1('0x1e')],function(_0x5a691d){return{'model':db[_0x5a691d[_0xeef1('0x20')]],'as':_0x5a691d['as'],'attributes':_0x5a691d[_0xeef1('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xeef1('0xd')](function(_0x1b51b0){logger['info'](_0xeef1('0x18'),_0x2f1922);logger['debug'](_0xeef1('0x18'),_0x2f1922,JSON['stringify'](_0x1b51b0));_0x2844eb(_0x1b51b0);})[_0xeef1('0x17')](function(_0x3cc6c3){logger['error'](_0xeef1('0x18'),_0x3cc6c3['message'],_0x2f1922);_0x678b11(_0x1792c6[_0xeef1('0x12')](0x1f4,_0x3cc6c3[_0xeef1('0x15')]));});});};exports[_0xeef1('0x21')]=function(_0x58b29a){var _0x34982f=this;return new Promise(function(_0x345103,_0x18103f){return db[_0xeef1('0x22')][_0xeef1('0x23')]({'raw':_0x58b29a[_0xeef1('0x1b')]?_0x58b29a['options'][_0xeef1('0x1a')]===undefined?!![]:![]:!![],'where':_0x58b29a[_0xeef1('0x1b')]?_0x58b29a[_0xeef1('0x1b')][_0xeef1('0x24')]||null:null,'attributes':_0x58b29a['options']?_0x58b29a[_0xeef1('0x1b')][_0xeef1('0x1c')]||null:null,'include':_0x58b29a[_0xeef1('0x1b')]?_0x58b29a[_0xeef1('0x1b')][_0xeef1('0x1e')]?_['map'](_0x58b29a[_0xeef1('0x1b')]['include'],function(_0x35bf2c){return{'model':db[_0x35bf2c[_0xeef1('0x20')]],'as':_0x35bf2c['as'],'attributes':_0x35bf2c[_0xeef1('0x1c')],'include':_0x35bf2c['include']?_['map'](_0x35bf2c[_0xeef1('0x1e')],function(_0x59a12c){return{'model':db[_0x59a12c['model']],'as':_0x59a12c['as'],'attributes':_0x59a12c[_0xeef1('0x1c')],'include':_0x59a12c[_0xeef1('0x1e')]?_[_0xeef1('0x1f')](_0x59a12c['include'],function(_0x3fd104){return{'model':db[_0x3fd104[_0xeef1('0x20')]],'as':_0x3fd104['as'],'attributes':_0x3fd104['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4e5055){logger[_0xeef1('0x25')](_0xeef1('0x21'),_0x58b29a);logger[_0xeef1('0xe')](_0xeef1('0x21'),_0x58b29a,JSON[_0xeef1('0x11')](_0x4e5055));_0x345103(_0x4e5055);})[_0xeef1('0x17')](function(_0x590037){logger[_0xeef1('0x12')](_0xeef1('0x21'),_0x590037[_0xeef1('0x15')],_0x58b29a);_0x18103f(_0x34982f[_0xeef1('0x12')](0x1f4,_0x590037[_0xeef1('0x15')]));});});}; \ No newline at end of file +var _0xa075=['Trigger,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetTrigger','Trigger','options','raw','where','attributes','limit','include','model','map','ShowTrigger','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x2bccd9,_0x1d0e16){var _0xdabd4c=function(_0x2d15f8){while(--_0x2d15f8){_0x2bccd9['push'](_0x2bccd9['shift']());}};_0xdabd4c(++_0x1d0e16);}(_0xa075,0x102));var _0x5a07=function(_0x14cf6,_0x52f437){_0x14cf6=_0x14cf6-0x0;var _0xbcad5f=_0xa075[_0x14cf6];return _0xbcad5f;};'use strict';var _=require(_0x5a07('0x0'));var util=require(_0x5a07('0x1'));var moment=require(_0x5a07('0x2'));var BPromise=require('bluebird');var rs=require(_0x5a07('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5a07('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5a07('0x5'))(_0x5a07('0x6'));var config=require(_0x5a07('0x7'));var jayson=require(_0x5a07('0x8'));var client=jayson[_0x5a07('0x9')][_0x5a07('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x54fec8,_0xbd9400,_0x1053cb){return new BPromise(function(_0x1195a3,_0x5dbc16){return client[_0x5a07('0xb')](_0x54fec8,_0x1053cb)[_0x5a07('0xc')](function(_0x5be6ff){logger[_0x5a07('0xd')](_0x5a07('0xe'),_0xbd9400,_0x5a07('0xf'));logger[_0x5a07('0x10')]('Trigger,\x20%s,\x20%s,\x20%s',_0xbd9400,'request\x20sent',JSON[_0x5a07('0x11')](_0x5be6ff));if(_0x5be6ff[_0x5a07('0x12')]){if(_0x5be6ff[_0x5a07('0x12')][_0x5a07('0x13')]===0x1f4){logger[_0x5a07('0x12')](_0x5a07('0xe'),_0xbd9400,_0x5be6ff[_0x5a07('0x12')][_0x5a07('0x14')]);return _0x5dbc16(_0x5be6ff[_0x5a07('0x12')][_0x5a07('0x14')]);}logger[_0x5a07('0x12')](_0x5a07('0xe'),_0xbd9400,_0x5be6ff[_0x5a07('0x12')][_0x5a07('0x14')]);return _0x1195a3(_0x5be6ff[_0x5a07('0x12')][_0x5a07('0x14')]);}else{logger[_0x5a07('0xd')](_0x5a07('0xe'),_0xbd9400,_0x5a07('0xf'));_0x1195a3(_0x5be6ff[_0x5a07('0x15')][_0x5a07('0x14')]);}})[_0x5a07('0x16')](function(_0x202a4e){logger['error'](_0x5a07('0xe'),_0xbd9400,_0x202a4e);_0x5dbc16(_0x202a4e);});});}exports[_0x5a07('0x17')]=function(_0x225de9){var _0x566f85=this;return new Promise(function(_0x3405a1,_0xb23dd4){return db[_0x5a07('0x18')]['findAll']({'raw':_0x225de9[_0x5a07('0x19')]?_0x225de9[_0x5a07('0x19')][_0x5a07('0x1a')]===undefined?!![]:![]:!![],'where':_0x225de9[_0x5a07('0x19')]?_0x225de9['options'][_0x5a07('0x1b')]||null:null,'attributes':_0x225de9[_0x5a07('0x19')]?_0x225de9[_0x5a07('0x19')][_0x5a07('0x1c')]||null:null,'limit':_0x225de9['options']?_0x225de9[_0x5a07('0x19')][_0x5a07('0x1d')]||null:null,'include':_0x225de9['options']?_0x225de9['options']['include']?_['map'](_0x225de9[_0x5a07('0x19')][_0x5a07('0x1e')],function(_0x1013f0){return{'model':db[_0x1013f0[_0x5a07('0x1f')]],'as':_0x1013f0['as'],'attributes':_0x1013f0[_0x5a07('0x1c')],'include':_0x1013f0[_0x5a07('0x1e')]?_[_0x5a07('0x20')](_0x1013f0['include'],function(_0x487036){return{'model':db[_0x487036[_0x5a07('0x1f')]],'as':_0x487036['as'],'attributes':_0x487036[_0x5a07('0x1c')],'include':_0x487036['include']?_[_0x5a07('0x20')](_0x487036['include'],function(_0x52602d){return{'model':db[_0x52602d[_0x5a07('0x1f')]],'as':_0x52602d['as'],'attributes':_0x52602d['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x47fa33){logger[_0x5a07('0xd')](_0x5a07('0x17'),_0x225de9);logger['debug'](_0x5a07('0x17'),_0x225de9,JSON[_0x5a07('0x11')](_0x47fa33));_0x3405a1(_0x47fa33);})[_0x5a07('0x16')](function(_0x12b052){logger[_0x5a07('0x12')]('GetTrigger',_0x12b052['message'],_0x225de9);_0xb23dd4(_0x566f85[_0x5a07('0x12')](0x1f4,_0x12b052[_0x5a07('0x14')]));});});};exports[_0x5a07('0x21')]=function(_0x53ceae){var _0x278da3=this;return new Promise(function(_0x143b02,_0x5a0439){return db[_0x5a07('0x18')]['find']({'raw':_0x53ceae[_0x5a07('0x19')]?_0x53ceae[_0x5a07('0x19')][_0x5a07('0x1a')]===undefined?!![]:![]:!![],'where':_0x53ceae[_0x5a07('0x19')]?_0x53ceae[_0x5a07('0x19')][_0x5a07('0x1b')]||null:null,'attributes':_0x53ceae[_0x5a07('0x19')]?_0x53ceae['options'][_0x5a07('0x1c')]||null:null,'include':_0x53ceae[_0x5a07('0x19')]?_0x53ceae[_0x5a07('0x19')][_0x5a07('0x1e')]?_['map'](_0x53ceae[_0x5a07('0x19')][_0x5a07('0x1e')],function(_0x262ae4){return{'model':db[_0x262ae4['model']],'as':_0x262ae4['as'],'attributes':_0x262ae4[_0x5a07('0x1c')],'include':_0x262ae4[_0x5a07('0x1e')]?_[_0x5a07('0x20')](_0x262ae4['include'],function(_0x49ba8c){return{'model':db[_0x49ba8c[_0x5a07('0x1f')]],'as':_0x49ba8c['as'],'attributes':_0x49ba8c[_0x5a07('0x1c')],'include':_0x49ba8c[_0x5a07('0x1e')]?_['map'](_0x49ba8c[_0x5a07('0x1e')],function(_0xe5c8fc){return{'model':db[_0xe5c8fc[_0x5a07('0x1f')]],'as':_0xe5c8fc['as'],'attributes':_0xe5c8fc[_0x5a07('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x5a07('0xc')](function(_0x564905){logger[_0x5a07('0xd')](_0x5a07('0x21'),_0x53ceae);logger[_0x5a07('0x10')](_0x5a07('0x21'),_0x53ceae,JSON[_0x5a07('0x11')](_0x564905));_0x143b02(_0x564905);})[_0x5a07('0x16')](function(_0x8d5d3f){logger[_0x5a07('0x12')](_0x5a07('0x21'),_0x8d5d3f[_0x5a07('0x14')],_0x53ceae);_0x5a0439(_0x278da3['error'](0x1f4,_0x8d5d3f[_0x5a07('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index edd6246..90c030d 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 _0xfe36=['./trunk.controller','get','isAuthenticated','index','/:id','show','post','/:id/clone','clone','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service'];(function(_0x341a15,_0xaa08f7){var _0x5d1bd0=function(_0x28254f){while(--_0x28254f){_0x341a15['push'](_0x341a15['shift']());}};_0x5d1bd0(++_0xaa08f7);}(_0xfe36,0x7f));var _0x6fe3=function(_0x442eb4,_0xe9d617){_0x442eb4=_0x442eb4-0x0;var _0x125321=_0xfe36[_0x442eb4];return _0x125321;};'use strict';var multer=require(_0x6fe3('0x0'));var util=require(_0x6fe3('0x1'));var path=require(_0x6fe3('0x2'));var timeout=require(_0x6fe3('0x3'));var express=require(_0x6fe3('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x6fe3('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x6fe3('0x6'));router[_0x6fe3('0x7')]('/',auth[_0x6fe3('0x8')](),controller[_0x6fe3('0x9')]);router[_0x6fe3('0x7')](_0x6fe3('0xa'),auth['isAuthenticated'](),controller[_0x6fe3('0xb')]);router[_0x6fe3('0xc')](_0x6fe3('0xd'),auth['isAuthenticated'](),controller[_0x6fe3('0xe')]);router[_0x6fe3('0xc')]('/',auth[_0x6fe3('0x8')](),controller['create']);router['put'](_0x6fe3('0xa'),auth[_0x6fe3('0x8')](),controller[_0x6fe3('0xf')]);router[_0x6fe3('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x6fe3('0x11')]);module[_0x6fe3('0x12')]=router; \ No newline at end of file +var _0xfc10=['multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller','get','index','/:id','isAuthenticated','clone','post','create','put','update','delete','destroy','exports'];(function(_0x1f0d60,_0x58a2c2){var _0x148a20=function(_0x96e0a3){while(--_0x96e0a3){_0x1f0d60['push'](_0x1f0d60['shift']());}};_0x148a20(++_0x58a2c2);}(_0xfc10,0x11e));var _0x0fc1=function(_0x192e54,_0xd77a5e){_0x192e54=_0x192e54-0x0;var _0x57d9b3=_0xfc10[_0x192e54];return _0x57d9b3;};'use strict';var multer=require(_0x0fc1('0x0'));var util=require(_0x0fc1('0x1'));var path=require(_0x0fc1('0x2'));var timeout=require(_0x0fc1('0x3'));var express=require(_0x0fc1('0x4'));var router=express['Router']();var fs_extra=require(_0x0fc1('0x5'));var auth=require(_0x0fc1('0x6'));var interaction=require(_0x0fc1('0x7'));var config=require(_0x0fc1('0x8'));var controller=require(_0x0fc1('0x9'));router[_0x0fc1('0xa')]('/',auth['isAuthenticated'](),controller[_0x0fc1('0xb')]);router[_0x0fc1('0xa')](_0x0fc1('0xc'),auth[_0x0fc1('0xd')](),controller['show']);router['post']('/:id/clone',auth[_0x0fc1('0xd')](),controller[_0x0fc1('0xe')]);router[_0x0fc1('0xf')]('/',auth[_0x0fc1('0xd')](),controller[_0x0fc1('0x10')]);router[_0x0fc1('0x11')](_0x0fc1('0xc'),auth[_0x0fc1('0xd')](),controller[_0x0fc1('0x12')]);router[_0x0fc1('0x13')](_0x0fc1('0xc'),auth[_0x0fc1('0xd')](),controller[_0x0fc1('0x14')]);module[_0x0fc1('0x15')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 3c6525c..d017a66 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 _0xb476=['ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','udp','setDataValue','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','inband','auto','yes','update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','INTEGER','\x22\x22\x20<>','accept','originate','uac','uas','pai','fingerprint','certificate','active','actpass','nonat','update,nonat','BOOLEAN','sequelize','STRING','name','ENUM','friend','user','peer','from-voip-provider'];(function(_0x12a98f,_0x3d2af6){var _0x513fb7=function(_0x2dc889){while(--_0x2dc889){_0x12a98f['push'](_0x12a98f['shift']());}};_0x513fb7(++_0x3d2af6);}(_0xb476,0x8e));var _0x6b47=function(_0x191154,_0x56f74c){_0x191154=_0x191154-0x0;var _0x3dcd73=_0xb476[_0x191154];return _0x3dcd73;};'use strict';var Sequelize=require(_0x6b47('0x0'));module['exports']={'name':{'type':Sequelize[_0x6b47('0x1')],'allowNull':![],'unique':_0x6b47('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x6b47('0x3')](_0x6b47('0x4'),_0x6b47('0x5'),_0x6b47('0x6')),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize[_0x6b47('0x1')],'allowNull':![],'defaultValue':_0x6b47('0x7')},'callingpres':{'type':Sequelize[_0x6b47('0x3')](_0x6b47('0x8'),_0x6b47('0x9'),_0x6b47('0xa'),'ALLOWED',_0x6b47('0xb'),'PROHIB_PASSED_SCREEN',_0x6b47('0xc'),'PROHIB')},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize[_0x6b47('0x1')]},'secret':{'type':Sequelize[_0x6b47('0x1')]},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize[_0x6b47('0x1')]},'transport':{'type':Sequelize['STRING'],'defaultValue':_0x6b47('0xd'),'set':function(_0x10b00a){this[_0x6b47('0xe')](_0x6b47('0xf'),_0x10b00a?_0x10b00a[_0x6b47('0x10')](','):null);},'get':function(){return this[_0x6b47('0x11')](_0x6b47('0xf'))?this[_0x6b47('0x11')]('transport')[_0x6b47('0x12')](','):null;},'comment':_0x6b47('0x13')},'dtmfmode':{'type':Sequelize[_0x6b47('0x3')](_0x6b47('0x14'),_0x6b47('0x15'),'shortinfo',_0x6b47('0x16'),_0x6b47('0x17')),'defaultValue':_0x6b47('0x14')},'directmedia':{'type':Sequelize[_0x6b47('0x3')](_0x6b47('0x18'),'no','nonat',_0x6b47('0x19'),_0x6b47('0x1a')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x6b47('0x3')](_0x6b47('0x18'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x6b47('0x1')]},'directmediadeny':{'type':Sequelize[_0x6b47('0x1')]},'nat':{'type':Sequelize[_0x6b47('0x1')],'defaultValue':_0x6b47('0x1b'),'set':function(_0x17ba80){this[_0x6b47('0xe')](_0x6b47('0x1c'),_0x17ba80?_0x17ba80[_0x6b47('0x10')](','):null);},'get':function(){return this[_0x6b47('0x11')]('nat')?this['getDataValue'](_0x6b47('0x1c'))['split'](','):null;},'comment':_0x6b47('0x1d')},'callgroup':{'type':Sequelize[_0x6b47('0x1')]},'namedcallgroup':{'type':Sequelize[_0x6b47('0x1')]},'pickupgroup':{'type':Sequelize[_0x6b47('0x1')]},'namedpickupgroup':{'type':Sequelize[_0x6b47('0x1')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x6b47('0x1')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x6b47('0x1')],'defaultValue':_0x6b47('0x1e')},'allow':{'type':Sequelize[_0x6b47('0x1')],'allowNull':![],'defaultValue':_0x6b47('0x1f'),'set':function(_0x24d948){this[_0x6b47('0xe')](_0x6b47('0x20'),_0x24d948?_0x24d948[_0x6b47('0x10')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0x6b47('0x11')](_0x6b47('0x20'))?this['getDataValue']('allow')['split'](';'):null;},'comment':_0x6b47('0x21')},'autoframing':{'type':Sequelize[_0x6b47('0x3')](_0x6b47('0x18'),'no')},'insecure':{'type':Sequelize[_0x6b47('0x1')],'defaultValue':_0x6b47('0x22'),'set':function(_0x4f48ea){this[_0x6b47('0xe')](_0x6b47('0x23'),_0x4f48ea?_0x4f48ea[_0x6b47('0x10')](','):null);},'get':function(){return this[_0x6b47('0x11')](_0x6b47('0x23'))?this[_0x6b47('0x11')](_0x6b47('0x23'))[_0x6b47('0x12')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x6b47('0x3')](_0x6b47('0x18'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x6b47('0x3')](_0x6b47('0x18'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0x6b47('0x18'),'no','never')},'promiscredir':{'type':Sequelize['ENUM']('yes','no')},'useclientcode':{'type':Sequelize[_0x6b47('0x3')](_0x6b47('0x18'),'no')},'accountcode':{'type':Sequelize[_0x6b47('0x24')](0xb)},'setvar':{'type':Sequelize[_0x6b47('0x1')]},'callerid':{'type':Sequelize[_0x6b47('0x1')],'defaultValue':_0x6b47('0x25')},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize[_0x6b47('0x3')](_0x6b47('0x18'),'no'),'defaultValue':_0x6b47('0x18')},'busylevel':{'type':Sequelize[_0x6b47('0x24')](0xb)},'allowoverlap':{'type':Sequelize[_0x6b47('0x3')](_0x6b47('0x18'),'no')},'allowsubscribe':{'type':Sequelize[_0x6b47('0x3')](_0x6b47('0x18'),'no')},'allowtransfer':{'type':Sequelize[_0x6b47('0x3')](_0x6b47('0x18'),'no')},'ignoresdpversion':{'type':Sequelize[_0x6b47('0x3')](_0x6b47('0x18'),'no')},'subscribecontext':{'type':Sequelize[_0x6b47('0x1')]},'template':{'type':Sequelize[_0x6b47('0x1')]},'videosupport':{'type':Sequelize[_0x6b47('0x3')](_0x6b47('0x18'),'no','always'),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x6b47('0x24')](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x6b47('0x18'),'no')},'mailbox':{'type':Sequelize[_0x6b47('0x1')]},'session_timers':{'type':Sequelize[_0x6b47('0x3')](_0x6b47('0x26'),'refuse',_0x6b47('0x27'))},'session_expires':{'type':Sequelize[_0x6b47('0x24')](0xb)},'session_minse':{'type':Sequelize[_0x6b47('0x24')](0xb)},'session_refresher':{'type':Sequelize['ENUM'](_0x6b47('0x28'),_0x6b47('0x29')),'defaultValue':_0x6b47('0x29')},'t38pt_usertpsource':{'type':Sequelize[_0x6b47('0x1')]},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize[_0x6b47('0x1')]},'fromuser':{'type':Sequelize['STRING']},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize['ENUM'](_0x6b47('0x18'),'no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x6b47('0x24')](0xb)},'defaultip':{'type':Sequelize[_0x6b47('0x1')]},'defaultuser':{'type':Sequelize[_0x6b47('0x1')]},'rtptimeout':{'type':Sequelize[_0x6b47('0x24')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x6b47('0x24')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x6b47('0x24')](0xb)},'sendrpid':{'type':Sequelize[_0x6b47('0x3')](_0x6b47('0x18'),'no',_0x6b47('0x2a')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x6b47('0x1')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize[_0x6b47('0x24')](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize[_0x6b47('0x24')](0xb)},'contactpermit':{'type':Sequelize[_0x6b47('0x1')]},'contactdeny':{'type':Sequelize[_0x6b47('0x1')]},'contactacl':{'type':Sequelize[_0x6b47('0x1')]},'unsolicited_mailbox':{'type':Sequelize['STRING']},'use_q850_reason':{'type':Sequelize[_0x6b47('0x1')]},'maxforwards':{'type':Sequelize[_0x6b47('0x24')](0xb)},'encryption':{'type':Sequelize['ENUM'](_0x6b47('0x18'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x6b47('0x3')]('yes','no')},'force_avp':{'type':Sequelize['ENUM'](_0x6b47('0x18'),'no')},'icesupport':{'type':Sequelize[_0x6b47('0x3')](_0x6b47('0x18'),'no')},'dtlsenable':{'type':Sequelize[_0x6b47('0x3')](_0x6b47('0x18'),'no')},'dtlsverify':{'type':Sequelize['ENUM'](_0x6b47('0x18'),'no',_0x6b47('0x2b'),_0x6b47('0x2c'))},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb)},'dtlscertfile':{'type':Sequelize[_0x6b47('0x1')]},'dtlsprivatekey':{'type':Sequelize[_0x6b47('0x1')]},'dtlscipher':{'type':Sequelize[_0x6b47('0x1')]},'dtlscafile':{'type':Sequelize[_0x6b47('0x1')]},'dtlscapath':{'type':Sequelize[_0x6b47('0x1')]},'dtlssetup':{'type':Sequelize[_0x6b47('0x3')](_0x6b47('0x2d'),'passive',_0x6b47('0x2e')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize[_0x6b47('0x3')](_0x6b47('0x18'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x6b47('0x1')]},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize[_0x6b47('0x24')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x6b47('0x3')](_0x6b47('0x18'),'no')},'subscribemwi':{'type':Sequelize[_0x6b47('0x3')](_0x6b47('0x18'),'no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize[_0x6b47('0x1')]},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize[_0x6b47('0x1')]},'description':{'type':Sequelize[_0x6b47('0x1')]},'host':{'type':Sequelize[_0x6b47('0x1')],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize[_0x6b47('0x3')](_0x6b47('0x18'),'no',_0x6b47('0x2f'),_0x6b47('0x19'),_0x6b47('0x30')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x6b47('0x1')]},'otherFields':{'type':Sequelize[_0x6b47('0x1')]},'active':{'type':Sequelize[_0x6b47('0x31')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize['STRING'],'defaultValue':'no'}}; \ No newline at end of file +var _0xa2b8=['from-voip-provider','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','udp','setDataValue','transport','join','getDataValue','split','rfc2833','info','nonat','outgoing','yes','force_rport,comedia','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\x22alaw\x22]','port,invite','insecure','never','INTEGER','always','accept','refuse','originate','uac','uas','pai','active','actpass','dynamic','update','BOOLEAN','sequelize','exports','STRING','name','ENUM','friend','user','peer'];(function(_0x14bad0,_0x583f36){var _0x503713=function(_0x4bb510){while(--_0x4bb510){_0x14bad0['push'](_0x14bad0['shift']());}};_0x503713(++_0x583f36);}(_0xa2b8,0x180));var _0x8a2b=function(_0x3db0a6,_0x5e67d3){_0x3db0a6=_0x3db0a6-0x0;var _0x19f504=_0xa2b8[_0x3db0a6];return _0x19f504;};'use strict';var Sequelize=require(_0x8a2b('0x0'));module[_0x8a2b('0x1')]={'name':{'type':Sequelize[_0x8a2b('0x2')],'allowNull':![],'unique':_0x8a2b('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x8a2b('0x4')](_0x8a2b('0x5'),_0x8a2b('0x6'),_0x8a2b('0x7')),'allowNull':![],'defaultValue':_0x8a2b('0x5')},'context':{'type':Sequelize[_0x8a2b('0x2')],'allowNull':![],'defaultValue':_0x8a2b('0x8')},'callingpres':{'type':Sequelize[_0x8a2b('0x4')]('ALLOWED_NOT_SCREENED',_0x8a2b('0x9'),_0x8a2b('0xa'),_0x8a2b('0xb'),_0x8a2b('0xc'),_0x8a2b('0xd'),_0x8a2b('0xe'),'PROHIB')},'deny':{'type':Sequelize[_0x8a2b('0x2')]},'permit':{'type':Sequelize[_0x8a2b('0x2')]},'secret':{'type':Sequelize[_0x8a2b('0x2')]},'md5secret':{'type':Sequelize[_0x8a2b('0x2')]},'remotesecret':{'type':Sequelize[_0x8a2b('0x2')]},'transport':{'type':Sequelize['STRING'],'defaultValue':_0x8a2b('0xf'),'set':function(_0xc5707e){this[_0x8a2b('0x10')](_0x8a2b('0x11'),_0xc5707e?_0xc5707e[_0x8a2b('0x12')](','):null);},'get':function(){return this[_0x8a2b('0x13')](_0x8a2b('0x11'))?this['getDataValue'](_0x8a2b('0x11'))[_0x8a2b('0x14')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0x8a2b('0x4')](_0x8a2b('0x15'),_0x8a2b('0x16'),'shortinfo','inband','auto'),'defaultValue':_0x8a2b('0x15')},'directmedia':{'type':Sequelize[_0x8a2b('0x4')]('yes','no',_0x8a2b('0x17'),'update',_0x8a2b('0x18')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0x8a2b('0x19'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x8a2b('0x2')]},'directmediadeny':{'type':Sequelize[_0x8a2b('0x2')]},'nat':{'type':Sequelize[_0x8a2b('0x2')],'defaultValue':_0x8a2b('0x1a'),'set':function(_0x44478){this['setDataValue'](_0x8a2b('0x1b'),_0x44478?_0x44478['join'](','):null);},'get':function(){return this[_0x8a2b('0x13')](_0x8a2b('0x1b'))?this['getDataValue'](_0x8a2b('0x1b'))[_0x8a2b('0x14')](','):null;},'comment':_0x8a2b('0x1c')},'callgroup':{'type':Sequelize[_0x8a2b('0x2')]},'namedcallgroup':{'type':Sequelize[_0x8a2b('0x2')]},'pickupgroup':{'type':Sequelize[_0x8a2b('0x2')]},'namedpickupgroup':{'type':Sequelize[_0x8a2b('0x2')]},'language':{'type':Sequelize[_0x8a2b('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x8a2b('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize['STRING'],'defaultValue':_0x8a2b('0x1d')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x2880c3){this['setDataValue'](_0x8a2b('0x1e'),_0x2880c3?_0x2880c3['join'](';'):_0x8a2b('0x1f'));},'get':function(){return this[_0x8a2b('0x13')](_0x8a2b('0x1e'))?this[_0x8a2b('0x13')]('allow')[_0x8a2b('0x14')](';'):null;},'comment':_0x8a2b('0x20')},'autoframing':{'type':Sequelize[_0x8a2b('0x4')]('yes','no')},'insecure':{'type':Sequelize[_0x8a2b('0x2')],'defaultValue':_0x8a2b('0x21'),'set':function(_0x5c1b88){this[_0x8a2b('0x10')](_0x8a2b('0x22'),_0x5c1b88?_0x5c1b88[_0x8a2b('0x12')](','):null);},'get':function(){return this[_0x8a2b('0x13')](_0x8a2b('0x22'))?this[_0x8a2b('0x13')](_0x8a2b('0x22'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x8a2b('0x4')]('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0x8a2b('0x19'),'no',_0x8a2b('0x23'))},'promiscredir':{'type':Sequelize[_0x8a2b('0x4')](_0x8a2b('0x19'),'no')},'useclientcode':{'type':Sequelize[_0x8a2b('0x4')]('yes','no')},'accountcode':{'type':Sequelize[_0x8a2b('0x24')](0xb)},'setvar':{'type':Sequelize[_0x8a2b('0x2')]},'callerid':{'type':Sequelize[_0x8a2b('0x2')],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0x8a2b('0x2')]},'callcounter':{'type':Sequelize[_0x8a2b('0x4')]('yes','no'),'defaultValue':_0x8a2b('0x19')},'busylevel':{'type':Sequelize[_0x8a2b('0x24')](0xb)},'allowoverlap':{'type':Sequelize[_0x8a2b('0x4')](_0x8a2b('0x19'),'no')},'allowsubscribe':{'type':Sequelize[_0x8a2b('0x4')]('yes','no')},'allowtransfer':{'type':Sequelize['ENUM'](_0x8a2b('0x19'),'no')},'ignoresdpversion':{'type':Sequelize[_0x8a2b('0x4')](_0x8a2b('0x19'),'no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize[_0x8a2b('0x2')]},'videosupport':{'type':Sequelize[_0x8a2b('0x4')]('yes','no',_0x8a2b('0x25')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x8a2b('0x24')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x8a2b('0x4')](_0x8a2b('0x19'),'no')},'mailbox':{'type':Sequelize[_0x8a2b('0x2')]},'session_timers':{'type':Sequelize['ENUM'](_0x8a2b('0x26'),_0x8a2b('0x27'),_0x8a2b('0x28'))},'session_expires':{'type':Sequelize[_0x8a2b('0x24')](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize[_0x8a2b('0x4')](_0x8a2b('0x29'),_0x8a2b('0x2a')),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x8a2b('0x2')]},'regexten':{'type':Sequelize[_0x8a2b('0x2')]},'fromdomain':{'type':Sequelize[_0x8a2b('0x2')]},'fromuser':{'type':Sequelize[_0x8a2b('0x2')]},'port':{'type':Sequelize[_0x8a2b('0x24')](0x5)},'qualify':{'type':Sequelize[_0x8a2b('0x4')](_0x8a2b('0x19'),'no'),'defaultValue':_0x8a2b('0x19')},'keepalive':{'type':Sequelize[_0x8a2b('0x24')](0xb)},'defaultip':{'type':Sequelize[_0x8a2b('0x2')]},'defaultuser':{'type':Sequelize[_0x8a2b('0x2')]},'rtptimeout':{'type':Sequelize[_0x8a2b('0x24')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x8a2b('0x24')](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize[_0x8a2b('0x4')](_0x8a2b('0x19'),'no',_0x8a2b('0x2b')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x8a2b('0x2')]},'callbackextension':{'type':Sequelize[_0x8a2b('0x2')]},'timert1':{'type':Sequelize[_0x8a2b('0x24')](0xb)},'timerb':{'type':Sequelize[_0x8a2b('0x24')](0xb)},'qualifyfreq':{'type':Sequelize[_0x8a2b('0x24')](0xb)},'contactpermit':{'type':Sequelize[_0x8a2b('0x2')]},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize[_0x8a2b('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0x8a2b('0x2')]},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize[_0x8a2b('0x24')](0xb)},'encryption':{'type':Sequelize[_0x8a2b('0x4')](_0x8a2b('0x19'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x8a2b('0x4')]('yes','no')},'force_avp':{'type':Sequelize['ENUM'](_0x8a2b('0x19'),'no')},'icesupport':{'type':Sequelize['ENUM'](_0x8a2b('0x19'),'no')},'dtlsenable':{'type':Sequelize[_0x8a2b('0x4')]('yes','no')},'dtlsverify':{'type':Sequelize['ENUM'](_0x8a2b('0x19'),'no','fingerprint','certificate')},'dtlsrekey':{'type':Sequelize[_0x8a2b('0x24')](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize[_0x8a2b('0x2')]},'dtlscipher':{'type':Sequelize[_0x8a2b('0x2')]},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize[_0x8a2b('0x2')]},'dtlssetup':{'type':Sequelize['ENUM'](_0x8a2b('0x2c'),'passive',_0x8a2b('0x2d')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x8a2b('0x2')]},'usereqphone':{'type':Sequelize[_0x8a2b('0x4')](_0x8a2b('0x19'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize[_0x8a2b('0x2')]},'call_limit':{'type':Sequelize[_0x8a2b('0x24')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x8a2b('0x4')](_0x8a2b('0x19'),'no')},'subscribemwi':{'type':Sequelize['ENUM']('yes','no')},'vmexten':{'type':Sequelize[_0x8a2b('0x2')]},'mohinterpret':{'type':Sequelize['STRING']},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x8a2b('0x2')]},'host':{'type':Sequelize[_0x8a2b('0x2')],'defaultValue':_0x8a2b('0x2e')},'canreinvite':{'type':Sequelize[_0x8a2b('0x4')](_0x8a2b('0x19'),'no',_0x8a2b('0x17'),_0x8a2b('0x2f'),'update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize[_0x8a2b('0x2')]},'active':{'type':Sequelize[_0x8a2b('0x30')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x8a2b('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 639de3b..bfef788 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 _0x6f0d=['server/files/templates/registry.ejs','utf8','render','writeFileSync','registry','Reload','chan_sip.so','user','UserProfileSection','autoAssociation','/etc/asterisk/sip_xcally_trunks.conf','/etc/asterisk/sip_xcally_registers.conf','destroy','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','http','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','get','Trunks','UserProfileResource','end','stack','name','send','index','map','Trunk','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','clone','rawAttributes','find','updatedAt','body','omit','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','root','server/files/templates/trunk.ejs','join'];(function(_0x145a29,_0xc8285b){var _0x2cceaf=function(_0x596e1e){while(--_0x596e1e){_0x145a29['push'](_0x145a29['shift']());}};_0x2cceaf(++_0xc8285b);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x4bd0c1,_0x44c2b5){_0x4bd0c1=_0x4bd0c1-0x0;var _0x964b91=_0x6f0d[_0x4bd0c1];return _0x964b91;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd6f0('0x0'));var zipdir=require(_0xd6f0('0x1'));var jsonpatch=require(_0xd6f0('0x2'));var rp=require(_0xd6f0('0x3'));var moment=require('moment');var BPromise=require(_0xd6f0('0x4'));var Mustache=require(_0xd6f0('0x5'));var util=require(_0xd6f0('0x6'));var path=require(_0xd6f0('0x7'));var sox=require(_0xd6f0('0x8'));var csv=require('to-csv');var ejs=require(_0xd6f0('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd6f0('0xa'));var squel=require(_0xd6f0('0xb'));var crypto=require(_0xd6f0('0xc'));var jsforce=require(_0xd6f0('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd6f0('0xe'));var Papa=require(_0xd6f0('0xf'));var Redis=require(_0xd6f0('0x10'));var authService=require(_0xd6f0('0x11'));var qs=require(_0xd6f0('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd6f0('0x13'));var logger=require(_0xd6f0('0x14'))(_0xd6f0('0x15'));var utils=require(_0xd6f0('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xd6f0('0x17'));var db=require(_0xd6f0('0x18'))['db'];var jayson=require(_0xd6f0('0x19'));var client=jayson[_0xd6f0('0x1a')][_0xd6f0('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x409549,_0x2bf5b8,_0x250999,_0x246dad){return new BPromise(function(_0x4ab979,_0x2b3f32){var _0x354846=_0x246dad||client;return _0x354846['request'](_0x409549,_0x250999)[_0xd6f0('0x1c')](function(_0x593abe){logger[_0xd6f0('0x1d')](_0xd6f0('0x1e'),_0x2bf5b8,_0xd6f0('0x1f'));logger[_0xd6f0('0x20')](_0xd6f0('0x21'),_0x2bf5b8,_0xd6f0('0x1f'),JSON[_0xd6f0('0x22')](_0x593abe));if(_0x593abe[_0xd6f0('0x23')]){if(_0x593abe[_0xd6f0('0x23')][_0xd6f0('0x24')]===0x1f4){logger[_0xd6f0('0x23')](_0xd6f0('0x1e'),_0x2bf5b8,_0x593abe[_0xd6f0('0x23')][_0xd6f0('0x25')]);return _0x2b3f32(_0x593abe[_0xd6f0('0x23')][_0xd6f0('0x25')]);}logger['error']('Trunk,\x20%s,\x20%s',_0x2bf5b8,_0x593abe[_0xd6f0('0x23')][_0xd6f0('0x25')]);return _0x4ab979(_0x593abe[_0xd6f0('0x23')]['message']);}else{logger[_0xd6f0('0x1d')](_0xd6f0('0x1e'),_0x2bf5b8,'request\x20sent');_0x4ab979(_0x593abe[_0xd6f0('0x26')]['message']);}})[_0xd6f0('0x27')](function(_0x1c9d90){logger['error'](_0xd6f0('0x1e'),_0x2bf5b8,_0x1c9d90);_0x2b3f32(_0x1c9d90);});});}function respondWithStatusCode(_0x45e99c,_0x5ea2dd){_0x5ea2dd=_0x5ea2dd||0xcc;return function(_0x3dbdc3){if(_0x3dbdc3){return _0x45e99c[_0xd6f0('0x28')](_0x5ea2dd);}return _0x45e99c[_0xd6f0('0x29')](_0x5ea2dd)['end']();};}function respondWithResult(_0x2ca8bb,_0x3dc166){_0x3dc166=_0x3dc166||0xc8;return function(_0x5ecb16){if(_0x5ecb16){return _0x2ca8bb[_0xd6f0('0x29')](_0x3dc166)['json'](_0x5ecb16);}};}function respondWithFilteredResult(_0x2042d5,_0x3fb5c3){return function(_0x1630dc){if(_0x1630dc){var _0x3c1bff=typeof _0x3fb5c3[_0xd6f0('0x2a')]===_0xd6f0('0x2b')&&typeof _0x3fb5c3[_0xd6f0('0x2c')]===_0xd6f0('0x2b');var _0x48975d=_0x1630dc[_0xd6f0('0x2d')];var _0x1982d3=_0x3c1bff?0x0:_0x3fb5c3['offset'];var _0x38a3e9=_0x3c1bff?_0x1630dc[_0xd6f0('0x2d')]:_0x3fb5c3[_0xd6f0('0x2a')]+_0x3fb5c3[_0xd6f0('0x2c')];var _0x1a3967;if(_0x38a3e9>=_0x48975d){_0x38a3e9=_0x48975d;_0x1a3967=0xc8;}else{_0x1a3967=0xce;}_0x2042d5[_0xd6f0('0x29')](_0x1a3967);return _0x2042d5[_0xd6f0('0x2e')](_0xd6f0('0x2f'),_0x1982d3+'-'+_0x38a3e9+'/'+_0x48975d)[_0xd6f0('0x30')](_0x1630dc);}return null;};}function patchUpdates(_0x43f72f){return function(_0x1dff9b){try{jsonpatch[_0xd6f0('0x31')](_0x1dff9b,_0x43f72f,!![]);}catch(_0x348529){return BPromise[_0xd6f0('0x32')](_0x348529);}return _0x1dff9b[_0xd6f0('0x33')]();};}function saveUpdates(_0x2d7c90,_0x31c493){return function(_0x376890){if(_0x376890){return _0x376890[_0xd6f0('0x34')](_0x2d7c90)[_0xd6f0('0x1c')](function(_0x3906ca){return _0x3906ca;});}return null;};}function removeEntity(_0x26ab29,_0x4a8ebe){return function(_0x11124c){if(_0x11124c){return _0x11124c['destroy']()['then'](function(){var _0x43d588=_0x11124c[_0xd6f0('0x35')]({'plain':!![]});var _0x12a6fa=_0xd6f0('0x36');return db[_0xd6f0('0x37')]['destroy']({'where':{'type':_0x12a6fa,'resourceId':_0x43d588['id']}})[_0xd6f0('0x1c')](function(){return _0x11124c;});})['then'](function(){_0x26ab29[_0xd6f0('0x29')](0xcc)[_0xd6f0('0x38')]();});}};}function handleEntityNotFound(_0x42c01a,_0x1eecf0){return function(_0x518751){if(!_0x518751){_0x42c01a['sendStatus'](0x194);}return _0x518751;};}function handleError(_0x47b33d,_0x3b6463){_0x3b6463=_0x3b6463||0x1f4;return function(_0xe2958d){logger['error'](_0xe2958d[_0xd6f0('0x39')]);if(_0xe2958d['name']){delete _0xe2958d[_0xd6f0('0x3a')];}_0x47b33d[_0xd6f0('0x29')](_0x3b6463)[_0xd6f0('0x3b')](_0xe2958d);};}exports[_0xd6f0('0x3c')]=function(_0x451834,_0x3d1280){var _0x6b44fa={},_0x4fd4db={},_0x52203d={'count':0x0,'rows':[]};var _0x162537=_[_0xd6f0('0x3d')](db[_0xd6f0('0x3e')]['rawAttributes'],function(_0x59f905){return{'name':_0x59f905[_0xd6f0('0x3f')],'type':_0x59f905[_0xd6f0('0x40')][_0xd6f0('0x41')]};});_0x4fd4db[_0xd6f0('0x42')]=_[_0xd6f0('0x3d')](_0x162537,_0xd6f0('0x3a'));_0x4fd4db[_0xd6f0('0x43')]=_[_0xd6f0('0x44')](_0x451834['query']);_0x4fd4db[_0xd6f0('0x45')]=_[_0xd6f0('0x46')](_0x4fd4db[_0xd6f0('0x42')],_0x4fd4db[_0xd6f0('0x43')]);_0x6b44fa['attributes']=_[_0xd6f0('0x46')](_0x4fd4db[_0xd6f0('0x42')],qs[_0xd6f0('0x47')](_0x451834[_0xd6f0('0x43')][_0xd6f0('0x47')]));_0x6b44fa['attributes']=_0x6b44fa[_0xd6f0('0x48')][_0xd6f0('0x49')]?_0x6b44fa[_0xd6f0('0x48')]:_0x4fd4db['model'];if(!_0x451834[_0xd6f0('0x43')][_0xd6f0('0x4a')]('nolimit')){_0x6b44fa['limit']=qs[_0xd6f0('0x2c')](_0x451834[_0xd6f0('0x43')][_0xd6f0('0x2c')]);_0x6b44fa['offset']=qs[_0xd6f0('0x2a')](_0x451834[_0xd6f0('0x43')]['offset']);}_0x6b44fa[_0xd6f0('0x4b')]=qs[_0xd6f0('0x4c')](_0x451834[_0xd6f0('0x43')][_0xd6f0('0x4c')]);_0x6b44fa['where']=qs[_0xd6f0('0x45')](_[_0xd6f0('0x4d')](_0x451834[_0xd6f0('0x43')],_0x4fd4db[_0xd6f0('0x45')]),_0x162537);if(_0x451834[_0xd6f0('0x43')][_0xd6f0('0x4e')]){_0x6b44fa[_0xd6f0('0x4f')]=_[_0xd6f0('0x50')](_0x6b44fa['where'],{'$or':_[_0xd6f0('0x3d')](_0x162537,function(_0x3d42ca){if(_0x3d42ca['type']!==_0xd6f0('0x51')){var _0x39ca69={};_0x39ca69[_0x3d42ca[_0xd6f0('0x3a')]]={'$like':'%'+_0x451834[_0xd6f0('0x43')]['filter']+'%'};return _0x39ca69;}})});}_0x6b44fa=_[_0xd6f0('0x50')]({},_0x6b44fa,_0x451834[_0xd6f0('0x52')]);var _0x494542={'where':_0x6b44fa['where']};return db[_0xd6f0('0x3e')]['count'](_0x494542)[_0xd6f0('0x1c')](function(_0x61b354){_0x52203d[_0xd6f0('0x2d')]=_0x61b354;if(_0x451834['query'][_0xd6f0('0x53')]){_0x6b44fa[_0xd6f0('0x54')]=[{'all':!![]}];}return db[_0xd6f0('0x3e')][_0xd6f0('0x55')](_0x6b44fa);})[_0xd6f0('0x1c')](function(_0x4c42ce){_0x52203d[_0xd6f0('0x56')]=_0x4c42ce;return _0x52203d;})['then'](respondWithFilteredResult(_0x3d1280,_0x6b44fa))[_0xd6f0('0x27')](handleError(_0x3d1280,null));};exports[_0xd6f0('0x57')]=function(_0x2eb338,_0x1dc320){var _0x554e37={'raw':![],'where':{'id':_0x2eb338[_0xd6f0('0x58')]['id']}},_0x5ceb6b={};_0x5ceb6b[_0xd6f0('0x42')]=_['keys'](db[_0xd6f0('0x3e')]['rawAttributes']);_0x5ceb6b[_0xd6f0('0x43')]=_[_0xd6f0('0x44')](_0x2eb338[_0xd6f0('0x43')]);_0x5ceb6b[_0xd6f0('0x45')]=_[_0xd6f0('0x46')](_0x5ceb6b['model'],_0x5ceb6b[_0xd6f0('0x43')]);_0x554e37[_0xd6f0('0x48')]=_[_0xd6f0('0x46')](_0x5ceb6b[_0xd6f0('0x42')],qs[_0xd6f0('0x47')](_0x2eb338[_0xd6f0('0x43')][_0xd6f0('0x47')]));_0x554e37[_0xd6f0('0x48')]=_0x554e37['attributes'][_0xd6f0('0x49')]?_0x554e37[_0xd6f0('0x48')]:_0x5ceb6b[_0xd6f0('0x42')];if(_0x2eb338[_0xd6f0('0x43')][_0xd6f0('0x53')]){_0x554e37[_0xd6f0('0x54')]=[{'all':!![]}];}_0x554e37=_[_0xd6f0('0x50')]({},_0x554e37,_0x2eb338[_0xd6f0('0x52')]);return db[_0xd6f0('0x3e')]['find'](_0x554e37)[_0xd6f0('0x1c')](handleEntityNotFound(_0x1dc320,null))['then'](respondWithResult(_0x1dc320,null))['catch'](handleError(_0x1dc320,null));};exports[_0xd6f0('0x59')]=function(_0x55fd25,_0x539ef1){var _0x28c3c4={'where':{'id':_0x55fd25[_0xd6f0('0x58')]['id']}},_0x2d39a2={};_0x2d39a2['model']=_[_0xd6f0('0x44')](db[_0xd6f0('0x3e')][_0xd6f0('0x5a')]);_0x28c3c4['attributes']=_[_0xd6f0('0x46')](_0x2d39a2[_0xd6f0('0x42')],qs['fields'](_0x55fd25[_0xd6f0('0x43')][_0xd6f0('0x47')]));_0x28c3c4['attributes']=_0x28c3c4[_0xd6f0('0x48')][_0xd6f0('0x49')]?_0x28c3c4[_0xd6f0('0x48')]:_0x2d39a2[_0xd6f0('0x42')];if(_0x55fd25[_0xd6f0('0x43')]['includeAll']){_0x28c3c4[_0xd6f0('0x54')]=[{'all':!![]}];}_0x28c3c4=_[_0xd6f0('0x50')]({},_0x28c3c4,_0x55fd25['options']);return db[_0xd6f0('0x3e')][_0xd6f0('0x5b')](_0x28c3c4)[_0xd6f0('0x1c')](handleEntityNotFound(_0x539ef1,null))['then'](function(_0x229f19){if(_0x229f19){var _0x5d75fa=_0x229f19['get']({'plain':!![]});_0x5d75fa=qs['omit'](_0x5d75fa,['id','createdAt',_0xd6f0('0x5c')]);_0x55fd25[_0xd6f0('0x5d')]=_[_0xd6f0('0x5e')](_0x55fd25[_0xd6f0('0x5d')],['id','createdAt',_0xd6f0('0x5c')]);return db['Trunk'][_0xd6f0('0x5f')](_[_0xd6f0('0x50')](_0x5d75fa,_0x55fd25[_0xd6f0('0x5d')]),{'include':_0x55fd25['query'][_0xd6f0('0x53')]?[{'all':!![]}]:undefined})[_0xd6f0('0x1c')](function(_0x269dd7){var _0x705eb=_0x55fd25['user'][_0xd6f0('0x35')]({'plain':!![]});if(!_0x705eb)throw new Error(_0xd6f0('0x60'));if(_0x705eb[_0xd6f0('0x61')]==='user'){var _0x5bc4e7=_0x269dd7[_0xd6f0('0x35')]({'plain':!![]});var _0x1fee47=_0xd6f0('0x36');return db['UserProfileSection'][_0xd6f0('0x5b')]({'where':{'name':_0x1fee47,'userProfileId':_0x705eb[_0xd6f0('0x62')]},'raw':!![]})[_0xd6f0('0x1c')](function(_0x282e9b){if(_0x282e9b&&_0x282e9b['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x5bc4e7['name'],'resourceId':_0x5bc4e7['id'],'type':_0x282e9b[_0xd6f0('0x3a')],'sectionId':_0x282e9b['id']},{})[_0xd6f0('0x1c')](function(){return _0x269dd7;});}else{return _0x269dd7;}})[_0xd6f0('0x27')](function(_0x30cd81){logger[_0xd6f0('0x23')](_0xd6f0('0x63'),_0x30cd81);throw _0x30cd81;});}return _0x269dd7;});}})[_0xd6f0('0x1c')](respondWithResult(_0x539ef1,0xc9))[_0xd6f0('0x27')](handleError(_0x539ef1,null));};exports[_0xd6f0('0x5f')]=function(_0x5ad146,_0x55f96e,_0x1b9728){var _0x5af4f6;return db[_0xd6f0('0x3e')][_0xd6f0('0x5f')](_0x5ad146[_0xd6f0('0x5d')],{'raw':!![]})[_0xd6f0('0x1c')](function(_0x14384f){_0x5af4f6=_0x14384f;return db[_0xd6f0('0x3e')][_0xd6f0('0x55')]({'raw':!![]});})['then'](function(_0x3c8a3e){var _0x318a68=fs[_0xd6f0('0x64')](path['join'](config[_0xd6f0('0x65')],_0xd6f0('0x66')),'utf8');var _0xad50ac=fs[_0xd6f0('0x64')](path[_0xd6f0('0x67')](config[_0xd6f0('0x65')],_0xd6f0('0x68')),_0xd6f0('0x69'));var _0x1c6140=ejs[_0xd6f0('0x6a')](_0x318a68,{'trunks':_0x3c8a3e||[]});fs[_0xd6f0('0x6b')]('/etc/asterisk/sip_xcally_trunks.conf',_0x1c6140);if(_0x5af4f6[_0xd6f0('0x6c')]){var _0x205b6a=ejs[_0xd6f0('0x6a')](_0xad50ac,{'trunks':_0x3c8a3e||[]});fs[_0xd6f0('0x6b')]('/etc/asterisk/sip_xcally_registers.conf',_0x205b6a);}})[_0xd6f0('0x1c')](function(){return respondWithRpcPromise(_0xd6f0('0x6d'),_0xd6f0('0x5f'),{'module':_0xd6f0('0x6e')});})[_0xd6f0('0x1c')](function(){var _0x12e0e5=_0x5ad146[_0xd6f0('0x6f')][_0xd6f0('0x35')]({'plain':!![]});if(!_0x12e0e5)throw new Error(_0xd6f0('0x60'));if(_0x12e0e5[_0xd6f0('0x61')]==='user'){var _0x440d5c=_0x5af4f6[_0xd6f0('0x35')]({'plain':!![]});return db[_0xd6f0('0x70')]['find']({'where':{'name':_0xd6f0('0x36'),'userProfileId':_0x12e0e5[_0xd6f0('0x62')]},'raw':!![]})[_0xd6f0('0x1c')](function(_0x406bc7){if(_0x406bc7&&_0x406bc7[_0xd6f0('0x71')]===0x0){return db[_0xd6f0('0x37')][_0xd6f0('0x5f')]({'name':_0x440d5c[_0xd6f0('0x3a')],'resourceId':_0x440d5c['id'],'type':_0x406bc7[_0xd6f0('0x3a')],'sectionId':_0x406bc7['id']},{})[_0xd6f0('0x1c')](function(){return _0x5af4f6;});}else{return _0x5af4f6;}})[_0xd6f0('0x27')](function(_0x5b3155){logger['error'](_0xd6f0('0x63'),_0x5b3155);throw _0x5b3155;});}return _0x5af4f6;})[_0xd6f0('0x1c')](respondWithResult(_0x55f96e,0xc9))[_0xd6f0('0x27')](handleError(_0x55f96e,null));};exports[_0xd6f0('0x34')]=function(_0x1da442,_0x5a781b,_0x15143a){var _0x2d38e6;return db['Trunk'][_0xd6f0('0x5b')]({'where':{'id':_0x1da442['params']['id']}})[_0xd6f0('0x1c')](handleEntityNotFound(_0x5a781b,null))[_0xd6f0('0x1c')](saveUpdates(_0x1da442[_0xd6f0('0x5d')],null))[_0xd6f0('0x1c')](function(_0x391c2a){if(_0x391c2a){_0x2d38e6=_0x391c2a;return db['Trunk']['findAll']({'raw':!![]});}})[_0xd6f0('0x1c')](function(_0x17b320){if(_0x17b320){var _0x484124=fs[_0xd6f0('0x64')](path['join'](config['root'],_0xd6f0('0x66')),'utf8');var _0x5dc1c7=fs['readFileSync'](path['join'](config[_0xd6f0('0x65')],_0xd6f0('0x68')),_0xd6f0('0x69'));var _0xcfed18=ejs[_0xd6f0('0x6a')](_0x484124,{'trunks':_0x17b320||[]});fs[_0xd6f0('0x6b')](_0xd6f0('0x72'),_0xcfed18);var _0x381f88=ejs[_0xd6f0('0x6a')](_0x5dc1c7,{'trunks':_0x17b320||[]});fs['writeFileSync'](_0xd6f0('0x73'),_0x381f88);return respondWithRpcPromise('Reload','update',{'module':_0xd6f0('0x6e')});}return null;})[_0xd6f0('0x1c')](function(_0x397f2c){if(_0x397f2c){return _0x2d38e6;}})['then'](respondWithResult(_0x5a781b,null))[_0xd6f0('0x27')](handleError(_0x5a781b,null));};exports[_0xd6f0('0x74')]=function(_0xc0585c,_0xf7ade1,_0x41e738){var _0x202e37;return db[_0xd6f0('0x3e')][_0xd6f0('0x5b')]({'where':{'id':_0xc0585c['params']['id']}})[_0xd6f0('0x1c')](handleEntityNotFound(_0xf7ade1,null))[_0xd6f0('0x1c')](removeEntity(_0xf7ade1,null))['then'](function(){return db[_0xd6f0('0x3e')][_0xd6f0('0x55')]({'raw':!![]});})[_0xd6f0('0x1c')](function(_0x175ba6){var _0x403698=fs[_0xd6f0('0x64')](path[_0xd6f0('0x67')](config['root'],_0xd6f0('0x66')),_0xd6f0('0x69'));var _0x5c3659=fs['readFileSync'](path['join'](config['root'],_0xd6f0('0x68')),_0xd6f0('0x69'));var _0x2fdd59=ejs[_0xd6f0('0x6a')](_0x403698,{'trunks':_0x175ba6});var _0x427b95=ejs[_0xd6f0('0x6a')](_0x5c3659,{'trunks':_0x175ba6});fs['writeFileSync'](_0xd6f0('0x72'),_0x2fdd59);fs[_0xd6f0('0x6b')](_0xd6f0('0x73'),_0x427b95);return respondWithRpcPromise(_0xd6f0('0x6d'),'destroy',{'module':_0xd6f0('0x6e')});})['catch'](handleError(_0xf7ade1,null));}; \ No newline at end of file +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(_0x48c5f3,_0x12e63c){var _0x63f3a4=function(_0x4d0e89){while(--_0x4d0e89){_0x48c5f3['push'](_0x48c5f3['shift']());}};_0x63f3a4(++_0x12e63c);}(_0x24ca,0x1bc));var _0xa24c=function(_0x210603,_0x4adbac){_0x210603=_0x210603-0x0;var _0x1bcb7d=_0x24ca[_0x210603];return _0x1bcb7d;};'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 diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 874e112..006afbc 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 _0x62b3=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','Trunk','tools_trunks','lodash'];(function(_0x1dec55,_0x3bf5d0){var _0x40f7aa=function(_0x322836){while(--_0x322836){_0x1dec55['push'](_0x1dec55['shift']());}};_0x40f7aa(++_0x3bf5d0);}(_0x62b3,0x107));var _0x362b=function(_0x20fc23,_0x30f0c9){_0x20fc23=_0x20fc23-0x0;var _0x19a0ca=_0x62b3[_0x20fc23];return _0x19a0ca;};'use strict';var _=require(_0x362b('0x0'));var util=require('util');var logger=require(_0x362b('0x1'))(_0x362b('0x2'));var moment=require(_0x362b('0x3'));var BPromise=require(_0x362b('0x4'));var rp=require(_0x362b('0x5'));var fs=require('fs');var path=require(_0x362b('0x6'));var rimraf=require(_0x362b('0x7'));var config=require(_0x362b('0x8'));var attributes=require('./trunk.attributes');module[_0x362b('0x9')]=function(_0x3d6711,_0x5e8929){return _0x3d6711['define'](_0x362b('0xa'),attributes,{'tableName':_0x362b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x36fe=['./trunk.attributes','define','tools_trunks','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0x36fe,0xb3));var _0xe36f=function(_0x3ad7ad,_0x291a8d){_0x3ad7ad=_0x3ad7ad-0x0;var _0x225a60=_0x36fe[_0x3ad7ad];return _0x225a60;};'use strict';var _=require(_0xe36f('0x0'));var util=require(_0xe36f('0x1'));var logger=require(_0xe36f('0x2'))('api');var moment=require(_0xe36f('0x3'));var BPromise=require(_0xe36f('0x4'));var rp=require(_0xe36f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe36f('0x6'));var config=require(_0xe36f('0x7'));var attributes=require(_0xe36f('0x8'));module['exports']=function(_0x29d4df,_0x3b96f0){return _0x29d4df[_0xe36f('0x9')]('Trunk',attributes,{'tableName':_0xe36f('0xa'),'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 6109c44..6c06406 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 _0xa8b4=['ShowTrunk','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','GetTrunk','Trunk','findAll','options','raw','where','limit','map','include','model','attributes'];(function(_0x565e8d,_0x2c8682){var _0x44ef68=function(_0x120125){while(--_0x120125){_0x565e8d['push'](_0x565e8d['shift']());}};_0x44ef68(++_0x2c8682);}(_0xa8b4,0xc0));var _0x4a8b=function(_0x223ed9,_0x4f912b){_0x223ed9=_0x223ed9-0x0;var _0x26b683=_0xa8b4[_0x223ed9];return _0x26b683;};'use strict';var _=require(_0x4a8b('0x0'));var util=require(_0x4a8b('0x1'));var moment=require(_0x4a8b('0x2'));var BPromise=require(_0x4a8b('0x3'));var rs=require(_0x4a8b('0x4'));var fs=require('fs');var Redis=require(_0x4a8b('0x5'));var db=require(_0x4a8b('0x6'))['db'];var utils=require(_0x4a8b('0x7'));var logger=require(_0x4a8b('0x8'))('rpc');var config=require(_0x4a8b('0x9'));var jayson=require(_0x4a8b('0xa'));var client=jayson[_0x4a8b('0xb')][_0x4a8b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1cb7e4,_0x2e73c2,_0x5470ad){return new BPromise(function(_0x170f59,_0x47e3a9){return client[_0x4a8b('0xd')](_0x1cb7e4,_0x5470ad)[_0x4a8b('0xe')](function(_0x4177d3){logger['info'](_0x4a8b('0xf'),_0x2e73c2,_0x4a8b('0x10'));logger[_0x4a8b('0x11')](_0x4a8b('0x12'),_0x2e73c2,_0x4a8b('0x10'),JSON[_0x4a8b('0x13')](_0x4177d3));if(_0x4177d3[_0x4a8b('0x14')]){if(_0x4177d3[_0x4a8b('0x14')]['code']===0x1f4){logger[_0x4a8b('0x14')]('Trunk,\x20%s,\x20%s',_0x2e73c2,_0x4177d3['error']['message']);return _0x47e3a9(_0x4177d3[_0x4a8b('0x14')][_0x4a8b('0x15')]);}logger[_0x4a8b('0x14')]('Trunk,\x20%s,\x20%s',_0x2e73c2,_0x4177d3[_0x4a8b('0x14')][_0x4a8b('0x15')]);return _0x170f59(_0x4177d3[_0x4a8b('0x14')][_0x4a8b('0x15')]);}else{logger[_0x4a8b('0x16')]('Trunk,\x20%s,\x20%s',_0x2e73c2,_0x4a8b('0x10'));_0x170f59(_0x4177d3[_0x4a8b('0x17')][_0x4a8b('0x15')]);}})[_0x4a8b('0x18')](function(_0x2807e3){logger[_0x4a8b('0x14')](_0x4a8b('0xf'),_0x2e73c2,_0x2807e3);_0x47e3a9(_0x2807e3);});});}exports[_0x4a8b('0x19')]=function(_0x58cb67){var _0x55a7d6=this;return new Promise(function(_0x2752d4,_0x130efd){return db[_0x4a8b('0x1a')][_0x4a8b('0x1b')]({'raw':_0x58cb67[_0x4a8b('0x1c')]?_0x58cb67[_0x4a8b('0x1c')][_0x4a8b('0x1d')]===undefined?!![]:![]:!![],'where':_0x58cb67[_0x4a8b('0x1c')]?_0x58cb67[_0x4a8b('0x1c')][_0x4a8b('0x1e')]||null:null,'attributes':_0x58cb67['options']?_0x58cb67['options']['attributes']||null:null,'limit':_0x58cb67['options']?_0x58cb67[_0x4a8b('0x1c')][_0x4a8b('0x1f')]||null:null,'include':_0x58cb67[_0x4a8b('0x1c')]?_0x58cb67['options']['include']?_[_0x4a8b('0x20')](_0x58cb67[_0x4a8b('0x1c')][_0x4a8b('0x21')],function(_0x23e07c){return{'model':db[_0x23e07c[_0x4a8b('0x22')]],'as':_0x23e07c['as'],'attributes':_0x23e07c[_0x4a8b('0x23')],'include':_0x23e07c[_0x4a8b('0x21')]?_[_0x4a8b('0x20')](_0x23e07c['include'],function(_0x140c8a){return{'model':db[_0x140c8a[_0x4a8b('0x22')]],'as':_0x140c8a['as'],'attributes':_0x140c8a[_0x4a8b('0x23')],'include':_0x140c8a[_0x4a8b('0x21')]?_[_0x4a8b('0x20')](_0x140c8a[_0x4a8b('0x21')],function(_0x1b81e9){return{'model':db[_0x1b81e9[_0x4a8b('0x22')]],'as':_0x1b81e9['as'],'attributes':_0x1b81e9[_0x4a8b('0x23')]};}):[]};}):[]};}):[]:[]})[_0x4a8b('0xe')](function(_0x2c1542){logger[_0x4a8b('0x16')](_0x4a8b('0x19'),_0x58cb67);logger['debug'](_0x4a8b('0x19'),_0x58cb67,JSON[_0x4a8b('0x13')](_0x2c1542));_0x2752d4(_0x2c1542);})[_0x4a8b('0x18')](function(_0x20cd2e){logger[_0x4a8b('0x14')]('GetTrunk',_0x20cd2e[_0x4a8b('0x15')],_0x58cb67);_0x130efd(_0x55a7d6[_0x4a8b('0x14')](0x1f4,_0x20cd2e[_0x4a8b('0x15')]));});});};exports[_0x4a8b('0x24')]=function(_0x248412){var _0x3c2db5=this;return new Promise(function(_0x3a1285,_0x47ff29){return db[_0x4a8b('0x1a')][_0x4a8b('0x25')]({'raw':_0x248412['options']?_0x248412['options'][_0x4a8b('0x1d')]===undefined?!![]:![]:!![],'where':_0x248412[_0x4a8b('0x1c')]?_0x248412[_0x4a8b('0x1c')][_0x4a8b('0x1e')]||null:null,'attributes':_0x248412['options']?_0x248412[_0x4a8b('0x1c')][_0x4a8b('0x23')]||null:null,'include':_0x248412[_0x4a8b('0x1c')]?_0x248412[_0x4a8b('0x1c')][_0x4a8b('0x21')]?_[_0x4a8b('0x20')](_0x248412[_0x4a8b('0x1c')][_0x4a8b('0x21')],function(_0x1cee7a){return{'model':db[_0x1cee7a['model']],'as':_0x1cee7a['as'],'attributes':_0x1cee7a[_0x4a8b('0x23')],'include':_0x1cee7a['include']?_[_0x4a8b('0x20')](_0x1cee7a[_0x4a8b('0x21')],function(_0x285a7a){return{'model':db[_0x285a7a[_0x4a8b('0x22')]],'as':_0x285a7a['as'],'attributes':_0x285a7a[_0x4a8b('0x23')],'include':_0x285a7a[_0x4a8b('0x21')]?_[_0x4a8b('0x20')](_0x285a7a['include'],function(_0x1d37f5){return{'model':db[_0x1d37f5[_0x4a8b('0x22')]],'as':_0x1d37f5['as'],'attributes':_0x1d37f5[_0x4a8b('0x23')]};}):[]};}):[]};}):[]:[]})[_0x4a8b('0xe')](function(_0x43b6db){logger[_0x4a8b('0x16')](_0x4a8b('0x24'),_0x248412);logger[_0x4a8b('0x11')](_0x4a8b('0x24'),_0x248412,JSON[_0x4a8b('0x13')](_0x43b6db));_0x3a1285(_0x43b6db);})[_0x4a8b('0x18')](function(_0x3ec30f){logger[_0x4a8b('0x14')]('ShowTrunk',_0x3ec30f['message'],_0x248412);_0x47ff29(_0x3c2db5['error'](0x1f4,_0x3ec30f['message']));});});}; \ No newline at end of file +var _0x90dd=['../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetTrunk','findAll','options','where','attributes','map','model','include','ShowTrunk','Trunk','raw','moment','bluebird'];(function(_0x2fd160,_0x53c0d6){var _0x5c2031=function(_0x8ecfa5){while(--_0x8ecfa5){_0x2fd160['push'](_0x2fd160['shift']());}};_0x5c2031(++_0x53c0d6);}(_0x90dd,0x13d));var _0xd90d=function(_0x4b8193,_0x27b1b4){_0x4b8193=_0x4b8193-0x0;var _0x4872ef=_0x90dd[_0x4b8193];return _0x4872ef;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd90d('0x0'));var BPromise=require(_0xd90d('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xd90d('0x2'));var logger=require(_0xd90d('0x3'))(_0xd90d('0x4'));var config=require(_0xd90d('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd90d('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x3c0b63,_0x1ce53d,_0x422e95){return new BPromise(function(_0x5ae4da,_0x207d30){return client['request'](_0x3c0b63,_0x422e95)[_0xd90d('0x7')](function(_0x68559f){logger[_0xd90d('0x8')](_0xd90d('0x9'),_0x1ce53d,'request\x20sent');logger[_0xd90d('0xa')](_0xd90d('0xb'),_0x1ce53d,_0xd90d('0xc'),JSON[_0xd90d('0xd')](_0x68559f));if(_0x68559f['error']){if(_0x68559f[_0xd90d('0xe')][_0xd90d('0xf')]===0x1f4){logger[_0xd90d('0xe')](_0xd90d('0x9'),_0x1ce53d,_0x68559f[_0xd90d('0xe')][_0xd90d('0x10')]);return _0x207d30(_0x68559f[_0xd90d('0xe')][_0xd90d('0x10')]);}logger['error'](_0xd90d('0x9'),_0x1ce53d,_0x68559f[_0xd90d('0xe')][_0xd90d('0x10')]);return _0x5ae4da(_0x68559f[_0xd90d('0xe')][_0xd90d('0x10')]);}else{logger['info'](_0xd90d('0x9'),_0x1ce53d,_0xd90d('0xc'));_0x5ae4da(_0x68559f['result'][_0xd90d('0x10')]);}})[_0xd90d('0x11')](function(_0x751644){logger[_0xd90d('0xe')](_0xd90d('0x9'),_0x1ce53d,_0x751644);_0x207d30(_0x751644);});});}exports[_0xd90d('0x12')]=function(_0x4a1703){var _0x72006a=this;return new Promise(function(_0x1deca8,_0x2a6929){return db['Trunk'][_0xd90d('0x13')]({'raw':_0x4a1703[_0xd90d('0x14')]?_0x4a1703[_0xd90d('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x4a1703[_0xd90d('0x14')]?_0x4a1703[_0xd90d('0x14')][_0xd90d('0x15')]||null:null,'attributes':_0x4a1703['options']?_0x4a1703[_0xd90d('0x14')][_0xd90d('0x16')]||null:null,'limit':_0x4a1703[_0xd90d('0x14')]?_0x4a1703['options']['limit']||null:null,'include':_0x4a1703[_0xd90d('0x14')]?_0x4a1703[_0xd90d('0x14')]['include']?_[_0xd90d('0x17')](_0x4a1703[_0xd90d('0x14')]['include'],function(_0x11e9bf){return{'model':db[_0x11e9bf[_0xd90d('0x18')]],'as':_0x11e9bf['as'],'attributes':_0x11e9bf[_0xd90d('0x16')],'include':_0x11e9bf[_0xd90d('0x19')]?_[_0xd90d('0x17')](_0x11e9bf['include'],function(_0x887ae5){return{'model':db[_0x887ae5['model']],'as':_0x887ae5['as'],'attributes':_0x887ae5[_0xd90d('0x16')],'include':_0x887ae5['include']?_['map'](_0x887ae5[_0xd90d('0x19')],function(_0x5efdc6){return{'model':db[_0x5efdc6[_0xd90d('0x18')]],'as':_0x5efdc6['as'],'attributes':_0x5efdc6[_0xd90d('0x16')]};}):[]};}):[]};}):[]:[]})[_0xd90d('0x7')](function(_0x5e3cbc){logger[_0xd90d('0x8')](_0xd90d('0x12'),_0x4a1703);logger[_0xd90d('0xa')]('GetTrunk',_0x4a1703,JSON['stringify'](_0x5e3cbc));_0x1deca8(_0x5e3cbc);})[_0xd90d('0x11')](function(_0x2640aa){logger[_0xd90d('0xe')]('GetTrunk',_0x2640aa[_0xd90d('0x10')],_0x4a1703);_0x2a6929(_0x72006a['error'](0x1f4,_0x2640aa[_0xd90d('0x10')]));});});};exports[_0xd90d('0x1a')]=function(_0x5182bf){var _0x486c41=this;return new Promise(function(_0x3e091f,_0x4efcf8){return db[_0xd90d('0x1b')]['find']({'raw':_0x5182bf[_0xd90d('0x14')]?_0x5182bf[_0xd90d('0x14')][_0xd90d('0x1c')]===undefined?!![]:![]:!![],'where':_0x5182bf[_0xd90d('0x14')]?_0x5182bf[_0xd90d('0x14')][_0xd90d('0x15')]||null:null,'attributes':_0x5182bf[_0xd90d('0x14')]?_0x5182bf[_0xd90d('0x14')][_0xd90d('0x16')]||null:null,'include':_0x5182bf[_0xd90d('0x14')]?_0x5182bf[_0xd90d('0x14')]['include']?_['map'](_0x5182bf[_0xd90d('0x14')][_0xd90d('0x19')],function(_0x435a8f){return{'model':db[_0x435a8f['model']],'as':_0x435a8f['as'],'attributes':_0x435a8f['attributes'],'include':_0x435a8f[_0xd90d('0x19')]?_[_0xd90d('0x17')](_0x435a8f[_0xd90d('0x19')],function(_0x4353f0){return{'model':db[_0x4353f0['model']],'as':_0x4353f0['as'],'attributes':_0x4353f0['attributes'],'include':_0x4353f0['include']?_['map'](_0x4353f0[_0xd90d('0x19')],function(_0x5a994d){return{'model':db[_0x5a994d['model']],'as':_0x5a994d['as'],'attributes':_0x5a994d[_0xd90d('0x16')]};}):[]};}):[]};}):[]:[]})[_0xd90d('0x7')](function(_0x120b7f){logger[_0xd90d('0x8')](_0xd90d('0x1a'),_0x5182bf);logger[_0xd90d('0xa')](_0xd90d('0x1a'),_0x5182bf,JSON[_0xd90d('0xd')](_0x120b7f));_0x3e091f(_0x120b7f);})[_0xd90d('0x11')](function(_0x502f84){logger[_0xd90d('0xe')]('ShowTrunk',_0x502f84[_0xd90d('0x10')],_0x5182bf);_0x4efcf8(_0x486c41[_0xd90d('0xe')](0x1f4,_0x502f84[_0xd90d('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index 481ca50..8c6d2e7 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 _0x7fd9=['/:id','isAuthenticated','express','Router','./user-setting.controller','put'];(function(_0x367361,_0x311488){var _0x195d2d=function(_0x2b20a4){while(--_0x2b20a4){_0x367361['push'](_0x367361['shift']());}};_0x195d2d(++_0x311488);}(_0x7fd9,0x1ee));var _0x97fd=function(_0x2c7516,_0x2ca7f1){_0x2c7516=_0x2c7516-0x0;var _0x1d76a2=_0x7fd9[_0x2c7516];return _0x1d76a2;};'use strict';var express=require(_0x97fd('0x0'));var router=express[_0x97fd('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x97fd('0x2'));router[_0x97fd('0x3')](_0x97fd('0x4'),auth[_0x97fd('0x5')](),controller['update']);module['exports']=router; \ No newline at end of file +var _0x5167=['../../components/auth/service','./user-setting.controller','put','/:id','update','exports','express','Router'];(function(_0x2d9746,_0x23ec17){var _0x1f9b51=function(_0x2afb38){while(--_0x2afb38){_0x2d9746['push'](_0x2d9746['shift']());}};_0x1f9b51(++_0x23ec17);}(_0x5167,0x18e));var _0x7516=function(_0x5c7a3e,_0x56db85){_0x5c7a3e=_0x5c7a3e-0x0;var _0x1c4118=_0x5167[_0x5c7a3e];return _0x1c4118;};'use strict';var express=require(_0x7516('0x0'));var router=express[_0x7516('0x1')]();var auth=require(_0x7516('0x2'));var controller=require(_0x7516('0x3'));router[_0x7516('0x4')](_0x7516('0x5'),auth['isAuthenticated'](),controller[_0x7516('0x6')]);module[_0x7516('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 87e50dd..3081845 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 _0x52e8=['BOOLEAN','TEXT','DATE','INTEGER','error','warning','info','debug'];(function(_0x5ecadc,_0x1cf9f1){var _0x565037=function(_0x22908b){while(--_0x22908b){_0x5ecadc['push'](_0x5ecadc['shift']());}};_0x565037(++_0x1cf9f1);}(_0x52e8,0x1e4));var _0x852e=function(_0x543242,_0xeac9fd){_0x543242=_0x543242-0x0;var _0x4c99b6=_0x52e8[_0x543242];return _0x4c99b6;};'use strict';var Sequelize=require('sequelize');const CLIENT_SIDE_LOG_LEVELS=[_0x852e('0x0'),_0x852e('0x1'),_0x852e('0x2'),_0x852e('0x3')];module['exports']={'clientSideLoggingLevel':{'type':Sequelize['ENUM'](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x852e('0x0'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x852e('0x4')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0x852e('0x5')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x852e('0x6')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x852e('0x7')],'unique':'UserId'}}; \ No newline at end of file +var _0xa6aa=['ENUM','BOOLEAN','INTEGER','UserId','sequelize','error','info','debug','exports'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa6aa,0x1c6));var _0xaa6a=function(_0x9fd887,_0x47f76c){_0x9fd887=_0x9fd887-0x0;var _0x1a54ab=_0xa6aa[_0x9fd887];return _0x1a54ab;};'use strict';var Sequelize=require(_0xaa6a('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0xaa6a('0x1'),'warning',_0xaa6a('0x2'),_0xaa6a('0x3')];module[_0xaa6a('0x4')]={'clientSideLoggingLevel':{'type':Sequelize[_0xaa6a('0x5')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0xaa6a('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0xaa6a('0x6')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize['TEXT'],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0xaa6a('0x7')],'unique':_0xaa6a('0x8')}}; \ 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 77a65e9..6621691 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 _0x6bff=['api','../../mysqldb','socket.io-emitter','redis','./user-setting.socket','defaults','localhost','status','update','then','stack','name','user','Unauthorized','Invalid\x20user\x20setting\x20id','UserSetting','find','params','catch','lodash','ioredis'];(function(_0x3fa7ac,_0x24041d){var _0x2d87d4=function(_0x23c695){while(--_0x23c695){_0x3fa7ac['push'](_0x3fa7ac['shift']());}};_0x2d87d4(++_0x24041d);}(_0x6bff,0xa6));var _0xf6bf=function(_0x5eb1ea,_0x1698af){_0x5eb1ea=_0x5eb1ea-0x0;var _0x2bf59f=_0x6bff[_0x5eb1ea];return _0x2bf59f;};'use strict';var _=require(_0xf6bf('0x0'));var Redis=require(_0xf6bf('0x1'));var logger=require('../../config/logger')(_0xf6bf('0x2'));var config=require('../../config/environment');var db=require(_0xf6bf('0x3'))['db'];var socket=require(_0xf6bf('0x4'))(new Redis(config[_0xf6bf('0x5')]));require(_0xf6bf('0x6'))['register'](socket);config[_0xf6bf('0x5')]=_[_0xf6bf('0x7')](config[_0xf6bf('0x5')],{'host':_0xf6bf('0x8'),'port':0x18eb});function respondWithResult(_0x9cf3a4,_0x139f2f){_0x139f2f=_0x139f2f||0xc8;return function(_0x199047){if(_0x199047){return _0x9cf3a4[_0xf6bf('0x9')](_0x139f2f)['json'](_0x199047);}};}function saveUpdates(_0x5aa5dc){return function(_0x4e06fd){if(_0x4e06fd){return _0x4e06fd[_0xf6bf('0xa')](_0x5aa5dc)[_0xf6bf('0xb')](function(_0x255360){return _0x255360;});}return null;};}function handleEntityNotFound(_0x41000e){return function(_0xf518ca){if(!_0xf518ca){_0x41000e['sendStatus'](0x194);}return _0xf518ca;};}function handleError(_0x2c8ad1,_0x45ce10){_0x45ce10=_0x45ce10||0x1f4;return function(_0x5bb119){logger['error'](_0x5bb119[_0xf6bf('0xc')]);if(_0x5bb119[_0xf6bf('0xd')]){delete _0x5bb119['name'];}_0x2c8ad1[_0xf6bf('0x9')](_0x45ce10)['send'](_0x5bb119);};}exports[_0xf6bf('0xa')]=function(_0x539079,_0x1aed26){if(_0x539079[_0xf6bf('0xe')]['role']!=='admin')throw new Error(_0xf6bf('0xf'));if(isNaN(Number(_0x539079['params']['id'])))throw new Error(_0xf6bf('0x10'));return db[_0xf6bf('0x11')][_0xf6bf('0x12')]({'where':{'id':_0x539079[_0xf6bf('0x13')]['id']}})[_0xf6bf('0xb')](handleEntityNotFound(_0x1aed26,null))[_0xf6bf('0xb')](saveUpdates(_0x539079['body'],null))[_0xf6bf('0xb')](respondWithResult(_0x1aed26,null))[_0xf6bf('0x14')](handleError(_0x1aed26,null));}; \ No newline at end of file +var _0x562d=['register','localhost','status','update','then','sendStatus','error','stack','name','admin','Unauthorized','params','Invalid\x20user\x20setting\x20id','UserSetting','body','lodash','ioredis','../../config/logger','../../mysqldb','socket.io-emitter','redis'];(function(_0x4091bc,_0x441db5){var _0x3432e1=function(_0x519a97){while(--_0x519a97){_0x4091bc['push'](_0x4091bc['shift']());}};_0x3432e1(++_0x441db5);}(_0x562d,0xe1));var _0xd562=function(_0x15291b,_0x17870b){_0x15291b=_0x15291b-0x0;var _0x12492a=_0x562d[_0x15291b];return _0x12492a;};'use strict';var _=require(_0xd562('0x0'));var Redis=require(_0xd562('0x1'));var logger=require(_0xd562('0x2'))('api');var config=require('../../config/environment');var db=require(_0xd562('0x3'))['db'];var socket=require(_0xd562('0x4'))(new Redis(config[_0xd562('0x5')]));require('./user-setting.socket')[_0xd562('0x6')](socket);config['redis']=_['defaults'](config[_0xd562('0x5')],{'host':_0xd562('0x7'),'port':0x18eb});function respondWithResult(_0x3e6465,_0x3b03fe){_0x3b03fe=_0x3b03fe||0xc8;return function(_0x21f82a){if(_0x21f82a){return _0x3e6465[_0xd562('0x8')](_0x3b03fe)['json'](_0x21f82a);}};}function saveUpdates(_0x1fdb93){return function(_0x5ef5e2){if(_0x5ef5e2){return _0x5ef5e2[_0xd562('0x9')](_0x1fdb93)[_0xd562('0xa')](function(_0x2f3572){return _0x2f3572;});}return null;};}function handleEntityNotFound(_0x31e826){return function(_0x22750e){if(!_0x22750e){_0x31e826[_0xd562('0xb')](0x194);}return _0x22750e;};}function handleError(_0x381265,_0x467927){_0x467927=_0x467927||0x1f4;return function(_0x15a39e){logger[_0xd562('0xc')](_0x15a39e[_0xd562('0xd')]);if(_0x15a39e['name']){delete _0x15a39e[_0xd562('0xe')];}_0x381265['status'](_0x467927)['send'](_0x15a39e);};}exports[_0xd562('0x9')]=function(_0x583523,_0x39522e){if(_0x583523['user']['role']!==_0xd562('0xf'))throw new Error(_0xd562('0x10'));if(isNaN(Number(_0x583523[_0xd562('0x11')]['id'])))throw new Error(_0xd562('0x12'));return db[_0xd562('0x13')]['find']({'where':{'id':_0x583523[_0xd562('0x11')]['id']}})[_0xd562('0xa')](handleEntityNotFound(_0x39522e,null))['then'](saveUpdates(_0x583523[_0xd562('0x14')],null))[_0xd562('0xa')](respondWithResult(_0x39522e,null))['catch'](handleError(_0x39522e,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 fdf1d45..488d4cd 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 _0x5f75=['hook','../../mysqldb','UserSetting','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x5f75,0x1a8));var _0x55f7=function(_0x57cb4f,_0x541f57){_0x57cb4f=_0x57cb4f-0x0;var _0x29bb45=_0x5f75[_0x57cb4f];return _0x29bb45;};'use strict';var EventEmitter=require('events');var UserSetting=require(_0x55f7('0x0'))['db'][_0x55f7('0x1')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x55f7('0x2')](0x0);var events={'afterCreate':_0x55f7('0x3'),'afterUpdate':_0x55f7('0x4'),'afterDestroy':_0x55f7('0x5')};function emitEvent(_0x2956c1){return function(_0x4ef6b9,_0x2cd146,_0x116d8d){UserSettingEvents[_0x55f7('0x6')](_0x2956c1+':'+_0x4ef6b9['id'],_0x4ef6b9);UserSettingEvents[_0x55f7('0x6')](_0x2956c1,_0x4ef6b9);_0x116d8d(null);};}for(var e in events){if(events[_0x55f7('0x7')](e)){var event=events[e];UserSetting[_0x55f7('0x8')](e,emitEvent(event));}}module['exports']=UserSettingEvents; \ No newline at end of file +var _0xce71=['../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xce71,0x1ad));var _0x1ce7=function(_0x5ecca4,_0x5a5b0f){_0x5ecca4=_0x5ecca4-0x0;var _0x7d031=_0xce71[_0x5ecca4];return _0x7d031;};'use strict';var EventEmitter=require(_0x1ce7('0x0'));var UserSetting=require(_0x1ce7('0x1'))['db']['UserSetting'];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x1ce7('0x2')](0x0);var events={'afterCreate':_0x1ce7('0x3'),'afterUpdate':_0x1ce7('0x4'),'afterDestroy':_0x1ce7('0x5')};function emitEvent(_0x2574be){return function(_0x4c9675,_0xd1f325,_0x145503){UserSettingEvents[_0x1ce7('0x6')](_0x2574be+':'+_0x4c9675['id'],_0x4c9675);UserSettingEvents[_0x1ce7('0x6')](_0x2574be,_0x4c9675);_0x145503(null);};}for(var e in events){if(events[_0x1ce7('0x7')](e)){var event=events[e];UserSetting[_0x1ce7('0x8')](e,emitEvent(event));}}module[_0x1ce7('0x9')]=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 a87e775..454b159 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 _0x8580=['define','clientSideLoggingEnabled','clientSideLoggingEnabledSince','exports'];(function(_0x3eea30,_0x48a04f){var _0x528546=function(_0x1aff57){while(--_0x1aff57){_0x3eea30['push'](_0x3eea30['shift']());}};_0x528546(++_0x48a04f);}(_0x8580,0x1c7));var _0x0858=function(_0x2a812e,_0x36d2b4){_0x2a812e=_0x2a812e-0x0;var _0x47beff=_0x8580[_0x2a812e];return _0x47beff;};'use strict';var attributes=require('./user-setting.attributes');module[_0x0858('0x0')]=function(_0x515938){return _0x515938[_0x0858('0x1')]('UserSetting',attributes,{'tableName':'user_settings','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x12b52e){if(!_0x12b52e[_0x0858('0x2')])_0x12b52e['clientSideLoggingEnabledSince']=null;else if(_0x12b52e[_0x0858('0x3')]===null)_0x12b52e[_0x0858('0x3')]=new Date();}}});}; \ No newline at end of file +var _0xee11=['clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes','define','UserSetting','user_settings'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xee11,0x146));var _0x1ee1=function(_0xc2bf5e,_0x3b48c1){_0xc2bf5e=_0xc2bf5e-0x0;var _0x3e4354=_0xee11[_0xc2bf5e];return _0x3e4354;};'use strict';var attributes=require(_0x1ee1('0x0'));module['exports']=function(_0x4e1a0d){return _0x4e1a0d[_0x1ee1('0x1')](_0x1ee1('0x2'),attributes,{'tableName':_0x1ee1('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1eb386){if(!_0x1eb386[_0x1ee1('0x4')])_0x1eb386[_0x1ee1('0x5')]=null;else if(_0x1eb386[_0x1ee1('0x5')]===null)_0x1eb386[_0x1ee1('0x5')]=new Date();}}});}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.socket.js b/server/api/user-setting/user-setting.socket.js index 97d5429..0e97beb 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 _0xe5a4=['./user-setting.events','save','remove','update','emit','user-setting:update','UserId','register','length'];(function(_0x4e0691,_0x168052){var _0x138faa=function(_0x3dd722){while(--_0x3dd722){_0x4e0691['push'](_0x4e0691['shift']());}};_0x138faa(++_0x168052);}(_0xe5a4,0x7e));var _0x4e5a=function(_0x21de95,_0x71ff49){_0x21de95=_0x21de95-0x0;var _0x8689ea=_0xe5a4[_0x21de95];return _0x8689ea;};'use strict';var UserSettingEvents=require(_0x4e5a('0x0'));var events=[_0x4e5a('0x1'),_0x4e5a('0x2'),_0x4e5a('0x3')];function createListener(_0x57c895,_0x1f4746){return function(_0x3ceb70){_0x1f4746[_0x4e5a('0x4')](_0x57c895,_0x3ceb70);if(_0x57c895===_0x4e5a('0x5')){_0x1f4746[_0x4e5a('0x4')]('user-setting:update:user-'+_0x3ceb70[_0x4e5a('0x6')],_0x3ceb70);}};}exports[_0x4e5a('0x7')]=function(_0x56d3d5){for(var _0x27b8a2=0x0,_0x36c556=events[_0x4e5a('0x8')];_0x27b8a2<_0x36c556;_0x27b8a2++){var _0x490cbe=events[_0x27b8a2];var _0x5a31f5=createListener('user-setting:'+_0x490cbe,_0x56d3d5);UserSettingEvents['on'](_0x490cbe,_0x5a31f5);}}; \ No newline at end of file +var _0xb2cd=['user-setting:update','user-setting:update:user-','UserId','user-setting:','./user-setting.events','save','update','emit'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0xb2cd,0x1d4));var _0xdb2c=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0xb2cd[_0x12fc8d];return _0x3f9d04;};'use strict';var UserSettingEvents=require(_0xdb2c('0x0'));var events=[_0xdb2c('0x1'),'remove',_0xdb2c('0x2')];function createListener(_0x1ad483,_0x17a21e){return function(_0x47fdac){_0x17a21e[_0xdb2c('0x3')](_0x1ad483,_0x47fdac);if(_0x1ad483===_0xdb2c('0x4')){_0x17a21e[_0xdb2c('0x3')](_0xdb2c('0x5')+_0x47fdac[_0xdb2c('0x6')],_0x47fdac);}};}exports['register']=function(_0x163c10){for(var _0x362493=0x0,_0x4b4371=events['length'];_0x362493<_0x4b4371;_0x362493++){var _0x5a13f3=events[_0x362493];var _0x18a92d=createListener(_0xdb2c('0x7')+_0x5a13f3,_0x163c10);UserSettingEvents['on'](_0x5a13f3,_0x18a92d);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 73a6e2e..bd00dd8 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 _0xcdd2=['addWhatsappAccounts','createApiKey','put','/:id/password','delete','removeQueues','removeTeams','/:id/chat_interactions','removeChatInteractions','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeApiKey','/:id/messengerSoundNotification','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./user.controller','get','index','/describe','isAuthenticated','/presence','getPresence','/:id','show','/:id/avatar','/:id/open_tabs','/:id/contacts','getContacts','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','/:id/mail/interactions','/:id/sms/interactions','getSmsInteractions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','getTeams','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','getFaxAccounts','/:id/mail_accounts','getMailAccounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','/:id/whatsapp_accounts','getScheduledCalls','/:id/api_key','getApiKey','post','create','/create_many','bulkCreate','/:id/queues','addQueues','diskStorage','join','root','server/files/images/','format','%s-%s','single','addAvatar','login','/:id/logout','logout','/:id/pause','/:id/unpause','/:id/teams','addTeams','addChatInteractions','/:id/mail_interactions','/:id/fax_interactions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','/:id/fax_accounts','addMailAccounts','/:id/openchannel_accounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites'];(function(_0x4f9d26,_0x641341){var _0x57debc=function(_0x48f368){while(--_0x48f368){_0x4f9d26['push'](_0x4f9d26['shift']());}};_0x57debc(++_0x641341);}(_0xcdd2,0x83));var _0x2cdd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcdd2[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x2cdd('0x0'));var util=require(_0x2cdd('0x1'));var path=require(_0x2cdd('0x2'));var timeout=require(_0x2cdd('0x3'));var express=require('express');var router=express[_0x2cdd('0x4')]();var fs_extra=require(_0x2cdd('0x5'));var auth=require(_0x2cdd('0x6'));var interaction=require(_0x2cdd('0x7'));var config=require('../../config/environment');var controller=require(_0x2cdd('0x8'));router[_0x2cdd('0x9')]('/',auth['isAuthenticated'](),controller[_0x2cdd('0xa')]);router[_0x2cdd('0x9')](_0x2cdd('0xb'),auth[_0x2cdd('0xc')](),controller['describe']);router['get']('/whoami',auth[_0x2cdd('0xc')](),controller['whoami']);router[_0x2cdd('0x9')](_0x2cdd('0xd'),auth[_0x2cdd('0xc')](),controller[_0x2cdd('0xe')]);router[_0x2cdd('0x9')](_0x2cdd('0xf'),auth[_0x2cdd('0xc')](),controller[_0x2cdd('0x10')]);router[_0x2cdd('0x9')](_0x2cdd('0x11'),controller['getAvatar']);router['get'](_0x2cdd('0x12'),auth[_0x2cdd('0xc')](),controller['getOpenTabs']);router[_0x2cdd('0x9')](_0x2cdd('0x13'),auth[_0x2cdd('0xc')](),controller[_0x2cdd('0x14')]);router[_0x2cdd('0x9')]('/:id/queues',auth[_0x2cdd('0xc')](),controller[_0x2cdd('0x15')]);router['get'](_0x2cdd('0x16'),auth[_0x2cdd('0xc')](),controller[_0x2cdd('0x17')]);router[_0x2cdd('0x9')](_0x2cdd('0x18'),auth[_0x2cdd('0xc')](),controller['getGroups']);router[_0x2cdd('0x9')](_0x2cdd('0x19'),auth[_0x2cdd('0xc')](),controller[_0x2cdd('0x1a')]);router['get'](_0x2cdd('0x1b'),auth[_0x2cdd('0xc')](),controller[_0x2cdd('0x1c')]);router[_0x2cdd('0x9')](_0x2cdd('0x1d'),auth[_0x2cdd('0xc')](),controller[_0x2cdd('0x1e')]);router[_0x2cdd('0x9')](_0x2cdd('0x1f'),auth[_0x2cdd('0xc')](),controller['getOpenchannelInteractions']);router['get'](_0x2cdd('0x20'),auth['isAuthenticated'](),controller['getMailInteractions']);router[_0x2cdd('0x9')](_0x2cdd('0x21'),auth[_0x2cdd('0xc')](),controller[_0x2cdd('0x22')]);router['get']('/:id/fax/interactions',auth[_0x2cdd('0xc')](),controller[_0x2cdd('0x23')]);router[_0x2cdd('0x9')](_0x2cdd('0x24'),auth[_0x2cdd('0xc')](),controller[_0x2cdd('0x25')]);router[_0x2cdd('0x9')]('/:id/teams',auth[_0x2cdd('0xc')](),controller[_0x2cdd('0x26')]);router[_0x2cdd('0x9')]('/:id/lists',auth['isAuthenticated'](),controller['getLists']);router[_0x2cdd('0x9')](_0x2cdd('0x27'),auth['isAuthenticated'](),controller[_0x2cdd('0x28')]);router[_0x2cdd('0x9')](_0x2cdd('0x29'),auth[_0x2cdd('0xc')](),controller[_0x2cdd('0x2a')]);router[_0x2cdd('0x9')]('/:id/fax_accounts',auth[_0x2cdd('0xc')](),controller[_0x2cdd('0x2b')]);router[_0x2cdd('0x9')](_0x2cdd('0x2c'),auth['isAuthenticated'](),controller[_0x2cdd('0x2d')]);router[_0x2cdd('0x9')]('/:id/openchannel_accounts',auth[_0x2cdd('0xc')](),controller[_0x2cdd('0x2e')]);router[_0x2cdd('0x9')](_0x2cdd('0x2f'),auth[_0x2cdd('0xc')](),controller[_0x2cdd('0x30')]);router[_0x2cdd('0x9')](_0x2cdd('0x31'),auth[_0x2cdd('0xc')](),controller['getChatWebsites']);router[_0x2cdd('0x9')](_0x2cdd('0x32'),auth[_0x2cdd('0xc')](),controller['getWhatsappAccounts']);router['get']('/:id/scheduled_calls',auth[_0x2cdd('0xc')](),controller[_0x2cdd('0x33')]);router['get'](_0x2cdd('0x34'),auth[_0x2cdd('0xc')](),controller[_0x2cdd('0x35')]);router[_0x2cdd('0x36')](_0x2cdd('0x13'),auth['isAuthenticated'](),controller['addContacts']);router[_0x2cdd('0x36')]('/',auth[_0x2cdd('0xc')](),controller[_0x2cdd('0x37')]);router[_0x2cdd('0x36')](_0x2cdd('0x38'),auth['isAuthenticated'](),controller[_0x2cdd('0x39')]);router[_0x2cdd('0x36')](_0x2cdd('0x3a'),auth[_0x2cdd('0xc')](),controller[_0x2cdd('0x3b')]);var upload=multer({'storage':multer[_0x2cdd('0x3c')]({'destination':function(_0xfa0de9,_0x5a0fd1,_0x34d3b8){_0x34d3b8(null,path[_0x2cdd('0x3d')](config[_0x2cdd('0x3e')],_0x2cdd('0x3f')));},'filename':function(_0x296359,_0x113d5d,_0x1a62af){_0x1a62af(null,util[_0x2cdd('0x40')](_0x2cdd('0x41'),Date['now'](),_0x113d5d['originalname']));}})});router[_0x2cdd('0x36')](_0x2cdd('0x11'),upload[_0x2cdd('0x42')]('file'),controller[_0x2cdd('0x43')]);router['post']('/:id/login',auth[_0x2cdd('0xc')](),controller[_0x2cdd('0x44')]);router[_0x2cdd('0x36')](_0x2cdd('0x45'),auth[_0x2cdd('0xc')](),controller[_0x2cdd('0x46')]);router[_0x2cdd('0x36')](_0x2cdd('0x47'),auth[_0x2cdd('0xc')](),controller['pause']);router[_0x2cdd('0x36')](_0x2cdd('0x48'),auth[_0x2cdd('0xc')](),controller['unpause']);router[_0x2cdd('0x36')](_0x2cdd('0x49'),auth[_0x2cdd('0xc')](),controller[_0x2cdd('0x4a')]);router[_0x2cdd('0x36')]('/:id/chat_interactions',auth['isAuthenticated'](),controller[_0x2cdd('0x4b')]);router[_0x2cdd('0x36')](_0x2cdd('0x4c'),auth['isAuthenticated'](),controller['addMailInteractions']);router[_0x2cdd('0x36')](_0x2cdd('0x4d'),auth['isAuthenticated'](),controller['addFaxInteractions']);router[_0x2cdd('0x36')](_0x2cdd('0x4e'),auth[_0x2cdd('0xc')](),controller[_0x2cdd('0x4f')]);router[_0x2cdd('0x36')](_0x2cdd('0x50'),auth[_0x2cdd('0xc')](),controller[_0x2cdd('0x51')]);router[_0x2cdd('0x36')](_0x2cdd('0x52'),auth[_0x2cdd('0xc')](),controller['addWhatsappInteractions']);router[_0x2cdd('0x36')](_0x2cdd('0x53'),auth[_0x2cdd('0xc')](),controller['addFaxAccounts']);router[_0x2cdd('0x36')]('/:id/mail_accounts',auth['isAuthenticated'](),controller[_0x2cdd('0x54')]);router['post'](_0x2cdd('0x55'),auth[_0x2cdd('0xc')](),controller[_0x2cdd('0x56')]);router['post'](_0x2cdd('0x2f'),auth[_0x2cdd('0xc')](),controller[_0x2cdd('0x57')]);router[_0x2cdd('0x36')](_0x2cdd('0x31'),auth[_0x2cdd('0xc')](),controller[_0x2cdd('0x58')]);router[_0x2cdd('0x36')]('/:id/whatsapp_accounts',auth[_0x2cdd('0xc')](),controller[_0x2cdd('0x59')]);router[_0x2cdd('0x36')](_0x2cdd('0x34'),auth[_0x2cdd('0xc')](),controller[_0x2cdd('0x5a')]);router['put'](_0x2cdd('0xf'),auth['isAuthenticated'](),controller['update']);router[_0x2cdd('0x5b')](_0x2cdd('0x5c'),auth['isAuthenticated'](),controller['changePassword']);router[_0x2cdd('0x5d')]('/:id/queues',auth[_0x2cdd('0xc')](),controller[_0x2cdd('0x5e')]);router[_0x2cdd('0x5d')](_0x2cdd('0x49'),auth['isAuthenticated'](),controller[_0x2cdd('0x5f')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);router['delete'](_0x2cdd('0x60'),auth[_0x2cdd('0xc')](),controller[_0x2cdd('0x61')]);router[_0x2cdd('0x5d')](_0x2cdd('0x4c'),auth[_0x2cdd('0xc')](),controller[_0x2cdd('0x62')]);router[_0x2cdd('0x5d')]('/:id/fax_interactions',auth[_0x2cdd('0xc')](),controller[_0x2cdd('0x63')]);router[_0x2cdd('0x5d')](_0x2cdd('0x4e'),auth[_0x2cdd('0xc')](),controller[_0x2cdd('0x64')]);router[_0x2cdd('0x5d')]('/:id/openchannel_interactions',auth[_0x2cdd('0xc')](),controller[_0x2cdd('0x65')]);router[_0x2cdd('0x5d')](_0x2cdd('0x52'),auth[_0x2cdd('0xc')](),controller['removeWhatsappInteractions']);router[_0x2cdd('0x5d')]('/:id/fax_accounts',auth['isAuthenticated'](),controller['removeFaxAccounts']);router['delete'](_0x2cdd('0x2c'),auth[_0x2cdd('0xc')](),controller[_0x2cdd('0x66')]);router[_0x2cdd('0x5d')]('/:id/openchannel_accounts',auth[_0x2cdd('0xc')](),controller[_0x2cdd('0x67')]);router['delete'](_0x2cdd('0x2f'),auth[_0x2cdd('0xc')](),controller[_0x2cdd('0x68')]);router[_0x2cdd('0x5d')](_0x2cdd('0x31'),auth[_0x2cdd('0xc')](),controller[_0x2cdd('0x69')]);router['delete'](_0x2cdd('0x32'),auth[_0x2cdd('0xc')](),controller[_0x2cdd('0x6a')]);router['delete'](_0x2cdd('0x34'),auth['isAuthenticated'](),controller[_0x2cdd('0x6b')]);router[_0x2cdd('0x36')](_0x2cdd('0x6c'),auth[_0x2cdd('0xc')](),controller['messengerSoundNotification']);module[_0x2cdd('0x6d')]=router; \ No newline at end of file +var _0xb338=['createApiKey','put','update','/:id/password','delete','removeTeams','destroy','/:id/chat_interactions','removeChatInteractions','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','/:id/whatsapp_interactions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeChatWebsites','removeWhatsappAccounts','removeApiKey','/:id/messengerSoundNotification','messengerSoundNotification','exports','multer','connect-timeout','express','Router','../../config/environment','./user.controller','isAuthenticated','get','/describe','/whoami','whoami','/presence','/:id','show','/:id/avatar','getAvatar','getOpenTabs','/:id/contacts','getContacts','/:id/queues','getVoiceQueuesRt','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','/:id/lists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','/:id/chat_websites','getChatWebsites','getWhatsappAccounts','/:id/scheduled_calls','getScheduledCalls','getApiKey','post','addContacts','create','bulkCreate','addQueues','join','root','server/files/images/','format','%s-%s','now','originalname','addAvatar','/:id/login','login','/:id/logout','/:id/pause','pause','/:id/unpause','unpause','addTeams','addChatInteractions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','addFaxAccounts','addSmsAccounts','addChatWebsites','/:id/whatsapp_accounts','/:id/api_key'];(function(_0x6c71bb,_0x3e5acf){var _0x508f22=function(_0x573e45){while(--_0x573e45){_0x6c71bb['push'](_0x6c71bb['shift']());}};_0x508f22(++_0x3e5acf);}(_0xb338,0x16e));var _0x8b33=function(_0x2d42b7,_0x391076){_0x2d42b7=_0x2d42b7-0x0;var _0x3ac15a=_0xb338[_0x2d42b7];return _0x3ac15a;};'use strict';var multer=require(_0x8b33('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x8b33('0x1'));var express=require(_0x8b33('0x2'));var router=express[_0x8b33('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8b33('0x4'));var controller=require(_0x8b33('0x5'));router['get']('/',auth[_0x8b33('0x6')](),controller['index']);router[_0x8b33('0x7')](_0x8b33('0x8'),auth['isAuthenticated'](),controller['describe']);router[_0x8b33('0x7')](_0x8b33('0x9'),auth[_0x8b33('0x6')](),controller[_0x8b33('0xa')]);router[_0x8b33('0x7')](_0x8b33('0xb'),auth[_0x8b33('0x6')](),controller['getPresence']);router[_0x8b33('0x7')](_0x8b33('0xc'),auth[_0x8b33('0x6')](),controller[_0x8b33('0xd')]);router[_0x8b33('0x7')](_0x8b33('0xe'),controller[_0x8b33('0xf')]);router[_0x8b33('0x7')]('/:id/open_tabs',auth[_0x8b33('0x6')](),controller[_0x8b33('0x10')]);router[_0x8b33('0x7')](_0x8b33('0x11'),auth[_0x8b33('0x6')](),controller[_0x8b33('0x12')]);router[_0x8b33('0x7')](_0x8b33('0x13'),auth[_0x8b33('0x6')](),controller['getQueues']);router[_0x8b33('0x7')]('/:id/queues_rt',auth[_0x8b33('0x6')](),controller[_0x8b33('0x14')]);router[_0x8b33('0x7')]('/:id/groups',auth[_0x8b33('0x6')](),controller[_0x8b33('0x15')]);router['get'](_0x8b33('0x16'),auth[_0x8b33('0x6')](),controller[_0x8b33('0x17')]);router[_0x8b33('0x7')](_0x8b33('0x18'),auth['isAuthenticated'](),controller[_0x8b33('0x19')]);router[_0x8b33('0x7')](_0x8b33('0x1a'),auth[_0x8b33('0x6')](),controller[_0x8b33('0x1b')]);router['get'](_0x8b33('0x1c'),auth['isAuthenticated'](),controller[_0x8b33('0x1d')]);router[_0x8b33('0x7')](_0x8b33('0x1e'),auth[_0x8b33('0x6')](),controller[_0x8b33('0x1f')]);router[_0x8b33('0x7')](_0x8b33('0x20'),auth['isAuthenticated'](),controller[_0x8b33('0x21')]);router['get'](_0x8b33('0x22'),auth[_0x8b33('0x6')](),controller[_0x8b33('0x23')]);router[_0x8b33('0x7')](_0x8b33('0x24'),auth[_0x8b33('0x6')](),controller[_0x8b33('0x25')]);router['get'](_0x8b33('0x26'),auth[_0x8b33('0x6')](),controller['getTeams']);router[_0x8b33('0x7')](_0x8b33('0x27'),auth['isAuthenticated'](),controller['getLists']);router['get'](_0x8b33('0x28'),auth[_0x8b33('0x6')](),controller[_0x8b33('0x29')]);router['get'](_0x8b33('0x2a'),auth[_0x8b33('0x6')](),controller[_0x8b33('0x2b')]);router[_0x8b33('0x7')](_0x8b33('0x2c'),auth[_0x8b33('0x6')](),controller['getFaxAccounts']);router[_0x8b33('0x7')](_0x8b33('0x2d'),auth[_0x8b33('0x6')](),controller[_0x8b33('0x2e')]);router[_0x8b33('0x7')](_0x8b33('0x2f'),auth[_0x8b33('0x6')](),controller[_0x8b33('0x30')]);router['get'](_0x8b33('0x31'),auth[_0x8b33('0x6')](),controller['getSmsAccounts']);router[_0x8b33('0x7')](_0x8b33('0x32'),auth[_0x8b33('0x6')](),controller[_0x8b33('0x33')]);router['get']('/:id/whatsapp_accounts',auth['isAuthenticated'](),controller[_0x8b33('0x34')]);router[_0x8b33('0x7')](_0x8b33('0x35'),auth[_0x8b33('0x6')](),controller[_0x8b33('0x36')]);router[_0x8b33('0x7')]('/:id/api_key',auth[_0x8b33('0x6')](),controller[_0x8b33('0x37')]);router[_0x8b33('0x38')](_0x8b33('0x11'),auth['isAuthenticated'](),controller[_0x8b33('0x39')]);router[_0x8b33('0x38')]('/',auth[_0x8b33('0x6')](),controller[_0x8b33('0x3a')]);router[_0x8b33('0x38')]('/create_many',auth[_0x8b33('0x6')](),controller[_0x8b33('0x3b')]);router[_0x8b33('0x38')](_0x8b33('0x13'),auth[_0x8b33('0x6')](),controller[_0x8b33('0x3c')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4f9805,_0x3d37ff,_0x29a8ea){_0x29a8ea(null,path[_0x8b33('0x3d')](config[_0x8b33('0x3e')],_0x8b33('0x3f')));},'filename':function(_0x4623e6,_0x1d5907,_0x4d454d){_0x4d454d(null,util[_0x8b33('0x40')](_0x8b33('0x41'),Date[_0x8b33('0x42')](),_0x1d5907[_0x8b33('0x43')]));}})});router[_0x8b33('0x38')](_0x8b33('0xe'),upload['single']('file'),controller[_0x8b33('0x44')]);router[_0x8b33('0x38')](_0x8b33('0x45'),auth[_0x8b33('0x6')](),controller[_0x8b33('0x46')]);router[_0x8b33('0x38')](_0x8b33('0x47'),auth[_0x8b33('0x6')](),controller['logout']);router[_0x8b33('0x38')](_0x8b33('0x48'),auth[_0x8b33('0x6')](),controller[_0x8b33('0x49')]);router[_0x8b33('0x38')](_0x8b33('0x4a'),auth['isAuthenticated'](),controller[_0x8b33('0x4b')]);router[_0x8b33('0x38')](_0x8b33('0x26'),auth['isAuthenticated'](),controller[_0x8b33('0x4c')]);router[_0x8b33('0x38')]('/:id/chat_interactions',auth['isAuthenticated'](),controller[_0x8b33('0x4d')]);router[_0x8b33('0x38')]('/:id/mail_interactions',auth['isAuthenticated'](),controller[_0x8b33('0x4e')]);router[_0x8b33('0x38')](_0x8b33('0x4f'),auth[_0x8b33('0x6')](),controller[_0x8b33('0x50')]);router[_0x8b33('0x38')](_0x8b33('0x51'),auth[_0x8b33('0x6')](),controller[_0x8b33('0x52')]);router[_0x8b33('0x38')](_0x8b33('0x53'),auth[_0x8b33('0x6')](),controller[_0x8b33('0x54')]);router[_0x8b33('0x38')]('/:id/whatsapp_interactions',auth[_0x8b33('0x6')](),controller['addWhatsappInteractions']);router[_0x8b33('0x38')](_0x8b33('0x2c'),auth['isAuthenticated'](),controller[_0x8b33('0x55')]);router[_0x8b33('0x38')](_0x8b33('0x2d'),auth[_0x8b33('0x6')](),controller['addMailAccounts']);router['post'](_0x8b33('0x2f'),auth['isAuthenticated'](),controller['addOpenchannelAccounts']);router[_0x8b33('0x38')](_0x8b33('0x31'),auth[_0x8b33('0x6')](),controller[_0x8b33('0x56')]);router[_0x8b33('0x38')](_0x8b33('0x32'),auth['isAuthenticated'](),controller[_0x8b33('0x57')]);router[_0x8b33('0x38')](_0x8b33('0x58'),auth[_0x8b33('0x6')](),controller['addWhatsappAccounts']);router['post'](_0x8b33('0x59'),auth[_0x8b33('0x6')](),controller[_0x8b33('0x5a')]);router[_0x8b33('0x5b')](_0x8b33('0xc'),auth[_0x8b33('0x6')](),controller[_0x8b33('0x5c')]);router[_0x8b33('0x5b')](_0x8b33('0x5d'),auth['isAuthenticated'](),controller['changePassword']);router['delete'](_0x8b33('0x13'),auth[_0x8b33('0x6')](),controller['removeQueues']);router[_0x8b33('0x5e')](_0x8b33('0x26'),auth[_0x8b33('0x6')](),controller[_0x8b33('0x5f')]);router[_0x8b33('0x5e')](_0x8b33('0xc'),auth[_0x8b33('0x6')](),controller[_0x8b33('0x60')]);router['delete'](_0x8b33('0x61'),auth['isAuthenticated'](),controller[_0x8b33('0x62')]);router[_0x8b33('0x5e')]('/:id/mail_interactions',auth[_0x8b33('0x6')](),controller[_0x8b33('0x63')]);router[_0x8b33('0x5e')](_0x8b33('0x4f'),auth['isAuthenticated'](),controller[_0x8b33('0x64')]);router[_0x8b33('0x5e')]('/:id/sms_interactions',auth[_0x8b33('0x6')](),controller[_0x8b33('0x65')]);router[_0x8b33('0x5e')]('/:id/openchannel_interactions',auth[_0x8b33('0x6')](),controller[_0x8b33('0x66')]);router[_0x8b33('0x5e')](_0x8b33('0x67'),auth[_0x8b33('0x6')](),controller[_0x8b33('0x68')]);router[_0x8b33('0x5e')](_0x8b33('0x2c'),auth[_0x8b33('0x6')](),controller[_0x8b33('0x69')]);router[_0x8b33('0x5e')](_0x8b33('0x2d'),auth['isAuthenticated'](),controller[_0x8b33('0x6a')]);router['delete'](_0x8b33('0x2f'),auth[_0x8b33('0x6')](),controller[_0x8b33('0x6b')]);router[_0x8b33('0x5e')](_0x8b33('0x31'),auth[_0x8b33('0x6')](),controller['removeSmsAccounts']);router[_0x8b33('0x5e')](_0x8b33('0x32'),auth[_0x8b33('0x6')](),controller[_0x8b33('0x6c')]);router[_0x8b33('0x5e')](_0x8b33('0x58'),auth[_0x8b33('0x6')](),controller[_0x8b33('0x6d')]);router['delete'](_0x8b33('0x59'),auth[_0x8b33('0x6')](),controller[_0x8b33('0x6e')]);router[_0x8b33('0x38')](_0x8b33('0x6f'),auth[_0x8b33('0x6')](),controller[_0x8b33('0x70')]);module[_0x8b33('0x71')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index d89ec97..45d1d07 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 _0x13e9=['fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','ENUM','admin','agent','local','INTEGER','BOOLEAN','DATE','DEFAULT\x20PAUSE','dynamic','friend','from-sip','ALLOWED_NOT_SCREENED','ALLOWED','PROHIB_PASSED_SCREEN','udp','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','shortinfo','rfc2833','yes','nonat','update','outgoing','force_rport,comedia','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','never','\x22\x22\x20<>','always','accept','uac','uas','fingerprint','certificate','active','passive','update,nonat','TEXT','showWebBar','get','isArray','wss','encryption','avpf','force_avp','icesupport','dtlsenable','dtlssetup','dtlscertfile','dtlsprivatekey','rtcp_mux','actpass','/etc/pki/tls/certs/motion.crt','permissions','VIRTUAL','string','true','false','screenrecording','blocked','blockedAt','loginAttempts','UNSIGNED','moment','util','lodash','exports','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x13e9,0xfc));var _0x913e=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x13e9[_0x618414];return _0x21c19a;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x913e('0x0'));var util=require(_0x913e('0x1'));var _=require(_0x913e('0x2'));module[_0x913e('0x3')]={'name':{'type':Sequelize[_0x913e('0x4')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x135532){this['setDataValue'](_0x913e('0x5'),_0x135532);this[_0x913e('0x6')](_0x913e('0x7'),_0x135532);},'comment':_0x913e('0x8')},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x1f14fa){this['setDataValue'](_0x913e('0x9'),_0x1f14fa);this[_0x913e('0x6')](_0x913e('0xa'),util[_0x913e('0xb')](_0x913e('0xc'),_0x1f14fa,this[_0x913e('0xd')](_0x913e('0xe'))));}},'alias':{'type':Sequelize[_0x913e('0x4')]},'email':{'type':Sequelize[_0x913e('0x4')],'allowNull':![],'unique':_0x913e('0xf'),'validate':{'isEmail':!![]},'set':function(_0x51c3bd){if(_0x51c3bd){this[_0x913e('0x6')](_0x913e('0xf'),_0x51c3bd[_0x913e('0x10')]());}}},'role':{'type':Sequelize[_0x913e('0x11')](_0x913e('0x12'),'user',_0x913e('0x13'),'telephone'),'allowNull':![]},'password':{'type':Sequelize[_0x913e('0x4')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x913e('0x4')],'defaultValue':_0x913e('0x14')},'internal':{'type':Sequelize[_0x913e('0x15')](0xb),'allowNull':![],'unique':_0x913e('0xe'),'set':function(_0xad3681){this['setDataValue'](_0x913e('0xe'),_0xad3681);this[_0x913e('0x6')]('accountcode',_0xad3681);this[_0x913e('0x6')](_0x913e('0xa'),util['format'](_0x913e('0xc'),this[_0x913e('0xd')](_0x913e('0x9')),_0xad3681));}},'salt':{'type':Sequelize[_0x913e('0x4')]},'phone':{'type':Sequelize[_0x913e('0x4')]},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize[_0x913e('0x4')]},'zipcode':{'type':Sequelize[_0x913e('0x4')]},'userpic':{'type':Sequelize[_0x913e('0x4')]},'city':{'type':Sequelize[_0x913e('0x4')]},'country':{'type':Sequelize['STRING']},'online':{'type':Sequelize[_0x913e('0x16')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x913e('0x17')]},'voicePause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x913e('0x16')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x913e('0x16')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x913e('0x16')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x913e('0x16')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x913e('0x16')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x913e('0x16')],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':_0x913e('0x18')},'lastPauseAt':{'type':Sequelize[_0x913e('0x17')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x913e('0x15')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x913e('0x15')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x913e('0x15')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x913e('0x15')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x913e('0x16')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x913e('0x16')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x913e('0x15')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x913e('0x15')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x913e('0x16')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x913e('0x15')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x913e('0x16')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x913e('0x16')],'defaultValue':![]},'description':{'type':Sequelize[_0x913e('0x4')],'allowNull':!![]},'host':{'type':Sequelize[_0x913e('0x4')],'allowNull':!![],'defaultValue':_0x913e('0x19')},'ipaddr':{'type':Sequelize[_0x913e('0x4')],'allowNull':!![]},'port':{'type':Sequelize[_0x913e('0x15')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x913e('0x15')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize['STRING'],'allowNull':!![]},'regserver':{'type':Sequelize[_0x913e('0x4')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x913e('0x4')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x913e('0x15')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x913e('0x11')](_0x913e('0x1a'),'user','peer'),'allowNull':!![],'defaultValue':_0x913e('0x1a')},'context':{'type':Sequelize[_0x913e('0x4')],'allowNull':!![],'defaultValue':_0x913e('0x1b')},'callingpres':{'type':Sequelize[_0x913e('0x11')](_0x913e('0x1c'),'ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN',_0x913e('0x1d'),'PROHIB_NOT_SCREENED',_0x913e('0x1e'),'PROHIB_FAILED_SCREEN','PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0x913e('0x4')],'allowNull':!![]},'permit':{'type':Sequelize[_0x913e('0x4')],'allowNull':!![]},'secret':{'type':Sequelize['STRING'],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x913e('0x4')],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x913e('0x1f'),'set':function(_0x3dd226){this['setDataValue'](_0x913e('0x20'),_0x3dd226?_0x3dd226['join'](','):null);},'get':function(){return this['getDataValue'](_0x913e('0x20'))?this[_0x913e('0xd')](_0x913e('0x20'))[_0x913e('0x21')](','):null;},'comment':_0x913e('0x22')},'dtmfmode':{'type':Sequelize['ENUM']('rfc2833',_0x913e('0x23'),_0x913e('0x24'),'inband','auto'),'allowNull':!![],'defaultValue':_0x913e('0x25')},'directmedia':{'type':Sequelize[_0x913e('0x11')](_0x913e('0x26'),'no',_0x913e('0x27'),_0x913e('0x28'),_0x913e('0x29')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x913e('0x11')](_0x913e('0x26'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x913e('0x4')],'allowNull':!![]},'directmediadeny':{'type':Sequelize['STRING'],'allowNull':!![]},'nat':{'type':Sequelize[_0x913e('0x4')],'allowNull':!![],'defaultValue':_0x913e('0x2a'),'set':function(_0x5474f5){this[_0x913e('0x6')]('nat',_0x5474f5?_0x5474f5[_0x913e('0x2b')](','):null);},'get':function(){return this[_0x913e('0xd')]('nat')?this['getDataValue']('nat')[_0x913e('0x21')](','):null;},'comment':_0x913e('0x2c')},'callgroup':{'type':Sequelize[_0x913e('0x4')]},'namedcallgroup':{'type':Sequelize[_0x913e('0x4')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0x913e('0x4')]},'language':{'type':Sequelize[_0x913e('0x4')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x913e('0x4')]},'disallow':{'type':Sequelize[_0x913e('0x4')],'allowNull':![],'defaultValue':_0x913e('0x2d')},'allow':{'type':Sequelize[_0x913e('0x4')],'allowNull':![],'defaultValue':_0x913e('0x2e'),'set':function(_0x43917e){this[_0x913e('0x6')](_0x913e('0x2f'),_0x43917e?_0x43917e[_0x913e('0x2b')](';'):_0x913e('0x2e'));},'get':function(){return this[_0x913e('0xd')]('allow')?this[_0x913e('0xd')]('allow')[_0x913e('0x21')](';'):null;},'comment':_0x913e('0x30')},'autoframing':{'type':Sequelize[_0x913e('0x11')]('yes','no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x913e('0x4')],'allowNull':!![],'set':function(_0x3d8ae3){this[_0x913e('0x6')](_0x913e('0x31'),_0x3d8ae3?_0x3d8ae3[_0x913e('0x2b')](','):null);},'get':function(){return this[_0x913e('0xd')](_0x913e('0x31'))?this[_0x913e('0xd')](_0x913e('0x31'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x913e('0x11')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x913e('0x11')](_0x913e('0x26'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x913e('0x11')](_0x913e('0x26'),'no',_0x913e('0x32')),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM'](_0x913e('0x26'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x913e('0x11')](_0x913e('0x26'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x913e('0x15')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize[_0x913e('0x4')],'allowNull':!![],'defaultValue':_0x913e('0x33')},'amaflags':{'type':Sequelize[_0x913e('0x4')],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM'](_0x913e('0x26'),'no'),'allowNull':!![],'defaultValue':_0x913e('0x26')},'busylevel':{'type':Sequelize[_0x913e('0x15')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x913e('0x11')](_0x913e('0x26'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0x913e('0x26'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x913e('0x11')](_0x913e('0x26'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize['STRING'],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize['ENUM'](_0x913e('0x26'),'no',_0x913e('0x34')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x913e('0x15')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x913e('0x11')](_0x913e('0x26'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x913e('0x4')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x913e('0x11')](_0x913e('0x35'),'refuse','originate'),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x913e('0x15')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x913e('0x15')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x913e('0x11')](_0x913e('0x36'),'uas'),'allowNull':!![],'defaultValue':_0x913e('0x37')},'t38pt_usertpsource':{'type':Sequelize[_0x913e('0x4')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x913e('0x4')],'allowNull':!![]},'fromdomain':{'type':Sequelize['STRING'],'allowNull':!![]},'fromuser':{'type':Sequelize['STRING'],'allowNull':!![]},'qualify':{'type':Sequelize[_0x913e('0x11')]('yes','no'),'allowNull':!![],'defaultValue':_0x913e('0x26')},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x913e('0x4')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x913e('0x15')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x913e('0x15')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x913e('0x15')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x913e('0x11')](_0x913e('0x26'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x913e('0x4')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x913e('0x4')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x913e('0x15')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x913e('0x15')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x913e('0x15')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x913e('0x4')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x913e('0x4')],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x913e('0x4')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x913e('0x4')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x913e('0x15')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x913e('0x11')](_0x913e('0x26'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x913e('0x11')](_0x913e('0x26'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x913e('0x11')](_0x913e('0x26'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x913e('0x11')](_0x913e('0x26'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x913e('0x11')]('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x913e('0x11')](_0x913e('0x26'),'no',_0x913e('0x38'),_0x913e('0x39')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x913e('0x15')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x913e('0x4')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x913e('0x4')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x913e('0x4')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x913e('0x4')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x913e('0x4')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x913e('0x11')](_0x913e('0x3a'),_0x913e('0x3b'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x913e('0x4')],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM'](_0x913e('0x26'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x913e('0x11')](_0x913e('0x26'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x913e('0x11')](_0x913e('0x26'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x913e('0x4')],'allowNull':!![]},'mohinterpret':{'type':Sequelize['STRING'],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x913e('0x4')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x913e('0x4')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x913e('0x11')](_0x913e('0x26'),'no',_0x913e('0x27'),_0x913e('0x28'),_0x913e('0x3c')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x913e('0x16')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x913e('0x4')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize['DATE'],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x913e('0x3d')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x1b683d){this[_0x913e('0x6')](_0x913e('0x3e'),_0x1b683d);var _0x6198e8=this[_0x913e('0x3f')]({'plain':!![]});switch(_0x1b683d){case 0x0:case 0x1:var _0x18a1ee=_0x6198e8['transport']?_[_0x913e('0x40')](_0x6198e8[_0x913e('0x20')])?_0x6198e8['transport'][_0x913e('0x2b')]():_0x6198e8[_0x913e('0x20')]:_0x913e('0x1f');if(_0x18a1ee===_0x913e('0x41')){_0x18a1ee=_0x913e('0x1f');}this[_0x913e('0x6')](_0x913e('0x20'),_0x18a1ee);this[_0x913e('0x6')](_0x913e('0x42'),'no');this[_0x913e('0x6')](_0x913e('0x43'),null);this[_0x913e('0x6')](_0x913e('0x44'),null);this[_0x913e('0x6')](_0x913e('0x45'),null);this[_0x913e('0x6')](_0x913e('0x46'),null);this[_0x913e('0x6')]('dtlsverify',null);this[_0x913e('0x6')](_0x913e('0x47'),null);this[_0x913e('0x6')](_0x913e('0x48'),null);this['setDataValue'](_0x913e('0x49'),null);this[_0x913e('0x6')](_0x913e('0x4a'),'no');break;case 0x2:this[_0x913e('0x6')](_0x913e('0x20'),_0x913e('0x41'));this[_0x913e('0x6')](_0x913e('0x42'),'yes');this[_0x913e('0x6')](_0x913e('0x43'),'yes');this['setDataValue'](_0x913e('0x44'),'yes');this[_0x913e('0x6')](_0x913e('0x45'),_0x913e('0x26'));this[_0x913e('0x6')]('dtlsenable',_0x913e('0x26'));this[_0x913e('0x6')]('dtlsverify','no');this[_0x913e('0x6')]('dtlssetup',_0x913e('0x4b'));this[_0x913e('0x6')](_0x913e('0x48'),_0x6198e8[_0x913e('0x48')]||_0x913e('0x4c'));this[_0x913e('0x6')](_0x913e('0x49'),_0x6198e8['dtlsprivatekey']||'/etc/pki/tls/private/motion.key');this[_0x913e('0x6')]('rtcp_mux',_0x913e('0x26'));break;default:}}},'permissions':{'type':Sequelize[_0x913e('0x3d')],'set':function(_0x501a94){this[_0x913e('0x6')](_0x913e('0x4d'),_0x501a94?_0x501a94[_0x913e('0x2b')](','):[]);},'get':function(){return this[_0x913e('0xd')](_0x913e('0x4d'))?_['map'](this[_0x913e('0xd')](_0x913e('0x4d'))[_0x913e('0x21')](','),function(_0x370983){return parseInt(_0x370983,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x913e('0x4')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x913e('0x4')]},'phoneBarBusyNumber':{'type':Sequelize[_0x913e('0x4')]},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x913e('0x16')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x913e('0x16')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x913e('0x16')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x913e('0x16')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x913e('0x15')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x913e('0x4')],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x913e('0x11')]('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize[_0x913e('0x16')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x913e('0x16')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x913e('0x4e')],'get':function(){return this[_0x913e('0xd')]('phoneBarEnableScreenRecordingByAgent')?this[_0x913e('0xd')]('phoneBarEnableScreenRecordingByAgent'):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x913e('0x16')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x913e('0x16')],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0x913e('0x4')],'defaultValue':null},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x913e('0x4')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize['STRING'],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x913e('0x16')],'defaultValue':![],'set':function(_0x9458){if(typeof _0x9458===_0x913e('0x4f')){var _0x313e5b=_0x9458==='1'?!![]:_0x9458==='0'?![]:_0x9458===_0x913e('0x50')?!![]:_0x9458===_0x913e('0x51')?![]:![];this[_0x913e('0x6')](_0x913e('0x52'),_0x313e5b);}else{this[_0x913e('0x6')](_0x913e('0x52'),_0x9458);}}},'blocked':{'type':Sequelize[_0x913e('0x16')],'defaultValue':![],'set':function(_0x41a54d){this[_0x913e('0x6')](_0x913e('0x53'),_0x41a54d);if(_0x41a54d===!![]){this[_0x913e('0x6')](_0x913e('0x54'),moment());this[_0x913e('0x6')](_0x913e('0x55'),0x0);}else{this['setDataValue'](_0x913e('0x54'),null);}}},'blockedAt':{'type':Sequelize[_0x913e('0x17')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x913e('0x15')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x913e('0x16')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x913e('0x15')](0x5)[_0x913e('0x56')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x913e('0x16')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x913e('0x16')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x913e('0x16')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x913e('0x16')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x913e('0x15')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x913e('0x16')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0x913e('0x15')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x913e('0x16')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x913e('0x16')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x913e('0x15')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x913e('0x15')],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize[_0x913e('0x16')],'defaultValue':![]}}; \ No newline at end of file +var _0x5b2b=['ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','shortinfo','inband','auto','yes','nonat','update','outgoing','nat','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','never','\x22\x22\x20<>','always','accept','refuse','uac','uas','fingerprint','certificate','active','update,nonat','TEXT','showWebBar','get','isArray','wss','encryption','avpf','force_avp','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','rtcp_mux','icesupport','actpass','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','blockedAt','loginAttempts','UNSIGNED','util','lodash','exports','STRING','name','setDataValue','defaultuser','fullname','format','getDataValue','email','admin','user','agent','telephone','local','INTEGER','internal','callerid','\x22%s\x22\x20<%s>','DATE','BOOLEAN','dynamic','ENUM','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN'];(function(_0x102977,_0x3a99a6){var _0x15c466=function(_0x1a6a12){while(--_0x1a6a12){_0x102977['push'](_0x102977['shift']());}};_0x15c466(++_0x3a99a6);}(_0x5b2b,0x15b));var _0xb5b2=function(_0x31ed73,_0xf1d9af){_0x31ed73=_0x31ed73-0x0;var _0xe43ce6=_0x5b2b[_0x31ed73];return _0xe43ce6;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');var util=require(_0xb5b2('0x0'));var _=require(_0xb5b2('0x1'));module[_0xb5b2('0x2')]={'name':{'type':Sequelize[_0xb5b2('0x3')],'allowNull':![],'unique':_0xb5b2('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x640b40){this['setDataValue'](_0xb5b2('0x4'),_0x640b40);this[_0xb5b2('0x5')](_0xb5b2('0x6'),_0x640b40);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x57bd1b){this[_0xb5b2('0x5')](_0xb5b2('0x7'),_0x57bd1b);this[_0xb5b2('0x5')]('callerid',util[_0xb5b2('0x8')]('\x22%s\x22\x20<%s>',_0x57bd1b,this[_0xb5b2('0x9')]('internal')));}},'alias':{'type':Sequelize[_0xb5b2('0x3')]},'email':{'type':Sequelize[_0xb5b2('0x3')],'allowNull':![],'unique':_0xb5b2('0xa'),'validate':{'isEmail':!![]},'set':function(_0x2ca3c6){if(_0x2ca3c6){this['setDataValue'](_0xb5b2('0xa'),_0x2ca3c6['toLowerCase']());}}},'role':{'type':Sequelize['ENUM'](_0xb5b2('0xb'),_0xb5b2('0xc'),_0xb5b2('0xd'),_0xb5b2('0xe')),'allowNull':![]},'password':{'type':Sequelize[_0xb5b2('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0xb5b2('0x3')],'defaultValue':_0xb5b2('0xf')},'internal':{'type':Sequelize[_0xb5b2('0x10')](0xb),'allowNull':![],'unique':'internal','set':function(_0x251b08){this['setDataValue'](_0xb5b2('0x11'),_0x251b08);this[_0xb5b2('0x5')]('accountcode',_0x251b08);this[_0xb5b2('0x5')](_0xb5b2('0x12'),util['format'](_0xb5b2('0x13'),this['getDataValue'](_0xb5b2('0x7')),_0x251b08));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xb5b2('0x3')]},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize[_0xb5b2('0x3')]},'userpic':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0xb5b2('0x3')]},'country':{'type':Sequelize[_0xb5b2('0x3')]},'online':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0xb5b2('0x14')]},'voicePause':{'type':Sequelize[_0xb5b2('0x15')],'defaultValue':![]},'chatPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'mailPause':{'type':Sequelize[_0xb5b2('0x15')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0xb5b2('0x15')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0xb5b2('0x15')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0xb5b2('0x15')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xb5b2('0x15')],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize[_0xb5b2('0x10')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0xb5b2('0x10')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0xb5b2('0x10')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0xb5b2('0x10')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0xb5b2('0x10')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xb5b2('0x15')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0xb5b2('0x15')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xb5b2('0x10')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0xb5b2('0x10')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xb5b2('0x10')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xb5b2('0x15')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0xb5b2('0x15')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0xb5b2('0x15')],'defaultValue':![]},'description':{'type':Sequelize[_0xb5b2('0x3')],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xb5b2('0x16')},'ipaddr':{'type':Sequelize[_0xb5b2('0x3')],'allowNull':!![]},'port':{'type':Sequelize[_0xb5b2('0x10')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0xb5b2('0x10')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0xb5b2('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize[_0xb5b2('0x3')],'allowNull':!![]},'useragent':{'type':Sequelize['STRING'],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xb5b2('0x17')](_0xb5b2('0x18'),_0xb5b2('0xc'),_0xb5b2('0x19')),'allowNull':!![],'defaultValue':_0xb5b2('0x18')},'context':{'type':Sequelize[_0xb5b2('0x3')],'allowNull':!![],'defaultValue':_0xb5b2('0x1a')},'callingpres':{'type':Sequelize[_0xb5b2('0x17')](_0xb5b2('0x1b'),_0xb5b2('0x1c'),_0xb5b2('0x1d'),_0xb5b2('0x1e'),_0xb5b2('0x1f'),'PROHIB_PASSED_SCREEN',_0xb5b2('0x20'),_0xb5b2('0x21')),'allowNull':!![]},'deny':{'type':Sequelize[_0xb5b2('0x3')],'allowNull':!![]},'permit':{'type':Sequelize[_0xb5b2('0x3')],'allowNull':!![]},'secret':{'type':Sequelize['STRING'],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0xb5b2('0x3')],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xb5b2('0x22'),'set':function(_0x4080ba){this[_0xb5b2('0x5')](_0xb5b2('0x23'),_0x4080ba?_0x4080ba[_0xb5b2('0x24')](','):null);},'get':function(){return this[_0xb5b2('0x9')]('transport')?this[_0xb5b2('0x9')](_0xb5b2('0x23'))['split'](','):null;},'comment':_0xb5b2('0x25')},'dtmfmode':{'type':Sequelize[_0xb5b2('0x17')](_0xb5b2('0x26'),'info',_0xb5b2('0x27'),_0xb5b2('0x28'),_0xb5b2('0x29')),'allowNull':!![],'defaultValue':_0xb5b2('0x26')},'directmedia':{'type':Sequelize[_0xb5b2('0x17')](_0xb5b2('0x2a'),'no',_0xb5b2('0x2b'),_0xb5b2('0x2c'),_0xb5b2('0x2d')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xb5b2('0x17')](_0xb5b2('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xb5b2('0x3')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xb5b2('0x3')],'allowNull':!![]},'nat':{'type':Sequelize[_0xb5b2('0x3')],'allowNull':!![],'defaultValue':'force_rport,comedia','set':function(_0x2351f3){this[_0xb5b2('0x5')](_0xb5b2('0x2e'),_0x2351f3?_0x2351f3['join'](','):null);},'get':function(){return this[_0xb5b2('0x9')](_0xb5b2('0x2e'))?this['getDataValue'](_0xb5b2('0x2e'))[_0xb5b2('0x2f')](','):null;},'comment':_0xb5b2('0x30')},'callgroup':{'type':Sequelize[_0xb5b2('0x3')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0xb5b2('0x3')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING']},'disallow':{'type':Sequelize[_0xb5b2('0x3')],'allowNull':![],'defaultValue':_0xb5b2('0x31')},'allow':{'type':Sequelize[_0xb5b2('0x3')],'allowNull':![],'defaultValue':_0xb5b2('0x32'),'set':function(_0x11ca62){this[_0xb5b2('0x5')](_0xb5b2('0x33'),_0x11ca62?_0x11ca62[_0xb5b2('0x24')](';'):_0xb5b2('0x32'));},'get':function(){return this[_0xb5b2('0x9')]('allow')?this['getDataValue'](_0xb5b2('0x33'))[_0xb5b2('0x2f')](';'):null;},'comment':_0xb5b2('0x34')},'autoframing':{'type':Sequelize[_0xb5b2('0x17')](_0xb5b2('0x2a'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0xb5b2('0x3')],'allowNull':!![],'set':function(_0x33dba0){this[_0xb5b2('0x5')](_0xb5b2('0x35'),_0x33dba0?_0x33dba0[_0xb5b2('0x24')](','):null);},'get':function(){return this[_0xb5b2('0x9')](_0xb5b2('0x35'))?this[_0xb5b2('0x9')](_0xb5b2('0x35'))[_0xb5b2('0x2f')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0xb5b2('0x17')](_0xb5b2('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xb5b2('0x17')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xb5b2('0x17')](_0xb5b2('0x2a'),'no',_0xb5b2('0x36')),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM'](_0xb5b2('0x2a'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM'](_0xb5b2('0x2a'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0xb5b2('0x10')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0xb5b2('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xb5b2('0x37')},'amaflags':{'type':Sequelize[_0xb5b2('0x3')],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM'](_0xb5b2('0x2a'),'no'),'allowNull':!![],'defaultValue':_0xb5b2('0x2a')},'busylevel':{'type':Sequelize[_0xb5b2('0x10')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xb5b2('0x17')](_0xb5b2('0x2a'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0xb5b2('0x2a'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0xb5b2('0x17')](_0xb5b2('0x2a'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0xb5b2('0x3')],'allowNull':!![]},'template':{'type':Sequelize[_0xb5b2('0x3')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xb5b2('0x17')]('yes','no',_0xb5b2('0x38')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM'](_0xb5b2('0x2a'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xb5b2('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0xb5b2('0x17')](_0xb5b2('0x39'),_0xb5b2('0x3a'),'originate'),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xb5b2('0x10')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0xb5b2('0x10')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize['ENUM'](_0xb5b2('0x3b'),_0xb5b2('0x3c')),'allowNull':!![],'defaultValue':_0xb5b2('0x3c')},'t38pt_usertpsource':{'type':Sequelize[_0xb5b2('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0xb5b2('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0xb5b2('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize['STRING'],'allowNull':!![]},'qualify':{'type':Sequelize[_0xb5b2('0x17')]('yes','no'),'allowNull':!![],'defaultValue':_0xb5b2('0x2a')},'keepalive':{'type':Sequelize[_0xb5b2('0x10')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0xb5b2('0x10')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xb5b2('0x10')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xb5b2('0x10')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0xb5b2('0x17')](_0xb5b2('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xb5b2('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0xb5b2('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0xb5b2('0x10')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xb5b2('0x10')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xb5b2('0x10')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize['STRING'],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xb5b2('0x3')],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xb5b2('0x3')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0xb5b2('0x3')],'allowNull':!![]},'maxforwards':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0xb5b2('0x17')](_0xb5b2('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xb5b2('0x17')](_0xb5b2('0x2a'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xb5b2('0x17')](_0xb5b2('0x2a'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM'](_0xb5b2('0x2a'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xb5b2('0x17')](_0xb5b2('0x2a'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0xb5b2('0x17')](_0xb5b2('0x2a'),'no',_0xb5b2('0x3d'),_0xb5b2('0x3e')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0xb5b2('0x10')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xb5b2('0x3')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0xb5b2('0x3')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xb5b2('0x3')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xb5b2('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize['ENUM'](_0xb5b2('0x3f'),'passive','actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xb5b2('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM'](_0xb5b2('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xb5b2('0x3')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0xb5b2('0x3')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0xb5b2('0x10')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0xb5b2('0x17')]('yes','no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xb5b2('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xb5b2('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0xb5b2('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xb5b2('0x3')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0xb5b2('0x17')](_0xb5b2('0x2a'),'no',_0xb5b2('0x2b'),_0xb5b2('0x2c'),_0xb5b2('0x40')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0xb5b2('0x15')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xb5b2('0x3')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0xb5b2('0x14')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0xb5b2('0x41')]},'showWebBar':{'type':Sequelize[_0xb5b2('0x10')],'defaultValue':0x0,'set':function(_0xb3f4be){this[_0xb5b2('0x5')](_0xb5b2('0x42'),_0xb3f4be);var _0x4d2e7a=this[_0xb5b2('0x43')]({'plain':!![]});switch(_0xb3f4be){case 0x0:case 0x1:var _0x4062d9=_0x4d2e7a[_0xb5b2('0x23')]?_[_0xb5b2('0x44')](_0x4d2e7a[_0xb5b2('0x23')])?_0x4d2e7a['transport'][_0xb5b2('0x24')]():_0x4d2e7a[_0xb5b2('0x23')]:_0xb5b2('0x22');if(_0x4062d9===_0xb5b2('0x45')){_0x4062d9=_0xb5b2('0x22');}this['setDataValue']('transport',_0x4062d9);this['setDataValue'](_0xb5b2('0x46'),'no');this[_0xb5b2('0x5')](_0xb5b2('0x47'),null);this[_0xb5b2('0x5')](_0xb5b2('0x48'),null);this[_0xb5b2('0x5')]('icesupport',null);this['setDataValue']('dtlsenable',null);this['setDataValue'](_0xb5b2('0x49'),null);this['setDataValue'](_0xb5b2('0x4a'),null);this[_0xb5b2('0x5')](_0xb5b2('0x4b'),null);this[_0xb5b2('0x5')](_0xb5b2('0x4c'),null);this[_0xb5b2('0x5')](_0xb5b2('0x4d'),'no');break;case 0x2:this[_0xb5b2('0x5')](_0xb5b2('0x23'),'wss');this[_0xb5b2('0x5')](_0xb5b2('0x46'),'yes');this['setDataValue'](_0xb5b2('0x47'),'yes');this['setDataValue'](_0xb5b2('0x48'),_0xb5b2('0x2a'));this[_0xb5b2('0x5')](_0xb5b2('0x4e'),_0xb5b2('0x2a'));this[_0xb5b2('0x5')]('dtlsenable','yes');this[_0xb5b2('0x5')](_0xb5b2('0x49'),'no');this['setDataValue'](_0xb5b2('0x4a'),_0xb5b2('0x4f'));this[_0xb5b2('0x5')](_0xb5b2('0x4b'),_0x4d2e7a['dtlscertfile']||_0xb5b2('0x50'));this[_0xb5b2('0x5')](_0xb5b2('0x4c'),_0x4d2e7a[_0xb5b2('0x4c')]||_0xb5b2('0x51'));this['setDataValue']('rtcp_mux',_0xb5b2('0x2a'));break;default:}}},'permissions':{'type':Sequelize[_0xb5b2('0x41')],'set':function(_0x5d9326){this[_0xb5b2('0x5')](_0xb5b2('0x52'),_0x5d9326?_0x5d9326[_0xb5b2('0x24')](','):[]);},'get':function(){return this[_0xb5b2('0x9')](_0xb5b2('0x52'))?_[_0xb5b2('0x53')](this[_0xb5b2('0x9')](_0xb5b2('0x52'))[_0xb5b2('0x2f')](','),function(_0x2a4519){return parseInt(_0x2a4519,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0xb5b2('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0xb5b2('0x3')]},'phoneBarBusyNumber':{'type':Sequelize[_0xb5b2('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0xb5b2('0x15')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xb5b2('0x15')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xb5b2('0x10')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0xb5b2('0x3')],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xb5b2('0x17')]('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0xb5b2('0x15')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0xb5b2('0x3')]},'phoneBarEnableJaws':{'type':Sequelize[_0xb5b2('0x15')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0xb5b2('0x15')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xb5b2('0x54')],'get':function(){return this[_0xb5b2('0x9')](_0xb5b2('0x55'))?this[_0xb5b2('0x9')]('phoneBarEnableScreenRecordingByAgent'):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0xb5b2('0x15')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xb5b2('0x15')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0xb5b2('0x15')],'defaultValue':![]},'interface':{'type':Sequelize[_0xb5b2('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0xb5b2('0x15')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0xb5b2('0x3')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xb5b2('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0xb5b2('0x15')],'defaultValue':![],'set':function(_0x327ce9){if(typeof _0x327ce9===_0xb5b2('0x56')){var _0x7a1547=_0x327ce9==='1'?!![]:_0x327ce9==='0'?![]:_0x327ce9===_0xb5b2('0x57')?!![]:_0x327ce9===_0xb5b2('0x58')?![]:![];this['setDataValue'](_0xb5b2('0x59'),_0x7a1547);}else{this[_0xb5b2('0x5')]('screenrecording',_0x327ce9);}}},'blocked':{'type':Sequelize[_0xb5b2('0x15')],'defaultValue':![],'set':function(_0x3155be){this[_0xb5b2('0x5')](_0xb5b2('0x5a'),_0x3155be);if(_0x3155be===!![]){this[_0xb5b2('0x5')](_0xb5b2('0x5b'),moment());this[_0xb5b2('0x5')](_0xb5b2('0x5c'),0x0);}else{this[_0xb5b2('0x5')]('blockedAt',null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0xb5b2('0x10')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xb5b2('0x15')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize['INTEGER'](0x5)[_0xb5b2('0x5d')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0xb5b2('0x15')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xb5b2('0x15')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xb5b2('0x15')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0xb5b2('0x15')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0xb5b2('0x15')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0xb5b2('0x15')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0xb5b2('0x15')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0xb5b2('0x15')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0xb5b2('0x10')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0xb5b2('0x15')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0xb5b2('0x10')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0xb5b2('0x15')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0xb5b2('0x15')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0xb5b2('0x15')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 248f2ae..ff78d34 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 _0xcf50=['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','removeWhatsappInteractions','VoicePrefix','getVoicePrefixes','FaxAccount','getFaxAccounts','addFaxAccounts','removeFaxAccounts','MailAccount','getMailAccounts','addMailAccounts','removeMailAccounts','OpenchannelAccount','getOpenchannelAccounts','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','CmHopper','$and','$gt','$gte','$lt','$lte','$ne','$eq','$not','$between','$like','$notLike','$iLike','$notILike','$overlap','$contains','$any','firstName','lastName','CmContact','dialActive','retrieveApiKey','token','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','generateApiKey','iat','nonce','removeApiKey','apiKeyNonce','Unable\x20to\x20retrieve\x20the\x20current\x20user','getUserSetting','getPresence','unknown','queues','inbound','flatten','lower','col','asc','desc','uniqBy','orderBy','getRealtimeAgents','voiceStatus','unavailable','busy','slice','toUpperCase','field','InteractionId','user_has_','toString','OpenTabs','messengerSoundNotification','enabled','util','path','lodash','squel','ioredis','../../components/auth/service','../../components/contacts','../../components/parsers/qs','../../components/realtime/agents','../../config/logger','../../config/license/util','../../errors/api','APINotFoundError','handleError','../../mysqldb','socket.io-emitter','./user.socket','register','redis','defaults','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','then','role','emit','destroy','get','admin','Users','user','Agents','Telephones','telephone','filter','map','value','includes','find','name','error','stack','send','User','fieldName','type','key','password','resetPasswordToken','resetPasswordExpires','md5secret','getOptions','query','includeAll','include','userSetting','UserSetting','attributes','findAll','rows','openTabs','true','length','push','chat','dataValues','fax','mail','openchannel','all','catch','show','params','options','sms','whatsapp','update','body','describe','ids','omit','internal','findById','securePassword','isNil','min_internal','sequelize','SELECT','mailbox','VoiceMail','fullname','agent','102','113','110','104','105','106','107','108','109','100','111','115','create','Unauthorized','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','checkUserLimits','settingsEnabled','userProfileId','autoAssociation','UserProfileResource','bulkCreate','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','UserProfileSection','isEmpty','compact','oldPassword','Sequelize','authenticate','ValidationError','Wrong\x20credentials','newPassword','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','Setting','findOne','passwordHistoryLimit','validatePasswordPattern','enforcePasswordHistory','validatePasswordHistory','previousPasswords','updatePasswordsHistory','channel','online','loginInPause','voicePause','interface','isValidChannel','Unknown\x20channel','add','capitalize','Queues','penalty','spread','QueueId','toLowerCase','Queue:save','voice','VoiceQueue','format','remove','isArray','Queue:remove','UserVoiceQueueRt','addAvatar','file','getAvatar','join','root','server/files/images/logos/default_profile.png','userpic','existsSync','download','server/files/images/','getOpenTabs','ChatOpenTabs','FaxOpenTabs','FAX','createdAt','OpenchannelOpenTabs','OPENCHANNEL','MAIL','SMS','WhatsappOpenTabs','concat','User\x20with\x20id\x20%s\x20not\x20found','hasOwnProperty','List','Tag','Tags','color','tag','getQueues','keys','Queue','rawAttributes','intersection','model','fields','order','sort','where','filters','merge','Unknown\x20role','nolimit','getVoiceQueuesRt','pick','getGroups','ChatGroup','getRecordings','VoiceRecording','getScreenRecordings','UserId','ScreenRecording','getChatInteractions','getOpenchannelInteractions','OpenchannelInteraction','getMailInteractions','MailInteraction','getSmsInteractions','SmsInteraction','getFaxInteractions','FaxInteraction','getWhatsappInteractions','phone','mobile','SIP/%s','user:%s','headers','connection','remoteAddress','socket','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','UserVoiceQueue.penalty','upsert','MemberReport','forEach','YYYY-MM-DD\x20HH:mm:ss','getChannels','LOGIN','device','PAUSE','LOGININPAUSE','isMiddleware','resolve','logout','pause','updateAttributes','DEFAULT\x20PAUSE','Channel\x20parameter\x20%s\x20is\x20invalid','mailPause','chatPause','openchannelPause','pauseType','lastPauseAt','unpause','getTeams','Team','Body\x20parameter\x20\x27ids\x27\x20is\x20required','addTeams','getAssociatedQueues','flattenDeep','getDataValue','TeamVoicePrefix','VoicePrefixId','Query\x20parameter\x20\x27ids\x27\x20is\x20required','transaction','removeTeams','removeAgent','getLists','getAgents','values','addChatInteractions','removeChatInteractions','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions'];(function(_0x21a30e,_0x375620){var _0x5f00bd=function(_0x4b1d0e){while(--_0x4b1d0e){_0x21a30e['push'](_0x21a30e['shift']());}};_0x5f00bd(++_0x375620);}(_0xcf50,0x1d4));var _0x0cf5=function(_0xb5651e,_0x483971){_0xb5651e=_0xb5651e-0x0;var _0x48e6f4=_0xcf50[_0xb5651e];return _0x48e6f4;};'use strict';var moment=require('moment');var util=require(_0x0cf5('0x0'));var path=require(_0x0cf5('0x1'));var fs=require('fs');var _=require(_0x0cf5('0x2'));var squel=require(_0x0cf5('0x3'));var Redis=require(_0x0cf5('0x4'));var authService=require(_0x0cf5('0x5'));var contacts=require(_0x0cf5('0x6'));var qs=require(_0x0cf5('0x7'));var rta=require(_0x0cf5('0x8'));var logger=require(_0x0cf5('0x9'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0cf5('0xa'));var APIBadRequestError=require('../../errors/api')['APIBadRequestError'];var APINotFoundError=require(_0x0cf5('0xb'))[_0x0cf5('0xc')];var APIHandleError=require('../../errors/api')[_0x0cf5('0xd')];var db=require(_0x0cf5('0xe'))['db'];var socket=require(_0x0cf5('0xf'))(new Redis(config['redis']));require(_0x0cf5('0x10'))[_0x0cf5('0x11')](socket);config[_0x0cf5('0x12')]=_[_0x0cf5('0x13')](config['redis'],{'host':'localhost','port':0x18eb});var values;function respondWithStatusCode(_0x1819cd,_0x415139){_0x415139=_0x415139||0xcc;return function(_0x3eb494){if(_0x3eb494){return _0x1819cd[_0x0cf5('0x14')](_0x415139);}return _0x1819cd[_0x0cf5('0x15')](_0x415139)[_0x0cf5('0x16')]();};}function respondWithResult(_0x211a11,_0x6823ad){_0x6823ad=_0x6823ad||0xc8;return function(_0x1aa7cd){if(_0x1aa7cd){return _0x211a11['status'](_0x6823ad)[_0x0cf5('0x17')](_0x1aa7cd);}};}function respondWithFilteredResult(_0x5c0a5c,_0x1b8d47){return function(_0x5bf54c){if(_0x5bf54c){var _0x2385e1=typeof _0x1b8d47[_0x0cf5('0x18')]===_0x0cf5('0x19')&&typeof _0x1b8d47['limit']===_0x0cf5('0x19');var _0x3d90bf=_0x5bf54c[_0x0cf5('0x1a')];var _0x9cc977=_0x2385e1?0x0:_0x1b8d47[_0x0cf5('0x18')];var _0x5749f9=_0x2385e1?_0x5bf54c['count']:_0x1b8d47[_0x0cf5('0x18')]+_0x1b8d47[_0x0cf5('0x1b')];var _0x262350;if(_0x5749f9>=_0x3d90bf){_0x5749f9=_0x3d90bf;_0x262350=0xc8;}else{_0x262350=0xce;}_0x5c0a5c[_0x0cf5('0x15')](_0x262350);return _0x5c0a5c[_0x0cf5('0x1c')](_0x0cf5('0x1d'),_0x9cc977+'-'+_0x5749f9+'/'+_0x3d90bf)[_0x0cf5('0x17')](_0x5bf54c);}return null;};}function saveUpdates(_0x3287f1){return function(_0x2b0486){if(_0x2b0486){return _0x2b0486['update'](_0x3287f1)[_0x0cf5('0x1e')](function(_0x2ed4d9){if(_0x2ed4d9[_0x0cf5('0x1f')]==='agent'){socket[_0x0cf5('0x20')]('userNotification:recalc:'+_0x2ed4d9['id'],_0x2ed4d9);}return _0x2ed4d9;});}return null;};}function removeEntity(_0x848ae3){return function(_0x7380c4){if(_0x7380c4){return _0x7380c4[_0x0cf5('0x21')]()[_0x0cf5('0x1e')](function(){var _0x2eb9af=_0x7380c4[_0x0cf5('0x22')]({'plain':!![]});if(_0x2eb9af[_0x0cf5('0x1f')]===_0x0cf5('0x23'))return;var _0x262f29=[{'name':_0x0cf5('0x24'),'value':_0x0cf5('0x25'),'ignore':!![]},{'name':_0x0cf5('0x26'),'value':'agent','ignore':![]},{'name':_0x0cf5('0x27'),'value':_0x0cf5('0x28'),'ignore':![]}];var _0x455355=_(_0x262f29)[_0x0cf5('0x29')]('ignore')[_0x0cf5('0x2a')]('value')[_0x0cf5('0x2b')]();if(_[_0x0cf5('0x2c')](_0x455355,_0x2eb9af[_0x0cf5('0x1f')])){return;}var _0x3bc5d8=_[_0x0cf5('0x2d')](_0x262f29,[_0x0cf5('0x2b'),_0x2eb9af[_0x0cf5('0x1f')]])[_0x0cf5('0x2e')];return db['UserProfileResource']['destroy']({'where':{'type':_0x3bc5d8,'resourceId':_0x2eb9af['id']}})[_0x0cf5('0x1e')](function(){return _0x7380c4;});})[_0x0cf5('0x1e')](function(){_0x848ae3['status'](0xcc)[_0x0cf5('0x16')]();});}};}function handleEntityNotFound(_0x3af83e){return function(_0x1d1768){if(!_0x1d1768){_0x3af83e['sendStatus'](0x194);}return _0x1d1768;};}function handleError(_0x58cd62,_0x1148aa){_0x1148aa=_0x1148aa||0x1f4;return function(_0x10f464){logger[_0x0cf5('0x2f')](_0x10f464[_0x0cf5('0x30')]);if(_0x10f464[_0x0cf5('0x2e')]){delete _0x10f464[_0x0cf5('0x2e')];}_0x58cd62['status'](_0x1148aa)[_0x0cf5('0x31')](_0x10f464);};}function getUserAttributes(){return _(db[_0x0cf5('0x32')]['rawAttributes'])['map'](function(_0x10dd43){return{'name':_0x10dd43[_0x0cf5('0x33')],'type':_0x10dd43[_0x0cf5('0x34')][_0x0cf5('0x35')]};})[_0x0cf5('0x29')](function(_0x4328e2){return![_0x0cf5('0x36'),'salt','previousPasswords',_0x0cf5('0x37'),_0x0cf5('0x38'),_0x0cf5('0x39')]['includes'](_0x4328e2[_0x0cf5('0x2e')]);})[_0x0cf5('0x2b')]();}exports['index']=function(_0x377741,_0x4926ac){var _0x16f0a7={},_0x5b7c36={'count':0x0,'rows':[]};var _0x4b7992=getUserAttributes();_0x16f0a7=qs[_0x0cf5('0x3a')](_0x4b7992,_0x377741);var _0x4ded26={'where':_0x16f0a7['where']};return db[_0x0cf5('0x32')][_0x0cf5('0x1a')](_0x4ded26)['then'](function(_0x245c4b){_0x5b7c36[_0x0cf5('0x1a')]=_0x245c4b;if(_0x377741[_0x0cf5('0x3b')][_0x0cf5('0x3c')]){_0x16f0a7[_0x0cf5('0x3d')]=[{'all':!![]}];}if(_0x377741[_0x0cf5('0x3b')][_0x0cf5('0x3e')]==='true'){_0x16f0a7[_0x0cf5('0x3d')]=[{'model':db[_0x0cf5('0x3f')],'as':'userSetting'}];}if(!_[_0x0cf5('0x2c')](_0x16f0a7[_0x0cf5('0x40')],'id')){_0x16f0a7[_0x0cf5('0x40')]['push']('id');}return db[_0x0cf5('0x32')][_0x0cf5('0x41')](_0x16f0a7);})[_0x0cf5('0x1e')](function(_0x36d39a){_0x5b7c36[_0x0cf5('0x42')]=_0x36d39a;if(_0x377741[_0x0cf5('0x3b')][_0x0cf5('0x43')]===_0x0cf5('0x44')){var _0x31e99c=[];for(var _0x539268=0x0;_0x539268<_0x5b7c36[_0x0cf5('0x42')][_0x0cf5('0x45')];_0x539268++){_0x31e99c[_0x0cf5('0x46')](get_open_tabs(_0x0cf5('0x47'),_0x5b7c36[_0x0cf5('0x42')][_0x539268][_0x0cf5('0x48')]));_0x31e99c[_0x0cf5('0x46')](get_open_tabs('sms',_0x5b7c36[_0x0cf5('0x42')][_0x539268][_0x0cf5('0x48')]));_0x31e99c[_0x0cf5('0x46')](get_open_tabs(_0x0cf5('0x49'),_0x5b7c36[_0x0cf5('0x42')][_0x539268][_0x0cf5('0x48')]));_0x31e99c[_0x0cf5('0x46')](get_open_tabs(_0x0cf5('0x4a'),_0x5b7c36['rows'][_0x539268][_0x0cf5('0x48')]));_0x31e99c[_0x0cf5('0x46')](get_open_tabs(_0x0cf5('0x4b'),_0x5b7c36[_0x0cf5('0x42')][_0x539268][_0x0cf5('0x48')]));_0x31e99c[_0x0cf5('0x46')](get_open_tabs('whatsapp',_0x5b7c36[_0x0cf5('0x42')][_0x539268][_0x0cf5('0x48')]));}return Promise[_0x0cf5('0x4c')](_0x31e99c)[_0x0cf5('0x1e')](function(){return _0x5b7c36;});}else{return _0x5b7c36;}})[_0x0cf5('0x1e')](respondWithFilteredResult(_0x4926ac,_0x16f0a7))[_0x0cf5('0x4d')](handleError(_0x4926ac,null));};exports[_0x0cf5('0x4e')]=function(_0x21c1bd,_0x207156){var _0x52030a=getUserAttributes();_0x21c1bd[_0x0cf5('0x3b')]['id']=_0x21c1bd[_0x0cf5('0x4f')]['id'];var _0x2f7827=qs['getOptions'](_0x52030a,_0x21c1bd);if(_0x21c1bd['query'][_0x0cf5('0x3c')]){_0x2f7827['include']=[{'all':!![]}];}if(_0x21c1bd[_0x0cf5('0x3b')]['userSetting']===_0x0cf5('0x44')){_0x2f7827['include']=[{'model':db[_0x0cf5('0x3f')],'as':'userSetting'}];}_0x2f7827=_['merge']({},_0x2f7827,_0x21c1bd[_0x0cf5('0x50')]);if(!_[_0x0cf5('0x2c')](_0x2f7827[_0x0cf5('0x40')],'id')){_0x2f7827[_0x0cf5('0x40')]['push']('id');}return db[_0x0cf5('0x32')]['find'](_0x2f7827)[_0x0cf5('0x1e')](handleEntityNotFound(_0x207156,null))['then'](function(_0x4d4667){var _0x1f7f86=[];values=_0x4d4667;if(_0x21c1bd[_0x0cf5('0x3b')][_0x0cf5('0x43')]===_0x0cf5('0x44')){_0x1f7f86[_0x0cf5('0x46')](get_open_tabs('chat',_0x4d4667['dataValues']));_0x1f7f86[_0x0cf5('0x46')](get_open_tabs(_0x0cf5('0x51'),_0x4d4667[_0x0cf5('0x48')]));_0x1f7f86[_0x0cf5('0x46')](get_open_tabs(_0x0cf5('0x4b'),_0x4d4667['dataValues']));_0x1f7f86[_0x0cf5('0x46')](get_open_tabs(_0x0cf5('0x52'),_0x4d4667[_0x0cf5('0x48')]));_0x1f7f86['push'](get_open_tabs('fax',_0x4d4667[_0x0cf5('0x48')]));_0x1f7f86[_0x0cf5('0x46')](get_open_tabs(_0x0cf5('0x4a'),_0x4d4667[_0x0cf5('0x48')]));return Promise[_0x0cf5('0x4c')](_0x1f7f86);}else{return values;}})[_0x0cf5('0x1e')](function(){return values;})[_0x0cf5('0x1e')](respondWithResult(_0x207156,null))[_0x0cf5('0x4d')](handleError(_0x207156,null));};exports[_0x0cf5('0x53')]=function(_0xc4bc04,_0x2182cc){if(_0xc4bc04[_0x0cf5('0x54')]['id']){delete _0xc4bc04['body']['id'];}delete _0xc4bc04[_0x0cf5('0x54')]['role'];return db[_0x0cf5('0x32')]['find']({'where':{'id':_0xc4bc04[_0x0cf5('0x4f')]['id']}})['then'](handleEntityNotFound(_0x2182cc,null))[_0x0cf5('0x1e')](saveUpdates(_0xc4bc04[_0x0cf5('0x54')],null))[_0x0cf5('0x1e')](respondWithResult(_0x2182cc,null))[_0x0cf5('0x4d')](handleError(_0x2182cc,null));};exports[_0x0cf5('0x55')]=function(_0x1fa55b,_0x43fd98){return db[_0x0cf5('0x32')][_0x0cf5('0x55')]()[_0x0cf5('0x1e')](respondWithResult(_0x43fd98,null))['catch'](handleError(_0x43fd98,null));};exports['addContacts']=function(_0x5d70ac,_0x2cf4f0){return db[_0x0cf5('0x32')][_0x0cf5('0x2d')]({'where':{'id':_0x5d70ac['params']['id']}})[_0x0cf5('0x1e')](handleEntityNotFound(_0x2cf4f0,null))['then'](function(_0x58e1fe){if(_0x58e1fe){return _0x58e1fe['addContacts'](_0x5d70ac[_0x0cf5('0x54')][_0x0cf5('0x56')],_[_0x0cf5('0x57')](_0x5d70ac[_0x0cf5('0x54')],[_0x0cf5('0x56'),'id'])||{});}})[_0x0cf5('0x1e')](respondWithResult(_0x2cf4f0,null))[_0x0cf5('0x4d')](handleError(_0x2cf4f0,null));};function validateUser(_0x56d28d){return new Promise(function(_0x3571e6,_0x2c1f61){if(_0x56d28d[_0x0cf5('0x58')])return _0x3571e6(_0x56d28d);return db['Setting'][_0x0cf5('0x59')](0x1)[_0x0cf5('0x1e')](function(_0x316de3){if(_0x316de3[_0x0cf5('0x5a')])authService['validatePasswordPattern'](_0x56d28d[_0x0cf5('0x36')]);db[_0x0cf5('0x32')]['max'](_0x0cf5('0x58'))[_0x0cf5('0x1e')](function(_0x1d2902){if(_[_0x0cf5('0x5b')](_0x1d2902)){_0x56d28d[_0x0cf5('0x58')]=_0x316de3[_0x0cf5('0x5c')]||0x1;return;}if(_[_0x0cf5('0x5b')](_0x316de3[_0x0cf5('0x5c')])||_0x316de3[_0x0cf5('0x5c')]===_0x1d2902){_0x56d28d['internal']=_0x1d2902+0x1;return;}if(_0x316de3[_0x0cf5('0x5c')]>_0x1d2902){_0x56d28d['internal']=_0x316de3[_0x0cf5('0x5c')];return;}return db[_0x0cf5('0x5d')][_0x0cf5('0x3b')]('select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)',{'type':db[_0x0cf5('0x5d')]['QueryTypes'][_0x0cf5('0x5e')]})[_0x0cf5('0x1e')](function(_0xd2f414){if(_0xd2f414&&_0xd2f414['length']){for(var _0x2a458b=0x0,_0x276ba6=_0xd2f414[_0x0cf5('0x45')];_0x2a458b<_0x276ba6&&_[_0x0cf5('0x5b')](_0x56d28d[_0x0cf5('0x58')]);_0x2a458b++){if(_0x316de3[_0x0cf5('0x5c')]<=_0xd2f414[_0x2a458b]['from']){_0x56d28d[_0x0cf5('0x58')]=_0xd2f414[_0x2a458b]['from'];}else if(_0x316de3[_0x0cf5('0x5c')]>_0xd2f414[_0x2a458b]['from']&&_0x316de3['min_internal']<=_0xd2f414[_0x2a458b]['to']){_0x56d28d['internal']=_0x316de3[_0x0cf5('0x5c')];}}}if(_[_0x0cf5('0x5b')](_0x56d28d['internal'])){_0x56d28d[_0x0cf5('0x58')]=_0x1d2902+0x1;}return _0x3571e6(_0x56d28d);});});})[_0x0cf5('0x4d')](function(_0x279fce){_0x2c1f61(_0x279fce);});});}function updateUser(_0xd41090){return new Promise(function(_0x4da57f,_0x180b84){try{if(_0xd41090['voicemail']){_0xd41090[_0x0cf5('0x5f')]=_0xd41090['internal'];_0xd41090[_0x0cf5('0x60')]={'mailbox':_0xd41090['internal'],'password':_0xd41090[_0x0cf5('0x36')],'fullname':_0xd41090[_0x0cf5('0x61')],'email':_0xd41090['email']};}if(_0xd41090[_0x0cf5('0x1f')]===_0x0cf5('0x62')){if(!_0xd41090['permissions'])_0xd41090['permissions']=['101',_0x0cf5('0x63'),'103',_0x0cf5('0x64'),_0x0cf5('0x65'),_0x0cf5('0x66'),_0x0cf5('0x67'),_0x0cf5('0x68'),_0x0cf5('0x69'),_0x0cf5('0x6a'),_0x0cf5('0x6b'),_0x0cf5('0x6c'),_0x0cf5('0x6d'),'114',_0x0cf5('0x6e')];}_0x4da57f(_0xd41090);}catch(_0x188e95){_0x180b84(_0x188e95);}});}exports[_0x0cf5('0x6f')]=function(_0x1eaecb,_0x3b0a3f){if(_0x1eaecb[_0x0cf5('0x25')][_0x0cf5('0x1f')]==='agent')throw new Error(_0x0cf5('0x70'));if(_0x1eaecb[_0x0cf5('0x54')]['role']===_0x0cf5('0x25')&&_0x1eaecb[_0x0cf5('0x25')][_0x0cf5('0x1f')]!==_0x0cf5('0x23')){throw new Error(_0x0cf5('0x71'));}if(_0x1eaecb[_0x0cf5('0x54')][_0x0cf5('0x1f')]===_0x0cf5('0x23')&&_0x1eaecb[_0x0cf5('0x25')][_0x0cf5('0x1f')]!=='admin'){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator');}return licenseUtil[_0x0cf5('0x72')]([_0x1eaecb[_0x0cf5('0x54')]])[_0x0cf5('0x1e')](function(){return validateUser(_0x1eaecb[_0x0cf5('0x54')]);})[_0x0cf5('0x1e')](function(_0x34d549){return updateUser(_0x34d549)[_0x0cf5('0x1e')](function(_0x487f4a){if(_0x487f4a[_0x0cf5('0x1f')]===_0x0cf5('0x23')){_0x487f4a[_0x0cf5('0x73')]=_0x1eaecb[_0x0cf5('0x25')][_0x0cf5('0x73')];delete _0x487f4a[_0x0cf5('0x74')];}return _0x487f4a;});})[_0x0cf5('0x1e')](function(_0x4a5a17){return db[_0x0cf5('0x32')]['create'](_0x4a5a17,{'include':[{'model':db[_0x0cf5('0x60')],'as':_0x0cf5('0x60')}]});})[_0x0cf5('0x1e')](function(_0xa12cbe){if(_0x1eaecb[_0x0cf5('0x54')]['role']===_0x0cf5('0x25'))return _0xa12cbe;if(_0x1eaecb[_0x0cf5('0x25')][_0x0cf5('0x1f')]!=='user')return _0xa12cbe;return db['UserProfileSection'][_0x0cf5('0x2d')]({'where':{'name':_0xa12cbe[_0x0cf5('0x1f')]===_0x0cf5('0x62')?'Agents':'Telephones','userProfileId':_0x1eaecb[_0x0cf5('0x25')][_0x0cf5('0x74')]},'raw':!![]})['then'](function(_0x542945){if(!_0x542945||_0x542945[_0x0cf5('0x75')]!=0x0)return _0xa12cbe;return db[_0x0cf5('0x76')][_0x0cf5('0x6f')]({'name':_0xa12cbe[_0x0cf5('0x2e')],'resourceId':_0xa12cbe['id'],'type':_0x542945[_0x0cf5('0x2e')],'sectionId':_0x542945['id']},{})[_0x0cf5('0x1e')](function(){return _0xa12cbe;});})[_0x0cf5('0x4d')](function(_0x3c31ef){logger[_0x0cf5('0x2f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3c31ef);throw _0x3c31ef;});})[_0x0cf5('0x1e')](respondWithResult(_0x3b0a3f,0xc9))[_0x0cf5('0x4d')](handleError(_0x3b0a3f,null));};exports[_0x0cf5('0x77')]=function(_0x17ce9a,_0x275127){var _0xfbeedb=_0x17ce9a[_0x0cf5('0x54')];var _0x1d48c1=[];if(_0x17ce9a['user'][_0x0cf5('0x1f')]===_0x0cf5('0x62'))throw new Error('Unauthorized');if(_[_0x0cf5('0x78')](_0xfbeedb,[_0x0cf5('0x1f'),'user'])&&_0x17ce9a[_0x0cf5('0x25')][_0x0cf5('0x1f')]!==_0x0cf5('0x23')){throw new Error(_0x0cf5('0x71'));}if(_['some'](_0xfbeedb,[_0x0cf5('0x1f'),_0x0cf5('0x23')])&&_0x17ce9a[_0x0cf5('0x25')][_0x0cf5('0x1f')]!==_0x0cf5('0x23')){throw new Error(_0x0cf5('0x79'));}return licenseUtil['checkUserLimits'](_0xfbeedb)[_0x0cf5('0x1e')](function(){return validateUser(_0xfbeedb[0x0]);})[_0x0cf5('0x1e')](function(){for(var _0x14f263=0x1;_0x14f263<_0xfbeedb[_0x0cf5('0x45')];_0x14f263++){var _0x4eb7cc=_0xfbeedb[_0x14f263-0x1]['internal'];if(!_0xfbeedb[_0x14f263][_0x0cf5('0x58')])_0xfbeedb[_0x14f263]['internal']=_0x4eb7cc+0x1;_0x1d48c1[_0x0cf5('0x46')](validateUser(_0xfbeedb[_0x14f263]));}return Promise[_0x0cf5('0x4c')](_0x1d48c1);})[_0x0cf5('0x1e')](function(){_0x1d48c1=[];for(var _0x588db0=0x0;_0x588db0<_0xfbeedb[_0x0cf5('0x45')];_0x588db0++){_0x1d48c1[_0x0cf5('0x46')](updateUser(_0xfbeedb[_0x588db0]));}return Promise[_0x0cf5('0x4c')](_0x1d48c1);})[_0x0cf5('0x1e')](function(){_0x1d48c1=_0xfbeedb[_0x0cf5('0x2a')](function(_0xd05975){return db['User'][_0x0cf5('0x6f')](_0xd05975,{'include':[{'model':db[_0x0cf5('0x60')],'as':'VoiceMail'}]})[_0x0cf5('0x1e')](function(_0x32eb1f){_0xd05975['id']=_0x32eb1f['id'];return _0xd05975;});});return Promise[_0x0cf5('0x4c')](_0x1d48c1);})[_0x0cf5('0x1e')](function(_0x38a9d0){if(_0x17ce9a[_0x0cf5('0x54')][_0x0cf5('0x1f')]===_0x0cf5('0x25'))return _0x38a9d0;if(_0x17ce9a[_0x0cf5('0x25')]['role']!==_0x0cf5('0x25'))return _0x38a9d0;var _0x3eeffc=_['some'](_0x38a9d0,function(_0x5650f6){return _0x5650f6['role']===_0x0cf5('0x62')||_0x5650f6[_0x0cf5('0x1f')]===_0x0cf5('0x28');});if(!_0x3eeffc)return _0x38a9d0;return db[_0x0cf5('0x7a')][_0x0cf5('0x41')]({'where':{'name':{'$or':[_0x0cf5('0x26'),'Telephones']},'userProfileId':_0x17ce9a[_0x0cf5('0x25')][_0x0cf5('0x74')]},'raw':!![]})[_0x0cf5('0x1e')](function(_0x13f274){if(_[_0x0cf5('0x7b')](_0x13f274)||!_[_0x0cf5('0x78')](_0x13f274,[_0x0cf5('0x75'),0x0]))return _0x38a9d0;_0x1d48c1=[];var _0x270495=_(_0x13f274)['map'](function(_0xc6765c){if(_0xc6765c[_0x0cf5('0x75')]===0x1)return;return _0xc6765c[_0x0cf5('0x2e')]===_0x0cf5('0x26')?_0x0cf5('0x62'):_0x0cf5('0x28');})[_0x0cf5('0x7c')]()[_0x0cf5('0x2b')]();for(var _0xd06b6d=0x0;_0xd06b6d<_0x38a9d0[_0x0cf5('0x45')];_0xd06b6d++){if(!_[_0x0cf5('0x2c')](_0x270495,_0x38a9d0[_0xd06b6d]['role']))return;var _0x6e45a4=_0x38a9d0[_0xd06b6d]['role']===_0x0cf5('0x62')?_0x0cf5('0x26'):_0x0cf5('0x27');_0x1d48c1['push'](db[_0x0cf5('0x76')][_0x0cf5('0x6f')]({'name':_0x38a9d0[_0xd06b6d][_0x0cf5('0x2e')],'resourceId':_0x38a9d0[_0xd06b6d]['id'],'type':_0x6e45a4,'sectionId':_[_0x0cf5('0x2d')](_0x13f274,[_0x0cf5('0x2e'),_0x6e45a4])['id']},{}));}return Promise[_0x0cf5('0x4c')](_0x1d48c1);});})[_0x0cf5('0x1e')](respondWithResult(_0x275127,0xc9))[_0x0cf5('0x4d')](handleError(_0x275127,null));};exports['changePassword']=function(_0x375ace,_0x428f81){if(_0x375ace[_0x0cf5('0x54')]['id']){delete _0x375ace[_0x0cf5('0x54')]['id'];}return db['User'][_0x0cf5('0x2d')]({'where':{'id':_0x375ace[_0x0cf5('0x4f')]['id']}})['then'](function(_0x32d31f){if(!_0x32d31f)return null;if(_0x32d31f['id']===_0x375ace[_0x0cf5('0x25')]['id']){if(!_0x375ace[_0x0cf5('0x54')][_0x0cf5('0x7d')]||!_0x375ace[_0x0cf5('0x54')]['newPassword']){throw new db[(_0x0cf5('0x7e'))]['ValidationError']('Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword');}if(!_0x32d31f[_0x0cf5('0x7f')](_0x375ace[_0x0cf5('0x54')][_0x0cf5('0x7d')])){throw new db[(_0x0cf5('0x7e'))][(_0x0cf5('0x80'))](_0x0cf5('0x81'));}if(_0x375ace[_0x0cf5('0x54')][_0x0cf5('0x7d')]===_0x375ace[_0x0cf5('0x54')][_0x0cf5('0x82')]){throw new db[(_0x0cf5('0x7e'))][(_0x0cf5('0x80'))](_0x0cf5('0x83'));}}else if(_0x375ace[_0x0cf5('0x25')][_0x0cf5('0x1f')]==='admin'){if(!_0x375ace[_0x0cf5('0x54')][_0x0cf5('0x82')]){throw new db[(_0x0cf5('0x7e'))][(_0x0cf5('0x80'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}}else if(_0x375ace[_0x0cf5('0x25')]['role']===_0x0cf5('0x25')){if(!_0x375ace[_0x0cf5('0x54')][_0x0cf5('0x82')]){throw new db[(_0x0cf5('0x7e'))]['ValidationError'](_0x0cf5('0x84'));}if(_0x32d31f[_0x0cf5('0x1f')]!==_0x0cf5('0x62')){throw new db[(_0x0cf5('0x7e'))][(_0x0cf5('0x80'))](_0x0cf5('0x70'));}}else{throw new db['Sequelize'][(_0x0cf5('0x80'))](_0x0cf5('0x70'));}return _0x32d31f;})[_0x0cf5('0x1e')](handleEntityNotFound(_0x428f81,null))[_0x0cf5('0x1e')](function(_0x213032){return db[_0x0cf5('0x85')][_0x0cf5('0x86')]({'attributes':['id',_0x0cf5('0x5a'),'enforcePasswordHistory',_0x0cf5('0x87')]})[_0x0cf5('0x1e')](function(_0xae2dca){if(_0xae2dca[_0x0cf5('0x5a')])authService[_0x0cf5('0x88')](_0x375ace['body'][_0x0cf5('0x82')]);if(!_0xae2dca[_0x0cf5('0x89')]||!_0x213032['previousPasswords'])return _0x213032;authService[_0x0cf5('0x8a')](_0x375ace[_0x0cf5('0x54')]['newPassword'],_0x213032[_0x0cf5('0x8b')],_0xae2dca[_0x0cf5('0x87')]);return _0x213032;})[_0x0cf5('0x1e')](saveUpdates({'password':_0x375ace['body'][_0x0cf5('0x82')],'passwordResetAt':_0x375ace[_0x0cf5('0x25')]['id']==_0x375ace[_0x0cf5('0x4f')]['id']?moment():null,'previousPasswords':authService[_0x0cf5('0x8c')](_0x375ace[_0x0cf5('0x54')][_0x0cf5('0x82')],_0x213032['previousPasswords'])},null));})['then'](respondWithResult(_0x428f81,null))['catch'](handleError(_0x428f81,null));};exports['addQueues']=function(_0x3a4295,_0x567ac7){var _0x5df0c8=_0x3a4295[_0x0cf5('0x54')][_0x0cf5('0x8d')];return db['User'][_0x0cf5('0x2d')]({'where':{'id':_0x3a4295[_0x0cf5('0x4f')]['id']},'attributes':['id',_0x0cf5('0x2e'),_0x0cf5('0x1f'),_0x0cf5('0x8e'),_0x0cf5('0x8f'),_0x0cf5('0x90'),_0x0cf5('0x91')]})[_0x0cf5('0x1e')](handleEntityNotFound(_0x567ac7,null))[_0x0cf5('0x1e')](function(_0x4fee18){if(_0x4fee18){if(!utils[_0x0cf5('0x92')](_0x5df0c8)){throw new db[(_0x0cf5('0x7e'))][(_0x0cf5('0x80'))](_0x0cf5('0x93'));}return _0x4fee18[_0x0cf5('0x94')+_[_0x0cf5('0x95')](_0x5df0c8['toLowerCase']())+_0x0cf5('0x96')](_0x3a4295[_0x0cf5('0x54')][_0x0cf5('0x56')],{'penalty':_0x3a4295['body'][_0x0cf5('0x97')]||0x0})[_0x0cf5('0x98')](function(_0x51ec7d){for(var _0x49a4f9=0x0;_0x49a4f9<_0x3a4295[_0x0cf5('0x54')][_0x0cf5('0x56')][_0x0cf5('0x45')];_0x49a4f9+=0x1){var _0x195059={'UserId':Number(_0x3a4295[_0x0cf5('0x4f')]['id'])};_0x195059[_['capitalize'](_0x5df0c8['toLowerCase']())+_0x0cf5('0x99')]=Number(_0x3a4295[_0x0cf5('0x54')][_0x0cf5('0x56')][_0x49a4f9]);socket['emit']('user'+_['capitalize'](_0x5df0c8[_0x0cf5('0x9a')]())+_0x0cf5('0x9b'),_0x195059);}return _0x51ec7d;})[_0x0cf5('0x1e')](function(){if(_0x5df0c8===_0x0cf5('0x9c')){return db[_0x0cf5('0x9d')][_0x0cf5('0x41')]({'where':{'id':_0x3a4295[_0x0cf5('0x54')]['ids']||[]},'raw':!![],'attributes':['id',_0x0cf5('0x2e')]});}})[_0x0cf5('0x1e')](function(_0x352f40){var _0x5df92f=_0x4fee18[_0x0cf5('0x22')]({'plain':!![]});var _0x169bd4=[];if(_0x5df0c8===_0x0cf5('0x9c')&&_0x5df92f[_0x0cf5('0x1f')]===_0x0cf5('0x62')&&_0x5df92f[_0x0cf5('0x8e')]){for(let _0xa916d2=0x0;_0xa916d2<_0x352f40[_0x0cf5('0x45')];_0xa916d2+=0x1){_0x169bd4[_0x0cf5('0x46')]({'membername':_0x5df92f[_0x0cf5('0x2e')],'UserId':_0x5df92f['id'],'queue_name':_0x352f40[_0xa916d2][_0x0cf5('0x2e')],'VoiceQueueId':_0x352f40[_0xa916d2]['id'],'interface':_['isNil'](_0x5df92f[_0x0cf5('0x91')])?util[_0x0cf5('0x9e')]('SIP/%s',_0x5df92f['name']):_0x5df92f[_0x0cf5('0x91')],'paused':_0x5df92f[_0x0cf5('0x90')]||![],'penalty':_0x3a4295[_0x0cf5('0x54')]['penalty']||0x0});}return Promise[_0x0cf5('0x4c')](_0x169bd4[_0x0cf5('0x2a')](function(_0x4bf142){return db['UserVoiceQueueRt']['upsert'](_0x4bf142);}));}return _0x4fee18;});}})[_0x0cf5('0x1e')](respondWithStatusCode(_0x567ac7,null))[_0x0cf5('0x4d')](handleError(_0x567ac7,null));};exports['removeQueues']=function(_0x17322f,_0x3c2928){var _0x252e3f,_0x48bbc;return db[_0x0cf5('0x32')][_0x0cf5('0x2d')]({'where':{'id':_0x17322f['params']['id']},'attributes':['id',_0x0cf5('0x2e'),'role']})[_0x0cf5('0x1e')](handleEntityNotFound(_0x3c2928,null))[_0x0cf5('0x1e')](function(_0x50d746){if(_0x50d746){_0x252e3f=_0x50d746;if(!_0x17322f[_0x0cf5('0x3b')]['channel']||!utils[_0x0cf5('0x92')](_0x17322f[_0x0cf5('0x3b')][_0x0cf5('0x8d')])){throw new db['Sequelize'][(_0x0cf5('0x80'))](_0x0cf5('0x93'));}return _0x50d746[_0x0cf5('0x9f')+_[_0x0cf5('0x95')](_0x17322f[_0x0cf5('0x3b')][_0x0cf5('0x8d')][_0x0cf5('0x9a')]())+_0x0cf5('0x96')](_0x17322f[_0x0cf5('0x3b')]['ids']);}})[_0x0cf5('0x1e')](function(_0x2a15aa){if(_[_0x0cf5('0xa0')](_0x17322f[_0x0cf5('0x3b')]['ids'])){for(var _0x41bf2b=0x0;_0x41bf2b<_0x17322f[_0x0cf5('0x3b')][_0x0cf5('0x56')]['length'];_0x41bf2b+=0x1){_0x48bbc={'UserId':Number(_0x17322f[_0x0cf5('0x4f')]['id'])};_0x48bbc[_[_0x0cf5('0x95')](_0x17322f['query'][_0x0cf5('0x8d')][_0x0cf5('0x9a')]())+_0x0cf5('0x99')]=Number(_0x17322f[_0x0cf5('0x3b')][_0x0cf5('0x56')][_0x41bf2b]);socket['emit']('user'+_[_0x0cf5('0x95')](_0x17322f[_0x0cf5('0x3b')][_0x0cf5('0x8d')][_0x0cf5('0x9a')]())+_0x0cf5('0xa1'),_0x48bbc);}}else{_0x48bbc={'UserId':Number(_0x17322f['params']['id'])};_0x48bbc[_['capitalize'](_0x17322f[_0x0cf5('0x3b')]['channel']['toLowerCase']())+_0x0cf5('0x99')]=Number(_0x17322f[_0x0cf5('0x3b')][_0x0cf5('0x56')]);socket['emit']('user'+_['capitalize'](_0x17322f[_0x0cf5('0x3b')][_0x0cf5('0x8d')][_0x0cf5('0x9a')]())+'Queue:remove',_0x48bbc);}return _0x2a15aa;})[_0x0cf5('0x1e')](function(){if(_0x17322f[_0x0cf5('0x3b')][_0x0cf5('0x8d')]===_0x0cf5('0x9c')){return db[_0x0cf5('0xa2')][_0x0cf5('0x21')]({'where':{'UserId':_0x17322f[_0x0cf5('0x4f')]['id'],'VoiceQueueId':_0x17322f[_0x0cf5('0x3b')][_0x0cf5('0x56')]},'individualHooks':!![]})[_0x0cf5('0x1e')](function(){return _0x252e3f;});}return _0x252e3f;})[_0x0cf5('0x1e')](respondWithStatusCode(_0x3c2928,null))[_0x0cf5('0x4d')](handleError(_0x3c2928,null));};exports[_0x0cf5('0xa3')]=function(_0x25cec8,_0x5e6264){_0x25cec8['body']['userpic']=_0x25cec8[_0x0cf5('0xa4')]['filename'];return db['User'][_0x0cf5('0x2d')]({'where':{'id':_0x25cec8[_0x0cf5('0x4f')]['id']}})[_0x0cf5('0x1e')](handleEntityNotFound(_0x5e6264,null))['then'](saveUpdates(_0x25cec8[_0x0cf5('0x54')],null))[_0x0cf5('0x1e')](respondWithResult(_0x5e6264,null))[_0x0cf5('0x4d')](handleError(_0x5e6264,null));};exports[_0x0cf5('0xa5')]=function(_0x215923,_0x40fe00){var _0x16e979=path[_0x0cf5('0xa6')](config[_0x0cf5('0xa7')],_0x0cf5('0xa8'));return db['User'][_0x0cf5('0x2d')]({'where':{'id':_0x215923['params']['id']},'attributes':['id',_0x0cf5('0xa9')],'raw':!![]})[_0x0cf5('0x1e')](handleEntityNotFound(_0x40fe00,null))['then'](function(_0x566a83){if(_0x566a83){if(_[_0x0cf5('0x5b')](_0x566a83[_0x0cf5('0xa9')])){return _0x40fe00['download'](_0x16e979);}else{if(!fs[_0x0cf5('0xaa')](path[_0x0cf5('0xa6')](config[_0x0cf5('0xa7')],'server/files/images/',_0x566a83[_0x0cf5('0xa9')]))){return _0x40fe00[_0x0cf5('0xab')](_0x16e979);}return _0x40fe00[_0x0cf5('0xab')](path[_0x0cf5('0xa6')](config[_0x0cf5('0xa7')],_0x0cf5('0xac'),_0x566a83['userpic']));}}})[_0x0cf5('0x4d')](handleError(_0x40fe00,null));};exports[_0x0cf5('0xad')]=function(_0x46e871,_0x4e6bf8){return db[_0x0cf5('0x32')][_0x0cf5('0x2d')]({'where':{'id':_0x46e871['params']['id']},'attributes':['id']})[_0x0cf5('0x1e')](handleEntityNotFound(_0x4e6bf8,null))['then'](function(_0x3883a2){var _0x4dba2f=[];values=_0x3883a2[_0x0cf5('0x48')];_0x4dba2f[_0x0cf5('0x46')](get_open_tabs(_0x0cf5('0x47'),_0x3883a2['dataValues']));_0x4dba2f['push'](get_open_tabs(_0x0cf5('0x51'),_0x3883a2[_0x0cf5('0x48')]));_0x4dba2f['push'](get_open_tabs('openchannel',_0x3883a2[_0x0cf5('0x48')]));_0x4dba2f[_0x0cf5('0x46')](get_open_tabs('whatsapp',_0x3883a2[_0x0cf5('0x48')]));_0x4dba2f[_0x0cf5('0x46')](get_open_tabs(_0x0cf5('0x49'),_0x3883a2[_0x0cf5('0x48')]));_0x4dba2f[_0x0cf5('0x46')](get_open_tabs(_0x0cf5('0x4a'),_0x3883a2['dataValues']));return Promise['all'](_0x4dba2f);})[_0x0cf5('0x1e')](function(_0x377274){if(_0x377274){var _0x4301c6=_[_0x0cf5('0x2a')](values[_0x0cf5('0xae')],function(_0x3224d4){return{'channel':'CHAT','id':_0x3224d4['id'],'createdAt':_0x3224d4['createdAt']};});var _0x248fcf=_[_0x0cf5('0x2a')](values[_0x0cf5('0xaf')],function(_0x5ba73f){return{'channel':_0x0cf5('0xb0'),'id':_0x5ba73f['id'],'createdAt':_0x5ba73f[_0x0cf5('0xb1')]};});var _0x303bb5=_[_0x0cf5('0x2a')](values[_0x0cf5('0xb2')],function(_0x5d19c9){return{'channel':_0x0cf5('0xb3'),'id':_0x5d19c9['id'],'createdAt':_0x5d19c9[_0x0cf5('0xb1')]};});var _0x2896d6=_[_0x0cf5('0x2a')](values['MailOpenTabs'],function(_0x2e0e5d){return{'channel':_0x0cf5('0xb4'),'id':_0x2e0e5d['id'],'createdAt':_0x2e0e5d[_0x0cf5('0xb1')]};});var _0x3f3355=_['map'](values['SmsOpenTabs'],function(_0x1ed9e6){return{'channel':_0x0cf5('0xb5'),'id':_0x1ed9e6['id'],'createdAt':_0x1ed9e6[_0x0cf5('0xb1')]};});var _0x1e338d=_['map'](values[_0x0cf5('0xb6')],function(_0x16f4e3){return{'channel':'WHATSAPP','id':_0x16f4e3['id'],'createdAt':_0x16f4e3[_0x0cf5('0xb1')]};});var _0x43f85a=_[_0x0cf5('0xb7')](_0x4301c6,_0x248fcf,_0x303bb5,_0x2896d6,_0x3f3355,_0x1e338d);var _0x6c5fb9={'count':_0x43f85a[_0x0cf5('0x45')],'rows':_0x43f85a};return _0x6c5fb9;}else return null;})['then'](respondWithResult(_0x4e6bf8,null))[_0x0cf5('0x4d')](handleError(_0x4e6bf8,null));};exports['getContacts']=function(_0x2ac193,_0xa07939){var _0x55537d={};return db[_0x0cf5('0x32')][_0x0cf5('0x86')]({'where':{'id':_0x2ac193[_0x0cf5('0x4f')]['id']}})[_0x0cf5('0x1e')](function(_0x15695b){if(!_0x15695b){throw new APINotFoundError(util[_0x0cf5('0x9e')](_0x0cf5('0xb8'),_0x2ac193['params']['id']));}return contacts[_0x0cf5('0x55')]();})[_0x0cf5('0x1e')](function(_0x34dfdb){_0x2ac193[_0x0cf5('0x3b')][_0x0cf5('0x32')]=_0x2ac193['params']['id'];_0x55537d=qs[_0x0cf5('0x3a')](_0x34dfdb,_0x2ac193);if(_0x2ac193['query'][_0x0cf5('0xb9')](_0x0cf5('0x3c'))){_0x55537d[_0x0cf5('0x3d')]=[{'model':db['CmList'],'as':_0x0cf5('0xba'),'required':![]},{'model':db[_0x0cf5('0xbb')],'as':_0x0cf5('0xbc'),'attributes':['id',_0x0cf5('0x2e'),_0x0cf5('0xbd')],'where':_0x2ac193['query']['tag']?{'id':_0x2ac193[_0x0cf5('0x3b')][_0x0cf5('0xbe')]}:undefined,'required':_0x2ac193[_0x0cf5('0x3b')][_0x0cf5('0xbe')]?!![]:![]}];}return contacts[_0x0cf5('0x41')](_0x2ac193[_0x0cf5('0x3b')],_0x2ac193[_0x0cf5('0x25')],_0x55537d,_0x34dfdb);})[_0x0cf5('0x1e')](respondWithFilteredResult(_0xa07939,_0x55537d))[_0x0cf5('0x4d')](APIHandleError(_0xa07939));};exports[_0x0cf5('0xbf')]=function(_0x202331,_0x1cb326){var _0x9d845c;var _0x4efa9a={};var _0x31add5;return db[_0x0cf5('0x32')]['findOne']({'where':{'id':_0x202331['params']['id']},'attributes':['id','name',_0x0cf5('0x1f')]})[_0x0cf5('0x1e')](handleEntityNotFound(_0x1cb326,null))[_0x0cf5('0x1e')](function(_0x14259b){if(!utils[_0x0cf5('0x92')](_0x202331['query'][_0x0cf5('0x8d')])){throw new db[(_0x0cf5('0x7e'))][(_0x0cf5('0x80'))](_0x0cf5('0x93'));}_0x9d845c=_0x14259b;var _0x299314={};_0x299314['model']=_[_0x0cf5('0xc0')](db[_['capitalize'](_0x202331[_0x0cf5('0x3b')][_0x0cf5('0x8d')])+_0x0cf5('0xc1')][_0x0cf5('0xc2')]);_0x299314[_0x0cf5('0x3b')]=_[_0x0cf5('0xc0')](_0x202331[_0x0cf5('0x3b')]);_0x299314['filters']=_[_0x0cf5('0xc3')](_0x299314[_0x0cf5('0xc4')],_0x299314['query']);_0x4efa9a[_0x0cf5('0x40')]=_[_0x0cf5('0xc3')](_0x299314[_0x0cf5('0xc4')],qs['fields'](_0x202331[_0x0cf5('0x3b')][_0x0cf5('0xc5')]));_0x4efa9a[_0x0cf5('0x40')]=_0x4efa9a['attributes']['length']?_0x4efa9a['attributes']:_0x299314[_0x0cf5('0xc4')];_0x4efa9a[_0x0cf5('0xc6')]=qs[_0x0cf5('0xc7')](_0x202331[_0x0cf5('0x3b')]['sort']);_0x4efa9a[_0x0cf5('0xc8')]=qs[_0x0cf5('0xc9')](_['pick'](_0x202331[_0x0cf5('0x3b')],_0x299314[_0x0cf5('0xc9')]));if(_0x202331[_0x0cf5('0x3b')][_0x0cf5('0x29')]){_0x4efa9a[_0x0cf5('0xc8')]=_[_0x0cf5('0xca')](_0x4efa9a[_0x0cf5('0xc8')],{'$or':_[_0x0cf5('0x2a')](_0x4efa9a[_0x0cf5('0x40')],function(_0x458a44){var _0x338ab8={};_0x338ab8[_0x458a44]={'$like':'%'+_0x202331['query'][_0x0cf5('0x29')]+'%'};return _0x338ab8;})});}_0x4efa9a=_['merge']({},_0x4efa9a,_0x202331[_0x0cf5('0x50')]);switch(_0x9d845c['role']){case _0x0cf5('0x23'):return db[_['capitalize'](_0x202331[_0x0cf5('0x3b')]['channel'])+_0x0cf5('0xc1')][_0x0cf5('0x41')](_0x4efa9a);case _0x0cf5('0x25'):case _0x0cf5('0x62'):return _0x9d845c[_0x0cf5('0x22')+_[_0x0cf5('0x95')](_0x202331[_0x0cf5('0x3b')][_0x0cf5('0x8d')])+'Queues'](_0x4efa9a);default:throw new db[(_0x0cf5('0x7e'))][(_0x0cf5('0x80'))](_0x0cf5('0xcb'));}})['then'](function(_0x3165e7){_0x31add5=_0x3165e7[_0x0cf5('0x45')];if(!_0x202331[_0x0cf5('0x3b')][_0x0cf5('0xb9')](_0x0cf5('0xcc'))){_0x4efa9a[_0x0cf5('0x1b')]=qs[_0x0cf5('0x1b')](_0x202331['query'][_0x0cf5('0x1b')]);_0x4efa9a['offset']=qs['offset'](_0x202331[_0x0cf5('0x3b')][_0x0cf5('0x18')]);}switch(_0x9d845c[_0x0cf5('0x1f')]){case _0x0cf5('0x23'):return db[_[_0x0cf5('0x95')](_0x202331[_0x0cf5('0x3b')][_0x0cf5('0x8d')])+_0x0cf5('0xc1')]['findAll'](_0x4efa9a);case _0x0cf5('0x25'):case _0x0cf5('0x62'):return _0x9d845c[_0x0cf5('0x22')+_[_0x0cf5('0x95')](_0x202331[_0x0cf5('0x3b')][_0x0cf5('0x8d')])+_0x0cf5('0x96')](_0x4efa9a);}})[_0x0cf5('0x1e')](function(_0x234822){return{'count':_0x31add5,'rows':_0x234822};})[_0x0cf5('0x1e')](respondWithResult(_0x1cb326,null))[_0x0cf5('0x4d')](handleError(_0x1cb326,null));};exports[_0x0cf5('0xcd')]=function(_0x5187e7,_0x10bcc0){var _0x337a42={};var _0x4afae9={};var _0x10784f;var _0x23c9cf;return db[_0x0cf5('0x32')][_0x0cf5('0x86')]({'where':{'id':_0x5187e7[_0x0cf5('0x4f')]['id']}})[_0x0cf5('0x1e')](handleEntityNotFound(_0x10bcc0,null))[_0x0cf5('0x1e')](function(_0x35bae3){if(_0x35bae3){_0x10784f=_0x35bae3;_0x4afae9['model']=_[_0x0cf5('0xc0')](db['UserVoiceQueueRt'][_0x0cf5('0xc2')]);_0x4afae9[_0x0cf5('0x3b')]=_[_0x0cf5('0xc0')](_0x5187e7[_0x0cf5('0x3b')]);_0x4afae9[_0x0cf5('0xc9')]=_[_0x0cf5('0xc3')](_0x4afae9[_0x0cf5('0xc4')],_0x4afae9[_0x0cf5('0x3b')]);_0x337a42[_0x0cf5('0x40')]=_[_0x0cf5('0xc3')](_0x4afae9['model'],qs[_0x0cf5('0xc5')](_0x5187e7['query']['fields']));_0x337a42[_0x0cf5('0x40')]=_0x337a42[_0x0cf5('0x40')][_0x0cf5('0x45')]?_0x337a42[_0x0cf5('0x40')]:_0x4afae9[_0x0cf5('0xc4')];_0x337a42[_0x0cf5('0xc6')]=qs['sort'](_0x5187e7['query'][_0x0cf5('0xc7')]);_0x337a42[_0x0cf5('0xc8')]=qs[_0x0cf5('0xc9')](_[_0x0cf5('0xce')](_0x5187e7[_0x0cf5('0x3b')],_0x4afae9[_0x0cf5('0xc9')]));if(_0x5187e7[_0x0cf5('0x3b')][_0x0cf5('0x29')]){_0x337a42[_0x0cf5('0xc8')]=_[_0x0cf5('0xca')](_0x337a42['where'],{'$or':_[_0x0cf5('0x2a')](_0x337a42[_0x0cf5('0x40')],function(_0x16053f){var _0x138cd3={};_0x138cd3[_0x16053f]={'$like':'%'+_0x5187e7[_0x0cf5('0x3b')]['filter']+'%'};return _0x138cd3;})});}_0x337a42=_[_0x0cf5('0xca')]({},_0x337a42,_0x5187e7[_0x0cf5('0x50')]);return _0x10784f[_0x0cf5('0xcd')](_0x337a42);}})[_0x0cf5('0x1e')](function(_0x48a87e){if(_0x48a87e){_0x23c9cf=_0x48a87e[_0x0cf5('0x45')];if(!_0x5187e7[_0x0cf5('0x3b')][_0x0cf5('0xb9')](_0x0cf5('0xcc'))){_0x337a42[_0x0cf5('0x1b')]=qs[_0x0cf5('0x1b')](_0x5187e7['query'][_0x0cf5('0x1b')]);_0x337a42[_0x0cf5('0x18')]=qs['offset'](_0x5187e7[_0x0cf5('0x3b')]['offset']);}return _0x10784f[_0x0cf5('0xcd')](_0x337a42);}})['then'](function(_0x355d19){if(_0x355d19){return _0x355d19?{'count':_0x23c9cf,'rows':_0x355d19}:null;}})[_0x0cf5('0x1e')](respondWithResult(_0x10bcc0,null))['catch'](handleError(_0x10bcc0,null));};exports[_0x0cf5('0xcf')]=function(_0x1657ab,_0x41d757){var _0x8b2d8c={};var _0x22c020={};var _0x4a255d;var _0x46483a;return db[_0x0cf5('0x32')]['findOne']({'where':{'id':_0x1657ab[_0x0cf5('0x4f')]['id']}})[_0x0cf5('0x1e')](handleEntityNotFound(_0x41d757,null))[_0x0cf5('0x1e')](function(_0xcf25a8){if(_0xcf25a8){_0x4a255d=_0xcf25a8;_0x22c020[_0x0cf5('0xc4')]=_['keys'](db[_0x0cf5('0xd0')]['rawAttributes']);_0x22c020[_0x0cf5('0x3b')]=_[_0x0cf5('0xc0')](_0x1657ab['query']);_0x22c020[_0x0cf5('0xc9')]=_[_0x0cf5('0xc3')](_0x22c020['model'],_0x22c020[_0x0cf5('0x3b')]);_0x8b2d8c[_0x0cf5('0x40')]=_[_0x0cf5('0xc3')](_0x22c020[_0x0cf5('0xc4')],qs[_0x0cf5('0xc5')](_0x1657ab[_0x0cf5('0x3b')]['fields']));_0x8b2d8c[_0x0cf5('0x40')]=_0x8b2d8c[_0x0cf5('0x40')]['length']?_0x8b2d8c[_0x0cf5('0x40')]:_0x22c020[_0x0cf5('0xc4')];_0x8b2d8c[_0x0cf5('0xc6')]=qs['sort'](_0x1657ab[_0x0cf5('0x3b')][_0x0cf5('0xc7')]);_0x8b2d8c[_0x0cf5('0xc8')]=qs[_0x0cf5('0xc9')](_[_0x0cf5('0xce')](_0x1657ab[_0x0cf5('0x3b')],_0x22c020['filters']));if(_0x1657ab[_0x0cf5('0x3b')][_0x0cf5('0x29')]){_0x8b2d8c[_0x0cf5('0xc8')]=_[_0x0cf5('0xca')](_0x8b2d8c['where'],{'$or':_[_0x0cf5('0x2a')](_0x8b2d8c[_0x0cf5('0x40')],function(_0x4c2e51){var _0x20ca00={};_0x20ca00[_0x4c2e51]={'$like':'%'+_0x1657ab[_0x0cf5('0x3b')][_0x0cf5('0x29')]+'%'};return _0x20ca00;})});}_0x8b2d8c=_[_0x0cf5('0xca')]({},_0x8b2d8c,_0x1657ab[_0x0cf5('0x50')]);return _0x4a255d[_0x0cf5('0xcf')](_0x8b2d8c);}})[_0x0cf5('0x1e')](function(_0x428bf1){if(_0x428bf1){_0x46483a=_0x428bf1[_0x0cf5('0x45')];if(!_0x1657ab[_0x0cf5('0x3b')][_0x0cf5('0xb9')](_0x0cf5('0xcc'))){_0x8b2d8c[_0x0cf5('0x1b')]=qs['limit'](_0x1657ab['query'][_0x0cf5('0x1b')]);_0x8b2d8c[_0x0cf5('0x18')]=qs['offset'](_0x1657ab[_0x0cf5('0x3b')][_0x0cf5('0x18')]);}return _0x4a255d[_0x0cf5('0xcf')](_0x8b2d8c);}})[_0x0cf5('0x1e')](function(_0x59dcc2){if(_0x59dcc2){return _0x59dcc2?{'count':_0x46483a,'rows':_0x59dcc2}:null;}})[_0x0cf5('0x1e')](respondWithResult(_0x41d757,null))[_0x0cf5('0x4d')](handleError(_0x41d757,null));};exports[_0x0cf5('0xd1')]=function(_0xd1d367,_0x1f01c5){var _0x100dad={'raw':!![],'where':{}};var _0x3a4f8c={};var _0x342a6a={'count':0x0,'rows':[]};return db[_0x0cf5('0x32')]['findOne']({'where':{'id':_0xd1d367[_0x0cf5('0x4f')]['id']}})[_0x0cf5('0x1e')](handleEntityNotFound(_0x1f01c5,null))['then'](function(_0x47f656){if(_0x47f656){_0x3a4f8c['model']=_[_0x0cf5('0xc0')](db[_0x0cf5('0xd2')][_0x0cf5('0xc2')]);_0x3a4f8c['query']=_[_0x0cf5('0xc0')](_0xd1d367[_0x0cf5('0x3b')]);_0x3a4f8c['filters']=_[_0x0cf5('0xc3')](_0x3a4f8c[_0x0cf5('0xc4')],_0x3a4f8c[_0x0cf5('0x3b')]);_0x100dad[_0x0cf5('0x40')]=_[_0x0cf5('0xc3')](_0x3a4f8c[_0x0cf5('0xc4')],qs[_0x0cf5('0xc5')](_0xd1d367[_0x0cf5('0x3b')][_0x0cf5('0xc5')]));_0x100dad[_0x0cf5('0x40')]=_0x100dad[_0x0cf5('0x40')]['length']?_0x100dad[_0x0cf5('0x40')]:_0x3a4f8c[_0x0cf5('0xc4')];if(!_0xd1d367[_0x0cf5('0x3b')][_0x0cf5('0xb9')](_0x0cf5('0xcc'))){_0x100dad[_0x0cf5('0x1b')]=qs[_0x0cf5('0x1b')](_0xd1d367['query'][_0x0cf5('0x1b')]);_0x100dad[_0x0cf5('0x18')]=qs[_0x0cf5('0x18')](_0xd1d367[_0x0cf5('0x3b')][_0x0cf5('0x18')]);}_0x100dad[_0x0cf5('0xc6')]=qs[_0x0cf5('0xc7')](_0xd1d367['query'][_0x0cf5('0xc7')]);_0x100dad[_0x0cf5('0xc8')]=qs['filters'](_[_0x0cf5('0xce')](_0xd1d367['query'],_0x3a4f8c[_0x0cf5('0xc9')]));_0x100dad[_0x0cf5('0xc8')]['UserId']=_0x47f656['id'];if(_0xd1d367['query'][_0x0cf5('0x29')]){_0x100dad['where']=_['merge'](_0x100dad[_0x0cf5('0xc8')],{'$or':_[_0x0cf5('0x2a')](_0x100dad[_0x0cf5('0x40')],function(_0x1efc61){var _0xac8f1d={};_0xac8f1d[_0x1efc61]={'$like':'%'+_0xd1d367[_0x0cf5('0x3b')][_0x0cf5('0x29')]+'%'};return _0xac8f1d;})});}_0x100dad=_[_0x0cf5('0xca')]({},_0x100dad,_0xd1d367['options']);return db[_0x0cf5('0xd2')][_0x0cf5('0x1a')]({'where':_0x100dad[_0x0cf5('0xc8')]})[_0x0cf5('0x1e')](function(_0x308bf9){_0x342a6a['count']=_0x308bf9;if(_0xd1d367[_0x0cf5('0x3b')][_0x0cf5('0x3c')]){_0x100dad[_0x0cf5('0x3d')]=[{'all':!![]}];}return db[_0x0cf5('0xd2')][_0x0cf5('0x41')](_0x100dad);})[_0x0cf5('0x1e')](function(_0x30f94f){_0x342a6a[_0x0cf5('0x42')]=_0x30f94f;return _0x342a6a;});}})[_0x0cf5('0x1e')](respondWithFilteredResult(_0x1f01c5,_0x100dad))[_0x0cf5('0x4d')](handleError(_0x1f01c5,null));};exports[_0x0cf5('0xd3')]=function(_0x37ab0e,_0x4f3b09){var _0x4330bc={'raw':!![],'where':{}};var _0x23b2d5={};var _0x4934a8={'count':0x0,'rows':[]};return db[_0x0cf5('0x32')]['findOne']({'where':{'id':_0x37ab0e[_0x0cf5('0x4f')]['id']}})[_0x0cf5('0x1e')](handleEntityNotFound(_0x4f3b09,null))['then'](function(_0x2562a3){if(_0x2562a3){_0x23b2d5[_0x0cf5('0xc4')]=_['keys'](db['ScreenRecording'][_0x0cf5('0xc2')]);_0x23b2d5[_0x0cf5('0x3b')]=_['keys'](_0x37ab0e['query']);_0x23b2d5['filters']=_[_0x0cf5('0xc3')](_0x23b2d5['model'],_0x23b2d5[_0x0cf5('0x3b')]);_0x4330bc[_0x0cf5('0x40')]=_[_0x0cf5('0xc3')](_0x23b2d5[_0x0cf5('0xc4')],qs[_0x0cf5('0xc5')](_0x37ab0e[_0x0cf5('0x3b')][_0x0cf5('0xc5')]));_0x4330bc[_0x0cf5('0x40')]=_0x4330bc[_0x0cf5('0x40')][_0x0cf5('0x45')]?_0x4330bc[_0x0cf5('0x40')]:_0x23b2d5[_0x0cf5('0xc4')];if(!_0x37ab0e[_0x0cf5('0x3b')][_0x0cf5('0xb9')]('nolimit')){_0x4330bc[_0x0cf5('0x1b')]=qs['limit'](_0x37ab0e[_0x0cf5('0x3b')][_0x0cf5('0x1b')]);_0x4330bc[_0x0cf5('0x18')]=qs[_0x0cf5('0x18')](_0x37ab0e[_0x0cf5('0x3b')][_0x0cf5('0x18')]);}_0x4330bc['order']=qs[_0x0cf5('0xc7')](_0x37ab0e[_0x0cf5('0x3b')][_0x0cf5('0xc7')]);_0x4330bc[_0x0cf5('0xc8')]=qs[_0x0cf5('0xc9')](_['pick'](_0x37ab0e[_0x0cf5('0x3b')],_0x23b2d5[_0x0cf5('0xc9')]));_0x4330bc[_0x0cf5('0xc8')][_0x0cf5('0xd4')]=_0x2562a3['id'];if(_0x37ab0e[_0x0cf5('0x3b')][_0x0cf5('0x29')]){_0x4330bc[_0x0cf5('0xc8')]=_[_0x0cf5('0xca')](_0x4330bc['where'],{'$or':_['map'](_0x4330bc[_0x0cf5('0x40')],function(_0x40160d){var _0x2608a4={};_0x2608a4[_0x40160d]={'$like':'%'+_0x37ab0e[_0x0cf5('0x3b')][_0x0cf5('0x29')]+'%'};return _0x2608a4;})});}_0x4330bc=_[_0x0cf5('0xca')]({},_0x4330bc,_0x37ab0e[_0x0cf5('0x50')]);return db[_0x0cf5('0xd5')][_0x0cf5('0x1a')]({'where':_0x4330bc[_0x0cf5('0xc8')]})[_0x0cf5('0x1e')](function(_0x3b7b4f){_0x4934a8[_0x0cf5('0x1a')]=_0x3b7b4f;if(_0x37ab0e['query'][_0x0cf5('0x3c')]){_0x4330bc[_0x0cf5('0x3d')]=[{'all':!![]}];}return db[_0x0cf5('0xd5')][_0x0cf5('0x41')](_0x4330bc);})[_0x0cf5('0x1e')](function(_0x46e76d){_0x4934a8['rows']=_0x46e76d;return _0x4934a8;});}})['then'](respondWithFilteredResult(_0x4f3b09,_0x4330bc))[_0x0cf5('0x4d')](handleError(_0x4f3b09,null));};exports[_0x0cf5('0xd6')]=function(_0x4609c1,_0x55d853){var _0x254d31={};var _0xde92e5={};var _0x120733;var _0x458a72;return db['User']['findOne']({'where':{'id':_0x4609c1[_0x0cf5('0x4f')]['id']}})[_0x0cf5('0x1e')](handleEntityNotFound(_0x55d853,null))[_0x0cf5('0x1e')](function(_0x58249b){if(_0x58249b){_0x120733=_0x58249b;_0xde92e5[_0x0cf5('0xc4')]=_[_0x0cf5('0xc0')](db['ChatInteraction'][_0x0cf5('0xc2')]);_0xde92e5['query']=_['keys'](_0x4609c1['query']);_0xde92e5['filters']=_[_0x0cf5('0xc3')](_0xde92e5[_0x0cf5('0xc4')],_0xde92e5[_0x0cf5('0x3b')]);_0x254d31[_0x0cf5('0x40')]=_['intersection'](_0xde92e5[_0x0cf5('0xc4')],qs['fields'](_0x4609c1[_0x0cf5('0x3b')][_0x0cf5('0xc5')]));_0x254d31[_0x0cf5('0x40')]=_0x254d31['attributes']['length']?_0x254d31['attributes']:_0xde92e5[_0x0cf5('0xc4')];_0x254d31[_0x0cf5('0xc6')]=qs[_0x0cf5('0xc7')](_0x4609c1[_0x0cf5('0x3b')]['sort']);_0x254d31[_0x0cf5('0xc8')]=qs[_0x0cf5('0xc9')](_[_0x0cf5('0xce')](_0x4609c1[_0x0cf5('0x3b')],_0xde92e5[_0x0cf5('0xc9')]));if(_0x4609c1['query'][_0x0cf5('0x29')]){_0x254d31['where']=_[_0x0cf5('0xca')](_0x254d31[_0x0cf5('0xc8')],{'$or':_[_0x0cf5('0x2a')](_0x254d31['attributes'],function(_0x5394b6){var _0x3277c7={};_0x3277c7[_0x5394b6]={'$like':'%'+_0x4609c1[_0x0cf5('0x3b')]['filter']+'%'};return _0x3277c7;})});}_0x254d31=_[_0x0cf5('0xca')]({},_0x254d31,_0x4609c1[_0x0cf5('0x50')]);return _0x120733['getChatInteractions'](_0x254d31);}})[_0x0cf5('0x1e')](function(_0x24fd55){if(_0x24fd55){_0x458a72=_0x24fd55[_0x0cf5('0x45')];if(!_0x4609c1[_0x0cf5('0x3b')][_0x0cf5('0xb9')]('nolimit')){_0x254d31['limit']=qs['limit'](_0x4609c1[_0x0cf5('0x3b')][_0x0cf5('0x1b')]);_0x254d31[_0x0cf5('0x18')]=qs[_0x0cf5('0x18')](_0x4609c1[_0x0cf5('0x3b')][_0x0cf5('0x18')]);}return _0x120733[_0x0cf5('0xd6')](_0x254d31);}})[_0x0cf5('0x1e')](function(_0x47d0d4){if(_0x47d0d4){return _0x47d0d4?{'count':_0x458a72,'rows':_0x47d0d4}:null;}})[_0x0cf5('0x1e')](respondWithResult(_0x55d853,null))[_0x0cf5('0x4d')](handleError(_0x55d853,null));};exports[_0x0cf5('0xd7')]=function(_0x2ab3e5,_0x45b52e){var _0x20e9df={};var _0x2d446f={};var _0x34909;var _0xa44b7;return db['User']['findOne']({'where':{'id':_0x2ab3e5[_0x0cf5('0x4f')]['id']}})['then'](handleEntityNotFound(_0x45b52e,null))[_0x0cf5('0x1e')](function(_0x164b45){if(_0x164b45){_0x34909=_0x164b45;_0x2d446f[_0x0cf5('0xc4')]=_[_0x0cf5('0xc0')](db[_0x0cf5('0xd8')][_0x0cf5('0xc2')]);_0x2d446f[_0x0cf5('0x3b')]=_['keys'](_0x2ab3e5[_0x0cf5('0x3b')]);_0x2d446f[_0x0cf5('0xc9')]=_[_0x0cf5('0xc3')](_0x2d446f[_0x0cf5('0xc4')],_0x2d446f[_0x0cf5('0x3b')]);_0x20e9df[_0x0cf5('0x40')]=_[_0x0cf5('0xc3')](_0x2d446f[_0x0cf5('0xc4')],qs[_0x0cf5('0xc5')](_0x2ab3e5['query']['fields']));_0x20e9df[_0x0cf5('0x40')]=_0x20e9df[_0x0cf5('0x40')]['length']?_0x20e9df[_0x0cf5('0x40')]:_0x2d446f['model'];_0x20e9df[_0x0cf5('0xc6')]=qs[_0x0cf5('0xc7')](_0x2ab3e5['query'][_0x0cf5('0xc7')]);_0x20e9df[_0x0cf5('0xc8')]=qs[_0x0cf5('0xc9')](_[_0x0cf5('0xce')](_0x2ab3e5[_0x0cf5('0x3b')],_0x2d446f[_0x0cf5('0xc9')]));if(_0x2ab3e5[_0x0cf5('0x3b')][_0x0cf5('0x29')]){_0x20e9df[_0x0cf5('0xc8')]=_[_0x0cf5('0xca')](_0x20e9df['where'],{'$or':_[_0x0cf5('0x2a')](_0x20e9df[_0x0cf5('0x40')],function(_0x479544){var _0x10cf5d={};_0x10cf5d[_0x479544]={'$like':'%'+_0x2ab3e5[_0x0cf5('0x3b')][_0x0cf5('0x29')]+'%'};return _0x10cf5d;})});}_0x20e9df=_[_0x0cf5('0xca')]({},_0x20e9df,_0x2ab3e5[_0x0cf5('0x50')]);return _0x34909[_0x0cf5('0xd7')](_0x20e9df);}})[_0x0cf5('0x1e')](function(_0x5d1cb9){if(_0x5d1cb9){_0xa44b7=_0x5d1cb9[_0x0cf5('0x45')];if(!_0x2ab3e5['query'][_0x0cf5('0xb9')](_0x0cf5('0xcc'))){_0x20e9df[_0x0cf5('0x1b')]=qs[_0x0cf5('0x1b')](_0x2ab3e5[_0x0cf5('0x3b')][_0x0cf5('0x1b')]);_0x20e9df[_0x0cf5('0x18')]=qs[_0x0cf5('0x18')](_0x2ab3e5[_0x0cf5('0x3b')][_0x0cf5('0x18')]);}return _0x34909['getOpenchannelInteractions'](_0x20e9df);}})[_0x0cf5('0x1e')](function(_0xfcff1b){if(_0xfcff1b){return _0xfcff1b?{'count':_0xa44b7,'rows':_0xfcff1b}:null;}})[_0x0cf5('0x1e')](respondWithResult(_0x45b52e,null))['catch'](handleError(_0x45b52e,null));};exports[_0x0cf5('0xd9')]=function(_0x4fbda5,_0x54441a){var _0x5237f4={'raw':!![],'where':{}};var _0x150597={};var _0x150b16={'count':0x0,'rows':[]};return db[_0x0cf5('0x32')]['findOne']({'where':{'id':_0x4fbda5[_0x0cf5('0x4f')]['id']}})[_0x0cf5('0x1e')](handleEntityNotFound(_0x54441a,null))['then'](function(_0x33fb15){if(_0x33fb15){_0x150597['model']=_[_0x0cf5('0xc0')](db['MailInteraction'][_0x0cf5('0xc2')]);_0x150597[_0x0cf5('0x3b')]=_[_0x0cf5('0xc0')](_0x4fbda5[_0x0cf5('0x3b')]);_0x150597[_0x0cf5('0xc9')]=_['intersection'](_0x150597[_0x0cf5('0xc4')],_0x150597[_0x0cf5('0x3b')]);_0x5237f4[_0x0cf5('0x40')]=_[_0x0cf5('0xc3')](_0x150597[_0x0cf5('0xc4')],qs[_0x0cf5('0xc5')](_0x4fbda5[_0x0cf5('0x3b')][_0x0cf5('0xc5')]));_0x5237f4[_0x0cf5('0x40')]=_0x5237f4[_0x0cf5('0x40')]['length']?_0x5237f4[_0x0cf5('0x40')]:_0x150597[_0x0cf5('0xc4')];if(!_0x4fbda5[_0x0cf5('0x3b')]['hasOwnProperty']('nolimit')){_0x5237f4[_0x0cf5('0x1b')]=qs['limit'](_0x4fbda5['query'][_0x0cf5('0x1b')]);_0x5237f4[_0x0cf5('0x18')]=qs[_0x0cf5('0x18')](_0x4fbda5[_0x0cf5('0x3b')][_0x0cf5('0x18')]);}_0x5237f4[_0x0cf5('0xc6')]=qs[_0x0cf5('0xc7')](_0x4fbda5[_0x0cf5('0x3b')][_0x0cf5('0xc7')]);_0x5237f4[_0x0cf5('0xc8')]=qs[_0x0cf5('0xc9')](_[_0x0cf5('0xce')](_0x4fbda5[_0x0cf5('0x3b')],_0x150597['filters']));_0x5237f4['where'][_0x0cf5('0xd4')]=_0x33fb15['id'];if(_0x4fbda5[_0x0cf5('0x3b')]['filter']){_0x5237f4[_0x0cf5('0xc8')]=_[_0x0cf5('0xca')](_0x5237f4[_0x0cf5('0xc8')],{'$or':_[_0x0cf5('0x2a')](_0x5237f4['attributes'],function(_0xa622b2){var _0x355c35={};_0x355c35[_0xa622b2]={'$like':'%'+_0x4fbda5[_0x0cf5('0x3b')][_0x0cf5('0x29')]+'%'};return _0x355c35;})});}_0x5237f4=_[_0x0cf5('0xca')]({},_0x5237f4,_0x4fbda5[_0x0cf5('0x50')]);return db[_0x0cf5('0xda')][_0x0cf5('0x1a')]({'where':_0x5237f4[_0x0cf5('0xc8')]})[_0x0cf5('0x1e')](function(_0x370416){_0x150b16[_0x0cf5('0x1a')]=_0x370416;if(_0x4fbda5[_0x0cf5('0x3b')][_0x0cf5('0x3c')]){_0x5237f4[_0x0cf5('0x3d')]=[{'all':!![]}];}return db[_0x0cf5('0xda')][_0x0cf5('0x41')](_0x5237f4);})[_0x0cf5('0x1e')](function(_0x84eb12){_0x150b16['rows']=_0x84eb12;return _0x150b16;});}})[_0x0cf5('0x1e')](respondWithFilteredResult(_0x54441a,_0x5237f4))['catch'](handleError(_0x54441a,null));};exports[_0x0cf5('0xdb')]=function(_0x413d16,_0x3893a7){var _0x4acaf0={};var _0x8d93be={};var _0x26f0a1;var _0x317856;return db[_0x0cf5('0x32')][_0x0cf5('0x86')]({'where':{'id':_0x413d16[_0x0cf5('0x4f')]['id']}})[_0x0cf5('0x1e')](handleEntityNotFound(_0x3893a7,null))['then'](function(_0x2ee291){if(_0x2ee291){_0x26f0a1=_0x2ee291;_0x8d93be[_0x0cf5('0xc4')]=_[_0x0cf5('0xc0')](db[_0x0cf5('0xdc')][_0x0cf5('0xc2')]);_0x8d93be['query']=_[_0x0cf5('0xc0')](_0x413d16['query']);_0x8d93be[_0x0cf5('0xc9')]=_[_0x0cf5('0xc3')](_0x8d93be[_0x0cf5('0xc4')],_0x8d93be['query']);_0x4acaf0['attributes']=_[_0x0cf5('0xc3')](_0x8d93be['model'],qs[_0x0cf5('0xc5')](_0x413d16['query']['fields']));_0x4acaf0[_0x0cf5('0x40')]=_0x4acaf0[_0x0cf5('0x40')][_0x0cf5('0x45')]?_0x4acaf0[_0x0cf5('0x40')]:_0x8d93be[_0x0cf5('0xc4')];_0x4acaf0['order']=qs[_0x0cf5('0xc7')](_0x413d16[_0x0cf5('0x3b')][_0x0cf5('0xc7')]);_0x4acaf0[_0x0cf5('0xc8')]=qs[_0x0cf5('0xc9')](_['pick'](_0x413d16[_0x0cf5('0x3b')],_0x8d93be[_0x0cf5('0xc9')]));if(_0x413d16[_0x0cf5('0x3b')][_0x0cf5('0x29')]){_0x4acaf0['where']=_[_0x0cf5('0xca')](_0x4acaf0[_0x0cf5('0xc8')],{'$or':_[_0x0cf5('0x2a')](_0x4acaf0['attributes'],function(_0x250c3d){var _0x36b51a={};_0x36b51a[_0x250c3d]={'$like':'%'+_0x413d16['query'][_0x0cf5('0x29')]+'%'};return _0x36b51a;})});}_0x4acaf0=_[_0x0cf5('0xca')]({},_0x4acaf0,_0x413d16[_0x0cf5('0x50')]);return _0x26f0a1[_0x0cf5('0xdb')](_0x4acaf0);}})['then'](function(_0x5a035d){if(_0x5a035d){_0x317856=_0x5a035d['length'];if(!_0x413d16[_0x0cf5('0x3b')][_0x0cf5('0xb9')](_0x0cf5('0xcc'))){_0x4acaf0[_0x0cf5('0x1b')]=qs[_0x0cf5('0x1b')](_0x413d16['query']['limit']);_0x4acaf0[_0x0cf5('0x18')]=qs['offset'](_0x413d16[_0x0cf5('0x3b')][_0x0cf5('0x18')]);}return _0x26f0a1[_0x0cf5('0xdb')](_0x4acaf0);}})[_0x0cf5('0x1e')](function(_0x5e43d2){if(_0x5e43d2){return _0x5e43d2?{'count':_0x317856,'rows':_0x5e43d2}:null;}})[_0x0cf5('0x1e')](respondWithResult(_0x3893a7,null))[_0x0cf5('0x4d')](handleError(_0x3893a7,null));};exports[_0x0cf5('0xdd')]=function(_0x34906c,_0x4698f4){var _0x573852={};var _0x14a2fe={};var _0x18f711;var _0x1da622;return db[_0x0cf5('0x32')][_0x0cf5('0x86')]({'where':{'id':_0x34906c[_0x0cf5('0x4f')]['id']}})['then'](handleEntityNotFound(_0x4698f4,null))[_0x0cf5('0x1e')](function(_0x3e8264){if(_0x3e8264){_0x18f711=_0x3e8264;_0x14a2fe['model']=_[_0x0cf5('0xc0')](db[_0x0cf5('0xde')][_0x0cf5('0xc2')]);_0x14a2fe['query']=_[_0x0cf5('0xc0')](_0x34906c['query']);_0x14a2fe['filters']=_['intersection'](_0x14a2fe['model'],_0x14a2fe[_0x0cf5('0x3b')]);_0x573852[_0x0cf5('0x40')]=_['intersection'](_0x14a2fe[_0x0cf5('0xc4')],qs[_0x0cf5('0xc5')](_0x34906c[_0x0cf5('0x3b')][_0x0cf5('0xc5')]));_0x573852['attributes']=_0x573852[_0x0cf5('0x40')][_0x0cf5('0x45')]?_0x573852[_0x0cf5('0x40')]:_0x14a2fe[_0x0cf5('0xc4')];_0x573852[_0x0cf5('0xc6')]=qs[_0x0cf5('0xc7')](_0x34906c[_0x0cf5('0x3b')][_0x0cf5('0xc7')]);_0x573852['where']=qs[_0x0cf5('0xc9')](_[_0x0cf5('0xce')](_0x34906c[_0x0cf5('0x3b')],_0x14a2fe[_0x0cf5('0xc9')]));if(_0x34906c[_0x0cf5('0x3b')][_0x0cf5('0x29')]){_0x573852[_0x0cf5('0xc8')]=_['merge'](_0x573852[_0x0cf5('0xc8')],{'$or':_[_0x0cf5('0x2a')](_0x573852['attributes'],function(_0x5b9e12){var _0x54f9d8={};_0x54f9d8[_0x5b9e12]={'$like':'%'+_0x34906c[_0x0cf5('0x3b')][_0x0cf5('0x29')]+'%'};return _0x54f9d8;})});}_0x573852=_['merge']({},_0x573852,_0x34906c[_0x0cf5('0x50')]);return _0x18f711[_0x0cf5('0xdd')](_0x573852);}})['then'](function(_0x2cbb0b){if(_0x2cbb0b){_0x1da622=_0x2cbb0b[_0x0cf5('0x45')];if(!_0x34906c[_0x0cf5('0x3b')][_0x0cf5('0xb9')](_0x0cf5('0xcc'))){_0x573852[_0x0cf5('0x1b')]=qs[_0x0cf5('0x1b')](_0x34906c['query']['limit']);_0x573852['offset']=qs[_0x0cf5('0x18')](_0x34906c['query']['offset']);}return _0x18f711[_0x0cf5('0xdd')](_0x573852);}})[_0x0cf5('0x1e')](function(_0x5c3f78){if(_0x5c3f78){return _0x5c3f78?{'count':_0x1da622,'rows':_0x5c3f78}:null;}})[_0x0cf5('0x1e')](respondWithResult(_0x4698f4,null))[_0x0cf5('0x4d')](handleError(_0x4698f4,null));};exports[_0x0cf5('0xdf')]=function(_0x455082,_0x5265c9){var _0x1d215a={};var _0x66ae9d={};var _0x5c22d3;var _0x35e2f6;return db['User'][_0x0cf5('0x86')]({'where':{'id':_0x455082[_0x0cf5('0x4f')]['id']}})[_0x0cf5('0x1e')](handleEntityNotFound(_0x5265c9,null))[_0x0cf5('0x1e')](function(_0x5117f0){if(_0x5117f0){_0x5c22d3=_0x5117f0;_0x66ae9d['model']=_['keys'](db['WhatsappInteraction'][_0x0cf5('0xc2')]);_0x66ae9d['query']=_[_0x0cf5('0xc0')](_0x455082[_0x0cf5('0x3b')]);_0x66ae9d[_0x0cf5('0xc9')]=_[_0x0cf5('0xc3')](_0x66ae9d[_0x0cf5('0xc4')],_0x66ae9d[_0x0cf5('0x3b')]);_0x1d215a['attributes']=_[_0x0cf5('0xc3')](_0x66ae9d[_0x0cf5('0xc4')],qs['fields'](_0x455082[_0x0cf5('0x3b')]['fields']));_0x1d215a[_0x0cf5('0x40')]=_0x1d215a[_0x0cf5('0x40')]['length']?_0x1d215a[_0x0cf5('0x40')]:_0x66ae9d[_0x0cf5('0xc4')];_0x1d215a[_0x0cf5('0xc6')]=qs[_0x0cf5('0xc7')](_0x455082[_0x0cf5('0x3b')]['sort']);_0x1d215a[_0x0cf5('0xc8')]=qs[_0x0cf5('0xc9')](_[_0x0cf5('0xce')](_0x455082['query'],_0x66ae9d[_0x0cf5('0xc9')]));if(_0x455082[_0x0cf5('0x3b')]['filter']){_0x1d215a[_0x0cf5('0xc8')]=_[_0x0cf5('0xca')](_0x1d215a['where'],{'$or':_[_0x0cf5('0x2a')](_0x1d215a['attributes'],function(_0x474dbc){var _0x2d12ff={};_0x2d12ff[_0x474dbc]={'$like':'%'+_0x455082[_0x0cf5('0x3b')][_0x0cf5('0x29')]+'%'};return _0x2d12ff;})});}_0x1d215a=_[_0x0cf5('0xca')]({},_0x1d215a,_0x455082[_0x0cf5('0x50')]);return _0x5c22d3[_0x0cf5('0xdf')](_0x1d215a);}})['then'](function(_0x53ed96){if(_0x53ed96){_0x35e2f6=_0x53ed96[_0x0cf5('0x45')];if(!_0x455082[_0x0cf5('0x3b')][_0x0cf5('0xb9')](_0x0cf5('0xcc'))){_0x1d215a[_0x0cf5('0x1b')]=qs['limit'](_0x455082[_0x0cf5('0x3b')][_0x0cf5('0x1b')]);_0x1d215a['offset']=qs[_0x0cf5('0x18')](_0x455082[_0x0cf5('0x3b')][_0x0cf5('0x18')]);}return _0x5c22d3[_0x0cf5('0xdf')](_0x1d215a);}})['then'](function(_0x2a61cf){if(_0x2a61cf){return _0x2a61cf?{'count':_0x35e2f6,'rows':_0x2a61cf}:null;}})[_0x0cf5('0x1e')](respondWithResult(_0x5265c9,null))['catch'](handleError(_0x5265c9,null));};exports['login']=function(_0xb93971,_0xd8ab56,_0x685fb7){var _0x362ad4;var _0x2b29db;var _0x43bcb3;var _0x49ea04=!_[_0x0cf5('0x5b')](_0xb93971[_0x0cf5('0x4f')]['id'])?_0xb93971[_0x0cf5('0x4f')]['id']:!_['isNil'](_0xb93971[_0x0cf5('0x25')]['id'])?_0xb93971[_0x0cf5('0x25')]['id']:null;return db[_0x0cf5('0x32')][_0x0cf5('0x2d')]({'where':{'id':_0x49ea04,'role':{'$or':['admin',_0x0cf5('0x25'),_0x0cf5('0x62')]}},'attributes':['id',_0x0cf5('0x2e'),_0x0cf5('0xe0'),_0x0cf5('0xe1'),_0x0cf5('0x1f'),_0x0cf5('0x58'),_0x0cf5('0x8f')]})[_0x0cf5('0x1e')](function(_0x1c6e9d){if(_0x1c6e9d){if(_0x1c6e9d[_0x0cf5('0x1f')]===_0x0cf5('0x62')){_0x362ad4=_0x1c6e9d;if(_0xb93971[_0x0cf5('0x54')][_0x0cf5('0x91')]){_0x43bcb3=util['format']('LOCAL/%s@from-sip/n',_0x362ad4[_0xb93971[_0x0cf5('0x54')][_0x0cf5('0x91')]]);}else if(_0xb93971[_0x0cf5('0x54')]['intrf']){_0x43bcb3=util[_0x0cf5('0x9e')]('SIP/%s',_0xb93971[_0x0cf5('0x54')]['intrf']);}else{_0x43bcb3=util[_0x0cf5('0x9e')](_0x0cf5('0xe2'),_0x362ad4[_0x0cf5('0x2e')]);}socket['to'](util[_0x0cf5('0x9e')](_0x0cf5('0xe3'),_0x362ad4[_0x0cf5('0x2e')]))[_0x0cf5('0x20')]('user:forcelogout',{'user':{'id':_0x362ad4['id'],'name':_0x362ad4[_0x0cf5('0x2e')]},'ip':_0xb93971[_0x0cf5('0xe4')]['x-forwarded-for']||_0xb93971[_0x0cf5('0xe5')][_0x0cf5('0xe6')]||_0xb93971[_0x0cf5('0xe7')][_0x0cf5('0xe6')]||_0xb93971[_0x0cf5('0xe5')][_0x0cf5('0xe7')][_0x0cf5('0xe6')]});return db[_0x0cf5('0xa2')]['destroy']({'where':{'membername':_0x362ad4['name']},'individualHooks':!![]});}}else{throw new db['Sequelize'][(_0x0cf5('0x80'))](_0x0cf5('0xe8'));}})[_0x0cf5('0x1e')](function(){if(_0x362ad4){return _0x362ad4[_0x0cf5('0xe9')]({'raw':!![]});}})[_0x0cf5('0x1e')](function(_0x2acd0e){if(_0x362ad4){if(_0x2acd0e){_0x2b29db=_0x2acd0e;if(_0x2b29db[_0x0cf5('0x45')]){var _0x11b4d6=_0x2b29db[_0x0cf5('0x2a')](function(_0x4557e0){var _0x2f1c2a={'membername':_0x362ad4[_0x0cf5('0x2e')],'UserId':_0x362ad4['id'],'queue_name':_0x4557e0[_0x0cf5('0x2e')],'VoiceQueueId':_0x4557e0['id'],'interface':_0x43bcb3,'paused':_0x362ad4[_0x0cf5('0x8f')]||![],'penalty':_0x4557e0[_0x0cf5('0xea')]||0x0};return db[_0x0cf5('0xa2')][_0x0cf5('0xeb')](_0x2f1c2a);});return Promise[_0x0cf5('0x4c')](_0x11b4d6);}}}})['then'](function(){if(_0x362ad4){return db[_0x0cf5('0xec')]['findAll']({'where':{'membername':_0x362ad4['name'],'exitAt':null}});}})[_0x0cf5('0x1e')](function(_0x15c8a5){if(_0x362ad4){var _0x17e9cf=[];_0x15c8a5[_0x0cf5('0xed')](function(_0x131030){_0x17e9cf[_0x0cf5('0x46')](_0x131030[_0x0cf5('0x53')]({'exitAt':moment()[_0x0cf5('0x9e')](_0x0cf5('0xee'))}));});return Promise[_0x0cf5('0x4c')](_0x17e9cf);}})[_0x0cf5('0x1e')](function(){if(_0x362ad4){var _0x2779c5=[];var _0x4e7683=[];var _0x4eaca4=utils[_0x0cf5('0xef')]();var _0x100830={'membername':_0x362ad4[_0x0cf5('0x2e')],'interface':_0x43bcb3,'enterAt':moment()[_0x0cf5('0x9e')](_0x0cf5('0xee')),'role':_0x362ad4[_0x0cf5('0x1f')],'internal':_0x362ad4[_0x0cf5('0x58')]};_0x4eaca4[_0x0cf5('0xed')](function(_0x9ef5e0){_0x2779c5[_0x0cf5('0x46')](_[_0x0cf5('0xca')]({'channel':_0x9ef5e0,'type':_0x0cf5('0xf0'),'data1':_0xb93971[_0x0cf5('0x54')][_0x0cf5('0xf1')],'data2':_0x43bcb3},_0x100830));if(_0x362ad4[_0x0cf5('0x8f')]){_0x4e7683[_0x0cf5('0x46')](_[_0x0cf5('0xca')]({'channel':_0x9ef5e0,'type':_0x0cf5('0xf2'),'data1':_0x0cf5('0xf3')},_0x100830));}});return db[_0x0cf5('0xec')][_0x0cf5('0x77')](_0x2779c5[_0x0cf5('0xb7')](_0x4e7683),{'individualHooks':!![]});}})[_0x0cf5('0x1e')](function(){if(_0x362ad4){return _0x362ad4[_0x0cf5('0x53')]({'online':!![],'lastLoginAt':moment()[_0x0cf5('0x9e')](_0x0cf5('0xee')),'voicePause':_0x362ad4[_0x0cf5('0x8f')]||![],'mailPause':_0x362ad4['loginInPause']||![],'chatPause':_0x362ad4[_0x0cf5('0x8f')]||![],'faxPause':_0x362ad4[_0x0cf5('0x8f')]||![],'smsPause':_0x362ad4[_0x0cf5('0x8f')]||![],'openchannelPause':_0x362ad4[_0x0cf5('0x8f')]||![],'whatsappPause':_0x362ad4[_0x0cf5('0x8f')]||![],'pauseType':_0x362ad4[_0x0cf5('0x8f')]?_0x0cf5('0xf3'):null,'interface':_0x43bcb3,'lastPauseAt':moment()[_0x0cf5('0x9e')](_0x0cf5('0xee'))});}})[_0x0cf5('0x1e')](function(_0x4ec617){if(_0xb93971[_0x0cf5('0xf4')]){return _0x685fb7();}else{return Promise[_0x0cf5('0xf5')](_0x4ec617)[_0x0cf5('0x1e')](respondWithResult(_0xd8ab56,null));}})[_0x0cf5('0x4d')](handleError(_0xd8ab56,null));};exports[_0x0cf5('0xf6')]=function(_0x37148d,_0xba127f){var _0x5ad18b;return db['User'][_0x0cf5('0x2d')]({'where':{'id':_0x37148d[_0x0cf5('0x4f')]['id'],'role':'agent'},'attributes':['id',_0x0cf5('0x2e'),'role']})['then'](handleEntityNotFound(_0xba127f,null))[_0x0cf5('0x1e')](function(_0x2b2e2f){if(_0x2b2e2f){_0x5ad18b=_0x2b2e2f;return db[_0x0cf5('0xa2')][_0x0cf5('0x21')]({'where':{'membername':_0x5ad18b[_0x0cf5('0x2e')]},'individualHooks':!![]});}})[_0x0cf5('0x1e')](function(){return db['MemberReport'][_0x0cf5('0x41')]({'where':{'membername':_0x5ad18b[_0x0cf5('0x2e')],'exitAt':null}});})[_0x0cf5('0x1e')](function(_0x1cfb0e){var _0x509eba=[];_0x1cfb0e[_0x0cf5('0xed')](function(_0xbb9349){_0x509eba['push'](_0xbb9349[_0x0cf5('0x53')]({'exitAt':moment()['format'](_0x0cf5('0xee'))}));});return Promise[_0x0cf5('0x4c')](_0x509eba);})[_0x0cf5('0x1e')](function(){return _0x5ad18b[_0x0cf5('0x53')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})['then'](respondWithResult(_0xba127f,null))[_0x0cf5('0x4d')](handleError(_0xba127f,null));};exports[_0x0cf5('0xf7')]=function(_0x311bd6,_0x44b504){var _0x33756f;return db[_0x0cf5('0xa2')]['update']({'paused':0x1},{'where':{'UserId':_0x311bd6[_0x0cf5('0x4f')]['id']},'individualHooks':!![]})[_0x0cf5('0x1e')](function(){return db[_0x0cf5('0x32')][_0x0cf5('0x2d')]({'where':{'id':_0x311bd6[_0x0cf5('0x4f')]['id'],'role':_0x0cf5('0x62')},'attributes':['id',_0x0cf5('0x2e'),_0x0cf5('0x1f'),_0x0cf5('0x58'),'interface',_0x0cf5('0x8e')]});})[_0x0cf5('0x1e')](handleEntityNotFound(_0x44b504,null))[_0x0cf5('0x1e')](function(_0x5a3011){if(_0x5a3011){_0x33756f=_0x5a3011;return db['MemberReport'][_0x0cf5('0x41')]({'where':{'membername':_0x33756f['name'],'type':_0x0cf5('0xf2'),'exitAt':null}});}})[_0x0cf5('0x1e')](function(_0x35110b){if(_0x35110b[_0x0cf5('0x45')]){var _0x17cedb=moment()[_0x0cf5('0x9e')](_0x0cf5('0xee'));for(var _0x413956=0x0,_0x3d7aab=_0x35110b[_0x0cf5('0x45')];_0x413956<_0x3d7aab;_0x413956++){_0x35110b[_0x413956][_0x0cf5('0xf8')]({'exitAt':_0x17cedb});}}})[_0x0cf5('0x1e')](function(){var _0x404b5a=[];var _0x327b5a=utils['getChannels']();_0x327b5a[_0x0cf5('0xed')](function(_0x2f5c3d){_0x404b5a[_0x0cf5('0x46')]({'channel':_0x2f5c3d,'membername':_0x33756f['name'],'interface':_[_0x0cf5('0x5b')](_0x33756f[_0x0cf5('0x91')])?util['format'](_0x0cf5('0xe2'),_0x33756f[_0x0cf5('0x2e')]):_0x33756f[_0x0cf5('0x91')],'type':_0x0cf5('0xf2'),'enterAt':moment()[_0x0cf5('0x9e')](_0x0cf5('0xee')),'data1':_0x311bd6[_0x0cf5('0x54')]['type']||_0x0cf5('0xf9'),'role':_0x33756f[_0x0cf5('0x1f')],'internal':_0x33756f[_0x0cf5('0x58')]});});return db['MemberReport'][_0x0cf5('0x77')](_0x404b5a,{'individualHooks':!![]});})[_0x0cf5('0x1e')](function(){return _0x33756f['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x311bd6['body'][_0x0cf5('0x34')]||_0x0cf5('0xf9'),'lastPauseAt':moment()['format'](_0x0cf5('0xee'))});})[_0x0cf5('0x1e')](respondWithResult(_0x44b504,null))['catch'](handleError(_0x44b504,null));};exports['unpause']=function(_0x256478,_0x4d6435){if(_0x256478[_0x0cf5('0x54')][_0x0cf5('0x8d')]&&!utils[_0x0cf5('0x92')](_0x256478[_0x0cf5('0x54')][_0x0cf5('0x8d')])){throw new APIBadRequestError(util[_0x0cf5('0x9e')](_0x0cf5('0xfa'),_0x256478[_0x0cf5('0x54')][_0x0cf5('0x8d')]));}return db[_0x0cf5('0x32')]['find']({'where':{'id':_0x256478[_0x0cf5('0x4f')]['id']},'attributes':['id',_0x0cf5('0x2e'),_0x0cf5('0x1f'),_0x0cf5('0x58'),_0x0cf5('0x91'),_0x0cf5('0x8e'),_0x0cf5('0x90'),_0x0cf5('0xfb'),_0x0cf5('0xfc'),'faxPause',_0x0cf5('0xfd'),'smsPause','whatsappPause',_0x0cf5('0xfe'),_0x0cf5('0xff')]})['then'](function(_0x234fa1){if(!_0x234fa1){throw new APINotFoundError(util[_0x0cf5('0x9e')](_0x0cf5('0xb8'),_0x256478['params']['id']));}return _0x234fa1[_0x0cf5('0x100')](_0x256478['body'][_0x0cf5('0x8d')]);})[_0x0cf5('0x1e')](respondWithResult(_0x4d6435,null))[_0x0cf5('0x4d')](APIHandleError(_0x4d6435));};exports[_0x0cf5('0x101')]=function(_0x1e1266,_0x584f22){var _0x2af26a={};var _0x5dcfe3={};var _0x1ce404;var _0x455524;return db[_0x0cf5('0x32')][_0x0cf5('0x86')]({'where':{'id':_0x1e1266[_0x0cf5('0x4f')]['id']}})[_0x0cf5('0x1e')](handleEntityNotFound(_0x584f22,null))['then'](function(_0x2a8d37){if(_0x2a8d37){_0x1ce404=_0x2a8d37;_0x5dcfe3[_0x0cf5('0xc4')]=_[_0x0cf5('0xc0')](db[_0x0cf5('0x102')][_0x0cf5('0xc2')]);_0x5dcfe3[_0x0cf5('0x3b')]=_[_0x0cf5('0xc0')](_0x1e1266[_0x0cf5('0x3b')]);_0x5dcfe3[_0x0cf5('0xc9')]=_['intersection'](_0x5dcfe3[_0x0cf5('0xc4')],_0x5dcfe3[_0x0cf5('0x3b')]);_0x2af26a[_0x0cf5('0x40')]=_[_0x0cf5('0xc3')](_0x5dcfe3['model'],qs['fields'](_0x1e1266[_0x0cf5('0x3b')][_0x0cf5('0xc5')]));_0x2af26a[_0x0cf5('0x40')]=_0x2af26a[_0x0cf5('0x40')]['length']?_0x2af26a[_0x0cf5('0x40')]:_0x5dcfe3[_0x0cf5('0xc4')];_0x2af26a[_0x0cf5('0xc6')]=qs[_0x0cf5('0xc7')](_0x1e1266['query']['sort']);_0x2af26a[_0x0cf5('0xc8')]=qs['filters'](_[_0x0cf5('0xce')](_0x1e1266[_0x0cf5('0x3b')],_0x5dcfe3[_0x0cf5('0xc9')]));if(_0x1e1266[_0x0cf5('0x3b')]['filter']){_0x2af26a[_0x0cf5('0xc8')]=_['merge'](_0x2af26a[_0x0cf5('0xc8')],{'$or':_[_0x0cf5('0x2a')](_0x2af26a[_0x0cf5('0x40')],function(_0x1c3b52){var _0x441c52={};_0x441c52[_0x1c3b52]={'$like':'%'+_0x1e1266[_0x0cf5('0x3b')]['filter']+'%'};return _0x441c52;})});}_0x2af26a=_[_0x0cf5('0xca')]({},_0x2af26a,_0x1e1266['options']);return _0x1ce404[_0x0cf5('0x101')](_0x2af26a);}})[_0x0cf5('0x1e')](function(_0x48f949){if(_0x48f949){_0x455524=_0x48f949[_0x0cf5('0x45')];if(!_0x1e1266[_0x0cf5('0x3b')][_0x0cf5('0xb9')](_0x0cf5('0xcc'))){_0x2af26a['limit']=qs[_0x0cf5('0x1b')](_0x1e1266['query'][_0x0cf5('0x1b')]);_0x2af26a[_0x0cf5('0x18')]=qs[_0x0cf5('0x18')](_0x1e1266['query'][_0x0cf5('0x18')]);}return _0x1ce404['getTeams'](_0x2af26a);}})[_0x0cf5('0x1e')](function(_0x931dcc){if(_0x931dcc){return _0x931dcc?{'count':_0x455524,'rows':_0x931dcc}:null;}})[_0x0cf5('0x1e')](respondWithResult(_0x584f22,null))['catch'](handleError(_0x584f22,null));};exports['addTeams']=function(_0x490ab5,_0x1d0e9d){var _0x4084c0=_0x490ab5[_0x0cf5('0x4f')]['id'];var _0x53f63b=_0x490ab5[_0x0cf5('0x54')]?_0x490ab5[_0x0cf5('0x54')]['ids']:null;var _0x11fb3c=[];return Promise[_0x0cf5('0xf5')]()[_0x0cf5('0x1e')](function(){if(!_0x53f63b)throw new APIBadRequestError(_0x0cf5('0x103'));})['then'](function(){return db['User'][_0x0cf5('0x86')]({'where':{'id':_0x4084c0}});})[_0x0cf5('0x1e')](function(_0x1f99bd){if(!_0x1f99bd)throw new APINotFoundError(util[_0x0cf5('0x9e')](_0x0cf5('0xb8'),_0x490ab5['params']['id']));return db[_0x0cf5('0x5d')]['transaction'](function(_0x5d27bf){return _0x1f99bd[_0x0cf5('0x104')](_0x53f63b,{'transaction':_0x5d27bf})[_0x0cf5('0x1e')](function(){return db[_0x0cf5('0x102')]['findAll']({'where':{'id':{'$in':_0x53f63b}}});})['then'](function(_0xd637df){var _0xbb2e19=_[_0x0cf5('0x2a')](_0xd637df,function(_0x300029){return _0x300029[_0x0cf5('0x105')]();});return Promise[_0x0cf5('0x4c')](_0xbb2e19);})[_0x0cf5('0x1e')](function(_0x4e1c7d){_0x11fb3c=_[_0x0cf5('0x106')](_0x4e1c7d);var _0x2dfa21=_[_0x0cf5('0x2a')](_0x11fb3c,function(_0x4392e7){return _0x4392e7['addAgent'](_0x1f99bd['id'],{'transaction':_0x5d27bf});});return Promise[_0x0cf5('0x4c')](_0x2dfa21);})[_0x0cf5('0x1e')](function(){if(!_0x1f99bd[_0x0cf5('0x8e')])return;var _0x137253=_[_0x0cf5('0x29')](_0x11fb3c,function(_0x4667e3){return _0x4667e3[_0x0cf5('0x107')](_0x0cf5('0x8d'))==='Voice';});var _0x5c0664=_['map'](_0x137253,function(_0x302a64){return db['UserVoiceQueueRt'][_0x0cf5('0xeb')]({'membername':_0x1f99bd[_0x0cf5('0x2e')],'UserId':_0x1f99bd['id'],'queue_name':_0x302a64[_0x0cf5('0x2e')],'VoiceQueueId':_0x302a64['id'],'interface':_[_0x0cf5('0x5b')](_0x1f99bd[_0x0cf5('0x91')])?util[_0x0cf5('0x9e')](_0x0cf5('0xe2'),_0x1f99bd[_0x0cf5('0x2e')]):_0x1f99bd[_0x0cf5('0x91')],'paused':_0x1f99bd[_0x0cf5('0x90')]||![],'penalty':_0x1f99bd[_0x0cf5('0x97')]},{'transaction':_0x5d27bf});});return Promise['all'](_0x5c0664);})[_0x0cf5('0x1e')](function(){return db[_0x0cf5('0x108')][_0x0cf5('0x41')]({'where':{'teamId':{'$in':_0x53f63b}}});})[_0x0cf5('0x1e')](function(_0x449ff1){var _0x31ba38=_['map'](_0x449ff1,function(_0x773fba){return db['UserVoicePrefix'][_0x0cf5('0x6f')]({'UserId':_0x1f99bd['id'],'VoicePrefixId':_0x773fba[_0x0cf5('0x109')]},{'transaction':_0x5d27bf});});return Promise[_0x0cf5('0x4c')](_0x31ba38);});});})['then'](function(){for(var _0x2bb108=0x0;_0x2bb108<_0x11fb3c[_0x0cf5('0x45')];_0x2bb108++){var _0x517697=_0x11fb3c[_0x2bb108]['getDataValue']('channel');var _0x530263=_0x517697+'QueueId';socket[_0x0cf5('0x20')]('user'+_0x517697+_0x0cf5('0x9b'),{'UserId':_0x4084c0,['queueField']:_0x11fb3c[_0x2bb108]['id']});}})[_0x0cf5('0x1e')](respondWithStatusCode(_0x1d0e9d,null))['catch'](APIHandleError(_0x1d0e9d));};exports['removeTeams']=function(_0x7b22d4,_0x4f7dd9){var _0x550702=_0x7b22d4[_0x0cf5('0x4f')]['id'];var _0x4cc12d=null;if(_0x7b22d4[_0x0cf5('0x3b')][_0x0cf5('0x56')]){_0x4cc12d=_[_0x0cf5('0xa0')](_0x7b22d4[_0x0cf5('0x3b')]['ids'])?_0x7b22d4['query'][_0x0cf5('0x56')]:[_0x7b22d4['query'][_0x0cf5('0x56')]];}var _0x529704=[];return Promise[_0x0cf5('0xf5')]()[_0x0cf5('0x1e')](function(){if(!_0x4cc12d)throw new APIBadRequestError(_0x0cf5('0x10a'));})[_0x0cf5('0x1e')](function(){return db[_0x0cf5('0x32')]['findOne']({'where':{'id':_0x550702}});})[_0x0cf5('0x1e')](function(_0x28537a){if(!_0x28537a)throw new APINotFoundError(util[_0x0cf5('0x9e')]('User\x20with\x20id\x20%s\x20not\x20found',_0x7b22d4[_0x0cf5('0x4f')]['id']));return db[_0x0cf5('0x5d')][_0x0cf5('0x10b')](function(_0x2d5cbf){return _0x28537a[_0x0cf5('0x10c')](_0x4cc12d,{'transaction':_0x2d5cbf})[_0x0cf5('0x1e')](function(){return db['Team']['findAll']({'where':{'id':{'$in':_0x4cc12d}}});})[_0x0cf5('0x1e')](function(_0x34147b){var _0x3f596c=_[_0x0cf5('0x2a')](_0x34147b,function(_0xa1ac8c){return _0xa1ac8c['getAssociatedQueues']();});return Promise[_0x0cf5('0x4c')](_0x3f596c);})[_0x0cf5('0x1e')](function(_0x3d785a){_0x529704=_[_0x0cf5('0x106')](_0x3d785a);var _0x2e7019=_['map'](_0x529704,function(_0xe3e901){return _0xe3e901[_0x0cf5('0x10d')](_0x28537a['id'],{'transaction':_0x2d5cbf});});return Promise[_0x0cf5('0x4c')](_0x2e7019);})[_0x0cf5('0x1e')](function(){if(!_0x28537a[_0x0cf5('0x8e')])return;var _0x55e727=_[_0x0cf5('0x29')](_0x529704,function(_0x38d314){return _0x38d314[_0x0cf5('0x107')](_0x0cf5('0x8d'))==='Voice';});var _0x36f9b7=_[_0x0cf5('0x2a')](_0x55e727,function(_0x31b78c){return db[_0x0cf5('0xa2')][_0x0cf5('0x21')]({'where':{'VoiceQueueId':_0x31b78c['id'],'UserId':_0x28537a['id']},'transaction':_0x2d5cbf});});return Promise[_0x0cf5('0x4c')](_0x36f9b7);})['then'](function(){return db[_0x0cf5('0x108')][_0x0cf5('0x41')]({'where':{'teamId':{'$in':_0x4cc12d}}});})[_0x0cf5('0x1e')](function(_0x484ab3){var _0x3a343e=_[_0x0cf5('0x2a')](_0x484ab3,function(_0x226715){return db['UserVoicePrefix'][_0x0cf5('0x21')]({'where':{'UserId':_0x28537a['id'],'VoicePrefixId':_0x226715[_0x0cf5('0x109')]}},{'transaction':_0x2d5cbf});});return Promise[_0x0cf5('0x4c')](_0x3a343e);});});})[_0x0cf5('0x1e')](function(){for(var _0x569e92=0x0;_0x569e92<_0x529704[_0x0cf5('0x45')];_0x569e92++){var _0x38caa3=_0x529704[_0x569e92][_0x0cf5('0x107')](_0x0cf5('0x8d'));var _0x5f7337=_0x38caa3+_0x0cf5('0x99');socket[_0x0cf5('0x20')](_0x0cf5('0x25')+_0x38caa3+_0x0cf5('0xa1'),{'UserId':_0x550702,['queueField']:_0x529704[_0x569e92]['id']});}})['then'](respondWithStatusCode(_0x4f7dd9,null))[_0x0cf5('0x4d')](APIHandleError(_0x4f7dd9));};exports[_0x0cf5('0x10e')]=function(_0xb3da8f,_0x444d91){var _0x50c936={};var _0x12fef4={};var _0x4d507f;var _0x260fc9;return db[_0x0cf5('0x32')][_0x0cf5('0x86')]({'where':{'id':_0xb3da8f[_0x0cf5('0x4f')]['id']}})[_0x0cf5('0x1e')](handleEntityNotFound(_0x444d91,null))[_0x0cf5('0x1e')](function(_0x2be44a){if(_0x2be44a){_0x4d507f=_0x2be44a;_0x12fef4[_0x0cf5('0xc4')]=_[_0x0cf5('0xc0')](db['CmList'][_0x0cf5('0xc2')]);_0x12fef4['query']=_['keys'](_0xb3da8f[_0x0cf5('0x3b')]);_0x12fef4[_0x0cf5('0xc9')]=_[_0x0cf5('0xc3')](_0x12fef4[_0x0cf5('0xc4')],_0x12fef4['query']);_0x50c936[_0x0cf5('0x40')]=_[_0x0cf5('0xc3')](_0x12fef4[_0x0cf5('0xc4')],qs[_0x0cf5('0xc5')](_0xb3da8f[_0x0cf5('0x3b')][_0x0cf5('0xc5')]));_0x50c936['attributes']=_0x50c936[_0x0cf5('0x40')][_0x0cf5('0x45')]?_0x50c936[_0x0cf5('0x40')]:_0x12fef4[_0x0cf5('0xc4')];_0x50c936['order']=qs['sort'](_0xb3da8f[_0x0cf5('0x3b')][_0x0cf5('0xc7')]);_0x50c936[_0x0cf5('0xc8')]=qs[_0x0cf5('0xc9')](_[_0x0cf5('0xce')](_0xb3da8f[_0x0cf5('0x3b')],_0x12fef4['filters']));if(_0xb3da8f[_0x0cf5('0x3b')][_0x0cf5('0x29')]){_0x50c936[_0x0cf5('0xc8')]=_['merge'](_0x50c936[_0x0cf5('0xc8')],{'$or':_['map'](_0x50c936['attributes'],function(_0x6f5143){var _0x5b3125={};_0x5b3125[_0x6f5143]={'$like':'%'+_0xb3da8f['query'][_0x0cf5('0x29')]+'%'};return _0x5b3125;})});}_0x50c936=_[_0x0cf5('0xca')]({},_0x50c936,_0xb3da8f[_0x0cf5('0x50')]);return _0x4d507f['getLists'](_0x50c936);}})['then'](function(_0x3386e3){if(_0x3386e3){_0x260fc9=_0x3386e3[_0x0cf5('0x45')];if(!_0xb3da8f[_0x0cf5('0x3b')][_0x0cf5('0xb9')](_0x0cf5('0xcc'))){_0x50c936['limit']=qs[_0x0cf5('0x1b')](_0xb3da8f[_0x0cf5('0x3b')][_0x0cf5('0x1b')]);_0x50c936[_0x0cf5('0x18')]=qs[_0x0cf5('0x18')](_0xb3da8f[_0x0cf5('0x3b')][_0x0cf5('0x18')]);}return _0x4d507f['getLists'](_0x50c936);}})['then'](function(_0x567798){if(_0x567798){return _0x567798?{'count':_0x260fc9,'rows':_0x567798}:null;}})['then'](respondWithResult(_0x444d91,null))[_0x0cf5('0x4d')](handleError(_0x444d91,null));};exports[_0x0cf5('0x10f')]=function(_0x582085,_0x2ebe94){var _0x34d10f={};var _0x3a25a0={};var _0x4c6549;return db[_0x0cf5('0x32')]['findOne']({'where':{'id':_0x582085[_0x0cf5('0x4f')]['id']}})[_0x0cf5('0x1e')](handleEntityNotFound(_0x2ebe94,null))[_0x0cf5('0x1e')](function(_0x5c4ed2){if(_0x5c4ed2){_0x4c6549=_0x5c4ed2;_0x3a25a0[_0x0cf5('0xc4')]=_[_0x0cf5('0xc0')](db[_0x0cf5('0x32')][_0x0cf5('0xc2')]);_0x3a25a0[_0x0cf5('0x3b')]=_[_0x0cf5('0xc0')](_0x582085[_0x0cf5('0x3b')]);_0x3a25a0[_0x0cf5('0xc9')]=_[_0x0cf5('0xc3')](_0x3a25a0[_0x0cf5('0xc4')],_0x3a25a0['query']);_0x34d10f['attributes']=_['intersection'](_0x3a25a0[_0x0cf5('0xc4')],qs[_0x0cf5('0xc5')](_0x582085[_0x0cf5('0x3b')][_0x0cf5('0xc5')]));_0x34d10f['attributes']=_0x34d10f[_0x0cf5('0x40')]['length']?_0x34d10f[_0x0cf5('0x40')]:_0x3a25a0['model'];_0x34d10f[_0x0cf5('0xc6')]=qs['sort'](_0x582085['query'][_0x0cf5('0xc7')]);_0x34d10f[_0x0cf5('0xc8')]=qs[_0x0cf5('0xc9')](_[_0x0cf5('0xce')](_0x582085[_0x0cf5('0x3b')],_0x3a25a0[_0x0cf5('0xc9')]));if(_0x582085[_0x0cf5('0x3b')][_0x0cf5('0x29')]){_0x34d10f[_0x0cf5('0xc8')]=_[_0x0cf5('0xca')](_0x34d10f[_0x0cf5('0xc8')],{'$or':_['map'](_0x34d10f[_0x0cf5('0x40')],function(_0x39efb6){var _0xbe99bd={};_0xbe99bd[_0x39efb6]={'$like':'%'+_0x582085[_0x0cf5('0x3b')]['filter']+'%'};return _0xbe99bd;})});}_0x34d10f[_0x0cf5('0xc4')]=db[_0x0cf5('0x32')];_0x34d10f['as']='Agents';_0x34d10f=_[_0x0cf5('0xca')]({},_0x34d10f,_0x582085[_0x0cf5('0x50')]);return _0x4c6549[_0x0cf5('0xe9')]({'include':[_0x34d10f]});}})['then'](function(_0x21708e){if(_0x21708e){var _0x278208={},_0x5ab885=[];for(var _0x5bd556=0x0;_0x5bd556<_0x21708e[_0x0cf5('0x45')];_0x5bd556+=0x1){for(var _0x4d9738=0x0,_0x382268;_0x4d9738<_0x21708e[_0x5bd556][_0x0cf5('0x26')][_0x0cf5('0x45')];_0x4d9738+=0x1){_0x382268=_0x21708e[_0x5bd556][_0x0cf5('0x26')][_0x4d9738][_0x0cf5('0x22')]({'plain':!![]});_0x278208[_0x382268['id']]=_0x382268;}}_0x278208=_[_0x0cf5('0x110')](_0x278208);for(var _0x55ffd7=qs[_0x0cf5('0x18')](_0x582085[_0x0cf5('0x3b')][_0x0cf5('0x18')]);_0x55ffd7<_0x278208[_0x0cf5('0x45')]&&_0x5ab885[_0x0cf5('0x45')]=_0x4119fb){_0xee30b4=_0x4119fb;_0x514573=0xc8;}else{_0x514573=0xce;}_0x337a93[_0xfcb0('0x19')](_0x514573);return _0x337a93[_0xfcb0('0x1a')](_0xfcb0('0x1b'),_0x5e91ed+'-'+_0xee30b4+'/'+_0x4119fb)[_0xfcb0('0x14')](_0x133d9d);}return null;};}function saveUpdates(_0x3c7181){return function(_0x58154c){if(_0x58154c){return _0x58154c[_0xfcb0('0x1c')](_0x3c7181)[_0xfcb0('0x1d')](function(_0x3ec8b0){if(_0x3ec8b0[_0xfcb0('0x1e')]===_0xfcb0('0x1f')){socket[_0xfcb0('0x20')](_0xfcb0('0x21')+_0x3ec8b0['id'],_0x3ec8b0);}return _0x3ec8b0;});}return null;};}function removeEntity(_0x3a87b3){return function(_0x49fb3b){if(_0x49fb3b){return _0x49fb3b['destroy']()['then'](function(){var _0x46b29b=_0x49fb3b[_0xfcb0('0x22')]({'plain':!![]});if(_0x46b29b['role']==='admin')return;var _0x4ecf1f=[{'name':_0xfcb0('0x23'),'value':_0xfcb0('0x24'),'ignore':!![]},{'name':'Agents','value':_0xfcb0('0x1f'),'ignore':![]},{'name':_0xfcb0('0x25'),'value':_0xfcb0('0x26'),'ignore':![]}];var _0x5c5c84=_(_0x4ecf1f)[_0xfcb0('0x27')](_0xfcb0('0x28'))[_0xfcb0('0x29')]('value')[_0xfcb0('0x2a')]();if(_['includes'](_0x5c5c84,_0x46b29b[_0xfcb0('0x1e')])){return;}var _0x51f852=_['find'](_0x4ecf1f,['value',_0x46b29b[_0xfcb0('0x1e')]])[_0xfcb0('0x2b')];return db[_0xfcb0('0x2c')][_0xfcb0('0x2d')]({'where':{'type':_0x51f852,'resourceId':_0x46b29b['id']}})[_0xfcb0('0x1d')](function(){return _0x49fb3b;});})[_0xfcb0('0x1d')](function(){_0x3a87b3[_0xfcb0('0x19')](0xcc)[_0xfcb0('0x13')]();});}};}function handleEntityNotFound(_0x382ec5){return function(_0x351b31){if(!_0x351b31){_0x382ec5[_0xfcb0('0x12')](0x194);}return _0x351b31;};}function handleError(_0x5783d2,_0x34f87d){_0x34f87d=_0x34f87d||0x1f4;return function(_0x19724f){logger['error'](_0x19724f[_0xfcb0('0x2e')]);if(_0x19724f[_0xfcb0('0x2b')]){delete _0x19724f[_0xfcb0('0x2b')];}_0x5783d2[_0xfcb0('0x19')](_0x34f87d)['send'](_0x19724f);};}function getUserAttributes(){return _(db[_0xfcb0('0x2f')][_0xfcb0('0x30')])[_0xfcb0('0x29')](function(_0x280bee){return{'name':_0x280bee['fieldName'],'type':_0x280bee[_0xfcb0('0x31')][_0xfcb0('0x32')]};})[_0xfcb0('0x27')](function(_0xca9871){return![_0xfcb0('0x33'),_0xfcb0('0x34'),'previousPasswords','resetPasswordToken',_0xfcb0('0x35'),_0xfcb0('0x36')]['includes'](_0xca9871[_0xfcb0('0x2b')]);})['value']();}exports[_0xfcb0('0x37')]=function(_0x1b5480,_0x43c228){var _0x5429cf={},_0x1127e8={'count':0x0,'rows':[]};var _0x3c056e=getUserAttributes();_0x5429cf=qs['getOptions'](_0x3c056e,_0x1b5480);var _0x57e8c8={'where':_0x5429cf[_0xfcb0('0x38')]};return db[_0xfcb0('0x2f')][_0xfcb0('0x17')](_0x57e8c8)[_0xfcb0('0x1d')](function(_0x210d36){_0x1127e8['count']=_0x210d36;if(_0x1b5480[_0xfcb0('0x39')]['includeAll']){_0x5429cf[_0xfcb0('0x3a')]=[{'all':!![]}];}if(_0x1b5480[_0xfcb0('0x39')]['userSetting']==='true'){_0x5429cf[_0xfcb0('0x3a')]=[{'model':db[_0xfcb0('0x3b')],'as':'userSetting'}];}if(!_[_0xfcb0('0x3c')](_0x5429cf[_0xfcb0('0x3d')],'id')){_0x5429cf['attributes']['push']('id');}return db[_0xfcb0('0x2f')][_0xfcb0('0x3e')](_0x5429cf);})[_0xfcb0('0x1d')](function(_0x3e09d4){_0x1127e8[_0xfcb0('0x3f')]=_0x3e09d4;if(_0x1b5480[_0xfcb0('0x39')][_0xfcb0('0x40')]===_0xfcb0('0x41')){var _0x1ce5a6=[];for(var _0x3d8c0e=0x0;_0x3d8c0e<_0x1127e8[_0xfcb0('0x3f')][_0xfcb0('0x42')];_0x3d8c0e++){_0x1ce5a6[_0xfcb0('0x43')](get_open_tabs('chat',_0x1127e8[_0xfcb0('0x3f')][_0x3d8c0e][_0xfcb0('0x44')]));_0x1ce5a6[_0xfcb0('0x43')](get_open_tabs(_0xfcb0('0x45'),_0x1127e8[_0xfcb0('0x3f')][_0x3d8c0e][_0xfcb0('0x44')]));_0x1ce5a6[_0xfcb0('0x43')](get_open_tabs(_0xfcb0('0x46'),_0x1127e8[_0xfcb0('0x3f')][_0x3d8c0e][_0xfcb0('0x44')]));_0x1ce5a6['push'](get_open_tabs(_0xfcb0('0x47'),_0x1127e8[_0xfcb0('0x3f')][_0x3d8c0e][_0xfcb0('0x44')]));_0x1ce5a6[_0xfcb0('0x43')](get_open_tabs(_0xfcb0('0x48'),_0x1127e8[_0xfcb0('0x3f')][_0x3d8c0e]['dataValues']));_0x1ce5a6[_0xfcb0('0x43')](get_open_tabs(_0xfcb0('0x49'),_0x1127e8['rows'][_0x3d8c0e][_0xfcb0('0x44')]));}return Promise[_0xfcb0('0x4a')](_0x1ce5a6)[_0xfcb0('0x1d')](function(){return _0x1127e8;});}else{return _0x1127e8;}})['then'](respondWithFilteredResult(_0x43c228,_0x5429cf))['catch'](handleError(_0x43c228,null));};exports[_0xfcb0('0x4b')]=function(_0x5c7bec,_0x3314a8){var _0x549a90=getUserAttributes();_0x5c7bec['query']['id']=_0x5c7bec['params']['id'];var _0x3d6399=qs[_0xfcb0('0x4c')](_0x549a90,_0x5c7bec);if(_0x5c7bec['query']['includeAll']){_0x3d6399[_0xfcb0('0x3a')]=[{'all':!![]}];}if(_0x5c7bec['query'][_0xfcb0('0x4d')]===_0xfcb0('0x41')){_0x3d6399[_0xfcb0('0x3a')]=[{'model':db[_0xfcb0('0x3b')],'as':_0xfcb0('0x4d')}];}_0x3d6399=_[_0xfcb0('0x4e')]({},_0x3d6399,_0x5c7bec[_0xfcb0('0x4f')]);if(!_[_0xfcb0('0x3c')](_0x3d6399[_0xfcb0('0x3d')],'id')){_0x3d6399[_0xfcb0('0x3d')][_0xfcb0('0x43')]('id');}return db[_0xfcb0('0x2f')][_0xfcb0('0x50')](_0x3d6399)[_0xfcb0('0x1d')](handleEntityNotFound(_0x3314a8,null))[_0xfcb0('0x1d')](function(_0x9b2726){var _0x444436=[];values=_0x9b2726;if(_0x5c7bec['query'][_0xfcb0('0x40')]===_0xfcb0('0x41')){_0x444436[_0xfcb0('0x43')](get_open_tabs(_0xfcb0('0x51'),_0x9b2726[_0xfcb0('0x44')]));_0x444436['push'](get_open_tabs('sms',_0x9b2726[_0xfcb0('0x44')]));_0x444436[_0xfcb0('0x43')](get_open_tabs('openchannel',_0x9b2726[_0xfcb0('0x44')]));_0x444436[_0xfcb0('0x43')](get_open_tabs(_0xfcb0('0x49'),_0x9b2726[_0xfcb0('0x44')]));_0x444436[_0xfcb0('0x43')](get_open_tabs(_0xfcb0('0x46'),_0x9b2726['dataValues']));_0x444436[_0xfcb0('0x43')](get_open_tabs(_0xfcb0('0x47'),_0x9b2726[_0xfcb0('0x44')]));return Promise['all'](_0x444436);}else{return values;}})[_0xfcb0('0x1d')](function(){return values;})['then'](respondWithResult(_0x3314a8,null))[_0xfcb0('0x52')](handleError(_0x3314a8,null));};exports[_0xfcb0('0x1c')]=function(_0x53ab9f,_0x123218){if(_0x53ab9f[_0xfcb0('0x53')]['id']){delete _0x53ab9f[_0xfcb0('0x53')]['id'];}delete _0x53ab9f['body'][_0xfcb0('0x1e')];return db[_0xfcb0('0x2f')][_0xfcb0('0x50')]({'where':{'id':_0x53ab9f[_0xfcb0('0x54')]['id']}})[_0xfcb0('0x1d')](handleEntityNotFound(_0x123218,null))['then'](saveUpdates(_0x53ab9f[_0xfcb0('0x53')],null))[_0xfcb0('0x1d')](respondWithResult(_0x123218,null))['catch'](handleError(_0x123218,null));};exports['describe']=function(_0x2b96b2,_0x2ee332){return db[_0xfcb0('0x2f')]['describe']()[_0xfcb0('0x1d')](respondWithResult(_0x2ee332,null))['catch'](handleError(_0x2ee332,null));};exports[_0xfcb0('0x55')]=function(_0x5e8c0c,_0x4af158){return db[_0xfcb0('0x2f')]['find']({'where':{'id':_0x5e8c0c[_0xfcb0('0x54')]['id']}})[_0xfcb0('0x1d')](handleEntityNotFound(_0x4af158,null))[_0xfcb0('0x1d')](function(_0x42f6c5){if(_0x42f6c5){return _0x42f6c5[_0xfcb0('0x55')](_0x5e8c0c[_0xfcb0('0x53')][_0xfcb0('0x56')],_[_0xfcb0('0x57')](_0x5e8c0c['body'],[_0xfcb0('0x56'),'id'])||{});}})[_0xfcb0('0x1d')](respondWithResult(_0x4af158,null))[_0xfcb0('0x52')](handleError(_0x4af158,null));};function validateUser(_0x2caea3){return new Promise(function(_0x4b9df7,_0xdb87c8){if(_0x2caea3[_0xfcb0('0x58')])return _0x4b9df7(_0x2caea3);return db['Setting'][_0xfcb0('0x59')](0x1)['then'](function(_0x22fbd5){if(_0x22fbd5[_0xfcb0('0x5a')])authService[_0xfcb0('0x5b')](_0x2caea3[_0xfcb0('0x33')]);db[_0xfcb0('0x2f')][_0xfcb0('0x5c')](_0xfcb0('0x58'))[_0xfcb0('0x1d')](function(_0x4ad03f){if(_[_0xfcb0('0x5d')](_0x4ad03f)){_0x2caea3[_0xfcb0('0x58')]=_0x22fbd5['min_internal']||0x1;return;}if(_[_0xfcb0('0x5d')](_0x22fbd5[_0xfcb0('0x5e')])||_0x22fbd5[_0xfcb0('0x5e')]===_0x4ad03f){_0x2caea3['internal']=_0x4ad03f+0x1;return;}if(_0x22fbd5[_0xfcb0('0x5e')]>_0x4ad03f){_0x2caea3[_0xfcb0('0x58')]=_0x22fbd5[_0xfcb0('0x5e')];return;}return db[_0xfcb0('0x5f')][_0xfcb0('0x39')](_0xfcb0('0x60'),{'type':db['sequelize']['QueryTypes'][_0xfcb0('0x61')]})['then'](function(_0x538d9e){if(_0x538d9e&&_0x538d9e[_0xfcb0('0x42')]){for(var _0x152b63=0x0,_0x5e990e=_0x538d9e[_0xfcb0('0x42')];_0x152b63<_0x5e990e&&_['isNil'](_0x2caea3[_0xfcb0('0x58')]);_0x152b63++){if(_0x22fbd5[_0xfcb0('0x5e')]<=_0x538d9e[_0x152b63]['from']){_0x2caea3[_0xfcb0('0x58')]=_0x538d9e[_0x152b63][_0xfcb0('0x62')];}else if(_0x22fbd5['min_internal']>_0x538d9e[_0x152b63][_0xfcb0('0x62')]&&_0x22fbd5['min_internal']<=_0x538d9e[_0x152b63]['to']){_0x2caea3[_0xfcb0('0x58')]=_0x22fbd5['min_internal'];}}}if(_[_0xfcb0('0x5d')](_0x2caea3[_0xfcb0('0x58')])){_0x2caea3['internal']=_0x4ad03f+0x1;}return _0x4b9df7(_0x2caea3);});});})['catch'](function(_0x566673){_0xdb87c8(_0x566673);});});}function updateUser(_0x596c46){return new Promise(function(_0x478af0,_0x25577a){try{if(_0x596c46['voicemail']){_0x596c46[_0xfcb0('0x63')]=_0x596c46[_0xfcb0('0x58')];_0x596c46[_0xfcb0('0x64')]={'mailbox':_0x596c46[_0xfcb0('0x58')],'password':_0x596c46[_0xfcb0('0x33')],'fullname':_0x596c46[_0xfcb0('0x65')],'email':_0x596c46[_0xfcb0('0x66')]};}if(_0x596c46[_0xfcb0('0x1e')]===_0xfcb0('0x1f')){if(!_0x596c46[_0xfcb0('0x67')])_0x596c46[_0xfcb0('0x67')]=[_0xfcb0('0x68'),_0xfcb0('0x69'),'103',_0xfcb0('0x6a'),_0xfcb0('0x6b'),_0xfcb0('0x6c'),_0xfcb0('0x6d'),_0xfcb0('0x6e'),_0xfcb0('0x6f'),_0xfcb0('0x70'),'109','100',_0xfcb0('0x71'),_0xfcb0('0x72'),'115'];}_0x478af0(_0x596c46);}catch(_0x19ff6e){_0x25577a(_0x19ff6e);}});}exports['create']=function(_0x5ec5c0,_0x53515e){if(_0x5ec5c0[_0xfcb0('0x24')][_0xfcb0('0x1e')]===_0xfcb0('0x1f'))throw new Error('Unauthorized');if(_0x5ec5c0[_0xfcb0('0x53')][_0xfcb0('0x1e')]===_0xfcb0('0x24')&&_0x5ec5c0['user'][_0xfcb0('0x1e')]!==_0xfcb0('0x73')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_0x5ec5c0[_0xfcb0('0x53')][_0xfcb0('0x1e')]==='admin'&&_0x5ec5c0[_0xfcb0('0x24')]['role']!=='admin'){throw new Error(_0xfcb0('0x74'));}return licenseUtil[_0xfcb0('0x75')]([_0x5ec5c0[_0xfcb0('0x53')]])[_0xfcb0('0x1d')](function(){return validateUser(_0x5ec5c0[_0xfcb0('0x53')]);})[_0xfcb0('0x1d')](function(_0x1c15da){return updateUser(_0x1c15da)['then'](function(_0x45456c){if(_0x45456c[_0xfcb0('0x1e')]===_0xfcb0('0x73')){_0x45456c['settingsEnabled']=_0x5ec5c0[_0xfcb0('0x24')][_0xfcb0('0x76')];delete _0x45456c[_0xfcb0('0x77')];}return _0x45456c;});})[_0xfcb0('0x1d')](function(_0x193e59){return db[_0xfcb0('0x2f')][_0xfcb0('0x78')](_0x193e59,{'include':[{'model':db[_0xfcb0('0x64')],'as':_0xfcb0('0x64')}]});})[_0xfcb0('0x1d')](function(_0x29cb9f){if(_0x5ec5c0['body']['role']===_0xfcb0('0x24'))return _0x29cb9f;if(_0x5ec5c0[_0xfcb0('0x24')][_0xfcb0('0x1e')]!==_0xfcb0('0x24'))return _0x29cb9f;return db[_0xfcb0('0x79')]['find']({'where':{'name':_0x29cb9f[_0xfcb0('0x1e')]===_0xfcb0('0x1f')?_0xfcb0('0x7a'):_0xfcb0('0x25'),'userProfileId':_0x5ec5c0[_0xfcb0('0x24')]['userProfileId']},'raw':!![]})[_0xfcb0('0x1d')](function(_0x37a09d){if(!_0x37a09d||_0x37a09d[_0xfcb0('0x7b')]!=0x0)return _0x29cb9f;return db[_0xfcb0('0x2c')]['create']({'name':_0x29cb9f[_0xfcb0('0x2b')],'resourceId':_0x29cb9f['id'],'type':_0x37a09d['name'],'sectionId':_0x37a09d['id']},{})[_0xfcb0('0x1d')](function(){return _0x29cb9f;});})[_0xfcb0('0x52')](function(_0x42e8c6){logger[_0xfcb0('0x7c')](_0xfcb0('0x7d'),_0x42e8c6);throw _0x42e8c6;});})[_0xfcb0('0x1d')](respondWithResult(_0x53515e,0xc9))[_0xfcb0('0x52')](handleError(_0x53515e,null));};exports[_0xfcb0('0x7e')]=function(_0x3486bc,_0xc79ea){var _0x4496a2=_0x3486bc[_0xfcb0('0x53')];var _0x182c0c=[];if(_0x3486bc[_0xfcb0('0x24')][_0xfcb0('0x1e')]==='agent')throw new Error(_0xfcb0('0x7f'));if(_[_0xfcb0('0x80')](_0x4496a2,[_0xfcb0('0x1e'),'user'])&&_0x3486bc[_0xfcb0('0x24')][_0xfcb0('0x1e')]!=='admin'){throw new Error(_0xfcb0('0x81'));}if(_['some'](_0x4496a2,[_0xfcb0('0x1e'),'admin'])&&_0x3486bc[_0xfcb0('0x24')]['role']!==_0xfcb0('0x73')){throw new Error(_0xfcb0('0x82'));}return licenseUtil[_0xfcb0('0x75')](_0x4496a2)[_0xfcb0('0x1d')](function(){return validateUser(_0x4496a2[0x0]);})['then'](function(){for(var _0xc50b9d=0x1;_0xc50b9d<_0x4496a2[_0xfcb0('0x42')];_0xc50b9d++){var _0x3757b9=_0x4496a2[_0xc50b9d-0x1][_0xfcb0('0x58')];if(!_0x4496a2[_0xc50b9d]['internal'])_0x4496a2[_0xc50b9d][_0xfcb0('0x58')]=_0x3757b9+0x1;_0x182c0c[_0xfcb0('0x43')](validateUser(_0x4496a2[_0xc50b9d]));}return Promise[_0xfcb0('0x4a')](_0x182c0c);})['then'](function(){_0x182c0c=[];for(var _0x4a588c=0x0;_0x4a588c<_0x4496a2['length'];_0x4a588c++){_0x182c0c['push'](updateUser(_0x4496a2[_0x4a588c]));}return Promise['all'](_0x182c0c);})[_0xfcb0('0x1d')](function(){_0x182c0c=_0x4496a2[_0xfcb0('0x29')](function(_0x2555da){return db[_0xfcb0('0x2f')]['create'](_0x2555da,{'include':[{'model':db[_0xfcb0('0x64')],'as':_0xfcb0('0x64')}]})[_0xfcb0('0x1d')](function(_0x311676){_0x2555da['id']=_0x311676['id'];return _0x2555da;});});return Promise[_0xfcb0('0x4a')](_0x182c0c);})['then'](function(_0x36f3c5){if(_0x3486bc[_0xfcb0('0x53')][_0xfcb0('0x1e')]===_0xfcb0('0x24'))return _0x36f3c5;if(_0x3486bc[_0xfcb0('0x24')][_0xfcb0('0x1e')]!==_0xfcb0('0x24'))return _0x36f3c5;var _0x14a762=_[_0xfcb0('0x80')](_0x36f3c5,function(_0x4dbb79){return _0x4dbb79[_0xfcb0('0x1e')]===_0xfcb0('0x1f')||_0x4dbb79[_0xfcb0('0x1e')]===_0xfcb0('0x26');});if(!_0x14a762)return _0x36f3c5;return db[_0xfcb0('0x79')][_0xfcb0('0x3e')]({'where':{'name':{'$or':[_0xfcb0('0x7a'),_0xfcb0('0x25')]},'userProfileId':_0x3486bc[_0xfcb0('0x24')][_0xfcb0('0x77')]},'raw':!![]})[_0xfcb0('0x1d')](function(_0x17db49){if(_[_0xfcb0('0x83')](_0x17db49)||!_['some'](_0x17db49,['autoAssociation',0x0]))return _0x36f3c5;_0x182c0c=[];var _0xac9454=_(_0x17db49)['map'](function(_0x22ef3e){if(_0x22ef3e['autoAssociation']===0x1)return;return _0x22ef3e['name']==='Agents'?'agent':_0xfcb0('0x26');})[_0xfcb0('0x84')]()[_0xfcb0('0x2a')]();for(var _0x5c19d3=0x0;_0x5c19d3<_0x36f3c5['length'];_0x5c19d3++){if(!_['includes'](_0xac9454,_0x36f3c5[_0x5c19d3]['role']))return;var _0x9323bf=_0x36f3c5[_0x5c19d3][_0xfcb0('0x1e')]===_0xfcb0('0x1f')?_0xfcb0('0x7a'):_0xfcb0('0x25');_0x182c0c[_0xfcb0('0x43')](db[_0xfcb0('0x2c')][_0xfcb0('0x78')]({'name':_0x36f3c5[_0x5c19d3][_0xfcb0('0x2b')],'resourceId':_0x36f3c5[_0x5c19d3]['id'],'type':_0x9323bf,'sectionId':_[_0xfcb0('0x50')](_0x17db49,['name',_0x9323bf])['id']},{}));}return Promise['all'](_0x182c0c);});})[_0xfcb0('0x1d')](respondWithResult(_0xc79ea,0xc9))['catch'](handleError(_0xc79ea,null));};exports[_0xfcb0('0x85')]=function(_0x19bd61,_0x19d8b0){if(_0x19bd61[_0xfcb0('0x53')]['id']){delete _0x19bd61[_0xfcb0('0x53')]['id'];}return db['User'][_0xfcb0('0x50')]({'where':{'id':_0x19bd61[_0xfcb0('0x54')]['id']}})[_0xfcb0('0x1d')](function(_0x21b59d){if(!_0x21b59d)return null;if(_0x21b59d['id']===_0x19bd61[_0xfcb0('0x24')]['id']){if(!_0x19bd61['body'][_0xfcb0('0x86')]||!_0x19bd61[_0xfcb0('0x53')][_0xfcb0('0x87')]){throw new db['Sequelize'][(_0xfcb0('0x88'))](_0xfcb0('0x89'));}if(!_0x21b59d[_0xfcb0('0x8a')](_0x19bd61[_0xfcb0('0x53')]['oldPassword'])){throw new db[(_0xfcb0('0x8b'))][(_0xfcb0('0x88'))](_0xfcb0('0x8c'));}if(_0x19bd61[_0xfcb0('0x53')][_0xfcb0('0x86')]===_0x19bd61['body'][_0xfcb0('0x87')]){throw new db[(_0xfcb0('0x8b'))][(_0xfcb0('0x88'))](_0xfcb0('0x8d'));}}else if(_0x19bd61[_0xfcb0('0x24')][_0xfcb0('0x1e')]===_0xfcb0('0x73')){if(!_0x19bd61[_0xfcb0('0x53')][_0xfcb0('0x87')]){throw new db['Sequelize'][(_0xfcb0('0x88'))](_0xfcb0('0x8e'));}}else if(_0x19bd61[_0xfcb0('0x24')][_0xfcb0('0x1e')]===_0xfcb0('0x24')){if(!_0x19bd61[_0xfcb0('0x53')]['newPassword']){throw new db[(_0xfcb0('0x8b'))][(_0xfcb0('0x88'))](_0xfcb0('0x8e'));}if(_0x21b59d['role']!==_0xfcb0('0x1f')){throw new db[(_0xfcb0('0x8b'))][(_0xfcb0('0x88'))](_0xfcb0('0x7f'));}}else{throw new db[(_0xfcb0('0x8b'))][(_0xfcb0('0x88'))](_0xfcb0('0x7f'));}return _0x21b59d;})[_0xfcb0('0x1d')](handleEntityNotFound(_0x19d8b0,null))[_0xfcb0('0x1d')](function(_0x270e60){return db[_0xfcb0('0x8f')][_0xfcb0('0x90')]({'attributes':['id',_0xfcb0('0x5a'),'enforcePasswordHistory',_0xfcb0('0x91')]})[_0xfcb0('0x1d')](function(_0x3a29c4){if(_0x3a29c4[_0xfcb0('0x5a')])authService[_0xfcb0('0x5b')](_0x19bd61[_0xfcb0('0x53')][_0xfcb0('0x87')]);if(!_0x3a29c4[_0xfcb0('0x92')]||!_0x270e60[_0xfcb0('0x93')])return _0x270e60;authService[_0xfcb0('0x94')](_0x19bd61[_0xfcb0('0x53')][_0xfcb0('0x87')],_0x270e60[_0xfcb0('0x93')],_0x3a29c4[_0xfcb0('0x91')]);return _0x270e60;})[_0xfcb0('0x1d')](saveUpdates({'password':_0x19bd61[_0xfcb0('0x53')]['newPassword'],'passwordResetAt':_0x19bd61['user']['id']==_0x19bd61[_0xfcb0('0x54')]['id']?moment():null,'previousPasswords':authService[_0xfcb0('0x95')](_0x19bd61[_0xfcb0('0x53')][_0xfcb0('0x87')],_0x270e60[_0xfcb0('0x93')])},null));})[_0xfcb0('0x1d')](respondWithResult(_0x19d8b0,null))[_0xfcb0('0x52')](handleError(_0x19d8b0,null));};exports['addQueues']=function(_0x39d7ef,_0x2d31c5){var _0x15bbd9=_0x39d7ef[_0xfcb0('0x53')][_0xfcb0('0x96')];return db[_0xfcb0('0x2f')]['find']({'where':{'id':_0x39d7ef[_0xfcb0('0x54')]['id']},'attributes':['id',_0xfcb0('0x2b'),_0xfcb0('0x1e'),_0xfcb0('0x97'),_0xfcb0('0x98'),_0xfcb0('0x99'),'interface']})[_0xfcb0('0x1d')](handleEntityNotFound(_0x2d31c5,null))[_0xfcb0('0x1d')](function(_0x475678){if(_0x475678){if(!utils[_0xfcb0('0x9a')](_0x15bbd9)){throw new db[(_0xfcb0('0x8b'))][(_0xfcb0('0x88'))](_0xfcb0('0x9b'));}return _0x475678[_0xfcb0('0x9c')+_[_0xfcb0('0x9d')](_0x15bbd9['toLowerCase']())+'Queues'](_0x39d7ef[_0xfcb0('0x53')][_0xfcb0('0x56')],{'penalty':_0x39d7ef[_0xfcb0('0x53')]['penalty']||0x0})[_0xfcb0('0x9e')](function(_0x2a322a){for(var _0x3610c8=0x0;_0x3610c8<_0x39d7ef['body']['ids'][_0xfcb0('0x42')];_0x3610c8+=0x1){var _0x28bf68={'UserId':Number(_0x39d7ef[_0xfcb0('0x54')]['id'])};_0x28bf68[_[_0xfcb0('0x9d')](_0x15bbd9[_0xfcb0('0x9f')]())+'QueueId']=Number(_0x39d7ef[_0xfcb0('0x53')][_0xfcb0('0x56')][_0x3610c8]);socket['emit'](_0xfcb0('0x24')+_[_0xfcb0('0x9d')](_0x15bbd9['toLowerCase']())+_0xfcb0('0xa0'),_0x28bf68);}return _0x2a322a;})[_0xfcb0('0x1d')](function(){if(_0x15bbd9===_0xfcb0('0xa1')){return db[_0xfcb0('0xa2')]['findAll']({'where':{'id':_0x39d7ef[_0xfcb0('0x53')][_0xfcb0('0x56')]||[]},'raw':!![],'attributes':['id',_0xfcb0('0x2b')]});}})['then'](function(_0x1928d5){var _0x282818=_0x475678['get']({'plain':!![]});var _0x2ad304=[];if(_0x15bbd9==='voice'&&_0x282818['role']===_0xfcb0('0x1f')&&_0x282818[_0xfcb0('0x97')]){for(let _0x158656=0x0;_0x158656<_0x1928d5[_0xfcb0('0x42')];_0x158656+=0x1){_0x2ad304[_0xfcb0('0x43')]({'membername':_0x282818[_0xfcb0('0x2b')],'UserId':_0x282818['id'],'queue_name':_0x1928d5[_0x158656]['name'],'VoiceQueueId':_0x1928d5[_0x158656]['id'],'interface':_[_0xfcb0('0x5d')](_0x282818['interface'])?util['format'](_0xfcb0('0xa3'),_0x282818[_0xfcb0('0x2b')]):_0x282818['interface'],'paused':_0x282818[_0xfcb0('0x99')]||![],'penalty':_0x39d7ef[_0xfcb0('0x53')][_0xfcb0('0xa4')]||0x0});}return Promise[_0xfcb0('0x4a')](_0x2ad304[_0xfcb0('0x29')](function(_0x46079f){return db[_0xfcb0('0xa5')][_0xfcb0('0xa6')](_0x46079f);}));}return _0x475678;});}})[_0xfcb0('0x1d')](respondWithStatusCode(_0x2d31c5,null))[_0xfcb0('0x52')](handleError(_0x2d31c5,null));};exports[_0xfcb0('0xa7')]=function(_0x4c99cb,_0x329fa5){var _0x334755,_0x4c8798;return db[_0xfcb0('0x2f')][_0xfcb0('0x50')]({'where':{'id':_0x4c99cb['params']['id']},'attributes':['id',_0xfcb0('0x2b'),_0xfcb0('0x1e')]})[_0xfcb0('0x1d')](handleEntityNotFound(_0x329fa5,null))[_0xfcb0('0x1d')](function(_0x375de9){if(_0x375de9){_0x334755=_0x375de9;if(!_0x4c99cb[_0xfcb0('0x39')][_0xfcb0('0x96')]||!utils[_0xfcb0('0x9a')](_0x4c99cb['query']['channel'])){throw new db[(_0xfcb0('0x8b'))][(_0xfcb0('0x88'))](_0xfcb0('0x9b'));}return _0x375de9[_0xfcb0('0xa8')+_[_0xfcb0('0x9d')](_0x4c99cb[_0xfcb0('0x39')]['channel']['toLowerCase']())+_0xfcb0('0xa9')](_0x4c99cb[_0xfcb0('0x39')][_0xfcb0('0x56')]);}})[_0xfcb0('0x1d')](function(_0x7cfc1){if(_['isArray'](_0x4c99cb['query'][_0xfcb0('0x56')])){for(var _0x4b24df=0x0;_0x4b24df<_0x4c99cb[_0xfcb0('0x39')][_0xfcb0('0x56')][_0xfcb0('0x42')];_0x4b24df+=0x1){_0x4c8798={'UserId':Number(_0x4c99cb[_0xfcb0('0x54')]['id'])};_0x4c8798[_['capitalize'](_0x4c99cb[_0xfcb0('0x39')][_0xfcb0('0x96')][_0xfcb0('0x9f')]())+_0xfcb0('0xaa')]=Number(_0x4c99cb['query']['ids'][_0x4b24df]);socket[_0xfcb0('0x20')](_0xfcb0('0x24')+_['capitalize'](_0x4c99cb[_0xfcb0('0x39')][_0xfcb0('0x96')][_0xfcb0('0x9f')]())+_0xfcb0('0xab'),_0x4c8798);}}else{_0x4c8798={'UserId':Number(_0x4c99cb['params']['id'])};_0x4c8798[_[_0xfcb0('0x9d')](_0x4c99cb[_0xfcb0('0x39')][_0xfcb0('0x96')][_0xfcb0('0x9f')]())+_0xfcb0('0xaa')]=Number(_0x4c99cb['query'][_0xfcb0('0x56')]);socket['emit'](_0xfcb0('0x24')+_[_0xfcb0('0x9d')](_0x4c99cb['query'][_0xfcb0('0x96')][_0xfcb0('0x9f')]())+'Queue:remove',_0x4c8798);}return _0x7cfc1;})['then'](function(){if(_0x4c99cb['query'][_0xfcb0('0x96')]===_0xfcb0('0xa1')){return db[_0xfcb0('0xa5')][_0xfcb0('0x2d')]({'where':{'UserId':_0x4c99cb['params']['id'],'VoiceQueueId':_0x4c99cb[_0xfcb0('0x39')][_0xfcb0('0x56')]},'individualHooks':!![]})[_0xfcb0('0x1d')](function(){return _0x334755;});}return _0x334755;})[_0xfcb0('0x1d')](respondWithStatusCode(_0x329fa5,null))['catch'](handleError(_0x329fa5,null));};exports[_0xfcb0('0xac')]=function(_0x5b6fd7,_0x377cd3){_0x5b6fd7['body']['userpic']=_0x5b6fd7['file']['filename'];return db[_0xfcb0('0x2f')][_0xfcb0('0x50')]({'where':{'id':_0x5b6fd7[_0xfcb0('0x54')]['id']}})[_0xfcb0('0x1d')](handleEntityNotFound(_0x377cd3,null))['then'](saveUpdates(_0x5b6fd7[_0xfcb0('0x53')],null))[_0xfcb0('0x1d')](respondWithResult(_0x377cd3,null))[_0xfcb0('0x52')](handleError(_0x377cd3,null));};exports['getAvatar']=function(_0x1b0961,_0x347ec1){var _0x5ac2e4=path['join'](config['root'],_0xfcb0('0xad'));return db[_0xfcb0('0x2f')][_0xfcb0('0x50')]({'where':{'id':_0x1b0961[_0xfcb0('0x54')]['id']},'attributes':['id',_0xfcb0('0xae')],'raw':!![]})['then'](handleEntityNotFound(_0x347ec1,null))[_0xfcb0('0x1d')](function(_0x4b72c4){if(_0x4b72c4){if(_[_0xfcb0('0x5d')](_0x4b72c4['userpic'])){return _0x347ec1[_0xfcb0('0xaf')](_0x5ac2e4);}else{if(!fs['existsSync'](path[_0xfcb0('0xb0')](config[_0xfcb0('0xb1')],_0xfcb0('0xb2'),_0x4b72c4[_0xfcb0('0xae')]))){return _0x347ec1['download'](_0x5ac2e4);}return _0x347ec1['download'](path[_0xfcb0('0xb0')](config[_0xfcb0('0xb1')],_0xfcb0('0xb2'),_0x4b72c4[_0xfcb0('0xae')]));}}})[_0xfcb0('0x52')](handleError(_0x347ec1,null));};exports['getOpenTabs']=function(_0x510191,_0x295d2f){return db['User']['find']({'where':{'id':_0x510191[_0xfcb0('0x54')]['id']},'attributes':['id']})[_0xfcb0('0x1d')](handleEntityNotFound(_0x295d2f,null))[_0xfcb0('0x1d')](function(_0x4374ca){var _0x106f55=[];values=_0x4374ca[_0xfcb0('0x44')];_0x106f55[_0xfcb0('0x43')](get_open_tabs(_0xfcb0('0x51'),_0x4374ca[_0xfcb0('0x44')]));_0x106f55[_0xfcb0('0x43')](get_open_tabs('sms',_0x4374ca['dataValues']));_0x106f55[_0xfcb0('0x43')](get_open_tabs(_0xfcb0('0x48'),_0x4374ca[_0xfcb0('0x44')]));_0x106f55[_0xfcb0('0x43')](get_open_tabs(_0xfcb0('0x49'),_0x4374ca[_0xfcb0('0x44')]));_0x106f55[_0xfcb0('0x43')](get_open_tabs('fax',_0x4374ca[_0xfcb0('0x44')]));_0x106f55[_0xfcb0('0x43')](get_open_tabs(_0xfcb0('0x47'),_0x4374ca[_0xfcb0('0x44')]));return Promise[_0xfcb0('0x4a')](_0x106f55);})['then'](function(_0xe44f0d){if(_0xe44f0d){var _0x2387af=_[_0xfcb0('0x29')](values['ChatOpenTabs'],function(_0x111722){return{'channel':_0xfcb0('0xb3'),'id':_0x111722['id'],'createdAt':_0x111722[_0xfcb0('0xb4')]};});var _0x552ceb=_[_0xfcb0('0x29')](values[_0xfcb0('0xb5')],function(_0x2f7e89){return{'channel':_0xfcb0('0xb6'),'id':_0x2f7e89['id'],'createdAt':_0x2f7e89[_0xfcb0('0xb4')]};});var _0x1d3e1e=_[_0xfcb0('0x29')](values[_0xfcb0('0xb7')],function(_0x5e853c){return{'channel':'OPENCHANNEL','id':_0x5e853c['id'],'createdAt':_0x5e853c[_0xfcb0('0xb4')]};});var _0x180c2a=_[_0xfcb0('0x29')](values[_0xfcb0('0xb8')],function(_0x2a7b1c){return{'channel':_0xfcb0('0xb9'),'id':_0x2a7b1c['id'],'createdAt':_0x2a7b1c['createdAt']};});var _0x4b3b4d=_['map'](values[_0xfcb0('0xba')],function(_0x52bbe0){return{'channel':_0xfcb0('0xbb'),'id':_0x52bbe0['id'],'createdAt':_0x52bbe0[_0xfcb0('0xb4')]};});var _0x5ee34c=_[_0xfcb0('0x29')](values[_0xfcb0('0xbc')],function(_0x4f8316){return{'channel':'WHATSAPP','id':_0x4f8316['id'],'createdAt':_0x4f8316[_0xfcb0('0xb4')]};});var _0x146c15=_[_0xfcb0('0xbd')](_0x2387af,_0x552ceb,_0x1d3e1e,_0x180c2a,_0x4b3b4d,_0x5ee34c);var _0x5ddb32={'count':_0x146c15[_0xfcb0('0x42')],'rows':_0x146c15};return _0x5ddb32;}else return null;})[_0xfcb0('0x1d')](respondWithResult(_0x295d2f,null))['catch'](handleError(_0x295d2f,null));};exports[_0xfcb0('0xbe')]=function(_0x5cb6fa,_0x5ddf7d){var _0x29e04b={};return db[_0xfcb0('0x2f')][_0xfcb0('0x90')]({'where':{'id':_0x5cb6fa[_0xfcb0('0x54')]['id']}})[_0xfcb0('0x1d')](function(_0x119bba){if(!_0x119bba){throw new APINotFoundError(util[_0xfcb0('0xbf')](_0xfcb0('0xc0'),_0x5cb6fa['params']['id']));}return contacts[_0xfcb0('0xc1')]();})[_0xfcb0('0x1d')](function(_0x47c116){_0x5cb6fa[_0xfcb0('0x39')][_0xfcb0('0x2f')]=_0x5cb6fa['params']['id'];_0x29e04b=qs[_0xfcb0('0x4c')](_0x47c116,_0x5cb6fa);if(_0x5cb6fa[_0xfcb0('0x39')][_0xfcb0('0xc2')](_0xfcb0('0xc3'))){_0x29e04b[_0xfcb0('0x3a')]=[{'model':db[_0xfcb0('0xc4')],'as':_0xfcb0('0xc5'),'required':![]},{'model':db[_0xfcb0('0xc6')],'as':_0xfcb0('0xc7'),'attributes':['id',_0xfcb0('0x2b'),_0xfcb0('0xc8')],'where':_0x5cb6fa[_0xfcb0('0x39')]['tag']?{'id':_0x5cb6fa[_0xfcb0('0x39')][_0xfcb0('0xc9')]}:undefined,'required':_0x5cb6fa[_0xfcb0('0x39')][_0xfcb0('0xc9')]?!![]:![]}];}return contacts[_0xfcb0('0x3e')](_0x5cb6fa[_0xfcb0('0x39')],_0x5cb6fa[_0xfcb0('0x24')],_0x29e04b,_0x47c116);})[_0xfcb0('0x1d')](respondWithFilteredResult(_0x5ddf7d,_0x29e04b))[_0xfcb0('0x52')](APIHandleError(_0x5ddf7d));};exports[_0xfcb0('0xca')]=function(_0x9b539d,_0x1e9376){var _0x5ec88c;var _0x34964c={};var _0x154c4c;return db[_0xfcb0('0x2f')][_0xfcb0('0x90')]({'where':{'id':_0x9b539d[_0xfcb0('0x54')]['id']},'attributes':['id',_0xfcb0('0x2b'),_0xfcb0('0x1e')]})[_0xfcb0('0x1d')](handleEntityNotFound(_0x1e9376,null))[_0xfcb0('0x1d')](function(_0x932711){if(!utils[_0xfcb0('0x9a')](_0x9b539d[_0xfcb0('0x39')][_0xfcb0('0x96')])){throw new db[(_0xfcb0('0x8b'))][(_0xfcb0('0x88'))]('Unknown\x20channel');}_0x5ec88c=_0x932711;var _0xcb20ca={};_0xcb20ca[_0xfcb0('0xcb')]=_[_0xfcb0('0xcc')](db[_[_0xfcb0('0x9d')](_0x9b539d[_0xfcb0('0x39')][_0xfcb0('0x96')])+_0xfcb0('0xcd')][_0xfcb0('0x30')]);_0xcb20ca[_0xfcb0('0x39')]=_[_0xfcb0('0xcc')](_0x9b539d[_0xfcb0('0x39')]);_0xcb20ca[_0xfcb0('0xce')]=_[_0xfcb0('0xcf')](_0xcb20ca[_0xfcb0('0xcb')],_0xcb20ca[_0xfcb0('0x39')]);_0x34964c[_0xfcb0('0x3d')]=_[_0xfcb0('0xcf')](_0xcb20ca['model'],qs['fields'](_0x9b539d[_0xfcb0('0x39')][_0xfcb0('0xd0')]));_0x34964c[_0xfcb0('0x3d')]=_0x34964c['attributes'][_0xfcb0('0x42')]?_0x34964c[_0xfcb0('0x3d')]:_0xcb20ca[_0xfcb0('0xcb')];_0x34964c[_0xfcb0('0xd1')]=qs[_0xfcb0('0xd2')](_0x9b539d['query'][_0xfcb0('0xd2')]);_0x34964c[_0xfcb0('0x38')]=qs[_0xfcb0('0xce')](_[_0xfcb0('0xd3')](_0x9b539d['query'],_0xcb20ca[_0xfcb0('0xce')]));if(_0x9b539d['query'][_0xfcb0('0x27')]){_0x34964c['where']=_[_0xfcb0('0x4e')](_0x34964c['where'],{'$or':_[_0xfcb0('0x29')](_0x34964c[_0xfcb0('0x3d')],function(_0x372ab3){var _0x5d291f={};_0x5d291f[_0x372ab3]={'$like':'%'+_0x9b539d[_0xfcb0('0x39')][_0xfcb0('0x27')]+'%'};return _0x5d291f;})});}_0x34964c=_[_0xfcb0('0x4e')]({},_0x34964c,_0x9b539d[_0xfcb0('0x4f')]);switch(_0x5ec88c[_0xfcb0('0x1e')]){case'admin':return db[_[_0xfcb0('0x9d')](_0x9b539d[_0xfcb0('0x39')][_0xfcb0('0x96')])+_0xfcb0('0xcd')]['findAll'](_0x34964c);case'user':case'agent':return _0x5ec88c[_0xfcb0('0x22')+_['capitalize'](_0x9b539d[_0xfcb0('0x39')]['channel'])+_0xfcb0('0xa9')](_0x34964c);default:throw new db[(_0xfcb0('0x8b'))][(_0xfcb0('0x88'))](_0xfcb0('0xd4'));}})['then'](function(_0x4139b3){_0x154c4c=_0x4139b3[_0xfcb0('0x42')];if(!_0x9b539d[_0xfcb0('0x39')]['hasOwnProperty'](_0xfcb0('0xd5'))){_0x34964c[_0xfcb0('0x18')]=qs[_0xfcb0('0x18')](_0x9b539d[_0xfcb0('0x39')][_0xfcb0('0x18')]);_0x34964c[_0xfcb0('0x15')]=qs[_0xfcb0('0x15')](_0x9b539d[_0xfcb0('0x39')][_0xfcb0('0x15')]);}switch(_0x5ec88c[_0xfcb0('0x1e')]){case _0xfcb0('0x73'):return db[_[_0xfcb0('0x9d')](_0x9b539d[_0xfcb0('0x39')][_0xfcb0('0x96')])+'Queue'][_0xfcb0('0x3e')](_0x34964c);case _0xfcb0('0x24'):case _0xfcb0('0x1f'):return _0x5ec88c[_0xfcb0('0x22')+_[_0xfcb0('0x9d')](_0x9b539d['query'][_0xfcb0('0x96')])+_0xfcb0('0xa9')](_0x34964c);}})[_0xfcb0('0x1d')](function(_0x3f65d0){return{'count':_0x154c4c,'rows':_0x3f65d0};})[_0xfcb0('0x1d')](respondWithResult(_0x1e9376,null))['catch'](handleError(_0x1e9376,null));};exports['getVoiceQueuesRt']=function(_0x402695,_0x4fc624){var _0x3fdad8={};var _0x8d97d5={};var _0x50b99a;var _0x499037;return db[_0xfcb0('0x2f')][_0xfcb0('0x90')]({'where':{'id':_0x402695[_0xfcb0('0x54')]['id']}})[_0xfcb0('0x1d')](handleEntityNotFound(_0x4fc624,null))[_0xfcb0('0x1d')](function(_0x372e87){if(_0x372e87){_0x50b99a=_0x372e87;_0x8d97d5[_0xfcb0('0xcb')]=_[_0xfcb0('0xcc')](db['UserVoiceQueueRt'][_0xfcb0('0x30')]);_0x8d97d5['query']=_[_0xfcb0('0xcc')](_0x402695[_0xfcb0('0x39')]);_0x8d97d5[_0xfcb0('0xce')]=_[_0xfcb0('0xcf')](_0x8d97d5['model'],_0x8d97d5[_0xfcb0('0x39')]);_0x3fdad8['attributes']=_[_0xfcb0('0xcf')](_0x8d97d5[_0xfcb0('0xcb')],qs['fields'](_0x402695[_0xfcb0('0x39')][_0xfcb0('0xd0')]));_0x3fdad8[_0xfcb0('0x3d')]=_0x3fdad8[_0xfcb0('0x3d')][_0xfcb0('0x42')]?_0x3fdad8[_0xfcb0('0x3d')]:_0x8d97d5[_0xfcb0('0xcb')];_0x3fdad8['order']=qs[_0xfcb0('0xd2')](_0x402695[_0xfcb0('0x39')]['sort']);_0x3fdad8[_0xfcb0('0x38')]=qs[_0xfcb0('0xce')](_[_0xfcb0('0xd3')](_0x402695[_0xfcb0('0x39')],_0x8d97d5['filters']));if(_0x402695[_0xfcb0('0x39')][_0xfcb0('0x27')]){_0x3fdad8[_0xfcb0('0x38')]=_['merge'](_0x3fdad8[_0xfcb0('0x38')],{'$or':_[_0xfcb0('0x29')](_0x3fdad8['attributes'],function(_0x2f01fa){var _0x5d9317={};_0x5d9317[_0x2f01fa]={'$like':'%'+_0x402695[_0xfcb0('0x39')][_0xfcb0('0x27')]+'%'};return _0x5d9317;})});}_0x3fdad8=_[_0xfcb0('0x4e')]({},_0x3fdad8,_0x402695['options']);return _0x50b99a[_0xfcb0('0xd6')](_0x3fdad8);}})['then'](function(_0x4dce62){if(_0x4dce62){_0x499037=_0x4dce62[_0xfcb0('0x42')];if(!_0x402695[_0xfcb0('0x39')][_0xfcb0('0xc2')](_0xfcb0('0xd5'))){_0x3fdad8[_0xfcb0('0x18')]=qs[_0xfcb0('0x18')](_0x402695[_0xfcb0('0x39')]['limit']);_0x3fdad8['offset']=qs[_0xfcb0('0x15')](_0x402695['query'][_0xfcb0('0x15')]);}return _0x50b99a['getVoiceQueuesRt'](_0x3fdad8);}})[_0xfcb0('0x1d')](function(_0x5a692c){if(_0x5a692c){return _0x5a692c?{'count':_0x499037,'rows':_0x5a692c}:null;}})['then'](respondWithResult(_0x4fc624,null))['catch'](handleError(_0x4fc624,null));};exports[_0xfcb0('0xd7')]=function(_0x411833,_0x2a7cd3){var _0x11ef49={};var _0x488f87={};var _0x1a14fc;var _0x20f847;return db[_0xfcb0('0x2f')][_0xfcb0('0x90')]({'where':{'id':_0x411833[_0xfcb0('0x54')]['id']}})['then'](handleEntityNotFound(_0x2a7cd3,null))[_0xfcb0('0x1d')](function(_0xbfbc7e){if(_0xbfbc7e){_0x1a14fc=_0xbfbc7e;_0x488f87[_0xfcb0('0xcb')]=_[_0xfcb0('0xcc')](db['ChatGroup'][_0xfcb0('0x30')]);_0x488f87[_0xfcb0('0x39')]=_[_0xfcb0('0xcc')](_0x411833['query']);_0x488f87[_0xfcb0('0xce')]=_[_0xfcb0('0xcf')](_0x488f87['model'],_0x488f87[_0xfcb0('0x39')]);_0x11ef49[_0xfcb0('0x3d')]=_[_0xfcb0('0xcf')](_0x488f87[_0xfcb0('0xcb')],qs[_0xfcb0('0xd0')](_0x411833[_0xfcb0('0x39')]['fields']));_0x11ef49[_0xfcb0('0x3d')]=_0x11ef49[_0xfcb0('0x3d')]['length']?_0x11ef49['attributes']:_0x488f87['model'];_0x11ef49[_0xfcb0('0xd1')]=qs['sort'](_0x411833['query']['sort']);_0x11ef49[_0xfcb0('0x38')]=qs['filters'](_['pick'](_0x411833[_0xfcb0('0x39')],_0x488f87[_0xfcb0('0xce')]));if(_0x411833[_0xfcb0('0x39')][_0xfcb0('0x27')]){_0x11ef49[_0xfcb0('0x38')]=_[_0xfcb0('0x4e')](_0x11ef49[_0xfcb0('0x38')],{'$or':_[_0xfcb0('0x29')](_0x11ef49[_0xfcb0('0x3d')],function(_0x133a1a){var _0x198925={};_0x198925[_0x133a1a]={'$like':'%'+_0x411833[_0xfcb0('0x39')][_0xfcb0('0x27')]+'%'};return _0x198925;})});}_0x11ef49=_['merge']({},_0x11ef49,_0x411833['options']);return _0x1a14fc[_0xfcb0('0xd7')](_0x11ef49);}})['then'](function(_0x3f8d2c){if(_0x3f8d2c){_0x20f847=_0x3f8d2c[_0xfcb0('0x42')];if(!_0x411833[_0xfcb0('0x39')][_0xfcb0('0xc2')](_0xfcb0('0xd5'))){_0x11ef49[_0xfcb0('0x18')]=qs[_0xfcb0('0x18')](_0x411833[_0xfcb0('0x39')][_0xfcb0('0x18')]);_0x11ef49[_0xfcb0('0x15')]=qs[_0xfcb0('0x15')](_0x411833['query'][_0xfcb0('0x15')]);}return _0x1a14fc[_0xfcb0('0xd7')](_0x11ef49);}})['then'](function(_0x2ec5e7){if(_0x2ec5e7){return _0x2ec5e7?{'count':_0x20f847,'rows':_0x2ec5e7}:null;}})[_0xfcb0('0x1d')](respondWithResult(_0x2a7cd3,null))[_0xfcb0('0x52')](handleError(_0x2a7cd3,null));};exports['getRecordings']=function(_0x4065ae,_0xbfe016){var _0x7828b5={'raw':!![],'where':{}};var _0x420ea0={};var _0x4abe06={'count':0x0,'rows':[]};return db[_0xfcb0('0x2f')][_0xfcb0('0x90')]({'where':{'id':_0x4065ae[_0xfcb0('0x54')]['id']}})['then'](handleEntityNotFound(_0xbfe016,null))[_0xfcb0('0x1d')](function(_0x14f68d){if(_0x14f68d){_0x420ea0[_0xfcb0('0xcb')]=_['keys'](db[_0xfcb0('0xd8')][_0xfcb0('0x30')]);_0x420ea0[_0xfcb0('0x39')]=_[_0xfcb0('0xcc')](_0x4065ae[_0xfcb0('0x39')]);_0x420ea0['filters']=_[_0xfcb0('0xcf')](_0x420ea0['model'],_0x420ea0[_0xfcb0('0x39')]);_0x7828b5[_0xfcb0('0x3d')]=_[_0xfcb0('0xcf')](_0x420ea0[_0xfcb0('0xcb')],qs[_0xfcb0('0xd0')](_0x4065ae[_0xfcb0('0x39')][_0xfcb0('0xd0')]));_0x7828b5[_0xfcb0('0x3d')]=_0x7828b5[_0xfcb0('0x3d')][_0xfcb0('0x42')]?_0x7828b5[_0xfcb0('0x3d')]:_0x420ea0[_0xfcb0('0xcb')];if(!_0x4065ae['query'][_0xfcb0('0xc2')]('nolimit')){_0x7828b5['limit']=qs[_0xfcb0('0x18')](_0x4065ae['query'][_0xfcb0('0x18')]);_0x7828b5[_0xfcb0('0x15')]=qs[_0xfcb0('0x15')](_0x4065ae['query']['offset']);}_0x7828b5[_0xfcb0('0xd1')]=qs['sort'](_0x4065ae[_0xfcb0('0x39')]['sort']);_0x7828b5[_0xfcb0('0x38')]=qs[_0xfcb0('0xce')](_[_0xfcb0('0xd3')](_0x4065ae['query'],_0x420ea0['filters']));_0x7828b5[_0xfcb0('0x38')][_0xfcb0('0xd9')]=_0x14f68d['id'];if(_0x4065ae[_0xfcb0('0x39')][_0xfcb0('0x27')]){_0x7828b5[_0xfcb0('0x38')]=_[_0xfcb0('0x4e')](_0x7828b5[_0xfcb0('0x38')],{'$or':_[_0xfcb0('0x29')](_0x7828b5[_0xfcb0('0x3d')],function(_0x38c3cf){var _0x1d3b80={};_0x1d3b80[_0x38c3cf]={'$like':'%'+_0x4065ae[_0xfcb0('0x39')][_0xfcb0('0x27')]+'%'};return _0x1d3b80;})});}_0x7828b5=_[_0xfcb0('0x4e')]({},_0x7828b5,_0x4065ae[_0xfcb0('0x4f')]);return db[_0xfcb0('0xd8')][_0xfcb0('0x17')]({'where':_0x7828b5[_0xfcb0('0x38')]})[_0xfcb0('0x1d')](function(_0x42cb17){_0x4abe06[_0xfcb0('0x17')]=_0x42cb17;if(_0x4065ae[_0xfcb0('0x39')][_0xfcb0('0xc3')]){_0x7828b5['include']=[{'all':!![]}];}return db[_0xfcb0('0xd8')]['findAll'](_0x7828b5);})[_0xfcb0('0x1d')](function(_0x21d1a4){_0x4abe06[_0xfcb0('0x3f')]=_0x21d1a4;return _0x4abe06;});}})[_0xfcb0('0x1d')](respondWithFilteredResult(_0xbfe016,_0x7828b5))['catch'](handleError(_0xbfe016,null));};exports[_0xfcb0('0xda')]=function(_0x5d63f7,_0x3859f8){var _0x15b52a={'raw':!![],'where':{}};var _0xed9165={};var _0x4214cc={'count':0x0,'rows':[]};return db[_0xfcb0('0x2f')]['findOne']({'where':{'id':_0x5d63f7[_0xfcb0('0x54')]['id']}})[_0xfcb0('0x1d')](handleEntityNotFound(_0x3859f8,null))['then'](function(_0x58b95b){if(_0x58b95b){_0xed9165[_0xfcb0('0xcb')]=_[_0xfcb0('0xcc')](db[_0xfcb0('0xdb')][_0xfcb0('0x30')]);_0xed9165[_0xfcb0('0x39')]=_[_0xfcb0('0xcc')](_0x5d63f7[_0xfcb0('0x39')]);_0xed9165[_0xfcb0('0xce')]=_[_0xfcb0('0xcf')](_0xed9165['model'],_0xed9165[_0xfcb0('0x39')]);_0x15b52a[_0xfcb0('0x3d')]=_[_0xfcb0('0xcf')](_0xed9165['model'],qs[_0xfcb0('0xd0')](_0x5d63f7[_0xfcb0('0x39')][_0xfcb0('0xd0')]));_0x15b52a['attributes']=_0x15b52a['attributes']['length']?_0x15b52a[_0xfcb0('0x3d')]:_0xed9165[_0xfcb0('0xcb')];if(!_0x5d63f7[_0xfcb0('0x39')]['hasOwnProperty'](_0xfcb0('0xd5'))){_0x15b52a['limit']=qs[_0xfcb0('0x18')](_0x5d63f7['query'][_0xfcb0('0x18')]);_0x15b52a[_0xfcb0('0x15')]=qs[_0xfcb0('0x15')](_0x5d63f7[_0xfcb0('0x39')][_0xfcb0('0x15')]);}_0x15b52a[_0xfcb0('0xd1')]=qs['sort'](_0x5d63f7[_0xfcb0('0x39')]['sort']);_0x15b52a['where']=qs[_0xfcb0('0xce')](_[_0xfcb0('0xd3')](_0x5d63f7[_0xfcb0('0x39')],_0xed9165['filters']));_0x15b52a[_0xfcb0('0x38')]['UserId']=_0x58b95b['id'];if(_0x5d63f7[_0xfcb0('0x39')][_0xfcb0('0x27')]){_0x15b52a[_0xfcb0('0x38')]=_[_0xfcb0('0x4e')](_0x15b52a[_0xfcb0('0x38')],{'$or':_[_0xfcb0('0x29')](_0x15b52a[_0xfcb0('0x3d')],function(_0x5f3f89){var _0x1993d3={};_0x1993d3[_0x5f3f89]={'$like':'%'+_0x5d63f7[_0xfcb0('0x39')]['filter']+'%'};return _0x1993d3;})});}_0x15b52a=_[_0xfcb0('0x4e')]({},_0x15b52a,_0x5d63f7[_0xfcb0('0x4f')]);return db[_0xfcb0('0xdb')][_0xfcb0('0x17')]({'where':_0x15b52a[_0xfcb0('0x38')]})[_0xfcb0('0x1d')](function(_0x50b826){_0x4214cc['count']=_0x50b826;if(_0x5d63f7['query'][_0xfcb0('0xc3')]){_0x15b52a[_0xfcb0('0x3a')]=[{'all':!![]}];}return db[_0xfcb0('0xdb')][_0xfcb0('0x3e')](_0x15b52a);})[_0xfcb0('0x1d')](function(_0x12a003){_0x4214cc[_0xfcb0('0x3f')]=_0x12a003;return _0x4214cc;});}})[_0xfcb0('0x1d')](respondWithFilteredResult(_0x3859f8,_0x15b52a))[_0xfcb0('0x52')](handleError(_0x3859f8,null));};exports[_0xfcb0('0xdc')]=function(_0xa864c5,_0x117746){var _0x42491f={};var _0x302f9c={};var _0x2cef3d;var _0x3eae57;return db['User'][_0xfcb0('0x90')]({'where':{'id':_0xa864c5[_0xfcb0('0x54')]['id']}})[_0xfcb0('0x1d')](handleEntityNotFound(_0x117746,null))[_0xfcb0('0x1d')](function(_0x43cace){if(_0x43cace){_0x2cef3d=_0x43cace;_0x302f9c[_0xfcb0('0xcb')]=_[_0xfcb0('0xcc')](db[_0xfcb0('0xdd')][_0xfcb0('0x30')]);_0x302f9c[_0xfcb0('0x39')]=_['keys'](_0xa864c5[_0xfcb0('0x39')]);_0x302f9c['filters']=_[_0xfcb0('0xcf')](_0x302f9c[_0xfcb0('0xcb')],_0x302f9c[_0xfcb0('0x39')]);_0x42491f[_0xfcb0('0x3d')]=_[_0xfcb0('0xcf')](_0x302f9c[_0xfcb0('0xcb')],qs[_0xfcb0('0xd0')](_0xa864c5[_0xfcb0('0x39')][_0xfcb0('0xd0')]));_0x42491f[_0xfcb0('0x3d')]=_0x42491f[_0xfcb0('0x3d')]['length']?_0x42491f[_0xfcb0('0x3d')]:_0x302f9c[_0xfcb0('0xcb')];_0x42491f[_0xfcb0('0xd1')]=qs['sort'](_0xa864c5[_0xfcb0('0x39')][_0xfcb0('0xd2')]);_0x42491f[_0xfcb0('0x38')]=qs['filters'](_[_0xfcb0('0xd3')](_0xa864c5[_0xfcb0('0x39')],_0x302f9c[_0xfcb0('0xce')]));if(_0xa864c5['query'][_0xfcb0('0x27')]){_0x42491f[_0xfcb0('0x38')]=_[_0xfcb0('0x4e')](_0x42491f['where'],{'$or':_['map'](_0x42491f[_0xfcb0('0x3d')],function(_0x53a6e5){var _0x31c3be={};_0x31c3be[_0x53a6e5]={'$like':'%'+_0xa864c5[_0xfcb0('0x39')]['filter']+'%'};return _0x31c3be;})});}_0x42491f=_[_0xfcb0('0x4e')]({},_0x42491f,_0xa864c5[_0xfcb0('0x4f')]);return _0x2cef3d[_0xfcb0('0xdc')](_0x42491f);}})['then'](function(_0x2b9336){if(_0x2b9336){_0x3eae57=_0x2b9336[_0xfcb0('0x42')];if(!_0xa864c5[_0xfcb0('0x39')][_0xfcb0('0xc2')]('nolimit')){_0x42491f[_0xfcb0('0x18')]=qs[_0xfcb0('0x18')](_0xa864c5[_0xfcb0('0x39')][_0xfcb0('0x18')]);_0x42491f[_0xfcb0('0x15')]=qs[_0xfcb0('0x15')](_0xa864c5[_0xfcb0('0x39')][_0xfcb0('0x15')]);}return _0x2cef3d[_0xfcb0('0xdc')](_0x42491f);}})[_0xfcb0('0x1d')](function(_0x394c2c){if(_0x394c2c){return _0x394c2c?{'count':_0x3eae57,'rows':_0x394c2c}:null;}})[_0xfcb0('0x1d')](respondWithResult(_0x117746,null))[_0xfcb0('0x52')](handleError(_0x117746,null));};exports[_0xfcb0('0xde')]=function(_0x974693,_0x2d42df){var _0x1823b6={};var _0x12bc87={};var _0x47e995;var _0x30abdd;return db[_0xfcb0('0x2f')][_0xfcb0('0x90')]({'where':{'id':_0x974693['params']['id']}})['then'](handleEntityNotFound(_0x2d42df,null))[_0xfcb0('0x1d')](function(_0x1a53f8){if(_0x1a53f8){_0x47e995=_0x1a53f8;_0x12bc87[_0xfcb0('0xcb')]=_['keys'](db['OpenchannelInteraction']['rawAttributes']);_0x12bc87['query']=_[_0xfcb0('0xcc')](_0x974693[_0xfcb0('0x39')]);_0x12bc87['filters']=_['intersection'](_0x12bc87[_0xfcb0('0xcb')],_0x12bc87[_0xfcb0('0x39')]);_0x1823b6[_0xfcb0('0x3d')]=_[_0xfcb0('0xcf')](_0x12bc87[_0xfcb0('0xcb')],qs['fields'](_0x974693[_0xfcb0('0x39')][_0xfcb0('0xd0')]));_0x1823b6['attributes']=_0x1823b6['attributes'][_0xfcb0('0x42')]?_0x1823b6[_0xfcb0('0x3d')]:_0x12bc87[_0xfcb0('0xcb')];_0x1823b6[_0xfcb0('0xd1')]=qs['sort'](_0x974693[_0xfcb0('0x39')][_0xfcb0('0xd2')]);_0x1823b6[_0xfcb0('0x38')]=qs[_0xfcb0('0xce')](_[_0xfcb0('0xd3')](_0x974693['query'],_0x12bc87[_0xfcb0('0xce')]));if(_0x974693[_0xfcb0('0x39')]['filter']){_0x1823b6['where']=_[_0xfcb0('0x4e')](_0x1823b6['where'],{'$or':_['map'](_0x1823b6[_0xfcb0('0x3d')],function(_0x14892c){var _0x11c68c={};_0x11c68c[_0x14892c]={'$like':'%'+_0x974693[_0xfcb0('0x39')][_0xfcb0('0x27')]+'%'};return _0x11c68c;})});}_0x1823b6=_[_0xfcb0('0x4e')]({},_0x1823b6,_0x974693[_0xfcb0('0x4f')]);return _0x47e995[_0xfcb0('0xde')](_0x1823b6);}})[_0xfcb0('0x1d')](function(_0x53cfab){if(_0x53cfab){_0x30abdd=_0x53cfab['length'];if(!_0x974693['query'][_0xfcb0('0xc2')]('nolimit')){_0x1823b6[_0xfcb0('0x18')]=qs['limit'](_0x974693[_0xfcb0('0x39')][_0xfcb0('0x18')]);_0x1823b6[_0xfcb0('0x15')]=qs[_0xfcb0('0x15')](_0x974693[_0xfcb0('0x39')]['offset']);}return _0x47e995[_0xfcb0('0xde')](_0x1823b6);}})[_0xfcb0('0x1d')](function(_0x1441f9){if(_0x1441f9){return _0x1441f9?{'count':_0x30abdd,'rows':_0x1441f9}:null;}})[_0xfcb0('0x1d')](respondWithResult(_0x2d42df,null))['catch'](handleError(_0x2d42df,null));};exports[_0xfcb0('0xdf')]=function(_0x1a0086,_0x29adc3){var _0x20c606={'raw':!![],'where':{}};var _0x1532cb={};var _0x43d999={'count':0x0,'rows':[]};return db[_0xfcb0('0x2f')][_0xfcb0('0x90')]({'where':{'id':_0x1a0086['params']['id']}})[_0xfcb0('0x1d')](handleEntityNotFound(_0x29adc3,null))[_0xfcb0('0x1d')](function(_0xa14dbf){if(_0xa14dbf){_0x1532cb[_0xfcb0('0xcb')]=_[_0xfcb0('0xcc')](db[_0xfcb0('0xe0')]['rawAttributes']);_0x1532cb[_0xfcb0('0x39')]=_['keys'](_0x1a0086[_0xfcb0('0x39')]);_0x1532cb[_0xfcb0('0xce')]=_['intersection'](_0x1532cb['model'],_0x1532cb[_0xfcb0('0x39')]);_0x20c606['attributes']=_['intersection'](_0x1532cb[_0xfcb0('0xcb')],qs[_0xfcb0('0xd0')](_0x1a0086['query'][_0xfcb0('0xd0')]));_0x20c606[_0xfcb0('0x3d')]=_0x20c606[_0xfcb0('0x3d')][_0xfcb0('0x42')]?_0x20c606[_0xfcb0('0x3d')]:_0x1532cb['model'];if(!_0x1a0086['query']['hasOwnProperty']('nolimit')){_0x20c606['limit']=qs['limit'](_0x1a0086[_0xfcb0('0x39')][_0xfcb0('0x18')]);_0x20c606[_0xfcb0('0x15')]=qs[_0xfcb0('0x15')](_0x1a0086[_0xfcb0('0x39')][_0xfcb0('0x15')]);}_0x20c606[_0xfcb0('0xd1')]=qs[_0xfcb0('0xd2')](_0x1a0086[_0xfcb0('0x39')][_0xfcb0('0xd2')]);_0x20c606[_0xfcb0('0x38')]=qs[_0xfcb0('0xce')](_[_0xfcb0('0xd3')](_0x1a0086[_0xfcb0('0x39')],_0x1532cb[_0xfcb0('0xce')]));_0x20c606[_0xfcb0('0x38')][_0xfcb0('0xd9')]=_0xa14dbf['id'];if(_0x1a0086[_0xfcb0('0x39')][_0xfcb0('0x27')]){_0x20c606[_0xfcb0('0x38')]=_[_0xfcb0('0x4e')](_0x20c606['where'],{'$or':_['map'](_0x20c606[_0xfcb0('0x3d')],function(_0x3c9442){var _0x546b47={};_0x546b47[_0x3c9442]={'$like':'%'+_0x1a0086['query'][_0xfcb0('0x27')]+'%'};return _0x546b47;})});}_0x20c606=_[_0xfcb0('0x4e')]({},_0x20c606,_0x1a0086[_0xfcb0('0x4f')]);return db[_0xfcb0('0xe0')][_0xfcb0('0x17')]({'where':_0x20c606['where']})[_0xfcb0('0x1d')](function(_0x4d1d61){_0x43d999[_0xfcb0('0x17')]=_0x4d1d61;if(_0x1a0086['query'][_0xfcb0('0xc3')]){_0x20c606[_0xfcb0('0x3a')]=[{'all':!![]}];}return db[_0xfcb0('0xe0')]['findAll'](_0x20c606);})['then'](function(_0x519ff0){_0x43d999[_0xfcb0('0x3f')]=_0x519ff0;return _0x43d999;});}})[_0xfcb0('0x1d')](respondWithFilteredResult(_0x29adc3,_0x20c606))['catch'](handleError(_0x29adc3,null));};exports[_0xfcb0('0xe1')]=function(_0x37f450,_0x1cf671){var _0x34141a={};var _0x3ac006={};var _0x4b5880;var _0x418079;return db[_0xfcb0('0x2f')][_0xfcb0('0x90')]({'where':{'id':_0x37f450[_0xfcb0('0x54')]['id']}})['then'](handleEntityNotFound(_0x1cf671,null))[_0xfcb0('0x1d')](function(_0x2f1e5d){if(_0x2f1e5d){_0x4b5880=_0x2f1e5d;_0x3ac006[_0xfcb0('0xcb')]=_[_0xfcb0('0xcc')](db[_0xfcb0('0xe2')]['rawAttributes']);_0x3ac006[_0xfcb0('0x39')]=_[_0xfcb0('0xcc')](_0x37f450['query']);_0x3ac006['filters']=_[_0xfcb0('0xcf')](_0x3ac006[_0xfcb0('0xcb')],_0x3ac006[_0xfcb0('0x39')]);_0x34141a[_0xfcb0('0x3d')]=_[_0xfcb0('0xcf')](_0x3ac006['model'],qs[_0xfcb0('0xd0')](_0x37f450[_0xfcb0('0x39')][_0xfcb0('0xd0')]));_0x34141a[_0xfcb0('0x3d')]=_0x34141a[_0xfcb0('0x3d')]['length']?_0x34141a[_0xfcb0('0x3d')]:_0x3ac006['model'];_0x34141a[_0xfcb0('0xd1')]=qs[_0xfcb0('0xd2')](_0x37f450[_0xfcb0('0x39')][_0xfcb0('0xd2')]);_0x34141a['where']=qs['filters'](_[_0xfcb0('0xd3')](_0x37f450[_0xfcb0('0x39')],_0x3ac006[_0xfcb0('0xce')]));if(_0x37f450[_0xfcb0('0x39')]['filter']){_0x34141a[_0xfcb0('0x38')]=_[_0xfcb0('0x4e')](_0x34141a['where'],{'$or':_[_0xfcb0('0x29')](_0x34141a[_0xfcb0('0x3d')],function(_0x2c900a){var _0x430d06={};_0x430d06[_0x2c900a]={'$like':'%'+_0x37f450[_0xfcb0('0x39')][_0xfcb0('0x27')]+'%'};return _0x430d06;})});}_0x34141a=_[_0xfcb0('0x4e')]({},_0x34141a,_0x37f450['options']);return _0x4b5880[_0xfcb0('0xe1')](_0x34141a);}})[_0xfcb0('0x1d')](function(_0x54d9c4){if(_0x54d9c4){_0x418079=_0x54d9c4[_0xfcb0('0x42')];if(!_0x37f450[_0xfcb0('0x39')]['hasOwnProperty'](_0xfcb0('0xd5'))){_0x34141a['limit']=qs[_0xfcb0('0x18')](_0x37f450[_0xfcb0('0x39')][_0xfcb0('0x18')]);_0x34141a['offset']=qs[_0xfcb0('0x15')](_0x37f450[_0xfcb0('0x39')][_0xfcb0('0x15')]);}return _0x4b5880['getSmsInteractions'](_0x34141a);}})[_0xfcb0('0x1d')](function(_0x3f4349){if(_0x3f4349){return _0x3f4349?{'count':_0x418079,'rows':_0x3f4349}:null;}})[_0xfcb0('0x1d')](respondWithResult(_0x1cf671,null))['catch'](handleError(_0x1cf671,null));};exports[_0xfcb0('0xe3')]=function(_0x30c977,_0x4f442e){var _0x454f04={};var _0x82e73b={};var _0x1ecda1;var _0x328b99;return db[_0xfcb0('0x2f')][_0xfcb0('0x90')]({'where':{'id':_0x30c977[_0xfcb0('0x54')]['id']}})['then'](handleEntityNotFound(_0x4f442e,null))[_0xfcb0('0x1d')](function(_0x665c7){if(_0x665c7){_0x1ecda1=_0x665c7;_0x82e73b['model']=_[_0xfcb0('0xcc')](db[_0xfcb0('0xe4')][_0xfcb0('0x30')]);_0x82e73b[_0xfcb0('0x39')]=_[_0xfcb0('0xcc')](_0x30c977[_0xfcb0('0x39')]);_0x82e73b['filters']=_['intersection'](_0x82e73b[_0xfcb0('0xcb')],_0x82e73b[_0xfcb0('0x39')]);_0x454f04[_0xfcb0('0x3d')]=_[_0xfcb0('0xcf')](_0x82e73b[_0xfcb0('0xcb')],qs[_0xfcb0('0xd0')](_0x30c977[_0xfcb0('0x39')][_0xfcb0('0xd0')]));_0x454f04['attributes']=_0x454f04['attributes'][_0xfcb0('0x42')]?_0x454f04['attributes']:_0x82e73b[_0xfcb0('0xcb')];_0x454f04[_0xfcb0('0xd1')]=qs[_0xfcb0('0xd2')](_0x30c977[_0xfcb0('0x39')][_0xfcb0('0xd2')]);_0x454f04['where']=qs['filters'](_['pick'](_0x30c977[_0xfcb0('0x39')],_0x82e73b['filters']));if(_0x30c977[_0xfcb0('0x39')][_0xfcb0('0x27')]){_0x454f04[_0xfcb0('0x38')]=_[_0xfcb0('0x4e')](_0x454f04[_0xfcb0('0x38')],{'$or':_[_0xfcb0('0x29')](_0x454f04[_0xfcb0('0x3d')],function(_0x3d09c3){var _0x55e014={};_0x55e014[_0x3d09c3]={'$like':'%'+_0x30c977[_0xfcb0('0x39')][_0xfcb0('0x27')]+'%'};return _0x55e014;})});}_0x454f04=_['merge']({},_0x454f04,_0x30c977[_0xfcb0('0x4f')]);return _0x1ecda1[_0xfcb0('0xe3')](_0x454f04);}})[_0xfcb0('0x1d')](function(_0x2bc488){if(_0x2bc488){_0x328b99=_0x2bc488[_0xfcb0('0x42')];if(!_0x30c977[_0xfcb0('0x39')]['hasOwnProperty'](_0xfcb0('0xd5'))){_0x454f04['limit']=qs[_0xfcb0('0x18')](_0x30c977[_0xfcb0('0x39')]['limit']);_0x454f04[_0xfcb0('0x15')]=qs[_0xfcb0('0x15')](_0x30c977[_0xfcb0('0x39')][_0xfcb0('0x15')]);}return _0x1ecda1['getFaxInteractions'](_0x454f04);}})[_0xfcb0('0x1d')](function(_0x160a1e){if(_0x160a1e){return _0x160a1e?{'count':_0x328b99,'rows':_0x160a1e}:null;}})[_0xfcb0('0x1d')](respondWithResult(_0x4f442e,null))['catch'](handleError(_0x4f442e,null));};exports[_0xfcb0('0xe5')]=function(_0x12bfb7,_0x2c3101){var _0x446ea3={};var _0x3b5e2d={};var _0x333b65;var _0x5bd6cf;return db['User'][_0xfcb0('0x90')]({'where':{'id':_0x12bfb7[_0xfcb0('0x54')]['id']}})['then'](handleEntityNotFound(_0x2c3101,null))[_0xfcb0('0x1d')](function(_0x3e60e6){if(_0x3e60e6){_0x333b65=_0x3e60e6;_0x3b5e2d[_0xfcb0('0xcb')]=_['keys'](db[_0xfcb0('0xe6')][_0xfcb0('0x30')]);_0x3b5e2d[_0xfcb0('0x39')]=_[_0xfcb0('0xcc')](_0x12bfb7[_0xfcb0('0x39')]);_0x3b5e2d[_0xfcb0('0xce')]=_[_0xfcb0('0xcf')](_0x3b5e2d[_0xfcb0('0xcb')],_0x3b5e2d['query']);_0x446ea3[_0xfcb0('0x3d')]=_['intersection'](_0x3b5e2d[_0xfcb0('0xcb')],qs[_0xfcb0('0xd0')](_0x12bfb7[_0xfcb0('0x39')]['fields']));_0x446ea3['attributes']=_0x446ea3[_0xfcb0('0x3d')][_0xfcb0('0x42')]?_0x446ea3[_0xfcb0('0x3d')]:_0x3b5e2d['model'];_0x446ea3[_0xfcb0('0xd1')]=qs[_0xfcb0('0xd2')](_0x12bfb7['query']['sort']);_0x446ea3[_0xfcb0('0x38')]=qs[_0xfcb0('0xce')](_['pick'](_0x12bfb7[_0xfcb0('0x39')],_0x3b5e2d[_0xfcb0('0xce')]));if(_0x12bfb7['query'][_0xfcb0('0x27')]){_0x446ea3[_0xfcb0('0x38')]=_[_0xfcb0('0x4e')](_0x446ea3[_0xfcb0('0x38')],{'$or':_[_0xfcb0('0x29')](_0x446ea3[_0xfcb0('0x3d')],function(_0x587b0b){var _0x473587={};_0x473587[_0x587b0b]={'$like':'%'+_0x12bfb7[_0xfcb0('0x39')][_0xfcb0('0x27')]+'%'};return _0x473587;})});}_0x446ea3=_[_0xfcb0('0x4e')]({},_0x446ea3,_0x12bfb7[_0xfcb0('0x4f')]);return _0x333b65['getWhatsappInteractions'](_0x446ea3);}})[_0xfcb0('0x1d')](function(_0x202f62){if(_0x202f62){_0x5bd6cf=_0x202f62[_0xfcb0('0x42')];if(!_0x12bfb7['query'][_0xfcb0('0xc2')](_0xfcb0('0xd5'))){_0x446ea3['limit']=qs[_0xfcb0('0x18')](_0x12bfb7['query'][_0xfcb0('0x18')]);_0x446ea3[_0xfcb0('0x15')]=qs[_0xfcb0('0x15')](_0x12bfb7['query'][_0xfcb0('0x15')]);}return _0x333b65['getWhatsappInteractions'](_0x446ea3);}})[_0xfcb0('0x1d')](function(_0x20778e){if(_0x20778e){return _0x20778e?{'count':_0x5bd6cf,'rows':_0x20778e}:null;}})[_0xfcb0('0x1d')](respondWithResult(_0x2c3101,null))['catch'](handleError(_0x2c3101,null));};exports['login']=function(_0x5327e8,_0x23bc98,_0x3d4279){var _0x331173;var _0x32988e;var _0x1c2ab3;var _0x415748=!_['isNil'](_0x5327e8[_0xfcb0('0x54')]['id'])?_0x5327e8[_0xfcb0('0x54')]['id']:!_[_0xfcb0('0x5d')](_0x5327e8['user']['id'])?_0x5327e8[_0xfcb0('0x24')]['id']:null;return db['User'][_0xfcb0('0x50')]({'where':{'id':_0x415748,'role':{'$or':[_0xfcb0('0x73'),_0xfcb0('0x24'),_0xfcb0('0x1f')]}},'attributes':['id',_0xfcb0('0x2b'),'phone',_0xfcb0('0xe7'),_0xfcb0('0x1e'),_0xfcb0('0x58'),_0xfcb0('0x98')]})[_0xfcb0('0x1d')](function(_0x57aba4){if(_0x57aba4){if(_0x57aba4[_0xfcb0('0x1e')]===_0xfcb0('0x1f')){_0x331173=_0x57aba4;if(_0x5327e8[_0xfcb0('0x53')]['interface']){_0x1c2ab3=util[_0xfcb0('0xbf')](_0xfcb0('0xe8'),_0x331173[_0x5327e8['body'][_0xfcb0('0xe9')]]);}else if(_0x5327e8['body'][_0xfcb0('0xea')]){_0x1c2ab3=util[_0xfcb0('0xbf')](_0xfcb0('0xa3'),_0x5327e8['body'][_0xfcb0('0xea')]);}else{_0x1c2ab3=util[_0xfcb0('0xbf')](_0xfcb0('0xa3'),_0x331173[_0xfcb0('0x2b')]);}socket['to'](util[_0xfcb0('0xbf')](_0xfcb0('0xeb'),_0x331173['name']))[_0xfcb0('0x20')](_0xfcb0('0xec'),{'user':{'id':_0x331173['id'],'name':_0x331173[_0xfcb0('0x2b')]},'ip':_0x5327e8[_0xfcb0('0xed')][_0xfcb0('0xee')]||_0x5327e8[_0xfcb0('0xef')][_0xfcb0('0xf0')]||_0x5327e8['socket'][_0xfcb0('0xf0')]||_0x5327e8[_0xfcb0('0xef')][_0xfcb0('0xf1')]['remoteAddress']});return db[_0xfcb0('0xa5')][_0xfcb0('0x2d')]({'where':{'membername':_0x331173[_0xfcb0('0x2b')]},'individualHooks':!![]});}}else{throw new db[(_0xfcb0('0x8b'))][(_0xfcb0('0x88'))](_0xfcb0('0xf2'));}})['then'](function(){if(_0x331173){return _0x331173[_0xfcb0('0xf3')]({'raw':!![]});}})['then'](function(_0x2f7cf4){if(_0x331173){if(_0x2f7cf4){_0x32988e=_0x2f7cf4;if(_0x32988e['length']){var _0x2af211=_0x32988e[_0xfcb0('0x29')](function(_0x6569e3){var _0x40fa6c={'membername':_0x331173[_0xfcb0('0x2b')],'UserId':_0x331173['id'],'queue_name':_0x6569e3[_0xfcb0('0x2b')],'VoiceQueueId':_0x6569e3['id'],'interface':_0x1c2ab3,'paused':_0x331173[_0xfcb0('0x98')]||![],'penalty':_0x6569e3[_0xfcb0('0xf4')]||0x0};return db[_0xfcb0('0xa5')][_0xfcb0('0xa6')](_0x40fa6c);});return Promise['all'](_0x2af211);}}}})[_0xfcb0('0x1d')](function(){if(_0x331173){return db[_0xfcb0('0xf5')][_0xfcb0('0x3e')]({'where':{'membername':_0x331173[_0xfcb0('0x2b')],'exitAt':null}});}})[_0xfcb0('0x1d')](function(_0x430e81){if(_0x331173){var _0x37da81=[];_0x430e81[_0xfcb0('0xf6')](function(_0x20cb7b){_0x37da81[_0xfcb0('0x43')](_0x20cb7b[_0xfcb0('0x1c')]({'exitAt':moment()['format'](_0xfcb0('0xf7'))}));});return Promise['all'](_0x37da81);}})['then'](function(){if(_0x331173){var _0x24721b=[];var _0x569960=[];var _0x440906=utils[_0xfcb0('0xf8')]();var _0x144048={'membername':_0x331173['name'],'interface':_0x1c2ab3,'enterAt':moment()[_0xfcb0('0xbf')](_0xfcb0('0xf7')),'role':_0x331173[_0xfcb0('0x1e')],'internal':_0x331173[_0xfcb0('0x58')]};_0x440906[_0xfcb0('0xf6')](function(_0x57cfe2){_0x24721b[_0xfcb0('0x43')](_[_0xfcb0('0x4e')]({'channel':_0x57cfe2,'type':'LOGIN','data1':_0x5327e8[_0xfcb0('0x53')]['device'],'data2':_0x1c2ab3},_0x144048));if(_0x331173[_0xfcb0('0x98')]){_0x569960[_0xfcb0('0x43')](_[_0xfcb0('0x4e')]({'channel':_0x57cfe2,'type':'PAUSE','data1':_0xfcb0('0xf9')},_0x144048));}});return db['MemberReport'][_0xfcb0('0x7e')](_0x24721b[_0xfcb0('0xbd')](_0x569960),{'individualHooks':!![]});}})[_0xfcb0('0x1d')](function(){if(_0x331173){return _0x331173['update']({'online':!![],'lastLoginAt':moment()[_0xfcb0('0xbf')](_0xfcb0('0xf7')),'voicePause':_0x331173[_0xfcb0('0x98')]||![],'mailPause':_0x331173['loginInPause']||![],'chatPause':_0x331173['loginInPause']||![],'faxPause':_0x331173[_0xfcb0('0x98')]||![],'smsPause':_0x331173[_0xfcb0('0x98')]||![],'openchannelPause':_0x331173['loginInPause']||![],'whatsappPause':_0x331173[_0xfcb0('0x98')]||![],'pauseType':_0x331173['loginInPause']?_0xfcb0('0xf9'):null,'interface':_0x1c2ab3,'lastPauseAt':moment()[_0xfcb0('0xbf')](_0xfcb0('0xf7'))});}})['then'](function(_0x43e08f){if(_0x5327e8['isMiddleware']){return _0x3d4279();}else{return Promise[_0xfcb0('0xfa')](_0x43e08f)[_0xfcb0('0x1d')](respondWithResult(_0x23bc98,null));}})[_0xfcb0('0x52')](handleError(_0x23bc98,null));};exports[_0xfcb0('0xfb')]=function(_0x234952,_0x53d716){var _0xdda93;return db[_0xfcb0('0x2f')][_0xfcb0('0x50')]({'where':{'id':_0x234952[_0xfcb0('0x54')]['id'],'role':_0xfcb0('0x1f')},'attributes':['id',_0xfcb0('0x2b'),'role']})[_0xfcb0('0x1d')](handleEntityNotFound(_0x53d716,null))['then'](function(_0x89f4b2){if(_0x89f4b2){_0xdda93=_0x89f4b2;return db[_0xfcb0('0xa5')]['destroy']({'where':{'membername':_0xdda93[_0xfcb0('0x2b')]},'individualHooks':!![]});}})['then'](function(){return db[_0xfcb0('0xf5')][_0xfcb0('0x3e')]({'where':{'membername':_0xdda93['name'],'exitAt':null}});})[_0xfcb0('0x1d')](function(_0x140bd2){var _0x310f97=[];_0x140bd2[_0xfcb0('0xf6')](function(_0x14c7ef){_0x310f97[_0xfcb0('0x43')](_0x14c7ef[_0xfcb0('0x1c')]({'exitAt':moment()[_0xfcb0('0xbf')]('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise['all'](_0x310f97);})[_0xfcb0('0x1d')](function(){return _0xdda93[_0xfcb0('0x1c')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0xfcb0('0x1d')](respondWithResult(_0x53d716,null))[_0xfcb0('0x52')](handleError(_0x53d716,null));};exports[_0xfcb0('0xfc')]=function(_0x2b7469,_0x14d485){var _0x28f313;return db[_0xfcb0('0xa5')][_0xfcb0('0x1c')]({'paused':0x1},{'where':{'UserId':_0x2b7469[_0xfcb0('0x54')]['id']},'individualHooks':!![]})[_0xfcb0('0x1d')](function(){return db[_0xfcb0('0x2f')][_0xfcb0('0x50')]({'where':{'id':_0x2b7469[_0xfcb0('0x54')]['id'],'role':_0xfcb0('0x1f')},'attributes':['id',_0xfcb0('0x2b'),'role','internal',_0xfcb0('0xe9'),_0xfcb0('0x97')]});})[_0xfcb0('0x1d')](handleEntityNotFound(_0x14d485,null))['then'](function(_0x224f87){if(_0x224f87){_0x28f313=_0x224f87;return db[_0xfcb0('0xf5')][_0xfcb0('0x3e')]({'where':{'membername':_0x28f313['name'],'type':'PAUSE','exitAt':null}});}})[_0xfcb0('0x1d')](function(_0x408adc){if(_0x408adc['length']){var _0x448132=moment()[_0xfcb0('0xbf')](_0xfcb0('0xf7'));for(var _0x29dcb5=0x0,_0x1fa723=_0x408adc['length'];_0x29dcb5<_0x1fa723;_0x29dcb5++){_0x408adc[_0x29dcb5][_0xfcb0('0xfd')]({'exitAt':_0x448132});}}})[_0xfcb0('0x1d')](function(){var _0xea84a6=[];var _0x3c1b86=utils[_0xfcb0('0xf8')]();_0x3c1b86[_0xfcb0('0xf6')](function(_0x38e46d){_0xea84a6[_0xfcb0('0x43')]({'channel':_0x38e46d,'membername':_0x28f313[_0xfcb0('0x2b')],'interface':_[_0xfcb0('0x5d')](_0x28f313[_0xfcb0('0xe9')])?util[_0xfcb0('0xbf')]('SIP/%s',_0x28f313[_0xfcb0('0x2b')]):_0x28f313[_0xfcb0('0xe9')],'type':_0xfcb0('0xfe'),'enterAt':moment()[_0xfcb0('0xbf')](_0xfcb0('0xf7')),'data1':_0x2b7469[_0xfcb0('0x53')][_0xfcb0('0x31')]||_0xfcb0('0xff'),'role':_0x28f313[_0xfcb0('0x1e')],'internal':_0x28f313[_0xfcb0('0x58')]});});return db['MemberReport'][_0xfcb0('0x7e')](_0xea84a6,{'individualHooks':!![]});})[_0xfcb0('0x1d')](function(){return _0x28f313['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x2b7469[_0xfcb0('0x53')][_0xfcb0('0x31')]||_0xfcb0('0xff'),'lastPauseAt':moment()[_0xfcb0('0xbf')]('YYYY-MM-DD\x20HH:mm:ss')});})['then'](respondWithResult(_0x14d485,null))[_0xfcb0('0x52')](handleError(_0x14d485,null));};exports[_0xfcb0('0x100')]=function(_0x2f4804,_0x33a208){if(_0x2f4804['body'][_0xfcb0('0x96')]&&!utils[_0xfcb0('0x9a')](_0x2f4804[_0xfcb0('0x53')]['channel'])){throw new APIBadRequestError(util[_0xfcb0('0xbf')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x2f4804[_0xfcb0('0x53')]['channel']));}return db['User']['find']({'where':{'id':_0x2f4804[_0xfcb0('0x54')]['id']},'attributes':['id',_0xfcb0('0x2b'),_0xfcb0('0x1e'),_0xfcb0('0x58'),_0xfcb0('0xe9'),_0xfcb0('0x97'),'voicePause','mailPause','chatPause',_0xfcb0('0x101'),_0xfcb0('0x102'),_0xfcb0('0x103'),_0xfcb0('0x104'),_0xfcb0('0x105'),_0xfcb0('0x106')]})[_0xfcb0('0x1d')](function(_0x338bba){if(!_0x338bba){throw new APINotFoundError(util[_0xfcb0('0xbf')](_0xfcb0('0xc0'),_0x2f4804[_0xfcb0('0x54')]['id']));}return _0x338bba[_0xfcb0('0x100')](_0x2f4804[_0xfcb0('0x53')][_0xfcb0('0x96')]);})[_0xfcb0('0x1d')](respondWithResult(_0x33a208,null))['catch'](APIHandleError(_0x33a208));};exports[_0xfcb0('0x107')]=function(_0x407805,_0x304819){var _0x463dd6={};var _0x592f68={};var _0x19cb34;var _0x1f698e;return db[_0xfcb0('0x2f')][_0xfcb0('0x90')]({'where':{'id':_0x407805[_0xfcb0('0x54')]['id']}})[_0xfcb0('0x1d')](handleEntityNotFound(_0x304819,null))['then'](function(_0x4467d0){if(_0x4467d0){_0x19cb34=_0x4467d0;_0x592f68[_0xfcb0('0xcb')]=_[_0xfcb0('0xcc')](db['Team'][_0xfcb0('0x30')]);_0x592f68['query']=_['keys'](_0x407805['query']);_0x592f68[_0xfcb0('0xce')]=_[_0xfcb0('0xcf')](_0x592f68[_0xfcb0('0xcb')],_0x592f68[_0xfcb0('0x39')]);_0x463dd6['attributes']=_['intersection'](_0x592f68[_0xfcb0('0xcb')],qs[_0xfcb0('0xd0')](_0x407805[_0xfcb0('0x39')][_0xfcb0('0xd0')]));_0x463dd6[_0xfcb0('0x3d')]=_0x463dd6[_0xfcb0('0x3d')]['length']?_0x463dd6[_0xfcb0('0x3d')]:_0x592f68[_0xfcb0('0xcb')];_0x463dd6[_0xfcb0('0xd1')]=qs[_0xfcb0('0xd2')](_0x407805[_0xfcb0('0x39')]['sort']);_0x463dd6['where']=qs[_0xfcb0('0xce')](_[_0xfcb0('0xd3')](_0x407805[_0xfcb0('0x39')],_0x592f68['filters']));if(_0x407805[_0xfcb0('0x39')][_0xfcb0('0x27')]){_0x463dd6[_0xfcb0('0x38')]=_[_0xfcb0('0x4e')](_0x463dd6[_0xfcb0('0x38')],{'$or':_['map'](_0x463dd6[_0xfcb0('0x3d')],function(_0x272191){var _0x29c127={};_0x29c127[_0x272191]={'$like':'%'+_0x407805['query']['filter']+'%'};return _0x29c127;})});}_0x463dd6=_[_0xfcb0('0x4e')]({},_0x463dd6,_0x407805[_0xfcb0('0x4f')]);return _0x19cb34[_0xfcb0('0x107')](_0x463dd6);}})[_0xfcb0('0x1d')](function(_0x33b4a5){if(_0x33b4a5){_0x1f698e=_0x33b4a5[_0xfcb0('0x42')];if(!_0x407805[_0xfcb0('0x39')][_0xfcb0('0xc2')](_0xfcb0('0xd5'))){_0x463dd6[_0xfcb0('0x18')]=qs['limit'](_0x407805['query'][_0xfcb0('0x18')]);_0x463dd6[_0xfcb0('0x15')]=qs['offset'](_0x407805[_0xfcb0('0x39')][_0xfcb0('0x15')]);}return _0x19cb34['getTeams'](_0x463dd6);}})[_0xfcb0('0x1d')](function(_0x373fee){if(_0x373fee){return _0x373fee?{'count':_0x1f698e,'rows':_0x373fee}:null;}})[_0xfcb0('0x1d')](respondWithResult(_0x304819,null))[_0xfcb0('0x52')](handleError(_0x304819,null));};exports['addTeams']=function(_0x5a625d,_0x5d972){var _0x477fee=_0x5a625d[_0xfcb0('0x54')]['id'];var _0x2c9a0e=_0x5a625d[_0xfcb0('0x53')]?_0x5a625d['body'][_0xfcb0('0x56')]:null;var _0x1f7fa3=[];return Promise[_0xfcb0('0xfa')]()[_0xfcb0('0x1d')](function(){if(!_0x2c9a0e)throw new APIBadRequestError('Body\x20parameter\x20\x27ids\x27\x20is\x20required');})[_0xfcb0('0x1d')](function(){return db[_0xfcb0('0x2f')][_0xfcb0('0x90')]({'where':{'id':_0x477fee}});})[_0xfcb0('0x1d')](function(_0x257c41){if(!_0x257c41)throw new APINotFoundError(util[_0xfcb0('0xbf')]('User\x20with\x20id\x20%s\x20not\x20found',_0x5a625d[_0xfcb0('0x54')]['id']));return db[_0xfcb0('0x5f')][_0xfcb0('0x108')](function(_0x29812e){return _0x257c41[_0xfcb0('0x109')](_0x2c9a0e,{'transaction':_0x29812e})['then'](function(){return db[_0xfcb0('0x10a')][_0xfcb0('0x3e')]({'where':{'id':{'$in':_0x2c9a0e}}});})[_0xfcb0('0x1d')](function(_0x3448e4){var _0x12d43e=_[_0xfcb0('0x29')](_0x3448e4,function(_0x1aaf7b){return _0x1aaf7b['getAssociatedQueues']();});return Promise[_0xfcb0('0x4a')](_0x12d43e);})['then'](function(_0xf87751){_0x1f7fa3=_[_0xfcb0('0x10b')](_0xf87751);var _0x2838b7=_[_0xfcb0('0x29')](_0x1f7fa3,function(_0x4eec0d){return _0x4eec0d['addAgent'](_0x257c41['id'],{'transaction':_0x29812e});});return Promise[_0xfcb0('0x4a')](_0x2838b7);})['then'](function(){if(!_0x257c41[_0xfcb0('0x97')])return;var _0x31bbe3=_[_0xfcb0('0x27')](_0x1f7fa3,function(_0x4ef7c9){return _0x4ef7c9[_0xfcb0('0x10c')](_0xfcb0('0x96'))===_0xfcb0('0x10d');});var _0x14534c=_[_0xfcb0('0x29')](_0x31bbe3,function(_0x157f92){return db[_0xfcb0('0xa5')]['upsert']({'membername':_0x257c41['name'],'UserId':_0x257c41['id'],'queue_name':_0x157f92[_0xfcb0('0x2b')],'VoiceQueueId':_0x157f92['id'],'interface':_[_0xfcb0('0x5d')](_0x257c41[_0xfcb0('0xe9')])?util[_0xfcb0('0xbf')](_0xfcb0('0xa3'),_0x257c41[_0xfcb0('0x2b')]):_0x257c41[_0xfcb0('0xe9')],'paused':_0x257c41[_0xfcb0('0x99')]||![],'penalty':_0x257c41[_0xfcb0('0xa4')]},{'transaction':_0x29812e});});return Promise[_0xfcb0('0x4a')](_0x14534c);})['then'](function(){return db[_0xfcb0('0x10e')][_0xfcb0('0x3e')]({'where':{'teamId':{'$in':_0x2c9a0e}}});})[_0xfcb0('0x1d')](function(_0x554564){var _0x17227e=_['map'](_0x554564,function(_0x4cea52){return db['UserVoicePrefix'][_0xfcb0('0x78')]({'UserId':_0x257c41['id'],'VoicePrefixId':_0x4cea52['VoicePrefixId']},{'transaction':_0x29812e});});return Promise['all'](_0x17227e);});});})[_0xfcb0('0x1d')](function(){for(var _0x47f3fd=0x0;_0x47f3fd<_0x1f7fa3[_0xfcb0('0x42')];_0x47f3fd++){var _0x1e5c86=_0x1f7fa3[_0x47f3fd]['getDataValue'](_0xfcb0('0x96'));var _0x46c5e5=_0x1e5c86+_0xfcb0('0xaa');socket[_0xfcb0('0x20')](_0xfcb0('0x24')+_0x1e5c86+'Queue:save',{'UserId':_0x477fee,['queueField']:_0x1f7fa3[_0x47f3fd]['id']});}})['then'](respondWithStatusCode(_0x5d972,null))[_0xfcb0('0x52')](APIHandleError(_0x5d972));};exports[_0xfcb0('0x10f')]=function(_0x431e32,_0x211690){var _0x55e6bf=_0x431e32['params']['id'];var _0x7a0203=null;if(_0x431e32['query']['ids']){_0x7a0203=_[_0xfcb0('0x110')](_0x431e32[_0xfcb0('0x39')][_0xfcb0('0x56')])?_0x431e32[_0xfcb0('0x39')]['ids']:[_0x431e32[_0xfcb0('0x39')][_0xfcb0('0x56')]];}var _0x287d1f=[];return Promise[_0xfcb0('0xfa')]()[_0xfcb0('0x1d')](function(){if(!_0x7a0203)throw new APIBadRequestError(_0xfcb0('0x111'));})[_0xfcb0('0x1d')](function(){return db[_0xfcb0('0x2f')][_0xfcb0('0x90')]({'where':{'id':_0x55e6bf}});})[_0xfcb0('0x1d')](function(_0x142886){if(!_0x142886)throw new APINotFoundError(util[_0xfcb0('0xbf')](_0xfcb0('0xc0'),_0x431e32[_0xfcb0('0x54')]['id']));return db[_0xfcb0('0x5f')]['transaction'](function(_0x2ecb96){return _0x142886[_0xfcb0('0x10f')](_0x7a0203,{'transaction':_0x2ecb96})[_0xfcb0('0x1d')](function(){return db[_0xfcb0('0x10a')][_0xfcb0('0x3e')]({'where':{'id':{'$in':_0x7a0203}}});})[_0xfcb0('0x1d')](function(_0x5bad5a){var _0x3a7ef4=_['map'](_0x5bad5a,function(_0x506289){return _0x506289[_0xfcb0('0x112')]();});return Promise[_0xfcb0('0x4a')](_0x3a7ef4);})[_0xfcb0('0x1d')](function(_0x392a06){_0x287d1f=_[_0xfcb0('0x10b')](_0x392a06);var _0x36294b=_['map'](_0x287d1f,function(_0x557ef1){return _0x557ef1[_0xfcb0('0x113')](_0x142886['id'],{'transaction':_0x2ecb96});});return Promise[_0xfcb0('0x4a')](_0x36294b);})[_0xfcb0('0x1d')](function(){if(!_0x142886[_0xfcb0('0x97')])return;var _0x232f3=_[_0xfcb0('0x27')](_0x287d1f,function(_0x5a15c0){return _0x5a15c0[_0xfcb0('0x10c')]('channel')==='Voice';});var _0x2ba8d9=_[_0xfcb0('0x29')](_0x232f3,function(_0x22b9c3){return db[_0xfcb0('0xa5')]['destroy']({'where':{'VoiceQueueId':_0x22b9c3['id'],'UserId':_0x142886['id']},'transaction':_0x2ecb96});});return Promise['all'](_0x2ba8d9);})[_0xfcb0('0x1d')](function(){return db[_0xfcb0('0x10e')][_0xfcb0('0x3e')]({'where':{'teamId':{'$in':_0x7a0203}}});})[_0xfcb0('0x1d')](function(_0xe36668){var _0x111085=_[_0xfcb0('0x29')](_0xe36668,function(_0x4cfaff){return db[_0xfcb0('0x114')]['destroy']({'where':{'UserId':_0x142886['id'],'VoicePrefixId':_0x4cfaff[_0xfcb0('0x115')]}},{'transaction':_0x2ecb96});});return Promise['all'](_0x111085);});});})['then'](function(){for(var _0x2b24ac=0x0;_0x2b24ac<_0x287d1f[_0xfcb0('0x42')];_0x2b24ac++){var _0x106463=_0x287d1f[_0x2b24ac][_0xfcb0('0x10c')](_0xfcb0('0x96'));var _0x1b137b=_0x106463+_0xfcb0('0xaa');socket[_0xfcb0('0x20')](_0xfcb0('0x24')+_0x106463+_0xfcb0('0xab'),{'UserId':_0x55e6bf,['queueField']:_0x287d1f[_0x2b24ac]['id']});}})['then'](respondWithStatusCode(_0x211690,null))[_0xfcb0('0x52')](APIHandleError(_0x211690));};exports['getLists']=function(_0x30dee9,_0x17fcb8){var _0x40730f={};var _0x36bfe8={};var _0x54f06e;var _0x2dd500;return db['User'][_0xfcb0('0x90')]({'where':{'id':_0x30dee9['params']['id']}})[_0xfcb0('0x1d')](handleEntityNotFound(_0x17fcb8,null))[_0xfcb0('0x1d')](function(_0x462fc1){if(_0x462fc1){_0x54f06e=_0x462fc1;_0x36bfe8['model']=_[_0xfcb0('0xcc')](db['CmList']['rawAttributes']);_0x36bfe8[_0xfcb0('0x39')]=_['keys'](_0x30dee9[_0xfcb0('0x39')]);_0x36bfe8[_0xfcb0('0xce')]=_[_0xfcb0('0xcf')](_0x36bfe8[_0xfcb0('0xcb')],_0x36bfe8[_0xfcb0('0x39')]);_0x40730f['attributes']=_[_0xfcb0('0xcf')](_0x36bfe8[_0xfcb0('0xcb')],qs[_0xfcb0('0xd0')](_0x30dee9['query'][_0xfcb0('0xd0')]));_0x40730f[_0xfcb0('0x3d')]=_0x40730f['attributes'][_0xfcb0('0x42')]?_0x40730f[_0xfcb0('0x3d')]:_0x36bfe8['model'];_0x40730f[_0xfcb0('0xd1')]=qs[_0xfcb0('0xd2')](_0x30dee9[_0xfcb0('0x39')]['sort']);_0x40730f[_0xfcb0('0x38')]=qs[_0xfcb0('0xce')](_[_0xfcb0('0xd3')](_0x30dee9['query'],_0x36bfe8[_0xfcb0('0xce')]));if(_0x30dee9['query']['filter']){_0x40730f['where']=_[_0xfcb0('0x4e')](_0x40730f[_0xfcb0('0x38')],{'$or':_[_0xfcb0('0x29')](_0x40730f[_0xfcb0('0x3d')],function(_0x88bd33){var _0x2eec8f={};_0x2eec8f[_0x88bd33]={'$like':'%'+_0x30dee9[_0xfcb0('0x39')][_0xfcb0('0x27')]+'%'};return _0x2eec8f;})});}_0x40730f=_['merge']({},_0x40730f,_0x30dee9[_0xfcb0('0x4f')]);return _0x54f06e['getLists'](_0x40730f);}})[_0xfcb0('0x1d')](function(_0x30e1c6){if(_0x30e1c6){_0x2dd500=_0x30e1c6[_0xfcb0('0x42')];if(!_0x30dee9[_0xfcb0('0x39')][_0xfcb0('0xc2')]('nolimit')){_0x40730f[_0xfcb0('0x18')]=qs[_0xfcb0('0x18')](_0x30dee9[_0xfcb0('0x39')][_0xfcb0('0x18')]);_0x40730f['offset']=qs[_0xfcb0('0x15')](_0x30dee9[_0xfcb0('0x39')]['offset']);}return _0x54f06e[_0xfcb0('0x116')](_0x40730f);}})[_0xfcb0('0x1d')](function(_0x2fb6e9){if(_0x2fb6e9){return _0x2fb6e9?{'count':_0x2dd500,'rows':_0x2fb6e9}:null;}})[_0xfcb0('0x1d')](respondWithResult(_0x17fcb8,null))[_0xfcb0('0x52')](handleError(_0x17fcb8,null));};exports[_0xfcb0('0x117')]=function(_0x3691f2,_0x4a3c3e){var _0x3bc22c={};var _0x3a26f5={};var _0x1a116d;return db['User'][_0xfcb0('0x90')]({'where':{'id':_0x3691f2[_0xfcb0('0x54')]['id']}})[_0xfcb0('0x1d')](handleEntityNotFound(_0x4a3c3e,null))[_0xfcb0('0x1d')](function(_0x19129f){if(_0x19129f){_0x1a116d=_0x19129f;_0x3a26f5[_0xfcb0('0xcb')]=_[_0xfcb0('0xcc')](db[_0xfcb0('0x2f')][_0xfcb0('0x30')]);_0x3a26f5['query']=_[_0xfcb0('0xcc')](_0x3691f2[_0xfcb0('0x39')]);_0x3a26f5[_0xfcb0('0xce')]=_[_0xfcb0('0xcf')](_0x3a26f5[_0xfcb0('0xcb')],_0x3a26f5['query']);_0x3bc22c[_0xfcb0('0x3d')]=_[_0xfcb0('0xcf')](_0x3a26f5['model'],qs[_0xfcb0('0xd0')](_0x3691f2[_0xfcb0('0x39')][_0xfcb0('0xd0')]));_0x3bc22c[_0xfcb0('0x3d')]=_0x3bc22c[_0xfcb0('0x3d')]['length']?_0x3bc22c[_0xfcb0('0x3d')]:_0x3a26f5[_0xfcb0('0xcb')];_0x3bc22c['order']=qs[_0xfcb0('0xd2')](_0x3691f2[_0xfcb0('0x39')][_0xfcb0('0xd2')]);_0x3bc22c[_0xfcb0('0x38')]=qs[_0xfcb0('0xce')](_[_0xfcb0('0xd3')](_0x3691f2[_0xfcb0('0x39')],_0x3a26f5['filters']));if(_0x3691f2[_0xfcb0('0x39')][_0xfcb0('0x27')]){_0x3bc22c['where']=_[_0xfcb0('0x4e')](_0x3bc22c[_0xfcb0('0x38')],{'$or':_[_0xfcb0('0x29')](_0x3bc22c['attributes'],function(_0x3d48d5){var _0x40a1bc={};_0x40a1bc[_0x3d48d5]={'$like':'%'+_0x3691f2[_0xfcb0('0x39')][_0xfcb0('0x27')]+'%'};return _0x40a1bc;})});}_0x3bc22c[_0xfcb0('0xcb')]=db[_0xfcb0('0x2f')];_0x3bc22c['as']=_0xfcb0('0x7a');_0x3bc22c=_['merge']({},_0x3bc22c,_0x3691f2[_0xfcb0('0x4f')]);return _0x1a116d[_0xfcb0('0xf3')]({'include':[_0x3bc22c]});}})[_0xfcb0('0x1d')](function(_0x1da6e5){if(_0x1da6e5){var _0x48bf0b={},_0x28b95c=[];for(var _0x1009de=0x0;_0x1009de<_0x1da6e5[_0xfcb0('0x42')];_0x1009de+=0x1){for(var _0x373e17=0x0,_0x5383fb;_0x373e17<_0x1da6e5[_0x1009de]['Agents'][_0xfcb0('0x42')];_0x373e17+=0x1){_0x5383fb=_0x1da6e5[_0x1009de][_0xfcb0('0x7a')][_0x373e17][_0xfcb0('0x22')]({'plain':!![]});_0x48bf0b[_0x5383fb['id']]=_0x5383fb;}}_0x48bf0b=_[_0xfcb0('0x118')](_0x48bf0b);for(var _0x4c6dd0=qs[_0xfcb0('0x15')](_0x3691f2[_0xfcb0('0x39')][_0xfcb0('0x15')]);_0x4c6dd0<_0x48bf0b[_0xfcb0('0x42')]&&_0x28b95c[_0xfcb0('0x42')]=_0x1c1f09[_0x1944('0x4b')]){throw new Error(_0x1944('0x4c'));}})[_0x1944('0x16')](function(){if(_0x25e95d){return db[_0x1944('0x27')][_0x1944('0x44')]({'where':{'membername':_0x25e95d[_0x1944('0x21')]},'individualHooks':!![]});}})[_0x1944('0x16')](function(){if(_0x25e95d){return _0x25e95d[_0x1944('0x4d')]({'raw':!![]});}})[_0x1944('0x16')](function(_0x190c2f){if(_0x25e95d){if(_0x190c2f){var _0x432d36=[];_0x26ce6a=_0x190c2f;if(_0x26ce6a['length']){for(var _0x1f8e5a=0x0;_0x1f8e5a<_0x26ce6a['length'];_0x1f8e5a++){_0x432d36['push'](db['UserVoiceQueueRt']['upsert']({'membername':_0x25e95d[_0x1944('0x21')],'UserId':_0x25e95d['id'],'queue_name':_0x26ce6a[_0x1f8e5a][_0x1944('0x21')],'VoiceQueueId':_0x26ce6a[_0x1f8e5a]['id'],'interface':_0x45e50d,'paused':_0x25e95d[_0x1944('0x4e')]||![],'penalty':_0x26ce6a[_0x1f8e5a][_0x1944('0x4f')]||0x0}));}return BPromise[_0x1944('0x46')](_0x432d36);}}}})[_0x1944('0x16')](function(){if(_0x25e95d){return db['MemberReport'][_0x1944('0xf')]({'where':{'membername':_0x25e95d['name'],'exitAt':null}});}})[_0x1944('0x16')](function(_0x190d66){if(_0x25e95d){if(_0x190d66&&_0x190d66[_0x1944('0x2b')]){var _0x5d5106=[];_0x190d66[_0x1944('0x2f')](function(_0x1e989c){_0x5d5106['push'](_0x1e989c['update']({'exitAt':moment()[_0x1944('0x25')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x1944('0x46')](_0x5d5106);}}})[_0x1944('0x16')](function(){if(_0x25e95d){var _0x3fa012=[];var _0x424a97=[];var _0x4d397a=utils['getChannels']();var _0x37b1b8={'membername':_0x25e95d[_0x1944('0x21')],'interface':_0x45e50d,'enterAt':moment()[_0x1944('0x25')](_0x1944('0x2c')),'role':_0x25e95d[_0x1944('0x22')],'internal':_0x25e95d['internal']};_0x4d397a['forEach'](function(_0x3c9e55){_0x3fa012[_0x1944('0x45')](_[_0x1944('0x50')]({'channel':_0x3c9e55,'type':_0x1944('0x51'),'data1':_0x1944('0x52'),'data2':_0x45e50d},_0x37b1b8));if(_0x25e95d[_0x1944('0x4e')]){_0x424a97[_0x1944('0x45')](_[_0x1944('0x50')]({'channel':_0x3c9e55,'type':_0x1944('0x2a'),'data1':'LOGININPAUSE'},_0x37b1b8));}});return db[_0x1944('0x29')]['bulkCreate'](_0x3fa012[_0x1944('0x53')](_0x424a97),{'individualHooks':!![]});}})[_0x1944('0x16')](function(){if(_0x25e95d){return _0x25e95d[_0x1944('0x28')]({'online':!![],'lastLoginAt':moment()[_0x1944('0x25')](_0x1944('0x2c')),'voicePause':_0x25e95d[_0x1944('0x4e')]||![],'mailPause':_0x25e95d[_0x1944('0x4e')]||![],'chatPause':_0x25e95d['loginInPause']||![],'faxPause':_0x25e95d[_0x1944('0x4e')]||![],'smsPause':_0x25e95d[_0x1944('0x4e')]||![],'openchannelPause':_0x25e95d[_0x1944('0x4e')]||![],'pauseType':_0x25e95d['loginInPause']?_0x1944('0x54'):null,'lastPauseAt':moment()[_0x1944('0x25')](_0x1944('0x2c')),'interface':_0x45e50d});}})['then'](function(_0x2b05af){_0x59bb8c(_0x2b05af);})['catch'](function(_0x1a4b12){_0x2ad6b8(_0x2b7f18[_0x1944('0x1b')](0x1f4,_0x1a4b12['message']));});});}; \ No newline at end of file +var _0x482d=['../../config/logger','rpc','redis','defaults','localhost','socket.io-emitter','./user.socket','register','GetUser','User','findAll','options','where','attributes','map','include','model','then','info','debug','stringify','catch','error','message','ShowUser','raw','name','role','format','params','update','MemberReport','PAUSE','length','getChannels','push','interface','SIP/%s','body','type','DEFAULT\x20PAUSE','internal','uniqueid','bulkCreate','channel','isValidChannel','Channel\x20parameter\x20%s\x20is\x20invalid','online','faxPause','openchannelPause','smsPause','whatsappPause','lastPauseAt','User\x20with\x20id\x20%s\x20not\x20found','unpause','system','LogoutUser','UserVoiceQueueRt','destroy','forEach','YYYY-MM-DD\x20HH:mm:ss','all','LoginUser','mobile','phone','loginInPause','count','agent','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','getVoiceQueues','UserVoiceQueue.penalty','merge','LOGIN','LOGININPAUSE','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x5eb128,_0x52dbb8){var _0x457304=function(_0x3f2344){while(--_0x3f2344){_0x5eb128['push'](_0x5eb128['shift']());}};_0x457304(++_0x52dbb8);}(_0x482d,0x198));var _0xd482=function(_0x11b863,_0x1f76ac){_0x11b863=_0x11b863-0x0;var _0x8d52fc=_0x482d[_0x11b863];return _0x8d52fc;};'use strict';var _=require(_0xd482('0x0'));var util=require(_0xd482('0x1'));var moment=require(_0xd482('0x2'));var BPromise=require(_0xd482('0x3'));var Redis=require(_0xd482('0x4'));var db=require(_0xd482('0x5'))['db'];var utils=require(_0xd482('0x6'));var logger=require(_0xd482('0x7'))(_0xd482('0x8'));var config=require('../../config/environment');config[_0xd482('0x9')]=_[_0xd482('0xa')](config[_0xd482('0x9')],{'host':_0xd482('0xb'),'port':0x18eb});var socket=require(_0xd482('0xc'))(new Redis(config[_0xd482('0x9')]));require(_0xd482('0xd'))[_0xd482('0xe')](socket);exports[_0xd482('0xf')]=function(_0x153f34){var _0x4bc1ff=this;return new Promise(function(_0x15a32f,_0x4bd2d4){return db[_0xd482('0x10')][_0xd482('0x11')]({'raw':_0x153f34[_0xd482('0x12')]?_0x153f34[_0xd482('0x12')]['raw']===undefined?!![]:![]:!![],'where':_0x153f34[_0xd482('0x12')]?_0x153f34[_0xd482('0x12')][_0xd482('0x13')]||null:null,'attributes':_0x153f34[_0xd482('0x12')]?_0x153f34['options'][_0xd482('0x14')]||null:null,'limit':_0x153f34[_0xd482('0x12')]?_0x153f34['options']['limit']||null:null,'include':_0x153f34[_0xd482('0x12')]?_0x153f34[_0xd482('0x12')]['include']?_[_0xd482('0x15')](_0x153f34[_0xd482('0x12')][_0xd482('0x16')],function(_0x34b21f){return{'model':db[_0x34b21f['model']],'as':_0x34b21f['as'],'attributes':_0x34b21f['attributes'],'include':_0x34b21f['include']?_[_0xd482('0x15')](_0x34b21f[_0xd482('0x16')],function(_0x40c9d1){return{'model':db[_0x40c9d1[_0xd482('0x17')]],'as':_0x40c9d1['as'],'attributes':_0x40c9d1[_0xd482('0x14')],'include':_0x40c9d1[_0xd482('0x16')]?_['map'](_0x40c9d1[_0xd482('0x16')],function(_0x43f3d2){return{'model':db[_0x43f3d2[_0xd482('0x17')]],'as':_0x43f3d2['as'],'attributes':_0x43f3d2[_0xd482('0x14')]};}):[]};}):[]};}):[]:[]})[_0xd482('0x18')](function(_0x4854e7){logger[_0xd482('0x19')]('GetUser',_0x153f34);logger[_0xd482('0x1a')](_0xd482('0xf'),_0x153f34,JSON[_0xd482('0x1b')](_0x4854e7));_0x15a32f(_0x4854e7);})[_0xd482('0x1c')](function(_0x4fdee9){logger[_0xd482('0x1d')]('GetUser',_0x4fdee9[_0xd482('0x1e')],_0x153f34);_0x4bd2d4(_0x4bc1ff[_0xd482('0x1d')](0x1f4,_0x4fdee9['message']));});});};exports[_0xd482('0x1f')]=function(_0x21d7c9){var _0x1c1a87=this;return new Promise(function(_0x20d34b,_0x87017b){return db[_0xd482('0x10')]['find']({'raw':_0x21d7c9[_0xd482('0x12')]?_0x21d7c9[_0xd482('0x12')][_0xd482('0x20')]===undefined?!![]:![]:!![],'where':_0x21d7c9[_0xd482('0x12')]?_0x21d7c9[_0xd482('0x12')][_0xd482('0x13')]||null:null,'attributes':_0x21d7c9['options']?_0x21d7c9[_0xd482('0x12')][_0xd482('0x14')]||null:null,'include':_0x21d7c9[_0xd482('0x12')]?_0x21d7c9['options'][_0xd482('0x16')]?_[_0xd482('0x15')](_0x21d7c9['options'][_0xd482('0x16')],function(_0x47e8e){return{'model':db[_0x47e8e[_0xd482('0x17')]],'as':_0x47e8e['as'],'attributes':_0x47e8e[_0xd482('0x14')],'include':_0x47e8e[_0xd482('0x16')]?_[_0xd482('0x15')](_0x47e8e['include'],function(_0x286b3a){return{'model':db[_0x286b3a[_0xd482('0x17')]],'as':_0x286b3a['as'],'attributes':_0x286b3a[_0xd482('0x14')],'include':_0x286b3a['include']?_[_0xd482('0x15')](_0x286b3a['include'],function(_0x3d5afe){return{'model':db[_0x3d5afe[_0xd482('0x17')]],'as':_0x3d5afe['as'],'attributes':_0x3d5afe[_0xd482('0x14')]};}):[]};}):[]};}):[]:[]})[_0xd482('0x18')](function(_0x3756f5){logger[_0xd482('0x19')](_0xd482('0x1f'),_0x21d7c9);logger[_0xd482('0x1a')](_0xd482('0x1f'),_0x21d7c9,JSON[_0xd482('0x1b')](_0x3756f5));_0x20d34b(_0x3756f5);})['catch'](function(_0xb28102){logger[_0xd482('0x1d')](_0xd482('0x1f'),_0xb28102[_0xd482('0x1e')],_0x21d7c9);_0x87017b(_0x1c1a87[_0xd482('0x1d')](0x1f4,_0xb28102[_0xd482('0x1e')]));});});};exports['PauseUser']=function(_0x8cba79){var _0x59ba97;return db[_0xd482('0x10')]['find']({'where':_0x8cba79[_0xd482('0x12')][_0xd482('0x13')]||{},'attributes':['id',_0xd482('0x21'),_0xd482('0x22'),'internal','interface']})['then'](function(_0x35ae71){if(!_0x35ae71){throw new Error(util[_0xd482('0x23')]('User\x20with\x20id\x20%s\x20not\x20found',_0x8cba79[_0xd482('0x24')]['id']));}_0x59ba97=_0x35ae71;return db['UserVoiceQueueRt'][_0xd482('0x25')]({'paused':0x1},{'where':{'UserId':_0x59ba97['id']},'individualHooks':!![]});})[_0xd482('0x18')](function(){return db[_0xd482('0x26')][_0xd482('0x11')]({'where':{'membername':_0x59ba97[_0xd482('0x21')],'type':_0xd482('0x27'),'exitAt':null}});})[_0xd482('0x18')](function(_0x31a3dd){if(_0x31a3dd&&_0x31a3dd[_0xd482('0x28')]){var _0x32caa3=moment()[_0xd482('0x23')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x5aec4c=0x0,_0x317105=_0x31a3dd[_0xd482('0x28')];_0x5aec4c<_0x317105;_0x5aec4c++){_0x31a3dd[_0x5aec4c]['updateAttributes']({'exitAt':_0x32caa3});}}})[_0xd482('0x18')](function(){var _0x11385e=[];var _0x37a216=utils[_0xd482('0x29')]();_0x37a216['forEach'](function(_0x168def){_0x11385e[_0xd482('0x2a')]({'channel':_0x168def,'membername':_0x59ba97[_0xd482('0x21')],'interface':_['isNil'](_0x59ba97[_0xd482('0x2b')])?util[_0xd482('0x23')](_0xd482('0x2c'),_0x59ba97[_0xd482('0x21')]):_0x59ba97[_0xd482('0x2b')],'type':_0xd482('0x27'),'enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x8cba79[_0xd482('0x2d')][_0xd482('0x2e')]||_0xd482('0x2f'),'role':_0x59ba97[_0xd482('0x22')],'internal':_0x59ba97[_0xd482('0x30')],'uniqueid':_0x8cba79[_0xd482('0x2d')][_0xd482('0x31')]||null});});return db[_0xd482('0x26')][_0xd482('0x32')](_0x11385e,{'individualHooks':!![]});})[_0xd482('0x18')](function(){return _0x59ba97[_0xd482('0x25')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x8cba79[_0xd482('0x2d')][_0xd482('0x2e')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')});})[_0xd482('0x1c')](function(_0x40e0fa){throw _0x40e0fa;});};exports['UnpauseUser']=function(_0x43cc05){return Promise['resolve']()[_0xd482('0x18')](function(){if(_0x43cc05['body'][_0xd482('0x33')]&&!utils[_0xd482('0x34')](_0x43cc05[_0xd482('0x2d')]['channel'])){throw new Error(util['format'](_0xd482('0x35'),_0x43cc05[_0xd482('0x2d')]['channel']));}return db[_0xd482('0x10')]['findOne']({'where':_0x43cc05[_0xd482('0x12')][_0xd482('0x13')]||{},'attributes':['id',_0xd482('0x21'),_0xd482('0x22'),_0xd482('0x30'),_0xd482('0x2b'),_0xd482('0x36'),'voicePause','mailPause','chatPause',_0xd482('0x37'),_0xd482('0x38'),_0xd482('0x39'),_0xd482('0x3a'),'pauseType',_0xd482('0x3b')]});})[_0xd482('0x18')](function(_0xa03976){if(!_0xa03976){throw new Error(util['format'](_0xd482('0x3c'),_0x43cc05[_0xd482('0x24')]['id']));}return _0xa03976[_0xd482('0x3d')](_0x43cc05[_0xd482('0x2d')][_0xd482('0x33')],_0xd482('0x3e'));})[_0xd482('0x1c')](function(_0x3f85f8){throw _0x3f85f8;});};exports[_0xd482('0x3f')]=function(_0x22981d){var _0x91ab4e=this;return new Promise(function(_0x54e5c8,_0x29d922){var _0x3c19ac;return db['User']['findOne']({'where':_0x22981d['options'][_0xd482('0x13')]||{},'attributes':['id','name']})['then'](function(_0x23b4e1){if(_0x23b4e1){_0x3c19ac=_0x23b4e1;return db[_0xd482('0x40')][_0xd482('0x41')]({'where':{'membername':_0x3c19ac[_0xd482('0x21')]},'individualHooks':!![]});}})[_0xd482('0x18')](function(){if(_0x3c19ac){return db['MemberReport'][_0xd482('0x11')]({'where':{'membername':_0x3c19ac[_0xd482('0x21')],'exitAt':null}});}})[_0xd482('0x18')](function(_0x152a0b){if(_0x3c19ac){if(_0x152a0b&&_0x152a0b['length']){var _0x41236d=[];_0x152a0b[_0xd482('0x42')](function(_0x3dd19e){_0x41236d[_0xd482('0x2a')](_0x3dd19e[_0xd482('0x25')]({'exitAt':moment()['format'](_0xd482('0x43'))}));});return BPromise[_0xd482('0x44')](_0x41236d);}}})[_0xd482('0x18')](function(){if(_0x3c19ac){return _0x3c19ac['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0xd482('0x18')](function(_0x54c532){_0x54e5c8(_0x54c532);})[_0xd482('0x1c')](function(_0x2ccaf1){_0x29d922(_0x91ab4e['error'](0x1f4,_0x2ccaf1[_0xd482('0x1e')]));});});};exports[_0xd482('0x45')]=function(_0x489b6b){var _0x1b52f0=this;return new Promise(function(_0x4f6585,_0x57c744){var _0x1bfbc5;var _0x190c8b;var _0x15b3fa;var _0x27a535;return db[_0xd482('0x10')]['findOne']({'where':_0x489b6b[_0xd482('0x12')][_0xd482('0x13')]||{},'attributes':['id',_0xd482('0x21'),'role',_0xd482('0x46'),_0xd482('0x47'),'internal',_0xd482('0x48'),'interface']})[_0xd482('0x18')](function(_0x17e45f){if(_0x17e45f){_0x1bfbc5=_0x17e45f;_0x27a535=_0x489b6b[_0xd482('0x2d')][_0xd482('0x2b')]?_0x489b6b[_0xd482('0x2d')][_0xd482('0x2b')]:util[_0xd482('0x23')]('SIP/%s',_0x1bfbc5[_0xd482('0x21')]);return db[_0xd482('0x10')][_0xd482('0x49')]({'where':{'role':_0xd482('0x4a'),'online':!![],'id':{'$ne':_0x1bfbc5['id']}}});}})['then'](function(_0x3f6ecc){if(_0x3f6ecc){_0x15b3fa=_0x3f6ecc;return require('../../config/license/util')[_0xd482('0x4b')]();}})[_0xd482('0x18')](function(_0xafc7d5){if(_0xafc7d5&&_0xafc7d5[_0xd482('0x4c')]&&_0x15b3fa>=_0xafc7d5[_0xd482('0x4c')]){throw new Error(_0xd482('0x4d'));}})['then'](function(){if(_0x1bfbc5){return db[_0xd482('0x40')][_0xd482('0x41')]({'where':{'membername':_0x1bfbc5['name']},'individualHooks':!![]});}})['then'](function(){if(_0x1bfbc5){return _0x1bfbc5[_0xd482('0x4e')]({'raw':!![]});}})[_0xd482('0x18')](function(_0x112e6e){if(_0x1bfbc5){if(_0x112e6e){var _0x3ac270=[];_0x190c8b=_0x112e6e;if(_0x190c8b[_0xd482('0x28')]){for(var _0x5142b8=0x0;_0x5142b8<_0x190c8b['length'];_0x5142b8++){_0x3ac270[_0xd482('0x2a')](db['UserVoiceQueueRt']['upsert']({'membername':_0x1bfbc5[_0xd482('0x21')],'UserId':_0x1bfbc5['id'],'queue_name':_0x190c8b[_0x5142b8][_0xd482('0x21')],'VoiceQueueId':_0x190c8b[_0x5142b8]['id'],'interface':_0x27a535,'paused':_0x1bfbc5[_0xd482('0x48')]||![],'penalty':_0x190c8b[_0x5142b8][_0xd482('0x4f')]||0x0}));}return BPromise[_0xd482('0x44')](_0x3ac270);}}}})[_0xd482('0x18')](function(){if(_0x1bfbc5){return db[_0xd482('0x26')][_0xd482('0x11')]({'where':{'membername':_0x1bfbc5[_0xd482('0x21')],'exitAt':null}});}})[_0xd482('0x18')](function(_0x1fb320){if(_0x1bfbc5){if(_0x1fb320&&_0x1fb320[_0xd482('0x28')]){var _0x3d9891=[];_0x1fb320[_0xd482('0x42')](function(_0x50f754){_0x3d9891[_0xd482('0x2a')](_0x50f754['update']({'exitAt':moment()[_0xd482('0x23')](_0xd482('0x43'))}));});return BPromise[_0xd482('0x44')](_0x3d9891);}}})['then'](function(){if(_0x1bfbc5){var _0x743054=[];var _0x4bb16b=[];var _0x3c5f25=utils[_0xd482('0x29')]();var _0x270c9f={'membername':_0x1bfbc5[_0xd482('0x21')],'interface':_0x27a535,'enterAt':moment()[_0xd482('0x23')](_0xd482('0x43')),'role':_0x1bfbc5[_0xd482('0x22')],'internal':_0x1bfbc5[_0xd482('0x30')]};_0x3c5f25[_0xd482('0x42')](function(_0xae64e6){_0x743054[_0xd482('0x2a')](_[_0xd482('0x50')]({'channel':_0xae64e6,'type':_0xd482('0x51'),'data1':'callysquare','data2':_0x27a535},_0x270c9f));if(_0x1bfbc5['loginInPause']){_0x4bb16b[_0xd482('0x2a')](_[_0xd482('0x50')]({'channel':_0xae64e6,'type':_0xd482('0x27'),'data1':'LOGININPAUSE'},_0x270c9f));}});return db[_0xd482('0x26')][_0xd482('0x32')](_0x743054['concat'](_0x4bb16b),{'individualHooks':!![]});}})[_0xd482('0x18')](function(){if(_0x1bfbc5){return _0x1bfbc5['update']({'online':!![],'lastLoginAt':moment()[_0xd482('0x23')](_0xd482('0x43')),'voicePause':_0x1bfbc5['loginInPause']||![],'mailPause':_0x1bfbc5[_0xd482('0x48')]||![],'chatPause':_0x1bfbc5['loginInPause']||![],'faxPause':_0x1bfbc5[_0xd482('0x48')]||![],'smsPause':_0x1bfbc5[_0xd482('0x48')]||![],'openchannelPause':_0x1bfbc5['loginInPause']||![],'pauseType':_0x1bfbc5['loginInPause']?_0xd482('0x52'):null,'lastPauseAt':moment()[_0xd482('0x23')](_0xd482('0x43')),'interface':_0x27a535});}})[_0xd482('0x18')](function(_0x17915d){_0x4f6585(_0x17915d);})[_0xd482('0x1c')](function(_0x4bae88){_0x57c744(_0x1b52f0[_0xd482('0x1d')](0x1f4,_0x4bae88[_0xd482('0x1e')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 9e0b5c0..a843974 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 _0x748b=['emit','removeListener','register','length','user:','./user.events','save','remove'];(function(_0x2f479d,_0x1d6836){var _0x300d48=function(_0x338a74){while(--_0x338a74){_0x2f479d['push'](_0x2f479d['shift']());}};_0x300d48(++_0x1d6836);}(_0x748b,0x17d));var _0xb748=function(_0x1592fe,_0x42c73c){_0x1592fe=_0x1592fe-0x0;var _0x33fd01=_0x748b[_0x1592fe];return _0x33fd01;};'use strict';var UserEvents=require(_0xb748('0x0'));var events=[_0xb748('0x1'),_0xb748('0x2'),'update'];function createListener(_0x36639d,_0x390249){return function(_0x30dadd){_0x390249[_0xb748('0x3')](_0x36639d,_0x30dadd);};}function removeListener(_0x555e2d,_0x39cca5){return function(){UserEvents[_0xb748('0x4')](_0x555e2d,_0x39cca5);};}exports[_0xb748('0x5')]=function(_0x4bbc49){for(var _0x44fcb3=0x0,_0xe42e6b=events[_0xb748('0x6')];_0x44fcb3<_0xe42e6b;_0x44fcb3++){var _0x36c713=events[_0x44fcb3];var _0x103e26=createListener(_0xb748('0x7')+_0x36c713,_0x4bbc49);UserEvents['on'](_0x36c713,_0x103e26);}}; \ No newline at end of file +var _0xe114=['length','./user.events','save','remove','update','removeListener'];(function(_0x3c45b4,_0x1941cf){var _0x73361f=function(_0x1ab007){while(--_0x1ab007){_0x3c45b4['push'](_0x3c45b4['shift']());}};_0x73361f(++_0x1941cf);}(_0xe114,0x199));var _0x4e11=function(_0x323a54,_0x273b61){_0x323a54=_0x323a54-0x0;var _0x48ad04=_0xe114[_0x323a54];return _0x48ad04;};'use strict';var UserEvents=require(_0x4e11('0x0'));var events=[_0x4e11('0x1'),_0x4e11('0x2'),_0x4e11('0x3')];function createListener(_0x5501e6,_0xefaf9e){return function(_0x4415d2){_0xefaf9e['emit'](_0x5501e6,_0x4415d2);};}function removeListener(_0x579f44,_0xac8236){return function(){UserEvents[_0x4e11('0x4')](_0x579f44,_0xac8236);};}exports['register']=function(_0x2fc7ee){for(var _0x36baa8=0x0,_0x1179b0=events[_0x4e11('0x5')];_0x36baa8<_0x1179b0;_0x36baa8++){var _0x660368=events[_0x36baa8];var _0x243f41=createListener('user:'+_0x660368,_0x2fc7ee);UserEvents['on'](_0x660368,_0x243f41);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 7b3ad48..c2f0041 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x571a17,_0x63fb3d){var _0x3ef337=function(_0x12096b){while(--_0x12096b){_0x571a17['push'](_0x571a17['shift']());}};_0x3ef337(++_0x63fb3d);}(_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'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0xb50e8b,_0x2272b4){var _0x53af14=function(_0x27483b){while(--_0x27483b){_0xb50e8b['push'](_0xb50e8b['shift']());}};_0x53af14(++_0x2272b4);}(_0xe706,0xa3));var _0x6e70=function(_0x25aaec,_0x159e5b){_0x25aaec=_0x25aaec-0x0;var _0x293c2f=_0xe706[_0x25aaec];return _0x293c2f;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 7ad05fe..f21ace0 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 _0xd814=['exports'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xd814,0x187));var _0x4d81=function(_0x3e7875,_0x35bddb){_0x3e7875=_0x3e7875-0x0;var _0x408227=_0xd814[_0x3e7875];return _0x408227;};'use strict';var Sequelize=require('sequelize');module[_0x4d81('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x8412=['exports','sequelize'];(function(_0x169790,_0x48aa33){var _0x4d0f36=function(_0x2a848d){while(--_0x2a848d){_0x169790['push'](_0x169790['shift']());}};_0x4d0f36(++_0x48aa33);}(_0x8412,0xdf));var _0x2841=function(_0x5471ec,_0x1ce81a){_0x5471ec=_0x5471ec-0x0;var _0x121d4c=_0x8412[_0x5471ec];return _0x121d4c;};'use strict';var Sequelize=require(_0x2841('0x0'));module[_0x2841('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index be8c9a0..bc1275d 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 _0xcce3=['lodash','../../config/logger','api','moment','bluebird','../../config/environment','exports','define','UserChatQueue'];(function(_0x1057a3,_0x28d9b7){var _0x131cdb=function(_0x47a386){while(--_0x47a386){_0x1057a3['push'](_0x1057a3['shift']());}};_0x131cdb(++_0x28d9b7);}(_0xcce3,0x18c));var _0x3cce=function(_0x33154d,_0x854047){_0x33154d=_0x33154d-0x0;var _0x3b2f03=_0xcce3[_0x33154d];return _0x3b2f03;};'use strict';var _=require(_0x3cce('0x0'));var util=require('util');var logger=require(_0x3cce('0x1'))(_0x3cce('0x2'));var moment=require(_0x3cce('0x3'));var BPromise=require(_0x3cce('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3cce('0x5'));var attributes=require('./userChatQueue.attributes');module[_0x3cce('0x6')]=function(_0x5dc817,_0x334f41){return _0x5dc817[_0x3cce('0x7')](_0x3cce('0x8'),attributes,{'tableName':'user_has_chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdc39=['bluebird','path','../../config/environment','./userChatQueue.attributes','user_has_chat_queues','util','../../config/logger','moment'];(function(_0xc86912,_0x5eb4e9){var _0x5d6b9f=function(_0x5d4037){while(--_0x5d4037){_0xc86912['push'](_0xc86912['shift']());}};_0x5d6b9f(++_0x5eb4e9);}(_0xdc39,0x65));var _0x9dc3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdc39[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x9dc3('0x0'));var logger=require(_0x9dc3('0x1'))('api');var moment=require(_0x9dc3('0x2'));var BPromise=require(_0x9dc3('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9dc3('0x4'));var rimraf=require('rimraf');var config=require(_0x9dc3('0x5'));var attributes=require(_0x9dc3('0x6'));module['exports']=function(_0x3c7ccf,_0x533f1e){return _0x3c7ccf['define']('UserChatQueue',attributes,{'tableName':_0x9dc3('0x7'),'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 633ad8d..dec5554 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 _0x6dde=['../../config/logger','rpc','../../config/environment','jayson/promise','request','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','UserChatQueue,\x20%s,\x20%s','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x170994,_0x5adc66){var _0x3c89a3=function(_0x53e7e1){while(--_0x53e7e1){_0x170994['push'](_0x170994['shift']());}};_0x3c89a3(++_0x5adc66);}(_0x6dde,0x173));var _0xe6dd=function(_0x47dff4,_0x1ea937){_0x47dff4=_0x47dff4-0x0;var _0x5c17d0=_0x6dde[_0x47dff4];return _0x5c17d0;};'use strict';var _=require(_0xe6dd('0x0'));var util=require(_0xe6dd('0x1'));var moment=require(_0xe6dd('0x2'));var BPromise=require(_0xe6dd('0x3'));var rs=require(_0xe6dd('0x4'));var fs=require('fs');var Redis=require(_0xe6dd('0x5'));var db=require(_0xe6dd('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xe6dd('0x7'))(_0xe6dd('0x8'));var config=require(_0xe6dd('0x9'));var jayson=require(_0xe6dd('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4c5574,_0x469d08,_0x2a7de5){return new BPromise(function(_0x5b85ed,_0xcc7485){return client[_0xe6dd('0xb')](_0x4c5574,_0x2a7de5)['then'](function(_0x386f30){logger['info']('UserChatQueue,\x20%s,\x20%s',_0x469d08,_0xe6dd('0xc'));logger[_0xe6dd('0xd')](_0xe6dd('0xe'),_0x469d08,_0xe6dd('0xc'),JSON[_0xe6dd('0xf')](_0x386f30));if(_0x386f30[_0xe6dd('0x10')]){if(_0x386f30[_0xe6dd('0x10')][_0xe6dd('0x11')]===0x1f4){logger[_0xe6dd('0x10')]('UserChatQueue,\x20%s,\x20%s',_0x469d08,_0x386f30[_0xe6dd('0x10')][_0xe6dd('0x12')]);return _0xcc7485(_0x386f30[_0xe6dd('0x10')][_0xe6dd('0x12')]);}logger[_0xe6dd('0x10')](_0xe6dd('0x13'),_0x469d08,_0x386f30['error'][_0xe6dd('0x12')]);return _0x5b85ed(_0x386f30[_0xe6dd('0x10')][_0xe6dd('0x12')]);}else{logger['info'](_0xe6dd('0x13'),_0x469d08,_0xe6dd('0xc'));_0x5b85ed(_0x386f30[_0xe6dd('0x14')][_0xe6dd('0x12')]);}})['catch'](function(_0x59a191){logger[_0xe6dd('0x10')](_0xe6dd('0x13'),_0x469d08,_0x59a191);_0xcc7485(_0x59a191);});});} \ No newline at end of file +var _0xce38=['request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','http','request','then','info','UserChatQueue,\x20%s,\x20%s'];(function(_0x440bf6,_0x31e6d9){var _0x2c0a6c=function(_0x19f22b){while(--_0x19f22b){_0x440bf6['push'](_0x440bf6['shift']());}};_0x2c0a6c(++_0x31e6d9);}(_0xce38,0x1a1));var _0x8ce3=function(_0x2a3b70,_0x137f86){_0x2a3b70=_0x2a3b70-0x0;var _0x376380=_0xce38[_0x2a3b70];return _0x376380;};'use strict';var _=require(_0x8ce3('0x0'));var util=require(_0x8ce3('0x1'));var moment=require(_0x8ce3('0x2'));var BPromise=require(_0x8ce3('0x3'));var rs=require(_0x8ce3('0x4'));var fs=require('fs');var Redis=require(_0x8ce3('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x8ce3('0x6'));var logger=require(_0x8ce3('0x7'))(_0x8ce3('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8ce3('0x9')][_0x8ce3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x17dde3,_0x4a5323,_0x1de3ba){return new BPromise(function(_0x5d8133,_0x171429){return client[_0x8ce3('0xb')](_0x17dde3,_0x1de3ba)[_0x8ce3('0xc')](function(_0x2cd060){logger[_0x8ce3('0xd')](_0x8ce3('0xe'),_0x4a5323,_0x8ce3('0xf'));logger[_0x8ce3('0x10')](_0x8ce3('0x11'),_0x4a5323,_0x8ce3('0xf'),JSON[_0x8ce3('0x12')](_0x2cd060));if(_0x2cd060[_0x8ce3('0x13')]){if(_0x2cd060[_0x8ce3('0x13')][_0x8ce3('0x14')]===0x1f4){logger[_0x8ce3('0x13')]('UserChatQueue,\x20%s,\x20%s',_0x4a5323,_0x2cd060[_0x8ce3('0x13')][_0x8ce3('0x15')]);return _0x171429(_0x2cd060[_0x8ce3('0x13')][_0x8ce3('0x15')]);}logger[_0x8ce3('0x13')](_0x8ce3('0xe'),_0x4a5323,_0x2cd060['error'][_0x8ce3('0x15')]);return _0x5d8133(_0x2cd060[_0x8ce3('0x13')][_0x8ce3('0x15')]);}else{logger[_0x8ce3('0xd')](_0x8ce3('0xe'),_0x4a5323,_0x8ce3('0xf'));_0x5d8133(_0x2cd060[_0x8ce3('0x16')][_0x8ce3('0x15')]);}})[_0x8ce3('0x17')](function(_0x300214){logger[_0x8ce3('0x13')](_0x8ce3('0xe'),_0x4a5323,_0x300214);_0x171429(_0x300214);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index c816386..46552e6 100644 --- a/server/api/userFaxQueue/index.js +++ b/server/api/userFaxQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x3e8092,_0x5247db){var _0x56a2b5=function(_0x47c4d4){while(--_0x47c4d4){_0x3e8092['push'](_0x3e8092['shift']());}};_0x56a2b5(++_0x5247db);}(_0xedd9,0xfc));var _0x9edd=function(_0x116246,_0x2dfa41){_0x116246=_0x116246-0x0;var _0x439ddd=_0xedd9[_0x116246];return _0x439ddd;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x3ec5ab,_0x17b398){var _0x39e35e=function(_0x30d8a5){while(--_0x30d8a5){_0x3ec5ab['push'](_0x3ec5ab['shift']());}};_0x39e35e(++_0x17b398);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index e98114f..2399947 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 _0xc39d=['exports','INTEGER','sequelize'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xc39d,0x1b5));var _0xdc39=function(_0x5e85da,_0x16c15b){_0x5e85da=_0x5e85da-0x0;var _0x3117e1=_0xc39d[_0x5e85da];return _0x3117e1;};'use strict';var Sequelize=require(_0xdc39('0x0'));module[_0xdc39('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xdc39('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6890=['sequelize','exports','INTEGER','STRING'];(function(_0x55a802,_0x10ab3a){var _0x1a0461=function(_0x43d162){while(--_0x43d162){_0x55a802['push'](_0x55a802['shift']());}};_0x1a0461(++_0x10ab3a);}(_0x6890,0xfc));var _0x0689=function(_0x214c64,_0x3b91ac){_0x214c64=_0x214c64-0x0;var _0x2c7b20=_0x6890[_0x214c64];return _0x2c7b20;};'use strict';var Sequelize=require(_0x0689('0x0'));module[_0x0689('0x1')]={'penalty':{'type':Sequelize[_0x0689('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x0689('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x0689('0x3')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 58b25dd..0897a44 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 _0xb5cf=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','UserFaxQueue','user_has_fax_queues','lodash'];(function(_0x33cbcc,_0x4f4748){var _0x3cf3f8=function(_0xcc296c){while(--_0xcc296c){_0x33cbcc['push'](_0x33cbcc['shift']());}};_0x3cf3f8(++_0x4f4748);}(_0xb5cf,0x1df));var _0xfb5c=function(_0x787120,_0x2de4ac){_0x787120=_0x787120-0x0;var _0x49e40b=_0xb5cf[_0x787120];return _0x49e40b;};'use strict';var _=require(_0xfb5c('0x0'));var util=require('util');var logger=require(_0xfb5c('0x1'))('api');var moment=require(_0xfb5c('0x2'));var BPromise=require(_0xfb5c('0x3'));var rp=require(_0xfb5c('0x4'));var fs=require('fs');var path=require(_0xfb5c('0x5'));var rimraf=require(_0xfb5c('0x6'));var config=require(_0xfb5c('0x7'));var attributes=require('./userFaxQueue.attributes');module[_0xfb5c('0x8')]=function(_0x3a76b4,_0x58d76e){return _0x3a76b4[_0xfb5c('0x9')](_0xfb5c('0xa'),attributes,{'tableName':_0xfb5c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1bf2=['../../config/environment','exports','define','UserFaxQueue','user_has_fax_queues','lodash','../../config/logger','bluebird','request-promise','path','rimraf'];(function(_0x22e3ed,_0x3eb095){var _0x9213e8=function(_0x4278dd){while(--_0x4278dd){_0x22e3ed['push'](_0x22e3ed['shift']());}};_0x9213e8(++_0x3eb095);}(_0x1bf2,0x165));var _0x21bf=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0x1bf2[_0xd1d19a];return _0x52a79d;};'use strict';var _=require(_0x21bf('0x0'));var util=require('util');var logger=require(_0x21bf('0x1'))('api');var moment=require('moment');var BPromise=require(_0x21bf('0x2'));var rp=require(_0x21bf('0x3'));var fs=require('fs');var path=require(_0x21bf('0x4'));var rimraf=require(_0x21bf('0x5'));var config=require(_0x21bf('0x6'));var attributes=require('./userFaxQueue.attributes');module[_0x21bf('0x7')]=function(_0x29a331,_0xa5e3a4){return _0x29a331[_0x21bf('0x8')](_0x21bf('0x9'),attributes,{'tableName':_0x21bf('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.rpc.js b/server/api/userFaxQueue/userFaxQueue.rpc.js index b5a806b..aad1cf6 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 _0x0489=['info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x57a3b8,_0x594e42){var _0x548353=function(_0x4132df){while(--_0x4132df){_0x57a3b8['push'](_0x57a3b8['shift']());}};_0x548353(++_0x594e42);}(_0x0489,0x13e));var _0x9048=function(_0x310a1b,_0x4c9129){_0x310a1b=_0x310a1b-0x0;var _0xdea206=_0x0489[_0x310a1b];return _0xdea206;};'use strict';var _=require(_0x9048('0x0'));var util=require(_0x9048('0x1'));var moment=require(_0x9048('0x2'));var BPromise=require('bluebird');var rs=require(_0x9048('0x3'));var fs=require('fs');var Redis=require(_0x9048('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x9048('0x5'))(_0x9048('0x6'));var config=require(_0x9048('0x7'));var jayson=require(_0x9048('0x8'));var client=jayson[_0x9048('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1418aa,_0x3690cb,_0x1e9c72){return new BPromise(function(_0x1ed7ed,_0x3385d2){return client[_0x9048('0xa')](_0x1418aa,_0x1e9c72)[_0x9048('0xb')](function(_0x12879c){logger[_0x9048('0xc')](_0x9048('0xd'),_0x3690cb,_0x9048('0xe'));logger[_0x9048('0xf')]('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x3690cb,_0x9048('0xe'),JSON[_0x9048('0x10')](_0x12879c));if(_0x12879c[_0x9048('0x11')]){if(_0x12879c['error'][_0x9048('0x12')]===0x1f4){logger[_0x9048('0x11')](_0x9048('0xd'),_0x3690cb,_0x12879c[_0x9048('0x11')]['message']);return _0x3385d2(_0x12879c[_0x9048('0x11')][_0x9048('0x13')]);}logger[_0x9048('0x11')](_0x9048('0xd'),_0x3690cb,_0x12879c[_0x9048('0x11')][_0x9048('0x13')]);return _0x1ed7ed(_0x12879c['error']['message']);}else{logger[_0x9048('0xc')](_0x9048('0xd'),_0x3690cb,_0x9048('0xe'));_0x1ed7ed(_0x12879c[_0x9048('0x14')][_0x9048('0x13')]);}})[_0x9048('0x15')](function(_0x4b40d9){logger['error'](_0x9048('0xd'),_0x3690cb,_0x4b40d9);_0x3385d2(_0x4b40d9);});});} \ No newline at end of file +var _0xba6e=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','UserFaxQueue,\x20%s,\x20%s','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','lodash','util','moment'];(function(_0x5143b7,_0x414ceb){var _0x4960a4=function(_0x5ac96a){while(--_0x5ac96a){_0x5143b7['push'](_0x5143b7['shift']());}};_0x4960a4(++_0x414ceb);}(_0xba6e,0x105));var _0xeba6=function(_0x5928e1,_0xca2bf0){_0x5928e1=_0x5928e1-0x0;var _0xe11fb9=_0xba6e[_0x5928e1];return _0xe11fb9;};'use strict';var _=require(_0xeba6('0x0'));var util=require(_0xeba6('0x1'));var moment=require(_0xeba6('0x2'));var BPromise=require(_0xeba6('0x3'));var rs=require(_0xeba6('0x4'));var fs=require('fs');var Redis=require(_0xeba6('0x5'));var db=require(_0xeba6('0x6'))['db'];var utils=require(_0xeba6('0x7'));var logger=require(_0xeba6('0x8'))(_0xeba6('0x9'));var config=require(_0xeba6('0xa'));var jayson=require('jayson/promise');var client=jayson['client'][_0xeba6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5aba13,_0x453dd9,_0x3173af){return new BPromise(function(_0x94b784,_0x56de6c){return client[_0xeba6('0xc')](_0x5aba13,_0x3173af)[_0xeba6('0xd')](function(_0x11e6ac){logger['info'](_0xeba6('0xe'),_0x453dd9,'request\x20sent');logger[_0xeba6('0xf')](_0xeba6('0x10'),_0x453dd9,_0xeba6('0x11'),JSON[_0xeba6('0x12')](_0x11e6ac));if(_0x11e6ac[_0xeba6('0x13')]){if(_0x11e6ac[_0xeba6('0x13')]['code']===0x1f4){logger[_0xeba6('0x13')]('UserFaxQueue,\x20%s,\x20%s',_0x453dd9,_0x11e6ac[_0xeba6('0x13')][_0xeba6('0x14')]);return _0x56de6c(_0x11e6ac['error'][_0xeba6('0x14')]);}logger[_0xeba6('0x13')]('UserFaxQueue,\x20%s,\x20%s',_0x453dd9,_0x11e6ac['error']['message']);return _0x94b784(_0x11e6ac['error'][_0xeba6('0x14')]);}else{logger[_0xeba6('0x15')](_0xeba6('0xe'),_0x453dd9,'request\x20sent');_0x94b784(_0x11e6ac[_0xeba6('0x16')][_0xeba6('0x14')]);}})[_0xeba6('0x17')](function(_0x81a6dd){logger[_0xeba6('0x13')](_0xeba6('0xe'),_0x453dd9,_0x81a6dd);_0x56de6c(_0x81a6dd);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index a791ffd..38db19c 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(_0x626dfd,_0x474a92){var _0xf03ec7=function(_0x4ec674){while(--_0x4ec674){_0x626dfd['push'](_0x626dfd['shift']());}};_0xf03ec7(++_0x474a92);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x29e35f,_0x4859ef){_0x29e35f=_0x29e35f-0x0;var _0x266b74=_0xcb91[_0x29e35f];return _0x266b74;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x99ee48,_0x30eaf3){var _0x44c023=function(_0x231bea){while(--_0x231bea){_0x99ee48['push'](_0x99ee48['shift']());}};_0x44c023(++_0x30eaf3);}(_0x70e0,0x17b));var _0x070e=function(_0x219651,_0x581d7a){_0x219651=_0x219651-0x0;var _0x1fc917=_0x70e0[_0x219651];return _0x1fc917;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index d57e955..c32736a 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 _0xe5b6=['sequelize','exports','INTEGER'];(function(_0x2ee72f,_0x270619){var _0x2c9194=function(_0x1b9888){while(--_0x1b9888){_0x2ee72f['push'](_0x2ee72f['shift']());}};_0x2c9194(++_0x270619);}(_0xe5b6,0xc3));var _0x6e5b=function(_0x4afa32,_0x48d611){_0x4afa32=_0x4afa32-0x0;var _0x14535f=_0xe5b6[_0x4afa32];return _0x14535f;};'use strict';var Sequelize=require(_0x6e5b('0x0'));module[_0x6e5b('0x1')]={'penalty':{'type':Sequelize[_0x6e5b('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x74d6=['sequelize','exports','INTEGER'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x74d6,0xc9));var _0x674d=function(_0x34c716,_0x1c15f9){_0x34c716=_0x34c716-0x0;var _0x5c120a=_0x74d6[_0x34c716];return _0x5c120a;};'use strict';var Sequelize=require(_0x674d('0x0'));module[_0x674d('0x1')]={'penalty':{'type':Sequelize[_0x674d('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index 4244077..e6f3e18 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 _0x4e05=['bluebird','request-promise','path','rimraf','./userMailQueue.attributes','exports','define','UserMailQueue','user_has_mail_queues','util','../../config/logger','moment'];(function(_0x1778e1,_0x3e1727){var _0x2bc4c6=function(_0x359c65){while(--_0x359c65){_0x1778e1['push'](_0x1778e1['shift']());}};_0x2bc4c6(++_0x3e1727);}(_0x4e05,0x14d));var _0x54e0=function(_0x1909e1,_0x53667a){_0x1909e1=_0x1909e1-0x0;var _0x560761=_0x4e05[_0x1909e1];return _0x560761;};'use strict';var _=require('lodash');var util=require(_0x54e0('0x0'));var logger=require(_0x54e0('0x1'))('api');var moment=require(_0x54e0('0x2'));var BPromise=require(_0x54e0('0x3'));var rp=require(_0x54e0('0x4'));var fs=require('fs');var path=require(_0x54e0('0x5'));var rimraf=require(_0x54e0('0x6'));var config=require('../../config/environment');var attributes=require(_0x54e0('0x7'));module[_0x54e0('0x8')]=function(_0x1fee52,_0x16bf56){return _0x1fee52[_0x54e0('0x9')](_0x54e0('0xa'),attributes,{'tableName':_0x54e0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x497a=['rimraf','../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue','user_has_mail_queues','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x3c203c,_0x1d236b){var _0x563942=function(_0xae459e){while(--_0xae459e){_0x3c203c['push'](_0x3c203c['shift']());}};_0x563942(++_0x1d236b);}(_0x497a,0x125));var _0xa497=function(_0x4b2436,_0x452299){_0x4b2436=_0x4b2436-0x0;var _0x4f5ab2=_0x497a[_0x4b2436];return _0x4f5ab2;};'use strict';var _=require(_0xa497('0x0'));var util=require(_0xa497('0x1'));var logger=require(_0xa497('0x2'))(_0xa497('0x3'));var moment=require('moment');var BPromise=require(_0xa497('0x4'));var rp=require(_0xa497('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa497('0x6'));var config=require(_0xa497('0x7'));var attributes=require(_0xa497('0x8'));module[_0xa497('0x9')]=function(_0x912bd8,_0x5b12c0){return _0x912bd8[_0xa497('0xa')](_0xa497('0xb'),attributes,{'tableName':_0xa497('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index 68f8a66..915149c 100644 --- a/server/api/userMailQueue/userMailQueue.rpc.js +++ b/server/api/userMailQueue/userMailQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa41a=['rpc','../../config/environment','client','http','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x38e49e,_0x5c79a8){var _0x3ed711=function(_0x4a8069){while(--_0x4a8069){_0x38e49e['push'](_0x38e49e['shift']());}};_0x3ed711(++_0x5c79a8);}(_0xa41a,0x6b));var _0xaa41=function(_0x554590,_0x57a28c){_0x554590=_0x554590-0x0;var _0xfd486a=_0xa41a[_0x554590];return _0xfd486a;};'use strict';var _=require(_0xaa41('0x0'));var util=require(_0xaa41('0x1'));var moment=require('moment');var BPromise=require(_0xaa41('0x2'));var rs=require(_0xaa41('0x3'));var fs=require('fs');var Redis=require(_0xaa41('0x4'));var db=require(_0xaa41('0x5'))['db'];var utils=require(_0xaa41('0x6'));var logger=require(_0xaa41('0x7'))(_0xaa41('0x8'));var config=require(_0xaa41('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xaa41('0xa')][_0xaa41('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x54bc5a,_0x5b1fff,_0x179545){return new BPromise(function(_0x202cce,_0x588ab4){return client[_0xaa41('0xc')](_0x54bc5a,_0x179545)[_0xaa41('0xd')](function(_0x409dab){logger[_0xaa41('0xe')](_0xaa41('0xf'),_0x5b1fff,_0xaa41('0x10'));logger[_0xaa41('0x11')](_0xaa41('0x12'),_0x5b1fff,_0xaa41('0x10'),JSON['stringify'](_0x409dab));if(_0x409dab[_0xaa41('0x13')]){if(_0x409dab[_0xaa41('0x13')]['code']===0x1f4){logger['error'](_0xaa41('0xf'),_0x5b1fff,_0x409dab['error'][_0xaa41('0x14')]);return _0x588ab4(_0x409dab[_0xaa41('0x13')][_0xaa41('0x14')]);}logger[_0xaa41('0x13')](_0xaa41('0xf'),_0x5b1fff,_0x409dab['error'][_0xaa41('0x14')]);return _0x202cce(_0x409dab[_0xaa41('0x13')][_0xaa41('0x14')]);}else{logger[_0xaa41('0xe')](_0xaa41('0xf'),_0x5b1fff,_0xaa41('0x10'));_0x202cce(_0x409dab[_0xaa41('0x15')]['message']);}})[_0xaa41('0x16')](function(_0x16b930){logger[_0xaa41('0x13')](_0xaa41('0xf'),_0x5b1fff,_0x16b930);_0x588ab4(_0x16b930);});});} \ No newline at end of file +var _0x4b84=['../../config/logger','rpc','http','then','info','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','UserMailQueue,\x20%s,\x20%s','message','lodash','util','randomstring','../../config/utils'];(function(_0x3d3545,_0x42b645){var _0x141327=function(_0x4055e0){while(--_0x4055e0){_0x3d3545['push'](_0x3d3545['shift']());}};_0x141327(++_0x42b645);}(_0x4b84,0x1cc));var _0x44b8=function(_0x333fc8,_0x2b292c){_0x333fc8=_0x333fc8-0x0;var _0x432439=_0x4b84[_0x333fc8];return _0x432439;};'use strict';var _=require(_0x44b8('0x0'));var util=require(_0x44b8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x44b8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x44b8('0x3'));var logger=require(_0x44b8('0x4'))(_0x44b8('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x44b8('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x54274b,_0x327f59,_0x5947f7){return new BPromise(function(_0x3e87c5,_0x5a2353){return client['request'](_0x54274b,_0x5947f7)[_0x44b8('0x7')](function(_0x42319d){logger[_0x44b8('0x8')]('UserMailQueue,\x20%s,\x20%s',_0x327f59,_0x44b8('0x9'));logger[_0x44b8('0xa')](_0x44b8('0xb'),_0x327f59,_0x44b8('0x9'),JSON[_0x44b8('0xc')](_0x42319d));if(_0x42319d[_0x44b8('0xd')]){if(_0x42319d[_0x44b8('0xd')]['code']===0x1f4){logger[_0x44b8('0xd')](_0x44b8('0xe'),_0x327f59,_0x42319d['error'][_0x44b8('0xf')]);return _0x5a2353(_0x42319d['error'][_0x44b8('0xf')]);}logger[_0x44b8('0xd')]('UserMailQueue,\x20%s,\x20%s',_0x327f59,_0x42319d[_0x44b8('0xd')]['message']);return _0x3e87c5(_0x42319d['error'][_0x44b8('0xf')]);}else{logger[_0x44b8('0x8')](_0x44b8('0xe'),_0x327f59,_0x44b8('0x9'));_0x3e87c5(_0x42319d['result']['message']);}})['catch'](function(_0x3fe9fb){logger['error'](_0x44b8('0xe'),_0x327f59,_0x3fe9fb);_0x5a2353(_0x3fe9fb);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 10310a9..abb5b6d 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 _0x3841=['./userNotification.controller','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x51f99e,_0x70684d){var _0x5b12cd=function(_0xb3679){while(--_0xb3679){_0x51f99e['push'](_0x51f99e['shift']());}};_0x5b12cd(++_0x70684d);}(_0x3841,0x141));var _0x1384=function(_0x3c04d7,_0x472801){_0x3c04d7=_0x3c04d7-0x0;var _0x2fb24=_0x3841[_0x3c04d7];return _0x2fb24;};'use strict';var multer=require(_0x1384('0x0'));var util=require(_0x1384('0x1'));var path=require(_0x1384('0x2'));var timeout=require(_0x1384('0x3'));var express=require(_0x1384('0x4'));var router=express[_0x1384('0x5')]();var fs_extra=require(_0x1384('0x6'));var auth=require(_0x1384('0x7'));var interaction=require(_0x1384('0x8'));var config=require('../../config/environment');var controller=require(_0x1384('0x9'));router['post']('/',auth['isAuthenticated'](),controller['sendUserNotification']);module['exports']=router; \ No newline at end of file +var _0x2620=['./userNotification.controller','post','isAuthenticated','sendUserNotification','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x426b63,_0x3b4c07){var _0x1adcc0=function(_0x638c80){while(--_0x638c80){_0x426b63['push'](_0x426b63['shift']());}};_0x1adcc0(++_0x3b4c07);}(_0x2620,0x161));var _0x0262=function(_0x11155f,_0x57b687){_0x11155f=_0x11155f-0x0;var _0xd07e48=_0x2620[_0x11155f];return _0xd07e48;};'use strict';var multer=require(_0x0262('0x0'));var util=require('util');var path=require(_0x0262('0x1'));var timeout=require(_0x0262('0x2'));var express=require(_0x0262('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x0262('0x4'));var interaction=require(_0x0262('0x5'));var config=require(_0x0262('0x6'));var controller=require(_0x0262('0x7'));router[_0x0262('0x8')]('/',auth[_0x0262('0x9')](),controller[_0x0262('0xa')]);module[_0x0262('0xb')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index c7f595c..5c8ee3c 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 _0x8311=['STRING','BOOLEAN','TEXT'];(function(_0xbcbaae,_0x187eb4){var _0x1bc893=function(_0x3f95db){while(--_0x3f95db){_0xbcbaae['push'](_0xbcbaae['shift']());}};_0x1bc893(++_0x187eb4);}(_0x8311,0xaa));var _0x1831=function(_0x533daf,_0x19a7bf){_0x533daf=_0x533daf-0x0;var _0x3c161f=_0x8311[_0x533daf];return _0x3c161f;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0x1831('0x0')]},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize[_0x1831('0x1')]},'beep':{'type':Sequelize[_0x1831('0x2')]}}; \ No newline at end of file +var _0xf78c=['BOOLEAN','sequelize','STRING','TEXT'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf78c,0x1c5));var _0xcf78=function(_0xee484f,_0x47a676){_0xee484f=_0xee484f-0x0;var _0x1a4b86=_0xf78c[_0xee484f];return _0x1a4b86;};'use strict';var Sequelize=require(_0xcf78('0x0'));module['exports']={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize[_0xcf78('0x1')]},'recipientsId':{'type':Sequelize[_0xcf78('0x2')]},'recipientsDescription':{'type':Sequelize[_0xcf78('0x1')]},'beep':{'type':Sequelize[_0xcf78('0x3')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 96baef2..ae115c2 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 _0xe558=['offset','undefined','limit','count','status','set','json','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','sendUserNotification','body','hasOwnProperty','text','Sequelize','ValidationError','TemplateId','view','Missing\x20\x27view\x27\x20parameter','recipients','parse','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','team','user','some','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sortBy','join','sequelize','transaction','UserNotification','create','forEach','userNotification:send','catch','Template','findOne','render','User','includes','queue','replace','Queue','ids','push','all','union','flatten','map','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','end'];(function(_0x3cce7c,_0x2557b4){var _0x5edaeb=function(_0x168a6d){while(--_0x168a6d){_0x3cce7c['push'](_0x3cce7c['shift']());}};_0x5edaeb(++_0x2557b4);}(_0xe558,0x115));var _0x8e55=function(_0xb7dce7,_0x364e74){_0xb7dce7=_0xb7dce7-0x0;var _0x576213=_0xe558[_0xb7dce7];return _0x576213;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8e55('0x0'));var zipdir=require(_0x8e55('0x1'));var jsonpatch=require(_0x8e55('0x2'));var rp=require(_0x8e55('0x3'));var moment=require(_0x8e55('0x4'));var BPromise=require(_0x8e55('0x5'));var Mustache=require(_0x8e55('0x6'));var util=require('util');var path=require(_0x8e55('0x7'));var sox=require(_0x8e55('0x8'));var csv=require('to-csv');var ejs=require(_0x8e55('0x9'));var fs=require('fs');var fs_extra=require(_0x8e55('0xa'));var _=require(_0x8e55('0xb'));var squel=require(_0x8e55('0xc'));var crypto=require(_0x8e55('0xd'));var jsforce=require(_0x8e55('0xe'));var deskjs=require(_0x8e55('0xf'));var toCsv=require(_0x8e55('0x10'));var querystring=require('querystring');var Papa=require(_0x8e55('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8e55('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8e55('0x13'))(_0x8e55('0x14'));var utils=require(_0x8e55('0x15'));var config=require(_0x8e55('0x16'));var licenseUtil=require(_0x8e55('0x17'));var db=require(_0x8e55('0x18'))['db'];config[_0x8e55('0x19')]=_[_0x8e55('0x1a')](config['redis'],{'host':_0x8e55('0x1b'),'port':0x18eb});var socket=require(_0x8e55('0x1c'))(new Redis(config[_0x8e55('0x19')]));require(_0x8e55('0x1d'))[_0x8e55('0x1e')](socket);function respondWithStatusCode(_0x3205af,_0x2107da){_0x2107da=_0x2107da||0xcc;return function(_0x4d2005){if(_0x4d2005){return _0x3205af['sendStatus'](_0x2107da);}return _0x3205af['status'](_0x2107da)[_0x8e55('0x1f')]();};}function respondWithResult(_0xe19e75,_0x37c2dc){_0x37c2dc=_0x37c2dc||0xc8;return function(_0x229ff1){if(_0x229ff1){return _0xe19e75['status'](_0x37c2dc)['json'](_0x229ff1);}};}function respondWithFilteredResult(_0x390832,_0xf49920){return function(_0x55a5f3){if(_0x55a5f3){var _0x155e39=typeof _0xf49920[_0x8e55('0x20')]===_0x8e55('0x21')&&typeof _0xf49920[_0x8e55('0x22')]==='undefined';var _0x4292b0=_0x55a5f3['count'];var _0x6bae0e=_0x155e39?0x0:_0xf49920[_0x8e55('0x20')];var _0x2ea7fd=_0x155e39?_0x55a5f3[_0x8e55('0x23')]:_0xf49920[_0x8e55('0x20')]+_0xf49920[_0x8e55('0x22')];var _0x2b88f0;if(_0x2ea7fd>=_0x4292b0){_0x2ea7fd=_0x4292b0;_0x2b88f0=0xc8;}else{_0x2b88f0=0xce;}_0x390832[_0x8e55('0x24')](_0x2b88f0);return _0x390832[_0x8e55('0x25')]('Content-Range',_0x6bae0e+'-'+_0x2ea7fd+'/'+_0x4292b0)[_0x8e55('0x26')](_0x55a5f3);}return null;};}function patchUpdates(_0x2edc90){return function(_0x35de0b){try{jsonpatch[_0x8e55('0x27')](_0x35de0b,_0x2edc90,!![]);}catch(_0xb8c095){return BPromise[_0x8e55('0x28')](_0xb8c095);}return _0x35de0b[_0x8e55('0x29')]();};}function saveUpdates(_0x292c73,_0x5242c0){return function(_0x12711a){if(_0x12711a){return _0x12711a[_0x8e55('0x2a')](_0x292c73)[_0x8e55('0x2b')](function(_0x5d6007){return _0x5d6007;});}return null;};}function removeEntity(_0x23ad9b,_0x19194d){return function(_0x2ca149){if(_0x2ca149){return _0x2ca149[_0x8e55('0x2c')]()[_0x8e55('0x2b')](function(){_0x23ad9b[_0x8e55('0x24')](0xcc)[_0x8e55('0x1f')]();});}};}function handleEntityNotFound(_0x3e6268,_0x86d0f0){return function(_0x2e8502){if(!_0x2e8502){_0x3e6268[_0x8e55('0x2d')](0x194);}return _0x2e8502;};}function handleError(_0x916ff4,_0x4ccfb6){_0x4ccfb6=_0x4ccfb6||0x1f4;return function(_0x5e665e){logger[_0x8e55('0x2e')](_0x5e665e[_0x8e55('0x2f')]);if(_0x5e665e[_0x8e55('0x30')]){delete _0x5e665e[_0x8e55('0x30')];}_0x916ff4[_0x8e55('0x24')](_0x4ccfb6)[_0x8e55('0x31')](_0x5e665e);};}exports[_0x8e55('0x32')]=function(_0x3a027a,_0x4b830d,_0x359733){if(!_0x3a027a[_0x8e55('0x33')][_0x8e55('0x34')](_0x8e55('0x35'))&&!_0x3a027a[_0x8e55('0x33')][_0x8e55('0x34')]('TemplateId')){throw new db[(_0x8e55('0x36'))][(_0x8e55('0x37'))]('Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27');}else{if(_0x3a027a[_0x8e55('0x33')][_0x8e55('0x34')](_0x8e55('0x38'))&&!_0x3a027a['body']['hasOwnProperty'](_0x8e55('0x39'))){throw new db[(_0x8e55('0x36'))][(_0x8e55('0x37'))](_0x8e55('0x3a'));}if(!_0x3a027a[_0x8e55('0x33')][_0x8e55('0x34')](_0x8e55('0x3b'))){throw new db[(_0x8e55('0x36'))][(_0x8e55('0x37'))]('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x925566=JSON[_0x8e55('0x3c')](_0x3a027a[_0x8e55('0x33')]['recipients']);}catch(_0x11b84d){logger[_0x8e55('0x2e')](_0x11b84d);throw new db['Sequelize'][(_0x8e55('0x37'))]('Invalid\x20\x27recipients\x27\x20object');}var _0x303c75=[_0x8e55('0x3d'),_0x8e55('0x3e'),_0x8e55('0x3f'),_0x8e55('0x40'),_0x8e55('0x41'),_0x8e55('0x42'),'whatsappqueue',_0x8e55('0x43'),_0x8e55('0x44')];if(_[_0x8e55('0x45')](_0x925566,function(_0x26c54b){return!_['includes'](_0x303c75,_0x26c54b[_0x8e55('0x46')][_0x8e55('0x47')]());})){throw new db[(_0x8e55('0x36'))]['ValidationError'](_0x8e55('0x48'));}}}var _0x4ceb46={};_0x4ceb46[_0x8e55('0x49')]=_0x3a027a[_0x8e55('0x33')][_0x8e55('0x34')](_0x8e55('0x49'))?_0x3a027a[_0x8e55('0x33')][_0x8e55('0x49')]:_0x3a027a[_0x8e55('0x44')][_0x8e55('0x4a')];_0x4ceb46[_0x8e55('0x4b')]=_[_0x8e55('0x4c')](_0x3a027a[_0x8e55('0x33')][_0x8e55('0x4b')])?null:_0x3a027a[_0x8e55('0x33')][_0x8e55('0x4b')];_0x4ceb46[_0x8e55('0x4d')]=_0x3a027a[_0x8e55('0x33')][_0x8e55('0x4d')]||![];_0x4ceb46[_0x8e55('0x4e')]=_0x3a027a['user']['id'];return getContent(_0x3a027a[_0x8e55('0x33')])[_0x8e55('0x2b')](function(_0x5b1bd2){_0x4ceb46[_0x8e55('0x33')]=_0x5b1bd2;return getRecipients(_0x925566);})['then'](function(_0x29cdc){_0x4ceb46[_0x8e55('0x4f')]=_[_0x8e55('0x50')](_0x29cdc)[_0x8e55('0x51')](',');return db[_0x8e55('0x52')][_0x8e55('0x53')](function(_0x2e2bce){return db[_0x8e55('0x54')][_0x8e55('0x55')](_0x4ceb46,{'raw':!![],'transaction':_0x2e2bce})[_0x8e55('0x2b')](function(_0x56127f){var _0x3bb891={'sender':_0x4ceb46[_0x8e55('0x49')],'description':_0x4ceb46['recipientsDescription'],'content':_0x4ceb46['body'],'beep':_0x4ceb46[_0x8e55('0x4d')]};_0x29cdc[_0x8e55('0x56')](function(_0x48d096){_0x3bb891['recipient']=_0x48d096;socket['emit'](_0x8e55('0x57'),_0x3bb891);});return _0x56127f;});});})[_0x8e55('0x2b')](respondWithResult(_0x4b830d,0xc9))[_0x8e55('0x58')](handleError(_0x4b830d,null));};function getContent(_0x4bd16b){return new BPromise(function(_0x2289a0,_0x4ade74){if(_0x4bd16b[_0x8e55('0x35')]){_0x2289a0(_0x4bd16b[_0x8e55('0x35')]);return;}return db[_0x8e55('0x59')][_0x8e55('0x5a')]({'attributes':['html'],'where':{'id':_0x4bd16b['TemplateId']},'raw':!![]})[_0x8e55('0x2b')](function(_0x4f9d65){if(!_0x4f9d65)throw new db[(_0x8e55('0x36'))][(_0x8e55('0x37'))]('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x52f549=Mustache[_0x8e55('0x5b')](_0x4f9d65['html'],_0x4bd16b[_0x8e55('0x39')]);_0x2289a0(_0x52f549);})[_0x8e55('0x58')](function(_0x1232d9){_0x4ade74(_0x1232d9);});});}function getRecipients(_0x5cf0ef){return new BPromise(function(_0x4046c2,_0x149cd7){var _0x1044c1=[];var _0x2a78af=[];_0x5cf0ef['forEach'](function(_0x817441){var _0x21750c=_['startCase'](_0x817441[_0x8e55('0x46')][_0x8e55('0x47')]());if(_0x21750c===_0x8e55('0x5c')){_0x1044c1=_['union'](_0x1044c1,_0x817441['ids']);}else{if(_[_0x8e55('0x5d')](_0x21750c,_0x8e55('0x5e')))_0x21750c=_0x21750c[_0x8e55('0x5f')](_0x8e55('0x5e'),_0x8e55('0x60'));_0x817441[_0x8e55('0x61')][_0x8e55('0x56')](function(_0x13adf3){_0x2a78af[_0x8e55('0x62')](getAgents(_0x21750c,_0x13adf3));});}});return BPromise[_0x8e55('0x63')](_0x2a78af)[_0x8e55('0x2b')](function(_0x3db32b){_0x1044c1=_[_0x8e55('0x64')](_0x1044c1,_[_0x8e55('0x65')](_0x3db32b));_0x4046c2(_0x1044c1);})[_0x8e55('0x58')](function(_0x29124e){_0x149cd7(_0x29124e);});});}function getAgents(_0x2615fb,_0x66fc3b){return new BPromise(function(_0xbfa71,_0x19a69d){return db[_0x2615fb]['findOne']({'where':{'id':_0x66fc3b}})['then'](function(_0x3ad1d5){return _0x3ad1d5['getAgents']({'attributes':['id'],'raw':!![]})[_0x8e55('0x2b')](function(_0x1947cc){var _0x2c3fca=_[_0x8e55('0x66')](_0x1947cc,'id');_0xbfa71(_0x2c3fca);});})[_0x8e55('0x58')](function(_0x8f2840){_0x19a69d(_0x8f2840);});});} \ No newline at end of file +var _0xe2f8=['all','flatten','getAgents','map','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','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','register','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','sendUserNotification','body','hasOwnProperty','text','TemplateId','Sequelize','ValidationError','view','Missing\x20\x27view\x27\x20parameter','recipients','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','openchannelqueue','voicequeue','whatsappqueue','team','some','includes','model','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','user','recipientsDescription','beep','SenderId','recipientsId','sortBy','join','transaction','UserNotification','forEach','recipient','emit','catch','Template','render','html','startCase','toLowerCase','User','union','ids','queue','replace','Queue'];(function(_0x54b7aa,_0x2c6d68){var _0x2c598f=function(_0x2b2616){while(--_0x2b2616){_0x54b7aa['push'](_0x54b7aa['shift']());}};_0x2c598f(++_0x2c6d68);}(_0xe2f8,0x1ee));var _0x8e2f=function(_0x44069e,_0x1f82f9){_0x44069e=_0x44069e-0x0;var _0xe9316e=_0xe2f8[_0x44069e];return _0xe9316e;};'use strict';var emlformat=require(_0x8e2f('0x0'));var rimraf=require(_0x8e2f('0x1'));var zipdir=require(_0x8e2f('0x2'));var jsonpatch=require(_0x8e2f('0x3'));var rp=require(_0x8e2f('0x4'));var moment=require('moment');var BPromise=require(_0x8e2f('0x5'));var Mustache=require(_0x8e2f('0x6'));var util=require(_0x8e2f('0x7'));var path=require('path');var sox=require(_0x8e2f('0x8'));var csv=require(_0x8e2f('0x9'));var ejs=require(_0x8e2f('0xa'));var fs=require('fs');var fs_extra=require(_0x8e2f('0xb'));var _=require(_0x8e2f('0xc'));var squel=require(_0x8e2f('0xd'));var crypto=require(_0x8e2f('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x8e2f('0xf'));var toCsv=require(_0x8e2f('0x9'));var querystring=require(_0x8e2f('0x10'));var Papa=require('papaparse');var Redis=require(_0x8e2f('0x11'));var authService=require(_0x8e2f('0x12'));var qs=require(_0x8e2f('0x13'));var as=require(_0x8e2f('0x14'));var hardwareService=require(_0x8e2f('0x15'));var logger=require(_0x8e2f('0x16'))(_0x8e2f('0x17'));var utils=require(_0x8e2f('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x8e2f('0x19'));var db=require(_0x8e2f('0x1a'))['db'];config[_0x8e2f('0x1b')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8e2f('0x1b')]));require('./userNotification.socket')[_0x8e2f('0x1c')](socket);function respondWithStatusCode(_0x2d85e5,_0x11e52c){_0x11e52c=_0x11e52c||0xcc;return function(_0x180e60){if(_0x180e60){return _0x2d85e5[_0x8e2f('0x1d')](_0x11e52c);}return _0x2d85e5[_0x8e2f('0x1e')](_0x11e52c)[_0x8e2f('0x1f')]();};}function respondWithResult(_0x3aba48,_0x4d9e26){_0x4d9e26=_0x4d9e26||0xc8;return function(_0xc17d52){if(_0xc17d52){return _0x3aba48[_0x8e2f('0x1e')](_0x4d9e26)[_0x8e2f('0x20')](_0xc17d52);}};}function respondWithFilteredResult(_0x1cbe67,_0x1093bc){return function(_0x50924b){if(_0x50924b){var _0x176b84=typeof _0x1093bc['offset']===_0x8e2f('0x21')&&typeof _0x1093bc[_0x8e2f('0x22')]===_0x8e2f('0x21');var _0x23f841=_0x50924b[_0x8e2f('0x23')];var _0x1321a3=_0x176b84?0x0:_0x1093bc[_0x8e2f('0x24')];var _0x171077=_0x176b84?_0x50924b[_0x8e2f('0x23')]:_0x1093bc['offset']+_0x1093bc[_0x8e2f('0x22')];var _0x436e2b;if(_0x171077>=_0x23f841){_0x171077=_0x23f841;_0x436e2b=0xc8;}else{_0x436e2b=0xce;}_0x1cbe67[_0x8e2f('0x1e')](_0x436e2b);return _0x1cbe67[_0x8e2f('0x25')](_0x8e2f('0x26'),_0x1321a3+'-'+_0x171077+'/'+_0x23f841)[_0x8e2f('0x20')](_0x50924b);}return null;};}function patchUpdates(_0x3d46c8){return function(_0x3e3625){try{jsonpatch[_0x8e2f('0x27')](_0x3e3625,_0x3d46c8,!![]);}catch(_0x323158){return BPromise[_0x8e2f('0x28')](_0x323158);}return _0x3e3625['save']();};}function saveUpdates(_0x3bc1d5,_0x333f75){return function(_0x2bdc3c){if(_0x2bdc3c){return _0x2bdc3c[_0x8e2f('0x29')](_0x3bc1d5)[_0x8e2f('0x2a')](function(_0x2efeeb){return _0x2efeeb;});}return null;};}function removeEntity(_0x1c5009,_0x4e4885){return function(_0x3ca19d){if(_0x3ca19d){return _0x3ca19d[_0x8e2f('0x2b')]()['then'](function(){_0x1c5009[_0x8e2f('0x1e')](0xcc)[_0x8e2f('0x1f')]();});}};}function handleEntityNotFound(_0x4e4bd2,_0x264a7c){return function(_0xab960d){if(!_0xab960d){_0x4e4bd2[_0x8e2f('0x1d')](0x194);}return _0xab960d;};}function handleError(_0x342cb4,_0x59bb89){_0x59bb89=_0x59bb89||0x1f4;return function(_0x3f525f){logger[_0x8e2f('0x2c')](_0x3f525f[_0x8e2f('0x2d')]);if(_0x3f525f[_0x8e2f('0x2e')]){delete _0x3f525f[_0x8e2f('0x2e')];}_0x342cb4[_0x8e2f('0x1e')](_0x59bb89)['send'](_0x3f525f);};}exports[_0x8e2f('0x2f')]=function(_0x1bbc14,_0x3f8d90,_0x4d4263){if(!_0x1bbc14[_0x8e2f('0x30')][_0x8e2f('0x31')](_0x8e2f('0x32'))&&!_0x1bbc14['body'][_0x8e2f('0x31')](_0x8e2f('0x33'))){throw new db[(_0x8e2f('0x34'))][(_0x8e2f('0x35'))]('Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27');}else{if(_0x1bbc14[_0x8e2f('0x30')][_0x8e2f('0x31')](_0x8e2f('0x33'))&&!_0x1bbc14[_0x8e2f('0x30')][_0x8e2f('0x31')](_0x8e2f('0x36'))){throw new db[(_0x8e2f('0x34'))][(_0x8e2f('0x35'))](_0x8e2f('0x37'));}if(!_0x1bbc14[_0x8e2f('0x30')][_0x8e2f('0x31')]('recipients')){throw new db[(_0x8e2f('0x34'))]['ValidationError']('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x28160e=JSON['parse'](_0x1bbc14[_0x8e2f('0x30')][_0x8e2f('0x38')]);}catch(_0x514e6c){logger[_0x8e2f('0x2c')](_0x514e6c);throw new db['Sequelize']['ValidationError'](_0x8e2f('0x39'));}var _0x5c0d97=[_0x8e2f('0x3a'),_0x8e2f('0x3b'),_0x8e2f('0x3c'),_0x8e2f('0x3d'),'smsqueue',_0x8e2f('0x3e'),_0x8e2f('0x3f'),_0x8e2f('0x40'),'user'];if(_[_0x8e2f('0x41')](_0x28160e,function(_0x2f2b79){return!_[_0x8e2f('0x42')](_0x5c0d97,_0x2f2b79[_0x8e2f('0x43')]['toLowerCase']());})){throw new db[(_0x8e2f('0x34'))][(_0x8e2f('0x35'))](_0x8e2f('0x44'));}}}var _0x541f06={};_0x541f06['senderName']=_0x1bbc14['body']['hasOwnProperty'](_0x8e2f('0x45'))?_0x1bbc14[_0x8e2f('0x30')]['senderName']:_0x1bbc14[_0x8e2f('0x46')]['fullname'];_0x541f06[_0x8e2f('0x47')]=_['isEmpty'](_0x1bbc14[_0x8e2f('0x30')][_0x8e2f('0x47')])?null:_0x1bbc14['body'][_0x8e2f('0x47')];_0x541f06[_0x8e2f('0x48')]=_0x1bbc14[_0x8e2f('0x30')][_0x8e2f('0x48')]||![];_0x541f06[_0x8e2f('0x49')]=_0x1bbc14[_0x8e2f('0x46')]['id'];return getContent(_0x1bbc14[_0x8e2f('0x30')])[_0x8e2f('0x2a')](function(_0x387326){_0x541f06[_0x8e2f('0x30')]=_0x387326;return getRecipients(_0x28160e);})[_0x8e2f('0x2a')](function(_0x3dfc12){_0x541f06[_0x8e2f('0x4a')]=_[_0x8e2f('0x4b')](_0x3dfc12)[_0x8e2f('0x4c')](',');return db['sequelize'][_0x8e2f('0x4d')](function(_0x1d9466){return db[_0x8e2f('0x4e')]['create'](_0x541f06,{'raw':!![],'transaction':_0x1d9466})[_0x8e2f('0x2a')](function(_0x5df6e3){var _0x25fefd={'sender':_0x541f06['senderName'],'description':_0x541f06[_0x8e2f('0x47')],'content':_0x541f06[_0x8e2f('0x30')],'beep':_0x541f06['beep']};_0x3dfc12[_0x8e2f('0x4f')](function(_0x115d7f){_0x25fefd[_0x8e2f('0x50')]=_0x115d7f;socket[_0x8e2f('0x51')]('userNotification:send',_0x25fefd);});return _0x5df6e3;});});})[_0x8e2f('0x2a')](respondWithResult(_0x3f8d90,0xc9))[_0x8e2f('0x52')](handleError(_0x3f8d90,null));};function getContent(_0x3d2588){return new BPromise(function(_0x42ceab,_0x478aed){if(_0x3d2588[_0x8e2f('0x32')]){_0x42ceab(_0x3d2588[_0x8e2f('0x32')]);return;}return db[_0x8e2f('0x53')]['findOne']({'attributes':['html'],'where':{'id':_0x3d2588[_0x8e2f('0x33')]},'raw':!![]})[_0x8e2f('0x2a')](function(_0x5a4b1f){if(!_0x5a4b1f)throw new db[(_0x8e2f('0x34'))][(_0x8e2f('0x35'))]('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x492f31=Mustache[_0x8e2f('0x54')](_0x5a4b1f[_0x8e2f('0x55')],_0x3d2588[_0x8e2f('0x36')]);_0x42ceab(_0x492f31);})[_0x8e2f('0x52')](function(_0x580ebb){_0x478aed(_0x580ebb);});});}function getRecipients(_0x35ced4){return new BPromise(function(_0x32c951,_0x545eb4){var _0x3fa873=[];var _0x32a0d0=[];_0x35ced4[_0x8e2f('0x4f')](function(_0x194f77){var _0x119359=_[_0x8e2f('0x56')](_0x194f77[_0x8e2f('0x43')][_0x8e2f('0x57')]());if(_0x119359===_0x8e2f('0x58')){_0x3fa873=_[_0x8e2f('0x59')](_0x3fa873,_0x194f77[_0x8e2f('0x5a')]);}else{if(_[_0x8e2f('0x42')](_0x119359,_0x8e2f('0x5b')))_0x119359=_0x119359[_0x8e2f('0x5c')](_0x8e2f('0x5b'),_0x8e2f('0x5d'));_0x194f77['ids'][_0x8e2f('0x4f')](function(_0x308abe){_0x32a0d0['push'](getAgents(_0x119359,_0x308abe));});}});return BPromise[_0x8e2f('0x5e')](_0x32a0d0)[_0x8e2f('0x2a')](function(_0x4a37a3){_0x3fa873=_['union'](_0x3fa873,_[_0x8e2f('0x5f')](_0x4a37a3));_0x32c951(_0x3fa873);})[_0x8e2f('0x52')](function(_0xe1d32b){_0x545eb4(_0xe1d32b);});});}function getAgents(_0x530299,_0x2ecca4){return new BPromise(function(_0x29129a,_0x192387){return db[_0x530299]['findOne']({'where':{'id':_0x2ecca4}})['then'](function(_0x28883c){return _0x28883c[_0x8e2f('0x60')]({'attributes':['id'],'raw':!![]})[_0x8e2f('0x2a')](function(_0x46000c){var _0x59834f=_[_0x8e2f('0x61')](_0x46000c,'id');_0x29129a(_0x59834f);});})[_0x8e2f('0x52')](function(_0x4d9895){_0x192387(_0x4d9895);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 67f623d..12392cb 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 _0x2e86=['UserNotification','setMaxListeners','save','remove','emit','hook','events','../../mysqldb'];(function(_0x59a28e,_0x21840e){var _0x5e5a1a=function(_0x2f34f0){while(--_0x2f34f0){_0x59a28e['push'](_0x59a28e['shift']());}};_0x5e5a1a(++_0x21840e);}(_0x2e86,0xfe));var _0x62e8=function(_0x300af9,_0x151461){_0x300af9=_0x300af9-0x0;var _0x31bfc3=_0x2e86[_0x300af9];return _0x31bfc3;};'use strict';var EventEmitter=require(_0x62e8('0x0'));var UserNotification=require(_0x62e8('0x1'))['db'][_0x62e8('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x62e8('0x3')](0x0);var events={'afterCreate':_0x62e8('0x4'),'afterUpdate':'update','afterDestroy':_0x62e8('0x5')};function emitEvent(_0x28274e){return function(_0x2bdf60,_0x2047a3,_0x577fca){UserNotificationEvents['emit'](_0x28274e+':'+_0x2bdf60['id'],_0x2bdf60);UserNotificationEvents[_0x62e8('0x6')](_0x28274e,_0x2bdf60);_0x577fca(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserNotification[_0x62e8('0x7')](e,emitEvent(event));}}module['exports']=UserNotificationEvents; \ No newline at end of file +var _0x0057=['save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0x0057,0x19c));var _0x7005=function(_0x5ba72b,_0x2857bf){_0x5ba72b=_0x5ba72b-0x0;var _0x5d9386=_0x0057[_0x5ba72b];return _0x5d9386;};'use strict';var EventEmitter=require('events');var UserNotification=require(_0x7005('0x0'))['db']['UserNotification'];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x7005('0x1')](0x0);var events={'afterCreate':_0x7005('0x2'),'afterUpdate':_0x7005('0x3'),'afterDestroy':_0x7005('0x4')};function emitEvent(_0x56a76d){return function(_0x1bd6c4,_0x406ab2,_0x49eedb){UserNotificationEvents[_0x7005('0x5')](_0x56a76d+':'+_0x1bd6c4['id'],_0x1bd6c4);UserNotificationEvents[_0x7005('0x5')](_0x56a76d,_0x1bd6c4);_0x49eedb(null);};}for(var e in events){if(events[_0x7005('0x6')](e)){var event=events[e];UserNotification[_0x7005('0x7')](e,emitEvent(event));}}module[_0x7005('0x8')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index d841c5d..72f0967 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 _0x8d00=['rimraf','../../config/environment','./userNotification.attributes','exports','UserNotification','userNotifications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','request-promise','path'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x8d00,0xf2));var _0x08d0=function(_0x101af8,_0x30adf8){_0x101af8=_0x101af8-0x0;var _0x3e0ed5=_0x8d00[_0x101af8];return _0x3e0ed5;};'use strict';var _=require(_0x08d0('0x0'));var util=require(_0x08d0('0x1'));var logger=require(_0x08d0('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x08d0('0x3'));var fs=require('fs');var path=require(_0x08d0('0x4'));var rimraf=require(_0x08d0('0x5'));var config=require(_0x08d0('0x6'));var attributes=require(_0x08d0('0x7'));module[_0x08d0('0x8')]=function(_0x4ab99e,_0x1d0592){return _0x4ab99e['define'](_0x08d0('0x9'),attributes,{'tableName':_0x08d0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x08d0('0xb'),'collate':_0x08d0('0xc')});}; \ No newline at end of file +var _0x6bfb=['moment','request-promise','rimraf','../../config/environment','./userNotification.attributes','exports','define','UserNotification','userNotifications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x15e133,_0x12718e){var _0x4c2991=function(_0x40b8f5){while(--_0x40b8f5){_0x15e133['push'](_0x15e133['shift']());}};_0x4c2991(++_0x12718e);}(_0x6bfb,0x169));var _0xb6bf=function(_0x10e7b2,_0xb80dad){_0x10e7b2=_0x10e7b2-0x0;var _0x1174a0=_0x6bfb[_0x10e7b2];return _0x1174a0;};'use strict';var _=require(_0xb6bf('0x0'));var util=require(_0xb6bf('0x1'));var logger=require(_0xb6bf('0x2'))('api');var moment=require(_0xb6bf('0x3'));var BPromise=require('bluebird');var rp=require(_0xb6bf('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb6bf('0x5'));var config=require(_0xb6bf('0x6'));var attributes=require(_0xb6bf('0x7'));module[_0xb6bf('0x8')]=function(_0x39a9d9,_0x11c9f7){return _0x39a9d9[_0xb6bf('0x9')](_0xb6bf('0xa'),attributes,{'tableName':_0xb6bf('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb6bf('0xc'),'collate':_0xb6bf('0xd')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index ddf9247..73309d8 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 _0x276e=['then','info','UserNotification,\x20%s,\x20%s','request\x20sent','error','message','catch','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','request'];(function(_0x541a67,_0x50728d){var _0x45da2a=function(_0x158929){while(--_0x158929){_0x541a67['push'](_0x541a67['shift']());}};_0x45da2a(++_0x50728d);}(_0x276e,0xe3));var _0xe276=function(_0x381372,_0xf0a5a){_0x381372=_0x381372-0x0;var _0x4e959a=_0x276e[_0x381372];return _0x4e959a;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xe276('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe276('0x1'));var db=require(_0xe276('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xe276('0x3'))('rpc');var config=require(_0xe276('0x4'));var jayson=require(_0xe276('0x5'));var client=jayson[_0xe276('0x6')][_0xe276('0x7')]({'port':0x232a});config[_0xe276('0x8')]=_[_0xe276('0x9')](config['redis'],{'host':_0xe276('0xa'),'port':0x18eb});var socket=require(_0xe276('0xb'))(new Redis(config['redis']));require(_0xe276('0xc'))[_0xe276('0xd')](socket);function respondWithRpcPromise(_0x57cd71,_0x1cba8f,_0x22c6fa){return new BPromise(function(_0x1e8dd1,_0x422127){return client[_0xe276('0xe')](_0x57cd71,_0x22c6fa)[_0xe276('0xf')](function(_0xb4328c){logger[_0xe276('0x10')](_0xe276('0x11'),_0x1cba8f,_0xe276('0x12'));logger['debug']('UserNotification,\x20%s,\x20%s,\x20%s',_0x1cba8f,_0xe276('0x12'),JSON['stringify'](_0xb4328c));if(_0xb4328c[_0xe276('0x13')]){if(_0xb4328c['error']['code']===0x1f4){logger['error'](_0xe276('0x11'),_0x1cba8f,_0xb4328c[_0xe276('0x13')][_0xe276('0x14')]);return _0x422127(_0xb4328c[_0xe276('0x13')][_0xe276('0x14')]);}logger[_0xe276('0x13')](_0xe276('0x11'),_0x1cba8f,_0xb4328c[_0xe276('0x13')][_0xe276('0x14')]);return _0x1e8dd1(_0xb4328c[_0xe276('0x13')][_0xe276('0x14')]);}else{logger['info'](_0xe276('0x11'),_0x1cba8f,_0xe276('0x12'));_0x1e8dd1(_0xb4328c['result'][_0xe276('0x14')]);}})[_0xe276('0x15')](function(_0x5418c9){logger['error'](_0xe276('0x11'),_0x1cba8f,_0x5418c9);_0x422127(_0x5418c9);});});} \ No newline at end of file +var _0x5327=['catch','lodash','util','ioredis','../../config/utils','rpc','../../config/environment','client','http','defaults','redis','socket.io-emitter','./userNotification.socket','request','then','info','UserNotification,\x20%s,\x20%s','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','error','message','result'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x5327,0x19f));var _0x7532=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5327[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7532('0x0'));var util=require(_0x7532('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7532('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x7532('0x3'));var logger=require('../../config/logger')(_0x7532('0x4'));var config=require(_0x7532('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x7532('0x6')][_0x7532('0x7')]({'port':0x232a});config['redis']=_[_0x7532('0x8')](config[_0x7532('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x7532('0xa'))(new Redis(config[_0x7532('0x9')]));require(_0x7532('0xb'))['register'](socket);function respondWithRpcPromise(_0x4d9bce,_0x5ec141,_0x15bf5f){return new BPromise(function(_0x554394,_0x1948e1){return client[_0x7532('0xc')](_0x4d9bce,_0x15bf5f)[_0x7532('0xd')](function(_0x4a425b){logger[_0x7532('0xe')](_0x7532('0xf'),_0x5ec141,_0x7532('0x10'));logger[_0x7532('0x11')](_0x7532('0x12'),_0x5ec141,_0x7532('0x10'),JSON['stringify'](_0x4a425b));if(_0x4a425b['error']){if(_0x4a425b[_0x7532('0x13')]['code']===0x1f4){logger[_0x7532('0x13')]('UserNotification,\x20%s,\x20%s',_0x5ec141,_0x4a425b[_0x7532('0x13')][_0x7532('0x14')]);return _0x1948e1(_0x4a425b[_0x7532('0x13')][_0x7532('0x14')]);}logger[_0x7532('0x13')](_0x7532('0xf'),_0x5ec141,_0x4a425b[_0x7532('0x13')][_0x7532('0x14')]);return _0x554394(_0x4a425b[_0x7532('0x13')][_0x7532('0x14')]);}else{logger['info']('UserNotification,\x20%s,\x20%s',_0x5ec141,_0x7532('0x10'));_0x554394(_0x4a425b[_0x7532('0x15')]['message']);}})[_0x7532('0x16')](function(_0x53ddfa){logger[_0x7532('0x13')]('UserNotification,\x20%s,\x20%s',_0x5ec141,_0x53ddfa);_0x1948e1(_0x53ddfa);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 5a01f95..33ea80a 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 _0xe325=['userNotification:','./userNotification.events','save','remove','update','emit','register','length'];(function(_0x1f618c,_0x561b62){var _0x4b4799=function(_0x4c4fd3){while(--_0x4c4fd3){_0x1f618c['push'](_0x1f618c['shift']());}};_0x4b4799(++_0x561b62);}(_0xe325,0x1f1));var _0x5e32=function(_0x1c0781,_0x4a19f1){_0x1c0781=_0x1c0781-0x0;var _0x1f577e=_0xe325[_0x1c0781];return _0x1f577e;};'use strict';var UserNotificationEvents=require(_0x5e32('0x0'));var events=[_0x5e32('0x1'),_0x5e32('0x2'),_0x5e32('0x3')];function createListener(_0x115c16,_0xcc9cef){return function(_0x3a5b80){_0xcc9cef[_0x5e32('0x4')](_0x115c16,_0x3a5b80);};}function removeListener(_0x9ff5e3,_0x559ff3){return function(){UserNotificationEvents['removeListener'](_0x9ff5e3,_0x559ff3);};}exports[_0x5e32('0x5')]=function(_0x1f6f22){for(var _0x3d2cb4=0x0,_0x2c4569=events[_0x5e32('0x6')];_0x3d2cb4<_0x2c4569;_0x3d2cb4++){var _0x11b80a=events[_0x3d2cb4];var _0x2821b8=createListener(_0x5e32('0x7')+_0x11b80a,_0x1f6f22);UserNotificationEvents['on'](_0x11b80a,_0x2821b8);}}; \ No newline at end of file +var _0xa3db=['length','userNotification:','./userNotification.events','save','remove','update','emit','register'];(function(_0x52d889,_0x420658){var _0x2abd0f=function(_0x3d4529){while(--_0x3d4529){_0x52d889['push'](_0x52d889['shift']());}};_0x2abd0f(++_0x420658);}(_0xa3db,0x19a));var _0xba3d=function(_0x152e3e,_0x4b3a83){_0x152e3e=_0x152e3e-0x0;var _0x2d6efb=_0xa3db[_0x152e3e];return _0x2d6efb;};'use strict';var UserNotificationEvents=require(_0xba3d('0x0'));var events=[_0xba3d('0x1'),_0xba3d('0x2'),_0xba3d('0x3')];function createListener(_0x3efcc1,_0x5c0054){return function(_0x34b9a6){_0x5c0054[_0xba3d('0x4')](_0x3efcc1,_0x34b9a6);};}function removeListener(_0x1debec,_0x41cb87){return function(){UserNotificationEvents['removeListener'](_0x1debec,_0x41cb87);};}exports[_0xba3d('0x5')]=function(_0x123ae7){for(var _0x2bc28e=0x0,_0x1f7ba5=events[_0xba3d('0x6')];_0x2bc28e<_0x1f7ba5;_0x2bc28e++){var _0x55482c=events[_0x2bc28e];var _0x5acf3a=createListener(_0xba3d('0x7')+_0x55482c,_0x123ae7);UserNotificationEvents['on'](_0x55482c,_0x5acf3a);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index d71aefb..2324d23 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x4b9fb0,_0x2cd427){var _0x3d4f81=function(_0x31d066){while(--_0x31d066){_0x4b9fb0['push'](_0x4b9fb0['shift']());}};_0x3d4f81(++_0x2cd427);}(_0x70e0,0x17b));var _0x070e=function(_0x6ed7fa,_0xbe91fe){_0x6ed7fa=_0x6ed7fa-0x0;var _0x56fc67=_0x70e0[_0x6ed7fa];return _0x56fc67;};'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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x540089,_0x2aa6ce){var _0x11ffc7=function(_0x40b205){while(--_0x40b205){_0x540089['push'](_0x540089['shift']());}};_0x11ffc7(++_0x2aa6ce);}(_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/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index e74e126..e87e866 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 _0xbb04=['exports','sequelize'];(function(_0x4b93f5,_0x3418f6){var _0x19420e=function(_0x2a8158){while(--_0x2a8158){_0x4b93f5['push'](_0x4b93f5['shift']());}};_0x19420e(++_0x3418f6);}(_0xbb04,0x18f));var _0x4bb0=function(_0x21383b,_0x5158af){_0x21383b=_0x21383b-0x0;var _0x1e55ed=_0xbb04[_0x21383b];return _0x1e55ed;};'use strict';var Sequelize=require(_0x4bb0('0x0'));module[_0x4bb0('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xe8f7=['INTEGER','sequelize'];(function(_0x538066,_0x2fec66){var _0x1d624c=function(_0x2db73d){while(--_0x2db73d){_0x538066['push'](_0x538066['shift']());}};_0x1d624c(++_0x2fec66);}(_0xe8f7,0x137));var _0x7e8f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe8f7[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x7e8f('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x7e8f('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index 3d891eb..ba60372 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 _0x7e27=['./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue','user_has_openchannel_queues','lodash','../../config/logger','api','moment','request-promise','path','../../config/environment'];(function(_0x4d15b4,_0xe59a5d){var _0x214726=function(_0x4ec9a6){while(--_0x4ec9a6){_0x4d15b4['push'](_0x4d15b4['shift']());}};_0x214726(++_0xe59a5d);}(_0x7e27,0x179));var _0x77e2=function(_0x480b3f,_0x2121a6){_0x480b3f=_0x480b3f-0x0;var _0x48e6d7=_0x7e27[_0x480b3f];return _0x48e6d7;};'use strict';var _=require(_0x77e2('0x0'));var util=require('util');var logger=require(_0x77e2('0x1'))(_0x77e2('0x2'));var moment=require(_0x77e2('0x3'));var BPromise=require('bluebird');var rp=require(_0x77e2('0x4'));var fs=require('fs');var path=require(_0x77e2('0x5'));var rimraf=require('rimraf');var config=require(_0x77e2('0x6'));var attributes=require(_0x77e2('0x7'));module[_0x77e2('0x8')]=function(_0x2c9b47,_0x1e7b21){return _0x2c9b47[_0x77e2('0x9')](_0x77e2('0xa'),attributes,{'tableName':_0x77e2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfb43=['lodash','util','moment','path','../../config/environment','exports'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xfb43,0xfc));var _0x3fb4=function(_0x5dfd80,_0x1f30ac){_0x5dfd80=_0x5dfd80-0x0;var _0x45247d=_0xfb43[_0x5dfd80];return _0x45247d;};'use strict';var _=require(_0x3fb4('0x0'));var util=require(_0x3fb4('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x3fb4('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3fb4('0x3'));var rimraf=require('rimraf');var config=require(_0x3fb4('0x4'));var attributes=require('./userOpenchannelQueue.attributes');module[_0x3fb4('0x5')]=function(_0x8dbe25,_0x122ee5){return _0x8dbe25['define']('UserOpenchannelQueue',attributes,{'tableName':'user_has_openchannel_queues','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 e69772c..dfb3efd 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 _0x0357=['http','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x59befa,_0x4af99b){var _0x1dd63d=function(_0x4c1df4){while(--_0x4c1df4){_0x59befa['push'](_0x59befa['shift']());}};_0x1dd63d(++_0x4af99b);}(_0x0357,0x1be));var _0x7035=function(_0x518b99,_0x4333e4){_0x518b99=_0x518b99-0x0;var _0x45faed=_0x0357[_0x518b99];return _0x45faed;};'use strict';var _=require(_0x7035('0x0'));var util=require(_0x7035('0x1'));var moment=require('moment');var BPromise=require(_0x7035('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7035('0x3'))['db'];var utils=require(_0x7035('0x4'));var logger=require(_0x7035('0x5'))(_0x7035('0x6'));var config=require(_0x7035('0x7'));var jayson=require(_0x7035('0x8'));var client=jayson[_0x7035('0x9')][_0x7035('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3401b7,_0x14551c,_0x4f35d5){return new BPromise(function(_0x383c94,_0x8609e){return client[_0x7035('0xb')](_0x3401b7,_0x4f35d5)[_0x7035('0xc')](function(_0x3478fc){logger[_0x7035('0xd')](_0x7035('0xe'),_0x14551c,'request\x20sent');logger[_0x7035('0xf')](_0x7035('0x10'),_0x14551c,_0x7035('0x11'),JSON[_0x7035('0x12')](_0x3478fc));if(_0x3478fc[_0x7035('0x13')]){if(_0x3478fc[_0x7035('0x13')][_0x7035('0x14')]===0x1f4){logger[_0x7035('0x13')](_0x7035('0xe'),_0x14551c,_0x3478fc['error']['message']);return _0x8609e(_0x3478fc[_0x7035('0x13')]['message']);}logger[_0x7035('0x13')](_0x7035('0xe'),_0x14551c,_0x3478fc[_0x7035('0x13')]['message']);return _0x383c94(_0x3478fc[_0x7035('0x13')][_0x7035('0x15')]);}else{logger['info']('UserOpenchannelQueue,\x20%s,\x20%s',_0x14551c,_0x7035('0x11'));_0x383c94(_0x3478fc[_0x7035('0x16')][_0x7035('0x15')]);}})[_0x7035('0x17')](function(_0x554447){logger[_0x7035('0x13')](_0x7035('0xe'),_0x14551c,_0x554447);_0x8609e(_0x554447);});});} \ No newline at end of file +var _0x4134=['code','message','result','catch','util','randomstring','ioredis','../../config/utils','../../config/logger','client','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','error'];(function(_0x271960,_0x129acd){var _0xe80d69=function(_0x4b1d59){while(--_0x4b1d59){_0x271960['push'](_0x271960['shift']());}};_0xe80d69(++_0x129acd);}(_0x4134,0x1c6));var _0x4413=function(_0x3c44de,_0xbc19f7){_0x3c44de=_0x3c44de-0x0;var _0x394764=_0x4134[_0x3c44de];return _0x394764;};'use strict';var _=require('lodash');var util=require(_0x4413('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4413('0x1'));var fs=require('fs');var Redis=require(_0x4413('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x4413('0x3'));var logger=require(_0x4413('0x4'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4413('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0x104165,_0x11cbec,_0x5653fc){return new BPromise(function(_0x567f95,_0x1411b5){return client[_0x4413('0x6')](_0x104165,_0x5653fc)[_0x4413('0x7')](function(_0x487741){logger[_0x4413('0x8')](_0x4413('0x9'),_0x11cbec,_0x4413('0xa'));logger[_0x4413('0xb')](_0x4413('0xc'),_0x11cbec,'request\x20sent',JSON['stringify'](_0x487741));if(_0x487741[_0x4413('0xd')]){if(_0x487741[_0x4413('0xd')][_0x4413('0xe')]===0x1f4){logger[_0x4413('0xd')](_0x4413('0x9'),_0x11cbec,_0x487741[_0x4413('0xd')][_0x4413('0xf')]);return _0x1411b5(_0x487741[_0x4413('0xd')][_0x4413('0xf')]);}logger[_0x4413('0xd')](_0x4413('0x9'),_0x11cbec,_0x487741[_0x4413('0xd')]['message']);return _0x567f95(_0x487741['error'][_0x4413('0xf')]);}else{logger[_0x4413('0x8')](_0x4413('0x9'),_0x11cbec,'request\x20sent');_0x567f95(_0x487741[_0x4413('0x10')][_0x4413('0xf')]);}})[_0x4413('0x11')](function(_0x92eec1){logger[_0x4413('0xd')](_0x4413('0x9'),_0x11cbec,_0x92eec1);_0x1411b5(_0x92eec1);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 664e88b..e8f9ebe 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 _0xaede=['../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','show','/:id/sections','getSections','/:id/resources','getResources','post','create','clone','addSections','addResources','put','/:id','delete','removeSections','removeResources','exports','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0x187223,_0x4f4d80){var _0x403947=function(_0x2a4f29){while(--_0x2a4f29){_0x187223['push'](_0x187223['shift']());}};_0x403947(++_0x4f4d80);}(_0xaede,0x11c));var _0xeaed=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xaede[_0xfae23b];return _0x200640;};'use strict';var multer=require(_0xeaed('0x0'));var util=require(_0xeaed('0x1'));var path=require(_0xeaed('0x2'));var timeout=require(_0xeaed('0x3'));var express=require('express');var router=express[_0xeaed('0x4')]();var fs_extra=require(_0xeaed('0x5'));var auth=require(_0xeaed('0x6'));var interaction=require(_0xeaed('0x7'));var config=require(_0xeaed('0x8'));var controller=require('./userProfile.controller');router['get']('/',auth[_0xeaed('0x9')](),controller[_0xeaed('0xa')]);router[_0xeaed('0xb')]('/describe',auth['isAuthenticated'](),controller[_0xeaed('0xc')]);router[_0xeaed('0xb')]('/:id',auth[_0xeaed('0x9')](),controller[_0xeaed('0xd')]);router[_0xeaed('0xb')](_0xeaed('0xe'),auth[_0xeaed('0x9')](),controller[_0xeaed('0xf')]);router[_0xeaed('0xb')](_0xeaed('0x10'),auth[_0xeaed('0x9')](),controller[_0xeaed('0x11')]);router[_0xeaed('0x12')]('/',auth['isAuthenticated'](),controller[_0xeaed('0x13')]);router['post']('/:id/clone',auth[_0xeaed('0x9')](),controller[_0xeaed('0x14')]);router[_0xeaed('0x12')](_0xeaed('0xe'),auth[_0xeaed('0x9')](),controller[_0xeaed('0x15')]);router[_0xeaed('0x12')](_0xeaed('0x10'),auth['isAuthenticated'](),controller[_0xeaed('0x16')]);router[_0xeaed('0x17')](_0xeaed('0x18'),auth[_0xeaed('0x9')](),controller['update']);router['delete'](_0xeaed('0x18'),auth[_0xeaed('0x9')](),controller['destroy']);router[_0xeaed('0x19')](_0xeaed('0xe'),auth[_0xeaed('0x9')](),controller[_0xeaed('0x1a')]);router[_0xeaed('0x19')](_0xeaed('0x10'),auth[_0xeaed('0x9')](),controller[_0xeaed('0x1b')]);module[_0xeaed('0x1c')]=router; \ No newline at end of file +var _0x8813=['express','Router','fs-extra','../../components/auth/service','../../config/environment','get','index','/describe','isAuthenticated','describe','show','/:id/sections','getSections','/:id/resources','getResources','post','/:id/clone','clone','addSections','put','update','delete','/:id','destroy','removeSections','multer','path','connect-timeout'];(function(_0x329f72,_0x161674){var _0x635cca=function(_0x317251){while(--_0x317251){_0x329f72['push'](_0x329f72['shift']());}};_0x635cca(++_0x161674);}(_0x8813,0xdd));var _0x3881=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8813[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x3881('0x0'));var util=require('util');var path=require(_0x3881('0x1'));var timeout=require(_0x3881('0x2'));var express=require(_0x3881('0x3'));var router=express[_0x3881('0x4')]();var fs_extra=require(_0x3881('0x5'));var auth=require(_0x3881('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x3881('0x7'));var controller=require('./userProfile.controller');router[_0x3881('0x8')]('/',auth['isAuthenticated'](),controller[_0x3881('0x9')]);router['get'](_0x3881('0xa'),auth[_0x3881('0xb')](),controller[_0x3881('0xc')]);router[_0x3881('0x8')]('/:id',auth[_0x3881('0xb')](),controller[_0x3881('0xd')]);router[_0x3881('0x8')](_0x3881('0xe'),auth[_0x3881('0xb')](),controller[_0x3881('0xf')]);router[_0x3881('0x8')](_0x3881('0x10'),auth[_0x3881('0xb')](),controller[_0x3881('0x11')]);router[_0x3881('0x12')]('/',auth[_0x3881('0xb')](),controller['create']);router[_0x3881('0x12')](_0x3881('0x13'),auth[_0x3881('0xb')](),controller[_0x3881('0x14')]);router[_0x3881('0x12')](_0x3881('0xe'),auth[_0x3881('0xb')](),controller[_0x3881('0x15')]);router[_0x3881('0x12')]('/:id/resources',auth[_0x3881('0xb')](),controller['addResources']);router[_0x3881('0x16')]('/:id',auth[_0x3881('0xb')](),controller[_0x3881('0x17')]);router[_0x3881('0x18')](_0x3881('0x19'),auth['isAuthenticated'](),controller[_0x3881('0x1a')]);router[_0x3881('0x18')]('/:id/sections',auth[_0x3881('0xb')](),controller[_0x3881('0x1b')]);router['delete']('/:id/resources',auth[_0x3881('0xb')](),controller['removeResources']);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 8789d09..3111c7e 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 _0x9758=['getDataValue','split','BOOLEAN','sequelize','exports','STRING','setDataValue','crudPermissions','join'];(function(_0x43380c,_0x1f8f3a){var _0x2b160d=function(_0x3707d2){while(--_0x3707d2){_0x43380c['push'](_0x43380c['shift']());}};_0x2b160d(++_0x1f8f3a);}(_0x9758,0x13e));var _0x8975=function(_0x143f38,_0x3fc28f){_0x143f38=_0x143f38-0x0;var _0x5d586b=_0x9758[_0x143f38];return _0x5d586b;};'use strict';var Sequelize=require(_0x8975('0x0'));module[_0x8975('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize[_0x8975('0x2')],'set':function(_0x2dde94){this[_0x8975('0x3')](_0x8975('0x4'),_0x2dde94?_0x2dde94[_0x8975('0x5')](''):[]);},'get':function(){return this[_0x8975('0x6')]('crudPermissions')?this['getDataValue'](_0x8975('0x4'))[_0x8975('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x8975('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x8975('0x8')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x8975('0x8')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x8975('0x8')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x8975('0x8')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x8975('0x8')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x8975('0x8')],'defaultValue':!![]}}; \ No newline at end of file +var _0x5feb=['join','getDataValue','BOOLEAN','sequelize','exports','STRING','setDataValue','crudPermissions'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x5feb,0x1f3));var _0xb5fe=function(_0x4164f2,_0x38669f){_0x4164f2=_0x4164f2-0x0;var _0x2575c7=_0x5feb[_0x4164f2];return _0x2575c7;};'use strict';var Sequelize=require(_0xb5fe('0x0'));module[_0xb5fe('0x1')]={'name':{'type':Sequelize[_0xb5fe('0x2')],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0xe906bd){this[_0xb5fe('0x3')](_0xb5fe('0x4'),_0xe906bd?_0xe906bd[_0xb5fe('0x5')](''):[]);},'get':function(){return this[_0xb5fe('0x6')]('crudPermissions')?this['getDataValue']('crudPermissions')['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xb5fe('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0xb5fe('0x7')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xb5fe('0x7')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xb5fe('0x7')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0xb5fe('0x7')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0xb5fe('0x7')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0xb5fe('0x7')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xb5fe('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 0cc9d4c..cde9142 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 _0x907d=['updatedAt','sequelize','transaction','params','each','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','UserProfileSection','describe','addSections','push','ids','getSections','includes','isEmpty','subsections','enabled','concat','forEach','resourceId','Plugin','addResources','bulkCreate','section','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','rimraf','request-promise','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','register','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','then','destroy','error','stack','name','send','UserProfile','type','model','map','keys','query','attributes','intersection','length','hasOwnProperty','nolimit','sort','where','filters','filter','merge','options','includeAll','include','findAll','catch','show','rawAttributes','fields','find','create','body','clone','get','omit','createdAt'];(function(_0x128549,_0x5682a8){var _0x4a3040=function(_0x5a2dd0){while(--_0x5a2dd0){_0x128549['push'](_0x128549['shift']());}};_0x4a3040(++_0x5682a8);}(_0x907d,0x83));var _0xd907=function(_0x2fc113,_0x45ec6e){_0x2fc113=_0x2fc113-0x0;var _0x5144ce=_0x907d[_0x2fc113];return _0x5144ce;};'use strict';var emlformat=require(_0xd907('0x0'));var rimraf=require(_0xd907('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xd907('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xd907('0x3'));var sox=require(_0xd907('0x4'));var csv=require(_0xd907('0x5'));var ejs=require(_0xd907('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xd907('0x7'));var crypto=require(_0xd907('0x8'));var jsforce=require(_0xd907('0x9'));var deskjs=require('desk.js');var toCsv=require(_0xd907('0x5'));var querystring=require(_0xd907('0xa'));var Papa=require(_0xd907('0xb'));var Redis=require(_0xd907('0xc'));var authService=require('../../components/auth/service');var qs=require(_0xd907('0xd'));var as=require(_0xd907('0xe'));var hardwareService=require(_0xd907('0xf'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xd907('0x10'));var licenseUtil=require(_0xd907('0x11'));var db=require(_0xd907('0x12'))['db'];config['redis']=_[_0xd907('0x13')](config[_0xd907('0x14')],{'host':_0xd907('0x15'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd907('0x14')]));require('./userProfile.socket')[_0xd907('0x16')](socket);function respondWithStatusCode(_0x53f848,_0x5678ab){_0x5678ab=_0x5678ab||0xcc;return function(_0x29a86b){if(_0x29a86b){return _0x53f848[_0xd907('0x17')](_0x5678ab);}return _0x53f848[_0xd907('0x18')](_0x5678ab)[_0xd907('0x19')]();};}function respondWithResult(_0x397eb5,_0x635004){_0x635004=_0x635004||0xc8;return function(_0x180dfb){if(_0x180dfb){return _0x397eb5[_0xd907('0x18')](_0x635004)['json'](_0x180dfb);}};}function respondWithFilteredResult(_0x4e45e6,_0xd987a9){return function(_0x313ed7){if(_0x313ed7){var _0x954781=typeof _0xd987a9[_0xd907('0x1a')]==='undefined'&&typeof _0xd987a9[_0xd907('0x1b')]===_0xd907('0x1c');var _0x3d86f8=_0x313ed7[_0xd907('0x1d')];var _0x4afb4c=_0x954781?0x0:_0xd987a9[_0xd907('0x1a')];var _0xab55a4=_0x954781?_0x313ed7['count']:_0xd987a9[_0xd907('0x1a')]+_0xd987a9[_0xd907('0x1b')];var _0x210c2e;if(_0xab55a4>=_0x3d86f8){_0xab55a4=_0x3d86f8;_0x210c2e=0xc8;}else{_0x210c2e=0xce;}_0x4e45e6[_0xd907('0x18')](_0x210c2e);return _0x4e45e6[_0xd907('0x1e')](_0xd907('0x1f'),_0x4afb4c+'-'+_0xab55a4+'/'+_0x3d86f8)[_0xd907('0x20')](_0x313ed7);}return null;};}function patchUpdates(_0x3ba325){return function(_0x1ff9ff){try{jsonpatch[_0xd907('0x21')](_0x1ff9ff,_0x3ba325,!![]);}catch(_0x36c9b3){return BPromise[_0xd907('0x22')](_0x36c9b3);}return _0x1ff9ff[_0xd907('0x23')]();};}function saveUpdates(_0x1c652e,_0x578b59){return function(_0x4d8678){if(_0x4d8678){return _0x4d8678['update'](_0x1c652e)[_0xd907('0x24')](function(_0x1a339a){return _0x1a339a;});}return null;};}function removeEntity(_0x32af75,_0x5dfaa3){return function(_0x465d8b){if(_0x465d8b){return _0x465d8b[_0xd907('0x25')]()[_0xd907('0x24')](function(){_0x32af75[_0xd907('0x18')](0xcc)[_0xd907('0x19')]();});}};}function handleEntityNotFound(_0x190c9b,_0x5a6450){return function(_0x21ad4b){if(!_0x21ad4b){_0x190c9b['sendStatus'](0x194);}return _0x21ad4b;};}function handleError(_0x1dea3a,_0x587d14){_0x587d14=_0x587d14||0x1f4;return function(_0x19485e){logger[_0xd907('0x26')](_0x19485e[_0xd907('0x27')]);if(_0x19485e['name']){delete _0x19485e[_0xd907('0x28')];}_0x1dea3a[_0xd907('0x18')](_0x587d14)[_0xd907('0x29')](_0x19485e);};}exports['index']=function(_0x3a436f,_0x54b7a7){var _0x2211b4={},_0x2e60c4={},_0x5f59ba={'count':0x0,'rows':[]};var _0x1f31cb=_['map'](db[_0xd907('0x2a')]['rawAttributes'],function(_0x5add3d){return{'name':_0x5add3d['fieldName'],'type':_0x5add3d[_0xd907('0x2b')]['key']};});_0x2e60c4[_0xd907('0x2c')]=_[_0xd907('0x2d')](_0x1f31cb,_0xd907('0x28'));_0x2e60c4['query']=_[_0xd907('0x2e')](_0x3a436f['query']);_0x2e60c4['filters']=_['intersection'](_0x2e60c4[_0xd907('0x2c')],_0x2e60c4[_0xd907('0x2f')]);_0x2211b4[_0xd907('0x30')]=_[_0xd907('0x31')](_0x2e60c4[_0xd907('0x2c')],qs['fields'](_0x3a436f[_0xd907('0x2f')]['fields']));_0x2211b4[_0xd907('0x30')]=_0x2211b4[_0xd907('0x30')][_0xd907('0x32')]?_0x2211b4[_0xd907('0x30')]:_0x2e60c4['model'];if(!_0x3a436f[_0xd907('0x2f')][_0xd907('0x33')](_0xd907('0x34'))){_0x2211b4[_0xd907('0x1b')]=qs[_0xd907('0x1b')](_0x3a436f[_0xd907('0x2f')]['limit']);_0x2211b4[_0xd907('0x1a')]=qs['offset'](_0x3a436f[_0xd907('0x2f')][_0xd907('0x1a')]);}_0x2211b4['order']=qs[_0xd907('0x35')](_0x3a436f[_0xd907('0x2f')]['sort']);_0x2211b4[_0xd907('0x36')]=qs[_0xd907('0x37')](_['pick'](_0x3a436f[_0xd907('0x2f')],_0x2e60c4[_0xd907('0x37')]),_0x1f31cb);if(_0x3a436f[_0xd907('0x2f')][_0xd907('0x38')]){_0x2211b4[_0xd907('0x36')]=_[_0xd907('0x39')](_0x2211b4[_0xd907('0x36')],{'$or':_[_0xd907('0x2d')](_0x1f31cb,function(_0xa0ffef){if(_0xa0ffef['type']!=='VIRTUAL'){var _0x2dd2fd={};_0x2dd2fd[_0xa0ffef['name']]={'$like':'%'+_0x3a436f[_0xd907('0x2f')][_0xd907('0x38')]+'%'};return _0x2dd2fd;}})});}_0x2211b4=_['merge']({},_0x2211b4,_0x3a436f[_0xd907('0x3a')]);var _0x72f89d={'where':_0x2211b4[_0xd907('0x36')]};return db['UserProfile'][_0xd907('0x1d')](_0x72f89d)[_0xd907('0x24')](function(_0x1ff5b3){_0x5f59ba['count']=_0x1ff5b3;if(_0x3a436f[_0xd907('0x2f')][_0xd907('0x3b')]){_0x2211b4[_0xd907('0x3c')]=[{'all':!![]}];}return db[_0xd907('0x2a')][_0xd907('0x3d')](_0x2211b4);})['then'](function(_0x46e007){_0x5f59ba['rows']=_0x46e007;return _0x5f59ba;})[_0xd907('0x24')](respondWithFilteredResult(_0x54b7a7,_0x2211b4))[_0xd907('0x3e')](handleError(_0x54b7a7,null));};exports[_0xd907('0x3f')]=function(_0x4c5baf,_0xa16bd5){var _0xf728ab={'raw':![],'where':{'id':_0x4c5baf['params']['id']}},_0x528266={};_0x528266[_0xd907('0x2c')]=_[_0xd907('0x2e')](db['UserProfile'][_0xd907('0x40')]);_0x528266['query']=_[_0xd907('0x2e')](_0x4c5baf['query']);_0x528266[_0xd907('0x37')]=_['intersection'](_0x528266[_0xd907('0x2c')],_0x528266[_0xd907('0x2f')]);_0xf728ab[_0xd907('0x30')]=_[_0xd907('0x31')](_0x528266[_0xd907('0x2c')],qs[_0xd907('0x41')](_0x4c5baf[_0xd907('0x2f')][_0xd907('0x41')]));_0xf728ab[_0xd907('0x30')]=_0xf728ab[_0xd907('0x30')][_0xd907('0x32')]?_0xf728ab[_0xd907('0x30')]:_0x528266[_0xd907('0x2c')];if(_0x4c5baf[_0xd907('0x2f')]['includeAll']){_0xf728ab[_0xd907('0x3c')]=[{'all':!![]}];}_0xf728ab=_['merge']({},_0xf728ab,_0x4c5baf[_0xd907('0x3a')]);return db[_0xd907('0x2a')][_0xd907('0x42')](_0xf728ab)[_0xd907('0x24')](handleEntityNotFound(_0xa16bd5,null))[_0xd907('0x24')](respondWithResult(_0xa16bd5,null))[_0xd907('0x3e')](handleError(_0xa16bd5,null));};exports[_0xd907('0x43')]=function(_0x3a0a2b,_0x54295b){return db['UserProfile'][_0xd907('0x43')](_0x3a0a2b[_0xd907('0x44')],{})[_0xd907('0x24')](respondWithResult(_0x54295b,0xc9))['catch'](handleError(_0x54295b,null));};exports[_0xd907('0x45')]=function(_0x35be12,_0x1c42cd){var _0x5ead23={'where':{'id':_0x35be12['params']['id']}},_0x44311e={};_0x44311e[_0xd907('0x2c')]=_[_0xd907('0x2e')](db[_0xd907('0x2a')][_0xd907('0x40')]);_0x5ead23['attributes']=_['intersection'](_0x44311e[_0xd907('0x2c')],qs[_0xd907('0x41')](_0x35be12['query'][_0xd907('0x41')]));_0x5ead23[_0xd907('0x30')]=_0x5ead23[_0xd907('0x30')][_0xd907('0x32')]?_0x5ead23[_0xd907('0x30')]:_0x44311e[_0xd907('0x2c')];if(_0x35be12[_0xd907('0x2f')]['includeAll']){_0x5ead23[_0xd907('0x3c')]=[{'all':!![]}];}_0x5ead23=_[_0xd907('0x39')]({},_0x5ead23,_0x35be12[_0xd907('0x3a')]);return db['UserProfile'][_0xd907('0x42')](_0x5ead23)[_0xd907('0x24')](handleEntityNotFound(_0x1c42cd,null))['then'](function(_0x452ceb){if(_0x452ceb){var _0x29fa31=_0x452ceb[_0xd907('0x46')]({'plain':!![]});_0x29fa31=qs[_0xd907('0x47')](_0x29fa31,['id',_0xd907('0x48'),_0xd907('0x49'),'crudPermissions']);_0x35be12[_0xd907('0x44')]=_['omit'](_0x35be12[_0xd907('0x44')],['id',_0xd907('0x48'),_0xd907('0x49')]);return db[_0xd907('0x4a')][_0xd907('0x4b')](function(_0x25fe46){return db[_0xd907('0x2a')][_0xd907('0x43')](_[_0xd907('0x39')](_0x29fa31,_0x35be12[_0xd907('0x44')]),{'include':_0x35be12[_0xd907('0x2f')][_0xd907('0x3b')]?[{'all':!![]}]:undefined,'transaction':_0x25fe46})[_0xd907('0x24')](function(_0x1536ad){var _0x1ed26c=_0x1536ad[_0xd907('0x46')]({'plain':!![]});return db['UserProfileSection'][_0xd907('0x3d')]({'where':{'userProfileId':_0x35be12[_0xd907('0x4c')]['id']},'raw':!![]})[_0xd907('0x24')](function(_0x53e8db){if(_0x53e8db){return BPromise[_0xd907('0x4d')](_0x53e8db,function(_0x59c07a){return new BPromise(function(_0x4c7330,_0x15f822){if(_0x59c07a[_0xd907('0x4e')]===null||_0x59c07a[_0xd907('0x4e')]===0x1)_0x4c7330(null);return db[_0xd907('0x4f')][_0xd907('0x3d')]({'where':{'sectionId':_0x59c07a['id']},'raw':!![]})[_0xd907('0x24')](function(_0x1f6c0b){var _0x12040d=_[_0xd907('0x2d')](_0x1f6c0b,function(_0xd75da7){return qs['omit'](_0xd75da7,['id',_0xd907('0x48'),_0xd907('0x49'),_0xd907('0x50')]);});_0x4c7330(_0x12040d);})['catch'](function(_0x1d98bc){_0x15f822(_0x1d98bc);});})[_0xd907('0x24')](function(_0x519ed9){var _0x51f76c=qs['omit'](_0x59c07a,['id',_0xd907('0x48'),_0xd907('0x49')]);_0x51f76c[_0xd907('0x51')]=_0x1ed26c['id'];if(_0x519ed9)_0x51f76c[_0xd907('0x52')]=_0x519ed9;return _0x51f76c;})[_0xd907('0x24')](function(_0x5c1ca6){return db[_0xd907('0x53')][_0xd907('0x43')](_0x5c1ca6,{'include':[{'model':db[_0xd907('0x4f')],'as':_0xd907('0x52')}],'raw':!![],'transaction':_0x25fe46});});})[_0xd907('0x24')](function(){return _0x1ed26c;});}});});});}})['then'](respondWithResult(_0x1c42cd,0xc9))[_0xd907('0x3e')](handleError(_0x1c42cd,null));};exports['update']=function(_0x91c422,_0x3b09e7){if(_0x91c422[_0xd907('0x44')]['id']){delete _0x91c422[_0xd907('0x44')]['id'];}return db[_0xd907('0x2a')][_0xd907('0x42')]({'where':{'id':_0x91c422['params']['id']}})['then'](handleEntityNotFound(_0x3b09e7,null))[_0xd907('0x24')](saveUpdates(_0x91c422[_0xd907('0x44')],null))['then'](respondWithResult(_0x3b09e7,null))['catch'](handleError(_0x3b09e7,null));};exports[_0xd907('0x25')]=function(_0x266732,_0x1fb98f){return db['UserProfile']['find']({'where':{'id':_0x266732[_0xd907('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1fb98f,null))[_0xd907('0x24')](removeEntity(_0x1fb98f,null))[_0xd907('0x3e')](handleError(_0x1fb98f,null));};exports[_0xd907('0x54')]=function(_0x385661,_0x170337){return db[_0xd907('0x2a')][_0xd907('0x54')]()[_0xd907('0x24')](respondWithResult(_0x170337,null))[_0xd907('0x3e')](handleError(_0x170337,null));};exports[_0xd907('0x55')]=function(_0x488fbc,_0x11192b){var _0xf42b9c=_0x488fbc[_0xd907('0x44')];return db[_0xd907('0x2a')]['find']({'where':{'id':_0x488fbc[_0xd907('0x4c')]['id']}})['then'](handleEntityNotFound(_0x11192b,null))['then'](function(_0xfe153f){if(_0xfe153f){return db[_0xd907('0x4a')]['transaction'](function(_0x392476){return db[_0xd907('0x53')][_0xd907('0x25')]({'where':{'userProfileId':_0x488fbc['params']['id'],'sectionId':_[_0xd907('0x2d')](_0xf42b9c,function(_0xe66532){return _0xe66532[_0xd907('0x50')];})},'transaction':_0x392476})[_0xd907('0x24')](function(){var _0x55ffa1=_[_0xd907('0x2d')](_0xf42b9c,function(_0xea7735){_0xea7735[_0xd907('0x51')]=_0x488fbc[_0xd907('0x4c')]['id'];return _0xea7735;});var _0x4d12de=[];return BPromise[_0xd907('0x4d')](_0x55ffa1,function(_0x27bd95){return db[_0xd907('0x53')][_0xd907('0x43')](_0x27bd95,{'include':[{'model':db[_0xd907('0x4f')],'as':_0xd907('0x52')}],'raw':!![],'transaction':_0x392476})['then'](function(_0x1822f0){_0x4d12de[_0xd907('0x56')](_0x1822f0['get']({'plain':!![]}));});})[_0xd907('0x24')](function(){return _0x4d12de;});});});}})['then'](function(_0x20027a){return _0x20027a;})[_0xd907('0x24')](respondWithResult(_0x11192b,null))['catch'](handleError(_0x11192b,null));};exports['removeSections']=function(_0xf5efc8,_0x4f625a){var _0x54d353;return db[_0xd907('0x2a')][_0xd907('0x42')]({'where':{'id':_0xf5efc8[_0xd907('0x4c')]['id']},'attributes':['id','name']})['then'](handleEntityNotFound(_0x4f625a,null))[_0xd907('0x24')](function(_0x4c79e3){if(_0x4c79e3){_0x54d353=_0x4c79e3;return db[_0xd907('0x53')][_0xd907('0x25')]({'where':{'userProfileId':_0xf5efc8[_0xd907('0x4c')]['id'],'sectionId':_0xf5efc8['query'][_0xd907('0x57')]}});}})[_0xd907('0x24')](function(){return _0x54d353;})[_0xd907('0x24')](respondWithStatusCode(_0x4f625a,null))[_0xd907('0x3e')](handleError(_0x4f625a,null));};exports[_0xd907('0x58')]=function(_0x26beaf,_0x3842c0){var _0x3ddb34=[];var _0x359c2b=[];return db['UserProfileSection'][_0xd907('0x3d')]({'where':{'userProfileId':_0x26beaf[_0xd907('0x4c')]['id']},'raw':!![]})['then'](function(_0x78b67e){_0x3ddb34=_[_0xd907('0x38')](_0x78b67e,function(_0x58910a){return _0x58910a['enabled']===0x1||_[_0xd907('0x59')]([0x3eb,0x709],_0x58910a[_0xd907('0x50')]);});if(!_[_0xd907('0x5a')](_0x3ddb34)){return _[_0xd907('0x2d')](_0x3ddb34,function(_0x53e2ed){return _0x53e2ed[_0xd907('0x50')];});}else{return;}})['then'](function(_0x5dae37){if(_0x5dae37)_0x359c2b=_0x5dae37;if(_[_0xd907('0x59')](_0x359c2b,0x64)){var _0x247c12=_[_0xd907('0x42')](_0x3ddb34,{'sectionId':0x64});return hasDefaultDashboard(_0x247c12)['then'](function(_0x33b606){return _[_0xd907('0x2d')](_0x3ddb34,function(_0x16147c){if(_0x16147c[_0xd907('0x50')]===0x64){_0x16147c[_0xd907('0x5b')]=_0x33b606;}return _0x16147c;});});}else{return;}})[_0xd907('0x24')](function(_0x52f2c4){if(_0x52f2c4)_0x3ddb34=_0x52f2c4;if(_[_0xd907('0x59')](_0x359c2b,0x3eb)){var _0x264bef=_['find'](_0x3ddb34,{'sectionId':0x3eb});return getCustomDashboards(_0x264bef)[_0xd907('0x24')](function(_0x32ac1f){return _['map'](_0x3ddb34,function(_0x2c306f){if(_0x264bef[_0xd907('0x5c')]){if(_0x2c306f['sectionId']===0x3eb){_0x2c306f[_0xd907('0x5b')]=_0x32ac1f;}}else{if(_0x2c306f[_0xd907('0x50')]===0x64){if(!_0x2c306f[_0xd907('0x5b')]){_0x2c306f[_0xd907('0x5b')]=[];}_0x2c306f[_0xd907('0x5b')]=_0x2c306f[_0xd907('0x5b')][_0xd907('0x5d')](_0x32ac1f);}}return _0x2c306f;});});}else{return;}})[_0xd907('0x24')](function(_0x51a75f){if(_0x51a75f)_0x3ddb34=_0x51a75f;if(_['includes'](_0x359c2b,0x709)){var _0x11aff4=_[_0xd907('0x42')](_0x3ddb34,{'sectionId':0x709});return getPlugins(_0x11aff4)[_0xd907('0x24')](function(_0x39164f){if(_0x11aff4[_0xd907('0x5c')]){return _[_0xd907('0x2d')](_0x3ddb34,function(_0x2b8332){if(_0x2b8332[_0xd907('0x50')]===0x709){_0x2b8332['subsections']=_0x39164f;}return _0x2b8332;});}else{var _0x10c561={'sectionId':0x76c,'enabled':0x1,'subsections':_0x39164f};var _0x43bc42=_['map'](_0x3ddb34);_0x43bc42['push'](_0x10c561);return _0x43bc42;}});}else{return;}})[_0xd907('0x24')](function(_0x2bd643){if(_0x2bd643)_0x3ddb34=_0x2bd643;return _[_0xd907('0x38')](_0x3ddb34,[_0xd907('0x5c'),0x1]);})['then'](respondWithResult(_0x3842c0,null))[_0xd907('0x3e')](handleError(_0x3842c0,null));};function hasDefaultDashboard(_0x27341b){var _0x40a8f0=[0x65];return new BPromise(function(_0x37af6c,_0x5493a8){try{if(_0x27341b[_0xd907('0x4e')]){_0x37af6c(_0x40a8f0);}else{return db[_0xd907('0x4f')]['findOne']({'where':{'sectionId':_0x27341b['id']},'raw':!![]})['then'](function(_0x106a33){_0x106a33?_0x37af6c(_0x40a8f0):_0x37af6c();});}}catch(_0x35a61f){_0x5493a8(_0x35a61f);}});}function getCustomDashboards(_0x25a296){var _0x144ca8=[];return new BPromise(function(_0x435a25,_0x4c2f83){try{if(_0x25a296['autoAssociation']){return db['Dashboard']['findAll']({'raw':!![]})[_0xd907('0x24')](function(_0x315db2){_0x315db2[_0xd907('0x5e')](function(_0x59e278){_0x144ca8[_0xd907('0x56')](_0x59e278['id']+0x1869f);});_0x435a25(_0x144ca8);});}else{return db['UserProfileResource'][_0xd907('0x3d')]({'where':{'sectionId':_0x25a296['id']},'raw':!![]})[_0xd907('0x24')](function(_0x2fc1a7){_0x2fc1a7[_0xd907('0x5e')](function(_0x2a8c7d){_0x144ca8[_0xd907('0x56')](_0x2a8c7d[_0xd907('0x5f')]+0x1869f);});_0x435a25(_0x144ca8);});}}catch(_0x1095c5){_0x4c2f83(_0x1095c5);}});}function getPlugins(_0x4bd2f4){var _0x138e00=[];return new BPromise(function(_0x430ab2,_0x2529a4){try{if(_0x4bd2f4['autoAssociation']){return db[_0xd907('0x60')]['findAll']({'raw':!![]})[_0xd907('0x24')](function(_0x1df492){_0x1df492[_0xd907('0x5e')](function(_0x41070c){_0x138e00[_0xd907('0x56')](_0x41070c['id']+0x15b38);});_0x430ab2(_0x138e00);});}else{return db[_0xd907('0x4f')][_0xd907('0x3d')]({'where':{'sectionId':_0x4bd2f4['id']},'raw':!![]})[_0xd907('0x24')](function(_0x296f65){_0x296f65[_0xd907('0x5e')](function(_0x223f66){_0x138e00[_0xd907('0x56')](_0x223f66[_0xd907('0x5f')]+0x15b38);});_0x430ab2(_0x138e00);});}}catch(_0x225e8b){_0x2529a4(_0x225e8b);}});}exports[_0xd907('0x61')]=function(_0x41b2ea,_0x4b69bf){return db[_0xd907('0x2a')][_0xd907('0x42')]({'where':{'id':_0x41b2ea[_0xd907('0x4c')]['id']}})[_0xd907('0x24')](handleEntityNotFound(_0x4b69bf,null))[_0xd907('0x24')](function(_0x80fced){if(_0x80fced){return db[_0xd907('0x4a')][_0xd907('0x4b')](function(_0x5a0f68){return db['UserProfileSection'][_0xd907('0x3d')]({'where':{'userProfileId':_0x41b2ea[_0xd907('0x4c')]['id']},'attributes':['id'],'raw':!![]})[_0xd907('0x24')](function(_0x42d10a){if(_0x42d10a){return db[_0xd907('0x53')][_0xd907('0x25')]({'where':{'userProfileId':_0x41b2ea[_0xd907('0x4c')]['id'],'id':_[_0xd907('0x2d')](_0x42d10a,function(_0x11ebf4){return _0x11ebf4['id'];})},'transaction':_0x5a0f68});}})['then'](function(_0x150011){var _0x233ebc=_[_0xd907('0x2d')](_0x41b2ea[_0xd907('0x44')],function(_0x3270e7){_0x3270e7[_0xd907('0x51')]=_0x41b2ea[_0xd907('0x4c')]['id'];return _0x3270e7;});return db[_0xd907('0x53')][_0xd907('0x62')](_0x233ebc,{'raw':!![],'transaction':_0x5a0f68});})[_0xd907('0x24')](function(_0x48c577){var _0x4c194c=_[_0xd907('0x38')](_[_0xd907('0x2d')](_0x48c577,function(_0x38c47f){return _0x38c47f[_0xd907('0x46')]({'plain':!![]});}),{'includeAll':![]});if(_0x4c194c){return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x41b2ea['params']['id'],'sectionId':_[_0xd907('0x2d')](_0x4c194c,function(_0x26ee2c){return _0x26ee2c['sectionId'];})},'attributes':['id','sectionId'],'raw':!![]})[_0xd907('0x24')](function(_0x4d46ad){var _0x135306=_[_0xd907('0x2d')](_0x41b2ea['body'],function(_0x59563e){_0x59563e[_0xd907('0x51')]=_0x41b2ea['params']['id'];return _0x59563e;});return db['UserProfileResource'][_0xd907('0x62')](_0x135306,{'raw':!![],'transaction':_0x5a0f68});});}})['catch'](handleError(_0x4b69bf,null));});}})[_0xd907('0x24')](function(_0x53c0d1){var _0x3e4ecc=_[_0xd907('0x2d')](_0x53c0d1,function(_0x323846){return _0x323846[_0xd907('0x46')]({'plain':!![]});});})[_0xd907('0x24')](respondWithResult(_0x4b69bf,null))[_0xd907('0x3e')](handleError(_0x4b69bf,null));};exports['removeResources']=function(_0x1a5c7e,_0x2ebc3b,_0x2a569f){return db['UserProfile'][_0xd907('0x42')]({'where':{'id':_0x1a5c7e[_0xd907('0x4c')]['id']}})['then'](handleEntityNotFound(_0x2ebc3b,null))['then'](function(_0x5f3c46){if(_0x5f3c46){return _0x5f3c46['removeResources'](_0x1a5c7e['query'][_0xd907('0x57')]);}})['then'](respondWithStatusCode(_0x2ebc3b,null))['catch'](handleError(_0x2ebc3b,null));};exports['getResources']=function(_0x299b3b,_0x36949a){var _0x3fe700={};if(!_0x299b3b['query'][_0xd907('0x63')])throw new Error(_0xd907('0x64'));if(!_0x299b3b['query']['hasOwnProperty']('nolimit')){_0x3fe700[_0xd907('0x1b')]=qs[_0xd907('0x1b')](_0x299b3b[_0xd907('0x2f')]['limit']);_0x3fe700[_0xd907('0x1a')]=qs[_0xd907('0x1a')](_0x299b3b[_0xd907('0x2f')]['offset']);}return db['UserProfile'][_0xd907('0x42')]({'where':{'id':_0x299b3b[_0xd907('0x4c')]['id']}})[_0xd907('0x24')](function(_0xcbafda){if(!_0xcbafda)throw new Error(_0xd907('0x65')+_0x299b3b[_0xd907('0x4c')]['id']);return db[_0xd907('0x2a')]['getResources'](_0x299b3b);})[_0xd907('0x24')](respondWithFilteredResult(_0x36949a,_0x3fe700))[_0xd907('0x3e')](handleError(_0x36949a,null));}; \ No newline at end of file +var _0x75f1=['addResources','bulkCreate','removeResources','section','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','getResources','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','offset','undefined','count','set','json','apply','save','update','then','destroy','error','stack','name','send','map','UserProfile','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','includeAll','findAll','rows','catch','params','include','merge','options','create','body','clone','get','omit','crudPermissions','updatedAt','sequelize','transaction','UserProfileSection','each','autoAssociation','createdAt','sectionId','Resources','find','describe','addSections','userProfileId','UserProfileResource','push','enabled','includes','subsections','concat','findOne','Dashboard','resourceId','Plugin'];(function(_0x4eb746,_0x4202c4){var _0x26094a=function(_0x493485){while(--_0x493485){_0x4eb746['push'](_0x4eb746['shift']());}};_0x26094a(++_0x4202c4);}(_0x75f1,0x1db));var _0x175f=function(_0x36daf3,_0x2ea0dd){_0x36daf3=_0x36daf3-0x0;var _0x3e4e26=_0x75f1[_0x36daf3];return _0x3e4e26;};'use strict';var emlformat=require(_0x175f('0x0'));var rimraf=require(_0x175f('0x1'));var zipdir=require(_0x175f('0x2'));var jsonpatch=require(_0x175f('0x3'));var rp=require(_0x175f('0x4'));var moment=require(_0x175f('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x175f('0x6'));var util=require(_0x175f('0x7'));var path=require(_0x175f('0x8'));var sox=require(_0x175f('0x9'));var csv=require('to-csv');var ejs=require(_0x175f('0xa'));var fs=require('fs');var fs_extra=require(_0x175f('0xb'));var _=require(_0x175f('0xc'));var squel=require(_0x175f('0xd'));var crypto=require(_0x175f('0xe'));var jsforce=require(_0x175f('0xf'));var deskjs=require(_0x175f('0x10'));var toCsv=require(_0x175f('0x11'));var querystring=require(_0x175f('0x12'));var Papa=require('papaparse');var Redis=require(_0x175f('0x13'));var authService=require(_0x175f('0x14'));var qs=require(_0x175f('0x15'));var as=require(_0x175f('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x175f('0x17'))(_0x175f('0x18'));var utils=require(_0x175f('0x19'));var config=require(_0x175f('0x1a'));var licenseUtil=require(_0x175f('0x1b'));var db=require(_0x175f('0x1c'))['db'];config[_0x175f('0x1d')]=_[_0x175f('0x1e')](config[_0x175f('0x1d')],{'host':_0x175f('0x1f'),'port':0x18eb});var socket=require(_0x175f('0x20'))(new Redis(config[_0x175f('0x1d')]));require('./userProfile.socket')[_0x175f('0x21')](socket);function respondWithStatusCode(_0x18fa2d,_0x5472ac){_0x5472ac=_0x5472ac||0xcc;return function(_0x271c59){if(_0x271c59){return _0x18fa2d[_0x175f('0x22')](_0x5472ac);}return _0x18fa2d[_0x175f('0x23')](_0x5472ac)[_0x175f('0x24')]();};}function respondWithResult(_0x357cc9,_0x2e3432){_0x2e3432=_0x2e3432||0xc8;return function(_0x471c64){if(_0x471c64){return _0x357cc9[_0x175f('0x23')](_0x2e3432)['json'](_0x471c64);}};}function respondWithFilteredResult(_0x8b1462,_0x3c57a8){return function(_0x27f9f7){if(_0x27f9f7){var _0x159aee=typeof _0x3c57a8[_0x175f('0x25')]===_0x175f('0x26')&&typeof _0x3c57a8['limit']==='undefined';var _0x524ba2=_0x27f9f7['count'];var _0x16d87f=_0x159aee?0x0:_0x3c57a8['offset'];var _0x5b280f=_0x159aee?_0x27f9f7[_0x175f('0x27')]:_0x3c57a8[_0x175f('0x25')]+_0x3c57a8['limit'];var _0x4bd9af;if(_0x5b280f>=_0x524ba2){_0x5b280f=_0x524ba2;_0x4bd9af=0xc8;}else{_0x4bd9af=0xce;}_0x8b1462[_0x175f('0x23')](_0x4bd9af);return _0x8b1462[_0x175f('0x28')]('Content-Range',_0x16d87f+'-'+_0x5b280f+'/'+_0x524ba2)[_0x175f('0x29')](_0x27f9f7);}return null;};}function patchUpdates(_0xfc65c){return function(_0x18a154){try{jsonpatch[_0x175f('0x2a')](_0x18a154,_0xfc65c,!![]);}catch(_0x3c8c40){return BPromise['reject'](_0x3c8c40);}return _0x18a154[_0x175f('0x2b')]();};}function saveUpdates(_0xa2dd2e,_0x5b3ab1){return function(_0x19d988){if(_0x19d988){return _0x19d988[_0x175f('0x2c')](_0xa2dd2e)[_0x175f('0x2d')](function(_0xb58ad0){return _0xb58ad0;});}return null;};}function removeEntity(_0x463e0a,_0x1bcc14){return function(_0x4e92cf){if(_0x4e92cf){return _0x4e92cf[_0x175f('0x2e')]()['then'](function(){_0x463e0a[_0x175f('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39cd8a,_0x108339){return function(_0xef7854){if(!_0xef7854){_0x39cd8a[_0x175f('0x22')](0x194);}return _0xef7854;};}function handleError(_0x1b3ffe,_0x4ff86d){_0x4ff86d=_0x4ff86d||0x1f4;return function(_0x452949){logger[_0x175f('0x2f')](_0x452949[_0x175f('0x30')]);if(_0x452949[_0x175f('0x31')]){delete _0x452949[_0x175f('0x31')];}_0x1b3ffe[_0x175f('0x23')](_0x4ff86d)[_0x175f('0x32')](_0x452949);};}exports['index']=function(_0x23d0bf,_0x5c1387){var _0x2cd787={},_0x1eeae8={},_0x5a15a7={'count':0x0,'rows':[]};var _0x30d1ee=_[_0x175f('0x33')](db[_0x175f('0x34')][_0x175f('0x35')],function(_0x4cdde7){return{'name':_0x4cdde7[_0x175f('0x36')],'type':_0x4cdde7[_0x175f('0x37')][_0x175f('0x38')]};});_0x1eeae8[_0x175f('0x39')]=_[_0x175f('0x33')](_0x30d1ee,_0x175f('0x31'));_0x1eeae8[_0x175f('0x3a')]=_[_0x175f('0x3b')](_0x23d0bf['query']);_0x1eeae8[_0x175f('0x3c')]=_['intersection'](_0x1eeae8['model'],_0x1eeae8[_0x175f('0x3a')]);_0x2cd787[_0x175f('0x3d')]=_[_0x175f('0x3e')](_0x1eeae8[_0x175f('0x39')],qs[_0x175f('0x3f')](_0x23d0bf[_0x175f('0x3a')][_0x175f('0x3f')]));_0x2cd787[_0x175f('0x3d')]=_0x2cd787[_0x175f('0x3d')][_0x175f('0x40')]?_0x2cd787[_0x175f('0x3d')]:_0x1eeae8[_0x175f('0x39')];if(!_0x23d0bf[_0x175f('0x3a')][_0x175f('0x41')](_0x175f('0x42'))){_0x2cd787[_0x175f('0x43')]=qs['limit'](_0x23d0bf[_0x175f('0x3a')][_0x175f('0x43')]);_0x2cd787[_0x175f('0x25')]=qs['offset'](_0x23d0bf[_0x175f('0x3a')]['offset']);}_0x2cd787[_0x175f('0x44')]=qs[_0x175f('0x45')](_0x23d0bf[_0x175f('0x3a')]['sort']);_0x2cd787[_0x175f('0x46')]=qs['filters'](_[_0x175f('0x47')](_0x23d0bf[_0x175f('0x3a')],_0x1eeae8['filters']),_0x30d1ee);if(_0x23d0bf[_0x175f('0x3a')][_0x175f('0x48')]){_0x2cd787[_0x175f('0x46')]=_['merge'](_0x2cd787[_0x175f('0x46')],{'$or':_[_0x175f('0x33')](_0x30d1ee,function(_0x45547d){if(_0x45547d[_0x175f('0x37')]!=='VIRTUAL'){var _0x26fafb={};_0x26fafb[_0x45547d[_0x175f('0x31')]]={'$like':'%'+_0x23d0bf[_0x175f('0x3a')]['filter']+'%'};return _0x26fafb;}})});}_0x2cd787=_['merge']({},_0x2cd787,_0x23d0bf['options']);var _0x5df965={'where':_0x2cd787['where']};return db['UserProfile'][_0x175f('0x27')](_0x5df965)[_0x175f('0x2d')](function(_0x1f466b){_0x5a15a7[_0x175f('0x27')]=_0x1f466b;if(_0x23d0bf[_0x175f('0x3a')][_0x175f('0x49')]){_0x2cd787['include']=[{'all':!![]}];}return db[_0x175f('0x34')][_0x175f('0x4a')](_0x2cd787);})['then'](function(_0x7f790e){_0x5a15a7[_0x175f('0x4b')]=_0x7f790e;return _0x5a15a7;})[_0x175f('0x2d')](respondWithFilteredResult(_0x5c1387,_0x2cd787))[_0x175f('0x4c')](handleError(_0x5c1387,null));};exports['show']=function(_0x7c7d7b,_0x34020f){var _0x5d6bc5={'raw':![],'where':{'id':_0x7c7d7b[_0x175f('0x4d')]['id']}},_0x15cdfa={};_0x15cdfa['model']=_[_0x175f('0x3b')](db[_0x175f('0x34')][_0x175f('0x35')]);_0x15cdfa[_0x175f('0x3a')]=_['keys'](_0x7c7d7b['query']);_0x15cdfa[_0x175f('0x3c')]=_[_0x175f('0x3e')](_0x15cdfa[_0x175f('0x39')],_0x15cdfa[_0x175f('0x3a')]);_0x5d6bc5[_0x175f('0x3d')]=_[_0x175f('0x3e')](_0x15cdfa[_0x175f('0x39')],qs[_0x175f('0x3f')](_0x7c7d7b['query'][_0x175f('0x3f')]));_0x5d6bc5[_0x175f('0x3d')]=_0x5d6bc5[_0x175f('0x3d')][_0x175f('0x40')]?_0x5d6bc5[_0x175f('0x3d')]:_0x15cdfa['model'];if(_0x7c7d7b[_0x175f('0x3a')]['includeAll']){_0x5d6bc5[_0x175f('0x4e')]=[{'all':!![]}];}_0x5d6bc5=_[_0x175f('0x4f')]({},_0x5d6bc5,_0x7c7d7b[_0x175f('0x50')]);return db[_0x175f('0x34')]['find'](_0x5d6bc5)['then'](handleEntityNotFound(_0x34020f,null))[_0x175f('0x2d')](respondWithResult(_0x34020f,null))[_0x175f('0x4c')](handleError(_0x34020f,null));};exports[_0x175f('0x51')]=function(_0x244577,_0x519e91){return db['UserProfile'][_0x175f('0x51')](_0x244577[_0x175f('0x52')],{})[_0x175f('0x2d')](respondWithResult(_0x519e91,0xc9))[_0x175f('0x4c')](handleError(_0x519e91,null));};exports[_0x175f('0x53')]=function(_0x50dcdf,_0x2cb826){var _0x40747a={'where':{'id':_0x50dcdf['params']['id']}},_0x2bba6e={};_0x2bba6e[_0x175f('0x39')]=_[_0x175f('0x3b')](db[_0x175f('0x34')][_0x175f('0x35')]);_0x40747a[_0x175f('0x3d')]=_[_0x175f('0x3e')](_0x2bba6e['model'],qs[_0x175f('0x3f')](_0x50dcdf[_0x175f('0x3a')][_0x175f('0x3f')]));_0x40747a['attributes']=_0x40747a[_0x175f('0x3d')][_0x175f('0x40')]?_0x40747a['attributes']:_0x2bba6e['model'];if(_0x50dcdf[_0x175f('0x3a')]['includeAll']){_0x40747a[_0x175f('0x4e')]=[{'all':!![]}];}_0x40747a=_[_0x175f('0x4f')]({},_0x40747a,_0x50dcdf[_0x175f('0x50')]);return db['UserProfile']['find'](_0x40747a)[_0x175f('0x2d')](handleEntityNotFound(_0x2cb826,null))[_0x175f('0x2d')](function(_0x54bc66){if(_0x54bc66){var _0x181748=_0x54bc66[_0x175f('0x54')]({'plain':!![]});_0x181748=qs[_0x175f('0x55')](_0x181748,['id','createdAt','updatedAt',_0x175f('0x56')]);_0x50dcdf[_0x175f('0x52')]=_['omit'](_0x50dcdf[_0x175f('0x52')],['id','createdAt',_0x175f('0x57')]);return db[_0x175f('0x58')][_0x175f('0x59')](function(_0x3a0baa){return db['UserProfile'][_0x175f('0x51')](_[_0x175f('0x4f')](_0x181748,_0x50dcdf[_0x175f('0x52')]),{'include':_0x50dcdf[_0x175f('0x3a')][_0x175f('0x49')]?[{'all':!![]}]:undefined,'transaction':_0x3a0baa})[_0x175f('0x2d')](function(_0x2268b1){var _0x29cd3e=_0x2268b1[_0x175f('0x54')]({'plain':!![]});return db[_0x175f('0x5a')][_0x175f('0x4a')]({'where':{'userProfileId':_0x50dcdf[_0x175f('0x4d')]['id']},'raw':!![]})[_0x175f('0x2d')](function(_0x2c822e){if(_0x2c822e){return BPromise[_0x175f('0x5b')](_0x2c822e,function(_0x43a53a){return new BPromise(function(_0x5b79cb,_0x1b9b21){if(_0x43a53a['autoAssociation']===null||_0x43a53a[_0x175f('0x5c')]===0x1)_0x5b79cb(null);return db['UserProfileResource'][_0x175f('0x4a')]({'where':{'sectionId':_0x43a53a['id']},'raw':!![]})[_0x175f('0x2d')](function(_0x15f855){var _0xc8d9d9=_['map'](_0x15f855,function(_0x328d62){return qs[_0x175f('0x55')](_0x328d62,['id',_0x175f('0x5d'),'updatedAt',_0x175f('0x5e')]);});_0x5b79cb(_0xc8d9d9);})[_0x175f('0x4c')](function(_0x367d58){_0x1b9b21(_0x367d58);});})[_0x175f('0x2d')](function(_0x588151){var _0x1b4643=qs[_0x175f('0x55')](_0x43a53a,['id',_0x175f('0x5d'),_0x175f('0x57')]);_0x1b4643['userProfileId']=_0x29cd3e['id'];if(_0x588151)_0x1b4643[_0x175f('0x5f')]=_0x588151;return _0x1b4643;})[_0x175f('0x2d')](function(_0x46904a){return db['UserProfileSection'][_0x175f('0x51')](_0x46904a,{'include':[{'model':db['UserProfileResource'],'as':_0x175f('0x5f')}],'raw':!![],'transaction':_0x3a0baa});});})[_0x175f('0x2d')](function(){return _0x29cd3e;});}});});});}})[_0x175f('0x2d')](respondWithResult(_0x2cb826,0xc9))[_0x175f('0x4c')](handleError(_0x2cb826,null));};exports['update']=function(_0x3b37a8,_0x4c8570){if(_0x3b37a8[_0x175f('0x52')]['id']){delete _0x3b37a8[_0x175f('0x52')]['id'];}return db[_0x175f('0x34')][_0x175f('0x60')]({'where':{'id':_0x3b37a8['params']['id']}})['then'](handleEntityNotFound(_0x4c8570,null))['then'](saveUpdates(_0x3b37a8[_0x175f('0x52')],null))[_0x175f('0x2d')](respondWithResult(_0x4c8570,null))[_0x175f('0x4c')](handleError(_0x4c8570,null));};exports['destroy']=function(_0x10dfce,_0x49b00a){return db[_0x175f('0x34')][_0x175f('0x60')]({'where':{'id':_0x10dfce[_0x175f('0x4d')]['id']}})[_0x175f('0x2d')](handleEntityNotFound(_0x49b00a,null))[_0x175f('0x2d')](removeEntity(_0x49b00a,null))[_0x175f('0x4c')](handleError(_0x49b00a,null));};exports[_0x175f('0x61')]=function(_0x1caf22,_0xbb0d73){return db[_0x175f('0x34')]['describe']()['then'](respondWithResult(_0xbb0d73,null))['catch'](handleError(_0xbb0d73,null));};exports[_0x175f('0x62')]=function(_0x18e826,_0x40cb5d){var _0x301bba=_0x18e826[_0x175f('0x52')];return db[_0x175f('0x34')][_0x175f('0x60')]({'where':{'id':_0x18e826[_0x175f('0x4d')]['id']}})['then'](handleEntityNotFound(_0x40cb5d,null))[_0x175f('0x2d')](function(_0x549762){if(_0x549762){return db[_0x175f('0x58')][_0x175f('0x59')](function(_0x2ec3e9){return db[_0x175f('0x5a')][_0x175f('0x2e')]({'where':{'userProfileId':_0x18e826[_0x175f('0x4d')]['id'],'sectionId':_[_0x175f('0x33')](_0x301bba,function(_0x585b29){return _0x585b29['sectionId'];})},'transaction':_0x2ec3e9})['then'](function(){var _0x4c5400=_[_0x175f('0x33')](_0x301bba,function(_0xadd38f){_0xadd38f[_0x175f('0x63')]=_0x18e826[_0x175f('0x4d')]['id'];return _0xadd38f;});var _0x1b5b46=[];return BPromise[_0x175f('0x5b')](_0x4c5400,function(_0x15e0a7){return db['UserProfileSection'][_0x175f('0x51')](_0x15e0a7,{'include':[{'model':db[_0x175f('0x64')],'as':_0x175f('0x5f')}],'raw':!![],'transaction':_0x2ec3e9})[_0x175f('0x2d')](function(_0x5d2d53){_0x1b5b46[_0x175f('0x65')](_0x5d2d53[_0x175f('0x54')]({'plain':!![]}));});})[_0x175f('0x2d')](function(){return _0x1b5b46;});});});}})[_0x175f('0x2d')](function(_0x462559){return _0x462559;})[_0x175f('0x2d')](respondWithResult(_0x40cb5d,null))['catch'](handleError(_0x40cb5d,null));};exports['removeSections']=function(_0x4e59cf,_0x5e0ebe){var _0x3f8256;return db[_0x175f('0x34')][_0x175f('0x60')]({'where':{'id':_0x4e59cf[_0x175f('0x4d')]['id']},'attributes':['id',_0x175f('0x31')]})[_0x175f('0x2d')](handleEntityNotFound(_0x5e0ebe,null))[_0x175f('0x2d')](function(_0x40c6ca){if(_0x40c6ca){_0x3f8256=_0x40c6ca;return db[_0x175f('0x5a')][_0x175f('0x2e')]({'where':{'userProfileId':_0x4e59cf[_0x175f('0x4d')]['id'],'sectionId':_0x4e59cf['query']['ids']}});}})['then'](function(){return _0x3f8256;})[_0x175f('0x2d')](respondWithStatusCode(_0x5e0ebe,null))['catch'](handleError(_0x5e0ebe,null));};exports['getSections']=function(_0x266499,_0x1f94ba){var _0x3f9319=[];var _0x4eb8f1=[];return db[_0x175f('0x5a')][_0x175f('0x4a')]({'where':{'userProfileId':_0x266499[_0x175f('0x4d')]['id']},'raw':!![]})[_0x175f('0x2d')](function(_0x31c425){_0x3f9319=_[_0x175f('0x48')](_0x31c425,function(_0x504464){return _0x504464[_0x175f('0x66')]===0x1||_[_0x175f('0x67')]([0x3eb,0x709],_0x504464[_0x175f('0x5e')]);});if(!_['isEmpty'](_0x3f9319)){return _[_0x175f('0x33')](_0x3f9319,function(_0xf41353){return _0xf41353['sectionId'];});}else{return;}})[_0x175f('0x2d')](function(_0x913ce8){if(_0x913ce8)_0x4eb8f1=_0x913ce8;if(_['includes'](_0x4eb8f1,0x64)){var _0x4f5753=_[_0x175f('0x60')](_0x3f9319,{'sectionId':0x64});return hasDefaultDashboard(_0x4f5753)[_0x175f('0x2d')](function(_0x2d6e2a){return _[_0x175f('0x33')](_0x3f9319,function(_0x1d5f21){if(_0x1d5f21[_0x175f('0x5e')]===0x64){_0x1d5f21['subsections']=_0x2d6e2a;}return _0x1d5f21;});});}else{return;}})[_0x175f('0x2d')](function(_0x3177fe){if(_0x3177fe)_0x3f9319=_0x3177fe;if(_['includes'](_0x4eb8f1,0x3eb)){var _0x374864=_[_0x175f('0x60')](_0x3f9319,{'sectionId':0x3eb});return getCustomDashboards(_0x374864)[_0x175f('0x2d')](function(_0x2779be){return _['map'](_0x3f9319,function(_0x2b0cf1){if(_0x374864[_0x175f('0x66')]){if(_0x2b0cf1['sectionId']===0x3eb){_0x2b0cf1[_0x175f('0x68')]=_0x2779be;}}else{if(_0x2b0cf1[_0x175f('0x5e')]===0x64){if(!_0x2b0cf1[_0x175f('0x68')]){_0x2b0cf1[_0x175f('0x68')]=[];}_0x2b0cf1[_0x175f('0x68')]=_0x2b0cf1['subsections'][_0x175f('0x69')](_0x2779be);}}return _0x2b0cf1;});});}else{return;}})[_0x175f('0x2d')](function(_0x3d16ea){if(_0x3d16ea)_0x3f9319=_0x3d16ea;if(_['includes'](_0x4eb8f1,0x709)){var _0x2dfac0=_[_0x175f('0x60')](_0x3f9319,{'sectionId':0x709});return getPlugins(_0x2dfac0)[_0x175f('0x2d')](function(_0x105b6f){if(_0x2dfac0[_0x175f('0x66')]){return _[_0x175f('0x33')](_0x3f9319,function(_0x11dc0a){if(_0x11dc0a['sectionId']===0x709){_0x11dc0a['subsections']=_0x105b6f;}return _0x11dc0a;});}else{var _0x54e6f1={'sectionId':0x76c,'enabled':0x1,'subsections':_0x105b6f};var _0x1519ba=_[_0x175f('0x33')](_0x3f9319);_0x1519ba[_0x175f('0x65')](_0x54e6f1);return _0x1519ba;}});}else{return;}})[_0x175f('0x2d')](function(_0x4eaf1f){if(_0x4eaf1f)_0x3f9319=_0x4eaf1f;return _[_0x175f('0x48')](_0x3f9319,[_0x175f('0x66'),0x1]);})[_0x175f('0x2d')](respondWithResult(_0x1f94ba,null))['catch'](handleError(_0x1f94ba,null));};function hasDefaultDashboard(_0x521e80){var _0x3a5b98=[0x65];return new BPromise(function(_0x49afc5,_0x220bd1){try{if(_0x521e80[_0x175f('0x5c')]){_0x49afc5(_0x3a5b98);}else{return db[_0x175f('0x64')][_0x175f('0x6a')]({'where':{'sectionId':_0x521e80['id']},'raw':!![]})[_0x175f('0x2d')](function(_0x298c13){_0x298c13?_0x49afc5(_0x3a5b98):_0x49afc5();});}}catch(_0x2de488){_0x220bd1(_0x2de488);}});}function getCustomDashboards(_0x377d26){var _0x514f1e=[];return new BPromise(function(_0x703f66,_0x4db72c){try{if(_0x377d26[_0x175f('0x5c')]){return db[_0x175f('0x6b')][_0x175f('0x4a')]({'raw':!![]})[_0x175f('0x2d')](function(_0x59ef5f){_0x59ef5f['forEach'](function(_0x2cd5eb){_0x514f1e[_0x175f('0x65')](_0x2cd5eb['id']+0x1869f);});_0x703f66(_0x514f1e);});}else{return db[_0x175f('0x64')][_0x175f('0x4a')]({'where':{'sectionId':_0x377d26['id']},'raw':!![]})[_0x175f('0x2d')](function(_0x2cd2f0){_0x2cd2f0['forEach'](function(_0x459965){_0x514f1e['push'](_0x459965[_0x175f('0x6c')]+0x1869f);});_0x703f66(_0x514f1e);});}}catch(_0x66ac4){_0x4db72c(_0x66ac4);}});}function getPlugins(_0x5788dc){var _0x5360f0=[];return new BPromise(function(_0x39dd14,_0x14573f){try{if(_0x5788dc['autoAssociation']){return db[_0x175f('0x6d')]['findAll']({'raw':!![]})[_0x175f('0x2d')](function(_0x108b6a){_0x108b6a['forEach'](function(_0x251032){_0x5360f0[_0x175f('0x65')](_0x251032['id']+0x15b38);});_0x39dd14(_0x5360f0);});}else{return db[_0x175f('0x64')][_0x175f('0x4a')]({'where':{'sectionId':_0x5788dc['id']},'raw':!![]})[_0x175f('0x2d')](function(_0x300a41){_0x300a41['forEach'](function(_0x26d35){_0x5360f0[_0x175f('0x65')](_0x26d35[_0x175f('0x6c')]+0x15b38);});_0x39dd14(_0x5360f0);});}}catch(_0x131c12){_0x14573f(_0x131c12);}});}exports[_0x175f('0x6e')]=function(_0x4f9490,_0xd0fb93){return db[_0x175f('0x34')][_0x175f('0x60')]({'where':{'id':_0x4f9490['params']['id']}})[_0x175f('0x2d')](handleEntityNotFound(_0xd0fb93,null))['then'](function(_0x1f8f13){if(_0x1f8f13){return db[_0x175f('0x58')][_0x175f('0x59')](function(_0x197f67){return db['UserProfileSection'][_0x175f('0x4a')]({'where':{'userProfileId':_0x4f9490[_0x175f('0x4d')]['id']},'attributes':['id'],'raw':!![]})['then'](function(_0x36b25d){if(_0x36b25d){return db[_0x175f('0x5a')][_0x175f('0x2e')]({'where':{'userProfileId':_0x4f9490[_0x175f('0x4d')]['id'],'id':_['map'](_0x36b25d,function(_0x53ba0c){return _0x53ba0c['id'];})},'transaction':_0x197f67});}})[_0x175f('0x2d')](function(_0x59a4cc){var _0xc52aba=_[_0x175f('0x33')](_0x4f9490['body'],function(_0x48c655){_0x48c655['userProfileId']=_0x4f9490[_0x175f('0x4d')]['id'];return _0x48c655;});return db[_0x175f('0x5a')][_0x175f('0x6f')](_0xc52aba,{'raw':!![],'transaction':_0x197f67});})[_0x175f('0x2d')](function(_0x13dd0f){var _0x343f1c=_[_0x175f('0x48')](_[_0x175f('0x33')](_0x13dd0f,function(_0x5a0bef){return _0x5a0bef[_0x175f('0x54')]({'plain':!![]});}),{'includeAll':![]});if(_0x343f1c){return db[_0x175f('0x5a')][_0x175f('0x4a')]({'where':{'userProfileId':_0x4f9490[_0x175f('0x4d')]['id'],'sectionId':_['map'](_0x343f1c,function(_0x1b3ba3){return _0x1b3ba3[_0x175f('0x5e')];})},'attributes':['id',_0x175f('0x5e')],'raw':!![]})[_0x175f('0x2d')](function(_0x51972f){var _0x4d4b1a=_[_0x175f('0x33')](_0x4f9490[_0x175f('0x52')],function(_0x29f910){_0x29f910[_0x175f('0x63')]=_0x4f9490[_0x175f('0x4d')]['id'];return _0x29f910;});return db['UserProfileResource'][_0x175f('0x6f')](_0x4d4b1a,{'raw':!![],'transaction':_0x197f67});});}})['catch'](handleError(_0xd0fb93,null));});}})['then'](function(_0x577fb3){var _0x29b5fe=_[_0x175f('0x33')](_0x577fb3,function(_0x4719a3){return _0x4719a3[_0x175f('0x54')]({'plain':!![]});});})['then'](respondWithResult(_0xd0fb93,null))[_0x175f('0x4c')](handleError(_0xd0fb93,null));};exports['removeResources']=function(_0x135338,_0x28c542,_0x1d1f5f){return db['UserProfile'][_0x175f('0x60')]({'where':{'id':_0x135338[_0x175f('0x4d')]['id']}})['then'](handleEntityNotFound(_0x28c542,null))[_0x175f('0x2d')](function(_0x4e7d25){if(_0x4e7d25){return _0x4e7d25[_0x175f('0x70')](_0x135338['query']['ids']);}})[_0x175f('0x2d')](respondWithStatusCode(_0x28c542,null))[_0x175f('0x4c')](handleError(_0x28c542,null));};exports['getResources']=function(_0x161e7e,_0x292653){var _0x30f068={};if(!_0x161e7e[_0x175f('0x3a')][_0x175f('0x71')])throw new Error(_0x175f('0x72'));if(!_0x161e7e['query'][_0x175f('0x41')]('nolimit')){_0x30f068[_0x175f('0x43')]=qs['limit'](_0x161e7e['query'][_0x175f('0x43')]);_0x30f068[_0x175f('0x25')]=qs['offset'](_0x161e7e[_0x175f('0x3a')][_0x175f('0x25')]);}return db['UserProfile'][_0x175f('0x60')]({'where':{'id':_0x161e7e['params']['id']}})[_0x175f('0x2d')](function(_0x249742){if(!_0x249742)throw new Error(_0x175f('0x73')+_0x161e7e[_0x175f('0x4d')]['id']);return db[_0x175f('0x34')][_0x175f('0x74')](_0x161e7e);})['then'](respondWithFilteredResult(_0x292653,_0x30f068))[_0x175f('0x4c')](handleError(_0x292653,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 08cbc0a..efe21ad 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 _0x11c8=['hook','exports','../../mysqldb','UserProfile','save','update','remove','emit'];(function(_0x5c3bae,_0x1d7a16){var _0x498d1e=function(_0x59a30e){while(--_0x59a30e){_0x5c3bae['push'](_0x5c3bae['shift']());}};_0x498d1e(++_0x1d7a16);}(_0x11c8,0x19a));var _0x811c=function(_0x45c1b7,_0x136e78){_0x45c1b7=_0x45c1b7-0x0;var _0x2ae433=_0x11c8[_0x45c1b7];return _0x2ae433;};'use strict';var EventEmitter=require('events');var UserProfile=require(_0x811c('0x0'))['db'][_0x811c('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x811c('0x2'),'afterUpdate':_0x811c('0x3'),'afterDestroy':_0x811c('0x4')};function emitEvent(_0x85a54c){return function(_0x16f1d6,_0x432f5b,_0x49a07c){UserProfileEvents[_0x811c('0x5')](_0x85a54c+':'+_0x16f1d6['id'],_0x16f1d6);UserProfileEvents[_0x811c('0x5')](_0x85a54c,_0x16f1d6);_0x49a07c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile[_0x811c('0x6')](e,emitEvent(event));}}module[_0x811c('0x7')]=UserProfileEvents; \ No newline at end of file +var _0x2525=['exports','events','../../mysqldb','UserProfile','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x4517f3,_0x3af8ef){var _0x1d63d3=function(_0x459a04){while(--_0x459a04){_0x4517f3['push'](_0x4517f3['shift']());}};_0x1d63d3(++_0x3af8ef);}(_0x2525,0x1f0));var _0x5252=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0x2525[_0x2ec461];return _0x28603d;};'use strict';var EventEmitter=require(_0x5252('0x0'));var UserProfile=require(_0x5252('0x1'))['db'][_0x5252('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x5252('0x3')](0x0);var events={'afterCreate':_0x5252('0x4'),'afterUpdate':_0x5252('0x5'),'afterDestroy':_0x5252('0x6')};function emitEvent(_0x1138af){return function(_0x28efdd,_0x4907eb,_0x4a73a2){UserProfileEvents[_0x5252('0x7')](_0x1138af+':'+_0x28efdd['id'],_0x28efdd);UserProfileEvents[_0x5252('0x7')](_0x1138af,_0x28efdd);_0x4a73a2(null);};}for(var e in events){if(events[_0x5252('0x8')](e)){var event=events[e];UserProfile[_0x5252('0x9')](e,emitEvent(event));}}module[_0x5252('0xa')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 62f4b47..c71d566 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 _0xa65a=['pick','where','merge','key','foreignKey','forEach','options','includeAll','include','reportType','default','custom','rows','ids','customSorting','extraQueryConditions','count','CmContact','tag','ThroughTags','color','openTabs','chat','dataValues','sms','fax','mail','openchannel','lodash','squel','exports','filter','findAll','then','associatedResources','map','catch','field','model','name','resolve','UserProfileResource','AnalyticExtractedReport','resourceId','type','toLowerCase','squareprojects','SquareProject','odbc','childModel','SquareOdbc','squarerecordings','SquareRecording','parentSections','SquareProjects','projectName','projects','JscriptyProject','ListId','lists','CmList','companies','CmCustomField','chatqueues','ChatQueue','ChatWebsite','faxqueues','FaxQueue','faxaccounts','FaxAccount','inboundroutes','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','Agents','membername','User','role','agent','Telephones','telephone','VoiceQueues','queue','inbound','QueueCampaigns','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailQueue','MailAccount','mailsubstatuses','openchannelqueues','OpenchannelQueue','openchannelaccounts','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','whatsappaccounts','Team','queuecampaigns','VoiceQueue','users','agents','Users','ZendeskAccount','salesforceaccounts','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','ZohoAccount','cannedanswers','CannedAnswer','dispositions','customdashboards','Dashboard','intervals','pauses','Pause','Schedule','sounds','Sound','Tag','templates','Template','triggers','Trigger','Trunk','Variable','Plugin','extractedreports','Reports','reportId','metrics','AnalyticMetric','toUpperCase','slice','Sequelize','QueryTypes','SELECT','select','InteractionId','from','user_has_','ui.UserId\x20=\x20?','sequelize','OpenTabs','define','UserProfile','query','raw','Invalid\x20section\x20\x27','isEmpty','length','push','UserProfileSection','find','params','ignore','union','autoAssociation','all','keys','filters','intersection','attributes','fields','nolimit','limit','offset','order','sort'];(function(_0x4d003a,_0x55eb31){var _0x402cc9=function(_0x3f6936){while(--_0x3f6936){_0x4d003a['push'](_0x4d003a['shift']());}};_0x402cc9(++_0x55eb31);}(_0xa65a,0x18e));var _0xaa65=function(_0x23ff3b,_0x239430){_0x23ff3b=_0x23ff3b-0x0;var _0x4bc26e=_0xa65a[_0x23ff3b];return _0x4bc26e;};'use strict';var _=require(_0xaa65('0x0'));var attributes=require('./userProfile.attributes');var squel=require(_0xaa65('0x1'));module[_0xaa65('0x2')]=function(_0x50bb87){var _0x16af53=_0x50bb87['models'];function _0x4ae012(_0x7e236f,_0x146901){return new Promise(function(_0x454c1f,_0xe32414){if(!_0x146901)return _0x454c1f(null);var _0x417152=_0x146901[_0xaa65('0x3')]?{[_0x146901[_0xaa65('0x3')]['field']]:_0x146901['filter']['value']}:undefined;return _0x16af53[_0x7e236f][_0xaa65('0x4')]({'where':_0x417152,'raw':!![]})[_0xaa65('0x5')](function(_0x2ad02d){_0x146901[_0xaa65('0x6')]=_[_0xaa65('0x7')](_0x2ad02d,'id');_0x454c1f(_0x146901);})[_0xaa65('0x8')](function(_0x1f589e){_0xe32414(_0x1f589e);});});}function _0x5cc80c(_0x1e5ab4,_0x304366){return new Promise(function(_0x2a0471,_0x53adf3){var _0x47225f=_0x1e5ab4['filter']?{[_0x1e5ab4[_0xaa65('0x3')][_0xaa65('0x9')]]:_0x1e5ab4[_0xaa65('0x3')]['value']}:undefined;return _0x16af53[_0x1e5ab4[_0xaa65('0xa')]]['findAll']({'where':_0x47225f,'raw':!![]})['then'](function(_0x58c724){_0x304366[_0xaa65('0x6')]=_['map'](_0x58c724,function(_0x11fabc){return _0x11fabc[_0xaa65('0xb')];});_0x2a0471(_0x304366);})[_0xaa65('0x8')](function(_0x376285){_0x53adf3(_0x376285);});});}function _0x2145e8(_0x234327,_0x364d74,_0x1d15a3){if(!_0x364d74)return Promise[_0xaa65('0xc')](null);return new Promise(function(_0x2cc931,_0x56f49a){return _0x16af53[_0xaa65('0xd')]['findAll']({'where':{'sectionId':_0x364d74['id']},'raw':!![]})[_0xaa65('0x5')](function(_0x56c7e6){if(_0x234327[_0xaa65('0x9')]&&_0x234327[_0xaa65('0x9')]!=='id'){_0x364d74['associatedResources']=_[_0xaa65('0x7')](_0x56c7e6,function(_0x5a10e6){return _0x5a10e6[_0x234327[_0xaa65('0x9')]];});}else{if(_0x1d15a3===_0xaa65('0xe')){_0x364d74['associatedResources']=_[_0xaa65('0x7')](_0x56c7e6,function(_0x59945b){return{'id':_0x59945b[_0xaa65('0xf')],'type':_0x59945b[_0xaa65('0x10')]};});}else{_0x364d74[_0xaa65('0x6')]=_[_0xaa65('0x7')](_0x56c7e6,function(_0x828bb){return _0x828bb[_0xaa65('0xf')];});}}_0x2cc931(_0x364d74);})[_0xaa65('0x8')](function(_0x412252){_0x56f49a(_0x412252);});});}function _0x6a9882(_0x3b6035,_0x211cf0){var _0x10ff0d={'parentSections':[]};switch(_0x3b6035[_0xaa65('0x11')]()){case _0xaa65('0x12'):_0x10ff0d['childModel']=_0xaa65('0x13');break;case _0xaa65('0x14'):_0x10ff0d[_0xaa65('0x15')]=_0xaa65('0x16');break;case _0xaa65('0x17'):_0x10ff0d['childModel']=_0xaa65('0x18');_0x10ff0d[_0xaa65('0x19')]=[{'name':_0xaa65('0x1a'),'field':_0xaa65('0xb'),'foreignKey':_0xaa65('0x1b')}];break;case _0xaa65('0x1c'):_0x10ff0d['childModel']=_0xaa65('0x1d');break;case'contacts':_0x10ff0d[_0xaa65('0x15')]='CmContact';_0x10ff0d['parentSections']=[{'name':'Lists','field':'id','foreignKey':_0xaa65('0x1e')}];break;case _0xaa65('0x1f'):_0x10ff0d['childModel']=_0xaa65('0x20');break;case _0xaa65('0x21'):_0x10ff0d[_0xaa65('0x15')]='CmCompany';break;case'globalcustomfields':_0x10ff0d['childModel']=_0xaa65('0x22');break;case _0xaa65('0x23'):_0x10ff0d[_0xaa65('0x15')]=_0xaa65('0x24');break;case'chatwebsites':_0x10ff0d[_0xaa65('0x15')]=_0xaa65('0x25');break;case _0xaa65('0x26'):_0x10ff0d[_0xaa65('0x15')]=_0xaa65('0x27');break;case _0xaa65('0x28'):_0x10ff0d[_0xaa65('0x15')]=_0xaa65('0x29');break;case _0xaa65('0x2a'):case _0xaa65('0x2b'):case _0xaa65('0x2c'):_0x10ff0d['childModel']=_0xaa65('0x2d');break;case _0xaa65('0x2e'):_0x10ff0d[_0xaa65('0x15')]=_0xaa65('0x2f');break;case _0xaa65('0x30'):_0x10ff0d[_0xaa65('0x15')]=_0xaa65('0x31');break;case'voicerecordings':_0x10ff0d['childModel']='VoiceRecording';_0x10ff0d['parentSections']=[{'name':_0xaa65('0x32'),'field':_0xaa65('0xb'),'foreignKey':_0xaa65('0x33'),'model':_0xaa65('0x34'),'filter':{'field':_0xaa65('0x35'),'value':[_0xaa65('0x36')]}},{'name':_0xaa65('0x37'),'field':'name','foreignKey':_0xaa65('0x33'),'model':_0xaa65('0x34'),'filter':{'field':_0xaa65('0x35'),'value':[_0xaa65('0x38')]}},{'name':_0xaa65('0x39'),'field':'name','foreignKey':_0xaa65('0x3a'),'model':'VoiceQueue','filter':{'field':'type','value':[_0xaa65('0x3b')]}},{'name':_0xaa65('0x3c'),'field':_0xaa65('0xb'),'foreignKey':'queue','model':'VoiceQueue','filter':{'field':'type','value':[_0xaa65('0x3d')]}}];break;case _0xaa65('0x3e'):_0x10ff0d[_0xaa65('0x15')]=_0xaa65('0x3f');break;case _0xaa65('0x40'):_0x10ff0d[_0xaa65('0x15')]=_0xaa65('0x41');break;case _0xaa65('0x42'):_0x10ff0d[_0xaa65('0x15')]=_0xaa65('0x43');break;case _0xaa65('0x44'):_0x10ff0d[_0xaa65('0x15')]=_0xaa65('0x45');break;case _0xaa65('0x46'):_0x10ff0d['childModel']=_0xaa65('0x47');break;case'mailaccounts':_0x10ff0d[_0xaa65('0x15')]=_0xaa65('0x48');break;case _0xaa65('0x49'):_0x10ff0d[_0xaa65('0x15')]='MailSubstatus';break;case _0xaa65('0x4a'):_0x10ff0d[_0xaa65('0x15')]=_0xaa65('0x4b');break;case _0xaa65('0x4c'):_0x10ff0d[_0xaa65('0x15')]='OpenchannelAccount';break;case'smsqueues':_0x10ff0d[_0xaa65('0x15')]=_0xaa65('0x4d');break;case _0xaa65('0x4e'):_0x10ff0d[_0xaa65('0x15')]=_0xaa65('0x4f');break;case _0xaa65('0x50'):_0x10ff0d[_0xaa65('0x15')]='WhatsappQueue';break;case _0xaa65('0x51'):_0x10ff0d[_0xaa65('0x15')]='WhatsappAccount';break;case'teams':_0x10ff0d[_0xaa65('0x15')]=_0xaa65('0x52');break;case'voicequeues':case _0xaa65('0x53'):_0x10ff0d[_0xaa65('0x15')]=_0xaa65('0x54');if(_0x211cf0){_0x10ff0d[_0xaa65('0x19')]=[{'name':_0xaa65('0x39')},{'name':_0xaa65('0x3c')}];}break;case _0xaa65('0x55'):case _0xaa65('0x56'):case'telephones':_0x10ff0d[_0xaa65('0x15')]=_0xaa65('0x34');if(_0x211cf0){_0x10ff0d[_0xaa65('0x19')]=[{'name':_0xaa65('0x57'),'filter':{'field':_0xaa65('0x35'),'value':['admin','user']},'ignore':!![]},{'name':'Agents'},{'name':'Telephones'}];}break;case'zendeskaccounts':_0x10ff0d[_0xaa65('0x15')]=_0xaa65('0x58');break;case _0xaa65('0x59'):_0x10ff0d[_0xaa65('0x15')]='SalesforceAccount';break;case _0xaa65('0x5a'):_0x10ff0d[_0xaa65('0x15')]=_0xaa65('0x5b');break;case _0xaa65('0x5c'):_0x10ff0d[_0xaa65('0x15')]=_0xaa65('0x5d');break;case _0xaa65('0x5e'):_0x10ff0d['childModel']='DeskAccount';break;case'zohoaccounts':_0x10ff0d[_0xaa65('0x15')]=_0xaa65('0x5f');break;case'vtigeraccounts':_0x10ff0d[_0xaa65('0x15')]='User';break;case _0xaa65('0x60'):_0x10ff0d[_0xaa65('0x15')]=_0xaa65('0x61');break;case _0xaa65('0x62'):_0x10ff0d[_0xaa65('0x15')]='Disposition';break;case _0xaa65('0x63'):_0x10ff0d[_0xaa65('0x15')]=_0xaa65('0x64');break;case _0xaa65('0x65'):_0x10ff0d[_0xaa65('0x15')]='Interval';break;case _0xaa65('0x66'):_0x10ff0d[_0xaa65('0x15')]=_0xaa65('0x67');break;case'scheduler':_0x10ff0d[_0xaa65('0x15')]=_0xaa65('0x68');break;case _0xaa65('0x69'):_0x10ff0d[_0xaa65('0x15')]=_0xaa65('0x6a');break;case'tags':_0x10ff0d[_0xaa65('0x15')]=_0xaa65('0x6b');break;case _0xaa65('0x6c'):_0x10ff0d[_0xaa65('0x15')]=_0xaa65('0x6d');break;case _0xaa65('0x6e'):_0x10ff0d[_0xaa65('0x15')]=_0xaa65('0x6f');break;case'trunks':_0x10ff0d[_0xaa65('0x15')]=_0xaa65('0x70');break;case'variables':_0x10ff0d['childModel']=_0xaa65('0x71');break;case'plugins':_0x10ff0d[_0xaa65('0x15')]=_0xaa65('0x72');break;case _0xaa65('0x73'):_0x10ff0d[_0xaa65('0x15')]=_0xaa65('0xe');_0x10ff0d[_0xaa65('0x19')]=[{'name':_0xaa65('0x74'),'field':'id','foreignKey':_0xaa65('0x75')}];break;case _0xaa65('0x76'):_0x10ff0d[_0xaa65('0x15')]=_0xaa65('0x77');break;}return _0x10ff0d;}function _0x41b523(_0xbf7b4d,_0x4e3465){var _0x3a7731=_0xbf7b4d['charAt'](0x0)[_0xaa65('0x78')]()+_0xbf7b4d[_0xaa65('0x79')](0x1);var _0x156506={'type':_0x16af53[_0xaa65('0x7a')][_0xaa65('0x7b')][_0xaa65('0x7c')],'raw':!![]};return new Promise(function(_0x33083a,_0x349ea1){var _0x5dca9d=squel[_0xaa65('0x7d')]()[_0xaa65('0x9')]('ui.'+_0x3a7731+_0xaa65('0x7e'),'id')['field']('ui.createdAt')[_0xaa65('0x7f')](_0xaa65('0x80')+_0xbf7b4d+'_interactions','ui')['where'](_0xaa65('0x81'),_0x4e3465['id']);return _0x16af53[_0xaa65('0x82')]['query'](_0x5dca9d['toString'](),_0x156506)[_0xaa65('0x5')](function(_0x2db1bc){_0x4e3465[_0x3a7731+_0xaa65('0x83')]=_0x2db1bc;_0x33083a(_0x2db1bc);})[_0xaa65('0x8')](function(_0x49e7d0){_0x349ea1(_0x49e7d0);});});}return _0x50bb87[_0xaa65('0x84')](_0xaa65('0x85'),attributes,{'tableName':'user_profiles','paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x55d717){var _0x245686=require('../../components/parsers/qs');var _0x416228={'raw':_0x55d717[_0xaa65('0x86')][_0xaa65('0x87')],'where':{}};var _0x5ebd11={};var _0x25b945={'count':0x0,'rows':[]};var _0x4c9e7f=_0x55d717[_0xaa65('0x86')]['section'];var _0x3eae25=_0x55d717[_0xaa65('0x86')]['mergeResources']||![];var _0x154092=_0x6a9882(_0x4c9e7f,_0x3eae25);if(!_0x154092[_0xaa65('0x15')])throw new Error(_0xaa65('0x88')+_0x4c9e7f+'\x27');var _0x543d01=[{'name':_0x4c9e7f}];if(!_[_0xaa65('0x89')](_0x154092[_0xaa65('0x19')]))_0x543d01=_0x154092[_0xaa65('0x19')];var _0x105329=[];for(var _0x4e8937=0x0;_0x4e8937<_0x543d01[_0xaa65('0x8a')];_0x4e8937++){_0x105329[_0xaa65('0x8b')](_0x16af53[_0xaa65('0x8c')][_0xaa65('0x8d')]({'where':{'userProfileId':_0x55d717[_0xaa65('0x8e')]['id'],'name':_0x543d01[_0x4e8937][_0xaa65('0xb')]},'raw':!![]}));}return Promise['all'](_0x105329)[_0xaa65('0x5')](function(_0x2ea8c9){var _0x4df3dd=_[_0xaa65('0x3')](_0x2ea8c9,function(_0x2dd798){return _0x2dd798?_0x2dd798:undefined;});var _0x49fc8e=_[_0xaa65('0x3')](_0x543d01,[_0xaa65('0x8f'),!![]]);var _0x5e76d4=_['isEmpty'](_0x4df3dd)&&_[_0xaa65('0x89')](_0x49fc8e)?null:_[_0xaa65('0x90')](_0x49fc8e,_0x4df3dd);if(!_0x5e76d4)return null;var _0xc4b6fb=[];for(var _0x437872=0x0;_0x437872<_0x5e76d4[_0xaa65('0x8a')];_0x437872++){var _0x231dee=_[_0xaa65('0x8d')](_0x543d01,function(_0x2939c7){return _0x5e76d4[_0x437872]?_0x2939c7[_0xaa65('0xb')]===_0x5e76d4[_0x437872][_0xaa65('0xb')]:null;});if(_0x231dee){if(_0x5e76d4[_0x437872][_0xaa65('0x8f')]){_0xc4b6fb['push'](_0x4ae012(_0x154092[_0xaa65('0x15')],_0x5e76d4[_0x437872]));}else{if(!_0x5e76d4[_0x437872][_0xaa65('0x91')]){_0xc4b6fb[_0xaa65('0x8b')](_0x2145e8(_0x231dee,_0x5e76d4[_0x437872],_0x154092[_0xaa65('0x15')]));}else{if(_0x231dee[_0xaa65('0xa')]){_0xc4b6fb[_0xaa65('0x8b')](_0x5cc80c(_0x231dee,_0x5e76d4[_0x437872]));}}}}}return Promise[_0xaa65('0x92')](_0xc4b6fb);})[_0xaa65('0x5')](function(_0x3fb015){var _0x51fdc2=_0x3fb015;var _0xf958f6=null;if(_0x51fdc2){_0xf958f6=_0x51fdc2['length']===0x1?_0x51fdc2[0x0]:null;}if(!_0xf958f6&&!_0x51fdc2)return _0x25b945;var _0x5343c2=_0x16af53[_0x154092[_0xaa65('0x15')]]['rawAttributes'];_0x5ebd11['model']=_[_0xaa65('0x93')](_0x5343c2);_0x5ebd11[_0xaa65('0x86')]=_[_0xaa65('0x93')](_0x55d717[_0xaa65('0x86')]);_0x5ebd11[_0xaa65('0x94')]=_[_0xaa65('0x95')](_0x5ebd11['model'],_0x5ebd11[_0xaa65('0x86')]);_0x416228[_0xaa65('0x96')]=_[_0xaa65('0x95')](_0x5ebd11[_0xaa65('0xa')],_0x245686['fields'](_0x55d717['query'][_0xaa65('0x97')]));_0x416228['attributes']=_0x416228['attributes']['length']?_0x416228[_0xaa65('0x96')]:_0x5ebd11[_0xaa65('0xa')];if(!_0x55d717[_0xaa65('0x86')]['hasOwnProperty'](_0xaa65('0x98'))){_0x416228[_0xaa65('0x99')]=_0x245686[_0xaa65('0x99')](_0x55d717[_0xaa65('0x86')]['limit']);_0x416228[_0xaa65('0x9a')]=_0x245686[_0xaa65('0x9a')](_0x55d717['query'][_0xaa65('0x9a')]);}_0x416228[_0xaa65('0x9b')]=_0x245686[_0xaa65('0x9c')](_0x55d717[_0xaa65('0x86')][_0xaa65('0x9c')]);_0x416228['where']=_0x245686[_0xaa65('0x94')](_[_0xaa65('0x9d')](_0x55d717[_0xaa65('0x86')],_0x5ebd11[_0xaa65('0x94')]));if(_0x55d717[_0xaa65('0x86')]['filter']){_0x416228[_0xaa65('0x9e')]=_[_0xaa65('0x9f')](_0x416228['where'],{'$or':_[_0xaa65('0x7')](_0x5343c2,function(_0x18821b){if(_0x18821b[_0xaa65('0x10')][_0xaa65('0xa0')]!=='VIRTUAL'){var _0x3c6b9a={};_0x3c6b9a[_0x18821b[_0xaa65('0x9')]]={'$like':'%'+_0x55d717[_0xaa65('0x86')][_0xaa65('0x3')]+'%'};return _0x3c6b9a;}})});}var _0x1462eb=[];var _0x44ade9=null;var _0x246354={};if(_0xf958f6){_0x44ade9=_['find'](_0x543d01,[_0xaa65('0xb'),_0xf958f6[_0xaa65('0xb')]]);if(_0x44ade9[_0xaa65('0x9')]){_0x246354={};if(_0x154092[_0xaa65('0x15')]===_0xaa65('0xe')){_0x246354[_0x44ade9[_0xaa65('0xa1')]]=_[_0xaa65('0x7')](_0xf958f6['associatedResources'],'id');}else{_0x246354[_0x44ade9[_0xaa65('0xa1')]]=_0xf958f6['associatedResources'];}_0x1462eb[_0xaa65('0x8b')](_0x246354);}else{_0x416228[_0xaa65('0x9e')]['id']=_0xf958f6[_0xaa65('0x6')];}}else{for(var _0x7fae3e=0x0;_0x7fae3e<_0x51fdc2['length'];_0x7fae3e++){_0x44ade9=_['find'](_0x543d01,[_0xaa65('0xb'),_0x51fdc2[_0x7fae3e][_0xaa65('0xb')]]);if(_0x44ade9[_0xaa65('0x9')]){_0x246354={};_0x246354[_0x44ade9[_0xaa65('0xa1')]]=_0x51fdc2[_0x7fae3e][_0xaa65('0x6')];_0x1462eb['push'](_0x246354);}else{if(!_0x416228[_0xaa65('0x9e')]['id'])_0x416228[_0xaa65('0x9e')]['id']=[];_0x51fdc2[_0x7fae3e][_0xaa65('0x6')][_0xaa65('0xa2')](function(_0x2828d1){_0x416228[_0xaa65('0x9e')]['id']['push'](_0x2828d1);});}}}if(!_['isEmpty'](_0x1462eb)){_0x416228[_0xaa65('0x9e')]=_[_0xaa65('0x9f')](_0x416228['where'],{'$and':{'$or':_0x1462eb}});}_0x416228=_[_0xaa65('0x9f')]({},_0x416228,_0x55d717[_0xaa65('0xa3')]);if(_0xf958f6&&!_0xf958f6[_0xaa65('0x91')]&&_0x154092['childModel']==='AnalyticExtractedReport'){if(_0x55d717['query'][_0xaa65('0xa4')]){_0x416228[_0xaa65('0xa5')]=[{'all':!![]}];}return _0x16af53[_0x154092[_0xaa65('0x15')]][_0xaa65('0x4')](_0x416228)[_0xaa65('0x5')](function(_0x226e39){var _0x6f2d9f=[];_0x226e39[_0xaa65('0xa2')](function(_0xac0dfe){var _0x2ff98d;switch(_0xac0dfe[_0xaa65('0xa6')]){case _0xaa65('0xa7'):_0x2ff98d=_[_0xaa65('0x8d')](_0xf958f6['associatedResources'],function(_0x1e2998){return _0x1e2998['id']===_0xac0dfe[_0xaa65('0x75')]&&_0x1e2998[_0xaa65('0x10')]==='DefaultReports';});break;case _0xaa65('0xa8'):_0x2ff98d=_[_0xaa65('0x8d')](_0xf958f6['associatedResources'],function(_0xcea4fa){return _0xcea4fa['id']===_0xac0dfe[_0xaa65('0x75')]&&_0xcea4fa[_0xaa65('0x10')]==='CustomReports';});break;}if(_0x2ff98d)_0x6f2d9f[_0xaa65('0x8b')](_0xac0dfe);});_0x25b945['count']=_0x6f2d9f[_0xaa65('0x8a')];_0x25b945[_0xaa65('0xa9')]=_0x6f2d9f;return _0x25b945;});}else{if(!_[_0xaa65('0x89')](_0x55d717['query'][_0xaa65('0xaa')])){_0x416228[_0xaa65('0x9e')]['id']=_0x416228[_0xaa65('0x9e')]['id']?_[_0xaa65('0x95')](_0x416228[_0xaa65('0x9e')]['id'],_0x55d717[_0xaa65('0x86')][_0xaa65('0xaa')]):_0x55d717[_0xaa65('0x86')][_0xaa65('0xaa')];if(_0x55d717['query'][_0xaa65('0xab')]){_0x416228[_0xaa65('0x9b')]=_0x55d717[_0xaa65('0x86')][_0xaa65('0xab')];}}if(_0x55d717[_0xaa65('0x86')][_0xaa65('0xac')]){_0x416228[_0xaa65('0x9e')]=_[_0xaa65('0x9f')](_0x416228['where'],{'$and':_0x55d717[_0xaa65('0x86')][_0xaa65('0xac')]});}return _0x16af53[_0x154092[_0xaa65('0x15')]][_0xaa65('0xad')]({'where':_0x416228[_0xaa65('0x9e')]})[_0xaa65('0x5')](function(_0x1ce34f){_0x25b945['count']=_0x1ce34f;if(_0x55d717[_0xaa65('0x86')][_0xaa65('0xa4')]){if(_0x154092['childModel']===_0xaa65('0xae')){_0x416228[_0xaa65('0xa5')]=[{'model':_0x16af53[_0xaa65('0x6b')],'as':'Tags','attributes':['id','name','color'],'required':_0x55d717[_0xaa65('0x86')][_0xaa65('0xaf')]?!![]:![]},{'model':_0x16af53[_0xaa65('0x6b')],'as':_0xaa65('0xb0'),'attributes':['id',_0xaa65('0xb'),_0xaa65('0xb1')],'through':_0x55d717[_0xaa65('0x86')]['tag']?{'attributes':[],'where':{'TagId':_0x55d717[_0xaa65('0x86')][_0xaa65('0xaf')]||undefined}}:{},'required':_0x55d717[_0xaa65('0x86')]['tag']?!![]:![]}];}else{_0x416228[_0xaa65('0xa5')]=[{'all':!![]}];}}return _0x16af53[_0x154092[_0xaa65('0x15')]][_0xaa65('0x4')](_0x416228);})[_0xaa65('0x5')](function(_0x15d2c4){_0x25b945[_0xaa65('0xa9')]=_0x15d2c4;if(_0x4c9e7f==='Agents'&&_0x55d717[_0xaa65('0x86')][_0xaa65('0xb2')]==='true'){var _0x47a9f0=[];for(var _0x1a99f7=0x0;_0x1a99f7<_0x25b945[_0xaa65('0xa9')][_0xaa65('0x8a')];_0x1a99f7++){_0x47a9f0[_0xaa65('0x8b')](_0x41b523(_0xaa65('0xb3'),_0x25b945['rows'][_0x1a99f7][_0xaa65('0xb4')]));_0x47a9f0[_0xaa65('0x8b')](_0x41b523(_0xaa65('0xb5'),_0x25b945['rows'][_0x1a99f7][_0xaa65('0xb4')]));_0x47a9f0[_0xaa65('0x8b')](_0x41b523(_0xaa65('0xb6'),_0x25b945[_0xaa65('0xa9')][_0x1a99f7][_0xaa65('0xb4')]));_0x47a9f0[_0xaa65('0x8b')](_0x41b523(_0xaa65('0xb7'),_0x25b945['rows'][_0x1a99f7][_0xaa65('0xb4')]));_0x47a9f0[_0xaa65('0x8b')](_0x41b523(_0xaa65('0xb8'),_0x25b945['rows'][_0x1a99f7]['dataValues']));_0x47a9f0[_0xaa65('0x8b')](_0x41b523('whatsapp',_0x25b945[_0xaa65('0xa9')][_0x1a99f7]['dataValues']));}return Promise['all'](_0x47a9f0)[_0xaa65('0x5')](function(){return _0x25b945;});}return _0x25b945;});}});}}});}; \ No newline at end of file +var _0x8f18=['telephone','queue','VoiceQueue','inbound','QueueCampaigns','outbound','VoiceMusicOnHold','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailAccount','mailsubstatuses','openchannelqueues','OpenchannelQueue','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','teams','Team','VoiceQueues','users','agents','user','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','Disposition','customdashboards','Dashboard','intervals','pauses','Pause','scheduler','sounds','Sound','tags','Tag','templates','Template','triggers','Trigger','trunks','Trunk','Variable','plugins','Plugin','extractedreports','Reports','metrics','charAt','toUpperCase','slice','Sequelize','select','ui.','InteractionId','from','user_has_','where','ui.UserId\x20=\x20?','sequelize','query','then','UserProfile','user_profiles','../../components/parsers/qs','raw','section','mergeResources','Invalid\x20section\x20\x27','isEmpty','length','UserProfileSection','find','all','push','autoAssociation','rawAttributes','keys','filters','intersection','attributes','fields','nolimit','limit','offset','order','sort','pick','merge','key','VIRTUAL','foreignKey','options','include','reportType','reportId','custom','CustomReports','count','rows','ids','customSorting','extraQueryConditions','includeAll','Tags','color','tag','ThroughTags','openTabs','dataValues','openchannel','./userProfile.attributes','squel','models','field','filter','value','findAll','catch','model','associatedResources','name','resolve','UserProfileResource','map','AnalyticExtractedReport','resourceId','type','toLowerCase','childModel','SquareProject','squarerecordings','SquareRecording','parentSections','SquareProjects','projectName','projects','contacts','CmContact','Lists','ListId','lists','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','FaxQueue','faxaccounts','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','Agents','membername','User','agent','Telephones','role'];(function(_0x54d4a8,_0x585a59){var _0x3b321b=function(_0x245c6a){while(--_0x245c6a){_0x54d4a8['push'](_0x54d4a8['shift']());}};_0x3b321b(++_0x585a59);}(_0x8f18,0x1e6));var _0x88f1=function(_0x11e203,_0x4fd4ce){_0x11e203=_0x11e203-0x0;var _0x2a0a4b=_0x8f18[_0x11e203];return _0x2a0a4b;};'use strict';var _=require('lodash');var attributes=require(_0x88f1('0x0'));var squel=require(_0x88f1('0x1'));module['exports']=function(_0x5aee9a){var _0x39717f=_0x5aee9a[_0x88f1('0x2')];function _0x1da27d(_0x4d6511,_0x143144){return new Promise(function(_0x34f55d,_0x5420b8){if(!_0x143144)return _0x34f55d(null);var _0x3865d4=_0x143144['filter']?{[_0x143144['filter'][_0x88f1('0x3')]]:_0x143144[_0x88f1('0x4')][_0x88f1('0x5')]}:undefined;return _0x39717f[_0x4d6511][_0x88f1('0x6')]({'where':_0x3865d4,'raw':!![]})['then'](function(_0x189fef){_0x143144['associatedResources']=_['map'](_0x189fef,'id');_0x34f55d(_0x143144);})[_0x88f1('0x7')](function(_0x3ec34e){_0x5420b8(_0x3ec34e);});});}function _0x32a2fa(_0x5a21cf,_0xa5c94c){return new Promise(function(_0x12b8cd,_0x37efcd){var _0x284863=_0x5a21cf[_0x88f1('0x4')]?{[_0x5a21cf[_0x88f1('0x4')]['field']]:_0x5a21cf[_0x88f1('0x4')]['value']}:undefined;return _0x39717f[_0x5a21cf[_0x88f1('0x8')]][_0x88f1('0x6')]({'where':_0x284863,'raw':!![]})['then'](function(_0x4efe82){_0xa5c94c[_0x88f1('0x9')]=_['map'](_0x4efe82,function(_0x27c78f){return _0x27c78f[_0x88f1('0xa')];});_0x12b8cd(_0xa5c94c);})[_0x88f1('0x7')](function(_0xba786c){_0x37efcd(_0xba786c);});});}function _0x4e9072(_0x433911,_0x5f2a02,_0x566dc9){if(!_0x5f2a02)return Promise[_0x88f1('0xb')](null);return new Promise(function(_0x47f444,_0x5e0ee8){return _0x39717f[_0x88f1('0xc')][_0x88f1('0x6')]({'where':{'sectionId':_0x5f2a02['id']},'raw':!![]})['then'](function(_0x3532cb){if(_0x433911[_0x88f1('0x3')]&&_0x433911[_0x88f1('0x3')]!=='id'){_0x5f2a02[_0x88f1('0x9')]=_[_0x88f1('0xd')](_0x3532cb,function(_0x8b7478){return _0x8b7478[_0x433911[_0x88f1('0x3')]];});}else{if(_0x566dc9===_0x88f1('0xe')){_0x5f2a02['associatedResources']=_['map'](_0x3532cb,function(_0x3edf2f){return{'id':_0x3edf2f[_0x88f1('0xf')],'type':_0x3edf2f[_0x88f1('0x10')]};});}else{_0x5f2a02[_0x88f1('0x9')]=_[_0x88f1('0xd')](_0x3532cb,function(_0x345e8c){return _0x345e8c[_0x88f1('0xf')];});}}_0x47f444(_0x5f2a02);})['catch'](function(_0xf8744e){_0x5e0ee8(_0xf8744e);});});}function _0x35a297(_0x5d13da,_0x2e7ff1){var _0x1248c3={'parentSections':[]};switch(_0x5d13da[_0x88f1('0x11')]()){case'squareprojects':_0x1248c3[_0x88f1('0x12')]=_0x88f1('0x13');break;case'odbc':_0x1248c3[_0x88f1('0x12')]='SquareOdbc';break;case _0x88f1('0x14'):_0x1248c3[_0x88f1('0x12')]=_0x88f1('0x15');_0x1248c3[_0x88f1('0x16')]=[{'name':_0x88f1('0x17'),'field':_0x88f1('0xa'),'foreignKey':_0x88f1('0x18')}];break;case _0x88f1('0x19'):_0x1248c3[_0x88f1('0x12')]='JscriptyProject';break;case _0x88f1('0x1a'):_0x1248c3['childModel']=_0x88f1('0x1b');_0x1248c3[_0x88f1('0x16')]=[{'name':_0x88f1('0x1c'),'field':'id','foreignKey':_0x88f1('0x1d')}];break;case _0x88f1('0x1e'):_0x1248c3[_0x88f1('0x12')]='CmList';break;case _0x88f1('0x1f'):_0x1248c3['childModel']=_0x88f1('0x20');break;case _0x88f1('0x21'):_0x1248c3['childModel']=_0x88f1('0x22');break;case _0x88f1('0x23'):_0x1248c3[_0x88f1('0x12')]=_0x88f1('0x24');break;case _0x88f1('0x25'):_0x1248c3[_0x88f1('0x12')]=_0x88f1('0x26');break;case'faxqueues':_0x1248c3[_0x88f1('0x12')]=_0x88f1('0x27');break;case _0x88f1('0x28'):_0x1248c3[_0x88f1('0x12')]='FaxAccount';break;case'inboundroutes':case'internalroutes':case'outboundroutes':_0x1248c3[_0x88f1('0x12')]=_0x88f1('0x29');break;case _0x88f1('0x2a'):_0x1248c3[_0x88f1('0x12')]=_0x88f1('0x2b');break;case _0x88f1('0x2c'):_0x1248c3[_0x88f1('0x12')]=_0x88f1('0x2d');break;case _0x88f1('0x2e'):_0x1248c3['childModel']=_0x88f1('0x2f');_0x1248c3[_0x88f1('0x16')]=[{'name':_0x88f1('0x30'),'field':'name','foreignKey':_0x88f1('0x31'),'model':_0x88f1('0x32'),'filter':{'field':'role','value':[_0x88f1('0x33')]}},{'name':_0x88f1('0x34'),'field':_0x88f1('0xa'),'foreignKey':_0x88f1('0x31'),'model':_0x88f1('0x32'),'filter':{'field':_0x88f1('0x35'),'value':[_0x88f1('0x36')]}},{'name':'VoiceQueues','field':_0x88f1('0xa'),'foreignKey':_0x88f1('0x37'),'model':_0x88f1('0x38'),'filter':{'field':_0x88f1('0x10'),'value':[_0x88f1('0x39')]}},{'name':_0x88f1('0x3a'),'field':_0x88f1('0xa'),'foreignKey':_0x88f1('0x37'),'model':_0x88f1('0x38'),'filter':{'field':'type','value':[_0x88f1('0x3b')]}}];break;case'musiconholds':_0x1248c3['childModel']=_0x88f1('0x3c');break;case'chanspies':_0x1248c3['childModel']='VoiceChanSpy';break;case _0x88f1('0x3d'):_0x1248c3[_0x88f1('0x12')]=_0x88f1('0x3e');break;case _0x88f1('0x3f'):_0x1248c3['childModel']=_0x88f1('0x40');break;case _0x88f1('0x41'):_0x1248c3['childModel']='MailQueue';break;case'mailaccounts':_0x1248c3['childModel']=_0x88f1('0x42');break;case _0x88f1('0x43'):_0x1248c3[_0x88f1('0x12')]='MailSubstatus';break;case _0x88f1('0x44'):_0x1248c3[_0x88f1('0x12')]=_0x88f1('0x45');break;case'openchannelaccounts':_0x1248c3[_0x88f1('0x12')]=_0x88f1('0x46');break;case _0x88f1('0x47'):_0x1248c3['childModel']=_0x88f1('0x48');break;case _0x88f1('0x49'):_0x1248c3[_0x88f1('0x12')]=_0x88f1('0x4a');break;case _0x88f1('0x4b'):_0x1248c3[_0x88f1('0x12')]=_0x88f1('0x4c');break;case'whatsappaccounts':_0x1248c3[_0x88f1('0x12')]='WhatsappAccount';break;case _0x88f1('0x4d'):_0x1248c3[_0x88f1('0x12')]=_0x88f1('0x4e');break;case'voicequeues':case'queuecampaigns':_0x1248c3['childModel']=_0x88f1('0x38');if(_0x2e7ff1){_0x1248c3[_0x88f1('0x16')]=[{'name':_0x88f1('0x4f')},{'name':_0x88f1('0x3a')}];}break;case _0x88f1('0x50'):case _0x88f1('0x51'):case'telephones':_0x1248c3[_0x88f1('0x12')]=_0x88f1('0x32');if(_0x2e7ff1){_0x1248c3[_0x88f1('0x16')]=[{'name':'Users','filter':{'field':_0x88f1('0x35'),'value':['admin',_0x88f1('0x52')]},'ignore':!![]},{'name':_0x88f1('0x30')},{'name':_0x88f1('0x34')}];}break;case'zendeskaccounts':_0x1248c3['childModel']='ZendeskAccount';break;case'salesforceaccounts':_0x1248c3[_0x88f1('0x12')]=_0x88f1('0x53');break;case _0x88f1('0x54'):_0x1248c3[_0x88f1('0x12')]=_0x88f1('0x55');break;case _0x88f1('0x56'):_0x1248c3[_0x88f1('0x12')]=_0x88f1('0x57');break;case'deskaccounts':_0x1248c3[_0x88f1('0x12')]=_0x88f1('0x58');break;case _0x88f1('0x59'):_0x1248c3['childModel']=_0x88f1('0x5a');break;case _0x88f1('0x5b'):_0x1248c3[_0x88f1('0x12')]=_0x88f1('0x32');break;case _0x88f1('0x5c'):_0x1248c3[_0x88f1('0x12')]=_0x88f1('0x5d');break;case'dispositions':_0x1248c3[_0x88f1('0x12')]=_0x88f1('0x5e');break;case _0x88f1('0x5f'):_0x1248c3[_0x88f1('0x12')]=_0x88f1('0x60');break;case _0x88f1('0x61'):_0x1248c3[_0x88f1('0x12')]='Interval';break;case _0x88f1('0x62'):_0x1248c3[_0x88f1('0x12')]=_0x88f1('0x63');break;case _0x88f1('0x64'):_0x1248c3[_0x88f1('0x12')]='Schedule';break;case _0x88f1('0x65'):_0x1248c3[_0x88f1('0x12')]=_0x88f1('0x66');break;case _0x88f1('0x67'):_0x1248c3[_0x88f1('0x12')]=_0x88f1('0x68');break;case _0x88f1('0x69'):_0x1248c3['childModel']=_0x88f1('0x6a');break;case _0x88f1('0x6b'):_0x1248c3['childModel']=_0x88f1('0x6c');break;case _0x88f1('0x6d'):_0x1248c3[_0x88f1('0x12')]=_0x88f1('0x6e');break;case'variables':_0x1248c3[_0x88f1('0x12')]=_0x88f1('0x6f');break;case _0x88f1('0x70'):_0x1248c3[_0x88f1('0x12')]=_0x88f1('0x71');break;case _0x88f1('0x72'):_0x1248c3[_0x88f1('0x12')]=_0x88f1('0xe');_0x1248c3['parentSections']=[{'name':_0x88f1('0x73'),'field':'id','foreignKey':'reportId'}];break;case _0x88f1('0x74'):_0x1248c3['childModel']='AnalyticMetric';break;}return _0x1248c3;}function _0x2fe076(_0x55c1cb,_0x3383d7){var _0x179e34=_0x55c1cb[_0x88f1('0x75')](0x0)[_0x88f1('0x76')]()+_0x55c1cb[_0x88f1('0x77')](0x1);var _0x55e4e3={'type':_0x39717f[_0x88f1('0x78')]['QueryTypes']['SELECT'],'raw':!![]};return new Promise(function(_0x110663,_0x19ed10){var _0x4b1c00=squel[_0x88f1('0x79')]()[_0x88f1('0x3')](_0x88f1('0x7a')+_0x179e34+_0x88f1('0x7b'),'id')[_0x88f1('0x3')]('ui.createdAt')[_0x88f1('0x7c')](_0x88f1('0x7d')+_0x55c1cb+'_interactions','ui')[_0x88f1('0x7e')](_0x88f1('0x7f'),_0x3383d7['id']);return _0x39717f[_0x88f1('0x80')][_0x88f1('0x81')](_0x4b1c00['toString'](),_0x55e4e3)[_0x88f1('0x82')](function(_0x4bbc4d){_0x3383d7[_0x179e34+'OpenTabs']=_0x4bbc4d;_0x110663(_0x4bbc4d);})['catch'](function(_0x2a5140){_0x19ed10(_0x2a5140);});});}return _0x5aee9a['define'](_0x88f1('0x83'),attributes,{'tableName':_0x88f1('0x84'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x2f02c1){var _0x55a789=require(_0x88f1('0x85'));var _0x30a531={'raw':_0x2f02c1[_0x88f1('0x81')][_0x88f1('0x86')],'where':{}};var _0x1f08be={};var _0x1c68c1={'count':0x0,'rows':[]};var _0x1a44a9=_0x2f02c1['query'][_0x88f1('0x87')];var _0x4dccec=_0x2f02c1[_0x88f1('0x81')][_0x88f1('0x88')]||![];var _0x14646e=_0x35a297(_0x1a44a9,_0x4dccec);if(!_0x14646e['childModel'])throw new Error(_0x88f1('0x89')+_0x1a44a9+'\x27');var _0x266538=[{'name':_0x1a44a9}];if(!_[_0x88f1('0x8a')](_0x14646e[_0x88f1('0x16')]))_0x266538=_0x14646e[_0x88f1('0x16')];var _0x3bcf43=[];for(var _0x47f0a1=0x0;_0x47f0a1<_0x266538[_0x88f1('0x8b')];_0x47f0a1++){_0x3bcf43['push'](_0x39717f[_0x88f1('0x8c')][_0x88f1('0x8d')]({'where':{'userProfileId':_0x2f02c1['params']['id'],'name':_0x266538[_0x47f0a1][_0x88f1('0xa')]},'raw':!![]}));}return Promise[_0x88f1('0x8e')](_0x3bcf43)['then'](function(_0x2548ff){var _0xd4113e=_[_0x88f1('0x4')](_0x2548ff,function(_0x5b6a6f){return _0x5b6a6f?_0x5b6a6f:undefined;});var _0x19c294=_[_0x88f1('0x4')](_0x266538,['ignore',!![]]);var _0x16f8cd=_[_0x88f1('0x8a')](_0xd4113e)&&_[_0x88f1('0x8a')](_0x19c294)?null:_['union'](_0x19c294,_0xd4113e);if(!_0x16f8cd)return null;var _0x463279=[];for(var _0x3619df=0x0;_0x3619df<_0x16f8cd[_0x88f1('0x8b')];_0x3619df++){var _0x1f3e54=_[_0x88f1('0x8d')](_0x266538,function(_0x633735){return _0x16f8cd[_0x3619df]?_0x633735['name']===_0x16f8cd[_0x3619df][_0x88f1('0xa')]:null;});if(_0x1f3e54){if(_0x16f8cd[_0x3619df]['ignore']){_0x463279[_0x88f1('0x8f')](_0x1da27d(_0x14646e[_0x88f1('0x12')],_0x16f8cd[_0x3619df]));}else{if(!_0x16f8cd[_0x3619df][_0x88f1('0x90')]){_0x463279['push'](_0x4e9072(_0x1f3e54,_0x16f8cd[_0x3619df],_0x14646e[_0x88f1('0x12')]));}else{if(_0x1f3e54[_0x88f1('0x8')]){_0x463279[_0x88f1('0x8f')](_0x32a2fa(_0x1f3e54,_0x16f8cd[_0x3619df]));}}}}}return Promise['all'](_0x463279);})[_0x88f1('0x82')](function(_0x3324d8){var _0x835b1b=_0x3324d8;var _0x2b7c9b=null;if(_0x835b1b){_0x2b7c9b=_0x835b1b[_0x88f1('0x8b')]===0x1?_0x835b1b[0x0]:null;}if(!_0x2b7c9b&&!_0x835b1b)return _0x1c68c1;var _0x586001=_0x39717f[_0x14646e[_0x88f1('0x12')]][_0x88f1('0x91')];_0x1f08be['model']=_[_0x88f1('0x92')](_0x586001);_0x1f08be['query']=_[_0x88f1('0x92')](_0x2f02c1[_0x88f1('0x81')]);_0x1f08be[_0x88f1('0x93')]=_[_0x88f1('0x94')](_0x1f08be['model'],_0x1f08be[_0x88f1('0x81')]);_0x30a531[_0x88f1('0x95')]=_[_0x88f1('0x94')](_0x1f08be[_0x88f1('0x8')],_0x55a789[_0x88f1('0x96')](_0x2f02c1[_0x88f1('0x81')]['fields']));_0x30a531['attributes']=_0x30a531[_0x88f1('0x95')]['length']?_0x30a531[_0x88f1('0x95')]:_0x1f08be[_0x88f1('0x8')];if(!_0x2f02c1[_0x88f1('0x81')]['hasOwnProperty'](_0x88f1('0x97'))){_0x30a531[_0x88f1('0x98')]=_0x55a789['limit'](_0x2f02c1['query'][_0x88f1('0x98')]);_0x30a531[_0x88f1('0x99')]=_0x55a789[_0x88f1('0x99')](_0x2f02c1['query'][_0x88f1('0x99')]);}_0x30a531[_0x88f1('0x9a')]=_0x55a789[_0x88f1('0x9b')](_0x2f02c1[_0x88f1('0x81')][_0x88f1('0x9b')]);_0x30a531['where']=_0x55a789['filters'](_[_0x88f1('0x9c')](_0x2f02c1[_0x88f1('0x81')],_0x1f08be[_0x88f1('0x93')]));if(_0x2f02c1[_0x88f1('0x81')]['filter']){_0x30a531[_0x88f1('0x7e')]=_[_0x88f1('0x9d')](_0x30a531[_0x88f1('0x7e')],{'$or':_['map'](_0x586001,function(_0x416f7c){if(_0x416f7c['type'][_0x88f1('0x9e')]!==_0x88f1('0x9f')){var _0x1e9d68={};_0x1e9d68[_0x416f7c[_0x88f1('0x3')]]={'$like':'%'+_0x2f02c1[_0x88f1('0x81')]['filter']+'%'};return _0x1e9d68;}})});}var _0x4d5ad6=[];var _0x3961b7=null;var _0x425b7e={};if(_0x2b7c9b){_0x3961b7=_[_0x88f1('0x8d')](_0x266538,[_0x88f1('0xa'),_0x2b7c9b[_0x88f1('0xa')]]);if(_0x3961b7[_0x88f1('0x3')]){_0x425b7e={};if(_0x14646e['childModel']===_0x88f1('0xe')){_0x425b7e[_0x3961b7[_0x88f1('0xa0')]]=_['map'](_0x2b7c9b['associatedResources'],'id');}else{_0x425b7e[_0x3961b7[_0x88f1('0xa0')]]=_0x2b7c9b[_0x88f1('0x9')];}_0x4d5ad6[_0x88f1('0x8f')](_0x425b7e);}else{_0x30a531[_0x88f1('0x7e')]['id']=_0x2b7c9b[_0x88f1('0x9')];}}else{for(var _0x652a28=0x0;_0x652a28<_0x835b1b[_0x88f1('0x8b')];_0x652a28++){_0x3961b7=_[_0x88f1('0x8d')](_0x266538,[_0x88f1('0xa'),_0x835b1b[_0x652a28][_0x88f1('0xa')]]);if(_0x3961b7[_0x88f1('0x3')]){_0x425b7e={};_0x425b7e[_0x3961b7[_0x88f1('0xa0')]]=_0x835b1b[_0x652a28][_0x88f1('0x9')];_0x4d5ad6['push'](_0x425b7e);}else{if(!_0x30a531['where']['id'])_0x30a531[_0x88f1('0x7e')]['id']=[];_0x835b1b[_0x652a28][_0x88f1('0x9')]['forEach'](function(_0x18458d){_0x30a531[_0x88f1('0x7e')]['id'][_0x88f1('0x8f')](_0x18458d);});}}}if(!_[_0x88f1('0x8a')](_0x4d5ad6)){_0x30a531[_0x88f1('0x7e')]=_[_0x88f1('0x9d')](_0x30a531[_0x88f1('0x7e')],{'$and':{'$or':_0x4d5ad6}});}_0x30a531=_[_0x88f1('0x9d')]({},_0x30a531,_0x2f02c1[_0x88f1('0xa1')]);if(_0x2b7c9b&&!_0x2b7c9b[_0x88f1('0x90')]&&_0x14646e['childModel']===_0x88f1('0xe')){if(_0x2f02c1['query']['includeAll']){_0x30a531[_0x88f1('0xa2')]=[{'all':!![]}];}return _0x39717f[_0x14646e[_0x88f1('0x12')]][_0x88f1('0x6')](_0x30a531)['then'](function(_0x432260){var _0x29ed7a=[];_0x432260['forEach'](function(_0x4a1f4d){var _0x5759cb;switch(_0x4a1f4d[_0x88f1('0xa3')]){case'default':_0x5759cb=_['find'](_0x2b7c9b[_0x88f1('0x9')],function(_0x27cea7){return _0x27cea7['id']===_0x4a1f4d[_0x88f1('0xa4')]&&_0x27cea7[_0x88f1('0x10')]==='DefaultReports';});break;case _0x88f1('0xa5'):_0x5759cb=_[_0x88f1('0x8d')](_0x2b7c9b[_0x88f1('0x9')],function(_0x2adb8d){return _0x2adb8d['id']===_0x4a1f4d[_0x88f1('0xa4')]&&_0x2adb8d[_0x88f1('0x10')]===_0x88f1('0xa6');});break;}if(_0x5759cb)_0x29ed7a[_0x88f1('0x8f')](_0x4a1f4d);});_0x1c68c1[_0x88f1('0xa7')]=_0x29ed7a[_0x88f1('0x8b')];_0x1c68c1[_0x88f1('0xa8')]=_0x29ed7a;return _0x1c68c1;});}else{if(!_[_0x88f1('0x8a')](_0x2f02c1[_0x88f1('0x81')]['ids'])){_0x30a531['where']['id']=_0x30a531[_0x88f1('0x7e')]['id']?_[_0x88f1('0x94')](_0x30a531[_0x88f1('0x7e')]['id'],_0x2f02c1[_0x88f1('0x81')][_0x88f1('0xa9')]):_0x2f02c1['query'][_0x88f1('0xa9')];if(_0x2f02c1[_0x88f1('0x81')][_0x88f1('0xaa')]){_0x30a531[_0x88f1('0x9a')]=_0x2f02c1['query']['customSorting'];}}if(_0x2f02c1[_0x88f1('0x81')][_0x88f1('0xab')]){_0x30a531['where']=_[_0x88f1('0x9d')](_0x30a531['where'],{'$and':_0x2f02c1[_0x88f1('0x81')][_0x88f1('0xab')]});}return _0x39717f[_0x14646e[_0x88f1('0x12')]][_0x88f1('0xa7')]({'where':_0x30a531[_0x88f1('0x7e')]})[_0x88f1('0x82')](function(_0xdfae62){_0x1c68c1['count']=_0xdfae62;if(_0x2f02c1[_0x88f1('0x81')][_0x88f1('0xac')]){if(_0x14646e[_0x88f1('0x12')]===_0x88f1('0x1b')){_0x30a531[_0x88f1('0xa2')]=[{'model':_0x39717f[_0x88f1('0x68')],'as':_0x88f1('0xad'),'attributes':['id',_0x88f1('0xa'),_0x88f1('0xae')],'required':_0x2f02c1[_0x88f1('0x81')][_0x88f1('0xaf')]?!![]:![]},{'model':_0x39717f['Tag'],'as':_0x88f1('0xb0'),'attributes':['id',_0x88f1('0xa'),_0x88f1('0xae')],'through':_0x2f02c1[_0x88f1('0x81')][_0x88f1('0xaf')]?{'attributes':[],'where':{'TagId':_0x2f02c1[_0x88f1('0x81')][_0x88f1('0xaf')]||undefined}}:{},'required':_0x2f02c1[_0x88f1('0x81')][_0x88f1('0xaf')]?!![]:![]}];}else{_0x30a531[_0x88f1('0xa2')]=[{'all':!![]}];}}return _0x39717f[_0x14646e[_0x88f1('0x12')]][_0x88f1('0x6')](_0x30a531);})[_0x88f1('0x82')](function(_0xfb3839){_0x1c68c1[_0x88f1('0xa8')]=_0xfb3839;if(_0x1a44a9==='Agents'&&_0x2f02c1[_0x88f1('0x81')][_0x88f1('0xb1')]==='true'){var _0x2e2e9e=[];for(var _0x400980=0x0;_0x400980<_0x1c68c1[_0x88f1('0xa8')][_0x88f1('0x8b')];_0x400980++){_0x2e2e9e[_0x88f1('0x8f')](_0x2fe076('chat',_0x1c68c1[_0x88f1('0xa8')][_0x400980][_0x88f1('0xb2')]));_0x2e2e9e[_0x88f1('0x8f')](_0x2fe076('sms',_0x1c68c1[_0x88f1('0xa8')][_0x400980][_0x88f1('0xb2')]));_0x2e2e9e[_0x88f1('0x8f')](_0x2fe076('fax',_0x1c68c1[_0x88f1('0xa8')][_0x400980][_0x88f1('0xb2')]));_0x2e2e9e[_0x88f1('0x8f')](_0x2fe076('mail',_0x1c68c1[_0x88f1('0xa8')][_0x400980][_0x88f1('0xb2')]));_0x2e2e9e[_0x88f1('0x8f')](_0x2fe076(_0x88f1('0xb3'),_0x1c68c1[_0x88f1('0xa8')][_0x400980][_0x88f1('0xb2')]));_0x2e2e9e[_0x88f1('0x8f')](_0x2fe076('whatsapp',_0x1c68c1[_0x88f1('0xa8')][_0x400980][_0x88f1('0xb2')]));}return Promise[_0x88f1('0x8e')](_0x2e2e9e)['then'](function(){return _0x1c68c1;});}return _0x1c68c1;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 7c58360..4290c3b 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 _0xba0d=['bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','request','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','moment'];(function(_0x4c87d1,_0x1e547b){var _0x2b44ce=function(_0x3844ae){while(--_0x3844ae){_0x4c87d1['push'](_0x4c87d1['shift']());}};_0x2b44ce(++_0x1e547b);}(_0xba0d,0x8e));var _0xdba0=function(_0x325b07,_0x5cfc13){_0x325b07=_0x325b07-0x0;var _0x3926f2=_0xba0d[_0x325b07];return _0x3926f2;};'use strict';var _=require(_0xdba0('0x0'));var util=require('util');var moment=require(_0xdba0('0x1'));var BPromise=require(_0xdba0('0x2'));var rs=require(_0xdba0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdba0('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xdba0('0x5'))(_0xdba0('0x6'));var config=require(_0xdba0('0x7'));var jayson=require(_0xdba0('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0xdba0('0x9')]=_[_0xdba0('0xa')](config[_0xdba0('0x9')],{'host':_0xdba0('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdba0('0x9')]));require('./userProfile.socket')['register'](socket);function respondWithRpcPromise(_0x21cb20,_0x4d01a9,_0x268cc3){return new BPromise(function(_0x56d368,_0x1b4dec){return client[_0xdba0('0xc')](_0x21cb20,_0x268cc3)[_0xdba0('0xd')](function(_0x193cd6){logger[_0xdba0('0xe')](_0xdba0('0xf'),_0x4d01a9,_0xdba0('0x10'));logger[_0xdba0('0x11')]('UserProfile,\x20%s,\x20%s,\x20%s',_0x4d01a9,'request\x20sent',JSON[_0xdba0('0x12')](_0x193cd6));if(_0x193cd6[_0xdba0('0x13')]){if(_0x193cd6[_0xdba0('0x13')][_0xdba0('0x14')]===0x1f4){logger[_0xdba0('0x13')](_0xdba0('0xf'),_0x4d01a9,_0x193cd6[_0xdba0('0x13')]['message']);return _0x1b4dec(_0x193cd6[_0xdba0('0x13')][_0xdba0('0x15')]);}logger[_0xdba0('0x13')](_0xdba0('0xf'),_0x4d01a9,_0x193cd6[_0xdba0('0x13')][_0xdba0('0x15')]);return _0x56d368(_0x193cd6[_0xdba0('0x13')][_0xdba0('0x15')]);}else{logger[_0xdba0('0xe')](_0xdba0('0xf'),_0x4d01a9,'request\x20sent');_0x56d368(_0x193cd6[_0xdba0('0x16')]['message']);}})[_0xdba0('0x17')](function(_0x2915e6){logger[_0xdba0('0x13')](_0xdba0('0xf'),_0x4d01a9,_0x2915e6);_0x1b4dec(_0x2915e6);});});} \ No newline at end of file +var _0xe0dc=['../../config/logger','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','request','then','info','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','UserProfile,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0xdda617,_0x54ca1b){var _0x3b8bd9=function(_0x2fad0e){while(--_0x2fad0e){_0xdda617['push'](_0xdda617['shift']());}};_0x3b8bd9(++_0x54ca1b);}(_0xe0dc,0x190));var _0xce0d=function(_0x54b283,_0x5eb8a6){_0x54b283=_0x54b283-0x0;var _0x2462b3=_0xe0dc[_0x54b283];return _0x2462b3;};'use strict';var _=require(_0xce0d('0x0'));var util=require('util');var moment=require(_0xce0d('0x1'));var BPromise=require(_0xce0d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xce0d('0x3'));var db=require(_0xce0d('0x4'))['db'];var utils=require(_0xce0d('0x5'));var logger=require(_0xce0d('0x6'))('rpc');var config=require(_0xce0d('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xce0d('0x8')][_0xce0d('0x9')]({'port':0x232a});config[_0xce0d('0xa')]=_[_0xce0d('0xb')](config[_0xce0d('0xa')],{'host':_0xce0d('0xc'),'port':0x18eb});var socket=require(_0xce0d('0xd'))(new Redis(config[_0xce0d('0xa')]));require(_0xce0d('0xe'))[_0xce0d('0xf')](socket);function respondWithRpcPromise(_0x29b996,_0xada75a,_0xc0e7c5){return new BPromise(function(_0x3edaad,_0x3a4d42){return client[_0xce0d('0x10')](_0x29b996,_0xc0e7c5)[_0xce0d('0x11')](function(_0x431271){logger[_0xce0d('0x12')]('UserProfile,\x20%s,\x20%s',_0xada75a,_0xce0d('0x13'));logger[_0xce0d('0x14')](_0xce0d('0x15'),_0xada75a,_0xce0d('0x13'),JSON[_0xce0d('0x16')](_0x431271));if(_0x431271[_0xce0d('0x17')]){if(_0x431271[_0xce0d('0x17')][_0xce0d('0x18')]===0x1f4){logger[_0xce0d('0x17')](_0xce0d('0x19'),_0xada75a,_0x431271[_0xce0d('0x17')][_0xce0d('0x1a')]);return _0x3a4d42(_0x431271[_0xce0d('0x17')][_0xce0d('0x1a')]);}logger[_0xce0d('0x17')](_0xce0d('0x19'),_0xada75a,_0x431271[_0xce0d('0x17')][_0xce0d('0x1a')]);return _0x3edaad(_0x431271[_0xce0d('0x17')][_0xce0d('0x1a')]);}else{logger[_0xce0d('0x12')](_0xce0d('0x19'),_0xada75a,_0xce0d('0x13'));_0x3edaad(_0x431271[_0xce0d('0x1b')][_0xce0d('0x1a')]);}})[_0xce0d('0x1c')](function(_0x1f4049){logger[_0xce0d('0x17')](_0xce0d('0x19'),_0xada75a,_0x1f4049);_0x3a4d42(_0x1f4049);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 44afe82..35f0263 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 _0x3fa2=['userProfile:','./userProfile.events','save','remove','register','length'];(function(_0x370f74,_0x247d3c){var _0x34c764=function(_0x5e19e8){while(--_0x5e19e8){_0x370f74['push'](_0x370f74['shift']());}};_0x34c764(++_0x247d3c);}(_0x3fa2,0x121));var _0x23fa=function(_0x1222fa,_0x39a7b9){_0x1222fa=_0x1222fa-0x0;var _0x1dcd74=_0x3fa2[_0x1222fa];return _0x1dcd74;};'use strict';var UserProfileEvents=require(_0x23fa('0x0'));var events=[_0x23fa('0x1'),_0x23fa('0x2'),'update'];function createListener(_0x1bcace,_0xb02ce){return function(_0x17e7fe){_0xb02ce['emit'](_0x1bcace,_0x17e7fe);};}function removeListener(_0x1bf916,_0xe48ad1){return function(){UserProfileEvents['removeListener'](_0x1bf916,_0xe48ad1);};}exports[_0x23fa('0x3')]=function(_0x1914d8){for(var _0x45a83d=0x0,_0x11eb9a=events[_0x23fa('0x4')];_0x45a83d<_0x11eb9a;_0x45a83d++){var _0x285258=events[_0x45a83d];var _0x58fa0c=createListener(_0x23fa('0x5')+_0x285258,_0x1914d8);UserProfileEvents['on'](_0x285258,_0x58fa0c);}}; \ No newline at end of file +var _0x8481=['removeListener','register','length','userProfile:','./userProfile.events','remove','update','emit'];(function(_0x32eca6,_0x132713){var _0x242626=function(_0x4a17a8){while(--_0x4a17a8){_0x32eca6['push'](_0x32eca6['shift']());}};_0x242626(++_0x132713);}(_0x8481,0x114));var _0x1848=function(_0x4a82ac,_0x1fb931){_0x4a82ac=_0x4a82ac-0x0;var _0x58ee97=_0x8481[_0x4a82ac];return _0x58ee97;};'use strict';var UserProfileEvents=require(_0x1848('0x0'));var events=['save',_0x1848('0x1'),_0x1848('0x2')];function createListener(_0x5480bd,_0x545cd5){return function(_0x4c125d){_0x545cd5[_0x1848('0x3')](_0x5480bd,_0x4c125d);};}function removeListener(_0x5f45ba,_0x99708c){return function(){UserProfileEvents[_0x1848('0x4')](_0x5f45ba,_0x99708c);};}exports[_0x1848('0x5')]=function(_0x2678a7){for(var _0x5f3fe0=0x0,_0x177192=events[_0x1848('0x6')];_0x5f3fe0<_0x177192;_0x5f3fe0++){var _0xfac01b=events[_0x5f3fe0];var _0x14dcbc=createListener(_0x1848('0x7')+_0xfac01b,_0x2678a7);UserProfileEvents['on'](_0xfac01b,_0x14dcbc);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index d2add07..2290cc8 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 _0xb564=['../../components/auth/service','../../components/interaction/service','./userProfileResource.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','put','update','destroy','util','path','connect-timeout','Router','fs-extra'];(function(_0x428cac,_0xc3e5){var _0x26446e=function(_0x3c8fe6){while(--_0x3c8fe6){_0x428cac['push'](_0x428cac['shift']());}};_0x26446e(++_0xc3e5);}(_0xb564,0x93));var _0x4b56=function(_0x3aaf77,_0x5930bf){_0x3aaf77=_0x3aaf77-0x0;var _0x4b0bdb=_0xb564[_0x3aaf77];return _0x4b0bdb;};'use strict';var multer=require('multer');var util=require(_0x4b56('0x0'));var path=require(_0x4b56('0x1'));var timeout=require(_0x4b56('0x2'));var express=require('express');var router=express[_0x4b56('0x3')]();var fs_extra=require(_0x4b56('0x4'));var auth=require(_0x4b56('0x5'));var interaction=require(_0x4b56('0x6'));var config=require('../../config/environment');var controller=require(_0x4b56('0x7'));router[_0x4b56('0x8')]('/',auth[_0x4b56('0x9')](),controller['index']);router[_0x4b56('0x8')](_0x4b56('0xa'),auth[_0x4b56('0x9')](),controller[_0x4b56('0xb')]);router[_0x4b56('0x8')](_0x4b56('0xc'),auth[_0x4b56('0x9')](),controller[_0x4b56('0xd')]);router[_0x4b56('0xe')]('/',auth[_0x4b56('0x9')](),controller[_0x4b56('0xf')]);router[_0x4b56('0x10')]('/:id',auth[_0x4b56('0x9')](),controller[_0x4b56('0x11')]);router['delete'](_0x4b56('0xc'),auth[_0x4b56('0x9')](),controller[_0x4b56('0x12')]);module['exports']=router; \ No newline at end of file +var _0x6f69=['put','update','delete','destroy','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','./userProfileResource.controller','isAuthenticated','index','get','/:id','show','post','create'];(function(_0x385567,_0x40550f){var _0x49cf95=function(_0x4d3081){while(--_0x4d3081){_0x385567['push'](_0x385567['shift']());}};_0x49cf95(++_0x40550f);}(_0x6f69,0x1e0));var _0x96f6=function(_0x17c412,_0x5b0714){_0x17c412=_0x17c412-0x0;var _0x568900=_0x6f69[_0x17c412];return _0x568900;};'use strict';var multer=require(_0x96f6('0x0'));var util=require(_0x96f6('0x1'));var path=require(_0x96f6('0x2'));var timeout=require('connect-timeout');var express=require(_0x96f6('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x96f6('0x4'));var interaction=require(_0x96f6('0x5'));var config=require('../../config/environment');var controller=require(_0x96f6('0x6'));router['get']('/',auth[_0x96f6('0x7')](),controller[_0x96f6('0x8')]);router[_0x96f6('0x9')]('/describe',auth['isAuthenticated'](),controller['describe']);router['get'](_0x96f6('0xa'),auth[_0x96f6('0x7')](),controller[_0x96f6('0xb')]);router[_0x96f6('0xc')]('/',auth['isAuthenticated'](),controller[_0x96f6('0xd')]);router[_0x96f6('0xe')](_0x96f6('0xa'),auth['isAuthenticated'](),controller[_0x96f6('0xf')]);router[_0x96f6('0x10')](_0x96f6('0xa'),auth['isAuthenticated'](),controller[_0x96f6('0x11')]);module[_0x96f6('0x12')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index fa54e6e..7fa39a3 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 _0x8c93=['INTEGER','exports','STRING'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8c93,0x193));var _0x38c9=function(_0x1e2b8e,_0x3d9b95){_0x1e2b8e=_0x1e2b8e-0x0;var _0x28a76f=_0x8c93[_0x1e2b8e];return _0x28a76f;};'use strict';var Sequelize=require('sequelize');module[_0x38c9('0x0')]={'name':{'type':Sequelize[_0x38c9('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x38c9('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x38c9('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x35d9=['INTEGER','sequelize','exports','STRING'];(function(_0x54b321,_0x2d3c0c){var _0x5f0f18=function(_0xc0cc12){while(--_0xc0cc12){_0x54b321['push'](_0x54b321['shift']());}};_0x5f0f18(++_0x2d3c0c);}(_0x35d9,0xed));var _0x935d=function(_0x2244d3,_0x4280bc){_0x2244d3=_0x2244d3-0x0;var _0x5720dd=_0x35d9[_0x2244d3];return _0x5720dd;};'use strict';var Sequelize=require(_0x935d('0x0'));module[_0x935d('0x1')]={'name':{'type':Sequelize[_0x935d('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x935d('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x935d('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index a4537e0..48f6ab2 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 _0x4888=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','json','offset','limit','undefined','count','set','apply','reject','save','then','sendStatus','error','name','send','index','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','VIRTUAL','merge','UserProfileResource','includeAll','include','rows','catch','params','options','create','body','update','find','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x16d10f,_0x2ba2d5){var _0x50c823=function(_0x44e43f){while(--_0x44e43f){_0x16d10f['push'](_0x16d10f['shift']());}};_0x50c823(++_0x2ba2d5);}(_0x4888,0x198));var _0x8488=function(_0x355adc,_0xac51ab){_0x355adc=_0x355adc-0x0;var _0x4df04f=_0x4888[_0x355adc];return _0x4df04f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8488('0x0'));var zipdir=require(_0x8488('0x1'));var jsonpatch=require(_0x8488('0x2'));var rp=require(_0x8488('0x3'));var moment=require(_0x8488('0x4'));var BPromise=require(_0x8488('0x5'));var Mustache=require(_0x8488('0x6'));var util=require('util');var path=require(_0x8488('0x7'));var sox=require(_0x8488('0x8'));var csv=require(_0x8488('0x9'));var ejs=require(_0x8488('0xa'));var fs=require('fs');var fs_extra=require(_0x8488('0xb'));var _=require(_0x8488('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8488('0x9'));var querystring=require(_0x8488('0xd'));var Papa=require('papaparse');var Redis=require(_0x8488('0xe'));var authService=require(_0x8488('0xf'));var qs=require(_0x8488('0x10'));var as=require(_0x8488('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8488('0x12'))(_0x8488('0x13'));var utils=require(_0x8488('0x14'));var config=require(_0x8488('0x15'));var licenseUtil=require(_0x8488('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x14462e,_0x3d1f7a){_0x3d1f7a=_0x3d1f7a||0xcc;return function(_0x58f83d){if(_0x58f83d){return _0x14462e['sendStatus'](_0x3d1f7a);}return _0x14462e[_0x8488('0x17')](_0x3d1f7a)['end']();};}function respondWithResult(_0x214083,_0x4e94fc){_0x4e94fc=_0x4e94fc||0xc8;return function(_0x5161a3){if(_0x5161a3){return _0x214083[_0x8488('0x17')](_0x4e94fc)[_0x8488('0x18')](_0x5161a3);}};}function respondWithFilteredResult(_0x5700b,_0x2bcb7c){return function(_0x3b3cfa){if(_0x3b3cfa){var _0x8d3b3d=typeof _0x2bcb7c[_0x8488('0x19')]==='undefined'&&typeof _0x2bcb7c[_0x8488('0x1a')]===_0x8488('0x1b');var _0x3edfe4=_0x3b3cfa[_0x8488('0x1c')];var _0x60ae2f=_0x8d3b3d?0x0:_0x2bcb7c[_0x8488('0x19')];var _0x1aedb1=_0x8d3b3d?_0x3b3cfa[_0x8488('0x1c')]:_0x2bcb7c[_0x8488('0x19')]+_0x2bcb7c[_0x8488('0x1a')];var _0x10bfd6;if(_0x1aedb1>=_0x3edfe4){_0x1aedb1=_0x3edfe4;_0x10bfd6=0xc8;}else{_0x10bfd6=0xce;}_0x5700b[_0x8488('0x17')](_0x10bfd6);return _0x5700b[_0x8488('0x1d')]('Content-Range',_0x60ae2f+'-'+_0x1aedb1+'/'+_0x3edfe4)['json'](_0x3b3cfa);}return null;};}function patchUpdates(_0x340d6b){return function(_0x12d40f){try{jsonpatch[_0x8488('0x1e')](_0x12d40f,_0x340d6b,!![]);}catch(_0x3c9fc2){return BPromise[_0x8488('0x1f')](_0x3c9fc2);}return _0x12d40f[_0x8488('0x20')]();};}function saveUpdates(_0x43b672,_0x3c078c){return function(_0x39dd43){if(_0x39dd43){return _0x39dd43['update'](_0x43b672)[_0x8488('0x21')](function(_0x4e07e1){return _0x4e07e1;});}return null;};}function removeEntity(_0x140b0b,_0x1361a6){return function(_0x290b33){if(_0x290b33){return _0x290b33['destroy']()['then'](function(){_0x140b0b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x472624,_0x51fe30){return function(_0x58057a){if(!_0x58057a){_0x472624[_0x8488('0x22')](0x194);}return _0x58057a;};}function handleError(_0x2f350a,_0x2b3c97){_0x2b3c97=_0x2b3c97||0x1f4;return function(_0x6ebee0){logger[_0x8488('0x23')](_0x6ebee0['stack']);if(_0x6ebee0[_0x8488('0x24')]){delete _0x6ebee0[_0x8488('0x24')];}_0x2f350a[_0x8488('0x17')](_0x2b3c97)[_0x8488('0x25')](_0x6ebee0);};}exports[_0x8488('0x26')]=function(_0x27f5cf,_0x2c15ff){var _0x296b6c={},_0x368f9c={},_0x1d9317={'count':0x0,'rows':[]};var _0x888b24=_['map'](db['UserProfileResource']['rawAttributes'],function(_0x292fe8){return{'name':_0x292fe8[_0x8488('0x27')],'type':_0x292fe8[_0x8488('0x28')][_0x8488('0x29')]};});_0x368f9c[_0x8488('0x2a')]=_[_0x8488('0x2b')](_0x888b24,'name');_0x368f9c[_0x8488('0x2c')]=_[_0x8488('0x2d')](_0x27f5cf[_0x8488('0x2c')]);_0x368f9c[_0x8488('0x2e')]=_[_0x8488('0x2f')](_0x368f9c['model'],_0x368f9c[_0x8488('0x2c')]);_0x296b6c[_0x8488('0x30')]=_['intersection'](_0x368f9c[_0x8488('0x2a')],qs[_0x8488('0x31')](_0x27f5cf[_0x8488('0x2c')][_0x8488('0x31')]));_0x296b6c[_0x8488('0x30')]=_0x296b6c['attributes'][_0x8488('0x32')]?_0x296b6c[_0x8488('0x30')]:_0x368f9c[_0x8488('0x2a')];if(!_0x27f5cf['query'][_0x8488('0x33')]('nolimit')){_0x296b6c[_0x8488('0x1a')]=qs[_0x8488('0x1a')](_0x27f5cf[_0x8488('0x2c')][_0x8488('0x1a')]);_0x296b6c['offset']=qs[_0x8488('0x19')](_0x27f5cf[_0x8488('0x2c')][_0x8488('0x19')]);}_0x296b6c['order']=qs[_0x8488('0x34')](_0x27f5cf[_0x8488('0x2c')][_0x8488('0x34')]);_0x296b6c[_0x8488('0x35')]=qs[_0x8488('0x2e')](_[_0x8488('0x36')](_0x27f5cf[_0x8488('0x2c')],_0x368f9c[_0x8488('0x2e')]),_0x888b24);if(_0x27f5cf[_0x8488('0x2c')][_0x8488('0x37')]){_0x296b6c[_0x8488('0x35')]=_['merge'](_0x296b6c['where'],{'$or':_[_0x8488('0x2b')](_0x888b24,function(_0x36c17a){if(_0x36c17a[_0x8488('0x28')]!==_0x8488('0x38')){var _0x2d9fa1={};_0x2d9fa1[_0x36c17a[_0x8488('0x24')]]={'$like':'%'+_0x27f5cf[_0x8488('0x2c')][_0x8488('0x37')]+'%'};return _0x2d9fa1;}})});}_0x296b6c=_[_0x8488('0x39')]({},_0x296b6c,_0x27f5cf['options']);var _0xf5a0a0={'where':_0x296b6c[_0x8488('0x35')]};return db[_0x8488('0x3a')]['count'](_0xf5a0a0)[_0x8488('0x21')](function(_0xa50c4b){_0x1d9317[_0x8488('0x1c')]=_0xa50c4b;if(_0x27f5cf[_0x8488('0x2c')][_0x8488('0x3b')]){_0x296b6c[_0x8488('0x3c')]=[{'all':!![]}];}return db[_0x8488('0x3a')]['findAll'](_0x296b6c);})[_0x8488('0x21')](function(_0x1c33a1){_0x1d9317[_0x8488('0x3d')]=_0x1c33a1;return _0x1d9317;})['then'](respondWithFilteredResult(_0x2c15ff,_0x296b6c))[_0x8488('0x3e')](handleError(_0x2c15ff,null));};exports['show']=function(_0x40ee7e,_0x34b11b){var _0x5cbd11={'raw':![],'where':{'id':_0x40ee7e[_0x8488('0x3f')]['id']}},_0x22a3f3={};_0x22a3f3[_0x8488('0x2a')]=_[_0x8488('0x2d')](db[_0x8488('0x3a')]['rawAttributes']);_0x22a3f3[_0x8488('0x2c')]=_['keys'](_0x40ee7e[_0x8488('0x2c')]);_0x22a3f3[_0x8488('0x2e')]=_[_0x8488('0x2f')](_0x22a3f3[_0x8488('0x2a')],_0x22a3f3[_0x8488('0x2c')]);_0x5cbd11[_0x8488('0x30')]=_[_0x8488('0x2f')](_0x22a3f3[_0x8488('0x2a')],qs[_0x8488('0x31')](_0x40ee7e[_0x8488('0x2c')][_0x8488('0x31')]));_0x5cbd11[_0x8488('0x30')]=_0x5cbd11[_0x8488('0x30')][_0x8488('0x32')]?_0x5cbd11[_0x8488('0x30')]:_0x22a3f3[_0x8488('0x2a')];if(_0x40ee7e[_0x8488('0x2c')]['includeAll']){_0x5cbd11[_0x8488('0x3c')]=[{'all':!![]}];}_0x5cbd11=_[_0x8488('0x39')]({},_0x5cbd11,_0x40ee7e[_0x8488('0x40')]);return db[_0x8488('0x3a')]['find'](_0x5cbd11)[_0x8488('0x21')](handleEntityNotFound(_0x34b11b,null))[_0x8488('0x21')](respondWithResult(_0x34b11b,null))[_0x8488('0x3e')](handleError(_0x34b11b,null));};exports[_0x8488('0x41')]=function(_0x52042c,_0x1f0516){return db[_0x8488('0x3a')][_0x8488('0x41')](_0x52042c[_0x8488('0x42')],{})[_0x8488('0x21')](respondWithResult(_0x1f0516,0xc9))[_0x8488('0x3e')](handleError(_0x1f0516,null));};exports[_0x8488('0x43')]=function(_0x299d8e,_0x1bc2e1){if(_0x299d8e[_0x8488('0x42')]['id']){delete _0x299d8e[_0x8488('0x42')]['id'];}return db[_0x8488('0x3a')][_0x8488('0x44')]({'where':{'id':_0x299d8e['params']['id']}})['then'](handleEntityNotFound(_0x1bc2e1,null))[_0x8488('0x21')](saveUpdates(_0x299d8e[_0x8488('0x42')],null))[_0x8488('0x21')](respondWithResult(_0x1bc2e1,null))[_0x8488('0x3e')](handleError(_0x1bc2e1,null));};exports[_0x8488('0x45')]=function(_0x22d22c,_0x25f2dc){return db[_0x8488('0x3a')][_0x8488('0x44')]({'where':{'id':_0x22d22c['params']['id']}})[_0x8488('0x21')](handleEntityNotFound(_0x25f2dc,null))[_0x8488('0x21')](removeEntity(_0x25f2dc,null))['catch'](handleError(_0x25f2dc,null));};exports[_0x8488('0x46')]=function(_0x313e00,_0x186747){return db[_0x8488('0x3a')]['describe']()[_0x8488('0x21')](respondWithResult(_0x186747,null))[_0x8488('0x3e')](handleError(_0x186747,null));}; \ No newline at end of file +var _0x5f2f=['offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','stack','name','send','index','UserProfileResource','rawAttributes','fieldName','type','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','merge','where','options','includeAll','include','findAll','rows','catch','keys','find','body','params','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status'];(function(_0x1443eb,_0x203408){var _0x2b8810=function(_0x48bc4e){while(--_0x48bc4e){_0x1443eb['push'](_0x1443eb['shift']());}};_0x2b8810(++_0x203408);}(_0x5f2f,0x73));var _0xf5f2=function(_0x15d30c,_0x4e22f7){_0x15d30c=_0x15d30c-0x0;var _0x2191c4=_0x5f2f[_0x15d30c];return _0x2191c4;};'use strict';var emlformat=require(_0xf5f2('0x0'));var rimraf=require(_0xf5f2('0x1'));var zipdir=require(_0xf5f2('0x2'));var jsonpatch=require(_0xf5f2('0x3'));var rp=require(_0xf5f2('0x4'));var moment=require(_0xf5f2('0x5'));var BPromise=require(_0xf5f2('0x6'));var Mustache=require(_0xf5f2('0x7'));var util=require('util');var path=require('path');var sox=require(_0xf5f2('0x8'));var csv=require(_0xf5f2('0x9'));var ejs=require(_0xf5f2('0xa'));var fs=require('fs');var fs_extra=require(_0xf5f2('0xb'));var _=require(_0xf5f2('0xc'));var squel=require(_0xf5f2('0xd'));var crypto=require('crypto');var jsforce=require(_0xf5f2('0xe'));var deskjs=require(_0xf5f2('0xf'));var toCsv=require(_0xf5f2('0x9'));var querystring=require('querystring');var Papa=require(_0xf5f2('0x10'));var Redis=require(_0xf5f2('0x11'));var authService=require(_0xf5f2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf5f2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf5f2('0x14'));var utils=require(_0xf5f2('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf5f2('0x16'));var db=require(_0xf5f2('0x17'))['db'];function respondWithStatusCode(_0x331482,_0x3f2997){_0x3f2997=_0x3f2997||0xcc;return function(_0x59bb6c){if(_0x59bb6c){return _0x331482[_0xf5f2('0x18')](_0x3f2997);}return _0x331482['status'](_0x3f2997)[_0xf5f2('0x19')]();};}function respondWithResult(_0xea612c,_0x269909){_0x269909=_0x269909||0xc8;return function(_0x1c1a5c){if(_0x1c1a5c){return _0xea612c[_0xf5f2('0x1a')](_0x269909)['json'](_0x1c1a5c);}};}function respondWithFilteredResult(_0xafe430,_0x286197){return function(_0x17d656){if(_0x17d656){var _0x1b6dd2=typeof _0x286197[_0xf5f2('0x1b')]===_0xf5f2('0x1c')&&typeof _0x286197[_0xf5f2('0x1d')]===_0xf5f2('0x1c');var _0x11f702=_0x17d656[_0xf5f2('0x1e')];var _0x20fccd=_0x1b6dd2?0x0:_0x286197[_0xf5f2('0x1b')];var _0x4ff59b=_0x1b6dd2?_0x17d656[_0xf5f2('0x1e')]:_0x286197[_0xf5f2('0x1b')]+_0x286197[_0xf5f2('0x1d')];var _0x1bf655;if(_0x4ff59b>=_0x11f702){_0x4ff59b=_0x11f702;_0x1bf655=0xc8;}else{_0x1bf655=0xce;}_0xafe430['status'](_0x1bf655);return _0xafe430[_0xf5f2('0x1f')](_0xf5f2('0x20'),_0x20fccd+'-'+_0x4ff59b+'/'+_0x11f702)['json'](_0x17d656);}return null;};}function patchUpdates(_0x47acfc){return function(_0x2d2805){try{jsonpatch[_0xf5f2('0x21')](_0x2d2805,_0x47acfc,!![]);}catch(_0x4ae323){return BPromise[_0xf5f2('0x22')](_0x4ae323);}return _0x2d2805[_0xf5f2('0x23')]();};}function saveUpdates(_0x39e44a,_0x39c024){return function(_0x36f1cb){if(_0x36f1cb){return _0x36f1cb['update'](_0x39e44a)[_0xf5f2('0x24')](function(_0x4669a6){return _0x4669a6;});}return null;};}function removeEntity(_0x4e8bda,_0x2833fe){return function(_0x287ad5){if(_0x287ad5){return _0x287ad5['destroy']()['then'](function(){_0x4e8bda[_0xf5f2('0x1a')](0xcc)[_0xf5f2('0x19')]();});}};}function handleEntityNotFound(_0x13da6f,_0x1a5bb3){return function(_0xf6c58d){if(!_0xf6c58d){_0x13da6f[_0xf5f2('0x18')](0x194);}return _0xf6c58d;};}function handleError(_0x13a3be,_0x281ec8){_0x281ec8=_0x281ec8||0x1f4;return function(_0x294414){logger['error'](_0x294414[_0xf5f2('0x25')]);if(_0x294414[_0xf5f2('0x26')]){delete _0x294414[_0xf5f2('0x26')];}_0x13a3be[_0xf5f2('0x1a')](_0x281ec8)[_0xf5f2('0x27')](_0x294414);};}exports[_0xf5f2('0x28')]=function(_0x5b6672,_0x53cb96){var _0x22c826={},_0x14c829={},_0x11c771={'count':0x0,'rows':[]};var _0x5027ab=_['map'](db[_0xf5f2('0x29')][_0xf5f2('0x2a')],function(_0x17394a){return{'name':_0x17394a[_0xf5f2('0x2b')],'type':_0x17394a[_0xf5f2('0x2c')]['key']};});_0x14c829['model']=_[_0xf5f2('0x2d')](_0x5027ab,'name');_0x14c829[_0xf5f2('0x2e')]=_['keys'](_0x5b6672[_0xf5f2('0x2e')]);_0x14c829[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x14c829[_0xf5f2('0x31')],_0x14c829[_0xf5f2('0x2e')]);_0x22c826[_0xf5f2('0x32')]=_[_0xf5f2('0x30')](_0x14c829[_0xf5f2('0x31')],qs['fields'](_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x33')]));_0x22c826[_0xf5f2('0x32')]=_0x22c826[_0xf5f2('0x32')][_0xf5f2('0x34')]?_0x22c826[_0xf5f2('0x32')]:_0x14c829[_0xf5f2('0x31')];if(!_0x5b6672['query'][_0xf5f2('0x35')](_0xf5f2('0x36'))){_0x22c826['limit']=qs[_0xf5f2('0x1d')](_0x5b6672['query'][_0xf5f2('0x1d')]);_0x22c826[_0xf5f2('0x1b')]=qs[_0xf5f2('0x1b')](_0x5b6672[_0xf5f2('0x2e')]['offset']);}_0x22c826['order']=qs[_0xf5f2('0x37')](_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x37')]);_0x22c826['where']=qs[_0xf5f2('0x2f')](_['pick'](_0x5b6672[_0xf5f2('0x2e')],_0x14c829['filters']),_0x5027ab);if(_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x38')]){_0x22c826['where']=_[_0xf5f2('0x39')](_0x22c826[_0xf5f2('0x3a')],{'$or':_[_0xf5f2('0x2d')](_0x5027ab,function(_0x35f738){if(_0x35f738['type']!=='VIRTUAL'){var _0x3d328f={};_0x3d328f[_0x35f738[_0xf5f2('0x26')]]={'$like':'%'+_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x38')]+'%'};return _0x3d328f;}})});}_0x22c826=_[_0xf5f2('0x39')]({},_0x22c826,_0x5b6672[_0xf5f2('0x3b')]);var _0x2bc20e={'where':_0x22c826['where']};return db[_0xf5f2('0x29')][_0xf5f2('0x1e')](_0x2bc20e)['then'](function(_0xc6a1ae){_0x11c771[_0xf5f2('0x1e')]=_0xc6a1ae;if(_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x3c')]){_0x22c826[_0xf5f2('0x3d')]=[{'all':!![]}];}return db[_0xf5f2('0x29')][_0xf5f2('0x3e')](_0x22c826);})[_0xf5f2('0x24')](function(_0x574f24){_0x11c771[_0xf5f2('0x3f')]=_0x574f24;return _0x11c771;})[_0xf5f2('0x24')](respondWithFilteredResult(_0x53cb96,_0x22c826))[_0xf5f2('0x40')](handleError(_0x53cb96,null));};exports['show']=function(_0x509dbc,_0x59eb00){var _0x76d21b={'raw':![],'where':{'id':_0x509dbc['params']['id']}},_0x2ad13c={};_0x2ad13c[_0xf5f2('0x31')]=_[_0xf5f2('0x41')](db[_0xf5f2('0x29')][_0xf5f2('0x2a')]);_0x2ad13c[_0xf5f2('0x2e')]=_[_0xf5f2('0x41')](_0x509dbc[_0xf5f2('0x2e')]);_0x2ad13c[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x2ad13c[_0xf5f2('0x31')],_0x2ad13c[_0xf5f2('0x2e')]);_0x76d21b[_0xf5f2('0x32')]=_[_0xf5f2('0x30')](_0x2ad13c[_0xf5f2('0x31')],qs['fields'](_0x509dbc[_0xf5f2('0x2e')]['fields']));_0x76d21b[_0xf5f2('0x32')]=_0x76d21b[_0xf5f2('0x32')][_0xf5f2('0x34')]?_0x76d21b[_0xf5f2('0x32')]:_0x2ad13c[_0xf5f2('0x31')];if(_0x509dbc[_0xf5f2('0x2e')]['includeAll']){_0x76d21b[_0xf5f2('0x3d')]=[{'all':!![]}];}_0x76d21b=_[_0xf5f2('0x39')]({},_0x76d21b,_0x509dbc[_0xf5f2('0x3b')]);return db[_0xf5f2('0x29')][_0xf5f2('0x42')](_0x76d21b)[_0xf5f2('0x24')](handleEntityNotFound(_0x59eb00,null))[_0xf5f2('0x24')](respondWithResult(_0x59eb00,null))[_0xf5f2('0x40')](handleError(_0x59eb00,null));};exports['create']=function(_0x35dece,_0x33ec29){return db[_0xf5f2('0x29')]['create'](_0x35dece[_0xf5f2('0x43')],{})[_0xf5f2('0x24')](respondWithResult(_0x33ec29,0xc9))[_0xf5f2('0x40')](handleError(_0x33ec29,null));};exports['update']=function(_0x57a7cb,_0x7bb942){if(_0x57a7cb[_0xf5f2('0x43')]['id']){delete _0x57a7cb['body']['id'];}return db[_0xf5f2('0x29')]['find']({'where':{'id':_0x57a7cb[_0xf5f2('0x44')]['id']}})['then'](handleEntityNotFound(_0x7bb942,null))[_0xf5f2('0x24')](saveUpdates(_0x57a7cb['body'],null))[_0xf5f2('0x24')](respondWithResult(_0x7bb942,null))[_0xf5f2('0x40')](handleError(_0x7bb942,null));};exports[_0xf5f2('0x45')]=function(_0x11a083,_0x4fa738){return db[_0xf5f2('0x29')][_0xf5f2('0x42')]({'where':{'id':_0x11a083['params']['id']}})['then'](handleEntityNotFound(_0x4fa738,null))[_0xf5f2('0x24')](removeEntity(_0x4fa738,null))[_0xf5f2('0x40')](handleError(_0x4fa738,null));};exports['describe']=function(_0x22b645,_0xe0ce7f){return db[_0xf5f2('0x29')][_0xf5f2('0x46')]()['then'](respondWithResult(_0xe0ce7f,null))['catch'](handleError(_0xe0ce7f,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index c473d96..3f6ed5c 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 _0x4f80=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userProfileResource.attributes','exports','UserProfileResource','user_profile_has_resources','compositeIndex','sectionId','lodash'];(function(_0x278862,_0x97d35a){var _0x3202cb=function(_0xd4b4cd){while(--_0xd4b4cd){_0x278862['push'](_0x278862['shift']());}};_0x3202cb(++_0x97d35a);}(_0x4f80,0x1a3));var _0x04f8=function(_0x784035,_0x318960){_0x784035=_0x784035-0x0;var _0x18eb99=_0x4f80[_0x784035];return _0x18eb99;};'use strict';var _=require(_0x04f8('0x0'));var util=require('util');var logger=require(_0x04f8('0x1'))(_0x04f8('0x2'));var moment=require(_0x04f8('0x3'));var BPromise=require(_0x04f8('0x4'));var rp=require(_0x04f8('0x5'));var fs=require('fs');var path=require(_0x04f8('0x6'));var rimraf=require(_0x04f8('0x7'));var config=require(_0x04f8('0x8'));var attributes=require(_0x04f8('0x9'));module[_0x04f8('0xa')]=function(_0x16bac6,_0x24db88){return _0x16bac6['define'](_0x04f8('0xb'),attributes,{'tableName':_0x04f8('0xc'),'paranoid':![],'indexes':[{'name':_0x04f8('0xd'),'fields':['resourceId',_0x04f8('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5448=['sectionId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define','UserProfileResource','user_profile_has_resources','compositeIndex','resourceId'];(function(_0x3481dd,_0x5e533a){var _0x3748d3=function(_0x4abcfc){while(--_0x4abcfc){_0x3481dd['push'](_0x3481dd['shift']());}};_0x3748d3(++_0x5e533a);}(_0x5448,0xc1));var _0x8544=function(_0x1cb18a,_0x33167a){_0x1cb18a=_0x1cb18a-0x0;var _0x22442e=_0x5448[_0x1cb18a];return _0x22442e;};'use strict';var _=require(_0x8544('0x0'));var util=require(_0x8544('0x1'));var logger=require(_0x8544('0x2'))(_0x8544('0x3'));var moment=require(_0x8544('0x4'));var BPromise=require(_0x8544('0x5'));var rp=require(_0x8544('0x6'));var fs=require('fs');var path=require(_0x8544('0x7'));var rimraf=require(_0x8544('0x8'));var config=require('../../config/environment');var attributes=require('./userProfileResource.attributes');module[_0x8544('0x9')]=function(_0x128c6a,_0x42b802){return _0x128c6a[_0x8544('0xa')](_0x8544('0xb'),attributes,{'tableName':_0x8544('0xc'),'paranoid':![],'indexes':[{'name':_0x8544('0xd'),'fields':[_0x8544('0xe'),_0x8544('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index afa8f57..6317b7c 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 _0x6a8b=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','debug','request\x20sent','stringify','error','code','UserProfileResource,\x20%s,\x20%s','message','result','catch','util','moment'];(function(_0x2d4d3d,_0x177ff8){var _0x33d0b6=function(_0x467dbb){while(--_0x467dbb){_0x2d4d3d['push'](_0x2d4d3d['shift']());}};_0x33d0b6(++_0x177ff8);}(_0x6a8b,0x71));var _0xb6a8=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x6a8b[_0x167cc1];return _0x10bc4b;};'use strict';var _=require('lodash');var util=require(_0xb6a8('0x0'));var moment=require(_0xb6a8('0x1'));var BPromise=require(_0xb6a8('0x2'));var rs=require(_0xb6a8('0x3'));var fs=require('fs');var Redis=require(_0xb6a8('0x4'));var db=require(_0xb6a8('0x5'))['db'];var utils=require(_0xb6a8('0x6'));var logger=require(_0xb6a8('0x7'))(_0xb6a8('0x8'));var config=require('../../config/environment');var jayson=require(_0xb6a8('0x9'));var client=jayson[_0xb6a8('0xa')][_0xb6a8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbc33be,_0x7bed0,_0xd18f5c){return new BPromise(function(_0x13c818,_0x13a5f8){return client[_0xb6a8('0xc')](_0xbc33be,_0xd18f5c)['then'](function(_0xe6b018){logger[_0xb6a8('0xd')]('UserProfileResource,\x20%s,\x20%s',_0x7bed0,'request\x20sent');logger[_0xb6a8('0xe')]('UserProfileResource,\x20%s,\x20%s,\x20%s',_0x7bed0,_0xb6a8('0xf'),JSON[_0xb6a8('0x10')](_0xe6b018));if(_0xe6b018[_0xb6a8('0x11')]){if(_0xe6b018[_0xb6a8('0x11')][_0xb6a8('0x12')]===0x1f4){logger[_0xb6a8('0x11')](_0xb6a8('0x13'),_0x7bed0,_0xe6b018[_0xb6a8('0x11')][_0xb6a8('0x14')]);return _0x13a5f8(_0xe6b018[_0xb6a8('0x11')][_0xb6a8('0x14')]);}logger[_0xb6a8('0x11')](_0xb6a8('0x13'),_0x7bed0,_0xe6b018[_0xb6a8('0x11')][_0xb6a8('0x14')]);return _0x13c818(_0xe6b018[_0xb6a8('0x11')][_0xb6a8('0x14')]);}else{logger['info'](_0xb6a8('0x13'),_0x7bed0,'request\x20sent');_0x13c818(_0xe6b018[_0xb6a8('0x15')][_0xb6a8('0x14')]);}})[_0xb6a8('0x16')](function(_0x463a0b){logger[_0xb6a8('0x11')](_0xb6a8('0x13'),_0x7bed0,_0x463a0b);_0x13a5f8(_0x463a0b);});});} \ No newline at end of file +var _0x98d8=['randomstring','ioredis','../../mysqldb','rpc','client','request','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird'];(function(_0x4b287d,_0x2ea048){var _0x563b27=function(_0x9e9396){while(--_0x9e9396){_0x4b287d['push'](_0x4b287d['shift']());}};_0x563b27(++_0x2ea048);}(_0x98d8,0xce));var _0x898d=function(_0x4132d1,_0x41fbbd){_0x4132d1=_0x4132d1-0x0;var _0x27d9cb=_0x98d8[_0x4132d1];return _0x27d9cb;};'use strict';var _=require(_0x898d('0x0'));var util=require(_0x898d('0x1'));var moment=require(_0x898d('0x2'));var BPromise=require(_0x898d('0x3'));var rs=require(_0x898d('0x4'));var fs=require('fs');var Redis=require(_0x898d('0x5'));var db=require(_0x898d('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x898d('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x898d('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x16b99a,_0x4e8c68,_0x1de5df){return new BPromise(function(_0x4fe1bf,_0x3e9ba6){return client[_0x898d('0x9')](_0x16b99a,_0x1de5df)[_0x898d('0xa')](function(_0x40f217){logger[_0x898d('0xb')](_0x898d('0xc'),_0x4e8c68,_0x898d('0xd'));logger[_0x898d('0xe')](_0x898d('0xf'),_0x4e8c68,_0x898d('0xd'),JSON[_0x898d('0x10')](_0x40f217));if(_0x40f217[_0x898d('0x11')]){if(_0x40f217[_0x898d('0x11')][_0x898d('0x12')]===0x1f4){logger[_0x898d('0x11')]('UserProfileResource,\x20%s,\x20%s',_0x4e8c68,_0x40f217[_0x898d('0x11')][_0x898d('0x13')]);return _0x3e9ba6(_0x40f217['error'][_0x898d('0x13')]);}logger[_0x898d('0x11')](_0x898d('0xc'),_0x4e8c68,_0x40f217[_0x898d('0x11')][_0x898d('0x13')]);return _0x4fe1bf(_0x40f217[_0x898d('0x11')][_0x898d('0x13')]);}else{logger['info'](_0x898d('0xc'),_0x4e8c68,_0x898d('0xd'));_0x4fe1bf(_0x40f217['result']['message']);}})[_0x898d('0x14')](function(_0x42a098){logger[_0x898d('0x11')](_0x898d('0xc'),_0x4e8c68,_0x42a098);_0x3e9ba6(_0x42a098);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 277336a..2eb5541 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 _0x9b07=['post','create','update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id'];(function(_0x120656,_0x55aaab){var _0x56a1f1=function(_0x1ab201){while(--_0x1ab201){_0x120656['push'](_0x120656['shift']());}};_0x56a1f1(++_0x55aaab);}(_0x9b07,0x92));var _0x79b0=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0x9b07[_0x273c39];return _0x46d6b5;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x79b0('0x0'));var timeout=require(_0x79b0('0x1'));var express=require(_0x79b0('0x2'));var router=express[_0x79b0('0x3')]();var fs_extra=require(_0x79b0('0x4'));var auth=require(_0x79b0('0x5'));var interaction=require(_0x79b0('0x6'));var config=require(_0x79b0('0x7'));var controller=require('./userProfileSection.controller');router['get']('/',auth[_0x79b0('0x8')](),controller[_0x79b0('0x9')]);router[_0x79b0('0xa')](_0x79b0('0xb'),auth['isAuthenticated'](),controller[_0x79b0('0xc')]);router[_0x79b0('0xa')](_0x79b0('0xd'),auth[_0x79b0('0x8')](),controller['show']);router[_0x79b0('0xe')]('/',auth[_0x79b0('0x8')](),controller[_0x79b0('0xf')]);router['put'](_0x79b0('0xd'),auth['isAuthenticated'](),controller[_0x79b0('0x10')]);router[_0x79b0('0x11')](_0x79b0('0xd'),auth[_0x79b0('0x8')](),controller[_0x79b0('0x12')]);module[_0x79b0('0x13')]=router; \ No newline at end of file +var _0x10d3=['path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller','isAuthenticated','index','get','/describe','describe','show','post','create','put','update','delete','/:id','destroy','multer'];(function(_0x522d58,_0x1b8513){var _0x54d3d3=function(_0x1ce956){while(--_0x1ce956){_0x522d58['push'](_0x522d58['shift']());}};_0x54d3d3(++_0x1b8513);}(_0x10d3,0xef));var _0x310d=function(_0x4195c2,_0x57e3b8){_0x4195c2=_0x4195c2-0x0;var _0x273062=_0x10d3[_0x4195c2];return _0x273062;};'use strict';var multer=require(_0x310d('0x0'));var util=require('util');var path=require(_0x310d('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x310d('0x2'));var auth=require(_0x310d('0x3'));var interaction=require(_0x310d('0x4'));var config=require(_0x310d('0x5'));var controller=require(_0x310d('0x6'));router['get']('/',auth[_0x310d('0x7')](),controller[_0x310d('0x8')]);router[_0x310d('0x9')](_0x310d('0xa'),auth[_0x310d('0x7')](),controller[_0x310d('0xb')]);router[_0x310d('0x9')]('/:id',auth[_0x310d('0x7')](),controller[_0x310d('0xc')]);router[_0x310d('0xd')]('/',auth['isAuthenticated'](),controller[_0x310d('0xe')]);router[_0x310d('0xf')]('/:id',auth[_0x310d('0x7')](),controller[_0x310d('0x10')]);router[_0x310d('0x11')](_0x310d('0x12'),auth['isAuthenticated'](),controller[_0x310d('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index ebd1ad4..73ecea3 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 _0xf4f4=['INTEGER','BOOLEAN','setDataValue','join','getDataValue','crudPermissions','split','sequelize','exports','STRING'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf4f4,0xe3));var _0x4f4f=function(_0x335eca,_0x23bee1){_0x335eca=_0x335eca-0x0;var _0x4a9e78=_0xf4f4[_0x335eca];return _0x4a9e78;};'use strict';var Sequelize=require(_0x4f4f('0x0'));module[_0x4f4f('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize[_0x4f4f('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x4f4f('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0x4f4f('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x4f4f('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x4f4f('0x2')],'set':function(_0x510b24){this[_0x4f4f('0x5')]('crudPermissions',_0x510b24?_0x510b24[_0x4f4f('0x6')](''):[]);},'get':function(){return this[_0x4f4f('0x7')](_0x4f4f('0x8'))?this[_0x4f4f('0x7')](_0x4f4f('0x8'))[_0x4f4f('0x9')](''):[];}}}; \ No newline at end of file +var _0xb688=['STRING','INTEGER','BOOLEAN','setDataValue','crudPermissions','join','split','exports'];(function(_0x245b0f,_0x4a5ed2){var _0x337c3f=function(_0xc8b994){while(--_0xc8b994){_0x245b0f['push'](_0x245b0f['shift']());}};_0x337c3f(++_0x4a5ed2);}(_0xb688,0xcf));var _0x8b68=function(_0x50f60f,_0x37c2ca){_0x50f60f=_0x50f60f-0x0;var _0x298ad1=_0xb688[_0x50f60f];return _0x298ad1;};'use strict';var Sequelize=require('sequelize');module[_0x8b68('0x0')]={'name':{'type':Sequelize[_0x8b68('0x1')],'allowNull':![]},'category':{'type':Sequelize[_0x8b68('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x8b68('0x2')],'allowNull':![]},'enabled':{'type':Sequelize[_0x8b68('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x8b68('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x41030e){this[_0x8b68('0x4')](_0x8b68('0x5'),_0x41030e?_0x41030e[_0x8b68('0x6')](''):[]);},'get':function(){return this['getDataValue'](_0x8b68('0x5'))?this['getDataValue'](_0x8b68('0x5'))[_0x8b68('0x7')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 6b9b94f..1c4739a 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 _0x1718=['fs-extra','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','offset','limit','undefined','count','Content-Range','reject','save','update','then','destroy','status','end','error','stack','send','index','map','rawAttributes','fieldName','key','model','keys','query','attributes','intersection','fields','length','hasOwnProperty','order','sort','filters','filter','where','merge','name','options','UserProfileSection','include','findAll','rows','catch','show','params','includeAll','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox'];(function(_0x377aea,_0x5bfd7c){var _0x3dfbdd=function(_0x1256dc){while(--_0x1256dc){_0x377aea['push'](_0x377aea['shift']());}};_0x3dfbdd(++_0x5bfd7c);}(_0x1718,0x126));var _0x8171=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x1718[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require(_0x8171('0x0'));var rimraf=require(_0x8171('0x1'));var zipdir=require(_0x8171('0x2'));var jsonpatch=require(_0x8171('0x3'));var rp=require(_0x8171('0x4'));var moment=require(_0x8171('0x5'));var BPromise=require(_0x8171('0x6'));var Mustache=require(_0x8171('0x7'));var util=require('util');var path=require(_0x8171('0x8'));var sox=require(_0x8171('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8171('0xa'));var _=require('lodash');var squel=require(_0x8171('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8171('0xc'));var toCsv=require(_0x8171('0xd'));var querystring=require(_0x8171('0xe'));var Papa=require(_0x8171('0xf'));var Redis=require(_0x8171('0x10'));var authService=require(_0x8171('0x11'));var qs=require(_0x8171('0x12'));var as=require(_0x8171('0x13'));var hardwareService=require(_0x8171('0x14'));var logger=require(_0x8171('0x15'))(_0x8171('0x16'));var utils=require('../../config/utils');var config=require(_0x8171('0x17'));var licenseUtil=require(_0x8171('0x18'));var db=require(_0x8171('0x19'))['db'];function respondWithStatusCode(_0x1f9337,_0x3a7504){_0x3a7504=_0x3a7504||0xcc;return function(_0x321049){if(_0x321049){return _0x1f9337[_0x8171('0x1a')](_0x3a7504);}return _0x1f9337['status'](_0x3a7504)['end']();};}function respondWithResult(_0x3df589,_0x606a2b){_0x606a2b=_0x606a2b||0xc8;return function(_0x26d3d5){if(_0x26d3d5){return _0x3df589['status'](_0x606a2b)[_0x8171('0x1b')](_0x26d3d5);}};}function respondWithFilteredResult(_0x3f8f0e,_0x118fd1){return function(_0x2e933f){if(_0x2e933f){var _0x1d288a=typeof _0x118fd1[_0x8171('0x1c')]==='undefined'&&typeof _0x118fd1[_0x8171('0x1d')]===_0x8171('0x1e');var _0x2fae85=_0x2e933f[_0x8171('0x1f')];var _0x1ecf9f=_0x1d288a?0x0:_0x118fd1[_0x8171('0x1c')];var _0x26f01c=_0x1d288a?_0x2e933f[_0x8171('0x1f')]:_0x118fd1['offset']+_0x118fd1[_0x8171('0x1d')];var _0x3d022f;if(_0x26f01c>=_0x2fae85){_0x26f01c=_0x2fae85;_0x3d022f=0xc8;}else{_0x3d022f=0xce;}_0x3f8f0e['status'](_0x3d022f);return _0x3f8f0e['set'](_0x8171('0x20'),_0x1ecf9f+'-'+_0x26f01c+'/'+_0x2fae85)[_0x8171('0x1b')](_0x2e933f);}return null;};}function patchUpdates(_0x24fb89){return function(_0x44658b){try{jsonpatch['apply'](_0x44658b,_0x24fb89,!![]);}catch(_0xd405d){return BPromise[_0x8171('0x21')](_0xd405d);}return _0x44658b[_0x8171('0x22')]();};}function saveUpdates(_0xc8418,_0x33a822){return function(_0x544a1b){if(_0x544a1b){return _0x544a1b[_0x8171('0x23')](_0xc8418)[_0x8171('0x24')](function(_0x4da0b5){return _0x4da0b5;});}return null;};}function removeEntity(_0x5a47ad,_0x539ba7){return function(_0x408de6){if(_0x408de6){return _0x408de6[_0x8171('0x25')]()['then'](function(){_0x5a47ad[_0x8171('0x26')](0xcc)[_0x8171('0x27')]();});}};}function handleEntityNotFound(_0x2067ac,_0x5068ed){return function(_0x4e354e){if(!_0x4e354e){_0x2067ac[_0x8171('0x1a')](0x194);}return _0x4e354e;};}function handleError(_0x66dc4f,_0x4aba97){_0x4aba97=_0x4aba97||0x1f4;return function(_0x4f12fb){logger[_0x8171('0x28')](_0x4f12fb[_0x8171('0x29')]);if(_0x4f12fb['name']){delete _0x4f12fb['name'];}_0x66dc4f['status'](_0x4aba97)[_0x8171('0x2a')](_0x4f12fb);};}exports[_0x8171('0x2b')]=function(_0x2c06f0,_0xc7e23d){var _0x5c4a15={},_0x3613aa={},_0x56d159={'count':0x0,'rows':[]};var _0xc7c775=_[_0x8171('0x2c')](db['UserProfileSection'][_0x8171('0x2d')],function(_0x33e3af){return{'name':_0x33e3af[_0x8171('0x2e')],'type':_0x33e3af['type'][_0x8171('0x2f')]};});_0x3613aa[_0x8171('0x30')]=_[_0x8171('0x2c')](_0xc7c775,'name');_0x3613aa['query']=_[_0x8171('0x31')](_0x2c06f0[_0x8171('0x32')]);_0x3613aa['filters']=_['intersection'](_0x3613aa[_0x8171('0x30')],_0x3613aa[_0x8171('0x32')]);_0x5c4a15[_0x8171('0x33')]=_[_0x8171('0x34')](_0x3613aa[_0x8171('0x30')],qs[_0x8171('0x35')](_0x2c06f0[_0x8171('0x32')][_0x8171('0x35')]));_0x5c4a15[_0x8171('0x33')]=_0x5c4a15[_0x8171('0x33')][_0x8171('0x36')]?_0x5c4a15[_0x8171('0x33')]:_0x3613aa[_0x8171('0x30')];if(!_0x2c06f0[_0x8171('0x32')][_0x8171('0x37')]('nolimit')){_0x5c4a15[_0x8171('0x1d')]=qs[_0x8171('0x1d')](_0x2c06f0[_0x8171('0x32')][_0x8171('0x1d')]);_0x5c4a15[_0x8171('0x1c')]=qs[_0x8171('0x1c')](_0x2c06f0[_0x8171('0x32')][_0x8171('0x1c')]);}_0x5c4a15[_0x8171('0x38')]=qs[_0x8171('0x39')](_0x2c06f0['query'][_0x8171('0x39')]);_0x5c4a15['where']=qs[_0x8171('0x3a')](_['pick'](_0x2c06f0['query'],_0x3613aa[_0x8171('0x3a')]),_0xc7c775);if(_0x2c06f0[_0x8171('0x32')][_0x8171('0x3b')]){_0x5c4a15[_0x8171('0x3c')]=_[_0x8171('0x3d')](_0x5c4a15[_0x8171('0x3c')],{'$or':_[_0x8171('0x2c')](_0xc7c775,function(_0x216f8e){if(_0x216f8e['type']!=='VIRTUAL'){var _0x2dc70c={};_0x2dc70c[_0x216f8e[_0x8171('0x3e')]]={'$like':'%'+_0x2c06f0[_0x8171('0x32')][_0x8171('0x3b')]+'%'};return _0x2dc70c;}})});}_0x5c4a15=_[_0x8171('0x3d')]({},_0x5c4a15,_0x2c06f0[_0x8171('0x3f')]);var _0x2e51c7={'where':_0x5c4a15['where']};return db[_0x8171('0x40')]['count'](_0x2e51c7)[_0x8171('0x24')](function(_0xd7b030){_0x56d159[_0x8171('0x1f')]=_0xd7b030;if(_0x2c06f0[_0x8171('0x32')]['includeAll']){_0x5c4a15[_0x8171('0x41')]=[{'all':!![]}];}return db[_0x8171('0x40')][_0x8171('0x42')](_0x5c4a15);})[_0x8171('0x24')](function(_0x36e730){_0x56d159[_0x8171('0x43')]=_0x36e730;return _0x56d159;})['then'](respondWithFilteredResult(_0xc7e23d,_0x5c4a15))[_0x8171('0x44')](handleError(_0xc7e23d,null));};exports[_0x8171('0x45')]=function(_0x4f7035,_0x5dfe03){var _0x33ae00={'raw':![],'where':{'id':_0x4f7035[_0x8171('0x46')]['id']}},_0x1dcb01={};_0x1dcb01[_0x8171('0x30')]=_[_0x8171('0x31')](db[_0x8171('0x40')][_0x8171('0x2d')]);_0x1dcb01[_0x8171('0x32')]=_[_0x8171('0x31')](_0x4f7035[_0x8171('0x32')]);_0x1dcb01[_0x8171('0x3a')]=_[_0x8171('0x34')](_0x1dcb01['model'],_0x1dcb01[_0x8171('0x32')]);_0x33ae00['attributes']=_[_0x8171('0x34')](_0x1dcb01['model'],qs[_0x8171('0x35')](_0x4f7035[_0x8171('0x32')]['fields']));_0x33ae00[_0x8171('0x33')]=_0x33ae00[_0x8171('0x33')][_0x8171('0x36')]?_0x33ae00[_0x8171('0x33')]:_0x1dcb01[_0x8171('0x30')];if(_0x4f7035['query'][_0x8171('0x47')]){_0x33ae00[_0x8171('0x41')]=[{'all':!![]}];}_0x33ae00=_[_0x8171('0x3d')]({},_0x33ae00,_0x4f7035[_0x8171('0x3f')]);return db[_0x8171('0x40')][_0x8171('0x48')](_0x33ae00)[_0x8171('0x24')](handleEntityNotFound(_0x5dfe03,null))[_0x8171('0x24')](respondWithResult(_0x5dfe03,null))[_0x8171('0x44')](handleError(_0x5dfe03,null));};exports[_0x8171('0x49')]=function(_0x371cb1,_0x13a0ab){return db[_0x8171('0x40')][_0x8171('0x49')](_0x371cb1[_0x8171('0x4a')],{})[_0x8171('0x24')](respondWithResult(_0x13a0ab,0xc9))[_0x8171('0x44')](handleError(_0x13a0ab,null));};exports[_0x8171('0x23')]=function(_0x253943,_0x45716d){if(_0x253943[_0x8171('0x4a')]['id']){delete _0x253943[_0x8171('0x4a')]['id'];}return db[_0x8171('0x40')][_0x8171('0x48')]({'where':{'id':_0x253943['params']['id']}})['then'](handleEntityNotFound(_0x45716d,null))[_0x8171('0x24')](saveUpdates(_0x253943['body'],null))[_0x8171('0x24')](respondWithResult(_0x45716d,null))[_0x8171('0x44')](handleError(_0x45716d,null));};exports[_0x8171('0x25')]=function(_0x553753,_0x53b0f1){return db[_0x8171('0x40')][_0x8171('0x48')]({'where':{'id':_0x553753[_0x8171('0x46')]['id']}})['then'](handleEntityNotFound(_0x53b0f1,null))[_0x8171('0x24')](removeEntity(_0x53b0f1,null))[_0x8171('0x44')](handleError(_0x53b0f1,null));};exports[_0x8171('0x4b')]=function(_0x27e6ea,_0x4757e9){return db[_0x8171('0x40')]['describe']()[_0x8171('0x24')](respondWithResult(_0x4757e9,null))[_0x8171('0x44')](handleError(_0x4757e9,null));}; \ No newline at end of file +var _0x2024=['json','offset','undefined','limit','count','Content-Range','reject','update','then','destroy','end','error','stack','name','send','index','UserProfileSection','rawAttributes','fieldName','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','findAll','rows','catch','includeAll','include','find','create','body','params','describe','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status'];(function(_0x5b3b6a,_0x906f49){var _0x4a9af7=function(_0x435c41){while(--_0x435c41){_0x5b3b6a['push'](_0x5b3b6a['shift']());}};_0x4a9af7(++_0x906f49);}(_0x2024,0x77));var _0x4202=function(_0x2b2be3,_0x431946){_0x2b2be3=_0x2b2be3-0x0;var _0xedd99c=_0x2024[_0x2b2be3];return _0xedd99c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4202('0x0'));var zipdir=require(_0x4202('0x1'));var jsonpatch=require(_0x4202('0x2'));var rp=require('request-promise');var moment=require(_0x4202('0x3'));var BPromise=require(_0x4202('0x4'));var Mustache=require(_0x4202('0x5'));var util=require(_0x4202('0x6'));var path=require(_0x4202('0x7'));var sox=require(_0x4202('0x8'));var csv=require(_0x4202('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4202('0xa'));var _=require(_0x4202('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4202('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x4202('0x9'));var querystring=require('querystring');var Papa=require(_0x4202('0xd'));var Redis=require(_0x4202('0xe'));var authService=require(_0x4202('0xf'));var qs=require(_0x4202('0x10'));var as=require(_0x4202('0x11'));var hardwareService=require(_0x4202('0x12'));var logger=require(_0x4202('0x13'))(_0x4202('0x14'));var utils=require('../../config/utils');var config=require(_0x4202('0x15'));var licenseUtil=require(_0x4202('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5e82b2,_0x550e18){_0x550e18=_0x550e18||0xcc;return function(_0x583c9){if(_0x583c9){return _0x5e82b2[_0x4202('0x17')](_0x550e18);}return _0x5e82b2[_0x4202('0x18')](_0x550e18)['end']();};}function respondWithResult(_0x29311a,_0x50bf16){_0x50bf16=_0x50bf16||0xc8;return function(_0x3b697d){if(_0x3b697d){return _0x29311a[_0x4202('0x18')](_0x50bf16)[_0x4202('0x19')](_0x3b697d);}};}function respondWithFilteredResult(_0xbd752f,_0xcc2766){return function(_0x4dcd87){if(_0x4dcd87){var _0x19c477=typeof _0xcc2766[_0x4202('0x1a')]===_0x4202('0x1b')&&typeof _0xcc2766[_0x4202('0x1c')]===_0x4202('0x1b');var _0x47599a=_0x4dcd87[_0x4202('0x1d')];var _0x4e8d40=_0x19c477?0x0:_0xcc2766['offset'];var _0x56ffd7=_0x19c477?_0x4dcd87[_0x4202('0x1d')]:_0xcc2766[_0x4202('0x1a')]+_0xcc2766[_0x4202('0x1c')];var _0x40b213;if(_0x56ffd7>=_0x47599a){_0x56ffd7=_0x47599a;_0x40b213=0xc8;}else{_0x40b213=0xce;}_0xbd752f[_0x4202('0x18')](_0x40b213);return _0xbd752f['set'](_0x4202('0x1e'),_0x4e8d40+'-'+_0x56ffd7+'/'+_0x47599a)[_0x4202('0x19')](_0x4dcd87);}return null;};}function patchUpdates(_0x3a69c0){return function(_0x4be5c3){try{jsonpatch['apply'](_0x4be5c3,_0x3a69c0,!![]);}catch(_0xc7ab17){return BPromise[_0x4202('0x1f')](_0xc7ab17);}return _0x4be5c3['save']();};}function saveUpdates(_0x2b701a,_0x392452){return function(_0x49c181){if(_0x49c181){return _0x49c181[_0x4202('0x20')](_0x2b701a)[_0x4202('0x21')](function(_0x55bb9b){return _0x55bb9b;});}return null;};}function removeEntity(_0x214e11,_0xce56c9){return function(_0x5ed33b){if(_0x5ed33b){return _0x5ed33b[_0x4202('0x22')]()[_0x4202('0x21')](function(){_0x214e11['status'](0xcc)[_0x4202('0x23')]();});}};}function handleEntityNotFound(_0x1b694e,_0x29fd18){return function(_0x73a5ff){if(!_0x73a5ff){_0x1b694e[_0x4202('0x17')](0x194);}return _0x73a5ff;};}function handleError(_0x45a40d,_0xe7f968){_0xe7f968=_0xe7f968||0x1f4;return function(_0x33fe8d){logger[_0x4202('0x24')](_0x33fe8d[_0x4202('0x25')]);if(_0x33fe8d[_0x4202('0x26')]){delete _0x33fe8d[_0x4202('0x26')];}_0x45a40d[_0x4202('0x18')](_0xe7f968)[_0x4202('0x27')](_0x33fe8d);};}exports[_0x4202('0x28')]=function(_0x4309e7,_0x3f7a99){var _0x588d93={},_0x4b3568={},_0x4f8f29={'count':0x0,'rows':[]};var _0x375abe=_['map'](db[_0x4202('0x29')][_0x4202('0x2a')],function(_0x241225){return{'name':_0x241225[_0x4202('0x2b')],'type':_0x241225['type']['key']};});_0x4b3568[_0x4202('0x2c')]=_[_0x4202('0x2d')](_0x375abe,_0x4202('0x26'));_0x4b3568[_0x4202('0x2e')]=_[_0x4202('0x2f')](_0x4309e7[_0x4202('0x2e')]);_0x4b3568[_0x4202('0x30')]=_[_0x4202('0x31')](_0x4b3568[_0x4202('0x2c')],_0x4b3568[_0x4202('0x2e')]);_0x588d93[_0x4202('0x32')]=_[_0x4202('0x31')](_0x4b3568[_0x4202('0x2c')],qs[_0x4202('0x33')](_0x4309e7['query'][_0x4202('0x33')]));_0x588d93[_0x4202('0x32')]=_0x588d93['attributes'][_0x4202('0x34')]?_0x588d93['attributes']:_0x4b3568[_0x4202('0x2c')];if(!_0x4309e7[_0x4202('0x2e')][_0x4202('0x35')]('nolimit')){_0x588d93[_0x4202('0x1c')]=qs['limit'](_0x4309e7['query'][_0x4202('0x1c')]);_0x588d93['offset']=qs[_0x4202('0x1a')](_0x4309e7[_0x4202('0x2e')][_0x4202('0x1a')]);}_0x588d93[_0x4202('0x36')]=qs['sort'](_0x4309e7['query'][_0x4202('0x37')]);_0x588d93[_0x4202('0x38')]=qs[_0x4202('0x30')](_[_0x4202('0x39')](_0x4309e7['query'],_0x4b3568[_0x4202('0x30')]),_0x375abe);if(_0x4309e7[_0x4202('0x2e')][_0x4202('0x3a')]){_0x588d93[_0x4202('0x38')]=_[_0x4202('0x3b')](_0x588d93['where'],{'$or':_[_0x4202('0x2d')](_0x375abe,function(_0x300d09){if(_0x300d09[_0x4202('0x3c')]!==_0x4202('0x3d')){var _0xedeba7={};_0xedeba7[_0x300d09[_0x4202('0x26')]]={'$like':'%'+_0x4309e7['query'][_0x4202('0x3a')]+'%'};return _0xedeba7;}})});}_0x588d93=_[_0x4202('0x3b')]({},_0x588d93,_0x4309e7['options']);var _0x5941bf={'where':_0x588d93['where']};return db[_0x4202('0x29')][_0x4202('0x1d')](_0x5941bf)[_0x4202('0x21')](function(_0x3ce742){_0x4f8f29[_0x4202('0x1d')]=_0x3ce742;if(_0x4309e7[_0x4202('0x2e')]['includeAll']){_0x588d93['include']=[{'all':!![]}];}return db[_0x4202('0x29')][_0x4202('0x3e')](_0x588d93);})[_0x4202('0x21')](function(_0x110559){_0x4f8f29[_0x4202('0x3f')]=_0x110559;return _0x4f8f29;})[_0x4202('0x21')](respondWithFilteredResult(_0x3f7a99,_0x588d93))[_0x4202('0x40')](handleError(_0x3f7a99,null));};exports['show']=function(_0xd804b6,_0xc36f52){var _0x463975={'raw':![],'where':{'id':_0xd804b6['params']['id']}},_0x4b5070={};_0x4b5070[_0x4202('0x2c')]=_[_0x4202('0x2f')](db['UserProfileSection'][_0x4202('0x2a')]);_0x4b5070[_0x4202('0x2e')]=_['keys'](_0xd804b6['query']);_0x4b5070['filters']=_[_0x4202('0x31')](_0x4b5070[_0x4202('0x2c')],_0x4b5070[_0x4202('0x2e')]);_0x463975[_0x4202('0x32')]=_[_0x4202('0x31')](_0x4b5070[_0x4202('0x2c')],qs[_0x4202('0x33')](_0xd804b6[_0x4202('0x2e')]['fields']));_0x463975[_0x4202('0x32')]=_0x463975[_0x4202('0x32')][_0x4202('0x34')]?_0x463975[_0x4202('0x32')]:_0x4b5070[_0x4202('0x2c')];if(_0xd804b6[_0x4202('0x2e')][_0x4202('0x41')]){_0x463975[_0x4202('0x42')]=[{'all':!![]}];}_0x463975=_['merge']({},_0x463975,_0xd804b6['options']);return db[_0x4202('0x29')][_0x4202('0x43')](_0x463975)[_0x4202('0x21')](handleEntityNotFound(_0xc36f52,null))[_0x4202('0x21')](respondWithResult(_0xc36f52,null))['catch'](handleError(_0xc36f52,null));};exports['create']=function(_0x4e77d2,_0xc7196){return db[_0x4202('0x29')][_0x4202('0x44')](_0x4e77d2[_0x4202('0x45')],{})[_0x4202('0x21')](respondWithResult(_0xc7196,0xc9))['catch'](handleError(_0xc7196,null));};exports[_0x4202('0x20')]=function(_0x59f059,_0x250f5f){if(_0x59f059[_0x4202('0x45')]['id']){delete _0x59f059['body']['id'];}return db[_0x4202('0x29')][_0x4202('0x43')]({'where':{'id':_0x59f059['params']['id']}})[_0x4202('0x21')](handleEntityNotFound(_0x250f5f,null))[_0x4202('0x21')](saveUpdates(_0x59f059[_0x4202('0x45')],null))[_0x4202('0x21')](respondWithResult(_0x250f5f,null))[_0x4202('0x40')](handleError(_0x250f5f,null));};exports['destroy']=function(_0x15cadf,_0x4073b0){return db[_0x4202('0x29')]['find']({'where':{'id':_0x15cadf[_0x4202('0x46')]['id']}})[_0x4202('0x21')](handleEntityNotFound(_0x4073b0,null))[_0x4202('0x21')](removeEntity(_0x4073b0,null))[_0x4202('0x40')](handleError(_0x4073b0,null));};exports[_0x4202('0x47')]=function(_0x310af2,_0x443fe2){return db[_0x4202('0x29')][_0x4202('0x47')]()['then'](respondWithResult(_0x443fe2,null))[_0x4202('0x40')](handleError(_0x443fe2,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 0c3ed97..0b3f526 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 _0x92bd=['lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','UserProfileSection','user_profile_has_sections','compositeIndex'];(function(_0x4c1fde,_0x270de8){var _0x42770d=function(_0x4c85e7){while(--_0x4c85e7){_0x4c1fde['push'](_0x4c1fde['shift']());}};_0x42770d(++_0x270de8);}(_0x92bd,0x12b));var _0xd92b=function(_0x56fe58,_0x51a78c){_0x56fe58=_0x56fe58-0x0;var _0x43d0e3=_0x92bd[_0x56fe58];return _0x43d0e3;};'use strict';var _=require(_0xd92b('0x0'));var util=require(_0xd92b('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xd92b('0x2'));var BPromise=require(_0xd92b('0x3'));var rp=require(_0xd92b('0x4'));var fs=require('fs');var path=require(_0xd92b('0x5'));var rimraf=require(_0xd92b('0x6'));var config=require(_0xd92b('0x7'));var attributes=require('./userProfileSection.attributes');module[_0xd92b('0x8')]=function(_0x5944d9,_0x3120d5){return _0x5944d9[_0xd92b('0x9')](_0xd92b('0xa'),attributes,{'tableName':_0xd92b('0xb'),'paranoid':![],'indexes':[{'name':_0xd92b('0xc'),'fields':['sectionId','userProfileId']}],'timestamps':!![]});}; \ No newline at end of file +var _0x5b57=['api','moment','bluebird','rimraf','../../config/environment','exports','define','UserProfileSection','compositeIndex','sectionId','userProfileId','lodash','../../config/logger'];(function(_0x3285a3,_0xdbc3c7){var _0x392540=function(_0x33f243){while(--_0x33f243){_0x3285a3['push'](_0x3285a3['shift']());}};_0x392540(++_0xdbc3c7);}(_0x5b57,0x80));var _0x75b5=function(_0x269da9,_0x3c2b8c){_0x269da9=_0x269da9-0x0;var _0x12f391=_0x5b57[_0x269da9];return _0x12f391;};'use strict';var _=require(_0x75b5('0x0'));var util=require('util');var logger=require(_0x75b5('0x1'))(_0x75b5('0x2'));var moment=require(_0x75b5('0x3'));var BPromise=require(_0x75b5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x75b5('0x5'));var config=require(_0x75b5('0x6'));var attributes=require('./userProfileSection.attributes');module[_0x75b5('0x7')]=function(_0x48a9ac,_0x2d3be8){return _0x48a9ac[_0x75b5('0x8')](_0x75b5('0x9'),attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':_0x75b5('0xa'),'fields':[_0x75b5('0xb'),_0x75b5('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 410fce3..18e451d 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 _0x3aff=['request','then','UserProfileSection,\x20%s,\x20%s','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x3d8abb,_0x4fda89){var _0x24d981=function(_0x3f32a0){while(--_0x3f32a0){_0x3d8abb['push'](_0x3d8abb['shift']());}};_0x24d981(++_0x4fda89);}(_0x3aff,0x148));var _0xf3af=function(_0x3751c4,_0x59f529){_0x3751c4=_0x3751c4-0x0;var _0x3a0e4b=_0x3aff[_0x3751c4];return _0x3a0e4b;};'use strict';var _=require(_0xf3af('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf3af('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf3af('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xf3af('0x3'))('rpc');var config=require(_0xf3af('0x4'));var jayson=require(_0xf3af('0x5'));var client=jayson[_0xf3af('0x6')][_0xf3af('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xb051e5,_0x5aae23,_0x14c51b){return new BPromise(function(_0x4a3c8a,_0x315cc3){return client[_0xf3af('0x8')](_0xb051e5,_0x14c51b)[_0xf3af('0x9')](function(_0xd4deda){logger['info'](_0xf3af('0xa'),_0x5aae23,'request\x20sent');logger[_0xf3af('0xb')](_0xf3af('0xc'),_0x5aae23,_0xf3af('0xd'),JSON[_0xf3af('0xe')](_0xd4deda));if(_0xd4deda['error']){if(_0xd4deda[_0xf3af('0xf')][_0xf3af('0x10')]===0x1f4){logger[_0xf3af('0xf')](_0xf3af('0xa'),_0x5aae23,_0xd4deda[_0xf3af('0xf')][_0xf3af('0x11')]);return _0x315cc3(_0xd4deda[_0xf3af('0xf')][_0xf3af('0x11')]);}logger[_0xf3af('0xf')]('UserProfileSection,\x20%s,\x20%s',_0x5aae23,_0xd4deda['error']['message']);return _0x4a3c8a(_0xd4deda['error'][_0xf3af('0x11')]);}else{logger[_0xf3af('0x12')](_0xf3af('0xa'),_0x5aae23,'request\x20sent');_0x4a3c8a(_0xd4deda[_0xf3af('0x13')][_0xf3af('0x11')]);}})[_0xf3af('0x14')](function(_0x278642){logger['error'](_0xf3af('0xa'),_0x5aae23,_0x278642);_0x315cc3(_0x278642);});});} \ No newline at end of file +var _0x3c3e=['stringify','error','message','result','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','jayson/promise','client','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1870c7,_0x5aebca){var _0x2e0590=function(_0x4750f3){while(--_0x4750f3){_0x1870c7['push'](_0x1870c7['shift']());}};_0x2e0590(++_0x5aebca);}(_0x3c3e,0x103));var _0xe3c3=function(_0x3631ea,_0xe57b78){_0x3631ea=_0x3631ea-0x0;var _0x3630d6=_0x3c3e[_0x3631ea];return _0x3630d6;};'use strict';var _=require(_0xe3c3('0x0'));var util=require(_0xe3c3('0x1'));var moment=require(_0xe3c3('0x2'));var BPromise=require(_0xe3c3('0x3'));var rs=require(_0xe3c3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe3c3('0x5'));var logger=require('../../config/logger')(_0xe3c3('0x6'));var config=require('../../config/environment');var jayson=require(_0xe3c3('0x7'));var client=jayson[_0xe3c3('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1144a1,_0x35f041,_0x2e3527){return new BPromise(function(_0x311997,_0x3fbaae){return client['request'](_0x1144a1,_0x2e3527)['then'](function(_0x27f310){logger[_0xe3c3('0x9')](_0xe3c3('0xa'),_0x35f041,_0xe3c3('0xb'));logger[_0xe3c3('0xc')]('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x35f041,_0xe3c3('0xb'),JSON[_0xe3c3('0xd')](_0x27f310));if(_0x27f310['error']){if(_0x27f310[_0xe3c3('0xe')]['code']===0x1f4){logger[_0xe3c3('0xe')](_0xe3c3('0xa'),_0x35f041,_0x27f310[_0xe3c3('0xe')][_0xe3c3('0xf')]);return _0x3fbaae(_0x27f310[_0xe3c3('0xe')][_0xe3c3('0xf')]);}logger[_0xe3c3('0xe')](_0xe3c3('0xa'),_0x35f041,_0x27f310[_0xe3c3('0xe')]['message']);return _0x311997(_0x27f310[_0xe3c3('0xe')][_0xe3c3('0xf')]);}else{logger[_0xe3c3('0x9')](_0xe3c3('0xa'),_0x35f041,_0xe3c3('0xb'));_0x311997(_0x27f310[_0xe3c3('0x10')][_0xe3c3('0xf')]);}})['catch'](function(_0x83a450){logger['error'](_0xe3c3('0xa'),_0x35f041,_0x83a450);_0x3fbaae(_0x83a450);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 44f5715..ef4d8f1 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x4443c5,_0x7921ed){var _0x31818c=function(_0x572e11){while(--_0x572e11){_0x4443c5['push'](_0x4443c5['shift']());}};_0x31818c(++_0x7921ed);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x40927b,_0xf9b0a0){_0x40927b=_0x40927b-0x0;var _0x2635e8=_0xcb91[_0x40927b];return _0x2635e8;};'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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x4fb2dd,_0x139852){var _0x1aefec=function(_0x576fd8){while(--_0x576fd8){_0x4fb2dd['push'](_0x4fb2dd['shift']());}};_0x1aefec(++_0x139852);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x16e57d,_0x2cb7ba){_0x16e57d=_0x16e57d-0x0;var _0x40239c=_0xcb91[_0x16e57d];return _0x40239c;};'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/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 8e30bff..17d78f8 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 _0x2598=['exports'];(function(_0x51ad3f,_0xba6fd0){var _0x5a2bab=function(_0x10de5c){while(--_0x10de5c){_0x51ad3f['push'](_0x51ad3f['shift']());}};_0x5a2bab(++_0xba6fd0);}(_0x2598,0x101));var _0x8259=function(_0x3fb743,_0x2b6886){_0x3fb743=_0x3fb743-0x0;var _0x135901=_0x2598[_0x3fb743];return _0x135901;};'use strict';var Sequelize=require('sequelize');module[_0x8259('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x4f16=['exports','INTEGER'];(function(_0x5a1cc9,_0x28f54d){var _0x471761=function(_0xda51c0){while(--_0xda51c0){_0x5a1cc9['push'](_0x5a1cc9['shift']());}};_0x471761(++_0x28f54d);}(_0x4f16,0x12a));var _0x64f1=function(_0x5d2507,_0x556fac){_0x5d2507=_0x5d2507-0x0;var _0x198c07=_0x4f16[_0x5d2507];return _0x198c07;};'use strict';var Sequelize=require('sequelize');module[_0x64f1('0x0')]={'penalty':{'type':Sequelize[_0x64f1('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 ec99b27..5611e36 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 _0x38b8=['../../config/logger','api','bluebird','rimraf','../../config/environment','UserSmsQueue','user_has_sms_queues','lodash'];(function(_0x2d34d6,_0x397ff9){var _0x1d3d12=function(_0x558800){while(--_0x558800){_0x2d34d6['push'](_0x2d34d6['shift']());}};_0x1d3d12(++_0x397ff9);}(_0x38b8,0x7f));var _0x838b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x38b8[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x838b('0x0'));var util=require('util');var logger=require(_0x838b('0x1'))(_0x838b('0x2'));var moment=require('moment');var BPromise=require(_0x838b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x838b('0x4'));var config=require(_0x838b('0x5'));var attributes=require('./userSmsQueue.attributes');module['exports']=function(_0x43fd53,_0x4299dc){return _0x43fd53['define'](_0x838b('0x6'),attributes,{'tableName':_0x838b('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x292c=['define','UserSmsQueue','user_has_sms_queues','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','exports'];(function(_0x2f2dd0,_0x242127){var _0x3c48d1=function(_0x4516b1){while(--_0x4516b1){_0x2f2dd0['push'](_0x2f2dd0['shift']());}};_0x3c48d1(++_0x242127);}(_0x292c,0x66));var _0xc292=function(_0x2e3dfc,_0x454d6c){_0x2e3dfc=_0x2e3dfc-0x0;var _0x4b1245=_0x292c[_0x2e3dfc];return _0x4b1245;};'use strict';var _=require(_0xc292('0x0'));var util=require('util');var logger=require(_0xc292('0x1'))(_0xc292('0x2'));var moment=require(_0xc292('0x3'));var BPromise=require(_0xc292('0x4'));var rp=require(_0xc292('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc292('0x6'));var config=require('../../config/environment');var attributes=require('./userSmsQueue.attributes');module[_0xc292('0x7')]=function(_0x1c45ed,_0x2c01eb){return _0x1c45ed[_0xc292('0x8')](_0xc292('0x9'),attributes,{'tableName':_0xc292('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.rpc.js b/server/api/userSmsQueue/userSmsQueue.rpc.js index 5d58f11..41d37b7 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 _0x0f97=['message','result','lodash','moment','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x19602e,_0x588309){var _0x37e890=function(_0x38438f){while(--_0x38438f){_0x19602e['push'](_0x19602e['shift']());}};_0x37e890(++_0x588309);}(_0x0f97,0x1a6));var _0x70f9=function(_0x187842,_0x58331c){_0x187842=_0x187842-0x0;var _0x5dbcf3=_0x0f97[_0x187842];return _0x5dbcf3;};'use strict';var _=require(_0x70f9('0x0'));var util=require('util');var moment=require(_0x70f9('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x70f9('0x2'));var db=require(_0x70f9('0x3'))['db'];var utils=require(_0x70f9('0x4'));var logger=require('../../config/logger')(_0x70f9('0x5'));var config=require('../../config/environment');var jayson=require(_0x70f9('0x6'));var client=jayson[_0x70f9('0x7')][_0x70f9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1b46b8,_0x56ee54,_0x86dcbf){return new BPromise(function(_0x5d7603,_0x4fbf89){return client[_0x70f9('0x9')](_0x1b46b8,_0x86dcbf)[_0x70f9('0xa')](function(_0x53779d){logger[_0x70f9('0xb')](_0x70f9('0xc'),_0x56ee54,_0x70f9('0xd'));logger[_0x70f9('0xe')]('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x56ee54,_0x70f9('0xd'),JSON[_0x70f9('0xf')](_0x53779d));if(_0x53779d[_0x70f9('0x10')]){if(_0x53779d['error'][_0x70f9('0x11')]===0x1f4){logger[_0x70f9('0x10')](_0x70f9('0xc'),_0x56ee54,_0x53779d['error'][_0x70f9('0x12')]);return _0x4fbf89(_0x53779d['error'][_0x70f9('0x12')]);}logger[_0x70f9('0x10')](_0x70f9('0xc'),_0x56ee54,_0x53779d[_0x70f9('0x10')]['message']);return _0x5d7603(_0x53779d[_0x70f9('0x10')][_0x70f9('0x12')]);}else{logger[_0x70f9('0xb')](_0x70f9('0xc'),_0x56ee54,'request\x20sent');_0x5d7603(_0x53779d[_0x70f9('0x13')][_0x70f9('0x12')]);}})['catch'](function(_0x5a5ec3){logger[_0x70f9('0x10')](_0x70f9('0xc'),_0x56ee54,_0x5a5ec3);_0x4fbf89(_0x5a5ec3);});});} \ No newline at end of file +var _0x0f52=['../../config/logger','rpc','jayson/promise','client','then','info','UserSmsQueue,\x20%s,\x20%s','debug','request\x20sent','error','message','result','catch','util','randomstring','../../mysqldb','../../config/utils'];(function(_0x2235bf,_0x3a06a7){var _0x4c3a64=function(_0x3b3bb6){while(--_0x3b3bb6){_0x2235bf['push'](_0x2235bf['shift']());}};_0x4c3a64(++_0x3a06a7);}(_0x0f52,0xd9));var _0x20f5=function(_0x27cb8a,_0x467852){_0x27cb8a=_0x27cb8a-0x0;var _0x42bb73=_0x0f52[_0x27cb8a];return _0x42bb73;};'use strict';var _=require('lodash');var util=require(_0x20f5('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x20f5('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x20f5('0x2'))['db'];var utils=require(_0x20f5('0x3'));var logger=require(_0x20f5('0x4'))(_0x20f5('0x5'));var config=require('../../config/environment');var jayson=require(_0x20f5('0x6'));var client=jayson[_0x20f5('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2d375e,_0x5ad818,_0x1ab142){return new BPromise(function(_0x3d8279,_0x4f764f){return client['request'](_0x2d375e,_0x1ab142)[_0x20f5('0x8')](function(_0x4c88e4){logger[_0x20f5('0x9')](_0x20f5('0xa'),_0x5ad818,'request\x20sent');logger[_0x20f5('0xb')]('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x5ad818,_0x20f5('0xc'),JSON['stringify'](_0x4c88e4));if(_0x4c88e4['error']){if(_0x4c88e4[_0x20f5('0xd')]['code']===0x1f4){logger[_0x20f5('0xd')](_0x20f5('0xa'),_0x5ad818,_0x4c88e4[_0x20f5('0xd')][_0x20f5('0xe')]);return _0x4f764f(_0x4c88e4['error'][_0x20f5('0xe')]);}logger[_0x20f5('0xd')](_0x20f5('0xa'),_0x5ad818,_0x4c88e4['error'][_0x20f5('0xe')]);return _0x3d8279(_0x4c88e4[_0x20f5('0xd')][_0x20f5('0xe')]);}else{logger[_0x20f5('0x9')](_0x20f5('0xa'),_0x5ad818,_0x20f5('0xc'));_0x3d8279(_0x4c88e4[_0x20f5('0xf')][_0x20f5('0xe')]);}})[_0x20f5('0x10')](function(_0x53d270){logger[_0x20f5('0xd')](_0x20f5('0xa'),_0x5ad818,_0x53d270);_0x4f764f(_0x53d270);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index 47ec8bc..221ed6e 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 _0x604f=['sequelize','exports','INTEGER'];(function(_0x2071e9,_0xe385d7){var _0x1e1dd8=function(_0x7a3944){while(--_0x7a3944){_0x2071e9['push'](_0x2071e9['shift']());}};_0x1e1dd8(++_0xe385d7);}(_0x604f,0x114));var _0xf604=function(_0x231e16,_0x67347b){_0x231e16=_0x231e16-0x0;var _0x570a7c=_0x604f[_0x231e16];return _0x570a7c;};'use strict';var Sequelize=require(_0xf604('0x0'));module[_0xf604('0x1')]={'UserId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0xf604('0x2')]}}; \ No newline at end of file +var _0xba31=['INTEGER','sequelize','exports'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xba31,0xa0));var _0x1ba3=function(_0x5bc5fe,_0x2afaef){_0x5bc5fe=_0x5bc5fe-0x0;var _0x298ea7=_0xba31[_0x5bc5fe];return _0x298ea7;};'use strict';var Sequelize=require(_0x1ba3('0x0'));module[_0x1ba3('0x1')]={'UserId':{'type':Sequelize[_0x1ba3('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x1ba3('0x2')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index deffe74..88ad5fb 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(_0x542f3e,_0x136753){var _0x54aa11=function(_0x24f102){while(--_0x24f102){_0x542f3e['push'](_0x542f3e['shift']());}};_0x54aa11(++_0x136753);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'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(_0x507724,_0x4553f5){var _0x23776f=function(_0x575ca4){while(--_0x575ca4){_0x507724['push'](_0x507724['shift']());}};_0x23776f(++_0x4553f5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'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 562f1ec..407f76b 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x547c62,_0x3960e9){var _0x39dbbc=function(_0x1e6323){while(--_0x1e6323){_0x547c62['push'](_0x547c62['shift']());}};_0x39dbbc(++_0x3960e9);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1b1e76,_0x31695b){_0x1b1e76=_0x1b1e76-0x0;var _0x3d743a=_0xcb91[_0x1b1e76];return _0x3d743a;};'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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x1ccb4b,_0x1c5bdc){var _0x2fd92c=function(_0x1a0286){while(--_0x1a0286){_0x1ccb4b['push'](_0x1ccb4b['shift']());}};_0x2fd92c(++_0x1c5bdc);}(_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 diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index b2dd4e4..45c61a7 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 _0x92df=['exports','INTEGER','sequelize'];(function(_0x337c08,_0x3c7b1e){var _0x4352fc=function(_0x5a5dfa){while(--_0x5a5dfa){_0x337c08['push'](_0x337c08['shift']());}};_0x4352fc(++_0x3c7b1e);}(_0x92df,0xcb));var _0xf92d=function(_0x1bc108,_0x4254cf){_0x1bc108=_0x1bc108-0x0;var _0x202e5d=_0x92df[_0x1bc108];return _0x202e5d;};'use strict';var Sequelize=require(_0xf92d('0x0'));module[_0xf92d('0x1')]={'penalty':{'type':Sequelize[_0xf92d('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x8e70=['sequelize','exports'];(function(_0x17a5cb,_0x3952a8){var _0x525e63=function(_0x1bce90){while(--_0x1bce90){_0x17a5cb['push'](_0x17a5cb['shift']());}};_0x525e63(++_0x3952a8);}(_0x8e70,0x88));var _0x08e7=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8e70[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x08e7('0x0'));module[_0x08e7('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 be88b37..b9983ac 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 _0x2700=['../../config/environment','./userVoiceQueue.attributes','UserVoiceQueue','user_has_voice_queues','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x2700,0x7c));var _0x0270=function(_0x5ad2a2,_0xdbcb51){_0x5ad2a2=_0x5ad2a2-0x0;var _0x51fec2=_0x2700[_0x5ad2a2];return _0x51fec2;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x0270('0x0'));var moment=require(_0x0270('0x1'));var BPromise=require(_0x0270('0x2'));var rp=require(_0x0270('0x3'));var fs=require('fs');var path=require(_0x0270('0x4'));var rimraf=require(_0x0270('0x5'));var config=require(_0x0270('0x6'));var attributes=require(_0x0270('0x7'));module['exports']=function(_0x19071f,_0x27df80){return _0x19071f['define'](_0x0270('0x8'),attributes,{'tableName':_0x0270('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6f5f=['user_has_voice_queues','lodash','util','moment','bluebird','request-promise','path','./userVoiceQueue.attributes','exports','define','UserVoiceQueue'];(function(_0x20ae2f,_0x455457){var _0x47adce=function(_0xae326f){while(--_0xae326f){_0x20ae2f['push'](_0x20ae2f['shift']());}};_0x47adce(++_0x455457);}(_0x6f5f,0xf3));var _0xf6f5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6f5f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf6f5('0x0'));var util=require(_0xf6f5('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xf6f5('0x2'));var BPromise=require(_0xf6f5('0x3'));var rp=require(_0xf6f5('0x4'));var fs=require('fs');var path=require(_0xf6f5('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf6f5('0x6'));module[_0xf6f5('0x7')]=function(_0xe61aa,_0x3dd1a4){return _0xe61aa[_0xf6f5('0x8')](_0xf6f5('0x9'),attributes,{'tableName':_0xf6f5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.rpc.js b/server/api/userVoiceQueue/userVoiceQueue.rpc.js index ffc14c2..9fdb841 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 _0xbd5f=['client','http','request','info','UserVoiceQueue,\x20%s,\x20%s','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x3aa8e3,_0xaa3ed4){var _0xe1b4af=function(_0x39f939){while(--_0x39f939){_0x3aa8e3['push'](_0x3aa8e3['shift']());}};_0xe1b4af(++_0xaa3ed4);}(_0xbd5f,0x15e));var _0xfbd5=function(_0x855ca5,_0x492541){_0x855ca5=_0x855ca5-0x0;var _0x31c8a5=_0xbd5f[_0x855ca5];return _0x31c8a5;};'use strict';var _=require(_0xfbd5('0x0'));var util=require(_0xfbd5('0x1'));var moment=require('moment');var BPromise=require(_0xfbd5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfbd5('0x3'));var db=require(_0xfbd5('0x4'))['db'];var utils=require(_0xfbd5('0x5'));var logger=require(_0xfbd5('0x6'))(_0xfbd5('0x7'));var config=require(_0xfbd5('0x8'));var jayson=require(_0xfbd5('0x9'));var client=jayson[_0xfbd5('0xa')][_0xfbd5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xadfca3,_0x3fefd6,_0x22922c){return new BPromise(function(_0x21320a,_0xd573d7){return client[_0xfbd5('0xc')](_0xadfca3,_0x22922c)['then'](function(_0x5ad6fc){logger[_0xfbd5('0xd')](_0xfbd5('0xe'),_0x3fefd6,'request\x20sent');logger[_0xfbd5('0xf')](_0xfbd5('0x10'),_0x3fefd6,_0xfbd5('0x11'),JSON[_0xfbd5('0x12')](_0x5ad6fc));if(_0x5ad6fc['error']){if(_0x5ad6fc[_0xfbd5('0x13')][_0xfbd5('0x14')]===0x1f4){logger[_0xfbd5('0x13')](_0xfbd5('0xe'),_0x3fefd6,_0x5ad6fc[_0xfbd5('0x13')]['message']);return _0xd573d7(_0x5ad6fc[_0xfbd5('0x13')]['message']);}logger['error'](_0xfbd5('0xe'),_0x3fefd6,_0x5ad6fc[_0xfbd5('0x13')]['message']);return _0x21320a(_0x5ad6fc['error'][_0xfbd5('0x15')]);}else{logger[_0xfbd5('0xd')](_0xfbd5('0xe'),_0x3fefd6,'request\x20sent');_0x21320a(_0x5ad6fc[_0xfbd5('0x16')][_0xfbd5('0x15')]);}})[_0xfbd5('0x17')](function(_0x1ceebd){logger[_0xfbd5('0x13')](_0xfbd5('0xe'),_0x3fefd6,_0x1ceebd);_0xd573d7(_0x1ceebd);});});} \ No newline at end of file +var _0x6192=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x539fef,_0x17f310){var _0x1c9d6f=function(_0x562903){while(--_0x562903){_0x539fef['push'](_0x539fef['shift']());}};_0x1c9d6f(++_0x17f310);}(_0x6192,0x19e));var _0x2619=function(_0xf8b548,_0x55255c){_0xf8b548=_0xf8b548-0x0;var _0x10010f=_0x6192[_0xf8b548];return _0x10010f;};'use strict';var _=require(_0x2619('0x0'));var util=require(_0x2619('0x1'));var moment=require(_0x2619('0x2'));var BPromise=require(_0x2619('0x3'));var rs=require(_0x2619('0x4'));var fs=require('fs');var Redis=require(_0x2619('0x5'));var db=require(_0x2619('0x6'))['db'];var utils=require(_0x2619('0x7'));var logger=require(_0x2619('0x8'))('rpc');var config=require(_0x2619('0x9'));var jayson=require(_0x2619('0xa'));var client=jayson[_0x2619('0xb')][_0x2619('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x7e5cb9,_0x171790,_0x4d3d2a){return new BPromise(function(_0x362e7f,_0x23239d){return client[_0x2619('0xd')](_0x7e5cb9,_0x4d3d2a)['then'](function(_0x5bcfdf){logger[_0x2619('0xe')](_0x2619('0xf'),_0x171790,_0x2619('0x10'));logger[_0x2619('0x11')](_0x2619('0x12'),_0x171790,_0x2619('0x10'),JSON[_0x2619('0x13')](_0x5bcfdf));if(_0x5bcfdf['error']){if(_0x5bcfdf['error']['code']===0x1f4){logger['error']('UserVoiceQueue,\x20%s,\x20%s',_0x171790,_0x5bcfdf[_0x2619('0x14')]['message']);return _0x23239d(_0x5bcfdf['error'][_0x2619('0x15')]);}logger[_0x2619('0x14')](_0x2619('0xf'),_0x171790,_0x5bcfdf['error'][_0x2619('0x15')]);return _0x362e7f(_0x5bcfdf['error'][_0x2619('0x15')]);}else{logger[_0x2619('0xe')](_0x2619('0xf'),_0x171790,_0x2619('0x10'));_0x362e7f(_0x5bcfdf[_0x2619('0x16')]['message']);}})['catch'](function(_0x1f0280){logger[_0x2619('0x14')](_0x2619('0xf'),_0x171790,_0x1f0280);_0x23239d(_0x1f0280);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index e383533..02a6909 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x22071a,_0x4bcf62){var _0x5c6c85=function(_0x4c531b){while(--_0x4c531b){_0x22071a['push'](_0x22071a['shift']());}};_0x5c6c85(++_0x4bcf62);}(_0x9c44,0x178));var _0x49c4=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0x9c44[_0x45d55e];return _0x29812a;};'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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x151227,_0x1c2d2d){var _0x9b7602=function(_0x28f9a6){while(--_0x28f9a6){_0x151227['push'](_0x151227['shift']());}};_0x9b7602(++_0x1c2d2d);}(_0xe706,0xa3));var _0x6e70=function(_0xa5c63f,_0x2aaaa8){_0xa5c63f=_0xa5c63f-0x0;var _0xf352b1=_0xe706[_0xa5c63f];return _0xf352b1;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index ee187d8..cad59d2 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 _0xd01b=['queue_interface','sequelize','exports','INTEGER','Required\x20by\x20Asterisk','STRING'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd01b,0x121));var _0xbd01=function(_0x1461c5,_0x457318){_0x1461c5=_0x1461c5-0x0;var _0x16bfab=_0xd01b[_0x1461c5];return _0x16bfab;};'use strict';var Sequelize=require(_0xbd01('0x0'));module[_0xbd01('0x1')]={'uniqueid':{'type':Sequelize[_0xbd01('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0xbd01('0x3')},'membername':{'type':Sequelize[_0xbd01('0x4')],'allowNull':![],'comment':_0xbd01('0x3')},'UserId':{'type':Sequelize[_0xbd01('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0xbd01('0x4')],'allowNull':![],'unique':_0xbd01('0x5'),'comment':_0xbd01('0x3')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize[_0xbd01('0x4')],'allowNull':![],'unique':_0xbd01('0x5'),'comment':_0xbd01('0x3')},'penalty':{'type':Sequelize[_0xbd01('0x2')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0xbd01('0x3')}}; \ No newline at end of file +var _0x6f26=['INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface','exports'];(function(_0x7c10f3,_0x4447fe){var _0x51d432=function(_0x3e8c68){while(--_0x3e8c68){_0x7c10f3['push'](_0x7c10f3['shift']());}};_0x51d432(++_0x4447fe);}(_0x6f26,0x1ad));var _0x66f2=function(_0x4159bc,_0x13aa41){_0x4159bc=_0x4159bc-0x0;var _0x536069=_0x6f26[_0x4159bc];return _0x536069;};'use strict';var Sequelize=require('sequelize');module[_0x66f2('0x0')]={'uniqueid':{'type':Sequelize[_0x66f2('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x66f2('0x2')},'membername':{'type':Sequelize[_0x66f2('0x3')],'allowNull':![],'comment':_0x66f2('0x2')},'UserId':{'type':Sequelize[_0x66f2('0x1')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x66f2('0x3')],'allowNull':![],'unique':_0x66f2('0x4'),'comment':_0x66f2('0x2')},'VoiceQueueId':{'type':Sequelize[_0x66f2('0x1')],'allowNull':![]},'interface':{'type':Sequelize[_0x66f2('0x3')],'allowNull':![],'unique':_0x66f2('0x4'),'comment':'Required\x20by\x20Asterisk'},'penalty':{'type':Sequelize[_0x66f2('0x1')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize[_0x66f2('0x1')](0xb),'defaultValue':0x0,'comment':_0x66f2('0x2')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index d7dfad0..7f2108d 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 _0xa979=['../../mysqldb','UserVoiceQueueRt','setMaxListeners','save','update','remove','emit','hook'];(function(_0x5b5a44,_0x5ac308){var _0x339d7f=function(_0xbdabe8){while(--_0xbdabe8){_0x5b5a44['push'](_0x5b5a44['shift']());}};_0x339d7f(++_0x5ac308);}(_0xa979,0x110));var _0x9a97=function(_0x195ab0,_0x273e02){_0x195ab0=_0x195ab0-0x0;var _0x59414a=_0xa979[_0x195ab0];return _0x59414a;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require(_0x9a97('0x0'))['db'][_0x9a97('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x9a97('0x2')](0x0);var events={'afterCreate':_0x9a97('0x3'),'afterUpdate':_0x9a97('0x4'),'afterDestroy':_0x9a97('0x5')};function emitEvent(_0x5385ac){return function(_0x5b8ce1,_0x130ae0,_0x4e7f0a){UserVoiceQueueRtEvents[_0x9a97('0x6')](_0x5385ac+':'+_0x5b8ce1['id'],_0x5b8ce1);UserVoiceQueueRtEvents[_0x9a97('0x6')](_0x5385ac,_0x5b8ce1);_0x4e7f0a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0x9a97('0x7')](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file +var _0xb63b=['emit','hook','exports','events','../../mysqldb','UserVoiceQueueRt','setMaxListeners','save','update','remove'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0xb63b,0xfd));var _0xbb63=function(_0x4c1c36,_0x1575f2){_0x4c1c36=_0x4c1c36-0x0;var _0x47a637=_0xb63b[_0x4c1c36];return _0x47a637;};'use strict';var EventEmitter=require(_0xbb63('0x0'));var UserVoiceQueueRt=require(_0xbb63('0x1'))['db'][_0xbb63('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xbb63('0x3')](0x0);var events={'afterCreate':_0xbb63('0x4'),'afterUpdate':_0xbb63('0x5'),'afterDestroy':_0xbb63('0x6')};function emitEvent(_0x4ad978){return function(_0x3d8e72,_0x56d582,_0x298955){UserVoiceQueueRtEvents['emit'](_0x4ad978+':'+_0x3d8e72['id'],_0x3d8e72);UserVoiceQueueRtEvents[_0xbb63('0x7')](_0x4ad978,_0x3d8e72);_0x298955(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0xbb63('0x8')](e,emitEvent(event));}}module[_0xbb63('0x9')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index ded62c5..0c7a5c6 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 _0x7a33=['./userVoiceQueueRt.attributes','exports','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util','../../config/logger','moment','bluebird','request-promise','../../config/environment'];(function(_0x35ef47,_0x4590ae){var _0x3a8b18=function(_0xecabda){while(--_0xecabda){_0x35ef47['push'](_0x35ef47['shift']());}};_0x3a8b18(++_0x4590ae);}(_0x7a33,0x7d));var _0x37a3=function(_0x35a558,_0x588e15){_0x35a558=_0x35a558-0x0;var _0x1f7adc=_0x7a33[_0x35a558];return _0x1f7adc;};'use strict';var _=require(_0x37a3('0x0'));var util=require(_0x37a3('0x1'));var logger=require(_0x37a3('0x2'))('api');var moment=require(_0x37a3('0x3'));var BPromise=require(_0x37a3('0x4'));var rp=require(_0x37a3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x37a3('0x6'));var attributes=require(_0x37a3('0x7'));module[_0x37a3('0x8')]=function(_0x589e38,_0x91cfc0){return _0x589e38['define'](_0x37a3('0x9'),attributes,{'tableName':_0x37a3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x41d9=['../../config/environment','exports','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x41d9,0x9b));var _0x941d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x41d9[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x941d('0x0'));var util=require(_0x941d('0x1'));var logger=require(_0x941d('0x2'))(_0x941d('0x3'));var moment=require('moment');var BPromise=require(_0x941d('0x4'));var rp=require(_0x941d('0x5'));var fs=require('fs');var path=require(_0x941d('0x6'));var rimraf=require('rimraf');var config=require(_0x941d('0x7'));var attributes=require('./userVoiceQueueRt.attributes');module[_0x941d('0x8')]=function(_0x11e294,_0x169159){return _0x11e294['define']('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 43e7c81..06fae72 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 _0x58b1=['UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','UserVoiceQueueRt','findAll','options','COUNT','sequelize','outboundQueuePauses','GetVoiceQueueRtPauses','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','socket.io-emitter','./userVoiceQueueRt.socket','register','request','info','UserVoiceQueueRt,\x20%s,\x20%s','debug'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x58b1,0xda));var _0x158b=function(_0x57486e,_0x32283b){_0x57486e=_0x57486e-0x0;var _0x5f110b=_0x58b1[_0x57486e];return _0x5f110b;};'use strict';var _=require(_0x158b('0x0'));var util=require(_0x158b('0x1'));var moment=require(_0x158b('0x2'));var BPromise=require(_0x158b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x158b('0x4'))['db'];var utils=require(_0x158b('0x5'));var logger=require(_0x158b('0x6'))(_0x158b('0x7'));var config=require(_0x158b('0x8'));var jayson=require(_0x158b('0x9'));var client=jayson[_0x158b('0xa')]['http']({'port':0x232a});config['redis']=_[_0x158b('0xb')](config[_0x158b('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x158b('0xd'))(new Redis(config[_0x158b('0xc')]));require(_0x158b('0xe'))[_0x158b('0xf')](socket);function respondWithRpcPromise(_0x24b765,_0x5df29e,_0xba29a){return new BPromise(function(_0x3a5f4c,_0x44d26e){return client[_0x158b('0x10')](_0x24b765,_0xba29a)['then'](function(_0x2a651e){logger[_0x158b('0x11')](_0x158b('0x12'),_0x5df29e,'request\x20sent');logger[_0x158b('0x13')](_0x158b('0x14'),_0x5df29e,'request\x20sent',JSON[_0x158b('0x15')](_0x2a651e));if(_0x2a651e[_0x158b('0x16')]){if(_0x2a651e[_0x158b('0x16')][_0x158b('0x17')]===0x1f4){logger[_0x158b('0x16')](_0x158b('0x12'),_0x5df29e,_0x2a651e[_0x158b('0x16')][_0x158b('0x18')]);return _0x44d26e(_0x2a651e[_0x158b('0x16')][_0x158b('0x18')]);}logger['error']('UserVoiceQueueRt,\x20%s,\x20%s',_0x5df29e,_0x2a651e[_0x158b('0x16')][_0x158b('0x18')]);return _0x3a5f4c(_0x2a651e[_0x158b('0x16')][_0x158b('0x18')]);}else{logger[_0x158b('0x11')](_0x158b('0x12'),_0x5df29e,_0x158b('0x19'));_0x3a5f4c(_0x2a651e['result']['message']);}})[_0x158b('0x1a')](function(_0x200a37){logger[_0x158b('0x16')](_0x158b('0x12'),_0x5df29e,_0x200a37);_0x44d26e(_0x200a37);});});}exports['GetVoiceQueueRtPauses']=function(_0x2082d8){var _0x3d0773=this;return new Promise(function(_0x154e05,_0x449072){return db[_0x158b('0x1b')][_0x158b('0x1c')]({'raw':_0x2082d8['options']?_0x2082d8[_0x158b('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x2082d8[_0x158b('0x1d')]?_0x2082d8[_0x158b('0x1d')]['where']||null:null,'attributes':[[db['sequelize']['fn'](_0x158b('0x1e'),db[_0x158b('0x1f')]['fn']('IF',db[_0x158b('0x1f')]['literal']('`paused`\x20=\x201,\x201,\x20null'))),_0x158b('0x20')]]})['then'](function(_0xc24ca0){logger[_0x158b('0x11')](_0x158b('0x21'),_0x2082d8);logger[_0x158b('0x13')](_0x158b('0x21'),_0x2082d8,JSON[_0x158b('0x15')](_0xc24ca0));_0x154e05(_0xc24ca0);})[_0x158b('0x1a')](function(_0x32fe55){logger[_0x158b('0x16')]('GetVoiceQueueRtPauses',_0x32fe55[_0x158b('0x18')],_0x2082d8);_0x449072(_0x3d0773['error'](0x1f4,_0x32fe55['message']));});});}; \ No newline at end of file +var _0xd0ab=['result','catch','UserVoiceQueueRt','options','raw','where','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','GetVoiceQueueRtPauses','stringify','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','client','redis','localhost','./userVoiceQueueRt.socket','register','request','then','info','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','error','code','UserVoiceQueueRt,\x20%s,\x20%s','message'];(function(_0xc88275,_0x5ea571){var _0x303c72=function(_0x32d068){while(--_0x32d068){_0xc88275['push'](_0xc88275['shift']());}};_0x303c72(++_0x5ea571);}(_0xd0ab,0x13f));var _0xbd0a=function(_0x583d1b,_0x3c33b9){_0x583d1b=_0x583d1b-0x0;var _0x5f10d8=_0xd0ab[_0x583d1b];return _0x5f10d8;};'use strict';var _=require('lodash');var util=require(_0xbd0a('0x0'));var moment=require('moment');var BPromise=require(_0xbd0a('0x1'));var rs=require(_0xbd0a('0x2'));var fs=require('fs');var Redis=require(_0xbd0a('0x3'));var db=require(_0xbd0a('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xbd0a('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xbd0a('0x6')]['http']({'port':0x232a});config[_0xbd0a('0x7')]=_['defaults'](config[_0xbd0a('0x7')],{'host':_0xbd0a('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbd0a('0x7')]));require(_0xbd0a('0x9'))[_0xbd0a('0xa')](socket);function respondWithRpcPromise(_0x4ea438,_0x496790,_0x252637){return new BPromise(function(_0x38ff2f,_0x942b03){return client[_0xbd0a('0xb')](_0x4ea438,_0x252637)[_0xbd0a('0xc')](function(_0x4d9d39){logger[_0xbd0a('0xd')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x496790,_0xbd0a('0xe'));logger[_0xbd0a('0xf')](_0xbd0a('0x10'),_0x496790,_0xbd0a('0xe'),JSON['stringify'](_0x4d9d39));if(_0x4d9d39['error']){if(_0x4d9d39[_0xbd0a('0x11')][_0xbd0a('0x12')]===0x1f4){logger[_0xbd0a('0x11')](_0xbd0a('0x13'),_0x496790,_0x4d9d39[_0xbd0a('0x11')][_0xbd0a('0x14')]);return _0x942b03(_0x4d9d39[_0xbd0a('0x11')][_0xbd0a('0x14')]);}logger['error']('UserVoiceQueueRt,\x20%s,\x20%s',_0x496790,_0x4d9d39[_0xbd0a('0x11')]['message']);return _0x38ff2f(_0x4d9d39[_0xbd0a('0x11')][_0xbd0a('0x14')]);}else{logger['info'](_0xbd0a('0x13'),_0x496790,_0xbd0a('0xe'));_0x38ff2f(_0x4d9d39[_0xbd0a('0x15')][_0xbd0a('0x14')]);}})[_0xbd0a('0x16')](function(_0x2da410){logger['error'](_0xbd0a('0x13'),_0x496790,_0x2da410);_0x942b03(_0x2da410);});});}exports['GetVoiceQueueRtPauses']=function(_0xb979d6){var _0x524c7d=this;return new Promise(function(_0x2dec61,_0x5c77de){return db[_0xbd0a('0x17')]['findAll']({'raw':_0xb979d6[_0xbd0a('0x18')]?_0xb979d6[_0xbd0a('0x18')][_0xbd0a('0x19')]===undefined?!![]:![]:!![],'where':_0xb979d6[_0xbd0a('0x18')]?_0xb979d6[_0xbd0a('0x18')][_0xbd0a('0x1a')]||null:null,'attributes':[[db[_0xbd0a('0x1b')]['fn'](_0xbd0a('0x1c'),db['sequelize']['fn']('IF',db[_0xbd0a('0x1b')][_0xbd0a('0x1d')](_0xbd0a('0x1e')))),_0xbd0a('0x1f')]]})[_0xbd0a('0xc')](function(_0x4ca38f){logger['info'](_0xbd0a('0x20'),_0xb979d6);logger['debug'](_0xbd0a('0x20'),_0xb979d6,JSON[_0xbd0a('0x21')](_0x4ca38f));_0x2dec61(_0x4ca38f);})[_0xbd0a('0x16')](function(_0x42be3a){logger['error'](_0xbd0a('0x20'),_0x42be3a[_0xbd0a('0x14')],_0xb979d6);_0x5c77de(_0x524c7d[_0xbd0a('0x11')](0x1f4,_0x42be3a[_0xbd0a('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 0b195e2..534027a 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 _0x8585=['remove','removeListener','length','userVoiceQueueRt:','./userVoiceQueueRt.events','save'];(function(_0x148397,_0x5dfe77){var _0x428af6=function(_0x3a4d96){while(--_0x3a4d96){_0x148397['push'](_0x148397['shift']());}};_0x428af6(++_0x5dfe77);}(_0x8585,0x64));var _0x5858=function(_0x487a2e,_0xbea254){_0x487a2e=_0x487a2e-0x0;var _0x6df506=_0x8585[_0x487a2e];return _0x6df506;};'use strict';var UserVoiceQueueRtEvents=require(_0x5858('0x0'));var events=[_0x5858('0x1'),_0x5858('0x2'),'update'];function createListener(_0x2864b0,_0x294e8e){return function(_0x5739bc){_0x294e8e['emit'](_0x2864b0,_0x5739bc);};}function removeListener(_0x5c548b,_0x307ed3){return function(){UserVoiceQueueRtEvents[_0x5858('0x3')](_0x5c548b,_0x307ed3);};}exports['register']=function(_0x5807a2){for(var _0x35b37a=0x0,_0x1d26d1=events[_0x5858('0x4')];_0x35b37a<_0x1d26d1;_0x35b37a++){var _0x5c8e94=events[_0x35b37a];var _0x4d5efe=createListener(_0x5858('0x5')+_0x5c8e94,_0x5807a2);UserVoiceQueueRtEvents['on'](_0x5c8e94,_0x4d5efe);}}; \ No newline at end of file +var _0x2975=['update','removeListener','register','length','userVoiceQueueRt:','save','remove'];(function(_0x1937a2,_0x1bbffd){var _0x3347c7=function(_0x2021c3){while(--_0x2021c3){_0x1937a2['push'](_0x1937a2['shift']());}};_0x3347c7(++_0x1bbffd);}(_0x2975,0x1c5));var _0x5297=function(_0x1f80c8,_0x44ed21){_0x1f80c8=_0x1f80c8-0x0;var _0x867980=_0x2975[_0x1f80c8];return _0x867980;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=[_0x5297('0x0'),_0x5297('0x1'),_0x5297('0x2')];function createListener(_0x1a511b,_0x115e60){return function(_0x178801){_0x115e60['emit'](_0x1a511b,_0x178801);};}function removeListener(_0x56371f,_0x5e9de3){return function(){UserVoiceQueueRtEvents[_0x5297('0x3')](_0x56371f,_0x5e9de3);};}exports[_0x5297('0x4')]=function(_0x11a43d){for(var _0x3da9c6=0x0,_0x4d1d2c=events[_0x5297('0x5')];_0x3da9c6<_0x4d1d2c;_0x3da9c6++){var _0x1b72a7=events[_0x3da9c6];var _0x4f12b0=createListener(_0x5297('0x6')+_0x1b72a7,_0x11a43d);UserVoiceQueueRtEvents['on'](_0x1b72a7,_0x4f12b0);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 32af543..c0a9fc3 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x41f892,_0xa805c2){var _0x4d390f=function(_0x1118ab){while(--_0x1118ab){_0x41f892['push'](_0x41f892['shift']());}};_0x4d390f(++_0xa805c2);}(_0xe706,0xa3));var _0x6e70=function(_0x4beb7a,_0x246983){_0x4beb7a=_0x4beb7a-0x0;var _0x50c7dd=_0xe706[_0x4beb7a];return _0x50c7dd;};'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(_0x470d59,_0x2d6c72){var _0x48d24b=function(_0x1ebd42){while(--_0x1ebd42){_0x470d59['push'](_0x470d59['shift']());}};_0x48d24b(++_0x2d6c72);}(_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 diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 4869487..fbdee9f 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 _0x6d2e=['exports'];(function(_0x2bbc07,_0x1e2168){var _0x6879e4=function(_0x290fa1){while(--_0x290fa1){_0x2bbc07['push'](_0x2bbc07['shift']());}};_0x6879e4(++_0x1e2168);}(_0x6d2e,0x134));var _0xe6d2=function(_0x5b96f6,_0x26fe54){_0x5b96f6=_0x5b96f6-0x0;var _0xe67cd8=_0x6d2e[_0x5b96f6];return _0xe67cd8;};'use strict';var Sequelize=require('sequelize');module[_0xe6d2('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xfeec=['INTEGER','sequelize'];(function(_0x1b1c33,_0x3a6eb4){var _0x5a133a=function(_0x5dfdd9){while(--_0x5dfdd9){_0x1b1c33['push'](_0x1b1c33['shift']());}};_0x5a133a(++_0x3a6eb4);}(_0xfeec,0xd9));var _0xcfee=function(_0x35f60f,_0x4a4e98){_0x35f60f=_0x35f60f-0x0;var _0x37cb4a=_0xfeec[_0x35f60f];return _0x37cb4a;};'use strict';var Sequelize=require(_0xcfee('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xcfee('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index 56bfc28..e993f3e 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 _0xacde=['path','rimraf','../../config/environment','./userWhatsappQueue.attributes','exports','UserWhatsappQueue','util','../../config/logger','api','bluebird','request-promise'];(function(_0x502c21,_0x1c019b){var _0x4fe468=function(_0x5230f4){while(--_0x5230f4){_0x502c21['push'](_0x502c21['shift']());}};_0x4fe468(++_0x1c019b);}(_0xacde,0x95));var _0xeacd=function(_0x89e0f5,_0x5652e6){_0x89e0f5=_0x89e0f5-0x0;var _0x119e69=_0xacde[_0x89e0f5];return _0x119e69;};'use strict';var _=require('lodash');var util=require(_0xeacd('0x0'));var logger=require(_0xeacd('0x1'))(_0xeacd('0x2'));var moment=require('moment');var BPromise=require(_0xeacd('0x3'));var rp=require(_0xeacd('0x4'));var fs=require('fs');var path=require(_0xeacd('0x5'));var rimraf=require(_0xeacd('0x6'));var config=require(_0xeacd('0x7'));var attributes=require(_0xeacd('0x8'));module[_0xeacd('0x9')]=function(_0x7cfad1,_0x4af253){return _0x7cfad1['define'](_0xeacd('0xa'),attributes,{'tableName':'user_has_whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd028=['util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./userWhatsappQueue.attributes','exports','define','UserWhatsappQueue','user_has_whatsapp_queues'];(function(_0x170db7,_0x3652df){var _0x13cc2c=function(_0x3149b3){while(--_0x3149b3){_0x170db7['push'](_0x170db7['shift']());}};_0x13cc2c(++_0x3652df);}(_0xd028,0xd0));var _0x8d02=function(_0x5a3fa5,_0x31f617){_0x5a3fa5=_0x5a3fa5-0x0;var _0x3bd85d=_0xd028[_0x5a3fa5];return _0x3bd85d;};'use strict';var _=require('lodash');var util=require(_0x8d02('0x0'));var logger=require(_0x8d02('0x1'))(_0x8d02('0x2'));var moment=require(_0x8d02('0x3'));var BPromise=require('bluebird');var rp=require(_0x8d02('0x4'));var fs=require('fs');var path=require(_0x8d02('0x5'));var rimraf=require(_0x8d02('0x6'));var config=require(_0x8d02('0x7'));var attributes=require(_0x8d02('0x8'));module[_0x8d02('0x9')]=function(_0x41d77b,_0x496826){return _0x41d77b[_0x8d02('0xa')](_0x8d02('0xb'),attributes,{'tableName':_0x8d02('0xc'),'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 8d8a006..01b6b8b 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 _0xe5d7=['message','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','error','code','UserWhatsappQueue,\x20%s,\x20%s'];(function(_0x53e787,_0x4298e6){var _0x2781a0=function(_0x21f861){while(--_0x21f861){_0x53e787['push'](_0x53e787['shift']());}};_0x2781a0(++_0x4298e6);}(_0xe5d7,0x151));var _0x7e5d=function(_0xdb8c5c,_0x5a6559){_0xdb8c5c=_0xdb8c5c-0x0;var _0x3b2966=_0xe5d7[_0xdb8c5c];return _0x3b2966;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7e5d('0x0'));var BPromise=require(_0x7e5d('0x1'));var rs=require(_0x7e5d('0x2'));var fs=require('fs');var Redis=require(_0x7e5d('0x3'));var db=require(_0x7e5d('0x4'))['db'];var utils=require(_0x7e5d('0x5'));var logger=require(_0x7e5d('0x6'))(_0x7e5d('0x7'));var config=require(_0x7e5d('0x8'));var jayson=require(_0x7e5d('0x9'));var client=jayson[_0x7e5d('0xa')][_0x7e5d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x30da17,_0x384b42,_0x3fa800){return new BPromise(function(_0x213edd,_0x2bd8fa){return client[_0x7e5d('0xc')](_0x30da17,_0x3fa800)[_0x7e5d('0xd')](function(_0x4a387d){logger[_0x7e5d('0xe')]('UserWhatsappQueue,\x20%s,\x20%s',_0x384b42,_0x7e5d('0xf'));logger[_0x7e5d('0x10')]('UserWhatsappQueue,\x20%s,\x20%s,\x20%s',_0x384b42,_0x7e5d('0xf'),JSON['stringify'](_0x4a387d));if(_0x4a387d[_0x7e5d('0x11')]){if(_0x4a387d['error'][_0x7e5d('0x12')]===0x1f4){logger[_0x7e5d('0x11')](_0x7e5d('0x13'),_0x384b42,_0x4a387d[_0x7e5d('0x11')][_0x7e5d('0x14')]);return _0x2bd8fa(_0x4a387d[_0x7e5d('0x11')][_0x7e5d('0x14')]);}logger[_0x7e5d('0x11')]('UserWhatsappQueue,\x20%s,\x20%s',_0x384b42,_0x4a387d[_0x7e5d('0x11')][_0x7e5d('0x14')]);return _0x213edd(_0x4a387d['error']['message']);}else{logger[_0x7e5d('0xe')](_0x7e5d('0x13'),_0x384b42,_0x7e5d('0xf'));_0x213edd(_0x4a387d['result'][_0x7e5d('0x14')]);}})['catch'](function(_0x4e8390){logger[_0x7e5d('0x11')](_0x7e5d('0x13'),_0x384b42,_0x4e8390);_0x2bd8fa(_0x4e8390);});});} \ No newline at end of file +var _0x9f3e=['stringify','error','code','UserWhatsappQueue,\x20%s,\x20%s','message','info','result','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s'];(function(_0x25d2fa,_0x1d35c6){var _0x42d4aa=function(_0x590383){while(--_0x590383){_0x25d2fa['push'](_0x25d2fa['shift']());}};_0x42d4aa(++_0x1d35c6);}(_0x9f3e,0xed));var _0xe9f3=function(_0x137106,_0x1c47ef){_0x137106=_0x137106-0x0;var _0x9fc4f5=_0x9f3e[_0x137106];return _0x9fc4f5;};'use strict';var _=require(_0xe9f3('0x0'));var util=require(_0xe9f3('0x1'));var moment=require(_0xe9f3('0x2'));var BPromise=require(_0xe9f3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe9f3('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe9f3('0x5'));var logger=require(_0xe9f3('0x6'))('rpc');var config=require(_0xe9f3('0x7'));var jayson=require(_0xe9f3('0x8'));var client=jayson[_0xe9f3('0x9')][_0xe9f3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3e2859,_0x2ae7df,_0x43e300){return new BPromise(function(_0x2d9204,_0x2077c0){return client[_0xe9f3('0xb')](_0x3e2859,_0x43e300)[_0xe9f3('0xc')](function(_0x51e000){logger['info']('UserWhatsappQueue,\x20%s,\x20%s',_0x2ae7df,_0xe9f3('0xd'));logger[_0xe9f3('0xe')](_0xe9f3('0xf'),_0x2ae7df,_0xe9f3('0xd'),JSON[_0xe9f3('0x10')](_0x51e000));if(_0x51e000[_0xe9f3('0x11')]){if(_0x51e000['error'][_0xe9f3('0x12')]===0x1f4){logger[_0xe9f3('0x11')](_0xe9f3('0x13'),_0x2ae7df,_0x51e000[_0xe9f3('0x11')][_0xe9f3('0x14')]);return _0x2077c0(_0x51e000[_0xe9f3('0x11')][_0xe9f3('0x14')]);}logger[_0xe9f3('0x11')](_0xe9f3('0x13'),_0x2ae7df,_0x51e000['error'][_0xe9f3('0x14')]);return _0x2d9204(_0x51e000[_0xe9f3('0x11')]['message']);}else{logger[_0xe9f3('0x15')](_0xe9f3('0x13'),_0x2ae7df,_0xe9f3('0xd'));_0x2d9204(_0x51e000[_0xe9f3('0x16')][_0xe9f3('0x14')]);}})['catch'](function(_0x17640e){logger[_0xe9f3('0x11')](_0xe9f3('0x13'),_0x2ae7df,_0x17640e);_0x2077c0(_0x17640e);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 806494a..e5f6e52 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 _0x26c2=['Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports','connect-timeout','express'];(function(_0x731fcf,_0x19ad1b){var _0x10eb66=function(_0x503b4c){while(--_0x503b4c){_0x731fcf['push'](_0x731fcf['shift']());}};_0x10eb66(++_0x19ad1b);}(_0x26c2,0x130));var _0x226c=function(_0xef182d,_0x35ddcd){_0xef182d=_0xef182d-0x0;var _0x2d249e=_0x26c2[_0xef182d];return _0x2d249e;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x226c('0x0'));var express=require(_0x226c('0x1'));var router=express[_0x226c('0x2')]();var fs_extra=require(_0x226c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x226c('0x4'));var config=require(_0x226c('0x5'));var controller=require('./variable.controller');router[_0x226c('0x6')]('/',auth[_0x226c('0x7')](),controller[_0x226c('0x8')]);router[_0x226c('0x6')](_0x226c('0x9'),auth['isAuthenticated'](),controller[_0x226c('0xa')]);router[_0x226c('0xb')]('/',auth[_0x226c('0x7')](),controller[_0x226c('0xc')]);router[_0x226c('0xd')]('/:id',auth[_0x226c('0x7')](),controller[_0x226c('0xe')]);router['delete']('/:id',auth[_0x226c('0x7')](),controller[_0x226c('0xf')]);module[_0x226c('0x10')]=router; \ No newline at end of file +var _0x2f72=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./variable.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','exports','multer','util'];(function(_0x32ca0b,_0x49c78b){var _0x1587bd=function(_0x2ca8fe){while(--_0x2ca8fe){_0x32ca0b['push'](_0x32ca0b['shift']());}};_0x1587bd(++_0x49c78b);}(_0x2f72,0x166));var _0x22f7=function(_0x4dfc5c,_0x43df75){_0x4dfc5c=_0x4dfc5c-0x0;var _0x3e7b9a=_0x2f72[_0x4dfc5c];return _0x3e7b9a;};'use strict';var multer=require(_0x22f7('0x0'));var util=require(_0x22f7('0x1'));var path=require(_0x22f7('0x2'));var timeout=require(_0x22f7('0x3'));var express=require(_0x22f7('0x4'));var router=express[_0x22f7('0x5')]();var fs_extra=require(_0x22f7('0x6'));var auth=require(_0x22f7('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x22f7('0x8'));var controller=require(_0x22f7('0x9'));router[_0x22f7('0xa')]('/',auth[_0x22f7('0xb')](),controller[_0x22f7('0xc')]);router[_0x22f7('0xa')](_0x22f7('0xd'),auth[_0x22f7('0xb')](),controller[_0x22f7('0xe')]);router[_0x22f7('0xf')]('/',auth[_0x22f7('0xb')](),controller[_0x22f7('0x10')]);router[_0x22f7('0x11')](_0x22f7('0xd'),auth[_0x22f7('0xb')](),controller[_0x22f7('0x12')]);router['delete'](_0x22f7('0xd'),auth[_0x22f7('0xb')](),controller['destroy']);module[_0x22f7('0x13')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 9576c12..02a11b2 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 _0xc2a5=['STRING','name','sequelize'];(function(_0x54057b,_0x44ad66){var _0x48e268=function(_0x1f8bdd){while(--_0x1f8bdd){_0x54057b['push'](_0x54057b['shift']());}};_0x48e268(++_0x44ad66);}(_0xc2a5,0x1d6));var _0x5c2a=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xc2a5[_0x432682];return _0x463d05;};'use strict';var Sequelize=require(_0x5c2a('0x0'));module['exports']={'name':{'type':Sequelize[_0x5c2a('0x1')],'unique':_0x5c2a('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1a28=['STRING','name','sequelize','exports'];(function(_0xa5b0c1,_0x2273f5){var _0x564872=function(_0x3e0f02){while(--_0x3e0f02){_0xa5b0c1['push'](_0xa5b0c1['shift']());}};_0x564872(++_0x2273f5);}(_0x1a28,0x10e));var _0x81a2=function(_0x4ec7f2,_0x3d92d2){_0x4ec7f2=_0x4ec7f2-0x0;var _0x118004=_0x1a28[_0x4ec7f2];return _0x118004;};'use strict';var Sequelize=require(_0x81a2('0x0'));module[_0x81a2('0x1')]={'name':{'type':Sequelize[_0x81a2('0x2')],'unique':_0x81a2('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x81a2('0x2')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index abe2f80..d4e3ea6 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 _0xc50f=['attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','keys','length','find','create','body','user','UserProfileSection','autoAssociation','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Variables','UserProfileResource','error','stack','name','index','Variable','rawAttributes','fieldName','type','key','model','map','query','intersection'];(function(_0x18c8b5,_0x2a15d3){var _0x358984=function(_0xf5461){while(--_0xf5461){_0x18c8b5['push'](_0x18c8b5['shift']());}};_0x358984(++_0x2a15d3);}(_0xc50f,0xba));var _0xfc50=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xc50f[_0x2b4411];return _0x8e41ef;};'use strict';var emlformat=require(_0xfc50('0x0'));var rimraf=require(_0xfc50('0x1'));var zipdir=require(_0xfc50('0x2'));var jsonpatch=require(_0xfc50('0x3'));var rp=require(_0xfc50('0x4'));var moment=require(_0xfc50('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xfc50('0x6'));var path=require(_0xfc50('0x7'));var sox=require('sox');var csv=require(_0xfc50('0x8'));var ejs=require(_0xfc50('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfc50('0xa'));var squel=require(_0xfc50('0xb'));var crypto=require('crypto');var jsforce=require(_0xfc50('0xc'));var deskjs=require(_0xfc50('0xd'));var toCsv=require('to-csv');var querystring=require(_0xfc50('0xe'));var Papa=require(_0xfc50('0xf'));var Redis=require(_0xfc50('0x10'));var authService=require(_0xfc50('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xfc50('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfc50('0x13'))('api');var utils=require(_0xfc50('0x14'));var config=require(_0xfc50('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2b2d59,_0x2275cb){_0x2275cb=_0x2275cb||0xcc;return function(_0x5c8c5f){if(_0x5c8c5f){return _0x2b2d59[_0xfc50('0x16')](_0x2275cb);}return _0x2b2d59[_0xfc50('0x17')](_0x2275cb)[_0xfc50('0x18')]();};}function respondWithResult(_0x1eb102,_0x2bfdbe){_0x2bfdbe=_0x2bfdbe||0xc8;return function(_0x48503b){if(_0x48503b){return _0x1eb102['status'](_0x2bfdbe)[_0xfc50('0x19')](_0x48503b);}};}function respondWithFilteredResult(_0x199495,_0xb35c9a){return function(_0x2256be){if(_0x2256be){var _0x2028e1=typeof _0xb35c9a[_0xfc50('0x1a')]===_0xfc50('0x1b')&&typeof _0xb35c9a[_0xfc50('0x1c')]==='undefined';var _0x377382=_0x2256be[_0xfc50('0x1d')];var _0x5a1e4b=_0x2028e1?0x0:_0xb35c9a[_0xfc50('0x1a')];var _0x2b3186=_0x2028e1?_0x2256be[_0xfc50('0x1d')]:_0xb35c9a[_0xfc50('0x1a')]+_0xb35c9a['limit'];var _0x3443d2;if(_0x2b3186>=_0x377382){_0x2b3186=_0x377382;_0x3443d2=0xc8;}else{_0x3443d2=0xce;}_0x199495[_0xfc50('0x17')](_0x3443d2);return _0x199495[_0xfc50('0x1e')](_0xfc50('0x1f'),_0x5a1e4b+'-'+_0x2b3186+'/'+_0x377382)[_0xfc50('0x19')](_0x2256be);}return null;};}function patchUpdates(_0x175e04){return function(_0x4bdb66){try{jsonpatch[_0xfc50('0x20')](_0x4bdb66,_0x175e04,!![]);}catch(_0x51c2c2){return BPromise[_0xfc50('0x21')](_0x51c2c2);}return _0x4bdb66[_0xfc50('0x22')]();};}function saveUpdates(_0x2db1e4,_0x2abaaa){return function(_0x1d4e66){if(_0x1d4e66){return _0x1d4e66[_0xfc50('0x23')](_0x2db1e4)[_0xfc50('0x24')](function(_0x2e08ba){return _0x2e08ba;});}return null;};}function removeEntity(_0x30457b,_0x43a8a6){return function(_0x37401d){if(_0x37401d){return _0x37401d[_0xfc50('0x25')]()[_0xfc50('0x24')](function(){var _0x15755c=_0x37401d[_0xfc50('0x26')]({'plain':!![]});var _0x5113c0=_0xfc50('0x27');return db[_0xfc50('0x28')][_0xfc50('0x25')]({'where':{'type':_0x5113c0,'resourceId':_0x15755c['id']}})['then'](function(){return _0x37401d;});})[_0xfc50('0x24')](function(){_0x30457b['status'](0xcc)[_0xfc50('0x18')]();});}};}function handleEntityNotFound(_0x1bf2a4,_0x3dec0d){return function(_0x1f4b4c){if(!_0x1f4b4c){_0x1bf2a4[_0xfc50('0x16')](0x194);}return _0x1f4b4c;};}function handleError(_0x2a66ec,_0x50fc93){_0x50fc93=_0x50fc93||0x1f4;return function(_0x3edb78){logger[_0xfc50('0x29')](_0x3edb78[_0xfc50('0x2a')]);if(_0x3edb78[_0xfc50('0x2b')]){delete _0x3edb78['name'];}_0x2a66ec[_0xfc50('0x17')](_0x50fc93)['send'](_0x3edb78);};}exports[_0xfc50('0x2c')]=function(_0x2edaa3,_0x5e6fda){var _0x4f3634={},_0x16bf20={},_0x467bce={'count':0x0,'rows':[]};var _0x4cb106=_['map'](db[_0xfc50('0x2d')][_0xfc50('0x2e')],function(_0x36f151){return{'name':_0x36f151[_0xfc50('0x2f')],'type':_0x36f151[_0xfc50('0x30')][_0xfc50('0x31')]};});_0x16bf20[_0xfc50('0x32')]=_[_0xfc50('0x33')](_0x4cb106,_0xfc50('0x2b'));_0x16bf20[_0xfc50('0x34')]=_['keys'](_0x2edaa3[_0xfc50('0x34')]);_0x16bf20['filters']=_[_0xfc50('0x35')](_0x16bf20['model'],_0x16bf20[_0xfc50('0x34')]);_0x4f3634[_0xfc50('0x36')]=_[_0xfc50('0x35')](_0x16bf20[_0xfc50('0x32')],qs['fields'](_0x2edaa3[_0xfc50('0x34')][_0xfc50('0x37')]));_0x4f3634[_0xfc50('0x36')]=_0x4f3634['attributes']['length']?_0x4f3634['attributes']:_0x16bf20[_0xfc50('0x32')];if(!_0x2edaa3['query'][_0xfc50('0x38')](_0xfc50('0x39'))){_0x4f3634[_0xfc50('0x1c')]=qs['limit'](_0x2edaa3[_0xfc50('0x34')]['limit']);_0x4f3634['offset']=qs[_0xfc50('0x1a')](_0x2edaa3[_0xfc50('0x34')][_0xfc50('0x1a')]);}_0x4f3634[_0xfc50('0x3a')]=qs['sort'](_0x2edaa3[_0xfc50('0x34')][_0xfc50('0x3b')]);_0x4f3634[_0xfc50('0x3c')]=qs[_0xfc50('0x3d')](_['pick'](_0x2edaa3[_0xfc50('0x34')],_0x16bf20['filters']),_0x4cb106);if(_0x2edaa3[_0xfc50('0x34')][_0xfc50('0x3e')]){_0x4f3634[_0xfc50('0x3c')]=_[_0xfc50('0x3f')](_0x4f3634[_0xfc50('0x3c')],{'$or':_[_0xfc50('0x33')](_0x4cb106,function(_0x28863e){if(_0x28863e[_0xfc50('0x30')]!==_0xfc50('0x40')){var _0x13f201={};_0x13f201[_0x28863e[_0xfc50('0x2b')]]={'$like':'%'+_0x2edaa3[_0xfc50('0x34')]['filter']+'%'};return _0x13f201;}})});}_0x4f3634=_[_0xfc50('0x3f')]({},_0x4f3634,_0x2edaa3[_0xfc50('0x41')]);var _0x32a701={'where':_0x4f3634['where']};return db[_0xfc50('0x2d')][_0xfc50('0x1d')](_0x32a701)[_0xfc50('0x24')](function(_0x64e608){_0x467bce[_0xfc50('0x1d')]=_0x64e608;if(_0x2edaa3[_0xfc50('0x34')]['includeAll']){_0x4f3634[_0xfc50('0x42')]=[{'all':!![]}];}return db['Variable'][_0xfc50('0x43')](_0x4f3634);})['then'](function(_0x2654c4){_0x467bce[_0xfc50('0x44')]=_0x2654c4;return _0x467bce;})['then'](respondWithFilteredResult(_0x5e6fda,_0x4f3634))[_0xfc50('0x45')](handleError(_0x5e6fda,null));};exports[_0xfc50('0x46')]=function(_0xaa49e1,_0x223793){var _0x5bf84c={'raw':!![],'where':{'id':_0xaa49e1[_0xfc50('0x47')]['id']}},_0x44e0cd={};_0x44e0cd[_0xfc50('0x32')]=_[_0xfc50('0x48')](db[_0xfc50('0x2d')]['rawAttributes']);_0x44e0cd[_0xfc50('0x34')]=_['keys'](_0xaa49e1['query']);_0x44e0cd['filters']=_['intersection'](_0x44e0cd[_0xfc50('0x32')],_0x44e0cd['query']);_0x5bf84c[_0xfc50('0x36')]=_['intersection'](_0x44e0cd[_0xfc50('0x32')],qs[_0xfc50('0x37')](_0xaa49e1[_0xfc50('0x34')][_0xfc50('0x37')]));_0x5bf84c[_0xfc50('0x36')]=_0x5bf84c[_0xfc50('0x36')][_0xfc50('0x49')]?_0x5bf84c['attributes']:_0x44e0cd[_0xfc50('0x32')];if(_0xaa49e1[_0xfc50('0x34')]['includeAll']){_0x5bf84c[_0xfc50('0x42')]=[{'all':!![]}];}_0x5bf84c=_[_0xfc50('0x3f')]({},_0x5bf84c,_0xaa49e1[_0xfc50('0x41')]);return db[_0xfc50('0x2d')][_0xfc50('0x4a')](_0x5bf84c)[_0xfc50('0x24')](handleEntityNotFound(_0x223793,null))[_0xfc50('0x24')](respondWithResult(_0x223793,null))[_0xfc50('0x45')](handleError(_0x223793,null));};exports[_0xfc50('0x4b')]=function(_0x18e3ad,_0x1fa9d1){return db[_0xfc50('0x2d')][_0xfc50('0x4b')](_0x18e3ad[_0xfc50('0x4c')],{})[_0xfc50('0x24')](function(_0x19a728){var _0x546476=_0x18e3ad[_0xfc50('0x4d')][_0xfc50('0x26')]({'plain':!![]});if(!_0x546476)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x546476['role']==='user'){var _0x35e6d1=_0x19a728[_0xfc50('0x26')]({'plain':!![]});var _0xe19c86=_0xfc50('0x27');return db[_0xfc50('0x4e')][_0xfc50('0x4a')]({'where':{'name':_0xe19c86,'userProfileId':_0x546476['userProfileId']},'raw':!![]})['then'](function(_0x2ea6ea){if(_0x2ea6ea&&_0x2ea6ea[_0xfc50('0x4f')]===0x0){return db['UserProfileResource']['create']({'name':_0x35e6d1['name'],'resourceId':_0x35e6d1['id'],'type':_0x2ea6ea[_0xfc50('0x2b')],'sectionId':_0x2ea6ea['id']},{})[_0xfc50('0x24')](function(){return _0x19a728;});}else{return _0x19a728;}})[_0xfc50('0x45')](function(_0x255a62){logger[_0xfc50('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x255a62);throw _0x255a62;});}return _0x19a728;})['then'](respondWithResult(_0x1fa9d1,0xc9))[_0xfc50('0x45')](handleError(_0x1fa9d1,null));};exports['update']=function(_0x2194c5,_0x28a903){if(_0x2194c5[_0xfc50('0x4c')]['id']){delete _0x2194c5[_0xfc50('0x4c')]['id'];}return db[_0xfc50('0x2d')]['find']({'where':{'id':_0x2194c5[_0xfc50('0x47')]['id']}})[_0xfc50('0x24')](handleEntityNotFound(_0x28a903,null))['then'](saveUpdates(_0x2194c5[_0xfc50('0x4c')],null))[_0xfc50('0x24')](respondWithResult(_0x28a903,null))[_0xfc50('0x45')](handleError(_0x28a903,null));};exports[_0xfc50('0x25')]=function(_0x43356e,_0x3368ab){return db[_0xfc50('0x2d')][_0xfc50('0x4a')]({'where':{'id':_0x43356e[_0xfc50('0x47')]['id']}})[_0xfc50('0x24')](handleEntityNotFound(_0x3368ab,null))[_0xfc50('0x24')](removeEntity(_0x3368ab,null))[_0xfc50('0x45')](handleError(_0x3368ab,null));}; \ No newline at end of file +var _0xd667=['lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','save','update','then','destroy','error','stack','name','map','Variable','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','order','sort','pick','filter','where','merge','options','includeAll','include','rows','catch','length','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Variables','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra'];(function(_0x526a39,_0x4d63f9){var _0x396733=function(_0x440f12){while(--_0x440f12){_0x526a39['push'](_0x526a39['shift']());}};_0x396733(++_0x4d63f9);}(_0xd667,0x94));var _0x7d66=function(_0x52c72f,_0x818765){_0x52c72f=_0x52c72f-0x0;var _0x3e0249=_0xd667[_0x52c72f];return _0x3e0249;};'use strict';var emlformat=require(_0x7d66('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7d66('0x1'));var jsonpatch=require(_0x7d66('0x2'));var rp=require(_0x7d66('0x3'));var moment=require(_0x7d66('0x4'));var BPromise=require(_0x7d66('0x5'));var Mustache=require(_0x7d66('0x6'));var util=require(_0x7d66('0x7'));var path=require(_0x7d66('0x8'));var sox=require('sox');var csv=require(_0x7d66('0x9'));var ejs=require(_0x7d66('0xa'));var fs=require('fs');var fs_extra=require(_0x7d66('0xb'));var _=require(_0x7d66('0xc'));var squel=require(_0x7d66('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x7d66('0xe'));var toCsv=require(_0x7d66('0x9'));var querystring=require('querystring');var Papa=require(_0x7d66('0xf'));var Redis=require(_0x7d66('0x10'));var authService=require(_0x7d66('0x11'));var qs=require(_0x7d66('0x12'));var as=require(_0x7d66('0x13'));var hardwareService=require(_0x7d66('0x14'));var logger=require(_0x7d66('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x7d66('0x16'));var licenseUtil=require(_0x7d66('0x17'));var db=require(_0x7d66('0x18'))['db'];function respondWithStatusCode(_0x580a2c,_0x3fcf7c){_0x3fcf7c=_0x3fcf7c||0xcc;return function(_0xdf2bc0){if(_0xdf2bc0){return _0x580a2c[_0x7d66('0x19')](_0x3fcf7c);}return _0x580a2c[_0x7d66('0x1a')](_0x3fcf7c)[_0x7d66('0x1b')]();};}function respondWithResult(_0x306510,_0x38686a){_0x38686a=_0x38686a||0xc8;return function(_0x57fe20){if(_0x57fe20){return _0x306510['status'](_0x38686a)['json'](_0x57fe20);}};}function respondWithFilteredResult(_0xd3a930,_0x77acd9){return function(_0x371066){if(_0x371066){var _0x5eae1a=typeof _0x77acd9[_0x7d66('0x1c')]===_0x7d66('0x1d')&&typeof _0x77acd9[_0x7d66('0x1e')]===_0x7d66('0x1d');var _0x476869=_0x371066[_0x7d66('0x1f')];var _0xaacfb4=_0x5eae1a?0x0:_0x77acd9[_0x7d66('0x1c')];var _0x54d54d=_0x5eae1a?_0x371066[_0x7d66('0x1f')]:_0x77acd9['offset']+_0x77acd9[_0x7d66('0x1e')];var _0x4a2537;if(_0x54d54d>=_0x476869){_0x54d54d=_0x476869;_0x4a2537=0xc8;}else{_0x4a2537=0xce;}_0xd3a930[_0x7d66('0x1a')](_0x4a2537);return _0xd3a930[_0x7d66('0x20')]('Content-Range',_0xaacfb4+'-'+_0x54d54d+'/'+_0x476869)[_0x7d66('0x21')](_0x371066);}return null;};}function patchUpdates(_0x2a85b7){return function(_0x1d0e3f){try{jsonpatch[_0x7d66('0x22')](_0x1d0e3f,_0x2a85b7,!![]);}catch(_0x2df9cb){return BPromise[_0x7d66('0x23')](_0x2df9cb);}return _0x1d0e3f[_0x7d66('0x24')]();};}function saveUpdates(_0x33ffaa,_0xe4b502){return function(_0x30886f){if(_0x30886f){return _0x30886f[_0x7d66('0x25')](_0x33ffaa)[_0x7d66('0x26')](function(_0x424327){return _0x424327;});}return null;};}function removeEntity(_0xe30628,_0xeaf1ec){return function(_0x4dd693){if(_0x4dd693){return _0x4dd693[_0x7d66('0x27')]()[_0x7d66('0x26')](function(){var _0x34fbfd=_0x4dd693['get']({'plain':!![]});var _0x1fe366='Variables';return db['UserProfileResource'][_0x7d66('0x27')]({'where':{'type':_0x1fe366,'resourceId':_0x34fbfd['id']}})[_0x7d66('0x26')](function(){return _0x4dd693;});})[_0x7d66('0x26')](function(){_0xe30628[_0x7d66('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45abf7,_0x27739c){return function(_0x49c9bb){if(!_0x49c9bb){_0x45abf7['sendStatus'](0x194);}return _0x49c9bb;};}function handleError(_0x40044f,_0x43b2d6){_0x43b2d6=_0x43b2d6||0x1f4;return function(_0x31d418){logger[_0x7d66('0x28')](_0x31d418[_0x7d66('0x29')]);if(_0x31d418[_0x7d66('0x2a')]){delete _0x31d418[_0x7d66('0x2a')];}_0x40044f[_0x7d66('0x1a')](_0x43b2d6)['send'](_0x31d418);};}exports['index']=function(_0x2f4db6,_0x840bc6){var _0x353c12={},_0x344bb3={},_0x2648ba={'count':0x0,'rows':[]};var _0x56fa8a=_[_0x7d66('0x2b')](db[_0x7d66('0x2c')][_0x7d66('0x2d')],function(_0x4242f9){return{'name':_0x4242f9[_0x7d66('0x2e')],'type':_0x4242f9[_0x7d66('0x2f')]['key']};});_0x344bb3[_0x7d66('0x30')]=_['map'](_0x56fa8a,_0x7d66('0x2a'));_0x344bb3[_0x7d66('0x31')]=_[_0x7d66('0x32')](_0x2f4db6[_0x7d66('0x31')]);_0x344bb3[_0x7d66('0x33')]=_['intersection'](_0x344bb3[_0x7d66('0x30')],_0x344bb3['query']);_0x353c12[_0x7d66('0x34')]=_[_0x7d66('0x35')](_0x344bb3[_0x7d66('0x30')],qs[_0x7d66('0x36')](_0x2f4db6['query'][_0x7d66('0x36')]));_0x353c12[_0x7d66('0x34')]=_0x353c12[_0x7d66('0x34')]['length']?_0x353c12[_0x7d66('0x34')]:_0x344bb3[_0x7d66('0x30')];if(!_0x2f4db6['query'][_0x7d66('0x37')]('nolimit')){_0x353c12['limit']=qs[_0x7d66('0x1e')](_0x2f4db6[_0x7d66('0x31')][_0x7d66('0x1e')]);_0x353c12[_0x7d66('0x1c')]=qs[_0x7d66('0x1c')](_0x2f4db6[_0x7d66('0x31')][_0x7d66('0x1c')]);}_0x353c12[_0x7d66('0x38')]=qs[_0x7d66('0x39')](_0x2f4db6[_0x7d66('0x31')][_0x7d66('0x39')]);_0x353c12['where']=qs[_0x7d66('0x33')](_[_0x7d66('0x3a')](_0x2f4db6['query'],_0x344bb3['filters']),_0x56fa8a);if(_0x2f4db6[_0x7d66('0x31')][_0x7d66('0x3b')]){_0x353c12[_0x7d66('0x3c')]=_[_0x7d66('0x3d')](_0x353c12['where'],{'$or':_[_0x7d66('0x2b')](_0x56fa8a,function(_0x67ac58){if(_0x67ac58[_0x7d66('0x2f')]!=='VIRTUAL'){var _0x2e6fd8={};_0x2e6fd8[_0x67ac58['name']]={'$like':'%'+_0x2f4db6[_0x7d66('0x31')][_0x7d66('0x3b')]+'%'};return _0x2e6fd8;}})});}_0x353c12=_[_0x7d66('0x3d')]({},_0x353c12,_0x2f4db6[_0x7d66('0x3e')]);var _0x32adf1={'where':_0x353c12[_0x7d66('0x3c')]};return db[_0x7d66('0x2c')][_0x7d66('0x1f')](_0x32adf1)[_0x7d66('0x26')](function(_0x3b4eee){_0x2648ba['count']=_0x3b4eee;if(_0x2f4db6[_0x7d66('0x31')][_0x7d66('0x3f')]){_0x353c12[_0x7d66('0x40')]=[{'all':!![]}];}return db[_0x7d66('0x2c')]['findAll'](_0x353c12);})[_0x7d66('0x26')](function(_0x29a1d8){_0x2648ba[_0x7d66('0x41')]=_0x29a1d8;return _0x2648ba;})[_0x7d66('0x26')](respondWithFilteredResult(_0x840bc6,_0x353c12))[_0x7d66('0x42')](handleError(_0x840bc6,null));};exports['show']=function(_0x3f24b2,_0x5b6dd1){var _0x405c16={'raw':!![],'where':{'id':_0x3f24b2['params']['id']}},_0x982a0={};_0x982a0[_0x7d66('0x30')]=_[_0x7d66('0x32')](db[_0x7d66('0x2c')]['rawAttributes']);_0x982a0[_0x7d66('0x31')]=_[_0x7d66('0x32')](_0x3f24b2[_0x7d66('0x31')]);_0x982a0['filters']=_[_0x7d66('0x35')](_0x982a0[_0x7d66('0x30')],_0x982a0[_0x7d66('0x31')]);_0x405c16[_0x7d66('0x34')]=_[_0x7d66('0x35')](_0x982a0[_0x7d66('0x30')],qs['fields'](_0x3f24b2['query']['fields']));_0x405c16[_0x7d66('0x34')]=_0x405c16[_0x7d66('0x34')][_0x7d66('0x43')]?_0x405c16[_0x7d66('0x34')]:_0x982a0[_0x7d66('0x30')];if(_0x3f24b2['query']['includeAll']){_0x405c16[_0x7d66('0x40')]=[{'all':!![]}];}_0x405c16=_[_0x7d66('0x3d')]({},_0x405c16,_0x3f24b2[_0x7d66('0x3e')]);return db[_0x7d66('0x2c')][_0x7d66('0x44')](_0x405c16)[_0x7d66('0x26')](handleEntityNotFound(_0x5b6dd1,null))['then'](respondWithResult(_0x5b6dd1,null))['catch'](handleError(_0x5b6dd1,null));};exports[_0x7d66('0x45')]=function(_0x3cf7d1,_0x54b70){return db[_0x7d66('0x2c')][_0x7d66('0x45')](_0x3cf7d1['body'],{})[_0x7d66('0x26')](function(_0xf6c24f){var _0x3758fd=_0x3cf7d1[_0x7d66('0x46')][_0x7d66('0x47')]({'plain':!![]});if(!_0x3758fd)throw new Error(_0x7d66('0x48'));if(_0x3758fd[_0x7d66('0x49')]===_0x7d66('0x46')){var _0x754b57=_0xf6c24f[_0x7d66('0x47')]({'plain':!![]});var _0x363b82=_0x7d66('0x4a');return db[_0x7d66('0x4b')][_0x7d66('0x44')]({'where':{'name':_0x363b82,'userProfileId':_0x3758fd[_0x7d66('0x4c')]},'raw':!![]})['then'](function(_0x4f74a3){if(_0x4f74a3&&_0x4f74a3[_0x7d66('0x4d')]===0x0){return db['UserProfileResource'][_0x7d66('0x45')]({'name':_0x754b57[_0x7d66('0x2a')],'resourceId':_0x754b57['id'],'type':_0x4f74a3['name'],'sectionId':_0x4f74a3['id']},{})['then'](function(){return _0xf6c24f;});}else{return _0xf6c24f;}})[_0x7d66('0x42')](function(_0x5a198a){logger[_0x7d66('0x28')](_0x7d66('0x4e'),_0x5a198a);throw _0x5a198a;});}return _0xf6c24f;})[_0x7d66('0x26')](respondWithResult(_0x54b70,0xc9))['catch'](handleError(_0x54b70,null));};exports[_0x7d66('0x25')]=function(_0x3cb9c1,_0x189530){if(_0x3cb9c1[_0x7d66('0x4f')]['id']){delete _0x3cb9c1[_0x7d66('0x4f')]['id'];}return db[_0x7d66('0x2c')][_0x7d66('0x44')]({'where':{'id':_0x3cb9c1['params']['id']}})['then'](handleEntityNotFound(_0x189530,null))['then'](saveUpdates(_0x3cb9c1[_0x7d66('0x4f')],null))[_0x7d66('0x26')](respondWithResult(_0x189530,null))[_0x7d66('0x42')](handleError(_0x189530,null));};exports['destroy']=function(_0x3e81d7,_0x343871){return db[_0x7d66('0x2c')]['find']({'where':{'id':_0x3e81d7['params']['id']}})[_0x7d66('0x26')](handleEntityNotFound(_0x343871,null))['then'](removeEntity(_0x343871,null))[_0x7d66('0x42')](handleError(_0x343871,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index dd0b248..44c5fb7 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 _0xc310=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./variable.attributes','define','Variable','tools_variables','lodash','util','../../config/logger'];(function(_0x2ce733,_0x1a2ea2){var _0x31dc08=function(_0x15fbee){while(--_0x15fbee){_0x2ce733['push'](_0x2ce733['shift']());}};_0x31dc08(++_0x1a2ea2);}(_0xc310,0x169));var _0x0c31=function(_0x238a90,_0x15feda){_0x238a90=_0x238a90-0x0;var _0x3534ad=_0xc310[_0x238a90];return _0x3534ad;};'use strict';var _=require(_0x0c31('0x0'));var util=require(_0x0c31('0x1'));var logger=require(_0x0c31('0x2'))('api');var moment=require(_0x0c31('0x3'));var BPromise=require(_0x0c31('0x4'));var rp=require(_0x0c31('0x5'));var fs=require('fs');var path=require(_0x0c31('0x6'));var rimraf=require(_0x0c31('0x7'));var config=require(_0x0c31('0x8'));var attributes=require(_0x0c31('0x9'));module['exports']=function(_0x485207,_0xe9dce2){return _0x485207[_0x0c31('0xa')](_0x0c31('0xb'),attributes,{'tableName':_0x0c31('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8234=['tools_variables','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment','./variable.attributes','define','Variable'];(function(_0x48cac8,_0x150d03){var _0x539232=function(_0x2fe472){while(--_0x2fe472){_0x48cac8['push'](_0x48cac8['shift']());}};_0x539232(++_0x150d03);}(_0x8234,0x198));var _0x4823=function(_0xdf4058,_0x3d913d){_0xdf4058=_0xdf4058-0x0;var _0x141888=_0x8234[_0xdf4058];return _0x141888;};'use strict';var _=require(_0x4823('0x0'));var util=require(_0x4823('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x4823('0x2'));var rp=require(_0x4823('0x3'));var fs=require('fs');var path=require(_0x4823('0x4'));var rimraf=require(_0x4823('0x5'));var config=require(_0x4823('0x6'));var attributes=require(_0x4823('0x7'));module['exports']=function(_0x3ebb91,_0x284f01){return _0x3ebb91[_0x4823('0x8')](_0x4823('0x9'),attributes,{'tableName':_0x4823('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 5dba5df..c65d7f2 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 _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(_0x560250,_0x2a24f5){var _0x55e2e1=function(_0x2dba93){while(--_0x2dba93){_0x560250['push'](_0x560250['shift']());}};_0x55e2e1(++_0x2a24f5);}(_0x5fc3,0xa8));var _0x35fc=function(_0x221ba2,_0x79208){_0x221ba2=_0x221ba2-0x0;var _0x47d08e=_0x5fc3[_0x221ba2];return _0x47d08e;};'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 +var _0x55ca=['options','where','attributes','include','map','model','lodash','util','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','ShowVariable','Variable','find'];(function(_0x39da12,_0x2365e3){var _0x3c68a3=function(_0x464264){while(--_0x464264){_0x39da12['push'](_0x39da12['shift']());}};_0x3c68a3(++_0x2365e3);}(_0x55ca,0x126));var _0xa55c=function(_0x51539c,_0x25f587){_0x51539c=_0x51539c-0x0;var _0x4f7914=_0x55ca[_0x51539c];return _0x4f7914;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa55c('0x2'));var db=require(_0xa55c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa55c('0x4'))(_0xa55c('0x5'));var config=require(_0xa55c('0x6'));var jayson=require(_0xa55c('0x7'));var client=jayson[_0xa55c('0x8')][_0xa55c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x36b623,_0x4d0624,_0x2121fd){return new BPromise(function(_0x2537f0,_0x57e069){return client[_0xa55c('0xa')](_0x36b623,_0x2121fd)[_0xa55c('0xb')](function(_0x52a3bc){logger['info'](_0xa55c('0xc'),_0x4d0624,_0xa55c('0xd'));logger[_0xa55c('0xe')](_0xa55c('0xf'),_0x4d0624,_0xa55c('0xd'),JSON[_0xa55c('0x10')](_0x52a3bc));if(_0x52a3bc[_0xa55c('0x11')]){if(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x12')]===0x1f4){logger[_0xa55c('0x11')]('Variable,\x20%s,\x20%s',_0x4d0624,_0x52a3bc['error'][_0xa55c('0x13')]);return _0x57e069(_0x52a3bc['error']['message']);}logger['error'](_0xa55c('0xc'),_0x4d0624,_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);return _0x2537f0(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);}else{logger[_0xa55c('0x14')]('Variable,\x20%s,\x20%s',_0x4d0624,_0xa55c('0xd'));_0x2537f0(_0x52a3bc[_0xa55c('0x15')][_0xa55c('0x13')]);}})[_0xa55c('0x16')](function(_0x1c4cfd){logger[_0xa55c('0x11')](_0xa55c('0xc'),_0x4d0624,_0x1c4cfd);_0x57e069(_0x1c4cfd);});});}exports[_0xa55c('0x17')]=function(_0x24783b){var _0x4cee3c=this;return new Promise(function(_0x3d4c9e,_0x104a99){return db[_0xa55c('0x18')][_0xa55c('0x19')]({'raw':_0x24783b[_0xa55c('0x1a')]?_0x24783b[_0xa55c('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x24783b['options']?_0x24783b[_0xa55c('0x1a')][_0xa55c('0x1b')]||null:null,'attributes':_0x24783b[_0xa55c('0x1a')]?_0x24783b['options'][_0xa55c('0x1c')]||null:null,'include':_0x24783b[_0xa55c('0x1a')]?_0x24783b['options'][_0xa55c('0x1d')]?_[_0xa55c('0x1e')](_0x24783b[_0xa55c('0x1a')][_0xa55c('0x1d')],function(_0x234372){return{'model':db[_0x234372['model']],'as':_0x234372['as'],'attributes':_0x234372[_0xa55c('0x1c')],'include':_0x234372['include']?_['map'](_0x234372['include'],function(_0x19ae88){return{'model':db[_0x19ae88['model']],'as':_0x19ae88['as'],'attributes':_0x19ae88[_0xa55c('0x1c')],'include':_0x19ae88[_0xa55c('0x1d')]?_[_0xa55c('0x1e')](_0x19ae88[_0xa55c('0x1d')],function(_0x2313a9){return{'model':db[_0x2313a9[_0xa55c('0x1f')]],'as':_0x2313a9['as'],'attributes':_0x2313a9[_0xa55c('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa55c('0xb')](function(_0x192df2){logger[_0xa55c('0x14')](_0xa55c('0x17'),_0x24783b);logger['debug'](_0xa55c('0x17'),_0x24783b,JSON[_0xa55c('0x10')](_0x192df2));_0x3d4c9e(_0x192df2);})[_0xa55c('0x16')](function(_0x906caa){logger['error'](_0xa55c('0x17'),_0x906caa[_0xa55c('0x13')],_0x24783b);_0x104a99(_0x4cee3c[_0xa55c('0x11')](0x1f4,_0x906caa[_0xa55c('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index e5a5f6f..a96659c 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 _0xc8d3=['../../components/auth/service','./version.controller','get','/fetch','isAuthenticated','fetch','canUpdate','reset','/pull','/restart','/migrations','migrations','exports','express','Router'];(function(_0x8631d,_0x3aba89){var _0x10d9d0=function(_0x353936){while(--_0x353936){_0x8631d['push'](_0x8631d['shift']());}};_0x10d9d0(++_0x3aba89);}(_0xc8d3,0xfd));var _0x3c8d=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0xc8d3[_0x273c39];return _0x46d6b5;};'use strict';var express=require(_0x3c8d('0x0'));var router=express[_0x3c8d('0x1')]();var auth=require(_0x3c8d('0x2'));var controller=require(_0x3c8d('0x3'));router[_0x3c8d('0x4')]('/',controller['index']);router[_0x3c8d('0x4')](_0x3c8d('0x5'),auth[_0x3c8d('0x6')](),auth['canUpdate'](),controller[_0x3c8d('0x7')]);router['get']('/reset',auth[_0x3c8d('0x6')](),auth[_0x3c8d('0x8')](),controller[_0x3c8d('0x9')]);router[_0x3c8d('0x4')](_0x3c8d('0xa'),auth[_0x3c8d('0x6')](),auth['canUpdate'](),controller['pull']);router[_0x3c8d('0x4')](_0x3c8d('0xb'),auth['isAuthenticated'](),controller['restart']);router[_0x3c8d('0x4')](_0x3c8d('0xc'),controller[_0x3c8d('0xd')]);module[_0x3c8d('0xe')]=router; \ No newline at end of file +var _0xea2e=['fetch','get','reset','/pull','pull','restart','/migrations','migrations','exports','./version.controller','index','/fetch','isAuthenticated','canUpdate'];(function(_0x39f119,_0xc67edd){var _0x36d66c=function(_0x55b146){while(--_0x55b146){_0x39f119['push'](_0x39f119['shift']());}};_0x36d66c(++_0xc67edd);}(_0xea2e,0x1d7));var _0xeea2=function(_0x262006,_0xc16061){_0x262006=_0x262006-0x0;var _0x9b2b5e=_0xea2e[_0x262006];return _0x9b2b5e;};'use strict';var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0xeea2('0x0'));router['get']('/',controller[_0xeea2('0x1')]);router['get'](_0xeea2('0x2'),auth[_0xeea2('0x3')](),auth[_0xeea2('0x4')](),controller[_0xeea2('0x5')]);router[_0xeea2('0x6')]('/reset',auth[_0xeea2('0x3')](),auth[_0xeea2('0x4')](),controller[_0xeea2('0x7')]);router['get'](_0xeea2('0x8'),auth[_0xeea2('0x3')](),auth['canUpdate'](),controller[_0xeea2('0x9')]);router[_0xeea2('0x6')]('/restart',auth['isAuthenticated'](),controller[_0xeea2('0xa')]);router[_0xeea2('0x6')](_0xeea2('0xb'),controller[_0xeea2('0xc')]);module[_0xeea2('0xd')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 4ac86f1..1726df9 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 _0x6a32=['Migration','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','catch','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','pkginfo','version','compare-versions','child_process','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','update','index','exports','query','latest','fetch','tags','status','json','origin','master','error','info','git\x20fetch','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','migrations','readdirSync','join','root','server','length','replace','.js','push','sort','sequelize'];(function(_0x15e527,_0x251882){var _0x205f1c=function(_0x105dcd){while(--_0x105dcd){_0x15e527['push'](_0x15e527['shift']());}};_0x205f1c(++_0x251882);}(_0x6a32,0x127));var _0x26a3=function(_0x159663,_0x222e4d){_0x159663=_0x159663-0x0;var _0x39d088=_0x6a32[_0x159663];return _0x39d088;};'use strict';var Umzug=require(_0x26a3('0x0'));var path=require(_0x26a3('0x1'));var fs=require('fs');var _=require('lodash');var pkginfo=require(_0x26a3('0x2'))(module,_0x26a3('0x3'));var compareVersions=require(_0x26a3('0x4'));var exec=require(_0x26a3('0x5'))['exec'];var db=require(_0x26a3('0x6'))['db'];var config=require(_0x26a3('0x7'));var pm2=require(_0x26a3('0x8'));var logger=require(_0x26a3('0x9'))(_0x26a3('0xa'));var git=require('simple-git')(config['root']);exports[_0x26a3('0xb')]=function(_0x4c96d1,_0x445d80){var _0x32cb40={'current':module[_0x26a3('0xc')][_0x26a3('0x3')],'phonebar':0x2};if(_0x4c96d1[_0x26a3('0xd')]&&_0x4c96d1[_0x26a3('0xd')][_0x26a3('0xe')]){return git[_0x26a3('0xf')]()[_0x26a3('0x10')](function(_0x280214,_0x1dfa8c){_0x32cb40[_0x26a3('0xe')]=(_0x280214?module[_0x26a3('0xc')]['version']:_0x1dfa8c['latest'])||'2.0.0';return _0x445d80[_0x26a3('0x11')](0xc8)[_0x26a3('0x12')](_0x32cb40);});}else{return _0x445d80[_0x26a3('0x11')](0xc8)[_0x26a3('0x12')](_0x32cb40);}};exports[_0x26a3('0xf')]=function(_0x3456ac,_0x511d1e){return git[_0x26a3('0xf')]([_0x26a3('0x13'),_0x26a3('0x14')],function(_0x33c34d){if(_0x33c34d){logger[_0x26a3('0x15')](_0x33c34d);return _0x511d1e[_0x26a3('0x11')](0x1f4)[_0x26a3('0x12')](_0x33c34d);}logger[_0x26a3('0x16')](_0x26a3('0x17'));return _0x511d1e[_0x26a3('0x11')](0xc8)[_0x26a3('0x12')]({'output':'git\x20fetch\x20origin\x20master'});});};exports[_0x26a3('0x18')]=function(_0x2b4028,_0x57f0fb){return git['reset']([_0x26a3('0x19'),_0x26a3('0x1a')],function(_0x12d64f){if(_0x12d64f){logger[_0x26a3('0x15')](_0x12d64f);return _0x57f0fb[_0x26a3('0x11')](0x1f4)[_0x26a3('0x12')](_0x12d64f);}logger[_0x26a3('0x16')](_0x26a3('0x1b'));return _0x57f0fb[_0x26a3('0x11')](0xc8)[_0x26a3('0x12')]({'output':_0x26a3('0x1c')});});};exports[_0x26a3('0x1d')]=function(_0x1a80e4,_0x3f2e8c){exec(_0x26a3('0x1e'),function(_0x5e8ea7,_0x21fd3b,_0x34b218){logger[_0x26a3('0x16')](_0x21fd3b);logger[_0x26a3('0x16')](_0x34b218);if(_0x5e8ea7){logger[_0x26a3('0x15')](_0x5e8ea7);return _0x3f2e8c['status'](0x1f4)[_0x26a3('0x12')](_0x5e8ea7);}return _0x3f2e8c['status'](0xc8)['json']({'output':_0x21fd3b});});};exports[_0x26a3('0x1f')]=function(_0x56173e,_0x25758c){return pm2['restart'](_0x26a3('0x20'))[_0x26a3('0x21')](function(_0x18932f){logger[_0x26a3('0x16')](_0x26a3('0x22'),_0x18932f);return _0x25758c['status'](0xc8)[_0x26a3('0x12')]({'output':_0x26a3('0x23')});})['catch'](function(_0x4cc67a){logger[_0x26a3('0x15')](_0x4cc67a);return _0x25758c['status'](0x1f4)[_0x26a3('0x12')](_0x4cc67a);});};exports[_0x26a3('0x24')]=function(_0x29254c,_0x3b8fe8){var _0x3fdc97=fs[_0x26a3('0x25')](path[_0x26a3('0x26')](config[_0x26a3('0x27')],_0x26a3('0x28'),_0x26a3('0x24')));var _0x253d1d=[];for(var _0x53f7a8=0x0;_0x53f7a8<_0x3fdc97[_0x26a3('0x29')];_0x53f7a8++){var _0xe7dcef=_0x3fdc97[_0x53f7a8][_0x26a3('0x2a')](_0x26a3('0x2b'),'');if(compareVersions(module[_0x26a3('0xc')]['version'],_0xe7dcef)===-0x1){_0x253d1d[_0x26a3('0x2c')](_0xe7dcef);}}if(_0x253d1d[_0x26a3('0x29')]){var _0xddda20=_0x253d1d[_0x26a3('0x2d')](compareVersions);var _0x508f75=new Umzug({'storage':_0x26a3('0x2e'),'storageOptions':{'model':db[_0x26a3('0x2f')],'modelName':_0x26a3('0x2f'),'columnName':_0x26a3('0x3')},'migrations':{'params':[db[_0x26a3('0x2e')]['getQueryInterface'](),db['sequelize'][_0x26a3('0x30')],function(){throw new Error(_0x26a3('0x31'));}],'path':path[_0x26a3('0x26')](config[_0x26a3('0x27')],_0x26a3('0x28'),_0x26a3('0x24')),'pattern':/\.js$/}});_0x508f75['up']({'migrations':_[_0x26a3('0x32')](_0xddda20,function(_0x5a3b0f){return _0x5a3b0f+'.js';})})[_0x26a3('0x21')](function(){return _0x3b8fe8['status'](0xc8)[_0x26a3('0x12')]({'output':_0x26a3('0x33')+module[_0x26a3('0xc')][_0x26a3('0x3')]+_0x26a3('0x34')+_[_0x26a3('0x35')](_0xddda20),'migrations':_['join'](_0xddda20)});})[_0x26a3('0x36')](function(_0x335e3c){if(_0x335e3c instanceof db[_0x26a3('0x2e')][_0x26a3('0x37')]){return _0x3b8fe8['status'](0xc8)['json']({'output':_0x26a3('0x38')});}else{return _0x3b8fe8[_0x26a3('0x11')](0x1f4)['json'](_0x335e3c);}});}else{return _0x3b8fe8[_0x26a3('0x11')](0xc8)[_0x26a3('0x12')]({'output':_0x26a3('0x38')});}}; \ No newline at end of file +var _0x5839=['version','compare-versions','child_process','exec','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','simple-git','root','index','exports','fetch','tags','latest','origin','master','error','status','json','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','pull','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','server','length','.js','sort','sequelize','Migration','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','Database\x20already\x20up-to-date','umzug','path','lodash'];(function(_0x24cd9e,_0x294c4b){var _0x3f4b98=function(_0xcfdb9c){while(--_0xcfdb9c){_0x24cd9e['push'](_0x24cd9e['shift']());}};_0x3f4b98(++_0x294c4b);}(_0x5839,0x1d1));var _0x9583=function(_0x177d06,_0x16308d){_0x177d06=_0x177d06-0x0;var _0x4f7e1d=_0x5839[_0x177d06];return _0x4f7e1d;};'use strict';var Umzug=require(_0x9583('0x0'));var path=require(_0x9583('0x1'));var fs=require('fs');var _=require(_0x9583('0x2'));var pkginfo=require('pkginfo')(module,_0x9583('0x3'));var compareVersions=require(_0x9583('0x4'));var exec=require(_0x9583('0x5'))[_0x9583('0x6')];var db=require(_0x9583('0x7'))['db'];var config=require(_0x9583('0x8'));var pm2=require(_0x9583('0x9'));var logger=require(_0x9583('0xa'))('update');var git=require(_0x9583('0xb'))(config[_0x9583('0xc')]);exports[_0x9583('0xd')]=function(_0x220737,_0x76948c){var _0x50194e={'current':module[_0x9583('0xe')][_0x9583('0x3')],'phonebar':0x2};if(_0x220737['query']&&_0x220737['query']['latest']){return git[_0x9583('0xf')]()[_0x9583('0x10')](function(_0x2bab99,_0x252e61){_0x50194e[_0x9583('0x11')]=(_0x2bab99?module[_0x9583('0xe')]['version']:_0x252e61['latest'])||'2.0.0';return _0x76948c['status'](0xc8)['json'](_0x50194e);});}else{return _0x76948c['status'](0xc8)['json'](_0x50194e);}};exports['fetch']=function(_0x460abd,_0xdda6dd){return git['fetch']([_0x9583('0x12'),_0x9583('0x13')],function(_0x142656){if(_0x142656){logger[_0x9583('0x14')](_0x142656);return _0xdda6dd[_0x9583('0x15')](0x1f4)[_0x9583('0x16')](_0x142656);}logger[_0x9583('0x17')](_0x9583('0x18'));return _0xdda6dd[_0x9583('0x15')](0xc8)['json']({'output':_0x9583('0x19')});});};exports[_0x9583('0x1a')]=function(_0x4c4675,_0x20416e){return git[_0x9583('0x1a')]([_0x9583('0x1b'),_0x9583('0x1c')],function(_0x143360){if(_0x143360){logger[_0x9583('0x14')](_0x143360);return _0x20416e[_0x9583('0x15')](0x1f4)[_0x9583('0x16')](_0x143360);}logger[_0x9583('0x17')](_0x9583('0x1d'));return _0x20416e[_0x9583('0x15')](0xc8)[_0x9583('0x16')]({'output':'git\x20reset\x20--hard'});});};exports[_0x9583('0x1e')]=function(_0x3bbc3b,_0x4dc5c2){exec('npm\x20install\x20--production',function(_0x1e9a08,_0x3d92df,_0x10ec56){logger['info'](_0x3d92df);logger[_0x9583('0x17')](_0x10ec56);if(_0x1e9a08){logger[_0x9583('0x14')](_0x1e9a08);return _0x4dc5c2[_0x9583('0x15')](0x1f4)[_0x9583('0x16')](_0x1e9a08);}return _0x4dc5c2[_0x9583('0x15')](0xc8)[_0x9583('0x16')]({'output':_0x3d92df});});};exports[_0x9583('0x1f')]=function(_0x2c06e2,_0x358dab){return pm2[_0x9583('0x1f')](_0x9583('0x20'))[_0x9583('0x21')](function(_0xc56634){logger['info'](_0x9583('0x22'),_0xc56634);return _0x358dab['status'](0xc8)[_0x9583('0x16')]({'output':_0x9583('0x23')});})[_0x9583('0x24')](function(_0x447b9b){logger[_0x9583('0x14')](_0x447b9b);return _0x358dab[_0x9583('0x15')](0x1f4)[_0x9583('0x16')](_0x447b9b);});};exports[_0x9583('0x25')]=function(_0x3720a7,_0x45f528){var _0x3035b8=fs['readdirSync'](path['join'](config['root'],_0x9583('0x26'),'migrations'));var _0x5eaf83=[];for(var _0x35f906=0x0;_0x35f906<_0x3035b8[_0x9583('0x27')];_0x35f906++){var _0x36d453=_0x3035b8[_0x35f906]['replace'](_0x9583('0x28'),'');if(compareVersions(module[_0x9583('0xe')][_0x9583('0x3')],_0x36d453)===-0x1){_0x5eaf83['push'](_0x36d453);}}if(_0x5eaf83[_0x9583('0x27')]){var _0x1da543=_0x5eaf83[_0x9583('0x29')](compareVersions);var _0x227d25=new Umzug({'storage':_0x9583('0x2a'),'storageOptions':{'model':db[_0x9583('0x2b')],'modelName':_0x9583('0x2b'),'columnName':_0x9583('0x3')},'migrations':{'params':[db[_0x9583('0x2a')][_0x9583('0x2c')](),db['sequelize'][_0x9583('0x2d')],function(){throw new Error(_0x9583('0x2e'));}],'path':path['join'](config['root'],'server',_0x9583('0x25')),'pattern':/\.js$/}});_0x227d25['up']({'migrations':_[_0x9583('0x2f')](_0x1da543,function(_0x113fda){return _0x113fda+'.js';})})[_0x9583('0x21')](function(){return _0x45f528[_0x9583('0x15')](0xc8)[_0x9583('0x16')]({'output':_0x9583('0x30')+module['exports'][_0x9583('0x3')]+_0x9583('0x31')+_[_0x9583('0x32')](_0x1da543),'migrations':_['join'](_0x1da543)});})[_0x9583('0x24')](function(_0x6eff79){if(_0x6eff79 instanceof db['sequelize']['UniqueConstraintError']){return _0x45f528['status'](0xc8)['json']({'output':_0x9583('0x33')});}else{return _0x45f528[_0x9583('0x15')](0x1f4)[_0x9583('0x16')](_0x6eff79);}});}else{return _0x45f528['status'](0xc8)[_0x9583('0x16')]({'output':_0x9583('0x33')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 3fdec91..dd98fe6 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 _0x317c=['/:id','post','create','put','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','index','/describe','isAuthenticated','describe'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x317c,0xed));var _0xc317=function(_0x4aed95,_0x5b2383){_0x4aed95=_0x4aed95-0x0;var _0x76a29b=_0x317c[_0x4aed95];return _0x76a29b;};'use strict';var multer=require(_0xc317('0x0'));var util=require(_0xc317('0x1'));var path=require(_0xc317('0x2'));var timeout=require(_0xc317('0x3'));var express=require('express');var router=express[_0xc317('0x4')]();var fs_extra=require(_0xc317('0x5'));var auth=require(_0xc317('0x6'));var interaction=require(_0xc317('0x7'));var config=require(_0xc317('0x8'));var controller=require(_0xc317('0x9'));router[_0xc317('0xa')]('/',auth['isAuthenticated'](),controller[_0xc317('0xb')]);router[_0xc317('0xa')](_0xc317('0xc'),auth[_0xc317('0xd')](),controller[_0xc317('0xe')]);router[_0xc317('0xa')](_0xc317('0xf'),auth['isAuthenticated'](),controller['show']);router[_0xc317('0x10')]('/',auth[_0xc317('0xd')](),controller[_0xc317('0x11')]);router[_0xc317('0x12')]('/:id',auth[_0xc317('0xd')](),controller['update']);router[_0xc317('0x13')](_0xc317('0xf'),auth['isAuthenticated'](),controller[_0xc317('0x14')]);module['exports']=router; \ No newline at end of file +var _0x9fd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceAgentReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer'];(function(_0x2aa0e7,_0x4e5145){var _0x1472c0=function(_0x4deaeb){while(--_0x4deaeb){_0x2aa0e7['push'](_0x2aa0e7['shift']());}};_0x1472c0(++_0x4e5145);}(_0x9fd9,0x1af));var _0x99fd=function(_0x5cfc1e,_0x13a37c){_0x5cfc1e=_0x5cfc1e-0x0;var _0x44c04d=_0x9fd9[_0x5cfc1e];return _0x44c04d;};'use strict';var multer=require(_0x99fd('0x0'));var util=require(_0x99fd('0x1'));var path=require(_0x99fd('0x2'));var timeout=require(_0x99fd('0x3'));var express=require(_0x99fd('0x4'));var router=express[_0x99fd('0x5')]();var fs_extra=require(_0x99fd('0x6'));var auth=require(_0x99fd('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x99fd('0x8'));var controller=require(_0x99fd('0x9'));router['get']('/',auth[_0x99fd('0xa')](),controller[_0x99fd('0xb')]);router[_0x99fd('0xc')](_0x99fd('0xd'),auth[_0x99fd('0xa')](),controller[_0x99fd('0xe')]);router[_0x99fd('0xc')](_0x99fd('0xf'),auth[_0x99fd('0xa')](),controller[_0x99fd('0x10')]);router[_0x99fd('0x11')]('/',auth[_0x99fd('0xa')](),controller[_0x99fd('0x12')]);router[_0x99fd('0x13')](_0x99fd('0xf'),auth[_0x99fd('0xa')](),controller[_0x99fd('0x14')]);router[_0x99fd('0x15')]('/:id',auth[_0x99fd('0xa')](),controller[_0x99fd('0x16')]);module[_0x99fd('0x17')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 6222b08..7f472da 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 _0xb5fb=['exports','STRING','DATE','BOOLEAN','INTEGER','FORWARD,\x20BLIND,\x20ATTENDED','sequelize'];(function(_0x7b027b,_0x2f36eb){var _0x2d52b1=function(_0x16cee3){while(--_0x16cee3){_0x7b027b['push'](_0x7b027b['shift']());}};_0x2d52b1(++_0x2f36eb);}(_0xb5fb,0x172));var _0xbb5f=function(_0x2eaf4d,_0x2a3aac){_0x2eaf4d=_0x2eaf4d-0x0;var _0x2bd85e=_0xb5fb[_0x2eaf4d];return _0x2bd85e;};'use strict';var Sequelize=require(_0xbb5f('0x0'));module[_0xbb5f('0x1')]={'type':{'type':Sequelize[_0xbb5f('0x2')]},'uniqueid':{'type':Sequelize[_0xbb5f('0x2')]},'calleridnum':{'type':Sequelize[_0xbb5f('0x2')]},'calleridname':{'type':Sequelize[_0xbb5f('0x2')]},'queue':{'type':Sequelize[_0xbb5f('0x2')]},'interface':{'type':Sequelize[_0xbb5f('0x2')]},'membername':{'type':Sequelize[_0xbb5f('0x2')]},'agentcalledAt':{'type':Sequelize[_0xbb5f('0x3')]},'agentconnectAt':{'type':Sequelize[_0xbb5f('0x3')]},'agentcompleteAt':{'type':Sequelize[_0xbb5f('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0xbb5f('0x3')]},'agentdumpAt':{'type':Sequelize[_0xbb5f('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xbb5f('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize[_0xbb5f('0x5')]},'agentacw':{'type':Sequelize[_0xbb5f('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize[_0xbb5f('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0xbb5f('0x5')]},'channelstatedesc':{'type':Sequelize[_0xbb5f('0x2')]},'connectedlinenum':{'type':Sequelize[_0xbb5f('0x2')]},'connectedlinename':{'type':Sequelize[_0xbb5f('0x2')]},'language':{'type':Sequelize[_0xbb5f('0x2')]},'accountcode':{'type':Sequelize[_0xbb5f('0x2')]},'context':{'type':Sequelize[_0xbb5f('0x2')]},'exten':{'type':Sequelize[_0xbb5f('0x2')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xbb5f('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xbb5f('0x2')]},'destcalleridnum':{'type':Sequelize[_0xbb5f('0x2')]},'destcalleridname':{'type':Sequelize[_0xbb5f('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0xbb5f('0x2')]},'destlanguage':{'type':Sequelize[_0xbb5f('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0xbb5f('0x2')]},'destexten':{'type':Sequelize[_0xbb5f('0x2')]},'destpriority':{'type':Sequelize[_0xbb5f('0x2')]},'destuniqueid':{'type':Sequelize[_0xbb5f('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize['STRING']},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0xbb5f('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0xbb5f('0x6')},'transferexten':{'type':Sequelize[_0xbb5f('0x2')]},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize[_0xbb5f('0x5')],'defaultValue':0x0}}; \ No newline at end of file +var _0xc2a2=['exports','STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize'];(function(_0x14aa96,_0x52c180){var _0x520d32=function(_0x3dd977){while(--_0x3dd977){_0x14aa96['push'](_0x14aa96['shift']());}};_0x520d32(++_0x52c180);}(_0xc2a2,0x84));var _0x2c2a=function(_0x4bdb81,_0x528833){_0x4bdb81=_0x4bdb81-0x0;var _0x297323=_0xc2a2[_0x4bdb81];return _0x297323;};'use strict';var Sequelize=require(_0x2c2a('0x0'));module[_0x2c2a('0x1')]={'type':{'type':Sequelize[_0x2c2a('0x2')]},'uniqueid':{'type':Sequelize[_0x2c2a('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x2c2a('0x2')]},'queue':{'type':Sequelize[_0x2c2a('0x2')]},'interface':{'type':Sequelize[_0x2c2a('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x2c2a('0x3')]},'agentconnectAt':{'type':Sequelize[_0x2c2a('0x3')]},'agentcompleteAt':{'type':Sequelize[_0x2c2a('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0x2c2a('0x3')]},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize[_0x2c2a('0x4')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x2c2a('0x4')]},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize[_0x2c2a('0x2')]},'channel':{'type':Sequelize[_0x2c2a('0x2')]},'channelstate':{'type':Sequelize[_0x2c2a('0x4')]},'channelstatedesc':{'type':Sequelize[_0x2c2a('0x2')]},'connectedlinenum':{'type':Sequelize[_0x2c2a('0x2')]},'connectedlinename':{'type':Sequelize[_0x2c2a('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x2c2a('0x2')]},'exten':{'type':Sequelize[_0x2c2a('0x2')]},'priority':{'type':Sequelize[_0x2c2a('0x2')]},'destchannel':{'type':Sequelize[_0x2c2a('0x2')]},'destchannelstate':{'type':Sequelize[_0x2c2a('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x2c2a('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x2c2a('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x2c2a('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x2c2a('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x2c2a('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x2c2a('0x2')]},'destuniqueid':{'type':Sequelize[_0x2c2a('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize['STRING']},'answeredelsewheremembername':{'type':Sequelize[_0x2c2a('0x2')]},'transfer':{'type':Sequelize[_0x2c2a('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x2c2a('0x2')],'comment':_0x2c2a('0x6')},'transferexten':{'type':Sequelize[_0x2c2a('0x2')]},'transferuniqueid':{'type':Sequelize[_0x2c2a('0x2')]},'agententerreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index 43421e2..18ca2bc 100644 --- a/server/api/voiceAgentReport/voiceAgentReport.controller.js +++ b/server/api/voiceAgentReport/voiceAgentReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['type','options','includeAll','include','findAll','catch','show','params','find','body','describe','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','offset','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','VoiceAgentReport','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xa9e0[_0xf50820];return _0x2a9b10;};'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(_0x2f45ea,_0x15c656){var _0x485a84=function(_0x4a1fe3){while(--_0x4a1fe3){_0x2f45ea['push'](_0x2f45ea['shift']());}};_0x485a84(++_0x15c656);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xa9e0[_0x3a6efd];return _0x487b9a;};'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 7bf307b..5a7317f 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 _0xf452=['request-promise','path','rimraf','../../config/environment','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','report_agent','uniqueid','destuniqueid','lodash','util','api','moment','bluebird'];(function(_0x2c4823,_0x2cc329){var _0x3add59=function(_0x5353a2){while(--_0x5353a2){_0x2c4823['push'](_0x2c4823['shift']());}};_0x3add59(++_0x2cc329);}(_0xf452,0x13b));var _0x2f45=function(_0x28b7cd,_0x1cd352){_0x28b7cd=_0x28b7cd-0x0;var _0x3c3a73=_0xf452[_0x28b7cd];return _0x3c3a73;};'use strict';var _=require(_0x2f45('0x0'));var util=require(_0x2f45('0x1'));var logger=require('../../config/logger')(_0x2f45('0x2'));var moment=require(_0x2f45('0x3'));var BPromise=require(_0x2f45('0x4'));var rp=require(_0x2f45('0x5'));var fs=require('fs');var path=require(_0x2f45('0x6'));var rimraf=require(_0x2f45('0x7'));var config=require(_0x2f45('0x8'));var attributes=require(_0x2f45('0x9'));module[_0x2f45('0xa')]=function(_0x416e83,_0x1a53cf){return _0x416e83[_0x2f45('0xb')](_0x2f45('0xc'),attributes,{'tableName':_0x2f45('0xd'),'paranoid':![],'indexes':[{'fields':[_0x2f45('0xe'),_0x2f45('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3831=['bluebird','request-promise','rimraf','./voiceAgentReport.attributes','define','report_agent','uniqueid','destuniqueid','lodash','../../config/logger','api','moment'];(function(_0x24f92b,_0xc395fe){var _0x2a3bed=function(_0x4253b2){while(--_0x4253b2){_0x24f92b['push'](_0x24f92b['shift']());}};_0x2a3bed(++_0xc395fe);}(_0x3831,0x14c));var _0x1383=function(_0x5bfea1,_0x494abb){_0x5bfea1=_0x5bfea1-0x0;var _0x42d2fa=_0x3831[_0x5bfea1];return _0x42d2fa;};'use strict';var _=require(_0x1383('0x0'));var util=require('util');var logger=require(_0x1383('0x1'))(_0x1383('0x2'));var moment=require(_0x1383('0x3'));var BPromise=require(_0x1383('0x4'));var rp=require(_0x1383('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1383('0x6'));var config=require('../../config/environment');var attributes=require(_0x1383('0x7'));module['exports']=function(_0x5b64b1,_0x5eb4d8){return _0x5b64b1[_0x1383('0x8')]('VoiceAgentReport',attributes,{'tableName':_0x1383('0x9'),'paranoid':![],'indexes':[{'fields':[_0x1383('0xa'),_0x1383('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index e5c133a..b0866f2 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 _0xd4dd=['create','options','raw','catch','UpdateVoiceAgentReport','update','body','where','attributes','limit','debug','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','CreateVoiceAgentReport','VoiceAgentReport'];(function(_0xb9bd53,_0x27ae69){var _0x5007e3=function(_0x3d6edd){while(--_0x3d6edd){_0xb9bd53['push'](_0xb9bd53['shift']());}};_0x5007e3(++_0x27ae69);}(_0xd4dd,0xd7));var _0xdd4d=function(_0x5c42ed,_0x22ffe1){_0x5c42ed=_0x5c42ed-0x0;var _0x371f5e=_0xd4dd[_0x5c42ed];return _0x371f5e;};'use strict';var _=require(_0xdd4d('0x0'));var util=require(_0xdd4d('0x1'));var moment=require(_0xdd4d('0x2'));var BPromise=require('bluebird');var rs=require(_0xdd4d('0x3'));var fs=require('fs');var Redis=require(_0xdd4d('0x4'));var db=require(_0xdd4d('0x5'))['db'];var utils=require(_0xdd4d('0x6'));var logger=require(_0xdd4d('0x7'))(_0xdd4d('0x8'));var config=require(_0xdd4d('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xdd4d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x442ebf,_0x3d3e9e,_0x3242ff){return new BPromise(function(_0x204153,_0x58a700){return client[_0xdd4d('0xb')](_0x442ebf,_0x3242ff)[_0xdd4d('0xc')](function(_0x34289d){logger[_0xdd4d('0xd')](_0xdd4d('0xe'),_0x3d3e9e,_0xdd4d('0xf'));logger['debug'](_0xdd4d('0x10'),_0x3d3e9e,_0xdd4d('0xf'),JSON[_0xdd4d('0x11')](_0x34289d));if(_0x34289d[_0xdd4d('0x12')]){if(_0x34289d[_0xdd4d('0x12')]['code']===0x1f4){logger[_0xdd4d('0x12')](_0xdd4d('0xe'),_0x3d3e9e,_0x34289d[_0xdd4d('0x12')][_0xdd4d('0x13')]);return _0x58a700(_0x34289d[_0xdd4d('0x12')]['message']);}logger['error']('VoiceAgentReport,\x20%s,\x20%s',_0x3d3e9e,_0x34289d['error'][_0xdd4d('0x13')]);return _0x204153(_0x34289d[_0xdd4d('0x12')][_0xdd4d('0x13')]);}else{logger[_0xdd4d('0xd')](_0xdd4d('0xe'),_0x3d3e9e,_0xdd4d('0xf'));_0x204153(_0x34289d[_0xdd4d('0x14')]['message']);}})['catch'](function(_0x5b144f){logger[_0xdd4d('0x12')](_0xdd4d('0xe'),_0x3d3e9e,_0x5b144f);_0x58a700(_0x5b144f);});});}exports[_0xdd4d('0x15')]=function(_0xdb8d09){var _0x4d6e62=this;return new Promise(function(_0x283861,_0x545392){return db[_0xdd4d('0x16')][_0xdd4d('0x17')](_0xdb8d09['body'],{'raw':_0xdb8d09[_0xdd4d('0x18')]?_0xdb8d09['options'][_0xdd4d('0x19')]===undefined?!![]:![]:!![]})[_0xdd4d('0xc')](function(_0x43c8b5){logger['info']('CreateVoiceAgentReport',_0xdb8d09);logger['debug'](_0xdd4d('0x15'),_0xdb8d09,JSON['stringify'](_0x43c8b5));_0x283861(_0x43c8b5);})[_0xdd4d('0x1a')](function(_0x31ea5c){logger['error'](_0xdd4d('0x15'),_0x31ea5c[_0xdd4d('0x13')],_0xdb8d09);_0x545392(_0x4d6e62[_0xdd4d('0x12')](0x1f4,_0x31ea5c[_0xdd4d('0x13')]));});});};exports[_0xdd4d('0x1b')]=function(_0x5be33e){var _0x380d2b=this;return new Promise(function(_0x495c0b,_0x81c21){return db[_0xdd4d('0x16')][_0xdd4d('0x1c')](_0x5be33e[_0xdd4d('0x1d')],{'raw':_0x5be33e[_0xdd4d('0x18')]?_0x5be33e[_0xdd4d('0x18')][_0xdd4d('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5be33e[_0xdd4d('0x18')]?_0x5be33e[_0xdd4d('0x18')][_0xdd4d('0x1e')]||null:null,'attributes':_0x5be33e[_0xdd4d('0x18')]?_0x5be33e[_0xdd4d('0x18')][_0xdd4d('0x1f')]||null:null,'limit':_0x5be33e[_0xdd4d('0x18')]?_0x5be33e[_0xdd4d('0x18')][_0xdd4d('0x20')]||null:null})[_0xdd4d('0xc')](function(_0x5b52ad){logger['info'](_0xdd4d('0x1b'),_0x5be33e);logger[_0xdd4d('0x21')]('UpdateVoiceAgentReport',_0x5be33e,JSON[_0xdd4d('0x11')](_0x5b52ad));_0x495c0b(_0x5b52ad);})[_0xdd4d('0x1a')](function(_0x50f47e){logger[_0xdd4d('0x12')](_0xdd4d('0x1b'),_0x50f47e['message'],_0x5be33e);_0x81c21(_0x380d2b[_0xdd4d('0x12')](0x1f4,_0x50f47e[_0xdd4d('0x13')]));});});}; \ No newline at end of file +var _0x2a1d=['UpdateVoiceAgentReport','update','where','limit','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','stringify','error','code','VoiceAgentReport,\x20%s,\x20%s','message','result','catch','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','raw'];(function(_0x4f3c9b,_0x28e078){var _0x84e58a=function(_0x37bf49){while(--_0x37bf49){_0x4f3c9b['push'](_0x4f3c9b['shift']());}};_0x84e58a(++_0x28e078);}(_0x2a1d,0x184));var _0xd2a1=function(_0x5f3ea0,_0x111f48){_0x5f3ea0=_0x5f3ea0-0x0;var _0x4ff1f6=_0x2a1d[_0x5f3ea0];return _0x4ff1f6;};'use strict';var _=require(_0xd2a1('0x0'));var util=require('util');var moment=require(_0xd2a1('0x1'));var BPromise=require('bluebird');var rs=require(_0xd2a1('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd2a1('0x3'))['db'];var utils=require(_0xd2a1('0x4'));var logger=require(_0xd2a1('0x5'))(_0xd2a1('0x6'));var config=require(_0xd2a1('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xd2a1('0x8')][_0xd2a1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2a4af5,_0x24164b,_0x50c2b8){return new BPromise(function(_0x230328,_0x476fcf){return client[_0xd2a1('0xa')](_0x2a4af5,_0x50c2b8)[_0xd2a1('0xb')](function(_0x2f5076){logger[_0xd2a1('0xc')]('VoiceAgentReport,\x20%s,\x20%s',_0x24164b,_0xd2a1('0xd'));logger[_0xd2a1('0xe')]('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0x24164b,'request\x20sent',JSON[_0xd2a1('0xf')](_0x2f5076));if(_0x2f5076[_0xd2a1('0x10')]){if(_0x2f5076['error'][_0xd2a1('0x11')]===0x1f4){logger[_0xd2a1('0x10')](_0xd2a1('0x12'),_0x24164b,_0x2f5076[_0xd2a1('0x10')]['message']);return _0x476fcf(_0x2f5076['error']['message']);}logger[_0xd2a1('0x10')](_0xd2a1('0x12'),_0x24164b,_0x2f5076[_0xd2a1('0x10')][_0xd2a1('0x13')]);return _0x230328(_0x2f5076[_0xd2a1('0x10')][_0xd2a1('0x13')]);}else{logger[_0xd2a1('0xc')]('VoiceAgentReport,\x20%s,\x20%s',_0x24164b,_0xd2a1('0xd'));_0x230328(_0x2f5076[_0xd2a1('0x14')][_0xd2a1('0x13')]);}})[_0xd2a1('0x15')](function(_0x1d1b14){logger[_0xd2a1('0x10')](_0xd2a1('0x12'),_0x24164b,_0x1d1b14);_0x476fcf(_0x1d1b14);});});}exports[_0xd2a1('0x16')]=function(_0xb9590a){var _0x3fdb69=this;return new Promise(function(_0x250f13,_0x1b2d6d){return db[_0xd2a1('0x17')][_0xd2a1('0x18')](_0xb9590a[_0xd2a1('0x19')],{'raw':_0xb9590a[_0xd2a1('0x1a')]?_0xb9590a[_0xd2a1('0x1a')][_0xd2a1('0x1b')]===undefined?!![]:![]:!![]})[_0xd2a1('0xb')](function(_0x2d5a55){logger[_0xd2a1('0xc')]('CreateVoiceAgentReport',_0xb9590a);logger['debug']('CreateVoiceAgentReport',_0xb9590a,JSON[_0xd2a1('0xf')](_0x2d5a55));_0x250f13(_0x2d5a55);})['catch'](function(_0x37e033){logger[_0xd2a1('0x10')](_0xd2a1('0x16'),_0x37e033[_0xd2a1('0x13')],_0xb9590a);_0x1b2d6d(_0x3fdb69[_0xd2a1('0x10')](0x1f4,_0x37e033[_0xd2a1('0x13')]));});});};exports[_0xd2a1('0x1c')]=function(_0x4b1cd7){var _0x1ce8f4=this;return new Promise(function(_0x47efe2,_0x3b186d){return db[_0xd2a1('0x17')][_0xd2a1('0x1d')](_0x4b1cd7[_0xd2a1('0x19')],{'raw':_0x4b1cd7['options']?_0x4b1cd7[_0xd2a1('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b1cd7['options']?_0x4b1cd7[_0xd2a1('0x1a')][_0xd2a1('0x1e')]||null:null,'attributes':_0x4b1cd7[_0xd2a1('0x1a')]?_0x4b1cd7[_0xd2a1('0x1a')]['attributes']||null:null,'limit':_0x4b1cd7[_0xd2a1('0x1a')]?_0x4b1cd7[_0xd2a1('0x1a')][_0xd2a1('0x1f')]||null:null})[_0xd2a1('0xb')](function(_0xcd53e3){logger['info']('UpdateVoiceAgentReport',_0x4b1cd7);logger[_0xd2a1('0xe')]('UpdateVoiceAgentReport',_0x4b1cd7,JSON[_0xd2a1('0xf')](_0xcd53e3));_0x47efe2(_0xcd53e3);})[_0xd2a1('0x15')](function(_0x141cd1){logger['error'](_0xd2a1('0x1c'),_0x141cd1[_0xd2a1('0x13')],_0x4b1cd7);_0x3b186d(_0x1ce8f4[_0xd2a1('0x10')](0x1f4,_0x141cd1[_0xd2a1('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 2746e3b..f7fa890 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 _0x3435=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/describe','describe','/:id','show','create','put','delete','exports','multer','util'];(function(_0x1dcc64,_0x496954){var _0x1a7eb8=function(_0x76e4ff){while(--_0x76e4ff){_0x1dcc64['push'](_0x1dcc64['shift']());}};_0x1a7eb8(++_0x496954);}(_0x3435,0xfa));var _0x5343=function(_0x280f4a,_0x2ed8d6){_0x280f4a=_0x280f4a-0x0;var _0x1bb157=_0x3435[_0x280f4a];return _0x1bb157;};'use strict';var multer=require(_0x5343('0x0'));var util=require(_0x5343('0x1'));var path=require(_0x5343('0x2'));var timeout=require(_0x5343('0x3'));var express=require(_0x5343('0x4'));var router=express[_0x5343('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x5343('0x6'));var interaction=require(_0x5343('0x7'));var config=require('../../config/environment');var controller=require('./voiceCallReport.controller');router[_0x5343('0x8')]('/',auth[_0x5343('0x9')](),controller['index']);router['get'](_0x5343('0xa'),auth[_0x5343('0x9')](),controller[_0x5343('0xb')]);router[_0x5343('0x8')](_0x5343('0xc'),auth['isAuthenticated'](),controller[_0x5343('0xd')]);router['post']('/',auth[_0x5343('0x9')](),controller[_0x5343('0xe')]);router[_0x5343('0xf')](_0x5343('0xc'),auth[_0x5343('0x9')](),controller['update']);router[_0x5343('0x10')](_0x5343('0xc'),auth[_0x5343('0x9')](),controller['destroy']);module[_0x5343('0x11')]=router; \ No newline at end of file +var _0x7217=['../../config/environment','./voiceCallReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x2a5099,_0x329e92){var _0x2802f1=function(_0x53f99b){while(--_0x53f99b){_0x2a5099['push'](_0x2a5099['shift']());}};_0x2802f1(++_0x329e92);}(_0x7217,0x19e));var _0x7721=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x7217[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var fs_extra=require(_0x7721('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7721('0x6'));var controller=require(_0x7721('0x7'));router[_0x7721('0x8')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xa')]);router[_0x7721('0x8')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0xc')]);router[_0x7721('0x8')](_0x7721('0xd'),auth[_0x7721('0x9')](),controller[_0x7721('0xe')]);router[_0x7721('0xf')]('/',auth[_0x7721('0x9')](),controller['create']);router[_0x7721('0x10')](_0x7721('0xd'),auth[_0x7721('0x9')](),controller[_0x7721('0x11')]);router[_0x7721('0x12')](_0x7721('0xd'),auth[_0x7721('0x9')](),controller[_0x7721('0x13')]);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 778277f..c53fa8d 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 _0x5ad1=['sequelize','exports','ENUM','internal','outbound','inbound-fax','STRING','TEXT','DATE','INTEGER'];(function(_0x20b510,_0x48caf7){var _0x507561=function(_0x2eb2e0){while(--_0x2eb2e0){_0x20b510['push'](_0x20b510['shift']());}};_0x507561(++_0x48caf7);}(_0x5ad1,0x12c));var _0x15ad=function(_0x453e41,_0x35f790){_0x453e41=_0x453e41-0x0;var _0x55df6c=_0x5ad1[_0x453e41];return _0x55df6c;};'use strict';var Sequelize=require(_0x15ad('0x0'));module[_0x15ad('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x15ad('0x2')]('inbound',_0x15ad('0x3'),_0x15ad('0x4'),_0x15ad('0x5'),'outbound-fax','dialer')},'tag':{'type':Sequelize[_0x15ad('0x6')]},'accountcode':{'type':Sequelize[_0x15ad('0x6')]},'source':{'type':Sequelize[_0x15ad('0x6')]},'destination':{'type':Sequelize[_0x15ad('0x6')]},'destinationcontext':{'type':Sequelize[_0x15ad('0x6')]},'callerid':{'type':Sequelize[_0x15ad('0x6')]},'channel':{'type':Sequelize[_0x15ad('0x6')]},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize[_0x15ad('0x6')]},'lastdata':{'type':Sequelize[_0x15ad('0x7')]},'starttime':{'type':Sequelize[_0x15ad('0x8')]},'systemanswertime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x15ad('0x8')]},'endtime':{'type':Sequelize['DATE']},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0x15ad('0x9')]},'mohtime':{'type':Sequelize[_0x15ad('0x9')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x15ad('0x6')]},'userDisposition':{'type':Sequelize[_0x15ad('0x6')]},'userSecondDisposition':{'type':Sequelize[_0x15ad('0x6')]},'userThirdDisposition':{'type':Sequelize[_0x15ad('0x6')]},'note':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0x15ad('0x6')]},'routeid':{'type':Sequelize['INTEGER']},'sipcallid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xebc0=['STRING','inbound','internal','outbound','inbound-fax','outbound-fax','dialer','DATE','INTEGER','sequelize','exports'];(function(_0x485f53,_0x104081){var _0x480f1e=function(_0x2d61d2){while(--_0x2d61d2){_0x485f53['push'](_0x485f53['shift']());}};_0x480f1e(++_0x104081);}(_0xebc0,0xe5));var _0x0ebc=function(_0x54ef34,_0x119ec1){_0x54ef34=_0x54ef34-0x0;var _0xd06ff1=_0xebc0[_0x54ef34];return _0xd06ff1;};'use strict';var Sequelize=require(_0x0ebc('0x0'));module[_0x0ebc('0x1')]={'uniqueid':{'type':Sequelize[_0x0ebc('0x2')]},'type':{'type':Sequelize['ENUM'](_0x0ebc('0x3'),_0x0ebc('0x4'),_0x0ebc('0x5'),_0x0ebc('0x6'),_0x0ebc('0x7'),_0x0ebc('0x8'))},'tag':{'type':Sequelize[_0x0ebc('0x2')]},'accountcode':{'type':Sequelize['STRING']},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize[_0x0ebc('0x2')]},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x0ebc('0x2')]},'destinationchannel':{'type':Sequelize[_0x0ebc('0x2')]},'lastapplication':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize[_0x0ebc('0x9')]},'answertime':{'type':Sequelize[_0x0ebc('0x9')]},'endtime':{'type':Sequelize[_0x0ebc('0x9')]},'duration':{'type':Sequelize[_0x0ebc('0xa')]},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0x0ebc('0xa')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x0ebc('0x2')]},'amaflags':{'type':Sequelize[_0x0ebc('0x2')]},'userfield':{'type':Sequelize[_0x0ebc('0x2')]},'userDisposition':{'type':Sequelize[_0x0ebc('0x2')]},'userSecondDisposition':{'type':Sequelize[_0x0ebc('0x2')]},'userThirdDisposition':{'type':Sequelize[_0x0ebc('0x2')]},'note':{'type':Sequelize[_0x0ebc('0x2')]},'prefix':{'type':Sequelize[_0x0ebc('0x2')]},'routeid':{'type':Sequelize[_0x0ebc('0xa')]},'sipcallid':{'type':Sequelize[_0x0ebc('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 40e8d75..bd982b2 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 _0x2ef3=['pick','filter','merge','options','VoiceCallReport','then','includeAll','include','fullname','alias','User','findAll','rows','catch','show','params','keys','find','create','destroy','describe','body','uniqueid','user','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where'];(function(_0xf79bae,_0x263b2a){var _0x5d2cb7=function(_0x27c86b){while(--_0x27c86b){_0xf79bae['push'](_0xf79bae['shift']());}};_0x5d2cb7(++_0x263b2a);}(_0x2ef3,0xba));var _0x32ef=function(_0x5594cf,_0x56f38d){_0x5594cf=_0x5594cf-0x0;var _0x24647e=_0x2ef3[_0x5594cf];return _0x24647e;};'use strict';var emlformat=require(_0x32ef('0x0'));var rimraf=require(_0x32ef('0x1'));var zipdir=require(_0x32ef('0x2'));var jsonpatch=require(_0x32ef('0x3'));var rp=require(_0x32ef('0x4'));var moment=require(_0x32ef('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x32ef('0x6'));var util=require(_0x32ef('0x7'));var path=require('path');var sox=require(_0x32ef('0x8'));var csv=require(_0x32ef('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x32ef('0xa'));var squel=require(_0x32ef('0xb'));var crypto=require(_0x32ef('0xc'));var jsforce=require(_0x32ef('0xd'));var deskjs=require(_0x32ef('0xe'));var toCsv=require(_0x32ef('0x9'));var querystring=require(_0x32ef('0xf'));var Papa=require(_0x32ef('0x10'));var Redis=require(_0x32ef('0x11'));var authService=require(_0x32ef('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x32ef('0x13'));var logger=require(_0x32ef('0x14'))(_0x32ef('0x15'));var utils=require(_0x32ef('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x32ef('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a5106,_0x49d590){_0x49d590=_0x49d590||0xcc;return function(_0x3e98df){if(_0x3e98df){return _0x1a5106[_0x32ef('0x18')](_0x49d590);}return _0x1a5106['status'](_0x49d590)['end']();};}function respondWithResult(_0x19ce1,_0x4d8009){_0x4d8009=_0x4d8009||0xc8;return function(_0x326fce){if(_0x326fce){return _0x19ce1[_0x32ef('0x19')](_0x4d8009)[_0x32ef('0x1a')](_0x326fce);}};}function respondWithFilteredResult(_0x54c7f5,_0x57aff1){return function(_0x55bf0b){if(_0x55bf0b){var _0x531e30=typeof _0x57aff1[_0x32ef('0x1b')]===_0x32ef('0x1c')&&typeof _0x57aff1[_0x32ef('0x1d')]==='undefined';var _0x5d559b=_0x55bf0b[_0x32ef('0x1e')];var _0x1a9476=_0x531e30?0x0:_0x57aff1[_0x32ef('0x1b')];var _0x57863c=_0x531e30?_0x55bf0b[_0x32ef('0x1e')]:_0x57aff1[_0x32ef('0x1b')]+_0x57aff1['limit'];var _0x304505;if(_0x57863c>=_0x5d559b){_0x57863c=_0x5d559b;_0x304505=0xc8;}else{_0x304505=0xce;}_0x54c7f5[_0x32ef('0x19')](_0x304505);return _0x54c7f5[_0x32ef('0x1f')](_0x32ef('0x20'),_0x1a9476+'-'+_0x57863c+'/'+_0x5d559b)[_0x32ef('0x1a')](_0x55bf0b);}return null;};}function patchUpdates(_0x3aec05){return function(_0x4de441){try{jsonpatch[_0x32ef('0x21')](_0x4de441,_0x3aec05,!![]);}catch(_0x5cc3ef){return BPromise[_0x32ef('0x22')](_0x5cc3ef);}return _0x4de441[_0x32ef('0x23')]();};}function saveUpdates(_0x49f2d8,_0x1af371){return function(_0x97780){if(_0x97780){return _0x97780[_0x32ef('0x24')](_0x49f2d8)['then'](function(_0x57f5e5){return _0x57f5e5;});}return null;};}function removeEntity(_0x22f2d7,_0xb30fab){return function(_0x225feb){if(_0x225feb){return _0x225feb['destroy']()['then'](function(){_0x22f2d7[_0x32ef('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51a412,_0x278495){return function(_0x14d4b3){if(!_0x14d4b3){_0x51a412[_0x32ef('0x18')](0x194);}return _0x14d4b3;};}function handleError(_0x1dbe98,_0x15ce54){_0x15ce54=_0x15ce54||0x1f4;return function(_0x234175){logger[_0x32ef('0x25')](_0x234175[_0x32ef('0x26')]);if(_0x234175[_0x32ef('0x27')]){delete _0x234175[_0x32ef('0x27')];}_0x1dbe98[_0x32ef('0x19')](_0x15ce54)[_0x32ef('0x28')](_0x234175);};}exports['index']=function(_0xd65fde,_0x2f5d06){var _0x5a04cd={},_0x12de1a={},_0x3c569d={'count':0x0,'rows':[]};var _0x30b250=_[_0x32ef('0x29')](db['VoiceCallReport'][_0x32ef('0x2a')],function(_0x22bf86){return{'name':_0x22bf86[_0x32ef('0x2b')],'type':_0x22bf86[_0x32ef('0x2c')][_0x32ef('0x2d')]};});_0x12de1a[_0x32ef('0x2e')]=_[_0x32ef('0x29')](_0x30b250,'name');_0x12de1a[_0x32ef('0x2f')]=_['keys'](_0xd65fde[_0x32ef('0x2f')]);_0x12de1a[_0x32ef('0x30')]=_['intersection'](_0x12de1a[_0x32ef('0x2e')],_0x12de1a[_0x32ef('0x2f')]);_0x5a04cd[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0x12de1a[_0x32ef('0x2e')],qs['fields'](_0xd65fde['query'][_0x32ef('0x33')]));_0x5a04cd['attributes']=_0x5a04cd[_0x32ef('0x31')][_0x32ef('0x34')]?_0x5a04cd[_0x32ef('0x31')]:_0x12de1a[_0x32ef('0x2e')];if(!_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x35')]('nolimit')){_0x5a04cd['limit']=qs['limit'](_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x1d')]);_0x5a04cd[_0x32ef('0x1b')]=qs['offset'](_0xd65fde['query'][_0x32ef('0x1b')]);}_0x5a04cd[_0x32ef('0x36')]=qs[_0x32ef('0x37')](_0xd65fde['query']['sort']);_0x5a04cd[_0x32ef('0x38')]=qs[_0x32ef('0x30')](_[_0x32ef('0x39')](_0xd65fde[_0x32ef('0x2f')],_0x12de1a[_0x32ef('0x30')]),_0x30b250);if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]){_0x5a04cd[_0x32ef('0x38')]=_[_0x32ef('0x3b')](_0x5a04cd['where'],{'$or':_[_0x32ef('0x29')](_0x30b250,function(_0x36e374){if(_0x36e374[_0x32ef('0x2c')]!=='VIRTUAL'){var _0x365125={};_0x365125[_0x36e374[_0x32ef('0x27')]]={'$like':'%'+_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]+'%'};return _0x365125;}})});}_0x5a04cd=_[_0x32ef('0x3b')]({},_0x5a04cd,_0xd65fde[_0x32ef('0x3c')]);var _0x256c40={'where':_0x5a04cd[_0x32ef('0x38')]};return db[_0x32ef('0x3d')][_0x32ef('0x1e')](_0x256c40)[_0x32ef('0x3e')](function(_0x4615b4){_0x3c569d['count']=_0x4615b4;if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3f')]){_0x5a04cd[_0x32ef('0x40')]=[{'attributes':['id',_0x32ef('0x27'),_0x32ef('0x41'),_0x32ef('0x42')],'model':db[_0x32ef('0x43')],'as':'User'}];}return db['VoiceCallReport'][_0x32ef('0x44')](_0x5a04cd);})[_0x32ef('0x3e')](function(_0x2a33dd){_0x3c569d[_0x32ef('0x45')]=_0x2a33dd;return _0x3c569d;})['then'](respondWithFilteredResult(_0x2f5d06,_0x5a04cd))[_0x32ef('0x46')](handleError(_0x2f5d06,null));};exports[_0x32ef('0x47')]=function(_0x5d2f06,_0x4744ba){var _0x4bc5bc={'raw':!![],'where':{'id':_0x5d2f06[_0x32ef('0x48')]['id']}},_0xcb3c08={};_0xcb3c08[_0x32ef('0x2e')]=_[_0x32ef('0x49')](db[_0x32ef('0x3d')][_0x32ef('0x2a')]);_0xcb3c08[_0x32ef('0x2f')]=_[_0x32ef('0x49')](_0x5d2f06[_0x32ef('0x2f')]);_0xcb3c08[_0x32ef('0x30')]=_['intersection'](_0xcb3c08[_0x32ef('0x2e')],_0xcb3c08['query']);_0x4bc5bc[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0xcb3c08[_0x32ef('0x2e')],qs['fields'](_0x5d2f06[_0x32ef('0x2f')][_0x32ef('0x33')]));_0x4bc5bc[_0x32ef('0x31')]=_0x4bc5bc[_0x32ef('0x31')][_0x32ef('0x34')]?_0x4bc5bc[_0x32ef('0x31')]:_0xcb3c08[_0x32ef('0x2e')];if(_0x5d2f06['query']['includeAll']){_0x4bc5bc[_0x32ef('0x40')]=[{'all':!![]}];}_0x4bc5bc=_[_0x32ef('0x3b')]({},_0x4bc5bc,_0x5d2f06[_0x32ef('0x3c')]);return db[_0x32ef('0x3d')][_0x32ef('0x4a')](_0x4bc5bc)[_0x32ef('0x3e')](handleEntityNotFound(_0x4744ba,null))[_0x32ef('0x3e')](respondWithResult(_0x4744ba,null))[_0x32ef('0x46')](handleError(_0x4744ba,null));};exports[_0x32ef('0x4b')]=function(_0x1ebedf,_0x35a294){return db[_0x32ef('0x3d')][_0x32ef('0x4b')](_0x1ebedf['body'],{})[_0x32ef('0x3e')](respondWithResult(_0x35a294,0xc9))[_0x32ef('0x46')](handleError(_0x35a294,null));};exports[_0x32ef('0x4c')]=function(_0xd42609,_0x1cc9f3){return db[_0x32ef('0x3d')][_0x32ef('0x4a')]({'where':{'id':_0xd42609[_0x32ef('0x48')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x1cc9f3,null))[_0x32ef('0x3e')](removeEntity(_0x1cc9f3,null))[_0x32ef('0x46')](handleError(_0x1cc9f3,null));};exports[_0x32ef('0x4d')]=function(_0x272377,_0x326445){return db[_0x32ef('0x3d')][_0x32ef('0x4d')]()[_0x32ef('0x3e')](respondWithResult(_0x326445,null))[_0x32ef('0x46')](handleError(_0x326445,null));};exports['update']=function(_0x515ac9,_0x179c2f){if(_0x515ac9[_0x32ef('0x4e')][_0x32ef('0x4f')]){delete _0x515ac9[_0x32ef('0x4e')][_0x32ef('0x4f')];}return db[_0x32ef('0x3d')][_0x32ef('0x4a')]({'where':{'uniqueid':_0x515ac9[_0x32ef('0x48')]['id'],'UserId':{'$or':[null,_0x515ac9[_0x32ef('0x50')]['id']]}}})[_0x32ef('0x3e')](handleEntityNotFound(_0x179c2f,null))[_0x32ef('0x3e')](saveUpdates(_0x515ac9['body'],null))[_0x32ef('0x3e')](respondWithResult(_0x179c2f,null))[_0x32ef('0x46')](handleError(_0x179c2f,null));}; \ No newline at end of file +var _0xdb28=['options','includeAll','fullname','User','findAll','rows','catch','show','params','rawAttributes','intersection','include','find','create','destroy','describe','body','uniqueid','user','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','error','stack','name','send','index','VoiceCallReport','fieldName','type','key','map','query','keys','model','fields','attributes','length','nolimit','order','sort','filters','filter','where','VIRTUAL','merge'];(function(_0x2af672,_0x48dd4e){var _0x2127ef=function(_0x3ad7d7){while(--_0x3ad7d7){_0x2af672['push'](_0x2af672['shift']());}};_0x2127ef(++_0x48dd4e);}(_0xdb28,0x106));var _0x8db2=function(_0x5aecf5,_0x20b388){_0x5aecf5=_0x5aecf5-0x0;var _0x4ac826=_0xdb28[_0x5aecf5];return _0x4ac826;};'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']=[{'attributes':['id',_0x8db2('0x28'),_0x8db2('0x40'),'alias'],'model':db['User'],'as':_0x8db2('0x41')}];}return db['VoiceCallReport'][_0x8db2('0x42')](_0x21bae5);})[_0x8db2('0x24')](function(_0x313130){_0x3124d5[_0x8db2('0x43')]=_0x313130;return _0x3124d5;})[_0x8db2('0x24')](respondWithFilteredResult(_0xbe5ece,_0x21bae5))[_0x8db2('0x44')](handleError(_0xbe5ece,null));};exports[_0x8db2('0x45')]=function(_0x5c97ef,_0x2f86b1){var _0x3d44de={'raw':!![],'where':{'id':_0x5c97ef[_0x8db2('0x46')]['id']}},_0x40c69e={};_0x40c69e['model']=_[_0x8db2('0x31')](db[_0x8db2('0x2b')][_0x8db2('0x47')]);_0x40c69e[_0x8db2('0x30')]=_['keys'](_0x5c97ef[_0x8db2('0x30')]);_0x40c69e['filters']=_[_0x8db2('0x48')](_0x40c69e[_0x8db2('0x32')],_0x40c69e[_0x8db2('0x30')]);_0x3d44de['attributes']=_['intersection'](_0x40c69e[_0x8db2('0x32')],qs['fields'](_0x5c97ef[_0x8db2('0x30')][_0x8db2('0x33')]));_0x3d44de[_0x8db2('0x34')]=_0x3d44de[_0x8db2('0x34')][_0x8db2('0x35')]?_0x3d44de[_0x8db2('0x34')]:_0x40c69e[_0x8db2('0x32')];if(_0x5c97ef[_0x8db2('0x30')][_0x8db2('0x3f')]){_0x3d44de[_0x8db2('0x49')]=[{'all':!![]}];}_0x3d44de=_[_0x8db2('0x3d')]({},_0x3d44de,_0x5c97ef[_0x8db2('0x3e')]);return db['VoiceCallReport'][_0x8db2('0x4a')](_0x3d44de)[_0x8db2('0x24')](handleEntityNotFound(_0x2f86b1,null))[_0x8db2('0x24')](respondWithResult(_0x2f86b1,null))[_0x8db2('0x44')](handleError(_0x2f86b1,null));};exports['create']=function(_0x4ffd9d,_0x11c224){return db[_0x8db2('0x2b')][_0x8db2('0x4b')](_0x4ffd9d['body'],{})['then'](respondWithResult(_0x11c224,0xc9))['catch'](handleError(_0x11c224,null));};exports[_0x8db2('0x4c')]=function(_0x368c37,_0x55c7dd){return db[_0x8db2('0x2b')][_0x8db2('0x4a')]({'where':{'id':_0x368c37[_0x8db2('0x46')]['id']}})[_0x8db2('0x24')](handleEntityNotFound(_0x55c7dd,null))['then'](removeEntity(_0x55c7dd,null))['catch'](handleError(_0x55c7dd,null));};exports[_0x8db2('0x4d')]=function(_0x18c6ef,_0x2908e4){return db[_0x8db2('0x2b')][_0x8db2('0x4d')]()[_0x8db2('0x24')](respondWithResult(_0x2908e4,null))[_0x8db2('0x44')](handleError(_0x2908e4,null));};exports[_0x8db2('0x23')]=function(_0x4187d6,_0x426ae0){if(_0x4187d6[_0x8db2('0x4e')][_0x8db2('0x4f')]){delete _0x4187d6[_0x8db2('0x4e')][_0x8db2('0x4f')];}return db[_0x8db2('0x2b')]['find']({'where':{'uniqueid':_0x4187d6[_0x8db2('0x46')]['id'],'UserId':{'$or':[null,_0x4187d6[_0x8db2('0x50')]['id']]}}})['then'](handleEntityNotFound(_0x426ae0,null))[_0x8db2('0x24')](saveUpdates(_0x4187d6[_0x8db2('0x4e')],null))[_0x8db2('0x24')](respondWithResult(_0x426ae0,null))['catch'](handleError(_0x426ae0,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 445252e..a3183f4 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 _0x7577=['uniqueid','../../config/logger','api','bluebird','request-promise','./voiceCallReport.attributes','exports','VoiceCallReport','report_call'];(function(_0x3f3f06,_0x581e5b){var _0x140feb=function(_0x4cc383){while(--_0x4cc383){_0x3f3f06['push'](_0x3f3f06['shift']());}};_0x140feb(++_0x581e5b);}(_0x7577,0x88));var _0x7757=function(_0x53ff28,_0x4ea1a8){_0x53ff28=_0x53ff28-0x0;var _0x13201a=_0x7577[_0x53ff28];return _0x13201a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7757('0x0'))(_0x7757('0x1'));var moment=require('moment');var BPromise=require(_0x7757('0x2'));var rp=require(_0x7757('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x7757('0x4'));module[_0x7757('0x5')]=function(_0x40b0cb,_0x217d84){return _0x40b0cb['define'](_0x7757('0x6'),attributes,{'tableName':_0x7757('0x7'),'paranoid':![],'indexes':[{'fields':[_0x7757('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe586=['define','VoiceCallReport','report_call','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./voiceCallReport.attributes','exports'];(function(_0x56592c,_0x1ba585){var _0x5985e2=function(_0x18e9fb){while(--_0x18e9fb){_0x56592c['push'](_0x56592c['shift']());}};_0x5985e2(++_0x1ba585);}(_0xe586,0xc8));var _0x6e58=function(_0x3fd450,_0x3537b1){_0x3fd450=_0x3fd450-0x0;var _0x1a16cc=_0xe586[_0x3fd450];return _0x1a16cc;};'use strict';var _=require(_0x6e58('0x0'));var util=require(_0x6e58('0x1'));var logger=require(_0x6e58('0x2'))('api');var moment=require(_0x6e58('0x3'));var BPromise=require(_0x6e58('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6e58('0x5'));var rimraf=require(_0x6e58('0x6'));var config=require(_0x6e58('0x7'));var attributes=require(_0x6e58('0x8'));module[_0x6e58('0x9')]=function(_0xc77f2a,_0x3fff2d){return _0xc77f2a[_0x6e58('0xa')](_0x6e58('0xb'),attributes,{'tableName':_0x6e58('0xc'),'paranoid':![],'indexes':[{'fields':[_0x6e58('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 6074a8f..b31e97d 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 _0x2fb4=['client','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','GetVoiceCallReport','VoiceCallReport','options','where','include','map','model','attributes','stringify','CreateVoiceCallReport','create','body','raw','UpdateVoiceCallReport','update','limit','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x65569f,_0x95822d){var _0x3e802b=function(_0x9f91cf){while(--_0x9f91cf){_0x65569f['push'](_0x65569f['shift']());}};_0x3e802b(++_0x95822d);}(_0x2fb4,0x81));var _0x42fb=function(_0x37d933,_0x4ea30f){_0x37d933=_0x37d933-0x0;var _0x23741d=_0x2fb4[_0x37d933];return _0x23741d;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x42fb('0x0'));var rs=require(_0x42fb('0x1'));var fs=require('fs');var Redis=require(_0x42fb('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x42fb('0x3'));var logger=require('../../config/logger')(_0x42fb('0x4'));var config=require(_0x42fb('0x5'));var jayson=require(_0x42fb('0x6'));var client=jayson[_0x42fb('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x599ede,_0x4901f3,_0x339173){return new BPromise(function(_0x32f2c5,_0x2142f7){return client['request'](_0x599ede,_0x339173)[_0x42fb('0x8')](function(_0x110b8){logger[_0x42fb('0x9')](_0x42fb('0xa'),_0x4901f3,_0x42fb('0xb'));logger[_0x42fb('0xc')](_0x42fb('0xd'),_0x4901f3,_0x42fb('0xb'),JSON['stringify'](_0x110b8));if(_0x110b8['error']){if(_0x110b8[_0x42fb('0xe')]['code']===0x1f4){logger[_0x42fb('0xe')](_0x42fb('0xa'),_0x4901f3,_0x110b8[_0x42fb('0xe')][_0x42fb('0xf')]);return _0x2142f7(_0x110b8[_0x42fb('0xe')]['message']);}logger[_0x42fb('0xe')]('VoiceCallReport,\x20%s,\x20%s',_0x4901f3,_0x110b8[_0x42fb('0xe')][_0x42fb('0xf')]);return _0x32f2c5(_0x110b8[_0x42fb('0xe')][_0x42fb('0xf')]);}else{logger[_0x42fb('0x9')](_0x42fb('0xa'),_0x4901f3,_0x42fb('0xb'));_0x32f2c5(_0x110b8[_0x42fb('0x10')][_0x42fb('0xf')]);}})[_0x42fb('0x11')](function(_0x2a62f9){logger[_0x42fb('0xe')]('VoiceCallReport,\x20%s,\x20%s',_0x4901f3,_0x2a62f9);_0x2142f7(_0x2a62f9);});});}exports[_0x42fb('0x12')]=function(_0x33dbd6){var _0x23a518=this;return new Promise(function(_0x3cc05f,_0x488359){return db[_0x42fb('0x13')]['findAll']({'raw':_0x33dbd6[_0x42fb('0x14')]?_0x33dbd6['options']['raw']===undefined?!![]:![]:!![],'where':_0x33dbd6[_0x42fb('0x14')]?_0x33dbd6[_0x42fb('0x14')][_0x42fb('0x15')]||null:null,'attributes':_0x33dbd6['options']?_0x33dbd6[_0x42fb('0x14')]['attributes']||null:null,'limit':_0x33dbd6[_0x42fb('0x14')]?_0x33dbd6['options']['limit']||null:null,'include':_0x33dbd6[_0x42fb('0x14')]?_0x33dbd6[_0x42fb('0x14')][_0x42fb('0x16')]?_[_0x42fb('0x17')](_0x33dbd6['options'][_0x42fb('0x16')],function(_0x4d80ef){return{'model':db[_0x4d80ef[_0x42fb('0x18')]],'as':_0x4d80ef['as'],'attributes':_0x4d80ef['attributes'],'include':_0x4d80ef[_0x42fb('0x16')]?_[_0x42fb('0x17')](_0x4d80ef[_0x42fb('0x16')],function(_0x4f68d3){return{'model':db[_0x4f68d3['model']],'as':_0x4f68d3['as'],'attributes':_0x4f68d3[_0x42fb('0x19')],'include':_0x4f68d3[_0x42fb('0x16')]?_[_0x42fb('0x17')](_0x4f68d3[_0x42fb('0x16')],function(_0x495a56){return{'model':db[_0x495a56[_0x42fb('0x18')]],'as':_0x495a56['as'],'attributes':_0x495a56[_0x42fb('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x29c69c){logger[_0x42fb('0x9')](_0x42fb('0x12'),_0x33dbd6);logger[_0x42fb('0xc')]('GetVoiceCallReport',_0x33dbd6,JSON[_0x42fb('0x1a')](_0x29c69c));_0x3cc05f(_0x29c69c);})[_0x42fb('0x11')](function(_0x52df31){logger[_0x42fb('0xe')](_0x42fb('0x12'),_0x52df31[_0x42fb('0xf')],_0x33dbd6);_0x488359(_0x23a518[_0x42fb('0xe')](0x1f4,_0x52df31[_0x42fb('0xf')]));});});};exports[_0x42fb('0x1b')]=function(_0x3faf4e){var _0x4c3a0f=this;return new Promise(function(_0x2a0f77,_0x1fd826){return db[_0x42fb('0x13')][_0x42fb('0x1c')](_0x3faf4e[_0x42fb('0x1d')],{'raw':_0x3faf4e['options']?_0x3faf4e['options'][_0x42fb('0x1e')]===undefined?!![]:![]:!![]})[_0x42fb('0x8')](function(_0x27bb9a){logger[_0x42fb('0x9')](_0x42fb('0x1b'),_0x3faf4e);logger['debug'](_0x42fb('0x1b'),_0x3faf4e,JSON[_0x42fb('0x1a')](_0x27bb9a));_0x2a0f77(_0x27bb9a);})['catch'](function(_0x466098){logger[_0x42fb('0xe')](_0x42fb('0x1b'),_0x466098[_0x42fb('0xf')],_0x3faf4e);_0x1fd826(_0x4c3a0f[_0x42fb('0xe')](0x1f4,_0x466098[_0x42fb('0xf')]));});});};exports[_0x42fb('0x1f')]=function(_0x5adcc2){var _0x60237b=this;return new Promise(function(_0x8a4f82,_0x14c52c){return db['VoiceCallReport'][_0x42fb('0x20')](_0x5adcc2['body'],{'raw':_0x5adcc2[_0x42fb('0x14')]?_0x5adcc2[_0x42fb('0x14')][_0x42fb('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5adcc2[_0x42fb('0x14')]?_0x5adcc2[_0x42fb('0x14')][_0x42fb('0x15')]||null:null,'attributes':_0x5adcc2[_0x42fb('0x14')]?_0x5adcc2['options'][_0x42fb('0x19')]||null:null,'limit':_0x5adcc2[_0x42fb('0x14')]?_0x5adcc2[_0x42fb('0x14')][_0x42fb('0x21')]||null:null})[_0x42fb('0x8')](function(_0x603637){logger[_0x42fb('0x9')](_0x42fb('0x1f'),_0x5adcc2);logger[_0x42fb('0xc')]('UpdateVoiceCallReport',_0x5adcc2,JSON[_0x42fb('0x1a')](_0x603637));_0x8a4f82(_0x603637);})[_0x42fb('0x11')](function(_0xbc73bf){logger[_0x42fb('0xe')]('UpdateVoiceCallReport',_0xbc73bf['message'],_0x5adcc2);_0x14c52c(_0x60237b[_0x42fb('0xe')](0x1f4,_0xbc73bf[_0x42fb('0xf')]));});});}; \ No newline at end of file +var _0x785d=['UpdateVoiceCallReport','update','body','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','catch','GetVoiceCallReport','VoiceCallReport','options','raw','where','attributes','limit','include','map','model','then','CreateVoiceCallReport'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x785d,0x1b3));var _0xd785=function(_0x1e8f39,_0x81ddc6){_0x1e8f39=_0x1e8f39-0x0;var _0x3f9ef0=_0x785d[_0x1e8f39];return _0x3f9ef0;};'use strict';var _=require(_0xd785('0x0'));var util=require(_0xd785('0x1'));var moment=require(_0xd785('0x2'));var BPromise=require(_0xd785('0x3'));var rs=require(_0xd785('0x4'));var fs=require('fs');var Redis=require(_0xd785('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xd785('0x6'));var logger=require(_0xd785('0x7'))('rpc');var config=require(_0xd785('0x8'));var jayson=require(_0xd785('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x290679,_0x50599c,_0x579ff3){return new BPromise(function(_0x2158ec,_0x3e0196){return client[_0xd785('0xa')](_0x290679,_0x579ff3)['then'](function(_0x2af301){logger[_0xd785('0xb')](_0xd785('0xc'),_0x50599c,_0xd785('0xd'));logger[_0xd785('0xe')]('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x50599c,_0xd785('0xd'),JSON[_0xd785('0xf')](_0x2af301));if(_0x2af301['error']){if(_0x2af301['error'][_0xd785('0x10')]===0x1f4){logger[_0xd785('0x11')](_0xd785('0xc'),_0x50599c,_0x2af301[_0xd785('0x11')]['message']);return _0x3e0196(_0x2af301[_0xd785('0x11')][_0xd785('0x12')]);}logger[_0xd785('0x11')]('VoiceCallReport,\x20%s,\x20%s',_0x50599c,_0x2af301[_0xd785('0x11')][_0xd785('0x12')]);return _0x2158ec(_0x2af301[_0xd785('0x11')][_0xd785('0x12')]);}else{logger[_0xd785('0xb')](_0xd785('0xc'),_0x50599c,'request\x20sent');_0x2158ec(_0x2af301[_0xd785('0x13')][_0xd785('0x12')]);}})[_0xd785('0x14')](function(_0x467c1e){logger[_0xd785('0x11')](_0xd785('0xc'),_0x50599c,_0x467c1e);_0x3e0196(_0x467c1e);});});}exports[_0xd785('0x15')]=function(_0x29d72d){var _0x3c974c=this;return new Promise(function(_0x2d4079,_0x54aab3){return db[_0xd785('0x16')]['findAll']({'raw':_0x29d72d['options']?_0x29d72d[_0xd785('0x17')][_0xd785('0x18')]===undefined?!![]:![]:!![],'where':_0x29d72d[_0xd785('0x17')]?_0x29d72d['options'][_0xd785('0x19')]||null:null,'attributes':_0x29d72d[_0xd785('0x17')]?_0x29d72d[_0xd785('0x17')][_0xd785('0x1a')]||null:null,'limit':_0x29d72d[_0xd785('0x17')]?_0x29d72d['options'][_0xd785('0x1b')]||null:null,'include':_0x29d72d[_0xd785('0x17')]?_0x29d72d[_0xd785('0x17')][_0xd785('0x1c')]?_[_0xd785('0x1d')](_0x29d72d[_0xd785('0x17')][_0xd785('0x1c')],function(_0x267772){return{'model':db[_0x267772['model']],'as':_0x267772['as'],'attributes':_0x267772['attributes'],'include':_0x267772[_0xd785('0x1c')]?_[_0xd785('0x1d')](_0x267772[_0xd785('0x1c')],function(_0x206fd9){return{'model':db[_0x206fd9[_0xd785('0x1e')]],'as':_0x206fd9['as'],'attributes':_0x206fd9[_0xd785('0x1a')],'include':_0x206fd9[_0xd785('0x1c')]?_[_0xd785('0x1d')](_0x206fd9[_0xd785('0x1c')],function(_0x3c7bf5){return{'model':db[_0x3c7bf5[_0xd785('0x1e')]],'as':_0x3c7bf5['as'],'attributes':_0x3c7bf5[_0xd785('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xd785('0x1f')](function(_0x1218e0){logger[_0xd785('0xb')]('GetVoiceCallReport',_0x29d72d);logger[_0xd785('0xe')](_0xd785('0x15'),_0x29d72d,JSON['stringify'](_0x1218e0));_0x2d4079(_0x1218e0);})[_0xd785('0x14')](function(_0x1639dd){logger[_0xd785('0x11')](_0xd785('0x15'),_0x1639dd[_0xd785('0x12')],_0x29d72d);_0x54aab3(_0x3c974c[_0xd785('0x11')](0x1f4,_0x1639dd[_0xd785('0x12')]));});});};exports[_0xd785('0x20')]=function(_0x26d865){var _0x123c2d=this;return new Promise(function(_0x3701a4,_0x438e15){return db[_0xd785('0x16')]['create'](_0x26d865['body'],{'raw':_0x26d865['options']?_0x26d865[_0xd785('0x17')]['raw']===undefined?!![]:![]:!![]})[_0xd785('0x1f')](function(_0x27aac4){logger[_0xd785('0xb')](_0xd785('0x20'),_0x26d865);logger[_0xd785('0xe')]('CreateVoiceCallReport',_0x26d865,JSON['stringify'](_0x27aac4));_0x3701a4(_0x27aac4);})[_0xd785('0x14')](function(_0x5b5655){logger['error'](_0xd785('0x20'),_0x5b5655[_0xd785('0x12')],_0x26d865);_0x438e15(_0x123c2d[_0xd785('0x11')](0x1f4,_0x5b5655['message']));});});};exports[_0xd785('0x21')]=function(_0x58ccb4){var _0x25c37b=this;return new Promise(function(_0x46f680,_0x1bf922){return db[_0xd785('0x16')][_0xd785('0x22')](_0x58ccb4[_0xd785('0x23')],{'raw':_0x58ccb4[_0xd785('0x17')]?_0x58ccb4['options'][_0xd785('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x58ccb4[_0xd785('0x17')]?_0x58ccb4[_0xd785('0x17')]['where']||null:null,'attributes':_0x58ccb4['options']?_0x58ccb4[_0xd785('0x17')][_0xd785('0x1a')]||null:null,'limit':_0x58ccb4[_0xd785('0x17')]?_0x58ccb4[_0xd785('0x17')][_0xd785('0x1b')]||null:null})['then'](function(_0x5e3283){logger[_0xd785('0xb')](_0xd785('0x21'),_0x58ccb4);logger[_0xd785('0xe')](_0xd785('0x21'),_0x58ccb4,JSON[_0xd785('0xf')](_0x5e3283));_0x46f680(_0x5e3283);})['catch'](function(_0x4b331c){logger[_0xd785('0x11')]('UpdateVoiceCallReport',_0x4b331c['message'],_0x58ccb4);_0x1bf922(_0x25c37b[_0xd785('0x11')](0x1f4,_0x4b331c[_0xd785('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 77dfe9d..d41b570 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 _0xc9b8=['post','create','destroy','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','index','/:id','isAuthenticated'];(function(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0xc9b8,0x1e3));var _0x8c9b=function(_0x22a24b,_0x33ebca){_0x22a24b=_0x22a24b-0x0;var _0x2309c4=_0xc9b8[_0x22a24b];return _0x2309c4;};'use strict';var multer=require('multer');var util=require(_0x8c9b('0x0'));var path=require(_0x8c9b('0x1'));var timeout=require(_0x8c9b('0x2'));var express=require('express');var router=express[_0x8c9b('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x8c9b('0x4'));var interaction=require(_0x8c9b('0x5'));var config=require(_0x8c9b('0x6'));var controller=require(_0x8c9b('0x7'));router[_0x8c9b('0x8')]('/',auth['isAuthenticated'](),controller[_0x8c9b('0x9')]);router['get'](_0x8c9b('0xa'),auth[_0x8c9b('0xb')](),controller['show']);router[_0x8c9b('0xc')]('/',auth[_0x8c9b('0xb')](),controller[_0x8c9b('0xd')]);router['put'](_0x8c9b('0xa'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x8c9b('0xb')](),controller[_0x8c9b('0xe')]);module['exports']=router; \ No newline at end of file +var _0x87b4=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','exports','multer','util','path','connect-timeout','Router'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x87b4,0x1c7));var _0x487b=function(_0x34fb70,_0x28c51b){_0x34fb70=_0x34fb70-0x0;var _0x4c6a36=_0x87b4[_0x34fb70];return _0x4c6a36;};'use strict';var multer=require(_0x487b('0x0'));var util=require(_0x487b('0x1'));var path=require(_0x487b('0x2'));var timeout=require(_0x487b('0x3'));var express=require('express');var router=express[_0x487b('0x4')]();var fs_extra=require(_0x487b('0x5'));var auth=require(_0x487b('0x6'));var interaction=require(_0x487b('0x7'));var config=require(_0x487b('0x8'));var controller=require(_0x487b('0x9'));router[_0x487b('0xa')]('/',auth[_0x487b('0xb')](),controller[_0x487b('0xc')]);router[_0x487b('0xa')](_0x487b('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x487b('0xe')]('/',auth[_0x487b('0xb')](),controller[_0x487b('0xf')]);router[_0x487b('0x10')]('/:id',auth[_0x487b('0xb')](),controller[_0x487b('0x11')]);router[_0x487b('0x12')](_0x487b('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x487b('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 8433d9b..6b279db 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 _0xb8cc=['options','getDataValue','sequelize','exports','STRING','name','setDataValue'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb8cc,0x175));var _0xcb8c=function(_0x33688f,_0x42f8c8){_0x33688f=_0x33688f-0x0;var _0x15b44a=_0xb8cc[_0x33688f];return _0x15b44a;};'use strict';var Sequelize=require(_0xcb8c('0x0'));module[_0xcb8c('0x1')]={'name':{'type':Sequelize[_0xcb8c('0x2')]},'prefix':{'type':Sequelize['STRING'],'unique':_0xcb8c('0x3'),'allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x2d0d5e){this[_0xcb8c('0x4')](_0xcb8c('0x5'),_0x2d0d5e?_0x2d0d5e['join'](''):[]);},'get':function(){return this[_0xcb8c('0x6')](_0xcb8c('0x5'))?this[_0xcb8c('0x6')]('options')['split'](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xcb8c('0x2')]},'description':{'type':Sequelize[_0xcb8c('0x2')]}}; \ No newline at end of file +var _0x7029=['join','getDataValue','split','BOOLEAN','sequelize','exports','STRING','name','setDataValue','options'];(function(_0x40bfb8,_0x5075a0){var _0x3950e5=function(_0x494453){while(--_0x494453){_0x40bfb8['push'](_0x40bfb8['shift']());}};_0x3950e5(++_0x5075a0);}(_0x7029,0x1d0));var _0x9702=function(_0x3bce7a,_0x352801){_0x3bce7a=_0x3bce7a-0x0;var _0x9785a6=_0x7029[_0x3bce7a];return _0x9785a6;};'use strict';var Sequelize=require(_0x9702('0x0'));module[_0x9702('0x1')]={'name':{'type':Sequelize[_0x9702('0x2')]},'prefix':{'type':Sequelize[_0x9702('0x2')],'unique':_0x9702('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0x9702('0x2')],'set':function(_0x5606ed){this[_0x9702('0x4')](_0x9702('0x5'),_0x5606ed?_0x5606ed[_0x9702('0x6')](''):[]);},'get':function(){return this[_0x9702('0x7')](_0x9702('0x5'))?this[_0x9702('0x7')]('options')[_0x9702('0x8')](''):[];}},'auth':{'type':Sequelize[_0x9702('0x9')],'defaultValue':![]},'password':{'type':Sequelize[_0x9702('0x2')]},'record':{'type':Sequelize[_0x9702('0x9')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x9702('0x2')]},'description':{'type':Sequelize[_0x9702('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index a7977f0..440bdc3 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 _0x43fd=['length','nolimit','order','sort','where','filters','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','body','user','get','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','offset','undefined','count','limit','set','reject','then','destroy','ChanSpies','UserProfileResource','end','error','stack','name','send','index','map','VoiceChanSpy','type','model','keys','query','intersection','attributes','fields'];(function(_0x4a4ea2,_0x15d603){var _0x17c345=function(_0x11bfcf){while(--_0x11bfcf){_0x4a4ea2['push'](_0x4a4ea2['shift']());}};_0x17c345(++_0x15d603);}(_0x43fd,0x150));var _0xd43f=function(_0x30a321,_0x475f0c){_0x30a321=_0x30a321-0x0;var _0x9f01b2=_0x43fd[_0x30a321];return _0x9f01b2;};'use strict';var emlformat=require(_0xd43f('0x0'));var rimraf=require(_0xd43f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd43f('0x2'));var rp=require('request-promise');var moment=require(_0xd43f('0x3'));var BPromise=require(_0xd43f('0x4'));var Mustache=require(_0xd43f('0x5'));var util=require(_0xd43f('0x6'));var path=require(_0xd43f('0x7'));var sox=require(_0xd43f('0x8'));var csv=require(_0xd43f('0x9'));var ejs=require(_0xd43f('0xa'));var fs=require('fs');var fs_extra=require(_0xd43f('0xb'));var _=require(_0xd43f('0xc'));var squel=require(_0xd43f('0xd'));var crypto=require(_0xd43f('0xe'));var jsforce=require(_0xd43f('0xf'));var deskjs=require(_0xd43f('0x10'));var toCsv=require('to-csv');var querystring=require(_0xd43f('0x11'));var Papa=require(_0xd43f('0x12'));var Redis=require(_0xd43f('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xd43f('0x14'));var as=require(_0xd43f('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd43f('0x16'))(_0xd43f('0x17'));var utils=require(_0xd43f('0x18'));var config=require(_0xd43f('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3be74e,_0xed42ff){_0xed42ff=_0xed42ff||0xcc;return function(_0x5b90a7){if(_0x5b90a7){return _0x3be74e[_0xd43f('0x1a')](_0xed42ff);}return _0x3be74e['status'](_0xed42ff)['end']();};}function respondWithResult(_0x28fe2d,_0x12bd82){_0x12bd82=_0x12bd82||0xc8;return function(_0x568087){if(_0x568087){return _0x28fe2d[_0xd43f('0x1b')](_0x12bd82)[_0xd43f('0x1c')](_0x568087);}};}function respondWithFilteredResult(_0x54f136,_0x229f81){return function(_0x351c9c){if(_0x351c9c){var _0x10f584=typeof _0x229f81[_0xd43f('0x1d')]===_0xd43f('0x1e')&&typeof _0x229f81['limit']==='undefined';var _0x5c03a6=_0x351c9c[_0xd43f('0x1f')];var _0x22d86f=_0x10f584?0x0:_0x229f81[_0xd43f('0x1d')];var _0x2e2396=_0x10f584?_0x351c9c['count']:_0x229f81[_0xd43f('0x1d')]+_0x229f81[_0xd43f('0x20')];var _0x263e9a;if(_0x2e2396>=_0x5c03a6){_0x2e2396=_0x5c03a6;_0x263e9a=0xc8;}else{_0x263e9a=0xce;}_0x54f136[_0xd43f('0x1b')](_0x263e9a);return _0x54f136[_0xd43f('0x21')]('Content-Range',_0x22d86f+'-'+_0x2e2396+'/'+_0x5c03a6)[_0xd43f('0x1c')](_0x351c9c);}return null;};}function patchUpdates(_0x5bae9e){return function(_0x1ad9d3){try{jsonpatch['apply'](_0x1ad9d3,_0x5bae9e,!![]);}catch(_0x1ce702){return BPromise[_0xd43f('0x22')](_0x1ce702);}return _0x1ad9d3['save']();};}function saveUpdates(_0x37da4a,_0x1c79b8){return function(_0x15a7d9){if(_0x15a7d9){return _0x15a7d9['update'](_0x37da4a)[_0xd43f('0x23')](function(_0x51c68c){return _0x51c68c;});}return null;};}function removeEntity(_0x3ff3dc,_0x4646c2){return function(_0x1bf18d){if(_0x1bf18d){return _0x1bf18d[_0xd43f('0x24')]()[_0xd43f('0x23')](function(){var _0x364d67=_0x1bf18d['get']({'plain':!![]});var _0x3cf19f=_0xd43f('0x25');return db[_0xd43f('0x26')][_0xd43f('0x24')]({'where':{'type':_0x3cf19f,'resourceId':_0x364d67['id']}})[_0xd43f('0x23')](function(){return _0x1bf18d;});})[_0xd43f('0x23')](function(){_0x3ff3dc[_0xd43f('0x1b')](0xcc)[_0xd43f('0x27')]();});}};}function handleEntityNotFound(_0x207cb7,_0x4255ea){return function(_0x5bcdfd){if(!_0x5bcdfd){_0x207cb7[_0xd43f('0x1a')](0x194);}return _0x5bcdfd;};}function handleError(_0x353b64,_0xed6845){_0xed6845=_0xed6845||0x1f4;return function(_0x1215cf){logger[_0xd43f('0x28')](_0x1215cf[_0xd43f('0x29')]);if(_0x1215cf[_0xd43f('0x2a')]){delete _0x1215cf[_0xd43f('0x2a')];}_0x353b64[_0xd43f('0x1b')](_0xed6845)[_0xd43f('0x2b')](_0x1215cf);};}exports[_0xd43f('0x2c')]=function(_0xf469b2,_0x136b99){var _0xe680a3={},_0x459f67={},_0x19fd9b={'count':0x0,'rows':[]};var _0x595c5d=_[_0xd43f('0x2d')](db[_0xd43f('0x2e')]['rawAttributes'],function(_0x3de6ca){return{'name':_0x3de6ca['fieldName'],'type':_0x3de6ca[_0xd43f('0x2f')]['key']};});_0x459f67[_0xd43f('0x30')]=_['map'](_0x595c5d,_0xd43f('0x2a'));_0x459f67['query']=_[_0xd43f('0x31')](_0xf469b2[_0xd43f('0x32')]);_0x459f67['filters']=_[_0xd43f('0x33')](_0x459f67[_0xd43f('0x30')],_0x459f67[_0xd43f('0x32')]);_0xe680a3[_0xd43f('0x34')]=_[_0xd43f('0x33')](_0x459f67[_0xd43f('0x30')],qs['fields'](_0xf469b2[_0xd43f('0x32')][_0xd43f('0x35')]));_0xe680a3['attributes']=_0xe680a3[_0xd43f('0x34')][_0xd43f('0x36')]?_0xe680a3[_0xd43f('0x34')]:_0x459f67[_0xd43f('0x30')];if(!_0xf469b2[_0xd43f('0x32')]['hasOwnProperty'](_0xd43f('0x37'))){_0xe680a3['limit']=qs[_0xd43f('0x20')](_0xf469b2[_0xd43f('0x32')][_0xd43f('0x20')]);_0xe680a3[_0xd43f('0x1d')]=qs[_0xd43f('0x1d')](_0xf469b2[_0xd43f('0x32')]['offset']);}_0xe680a3[_0xd43f('0x38')]=qs[_0xd43f('0x39')](_0xf469b2['query'][_0xd43f('0x39')]);_0xe680a3[_0xd43f('0x3a')]=qs[_0xd43f('0x3b')](_['pick'](_0xf469b2[_0xd43f('0x32')],_0x459f67['filters']),_0x595c5d);if(_0xf469b2[_0xd43f('0x32')][_0xd43f('0x3c')]){_0xe680a3['where']=_[_0xd43f('0x3d')](_0xe680a3['where'],{'$or':_[_0xd43f('0x2d')](_0x595c5d,function(_0x2c7609){if(_0x2c7609['type']!=='VIRTUAL'){var _0x5e7a0a={};_0x5e7a0a[_0x2c7609['name']]={'$like':'%'+_0xf469b2[_0xd43f('0x32')][_0xd43f('0x3c')]+'%'};return _0x5e7a0a;}})});}_0xe680a3=_[_0xd43f('0x3d')]({},_0xe680a3,_0xf469b2[_0xd43f('0x3e')]);var _0x25e3ac={'where':_0xe680a3[_0xd43f('0x3a')]};return db[_0xd43f('0x2e')][_0xd43f('0x1f')](_0x25e3ac)['then'](function(_0x5f01a1){_0x19fd9b[_0xd43f('0x1f')]=_0x5f01a1;if(_0xf469b2[_0xd43f('0x32')][_0xd43f('0x3f')]){_0xe680a3[_0xd43f('0x40')]=[{'all':!![]}];}return db[_0xd43f('0x2e')][_0xd43f('0x41')](_0xe680a3);})[_0xd43f('0x23')](function(_0x335315){_0x19fd9b[_0xd43f('0x42')]=_0x335315;return _0x19fd9b;})['then'](respondWithFilteredResult(_0x136b99,_0xe680a3))[_0xd43f('0x43')](handleError(_0x136b99,null));};exports[_0xd43f('0x44')]=function(_0x417a58,_0x286d26){var _0xc72b3f={'raw':![],'where':{'id':_0x417a58[_0xd43f('0x45')]['id']}},_0x271a07={};_0x271a07[_0xd43f('0x30')]=_['keys'](db[_0xd43f('0x2e')]['rawAttributes']);_0x271a07[_0xd43f('0x32')]=_[_0xd43f('0x31')](_0x417a58[_0xd43f('0x32')]);_0x271a07['filters']=_['intersection'](_0x271a07[_0xd43f('0x30')],_0x271a07['query']);_0xc72b3f[_0xd43f('0x34')]=_[_0xd43f('0x33')](_0x271a07['model'],qs[_0xd43f('0x35')](_0x417a58[_0xd43f('0x32')][_0xd43f('0x35')]));_0xc72b3f[_0xd43f('0x34')]=_0xc72b3f[_0xd43f('0x34')]['length']?_0xc72b3f[_0xd43f('0x34')]:_0x271a07[_0xd43f('0x30')];if(_0x417a58[_0xd43f('0x32')]['includeAll']){_0xc72b3f[_0xd43f('0x40')]=[{'all':!![]}];}_0xc72b3f=_[_0xd43f('0x3d')]({},_0xc72b3f,_0x417a58['options']);return db[_0xd43f('0x2e')][_0xd43f('0x46')](_0xc72b3f)[_0xd43f('0x23')](handleEntityNotFound(_0x286d26,null))[_0xd43f('0x23')](respondWithResult(_0x286d26,null))[_0xd43f('0x43')](handleError(_0x286d26,null));};exports['create']=function(_0x4ae991,_0x13f856){return db[_0xd43f('0x2e')]['create'](_0x4ae991[_0xd43f('0x47')],{})[_0xd43f('0x23')](function(_0x1660ca){var _0x49e396=_0x4ae991[_0xd43f('0x48')][_0xd43f('0x49')]({'plain':!![]});if(!_0x49e396)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x49e396['role']===_0xd43f('0x48')){var _0x2625c6=_0x1660ca[_0xd43f('0x49')]({'plain':!![]});var _0x4cd5a0=_0xd43f('0x25');return db['UserProfileSection'][_0xd43f('0x46')]({'where':{'name':_0x4cd5a0,'userProfileId':_0x49e396['userProfileId']},'raw':!![]})[_0xd43f('0x23')](function(_0x51833e){if(_0x51833e&&_0x51833e[_0xd43f('0x4a')]===0x0){return db['UserProfileResource'][_0xd43f('0x4b')]({'name':_0x2625c6[_0xd43f('0x2a')],'resourceId':_0x2625c6['id'],'type':_0x51833e['name'],'sectionId':_0x51833e['id']},{})[_0xd43f('0x23')](function(){return _0x1660ca;});}else{return _0x1660ca;}})['catch'](function(_0x453e45){logger[_0xd43f('0x28')](_0xd43f('0x4c'),_0x453e45);throw _0x453e45;});}return _0x1660ca;})['then'](respondWithResult(_0x13f856,0xc9))[_0xd43f('0x43')](handleError(_0x13f856,null));};exports[_0xd43f('0x4d')]=function(_0x4986bd,_0x2860da){if(_0x4986bd[_0xd43f('0x47')]['id']){delete _0x4986bd[_0xd43f('0x47')]['id'];}return db[_0xd43f('0x2e')][_0xd43f('0x46')]({'where':{'id':_0x4986bd[_0xd43f('0x45')]['id']}})[_0xd43f('0x23')](handleEntityNotFound(_0x2860da,null))['then'](saveUpdates(_0x4986bd['body'],null))[_0xd43f('0x23')](respondWithResult(_0x2860da,null))['catch'](handleError(_0x2860da,null));};exports[_0xd43f('0x24')]=function(_0xacb602,_0x52ff4c){return db[_0xd43f('0x2e')][_0xd43f('0x46')]({'where':{'id':_0xacb602[_0xd43f('0x45')]['id']}})[_0xd43f('0x23')](handleEntityNotFound(_0x52ff4c,null))[_0xd43f('0x23')](removeEntity(_0x52ff4c,null))[_0xd43f('0x43')](handleError(_0x52ff4c,null));}; \ No newline at end of file +var _0xf2a6=['mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','ChanSpies','UserProfileResource','destroy','error','stack','name','send','index','map','VoiceChanSpy','type','key','query','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','sort','where','filters','merge','VIRTUAL','filter','options','includeAll','include','catch','show','params','keys','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','request-promise','bluebird'];(function(_0x576f60,_0x5522de){var _0x364982=function(_0x47932d){while(--_0x47932d){_0x576f60['push'](_0x576f60['shift']());}};_0x364982(++_0x5522de);}(_0xf2a6,0x13d));var _0x6f2a=function(_0x11ecc8,_0x44edcf){_0x11ecc8=_0x11ecc8-0x0;var _0x21057d=_0xf2a6[_0x11ecc8];return _0x21057d;};'use strict';var emlformat=require(_0x6f2a('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6f2a('0x1'));var moment=require('moment');var BPromise=require(_0x6f2a('0x2'));var Mustache=require(_0x6f2a('0x3'));var util=require(_0x6f2a('0x4'));var path=require(_0x6f2a('0x5'));var sox=require(_0x6f2a('0x6'));var csv=require(_0x6f2a('0x7'));var ejs=require(_0x6f2a('0x8'));var fs=require('fs');var fs_extra=require(_0x6f2a('0x9'));var _=require(_0x6f2a('0xa'));var squel=require(_0x6f2a('0xb'));var crypto=require('crypto');var jsforce=require(_0x6f2a('0xc'));var deskjs=require(_0x6f2a('0xd'));var toCsv=require(_0x6f2a('0x7'));var querystring=require(_0x6f2a('0xe'));var Papa=require('papaparse');var Redis=require(_0x6f2a('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x6f2a('0x10'));var as=require(_0x6f2a('0x11'));var hardwareService=require(_0x6f2a('0x12'));var logger=require('../../config/logger')(_0x6f2a('0x13'));var utils=require('../../config/utils');var config=require(_0x6f2a('0x14'));var licenseUtil=require(_0x6f2a('0x15'));var db=require(_0x6f2a('0x16'))['db'];function respondWithStatusCode(_0x59df4e,_0x46a54f){_0x46a54f=_0x46a54f||0xcc;return function(_0x4f1b32){if(_0x4f1b32){return _0x59df4e[_0x6f2a('0x17')](_0x46a54f);}return _0x59df4e[_0x6f2a('0x18')](_0x46a54f)[_0x6f2a('0x19')]();};}function respondWithResult(_0x421e15,_0xe24075){_0xe24075=_0xe24075||0xc8;return function(_0x5224e6){if(_0x5224e6){return _0x421e15[_0x6f2a('0x18')](_0xe24075)[_0x6f2a('0x1a')](_0x5224e6);}};}function respondWithFilteredResult(_0x27ca04,_0x44b317){return function(_0x1057f2){if(_0x1057f2){var _0x3dfc44=typeof _0x44b317[_0x6f2a('0x1b')]===_0x6f2a('0x1c')&&typeof _0x44b317[_0x6f2a('0x1d')]===_0x6f2a('0x1c');var _0x2aaed5=_0x1057f2[_0x6f2a('0x1e')];var _0x5c408b=_0x3dfc44?0x0:_0x44b317[_0x6f2a('0x1b')];var _0x3171b9=_0x3dfc44?_0x1057f2[_0x6f2a('0x1e')]:_0x44b317[_0x6f2a('0x1b')]+_0x44b317[_0x6f2a('0x1d')];var _0x43602b;if(_0x3171b9>=_0x2aaed5){_0x3171b9=_0x2aaed5;_0x43602b=0xc8;}else{_0x43602b=0xce;}_0x27ca04[_0x6f2a('0x18')](_0x43602b);return _0x27ca04[_0x6f2a('0x1f')](_0x6f2a('0x20'),_0x5c408b+'-'+_0x3171b9+'/'+_0x2aaed5)[_0x6f2a('0x1a')](_0x1057f2);}return null;};}function patchUpdates(_0x33554f){return function(_0x4eca00){try{jsonpatch[_0x6f2a('0x21')](_0x4eca00,_0x33554f,!![]);}catch(_0x20e7ff){return BPromise[_0x6f2a('0x22')](_0x20e7ff);}return _0x4eca00[_0x6f2a('0x23')]();};}function saveUpdates(_0x1da29f,_0x108b8b){return function(_0x28a8c2){if(_0x28a8c2){return _0x28a8c2['update'](_0x1da29f)[_0x6f2a('0x24')](function(_0x590c40){return _0x590c40;});}return null;};}function removeEntity(_0xb7de5a,_0x301aa9){return function(_0x148240){if(_0x148240){return _0x148240['destroy']()[_0x6f2a('0x24')](function(){var _0xb7cd00=_0x148240['get']({'plain':!![]});var _0x55c1bc=_0x6f2a('0x25');return db[_0x6f2a('0x26')][_0x6f2a('0x27')]({'where':{'type':_0x55c1bc,'resourceId':_0xb7cd00['id']}})[_0x6f2a('0x24')](function(){return _0x148240;});})[_0x6f2a('0x24')](function(){_0xb7de5a['status'](0xcc)[_0x6f2a('0x19')]();});}};}function handleEntityNotFound(_0x549dd7,_0x3ac571){return function(_0xd64d6){if(!_0xd64d6){_0x549dd7['sendStatus'](0x194);}return _0xd64d6;};}function handleError(_0x3973e8,_0x409ea4){_0x409ea4=_0x409ea4||0x1f4;return function(_0x498d7e){logger[_0x6f2a('0x28')](_0x498d7e[_0x6f2a('0x29')]);if(_0x498d7e[_0x6f2a('0x2a')]){delete _0x498d7e[_0x6f2a('0x2a')];}_0x3973e8[_0x6f2a('0x18')](_0x409ea4)[_0x6f2a('0x2b')](_0x498d7e);};}exports[_0x6f2a('0x2c')]=function(_0x4da5dc,_0xb0f466){var _0x5a0a3c={},_0x34acb0={},_0x4e188f={'count':0x0,'rows':[]};var _0x34b78e=_[_0x6f2a('0x2d')](db[_0x6f2a('0x2e')]['rawAttributes'],function(_0xedbbba){return{'name':_0xedbbba['fieldName'],'type':_0xedbbba[_0x6f2a('0x2f')][_0x6f2a('0x30')]};});_0x34acb0['model']=_[_0x6f2a('0x2d')](_0x34b78e,_0x6f2a('0x2a'));_0x34acb0[_0x6f2a('0x31')]=_['keys'](_0x4da5dc['query']);_0x34acb0['filters']=_[_0x6f2a('0x32')](_0x34acb0['model'],_0x34acb0[_0x6f2a('0x31')]);_0x5a0a3c[_0x6f2a('0x33')]=_['intersection'](_0x34acb0[_0x6f2a('0x34')],qs[_0x6f2a('0x35')](_0x4da5dc[_0x6f2a('0x31')][_0x6f2a('0x35')]));_0x5a0a3c['attributes']=_0x5a0a3c[_0x6f2a('0x33')]['length']?_0x5a0a3c[_0x6f2a('0x33')]:_0x34acb0[_0x6f2a('0x34')];if(!_0x4da5dc[_0x6f2a('0x31')][_0x6f2a('0x36')](_0x6f2a('0x37'))){_0x5a0a3c[_0x6f2a('0x1d')]=qs[_0x6f2a('0x1d')](_0x4da5dc['query'][_0x6f2a('0x1d')]);_0x5a0a3c[_0x6f2a('0x1b')]=qs[_0x6f2a('0x1b')](_0x4da5dc[_0x6f2a('0x31')][_0x6f2a('0x1b')]);}_0x5a0a3c[_0x6f2a('0x38')]=qs[_0x6f2a('0x39')](_0x4da5dc[_0x6f2a('0x31')][_0x6f2a('0x39')]);_0x5a0a3c[_0x6f2a('0x3a')]=qs[_0x6f2a('0x3b')](_['pick'](_0x4da5dc[_0x6f2a('0x31')],_0x34acb0[_0x6f2a('0x3b')]),_0x34b78e);if(_0x4da5dc[_0x6f2a('0x31')]['filter']){_0x5a0a3c[_0x6f2a('0x3a')]=_[_0x6f2a('0x3c')](_0x5a0a3c[_0x6f2a('0x3a')],{'$or':_[_0x6f2a('0x2d')](_0x34b78e,function(_0x2dfd7d){if(_0x2dfd7d[_0x6f2a('0x2f')]!==_0x6f2a('0x3d')){var _0x44c61d={};_0x44c61d[_0x2dfd7d[_0x6f2a('0x2a')]]={'$like':'%'+_0x4da5dc[_0x6f2a('0x31')][_0x6f2a('0x3e')]+'%'};return _0x44c61d;}})});}_0x5a0a3c=_['merge']({},_0x5a0a3c,_0x4da5dc[_0x6f2a('0x3f')]);var _0xccc1c={'where':_0x5a0a3c[_0x6f2a('0x3a')]};return db['VoiceChanSpy'][_0x6f2a('0x1e')](_0xccc1c)[_0x6f2a('0x24')](function(_0x14f869){_0x4e188f[_0x6f2a('0x1e')]=_0x14f869;if(_0x4da5dc[_0x6f2a('0x31')][_0x6f2a('0x40')]){_0x5a0a3c[_0x6f2a('0x41')]=[{'all':!![]}];}return db[_0x6f2a('0x2e')]['findAll'](_0x5a0a3c);})[_0x6f2a('0x24')](function(_0x5be543){_0x4e188f['rows']=_0x5be543;return _0x4e188f;})[_0x6f2a('0x24')](respondWithFilteredResult(_0xb0f466,_0x5a0a3c))[_0x6f2a('0x42')](handleError(_0xb0f466,null));};exports[_0x6f2a('0x43')]=function(_0xfe3724,_0x4b5782){var _0x3e43cd={'raw':![],'where':{'id':_0xfe3724[_0x6f2a('0x44')]['id']}},_0x10bf26={};_0x10bf26[_0x6f2a('0x34')]=_[_0x6f2a('0x45')](db[_0x6f2a('0x2e')]['rawAttributes']);_0x10bf26[_0x6f2a('0x31')]=_[_0x6f2a('0x45')](_0xfe3724[_0x6f2a('0x31')]);_0x10bf26[_0x6f2a('0x3b')]=_[_0x6f2a('0x32')](_0x10bf26[_0x6f2a('0x34')],_0x10bf26['query']);_0x3e43cd['attributes']=_[_0x6f2a('0x32')](_0x10bf26['model'],qs[_0x6f2a('0x35')](_0xfe3724['query'][_0x6f2a('0x35')]));_0x3e43cd[_0x6f2a('0x33')]=_0x3e43cd['attributes']['length']?_0x3e43cd['attributes']:_0x10bf26[_0x6f2a('0x34')];if(_0xfe3724['query']['includeAll']){_0x3e43cd[_0x6f2a('0x41')]=[{'all':!![]}];}_0x3e43cd=_[_0x6f2a('0x3c')]({},_0x3e43cd,_0xfe3724[_0x6f2a('0x3f')]);return db[_0x6f2a('0x2e')]['find'](_0x3e43cd)[_0x6f2a('0x24')](handleEntityNotFound(_0x4b5782,null))[_0x6f2a('0x24')](respondWithResult(_0x4b5782,null))[_0x6f2a('0x42')](handleError(_0x4b5782,null));};exports[_0x6f2a('0x46')]=function(_0x3d8f60,_0xb59bd1){return db['VoiceChanSpy'][_0x6f2a('0x46')](_0x3d8f60[_0x6f2a('0x47')],{})[_0x6f2a('0x24')](function(_0xfd6940){var _0x1f6a48=_0x3d8f60[_0x6f2a('0x48')]['get']({'plain':!![]});if(!_0x1f6a48)throw new Error(_0x6f2a('0x49'));if(_0x1f6a48[_0x6f2a('0x4a')]===_0x6f2a('0x48')){var _0x5e72fe=_0xfd6940['get']({'plain':!![]});var _0x435fec=_0x6f2a('0x25');return db[_0x6f2a('0x4b')][_0x6f2a('0x4c')]({'where':{'name':_0x435fec,'userProfileId':_0x1f6a48[_0x6f2a('0x4d')]},'raw':!![]})[_0x6f2a('0x24')](function(_0x450160){if(_0x450160&&_0x450160[_0x6f2a('0x4e')]===0x0){return db[_0x6f2a('0x26')][_0x6f2a('0x46')]({'name':_0x5e72fe[_0x6f2a('0x2a')],'resourceId':_0x5e72fe['id'],'type':_0x450160[_0x6f2a('0x2a')],'sectionId':_0x450160['id']},{})[_0x6f2a('0x24')](function(){return _0xfd6940;});}else{return _0xfd6940;}})['catch'](function(_0x2c26fc){logger['error'](_0x6f2a('0x4f'),_0x2c26fc);throw _0x2c26fc;});}return _0xfd6940;})['then'](respondWithResult(_0xb59bd1,0xc9))[_0x6f2a('0x42')](handleError(_0xb59bd1,null));};exports['update']=function(_0x13d759,_0x1c1ad9){if(_0x13d759[_0x6f2a('0x47')]['id']){delete _0x13d759['body']['id'];}return db[_0x6f2a('0x2e')]['find']({'where':{'id':_0x13d759[_0x6f2a('0x44')]['id']}})['then'](handleEntityNotFound(_0x1c1ad9,null))['then'](saveUpdates(_0x13d759[_0x6f2a('0x47')],null))[_0x6f2a('0x24')](respondWithResult(_0x1c1ad9,null))[_0x6f2a('0x42')](handleError(_0x1c1ad9,null));};exports[_0x6f2a('0x27')]=function(_0x429acf,_0x30f41f){return db[_0x6f2a('0x2e')]['find']({'where':{'id':_0x429acf[_0x6f2a('0x44')]['id']}})[_0x6f2a('0x24')](handleEntityNotFound(_0x30f41f,null))[_0x6f2a('0x24')](removeEntity(_0x30f41f,null))[_0x6f2a('0x42')](handleError(_0x30f41f,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 4b5cfdc..9703bf4 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 _0x6d4f=['VoiceExtension','destroy','bulkCreate','bluebird','./voiceChanSpy.attributes','context','from-sip','%s%s','prefix','system','push','Set','format','chanspy','record','merge','MixMonitor','recordingFormat','auth','options','join','length','concat','internal','name','User','agent','then','catch','models','define','VoiceChanSpy','voice_chanspy'];(function(_0x10482b,_0x1461c7){var _0x2388d4=function(_0x2bbc6c){while(--_0x2bbc6c){_0x10482b['push'](_0x10482b['shift']());}};_0x2388d4(++_0x1461c7);}(_0x6d4f,0x16e));var _0xf6d4=function(_0x53e29e,_0x17c540){_0x53e29e=_0x53e29e-0x0;var _0x54c118=_0x6d4f[_0x53e29e];return _0x54c118;};'use strict';var _=require('lodash');var util=require('util');var BPromise=require(_0xf6d4('0x0'));var attributes=require(_0xf6d4('0x1'));var getUserApplications=function(_0x4099e2,_0x56a91a,_0x1b4995){var _0x221a68=0x1;var _0x1e24ef=[];var _0x331504={'context':_0x56a91a[_0xf6d4('0x2')]||_0xf6d4('0x3'),'exten':util['format'](_0xf6d4('0x4'),_0x4099e2[_0xf6d4('0x5')],_0x1b4995),'type':_0xf6d4('0x6'),'isApp':![],'ChanSpyId':_0x4099e2['id'],'UserId':_0x56a91a['id']};_0x1e24ef[_0xf6d4('0x7')](_['merge']({'app':_0xf6d4('0x8'),'appdata':util[_0xf6d4('0x9')]('CDR(type)=%s',_0xf6d4('0xa')),'priority':_0x221a68++},_0x331504));if(_0x4099e2[_0xf6d4('0xb')]){_0x1e24ef[_0xf6d4('0x7')](_[_0xf6d4('0xc')]({'app':_0xf6d4('0xd'),'appdata':util[_0xf6d4('0x9')]('${UNIQUEID}.%s,a',_0x4099e2[_0xf6d4('0xe')]),'priority':_0x221a68++},_0x331504));}if(_0x4099e2[_0xf6d4('0xf')]){_0x1e24ef['push'](_[_0xf6d4('0xc')]({'app':'Authenticate','appdata':_0x4099e2['password'],'priority':_0x221a68++},_0x331504));}_0x1e24ef[_0xf6d4('0x7')](_[_0xf6d4('0xc')]({'app':'ChanSpy','appdata':util['format']('SIP/%s,%s',_0x56a91a['name'],_0x4099e2[_0xf6d4('0x10')]?_0x4099e2[_0xf6d4('0x10')][_0xf6d4('0x11')](''):''),'priority':_0x221a68++},_0x331504));if(_0x4099e2['record']){_0x1e24ef[_0xf6d4('0x7')](_[_0xf6d4('0xc')]({'app':'StopMixMonitor','priority':_0x221a68++},_0x331504));}return _0x1e24ef;};var getChanSpyApplications=function(_0x2c1191,_0x20fa7f){var _0x13fd8d=[];for(var _0x3cccfc=0x0,_0x472b3e=0x1;_0x3cccfc<_0x20fa7f[_0xf6d4('0x12')];_0x3cccfc++,_0x472b3e=0x1){_0x13fd8d=_0x13fd8d[_0xf6d4('0x13')](getUserApplications(_0x2c1191,_0x20fa7f[_0x3cccfc],_0x20fa7f[_0x3cccfc]['internal']));if(_0x20fa7f[_0x3cccfc][_0xf6d4('0x14')]!=_0x20fa7f[_0x3cccfc][_0xf6d4('0x15')]){_0x13fd8d=_0x13fd8d[_0xf6d4('0x13')](getUserApplications(_0x2c1191,_0x20fa7f[_0x3cccfc],_0x20fa7f[_0x3cccfc][_0xf6d4('0x15')]));}}return _0x13fd8d;};var getChanSpyPromise=function(_0x20df68,_0x3949c3){return new BPromise(function(_0x9eb901,_0x1b098f){return _0x20df68[_0xf6d4('0x16')]['findAll']({'attributes':['id',_0xf6d4('0x15'),_0xf6d4('0x14')],'where':{'role':_0xf6d4('0x17'),'chanspy':!![]},'raw':!![]})[_0xf6d4('0x18')](function(_0x3d5646){if(_0x3d5646){return _0x9eb901(getChanSpyApplications(_0x3949c3,_0x3d5646));}return _0x9eb901([]);})[_0xf6d4('0x19')](function(_0x2ab8dc){_0x1b098f(_0x2ab8dc);});});};module['exports']=function(_0xc9d5e4,_0x324bc9){var _0x70ea27=_0xc9d5e4[_0xf6d4('0x1a')];return _0xc9d5e4[_0xf6d4('0x1b')](_0xf6d4('0x1c'),attributes,{'tableName':_0xf6d4('0x1d'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x1a2ed8,_0x28db49,_0x553238){return getChanSpyPromise(_0x70ea27,_0x1a2ed8)[_0xf6d4('0x18')](function(_0x2a57a2){if(_0x2a57a2&&_0x2a57a2[_0xf6d4('0x12')]){return _0x70ea27[_0xf6d4('0x1e')]['bulkCreate'](_0x2a57a2);}})[_0xf6d4('0x18')](function(){_0x553238();})[_0xf6d4('0x19')](function(_0x6c7ae6){_0x553238(_0x6c7ae6);});},'afterUpdate':function(_0x424a70,_0x871729,_0x28fcb0){return _0x70ea27[_0xf6d4('0x1e')][_0xf6d4('0x1f')]({'where':{'ChanSpyId':_0x424a70['id']}})[_0xf6d4('0x18')](function(){return getChanSpyPromise(_0x70ea27,_0x424a70);})[_0xf6d4('0x18')](function(_0x1f572c){if(_0x1f572c&&_0x1f572c[_0xf6d4('0x12')]){return _0x70ea27[_0xf6d4('0x1e')][_0xf6d4('0x20')](_0x1f572c);}})['then'](function(){_0x28fcb0();})[_0xf6d4('0x19')](function(_0x27a125){_0x28fcb0(_0x27a125);});},'afterDestroy':function(_0x44bc2c,_0x213aa3,_0x56633a){return _0x70ea27[_0xf6d4('0x1e')]['destroy']({'where':{'ChanSpyId':_0x44bc2c['id']}})[_0xf6d4('0x18')](function(){_0x56633a();})[_0xf6d4('0x19')](function(_0x32e4e2){_0x56633a(_0x32e4e2);});}}});}; \ No newline at end of file +var _0x9383=['destroy','VoiceExtension','lodash','./voiceChanSpy.attributes','context','format','%s%s','system','merge','Set','CDR(type)=%s','chanspy','record','push','MixMonitor','${UNIQUEID}.%s,a','auth','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','join','length','concat','internal','User','agent','exports','models','define','VoiceChanSpy','then','bulkCreate','catch'];(function(_0x4480c1,_0x319692){var _0x1e040b=function(_0x5ddb94){while(--_0x5ddb94){_0x4480c1['push'](_0x4480c1['shift']());}};_0x1e040b(++_0x319692);}(_0x9383,0x6e));var _0x3938=function(_0x37206b,_0x18fb8a){_0x37206b=_0x37206b-0x0;var _0x2f42ac=_0x9383[_0x37206b];return _0x2f42ac;};'use strict';var _=require(_0x3938('0x0'));var util=require('util');var BPromise=require('bluebird');var attributes=require(_0x3938('0x1'));var getUserApplications=function(_0x2cd073,_0x435614,_0x182f19){var _0x23a508=0x1;var _0x2af90c=[];var _0x529fa5={'context':_0x435614[_0x3938('0x2')]||'from-sip','exten':util[_0x3938('0x3')](_0x3938('0x4'),_0x2cd073['prefix'],_0x182f19),'type':_0x3938('0x5'),'isApp':![],'ChanSpyId':_0x2cd073['id'],'UserId':_0x435614['id']};_0x2af90c['push'](_[_0x3938('0x6')]({'app':_0x3938('0x7'),'appdata':util['format'](_0x3938('0x8'),_0x3938('0x9')),'priority':_0x23a508++},_0x529fa5));if(_0x2cd073[_0x3938('0xa')]){_0x2af90c[_0x3938('0xb')](_[_0x3938('0x6')]({'app':_0x3938('0xc'),'appdata':util[_0x3938('0x3')](_0x3938('0xd'),_0x2cd073['recordingFormat']),'priority':_0x23a508++},_0x529fa5));}if(_0x2cd073[_0x3938('0xe')]){_0x2af90c[_0x3938('0xb')](_[_0x3938('0x6')]({'app':_0x3938('0xf'),'appdata':_0x2cd073[_0x3938('0x10')],'priority':_0x23a508++},_0x529fa5));}_0x2af90c['push'](_[_0x3938('0x6')]({'app':_0x3938('0x11'),'appdata':util[_0x3938('0x3')](_0x3938('0x12'),_0x435614[_0x3938('0x13')],_0x2cd073[_0x3938('0x14')]?_0x2cd073[_0x3938('0x14')][_0x3938('0x15')](''):''),'priority':_0x23a508++},_0x529fa5));if(_0x2cd073['record']){_0x2af90c['push'](_['merge']({'app':'StopMixMonitor','priority':_0x23a508++},_0x529fa5));}return _0x2af90c;};var getChanSpyApplications=function(_0x1d504a,_0x3be7e2){var _0x306d39=[];for(var _0x555706=0x0,_0x2e65fb=0x1;_0x555706<_0x3be7e2[_0x3938('0x16')];_0x555706++,_0x2e65fb=0x1){_0x306d39=_0x306d39[_0x3938('0x17')](getUserApplications(_0x1d504a,_0x3be7e2[_0x555706],_0x3be7e2[_0x555706]['internal']));if(_0x3be7e2[_0x555706][_0x3938('0x18')]!=_0x3be7e2[_0x555706][_0x3938('0x13')]){_0x306d39=_0x306d39['concat'](getUserApplications(_0x1d504a,_0x3be7e2[_0x555706],_0x3be7e2[_0x555706][_0x3938('0x13')]));}}return _0x306d39;};var getChanSpyPromise=function(_0x5edd72,_0x9bbaae){return new BPromise(function(_0x358d43,_0x11ea05){return _0x5edd72[_0x3938('0x19')]['findAll']({'attributes':['id','name',_0x3938('0x18')],'where':{'role':_0x3938('0x1a'),'chanspy':!![]},'raw':!![]})['then'](function(_0x539616){if(_0x539616){return _0x358d43(getChanSpyApplications(_0x9bbaae,_0x539616));}return _0x358d43([]);})['catch'](function(_0x17a9ba){_0x11ea05(_0x17a9ba);});});};module[_0x3938('0x1b')]=function(_0x393ff7,_0x5f4610){var _0x4e4b0d=_0x393ff7[_0x3938('0x1c')];return _0x393ff7[_0x3938('0x1d')](_0x3938('0x1e'),attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x4d9310,_0x2fc301,_0x1cd0ce){return getChanSpyPromise(_0x4e4b0d,_0x4d9310)[_0x3938('0x1f')](function(_0xec35d6){if(_0xec35d6&&_0xec35d6[_0x3938('0x16')]){return _0x4e4b0d['VoiceExtension'][_0x3938('0x20')](_0xec35d6);}})['then'](function(){_0x1cd0ce();})[_0x3938('0x21')](function(_0x264d7f){_0x1cd0ce(_0x264d7f);});},'afterUpdate':function(_0x5e3864,_0x1d52aa,_0x5b7f3f){return _0x4e4b0d['VoiceExtension'][_0x3938('0x22')]({'where':{'ChanSpyId':_0x5e3864['id']}})[_0x3938('0x1f')](function(){return getChanSpyPromise(_0x4e4b0d,_0x5e3864);})['then'](function(_0x6b43fd){if(_0x6b43fd&&_0x6b43fd['length']){return _0x4e4b0d[_0x3938('0x23')][_0x3938('0x20')](_0x6b43fd);}})[_0x3938('0x1f')](function(){_0x5b7f3f();})['catch'](function(_0x4d040e){_0x5b7f3f(_0x4d040e);});},'afterDestroy':function(_0x306f62,_0x54febe,_0x5c483e){return _0x4e4b0d[_0x3938('0x23')]['destroy']({'where':{'ChanSpyId':_0x306f62['id']}})[_0x3938('0x1f')](function(){_0x5c483e();})[_0x3938('0x21')](function(_0x1d49fa){_0x5c483e(_0x1d49fa);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index b7f7913..b294646 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 _0xb58b=['ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','bluebird'];(function(_0x3b259c,_0x2cb070){var _0x276cd6=function(_0x362784){while(--_0x362784){_0x3b259c['push'](_0x3b259c['shift']());}};_0x276cd6(++_0x2cb070);}(_0xb58b,0x1f1));var _0xbb58=function(_0x4cf4c8,_0x4291b2){_0x4cf4c8=_0x4cf4c8-0x0;var _0x3410ca=_0xb58b[_0x4cf4c8];return _0x3410ca;};'use strict';var _=require('lodash');var util=require(_0xbb58('0x0'));var moment=require(_0xbb58('0x1'));var BPromise=require(_0xbb58('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbb58('0x3'));var db=require(_0xbb58('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xbb58('0x5'))('rpc');var config=require(_0xbb58('0x6'));var jayson=require(_0xbb58('0x7'));var client=jayson[_0xbb58('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x27cbda,_0x323066,_0xe874f2){return new BPromise(function(_0x5d7fe8,_0xd94f1){return client[_0xbb58('0x9')](_0x27cbda,_0xe874f2)[_0xbb58('0xa')](function(_0x36ca50){logger[_0xbb58('0xb')](_0xbb58('0xc'),_0x323066,_0xbb58('0xd'));logger['debug'](_0xbb58('0xe'),_0x323066,'request\x20sent',JSON[_0xbb58('0xf')](_0x36ca50));if(_0x36ca50[_0xbb58('0x10')]){if(_0x36ca50[_0xbb58('0x10')][_0xbb58('0x11')]===0x1f4){logger['error'](_0xbb58('0xc'),_0x323066,_0x36ca50[_0xbb58('0x10')]['message']);return _0xd94f1(_0x36ca50[_0xbb58('0x10')][_0xbb58('0x12')]);}logger[_0xbb58('0x10')](_0xbb58('0xc'),_0x323066,_0x36ca50[_0xbb58('0x10')]['message']);return _0x5d7fe8(_0x36ca50[_0xbb58('0x10')][_0xbb58('0x12')]);}else{logger['info']('VoiceChanSpy,\x20%s,\x20%s',_0x323066,_0xbb58('0xd'));_0x5d7fe8(_0x36ca50[_0xbb58('0x13')][_0xbb58('0x12')]);}})['catch'](function(_0x5edc97){logger['error']('VoiceChanSpy,\x20%s,\x20%s',_0x323066,_0x5edc97);_0xd94f1(_0x5edc97);});});} \ No newline at end of file +var _0x4058=['request','then','info','request\x20sent','debug','stringify','VoiceChanSpy,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4058,0x129));var _0x8405=function(_0x16d3d1,_0x5e31d8){_0x16d3d1=_0x16d3d1-0x0;var _0x11504c=_0x4058[_0x16d3d1];return _0x11504c;};'use strict';var _=require(_0x8405('0x0'));var util=require(_0x8405('0x1'));var moment=require(_0x8405('0x2'));var BPromise=require(_0x8405('0x3'));var rs=require(_0x8405('0x4'));var fs=require('fs');var Redis=require(_0x8405('0x5'));var db=require(_0x8405('0x6'))['db'];var utils=require(_0x8405('0x7'));var logger=require(_0x8405('0x8'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8405('0x9')][_0x8405('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3d9bf6,_0x1322e5,_0x1cb061){return new BPromise(function(_0x479c97,_0x16d810){return client[_0x8405('0xb')](_0x3d9bf6,_0x1cb061)[_0x8405('0xc')](function(_0x53bd7c){logger[_0x8405('0xd')]('VoiceChanSpy,\x20%s,\x20%s',_0x1322e5,_0x8405('0xe'));logger[_0x8405('0xf')]('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x1322e5,_0x8405('0xe'),JSON[_0x8405('0x10')](_0x53bd7c));if(_0x53bd7c['error']){if(_0x53bd7c['error']['code']===0x1f4){logger['error'](_0x8405('0x11'),_0x1322e5,_0x53bd7c['error']['message']);return _0x16d810(_0x53bd7c['error']['message']);}logger['error'](_0x8405('0x11'),_0x1322e5,_0x53bd7c[_0x8405('0x12')]['message']);return _0x479c97(_0x53bd7c[_0x8405('0x12')][_0x8405('0x13')]);}else{logger[_0x8405('0xd')](_0x8405('0x11'),_0x1322e5,'request\x20sent');_0x479c97(_0x53bd7c[_0x8405('0x14')][_0x8405('0x13')]);}})[_0x8405('0x15')](function(_0x30cef7){logger[_0x8405('0x12')](_0x8405('0x11'),_0x1322e5,_0x30cef7);_0x16d810(_0x30cef7);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 3bdad49..589c2aa 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 _0x6ef5=['delete','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','post','create','update'];(function(_0x406395,_0x1f83ac){var _0x5ed99f=function(_0x50a446){while(--_0x50a446){_0x406395['push'](_0x406395['shift']());}};_0x5ed99f(++_0x1f83ac);}(_0x6ef5,0x192));var _0x56ef=function(_0x1c8581,_0x5ec4f1){_0x1c8581=_0x1c8581-0x0;var _0x3d9f01=_0x6ef5[_0x1c8581];return _0x3d9f01;};'use strict';var multer=require('multer');var util=require(_0x56ef('0x0'));var path=require(_0x56ef('0x1'));var timeout=require('connect-timeout');var express=require(_0x56ef('0x2'));var router=express[_0x56ef('0x3')]();var fs_extra=require(_0x56ef('0x4'));var auth=require(_0x56ef('0x5'));var interaction=require(_0x56ef('0x6'));var config=require(_0x56ef('0x7'));var controller=require('./voiceContext.controller');router[_0x56ef('0x8')]('/',auth['isAuthenticated'](),controller[_0x56ef('0x9')]);router[_0x56ef('0x8')](_0x56ef('0xa'),auth[_0x56ef('0xb')](),controller[_0x56ef('0xc')]);router[_0x56ef('0xd')]('/',auth['isAuthenticated'](),controller[_0x56ef('0xe')]);router['put'](_0x56ef('0xa'),auth[_0x56ef('0xb')](),controller[_0x56ef('0xf')]);router[_0x56ef('0x10')](_0x56ef('0xa'),auth[_0x56ef('0xb')](),controller[_0x56ef('0x11')]);module[_0x56ef('0x12')]=router; \ No newline at end of file +var _0xb141=['put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceContext.controller','get','isAuthenticated','index','show','post'];(function(_0x4dcc2d,_0x422839){var _0x1bbd79=function(_0x173341){while(--_0x173341){_0x4dcc2d['push'](_0x4dcc2d['shift']());}};_0x1bbd79(++_0x422839);}(_0xb141,0x15a));var _0x1b14=function(_0x2f071f,_0x12cb52){_0x2f071f=_0x2f071f-0x0;var _0x1062ac=_0xb141[_0x2f071f];return _0x1062ac;};'use strict';var multer=require(_0x1b14('0x0'));var util=require(_0x1b14('0x1'));var path=require(_0x1b14('0x2'));var timeout=require(_0x1b14('0x3'));var express=require('express');var router=express[_0x1b14('0x4')]();var fs_extra=require(_0x1b14('0x5'));var auth=require(_0x1b14('0x6'));var interaction=require(_0x1b14('0x7'));var config=require('../../config/environment');var controller=require(_0x1b14('0x8'));router[_0x1b14('0x9')]('/',auth[_0x1b14('0xa')](),controller[_0x1b14('0xb')]);router['get']('/:id',auth[_0x1b14('0xa')](),controller[_0x1b14('0xc')]);router[_0x1b14('0xd')]('/',auth[_0x1b14('0xa')](),controller['create']);router[_0x1b14('0xe')](_0x1b14('0xf'),auth['isAuthenticated'](),controller[_0x1b14('0x10')]);router[_0x1b14('0x11')]('/:id',auth[_0x1b14('0xa')](),controller[_0x1b14('0x12')]);module[_0x1b14('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index a2e80e9..d9c9916 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 _0x442e=['name','STRING'];(function(_0xc9e72c,_0x5cdb65){var _0x3c3a8d=function(_0x73d03a){while(--_0x73d03a){_0xc9e72c['push'](_0xc9e72c['shift']());}};_0x3c3a8d(++_0x5cdb65);}(_0x442e,0x1d4));var _0xe442=function(_0x37802b,_0x43f5e3){_0x37802b=_0x37802b-0x0;var _0x1011fe=_0x442e[_0x37802b];return _0x1011fe;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xe442('0x0')},'description':{'type':Sequelize[_0xe442('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0x1037=['name','BOOLEAN','sequelize','STRING'];(function(_0x173113,_0x316a7c){var _0x3bea89=function(_0xd33ac1){while(--_0xd33ac1){_0x173113['push'](_0x173113['shift']());}};_0x3bea89(++_0x316a7c);}(_0x1037,0x6e));var _0x7103=function(_0xa79977,_0x4f7f12){_0xa79977=_0xa79977-0x0;var _0x109f10=_0x1037[_0xa79977];return _0x109f10;};'use strict';var Sequelize=require(_0x7103('0x0'));module['exports']={'name':{'type':Sequelize[_0x7103('0x1')],'unique':_0x7103('0x2')},'description':{'type':Sequelize[_0x7103('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x7103('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index d073f5e..3ac5447 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 _0x45ae=['render','eml-format','rimraf','zip-dir','request-promise','bluebird','util','path','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','request','then','info','request\x20sent','debug','stringify','error','VoiceContext,\x20%s,\x20%s','message','catch','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','get','Contexts','UserProfileResource','sendStatus','name','send','index','map','VoiceContext','fieldName','type','key','query','keys','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','rows','show','params','rawAttributes','include','find','body','findAll','readFileSync','join','root','server/files/templates/context.ejs','utf8','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Reload','chan_sip.so','destroy'];(function(_0x21b36c,_0x543483){var _0x236627=function(_0x174f99){while(--_0x174f99){_0x21b36c['push'](_0x21b36c['shift']());}};_0x236627(++_0x543483);}(_0x45ae,0x64));var _0xe45a=function(_0x572255,_0x486db9){_0x572255=_0x572255-0x0;var _0x5196e9=_0x45ae[_0x572255];return _0x5196e9;};'use strict';var emlformat=require(_0xe45a('0x0'));var rimraf=require(_0xe45a('0x1'));var zipdir=require(_0xe45a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe45a('0x3'));var moment=require('moment');var BPromise=require(_0xe45a('0x4'));var Mustache=require('mustache');var util=require(_0xe45a('0x5'));var path=require(_0xe45a('0x6'));var sox=require('sox');var csv=require(_0xe45a('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe45a('0x8'));var _=require(_0xe45a('0x9'));var squel=require(_0xe45a('0xa'));var crypto=require(_0xe45a('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xe45a('0xc'));var toCsv=require('to-csv');var querystring=require(_0xe45a('0xd'));var Papa=require(_0xe45a('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xe45a('0xf'));var as=require(_0xe45a('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe45a('0x11'))('api');var utils=require(_0xe45a('0x12'));var config=require(_0xe45a('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xe45a('0x14'))['db'];var jayson=require(_0xe45a('0x15'));var client=jayson[_0xe45a('0x16')]['http']({'port':0x232a});function respondWithRpcPromise(_0x19c553,_0x13db46,_0x53c1ec,_0x2a330d){return new BPromise(function(_0x227ecb,_0x1567a2){var _0x1ffda1=_0x2a330d||client;return _0x1ffda1[_0xe45a('0x17')](_0x19c553,_0x53c1ec)[_0xe45a('0x18')](function(_0x5e19b8){logger[_0xe45a('0x19')]('VoiceContext,\x20%s,\x20%s',_0x13db46,_0xe45a('0x1a'));logger[_0xe45a('0x1b')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x13db46,_0xe45a('0x1a'),JSON[_0xe45a('0x1c')](_0x5e19b8));if(_0x5e19b8[_0xe45a('0x1d')]){if(_0x5e19b8['error']['code']===0x1f4){logger[_0xe45a('0x1d')](_0xe45a('0x1e'),_0x13db46,_0x5e19b8[_0xe45a('0x1d')]['message']);return _0x1567a2(_0x5e19b8[_0xe45a('0x1d')][_0xe45a('0x1f')]);}logger[_0xe45a('0x1d')]('VoiceContext,\x20%s,\x20%s',_0x13db46,_0x5e19b8[_0xe45a('0x1d')][_0xe45a('0x1f')]);return _0x227ecb(_0x5e19b8[_0xe45a('0x1d')][_0xe45a('0x1f')]);}else{logger[_0xe45a('0x19')](_0xe45a('0x1e'),_0x13db46,_0xe45a('0x1a'));_0x227ecb(_0x5e19b8['result']['message']);}})[_0xe45a('0x20')](function(_0x263a5e){logger[_0xe45a('0x1d')]('VoiceContext,\x20%s,\x20%s',_0x13db46,_0x263a5e);_0x1567a2(_0x263a5e);});});}function respondWithStatusCode(_0x36f4fc,_0x570d73){_0x570d73=_0x570d73||0xcc;return function(_0x2369de){if(_0x2369de){return _0x36f4fc['sendStatus'](_0x570d73);}return _0x36f4fc[_0xe45a('0x21')](_0x570d73)[_0xe45a('0x22')]();};}function respondWithResult(_0x4df1f6,_0x537d32){_0x537d32=_0x537d32||0xc8;return function(_0xd366c5){if(_0xd366c5){return _0x4df1f6[_0xe45a('0x21')](_0x537d32)[_0xe45a('0x23')](_0xd366c5);}};}function respondWithFilteredResult(_0x17d87c,_0x1e72b3){return function(_0x448ee5){if(_0x448ee5){var _0x3fabf6=typeof _0x1e72b3[_0xe45a('0x24')]===_0xe45a('0x25')&&typeof _0x1e72b3[_0xe45a('0x26')]===_0xe45a('0x25');var _0x5ed882=_0x448ee5[_0xe45a('0x27')];var _0x3dc7f7=_0x3fabf6?0x0:_0x1e72b3[_0xe45a('0x24')];var _0x5d973c=_0x3fabf6?_0x448ee5[_0xe45a('0x27')]:_0x1e72b3[_0xe45a('0x24')]+_0x1e72b3[_0xe45a('0x26')];var _0x419396;if(_0x5d973c>=_0x5ed882){_0x5d973c=_0x5ed882;_0x419396=0xc8;}else{_0x419396=0xce;}_0x17d87c[_0xe45a('0x21')](_0x419396);return _0x17d87c[_0xe45a('0x28')](_0xe45a('0x29'),_0x3dc7f7+'-'+_0x5d973c+'/'+_0x5ed882)[_0xe45a('0x23')](_0x448ee5);}return null;};}function patchUpdates(_0xbffc08){return function(_0x1a3450){try{jsonpatch['apply'](_0x1a3450,_0xbffc08,!![]);}catch(_0x4e23e3){return BPromise['reject'](_0x4e23e3);}return _0x1a3450[_0xe45a('0x2a')]();};}function saveUpdates(_0x1624bf,_0x212f78){return function(_0x3430b5){if(_0x3430b5){return _0x3430b5[_0xe45a('0x2b')](_0x1624bf)['then'](function(_0x476963){return _0x476963;});}return null;};}function removeEntity(_0x9501df,_0x39029f){return function(_0x472174){if(_0x472174){return _0x472174['destroy']()[_0xe45a('0x18')](function(){var _0x4a7955=_0x472174[_0xe45a('0x2c')]({'plain':!![]});var _0xf832e7=_0xe45a('0x2d');return db[_0xe45a('0x2e')]['destroy']({'where':{'type':_0xf832e7,'resourceId':_0x4a7955['id']}})[_0xe45a('0x18')](function(){return _0x472174;});})[_0xe45a('0x18')](function(){_0x9501df[_0xe45a('0x21')](0xcc)[_0xe45a('0x22')]();});}};}function handleEntityNotFound(_0x3c6630,_0x5769af){return function(_0x53e5f9){if(!_0x53e5f9){_0x3c6630[_0xe45a('0x2f')](0x194);}return _0x53e5f9;};}function handleError(_0x36f4b9,_0x2297cd){_0x2297cd=_0x2297cd||0x1f4;return function(_0x21f24b){logger['error'](_0x21f24b['stack']);if(_0x21f24b[_0xe45a('0x30')]){delete _0x21f24b[_0xe45a('0x30')];}_0x36f4b9['status'](_0x2297cd)[_0xe45a('0x31')](_0x21f24b);};}exports[_0xe45a('0x32')]=function(_0x2205fe,_0x244474){var _0x3985fc={},_0x1eb795={},_0x2852aa={'count':0x0,'rows':[]};var _0x2b513b=_[_0xe45a('0x33')](db[_0xe45a('0x34')]['rawAttributes'],function(_0x2fc1e0){return{'name':_0x2fc1e0[_0xe45a('0x35')],'type':_0x2fc1e0[_0xe45a('0x36')][_0xe45a('0x37')]};});_0x1eb795['model']=_[_0xe45a('0x33')](_0x2b513b,_0xe45a('0x30'));_0x1eb795[_0xe45a('0x38')]=_[_0xe45a('0x39')](_0x2205fe[_0xe45a('0x38')]);_0x1eb795[_0xe45a('0x3a')]=_['intersection'](_0x1eb795[_0xe45a('0x3b')],_0x1eb795[_0xe45a('0x38')]);_0x3985fc['attributes']=_[_0xe45a('0x3c')](_0x1eb795[_0xe45a('0x3b')],qs[_0xe45a('0x3d')](_0x2205fe['query'][_0xe45a('0x3d')]));_0x3985fc[_0xe45a('0x3e')]=_0x3985fc[_0xe45a('0x3e')][_0xe45a('0x3f')]?_0x3985fc[_0xe45a('0x3e')]:_0x1eb795[_0xe45a('0x3b')];if(!_0x2205fe[_0xe45a('0x38')][_0xe45a('0x40')](_0xe45a('0x41'))){_0x3985fc[_0xe45a('0x26')]=qs[_0xe45a('0x26')](_0x2205fe['query'][_0xe45a('0x26')]);_0x3985fc[_0xe45a('0x24')]=qs['offset'](_0x2205fe['query'][_0xe45a('0x24')]);}_0x3985fc[_0xe45a('0x42')]=qs[_0xe45a('0x43')](_0x2205fe[_0xe45a('0x38')][_0xe45a('0x43')]);_0x3985fc[_0xe45a('0x44')]=qs['filters'](_['pick'](_0x2205fe[_0xe45a('0x38')],_0x1eb795['filters']),_0x2b513b);if(_0x2205fe[_0xe45a('0x38')][_0xe45a('0x45')]){_0x3985fc[_0xe45a('0x44')]=_[_0xe45a('0x46')](_0x3985fc['where'],{'$or':_[_0xe45a('0x33')](_0x2b513b,function(_0x2fcce1){if(_0x2fcce1[_0xe45a('0x36')]!=='VIRTUAL'){var _0x4d10db={};_0x4d10db[_0x2fcce1[_0xe45a('0x30')]]={'$like':'%'+_0x2205fe[_0xe45a('0x38')]['filter']+'%'};return _0x4d10db;}})});}_0x3985fc=_[_0xe45a('0x46')]({},_0x3985fc,_0x2205fe[_0xe45a('0x47')]);var _0x5889e9={'where':_0x3985fc[_0xe45a('0x44')]};return db['VoiceContext'][_0xe45a('0x27')](_0x5889e9)[_0xe45a('0x18')](function(_0x1fc0d3){_0x2852aa[_0xe45a('0x27')]=_0x1fc0d3;if(_0x2205fe[_0xe45a('0x38')][_0xe45a('0x48')]){_0x3985fc['include']=[{'all':!![]}];}return db[_0xe45a('0x34')]['findAll'](_0x3985fc);})[_0xe45a('0x18')](function(_0x39b152){_0x2852aa[_0xe45a('0x49')]=_0x39b152;return _0x2852aa;})['then'](respondWithFilteredResult(_0x244474,_0x3985fc))[_0xe45a('0x20')](handleError(_0x244474,null));};exports[_0xe45a('0x4a')]=function(_0x17044d,_0x16789e){var _0x434045={'raw':![],'where':{'id':_0x17044d[_0xe45a('0x4b')]['id']}},_0x3562e6={};_0x3562e6[_0xe45a('0x3b')]=_[_0xe45a('0x39')](db[_0xe45a('0x34')][_0xe45a('0x4c')]);_0x3562e6[_0xe45a('0x38')]=_[_0xe45a('0x39')](_0x17044d['query']);_0x3562e6[_0xe45a('0x3a')]=_['intersection'](_0x3562e6['model'],_0x3562e6[_0xe45a('0x38')]);_0x434045[_0xe45a('0x3e')]=_['intersection'](_0x3562e6[_0xe45a('0x3b')],qs[_0xe45a('0x3d')](_0x17044d[_0xe45a('0x38')][_0xe45a('0x3d')]));_0x434045['attributes']=_0x434045[_0xe45a('0x3e')]['length']?_0x434045[_0xe45a('0x3e')]:_0x3562e6[_0xe45a('0x3b')];if(_0x17044d[_0xe45a('0x38')][_0xe45a('0x48')]){_0x434045[_0xe45a('0x4d')]=[{'all':!![]}];}_0x434045=_[_0xe45a('0x46')]({},_0x434045,_0x17044d['options']);return db['VoiceContext'][_0xe45a('0x4e')](_0x434045)[_0xe45a('0x18')](handleEntityNotFound(_0x16789e,null))[_0xe45a('0x18')](respondWithResult(_0x16789e,null))[_0xe45a('0x20')](handleError(_0x16789e,null));};exports['create']=function(_0x48f609,_0x504807,_0x32425f){var _0x492733;return db['VoiceContext']['create'](_0x48f609[_0xe45a('0x4f')],{'raw':!![]})[_0xe45a('0x18')](function(_0x27739d){_0x492733=_0x27739d;return db[_0xe45a('0x34')][_0xe45a('0x50')]({'raw':!![]});})[_0xe45a('0x18')](function(_0x370faa){var _0x4f13c0=fs[_0xe45a('0x51')](path[_0xe45a('0x52')](config[_0xe45a('0x53')],_0xe45a('0x54')),_0xe45a('0x55'));var _0x37d08d=ejs['render'](_0x4f13c0,{'contexts':_0x370faa||[]});fs[_0xe45a('0x56')](_0xe45a('0x57'),_0x37d08d);})[_0xe45a('0x18')](function(){return respondWithRpcPromise('Reload','create',{'module':'chan_sip.so'});})[_0xe45a('0x18')](function(){var _0x471fe3=_0x48f609[_0xe45a('0x58')]['get']({'plain':!![]});if(!_0x471fe3)throw new Error(_0xe45a('0x59'));if(_0x471fe3[_0xe45a('0x5a')]===_0xe45a('0x58')){var _0x313b29=_0x492733[_0xe45a('0x2c')]({'plain':!![]});return db[_0xe45a('0x5b')][_0xe45a('0x4e')]({'where':{'name':'Contexts','userProfileId':_0x471fe3[_0xe45a('0x5c')]},'raw':!![]})[_0xe45a('0x18')](function(_0x21256e){if(_0x21256e&&_0x21256e['autoAssociation']===0x0){return db['UserProfileResource'][_0xe45a('0x5d')]({'name':_0x313b29[_0xe45a('0x30')],'resourceId':_0x313b29['id'],'type':_0x21256e[_0xe45a('0x30')],'sectionId':_0x21256e['id']},{})['then'](function(){return _0x492733;});}else{return _0x492733;}})[_0xe45a('0x20')](function(_0x212fa8){logger[_0xe45a('0x1d')](_0xe45a('0x5e'),_0x212fa8);throw _0x212fa8;});}return _0x492733;})[_0xe45a('0x18')](respondWithResult(_0x504807,0xc9))[_0xe45a('0x20')](handleError(_0x504807,null));};exports[_0xe45a('0x2b')]=function(_0x9e9b81,_0x51d84b,_0x4e3a77){var _0x9b14d3;return db['VoiceContext']['find']({'where':{'id':_0x9e9b81[_0xe45a('0x4b')]['id']}})['then'](handleEntityNotFound(_0x51d84b,null))['then'](saveUpdates(_0x9e9b81['body'],null))['then'](function(_0x143626){if(_0x143626){_0x9b14d3=_0x143626;return db[_0xe45a('0x34')][_0xe45a('0x50')]({'raw':!![]});}})[_0xe45a('0x18')](function(_0x44266c){var _0x186abc=fs[_0xe45a('0x51')](path['join'](config[_0xe45a('0x53')],_0xe45a('0x54')),_0xe45a('0x55'));var _0xb0f9e6=ejs['render'](_0x186abc,{'contexts':_0x44266c||[]});fs[_0xe45a('0x56')](_0xe45a('0x57'),_0xb0f9e6);})['then'](function(){return respondWithRpcPromise(_0xe45a('0x5f'),_0xe45a('0x2b'),{'module':_0xe45a('0x60')});})[_0xe45a('0x18')](function(){return _0x9b14d3;})[_0xe45a('0x18')](respondWithResult(_0x51d84b,null))[_0xe45a('0x20')](handleError(_0x51d84b,null));};exports[_0xe45a('0x61')]=function(_0x1cfc17,_0x4fbea6,_0x1a864f){var _0x2c8160;return db[_0xe45a('0x34')][_0xe45a('0x4e')]({'where':{'id':_0x1cfc17[_0xe45a('0x4b')]['id']}})[_0xe45a('0x18')](handleEntityNotFound(_0x4fbea6,null))['then'](removeEntity(_0x4fbea6,null))[_0xe45a('0x18')](function(){return db[_0xe45a('0x34')]['findAll']({'raw':!![]});})[_0xe45a('0x18')](function(_0x314c4f){var _0x13ee6a=fs[_0xe45a('0x51')](path['join'](config['root'],'server/files/templates/context.ejs'),_0xe45a('0x55'));var _0xdb6b07=ejs[_0xe45a('0x62')](_0x13ee6a,{'contexts':_0x314c4f});fs[_0xe45a('0x56')](_0xe45a('0x57'),_0xdb6b07);return respondWithRpcPromise('Reload','destroy',{'module':_0xe45a('0x60')});})['catch'](handleError(_0x4fbea6,null));}; \ No newline at end of file +var _0x159c=['pick','filter','where','merge','VIRTUAL','options','include','findAll','rows','params','includeAll','find','create','body','join','root','server/files/templates/context.ejs','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','readFileSync','utf8','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','undefined','limit','count','offset','Content-Range','reject','save','update','then','destroy','get','Contexts','UserProfileResource','stack','name','index','map','VoiceContext','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort'];(function(_0x59bc12,_0x2eaf8e){var _0x55eebd=function(_0x551fe0){while(--_0x551fe0){_0x59bc12['push'](_0x59bc12['shift']());}};_0x55eebd(++_0x2eaf8e);}(_0x159c,0x88));var _0xc159=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x159c[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0xc159('0x0'));var rimraf=require(_0xc159('0x1'));var zipdir=require(_0xc159('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc159('0x3'));var moment=require(_0xc159('0x4'));var BPromise=require(_0xc159('0x5'));var Mustache=require(_0xc159('0x6'));var util=require(_0xc159('0x7'));var path=require('path');var sox=require(_0xc159('0x8'));var csv=require(_0xc159('0x9'));var ejs=require(_0xc159('0xa'));var fs=require('fs');var fs_extra=require(_0xc159('0xb'));var _=require(_0xc159('0xc'));var squel=require('squel');var crypto=require(_0xc159('0xd'));var jsforce=require(_0xc159('0xe'));var deskjs=require(_0xc159('0xf'));var toCsv=require(_0xc159('0x9'));var querystring=require(_0xc159('0x10'));var Papa=require('papaparse');var Redis=require(_0xc159('0x11'));var authService=require(_0xc159('0x12'));var qs=require(_0xc159('0x13'));var as=require(_0xc159('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xc159('0x15'));var config=require(_0xc159('0x16'));var licenseUtil=require(_0xc159('0x17'));var db=require(_0xc159('0x18'))['db'];var jayson=require(_0xc159('0x19'));var client=jayson[_0xc159('0x1a')][_0xc159('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x3974df,_0x3d6d0e,_0x34500a,_0x288342){return new BPromise(function(_0x4917a2,_0x20f07d){var _0x55fe17=_0x288342||client;return _0x55fe17['request'](_0x3974df,_0x34500a)['then'](function(_0x5acc70){logger[_0xc159('0x1c')](_0xc159('0x1d'),_0x3d6d0e,_0xc159('0x1e'));logger[_0xc159('0x1f')](_0xc159('0x20'),_0x3d6d0e,'request\x20sent',JSON[_0xc159('0x21')](_0x5acc70));if(_0x5acc70['error']){if(_0x5acc70[_0xc159('0x22')][_0xc159('0x23')]===0x1f4){logger['error'](_0xc159('0x1d'),_0x3d6d0e,_0x5acc70[_0xc159('0x22')][_0xc159('0x24')]);return _0x20f07d(_0x5acc70[_0xc159('0x22')][_0xc159('0x24')]);}logger[_0xc159('0x22')]('VoiceContext,\x20%s,\x20%s',_0x3d6d0e,_0x5acc70['error'][_0xc159('0x24')]);return _0x4917a2(_0x5acc70['error'][_0xc159('0x24')]);}else{logger[_0xc159('0x1c')](_0xc159('0x1d'),_0x3d6d0e,_0xc159('0x1e'));_0x4917a2(_0x5acc70[_0xc159('0x25')][_0xc159('0x24')]);}})[_0xc159('0x26')](function(_0x25abe9){logger[_0xc159('0x22')](_0xc159('0x1d'),_0x3d6d0e,_0x25abe9);_0x20f07d(_0x25abe9);});});}function respondWithStatusCode(_0xafa50c,_0x137a23){_0x137a23=_0x137a23||0xcc;return function(_0x19e060){if(_0x19e060){return _0xafa50c[_0xc159('0x27')](_0x137a23);}return _0xafa50c[_0xc159('0x28')](_0x137a23)['end']();};}function respondWithResult(_0x1278d0,_0xdb1bcb){_0xdb1bcb=_0xdb1bcb||0xc8;return function(_0x8b1ca9){if(_0x8b1ca9){return _0x1278d0[_0xc159('0x28')](_0xdb1bcb)[_0xc159('0x29')](_0x8b1ca9);}};}function respondWithFilteredResult(_0x25dc2e,_0x12e730){return function(_0x19605f){if(_0x19605f){var _0x740212=typeof _0x12e730['offset']===_0xc159('0x2a')&&typeof _0x12e730[_0xc159('0x2b')]===_0xc159('0x2a');var _0x4edd37=_0x19605f[_0xc159('0x2c')];var _0x1904af=_0x740212?0x0:_0x12e730[_0xc159('0x2d')];var _0x3f370a=_0x740212?_0x19605f[_0xc159('0x2c')]:_0x12e730[_0xc159('0x2d')]+_0x12e730[_0xc159('0x2b')];var _0x21d261;if(_0x3f370a>=_0x4edd37){_0x3f370a=_0x4edd37;_0x21d261=0xc8;}else{_0x21d261=0xce;}_0x25dc2e[_0xc159('0x28')](_0x21d261);return _0x25dc2e['set'](_0xc159('0x2e'),_0x1904af+'-'+_0x3f370a+'/'+_0x4edd37)[_0xc159('0x29')](_0x19605f);}return null;};}function patchUpdates(_0xc0e2e8){return function(_0x178ab9){try{jsonpatch['apply'](_0x178ab9,_0xc0e2e8,!![]);}catch(_0xf1dacc){return BPromise[_0xc159('0x2f')](_0xf1dacc);}return _0x178ab9[_0xc159('0x30')]();};}function saveUpdates(_0x147557,_0x3f08e9){return function(_0x495b48){if(_0x495b48){return _0x495b48[_0xc159('0x31')](_0x147557)[_0xc159('0x32')](function(_0x43f3d2){return _0x43f3d2;});}return null;};}function removeEntity(_0x16549e,_0x1f87c4){return function(_0x349c65){if(_0x349c65){return _0x349c65[_0xc159('0x33')]()[_0xc159('0x32')](function(){var _0x53bdb5=_0x349c65[_0xc159('0x34')]({'plain':!![]});var _0x19f55a=_0xc159('0x35');return db[_0xc159('0x36')][_0xc159('0x33')]({'where':{'type':_0x19f55a,'resourceId':_0x53bdb5['id']}})[_0xc159('0x32')](function(){return _0x349c65;});})['then'](function(){_0x16549e[_0xc159('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x56306a,_0x13d05c){return function(_0x2e2d6e){if(!_0x2e2d6e){_0x56306a[_0xc159('0x27')](0x194);}return _0x2e2d6e;};}function handleError(_0x3ee454,_0xf9a95){_0xf9a95=_0xf9a95||0x1f4;return function(_0x195ce2){logger[_0xc159('0x22')](_0x195ce2[_0xc159('0x37')]);if(_0x195ce2[_0xc159('0x38')]){delete _0x195ce2['name'];}_0x3ee454[_0xc159('0x28')](_0xf9a95)['send'](_0x195ce2);};}exports[_0xc159('0x39')]=function(_0x35dbf4,_0x2744c9){var _0x17724e={},_0x32fc54={},_0x441e23={'count':0x0,'rows':[]};var _0x589336=_[_0xc159('0x3a')](db[_0xc159('0x3b')][_0xc159('0x3c')],function(_0xa2c473){return{'name':_0xa2c473[_0xc159('0x3d')],'type':_0xa2c473[_0xc159('0x3e')][_0xc159('0x3f')]};});_0x32fc54[_0xc159('0x40')]=_['map'](_0x589336,'name');_0x32fc54[_0xc159('0x41')]=_[_0xc159('0x42')](_0x35dbf4['query']);_0x32fc54[_0xc159('0x43')]=_[_0xc159('0x44')](_0x32fc54[_0xc159('0x40')],_0x32fc54['query']);_0x17724e[_0xc159('0x45')]=_[_0xc159('0x44')](_0x32fc54[_0xc159('0x40')],qs['fields'](_0x35dbf4['query'][_0xc159('0x46')]));_0x17724e[_0xc159('0x45')]=_0x17724e[_0xc159('0x45')][_0xc159('0x47')]?_0x17724e['attributes']:_0x32fc54[_0xc159('0x40')];if(!_0x35dbf4['query'][_0xc159('0x48')](_0xc159('0x49'))){_0x17724e[_0xc159('0x2b')]=qs[_0xc159('0x2b')](_0x35dbf4['query']['limit']);_0x17724e[_0xc159('0x2d')]=qs['offset'](_0x35dbf4[_0xc159('0x41')]['offset']);}_0x17724e[_0xc159('0x4a')]=qs[_0xc159('0x4b')](_0x35dbf4[_0xc159('0x41')][_0xc159('0x4b')]);_0x17724e['where']=qs[_0xc159('0x43')](_[_0xc159('0x4c')](_0x35dbf4[_0xc159('0x41')],_0x32fc54[_0xc159('0x43')]),_0x589336);if(_0x35dbf4['query'][_0xc159('0x4d')]){_0x17724e[_0xc159('0x4e')]=_[_0xc159('0x4f')](_0x17724e[_0xc159('0x4e')],{'$or':_[_0xc159('0x3a')](_0x589336,function(_0x2ee84b){if(_0x2ee84b['type']!==_0xc159('0x50')){var _0x1a3544={};_0x1a3544[_0x2ee84b['name']]={'$like':'%'+_0x35dbf4[_0xc159('0x41')][_0xc159('0x4d')]+'%'};return _0x1a3544;}})});}_0x17724e=_[_0xc159('0x4f')]({},_0x17724e,_0x35dbf4[_0xc159('0x51')]);var _0x115637={'where':_0x17724e[_0xc159('0x4e')]};return db[_0xc159('0x3b')][_0xc159('0x2c')](_0x115637)[_0xc159('0x32')](function(_0x42df32){_0x441e23['count']=_0x42df32;if(_0x35dbf4[_0xc159('0x41')]['includeAll']){_0x17724e[_0xc159('0x52')]=[{'all':!![]}];}return db['VoiceContext'][_0xc159('0x53')](_0x17724e);})[_0xc159('0x32')](function(_0x1e27db){_0x441e23[_0xc159('0x54')]=_0x1e27db;return _0x441e23;})[_0xc159('0x32')](respondWithFilteredResult(_0x2744c9,_0x17724e))['catch'](handleError(_0x2744c9,null));};exports['show']=function(_0x41a486,_0x1c7912){var _0x19f9e9={'raw':![],'where':{'id':_0x41a486[_0xc159('0x55')]['id']}},_0x46ebab={};_0x46ebab[_0xc159('0x40')]=_[_0xc159('0x42')](db[_0xc159('0x3b')][_0xc159('0x3c')]);_0x46ebab['query']=_[_0xc159('0x42')](_0x41a486[_0xc159('0x41')]);_0x46ebab[_0xc159('0x43')]=_['intersection'](_0x46ebab['model'],_0x46ebab[_0xc159('0x41')]);_0x19f9e9[_0xc159('0x45')]=_['intersection'](_0x46ebab[_0xc159('0x40')],qs[_0xc159('0x46')](_0x41a486['query']['fields']));_0x19f9e9[_0xc159('0x45')]=_0x19f9e9[_0xc159('0x45')][_0xc159('0x47')]?_0x19f9e9[_0xc159('0x45')]:_0x46ebab[_0xc159('0x40')];if(_0x41a486[_0xc159('0x41')][_0xc159('0x56')]){_0x19f9e9[_0xc159('0x52')]=[{'all':!![]}];}_0x19f9e9=_[_0xc159('0x4f')]({},_0x19f9e9,_0x41a486[_0xc159('0x51')]);return db[_0xc159('0x3b')][_0xc159('0x57')](_0x19f9e9)[_0xc159('0x32')](handleEntityNotFound(_0x1c7912,null))[_0xc159('0x32')](respondWithResult(_0x1c7912,null))[_0xc159('0x26')](handleError(_0x1c7912,null));};exports[_0xc159('0x58')]=function(_0x374824,_0x1c45c7,_0x38592b){var _0x56eb26;return db[_0xc159('0x3b')][_0xc159('0x58')](_0x374824[_0xc159('0x59')],{'raw':!![]})[_0xc159('0x32')](function(_0xcc61f6){_0x56eb26=_0xcc61f6;return db[_0xc159('0x3b')][_0xc159('0x53')]({'raw':!![]});})[_0xc159('0x32')](function(_0x2e5bea){var _0x4f52dd=fs['readFileSync'](path[_0xc159('0x5a')](config[_0xc159('0x5b')],_0xc159('0x5c')),'utf8');var _0x30ebb7=ejs[_0xc159('0x5d')](_0x4f52dd,{'contexts':_0x2e5bea||[]});fs[_0xc159('0x5e')](_0xc159('0x5f'),_0x30ebb7);})[_0xc159('0x32')](function(){return respondWithRpcPromise(_0xc159('0x60'),_0xc159('0x58'),{'module':_0xc159('0x61')});})[_0xc159('0x32')](function(){var _0x30af95=_0x374824[_0xc159('0x62')][_0xc159('0x34')]({'plain':!![]});if(!_0x30af95)throw new Error(_0xc159('0x63'));if(_0x30af95[_0xc159('0x64')]==='user'){var _0x10534a=_0x56eb26[_0xc159('0x34')]({'plain':!![]});return db[_0xc159('0x65')]['find']({'where':{'name':'Contexts','userProfileId':_0x30af95[_0xc159('0x66')]},'raw':!![]})[_0xc159('0x32')](function(_0xef7f02){if(_0xef7f02&&_0xef7f02[_0xc159('0x67')]===0x0){return db['UserProfileResource'][_0xc159('0x58')]({'name':_0x10534a['name'],'resourceId':_0x10534a['id'],'type':_0xef7f02[_0xc159('0x38')],'sectionId':_0xef7f02['id']},{})[_0xc159('0x32')](function(){return _0x56eb26;});}else{return _0x56eb26;}})['catch'](function(_0x3132c1){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3132c1);throw _0x3132c1;});}return _0x56eb26;})[_0xc159('0x32')](respondWithResult(_0x1c45c7,0xc9))[_0xc159('0x26')](handleError(_0x1c45c7,null));};exports[_0xc159('0x31')]=function(_0xf4497,_0x385023,_0x1d34fd){var _0xba0567;return db['VoiceContext'][_0xc159('0x57')]({'where':{'id':_0xf4497[_0xc159('0x55')]['id']}})['then'](handleEntityNotFound(_0x385023,null))[_0xc159('0x32')](saveUpdates(_0xf4497[_0xc159('0x59')],null))['then'](function(_0x2b88cf){if(_0x2b88cf){_0xba0567=_0x2b88cf;return db[_0xc159('0x3b')][_0xc159('0x53')]({'raw':!![]});}})['then'](function(_0x219be8){var _0x28e33a=fs[_0xc159('0x68')](path['join'](config[_0xc159('0x5b')],'server/files/templates/context.ejs'),_0xc159('0x69'));var _0x49d57a=ejs['render'](_0x28e33a,{'contexts':_0x219be8||[]});fs[_0xc159('0x5e')](_0xc159('0x5f'),_0x49d57a);})[_0xc159('0x32')](function(){return respondWithRpcPromise(_0xc159('0x60'),_0xc159('0x31'),{'module':'chan_sip.so'});})[_0xc159('0x32')](function(){return _0xba0567;})['then'](respondWithResult(_0x385023,null))['catch'](handleError(_0x385023,null));};exports['destroy']=function(_0x3e8757,_0x2d74d5,_0xdfff4f){var _0x257c03;return db[_0xc159('0x3b')][_0xc159('0x57')]({'where':{'id':_0x3e8757['params']['id']}})['then'](handleEntityNotFound(_0x2d74d5,null))[_0xc159('0x32')](removeEntity(_0x2d74d5,null))[_0xc159('0x32')](function(){return db[_0xc159('0x3b')]['findAll']({'raw':!![]});})[_0xc159('0x32')](function(_0x1799a6){var _0xc7ae14=fs[_0xc159('0x68')](path['join'](config[_0xc159('0x5b')],'server/files/templates/context.ejs'),'utf8');var _0x59834d=ejs[_0xc159('0x5d')](_0xc7ae14,{'contexts':_0x1799a6});fs['writeFileSync'](_0xc159('0x5f'),_0x59834d);return respondWithRpcPromise(_0xc159('0x60'),_0xc159('0x33'),{'module':_0xc159('0x61')});})['catch'](handleError(_0x2d74d5,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 5582989..9bfca58 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 _0x445e=['define','VoiceContext','voice_contexts','lodash','util','../../config/logger','api','path','../../config/environment','./voiceContext.attributes','exports'];(function(_0x50ed34,_0x7cb270){var _0x44f5c9=function(_0x154c14){while(--_0x154c14){_0x50ed34['push'](_0x50ed34['shift']());}};_0x44f5c9(++_0x7cb270);}(_0x445e,0x1d1));var _0xe445=function(_0x155685,_0x1bfe30){_0x155685=_0x155685-0x0;var _0x19199b=_0x445e[_0x155685];return _0x19199b;};'use strict';var _=require(_0xe445('0x0'));var util=require(_0xe445('0x1'));var logger=require(_0xe445('0x2'))(_0xe445('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe445('0x4'));var rimraf=require('rimraf');var config=require(_0xe445('0x5'));var attributes=require(_0xe445('0x6'));module[_0xe445('0x7')]=function(_0x524858,_0x5319df){return _0x524858[_0xe445('0x8')](_0xe445('0x9'),attributes,{'tableName':_0xe445('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x10bf=['./voiceContext.attributes','VoiceContext','voice_contexts','lodash','util','../../config/logger','bluebird','request-promise','path','../../config/environment'];(function(_0x190603,_0x2fc135){var _0x112448=function(_0x3ebce5){while(--_0x3ebce5){_0x190603['push'](_0x190603['shift']());}};_0x112448(++_0x2fc135);}(_0x10bf,0xf3));var _0xf10b=function(_0x16960e,_0x169c9f){_0x16960e=_0x16960e-0x0;var _0x1c24ce=_0x10bf[_0x16960e];return _0x1c24ce;};'use strict';var _=require(_0xf10b('0x0'));var util=require(_0xf10b('0x1'));var logger=require(_0xf10b('0x2'))('api');var moment=require('moment');var BPromise=require(_0xf10b('0x3'));var rp=require(_0xf10b('0x4'));var fs=require('fs');var path=require(_0xf10b('0x5'));var rimraf=require('rimraf');var config=require(_0xf10b('0x6'));var attributes=require(_0xf10b('0x7'));module['exports']=function(_0x464806,_0x5d135d){return _0x464806['define'](_0xf10b('0x8'),attributes,{'tableName':_0xf10b('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 9a2f0b3..5e6878b 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 _0x988c=['client','request','then','info','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceContext,\x20%s,\x20%s','message','result','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x988c,0x19e));var _0xc988=function(_0x114471,_0x1cec72){_0x114471=_0x114471-0x0;var _0x5de4f7=_0x988c[_0x114471];return _0x5de4f7;};'use strict';var _=require(_0xc988('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc988('0x1'));var fs=require('fs');var Redis=require(_0xc988('0x2'));var db=require(_0xc988('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xc988('0x4'));var jayson=require(_0xc988('0x5'));var client=jayson[_0xc988('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x26e109,_0x14b586,_0x4e6f38){return new BPromise(function(_0x4e48db,_0x2a96ab){return client[_0xc988('0x7')](_0x26e109,_0x4e6f38)[_0xc988('0x8')](function(_0x271d0f){logger[_0xc988('0x9')]('VoiceContext,\x20%s,\x20%s',_0x14b586,_0xc988('0xa'));logger[_0xc988('0xb')](_0xc988('0xc'),_0x14b586,_0xc988('0xa'),JSON[_0xc988('0xd')](_0x271d0f));if(_0x271d0f['error']){if(_0x271d0f[_0xc988('0xe')][_0xc988('0xf')]===0x1f4){logger[_0xc988('0xe')]('VoiceContext,\x20%s,\x20%s',_0x14b586,_0x271d0f[_0xc988('0xe')]['message']);return _0x2a96ab(_0x271d0f[_0xc988('0xe')]['message']);}logger[_0xc988('0xe')](_0xc988('0x10'),_0x14b586,_0x271d0f[_0xc988('0xe')][_0xc988('0x11')]);return _0x4e48db(_0x271d0f['error'][_0xc988('0x11')]);}else{logger[_0xc988('0x9')](_0xc988('0x10'),_0x14b586,_0xc988('0xa'));_0x4e48db(_0x271d0f[_0xc988('0x12')][_0xc988('0x11')]);}})[_0xc988('0x13')](function(_0x35aebb){logger[_0xc988('0xe')](_0xc988('0x10'),_0x14b586,_0x35aebb);_0x2a96ab(_0x35aebb);});});} \ No newline at end of file +var _0xa30e=['stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent'];(function(_0xd05f72,_0x2f1629){var _0x3b1dee=function(_0x211cfe){while(--_0x211cfe){_0xd05f72['push'](_0xd05f72['shift']());}};_0x3b1dee(++_0x2f1629);}(_0xa30e,0x117));var _0xea30=function(_0x1e50fc,_0x3d2684){_0x1e50fc=_0x1e50fc-0x0;var _0x497f51=_0xa30e[_0x1e50fc];return _0x497f51;};'use strict';var _=require(_0xea30('0x0'));var util=require(_0xea30('0x1'));var moment=require(_0xea30('0x2'));var BPromise=require(_0xea30('0x3'));var rs=require(_0xea30('0x4'));var fs=require('fs');var Redis=require(_0xea30('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xea30('0x6'));var config=require(_0xea30('0x7'));var jayson=require(_0xea30('0x8'));var client=jayson['client'][_0xea30('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x33e178,_0x10c36f,_0x32320b){return new BPromise(function(_0x1c5d00,_0xc7858e){return client[_0xea30('0xa')](_0x33e178,_0x32320b)[_0xea30('0xb')](function(_0x4192e9){logger[_0xea30('0xc')](_0xea30('0xd'),_0x10c36f,_0xea30('0xe'));logger['debug']('VoiceContext,\x20%s,\x20%s,\x20%s',_0x10c36f,_0xea30('0xe'),JSON[_0xea30('0xf')](_0x4192e9));if(_0x4192e9[_0xea30('0x10')]){if(_0x4192e9[_0xea30('0x10')][_0xea30('0x11')]===0x1f4){logger[_0xea30('0x10')](_0xea30('0xd'),_0x10c36f,_0x4192e9[_0xea30('0x10')][_0xea30('0x12')]);return _0xc7858e(_0x4192e9[_0xea30('0x10')][_0xea30('0x12')]);}logger[_0xea30('0x10')](_0xea30('0xd'),_0x10c36f,_0x4192e9['error'][_0xea30('0x12')]);return _0x1c5d00(_0x4192e9[_0xea30('0x10')][_0xea30('0x12')]);}else{logger['info'](_0xea30('0xd'),_0x10c36f,_0xea30('0xe'));_0x1c5d00(_0x4192e9[_0xea30('0x13')][_0xea30('0x12')]);}})[_0xea30('0x14')](function(_0x36212e){logger[_0xea30('0x10')](_0xea30('0xd'),_0x10c36f,_0x36212e);_0xc7858e(_0x36212e);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 593ad85..e35cc1c 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 _0xf43e=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','isAuthenticated','index','get','describe','/:id','show','post','create','update'];(function(_0x3fa9cc,_0x2172bc){var _0x3ade14=function(_0xe23443){while(--_0xe23443){_0x3fa9cc['push'](_0x3fa9cc['shift']());}};_0x3ade14(++_0x2172bc);}(_0xf43e,0x75));var _0xef43=function(_0x54d944,_0x4c5672){_0x54d944=_0x54d944-0x0;var _0x394604=_0xf43e[_0x54d944];return _0x394604;};'use strict';var multer=require(_0xef43('0x0'));var util=require(_0xef43('0x1'));var path=require(_0xef43('0x2'));var timeout=require(_0xef43('0x3'));var express=require(_0xef43('0x4'));var router=express[_0xef43('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xef43('0x6'));var config=require('../../config/environment');var controller=require('./voiceDialReport.controller');router['get']('/',auth[_0xef43('0x7')](),controller[_0xef43('0x8')]);router[_0xef43('0x9')]('/describe',auth[_0xef43('0x7')](),controller[_0xef43('0xa')]);router[_0xef43('0x9')](_0xef43('0xb'),auth[_0xef43('0x7')](),controller[_0xef43('0xc')]);router[_0xef43('0xd')]('/',auth[_0xef43('0x7')](),controller[_0xef43('0xe')]);router['put'](_0xef43('0xb'),auth[_0xef43('0x7')](),controller[_0xef43('0xf')]);router[_0xef43('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xef43('0x11')]);module[_0xef43('0x12')]=router; \ No newline at end of file +var _0x34bb=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','/describe','/:id','show','post','create','put','update'];(function(_0x1d7df3,_0x4263cc){var _0x275210=function(_0xcaf857){while(--_0xcaf857){_0x1d7df3['push'](_0x1d7df3['shift']());}};_0x275210(++_0x4263cc);}(_0x34bb,0x129));var _0xb34b=function(_0x1fe130,_0x2e1d15){_0x1fe130=_0x1fe130-0x0;var _0x1403ad=_0x34bb[_0x1fe130];return _0x1403ad;};'use strict';var multer=require(_0xb34b('0x0'));var util=require(_0xb34b('0x1'));var path=require(_0xb34b('0x2'));var timeout=require(_0xb34b('0x3'));var express=require(_0xb34b('0x4'));var router=express[_0xb34b('0x5')]();var fs_extra=require(_0xb34b('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb34b('0x7'));var controller=require(_0xb34b('0x8'));router[_0xb34b('0x9')]('/',auth[_0xb34b('0xa')](),controller['index']);router['get'](_0xb34b('0xb'),auth[_0xb34b('0xa')](),controller['describe']);router[_0xb34b('0x9')](_0xb34b('0xc'),auth[_0xb34b('0xa')](),controller[_0xb34b('0xd')]);router[_0xb34b('0xe')]('/',auth[_0xb34b('0xa')](),controller[_0xb34b('0xf')]);router[_0xb34b('0x10')](_0xb34b('0xc'),auth[_0xb34b('0xa')](),controller[_0xb34b('0x11')]);router[_0xb34b('0x12')]('/:id',auth[_0xb34b('0xa')](),controller[_0xb34b('0x13')]);module[_0xb34b('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index ed57386..695348f 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 _0x3e74=['DATE','sequelize','STRING','INTEGER'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0x3e74,0x175));var _0x43e7=function(_0x5f1dcc,_0x2d3808){_0x5f1dcc=_0x5f1dcc-0x0;var _0x413661=_0x3e74[_0x5f1dcc];return _0x413661;};'use strict';var Sequelize=require(_0x43e7('0x0'));module['exports']={'privilege':{'type':Sequelize[_0x43e7('0x1')]},'channel':{'type':Sequelize[_0x43e7('0x1')]},'channelstate':{'type':Sequelize[_0x43e7('0x2')]},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x43e7('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x43e7('0x1')]},'language':{'type':Sequelize[_0x43e7('0x1')]},'accountcode':{'type':Sequelize[_0x43e7('0x1')]},'context':{'type':Sequelize[_0x43e7('0x1')]},'exten':{'type':Sequelize[_0x43e7('0x1')]},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x43e7('0x1')]},'linkedid':{'type':Sequelize[_0x43e7('0x1')]},'destchannel':{'type':Sequelize[_0x43e7('0x1')]},'destchannelstate':{'type':Sequelize[_0x43e7('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x43e7('0x1')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x43e7('0x1')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x43e7('0x1')]},'destaccountcode':{'type':Sequelize[_0x43e7('0x1')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x43e7('0x1')]},'destpriority':{'type':Sequelize['INTEGER']},'destuniqueid':{'type':Sequelize[_0x43e7('0x1')]},'destlinkedid':{'type':Sequelize[_0x43e7('0x1')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0x43e7('0x1')]},'starttime':{'type':Sequelize[_0x43e7('0x3')]},'answertime':{'type':Sequelize[_0x43e7('0x3')]},'endtime':{'type':Sequelize[_0x43e7('0x3')]},'lastevent':{'type':Sequelize['STRING'],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0x43e7('0x2')]},'duration':{'type':Sequelize[_0x43e7('0x2')]},'holdtime':{'type':Sequelize[_0x43e7('0x2')]},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xf3cd=['exports','STRING','INTEGER','DATE','sequelize'];(function(_0x2eaadf,_0x104e72){var _0x2e5e8a=function(_0x42b665){while(--_0x42b665){_0x2eaadf['push'](_0x2eaadf['shift']());}};_0x2e5e8a(++_0x104e72);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x39772f,_0x5605cb){_0x39772f=_0x39772f-0x0;var _0xc9edbf=_0xf3cd[_0x39772f];return _0xc9edbf;};'use strict';var Sequelize=require(_0xdf3c('0x0'));module[_0xdf3c('0x1')]={'privilege':{'type':Sequelize[_0xdf3c('0x2')]},'channel':{'type':Sequelize[_0xdf3c('0x2')]},'channelstate':{'type':Sequelize[_0xdf3c('0x3')]},'channelstatedesc':{'type':Sequelize[_0xdf3c('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xdf3c('0x2')]},'connectedlinenum':{'type':Sequelize[_0xdf3c('0x2')]},'connectedlinename':{'type':Sequelize[_0xdf3c('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xdf3c('0x2')]},'context':{'type':Sequelize[_0xdf3c('0x2')]},'exten':{'type':Sequelize[_0xdf3c('0x2')]},'priority':{'type':Sequelize[_0xdf3c('0x3')]},'uniqueid':{'type':Sequelize[_0xdf3c('0x2')]},'linkedid':{'type':Sequelize[_0xdf3c('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xdf3c('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0xdf3c('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xdf3c('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0xdf3c('0x2')]},'destaccountcode':{'type':Sequelize[_0xdf3c('0x2')]},'destcontext':{'type':Sequelize[_0xdf3c('0x2')]},'destexten':{'type':Sequelize[_0xdf3c('0x2')]},'destpriority':{'type':Sequelize[_0xdf3c('0x3')]},'destuniqueid':{'type':Sequelize[_0xdf3c('0x2')]},'destlinkedid':{'type':Sequelize[_0xdf3c('0x2')]},'dialstring':{'type':Sequelize[_0xdf3c('0x2')]},'dialstatus':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xdf3c('0x4')]},'answertime':{'type':Sequelize[_0xdf3c('0x4')]},'endtime':{'type':Sequelize[_0xdf3c('0x4')]},'lastevent':{'type':Sequelize[_0xdf3c('0x2')],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0xdf3c('0x3')]},'duration':{'type':Sequelize[_0xdf3c('0x3')]},'holdtime':{'type':Sequelize[_0xdf3c('0x3')]},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 6cec680..2347910 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 _0xfa52=['status','end','json','offset','undefined','limit','count','set','reject','update','destroy','then','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','filter','merge','VIRTUAL','VoiceDialReport','include','findAll','rows','catch','show','params','keys','includeAll','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x4e84bb,_0x36f87b){var _0x57467a=function(_0x348c16){while(--_0x348c16){_0x4e84bb['push'](_0x4e84bb['shift']());}};_0x57467a(++_0x36f87b);}(_0xfa52,0xc9));var _0x2fa5=function(_0xdc68fb,_0x230367){_0xdc68fb=_0xdc68fb-0x0;var _0x388b44=_0xfa52[_0xdc68fb];return _0x388b44;};'use strict';var emlformat=require(_0x2fa5('0x0'));var rimraf=require(_0x2fa5('0x1'));var zipdir=require(_0x2fa5('0x2'));var jsonpatch=require(_0x2fa5('0x3'));var rp=require('request-promise');var moment=require(_0x2fa5('0x4'));var BPromise=require(_0x2fa5('0x5'));var Mustache=require('mustache');var util=require(_0x2fa5('0x6'));var path=require(_0x2fa5('0x7'));var sox=require(_0x2fa5('0x8'));var csv=require(_0x2fa5('0x9'));var ejs=require(_0x2fa5('0xa'));var fs=require('fs');var fs_extra=require(_0x2fa5('0xb'));var _=require(_0x2fa5('0xc'));var squel=require(_0x2fa5('0xd'));var crypto=require(_0x2fa5('0xe'));var jsforce=require(_0x2fa5('0xf'));var deskjs=require(_0x2fa5('0x10'));var toCsv=require(_0x2fa5('0x9'));var querystring=require(_0x2fa5('0x11'));var Papa=require(_0x2fa5('0x12'));var Redis=require(_0x2fa5('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2fa5('0x14'));var logger=require(_0x2fa5('0x15'))(_0x2fa5('0x16'));var utils=require('../../config/utils');var config=require(_0x2fa5('0x17'));var licenseUtil=require(_0x2fa5('0x18'));var db=require(_0x2fa5('0x19'))['db'];function respondWithStatusCode(_0x373e2c,_0x12bfac){_0x12bfac=_0x12bfac||0xcc;return function(_0x296385){if(_0x296385){return _0x373e2c[_0x2fa5('0x1a')](_0x12bfac);}return _0x373e2c[_0x2fa5('0x1b')](_0x12bfac)[_0x2fa5('0x1c')]();};}function respondWithResult(_0x6f93f9,_0x54025a){_0x54025a=_0x54025a||0xc8;return function(_0x258d3b){if(_0x258d3b){return _0x6f93f9[_0x2fa5('0x1b')](_0x54025a)[_0x2fa5('0x1d')](_0x258d3b);}};}function respondWithFilteredResult(_0x24d96e,_0x50627f){return function(_0x198d78){if(_0x198d78){var _0x1e2ee4=typeof _0x50627f[_0x2fa5('0x1e')]===_0x2fa5('0x1f')&&typeof _0x50627f[_0x2fa5('0x20')]==='undefined';var _0x3b9794=_0x198d78[_0x2fa5('0x21')];var _0x66702a=_0x1e2ee4?0x0:_0x50627f[_0x2fa5('0x1e')];var _0x111cc7=_0x1e2ee4?_0x198d78[_0x2fa5('0x21')]:_0x50627f[_0x2fa5('0x1e')]+_0x50627f[_0x2fa5('0x20')];var _0x3be79b;if(_0x111cc7>=_0x3b9794){_0x111cc7=_0x3b9794;_0x3be79b=0xc8;}else{_0x3be79b=0xce;}_0x24d96e[_0x2fa5('0x1b')](_0x3be79b);return _0x24d96e[_0x2fa5('0x22')]('Content-Range',_0x66702a+'-'+_0x111cc7+'/'+_0x3b9794)[_0x2fa5('0x1d')](_0x198d78);}return null;};}function patchUpdates(_0x10e561){return function(_0x3369f2){try{jsonpatch['apply'](_0x3369f2,_0x10e561,!![]);}catch(_0x1a8577){return BPromise[_0x2fa5('0x23')](_0x1a8577);}return _0x3369f2['save']();};}function saveUpdates(_0x3de503,_0x35d008){return function(_0x4bc9ce){if(_0x4bc9ce){return _0x4bc9ce[_0x2fa5('0x24')](_0x3de503)['then'](function(_0x48350d){return _0x48350d;});}return null;};}function removeEntity(_0xee5740,_0x5c1cb3){return function(_0x13b009){if(_0x13b009){return _0x13b009[_0x2fa5('0x25')]()[_0x2fa5('0x26')](function(){_0xee5740[_0x2fa5('0x1b')](0xcc)[_0x2fa5('0x1c')]();});}};}function handleEntityNotFound(_0x57709d,_0x4ee16e){return function(_0x3f0076){if(!_0x3f0076){_0x57709d[_0x2fa5('0x1a')](0x194);}return _0x3f0076;};}function handleError(_0x496be2,_0x3868f3){_0x3868f3=_0x3868f3||0x1f4;return function(_0x1865d2){logger[_0x2fa5('0x27')](_0x1865d2[_0x2fa5('0x28')]);if(_0x1865d2[_0x2fa5('0x29')]){delete _0x1865d2[_0x2fa5('0x29')];}_0x496be2['status'](_0x3868f3)[_0x2fa5('0x2a')](_0x1865d2);};}exports[_0x2fa5('0x2b')]=function(_0x49cf86,_0x5a3ec8){var _0x3d31ae={},_0x1f75c0={},_0x4eb9e8={'count':0x0,'rows':[]};var _0x3572b4=_['map'](db['VoiceDialReport'][_0x2fa5('0x2c')],function(_0x3dd4ca){return{'name':_0x3dd4ca[_0x2fa5('0x2d')],'type':_0x3dd4ca[_0x2fa5('0x2e')][_0x2fa5('0x2f')]};});_0x1f75c0[_0x2fa5('0x30')]=_['map'](_0x3572b4,_0x2fa5('0x29'));_0x1f75c0[_0x2fa5('0x31')]=_['keys'](_0x49cf86[_0x2fa5('0x31')]);_0x1f75c0['filters']=_[_0x2fa5('0x32')](_0x1f75c0[_0x2fa5('0x30')],_0x1f75c0[_0x2fa5('0x31')]);_0x3d31ae['attributes']=_[_0x2fa5('0x32')](_0x1f75c0[_0x2fa5('0x30')],qs[_0x2fa5('0x33')](_0x49cf86[_0x2fa5('0x31')][_0x2fa5('0x33')]));_0x3d31ae[_0x2fa5('0x34')]=_0x3d31ae[_0x2fa5('0x34')][_0x2fa5('0x35')]?_0x3d31ae['attributes']:_0x1f75c0[_0x2fa5('0x30')];if(!_0x49cf86[_0x2fa5('0x31')][_0x2fa5('0x36')]('nolimit')){_0x3d31ae[_0x2fa5('0x20')]=qs[_0x2fa5('0x20')](_0x49cf86[_0x2fa5('0x31')][_0x2fa5('0x20')]);_0x3d31ae[_0x2fa5('0x1e')]=qs[_0x2fa5('0x1e')](_0x49cf86['query']['offset']);}_0x3d31ae[_0x2fa5('0x37')]=qs[_0x2fa5('0x38')](_0x49cf86[_0x2fa5('0x31')]['sort']);_0x3d31ae[_0x2fa5('0x39')]=qs[_0x2fa5('0x3a')](_['pick'](_0x49cf86['query'],_0x1f75c0[_0x2fa5('0x3a')]),_0x3572b4);if(_0x49cf86[_0x2fa5('0x31')][_0x2fa5('0x3b')]){_0x3d31ae[_0x2fa5('0x39')]=_[_0x2fa5('0x3c')](_0x3d31ae[_0x2fa5('0x39')],{'$or':_['map'](_0x3572b4,function(_0xa6d58c){if(_0xa6d58c[_0x2fa5('0x2e')]!==_0x2fa5('0x3d')){var _0x1ba1e8={};_0x1ba1e8[_0xa6d58c[_0x2fa5('0x29')]]={'$like':'%'+_0x49cf86[_0x2fa5('0x31')]['filter']+'%'};return _0x1ba1e8;}})});}_0x3d31ae=_[_0x2fa5('0x3c')]({},_0x3d31ae,_0x49cf86['options']);var _0x1232ac={'where':_0x3d31ae[_0x2fa5('0x39')]};return db[_0x2fa5('0x3e')]['count'](_0x1232ac)['then'](function(_0x57ce74){_0x4eb9e8[_0x2fa5('0x21')]=_0x57ce74;if(_0x49cf86[_0x2fa5('0x31')]['includeAll']){_0x3d31ae[_0x2fa5('0x3f')]=[{'all':!![]}];}return db[_0x2fa5('0x3e')][_0x2fa5('0x40')](_0x3d31ae);})[_0x2fa5('0x26')](function(_0x3138a9){_0x4eb9e8[_0x2fa5('0x41')]=_0x3138a9;return _0x4eb9e8;})[_0x2fa5('0x26')](respondWithFilteredResult(_0x5a3ec8,_0x3d31ae))[_0x2fa5('0x42')](handleError(_0x5a3ec8,null));};exports[_0x2fa5('0x43')]=function(_0x40d8ce,_0x505010){var _0x2640b9={'raw':!![],'where':{'id':_0x40d8ce[_0x2fa5('0x44')]['id']}},_0x4cb1c3={};_0x4cb1c3[_0x2fa5('0x30')]=_[_0x2fa5('0x45')](db['VoiceDialReport']['rawAttributes']);_0x4cb1c3[_0x2fa5('0x31')]=_[_0x2fa5('0x45')](_0x40d8ce['query']);_0x4cb1c3['filters']=_[_0x2fa5('0x32')](_0x4cb1c3['model'],_0x4cb1c3['query']);_0x2640b9[_0x2fa5('0x34')]=_[_0x2fa5('0x32')](_0x4cb1c3[_0x2fa5('0x30')],qs['fields'](_0x40d8ce['query'][_0x2fa5('0x33')]));_0x2640b9[_0x2fa5('0x34')]=_0x2640b9[_0x2fa5('0x34')]['length']?_0x2640b9[_0x2fa5('0x34')]:_0x4cb1c3[_0x2fa5('0x30')];if(_0x40d8ce[_0x2fa5('0x31')][_0x2fa5('0x46')]){_0x2640b9[_0x2fa5('0x3f')]=[{'all':!![]}];}_0x2640b9=_[_0x2fa5('0x3c')]({},_0x2640b9,_0x40d8ce[_0x2fa5('0x47')]);return db['VoiceDialReport'][_0x2fa5('0x48')](_0x2640b9)[_0x2fa5('0x26')](handleEntityNotFound(_0x505010,null))[_0x2fa5('0x26')](respondWithResult(_0x505010,null))[_0x2fa5('0x42')](handleError(_0x505010,null));};exports[_0x2fa5('0x49')]=function(_0x425289,_0x26e1f5){return db['VoiceDialReport'][_0x2fa5('0x49')](_0x425289['body'],{})['then'](respondWithResult(_0x26e1f5,0xc9))['catch'](handleError(_0x26e1f5,null));};exports['update']=function(_0x27ed00,_0x348cdb){if(_0x27ed00[_0x2fa5('0x4a')]['id']){delete _0x27ed00[_0x2fa5('0x4a')]['id'];}return db[_0x2fa5('0x3e')][_0x2fa5('0x48')]({'where':{'id':_0x27ed00['params']['id']}})[_0x2fa5('0x26')](handleEntityNotFound(_0x348cdb,null))['then'](saveUpdates(_0x27ed00[_0x2fa5('0x4a')],null))[_0x2fa5('0x26')](respondWithResult(_0x348cdb,null))['catch'](handleError(_0x348cdb,null));};exports[_0x2fa5('0x25')]=function(_0x18b615,_0x37165d){return db[_0x2fa5('0x3e')][_0x2fa5('0x48')]({'where':{'id':_0x18b615[_0x2fa5('0x44')]['id']}})[_0x2fa5('0x26')](handleEntityNotFound(_0x37165d,null))['then'](removeEntity(_0x37165d,null))[_0x2fa5('0x42')](handleError(_0x37165d,null));};exports[_0x2fa5('0x4b')]=function(_0x5b24c1,_0x3a3ec5){return db['VoiceDialReport'][_0x2fa5('0x4b')]()[_0x2fa5('0x26')](respondWithResult(_0x3a3ec5,null))[_0x2fa5('0x42')](handleError(_0x3a3ec5,null));}; \ No newline at end of file +var _0xdc34=['fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','VoiceDialReport','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','end','status','json','undefined','count','offset','limit','Content-Range','apply','save','update','then','destroy','sendStatus','error','name','send','index','fieldName','type','map','query','keys','intersection','model','attributes'];(function(_0xb5cb23,_0x336cbb){var _0x2edd65=function(_0x33469e){while(--_0x33469e){_0xb5cb23['push'](_0xb5cb23['shift']());}};_0x2edd65(++_0x336cbb);}(_0xdc34,0x66));var _0x4dc3=function(_0x5561c7,_0x4daf57){_0x5561c7=_0x5561c7-0x0;var _0x56de1b=_0xdc34[_0x5561c7];return _0x56de1b;};'use strict';var emlformat=require(_0x4dc3('0x0'));var rimraf=require(_0x4dc3('0x1'));var zipdir=require(_0x4dc3('0x2'));var jsonpatch=require(_0x4dc3('0x3'));var rp=require(_0x4dc3('0x4'));var moment=require(_0x4dc3('0x5'));var BPromise=require(_0x4dc3('0x6'));var Mustache=require('mustache');var util=require(_0x4dc3('0x7'));var path=require(_0x4dc3('0x8'));var sox=require('sox');var csv=require(_0x4dc3('0x9'));var ejs=require(_0x4dc3('0xa'));var fs=require('fs');var fs_extra=require(_0x4dc3('0xb'));var _=require(_0x4dc3('0xc'));var squel=require(_0x4dc3('0xd'));var crypto=require(_0x4dc3('0xe'));var jsforce=require(_0x4dc3('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4dc3('0x10'));var Papa=require('papaparse');var Redis=require(_0x4dc3('0x11'));var authService=require(_0x4dc3('0x12'));var qs=require(_0x4dc3('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4dc3('0x14'));var logger=require(_0x4dc3('0x15'))(_0x4dc3('0x16'));var utils=require(_0x4dc3('0x17'));var config=require(_0x4dc3('0x18'));var licenseUtil=require(_0x4dc3('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2c7480,_0x3ed19d){_0x3ed19d=_0x3ed19d||0xcc;return function(_0x57f2f7){if(_0x57f2f7){return _0x2c7480['sendStatus'](_0x3ed19d);}return _0x2c7480['status'](_0x3ed19d)[_0x4dc3('0x1a')]();};}function respondWithResult(_0x57fc33,_0x9c3f2){_0x9c3f2=_0x9c3f2||0xc8;return function(_0x13b5c6){if(_0x13b5c6){return _0x57fc33[_0x4dc3('0x1b')](_0x9c3f2)[_0x4dc3('0x1c')](_0x13b5c6);}};}function respondWithFilteredResult(_0x37c61b,_0x292bf0){return function(_0x504b84){if(_0x504b84){var _0x1337b8=typeof _0x292bf0['offset']===_0x4dc3('0x1d')&&typeof _0x292bf0['limit']==='undefined';var _0x400fca=_0x504b84[_0x4dc3('0x1e')];var _0x2d1711=_0x1337b8?0x0:_0x292bf0[_0x4dc3('0x1f')];var _0x4e92d2=_0x1337b8?_0x504b84[_0x4dc3('0x1e')]:_0x292bf0[_0x4dc3('0x1f')]+_0x292bf0[_0x4dc3('0x20')];var _0x355294;if(_0x4e92d2>=_0x400fca){_0x4e92d2=_0x400fca;_0x355294=0xc8;}else{_0x355294=0xce;}_0x37c61b['status'](_0x355294);return _0x37c61b['set'](_0x4dc3('0x21'),_0x2d1711+'-'+_0x4e92d2+'/'+_0x400fca)['json'](_0x504b84);}return null;};}function patchUpdates(_0x5129ac){return function(_0x5b66e8){try{jsonpatch[_0x4dc3('0x22')](_0x5b66e8,_0x5129ac,!![]);}catch(_0x39bfbf){return BPromise['reject'](_0x39bfbf);}return _0x5b66e8[_0x4dc3('0x23')]();};}function saveUpdates(_0x4cb450,_0x5ed613){return function(_0x498011){if(_0x498011){return _0x498011[_0x4dc3('0x24')](_0x4cb450)[_0x4dc3('0x25')](function(_0x573bf4){return _0x573bf4;});}return null;};}function removeEntity(_0x22d0a9,_0x2e6d22){return function(_0x351e4f){if(_0x351e4f){return _0x351e4f[_0x4dc3('0x26')]()['then'](function(){_0x22d0a9[_0x4dc3('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x579e6c,_0x4143b1){return function(_0x502aba){if(!_0x502aba){_0x579e6c[_0x4dc3('0x27')](0x194);}return _0x502aba;};}function handleError(_0x2a337e,_0x22c76b){_0x22c76b=_0x22c76b||0x1f4;return function(_0x51d6d8){logger[_0x4dc3('0x28')](_0x51d6d8['stack']);if(_0x51d6d8[_0x4dc3('0x29')]){delete _0x51d6d8[_0x4dc3('0x29')];}_0x2a337e[_0x4dc3('0x1b')](_0x22c76b)[_0x4dc3('0x2a')](_0x51d6d8);};}exports[_0x4dc3('0x2b')]=function(_0x58ed6c,_0x591c2c){var _0x23d22e={},_0x1c8d7d={},_0x4b7ceb={'count':0x0,'rows':[]};var _0x5216ee=_['map'](db['VoiceDialReport']['rawAttributes'],function(_0x3c9754){return{'name':_0x3c9754[_0x4dc3('0x2c')],'type':_0x3c9754[_0x4dc3('0x2d')]['key']};});_0x1c8d7d['model']=_[_0x4dc3('0x2e')](_0x5216ee,_0x4dc3('0x29'));_0x1c8d7d[_0x4dc3('0x2f')]=_[_0x4dc3('0x30')](_0x58ed6c[_0x4dc3('0x2f')]);_0x1c8d7d['filters']=_[_0x4dc3('0x31')](_0x1c8d7d[_0x4dc3('0x32')],_0x1c8d7d['query']);_0x23d22e[_0x4dc3('0x33')]=_[_0x4dc3('0x31')](_0x1c8d7d['model'],qs[_0x4dc3('0x34')](_0x58ed6c[_0x4dc3('0x2f')][_0x4dc3('0x34')]));_0x23d22e['attributes']=_0x23d22e[_0x4dc3('0x33')][_0x4dc3('0x35')]?_0x23d22e[_0x4dc3('0x33')]:_0x1c8d7d[_0x4dc3('0x32')];if(!_0x58ed6c[_0x4dc3('0x2f')]['hasOwnProperty'](_0x4dc3('0x36'))){_0x23d22e['limit']=qs[_0x4dc3('0x20')](_0x58ed6c['query'][_0x4dc3('0x20')]);_0x23d22e[_0x4dc3('0x1f')]=qs[_0x4dc3('0x1f')](_0x58ed6c[_0x4dc3('0x2f')][_0x4dc3('0x1f')]);}_0x23d22e[_0x4dc3('0x37')]=qs[_0x4dc3('0x38')](_0x58ed6c['query'][_0x4dc3('0x38')]);_0x23d22e[_0x4dc3('0x39')]=qs[_0x4dc3('0x3a')](_[_0x4dc3('0x3b')](_0x58ed6c[_0x4dc3('0x2f')],_0x1c8d7d['filters']),_0x5216ee);if(_0x58ed6c['query'][_0x4dc3('0x3c')]){_0x23d22e[_0x4dc3('0x39')]=_[_0x4dc3('0x3d')](_0x23d22e[_0x4dc3('0x39')],{'$or':_['map'](_0x5216ee,function(_0x192280){if(_0x192280[_0x4dc3('0x2d')]!==_0x4dc3('0x3e')){var _0x5a369c={};_0x5a369c[_0x192280[_0x4dc3('0x29')]]={'$like':'%'+_0x58ed6c['query'][_0x4dc3('0x3c')]+'%'};return _0x5a369c;}})});}_0x23d22e=_['merge']({},_0x23d22e,_0x58ed6c[_0x4dc3('0x3f')]);var _0x1a095b={'where':_0x23d22e[_0x4dc3('0x39')]};return db[_0x4dc3('0x40')][_0x4dc3('0x1e')](_0x1a095b)[_0x4dc3('0x25')](function(_0x1fba3c){_0x4b7ceb['count']=_0x1fba3c;if(_0x58ed6c[_0x4dc3('0x2f')][_0x4dc3('0x41')]){_0x23d22e[_0x4dc3('0x42')]=[{'all':!![]}];}return db['VoiceDialReport'][_0x4dc3('0x43')](_0x23d22e);})['then'](function(_0x2fd6a0){_0x4b7ceb[_0x4dc3('0x44')]=_0x2fd6a0;return _0x4b7ceb;})[_0x4dc3('0x25')](respondWithFilteredResult(_0x591c2c,_0x23d22e))[_0x4dc3('0x45')](handleError(_0x591c2c,null));};exports[_0x4dc3('0x46')]=function(_0x336e24,_0x1188bd){var _0x5dd49c={'raw':!![],'where':{'id':_0x336e24[_0x4dc3('0x47')]['id']}},_0x4f5d79={};_0x4f5d79[_0x4dc3('0x32')]=_[_0x4dc3('0x30')](db['VoiceDialReport'][_0x4dc3('0x48')]);_0x4f5d79[_0x4dc3('0x2f')]=_['keys'](_0x336e24[_0x4dc3('0x2f')]);_0x4f5d79[_0x4dc3('0x3a')]=_['intersection'](_0x4f5d79[_0x4dc3('0x32')],_0x4f5d79[_0x4dc3('0x2f')]);_0x5dd49c[_0x4dc3('0x33')]=_['intersection'](_0x4f5d79['model'],qs[_0x4dc3('0x34')](_0x336e24[_0x4dc3('0x2f')][_0x4dc3('0x34')]));_0x5dd49c[_0x4dc3('0x33')]=_0x5dd49c[_0x4dc3('0x33')]['length']?_0x5dd49c[_0x4dc3('0x33')]:_0x4f5d79[_0x4dc3('0x32')];if(_0x336e24[_0x4dc3('0x2f')][_0x4dc3('0x41')]){_0x5dd49c[_0x4dc3('0x42')]=[{'all':!![]}];}_0x5dd49c=_[_0x4dc3('0x3d')]({},_0x5dd49c,_0x336e24[_0x4dc3('0x3f')]);return db[_0x4dc3('0x40')][_0x4dc3('0x49')](_0x5dd49c)['then'](handleEntityNotFound(_0x1188bd,null))[_0x4dc3('0x25')](respondWithResult(_0x1188bd,null))[_0x4dc3('0x45')](handleError(_0x1188bd,null));};exports['create']=function(_0xb4ee09,_0x193305){return db[_0x4dc3('0x40')][_0x4dc3('0x4a')](_0xb4ee09['body'],{})[_0x4dc3('0x25')](respondWithResult(_0x193305,0xc9))[_0x4dc3('0x45')](handleError(_0x193305,null));};exports['update']=function(_0x419f0e,_0x45392d){if(_0x419f0e[_0x4dc3('0x4b')]['id']){delete _0x419f0e[_0x4dc3('0x4b')]['id'];}return db[_0x4dc3('0x40')][_0x4dc3('0x49')]({'where':{'id':_0x419f0e[_0x4dc3('0x47')]['id']}})[_0x4dc3('0x25')](handleEntityNotFound(_0x45392d,null))[_0x4dc3('0x25')](saveUpdates(_0x419f0e[_0x4dc3('0x4b')],null))[_0x4dc3('0x25')](respondWithResult(_0x45392d,null))['catch'](handleError(_0x45392d,null));};exports[_0x4dc3('0x26')]=function(_0x2d2c6a,_0x5869bb){return db['VoiceDialReport'][_0x4dc3('0x49')]({'where':{'id':_0x2d2c6a[_0x4dc3('0x47')]['id']}})[_0x4dc3('0x25')](handleEntityNotFound(_0x5869bb,null))[_0x4dc3('0x25')](removeEntity(_0x5869bb,null))[_0x4dc3('0x45')](handleError(_0x5869bb,null));};exports[_0x4dc3('0x4c')]=function(_0x3420ea,_0x3d5288){return db[_0x4dc3('0x40')][_0x4dc3('0x4c')]()[_0x4dc3('0x25')](respondWithResult(_0x3d5288,null))['catch'](handleError(_0x3d5288,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 44552c4..9f63768 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 _0x7d82=['VoiceDialReport','uniqueid','lodash','../../config/logger','moment','bluebird','path','../../config/environment','exports','define'];(function(_0x4e5a14,_0x402955){var _0x4a87e1=function(_0x13ba74){while(--_0x13ba74){_0x4e5a14['push'](_0x4e5a14['shift']());}};_0x4a87e1(++_0x402955);}(_0x7d82,0x174));var _0x27d8=function(_0x474a68,_0x3aa54f){_0x474a68=_0x474a68-0x0;var _0x1a9729=_0x7d82[_0x474a68];return _0x1a9729;};'use strict';var _=require(_0x27d8('0x0'));var util=require('util');var logger=require(_0x27d8('0x1'))('api');var moment=require(_0x27d8('0x2'));var BPromise=require(_0x27d8('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x27d8('0x4'));var rimraf=require('rimraf');var config=require(_0x27d8('0x5'));var attributes=require('./voiceDialReport.attributes');module[_0x27d8('0x6')]=function(_0x449d6a,_0x459925){return _0x449d6a[_0x27d8('0x7')](_0x27d8('0x8'),attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':[_0x27d8('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xac05=['define','VoiceDialReport','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x535617,_0x229ffe){var _0x542d35=function(_0x44978d){while(--_0x44978d){_0x535617['push'](_0x535617['shift']());}};_0x542d35(++_0x229ffe);}(_0xac05,0x1c3));var _0x5ac0=function(_0x52e3c9,_0x1f639c){_0x52e3c9=_0x52e3c9-0x0;var _0x41c430=_0xac05[_0x52e3c9];return _0x41c430;};'use strict';var _=require(_0x5ac0('0x0'));var util=require(_0x5ac0('0x1'));var logger=require(_0x5ac0('0x2'))(_0x5ac0('0x3'));var moment=require(_0x5ac0('0x4'));var BPromise=require(_0x5ac0('0x5'));var rp=require(_0x5ac0('0x6'));var fs=require('fs');var path=require(_0x5ac0('0x7'));var rimraf=require(_0x5ac0('0x8'));var config=require(_0x5ac0('0x9'));var attributes=require('./voiceDialReport.attributes');module[_0x5ac0('0xa')]=function(_0xfcf73e,_0x5ca7e4){return _0xfcf73e[_0x5ac0('0xb')](_0x5ac0('0xc'),attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':[_0x5ac0('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 a630614..52d3f7e 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 _0xb717=['VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateVoiceDialReport','VoiceDialReport','create','options','raw','UpdateVoiceDialReport','update','where','attributes','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x4b5961,_0x4f474f){var _0x1ce58c=function(_0x47d960){while(--_0x47d960){_0x4b5961['push'](_0x4b5961['shift']());}};_0x1ce58c(++_0x4f474f);}(_0xb717,0x8f));var _0x7b71=function(_0x20de86,_0x3e61ab){_0x20de86=_0x20de86-0x0;var _0xc45a70=_0xb717[_0x20de86];return _0xc45a70;};'use strict';var _=require(_0x7b71('0x0'));var util=require('util');var moment=require(_0x7b71('0x1'));var BPromise=require(_0x7b71('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7b71('0x3'));var db=require(_0x7b71('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x7b71('0x5'))(_0x7b71('0x6'));var config=require(_0x7b71('0x7'));var jayson=require(_0x7b71('0x8'));var client=jayson[_0x7b71('0x9')][_0x7b71('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x32dfe4,_0x46204f,_0x59fa2b){return new BPromise(function(_0x249f9d,_0x5a7645){return client[_0x7b71('0xb')](_0x32dfe4,_0x59fa2b)[_0x7b71('0xc')](function(_0x2b9dbd){logger[_0x7b71('0xd')](_0x7b71('0xe'),_0x46204f,_0x7b71('0xf'));logger[_0x7b71('0x10')](_0x7b71('0x11'),_0x46204f,_0x7b71('0xf'),JSON[_0x7b71('0x12')](_0x2b9dbd));if(_0x2b9dbd[_0x7b71('0x13')]){if(_0x2b9dbd[_0x7b71('0x13')]['code']===0x1f4){logger['error'](_0x7b71('0xe'),_0x46204f,_0x2b9dbd[_0x7b71('0x13')][_0x7b71('0x14')]);return _0x5a7645(_0x2b9dbd[_0x7b71('0x13')][_0x7b71('0x14')]);}logger[_0x7b71('0x13')](_0x7b71('0xe'),_0x46204f,_0x2b9dbd['error']['message']);return _0x249f9d(_0x2b9dbd['error'][_0x7b71('0x14')]);}else{logger[_0x7b71('0xd')]('VoiceDialReport,\x20%s,\x20%s',_0x46204f,'request\x20sent');_0x249f9d(_0x2b9dbd[_0x7b71('0x15')][_0x7b71('0x14')]);}})[_0x7b71('0x16')](function(_0x128711){logger[_0x7b71('0x13')](_0x7b71('0xe'),_0x46204f,_0x128711);_0x5a7645(_0x128711);});});}exports[_0x7b71('0x17')]=function(_0x3b26bf){var _0x55e330=this;return new Promise(function(_0x5384d8,_0x12892d){return db[_0x7b71('0x18')][_0x7b71('0x19')](_0x3b26bf['body'],{'raw':_0x3b26bf[_0x7b71('0x1a')]?_0x3b26bf[_0x7b71('0x1a')][_0x7b71('0x1b')]===undefined?!![]:![]:!![]})[_0x7b71('0xc')](function(_0x16615e){logger['info']('CreateVoiceDialReport',_0x3b26bf);logger[_0x7b71('0x10')]('CreateVoiceDialReport',_0x3b26bf,JSON[_0x7b71('0x12')](_0x16615e));_0x5384d8(_0x16615e);})[_0x7b71('0x16')](function(_0x37e38c){logger[_0x7b71('0x13')](_0x7b71('0x17'),_0x37e38c[_0x7b71('0x14')],_0x3b26bf);_0x12892d(_0x55e330[_0x7b71('0x13')](0x1f4,_0x37e38c[_0x7b71('0x14')]));});});};exports[_0x7b71('0x1c')]=function(_0x1e9c7a){var _0x37505a=this;return new Promise(function(_0x50fc87,_0x9c51cc){return db[_0x7b71('0x18')][_0x7b71('0x1d')](_0x1e9c7a['body'],{'raw':_0x1e9c7a['options']?_0x1e9c7a[_0x7b71('0x1a')][_0x7b71('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1e9c7a[_0x7b71('0x1a')]?_0x1e9c7a[_0x7b71('0x1a')][_0x7b71('0x1e')]||null:null,'attributes':_0x1e9c7a['options']?_0x1e9c7a[_0x7b71('0x1a')][_0x7b71('0x1f')]||null:null,'limit':_0x1e9c7a[_0x7b71('0x1a')]?_0x1e9c7a[_0x7b71('0x1a')]['limit']||null:null})['then'](function(_0x50924b){logger['info'](_0x7b71('0x1c'),_0x1e9c7a);logger['debug'](_0x7b71('0x1c'),_0x1e9c7a,JSON[_0x7b71('0x12')](_0x50924b));_0x50fc87(_0x50924b);})[_0x7b71('0x16')](function(_0x750a59){logger[_0x7b71('0x13')]('UpdateVoiceDialReport',_0x750a59[_0x7b71('0x14')],_0x1e9c7a);_0x9c51cc(_0x37505a['error'](0x1f4,_0x750a59[_0x7b71('0x14')]));});});}; \ No newline at end of file +var _0x9c70=['options','raw','CreateVoiceDialReport','UpdateVoiceDialReport','body','limit','debug','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','VoiceDialReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','VoiceDialReport','create'];(function(_0x4d121d,_0x3fe733){var _0xffa031=function(_0x1fec1b){while(--_0x1fec1b){_0x4d121d['push'](_0x4d121d['shift']());}};_0xffa031(++_0x3fe733);}(_0x9c70,0x98));var _0x09c7=function(_0xd4470d,_0x47318d){_0xd4470d=_0xd4470d-0x0;var _0x5544c5=_0x9c70[_0xd4470d];return _0x5544c5;};'use strict';var _=require('lodash');var util=require(_0x09c7('0x0'));var moment=require('moment');var BPromise=require(_0x09c7('0x1'));var rs=require(_0x09c7('0x2'));var fs=require('fs');var Redis=require(_0x09c7('0x3'));var db=require(_0x09c7('0x4'))['db'];var utils=require(_0x09c7('0x5'));var logger=require('../../config/logger')(_0x09c7('0x6'));var config=require(_0x09c7('0x7'));var jayson=require(_0x09c7('0x8'));var client=jayson[_0x09c7('0x9')][_0x09c7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xb63ef,_0x8b4fec,_0x459211){return new BPromise(function(_0x49022c,_0x414844){return client['request'](_0xb63ef,_0x459211)[_0x09c7('0xb')](function(_0x305dec){logger[_0x09c7('0xc')](_0x09c7('0xd'),_0x8b4fec,_0x09c7('0xe'));logger['debug'](_0x09c7('0xf'),_0x8b4fec,_0x09c7('0xe'),JSON['stringify'](_0x305dec));if(_0x305dec['error']){if(_0x305dec[_0x09c7('0x10')]['code']===0x1f4){logger[_0x09c7('0x10')](_0x09c7('0xd'),_0x8b4fec,_0x305dec[_0x09c7('0x10')][_0x09c7('0x11')]);return _0x414844(_0x305dec[_0x09c7('0x10')][_0x09c7('0x11')]);}logger[_0x09c7('0x10')]('VoiceDialReport,\x20%s,\x20%s',_0x8b4fec,_0x305dec[_0x09c7('0x10')][_0x09c7('0x11')]);return _0x49022c(_0x305dec[_0x09c7('0x10')][_0x09c7('0x11')]);}else{logger[_0x09c7('0xc')]('VoiceDialReport,\x20%s,\x20%s',_0x8b4fec,_0x09c7('0xe'));_0x49022c(_0x305dec[_0x09c7('0x12')][_0x09c7('0x11')]);}})[_0x09c7('0x13')](function(_0x346332){logger[_0x09c7('0x10')](_0x09c7('0xd'),_0x8b4fec,_0x346332);_0x414844(_0x346332);});});}exports['CreateVoiceDialReport']=function(_0x35b396){var _0x1c5799=this;return new Promise(function(_0x4803e2,_0x20432d){return db[_0x09c7('0x14')][_0x09c7('0x15')](_0x35b396['body'],{'raw':_0x35b396[_0x09c7('0x16')]?_0x35b396[_0x09c7('0x16')][_0x09c7('0x17')]===undefined?!![]:![]:!![]})[_0x09c7('0xb')](function(_0x49e2c7){logger[_0x09c7('0xc')](_0x09c7('0x18'),_0x35b396);logger['debug']('CreateVoiceDialReport',_0x35b396,JSON['stringify'](_0x49e2c7));_0x4803e2(_0x49e2c7);})[_0x09c7('0x13')](function(_0x787298){logger['error'](_0x09c7('0x18'),_0x787298[_0x09c7('0x11')],_0x35b396);_0x20432d(_0x1c5799[_0x09c7('0x10')](0x1f4,_0x787298[_0x09c7('0x11')]));});});};exports[_0x09c7('0x19')]=function(_0x4b2caf){var _0x276537=this;return new Promise(function(_0x86a4e0,_0x119cfc){return db[_0x09c7('0x14')]['update'](_0x4b2caf[_0x09c7('0x1a')],{'raw':_0x4b2caf[_0x09c7('0x16')]?_0x4b2caf[_0x09c7('0x16')][_0x09c7('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b2caf['options']?_0x4b2caf[_0x09c7('0x16')]['where']||null:null,'attributes':_0x4b2caf[_0x09c7('0x16')]?_0x4b2caf[_0x09c7('0x16')]['attributes']||null:null,'limit':_0x4b2caf['options']?_0x4b2caf[_0x09c7('0x16')][_0x09c7('0x1b')]||null:null})['then'](function(_0x156d5f){logger[_0x09c7('0xc')](_0x09c7('0x19'),_0x4b2caf);logger[_0x09c7('0x1c')](_0x09c7('0x19'),_0x4b2caf,JSON['stringify'](_0x156d5f));_0x86a4e0(_0x156d5f);})[_0x09c7('0x13')](function(_0x3bbb6e){logger['error'](_0x09c7('0x19'),_0x3bbb6e[_0x09c7('0x11')],_0x4b2caf);_0x119cfc(_0x276537[_0x09c7('0x10')](0x1f4,_0x3bbb6e[_0x09c7('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 69446a5..b7bacf2 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 _0x57fa=['isAuthenticated','index','/:id','create','post','/:id/applications','addApplications','put','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','get'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x57fa,0x173));var _0xa57f=function(_0x208934,_0x3b60c3){_0x208934=_0x208934-0x0;var _0x2695de=_0x57fa[_0x208934];return _0x2695de;};'use strict';var multer=require(_0xa57f('0x0'));var util=require(_0xa57f('0x1'));var path=require(_0xa57f('0x2'));var timeout=require(_0xa57f('0x3'));var express=require('express');var router=express[_0xa57f('0x4')]();var fs_extra=require(_0xa57f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xa57f('0x6'));var config=require(_0xa57f('0x7'));var controller=require('./voiceExtension.controller');router[_0xa57f('0x8')]('/',auth[_0xa57f('0x9')](),controller[_0xa57f('0xa')]);router[_0xa57f('0x8')](_0xa57f('0xb'),auth[_0xa57f('0x9')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xa57f('0xc')]);router[_0xa57f('0xd')](_0xa57f('0xe'),auth[_0xa57f('0x9')](),controller[_0xa57f('0xf')]);router[_0xa57f('0x10')](_0xa57f('0xb'),auth[_0xa57f('0x9')](),controller['update']);router['delete']('/:id',auth[_0xa57f('0x9')](),controller[_0xa57f('0x11')]);module[_0xa57f('0x12')]=router; \ No newline at end of file +var _0x8cba=['./voiceExtension.controller','get','isAuthenticated','index','/:id','show','post','addApplications','put','update','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x1b6c6d,_0x2983b0){var _0x290d9d=function(_0x5b9779){while(--_0x5b9779){_0x1b6c6d['push'](_0x1b6c6d['shift']());}};_0x290d9d(++_0x2983b0);}(_0x8cba,0xa3));var _0xa8cb=function(_0x1785e8,_0x492aac){_0x1785e8=_0x1785e8-0x0;var _0x5e6021=_0x8cba[_0x1785e8];return _0x5e6021;};'use strict';var multer=require(_0xa8cb('0x0'));var util=require(_0xa8cb('0x1'));var path=require('path');var timeout=require(_0xa8cb('0x2'));var express=require(_0xa8cb('0x3'));var router=express[_0xa8cb('0x4')]();var fs_extra=require(_0xa8cb('0x5'));var auth=require(_0xa8cb('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xa8cb('0x7'));var controller=require(_0xa8cb('0x8'));router[_0xa8cb('0x9')]('/',auth[_0xa8cb('0xa')](),controller[_0xa8cb('0xb')]);router['get'](_0xa8cb('0xc'),auth['isAuthenticated'](),controller[_0xa8cb('0xd')]);router[_0xa8cb('0xe')]('/',auth[_0xa8cb('0xa')](),controller['create']);router[_0xa8cb('0xe')]('/:id/applications',auth[_0xa8cb('0xa')](),controller[_0xa8cb('0xf')]);router[_0xa8cb('0x10')](_0xa8cb('0xc'),auth[_0xa8cb('0xa')](),controller[_0xa8cb('0x11')]);router['delete']('/:id',auth[_0xa8cb('0xa')](),controller['destroy']);module[_0xa8cb('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 80a8960..534a3bd 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 _0x9fa5=['system','*,*,*,*','INTEGER','BOOLEAN','wav','getDataValue','exten','sequelize','exports','compositeIndex','STRING','ENUM','internal','inbound-fax'];(function(_0xcfeda9,_0xd418ae){var _0x4826c7=function(_0x45dc9d){while(--_0x45dc9d){_0xcfeda9['push'](_0xcfeda9['shift']());}};_0x4826c7(++_0xd418ae);}(_0x9fa5,0x12d));var _0x59fa=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0x9fa5[_0x220dbb];return _0x2b77de;};'use strict';var Sequelize=require(_0x59fa('0x0'));module[_0x59fa('0x1')]={'context':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x59fa('0x2'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x59fa('0x3')],'allowNull':![],'unique':_0x59fa('0x2')},'priority':{'type':Sequelize[_0x59fa('0x3')],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x59fa('0x3')],'allowNull':![],'defaultValue':'NoOp'},'appdata':{'type':Sequelize[_0x59fa('0x3')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x59fa('0x4')]('inbound','outbound',_0x59fa('0x5'),_0x59fa('0x6'),'outbound-fax',_0x59fa('0x7'),'any'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x59fa('0x3')],'allowNull':![],'defaultValue':_0x59fa('0x8')},'IntervalId':{'type':Sequelize[_0x59fa('0x9')]},'isApp':{'type':Sequelize[_0x59fa('0xa')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x59fa('0x3')],'defaultValue':null},'callerID':{'type':Sequelize[_0x59fa('0x3')],'allowNull':!![]},'record':{'type':Sequelize[_0x59fa('0xa')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x59fa('0x9')]},'recordingFormat':{'type':Sequelize[_0x59fa('0x3')],'defaultValue':_0x59fa('0xb')},'answer':{'type':Sequelize[_0x59fa('0xa')],'defaultValue':!![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x25b718){return this[_0x59fa('0xc')](_0x59fa('0xd'));}},'alias':{'type':Sequelize[_0x59fa('0x3')],'allowNull':!![]}}; \ No newline at end of file +var _0x103a=['getDataValue','exten','sequelize','exports','STRING','compositeIndex','NoOp','ENUM','inbound','outbound','internal','system','*,*,*,*','INTEGER','BOOLEAN','wav','VIRTUAL'];(function(_0x4ac424,_0x554b5d){var _0xe1b890=function(_0x5e85c4){while(--_0x5e85c4){_0x4ac424['push'](_0x4ac424['shift']());}};_0xe1b890(++_0x554b5d);}(_0x103a,0x134));var _0xa103=function(_0xee852a,_0xaa3a3a){_0xee852a=_0xee852a-0x0;var _0x2af24d=_0x103a[_0xee852a];return _0x2af24d;};'use strict';var Sequelize=require(_0xa103('0x0'));module[_0xa103('0x1')]={'context':{'type':Sequelize[_0xa103('0x2')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':'compositeIndex'},'priority':{'type':Sequelize[_0xa103('0x2')],'allowNull':![],'defaultValue':'1','unique':_0xa103('0x3')},'tag':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xa103('0x4')},'appdata':{'type':Sequelize['STRING'](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0xa103('0x5')](_0xa103('0x6'),_0xa103('0x7'),_0xa103('0x8'),'inbound-fax','outbound-fax',_0xa103('0x9'),'any'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xa103('0x2')],'allowNull':![],'defaultValue':_0xa103('0xa')},'IntervalId':{'type':Sequelize[_0xa103('0xb')]},'isApp':{'type':Sequelize[_0xa103('0xc')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0xa103('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0xa103('0x2')],'allowNull':!![]},'record':{'type':Sequelize[_0xa103('0xc')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0xa103('0xb')]},'recordingFormat':{'type':Sequelize[_0xa103('0x2')],'defaultValue':_0xa103('0xd')},'answer':{'type':Sequelize[_0xa103('0xc')],'defaultValue':!![]},'name':{'type':Sequelize[_0xa103('0xe')],'get':function(_0x10e608){return this[_0xa103('0xf')](_0xa103('0x10'));}},'alias':{'type':Sequelize[_0xa103('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index f7edd4b..82ed670 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 _0x3a6f=['type','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','merge','options','includeAll','include','findAll','rows','catch','show','params','create','body','outbound','startsWith','exten','user','role','InternalRoutes','internal','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','recordingFormat','cutdigits','mandatoryDisposition','sequelize','Transaction','ISOLATION_LEVELS','findOne','VoiceExtensionId','isApp','createRouting','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','finally','lodash','ioredis','../../config/logger','api','../../config/environment','localhost','socket.io-emitter','redis','register','status','json','offset','undefined','limit','count','Content-Range','destroy','then','get','InboundRoutes','inbound','OutboundRoutes','filter','ignore','value','includes','find','name','UserProfileResource','end','error','stack','send','index','map','VoiceExtension','rawAttributes','fieldName'];(function(_0x546ac5,_0x59e59b){var _0x56a6d8=function(_0x2aff07){while(--_0x2aff07){_0x546ac5['push'](_0x546ac5['shift']());}};_0x56a6d8(++_0x59e59b);}(_0x3a6f,0xe2));var _0xf3a6=function(_0x8bfce6,_0x592ef2){_0x8bfce6=_0x8bfce6-0x0;var _0x16bb30=_0x3a6f[_0x8bfce6];return _0x16bb30;};'use strict';var _=require(_0xf3a6('0x0'));var Redis=require(_0xf3a6('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0xf3a6('0x2'))(_0xf3a6('0x3'));var config=require(_0xf3a6('0x4'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config['redis'],{'host':_0xf3a6('0x5'),'port':0x18eb});var socket=require(_0xf3a6('0x6'))(new Redis(config[_0xf3a6('0x7')]));require('./voiceExtension.socket')[_0xf3a6('0x8')](socket);function respondWithStatusCode(_0x43ef34,_0x4b063d){_0x4b063d=_0x4b063d||0xcc;return function(_0x578571){if(_0x578571){return _0x43ef34['sendStatus'](_0x4b063d);}return _0x43ef34[_0xf3a6('0x9')](_0x4b063d)['end']();};}function respondWithResult(_0xe9c0fd,_0x95ea8b){_0x95ea8b=_0x95ea8b||0xc8;return function(_0x426960){if(_0x426960){return _0xe9c0fd[_0xf3a6('0x9')](_0x95ea8b)[_0xf3a6('0xa')](_0x426960);}};}function respondWithFilteredResult(_0xef369d,_0x1f6e9a){return function(_0xbb0371){if(_0xbb0371){var _0x4994b8=typeof _0x1f6e9a[_0xf3a6('0xb')]===_0xf3a6('0xc')&&typeof _0x1f6e9a[_0xf3a6('0xd')]==='undefined';var _0x501a10=_0xbb0371[_0xf3a6('0xe')];var _0x2b485f=_0x4994b8?0x0:_0x1f6e9a[_0xf3a6('0xb')];var _0x33e05b=_0x4994b8?_0xbb0371[_0xf3a6('0xe')]:_0x1f6e9a[_0xf3a6('0xb')]+_0x1f6e9a[_0xf3a6('0xd')];var _0x458151;if(_0x33e05b>=_0x501a10){_0x33e05b=_0x501a10;_0x458151=0xc8;}else{_0x458151=0xce;}_0xef369d[_0xf3a6('0x9')](_0x458151);return _0xef369d['set'](_0xf3a6('0xf'),_0x2b485f+'-'+_0x33e05b+'/'+_0x501a10)[_0xf3a6('0xa')](_0xbb0371);}return null;};}function removeEntity(_0x53a76e){return function(_0x329c84){if(_0x329c84){return _0x329c84[_0xf3a6('0x10')]()[_0xf3a6('0x11')](function(){var _0x8ee86f=_0x329c84[_0xf3a6('0x12')]({'plain':!![]});var _0x1cbd20=[{'name':_0xf3a6('0x13'),'value':_0xf3a6('0x14'),'ignore':![]},{'name':_0xf3a6('0x15'),'value':'outbound','ignore':![]},{'name':'InternalRoutes','value':'internal','ignore':![]}];var _0x1372e7=_(_0x1cbd20)[_0xf3a6('0x16')](_0xf3a6('0x17'))['map'](_0xf3a6('0x18'))[_0xf3a6('0x18')]();if(_[_0xf3a6('0x19')](_0x1372e7,_0x8ee86f['type'])){return;}var _0x36ed64=_[_0xf3a6('0x1a')](_0x1cbd20,[_0xf3a6('0x18'),_0x8ee86f['type']])[_0xf3a6('0x1b')];return db[_0xf3a6('0x1c')][_0xf3a6('0x10')]({'where':{'type':_0x36ed64,'resourceId':_0x8ee86f['id']}})[_0xf3a6('0x11')](function(){return _0x329c84;});})[_0xf3a6('0x11')](function(){_0x53a76e[_0xf3a6('0x9')](0xcc)[_0xf3a6('0x1d')]();});}};}function handleEntityNotFound(_0xc119da){return function(_0x52042c){if(!_0x52042c){_0xc119da['sendStatus'](0x194);}return _0x52042c;};}function handleError(_0x5227aa,_0x22a4d4){_0x22a4d4=_0x22a4d4||0x1f4;return function(_0x1e3968){logger[_0xf3a6('0x1e')](_0x1e3968[_0xf3a6('0x1f')]);if(_0x1e3968[_0xf3a6('0x1b')]){delete _0x1e3968['name'];}_0x5227aa['status'](_0x22a4d4)[_0xf3a6('0x20')](_0x1e3968);};}exports[_0xf3a6('0x21')]=function(_0x2375de,_0xa45df7){var _0x47fd8a={},_0x351af8={},_0x3140ab={'count':0x0,'rows':[]};var _0x22a3fa=_[_0xf3a6('0x22')](db[_0xf3a6('0x23')][_0xf3a6('0x24')],function(_0x2c0d66){return{'name':_0x2c0d66[_0xf3a6('0x25')],'type':_0x2c0d66[_0xf3a6('0x26')]['key']};});_0x351af8[_0xf3a6('0x27')]=_[_0xf3a6('0x22')](_0x22a3fa,_0xf3a6('0x1b'));_0x351af8[_0xf3a6('0x28')]=_[_0xf3a6('0x29')](_0x2375de[_0xf3a6('0x28')]);_0x351af8[_0xf3a6('0x2a')]=_[_0xf3a6('0x2b')](_0x351af8['model'],_0x351af8[_0xf3a6('0x28')]);_0x47fd8a['attributes']=_['intersection'](_0x351af8['model'],qs[_0xf3a6('0x2c')](_0x2375de['query'][_0xf3a6('0x2c')]));_0x47fd8a[_0xf3a6('0x2d')]=_0x47fd8a[_0xf3a6('0x2d')]['length']?_0x47fd8a[_0xf3a6('0x2d')]:_0x351af8[_0xf3a6('0x27')];if(!_0x2375de['query'][_0xf3a6('0x2e')](_0xf3a6('0x2f'))){_0x47fd8a[_0xf3a6('0xd')]=qs['limit'](_0x2375de[_0xf3a6('0x28')][_0xf3a6('0xd')]);_0x47fd8a[_0xf3a6('0xb')]=qs[_0xf3a6('0xb')](_0x2375de[_0xf3a6('0x28')][_0xf3a6('0xb')]);}_0x47fd8a[_0xf3a6('0x30')]=qs[_0xf3a6('0x31')](_0x2375de['query'][_0xf3a6('0x31')]);_0x47fd8a[_0xf3a6('0x32')]=qs[_0xf3a6('0x2a')](_['pick'](_0x2375de[_0xf3a6('0x28')],_0x351af8[_0xf3a6('0x2a')]),_0x22a3fa);if(_0x2375de[_0xf3a6('0x28')][_0xf3a6('0x16')]){_0x47fd8a[_0xf3a6('0x32')]=_['merge'](_0x47fd8a[_0xf3a6('0x32')],{'$or':_['map'](_0x22a3fa,function(_0x47ec09){if(_0x47ec09[_0xf3a6('0x26')]!=='VIRTUAL'){var _0x4e7d38={};_0x4e7d38[_0x47ec09['name']]={'$like':'%'+_0x2375de[_0xf3a6('0x28')][_0xf3a6('0x16')]+'%'};return _0x4e7d38;}})});}_0x47fd8a=_[_0xf3a6('0x33')]({},_0x47fd8a,_0x2375de[_0xf3a6('0x34')]);var _0x3d7694={'where':_0x47fd8a[_0xf3a6('0x32')]};return db[_0xf3a6('0x23')][_0xf3a6('0xe')](_0x3d7694)[_0xf3a6('0x11')](function(_0x36acc8){_0x3140ab[_0xf3a6('0xe')]=_0x36acc8;if(_0x2375de[_0xf3a6('0x28')][_0xf3a6('0x35')]){_0x47fd8a[_0xf3a6('0x36')]=[{'all':!![]}];}return db[_0xf3a6('0x23')][_0xf3a6('0x37')](_0x47fd8a);})[_0xf3a6('0x11')](function(_0x377b08){_0x3140ab[_0xf3a6('0x38')]=_0x377b08;return _0x3140ab;})[_0xf3a6('0x11')](respondWithFilteredResult(_0xa45df7,_0x47fd8a))[_0xf3a6('0x39')](handleError(_0xa45df7,null));};exports[_0xf3a6('0x3a')]=function(_0x1c47ed,_0x4e1d19){var _0x23cbe3={'raw':![],'where':{'id':_0x1c47ed['params']['id']}},_0x46a1a1={};_0x46a1a1[_0xf3a6('0x27')]=_['keys'](db[_0xf3a6('0x23')][_0xf3a6('0x24')]);_0x46a1a1[_0xf3a6('0x28')]=_['keys'](_0x1c47ed[_0xf3a6('0x28')]);_0x46a1a1['filters']=_['intersection'](_0x46a1a1['model'],_0x46a1a1[_0xf3a6('0x28')]);_0x23cbe3[_0xf3a6('0x2d')]=_[_0xf3a6('0x2b')](_0x46a1a1[_0xf3a6('0x27')],qs[_0xf3a6('0x2c')](_0x1c47ed[_0xf3a6('0x28')][_0xf3a6('0x2c')]));_0x23cbe3[_0xf3a6('0x2d')]=_0x23cbe3[_0xf3a6('0x2d')]['length']?_0x23cbe3[_0xf3a6('0x2d')]:_0x46a1a1[_0xf3a6('0x27')];if(_0x1c47ed[_0xf3a6('0x28')][_0xf3a6('0x35')]){_0x23cbe3[_0xf3a6('0x36')]=[{'all':!![]}];}_0x23cbe3=_[_0xf3a6('0x33')]({},_0x23cbe3,_0x1c47ed[_0xf3a6('0x34')]);return db[_0xf3a6('0x23')]['find'](_0x23cbe3)[_0xf3a6('0x11')](handleEntityNotFound(_0x4e1d19,null))[_0xf3a6('0x11')](respondWithResult(_0x4e1d19,null))[_0xf3a6('0x39')](handleError(_0x4e1d19,null));};exports['destroy']=function(_0x3bf6d7,_0x2e19e4){return db['VoiceExtension']['find']({'where':{'id':_0x3bf6d7[_0xf3a6('0x3b')]['id']}})[_0xf3a6('0x11')](handleEntityNotFound(_0x2e19e4,null))['then'](removeEntity(_0x2e19e4,null))[_0xf3a6('0x39')](handleError(_0x2e19e4,null));};exports[_0xf3a6('0x3c')]=function(_0x470259,_0x22667c){if(_0x470259[_0xf3a6('0x3d')][_0xf3a6('0x26')]===_0xf3a6('0x3e')&&!_[_0xf3a6('0x3f')](_0x470259[_0xf3a6('0x3d')][_0xf3a6('0x40')],'_')){_0x470259['body'][_0xf3a6('0x40')]='_'['concat'](_0x470259['body']['exten']);}return db[_0xf3a6('0x23')][_0xf3a6('0x3c')](_0x470259[_0xf3a6('0x3d')],{'raw':![]})['then'](function(_0x1587d9){var _0x40c7ed=_0x470259[_0xf3a6('0x41')]['get']({'plain':!![]});if(!_0x40c7ed)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x40c7ed[_0xf3a6('0x42')]===_0xf3a6('0x41')){var _0x283843=_0x1587d9['get']({'plain':!![]});var _0x2d06af=[{'name':_0xf3a6('0x13'),'value':'inbound'},{'name':_0xf3a6('0x15'),'value':_0xf3a6('0x3e')},{'name':_0xf3a6('0x43'),'value':_0xf3a6('0x44')}];var _0x12479a=_[_0xf3a6('0x1a')](_0x2d06af,[_0xf3a6('0x18'),_0x283843[_0xf3a6('0x26')]])[_0xf3a6('0x1b')];return db[_0xf3a6('0x45')][_0xf3a6('0x1a')]({'where':{'name':_0x12479a,'userProfileId':_0x40c7ed['userProfileId']},'raw':!![]})[_0xf3a6('0x11')](function(_0x3ef6f6){if(_0x3ef6f6&&_0x3ef6f6[_0xf3a6('0x46')]===0x0){return db[_0xf3a6('0x1c')][_0xf3a6('0x3c')]({'name':_0x283843[_0xf3a6('0x1b')],'resourceId':_0x283843['id'],'type':_0x3ef6f6[_0xf3a6('0x1b')],'sectionId':_0x3ef6f6['id']},{})[_0xf3a6('0x11')](function(){return _0x1587d9;});}else{return _0x1587d9;}})['catch'](function(_0x22b590){logger[_0xf3a6('0x1e')](_0xf3a6('0x47'),_0x22b590);throw _0x22b590;});}return _0x1587d9;})[_0xf3a6('0x11')](respondWithResult(_0x22667c,0xc9))[_0xf3a6('0x39')](handleError(_0x22667c,null));};exports[_0xf3a6('0x48')]=function(_0x22f594,_0x377e93){if(_0x22f594[_0xf3a6('0x3d')]['id']){delete _0x22f594[_0xf3a6('0x3d')]['id'];}return db[_0xf3a6('0x23')]['find']({'where':{'id':_0x22f594[_0xf3a6('0x3b')]['id']}})[_0xf3a6('0x11')](handleEntityNotFound(_0x377e93,null))[_0xf3a6('0x11')](function(_0x3f72e0){if(_0x3f72e0){return db[_0xf3a6('0x23')][_0xf3a6('0x48')](_['pick'](_0x22f594[_0xf3a6('0x3d')],[_0xf3a6('0x40'),_0xf3a6('0x49'),'description',_0xf3a6('0x4a'),_0xf3a6('0x4b'),_0xf3a6('0x4c'),'alias']),{'where':{'context':_0x3f72e0[_0xf3a6('0x49')],'exten':_0x3f72e0[_0xf3a6('0x40')]},'individualHooks':!![]})['then'](function(_0x4b16a0){return _0x4b16a0;});}return null;})[_0xf3a6('0x11')](respondWithStatusCode(_0x377e93,null))[_0xf3a6('0x39')](handleError(_0x377e93,null));};exports['addApplications']=function(_0x1043fc,_0x160055){var _0x1de70b=_0x1043fc[_0xf3a6('0x3b')]['id'];var _0xff1116=_0x1043fc[_0xf3a6('0x3d')];var _0xa28388=0xc8;var _0x490de7=null;return db[_0xf3a6('0x4d')]['transaction']({'isolationLevel':db[_0xf3a6('0x4d')][_0xf3a6('0x4e')][_0xf3a6('0x4f')]['READ_COMMITTED']},function(_0x48aa20){return db[_0xf3a6('0x23')][_0xf3a6('0x50')]({'where':{'id':_0x1de70b},'transaction':_0x48aa20})['then'](function(_0x497c2d){if(_0x497c2d){return db[_0xf3a6('0x23')][_0xf3a6('0x10')]({'where':{'VoiceExtensionId':_0x1de70b},'transaction':_0x48aa20})[_0xf3a6('0x11')](function(){var _0x45ea51=_[_0xf3a6('0x22')](_0xff1116,function(_0x10c367){_0x10c367[_0xf3a6('0x51')]=_0x1de70b;_0x10c367[_0xf3a6('0x52')]=!![];return _0x10c367;});return _0x497c2d[_0xf3a6('0x53')](_0x45ea51);})[_0xf3a6('0x11')](function(_0x27b90a){return db['VoiceExtension'][_0xf3a6('0x54')](_0x27b90a,{'transaction':_0x48aa20});});}else{_0xa28388=0x194;_0x490de7=[];}});})[_0xf3a6('0x11')](function(){if(_0xa28388!==0x194){return db[_0xf3a6('0x23')][_0xf3a6('0x55')]({'where':{'isApp':!![],'VoiceExtensionId':_0x1de70b},'order':_0xf3a6('0x56')})[_0xf3a6('0x11')](function(_0x414fe7){_0x490de7=_0x414fe7;});}})[_0xf3a6('0x39')](function(_0x38ab96){_0xa28388=0x1f4;logger[_0xf3a6('0x1e')](_0x38ab96[_0xf3a6('0x1f')]);if(_0x38ab96[_0xf3a6('0x1b')]){delete _0x38ab96[_0xf3a6('0x1b')];}_0x490de7=_0x38ab96;})[_0xf3a6('0x57')](function(){if(_0x490de7===null){_0x160055['sendStatus'](_0xa28388);}else{if(_0xa28388===0x1f4){_0x160055[_0xf3a6('0x9')](_0xa28388)[_0xf3a6('0x20')](_0x490de7);}else{_0x160055[_0xf3a6('0x9')](_0xa28388)[_0xf3a6('0xa')](_0x490de7);}}});}; \ No newline at end of file +var _0x17c2=['localhost','socket.io-emitter','./voiceExtension.socket','undefined','limit','count','offset','status','Content-Range','json','destroy','get','inbound','OutboundRoutes','InternalRoutes','internal','filter','ignore','value','type','name','UserProfileResource','then','error','send','map','VoiceExtension','rawAttributes','key','query','keys','model','intersection','attributes','hasOwnProperty','nolimit','sort','where','filters','pick','merge','options','includeAll','findAll','rows','catch','show','params','fields','include','find','create','body','outbound','exten','user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','alias','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','VoiceExtensionId','isApp','bulkCreate','cast(priority\x20as\x20unsigned)','stack','finally','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults'];(function(_0x3f280a,_0xabd9fd){var _0x1ee43e=function(_0x1ca574){while(--_0x1ca574){_0x3f280a['push'](_0x3f280a['shift']());}};_0x1ee43e(++_0xabd9fd);}(_0x17c2,0x188));var _0x217c=function(_0x89ee68,_0x18ca4d){_0x89ee68=_0x89ee68-0x0;var _0x1dfd3b=_0x17c2[_0x89ee68];return _0x1dfd3b;};'use strict';var _=require('lodash');var Redis=require(_0x217c('0x0'));var qs=require(_0x217c('0x1'));var logger=require(_0x217c('0x2'))(_0x217c('0x3'));var config=require(_0x217c('0x4'));var db=require(_0x217c('0x5'))['db'];config[_0x217c('0x6')]=_[_0x217c('0x7')](config[_0x217c('0x6')],{'host':_0x217c('0x8'),'port':0x18eb});var socket=require(_0x217c('0x9'))(new Redis(config[_0x217c('0x6')]));require(_0x217c('0xa'))['register'](socket);function respondWithStatusCode(_0x5932cc,_0x3d7147){_0x3d7147=_0x3d7147||0xcc;return function(_0x3cb9be){if(_0x3cb9be){return _0x5932cc['sendStatus'](_0x3d7147);}return _0x5932cc['status'](_0x3d7147)['end']();};}function respondWithResult(_0x22e3e5,_0x3b0d7d){_0x3b0d7d=_0x3b0d7d||0xc8;return function(_0xdf1b2c){if(_0xdf1b2c){return _0x22e3e5['status'](_0x3b0d7d)['json'](_0xdf1b2c);}};}function respondWithFilteredResult(_0x2d8049,_0x2fe8e3){return function(_0x4c2574){if(_0x4c2574){var _0x3286ee=typeof _0x2fe8e3['offset']===_0x217c('0xb')&&typeof _0x2fe8e3[_0x217c('0xc')]===_0x217c('0xb');var _0x4efe8b=_0x4c2574[_0x217c('0xd')];var _0x1e9e13=_0x3286ee?0x0:_0x2fe8e3['offset'];var _0x3561fa=_0x3286ee?_0x4c2574[_0x217c('0xd')]:_0x2fe8e3[_0x217c('0xe')]+_0x2fe8e3[_0x217c('0xc')];var _0x2a6da9;if(_0x3561fa>=_0x4efe8b){_0x3561fa=_0x4efe8b;_0x2a6da9=0xc8;}else{_0x2a6da9=0xce;}_0x2d8049[_0x217c('0xf')](_0x2a6da9);return _0x2d8049['set'](_0x217c('0x10'),_0x1e9e13+'-'+_0x3561fa+'/'+_0x4efe8b)[_0x217c('0x11')](_0x4c2574);}return null;};}function removeEntity(_0xaf517c){return function(_0x2f067b){if(_0x2f067b){return _0x2f067b[_0x217c('0x12')]()['then'](function(){var _0x5373cb=_0x2f067b[_0x217c('0x13')]({'plain':!![]});var _0x4865e5=[{'name':'InboundRoutes','value':_0x217c('0x14'),'ignore':![]},{'name':_0x217c('0x15'),'value':'outbound','ignore':![]},{'name':_0x217c('0x16'),'value':_0x217c('0x17'),'ignore':![]}];var _0x3f329b=_(_0x4865e5)[_0x217c('0x18')](_0x217c('0x19'))['map'](_0x217c('0x1a'))[_0x217c('0x1a')]();if(_['includes'](_0x3f329b,_0x5373cb[_0x217c('0x1b')])){return;}var _0x15d7cd=_['find'](_0x4865e5,[_0x217c('0x1a'),_0x5373cb['type']])[_0x217c('0x1c')];return db[_0x217c('0x1d')][_0x217c('0x12')]({'where':{'type':_0x15d7cd,'resourceId':_0x5373cb['id']}})['then'](function(){return _0x2f067b;});})[_0x217c('0x1e')](function(){_0xaf517c[_0x217c('0xf')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5575fe){return function(_0x24c217){if(!_0x24c217){_0x5575fe['sendStatus'](0x194);}return _0x24c217;};}function handleError(_0x877c2c,_0x51e6b9){_0x51e6b9=_0x51e6b9||0x1f4;return function(_0x15f242){logger[_0x217c('0x1f')](_0x15f242['stack']);if(_0x15f242[_0x217c('0x1c')]){delete _0x15f242[_0x217c('0x1c')];}_0x877c2c[_0x217c('0xf')](_0x51e6b9)[_0x217c('0x20')](_0x15f242);};}exports['index']=function(_0x17ef2d,_0x38f8d1){var _0x5d1c30={},_0x2f1778={},_0x1b5b42={'count':0x0,'rows':[]};var _0x22309a=_[_0x217c('0x21')](db[_0x217c('0x22')][_0x217c('0x23')],function(_0x13297a){return{'name':_0x13297a['fieldName'],'type':_0x13297a[_0x217c('0x1b')][_0x217c('0x24')]};});_0x2f1778['model']=_[_0x217c('0x21')](_0x22309a,_0x217c('0x1c'));_0x2f1778[_0x217c('0x25')]=_[_0x217c('0x26')](_0x17ef2d[_0x217c('0x25')]);_0x2f1778['filters']=_['intersection'](_0x2f1778[_0x217c('0x27')],_0x2f1778[_0x217c('0x25')]);_0x5d1c30['attributes']=_[_0x217c('0x28')](_0x2f1778[_0x217c('0x27')],qs['fields'](_0x17ef2d[_0x217c('0x25')]['fields']));_0x5d1c30['attributes']=_0x5d1c30[_0x217c('0x29')]['length']?_0x5d1c30[_0x217c('0x29')]:_0x2f1778[_0x217c('0x27')];if(!_0x17ef2d[_0x217c('0x25')][_0x217c('0x2a')](_0x217c('0x2b'))){_0x5d1c30[_0x217c('0xc')]=qs[_0x217c('0xc')](_0x17ef2d[_0x217c('0x25')][_0x217c('0xc')]);_0x5d1c30[_0x217c('0xe')]=qs[_0x217c('0xe')](_0x17ef2d[_0x217c('0x25')][_0x217c('0xe')]);}_0x5d1c30['order']=qs[_0x217c('0x2c')](_0x17ef2d[_0x217c('0x25')][_0x217c('0x2c')]);_0x5d1c30[_0x217c('0x2d')]=qs[_0x217c('0x2e')](_[_0x217c('0x2f')](_0x17ef2d[_0x217c('0x25')],_0x2f1778[_0x217c('0x2e')]),_0x22309a);if(_0x17ef2d[_0x217c('0x25')][_0x217c('0x18')]){_0x5d1c30[_0x217c('0x2d')]=_[_0x217c('0x30')](_0x5d1c30[_0x217c('0x2d')],{'$or':_['map'](_0x22309a,function(_0x270ef3){if(_0x270ef3[_0x217c('0x1b')]!=='VIRTUAL'){var _0x219fae={};_0x219fae[_0x270ef3[_0x217c('0x1c')]]={'$like':'%'+_0x17ef2d[_0x217c('0x25')][_0x217c('0x18')]+'%'};return _0x219fae;}})});}_0x5d1c30=_[_0x217c('0x30')]({},_0x5d1c30,_0x17ef2d[_0x217c('0x31')]);var _0x558799={'where':_0x5d1c30['where']};return db[_0x217c('0x22')][_0x217c('0xd')](_0x558799)[_0x217c('0x1e')](function(_0x5ad164){_0x1b5b42[_0x217c('0xd')]=_0x5ad164;if(_0x17ef2d[_0x217c('0x25')][_0x217c('0x32')]){_0x5d1c30['include']=[{'all':!![]}];}return db['VoiceExtension'][_0x217c('0x33')](_0x5d1c30);})[_0x217c('0x1e')](function(_0x479328){_0x1b5b42[_0x217c('0x34')]=_0x479328;return _0x1b5b42;})[_0x217c('0x1e')](respondWithFilteredResult(_0x38f8d1,_0x5d1c30))[_0x217c('0x35')](handleError(_0x38f8d1,null));};exports[_0x217c('0x36')]=function(_0x57d5db,_0x2e4c6f){var _0x3f99f6={'raw':![],'where':{'id':_0x57d5db[_0x217c('0x37')]['id']}},_0x270e02={};_0x270e02[_0x217c('0x27')]=_['keys'](db[_0x217c('0x22')][_0x217c('0x23')]);_0x270e02['query']=_['keys'](_0x57d5db[_0x217c('0x25')]);_0x270e02[_0x217c('0x2e')]=_[_0x217c('0x28')](_0x270e02[_0x217c('0x27')],_0x270e02[_0x217c('0x25')]);_0x3f99f6[_0x217c('0x29')]=_[_0x217c('0x28')](_0x270e02[_0x217c('0x27')],qs[_0x217c('0x38')](_0x57d5db['query'][_0x217c('0x38')]));_0x3f99f6[_0x217c('0x29')]=_0x3f99f6[_0x217c('0x29')]['length']?_0x3f99f6[_0x217c('0x29')]:_0x270e02['model'];if(_0x57d5db['query']['includeAll']){_0x3f99f6[_0x217c('0x39')]=[{'all':!![]}];}_0x3f99f6=_['merge']({},_0x3f99f6,_0x57d5db[_0x217c('0x31')]);return db['VoiceExtension'][_0x217c('0x3a')](_0x3f99f6)[_0x217c('0x1e')](handleEntityNotFound(_0x2e4c6f,null))[_0x217c('0x1e')](respondWithResult(_0x2e4c6f,null))[_0x217c('0x35')](handleError(_0x2e4c6f,null));};exports[_0x217c('0x12')]=function(_0x34a46a,_0xccc78e){return db[_0x217c('0x22')][_0x217c('0x3a')]({'where':{'id':_0x34a46a['params']['id']}})[_0x217c('0x1e')](handleEntityNotFound(_0xccc78e,null))[_0x217c('0x1e')](removeEntity(_0xccc78e,null))['catch'](handleError(_0xccc78e,null));};exports[_0x217c('0x3b')]=function(_0x158264,_0x5aa81a){if(_0x158264[_0x217c('0x3c')][_0x217c('0x1b')]===_0x217c('0x3d')&&!_['startsWith'](_0x158264[_0x217c('0x3c')][_0x217c('0x3e')],'_')){_0x158264[_0x217c('0x3c')][_0x217c('0x3e')]='_'['concat'](_0x158264['body'][_0x217c('0x3e')]);}return db[_0x217c('0x22')]['create'](_0x158264[_0x217c('0x3c')],{'raw':![]})['then'](function(_0x160359){var _0x5a942b=_0x158264[_0x217c('0x3f')]['get']({'plain':!![]});if(!_0x5a942b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5a942b[_0x217c('0x40')]===_0x217c('0x3f')){var _0x26c2bd=_0x160359[_0x217c('0x13')]({'plain':!![]});var _0x3f18e3=[{'name':'InboundRoutes','value':'inbound'},{'name':_0x217c('0x15'),'value':_0x217c('0x3d')},{'name':_0x217c('0x16'),'value':_0x217c('0x17')}];var _0xe77b8f=_[_0x217c('0x3a')](_0x3f18e3,[_0x217c('0x1a'),_0x26c2bd[_0x217c('0x1b')]])[_0x217c('0x1c')];return db['UserProfileSection'][_0x217c('0x3a')]({'where':{'name':_0xe77b8f,'userProfileId':_0x5a942b[_0x217c('0x41')]},'raw':!![]})[_0x217c('0x1e')](function(_0x13c468){if(_0x13c468&&_0x13c468['autoAssociation']===0x0){return db[_0x217c('0x1d')]['create']({'name':_0x26c2bd['name'],'resourceId':_0x26c2bd['id'],'type':_0x13c468[_0x217c('0x1c')],'sectionId':_0x13c468['id']},{})[_0x217c('0x1e')](function(){return _0x160359;});}else{return _0x160359;}})['catch'](function(_0x1239e9){logger[_0x217c('0x1f')](_0x217c('0x42'),_0x1239e9);throw _0x1239e9;});}return _0x160359;})[_0x217c('0x1e')](respondWithResult(_0x5aa81a,0xc9))[_0x217c('0x35')](handleError(_0x5aa81a,null));};exports[_0x217c('0x43')]=function(_0x33b881,_0x1e58c9){if(_0x33b881[_0x217c('0x3c')]['id']){delete _0x33b881[_0x217c('0x3c')]['id'];}return db['VoiceExtension'][_0x217c('0x3a')]({'where':{'id':_0x33b881['params']['id']}})['then'](handleEntityNotFound(_0x1e58c9,null))['then'](function(_0x2730cc){if(_0x2730cc){return db[_0x217c('0x22')]['update'](_['pick'](_0x33b881[_0x217c('0x3c')],['exten',_0x217c('0x44'),'description','recordingFormat','cutdigits','mandatoryDisposition',_0x217c('0x45')]),{'where':{'context':_0x2730cc[_0x217c('0x44')],'exten':_0x2730cc[_0x217c('0x3e')]},'individualHooks':!![]})[_0x217c('0x1e')](function(_0x3fd7ea){return _0x3fd7ea;});}return null;})[_0x217c('0x1e')](respondWithStatusCode(_0x1e58c9,null))[_0x217c('0x35')](handleError(_0x1e58c9,null));};exports['addApplications']=function(_0x4491e4,_0x42cff7){var _0x11ee11=_0x4491e4[_0x217c('0x37')]['id'];var _0x249936=_0x4491e4[_0x217c('0x3c')];var _0xc6cc3f=0xc8;var _0x1a8bd3=null;return db[_0x217c('0x46')]['transaction']({'isolationLevel':db[_0x217c('0x46')][_0x217c('0x47')][_0x217c('0x48')][_0x217c('0x49')]},function(_0x362792){return db[_0x217c('0x22')]['findOne']({'where':{'id':_0x11ee11},'transaction':_0x362792})[_0x217c('0x1e')](function(_0x34df05){if(_0x34df05){return db[_0x217c('0x22')][_0x217c('0x12')]({'where':{'VoiceExtensionId':_0x11ee11},'transaction':_0x362792})[_0x217c('0x1e')](function(){var _0x31e4a7=_[_0x217c('0x21')](_0x249936,function(_0x3d2237){_0x3d2237[_0x217c('0x4a')]=_0x11ee11;_0x3d2237[_0x217c('0x4b')]=!![];return _0x3d2237;});return _0x34df05['createRouting'](_0x31e4a7);})[_0x217c('0x1e')](function(_0x23570b){return db['VoiceExtension'][_0x217c('0x4c')](_0x23570b,{'transaction':_0x362792});});}else{_0xc6cc3f=0x194;_0x1a8bd3=[];}});})['then'](function(){if(_0xc6cc3f!==0x194){return db['VoiceExtension']['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x11ee11},'order':_0x217c('0x4d')})[_0x217c('0x1e')](function(_0x4f2e78){_0x1a8bd3=_0x4f2e78;});}})['catch'](function(_0x163acc){_0xc6cc3f=0x1f4;logger[_0x217c('0x1f')](_0x163acc[_0x217c('0x4e')]);if(_0x163acc[_0x217c('0x1c')]){delete _0x163acc[_0x217c('0x1c')];}_0x1a8bd3=_0x163acc;})[_0x217c('0x4f')](function(){if(_0x1a8bd3===null){_0x42cff7['sendStatus'](_0xc6cc3f);}else{if(_0xc6cc3f===0x1f4){_0x42cff7['status'](_0xc6cc3f)[_0x217c('0x20')](_0x1a8bd3);}else{_0x42cff7[_0x217c('0xf')](_0xc6cc3f)[_0x217c('0x11')](_0x1a8bd3);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 6e7c73b..6180dda 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 _0x9a57=['events','VoiceExtension','setMaxListeners','save','remove','emit','exports'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0x9a57,0xf5));var _0x79a5=function(_0x15c421,_0x6366f7){_0x15c421=_0x15c421-0x0;var _0x5e5ed5=_0x9a57[_0x15c421];return _0x5e5ed5;};'use strict';var EventEmitter=require(_0x79a5('0x0'));var VoiceExtension=require('../../mysqldb')['db'][_0x79a5('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x79a5('0x2')](0x0);var events={'afterCreate':_0x79a5('0x3'),'afterUpdate':'update','afterDestroy':_0x79a5('0x4')};function emitEvent(_0x4fc827){return function(_0x1dae5b,_0x3e4c58,_0x4d6ca6){VoiceExtensionEvents['emit'](_0x4fc827+':'+_0x1dae5b['id'],_0x1dae5b);VoiceExtensionEvents[_0x79a5('0x5')](_0x4fc827,_0x1dae5b);_0x4d6ca6(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module[_0x79a5('0x6')]=VoiceExtensionEvents; \ No newline at end of file +var _0x129f=['remove','emit','hasOwnProperty','hook','../../mysqldb','VoiceExtension','setMaxListeners','save','update'];(function(_0x97932c,_0x16e944){var _0x5aedc9=function(_0x2ccc43){while(--_0x2ccc43){_0x97932c['push'](_0x97932c['shift']());}};_0x5aedc9(++_0x16e944);}(_0x129f,0xe5));var _0xf129=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0x129f[_0xdea41a];return _0x15d0d8;};'use strict';var EventEmitter=require('events');var VoiceExtension=require(_0xf129('0x0'))['db'][_0xf129('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xf129('0x2')](0x0);var events={'afterCreate':_0xf129('0x3'),'afterUpdate':_0xf129('0x4'),'afterDestroy':_0xf129('0x5')};function emitEvent(_0x3ae520){return function(_0x2b1727,_0x519a74,_0x1a4297){VoiceExtensionEvents[_0xf129('0x6')](_0x3ae520+':'+_0x2b1727['id'],_0x2b1727);VoiceExtensionEvents[_0xf129('0x6')](_0x3ae520,_0x2b1727);_0x1a4297(null);};}for(var e in events){if(events[_0xf129('0x7')](e)){var event=events[e];VoiceExtension[_0xf129('0x8')](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index e5369fe..087dcfe 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 _0x4a78=['name','phone','param','prefix','join','indexOf','U(xcally-mixmonitor-context)','replace','Interval','interval','IntervalId','then','*,*,*,*','intervals','map','filter','toLowerCase','tag','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','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},','outboundDial','appdata','agi','XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','priority','last','define','VoiceExtension','voice_extensions','get','concat','Hangup','lodash','./voiceExtension.attributes','exports','models','type','Set','CDR(type)=','context','exten','alias','NoOp','CDR(routeAlias)=','No\x20alias\x20set','inbound','push','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','CDR(routeid)=','):Goto(','CDR(prefix)=noprefix','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','options','url','split','length'];(function(_0x58a4ac,_0x26f3e7){var _0x435e2d=function(_0x1a5660){while(--_0x1a5660){_0x58a4ac['push'](_0x58a4ac['shift']());}};_0x435e2d(++_0x26f3e7);}(_0x4a78,0x18c));var _0x84a7=function(_0x3daefa,_0x41ef24){_0x3daefa=_0x3daefa-0x0;var _0xd46e4c=_0x4a78[_0x3daefa];return _0xd46e4c;};'use strict';var _=require(_0x84a7('0x0'));var attributes=require(_0x84a7('0x1'));module[_0x84a7('0x2')]=function(_0x396d78){var _0x1b3991=_0x396d78[_0x84a7('0x3')];function _0x563d96(_0x396044){var _0x2dfe01=0x2;var _0x46f2e8=[{'type':_0x396044[_0x84a7('0x4')],'app':_0x84a7('0x5'),'appdata':_0x84a7('0x6')+_0x396044[_0x84a7('0x4')],'context':_0x396044[_0x84a7('0x7')],'exten':_0x396044[_0x84a7('0x8')],'priority':_0x2dfe01++,'VoiceExtensionId':_0x396044['id']},{'type':_0x396044[_0x84a7('0x4')],'app':_0x396044[_0x84a7('0x9')]?'Set':_0x84a7('0xa'),'appdata':_0x396044[_0x84a7('0x9')]?_0x84a7('0xb')+_0x396044['alias']:_0x84a7('0xc'),'context':_0x396044[_0x84a7('0x7')],'exten':_0x396044[_0x84a7('0x8')],'priority':_0x2dfe01++,'VoiceExtensionId':_0x396044['id']}];if(_0x396044['type']===_0x84a7('0xd')){_0x46f2e8[_0x84a7('0xe')]({'type':_0x84a7('0xd'),'app':_0x84a7('0x5'),'appdata':'CDR(routeid)='+_0x396044['id'],'context':_0x396044['context'],'exten':_0x396044[_0x84a7('0x8')],'priority':_0x2dfe01++,'VoiceExtensionId':_0x396044['id']});}_0x46f2e8['push']({'type':_0x396044[_0x84a7('0x4')],'app':_0x84a7('0x5'),'appdata':_0x84a7('0xf'),'context':_0x396044[_0x84a7('0x7')],'exten':_0x396044[_0x84a7('0x8')],'priority':_0x2dfe01++,'VoiceExtensionId':_0x396044['id']},{'type':_0x396044[_0x84a7('0x4')],'app':_0x84a7('0x5'),'appdata':_0x84a7('0x10'),'context':_0x396044[_0x84a7('0x7')],'exten':_0x396044[_0x84a7('0x8')],'priority':_0x2dfe01++,'VoiceExtensionId':_0x396044['id']},{'type':_0x396044[_0x84a7('0x4')],'app':_0x84a7('0x5'),'appdata':_0x84a7('0x11'),'context':_0x396044['context'],'exten':_0x396044[_0x84a7('0x8')],'priority':_0x2dfe01++,'VoiceExtensionId':_0x396044['id']});return _0x46f2e8;}function _0xabb2a4(_0xf31c5a){var _0x11002b=0x2;var _0x2ae2a3=[{'type':_0x84a7('0x12'),'app':_0x84a7('0x5'),'appdata':_0x84a7('0x13'),'context':_0xf31c5a[_0x84a7('0x7')],'exten':_0xf31c5a[_0x84a7('0x8')],'priority':_0x11002b++,'VoiceExtensionId':_0xf31c5a['id']},{'type':_0x84a7('0x12'),'app':_0xf31c5a[_0x84a7('0x9')]?_0x84a7('0x5'):'NoOp','appdata':_0xf31c5a[_0x84a7('0x9')]?_0x84a7('0xb')+_0xf31c5a[_0x84a7('0x9')]:_0x84a7('0xc'),'context':_0xf31c5a[_0x84a7('0x7')],'exten':_0xf31c5a[_0x84a7('0x8')],'priority':_0x11002b++,'VoiceExtensionId':_0xf31c5a['id']},{'type':_0x84a7('0x12'),'app':'Set','appdata':_0x84a7('0x14')+(_0xf31c5a[_0x84a7('0x15')]?_0x84a7('0x16')+_0xf31c5a[_0x84a7('0x15')]+'}':_0x84a7('0x17')),'context':_0xf31c5a[_0x84a7('0x7')],'exten':_0xf31c5a[_0x84a7('0x8')],'priority':_0x11002b++,'VoiceExtensionId':_0xf31c5a['id']},{'type':'outbound','app':_0x84a7('0x5'),'appdata':_0x84a7('0x18')+_0xf31c5a['id'],'context':_0xf31c5a[_0x84a7('0x7')],'exten':_0xf31c5a[_0x84a7('0x8')],'priority':_0x11002b++,'VoiceExtensionId':_0xf31c5a['id']},{'type':_0x84a7('0x12'),'app':'ExecIf','appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x11002b+0x2)+_0x84a7('0x19')+(_0x11002b+0x1)+')','context':_0xf31c5a['context'],'exten':_0xf31c5a[_0x84a7('0x8')],'priority':_0x11002b++,'VoiceExtensionId':_0xf31c5a['id']},{'type':_0x84a7('0x12'),'app':_0x84a7('0x5'),'appdata':_0xf31c5a[_0x84a7('0x15')]?'CDR(prefix)=${EXTEN:0:'+_0xf31c5a[_0x84a7('0x15')]+'}':_0x84a7('0x1a'),'context':_0xf31c5a[_0x84a7('0x7')],'exten':_0xf31c5a['exten'],'priority':_0x11002b++,'VoiceExtensionId':_0xf31c5a['id']},{'type':_0x84a7('0x12'),'app':'Set','appdata':_0x84a7('0xf'),'context':_0xf31c5a['context'],'exten':_0xf31c5a[_0x84a7('0x8')],'priority':_0x11002b++,'VoiceExtensionId':_0xf31c5a['id']},{'type':_0x84a7('0x12'),'app':_0x84a7('0x5'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0xf31c5a['context'],'exten':_0xf31c5a['exten'],'priority':_0x11002b++,'VoiceExtensionId':_0xf31c5a['id']},{'type':'outbound','app':_0x84a7('0x5'),'appdata':_0x84a7('0x11'),'context':_0xf31c5a['context'],'exten':_0xf31c5a[_0x84a7('0x8')],'priority':_0x11002b++,'VoiceExtensionId':_0xf31c5a['id']},{'type':_0x84a7('0x12'),'app':_0x84a7('0x5'),'appdata':'outboundrouteid='+_0xf31c5a['id'],'context':_0xf31c5a['context'],'exten':_0xf31c5a[_0x84a7('0x8')],'priority':_0x11002b++,'VoiceExtensionId':_0xf31c5a['id']}];if(_0xf31c5a[_0x84a7('0x1b')](_0x84a7('0x1c'))&&_0xf31c5a[_0x84a7('0x1c')]!==_0x84a7('0x1d')){_0x2ae2a3['push']({'type':_0x84a7('0x12'),'app':_0x84a7('0x5'),'appdata':_0x84a7('0x1e'),'context':_0xf31c5a[_0x84a7('0x7')],'exten':_0xf31c5a[_0x84a7('0x8')],'priority':_0x11002b++,'VoiceExtensionId':_0xf31c5a['id']},{'type':_0x84a7('0x12'),'app':'Set','appdata':_0x84a7('0x1f')+_0xf31c5a['recordingFormat']||_0x84a7('0x20'),'context':_0xf31c5a[_0x84a7('0x7')],'exten':_0xf31c5a[_0x84a7('0x8')],'priority':_0x11002b++,'VoiceExtensionId':_0xf31c5a['id']});}return _0x2ae2a3;}function _0x972cc1(_0x28d55f,_0x11448f){var _0x55a8f0=[{'name':_0x84a7('0x21'),'param':0x0},{'name':_0x84a7('0x22'),'param':0x1},{'name':_0x84a7('0x23'),'param':0x2},{'name':_0x84a7('0x24'),'param':0x3}];var _0x5b3426={};var _0x2bcc12=_0x11448f[_0x84a7('0x25')](',');var _0x4addaa=[];for(var _0x4e8557=0x0;_0x4e8557<_0x55a8f0[_0x84a7('0x26')];_0x4e8557++){switch(_0x55a8f0[_0x4e8557][_0x84a7('0x27')]){case _0x84a7('0x21'):_0x5b3426[_0x84a7('0x21')]=_0x2bcc12[_0x55a8f0[_0x4e8557]['param']]['split']('/')[0x1];_0x5b3426[_0x84a7('0x28')]=_0x2bcc12[_0x55a8f0[_0x4e8557][_0x84a7('0x29')]]['split']('/')[0x2];_0x5b3426[_0x84a7('0x2a')]=_0x5b3426[_0x84a7('0x28')]?_0x5b3426[_0x84a7('0x28')][_0x84a7('0x25')]('$')[0x0]:undefined;_0x5b3426[_0x84a7('0x28')]=_0x28d55f['cutdigits']?(_0x5b3426[_0x84a7('0x2a')]||'')+_0x84a7('0x16')+_0x28d55f[_0x84a7('0x15')]+'}':(_0x5b3426[_0x84a7('0x2a')]||'')+_0x84a7('0x17');_0x4addaa[_0x55a8f0[_0x4e8557]['param']]=['SIP',_0x5b3426[_0x84a7('0x21')],_0x5b3426[_0x84a7('0x28')]][_0x84a7('0x2b')]('/');break;case _0x84a7('0x23'):_0x5b3426[_0x84a7('0x23')]=_0x2bcc12[_0x55a8f0[_0x4e8557]['param']];if(_0x28d55f['recordingFormat']!==_0x84a7('0x1d')){if(_0x5b3426['options'][_0x84a7('0x2c')]('U(xcally-mixmonitor-context)')<0x0){_0x5b3426['options']+=_0x84a7('0x2d');}}else{_0x5b3426[_0x84a7('0x23')]=_0x5b3426['options'][_0x84a7('0x2e')](_0x84a7('0x2d'),'');}_0x4addaa[_0x55a8f0[_0x4e8557][_0x84a7('0x29')]]=_0x5b3426[_0x84a7('0x23')];break;default:_0x4addaa[_0x55a8f0[_0x4e8557][_0x84a7('0x29')]]=_0x2bcc12[_0x55a8f0[_0x4e8557][_0x84a7('0x29')]];}}return _0x4addaa['join'](',');}function _0x17b2c3(_0xe19c0b,_0x3c3ea2,_0x33b844){return new Promise(function(_0x146b11,_0x39b310){var _0x44c55c=[];if(_['isEmpty'](_0x3c3ea2))return _0x146b11(_0x44c55c);_0x1b3991[_0x84a7('0x2f')]['findAll']({'attributes':['id',_0x84a7('0x30'),_0x84a7('0x31')],'raw':!![]})[_0x84a7('0x32')](function(_0x2db974){for(var _0x4bac64=0x0,_0x128613=0x0;_0x4bac64<_0x3c3ea2['length'];_0x4bac64++,_0x128613=0x0){var _0x1bff76=_0x3c3ea2[_0x4bac64];var _0x30478c=[];var _0x1a7f2c=[];delete _0x1bff76['id'];if(_0x1bff76[_0x84a7('0x30')]!==_0x84a7('0x33')){_0x1bff76[_0x84a7('0x34')]=[_0x1bff76[_0x84a7('0x30')]];}else{_0x1bff76[_0x84a7('0x34')]=_0x1bff76[_0x84a7('0x31')]?_[_0x84a7('0x35')](_[_0x84a7('0x36')](_0x2db974,{'IntervalId':_0x1bff76[_0x84a7('0x31')]}),'interval'):[];}_0x1bff76[_0x84a7('0x7')]=_0xe19c0b[_0x84a7('0x7')];_0x1bff76[_0x84a7('0x8')]=_0xe19c0b[_0x84a7('0x8')];if(_0x1bff76[_0x84a7('0x4')])_0x1bff76[_0x84a7('0x4')]=_0x1bff76[_0x84a7('0x4')][_0x84a7('0x37')]();if(_0xe19c0b['type']===_0x84a7('0x12')){if(_0x1bff76['hasOwnProperty'](_0x84a7('0x38'))&&_0x1bff76[_0x84a7('0x38')]&&_0x1bff76['tag']!=='--'){_0x30478c[_0x84a7('0xe')]({'type':_0x1bff76[_0x84a7('0x4')][_0x84a7('0x37')](),'app':_0x84a7('0x5'),'appdata':'CDR(tag)='+_0x1bff76[_0x84a7('0x38')],'context':_0xe19c0b[_0x84a7('0x7')],'exten':_0xe19c0b[_0x84a7('0x8')],'priority':_0x1bff76['intervals']['length']+_0x33b844+_0x128613++,'VoiceExtensionId':_0xe19c0b['id']});}_0x30478c[_0x84a7('0xe')]({'type':_0x1bff76[_0x84a7('0x4')][_0x84a7('0x37')](),'app':_0x84a7('0x39'),'appdata':_0x84a7('0x3a')+(_0x1bff76[_0x84a7('0x3b')]?_0x84a7('0x3c')+_0x1bff76['callerID']+')':_0x84a7('0x3d')),'context':_0xe19c0b[_0x84a7('0x7')],'exten':_0xe19c0b[_0x84a7('0x8')],'priority':_0x1bff76[_0x84a7('0x34')][_0x84a7('0x26')]+_0x33b844+_0x128613++,'VoiceExtensionId':_0xe19c0b['id']});}else{if(_0x1bff76[_0x84a7('0x1b')]('answer')){if([_0x84a7('0x3e'),_0x84a7('0x3f')][_0x84a7('0x40')](_0x1bff76[_0x84a7('0x41')][_0x84a7('0x37')]())&&_0x1bff76[_0x84a7('0x42')]!==_0x84a7('0x43')){if(_0x1bff76['answer']){_0x30478c['push']({'type':_0x1bff76[_0x84a7('0x4')][_0x84a7('0x37')](),'app':_0x84a7('0x39'),'appdata':_0x84a7('0x44'),'context':_0xe19c0b[_0x84a7('0x7')],'exten':_0xe19c0b[_0x84a7('0x8')],'priority':_0x1bff76[_0x84a7('0x34')][_0x84a7('0x26')]+_0x33b844+_0x128613++,'VoiceExtensionId':_0xe19c0b['id']});_0x30478c[_0x84a7('0xe')]({'type':_0x1bff76['type'][_0x84a7('0x37')](),'app':_0x84a7('0x5'),'appdata':_0x84a7('0x45'),'context':_0xe19c0b['context'],'exten':_0xe19c0b['exten'],'priority':_0x1bff76['intervals'][_0x84a7('0x26')]+_0x33b844+_0x128613++,'VoiceExtensionId':_0xe19c0b['id']});}else{_0x30478c[_0x84a7('0xe')]({'type':_0x1bff76[_0x84a7('0x4')][_0x84a7('0x37')](),'app':_0x84a7('0x39'),'appdata':_0x84a7('0x46'),'context':_0xe19c0b[_0x84a7('0x7')],'exten':_0xe19c0b[_0x84a7('0x8')],'priority':_0x1bff76[_0x84a7('0x34')][_0x84a7('0x26')]+_0x33b844+_0x128613++,'VoiceExtensionId':_0xe19c0b['id']});_0x30478c['push']({'type':_0x1bff76[_0x84a7('0x4')][_0x84a7('0x37')](),'app':_0x84a7('0x5'),'appdata':_0x84a7('0x47'),'context':_0xe19c0b[_0x84a7('0x7')],'exten':_0xe19c0b[_0x84a7('0x8')],'priority':_0x1bff76[_0x84a7('0x34')][_0x84a7('0x26')]+_0x33b844+_0x128613++,'VoiceExtensionId':_0xe19c0b['id']});}}}}for(var _0x595c1d=0x0;_0x595c1d<_0x1bff76[_0x84a7('0x34')][_0x84a7('0x26')];_0x595c1d++){var _0x21160e=_0x33b844+_0x1bff76[_0x84a7('0x34')][_0x84a7('0x26')];var _0x42de22=_0x595c1d===_0x1bff76[_0x84a7('0x34')][_0x84a7('0x26')]-0x1?_0x33b844+_0x30478c[_0x84a7('0x26')]+_0x1a7f2c['length']+0x2:_0x33b844+_0x595c1d+0x1;_0x30478c[_0x84a7('0x48')](_0x595c1d,0x0,{'type':_0xe19c0b[_0x84a7('0x4')],'app':_0x84a7('0x49'),'appdata':_0x1bff76[_0x84a7('0x34')][_0x595c1d]+'?'+_0xe19c0b[_0x84a7('0x7')]+_0x84a7('0x4a')+_0x21160e+':'+_0xe19c0b[_0x84a7('0x7')]+_0x84a7('0x4a')+_0x42de22,'exten':_0xe19c0b[_0x84a7('0x8')],'context':_0xe19c0b['context'],'priority':_0x33b844+_0x595c1d,'VoiceExtensionId':_0xe19c0b['id']});}if(_0x1bff76[_0x84a7('0x42')]===_0x84a7('0x4b')){_0x1bff76[_0x84a7('0x4c')]=_0x972cc1(_0xe19c0b,_0x1bff76['appdata']);}if(_0x1bff76[_0x84a7('0x42')]===_0x84a7('0x4d')){_0x30478c[_0x84a7('0xe')]({'type':_0x1bff76[_0x84a7('0x4')][_0x84a7('0x37')](),'app':_0x84a7('0x5'),'appdata':_0x84a7('0x4e'),'context':_0xe19c0b[_0x84a7('0x7')],'exten':_0xe19c0b[_0x84a7('0x8')],'priority':_0x1bff76['intervals'][_0x84a7('0x26')]+_0x33b844+_0x128613++,'VoiceExtensionId':_0xe19c0b['id']});}_0x1bff76[_0x84a7('0x4f')]=_0x30478c[_0x84a7('0x26')]?_[_0x84a7('0x50')](_0x30478c)[_0x84a7('0x4f')]+0x1:_0x33b844;_0x44c55c=_['concat'](_0x44c55c,_0x30478c,[_0x1bff76],_0x1a7f2c);_0x33b844=_[_0x84a7('0x50')](_0x44c55c)[_0x84a7('0x4f')]+0x1;}return _0x146b11(_0x44c55c);})['catch'](function(_0x45156d){_0x39b310(_0x45156d);});});}return _0x396d78[_0x84a7('0x51')](_0x84a7('0x52'),attributes,{'tableName':_0x84a7('0x53'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x21f054){var _0x55a6c2=this[_0x84a7('0x54')]({'plain':!![]});var _0x194441=_0x55a6c2[_0x84a7('0x4')]===_0x84a7('0x12')?_0xabb2a4(_0x55a6c2):_0x563d96(_0x55a6c2);return _0x17b2c3(_0x55a6c2,_0x21f054,_[_0x84a7('0x50')](_0x194441)[_0x84a7('0x4f')]+0x1)[_0x84a7('0x32')](function(_0x564fe9){var _0x3b63e0=_[_0x84a7('0x55')](_0x194441,_0x564fe9);_0x3b63e0[_0x84a7('0xe')]({'type':_0x55a6c2[_0x84a7('0x4')],'app':_0x84a7('0x56'),'exten':_0x55a6c2['exten'],'context':_0x55a6c2[_0x84a7('0x7')],'priority':_['last'](_0x3b63e0)[_0x84a7('0x4f')]+0x1,'VoiceExtensionId':_0x55a6c2['id']});return _0x3b63e0;});}}});}; \ No newline at end of file +var _0xecbe=['CDR(routeid)=','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','CDR(routeAlias)=','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','XCALLY-MOTION-ANSWER=0','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','options','length','name','param','split','prefix','phone','SIP','join','U(xcally-mixmonitor-context)','isEmpty','interval','then','*,*,*,*','intervals','IntervalId','map','filter','toLowerCase','tag','CDR(tag)=','ExecIf','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','queue','playback','includes','app','appType','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','outboundDial','appdata','XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','last','priority','concat','catch','define','VoiceExtension','voice_extensions','get','Hangup','lodash','./voiceExtension.attributes','models','type','Set','CDR(type)=','context','alias','NoOp','No\x20alias\x20set','exten','inbound','push'];(function(_0x10f6e8,_0x351db6){var _0x35bb3c=function(_0x30a39b){while(--_0x30a39b){_0x10f6e8['push'](_0x10f6e8['shift']());}};_0x35bb3c(++_0x351db6);}(_0xecbe,0x9b));var _0xeecb=function(_0x39e740,_0x3a3084){_0x39e740=_0x39e740-0x0;var _0x49d5fc=_0xecbe[_0x39e740];return _0x49d5fc;};'use strict';var _=require(_0xeecb('0x0'));var attributes=require(_0xeecb('0x1'));module['exports']=function(_0x56096e){var _0x30fcbf=_0x56096e[_0xeecb('0x2')];function _0x2709a3(_0x374ca5){var _0x11de56=0x2;var _0x1f84de=[{'type':_0x374ca5[_0xeecb('0x3')],'app':_0xeecb('0x4'),'appdata':_0xeecb('0x5')+_0x374ca5[_0xeecb('0x3')],'context':_0x374ca5[_0xeecb('0x6')],'exten':_0x374ca5['exten'],'priority':_0x11de56++,'VoiceExtensionId':_0x374ca5['id']},{'type':_0x374ca5['type'],'app':_0x374ca5[_0xeecb('0x7')]?_0xeecb('0x4'):_0xeecb('0x8'),'appdata':_0x374ca5[_0xeecb('0x7')]?'CDR(routeAlias)='+_0x374ca5[_0xeecb('0x7')]:_0xeecb('0x9'),'context':_0x374ca5[_0xeecb('0x6')],'exten':_0x374ca5[_0xeecb('0xa')],'priority':_0x11de56++,'VoiceExtensionId':_0x374ca5['id']}];if(_0x374ca5[_0xeecb('0x3')]===_0xeecb('0xb')){_0x1f84de[_0xeecb('0xc')]({'type':_0xeecb('0xb'),'app':'Set','appdata':_0xeecb('0xd')+_0x374ca5['id'],'context':_0x374ca5[_0xeecb('0x6')],'exten':_0x374ca5['exten'],'priority':_0x11de56++,'VoiceExtensionId':_0x374ca5['id']});}_0x1f84de[_0xeecb('0xc')]({'type':_0x374ca5[_0xeecb('0x3')],'app':_0xeecb('0x4'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x374ca5[_0xeecb('0x6')],'exten':_0x374ca5[_0xeecb('0xa')],'priority':_0x11de56++,'VoiceExtensionId':_0x374ca5['id']},{'type':_0x374ca5['type'],'app':'Set','appdata':_0xeecb('0xe'),'context':_0x374ca5[_0xeecb('0x6')],'exten':_0x374ca5['exten'],'priority':_0x11de56++,'VoiceExtensionId':_0x374ca5['id']},{'type':_0x374ca5[_0xeecb('0x3')],'app':'Set','appdata':_0xeecb('0xf'),'context':_0x374ca5[_0xeecb('0x6')],'exten':_0x374ca5[_0xeecb('0xa')],'priority':_0x11de56++,'VoiceExtensionId':_0x374ca5['id']});return _0x1f84de;}function _0x5760ed(_0x676ee1){var _0x2d15d5=0x2;var _0x5ce6a7=[{'type':_0xeecb('0x10'),'app':'Set','appdata':_0xeecb('0x11'),'context':_0x676ee1[_0xeecb('0x6')],'exten':_0x676ee1[_0xeecb('0xa')],'priority':_0x2d15d5++,'VoiceExtensionId':_0x676ee1['id']},{'type':_0xeecb('0x10'),'app':_0x676ee1[_0xeecb('0x7')]?_0xeecb('0x4'):_0xeecb('0x8'),'appdata':_0x676ee1['alias']?_0xeecb('0x12')+_0x676ee1[_0xeecb('0x7')]:_0xeecb('0x9'),'context':_0x676ee1[_0xeecb('0x6')],'exten':_0x676ee1[_0xeecb('0xa')],'priority':_0x2d15d5++,'VoiceExtensionId':_0x676ee1['id']},{'type':_0xeecb('0x10'),'app':_0xeecb('0x4'),'appdata':_0xeecb('0x13')+(_0x676ee1[_0xeecb('0x14')]?_0xeecb('0x15')+_0x676ee1['cutdigits']+'}':_0xeecb('0x16')),'context':_0x676ee1[_0xeecb('0x6')],'exten':_0x676ee1[_0xeecb('0xa')],'priority':_0x2d15d5++,'VoiceExtensionId':_0x676ee1['id']},{'type':_0xeecb('0x10'),'app':'Set','appdata':_0xeecb('0xd')+_0x676ee1['id'],'context':_0x676ee1[_0xeecb('0x6')],'exten':_0x676ee1[_0xeecb('0xa')],'priority':_0x2d15d5++,'VoiceExtensionId':_0x676ee1['id']},{'type':_0xeecb('0x10'),'app':'ExecIf','appdata':_0xeecb('0x17')+(_0x2d15d5+0x2)+_0xeecb('0x18')+(_0x2d15d5+0x1)+')','context':_0x676ee1[_0xeecb('0x6')],'exten':_0x676ee1[_0xeecb('0xa')],'priority':_0x2d15d5++,'VoiceExtensionId':_0x676ee1['id']},{'type':_0xeecb('0x10'),'app':'Set','appdata':_0x676ee1[_0xeecb('0x14')]?_0xeecb('0x19')+_0x676ee1['cutdigits']+'}':_0xeecb('0x1a'),'context':_0x676ee1[_0xeecb('0x6')],'exten':_0x676ee1[_0xeecb('0xa')],'priority':_0x2d15d5++,'VoiceExtensionId':_0x676ee1['id']},{'type':_0xeecb('0x10'),'app':_0xeecb('0x4'),'appdata':_0xeecb('0x1b'),'context':_0x676ee1[_0xeecb('0x6')],'exten':_0x676ee1[_0xeecb('0xa')],'priority':_0x2d15d5++,'VoiceExtensionId':_0x676ee1['id']},{'type':'outbound','app':_0xeecb('0x4'),'appdata':_0xeecb('0xe'),'context':_0x676ee1[_0xeecb('0x6')],'exten':_0x676ee1[_0xeecb('0xa')],'priority':_0x2d15d5++,'VoiceExtensionId':_0x676ee1['id']},{'type':_0xeecb('0x10'),'app':_0xeecb('0x4'),'appdata':'MONITOR_OPTIONS=ab','context':_0x676ee1[_0xeecb('0x6')],'exten':_0x676ee1[_0xeecb('0xa')],'priority':_0x2d15d5++,'VoiceExtensionId':_0x676ee1['id']},{'type':_0xeecb('0x10'),'app':_0xeecb('0x4'),'appdata':_0xeecb('0x1c')+_0x676ee1['id'],'context':_0x676ee1[_0xeecb('0x6')],'exten':_0x676ee1[_0xeecb('0xa')],'priority':_0x2d15d5++,'VoiceExtensionId':_0x676ee1['id']}];if(_0x676ee1[_0xeecb('0x1d')](_0xeecb('0x1e'))&&_0x676ee1[_0xeecb('0x1e')]!==_0xeecb('0x1f')){_0x5ce6a7[_0xeecb('0xc')]({'type':'outbound','app':_0xeecb('0x4'),'appdata':_0xeecb('0x20'),'context':_0x676ee1[_0xeecb('0x6')],'exten':_0x676ee1[_0xeecb('0xa')],'priority':_0x2d15d5++,'VoiceExtensionId':_0x676ee1['id']},{'type':_0xeecb('0x10'),'app':_0xeecb('0x4'),'appdata':_0xeecb('0x21')+_0x676ee1[_0xeecb('0x1e')]||_0xeecb('0x22'),'context':_0x676ee1[_0xeecb('0x6')],'exten':_0x676ee1[_0xeecb('0xa')],'priority':_0x2d15d5++,'VoiceExtensionId':_0x676ee1['id']});}return _0x5ce6a7;}function _0x448ace(_0x5ee4c,_0x2dfb51){var _0x109a13=[{'name':_0xeecb('0x23'),'param':0x0},{'name':_0xeecb('0x24'),'param':0x1},{'name':_0xeecb('0x25'),'param':0x2},{'name':'url','param':0x3}];var _0x307a1d={};var _0x289045=_0x2dfb51['split'](',');var _0x377bc8=[];for(var _0x28acac=0x0;_0x28acac<_0x109a13[_0xeecb('0x26')];_0x28acac++){switch(_0x109a13[_0x28acac][_0xeecb('0x27')]){case'trunk':_0x307a1d[_0xeecb('0x23')]=_0x289045[_0x109a13[_0x28acac][_0xeecb('0x28')]][_0xeecb('0x29')]('/')[0x1];_0x307a1d['phone']=_0x289045[_0x109a13[_0x28acac]['param']][_0xeecb('0x29')]('/')[0x2];_0x307a1d[_0xeecb('0x2a')]=_0x307a1d[_0xeecb('0x2b')]?_0x307a1d['phone'][_0xeecb('0x29')]('$')[0x0]:undefined;_0x307a1d[_0xeecb('0x2b')]=_0x5ee4c[_0xeecb('0x14')]?(_0x307a1d[_0xeecb('0x2a')]||'')+'${EXTEN:'+_0x5ee4c[_0xeecb('0x14')]+'}':(_0x307a1d['prefix']||'')+_0xeecb('0x16');_0x377bc8[_0x109a13[_0x28acac]['param']]=[_0xeecb('0x2c'),_0x307a1d[_0xeecb('0x23')],_0x307a1d[_0xeecb('0x2b')]][_0xeecb('0x2d')]('/');break;case _0xeecb('0x25'):_0x307a1d[_0xeecb('0x25')]=_0x289045[_0x109a13[_0x28acac][_0xeecb('0x28')]];if(_0x5ee4c['recordingFormat']!==_0xeecb('0x1f')){if(_0x307a1d[_0xeecb('0x25')]['indexOf'](_0xeecb('0x2e'))<0x0){_0x307a1d[_0xeecb('0x25')]+='U(xcally-mixmonitor-context)';}}else{_0x307a1d[_0xeecb('0x25')]=_0x307a1d[_0xeecb('0x25')]['replace'](_0xeecb('0x2e'),'');}_0x377bc8[_0x109a13[_0x28acac]['param']]=_0x307a1d['options'];break;default:_0x377bc8[_0x109a13[_0x28acac][_0xeecb('0x28')]]=_0x289045[_0x109a13[_0x28acac][_0xeecb('0x28')]];}}return _0x377bc8[_0xeecb('0x2d')](',');}function _0x23c55e(_0x3ee564,_0x57670d,_0x183104){return new Promise(function(_0x50c060,_0x19ccec){var _0x27128e=[];if(_[_0xeecb('0x2f')](_0x57670d))return _0x50c060(_0x27128e);_0x30fcbf['Interval']['findAll']({'attributes':['id',_0xeecb('0x30'),'IntervalId'],'raw':!![]})[_0xeecb('0x31')](function(_0x71aa9e){for(var _0x198f4f=0x0,_0x4710e3=0x0;_0x198f4f<_0x57670d[_0xeecb('0x26')];_0x198f4f++,_0x4710e3=0x0){var _0x38e809=_0x57670d[_0x198f4f];var _0x46ddc3=[];var _0x182795=[];delete _0x38e809['id'];if(_0x38e809['interval']!==_0xeecb('0x32')){_0x38e809[_0xeecb('0x33')]=[_0x38e809['interval']];}else{_0x38e809['intervals']=_0x38e809[_0xeecb('0x34')]?_[_0xeecb('0x35')](_[_0xeecb('0x36')](_0x71aa9e,{'IntervalId':_0x38e809[_0xeecb('0x34')]}),_0xeecb('0x30')):[];}_0x38e809[_0xeecb('0x6')]=_0x3ee564[_0xeecb('0x6')];_0x38e809['exten']=_0x3ee564[_0xeecb('0xa')];if(_0x38e809[_0xeecb('0x3')])_0x38e809[_0xeecb('0x3')]=_0x38e809[_0xeecb('0x3')][_0xeecb('0x37')]();if(_0x3ee564['type']===_0xeecb('0x10')){if(_0x38e809[_0xeecb('0x1d')](_0xeecb('0x38'))&&_0x38e809[_0xeecb('0x38')]&&_0x38e809['tag']!=='--'){_0x46ddc3[_0xeecb('0xc')]({'type':_0x38e809[_0xeecb('0x3')][_0xeecb('0x37')](),'app':_0xeecb('0x4'),'appdata':_0xeecb('0x39')+_0x38e809[_0xeecb('0x38')],'context':_0x3ee564[_0xeecb('0x6')],'exten':_0x3ee564[_0xeecb('0xa')],'priority':_0x38e809[_0xeecb('0x33')][_0xeecb('0x26')]+_0x183104+_0x4710e3++,'VoiceExtensionId':_0x3ee564['id']});}_0x46ddc3[_0xeecb('0xc')]({'type':_0x38e809[_0xeecb('0x3')]['toLowerCase'](),'app':_0xeecb('0x3a'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):'+(_0x38e809[_0xeecb('0x3b')]?_0xeecb('0x3c')+_0x38e809['callerID']+')':_0xeecb('0x3d')),'context':_0x3ee564[_0xeecb('0x6')],'exten':_0x3ee564[_0xeecb('0xa')],'priority':_0x38e809[_0xeecb('0x33')]['length']+_0x183104+_0x4710e3++,'VoiceExtensionId':_0x3ee564['id']});}else{if(_0x38e809[_0xeecb('0x1d')](_0xeecb('0x3e'))){if([_0xeecb('0x3f'),_0xeecb('0x40')][_0xeecb('0x41')](_0x38e809[_0xeecb('0x42')][_0xeecb('0x37')]())&&_0x38e809[_0xeecb('0x43')]!=='custom'){if(_0x38e809[_0xeecb('0x3e')]){_0x46ddc3[_0xeecb('0xc')]({'type':_0x38e809[_0xeecb('0x3')][_0xeecb('0x37')](),'app':_0xeecb('0x3a'),'appdata':_0xeecb('0x44'),'context':_0x3ee564['context'],'exten':_0x3ee564[_0xeecb('0xa')],'priority':_0x38e809[_0xeecb('0x33')][_0xeecb('0x26')]+_0x183104+_0x4710e3++,'VoiceExtensionId':_0x3ee564['id']});_0x46ddc3['push']({'type':_0x38e809[_0xeecb('0x3')][_0xeecb('0x37')](),'app':_0xeecb('0x4'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x3ee564[_0xeecb('0x6')],'exten':_0x3ee564[_0xeecb('0xa')],'priority':_0x38e809['intervals'][_0xeecb('0x26')]+_0x183104+_0x4710e3++,'VoiceExtensionId':_0x3ee564['id']});}else{_0x46ddc3[_0xeecb('0xc')]({'type':_0x38e809['type']['toLowerCase'](),'app':_0xeecb('0x3a'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x3ee564[_0xeecb('0x6')],'exten':_0x3ee564[_0xeecb('0xa')],'priority':_0x38e809[_0xeecb('0x33')][_0xeecb('0x26')]+_0x183104+_0x4710e3++,'VoiceExtensionId':_0x3ee564['id']});_0x46ddc3[_0xeecb('0xc')]({'type':_0x38e809[_0xeecb('0x3')][_0xeecb('0x37')](),'app':'Set','appdata':_0xeecb('0x45'),'context':_0x3ee564[_0xeecb('0x6')],'exten':_0x3ee564[_0xeecb('0xa')],'priority':_0x38e809[_0xeecb('0x33')][_0xeecb('0x26')]+_0x183104+_0x4710e3++,'VoiceExtensionId':_0x3ee564['id']});}}}}for(var _0x375a78=0x0;_0x375a78<_0x38e809[_0xeecb('0x33')][_0xeecb('0x26')];_0x375a78++){var _0x3048b9=_0x183104+_0x38e809[_0xeecb('0x33')]['length'];var _0x1ed184=_0x375a78===_0x38e809[_0xeecb('0x33')][_0xeecb('0x26')]-0x1?_0x183104+_0x46ddc3[_0xeecb('0x26')]+_0x182795[_0xeecb('0x26')]+0x2:_0x183104+_0x375a78+0x1;_0x46ddc3[_0xeecb('0x46')](_0x375a78,0x0,{'type':_0x3ee564[_0xeecb('0x3')],'app':'GotoIfTime','appdata':_0x38e809['intervals'][_0x375a78]+'?'+_0x3ee564['context']+_0xeecb('0x47')+_0x3048b9+':'+_0x3ee564['context']+',${EXTEN},'+_0x1ed184,'exten':_0x3ee564[_0xeecb('0xa')],'context':_0x3ee564[_0xeecb('0x6')],'priority':_0x183104+_0x375a78,'VoiceExtensionId':_0x3ee564['id']});}if(_0x38e809['appType']===_0xeecb('0x48')){_0x38e809[_0xeecb('0x49')]=_0x448ace(_0x3ee564,_0x38e809['appdata']);}if(_0x38e809[_0xeecb('0x43')]==='agi'){_0x46ddc3['push']({'type':_0x38e809[_0xeecb('0x3')]['toLowerCase'](),'app':_0xeecb('0x4'),'appdata':_0xeecb('0x4a'),'context':_0x3ee564[_0xeecb('0x6')],'exten':_0x3ee564[_0xeecb('0xa')],'priority':_0x38e809['intervals'][_0xeecb('0x26')]+_0x183104+_0x4710e3++,'VoiceExtensionId':_0x3ee564['id']});}_0x38e809['priority']=_0x46ddc3['length']?_[_0xeecb('0x4b')](_0x46ddc3)[_0xeecb('0x4c')]+0x1:_0x183104;_0x27128e=_[_0xeecb('0x4d')](_0x27128e,_0x46ddc3,[_0x38e809],_0x182795);_0x183104=_[_0xeecb('0x4b')](_0x27128e)[_0xeecb('0x4c')]+0x1;}return _0x50c060(_0x27128e);})[_0xeecb('0x4e')](function(_0x322890){_0x19ccec(_0x322890);});});}return _0x56096e[_0xeecb('0x4f')](_0xeecb('0x50'),attributes,{'tableName':_0xeecb('0x51'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x1c7382){var _0x2d82f2=this[_0xeecb('0x52')]({'plain':!![]});var _0xfc9e1d=_0x2d82f2[_0xeecb('0x3')]==='outbound'?_0x5760ed(_0x2d82f2):_0x2709a3(_0x2d82f2);return _0x23c55e(_0x2d82f2,_0x1c7382,_[_0xeecb('0x4b')](_0xfc9e1d)[_0xeecb('0x4c')]+0x1)[_0xeecb('0x31')](function(_0x54ad1a){var _0x4b9f54=_['concat'](_0xfc9e1d,_0x54ad1a);_0x4b9f54[_0xeecb('0xc')]({'type':_0x2d82f2['type'],'app':_0xeecb('0x53'),'exten':_0x2d82f2[_0xeecb('0xa')],'context':_0x2d82f2[_0xeecb('0x6')],'priority':_[_0xeecb('0x4b')](_0x4b9f54)[_0xeecb('0x4c')]+0x1,'VoiceExtensionId':_0x2d82f2['id']});return _0x4b9f54;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 8186655..c01e070 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 _0x7d9f=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','localhost','register','request','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','VoiceExtension','findAll','options','include','map','model','attributes','GetVoiceExtension','lodash','util','moment','bluebird'];(function(_0x509904,_0x53dce6){var _0x487b45=function(_0x4c2b9c){while(--_0x4c2b9c){_0x509904['push'](_0x509904['shift']());}};_0x487b45(++_0x53dce6);}(_0x7d9f,0x15c));var _0xf7d9=function(_0xf64e5,_0x4a3232){_0xf64e5=_0xf64e5-0x0;var _0x5f312c=_0x7d9f[_0xf64e5];return _0x5f312c;};'use strict';var _=require(_0xf7d9('0x0'));var util=require(_0xf7d9('0x1'));var moment=require(_0xf7d9('0x2'));var BPromise=require(_0xf7d9('0x3'));var rs=require(_0xf7d9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf7d9('0x5'))['db'];var utils=require(_0xf7d9('0x6'));var logger=require(_0xf7d9('0x7'))(_0xf7d9('0x8'));var config=require(_0xf7d9('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf7d9('0xa')]({'port':0x232a});config[_0xf7d9('0xb')]=_['defaults'](config[_0xf7d9('0xb')],{'host':_0xf7d9('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf7d9('0xb')]));require('./voiceExtension.socket')[_0xf7d9('0xd')](socket);function respondWithRpcPromise(_0x33360a,_0x5d2735,_0x560a34){return new BPromise(function(_0x46eb79,_0x90a7f9){return client[_0xf7d9('0xe')](_0x33360a,_0x560a34)['then'](function(_0x480d4a){logger[_0xf7d9('0xf')](_0xf7d9('0x10'),_0x5d2735,_0xf7d9('0x11'));logger[_0xf7d9('0x12')]('VoiceExtension,\x20%s,\x20%s,\x20%s',_0x5d2735,_0xf7d9('0x11'),JSON[_0xf7d9('0x13')](_0x480d4a));if(_0x480d4a[_0xf7d9('0x14')]){if(_0x480d4a[_0xf7d9('0x14')]['code']===0x1f4){logger[_0xf7d9('0x14')](_0xf7d9('0x10'),_0x5d2735,_0x480d4a[_0xf7d9('0x14')][_0xf7d9('0x15')]);return _0x90a7f9(_0x480d4a['error'][_0xf7d9('0x15')]);}logger[_0xf7d9('0x14')](_0xf7d9('0x10'),_0x5d2735,_0x480d4a['error']['message']);return _0x46eb79(_0x480d4a[_0xf7d9('0x14')][_0xf7d9('0x15')]);}else{logger[_0xf7d9('0xf')]('VoiceExtension,\x20%s,\x20%s',_0x5d2735,_0xf7d9('0x11'));_0x46eb79(_0x480d4a[_0xf7d9('0x16')]['message']);}})[_0xf7d9('0x17')](function(_0x4ab10a){logger[_0xf7d9('0x14')](_0xf7d9('0x10'),_0x5d2735,_0x4ab10a);_0x90a7f9(_0x4ab10a);});});}exports['GetVoiceExtension']=function(_0x34acd2){var _0x43dcff=this;return new Promise(function(_0x896c61,_0x316d54){return db[_0xf7d9('0x18')][_0xf7d9('0x19')]({'raw':_0x34acd2[_0xf7d9('0x1a')]?_0x34acd2[_0xf7d9('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x34acd2['options']?_0x34acd2[_0xf7d9('0x1a')]['where']||null:null,'attributes':_0x34acd2[_0xf7d9('0x1a')]?_0x34acd2[_0xf7d9('0x1a')]['attributes']||null:null,'limit':_0x34acd2[_0xf7d9('0x1a')]?_0x34acd2[_0xf7d9('0x1a')]['limit']||null:null,'include':_0x34acd2['options']?_0x34acd2[_0xf7d9('0x1a')][_0xf7d9('0x1b')]?_[_0xf7d9('0x1c')](_0x34acd2['options'][_0xf7d9('0x1b')],function(_0x496ab7){return{'model':db[_0x496ab7[_0xf7d9('0x1d')]],'as':_0x496ab7['as'],'attributes':_0x496ab7[_0xf7d9('0x1e')],'include':_0x496ab7[_0xf7d9('0x1b')]?_['map'](_0x496ab7[_0xf7d9('0x1b')],function(_0x3218bb){return{'model':db[_0x3218bb[_0xf7d9('0x1d')]],'as':_0x3218bb['as'],'attributes':_0x3218bb[_0xf7d9('0x1e')],'include':_0x3218bb[_0xf7d9('0x1b')]?_['map'](_0x3218bb[_0xf7d9('0x1b')],function(_0x3847ff){return{'model':db[_0x3847ff[_0xf7d9('0x1d')]],'as':_0x3847ff['as'],'attributes':_0x3847ff[_0xf7d9('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x20315e){logger[_0xf7d9('0xf')](_0xf7d9('0x1f'),_0x34acd2);logger[_0xf7d9('0x12')](_0xf7d9('0x1f'),_0x34acd2,JSON[_0xf7d9('0x13')](_0x20315e));_0x896c61(_0x20315e);})['catch'](function(_0x5d963f){logger['error'](_0xf7d9('0x1f'),_0x5d963f['message'],_0x34acd2);_0x316d54(_0x43dcff[_0xf7d9('0x14')](0x1f4,_0x5d963f['message']));});});}; \ No newline at end of file +var _0xac6a=['util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','VoiceExtension,\x20%s,\x20%s,\x20%s','error','code','message','result','GetVoiceExtension','VoiceExtension','findAll','options','raw','limit','map','include','model','attributes','debug','stringify','catch','lodash'];(function(_0x57de8d,_0x14289a){var _0x200558=function(_0x6c1cbe){while(--_0x6c1cbe){_0x57de8d['push'](_0x57de8d['shift']());}};_0x200558(++_0x14289a);}(_0xac6a,0xc2));var _0xaac6=function(_0x1c438c,_0x10eaf7){_0x1c438c=_0x1c438c-0x0;var _0xdb25e4=_0xac6a[_0x1c438c];return _0xdb25e4;};'use strict';var _=require(_0xaac6('0x0'));var util=require(_0xaac6('0x1'));var moment=require(_0xaac6('0x2'));var BPromise=require(_0xaac6('0x3'));var rs=require(_0xaac6('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaac6('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xaac6('0x6'))(_0xaac6('0x7'));var config=require(_0xaac6('0x8'));var jayson=require(_0xaac6('0x9'));var client=jayson[_0xaac6('0xa')][_0xaac6('0xb')]({'port':0x232a});config[_0xaac6('0xc')]=_[_0xaac6('0xd')](config[_0xaac6('0xc')],{'host':_0xaac6('0xe'),'port':0x18eb});var socket=require(_0xaac6('0xf'))(new Redis(config[_0xaac6('0xc')]));require('./voiceExtension.socket')[_0xaac6('0x10')](socket);function respondWithRpcPromise(_0x160834,_0x31fa92,_0x37c3ba){return new BPromise(function(_0x19345a,_0x2b9460){return client['request'](_0x160834,_0x37c3ba)[_0xaac6('0x11')](function(_0x1605a3){logger[_0xaac6('0x12')](_0xaac6('0x13'),_0x31fa92,_0xaac6('0x14'));logger['debug'](_0xaac6('0x15'),_0x31fa92,_0xaac6('0x14'),JSON['stringify'](_0x1605a3));if(_0x1605a3['error']){if(_0x1605a3[_0xaac6('0x16')][_0xaac6('0x17')]===0x1f4){logger[_0xaac6('0x16')](_0xaac6('0x13'),_0x31fa92,_0x1605a3[_0xaac6('0x16')][_0xaac6('0x18')]);return _0x2b9460(_0x1605a3[_0xaac6('0x16')][_0xaac6('0x18')]);}logger[_0xaac6('0x16')](_0xaac6('0x13'),_0x31fa92,_0x1605a3[_0xaac6('0x16')][_0xaac6('0x18')]);return _0x19345a(_0x1605a3['error']['message']);}else{logger[_0xaac6('0x12')](_0xaac6('0x13'),_0x31fa92,_0xaac6('0x14'));_0x19345a(_0x1605a3[_0xaac6('0x19')][_0xaac6('0x18')]);}})['catch'](function(_0x22d66e){logger[_0xaac6('0x16')](_0xaac6('0x13'),_0x31fa92,_0x22d66e);_0x2b9460(_0x22d66e);});});}exports[_0xaac6('0x1a')]=function(_0xab5028){var _0x1e7c3e=this;return new Promise(function(_0x450019,_0x4a6064){return db[_0xaac6('0x1b')][_0xaac6('0x1c')]({'raw':_0xab5028[_0xaac6('0x1d')]?_0xab5028[_0xaac6('0x1d')][_0xaac6('0x1e')]===undefined?!![]:![]:!![],'where':_0xab5028[_0xaac6('0x1d')]?_0xab5028[_0xaac6('0x1d')]['where']||null:null,'attributes':_0xab5028['options']?_0xab5028[_0xaac6('0x1d')]['attributes']||null:null,'limit':_0xab5028[_0xaac6('0x1d')]?_0xab5028[_0xaac6('0x1d')][_0xaac6('0x1f')]||null:null,'include':_0xab5028['options']?_0xab5028[_0xaac6('0x1d')]['include']?_[_0xaac6('0x20')](_0xab5028[_0xaac6('0x1d')][_0xaac6('0x21')],function(_0x335300){return{'model':db[_0x335300[_0xaac6('0x22')]],'as':_0x335300['as'],'attributes':_0x335300['attributes'],'include':_0x335300[_0xaac6('0x21')]?_[_0xaac6('0x20')](_0x335300['include'],function(_0x50a896){return{'model':db[_0x50a896[_0xaac6('0x22')]],'as':_0x50a896['as'],'attributes':_0x50a896['attributes'],'include':_0x50a896[_0xaac6('0x21')]?_[_0xaac6('0x20')](_0x50a896[_0xaac6('0x21')],function(_0x3b63f3){return{'model':db[_0x3b63f3[_0xaac6('0x22')]],'as':_0x3b63f3['as'],'attributes':_0x3b63f3[_0xaac6('0x23')]};}):[]};}):[]};}):[]:[]})[_0xaac6('0x11')](function(_0xb02a9b){logger[_0xaac6('0x12')]('GetVoiceExtension',_0xab5028);logger[_0xaac6('0x24')](_0xaac6('0x1a'),_0xab5028,JSON[_0xaac6('0x25')](_0xb02a9b));_0x450019(_0xb02a9b);})[_0xaac6('0x26')](function(_0xf71ad8){logger['error']('GetVoiceExtension',_0xf71ad8[_0xaac6('0x18')],_0xab5028);_0x4a6064(_0x1e7c3e[_0xaac6('0x16')](0x1f4,_0xf71ad8[_0xaac6('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index a8b2a06..5a557b3 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 _0x53ec=['length','voiceExtension:','./voiceExtension.events','save','remove','update','emit','removeListener'];(function(_0x55013b,_0x1712aa){var _0x35cfa6=function(_0x8b3c26){while(--_0x8b3c26){_0x55013b['push'](_0x55013b['shift']());}};_0x35cfa6(++_0x1712aa);}(_0x53ec,0x192));var _0xc53e=function(_0x40f5b7,_0xb3243e){_0x40f5b7=_0x40f5b7-0x0;var _0x3c884a=_0x53ec[_0x40f5b7];return _0x3c884a;};'use strict';var VoiceExtensionEvents=require(_0xc53e('0x0'));var events=[_0xc53e('0x1'),_0xc53e('0x2'),_0xc53e('0x3')];function createListener(_0x1b04cc,_0xe45c6d){return function(_0x51c435){_0xe45c6d[_0xc53e('0x4')](_0x1b04cc,_0x51c435);};}function removeListener(_0x4e954a,_0x2b90f6){return function(){VoiceExtensionEvents[_0xc53e('0x5')](_0x4e954a,_0x2b90f6);};}exports['register']=function(_0x2f1414){for(var _0x4f989b=0x0,_0x41a9e8=events[_0xc53e('0x6')];_0x4f989b<_0x41a9e8;_0x4f989b++){var _0x5d3b28=events[_0x4f989b];var _0x1616ac=createListener(_0xc53e('0x7')+_0x5d3b28,_0x2f1414);VoiceExtensionEvents['on'](_0x5d3b28,_0x1616ac);}}; \ No newline at end of file +var _0x53ec=['length','voiceExtension:','./voiceExtension.events','save','remove','update','emit','removeListener'];(function(_0x2ba500,_0x5c5f61){var _0x2efd44=function(_0x349e67){while(--_0x349e67){_0x2ba500['push'](_0x2ba500['shift']());}};_0x2efd44(++_0x5c5f61);}(_0x53ec,0x192));var _0xc53e=function(_0x441819,_0x5b8d0a){_0x441819=_0x441819-0x0;var _0x478882=_0x53ec[_0x441819];return _0x478882;};'use strict';var VoiceExtensionEvents=require(_0xc53e('0x0'));var events=[_0xc53e('0x1'),_0xc53e('0x2'),_0xc53e('0x3')];function createListener(_0x1b04cc,_0xe45c6d){return function(_0x51c435){_0xe45c6d[_0xc53e('0x4')](_0x1b04cc,_0x51c435);};}function removeListener(_0x4e954a,_0x2b90f6){return function(){VoiceExtensionEvents[_0xc53e('0x5')](_0x4e954a,_0x2b90f6);};}exports['register']=function(_0x2f1414){for(var _0x4f989b=0x0,_0x41a9e8=events[_0xc53e('0x6')];_0x4f989b<_0x41a9e8;_0x4f989b++){var _0x5d3b28=events[_0x4f989b];var _0x1616ac=createListener(_0xc53e('0x7')+_0x5d3b28,_0x2f1414);VoiceExtensionEvents['on'](_0x5d3b28,_0x1616ac);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 8659ab4..6a38ca3 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 _0x8f9d=['/:id/messages','getMessages','create','put','update','delete','destroy','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','isAuthenticated','index','get','/:id'];(function(_0x77d310,_0x2b2fe7){var _0x2cdce4=function(_0xbaa481){while(--_0xbaa481){_0x77d310['push'](_0x77d310['shift']());}};_0x2cdce4(++_0x2b2fe7);}(_0x8f9d,0x93));var _0xd8f9=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x8f9d[_0x42cae2];return _0x5f256f;};'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['show']);router[_0xd8f9('0xb')](_0xd8f9('0xd'),auth['isAuthenticated'](),controller[_0xd8f9('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0xd8f9('0xf')]);router[_0xd8f9('0x10')](_0xd8f9('0xc'),auth[_0xd8f9('0x9')](),controller[_0xd8f9('0x11')]);router[_0xd8f9('0x12')](_0xd8f9('0xc'),auth['isAuthenticated'](),controller[_0xd8f9('0x13')]);module['exports']=router; \ No newline at end of file +var _0x5fab=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','/:id','show','/:id/messages','getMessages','create','put','update','delete','destroy','multer','util','connect-timeout'];(function(_0x5f1b34,_0x18f8d8){var _0x128f85=function(_0x32dea0){while(--_0x32dea0){_0x5f1b34['push'](_0x5f1b34['shift']());}};_0x128f85(++_0x18f8d8);}(_0x5fab,0x177));var _0xb5fa=function(_0x5108bf,_0x1e9b2a){_0x5108bf=_0x5108bf-0x0;var _0x343c7e=_0x5fab[_0x5108bf];return _0x343c7e;};'use strict';var multer=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var path=require('path');var timeout=require(_0xb5fa('0x2'));var express=require(_0xb5fa('0x3'));var router=express[_0xb5fa('0x4')]();var fs_extra=require(_0xb5fa('0x5'));var auth=require(_0xb5fa('0x6'));var interaction=require(_0xb5fa('0x7'));var config=require(_0xb5fa('0x8'));var controller=require(_0xb5fa('0x9'));router[_0xb5fa('0xa')]('/',auth[_0xb5fa('0xb')](),controller['index']);router['get'](_0xb5fa('0xc'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0xd')]);router['get'](_0xb5fa('0xe'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0xb5fa('0x10')]);router[_0xb5fa('0x11')](_0xb5fa('0xc'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x12')]);router[_0xb5fa('0x13')](_0xb5fa('0xc'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index b6cd843..b25d0eb 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 _0xfd68=['exports','STRING','from-voicemail','contest_mailbox','setDataValue','email','string','trim','central','yes','ENUM','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','mailbox'];(function(_0x35efbe,_0x3f5b76){var _0x53bf98=function(_0x4571ca){while(--_0x4571ca){_0x35efbe['push'](_0x35efbe['shift']());}};_0x53bf98(++_0x3f5b76);}(_0xfd68,0x168));var _0x8fd6=function(_0x5c8e4a,_0xde191){_0x5c8e4a=_0x5c8e4a-0x0;var _0x1fe341=_0xfd68[_0x5c8e4a];return _0x1fe341;};'use strict';var Sequelize=require('sequelize');module[_0x8fd6('0x0')]={'customer_id':{'type':Sequelize[_0x8fd6('0x1')]},'context':{'type':Sequelize[_0x8fd6('0x1')],'defaultValue':_0x8fd6('0x2'),'unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0x8fd6('0x1')],'defaultValue':'','allowNull':![],'unique':_0x8fd6('0x3')},'password':{'type':Sequelize[_0x8fd6('0x1')]},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x8fd6('0x1')],'validate':{'isEmail':!![]},'set':function(_0x56b27c){this[_0x8fd6('0x4')](_0x8fd6('0x5'),typeof _0x56b27c===_0x8fd6('0x6')&&_0x56b27c[_0x8fd6('0x7')]()?_0x56b27c[_0x8fd6('0x7')]():null);}},'pager':{'type':Sequelize[_0x8fd6('0x1')]},'tz':{'type':Sequelize['STRING'],'defaultValue':_0x8fd6('0x8')},'attach':{'type':Sequelize['ENUM'](_0x8fd6('0x9'),'no'),'defaultValue':_0x8fd6('0x9'),'allowNull':![]},'saycid':{'type':Sequelize['ENUM'](_0x8fd6('0x9'),'no'),'defaultValue':_0x8fd6('0x9'),'allowNull':![]},'dialout':{'type':Sequelize[_0x8fd6('0x1')]},'callback':{'type':Sequelize[_0x8fd6('0x1')]},'review':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x8fd6('0xa')](_0x8fd6('0x9'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM'](_0x8fd6('0x9'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x8fd6('0xa')](_0x8fd6('0x9'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x8fd6('0xa')](_0x8fd6('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x8fd6('0xa')](_0x8fd6('0x9'),'no'),'defaultValue':'yes','allowNull':![]},'forcename':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x8fd6('0xa')](_0x8fd6('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x8fd6('0xa')](_0x8fd6('0x9'),'no'),'defaultValue':_0x8fd6('0x9'),'allowNull':![]},'stamp':{'type':_0x8fd6('0xb')},'emailsubject':{'type':Sequelize[_0x8fd6('0x1')]},'emailbody':{'type':Sequelize['STRING']},'maxsecs':{'type':Sequelize[_0x8fd6('0xc')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x8fd6('0xc')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x8fd6('0xd')],'get':function(){return this[_0x8fd6('0xe')](_0x8fd6('0xf'))+_0x8fd6('0x10')+this[_0x8fd6('0xe')](_0x8fd6('0x11'));}}}; \ No newline at end of file +var _0xa91b=['TIMESTAMP','INTEGER','getDataValue','fullname','\x20-\x20','mailbox','sequelize','STRING','from-voicemail','contest_mailbox','setDataValue','email','string','trim','central','ENUM','yes','TINYINT(4)'];(function(_0x319b87,_0x54b470){var _0x507350=function(_0x222652){while(--_0x222652){_0x319b87['push'](_0x319b87['shift']());}};_0x507350(++_0x54b470);}(_0xa91b,0x1b6));var _0xba91=function(_0x484dae,_0x198c2a){_0x484dae=_0x484dae-0x0;var _0x16aeb7=_0xa91b[_0x484dae];return _0x16aeb7;};'use strict';var Sequelize=require(_0xba91('0x0'));module['exports']={'customer_id':{'type':Sequelize[_0xba91('0x1')]},'context':{'type':Sequelize['STRING'],'defaultValue':_0xba91('0x2'),'unique':_0xba91('0x3')},'mailbox':{'type':Sequelize[_0xba91('0x1')],'defaultValue':'','allowNull':![],'unique':_0xba91('0x3')},'password':{'type':Sequelize[_0xba91('0x1')]},'fullname':{'type':Sequelize[_0xba91('0x1')]},'email':{'type':Sequelize[_0xba91('0x1')],'validate':{'isEmail':!![]},'set':function(_0x4d3d99){this[_0xba91('0x4')](_0xba91('0x5'),typeof _0x4d3d99===_0xba91('0x6')&&_0x4d3d99['trim']()?_0x4d3d99[_0xba91('0x7')]():null);}},'pager':{'type':Sequelize['STRING']},'tz':{'type':Sequelize['STRING'],'defaultValue':_0xba91('0x8')},'attach':{'type':Sequelize[_0xba91('0x9')]('yes','no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize[_0xba91('0x9')](_0xba91('0xa'),'no'),'defaultValue':_0xba91('0xa'),'allowNull':![]},'dialout':{'type':Sequelize[_0xba91('0x1')]},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize[_0xba91('0x9')](_0xba91('0xa'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xba91('0x9')](_0xba91('0xa'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xba91('0x9')](_0xba91('0xa'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xba91('0x9')](_0xba91('0xa'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xba91('0xb'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xba91('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xba91('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xba91('0x9')]('yes','no'),'defaultValue':_0xba91('0xa'),'allowNull':![]},'forcename':{'type':Sequelize[_0xba91('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xba91('0x9')](_0xba91('0xa'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xba91('0x9')]('yes','no'),'defaultValue':_0xba91('0xa'),'allowNull':![]},'stamp':{'type':_0xba91('0xc')},'emailsubject':{'type':Sequelize[_0xba91('0x1')]},'emailbody':{'type':Sequelize[_0xba91('0x1')]},'maxsecs':{'type':Sequelize[_0xba91('0xd')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xba91('0xd')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xba91('0xe')](_0xba91('0xf'))+_0xba91('0x10')+this[_0xba91('0xe')](_0xba91('0x11'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index e7a2cae..1d871f2 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 _0x3c81=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','get','end','error','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','intersection','fields','attributes','length','nolimit','order','sort','where','filters','pick','merge','filter','options','VoiceMail','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Voicemails','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMessages','findOne','VoiceMailMessage','hasOwnProperty','mailbox','findAndCountAll','eml-format','rimraf','fast-json-patch','request-promise','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x13eea8,_0x5ed8b2){var _0x255a29=function(_0x2fa27e){while(--_0x2fa27e){_0x13eea8['push'](_0x13eea8['shift']());}};_0x255a29(++_0x5ed8b2);}(_0x3c81,0x102));var _0x13c8=function(_0x4fae3b,_0x23fa32){_0x4fae3b=_0x4fae3b-0x0;var _0x3415e2=_0x3c81[_0x4fae3b];return _0x3415e2;};'use strict';var emlformat=require(_0x13c8('0x0'));var rimraf=require(_0x13c8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x13c8('0x2'));var rp=require(_0x13c8('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x13c8('0x4'));var sox=require(_0x13c8('0x5'));var csv=require(_0x13c8('0x6'));var ejs=require(_0x13c8('0x7'));var fs=require('fs');var fs_extra=require(_0x13c8('0x8'));var _=require(_0x13c8('0x9'));var squel=require(_0x13c8('0xa'));var crypto=require('crypto');var jsforce=require(_0x13c8('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x13c8('0x6'));var querystring=require(_0x13c8('0xc'));var Papa=require(_0x13c8('0xd'));var Redis=require(_0x13c8('0xe'));var authService=require(_0x13c8('0xf'));var qs=require(_0x13c8('0x10'));var as=require(_0x13c8('0x11'));var hardwareService=require(_0x13c8('0x12'));var logger=require(_0x13c8('0x13'))(_0x13c8('0x14'));var utils=require(_0x13c8('0x15'));var config=require(_0x13c8('0x16'));var licenseUtil=require(_0x13c8('0x17'));var db=require(_0x13c8('0x18'))['db'];function respondWithStatusCode(_0x5ab91d,_0x21442d){_0x21442d=_0x21442d||0xcc;return function(_0x7b6da8){if(_0x7b6da8){return _0x5ab91d[_0x13c8('0x19')](_0x21442d);}return _0x5ab91d[_0x13c8('0x1a')](_0x21442d)['end']();};}function respondWithResult(_0x42955d,_0x515681){_0x515681=_0x515681||0xc8;return function(_0x4d7a88){if(_0x4d7a88){return _0x42955d['status'](_0x515681)[_0x13c8('0x1b')](_0x4d7a88);}};}function respondWithFilteredResult(_0x5e0e06,_0x337397){return function(_0x17a3c1){if(_0x17a3c1){var _0x23f64e=typeof _0x337397[_0x13c8('0x1c')]==='undefined'&&typeof _0x337397[_0x13c8('0x1d')]===_0x13c8('0x1e');var _0x31ae02=_0x17a3c1[_0x13c8('0x1f')];var _0xce1ad2=_0x23f64e?0x0:_0x337397[_0x13c8('0x1c')];var _0x346417=_0x23f64e?_0x17a3c1[_0x13c8('0x1f')]:_0x337397[_0x13c8('0x1c')]+_0x337397[_0x13c8('0x1d')];var _0xe9386a;if(_0x346417>=_0x31ae02){_0x346417=_0x31ae02;_0xe9386a=0xc8;}else{_0xe9386a=0xce;}_0x5e0e06['status'](_0xe9386a);return _0x5e0e06[_0x13c8('0x20')](_0x13c8('0x21'),_0xce1ad2+'-'+_0x346417+'/'+_0x31ae02)[_0x13c8('0x1b')](_0x17a3c1);}return null;};}function patchUpdates(_0x313ea3){return function(_0x513085){try{jsonpatch[_0x13c8('0x22')](_0x513085,_0x313ea3,!![]);}catch(_0x3c4603){return BPromise[_0x13c8('0x23')](_0x3c4603);}return _0x513085[_0x13c8('0x24')]();};}function saveUpdates(_0x436d5d,_0x2fc123){return function(_0x5ab47f){if(_0x5ab47f){return _0x5ab47f[_0x13c8('0x25')](_0x436d5d)[_0x13c8('0x26')](function(_0x315d6c){return _0x315d6c;});}return null;};}function removeEntity(_0xcf41d2,_0x577df6){return function(_0x1770e5){if(_0x1770e5){return _0x1770e5[_0x13c8('0x27')]()['then'](function(){var _0x49b552=_0x1770e5[_0x13c8('0x28')]({'plain':!![]});var _0x4aff35='Voicemails';return db['UserProfileResource'][_0x13c8('0x27')]({'where':{'type':_0x4aff35,'resourceId':_0x49b552['id']}})[_0x13c8('0x26')](function(){return _0x1770e5;});})['then'](function(){_0xcf41d2['status'](0xcc)[_0x13c8('0x29')]();});}};}function handleEntityNotFound(_0x596166,_0x545b47){return function(_0x1c7dc4){if(!_0x1c7dc4){_0x596166[_0x13c8('0x19')](0x194);}return _0x1c7dc4;};}function handleError(_0x34fdbe,_0x560ede){_0x560ede=_0x560ede||0x1f4;return function(_0x5ef2f7){logger[_0x13c8('0x2a')](_0x5ef2f7[_0x13c8('0x2b')]);if(_0x5ef2f7[_0x13c8('0x2c')]){delete _0x5ef2f7[_0x13c8('0x2c')];}_0x34fdbe[_0x13c8('0x1a')](_0x560ede)[_0x13c8('0x2d')](_0x5ef2f7);};}exports[_0x13c8('0x2e')]=function(_0x4a1b9c,_0x109cb8){var _0xcbc9b7={},_0x5a5911={},_0x5c85e4={'count':0x0,'rows':[]};var _0x23a725=_[_0x13c8('0x2f')](db['VoiceMail'][_0x13c8('0x30')],function(_0x355ddc){return{'name':_0x355ddc['fieldName'],'type':_0x355ddc[_0x13c8('0x31')][_0x13c8('0x32')]};});_0x5a5911[_0x13c8('0x33')]=_[_0x13c8('0x2f')](_0x23a725,_0x13c8('0x2c'));_0x5a5911[_0x13c8('0x34')]=_[_0x13c8('0x35')](_0x4a1b9c[_0x13c8('0x34')]);_0x5a5911['filters']=_['intersection'](_0x5a5911[_0x13c8('0x33')],_0x5a5911[_0x13c8('0x34')]);_0xcbc9b7['attributes']=_[_0x13c8('0x36')](_0x5a5911['model'],qs[_0x13c8('0x37')](_0x4a1b9c['query'][_0x13c8('0x37')]));_0xcbc9b7[_0x13c8('0x38')]=_0xcbc9b7[_0x13c8('0x38')][_0x13c8('0x39')]?_0xcbc9b7[_0x13c8('0x38')]:_0x5a5911[_0x13c8('0x33')];if(!_0x4a1b9c[_0x13c8('0x34')]['hasOwnProperty'](_0x13c8('0x3a'))){_0xcbc9b7[_0x13c8('0x1d')]=qs['limit'](_0x4a1b9c[_0x13c8('0x34')][_0x13c8('0x1d')]);_0xcbc9b7[_0x13c8('0x1c')]=qs['offset'](_0x4a1b9c['query']['offset']);}_0xcbc9b7[_0x13c8('0x3b')]=qs[_0x13c8('0x3c')](_0x4a1b9c[_0x13c8('0x34')][_0x13c8('0x3c')]);_0xcbc9b7[_0x13c8('0x3d')]=qs[_0x13c8('0x3e')](_[_0x13c8('0x3f')](_0x4a1b9c[_0x13c8('0x34')],_0x5a5911[_0x13c8('0x3e')]),_0x23a725);if(_0x4a1b9c['query']['filter']){_0xcbc9b7[_0x13c8('0x3d')]=_[_0x13c8('0x40')](_0xcbc9b7[_0x13c8('0x3d')],{'$or':_[_0x13c8('0x2f')](_0x23a725,function(_0x4f1bed){if(_0x4f1bed[_0x13c8('0x31')]!=='VIRTUAL'){var _0x343dba={};_0x343dba[_0x4f1bed[_0x13c8('0x2c')]]={'$like':'%'+_0x4a1b9c[_0x13c8('0x34')][_0x13c8('0x41')]+'%'};return _0x343dba;}})});}_0xcbc9b7=_[_0x13c8('0x40')]({},_0xcbc9b7,_0x4a1b9c[_0x13c8('0x42')]);var _0xb272c0={'where':_0xcbc9b7[_0x13c8('0x3d')]};return db[_0x13c8('0x43')][_0x13c8('0x1f')](_0xb272c0)[_0x13c8('0x26')](function(_0x416169){_0x5c85e4[_0x13c8('0x1f')]=_0x416169;if(_0x4a1b9c[_0x13c8('0x34')][_0x13c8('0x44')]){_0xcbc9b7[_0x13c8('0x45')]=[{'all':!![]}];}return db[_0x13c8('0x43')][_0x13c8('0x46')](_0xcbc9b7);})[_0x13c8('0x26')](function(_0x1cff99){_0x5c85e4[_0x13c8('0x47')]=_0x1cff99;return _0x5c85e4;})[_0x13c8('0x26')](respondWithFilteredResult(_0x109cb8,_0xcbc9b7))[_0x13c8('0x48')](handleError(_0x109cb8,null));};exports[_0x13c8('0x49')]=function(_0x44ee66,_0x57e65f){var _0x3ef04e={'raw':!![],'where':{'id':_0x44ee66[_0x13c8('0x4a')]['id']}},_0x3fcb7f={};_0x3fcb7f[_0x13c8('0x33')]=_[_0x13c8('0x35')](db['VoiceMail']['rawAttributes']);_0x3fcb7f[_0x13c8('0x34')]=_[_0x13c8('0x35')](_0x44ee66[_0x13c8('0x34')]);_0x3fcb7f['filters']=_['intersection'](_0x3fcb7f['model'],_0x3fcb7f[_0x13c8('0x34')]);_0x3ef04e['attributes']=_[_0x13c8('0x36')](_0x3fcb7f['model'],qs[_0x13c8('0x37')](_0x44ee66[_0x13c8('0x34')][_0x13c8('0x37')]));_0x3ef04e[_0x13c8('0x38')]=_0x3ef04e[_0x13c8('0x38')][_0x13c8('0x39')]?_0x3ef04e['attributes']:_0x3fcb7f[_0x13c8('0x33')];if(_0x44ee66[_0x13c8('0x34')]['includeAll']){_0x3ef04e[_0x13c8('0x45')]=[{'all':!![]}];}_0x3ef04e=_[_0x13c8('0x40')]({},_0x3ef04e,_0x44ee66[_0x13c8('0x42')]);return db[_0x13c8('0x43')][_0x13c8('0x4b')](_0x3ef04e)['then'](handleEntityNotFound(_0x57e65f,null))[_0x13c8('0x26')](respondWithResult(_0x57e65f,null))[_0x13c8('0x48')](handleError(_0x57e65f,null));};exports[_0x13c8('0x4c')]=function(_0x38418b,_0x185d18){return db['VoiceMail'][_0x13c8('0x4c')](_0x38418b[_0x13c8('0x4d')],{})[_0x13c8('0x26')](function(_0x6b042b){var _0x2d4f87=_0x38418b[_0x13c8('0x4e')][_0x13c8('0x28')]({'plain':!![]});if(!_0x2d4f87)throw new Error(_0x13c8('0x4f'));if(_0x2d4f87[_0x13c8('0x50')]===_0x13c8('0x4e')){var _0x266f4e=_0x6b042b['get']({'plain':!![]});var _0x10ba7c=_0x13c8('0x51');return db[_0x13c8('0x52')][_0x13c8('0x4b')]({'where':{'name':_0x10ba7c,'userProfileId':_0x2d4f87[_0x13c8('0x53')]},'raw':!![]})[_0x13c8('0x26')](function(_0x48b7f6){if(_0x48b7f6&&_0x48b7f6[_0x13c8('0x54')]===0x0){return db[_0x13c8('0x55')][_0x13c8('0x4c')]({'name':_0x266f4e['name'],'resourceId':_0x266f4e['id'],'type':_0x48b7f6['name'],'sectionId':_0x48b7f6['id']},{})[_0x13c8('0x26')](function(){return _0x6b042b;});}else{return _0x6b042b;}})[_0x13c8('0x48')](function(_0x55d353){logger[_0x13c8('0x2a')](_0x13c8('0x56'),_0x55d353);throw _0x55d353;});}return _0x6b042b;})['then'](respondWithResult(_0x185d18,0xc9))[_0x13c8('0x48')](handleError(_0x185d18,null));};exports['update']=function(_0x242791,_0x1f67bd){if(_0x242791[_0x13c8('0x4d')]['id']){delete _0x242791['body']['id'];}return db[_0x13c8('0x43')][_0x13c8('0x4b')]({'where':{'id':_0x242791['params']['id']}})[_0x13c8('0x26')](handleEntityNotFound(_0x1f67bd,null))['then'](saveUpdates(_0x242791[_0x13c8('0x4d')],null))[_0x13c8('0x26')](respondWithResult(_0x1f67bd,null))[_0x13c8('0x48')](handleError(_0x1f67bd,null));};exports[_0x13c8('0x27')]=function(_0x3760e4,_0x5f4884){return db[_0x13c8('0x43')]['find']({'where':{'id':_0x3760e4['params']['id']}})['then'](handleEntityNotFound(_0x5f4884,null))['then'](removeEntity(_0x5f4884,null))['catch'](handleError(_0x5f4884,null));};exports[_0x13c8('0x57')]=function(_0x46074c,_0x1515a5,_0x1f383f){return db[_0x13c8('0x43')][_0x13c8('0x58')]({'where':{'id':_0x46074c[_0x13c8('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1515a5,null))['then'](function(_0x41f9d7){var _0x30e3e4;var _0x27760b={},_0x11b3ba={};_0x11b3ba[_0x13c8('0x33')]=_[_0x13c8('0x35')](db[_0x13c8('0x59')][_0x13c8('0x30')]);_0x11b3ba['query']=_[_0x13c8('0x35')](_0x46074c[_0x13c8('0x34')]);_0x11b3ba['filters']=_[_0x13c8('0x36')](_0x11b3ba[_0x13c8('0x33')],_0x11b3ba[_0x13c8('0x34')]);_0x27760b[_0x13c8('0x38')]=_[_0x13c8('0x36')](_0x11b3ba[_0x13c8('0x33')],qs[_0x13c8('0x37')](_0x46074c[_0x13c8('0x34')][_0x13c8('0x37')]));_0x27760b[_0x13c8('0x38')]=_0x27760b[_0x13c8('0x38')][_0x13c8('0x39')]?_0x27760b[_0x13c8('0x38')]:_0x11b3ba[_0x13c8('0x33')];if(!_0x46074c[_0x13c8('0x34')][_0x13c8('0x5a')]('nolimit')){_0x27760b[_0x13c8('0x1d')]=qs['limit'](_0x46074c[_0x13c8('0x34')][_0x13c8('0x1d')]);_0x27760b['offset']=qs[_0x13c8('0x1c')](_0x46074c[_0x13c8('0x34')]['offset']);}_0x27760b[_0x13c8('0x3b')]=qs[_0x13c8('0x3c')](_0x46074c[_0x13c8('0x34')][_0x13c8('0x3c')]);_0x27760b[_0x13c8('0x3d')]=qs[_0x13c8('0x3e')](_[_0x13c8('0x3f')](_0x46074c[_0x13c8('0x34')],_0x11b3ba[_0x13c8('0x3e')]));if(_0x46074c[_0x13c8('0x34')][_0x13c8('0x41')]){_0x27760b['where']=_[_0x13c8('0x40')](_0x27760b[_0x13c8('0x3d')],{'$or':_[_0x13c8('0x2f')](_0x27760b[_0x13c8('0x38')],function(_0x372ae4){var _0x23c67e={};_0x23c67e[_0x372ae4]={'$like':'%'+_0x46074c['query'][_0x13c8('0x41')]+'%'};return _0x23c67e;})});}_0x27760b[_0x13c8('0x3d')]=_[_0x13c8('0x40')](_0x27760b['where'],{'mailboxuser':_0x41f9d7[_0x13c8('0x5b')]});_0x27760b=_[_0x13c8('0x40')]({},_0x27760b,_0x46074c[_0x13c8('0x42')]);return db[_0x13c8('0x59')][_0x13c8('0x5c')](_0x27760b)[_0x13c8('0x26')](respondWithFilteredResult(_0x1515a5,_0x27760b));})['catch'](handleError(_0x1515a5,null));}; \ No newline at end of file +var _0x757a=['../../config/license/hardware','../../config/logger','api','status','json','offset','undefined','count','limit','Content-Range','apply','update','then','get','Voicemails','UserProfileResource','destroy','end','error','name','send','map','VoiceMail','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','options','include','rows','catch','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMessages','findOne','VoiceMailMessage','hasOwnProperty','findAndCountAll','rimraf','zip-dir','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0xecd1d7,_0x42d954){var _0x404fc4=function(_0x2d3309){while(--_0x2d3309){_0xecd1d7['push'](_0xecd1d7['shift']());}};_0x404fc4(++_0x42d954);}(_0x757a,0xde));var _0xa757=function(_0x265814,_0x1055a0){_0x265814=_0x265814-0x0;var _0x39915e=_0x757a[_0x265814];return _0x39915e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa757('0x0'));var zipdir=require(_0xa757('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa757('0x2'));var Mustache=require(_0xa757('0x3'));var util=require(_0xa757('0x4'));var path=require(_0xa757('0x5'));var sox=require(_0xa757('0x6'));var csv=require(_0xa757('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa757('0x8'));var _=require(_0xa757('0x9'));var squel=require('squel');var crypto=require(_0xa757('0xa'));var jsforce=require(_0xa757('0xb'));var deskjs=require(_0xa757('0xc'));var toCsv=require(_0xa757('0x7'));var querystring=require(_0xa757('0xd'));var Papa=require('papaparse');var Redis=require(_0xa757('0xe'));var authService=require(_0xa757('0xf'));var qs=require(_0xa757('0x10'));var as=require(_0xa757('0x11'));var hardwareService=require(_0xa757('0x12'));var logger=require(_0xa757('0x13'))(_0xa757('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4db68e,_0x421040){_0x421040=_0x421040||0xcc;return function(_0x544b45){if(_0x544b45){return _0x4db68e['sendStatus'](_0x421040);}return _0x4db68e[_0xa757('0x15')](_0x421040)['end']();};}function respondWithResult(_0x481508,_0x32112b){_0x32112b=_0x32112b||0xc8;return function(_0x1b670e){if(_0x1b670e){return _0x481508[_0xa757('0x15')](_0x32112b)[_0xa757('0x16')](_0x1b670e);}};}function respondWithFilteredResult(_0x86abd,_0x31cfd2){return function(_0xf12b68){if(_0xf12b68){var _0x2f7947=typeof _0x31cfd2[_0xa757('0x17')]===_0xa757('0x18')&&typeof _0x31cfd2['limit']===_0xa757('0x18');var _0x44eab8=_0xf12b68[_0xa757('0x19')];var _0x4d9f58=_0x2f7947?0x0:_0x31cfd2['offset'];var _0x151c04=_0x2f7947?_0xf12b68[_0xa757('0x19')]:_0x31cfd2[_0xa757('0x17')]+_0x31cfd2[_0xa757('0x1a')];var _0x27f4ba;if(_0x151c04>=_0x44eab8){_0x151c04=_0x44eab8;_0x27f4ba=0xc8;}else{_0x27f4ba=0xce;}_0x86abd[_0xa757('0x15')](_0x27f4ba);return _0x86abd['set'](_0xa757('0x1b'),_0x4d9f58+'-'+_0x151c04+'/'+_0x44eab8)['json'](_0xf12b68);}return null;};}function patchUpdates(_0x32c2a1){return function(_0x167640){try{jsonpatch[_0xa757('0x1c')](_0x167640,_0x32c2a1,!![]);}catch(_0x2c9ec6){return BPromise['reject'](_0x2c9ec6);}return _0x167640['save']();};}function saveUpdates(_0x40ec48,_0x2159cf){return function(_0x2ba923){if(_0x2ba923){return _0x2ba923[_0xa757('0x1d')](_0x40ec48)[_0xa757('0x1e')](function(_0x40562f){return _0x40562f;});}return null;};}function removeEntity(_0x2ca10d,_0x21f1af){return function(_0x2bf276){if(_0x2bf276){return _0x2bf276['destroy']()[_0xa757('0x1e')](function(){var _0x59e9d4=_0x2bf276[_0xa757('0x1f')]({'plain':!![]});var _0x47903b=_0xa757('0x20');return db[_0xa757('0x21')][_0xa757('0x22')]({'where':{'type':_0x47903b,'resourceId':_0x59e9d4['id']}})['then'](function(){return _0x2bf276;});})[_0xa757('0x1e')](function(){_0x2ca10d[_0xa757('0x15')](0xcc)[_0xa757('0x23')]();});}};}function handleEntityNotFound(_0x3bf7f3,_0x5b4779){return function(_0x449a7d){if(!_0x449a7d){_0x3bf7f3['sendStatus'](0x194);}return _0x449a7d;};}function handleError(_0x5a5664,_0x54b75e){_0x54b75e=_0x54b75e||0x1f4;return function(_0x4f8de2){logger[_0xa757('0x24')](_0x4f8de2['stack']);if(_0x4f8de2[_0xa757('0x25')]){delete _0x4f8de2[_0xa757('0x25')];}_0x5a5664['status'](_0x54b75e)[_0xa757('0x26')](_0x4f8de2);};}exports['index']=function(_0x2c4823,_0xa6d0f6){var _0x5307c3={},_0x235e54={},_0x5ade7b={'count':0x0,'rows':[]};var _0x3a4a66=_[_0xa757('0x27')](db[_0xa757('0x28')][_0xa757('0x29')],function(_0xcc87c0){return{'name':_0xcc87c0[_0xa757('0x2a')],'type':_0xcc87c0[_0xa757('0x2b')][_0xa757('0x2c')]};});_0x235e54[_0xa757('0x2d')]=_[_0xa757('0x27')](_0x3a4a66,_0xa757('0x25'));_0x235e54[_0xa757('0x2e')]=_[_0xa757('0x2f')](_0x2c4823[_0xa757('0x2e')]);_0x235e54[_0xa757('0x30')]=_[_0xa757('0x31')](_0x235e54[_0xa757('0x2d')],_0x235e54[_0xa757('0x2e')]);_0x5307c3[_0xa757('0x32')]=_[_0xa757('0x31')](_0x235e54[_0xa757('0x2d')],qs[_0xa757('0x33')](_0x2c4823[_0xa757('0x2e')][_0xa757('0x33')]));_0x5307c3['attributes']=_0x5307c3[_0xa757('0x32')][_0xa757('0x34')]?_0x5307c3[_0xa757('0x32')]:_0x235e54[_0xa757('0x2d')];if(!_0x2c4823[_0xa757('0x2e')]['hasOwnProperty'](_0xa757('0x35'))){_0x5307c3[_0xa757('0x1a')]=qs[_0xa757('0x1a')](_0x2c4823[_0xa757('0x2e')][_0xa757('0x1a')]);_0x5307c3[_0xa757('0x17')]=qs['offset'](_0x2c4823[_0xa757('0x2e')][_0xa757('0x17')]);}_0x5307c3[_0xa757('0x36')]=qs[_0xa757('0x37')](_0x2c4823[_0xa757('0x2e')][_0xa757('0x37')]);_0x5307c3[_0xa757('0x38')]=qs[_0xa757('0x30')](_[_0xa757('0x39')](_0x2c4823['query'],_0x235e54[_0xa757('0x30')]),_0x3a4a66);if(_0x2c4823[_0xa757('0x2e')][_0xa757('0x3a')]){_0x5307c3[_0xa757('0x38')]=_[_0xa757('0x3b')](_0x5307c3[_0xa757('0x38')],{'$or':_['map'](_0x3a4a66,function(_0x10d3fd){if(_0x10d3fd[_0xa757('0x2b')]!=='VIRTUAL'){var _0x5eae0b={};_0x5eae0b[_0x10d3fd[_0xa757('0x25')]]={'$like':'%'+_0x2c4823[_0xa757('0x2e')]['filter']+'%'};return _0x5eae0b;}})});}_0x5307c3=_['merge']({},_0x5307c3,_0x2c4823[_0xa757('0x3c')]);var _0x1725a2={'where':_0x5307c3[_0xa757('0x38')]};return db['VoiceMail'][_0xa757('0x19')](_0x1725a2)[_0xa757('0x1e')](function(_0x26802c){_0x5ade7b[_0xa757('0x19')]=_0x26802c;if(_0x2c4823[_0xa757('0x2e')]['includeAll']){_0x5307c3[_0xa757('0x3d')]=[{'all':!![]}];}return db['VoiceMail']['findAll'](_0x5307c3);})[_0xa757('0x1e')](function(_0x57298b){_0x5ade7b[_0xa757('0x3e')]=_0x57298b;return _0x5ade7b;})[_0xa757('0x1e')](respondWithFilteredResult(_0xa6d0f6,_0x5307c3))[_0xa757('0x3f')](handleError(_0xa6d0f6,null));};exports['show']=function(_0x5d25bb,_0x11e141){var _0x129d77={'raw':!![],'where':{'id':_0x5d25bb[_0xa757('0x40')]['id']}},_0x2b171c={};_0x2b171c[_0xa757('0x2d')]=_[_0xa757('0x2f')](db['VoiceMail'][_0xa757('0x29')]);_0x2b171c[_0xa757('0x2e')]=_['keys'](_0x5d25bb[_0xa757('0x2e')]);_0x2b171c['filters']=_[_0xa757('0x31')](_0x2b171c[_0xa757('0x2d')],_0x2b171c['query']);_0x129d77[_0xa757('0x32')]=_[_0xa757('0x31')](_0x2b171c['model'],qs[_0xa757('0x33')](_0x5d25bb[_0xa757('0x2e')][_0xa757('0x33')]));_0x129d77[_0xa757('0x32')]=_0x129d77['attributes'][_0xa757('0x34')]?_0x129d77[_0xa757('0x32')]:_0x2b171c[_0xa757('0x2d')];if(_0x5d25bb[_0xa757('0x2e')]['includeAll']){_0x129d77[_0xa757('0x3d')]=[{'all':!![]}];}_0x129d77=_['merge']({},_0x129d77,_0x5d25bb['options']);return db[_0xa757('0x28')][_0xa757('0x41')](_0x129d77)[_0xa757('0x1e')](handleEntityNotFound(_0x11e141,null))['then'](respondWithResult(_0x11e141,null))[_0xa757('0x3f')](handleError(_0x11e141,null));};exports['create']=function(_0x2ed63f,_0x151cc3){return db[_0xa757('0x28')][_0xa757('0x42')](_0x2ed63f[_0xa757('0x43')],{})[_0xa757('0x1e')](function(_0x57bf73){var _0x505cd=_0x2ed63f['user'][_0xa757('0x1f')]({'plain':!![]});if(!_0x505cd)throw new Error(_0xa757('0x44'));if(_0x505cd[_0xa757('0x45')]===_0xa757('0x46')){var _0x319988=_0x57bf73[_0xa757('0x1f')]({'plain':!![]});var _0x15bad7=_0xa757('0x20');return db[_0xa757('0x47')][_0xa757('0x41')]({'where':{'name':_0x15bad7,'userProfileId':_0x505cd[_0xa757('0x48')]},'raw':!![]})[_0xa757('0x1e')](function(_0x2367c7){if(_0x2367c7&&_0x2367c7[_0xa757('0x49')]===0x0){return db[_0xa757('0x21')][_0xa757('0x42')]({'name':_0x319988['name'],'resourceId':_0x319988['id'],'type':_0x2367c7[_0xa757('0x25')],'sectionId':_0x2367c7['id']},{})['then'](function(){return _0x57bf73;});}else{return _0x57bf73;}})[_0xa757('0x3f')](function(_0x311c25){logger[_0xa757('0x24')](_0xa757('0x4a'),_0x311c25);throw _0x311c25;});}return _0x57bf73;})['then'](respondWithResult(_0x151cc3,0xc9))[_0xa757('0x3f')](handleError(_0x151cc3,null));};exports[_0xa757('0x1d')]=function(_0x8614f9,_0x980e1){if(_0x8614f9['body']['id']){delete _0x8614f9[_0xa757('0x43')]['id'];}return db[_0xa757('0x28')][_0xa757('0x41')]({'where':{'id':_0x8614f9[_0xa757('0x40')]['id']}})[_0xa757('0x1e')](handleEntityNotFound(_0x980e1,null))[_0xa757('0x1e')](saveUpdates(_0x8614f9['body'],null))['then'](respondWithResult(_0x980e1,null))['catch'](handleError(_0x980e1,null));};exports['destroy']=function(_0x1d8742,_0x9b3779){return db[_0xa757('0x28')][_0xa757('0x41')]({'where':{'id':_0x1d8742[_0xa757('0x40')]['id']}})[_0xa757('0x1e')](handleEntityNotFound(_0x9b3779,null))['then'](removeEntity(_0x9b3779,null))[_0xa757('0x3f')](handleError(_0x9b3779,null));};exports[_0xa757('0x4b')]=function(_0x34e03f,_0x29b2f5,_0x48b578){return db[_0xa757('0x28')][_0xa757('0x4c')]({'where':{'id':_0x34e03f['params']['id']}})[_0xa757('0x1e')](handleEntityNotFound(_0x29b2f5,null))['then'](function(_0x211980){var _0x5d375c;var _0x51be6e={},_0x58633a={};_0x58633a['model']=_[_0xa757('0x2f')](db[_0xa757('0x4d')][_0xa757('0x29')]);_0x58633a[_0xa757('0x2e')]=_[_0xa757('0x2f')](_0x34e03f[_0xa757('0x2e')]);_0x58633a['filters']=_['intersection'](_0x58633a[_0xa757('0x2d')],_0x58633a[_0xa757('0x2e')]);_0x51be6e[_0xa757('0x32')]=_['intersection'](_0x58633a['model'],qs[_0xa757('0x33')](_0x34e03f[_0xa757('0x2e')][_0xa757('0x33')]));_0x51be6e[_0xa757('0x32')]=_0x51be6e[_0xa757('0x32')][_0xa757('0x34')]?_0x51be6e['attributes']:_0x58633a[_0xa757('0x2d')];if(!_0x34e03f[_0xa757('0x2e')][_0xa757('0x4e')](_0xa757('0x35'))){_0x51be6e[_0xa757('0x1a')]=qs[_0xa757('0x1a')](_0x34e03f[_0xa757('0x2e')][_0xa757('0x1a')]);_0x51be6e[_0xa757('0x17')]=qs[_0xa757('0x17')](_0x34e03f['query'][_0xa757('0x17')]);}_0x51be6e['order']=qs['sort'](_0x34e03f[_0xa757('0x2e')][_0xa757('0x37')]);_0x51be6e[_0xa757('0x38')]=qs[_0xa757('0x30')](_[_0xa757('0x39')](_0x34e03f[_0xa757('0x2e')],_0x58633a[_0xa757('0x30')]));if(_0x34e03f[_0xa757('0x2e')][_0xa757('0x3a')]){_0x51be6e[_0xa757('0x38')]=_[_0xa757('0x3b')](_0x51be6e['where'],{'$or':_[_0xa757('0x27')](_0x51be6e[_0xa757('0x32')],function(_0x5f0b71){var _0x11ebb3={};_0x11ebb3[_0x5f0b71]={'$like':'%'+_0x34e03f[_0xa757('0x2e')][_0xa757('0x3a')]+'%'};return _0x11ebb3;})});}_0x51be6e[_0xa757('0x38')]=_[_0xa757('0x3b')](_0x51be6e[_0xa757('0x38')],{'mailboxuser':_0x211980['mailbox']});_0x51be6e=_[_0xa757('0x3b')]({},_0x51be6e,_0x34e03f['options']);return db[_0xa757('0x4d')][_0xa757('0x4f')](_0x51be6e)[_0xa757('0x1e')](respondWithFilteredResult(_0x29b2f5,_0x51be6e));})[_0xa757('0x3f')](handleError(_0x29b2f5,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 09f0e27..1219e78 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 _0xac96=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMail.attributes','exports','VoiceMail','voice_voicemail','mailbox_context','mailbox','context'];(function(_0x48fbe8,_0x428f05){var _0x2f025e=function(_0x37f78c){while(--_0x37f78c){_0x48fbe8['push'](_0x48fbe8['shift']());}};_0x2f025e(++_0x428f05);}(_0xac96,0x150));var _0x6ac9=function(_0x105e94,_0x4f8753){_0x105e94=_0x105e94-0x0;var _0x2c8a5f=_0xac96[_0x105e94];return _0x2c8a5f;};'use strict';var _=require(_0x6ac9('0x0'));var util=require(_0x6ac9('0x1'));var logger=require(_0x6ac9('0x2'))('api');var moment=require(_0x6ac9('0x3'));var BPromise=require(_0x6ac9('0x4'));var rp=require(_0x6ac9('0x5'));var fs=require('fs');var path=require(_0x6ac9('0x6'));var rimraf=require(_0x6ac9('0x7'));var config=require(_0x6ac9('0x8'));var attributes=require(_0x6ac9('0x9'));module[_0x6ac9('0xa')]=function(_0x51977f,_0x5b1027){return _0x51977f['define'](_0x6ac9('0xb'),attributes,{'tableName':_0x6ac9('0xc'),'paranoid':![],'indexes':[{'name':_0x6ac9('0xd'),'fields':[_0x6ac9('0xe'),_0x6ac9('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5b09=['mailbox_context','mailbox','context','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','VoiceMail','voice_voicemail'];(function(_0x207301,_0x235203){var _0x10be14=function(_0x203ac4){while(--_0x203ac4){_0x207301['push'](_0x207301['shift']());}};_0x10be14(++_0x235203);}(_0x5b09,0x1d3));var _0x95b0=function(_0x671422,_0x4e27c7){_0x671422=_0x671422-0x0;var _0x129938=_0x5b09[_0x671422];return _0x129938;};'use strict';var _=require(_0x95b0('0x0'));var util=require(_0x95b0('0x1'));var logger=require('../../config/logger')(_0x95b0('0x2'));var moment=require(_0x95b0('0x3'));var BPromise=require(_0x95b0('0x4'));var rp=require(_0x95b0('0x5'));var fs=require('fs');var path=require(_0x95b0('0x6'));var rimraf=require(_0x95b0('0x7'));var config=require(_0x95b0('0x8'));var attributes=require('./voiceMail.attributes');module[_0x95b0('0x9')]=function(_0x3a1a82,_0x505a06){return _0x3a1a82[_0x95b0('0xa')](_0x95b0('0xb'),attributes,{'tableName':_0x95b0('0xc'),'paranoid':![],'indexes':[{'name':_0x95b0('0xd'),'fields':[_0x95b0('0xe'),_0x95b0('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 64b8e9e..c5298f8 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 _0xf3c9=['jayson/promise','client','http','then','info','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','VoiceMail,\x20%s,\x20%s','message','result','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x28ade3,_0x3849b9){var _0x20ca87=function(_0x47515f){while(--_0x47515f){_0x28ade3['push'](_0x28ade3['shift']());}};_0x20ca87(++_0x3849b9);}(_0xf3c9,0x139));var _0x9f3c=function(_0x456ccf,_0x1158a9){_0x456ccf=_0x456ccf-0x0;var _0x146380=_0xf3c9[_0x456ccf];return _0x146380;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x9f3c('0x0'));var rs=require(_0x9f3c('0x1'));var fs=require('fs');var Redis=require(_0x9f3c('0x2'));var db=require(_0x9f3c('0x3'))['db'];var utils=require(_0x9f3c('0x4'));var logger=require(_0x9f3c('0x5'))(_0x9f3c('0x6'));var config=require('../../config/environment');var jayson=require(_0x9f3c('0x7'));var client=jayson[_0x9f3c('0x8')][_0x9f3c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x57e68b,_0xdaeef8,_0x1f7ee7){return new BPromise(function(_0x3e5b84,_0x3db8a1){return client['request'](_0x57e68b,_0x1f7ee7)[_0x9f3c('0xa')](function(_0x804e67){logger[_0x9f3c('0xb')]('VoiceMail,\x20%s,\x20%s',_0xdaeef8,_0x9f3c('0xc'));logger[_0x9f3c('0xd')](_0x9f3c('0xe'),_0xdaeef8,_0x9f3c('0xc'),JSON[_0x9f3c('0xf')](_0x804e67));if(_0x804e67[_0x9f3c('0x10')]){if(_0x804e67['error']['code']===0x1f4){logger[_0x9f3c('0x10')](_0x9f3c('0x11'),_0xdaeef8,_0x804e67[_0x9f3c('0x10')][_0x9f3c('0x12')]);return _0x3db8a1(_0x804e67[_0x9f3c('0x10')][_0x9f3c('0x12')]);}logger[_0x9f3c('0x10')](_0x9f3c('0x11'),_0xdaeef8,_0x804e67[_0x9f3c('0x10')][_0x9f3c('0x12')]);return _0x3e5b84(_0x804e67[_0x9f3c('0x10')][_0x9f3c('0x12')]);}else{logger[_0x9f3c('0xb')](_0x9f3c('0x11'),_0xdaeef8,'request\x20sent');_0x3e5b84(_0x804e67[_0x9f3c('0x13')][_0x9f3c('0x12')]);}})['catch'](function(_0x10e40a){logger[_0x9f3c('0x10')](_0x9f3c('0x11'),_0xdaeef8,_0x10e40a);_0x3db8a1(_0x10e40a);});});} \ No newline at end of file +var _0x0df7=['debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','moment','ioredis','../../mysqldb','rpc','jayson/promise','http','then','VoiceMail,\x20%s,\x20%s','request\x20sent'];(function(_0x179000,_0x214f27){var _0xbdf0d=function(_0x58f2ac){while(--_0x58f2ac){_0x179000['push'](_0x179000['shift']());}};_0xbdf0d(++_0x214f27);}(_0x0df7,0xec));var _0x70df=function(_0x36d9ac,_0x314606){_0x36d9ac=_0x36d9ac-0x0;var _0x281977=_0x0df7[_0x36d9ac];return _0x281977;};'use strict';var _=require(_0x70df('0x0'));var util=require(_0x70df('0x1'));var moment=require(_0x70df('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x70df('0x3'));var db=require(_0x70df('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x70df('0x5'));var config=require('../../config/environment');var jayson=require(_0x70df('0x6'));var client=jayson['client'][_0x70df('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x285694,_0x5aab71,_0x1f1a68){return new BPromise(function(_0x47c04e,_0x13cb23){return client['request'](_0x285694,_0x1f1a68)[_0x70df('0x8')](function(_0x37709c){logger['info'](_0x70df('0x9'),_0x5aab71,_0x70df('0xa'));logger[_0x70df('0xb')](_0x70df('0xc'),_0x5aab71,_0x70df('0xa'),JSON[_0x70df('0xd')](_0x37709c));if(_0x37709c[_0x70df('0xe')]){if(_0x37709c[_0x70df('0xe')]['code']===0x1f4){logger['error'](_0x70df('0x9'),_0x5aab71,_0x37709c[_0x70df('0xe')]['message']);return _0x13cb23(_0x37709c[_0x70df('0xe')][_0x70df('0xf')]);}logger['error']('VoiceMail,\x20%s,\x20%s',_0x5aab71,_0x37709c[_0x70df('0xe')][_0x70df('0xf')]);return _0x47c04e(_0x37709c[_0x70df('0xe')]['message']);}else{logger[_0x70df('0x10')](_0x70df('0x9'),_0x5aab71,_0x70df('0xa'));_0x47c04e(_0x37709c[_0x70df('0x11')][_0x70df('0xf')]);}})[_0x70df('0x12')](function(_0x415b4e){logger[_0x70df('0xe')](_0x70df('0x9'),_0x5aab71,_0x415b4e);_0x13cb23(_0x415b4e);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 1b22236..6b071d3 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 _0x0fb9=['/:id/download','post','create','put','update','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','index','/:id','show'];(function(_0x40c2af,_0x3a4efa){var _0x2aa6bb=function(_0xa0c3b2){while(--_0xa0c3b2){_0x40c2af['push'](_0x40c2af['shift']());}};_0x2aa6bb(++_0x3a4efa);}(_0x0fb9,0xb7));var _0x90fb=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x0fb9[_0x4565bf];return _0x5610ba;};'use strict';var multer=require(_0x90fb('0x0'));var util=require('util');var path=require(_0x90fb('0x1'));var timeout=require(_0x90fb('0x2'));var express=require(_0x90fb('0x3'));var router=express[_0x90fb('0x4')]();var fs_extra=require(_0x90fb('0x5'));var auth=require(_0x90fb('0x6'));var interaction=require(_0x90fb('0x7'));var config=require(_0x90fb('0x8'));var controller=require(_0x90fb('0x9'));router[_0x90fb('0xa')]('/',auth[_0x90fb('0xb')](),controller[_0x90fb('0xc')]);router['get'](_0x90fb('0xd'),auth[_0x90fb('0xb')](),controller[_0x90fb('0xe')]);router[_0x90fb('0xa')](_0x90fb('0xf'),auth[_0x90fb('0xb')](),controller['download']);router[_0x90fb('0x10')]('/',auth['isAuthenticated'](),controller[_0x90fb('0x11')]);router[_0x90fb('0x12')](_0x90fb('0xd'),auth[_0x90fb('0xb')](),controller[_0x90fb('0x13')]);router[_0x90fb('0x14')]('/:id',auth[_0x90fb('0xb')](),controller['destroy']);module[_0x90fb('0x15')]=router; \ No newline at end of file +var _0xb159=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','index','/:id/download','post','create','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x49f30e,_0xf28439){var _0x2cafd5=function(_0x581d4c){while(--_0x581d4c){_0x49f30e['push'](_0x49f30e['shift']());}};_0x2cafd5(++_0xf28439);}(_0xb159,0x174));var _0x9b15=function(_0x47d2f9,_0x27b6d7){_0x47d2f9=_0x47d2f9-0x0;var _0x59f02b=_0xb159[_0x47d2f9];return _0x59f02b;};'use strict';var multer=require(_0x9b15('0x0'));var util=require('util');var path=require(_0x9b15('0x1'));var timeout=require(_0x9b15('0x2'));var express=require(_0x9b15('0x3'));var router=express[_0x9b15('0x4')]();var fs_extra=require(_0x9b15('0x5'));var auth=require(_0x9b15('0x6'));var interaction=require(_0x9b15('0x7'));var config=require(_0x9b15('0x8'));var controller=require(_0x9b15('0x9'));router[_0x9b15('0xa')]('/',auth[_0x9b15('0xb')](),controller[_0x9b15('0xc')]);router[_0x9b15('0xa')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x9b15('0xa')](_0x9b15('0xd'),auth[_0x9b15('0xb')](),controller['download']);router[_0x9b15('0xe')]('/',auth[_0x9b15('0xb')](),controller[_0x9b15('0xf')]);router['put'](_0x9b15('0x10'),auth[_0x9b15('0xb')](),controller[_0x9b15('0x11')]);router[_0x9b15('0x12')](_0x9b15('0x10'),auth[_0x9b15('0xb')](),controller[_0x9b15('0x13')]);module[_0x9b15('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index a2c0870..0958339 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 _0xd8aa=['sequelize','exports','VIRTUAL','getDataValue','INTEGER','STRING','BLOB','long','TIMESTAMP','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP'];(function(_0xe2794,_0x42caa5){var _0x578b5e=function(_0x3df5dd){while(--_0x3df5dd){_0xe2794['push'](_0xe2794['shift']());}};_0x578b5e(++_0x42caa5);}(_0xd8aa,0xd2));var _0xad8a=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8aa[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0xad8a('0x0'));module[_0xad8a('0x1')]={'name':{'type':Sequelize[_0xad8a('0x2')],'get':function(_0x32136a){return this[_0xad8a('0x3')]('id');}},'msgnum':{'type':Sequelize[_0xad8a('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xad8a('0x5')],'defaultValue':''},'context':{'type':Sequelize[_0xad8a('0x5')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xad8a('0x5')],'defaultValue':''},'callerid':{'type':Sequelize[_0xad8a('0x5')],'defaultValue':''},'origtime':{'type':Sequelize[_0xad8a('0x5')],'defaultValue':''},'duration':{'type':Sequelize[_0xad8a('0x5')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xad8a('0x5')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xad8a('0x5')],'defaultValue':''},'recording':{'type':Sequelize[_0xad8a('0x6')](_0xad8a('0x7')),'defaultValue':null},'flag':{'type':Sequelize[_0xad8a('0x5')],'defaultValue':''},'msg_id':{'type':Sequelize[_0xad8a('0x5')],'defaultValue':''},'stamp':{'type':_0xad8a('0x8'),'defaultValue':Sequelize['literal'](_0xad8a('0x9'))}}; \ No newline at end of file +var _0xf271=['CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','getDataValue','INTEGER','STRING','BLOB','long','TIMESTAMP','literal'];(function(_0x2836ef,_0x27d12d){var _0x40b686=function(_0x482ce0){while(--_0x482ce0){_0x2836ef['push'](_0x2836ef['shift']());}};_0x40b686(++_0x27d12d);}(_0xf271,0x191));var _0x1f27=function(_0xe4989c,_0x215994){_0xe4989c=_0xe4989c-0x0;var _0x952d3=_0xf271[_0xe4989c];return _0x952d3;};'use strict';var Sequelize=require(_0x1f27('0x0'));module[_0x1f27('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x2f3378){return this[_0x1f27('0x2')]('id');}},'msgnum':{'type':Sequelize[_0x1f27('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x1f27('0x4')],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x1f27('0x4')],'defaultValue':''},'callerid':{'type':Sequelize[_0x1f27('0x4')],'defaultValue':''},'origtime':{'type':Sequelize[_0x1f27('0x4')],'defaultValue':''},'duration':{'type':Sequelize[_0x1f27('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x1f27('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x1f27('0x4')],'defaultValue':''},'recording':{'type':Sequelize[_0x1f27('0x5')](_0x1f27('0x6')),'defaultValue':null},'flag':{'type':Sequelize[_0x1f27('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x1f27('0x4')],'defaultValue':''},'stamp':{'type':_0x1f27('0x7'),'defaultValue':Sequelize[_0x1f27('0x8')](_0x1f27('0x9'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index b51c4d6..761632d 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 _0x9b86=['filter','merge','options','include','then','rows','catch','show','params','keys','rawAttributes','intersection','includeAll','find','create','body','download','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','recording','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','name','send','index','map','VoiceMailMessage','fieldName','type','model','differenceBy','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x1e05d2,_0x253abc){var _0x1094af=function(_0x38093c){while(--_0x38093c){_0x1e05d2['push'](_0x1e05d2['shift']());}};_0x1094af(++_0x253abc);}(_0x9b86,0x15f));var _0x69b8=function(_0x2140e5,_0x1f84b5){_0x2140e5=_0x2140e5-0x0;var _0x1444d4=_0x9b86[_0x2140e5];return _0x1444d4;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x69b8('0x0'));var jsonpatch=require(_0x69b8('0x1'));var rp=require('request-promise');var moment=require(_0x69b8('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x69b8('0x3'));var util=require('util');var path=require(_0x69b8('0x4'));var sox=require(_0x69b8('0x5'));var csv=require(_0x69b8('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x69b8('0x7'));var _=require('lodash');var squel=require(_0x69b8('0x8'));var crypto=require(_0x69b8('0x9'));var jsforce=require(_0x69b8('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x69b8('0x6'));var querystring=require(_0x69b8('0xb'));var Papa=require(_0x69b8('0xc'));var Redis=require(_0x69b8('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x69b8('0xe'));var as=require(_0x69b8('0xf'));var hardwareService=require(_0x69b8('0x10'));var logger=require(_0x69b8('0x11'))(_0x69b8('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x69b8('0x13'))['db'];function respondWithStatusCode(_0x5b7cdb,_0x2d76d2){_0x2d76d2=_0x2d76d2||0xcc;return function(_0x41210d){if(_0x41210d){return _0x5b7cdb[_0x69b8('0x14')](_0x2d76d2);}return _0x5b7cdb[_0x69b8('0x15')](_0x2d76d2)[_0x69b8('0x16')]();};}function respondWithResult(_0x11c950,_0x3a8766){_0x3a8766=_0x3a8766||0xc8;return function(_0x273d86){if(_0x273d86){return _0x11c950[_0x69b8('0x15')](_0x3a8766)[_0x69b8('0x17')](_0x273d86);}};}function respondWithFilteredResult(_0x443197,_0x190cf4){return function(_0x34686c){if(_0x34686c){var _0x4b5f17=typeof _0x190cf4[_0x69b8('0x18')]===_0x69b8('0x19')&&typeof _0x190cf4[_0x69b8('0x1a')]==='undefined';var _0x38858d=_0x34686c[_0x69b8('0x1b')];var _0x5b741f=_0x4b5f17?0x0:_0x190cf4['offset'];var _0x410a46=_0x4b5f17?_0x34686c[_0x69b8('0x1b')]:_0x190cf4['offset']+_0x190cf4['limit'];var _0x27a412;if(_0x410a46>=_0x38858d){_0x410a46=_0x38858d;_0x27a412=0xc8;}else{_0x27a412=0xce;}_0x443197['status'](_0x27a412);return _0x443197[_0x69b8('0x1c')](_0x69b8('0x1d'),_0x5b741f+'-'+_0x410a46+'/'+_0x38858d)[_0x69b8('0x17')](_0x34686c);}return null;};}function patchUpdates(_0x361d73){return function(_0x480a20){try{jsonpatch['apply'](_0x480a20,_0x361d73,!![]);}catch(_0x44c9fb){return BPromise[_0x69b8('0x1e')](_0x44c9fb);}return _0x480a20[_0x69b8('0x1f')]();};}function saveUpdates(_0x2715b1,_0x83da9e){return function(_0x4c42fe){if(_0x4c42fe){return _0x4c42fe[_0x69b8('0x20')](_0x2715b1)['then'](function(_0x4b04bb){return _0x4b04bb;});}return null;};}function removeEntity(_0x1d71d7,_0xfe5fb6){return function(_0x180ba2){if(_0x180ba2){return _0x180ba2[_0x69b8('0x21')]()['then'](function(){_0x1d71d7[_0x69b8('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x27c741,_0x5e4243){return function(_0x407bf1){if(!_0x407bf1){_0x27c741[_0x69b8('0x14')](0x194);}return _0x407bf1;};}function handleError(_0x55bedc,_0x558f7a){_0x558f7a=_0x558f7a||0x1f4;return function(_0x478919){logger['error'](_0x478919['stack']);if(_0x478919['name']){delete _0x478919[_0x69b8('0x22')];}_0x55bedc[_0x69b8('0x15')](_0x558f7a)[_0x69b8('0x23')](_0x478919);};}exports[_0x69b8('0x24')]=function(_0x2bc6fc,_0x176269){var _0x570ed2={},_0xdc084f={},_0x4585cc={'count':0x0,'rows':[]};var _0x18ac52=_[_0x69b8('0x25')](db[_0x69b8('0x26')]['rawAttributes'],function(_0x149bcc){return{'name':_0x149bcc[_0x69b8('0x27')],'type':_0x149bcc[_0x69b8('0x28')]['key']};});_0xdc084f[_0x69b8('0x29')]=_[_0x69b8('0x2a')](_['map'](_0x18ac52,_0x69b8('0x22')),[_0x69b8('0x22')]);_0xdc084f['query']=_['keys'](_0x2bc6fc[_0x69b8('0x2b')]);_0xdc084f[_0x69b8('0x2c')]=_['intersection'](_0xdc084f[_0x69b8('0x29')],_0xdc084f[_0x69b8('0x2b')]);_0x570ed2[_0x69b8('0x2d')]=_['intersection'](_0xdc084f[_0x69b8('0x29')],qs['fields'](_0x2bc6fc[_0x69b8('0x2b')][_0x69b8('0x2e')]));_0x570ed2['attributes']=_0x570ed2[_0x69b8('0x2d')][_0x69b8('0x2f')]?_0x570ed2[_0x69b8('0x2d')]:_0xdc084f[_0x69b8('0x29')];if(!_0x2bc6fc[_0x69b8('0x2b')][_0x69b8('0x30')](_0x69b8('0x31'))){_0x570ed2[_0x69b8('0x1a')]=qs[_0x69b8('0x1a')](_0x2bc6fc[_0x69b8('0x2b')]['limit']);_0x570ed2[_0x69b8('0x18')]=qs[_0x69b8('0x18')](_0x2bc6fc[_0x69b8('0x2b')]['offset']);}_0x570ed2[_0x69b8('0x32')]=qs[_0x69b8('0x33')](_0x2bc6fc['query'][_0x69b8('0x33')]);_0x570ed2[_0x69b8('0x34')]=qs[_0x69b8('0x2c')](_[_0x69b8('0x35')](_0x2bc6fc[_0x69b8('0x2b')],_0xdc084f[_0x69b8('0x2c')]),_0x18ac52);if(_0x2bc6fc[_0x69b8('0x2b')][_0x69b8('0x36')]){_0x570ed2[_0x69b8('0x34')]=_['merge'](_0x570ed2['where'],{'$or':_[_0x69b8('0x25')](_0x18ac52,function(_0xe7b4bb){if(_0xe7b4bb['type']!=='VIRTUAL'){var _0x1669f5={};_0x1669f5[_0xe7b4bb[_0x69b8('0x22')]]={'$like':'%'+_0x2bc6fc[_0x69b8('0x2b')][_0x69b8('0x36')]+'%'};return _0x1669f5;}})});}_0x570ed2=_[_0x69b8('0x37')]({},_0x570ed2,_0x2bc6fc[_0x69b8('0x38')]);var _0x305903={'where':_0x570ed2[_0x69b8('0x34')]};return db[_0x69b8('0x26')][_0x69b8('0x1b')](_0x305903)['then'](function(_0x1ba15a){_0x4585cc[_0x69b8('0x1b')]=_0x1ba15a;if(_0x2bc6fc['query']['includeAll']){_0x570ed2[_0x69b8('0x39')]=[{'all':!![]}];}return db[_0x69b8('0x26')]['findAll'](_0x570ed2);})[_0x69b8('0x3a')](function(_0x52c3e2){_0x4585cc[_0x69b8('0x3b')]=_0x52c3e2;return _0x4585cc;})[_0x69b8('0x3a')](respondWithFilteredResult(_0x176269,_0x570ed2))[_0x69b8('0x3c')](handleError(_0x176269,null));};exports[_0x69b8('0x3d')]=function(_0x46dead,_0x1c23df){var _0x487ccc={'raw':!![],'where':{'id':_0x46dead[_0x69b8('0x3e')]['id']}},_0x147801={};_0x147801['model']=_[_0x69b8('0x3f')](db[_0x69b8('0x26')][_0x69b8('0x40')]);_0x147801[_0x69b8('0x2b')]=_[_0x69b8('0x3f')](_0x46dead[_0x69b8('0x2b')]);_0x147801[_0x69b8('0x2c')]=_[_0x69b8('0x41')](_0x147801[_0x69b8('0x29')],_0x147801['query']);_0x487ccc[_0x69b8('0x2d')]=_[_0x69b8('0x41')](_0x147801[_0x69b8('0x29')],qs['fields'](_0x46dead[_0x69b8('0x2b')]['fields']));_0x487ccc['attributes']=_0x487ccc[_0x69b8('0x2d')][_0x69b8('0x2f')]?_0x487ccc['attributes']:_0x147801['model'];if(_0x46dead[_0x69b8('0x2b')][_0x69b8('0x42')]){_0x487ccc[_0x69b8('0x39')]=[{'all':!![]}];}_0x487ccc=_[_0x69b8('0x37')]({},_0x487ccc,_0x46dead[_0x69b8('0x38')]);return db['VoiceMailMessage'][_0x69b8('0x43')](_0x487ccc)['then'](handleEntityNotFound(_0x1c23df,null))[_0x69b8('0x3a')](respondWithResult(_0x1c23df,null))[_0x69b8('0x3c')](handleError(_0x1c23df,null));};exports[_0x69b8('0x44')]=function(_0x322c15,_0x5e8115){return db['VoiceMailMessage'][_0x69b8('0x44')](_0x322c15['body'],{})[_0x69b8('0x3a')](respondWithResult(_0x5e8115,0xc9))[_0x69b8('0x3c')](handleError(_0x5e8115,null));};exports['update']=function(_0x181a2c,_0x384478){if(_0x181a2c[_0x69b8('0x45')]['id']){delete _0x181a2c['body']['id'];}return db['VoiceMailMessage']['find']({'where':{'id':_0x181a2c[_0x69b8('0x3e')]['id']}})[_0x69b8('0x3a')](handleEntityNotFound(_0x384478,null))['then'](saveUpdates(_0x181a2c['body'],null))[_0x69b8('0x3a')](respondWithResult(_0x384478,null))[_0x69b8('0x3c')](handleError(_0x384478,null));};exports['destroy']=function(_0x4e4c90,_0x3f82ae){return db['VoiceMailMessage']['find']({'where':{'id':_0x4e4c90[_0x69b8('0x3e')]['id']}})[_0x69b8('0x3a')](handleEntityNotFound(_0x3f82ae,null))[_0x69b8('0x3a')](removeEntity(_0x3f82ae,null))[_0x69b8('0x3c')](handleError(_0x3f82ae,null));};exports[_0x69b8('0x46')]=function(_0x332d7e,_0x4bc54e,_0x2b9cbd){return db[_0x69b8('0x26')]['find']({'where':{'id':_0x332d7e[_0x69b8('0x3e')]['id']},'attributes':['id','recording',_0x69b8('0x47')]})[_0x69b8('0x3a')](handleEntityNotFound(_0x4bc54e,null))[_0x69b8('0x3a')](function(_0x2229b2){if(_0x2229b2){if(!_0x2229b2['recording']){throw new db[(_0x69b8('0x48'))][(_0x69b8('0x49'))](_0x69b8('0x4a'));}var _0xf415aa={'Content-Type':_0x69b8('0x4b'),'Content-Disposition':_0x69b8('0x4c')};if(_0x2229b2['msg_id']){_0xf415aa[_0x69b8('0x4d')]=_0x69b8('0x4e')+_0x2229b2[_0x69b8('0x47')]+_0x69b8('0x4f');}_0x4bc54e['set'](_0xf415aa);return _0x4bc54e[_0x69b8('0x23')](new Buffer(_0x2229b2[_0x69b8('0x50')]));}})[_0x69b8('0x3c')](handleError(_0x4bc54e,null));}; \ No newline at end of file +var _0x556a=['send','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','name','map','rawAttributes','type','key','model','differenceBy','query','intersection','attributes','fields','length','hasOwnProperty','sort','where','filters','pick','filter','VIRTUAL','merge','options','VoiceMailMessage','include','findAll','catch','show','params','keys','includeAll','create','body','find','destroy','download','recording','Sequelize','VoiceMailMessage\x20not\x20found','audio/wav','attachment','msg_id','Content-Disposition'];(function(_0x19632c,_0x4c22e2){var _0x5225ea=function(_0x27a5ab){while(--_0x27a5ab){_0x19632c['push'](_0x19632c['shift']());}};_0x5225ea(++_0x4c22e2);}(_0x556a,0x1d5));var _0xa556=function(_0x262af0,_0x41301a){_0x262af0=_0x262af0-0x0;var _0x18413e=_0x556a[_0x262af0];return _0x18413e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa556('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa556('0x1'));var rp=require(_0xa556('0x2'));var moment=require(_0xa556('0x3'));var BPromise=require(_0xa556('0x4'));var Mustache=require(_0xa556('0x5'));var util=require(_0xa556('0x6'));var path=require(_0xa556('0x7'));var sox=require(_0xa556('0x8'));var csv=require(_0xa556('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa556('0xa'));var _=require('lodash');var squel=require(_0xa556('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa556('0x9'));var querystring=require(_0xa556('0xc'));var Papa=require(_0xa556('0xd'));var Redis=require(_0xa556('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa556('0xf'));var logger=require(_0xa556('0x10'))(_0xa556('0x11'));var utils=require(_0xa556('0x12'));var config=require(_0xa556('0x13'));var licenseUtil=require(_0xa556('0x14'));var db=require(_0xa556('0x15'))['db'];function respondWithStatusCode(_0x39c75f,_0x2586de){_0x2586de=_0x2586de||0xcc;return function(_0x46b2b0){if(_0x46b2b0){return _0x39c75f[_0xa556('0x16')](_0x2586de);}return _0x39c75f[_0xa556('0x17')](_0x2586de)[_0xa556('0x18')]();};}function respondWithResult(_0x2fd92b,_0x557e58){_0x557e58=_0x557e58||0xc8;return function(_0x27c098){if(_0x27c098){return _0x2fd92b['status'](_0x557e58)[_0xa556('0x19')](_0x27c098);}};}function respondWithFilteredResult(_0x2cb0c7,_0x5431a6){return function(_0x5d8d93){if(_0x5d8d93){var _0x2a0310=typeof _0x5431a6[_0xa556('0x1a')]===_0xa556('0x1b')&&typeof _0x5431a6[_0xa556('0x1c')]===_0xa556('0x1b');var _0x590063=_0x5d8d93[_0xa556('0x1d')];var _0x819684=_0x2a0310?0x0:_0x5431a6[_0xa556('0x1a')];var _0x45aba3=_0x2a0310?_0x5d8d93[_0xa556('0x1d')]:_0x5431a6[_0xa556('0x1a')]+_0x5431a6['limit'];var _0x438094;if(_0x45aba3>=_0x590063){_0x45aba3=_0x590063;_0x438094=0xc8;}else{_0x438094=0xce;}_0x2cb0c7[_0xa556('0x17')](_0x438094);return _0x2cb0c7[_0xa556('0x1e')](_0xa556('0x1f'),_0x819684+'-'+_0x45aba3+'/'+_0x590063)['json'](_0x5d8d93);}return null;};}function patchUpdates(_0x4c039e){return function(_0x5e4271){try{jsonpatch[_0xa556('0x20')](_0x5e4271,_0x4c039e,!![]);}catch(_0x37967b){return BPromise[_0xa556('0x21')](_0x37967b);}return _0x5e4271[_0xa556('0x22')]();};}function saveUpdates(_0xdfc5b7,_0x4d77f6){return function(_0x333e35){if(_0x333e35){return _0x333e35['update'](_0xdfc5b7)['then'](function(_0x30e84b){return _0x30e84b;});}return null;};}function removeEntity(_0x1f4c65,_0x5e5e69){return function(_0x2df9ee){if(_0x2df9ee){return _0x2df9ee['destroy']()[_0xa556('0x23')](function(){_0x1f4c65['status'](0xcc)[_0xa556('0x18')]();});}};}function handleEntityNotFound(_0x445ef1,_0x9a2b23){return function(_0x3b1061){if(!_0x3b1061){_0x445ef1[_0xa556('0x16')](0x194);}return _0x3b1061;};}function handleError(_0x32ec43,_0x5d0777){_0x5d0777=_0x5d0777||0x1f4;return function(_0x8b24ee){logger['error'](_0x8b24ee['stack']);if(_0x8b24ee[_0xa556('0x24')]){delete _0x8b24ee[_0xa556('0x24')];}_0x32ec43[_0xa556('0x17')](_0x5d0777)['send'](_0x8b24ee);};}exports['index']=function(_0x40f342,_0x236779){var _0x38631b={},_0x20dbfb={},_0x1bf186={'count':0x0,'rows':[]};var _0x177002=_[_0xa556('0x25')](db['VoiceMailMessage'][_0xa556('0x26')],function(_0x35d32f){return{'name':_0x35d32f['fieldName'],'type':_0x35d32f[_0xa556('0x27')][_0xa556('0x28')]};});_0x20dbfb[_0xa556('0x29')]=_[_0xa556('0x2a')](_[_0xa556('0x25')](_0x177002,_0xa556('0x24')),[_0xa556('0x24')]);_0x20dbfb[_0xa556('0x2b')]=_['keys'](_0x40f342['query']);_0x20dbfb['filters']=_[_0xa556('0x2c')](_0x20dbfb[_0xa556('0x29')],_0x20dbfb[_0xa556('0x2b')]);_0x38631b[_0xa556('0x2d')]=_[_0xa556('0x2c')](_0x20dbfb[_0xa556('0x29')],qs[_0xa556('0x2e')](_0x40f342[_0xa556('0x2b')][_0xa556('0x2e')]));_0x38631b[_0xa556('0x2d')]=_0x38631b[_0xa556('0x2d')][_0xa556('0x2f')]?_0x38631b[_0xa556('0x2d')]:_0x20dbfb[_0xa556('0x29')];if(!_0x40f342[_0xa556('0x2b')][_0xa556('0x30')]('nolimit')){_0x38631b['limit']=qs[_0xa556('0x1c')](_0x40f342[_0xa556('0x2b')]['limit']);_0x38631b[_0xa556('0x1a')]=qs[_0xa556('0x1a')](_0x40f342[_0xa556('0x2b')][_0xa556('0x1a')]);}_0x38631b['order']=qs[_0xa556('0x31')](_0x40f342[_0xa556('0x2b')][_0xa556('0x31')]);_0x38631b[_0xa556('0x32')]=qs[_0xa556('0x33')](_[_0xa556('0x34')](_0x40f342[_0xa556('0x2b')],_0x20dbfb[_0xa556('0x33')]),_0x177002);if(_0x40f342['query'][_0xa556('0x35')]){_0x38631b[_0xa556('0x32')]=_['merge'](_0x38631b[_0xa556('0x32')],{'$or':_[_0xa556('0x25')](_0x177002,function(_0x224523){if(_0x224523[_0xa556('0x27')]!==_0xa556('0x36')){var _0x35bd75={};_0x35bd75[_0x224523[_0xa556('0x24')]]={'$like':'%'+_0x40f342['query'][_0xa556('0x35')]+'%'};return _0x35bd75;}})});}_0x38631b=_[_0xa556('0x37')]({},_0x38631b,_0x40f342[_0xa556('0x38')]);var _0x12cdec={'where':_0x38631b['where']};return db[_0xa556('0x39')][_0xa556('0x1d')](_0x12cdec)[_0xa556('0x23')](function(_0x5ec4c6){_0x1bf186[_0xa556('0x1d')]=_0x5ec4c6;if(_0x40f342['query']['includeAll']){_0x38631b[_0xa556('0x3a')]=[{'all':!![]}];}return db[_0xa556('0x39')][_0xa556('0x3b')](_0x38631b);})[_0xa556('0x23')](function(_0x21614b){_0x1bf186['rows']=_0x21614b;return _0x1bf186;})[_0xa556('0x23')](respondWithFilteredResult(_0x236779,_0x38631b))[_0xa556('0x3c')](handleError(_0x236779,null));};exports[_0xa556('0x3d')]=function(_0x4fddd0,_0x12f213){var _0x361f33={'raw':!![],'where':{'id':_0x4fddd0[_0xa556('0x3e')]['id']}},_0x463bb7={};_0x463bb7[_0xa556('0x29')]=_['keys'](db['VoiceMailMessage'][_0xa556('0x26')]);_0x463bb7[_0xa556('0x2b')]=_[_0xa556('0x3f')](_0x4fddd0['query']);_0x463bb7['filters']=_[_0xa556('0x2c')](_0x463bb7[_0xa556('0x29')],_0x463bb7[_0xa556('0x2b')]);_0x361f33[_0xa556('0x2d')]=_[_0xa556('0x2c')](_0x463bb7[_0xa556('0x29')],qs[_0xa556('0x2e')](_0x4fddd0[_0xa556('0x2b')][_0xa556('0x2e')]));_0x361f33['attributes']=_0x361f33[_0xa556('0x2d')][_0xa556('0x2f')]?_0x361f33[_0xa556('0x2d')]:_0x463bb7['model'];if(_0x4fddd0[_0xa556('0x2b')][_0xa556('0x40')]){_0x361f33[_0xa556('0x3a')]=[{'all':!![]}];}_0x361f33=_[_0xa556('0x37')]({},_0x361f33,_0x4fddd0[_0xa556('0x38')]);return db[_0xa556('0x39')]['find'](_0x361f33)[_0xa556('0x23')](handleEntityNotFound(_0x12f213,null))[_0xa556('0x23')](respondWithResult(_0x12f213,null))[_0xa556('0x3c')](handleError(_0x12f213,null));};exports[_0xa556('0x41')]=function(_0x2b2e6c,_0x54e366){return db[_0xa556('0x39')][_0xa556('0x41')](_0x2b2e6c[_0xa556('0x42')],{})[_0xa556('0x23')](respondWithResult(_0x54e366,0xc9))[_0xa556('0x3c')](handleError(_0x54e366,null));};exports['update']=function(_0xebe223,_0x29a72d){if(_0xebe223['body']['id']){delete _0xebe223[_0xa556('0x42')]['id'];}return db['VoiceMailMessage'][_0xa556('0x43')]({'where':{'id':_0xebe223[_0xa556('0x3e')]['id']}})[_0xa556('0x23')](handleEntityNotFound(_0x29a72d,null))[_0xa556('0x23')](saveUpdates(_0xebe223[_0xa556('0x42')],null))[_0xa556('0x23')](respondWithResult(_0x29a72d,null))[_0xa556('0x3c')](handleError(_0x29a72d,null));};exports[_0xa556('0x44')]=function(_0x2b1592,_0x4d222d){return db[_0xa556('0x39')][_0xa556('0x43')]({'where':{'id':_0x2b1592[_0xa556('0x3e')]['id']}})[_0xa556('0x23')](handleEntityNotFound(_0x4d222d,null))[_0xa556('0x23')](removeEntity(_0x4d222d,null))[_0xa556('0x3c')](handleError(_0x4d222d,null));};exports[_0xa556('0x45')]=function(_0x11b343,_0x1f1e90,_0x1651a3){return db[_0xa556('0x39')]['find']({'where':{'id':_0x11b343['params']['id']},'attributes':['id',_0xa556('0x46'),'msg_id']})['then'](handleEntityNotFound(_0x1f1e90,null))[_0xa556('0x23')](function(_0x24995a){if(_0x24995a){if(!_0x24995a['recording']){throw new db[(_0xa556('0x47'))]['ValidationError'](_0xa556('0x48'));}var _0x384428={'Content-Type':_0xa556('0x49'),'Content-Disposition':_0xa556('0x4a')};if(_0x24995a[_0xa556('0x4b')]){_0x384428[_0xa556('0x4c')]='attachment;\x20filename=\x22'+_0x24995a[_0xa556('0x4b')]+'.wav\x22';}_0x1f1e90[_0xa556('0x1e')](_0x384428);return _0x1f1e90[_0xa556('0x4d')](new Buffer(_0x24995a[_0xa556('0x46')]));}})[_0xa556('0x3c')](handleError(_0x1f1e90,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 29b15d8..4a1acd7 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 _0xb744=['voice_voicemail_messages','dir','lodash','util','../../config/logger','api','bluebird','request-promise','path','exports','VoiceMailMessage'];(function(_0x23f101,_0x2c17b9){var _0x67a450=function(_0x16f1bd){while(--_0x16f1bd){_0x23f101['push'](_0x23f101['shift']());}};_0x67a450(++_0x2c17b9);}(_0xb744,0x10a));var _0x4b74=function(_0x3d1015,_0x513928){_0x3d1015=_0x3d1015-0x0;var _0x2b556f=_0xb744[_0x3d1015];return _0x2b556f;};'use strict';var _=require(_0x4b74('0x0'));var util=require(_0x4b74('0x1'));var logger=require(_0x4b74('0x2'))(_0x4b74('0x3'));var moment=require('moment');var BPromise=require(_0x4b74('0x4'));var rp=require(_0x4b74('0x5'));var fs=require('fs');var path=require(_0x4b74('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./voiceMailMessage.attributes');module[_0x4b74('0x7')]=function(_0x28964b,_0x5e1ceb){return _0x28964b['define'](_0x4b74('0x8'),attributes,{'tableName':_0x4b74('0x9'),'paranoid':![],'indexes':[{'name':'dir','fields':[_0x4b74('0xa')]}],'timestamps':![]});}; \ No newline at end of file +var _0x8444=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceMailMessage.attributes','exports','voice_voicemail_messages','dir','lodash'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x8444,0x185));var _0x4844=function(_0x275b85,_0x1a3f17){_0x275b85=_0x275b85-0x0;var _0x428ce5=_0x8444[_0x275b85];return _0x428ce5;};'use strict';var _=require(_0x4844('0x0'));var util=require(_0x4844('0x1'));var logger=require(_0x4844('0x2'))(_0x4844('0x3'));var moment=require(_0x4844('0x4'));var BPromise=require(_0x4844('0x5'));var rp=require(_0x4844('0x6'));var fs=require('fs');var path=require(_0x4844('0x7'));var rimraf=require(_0x4844('0x8'));var config=require('../../config/environment');var attributes=require(_0x4844('0x9'));module[_0x4844('0xa')]=function(_0x48e2fa,_0x4ab1be){return _0x48e2fa['define']('VoiceMailMessage',attributes,{'tableName':_0x4844('0xb'),'paranoid':![],'indexes':[{'name':_0x4844('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 f37a0cb..a82e5c0 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 _0x1a72=['VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent'];(function(_0x92a987,_0x4415b6){var _0x331f4c=function(_0x223e9d){while(--_0x223e9d){_0x92a987['push'](_0x92a987['shift']());}};_0x331f4c(++_0x4415b6);}(_0x1a72,0x1bc));var _0x21a7=function(_0xb277a7,_0x5653a4){_0xb277a7=_0xb277a7-0x0;var _0x571284=_0x1a72[_0xb277a7];return _0x571284;};'use strict';var _=require(_0x21a7('0x0'));var util=require(_0x21a7('0x1'));var moment=require(_0x21a7('0x2'));var BPromise=require(_0x21a7('0x3'));var rs=require(_0x21a7('0x4'));var fs=require('fs');var Redis=require(_0x21a7('0x5'));var db=require(_0x21a7('0x6'))['db'];var utils=require(_0x21a7('0x7'));var logger=require('../../config/logger')(_0x21a7('0x8'));var config=require(_0x21a7('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x21a7('0xa')][_0x21a7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x487c93,_0x2a7f46,_0x4be513){return new BPromise(function(_0x1891ec,_0x259044){return client[_0x21a7('0xc')](_0x487c93,_0x4be513)['then'](function(_0x362f86){logger[_0x21a7('0xd')](_0x21a7('0xe'),_0x2a7f46,_0x21a7('0xf'));logger['debug'](_0x21a7('0x10'),_0x2a7f46,_0x21a7('0xf'),JSON[_0x21a7('0x11')](_0x362f86));if(_0x362f86['error']){if(_0x362f86[_0x21a7('0x12')][_0x21a7('0x13')]===0x1f4){logger[_0x21a7('0x12')]('VoiceMailMessage,\x20%s,\x20%s',_0x2a7f46,_0x362f86[_0x21a7('0x12')][_0x21a7('0x14')]);return _0x259044(_0x362f86['error'][_0x21a7('0x14')]);}logger[_0x21a7('0x12')]('VoiceMailMessage,\x20%s,\x20%s',_0x2a7f46,_0x362f86[_0x21a7('0x12')][_0x21a7('0x14')]);return _0x1891ec(_0x362f86['error'][_0x21a7('0x14')]);}else{logger[_0x21a7('0xd')](_0x21a7('0xe'),_0x2a7f46,_0x21a7('0xf'));_0x1891ec(_0x362f86[_0x21a7('0x15')][_0x21a7('0x14')]);}})[_0x21a7('0x16')](function(_0x4ca59a){logger['error'](_0x21a7('0xe'),_0x2a7f46,_0x4ca59a);_0x259044(_0x4ca59a);});});} \ No newline at end of file +var _0x16ae=['result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','request','then','info','VoiceMailMessage,\x20%s,\x20%s','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message'];(function(_0x37a9d7,_0x2b6fde){var _0x1343d3=function(_0x3bde45){while(--_0x3bde45){_0x37a9d7['push'](_0x37a9d7['shift']());}};_0x1343d3(++_0x2b6fde);}(_0x16ae,0x1e6));var _0xe16a=function(_0x3d47f2,_0x180ece){_0x3d47f2=_0x3d47f2-0x0;var _0x481a6e=_0x16ae[_0x3d47f2];return _0x481a6e;};'use strict';var _=require(_0xe16a('0x0'));var util=require(_0xe16a('0x1'));var moment=require(_0xe16a('0x2'));var BPromise=require(_0xe16a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe16a('0x4'));var db=require(_0xe16a('0x5'))['db'];var utils=require(_0xe16a('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xe16a('0x7'));var client=jayson[_0xe16a('0x8')][_0xe16a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x33da64,_0x1ad78e,_0x2e3dd1){return new BPromise(function(_0x24e580,_0x320c0e){return client[_0xe16a('0xa')](_0x33da64,_0x2e3dd1)[_0xe16a('0xb')](function(_0x4c5691){logger[_0xe16a('0xc')](_0xe16a('0xd'),_0x1ad78e,'request\x20sent');logger[_0xe16a('0xe')](_0xe16a('0xf'),_0x1ad78e,_0xe16a('0x10'),JSON['stringify'](_0x4c5691));if(_0x4c5691['error']){if(_0x4c5691[_0xe16a('0x11')][_0xe16a('0x12')]===0x1f4){logger[_0xe16a('0x11')](_0xe16a('0xd'),_0x1ad78e,_0x4c5691[_0xe16a('0x11')][_0xe16a('0x13')]);return _0x320c0e(_0x4c5691[_0xe16a('0x11')][_0xe16a('0x13')]);}logger[_0xe16a('0x11')]('VoiceMailMessage,\x20%s,\x20%s',_0x1ad78e,_0x4c5691[_0xe16a('0x11')][_0xe16a('0x13')]);return _0x24e580(_0x4c5691[_0xe16a('0x11')][_0xe16a('0x13')]);}else{logger['info'](_0xe16a('0xd'),_0x1ad78e,_0xe16a('0x10'));_0x24e580(_0x4c5691[_0xe16a('0x14')]['message']);}})[_0xe16a('0x15')](function(_0x2a2bf7){logger['error']('VoiceMailMessage,\x20%s,\x20%s',_0x1ad78e,_0x2a2bf7);_0x320c0e(_0x2a2bf7);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index ea1df39..b30064b 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 _0x5504=['../../components/auth/service','get','isAuthenticated','index','/:id','/:id/sounds','getSounds','post','put','update','delete','destroy','/:id/sounds/:id2','removeSound','exports','multer','util','path','express','Router','fs-extra'];(function(_0x93c171,_0x2b3a4c){var _0x4970d9=function(_0x347849){while(--_0x347849){_0x93c171['push'](_0x93c171['shift']());}};_0x4970d9(++_0x2b3a4c);}(_0x5504,0x1dd));var _0x4550=function(_0x4b418f,_0x3b6a96){_0x4b418f=_0x4b418f-0x0;var _0x2ed208=_0x5504[_0x4b418f];return _0x2ed208;};'use strict';var multer=require(_0x4550('0x0'));var util=require(_0x4550('0x1'));var path=require(_0x4550('0x2'));var timeout=require('connect-timeout');var express=require(_0x4550('0x3'));var router=express[_0x4550('0x4')]();var fs_extra=require(_0x4550('0x5'));var auth=require(_0x4550('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./voiceMusicOnHold.controller');router[_0x4550('0x7')]('/',auth[_0x4550('0x8')](),controller[_0x4550('0x9')]);router['get'](_0x4550('0xa'),auth[_0x4550('0x8')](),controller['show']);router[_0x4550('0x7')](_0x4550('0xb'),auth[_0x4550('0x8')](),controller[_0x4550('0xc')]);router[_0x4550('0xd')]('/',auth[_0x4550('0x8')](),controller['create']);router[_0x4550('0xd')](_0x4550('0xb'),auth[_0x4550('0x8')](),controller['addSound']);router[_0x4550('0xe')](_0x4550('0xa'),auth[_0x4550('0x8')](),controller[_0x4550('0xf')]);router[_0x4550('0x10')](_0x4550('0xa'),auth[_0x4550('0x8')](),controller[_0x4550('0x11')]);router[_0x4550('0x10')](_0x4550('0x12'),auth[_0x4550('0x8')](),controller[_0x4550('0x13')]);module[_0x4550('0x14')]=router; \ No newline at end of file +var _0xae90=['post','create','/:id/sounds','addSound','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','index','isAuthenticated','getSounds'];(function(_0x43df6f,_0x5f5dd8){var _0x31b6b9=function(_0x5ec359){while(--_0x5ec359){_0x43df6f['push'](_0x43df6f['shift']());}};_0x31b6b9(++_0x5f5dd8);}(_0xae90,0x1c1));var _0x0ae9=function(_0x16660e,_0x3bee28){_0x16660e=_0x16660e-0x0;var _0x6978b8=_0xae90[_0x16660e];return _0x6978b8;};'use strict';var multer=require(_0x0ae9('0x0'));var util=require(_0x0ae9('0x1'));var path=require(_0x0ae9('0x2'));var timeout=require(_0x0ae9('0x3'));var express=require(_0x0ae9('0x4'));var router=express['Router']();var fs_extra=require(_0x0ae9('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0ae9('0x6'));var config=require(_0x0ae9('0x7'));var controller=require(_0x0ae9('0x8'));router[_0x0ae9('0x9')]('/',auth['isAuthenticated'](),controller[_0x0ae9('0xa')]);router[_0x0ae9('0x9')]('/:id',auth[_0x0ae9('0xb')](),controller['show']);router['get']('/:id/sounds',auth['isAuthenticated'](),controller[_0x0ae9('0xc')]);router[_0x0ae9('0xd')]('/',auth['isAuthenticated'](),controller[_0x0ae9('0xe')]);router['post'](_0x0ae9('0xf'),auth[_0x0ae9('0xb')](),controller[_0x0ae9('0x10')]);router['put'](_0x0ae9('0x11'),auth[_0x0ae9('0xb')](),controller[_0x0ae9('0x12')]);router[_0x0ae9('0x13')]('/:id',auth[_0x0ae9('0xb')](),controller[_0x0ae9('0x14')]);router['delete']('/:id/sounds/:id2',auth[_0x0ae9('0xb')](),controller['removeSound']);module[_0x0ae9('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index da651af..c9b0763 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 _0x6dd5=['name','ENUM','custom','files','mp3nb','quietmp3nb','quietmp3','mp3','alpha','BOOLEAN','sequelize','STRING'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x6dd5,0x1ea));var _0x56dd=function(_0x323419,_0xde889f){_0x323419=_0x323419-0x0;var _0xff8f74=_0x6dd5[_0x323419];return _0xff8f74;};'use strict';var Sequelize=require(_0x56dd('0x0'));module['exports']={'name':{'type':Sequelize[_0x56dd('0x1')],'allowNull':![],'unique':_0x56dd('0x2')},'mode':{'type':Sequelize[_0x56dd('0x3')](_0x56dd('0x4'),_0x56dd('0x5'),_0x56dd('0x6'),_0x56dd('0x7'),_0x56dd('0x8'),_0x56dd('0x9')),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize[_0x56dd('0x1')],'allowNull':!![]},'digit':{'type':Sequelize[_0x56dd('0x1')],'allowNull':!![]},'sort':{'type':Sequelize[_0x56dd('0x1')],'allowNull':!![],'defaultValue':_0x56dd('0xa')},'format':{'type':Sequelize[_0x56dd('0x1')],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize[_0x56dd('0xb')],'defaultValue':0x0}}; \ No newline at end of file +var _0x1f06=['files','mp3nb','quietmp3nb','quietmp3','mp3','alpha','TIMESTAMP','sequelize','exports','STRING','name'];(function(_0x93d3a7,_0x204287){var _0x45656a=function(_0x1c4667){while(--_0x1c4667){_0x93d3a7['push'](_0x93d3a7['shift']());}};_0x45656a(++_0x204287);}(_0x1f06,0xe3));var _0x61f0=function(_0x54c935,_0x1dee96){_0x54c935=_0x54c935-0x0;var _0x17963c=_0x1f06[_0x54c935];return _0x17963c;};'use strict';var Sequelize=require(_0x61f0('0x0'));module[_0x61f0('0x1')]={'name':{'type':Sequelize[_0x61f0('0x2')],'allowNull':![],'unique':_0x61f0('0x3')},'mode':{'type':Sequelize['ENUM']('custom',_0x61f0('0x4'),_0x61f0('0x5'),_0x61f0('0x6'),_0x61f0('0x7'),_0x61f0('0x8')),'allowNull':!![],'defaultValue':_0x61f0('0x4')},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize[_0x61f0('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0x61f0('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0x61f0('0x2')],'allowNull':!![],'defaultValue':_0x61f0('0x9')},'format':{'type':Sequelize[_0x61f0('0x2')],'allowNull':!![]},'stamp':{'type':_0x61f0('0xa')},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js index 8f16cdd..97015b0 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 _0xe021=['MusicOnHolds','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','unlinkSync','rmdirSync','Sequelize','ValidationError','addSound','Sound','findOne','save_name','converted_format','server/files/sounds/converted','format','%s.%s','extname','join','server/files/moh','message','removeSound','id2','getSounds','sort','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','then','get','UserProfileResource','error','stack','name','send','index','map','VoiceMusicOnHold','rawAttributes','fieldName','type','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','pick','merge','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','keys','includeAll','find','update','body','create','sequelize','transaction','mode','files','root','mkdirSync','directory','0777','Unable\x20to\x20retrieve\x20the\x20current\x20user','role'];(function(_0x5b9b6,_0x26aa24){var _0x2b498f=function(_0x1592ff){while(--_0x1592ff){_0x5b9b6['push'](_0x5b9b6['shift']());}};_0x2b498f(++_0x26aa24);}(_0xe021,0xfb));var _0x1e02=function(_0x25a5be,_0x326c29){_0x25a5be=_0x25a5be-0x0;var _0x5b6141=_0xe021[_0x25a5be];return _0x5b6141;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1e02('0x0'));var zipdir=require(_0x1e02('0x1'));var jsonpatch=require(_0x1e02('0x2'));var rp=require('request-promise');var moment=require(_0x1e02('0x3'));var BPromise=require(_0x1e02('0x4'));var Mustache=require(_0x1e02('0x5'));var util=require(_0x1e02('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x1e02('0x7'));var ejs=require(_0x1e02('0x8'));var fs=require('fs');var fs_extra=require(_0x1e02('0x9'));var _=require(_0x1e02('0xa'));var squel=require(_0x1e02('0xb'));var crypto=require(_0x1e02('0xc'));var jsforce=require(_0x1e02('0xd'));var deskjs=require(_0x1e02('0xe'));var toCsv=require('to-csv');var querystring=require(_0x1e02('0xf'));var Papa=require(_0x1e02('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1e02('0x11'));var hardwareService=require(_0x1e02('0x12'));var logger=require(_0x1e02('0x13'))(_0x1e02('0x14'));var utils=require('../../config/utils');var config=require(_0x1e02('0x15'));var licenseUtil=require(_0x1e02('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2c1edc,_0x3a3129){_0x3a3129=_0x3a3129||0xcc;return function(_0x1d1d66){if(_0x1d1d66){return _0x2c1edc[_0x1e02('0x17')](_0x3a3129);}return _0x2c1edc[_0x1e02('0x18')](_0x3a3129)[_0x1e02('0x19')]();};}function respondWithResult(_0x23c56a,_0x208658){_0x208658=_0x208658||0xc8;return function(_0x1b22f3){if(_0x1b22f3){return _0x23c56a['status'](_0x208658)[_0x1e02('0x1a')](_0x1b22f3);}};}function respondWithFilteredResult(_0x557c94,_0x11c442){return function(_0x3c80ad){if(_0x3c80ad){var _0x31ada9=typeof _0x11c442[_0x1e02('0x1b')]===_0x1e02('0x1c')&&typeof _0x11c442[_0x1e02('0x1d')]===_0x1e02('0x1c');var _0x5c169d=_0x3c80ad['count'];var _0x2e64d8=_0x31ada9?0x0:_0x11c442[_0x1e02('0x1b')];var _0x3b46e0=_0x31ada9?_0x3c80ad[_0x1e02('0x1e')]:_0x11c442[_0x1e02('0x1b')]+_0x11c442['limit'];var _0xfe0ef;if(_0x3b46e0>=_0x5c169d){_0x3b46e0=_0x5c169d;_0xfe0ef=0xc8;}else{_0xfe0ef=0xce;}_0x557c94[_0x1e02('0x18')](_0xfe0ef);return _0x557c94[_0x1e02('0x1f')](_0x1e02('0x20'),_0x2e64d8+'-'+_0x3b46e0+'/'+_0x5c169d)[_0x1e02('0x1a')](_0x3c80ad);}return null;};}function patchUpdates(_0xf384a9){return function(_0x796fc0){try{jsonpatch[_0x1e02('0x21')](_0x796fc0,_0xf384a9,!![]);}catch(_0x1989a5){return BPromise[_0x1e02('0x22')](_0x1989a5);}return _0x796fc0[_0x1e02('0x23')]();};}function saveUpdates(_0x430ce9,_0x5b6587){return function(_0x30a680){if(_0x30a680){return _0x30a680['update'](_0x430ce9)['then'](function(_0x330a5f){return _0x330a5f;});}return null;};}function removeEntity(_0x5b0fa1,_0x8e20d8){return function(_0x49c976){if(_0x49c976){return _0x49c976[_0x1e02('0x24')]()[_0x1e02('0x25')](function(){var _0x10fe76=_0x49c976[_0x1e02('0x26')]({'plain':!![]});var _0xde7f6c='MusicOnHolds';return db[_0x1e02('0x27')][_0x1e02('0x24')]({'where':{'type':_0xde7f6c,'resourceId':_0x10fe76['id']}})['then'](function(){return _0x49c976;});})[_0x1e02('0x25')](function(){_0x5b0fa1['status'](0xcc)[_0x1e02('0x19')]();});}};}function handleEntityNotFound(_0x5e420c,_0x34e6e0){return function(_0x5d4d72){if(!_0x5d4d72){_0x5e420c[_0x1e02('0x17')](0x194);}return _0x5d4d72;};}function handleError(_0x4ef47f,_0x4d047c){_0x4d047c=_0x4d047c||0x1f4;return function(_0x553dda){logger[_0x1e02('0x28')](_0x553dda[_0x1e02('0x29')]);if(_0x553dda[_0x1e02('0x2a')]){delete _0x553dda[_0x1e02('0x2a')];}_0x4ef47f['status'](_0x4d047c)[_0x1e02('0x2b')](_0x553dda);};}exports[_0x1e02('0x2c')]=function(_0x223d5e,_0x13015e){var _0x36e9d9={},_0x583e37={},_0x1cdc44={'count':0x0,'rows':[]};var _0x4afbf9=_[_0x1e02('0x2d')](db[_0x1e02('0x2e')][_0x1e02('0x2f')],function(_0x10c9db){return{'name':_0x10c9db[_0x1e02('0x30')],'type':_0x10c9db[_0x1e02('0x31')]['key']};});_0x583e37[_0x1e02('0x32')]=_[_0x1e02('0x2d')](_0x4afbf9,_0x1e02('0x2a'));_0x583e37['query']=_['keys'](_0x223d5e[_0x1e02('0x33')]);_0x583e37[_0x1e02('0x34')]=_[_0x1e02('0x35')](_0x583e37['model'],_0x583e37[_0x1e02('0x33')]);_0x36e9d9['attributes']=_[_0x1e02('0x35')](_0x583e37[_0x1e02('0x32')],qs[_0x1e02('0x36')](_0x223d5e[_0x1e02('0x33')][_0x1e02('0x36')]));_0x36e9d9['attributes']=_0x36e9d9[_0x1e02('0x37')][_0x1e02('0x38')]?_0x36e9d9[_0x1e02('0x37')]:_0x583e37[_0x1e02('0x32')];if(!_0x223d5e[_0x1e02('0x33')][_0x1e02('0x39')](_0x1e02('0x3a'))){_0x36e9d9[_0x1e02('0x1d')]=qs[_0x1e02('0x1d')](_0x223d5e[_0x1e02('0x33')][_0x1e02('0x1d')]);_0x36e9d9[_0x1e02('0x1b')]=qs[_0x1e02('0x1b')](_0x223d5e[_0x1e02('0x33')][_0x1e02('0x1b')]);}_0x36e9d9[_0x1e02('0x3b')]=qs['sort'](_0x223d5e[_0x1e02('0x33')]['sort']);delete _0x223d5e['query']['sort'];_0x36e9d9[_0x1e02('0x3c')]=qs[_0x1e02('0x34')](_[_0x1e02('0x3d')](_0x223d5e[_0x1e02('0x33')],_0x583e37[_0x1e02('0x34')]),_0x4afbf9);if(_0x223d5e[_0x1e02('0x33')]['filter']){_0x36e9d9['where']=_[_0x1e02('0x3e')](_0x36e9d9[_0x1e02('0x3c')],{'$or':_['map'](_0x4afbf9,function(_0x5ecc01){if(_0x5ecc01[_0x1e02('0x31')]!==_0x1e02('0x3f')){var _0x3a97e3={};_0x3a97e3[_0x5ecc01[_0x1e02('0x2a')]]={'$like':'%'+_0x223d5e[_0x1e02('0x33')][_0x1e02('0x40')]+'%'};return _0x3a97e3;}})});}_0x36e9d9=_[_0x1e02('0x3e')]({},_0x36e9d9,_0x223d5e[_0x1e02('0x41')]);var _0x10f888={'where':_0x36e9d9[_0x1e02('0x3c')]};return db[_0x1e02('0x2e')][_0x1e02('0x1e')](_0x10f888)[_0x1e02('0x25')](function(_0x4e8c58){_0x1cdc44[_0x1e02('0x1e')]=_0x4e8c58;if(_0x223d5e[_0x1e02('0x33')]['includeAll']){_0x36e9d9[_0x1e02('0x42')]=[{'all':!![]}];}return db['VoiceMusicOnHold'][_0x1e02('0x43')](_0x36e9d9);})[_0x1e02('0x25')](function(_0x1391ab){_0x1cdc44[_0x1e02('0x44')]=_0x1391ab;return _0x1cdc44;})[_0x1e02('0x25')](respondWithFilteredResult(_0x13015e,_0x36e9d9))[_0x1e02('0x45')](handleError(_0x13015e,null));};exports[_0x1e02('0x46')]=function(_0x1153a2,_0x4eff00){var _0x423fe2={'raw':![],'where':{'id':_0x1153a2[_0x1e02('0x47')]['id']}},_0x4af4b7={};_0x4af4b7['model']=_[_0x1e02('0x48')](db[_0x1e02('0x2e')][_0x1e02('0x2f')]);_0x4af4b7[_0x1e02('0x33')]=_[_0x1e02('0x48')](_0x1153a2[_0x1e02('0x33')]);_0x4af4b7[_0x1e02('0x34')]=_[_0x1e02('0x35')](_0x4af4b7[_0x1e02('0x32')],_0x4af4b7[_0x1e02('0x33')]);_0x423fe2[_0x1e02('0x37')]=_[_0x1e02('0x35')](_0x4af4b7[_0x1e02('0x32')],qs['fields'](_0x1153a2['query'][_0x1e02('0x36')]));_0x423fe2[_0x1e02('0x37')]=_0x423fe2[_0x1e02('0x37')][_0x1e02('0x38')]?_0x423fe2[_0x1e02('0x37')]:_0x4af4b7[_0x1e02('0x32')];if(_0x1153a2[_0x1e02('0x33')][_0x1e02('0x49')]){_0x423fe2[_0x1e02('0x42')]=[{'all':!![]}];}_0x423fe2=_[_0x1e02('0x3e')]({},_0x423fe2,_0x1153a2[_0x1e02('0x41')]);return db['VoiceMusicOnHold'][_0x1e02('0x4a')](_0x423fe2)[_0x1e02('0x25')](handleEntityNotFound(_0x4eff00,null))[_0x1e02('0x25')](respondWithResult(_0x4eff00,null))[_0x1e02('0x45')](handleError(_0x4eff00,null));};exports[_0x1e02('0x4b')]=function(_0x45fbf8,_0x18436b){if(_0x45fbf8[_0x1e02('0x4c')]['id']){delete _0x45fbf8[_0x1e02('0x4c')]['id'];}return db[_0x1e02('0x2e')]['find']({'where':{'id':_0x45fbf8[_0x1e02('0x47')]['id']}})['then'](handleEntityNotFound(_0x18436b,null))[_0x1e02('0x25')](saveUpdates(_0x45fbf8[_0x1e02('0x4c')],null))[_0x1e02('0x25')](respondWithResult(_0x18436b,null))[_0x1e02('0x45')](handleError(_0x18436b,null));};exports[_0x1e02('0x4d')]=function(_0x4ceff3,_0x485f69,_0xd38f7f){return db[_0x1e02('0x4e')][_0x1e02('0x4f')](function(_0x44a8d4){if(_0x4ceff3['body'][_0x1e02('0x50')]===_0x1e02('0x51')){_0x4ceff3['body']['directory']=path['join'](config[_0x1e02('0x52')],'server/files/moh',_0x4ceff3[_0x1e02('0x4c')][_0x1e02('0x2a')]);}return db[_0x1e02('0x2e')][_0x1e02('0x4d')](_0x4ceff3[_0x1e02('0x4c')],{'transaction':_0x44a8d4})[_0x1e02('0x25')](function(_0x4e27ff){if(_0x4ceff3[_0x1e02('0x4c')][_0x1e02('0x50')]===_0x1e02('0x51')){fs[_0x1e02('0x53')](_0x4e27ff[_0x1e02('0x54')],parseInt(_0x1e02('0x55'),0x8));}var _0x33b7f0=_0x4ceff3['user'][_0x1e02('0x26')]({'plain':!![]});if(!_0x33b7f0)throw new Error(_0x1e02('0x56'));if(_0x33b7f0[_0x1e02('0x57')]==='user'){var _0x5a3ab0=_0x4e27ff['get']({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0x1e02('0x58'),'userProfileId':_0x33b7f0['userProfileId']},'raw':!![]})[_0x1e02('0x25')](function(_0x5eed81){if(_0x5eed81&&_0x5eed81[_0x1e02('0x59')]===0x0){return db['UserProfileResource'][_0x1e02('0x4d')]({'name':_0x5a3ab0[_0x1e02('0x2a')],'resourceId':_0x5a3ab0['id'],'type':_0x5eed81[_0x1e02('0x2a')],'sectionId':_0x5eed81['id']},{})[_0x1e02('0x25')](function(){return _0x4e27ff;});}else{return _0x4e27ff;}})[_0x1e02('0x45')](function(_0x279d18){logger['error'](_0x1e02('0x5a'),_0x279d18);});}return _0x4e27ff;});})[_0x1e02('0x25')](respondWithResult(_0x485f69,0xc9))[_0x1e02('0x45')](handleError(_0x485f69,null));};exports[_0x1e02('0x24')]=function(_0x28afaa,_0x5308d4,_0x53a498){var _0x5e3e75;return db['VoiceMusicOnHold'][_0x1e02('0x4a')]({'where':{'id':_0x28afaa['params']['id']}})[_0x1e02('0x25')](function(_0x2128f2){if(_0x2128f2){return db['sequelize']['transaction'](function(_0x2567b7){return _0x2128f2[_0x1e02('0x24')]({'transaction':_0x2567b7,'raw':!![]})['then'](function(_0x6ecb11){if(_0x6ecb11['directory']){fs[_0x1e02('0x5b')](_0x6ecb11['directory'])[_0x1e02('0x5c')](function(_0x533b73){fs[_0x1e02('0x5d')](path['join'](_0x6ecb11[_0x1e02('0x54')],_0x533b73));});fs[_0x1e02('0x5e')](_0x6ecb11[_0x1e02('0x54')]);}return _0x6ecb11;});})[_0x1e02('0x45')](function(_0x5831e9){throw new db[(_0x1e02('0x5f'))][(_0x1e02('0x60'))](_0x5831e9['message']);});}})['then'](handleEntityNotFound(_0x5308d4,null))['then'](removeEntity(_0x5308d4,null))[_0x1e02('0x45')](handleError(_0x5308d4,null));};exports[_0x1e02('0x61')]=function(_0x5900ea,_0x37e802,_0x2a4a23){return db[_0x1e02('0x4e')][_0x1e02('0x4f')](function(_0x1f6e3b){var _0x34efe6;return db[_0x1e02('0x2e')][_0x1e02('0x4a')]({'where':{'id':_0x5900ea[_0x1e02('0x47')]['id']}})[_0x1e02('0x25')](function(_0x3c4fb4){if(_0x3c4fb4){_0x34efe6=_0x3c4fb4;return _0x3c4fb4[_0x1e02('0x61')](_0x5900ea[_0x1e02('0x4c')]['id'],{'transaction':_0x1f6e3b});}})[_0x1e02('0x25')](function(_0x2de2ff){if(_0x2de2ff){return db[_0x1e02('0x62')][_0x1e02('0x63')]({'where':{'id':_0x5900ea[_0x1e02('0x4c')]['id']},'attributes':['id',_0x1e02('0x2a'),_0x1e02('0x64'),_0x1e02('0x65'),'createdAt'],'raw':!![]});}})[_0x1e02('0x25')](function(_0x5f184f){if(_0x5f184f){var _0x26dcf=path['join'](config['root'],_0x1e02('0x66'),util[_0x1e02('0x67')](_0x1e02('0x68'),path['basename'](_0x5f184f['save_name'],path[_0x1e02('0x69')](_0x5f184f['save_name'])),_0x5f184f[_0x1e02('0x65')]));var _0x511e86=path[_0x1e02('0x6a')](config[_0x1e02('0x52')],_0x1e02('0x6b'),_0x34efe6[_0x1e02('0x2a')],util[_0x1e02('0x67')](_0x1e02('0x68'),_0x5f184f['name'],_0x5f184f[_0x1e02('0x65')]));fs['symlinkSync'](_0x26dcf,_0x511e86);return _0x5f184f;}})[_0x1e02('0x45')](function(_0x38d1df){throw new db[(_0x1e02('0x5f'))]['ValidationError'](_0x38d1df[_0x1e02('0x6c')]);});})[_0x1e02('0x25')](handleEntityNotFound(_0x37e802,null))[_0x1e02('0x25')](respondWithResult(_0x37e802,0xc9))[_0x1e02('0x45')](handleError(_0x37e802,null));};exports[_0x1e02('0x6d')]=function(_0x5bc628,_0x1b7526,_0x20bb8e){return db[_0x1e02('0x4e')][_0x1e02('0x4f')](function(_0x2228af){var _0x40d68c;return db[_0x1e02('0x2e')][_0x1e02('0x63')]({'where':{'id':_0x5bc628[_0x1e02('0x47')]['id']}})[_0x1e02('0x25')](handleEntityNotFound(_0x1b7526,null))[_0x1e02('0x25')](function(_0x4de6a0){if(_0x4de6a0){_0x40d68c=_0x4de6a0;return _0x4de6a0[_0x1e02('0x6d')](_0x5bc628['params']['id2']);}})[_0x1e02('0x25')](function(_0x54674b){if(_0x54674b){return db[_0x1e02('0x62')][_0x1e02('0x63')]({'where':{'id':_0x5bc628[_0x1e02('0x47')][_0x1e02('0x6e')]},'attributes':['id',_0x1e02('0x2a'),_0x1e02('0x64'),'converted_format','createdAt'],'raw':!![]});}})['then'](function(_0x409a24){if(_0x409a24){fs[_0x1e02('0x5d')](path[_0x1e02('0x6a')](_0x40d68c['directory'],util[_0x1e02('0x67')](_0x1e02('0x68'),_0x409a24[_0x1e02('0x2a')],_0x409a24[_0x1e02('0x65')])));return _0x409a24;}})[_0x1e02('0x45')](function(_0x467eb6){throw new db[(_0x1e02('0x5f'))][(_0x1e02('0x60'))](_0x467eb6[_0x1e02('0x6c')]);});})['then'](handleEntityNotFound(_0x1b7526,null))[_0x1e02('0x25')](respondWithStatusCode(_0x1b7526,0xcc))[_0x1e02('0x45')](handleError(_0x1b7526,null));};exports[_0x1e02('0x6f')]=function(_0x69656c,_0x106c28,_0xa13d1d){var _0x3a1e58={};var _0x3126ba={};var _0x4d2556;var _0x113570;return db[_0x1e02('0x2e')][_0x1e02('0x63')]({'where':{'id':_0x69656c[_0x1e02('0x47')]['id']}})['then'](handleEntityNotFound(_0x106c28,null))['then'](function(_0x43f384){if(_0x43f384){_0x4d2556=_0x43f384;_0x3126ba[_0x1e02('0x32')]=_[_0x1e02('0x48')](db['Sound']['rawAttributes']);_0x3126ba[_0x1e02('0x33')]=_[_0x1e02('0x48')](_0x69656c[_0x1e02('0x33')]);_0x3126ba['filters']=_[_0x1e02('0x35')](_0x3126ba[_0x1e02('0x32')],_0x3126ba[_0x1e02('0x33')]);_0x3a1e58[_0x1e02('0x37')]=_[_0x1e02('0x35')](_0x3126ba[_0x1e02('0x32')],qs[_0x1e02('0x36')](_0x69656c[_0x1e02('0x33')][_0x1e02('0x36')]));_0x3a1e58[_0x1e02('0x37')]=_0x3a1e58[_0x1e02('0x37')][_0x1e02('0x38')]?_0x3a1e58[_0x1e02('0x37')]:_0x3126ba[_0x1e02('0x32')];_0x3a1e58[_0x1e02('0x3b')]=qs['sort'](_0x69656c['query'][_0x1e02('0x70')]);_0x3a1e58[_0x1e02('0x3c')]=qs['filters'](_[_0x1e02('0x3d')](_0x69656c[_0x1e02('0x33')],_0x3126ba['filters']));if(_0x69656c['query'][_0x1e02('0x40')]){_0x3a1e58[_0x1e02('0x3c')]=_[_0x1e02('0x3e')](_0x3a1e58[_0x1e02('0x3c')],{'$or':_[_0x1e02('0x2d')](_0x3a1e58[_0x1e02('0x37')],function(_0x707058){var _0x4e6228={};_0x4e6228[_0x707058]={'$like':'%'+_0x69656c['query'][_0x1e02('0x40')]+'%'};return _0x4e6228;})});}_0x3a1e58=_[_0x1e02('0x3e')]({},_0x3a1e58,_0x69656c[_0x1e02('0x41')]);return _0x4d2556[_0x1e02('0x6f')](_0x3a1e58);}})[_0x1e02('0x25')](function(_0x489828){if(_0x489828){_0x113570=_0x489828[_0x1e02('0x38')];if(!_0x69656c[_0x1e02('0x33')][_0x1e02('0x39')]('nolimit')){_0x3a1e58[_0x1e02('0x1d')]=qs[_0x1e02('0x1d')](_0x69656c[_0x1e02('0x33')][_0x1e02('0x1d')]);_0x3a1e58[_0x1e02('0x1b')]=qs['offset'](_0x69656c[_0x1e02('0x33')][_0x1e02('0x1b')]);}return _0x4d2556[_0x1e02('0x6f')](_0x3a1e58);}})[_0x1e02('0x25')](function(_0x4a1e7f){if(_0x4a1e7f){return _0x4a1e7f?{'count':_0x113570,'rows':_0x4a1e7f}:null;}})[_0x1e02('0x25')](respondWithResult(_0x106c28,null))[_0x1e02('0x45')](handleError(_0x106c28,null));}; \ No newline at end of file +var _0xc3c5=['format','%s.%s','basename','extname','converted_format','message','removeSound','id2','findOne','unlinkSync','getSounds','pick','eml-format','rimraf','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','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','update','then','get','MusicOnHolds','UserProfileResource','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','options','include','VoiceMusicOnHold','rows','catch','keys','body','find','params','create','mode','files','directory','join','root','server/files/moh','mkdirSync','0777','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','sequelize','transaction','readdirSync','forEach','rmdirSync','Sequelize','ValidationError','addSound','Sound','save_name','createdAt','server/files/sounds/converted'];(function(_0x1b943f,_0x6f6e83){var _0x8b7549=function(_0x5b52d3){while(--_0x5b52d3){_0x1b943f['push'](_0x1b943f['shift']());}};_0x8b7549(++_0x6f6e83);}(_0xc3c5,0x1dc));var _0x5c3c=function(_0xb2b11e,_0x9c66dd){_0xb2b11e=_0xb2b11e-0x0;var _0x4ffc76=_0xc3c5[_0xb2b11e];return _0x4ffc76;};'use strict';var emlformat=require(_0x5c3c('0x0'));var rimraf=require(_0x5c3c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5c3c('0x2'));var rp=require(_0x5c3c('0x3'));var moment=require(_0x5c3c('0x4'));var BPromise=require(_0x5c3c('0x5'));var Mustache=require(_0x5c3c('0x6'));var util=require(_0x5c3c('0x7'));var path=require(_0x5c3c('0x8'));var sox=require(_0x5c3c('0x9'));var csv=require('to-csv');var ejs=require(_0x5c3c('0xa'));var fs=require('fs');var fs_extra=require(_0x5c3c('0xb'));var _=require(_0x5c3c('0xc'));var squel=require(_0x5c3c('0xd'));var crypto=require(_0x5c3c('0xe'));var jsforce=require(_0x5c3c('0xf'));var deskjs=require(_0x5c3c('0x10'));var toCsv=require(_0x5c3c('0x11'));var querystring=require(_0x5c3c('0x12'));var Papa=require(_0x5c3c('0x13'));var Redis=require(_0x5c3c('0x14'));var authService=require(_0x5c3c('0x15'));var qs=require(_0x5c3c('0x16'));var as=require(_0x5c3c('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5c3c('0x18'));var utils=require(_0x5c3c('0x19'));var config=require(_0x5c3c('0x1a'));var licenseUtil=require(_0x5c3c('0x1b'));var db=require(_0x5c3c('0x1c'))['db'];function respondWithStatusCode(_0x4a360f,_0x3616d6){_0x3616d6=_0x3616d6||0xcc;return function(_0x3fbc30){if(_0x3fbc30){return _0x4a360f[_0x5c3c('0x1d')](_0x3616d6);}return _0x4a360f[_0x5c3c('0x1e')](_0x3616d6)[_0x5c3c('0x1f')]();};}function respondWithResult(_0x2cec6d,_0x7f46cd){_0x7f46cd=_0x7f46cd||0xc8;return function(_0x38bc38){if(_0x38bc38){return _0x2cec6d[_0x5c3c('0x1e')](_0x7f46cd)[_0x5c3c('0x20')](_0x38bc38);}};}function respondWithFilteredResult(_0x2a5132,_0x24eab1){return function(_0x1aff11){if(_0x1aff11){var _0x47f42a=typeof _0x24eab1['offset']===_0x5c3c('0x21')&&typeof _0x24eab1[_0x5c3c('0x22')]==='undefined';var _0x2fe2f5=_0x1aff11[_0x5c3c('0x23')];var _0x124e5d=_0x47f42a?0x0:_0x24eab1[_0x5c3c('0x24')];var _0x304004=_0x47f42a?_0x1aff11[_0x5c3c('0x23')]:_0x24eab1[_0x5c3c('0x24')]+_0x24eab1[_0x5c3c('0x22')];var _0x52fa73;if(_0x304004>=_0x2fe2f5){_0x304004=_0x2fe2f5;_0x52fa73=0xc8;}else{_0x52fa73=0xce;}_0x2a5132[_0x5c3c('0x1e')](_0x52fa73);return _0x2a5132[_0x5c3c('0x25')]('Content-Range',_0x124e5d+'-'+_0x304004+'/'+_0x2fe2f5)[_0x5c3c('0x20')](_0x1aff11);}return null;};}function patchUpdates(_0x47d786){return function(_0x65c249){try{jsonpatch[_0x5c3c('0x26')](_0x65c249,_0x47d786,!![]);}catch(_0x4f7cdf){return BPromise[_0x5c3c('0x27')](_0x4f7cdf);}return _0x65c249['save']();};}function saveUpdates(_0x5ea51a,_0x380f49){return function(_0x69de){if(_0x69de){return _0x69de[_0x5c3c('0x28')](_0x5ea51a)['then'](function(_0x4a7f9d){return _0x4a7f9d;});}return null;};}function removeEntity(_0x3d5c3a,_0x1636bc){return function(_0x3233b3){if(_0x3233b3){return _0x3233b3['destroy']()[_0x5c3c('0x29')](function(){var _0x72b610=_0x3233b3[_0x5c3c('0x2a')]({'plain':!![]});var _0x5d9dce=_0x5c3c('0x2b');return db[_0x5c3c('0x2c')][_0x5c3c('0x2d')]({'where':{'type':_0x5d9dce,'resourceId':_0x72b610['id']}})[_0x5c3c('0x29')](function(){return _0x3233b3;});})[_0x5c3c('0x29')](function(){_0x3d5c3a[_0x5c3c('0x1e')](0xcc)[_0x5c3c('0x1f')]();});}};}function handleEntityNotFound(_0x583426,_0x491e0b){return function(_0x11e007){if(!_0x11e007){_0x583426[_0x5c3c('0x1d')](0x194);}return _0x11e007;};}function handleError(_0x1cfefc,_0x5bc528){_0x5bc528=_0x5bc528||0x1f4;return function(_0x3e8517){logger[_0x5c3c('0x2e')](_0x3e8517[_0x5c3c('0x2f')]);if(_0x3e8517[_0x5c3c('0x30')]){delete _0x3e8517[_0x5c3c('0x30')];}_0x1cfefc[_0x5c3c('0x1e')](_0x5bc528)[_0x5c3c('0x31')](_0x3e8517);};}exports[_0x5c3c('0x32')]=function(_0x15d16a,_0x35c97c){var _0x50adbc={},_0x5d465e={},_0xc87509={'count':0x0,'rows':[]};var _0x1b01fa=_[_0x5c3c('0x33')](db['VoiceMusicOnHold'][_0x5c3c('0x34')],function(_0x5730d3){return{'name':_0x5730d3[_0x5c3c('0x35')],'type':_0x5730d3[_0x5c3c('0x36')]['key']};});_0x5d465e[_0x5c3c('0x37')]=_[_0x5c3c('0x33')](_0x1b01fa,_0x5c3c('0x30'));_0x5d465e[_0x5c3c('0x38')]=_['keys'](_0x15d16a[_0x5c3c('0x38')]);_0x5d465e['filters']=_[_0x5c3c('0x39')](_0x5d465e['model'],_0x5d465e[_0x5c3c('0x38')]);_0x50adbc[_0x5c3c('0x3a')]=_[_0x5c3c('0x39')](_0x5d465e['model'],qs[_0x5c3c('0x3b')](_0x15d16a[_0x5c3c('0x38')]['fields']));_0x50adbc['attributes']=_0x50adbc[_0x5c3c('0x3a')][_0x5c3c('0x3c')]?_0x50adbc[_0x5c3c('0x3a')]:_0x5d465e['model'];if(!_0x15d16a['query'][_0x5c3c('0x3d')](_0x5c3c('0x3e'))){_0x50adbc[_0x5c3c('0x22')]=qs['limit'](_0x15d16a[_0x5c3c('0x38')]['limit']);_0x50adbc[_0x5c3c('0x24')]=qs[_0x5c3c('0x24')](_0x15d16a[_0x5c3c('0x38')][_0x5c3c('0x24')]);}_0x50adbc[_0x5c3c('0x3f')]=qs['sort'](_0x15d16a[_0x5c3c('0x38')][_0x5c3c('0x40')]);delete _0x15d16a[_0x5c3c('0x38')][_0x5c3c('0x40')];_0x50adbc[_0x5c3c('0x41')]=qs[_0x5c3c('0x42')](_['pick'](_0x15d16a[_0x5c3c('0x38')],_0x5d465e['filters']),_0x1b01fa);if(_0x15d16a[_0x5c3c('0x38')][_0x5c3c('0x43')]){_0x50adbc['where']=_[_0x5c3c('0x44')](_0x50adbc[_0x5c3c('0x41')],{'$or':_['map'](_0x1b01fa,function(_0x3a8e9c){if(_0x3a8e9c[_0x5c3c('0x36')]!=='VIRTUAL'){var _0x1e9154={};_0x1e9154[_0x3a8e9c['name']]={'$like':'%'+_0x15d16a[_0x5c3c('0x38')][_0x5c3c('0x43')]+'%'};return _0x1e9154;}})});}_0x50adbc=_[_0x5c3c('0x44')]({},_0x50adbc,_0x15d16a[_0x5c3c('0x45')]);var _0x547842={'where':_0x50adbc['where']};return db['VoiceMusicOnHold']['count'](_0x547842)[_0x5c3c('0x29')](function(_0x3a798c){_0xc87509['count']=_0x3a798c;if(_0x15d16a[_0x5c3c('0x38')]['includeAll']){_0x50adbc[_0x5c3c('0x46')]=[{'all':!![]}];}return db[_0x5c3c('0x47')]['findAll'](_0x50adbc);})[_0x5c3c('0x29')](function(_0x37b4f2){_0xc87509[_0x5c3c('0x48')]=_0x37b4f2;return _0xc87509;})[_0x5c3c('0x29')](respondWithFilteredResult(_0x35c97c,_0x50adbc))[_0x5c3c('0x49')](handleError(_0x35c97c,null));};exports['show']=function(_0x4c4eb0,_0x53c41d){var _0x224837={'raw':![],'where':{'id':_0x4c4eb0['params']['id']}},_0x36d106={};_0x36d106[_0x5c3c('0x37')]=_[_0x5c3c('0x4a')](db[_0x5c3c('0x47')][_0x5c3c('0x34')]);_0x36d106[_0x5c3c('0x38')]=_['keys'](_0x4c4eb0[_0x5c3c('0x38')]);_0x36d106[_0x5c3c('0x42')]=_['intersection'](_0x36d106[_0x5c3c('0x37')],_0x36d106[_0x5c3c('0x38')]);_0x224837[_0x5c3c('0x3a')]=_['intersection'](_0x36d106[_0x5c3c('0x37')],qs[_0x5c3c('0x3b')](_0x4c4eb0[_0x5c3c('0x38')][_0x5c3c('0x3b')]));_0x224837[_0x5c3c('0x3a')]=_0x224837[_0x5c3c('0x3a')][_0x5c3c('0x3c')]?_0x224837[_0x5c3c('0x3a')]:_0x36d106[_0x5c3c('0x37')];if(_0x4c4eb0['query']['includeAll']){_0x224837[_0x5c3c('0x46')]=[{'all':!![]}];}_0x224837=_[_0x5c3c('0x44')]({},_0x224837,_0x4c4eb0[_0x5c3c('0x45')]);return db[_0x5c3c('0x47')]['find'](_0x224837)[_0x5c3c('0x29')](handleEntityNotFound(_0x53c41d,null))[_0x5c3c('0x29')](respondWithResult(_0x53c41d,null))[_0x5c3c('0x49')](handleError(_0x53c41d,null));};exports[_0x5c3c('0x28')]=function(_0x824684,_0x168a3b){if(_0x824684[_0x5c3c('0x4b')]['id']){delete _0x824684[_0x5c3c('0x4b')]['id'];}return db['VoiceMusicOnHold'][_0x5c3c('0x4c')]({'where':{'id':_0x824684[_0x5c3c('0x4d')]['id']}})[_0x5c3c('0x29')](handleEntityNotFound(_0x168a3b,null))[_0x5c3c('0x29')](saveUpdates(_0x824684['body'],null))[_0x5c3c('0x29')](respondWithResult(_0x168a3b,null))[_0x5c3c('0x49')](handleError(_0x168a3b,null));};exports[_0x5c3c('0x4e')]=function(_0xd8de25,_0x272a24,_0x1a2d27){return db['sequelize']['transaction'](function(_0x247160){if(_0xd8de25[_0x5c3c('0x4b')][_0x5c3c('0x4f')]===_0x5c3c('0x50')){_0xd8de25[_0x5c3c('0x4b')][_0x5c3c('0x51')]=path[_0x5c3c('0x52')](config[_0x5c3c('0x53')],_0x5c3c('0x54'),_0xd8de25[_0x5c3c('0x4b')][_0x5c3c('0x30')]);}return db[_0x5c3c('0x47')][_0x5c3c('0x4e')](_0xd8de25['body'],{'transaction':_0x247160})[_0x5c3c('0x29')](function(_0x19b4fd){if(_0xd8de25[_0x5c3c('0x4b')]['mode']===_0x5c3c('0x50')){fs[_0x5c3c('0x55')](_0x19b4fd[_0x5c3c('0x51')],parseInt(_0x5c3c('0x56'),0x8));}var _0x21459a=_0xd8de25['user'][_0x5c3c('0x2a')]({'plain':!![]});if(!_0x21459a)throw new Error(_0x5c3c('0x57'));if(_0x21459a[_0x5c3c('0x58')]==='user'){var _0x3ecc86=_0x19b4fd['get']({'plain':!![]});return db[_0x5c3c('0x59')]['find']({'where':{'name':'MusicOnHolds','userProfileId':_0x21459a[_0x5c3c('0x5a')]},'raw':!![]})[_0x5c3c('0x29')](function(_0x4f5289){if(_0x4f5289&&_0x4f5289[_0x5c3c('0x5b')]===0x0){return db[_0x5c3c('0x2c')]['create']({'name':_0x3ecc86[_0x5c3c('0x30')],'resourceId':_0x3ecc86['id'],'type':_0x4f5289[_0x5c3c('0x30')],'sectionId':_0x4f5289['id']},{})['then'](function(){return _0x19b4fd;});}else{return _0x19b4fd;}})[_0x5c3c('0x49')](function(_0x3d9348){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3d9348);});}return _0x19b4fd;});})[_0x5c3c('0x29')](respondWithResult(_0x272a24,0xc9))['catch'](handleError(_0x272a24,null));};exports[_0x5c3c('0x2d')]=function(_0x525458,_0x5740d1,_0x1fb57c){var _0x4c32db;return db[_0x5c3c('0x47')]['find']({'where':{'id':_0x525458[_0x5c3c('0x4d')]['id']}})[_0x5c3c('0x29')](function(_0x1804bf){if(_0x1804bf){return db[_0x5c3c('0x5c')][_0x5c3c('0x5d')](function(_0x20fb74){return _0x1804bf[_0x5c3c('0x2d')]({'transaction':_0x20fb74,'raw':!![]})['then'](function(_0x1ab9e1){if(_0x1ab9e1[_0x5c3c('0x51')]){fs[_0x5c3c('0x5e')](_0x1ab9e1[_0x5c3c('0x51')])[_0x5c3c('0x5f')](function(_0x25089d){fs['unlinkSync'](path[_0x5c3c('0x52')](_0x1ab9e1['directory'],_0x25089d));});fs[_0x5c3c('0x60')](_0x1ab9e1[_0x5c3c('0x51')]);}return _0x1ab9e1;});})[_0x5c3c('0x49')](function(_0x5f5848){throw new db[(_0x5c3c('0x61'))][(_0x5c3c('0x62'))](_0x5f5848['message']);});}})['then'](handleEntityNotFound(_0x5740d1,null))['then'](removeEntity(_0x5740d1,null))[_0x5c3c('0x49')](handleError(_0x5740d1,null));};exports[_0x5c3c('0x63')]=function(_0x4d1126,_0x74a84a,_0x52f21e){return db['sequelize']['transaction'](function(_0x1b5545){var _0x3a1b0f;return db['VoiceMusicOnHold'][_0x5c3c('0x4c')]({'where':{'id':_0x4d1126[_0x5c3c('0x4d')]['id']}})[_0x5c3c('0x29')](function(_0xa76329){if(_0xa76329){_0x3a1b0f=_0xa76329;return _0xa76329[_0x5c3c('0x63')](_0x4d1126['body']['id'],{'transaction':_0x1b5545});}})['then'](function(_0x49134a){if(_0x49134a){return db[_0x5c3c('0x64')]['findOne']({'where':{'id':_0x4d1126[_0x5c3c('0x4b')]['id']},'attributes':['id',_0x5c3c('0x30'),_0x5c3c('0x65'),'converted_format',_0x5c3c('0x66')],'raw':!![]});}})[_0x5c3c('0x29')](function(_0xb04b20){if(_0xb04b20){var _0x5d8ffe=path[_0x5c3c('0x52')](config[_0x5c3c('0x53')],_0x5c3c('0x67'),util[_0x5c3c('0x68')](_0x5c3c('0x69'),path[_0x5c3c('0x6a')](_0xb04b20[_0x5c3c('0x65')],path[_0x5c3c('0x6b')](_0xb04b20[_0x5c3c('0x65')])),_0xb04b20['converted_format']));var _0x205e45=path[_0x5c3c('0x52')](config[_0x5c3c('0x53')],'server/files/moh',_0x3a1b0f[_0x5c3c('0x30')],util[_0x5c3c('0x68')]('%s.%s',_0xb04b20['name'],_0xb04b20[_0x5c3c('0x6c')]));fs['symlinkSync'](_0x5d8ffe,_0x205e45);return _0xb04b20;}})['catch'](function(_0xaccfa){throw new db[(_0x5c3c('0x61'))][(_0x5c3c('0x62'))](_0xaccfa[_0x5c3c('0x6d')]);});})[_0x5c3c('0x29')](handleEntityNotFound(_0x74a84a,null))[_0x5c3c('0x29')](respondWithResult(_0x74a84a,0xc9))[_0x5c3c('0x49')](handleError(_0x74a84a,null));};exports[_0x5c3c('0x6e')]=function(_0x179fc1,_0x234f26,_0x43479d){return db['sequelize'][_0x5c3c('0x5d')](function(_0x2bcf3a){var _0x153233;return db[_0x5c3c('0x47')]['findOne']({'where':{'id':_0x179fc1[_0x5c3c('0x4d')]['id']}})['then'](handleEntityNotFound(_0x234f26,null))['then'](function(_0x41d5be){if(_0x41d5be){_0x153233=_0x41d5be;return _0x41d5be[_0x5c3c('0x6e')](_0x179fc1[_0x5c3c('0x4d')][_0x5c3c('0x6f')]);}})[_0x5c3c('0x29')](function(_0x1ca8b7){if(_0x1ca8b7){return db[_0x5c3c('0x64')][_0x5c3c('0x70')]({'where':{'id':_0x179fc1['params'][_0x5c3c('0x6f')]},'attributes':['id',_0x5c3c('0x30'),'save_name',_0x5c3c('0x6c'),_0x5c3c('0x66')],'raw':!![]});}})[_0x5c3c('0x29')](function(_0x16baee){if(_0x16baee){fs[_0x5c3c('0x71')](path[_0x5c3c('0x52')](_0x153233['directory'],util['format'](_0x5c3c('0x69'),_0x16baee[_0x5c3c('0x30')],_0x16baee[_0x5c3c('0x6c')])));return _0x16baee;}})[_0x5c3c('0x49')](function(_0x11637d){throw new db[(_0x5c3c('0x61'))][(_0x5c3c('0x62'))](_0x11637d['message']);});})[_0x5c3c('0x29')](handleEntityNotFound(_0x234f26,null))[_0x5c3c('0x29')](respondWithStatusCode(_0x234f26,0xcc))[_0x5c3c('0x49')](handleError(_0x234f26,null));};exports[_0x5c3c('0x72')]=function(_0x432011,_0x112dad,_0x4619ce){var _0xcf025c={};var _0xa6a38c={};var _0x1e483;var _0x14246b;return db[_0x5c3c('0x47')][_0x5c3c('0x70')]({'where':{'id':_0x432011[_0x5c3c('0x4d')]['id']}})[_0x5c3c('0x29')](handleEntityNotFound(_0x112dad,null))[_0x5c3c('0x29')](function(_0x2073d3){if(_0x2073d3){_0x1e483=_0x2073d3;_0xa6a38c[_0x5c3c('0x37')]=_[_0x5c3c('0x4a')](db['Sound'][_0x5c3c('0x34')]);_0xa6a38c[_0x5c3c('0x38')]=_[_0x5c3c('0x4a')](_0x432011[_0x5c3c('0x38')]);_0xa6a38c['filters']=_[_0x5c3c('0x39')](_0xa6a38c[_0x5c3c('0x37')],_0xa6a38c[_0x5c3c('0x38')]);_0xcf025c['attributes']=_[_0x5c3c('0x39')](_0xa6a38c[_0x5c3c('0x37')],qs[_0x5c3c('0x3b')](_0x432011['query'][_0x5c3c('0x3b')]));_0xcf025c['attributes']=_0xcf025c[_0x5c3c('0x3a')][_0x5c3c('0x3c')]?_0xcf025c[_0x5c3c('0x3a')]:_0xa6a38c['model'];_0xcf025c[_0x5c3c('0x3f')]=qs[_0x5c3c('0x40')](_0x432011['query'][_0x5c3c('0x40')]);_0xcf025c['where']=qs[_0x5c3c('0x42')](_[_0x5c3c('0x73')](_0x432011[_0x5c3c('0x38')],_0xa6a38c[_0x5c3c('0x42')]));if(_0x432011['query']['filter']){_0xcf025c[_0x5c3c('0x41')]=_[_0x5c3c('0x44')](_0xcf025c['where'],{'$or':_[_0x5c3c('0x33')](_0xcf025c[_0x5c3c('0x3a')],function(_0x6f6b15){var _0x4eb195={};_0x4eb195[_0x6f6b15]={'$like':'%'+_0x432011['query']['filter']+'%'};return _0x4eb195;})});}_0xcf025c=_[_0x5c3c('0x44')]({},_0xcf025c,_0x432011[_0x5c3c('0x45')]);return _0x1e483[_0x5c3c('0x72')](_0xcf025c);}})['then'](function(_0x3ea287){if(_0x3ea287){_0x14246b=_0x3ea287['length'];if(!_0x432011['query'][_0x5c3c('0x3d')](_0x5c3c('0x3e'))){_0xcf025c[_0x5c3c('0x22')]=qs[_0x5c3c('0x22')](_0x432011[_0x5c3c('0x38')][_0x5c3c('0x22')]);_0xcf025c[_0x5c3c('0x24')]=qs['offset'](_0x432011[_0x5c3c('0x38')][_0x5c3c('0x24')]);}return _0x1e483[_0x5c3c('0x72')](_0xcf025c);}})[_0x5c3c('0x29')](function(_0x3a97ac){if(_0x3a97ac){return _0x3a97ac?{'count':_0x14246b,'rows':_0x3a97ac}:null;}})['then'](respondWithResult(_0x112dad,null))[_0x5c3c('0x49')](handleError(_0x112dad,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 02fcca8..1e48772 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 _0x1f45=['path','rimraf','../../config/environment','exports','VoiceMusicOnHold','voice_musiconhold','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1f45,0x186));var _0x51f4=function(_0x2890e7,_0x4be23c){_0x2890e7=_0x2890e7-0x0;var _0x32b9f9=_0x1f45[_0x2890e7];return _0x32b9f9;};'use strict';var _=require('lodash');var util=require(_0x51f4('0x0'));var logger=require(_0x51f4('0x1'))(_0x51f4('0x2'));var moment=require(_0x51f4('0x3'));var BPromise=require(_0x51f4('0x4'));var rp=require(_0x51f4('0x5'));var fs=require('fs');var path=require(_0x51f4('0x6'));var rimraf=require(_0x51f4('0x7'));var config=require(_0x51f4('0x8'));var attributes=require('./voiceMusicOnHold.attributes');module[_0x51f4('0x9')]=function(_0xce5147,_0xa2f102){return _0xce5147['define'](_0x51f4('0xa'),attributes,{'tableName':_0x51f4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7dfc=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold'];(function(_0xa1ae5c,_0x44beef){var _0x4573c1=function(_0x2580ec){while(--_0x2580ec){_0xa1ae5c['push'](_0xa1ae5c['shift']());}};_0x4573c1(++_0x44beef);}(_0x7dfc,0x1d4));var _0xc7df=function(_0x56fec6,_0x3834f1){_0x56fec6=_0x56fec6-0x0;var _0x1ce7ac=_0x7dfc[_0x56fec6];return _0x1ce7ac;};'use strict';var _=require(_0xc7df('0x0'));var util=require(_0xc7df('0x1'));var logger=require(_0xc7df('0x2'))(_0xc7df('0x3'));var moment=require(_0xc7df('0x4'));var BPromise=require(_0xc7df('0x5'));var rp=require(_0xc7df('0x6'));var fs=require('fs');var path=require(_0xc7df('0x7'));var rimraf=require(_0xc7df('0x8'));var config=require('../../config/environment');var attributes=require(_0xc7df('0x9'));module[_0xc7df('0xa')]=function(_0x4425cc,_0x780287){return _0x4425cc[_0xc7df('0xb')](_0xc7df('0xc'),attributes,{'tableName':'voice_musiconhold','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js index 5e48fc7..10cdd09 100644 --- a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js +++ b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['code','VoiceMusicOnHold,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x1b5e6a,_0x2be8e8){var _0x273c4c=function(_0x3b3e71){while(--_0x3b3e71){_0x1b5e6a['push'](_0x1b5e6a['shift']());}};_0x273c4c(++_0x2be8e8);}(_0x70e0,0x17b));var _0x070e=function(_0x4cf75a,_0x657c5f){_0x4cf75a=_0x4cf75a-0x0;var _0x292d35=_0x70e0[_0x4cf75a];return _0x292d35;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x070e('0x3'));var db=require(_0x070e('0x4'))['db'];var utils=require(_0x070e('0x5'));var logger=require(_0x070e('0x6'))('rpc');var config=require(_0x070e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x070e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56e420,_0x5032e5,_0x35ab0c){return new BPromise(function(_0x1e11f0,_0x604664){return client[_0x070e('0x9')](_0x56e420,_0x35ab0c)[_0x070e('0xa')](function(_0x68a09e){logger[_0x070e('0xb')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,'request\x20sent');logger[_0x070e('0xc')](_0x070e('0xd'),_0x5032e5,_0x070e('0xe'),JSON[_0x070e('0xf')](_0x68a09e));if(_0x68a09e[_0x070e('0x10')]){if(_0x68a09e[_0x070e('0x10')][_0x070e('0x11')]===0x1f4){logger[_0x070e('0x10')](_0x070e('0x12'),_0x5032e5,_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);return _0x604664(_0x68a09e['error']['message']);}logger[_0x070e('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,_0x070e('0xe'));_0x1e11f0(_0x68a09e[_0x070e('0x14')][_0x070e('0x13')]);}})[_0x070e('0x15')](function(_0x5bc71e){logger['error'](_0x070e('0x12'),_0x5032e5,_0x5bc71e);_0x604664(_0x5bc71e);});});} \ No newline at end of file +var _0xe706=['http','request','then','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x5acf43,_0x47756b){var _0x51d1ff=function(_0x2778c1){while(--_0x2778c1){_0x5acf43['push'](_0x5acf43['shift']());}};_0x51d1ff(++_0x47756b);}(_0xe706,0xa3));var _0x6e70=function(_0x565d0a,_0x4927cc){_0x565d0a=_0x565d0a-0x0;var _0x24c211=_0xe706[_0x565d0a];return _0x24c211;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e70('0x3'));var fs=require('fs');var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var utils=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var config=require(_0x6e70('0x9'));var jayson=require(_0x6e70('0xa'));var client=jayson[_0x6e70('0xb')][_0x6e70('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){return client[_0x6e70('0xd')](_0x36357b,_0x45a2d4)[_0x6e70('0xe')](function(_0x25e61c){logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,_0x6e70('0x11'));logger[_0x6e70('0x12')](_0x6e70('0x13'),_0x293ce7,_0x6e70('0x11'),JSON['stringify'](_0x25e61c));if(_0x25e61c['error']){if(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x15')]===0x1f4){logger[_0x6e70('0x14')](_0x6e70('0x10'),_0x293ce7,_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);return _0x3c4843(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);}logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0x293ce7,_0x25e61c['error'][_0x6e70('0x16')]);return _0x188ed3(_0x25e61c['error']['message']);}else{logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,'request\x20sent');_0x188ed3(_0x25e61c[_0x6e70('0x17')]['message']);}})[_0x6e70('0x18')](function(_0x161f23){logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 5b4c9d0..ecc1808 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 _0x10eb=['create','post','addTeams','put','/:id','update','delete','destroy','removeTeams','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','show','/:id/users','getAgents','/:id/teams','getTeams'];(function(_0x2b0f8a,_0x34db97){var _0x16c44e=function(_0x5a13bd){while(--_0x5a13bd){_0x2b0f8a['push'](_0x2b0f8a['shift']());}};_0x16c44e(++_0x34db97);}(_0x10eb,0x71));var _0xb10e=function(_0x5e955c,_0x192066){_0x5e955c=_0x5e955c-0x0;var _0x16bddd=_0x10eb[_0x5e955c];return _0x16bddd;};'use strict';var multer=require(_0xb10e('0x0'));var util=require('util');var path=require(_0xb10e('0x1'));var timeout=require(_0xb10e('0x2'));var express=require(_0xb10e('0x3'));var router=express[_0xb10e('0x4')]();var fs_extra=require(_0xb10e('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xb10e('0x6'));var config=require(_0xb10e('0x7'));var controller=require('./voicePrefix.controller');router['get']('/',auth[_0xb10e('0x8')](),controller[_0xb10e('0x9')]);router[_0xb10e('0xa')](_0xb10e('0xb'),auth['isAuthenticated'](),controller['describe']);router['get']('/:id',auth['isAuthenticated'](),controller[_0xb10e('0xc')]);router[_0xb10e('0xa')](_0xb10e('0xd'),auth[_0xb10e('0x8')](),controller[_0xb10e('0xe')]);router[_0xb10e('0xa')](_0xb10e('0xf'),auth[_0xb10e('0x8')](),controller[_0xb10e('0x10')]);router['post']('/',auth[_0xb10e('0x8')](),controller[_0xb10e('0x11')]);router[_0xb10e('0x12')]('/:id/users',auth[_0xb10e('0x8')](),controller['addAgents']);router[_0xb10e('0x12')](_0xb10e('0xf'),auth[_0xb10e('0x8')](),controller[_0xb10e('0x13')]);router[_0xb10e('0x14')](_0xb10e('0x15'),auth[_0xb10e('0x8')](),controller[_0xb10e('0x16')]);router[_0xb10e('0x17')]('/:id',auth[_0xb10e('0x8')](),controller[_0xb10e('0x18')]);router[_0xb10e('0x17')](_0xb10e('0xd'),auth[_0xb10e('0x8')](),controller['removeAgents']);router[_0xb10e('0x17')](_0xb10e('0xf'),auth[_0xb10e('0x8')](),controller[_0xb10e('0x19')]);module['exports']=router; \ No newline at end of file +var _0xe57d=['path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./voicePrefix.controller','isAuthenticated','index','get','describe','/:id','show','/:id/users','getAgents','/:id/teams','addAgents','post','addTeams','put','delete','destroy','removeAgents','exports','multer'];(function(_0x3d1c92,_0x2f03fb){var _0x4de912=function(_0x19fa18){while(--_0x19fa18){_0x3d1c92['push'](_0x3d1c92['shift']());}};_0x4de912(++_0x2f03fb);}(_0xe57d,0xd7));var _0xde57=function(_0x4cb086,_0x4cc048){_0x4cb086=_0x4cb086-0x0;var _0x10d1af=_0xe57d[_0x4cb086];return _0x10d1af;};'use strict';var multer=require(_0xde57('0x0'));var util=require('util');var path=require(_0xde57('0x1'));var timeout=require(_0xde57('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xde57('0x3'));var auth=require(_0xde57('0x4'));var interaction=require(_0xde57('0x5'));var config=require('../../config/environment');var controller=require(_0xde57('0x6'));router['get']('/',auth[_0xde57('0x7')](),controller[_0xde57('0x8')]);router[_0xde57('0x9')]('/describe',auth['isAuthenticated'](),controller[_0xde57('0xa')]);router['get'](_0xde57('0xb'),auth[_0xde57('0x7')](),controller[_0xde57('0xc')]);router['get'](_0xde57('0xd'),auth['isAuthenticated'](),controller[_0xde57('0xe')]);router[_0xde57('0x9')](_0xde57('0xf'),auth[_0xde57('0x7')](),controller['getTeams']);router['post']('/',auth['isAuthenticated'](),controller['create']);router['post'](_0xde57('0xd'),auth[_0xde57('0x7')](),controller[_0xde57('0x10')]);router[_0xde57('0x11')]('/:id/teams',auth[_0xde57('0x7')](),controller[_0xde57('0x12')]);router[_0xde57('0x13')](_0xde57('0xb'),auth[_0xde57('0x7')](),controller['update']);router[_0xde57('0x14')](_0xde57('0xb'),auth[_0xde57('0x7')](),controller[_0xde57('0x15')]);router['delete'](_0xde57('0xd'),auth[_0xde57('0x7')](),controller[_0xde57('0x16')]);router['delete']('/:id/teams',auth[_0xde57('0x7')](),controller['removeTeams']);module[_0xde57('0x17')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 71163dc..b8e8e35 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 _0xd9d4=['INTEGER','sequelize','exports','STRING','name','VIRTUAL','system-'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0xd9d4,0x1eb));var _0x4d9d=function(_0x5af97c,_0x24a49f){_0x5af97c=_0x5af97c-0x0;var _0x3472ae=_0xd9d4[_0x5af97c];return _0x3472ae;};'use strict';var Sequelize=require(_0x4d9d('0x0'));module[_0x4d9d('0x1')]={'name':{'type':Sequelize[_0x4d9d('0x2')],'allowNull':![],'unique':_0x4d9d('0x3')},'prefix':{'type':Sequelize[_0x4d9d('0x4')],'get':function(_0x104068){return _0x4d9d('0x5')+this['getDataValue'](_0x4d9d('0x3'))+'-';}},'description':{'type':Sequelize[_0x4d9d('0x2')]},'callerIdAll':{'type':Sequelize['STRING']},'VoiceExtensionId':{'type':Sequelize[_0x4d9d('0x6')]}}; \ No newline at end of file +var _0xdba3=['VIRTUAL','system-','getDataValue','STRING','INTEGER','exports','name'];(function(_0x5e2f73,_0x45b945){var _0x2ca653=function(_0x2a34cd){while(--_0x2a34cd){_0x5e2f73['push'](_0x5e2f73['shift']());}};_0x2ca653(++_0x45b945);}(_0xdba3,0xe5));var _0x3dba=function(_0x3d3e09,_0x45f288){_0x3d3e09=_0x3d3e09-0x0;var _0x446c36=_0xdba3[_0x3d3e09];return _0x446c36;};'use strict';var Sequelize=require('sequelize');module[_0x3dba('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x3dba('0x1')},'prefix':{'type':Sequelize[_0x3dba('0x2')],'get':function(_0x36e3ea){return _0x3dba('0x3')+this[_0x3dba('0x4')](_0x3dba('0x1'))+'-';}},'description':{'type':Sequelize[_0x3dba('0x5')]},'callerIdAll':{'type':Sequelize[_0x3dba('0x5')]},'VoiceExtensionId':{'type':Sequelize[_0x3dba('0x6')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 5723616..d103921 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 _0x1a37=['User','getTeams','Team','hasOwnProperty','addTeams','findAll','online','interface','Agents','each','upsert','findOrCreate','forEach','removeTeams','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','toString','QueryTypes','every','includes','all','union','compact','value','isEmpty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','get','VoicePrefixes','UserProfileResource','destroy','end','error','name','send','index','map','VoicePrefix','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','length','find','describe','create','transaction','body','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','from-sip','exten','Voice\x20Prefix\x20Extension','priority','appdata','prefix','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','NoOp','${EXTEN:','charAt','sequelize','addAgents','omit','ids','spread','emit','userVoicePrefix:save','removeAgents','userVoicePrefix:remove','getAgents','findOne'];(function(_0x2080a3,_0x48acfa){var _0x8d7d17=function(_0x2dbc06){while(--_0x2dbc06){_0x2080a3['push'](_0x2080a3['shift']());}};_0x8d7d17(++_0x48acfa);}(_0x1a37,0xb4));var _0x71a3=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x1a37[_0x4b369d];return _0x571a98;};'use strict';var emlformat=require(_0x71a3('0x0'));var rimraf=require(_0x71a3('0x1'));var zipdir=require(_0x71a3('0x2'));var jsonpatch=require(_0x71a3('0x3'));var rp=require(_0x71a3('0x4'));var moment=require(_0x71a3('0x5'));var BPromise=require(_0x71a3('0x6'));var Mustache=require(_0x71a3('0x7'));var util=require(_0x71a3('0x8'));var path=require(_0x71a3('0x9'));var sox=require('sox');var csv=require(_0x71a3('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x71a3('0xb'));var _=require(_0x71a3('0xc'));var squel=require(_0x71a3('0xd'));var crypto=require(_0x71a3('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x71a3('0xf'));var Redis=require(_0x71a3('0x10'));var authService=require(_0x71a3('0x11'));var qs=require(_0x71a3('0x12'));var as=require(_0x71a3('0x13'));var hardwareService=require(_0x71a3('0x14'));var logger=require(_0x71a3('0x15'))(_0x71a3('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x71a3('0x17'))['db'];config[_0x71a3('0x18')]=_[_0x71a3('0x19')](config[_0x71a3('0x18')],{'host':_0x71a3('0x1a'),'port':0x18eb});var socket=require(_0x71a3('0x1b'))(new Redis(config[_0x71a3('0x18')]));require(_0x71a3('0x1c'))[_0x71a3('0x1d')](socket);function respondWithStatusCode(_0x203ee1,_0x21a34d){_0x21a34d=_0x21a34d||0xcc;return function(_0x5a40c3){if(_0x5a40c3){return _0x203ee1[_0x71a3('0x1e')](_0x21a34d);}return _0x203ee1[_0x71a3('0x1f')](_0x21a34d)['end']();};}function respondWithResult(_0x4aa918,_0x41fe1c){_0x41fe1c=_0x41fe1c||0xc8;return function(_0x3a1c81){if(_0x3a1c81){return _0x4aa918[_0x71a3('0x1f')](_0x41fe1c)[_0x71a3('0x20')](_0x3a1c81);}};}function respondWithFilteredResult(_0x1af1bc,_0x318ff6){return function(_0x5d4dee){if(_0x5d4dee){var _0x656cd2=typeof _0x318ff6[_0x71a3('0x21')]==='undefined'&&typeof _0x318ff6['limit']===_0x71a3('0x22');var _0x250db3=_0x5d4dee[_0x71a3('0x23')];var _0x1c4ec2=_0x656cd2?0x0:_0x318ff6[_0x71a3('0x21')];var _0x596328=_0x656cd2?_0x5d4dee[_0x71a3('0x23')]:_0x318ff6[_0x71a3('0x21')]+_0x318ff6[_0x71a3('0x24')];var _0x3ea036;if(_0x596328>=_0x250db3){_0x596328=_0x250db3;_0x3ea036=0xc8;}else{_0x3ea036=0xce;}_0x1af1bc[_0x71a3('0x1f')](_0x3ea036);return _0x1af1bc['set'](_0x71a3('0x25'),_0x1c4ec2+'-'+_0x596328+'/'+_0x250db3)['json'](_0x5d4dee);}return null;};}function patchUpdates(_0x3bf78e){return function(_0x35d1d4){try{jsonpatch[_0x71a3('0x26')](_0x35d1d4,_0x3bf78e,!![]);}catch(_0x21899d){return BPromise[_0x71a3('0x27')](_0x21899d);}return _0x35d1d4[_0x71a3('0x28')]();};}function saveUpdates(_0x5f33c5,_0x26e6e7){return function(_0x299d1d){if(_0x299d1d){return _0x299d1d[_0x71a3('0x29')](_0x5f33c5)[_0x71a3('0x2a')](function(_0xb0f3aa){return _0xb0f3aa;});}return null;};}function removeEntity(_0x4fd214,_0x107fbd){return function(_0x2b414d){if(_0x2b414d){return _0x2b414d['destroy']()[_0x71a3('0x2a')](function(){var _0x515519=_0x2b414d[_0x71a3('0x2b')]({'plain':!![]});var _0x2fd3b6=_0x71a3('0x2c');return db[_0x71a3('0x2d')][_0x71a3('0x2e')]({'where':{'type':_0x2fd3b6,'resourceId':_0x515519['id']}})[_0x71a3('0x2a')](function(){return _0x2b414d;});})[_0x71a3('0x2a')](function(){_0x4fd214[_0x71a3('0x1f')](0xcc)[_0x71a3('0x2f')]();});}};}function handleEntityNotFound(_0x3fc578,_0x3ea7aa){return function(_0x228afa){if(!_0x228afa){_0x3fc578['sendStatus'](0x194);}return _0x228afa;};}function handleError(_0x26fd9f,_0x1719e6){_0x1719e6=_0x1719e6||0x1f4;return function(_0x334db0){logger[_0x71a3('0x30')](_0x334db0['stack']);if(_0x334db0[_0x71a3('0x31')]){delete _0x334db0[_0x71a3('0x31')];}_0x26fd9f[_0x71a3('0x1f')](_0x1719e6)[_0x71a3('0x32')](_0x334db0);};}exports[_0x71a3('0x33')]=function(_0xa82e46,_0x1d09bd){var _0x5af615={},_0x2ccd54={},_0x3c16ef={'count':0x0,'rows':[]};var _0x3aaf63=_[_0x71a3('0x34')](db[_0x71a3('0x35')][_0x71a3('0x36')],function(_0x425d83){return{'name':_0x425d83[_0x71a3('0x37')],'type':_0x425d83[_0x71a3('0x38')][_0x71a3('0x39')]};});_0x2ccd54[_0x71a3('0x3a')]=_[_0x71a3('0x34')](_0x3aaf63,_0x71a3('0x31'));_0x2ccd54['query']=_['keys'](_0xa82e46[_0x71a3('0x3b')]);_0x2ccd54[_0x71a3('0x3c')]=_['intersection'](_0x2ccd54[_0x71a3('0x3a')],_0x2ccd54[_0x71a3('0x3b')]);_0x5af615['attributes']=_[_0x71a3('0x3d')](_0x2ccd54[_0x71a3('0x3a')],qs[_0x71a3('0x3e')](_0xa82e46[_0x71a3('0x3b')][_0x71a3('0x3e')]));_0x5af615[_0x71a3('0x3f')]=_0x5af615[_0x71a3('0x3f')]['length']?_0x5af615[_0x71a3('0x3f')]:_0x2ccd54[_0x71a3('0x3a')];if(!_0xa82e46[_0x71a3('0x3b')]['hasOwnProperty'](_0x71a3('0x40'))){_0x5af615[_0x71a3('0x24')]=qs[_0x71a3('0x24')](_0xa82e46[_0x71a3('0x3b')][_0x71a3('0x24')]);_0x5af615['offset']=qs['offset'](_0xa82e46[_0x71a3('0x3b')][_0x71a3('0x21')]);}_0x5af615[_0x71a3('0x41')]=qs[_0x71a3('0x42')](_0xa82e46[_0x71a3('0x3b')]['sort']);_0x5af615[_0x71a3('0x43')]=qs[_0x71a3('0x3c')](_[_0x71a3('0x44')](_0xa82e46['query'],_0x2ccd54[_0x71a3('0x3c')]),_0x3aaf63);if(_0xa82e46['query'][_0x71a3('0x45')]){_0x5af615[_0x71a3('0x43')]=_[_0x71a3('0x46')](_0x5af615[_0x71a3('0x43')],{'$or':_[_0x71a3('0x34')](_0x3aaf63,function(_0x38912c){if(_0x38912c[_0x71a3('0x38')]!==_0x71a3('0x47')){var _0x31ba66={};_0x31ba66[_0x38912c[_0x71a3('0x31')]]={'$like':'%'+_0xa82e46['query'][_0x71a3('0x45')]+'%'};return _0x31ba66;}})});}_0x5af615=_['merge']({},_0x5af615,_0xa82e46[_0x71a3('0x48')]);var _0x1ed84d={'where':_0x5af615[_0x71a3('0x43')]};return db[_0x71a3('0x35')]['count'](_0x1ed84d)[_0x71a3('0x2a')](function(_0x4b4fde){_0x3c16ef['count']=_0x4b4fde;if(_0xa82e46[_0x71a3('0x3b')][_0x71a3('0x49')]){_0x5af615[_0x71a3('0x4a')]=[{'all':!![]}];}return db[_0x71a3('0x35')]['findAll'](_0x5af615);})[_0x71a3('0x2a')](function(_0x615c6f){_0x3c16ef[_0x71a3('0x4b')]=_0x615c6f;return _0x3c16ef;})[_0x71a3('0x2a')](respondWithFilteredResult(_0x1d09bd,_0x5af615))[_0x71a3('0x4c')](handleError(_0x1d09bd,null));};exports[_0x71a3('0x4d')]=function(_0x371aa5,_0x262afe){var _0x3ba2c1={'raw':![],'where':{'id':_0x371aa5[_0x71a3('0x4e')]['id']}},_0x3a18c4={};_0x3a18c4[_0x71a3('0x3a')]=_[_0x71a3('0x4f')](db[_0x71a3('0x35')][_0x71a3('0x36')]);_0x3a18c4[_0x71a3('0x3b')]=_['keys'](_0x371aa5[_0x71a3('0x3b')]);_0x3a18c4[_0x71a3('0x3c')]=_['intersection'](_0x3a18c4[_0x71a3('0x3a')],_0x3a18c4[_0x71a3('0x3b')]);_0x3ba2c1[_0x71a3('0x3f')]=_[_0x71a3('0x3d')](_0x3a18c4[_0x71a3('0x3a')],qs['fields'](_0x371aa5['query'][_0x71a3('0x3e')]));_0x3ba2c1[_0x71a3('0x3f')]=_0x3ba2c1['attributes'][_0x71a3('0x50')]?_0x3ba2c1[_0x71a3('0x3f')]:_0x3a18c4[_0x71a3('0x3a')];if(_0x371aa5[_0x71a3('0x3b')][_0x71a3('0x49')]){_0x3ba2c1[_0x71a3('0x4a')]=[{'all':!![]}];}_0x3ba2c1=_['merge']({},_0x3ba2c1,_0x371aa5[_0x71a3('0x48')]);return db['VoicePrefix'][_0x71a3('0x51')](_0x3ba2c1)[_0x71a3('0x2a')](handleEntityNotFound(_0x262afe,null))[_0x71a3('0x2a')](respondWithResult(_0x262afe,null))[_0x71a3('0x4c')](handleError(_0x262afe,null));};exports[_0x71a3('0x2e')]=function(_0x48fcd7,_0x263706){return db[_0x71a3('0x35')][_0x71a3('0x51')]({'where':{'id':_0x48fcd7['params']['id']}})[_0x71a3('0x2a')](handleEntityNotFound(_0x263706,null))['then'](removeEntity(_0x263706,null))[_0x71a3('0x4c')](handleError(_0x263706,null));};exports[_0x71a3('0x52')]=function(_0x5c6450,_0x30cea2){return db[_0x71a3('0x35')][_0x71a3('0x52')]()[_0x71a3('0x2a')](respondWithResult(_0x30cea2,null))[_0x71a3('0x4c')](handleError(_0x30cea2,null));};exports[_0x71a3('0x53')]=function(_0x13a9ed,_0x479a8a){var _0x2d4a2e;return db['sequelize'][_0x71a3('0x54')](function(_0x480e90){return db[_0x71a3('0x35')][_0x71a3('0x53')](_0x13a9ed[_0x71a3('0x55')],{'transaction':_0x480e90})[_0x71a3('0x2a')](function(_0x599059){_0x2d4a2e=_0x599059['get']({'plain':!![]});return db[_0x71a3('0x56')][_0x71a3('0x51')]({'where':{'id':_0x2d4a2e[_0x71a3('0x57')]},'raw':!![]})[_0x71a3('0x2a')](function(_0x4d9181){return createVoicePrefixExtensions(_0x2d4a2e,_0x4d9181,_0x480e90);});});})['then'](function(){var _0x464a25=_0x13a9ed[_0x71a3('0x58')][_0x71a3('0x2b')]({'plain':!![]});if(!_0x464a25)throw new Error(_0x71a3('0x59'));if(_0x464a25[_0x71a3('0x5a')]==='user'){var _0x421b6a=_0x2d4a2e;return db[_0x71a3('0x5b')][_0x71a3('0x51')]({'where':{'name':_0x71a3('0x2c'),'userProfileId':_0x464a25[_0x71a3('0x5c')]},'raw':!![]})[_0x71a3('0x2a')](function(_0x2eb690){if(_0x2eb690&&_0x2eb690[_0x71a3('0x5d')]===0x0){return db['UserProfileResource'][_0x71a3('0x53')]({'name':_0x421b6a[_0x71a3('0x31')],'resourceId':_0x421b6a['id'],'type':_0x2eb690[_0x71a3('0x31')],'sectionId':_0x2eb690['id']},{})['then'](function(){return _0x2d4a2e;});}else{return _0x2d4a2e;}})[_0x71a3('0x4c')](function(_0x3dd655){logger[_0x71a3('0x30')](_0x71a3('0x5e'),_0x3dd655);throw _0x3dd655;});}return _0x2d4a2e;})[_0x71a3('0x2a')](respondWithResult(_0x479a8a,null))[_0x71a3('0x4c')](handleError(_0x479a8a,null));};function Extension(_0x453b78,_0x302dab,_0x3ebf59,_0x11b951){this['context']=_0x71a3('0x5f');this[_0x71a3('0x60')]=_0x453b78;this['app']=_0x3ebf59;this[_0x71a3('0x38')]='system';this['description']=_0x71a3('0x61');this[_0x71a3('0x62')]=_0x302dab;this[_0x71a3('0x63')]=_0x11b951;}function createVoicePrefixExtensions(_0x3ac98c,_0x3910e3,_0x5cffd2){return new BPromise(function(_0x121b2d,_0x2b88f8){var _0x52b5c3=new Extension(formatPrefixName(_0x3ac98c[_0x71a3('0x64')]),0x1,'NoOp',_0x71a3('0x65'));_0x52b5c3[_0x71a3('0x66')]=_0x3ac98c['id'];return db['VoiceExtension']['create'](_0x52b5c3,{'transaction':_0x5cffd2})[_0x71a3('0x2a')](function(_0x39f38b){var _0x4d703a=_0x39f38b[_0x71a3('0x2b')]({'plain':!![]});var _0x97ed1b=_[_0x71a3('0x34')](addVoicePrefixExtensions(_0x3ac98c,_0x3910e3),function(_0x516526){_0x516526[_0x71a3('0x57')]=_0x4d703a['id'];_0x516526[_0x71a3('0x66')]=_0x3ac98c['id'];return _0x516526;});return db[_0x71a3('0x56')][_0x71a3('0x67')](_0x97ed1b,{'transaction':_0x5cffd2})[_0x71a3('0x2a')](function(_0x85c7ed){if(!_0x85c7ed){return _0x2b88f8(_0x71a3('0x68'));}else{return _0x121b2d(_0x85c7ed);}})[_0x71a3('0x4c')](function(_0xe03bb5){return _0x2b88f8(_0xe03bb5);});});;});};function addVoicePrefixExtensions(_0x4b6b75,_0x4e5ab1){var _0x11a2d7=[];var _0x84b636=formatPrefixName(_0x4b6b75['prefix']);_0x11a2d7[_0x71a3('0x69')](new Extension(_0x84b636,0x2,_0x71a3('0x6a'),_0x71a3('0x6b')+_0x4b6b75[_0x71a3('0x31')]));if(_0x4b6b75[_0x71a3('0x6c')]){_0x11a2d7[_0x71a3('0x69')](new Extension(_0x84b636,0x3,_0x71a3('0x6a'),_0x71a3('0x6d')+_0x4b6b75[_0x71a3('0x6c')]));}else{_0x11a2d7['push'](new Extension(_0x84b636,0x3,_0x71a3('0x6e'),'No\x20callerid\x20available'));}_0x11a2d7[_0x71a3('0x69')](new Extension(_0x84b636,0x4,'goto',_0x4e5ab1['context']+','+_0x71a3('0x6f')+(0x8+_0x4b6b75['name'][_0x71a3('0x50')])+'}'+','+0x1));return _0x11a2d7;}function formatPrefixName(_0x271e37){var _0x239d18='_';for(var _0x4aa296=0x0;_0x4aa296<_0x271e37[_0x71a3('0x50')];_0x4aa296++){if(_0x271e37[_0x71a3('0x70')](_0x4aa296)=='-'){_0x239d18+=_0x271e37['charAt'](_0x4aa296);}else{_0x239d18+='['+_0x271e37[_0x71a3('0x70')](_0x4aa296)+']';}}_0x239d18+='.';return _0x239d18;}exports[_0x71a3('0x29')]=function(_0x44a6e3,_0x1450cc,_0x4430f2){var _0xd8a124=_0x44a6e3[_0x71a3('0x55')];_0xd8a124[_0x71a3('0x64')]='system-'+_0xd8a124['name']+'-';return db[_0x71a3('0x71')][_0x71a3('0x54')](function(_0x1b3c9b){return db['VoicePrefix'][_0x71a3('0x29')](_0xd8a124,{'where':{'id':_0xd8a124['id']},'transaction':_0x1b3c9b})[_0x71a3('0x2a')](function(){return db['VoiceExtension'][_0x71a3('0x2e')]({'where':{'VoicePrefixId':_0xd8a124['id']},'transaction':_0x1b3c9b})['then'](function(){return db[_0x71a3('0x56')][_0x71a3('0x51')]({'where':{'id':_0xd8a124[_0x71a3('0x57')]},'raw':!![]})[_0x71a3('0x2a')](function(_0x528c4b){return createVoicePrefixExtensions(_0xd8a124,_0x528c4b,_0x1b3c9b);});});});})[_0x71a3('0x2a')](function(){return db[_0x71a3('0x35')]['findById'](_0xd8a124['id']);})[_0x71a3('0x2a')](respondWithResult(_0x1450cc,null))[_0x71a3('0x4c')](handleError(_0x1450cc,null));};exports[_0x71a3('0x72')]=function(_0x693a55,_0x21e7a2,_0x22c62d){return db[_0x71a3('0x35')][_0x71a3('0x51')]({'where':{'id':_0x693a55[_0x71a3('0x4e')]['id']}})[_0x71a3('0x2a')](handleEntityNotFound(_0x21e7a2,null))[_0x71a3('0x2a')](function(_0x19e7d1){if(_0x19e7d1){return _0x19e7d1['addAgents'](_0x693a55[_0x71a3('0x55')]['ids'],_[_0x71a3('0x73')](_0x693a55[_0x71a3('0x55')],[_0x71a3('0x74'),'id'])||{})[_0x71a3('0x75')](function(_0x3031da){for(var _0x206636=0x0;_0x206636<_0x693a55[_0x71a3('0x55')][_0x71a3('0x74')][_0x71a3('0x50')];_0x206636+=0x1){socket[_0x71a3('0x76')](_0x71a3('0x77'),{'UserId':Number(_0x693a55[_0x71a3('0x55')][_0x71a3('0x74')][_0x206636]),'VoicePrefixId':Number(_0x693a55[_0x71a3('0x4e')]['id'])});}return _0x3031da;});}})[_0x71a3('0x2a')](respondWithResult(_0x21e7a2,null))[_0x71a3('0x4c')](handleError(_0x21e7a2,null));};exports[_0x71a3('0x78')]=function(_0x295ff4,_0x6c9bb6,_0x49c6d5){return db[_0x71a3('0x35')][_0x71a3('0x51')]({'where':{'id':_0x295ff4[_0x71a3('0x4e')]['id']}})[_0x71a3('0x2a')](handleEntityNotFound(_0x6c9bb6,null))[_0x71a3('0x2a')](function(_0x1483ea){if(_0x1483ea){return _0x1483ea[_0x71a3('0x78')](_0x295ff4['query'][_0x71a3('0x74')])['then'](function(){if(_['isArray'](_0x295ff4['query']['ids'])){for(var _0x579faf=0x0;_0x579faf<_0x295ff4['query'][_0x71a3('0x74')][_0x71a3('0x50')];_0x579faf+=0x1){socket[_0x71a3('0x76')](_0x71a3('0x79'),{'UserId':Number(_0x295ff4[_0x71a3('0x3b')][_0x71a3('0x74')][_0x579faf]),'VoicePrefixId':Number(_0x295ff4[_0x71a3('0x4e')]['id'])});}}else{socket[_0x71a3('0x76')](_0x71a3('0x79'),{'UserId':Number(_0x295ff4[_0x71a3('0x3b')][_0x71a3('0x74')]),'VoicePrefixId':Number(_0x295ff4[_0x71a3('0x4e')]['id'])});}});}})[_0x71a3('0x2a')](respondWithStatusCode(_0x6c9bb6,null))['catch'](handleError(_0x6c9bb6,null));};exports[_0x71a3('0x7a')]=function(_0x18e375,_0x27cad5,_0x3898fa){var _0x38f928={};var _0x4af495={};var _0x50bf5e;var _0x4f2bec;return db['VoicePrefix'][_0x71a3('0x7b')]({'where':{'id':_0x18e375[_0x71a3('0x4e')]['id']}})[_0x71a3('0x2a')](handleEntityNotFound(_0x27cad5,null))['then'](function(_0x157527){if(_0x157527){_0x50bf5e=_0x157527;_0x4af495[_0x71a3('0x3a')]=_[_0x71a3('0x4f')](db[_0x71a3('0x7c')][_0x71a3('0x36')]);_0x4af495[_0x71a3('0x3b')]=_[_0x71a3('0x4f')](_0x18e375[_0x71a3('0x3b')]);_0x4af495[_0x71a3('0x3c')]=_['intersection'](_0x4af495[_0x71a3('0x3a')],_0x4af495[_0x71a3('0x3b')]);_0x38f928['attributes']=_[_0x71a3('0x3d')](_0x4af495['model'],qs[_0x71a3('0x3e')](_0x18e375[_0x71a3('0x3b')][_0x71a3('0x3e')]));_0x38f928[_0x71a3('0x3f')]=_0x38f928[_0x71a3('0x3f')]['length']?_0x38f928[_0x71a3('0x3f')]:_0x4af495[_0x71a3('0x3a')];_0x38f928['order']=qs[_0x71a3('0x42')](_0x18e375[_0x71a3('0x3b')][_0x71a3('0x42')]);_0x38f928['where']=qs[_0x71a3('0x3c')](_[_0x71a3('0x44')](_0x18e375[_0x71a3('0x3b')],_0x4af495['filters']));if(_0x18e375['query'][_0x71a3('0x45')]){_0x38f928[_0x71a3('0x43')]=_[_0x71a3('0x46')](_0x38f928['where'],{'$or':_[_0x71a3('0x34')](_0x38f928['attributes'],function(_0x158136){var _0x405040={};_0x405040[_0x158136]={'$like':'%'+_0x18e375[_0x71a3('0x3b')]['filter']+'%'};return _0x405040;})});}_0x38f928=_[_0x71a3('0x46')]({},_0x38f928,_0x18e375['options']);return _0x50bf5e[_0x71a3('0x7a')](_0x38f928);}})[_0x71a3('0x2a')](function(_0x333ab6){if(_0x333ab6){_0x4f2bec=_0x333ab6[_0x71a3('0x50')];if(!_0x18e375[_0x71a3('0x3b')]['hasOwnProperty'](_0x71a3('0x40'))){_0x38f928[_0x71a3('0x24')]=qs['limit'](_0x18e375['query'][_0x71a3('0x24')]);_0x38f928[_0x71a3('0x21')]=qs[_0x71a3('0x21')](_0x18e375['query'][_0x71a3('0x21')]);}return _0x50bf5e[_0x71a3('0x7a')](_0x38f928);}})[_0x71a3('0x2a')](function(_0x2fab3e){if(_0x2fab3e){return _0x2fab3e?{'count':_0x4f2bec,'rows':_0x2fab3e}:null;}})[_0x71a3('0x2a')](respondWithResult(_0x27cad5,null))[_0x71a3('0x4c')](handleError(_0x27cad5,null));};exports[_0x71a3('0x7d')]=function(_0x4ca034,_0x1b3b05,_0xd87f34){var _0x3e8cce={};var _0x2fc088={};var _0x5776c8;var _0xdb80f1;return db[_0x71a3('0x35')][_0x71a3('0x7b')]({'where':{'id':_0x4ca034[_0x71a3('0x4e')]['id']}})[_0x71a3('0x2a')](handleEntityNotFound(_0x1b3b05,null))[_0x71a3('0x2a')](function(_0x12a46c){if(_0x12a46c){_0x5776c8=_0x12a46c;_0x2fc088[_0x71a3('0x3a')]=_['keys'](db[_0x71a3('0x7e')]['rawAttributes']);_0x2fc088[_0x71a3('0x3b')]=_[_0x71a3('0x4f')](_0x4ca034[_0x71a3('0x3b')]);_0x2fc088[_0x71a3('0x3c')]=_['intersection'](_0x2fc088['model'],_0x2fc088['query']);_0x3e8cce[_0x71a3('0x3f')]=_[_0x71a3('0x3d')](_0x2fc088[_0x71a3('0x3a')],qs[_0x71a3('0x3e')](_0x4ca034[_0x71a3('0x3b')][_0x71a3('0x3e')]));_0x3e8cce[_0x71a3('0x3f')]=_0x3e8cce[_0x71a3('0x3f')][_0x71a3('0x50')]?_0x3e8cce[_0x71a3('0x3f')]:_0x2fc088['model'];_0x3e8cce[_0x71a3('0x41')]=qs[_0x71a3('0x42')](_0x4ca034[_0x71a3('0x3b')][_0x71a3('0x42')]);_0x3e8cce[_0x71a3('0x43')]=qs[_0x71a3('0x3c')](_['pick'](_0x4ca034[_0x71a3('0x3b')],_0x2fc088['filters']));if(_0x4ca034[_0x71a3('0x3b')]['filter']){_0x3e8cce[_0x71a3('0x43')]=_[_0x71a3('0x46')](_0x3e8cce['where'],{'$or':_[_0x71a3('0x34')](_0x3e8cce['attributes'],function(_0x3d59f8){var _0x4aca5f={};_0x4aca5f[_0x3d59f8]={'$like':'%'+_0x4ca034[_0x71a3('0x3b')][_0x71a3('0x45')]+'%'};return _0x4aca5f;})});}_0x3e8cce=_['merge']({},_0x3e8cce,_0x4ca034[_0x71a3('0x48')]);return _0x5776c8[_0x71a3('0x7d')](_0x3e8cce);}})[_0x71a3('0x2a')](function(_0xf0bded){if(_0xf0bded){_0xdb80f1=_0xf0bded[_0x71a3('0x50')];if(!_0x4ca034[_0x71a3('0x3b')][_0x71a3('0x7f')](_0x71a3('0x40'))){_0x3e8cce['limit']=qs[_0x71a3('0x24')](_0x4ca034[_0x71a3('0x3b')][_0x71a3('0x24')]);_0x3e8cce['offset']=qs[_0x71a3('0x21')](_0x4ca034[_0x71a3('0x3b')][_0x71a3('0x21')]);}return _0x5776c8['getTeams'](_0x3e8cce);}})['then'](function(_0x2149ee){if(_0x2149ee){return _0x2149ee?{'count':_0xdb80f1,'rows':_0x2149ee}:null;}})[_0x71a3('0x2a')](respondWithResult(_0x1b3b05,null))['catch'](handleError(_0x1b3b05,null));};exports[_0x71a3('0x80')]=function(_0x844dba,_0x15d28b,_0x3137b9){var _0x902b73=_0x844dba[_0x71a3('0x55')][_0x71a3('0x74')];var _0x5709ba;return db[_0x71a3('0x7e')][_0x71a3('0x81')]({'where':{'id':_0x902b73},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0x71a3('0x31'),_0x71a3('0x82'),'voicePause',_0x71a3('0x83')],'raw':!![]}]})[_0x71a3('0x2a')](function(_0x32f347){if(_0x32f347){_0x5709ba=_0x32f347;var _0x57b620=_['flatMap'](_0x32f347,function(_0x41d926){var _0x1f7ecd=_0x41d926[_0x71a3('0x2b')]({'plain':!![]});return _0x1f7ecd[_0x71a3('0x84')];});return db[_0x71a3('0x35')][_0x71a3('0x51')]({'where':{'id':_0x844dba[_0x71a3('0x4e')]['id']}})[_0x71a3('0x2a')](function(_0x17636b){return db['sequelize'][_0x71a3('0x54')](function(_0x5c63d0){return _0x17636b[_0x71a3('0x80')](_0x902b73,{'transaction':_0x5c63d0})[_0x71a3('0x2a')](function(){return BPromise[_0x71a3('0x85')](_0x5709ba,function(_0x474438){return db['TeamVoicePrefix'][_0x71a3('0x86')]({'TeamId':_0x474438['id'],'VoicePrefixId':_0x844dba[_0x71a3('0x4e')]['id']},{'transaction':_0x5c63d0});});})[_0x71a3('0x2a')](function(){return BPromise[_0x71a3('0x85')](_0x57b620,function(_0x26635c){return db['UserVoicePrefix'][_0x71a3('0x87')]({'where':{'UserId':_0x26635c['id'],'VoicePrefixId':_0x844dba[_0x71a3('0x4e')]['id']},'transaction':_0x5c63d0});});})['then'](function(){_0x57b620[_0x71a3('0x88')](function(_0x4cde32){socket[_0x71a3('0x76')](_0x71a3('0x77'),{'UserId':_0x4cde32['id'],'VoicePrefixId':_0x17636b['id']});});});});});}})[_0x71a3('0x2a')](respondWithStatusCode(_0x15d28b,null))[_0x71a3('0x4c')](handleError(_0x15d28b,null));};exports[_0x71a3('0x89')]=function(_0x5d880f,_0x3b8781,_0x5b6dac){return db[_0x71a3('0x7e')][_0x71a3('0x81')]({'where':{'id':_0x5d880f[_0x71a3('0x3b')][_0x71a3('0x74')]},'attributes':['id'],'include':[{'model':db[_0x71a3('0x7c')],'as':_0x71a3('0x84'),'attributes':['id'],'raw':!![]}]})[_0x71a3('0x2a')](handleEntityNotFound(_0x3b8781,null))[_0x71a3('0x2a')](function(_0x408b2a){var _0x2f7b7c=_[_0x71a3('0x34')](_0x408b2a,'id');var _0x2bd265=[];var _0x3d1710=[];var _0x17951c=squel['select']();_0x17951c['field']('tq.TeamId')[_0x71a3('0x8a')]('team_has_voice_prefixes','tq')[_0x71a3('0x8b')](_0x71a3('0x8c'),'ut',_0x71a3('0x8d'))[_0x71a3('0x43')]('VoicePrefixId\x20=\x20?',_0x5d880f[_0x71a3('0x4e')]['id']);for(var _0x44ac81=0x0;_0x44ac81<_0x408b2a[_0x71a3('0x50')];_0x44ac81+=0x1){let _0x3de32c=_0x408b2a[_0x44ac81];for(var _0x29e932=0x0;_0x29e932<_0x3de32c[_0x71a3('0x84')][_0x71a3('0x50')];_0x29e932+=0x1){let _0x15e9f7=_0x3de32c[_0x71a3('0x84')][_0x29e932];var _0x554aa2=_0x17951c[_0x71a3('0x8e')]();_0x554aa2['where']('ut.UserId\x20=\x20?',_0x15e9f7['id']);_0x3d1710[_0x71a3('0x69')](db[_0x71a3('0x71')][_0x71a3('0x3b')](_0x554aa2[_0x71a3('0x8f')](),{'type':db[_0x71a3('0x71')][_0x71a3('0x90')]['SELECT']})[_0x71a3('0x2a')](function(_0x1fca5c){if(_0x1fca5c[_0x71a3('0x50')]===0x1){return _0x15e9f7['id'];}else{var _0x47167a=_[_0x71a3('0x91')](_[_0x71a3('0x34')](_0x1fca5c,'TeamId'),function(_0x4b62e8){return _[_0x71a3('0x92')](_0x2f7b7c,_0x4b62e8);});if(_0x47167a){return _0x15e9f7['id'];}}}));}}return BPromise[_0x71a3('0x93')](_0x3d1710)[_0x71a3('0x2a')](function(_0x52f2f1){_0x2bd265=_(_0x2bd265)[_0x71a3('0x94')](_0x52f2f1)[_0x71a3('0x95')]()[_0x71a3('0x96')]();return db['VoicePrefix']['find']({'where':{'id':_0x5d880f[_0x71a3('0x4e')]['id']}})[_0x71a3('0x2a')](function(_0x4aef3e){return db[_0x71a3('0x71')][_0x71a3('0x54')](function(_0x292568){return _0x4aef3e[_0x71a3('0x89')](_0x5d880f['query'][_0x71a3('0x74')],{'transaction':_0x292568})[_0x71a3('0x2a')](function(){if(!_[_0x71a3('0x97')](_0x2bd265)){return _0x4aef3e[_0x71a3('0x78')](_0x2bd265,{'transaction':_0x292568});}})[_0x71a3('0x2a')](function(){_0x2bd265[_0x71a3('0x88')](function(_0x3a66f8){socket[_0x71a3('0x76')](_0x71a3('0x79'),{'UserId':_0x3a66f8,'VoicePrefixId':_0x4aef3e['id']});});});});});});})[_0x71a3('0x2a')](respondWithStatusCode(_0x3b8781,null))[_0x71a3('0x4c')](handleError(_0x3b8781,null));}; \ No newline at end of file +var _0x80ed=['../../mysqldb','redis','defaults','./voicePrefix.socket','register','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','get','VoicePrefixes','UserProfileResource','sendStatus','stack','name','send','index','map','VoicePrefix','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','type','filter','merge','options','includeAll','include','rows','catch','show','length','find','params','describe','create','sequelize','body','VoiceExtension','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','exten','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','VoicePrefixId','VoiceExtensionId','bulkCreate','Extensions\x20creation\x20failed','push','callerIdAll','Set','No\x20callerid\x20available','${EXTEN:','charAt','system-','findById','addAgents','ids','omit','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','getAgents','User','pick','getTeams','findOne','Team','nolimit','addTeams','findAll','Agents','online','voicePause','interface','flatMap','transaction','each','TeamVoicePrefix','UserVoicePrefix','forEach','removeTeams','field','tq.TeamId','from','team_has_voice_prefixes','join','user_has_teams','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','TeamId','includes','union','compact','value','isEmpty','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x3017eb,_0x263305){var _0x48df25=function(_0x54db96){while(--_0x54db96){_0x3017eb['push'](_0x3017eb['shift']());}};_0x48df25(++_0x263305);}(_0x80ed,0x11c));var _0xd80e=function(_0x459970,_0x2edbdf){_0x459970=_0x459970-0x0;var _0x8a148e=_0x80ed[_0x459970];return _0x8a148e;};'use strict';var emlformat=require(_0xd80e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd80e('0x1'));var jsonpatch=require(_0xd80e('0x2'));var rp=require(_0xd80e('0x3'));var moment=require('moment');var BPromise=require(_0xd80e('0x4'));var Mustache=require(_0xd80e('0x5'));var util=require(_0xd80e('0x6'));var path=require(_0xd80e('0x7'));var sox=require('sox');var csv=require(_0xd80e('0x8'));var ejs=require(_0xd80e('0x9'));var fs=require('fs');var fs_extra=require(_0xd80e('0xa'));var _=require('lodash');var squel=require(_0xd80e('0xb'));var crypto=require(_0xd80e('0xc'));var jsforce=require(_0xd80e('0xd'));var deskjs=require(_0xd80e('0xe'));var toCsv=require(_0xd80e('0x8'));var querystring=require(_0xd80e('0xf'));var Papa=require(_0xd80e('0x10'));var Redis=require(_0xd80e('0x11'));var authService=require(_0xd80e('0x12'));var qs=require(_0xd80e('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd80e('0x14'));var logger=require(_0xd80e('0x15'))(_0xd80e('0x16'));var utils=require(_0xd80e('0x17'));var config=require(_0xd80e('0x18'));var licenseUtil=require(_0xd80e('0x19'));var db=require(_0xd80e('0x1a'))['db'];config[_0xd80e('0x1b')]=_[_0xd80e('0x1c')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xd80e('0x1d'))[_0xd80e('0x1e')](socket);function respondWithStatusCode(_0x3096ae,_0x1e8b63){_0x1e8b63=_0x1e8b63||0xcc;return function(_0x449c60){if(_0x449c60){return _0x3096ae['sendStatus'](_0x1e8b63);}return _0x3096ae[_0xd80e('0x1f')](_0x1e8b63)[_0xd80e('0x20')]();};}function respondWithResult(_0x3124e8,_0x3b48ae){_0x3b48ae=_0x3b48ae||0xc8;return function(_0x40a4d5){if(_0x40a4d5){return _0x3124e8[_0xd80e('0x1f')](_0x3b48ae)[_0xd80e('0x21')](_0x40a4d5);}};}function respondWithFilteredResult(_0x22ab67,_0x49e3e5){return function(_0x21ceec){if(_0x21ceec){var _0x1cc576=typeof _0x49e3e5[_0xd80e('0x22')]===_0xd80e('0x23')&&typeof _0x49e3e5['limit']===_0xd80e('0x23');var _0x175c67=_0x21ceec[_0xd80e('0x24')];var _0x527237=_0x1cc576?0x0:_0x49e3e5[_0xd80e('0x22')];var _0x2ef8a1=_0x1cc576?_0x21ceec[_0xd80e('0x24')]:_0x49e3e5[_0xd80e('0x22')]+_0x49e3e5[_0xd80e('0x25')];var _0x5509d4;if(_0x2ef8a1>=_0x175c67){_0x2ef8a1=_0x175c67;_0x5509d4=0xc8;}else{_0x5509d4=0xce;}_0x22ab67['status'](_0x5509d4);return _0x22ab67[_0xd80e('0x26')](_0xd80e('0x27'),_0x527237+'-'+_0x2ef8a1+'/'+_0x175c67)[_0xd80e('0x21')](_0x21ceec);}return null;};}function patchUpdates(_0x2d46e7){return function(_0x3eb3ca){try{jsonpatch[_0xd80e('0x28')](_0x3eb3ca,_0x2d46e7,!![]);}catch(_0x43152c){return BPromise['reject'](_0x43152c);}return _0x3eb3ca[_0xd80e('0x29')]();};}function saveUpdates(_0x57d70,_0x170109){return function(_0x5b0d6d){if(_0x5b0d6d){return _0x5b0d6d[_0xd80e('0x2a')](_0x57d70)[_0xd80e('0x2b')](function(_0xe9bb59){return _0xe9bb59;});}return null;};}function removeEntity(_0x482779,_0x521aa4){return function(_0x5420e7){if(_0x5420e7){return _0x5420e7[_0xd80e('0x2c')]()['then'](function(){var _0x9f9287=_0x5420e7[_0xd80e('0x2d')]({'plain':!![]});var _0x4e8ed9=_0xd80e('0x2e');return db[_0xd80e('0x2f')][_0xd80e('0x2c')]({'where':{'type':_0x4e8ed9,'resourceId':_0x9f9287['id']}})[_0xd80e('0x2b')](function(){return _0x5420e7;});})['then'](function(){_0x482779[_0xd80e('0x1f')](0xcc)[_0xd80e('0x20')]();});}};}function handleEntityNotFound(_0x845451,_0x39088b){return function(_0x2b1aaf){if(!_0x2b1aaf){_0x845451[_0xd80e('0x30')](0x194);}return _0x2b1aaf;};}function handleError(_0x289685,_0x138f19){_0x138f19=_0x138f19||0x1f4;return function(_0x5522dd){logger['error'](_0x5522dd[_0xd80e('0x31')]);if(_0x5522dd[_0xd80e('0x32')]){delete _0x5522dd[_0xd80e('0x32')];}_0x289685[_0xd80e('0x1f')](_0x138f19)[_0xd80e('0x33')](_0x5522dd);};}exports[_0xd80e('0x34')]=function(_0x506842,_0x568d82){var _0x39c124={},_0x2d6ae5={},_0x380f4f={'count':0x0,'rows':[]};var _0x122a72=_[_0xd80e('0x35')](db[_0xd80e('0x36')][_0xd80e('0x37')],function(_0x1a0dfe){return{'name':_0x1a0dfe['fieldName'],'type':_0x1a0dfe['type'][_0xd80e('0x38')]};});_0x2d6ae5[_0xd80e('0x39')]=_[_0xd80e('0x35')](_0x122a72,_0xd80e('0x32'));_0x2d6ae5[_0xd80e('0x3a')]=_[_0xd80e('0x3b')](_0x506842[_0xd80e('0x3a')]);_0x2d6ae5[_0xd80e('0x3c')]=_[_0xd80e('0x3d')](_0x2d6ae5[_0xd80e('0x39')],_0x2d6ae5['query']);_0x39c124[_0xd80e('0x3e')]=_['intersection'](_0x2d6ae5[_0xd80e('0x39')],qs[_0xd80e('0x3f')](_0x506842[_0xd80e('0x3a')][_0xd80e('0x3f')]));_0x39c124['attributes']=_0x39c124[_0xd80e('0x3e')]['length']?_0x39c124[_0xd80e('0x3e')]:_0x2d6ae5['model'];if(!_0x506842[_0xd80e('0x3a')][_0xd80e('0x40')]('nolimit')){_0x39c124[_0xd80e('0x25')]=qs[_0xd80e('0x25')](_0x506842[_0xd80e('0x3a')]['limit']);_0x39c124[_0xd80e('0x22')]=qs[_0xd80e('0x22')](_0x506842[_0xd80e('0x3a')][_0xd80e('0x22')]);}_0x39c124[_0xd80e('0x41')]=qs[_0xd80e('0x42')](_0x506842[_0xd80e('0x3a')][_0xd80e('0x42')]);_0x39c124[_0xd80e('0x43')]=qs['filters'](_['pick'](_0x506842['query'],_0x2d6ae5[_0xd80e('0x3c')]),_0x122a72);if(_0x506842[_0xd80e('0x3a')]['filter']){_0x39c124[_0xd80e('0x43')]=_['merge'](_0x39c124[_0xd80e('0x43')],{'$or':_['map'](_0x122a72,function(_0x7bc136){if(_0x7bc136[_0xd80e('0x44')]!=='VIRTUAL'){var _0x58d58a={};_0x58d58a[_0x7bc136[_0xd80e('0x32')]]={'$like':'%'+_0x506842[_0xd80e('0x3a')][_0xd80e('0x45')]+'%'};return _0x58d58a;}})});}_0x39c124=_[_0xd80e('0x46')]({},_0x39c124,_0x506842[_0xd80e('0x47')]);var _0x19de99={'where':_0x39c124[_0xd80e('0x43')]};return db[_0xd80e('0x36')][_0xd80e('0x24')](_0x19de99)[_0xd80e('0x2b')](function(_0x1bbb36){_0x380f4f[_0xd80e('0x24')]=_0x1bbb36;if(_0x506842[_0xd80e('0x3a')][_0xd80e('0x48')]){_0x39c124[_0xd80e('0x49')]=[{'all':!![]}];}return db[_0xd80e('0x36')]['findAll'](_0x39c124);})['then'](function(_0x5bdea5){_0x380f4f[_0xd80e('0x4a')]=_0x5bdea5;return _0x380f4f;})['then'](respondWithFilteredResult(_0x568d82,_0x39c124))[_0xd80e('0x4b')](handleError(_0x568d82,null));};exports[_0xd80e('0x4c')]=function(_0x551bd5,_0x15a880){var _0x2612e7={'raw':![],'where':{'id':_0x551bd5['params']['id']}},_0x7c394f={};_0x7c394f['model']=_['keys'](db[_0xd80e('0x36')]['rawAttributes']);_0x7c394f[_0xd80e('0x3a')]=_[_0xd80e('0x3b')](_0x551bd5[_0xd80e('0x3a')]);_0x7c394f[_0xd80e('0x3c')]=_[_0xd80e('0x3d')](_0x7c394f['model'],_0x7c394f[_0xd80e('0x3a')]);_0x2612e7[_0xd80e('0x3e')]=_[_0xd80e('0x3d')](_0x7c394f['model'],qs[_0xd80e('0x3f')](_0x551bd5[_0xd80e('0x3a')][_0xd80e('0x3f')]));_0x2612e7['attributes']=_0x2612e7[_0xd80e('0x3e')][_0xd80e('0x4d')]?_0x2612e7[_0xd80e('0x3e')]:_0x7c394f[_0xd80e('0x39')];if(_0x551bd5[_0xd80e('0x3a')][_0xd80e('0x48')]){_0x2612e7['include']=[{'all':!![]}];}_0x2612e7=_['merge']({},_0x2612e7,_0x551bd5[_0xd80e('0x47')]);return db[_0xd80e('0x36')][_0xd80e('0x4e')](_0x2612e7)['then'](handleEntityNotFound(_0x15a880,null))['then'](respondWithResult(_0x15a880,null))[_0xd80e('0x4b')](handleError(_0x15a880,null));};exports[_0xd80e('0x2c')]=function(_0x183f78,_0x1c0da8){return db[_0xd80e('0x36')]['find']({'where':{'id':_0x183f78[_0xd80e('0x4f')]['id']}})['then'](handleEntityNotFound(_0x1c0da8,null))[_0xd80e('0x2b')](removeEntity(_0x1c0da8,null))[_0xd80e('0x4b')](handleError(_0x1c0da8,null));};exports['describe']=function(_0x29af86,_0xd19881){return db[_0xd80e('0x36')][_0xd80e('0x50')]()[_0xd80e('0x2b')](respondWithResult(_0xd19881,null))[_0xd80e('0x4b')](handleError(_0xd19881,null));};exports[_0xd80e('0x51')]=function(_0x50be26,_0x178c51){var _0x377e68;return db[_0xd80e('0x52')]['transaction'](function(_0x52ab04){return db[_0xd80e('0x36')][_0xd80e('0x51')](_0x50be26[_0xd80e('0x53')],{'transaction':_0x52ab04})[_0xd80e('0x2b')](function(_0x2f66eb){_0x377e68=_0x2f66eb[_0xd80e('0x2d')]({'plain':!![]});return db[_0xd80e('0x54')][_0xd80e('0x4e')]({'where':{'id':_0x377e68['VoiceExtensionId']},'raw':!![]})[_0xd80e('0x2b')](function(_0x5d6590){return createVoicePrefixExtensions(_0x377e68,_0x5d6590,_0x52ab04);});});})[_0xd80e('0x2b')](function(){var _0x3c184c=_0x50be26[_0xd80e('0x55')][_0xd80e('0x2d')]({'plain':!![]});if(!_0x3c184c)throw new Error(_0xd80e('0x56'));if(_0x3c184c[_0xd80e('0x57')]==='user'){var _0x13270c=_0x377e68;return db['UserProfileSection'][_0xd80e('0x4e')]({'where':{'name':_0xd80e('0x2e'),'userProfileId':_0x3c184c['userProfileId']},'raw':!![]})['then'](function(_0x402c0f){if(_0x402c0f&&_0x402c0f[_0xd80e('0x58')]===0x0){return db[_0xd80e('0x2f')]['create']({'name':_0x13270c['name'],'resourceId':_0x13270c['id'],'type':_0x402c0f[_0xd80e('0x32')],'sectionId':_0x402c0f['id']},{})[_0xd80e('0x2b')](function(){return _0x377e68;});}else{return _0x377e68;}})['catch'](function(_0x386918){logger[_0xd80e('0x59')](_0xd80e('0x5a'),_0x386918);throw _0x386918;});}return _0x377e68;})['then'](respondWithResult(_0x178c51,null))[_0xd80e('0x4b')](handleError(_0x178c51,null));};function Extension(_0x589c0b,_0x720eab,_0x392704,_0x3d8e46){this[_0xd80e('0x5b')]='from-sip';this[_0xd80e('0x5c')]=_0x589c0b;this['app']=_0x392704;this[_0xd80e('0x44')]='system';this[_0xd80e('0x5d')]=_0xd80e('0x5e');this[_0xd80e('0x5f')]=_0x720eab;this[_0xd80e('0x60')]=_0x3d8e46;}function createVoicePrefixExtensions(_0x53dd96,_0x1738ff,_0x280798){return new BPromise(function(_0x5d775f,_0x2ebfea){var _0x391e0c=new Extension(formatPrefixName(_0x53dd96[_0xd80e('0x61')]),0x1,_0xd80e('0x62'),'Voice\x20Prefix');_0x391e0c[_0xd80e('0x63')]=_0x53dd96['id'];return db[_0xd80e('0x54')]['create'](_0x391e0c,{'transaction':_0x280798})[_0xd80e('0x2b')](function(_0x22c680){var _0x136040=_0x22c680['get']({'plain':!![]});var _0x562ed7=_['map'](addVoicePrefixExtensions(_0x53dd96,_0x1738ff),function(_0x5f241c){_0x5f241c[_0xd80e('0x64')]=_0x136040['id'];_0x5f241c['VoicePrefixId']=_0x53dd96['id'];return _0x5f241c;});return db[_0xd80e('0x54')][_0xd80e('0x65')](_0x562ed7,{'transaction':_0x280798})[_0xd80e('0x2b')](function(_0x4e1b08){if(!_0x4e1b08){return _0x2ebfea(_0xd80e('0x66'));}else{return _0x5d775f(_0x4e1b08);}})[_0xd80e('0x4b')](function(_0x2b3ad6){return _0x2ebfea(_0x2b3ad6);});});;});};function addVoicePrefixExtensions(_0x1a351b,_0x43ab7b){var _0x2a34cd=[];var _0x385453=formatPrefixName(_0x1a351b[_0xd80e('0x61')]);_0x2a34cd[_0xd80e('0x67')](new Extension(_0x385453,0x2,'Set','CDR(prefix)='+_0x1a351b[_0xd80e('0x32')]));if(_0x1a351b[_0xd80e('0x68')]){_0x2a34cd[_0xd80e('0x67')](new Extension(_0x385453,0x3,_0xd80e('0x69'),'PREFIX-CALLERIDALL='+_0x1a351b[_0xd80e('0x68')]));}else{_0x2a34cd[_0xd80e('0x67')](new Extension(_0x385453,0x3,_0xd80e('0x62'),_0xd80e('0x6a')));}_0x2a34cd[_0xd80e('0x67')](new Extension(_0x385453,0x4,'goto',_0x43ab7b[_0xd80e('0x5b')]+','+_0xd80e('0x6b')+(0x8+_0x1a351b[_0xd80e('0x32')][_0xd80e('0x4d')])+'}'+','+0x1));return _0x2a34cd;}function formatPrefixName(_0x53971e){var _0x215f2d='_';for(var _0x29be62=0x0;_0x29be62<_0x53971e[_0xd80e('0x4d')];_0x29be62++){if(_0x53971e[_0xd80e('0x6c')](_0x29be62)=='-'){_0x215f2d+=_0x53971e[_0xd80e('0x6c')](_0x29be62);}else{_0x215f2d+='['+_0x53971e[_0xd80e('0x6c')](_0x29be62)+']';}}_0x215f2d+='.';return _0x215f2d;}exports['update']=function(_0x3e3176,_0x393fb6,_0x5243c7){var _0x44cf88=_0x3e3176[_0xd80e('0x53')];_0x44cf88[_0xd80e('0x61')]=_0xd80e('0x6d')+_0x44cf88['name']+'-';return db[_0xd80e('0x52')]['transaction'](function(_0x314fbb){return db[_0xd80e('0x36')][_0xd80e('0x2a')](_0x44cf88,{'where':{'id':_0x44cf88['id']},'transaction':_0x314fbb})[_0xd80e('0x2b')](function(){return db[_0xd80e('0x54')]['destroy']({'where':{'VoicePrefixId':_0x44cf88['id']},'transaction':_0x314fbb})[_0xd80e('0x2b')](function(){return db[_0xd80e('0x54')][_0xd80e('0x4e')]({'where':{'id':_0x44cf88[_0xd80e('0x64')]},'raw':!![]})['then'](function(_0x46c926){return createVoicePrefixExtensions(_0x44cf88,_0x46c926,_0x314fbb);});});});})[_0xd80e('0x2b')](function(){return db['VoicePrefix'][_0xd80e('0x6e')](_0x44cf88['id']);})[_0xd80e('0x2b')](respondWithResult(_0x393fb6,null))[_0xd80e('0x4b')](handleError(_0x393fb6,null));};exports[_0xd80e('0x6f')]=function(_0x3feb77,_0x8b2fc4,_0x4a0dea){return db['VoicePrefix'][_0xd80e('0x4e')]({'where':{'id':_0x3feb77['params']['id']}})['then'](handleEntityNotFound(_0x8b2fc4,null))[_0xd80e('0x2b')](function(_0x1c830c){if(_0x1c830c){return _0x1c830c[_0xd80e('0x6f')](_0x3feb77[_0xd80e('0x53')][_0xd80e('0x70')],_[_0xd80e('0x71')](_0x3feb77[_0xd80e('0x53')],[_0xd80e('0x70'),'id'])||{})['spread'](function(_0x2d80d1){for(var _0xc5455e=0x0;_0xc5455e<_0x3feb77[_0xd80e('0x53')][_0xd80e('0x70')]['length'];_0xc5455e+=0x1){socket[_0xd80e('0x72')](_0xd80e('0x73'),{'UserId':Number(_0x3feb77['body'][_0xd80e('0x70')][_0xc5455e]),'VoicePrefixId':Number(_0x3feb77[_0xd80e('0x4f')]['id'])});}return _0x2d80d1;});}})['then'](respondWithResult(_0x8b2fc4,null))[_0xd80e('0x4b')](handleError(_0x8b2fc4,null));};exports[_0xd80e('0x74')]=function(_0x472dd3,_0x3fb194,_0x18299b){return db[_0xd80e('0x36')][_0xd80e('0x4e')]({'where':{'id':_0x472dd3[_0xd80e('0x4f')]['id']}})[_0xd80e('0x2b')](handleEntityNotFound(_0x3fb194,null))[_0xd80e('0x2b')](function(_0x5d8e7c){if(_0x5d8e7c){return _0x5d8e7c[_0xd80e('0x74')](_0x472dd3[_0xd80e('0x3a')]['ids'])[_0xd80e('0x2b')](function(){if(_[_0xd80e('0x75')](_0x472dd3[_0xd80e('0x3a')]['ids'])){for(var _0x2090f4=0x0;_0x2090f4<_0x472dd3['query'][_0xd80e('0x70')][_0xd80e('0x4d')];_0x2090f4+=0x1){socket[_0xd80e('0x72')](_0xd80e('0x76'),{'UserId':Number(_0x472dd3[_0xd80e('0x3a')]['ids'][_0x2090f4]),'VoicePrefixId':Number(_0x472dd3[_0xd80e('0x4f')]['id'])});}}else{socket[_0xd80e('0x72')](_0xd80e('0x76'),{'UserId':Number(_0x472dd3[_0xd80e('0x3a')][_0xd80e('0x70')]),'VoicePrefixId':Number(_0x472dd3[_0xd80e('0x4f')]['id'])});}});}})[_0xd80e('0x2b')](respondWithStatusCode(_0x3fb194,null))[_0xd80e('0x4b')](handleError(_0x3fb194,null));};exports[_0xd80e('0x77')]=function(_0x28b7dc,_0x30a3d0,_0x99f183){var _0x31fd22={};var _0x1873d2={};var _0x5ddd1f;var _0x30ba45;return db['VoicePrefix']['findOne']({'where':{'id':_0x28b7dc['params']['id']}})[_0xd80e('0x2b')](handleEntityNotFound(_0x30a3d0,null))[_0xd80e('0x2b')](function(_0x2d8f13){if(_0x2d8f13){_0x5ddd1f=_0x2d8f13;_0x1873d2[_0xd80e('0x39')]=_['keys'](db[_0xd80e('0x78')][_0xd80e('0x37')]);_0x1873d2[_0xd80e('0x3a')]=_['keys'](_0x28b7dc['query']);_0x1873d2[_0xd80e('0x3c')]=_['intersection'](_0x1873d2[_0xd80e('0x39')],_0x1873d2[_0xd80e('0x3a')]);_0x31fd22[_0xd80e('0x3e')]=_[_0xd80e('0x3d')](_0x1873d2[_0xd80e('0x39')],qs[_0xd80e('0x3f')](_0x28b7dc[_0xd80e('0x3a')]['fields']));_0x31fd22['attributes']=_0x31fd22['attributes'][_0xd80e('0x4d')]?_0x31fd22[_0xd80e('0x3e')]:_0x1873d2[_0xd80e('0x39')];_0x31fd22[_0xd80e('0x41')]=qs[_0xd80e('0x42')](_0x28b7dc[_0xd80e('0x3a')][_0xd80e('0x42')]);_0x31fd22[_0xd80e('0x43')]=qs[_0xd80e('0x3c')](_[_0xd80e('0x79')](_0x28b7dc[_0xd80e('0x3a')],_0x1873d2[_0xd80e('0x3c')]));if(_0x28b7dc[_0xd80e('0x3a')]['filter']){_0x31fd22[_0xd80e('0x43')]=_[_0xd80e('0x46')](_0x31fd22[_0xd80e('0x43')],{'$or':_[_0xd80e('0x35')](_0x31fd22[_0xd80e('0x3e')],function(_0x14ed09){var _0x34fcb2={};_0x34fcb2[_0x14ed09]={'$like':'%'+_0x28b7dc[_0xd80e('0x3a')][_0xd80e('0x45')]+'%'};return _0x34fcb2;})});}_0x31fd22=_[_0xd80e('0x46')]({},_0x31fd22,_0x28b7dc['options']);return _0x5ddd1f[_0xd80e('0x77')](_0x31fd22);}})[_0xd80e('0x2b')](function(_0x3e36e4){if(_0x3e36e4){_0x30ba45=_0x3e36e4[_0xd80e('0x4d')];if(!_0x28b7dc['query']['hasOwnProperty']('nolimit')){_0x31fd22[_0xd80e('0x25')]=qs[_0xd80e('0x25')](_0x28b7dc['query'][_0xd80e('0x25')]);_0x31fd22[_0xd80e('0x22')]=qs[_0xd80e('0x22')](_0x28b7dc['query'][_0xd80e('0x22')]);}return _0x5ddd1f['getAgents'](_0x31fd22);}})[_0xd80e('0x2b')](function(_0x247ebc){if(_0x247ebc){return _0x247ebc?{'count':_0x30ba45,'rows':_0x247ebc}:null;}})['then'](respondWithResult(_0x30a3d0,null))[_0xd80e('0x4b')](handleError(_0x30a3d0,null));};exports[_0xd80e('0x7a')]=function(_0x273551,_0x3d0f54,_0x511baa){var _0x366559={};var _0x494718={};var _0x120907;var _0x39721f;return db[_0xd80e('0x36')][_0xd80e('0x7b')]({'where':{'id':_0x273551[_0xd80e('0x4f')]['id']}})[_0xd80e('0x2b')](handleEntityNotFound(_0x3d0f54,null))[_0xd80e('0x2b')](function(_0x23514b){if(_0x23514b){_0x120907=_0x23514b;_0x494718[_0xd80e('0x39')]=_[_0xd80e('0x3b')](db[_0xd80e('0x7c')]['rawAttributes']);_0x494718['query']=_['keys'](_0x273551[_0xd80e('0x3a')]);_0x494718[_0xd80e('0x3c')]=_[_0xd80e('0x3d')](_0x494718[_0xd80e('0x39')],_0x494718[_0xd80e('0x3a')]);_0x366559[_0xd80e('0x3e')]=_[_0xd80e('0x3d')](_0x494718[_0xd80e('0x39')],qs['fields'](_0x273551[_0xd80e('0x3a')]['fields']));_0x366559[_0xd80e('0x3e')]=_0x366559[_0xd80e('0x3e')][_0xd80e('0x4d')]?_0x366559['attributes']:_0x494718[_0xd80e('0x39')];_0x366559['order']=qs[_0xd80e('0x42')](_0x273551['query'][_0xd80e('0x42')]);_0x366559[_0xd80e('0x43')]=qs['filters'](_['pick'](_0x273551[_0xd80e('0x3a')],_0x494718[_0xd80e('0x3c')]));if(_0x273551[_0xd80e('0x3a')][_0xd80e('0x45')]){_0x366559[_0xd80e('0x43')]=_[_0xd80e('0x46')](_0x366559[_0xd80e('0x43')],{'$or':_['map'](_0x366559[_0xd80e('0x3e')],function(_0x5c8d28){var _0x33afc6={};_0x33afc6[_0x5c8d28]={'$like':'%'+_0x273551[_0xd80e('0x3a')][_0xd80e('0x45')]+'%'};return _0x33afc6;})});}_0x366559=_[_0xd80e('0x46')]({},_0x366559,_0x273551[_0xd80e('0x47')]);return _0x120907['getTeams'](_0x366559);}})['then'](function(_0x42e910){if(_0x42e910){_0x39721f=_0x42e910[_0xd80e('0x4d')];if(!_0x273551[_0xd80e('0x3a')][_0xd80e('0x40')](_0xd80e('0x7d'))){_0x366559[_0xd80e('0x25')]=qs[_0xd80e('0x25')](_0x273551[_0xd80e('0x3a')][_0xd80e('0x25')]);_0x366559[_0xd80e('0x22')]=qs[_0xd80e('0x22')](_0x273551[_0xd80e('0x3a')][_0xd80e('0x22')]);}return _0x120907['getTeams'](_0x366559);}})[_0xd80e('0x2b')](function(_0x54eaad){if(_0x54eaad){return _0x54eaad?{'count':_0x39721f,'rows':_0x54eaad}:null;}})[_0xd80e('0x2b')](respondWithResult(_0x3d0f54,null))[_0xd80e('0x4b')](handleError(_0x3d0f54,null));};exports[_0xd80e('0x7e')]=function(_0x3e60bf,_0x47184c,_0x53fbbd){var _0x5c108f=_0x3e60bf[_0xd80e('0x53')][_0xd80e('0x70')];var _0x4f010e;return db[_0xd80e('0x7c')][_0xd80e('0x7f')]({'where':{'id':_0x5c108f},'attributes':['id'],'include':[{'model':db[_0xd80e('0x78')],'as':_0xd80e('0x80'),'attributes':['id','name',_0xd80e('0x81'),_0xd80e('0x82'),_0xd80e('0x83')],'raw':!![]}]})[_0xd80e('0x2b')](function(_0x16737b){if(_0x16737b){_0x4f010e=_0x16737b;var _0xac3eff=_[_0xd80e('0x84')](_0x16737b,function(_0x3be383){var _0x50b24d=_0x3be383['get']({'plain':!![]});return _0x50b24d[_0xd80e('0x80')];});return db[_0xd80e('0x36')][_0xd80e('0x4e')]({'where':{'id':_0x3e60bf[_0xd80e('0x4f')]['id']}})[_0xd80e('0x2b')](function(_0x2c80ed){return db[_0xd80e('0x52')][_0xd80e('0x85')](function(_0x83a318){return _0x2c80ed[_0xd80e('0x7e')](_0x5c108f,{'transaction':_0x83a318})[_0xd80e('0x2b')](function(){return BPromise[_0xd80e('0x86')](_0x4f010e,function(_0x33e712){return db[_0xd80e('0x87')]['upsert']({'TeamId':_0x33e712['id'],'VoicePrefixId':_0x3e60bf[_0xd80e('0x4f')]['id']},{'transaction':_0x83a318});});})[_0xd80e('0x2b')](function(){return BPromise['each'](_0xac3eff,function(_0x2f90b3){return db[_0xd80e('0x88')]['findOrCreate']({'where':{'UserId':_0x2f90b3['id'],'VoicePrefixId':_0x3e60bf[_0xd80e('0x4f')]['id']},'transaction':_0x83a318});});})['then'](function(){_0xac3eff[_0xd80e('0x89')](function(_0x25455c){socket[_0xd80e('0x72')]('userVoicePrefix:save',{'UserId':_0x25455c['id'],'VoicePrefixId':_0x2c80ed['id']});});});});});}})[_0xd80e('0x2b')](respondWithStatusCode(_0x47184c,null))[_0xd80e('0x4b')](handleError(_0x47184c,null));};exports[_0xd80e('0x8a')]=function(_0x35bc9a,_0x598a2e,_0x1ba292){return db[_0xd80e('0x7c')][_0xd80e('0x7f')]({'where':{'id':_0x35bc9a[_0xd80e('0x3a')]['ids']},'attributes':['id'],'include':[{'model':db[_0xd80e('0x78')],'as':_0xd80e('0x80'),'attributes':['id'],'raw':!![]}]})[_0xd80e('0x2b')](handleEntityNotFound(_0x598a2e,null))[_0xd80e('0x2b')](function(_0x3a6e2d){var _0x4ba15d=_[_0xd80e('0x35')](_0x3a6e2d,'id');var _0x2635e9=[];var _0x21baed=[];var _0x570b33=squel['select']();_0x570b33[_0xd80e('0x8b')](_0xd80e('0x8c'))[_0xd80e('0x8d')](_0xd80e('0x8e'),'tq')[_0xd80e('0x8f')](_0xd80e('0x90'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xd80e('0x43')](_0xd80e('0x91'),_0x35bc9a[_0xd80e('0x4f')]['id']);for(var _0x24c913=0x0;_0x24c913<_0x3a6e2d[_0xd80e('0x4d')];_0x24c913+=0x1){let _0x302063=_0x3a6e2d[_0x24c913];for(var _0x5a477c=0x0;_0x5a477c<_0x302063[_0xd80e('0x80')][_0xd80e('0x4d')];_0x5a477c+=0x1){let _0x54cbd5=_0x302063['Agents'][_0x5a477c];var _0x33d344=_0x570b33[_0xd80e('0x92')]();_0x33d344[_0xd80e('0x43')](_0xd80e('0x93'),_0x54cbd5['id']);_0x21baed[_0xd80e('0x67')](db[_0xd80e('0x52')][_0xd80e('0x3a')](_0x33d344[_0xd80e('0x94')](),{'type':db[_0xd80e('0x52')]['QueryTypes']['SELECT']})[_0xd80e('0x2b')](function(_0x1387b7){if(_0x1387b7[_0xd80e('0x4d')]===0x1){return _0x54cbd5['id'];}else{var _0xc8b46=_['every'](_[_0xd80e('0x35')](_0x1387b7,_0xd80e('0x95')),function(_0x13590b){return _[_0xd80e('0x96')](_0x4ba15d,_0x13590b);});if(_0xc8b46){return _0x54cbd5['id'];}}}));}}return BPromise['all'](_0x21baed)['then'](function(_0x527b34){_0x2635e9=_(_0x2635e9)[_0xd80e('0x97')](_0x527b34)[_0xd80e('0x98')]()[_0xd80e('0x99')]();return db['VoicePrefix'][_0xd80e('0x4e')]({'where':{'id':_0x35bc9a[_0xd80e('0x4f')]['id']}})['then'](function(_0x5b72de){return db[_0xd80e('0x52')][_0xd80e('0x85')](function(_0x2a46e7){return _0x5b72de[_0xd80e('0x8a')](_0x35bc9a['query'][_0xd80e('0x70')],{'transaction':_0x2a46e7})[_0xd80e('0x2b')](function(){if(!_[_0xd80e('0x9a')](_0x2635e9)){return _0x5b72de[_0xd80e('0x74')](_0x2635e9,{'transaction':_0x2a46e7});}})[_0xd80e('0x2b')](function(){_0x2635e9[_0xd80e('0x89')](function(_0x45a047){socket[_0xd80e('0x72')]('userVoicePrefix:remove',{'UserId':_0x45a047,'VoicePrefixId':_0x5b72de['id']});});});});});});})[_0xd80e('0x2b')](respondWithStatusCode(_0x598a2e,null))[_0xd80e('0x4b')](handleError(_0x598a2e,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index adef0b6..22f0bcc 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 _0xec4f=['hook','exports','events','../../mysqldb','VoicePrefix','update','emit','hasOwnProperty'];(function(_0x1aa15a,_0x1a0e91){var _0x3c2b45=function(_0x5b7e76){while(--_0x5b7e76){_0x1aa15a['push'](_0x1aa15a['shift']());}};_0x3c2b45(++_0x1a0e91);}(_0xec4f,0x112));var _0xfec4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xec4f[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xfec4('0x0'));var VoicePrefix=require(_0xfec4('0x1'))['db'][_0xfec4('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xfec4('0x3'),'afterDestroy':'remove'};function emitEvent(_0x5dba20){return function(_0xe281b1,_0x1b04b3,_0x435197){VoicePrefixEvents[_0xfec4('0x4')](_0x5dba20+':'+_0xe281b1['id'],_0xe281b1);VoicePrefixEvents[_0xfec4('0x4')](_0x5dba20,_0xe281b1);_0x435197(null);};}for(var e in events){if(events[_0xfec4('0x5')](e)){var event=events[e];VoicePrefix[_0xfec4('0x6')](e,emitEvent(event));}}module[_0xfec4('0x7')]=VoicePrefixEvents; \ No newline at end of file +var _0x6fb5=['remove','emit','hook','exports','events','../../mysqldb','VoicePrefix','setMaxListeners','save'];(function(_0x4774d3,_0x35092f){var _0x519686=function(_0xbcc31a){while(--_0xbcc31a){_0x4774d3['push'](_0x4774d3['shift']());}};_0x519686(++_0x35092f);}(_0x6fb5,0x67));var _0x56fb=function(_0x563358,_0x4d245f){_0x563358=_0x563358-0x0;var _0x57431e=_0x6fb5[_0x563358];return _0x57431e;};'use strict';var EventEmitter=require(_0x56fb('0x0'));var VoicePrefix=require(_0x56fb('0x1'))['db'][_0x56fb('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x56fb('0x3')](0x0);var events={'afterCreate':_0x56fb('0x4'),'afterUpdate':'update','afterDestroy':_0x56fb('0x5')};function emitEvent(_0x1ade26){return function(_0x264a7d,_0x4ac5c7,_0x1c0d3d){VoicePrefixEvents[_0x56fb('0x6')](_0x1ade26+':'+_0x264a7d['id'],_0x264a7d);VoicePrefixEvents[_0x56fb('0x6')](_0x1ade26,_0x264a7d);_0x1c0d3d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoicePrefix[_0x56fb('0x7')](e,emitEvent(event));}}module[_0x56fb('0x8')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index f504150..a7070a7 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 _0xf2b2=['exports','define','VoicePrefix','voice_prefixes','lodash','util','../../config/logger','api','moment','bluebird','rimraf'];(function(_0x3d5a62,_0x371b8e){var _0x18a47a=function(_0x2e302e){while(--_0x2e302e){_0x3d5a62['push'](_0x3d5a62['shift']());}};_0x18a47a(++_0x371b8e);}(_0xf2b2,0x16f));var _0x2f2b=function(_0x41d602,_0x33cead){_0x41d602=_0x41d602-0x0;var _0x8034d2=_0xf2b2[_0x41d602];return _0x8034d2;};'use strict';var _=require(_0x2f2b('0x0'));var util=require(_0x2f2b('0x1'));var logger=require(_0x2f2b('0x2'))(_0x2f2b('0x3'));var moment=require(_0x2f2b('0x4'));var BPromise=require(_0x2f2b('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x2f2b('0x6'));var config=require('../../config/environment');var attributes=require('./voicePrefix.attributes');module[_0x2f2b('0x7')]=function(_0x231eeb,_0x4c1049){return _0x231eeb[_0x2f2b('0x8')](_0x2f2b('0x9'),attributes,{'tableName':_0x2f2b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdc64=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','VoicePrefix','lodash','util'];(function(_0x328f3f,_0x136175){var _0xc76b5d=function(_0x5ec9e0){while(--_0x5ec9e0){_0x328f3f['push'](_0x328f3f['shift']());}};_0xc76b5d(++_0x136175);}(_0xdc64,0xb9));var _0x4dc6=function(_0x215c79,_0xf25903){_0x215c79=_0x215c79-0x0;var _0x34b239=_0xdc64[_0x215c79];return _0x34b239;};'use strict';var _=require(_0x4dc6('0x0'));var util=require(_0x4dc6('0x1'));var logger=require(_0x4dc6('0x2'))(_0x4dc6('0x3'));var moment=require(_0x4dc6('0x4'));var BPromise=require(_0x4dc6('0x5'));var rp=require(_0x4dc6('0x6'));var fs=require('fs');var path=require(_0x4dc6('0x7'));var rimraf=require(_0x4dc6('0x8'));var config=require('../../config/environment');var attributes=require('./voicePrefix.attributes');module[_0x4dc6('0x9')]=function(_0xcdcbda,_0x39f60f){return _0xcdcbda['define'](_0x4dc6('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 178c91e..bec9254 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 _0xcac3=['register','request','then','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','VoicePrefix,\x20%s,\x20%s','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./voicePrefix.socket'];(function(_0x103080,_0x40ac65){var _0x2d05a0=function(_0x3f844d){while(--_0x3f844d){_0x103080['push'](_0x103080['shift']());}};_0x2d05a0(++_0x40ac65);}(_0xcac3,0x193));var _0x3cac=function(_0x201f73,_0x17489c){_0x201f73=_0x201f73-0x0;var _0x24516d=_0xcac3[_0x201f73];return _0x24516d;};'use strict';var _=require('lodash');var util=require(_0x3cac('0x0'));var moment=require(_0x3cac('0x1'));var BPromise=require(_0x3cac('0x2'));var rs=require(_0x3cac('0x3'));var fs=require('fs');var Redis=require(_0x3cac('0x4'));var db=require(_0x3cac('0x5'))['db'];var utils=require(_0x3cac('0x6'));var logger=require(_0x3cac('0x7'))(_0x3cac('0x8'));var config=require(_0x3cac('0x9'));var jayson=require(_0x3cac('0xa'));var client=jayson[_0x3cac('0xb')][_0x3cac('0xc')]({'port':0x232a});config[_0x3cac('0xd')]=_[_0x3cac('0xe')](config[_0x3cac('0xd')],{'host':_0x3cac('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3cac('0xd')]));require(_0x3cac('0x10'))[_0x3cac('0x11')](socket);function respondWithRpcPromise(_0x306664,_0x131e0d,_0x5a3ece){return new BPromise(function(_0x1e8fef,_0x169e39){return client[_0x3cac('0x12')](_0x306664,_0x5a3ece)[_0x3cac('0x13')](function(_0x1c5c70){logger['info']('VoicePrefix,\x20%s,\x20%s',_0x131e0d,_0x3cac('0x14'));logger[_0x3cac('0x15')](_0x3cac('0x16'),_0x131e0d,_0x3cac('0x14'),JSON[_0x3cac('0x17')](_0x1c5c70));if(_0x1c5c70[_0x3cac('0x18')]){if(_0x1c5c70[_0x3cac('0x18')]['code']===0x1f4){logger[_0x3cac('0x18')](_0x3cac('0x19'),_0x131e0d,_0x1c5c70[_0x3cac('0x18')][_0x3cac('0x1a')]);return _0x169e39(_0x1c5c70[_0x3cac('0x18')][_0x3cac('0x1a')]);}logger[_0x3cac('0x18')](_0x3cac('0x19'),_0x131e0d,_0x1c5c70[_0x3cac('0x18')][_0x3cac('0x1a')]);return _0x1e8fef(_0x1c5c70[_0x3cac('0x18')][_0x3cac('0x1a')]);}else{logger[_0x3cac('0x1b')](_0x3cac('0x19'),_0x131e0d,_0x3cac('0x14'));_0x1e8fef(_0x1c5c70[_0x3cac('0x1c')][_0x3cac('0x1a')]);}})[_0x3cac('0x1d')](function(_0x3cb08f){logger[_0x3cac('0x18')](_0x3cac('0x19'),_0x131e0d,_0x3cb08f);_0x169e39(_0x3cb08f);});});} \ No newline at end of file +var _0x67d1=['client','redis','localhost','socket.io-emitter','./voicePrefix.socket','register','request','then','info','request\x20sent','VoicePrefix,\x20%s,\x20%s,\x20%s','error','code','VoicePrefix,\x20%s,\x20%s','message','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x516d0d,_0x38542a){var _0x232a04=function(_0x2012cd){while(--_0x2012cd){_0x516d0d['push'](_0x516d0d['shift']());}};_0x232a04(++_0x38542a);}(_0x67d1,0xf1));var _0x167d=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0x67d1[_0x4a53d];return _0x27410e;};'use strict';var _=require('lodash');var util=require(_0x167d('0x0'));var moment=require(_0x167d('0x1'));var BPromise=require('bluebird');var rs=require(_0x167d('0x2'));var fs=require('fs');var Redis=require(_0x167d('0x3'));var db=require(_0x167d('0x4'))['db'];var utils=require(_0x167d('0x5'));var logger=require('../../config/logger')(_0x167d('0x6'));var config=require(_0x167d('0x7'));var jayson=require(_0x167d('0x8'));var client=jayson[_0x167d('0x9')]['http']({'port':0x232a});config[_0x167d('0xa')]=_['defaults'](config['redis'],{'host':_0x167d('0xb'),'port':0x18eb});var socket=require(_0x167d('0xc'))(new Redis(config[_0x167d('0xa')]));require(_0x167d('0xd'))[_0x167d('0xe')](socket);function respondWithRpcPromise(_0x43f58f,_0x3bcaab,_0x5904cb){return new BPromise(function(_0x326877,_0x238f44){return client[_0x167d('0xf')](_0x43f58f,_0x5904cb)[_0x167d('0x10')](function(_0x3f0609){logger[_0x167d('0x11')]('VoicePrefix,\x20%s,\x20%s',_0x3bcaab,_0x167d('0x12'));logger['debug'](_0x167d('0x13'),_0x3bcaab,_0x167d('0x12'),JSON['stringify'](_0x3f0609));if(_0x3f0609[_0x167d('0x14')]){if(_0x3f0609[_0x167d('0x14')][_0x167d('0x15')]===0x1f4){logger[_0x167d('0x14')](_0x167d('0x16'),_0x3bcaab,_0x3f0609['error']['message']);return _0x238f44(_0x3f0609[_0x167d('0x14')][_0x167d('0x17')]);}logger[_0x167d('0x14')]('VoicePrefix,\x20%s,\x20%s',_0x3bcaab,_0x3f0609[_0x167d('0x14')]['message']);return _0x326877(_0x3f0609[_0x167d('0x14')]['message']);}else{logger[_0x167d('0x11')](_0x167d('0x16'),_0x3bcaab,_0x167d('0x12'));_0x326877(_0x3f0609['result'][_0x167d('0x17')]);}})[_0x167d('0x18')](function(_0xdbc186){logger['error'](_0x167d('0x16'),_0x3bcaab,_0xdbc186);_0x238f44(_0xdbc186);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 8bf4803..95cd9d0 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 _0xefe3=['./voicePrefix.events','emit','register','length','voicePrefix:'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xefe3,0xf5));var _0x3efe=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xefe3[_0x122ef9];return _0x42fba0;};'use strict';var VoicePrefixEvents=require(_0x3efe('0x0'));var events=['save','remove','update'];function createListener(_0x336f0f,_0xcd5959){return function(_0x28c2d6){_0xcd5959[_0x3efe('0x1')](_0x336f0f,_0x28c2d6);};}function removeListener(_0x48d77b,_0x11125f){return function(){VoicePrefixEvents['removeListener'](_0x48d77b,_0x11125f);};}exports[_0x3efe('0x2')]=function(_0x4b5006){for(var _0x3a1c0a=0x0,_0x60487e=events[_0x3efe('0x3')];_0x3a1c0a<_0x60487e;_0x3a1c0a++){var _0x195d5d=events[_0x3a1c0a];var _0x30d2e8=createListener(_0x3efe('0x4')+_0x195d5d,_0x4b5006);VoicePrefixEvents['on'](_0x195d5d,_0x30d2e8);}}; \ No newline at end of file +var _0xdbfc=['removeListener','length','voicePrefix:','./voicePrefix.events','save','emit'];(function(_0x4af3e8,_0x2eeb30){var _0x3aaf84=function(_0x21fd67){while(--_0x21fd67){_0x4af3e8['push'](_0x4af3e8['shift']());}};_0x3aaf84(++_0x2eeb30);}(_0xdbfc,0x11d));var _0xcdbf=function(_0x5f0dcd,_0x582c76){_0x5f0dcd=_0x5f0dcd-0x0;var _0x1c336a=_0xdbfc[_0x5f0dcd];return _0x1c336a;};'use strict';var VoicePrefixEvents=require(_0xcdbf('0x0'));var events=[_0xcdbf('0x1'),'remove','update'];function createListener(_0x364647,_0x3067d8){return function(_0x3db24f){_0x3067d8[_0xcdbf('0x2')](_0x364647,_0x3db24f);};}function removeListener(_0x26c4cf,_0x1c2ce4){return function(){VoicePrefixEvents[_0xcdbf('0x3')](_0x26c4cf,_0x1c2ce4);};}exports['register']=function(_0x3ffa10){for(var _0x4129cf=0x0,_0x54aeaf=events[_0xcdbf('0x4')];_0x4129cf<_0x54aeaf;_0x4129cf++){var _0x3c077d=events[_0x4129cf];var _0x409a4e=createListener(_0xcdbf('0x5')+_0x3c077d,_0x3ffa10);VoicePrefixEvents['on'](_0x3c077d,_0x409a4e);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 593ee0b..a257ac9 100644 --- a/server/api/voiceQueue/index.js +++ b/server/api/voiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','/:id/blacklists','getBlackLists','post','create','/:id/clone','addTeams','addAgents','addLists','addBlackLists','put','/:id','update','delete','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','path','connect-timeout'];(function(_0x36fbef,_0x4ffc84){var _0x45e270=function(_0x32dd95){while(--_0x32dd95){_0x36fbef['push'](_0x36fbef['shift']());}};_0x45e270(++_0x4ffc84);}(_0xb10b,0x12a));var _0xbb10=function(_0x13f2ec,_0x407206){_0x13f2ec=_0x13f2ec-0x0;var _0x389ca9=_0xb10b[_0x13f2ec];return _0x389ca9;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['getHopperFinals']);router[_0xbb10('0x9')]('/:id/hopper_black',auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);router[_0xbb10('0x9')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router['get'](_0xbb10('0x14'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x15')]);router[_0xbb10('0x9')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x9')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller['getLists']);router[_0xbb10('0x9')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0x1c')]);router[_0xbb10('0x1b')](_0xbb10('0x1d'),auth[_0xbb10('0xb')](),controller['clone']);router[_0xbb10('0x1b')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);router[_0xbb10('0x1b')](_0xbb10('0x14'),auth['isAuthenticated'](),controller[_0xbb10('0x1f')]);router[_0xbb10('0x1b')]('/:id/lists',auth['isAuthenticated'](),controller[_0xbb10('0x20')]);router[_0xbb10('0x1b')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x21')]);router[_0xbb10('0x22')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x24')]);router[_0xbb10('0x25')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth[_0xbb10('0xb')](),controller[_0xbb10('0x26')]);router[_0xbb10('0x25')]('/:id/users',auth[_0xbb10('0xb')](),controller[_0xbb10('0x27')]);router[_0xbb10('0x25')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x28')]);router[_0xbb10('0x25')]('/:id/blacklists',auth[_0xbb10('0xb')](),controller[_0xbb10('0x29')]);module[_0xbb10('0x2a')]=router; \ No newline at end of file +var _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(_0x1deff2,_0x4a9388){var _0x5a651c=function(_0x502f06){while(--_0x502f06){_0x1deff2['push'](_0x1deff2['shift']());}};_0x5a651c(++_0x4a9388);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa9e0[_0x6c993a];return _0x27f547;};'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 0686ccc..66555cb 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 _0x1b48=['Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','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\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\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','ENUM','inbound','outbound','default','fewestcalls','rrmemory','rrordered','ringall','setDataValue','strategy','getDataValue','dialMethod','preview','booked','roundrobin','includes','INTEGER','yes','all','once','periodic_announce','split','join','joinempty','leavewhenempty','BOOLEAN','wrapuptime','Active/Disactive\x20Campaign','progressive','power','predictive','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'];(function(_0x2c2ff4,_0x2f84f5){var _0x218f18=function(_0x1223c3){while(--_0x1223c3){_0x2c2ff4['push'](_0x2c2ff4['shift']());}};_0x218f18(++_0x2f84f5);}(_0x1b48,0x1b6));var _0x81b4=function(_0x33e681,_0x511909){_0x33e681=_0x33e681-0x0;var _0x631a4d=_0x1b48[_0x33e681];return _0x631a4d;};'use strict';var Sequelize=require(_0x81b4('0x0'));module[_0x81b4('0x1')]={'name':{'type':Sequelize[_0x81b4('0x2')],'allowNull':![],'unique':_0x81b4('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x81b4('0x4')](_0x81b4('0x5'),_0x81b4('0x6')),'allowNull':![],'defaultValue':_0x81b4('0x5')},'musiconhold':{'type':Sequelize[_0x81b4('0x2')],'defaultValue':_0x81b4('0x7')},'announce':{'type':Sequelize[_0x81b4('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0x81b4('0x4')]('rr','ringall','leastrecent',_0x81b4('0x8'),'random',_0x81b4('0x9'),'linear','wrandom',_0x81b4('0xa')),'allowNull':![],'defaultValue':_0x81b4('0xb'),'set':function(_0x2f3c95){this[_0x81b4('0xc')](_0x81b4('0xd'),_0x2f3c95?_0x2f3c95:_0x81b4('0x9'));},'get':function(){var _0x1c0dea=this[_0x81b4('0xe')]('type');var _0x8d35ad=this[_0x81b4('0xe')](_0x81b4('0xf'));var _0xc5aefb=this['getDataValue']('strategy');if(_0x1c0dea===_0x81b4('0x6')){if(_0x8d35ad===_0x81b4('0x10')){return null;}if(_0x8d35ad===_0x81b4('0x11')&&![_0x81b4('0x9'),_0x81b4('0x12')][_0x81b4('0x13')](_0xc5aefb)){this['setDataValue']('strategy',_0x81b4('0x9'));}}return _0xc5aefb;}},'servicelevel':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x81b4('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x81b4('0x14')](0xb)},'timeout':{'type':Sequelize[_0x81b4('0x14')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x81b4('0x14')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x81b4('0x2')]},'weight':{'type':Sequelize[_0x81b4('0x14')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x81b4('0x14')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x81b4('0x4')](_0x81b4('0x15'),'no'),'defaultValue':_0x81b4('0x15')},'autopause':{'type':Sequelize[_0x81b4('0x4')]('yes','no',_0x81b4('0x16')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x81b4('0x14')](0xb)},'autopausebusy':{'type':Sequelize[_0x81b4('0x4')](_0x81b4('0x15'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x81b4('0x4')](_0x81b4('0x15'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x81b4('0x14')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize['ENUM'](_0x81b4('0x15'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize['ENUM'](_0x81b4('0x15'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x81b4('0x4')](_0x81b4('0x15'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize['ENUM'](_0x81b4('0x15'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x81b4('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x81b4('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x81b4('0x14')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x81b4('0x14')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x81b4('0x14')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x81b4('0x4')](_0x81b4('0x15'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x81b4('0x4')](_0x81b4('0x15'),'no'),'defaultValue':_0x81b4('0x15')},'announce_holdtime':{'type':Sequelize['ENUM']('yes','no',_0x81b4('0x17')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x81b4('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x81b4('0x4')](_0x81b4('0x15'),'no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize[_0x81b4('0x4')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x81b4('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x81b4('0x2')]},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x81b4('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x81b4('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x81b4('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x81b4('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x81b4('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x81b4('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x81b4('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x81b4('0x2')]},'queue_quantity1':{'type':Sequelize[_0x81b4('0x2')]},'queue_quantity2':{'type':Sequelize[_0x81b4('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0x81b4('0x2')]},'queue_less_than':{'type':Sequelize[_0x81b4('0x2')]},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0x578707){this['setDataValue'](_0x81b4('0x18'),_0x578707?_0x578707['join'](','):[]);},'get':function(){return this[_0x81b4('0xe')](_0x81b4('0x18'))?this[_0x81b4('0xe')]('periodic_announce')[_0x81b4('0x19')](','):[];}},'joinempty':{'type':Sequelize[_0x81b4('0x2')],'defaultValue':_0x81b4('0x15'),'set':function(_0x598e7d){this[_0x81b4('0xc')]('joinempty',_0x598e7d?_0x598e7d[_0x81b4('0x1a')](','):undefined);},'get':function(){return this[_0x81b4('0xe')](_0x81b4('0x1b'))?this[_0x81b4('0xe')](_0x81b4('0x1b'))[_0x81b4('0x19')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x81b4('0x2')],'defaultValue':'no','set':function(_0x35b66d){this[_0x81b4('0xc')](_0x81b4('0x1c'),_0x35b66d?_0x35b66d[_0x81b4('0x1a')](','):undefined);},'get':function(){return this[_0x81b4('0xe')](_0x81b4('0x1c'))?this[_0x81b4('0xe')]('leavewhenempty')['split'](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x81b4('0x4')](_0x81b4('0x15'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM'](_0x81b4('0x15'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x81b4('0x14')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x81b4('0x4')](_0x81b4('0x15'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x81b4('0x2')]},'description':{'type':Sequelize[_0x81b4('0x2')]},'acw':{'type':Sequelize[_0x81b4('0x1d')],'defaultValue':0x0,'set':function(_0x2c1298){this['setDataValue']('acw',_0x2c1298);if(_0x2c1298){if(this[_0x81b4('0xe')](_0x81b4('0x1e'))<0x2){this[_0x81b4('0xc')](_0x81b4('0x1e'),0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x81b4('0x1d')],'defaultValue':0x0,'comment':_0x81b4('0x1f')},'dialMethod':{'type':Sequelize[_0x81b4('0x4')](_0x81b4('0x10'),_0x81b4('0x20'),_0x81b4('0x21'),_0x81b4('0x22'),'booked'),'defaultValue':_0x81b4('0x20'),'comment':_0x81b4('0x23')},'dialLimitChannel':{'type':Sequelize[_0x81b4('0x14')](0x4)[_0x81b4('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x81b4('0x25')},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)[_0x81b4('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.'},'dialPowerLevel':{'type':Sequelize[_0x81b4('0x26')](0x2)['UNSIGNED'],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x81b4('0x27')},'dialPredictiveOptimization':{'type':Sequelize[_0x81b4('0x4')]('agentBusyFactor','dropRate'),'defaultValue':'dropRate','comment':_0x81b4('0x28')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x81b4('0x26')](0x2)[_0x81b4('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x81b4('0x29')},'dialPredictiveInterval':{'type':Sequelize[_0x81b4('0x14')](0x3)[_0x81b4('0x24')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x81b4('0x2a')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x81b4('0x2')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x81b4('0x24')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x81b4('0x2b')},'dialQueueOptions':{'type':Sequelize[_0x81b4('0x2')],'defaultValue':_0x81b4('0x2c'),'comment':_0x81b4('0x2d')},'dialQueueTimeout':{'type':Sequelize[_0x81b4('0x14')](0x3)[_0x81b4('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x81b4('0x2e')},'dialQueueProject':{'type':Sequelize[_0x81b4('0x2')],'comment':_0x81b4('0x2f')},'dialCongestionMaxRetry':{'type':Sequelize[_0x81b4('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x81b4('0x30')},'dialBusyMaxRetry':{'type':Sequelize[_0x81b4('0x14')](0x3)[_0x81b4('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x81b4('0x31')},'dialBusyRetryFrequency':{'type':Sequelize[_0x81b4('0x14')](0x5)[_0x81b4('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x81b4('0x32')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x81b4('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0x81b4('0x33')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x81b4('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x81b4('0x34')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x81b4('0x24')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x81b4('0x35')},'dialTimezone':{'type':Sequelize[_0x81b4('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x81b4('0x2')],'defaultValue':'07:00-22:00,*,*,*'},'dialPrefix':{'type':Sequelize[_0x81b4('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x81b4('0x4')](_0x81b4('0x36'),_0x81b4('0x37'),_0x81b4('0x38')),'defaultValue':_0x81b4('0x36')},'dialAMDActive':{'type':Sequelize[_0x81b4('0x1d')],'defaultValue':0x0,'comment':_0x81b4('0x39')},'dialAMDInitialSilence':{'type':Sequelize[_0x81b4('0x14')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x81b4('0x3a')},'dialAMDGreeting':{'type':Sequelize[_0x81b4('0x14')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x81b4('0x3b')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x81b4('0x14')](0x9)[_0x81b4('0x24')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x81b4('0x3c')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x81b4('0x14')](0x9)[_0x81b4('0x24')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x81b4('0x3d')},'dialAMDMinWordLength':{'type':Sequelize[_0x81b4('0x14')](0x9)[_0x81b4('0x24')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x81b4('0x3e')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0x81b4('0x24')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x81b4('0x24')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x81b4('0x3f')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x81b4('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x81b4('0x40')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x81b4('0x14')](0x9)[_0x81b4('0x24')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize[_0x81b4('0x14')](0x5)[_0x81b4('0x24')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x81b4('0x41')},'dialRecallInQueue':{'type':Sequelize[_0x81b4('0x1d')],'defaultValue':0x0,'comment':_0x81b4('0x42')},'dialOrderByScheduledAt':{'type':Sequelize[_0x81b4('0x4')](_0x81b4('0x43'),_0x81b4('0x44')),'defaultValue':'DESC'},'dialQueueProject2':{'type':Sequelize[_0x81b4('0x2')],'comment':_0x81b4('0x2f')},'dialAgiAfterHangupClient':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x81b4('0x1d')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x81b4('0x14')](0x3)[_0x81b4('0x24')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0x81b4('0x14')](0x3)[_0x81b4('0x24')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x81b4('0x45')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x81b4('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x81b4('0x46')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x81b4('0x14')](0x5)[_0x81b4('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x81b4('0x47')},'dialDropMaxRetry':{'type':Sequelize[_0x81b4('0x14')](0x3)[_0x81b4('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x81b4('0x48')},'dialDropRetryFrequency':{'type':Sequelize[_0x81b4('0x14')](0x5)[_0x81b4('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x81b4('0x49')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x81b4('0x14')](0x3)[_0x81b4('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x81b4('0x4a')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x81b4('0x14')](0x5)[_0x81b4('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x81b4('0x4b')},'dialMachineMaxRetry':{'type':Sequelize[_0x81b4('0x14')](0x3)[_0x81b4('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x81b4('0x4c')},'dialMachineRetryFrequency':{'type':Sequelize[_0x81b4('0x14')](0x5)[_0x81b4('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x81b4('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x81b4('0x14')](0x5)[_0x81b4('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x81b4('0x4d')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x81b4('0x14')],'allowNull':!![],'comment':_0x81b4('0x4e')},'mandatoryDisposition':{'type':Sequelize[_0x81b4('0x1d')],'defaultValue':![],'comment':_0x81b4('0x4f'),'set':function(_0x230616){if(!_0x230616)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0x81b4('0xc')](_0x81b4('0x50'),_0x230616);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x81b4('0x14')](0x3)['UNSIGNED'],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x81b4('0x14')](0x3)[_0x81b4('0x24')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x81b4('0x1d')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize['INTEGER'](0x3)[_0x81b4('0x24')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x81b4('0x1d')],'defaultValue':![]}}; \ No newline at end of file +var _0x43dc=['#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)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','name','ENUM','outbound','default','leastrecent','fewestcalls','rrmemory','wrandom','rrordered','ringall','setDataValue','getDataValue','type','dialMethod','booked','roundrobin','includes','INTEGER','yes','all','once','periodic_announce','join','split','joinempty','leavewhenempty','BOOLEAN','wrapuptime','preview','progressive','power','predictive','Dial\x20Method.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','FLOAT','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence'];(function(_0x1fae05,_0x1503b5){var _0x41bf22=function(_0x2a6419){while(--_0x2a6419){_0x1fae05['push'](_0x1fae05['shift']());}};_0x41bf22(++_0x1503b5);}(_0x43dc,0x64));var _0xc43d=function(_0x486f4a,_0x478dc7){_0x486f4a=_0x486f4a-0x0;var _0x135d99=_0x43dc[_0x486f4a];return _0x135d99;};'use strict';var Sequelize=require(_0xc43d('0x0'));module[_0xc43d('0x1')]={'name':{'type':Sequelize[_0xc43d('0x2')],'allowNull':![],'unique':_0xc43d('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xc43d('0x4')]('inbound',_0xc43d('0x5')),'allowNull':![],'defaultValue':'inbound'},'musiconhold':{'type':Sequelize[_0xc43d('0x2')],'defaultValue':_0xc43d('0x6')},'announce':{'type':Sequelize[_0xc43d('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0xc43d('0x4')]('rr','ringall',_0xc43d('0x7'),_0xc43d('0x8'),'random',_0xc43d('0x9'),'linear',_0xc43d('0xa'),_0xc43d('0xb')),'allowNull':![],'defaultValue':_0xc43d('0xc'),'set':function(_0x11e207){this[_0xc43d('0xd')]('strategy',_0x11e207?_0x11e207:_0xc43d('0x9'));},'get':function(){var _0x523ed2=this[_0xc43d('0xe')](_0xc43d('0xf'));var _0x98da14=this['getDataValue'](_0xc43d('0x10'));var _0x56759a=this['getDataValue']('strategy');if(_0x523ed2===_0xc43d('0x5')){if(_0x98da14==='preview'){return null;}if(_0x98da14===_0xc43d('0x11')&&![_0xc43d('0x9'),_0xc43d('0x12')][_0xc43d('0x13')](_0x56759a)){this[_0xc43d('0xd')]('strategy',_0xc43d('0x9'));}}return _0x56759a;}},'servicelevel':{'type':Sequelize[_0xc43d('0x14')](0xb),'defaultValue':0x0},'context':{'type':Sequelize['STRING'],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xc43d('0x14')](0xb)},'timeout':{'type':Sequelize[_0xc43d('0x14')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0xc43d('0x14')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0xc43d('0x2')]},'weight':{'type':Sequelize[_0xc43d('0x14')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0xc43d('0x14')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0xc43d('0x4')](_0xc43d('0x15'),'no'),'defaultValue':_0xc43d('0x15')},'autopause':{'type':Sequelize[_0xc43d('0x4')](_0xc43d('0x15'),'no',_0xc43d('0x16')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0xc43d('0x14')](0xb)},'autopausebusy':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0xc43d('0x4')]('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0xc43d('0x4')](_0xc43d('0x15'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0xc43d('0x4')](_0xc43d('0x15'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0xc43d('0x4')](_0xc43d('0x15'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize['ENUM'](_0xc43d('0x15'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0xc43d('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0xc43d('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0xc43d('0x14')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0xc43d('0x14')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0xc43d('0x4')](_0xc43d('0x15'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0xc43d('0x4')](_0xc43d('0x15'),'no'),'defaultValue':'yes'},'announce_holdtime':{'type':Sequelize['ENUM'](_0xc43d('0x15'),'no',_0xc43d('0x17')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0xc43d('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0xc43d('0x4')]('yes','no')},'announce_position_limit':{'type':Sequelize[_0xc43d('0x14')](0xb)},'announce_round_seconds':{'type':Sequelize[_0xc43d('0x4')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0xc43d('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0xc43d('0x2')]},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0xc43d('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize['STRING'],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize[_0xc43d('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0xc43d('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xc43d('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0xc43d('0x2')]},'queue_quantity1':{'type':Sequelize[_0xc43d('0x2')]},'queue_quantity2':{'type':Sequelize[_0xc43d('0x2')]},'queue_periodic_announce':{'type':Sequelize['STRING']},'queue_less_than':{'type':Sequelize[_0xc43d('0x2')]},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0x722e79){this[_0xc43d('0xd')](_0xc43d('0x18'),_0x722e79?_0x722e79[_0xc43d('0x19')](','):[]);},'get':function(){return this[_0xc43d('0xe')](_0xc43d('0x18'))?this[_0xc43d('0xe')]('periodic_announce')[_0xc43d('0x1a')](','):[];}},'joinempty':{'type':Sequelize[_0xc43d('0x2')],'defaultValue':_0xc43d('0x15'),'set':function(_0xf62251){this[_0xc43d('0xd')]('joinempty',_0xf62251?_0xf62251['join'](','):undefined);},'get':function(){return this[_0xc43d('0xe')]('joinempty')?this[_0xc43d('0xe')](_0xc43d('0x1b'))[_0xc43d('0x1a')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0xc43d('0x2')],'defaultValue':'no','set':function(_0x3e8071){this[_0xc43d('0xd')](_0xc43d('0x1c'),_0x3e8071?_0x3e8071['join'](','):undefined);},'get':function(){return this[_0xc43d('0xe')](_0xc43d('0x1c'))?this[_0xc43d('0xe')]('leavewhenempty')[_0xc43d('0x1a')](','):undefined;}},'reportholdtime':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0xc43d('0x14')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize['ENUM'](_0xc43d('0x15'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0xc43d('0x2')]},'description':{'type':Sequelize[_0xc43d('0x2')]},'acw':{'type':Sequelize[_0xc43d('0x1d')],'defaultValue':0x0,'set':function(_0x9b2a65){this[_0xc43d('0xd')]('acw',_0x9b2a65);if(_0x9b2a65){if(this[_0xc43d('0xe')](_0xc43d('0x1e'))<0x2){this['setDataValue']('wrapuptime',0x2);}}}},'acwTimeout':{'type':Sequelize[_0xc43d('0x14')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0xc43d('0x1d')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'dialMethod':{'type':Sequelize[_0xc43d('0x4')](_0xc43d('0x1f'),_0xc43d('0x20'),_0xc43d('0x21'),_0xc43d('0x22'),'booked'),'defaultValue':'progressive','comment':_0xc43d('0x23')},'dialLimitChannel':{'type':Sequelize[_0xc43d('0x14')](0x4)[_0xc43d('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize[_0xc43d('0x14')](0x4)[_0xc43d('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xc43d('0x25')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)[_0xc43d('0x24')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0xc43d('0x26')},'dialPredictiveOptimization':{'type':Sequelize[_0xc43d('0x4')](_0xc43d('0x27'),_0xc43d('0x28')),'defaultValue':_0xc43d('0x28'),'comment':_0xc43d('0x29')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0xc43d('0x2a')](0x2)[_0xc43d('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0xc43d('0x2b')},'dialPredictiveInterval':{'type':Sequelize['INTEGER'](0x3)[_0xc43d('0x24')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0xc43d('0x2c')},'dialOriginateCallerIdName':{'type':Sequelize[_0xc43d('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xc43d('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0xc43d('0x14')](0x3)[_0xc43d('0x24')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc43d('0x2d')},'dialQueueOptions':{'type':Sequelize[_0xc43d('0x2')],'defaultValue':'tTxX','comment':_0xc43d('0x2e')},'dialQueueTimeout':{'type':Sequelize[_0xc43d('0x14')](0x3)[_0xc43d('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc43d('0x2f')},'dialQueueProject':{'type':Sequelize[_0xc43d('0x2')],'comment':_0xc43d('0x30')},'dialCongestionMaxRetry':{'type':Sequelize[_0xc43d('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc43d('0x31')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xc43d('0x14')](0x5)[_0xc43d('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0xc43d('0x14')](0x3)[_0xc43d('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xc43d('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc43d('0x32')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xc43d('0x14')](0x3)[_0xc43d('0x24')],'defaultValue':0x3,'comment':_0xc43d('0x33')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xc43d('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0xc43d('0x14')](0x3)[_0xc43d('0x24')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0xc43d('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xc43d('0x2')],'defaultValue':_0xc43d('0x34')},'dialPrefix':{'type':Sequelize[_0xc43d('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0xc43d('0x4')](_0xc43d('0x35'),_0xc43d('0x36'),_0xc43d('0x37')),'defaultValue':_0xc43d('0x35')},'dialAMDActive':{'type':Sequelize[_0xc43d('0x1d')],'defaultValue':0x0,'comment':_0xc43d('0x38')},'dialAMDInitialSilence':{'type':Sequelize[_0xc43d('0x14')](0x9)[_0xc43d('0x24')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xc43d('0x39')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0xc43d('0x24')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xc43d('0x3a')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xc43d('0x14')](0x9)[_0xc43d('0x24')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xc43d('0x3b')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0xc43d('0x24')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xc43d('0x3c')},'dialAMDMinWordLength':{'type':Sequelize[_0xc43d('0x14')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xc43d('0x3d')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xc43d('0x14')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xc43d('0x3e')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0xc43d('0x24')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xc43d('0x3f')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0xc43d('0x24')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xc43d('0x40')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xc43d('0x14')](0x9)[_0xc43d('0x24')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize['INTEGER'](0x5)[_0xc43d('0x24')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':'#RecallMe\x20Timeout\x20(min:1)'},'dialRecallInQueue':{'type':Sequelize[_0xc43d('0x1d')],'defaultValue':0x0,'comment':_0xc43d('0x41')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0xc43d('0x42'),'ASC'),'defaultValue':'DESC'},'dialQueueProject2':{'type':Sequelize[_0xc43d('0x2')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize[_0xc43d('0x1d')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xc43d('0x14')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xc43d('0x43')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0xc43d('0x24')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xc43d('0x44')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xc43d('0x14')](0x3)[_0xc43d('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc43d('0x45')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xc43d('0x14')](0x5)[_0xc43d('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc43d('0x46')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xc43d('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0xc43d('0x14')](0x5)[_0xc43d('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc43d('0x47')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xc43d('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc43d('0x48')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xc43d('0x14')](0x5)[_0xc43d('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0xc43d('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc43d('0x49')},'dialMachineRetryFrequency':{'type':Sequelize[_0xc43d('0x14')](0x5)[_0xc43d('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc43d('0x4a')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xc43d('0x14')](0x3)[_0xc43d('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xc43d('0x14')](0x5)[_0xc43d('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc43d('0x4b')},'mandatoryDispositionPauseId':{'type':Sequelize[_0xc43d('0x14')],'allowNull':!![],'comment':_0xc43d('0x4c')},'mandatoryDisposition':{'type':Sequelize[_0xc43d('0x1d')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x4f517a){if(!_0x4f517a)this['setDataValue'](_0xc43d('0x4d'),null);this[_0xc43d('0xd')](_0xc43d('0x4e'),_0x4f517a);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)[_0xc43d('0x24')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0xc43d('0x1d')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0xc43d('0x14')](0x3)['UNSIGNED'],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0xc43d('0x1d')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 793e71b..dc01670 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(_0x2c480b,_0x3c4260){var _0x1615aa=function(_0x21ed68){while(--_0x21ed68){_0x2c480b['push'](_0x2c480b['shift']());}};_0x1615aa(++_0x3c4260);}(_0x55ca,0x126));var _0xa55c=function(_0x73b1cd,_0x176535){_0x73b1cd=_0x73b1cd-0x0;var _0x243426=_0x55ca[_0x73b1cd];return _0x243426;};'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 _0x9957=['includes','find','type','name','UserProfileResource','destroy','stack','send','fieldName','key','getOptions','include','query','findAll','catch','show','params','model','rawAttributes','filters','attributes','intersection','fields','includeAll','merge','VoiceQueue','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','inbound','UserProfileSection','userProfileId','autoAssociation','error','clone','length','options','omit','updatedAt','user','role','outbound','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getHoppers','findOne','keys','order','sort','where','pick','CmHopper','rows','getHopperHistories','CmHopperHistory','hasOwnProperty','VoiceQueueId','getHopperFinals','CmHopperFinal','nolimit','getHopperBlacks','CmHopperBlack','getTeams','addTeams','Team','Agents','voicePause','interface','penalty','transaction','each','upsert','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','isNil','format','forEach','emit','userVoiceQueue:save','ids','User','field','tq.TeamId','team_has_voice_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','toString','sequelize','QueryTypes','every','all','union','compact','removeTeams','isEmpty','userVoiceQueue:remove','addAgents','online','SIP/%s','removeAgents','isArray','getAgents','getMembers','getLists','addLists','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','createdAt','select','ContactId','CmListId','ListId','from','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','VoiceQueueId\x20=\x20?','onlyIfOpen','cm_contacts','deletedAt\x20IS\x20NULL','COALESCE(phone,\x27\x27)','OrderBy','h.id','ci.item','ci.OrderBy+1','cm_contact_has_items','join','h.scheduledat=?','ci.ItemClass=?','PHONE','removeLists','getBlackLists','CmList','addBlackLists','cm_hopper_black','removeBlackLists','moment','bluebird','util','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','update','then','VoiceQueues','QueueCampaigns','filter','ignore','map','value'];(function(_0xeb80bc,_0xcfc513){var _0x4845a5=function(_0xacaca8){while(--_0xacaca8){_0xeb80bc['push'](_0xeb80bc['shift']());}};_0x4845a5(++_0xcfc513);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var moment=require(_0x7995('0x0'));var BPromise=require(_0x7995('0x1'));var util=require(_0x7995('0x2'));var _=require(_0x7995('0x3'));var squel=require('squel');var Redis=require(_0x7995('0x4'));var qs=require(_0x7995('0x5'));var logger=require(_0x7995('0x6'))(_0x7995('0x7'));var config=require('../../config/environment');var db=require(_0x7995('0x8'))['db'];config[_0x7995('0x9')]=_[_0x7995('0xa')](config[_0x7995('0x9')],{'host':_0x7995('0xb'),'port':0x18eb});var socket=require(_0x7995('0xc'))(new Redis(config['redis']));require(_0x7995('0xd'))[_0x7995('0xe')](socket);function respondWithStatusCode(_0x4a64f7,_0xa2e5f0){_0xa2e5f0=_0xa2e5f0||0xcc;return function(_0x3116fb){if(_0x3116fb){return _0x4a64f7[_0x7995('0xf')](_0xa2e5f0);}return _0x4a64f7[_0x7995('0x10')](_0xa2e5f0)[_0x7995('0x11')]();};}function respondWithResult(_0x1e400a,_0x341672){_0x341672=_0x341672||0xc8;return function(_0x524f7b){if(_0x524f7b){return _0x1e400a[_0x7995('0x10')](_0x341672)[_0x7995('0x12')](_0x524f7b);}};}function respondWithFilteredResult(_0x581f22,_0xb0c872){return function(_0x2cb37a){if(_0x2cb37a){var _0x19a27e=typeof _0xb0c872[_0x7995('0x13')]===_0x7995('0x14')&&typeof _0xb0c872[_0x7995('0x15')]===_0x7995('0x14');var _0x4cc004=_0x2cb37a['count'];var _0x2b4e94=_0x19a27e?0x0:_0xb0c872[_0x7995('0x13')];var _0x24b5bb=_0x19a27e?_0x2cb37a[_0x7995('0x16')]:_0xb0c872[_0x7995('0x13')]+_0xb0c872[_0x7995('0x15')];var _0x2202ce;if(_0x24b5bb>=_0x4cc004){_0x24b5bb=_0x4cc004;_0x2202ce=0xc8;}else{_0x2202ce=0xce;}_0x581f22[_0x7995('0x10')](_0x2202ce);return _0x581f22['set'](_0x7995('0x17'),_0x2b4e94+'-'+_0x24b5bb+'/'+_0x4cc004)['json'](_0x2cb37a);}return null;};}function saveUpdates(_0x2f832e){return function(_0x37f297){if(_0x37f297){return _0x37f297[_0x7995('0x18')](_0x2f832e)[_0x7995('0x19')](function(_0x1e1415){return _0x1e1415;});}return null;};}function removeEntity(_0x37a7d4){return function(_0x4faa60){if(_0x4faa60){return _0x4faa60['destroy']()[_0x7995('0x19')](function(){var _0x5e6f90=_0x4faa60['get']({'plain':!![]});var _0x3ec178=[{'name':_0x7995('0x1a'),'value':'inbound','ignore':![]},{'name':_0x7995('0x1b'),'value':'outbound','ignore':![]}];var _0x4b1a8e=_(_0x3ec178)[_0x7995('0x1c')](_0x7995('0x1d'))[_0x7995('0x1e')](_0x7995('0x1f'))[_0x7995('0x1f')]();if(_[_0x7995('0x20')](_0x4b1a8e,_0x5e6f90['type'])){return;}var _0x32a09a=_[_0x7995('0x21')](_0x3ec178,[_0x7995('0x1f'),_0x5e6f90[_0x7995('0x22')]])[_0x7995('0x23')];return db[_0x7995('0x24')][_0x7995('0x25')]({'where':{'type':_0x32a09a,'resourceId':_0x5e6f90['id']}})[_0x7995('0x19')](function(){return _0x4faa60;});})['then'](function(){_0x37a7d4[_0x7995('0x10')](0xcc)[_0x7995('0x11')]();});}};}function handleEntityNotFound(_0x401dc3){return function(_0x268ce7){if(!_0x268ce7){_0x401dc3[_0x7995('0xf')](0x194);}return _0x268ce7;};}function handleError(_0x2a307e,_0x56691a){_0x56691a=_0x56691a||0x1f4;return function(_0x47625f){logger['error'](_0x47625f[_0x7995('0x26')]);if(_0x47625f[_0x7995('0x23')]){delete _0x47625f[_0x7995('0x23')];}_0x2a307e[_0x7995('0x10')](_0x56691a)[_0x7995('0x27')](_0x47625f);};}exports['index']=function(_0x9b2a15,_0x514445){var _0x456a28={};var _0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['VoiceQueue']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x28')],'type':_0x3573be[_0x7995('0x22')][_0x7995('0x29')]};});_0x456a28=qs[_0x7995('0x2a')](_0x4253e5,_0x9b2a15);var _0x1ca460={'where':_0x456a28['where']};return db['VoiceQueue'][_0x7995('0x16')](_0x1ca460)['then'](function(_0x553671){_0x3250e0[_0x7995('0x16')]=_0x553671;_0x456a28[_0x7995('0x2b')]=qs[_0x7995('0x2b')](_0x9b2a15[_0x7995('0x2c')]);return db['VoiceQueue'][_0x7995('0x2d')](_0x456a28);})[_0x7995('0x19')](function(_0x5dd802){_0x3250e0['rows']=_0x5dd802;return _0x3250e0;})['then'](respondWithFilteredResult(_0x514445,_0x456a28))[_0x7995('0x2e')](handleError(_0x514445,null));};exports[_0x7995('0x2f')]=function(_0x4a176f,_0x3e7020){var _0x51b95d={'raw':![],'where':{'id':_0x4a176f[_0x7995('0x30')]['id']}},_0x37917b={};_0x37917b[_0x7995('0x31')]=_['keys'](db['VoiceQueue'][_0x7995('0x32')]);_0x37917b['query']=_['keys'](_0x4a176f[_0x7995('0x2c')]);_0x37917b[_0x7995('0x33')]=_['intersection'](_0x37917b[_0x7995('0x31')],_0x37917b[_0x7995('0x2c')]);_0x51b95d[_0x7995('0x34')]=_[_0x7995('0x35')](_0x37917b[_0x7995('0x31')],qs['fields'](_0x4a176f[_0x7995('0x2c')][_0x7995('0x36')]));_0x51b95d[_0x7995('0x34')]=_0x51b95d[_0x7995('0x34')]['length']?_0x51b95d[_0x7995('0x34')]:_0x37917b[_0x7995('0x31')];if(_0x4a176f[_0x7995('0x2c')][_0x7995('0x37')]){_0x51b95d[_0x7995('0x2b')]=[{'all':!![]}];}_0x51b95d=_[_0x7995('0x38')]({},_0x51b95d,_0x4a176f['options']);return db[_0x7995('0x39')][_0x7995('0x21')](_0x51b95d)[_0x7995('0x19')](handleEntityNotFound(_0x3e7020,null))[_0x7995('0x19')](respondWithResult(_0x3e7020,null))[_0x7995('0x2e')](handleError(_0x3e7020,null));};exports[_0x7995('0x3a')]=function(_0x14d638,_0x270c0e){return db[_0x7995('0x39')][_0x7995('0x3a')](_0x14d638[_0x7995('0x3b')],{})[_0x7995('0x19')](function(_0x7b4e67){var _0x53cda2=_0x14d638['user'][_0x7995('0x3c')]({'plain':!![]});if(!_0x53cda2)throw new Error(_0x7995('0x3d'));if(_0x53cda2['role']==='user'){var _0x3f8522=_0x7b4e67['get']({'plain':!![]});var _0x504a33=[{'name':_0x7995('0x1a'),'value':_0x7995('0x3e')},{'name':_0x7995('0x1b'),'value':'outbound'}];var _0x46ac4f=_['find'](_0x504a33,[_0x7995('0x1f'),_0x3f8522['type']])['name'];return db[_0x7995('0x3f')][_0x7995('0x21')]({'where':{'name':_0x46ac4f,'userProfileId':_0x53cda2[_0x7995('0x40')]},'raw':!![]})[_0x7995('0x19')](function(_0x599ecb){if(_0x599ecb&&_0x599ecb[_0x7995('0x41')]===0x0){return db[_0x7995('0x24')][_0x7995('0x3a')]({'name':_0x3f8522[_0x7995('0x23')],'resourceId':_0x3f8522['id'],'type':_0x599ecb['name'],'sectionId':_0x599ecb['id']},{})['then'](function(){return _0x7b4e67;});}else{return _0x7b4e67;}})[_0x7995('0x2e')](function(_0x55791b){logger[_0x7995('0x42')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x55791b);throw _0x55791b;});}return _0x7b4e67;})[_0x7995('0x19')](respondWithResult(_0x270c0e,0xc9))['catch'](handleError(_0x270c0e,null));};exports[_0x7995('0x43')]=function(_0x1b0373,_0x4d9245){var _0x3e9e62={'where':{'id':_0x1b0373[_0x7995('0x30')]['id']}},_0x336ff2={};_0x336ff2[_0x7995('0x31')]=_['keys'](db[_0x7995('0x39')][_0x7995('0x32')]);_0x3e9e62[_0x7995('0x34')]=_['intersection'](_0x336ff2[_0x7995('0x31')],qs[_0x7995('0x36')](_0x1b0373[_0x7995('0x2c')][_0x7995('0x36')]));_0x3e9e62[_0x7995('0x34')]=_0x3e9e62['attributes'][_0x7995('0x44')]?_0x3e9e62[_0x7995('0x34')]:_0x336ff2['model'];if(_0x1b0373[_0x7995('0x2c')]['includeAll']){_0x3e9e62[_0x7995('0x2b')]=[{'all':!![]}];}_0x3e9e62=_[_0x7995('0x38')]({},_0x3e9e62,_0x1b0373[_0x7995('0x45')]);return db[_0x7995('0x39')][_0x7995('0x21')](_0x3e9e62)[_0x7995('0x19')](handleEntityNotFound(_0x4d9245,null))[_0x7995('0x19')](function(_0x4d46bc){if(_0x4d46bc){var _0x427dcf=_0x4d46bc[_0x7995('0x3c')]({'plain':!![]});_0x427dcf=qs[_0x7995('0x46')](_0x427dcf,['id','createdAt',_0x7995('0x47')]);_0x1b0373[_0x7995('0x3b')]=_[_0x7995('0x46')](_0x1b0373['body'],['id','createdAt','updatedAt']);return db[_0x7995('0x39')][_0x7995('0x3a')](_['merge'](_0x427dcf,_0x1b0373[_0x7995('0x3b')]),{'include':_0x1b0373[_0x7995('0x2c')][_0x7995('0x37')]?[{'all':!![]}]:undefined})[_0x7995('0x19')](function(_0xc04004){var _0x528c8e=_0x1b0373[_0x7995('0x48')]['get']({'plain':!![]});if(!_0x528c8e)throw new Error(_0x7995('0x3d'));if(_0x528c8e[_0x7995('0x49')]===_0x7995('0x48')){var _0x50c7b5=_0xc04004['get']({'plain':!![]});var _0x54e2b1=[{'name':'VoiceQueues','value':_0x7995('0x3e')},{'name':_0x7995('0x1b'),'value':_0x7995('0x4a')}];var _0x150261=_[_0x7995('0x21')](_0x54e2b1,[_0x7995('0x1f'),_0x50c7b5[_0x7995('0x22')]])[_0x7995('0x23')];return db[_0x7995('0x3f')][_0x7995('0x21')]({'where':{'name':_0x150261,'userProfileId':_0x528c8e[_0x7995('0x40')]},'raw':!![]})[_0x7995('0x19')](function(_0x3da72b){if(_0x3da72b&&_0x3da72b[_0x7995('0x41')]===0x0){return db[_0x7995('0x24')][_0x7995('0x3a')]({'name':_0x50c7b5[_0x7995('0x23')],'resourceId':_0x50c7b5['id'],'type':_0x3da72b[_0x7995('0x23')],'sectionId':_0x3da72b['id']},{})[_0x7995('0x19')](function(){return _0xc04004;});}else{return _0xc04004;}})['catch'](function(_0x56a374){logger[_0x7995('0x42')](_0x7995('0x4b'),_0x56a374);throw _0x56a374;});}return _0xc04004;});}})[_0x7995('0x19')](respondWithResult(_0x4d9245,0xc9))['catch'](handleError(_0x4d9245,null));};exports['update']=function(_0x402fa0,_0x197b52){if(_0x402fa0[_0x7995('0x3b')]['id']){delete _0x402fa0[_0x7995('0x3b')]['id'];}return db['VoiceQueue'][_0x7995('0x21')]({'where':{'id':_0x402fa0[_0x7995('0x30')]['id']}})[_0x7995('0x19')](handleEntityNotFound(_0x197b52,null))[_0x7995('0x19')](saveUpdates(_0x402fa0['body'],null))['then'](respondWithResult(_0x197b52,null))[_0x7995('0x2e')](handleError(_0x197b52,null));};exports[_0x7995('0x25')]=function(_0x6c0221,_0x1d69ce){return db[_0x7995('0x39')][_0x7995('0x21')]({'where':{'id':_0x6c0221[_0x7995('0x30')]['id']}})[_0x7995('0x19')](handleEntityNotFound(_0x1d69ce,null))[_0x7995('0x19')](removeEntity(_0x1d69ce,null))['catch'](handleError(_0x1d69ce,null));};exports[_0x7995('0x4c')]=function(_0x3ec5a8,_0xdf9e38){var _0x1ecfdb={'raw':![],'where':{}};var _0x59c5aa={};var _0x51bf6a={'count':0x0,'rows':[]};return db[_0x7995('0x39')][_0x7995('0x4d')]({'where':{'id':_0x3ec5a8['params']['id']}})[_0x7995('0x19')](handleEntityNotFound(_0xdf9e38,null))[_0x7995('0x19')](function(_0x2e3421){if(_0x2e3421){_0x59c5aa[_0x7995('0x31')]=_[_0x7995('0x4e')](db['CmHopper'][_0x7995('0x32')]);_0x59c5aa['query']=_[_0x7995('0x4e')](_0x3ec5a8[_0x7995('0x2c')]);_0x59c5aa[_0x7995('0x33')]=_[_0x7995('0x35')](_0x59c5aa[_0x7995('0x31')],_0x59c5aa[_0x7995('0x2c')]);_0x1ecfdb[_0x7995('0x34')]=_[_0x7995('0x35')](_0x59c5aa[_0x7995('0x31')],qs[_0x7995('0x36')](_0x3ec5a8[_0x7995('0x2c')][_0x7995('0x36')]));_0x1ecfdb['attributes']=_0x1ecfdb[_0x7995('0x34')][_0x7995('0x44')]?_0x1ecfdb[_0x7995('0x34')]:_0x59c5aa[_0x7995('0x31')];if(!_0x3ec5a8[_0x7995('0x2c')]['hasOwnProperty']('nolimit')){_0x1ecfdb[_0x7995('0x15')]=qs[_0x7995('0x15')](_0x3ec5a8[_0x7995('0x2c')][_0x7995('0x15')]);_0x1ecfdb['offset']=qs[_0x7995('0x13')](_0x3ec5a8['query']['offset']);}_0x1ecfdb[_0x7995('0x4f')]=qs[_0x7995('0x50')](_0x3ec5a8[_0x7995('0x2c')][_0x7995('0x50')]);_0x1ecfdb[_0x7995('0x51')]=qs[_0x7995('0x33')](_[_0x7995('0x52')](_0x3ec5a8[_0x7995('0x2c')],_0x59c5aa[_0x7995('0x33')]));_0x1ecfdb[_0x7995('0x51')]['VoiceQueueId']=_0x2e3421['id'];if(_0x3ec5a8[_0x7995('0x2c')][_0x7995('0x1c')]){_0x1ecfdb[_0x7995('0x51')]=_['merge'](_0x1ecfdb[_0x7995('0x51')],{'$or':_[_0x7995('0x1e')](_0x1ecfdb[_0x7995('0x34')],function(_0x3a7d9d){var _0x3b0d30={};_0x3b0d30[_0x3a7d9d]={'$like':'%'+_0x3ec5a8[_0x7995('0x2c')][_0x7995('0x1c')]+'%'};return _0x3b0d30;})});}_0x1ecfdb=_[_0x7995('0x38')]({},_0x1ecfdb,_0x3ec5a8[_0x7995('0x45')]);return db[_0x7995('0x53')][_0x7995('0x16')]({'where':_0x1ecfdb['where']})['then'](function(_0xd07c1c){_0x51bf6a[_0x7995('0x16')]=_0xd07c1c;if(_0x3ec5a8[_0x7995('0x2c')][_0x7995('0x37')]){_0x1ecfdb['include']=[{'all':!![]}];}return db[_0x7995('0x53')][_0x7995('0x2d')](_0x1ecfdb);})['then'](function(_0x480fdb){_0x51bf6a[_0x7995('0x54')]=_0x480fdb;return _0x51bf6a;});}})[_0x7995('0x19')](respondWithFilteredResult(_0xdf9e38,_0x1ecfdb))['catch'](handleError(_0xdf9e38,null));};exports[_0x7995('0x55')]=function(_0x5b1cba,_0x3758f9){var _0xea9aba={'raw':!![],'where':{}};var _0x4ff9ff={};var _0x5d9d33={'count':0x0,'rows':[]};return db[_0x7995('0x39')]['findOne']({'where':{'id':_0x5b1cba[_0x7995('0x30')]['id']}})[_0x7995('0x19')](handleEntityNotFound(_0x3758f9,null))[_0x7995('0x19')](function(_0x45bd8a){if(_0x45bd8a){_0x4ff9ff[_0x7995('0x31')]=_[_0x7995('0x4e')](db[_0x7995('0x56')][_0x7995('0x32')]);_0x4ff9ff[_0x7995('0x2c')]=_[_0x7995('0x4e')](_0x5b1cba[_0x7995('0x2c')]);_0x4ff9ff[_0x7995('0x33')]=_[_0x7995('0x35')](_0x4ff9ff[_0x7995('0x31')],_0x4ff9ff[_0x7995('0x2c')]);_0xea9aba[_0x7995('0x34')]=_[_0x7995('0x35')](_0x4ff9ff[_0x7995('0x31')],qs[_0x7995('0x36')](_0x5b1cba[_0x7995('0x2c')][_0x7995('0x36')]));_0xea9aba[_0x7995('0x34')]=_0xea9aba[_0x7995('0x34')][_0x7995('0x44')]?_0xea9aba[_0x7995('0x34')]:_0x4ff9ff[_0x7995('0x31')];if(!_0x5b1cba[_0x7995('0x2c')][_0x7995('0x57')]('nolimit')){_0xea9aba[_0x7995('0x15')]=qs[_0x7995('0x15')](_0x5b1cba['query']['limit']);_0xea9aba[_0x7995('0x13')]=qs[_0x7995('0x13')](_0x5b1cba[_0x7995('0x2c')][_0x7995('0x13')]);}_0xea9aba[_0x7995('0x4f')]=qs[_0x7995('0x50')](_0x5b1cba['query'][_0x7995('0x50')]);_0xea9aba[_0x7995('0x51')]=qs[_0x7995('0x33')](_[_0x7995('0x52')](_0x5b1cba[_0x7995('0x2c')],_0x4ff9ff[_0x7995('0x33')]));_0xea9aba[_0x7995('0x51')][_0x7995('0x58')]=_0x45bd8a['id'];if(_0x5b1cba['query'][_0x7995('0x1c')]){_0xea9aba[_0x7995('0x51')]=_['merge'](_0xea9aba['where'],{'$or':_[_0x7995('0x1e')](_0xea9aba[_0x7995('0x34')],function(_0x18e1a2){var _0x3db7a9={};_0x3db7a9[_0x18e1a2]={'$like':'%'+_0x5b1cba[_0x7995('0x2c')]['filter']+'%'};return _0x3db7a9;})});}_0xea9aba=_[_0x7995('0x38')]({},_0xea9aba,_0x5b1cba[_0x7995('0x45')]);return db['CmHopperHistory'][_0x7995('0x16')]({'where':_0xea9aba[_0x7995('0x51')]})['then'](function(_0x1535a3){_0x5d9d33['count']=_0x1535a3;if(_0x5b1cba[_0x7995('0x2c')][_0x7995('0x37')]){_0xea9aba[_0x7995('0x2b')]=[{'all':!![]}];}return db[_0x7995('0x56')][_0x7995('0x2d')](_0xea9aba);})['then'](function(_0x1f0506){_0x5d9d33[_0x7995('0x54')]=_0x1f0506;return _0x5d9d33;});}})[_0x7995('0x19')](respondWithFilteredResult(_0x3758f9,_0xea9aba))['catch'](handleError(_0x3758f9,null));};exports[_0x7995('0x59')]=function(_0x3f3434,_0x350ed3){var _0x308a26={'raw':!![],'where':{}};var _0x5d7018={};var _0x3356fd={'count':0x0,'rows':[]};return db[_0x7995('0x39')][_0x7995('0x4d')]({'where':{'id':_0x3f3434['params']['id']}})['then'](handleEntityNotFound(_0x350ed3,null))[_0x7995('0x19')](function(_0x333379){if(_0x333379){_0x5d7018['model']=_['keys'](db[_0x7995('0x5a')][_0x7995('0x32')]);_0x5d7018[_0x7995('0x2c')]=_[_0x7995('0x4e')](_0x3f3434[_0x7995('0x2c')]);_0x5d7018['filters']=_['intersection'](_0x5d7018[_0x7995('0x31')],_0x5d7018['query']);_0x308a26['attributes']=_[_0x7995('0x35')](_0x5d7018[_0x7995('0x31')],qs[_0x7995('0x36')](_0x3f3434['query'][_0x7995('0x36')]));_0x308a26[_0x7995('0x34')]=_0x308a26[_0x7995('0x34')][_0x7995('0x44')]?_0x308a26[_0x7995('0x34')]:_0x5d7018['model'];if(!_0x3f3434[_0x7995('0x2c')][_0x7995('0x57')](_0x7995('0x5b'))){_0x308a26[_0x7995('0x15')]=qs['limit'](_0x3f3434[_0x7995('0x2c')][_0x7995('0x15')]);_0x308a26['offset']=qs[_0x7995('0x13')](_0x3f3434[_0x7995('0x2c')]['offset']);}_0x308a26[_0x7995('0x4f')]=qs['sort'](_0x3f3434[_0x7995('0x2c')]['sort']);_0x308a26[_0x7995('0x51')]=qs['filters'](_[_0x7995('0x52')](_0x3f3434[_0x7995('0x2c')],_0x5d7018['filters']));_0x308a26[_0x7995('0x51')]['VoiceQueueId']=_0x333379['id'];if(_0x3f3434['query'][_0x7995('0x1c')]){_0x308a26[_0x7995('0x51')]=_[_0x7995('0x38')](_0x308a26[_0x7995('0x51')],{'$or':_['map'](_0x308a26[_0x7995('0x34')],function(_0x35044a){var _0x4bd29f={};_0x4bd29f[_0x35044a]={'$like':'%'+_0x3f3434['query'][_0x7995('0x1c')]+'%'};return _0x4bd29f;})});}_0x308a26=_['merge']({},_0x308a26,_0x3f3434[_0x7995('0x45')]);return db[_0x7995('0x5a')][_0x7995('0x16')]({'where':_0x308a26['where']})['then'](function(_0x2b7852){_0x3356fd['count']=_0x2b7852;if(_0x3f3434[_0x7995('0x2c')][_0x7995('0x37')]){_0x308a26[_0x7995('0x2b')]=[{'all':!![]}];}return db[_0x7995('0x5a')]['findAll'](_0x308a26);})['then'](function(_0x50f880){_0x3356fd[_0x7995('0x54')]=_0x50f880;return _0x3356fd;});}})[_0x7995('0x19')](respondWithFilteredResult(_0x350ed3,_0x308a26))[_0x7995('0x2e')](handleError(_0x350ed3,null));};exports[_0x7995('0x5c')]=function(_0x265f07,_0x168e7f){var _0x59a793={'raw':!![],'where':{}};var _0x53cbec={};var _0x1a2902={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x265f07[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x168e7f,null))['then'](function(_0x35c3f3){if(_0x35c3f3){_0x53cbec[_0x7995('0x31')]=_[_0x7995('0x4e')](db['CmHopperBlack'][_0x7995('0x32')]);_0x53cbec[_0x7995('0x2c')]=_[_0x7995('0x4e')](_0x265f07[_0x7995('0x2c')]);_0x53cbec[_0x7995('0x33')]=_[_0x7995('0x35')](_0x53cbec[_0x7995('0x31')],_0x53cbec[_0x7995('0x2c')]);_0x59a793[_0x7995('0x34')]=_['intersection'](_0x53cbec[_0x7995('0x31')],qs[_0x7995('0x36')](_0x265f07[_0x7995('0x2c')][_0x7995('0x36')]));_0x59a793[_0x7995('0x34')]=_0x59a793['attributes'][_0x7995('0x44')]?_0x59a793[_0x7995('0x34')]:_0x53cbec[_0x7995('0x31')];if(!_0x265f07['query']['hasOwnProperty']('nolimit')){_0x59a793[_0x7995('0x15')]=qs[_0x7995('0x15')](_0x265f07[_0x7995('0x2c')][_0x7995('0x15')]);_0x59a793[_0x7995('0x13')]=qs[_0x7995('0x13')](_0x265f07['query'][_0x7995('0x13')]);}_0x59a793['order']=qs[_0x7995('0x50')](_0x265f07[_0x7995('0x2c')][_0x7995('0x50')]);_0x59a793[_0x7995('0x51')]=qs[_0x7995('0x33')](_[_0x7995('0x52')](_0x265f07[_0x7995('0x2c')],_0x53cbec[_0x7995('0x33')]));_0x59a793[_0x7995('0x51')][_0x7995('0x58')]=_0x35c3f3['id'];if(_0x265f07[_0x7995('0x2c')]['filter']){_0x59a793[_0x7995('0x51')]=_['merge'](_0x59a793[_0x7995('0x51')],{'$or':_[_0x7995('0x1e')](_0x59a793['attributes'],function(_0x493e74){var _0x2a25eb={};_0x2a25eb[_0x493e74]={'$like':'%'+_0x265f07[_0x7995('0x2c')][_0x7995('0x1c')]+'%'};return _0x2a25eb;})});}_0x59a793=_[_0x7995('0x38')]({},_0x59a793,_0x265f07[_0x7995('0x45')]);return db[_0x7995('0x5d')][_0x7995('0x16')]({'where':_0x59a793[_0x7995('0x51')]})[_0x7995('0x19')](function(_0x3c9b3c){_0x1a2902[_0x7995('0x16')]=_0x3c9b3c;if(_0x265f07[_0x7995('0x2c')]['includeAll']){_0x59a793['include']=[{'all':!![]}];}return db[_0x7995('0x5d')][_0x7995('0x2d')](_0x59a793);})[_0x7995('0x19')](function(_0x1531a9){_0x1a2902[_0x7995('0x54')]=_0x1531a9;return _0x1a2902;});}})['then'](respondWithFilteredResult(_0x168e7f,_0x59a793))[_0x7995('0x2e')](handleError(_0x168e7f,null));};exports[_0x7995('0x5e')]=function(_0x5ebf5e,_0x46fc1c){var _0x53d693={};var _0x37416c={};var _0x30cda5;var _0x234a40;return db['VoiceQueue'][_0x7995('0x4d')]({'where':{'id':_0x5ebf5e[_0x7995('0x30')]['id']}})[_0x7995('0x19')](handleEntityNotFound(_0x46fc1c,null))[_0x7995('0x19')](function(_0x11f9fb){if(_0x11f9fb){_0x30cda5=_0x11f9fb;_0x37416c[_0x7995('0x31')]=_[_0x7995('0x4e')](db['Team']['rawAttributes']);_0x37416c['query']=_[_0x7995('0x4e')](_0x5ebf5e[_0x7995('0x2c')]);_0x37416c['filters']=_['intersection'](_0x37416c[_0x7995('0x31')],_0x37416c[_0x7995('0x2c')]);_0x53d693['attributes']=_['intersection'](_0x37416c['model'],qs['fields'](_0x5ebf5e[_0x7995('0x2c')][_0x7995('0x36')]));_0x53d693[_0x7995('0x34')]=_0x53d693[_0x7995('0x34')]['length']?_0x53d693[_0x7995('0x34')]:_0x37416c[_0x7995('0x31')];_0x53d693['order']=qs[_0x7995('0x50')](_0x5ebf5e[_0x7995('0x2c')][_0x7995('0x50')]);_0x53d693['where']=qs[_0x7995('0x33')](_[_0x7995('0x52')](_0x5ebf5e['query'],_0x37416c[_0x7995('0x33')]));if(_0x5ebf5e[_0x7995('0x2c')][_0x7995('0x1c')]){_0x53d693[_0x7995('0x51')]=_[_0x7995('0x38')](_0x53d693[_0x7995('0x51')],{'$or':_[_0x7995('0x1e')](_0x53d693[_0x7995('0x34')],function(_0x4254de){var _0x278004={};_0x278004[_0x4254de]={'$like':'%'+_0x5ebf5e[_0x7995('0x2c')][_0x7995('0x1c')]+'%'};return _0x278004;})});}_0x53d693=_[_0x7995('0x38')]({},_0x53d693,_0x5ebf5e['options']);return _0x30cda5[_0x7995('0x5e')](_0x53d693);}})[_0x7995('0x19')](function(_0x3603e8){if(_0x3603e8){_0x234a40=_0x3603e8[_0x7995('0x44')];if(!_0x5ebf5e['query'][_0x7995('0x57')](_0x7995('0x5b'))){_0x53d693[_0x7995('0x15')]=qs['limit'](_0x5ebf5e[_0x7995('0x2c')][_0x7995('0x15')]);_0x53d693[_0x7995('0x13')]=qs[_0x7995('0x13')](_0x5ebf5e[_0x7995('0x2c')][_0x7995('0x13')]);}return _0x30cda5[_0x7995('0x5e')](_0x53d693);}})['then'](function(_0x35dbd7){if(_0x35dbd7){return _0x35dbd7?{'count':_0x234a40,'rows':_0x35dbd7}:null;}})['then'](respondWithResult(_0x46fc1c,null))[_0x7995('0x2e')](handleError(_0x46fc1c,null));};exports[_0x7995('0x5f')]=function(_0x2190d1,_0x4cae1c){var _0xd012b9=_0x2190d1['body']['teams'];var _0x4ee5ee=_['map'](_0xd012b9,'id');return db[_0x7995('0x60')][_0x7995('0x2d')]({'where':{'id':_0x4ee5ee},'attributes':['id'],'include':[{'model':db['User'],'as':_0x7995('0x61'),'attributes':['id',_0x7995('0x23'),'online',_0x7995('0x62'),_0x7995('0x63')],'raw':!![]}]})[_0x7995('0x19')](function(_0x45a479){if(_0x45a479){var _0x443863=_['flatMap'](_0x45a479,function(_0x38ea3e){var _0x1df81d=_0x38ea3e[_0x7995('0x3c')]({'plain':!![]});_0x1df81d[_0x7995('0x61')]['forEach'](function(_0x428d5a){_0x428d5a[_0x7995('0x64')]=_[_0x7995('0x21')](_0xd012b9,{'id':_0x1df81d['id']})[_0x7995('0x64')];});return _0x1df81d[_0x7995('0x61')];});return db[_0x7995('0x39')][_0x7995('0x21')]({'where':{'id':_0x2190d1[_0x7995('0x30')]['id']}})[_0x7995('0x19')](function(_0x1fda95){return db['sequelize'][_0x7995('0x65')](function(_0x521712){return _0x1fda95[_0x7995('0x5f')](_0x4ee5ee,{'transaction':_0x521712})[_0x7995('0x19')](function(){return BPromise[_0x7995('0x66')](_0xd012b9,function(_0x50eb5e){return db['TeamVoiceQueue'][_0x7995('0x67')]({'TeamId':_0x50eb5e['id'],'VoiceQueueId':_0x2190d1[_0x7995('0x30')]['id'],'penalty':_0x50eb5e['penalty']},{'transaction':_0x521712});});})[_0x7995('0x19')](function(){return BPromise['each'](_0x443863,function(_0x43de18){return db[_0x7995('0x68')][_0x7995('0x69')]({'where':{'UserId':_0x43de18['id'],'VoiceQueueId':_0x2190d1[_0x7995('0x30')]['id']},'defaults':{'penalty':_0x43de18['penalty']},'transaction':_0x521712});});})['then'](function(){return BPromise[_0x7995('0x66')](_[_0x7995('0x1c')](_0x443863,{'online':!![]}),function(_0x365318){return db[_0x7995('0x6a')]['upsert']({'membername':_0x365318[_0x7995('0x23')],'UserId':_0x365318['id'],'queue_name':_0x1fda95[_0x7995('0x23')],'VoiceQueueId':_0x1fda95['id'],'interface':_[_0x7995('0x6b')](_0x365318[_0x7995('0x63')])?util[_0x7995('0x6c')]('SIP/%s',_0x365318['name']):_0x365318['interface'],'paused':_0x365318[_0x7995('0x62')]||![],'penalty':_0x365318[_0x7995('0x64')]},{'transaction':_0x521712});});})['then'](function(){_0x443863[_0x7995('0x6d')](function(_0x5635d6){socket[_0x7995('0x6e')](_0x7995('0x6f'),{'UserId':_0x5635d6['id'],'VoiceQueueId':_0x1fda95['id']});});});});});}})[_0x7995('0x19')](respondWithStatusCode(_0x4cae1c,null))[_0x7995('0x2e')](handleError(_0x4cae1c,null));};exports['removeTeams']=function(_0x3fbafb,_0x2caacd){return db[_0x7995('0x60')][_0x7995('0x2d')]({'where':{'id':_0x3fbafb[_0x7995('0x2c')][_0x7995('0x70')]},'attributes':['id'],'include':[{'model':db[_0x7995('0x71')],'as':_0x7995('0x61'),'attributes':['id'],'raw':!![]}]})[_0x7995('0x19')](handleEntityNotFound(_0x2caacd,null))[_0x7995('0x19')](function(_0x30893a){var _0x2b8d90=_[_0x7995('0x1e')](_0x30893a,'id');var _0x2122af=[];var _0x4ff0b6=[];var _0x764245=squel['select']();_0x764245[_0x7995('0x72')](_0x7995('0x73'))['from'](_0x7995('0x74'),'tq')['join'](_0x7995('0x75'),'ut',_0x7995('0x76'))['where']('VoiceQueueId\x20=\x20?',_0x3fbafb['params']['id']);for(var _0x8f5ecd=0x0;_0x8f5ecd<_0x30893a[_0x7995('0x44')];_0x8f5ecd+=0x1){let _0x139f76=_0x30893a[_0x8f5ecd];for(var _0x2b7bc2=0x0;_0x2b7bc2<_0x139f76['Agents'][_0x7995('0x44')];_0x2b7bc2+=0x1){let _0x2b2814=_0x139f76[_0x7995('0x61')][_0x2b7bc2];var _0x2de960=_0x764245[_0x7995('0x43')]();_0x2de960[_0x7995('0x51')](_0x7995('0x77'),_0x2b2814['id']);_0x4ff0b6[_0x7995('0x78')](db['sequelize'][_0x7995('0x2c')](_0x2de960[_0x7995('0x79')](),{'type':db[_0x7995('0x7a')][_0x7995('0x7b')]['SELECT']})[_0x7995('0x19')](function(_0x3a2958){if(_0x3a2958[_0x7995('0x44')]===0x1){return _0x2b2814['id'];}else{var _0x339e6b=_[_0x7995('0x7c')](_[_0x7995('0x1e')](_0x3a2958,'TeamId'),function(_0x1bc617){return _[_0x7995('0x20')](_0x2b8d90,_0x1bc617);});if(_0x339e6b){return _0x2b2814['id'];}}}));}}return BPromise[_0x7995('0x7d')](_0x4ff0b6)[_0x7995('0x19')](function(_0x3fcc49){_0x2122af=_(_0x2122af)[_0x7995('0x7e')](_0x3fcc49)[_0x7995('0x7f')]()[_0x7995('0x1f')]();return db[_0x7995('0x39')][_0x7995('0x21')]({'where':{'id':_0x3fbafb[_0x7995('0x30')]['id']}})[_0x7995('0x19')](function(_0x64a62d){return db[_0x7995('0x7a')][_0x7995('0x65')](function(_0x370984){return _0x64a62d[_0x7995('0x80')](_0x3fbafb[_0x7995('0x2c')][_0x7995('0x70')],{'transaction':_0x370984})[_0x7995('0x19')](function(){if(!_[_0x7995('0x81')](_0x2122af)){return _0x64a62d['removeAgents'](_0x2122af,{'transaction':_0x370984})['then'](function(){return db[_0x7995('0x6a')][_0x7995('0x25')]({'where':{'VoiceQueueId':_0x3fbafb['params']['id'],'UserId':_0x2122af},'transaction':_0x370984});});}})[_0x7995('0x19')](function(){_0x2122af['forEach'](function(_0x2ce103){socket['emit'](_0x7995('0x82'),{'UserId':_0x2ce103,'VoiceQueueId':_0x64a62d['id']});});});});});});})[_0x7995('0x19')](respondWithStatusCode(_0x2caacd,null))[_0x7995('0x2e')](handleError(_0x2caacd,null));};exports[_0x7995('0x83')]=function(_0x3aa676,_0x1df2a2){var _0xd82313,_0x1fa59d;return db[_0x7995('0x39')][_0x7995('0x21')]({'where':{'id':_0x3aa676['params']['id']}})[_0x7995('0x19')](handleEntityNotFound(_0x1df2a2,null))[_0x7995('0x19')](function(_0x1d0481){if(_0x1d0481){_0x1fa59d=_0x1d0481;return _0x1d0481[_0x7995('0x83')](_0x3aa676['body'][_0x7995('0x70')],_[_0x7995('0x46')](_0x3aa676[_0x7995('0x3b')],[_0x7995('0x70'),'id'])||{})['spread'](function(_0x32c550){for(var _0x37e647=0x0;_0x37e647<_0x3aa676[_0x7995('0x3b')][_0x7995('0x70')][_0x7995('0x44')];_0x37e647+=0x1){socket[_0x7995('0x6e')](_0x7995('0x6f'),{'UserId':Number(_0x3aa676[_0x7995('0x3b')][_0x7995('0x70')][_0x37e647]),'VoiceQueueId':Number(_0x3aa676['params']['id'])});}return _0x32c550;});}})[_0x7995('0x19')](function(_0x5f5496){_0xd82313=_0x5f5496||[];if(_0x1fa59d){return db[_0x7995('0x71')][_0x7995('0x2d')]({'where':{'id':_0x3aa676[_0x7995('0x3b')][_0x7995('0x70')]},'attributes':['id','name',_0x7995('0x84'),_0x7995('0x62'),_0x7995('0x63')],'raw':!![]});}})[_0x7995('0x19')](function(_0x2c715){if(!_[_0x7995('0x81')](_0x2c715)){var _0x3661ab=[];for(var _0x408692=0x0;_0x408692<_0x2c715[_0x7995('0x44')];_0x408692++){if(_0x2c715[_0x408692][_0x7995('0x84')]){_0x3661ab[_0x7995('0x78')](db[_0x7995('0x6a')][_0x7995('0x67')]({'membername':_0x2c715[_0x408692][_0x7995('0x23')],'UserId':_0x2c715[_0x408692]['id'],'queue_name':_0x1fa59d['name'],'VoiceQueueId':_0x1fa59d['id'],'interface':_['isNil'](_0x2c715[_0x408692][_0x7995('0x63')])?util[_0x7995('0x6c')](_0x7995('0x85'),_0x2c715[_0x408692]['name']):_0x2c715[_0x408692][_0x7995('0x63')],'paused':_0x2c715[_0x408692][_0x7995('0x62')]||![],'penalty':_0x3aa676[_0x7995('0x3b')]['penalty']||0x0}));}}return BPromise[_0x7995('0x7d')](_0x3661ab);}})[_0x7995('0x19')](function(){return _0xd82313;})[_0x7995('0x19')](respondWithResult(_0x1df2a2,null))[_0x7995('0x2e')](handleError(_0x1df2a2,null));};exports[_0x7995('0x86')]=function(_0x3d42a3,_0x29fb77){return db[_0x7995('0x39')][_0x7995('0x21')]({'where':{'id':_0x3d42a3[_0x7995('0x30')]['id']}})[_0x7995('0x19')](handleEntityNotFound(_0x29fb77,null))['then'](function(_0x580571){if(_0x580571){return _0x580571[_0x7995('0x86')](_0x3d42a3['query'][_0x7995('0x70')])[_0x7995('0x19')](function(){if(_[_0x7995('0x87')](_0x3d42a3[_0x7995('0x2c')][_0x7995('0x70')])){for(var _0x4eebf4=0x0;_0x4eebf4<_0x3d42a3['query'][_0x7995('0x70')][_0x7995('0x44')];_0x4eebf4+=0x1){socket[_0x7995('0x6e')](_0x7995('0x82'),{'UserId':Number(_0x3d42a3[_0x7995('0x2c')][_0x7995('0x70')][_0x4eebf4]),'VoiceQueueId':Number(_0x3d42a3[_0x7995('0x30')]['id'])});}}else{socket[_0x7995('0x6e')](_0x7995('0x82'),{'UserId':Number(_0x3d42a3[_0x7995('0x2c')]['ids']),'VoiceQueueId':Number(_0x3d42a3[_0x7995('0x30')]['id'])});}});}})[_0x7995('0x19')](function(_0x38e67a){return db[_0x7995('0x6a')]['destroy']({'where':{'VoiceQueueId':_0x3d42a3['params']['id'],'UserId':_0x3d42a3['query']['ids']}})['then'](function(){return _0x38e67a;});})[_0x7995('0x19')](respondWithStatusCode(_0x29fb77,null))['catch'](handleError(_0x29fb77,null));};exports['getAgents']=function(_0x32f19d,_0x44dbb8){var _0x181ed6={};var _0x48b807={};var _0xba00af;var _0x4f008a;return db[_0x7995('0x39')][_0x7995('0x4d')]({'where':{'id':_0x32f19d[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x44dbb8,null))[_0x7995('0x19')](function(_0x14be06){if(_0x14be06){_0xba00af=_0x14be06;_0x48b807[_0x7995('0x31')]=_['keys'](db[_0x7995('0x71')][_0x7995('0x32')]);_0x48b807[_0x7995('0x2c')]=_[_0x7995('0x4e')](_0x32f19d[_0x7995('0x2c')]);_0x48b807['filters']=_[_0x7995('0x35')](_0x48b807[_0x7995('0x31')],_0x48b807[_0x7995('0x2c')]);_0x181ed6['attributes']=_[_0x7995('0x35')](_0x48b807[_0x7995('0x31')],qs[_0x7995('0x36')](_0x32f19d[_0x7995('0x2c')][_0x7995('0x36')]));_0x181ed6['attributes']=_0x181ed6[_0x7995('0x34')][_0x7995('0x44')]?_0x181ed6[_0x7995('0x34')]:_0x48b807[_0x7995('0x31')];_0x181ed6[_0x7995('0x4f')]=qs[_0x7995('0x50')](_0x32f19d[_0x7995('0x2c')]['sort']);_0x181ed6['where']=qs[_0x7995('0x33')](_[_0x7995('0x52')](_0x32f19d['query'],_0x48b807['filters']));if(_0x32f19d[_0x7995('0x2c')][_0x7995('0x1c')]){_0x181ed6[_0x7995('0x51')]=_[_0x7995('0x38')](_0x181ed6[_0x7995('0x51')],{'$or':_[_0x7995('0x1e')](_0x181ed6[_0x7995('0x34')],function(_0x4dca11){var _0xf90cd8={};_0xf90cd8[_0x4dca11]={'$like':'%'+_0x32f19d[_0x7995('0x2c')][_0x7995('0x1c')]+'%'};return _0xf90cd8;})});}_0x181ed6=_[_0x7995('0x38')]({},_0x181ed6,_0x32f19d[_0x7995('0x45')]);return _0xba00af[_0x7995('0x88')](_0x181ed6);}})['then'](function(_0x1d7c33){if(_0x1d7c33){_0x4f008a=_0x1d7c33[_0x7995('0x44')];if(!_0x32f19d[_0x7995('0x2c')][_0x7995('0x57')](_0x7995('0x5b'))){_0x181ed6[_0x7995('0x15')]=qs[_0x7995('0x15')](_0x32f19d['query'][_0x7995('0x15')]);_0x181ed6[_0x7995('0x13')]=qs[_0x7995('0x13')](_0x32f19d[_0x7995('0x2c')]['offset']);}return _0xba00af[_0x7995('0x88')](_0x181ed6);}})['then'](function(_0x21ba9b){if(_0x21ba9b){return _0x21ba9b?{'count':_0x4f008a,'rows':_0x21ba9b}:null;}})[_0x7995('0x19')](respondWithResult(_0x44dbb8,null))['catch'](handleError(_0x44dbb8,null));};exports['getMembers']=function(_0x478c12,_0x3b22ec){var _0xf503d5={};var _0x7d2ccf={};var _0x18a3dc;var _0x503b32;return db[_0x7995('0x39')][_0x7995('0x4d')]({'where':{'id':_0x478c12[_0x7995('0x30')]['id']}})[_0x7995('0x19')](handleEntityNotFound(_0x3b22ec,null))[_0x7995('0x19')](function(_0x1fa484){if(_0x1fa484){_0x18a3dc=_0x1fa484;_0x7d2ccf[_0x7995('0x31')]=_['keys'](db['UserVoiceQueueRt'][_0x7995('0x32')]);_0x7d2ccf['query']=_['keys'](_0x478c12[_0x7995('0x2c')]);_0x7d2ccf[_0x7995('0x33')]=_[_0x7995('0x35')](_0x7d2ccf[_0x7995('0x31')],_0x7d2ccf[_0x7995('0x2c')]);_0xf503d5[_0x7995('0x34')]=_[_0x7995('0x35')](_0x7d2ccf[_0x7995('0x31')],qs[_0x7995('0x36')](_0x478c12[_0x7995('0x2c')][_0x7995('0x36')]));_0xf503d5[_0x7995('0x34')]=_0xf503d5['attributes'][_0x7995('0x44')]?_0xf503d5[_0x7995('0x34')]:_0x7d2ccf[_0x7995('0x31')];_0xf503d5[_0x7995('0x4f')]=qs[_0x7995('0x50')](_0x478c12[_0x7995('0x2c')][_0x7995('0x50')]);_0xf503d5['where']=qs[_0x7995('0x33')](_[_0x7995('0x52')](_0x478c12[_0x7995('0x2c')],_0x7d2ccf[_0x7995('0x33')]));if(_0x478c12[_0x7995('0x2c')]['filter']){_0xf503d5[_0x7995('0x51')]=_['merge'](_0xf503d5[_0x7995('0x51')],{'$or':_[_0x7995('0x1e')](_0xf503d5[_0x7995('0x34')],function(_0x5150aa){var _0x260e84={};_0x260e84[_0x5150aa]={'$like':'%'+_0x478c12[_0x7995('0x2c')][_0x7995('0x1c')]+'%'};return _0x260e84;})});}_0xf503d5=_[_0x7995('0x38')]({},_0xf503d5,_0x478c12[_0x7995('0x45')]);return _0x18a3dc[_0x7995('0x89')](_0xf503d5);}})[_0x7995('0x19')](function(_0x4fb899){if(_0x4fb899){_0x503b32=_0x4fb899['length'];if(!_0x478c12[_0x7995('0x2c')][_0x7995('0x57')](_0x7995('0x5b'))){_0xf503d5[_0x7995('0x15')]=qs[_0x7995('0x15')](_0x478c12[_0x7995('0x2c')]['limit']);_0xf503d5[_0x7995('0x13')]=qs[_0x7995('0x13')](_0x478c12[_0x7995('0x2c')][_0x7995('0x13')]);}return _0x18a3dc['getMembers'](_0xf503d5);}})['then'](function(_0x5b93e6){return _0x5b93e6?{'count':_0x503b32,'rows':_0x5b93e6}:null;})[_0x7995('0x19')](respondWithResult(_0x3b22ec,null))['catch'](handleError(_0x3b22ec,null));};exports[_0x7995('0x8a')]=function(_0x1b6411,_0x54e348){var _0x390bd3={};var _0x3f0a01={};var _0x45d8a2;var _0x26ab59;return db[_0x7995('0x39')]['findOne']({'where':{'id':_0x1b6411['params']['id']}})[_0x7995('0x19')](handleEntityNotFound(_0x54e348,null))[_0x7995('0x19')](function(_0x2cfa1d){if(_0x2cfa1d){_0x45d8a2=_0x2cfa1d;_0x3f0a01[_0x7995('0x31')]=_[_0x7995('0x4e')](db['CmList'][_0x7995('0x32')]);_0x3f0a01[_0x7995('0x2c')]=_[_0x7995('0x4e')](_0x1b6411[_0x7995('0x2c')]);_0x3f0a01[_0x7995('0x33')]=_['intersection'](_0x3f0a01['model'],_0x3f0a01['query']);_0x390bd3['attributes']=_[_0x7995('0x35')](_0x3f0a01[_0x7995('0x31')],qs['fields'](_0x1b6411[_0x7995('0x2c')][_0x7995('0x36')]));_0x390bd3['attributes']=_0x390bd3['attributes'][_0x7995('0x44')]?_0x390bd3[_0x7995('0x34')]:_0x3f0a01[_0x7995('0x31')];_0x390bd3[_0x7995('0x4f')]=qs[_0x7995('0x50')](_0x1b6411[_0x7995('0x2c')][_0x7995('0x50')]);_0x390bd3['where']=qs['filters'](_[_0x7995('0x52')](_0x1b6411[_0x7995('0x2c')],_0x3f0a01[_0x7995('0x33')]));if(_0x1b6411['query'][_0x7995('0x1c')]){_0x390bd3[_0x7995('0x51')]=_[_0x7995('0x38')](_0x390bd3[_0x7995('0x51')],{'$or':_[_0x7995('0x1e')](_0x390bd3[_0x7995('0x34')],function(_0x28ac7c){var _0x1b4cab={};_0x1b4cab[_0x28ac7c]={'$like':'%'+_0x1b6411[_0x7995('0x2c')]['filter']+'%'};return _0x1b4cab;})});}_0x390bd3=_['merge']({},_0x390bd3,_0x1b6411[_0x7995('0x45')]);return _0x45d8a2['getLists'](_0x390bd3);}})[_0x7995('0x19')](function(_0x5953d1){if(_0x5953d1){_0x26ab59=_0x5953d1[_0x7995('0x44')];if(!_0x1b6411[_0x7995('0x2c')][_0x7995('0x57')]('nolimit')){_0x390bd3['limit']=qs[_0x7995('0x15')](_0x1b6411[_0x7995('0x2c')][_0x7995('0x15')]);_0x390bd3[_0x7995('0x13')]=qs[_0x7995('0x13')](_0x1b6411[_0x7995('0x2c')][_0x7995('0x13')]);}return _0x45d8a2[_0x7995('0x8a')](_0x390bd3);}})[_0x7995('0x19')](function(_0x35403c){if(_0x35403c){return _0x35403c?{'count':_0x26ab59,'rows':_0x35403c}:null;}})[_0x7995('0x19')](respondWithResult(_0x54e348,null))['catch'](handleError(_0x54e348,null));};exports[_0x7995('0x8b')]=function(_0xe43c99,_0x1b7e44){var _0x442c6d=moment()[_0x7995('0x6c')]('YYYY-MM-DD\x20HH:mm:ss');var _0x3b5edf,_0x44068f;return db[_0x7995('0x39')][_0x7995('0x21')]({'where':{'id':_0xe43c99[_0x7995('0x30')]['id']}})[_0x7995('0x19')](handleEntityNotFound(_0x1b7e44,null))[_0x7995('0x19')](function(_0x2b812f){if(_0x2b812f){_0x44068f=_0x2b812f;return _0x2b812f[_0x7995('0x8b')](_0xe43c99['body']['ids'],_[_0x7995('0x46')](_0xe43c99[_0x7995('0x3b')],[_0x7995('0x70'),'id'])||{});}return null;})[_0x7995('0x8c')](function(_0x17fd98){var _0x498d7c;_0x3b5edf=_0x17fd98||[];var _0x341024=[];if(_0x17fd98){for(var _0x2bcbc6=0x0;_0x2bcbc6<_0x17fd98[_0x7995('0x44')];_0x2bcbc6+=0x1){var _0x2dd6c7=_0x17fd98[_0x2bcbc6][_0x7995('0x3c')]({'plain':!![]});_0x44068f[_0x7995('0x8d')]=_0xe43c99[_0x7995('0x3b')][_0x7995('0x8d')]?_0xe43c99[_0x7995('0x3b')]['dialCheckDuplicateType']:_0x44068f['dialCheckDuplicateType'];switch(_0x44068f[_0x7995('0x8d')]){case _0x7995('0x8e'):_0x498d7c=squel[_0x7995('0x8f')]()[_0x7995('0x90')](_0x7995('0x91'))[_0x7995('0x92')]([_0x7995('0x93'),_0x7995('0x94'),'ContactId','ListId',_0x7995('0x58'),_0x7995('0x95'),_0x7995('0x47')],squel[_0x7995('0x96')]()['field']('phone',_0x7995('0x93'))[_0x7995('0x72')]('\x27'+_0x442c6d+'\x27',_0x7995('0x94'))[_0x7995('0x72')]('id',_0x7995('0x97'))[_0x7995('0x72')](_0x2dd6c7[_0x7995('0x98')][_0x7995('0x79')](),_0x7995('0x99'))[_0x7995('0x72')](_0xe43c99[_0x7995('0x30')]['id'][_0x7995('0x79')](),'VoiceQueueId')['field']('\x27'+_0x442c6d+'\x27',_0x7995('0x95'))[_0x7995('0x72')]('\x27'+_0x442c6d+'\x27',_0x7995('0x47'))[_0x7995('0x9a')]('cm_contacts')[_0x7995('0x51')]('deletedAt\x20IS\x20NULL')[_0x7995('0x51')](_0x7995('0x9b'),_0x2dd6c7[_0x7995('0x98')][_0x7995('0x79')]())[_0x7995('0x51')](_0x7995('0x9c'))['where'](_0x7995('0x9d'),squel[_0x7995('0x96')]()[_0x7995('0x72')](_0x7995('0x9e'))['from']('cm_hopper_final')[_0x7995('0x51')](_0x7995('0x9f'),_0xe43c99[_0x7995('0x30')]['id'][_0x7995('0x79')]()))['where'](_0x7995('0x9d'),squel[_0x7995('0x96')]()[_0x7995('0x72')]('COALESCE(phone,\x27\x27)')[_0x7995('0x9a')](_0x7995('0x91'))[_0x7995('0x51')]('VoiceQueueId\x20=\x20?',_0xe43c99[_0x7995('0x30')]['id'][_0x7995('0x79')]())))[_0x7995('0x79')]();break;case _0x7995('0xa0'):_0x498d7c=squel[_0x7995('0x8f')]()[_0x7995('0x90')](_0x7995('0x91'))[_0x7995('0x92')]([_0x7995('0x93'),'scheduledAt',_0x7995('0x97'),_0x7995('0x99'),_0x7995('0x58'),_0x7995('0x95'),'updatedAt'],squel[_0x7995('0x96')]()[_0x7995('0x72')](_0x7995('0x93'),_0x7995('0x93'))['field']('\x27'+_0x442c6d+'\x27',_0x7995('0x94'))[_0x7995('0x72')]('id',_0x7995('0x97'))[_0x7995('0x72')](_0x2dd6c7[_0x7995('0x98')][_0x7995('0x79')](),_0x7995('0x99'))['field'](_0xe43c99[_0x7995('0x30')]['id'][_0x7995('0x79')](),_0x7995('0x58'))[_0x7995('0x72')]('\x27'+_0x442c6d+'\x27',_0x7995('0x95'))['field']('\x27'+_0x442c6d+'\x27',_0x7995('0x47'))['from'](_0x7995('0xa1'))[_0x7995('0x51')](_0x7995('0xa2'))['where']('ListId\x20=\x20?',_0x2dd6c7['CmListId'][_0x7995('0x79')]())[_0x7995('0x51')](_0x7995('0x9c'))[_0x7995('0x51')](_0x7995('0x9d'),squel[_0x7995('0x96')]()['field'](_0x7995('0xa3'))[_0x7995('0x9a')](_0x7995('0x91'))[_0x7995('0x51')]('VoiceQueueId\x20=\x20?',_0xe43c99[_0x7995('0x30')]['id'][_0x7995('0x79')]())))['toString']();break;default:_0x498d7c=squel[_0x7995('0x8f')]()['into'](_0x7995('0x91'))[_0x7995('0x92')]([_0x7995('0x93'),'scheduledAt','ContactId',_0x7995('0x99'),_0x7995('0x58'),_0x7995('0x95'),_0x7995('0x47')],squel[_0x7995('0x96')]()[_0x7995('0x72')](_0x7995('0x93'),_0x7995('0x93'))[_0x7995('0x72')]('\x27'+_0x442c6d+'\x27',_0x7995('0x94'))[_0x7995('0x72')]('id','ContactId')['field'](_0x2dd6c7[_0x7995('0x98')][_0x7995('0x79')](),_0x7995('0x99'))[_0x7995('0x72')](_0xe43c99['params']['id']['toString'](),_0x7995('0x58'))[_0x7995('0x72')]('\x27'+_0x442c6d+'\x27','createdAt')['field']('\x27'+_0x442c6d+'\x27',_0x7995('0x47'))[_0x7995('0x9a')](_0x7995('0xa1'))[_0x7995('0x51')](_0x7995('0xa2'))['where'](_0x7995('0x9b'),_0x2dd6c7[_0x7995('0x98')]['toString']())[_0x7995('0x51')](_0x7995('0x9c')))[_0x7995('0x79')]();}_0x341024['push'](db[_0x7995('0x7a')][_0x7995('0x2c')](_0x498d7c));}return BPromise[_0x7995('0x7d')](_0x341024);}})[_0x7995('0x19')](function(){var _0x113e03=[];var _0x5348b1=squel['insert']()[_0x7995('0x90')]('cm_hopper_additional_phones')[_0x7995('0x92')](['CmHopperId',_0x7995('0x93'),_0x7995('0xa4'),_0x7995('0x95'),'updatedAt'],squel['select']()['field'](_0x7995('0xa5'))[_0x7995('0x72')](_0x7995('0xa6'))['field'](_0x7995('0xa7'))[_0x7995('0x72')]('\x27'+_0x442c6d+'\x27','createdAt')[_0x7995('0x72')]('\x27'+_0x442c6d+'\x27',_0x7995('0x47'))[_0x7995('0x9a')](_0x7995('0xa8'),'ci')[_0x7995('0xa9')]('cm_hopper','h','h.ContactId=ci.CmContactId')[_0x7995('0x51')](_0x7995('0xaa'),_0x442c6d)[_0x7995('0x51')](_0x7995('0xab'),_0x7995('0xac')))[_0x7995('0x79')]();_0x113e03[_0x7995('0x78')](db[_0x7995('0x7a')][_0x7995('0x2c')](_0x5348b1));return BPromise[_0x7995('0x7d')](_0x113e03);})['then'](function(){return _0x3b5edf;})[_0x7995('0x19')](respondWithResult(_0x1b7e44,null))[_0x7995('0x2e')](handleError(_0x1b7e44,null));};exports[_0x7995('0xad')]=function(_0xff759b,_0x39ee00){return db[_0x7995('0x39')][_0x7995('0x21')]({'where':{'id':_0xff759b['params']['id']}})['then'](handleEntityNotFound(_0x39ee00,null))[_0x7995('0x19')](function(_0x2aec8d){if(_0x2aec8d){return _0x2aec8d[_0x7995('0xad')](_0xff759b[_0x7995('0x2c')]['ids']);}})['then'](function(_0x4b477a){if(_0x4b477a){return db[_0x7995('0x53')][_0x7995('0x25')]({'where':{'ListId':_0xff759b['query'][_0x7995('0x70')],'VoiceQueueId':_0xff759b[_0x7995('0x30')]['id']}})[_0x7995('0x19')](function(){return _0x4b477a;});}})[_0x7995('0x19')](respondWithStatusCode(_0x39ee00,null))[_0x7995('0x2e')](handleError(_0x39ee00,null));};exports[_0x7995('0xae')]=function(_0x35229d,_0x22d392){var _0x57438e={};var _0x463c25={};var _0x13d525;var _0x37b7e7;return db['VoiceQueue'][_0x7995('0x4d')]({'where':{'id':_0x35229d['params']['id']}})['then'](handleEntityNotFound(_0x22d392,null))['then'](function(_0x507bf3){if(_0x507bf3){_0x13d525=_0x507bf3;_0x463c25[_0x7995('0x31')]=_['keys'](db[_0x7995('0xaf')][_0x7995('0x32')]);_0x463c25['query']=_[_0x7995('0x4e')](_0x35229d[_0x7995('0x2c')]);_0x463c25[_0x7995('0x33')]=_[_0x7995('0x35')](_0x463c25['model'],_0x463c25[_0x7995('0x2c')]);_0x57438e['attributes']=_[_0x7995('0x35')](_0x463c25[_0x7995('0x31')],qs[_0x7995('0x36')](_0x35229d[_0x7995('0x2c')][_0x7995('0x36')]));_0x57438e[_0x7995('0x34')]=_0x57438e[_0x7995('0x34')][_0x7995('0x44')]?_0x57438e[_0x7995('0x34')]:_0x463c25[_0x7995('0x31')];_0x57438e['order']=qs[_0x7995('0x50')](_0x35229d[_0x7995('0x2c')]['sort']);_0x57438e[_0x7995('0x51')]=qs[_0x7995('0x33')](_[_0x7995('0x52')](_0x35229d[_0x7995('0x2c')],_0x463c25[_0x7995('0x33')]));if(_0x35229d[_0x7995('0x2c')]['filter']){_0x57438e[_0x7995('0x51')]=_['merge'](_0x57438e[_0x7995('0x51')],{'$or':_[_0x7995('0x1e')](_0x57438e[_0x7995('0x34')],function(_0xb79b0b){var _0x259bf2={};_0x259bf2[_0xb79b0b]={'$like':'%'+_0x35229d[_0x7995('0x2c')]['filter']+'%'};return _0x259bf2;})});}_0x57438e=_[_0x7995('0x38')]({},_0x57438e,_0x35229d[_0x7995('0x45')]);return _0x13d525[_0x7995('0xae')](_0x57438e);}})['then'](function(_0x1176cd){if(_0x1176cd){_0x37b7e7=_0x1176cd[_0x7995('0x44')];if(!_0x35229d[_0x7995('0x2c')][_0x7995('0x57')](_0x7995('0x5b'))){_0x57438e[_0x7995('0x15')]=qs[_0x7995('0x15')](_0x35229d[_0x7995('0x2c')][_0x7995('0x15')]);_0x57438e[_0x7995('0x13')]=qs[_0x7995('0x13')](_0x35229d['query'][_0x7995('0x13')]);}return _0x13d525[_0x7995('0xae')](_0x57438e);}})['then'](function(_0x3098ef){if(_0x3098ef){return _0x3098ef?{'count':_0x37b7e7,'rows':_0x3098ef}:null;}})[_0x7995('0x19')](respondWithResult(_0x22d392,null))[_0x7995('0x2e')](handleError(_0x22d392,null));};exports[_0x7995('0xb0')]=function(_0x258f87,_0x5a5cc4){var _0x37af6b;return db[_0x7995('0x39')][_0x7995('0x21')]({'where':{'id':_0x258f87[_0x7995('0x30')]['id']}})[_0x7995('0x19')](handleEntityNotFound(_0x5a5cc4,null))[_0x7995('0x19')](function(_0x120bef){if(_0x120bef){return _0x120bef[_0x7995('0xb0')](_0x258f87[_0x7995('0x3b')][_0x7995('0x70')],_[_0x7995('0x46')](_0x258f87[_0x7995('0x3b')],[_0x7995('0x70'),'id'])||{});}return null;})['spread'](function(_0x247b71){var _0x1ecb6f;_0x37af6b=_0x247b71||[];var _0x225a37=[];if(_0x247b71){for(var _0x1a9f59=0x0;_0x1a9f59<_0x247b71['length'];_0x1a9f59+=0x1){var _0x92a561=_0x247b71[_0x1a9f59][_0x7995('0x3c')]({'plain':!![]});_0x1ecb6f=squel[_0x7995('0x8f')]()[_0x7995('0x90')](_0x7995('0xb1'))[_0x7995('0x92')]([_0x7995('0x93'),'ContactId',_0x7995('0x99'),'VoiceQueueId',_0x7995('0x95'),_0x7995('0x47')],squel[_0x7995('0x96')]()['field']('phone',_0x7995('0x93'))[_0x7995('0x72')]('id',_0x7995('0x97'))['field'](_0x92a561[_0x7995('0x98')]['toString'](),_0x7995('0x99'))[_0x7995('0x72')](_0x258f87[_0x7995('0x30')]['id'][_0x7995('0x79')](),_0x7995('0x58'))[_0x7995('0x72')]('NOW()',_0x7995('0x95'))[_0x7995('0x72')]('NOW()',_0x7995('0x47'))[_0x7995('0x9a')](_0x7995('0xa1'))[_0x7995('0x51')](_0x7995('0xa2'))[_0x7995('0x51')](_0x7995('0x9b'),_0x92a561[_0x7995('0x98')][_0x7995('0x79')]())[_0x7995('0x51')](_0x7995('0x9c')))[_0x7995('0x79')]();_0x225a37[_0x7995('0x78')](db[_0x7995('0x7a')][_0x7995('0x2c')](_0x1ecb6f));}return BPromise[_0x7995('0x7d')](_0x225a37);}})[_0x7995('0x19')](function(){return _0x37af6b;})['then'](respondWithResult(_0x5a5cc4,null))['catch'](handleError(_0x5a5cc4,null));};exports[_0x7995('0xb2')]=function(_0x2f3c17,_0x4fe5eb){return db[_0x7995('0x39')][_0x7995('0x21')]({'where':{'id':_0x2f3c17['params']['id']}})['then'](handleEntityNotFound(_0x4fe5eb,null))[_0x7995('0x19')](function(_0x31a3d6){if(_0x31a3d6){return _0x31a3d6[_0x7995('0xb2')](_0x2f3c17[_0x7995('0x2c')][_0x7995('0x70')]);}})[_0x7995('0x19')](function(_0x1b3920){if(_0x1b3920){return db[_0x7995('0x5d')][_0x7995('0x25')]({'where':{'ListId':_0x2f3c17[_0x7995('0x2c')]['ids'],'VoiceQueueId':_0x2f3c17[_0x7995('0x30')]['id']}})[_0x7995('0x19')](function(){return _0x1b3920;});}})[_0x7995('0x19')](respondWithStatusCode(_0x4fe5eb,null))[_0x7995('0x2e')](handleError(_0x4fe5eb,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index e89c552..70aed58 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 _0x6054=['events','VoiceQueue','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x59d940,_0xa066b){var _0x399802=function(_0x518506){while(--_0x518506){_0x59d940['push'](_0x59d940['shift']());}};_0x399802(++_0xa066b);}(_0x6054,0x1a7));var _0x4605=function(_0x541155,_0x54f085){_0x541155=_0x541155-0x0;var _0x519cf5=_0x6054[_0x541155];return _0x519cf5;};'use strict';var EventEmitter=require(_0x4605('0x0'));var VoiceQueue=require('../../mysqldb')['db'][_0x4605('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4605('0x2'),'afterUpdate':_0x4605('0x3'),'afterDestroy':_0x4605('0x4')};function emitEvent(_0x530e1b){return function(_0x4e189c,_0x3cb9a3,_0x275d16){VoiceQueueEvents[_0x4605('0x5')](_0x530e1b+':'+_0x4e189c['id'],_0x4e189c);VoiceQueueEvents[_0x4605('0x5')](_0x530e1b,_0x4e189c);_0x275d16(null);};}for(var e in events){if(events[_0x4605('0x6')](e)){var event=events[e];VoiceQueue[_0x4605('0x7')](e,emitEvent(event));}}module[_0x4605('0x8')]=VoiceQueueEvents; \ No newline at end of file +var _0x6b60=['setMaxListeners','update','remove','emit','hook','exports','../../mysqldb','VoiceQueue'];(function(_0x33bcdb,_0x11846b){var _0x18a9bf=function(_0x34417a){while(--_0x34417a){_0x33bcdb['push'](_0x33bcdb['shift']());}};_0x18a9bf(++_0x11846b);}(_0x6b60,0x1e6));var _0x06b6=function(_0x1795df,_0xcb261e){_0x1795df=_0x1795df-0x0;var _0x3f13c0=_0x6b60[_0x1795df];return _0x3f13c0;};'use strict';var EventEmitter=require('events');var VoiceQueue=require(_0x06b6('0x0'))['db'][_0x06b6('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x06b6('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x06b6('0x3'),'afterDestroy':_0x06b6('0x4')};function emitEvent(_0x3b9bfd){return function(_0x3c4662,_0x6db76a,_0x2db1a9){VoiceQueueEvents['emit'](_0x3b9bfd+':'+_0x3c4662['id'],_0x3c4662);VoiceQueueEvents[_0x06b6('0x5')](_0x3b9bfd,_0x3c4662);_0x2db1a9(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue[_0x06b6('0x6')](e,emitEvent(event));}}module[_0x06b6('0x7')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 45d813c..c50cc48 100644 --- a/server/api/voiceQueue/voiceQueue.model.js +++ b/server/api/voiceQueue/voiceQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['exports','VoiceQueue','voice_queues','lodash','../../config/logger','api','moment','path','../../config/environment','./voiceQueue.attributes'];(function(_0x24721a,_0x1ac53c){var _0x6a9880=function(_0x558dc8){while(--_0x558dc8){_0x24721a['push'](_0x24721a['shift']());}};_0x6a9880(++_0x1ac53c);}(_0x3e74,0x175));var _0x43e7=function(_0x6ec746,_0x454dae){_0x6ec746=_0x6ec746-0x0;var _0x41b5c0=_0x3e74[_0x6ec746];return _0x41b5c0;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var logger=require(_0x43e7('0x1'))(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x43e7('0x4'));var rimraf=require('rimraf');var config=require(_0x43e7('0x5'));var attributes=require(_0x43e7('0x6'));module[_0x43e7('0x7')]=function(_0x1c503b,_0xc98b9c){return _0x1c503b['define'](_0x43e7('0x8'),attributes,{'tableName':_0x43e7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9c44=['request-promise','path','./voiceQueue.attributes','define','VoiceQueue','voice_queues','../../config/logger','api','moment','bluebird'];(function(_0x1d8772,_0x5f2656){var _0x3d7db4=function(_0x23063f){while(--_0x23063f){_0x1d8772['push'](_0x1d8772['shift']());}};_0x3d7db4(++_0x5f2656);}(_0x9c44,0x178));var _0x49c4=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x9c44[_0x3ff085];return _0x2b68c3;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x49c4('0x0'))(_0x49c4('0x1'));var moment=require(_0x49c4('0x2'));var BPromise=require(_0x49c4('0x3'));var rp=require(_0x49c4('0x4'));var fs=require('fs');var path=require(_0x49c4('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x49c4('0x6'));module['exports']=function(_0xc1278f,_0x6030ae){return _0xc1278f[_0x49c4('0x7')](_0x49c4('0x8'),attributes,{'tableName':_0x49c4('0x9'),'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 91d3648..1cbcbaa 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 _0xde96=['ShowVoiceQueue','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','./voiceQueue.socket','register','request','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','GetVoiceQueue','VoiceQueue','findAll','options','raw','where','limit','include','map','attributes','model','then'];(function(_0x417f21,_0x3b5820){var _0x2e990c=function(_0x2e9c68){while(--_0x2e9c68){_0x417f21['push'](_0x417f21['shift']());}};_0x2e990c(++_0x3b5820);}(_0xde96,0x1a3));var _0x6de9=function(_0xc15d9c,_0x49ddd3){_0xc15d9c=_0xc15d9c-0x0;var _0x485b07=_0xde96[_0xc15d9c];return _0x485b07;};'use strict';var _=require(_0x6de9('0x0'));var util=require(_0x6de9('0x1'));var moment=require(_0x6de9('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6de9('0x3'));var db=require(_0x6de9('0x4'))['db'];var utils=require(_0x6de9('0x5'));var logger=require('../../config/logger')(_0x6de9('0x6'));var config=require(_0x6de9('0x7'));var jayson=require(_0x6de9('0x8'));var client=jayson[_0x6de9('0x9')][_0x6de9('0xa')]({'port':0x232a});config[_0x6de9('0xb')]=_[_0x6de9('0xc')](config[_0x6de9('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6de9('0xb')]));require(_0x6de9('0xd'))[_0x6de9('0xe')](socket);function respondWithRpcPromise(_0x43a1aa,_0x141ebc,_0x1e839e){return new BPromise(function(_0x15e6b8,_0x3b7bca){return client[_0x6de9('0xf')](_0x43a1aa,_0x1e839e)['then'](function(_0x31d6cf){logger[_0x6de9('0x10')](_0x6de9('0x11'),_0x141ebc,_0x6de9('0x12'));logger[_0x6de9('0x13')]('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x141ebc,_0x6de9('0x12'),JSON[_0x6de9('0x14')](_0x31d6cf));if(_0x31d6cf[_0x6de9('0x15')]){if(_0x31d6cf[_0x6de9('0x15')]['code']===0x1f4){logger[_0x6de9('0x15')](_0x6de9('0x11'),_0x141ebc,_0x31d6cf[_0x6de9('0x15')][_0x6de9('0x16')]);return _0x3b7bca(_0x31d6cf[_0x6de9('0x15')]['message']);}logger[_0x6de9('0x15')]('VoiceQueue,\x20%s,\x20%s',_0x141ebc,_0x31d6cf[_0x6de9('0x15')][_0x6de9('0x16')]);return _0x15e6b8(_0x31d6cf[_0x6de9('0x15')][_0x6de9('0x16')]);}else{logger[_0x6de9('0x10')]('VoiceQueue,\x20%s,\x20%s',_0x141ebc,_0x6de9('0x12'));_0x15e6b8(_0x31d6cf[_0x6de9('0x17')][_0x6de9('0x16')]);}})[_0x6de9('0x18')](function(_0x4206db){logger[_0x6de9('0x15')](_0x6de9('0x11'),_0x141ebc,_0x4206db);_0x3b7bca(_0x4206db);});});}exports[_0x6de9('0x19')]=function(_0xa190e4){var _0x49fd02=this;return new Promise(function(_0x315a1c,_0x12584d){return db[_0x6de9('0x1a')][_0x6de9('0x1b')]({'raw':_0xa190e4[_0x6de9('0x1c')]?_0xa190e4[_0x6de9('0x1c')][_0x6de9('0x1d')]===undefined?!![]:![]:!![],'where':_0xa190e4[_0x6de9('0x1c')]?_0xa190e4[_0x6de9('0x1c')][_0x6de9('0x1e')]||null:null,'attributes':_0xa190e4[_0x6de9('0x1c')]?_0xa190e4[_0x6de9('0x1c')]['attributes']||null:null,'limit':_0xa190e4[_0x6de9('0x1c')]?_0xa190e4['options'][_0x6de9('0x1f')]||null:null,'include':_0xa190e4['options']?_0xa190e4[_0x6de9('0x1c')][_0x6de9('0x20')]?_[_0x6de9('0x21')](_0xa190e4[_0x6de9('0x1c')][_0x6de9('0x20')],function(_0x1cb06a){return{'model':db[_0x1cb06a['model']],'as':_0x1cb06a['as'],'attributes':_0x1cb06a[_0x6de9('0x22')],'include':_0x1cb06a[_0x6de9('0x20')]?_[_0x6de9('0x21')](_0x1cb06a[_0x6de9('0x20')],function(_0x2b8081){return{'model':db[_0x2b8081[_0x6de9('0x23')]],'as':_0x2b8081['as'],'attributes':_0x2b8081[_0x6de9('0x22')],'include':_0x2b8081['include']?_[_0x6de9('0x21')](_0x2b8081[_0x6de9('0x20')],function(_0x203dc1){return{'model':db[_0x203dc1[_0x6de9('0x23')]],'as':_0x203dc1['as'],'attributes':_0x203dc1[_0x6de9('0x22')]};}):[]};}):[]};}):[]:[]})[_0x6de9('0x24')](function(_0x3f48f0){logger['info'](_0x6de9('0x19'),_0xa190e4);logger[_0x6de9('0x13')]('GetVoiceQueue',_0xa190e4,JSON[_0x6de9('0x14')](_0x3f48f0));_0x315a1c(_0x3f48f0);})['catch'](function(_0x23294d){logger[_0x6de9('0x15')](_0x6de9('0x19'),_0x23294d[_0x6de9('0x16')],_0xa190e4);_0x12584d(_0x49fd02[_0x6de9('0x15')](0x1f4,_0x23294d[_0x6de9('0x16')]));});});};exports[_0x6de9('0x25')]=function(_0x1ede9b){var _0x4d305a=this;return new Promise(function(_0x4f81d8,_0x51a500){return db['VoiceQueue']['find']({'raw':_0x1ede9b[_0x6de9('0x1c')]?_0x1ede9b[_0x6de9('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x1ede9b[_0x6de9('0x1c')]?_0x1ede9b['options']['where']||null:null,'attributes':_0x1ede9b[_0x6de9('0x1c')]?_0x1ede9b[_0x6de9('0x1c')][_0x6de9('0x22')]||null:null,'include':_0x1ede9b[_0x6de9('0x1c')]?_0x1ede9b[_0x6de9('0x1c')][_0x6de9('0x20')]?_[_0x6de9('0x21')](_0x1ede9b['options']['include'],function(_0xe28ed1){return{'model':db[_0xe28ed1[_0x6de9('0x23')]],'as':_0xe28ed1['as'],'attributes':_0xe28ed1[_0x6de9('0x22')],'include':_0xe28ed1[_0x6de9('0x20')]?_['map'](_0xe28ed1[_0x6de9('0x20')],function(_0x1be2d7){return{'model':db[_0x1be2d7[_0x6de9('0x23')]],'as':_0x1be2d7['as'],'attributes':_0x1be2d7[_0x6de9('0x22')],'include':_0x1be2d7[_0x6de9('0x20')]?_[_0x6de9('0x21')](_0x1be2d7[_0x6de9('0x20')],function(_0x4a2be2){return{'model':db[_0x4a2be2[_0x6de9('0x23')]],'as':_0x4a2be2['as'],'attributes':_0x4a2be2[_0x6de9('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xa52480){logger[_0x6de9('0x10')](_0x6de9('0x25'),_0x1ede9b);logger[_0x6de9('0x13')](_0x6de9('0x25'),_0x1ede9b,JSON['stringify'](_0xa52480));_0x4f81d8(_0xa52480);})['catch'](function(_0x1fd82c){logger[_0x6de9('0x15')](_0x6de9('0x25'),_0x1fd82c[_0x6de9('0x16')],_0x1ede9b);_0x51a500(_0x4d305a['error'](0x1f4,_0x1fd82c[_0x6de9('0x16')]));});});}; \ No newline at end of file +var _0x2518=['../../config/environment','jayson/promise','http','redis','localhost','./voiceQueue.socket','register','request','then','info','VoiceQueue,\x20%s,\x20%s','VoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetVoiceQueue','VoiceQueue','findAll','options','raw','attributes','limit','include','model','map','debug','ShowVoiceQueue','where','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x4e9d38,_0x37b7bc){var _0x576735=function(_0x468891){while(--_0x468891){_0x4e9d38['push'](_0x4e9d38['shift']());}};_0x576735(++_0x37b7bc);}(_0x2518,0x129));var _0x8251=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x2518[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x8251('0x0'));var util=require('util');var moment=require(_0x8251('0x1'));var BPromise=require(_0x8251('0x2'));var rs=require(_0x8251('0x3'));var fs=require('fs');var Redis=require(_0x8251('0x4'));var db=require(_0x8251('0x5'))['db'];var utils=require(_0x8251('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x8251('0x7'));var jayson=require(_0x8251('0x8'));var client=jayson['client'][_0x8251('0x9')]({'port':0x232a});config[_0x8251('0xa')]=_['defaults'](config[_0x8251('0xa')],{'host':_0x8251('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x8251('0xc'))[_0x8251('0xd')](socket);function respondWithRpcPromise(_0x2c5158,_0x183ee1,_0x257869){return new BPromise(function(_0x1e1056,_0xf9fb74){return client[_0x8251('0xe')](_0x2c5158,_0x257869)[_0x8251('0xf')](function(_0x4686c3){logger[_0x8251('0x10')](_0x8251('0x11'),_0x183ee1,'request\x20sent');logger['debug'](_0x8251('0x12'),_0x183ee1,_0x8251('0x13'),JSON[_0x8251('0x14')](_0x4686c3));if(_0x4686c3[_0x8251('0x15')]){if(_0x4686c3[_0x8251('0x15')]['code']===0x1f4){logger[_0x8251('0x15')](_0x8251('0x11'),_0x183ee1,_0x4686c3[_0x8251('0x15')][_0x8251('0x16')]);return _0xf9fb74(_0x4686c3[_0x8251('0x15')]['message']);}logger[_0x8251('0x15')]('VoiceQueue,\x20%s,\x20%s',_0x183ee1,_0x4686c3[_0x8251('0x15')][_0x8251('0x16')]);return _0x1e1056(_0x4686c3['error'][_0x8251('0x16')]);}else{logger[_0x8251('0x10')](_0x8251('0x11'),_0x183ee1,'request\x20sent');_0x1e1056(_0x4686c3[_0x8251('0x17')][_0x8251('0x16')]);}})[_0x8251('0x18')](function(_0x3e220f){logger[_0x8251('0x15')](_0x8251('0x11'),_0x183ee1,_0x3e220f);_0xf9fb74(_0x3e220f);});});}exports[_0x8251('0x19')]=function(_0x49a352){var _0x293412=this;return new Promise(function(_0x107dc1,_0x34db01){return db[_0x8251('0x1a')][_0x8251('0x1b')]({'raw':_0x49a352[_0x8251('0x1c')]?_0x49a352[_0x8251('0x1c')][_0x8251('0x1d')]===undefined?!![]:![]:!![],'where':_0x49a352[_0x8251('0x1c')]?_0x49a352[_0x8251('0x1c')]['where']||null:null,'attributes':_0x49a352[_0x8251('0x1c')]?_0x49a352[_0x8251('0x1c')][_0x8251('0x1e')]||null:null,'limit':_0x49a352['options']?_0x49a352[_0x8251('0x1c')][_0x8251('0x1f')]||null:null,'include':_0x49a352[_0x8251('0x1c')]?_0x49a352[_0x8251('0x1c')][_0x8251('0x20')]?_['map'](_0x49a352[_0x8251('0x1c')][_0x8251('0x20')],function(_0x18e646){return{'model':db[_0x18e646[_0x8251('0x21')]],'as':_0x18e646['as'],'attributes':_0x18e646[_0x8251('0x1e')],'include':_0x18e646[_0x8251('0x20')]?_[_0x8251('0x22')](_0x18e646[_0x8251('0x20')],function(_0x4d6b05){return{'model':db[_0x4d6b05[_0x8251('0x21')]],'as':_0x4d6b05['as'],'attributes':_0x4d6b05['attributes'],'include':_0x4d6b05[_0x8251('0x20')]?_[_0x8251('0x22')](_0x4d6b05[_0x8251('0x20')],function(_0x4ad44e){return{'model':db[_0x4ad44e[_0x8251('0x21')]],'as':_0x4ad44e['as'],'attributes':_0x4ad44e['attributes']};}):[]};}):[]};}):[]:[]})[_0x8251('0xf')](function(_0x9b0beb){logger[_0x8251('0x10')](_0x8251('0x19'),_0x49a352);logger[_0x8251('0x23')](_0x8251('0x19'),_0x49a352,JSON[_0x8251('0x14')](_0x9b0beb));_0x107dc1(_0x9b0beb);})[_0x8251('0x18')](function(_0x3f8f31){logger[_0x8251('0x15')](_0x8251('0x19'),_0x3f8f31[_0x8251('0x16')],_0x49a352);_0x34db01(_0x293412[_0x8251('0x15')](0x1f4,_0x3f8f31[_0x8251('0x16')]));});});};exports[_0x8251('0x24')]=function(_0x31c9d8){var _0x34cc29=this;return new Promise(function(_0x5513cc,_0x206eb5){return db['VoiceQueue']['find']({'raw':_0x31c9d8[_0x8251('0x1c')]?_0x31c9d8[_0x8251('0x1c')][_0x8251('0x1d')]===undefined?!![]:![]:!![],'where':_0x31c9d8[_0x8251('0x1c')]?_0x31c9d8[_0x8251('0x1c')][_0x8251('0x25')]||null:null,'attributes':_0x31c9d8[_0x8251('0x1c')]?_0x31c9d8[_0x8251('0x1c')]['attributes']||null:null,'include':_0x31c9d8[_0x8251('0x1c')]?_0x31c9d8['options'][_0x8251('0x20')]?_[_0x8251('0x22')](_0x31c9d8[_0x8251('0x1c')][_0x8251('0x20')],function(_0x5c841f){return{'model':db[_0x5c841f[_0x8251('0x21')]],'as':_0x5c841f['as'],'attributes':_0x5c841f[_0x8251('0x1e')],'include':_0x5c841f[_0x8251('0x20')]?_[_0x8251('0x22')](_0x5c841f['include'],function(_0x6880de){return{'model':db[_0x6880de[_0x8251('0x21')]],'as':_0x6880de['as'],'attributes':_0x6880de[_0x8251('0x1e')],'include':_0x6880de[_0x8251('0x20')]?_[_0x8251('0x22')](_0x6880de[_0x8251('0x20')],function(_0x13e05e){return{'model':db[_0x13e05e[_0x8251('0x21')]],'as':_0x13e05e['as'],'attributes':_0x13e05e[_0x8251('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x8251('0xf')](function(_0x59d95b){logger[_0x8251('0x10')](_0x8251('0x24'),_0x31c9d8);logger['debug']('ShowVoiceQueue',_0x31c9d8,JSON[_0x8251('0x14')](_0x59d95b));_0x5513cc(_0x59d95b);})[_0x8251('0x18')](function(_0xdacd4c){logger[_0x8251('0x15')](_0x8251('0x24'),_0xdacd4c[_0x8251('0x16')],_0x31c9d8);_0x206eb5(_0x34cc29[_0x8251('0x15')](0x1f4,_0xdacd4c[_0x8251('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 1a2f912..745633b 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 _0x906f=['removeListener','length','voiceQueue:','./voiceQueue.events','save','remove','update','emit'];(function(_0x847498,_0xb88bc1){var _0x2c7d2b=function(_0x5acaa8){while(--_0x5acaa8){_0x847498['push'](_0x847498['shift']());}};_0x2c7d2b(++_0xb88bc1);}(_0x906f,0x15b));var _0xf906=function(_0x55db0b,_0x14bccc){_0x55db0b=_0x55db0b-0x0;var _0x288d33=_0x906f[_0x55db0b];return _0x288d33;};'use strict';var VoiceQueueEvents=require(_0xf906('0x0'));var events=[_0xf906('0x1'),_0xf906('0x2'),_0xf906('0x3')];function createListener(_0x3339fd,_0x147892){return function(_0x52ed2d){_0x147892[_0xf906('0x4')](_0x3339fd,_0x52ed2d);};}function removeListener(_0x25a366,_0x3122e4){return function(){VoiceQueueEvents[_0xf906('0x5')](_0x25a366,_0x3122e4);};}exports['register']=function(_0x4155bc){for(var _0x52058b=0x0,_0x2318b9=events[_0xf906('0x6')];_0x52058b<_0x2318b9;_0x52058b++){var _0x1f61e1=events[_0x52058b];var _0x137bb0=createListener(_0xf906('0x7')+_0x1f61e1,_0x4155bc);VoiceQueueEvents['on'](_0x1f61e1,_0x137bb0);}}; \ No newline at end of file +var _0x8de1=['voiceQueue:','./voiceQueue.events','save','remove','update','removeListener','length'];(function(_0x3e0b2a,_0x48c54a){var _0x4b1237=function(_0x46cb84){while(--_0x46cb84){_0x3e0b2a['push'](_0x3e0b2a['shift']());}};_0x4b1237(++_0x48c54a);}(_0x8de1,0x8d));var _0x18de=function(_0xb1b616,_0x3b9023){_0xb1b616=_0xb1b616-0x0;var _0x1259b0=_0x8de1[_0xb1b616];return _0x1259b0;};'use strict';var VoiceQueueEvents=require(_0x18de('0x0'));var events=[_0x18de('0x1'),_0x18de('0x2'),_0x18de('0x3')];function createListener(_0x586688,_0x461dda){return function(_0xedbad1){_0x461dda['emit'](_0x586688,_0xedbad1);};}function removeListener(_0x39773d,_0xfc2594){return function(){VoiceQueueEvents[_0x18de('0x4')](_0x39773d,_0xfc2594);};}exports['register']=function(_0x15cfdb){for(var _0x458c87=0x0,_0x4486e3=events[_0x18de('0x5')];_0x458c87<_0x4486e3;_0x458c87++){var _0xb6b13d=events[_0x458c87];var _0x802f08=createListener(_0x18de('0x6')+_0xb6b13d,_0x15cfdb);VoiceQueueEvents['on'](_0xb6b13d,_0x802f08);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index b75553e..31f450d 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 _0x27c1=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','isAuthenticated','get','describe','getVoiceQueuesReport','/:id','show','post','create','put','update','delete','destroy','exports','multer','util'];(function(_0x5715e8,_0x263e14){var _0x2eeedd=function(_0x144541){while(--_0x144541){_0x5715e8['push'](_0x5715e8['shift']());}};_0x2eeedd(++_0x263e14);}(_0x27c1,0x1a0));var _0x127c=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0x27c1[_0x2064e5];return _0x21a233;};'use strict';var multer=require(_0x127c('0x0'));var util=require(_0x127c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x127c('0x2'));var router=express[_0x127c('0x3')]();var fs_extra=require(_0x127c('0x4'));var auth=require(_0x127c('0x5'));var interaction=require(_0x127c('0x6'));var config=require(_0x127c('0x7'));var controller=require(_0x127c('0x8'));router['get']('/',auth[_0x127c('0x9')](),controller['index']);router[_0x127c('0xa')]('/describe',auth[_0x127c('0x9')](),controller[_0x127c('0xb')]);router[_0x127c('0xa')]('/index',auth[_0x127c('0x9')](),controller[_0x127c('0xc')]);router[_0x127c('0xa')](_0x127c('0xd'),auth[_0x127c('0x9')](),controller[_0x127c('0xe')]);router[_0x127c('0xf')]('/',auth[_0x127c('0x9')](),controller[_0x127c('0x10')]);router[_0x127c('0x11')](_0x127c('0xd'),auth[_0x127c('0x9')](),controller[_0x127c('0x12')]);router[_0x127c('0x13')](_0x127c('0xd'),auth[_0x127c('0x9')](),controller[_0x127c('0x14')]);module[_0x127c('0x15')]=router; \ No newline at end of file +var _0xc248=['multer','path','Router','../../components/auth/service','./voiceQueueReport.controller','get','isAuthenticated','index','/index','getVoiceQueuesReport','/:id','post','create','put','update','delete'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xc248,0x90));var _0x8c24=function(_0x170527,_0x10568e){_0x170527=_0x170527-0x0;var _0x748b63=_0xc248[_0x170527];return _0x748b63;};'use strict';var multer=require(_0x8c24('0x0'));var util=require('util');var path=require(_0x8c24('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8c24('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x8c24('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x8c24('0x4'));router[_0x8c24('0x5')]('/',auth[_0x8c24('0x6')](),controller[_0x8c24('0x7')]);router[_0x8c24('0x5')]('/describe',auth[_0x8c24('0x6')](),controller['describe']);router['get'](_0x8c24('0x8'),auth[_0x8c24('0x6')](),controller[_0x8c24('0x9')]);router['get'](_0x8c24('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x8c24('0xb')]('/',auth[_0x8c24('0x6')](),controller[_0x8c24('0xc')]);router[_0x8c24('0xd')](_0x8c24('0xa'),auth[_0x8c24('0x6')](),controller[_0x8c24('0xe')]);router[_0x8c24('0xf')](_0x8c24('0xa'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 192a836..364a6c7 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 _0xdea7=['format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','queuecallerleaveAt','setDataValue','holdtime','INTEGER','BOOLEAN','moment','exports','STRING','DATE','getDataValue','queuecallerjoinAt'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xdea7,0x117));var _0x7dea=function(_0x1f18e9,_0x4f4edb){_0x1f18e9=_0x1f18e9-0x0;var _0x39e461=_0xdea7[_0x1f18e9];return _0x39e461;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x7dea('0x0'));module[_0x7dea('0x1')]={'type':{'type':Sequelize[_0x7dea('0x2')]},'uniqueid':{'type':Sequelize[_0x7dea('0x2')]},'calleridnum':{'type':Sequelize[_0x7dea('0x2')]},'calleridname':{'type':Sequelize[_0x7dea('0x2')]},'queue':{'type':Sequelize[_0x7dea('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0x7dea('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0x7dea('0x3')],'set':function(_0x5c2951){var _0x4e8831=moment(_0x5c2951);var _0x286752=moment(this[_0x7dea('0x4')](_0x7dea('0x5')))[_0x7dea('0x6')](_0x7dea('0x7'));var _0x1d595e=_0x4e8831[_0x7dea('0x8')](_0x286752,_0x7dea('0x9'));this['setDataValue'](_0x7dea('0xa'),_0x5c2951);this[_0x7dea('0xb')](_0x7dea('0xc'),_0x1d595e||null);}},'position':{'type':Sequelize[_0x7dea('0xd')]},'count':{'type':Sequelize[_0x7dea('0xd')]},'queuecallerabandon':{'type':Sequelize[_0x7dea('0xe')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x7dea('0x3')]},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize[_0x7dea('0xe')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x7dea('0x3')]},'queuecallerexitreason':{'type':Sequelize[_0x7dea('0x2')],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize[_0x7dea('0xd')]},'channel':{'type':Sequelize[_0x7dea('0x2')]},'connectedlinenum':{'type':Sequelize[_0x7dea('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x7dea('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x7dea('0x2')]},'priority':{'type':Sequelize[_0x7dea('0x2')]},'holdtime':{'type':Sequelize[_0x7dea('0xd')]},'mohtime':{'type':Sequelize[_0x7dea('0xd')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x7dea('0xe')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x7dea('0xe')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x7dea('0x2')]},'transferuniqueid':{'type':Sequelize[_0x7dea('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize[_0x7dea('0xd')],'defaultValue':0x0},'note':{'type':Sequelize[_0x7dea('0x2')]}}; \ No newline at end of file +var _0x9495=['YYYY-MM-DD\x20HH:mm:ss','diff','seconds','queuecallerleaveAt','setDataValue','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','moment','STRING','DATE','getDataValue','queuecallerjoinAt','format'];(function(_0x476bf4,_0x2a3755){var _0x788ffe=function(_0x13fa11){while(--_0x13fa11){_0x476bf4['push'](_0x476bf4['shift']());}};_0x788ffe(++_0x2a3755);}(_0x9495,0x13c));var _0x5949=function(_0x25ad30,_0x4d9cb8){_0x25ad30=_0x25ad30-0x0;var _0x97c45e=_0x9495[_0x25ad30];return _0x97c45e;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x5949('0x0'));module['exports']={'type':{'type':Sequelize[_0x5949('0x1')]},'uniqueid':{'type':Sequelize[_0x5949('0x1')]},'calleridnum':{'type':Sequelize[_0x5949('0x1')]},'calleridname':{'type':Sequelize[_0x5949('0x1')]},'queue':{'type':Sequelize[_0x5949('0x1')]},'queuecallerjoinAt':{'type':Sequelize['DATE']},'queuecallerleaveAt':{'type':Sequelize[_0x5949('0x2')],'set':function(_0xd078eb){var _0x50a162=moment(_0xd078eb);var _0x20c493=moment(this[_0x5949('0x3')](_0x5949('0x4')))[_0x5949('0x5')](_0x5949('0x6'));var _0x50dbff=_0x50a162[_0x5949('0x7')](_0x20c493,_0x5949('0x8'));this['setDataValue'](_0x5949('0x9'),_0xd078eb);this[_0x5949('0xa')]('holdtime',_0x50dbff||null);}},'position':{'type':Sequelize[_0x5949('0xb')]},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize[_0x5949('0xc')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize[_0x5949('0xc')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x5949('0x2')]},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x5949('0x2')]},'queuecallerexitreason':{'type':Sequelize[_0x5949('0x1')],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize[_0x5949('0xb')]},'channel':{'type':Sequelize[_0x5949('0x1')]},'connectedlinenum':{'type':Sequelize[_0x5949('0x1')]},'connectedlinename':{'type':Sequelize[_0x5949('0x1')]},'accountcode':{'type':Sequelize[_0x5949('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x5949('0x1')]},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x5949('0xc')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x5949('0x1')]},'transfer':{'type':Sequelize[_0x5949('0xc')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0x5949('0xd')},'transferexten':{'type':Sequelize[_0x5949('0x1')]},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x5949('0x1')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x5949('0x1')]},'queuecallerenterreason':{'type':Sequelize[_0x5949('0xb')],'defaultValue':0x0},'note':{'type':Sequelize[_0x5949('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 043e899..bed2b64 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 _0x3e5e=['localhost','register','sendStatus','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','status','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','where','filter','merge','VIRTUAL','VoiceQueueReport','include','rows','catch','show','params','length','includeAll','options','find','create','body','describe','sort','findAll','getVoiceQueuesReport','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/utils','../../config/environment','../../config/license/util','redis','defaults'];(function(_0x53b6a5,_0x183165){var _0x2ef34e=function(_0x35da86){while(--_0x35da86){_0x53b6a5['push'](_0x53b6a5['shift']());}};_0x2ef34e(++_0x183165);}(_0x3e5e,0x1b7));var _0xe3e5=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x3e5e[_0x2c91e9];return _0x13f0ff;};'use strict';var emlformat=require(_0xe3e5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe3e5('0x1'));var jsonpatch=require(_0xe3e5('0x2'));var rp=require(_0xe3e5('0x3'));var moment=require(_0xe3e5('0x4'));var BPromise=require(_0xe3e5('0x5'));var Mustache=require(_0xe3e5('0x6'));var util=require('util');var path=require(_0xe3e5('0x7'));var sox=require(_0xe3e5('0x8'));var csv=require(_0xe3e5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe3e5('0xa'));var _=require(_0xe3e5('0xb'));var squel=require(_0xe3e5('0xc'));var crypto=require('crypto');var jsforce=require(_0xe3e5('0xd'));var deskjs=require(_0xe3e5('0xe'));var toCsv=require(_0xe3e5('0x9'));var querystring=require(_0xe3e5('0xf'));var Papa=require('papaparse');var Redis=require(_0xe3e5('0x10'));var authService=require(_0xe3e5('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xe3e5('0x12'));var config=require(_0xe3e5('0x13'));var licenseUtil=require(_0xe3e5('0x14'));var db=require('../../mysqldb')['db'];config[_0xe3e5('0x15')]=_[_0xe3e5('0x16')](config['redis'],{'host':_0xe3e5('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./voiceQueueReport.socket')[_0xe3e5('0x18')](socket);function respondWithStatusCode(_0x57b8b8,_0x15fe53){_0x15fe53=_0x15fe53||0xcc;return function(_0x5d8d3d){if(_0x5d8d3d){return _0x57b8b8[_0xe3e5('0x19')](_0x15fe53);}return _0x57b8b8['status'](_0x15fe53)[_0xe3e5('0x1a')]();};}function respondWithResult(_0x11aeba,_0x90b2ec){_0x90b2ec=_0x90b2ec||0xc8;return function(_0x3c3f3b){if(_0x3c3f3b){return _0x11aeba['status'](_0x90b2ec)[_0xe3e5('0x1b')](_0x3c3f3b);}};}function respondWithFilteredResult(_0x2283ac,_0x113c2a){return function(_0x5ab845){if(_0x5ab845){var _0x25a8df=typeof _0x113c2a[_0xe3e5('0x1c')]===_0xe3e5('0x1d')&&typeof _0x113c2a[_0xe3e5('0x1e')]===_0xe3e5('0x1d');var _0x33dd8a=_0x5ab845['count'];var _0x47f72f=_0x25a8df?0x0:_0x113c2a[_0xe3e5('0x1c')];var _0x446d57=_0x25a8df?_0x5ab845[_0xe3e5('0x1f')]:_0x113c2a['offset']+_0x113c2a['limit'];var _0x4dba21;if(_0x446d57>=_0x33dd8a){_0x446d57=_0x33dd8a;_0x4dba21=0xc8;}else{_0x4dba21=0xce;}_0x2283ac['status'](_0x4dba21);return _0x2283ac[_0xe3e5('0x20')](_0xe3e5('0x21'),_0x47f72f+'-'+_0x446d57+'/'+_0x33dd8a)['json'](_0x5ab845);}return null;};}function patchUpdates(_0x2d7e6c){return function(_0x3fe575){try{jsonpatch[_0xe3e5('0x22')](_0x3fe575,_0x2d7e6c,!![]);}catch(_0x2e66e8){return BPromise[_0xe3e5('0x23')](_0x2e66e8);}return _0x3fe575['save']();};}function saveUpdates(_0x4f6061,_0x529226){return function(_0x1ce086){if(_0x1ce086){return _0x1ce086[_0xe3e5('0x24')](_0x4f6061)[_0xe3e5('0x25')](function(_0x516b44){return _0x516b44;});}return null;};}function removeEntity(_0xc3ca3d,_0x2f15f3){return function(_0xbdab4d){if(_0xbdab4d){return _0xbdab4d['destroy']()[_0xe3e5('0x25')](function(){_0xc3ca3d[_0xe3e5('0x26')](0xcc)[_0xe3e5('0x1a')]();});}};}function handleEntityNotFound(_0x8d51dc,_0x5b7d7a){return function(_0x584b51){if(!_0x584b51){_0x8d51dc[_0xe3e5('0x19')](0x194);}return _0x584b51;};}function handleError(_0x14a020,_0xee283d){_0xee283d=_0xee283d||0x1f4;return function(_0x3ed4cb){logger['error'](_0x3ed4cb['stack']);if(_0x3ed4cb[_0xe3e5('0x27')]){delete _0x3ed4cb[_0xe3e5('0x27')];}_0x14a020['status'](_0xee283d)[_0xe3e5('0x28')](_0x3ed4cb);};}exports[_0xe3e5('0x29')]=function(_0xc54d83,_0x141568){var _0x42aada={},_0x3a547a={},_0x2b7331={'count':0x0,'rows':[]};var _0x4d9417=_[_0xe3e5('0x2a')](db['VoiceQueueReport'][_0xe3e5('0x2b')],function(_0x43db45){return{'name':_0x43db45[_0xe3e5('0x2c')],'type':_0x43db45[_0xe3e5('0x2d')][_0xe3e5('0x2e')]};});_0x3a547a[_0xe3e5('0x2f')]=_[_0xe3e5('0x2a')](_0x4d9417,_0xe3e5('0x27'));_0x3a547a[_0xe3e5('0x30')]=_[_0xe3e5('0x31')](_0xc54d83[_0xe3e5('0x30')]);_0x3a547a[_0xe3e5('0x32')]=_[_0xe3e5('0x33')](_0x3a547a['model'],_0x3a547a[_0xe3e5('0x30')]);_0x42aada[_0xe3e5('0x34')]=_['intersection'](_0x3a547a[_0xe3e5('0x2f')],qs[_0xe3e5('0x35')](_0xc54d83[_0xe3e5('0x30')][_0xe3e5('0x35')]));_0x42aada[_0xe3e5('0x34')]=_0x42aada[_0xe3e5('0x34')]['length']?_0x42aada['attributes']:_0x3a547a[_0xe3e5('0x2f')];if(!_0xc54d83[_0xe3e5('0x30')][_0xe3e5('0x36')](_0xe3e5('0x37'))){_0x42aada[_0xe3e5('0x1e')]=qs['limit'](_0xc54d83[_0xe3e5('0x30')]['limit']);_0x42aada['offset']=qs[_0xe3e5('0x1c')](_0xc54d83[_0xe3e5('0x30')][_0xe3e5('0x1c')]);}_0x42aada[_0xe3e5('0x38')]=qs['sort'](_0xc54d83[_0xe3e5('0x30')]['sort']);_0x42aada[_0xe3e5('0x39')]=qs[_0xe3e5('0x32')](_['pick'](_0xc54d83[_0xe3e5('0x30')],_0x3a547a[_0xe3e5('0x32')]),_0x4d9417);if(_0xc54d83['query'][_0xe3e5('0x3a')]){_0x42aada[_0xe3e5('0x39')]=_[_0xe3e5('0x3b')](_0x42aada[_0xe3e5('0x39')],{'$or':_[_0xe3e5('0x2a')](_0x4d9417,function(_0x502498){if(_0x502498['type']!==_0xe3e5('0x3c')){var _0x3540b2={};_0x3540b2[_0x502498[_0xe3e5('0x27')]]={'$like':'%'+_0xc54d83[_0xe3e5('0x30')][_0xe3e5('0x3a')]+'%'};return _0x3540b2;}})});}_0x42aada=_['merge']({},_0x42aada,_0xc54d83['options']);var _0x27282f={'where':_0x42aada['where']};return db[_0xe3e5('0x3d')][_0xe3e5('0x1f')](_0x27282f)[_0xe3e5('0x25')](function(_0x28d0a7){_0x2b7331[_0xe3e5('0x1f')]=_0x28d0a7;if(_0xc54d83[_0xe3e5('0x30')]['includeAll']){_0x42aada[_0xe3e5('0x3e')]=[{'all':!![]}];}return db[_0xe3e5('0x3d')]['findAll'](_0x42aada);})[_0xe3e5('0x25')](function(_0x5570d4){_0x2b7331[_0xe3e5('0x3f')]=_0x5570d4;return _0x2b7331;})[_0xe3e5('0x25')](respondWithFilteredResult(_0x141568,_0x42aada))[_0xe3e5('0x40')](handleError(_0x141568,null));};exports[_0xe3e5('0x41')]=function(_0x5a7ed9,_0x578b52){var _0x230d64={'raw':![],'where':{'id':_0x5a7ed9[_0xe3e5('0x42')]['id']}},_0x206f34={};_0x206f34['model']=_[_0xe3e5('0x31')](db['VoiceQueueReport']['rawAttributes']);_0x206f34['query']=_[_0xe3e5('0x31')](_0x5a7ed9[_0xe3e5('0x30')]);_0x206f34[_0xe3e5('0x32')]=_[_0xe3e5('0x33')](_0x206f34[_0xe3e5('0x2f')],_0x206f34[_0xe3e5('0x30')]);_0x230d64['attributes']=_[_0xe3e5('0x33')](_0x206f34['model'],qs[_0xe3e5('0x35')](_0x5a7ed9[_0xe3e5('0x30')][_0xe3e5('0x35')]));_0x230d64[_0xe3e5('0x34')]=_0x230d64['attributes'][_0xe3e5('0x43')]?_0x230d64[_0xe3e5('0x34')]:_0x206f34[_0xe3e5('0x2f')];if(_0x5a7ed9[_0xe3e5('0x30')][_0xe3e5('0x44')]){_0x230d64['include']=[{'all':!![]}];}_0x230d64=_['merge']({},_0x230d64,_0x5a7ed9[_0xe3e5('0x45')]);return db[_0xe3e5('0x3d')][_0xe3e5('0x46')](_0x230d64)[_0xe3e5('0x25')](handleEntityNotFound(_0x578b52,null))[_0xe3e5('0x25')](respondWithResult(_0x578b52,null))[_0xe3e5('0x40')](handleError(_0x578b52,null));};exports[_0xe3e5('0x47')]=function(_0x36437c,_0x3f20ff){return db[_0xe3e5('0x3d')]['create'](_0x36437c[_0xe3e5('0x48')],{})[_0xe3e5('0x25')](respondWithResult(_0x3f20ff,0xc9))['catch'](handleError(_0x3f20ff,null));};exports[_0xe3e5('0x24')]=function(_0x22cc42,_0x36ee87){if(_0x22cc42[_0xe3e5('0x48')]['id']){delete _0x22cc42[_0xe3e5('0x48')]['id'];}return db[_0xe3e5('0x3d')][_0xe3e5('0x46')]({'where':{'id':_0x22cc42[_0xe3e5('0x42')]['id']}})[_0xe3e5('0x25')](handleEntityNotFound(_0x36ee87,null))[_0xe3e5('0x25')](saveUpdates(_0x22cc42[_0xe3e5('0x48')],null))[_0xe3e5('0x25')](respondWithResult(_0x36ee87,null))[_0xe3e5('0x40')](handleError(_0x36ee87,null));};exports['destroy']=function(_0x5bb30a,_0x3635f7){return db[_0xe3e5('0x3d')]['find']({'where':{'id':_0x5bb30a[_0xe3e5('0x42')]['id']}})[_0xe3e5('0x25')](handleEntityNotFound(_0x3635f7,null))['then'](removeEntity(_0x3635f7,null))[_0xe3e5('0x40')](handleError(_0x3635f7,null));};exports[_0xe3e5('0x49')]=function(_0x34b501,_0x248f6f){return db['VoiceQueueReport'][_0xe3e5('0x49')]()[_0xe3e5('0x25')](respondWithResult(_0x248f6f,null))['catch'](handleError(_0x248f6f,null));};exports['getVoiceQueuesReport']=function(_0xf1cd85,_0x495bd9){var _0xd293e8={},_0x44f1cf={},_0x2558fa={'count':0x0,'rows':[]};_0x44f1cf[_0xe3e5('0x2f')]=_['keys'](db[_0xe3e5('0x3d')][_0xe3e5('0x2b')]);_0x44f1cf[_0xe3e5('0x30')]=_[_0xe3e5('0x31')](_0xf1cd85[_0xe3e5('0x30')]);_0x44f1cf[_0xe3e5('0x32')]=_[_0xe3e5('0x33')](_0x44f1cf[_0xe3e5('0x2f')],_0x44f1cf[_0xe3e5('0x30')]);_0xd293e8['attributes']=_[_0xe3e5('0x33')](_0x44f1cf[_0xe3e5('0x2f')],qs['fields'](_0xf1cd85['query'][_0xe3e5('0x35')]));_0xd293e8[_0xe3e5('0x34')]=_0xd293e8[_0xe3e5('0x34')][_0xe3e5('0x43')]?_0xd293e8[_0xe3e5('0x34')]:_0x44f1cf[_0xe3e5('0x2f')];if(!_0xf1cd85[_0xe3e5('0x30')][_0xe3e5('0x36')]('nolimit')){_0xd293e8[_0xe3e5('0x1e')]=qs[_0xe3e5('0x1e')](_0xf1cd85[_0xe3e5('0x30')][_0xe3e5('0x1e')]);_0xd293e8[_0xe3e5('0x1c')]=qs[_0xe3e5('0x1c')](_0xf1cd85['query'][_0xe3e5('0x1c')]);}_0xd293e8['order']=qs[_0xe3e5('0x4a')](_0xf1cd85['query']['sort']);_0xd293e8[_0xe3e5('0x39')]=qs['filters'](_['pick'](_0xf1cd85[_0xe3e5('0x30')],_0x44f1cf[_0xe3e5('0x32')]));if(_0xf1cd85[_0xe3e5('0x30')][_0xe3e5('0x3a')]){_0xd293e8['where']=_[_0xe3e5('0x3b')](_0xd293e8[_0xe3e5('0x39')],{'$or':_[_0xe3e5('0x2a')](_0xd293e8['attributes'],function(_0x1598f9){var _0x4f8b74={};_0x4f8b74[_0x1598f9]={'$like':'%'+_0xf1cd85[_0xe3e5('0x30')][_0xe3e5('0x3a')]+'%'};return _0x4f8b74;})});}_0xd293e8=_[_0xe3e5('0x3b')]({},_0xd293e8,_0xf1cd85[_0xe3e5('0x45')]);var _0x31fd24={'where':_0xd293e8[_0xe3e5('0x39')]};return db[_0xe3e5('0x3d')][_0xe3e5('0x1f')](_0x31fd24)[_0xe3e5('0x25')](function(_0x3019cb){_0x2558fa[_0xe3e5('0x1f')]=_0x3019cb;if(_0xf1cd85['query'][_0xe3e5('0x44')]){_0xd293e8[_0xe3e5('0x3e')]=[{'all':!![]}];}return db[_0xe3e5('0x3d')][_0xe3e5('0x4b')](_0xd293e8);})[_0xe3e5('0x25')](function(_0x35e7a9){_0x2558fa[_0xe3e5('0x3f')]=_0x35e7a9;return _0x2558fa;})[_0xe3e5('0x25')](respondWithFilteredResult(_0x495bd9,_0xd293e8,_0xe3e5('0x4c')))['catch'](handleError(_0x495bd9,null,_0xe3e5('0x4c')));}; \ No newline at end of file +var _0x25e0=['options','create','body','find','describe','getVoiceQueuesReport','order','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','sendStatus','status','limit','undefined','offset','count','set','Content-Range','json','save','update','destroy','then','end','error','stack','name','send','index','map','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','merge','where','VoiceQueueReport','includeAll','include','findAll','rows','catch','show','params','rawAttributes','intersection'];(function(_0x3430aa,_0x57cd92){var _0x2ac5c=function(_0x3068dd){while(--_0x3068dd){_0x3430aa['push'](_0x3430aa['shift']());}};_0x2ac5c(++_0x57cd92);}(_0x25e0,0x197));var _0x025e=function(_0x4239c8,_0x2c0c6e){_0x4239c8=_0x4239c8-0x0;var _0x40323b=_0x25e0[_0x4239c8];return _0x40323b;};'use strict';var emlformat=require(_0x025e('0x0'));var rimraf=require(_0x025e('0x1'));var zipdir=require(_0x025e('0x2'));var jsonpatch=require(_0x025e('0x3'));var rp=require('request-promise');var moment=require(_0x025e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x025e('0x5'));var util=require(_0x025e('0x6'));var path=require('path');var sox=require(_0x025e('0x7'));var csv=require(_0x025e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x025e('0x9'));var squel=require(_0x025e('0xa'));var crypto=require(_0x025e('0xb'));var jsforce=require(_0x025e('0xc'));var deskjs=require(_0x025e('0xd'));var toCsv=require(_0x025e('0x8'));var querystring=require('querystring');var Papa=require(_0x025e('0xe'));var Redis=require(_0x025e('0xf'));var authService=require(_0x025e('0x10'));var qs=require(_0x025e('0x11'));var as=require(_0x025e('0x12'));var hardwareService=require(_0x025e('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x025e('0x14'));var config=require(_0x025e('0x15'));var licenseUtil=require(_0x025e('0x16'));var db=require(_0x025e('0x17'))['db'];config['redis']=_[_0x025e('0x18')](config[_0x025e('0x19')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./voiceQueueReport.socket')['register'](socket);function respondWithStatusCode(_0x180bd9,_0xacdd1b){_0xacdd1b=_0xacdd1b||0xcc;return function(_0x53f520){if(_0x53f520){return _0x180bd9[_0x025e('0x1a')](_0xacdd1b);}return _0x180bd9[_0x025e('0x1b')](_0xacdd1b)['end']();};}function respondWithResult(_0x5ada06,_0x57409c){_0x57409c=_0x57409c||0xc8;return function(_0x1b4333){if(_0x1b4333){return _0x5ada06[_0x025e('0x1b')](_0x57409c)['json'](_0x1b4333);}};}function respondWithFilteredResult(_0x520e07,_0xc38db5){return function(_0x566809){if(_0x566809){var _0x4c7799=typeof _0xc38db5['offset']==='undefined'&&typeof _0xc38db5[_0x025e('0x1c')]===_0x025e('0x1d');var _0x5d8aff=_0x566809['count'];var _0x2af355=_0x4c7799?0x0:_0xc38db5[_0x025e('0x1e')];var _0x3c30d9=_0x4c7799?_0x566809[_0x025e('0x1f')]:_0xc38db5[_0x025e('0x1e')]+_0xc38db5[_0x025e('0x1c')];var _0x40e4ed;if(_0x3c30d9>=_0x5d8aff){_0x3c30d9=_0x5d8aff;_0x40e4ed=0xc8;}else{_0x40e4ed=0xce;}_0x520e07[_0x025e('0x1b')](_0x40e4ed);return _0x520e07[_0x025e('0x20')](_0x025e('0x21'),_0x2af355+'-'+_0x3c30d9+'/'+_0x5d8aff)[_0x025e('0x22')](_0x566809);}return null;};}function patchUpdates(_0xbed2ea){return function(_0x496791){try{jsonpatch['apply'](_0x496791,_0xbed2ea,!![]);}catch(_0x287a07){return BPromise['reject'](_0x287a07);}return _0x496791[_0x025e('0x23')]();};}function saveUpdates(_0x29d8fb,_0x578a4c){return function(_0x59211d){if(_0x59211d){return _0x59211d[_0x025e('0x24')](_0x29d8fb)['then'](function(_0x4bd1df){return _0x4bd1df;});}return null;};}function removeEntity(_0x265b52,_0x2554e1){return function(_0x32d2f4){if(_0x32d2f4){return _0x32d2f4[_0x025e('0x25')]()[_0x025e('0x26')](function(){_0x265b52[_0x025e('0x1b')](0xcc)[_0x025e('0x27')]();});}};}function handleEntityNotFound(_0x428b87,_0x37279f){return function(_0x48080b){if(!_0x48080b){_0x428b87['sendStatus'](0x194);}return _0x48080b;};}function handleError(_0x2824dc,_0x3eb24f){_0x3eb24f=_0x3eb24f||0x1f4;return function(_0x39411d){logger[_0x025e('0x28')](_0x39411d[_0x025e('0x29')]);if(_0x39411d[_0x025e('0x2a')]){delete _0x39411d[_0x025e('0x2a')];}_0x2824dc[_0x025e('0x1b')](_0x3eb24f)[_0x025e('0x2b')](_0x39411d);};}exports[_0x025e('0x2c')]=function(_0x4c1da6,_0x49f0d5){var _0x3736a3={},_0x43a1b4={},_0x3723ae={'count':0x0,'rows':[]};var _0x159558=_[_0x025e('0x2d')](db['VoiceQueueReport']['rawAttributes'],function(_0x13e9eb){return{'name':_0x13e9eb[_0x025e('0x2e')],'type':_0x13e9eb[_0x025e('0x2f')][_0x025e('0x30')]};});_0x43a1b4[_0x025e('0x31')]=_[_0x025e('0x2d')](_0x159558,'name');_0x43a1b4[_0x025e('0x32')]=_[_0x025e('0x33')](_0x4c1da6[_0x025e('0x32')]);_0x43a1b4[_0x025e('0x34')]=_['intersection'](_0x43a1b4[_0x025e('0x31')],_0x43a1b4[_0x025e('0x32')]);_0x3736a3[_0x025e('0x35')]=_['intersection'](_0x43a1b4[_0x025e('0x31')],qs[_0x025e('0x36')](_0x4c1da6[_0x025e('0x32')][_0x025e('0x36')]));_0x3736a3[_0x025e('0x35')]=_0x3736a3[_0x025e('0x35')][_0x025e('0x37')]?_0x3736a3[_0x025e('0x35')]:_0x43a1b4['model'];if(!_0x4c1da6[_0x025e('0x32')][_0x025e('0x38')](_0x025e('0x39'))){_0x3736a3['limit']=qs[_0x025e('0x1c')](_0x4c1da6[_0x025e('0x32')][_0x025e('0x1c')]);_0x3736a3['offset']=qs[_0x025e('0x1e')](_0x4c1da6[_0x025e('0x32')]['offset']);}_0x3736a3['order']=qs[_0x025e('0x3a')](_0x4c1da6[_0x025e('0x32')][_0x025e('0x3a')]);_0x3736a3['where']=qs['filters'](_[_0x025e('0x3b')](_0x4c1da6['query'],_0x43a1b4[_0x025e('0x34')]),_0x159558);if(_0x4c1da6[_0x025e('0x32')][_0x025e('0x3c')]){_0x3736a3['where']=_[_0x025e('0x3d')](_0x3736a3[_0x025e('0x3e')],{'$or':_[_0x025e('0x2d')](_0x159558,function(_0x4cb550){if(_0x4cb550[_0x025e('0x2f')]!=='VIRTUAL'){var _0x6f8e34={};_0x6f8e34[_0x4cb550[_0x025e('0x2a')]]={'$like':'%'+_0x4c1da6[_0x025e('0x32')]['filter']+'%'};return _0x6f8e34;}})});}_0x3736a3=_[_0x025e('0x3d')]({},_0x3736a3,_0x4c1da6['options']);var _0x3d579f={'where':_0x3736a3[_0x025e('0x3e')]};return db[_0x025e('0x3f')][_0x025e('0x1f')](_0x3d579f)[_0x025e('0x26')](function(_0xa29b62){_0x3723ae[_0x025e('0x1f')]=_0xa29b62;if(_0x4c1da6[_0x025e('0x32')][_0x025e('0x40')]){_0x3736a3[_0x025e('0x41')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0x025e('0x42')](_0x3736a3);})[_0x025e('0x26')](function(_0x2044f4){_0x3723ae[_0x025e('0x43')]=_0x2044f4;return _0x3723ae;})['then'](respondWithFilteredResult(_0x49f0d5,_0x3736a3))[_0x025e('0x44')](handleError(_0x49f0d5,null));};exports[_0x025e('0x45')]=function(_0x333da8,_0x37897b){var _0x3c2899={'raw':![],'where':{'id':_0x333da8[_0x025e('0x46')]['id']}},_0x430ee8={};_0x430ee8[_0x025e('0x31')]=_['keys'](db['VoiceQueueReport'][_0x025e('0x47')]);_0x430ee8[_0x025e('0x32')]=_[_0x025e('0x33')](_0x333da8[_0x025e('0x32')]);_0x430ee8[_0x025e('0x34')]=_['intersection'](_0x430ee8[_0x025e('0x31')],_0x430ee8['query']);_0x3c2899[_0x025e('0x35')]=_[_0x025e('0x48')](_0x430ee8[_0x025e('0x31')],qs[_0x025e('0x36')](_0x333da8[_0x025e('0x32')]['fields']));_0x3c2899['attributes']=_0x3c2899['attributes'][_0x025e('0x37')]?_0x3c2899[_0x025e('0x35')]:_0x430ee8[_0x025e('0x31')];if(_0x333da8[_0x025e('0x32')]['includeAll']){_0x3c2899[_0x025e('0x41')]=[{'all':!![]}];}_0x3c2899=_[_0x025e('0x3d')]({},_0x3c2899,_0x333da8[_0x025e('0x49')]);return db[_0x025e('0x3f')]['find'](_0x3c2899)[_0x025e('0x26')](handleEntityNotFound(_0x37897b,null))[_0x025e('0x26')](respondWithResult(_0x37897b,null))[_0x025e('0x44')](handleError(_0x37897b,null));};exports[_0x025e('0x4a')]=function(_0x2463c,_0x303697){return db[_0x025e('0x3f')][_0x025e('0x4a')](_0x2463c[_0x025e('0x4b')],{})[_0x025e('0x26')](respondWithResult(_0x303697,0xc9))[_0x025e('0x44')](handleError(_0x303697,null));};exports[_0x025e('0x24')]=function(_0x4a5fe7,_0x1970f3){if(_0x4a5fe7['body']['id']){delete _0x4a5fe7['body']['id'];}return db[_0x025e('0x3f')][_0x025e('0x4c')]({'where':{'id':_0x4a5fe7[_0x025e('0x46')]['id']}})['then'](handleEntityNotFound(_0x1970f3,null))[_0x025e('0x26')](saveUpdates(_0x4a5fe7[_0x025e('0x4b')],null))[_0x025e('0x26')](respondWithResult(_0x1970f3,null))['catch'](handleError(_0x1970f3,null));};exports[_0x025e('0x25')]=function(_0x51c41b,_0x379b5f){return db[_0x025e('0x3f')][_0x025e('0x4c')]({'where':{'id':_0x51c41b[_0x025e('0x46')]['id']}})['then'](handleEntityNotFound(_0x379b5f,null))[_0x025e('0x26')](removeEntity(_0x379b5f,null))['catch'](handleError(_0x379b5f,null));};exports[_0x025e('0x4d')]=function(_0x503a3d,_0x649e){return db[_0x025e('0x3f')][_0x025e('0x4d')]()[_0x025e('0x26')](respondWithResult(_0x649e,null))[_0x025e('0x44')](handleError(_0x649e,null));};exports[_0x025e('0x4e')]=function(_0x125ce9,_0x5032e9){var _0x2a5582={},_0x316a4e={},_0x599ff3={'count':0x0,'rows':[]};_0x316a4e[_0x025e('0x31')]=_['keys'](db['VoiceQueueReport'][_0x025e('0x47')]);_0x316a4e[_0x025e('0x32')]=_['keys'](_0x125ce9[_0x025e('0x32')]);_0x316a4e[_0x025e('0x34')]=_['intersection'](_0x316a4e[_0x025e('0x31')],_0x316a4e[_0x025e('0x32')]);_0x2a5582[_0x025e('0x35')]=_[_0x025e('0x48')](_0x316a4e[_0x025e('0x31')],qs[_0x025e('0x36')](_0x125ce9[_0x025e('0x32')]['fields']));_0x2a5582['attributes']=_0x2a5582[_0x025e('0x35')][_0x025e('0x37')]?_0x2a5582[_0x025e('0x35')]:_0x316a4e[_0x025e('0x31')];if(!_0x125ce9[_0x025e('0x32')]['hasOwnProperty'](_0x025e('0x39'))){_0x2a5582[_0x025e('0x1c')]=qs[_0x025e('0x1c')](_0x125ce9['query'][_0x025e('0x1c')]);_0x2a5582[_0x025e('0x1e')]=qs[_0x025e('0x1e')](_0x125ce9['query'][_0x025e('0x1e')]);}_0x2a5582[_0x025e('0x4f')]=qs['sort'](_0x125ce9[_0x025e('0x32')]['sort']);_0x2a5582['where']=qs[_0x025e('0x34')](_[_0x025e('0x3b')](_0x125ce9[_0x025e('0x32')],_0x316a4e[_0x025e('0x34')]));if(_0x125ce9['query'][_0x025e('0x3c')]){_0x2a5582['where']=_[_0x025e('0x3d')](_0x2a5582[_0x025e('0x3e')],{'$or':_[_0x025e('0x2d')](_0x2a5582[_0x025e('0x35')],function(_0x21c327){var _0x1c2564={};_0x1c2564[_0x21c327]={'$like':'%'+_0x125ce9[_0x025e('0x32')]['filter']+'%'};return _0x1c2564;})});}_0x2a5582=_[_0x025e('0x3d')]({},_0x2a5582,_0x125ce9['options']);var _0x22dd12={'where':_0x2a5582[_0x025e('0x3e')]};return db[_0x025e('0x3f')][_0x025e('0x1f')](_0x22dd12)[_0x025e('0x26')](function(_0x53dcc5){_0x599ff3[_0x025e('0x1f')]=_0x53dcc5;if(_0x125ce9['query'][_0x025e('0x40')]){_0x2a5582[_0x025e('0x41')]=[{'all':!![]}];}return db[_0x025e('0x3f')][_0x025e('0x42')](_0x2a5582);})[_0x025e('0x26')](function(_0x562e67){_0x599ff3['rows']=_0x562e67;return _0x599ff3;})[_0x025e('0x26')](respondWithFilteredResult(_0x5032e9,_0x2a5582,_0x025e('0x4e')))[_0x025e('0x44')](handleError(_0x5032e9,null,_0x025e('0x4e')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index a353338..967cc8b 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 _0x3972=['emit','hasOwnProperty','hook','exports','events','VoiceQueueReport','save','update','remove'];(function(_0x247fa1,_0x4ec37c){var _0x244f35=function(_0xfb98be){while(--_0xfb98be){_0x247fa1['push'](_0x247fa1['shift']());}};_0x244f35(++_0x4ec37c);}(_0x3972,0x16c));var _0x2397=function(_0x2351af,_0x15969f){_0x2351af=_0x2351af-0x0;var _0x317e32=_0x3972[_0x2351af];return _0x317e32;};'use strict';var EventEmitter=require(_0x2397('0x0'));var VoiceQueueReport=require('../../mysqldb')['db'][_0x2397('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2397('0x2'),'afterUpdate':_0x2397('0x3'),'afterDestroy':_0x2397('0x4')};function emitEvent(_0x417fa2){return function(_0x3b132b,_0x284cdf,_0x1fe995){VoiceQueueReportEvents[_0x2397('0x5')](_0x417fa2+':'+_0x3b132b['id'],_0x3b132b);VoiceQueueReportEvents[_0x2397('0x5')](_0x417fa2,_0x3b132b);_0x1fe995(null);};}for(var e in events){if(events[_0x2397('0x6')](e)){var event=events[e];VoiceQueueReport[_0x2397('0x7')](e,emitEvent(event));}}module[_0x2397('0x8')]=VoiceQueueReportEvents; \ No newline at end of file +var _0xdec1=['VoiceQueueReport','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x4b5a4b,_0x1b116b){var _0x27dae8=function(_0x5557a3){while(--_0x5557a3){_0x4b5a4b['push'](_0x4b5a4b['shift']());}};_0x27dae8(++_0x1b116b);}(_0xdec1,0x11f));var _0x1dec=function(_0x365d5c,_0x17a9af){_0x365d5c=_0x365d5c-0x0;var _0x1c146a=_0xdec1[_0x365d5c];return _0x1c146a;};'use strict';var EventEmitter=require(_0x1dec('0x0'));var VoiceQueueReport=require('../../mysqldb')['db'][_0x1dec('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x1dec('0x2')](0x0);var events={'afterCreate':_0x1dec('0x3'),'afterUpdate':_0x1dec('0x4'),'afterDestroy':_0x1dec('0x5')};function emitEvent(_0x4e14b9){return function(_0x2f9165,_0x55ddd8,_0x442e75){VoiceQueueReportEvents[_0x1dec('0x6')](_0x4e14b9+':'+_0x2f9165['id'],_0x2f9165);VoiceQueueReportEvents['emit'](_0x4e14b9,_0x2f9165);_0x442e75(null);};}for(var e in events){if(events[_0x1dec('0x7')](e)){var event=events[e];VoiceQueueReport[_0x1dec('0x8')](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index c584153..3e2f585 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 _0xa09a=['api','moment','bluebird','request-promise','path','rimraf','./voiceQueueReport.attributes','exports','define','VoiceQueueReport','uniqueid','calleridnum','util'];(function(_0x2b9b7f,_0x4d47df){var _0x4ed19a=function(_0x72b5ff){while(--_0x72b5ff){_0x2b9b7f['push'](_0x2b9b7f['shift']());}};_0x4ed19a(++_0x4d47df);}(_0xa09a,0x178));var _0xaa09=function(_0x1ca3ec,_0x250240){_0x1ca3ec=_0x1ca3ec-0x0;var _0x5de666=_0xa09a[_0x1ca3ec];return _0x5de666;};'use strict';var _=require('lodash');var util=require(_0xaa09('0x0'));var logger=require('../../config/logger')(_0xaa09('0x1'));var moment=require(_0xaa09('0x2'));var BPromise=require(_0xaa09('0x3'));var rp=require(_0xaa09('0x4'));var fs=require('fs');var path=require(_0xaa09('0x5'));var rimraf=require(_0xaa09('0x6'));var config=require('../../config/environment');var attributes=require(_0xaa09('0x7'));module[_0xaa09('0x8')]=function(_0x40f034,_0xfbea80){return _0x40f034[_0xaa09('0x9')](_0xaa09('0xa'),attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':[_0xaa09('0xb')]},{'fields':[_0xaa09('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3116=['bluebird','request-promise','../../config/environment','./voiceQueueReport.attributes','exports','define','report_queue','uniqueid','calleridnum','util','../../config/logger','moment'];(function(_0x285e8f,_0x446cfd){var _0x2c63a1=function(_0xf70392){while(--_0xf70392){_0x285e8f['push'](_0x285e8f['shift']());}};_0x2c63a1(++_0x446cfd);}(_0x3116,0x165));var _0x6311=function(_0x54d4a8,_0x585a59){_0x54d4a8=_0x54d4a8-0x0;var _0x3b321b=_0x3116[_0x54d4a8];return _0x3b321b;};'use strict';var _=require('lodash');var util=require(_0x6311('0x0'));var logger=require(_0x6311('0x1'))('api');var moment=require(_0x6311('0x2'));var BPromise=require(_0x6311('0x3'));var rp=require(_0x6311('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6311('0x5'));var attributes=require(_0x6311('0x6'));module[_0x6311('0x7')]=function(_0x507964,_0xa3dbdf){return _0x507964[_0x6311('0x8')]('VoiceQueueReport',attributes,{'tableName':_0x6311('0x9'),'paranoid':![],'indexes':[{'fields':[_0x6311('0xa')]},{'fields':[_0x6311('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 0df7d3a..46109d5 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 _0xa934=['stringify','code','error','message','request\x20sent','result','catch','GetVoiceQueueReport','VoiceQueueReport','options','raw','where','attributes','include','map','model','CreateVoiceQueueReport','create','body','UpdateVoiceQueueReport','update','limit','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','VoiceQueueReport,\x20%s,\x20%s','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s'];(function(_0x1c518c,_0x383352){var _0x2650cb=function(_0x45fe77){while(--_0x45fe77){_0x1c518c['push'](_0x1c518c['shift']());}};_0x2650cb(++_0x383352);}(_0xa934,0xf7));var _0x4a93=function(_0x5cd30f,_0x262fb0){_0x5cd30f=_0x5cd30f-0x0;var _0x5aae58=_0xa934[_0x5cd30f];return _0x5aae58;};'use strict';var _=require(_0x4a93('0x0'));var util=require(_0x4a93('0x1'));var moment=require(_0x4a93('0x2'));var BPromise=require('bluebird');var rs=require(_0x4a93('0x3'));var fs=require('fs');var Redis=require(_0x4a93('0x4'));var db=require(_0x4a93('0x5'))['db'];var utils=require(_0x4a93('0x6'));var logger=require(_0x4a93('0x7'))('rpc');var config=require(_0x4a93('0x8'));var jayson=require(_0x4a93('0x9'));var client=jayson[_0x4a93('0xa')][_0x4a93('0xb')]({'port':0x232a});config[_0x4a93('0xc')]=_[_0x4a93('0xd')](config[_0x4a93('0xc')],{'host':_0x4a93('0xe'),'port':0x18eb});var socket=require(_0x4a93('0xf'))(new Redis(config['redis']));require('./voiceQueueReport.socket')[_0x4a93('0x10')](socket);function respondWithRpcPromise(_0x3e8658,_0x2183f5,_0x45146f){return new BPromise(function(_0xb1e457,_0x2adfea){return client[_0x4a93('0x11')](_0x3e8658,_0x45146f)[_0x4a93('0x12')](function(_0x1014ee){logger[_0x4a93('0x13')](_0x4a93('0x14'),_0x2183f5,'request\x20sent');logger[_0x4a93('0x15')](_0x4a93('0x16'),_0x2183f5,'request\x20sent',JSON[_0x4a93('0x17')](_0x1014ee));if(_0x1014ee['error']){if(_0x1014ee['error'][_0x4a93('0x18')]===0x1f4){logger[_0x4a93('0x19')](_0x4a93('0x14'),_0x2183f5,_0x1014ee[_0x4a93('0x19')][_0x4a93('0x1a')]);return _0x2adfea(_0x1014ee[_0x4a93('0x19')][_0x4a93('0x1a')]);}logger['error'](_0x4a93('0x14'),_0x2183f5,_0x1014ee[_0x4a93('0x19')][_0x4a93('0x1a')]);return _0xb1e457(_0x1014ee['error'][_0x4a93('0x1a')]);}else{logger[_0x4a93('0x13')](_0x4a93('0x14'),_0x2183f5,_0x4a93('0x1b'));_0xb1e457(_0x1014ee[_0x4a93('0x1c')][_0x4a93('0x1a')]);}})[_0x4a93('0x1d')](function(_0x2c1b34){logger['error']('VoiceQueueReport,\x20%s,\x20%s',_0x2183f5,_0x2c1b34);_0x2adfea(_0x2c1b34);});});}exports[_0x4a93('0x1e')]=function(_0x1fb3c6){var _0x34b8ab=this;return new Promise(function(_0x560346,_0x195e23){return db[_0x4a93('0x1f')]['findAll']({'raw':_0x1fb3c6[_0x4a93('0x20')]?_0x1fb3c6['options'][_0x4a93('0x21')]===undefined?!![]:![]:!![],'where':_0x1fb3c6[_0x4a93('0x20')]?_0x1fb3c6[_0x4a93('0x20')][_0x4a93('0x22')]||null:null,'attributes':_0x1fb3c6[_0x4a93('0x20')]?_0x1fb3c6['options'][_0x4a93('0x23')]||null:null,'limit':_0x1fb3c6[_0x4a93('0x20')]?_0x1fb3c6[_0x4a93('0x20')]['limit']||null:null,'include':_0x1fb3c6[_0x4a93('0x20')]?_0x1fb3c6[_0x4a93('0x20')][_0x4a93('0x24')]?_[_0x4a93('0x25')](_0x1fb3c6[_0x4a93('0x20')][_0x4a93('0x24')],function(_0x45ac69){return{'model':db[_0x45ac69[_0x4a93('0x26')]],'as':_0x45ac69['as'],'attributes':_0x45ac69[_0x4a93('0x23')],'include':_0x45ac69['include']?_[_0x4a93('0x25')](_0x45ac69[_0x4a93('0x24')],function(_0x4fe406){return{'model':db[_0x4fe406[_0x4a93('0x26')]],'as':_0x4fe406['as'],'attributes':_0x4fe406[_0x4a93('0x23')],'include':_0x4fe406['include']?_[_0x4a93('0x25')](_0x4fe406['include'],function(_0x5de601){return{'model':db[_0x5de601['model']],'as':_0x5de601['as'],'attributes':_0x5de601[_0x4a93('0x23')]};}):[]};}):[]};}):[]:[]})[_0x4a93('0x12')](function(_0x152e60){logger[_0x4a93('0x13')](_0x4a93('0x1e'),_0x1fb3c6);logger['debug'](_0x4a93('0x1e'),_0x1fb3c6,JSON[_0x4a93('0x17')](_0x152e60));_0x560346(_0x152e60);})[_0x4a93('0x1d')](function(_0x2c1d26){logger[_0x4a93('0x19')](_0x4a93('0x1e'),_0x2c1d26['message'],_0x1fb3c6);_0x195e23(_0x34b8ab[_0x4a93('0x19')](0x1f4,_0x2c1d26[_0x4a93('0x1a')]));});});};exports[_0x4a93('0x27')]=function(_0x2dcec4){var _0x450adf=this;return new Promise(function(_0x57cc99,_0x59472f){return db['VoiceQueueReport'][_0x4a93('0x28')](_0x2dcec4[_0x4a93('0x29')],{'raw':_0x2dcec4[_0x4a93('0x20')]?_0x2dcec4[_0x4a93('0x20')][_0x4a93('0x21')]===undefined?!![]:![]:!![]})[_0x4a93('0x12')](function(_0x94978f){logger['info'](_0x4a93('0x27'),_0x2dcec4);logger[_0x4a93('0x15')](_0x4a93('0x27'),_0x2dcec4,JSON['stringify'](_0x94978f));_0x57cc99(_0x94978f);})[_0x4a93('0x1d')](function(_0x43d10b){logger[_0x4a93('0x19')](_0x4a93('0x27'),_0x43d10b[_0x4a93('0x1a')],_0x2dcec4);_0x59472f(_0x450adf['error'](0x1f4,_0x43d10b[_0x4a93('0x1a')]));});});};exports[_0x4a93('0x2a')]=function(_0x5f413b){var _0x7f53b2=this;return new Promise(function(_0xb2292f,_0x1c0784){return db[_0x4a93('0x1f')][_0x4a93('0x2b')](_0x5f413b[_0x4a93('0x29')],{'raw':_0x5f413b[_0x4a93('0x20')]?_0x5f413b[_0x4a93('0x20')][_0x4a93('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5f413b[_0x4a93('0x20')]?_0x5f413b['options'][_0x4a93('0x22')]||null:null,'attributes':_0x5f413b['options']?_0x5f413b[_0x4a93('0x20')][_0x4a93('0x23')]||null:null,'limit':_0x5f413b[_0x4a93('0x20')]?_0x5f413b[_0x4a93('0x20')][_0x4a93('0x2c')]||null:null})['then'](function(_0x518ed4){logger['info'](_0x4a93('0x2a'),_0x5f413b);logger['debug'](_0x4a93('0x2a'),_0x5f413b,JSON[_0x4a93('0x17')](_0x518ed4));_0xb2292f(_0x518ed4);})[_0x4a93('0x1d')](function(_0x4eb860){logger[_0x4a93('0x19')](_0x4a93('0x2a'),_0x4eb860[_0x4a93('0x1a')],_0x5f413b);_0x1c0784(_0x7f53b2[_0x4a93('0x19')](0x1f4,_0x4eb860[_0x4a93('0x1a')]));});});}; \ No newline at end of file +var _0xfd16=['debug','UpdateVoiceQueueReport','body','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','redis','defaults','socket.io-emitter','request','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceQueueReport','findAll','options','raw','where','attributes','limit','include','map','model','VoiceQueueReport','create','CreateVoiceQueueReport'];(function(_0x4ac1d4,_0x426667){var _0x48b460=function(_0x50961a){while(--_0x50961a){_0x4ac1d4['push'](_0x4ac1d4['shift']());}};_0x48b460(++_0x426667);}(_0xfd16,0xa3));var _0x6fd1=function(_0x432fca,_0xb0b1b5){_0x432fca=_0x432fca-0x0;var _0x3adba4=_0xfd16[_0x432fca];return _0x3adba4;};'use strict';var _=require(_0x6fd1('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x6fd1('0x1'));var rs=require(_0x6fd1('0x2'));var fs=require('fs');var Redis=require(_0x6fd1('0x3'));var db=require(_0x6fd1('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6fd1('0x5'))(_0x6fd1('0x6'));var config=require('../../config/environment');var jayson=require(_0x6fd1('0x7'));var client=jayson[_0x6fd1('0x8')]['http']({'port':0x232a});config[_0x6fd1('0x9')]=_[_0x6fd1('0xa')](config[_0x6fd1('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x6fd1('0xb'))(new Redis(config[_0x6fd1('0x9')]));require('./voiceQueueReport.socket')['register'](socket);function respondWithRpcPromise(_0x4afe47,_0x4abe1e,_0x2767dd){return new BPromise(function(_0xaa369d,_0xdd4b56){return client[_0x6fd1('0xc')](_0x4afe47,_0x2767dd)[_0x6fd1('0xd')](function(_0x5525f1){logger[_0x6fd1('0xe')](_0x6fd1('0xf'),_0x4abe1e,_0x6fd1('0x10'));logger['debug'](_0x6fd1('0x11'),_0x4abe1e,'request\x20sent',JSON[_0x6fd1('0x12')](_0x5525f1));if(_0x5525f1[_0x6fd1('0x13')]){if(_0x5525f1['error'][_0x6fd1('0x14')]===0x1f4){logger['error'](_0x6fd1('0xf'),_0x4abe1e,_0x5525f1[_0x6fd1('0x13')][_0x6fd1('0x15')]);return _0xdd4b56(_0x5525f1[_0x6fd1('0x13')][_0x6fd1('0x15')]);}logger[_0x6fd1('0x13')](_0x6fd1('0xf'),_0x4abe1e,_0x5525f1[_0x6fd1('0x13')][_0x6fd1('0x15')]);return _0xaa369d(_0x5525f1[_0x6fd1('0x13')]['message']);}else{logger['info']('VoiceQueueReport,\x20%s,\x20%s',_0x4abe1e,_0x6fd1('0x10'));_0xaa369d(_0x5525f1[_0x6fd1('0x16')][_0x6fd1('0x15')]);}})[_0x6fd1('0x17')](function(_0x235fa5){logger['error'](_0x6fd1('0xf'),_0x4abe1e,_0x235fa5);_0xdd4b56(_0x235fa5);});});}exports[_0x6fd1('0x18')]=function(_0x1b1d6b){var _0x1f03ba=this;return new Promise(function(_0x1adf3b,_0x33706f){return db['VoiceQueueReport'][_0x6fd1('0x19')]({'raw':_0x1b1d6b[_0x6fd1('0x1a')]?_0x1b1d6b[_0x6fd1('0x1a')][_0x6fd1('0x1b')]===undefined?!![]:![]:!![],'where':_0x1b1d6b[_0x6fd1('0x1a')]?_0x1b1d6b[_0x6fd1('0x1a')][_0x6fd1('0x1c')]||null:null,'attributes':_0x1b1d6b[_0x6fd1('0x1a')]?_0x1b1d6b[_0x6fd1('0x1a')][_0x6fd1('0x1d')]||null:null,'limit':_0x1b1d6b[_0x6fd1('0x1a')]?_0x1b1d6b[_0x6fd1('0x1a')][_0x6fd1('0x1e')]||null:null,'include':_0x1b1d6b['options']?_0x1b1d6b['options'][_0x6fd1('0x1f')]?_[_0x6fd1('0x20')](_0x1b1d6b[_0x6fd1('0x1a')][_0x6fd1('0x1f')],function(_0x5bd6ba){return{'model':db[_0x5bd6ba['model']],'as':_0x5bd6ba['as'],'attributes':_0x5bd6ba[_0x6fd1('0x1d')],'include':_0x5bd6ba[_0x6fd1('0x1f')]?_[_0x6fd1('0x20')](_0x5bd6ba[_0x6fd1('0x1f')],function(_0x2721f9){return{'model':db[_0x2721f9[_0x6fd1('0x21')]],'as':_0x2721f9['as'],'attributes':_0x2721f9[_0x6fd1('0x1d')],'include':_0x2721f9[_0x6fd1('0x1f')]?_[_0x6fd1('0x20')](_0x2721f9['include'],function(_0x403f21){return{'model':db[_0x403f21['model']],'as':_0x403f21['as'],'attributes':_0x403f21[_0x6fd1('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x6fd1('0xd')](function(_0xaa6dc5){logger[_0x6fd1('0xe')](_0x6fd1('0x18'),_0x1b1d6b);logger['debug']('GetVoiceQueueReport',_0x1b1d6b,JSON['stringify'](_0xaa6dc5));_0x1adf3b(_0xaa6dc5);})[_0x6fd1('0x17')](function(_0x2797f2){logger['error'](_0x6fd1('0x18'),_0x2797f2[_0x6fd1('0x15')],_0x1b1d6b);_0x33706f(_0x1f03ba['error'](0x1f4,_0x2797f2[_0x6fd1('0x15')]));});});};exports['CreateVoiceQueueReport']=function(_0x122f79){var _0x402b39=this;return new Promise(function(_0x2f2866,_0x44f5a){return db[_0x6fd1('0x22')][_0x6fd1('0x23')](_0x122f79['body'],{'raw':_0x122f79['options']?_0x122f79[_0x6fd1('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x6fd1('0xd')](function(_0x22cae2){logger[_0x6fd1('0xe')](_0x6fd1('0x24'),_0x122f79);logger[_0x6fd1('0x25')](_0x6fd1('0x24'),_0x122f79,JSON['stringify'](_0x22cae2));_0x2f2866(_0x22cae2);})[_0x6fd1('0x17')](function(_0x3f63f8){logger[_0x6fd1('0x13')]('CreateVoiceQueueReport',_0x3f63f8[_0x6fd1('0x15')],_0x122f79);_0x44f5a(_0x402b39[_0x6fd1('0x13')](0x1f4,_0x3f63f8['message']));});});};exports[_0x6fd1('0x26')]=function(_0x2c11e8){var _0x5acac5=this;return new Promise(function(_0x13ec1d,_0x1a2fb7){return db['VoiceQueueReport']['update'](_0x2c11e8[_0x6fd1('0x27')],{'raw':_0x2c11e8['options']?_0x2c11e8['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2c11e8[_0x6fd1('0x1a')]?_0x2c11e8[_0x6fd1('0x1a')]['where']||null:null,'attributes':_0x2c11e8[_0x6fd1('0x1a')]?_0x2c11e8[_0x6fd1('0x1a')][_0x6fd1('0x1d')]||null:null,'limit':_0x2c11e8[_0x6fd1('0x1a')]?_0x2c11e8['options']['limit']||null:null})[_0x6fd1('0xd')](function(_0x4207c1){logger[_0x6fd1('0xe')](_0x6fd1('0x26'),_0x2c11e8);logger[_0x6fd1('0x25')](_0x6fd1('0x26'),_0x2c11e8,JSON[_0x6fd1('0x12')](_0x4207c1));_0x13ec1d(_0x4207c1);})[_0x6fd1('0x17')](function(_0xa1d6d7){logger[_0x6fd1('0x13')](_0x6fd1('0x26'),_0xa1d6d7[_0x6fd1('0x15')],_0x2c11e8);_0x1a2fb7(_0x5acac5[_0x6fd1('0x13')](0x1f4,_0xa1d6d7['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index ea1cb13..c5fedc0 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 _0x4b47=['removeListener','register','length','voiceQueueReport:','./voiceQueueReport.events','remove','update','emit'];(function(_0x53fcae,_0x4fe20f){var _0x55c794=function(_0xcd0345){while(--_0xcd0345){_0x53fcae['push'](_0x53fcae['shift']());}};_0x55c794(++_0x4fe20f);}(_0x4b47,0x1b4));var _0x74b4=function(_0x2f4773,_0x325ea9){_0x2f4773=_0x2f4773-0x0;var _0x72b3e=_0x4b47[_0x2f4773];return _0x72b3e;};'use strict';var VoiceQueueReportEvents=require(_0x74b4('0x0'));var events=['save',_0x74b4('0x1'),_0x74b4('0x2')];function createListener(_0x4469a4,_0x1f5100){return function(_0x1f9dac){_0x1f5100[_0x74b4('0x3')](_0x4469a4,_0x1f9dac);};}function removeListener(_0x565f6b,_0x4ed4fe){return function(){VoiceQueueReportEvents[_0x74b4('0x4')](_0x565f6b,_0x4ed4fe);};}exports[_0x74b4('0x5')]=function(_0x4dc737){for(var _0x4cd397=0x0,_0x482278=events[_0x74b4('0x6')];_0x4cd397<_0x482278;_0x4cd397++){var _0x75ea22=events[_0x4cd397];var _0x1ebbb8=createListener(_0x74b4('0x7')+_0x75ea22,_0x4dc737);VoiceQueueReportEvents['on'](_0x75ea22,_0x1ebbb8);}}; \ No newline at end of file +var _0xb8ca=['save','remove','removeListener','register','voiceQueueReport:','./voiceQueueReport.events'];(function(_0x5c6218,_0x3496c8){var _0x5beb85=function(_0x57c5c8){while(--_0x57c5c8){_0x5c6218['push'](_0x5c6218['shift']());}};_0x5beb85(++_0x3496c8);}(_0xb8ca,0x89));var _0xab8c=function(_0x23fb16,_0x189597){_0x23fb16=_0x23fb16-0x0;var _0x19c8de=_0xb8ca[_0x23fb16];return _0x19c8de;};'use strict';var VoiceQueueReportEvents=require(_0xab8c('0x0'));var events=[_0xab8c('0x1'),_0xab8c('0x2'),'update'];function createListener(_0x22f9bf,_0x1a2b0a){return function(_0x534d74){_0x1a2b0a['emit'](_0x22f9bf,_0x534d74);};}function removeListener(_0x40c0b4,_0x293bde){return function(){VoiceQueueReportEvents[_0xab8c('0x3')](_0x40c0b4,_0x293bde);};}exports[_0xab8c('0x4')]=function(_0x31cc24){for(var _0x340159=0x0,_0x506335=events['length'];_0x340159<_0x506335;_0x340159++){var _0x32f11f=events[_0x340159];var _0x56f6ac=createListener(_0xab8c('0x5')+_0x32f11f,_0x31cc24);VoiceQueueReportEvents['on'](_0x32f11f,_0x56f6ac);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 346199c..c393b5d 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 _0xd1e7=['multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','post','create','put','/:id','delete','destroy','exports'];(function(_0x1baebc,_0x40a774){var _0x2d924a=function(_0x247ba2){while(--_0x247ba2){_0x1baebc['push'](_0x1baebc['shift']());}};_0x2d924a(++_0x40a774);}(_0xd1e7,0x1d4));var _0x7d1e=function(_0x57a40d,_0x388e2b){_0x57a40d=_0x57a40d-0x0;var _0x2ccfc2=_0xd1e7[_0x57a40d];return _0x2ccfc2;};'use strict';var multer=require(_0x7d1e('0x0'));var util=require(_0x7d1e('0x1'));var path=require(_0x7d1e('0x2'));var timeout=require(_0x7d1e('0x3'));var express=require(_0x7d1e('0x4'));var router=express['Router']();var fs_extra=require(_0x7d1e('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x7d1e('0x6'));var config=require(_0x7d1e('0x7'));var controller=require(_0x7d1e('0x8'));router[_0x7d1e('0x9')]('/',auth[_0x7d1e('0xa')](),controller['index']);router['get']('/:id',auth[_0x7d1e('0xa')](),controller['show']);router[_0x7d1e('0xb')]('/',auth['isAuthenticated'](),controller[_0x7d1e('0xc')]);router[_0x7d1e('0xd')](_0x7d1e('0xe'),auth[_0x7d1e('0xa')](),controller['update']);router[_0x7d1e('0xf')](_0x7d1e('0xe'),auth['isAuthenticated'](),controller[_0x7d1e('0x10')]);module[_0x7d1e('0x11')]=router; \ No newline at end of file +var _0x9abc=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','create','update','delete','destroy','multer','util','path'];(function(_0x352d28,_0x444033){var _0x387d7e=function(_0x40be0e){while(--_0x40be0e){_0x352d28['push'](_0x352d28['shift']());}};_0x387d7e(++_0x444033);}(_0x9abc,0x1e3));var _0xc9ab=function(_0x17a30d,_0x357c97){_0x17a30d=_0x17a30d-0x0;var _0xd9ce9f=_0x9abc[_0x17a30d];return _0xd9ce9f;};'use strict';var multer=require(_0xc9ab('0x0'));var util=require(_0xc9ab('0x1'));var path=require(_0xc9ab('0x2'));var timeout=require(_0xc9ab('0x3'));var express=require(_0xc9ab('0x4'));var router=express[_0xc9ab('0x5')]();var fs_extra=require(_0xc9ab('0x6'));var auth=require(_0xc9ab('0x7'));var interaction=require(_0xc9ab('0x8'));var config=require(_0xc9ab('0x9'));var controller=require('./voiceQueuesLog.controller');router[_0xc9ab('0xa')]('/',auth[_0xc9ab('0xb')](),controller[_0xc9ab('0xc')]);router[_0xc9ab('0xa')](_0xc9ab('0xd'),auth[_0xc9ab('0xb')](),controller['show']);router['post']('/',auth[_0xc9ab('0xb')](),controller[_0xc9ab('0xe')]);router['put'](_0xc9ab('0xd'),auth['isAuthenticated'](),controller[_0xc9ab('0xf')]);router[_0xc9ab('0x10')](_0xc9ab('0xd'),auth[_0xc9ab('0xb')](),controller[_0xc9ab('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index facda15..c01389c 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 _0x1c47=['literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','moment','STRING'];(function(_0x2f1d76,_0x51b483){var _0x15daed=function(_0x2bddf7){while(--_0x2bddf7){_0x2f1d76['push'](_0x2f1d76['shift']());}};_0x15daed(++_0x51b483);}(_0x1c47,0x1ec));var _0x71c4=function(_0x58a4fe,_0x11d439){_0x58a4fe=_0x58a4fe-0x0;var _0x697de2=_0x1c47[_0x58a4fe];return _0x697de2;};'use strict';var Sequelize=require(_0x71c4('0x0'));var moment=require(_0x71c4('0x1'));module['exports']={'time':{'type':Sequelize[_0x71c4('0x2')]},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x71c4('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x71c4('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x71c4('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x71c4('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x71c4('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x71c4('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x71c4('0x3')](_0x71c4('0x4'))}}; \ No newline at end of file +var _0x8f76=['moment','exports','STRING','DATE','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP'];(function(_0x2f70b4,_0x53dbb2){var _0x419baf=function(_0x14eaa7){while(--_0x14eaa7){_0x2f70b4['push'](_0x2f70b4['shift']());}};_0x419baf(++_0x53dbb2);}(_0x8f76,0x73));var _0x68f7=function(_0x4d07cc,_0x587613){_0x4d07cc=_0x4d07cc-0x0;var _0x42de3b=_0x8f76[_0x4d07cc];return _0x42de3b;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x68f7('0x0'));module[_0x68f7('0x1')]={'time':{'type':Sequelize[_0x68f7('0x2')]},'callid':{'type':Sequelize[_0x68f7('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x68f7('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x68f7('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x68f7('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x68f7('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x68f7('0x3')],'allowNull':![],'defaultValue':Sequelize['literal'](_0x68f7('0x4'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 92033f6..a53e2d5 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 _0x1984=['keys','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','includeAll','find','create','body','params','destroy','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','ejs','fs-extra','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','count','set','apply','reject','save','update','then','error','stack','name','send','map','VoiceQueuesLog','rawAttributes','type','key','model','query'];(function(_0x4674f7,_0x23a007){var _0x203744=function(_0x368466){while(--_0x368466){_0x4674f7['push'](_0x4674f7['shift']());}};_0x203744(++_0x23a007);}(_0x1984,0x182));var _0x4198=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x1984[_0x413feb];return _0x40ee88;};'use strict';var emlformat=require(_0x4198('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4198('0x1'));var jsonpatch=require(_0x4198('0x2'));var rp=require('request-promise');var moment=require(_0x4198('0x3'));var BPromise=require(_0x4198('0x4'));var Mustache=require(_0x4198('0x5'));var util=require(_0x4198('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4198('0x7'));var fs=require('fs');var fs_extra=require(_0x4198('0x8'));var _=require('lodash');var squel=require(_0x4198('0x9'));var crypto=require(_0x4198('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x4198('0xb'));var toCsv=require(_0x4198('0xc'));var querystring=require(_0x4198('0xd'));var Papa=require(_0x4198('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4198('0xf'));var as=require(_0x4198('0x10'));var hardwareService=require(_0x4198('0x11'));var logger=require(_0x4198('0x12'))(_0x4198('0x13'));var utils=require(_0x4198('0x14'));var config=require(_0x4198('0x15'));var licenseUtil=require(_0x4198('0x16'));var db=require(_0x4198('0x17'))['db'];function respondWithStatusCode(_0x227c29,_0x3effe0){_0x3effe0=_0x3effe0||0xcc;return function(_0x3d378d){if(_0x3d378d){return _0x227c29['sendStatus'](_0x3effe0);}return _0x227c29[_0x4198('0x18')](_0x3effe0)[_0x4198('0x19')]();};}function respondWithResult(_0x38d062,_0x447a50){_0x447a50=_0x447a50||0xc8;return function(_0xf0ba68){if(_0xf0ba68){return _0x38d062[_0x4198('0x18')](_0x447a50)['json'](_0xf0ba68);}};}function respondWithFilteredResult(_0x2888c5,_0x2dcb53){return function(_0xdd9075){if(_0xdd9075){var _0x464d20=typeof _0x2dcb53[_0x4198('0x1a')]===_0x4198('0x1b')&&typeof _0x2dcb53['limit']===_0x4198('0x1b');var _0x54242c=_0xdd9075[_0x4198('0x1c')];var _0x300a39=_0x464d20?0x0:_0x2dcb53[_0x4198('0x1a')];var _0x6887a7=_0x464d20?_0xdd9075[_0x4198('0x1c')]:_0x2dcb53['offset']+_0x2dcb53['limit'];var _0x5b97e0;if(_0x6887a7>=_0x54242c){_0x6887a7=_0x54242c;_0x5b97e0=0xc8;}else{_0x5b97e0=0xce;}_0x2888c5[_0x4198('0x18')](_0x5b97e0);return _0x2888c5[_0x4198('0x1d')]('Content-Range',_0x300a39+'-'+_0x6887a7+'/'+_0x54242c)['json'](_0xdd9075);}return null;};}function patchUpdates(_0x1680cc){return function(_0x4727d3){try{jsonpatch[_0x4198('0x1e')](_0x4727d3,_0x1680cc,!![]);}catch(_0x543c54){return BPromise[_0x4198('0x1f')](_0x543c54);}return _0x4727d3[_0x4198('0x20')]();};}function saveUpdates(_0x1d8184,_0x25f8d7){return function(_0x175494){if(_0x175494){return _0x175494[_0x4198('0x21')](_0x1d8184)[_0x4198('0x22')](function(_0x5d9d2a){return _0x5d9d2a;});}return null;};}function removeEntity(_0x346585,_0x155c76){return function(_0x1ced31){if(_0x1ced31){return _0x1ced31['destroy']()['then'](function(){_0x346585[_0x4198('0x18')](0xcc)[_0x4198('0x19')]();});}};}function handleEntityNotFound(_0x2aa6df,_0x53a0b4){return function(_0x3a6cd6){if(!_0x3a6cd6){_0x2aa6df['sendStatus'](0x194);}return _0x3a6cd6;};}function handleError(_0x2c2f28,_0x2cd408){_0x2cd408=_0x2cd408||0x1f4;return function(_0x7e3bcc){logger[_0x4198('0x23')](_0x7e3bcc[_0x4198('0x24')]);if(_0x7e3bcc[_0x4198('0x25')]){delete _0x7e3bcc[_0x4198('0x25')];}_0x2c2f28[_0x4198('0x18')](_0x2cd408)[_0x4198('0x26')](_0x7e3bcc);};}exports['index']=function(_0x1c19b4,_0x47bd1b){var _0x142026={},_0x3d095a={},_0x1615b6={'count':0x0,'rows':[]};var _0x284fc=_[_0x4198('0x27')](db[_0x4198('0x28')][_0x4198('0x29')],function(_0x3079f5){return{'name':_0x3079f5['fieldName'],'type':_0x3079f5[_0x4198('0x2a')][_0x4198('0x2b')]};});_0x3d095a[_0x4198('0x2c')]=_['map'](_0x284fc,_0x4198('0x25'));_0x3d095a[_0x4198('0x2d')]=_[_0x4198('0x2e')](_0x1c19b4[_0x4198('0x2d')]);_0x3d095a[_0x4198('0x2f')]=_[_0x4198('0x30')](_0x3d095a['model'],_0x3d095a[_0x4198('0x2d')]);_0x142026[_0x4198('0x31')]=_[_0x4198('0x30')](_0x3d095a[_0x4198('0x2c')],qs[_0x4198('0x32')](_0x1c19b4[_0x4198('0x2d')][_0x4198('0x32')]));_0x142026['attributes']=_0x142026[_0x4198('0x31')][_0x4198('0x33')]?_0x142026['attributes']:_0x3d095a[_0x4198('0x2c')];if(!_0x1c19b4[_0x4198('0x2d')]['hasOwnProperty'](_0x4198('0x34'))){_0x142026[_0x4198('0x35')]=qs['limit'](_0x1c19b4[_0x4198('0x2d')]['limit']);_0x142026['offset']=qs[_0x4198('0x1a')](_0x1c19b4[_0x4198('0x2d')][_0x4198('0x1a')]);}_0x142026[_0x4198('0x36')]=qs['sort'](_0x1c19b4['query'][_0x4198('0x37')]);_0x142026[_0x4198('0x38')]=qs['filters'](_['pick'](_0x1c19b4[_0x4198('0x2d')],_0x3d095a[_0x4198('0x2f')]),_0x284fc);if(_0x1c19b4[_0x4198('0x2d')][_0x4198('0x39')]){_0x142026[_0x4198('0x38')]=_[_0x4198('0x3a')](_0x142026['where'],{'$or':_[_0x4198('0x27')](_0x284fc,function(_0x58e6d7){if(_0x58e6d7[_0x4198('0x2a')]!==_0x4198('0x3b')){var _0x3a81ad={};_0x3a81ad[_0x58e6d7[_0x4198('0x25')]]={'$like':'%'+_0x1c19b4[_0x4198('0x2d')]['filter']+'%'};return _0x3a81ad;}})});}_0x142026=_[_0x4198('0x3a')]({},_0x142026,_0x1c19b4[_0x4198('0x3c')]);var _0xcbcba7={'where':_0x142026[_0x4198('0x38')]};return db[_0x4198('0x28')][_0x4198('0x1c')](_0xcbcba7)[_0x4198('0x22')](function(_0x314940){_0x1615b6[_0x4198('0x1c')]=_0x314940;if(_0x1c19b4['query']['includeAll']){_0x142026[_0x4198('0x3d')]=[{'all':!![]}];}return db['VoiceQueuesLog'][_0x4198('0x3e')](_0x142026);})['then'](function(_0x3e777f){_0x1615b6[_0x4198('0x3f')]=_0x3e777f;return _0x1615b6;})['then'](respondWithFilteredResult(_0x47bd1b,_0x142026))[_0x4198('0x40')](handleError(_0x47bd1b,null));};exports[_0x4198('0x41')]=function(_0x1e15b6,_0x25a72e){var _0x2f8d20={'raw':!![],'where':{'id':_0x1e15b6['params']['id']}},_0x317271={};_0x317271[_0x4198('0x2c')]=_[_0x4198('0x2e')](db[_0x4198('0x28')][_0x4198('0x29')]);_0x317271['query']=_[_0x4198('0x2e')](_0x1e15b6['query']);_0x317271['filters']=_[_0x4198('0x30')](_0x317271[_0x4198('0x2c')],_0x317271[_0x4198('0x2d')]);_0x2f8d20[_0x4198('0x31')]=_[_0x4198('0x30')](_0x317271[_0x4198('0x2c')],qs[_0x4198('0x32')](_0x1e15b6[_0x4198('0x2d')][_0x4198('0x32')]));_0x2f8d20[_0x4198('0x31')]=_0x2f8d20[_0x4198('0x31')][_0x4198('0x33')]?_0x2f8d20[_0x4198('0x31')]:_0x317271[_0x4198('0x2c')];if(_0x1e15b6[_0x4198('0x2d')][_0x4198('0x42')]){_0x2f8d20[_0x4198('0x3d')]=[{'all':!![]}];}_0x2f8d20=_[_0x4198('0x3a')]({},_0x2f8d20,_0x1e15b6[_0x4198('0x3c')]);return db[_0x4198('0x28')][_0x4198('0x43')](_0x2f8d20)[_0x4198('0x22')](handleEntityNotFound(_0x25a72e,null))['then'](respondWithResult(_0x25a72e,null))[_0x4198('0x40')](handleError(_0x25a72e,null));};exports[_0x4198('0x44')]=function(_0x40ed4b,_0x198d28){return db[_0x4198('0x28')][_0x4198('0x44')](_0x40ed4b[_0x4198('0x45')],{})[_0x4198('0x22')](respondWithResult(_0x198d28,0xc9))[_0x4198('0x40')](handleError(_0x198d28,null));};exports['update']=function(_0x23a313,_0x29a20e){if(_0x23a313[_0x4198('0x45')]['id']){delete _0x23a313[_0x4198('0x45')]['id'];}return db['VoiceQueuesLog'][_0x4198('0x43')]({'where':{'id':_0x23a313[_0x4198('0x46')]['id']}})['then'](handleEntityNotFound(_0x29a20e,null))[_0x4198('0x22')](saveUpdates(_0x23a313[_0x4198('0x45')],null))['then'](respondWithResult(_0x29a20e,null))[_0x4198('0x40')](handleError(_0x29a20e,null));};exports[_0x4198('0x47')]=function(_0x534966,_0x542020){return db[_0x4198('0x28')][_0x4198('0x43')]({'where':{'id':_0x534966[_0x4198('0x46')]['id']}})[_0x4198('0x22')](handleEntityNotFound(_0x542020,null))[_0x4198('0x22')](removeEntity(_0x542020,null))[_0x4198('0x40')](handleError(_0x542020,null));}; \ No newline at end of file +var _0x3707=['to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','limit','undefined','count','offset','set','Content-Range','reject','save','then','destroy','error','stack','name','index','map','VoiceQueuesLog','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','keys','catch','create','update','body','find','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox'];(function(_0x620dbb,_0x2653b6){var _0x396c1e=function(_0x489d7d){while(--_0x489d7d){_0x620dbb['push'](_0x620dbb['shift']());}};_0x396c1e(++_0x2653b6);}(_0x3707,0x92));var _0x7370=function(_0x2f8519,_0x239d7c){_0x2f8519=_0x2f8519-0x0;var _0x897f55=_0x3707[_0x2f8519];return _0x897f55;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7370('0x0'));var jsonpatch=require(_0x7370('0x1'));var rp=require('request-promise');var moment=require(_0x7370('0x2'));var BPromise=require(_0x7370('0x3'));var Mustache=require(_0x7370('0x4'));var util=require(_0x7370('0x5'));var path=require(_0x7370('0x6'));var sox=require(_0x7370('0x7'));var csv=require(_0x7370('0x8'));var ejs=require(_0x7370('0x9'));var fs=require('fs');var fs_extra=require(_0x7370('0xa'));var _=require(_0x7370('0xb'));var squel=require(_0x7370('0xc'));var crypto=require('crypto');var jsforce=require(_0x7370('0xd'));var deskjs=require(_0x7370('0xe'));var toCsv=require('to-csv');var querystring=require(_0x7370('0xf'));var Papa=require(_0x7370('0x10'));var Redis=require('ioredis');var authService=require(_0x7370('0x11'));var qs=require(_0x7370('0x12'));var as=require(_0x7370('0x13'));var hardwareService=require(_0x7370('0x14'));var logger=require(_0x7370('0x15'))(_0x7370('0x16'));var utils=require('../../config/utils');var config=require(_0x7370('0x17'));var licenseUtil=require(_0x7370('0x18'));var db=require(_0x7370('0x19'))['db'];function respondWithStatusCode(_0x5a6da8,_0x510ab8){_0x510ab8=_0x510ab8||0xcc;return function(_0x3b8dec){if(_0x3b8dec){return _0x5a6da8['sendStatus'](_0x510ab8);}return _0x5a6da8[_0x7370('0x1a')](_0x510ab8)[_0x7370('0x1b')]();};}function respondWithResult(_0x185f89,_0x350cdd){_0x350cdd=_0x350cdd||0xc8;return function(_0x1a8c26){if(_0x1a8c26){return _0x185f89[_0x7370('0x1a')](_0x350cdd)[_0x7370('0x1c')](_0x1a8c26);}};}function respondWithFilteredResult(_0x5d479f,_0x2f03ee){return function(_0x5a65e6){if(_0x5a65e6){var _0x51d0ae=typeof _0x2f03ee['offset']==='undefined'&&typeof _0x2f03ee[_0x7370('0x1d')]===_0x7370('0x1e');var _0xbdafe7=_0x5a65e6[_0x7370('0x1f')];var _0x229ddb=_0x51d0ae?0x0:_0x2f03ee[_0x7370('0x20')];var _0xd26c59=_0x51d0ae?_0x5a65e6[_0x7370('0x1f')]:_0x2f03ee[_0x7370('0x20')]+_0x2f03ee[_0x7370('0x1d')];var _0x2d4f52;if(_0xd26c59>=_0xbdafe7){_0xd26c59=_0xbdafe7;_0x2d4f52=0xc8;}else{_0x2d4f52=0xce;}_0x5d479f[_0x7370('0x1a')](_0x2d4f52);return _0x5d479f[_0x7370('0x21')](_0x7370('0x22'),_0x229ddb+'-'+_0xd26c59+'/'+_0xbdafe7)['json'](_0x5a65e6);}return null;};}function patchUpdates(_0x2f2c3a){return function(_0x1be31c){try{jsonpatch['apply'](_0x1be31c,_0x2f2c3a,!![]);}catch(_0x423306){return BPromise[_0x7370('0x23')](_0x423306);}return _0x1be31c[_0x7370('0x24')]();};}function saveUpdates(_0x158664,_0x3f4b2e){return function(_0x52af76){if(_0x52af76){return _0x52af76['update'](_0x158664)[_0x7370('0x25')](function(_0x3f0dcd){return _0x3f0dcd;});}return null;};}function removeEntity(_0x2c00b6,_0x56f87a){return function(_0x1d872e){if(_0x1d872e){return _0x1d872e[_0x7370('0x26')]()['then'](function(){_0x2c00b6['status'](0xcc)[_0x7370('0x1b')]();});}};}function handleEntityNotFound(_0x915765,_0x4041fe){return function(_0xe74863){if(!_0xe74863){_0x915765['sendStatus'](0x194);}return _0xe74863;};}function handleError(_0x18f197,_0x5c5c34){_0x5c5c34=_0x5c5c34||0x1f4;return function(_0x8182d0){logger[_0x7370('0x27')](_0x8182d0[_0x7370('0x28')]);if(_0x8182d0[_0x7370('0x29')]){delete _0x8182d0['name'];}_0x18f197[_0x7370('0x1a')](_0x5c5c34)['send'](_0x8182d0);};}exports[_0x7370('0x2a')]=function(_0x11b9ee,_0x45b57d){var _0x426b55={},_0xcd03be={},_0x3b205a={'count':0x0,'rows':[]};var _0x355f55=_[_0x7370('0x2b')](db[_0x7370('0x2c')][_0x7370('0x2d')],function(_0x33467b){return{'name':_0x33467b[_0x7370('0x2e')],'type':_0x33467b[_0x7370('0x2f')][_0x7370('0x30')]};});_0xcd03be['model']=_[_0x7370('0x2b')](_0x355f55,_0x7370('0x29'));_0xcd03be[_0x7370('0x31')]=_['keys'](_0x11b9ee['query']);_0xcd03be[_0x7370('0x32')]=_[_0x7370('0x33')](_0xcd03be[_0x7370('0x34')],_0xcd03be[_0x7370('0x31')]);_0x426b55[_0x7370('0x35')]=_[_0x7370('0x33')](_0xcd03be[_0x7370('0x34')],qs[_0x7370('0x36')](_0x11b9ee[_0x7370('0x31')][_0x7370('0x36')]));_0x426b55[_0x7370('0x35')]=_0x426b55[_0x7370('0x35')][_0x7370('0x37')]?_0x426b55[_0x7370('0x35')]:_0xcd03be[_0x7370('0x34')];if(!_0x11b9ee[_0x7370('0x31')][_0x7370('0x38')](_0x7370('0x39'))){_0x426b55['limit']=qs[_0x7370('0x1d')](_0x11b9ee[_0x7370('0x31')]['limit']);_0x426b55[_0x7370('0x20')]=qs[_0x7370('0x20')](_0x11b9ee['query']['offset']);}_0x426b55[_0x7370('0x3a')]=qs[_0x7370('0x3b')](_0x11b9ee[_0x7370('0x31')]['sort']);_0x426b55[_0x7370('0x3c')]=qs[_0x7370('0x32')](_[_0x7370('0x3d')](_0x11b9ee[_0x7370('0x31')],_0xcd03be[_0x7370('0x32')]),_0x355f55);if(_0x11b9ee['query'][_0x7370('0x3e')]){_0x426b55[_0x7370('0x3c')]=_[_0x7370('0x3f')](_0x426b55[_0x7370('0x3c')],{'$or':_[_0x7370('0x2b')](_0x355f55,function(_0x11985e){if(_0x11985e[_0x7370('0x2f')]!=='VIRTUAL'){var _0x55158d={};_0x55158d[_0x11985e[_0x7370('0x29')]]={'$like':'%'+_0x11b9ee['query']['filter']+'%'};return _0x55158d;}})});}_0x426b55=_[_0x7370('0x3f')]({},_0x426b55,_0x11b9ee[_0x7370('0x40')]);var _0x500368={'where':_0x426b55[_0x7370('0x3c')]};return db[_0x7370('0x2c')][_0x7370('0x1f')](_0x500368)['then'](function(_0x36f514){_0x3b205a[_0x7370('0x1f')]=_0x36f514;if(_0x11b9ee['query'][_0x7370('0x41')]){_0x426b55[_0x7370('0x42')]=[{'all':!![]}];}return db['VoiceQueuesLog'][_0x7370('0x43')](_0x426b55);})[_0x7370('0x25')](function(_0x2dc793){_0x3b205a[_0x7370('0x44')]=_0x2dc793;return _0x3b205a;})['then'](respondWithFilteredResult(_0x45b57d,_0x426b55))['catch'](handleError(_0x45b57d,null));};exports[_0x7370('0x45')]=function(_0x3b0c51,_0x1f8b9c){var _0x875012={'raw':!![],'where':{'id':_0x3b0c51[_0x7370('0x46')]['id']}},_0x4fe02e={};_0x4fe02e[_0x7370('0x34')]=_[_0x7370('0x47')](db[_0x7370('0x2c')][_0x7370('0x2d')]);_0x4fe02e[_0x7370('0x31')]=_[_0x7370('0x47')](_0x3b0c51[_0x7370('0x31')]);_0x4fe02e['filters']=_[_0x7370('0x33')](_0x4fe02e[_0x7370('0x34')],_0x4fe02e[_0x7370('0x31')]);_0x875012['attributes']=_[_0x7370('0x33')](_0x4fe02e[_0x7370('0x34')],qs[_0x7370('0x36')](_0x3b0c51[_0x7370('0x31')][_0x7370('0x36')]));_0x875012[_0x7370('0x35')]=_0x875012[_0x7370('0x35')]['length']?_0x875012['attributes']:_0x4fe02e['model'];if(_0x3b0c51['query'][_0x7370('0x41')]){_0x875012[_0x7370('0x42')]=[{'all':!![]}];}_0x875012=_[_0x7370('0x3f')]({},_0x875012,_0x3b0c51[_0x7370('0x40')]);return db[_0x7370('0x2c')]['find'](_0x875012)[_0x7370('0x25')](handleEntityNotFound(_0x1f8b9c,null))[_0x7370('0x25')](respondWithResult(_0x1f8b9c,null))[_0x7370('0x48')](handleError(_0x1f8b9c,null));};exports[_0x7370('0x49')]=function(_0x43dfd7,_0x70428d){return db[_0x7370('0x2c')]['create'](_0x43dfd7['body'],{})[_0x7370('0x25')](respondWithResult(_0x70428d,0xc9))[_0x7370('0x48')](handleError(_0x70428d,null));};exports[_0x7370('0x4a')]=function(_0x443ea3,_0xc464b8){if(_0x443ea3['body']['id']){delete _0x443ea3[_0x7370('0x4b')]['id'];}return db[_0x7370('0x2c')]['find']({'where':{'id':_0x443ea3[_0x7370('0x46')]['id']}})[_0x7370('0x25')](handleEntityNotFound(_0xc464b8,null))[_0x7370('0x25')](saveUpdates(_0x443ea3['body'],null))[_0x7370('0x25')](respondWithResult(_0xc464b8,null))[_0x7370('0x48')](handleError(_0xc464b8,null));};exports['destroy']=function(_0x39e19d,_0x1e33ec){return db[_0x7370('0x2c')][_0x7370('0x4c')]({'where':{'id':_0x39e19d[_0x7370('0x46')]['id']}})[_0x7370('0x25')](handleEntityNotFound(_0x1e33ec,null))[_0x7370('0x25')](removeEntity(_0x1e33ec,null))['catch'](handleError(_0x1e33ec,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 24c6d77..9d3aa36 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 _0x3f2e=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','voice_queues_log','event_dtm','event','dtm','lodash','util'];(function(_0x385e41,_0x3c784f){var _0x49de49=function(_0x1eee36){while(--_0x1eee36){_0x385e41['push'](_0x385e41['shift']());}};_0x49de49(++_0x3c784f);}(_0x3f2e,0x166));var _0xe3f2=function(_0x115621,_0x341cde){_0x115621=_0x115621-0x0;var _0x5ef5ce=_0x3f2e[_0x115621];return _0x5ef5ce;};'use strict';var _=require(_0xe3f2('0x0'));var util=require(_0xe3f2('0x1'));var logger=require(_0xe3f2('0x2'))(_0xe3f2('0x3'));var moment=require(_0xe3f2('0x4'));var BPromise=require(_0xe3f2('0x5'));var rp=require(_0xe3f2('0x6'));var fs=require('fs');var path=require(_0xe3f2('0x7'));var rimraf=require(_0xe3f2('0x8'));var config=require(_0xe3f2('0x9'));var attributes=require(_0xe3f2('0xa'));module[_0xe3f2('0xb')]=function(_0x44bd3b,_0x3902e6){return _0x44bd3b[_0xe3f2('0xc')](_0xe3f2('0xd'),attributes,{'tableName':_0xe3f2('0xe'),'paranoid':![],'indexes':[{'name':_0xe3f2('0xf'),'fields':[_0xe3f2('0x10'),_0xe3f2('0x11')]}],'timestamps':![]});}; \ No newline at end of file +var _0x0811=['util','../../config/logger','api','moment','bluebird','request-promise','path','./voiceQueuesLog.attributes','define','VoiceQueuesLog','voice_queues_log','event_dtm','event','dtm','lodash'];(function(_0x4659d0,_0xce046a){var _0x172b17=function(_0x136141){while(--_0x136141){_0x4659d0['push'](_0x4659d0['shift']());}};_0x172b17(++_0xce046a);}(_0x0811,0xb3));var _0x1081=function(_0x22f75e,_0x4a9e06){_0x22f75e=_0x22f75e-0x0;var _0x1f6ab3=_0x0811[_0x22f75e];return _0x1f6ab3;};'use strict';var _=require(_0x1081('0x0'));var util=require(_0x1081('0x1'));var logger=require(_0x1081('0x2'))(_0x1081('0x3'));var moment=require(_0x1081('0x4'));var BPromise=require(_0x1081('0x5'));var rp=require(_0x1081('0x6'));var fs=require('fs');var path=require(_0x1081('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1081('0x8'));module['exports']=function(_0x4c332a,_0xdb1f60){return _0x4c332a[_0x1081('0x9')](_0x1081('0xa'),attributes,{'tableName':_0x1081('0xb'),'paranoid':![],'indexes':[{'name':_0x1081('0xc'),'fields':[_0x1081('0xd'),_0x1081('0xe')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index be10a6f..f5c81ac 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 _0x72d1=['error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','code'];(function(_0x479c7f,_0x420811){var _0xcf7508=function(_0x68842a){while(--_0x68842a){_0x479c7f['push'](_0x479c7f['shift']());}};_0xcf7508(++_0x420811);}(_0x72d1,0x18b));var _0x172d=function(_0x54f322,_0x24a660){_0x54f322=_0x54f322-0x0;var _0xb0a1d5=_0x72d1[_0x54f322];return _0xb0a1d5;};'use strict';var _=require(_0x172d('0x0'));var util=require(_0x172d('0x1'));var moment=require('moment');var BPromise=require(_0x172d('0x2'));var rs=require(_0x172d('0x3'));var fs=require('fs');var Redis=require(_0x172d('0x4'));var db=require(_0x172d('0x5'))['db'];var utils=require(_0x172d('0x6'));var logger=require(_0x172d('0x7'))('rpc');var config=require(_0x172d('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x172d('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3d95e1,_0x2c3d19,_0x4071b3){return new BPromise(function(_0x52a4f3,_0x1fed7a){return client[_0x172d('0xa')](_0x3d95e1,_0x4071b3)[_0x172d('0xb')](function(_0x1de73f){logger[_0x172d('0xc')](_0x172d('0xd'),_0x2c3d19,_0x172d('0xe'));logger[_0x172d('0xf')](_0x172d('0x10'),_0x2c3d19,'request\x20sent',JSON[_0x172d('0x11')](_0x1de73f));if(_0x1de73f['error']){if(_0x1de73f['error'][_0x172d('0x12')]===0x1f4){logger['error'](_0x172d('0xd'),_0x2c3d19,_0x1de73f[_0x172d('0x13')][_0x172d('0x14')]);return _0x1fed7a(_0x1de73f[_0x172d('0x13')][_0x172d('0x14')]);}logger[_0x172d('0x13')](_0x172d('0xd'),_0x2c3d19,_0x1de73f[_0x172d('0x13')]['message']);return _0x52a4f3(_0x1de73f[_0x172d('0x13')]['message']);}else{logger[_0x172d('0xc')](_0x172d('0xd'),_0x2c3d19,'request\x20sent');_0x52a4f3(_0x1de73f[_0x172d('0x15')]['message']);}})[_0x172d('0x16')](function(_0x81f26a){logger[_0x172d('0x13')]('VoiceQueuesLog,\x20%s,\x20%s',_0x2c3d19,_0x81f26a);_0x1fed7a(_0x81f26a);});});} \ No newline at end of file +var _0x894f=['jayson/promise','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/environment'];(function(_0x3afe9b,_0x37eb48){var _0x2eb67f=function(_0x2e3f35){while(--_0x2e3f35){_0x3afe9b['push'](_0x3afe9b['shift']());}};_0x2eb67f(++_0x37eb48);}(_0x894f,0x14d));var _0xf894=function(_0x1446be,_0x1c4126){_0x1446be=_0x1446be-0x0;var _0x5a9b8f=_0x894f[_0x1446be];return _0x5a9b8f;};'use strict';var _=require(_0xf894('0x0'));var util=require(_0xf894('0x1'));var moment=require(_0xf894('0x2'));var BPromise=require(_0xf894('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf894('0x4'))['db'];var utils=require(_0xf894('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xf894('0x6'));var jayson=require(_0xf894('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x23a9fc,_0x371f86,_0x56d9d6){return new BPromise(function(_0x190cb1,_0x3d8f21){return client[_0xf894('0x8')](_0x23a9fc,_0x56d9d6)[_0xf894('0x9')](function(_0x10bb84){logger[_0xf894('0xa')](_0xf894('0xb'),_0x371f86,_0xf894('0xc'));logger[_0xf894('0xd')](_0xf894('0xe'),_0x371f86,_0xf894('0xc'),JSON[_0xf894('0xf')](_0x10bb84));if(_0x10bb84[_0xf894('0x10')]){if(_0x10bb84[_0xf894('0x10')][_0xf894('0x11')]===0x1f4){logger[_0xf894('0x10')](_0xf894('0xb'),_0x371f86,_0x10bb84[_0xf894('0x10')][_0xf894('0x12')]);return _0x3d8f21(_0x10bb84[_0xf894('0x10')][_0xf894('0x12')]);}logger[_0xf894('0x10')]('VoiceQueuesLog,\x20%s,\x20%s',_0x371f86,_0x10bb84[_0xf894('0x10')]['message']);return _0x190cb1(_0x10bb84['error'][_0xf894('0x12')]);}else{logger[_0xf894('0xa')](_0xf894('0xb'),_0x371f86,_0xf894('0xc'));_0x190cb1(_0x10bb84[_0xf894('0x13')]['message']);}})['catch'](function(_0x1865be){logger['error']('VoiceQueuesLog,\x20%s,\x20%s',_0x371f86,_0x1865be);_0x3d8f21(_0x1865be);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index d2b90b6..b520763 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 _0x40e2=['update','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download','downloads','/:id/transcribe','create','post'];(function(_0x2409f0,_0x157d54){var _0x5cbdfd=function(_0x5dc6dd){while(--_0x5dc6dd){_0x2409f0['push'](_0x2409f0['shift']());}};_0x5cbdfd(++_0x157d54);}(_0x40e2,0x9e));var _0x240e=function(_0x364176,_0x3b9608){_0x364176=_0x364176-0x0;var _0x47be54=_0x40e2[_0x364176];return _0x47be54;};'use strict';var multer=require(_0x240e('0x0'));var util=require(_0x240e('0x1'));var path=require(_0x240e('0x2'));var timeout=require(_0x240e('0x3'));var express=require(_0x240e('0x4'));var router=express[_0x240e('0x5')]();var fs_extra=require(_0x240e('0x6'));var auth=require(_0x240e('0x7'));var interaction=require(_0x240e('0x8'));var config=require(_0x240e('0x9'));var controller=require(_0x240e('0xa'));router[_0x240e('0xb')]('/',auth[_0x240e('0xc')](),controller[_0x240e('0xd')]);router[_0x240e('0xb')](_0x240e('0xe'),auth[_0x240e('0xc')](),controller[_0x240e('0xf')]);router['get'](_0x240e('0x10'),auth[_0x240e('0xc')](),controller[_0x240e('0x11')]);router['get'](_0x240e('0x12'),auth['isAuthenticated'](),controller[_0x240e('0x13')]);router['get']('/:id/downloads',controller[_0x240e('0x14')]);router[_0x240e('0xb')](_0x240e('0x15'),auth[_0x240e('0xc')](),controller['downloadTranscribe']);router['post']('/',auth[_0x240e('0xc')](),controller[_0x240e('0x16')]);router[_0x240e('0x17')](_0x240e('0x15'),auth[_0x240e('0xc')](),controller['runTranscribe']);router['put'](_0x240e('0x10'),auth['isAuthenticated'](),controller[_0x240e('0x18')]);router['delete'](_0x240e('0x10'),auth['isAuthenticated'](),controller[_0x240e('0x19')]);module['exports']=router; \ No newline at end of file +var _0x90fe=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get','isAuthenticated','/describe','describe','/:id','show','download','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','post','create','put','delete','util','path','express'];(function(_0x5ae51d,_0x58305f){var _0x4d4acc=function(_0x117fac){while(--_0x117fac){_0x5ae51d['push'](_0x5ae51d['shift']());}};_0x4d4acc(++_0x58305f);}(_0x90fe,0x195));var _0xe90f=function(_0xb179ea,_0xe7c08a){_0xb179ea=_0xb179ea-0x0;var _0xded50a=_0x90fe[_0xb179ea];return _0xded50a;};'use strict';var multer=require('multer');var util=require(_0xe90f('0x0'));var path=require(_0xe90f('0x1'));var timeout=require('connect-timeout');var express=require(_0xe90f('0x2'));var router=express[_0xe90f('0x3')]();var fs_extra=require(_0xe90f('0x4'));var auth=require(_0xe90f('0x5'));var interaction=require(_0xe90f('0x6'));var config=require(_0xe90f('0x7'));var controller=require(_0xe90f('0x8'));router[_0xe90f('0x9')]('/',auth[_0xe90f('0xa')](),controller['index']);router[_0xe90f('0x9')](_0xe90f('0xb'),auth[_0xe90f('0xa')](),controller[_0xe90f('0xc')]);router['get'](_0xe90f('0xd'),auth[_0xe90f('0xa')](),controller[_0xe90f('0xe')]);router[_0xe90f('0x9')]('/:id/download',auth['isAuthenticated'](),controller[_0xe90f('0xf')]);router['get'](_0xe90f('0x10'),controller[_0xe90f('0x11')]);router[_0xe90f('0x9')](_0xe90f('0x12'),auth[_0xe90f('0xa')](),controller[_0xe90f('0x13')]);router[_0xe90f('0x14')]('/',auth[_0xe90f('0xa')](),controller[_0xe90f('0x15')]);router[_0xe90f('0x14')]('/:id/transcribe',auth['isAuthenticated'](),controller['runTranscribe']);router[_0xe90f('0x16')]('/:id',auth[_0xe90f('0xa')](),controller['update']);router[_0xe90f('0x17')]('/:id',auth[_0xe90f('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index a8572f5..8f56ee6 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(_0x341e0f,_0x4a09d0){var _0x59555a=function(_0x4343a8){while(--_0x4343a8){_0x341e0f['push'](_0x341e0f['shift']());}};_0x59555a(++_0x4a09d0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xa9e0[_0x311c35];return _0x5cc50c;};'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(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'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 2961841..87ed363 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 _0xc316=['query','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','length','catch','create','body','find','describe','download','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','unlink','message','Not\x20found','downloads','sequelize','col','token','push','extname','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','unlinkSync','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','listBuckets','createBucket','upload','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','Location','bucket','Bucket','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','transcribeName','TranscriptionJobName','transcribeStatus','TranscriptionJob','TranscriptionJobStatus','runTranscribe','Voice\x20Recording\x20not\x20found','Setting','transcribeAccountId','transcribeRegion','Transcribe\x20not\x20configured','language','CloudProvider','findOne','data2','Cloud\x20Provider\x20not\x20configured','data1','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','tempSentiment','runSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','Transcript\x20not\x20available','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','uuid/v4','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','then','destroy','sendStatus','stack','name','send','map','VoiceRecording','rawAttributes','fieldName','model','differenceBy','format'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc316,0x18f));var _0x6c31=function(_0x47eaa5,_0x449254){_0x47eaa5=_0x47eaa5-0x0;var _0x174248=_0xc316[_0x47eaa5];return _0x174248;};'use strict';var emlformat=require(_0x6c31('0x0'));var rimraf=require(_0x6c31('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6c31('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x6c31('0x3'));var Mustache=require(_0x6c31('0x4'));var util=require(_0x6c31('0x5'));var path=require(_0x6c31('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x6c31('0x7'));var fs=require('fs');var fs_extra=require(_0x6c31('0x8'));var _=require(_0x6c31('0x9'));var squel=require(_0x6c31('0xa'));var crypto=require(_0x6c31('0xb'));var jsforce=require(_0x6c31('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x6c31('0xd'));var querystring=require(_0x6c31('0xe'));var Papa=require('papaparse');var AWS=require('aws-sdk');var uuidv4=require(_0x6c31('0xf'));var Redis=require('ioredis');var authService=require(_0x6c31('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6c31('0x11'));var logger=require(_0x6c31('0x12'))(_0x6c31('0x13'));var utils=require(_0x6c31('0x14'));var config=require(_0x6c31('0x15'));var licenseUtil=require(_0x6c31('0x16'));var db=require(_0x6c31('0x17'))['db'];function respondWithStatusCode(_0xab32bb,_0x481ae9){_0x481ae9=_0x481ae9||0xcc;return function(_0x2c0731){if(_0x2c0731){return _0xab32bb['sendStatus'](_0x481ae9);}return _0xab32bb[_0x6c31('0x18')](_0x481ae9)[_0x6c31('0x19')]();};}function respondWithResult(_0x50ea78,_0x27fef7){_0x27fef7=_0x27fef7||0xc8;return function(_0x6fe5d1){if(_0x6fe5d1){return _0x50ea78[_0x6c31('0x18')](_0x27fef7)[_0x6c31('0x1a')](_0x6fe5d1);}};}function respondWithFilteredResult(_0x134b09,_0x1e9a99){return function(_0x41cb57){if(_0x41cb57){var _0x28f600=typeof _0x1e9a99[_0x6c31('0x1b')]===_0x6c31('0x1c')&&typeof _0x1e9a99[_0x6c31('0x1d')]===_0x6c31('0x1c');var _0x3e6852=_0x41cb57[_0x6c31('0x1e')];var _0x34b9c6=_0x28f600?0x0:_0x1e9a99[_0x6c31('0x1b')];var _0x2b5237=_0x28f600?_0x41cb57['count']:_0x1e9a99['offset']+_0x1e9a99[_0x6c31('0x1d')];var _0x347ec8;if(_0x2b5237>=_0x3e6852){_0x2b5237=_0x3e6852;_0x347ec8=0xc8;}else{_0x347ec8=0xce;}_0x134b09[_0x6c31('0x18')](_0x347ec8);return _0x134b09[_0x6c31('0x1f')](_0x6c31('0x20'),_0x34b9c6+'-'+_0x2b5237+'/'+_0x3e6852)[_0x6c31('0x1a')](_0x41cb57);}return null;};}function patchUpdates(_0x325649){return function(_0x3a4e1e){try{jsonpatch['apply'](_0x3a4e1e,_0x325649,!![]);}catch(_0x7b0e28){return BPromise['reject'](_0x7b0e28);}return _0x3a4e1e[_0x6c31('0x21')]();};}function saveUpdates(_0x523352,_0x49141e){return function(_0xab8f8c){if(_0xab8f8c){return _0xab8f8c[_0x6c31('0x22')](_0x523352)[_0x6c31('0x23')](function(_0x1e75a4){return _0x1e75a4;});}return null;};}function removeEntity(_0x19ed3b,_0x1b2d68){return function(_0x451cb9){if(_0x451cb9){return _0x451cb9[_0x6c31('0x24')]()[_0x6c31('0x23')](function(){_0x19ed3b[_0x6c31('0x18')](0xcc)[_0x6c31('0x19')]();});}};}function handleEntityNotFound(_0x35855d,_0x24f49f){return function(_0x144705){if(!_0x144705){_0x35855d[_0x6c31('0x25')](0x194);}return _0x144705;};}function handleError(_0x4a866b,_0x3c5be7){_0x3c5be7=_0x3c5be7||0x1f4;return function(_0x486038){logger['error'](_0x486038[_0x6c31('0x26')]);if(_0x486038['name']){delete _0x486038[_0x6c31('0x27')];}_0x4a866b[_0x6c31('0x18')](_0x3c5be7)[_0x6c31('0x28')](_0x486038);};}exports['index']=function(_0x58549a,_0x52c0ec){var _0x1073e4={},_0xdf17b0={},_0x300fa7={'count':0x0,'rows':[]};var _0x2e0b2d=_[_0x6c31('0x29')](db[_0x6c31('0x2a')][_0x6c31('0x2b')],function(_0x8e6dac){return{'name':_0x8e6dac[_0x6c31('0x2c')],'type':_0x8e6dac['type']['key']};});_0xdf17b0[_0x6c31('0x2d')]=_[_0x6c31('0x2e')](_['map'](_0x2e0b2d,_0x6c31('0x27')),[_0x6c31('0x2f')]);_0xdf17b0['query']=_['keys'](_0x58549a[_0x6c31('0x30')]);_0xdf17b0[_0x6c31('0x31')]=_[_0x6c31('0x32')](_0xdf17b0[_0x6c31('0x2d')],_0xdf17b0[_0x6c31('0x30')]);_0x1073e4['attributes']=_[_0x6c31('0x32')](_0xdf17b0[_0x6c31('0x2d')],qs[_0x6c31('0x33')](_0x58549a[_0x6c31('0x30')][_0x6c31('0x33')]));_0x1073e4[_0x6c31('0x34')]=_0x1073e4[_0x6c31('0x34')]['length']?_0x1073e4[_0x6c31('0x34')]:_0xdf17b0[_0x6c31('0x2d')];if(!_0x58549a[_0x6c31('0x30')][_0x6c31('0x35')]('nolimit')){_0x1073e4['limit']=qs[_0x6c31('0x1d')](_0x58549a['query'][_0x6c31('0x1d')]);_0x1073e4['offset']=qs[_0x6c31('0x1b')](_0x58549a[_0x6c31('0x30')]['offset']);}_0x1073e4[_0x6c31('0x36')]=qs[_0x6c31('0x37')](_0x58549a[_0x6c31('0x30')]['sort']);_0x1073e4[_0x6c31('0x38')]=qs['filters'](_[_0x6c31('0x39')](_0x58549a[_0x6c31('0x30')],_0xdf17b0['filters']),_0x2e0b2d);if(_0x58549a[_0x6c31('0x30')][_0x6c31('0x3a')]){_0x1073e4[_0x6c31('0x38')]=_[_0x6c31('0x3b')](_0x1073e4[_0x6c31('0x38')],{'$or':_['map'](_0x2e0b2d,function(_0xa16340){if(_0xa16340[_0x6c31('0x3c')]!==_0x6c31('0x3d')){var _0x4b60f6={};_0x4b60f6[_0xa16340[_0x6c31('0x27')]]={'$like':'%'+_0x58549a['query'][_0x6c31('0x3a')]+'%'};return _0x4b60f6;}})});}_0x1073e4=_[_0x6c31('0x3b')]({},_0x1073e4,_0x58549a[_0x6c31('0x3e')]);var _0x31dcd8={'where':_0x1073e4[_0x6c31('0x38')]};return db[_0x6c31('0x2a')][_0x6c31('0x1e')](_0x31dcd8)[_0x6c31('0x23')](function(_0x17797c){_0x300fa7[_0x6c31('0x1e')]=_0x17797c;if(_0x58549a['query'][_0x6c31('0x3f')]){_0x1073e4[_0x6c31('0x40')]=[{'all':!![]}];}return db['VoiceRecording'][_0x6c31('0x41')](_0x1073e4);})[_0x6c31('0x23')](function(_0x5a468c){_0x300fa7[_0x6c31('0x42')]=_0x5a468c;return _0x300fa7;})[_0x6c31('0x23')](respondWithFilteredResult(_0x52c0ec,_0x1073e4))['catch'](handleError(_0x52c0ec,null));};exports[_0x6c31('0x43')]=function(_0x45dae0,_0x2fc9df){var _0x5823b8={'raw':![],'where':{'id':_0x45dae0[_0x6c31('0x44')]['id']}},_0x1c90c1={};_0x1c90c1[_0x6c31('0x2d')]=_[_0x6c31('0x45')](db['VoiceRecording'][_0x6c31('0x2b')]);_0x1c90c1['query']=_[_0x6c31('0x45')](_0x45dae0[_0x6c31('0x30')]);_0x1c90c1[_0x6c31('0x31')]=_[_0x6c31('0x32')](_0x1c90c1['model'],_0x1c90c1[_0x6c31('0x30')]);_0x5823b8[_0x6c31('0x34')]=_[_0x6c31('0x32')](_0x1c90c1[_0x6c31('0x2d')],qs[_0x6c31('0x33')](_0x45dae0[_0x6c31('0x30')][_0x6c31('0x33')]));_0x5823b8[_0x6c31('0x34')]=_0x5823b8[_0x6c31('0x34')][_0x6c31('0x46')]?_0x5823b8[_0x6c31('0x34')]:_0x1c90c1[_0x6c31('0x2d')];if(_0x45dae0[_0x6c31('0x30')]['includeAll']){_0x5823b8[_0x6c31('0x40')]=[{'all':!![]}];}_0x5823b8=_[_0x6c31('0x3b')]({},_0x5823b8,_0x45dae0[_0x6c31('0x3e')]);return db[_0x6c31('0x2a')]['find'](_0x5823b8)[_0x6c31('0x23')](handleEntityNotFound(_0x2fc9df,null))[_0x6c31('0x23')](respondWithResult(_0x2fc9df,null))[_0x6c31('0x47')](handleError(_0x2fc9df,null));};exports['create']=function(_0x2e8ea9,_0x8e8380){return db[_0x6c31('0x2a')][_0x6c31('0x48')](_0x2e8ea9['body'],{})[_0x6c31('0x23')](respondWithResult(_0x8e8380,0xc9))[_0x6c31('0x47')](handleError(_0x8e8380,null));};exports[_0x6c31('0x22')]=function(_0x2fca4e,_0x18b39b){if(_0x2fca4e[_0x6c31('0x49')]['id']){delete _0x2fca4e[_0x6c31('0x49')]['id'];}return db[_0x6c31('0x2a')][_0x6c31('0x4a')]({'where':{'id':_0x2fca4e[_0x6c31('0x44')]['id']}})[_0x6c31('0x23')](handleEntityNotFound(_0x18b39b,null))[_0x6c31('0x23')](saveUpdates(_0x2fca4e[_0x6c31('0x49')],null))[_0x6c31('0x23')](respondWithResult(_0x18b39b,null))[_0x6c31('0x47')](handleError(_0x18b39b,null));};exports[_0x6c31('0x4b')]=function(_0x2afd82,_0x338612){return db['VoiceRecording'][_0x6c31('0x4b')]()[_0x6c31('0x23')](respondWithResult(_0x338612,null))['catch'](handleError(_0x338612,null));};exports[_0x6c31('0x4c')]=function(_0x344313,_0x1924ca,_0x324b8a){var _0x4bfbbd=require(_0x6c31('0x4d'));var _0x4832e1=![];var _0x1bef89={};if(_0x344313[_0x6c31('0x30')][_0x6c31('0x3c')]&&_0x344313['query'][_0x6c31('0x3c')]===_0x6c31('0x4e')){_0x1bef89['uniqueid']=_0x344313[_0x6c31('0x44')]['id'];}else{_0x1bef89['id']=_0x344313[_0x6c31('0x44')]['id'];}return db['VoiceRecording']['find']({'where':_0x1bef89,'attributes':['id','value'],'raw':!![]})[_0x6c31('0x23')](handleEntityNotFound(_0x1924ca,null))[_0x6c31('0x23')](function(_0x224f27){if(_0x224f27){var _0x51b836=_0x224f27[_0x6c31('0x4f')];var _0x27eaa4=util[_0x6c31('0x2f')](_0x6c31('0x50'),_0x51b836);if(fs[_0x6c31('0x51')](_0x27eaa4)){_0x4832e1=!![];return _0x4bfbbd[_0x6c31('0x52')](_0x27eaa4,_0x51b836,config[_0x6c31('0x53')][_0x6c31('0x54')])[_0x6c31('0x23')](function(){return _0x224f27;});}return _0x224f27;}})[_0x6c31('0x23')](function(_0x4e5682){if(_0x4e5682){var _0x5dddc1=_0x4e5682[_0x6c31('0x4f')];if(!fs[_0x6c31('0x51')](_0x5dddc1)){throw new db[(_0x6c31('0x55'))][(_0x6c31('0x56'))](_0x6c31('0x57'));}if(_0x4e5682['filename']){return _0x1924ca[_0x6c31('0x4c')](_0x5dddc1,_0x4e5682[_0x6c31('0x58')]+path['extname'](_0x5dddc1),function(){if(_0x4832e1){fs[_0x6c31('0x59')](_0x5dddc1);}});}else{return _0x1924ca[_0x6c31('0x4c')](_0x5dddc1,function(_0x15ef16){if(_0x4832e1){fs[_0x6c31('0x59')](_0x5dddc1);}});}}})[_0x6c31('0x47')](function(_0x2a00a6){if(_0x2a00a6[_0x6c31('0x5a')]==='VoiceRecording\x20not\x20found'){_0x1924ca['status'](0x194)[_0x6c31('0x28')](_0x6c31('0x5b'));}else{return handleError(_0x1924ca,null);}});};exports[_0x6c31('0x5c')]=function(_0x4847bd,_0x2f9db8,_0x4c48b0){var _0x3f9bd0=require(_0x6c31('0x4d'));var _0xca0f59=![];var _0x2c7086={'$and':[db[_0x6c31('0x5d')][_0x6c31('0x38')](db['sequelize']['fn']('MD5',db[_0x6c31('0x5d')][_0x6c31('0x5e')](_0x6c31('0x4e'))),_0x4847bd[_0x6c31('0x30')][_0x6c31('0x5f')])]};if(_0x4847bd[_0x6c31('0x30')][_0x6c31('0x3c')]&&_0x4847bd['query'][_0x6c31('0x3c')]===_0x6c31('0x4e')){_0x2c7086['$and'][_0x6c31('0x60')]({'uniqueid':_0x4847bd[_0x6c31('0x44')]['id']});}else{_0x2c7086['$and'][_0x6c31('0x60')]({'id':_0x4847bd[_0x6c31('0x44')]['id']});}return db[_0x6c31('0x2a')][_0x6c31('0x4a')]({'where':_0x2c7086,'attributes':['id',_0x6c31('0x4f')],'raw':!![]})[_0x6c31('0x23')](handleEntityNotFound(_0x2f9db8,null))[_0x6c31('0x23')](function(_0x49c300){if(_0x49c300){var _0x31e754=util['format'](_0x6c31('0x50'),_0x49c300[_0x6c31('0x4f')]);if(fs[_0x6c31('0x51')](_0x31e754)){_0xca0f59=!![];return _0x3f9bd0[_0x6c31('0x52')](_0x31e754,_0x49c300[_0x6c31('0x4f')],config[_0x6c31('0x53')][_0x6c31('0x54')])[_0x6c31('0x23')](function(){return _0x49c300;});}return _0x49c300;}})[_0x6c31('0x23')](function(_0x4e9947){if(_0x4e9947){if(!fs[_0x6c31('0x51')](_0x4e9947[_0x6c31('0x4f')])){throw new db['Sequelize'][(_0x6c31('0x56'))]('VoiceRecording\x20not\x20found');}if(_0x4e9947[_0x6c31('0x58')]){return _0x2f9db8[_0x6c31('0x4c')](_0x4e9947[_0x6c31('0x4f')],_0x4e9947[_0x6c31('0x58')]+path[_0x6c31('0x61')](_0x4e9947[_0x6c31('0x4f')]),function(){if(_0xca0f59){fs[_0x6c31('0x59')](_0x4e9947[_0x6c31('0x4f')]);}});}else{return _0x2f9db8[_0x6c31('0x4c')](_0x4e9947[_0x6c31('0x4f')],function(_0x499c33){if(_0xca0f59){fs[_0x6c31('0x59')](_0x4e9947['value']);}});}}})[_0x6c31('0x47')](handleError(_0x2f9db8,null));};exports[_0x6c31('0x24')]=function(_0x442964,_0x1b3dde){return db[_0x6c31('0x2a')][_0x6c31('0x4a')]({'where':{'id':_0x442964[_0x6c31('0x44')]['id']}})[_0x6c31('0x23')](function(_0x2cbe3){if(_[_0x6c31('0x62')](_0x2cbe3)){throw new ReferenceError(_0x6c31('0x63'));}return _0x2cbe3;})[_0x6c31('0x23')](function(_0x1f6e7e){var _0x27132e=_0x1f6e7e['value'];logger[_0x6c31('0x64')](_0x6c31('0x65'),_0x27132e);if(!_[_0x6c31('0x62')](_0x1f6e7e['value'])&&fs[_0x6c31('0x51')](_0x27132e)){logger[_0x6c31('0x64')](_0x6c31('0x66')+_0x27132e+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x6c31('0x67')](_0x27132e);}_0x27132e=_0x27132e+'.cypher';if(!_['isNil'](_0x1f6e7e[_0x6c31('0x4f')])&&fs[_0x6c31('0x51')](_0x27132e)){logger[_0x6c31('0x64')]('File:\x20\x22'+_0x27132e+_0x6c31('0x68'));fs[_0x6c31('0x67')](_0x27132e);}return _0x1f6e7e;})[_0x6c31('0x23')](function(_0x345bf0){if(!_0x345bf0)throw new InternalError();return _0x345bf0[_0x6c31('0x24')]();})[_0x6c31('0x23')](function(){_0x1b3dde['status'](0xcc)[_0x6c31('0x19')]();})[_0x6c31('0x47')](handleError(_0x1b3dde,null));};function getBucketslist(_0x3483f4,_0x14a5a2,_0x18f817){return new Promise(function(_0x3024fd,_0x621c00){var _0x39e804=new AWS['S3']({'accessKeyId':_0x14a5a2,'secretAccessKey':_0x3483f4,'region':_0x18f817});_0x39e804[_0x6c31('0x69')]({},function(_0xf2e93c,_0x35a070){if(_0xf2e93c){return _0x621c00(_0xf2e93c);}else{return _0x3024fd(_0x35a070);}});});}function createBucket(_0x42f53e,_0xa5816a,_0x291c7a,_0x4a162f){return new Promise(function(_0x16fbc9,_0x31234c){var _0xc65c3=new AWS['S3']({'accessKeyId':_0xa5816a,'secretAccessKey':_0x42f53e,'region':_0x291c7a});_0xc65c3[_0x6c31('0x6a')]({'Bucket':_0x4a162f},function(_0x1ce095,_0x420f14){if(_0x1ce095){return _0x31234c(_0x1ce095);}else{return _0x16fbc9(_0x420f14);}});});}function uploadFile(_0x278c95,_0xa56474,_0x2c0b96,_0x3e2f01,_0x14e0d6,_0x138bf5){return new Promise(function(_0xd63a9b,_0x5672cf){var _0xc6c10f=new AWS['S3']({'accessKeyId':_0xa56474,'secretAccessKey':_0x278c95,'region':_0x2c0b96});_0xc6c10f[_0x6c31('0x6b')]({'Bucket':_0x3e2f01,'Key':_0x14e0d6,'Body':_0x138bf5},function(_0x5351aa,_0x40cc52){if(_0x5351aa){return _0x5672cf(_0x5351aa);}else{return _0xd63a9b(_0x40cc52);}});});}function startTranscribe(_0x5e8267,_0x2b4ef,_0x44dc0a,_0x3050fd,_0x39c661,_0x3845e6){return new Promise(function(_0x1a3f13,_0xe9ce1f){var _0x7e1614=new AWS['TranscribeService']({'accessKeyId':_0x2b4ef,'secretAccessKey':_0x5e8267,'region':_0x44dc0a});_0x7e1614[_0x6c31('0x6c')]({'TranscriptionJobName':_0x3050fd,'LanguageCode':_0x39c661,'Media':{'MediaFileUri':_0x3845e6}},function(_0x3aeffd,_0x202dd1){if(_0x3aeffd){return _0xe9ce1f(_0x3aeffd);}else{return _0x1a3f13(_0x202dd1);}});});}function transcribe(_0x42278f,_0xffee0e,_0x161115,_0x3665d1,_0x15a2b1,_0x338135,_0x406670){return new Promise(function(_0xb6fe3b,_0x41ff79){var _0x1a4d13={};logger[_0x6c31('0x64')](util['format'](_0x6c31('0x6d'),_0x42278f,_0x15a2b1));return uploadFile(_0xffee0e,_0x161115,_0x3665d1,_0x15a2b1,path[_0x6c31('0x6e')](_0x338135),fs[_0x6c31('0x6f')](_0x338135))[_0x6c31('0x23')](function(_0x12c6b6){logger[_0x6c31('0x64')](util[_0x6c31('0x2f')]('[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)',_0x42278f,_0x15a2b1,_0x12c6b6[_0x6c31('0x70')]));_0x1a4d13[_0x6c31('0x71')]=_0x12c6b6[_0x6c31('0x72')];_0x1a4d13['location']=_0x12c6b6[_0x6c31('0x70')];logger[_0x6c31('0x64')](util[_0x6c31('0x2f')](_0x6c31('0x73'),_0x42278f));return startTranscribe(_0xffee0e,_0x161115,_0x3665d1,uuidv4(),_0x406670,_0x12c6b6[_0x6c31('0x70')]);})['then'](function(_0x4be398){logger[_0x6c31('0x64')](util[_0x6c31('0x2f')](_0x6c31('0x74'),_0x42278f,_0x4be398['TranscriptionJob']['TranscriptionJobName']));_0x1a4d13[_0x6c31('0x75')]=_0x4be398['TranscriptionJob'][_0x6c31('0x76')];_0x1a4d13[_0x6c31('0x77')]=_0x4be398[_0x6c31('0x78')][_0x6c31('0x79')];return _0xb6fe3b(_0x1a4d13);})[_0x6c31('0x47')](function(_0x1c16f0){return _0x41ff79(_0x1c16f0);});});}exports[_0x6c31('0x7a')]=function(_0x34baff,_0x273993,_0x557f16){var _0x303128;var _0x41fb93;var _0x605eb;var _0x120b72=require(_0x6c31('0x4d'));return db[_0x6c31('0x2a')]['findOne']({'where':{'id':_0x34baff[_0x6c31('0x44')]['id']}})['then'](function(_0x236371){if(_0x236371){var _0x567420=util[_0x6c31('0x2f')](_0x6c31('0x50'),_0x236371['value']);if(fs[_0x6c31('0x51')](_0x567420)){cypher=!![];return _0x120b72['decryptFile'](_0x567420,_0x236371['value'],config['secrets'][_0x6c31('0x54')])[_0x6c31('0x23')](function(){return _0x236371;});}return _0x236371;}})[_0x6c31('0x23')](function(_0x2d86e5){if(!_0x2d86e5){throw new db[(_0x6c31('0x55'))][(_0x6c31('0x56'))](_0x6c31('0x7b'));}_0x41fb93=_0x2d86e5;return db[_0x6c31('0x7c')]['findOne']({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0x273993,null))[_0x6c31('0x23')](function(_0x5874b7){if(_0x5874b7){_0x303128=_0x5874b7;if(!_0x303128['transcribe']||!_0x303128[_0x6c31('0x7d')]||!_0x303128[_0x6c31('0x7e')]||!_0x303128['language']||!_0x303128[_0x6c31('0x71')]){throw new db[(_0x6c31('0x55'))][(_0x6c31('0x56'))](_0x6c31('0x7f'));}if(_0x34baff[_0x6c31('0x49')]['runSentiment']&&(!_0x303128['sentiment']||!_0x303128['sentimentAccountId']||!_0x303128['sentimentRegion']||!_0x303128[_0x6c31('0x80')]||!_0x303128[_0x6c31('0x71')])){throw new db[(_0x6c31('0x55'))][(_0x6c31('0x56'))]('Sentiment\x20Analysis\x20not\x20configured');}return db[_0x6c31('0x81')][_0x6c31('0x82')]({'where':{'id':_0x303128[_0x6c31('0x7d')]}});}})[_0x6c31('0x23')](function(_0x336a2c){if(!_0x336a2c){throw new db[(_0x6c31('0x55'))]['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0x336a2c['data1']||!_0x336a2c[_0x6c31('0x83')]){throw new db[(_0x6c31('0x55'))][(_0x6c31('0x56'))](_0x6c31('0x84'));}_0x605eb=_0x336a2c;return getBucketslist(_0x605eb[_0x6c31('0x85')],_0x605eb[_0x6c31('0x83')],_0x303128[_0x6c31('0x7e')]);})[_0x6c31('0x23')](function(_0xe5b24){if(_0xe5b24&&_0xe5b24[_0x6c31('0x86')]){var _0x425792=_[_0x6c31('0x4a')](_0xe5b24[_0x6c31('0x86')],function(_0x132762){return _0x132762[_0x6c31('0x87')]===_0x303128[_0x6c31('0x71')];});if(!_0x425792){logger['info'](util[_0x6c31('0x2f')](_0x6c31('0x88'),_0x34baff[_0x6c31('0x44')]['id'],_0x303128[_0x6c31('0x71')]));return createBucket(_0x605eb['data1'],_0x605eb[_0x6c31('0x83')],_0x303128['transcribeRegion'],_0x303128['bucket']);}logger[_0x6c31('0x64')](util[_0x6c31('0x2f')](_0x6c31('0x89'),_0x34baff[_0x6c31('0x44')]['id'],_0x303128[_0x6c31('0x71')]));return;}})[_0x6c31('0x23')](function(_0x392343){if(_0x41fb93['transcribeStatus']===_0x6c31('0x8a')){return transcribe(_0x34baff[_0x6c31('0x44')]['id'],_0x605eb[_0x6c31('0x85')],_0x605eb['data2'],_0x303128[_0x6c31('0x7e')],_0x303128[_0x6c31('0x71')],_0x41fb93[_0x6c31('0x4f')],_0x303128[_0x6c31('0x80')]);}else{logger['info'](util[_0x6c31('0x2f')](_0x6c31('0x8b'),_0x34baff[_0x6c31('0x44')]['id']));return{'transcribeStatus':'IN_PROGRESS'};}})['then'](function(_0x3897be){if(_0x3897be){_0x3897be[_0x6c31('0x8c')]=_0x34baff[_0x6c31('0x49')][_0x6c31('0x8d')];return _0x41fb93[_0x6c31('0x8e')](_0x3897be);}})[_0x6c31('0x23')](respondWithResult(_0x273993,null))[_0x6c31('0x47')](handleError(_0x273993,null));};function writeFile(_0x2ac78d,_0x4aa60e){return new Promise(function(_0x1d8539,_0x45fa79){fs[_0x6c31('0x8f')](_0x4aa60e,_0x2ac78d,function(_0x396aef,_0x537b3f){if(_0x396aef){return _0x45fa79(_0x396aef);}else{return _0x1d8539(_0x537b3f);}});});}exports[_0x6c31('0x90')]=function(_0x508628,_0x3b2d07,_0x54f8c6){return db[_0x6c31('0x2a')][_0x6c31('0x82')]({'where':{'id':_0x508628[_0x6c31('0x44')]['id']}})[_0x6c31('0x23')](handleEntityNotFound(_0x3b2d07))[_0x6c31('0x23')](function(_0x279acd){if(_0x279acd&&_0x279acd[_0x6c31('0x91')]){var _0x4940ca=_0x279acd[_0x6c31('0x91')];var _0x1b993d=config[_0x6c31('0x92')]+_0x6c31('0x93')+_0x279acd['id']+'.txt';if(fs['existsSync'](_0x1b993d)){return _0x1b993d;}return writeFile(_0x4940ca,_0x1b993d)[_0x6c31('0x23')](function(){return _0x1b993d;});}else{throw new db[(_0x6c31('0x55'))][(_0x6c31('0x56'))](_0x6c31('0x94'));}})[_0x6c31('0x23')](function(_0x25f6d1){return _0x3b2d07[_0x6c31('0x4c')](_0x25f6d1);})[_0x6c31('0x47')](handleError(_0x3b2d07));}; \ No newline at end of file +var _0x6f72=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','stack','name','send','index','map','fieldName','type','model','differenceBy','format','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','options','VoiceRecording','includeAll','include','findAll','rows','catch','params','find','create','body','describe','download','uniqueid','value','existsSync','decryptFile','Sequelize','VoiceRecording\x20not\x20found','filename','unlink','message','Not\x20found','sequelize','MD5','col','token','$and','push','%s.cypher','secrets','recording','ValidationError','isNil','Entity\x20not\x20found','info','File:\x20\x22','unlinkSync','.cypher','listBuckets','createBucket','upload','TranscribeService','startTranscriptionJob','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','TranscriptionJobName','transcribeName','runTranscribe','../../components/encryptor','Voice\x20Recording\x20not\x20found','Setting','findOne','transcribeRegion','language','bucket','runSentiment','sentiment','sentimentAccountId','sentimentRegion','CloudProvider','transcribeAccountId','Cloud\x20Provider\x20not\x20available','data2','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','data1','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','updateAttributes','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','jsforce','desk.js','papaparse','aws-sdk','uuid/v4','../../components/auth/service'];(function(_0x3d537b,_0x5d2728){var _0x5d2e69=function(_0x7e90c6){while(--_0x7e90c6){_0x3d537b['push'](_0x3d537b['shift']());}};_0x5d2e69(++_0x5d2728);}(_0x6f72,0x19f));var _0x26f7=function(_0x4a71d7,_0x267324){_0x4a71d7=_0x4a71d7-0x0;var _0x145eb0=_0x6f72[_0x4a71d7];return _0x145eb0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x26f7('0x0'));var zipdir=require(_0x26f7('0x1'));var jsonpatch=require(_0x26f7('0x2'));var rp=require('request-promise');var moment=require(_0x26f7('0x3'));var BPromise=require(_0x26f7('0x4'));var Mustache=require(_0x26f7('0x5'));var util=require('util');var path=require(_0x26f7('0x6'));var sox=require(_0x26f7('0x7'));var csv=require(_0x26f7('0x8'));var ejs=require(_0x26f7('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x26f7('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x26f7('0xb'));var deskjs=require(_0x26f7('0xc'));var toCsv=require(_0x26f7('0x8'));var querystring=require('querystring');var Papa=require(_0x26f7('0xd'));var AWS=require(_0x26f7('0xe'));var uuidv4=require(_0x26f7('0xf'));var Redis=require('ioredis');var authService=require(_0x26f7('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x26f7('0x11'));var hardwareService=require(_0x26f7('0x12'));var logger=require(_0x26f7('0x13'))('api');var utils=require(_0x26f7('0x14'));var config=require(_0x26f7('0x15'));var licenseUtil=require(_0x26f7('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4a8e2b,_0x134033){_0x134033=_0x134033||0xcc;return function(_0x31aed3){if(_0x31aed3){return _0x4a8e2b[_0x26f7('0x17')](_0x134033);}return _0x4a8e2b[_0x26f7('0x18')](_0x134033)[_0x26f7('0x19')]();};}function respondWithResult(_0x44659e,_0x5e4710){_0x5e4710=_0x5e4710||0xc8;return function(_0x2adba3){if(_0x2adba3){return _0x44659e[_0x26f7('0x18')](_0x5e4710)[_0x26f7('0x1a')](_0x2adba3);}};}function respondWithFilteredResult(_0x42d4b0,_0x386a03){return function(_0x13ea59){if(_0x13ea59){var _0x29ccc6=typeof _0x386a03[_0x26f7('0x1b')]===_0x26f7('0x1c')&&typeof _0x386a03[_0x26f7('0x1d')]==='undefined';var _0x284cab=_0x13ea59[_0x26f7('0x1e')];var _0x3cbb22=_0x29ccc6?0x0:_0x386a03[_0x26f7('0x1b')];var _0x5e1967=_0x29ccc6?_0x13ea59[_0x26f7('0x1e')]:_0x386a03['offset']+_0x386a03['limit'];var _0x269552;if(_0x5e1967>=_0x284cab){_0x5e1967=_0x284cab;_0x269552=0xc8;}else{_0x269552=0xce;}_0x42d4b0[_0x26f7('0x18')](_0x269552);return _0x42d4b0[_0x26f7('0x1f')](_0x26f7('0x20'),_0x3cbb22+'-'+_0x5e1967+'/'+_0x284cab)[_0x26f7('0x1a')](_0x13ea59);}return null;};}function patchUpdates(_0x15508){return function(_0x507abf){try{jsonpatch[_0x26f7('0x21')](_0x507abf,_0x15508,!![]);}catch(_0x494992){return BPromise[_0x26f7('0x22')](_0x494992);}return _0x507abf[_0x26f7('0x23')]();};}function saveUpdates(_0x5ac5dd,_0x1532cf){return function(_0xb2957c){if(_0xb2957c){return _0xb2957c[_0x26f7('0x24')](_0x5ac5dd)['then'](function(_0x44390e){return _0x44390e;});}return null;};}function removeEntity(_0x283e9b,_0x5b8735){return function(_0x5ed018){if(_0x5ed018){return _0x5ed018[_0x26f7('0x25')]()[_0x26f7('0x26')](function(){_0x283e9b[_0x26f7('0x18')](0xcc)[_0x26f7('0x19')]();});}};}function handleEntityNotFound(_0x45e1a4,_0x22f845){return function(_0x3b85fd){if(!_0x3b85fd){_0x45e1a4[_0x26f7('0x17')](0x194);}return _0x3b85fd;};}function handleError(_0x17cb07,_0x43cde8){_0x43cde8=_0x43cde8||0x1f4;return function(_0x45040b){logger['error'](_0x45040b[_0x26f7('0x27')]);if(_0x45040b['name']){delete _0x45040b[_0x26f7('0x28')];}_0x17cb07[_0x26f7('0x18')](_0x43cde8)[_0x26f7('0x29')](_0x45040b);};}exports[_0x26f7('0x2a')]=function(_0x71d027,_0x11a042){var _0xb5f339={},_0x1ea574={},_0x4d25dc={'count':0x0,'rows':[]};var _0x499844=_[_0x26f7('0x2b')](db['VoiceRecording']['rawAttributes'],function(_0x277efd){return{'name':_0x277efd[_0x26f7('0x2c')],'type':_0x277efd[_0x26f7('0x2d')]['key']};});_0x1ea574[_0x26f7('0x2e')]=_[_0x26f7('0x2f')](_[_0x26f7('0x2b')](_0x499844,_0x26f7('0x28')),[_0x26f7('0x30')]);_0x1ea574[_0x26f7('0x31')]=_[_0x26f7('0x32')](_0x71d027[_0x26f7('0x31')]);_0x1ea574[_0x26f7('0x33')]=_['intersection'](_0x1ea574[_0x26f7('0x2e')],_0x1ea574[_0x26f7('0x31')]);_0xb5f339[_0x26f7('0x34')]=_[_0x26f7('0x35')](_0x1ea574[_0x26f7('0x2e')],qs['fields'](_0x71d027[_0x26f7('0x31')][_0x26f7('0x36')]));_0xb5f339[_0x26f7('0x34')]=_0xb5f339['attributes'][_0x26f7('0x37')]?_0xb5f339[_0x26f7('0x34')]:_0x1ea574['model'];if(!_0x71d027[_0x26f7('0x31')]['hasOwnProperty'](_0x26f7('0x38'))){_0xb5f339[_0x26f7('0x1d')]=qs[_0x26f7('0x1d')](_0x71d027[_0x26f7('0x31')][_0x26f7('0x1d')]);_0xb5f339[_0x26f7('0x1b')]=qs[_0x26f7('0x1b')](_0x71d027[_0x26f7('0x31')][_0x26f7('0x1b')]);}_0xb5f339[_0x26f7('0x39')]=qs[_0x26f7('0x3a')](_0x71d027[_0x26f7('0x31')][_0x26f7('0x3a')]);_0xb5f339[_0x26f7('0x3b')]=qs[_0x26f7('0x33')](_[_0x26f7('0x3c')](_0x71d027[_0x26f7('0x31')],_0x1ea574['filters']),_0x499844);if(_0x71d027[_0x26f7('0x31')][_0x26f7('0x3d')]){_0xb5f339[_0x26f7('0x3b')]=_[_0x26f7('0x3e')](_0xb5f339[_0x26f7('0x3b')],{'$or':_['map'](_0x499844,function(_0x2810e1){if(_0x2810e1[_0x26f7('0x2d')]!=='VIRTUAL'){var _0x260a47={};_0x260a47[_0x2810e1[_0x26f7('0x28')]]={'$like':'%'+_0x71d027[_0x26f7('0x31')][_0x26f7('0x3d')]+'%'};return _0x260a47;}})});}_0xb5f339=_[_0x26f7('0x3e')]({},_0xb5f339,_0x71d027[_0x26f7('0x3f')]);var _0x15de9f={'where':_0xb5f339[_0x26f7('0x3b')]};return db[_0x26f7('0x40')][_0x26f7('0x1e')](_0x15de9f)[_0x26f7('0x26')](function(_0x497f03){_0x4d25dc[_0x26f7('0x1e')]=_0x497f03;if(_0x71d027[_0x26f7('0x31')][_0x26f7('0x41')]){_0xb5f339[_0x26f7('0x42')]=[{'all':!![]}];}return db[_0x26f7('0x40')][_0x26f7('0x43')](_0xb5f339);})[_0x26f7('0x26')](function(_0x67a82d){_0x4d25dc[_0x26f7('0x44')]=_0x67a82d;return _0x4d25dc;})[_0x26f7('0x26')](respondWithFilteredResult(_0x11a042,_0xb5f339))[_0x26f7('0x45')](handleError(_0x11a042,null));};exports['show']=function(_0xc9050c,_0x21f79c){var _0x9848f={'raw':![],'where':{'id':_0xc9050c[_0x26f7('0x46')]['id']}},_0x43e2b1={};_0x43e2b1[_0x26f7('0x2e')]=_[_0x26f7('0x32')](db[_0x26f7('0x40')]['rawAttributes']);_0x43e2b1[_0x26f7('0x31')]=_['keys'](_0xc9050c[_0x26f7('0x31')]);_0x43e2b1[_0x26f7('0x33')]=_[_0x26f7('0x35')](_0x43e2b1[_0x26f7('0x2e')],_0x43e2b1[_0x26f7('0x31')]);_0x9848f[_0x26f7('0x34')]=_[_0x26f7('0x35')](_0x43e2b1['model'],qs['fields'](_0xc9050c[_0x26f7('0x31')][_0x26f7('0x36')]));_0x9848f[_0x26f7('0x34')]=_0x9848f[_0x26f7('0x34')][_0x26f7('0x37')]?_0x9848f[_0x26f7('0x34')]:_0x43e2b1[_0x26f7('0x2e')];if(_0xc9050c[_0x26f7('0x31')][_0x26f7('0x41')]){_0x9848f[_0x26f7('0x42')]=[{'all':!![]}];}_0x9848f=_[_0x26f7('0x3e')]({},_0x9848f,_0xc9050c['options']);return db['VoiceRecording'][_0x26f7('0x47')](_0x9848f)['then'](handleEntityNotFound(_0x21f79c,null))['then'](respondWithResult(_0x21f79c,null))[_0x26f7('0x45')](handleError(_0x21f79c,null));};exports[_0x26f7('0x48')]=function(_0x24ec8f,_0x5a4e7f){return db[_0x26f7('0x40')][_0x26f7('0x48')](_0x24ec8f[_0x26f7('0x49')],{})[_0x26f7('0x26')](respondWithResult(_0x5a4e7f,0xc9))[_0x26f7('0x45')](handleError(_0x5a4e7f,null));};exports['update']=function(_0xa50abc,_0x393d68){if(_0xa50abc[_0x26f7('0x49')]['id']){delete _0xa50abc[_0x26f7('0x49')]['id'];}return db[_0x26f7('0x40')]['find']({'where':{'id':_0xa50abc[_0x26f7('0x46')]['id']}})[_0x26f7('0x26')](handleEntityNotFound(_0x393d68,null))[_0x26f7('0x26')](saveUpdates(_0xa50abc['body'],null))['then'](respondWithResult(_0x393d68,null))['catch'](handleError(_0x393d68,null));};exports['describe']=function(_0x3d61fc,_0x4a0b03){return db[_0x26f7('0x40')][_0x26f7('0x4a')]()[_0x26f7('0x26')](respondWithResult(_0x4a0b03,null))[_0x26f7('0x45')](handleError(_0x4a0b03,null));};exports[_0x26f7('0x4b')]=function(_0x112c4f,_0x1a2693,_0x4ff5e7){var _0x14c19c=require('../../components/encryptor');var _0x28d88a=![];var _0x5861a0={};if(_0x112c4f['query'][_0x26f7('0x2d')]&&_0x112c4f[_0x26f7('0x31')][_0x26f7('0x2d')]===_0x26f7('0x4c')){_0x5861a0[_0x26f7('0x4c')]=_0x112c4f[_0x26f7('0x46')]['id'];}else{_0x5861a0['id']=_0x112c4f[_0x26f7('0x46')]['id'];}return db['VoiceRecording'][_0x26f7('0x47')]({'where':_0x5861a0,'attributes':['id','value'],'raw':!![]})['then'](handleEntityNotFound(_0x1a2693,null))[_0x26f7('0x26')](function(_0x24ee67){if(_0x24ee67){var _0x513222=_0x24ee67[_0x26f7('0x4d')];var _0x3c5a43=util[_0x26f7('0x30')]('%s.cypher',_0x513222);if(fs[_0x26f7('0x4e')](_0x3c5a43)){_0x28d88a=!![];return _0x14c19c[_0x26f7('0x4f')](_0x3c5a43,_0x513222,config['secrets']['recording'])['then'](function(){return _0x24ee67;});}return _0x24ee67;}})['then'](function(_0x345c4d){if(_0x345c4d){var _0x3907b1=_0x345c4d[_0x26f7('0x4d')];if(!fs[_0x26f7('0x4e')](_0x3907b1)){throw new db[(_0x26f7('0x50'))]['ValidationError'](_0x26f7('0x51'));}if(_0x345c4d['filename']){return _0x1a2693['download'](_0x3907b1,_0x345c4d[_0x26f7('0x52')]+path['extname'](_0x3907b1),function(){if(_0x28d88a){fs[_0x26f7('0x53')](_0x3907b1);}});}else{return _0x1a2693['download'](_0x3907b1,function(_0x406fa9){if(_0x28d88a){fs[_0x26f7('0x53')](_0x3907b1);}});}}})[_0x26f7('0x45')](function(_0x113593){if(_0x113593[_0x26f7('0x54')]===_0x26f7('0x51')){_0x1a2693['status'](0x194)[_0x26f7('0x29')](_0x26f7('0x55'));}else{return handleError(_0x1a2693,null);}});};exports['downloads']=function(_0x4b75e3,_0x209cc1,_0x2d713f){var _0x44c28c=require('../../components/encryptor');var _0x4dfb61=![];var _0x7c9ea2={'$and':[db[_0x26f7('0x56')]['where'](db['sequelize']['fn'](_0x26f7('0x57'),db[_0x26f7('0x56')][_0x26f7('0x58')](_0x26f7('0x4c'))),_0x4b75e3['query'][_0x26f7('0x59')])]};if(_0x4b75e3[_0x26f7('0x31')][_0x26f7('0x2d')]&&_0x4b75e3['query'][_0x26f7('0x2d')]===_0x26f7('0x4c')){_0x7c9ea2[_0x26f7('0x5a')][_0x26f7('0x5b')]({'uniqueid':_0x4b75e3[_0x26f7('0x46')]['id']});}else{_0x7c9ea2[_0x26f7('0x5a')][_0x26f7('0x5b')]({'id':_0x4b75e3[_0x26f7('0x46')]['id']});}return db[_0x26f7('0x40')][_0x26f7('0x47')]({'where':_0x7c9ea2,'attributes':['id',_0x26f7('0x4d')],'raw':!![]})[_0x26f7('0x26')](handleEntityNotFound(_0x209cc1,null))[_0x26f7('0x26')](function(_0x38e1dd){if(_0x38e1dd){var _0x13567b=util['format'](_0x26f7('0x5c'),_0x38e1dd[_0x26f7('0x4d')]);if(fs['existsSync'](_0x13567b)){_0x4dfb61=!![];return _0x44c28c['decryptFile'](_0x13567b,_0x38e1dd[_0x26f7('0x4d')],config[_0x26f7('0x5d')][_0x26f7('0x5e')])[_0x26f7('0x26')](function(){return _0x38e1dd;});}return _0x38e1dd;}})[_0x26f7('0x26')](function(_0x17b28a){if(_0x17b28a){if(!fs[_0x26f7('0x4e')](_0x17b28a[_0x26f7('0x4d')])){throw new db[(_0x26f7('0x50'))][(_0x26f7('0x5f'))]('VoiceRecording\x20not\x20found');}if(_0x17b28a['filename']){return _0x209cc1[_0x26f7('0x4b')](_0x17b28a[_0x26f7('0x4d')],_0x17b28a[_0x26f7('0x52')]+path['extname'](_0x17b28a[_0x26f7('0x4d')]),function(){if(_0x4dfb61){fs[_0x26f7('0x53')](_0x17b28a[_0x26f7('0x4d')]);}});}else{return _0x209cc1['download'](_0x17b28a[_0x26f7('0x4d')],function(_0x258a0f){if(_0x4dfb61){fs[_0x26f7('0x53')](_0x17b28a['value']);}});}}})[_0x26f7('0x45')](handleError(_0x209cc1,null));};exports['destroy']=function(_0x301250,_0x2e6c0a){return db[_0x26f7('0x40')][_0x26f7('0x47')]({'where':{'id':_0x301250[_0x26f7('0x46')]['id']}})[_0x26f7('0x26')](function(_0x46472b){if(_[_0x26f7('0x60')](_0x46472b)){throw new ReferenceError(_0x26f7('0x61'));}return _0x46472b;})[_0x26f7('0x26')](function(_0x4dceff){var _0x132793=_0x4dceff[_0x26f7('0x4d')];logger[_0x26f7('0x62')]('cancellazione\x20fisica\x20documento\x20%s',_0x132793);if(!_[_0x26f7('0x60')](_0x4dceff[_0x26f7('0x4d')])&&fs[_0x26f7('0x4e')](_0x132793)){logger[_0x26f7('0x62')](_0x26f7('0x63')+_0x132793+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x26f7('0x64')](_0x132793);}_0x132793=_0x132793+_0x26f7('0x65');if(!_[_0x26f7('0x60')](_0x4dceff[_0x26f7('0x4d')])&&fs[_0x26f7('0x4e')](_0x132793)){logger[_0x26f7('0x62')]('File:\x20\x22'+_0x132793+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x132793);}return _0x4dceff;})['then'](function(_0x20881e){if(!_0x20881e)throw new InternalError();return _0x20881e['destroy']();})['then'](function(){_0x2e6c0a[_0x26f7('0x18')](0xcc)['end']();})[_0x26f7('0x45')](handleError(_0x2e6c0a,null));};function getBucketslist(_0x44036a,_0x32ee1b,_0x57fe72){return new Promise(function(_0xcfa03a,_0x2f686c){var _0x136fc9=new AWS['S3']({'accessKeyId':_0x32ee1b,'secretAccessKey':_0x44036a,'region':_0x57fe72});_0x136fc9[_0x26f7('0x66')]({},function(_0x2f1e92,_0x6a9255){if(_0x2f1e92){return _0x2f686c(_0x2f1e92);}else{return _0xcfa03a(_0x6a9255);}});});}function createBucket(_0x5b19fe,_0x3dfdf0,_0x6aa4e0,_0x5dda4e){return new Promise(function(_0x5656b0,_0x1dafa3){var _0x121d24=new AWS['S3']({'accessKeyId':_0x3dfdf0,'secretAccessKey':_0x5b19fe,'region':_0x6aa4e0});_0x121d24[_0x26f7('0x67')]({'Bucket':_0x5dda4e},function(_0x1e9a7f,_0x3650ac){if(_0x1e9a7f){return _0x1dafa3(_0x1e9a7f);}else{return _0x5656b0(_0x3650ac);}});});}function uploadFile(_0x1931a0,_0x15d54c,_0xacf8b3,_0x1a813d,_0x19efb6,_0x2c8238){return new Promise(function(_0x248e41,_0x395c79){var _0x1b5327=new AWS['S3']({'accessKeyId':_0x15d54c,'secretAccessKey':_0x1931a0,'region':_0xacf8b3});_0x1b5327[_0x26f7('0x68')]({'Bucket':_0x1a813d,'Key':_0x19efb6,'Body':_0x2c8238},function(_0x6e2422,_0xecad14){if(_0x6e2422){return _0x395c79(_0x6e2422);}else{return _0x248e41(_0xecad14);}});});}function startTranscribe(_0x290a48,_0x5bdfa7,_0x28e576,_0x558e25,_0x23c610,_0x5d1959){return new Promise(function(_0x1f6af8,_0x6a923){var _0x343eb0=new AWS[(_0x26f7('0x69'))]({'accessKeyId':_0x5bdfa7,'secretAccessKey':_0x290a48,'region':_0x28e576});_0x343eb0[_0x26f7('0x6a')]({'TranscriptionJobName':_0x558e25,'LanguageCode':_0x23c610,'Media':{'MediaFileUri':_0x5d1959}},function(_0xf7dbca,_0x1d8880){if(_0xf7dbca){return _0x6a923(_0xf7dbca);}else{return _0x1f6af8(_0x1d8880);}});});}function transcribe(_0x4948cf,_0x42ec5f,_0x2b6844,_0x3c1a49,_0x3698ff,_0x33bec8,_0x137ce6){return new Promise(function(_0xfa6a79,_0x3674bc){var _0x149c08={};logger[_0x26f7('0x62')](util[_0x26f7('0x30')]('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x4948cf,_0x3698ff));return uploadFile(_0x42ec5f,_0x2b6844,_0x3c1a49,_0x3698ff,path['basename'](_0x33bec8),fs[_0x26f7('0x6b')](_0x33bec8))['then'](function(_0x1e1f30){logger[_0x26f7('0x62')](util[_0x26f7('0x30')](_0x26f7('0x6c'),_0x4948cf,_0x3698ff,_0x1e1f30[_0x26f7('0x6d')]));_0x149c08['bucket']=_0x1e1f30['Bucket'];_0x149c08['location']=_0x1e1f30[_0x26f7('0x6d')];logger[_0x26f7('0x62')](util[_0x26f7('0x30')](_0x26f7('0x6e'),_0x4948cf));return startTranscribe(_0x42ec5f,_0x2b6844,_0x3c1a49,uuidv4(),_0x137ce6,_0x1e1f30[_0x26f7('0x6d')]);})['then'](function(_0x6d28fc){logger['info'](util[_0x26f7('0x30')]('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0x4948cf,_0x6d28fc['TranscriptionJob'][_0x26f7('0x6f')]));_0x149c08[_0x26f7('0x70')]=_0x6d28fc['TranscriptionJob'][_0x26f7('0x6f')];_0x149c08['transcribeStatus']=_0x6d28fc['TranscriptionJob']['TranscriptionJobStatus'];return _0xfa6a79(_0x149c08);})[_0x26f7('0x45')](function(_0x534d1d){return _0x3674bc(_0x534d1d);});});}exports[_0x26f7('0x71')]=function(_0x23e350,_0x7c3966,_0x172e90){var _0x3f7c0c;var _0x2fa5bf;var _0x8bc318;var _0x2d9090=require(_0x26f7('0x72'));return db[_0x26f7('0x40')]['findOne']({'where':{'id':_0x23e350[_0x26f7('0x46')]['id']}})['then'](function(_0x1d6451){if(_0x1d6451){var _0x185846=util[_0x26f7('0x30')](_0x26f7('0x5c'),_0x1d6451[_0x26f7('0x4d')]);if(fs['existsSync'](_0x185846)){cypher=!![];return _0x2d9090[_0x26f7('0x4f')](_0x185846,_0x1d6451[_0x26f7('0x4d')],config[_0x26f7('0x5d')][_0x26f7('0x5e')])[_0x26f7('0x26')](function(){return _0x1d6451;});}return _0x1d6451;}})[_0x26f7('0x26')](function(_0x55994d){if(!_0x55994d){throw new db[(_0x26f7('0x50'))]['ValidationError'](_0x26f7('0x73'));}_0x2fa5bf=_0x55994d;return db[_0x26f7('0x74')][_0x26f7('0x75')]({'where':{'id':0x1}});})[_0x26f7('0x26')](handleEntityNotFound(_0x7c3966,null))['then'](function(_0x30938e){if(_0x30938e){_0x3f7c0c=_0x30938e;if(!_0x3f7c0c['transcribe']||!_0x3f7c0c['transcribeAccountId']||!_0x3f7c0c[_0x26f7('0x76')]||!_0x3f7c0c[_0x26f7('0x77')]||!_0x3f7c0c[_0x26f7('0x78')]){throw new db[(_0x26f7('0x50'))][(_0x26f7('0x5f'))]('Transcribe\x20not\x20configured');}if(_0x23e350[_0x26f7('0x49')][_0x26f7('0x79')]&&(!_0x3f7c0c[_0x26f7('0x7a')]||!_0x3f7c0c[_0x26f7('0x7b')]||!_0x3f7c0c[_0x26f7('0x7c')]||!_0x3f7c0c[_0x26f7('0x77')]||!_0x3f7c0c[_0x26f7('0x78')])){throw new db[(_0x26f7('0x50'))][(_0x26f7('0x5f'))]('Sentiment\x20Analysis\x20not\x20configured');}return db[_0x26f7('0x7d')]['findOne']({'where':{'id':_0x3f7c0c[_0x26f7('0x7e')]}});}})[_0x26f7('0x26')](function(_0x13deac){if(!_0x13deac){throw new db[(_0x26f7('0x50'))][(_0x26f7('0x5f'))](_0x26f7('0x7f'));}if(!_0x13deac['data1']||!_0x13deac[_0x26f7('0x80')]){throw new db[(_0x26f7('0x50'))][(_0x26f7('0x5f'))]('Cloud\x20Provider\x20not\x20configured');}_0x8bc318=_0x13deac;return getBucketslist(_0x8bc318['data1'],_0x8bc318[_0x26f7('0x80')],_0x3f7c0c['transcribeRegion']);})[_0x26f7('0x26')](function(_0x26a2ba){if(_0x26a2ba&&_0x26a2ba[_0x26f7('0x81')]){var _0x2227e6=_[_0x26f7('0x47')](_0x26a2ba[_0x26f7('0x81')],function(_0x1f0058){return _0x1f0058[_0x26f7('0x82')]===_0x3f7c0c[_0x26f7('0x78')];});if(!_0x2227e6){logger['info'](util[_0x26f7('0x30')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x23e350[_0x26f7('0x46')]['id'],_0x3f7c0c[_0x26f7('0x78')]));return createBucket(_0x8bc318['data1'],_0x8bc318[_0x26f7('0x80')],_0x3f7c0c['transcribeRegion'],_0x3f7c0c[_0x26f7('0x78')]);}logger[_0x26f7('0x62')](util[_0x26f7('0x30')](_0x26f7('0x83'),_0x23e350[_0x26f7('0x46')]['id'],_0x3f7c0c[_0x26f7('0x78')]));return;}})[_0x26f7('0x26')](function(_0x39c442){if(_0x2fa5bf['transcribeStatus']===_0x26f7('0x84')){return transcribe(_0x23e350[_0x26f7('0x46')]['id'],_0x8bc318[_0x26f7('0x85')],_0x8bc318[_0x26f7('0x80')],_0x3f7c0c['transcribeRegion'],_0x3f7c0c[_0x26f7('0x78')],_0x2fa5bf[_0x26f7('0x4d')],_0x3f7c0c[_0x26f7('0x77')]);}else{logger[_0x26f7('0x62')](util[_0x26f7('0x30')](_0x26f7('0x86'),_0x23e350[_0x26f7('0x46')]['id']));return{'transcribeStatus':_0x26f7('0x87')};}})[_0x26f7('0x26')](function(_0x428a5b){if(_0x428a5b){_0x428a5b['tempSentiment']=_0x23e350['body']['runSentiment'];return _0x2fa5bf[_0x26f7('0x88')](_0x428a5b);}})[_0x26f7('0x26')](respondWithResult(_0x7c3966,null))[_0x26f7('0x45')](handleError(_0x7c3966,null));};function writeFile(_0x1c45f2,_0x65a0f){return new Promise(function(_0x2c6af6,_0xc7521a){fs[_0x26f7('0x89')](_0x65a0f,_0x1c45f2,function(_0xf761b3,_0x395e82){if(_0xf761b3){return _0xc7521a(_0xf761b3);}else{return _0x2c6af6(_0x395e82);}});});}exports[_0x26f7('0x8a')]=function(_0x25c089,_0x3d1d41,_0x14f507){return db[_0x26f7('0x40')][_0x26f7('0x75')]({'where':{'id':_0x25c089[_0x26f7('0x46')]['id']}})['then'](handleEntityNotFound(_0x3d1d41))['then'](function(_0xaa30b4){if(_0xaa30b4&&_0xaa30b4[_0x26f7('0x8b')]){var _0x1b1882=_0xaa30b4[_0x26f7('0x8b')];var _0x159ec0=config[_0x26f7('0x8c')]+_0x26f7('0x8d')+_0xaa30b4['id']+_0x26f7('0x8e');if(fs['existsSync'](_0x159ec0)){return _0x159ec0;}return writeFile(_0x1b1882,_0x159ec0)[_0x26f7('0x26')](function(){return _0x159ec0;});}else{throw new db['Sequelize'][(_0x26f7('0x5f'))](_0x26f7('0x8f'));}})['then'](function(_0x4ebe4a){return _0x3d1d41['download'](_0x4ebe4a);})[_0x26f7('0x45')](handleError(_0x3d1d41));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 282f152..9ba661d 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 _0x3dd5=['transcribeStatus','./voiceRecording.attributes','define','VoiceRecording','voice_recordings','uniqueid'];(function(_0x33e367,_0x13fa60){var _0x1c74ca=function(_0x862484){while(--_0x862484){_0x33e367['push'](_0x33e367['shift']());}};_0x1c74ca(++_0x13fa60);}(_0x3dd5,0x73));var _0x53dd=function(_0x173dde,_0xbe28b3){_0x173dde=_0x173dde-0x0;var _0x1d774c=_0x3dd5[_0x173dde];return _0x1d774c;};'use strict';var attributes=require(_0x53dd('0x0'));module['exports']=function(_0x46325c,_0x3e9198){return _0x46325c[_0x53dd('0x1')](_0x53dd('0x2'),attributes,{'tableName':_0x53dd('0x3'),'paranoid':![],'indexes':[{'name':_0x53dd('0x4'),'fields':[_0x53dd('0x4')]},{'name':_0x53dd('0x5'),'fields':[_0x53dd('0x5')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6898=['transcribeStatus','./voiceRecording.attributes','define','VoiceRecording','voice_recordings','uniqueid'];(function(_0x3ea913,_0x255df2){var _0x2b4f28=function(_0x48bb25){while(--_0x48bb25){_0x3ea913['push'](_0x3ea913['shift']());}};_0x2b4f28(++_0x255df2);}(_0x6898,0x11b));var _0x8689=function(_0x9f057f,_0x925030){_0x9f057f=_0x9f057f-0x0;var _0x524d08=_0x6898[_0x9f057f];return _0x524d08;};'use strict';var attributes=require(_0x8689('0x0'));module['exports']=function(_0x3b6c93,_0x15c5c2){return _0x3b6c93[_0x8689('0x1')](_0x8689('0x2'),attributes,{'tableName':_0x8689('0x3'),'paranoid':![],'indexes':[{'name':_0x8689('0x4'),'fields':[_0x8689('0x4')]},{'name':'transcribeStatus','fields':[_0x8689('0x5')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 69f3869..f6dea5a 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 _0x958a=['unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','then','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateVoiceRecording','VoiceRecording','update','body','options','raw','where','CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','create','existsSync','value','format','%s.cypher'];(function(_0x57cfd2,_0x189c1d){var _0x53c5ab=function(_0x5242d3){while(--_0x5242d3){_0x57cfd2['push'](_0x57cfd2['shift']());}};_0x53c5ab(++_0x189c1d);}(_0x958a,0x128));var _0xa958=function(_0x395f4f,_0x2ac8b2){_0x395f4f=_0x395f4f-0x0;var _0x4d0de3=_0x958a[_0x395f4f];return _0x4d0de3;};'use strict';var _=require(_0xa958('0x0'));var util=require(_0xa958('0x1'));var moment=require('moment');var BPromise=require(_0xa958('0x2'));var rs=require(_0xa958('0x3'));var fs=require('fs');var Redis=require(_0xa958('0x4'));var db=require(_0xa958('0x5'))['db'];var utils=require(_0xa958('0x6'));var logger=require('../../config/logger')(_0xa958('0x7'));var config=require('../../config/environment');var jayson=require(_0xa958('0x8'));var client=jayson[_0xa958('0x9')][_0xa958('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3ddaa9,_0x3ca01f,_0x3b2693){return new BPromise(function(_0x1895da,_0x54c0e0){return client['request'](_0x3ddaa9,_0x3b2693)[_0xa958('0xb')](function(_0x249764){logger[_0xa958('0xc')](_0xa958('0xd'),_0x3ca01f,_0xa958('0xe'));logger[_0xa958('0xf')](_0xa958('0x10'),_0x3ca01f,_0xa958('0xe'),JSON[_0xa958('0x11')](_0x249764));if(_0x249764[_0xa958('0x12')]){if(_0x249764[_0xa958('0x12')][_0xa958('0x13')]===0x1f4){logger[_0xa958('0x12')]('VoiceRecording,\x20%s,\x20%s',_0x3ca01f,_0x249764['error']['message']);return _0x54c0e0(_0x249764[_0xa958('0x12')][_0xa958('0x14')]);}logger[_0xa958('0x12')]('VoiceRecording,\x20%s,\x20%s',_0x3ca01f,_0x249764[_0xa958('0x12')]['message']);return _0x1895da(_0x249764['error']['message']);}else{logger[_0xa958('0xc')](_0xa958('0xd'),_0x3ca01f,_0xa958('0xe'));_0x1895da(_0x249764[_0xa958('0x15')][_0xa958('0x14')]);}})[_0xa958('0x16')](function(_0x23736f){logger[_0xa958('0x12')]('VoiceRecording,\x20%s,\x20%s',_0x3ca01f,_0x23736f);_0x54c0e0(_0x23736f);});});}exports[_0xa958('0x17')]=function(_0x4eadc9){var _0x3a053f=this;return new Promise(function(_0x70d13e,_0x52a184){return db[_0xa958('0x18')][_0xa958('0x19')](_0x4eadc9[_0xa958('0x1a')],{'raw':_0x4eadc9[_0xa958('0x1b')]?_0x4eadc9[_0xa958('0x1b')][_0xa958('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4eadc9['options']?_0x4eadc9['options'][_0xa958('0x1d')]||null:null,'attributes':_0x4eadc9[_0xa958('0x1b')]?_0x4eadc9[_0xa958('0x1b')]['attributes']||null:null,'limit':_0x4eadc9[_0xa958('0x1b')]?_0x4eadc9[_0xa958('0x1b')]['limit']||null:null})[_0xa958('0xb')](function(_0x401175){logger['info']('UpdateVoiceRecording',_0x4eadc9);logger[_0xa958('0xf')](_0xa958('0x17'),_0x4eadc9,JSON['stringify'](_0x401175));_0x70d13e(_0x401175);})[_0xa958('0x16')](function(_0x27097a){logger[_0xa958('0x12')](_0xa958('0x17'),_0x27097a[_0xa958('0x14')],_0x4eadc9);_0x52a184(_0x3a053f[_0xa958('0x12')](0x1f4,_0x27097a['message']));});});};exports[_0xa958('0x1e')]=function(_0x48ef34){var _0x43df63=this;return new Promise(function(_0x3c2ea3,_0x32ea36){var _0x18f600=require(_0xa958('0x1f'));var _0xddc7f6;return db[_0xa958('0x20')][_0xa958('0x21')]({'attributes':['id',_0xa958('0x22')],'where':{'id':0x1},'raw':!![]})[_0xa958('0xb')](function(_0x4c4c37){_0xddc7f6=_0x4c4c37;return db['VoiceRecording'][_0xa958('0x23')](_0x48ef34['body']);})[_0xa958('0xb')](function(_0x1b76de){if(_0xddc7f6['callRecordingEncryption']&&fs[_0xa958('0x24')](_0x1b76de[_0xa958('0x25')])){var _0x179bc2=util[_0xa958('0x26')](_0xa958('0x27'),_0x1b76de['value']);return _0x18f600['encryptFile'](_0x1b76de[_0xa958('0x25')],_0x179bc2,config['secrets']['recording'])[_0xa958('0xb')](function(){fs[_0xa958('0x28')](_0x1b76de[_0xa958('0x25')]);logger[_0xa958('0xc')](_0xa958('0x29'));return _0x1b76de;});}return _0x1b76de;})[_0xa958('0xb')](function(_0x516a2f){logger[_0xa958('0xc')]('CreateVoiceRecording',_0x48ef34);logger['debug'](_0xa958('0x1e'),_0x48ef34,JSON[_0xa958('0x11')](_0x516a2f));_0x3c2ea3(_0x516a2f);})[_0xa958('0x16')](function(_0x1cc55d){logger[_0xa958('0x12')](_0xa958('0x1e'),_0x1cc55d[_0xa958('0x14')],_0x48ef34);_0x32ea36(_0x43df63[_0xa958('0x12')](0x1f4,_0x1cc55d['message']));});});}; \ No newline at end of file +var _0xd4a2=['client','http','request','then','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','error','code','message','UpdateVoiceRecording','update','body','options','raw','attributes','limit','stringify','catch','CreateVoiceRecording','../../components/encryptor','Setting','findOne','VoiceRecording','create','callRecordingEncryption','existsSync','value','format','%s.cypher','encryptFile','recording','unlink','lodash','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x4287fe,_0x14ad49){var _0x329a39=function(_0x3c30a9){while(--_0x3c30a9){_0x4287fe['push'](_0x4287fe['shift']());}};_0x329a39(++_0x14ad49);}(_0xd4a2,0x173));var _0x2d4a=function(_0x322152,_0xd4dbfc){_0x322152=_0x322152-0x0;var _0x2d0c55=_0xd4a2[_0x322152];return _0x2d0c55;};'use strict';var _=require(_0x2d4a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x2d4a('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2d4a('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x2d4a('0x3'));var logger=require('../../config/logger')(_0x2d4a('0x4'));var config=require(_0x2d4a('0x5'));var jayson=require(_0x2d4a('0x6'));var client=jayson[_0x2d4a('0x7')][_0x2d4a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x57058f,_0x45fefb,_0x41b161){return new BPromise(function(_0x1f237e,_0x29597e){return client[_0x2d4a('0x9')](_0x57058f,_0x41b161)[_0x2d4a('0xa')](function(_0xb9f016){logger[_0x2d4a('0xb')](_0x2d4a('0xc'),_0x45fefb,_0x2d4a('0xd'));logger[_0x2d4a('0xe')](_0x2d4a('0xf'),_0x45fefb,'request\x20sent',JSON['stringify'](_0xb9f016));if(_0xb9f016[_0x2d4a('0x10')]){if(_0xb9f016['error'][_0x2d4a('0x11')]===0x1f4){logger[_0x2d4a('0x10')](_0x2d4a('0xc'),_0x45fefb,_0xb9f016[_0x2d4a('0x10')][_0x2d4a('0x12')]);return _0x29597e(_0xb9f016[_0x2d4a('0x10')][_0x2d4a('0x12')]);}logger[_0x2d4a('0x10')]('VoiceRecording,\x20%s,\x20%s',_0x45fefb,_0xb9f016['error'][_0x2d4a('0x12')]);return _0x1f237e(_0xb9f016['error'][_0x2d4a('0x12')]);}else{logger[_0x2d4a('0xb')](_0x2d4a('0xc'),_0x45fefb,_0x2d4a('0xd'));_0x1f237e(_0xb9f016['result'][_0x2d4a('0x12')]);}})['catch'](function(_0x2838fa){logger['error'](_0x2d4a('0xc'),_0x45fefb,_0x2838fa);_0x29597e(_0x2838fa);});});}exports[_0x2d4a('0x13')]=function(_0x2188b2){var _0x388371=this;return new Promise(function(_0x498956,_0x4fd169){return db['VoiceRecording'][_0x2d4a('0x14')](_0x2188b2[_0x2d4a('0x15')],{'raw':_0x2188b2[_0x2d4a('0x16')]?_0x2188b2[_0x2d4a('0x16')][_0x2d4a('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2188b2[_0x2d4a('0x16')]?_0x2188b2['options']['where']||null:null,'attributes':_0x2188b2[_0x2d4a('0x16')]?_0x2188b2[_0x2d4a('0x16')][_0x2d4a('0x18')]||null:null,'limit':_0x2188b2[_0x2d4a('0x16')]?_0x2188b2[_0x2d4a('0x16')][_0x2d4a('0x19')]||null:null})[_0x2d4a('0xa')](function(_0xa43fb1){logger['info'](_0x2d4a('0x13'),_0x2188b2);logger[_0x2d4a('0xe')](_0x2d4a('0x13'),_0x2188b2,JSON[_0x2d4a('0x1a')](_0xa43fb1));_0x498956(_0xa43fb1);})[_0x2d4a('0x1b')](function(_0xed2822){logger[_0x2d4a('0x10')](_0x2d4a('0x13'),_0xed2822['message'],_0x2188b2);_0x4fd169(_0x388371['error'](0x1f4,_0xed2822['message']));});});};exports[_0x2d4a('0x1c')]=function(_0x5029f3){var _0x410f7d=this;return new Promise(function(_0x3a2fd3,_0x3d5558){var _0x1d2fa6=require(_0x2d4a('0x1d'));var _0x326c38;return db[_0x2d4a('0x1e')][_0x2d4a('0x1f')]({'attributes':['id','callRecordingEncryption'],'where':{'id':0x1},'raw':!![]})[_0x2d4a('0xa')](function(_0x5ce262){_0x326c38=_0x5ce262;return db[_0x2d4a('0x20')][_0x2d4a('0x21')](_0x5029f3[_0x2d4a('0x15')]);})[_0x2d4a('0xa')](function(_0x101382){if(_0x326c38[_0x2d4a('0x22')]&&fs[_0x2d4a('0x23')](_0x101382[_0x2d4a('0x24')])){var _0x51b447=util[_0x2d4a('0x25')](_0x2d4a('0x26'),_0x101382[_0x2d4a('0x24')]);return _0x1d2fa6[_0x2d4a('0x27')](_0x101382[_0x2d4a('0x24')],_0x51b447,config['secrets'][_0x2d4a('0x28')])[_0x2d4a('0xa')](function(){fs[_0x2d4a('0x29')](_0x101382[_0x2d4a('0x24')]);logger[_0x2d4a('0xb')]('CreateVoiceRecording\x20file\x20encrypted');return _0x101382;});}return _0x101382;})[_0x2d4a('0xa')](function(_0x2ae694){logger[_0x2d4a('0xb')](_0x2d4a('0x1c'),_0x5029f3);logger[_0x2d4a('0xe')](_0x2d4a('0x1c'),_0x5029f3,JSON['stringify'](_0x2ae694));_0x3a2fd3(_0x2ae694);})[_0x2d4a('0x1b')](function(_0x28955f){logger[_0x2d4a('0x10')](_0x2d4a('0x1c'),_0x28955f[_0x2d4a('0x12')],_0x5029f3);_0x3d5558(_0x410f7d['error'](0x1f4,_0x28955f[_0x2d4a('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 1a8e48f..e675e8d 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 _0x956f=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','post','create','put','update','destroy','multer','util','Router','fs-extra'];(function(_0x19bb73,_0x16ab95){var _0xf90836=function(_0xa1a066){while(--_0xa1a066){_0x19bb73['push'](_0x19bb73['shift']());}};_0xf90836(++_0x16ab95);}(_0x956f,0x1be));var _0xf956=function(_0x31ad84,_0x3a1364){_0x31ad84=_0x31ad84-0x0;var _0x2ab374=_0x956f[_0x31ad84];return _0x2ab374;};'use strict';var multer=require(_0xf956('0x0'));var util=require(_0xf956('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf956('0x2')]();var fs_extra=require(_0xf956('0x3'));var auth=require(_0xf956('0x4'));var interaction=require(_0xf956('0x5'));var config=require(_0xf956('0x6'));var controller=require('./voiceTransferReport.controller');router[_0xf956('0x7')]('/',auth[_0xf956('0x8')](),controller['index']);router[_0xf956('0x7')](_0xf956('0x9'),auth[_0xf956('0x8')](),controller[_0xf956('0xa')]);router['get'](_0xf956('0xb'),auth[_0xf956('0x8')](),controller[_0xf956('0xc')]);router[_0xf956('0xd')]('/',auth['isAuthenticated'](),controller[_0xf956('0xe')]);router[_0xf956('0xf')](_0xf956('0xb'),auth[_0xf956('0x8')](),controller[_0xf956('0x10')]);router['delete']('/:id',auth[_0xf956('0x8')](),controller[_0xf956('0x11')]);module['exports']=router; \ No newline at end of file +var _0x17cb=['express','Router','fs-extra','../../components/interaction/service','./voiceTransferReport.controller','get','index','/describe','isAuthenticated','post','create','put','/:id','update','delete','destroy','exports','util','path','connect-timeout'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x17cb,0x1f1));var _0xb17c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x17cb[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0xb17c('0x0'));var path=require(_0xb17c('0x1'));var timeout=require(_0xb17c('0x2'));var express=require(_0xb17c('0x3'));var router=express[_0xb17c('0x4')]();var fs_extra=require(_0xb17c('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xb17c('0x6'));var config=require('../../config/environment');var controller=require(_0xb17c('0x7'));router[_0xb17c('0x8')]('/',auth['isAuthenticated'](),controller[_0xb17c('0x9')]);router['get'](_0xb17c('0xa'),auth[_0xb17c('0xb')](),controller['describe']);router[_0xb17c('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xb17c('0xc')]('/',auth['isAuthenticated'](),controller[_0xb17c('0xd')]);router[_0xb17c('0xe')](_0xb17c('0xf'),auth['isAuthenticated'](),controller[_0xb17c('0x10')]);router[_0xb17c('0x11')](_0xb17c('0xf'),auth[_0xb17c('0xb')](),controller[_0xb17c('0x12')]);module[_0xb17c('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index bcad167..7939323 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 _0x6b6d=['ENUM','moment','exports','blind','attended','STRING'];(function(_0x4a4922,_0x82cb8f){var _0x55a8c6=function(_0x59712e){while(--_0x59712e){_0x4a4922['push'](_0x4a4922['shift']());}};_0x55a8c6(++_0x82cb8f);}(_0x6b6d,0xe5));var _0xd6b6=function(_0x597484,_0x199340){_0x597484=_0x597484-0x0;var _0x218e64=_0x6b6d[_0x597484];return _0x218e64;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xd6b6('0x0'));module[_0xd6b6('0x1')]={'type':{'type':Sequelize['ENUM'](_0xd6b6('0x2'),_0xd6b6('0x3'))},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize[_0xd6b6('0x4')]},'transferercalleridnum':{'type':Sequelize[_0xd6b6('0x4')]},'transferercalleridname':{'type':Sequelize[_0xd6b6('0x4')]},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize['STRING']},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize[_0xd6b6('0x4')]},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize[_0xd6b6('0x4')]},'transfereecalleridname':{'type':Sequelize[_0xd6b6('0x4')]},'transfereeconnectedlinenum':{'type':Sequelize[_0xd6b6('0x4')]},'transfereeconnectedlinename':{'type':Sequelize[_0xd6b6('0x4')]},'transfereeaccountcode':{'type':Sequelize[_0xd6b6('0x4')]},'transfereecontext':{'type':Sequelize[_0xd6b6('0x4')]},'transfereeexten':{'type':Sequelize[_0xd6b6('0x4')]},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize[_0xd6b6('0x5')]('Yes','No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0xd6b6('0x4')]}}; \ No newline at end of file +var _0xa018=['blind','STRING','sequelize','moment','ENUM'];(function(_0x2ec4c8,_0x188a13){var _0x27f1f5=function(_0xc922fd){while(--_0xc922fd){_0x2ec4c8['push'](_0x2ec4c8['shift']());}};_0x27f1f5(++_0x188a13);}(_0xa018,0xf2));var _0x8a01=function(_0x5a3205,_0x4079ae){_0x5a3205=_0x5a3205-0x0;var _0x46ad1c=_0xa018[_0x5a3205];return _0x46ad1c;};'use strict';var Sequelize=require(_0x8a01('0x0'));var moment=require(_0x8a01('0x1'));module['exports']={'type':{'type':Sequelize[_0x8a01('0x2')](_0x8a01('0x3'),'attended')},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize[_0x8a01('0x4')]},'transferercalleridnum':{'type':Sequelize[_0x8a01('0x4')]},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize[_0x8a01('0x4')]},'transfererconnectedlinename':{'type':Sequelize[_0x8a01('0x4')]},'transfereraccountcode':{'type':Sequelize[_0x8a01('0x4')]},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize[_0x8a01('0x4')]},'transfererlinkedid':{'type':Sequelize[_0x8a01('0x4')]},'transfereechannel':{'type':Sequelize[_0x8a01('0x4')]},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize[_0x8a01('0x4')]},'transfereeconnectedlinename':{'type':Sequelize[_0x8a01('0x4')]},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize[_0x8a01('0x4')]},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize[_0x8a01('0x4')]},'isexternal':{'type':Sequelize[_0x8a01('0x2')]('Yes','No')},'context':{'type':Sequelize[_0x8a01('0x4')]},'extension':{'type':Sequelize[_0x8a01('0x4')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index fa57e3b..58913db 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 _0x7b47=['rawAttributes','fieldName','key','query','keys','intersection','attributes','fields','model','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','length','find','catch','create','body','params','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','destroy','stack','name','index','map','VoiceTransferReport'];(function(_0x1c2c86,_0x2bbc0c){var _0x263396=function(_0x153170){while(--_0x153170){_0x1c2c86['push'](_0x1c2c86['shift']());}};_0x263396(++_0x2bbc0c);}(_0x7b47,0x1e9));var _0x77b4=function(_0x45ebbe,_0x2a3a32){_0x45ebbe=_0x45ebbe-0x0;var _0x5a869b=_0x7b47[_0x45ebbe];return _0x5a869b;};'use strict';var emlformat=require(_0x77b4('0x0'));var rimraf=require(_0x77b4('0x1'));var zipdir=require(_0x77b4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x77b4('0x3'));var moment=require(_0x77b4('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x77b4('0x5'));var util=require(_0x77b4('0x6'));var path=require('path');var sox=require(_0x77b4('0x7'));var csv=require(_0x77b4('0x8'));var ejs=require(_0x77b4('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x77b4('0xa'));var squel=require(_0x77b4('0xb'));var crypto=require(_0x77b4('0xc'));var jsforce=require(_0x77b4('0xd'));var deskjs=require(_0x77b4('0xe'));var toCsv=require('to-csv');var querystring=require(_0x77b4('0xf'));var Papa=require('papaparse');var Redis=require(_0x77b4('0x10'));var authService=require(_0x77b4('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x77b4('0x12'));var hardwareService=require(_0x77b4('0x13'));var logger=require(_0x77b4('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x77b4('0x15'));var db=require(_0x77b4('0x16'))['db'];function respondWithStatusCode(_0x50cec7,_0x46b764){_0x46b764=_0x46b764||0xcc;return function(_0xa8969c){if(_0xa8969c){return _0x50cec7[_0x77b4('0x17')](_0x46b764);}return _0x50cec7[_0x77b4('0x18')](_0x46b764)[_0x77b4('0x19')]();};}function respondWithResult(_0x372c1a,_0x120b15){_0x120b15=_0x120b15||0xc8;return function(_0x246dcb){if(_0x246dcb){return _0x372c1a[_0x77b4('0x18')](_0x120b15)['json'](_0x246dcb);}};}function respondWithFilteredResult(_0x535d0a,_0x53f878){return function(_0x3919da){if(_0x3919da){var _0x513394=typeof _0x53f878[_0x77b4('0x1a')]===_0x77b4('0x1b')&&typeof _0x53f878[_0x77b4('0x1c')]===_0x77b4('0x1b');var _0x6efcdc=_0x3919da[_0x77b4('0x1d')];var _0x5b665a=_0x513394?0x0:_0x53f878[_0x77b4('0x1a')];var _0x31230a=_0x513394?_0x3919da[_0x77b4('0x1d')]:_0x53f878[_0x77b4('0x1a')]+_0x53f878[_0x77b4('0x1c')];var _0x43087d;if(_0x31230a>=_0x6efcdc){_0x31230a=_0x6efcdc;_0x43087d=0xc8;}else{_0x43087d=0xce;}_0x535d0a[_0x77b4('0x18')](_0x43087d);return _0x535d0a[_0x77b4('0x1e')](_0x77b4('0x1f'),_0x5b665a+'-'+_0x31230a+'/'+_0x6efcdc)[_0x77b4('0x20')](_0x3919da);}return null;};}function patchUpdates(_0x206f69){return function(_0x4b7533){try{jsonpatch[_0x77b4('0x21')](_0x4b7533,_0x206f69,!![]);}catch(_0x10bf7f){return BPromise['reject'](_0x10bf7f);}return _0x4b7533[_0x77b4('0x22')]();};}function saveUpdates(_0x65ed1c,_0x3d8005){return function(_0xa339d5){if(_0xa339d5){return _0xa339d5[_0x77b4('0x23')](_0x65ed1c)[_0x77b4('0x24')](function(_0x31bf66){return _0x31bf66;});}return null;};}function removeEntity(_0x1fbc84,_0x45338d){return function(_0x2da2b3){if(_0x2da2b3){return _0x2da2b3[_0x77b4('0x25')]()[_0x77b4('0x24')](function(){_0x1fbc84[_0x77b4('0x18')](0xcc)[_0x77b4('0x19')]();});}};}function handleEntityNotFound(_0x50731a,_0x2485bd){return function(_0x353f2a){if(!_0x353f2a){_0x50731a[_0x77b4('0x17')](0x194);}return _0x353f2a;};}function handleError(_0x49116a,_0x552be0){_0x552be0=_0x552be0||0x1f4;return function(_0x38102e){logger['error'](_0x38102e[_0x77b4('0x26')]);if(_0x38102e[_0x77b4('0x27')]){delete _0x38102e[_0x77b4('0x27')];}_0x49116a[_0x77b4('0x18')](_0x552be0)['send'](_0x38102e);};}exports[_0x77b4('0x28')]=function(_0x3f0b76,_0x231658){var _0xe6ce3c={},_0x24f6eb={},_0x98619e={'count':0x0,'rows':[]};var _0x3be0f5=_[_0x77b4('0x29')](db[_0x77b4('0x2a')][_0x77b4('0x2b')],function(_0x25aba8){return{'name':_0x25aba8[_0x77b4('0x2c')],'type':_0x25aba8['type'][_0x77b4('0x2d')]};});_0x24f6eb['model']=_[_0x77b4('0x29')](_0x3be0f5,'name');_0x24f6eb[_0x77b4('0x2e')]=_[_0x77b4('0x2f')](_0x3f0b76[_0x77b4('0x2e')]);_0x24f6eb['filters']=_[_0x77b4('0x30')](_0x24f6eb['model'],_0x24f6eb[_0x77b4('0x2e')]);_0xe6ce3c[_0x77b4('0x31')]=_[_0x77b4('0x30')](_0x24f6eb['model'],qs[_0x77b4('0x32')](_0x3f0b76['query']['fields']));_0xe6ce3c['attributes']=_0xe6ce3c[_0x77b4('0x31')]['length']?_0xe6ce3c[_0x77b4('0x31')]:_0x24f6eb[_0x77b4('0x33')];if(!_0x3f0b76[_0x77b4('0x2e')][_0x77b4('0x34')](_0x77b4('0x35'))){_0xe6ce3c[_0x77b4('0x1c')]=qs['limit'](_0x3f0b76[_0x77b4('0x2e')][_0x77b4('0x1c')]);_0xe6ce3c[_0x77b4('0x1a')]=qs[_0x77b4('0x1a')](_0x3f0b76['query'][_0x77b4('0x1a')]);}_0xe6ce3c[_0x77b4('0x36')]=qs['sort'](_0x3f0b76[_0x77b4('0x2e')][_0x77b4('0x37')]);_0xe6ce3c[_0x77b4('0x38')]=qs[_0x77b4('0x39')](_[_0x77b4('0x3a')](_0x3f0b76[_0x77b4('0x2e')],_0x24f6eb[_0x77b4('0x39')]),_0x3be0f5);if(_0x3f0b76[_0x77b4('0x2e')]['filter']){_0xe6ce3c[_0x77b4('0x38')]=_[_0x77b4('0x3b')](_0xe6ce3c['where'],{'$or':_['map'](_0x3be0f5,function(_0x15bf08){if(_0x15bf08[_0x77b4('0x3c')]!==_0x77b4('0x3d')){var _0x24774f={};_0x24774f[_0x15bf08['name']]={'$like':'%'+_0x3f0b76[_0x77b4('0x2e')][_0x77b4('0x3e')]+'%'};return _0x24774f;}})});}_0xe6ce3c=_[_0x77b4('0x3b')]({},_0xe6ce3c,_0x3f0b76[_0x77b4('0x3f')]);var _0x41b081={'where':_0xe6ce3c[_0x77b4('0x38')]};return db[_0x77b4('0x2a')][_0x77b4('0x1d')](_0x41b081)[_0x77b4('0x24')](function(_0x58a85c){_0x98619e['count']=_0x58a85c;if(_0x3f0b76[_0x77b4('0x2e')][_0x77b4('0x40')]){_0xe6ce3c[_0x77b4('0x41')]=[{'all':!![]}];}return db[_0x77b4('0x2a')][_0x77b4('0x42')](_0xe6ce3c);})[_0x77b4('0x24')](function(_0x22a118){_0x98619e[_0x77b4('0x43')]=_0x22a118;return _0x98619e;})[_0x77b4('0x24')](respondWithFilteredResult(_0x231658,_0xe6ce3c))['catch'](handleError(_0x231658,null));};exports[_0x77b4('0x44')]=function(_0x5df0d6,_0x4c48d3){var _0x82caca={'raw':!![],'where':{'id':_0x5df0d6['params']['id']}},_0x4ed5ce={};_0x4ed5ce[_0x77b4('0x33')]=_[_0x77b4('0x2f')](db['VoiceTransferReport'][_0x77b4('0x2b')]);_0x4ed5ce[_0x77b4('0x2e')]=_[_0x77b4('0x2f')](_0x5df0d6['query']);_0x4ed5ce['filters']=_[_0x77b4('0x30')](_0x4ed5ce['model'],_0x4ed5ce[_0x77b4('0x2e')]);_0x82caca[_0x77b4('0x31')]=_[_0x77b4('0x30')](_0x4ed5ce[_0x77b4('0x33')],qs['fields'](_0x5df0d6['query'][_0x77b4('0x32')]));_0x82caca['attributes']=_0x82caca[_0x77b4('0x31')][_0x77b4('0x45')]?_0x82caca[_0x77b4('0x31')]:_0x4ed5ce[_0x77b4('0x33')];if(_0x5df0d6[_0x77b4('0x2e')][_0x77b4('0x40')]){_0x82caca[_0x77b4('0x41')]=[{'all':!![]}];}_0x82caca=_[_0x77b4('0x3b')]({},_0x82caca,_0x5df0d6[_0x77b4('0x3f')]);return db[_0x77b4('0x2a')][_0x77b4('0x46')](_0x82caca)[_0x77b4('0x24')](handleEntityNotFound(_0x4c48d3,null))[_0x77b4('0x24')](respondWithResult(_0x4c48d3,null))[_0x77b4('0x47')](handleError(_0x4c48d3,null));};exports[_0x77b4('0x48')]=function(_0x52706f,_0x12f2aa){return db['VoiceTransferReport'][_0x77b4('0x48')](_0x52706f[_0x77b4('0x49')],{})['then'](respondWithResult(_0x12f2aa,0xc9))['catch'](handleError(_0x12f2aa,null));};exports[_0x77b4('0x23')]=function(_0x25b67a,_0x12119f){if(_0x25b67a[_0x77b4('0x49')]['id']){delete _0x25b67a[_0x77b4('0x49')]['id'];}return db[_0x77b4('0x2a')]['find']({'where':{'id':_0x25b67a[_0x77b4('0x4a')]['id']}})[_0x77b4('0x24')](handleEntityNotFound(_0x12119f,null))[_0x77b4('0x24')](saveUpdates(_0x25b67a['body'],null))[_0x77b4('0x24')](respondWithResult(_0x12119f,null))[_0x77b4('0x47')](handleError(_0x12119f,null));};exports[_0x77b4('0x25')]=function(_0x269a20,_0x1e46e4){return db[_0x77b4('0x2a')][_0x77b4('0x46')]({'where':{'id':_0x269a20[_0x77b4('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1e46e4,null))['then'](removeEntity(_0x1e46e4,null))[_0x77b4('0x47')](handleError(_0x1e46e4,null));};exports[_0x77b4('0x4b')]=function(_0x2f18ed,_0x3eb35f){return db[_0x77b4('0x2a')][_0x77b4('0x4b')]()[_0x77b4('0x24')](respondWithResult(_0x3eb35f,null))['catch'](handleError(_0x3eb35f,null));}; \ No newline at end of file +var _0xad45=['options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','index','map','VoiceTransferReport','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','where','merge','type','filter'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xad45,0xa9));var _0x5ad4=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xad45[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x5ad4('0x0'));var rimraf=require(_0x5ad4('0x1'));var zipdir=require(_0x5ad4('0x2'));var jsonpatch=require(_0x5ad4('0x3'));var rp=require(_0x5ad4('0x4'));var moment=require(_0x5ad4('0x5'));var BPromise=require(_0x5ad4('0x6'));var Mustache=require(_0x5ad4('0x7'));var util=require(_0x5ad4('0x8'));var path=require('path');var sox=require(_0x5ad4('0x9'));var csv=require('to-csv');var ejs=require(_0x5ad4('0xa'));var fs=require('fs');var fs_extra=require(_0x5ad4('0xb'));var _=require('lodash');var squel=require(_0x5ad4('0xc'));var crypto=require(_0x5ad4('0xd'));var jsforce=require(_0x5ad4('0xe'));var deskjs=require(_0x5ad4('0xf'));var toCsv=require(_0x5ad4('0x10'));var querystring=require('querystring');var Papa=require(_0x5ad4('0x11'));var Redis=require(_0x5ad4('0x12'));var authService=require(_0x5ad4('0x13'));var qs=require(_0x5ad4('0x14'));var as=require(_0x5ad4('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5ad4('0x16'))(_0x5ad4('0x17'));var utils=require(_0x5ad4('0x18'));var config=require(_0x5ad4('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2b8d9a,_0x360806){_0x360806=_0x360806||0xcc;return function(_0x164bc8){if(_0x164bc8){return _0x2b8d9a[_0x5ad4('0x1a')](_0x360806);}return _0x2b8d9a[_0x5ad4('0x1b')](_0x360806)[_0x5ad4('0x1c')]();};}function respondWithResult(_0x30d500,_0x1c09d6){_0x1c09d6=_0x1c09d6||0xc8;return function(_0x312028){if(_0x312028){return _0x30d500[_0x5ad4('0x1b')](_0x1c09d6)[_0x5ad4('0x1d')](_0x312028);}};}function respondWithFilteredResult(_0x51ae20,_0x1f6ecb){return function(_0x51f8fc){if(_0x51f8fc){var _0x524626=typeof _0x1f6ecb[_0x5ad4('0x1e')]==='undefined'&&typeof _0x1f6ecb[_0x5ad4('0x1f')]===_0x5ad4('0x20');var _0x2b6cce=_0x51f8fc[_0x5ad4('0x21')];var _0x556f10=_0x524626?0x0:_0x1f6ecb[_0x5ad4('0x1e')];var _0x2be514=_0x524626?_0x51f8fc[_0x5ad4('0x21')]:_0x1f6ecb['offset']+_0x1f6ecb[_0x5ad4('0x1f')];var _0x5c29ab;if(_0x2be514>=_0x2b6cce){_0x2be514=_0x2b6cce;_0x5c29ab=0xc8;}else{_0x5c29ab=0xce;}_0x51ae20[_0x5ad4('0x1b')](_0x5c29ab);return _0x51ae20[_0x5ad4('0x22')](_0x5ad4('0x23'),_0x556f10+'-'+_0x2be514+'/'+_0x2b6cce)[_0x5ad4('0x1d')](_0x51f8fc);}return null;};}function patchUpdates(_0x44eb08){return function(_0x702915){try{jsonpatch[_0x5ad4('0x24')](_0x702915,_0x44eb08,!![]);}catch(_0x596f6b){return BPromise[_0x5ad4('0x25')](_0x596f6b);}return _0x702915[_0x5ad4('0x26')]();};}function saveUpdates(_0x1e454f,_0x215880){return function(_0x1ee4cc){if(_0x1ee4cc){return _0x1ee4cc[_0x5ad4('0x27')](_0x1e454f)['then'](function(_0x49c6a3){return _0x49c6a3;});}return null;};}function removeEntity(_0x2e7e77,_0x4f140a){return function(_0x28e7ba){if(_0x28e7ba){return _0x28e7ba[_0x5ad4('0x28')]()[_0x5ad4('0x29')](function(){_0x2e7e77['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x281e45,_0x55889c){return function(_0x2d8141){if(!_0x2d8141){_0x281e45['sendStatus'](0x194);}return _0x2d8141;};}function handleError(_0x2cad0c,_0x849bfd){_0x849bfd=_0x849bfd||0x1f4;return function(_0x3ecfda){logger[_0x5ad4('0x2a')](_0x3ecfda[_0x5ad4('0x2b')]);if(_0x3ecfda[_0x5ad4('0x2c')]){delete _0x3ecfda['name'];}_0x2cad0c[_0x5ad4('0x1b')](_0x849bfd)['send'](_0x3ecfda);};}exports[_0x5ad4('0x2d')]=function(_0x8a4c50,_0x3985d0){var _0x4e73e1={},_0x1afb84={},_0x3b0877={'count':0x0,'rows':[]};var _0x4cbc6e=_[_0x5ad4('0x2e')](db[_0x5ad4('0x2f')]['rawAttributes'],function(_0x555c38){return{'name':_0x555c38['fieldName'],'type':_0x555c38['type'][_0x5ad4('0x30')]};});_0x1afb84[_0x5ad4('0x31')]=_[_0x5ad4('0x2e')](_0x4cbc6e,'name');_0x1afb84[_0x5ad4('0x32')]=_[_0x5ad4('0x33')](_0x8a4c50[_0x5ad4('0x32')]);_0x1afb84[_0x5ad4('0x34')]=_[_0x5ad4('0x35')](_0x1afb84[_0x5ad4('0x31')],_0x1afb84['query']);_0x4e73e1['attributes']=_[_0x5ad4('0x35')](_0x1afb84[_0x5ad4('0x31')],qs[_0x5ad4('0x36')](_0x8a4c50[_0x5ad4('0x32')][_0x5ad4('0x36')]));_0x4e73e1['attributes']=_0x4e73e1[_0x5ad4('0x37')]['length']?_0x4e73e1['attributes']:_0x1afb84[_0x5ad4('0x31')];if(!_0x8a4c50['query'][_0x5ad4('0x38')](_0x5ad4('0x39'))){_0x4e73e1[_0x5ad4('0x1f')]=qs[_0x5ad4('0x1f')](_0x8a4c50['query'][_0x5ad4('0x1f')]);_0x4e73e1[_0x5ad4('0x1e')]=qs[_0x5ad4('0x1e')](_0x8a4c50[_0x5ad4('0x32')][_0x5ad4('0x1e')]);}_0x4e73e1[_0x5ad4('0x3a')]=qs['sort'](_0x8a4c50[_0x5ad4('0x32')][_0x5ad4('0x3b')]);_0x4e73e1['where']=qs['filters'](_[_0x5ad4('0x3c')](_0x8a4c50['query'],_0x1afb84['filters']),_0x4cbc6e);if(_0x8a4c50['query']['filter']){_0x4e73e1[_0x5ad4('0x3d')]=_[_0x5ad4('0x3e')](_0x4e73e1[_0x5ad4('0x3d')],{'$or':_[_0x5ad4('0x2e')](_0x4cbc6e,function(_0x7a4acb){if(_0x7a4acb[_0x5ad4('0x3f')]!=='VIRTUAL'){var _0x335642={};_0x335642[_0x7a4acb['name']]={'$like':'%'+_0x8a4c50[_0x5ad4('0x32')][_0x5ad4('0x40')]+'%'};return _0x335642;}})});}_0x4e73e1=_[_0x5ad4('0x3e')]({},_0x4e73e1,_0x8a4c50[_0x5ad4('0x41')]);var _0x402fe0={'where':_0x4e73e1['where']};return db['VoiceTransferReport'][_0x5ad4('0x21')](_0x402fe0)[_0x5ad4('0x29')](function(_0x516b0d){_0x3b0877[_0x5ad4('0x21')]=_0x516b0d;if(_0x8a4c50[_0x5ad4('0x32')][_0x5ad4('0x42')]){_0x4e73e1[_0x5ad4('0x43')]=[{'all':!![]}];}return db[_0x5ad4('0x2f')][_0x5ad4('0x44')](_0x4e73e1);})[_0x5ad4('0x29')](function(_0x44acfc){_0x3b0877[_0x5ad4('0x45')]=_0x44acfc;return _0x3b0877;})[_0x5ad4('0x29')](respondWithFilteredResult(_0x3985d0,_0x4e73e1))[_0x5ad4('0x46')](handleError(_0x3985d0,null));};exports[_0x5ad4('0x47')]=function(_0x973d6e,_0x62d4cf){var _0x16806e={'raw':!![],'where':{'id':_0x973d6e[_0x5ad4('0x48')]['id']}},_0xbf4355={};_0xbf4355[_0x5ad4('0x31')]=_['keys'](db[_0x5ad4('0x2f')][_0x5ad4('0x49')]);_0xbf4355['query']=_[_0x5ad4('0x33')](_0x973d6e[_0x5ad4('0x32')]);_0xbf4355[_0x5ad4('0x34')]=_['intersection'](_0xbf4355[_0x5ad4('0x31')],_0xbf4355['query']);_0x16806e[_0x5ad4('0x37')]=_[_0x5ad4('0x35')](_0xbf4355['model'],qs[_0x5ad4('0x36')](_0x973d6e[_0x5ad4('0x32')][_0x5ad4('0x36')]));_0x16806e[_0x5ad4('0x37')]=_0x16806e[_0x5ad4('0x37')]['length']?_0x16806e[_0x5ad4('0x37')]:_0xbf4355[_0x5ad4('0x31')];if(_0x973d6e[_0x5ad4('0x32')][_0x5ad4('0x42')]){_0x16806e[_0x5ad4('0x43')]=[{'all':!![]}];}_0x16806e=_[_0x5ad4('0x3e')]({},_0x16806e,_0x973d6e[_0x5ad4('0x41')]);return db[_0x5ad4('0x2f')][_0x5ad4('0x4a')](_0x16806e)['then'](handleEntityNotFound(_0x62d4cf,null))['then'](respondWithResult(_0x62d4cf,null))['catch'](handleError(_0x62d4cf,null));};exports['create']=function(_0x457ab7,_0x125758){return db[_0x5ad4('0x2f')][_0x5ad4('0x4b')](_0x457ab7[_0x5ad4('0x4c')],{})[_0x5ad4('0x29')](respondWithResult(_0x125758,0xc9))['catch'](handleError(_0x125758,null));};exports['update']=function(_0xf9a9ef,_0x3f5a64){if(_0xf9a9ef[_0x5ad4('0x4c')]['id']){delete _0xf9a9ef[_0x5ad4('0x4c')]['id'];}return db['VoiceTransferReport']['find']({'where':{'id':_0xf9a9ef[_0x5ad4('0x48')]['id']}})[_0x5ad4('0x29')](handleEntityNotFound(_0x3f5a64,null))[_0x5ad4('0x29')](saveUpdates(_0xf9a9ef[_0x5ad4('0x4c')],null))[_0x5ad4('0x29')](respondWithResult(_0x3f5a64,null))['catch'](handleError(_0x3f5a64,null));};exports[_0x5ad4('0x28')]=function(_0x2af59f,_0x43a0c9){return db[_0x5ad4('0x2f')][_0x5ad4('0x4a')]({'where':{'id':_0x2af59f[_0x5ad4('0x48')]['id']}})['then'](handleEntityNotFound(_0x43a0c9,null))[_0x5ad4('0x29')](removeEntity(_0x43a0c9,null))['catch'](handleError(_0x43a0c9,null));};exports[_0x5ad4('0x4d')]=function(_0x1227eb,_0x32ba6e){return db['VoiceTransferReport']['describe']()[_0x5ad4('0x29')](respondWithResult(_0x32ba6e,null))[_0x5ad4('0x46')](handleError(_0x32ba6e,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index f1863f4..644e4cc 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 _0x4040=['rimraf','../../config/environment','./voiceTransferReport.attributes','define','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x272a4e,_0xf7e44b){var _0x51ef99=function(_0x15847c){while(--_0x15847c){_0x272a4e['push'](_0x272a4e['shift']());}};_0x51ef99(++_0xf7e44b);}(_0x4040,0xeb));var _0x0404=function(_0x5d9b63,_0x3b6a6f){_0x5d9b63=_0x5d9b63-0x0;var _0x546194=_0x4040[_0x5d9b63];return _0x546194;};'use strict';var _=require('lodash');var util=require(_0x0404('0x0'));var logger=require(_0x0404('0x1'))(_0x0404('0x2'));var moment=require(_0x0404('0x3'));var BPromise=require(_0x0404('0x4'));var rp=require(_0x0404('0x5'));var fs=require('fs');var path=require(_0x0404('0x6'));var rimraf=require(_0x0404('0x7'));var config=require(_0x0404('0x8'));var attributes=require(_0x0404('0x9'));module['exports']=function(_0xaccce3,_0x12f3d4){return _0xaccce3[_0x0404('0xa')]('VoiceTransferReport',attributes,{'tableName':'report_call_transfer','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfdb6=['path','rimraf','exports','define','report_call_transfer','lodash','../../config/logger','bluebird','request-promise'];(function(_0x2eb5bc,_0x4634c6){var _0x51c7b1=function(_0x1af430){while(--_0x1af430){_0x2eb5bc['push'](_0x2eb5bc['shift']());}};_0x51c7b1(++_0x4634c6);}(_0xfdb6,0x1a3));var _0x6fdb=function(_0x2b7d1a,_0x5639a4){_0x2b7d1a=_0x2b7d1a-0x0;var _0x4efeb3=_0xfdb6[_0x2b7d1a];return _0x4efeb3;};'use strict';var _=require(_0x6fdb('0x0'));var util=require('util');var logger=require(_0x6fdb('0x1'))('api');var moment=require('moment');var BPromise=require(_0x6fdb('0x2'));var rp=require(_0x6fdb('0x3'));var fs=require('fs');var path=require(_0x6fdb('0x4'));var rimraf=require(_0x6fdb('0x5'));var config=require('../../config/environment');var attributes=require('./voiceTransferReport.attributes');module[_0x6fdb('0x6')]=function(_0x2b1adc,_0x58e5f2){return _0x2b1adc[_0x6fdb('0x7')]('VoiceTransferReport',attributes,{'tableName':_0x6fdb('0x8'),'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 4460baa..6a5745f 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 _0x32e7=['create','body','options','catch','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','VoiceTransferReport,\x20%s,\x20%s','info','result','CreateVoiceTransferReport','VoiceTransferReport'];(function(_0x183256,_0x1a596d){var _0x5394a2=function(_0x192025){while(--_0x192025){_0x183256['push'](_0x183256['shift']());}};_0x5394a2(++_0x1a596d);}(_0x32e7,0x1d8));var _0x732e=function(_0x565b0b,_0x129e53){_0x565b0b=_0x565b0b-0x0;var _0x49c342=_0x32e7[_0x565b0b];return _0x49c342;};'use strict';var _=require('lodash');var util=require(_0x732e('0x0'));var moment=require(_0x732e('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x732e('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x732e('0x3'));var logger=require(_0x732e('0x4'))(_0x732e('0x5'));var config=require(_0x732e('0x6'));var jayson=require(_0x732e('0x7'));var client=jayson[_0x732e('0x8')][_0x732e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2d0fd3,_0x57880b,_0x22a428){return new BPromise(function(_0x496f76,_0x498d27){return client['request'](_0x2d0fd3,_0x22a428)[_0x732e('0xa')](function(_0x37688b){logger['info']('VoiceTransferReport,\x20%s,\x20%s',_0x57880b,'request\x20sent');logger[_0x732e('0xb')](_0x732e('0xc'),_0x57880b,_0x732e('0xd'),JSON[_0x732e('0xe')](_0x37688b));if(_0x37688b['error']){if(_0x37688b[_0x732e('0xf')]['code']===0x1f4){logger[_0x732e('0xf')]('VoiceTransferReport,\x20%s,\x20%s',_0x57880b,_0x37688b[_0x732e('0xf')][_0x732e('0x10')]);return _0x498d27(_0x37688b['error'][_0x732e('0x10')]);}logger['error'](_0x732e('0x11'),_0x57880b,_0x37688b['error'][_0x732e('0x10')]);return _0x496f76(_0x37688b[_0x732e('0xf')]['message']);}else{logger[_0x732e('0x12')](_0x732e('0x11'),_0x57880b,'request\x20sent');_0x496f76(_0x37688b[_0x732e('0x13')][_0x732e('0x10')]);}})['catch'](function(_0x1589aa){logger['error'](_0x732e('0x11'),_0x57880b,_0x1589aa);_0x498d27(_0x1589aa);});});}exports[_0x732e('0x14')]=function(_0x6b0a3b){var _0x5e1c49=this;return new Promise(function(_0x397613,_0x159a22){return db[_0x732e('0x15')][_0x732e('0x16')](_0x6b0a3b[_0x732e('0x17')],{'raw':_0x6b0a3b[_0x732e('0x18')]?_0x6b0a3b[_0x732e('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x732e('0xa')](function(_0x586c62){logger['info'](_0x732e('0x14'),_0x6b0a3b);logger[_0x732e('0xb')](_0x732e('0x14'),_0x6b0a3b,JSON[_0x732e('0xe')](_0x586c62));_0x397613(_0x586c62);})[_0x732e('0x19')](function(_0x3724da){logger[_0x732e('0xf')]('CreateVoiceTransferReport',_0x3724da['message'],_0x6b0a3b);_0x159a22(_0x5e1c49[_0x732e('0xf')](0x1f4,_0x3724da[_0x732e('0x10')]));});});}; \ No newline at end of file +var _0x1d51=['create','options','raw','then','CreateVoiceTransferReport','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceTransferReport,\x20%s,\x20%s','message','result','catch','VoiceTransferReport'];(function(_0x318d5b,_0x5bd9b0){var _0x201411=function(_0x510ba7){while(--_0x510ba7){_0x318d5b['push'](_0x318d5b['shift']());}};_0x201411(++_0x5bd9b0);}(_0x1d51,0x1d5));var _0x11d5=function(_0x4ddae0,_0x187bc9){_0x4ddae0=_0x4ddae0-0x0;var _0x417f3e=_0x1d51[_0x4ddae0];return _0x417f3e;};'use strict';var _=require('lodash');var util=require(_0x11d5('0x0'));var moment=require(_0x11d5('0x1'));var BPromise=require(_0x11d5('0x2'));var rs=require(_0x11d5('0x3'));var fs=require('fs');var Redis=require(_0x11d5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x11d5('0x5'));var logger=require('../../config/logger')(_0x11d5('0x6'));var config=require(_0x11d5('0x7'));var jayson=require(_0x11d5('0x8'));var client=jayson[_0x11d5('0x9')][_0x11d5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x64b667,_0x35242a,_0x4ab76f){return new BPromise(function(_0x24238c,_0x569295){return client[_0x11d5('0xb')](_0x64b667,_0x4ab76f)['then'](function(_0x524747){logger[_0x11d5('0xc')]('VoiceTransferReport,\x20%s,\x20%s',_0x35242a,_0x11d5('0xd'));logger[_0x11d5('0xe')](_0x11d5('0xf'),_0x35242a,_0x11d5('0xd'),JSON[_0x11d5('0x10')](_0x524747));if(_0x524747['error']){if(_0x524747[_0x11d5('0x11')][_0x11d5('0x12')]===0x1f4){logger['error'](_0x11d5('0x13'),_0x35242a,_0x524747[_0x11d5('0x11')]['message']);return _0x569295(_0x524747['error'][_0x11d5('0x14')]);}logger[_0x11d5('0x11')](_0x11d5('0x13'),_0x35242a,_0x524747['error'][_0x11d5('0x14')]);return _0x24238c(_0x524747['error'][_0x11d5('0x14')]);}else{logger['info'](_0x11d5('0x13'),_0x35242a,_0x11d5('0xd'));_0x24238c(_0x524747[_0x11d5('0x15')][_0x11d5('0x14')]);}})[_0x11d5('0x16')](function(_0x116285){logger[_0x11d5('0x11')](_0x11d5('0x13'),_0x35242a,_0x116285);_0x569295(_0x116285);});});}exports['CreateVoiceTransferReport']=function(_0x4db7de){var _0x3eb8b0=this;return new Promise(function(_0x2f0e49,_0x3d927f){return db[_0x11d5('0x17')][_0x11d5('0x18')](_0x4db7de['body'],{'raw':_0x4db7de[_0x11d5('0x19')]?_0x4db7de['options'][_0x11d5('0x1a')]===undefined?!![]:![]:!![]})[_0x11d5('0x1b')](function(_0x3b4622){logger[_0x11d5('0xc')](_0x11d5('0x1c'),_0x4db7de);logger[_0x11d5('0xe')]('CreateVoiceTransferReport',_0x4db7de,JSON['stringify'](_0x3b4622));_0x2f0e49(_0x3b4622);})[_0x11d5('0x16')](function(_0xbc35ef){logger[_0x11d5('0x11')](_0x11d5('0x1c'),_0xbc35ef[_0x11d5('0x14')],_0x4db7de);_0x3d927f(_0x3eb8b0[_0x11d5('0x11')](0x1f4,_0xbc35ef[_0x11d5('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 9155d95..c6ad5a6 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 _0x70e0=['unhold','/calls','calls','/transfer','transfer','express','Router','../../components/auth/service','/originate','isAuthenticated','isWebrtcLicence','originate','/hangup','answer','post','/hold','/unhold'];(function(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0x70e0,0x17b));var _0x070e=function(_0x229cfc,_0x4fae2d){_0x229cfc=_0x229cfc-0x0;var _0x5eb213=_0x70e0[_0x229cfc];return _0x5eb213;};'use strict';var express=require(_0x070e('0x0'));var router=express[_0x070e('0x1')]();var auth=require(_0x070e('0x2'));var controller=require('./webbar.controller');router['post'](_0x070e('0x3'),auth[_0x070e('0x4')](),auth[_0x070e('0x5')](),controller[_0x070e('0x6')]);router['post'](_0x070e('0x7'),auth['isAuthenticated'](),auth[_0x070e('0x5')](),controller['hangup']);router['post']('/answer',auth[_0x070e('0x4')](),auth[_0x070e('0x5')](),controller[_0x070e('0x8')]);router[_0x070e('0x9')](_0x070e('0xa'),auth[_0x070e('0x4')](),auth[_0x070e('0x5')](),controller['hold']);router['post'](_0x070e('0xb'),auth[_0x070e('0x4')](),auth[_0x070e('0x5')](),controller[_0x070e('0xc')]);router[_0x070e('0x9')](_0x070e('0xd'),auth[_0x070e('0x4')](),auth[_0x070e('0x5')](),controller[_0x070e('0xe')]);router[_0x070e('0x9')](_0x070e('0xf'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0x070e('0x10')]);module['exports']=router; \ No newline at end of file +var _0xf109=['/transfer','transfer','express','Router','../../components/auth/service','isAuthenticated','isWebrtcLicence','originate','post','/hangup','hangup','/answer','answer','/hold','/unhold','/calls','calls'];(function(_0x52b252,_0x106c11){var _0x330636=function(_0x10c768){while(--_0x10c768){_0x52b252['push'](_0x52b252['shift']());}};_0x330636(++_0x106c11);}(_0xf109,0xce));var _0x9f10=function(_0x1a9204,_0x1c9e00){_0x1a9204=_0x1a9204-0x0;var _0x17ca68=_0xf109[_0x1a9204];return _0x17ca68;};'use strict';var express=require(_0x9f10('0x0'));var router=express[_0x9f10('0x1')]();var auth=require(_0x9f10('0x2'));var controller=require('./webbar.controller');router['post']('/originate',auth[_0x9f10('0x3')](),auth[_0x9f10('0x4')](),controller[_0x9f10('0x5')]);router[_0x9f10('0x6')](_0x9f10('0x7'),auth[_0x9f10('0x3')](),auth[_0x9f10('0x4')](),controller[_0x9f10('0x8')]);router[_0x9f10('0x6')](_0x9f10('0x9'),auth[_0x9f10('0x3')](),auth['isWebrtcLicence'](),controller[_0x9f10('0xa')]);router[_0x9f10('0x6')](_0x9f10('0xb'),auth[_0x9f10('0x3')](),auth[_0x9f10('0x4')](),controller['hold']);router[_0x9f10('0x6')](_0x9f10('0xc'),auth[_0x9f10('0x3')](),auth['isWebrtcLicence'](),controller['unhold']);router[_0x9f10('0x6')](_0x9f10('0xd'),auth[_0x9f10('0x3')](),auth['isWebrtcLicence'](),controller[_0x9f10('0xe')]);router[_0x9f10('0x6')](_0x9f10('0xf'),auth['isAuthenticated'](),auth[_0x9f10('0x4')](),controller[_0x9f10('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 412af0b..df8462e 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 _0xe28e=['../../mysqldb','../../config/environment','util','bluebird','jayson/promise','client','http','../../config/logger','webbarapi','ioredis','redis','localhost','socket.io-emitter','validate','number','userId\x20is\x20required','string','sessionId\x20is\x20required','transferNumber\x20is\x20required','stringify','handleError:','stack','name','send','status','NotFound','request','error','code','message','result','catch','findOne','VoiceChannels','all','then','filter','UserId','sessionId','length','sessionId\x20','\x20not\x20found!','originate','info','body','json','callNumber','callerId','callbackUrl','entityFound:','user:%s','originate\x20executed!','hangup','hangup\x20fired:','userId','format','webbar:hangup','hangup\x20executed!','answer','webbar:answer','answer\x20executed!','hold','webbar:hold','hold\x20executed!','webbar:unhold','calls','rows','conference','conference\x20fired:','conference\x20executed!','transfer\x20fired:','transferNumber','path','lodash'];(function(_0x4051ab,_0x1d736f){var _0x347130=function(_0x45c784){while(--_0x45c784){_0x4051ab['push'](_0x4051ab['shift']());}};_0x347130(++_0x1d736f);}(_0xe28e,0x1ba));var _0xee28=function(_0x24d768,_0x41c893){_0x24d768=_0x24d768-0x0;var _0x1dcf15=_0xe28e[_0x24d768];return _0x1dcf15;};'use strict';var path=require(_0xee28('0x0'));var fs=require('fs');var _=require(_0xee28('0x1'));var db=require(_0xee28('0x2'))['db'];var config=require(_0xee28('0x3'));var util=require(_0xee28('0x4'));var BPromise=require(_0xee28('0x5'));var jayson=require(_0xee28('0x6'));var amiClient=jayson[_0xee28('0x7')][_0xee28('0x8')]({'port':0x232a});var logger=require(_0xee28('0x9'))(_0xee28('0xa'));var Redis=require(_0xee28('0xb'));config[_0xee28('0xc')]=_['defaults'](config[_0xee28('0xc')],{'host':_0xee28('0xd'),'port':0x18eb});var io=require(_0xee28('0xe'))(new Redis(config[_0xee28('0xc')]));var Schema=require(_0xee28('0xf'));var originateValidation=new Schema({'userId':{'type':_0xee28('0x10'),'required':[!![],_0xee28('0x11')]},'callNumber':{'type':'string','required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':'string'},'callbackUrl':{'type':_0xee28('0x12')}});var hangupValidation=new Schema({'userId':{'type':_0xee28('0x10'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xee28('0x12'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xee28('0x10'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xee28('0x12'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0xee28('0x10'),'required':[!![],_0xee28('0x11')]},'sessionId':{'type':_0xee28('0x12'),'required':[!![],_0xee28('0x13')]},'transferNumber':{'type':_0xee28('0x12'),'required':[!![],_0xee28('0x14')]}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],_0xee28('0x11')]},'sessionId':{'type':_0xee28('0x12'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xee28('0x10'),'required':[!![],_0xee28('0x11')]},'sessionId':{'type':_0xee28('0x12'),'required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],_0xee28('0x11')]}});var conferenceValidation=new Schema({'userId':{'type':_0xee28('0x10'),'required':[!![],_0xee28('0x11')]}});function emit(_0x343358,_0x1ff99e,_0x11c95d){logger['info'](_0x343358,_0x1ff99e,JSON[_0xee28('0x15')](_0x11c95d));io['to'](_0x343358)['emit'](_0x1ff99e,_0x11c95d);}function handleError(_0x37e429){return function(_0x19472a){console['log'](_0xee28('0x16'),_0x19472a,_0x19472a instanceof RangeError);logger['error'](_0x19472a[_0xee28('0x17')]);if(_0x19472a instanceof RangeError){if(_0x19472a['name']){delete _0x19472a[_0xee28('0x18')];}_0x37e429['status'](0x194)[_0xee28('0x19')](_0x19472a);}else{if(_0x19472a['name']){delete _0x19472a[_0xee28('0x18')];}_0x37e429[_0xee28('0x1a')](0x1f4)[_0xee28('0x19')](_0x19472a);}};}function checkError(){return function(_0x3674c7){if(!_0x3674c7){throw new RangeError(_0xee28('0x1b'));}return _0x3674c7;};}function respondWithRpcPromise(_0x1280f5,_0x2dbd49){return new BPromise(function(_0x4bda53,_0x342798){var _0x44d7ff=amiClient;return _0x44d7ff[_0xee28('0x1c')](_0x1280f5,_0x2dbd49)['then'](function(_0x5b500b){if(_0x5b500b[_0xee28('0x1d')]){if(_0x5b500b[_0xee28('0x1d')][_0xee28('0x1e')]===0x1f4){return _0x342798(_0x5b500b[_0xee28('0x1d')][_0xee28('0x1f')]);}return _0x4bda53(_0x5b500b[_0xee28('0x1d')][_0xee28('0x1f')]);}else{_0x4bda53(_0x5b500b[_0xee28('0x20')]);}})[_0xee28('0x21')](function(_0x733ca8){_0x342798(_0x733ca8);});});}function getAgent(_0x281c8a){return db['User'][_0xee28('0x22')]({'where':{'id':_0x281c8a,'role':'agent'}})['then'](checkError());}function getAgentCheckSession(_0x54528b,_0x587aac){return new BPromise(function(_0x51eae7,_0x8373a7){var _0x884e7d=respondWithRpcPromise(_0xee28('0x23'));var _0x469889=getAgent(_0x54528b);Promise[_0xee28('0x24')]([_0x884e7d,_0x469889])[_0xee28('0x25')](function(_0xbafd67){var _0x4fcc8f=_0xbafd67[0x0];var _0x84e0ba=_0xbafd67[0x1];var _0x7390dc=_[_0xee28('0x26')](_0x4fcc8f['rows'],function(_0x14f7c4){return _0x14f7c4[_0xee28('0x27')]==_0x84e0ba['id']&&_0x14f7c4[_0xee28('0x28')]==_0x587aac;});if(_0x7390dc[_0xee28('0x29')]==0x1){_0x51eae7(_0x84e0ba);}else{_0x8373a7(new RangeError(_0xee28('0x2a')+_0x587aac+_0xee28('0x2b')));}});});}exports[_0xee28('0x2c')]=function(_0x5d2a9d,_0x15f294){logger[_0xee28('0x2d')]('originate\x20fired:',_0x5d2a9d[_0xee28('0x2e')]);var _0x34dd11=originateValidation[_0xee28('0xf')](_0x5d2a9d[_0xee28('0x2e')]);if(_0x34dd11[_0xee28('0x29')]>0x0){return _0x15f294[_0xee28('0x1a')](0x190)[_0xee28('0x2f')](_0x34dd11);}var _0x5a4f48=_0x5d2a9d['body']['userId'];var _0x1a8ef0=_0x5d2a9d[_0xee28('0x2e')][_0xee28('0x30')];var _0x3402ce=_0x5d2a9d[_0xee28('0x2e')][_0xee28('0x31')];var _0x5b0c20=_0x5d2a9d[_0xee28('0x2e')][_0xee28('0x32')];return getAgent(_0x5a4f48)['then'](function(_0x51b28d){logger[_0xee28('0x2d')](_0xee28('0x33'),_0x51b28d['name']);emit(util['format'](_0xee28('0x34'),_0x51b28d[_0xee28('0x18')]),'webbar:originate',{'callNumber':_0x1a8ef0,'callerId':_0x3402ce,'callbackUrl':_0x5b0c20});return _0x15f294[_0xee28('0x1a')](0xc8)[_0xee28('0x2f')]({'error':![],'message':_0xee28('0x35')});})[_0xee28('0x21')](handleError(_0x15f294));};exports[_0xee28('0x36')]=function(_0x594116,_0x2a5d06){logger[_0xee28('0x2d')](_0xee28('0x37'),_0x594116[_0xee28('0x2e')]);var _0x43b587=hangupValidation[_0xee28('0xf')](_0x594116['body']);if(_0x43b587[_0xee28('0x29')]>0x0){return _0x2a5d06['status'](0x190)['json'](_0x43b587);}var _0x265ae5=_0x594116['body'][_0xee28('0x38')];var _0x5c5f08=_0x594116[_0xee28('0x2e')]['sessionId'];return getAgent(_0x265ae5)[_0xee28('0x25')](function(_0x211345){logger[_0xee28('0x2d')](_0xee28('0x33'),_0x211345['name']);emit(util[_0xee28('0x39')]('user:%s',_0x211345[_0xee28('0x18')]),_0xee28('0x3a'),{'sessionId':_0x5c5f08});return _0x2a5d06[_0xee28('0x1a')](0xc8)[_0xee28('0x2f')]({'error':![],'message':_0xee28('0x3b')});})[_0xee28('0x21')](handleError(_0x2a5d06));};exports[_0xee28('0x3c')]=function(_0x5a4b9c,_0x4d9d21){logger[_0xee28('0x2d')]('answer\x20fired:',_0x5a4b9c['body']);var _0x4064cf=answerValidation[_0xee28('0xf')](_0x5a4b9c['body']);if(_0x4064cf[_0xee28('0x29')]>0x0){return _0x4d9d21[_0xee28('0x1a')](0x190)[_0xee28('0x2f')](_0x4064cf);}var _0x24cfaa=_0x5a4b9c[_0xee28('0x2e')][_0xee28('0x38')];var _0x1735a9=_0x5a4b9c['body'][_0xee28('0x28')];return getAgent(_0x24cfaa)[_0xee28('0x25')](function(_0x2dd024){logger[_0xee28('0x2d')](_0xee28('0x33'),_0x2dd024['name']);emit(util[_0xee28('0x39')](_0xee28('0x34'),_0x2dd024['name']),_0xee28('0x3d'),{'sessionId':_0x1735a9});return _0x4d9d21[_0xee28('0x1a')](0xc8)[_0xee28('0x2f')]({'error':![],'message':_0xee28('0x3e')});})[_0xee28('0x21')](handleError(_0x4d9d21));};exports[_0xee28('0x3f')]=function(_0x54ab7b,_0x36e5bb){logger['info']('hold\x20fired:',_0x54ab7b[_0xee28('0x2e')]);var _0x2f240f=holdValidation['validate'](_0x54ab7b[_0xee28('0x2e')]);if(_0x2f240f[_0xee28('0x29')]>0x0){return _0x36e5bb[_0xee28('0x1a')](0x190)['json'](_0x2f240f);}var _0x57e57e=_0x54ab7b[_0xee28('0x2e')][_0xee28('0x38')];var _0x1bb1ac=_0x54ab7b[_0xee28('0x2e')][_0xee28('0x28')];return getAgent(_0x57e57e)[_0xee28('0x25')](function(_0x2574c5){logger[_0xee28('0x2d')](_0xee28('0x33'),_0x2574c5[_0xee28('0x18')]);emit(util['format'](_0xee28('0x34'),_0x2574c5['name']),_0xee28('0x40'),{'sessionId':_0x1bb1ac});return _0x36e5bb[_0xee28('0x1a')](0xc8)[_0xee28('0x2f')]({'error':![],'message':_0xee28('0x41')});})[_0xee28('0x21')](handleError(_0x36e5bb));};exports['unhold']=function(_0x5247fe,_0x5ca018){logger[_0xee28('0x2d')]('unhold\x20fired:',_0x5247fe['body']);var _0x659fc4=unholdValidation['validate'](_0x5247fe[_0xee28('0x2e')]);if(_0x659fc4[_0xee28('0x29')]>0x0){return _0x5ca018[_0xee28('0x1a')](0x190)[_0xee28('0x2f')](_0x659fc4);}var _0x398120=_0x5247fe[_0xee28('0x2e')][_0xee28('0x38')];var _0xc1bdba=_0x5247fe[_0xee28('0x2e')][_0xee28('0x28')];return getAgent(_0x398120)['then'](function(_0x1f3680){logger[_0xee28('0x2d')](_0xee28('0x33'),_0x1f3680['name']);emit(util['format']('user:%s',_0x1f3680['name']),_0xee28('0x42'),{'sessionId':_0xc1bdba});return _0x5ca018[_0xee28('0x1a')](0xc8)[_0xee28('0x2f')]({'error':![],'message':'unhold\x20executed!'});})[_0xee28('0x21')](handleError(_0x5ca018));};exports[_0xee28('0x43')]=function(_0x204bbe,_0x39b228){logger[_0xee28('0x2d')]('calls\x20fired:',_0x39b228[_0xee28('0x2e')]);var _0x1c6696=callsValidation[_0xee28('0xf')](_0x204bbe['body']);if(_0x1c6696[_0xee28('0x29')]>0x0){return _0x39b228[_0xee28('0x1a')](0x190)[_0xee28('0x2f')](_0x1c6696);}var _0x47794a=_0x204bbe[_0xee28('0x2e')][_0xee28('0x38')];var _0xfcca7e=respondWithRpcPromise('VoiceChannels');var _0x161394=getAgent(_0x47794a);return Promise['all']([_0xfcca7e,_0x161394])['then'](function(_0x5b7292){var _0x333d7e=_0x5b7292[0x0];var _0x7c51d5=_0x5b7292[0x1];var _0x3cad0a=_[_0xee28('0x26')](_0x333d7e[_0xee28('0x44')],function(_0x27d96d){return _0x27d96d[_0xee28('0x27')]==_0x7c51d5['id'];});return _0x39b228[_0xee28('0x1a')](0xc8)['json']({'count':_0x3cad0a[_0xee28('0x29')],'rows':_0x3cad0a});})[_0xee28('0x21')](handleError(_0x39b228));};exports[_0xee28('0x45')]=function(_0x2b8252,_0x209c3e){logger[_0xee28('0x2d')](_0xee28('0x46'),_0x2b8252['body']);var _0x438943=conferenceValidation['validate'](_0x2b8252[_0xee28('0x2e')]);if(_0x438943[_0xee28('0x29')]>0x0){return _0x209c3e['status'](0x190)[_0xee28('0x2f')](_0x438943);}var _0x2a5fa7=_0x2b8252[_0xee28('0x2e')][_0xee28('0x38')];return getAgent(_0x2a5fa7)['then'](function(_0x209d6d){logger[_0xee28('0x2d')](_0xee28('0x33'),_0x209d6d[_0xee28('0x18')]);emit(util[_0xee28('0x39')](_0xee28('0x34'),_0x209d6d[_0xee28('0x18')]),'webbar:conference');return _0x209c3e[_0xee28('0x1a')](0xc8)['json']({'error':![],'message':_0xee28('0x47')});})[_0xee28('0x21')](handleError(_0x209c3e));};exports['transfer']=function(_0x4b222a,_0x14bc7a){logger['info'](_0xee28('0x48'),_0x4b222a[_0xee28('0x2e')]);var _0x19f81a=transferValidation[_0xee28('0xf')](_0x4b222a[_0xee28('0x2e')]);if(_0x19f81a[_0xee28('0x29')]>0x0){return _0x14bc7a[_0xee28('0x1a')](0x190)['json'](_0x19f81a);}var _0x179ce6=_0x4b222a[_0xee28('0x2e')][_0xee28('0x38')];var _0x57ded5=_0x4b222a[_0xee28('0x2e')][_0xee28('0x28')];var _0x1e190f=_0x4b222a[_0xee28('0x2e')][_0xee28('0x49')];return getAgent(_0x179ce6)[_0xee28('0x25')](function(_0x5dc31e){logger[_0xee28('0x2d')](_0xee28('0x33'),_0x5dc31e[_0xee28('0x18')]);emit(util[_0xee28('0x39')](_0xee28('0x34'),_0x5dc31e[_0xee28('0x18')]),'webbar:transfer',{'sessionId':_0x57ded5,'transferNumber':_0x1e190f});return _0x14bc7a[_0xee28('0x1a')](0xc8)[_0xee28('0x2f')]({'error':![],'message':'transfer\x20executed!'});})['catch'](handleError(_0x14bc7a));}; \ No newline at end of file +var _0x55ea=['NotFound','request','code','message','result','catch','User','findOne','agent','then','VoiceChannels','all','filter','rows','UserId','sessionId','length','sessionId\x20','originate','info','originate\x20fired:','body','userId','callNumber','callerId','callbackUrl','entityFound:','webbar:originate','json','originate\x20executed!','hangup','hangup\x20fired:','format','user:%s','webbar:hangup','answer','answer\x20fired:','answer\x20executed!','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','conference\x20fired:','transfer\x20fired:','path','lodash','../../mysqldb','util','bluebird','jayson/promise','client','http','webbarapi','localhost','socket.io-emitter','redis','validate','number','userId\x20is\x20required','string','callNumber\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','stringify','log','handleError:','error','stack','name','status','send'];(function(_0x2797c6,_0x37421b){var _0x54809f=function(_0x2d100c){while(--_0x2d100c){_0x2797c6['push'](_0x2797c6['shift']());}};_0x54809f(++_0x37421b);}(_0x55ea,0xc9));var _0xa55e=function(_0x40998b,_0x27483e){_0x40998b=_0x40998b-0x0;var _0x319dfd=_0x55ea[_0x40998b];return _0x319dfd;};'use strict';var path=require(_0xa55e('0x0'));var fs=require('fs');var _=require(_0xa55e('0x1'));var db=require(_0xa55e('0x2'))['db'];var config=require('../../config/environment');var util=require(_0xa55e('0x3'));var BPromise=require(_0xa55e('0x4'));var jayson=require(_0xa55e('0x5'));var amiClient=jayson[_0xa55e('0x6')][_0xa55e('0x7')]({'port':0x232a});var logger=require('../../config/logger')(_0xa55e('0x8'));var Redis=require('ioredis');config['redis']=_['defaults'](config['redis'],{'host':_0xa55e('0x9'),'port':0x18eb});var io=require(_0xa55e('0xa'))(new Redis(config[_0xa55e('0xb')]));var Schema=require(_0xa55e('0xc'));var originateValidation=new Schema({'userId':{'type':_0xa55e('0xd'),'required':[!![],_0xa55e('0xe')]},'callNumber':{'type':_0xa55e('0xf'),'required':[!![],_0xa55e('0x10')]},'callerId':{'type':_0xa55e('0xf')},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],_0xa55e('0xe')]},'sessionId':{'type':_0xa55e('0xf'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xa55e('0xd'),'required':[!![],_0xa55e('0xe')]},'sessionId':{'type':_0xa55e('0xf'),'required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],_0xa55e('0xe')]},'sessionId':{'type':'string','required':[!![],_0xa55e('0x11')]},'transferNumber':{'type':_0xa55e('0xf'),'required':[!![],_0xa55e('0x12')]}});var holdValidation=new Schema({'userId':{'type':_0xa55e('0xd'),'required':[!![],_0xa55e('0xe')]},'sessionId':{'type':_0xa55e('0xf'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xa55e('0xd'),'required':[!![],_0xa55e('0xe')]},'sessionId':{'type':_0xa55e('0xf'),'required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],_0xa55e('0xe')]}});var conferenceValidation=new Schema({'userId':{'type':_0xa55e('0xd'),'required':[!![],_0xa55e('0xe')]}});function emit(_0x12895e,_0x303698,_0x339f1e){logger['info'](_0x12895e,_0x303698,JSON[_0xa55e('0x13')](_0x339f1e));io['to'](_0x12895e)['emit'](_0x303698,_0x339f1e);}function handleError(_0x517142){return function(_0x4599b9){console[_0xa55e('0x14')](_0xa55e('0x15'),_0x4599b9,_0x4599b9 instanceof RangeError);logger[_0xa55e('0x16')](_0x4599b9[_0xa55e('0x17')]);if(_0x4599b9 instanceof RangeError){if(_0x4599b9['name']){delete _0x4599b9[_0xa55e('0x18')];}_0x517142['status'](0x194)['send'](_0x4599b9);}else{if(_0x4599b9[_0xa55e('0x18')]){delete _0x4599b9[_0xa55e('0x18')];}_0x517142[_0xa55e('0x19')](0x1f4)[_0xa55e('0x1a')](_0x4599b9);}};}function checkError(){return function(_0x51304d){if(!_0x51304d){throw new RangeError(_0xa55e('0x1b'));}return _0x51304d;};}function respondWithRpcPromise(_0x475dde,_0x267adb){return new BPromise(function(_0x9594a3,_0x5b0e74){var _0x53a2f9=amiClient;return _0x53a2f9[_0xa55e('0x1c')](_0x475dde,_0x267adb)['then'](function(_0xaaf2f1){if(_0xaaf2f1[_0xa55e('0x16')]){if(_0xaaf2f1[_0xa55e('0x16')][_0xa55e('0x1d')]===0x1f4){return _0x5b0e74(_0xaaf2f1[_0xa55e('0x16')][_0xa55e('0x1e')]);}return _0x9594a3(_0xaaf2f1[_0xa55e('0x16')][_0xa55e('0x1e')]);}else{_0x9594a3(_0xaaf2f1[_0xa55e('0x1f')]);}})[_0xa55e('0x20')](function(_0x3c519d){_0x5b0e74(_0x3c519d);});});}function getAgent(_0x137aca){return db[_0xa55e('0x21')][_0xa55e('0x22')]({'where':{'id':_0x137aca,'role':_0xa55e('0x23')}})[_0xa55e('0x24')](checkError());}function getAgentCheckSession(_0x2f2579,_0xa1917c){return new BPromise(function(_0x875010,_0x4eebcc){var _0x5c218d=respondWithRpcPromise(_0xa55e('0x25'));var _0x4ebcbd=getAgent(_0x2f2579);Promise[_0xa55e('0x26')]([_0x5c218d,_0x4ebcbd])['then'](function(_0x2fe4e9){var _0x4d9634=_0x2fe4e9[0x0];var _0x2758ca=_0x2fe4e9[0x1];var _0x532b13=_[_0xa55e('0x27')](_0x4d9634[_0xa55e('0x28')],function(_0x4a03ef){return _0x4a03ef[_0xa55e('0x29')]==_0x2758ca['id']&&_0x4a03ef[_0xa55e('0x2a')]==_0xa1917c;});if(_0x532b13[_0xa55e('0x2b')]==0x1){_0x875010(_0x2758ca);}else{_0x4eebcc(new RangeError(_0xa55e('0x2c')+_0xa1917c+'\x20not\x20found!'));}});});}exports[_0xa55e('0x2d')]=function(_0x25ecb3,_0x5b79d6){logger[_0xa55e('0x2e')](_0xa55e('0x2f'),_0x25ecb3[_0xa55e('0x30')]);var _0xcaeba6=originateValidation['validate'](_0x25ecb3[_0xa55e('0x30')]);if(_0xcaeba6['length']>0x0){return _0x5b79d6[_0xa55e('0x19')](0x190)['json'](_0xcaeba6);}var _0x339406=_0x25ecb3[_0xa55e('0x30')][_0xa55e('0x31')];var _0x1e53f0=_0x25ecb3['body'][_0xa55e('0x32')];var _0x5aec2c=_0x25ecb3[_0xa55e('0x30')][_0xa55e('0x33')];var _0x7999ac=_0x25ecb3['body'][_0xa55e('0x34')];return getAgent(_0x339406)[_0xa55e('0x24')](function(_0x602aa0){logger[_0xa55e('0x2e')](_0xa55e('0x35'),_0x602aa0[_0xa55e('0x18')]);emit(util['format']('user:%s',_0x602aa0[_0xa55e('0x18')]),_0xa55e('0x36'),{'callNumber':_0x1e53f0,'callerId':_0x5aec2c,'callbackUrl':_0x7999ac});return _0x5b79d6[_0xa55e('0x19')](0xc8)[_0xa55e('0x37')]({'error':![],'message':_0xa55e('0x38')});})[_0xa55e('0x20')](handleError(_0x5b79d6));};exports[_0xa55e('0x39')]=function(_0x596a5d,_0x5cd5b3){logger[_0xa55e('0x2e')](_0xa55e('0x3a'),_0x596a5d[_0xa55e('0x30')]);var _0x351dbf=hangupValidation[_0xa55e('0xc')](_0x596a5d[_0xa55e('0x30')]);if(_0x351dbf[_0xa55e('0x2b')]>0x0){return _0x5cd5b3[_0xa55e('0x19')](0x190)[_0xa55e('0x37')](_0x351dbf);}var _0x113ab5=_0x596a5d[_0xa55e('0x30')]['userId'];var _0x1da8a9=_0x596a5d[_0xa55e('0x30')][_0xa55e('0x2a')];return getAgent(_0x113ab5)['then'](function(_0x1e806a){logger['info'](_0xa55e('0x35'),_0x1e806a[_0xa55e('0x18')]);emit(util[_0xa55e('0x3b')](_0xa55e('0x3c'),_0x1e806a[_0xa55e('0x18')]),_0xa55e('0x3d'),{'sessionId':_0x1da8a9});return _0x5cd5b3[_0xa55e('0x19')](0xc8)['json']({'error':![],'message':'hangup\x20executed!'});})[_0xa55e('0x20')](handleError(_0x5cd5b3));};exports[_0xa55e('0x3e')]=function(_0x27e756,_0x518e06){logger[_0xa55e('0x2e')](_0xa55e('0x3f'),_0x27e756[_0xa55e('0x30')]);var _0xb43d62=answerValidation[_0xa55e('0xc')](_0x27e756[_0xa55e('0x30')]);if(_0xb43d62[_0xa55e('0x2b')]>0x0){return _0x518e06[_0xa55e('0x19')](0x190)['json'](_0xb43d62);}var _0x4bd20d=_0x27e756[_0xa55e('0x30')][_0xa55e('0x31')];var _0x186dc2=_0x27e756[_0xa55e('0x30')][_0xa55e('0x2a')];return getAgent(_0x4bd20d)[_0xa55e('0x24')](function(_0x52c3b5){logger[_0xa55e('0x2e')]('entityFound:',_0x52c3b5['name']);emit(util[_0xa55e('0x3b')]('user:%s',_0x52c3b5[_0xa55e('0x18')]),'webbar:answer',{'sessionId':_0x186dc2});return _0x518e06['status'](0xc8)[_0xa55e('0x37')]({'error':![],'message':_0xa55e('0x40')});})['catch'](handleError(_0x518e06));};exports['hold']=function(_0x3ae40d,_0x1dda95){logger[_0xa55e('0x2e')](_0xa55e('0x41'),_0x3ae40d[_0xa55e('0x30')]);var _0x1031c9=holdValidation['validate'](_0x3ae40d['body']);if(_0x1031c9[_0xa55e('0x2b')]>0x0){return _0x1dda95[_0xa55e('0x19')](0x190)[_0xa55e('0x37')](_0x1031c9);}var _0x259cb3=_0x3ae40d[_0xa55e('0x30')][_0xa55e('0x31')];var _0x5b8776=_0x3ae40d[_0xa55e('0x30')][_0xa55e('0x2a')];return getAgent(_0x259cb3)[_0xa55e('0x24')](function(_0x1de3a8){logger[_0xa55e('0x2e')](_0xa55e('0x35'),_0x1de3a8['name']);emit(util['format'](_0xa55e('0x3c'),_0x1de3a8['name']),_0xa55e('0x42'),{'sessionId':_0x5b8776});return _0x1dda95['status'](0xc8)[_0xa55e('0x37')]({'error':![],'message':_0xa55e('0x43')});})[_0xa55e('0x20')](handleError(_0x1dda95));};exports[_0xa55e('0x44')]=function(_0x2c35a8,_0x63aa32){logger[_0xa55e('0x2e')](_0xa55e('0x45'),_0x2c35a8['body']);var _0x12c9e1=unholdValidation[_0xa55e('0xc')](_0x2c35a8[_0xa55e('0x30')]);if(_0x12c9e1[_0xa55e('0x2b')]>0x0){return _0x63aa32[_0xa55e('0x19')](0x190)[_0xa55e('0x37')](_0x12c9e1);}var _0x50bc5b=_0x2c35a8[_0xa55e('0x30')][_0xa55e('0x31')];var _0x42c00c=_0x2c35a8[_0xa55e('0x30')][_0xa55e('0x2a')];return getAgent(_0x50bc5b)[_0xa55e('0x24')](function(_0x5e0e05){logger[_0xa55e('0x2e')]('entityFound:',_0x5e0e05[_0xa55e('0x18')]);emit(util[_0xa55e('0x3b')](_0xa55e('0x3c'),_0x5e0e05[_0xa55e('0x18')]),_0xa55e('0x46'),{'sessionId':_0x42c00c});return _0x63aa32[_0xa55e('0x19')](0xc8)['json']({'error':![],'message':_0xa55e('0x47')});})['catch'](handleError(_0x63aa32));};exports[_0xa55e('0x48')]=function(_0x5be88c,_0x4f7b59){logger[_0xa55e('0x2e')](_0xa55e('0x49'),_0x4f7b59[_0xa55e('0x30')]);var _0x1f03a8=callsValidation[_0xa55e('0xc')](_0x5be88c[_0xa55e('0x30')]);if(_0x1f03a8[_0xa55e('0x2b')]>0x0){return _0x4f7b59['status'](0x190)[_0xa55e('0x37')](_0x1f03a8);}var _0x33d1e4=_0x5be88c[_0xa55e('0x30')]['userId'];var _0x467ea7=respondWithRpcPromise(_0xa55e('0x25'));var _0x2aeae3=getAgent(_0x33d1e4);return Promise['all']([_0x467ea7,_0x2aeae3])[_0xa55e('0x24')](function(_0x12c5a0){var _0x28fd5a=_0x12c5a0[0x0];var _0x2a6a1f=_0x12c5a0[0x1];var _0x6f0032=_[_0xa55e('0x27')](_0x28fd5a[_0xa55e('0x28')],function(_0x2f8b5f){return _0x2f8b5f[_0xa55e('0x29')]==_0x2a6a1f['id'];});return _0x4f7b59[_0xa55e('0x19')](0xc8)[_0xa55e('0x37')]({'count':_0x6f0032['length'],'rows':_0x6f0032});})[_0xa55e('0x20')](handleError(_0x4f7b59));};exports['conference']=function(_0x373874,_0x1ea145){logger[_0xa55e('0x2e')](_0xa55e('0x4a'),_0x373874[_0xa55e('0x30')]);var _0x1bef1b=conferenceValidation[_0xa55e('0xc')](_0x373874[_0xa55e('0x30')]);if(_0x1bef1b[_0xa55e('0x2b')]>0x0){return _0x1ea145[_0xa55e('0x19')](0x190)[_0xa55e('0x37')](_0x1bef1b);}var _0x424b87=_0x373874[_0xa55e('0x30')][_0xa55e('0x31')];return getAgent(_0x424b87)[_0xa55e('0x24')](function(_0x448641){logger['info']('entityFound:',_0x448641[_0xa55e('0x18')]);emit(util[_0xa55e('0x3b')](_0xa55e('0x3c'),_0x448641[_0xa55e('0x18')]),'webbar:conference');return _0x1ea145['status'](0xc8)[_0xa55e('0x37')]({'error':![],'message':'conference\x20executed!'});})['catch'](handleError(_0x1ea145));};exports['transfer']=function(_0x16f585,_0x37cd3a){logger[_0xa55e('0x2e')](_0xa55e('0x4b'),_0x16f585[_0xa55e('0x30')]);var _0x909ec4=transferValidation[_0xa55e('0xc')](_0x16f585[_0xa55e('0x30')]);if(_0x909ec4[_0xa55e('0x2b')]>0x0){return _0x37cd3a[_0xa55e('0x19')](0x190)['json'](_0x909ec4);}var _0x100633=_0x16f585[_0xa55e('0x30')][_0xa55e('0x31')];var _0x5d9388=_0x16f585[_0xa55e('0x30')][_0xa55e('0x2a')];var _0x3dab7b=_0x16f585[_0xa55e('0x30')]['transferNumber'];return getAgent(_0x100633)[_0xa55e('0x24')](function(_0x14fcad){logger[_0xa55e('0x2e')]('entityFound:',_0x14fcad['name']);emit(util[_0xa55e('0x3b')]('user:%s',_0x14fcad[_0xa55e('0x18')]),'webbar:transfer',{'sessionId':_0x5d9388,'transferNumber':_0x3dab7b});return _0x37cd3a[_0xa55e('0x19')](0xc8)[_0xa55e('0x37')]({'error':![],'message':'transfer\x20executed!'});})[_0xa55e('0x20')](handleError(_0x37cd3a));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 54be1be..71dc1a1 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 _0xbb5b=['put','update','destroy','delete','removeAnswers','removeAgents','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','post','addDisposition','addAnswer','/:id/users','addAgents','addApplications','/:id/notify','notify','/:id/send'];(function(_0x4d37c0,_0x5ce62a){var _0x3e8310=function(_0x183b91){while(--_0x183b91){_0x4d37c0['push'](_0x4d37c0['shift']());}};_0x3e8310(++_0x5ce62a);}(_0xbb5b,0x1a9));var _0xbbb5=function(_0x5b740b,_0x381833){_0x5b740b=_0x5b740b-0x0;var _0x6f8f4e=_0xbb5b[_0x5b740b];return _0x6f8f4e;};'use strict';var multer=require(_0xbbb5('0x0'));var util=require(_0xbbb5('0x1'));var path=require(_0xbbb5('0x2'));var timeout=require('connect-timeout');var express=require(_0xbbb5('0x3'));var router=express['Router']();var fs_extra=require(_0xbbb5('0x4'));var auth=require(_0xbbb5('0x5'));var interaction=require(_0xbbb5('0x6'));var config=require(_0xbbb5('0x7'));var controller=require(_0xbbb5('0x8'));router[_0xbbb5('0x9')]('/',auth['isAuthenticated'](),controller[_0xbbb5('0xa')]);router[_0xbbb5('0x9')](_0xbbb5('0xb'),auth[_0xbbb5('0xc')](),controller[_0xbbb5('0xd')]);router[_0xbbb5('0x9')](_0xbbb5('0xe'),auth['isAuthenticated'](),controller[_0xbbb5('0xf')]);router[_0xbbb5('0x9')](_0xbbb5('0x10'),auth[_0xbbb5('0xc')](),controller[_0xbbb5('0x11')]);router[_0xbbb5('0x9')](_0xbbb5('0x12'),auth['isAuthenticated'](),controller[_0xbbb5('0x13')]);router[_0xbbb5('0x9')]('/:id/users',auth[_0xbbb5('0xc')](),controller['getAgents']);router['get'](_0xbbb5('0x14'),auth['isAuthenticated'](),controller[_0xbbb5('0x15')]);router[_0xbbb5('0x16')]('/',auth[_0xbbb5('0xc')](),controller['create']);router[_0xbbb5('0x16')](_0xbbb5('0x10'),auth[_0xbbb5('0xc')](),controller[_0xbbb5('0x17')]);router['post']('/:id/canned_answers',auth[_0xbbb5('0xc')](),controller[_0xbbb5('0x18')]);router[_0xbbb5('0x16')](_0xbbb5('0x19'),auth[_0xbbb5('0xc')](),controller[_0xbbb5('0x1a')]);router[_0xbbb5('0x16')]('/:id/applications',auth[_0xbbb5('0xc')](),controller[_0xbbb5('0x1b')]);router[_0xbbb5('0x16')](_0xbbb5('0x1c'),controller[_0xbbb5('0x1d')]);router[_0xbbb5('0x16')](_0xbbb5('0x1e'),auth['isAuthenticated'](),controller['send']);router[_0xbbb5('0x1f')](_0xbbb5('0xe'),auth[_0xbbb5('0xc')](),controller[_0xbbb5('0x20')]);router['delete'](_0xbbb5('0xe'),auth['isAuthenticated'](),controller[_0xbbb5('0x21')]);router['delete'](_0xbbb5('0x10'),auth[_0xbbb5('0xc')](),controller['removeDispositions']);router[_0xbbb5('0x22')](_0xbbb5('0x12'),auth[_0xbbb5('0xc')](),controller[_0xbbb5('0x23')]);router[_0xbbb5('0x22')](_0xbbb5('0x19'),auth[_0xbbb5('0xc')](),controller[_0xbbb5('0x24')]);module[_0xbbb5('0x25')]=router; \ No newline at end of file +var _0x10dd=['get','isAuthenticated','/describe','describe','/:id','show','getDispositions','/:id/canned_answers','getAnswers','/:id/users','getAgents','/:id/applications','getApplications','post','create','/:id/dispositions','addDisposition','addAgents','addApplications','/:id/notify','notify','/:id/send','put','delete','removeDispositions','removeAnswers','removeAgents','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappAccount.controller'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x10dd,0x87));var _0xd10d=function(_0x58cf56,_0x272465){_0x58cf56=_0x58cf56-0x0;var _0x2ef7a8=_0x10dd[_0x58cf56];return _0x2ef7a8;};'use strict';var multer=require('multer');var util=require(_0xd10d('0x0'));var path=require(_0xd10d('0x1'));var timeout=require(_0xd10d('0x2'));var express=require(_0xd10d('0x3'));var router=express[_0xd10d('0x4')]();var fs_extra=require(_0xd10d('0x5'));var auth=require(_0xd10d('0x6'));var interaction=require(_0xd10d('0x7'));var config=require('../../config/environment');var controller=require(_0xd10d('0x8'));router[_0xd10d('0x9')]('/',auth[_0xd10d('0xa')](),controller['index']);router['get'](_0xd10d('0xb'),auth['isAuthenticated'](),controller[_0xd10d('0xc')]);router[_0xd10d('0x9')](_0xd10d('0xd'),auth[_0xd10d('0xa')](),controller[_0xd10d('0xe')]);router[_0xd10d('0x9')]('/:id/dispositions',auth[_0xd10d('0xa')](),controller[_0xd10d('0xf')]);router['get'](_0xd10d('0x10'),auth[_0xd10d('0xa')](),controller[_0xd10d('0x11')]);router[_0xd10d('0x9')](_0xd10d('0x12'),auth[_0xd10d('0xa')](),controller[_0xd10d('0x13')]);router['get'](_0xd10d('0x14'),auth[_0xd10d('0xa')](),controller[_0xd10d('0x15')]);router[_0xd10d('0x16')]('/',auth[_0xd10d('0xa')](),controller[_0xd10d('0x17')]);router['post'](_0xd10d('0x18'),auth[_0xd10d('0xa')](),controller[_0xd10d('0x19')]);router[_0xd10d('0x16')]('/:id/canned_answers',auth[_0xd10d('0xa')](),controller['addAnswer']);router['post'](_0xd10d('0x12'),auth['isAuthenticated'](),controller[_0xd10d('0x1a')]);router[_0xd10d('0x16')]('/:id/applications',auth['isAuthenticated'](),controller[_0xd10d('0x1b')]);router['post'](_0xd10d('0x1c'),controller[_0xd10d('0x1d')]);router[_0xd10d('0x16')](_0xd10d('0x1e'),auth[_0xd10d('0xa')](),controller['send']);router[_0xd10d('0x1f')]('/:id',auth[_0xd10d('0xa')](),controller['update']);router[_0xd10d('0x20')]('/:id',auth[_0xd10d('0xa')](),controller['destroy']);router[_0xd10d('0x20')](_0xd10d('0x18'),auth[_0xd10d('0xa')](),controller[_0xd10d('0x21')]);router[_0xd10d('0x20')](_0xd10d('0x10'),auth[_0xd10d('0xa')](),controller[_0xd10d('0x22')]);router[_0xd10d('0x20')](_0xd10d('0x12'),auth[_0xd10d('0xa')](),controller[_0xd10d('0x23')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index b21ae21..815ca42 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 _0x75d2=['BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','generate','sinch','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}'];(function(_0x4ef7ef,_0x3722d0){var _0x1e2b38=function(_0x502aa1){while(--_0x502aa1){_0x4ef7ef['push'](_0x4ef7ef['shift']());}};_0x1e2b38(++_0x3722d0);}(_0x75d2,0xd8));var _0x275d=function(_0x3d2d6f,_0x368872){_0x3d2d6f=_0x3d2d6f-0x0;var _0x5c0022=_0x75d2[_0x3d2d6f];return _0x5c0022;};'use strict';var Sequelize=require(_0x275d('0x0'));var rs=require(_0x275d('0x1'));module[_0x275d('0x2')]={'name':{'type':Sequelize[_0x275d('0x3')],'unique':_0x275d('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x275d('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x275d('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x275d('0x3')],'defaultValue':function(){return rs[_0x275d('0x5')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize['ENUM']('twilio',_0x275d('0x6'))},'accountSid':{'type':Sequelize['STRING']},'baseUrl':{'type':Sequelize[_0x275d('0x3')]},'authToken':{'type':Sequelize[_0x275d('0x3')]},'notificationTemplate':{'type':Sequelize[_0x275d('0x7')],'defaultValue':function(){return _0x275d('0x8');}},'notificationSound':{'type':Sequelize[_0x275d('0x9')],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x275d('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x275d('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x275d('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x275d('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x275d('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x275d('0xa')],'comment':_0x275d('0xb')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x315b22){if(!_0x315b22){this[_0x275d('0xc')](_0x275d('0xd'),null);}this[_0x275d('0xc')](_0x275d('0xe'),_0x315b22);}},'description':{'type':Sequelize[_0x275d('0x3')]}}; \ No newline at end of file +var _0x692a=['INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','STRING','name','ENUM','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN'];(function(_0x48d952,_0x4d41e9){var _0x4d358f=function(_0x246e7d){while(--_0x246e7d){_0x48d952['push'](_0x48d952['shift']());}};_0x4d358f(++_0x4d41e9);}(_0x692a,0x171));var _0xa692=function(_0x31ddba,_0x126ba9){_0x31ddba=_0x31ddba-0x0;var _0x2cce1e=_0x692a[_0x31ddba];return _0x2cce1e;};'use strict';var Sequelize=require(_0xa692('0x0'));var rs=require(_0xa692('0x1'));module['exports']={'name':{'type':Sequelize[_0xa692('0x2')],'unique':_0xa692('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0xa692('0x2')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0xa692('0x2')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0xa692('0x2')]},'type':{'type':Sequelize[_0xa692('0x4')]('twilio','sinch')},'accountSid':{'type':Sequelize[_0xa692('0x2')]},'baseUrl':{'type':Sequelize[_0xa692('0x2')]},'authToken':{'type':Sequelize[_0xa692('0x2')]},'notificationTemplate':{'type':Sequelize[_0xa692('0x5')],'defaultValue':function(){return _0xa692('0x6');}},'notificationSound':{'type':Sequelize[_0xa692('0x7')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xa692('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xa692('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xa692('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xa692('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xa692('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xa692('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xa692('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0xa692('0x9')},'mandatoryDisposition':{'type':Sequelize[_0xa692('0x7')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x41dbf6){if(!_0x41dbf6){this[_0xa692('0xa')](_0xa692('0xb'),null);}this[_0xa692('0xa')](_0xa692('0xc'),_0x41dbf6);}},'description':{'type':Sequelize[_0xa692('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 34f8ebf..f5444ed 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 _0x826c=['spread','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/license/util','redis','defaults','localhost','register','jayson/promise','client','http','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','destroy','WhatsappAccounts','UserProfileResource','send','index','Pause','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','name','includeAll','include','rows','catch','show','length','options','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','params','describe','WhatsappAccountId','Disposition','nolimit','findAll','removeDispositions','addAnswer','getAnswers','findOne','CannedAnswer','removeAnswers','ids','addAgents','omit','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','addApplications','sequelize','transaction','Transaction','READ_COMMITTED','WhatsappApplication','findAndCountAll','stack','finally','notify','whatsapp','Applications','account','sinch','statuses','state','read','WhatsappMessage','timestamp','applications','priority','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','mobile','twilio','From','replace','whatsapp:','Body','messageId','from','notifications','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','ListId','CmContact','DESC','list','Contacts','contact','WhatsappInteraction','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','ContactId','UserId','unshift','waitForTheAssignedAgent','queueId','queue','waitForTheAssignedQueue','Start','startRouting','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','\x0a','to\x20is\x20mandatory','List','out','user','Messages'];(function(_0x5316d4,_0x3e273a){var _0x590f57=function(_0x37718c){while(--_0x37718c){_0x5316d4['push'](_0x5316d4['shift']());}};_0x590f57(++_0x3e273a);}(_0x826c,0xc8));var _0xc826=function(_0x3ebc6b,_0x582bd8){_0x3ebc6b=_0x3ebc6b-0x0;var _0x4837de=_0x826c[_0x3ebc6b];return _0x4837de;};'use strict';var emlformat=require(_0xc826('0x0'));var rimraf=require(_0xc826('0x1'));var zipdir=require(_0xc826('0x2'));var jsonpatch=require(_0xc826('0x3'));var rp=require(_0xc826('0x4'));var moment=require(_0xc826('0x5'));var BPromise=require(_0xc826('0x6'));var Mustache=require(_0xc826('0x7'));var util=require(_0xc826('0x8'));var path=require(_0xc826('0x9'));var sox=require('sox');var csv=require(_0xc826('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc826('0xb'));var _=require('lodash');var squel=require(_0xc826('0xc'));var crypto=require(_0xc826('0xd'));var jsforce=require(_0xc826('0xe'));var deskjs=require(_0xc826('0xf'));var toCsv=require(_0xc826('0xa'));var querystring=require(_0xc826('0x10'));var Papa=require('papaparse');var Redis=require(_0xc826('0x11'));var authService=require(_0xc826('0x12'));var qs=require(_0xc826('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc826('0x14'));var logger=require('../../config/logger')(_0xc826('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc826('0x16'));var db=require('../../mysqldb')['db'];config[_0xc826('0x17')]=_[_0xc826('0x18')](config[_0xc826('0x17')],{'host':_0xc826('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc826('0x17')]));require('./whatsappAccount.socket')[_0xc826('0x1a')](socket);var jayson=require(_0xc826('0x1b'));var client=jayson[_0xc826('0x1c')][_0xc826('0x1d')]({'port':0x232c});function respondWithRpcPromise(_0x12e29c,_0x3cd94c,_0x3e1bd1,_0x475ac3){return new BPromise(function(_0x4c4205,_0x202b86){var _0x321f6b=_0x475ac3||client;return _0x321f6b['request'](_0x12e29c,_0x3e1bd1)[_0xc826('0x1e')](function(_0x96b56d){logger[_0xc826('0x1f')](_0xc826('0x20'),_0x3cd94c,_0xc826('0x21'));logger[_0xc826('0x22')](_0xc826('0x23'),_0x3cd94c,'request\x20sent',JSON[_0xc826('0x24')](_0x96b56d));if(_0x96b56d[_0xc826('0x25')]){if(_0x96b56d[_0xc826('0x25')]['code']===0x1f4){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x3cd94c,_0x96b56d[_0xc826('0x25')][_0xc826('0x26')]);return _0x202b86(_0x96b56d[_0xc826('0x25')][_0xc826('0x26')]);}logger[_0xc826('0x25')]('WhatsappAccount,\x20%s,\x20%s',_0x3cd94c,_0x96b56d[_0xc826('0x25')][_0xc826('0x26')]);return _0x4c4205(_0x96b56d[_0xc826('0x25')][_0xc826('0x26')]);}else{logger[_0xc826('0x1f')](_0xc826('0x20'),_0x3cd94c,_0xc826('0x21'));_0x4c4205(_0x96b56d[_0xc826('0x27')][_0xc826('0x26')]);}})['catch'](function(_0x175a41){logger[_0xc826('0x25')]('WhatsappAccount,\x20%s,\x20%s',_0x3cd94c,_0x175a41);_0x202b86(_0x175a41);});});}function respondWithStatusCode(_0x320c6d,_0x51884b){_0x51884b=_0x51884b||0xcc;return function(_0x4b28b2){if(_0x4b28b2){return _0x320c6d[_0xc826('0x28')](_0x51884b);}return _0x320c6d[_0xc826('0x29')](_0x51884b)[_0xc826('0x2a')]();};}function respondWithResult(_0x4c663f,_0x5ce8de){_0x5ce8de=_0x5ce8de||0xc8;return function(_0xa6cb39){if(_0xa6cb39){return _0x4c663f[_0xc826('0x29')](_0x5ce8de)['json'](_0xa6cb39);}};}function respondWithFilteredResult(_0x237230,_0xee7c58){return function(_0x598b18){if(_0x598b18){var _0x1bc35f=typeof _0xee7c58[_0xc826('0x2b')]===_0xc826('0x2c')&&typeof _0xee7c58[_0xc826('0x2d')]===_0xc826('0x2c');var _0x578885=_0x598b18[_0xc826('0x2e')];var _0x393ecd=_0x1bc35f?0x0:_0xee7c58[_0xc826('0x2b')];var _0x36957d=_0x1bc35f?_0x598b18[_0xc826('0x2e')]:_0xee7c58['offset']+_0xee7c58['limit'];var _0x134e47;if(_0x36957d>=_0x578885){_0x36957d=_0x578885;_0x134e47=0xc8;}else{_0x134e47=0xce;}_0x237230[_0xc826('0x29')](_0x134e47);return _0x237230[_0xc826('0x2f')](_0xc826('0x30'),_0x393ecd+'-'+_0x36957d+'/'+_0x578885)[_0xc826('0x31')](_0x598b18);}return null;};}function patchUpdates(_0x7e8114){return function(_0x1de8f3){try{jsonpatch[_0xc826('0x32')](_0x1de8f3,_0x7e8114,!![]);}catch(_0x4d9b26){return BPromise['reject'](_0x4d9b26);}return _0x1de8f3[_0xc826('0x33')]();};}function saveUpdates(_0x4811e6,_0x295d96){return function(_0x575ca0){if(_0x575ca0){return _0x575ca0[_0xc826('0x34')](_0x4811e6)['then'](function(_0x7ddc04){return _0x7ddc04;});}return null;};}function removeEntity(_0x94c5a8,_0x3346d8){return function(_0x3b3c24){if(_0x3b3c24){return _0x3b3c24[_0xc826('0x35')]()['then'](function(){var _0x20bba5=_0x3b3c24['get']({'plain':!![]});var _0x1f2bd0=_0xc826('0x36');return db[_0xc826('0x37')][_0xc826('0x35')]({'where':{'type':_0x1f2bd0,'resourceId':_0x20bba5['id']}})[_0xc826('0x1e')](function(){return _0x3b3c24;});})[_0xc826('0x1e')](function(){_0x94c5a8[_0xc826('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1de729,_0x42760b){return function(_0x1ae735){if(!_0x1ae735){_0x1de729[_0xc826('0x28')](0x194);}return _0x1ae735;};}function handleError(_0x472e75,_0x693f1d){_0x693f1d=_0x693f1d||0x1f4;return function(_0x4d6ecf){logger[_0xc826('0x25')](_0x4d6ecf['stack']);if(_0x4d6ecf['name']){delete _0x4d6ecf['name'];}_0x472e75[_0xc826('0x29')](_0x693f1d)[_0xc826('0x38')](_0x4d6ecf);};}exports[_0xc826('0x39')]=function(_0x1fb00c,_0x149ee2){var _0x2c8b7e={'include':[{'model':db[_0xc826('0x3a')],'as':_0xc826('0x3b')}]},_0x589844={},_0x50c716={'count':0x0,'rows':[]};var _0x26e067=_[_0xc826('0x3c')](db[_0xc826('0x3d')][_0xc826('0x3e')],function(_0xaccdbb){return{'name':_0xaccdbb[_0xc826('0x3f')],'type':_0xaccdbb[_0xc826('0x40')]['key']};});_0x589844[_0xc826('0x41')]=_[_0xc826('0x3c')](_0x26e067,'name');_0x589844['query']=_[_0xc826('0x42')](_0x1fb00c[_0xc826('0x43')]);_0x589844[_0xc826('0x44')]=_[_0xc826('0x45')](_0x589844[_0xc826('0x41')],_0x589844['query']);_0x2c8b7e[_0xc826('0x46')]=_[_0xc826('0x45')](_0x589844[_0xc826('0x41')],qs[_0xc826('0x47')](_0x1fb00c[_0xc826('0x43')][_0xc826('0x47')]));_0x2c8b7e[_0xc826('0x46')]=_0x2c8b7e[_0xc826('0x46')]['length']?_0x2c8b7e[_0xc826('0x46')]:_0x589844[_0xc826('0x41')];if(!_0x1fb00c[_0xc826('0x43')][_0xc826('0x48')]('nolimit')){_0x2c8b7e[_0xc826('0x2d')]=qs[_0xc826('0x2d')](_0x1fb00c[_0xc826('0x43')]['limit']);_0x2c8b7e[_0xc826('0x2b')]=qs[_0xc826('0x2b')](_0x1fb00c[_0xc826('0x43')][_0xc826('0x2b')]);}_0x2c8b7e[_0xc826('0x49')]=qs[_0xc826('0x4a')](_0x1fb00c[_0xc826('0x43')]['sort']);_0x2c8b7e[_0xc826('0x4b')]=qs[_0xc826('0x44')](_[_0xc826('0x4c')](_0x1fb00c['query'],_0x589844[_0xc826('0x44')]),_0x26e067);if(_0x1fb00c[_0xc826('0x43')][_0xc826('0x4d')]){_0x2c8b7e[_0xc826('0x4b')]=_[_0xc826('0x4e')](_0x2c8b7e[_0xc826('0x4b')],{'$or':_['map'](_0x26e067,function(_0x375613){if(_0x375613['type']!==_0xc826('0x4f')){var _0xd61624={};_0xd61624[_0x375613[_0xc826('0x50')]]={'$like':'%'+_0x1fb00c[_0xc826('0x43')]['filter']+'%'};return _0xd61624;}})});}_0x2c8b7e=_['merge']({},_0x2c8b7e,_0x1fb00c['options']);var _0x27899f={'where':_0x2c8b7e[_0xc826('0x4b')]};return db[_0xc826('0x3d')]['count'](_0x27899f)[_0xc826('0x1e')](function(_0x291d1e){_0x50c716['count']=_0x291d1e;if(_0x1fb00c[_0xc826('0x43')][_0xc826('0x51')]){_0x2c8b7e[_0xc826('0x52')]=[{'all':!![]}];}return db['WhatsappAccount']['findAll'](_0x2c8b7e);})[_0xc826('0x1e')](function(_0x48a361){_0x50c716[_0xc826('0x53')]=_0x48a361;return _0x50c716;})[_0xc826('0x1e')](respondWithFilteredResult(_0x149ee2,_0x2c8b7e))[_0xc826('0x54')](handleError(_0x149ee2,null));};exports[_0xc826('0x55')]=function(_0xd27583,_0x345d5a){var _0x46fa31={'raw':![],'where':{'id':_0xd27583['params']['id']},'include':[{'model':db[_0xc826('0x3a')],'as':_0xc826('0x3b')}]},_0x2e9d0f={};_0x2e9d0f[_0xc826('0x41')]=_['keys'](db[_0xc826('0x3d')][_0xc826('0x3e')]);_0x2e9d0f[_0xc826('0x43')]=_['keys'](_0xd27583[_0xc826('0x43')]);_0x2e9d0f['filters']=_[_0xc826('0x45')](_0x2e9d0f['model'],_0x2e9d0f['query']);_0x46fa31[_0xc826('0x46')]=_[_0xc826('0x45')](_0x2e9d0f['model'],qs[_0xc826('0x47')](_0xd27583[_0xc826('0x43')][_0xc826('0x47')]));_0x46fa31[_0xc826('0x46')]=_0x46fa31[_0xc826('0x46')][_0xc826('0x56')]?_0x46fa31[_0xc826('0x46')]:_0x2e9d0f['model'];if(_0xd27583['query'][_0xc826('0x51')]){_0x46fa31[_0xc826('0x52')]=[{'all':!![]}];}_0x46fa31=_[_0xc826('0x4e')]({},_0x46fa31,_0xd27583[_0xc826('0x57')]);return db[_0xc826('0x3d')][_0xc826('0x58')](_0x46fa31)[_0xc826('0x1e')](handleEntityNotFound(_0x345d5a,null))[_0xc826('0x1e')](respondWithResult(_0x345d5a,null))[_0xc826('0x54')](handleError(_0x345d5a,null));};exports[_0xc826('0x59')]=function(_0x5e7e47,_0x21b601){return db[_0xc826('0x3d')][_0xc826('0x59')](_0x5e7e47[_0xc826('0x5a')],{})[_0xc826('0x1e')](function(_0x2d73ba){var _0x5bc07e=_0x5e7e47['user'][_0xc826('0x5b')]({'plain':!![]});if(!_0x5bc07e)throw new Error(_0xc826('0x5c'));if(_0x5bc07e[_0xc826('0x5d')]==='user'){var _0x2061fc=_0x2d73ba[_0xc826('0x5b')]({'plain':!![]});var _0x21033d=_0xc826('0x36');return db[_0xc826('0x5e')]['find']({'where':{'name':_0x21033d,'userProfileId':_0x5bc07e[_0xc826('0x5f')]},'raw':!![]})[_0xc826('0x1e')](function(_0x2c2955){if(_0x2c2955&&_0x2c2955['autoAssociation']===0x0){return db[_0xc826('0x37')][_0xc826('0x59')]({'name':_0x2061fc[_0xc826('0x50')],'resourceId':_0x2061fc['id'],'type':_0x2c2955['name'],'sectionId':_0x2c2955['id']},{})['then'](function(){return _0x2d73ba;});}else{return _0x2d73ba;}})['catch'](function(_0x49ef19){logger[_0xc826('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x49ef19);throw _0x49ef19;});}return _0x2d73ba;})[_0xc826('0x1e')](respondWithResult(_0x21b601,0xc9))['catch'](handleError(_0x21b601,null));};exports['update']=function(_0x57a6fa,_0x2bdfe0){if(_0x57a6fa[_0xc826('0x5a')]['id']){delete _0x57a6fa[_0xc826('0x5a')]['id'];}return db[_0xc826('0x3d')][_0xc826('0x58')]({'where':{'id':_0x57a6fa[_0xc826('0x60')]['id']},'include':[{'model':db[_0xc826('0x3a')],'as':_0xc826('0x3b')}]})[_0xc826('0x1e')](handleEntityNotFound(_0x2bdfe0,null))[_0xc826('0x1e')](saveUpdates(_0x57a6fa[_0xc826('0x5a')],null))[_0xc826('0x1e')](respondWithResult(_0x2bdfe0,null))[_0xc826('0x54')](handleError(_0x2bdfe0,null));};exports['destroy']=function(_0x1352f4,_0x59a5f3){return db[_0xc826('0x3d')]['find']({'where':{'id':_0x1352f4[_0xc826('0x60')]['id']}})[_0xc826('0x1e')](handleEntityNotFound(_0x59a5f3,null))['then'](removeEntity(_0x59a5f3,null))[_0xc826('0x54')](handleError(_0x59a5f3,null));};exports[_0xc826('0x61')]=function(_0x52451b,_0x39c6b3){return db['WhatsappAccount'][_0xc826('0x61')]()['then'](respondWithResult(_0x39c6b3,null))[_0xc826('0x54')](handleError(_0x39c6b3,null));};exports['addDisposition']=function(_0x1e316b,_0x293560,_0x410099){if(_0x1e316b[_0xc826('0x5a')]['id']){delete _0x1e316b['body']['id'];}return db[_0xc826('0x3d')][_0xc826('0x58')]({'where':{'id':_0x1e316b[_0xc826('0x60')]['id']}})['then'](handleEntityNotFound(_0x293560,null))['then'](function(_0x1c03d3){if(_0x1c03d3){_0x1e316b[_0xc826('0x5a')][_0xc826('0x62')]=_0x1c03d3['id'];return db[_0xc826('0x63')][_0xc826('0x59')](_0x1e316b[_0xc826('0x5a')]);}})[_0xc826('0x1e')](respondWithResult(_0x293560,null))[_0xc826('0x54')](handleError(_0x293560,null));};exports['getDispositions']=function(_0x75874b,_0x349b2c,_0x4555d9){var _0x212551={'raw':![],'where':{}};var _0x5cde73={};var _0x403a60={'count':0x0,'rows':[]};return db[_0xc826('0x3d')]['findOne']({'where':{'id':_0x75874b[_0xc826('0x60')]['id']}})['then'](handleEntityNotFound(_0x349b2c,null))['then'](function(_0x6b987c){if(_0x6b987c){_0x5cde73['model']=_[_0xc826('0x42')](db[_0xc826('0x63')]['rawAttributes']);_0x5cde73['query']=_[_0xc826('0x42')](_0x75874b[_0xc826('0x43')]);_0x5cde73['filters']=_[_0xc826('0x45')](_0x5cde73['model'],_0x5cde73[_0xc826('0x43')]);_0x212551[_0xc826('0x46')]=_[_0xc826('0x45')](_0x5cde73['model'],qs[_0xc826('0x47')](_0x75874b[_0xc826('0x43')][_0xc826('0x47')]));_0x212551[_0xc826('0x46')]=_0x212551[_0xc826('0x46')]['length']?_0x212551['attributes']:_0x5cde73[_0xc826('0x41')];if(!_0x75874b[_0xc826('0x43')]['hasOwnProperty'](_0xc826('0x64'))){_0x212551[_0xc826('0x2d')]=qs[_0xc826('0x2d')](_0x75874b[_0xc826('0x43')][_0xc826('0x2d')]);_0x212551[_0xc826('0x2b')]=qs[_0xc826('0x2b')](_0x75874b[_0xc826('0x43')][_0xc826('0x2b')]);}_0x212551['order']=qs['sort'](_0x75874b['query'][_0xc826('0x4a')]);_0x212551['where']=qs[_0xc826('0x44')](_['pick'](_0x75874b['query'],_0x5cde73[_0xc826('0x44')]));_0x212551[_0xc826('0x4b')][_0xc826('0x62')]=_0x6b987c['id'];if(_0x75874b[_0xc826('0x43')]['filter']){_0x212551[_0xc826('0x4b')]=_[_0xc826('0x4e')](_0x212551[_0xc826('0x4b')],{'$or':_[_0xc826('0x3c')](_0x212551['attributes'],function(_0x1eb721){var _0x5ec409={};_0x5ec409[_0x1eb721]={'$like':'%'+_0x75874b[_0xc826('0x43')][_0xc826('0x4d')]+'%'};return _0x5ec409;})});}_0x212551=_[_0xc826('0x4e')]({},_0x212551,_0x75874b[_0xc826('0x57')]);return db[_0xc826('0x63')][_0xc826('0x2e')]({'where':_0x212551[_0xc826('0x4b')]})[_0xc826('0x1e')](function(_0x588aba){_0x403a60['count']=_0x588aba;if(_0x75874b[_0xc826('0x43')]['includeAll']){_0x212551[_0xc826('0x52')]=[{'all':!![]}];}return db['Disposition'][_0xc826('0x65')](_0x212551);})['then'](function(_0x5c6540){_0x403a60[_0xc826('0x53')]=_0x5c6540;return _0x403a60;});}})[_0xc826('0x1e')](respondWithFilteredResult(_0x349b2c,_0x212551))['catch'](handleError(_0x349b2c,null));};exports[_0xc826('0x66')]=function(_0x28f96d,_0x19cdbb,_0x45466d){return db[_0xc826('0x3d')][_0xc826('0x58')]({'where':{'id':_0x28f96d['params']['id']}})['then'](handleEntityNotFound(_0x19cdbb,null))[_0xc826('0x1e')](function(_0x247e15){if(_0x247e15){return _0x247e15[_0xc826('0x66')](_0x28f96d['query']['ids']);}})[_0xc826('0x1e')](respondWithStatusCode(_0x19cdbb,null))[_0xc826('0x54')](handleError(_0x19cdbb,null));};exports[_0xc826('0x67')]=function(_0x4f3285,_0x2f7d45,_0xfbbbba){if(_0x4f3285[_0xc826('0x5a')]['id']){delete _0x4f3285[_0xc826('0x5a')]['id'];}return db[_0xc826('0x3d')]['find']({'where':{'id':_0x4f3285[_0xc826('0x60')]['id']}})[_0xc826('0x1e')](handleEntityNotFound(_0x2f7d45,null))['then'](function(_0x4cc6cd){if(_0x4cc6cd){_0x4f3285[_0xc826('0x5a')][_0xc826('0x62')]=_0x4cc6cd['id'];return db['CannedAnswer']['create'](_0x4f3285[_0xc826('0x5a')]);}})[_0xc826('0x1e')](respondWithResult(_0x2f7d45,null))[_0xc826('0x54')](handleError(_0x2f7d45,null));};exports[_0xc826('0x68')]=function(_0x38a826,_0x3f0d65,_0x51a9f7){var _0x4e1181={'raw':![],'where':{}};var _0x2c9957={};var _0x4864f7={'count':0x0,'rows':[]};return db[_0xc826('0x3d')][_0xc826('0x69')]({'where':{'id':_0x38a826[_0xc826('0x60')]['id']}})['then'](handleEntityNotFound(_0x3f0d65,null))[_0xc826('0x1e')](function(_0x29a363){if(_0x29a363){_0x2c9957[_0xc826('0x41')]=_['keys'](db['CannedAnswer'][_0xc826('0x3e')]);_0x2c9957[_0xc826('0x43')]=_[_0xc826('0x42')](_0x38a826['query']);_0x2c9957[_0xc826('0x44')]=_[_0xc826('0x45')](_0x2c9957[_0xc826('0x41')],_0x2c9957[_0xc826('0x43')]);_0x4e1181[_0xc826('0x46')]=_['intersection'](_0x2c9957['model'],qs[_0xc826('0x47')](_0x38a826[_0xc826('0x43')]['fields']));_0x4e1181[_0xc826('0x46')]=_0x4e1181[_0xc826('0x46')][_0xc826('0x56')]?_0x4e1181['attributes']:_0x2c9957['model'];if(!_0x38a826[_0xc826('0x43')]['hasOwnProperty'](_0xc826('0x64'))){_0x4e1181[_0xc826('0x2d')]=qs[_0xc826('0x2d')](_0x38a826[_0xc826('0x43')][_0xc826('0x2d')]);_0x4e1181[_0xc826('0x2b')]=qs[_0xc826('0x2b')](_0x38a826[_0xc826('0x43')][_0xc826('0x2b')]);}_0x4e1181['order']=qs['sort'](_0x38a826[_0xc826('0x43')]['sort']);_0x4e1181[_0xc826('0x4b')]=qs[_0xc826('0x44')](_[_0xc826('0x4c')](_0x38a826[_0xc826('0x43')],_0x2c9957[_0xc826('0x44')]));_0x4e1181[_0xc826('0x4b')][_0xc826('0x62')]=_0x29a363['id'];if(_0x38a826[_0xc826('0x43')]['filter']){_0x4e1181[_0xc826('0x4b')]=_['merge'](_0x4e1181[_0xc826('0x4b')],{'$or':_['map'](_0x4e1181[_0xc826('0x46')],function(_0x460aed){var _0x1c931c={};_0x1c931c[_0x460aed]={'$like':'%'+_0x38a826[_0xc826('0x43')][_0xc826('0x4d')]+'%'};return _0x1c931c;})});}_0x4e1181=_[_0xc826('0x4e')]({},_0x4e1181,_0x38a826[_0xc826('0x57')]);return db[_0xc826('0x6a')][_0xc826('0x2e')]({'where':_0x4e1181['where']})[_0xc826('0x1e')](function(_0x2b9fc1){_0x4864f7[_0xc826('0x2e')]=_0x2b9fc1;if(_0x38a826[_0xc826('0x43')][_0xc826('0x51')]){_0x4e1181[_0xc826('0x52')]=[{'all':!![]}];}return db[_0xc826('0x6a')][_0xc826('0x65')](_0x4e1181);})[_0xc826('0x1e')](function(_0xaf00bf){_0x4864f7[_0xc826('0x53')]=_0xaf00bf;return _0x4864f7;});}})[_0xc826('0x1e')](respondWithFilteredResult(_0x3f0d65,_0x4e1181))[_0xc826('0x54')](handleError(_0x3f0d65,null));};exports['removeAnswers']=function(_0x5533be,_0x34afe3,_0x1763fc){return db['WhatsappAccount'][_0xc826('0x58')]({'where':{'id':_0x5533be[_0xc826('0x60')]['id']}})[_0xc826('0x1e')](handleEntityNotFound(_0x34afe3,null))[_0xc826('0x1e')](function(_0x237352){if(_0x237352){return _0x237352[_0xc826('0x6b')](_0x5533be['query'][_0xc826('0x6c')]);}})[_0xc826('0x1e')](respondWithStatusCode(_0x34afe3,null))['catch'](handleError(_0x34afe3,null));};exports['addAgents']=function(_0x33424a,_0x991e03,_0x7dc484){return db[_0xc826('0x3d')]['find']({'where':{'id':_0x33424a[_0xc826('0x60')]['id']}})[_0xc826('0x1e')](handleEntityNotFound(_0x991e03,null))[_0xc826('0x1e')](function(_0x4146cf){if(_0x4146cf){return _0x4146cf[_0xc826('0x6d')](_0x33424a[_0xc826('0x5a')][_0xc826('0x6c')],_[_0xc826('0x6e')](_0x33424a[_0xc826('0x5a')],[_0xc826('0x6c'),'id'])||{})['spread'](function(_0x32dece){for(var _0x44114b=0x0;_0x44114b<_0x33424a['body']['ids'][_0xc826('0x56')];_0x44114b+=0x1){socket[_0xc826('0x6f')](_0xc826('0x70'),{'UserId':Number(_0x33424a['body']['ids'][_0x44114b]),'WhatsappAccountId':Number(_0x33424a[_0xc826('0x60')]['id'])});}return _0x32dece;});}})['then'](respondWithResult(_0x991e03,null))[_0xc826('0x54')](handleError(_0x991e03,null));};exports[_0xc826('0x71')]=function(_0x56abac,_0x2128d5,_0x46ee6d){return db[_0xc826('0x3d')][_0xc826('0x58')]({'where':{'id':_0x56abac[_0xc826('0x60')]['id']}})[_0xc826('0x1e')](handleEntityNotFound(_0x2128d5,null))['then'](function(_0x1b54f2){if(_0x1b54f2){return _0x1b54f2[_0xc826('0x71')](_0x56abac['query'][_0xc826('0x6c')])[_0xc826('0x1e')](function(){if(_[_0xc826('0x72')](_0x56abac[_0xc826('0x43')][_0xc826('0x6c')])){for(var _0x31b809=0x0;_0x31b809<_0x56abac['query'][_0xc826('0x6c')][_0xc826('0x56')];_0x31b809+=0x1){socket[_0xc826('0x6f')](_0xc826('0x73'),{'UserId':Number(_0x56abac[_0xc826('0x43')][_0xc826('0x6c')][_0x31b809]),'WhatsappAccountId':Number(_0x56abac['params']['id'])});}}else{socket[_0xc826('0x6f')]('userWhatsappAccount:remove',{'UserId':Number(_0x56abac[_0xc826('0x43')][_0xc826('0x6c')]),'WhatsappAccountId':Number(_0x56abac[_0xc826('0x60')]['id'])});}});}})[_0xc826('0x1e')](respondWithStatusCode(_0x2128d5,null))[_0xc826('0x54')](handleError(_0x2128d5,null));};exports[_0xc826('0x74')]=function(_0x1720cf,_0x57201f,_0x1012c1){var _0x24f408={};var _0x18e123={};var _0x535331;var _0x41f634;return db[_0xc826('0x3d')][_0xc826('0x69')]({'where':{'id':_0x1720cf[_0xc826('0x60')]['id']}})[_0xc826('0x1e')](handleEntityNotFound(_0x57201f,null))[_0xc826('0x1e')](function(_0x22f032){if(_0x22f032){_0x535331=_0x22f032;_0x18e123[_0xc826('0x41')]=_[_0xc826('0x42')](db[_0xc826('0x75')][_0xc826('0x3e')]);_0x18e123[_0xc826('0x43')]=_[_0xc826('0x42')](_0x1720cf[_0xc826('0x43')]);_0x18e123[_0xc826('0x44')]=_[_0xc826('0x45')](_0x18e123[_0xc826('0x41')],_0x18e123[_0xc826('0x43')]);_0x24f408[_0xc826('0x46')]=_[_0xc826('0x45')](_0x18e123[_0xc826('0x41')],qs['fields'](_0x1720cf['query'][_0xc826('0x47')]));_0x24f408[_0xc826('0x46')]=_0x24f408[_0xc826('0x46')]['length']?_0x24f408[_0xc826('0x46')]:_0x18e123[_0xc826('0x41')];_0x24f408[_0xc826('0x49')]=qs[_0xc826('0x4a')](_0x1720cf[_0xc826('0x43')]['sort']);_0x24f408[_0xc826('0x4b')]=qs[_0xc826('0x44')](_[_0xc826('0x4c')](_0x1720cf['query'],_0x18e123['filters']));if(_0x1720cf[_0xc826('0x43')]['filter']){_0x24f408[_0xc826('0x4b')]=_['merge'](_0x24f408[_0xc826('0x4b')],{'$or':_[_0xc826('0x3c')](_0x24f408['attributes'],function(_0x2b6c0b){var _0x714795={};_0x714795[_0x2b6c0b]={'$like':'%'+_0x1720cf[_0xc826('0x43')][_0xc826('0x4d')]+'%'};return _0x714795;})});}_0x24f408=_['merge']({},_0x24f408,_0x1720cf[_0xc826('0x57')]);return _0x535331[_0xc826('0x74')](_0x24f408);}})[_0xc826('0x1e')](function(_0x49db56){if(_0x49db56){_0x41f634=_0x49db56[_0xc826('0x56')];if(!_0x1720cf[_0xc826('0x43')]['hasOwnProperty'](_0xc826('0x64'))){_0x24f408[_0xc826('0x2d')]=qs['limit'](_0x1720cf[_0xc826('0x43')][_0xc826('0x2d')]);_0x24f408[_0xc826('0x2b')]=qs[_0xc826('0x2b')](_0x1720cf['query'][_0xc826('0x2b')]);}return _0x535331[_0xc826('0x74')](_0x24f408);}})['then'](function(_0x48dc58){if(_0x48dc58){return _0x48dc58?{'count':_0x41f634,'rows':_0x48dc58}:null;}})[_0xc826('0x1e')](respondWithResult(_0x57201f,null))[_0xc826('0x54')](handleError(_0x57201f,null));};exports[_0xc826('0x76')]=function(_0x506892,_0x218512){var _0x415301=_0x506892[_0xc826('0x60')]['id'];var _0x154609=_0x506892[_0xc826('0x5a')];var _0x2d775a=0xc8;var _0x5797ec=null;return db[_0xc826('0x77')][_0xc826('0x78')]({'isolationLevel':db['sequelize'][_0xc826('0x79')]['ISOLATION_LEVELS'][_0xc826('0x7a')]},function(_0x4ab1ce){return db['WhatsappAccount'][_0xc826('0x69')]({'where':{'id':_0x415301},'transaction':_0x4ab1ce})[_0xc826('0x1e')](function(_0x224877){if(_0x224877){return db['WhatsappApplication'][_0xc826('0x35')]({'where':{'WhatsappAccountId':_0x415301},'transaction':_0x4ab1ce})[_0xc826('0x1e')](function(){var _0xb158dd=_[_0xc826('0x3c')](_0x154609,function(_0x46f6da){_0x46f6da['WhatsappAccountId']=_0x415301;return _0x46f6da;});return db[_0xc826('0x7b')]['bulkCreate'](_0xb158dd,{'transaction':_0x4ab1ce});});}else{_0x2d775a=0x194;_0x5797ec=[];}});})[_0xc826('0x1e')](function(){if(_0x2d775a!==0x194){return db['WhatsappApplication'][_0xc826('0x7c')]({'where':{'WhatsappAccountId':_0x415301},'order':'priority'})['then'](function(_0x37a012){_0x5797ec=_0x37a012;});}})['catch'](function(_0xdf9cb3){_0x2d775a=0x1f4;logger[_0xc826('0x25')](_0xdf9cb3[_0xc826('0x7d')]);if(_0xdf9cb3['name']){delete _0xdf9cb3[_0xc826('0x50')];}_0x5797ec=_0xdf9cb3;})[_0xc826('0x7e')](function(){if(_0x5797ec===null){_0x218512['sendStatus'](_0x2d775a);}else{if(_0x2d775a===0x1f4){_0x218512['status'](_0x2d775a)[_0xc826('0x38')](_0x5797ec);}else{_0x218512['status'](_0x2d775a)[_0xc826('0x31')](_0x5797ec);}}});};exports['getApplications']=function(_0x12dd9d,_0x55a7ca,_0x729be4){var _0x626add={};var _0x2f6271={};var _0xeb292;var _0x3f88f4;return db['WhatsappAccount'][_0xc826('0x69')]({'where':{'id':_0x12dd9d[_0xc826('0x60')]['id']}})[_0xc826('0x1e')](handleEntityNotFound(_0x55a7ca,null))[_0xc826('0x1e')](function(_0x324659){if(_0x324659){_0xeb292=_0x324659;_0x2f6271[_0xc826('0x41')]=_[_0xc826('0x42')](db['WhatsappApplication'][_0xc826('0x3e')]);_0x2f6271[_0xc826('0x43')]=_[_0xc826('0x42')](_0x12dd9d[_0xc826('0x43')]);_0x2f6271[_0xc826('0x44')]=_[_0xc826('0x45')](_0x2f6271['model'],_0x2f6271[_0xc826('0x43')]);_0x626add[_0xc826('0x46')]=_[_0xc826('0x45')](_0x2f6271[_0xc826('0x41')],qs['fields'](_0x12dd9d[_0xc826('0x43')][_0xc826('0x47')]));_0x626add['attributes']=_0x626add[_0xc826('0x46')][_0xc826('0x56')]?_0x626add[_0xc826('0x46')]:_0x2f6271['model'];_0x626add[_0xc826('0x49')]=qs['sort'](_0x12dd9d[_0xc826('0x43')]['sort']);_0x626add['where']=qs[_0xc826('0x44')](_[_0xc826('0x4c')](_0x12dd9d['query'],_0x2f6271[_0xc826('0x44')]));if(_0x12dd9d[_0xc826('0x43')][_0xc826('0x4d')]){_0x626add['where']=_[_0xc826('0x4e')](_0x626add[_0xc826('0x4b')],{'$or':_[_0xc826('0x3c')](_0x626add[_0xc826('0x46')],function(_0x2441f5){var _0x76c1={};_0x76c1[_0x2441f5]={'$like':'%'+_0x12dd9d[_0xc826('0x43')][_0xc826('0x4d')]+'%'};return _0x76c1;})});}_0x626add=_[_0xc826('0x4e')]({},_0x626add,_0x12dd9d[_0xc826('0x57')]);return _0xeb292['getApplications'](_0x626add);}})[_0xc826('0x1e')](function(_0x12b1e9){if(_0x12b1e9){_0x3f88f4=_0x12b1e9[_0xc826('0x56')];if(!_0x12dd9d[_0xc826('0x43')]['hasOwnProperty'](_0xc826('0x64'))){_0x626add[_0xc826('0x2d')]=qs[_0xc826('0x2d')](_0x12dd9d[_0xc826('0x43')][_0xc826('0x2d')]);_0x626add[_0xc826('0x2b')]=qs['offset'](_0x12dd9d[_0xc826('0x43')][_0xc826('0x2b')]);}return _0xeb292['getApplications'](_0x626add);}})[_0xc826('0x1e')](function(_0x1550f7){if(_0x1550f7){return _0x1550f7?{'count':_0x3f88f4,'rows':_0x1550f7}:null;}})[_0xc826('0x1e')](respondWithResult(_0x55a7ca,null))[_0xc826('0x54')](handleError(_0x55a7ca,null));};exports[_0xc826('0x7f')]=function(_0x15d98e,_0x3b5090,_0x3a39c6){var _0x5c0a66={'channel':_0xc826('0x80')};var _0x50ea74=[];var _0x255b26=[];var _0x5e2b75={};return db['WhatsappAccount'][_0xc826('0x58')]({'where':{'id':_0x15d98e[_0xc826('0x60')]['id']},'include':[{'model':db[_0xc826('0x7b')],'as':_0xc826('0x81')}]})[_0xc826('0x1e')](handleEntityNotFound(_0x3b5090,null))[_0xc826('0x1e')](function(_0x2db320){_0x5c0a66['account']=_0x2db320;if(_0x5c0a66[_0xc826('0x82')]&&_0x5c0a66[_0xc826('0x82')][_0xc826('0x40')]===_0xc826('0x83')&&_0x15d98e[_0xc826('0x5a')][_0xc826('0x84')]){if(_0x15d98e[_0xc826('0x5a')][_0xc826('0x84')][_0xc826('0x56')]===0x0)return;if(_0x15d98e[_0xc826('0x5a')][_0xc826('0x84')][0x0][_0xc826('0x85')]!==_0xc826('0x86'))return;return db[_0xc826('0x87')][_0xc826('0x34')]({'read':!![],'readAt':_0x15d98e[_0xc826('0x5a')][_0xc826('0x84')][0x0][_0xc826('0x88')]},{'where':{'messageId':_0x15d98e['body'][_0xc826('0x84')][0x0]['message_id']},'individualHooks':!![]})['then'](function(_0x3420c4){return _0x3b5090[_0xc826('0x29')](0xc8)['json'](_0x3420c4);});}_0x5c0a66[_0xc826('0x89')]=_['orderBy'](_0x2db320['Applications'],[_0xc826('0x8a')],['asc']);if(_0x5c0a66[_0xc826('0x82')][_0xc826('0x81')]){delete _0x5c0a66['account'][_0xc826('0x81')];}return db['CmContact'][_0xc826('0x61')]()[_0xc826('0x1e')](function(_0xb122dc){if(!_0xb122dc){throw new db[(_0xc826('0x8b'))][(_0xc826('0x8c'))](_0xc826('0x8d'));}_0x50ea74=_['difference'](_[_0xc826('0x42')](_0xb122dc),[_0xc826('0x8e'),_0xc826('0x8f')]);_0x255b26=_[_0xc826('0x90')](_[_0xc826('0x42')](_0xb122dc),['createdAt',_0xc826('0x8f'),_0xc826('0x91'),'ListId']);_0x5c0a66[_0xc826('0x5a')]={'mapKey':_0xc826('0x92')};if(_0x5c0a66[_0xc826('0x82')]&&_0x5c0a66[_0xc826('0x82')][_0xc826('0x40')]===_0xc826('0x93')){_0x5c0a66[_0xc826('0x5a')]['from']=_0x15d98e['body'][_0xc826('0x94')][_0xc826('0x95')](_0xc826('0x96'),'');_0x5c0a66[_0xc826('0x5a')]['body']=_0x15d98e['body'][_0xc826('0x97')];_0x5c0a66[_0xc826('0x5a')][_0xc826('0x98')]=_0x15d98e[_0xc826('0x5a')]['MessageSid'];}if(_0x5c0a66['account']&&_0x5c0a66['account']['type']==='sinch'){_0x5c0a66[_0xc826('0x5a')][_0xc826('0x99')]=_0x15d98e[_0xc826('0x5a')][_0xc826('0x9a')][0x0]['from'];_0x5c0a66[_0xc826('0x5a')][_0xc826('0x5a')]=_0x15d98e['body'][_0xc826('0x9a')][0x0]['message'][_0xc826('0x5a')];_0x5c0a66[_0xc826('0x5a')][_0xc826('0x98')]=_0x15d98e['body'][_0xc826('0x9a')][0x0]['message_id'];}if(_0x5c0a66['body']['id']){delete _0x5c0a66[_0xc826('0x5a')]['id'];}if(_[_0xc826('0x9b')](_0x5c0a66[_0xc826('0x5a')][_0xc826('0x99')])){throw new db[(_0xc826('0x8b'))]['ValidationError']('from\x20is\x20mandatory');}if(_[_0xc826('0x9b')](_0x5c0a66[_0xc826('0x5a')][_0xc826('0x5a')])||_0x5c0a66[_0xc826('0x5a')][_0xc826('0x5a')]===''){throw new db[(_0xc826('0x8b'))][(_0xc826('0x8c'))](_0xc826('0x9c'));}if(_['isNil'](_0x5c0a66['body'][_0xc826('0x9d')])){throw new db[(_0xc826('0x8b'))]['ValidationError'](_0xc826('0x9e')+_0x255b26);}if(!_[_0xc826('0x9f')](_0x255b26,_0x5c0a66[_0xc826('0x5a')][_0xc826('0x9d')])){throw new db[(_0xc826('0x8b'))][(_0xc826('0x8c'))](_0xc826('0xa0')+_0x255b26);}_0x5e2b75[_0x5c0a66[_0xc826('0x5a')][_0xc826('0x9d')]]=_0x5c0a66[_0xc826('0x5a')][_0xc826('0x99')];return db[_0xc826('0xa1')][_0xc826('0x58')]({'where':{'id':_0x5c0a66['account'][_0xc826('0xa2')]},'include':[{'model':db[_0xc826('0xa3')],'as':'Contacts','where':_0x5e2b75,'limit':0x1,'order':[[_0xc826('0x8f'),_0xc826('0xa4')]]}]});})[_0xc826('0x1e')](handleEntityNotFound(_0x3b5090,null))['then'](function(_0x4aa7eb){if(_0x4aa7eb){_0x5c0a66[_0xc826('0xa5')]=_[_0xc826('0x6e')](_0x4aa7eb,[_0xc826('0xa6')]);if(_0x4aa7eb[_0xc826('0xa6')][_0xc826('0x56')]){return _0x4aa7eb[_0xc826('0xa6')][0x0];}var _0x3306b7=_['defaults'](_0x5c0a66[_0xc826('0x5a')],{'firstName':_0x5c0a66['body'][_0xc826('0x99')],'ListId':_0x4aa7eb['id']});_0x3306b7[_0x5c0a66[_0xc826('0x5a')][_0xc826('0x9d')]]=_0x5c0a66[_0xc826('0x5a')][_0xc826('0x99')];return db[_0xc826('0xa3')]['create'](_0x3306b7,{'fields':_0x50ea74,'raw':!![]});}})[_0xc826('0x1e')](handleEntityNotFound(_0x3b5090,null))[_0xc826('0x1e')](function(_0x71f57e){if(_0x71f57e){_0x5c0a66[_0xc826('0xa7')]=_0x71f57e;var _0x44a07b={'ContactId':_0x71f57e['id'],'phone':_0x5c0a66[_0xc826('0x5a')][_0xc826('0x99')],'WhatsappAccountId':_0x15d98e[_0xc826('0x60')]['id']};var _0x2ad90a={'ContactId':_0x71f57e['id'],'WhatsappAccountId':_0x15d98e['params']['id'],'closed':![]};return db['WhatsappInteraction'][_0xc826('0x58')]({'where':_0x2ad90a})[_0xc826('0x1e')](function(_0x28d041){if(_0x28d041){return[_0x28d041,![]];}return db[_0xc826('0xa8')][_0xc826('0x59')](_0x44a07b)[_0xc826('0x1e')](function(_0x21f3b1){return[_0x21f3b1,!![]];});});}})['spread'](function(_0x4a7438,_0x598d78){_0x5c0a66[_0xc826('0xa9')]=_0x4a7438[_0xc826('0x5b')]({'plain':!![]});_0x5c0a66['interaction'][_0xc826('0xaa')]=![];if(_0x598d78){if(_0x5c0a66[_0xc826('0x82')][_0xc826('0xab')]){_0x5c0a66[_0xc826('0x89')][_0xc826('0xac')]({'id':0x0,'priority':_0x5c0a66[_0xc826('0x89')][_0xc826('0x56')]+0x1,'app':_0xc826('0xad'),'appdata':_0xc826('0xae'),'interval':_0xc826('0xaf')});}_0x5c0a66[_0xc826('0xa9')][_0xc826('0xaa')]=!![];}return db[_0xc826('0x87')]['create']({'phone':_0x5c0a66[_0xc826('0x5a')][_0xc826('0x99')],'messageId':_0x5c0a66['body']['messageId'],'body':_0x5c0a66[_0xc826('0x5a')][_0xc826('0x5a')],'WhatsappAccountId':_0x15d98e[_0xc826('0x60')]['id'],'WhatsappInteractionId':_0x4a7438['id'],'direction':'in','ContactId':_0x4a7438[_0xc826('0xb0')],'AttachmentId':_0x5c0a66[_0xc826('0x5a')]['AttachmentId']});})[_0xc826('0x1e')](function(_0x5bb7fa){_0x5c0a66['message']=_0x5bb7fa;if(!_0x5c0a66[_0xc826('0xa9')][_0xc826('0xb1')])return;return db[_0xc826('0x75')]['find']({'attributes':['id',_0xc826('0x50')],'where':{'id':_0x5c0a66[_0xc826('0xa9')][_0xc826('0xb1')]}});})[_0xc826('0x1e')](function(_0xc283bc){if(_0xc283bc){_0x5c0a66[_0xc826('0x89')][_0xc826('0xb2')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0xc283bc[_0xc826('0x50')]+','+(_0x5c0a66['account'][_0xc826('0xb3')]||0xa),'interval':_0xc826('0xaf')});}if(!_0x5c0a66[_0xc826('0xa9')][_0xc826('0xb4')])return;return db['WhatsappQueue'][_0xc826('0x58')]({'attributes':['id',_0xc826('0x50')],'where':{'id':_0x5c0a66[_0xc826('0xa9')][_0xc826('0xb4')]}});})['then'](function(_0x53c6a0){if(_0x53c6a0){_0x5c0a66['applications'][_0xc826('0xb2')]({'id':0x0,'priority':0x1,'app':_0xc826('0xb5'),'appdata':_0x53c6a0[_0xc826('0x50')]+','+(_0x5c0a66['account'][_0xc826('0xb6')]||0x12c),'interval':_0xc826('0xaf')});}return respondWithRpcPromise(_0xc826('0xb7'),_0xc826('0xb8'),_0x5c0a66);})[_0xc826('0x1e')](function(_0x1ba108){if(_0x1ba108){var _0x5d4054=0xc8;var _0x3d3e8e=_0xc826('0xb9');logger[_0xc826('0x1f')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x3d3e8e,_0x5d4054,_0xc826('0xba'));logger[_0xc826('0x22')](_0xc826('0xbb'),_0x3d3e8e,_0x5d4054,_0xc826('0xba'),JSON[_0xc826('0x24')](_0x1ba108));if(_0x5c0a66[_0xc826('0x82')]['type']===_0xc826('0x93')){return _0x3b5090[_0xc826('0x29')](_0x5d4054)[_0xc826('0x2f')](_0xc826('0xbc'),_0xc826('0xbd'))[_0xc826('0x38')](_0xc826('0xbe'));}else{return _0x3b5090[_0xc826('0x29')](_0x5d4054)['json'](_0x1ba108);}}});})[_0xc826('0x54')](handleError(_0x3b5090,null));};exports[_0xc826('0x38')]=function(_0x5a1a38,_0x9f9926,_0x18e606){var _0x382d3c,_0x1bfe5d,_0x3eba13;if(_['isNil'](_0x5a1a38[_0xc826('0x5a')][_0xc826('0x5a')])||_0x5a1a38[_0xc826('0x5a')][_0xc826('0x5a')]===''){throw new db[(_0xc826('0x8b'))]['ValidationError'](_0xc826('0x9c'));}if(_[_0xc826('0x9b')](_0x5a1a38[_0xc826('0x5a')]['to'])){throw new db['Sequelize'][(_0xc826('0x8c'))](_0xc826('0xbf'));}_0x382d3c=_0x5a1a38[_0xc826('0x5a')]['to'];return db[_0xc826('0x3d')][_0xc826('0x58')]({'where':{'id':_0x5a1a38[_0xc826('0x60')]['id']},'include':[{'model':db[_0xc826('0xa1')],'as':'List','include':[{'model':db[_0xc826('0xa3')],'as':'Contacts','where':{'mobile':_0x382d3c},'limit':0x1,'order':[['updatedAt',_0xc826('0xa4')]]}]}]})[_0xc826('0x1e')](handleEntityNotFound(_0x9f9926,null))['then'](function(_0x2d7405){if(_0x2d7405&&_0x2d7405[_0xc826('0xc0')]){_0x1bfe5d=_0x2d7405[_0xc826('0x5b')]({'plain':!![]});if(_0x1bfe5d['List']&&_0x1bfe5d[_0xc826('0xc0')][_0xc826('0xa6')][_0xc826('0x56')]){return _0x1bfe5d[_0xc826('0xc0')]['Contacts'][0x0];}return db[_0xc826('0xa3')][_0xc826('0x59')](_[_0xc826('0x18')](_0x5a1a38['body'],{'firstName':_0x382d3c,'mobile':_0x382d3c,'phone':_0x382d3c,'ListId':_0x1bfe5d[_0xc826('0xa2')]}));}})[_0xc826('0x1e')](handleEntityNotFound(_0x9f9926,null))[_0xc826('0x1e')](function(_0x5dd448){if(_0x5dd448){_0x3eba13=_0x5dd448;return db[_0xc826('0xa8')][_0xc826('0x58')]({'where':{'ContactId':_0x3eba13['id'],'closed':![],'WhatsappAccountId':_0x1bfe5d['id']}})[_0xc826('0x1e')](function(_0x35633c){if(_0x35633c){return[_0x35633c,![]];}return db[_0xc826('0xa8')][_0xc826('0x59')]({'UserId':_0x5a1a38['user']['id'],'ContactId':_0x3eba13['id'],'WhatsappAccountId':_0x1bfe5d['id'],'phone':_0x382d3c,'firstMsgDirection':_0xc826('0xc1'),'Messages':[_['merge'](_0x5a1a38[_0xc826('0x5a')],{'read':![],'body':_0x5a1a38[_0xc826('0x5a')][_0xc826('0x5a')],'phone':_0x382d3c,'WhatsappAccountId':_0x1bfe5d['id'],'UserId':_0x5a1a38[_0xc826('0xc2')]['id'],'ContactId':_0x3eba13['id']})]},{'include':[{'model':db[_0xc826('0x87')],'as':_0xc826('0xc3')}]})['then'](function(_0x31e610){return[_0x31e610,!![]];});});}})[_0xc826('0xc4')](function(_0x1ab247,_0x578f20){if(_0x578f20){return _0x1ab247;}return db[_0xc826('0x87')][_0xc826('0x59')](_[_0xc826('0x4e')](_0x5a1a38['body'],{'read':![],'body':_0x5a1a38[_0xc826('0x5a')][_0xc826('0x5a')],'phone':_0x382d3c,'WhatsappAccountId':_0x1bfe5d['id'],'WhatsappInteractionId':_0x1ab247['id'],'UserId':_0x5a1a38['user']['id'],'ContactId':_0x3eba13['id']}))[_0xc826('0x1e')](function(_0x6d14bf){_0x1ab247['dataValues']['Messages']=[];_0x1ab247[_0xc826('0xc5')][_0xc826('0xc3')][_0xc826('0xac')](_0x6d14bf[_0xc826('0xc5')]);return _0x1ab247;});})[_0xc826('0x1e')](respondWithResult(_0x9f9926,null))[_0xc826('0x54')](handleError(_0x9f9926,null));}; \ No newline at end of file +var _0xa405=['asc','CmContact','Sequelize','ValidationError','difference','createdAt','updatedAt','ListId','mobile','twilio','from','From','replace','whatsapp:','Body','MessageSid','sinch','notifications','messageId','message_id','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','Contacts','DESC','list','contact','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','ContactId','UserId','waitForTheAssignedAgent','queueId','WhatsappQueue','unshift','waitForTheAssignedQueue','Start','startRouting','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','\x0a','to\x20is\x20mandatory','List','defaults','out','Messages','dataValues','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','info','WhatsappAccount,\x20%s,\x20%s','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','get','UserProfileResource','destroy','stack','name','index','Pause','mandatoryDispositionPause','map','WhatsappAccount','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','rows','keys','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','WhatsappAccounts','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','Disposition','getDispositions','findOne','rawAttributes','pick','WhatsappAccountId','removeDispositions','addAnswer','CannedAnswer','getAnswers','findAll','removeAnswers','ids','addAgents','omit','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','nolimit','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','finally','send','getApplications','notify','Applications','account','statuses','state','read','WhatsappMessage','timestamp','applications','orderBy','priority'];(function(_0x411aa9,_0x42da07){var _0xdb7063=function(_0x1fe6d1){while(--_0x1fe6d1){_0x411aa9['push'](_0x411aa9['shift']());}};_0xdb7063(++_0x42da07);}(_0xa405,0x1ca));var _0x5a40=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xa405[_0x2641f9];return _0x585741;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5a40('0x0'));var zipdir=require(_0x5a40('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5a40('0x2'));var moment=require(_0x5a40('0x3'));var BPromise=require(_0x5a40('0x4'));var Mustache=require(_0x5a40('0x5'));var util=require(_0x5a40('0x6'));var path=require('path');var sox=require(_0x5a40('0x7'));var csv=require(_0x5a40('0x8'));var ejs=require(_0x5a40('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x5a40('0xa'));var deskjs=require(_0x5a40('0xb'));var toCsv=require(_0x5a40('0x8'));var querystring=require(_0x5a40('0xc'));var Papa=require(_0x5a40('0xd'));var Redis=require(_0x5a40('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5a40('0xf'));var logger=require('../../config/logger')(_0x5a40('0x10'));var utils=require('../../config/utils');var config=require(_0x5a40('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0x5a40('0x12'))['db'];config[_0x5a40('0x13')]=_['defaults'](config[_0x5a40('0x13')],{'host':_0x5a40('0x14'),'port':0x18eb});var socket=require(_0x5a40('0x15'))(new Redis(config['redis']));require(_0x5a40('0x16'))[_0x5a40('0x17')](socket);var jayson=require(_0x5a40('0x18'));var client=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x56ec80,_0x12cc02,_0x1181fe,_0x1c0e57){return new BPromise(function(_0x20112f,_0x5a8270){var _0x20e4c0=_0x1c0e57||client;return _0x20e4c0['request'](_0x56ec80,_0x1181fe)['then'](function(_0x5c69c1){logger[_0x5a40('0x19')](_0x5a40('0x1a'),_0x12cc02,'request\x20sent');logger[_0x5a40('0x1b')](_0x5a40('0x1c'),_0x12cc02,_0x5a40('0x1d'),JSON[_0x5a40('0x1e')](_0x5c69c1));if(_0x5c69c1[_0x5a40('0x1f')]){if(_0x5c69c1['error'][_0x5a40('0x20')]===0x1f4){logger[_0x5a40('0x1f')]('WhatsappAccount,\x20%s,\x20%s',_0x12cc02,_0x5c69c1[_0x5a40('0x1f')][_0x5a40('0x21')]);return _0x5a8270(_0x5c69c1[_0x5a40('0x1f')][_0x5a40('0x21')]);}logger[_0x5a40('0x1f')](_0x5a40('0x1a'),_0x12cc02,_0x5c69c1['error'][_0x5a40('0x21')]);return _0x20112f(_0x5c69c1[_0x5a40('0x1f')][_0x5a40('0x21')]);}else{logger[_0x5a40('0x19')](_0x5a40('0x1a'),_0x12cc02,_0x5a40('0x1d'));_0x20112f(_0x5c69c1[_0x5a40('0x22')][_0x5a40('0x21')]);}})[_0x5a40('0x23')](function(_0x4ca585){logger[_0x5a40('0x1f')](_0x5a40('0x1a'),_0x12cc02,_0x4ca585);_0x5a8270(_0x4ca585);});});}function respondWithStatusCode(_0x358012,_0x1c4a09){_0x1c4a09=_0x1c4a09||0xcc;return function(_0x55da80){if(_0x55da80){return _0x358012[_0x5a40('0x24')](_0x1c4a09);}return _0x358012[_0x5a40('0x25')](_0x1c4a09)[_0x5a40('0x26')]();};}function respondWithResult(_0x4758ae,_0x36188d){_0x36188d=_0x36188d||0xc8;return function(_0x44ed8f){if(_0x44ed8f){return _0x4758ae[_0x5a40('0x25')](_0x36188d)[_0x5a40('0x27')](_0x44ed8f);}};}function respondWithFilteredResult(_0x49fa77,_0x16dc8c){return function(_0x1aba06){if(_0x1aba06){var _0x4e1223=typeof _0x16dc8c['offset']===_0x5a40('0x28')&&typeof _0x16dc8c[_0x5a40('0x29')]===_0x5a40('0x28');var _0xdeeea7=_0x1aba06[_0x5a40('0x2a')];var _0x3e422d=_0x4e1223?0x0:_0x16dc8c['offset'];var _0x5b9f43=_0x4e1223?_0x1aba06['count']:_0x16dc8c[_0x5a40('0x2b')]+_0x16dc8c['limit'];var _0xf68af2;if(_0x5b9f43>=_0xdeeea7){_0x5b9f43=_0xdeeea7;_0xf68af2=0xc8;}else{_0xf68af2=0xce;}_0x49fa77['status'](_0xf68af2);return _0x49fa77[_0x5a40('0x2c')](_0x5a40('0x2d'),_0x3e422d+'-'+_0x5b9f43+'/'+_0xdeeea7)[_0x5a40('0x27')](_0x1aba06);}return null;};}function patchUpdates(_0xf90875){return function(_0x4bad46){try{jsonpatch[_0x5a40('0x2e')](_0x4bad46,_0xf90875,!![]);}catch(_0x441d99){return BPromise[_0x5a40('0x2f')](_0x441d99);}return _0x4bad46[_0x5a40('0x30')]();};}function saveUpdates(_0x15a17c,_0x69908f){return function(_0x1344a1){if(_0x1344a1){return _0x1344a1[_0x5a40('0x31')](_0x15a17c)['then'](function(_0x227374){return _0x227374;});}return null;};}function removeEntity(_0x5d2f00,_0x5a33cf){return function(_0x4f90e4){if(_0x4f90e4){return _0x4f90e4['destroy']()[_0x5a40('0x32')](function(){var _0x2ee9ab=_0x4f90e4[_0x5a40('0x33')]({'plain':!![]});var _0x4deb92='WhatsappAccounts';return db[_0x5a40('0x34')][_0x5a40('0x35')]({'where':{'type':_0x4deb92,'resourceId':_0x2ee9ab['id']}})[_0x5a40('0x32')](function(){return _0x4f90e4;});})[_0x5a40('0x32')](function(){_0x5d2f00['status'](0xcc)[_0x5a40('0x26')]();});}};}function handleEntityNotFound(_0x13cc0b,_0x3eeb8e){return function(_0x3e5596){if(!_0x3e5596){_0x13cc0b[_0x5a40('0x24')](0x194);}return _0x3e5596;};}function handleError(_0x4d8387,_0x52b3c3){_0x52b3c3=_0x52b3c3||0x1f4;return function(_0x457c06){logger[_0x5a40('0x1f')](_0x457c06[_0x5a40('0x36')]);if(_0x457c06['name']){delete _0x457c06[_0x5a40('0x37')];}_0x4d8387['status'](_0x52b3c3)['send'](_0x457c06);};}exports[_0x5a40('0x38')]=function(_0x5fd51b,_0x4fd509){var _0x45f802={'include':[{'model':db[_0x5a40('0x39')],'as':_0x5a40('0x3a')}]},_0x408e31={},_0x56e286={'count':0x0,'rows':[]};var _0x1420c6=_[_0x5a40('0x3b')](db[_0x5a40('0x3c')]['rawAttributes'],function(_0x336875){return{'name':_0x336875['fieldName'],'type':_0x336875['type'][_0x5a40('0x3d')]};});_0x408e31['model']=_[_0x5a40('0x3b')](_0x1420c6,_0x5a40('0x37'));_0x408e31[_0x5a40('0x3e')]=_['keys'](_0x5fd51b[_0x5a40('0x3e')]);_0x408e31[_0x5a40('0x3f')]=_[_0x5a40('0x40')](_0x408e31[_0x5a40('0x41')],_0x408e31[_0x5a40('0x3e')]);_0x45f802['attributes']=_['intersection'](_0x408e31[_0x5a40('0x41')],qs['fields'](_0x5fd51b['query'][_0x5a40('0x42')]));_0x45f802[_0x5a40('0x43')]=_0x45f802[_0x5a40('0x43')][_0x5a40('0x44')]?_0x45f802[_0x5a40('0x43')]:_0x408e31[_0x5a40('0x41')];if(!_0x5fd51b[_0x5a40('0x3e')][_0x5a40('0x45')]('nolimit')){_0x45f802[_0x5a40('0x29')]=qs['limit'](_0x5fd51b['query'][_0x5a40('0x29')]);_0x45f802[_0x5a40('0x2b')]=qs[_0x5a40('0x2b')](_0x5fd51b[_0x5a40('0x3e')][_0x5a40('0x2b')]);}_0x45f802[_0x5a40('0x46')]=qs[_0x5a40('0x47')](_0x5fd51b[_0x5a40('0x3e')][_0x5a40('0x47')]);_0x45f802[_0x5a40('0x48')]=qs[_0x5a40('0x3f')](_['pick'](_0x5fd51b[_0x5a40('0x3e')],_0x408e31['filters']),_0x1420c6);if(_0x5fd51b[_0x5a40('0x3e')][_0x5a40('0x49')]){_0x45f802['where']=_[_0x5a40('0x4a')](_0x45f802['where'],{'$or':_['map'](_0x1420c6,function(_0x191c44){if(_0x191c44[_0x5a40('0x4b')]!==_0x5a40('0x4c')){var _0x1f26e5={};_0x1f26e5[_0x191c44[_0x5a40('0x37')]]={'$like':'%'+_0x5fd51b['query'][_0x5a40('0x49')]+'%'};return _0x1f26e5;}})});}_0x45f802=_[_0x5a40('0x4a')]({},_0x45f802,_0x5fd51b[_0x5a40('0x4d')]);var _0x5b889c={'where':_0x45f802[_0x5a40('0x48')]};return db[_0x5a40('0x3c')][_0x5a40('0x2a')](_0x5b889c)[_0x5a40('0x32')](function(_0x1e83bb){_0x56e286[_0x5a40('0x2a')]=_0x1e83bb;if(_0x5fd51b[_0x5a40('0x3e')][_0x5a40('0x4e')]){_0x45f802[_0x5a40('0x4f')]=[{'all':!![]}];}return db[_0x5a40('0x3c')]['findAll'](_0x45f802);})[_0x5a40('0x32')](function(_0x337c86){_0x56e286[_0x5a40('0x50')]=_0x337c86;return _0x56e286;})[_0x5a40('0x32')](respondWithFilteredResult(_0x4fd509,_0x45f802))[_0x5a40('0x23')](handleError(_0x4fd509,null));};exports['show']=function(_0x1a97af,_0x1b24bf){var _0x3cd163={'raw':![],'where':{'id':_0x1a97af['params']['id']},'include':[{'model':db[_0x5a40('0x39')],'as':_0x5a40('0x3a')}]},_0x4fcc1a={};_0x4fcc1a[_0x5a40('0x41')]=_[_0x5a40('0x51')](db[_0x5a40('0x3c')]['rawAttributes']);_0x4fcc1a[_0x5a40('0x3e')]=_['keys'](_0x1a97af['query']);_0x4fcc1a['filters']=_['intersection'](_0x4fcc1a['model'],_0x4fcc1a[_0x5a40('0x3e')]);_0x3cd163['attributes']=_[_0x5a40('0x40')](_0x4fcc1a['model'],qs[_0x5a40('0x42')](_0x1a97af['query']['fields']));_0x3cd163[_0x5a40('0x43')]=_0x3cd163['attributes'][_0x5a40('0x44')]?_0x3cd163[_0x5a40('0x43')]:_0x4fcc1a[_0x5a40('0x41')];if(_0x1a97af[_0x5a40('0x3e')][_0x5a40('0x4e')]){_0x3cd163['include']=[{'all':!![]}];}_0x3cd163=_[_0x5a40('0x4a')]({},_0x3cd163,_0x1a97af[_0x5a40('0x4d')]);return db['WhatsappAccount'][_0x5a40('0x52')](_0x3cd163)[_0x5a40('0x32')](handleEntityNotFound(_0x1b24bf,null))['then'](respondWithResult(_0x1b24bf,null))[_0x5a40('0x23')](handleError(_0x1b24bf,null));};exports[_0x5a40('0x53')]=function(_0x4e2667,_0x17e748){return db[_0x5a40('0x3c')][_0x5a40('0x53')](_0x4e2667[_0x5a40('0x54')],{})['then'](function(_0x4a9284){var _0x5346a0=_0x4e2667['user'][_0x5a40('0x33')]({'plain':!![]});if(!_0x5346a0)throw new Error(_0x5a40('0x55'));if(_0x5346a0[_0x5a40('0x56')]===_0x5a40('0x57')){var _0xdd16ca=_0x4a9284[_0x5a40('0x33')]({'plain':!![]});var _0x2aaf99=_0x5a40('0x58');return db[_0x5a40('0x59')][_0x5a40('0x52')]({'where':{'name':_0x2aaf99,'userProfileId':_0x5346a0[_0x5a40('0x5a')]},'raw':!![]})[_0x5a40('0x32')](function(_0x44de4f){if(_0x44de4f&&_0x44de4f[_0x5a40('0x5b')]===0x0){return db[_0x5a40('0x34')]['create']({'name':_0xdd16ca[_0x5a40('0x37')],'resourceId':_0xdd16ca['id'],'type':_0x44de4f['name'],'sectionId':_0x44de4f['id']},{})['then'](function(){return _0x4a9284;});}else{return _0x4a9284;}})[_0x5a40('0x23')](function(_0x49f503){logger[_0x5a40('0x1f')](_0x5a40('0x5c'),_0x49f503);throw _0x49f503;});}return _0x4a9284;})[_0x5a40('0x32')](respondWithResult(_0x17e748,0xc9))[_0x5a40('0x23')](handleError(_0x17e748,null));};exports['update']=function(_0x1fd495,_0x23a641){if(_0x1fd495[_0x5a40('0x54')]['id']){delete _0x1fd495[_0x5a40('0x54')]['id'];}return db[_0x5a40('0x3c')][_0x5a40('0x52')]({'where':{'id':_0x1fd495[_0x5a40('0x5d')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x23a641,null))['then'](saveUpdates(_0x1fd495[_0x5a40('0x54')],null))[_0x5a40('0x32')](respondWithResult(_0x23a641,null))[_0x5a40('0x23')](handleError(_0x23a641,null));};exports[_0x5a40('0x35')]=function(_0x1bdb3e,_0x20dd06){return db['WhatsappAccount']['find']({'where':{'id':_0x1bdb3e['params']['id']}})[_0x5a40('0x32')](handleEntityNotFound(_0x20dd06,null))[_0x5a40('0x32')](removeEntity(_0x20dd06,null))[_0x5a40('0x23')](handleError(_0x20dd06,null));};exports[_0x5a40('0x5e')]=function(_0x37108f,_0x2fc98a){return db[_0x5a40('0x3c')][_0x5a40('0x5e')]()['then'](respondWithResult(_0x2fc98a,null))[_0x5a40('0x23')](handleError(_0x2fc98a,null));};exports[_0x5a40('0x5f')]=function(_0x525fcf,_0xf685c8,_0x16db88){if(_0x525fcf[_0x5a40('0x54')]['id']){delete _0x525fcf[_0x5a40('0x54')]['id'];}return db['WhatsappAccount'][_0x5a40('0x52')]({'where':{'id':_0x525fcf[_0x5a40('0x5d')]['id']}})[_0x5a40('0x32')](handleEntityNotFound(_0xf685c8,null))['then'](function(_0x512d86){if(_0x512d86){_0x525fcf['body']['WhatsappAccountId']=_0x512d86['id'];return db[_0x5a40('0x60')][_0x5a40('0x53')](_0x525fcf[_0x5a40('0x54')]);}})[_0x5a40('0x32')](respondWithResult(_0xf685c8,null))[_0x5a40('0x23')](handleError(_0xf685c8,null));};exports[_0x5a40('0x61')]=function(_0x42fbd2,_0x57fb95,_0x4b6f36){var _0x525752={'raw':![],'where':{}};var _0x597b64={};var _0x1c9670={'count':0x0,'rows':[]};return db[_0x5a40('0x3c')][_0x5a40('0x62')]({'where':{'id':_0x42fbd2[_0x5a40('0x5d')]['id']}})[_0x5a40('0x32')](handleEntityNotFound(_0x57fb95,null))[_0x5a40('0x32')](function(_0x13113a){if(_0x13113a){_0x597b64['model']=_[_0x5a40('0x51')](db[_0x5a40('0x60')][_0x5a40('0x63')]);_0x597b64[_0x5a40('0x3e')]=_[_0x5a40('0x51')](_0x42fbd2['query']);_0x597b64[_0x5a40('0x3f')]=_[_0x5a40('0x40')](_0x597b64[_0x5a40('0x41')],_0x597b64[_0x5a40('0x3e')]);_0x525752['attributes']=_[_0x5a40('0x40')](_0x597b64[_0x5a40('0x41')],qs[_0x5a40('0x42')](_0x42fbd2[_0x5a40('0x3e')][_0x5a40('0x42')]));_0x525752[_0x5a40('0x43')]=_0x525752['attributes'][_0x5a40('0x44')]?_0x525752[_0x5a40('0x43')]:_0x597b64[_0x5a40('0x41')];if(!_0x42fbd2[_0x5a40('0x3e')][_0x5a40('0x45')]('nolimit')){_0x525752[_0x5a40('0x29')]=qs[_0x5a40('0x29')](_0x42fbd2['query'][_0x5a40('0x29')]);_0x525752[_0x5a40('0x2b')]=qs[_0x5a40('0x2b')](_0x42fbd2[_0x5a40('0x3e')][_0x5a40('0x2b')]);}_0x525752['order']=qs[_0x5a40('0x47')](_0x42fbd2['query'][_0x5a40('0x47')]);_0x525752[_0x5a40('0x48')]=qs['filters'](_[_0x5a40('0x64')](_0x42fbd2['query'],_0x597b64[_0x5a40('0x3f')]));_0x525752[_0x5a40('0x48')][_0x5a40('0x65')]=_0x13113a['id'];if(_0x42fbd2[_0x5a40('0x3e')][_0x5a40('0x49')]){_0x525752[_0x5a40('0x48')]=_[_0x5a40('0x4a')](_0x525752['where'],{'$or':_['map'](_0x525752[_0x5a40('0x43')],function(_0x2000a4){var _0x4eb802={};_0x4eb802[_0x2000a4]={'$like':'%'+_0x42fbd2[_0x5a40('0x3e')]['filter']+'%'};return _0x4eb802;})});}_0x525752=_['merge']({},_0x525752,_0x42fbd2['options']);return db['Disposition'][_0x5a40('0x2a')]({'where':_0x525752[_0x5a40('0x48')]})[_0x5a40('0x32')](function(_0x3bb076){_0x1c9670[_0x5a40('0x2a')]=_0x3bb076;if(_0x42fbd2[_0x5a40('0x3e')][_0x5a40('0x4e')]){_0x525752[_0x5a40('0x4f')]=[{'all':!![]}];}return db[_0x5a40('0x60')]['findAll'](_0x525752);})['then'](function(_0x42d859){_0x1c9670[_0x5a40('0x50')]=_0x42d859;return _0x1c9670;});}})[_0x5a40('0x32')](respondWithFilteredResult(_0x57fb95,_0x525752))[_0x5a40('0x23')](handleError(_0x57fb95,null));};exports[_0x5a40('0x66')]=function(_0x291ce2,_0x27cec6,_0x6392a6){return db[_0x5a40('0x3c')]['find']({'where':{'id':_0x291ce2[_0x5a40('0x5d')]['id']}})['then'](handleEntityNotFound(_0x27cec6,null))['then'](function(_0x49365d){if(_0x49365d){return _0x49365d[_0x5a40('0x66')](_0x291ce2[_0x5a40('0x3e')]['ids']);}})[_0x5a40('0x32')](respondWithStatusCode(_0x27cec6,null))[_0x5a40('0x23')](handleError(_0x27cec6,null));};exports[_0x5a40('0x67')]=function(_0x3f62cb,_0x135d0d,_0x5ce865){if(_0x3f62cb[_0x5a40('0x54')]['id']){delete _0x3f62cb['body']['id'];}return db[_0x5a40('0x3c')][_0x5a40('0x52')]({'where':{'id':_0x3f62cb[_0x5a40('0x5d')]['id']}})[_0x5a40('0x32')](handleEntityNotFound(_0x135d0d,null))[_0x5a40('0x32')](function(_0x223bb1){if(_0x223bb1){_0x3f62cb['body']['WhatsappAccountId']=_0x223bb1['id'];return db[_0x5a40('0x68')]['create'](_0x3f62cb[_0x5a40('0x54')]);}})[_0x5a40('0x32')](respondWithResult(_0x135d0d,null))['catch'](handleError(_0x135d0d,null));};exports[_0x5a40('0x69')]=function(_0x1431d8,_0x36360e,_0x472258){var _0x1adb60={'raw':![],'where':{}};var _0x8de451={};var _0x5de49f={'count':0x0,'rows':[]};return db[_0x5a40('0x3c')]['findOne']({'where':{'id':_0x1431d8[_0x5a40('0x5d')]['id']}})['then'](handleEntityNotFound(_0x36360e,null))[_0x5a40('0x32')](function(_0x362993){if(_0x362993){_0x8de451[_0x5a40('0x41')]=_[_0x5a40('0x51')](db[_0x5a40('0x68')][_0x5a40('0x63')]);_0x8de451[_0x5a40('0x3e')]=_[_0x5a40('0x51')](_0x1431d8['query']);_0x8de451['filters']=_[_0x5a40('0x40')](_0x8de451[_0x5a40('0x41')],_0x8de451['query']);_0x1adb60['attributes']=_[_0x5a40('0x40')](_0x8de451['model'],qs[_0x5a40('0x42')](_0x1431d8[_0x5a40('0x3e')][_0x5a40('0x42')]));_0x1adb60['attributes']=_0x1adb60[_0x5a40('0x43')][_0x5a40('0x44')]?_0x1adb60['attributes']:_0x8de451['model'];if(!_0x1431d8[_0x5a40('0x3e')][_0x5a40('0x45')]('nolimit')){_0x1adb60[_0x5a40('0x29')]=qs[_0x5a40('0x29')](_0x1431d8[_0x5a40('0x3e')][_0x5a40('0x29')]);_0x1adb60['offset']=qs[_0x5a40('0x2b')](_0x1431d8[_0x5a40('0x3e')][_0x5a40('0x2b')]);}_0x1adb60[_0x5a40('0x46')]=qs[_0x5a40('0x47')](_0x1431d8[_0x5a40('0x3e')][_0x5a40('0x47')]);_0x1adb60[_0x5a40('0x48')]=qs[_0x5a40('0x3f')](_[_0x5a40('0x64')](_0x1431d8[_0x5a40('0x3e')],_0x8de451[_0x5a40('0x3f')]));_0x1adb60[_0x5a40('0x48')][_0x5a40('0x65')]=_0x362993['id'];if(_0x1431d8['query'][_0x5a40('0x49')]){_0x1adb60[_0x5a40('0x48')]=_[_0x5a40('0x4a')](_0x1adb60[_0x5a40('0x48')],{'$or':_[_0x5a40('0x3b')](_0x1adb60[_0x5a40('0x43')],function(_0x4f3994){var _0x19149d={};_0x19149d[_0x4f3994]={'$like':'%'+_0x1431d8['query'][_0x5a40('0x49')]+'%'};return _0x19149d;})});}_0x1adb60=_[_0x5a40('0x4a')]({},_0x1adb60,_0x1431d8[_0x5a40('0x4d')]);return db[_0x5a40('0x68')][_0x5a40('0x2a')]({'where':_0x1adb60[_0x5a40('0x48')]})[_0x5a40('0x32')](function(_0x341793){_0x5de49f[_0x5a40('0x2a')]=_0x341793;if(_0x1431d8[_0x5a40('0x3e')][_0x5a40('0x4e')]){_0x1adb60['include']=[{'all':!![]}];}return db['CannedAnswer'][_0x5a40('0x6a')](_0x1adb60);})[_0x5a40('0x32')](function(_0x2d3bfe){_0x5de49f[_0x5a40('0x50')]=_0x2d3bfe;return _0x5de49f;});}})[_0x5a40('0x32')](respondWithFilteredResult(_0x36360e,_0x1adb60))[_0x5a40('0x23')](handleError(_0x36360e,null));};exports[_0x5a40('0x6b')]=function(_0x22c8c8,_0xd3d93b,_0x21535e){return db['WhatsappAccount']['find']({'where':{'id':_0x22c8c8[_0x5a40('0x5d')]['id']}})[_0x5a40('0x32')](handleEntityNotFound(_0xd3d93b,null))[_0x5a40('0x32')](function(_0x134bbf){if(_0x134bbf){return _0x134bbf[_0x5a40('0x6b')](_0x22c8c8[_0x5a40('0x3e')][_0x5a40('0x6c')]);}})['then'](respondWithStatusCode(_0xd3d93b,null))[_0x5a40('0x23')](handleError(_0xd3d93b,null));};exports[_0x5a40('0x6d')]=function(_0x289bca,_0x1e647d,_0x42d7c8){return db[_0x5a40('0x3c')][_0x5a40('0x52')]({'where':{'id':_0x289bca[_0x5a40('0x5d')]['id']}})['then'](handleEntityNotFound(_0x1e647d,null))[_0x5a40('0x32')](function(_0x1330a7){if(_0x1330a7){return _0x1330a7[_0x5a40('0x6d')](_0x289bca[_0x5a40('0x54')][_0x5a40('0x6c')],_[_0x5a40('0x6e')](_0x289bca[_0x5a40('0x54')],[_0x5a40('0x6c'),'id'])||{})[_0x5a40('0x6f')](function(_0x57bc18){for(var _0x5569fd=0x0;_0x5569fd<_0x289bca['body'][_0x5a40('0x6c')][_0x5a40('0x44')];_0x5569fd+=0x1){socket[_0x5a40('0x70')](_0x5a40('0x71'),{'UserId':Number(_0x289bca['body']['ids'][_0x5569fd]),'WhatsappAccountId':Number(_0x289bca[_0x5a40('0x5d')]['id'])});}return _0x57bc18;});}})[_0x5a40('0x32')](respondWithResult(_0x1e647d,null))['catch'](handleError(_0x1e647d,null));};exports[_0x5a40('0x72')]=function(_0x2d27ac,_0x260b7f,_0x38b07d){return db[_0x5a40('0x3c')][_0x5a40('0x52')]({'where':{'id':_0x2d27ac[_0x5a40('0x5d')]['id']}})[_0x5a40('0x32')](handleEntityNotFound(_0x260b7f,null))[_0x5a40('0x32')](function(_0x196a51){if(_0x196a51){return _0x196a51[_0x5a40('0x72')](_0x2d27ac[_0x5a40('0x3e')]['ids'])[_0x5a40('0x32')](function(){if(_[_0x5a40('0x73')](_0x2d27ac[_0x5a40('0x3e')][_0x5a40('0x6c')])){for(var _0x3b149e=0x0;_0x3b149e<_0x2d27ac[_0x5a40('0x3e')][_0x5a40('0x6c')]['length'];_0x3b149e+=0x1){socket[_0x5a40('0x70')](_0x5a40('0x74'),{'UserId':Number(_0x2d27ac[_0x5a40('0x3e')][_0x5a40('0x6c')][_0x3b149e]),'WhatsappAccountId':Number(_0x2d27ac[_0x5a40('0x5d')]['id'])});}}else{socket[_0x5a40('0x70')](_0x5a40('0x74'),{'UserId':Number(_0x2d27ac[_0x5a40('0x3e')][_0x5a40('0x6c')]),'WhatsappAccountId':Number(_0x2d27ac[_0x5a40('0x5d')]['id'])});}});}})['then'](respondWithStatusCode(_0x260b7f,null))[_0x5a40('0x23')](handleError(_0x260b7f,null));};exports[_0x5a40('0x75')]=function(_0xda1a4f,_0xc0011a,_0x37b204){var _0xc832={};var _0x27b075={};var _0xfc570b;var _0x299639;return db['WhatsappAccount'][_0x5a40('0x62')]({'where':{'id':_0xda1a4f[_0x5a40('0x5d')]['id']}})['then'](handleEntityNotFound(_0xc0011a,null))['then'](function(_0x2c6415){if(_0x2c6415){_0xfc570b=_0x2c6415;_0x27b075[_0x5a40('0x41')]=_['keys'](db[_0x5a40('0x76')][_0x5a40('0x63')]);_0x27b075['query']=_[_0x5a40('0x51')](_0xda1a4f[_0x5a40('0x3e')]);_0x27b075[_0x5a40('0x3f')]=_[_0x5a40('0x40')](_0x27b075[_0x5a40('0x41')],_0x27b075[_0x5a40('0x3e')]);_0xc832[_0x5a40('0x43')]=_[_0x5a40('0x40')](_0x27b075[_0x5a40('0x41')],qs['fields'](_0xda1a4f['query'][_0x5a40('0x42')]));_0xc832['attributes']=_0xc832['attributes'][_0x5a40('0x44')]?_0xc832[_0x5a40('0x43')]:_0x27b075['model'];_0xc832['order']=qs[_0x5a40('0x47')](_0xda1a4f[_0x5a40('0x3e')][_0x5a40('0x47')]);_0xc832[_0x5a40('0x48')]=qs[_0x5a40('0x3f')](_[_0x5a40('0x64')](_0xda1a4f[_0x5a40('0x3e')],_0x27b075['filters']));if(_0xda1a4f[_0x5a40('0x3e')][_0x5a40('0x49')]){_0xc832[_0x5a40('0x48')]=_[_0x5a40('0x4a')](_0xc832[_0x5a40('0x48')],{'$or':_[_0x5a40('0x3b')](_0xc832[_0x5a40('0x43')],function(_0x5614a0){var _0x6c540b={};_0x6c540b[_0x5614a0]={'$like':'%'+_0xda1a4f[_0x5a40('0x3e')][_0x5a40('0x49')]+'%'};return _0x6c540b;})});}_0xc832=_[_0x5a40('0x4a')]({},_0xc832,_0xda1a4f[_0x5a40('0x4d')]);return _0xfc570b['getAgents'](_0xc832);}})[_0x5a40('0x32')](function(_0xcc307){if(_0xcc307){_0x299639=_0xcc307[_0x5a40('0x44')];if(!_0xda1a4f[_0x5a40('0x3e')]['hasOwnProperty'](_0x5a40('0x77'))){_0xc832['limit']=qs[_0x5a40('0x29')](_0xda1a4f[_0x5a40('0x3e')][_0x5a40('0x29')]);_0xc832[_0x5a40('0x2b')]=qs[_0x5a40('0x2b')](_0xda1a4f['query']['offset']);}return _0xfc570b['getAgents'](_0xc832);}})[_0x5a40('0x32')](function(_0x5b60c6){if(_0x5b60c6){return _0x5b60c6?{'count':_0x299639,'rows':_0x5b60c6}:null;}})[_0x5a40('0x32')](respondWithResult(_0xc0011a,null))[_0x5a40('0x23')](handleError(_0xc0011a,null));};exports[_0x5a40('0x78')]=function(_0x4d8098,_0x4172d7){var _0x2130e7=_0x4d8098['params']['id'];var _0x455ec2=_0x4d8098[_0x5a40('0x54')];var _0x90e3ed=0xc8;var _0x3e4baf=null;return db[_0x5a40('0x79')][_0x5a40('0x7a')]({'isolationLevel':db[_0x5a40('0x79')][_0x5a40('0x7b')][_0x5a40('0x7c')][_0x5a40('0x7d')]},function(_0x2f2a6e){return db[_0x5a40('0x3c')]['findOne']({'where':{'id':_0x2130e7},'transaction':_0x2f2a6e})[_0x5a40('0x32')](function(_0x1fcd04){if(_0x1fcd04){return db[_0x5a40('0x7e')][_0x5a40('0x35')]({'where':{'WhatsappAccountId':_0x2130e7},'transaction':_0x2f2a6e})[_0x5a40('0x32')](function(){var _0xf181e4=_[_0x5a40('0x3b')](_0x455ec2,function(_0x254800){_0x254800[_0x5a40('0x65')]=_0x2130e7;return _0x254800;});return db[_0x5a40('0x7e')][_0x5a40('0x7f')](_0xf181e4,{'transaction':_0x2f2a6e});});}else{_0x90e3ed=0x194;_0x3e4baf=[];}});})[_0x5a40('0x32')](function(){if(_0x90e3ed!==0x194){return db[_0x5a40('0x7e')]['findAndCountAll']({'where':{'WhatsappAccountId':_0x2130e7},'order':'priority'})[_0x5a40('0x32')](function(_0x22abbe){_0x3e4baf=_0x22abbe;});}})['catch'](function(_0x592605){_0x90e3ed=0x1f4;logger[_0x5a40('0x1f')](_0x592605[_0x5a40('0x36')]);if(_0x592605[_0x5a40('0x37')]){delete _0x592605[_0x5a40('0x37')];}_0x3e4baf=_0x592605;})[_0x5a40('0x80')](function(){if(_0x3e4baf===null){_0x4172d7[_0x5a40('0x24')](_0x90e3ed);}else{if(_0x90e3ed===0x1f4){_0x4172d7['status'](_0x90e3ed)[_0x5a40('0x81')](_0x3e4baf);}else{_0x4172d7[_0x5a40('0x25')](_0x90e3ed)[_0x5a40('0x27')](_0x3e4baf);}}});};exports[_0x5a40('0x82')]=function(_0x48ce07,_0x4e60ae,_0x7e6df2){var _0x24fa3e={};var _0x43c431={};var _0x224457;var _0x33cd69;return db['WhatsappAccount']['findOne']({'where':{'id':_0x48ce07[_0x5a40('0x5d')]['id']}})['then'](handleEntityNotFound(_0x4e60ae,null))['then'](function(_0xfa17d0){if(_0xfa17d0){_0x224457=_0xfa17d0;_0x43c431[_0x5a40('0x41')]=_[_0x5a40('0x51')](db['WhatsappApplication'][_0x5a40('0x63')]);_0x43c431[_0x5a40('0x3e')]=_['keys'](_0x48ce07[_0x5a40('0x3e')]);_0x43c431[_0x5a40('0x3f')]=_[_0x5a40('0x40')](_0x43c431[_0x5a40('0x41')],_0x43c431[_0x5a40('0x3e')]);_0x24fa3e['attributes']=_[_0x5a40('0x40')](_0x43c431[_0x5a40('0x41')],qs[_0x5a40('0x42')](_0x48ce07[_0x5a40('0x3e')]['fields']));_0x24fa3e[_0x5a40('0x43')]=_0x24fa3e['attributes'][_0x5a40('0x44')]?_0x24fa3e['attributes']:_0x43c431['model'];_0x24fa3e['order']=qs[_0x5a40('0x47')](_0x48ce07[_0x5a40('0x3e')][_0x5a40('0x47')]);_0x24fa3e[_0x5a40('0x48')]=qs[_0x5a40('0x3f')](_[_0x5a40('0x64')](_0x48ce07[_0x5a40('0x3e')],_0x43c431[_0x5a40('0x3f')]));if(_0x48ce07['query']['filter']){_0x24fa3e[_0x5a40('0x48')]=_[_0x5a40('0x4a')](_0x24fa3e[_0x5a40('0x48')],{'$or':_[_0x5a40('0x3b')](_0x24fa3e[_0x5a40('0x43')],function(_0x4365ee){var _0x2999db={};_0x2999db[_0x4365ee]={'$like':'%'+_0x48ce07['query'][_0x5a40('0x49')]+'%'};return _0x2999db;})});}_0x24fa3e=_[_0x5a40('0x4a')]({},_0x24fa3e,_0x48ce07[_0x5a40('0x4d')]);return _0x224457[_0x5a40('0x82')](_0x24fa3e);}})[_0x5a40('0x32')](function(_0x4b67d4){if(_0x4b67d4){_0x33cd69=_0x4b67d4[_0x5a40('0x44')];if(!_0x48ce07[_0x5a40('0x3e')][_0x5a40('0x45')]('nolimit')){_0x24fa3e[_0x5a40('0x29')]=qs[_0x5a40('0x29')](_0x48ce07[_0x5a40('0x3e')][_0x5a40('0x29')]);_0x24fa3e['offset']=qs['offset'](_0x48ce07[_0x5a40('0x3e')][_0x5a40('0x2b')]);}return _0x224457[_0x5a40('0x82')](_0x24fa3e);}})[_0x5a40('0x32')](function(_0x829df2){if(_0x829df2){return _0x829df2?{'count':_0x33cd69,'rows':_0x829df2}:null;}})[_0x5a40('0x32')](respondWithResult(_0x4e60ae,null))[_0x5a40('0x23')](handleError(_0x4e60ae,null));};exports[_0x5a40('0x83')]=function(_0x1a73ec,_0x171438,_0x2d9710){var _0x1ce4a9={'channel':'whatsapp'};var _0x48419f=[];var _0x2b136e=[];var _0x2ced09={};return db[_0x5a40('0x3c')]['find']({'where':{'id':_0x1a73ec[_0x5a40('0x5d')]['id']},'include':[{'model':db[_0x5a40('0x7e')],'as':_0x5a40('0x84')}]})[_0x5a40('0x32')](handleEntityNotFound(_0x171438,null))[_0x5a40('0x32')](function(_0x403ced){_0x1ce4a9[_0x5a40('0x85')]=_0x403ced;if(_0x1ce4a9[_0x5a40('0x85')]&&_0x1ce4a9['account'][_0x5a40('0x4b')]==='sinch'&&_0x1a73ec[_0x5a40('0x54')][_0x5a40('0x86')]){if(_0x1a73ec['body'][_0x5a40('0x86')][_0x5a40('0x44')]===0x0)return;if(_0x1a73ec['body'][_0x5a40('0x86')][0x0][_0x5a40('0x87')]!==_0x5a40('0x88'))return;return db[_0x5a40('0x89')]['update']({'read':!![],'readAt':_0x1a73ec[_0x5a40('0x54')][_0x5a40('0x86')][0x0][_0x5a40('0x8a')]},{'where':{'messageId':_0x1a73ec[_0x5a40('0x54')][_0x5a40('0x86')][0x0]['message_id']},'individualHooks':!![]})[_0x5a40('0x32')](function(_0x13b642){return _0x171438[_0x5a40('0x25')](0xc8)['json'](_0x13b642);});}_0x1ce4a9[_0x5a40('0x8b')]=_[_0x5a40('0x8c')](_0x403ced[_0x5a40('0x84')],[_0x5a40('0x8d')],[_0x5a40('0x8e')]);if(_0x1ce4a9[_0x5a40('0x85')][_0x5a40('0x84')]){delete _0x1ce4a9['account'][_0x5a40('0x84')];}return db[_0x5a40('0x8f')]['describe']()[_0x5a40('0x32')](function(_0x9fc022){if(!_0x9fc022){throw new db[(_0x5a40('0x90'))][(_0x5a40('0x91'))]('no\x20available\x20attributes');}_0x48419f=_[_0x5a40('0x92')](_[_0x5a40('0x51')](_0x9fc022),[_0x5a40('0x93'),_0x5a40('0x94')]);_0x2b136e=_[_0x5a40('0x92')](_[_0x5a40('0x51')](_0x9fc022),[_0x5a40('0x93'),_0x5a40('0x94'),'CompanyId',_0x5a40('0x95')]);_0x1ce4a9['body']={'mapKey':_0x5a40('0x96')};if(_0x1ce4a9[_0x5a40('0x85')]&&_0x1ce4a9[_0x5a40('0x85')][_0x5a40('0x4b')]===_0x5a40('0x97')){_0x1ce4a9[_0x5a40('0x54')][_0x5a40('0x98')]=_0x1a73ec[_0x5a40('0x54')][_0x5a40('0x99')][_0x5a40('0x9a')](_0x5a40('0x9b'),'');_0x1ce4a9[_0x5a40('0x54')][_0x5a40('0x54')]=_0x1a73ec[_0x5a40('0x54')][_0x5a40('0x9c')];_0x1ce4a9[_0x5a40('0x54')]['messageId']=_0x1a73ec[_0x5a40('0x54')][_0x5a40('0x9d')];}if(_0x1ce4a9[_0x5a40('0x85')]&&_0x1ce4a9[_0x5a40('0x85')][_0x5a40('0x4b')]===_0x5a40('0x9e')){_0x1ce4a9[_0x5a40('0x54')]['from']=_0x1a73ec[_0x5a40('0x54')][_0x5a40('0x9f')][0x0]['from'];_0x1ce4a9['body'][_0x5a40('0x54')]=_0x1a73ec[_0x5a40('0x54')][_0x5a40('0x9f')][0x0][_0x5a40('0x21')]['body'];_0x1ce4a9[_0x5a40('0x54')][_0x5a40('0xa0')]=_0x1a73ec[_0x5a40('0x54')][_0x5a40('0x9f')][0x0][_0x5a40('0xa1')];}if(_0x1ce4a9['body']['id']){delete _0x1ce4a9[_0x5a40('0x54')]['id'];}if(_[_0x5a40('0xa2')](_0x1ce4a9[_0x5a40('0x54')][_0x5a40('0x98')])){throw new db[(_0x5a40('0x90'))][(_0x5a40('0x91'))](_0x5a40('0xa3'));}if(_[_0x5a40('0xa2')](_0x1ce4a9['body'][_0x5a40('0x54')])||_0x1ce4a9[_0x5a40('0x54')]['body']===''){throw new db[(_0x5a40('0x90'))]['ValidationError'](_0x5a40('0xa4'));}if(_[_0x5a40('0xa2')](_0x1ce4a9['body'][_0x5a40('0xa5')])){throw new db[(_0x5a40('0x90'))]['ValidationError'](_0x5a40('0xa6')+_0x2b136e);}if(!_[_0x5a40('0xa7')](_0x2b136e,_0x1ce4a9[_0x5a40('0x54')][_0x5a40('0xa5')])){throw new db['Sequelize']['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2b136e);}_0x2ced09[_0x1ce4a9[_0x5a40('0x54')][_0x5a40('0xa5')]]=_0x1ce4a9[_0x5a40('0x54')][_0x5a40('0x98')];return db[_0x5a40('0xa8')]['find']({'where':{'id':_0x1ce4a9[_0x5a40('0x85')][_0x5a40('0x95')]},'include':[{'model':db[_0x5a40('0x8f')],'as':_0x5a40('0xa9'),'where':_0x2ced09,'limit':0x1,'order':[[_0x5a40('0x94'),_0x5a40('0xaa')]]}]});})[_0x5a40('0x32')](handleEntityNotFound(_0x171438,null))[_0x5a40('0x32')](function(_0x5ba390){if(_0x5ba390){_0x1ce4a9[_0x5a40('0xab')]=_[_0x5a40('0x6e')](_0x5ba390,[_0x5a40('0xa9')]);if(_0x5ba390[_0x5a40('0xa9')]['length']){return _0x5ba390[_0x5a40('0xa9')][0x0];}var _0x2ab507=_['defaults'](_0x1ce4a9[_0x5a40('0x54')],{'firstName':_0x1ce4a9['body']['from'],'ListId':_0x5ba390['id']});_0x2ab507[_0x1ce4a9['body'][_0x5a40('0xa5')]]=_0x1ce4a9[_0x5a40('0x54')][_0x5a40('0x98')];return db[_0x5a40('0x8f')][_0x5a40('0x53')](_0x2ab507,{'fields':_0x48419f,'raw':!![]});}})[_0x5a40('0x32')](handleEntityNotFound(_0x171438,null))['then'](function(_0x4f005f){if(_0x4f005f){_0x1ce4a9[_0x5a40('0xac')]=_0x4f005f;var _0x216223={'ContactId':_0x4f005f['id'],'phone':_0x1ce4a9['body'][_0x5a40('0x98')],'WhatsappAccountId':_0x1a73ec[_0x5a40('0x5d')]['id']};var _0x254946={'ContactId':_0x4f005f['id'],'WhatsappAccountId':_0x1a73ec[_0x5a40('0x5d')]['id'],'closed':![]};return db['WhatsappInteraction']['find']({'where':_0x254946})['then'](function(_0x5a7a10){if(_0x5a7a10){return[_0x5a7a10,![]];}return db['WhatsappInteraction'][_0x5a40('0x53')](_0x216223)['then'](function(_0x118ded){return[_0x118ded,!![]];});});}})[_0x5a40('0x6f')](function(_0x5834e2,_0x5aaa87){_0x1ce4a9['interaction']=_0x5834e2[_0x5a40('0x33')]({'plain':!![]});_0x1ce4a9[_0x5a40('0xad')][_0x5a40('0xae')]=![];if(_0x5aaa87){if(_0x1ce4a9['account'][_0x5a40('0xaf')]){_0x1ce4a9[_0x5a40('0x8b')][_0x5a40('0xb0')]({'id':0x0,'priority':_0x1ce4a9[_0x5a40('0x8b')][_0x5a40('0x44')]+0x1,'app':_0x5a40('0xb1'),'appdata':_0x5a40('0xb2'),'interval':_0x5a40('0xb3')});}_0x1ce4a9['interaction'][_0x5a40('0xae')]=!![];}return db[_0x5a40('0x89')][_0x5a40('0x53')]({'phone':_0x1ce4a9[_0x5a40('0x54')][_0x5a40('0x98')],'messageId':_0x1ce4a9[_0x5a40('0x54')]['messageId'],'body':_0x1ce4a9[_0x5a40('0x54')]['body'],'WhatsappAccountId':_0x1a73ec['params']['id'],'WhatsappInteractionId':_0x5834e2['id'],'direction':'in','ContactId':_0x5834e2[_0x5a40('0xb4')],'AttachmentId':_0x1ce4a9[_0x5a40('0x54')]['AttachmentId']});})[_0x5a40('0x32')](function(_0x1a7342){_0x1ce4a9['message']=_0x1a7342;if(!_0x1ce4a9[_0x5a40('0xad')][_0x5a40('0xb5')])return;return db[_0x5a40('0x76')]['find']({'attributes':['id',_0x5a40('0x37')],'where':{'id':_0x1ce4a9['interaction']['UserId']}});})[_0x5a40('0x32')](function(_0x24ed38){if(_0x24ed38){_0x1ce4a9[_0x5a40('0x8b')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x24ed38['name']+','+(_0x1ce4a9[_0x5a40('0x85')][_0x5a40('0xb6')]||0xa),'interval':_0x5a40('0xb3')});}if(!_0x1ce4a9['interaction'][_0x5a40('0xb7')])return;return db[_0x5a40('0xb8')]['find']({'attributes':['id',_0x5a40('0x37')],'where':{'id':_0x1ce4a9['interaction'][_0x5a40('0xb7')]}});})['then'](function(_0x44ee38){if(_0x44ee38){_0x1ce4a9['applications'][_0x5a40('0xb9')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x44ee38['name']+','+(_0x1ce4a9[_0x5a40('0x85')][_0x5a40('0xba')]||0x12c),'interval':_0x5a40('0xb3')});}return respondWithRpcPromise(_0x5a40('0xbb'),_0x5a40('0xbc'),_0x1ce4a9);})[_0x5a40('0x32')](function(_0x1f396f){if(_0x1f396f){var _0x1ac6c9=0xc8;var _0x42f552=_0x5a40('0xbd');logger[_0x5a40('0x19')](_0x5a40('0x1c'),_0x42f552,_0x1ac6c9,_0x5a40('0xbe'));logger[_0x5a40('0x1b')](_0x5a40('0xbf'),_0x42f552,_0x1ac6c9,_0x5a40('0xbe'),JSON[_0x5a40('0x1e')](_0x1f396f));if(_0x1ce4a9[_0x5a40('0x85')]['type']===_0x5a40('0x97')){return _0x171438[_0x5a40('0x25')](_0x1ac6c9)[_0x5a40('0x2c')](_0x5a40('0xc0'),'text/xml')[_0x5a40('0x81')](_0x5a40('0xc1'));}else{return _0x171438['status'](_0x1ac6c9)[_0x5a40('0x27')](_0x1f396f);}}});})[_0x5a40('0x23')](handleError(_0x171438,null));};exports[_0x5a40('0x81')]=function(_0x4c004f,_0xcf7a18,_0x27a263){var _0xaca5bf,_0xad70e7,_0x2124f1;if(_[_0x5a40('0xa2')](_0x4c004f[_0x5a40('0x54')]['body'])||_0x4c004f[_0x5a40('0x54')][_0x5a40('0x54')]===''){throw new db[(_0x5a40('0x90'))]['ValidationError'](_0x5a40('0xa4'));}if(_[_0x5a40('0xa2')](_0x4c004f[_0x5a40('0x54')]['to'])){throw new db[(_0x5a40('0x90'))][(_0x5a40('0x91'))](_0x5a40('0xc2'));}_0xaca5bf=_0x4c004f[_0x5a40('0x54')]['to'];return db['WhatsappAccount']['find']({'where':{'id':_0x4c004f[_0x5a40('0x5d')]['id']},'include':[{'model':db['CmList'],'as':_0x5a40('0xc3'),'include':[{'model':db[_0x5a40('0x8f')],'as':_0x5a40('0xa9'),'where':{'mobile':_0xaca5bf},'limit':0x1,'order':[[_0x5a40('0x94'),_0x5a40('0xaa')]]}]}]})[_0x5a40('0x32')](handleEntityNotFound(_0xcf7a18,null))[_0x5a40('0x32')](function(_0xd50487){if(_0xd50487&&_0xd50487[_0x5a40('0xc3')]){_0xad70e7=_0xd50487[_0x5a40('0x33')]({'plain':!![]});if(_0xad70e7[_0x5a40('0xc3')]&&_0xad70e7[_0x5a40('0xc3')][_0x5a40('0xa9')][_0x5a40('0x44')]){return _0xad70e7['List'][_0x5a40('0xa9')][0x0];}return db[_0x5a40('0x8f')][_0x5a40('0x53')](_[_0x5a40('0xc4')](_0x4c004f['body'],{'firstName':_0xaca5bf,'mobile':_0xaca5bf,'phone':_0xaca5bf,'ListId':_0xad70e7[_0x5a40('0x95')]}));}})[_0x5a40('0x32')](handleEntityNotFound(_0xcf7a18,null))[_0x5a40('0x32')](function(_0x19699b){if(_0x19699b){_0x2124f1=_0x19699b;return db['WhatsappInteraction'][_0x5a40('0x52')]({'where':{'ContactId':_0x2124f1['id'],'closed':![],'WhatsappAccountId':_0xad70e7['id']}})['then'](function(_0x454044){if(_0x454044){return[_0x454044,![]];}return db['WhatsappInteraction'][_0x5a40('0x53')]({'UserId':_0x4c004f[_0x5a40('0x57')]['id'],'ContactId':_0x2124f1['id'],'WhatsappAccountId':_0xad70e7['id'],'phone':_0xaca5bf,'firstMsgDirection':_0x5a40('0xc5'),'Messages':[_[_0x5a40('0x4a')](_0x4c004f[_0x5a40('0x54')],{'read':![],'body':_0x4c004f[_0x5a40('0x54')][_0x5a40('0x54')],'phone':_0xaca5bf,'WhatsappAccountId':_0xad70e7['id'],'UserId':_0x4c004f[_0x5a40('0x57')]['id'],'ContactId':_0x2124f1['id']})]},{'include':[{'model':db[_0x5a40('0x89')],'as':_0x5a40('0xc6')}]})['then'](function(_0x2724c2){return[_0x2724c2,!![]];});});}})[_0x5a40('0x6f')](function(_0xb4b42,_0x51b403){if(_0x51b403){return _0xb4b42;}return db[_0x5a40('0x89')]['create'](_[_0x5a40('0x4a')](_0x4c004f['body'],{'read':![],'body':_0x4c004f[_0x5a40('0x54')][_0x5a40('0x54')],'phone':_0xaca5bf,'WhatsappAccountId':_0xad70e7['id'],'WhatsappInteractionId':_0xb4b42['id'],'UserId':_0x4c004f[_0x5a40('0x57')]['id'],'ContactId':_0x2124f1['id']}))['then'](function(_0x492a2e){_0xb4b42['dataValues'][_0x5a40('0xc6')]=[];_0xb4b42[_0x5a40('0xc7')][_0x5a40('0xc6')]['push'](_0x492a2e[_0x5a40('0xc7')]);return _0xb4b42;});})[_0x5a40('0x32')](respondWithResult(_0xcf7a18,null))[_0x5a40('0x23')](handleError(_0xcf7a18,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index f89bbb0..c92ba7b 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 _0x1d2f=['hasOwnProperty','hook','exports','events','WhatsappAccount','update','remove','emit'];(function(_0x4ce028,_0x526d4b){var _0x583d0c=function(_0x874178){while(--_0x874178){_0x4ce028['push'](_0x4ce028['shift']());}};_0x583d0c(++_0x526d4b);}(_0x1d2f,0x1eb));var _0xf1d2=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x1d2f[_0x321bb2];return _0x9c12ed;};'use strict';var EventEmitter=require(_0xf1d2('0x0'));var WhatsappAccount=require('../../mysqldb')['db'][_0xf1d2('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xf1d2('0x2'),'afterDestroy':_0xf1d2('0x3')};function emitEvent(_0x3c9d31){return function(_0x40303f,_0x189fd4,_0x25e516){WhatsappAccountEvents['emit'](_0x3c9d31+':'+_0x40303f['id'],_0x40303f);WhatsappAccountEvents[_0xf1d2('0x4')](_0x3c9d31,_0x40303f);_0x25e516(null);};}for(var e in events){if(events[_0xf1d2('0x5')](e)){var event=events[e];WhatsappAccount[_0xf1d2('0x6')](e,emitEvent(event));}}module[_0xf1d2('0x7')]=WhatsappAccountEvents; \ No newline at end of file +var _0xa7c7=['WhatsappAccount','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events'];(function(_0x1c3908,_0x3da090){var _0x5c4ed6=function(_0x4b36ea){while(--_0x4b36ea){_0x1c3908['push'](_0x1c3908['shift']());}};_0x5c4ed6(++_0x3da090);}(_0xa7c7,0x1af));var _0x7a7c=function(_0x37d916,_0x3b41a4){_0x37d916=_0x37d916-0x0;var _0x17712a=_0xa7c7[_0x37d916];return _0x17712a;};'use strict';var EventEmitter=require(_0x7a7c('0x0'));var WhatsappAccount=require('../../mysqldb')['db'][_0x7a7c('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x7a7c('0x2')](0x0);var events={'afterCreate':_0x7a7c('0x3'),'afterUpdate':_0x7a7c('0x4'),'afterDestroy':'remove'};function emitEvent(_0x50ee9b){return function(_0x1e2f7b,_0x29b633,_0xe13805){WhatsappAccountEvents[_0x7a7c('0x5')](_0x50ee9b+':'+_0x1e2f7b['id'],_0x1e2f7b);WhatsappAccountEvents['emit'](_0x50ee9b,_0x1e2f7b);_0xe13805(null);};}for(var e in events){if(events[_0x7a7c('0x6')](e)){var event=events[e];WhatsappAccount[_0x7a7c('0x7')](e,emitEvent(event));}}module[_0x7a7c('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 7d5ffaa..8c245cd 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 _0x2d75=['path','rimraf','../../config/environment','./whatsappAccount.attributes','exports','define','WhatsappAccount','whatsapp_accounts','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x256d6a,_0x2f002f){var _0x460058=function(_0x195be7){while(--_0x195be7){_0x256d6a['push'](_0x256d6a['shift']());}};_0x460058(++_0x2f002f);}(_0x2d75,0x174));var _0x52d7=function(_0x158e6c,_0xaab4ed){_0x158e6c=_0x158e6c-0x0;var _0x3c26db=_0x2d75[_0x158e6c];return _0x3c26db;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x52d7('0x0'))(_0x52d7('0x1'));var moment=require(_0x52d7('0x2'));var BPromise=require(_0x52d7('0x3'));var rp=require(_0x52d7('0x4'));var fs=require('fs');var path=require(_0x52d7('0x5'));var rimraf=require(_0x52d7('0x6'));var config=require(_0x52d7('0x7'));var attributes=require(_0x52d7('0x8'));module[_0x52d7('0x9')]=function(_0x368c3f,_0x13b6ca){return _0x368c3f[_0x52d7('0xa')](_0x52d7('0xb'),attributes,{'tableName':_0x52d7('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6912=['whatsapp_accounts','../../config/logger','api','request-promise','path','rimraf'];(function(_0x36e31a,_0xddb24d){var _0x818540=function(_0x3da600){while(--_0x3da600){_0x36e31a['push'](_0x36e31a['shift']());}};_0x818540(++_0xddb24d);}(_0x6912,0x1a5));var _0x2691=function(_0x37e260,_0x3c729e){_0x37e260=_0x37e260-0x0;var _0x366060=_0x6912[_0x37e260];return _0x366060;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2691('0x0'))(_0x2691('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2691('0x2'));var fs=require('fs');var path=require(_0x2691('0x3'));var rimraf=require(_0x2691('0x4'));var config=require('../../config/environment');var attributes=require('./whatsappAccount.attributes');module['exports']=function(_0x3ab37a,_0x5d0ff9){return _0x3ab37a['define']('WhatsappAccount',attributes,{'tableName':_0x2691('0x5'),'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 669343c..fc564c2 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 _0xf95a=['randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','register','request','then','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','catch','WhatsappAccount','find','options','raw','where','attributes','include','model','map','ShowWhatsappAccount','util','bluebird'];(function(_0x5daa56,_0x18896d){var _0x19b85b=function(_0x23a129){while(--_0x23a129){_0x5daa56['push'](_0x5daa56['shift']());}};_0x19b85b(++_0x18896d);}(_0xf95a,0xd6));var _0xaf95=function(_0x69a008,_0x1a65b0){_0x69a008=_0x69a008-0x0;var _0x97d212=_0xf95a[_0x69a008];return _0x97d212;};'use strict';var _=require('lodash');var util=require(_0xaf95('0x0'));var moment=require('moment');var BPromise=require(_0xaf95('0x1'));var rs=require(_0xaf95('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaf95('0x3'))['db'];var utils=require(_0xaf95('0x4'));var logger=require('../../config/logger')(_0xaf95('0x5'));var config=require(_0xaf95('0x6'));var jayson=require(_0xaf95('0x7'));var client=jayson[_0xaf95('0x8')][_0xaf95('0x9')]({'port':0x232a});config[_0xaf95('0xa')]=_[_0xaf95('0xb')](config[_0xaf95('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xaf95('0xa')]));require('./whatsappAccount.socket')[_0xaf95('0xc')](socket);function respondWithRpcPromise(_0x1d2a69,_0x2a7615,_0x101f5b){return new BPromise(function(_0x5325c1,_0x41bce5){return client[_0xaf95('0xd')](_0x1d2a69,_0x101f5b)[_0xaf95('0xe')](function(_0x2439e0){logger['info'](_0xaf95('0xf'),_0x2a7615,_0xaf95('0x10'));logger[_0xaf95('0x11')](_0xaf95('0x12'),_0x2a7615,_0xaf95('0x10'),JSON[_0xaf95('0x13')](_0x2439e0));if(_0x2439e0['error']){if(_0x2439e0['error'][_0xaf95('0x14')]===0x1f4){logger[_0xaf95('0x15')](_0xaf95('0xf'),_0x2a7615,_0x2439e0[_0xaf95('0x15')][_0xaf95('0x16')]);return _0x41bce5(_0x2439e0[_0xaf95('0x15')][_0xaf95('0x16')]);}logger[_0xaf95('0x15')](_0xaf95('0xf'),_0x2a7615,_0x2439e0[_0xaf95('0x15')]['message']);return _0x5325c1(_0x2439e0[_0xaf95('0x15')]['message']);}else{logger[_0xaf95('0x17')](_0xaf95('0xf'),_0x2a7615,_0xaf95('0x10'));_0x5325c1(_0x2439e0[_0xaf95('0x18')][_0xaf95('0x16')]);}})[_0xaf95('0x19')](function(_0x3af7a2){logger[_0xaf95('0x15')]('WhatsappAccount,\x20%s,\x20%s',_0x2a7615,_0x3af7a2);_0x41bce5(_0x3af7a2);});});}exports['ShowWhatsappAccount']=function(_0x5de666){var _0x29c0fa=this;return new Promise(function(_0x4d5685,_0x3d57ad){return db[_0xaf95('0x1a')][_0xaf95('0x1b')]({'raw':_0x5de666[_0xaf95('0x1c')]?_0x5de666[_0xaf95('0x1c')][_0xaf95('0x1d')]===undefined?!![]:![]:!![],'where':_0x5de666[_0xaf95('0x1c')]?_0x5de666[_0xaf95('0x1c')][_0xaf95('0x1e')]||null:null,'attributes':_0x5de666[_0xaf95('0x1c')]?_0x5de666[_0xaf95('0x1c')][_0xaf95('0x1f')]||null:null,'include':_0x5de666[_0xaf95('0x1c')]?_0x5de666['options'][_0xaf95('0x20')]?_['map'](_0x5de666[_0xaf95('0x1c')]['include'],function(_0x466243){return{'model':db[_0x466243[_0xaf95('0x21')]],'as':_0x466243['as'],'attributes':_0x466243[_0xaf95('0x1f')],'include':_0x466243[_0xaf95('0x20')]?_[_0xaf95('0x22')](_0x466243['include'],function(_0x156af0){return{'model':db[_0x156af0[_0xaf95('0x21')]],'as':_0x156af0['as'],'attributes':_0x156af0[_0xaf95('0x1f')],'include':_0x156af0[_0xaf95('0x20')]?_[_0xaf95('0x22')](_0x156af0[_0xaf95('0x20')],function(_0x2323be){return{'model':db[_0x2323be[_0xaf95('0x21')]],'as':_0x2323be['as'],'attributes':_0x2323be[_0xaf95('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xaf95('0xe')](function(_0x1f558e){logger[_0xaf95('0x17')](_0xaf95('0x23'),_0x5de666);logger[_0xaf95('0x11')]('ShowWhatsappAccount',_0x5de666,JSON[_0xaf95('0x13')](_0x1f558e));_0x4d5685(_0x1f558e);})['catch'](function(_0x5a6e44){logger[_0xaf95('0x15')]('ShowWhatsappAccount',_0x5a6e44[_0xaf95('0x16')],_0x5de666);_0x3d57ad(_0x29c0fa['error'](0x1f4,_0x5a6e44['message']));});});}; \ No newline at end of file +var _0xba6c=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','register','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','WhatsappAccount','options','raw','attributes','include','map','model','debug','ShowWhatsappAccount','lodash'];(function(_0x1ae31c,_0x8dcd2d){var _0x19519d=function(_0x22b8cd){while(--_0x22b8cd){_0x1ae31c['push'](_0x1ae31c['shift']());}};_0x19519d(++_0x8dcd2d);}(_0xba6c,0x6e));var _0xcba6=function(_0x34d346,_0x4c6502){_0x34d346=_0x34d346-0x0;var _0x122d76=_0xba6c[_0x34d346];return _0x122d76;};'use strict';var _=require(_0xcba6('0x0'));var util=require(_0xcba6('0x1'));var moment=require(_0xcba6('0x2'));var BPromise=require(_0xcba6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcba6('0x4'));var db=require(_0xcba6('0x5'))['db'];var utils=require(_0xcba6('0x6'));var logger=require(_0xcba6('0x7'))(_0xcba6('0x8'));var config=require(_0xcba6('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xcba6('0xa')][_0xcba6('0xb')]({'port':0x232a});config[_0xcba6('0xc')]=_['defaults'](config['redis'],{'host':_0xcba6('0xd'),'port':0x18eb});var socket=require(_0xcba6('0xe'))(new Redis(config[_0xcba6('0xc')]));require('./whatsappAccount.socket')[_0xcba6('0xf')](socket);function respondWithRpcPromise(_0x205847,_0x460c80,_0xe5e339){return new BPromise(function(_0x4df12a,_0x201903){return client[_0xcba6('0x10')](_0x205847,_0xe5e339)[_0xcba6('0x11')](function(_0x3d154d){logger[_0xcba6('0x12')](_0xcba6('0x13'),_0x460c80,_0xcba6('0x14'));logger['debug'](_0xcba6('0x15'),_0x460c80,_0xcba6('0x14'),JSON[_0xcba6('0x16')](_0x3d154d));if(_0x3d154d['error']){if(_0x3d154d[_0xcba6('0x17')][_0xcba6('0x18')]===0x1f4){logger[_0xcba6('0x17')](_0xcba6('0x13'),_0x460c80,_0x3d154d['error'][_0xcba6('0x19')]);return _0x201903(_0x3d154d[_0xcba6('0x17')]['message']);}logger[_0xcba6('0x17')](_0xcba6('0x13'),_0x460c80,_0x3d154d[_0xcba6('0x17')]['message']);return _0x4df12a(_0x3d154d['error'][_0xcba6('0x19')]);}else{logger['info'](_0xcba6('0x13'),_0x460c80,_0xcba6('0x14'));_0x4df12a(_0x3d154d[_0xcba6('0x1a')][_0xcba6('0x19')]);}})[_0xcba6('0x1b')](function(_0x4074a7){logger[_0xcba6('0x17')](_0xcba6('0x13'),_0x460c80,_0x4074a7);_0x201903(_0x4074a7);});});}exports['ShowWhatsappAccount']=function(_0x5827ca){var _0x57b756=this;return new Promise(function(_0x3f42b6,_0x17414f){return db[_0xcba6('0x1c')]['find']({'raw':_0x5827ca[_0xcba6('0x1d')]?_0x5827ca['options'][_0xcba6('0x1e')]===undefined?!![]:![]:!![],'where':_0x5827ca[_0xcba6('0x1d')]?_0x5827ca[_0xcba6('0x1d')]['where']||null:null,'attributes':_0x5827ca[_0xcba6('0x1d')]?_0x5827ca[_0xcba6('0x1d')][_0xcba6('0x1f')]||null:null,'include':_0x5827ca[_0xcba6('0x1d')]?_0x5827ca[_0xcba6('0x1d')][_0xcba6('0x20')]?_[_0xcba6('0x21')](_0x5827ca[_0xcba6('0x1d')][_0xcba6('0x20')],function(_0x10224e){return{'model':db[_0x10224e[_0xcba6('0x22')]],'as':_0x10224e['as'],'attributes':_0x10224e[_0xcba6('0x1f')],'include':_0x10224e[_0xcba6('0x20')]?_[_0xcba6('0x21')](_0x10224e[_0xcba6('0x20')],function(_0x193cc8){return{'model':db[_0x193cc8[_0xcba6('0x22')]],'as':_0x193cc8['as'],'attributes':_0x193cc8[_0xcba6('0x1f')],'include':_0x193cc8['include']?_[_0xcba6('0x21')](_0x193cc8[_0xcba6('0x20')],function(_0x31c19c){return{'model':db[_0x31c19c[_0xcba6('0x22')]],'as':_0x31c19c['as'],'attributes':_0x31c19c[_0xcba6('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xcba6('0x11')](function(_0x27b7c5){logger[_0xcba6('0x12')]('ShowWhatsappAccount',_0x5827ca);logger[_0xcba6('0x23')](_0xcba6('0x24'),_0x5827ca,JSON[_0xcba6('0x16')](_0x27b7c5));_0x3f42b6(_0x27b7c5);})['catch'](function(_0x503512){logger[_0xcba6('0x17')](_0xcba6('0x24'),_0x503512[_0xcba6('0x19')],_0x5827ca);_0x17414f(_0x57b756[_0xcba6('0x17')](0x1f4,_0x503512[_0xcba6('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index f516b18..774eb62 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 _0x63e2=['register','length','whatsappAccount:','save','remove','emit','removeListener'];(function(_0x45073e,_0x2f5e78){var _0xefe68b=function(_0x3b172f){while(--_0x3b172f){_0x45073e['push'](_0x45073e['shift']());}};_0xefe68b(++_0x2f5e78);}(_0x63e2,0x1d8));var _0x263e=function(_0x4c34d8,_0x383073){_0x4c34d8=_0x4c34d8-0x0;var _0x4c21df=_0x63e2[_0x4c34d8];return _0x4c21df;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=[_0x263e('0x0'),_0x263e('0x1'),'update'];function createListener(_0x330771,_0x299b2c){return function(_0x1a5ce4){_0x299b2c[_0x263e('0x2')](_0x330771,_0x1a5ce4);};}function removeListener(_0x3b2c7f,_0x34a6f5){return function(){WhatsappAccountEvents[_0x263e('0x3')](_0x3b2c7f,_0x34a6f5);};}exports[_0x263e('0x4')]=function(_0x53a32d){for(var _0x32faa4=0x0,_0x968b39=events[_0x263e('0x5')];_0x32faa4<_0x968b39;_0x32faa4++){var _0xaadf7b=events[_0x32faa4];var _0x17c116=createListener(_0x263e('0x6')+_0xaadf7b,_0x53a32d);WhatsappAccountEvents['on'](_0xaadf7b,_0x17c116);}}; \ No newline at end of file +var _0x80cd=['./whatsappAccount.events','save','update','emit','removeListener','register','whatsappAccount:'];(function(_0x2521f2,_0x1346fa){var _0x106409=function(_0x230c91){while(--_0x230c91){_0x2521f2['push'](_0x2521f2['shift']());}};_0x106409(++_0x1346fa);}(_0x80cd,0x13b));var _0xd80c=function(_0x4687df,_0x12099c){_0x4687df=_0x4687df-0x0;var _0x32eaef=_0x80cd[_0x4687df];return _0x32eaef;};'use strict';var WhatsappAccountEvents=require(_0xd80c('0x0'));var events=[_0xd80c('0x1'),'remove',_0xd80c('0x2')];function createListener(_0x3a81be,_0x1d2f16){return function(_0x395b53){_0x1d2f16[_0xd80c('0x3')](_0x3a81be,_0x395b53);};}function removeListener(_0x413eab,_0x1fd1e0){return function(){WhatsappAccountEvents[_0xd80c('0x4')](_0x413eab,_0x1fd1e0);};}exports[_0xd80c('0x5')]=function(_0x54be71){for(var _0x61fc3=0x0,_0x58cf8c=events['length'];_0x61fc3<_0x58cf8c;_0x61fc3++){var _0x4e234f=events[_0x61fc3];var _0x4a218b=createListener(_0xd80c('0x6')+_0x4e234f,_0x54be71);WhatsappAccountEvents['on'](_0x4e234f,_0x4a218b);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index ea3c23f..68e8ca8 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 _0xa8e1=['../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','index','show','create','/:id','update','delete','exports','multer','connect-timeout','fs-extra','../../components/auth/service'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xa8e1,0x1ec));var _0x1a8e=function(_0xf26d40,_0x2f4f46){_0xf26d40=_0xf26d40-0x0;var _0x50b68c=_0xa8e1[_0xf26d40];return _0x50b68c;};'use strict';var multer=require(_0x1a8e('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x1a8e('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x1a8e('0x2'));var auth=require(_0x1a8e('0x3'));var interaction=require(_0x1a8e('0x4'));var config=require(_0x1a8e('0x5'));var controller=require(_0x1a8e('0x6'));router[_0x1a8e('0x7')]('/',auth[_0x1a8e('0x8')](),controller[_0x1a8e('0x9')]);router['get']('/:id',auth[_0x1a8e('0x8')](),controller[_0x1a8e('0xa')]);router['post']('/',auth[_0x1a8e('0x8')](),controller[_0x1a8e('0xb')]);router['put'](_0x1a8e('0xc'),auth[_0x1a8e('0x8')](),controller[_0x1a8e('0xd')]);router[_0x1a8e('0xe')]('/:id',auth[_0x1a8e('0x8')](),controller['destroy']);module[_0x1a8e('0xf')]=router; \ No newline at end of file +var _0xcdc8=['/:id','show','post','create','delete','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x171b65,_0x1aaf90){var _0xfb01b7=function(_0x29976d){while(--_0x29976d){_0x171b65['push'](_0x171b65['shift']());}};_0xfb01b7(++_0x1aaf90);}(_0xcdc8,0x1d5));var _0x8cdc=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xcdc8[_0x21aec3];return _0x288bbc;};'use strict';var multer=require('multer');var util=require(_0x8cdc('0x0'));var path=require(_0x8cdc('0x1'));var timeout=require('connect-timeout');var express=require(_0x8cdc('0x2'));var router=express[_0x8cdc('0x3')]();var fs_extra=require(_0x8cdc('0x4'));var auth=require(_0x8cdc('0x5'));var interaction=require(_0x8cdc('0x6'));var config=require(_0x8cdc('0x7'));var controller=require('./whatsappApplication.controller');router[_0x8cdc('0x8')]('/',auth[_0x8cdc('0x9')](),controller[_0x8cdc('0xa')]);router[_0x8cdc('0x8')](_0x8cdc('0xb'),auth[_0x8cdc('0x9')](),controller[_0x8cdc('0xc')]);router[_0x8cdc('0xd')]('/',auth[_0x8cdc('0x9')](),controller[_0x8cdc('0xe')]);router['put'](_0x8cdc('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x8cdc('0xf')](_0x8cdc('0xb'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index fad5a4d..746eeb2 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 _0x9d8c=['STRING','exports','noop','TEXT'];(function(_0x133277,_0xb1d6b2){var _0x5b4a22=function(_0x484c26){while(--_0x484c26){_0x133277['push'](_0x133277['shift']());}};_0x5b4a22(++_0xb1d6b2);}(_0x9d8c,0x135));var _0xc9d8=function(_0x46d272,_0x276a76){_0x46d272=_0x46d272-0x0;var _0x58b13d=_0x9d8c[_0x46d272];return _0x58b13d;};'use strict';var Sequelize=require('sequelize');module[_0xc9d8('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xc9d8('0x1')},'appdata':{'type':Sequelize[_0xc9d8('0x2')]()},'description':{'type':Sequelize[_0xc9d8('0x3')]},'interval':{'type':Sequelize[_0xc9d8('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x6f7f=['INTEGER','STRING','TEXT','*,*,*,*','sequelize','exports'];(function(_0x15c421,_0x6366f7){var _0x5e5ed5=function(_0x206e66){while(--_0x206e66){_0x15c421['push'](_0x15c421['shift']());}};_0x5e5ed5(++_0x6366f7);}(_0x6f7f,0x13c));var _0xf6f7=function(_0x1bc9cd,_0x4da80c){_0x1bc9cd=_0x1bc9cd-0x0;var _0x13bc89=_0x6f7f[_0x1bc9cd];return _0x13bc89;};'use strict';var Sequelize=require(_0xf6f7('0x0'));module[_0xf6f7('0x1')]={'priority':{'type':Sequelize[_0xf6f7('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xf6f7('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xf6f7('0x4')]()},'description':{'type':Sequelize[_0xf6f7('0x3')]},'interval':{'type':Sequelize[_0xf6f7('0x3')],'defaultValue':_0xf6f7('0x5')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 8976bd9..969c309 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 _0xb366=['hasOwnProperty','nolimit','offset','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','findAll','catch','show','params','keys','include','find','create','body','destroy','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','to-csv','ejs','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','limit','count','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','index','map','WhatsappApplication','rawAttributes','fieldName','type','model','query','filters','attributes','intersection','fields','length'];(function(_0x17ed43,_0x1c8035){var _0x2cd90b=function(_0x283b02){while(--_0x283b02){_0x17ed43['push'](_0x17ed43['shift']());}};_0x2cd90b(++_0x1c8035);}(_0xb366,0xa4));var _0x6b36=function(_0x511a5a,_0x4a687c){_0x511a5a=_0x511a5a-0x0;var _0x2a840c=_0xb366[_0x511a5a];return _0x2a840c;};'use strict';var emlformat=require(_0x6b36('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6b36('0x1'));var jsonpatch=require(_0x6b36('0x2'));var rp=require('request-promise');var moment=require(_0x6b36('0x3'));var BPromise=require(_0x6b36('0x4'));var Mustache=require(_0x6b36('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x6b36('0x6'));var ejs=require(_0x6b36('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6b36('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x6b36('0x9'));var deskjs=require(_0x6b36('0xa'));var toCsv=require(_0x6b36('0x6'));var querystring=require(_0x6b36('0xb'));var Papa=require('papaparse');var Redis=require(_0x6b36('0xc'));var authService=require(_0x6b36('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x6b36('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6b36('0xf'))(_0x6b36('0x10'));var utils=require(_0x6b36('0x11'));var config=require(_0x6b36('0x12'));var licenseUtil=require(_0x6b36('0x13'));var db=require(_0x6b36('0x14'))['db'];function respondWithStatusCode(_0x51ff2a,_0x22bab4){_0x22bab4=_0x22bab4||0xcc;return function(_0x283873){if(_0x283873){return _0x51ff2a['sendStatus'](_0x22bab4);}return _0x51ff2a[_0x6b36('0x15')](_0x22bab4)['end']();};}function respondWithResult(_0x1351f3,_0x4fffe4){_0x4fffe4=_0x4fffe4||0xc8;return function(_0x4dd3ed){if(_0x4dd3ed){return _0x1351f3['status'](_0x4fffe4)[_0x6b36('0x16')](_0x4dd3ed);}};}function respondWithFilteredResult(_0x3cfdff,_0x291a25){return function(_0x4f6ca1){if(_0x4f6ca1){var _0x207dc7=typeof _0x291a25['offset']===_0x6b36('0x17')&&typeof _0x291a25[_0x6b36('0x18')]===_0x6b36('0x17');var _0x58dc48=_0x4f6ca1['count'];var _0x17c969=_0x207dc7?0x0:_0x291a25['offset'];var _0x41334a=_0x207dc7?_0x4f6ca1[_0x6b36('0x19')]:_0x291a25['offset']+_0x291a25[_0x6b36('0x18')];var _0x56b605;if(_0x41334a>=_0x58dc48){_0x41334a=_0x58dc48;_0x56b605=0xc8;}else{_0x56b605=0xce;}_0x3cfdff[_0x6b36('0x15')](_0x56b605);return _0x3cfdff['set'](_0x6b36('0x1a'),_0x17c969+'-'+_0x41334a+'/'+_0x58dc48)[_0x6b36('0x16')](_0x4f6ca1);}return null;};}function patchUpdates(_0xda25fd){return function(_0xa4157f){try{jsonpatch[_0x6b36('0x1b')](_0xa4157f,_0xda25fd,!![]);}catch(_0x280e60){return BPromise[_0x6b36('0x1c')](_0x280e60);}return _0xa4157f[_0x6b36('0x1d')]();};}function saveUpdates(_0xfa1de9,_0xc14d73){return function(_0x189e7b){if(_0x189e7b){return _0x189e7b[_0x6b36('0x1e')](_0xfa1de9)['then'](function(_0x3df348){return _0x3df348;});}return null;};}function removeEntity(_0x3dc7d1,_0x514c0d){return function(_0x264a83){if(_0x264a83){return _0x264a83['destroy']()[_0x6b36('0x1f')](function(){_0x3dc7d1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b00d1,_0x2aec5a){return function(_0x1fa74e){if(!_0x1fa74e){_0x5b00d1[_0x6b36('0x20')](0x194);}return _0x1fa74e;};}function handleError(_0xf0eec6,_0x2d1af7){_0x2d1af7=_0x2d1af7||0x1f4;return function(_0x33d343){logger[_0x6b36('0x21')](_0x33d343[_0x6b36('0x22')]);if(_0x33d343['name']){delete _0x33d343[_0x6b36('0x23')];}_0xf0eec6[_0x6b36('0x15')](_0x2d1af7)['send'](_0x33d343);};}exports[_0x6b36('0x24')]=function(_0x432637,_0x4920df){var _0x40741d={},_0x111655={},_0xdf2d9c={'count':0x0,'rows':[]};var _0x45513b=_[_0x6b36('0x25')](db[_0x6b36('0x26')][_0x6b36('0x27')],function(_0xbc15cc){return{'name':_0xbc15cc[_0x6b36('0x28')],'type':_0xbc15cc[_0x6b36('0x29')]['key']};});_0x111655[_0x6b36('0x2a')]=_[_0x6b36('0x25')](_0x45513b,_0x6b36('0x23'));_0x111655[_0x6b36('0x2b')]=_['keys'](_0x432637['query']);_0x111655[_0x6b36('0x2c')]=_['intersection'](_0x111655[_0x6b36('0x2a')],_0x111655[_0x6b36('0x2b')]);_0x40741d[_0x6b36('0x2d')]=_[_0x6b36('0x2e')](_0x111655[_0x6b36('0x2a')],qs[_0x6b36('0x2f')](_0x432637[_0x6b36('0x2b')][_0x6b36('0x2f')]));_0x40741d[_0x6b36('0x2d')]=_0x40741d[_0x6b36('0x2d')][_0x6b36('0x30')]?_0x40741d['attributes']:_0x111655['model'];if(!_0x432637[_0x6b36('0x2b')][_0x6b36('0x31')](_0x6b36('0x32'))){_0x40741d[_0x6b36('0x18')]=qs[_0x6b36('0x18')](_0x432637['query']['limit']);_0x40741d[_0x6b36('0x33')]=qs[_0x6b36('0x33')](_0x432637[_0x6b36('0x2b')]['offset']);}_0x40741d[_0x6b36('0x34')]=qs[_0x6b36('0x35')](_0x432637['query'][_0x6b36('0x35')]);_0x40741d[_0x6b36('0x36')]=qs['filters'](_[_0x6b36('0x37')](_0x432637[_0x6b36('0x2b')],_0x111655[_0x6b36('0x2c')]),_0x45513b);if(_0x432637[_0x6b36('0x2b')]['filter']){_0x40741d[_0x6b36('0x36')]=_[_0x6b36('0x38')](_0x40741d[_0x6b36('0x36')],{'$or':_[_0x6b36('0x25')](_0x45513b,function(_0x49d42b){if(_0x49d42b[_0x6b36('0x29')]!==_0x6b36('0x39')){var _0x5e0455={};_0x5e0455[_0x49d42b[_0x6b36('0x23')]]={'$like':'%'+_0x432637['query'][_0x6b36('0x3a')]+'%'};return _0x5e0455;}})});}_0x40741d=_[_0x6b36('0x38')]({},_0x40741d,_0x432637[_0x6b36('0x3b')]);var _0x2dee8a={'where':_0x40741d[_0x6b36('0x36')]};return db['WhatsappApplication'][_0x6b36('0x19')](_0x2dee8a)[_0x6b36('0x1f')](function(_0x2cb16d){_0xdf2d9c['count']=_0x2cb16d;if(_0x432637[_0x6b36('0x2b')][_0x6b36('0x3c')]){_0x40741d['include']=[{'all':!![]}];}return db[_0x6b36('0x26')][_0x6b36('0x3d')](_0x40741d);})['then'](function(_0x427223){_0xdf2d9c['rows']=_0x427223;return _0xdf2d9c;})[_0x6b36('0x1f')](respondWithFilteredResult(_0x4920df,_0x40741d))[_0x6b36('0x3e')](handleError(_0x4920df,null));};exports[_0x6b36('0x3f')]=function(_0x576687,_0x47f8d6){var _0x226c52={'raw':!![],'where':{'id':_0x576687[_0x6b36('0x40')]['id']}},_0x33b6bc={};_0x33b6bc['model']=_[_0x6b36('0x41')](db[_0x6b36('0x26')][_0x6b36('0x27')]);_0x33b6bc[_0x6b36('0x2b')]=_[_0x6b36('0x41')](_0x576687[_0x6b36('0x2b')]);_0x33b6bc[_0x6b36('0x2c')]=_[_0x6b36('0x2e')](_0x33b6bc['model'],_0x33b6bc[_0x6b36('0x2b')]);_0x226c52[_0x6b36('0x2d')]=_[_0x6b36('0x2e')](_0x33b6bc['model'],qs['fields'](_0x576687[_0x6b36('0x2b')][_0x6b36('0x2f')]));_0x226c52[_0x6b36('0x2d')]=_0x226c52[_0x6b36('0x2d')][_0x6b36('0x30')]?_0x226c52[_0x6b36('0x2d')]:_0x33b6bc[_0x6b36('0x2a')];if(_0x576687[_0x6b36('0x2b')][_0x6b36('0x3c')]){_0x226c52[_0x6b36('0x42')]=[{'all':!![]}];}_0x226c52=_[_0x6b36('0x38')]({},_0x226c52,_0x576687[_0x6b36('0x3b')]);return db[_0x6b36('0x26')][_0x6b36('0x43')](_0x226c52)[_0x6b36('0x1f')](handleEntityNotFound(_0x47f8d6,null))[_0x6b36('0x1f')](respondWithResult(_0x47f8d6,null))['catch'](handleError(_0x47f8d6,null));};exports['create']=function(_0x51f0d4,_0x41e493){return db['WhatsappApplication'][_0x6b36('0x44')](_0x51f0d4[_0x6b36('0x45')],{})['then'](respondWithResult(_0x41e493,0xc9))['catch'](handleError(_0x41e493,null));};exports['update']=function(_0x5823ab,_0x2bfccf){if(_0x5823ab['body']['id']){delete _0x5823ab['body']['id'];}return db[_0x6b36('0x26')][_0x6b36('0x43')]({'where':{'id':_0x5823ab[_0x6b36('0x40')]['id']}})['then'](handleEntityNotFound(_0x2bfccf,null))[_0x6b36('0x1f')](saveUpdates(_0x5823ab[_0x6b36('0x45')],null))[_0x6b36('0x1f')](respondWithResult(_0x2bfccf,null))['catch'](handleError(_0x2bfccf,null));};exports[_0x6b36('0x46')]=function(_0x2b3d00,_0x3e8ca0){return db[_0x6b36('0x26')][_0x6b36('0x43')]({'where':{'id':_0x2b3d00[_0x6b36('0x40')]['id']}})['then'](handleEntityNotFound(_0x3e8ca0,null))[_0x6b36('0x1f')](removeEntity(_0x3e8ca0,null))['catch'](handleError(_0x3e8ca0,null));}; \ No newline at end of file +var _0xa35e=['api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','update','then','destroy','stack','name','index','map','WhatsappApplication','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','hasOwnProperty','order','sort','filters','pick','filter','where','VIRTUAL','merge','includeAll','findAll','rows','catch','params','keys','include','options','create','body','find','eml-format','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'];(function(_0x122e9b,_0x391bf4){var _0x22c247=function(_0x1b2c65){while(--_0x1b2c65){_0x122e9b['push'](_0x122e9b['shift']());}};_0x22c247(++_0x391bf4);}(_0xa35e,0x111));var _0xea35=function(_0x582d55,_0x4d9e1f){_0x582d55=_0x582d55-0x0;var _0xfd2e31=_0xa35e[_0x582d55];return _0xfd2e31;};'use strict';var emlformat=require(_0xea35('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xea35('0x1'));var jsonpatch=require(_0xea35('0x2'));var rp=require(_0xea35('0x3'));var moment=require(_0xea35('0x4'));var BPromise=require(_0xea35('0x5'));var Mustache=require(_0xea35('0x6'));var util=require(_0xea35('0x7'));var path=require(_0xea35('0x8'));var sox=require(_0xea35('0x9'));var csv=require(_0xea35('0xa'));var ejs=require(_0xea35('0xb'));var fs=require('fs');var fs_extra=require(_0xea35('0xc'));var _=require(_0xea35('0xd'));var squel=require(_0xea35('0xe'));var crypto=require('crypto');var jsforce=require(_0xea35('0xf'));var deskjs=require(_0xea35('0x10'));var toCsv=require(_0xea35('0xa'));var querystring=require('querystring');var Papa=require(_0xea35('0x11'));var Redis=require(_0xea35('0x12'));var authService=require(_0xea35('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xea35('0x14'));var hardwareService=require(_0xea35('0x15'));var logger=require(_0xea35('0x16'))(_0xea35('0x17'));var utils=require(_0xea35('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xea35('0x19'));var db=require(_0xea35('0x1a'))['db'];function respondWithStatusCode(_0x1914d4,_0x4a8e3d){_0x4a8e3d=_0x4a8e3d||0xcc;return function(_0x4eeb4b){if(_0x4eeb4b){return _0x1914d4[_0xea35('0x1b')](_0x4a8e3d);}return _0x1914d4[_0xea35('0x1c')](_0x4a8e3d)[_0xea35('0x1d')]();};}function respondWithResult(_0xb5f9a8,_0x4907be){_0x4907be=_0x4907be||0xc8;return function(_0x2c400a){if(_0x2c400a){return _0xb5f9a8['status'](_0x4907be)[_0xea35('0x1e')](_0x2c400a);}};}function respondWithFilteredResult(_0x3e7a79,_0x4ad1c3){return function(_0x281846){if(_0x281846){var _0x1a99af=typeof _0x4ad1c3[_0xea35('0x1f')]===_0xea35('0x20')&&typeof _0x4ad1c3[_0xea35('0x21')]===_0xea35('0x20');var _0x2b4322=_0x281846[_0xea35('0x22')];var _0x3b7336=_0x1a99af?0x0:_0x4ad1c3[_0xea35('0x1f')];var _0x4cf178=_0x1a99af?_0x281846[_0xea35('0x22')]:_0x4ad1c3[_0xea35('0x1f')]+_0x4ad1c3[_0xea35('0x21')];var _0x2d32e2;if(_0x4cf178>=_0x2b4322){_0x4cf178=_0x2b4322;_0x2d32e2=0xc8;}else{_0x2d32e2=0xce;}_0x3e7a79[_0xea35('0x1c')](_0x2d32e2);return _0x3e7a79['set'](_0xea35('0x23'),_0x3b7336+'-'+_0x4cf178+'/'+_0x2b4322)['json'](_0x281846);}return null;};}function patchUpdates(_0x9eb0a1){return function(_0x332fc2){try{jsonpatch['apply'](_0x332fc2,_0x9eb0a1,!![]);}catch(_0x123166){return BPromise[_0xea35('0x24')](_0x123166);}return _0x332fc2['save']();};}function saveUpdates(_0x1408ea,_0x3e46cf){return function(_0x3fa0c5){if(_0x3fa0c5){return _0x3fa0c5[_0xea35('0x25')](_0x1408ea)[_0xea35('0x26')](function(_0x50cf87){return _0x50cf87;});}return null;};}function removeEntity(_0x41c8c0,_0x1cb455){return function(_0x342749){if(_0x342749){return _0x342749[_0xea35('0x27')]()[_0xea35('0x26')](function(){_0x41c8c0[_0xea35('0x1c')](0xcc)[_0xea35('0x1d')]();});}};}function handleEntityNotFound(_0x49edd3,_0x5e6443){return function(_0x53510d){if(!_0x53510d){_0x49edd3[_0xea35('0x1b')](0x194);}return _0x53510d;};}function handleError(_0x590c4d,_0x56a63f){_0x56a63f=_0x56a63f||0x1f4;return function(_0x27b55a){logger['error'](_0x27b55a[_0xea35('0x28')]);if(_0x27b55a[_0xea35('0x29')]){delete _0x27b55a[_0xea35('0x29')];}_0x590c4d[_0xea35('0x1c')](_0x56a63f)['send'](_0x27b55a);};}exports[_0xea35('0x2a')]=function(_0x261a88,_0x2cffb5){var _0x33b3e7={},_0x5d4207={},_0x16fd14={'count':0x0,'rows':[]};var _0x5d8111=_[_0xea35('0x2b')](db[_0xea35('0x2c')][_0xea35('0x2d')],function(_0x2ff076){return{'name':_0x2ff076[_0xea35('0x2e')],'type':_0x2ff076[_0xea35('0x2f')][_0xea35('0x30')]};});_0x5d4207[_0xea35('0x31')]=_['map'](_0x5d8111,_0xea35('0x29'));_0x5d4207[_0xea35('0x32')]=_['keys'](_0x261a88[_0xea35('0x32')]);_0x5d4207['filters']=_[_0xea35('0x33')](_0x5d4207[_0xea35('0x31')],_0x5d4207[_0xea35('0x32')]);_0x33b3e7[_0xea35('0x34')]=_[_0xea35('0x33')](_0x5d4207[_0xea35('0x31')],qs[_0xea35('0x35')](_0x261a88['query']['fields']));_0x33b3e7[_0xea35('0x34')]=_0x33b3e7[_0xea35('0x34')]['length']?_0x33b3e7[_0xea35('0x34')]:_0x5d4207[_0xea35('0x31')];if(!_0x261a88['query'][_0xea35('0x36')]('nolimit')){_0x33b3e7[_0xea35('0x21')]=qs[_0xea35('0x21')](_0x261a88[_0xea35('0x32')][_0xea35('0x21')]);_0x33b3e7[_0xea35('0x1f')]=qs[_0xea35('0x1f')](_0x261a88[_0xea35('0x32')][_0xea35('0x1f')]);}_0x33b3e7[_0xea35('0x37')]=qs[_0xea35('0x38')](_0x261a88[_0xea35('0x32')]['sort']);_0x33b3e7['where']=qs[_0xea35('0x39')](_[_0xea35('0x3a')](_0x261a88['query'],_0x5d4207['filters']),_0x5d8111);if(_0x261a88[_0xea35('0x32')][_0xea35('0x3b')]){_0x33b3e7[_0xea35('0x3c')]=_['merge'](_0x33b3e7[_0xea35('0x3c')],{'$or':_['map'](_0x5d8111,function(_0x488104){if(_0x488104[_0xea35('0x2f')]!==_0xea35('0x3d')){var _0x244ec2={};_0x244ec2[_0x488104['name']]={'$like':'%'+_0x261a88['query'][_0xea35('0x3b')]+'%'};return _0x244ec2;}})});}_0x33b3e7=_[_0xea35('0x3e')]({},_0x33b3e7,_0x261a88['options']);var _0x366591={'where':_0x33b3e7[_0xea35('0x3c')]};return db[_0xea35('0x2c')][_0xea35('0x22')](_0x366591)[_0xea35('0x26')](function(_0x1e4d77){_0x16fd14['count']=_0x1e4d77;if(_0x261a88[_0xea35('0x32')][_0xea35('0x3f')]){_0x33b3e7['include']=[{'all':!![]}];}return db[_0xea35('0x2c')][_0xea35('0x40')](_0x33b3e7);})[_0xea35('0x26')](function(_0x73f98e){_0x16fd14[_0xea35('0x41')]=_0x73f98e;return _0x16fd14;})[_0xea35('0x26')](respondWithFilteredResult(_0x2cffb5,_0x33b3e7))[_0xea35('0x42')](handleError(_0x2cffb5,null));};exports['show']=function(_0x463b31,_0x49ca57){var _0x526b0f={'raw':!![],'where':{'id':_0x463b31[_0xea35('0x43')]['id']}},_0x5d6cf7={};_0x5d6cf7[_0xea35('0x31')]=_[_0xea35('0x44')](db[_0xea35('0x2c')][_0xea35('0x2d')]);_0x5d6cf7['query']=_[_0xea35('0x44')](_0x463b31[_0xea35('0x32')]);_0x5d6cf7[_0xea35('0x39')]=_[_0xea35('0x33')](_0x5d6cf7['model'],_0x5d6cf7[_0xea35('0x32')]);_0x526b0f[_0xea35('0x34')]=_[_0xea35('0x33')](_0x5d6cf7['model'],qs[_0xea35('0x35')](_0x463b31[_0xea35('0x32')][_0xea35('0x35')]));_0x526b0f[_0xea35('0x34')]=_0x526b0f['attributes']['length']?_0x526b0f[_0xea35('0x34')]:_0x5d6cf7['model'];if(_0x463b31['query'][_0xea35('0x3f')]){_0x526b0f[_0xea35('0x45')]=[{'all':!![]}];}_0x526b0f=_[_0xea35('0x3e')]({},_0x526b0f,_0x463b31[_0xea35('0x46')]);return db[_0xea35('0x2c')]['find'](_0x526b0f)[_0xea35('0x26')](handleEntityNotFound(_0x49ca57,null))[_0xea35('0x26')](respondWithResult(_0x49ca57,null))[_0xea35('0x42')](handleError(_0x49ca57,null));};exports[_0xea35('0x47')]=function(_0x2ec1e,_0x58a14f){return db[_0xea35('0x2c')][_0xea35('0x47')](_0x2ec1e['body'],{})[_0xea35('0x26')](respondWithResult(_0x58a14f,0xc9))[_0xea35('0x42')](handleError(_0x58a14f,null));};exports[_0xea35('0x25')]=function(_0x46172e,_0x53e744){if(_0x46172e[_0xea35('0x48')]['id']){delete _0x46172e['body']['id'];}return db[_0xea35('0x2c')]['find']({'where':{'id':_0x46172e[_0xea35('0x43')]['id']}})[_0xea35('0x26')](handleEntityNotFound(_0x53e744,null))[_0xea35('0x26')](saveUpdates(_0x46172e[_0xea35('0x48')],null))[_0xea35('0x26')](respondWithResult(_0x53e744,null))[_0xea35('0x42')](handleError(_0x53e744,null));};exports['destroy']=function(_0x1ef903,_0x525fd4){return db['WhatsappApplication'][_0xea35('0x49')]({'where':{'id':_0x1ef903[_0xea35('0x43')]['id']}})[_0xea35('0x26')](handleEntityNotFound(_0x525fd4,null))[_0xea35('0x26')](removeEntity(_0x525fd4,null))[_0xea35('0x42')](handleError(_0x525fd4,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index dff5386..d14c076 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 _0x49c4=['utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define','WhatsappApplication','whatsapp_applications','utf8mb4'];(function(_0xa651d4,_0x5df6cb){var _0x1301be=function(_0x5aa409){while(--_0x5aa409){_0xa651d4['push'](_0xa651d4['shift']());}};_0x1301be(++_0x5df6cb);}(_0x49c4,0x9b));var _0x449c=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0x49c4[_0x17b6e3];return _0x3906f3;};'use strict';var _=require(_0x449c('0x0'));var util=require('util');var logger=require(_0x449c('0x1'))(_0x449c('0x2'));var moment=require(_0x449c('0x3'));var BPromise=require(_0x449c('0x4'));var rp=require(_0x449c('0x5'));var fs=require('fs');var path=require(_0x449c('0x6'));var rimraf=require(_0x449c('0x7'));var config=require('../../config/environment');var attributes=require('./whatsappApplication.attributes');module[_0x449c('0x8')]=function(_0x442e56,_0x12586c){return _0x442e56[_0x449c('0x9')](_0x449c('0xa'),attributes,{'tableName':_0x449c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x449c('0xc'),'collate':_0x449c('0xd')});}; \ No newline at end of file +var _0x29d4=['utf8mb4','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./whatsappApplication.attributes','exports','define','WhatsappApplication'];(function(_0x367672,_0x171c6c){var _0x3b479e=function(_0x4d21db){while(--_0x4d21db){_0x367672['push'](_0x367672['shift']());}};_0x3b479e(++_0x171c6c);}(_0x29d4,0x1a1));var _0x429d=function(_0x2cf2e9,_0xd58ea1){_0x2cf2e9=_0x2cf2e9-0x0;var _0xd3670d=_0x29d4[_0x2cf2e9];return _0xd3670d;};'use strict';var _=require(_0x429d('0x0'));var util=require('util');var logger=require(_0x429d('0x1'))(_0x429d('0x2'));var moment=require(_0x429d('0x3'));var BPromise=require(_0x429d('0x4'));var rp=require(_0x429d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x429d('0x6'));var config=require(_0x429d('0x7'));var attributes=require(_0x429d('0x8'));module[_0x429d('0x9')]=function(_0x1c55aa,_0xa71445){return _0x1c55aa[_0x429d('0xa')](_0x429d('0xb'),attributes,{'tableName':'whatsapp_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x429d('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 1051b9a..0ef5465 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 _0x7bae=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','moment','bluebird','ioredis','../../config/utils','../../config/logger'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x7bae,0x13b));var _0xe7ba=function(_0xdc37a1,_0x53ebb9){_0xdc37a1=_0xdc37a1-0x0;var _0x99b4fe=_0x7bae[_0xdc37a1];return _0x99b4fe;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe7ba('0x0'));var BPromise=require(_0xe7ba('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe7ba('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xe7ba('0x3'));var logger=require(_0xe7ba('0x4'))(_0xe7ba('0x5'));var config=require(_0xe7ba('0x6'));var jayson=require(_0xe7ba('0x7'));var client=jayson[_0xe7ba('0x8')][_0xe7ba('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3c5e59,_0x10b307,_0x34fb18){return new BPromise(function(_0x160565,_0x27b1d5){return client[_0xe7ba('0xa')](_0x3c5e59,_0x34fb18)[_0xe7ba('0xb')](function(_0x588f08){logger[_0xe7ba('0xc')](_0xe7ba('0xd'),_0x10b307,_0xe7ba('0xe'));logger[_0xe7ba('0xf')](_0xe7ba('0x10'),_0x10b307,_0xe7ba('0xe'),JSON[_0xe7ba('0x11')](_0x588f08));if(_0x588f08[_0xe7ba('0x12')]){if(_0x588f08[_0xe7ba('0x12')]['code']===0x1f4){logger[_0xe7ba('0x12')]('WhatsappApplication,\x20%s,\x20%s',_0x10b307,_0x588f08[_0xe7ba('0x12')][_0xe7ba('0x13')]);return _0x27b1d5(_0x588f08[_0xe7ba('0x12')][_0xe7ba('0x13')]);}logger[_0xe7ba('0x12')](_0xe7ba('0xd'),_0x10b307,_0x588f08['error']['message']);return _0x160565(_0x588f08[_0xe7ba('0x12')][_0xe7ba('0x13')]);}else{logger[_0xe7ba('0xc')]('WhatsappApplication,\x20%s,\x20%s',_0x10b307,_0xe7ba('0xe'));_0x160565(_0x588f08['result']['message']);}})['catch'](function(_0x393f75){logger['error'](_0xe7ba('0xd'),_0x10b307,_0x393f75);_0x27b1d5(_0x393f75);});});} \ No newline at end of file +var _0xb458=['WhatsappApplication,\x20%s,\x20%s,\x20%s','code','error','message','request\x20sent','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','then','info','WhatsappApplication,\x20%s,\x20%s','debug'];(function(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0xb458,0x103));var _0x8b45=function(_0x4973e2,_0x3973a9){_0x4973e2=_0x4973e2-0x0;var _0x596228=_0xb458[_0x4973e2];return _0x596228;};'use strict';var _=require(_0x8b45('0x0'));var util=require(_0x8b45('0x1'));var moment=require(_0x8b45('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8b45('0x3'));var db=require(_0x8b45('0x4'))['db'];var utils=require(_0x8b45('0x5'));var logger=require(_0x8b45('0x6'))('rpc');var config=require(_0x8b45('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8b45('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x12bd05,_0x2daa9a,_0x3a8ccb){return new BPromise(function(_0x32342f,_0x4d1718){return client[_0x8b45('0x9')](_0x12bd05,_0x3a8ccb)[_0x8b45('0xa')](function(_0x33f30e){logger[_0x8b45('0xb')](_0x8b45('0xc'),_0x2daa9a,'request\x20sent');logger[_0x8b45('0xd')](_0x8b45('0xe'),_0x2daa9a,'request\x20sent',JSON['stringify'](_0x33f30e));if(_0x33f30e['error']){if(_0x33f30e['error'][_0x8b45('0xf')]===0x1f4){logger[_0x8b45('0x10')](_0x8b45('0xc'),_0x2daa9a,_0x33f30e['error'][_0x8b45('0x11')]);return _0x4d1718(_0x33f30e[_0x8b45('0x10')][_0x8b45('0x11')]);}logger[_0x8b45('0x10')](_0x8b45('0xc'),_0x2daa9a,_0x33f30e[_0x8b45('0x10')]['message']);return _0x32342f(_0x33f30e['error'][_0x8b45('0x11')]);}else{logger[_0x8b45('0xb')](_0x8b45('0xc'),_0x2daa9a,_0x8b45('0x12'));_0x32342f(_0x33f30e[_0x8b45('0x13')][_0x8b45('0x11')]);}})[_0x8b45('0x14')](function(_0x147d6b){logger[_0x8b45('0x10')](_0x8b45('0xc'),_0x2daa9a,_0x147d6b);_0x4d1718(_0x147d6b);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 74a79db..d8b70ad 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 _0xed1c=['whatsappinteraction:addtags','addTags','put','whatsapp','whatsappinteraction:update','update','delete','whatsappinteraction:destroy','destroy','removeTags','exports','multer','util','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download','post','create','/:id/messages','addMessage','tracked'];(function(_0x54edc9,_0x345f01){var _0x2ae7a9=function(_0x24a545){while(--_0x24a545){_0x54edc9['push'](_0x54edc9['shift']());}};_0x2ae7a9(++_0x345f01);}(_0xed1c,0xe4));var _0xced1=function(_0x1cdc44,_0x5e5ea1){_0x1cdc44=_0x1cdc44-0x0;var _0x2bcf3c=_0xed1c[_0x1cdc44];return _0x2bcf3c;};'use strict';var multer=require(_0xced1('0x0'));var util=require(_0xced1('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xced1('0x2'));var auth=require(_0xced1('0x3'));var interaction=require(_0xced1('0x4'));var config=require('../../config/environment');var controller=require(_0xced1('0x5'));router[_0xced1('0x6')]('/',auth[_0xced1('0x7')](),controller[_0xced1('0x8')]);router['get'](_0xced1('0x9'),auth[_0xced1('0x7')](),controller[_0xced1('0xa')]);router[_0xced1('0x6')](_0xced1('0xb'),auth[_0xced1('0x7')](),controller[_0xced1('0xc')]);router[_0xced1('0x6')]('/:id/messages',auth[_0xced1('0x7')](),controller['getMessages']);router[_0xced1('0x6')](_0xced1('0xd'),auth[_0xced1('0x7')](),controller[_0xced1('0xe')]);router[_0xced1('0xf')]('/',auth[_0xced1('0x7')](),controller[_0xced1('0x10')]);router['post'](_0xced1('0x11'),auth[_0xced1('0x7')](),controller[_0xced1('0x12')]);router[_0xced1('0xf')]('/:id/tags',auth[_0xced1('0x7')](),interaction[_0xced1('0x13')]('whatsapp',_0xced1('0x14')),controller[_0xced1('0x15')]);router[_0xced1('0x16')](_0xced1('0xb'),auth['isAuthenticated'](),interaction['tracked'](_0xced1('0x17'),_0xced1('0x18')),controller[_0xced1('0x19')]);router[_0xced1('0x1a')](_0xced1('0xb'),auth[_0xced1('0x7')](),interaction['tracked']('whatsapp',_0xced1('0x1b')),controller[_0xced1('0x1c')]);router[_0xced1('0x1a')]('/:id/tags',auth[_0xced1('0x7')](),controller[_0xced1('0x1d')]);module[_0xced1('0x1e')]=router; \ No newline at end of file +var _0x814b=['isAuthenticated','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','create','post','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','addTags','put','whatsappinteraction:update','update','delete','whatsappinteraction:destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get'];(function(_0x5af812,_0x43d252){var _0x1489f2=function(_0x1c7fa9){while(--_0x1c7fa9){_0x5af812['push'](_0x5af812['shift']());}};_0x1489f2(++_0x43d252);}(_0x814b,0x1a2));var _0xb814=function(_0x33154d,_0x854047){_0x33154d=_0x33154d-0x0;var _0x3b2f03=_0x814b[_0x33154d];return _0x3b2f03;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var timeout=require(_0xb814('0x3'));var express=require(_0xb814('0x4'));var router=express[_0xb814('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb814('0x6'));var interaction=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var controller=require(_0xb814('0x9'));router[_0xb814('0xa')]('/',auth[_0xb814('0xb')](),controller['index']);router[_0xb814('0xa')](_0xb814('0xc'),auth['isAuthenticated'](),controller[_0xb814('0xd')]);router[_0xb814('0xa')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0xf')]);router[_0xb814('0xa')](_0xb814('0x10'),auth[_0xb814('0xb')](),controller[_0xb814('0x11')]);router[_0xb814('0xa')](_0xb814('0x12'),auth['isAuthenticated'](),controller[_0xb814('0x13')]);router['post']('/',auth[_0xb814('0xb')](),controller[_0xb814('0x14')]);router[_0xb814('0x15')](_0xb814('0x10'),auth[_0xb814('0xb')](),controller[_0xb814('0x16')]);router[_0xb814('0x15')](_0xb814('0x17'),auth[_0xb814('0xb')](),interaction[_0xb814('0x18')](_0xb814('0x19'),_0xb814('0x1a')),controller[_0xb814('0x1b')]);router[_0xb814('0x1c')](_0xb814('0xe'),auth[_0xb814('0xb')](),interaction[_0xb814('0x18')](_0xb814('0x19'),_0xb814('0x1d')),controller[_0xb814('0x1e')]);router[_0xb814('0x1f')]('/:id',auth[_0xb814('0xb')](),interaction['tracked'](_0xb814('0x19'),_0xb814('0x20')),controller['destroy']);router['delete']('/:id/tags',auth[_0xb814('0xb')](),controller['removeTags']);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 2332851..751e4b9 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 _0x58cc=['ENUM','out','sequelize','moment','exports','BOOLEAN','DATE','STRING'];(function(_0x2c00af,_0x5d5c83){var _0x592a13=function(_0x580dea){while(--_0x580dea){_0x2c00af['push'](_0x2c00af['shift']());}};_0x592a13(++_0x5d5c83);}(_0x58cc,0x7a));var _0xc58c=function(_0x292f93,_0x2c6e8e){_0x292f93=_0x292f93-0x0;var _0x5a94b1=_0x58cc[_0x292f93];return _0x5a94b1;};'use strict';var Sequelize=require(_0xc58c('0x0'));var moment=require(_0xc58c('0x1'));module[_0xc58c('0x2')]={'closed':{'type':Sequelize[_0xc58c('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xc58c('0x4')]},'disposition':{'type':Sequelize[_0xc58c('0x5')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xc58c('0x5')]},'note':{'type':Sequelize[_0xc58c('0x5')]},'phone':{'type':Sequelize[_0xc58c('0x5')]},'read1stAt':{'type':Sequelize[_0xc58c('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xc58c('0x6')]('in',_0xc58c('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xc58c('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xc58c('0x3')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x2c16=['DATE','STRING','ENUM','out','BOOLEAN','INTEGER','sequelize','moment','exports'];(function(_0x55bed6,_0x5996a1){var _0x3dd98b=function(_0x3d23dc){while(--_0x3d23dc){_0x55bed6['push'](_0x55bed6['shift']());}};_0x3dd98b(++_0x5996a1);}(_0x2c16,0xf0));var _0x62c1=function(_0x56e9a1,_0x180afd){_0x56e9a1=_0x56e9a1-0x0;var _0xe4363f=_0x2c16[_0x56e9a1];return _0xe4363f;};'use strict';var Sequelize=require(_0x62c1('0x0'));var moment=require(_0x62c1('0x1'));module[_0x62c1('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x62c1('0x3')]},'disposition':{'type':Sequelize[_0x62c1('0x4')]},'secondDisposition':{'type':Sequelize[_0x62c1('0x4')]},'thirdDisposition':{'type':Sequelize[_0x62c1('0x4')]},'note':{'type':Sequelize[_0x62c1('0x4')]},'phone':{'type':Sequelize[_0x62c1('0x4')]},'read1stAt':{'type':Sequelize[_0x62c1('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x62c1('0x5')]('in',_0x62c1('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x62c1('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x62c1('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x62c1('0x7')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x62c1('0x8')]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index d9cdaa0..b632584 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 _0x6ddc=['whatsappInteractionTags:save','removeTags','download','unix','join','server','root','files','attachments','transcript-%d-%s.zip','push','User','fullname','Contact','firstName','Attachment','Messages','createdAt','direction','secret','read','WhatsappAccount','Account','Owner','get','Whatsapp','N.A.','YYYY-MM-DD\x20HH:mm:ss','toString','closed','closedAt','disposition','basename','existsSync','createReadStream','pipe','createWriteStream','out','System','lastName','renderFile','views','downloadInteraction.ejs','.pdf','createPdfFromHTML','err','unlinkSync','zip-dir','moment','bluebird','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','defaults','redis','socket.io-emitter','./whatsappInteraction.socket','register','status','json','offset','undefined','limit','count','set','Content-Range','update','then','end','sendStatus','stack','name','map','WhatsappInteraction','rawAttributes','fieldName','type','findAll','whatsapp','query','user','show','model','keys','intersection','attributes','fields','length','includeAll','include','options','find','create','catch','body','params','destroy','describe','WhatsappMessage','ids','omit','getMessages','findOne','filters','hasOwnProperty','nolimit','sort','where','pick','WhatsappInteractionId','filter','$gte','split','format','merge','rows','spread','Tag','color'];(function(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0x6ddc,0xac));var _0xc6dd=function(_0x40888d,_0x6aaf63){_0x40888d=_0x40888d-0x0;var _0x4d2996=_0x6ddc[_0x40888d];return _0x4d2996;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0xc6dd('0x0'));var moment=require(_0xc6dd('0x1'));var BPromise=require(_0xc6dd('0x2'));var util=require('util');var path=require('path');var ejs=require(_0xc6dd('0x3'));var fs=require('fs');var _=require(_0xc6dd('0x4'));var Redis=require(_0xc6dd('0x5'));var interaction=require(_0xc6dd('0x6'));var qs=require(_0xc6dd('0x7'));var pdf=require(_0xc6dd('0x8'));var logger=require(_0xc6dd('0x9'))(_0xc6dd('0xa'));var config=require(_0xc6dd('0xb'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xc6dd('0xc')](config[_0xc6dd('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0xc6dd('0xe'))(new Redis(config[_0xc6dd('0xd')]));require(_0xc6dd('0xf'))[_0xc6dd('0x10')](socket);function respondWithStatusCode(_0x4ec102,_0x4d9d59){_0x4d9d59=_0x4d9d59||0xcc;return function(_0x428e92){if(_0x428e92){return _0x4ec102['sendStatus'](_0x4d9d59);}return _0x4ec102[_0xc6dd('0x11')](_0x4d9d59)['end']();};}function respondWithResult(_0x10b001,_0x4e9947){_0x4e9947=_0x4e9947||0xc8;return function(_0x1b46d5){if(_0x1b46d5){return _0x10b001[_0xc6dd('0x11')](_0x4e9947)[_0xc6dd('0x12')](_0x1b46d5);}};}function respondWithFilteredResult(_0x2189d1,_0x2186c5){return function(_0x283e86){if(_0x283e86){var _0x38725e=typeof _0x2186c5[_0xc6dd('0x13')]===_0xc6dd('0x14')&&typeof _0x2186c5[_0xc6dd('0x15')]==='undefined';var _0x3ea4a9=_0x283e86[_0xc6dd('0x16')];var _0x3e299a=_0x38725e?0x0:_0x2186c5[_0xc6dd('0x13')];var _0x1a0248=_0x38725e?_0x283e86[_0xc6dd('0x16')]:_0x2186c5[_0xc6dd('0x13')]+_0x2186c5[_0xc6dd('0x15')];var _0x32afdd;if(_0x1a0248>=_0x3ea4a9){_0x1a0248=_0x3ea4a9;_0x32afdd=0xc8;}else{_0x32afdd=0xce;}_0x2189d1[_0xc6dd('0x11')](_0x32afdd);return _0x2189d1[_0xc6dd('0x17')](_0xc6dd('0x18'),_0x3e299a+'-'+_0x1a0248+'/'+_0x3ea4a9)[_0xc6dd('0x12')](_0x283e86);}return null;};}function saveUpdates(_0x511cce){return function(_0x30622d){if(_0x30622d){return _0x30622d[_0xc6dd('0x19')](_0x511cce)[_0xc6dd('0x1a')](function(_0x989c52){return _0x989c52;});}return null;};}function removeEntity(_0x300cb2){return function(_0x565fdc){if(_0x565fdc){return _0x565fdc['destroy']()['then'](function(){_0x300cb2['status'](0xcc)[_0xc6dd('0x1b')]();});}};}function handleEntityNotFound(_0x377d7){return function(_0x593aa0){if(!_0x593aa0){_0x377d7[_0xc6dd('0x1c')](0x194);}return _0x593aa0;};}function handleError(_0x125bd0,_0x17c4a5){_0x17c4a5=_0x17c4a5||0x1f4;return function(_0x373811){logger['error'](_0x373811[_0xc6dd('0x1d')]);if(_0x373811['name']){delete _0x373811[_0xc6dd('0x1e')];}_0x125bd0[_0xc6dd('0x11')](_0x17c4a5)['send'](_0x373811);};}exports['index']=function(_0x37d264,_0x10b8ad){var _0x4b4c33={};var _0x2ce6d2=_[_0xc6dd('0x1f')](db[_0xc6dd('0x20')][_0xc6dd('0x21')],function(_0x95bc7f){return{'name':_0x95bc7f[_0xc6dd('0x22')],'type':_0x95bc7f[_0xc6dd('0x23')]['key']};});_0x4b4c33=qs['getOptions'](_0x2ce6d2,_0x37d264);return interaction[_0xc6dd('0x24')](_0xc6dd('0x25'),_0x37d264[_0xc6dd('0x26')],_0x37d264[_0xc6dd('0x27')],_0x4b4c33,_0x2ce6d2)[_0xc6dd('0x1a')](respondWithFilteredResult(_0x10b8ad,_0x4b4c33))['catch'](handleError(_0x10b8ad,null));};exports[_0xc6dd('0x28')]=function(_0x4e04d1,_0x1fae52){var _0x1a155a={'raw':![],'where':{'id':_0x4e04d1['params']['id']}},_0x358383={};_0x358383[_0xc6dd('0x29')]=_[_0xc6dd('0x2a')](db['WhatsappInteraction'][_0xc6dd('0x21')]);_0x358383[_0xc6dd('0x26')]=_[_0xc6dd('0x2a')](_0x4e04d1[_0xc6dd('0x26')]);_0x358383['filters']=_[_0xc6dd('0x2b')](_0x358383[_0xc6dd('0x29')],_0x358383[_0xc6dd('0x26')]);_0x1a155a[_0xc6dd('0x2c')]=_[_0xc6dd('0x2b')](_0x358383[_0xc6dd('0x29')],qs[_0xc6dd('0x2d')](_0x4e04d1['query'][_0xc6dd('0x2d')]));_0x1a155a[_0xc6dd('0x2c')]=_0x1a155a[_0xc6dd('0x2c')][_0xc6dd('0x2e')]?_0x1a155a['attributes']:_0x358383[_0xc6dd('0x29')];if(_0x4e04d1[_0xc6dd('0x26')][_0xc6dd('0x2f')]){_0x1a155a[_0xc6dd('0x30')]=[{'all':!![]}];}_0x1a155a=_['merge']({},_0x1a155a,_0x4e04d1[_0xc6dd('0x31')]);return db['WhatsappInteraction'][_0xc6dd('0x32')](_0x1a155a)[_0xc6dd('0x1a')](handleEntityNotFound(_0x1fae52,null))['then'](respondWithResult(_0x1fae52,null))['catch'](handleError(_0x1fae52,null));};exports[_0xc6dd('0x33')]=function(_0x4b145c,_0x127412){return db[_0xc6dd('0x20')][_0xc6dd('0x33')](_0x4b145c['body'],{})[_0xc6dd('0x1a')](respondWithResult(_0x127412,0xc9))[_0xc6dd('0x34')](handleError(_0x127412,null));};exports[_0xc6dd('0x19')]=function(_0x47c83d,_0x121c68){if(_0x47c83d[_0xc6dd('0x35')]['id']){delete _0x47c83d[_0xc6dd('0x35')]['id'];}return db[_0xc6dd('0x20')][_0xc6dd('0x32')]({'where':{'id':_0x47c83d[_0xc6dd('0x36')]['id']}})['then'](handleEntityNotFound(_0x121c68,null))[_0xc6dd('0x1a')](saveUpdates(_0x47c83d[_0xc6dd('0x35')],null))[_0xc6dd('0x1a')](respondWithResult(_0x121c68,null))[_0xc6dd('0x34')](handleError(_0x121c68,null));};exports[_0xc6dd('0x37')]=function(_0x360173,_0x148cc0){return db[_0xc6dd('0x20')][_0xc6dd('0x32')]({'where':{'id':_0x360173[_0xc6dd('0x36')]['id']}})[_0xc6dd('0x1a')](handleEntityNotFound(_0x148cc0,null))['then'](removeEntity(_0x148cc0,null))[_0xc6dd('0x34')](handleError(_0x148cc0,null));};exports['describe']=function(_0x13c5b2,_0x1642f9){return db['WhatsappInteraction'][_0xc6dd('0x38')]()[_0xc6dd('0x1a')](respondWithResult(_0x1642f9,null))['catch'](handleError(_0x1642f9,null));};exports['addMessage']=function(_0x1d2fe4,_0x1f7cdb){return db[_0xc6dd('0x39')][_0xc6dd('0x32')]({'where':{'id':_0x1d2fe4[_0xc6dd('0x36')]['id']}})[_0xc6dd('0x1a')](handleEntityNotFound(_0x1f7cdb,null))[_0xc6dd('0x1a')](function(_0x21ea52){if(_0x21ea52){return _0x21ea52['addMessage'](_0x1d2fe4[_0xc6dd('0x35')][_0xc6dd('0x3a')],_[_0xc6dd('0x3b')](_0x1d2fe4[_0xc6dd('0x35')],['ids','id'])||{});}})[_0xc6dd('0x1a')](respondWithResult(_0x1f7cdb,null))[_0xc6dd('0x34')](handleError(_0x1f7cdb,null));};exports[_0xc6dd('0x3c')]=function(_0xc2432b,_0x5cea8e){var _0x148615={'raw':![],'where':{}};var _0xca8ec6={};var _0x203c0a={'count':0x0,'rows':[]};return db[_0xc6dd('0x20')][_0xc6dd('0x3d')]({'where':{'id':_0xc2432b[_0xc6dd('0x36')]['id']}})[_0xc6dd('0x1a')](handleEntityNotFound(_0x5cea8e,null))['then'](function(_0x54eb0a){if(_0x54eb0a){_0xca8ec6['model']=_[_0xc6dd('0x2a')](db['WhatsappMessage'][_0xc6dd('0x21')]);_0xca8ec6[_0xc6dd('0x26')]=_[_0xc6dd('0x2a')](_0xc2432b[_0xc6dd('0x26')]);_0xca8ec6[_0xc6dd('0x3e')]=_['intersection'](_0xca8ec6[_0xc6dd('0x29')],_0xca8ec6[_0xc6dd('0x26')]);_0x148615[_0xc6dd('0x2c')]=_[_0xc6dd('0x2b')](_0xca8ec6[_0xc6dd('0x29')],qs[_0xc6dd('0x2d')](_0xc2432b[_0xc6dd('0x26')][_0xc6dd('0x2d')]));_0x148615['attributes']=_0x148615['attributes'][_0xc6dd('0x2e')]?_0x148615['attributes']:_0xca8ec6['model'];if(!_0xc2432b['query'][_0xc6dd('0x3f')](_0xc6dd('0x40'))){_0x148615['limit']=qs[_0xc6dd('0x15')](_0xc2432b[_0xc6dd('0x26')]['limit']);_0x148615[_0xc6dd('0x13')]=qs['offset'](_0xc2432b[_0xc6dd('0x26')][_0xc6dd('0x13')]);}_0x148615['order']=qs[_0xc6dd('0x41')](_0xc2432b['query'][_0xc6dd('0x41')]);_0x148615[_0xc6dd('0x42')]=qs[_0xc6dd('0x3e')](_[_0xc6dd('0x43')](_0xc2432b[_0xc6dd('0x26')],_0xca8ec6[_0xc6dd('0x3e')]));_0x148615[_0xc6dd('0x42')][_0xc6dd('0x44')]=_0x54eb0a['id'];if(_0xc2432b[_0xc6dd('0x26')][_0xc6dd('0x45')]){_0x148615['where']=_['merge'](_0x148615['where'],{'$or':_[_0xc6dd('0x1f')](_0x148615[_0xc6dd('0x2c')],function(_0x287e2c){var _0x1d518b={};_0x1d518b[_0x287e2c]={'$like':'%'+_0xc2432b[_0xc6dd('0x26')]['filter']+'%'};return _0x1d518b;})});}if(_0xc2432b[_0xc6dd('0x26')][_0xc6dd('0x46')]){var _0xcb2ec=_0xc2432b['query'][_0xc6dd('0x46')][_0xc6dd('0x47')](',');var _0xc0b3d9={};_0xc0b3d9[_0xcb2ec[0x0]]={'$gte':moment(_0xcb2ec[0x1])[_0xc6dd('0x48')]('YYYY-MM-DD\x20HH:mm:ss')};_0x148615[_0xc6dd('0x42')]=_[_0xc6dd('0x49')](_0x148615[_0xc6dd('0x42')],_0xc0b3d9);}_0x148615=_[_0xc6dd('0x49')]({},_0x148615,_0xc2432b[_0xc6dd('0x31')]);return db[_0xc6dd('0x39')]['count']({'where':_0x148615[_0xc6dd('0x42')]})[_0xc6dd('0x1a')](function(_0x32f6bd){_0x203c0a[_0xc6dd('0x16')]=_0x32f6bd;if(_0xc2432b[_0xc6dd('0x26')][_0xc6dd('0x2f')]){_0x148615[_0xc6dd('0x30')]=[{'all':!![]}];}return db[_0xc6dd('0x39')][_0xc6dd('0x24')](_0x148615);})[_0xc6dd('0x1a')](function(_0x5aba19){_0x203c0a[_0xc6dd('0x4a')]=_0x5aba19;return _0x203c0a;});}})[_0xc6dd('0x1a')](respondWithFilteredResult(_0x5cea8e,_0x148615))[_0xc6dd('0x34')](handleError(_0x5cea8e,null));};exports['addTags']=function(_0x1ae539,_0x218f7a){return db['WhatsappInteraction']['find']({'where':{'id':_0x1ae539[_0xc6dd('0x36')]['id']}})[_0xc6dd('0x1a')](handleEntityNotFound(_0x218f7a,null))['then'](function(_0x21293a){if(_0x21293a){return _0x21293a['setTags'](_0x1ae539['body'][_0xc6dd('0x3a')],_[_0xc6dd('0x3b')](_0x1ae539['body'],['ids','id'])||{})[_0xc6dd('0x4b')](function(){return db[_0xc6dd('0x4c')][_0xc6dd('0x24')]({'attributes':['id',_0xc6dd('0x1e'),_0xc6dd('0x4d')],'where':{'id':_0x1ae539[_0xc6dd('0x35')]['ids']}});})[_0xc6dd('0x1a')](function(_0x33fda6){socket['emit'](_0xc6dd('0x4e'),{'id':Number(_0x1ae539['params']['id']),'tags':_0x33fda6||[]});return{'id':Number(_0x1ae539[_0xc6dd('0x36')]['id']),'tags':_0x33fda6||[]};});}})[_0xc6dd('0x1a')](respondWithResult(_0x218f7a,null))[_0xc6dd('0x34')](handleError(_0x218f7a,null));};exports['removeTags']=function(_0x726a2c,_0x2ff191){return db['WhatsappInteraction'][_0xc6dd('0x32')]({'where':{'id':_0x726a2c[_0xc6dd('0x36')]['id']}})[_0xc6dd('0x1a')](handleEntityNotFound(_0x2ff191,null))[_0xc6dd('0x1a')](function(_0x25fad4){if(_0x25fad4){return _0x25fad4[_0xc6dd('0x4f')](_0x726a2c[_0xc6dd('0x26')]['ids']);}})[_0xc6dd('0x1a')](respondWithStatusCode(_0x2ff191,null))[_0xc6dd('0x34')](handleError(_0x2ff191,null));};exports[_0xc6dd('0x50')]=function(_0x5bba96,_0x11d001){var _0xd9a19=moment()[_0xc6dd('0x51')]()['toString']();var _0xb11d78=path[_0xc6dd('0x52')](config['root'],_0xc6dd('0x53'),'files','tmp');var _0x287dd5=path[_0xc6dd('0x52')](config[_0xc6dd('0x54')],_0xc6dd('0x53'),_0xc6dd('0x55'),_0xc6dd('0x56'));var _0x4f29ca=path[_0xc6dd('0x52')](_0xb11d78,_0xd9a19);var _0x18c7db=util[_0xc6dd('0x48')](_0xc6dd('0x57'),_0x5bba96['params']['id'],_0xd9a19);var _0x26bbba=path['join'](_0xb11d78,_0x18c7db);var _0x2977f0=[];_0x2977f0[_0xc6dd('0x58')]({'model':db[_0xc6dd('0x59')],'as':_0xc6dd('0x59'),'attributes':['id',_0xc6dd('0x5a')],'raw':!![]});_0x2977f0[_0xc6dd('0x58')]({'model':db['CmContact'],'as':_0xc6dd('0x5b'),'attributes':['id',_0xc6dd('0x5c'),'lastName'],'raw':!![]});if(_0x5bba96['query']['attachments']){_0x2977f0[_0xc6dd('0x58')]({'model':db[_0xc6dd('0x5d')],'as':_0xc6dd('0x5d'),'raw':!![]});}var _0x123a69=[{'model':db[_0xc6dd('0x39')],'as':_0xc6dd('0x5e'),'attributes':['id',_0xc6dd('0x35'),_0xc6dd('0x5f'),_0xc6dd('0x60'),_0xc6dd('0x61'),_0xc6dd('0x62')],'include':_0x2977f0}];_0x123a69[_0xc6dd('0x58')]({'model':db[_0xc6dd('0x63')],'as':_0xc6dd('0x64'),'attributes':['id',_0xc6dd('0x1e')]});_0x123a69[_0xc6dd('0x58')]({'model':db['User'],'as':_0xc6dd('0x65'),'attributes':['id',_0xc6dd('0x5a')]});return db['WhatsappInteraction']['find']({'where':{'id':_0x5bba96[_0xc6dd('0x36')]['id']},'include':_0x123a69})['then'](handleEntityNotFound(_0x11d001,null))[_0xc6dd('0x1a')](function(_0x80af4){if(_0x80af4){var _0xeb7b6c=_0x80af4[_0xc6dd('0x66')]({'plain':!![]});fs['mkdirSync'](_0x4f29ca);var _0x331d49={'channel':_0xc6dd('0x67'),'account':_0xeb7b6c['Account'][_0xc6dd('0x1e')],'agent':_0xeb7b6c['Owner']?_0xeb7b6c[_0xc6dd('0x65')][_0xc6dd('0x5a')]:_0xc6dd('0x68'),'createdAt':moment(_0xeb7b6c[_0xc6dd('0x5f')])[_0xc6dd('0x48')](_0xc6dd('0x69'))[_0xc6dd('0x6a')](),'closedAt':_0xeb7b6c[_0xc6dd('0x6b')]?moment(_0xeb7b6c[_0xc6dd('0x6c')])['format'](_0xc6dd('0x69'))[_0xc6dd('0x6a')]():'','disposition':_0xeb7b6c[_0xc6dd('0x6d')],'messages':_(_0xeb7b6c[_0xc6dd('0x5e')])[_0xc6dd('0x45')]({'secret':![]})[_0xc6dd('0x1f')](function(_0x21ae89){if(_0x21ae89[_0xc6dd('0x5d')]){var _0x140c88=path['join'](_0x287dd5,_0x21ae89[_0xc6dd('0x5d')][_0xc6dd('0x6e')]);if(fs[_0xc6dd('0x6f')](_0x140c88)){fs[_0xc6dd('0x70')](_0x140c88)[_0xc6dd('0x71')](fs[_0xc6dd('0x72')](path[_0xc6dd('0x52')](_0x4f29ca,_0x21ae89['Attachment'][_0xc6dd('0x6e')])));}}return{'date':moment(_0x21ae89[_0xc6dd('0x5f')])[_0xc6dd('0x48')](_0xc6dd('0x69'))[_0xc6dd('0x6a')](),'sender':_0x21ae89['direction']===_0xc6dd('0x73')?_0x21ae89[_0xc6dd('0x59')]?_0x21ae89['User'][_0xc6dd('0x5a')]:_0xc6dd('0x74'):_0x21ae89[_0xc6dd('0x5b')][_0xc6dd('0x5c')]+(_0x21ae89[_0xc6dd('0x5b')][_0xc6dd('0x75')]?'\x20'+_0x21ae89[_0xc6dd('0x5b')][_0xc6dd('0x75')]:''),'body':_0x21ae89[_0xc6dd('0x5d')]?_0x21ae89['Attachment'][_0xc6dd('0x6e')]:_0x21ae89[_0xc6dd('0x35')],'direction':_0x21ae89['direction']==='out'?'A':'C','secret':_0x21ae89['secret'],'read':_0x21ae89['read'],'attachment':_0x21ae89[_0xc6dd('0x5d')]};})['value']()};return ejs[_0xc6dd('0x76')](path[_0xc6dd('0x52')](config[_0xc6dd('0x54')],_0xc6dd('0x53'),_0xc6dd('0x77'),_0xc6dd('0x78')),{'interaction':_0x331d49})[_0xc6dd('0x1a')](function(_0x2ba0c0){var _0x4040ae=path['join'](_0x4f29ca,'transcript-'+_0xeb7b6c['id']+'-'+_0xd9a19+_0xc6dd('0x79'));var _0x580924={'path':_0x4040ae,'channel':_0xc6dd('0x67'),'interactionId':_0xeb7b6c['id']};return pdf[_0xc6dd('0x7a')](_0x2ba0c0,_0x580924);})[_0xc6dd('0x1a')](function(){return new BPromise(function(_0x366640,_0x37bf58){zipdir(_0x4f29ca,{'saveTo':_0x26bbba},function(_0x5cf161,_0x258f14){if(_0x5cf161)return _0x37bf58(_0x5cf161);return _0x366640(_0x258f14);});})[_0xc6dd('0x1a')](function(){return new BPromise(function(_0x549608,_0x2bb409){rimraf(_0x4f29ca,function(_0x54065f){if(_0x54065f)_0x2bb409(_0x54065f);return _0x549608();});});})['then'](function(){return _0x11d001[_0xc6dd('0x50')](_0x26bbba,_0x18c7db,function(_0x73d3a8){if(_0x73d3a8){console['log'](_0xc6dd('0x7b'),_0x73d3a8);}else{fs[_0xc6dd('0x7c')](_0x26bbba);}});});});}else{return _0x11d001[_0xc6dd('0x1c')](0xc8);}})[_0xc6dd('0x34')](handleError(_0x11d001,null));}; \ No newline at end of file +var _0xa23b=['emit','whatsappInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','tmp','transcript-%d-%s.zip','push','User','CmContact','Contact','firstName','lastName','attachments','Attachment','Messages','createdAt','direction','secret','read','WhatsappAccount','Owner','fullname','mkdirSync','Account','N.A.','closed','closedAt','disposition','basename','existsSync','createReadStream','pipe','createWriteStream','out','System','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','Whatsapp','createPdfFromHTML','log','err','rimraf','zip-dir','moment','util','path','ejs','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','redis','socket.io-emitter','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','update','then','destroy','name','send','index','map','rawAttributes','fieldName','type','getOptions','findAll','whatsapp','query','user','catch','params','keys','filters','intersection','model','fields','attributes','length','includeAll','include','merge','options','find','create','body','WhatsappInteraction','describe','addMessage','ids','omit','getMessages','findOne','WhatsappMessage','hasOwnProperty','sort','where','pick','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','setTags','Tag'];(function(_0x60286b,_0x3247c1){var _0x5dff69=function(_0x4ecfcf){while(--_0x4ecfcf){_0x60286b['push'](_0x60286b['shift']());}};_0x5dff69(++_0x3247c1);}(_0xa23b,0x12f));var _0xba23=function(_0x423af3,_0x1b765b){_0x423af3=_0x423af3-0x0;var _0x302fec=_0xa23b[_0x423af3];return _0x302fec;};'use strict';var rimraf=require(_0xba23('0x0'));var zipdir=require(_0xba23('0x1'));var moment=require(_0xba23('0x2'));var BPromise=require('bluebird');var util=require(_0xba23('0x3'));var path=require(_0xba23('0x4'));var ejs=require(_0xba23('0x5'));var fs=require('fs');var _=require('lodash');var Redis=require('ioredis');var interaction=require(_0xba23('0x6'));var qs=require(_0xba23('0x7'));var pdf=require(_0xba23('0x8'));var logger=require(_0xba23('0x9'))(_0xba23('0xa'));var config=require(_0xba23('0xb'));var db=require('../../mysqldb')['db'];config[_0xba23('0xc')]=_['defaults'](config[_0xba23('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xba23('0xd'))(new Redis(config[_0xba23('0xc')]));require('./whatsappInteraction.socket')['register'](socket);function respondWithStatusCode(_0x5d34f1,_0xa30a6b){_0xa30a6b=_0xa30a6b||0xcc;return function(_0x5efafa){if(_0x5efafa){return _0x5d34f1[_0xba23('0xe')](_0xa30a6b);}return _0x5d34f1[_0xba23('0xf')](_0xa30a6b)[_0xba23('0x10')]();};}function respondWithResult(_0x2b659d,_0x2f7754){_0x2f7754=_0x2f7754||0xc8;return function(_0x2c80b0){if(_0x2c80b0){return _0x2b659d['status'](_0x2f7754)['json'](_0x2c80b0);}};}function respondWithFilteredResult(_0x8f3cf4,_0x390d84){return function(_0x2e4818){if(_0x2e4818){var _0x2f7d98=typeof _0x390d84['offset']===_0xba23('0x11')&&typeof _0x390d84[_0xba23('0x12')]===_0xba23('0x11');var _0x4847db=_0x2e4818[_0xba23('0x13')];var _0x5301b8=_0x2f7d98?0x0:_0x390d84[_0xba23('0x14')];var _0x58ebe1=_0x2f7d98?_0x2e4818[_0xba23('0x13')]:_0x390d84['offset']+_0x390d84[_0xba23('0x12')];var _0xcc4e02;if(_0x58ebe1>=_0x4847db){_0x58ebe1=_0x4847db;_0xcc4e02=0xc8;}else{_0xcc4e02=0xce;}_0x8f3cf4['status'](_0xcc4e02);return _0x8f3cf4[_0xba23('0x15')](_0xba23('0x16'),_0x5301b8+'-'+_0x58ebe1+'/'+_0x4847db)[_0xba23('0x17')](_0x2e4818);}return null;};}function saveUpdates(_0x21d450){return function(_0x196055){if(_0x196055){return _0x196055[_0xba23('0x18')](_0x21d450)[_0xba23('0x19')](function(_0x1c6889){return _0x1c6889;});}return null;};}function removeEntity(_0x3f4d7a){return function(_0x58d36a){if(_0x58d36a){return _0x58d36a[_0xba23('0x1a')]()[_0xba23('0x19')](function(){_0x3f4d7a[_0xba23('0xf')](0xcc)['end']();});}};}function handleEntityNotFound(_0x307171){return function(_0x541076){if(!_0x541076){_0x307171[_0xba23('0xe')](0x194);}return _0x541076;};}function handleError(_0x3c94dd,_0x2268aa){_0x2268aa=_0x2268aa||0x1f4;return function(_0x4082e9){logger['error'](_0x4082e9['stack']);if(_0x4082e9[_0xba23('0x1b')]){delete _0x4082e9[_0xba23('0x1b')];}_0x3c94dd[_0xba23('0xf')](_0x2268aa)[_0xba23('0x1c')](_0x4082e9);};}exports[_0xba23('0x1d')]=function(_0xcb2728,_0x39caf3){var _0x7e7e7e={};var _0x26840a=_[_0xba23('0x1e')](db['WhatsappInteraction'][_0xba23('0x1f')],function(_0x87bfe7){return{'name':_0x87bfe7[_0xba23('0x20')],'type':_0x87bfe7[_0xba23('0x21')]['key']};});_0x7e7e7e=qs[_0xba23('0x22')](_0x26840a,_0xcb2728);return interaction[_0xba23('0x23')](_0xba23('0x24'),_0xcb2728[_0xba23('0x25')],_0xcb2728[_0xba23('0x26')],_0x7e7e7e,_0x26840a)[_0xba23('0x19')](respondWithFilteredResult(_0x39caf3,_0x7e7e7e))[_0xba23('0x27')](handleError(_0x39caf3,null));};exports['show']=function(_0x1840a8,_0x1b03a3){var _0x2598de={'raw':![],'where':{'id':_0x1840a8[_0xba23('0x28')]['id']}},_0x2fbe21={};_0x2fbe21['model']=_[_0xba23('0x29')](db['WhatsappInteraction']['rawAttributes']);_0x2fbe21[_0xba23('0x25')]=_[_0xba23('0x29')](_0x1840a8[_0xba23('0x25')]);_0x2fbe21[_0xba23('0x2a')]=_[_0xba23('0x2b')](_0x2fbe21[_0xba23('0x2c')],_0x2fbe21[_0xba23('0x25')]);_0x2598de['attributes']=_[_0xba23('0x2b')](_0x2fbe21[_0xba23('0x2c')],qs[_0xba23('0x2d')](_0x1840a8[_0xba23('0x25')][_0xba23('0x2d')]));_0x2598de[_0xba23('0x2e')]=_0x2598de['attributes'][_0xba23('0x2f')]?_0x2598de['attributes']:_0x2fbe21[_0xba23('0x2c')];if(_0x1840a8[_0xba23('0x25')][_0xba23('0x30')]){_0x2598de[_0xba23('0x31')]=[{'all':!![]}];}_0x2598de=_[_0xba23('0x32')]({},_0x2598de,_0x1840a8[_0xba23('0x33')]);return db['WhatsappInteraction'][_0xba23('0x34')](_0x2598de)[_0xba23('0x19')](handleEntityNotFound(_0x1b03a3,null))[_0xba23('0x19')](respondWithResult(_0x1b03a3,null))[_0xba23('0x27')](handleError(_0x1b03a3,null));};exports[_0xba23('0x35')]=function(_0x1109a8,_0xcce577){return db['WhatsappInteraction']['create'](_0x1109a8[_0xba23('0x36')],{})['then'](respondWithResult(_0xcce577,0xc9))[_0xba23('0x27')](handleError(_0xcce577,null));};exports[_0xba23('0x18')]=function(_0x2e79b3,_0x270424){if(_0x2e79b3[_0xba23('0x36')]['id']){delete _0x2e79b3['body']['id'];}return db['WhatsappInteraction'][_0xba23('0x34')]({'where':{'id':_0x2e79b3['params']['id']}})[_0xba23('0x19')](handleEntityNotFound(_0x270424,null))[_0xba23('0x19')](saveUpdates(_0x2e79b3['body'],null))[_0xba23('0x19')](respondWithResult(_0x270424,null))[_0xba23('0x27')](handleError(_0x270424,null));};exports[_0xba23('0x1a')]=function(_0x1e5688,_0x3d99b1){return db[_0xba23('0x37')][_0xba23('0x34')]({'where':{'id':_0x1e5688[_0xba23('0x28')]['id']}})[_0xba23('0x19')](handleEntityNotFound(_0x3d99b1,null))[_0xba23('0x19')](removeEntity(_0x3d99b1,null))[_0xba23('0x27')](handleError(_0x3d99b1,null));};exports['describe']=function(_0x810eb4,_0x444b90){return db[_0xba23('0x37')][_0xba23('0x38')]()[_0xba23('0x19')](respondWithResult(_0x444b90,null))[_0xba23('0x27')](handleError(_0x444b90,null));};exports[_0xba23('0x39')]=function(_0x47074c,_0x4844fe){return db['WhatsappMessage']['find']({'where':{'id':_0x47074c[_0xba23('0x28')]['id']}})[_0xba23('0x19')](handleEntityNotFound(_0x4844fe,null))['then'](function(_0x5b606c){if(_0x5b606c){return _0x5b606c['addMessage'](_0x47074c[_0xba23('0x36')][_0xba23('0x3a')],_[_0xba23('0x3b')](_0x47074c[_0xba23('0x36')],[_0xba23('0x3a'),'id'])||{});}})[_0xba23('0x19')](respondWithResult(_0x4844fe,null))[_0xba23('0x27')](handleError(_0x4844fe,null));};exports[_0xba23('0x3c')]=function(_0xd6a748,_0x45ed23){var _0x2aae84={'raw':![],'where':{}};var _0x534742={};var _0xe0dbb0={'count':0x0,'rows':[]};return db[_0xba23('0x37')][_0xba23('0x3d')]({'where':{'id':_0xd6a748['params']['id']}})[_0xba23('0x19')](handleEntityNotFound(_0x45ed23,null))[_0xba23('0x19')](function(_0x34d599){if(_0x34d599){_0x534742[_0xba23('0x2c')]=_[_0xba23('0x29')](db[_0xba23('0x3e')]['rawAttributes']);_0x534742[_0xba23('0x25')]=_[_0xba23('0x29')](_0xd6a748['query']);_0x534742['filters']=_[_0xba23('0x2b')](_0x534742[_0xba23('0x2c')],_0x534742[_0xba23('0x25')]);_0x2aae84[_0xba23('0x2e')]=_['intersection'](_0x534742[_0xba23('0x2c')],qs[_0xba23('0x2d')](_0xd6a748['query']['fields']));_0x2aae84[_0xba23('0x2e')]=_0x2aae84[_0xba23('0x2e')]['length']?_0x2aae84[_0xba23('0x2e')]:_0x534742[_0xba23('0x2c')];if(!_0xd6a748[_0xba23('0x25')][_0xba23('0x3f')]('nolimit')){_0x2aae84[_0xba23('0x12')]=qs[_0xba23('0x12')](_0xd6a748[_0xba23('0x25')][_0xba23('0x12')]);_0x2aae84[_0xba23('0x14')]=qs['offset'](_0xd6a748['query'][_0xba23('0x14')]);}_0x2aae84['order']=qs[_0xba23('0x40')](_0xd6a748[_0xba23('0x25')][_0xba23('0x40')]);_0x2aae84[_0xba23('0x41')]=qs[_0xba23('0x2a')](_[_0xba23('0x42')](_0xd6a748[_0xba23('0x25')],_0x534742[_0xba23('0x2a')]));_0x2aae84[_0xba23('0x41')]['WhatsappInteractionId']=_0x34d599['id'];if(_0xd6a748[_0xba23('0x25')][_0xba23('0x43')]){_0x2aae84[_0xba23('0x41')]=_['merge'](_0x2aae84[_0xba23('0x41')],{'$or':_[_0xba23('0x1e')](_0x2aae84['attributes'],function(_0x142ccb){var _0x172604={};_0x172604[_0x142ccb]={'$like':'%'+_0xd6a748[_0xba23('0x25')][_0xba23('0x43')]+'%'};return _0x172604;})});}if(_0xd6a748[_0xba23('0x25')][_0xba23('0x44')]){var _0x66e0fb=_0xd6a748['query']['$gte'][_0xba23('0x45')](',');var _0x19e7b2={};_0x19e7b2[_0x66e0fb[0x0]]={'$gte':moment(_0x66e0fb[0x1])[_0xba23('0x46')](_0xba23('0x47'))};_0x2aae84[_0xba23('0x41')]=_[_0xba23('0x32')](_0x2aae84[_0xba23('0x41')],_0x19e7b2);}_0x2aae84=_[_0xba23('0x32')]({},_0x2aae84,_0xd6a748[_0xba23('0x33')]);return db['WhatsappMessage'][_0xba23('0x13')]({'where':_0x2aae84[_0xba23('0x41')]})[_0xba23('0x19')](function(_0x26223f){_0xe0dbb0[_0xba23('0x13')]=_0x26223f;if(_0xd6a748[_0xba23('0x25')][_0xba23('0x30')]){_0x2aae84[_0xba23('0x31')]=[{'all':!![]}];}return db[_0xba23('0x3e')][_0xba23('0x23')](_0x2aae84);})[_0xba23('0x19')](function(_0x1d45bc){_0xe0dbb0[_0xba23('0x48')]=_0x1d45bc;return _0xe0dbb0;});}})[_0xba23('0x19')](respondWithFilteredResult(_0x45ed23,_0x2aae84))[_0xba23('0x27')](handleError(_0x45ed23,null));};exports['addTags']=function(_0x2a3d3c,_0x4aea4a){return db['WhatsappInteraction'][_0xba23('0x34')]({'where':{'id':_0x2a3d3c['params']['id']}})[_0xba23('0x19')](handleEntityNotFound(_0x4aea4a,null))[_0xba23('0x19')](function(_0x23614f){if(_0x23614f){return _0x23614f[_0xba23('0x49')](_0x2a3d3c[_0xba23('0x36')][_0xba23('0x3a')],_[_0xba23('0x3b')](_0x2a3d3c[_0xba23('0x36')],['ids','id'])||{})['spread'](function(){return db[_0xba23('0x4a')][_0xba23('0x23')]({'attributes':['id',_0xba23('0x1b'),'color'],'where':{'id':_0x2a3d3c[_0xba23('0x36')][_0xba23('0x3a')]}});})[_0xba23('0x19')](function(_0x5d0612){socket[_0xba23('0x4b')](_0xba23('0x4c'),{'id':Number(_0x2a3d3c[_0xba23('0x28')]['id']),'tags':_0x5d0612||[]});return{'id':Number(_0x2a3d3c[_0xba23('0x28')]['id']),'tags':_0x5d0612||[]};});}})[_0xba23('0x19')](respondWithResult(_0x4aea4a,null))[_0xba23('0x27')](handleError(_0x4aea4a,null));};exports[_0xba23('0x4d')]=function(_0x39f72c,_0x52582e){return db[_0xba23('0x37')][_0xba23('0x34')]({'where':{'id':_0x39f72c[_0xba23('0x28')]['id']}})[_0xba23('0x19')](handleEntityNotFound(_0x52582e,null))[_0xba23('0x19')](function(_0x27b3cb){if(_0x27b3cb){return _0x27b3cb['removeTags'](_0x39f72c[_0xba23('0x25')][_0xba23('0x3a')]);}})[_0xba23('0x19')](respondWithStatusCode(_0x52582e,null))[_0xba23('0x27')](handleError(_0x52582e,null));};exports[_0xba23('0x4e')]=function(_0x55d1fb,_0x4e8dd0){var _0x51940d=moment()[_0xba23('0x4f')]()[_0xba23('0x50')]();var _0x54db6a=path[_0xba23('0x51')](config[_0xba23('0x52')],_0xba23('0x53'),_0xba23('0x54'),_0xba23('0x55'));var _0x3b6b4c=path[_0xba23('0x51')](config[_0xba23('0x52')],_0xba23('0x53'),_0xba23('0x54'),'attachments');var _0x455ac2=path[_0xba23('0x51')](_0x54db6a,_0x51940d);var _0x374d63=util[_0xba23('0x46')](_0xba23('0x56'),_0x55d1fb[_0xba23('0x28')]['id'],_0x51940d);var _0x4a60f3=path['join'](_0x54db6a,_0x374d63);var _0x37756b=[];_0x37756b[_0xba23('0x57')]({'model':db['User'],'as':_0xba23('0x58'),'attributes':['id','fullname'],'raw':!![]});_0x37756b['push']({'model':db[_0xba23('0x59')],'as':_0xba23('0x5a'),'attributes':['id',_0xba23('0x5b'),_0xba23('0x5c')],'raw':!![]});if(_0x55d1fb['query'][_0xba23('0x5d')]){_0x37756b['push']({'model':db['Attachment'],'as':_0xba23('0x5e'),'raw':!![]});}var _0x58b416=[{'model':db[_0xba23('0x3e')],'as':_0xba23('0x5f'),'attributes':['id',_0xba23('0x36'),_0xba23('0x60'),_0xba23('0x61'),_0xba23('0x62'),_0xba23('0x63')],'include':_0x37756b}];_0x58b416[_0xba23('0x57')]({'model':db[_0xba23('0x64')],'as':'Account','attributes':['id',_0xba23('0x1b')]});_0x58b416['push']({'model':db[_0xba23('0x58')],'as':_0xba23('0x65'),'attributes':['id',_0xba23('0x66')]});return db[_0xba23('0x37')][_0xba23('0x34')]({'where':{'id':_0x55d1fb[_0xba23('0x28')]['id']},'include':_0x58b416})[_0xba23('0x19')](handleEntityNotFound(_0x4e8dd0,null))['then'](function(_0x2bea1f){if(_0x2bea1f){var _0x1fc880=_0x2bea1f['get']({'plain':!![]});fs[_0xba23('0x67')](_0x455ac2);var _0x23a071={'channel':'Whatsapp','account':_0x1fc880[_0xba23('0x68')][_0xba23('0x1b')],'agent':_0x1fc880[_0xba23('0x65')]?_0x1fc880['Owner']['fullname']:_0xba23('0x69'),'createdAt':moment(_0x1fc880['createdAt'])[_0xba23('0x46')](_0xba23('0x47'))['toString'](),'closedAt':_0x1fc880[_0xba23('0x6a')]?moment(_0x1fc880[_0xba23('0x6b')])['format'](_0xba23('0x47'))[_0xba23('0x50')]():'','disposition':_0x1fc880[_0xba23('0x6c')],'messages':_(_0x1fc880[_0xba23('0x5f')])[_0xba23('0x43')]({'secret':![]})[_0xba23('0x1e')](function(_0x54c18e){if(_0x54c18e[_0xba23('0x5e')]){var _0x4ba7b1=path[_0xba23('0x51')](_0x3b6b4c,_0x54c18e[_0xba23('0x5e')][_0xba23('0x6d')]);if(fs[_0xba23('0x6e')](_0x4ba7b1)){fs[_0xba23('0x6f')](_0x4ba7b1)[_0xba23('0x70')](fs[_0xba23('0x71')](path[_0xba23('0x51')](_0x455ac2,_0x54c18e['Attachment'][_0xba23('0x6d')])));}}return{'date':moment(_0x54c18e[_0xba23('0x60')])['format'](_0xba23('0x47'))['toString'](),'sender':_0x54c18e[_0xba23('0x61')]===_0xba23('0x72')?_0x54c18e[_0xba23('0x58')]?_0x54c18e['User'][_0xba23('0x66')]:_0xba23('0x73'):_0x54c18e[_0xba23('0x5a')][_0xba23('0x5b')]+(_0x54c18e[_0xba23('0x5a')][_0xba23('0x5c')]?'\x20'+_0x54c18e[_0xba23('0x5a')][_0xba23('0x5c')]:''),'body':_0x54c18e['Attachment']?_0x54c18e[_0xba23('0x5e')][_0xba23('0x6d')]:_0x54c18e[_0xba23('0x36')],'direction':_0x54c18e[_0xba23('0x61')]===_0xba23('0x72')?'A':'C','secret':_0x54c18e[_0xba23('0x62')],'read':_0x54c18e[_0xba23('0x63')],'attachment':_0x54c18e['Attachment']};})[_0xba23('0x74')]()};return ejs[_0xba23('0x75')](path[_0xba23('0x51')](config[_0xba23('0x52')],_0xba23('0x53'),_0xba23('0x76'),_0xba23('0x77')),{'interaction':_0x23a071})[_0xba23('0x19')](function(_0x6777bd){var _0x313fdd=path[_0xba23('0x51')](_0x455ac2,_0xba23('0x78')+_0x1fc880['id']+'-'+_0x51940d+_0xba23('0x79'));var _0x20d45a={'path':_0x313fdd,'channel':_0xba23('0x7a'),'interactionId':_0x1fc880['id']};return pdf[_0xba23('0x7b')](_0x6777bd,_0x20d45a);})[_0xba23('0x19')](function(){return new BPromise(function(_0x2c211c,_0x12ab44){zipdir(_0x455ac2,{'saveTo':_0x4a60f3},function(_0x154d8e,_0x3708f8){if(_0x154d8e)return _0x12ab44(_0x154d8e);return _0x2c211c(_0x3708f8);});})[_0xba23('0x19')](function(){return new BPromise(function(_0x351e66,_0xc6e95d){rimraf(_0x455ac2,function(_0x4b9a72){if(_0x4b9a72)_0xc6e95d(_0x4b9a72);return _0x351e66();});});})[_0xba23('0x19')](function(){return _0x4e8dd0[_0xba23('0x4e')](_0x4a60f3,_0x374d63,function(_0x36f5c7){if(_0x36f5c7){console[_0xba23('0x7c')](_0xba23('0x7d'),_0x36f5c7);}else{fs['unlinkSync'](_0x4a60f3);}});});});}else{return _0x4e8dd0[_0xba23('0xe')](0xc8);}})[_0xba23('0x27')](handleError(_0x4e8dd0,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 3fde1d0..3669c93 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 _0xb58b=['exports','../../mysqldb','WhatsappInteraction','setMaxListeners','save','remove','then','setDataValue','Users','map','findAll','unreadMessages','emit','catch','hasOwnProperty','hook'];(function(_0x523252,_0x2c5792){var _0x54c642=function(_0x4fd131){while(--_0x4fd131){_0x523252['push'](_0x523252['shift']());}};_0x54c642(++_0x2c5792);}(_0xb58b,0x1f1));var _0xbb58=function(_0x29507e,_0x5cbf20){_0x29507e=_0x29507e-0x0;var _0x1ec3eb=_0xb58b[_0x29507e];return _0x1ec3eb;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require(_0xbb58('0x0'))['db'][_0xbb58('0x1')];var WhatsappMessage=require(_0xbb58('0x0'))['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xbb58('0x2')](0x0);var events={'afterCreate':_0xbb58('0x3'),'afterUpdate':'update','afterDestroy':_0xbb58('0x4')};function emitEvent(_0x546510){return function(_0x2edb10,_0x367b4f,_0x33fe85){_0x2edb10['getUsers']({'attributes':['id'],'raw':!![]})[_0xbb58('0x5')](function(_0x323066){_0x2edb10[_0xbb58('0x6')](_0xbb58('0x7'),_0x323066[_0xbb58('0x8')](function(_0x3e3144){return{'id':_0x3e3144['id']};}));return WhatsappMessage[_0xbb58('0x9')]({'where':{'WhatsappInteractionId':_0x2edb10['id'],'direction':'in','read':![]},'raw':!![]});})[_0xbb58('0x5')](function(_0x429e75){_0x2edb10[_0xbb58('0x6')](_0xbb58('0xa'),_0x429e75['length']);WhatsappInteractionEvents[_0xbb58('0xb')](_0x546510+':'+_0x2edb10['id'],_0x2edb10);WhatsappInteractionEvents['emit'](_0x546510,_0x2edb10);_0x33fe85(null);})[_0xbb58('0xc')](_0x33fe85(null));};}for(var e in events){if(events[_0xbb58('0xd')](e)){var event=events[e];WhatsappInteraction[_0xbb58('0xe')](e,emitEvent(event));}}module[_0xbb58('0xf')]=WhatsappInteractionEvents; \ No newline at end of file +var _0x61a5=['events','WhatsappInteraction','../../mysqldb','setMaxListeners','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','hasOwnProperty','hook','exports'];(function(_0x104530,_0x1a94c3){var _0x32821f=function(_0x61d9d0){while(--_0x61d9d0){_0x104530['push'](_0x104530['shift']());}};_0x32821f(++_0x1a94c3);}(_0x61a5,0x19e));var _0x561a=function(_0x5c4d27,_0x5b0822){_0x5c4d27=_0x5c4d27-0x0;var _0x1dda1a=_0x61a5[_0x5c4d27];return _0x1dda1a;};'use strict';var EventEmitter=require(_0x561a('0x0'));var WhatsappInteraction=require('../../mysqldb')['db'][_0x561a('0x1')];var WhatsappMessage=require(_0x561a('0x2'))['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x561a('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x561a('0x4'),'afterDestroy':_0x561a('0x5')};function emitEvent(_0x1d8bd8){return function(_0x1bce83,_0x2261b3,_0x28ff42){_0x1bce83[_0x561a('0x6')]({'attributes':['id'],'raw':!![]})[_0x561a('0x7')](function(_0x4c2853){_0x1bce83[_0x561a('0x8')](_0x561a('0x9'),_0x4c2853[_0x561a('0xa')](function(_0x5cd4f6){return{'id':_0x5cd4f6['id']};}));return WhatsappMessage[_0x561a('0xb')]({'where':{'WhatsappInteractionId':_0x1bce83['id'],'direction':'in','read':![]},'raw':!![]});})[_0x561a('0x7')](function(_0x5a4e9b){_0x1bce83[_0x561a('0x8')](_0x561a('0xc'),_0x5a4e9b[_0x561a('0xd')]);WhatsappInteractionEvents[_0x561a('0xe')](_0x1d8bd8+':'+_0x1bce83['id'],_0x1bce83);WhatsappInteractionEvents['emit'](_0x1d8bd8,_0x1bce83);_0x28ff42(null);})['catch'](_0x28ff42(null));};}for(var e in events){if(events[_0x561a('0xf')](e)){var event=events[e];WhatsappInteraction[_0x561a('0x10')](e,emitEvent(event));}}module[_0x561a('0x11')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 2b8b328..05516c8 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 _0xc39e=['closed','closedAt','format','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./whatsappInteraction.attributes','exports','define','whatsapp_interactions','changed'];(function(_0x7cb10c,_0x2fcc3a){var _0x11df59=function(_0x75305f){while(--_0x75305f){_0x7cb10c['push'](_0x7cb10c['shift']());}};_0x11df59(++_0x2fcc3a);}(_0xc39e,0x1e3));var _0xec39=function(_0x10c51f,_0x11270f){_0x10c51f=_0x10c51f-0x0;var _0x56a0cd=_0xc39e[_0x10c51f];return _0x56a0cd;};'use strict';var _=require(_0xec39('0x0'));var util=require(_0xec39('0x1'));var logger=require(_0xec39('0x2'))(_0xec39('0x3'));var moment=require(_0xec39('0x4'));var BPromise=require(_0xec39('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xec39('0x6'));var rimraf=require(_0xec39('0x7'));var config=require('../../config/environment');var attributes=require(_0xec39('0x8'));module[_0xec39('0x9')]=function(_0x2ca741,_0x4be662){return _0x2ca741[_0xec39('0xa')]('WhatsappInteraction',attributes,{'tableName':_0xec39('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x21af77,_0x44db96,_0x2ecf13){if(_0x21af77[_0xec39('0xc')](_0xec39('0xd'))){_0x21af77[_0xec39('0xe')]=moment()[_0xec39('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}_0x2ecf13(null,_0x21af77);}}});}; \ No newline at end of file +var _0x2a9a=['format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','request-promise','rimraf','./whatsappInteraction.attributes','exports','WhatsappInteraction','changed','closed','closedAt'];(function(_0x2a9c57,_0x4f4114){var _0x4d4183=function(_0x115c49){while(--_0x115c49){_0x2a9c57['push'](_0x2a9c57['shift']());}};_0x4d4183(++_0x4f4114);}(_0x2a9a,0x89));var _0xa2a9=function(_0xc3f41,_0x17b93e){_0xc3f41=_0xc3f41-0x0;var _0x55f58e=_0x2a9a[_0xc3f41];return _0x55f58e;};'use strict';var _=require(_0xa2a9('0x0'));var util=require(_0xa2a9('0x1'));var logger=require(_0xa2a9('0x2'))(_0xa2a9('0x3'));var moment=require(_0xa2a9('0x4'));var BPromise=require('bluebird');var rp=require(_0xa2a9('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa2a9('0x6'));var config=require('../../config/environment');var attributes=require(_0xa2a9('0x7'));module[_0xa2a9('0x8')]=function(_0x122bc8,_0x58a799){return _0x122bc8['define'](_0xa2a9('0x9'),attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2a973d,_0x46ed6e,_0x415ae1){if(_0x2a973d[_0xa2a9('0xa')](_0xa2a9('0xb'))){_0x2a973d[_0xa2a9('0xc')]=moment()[_0xa2a9('0xd')](_0xa2a9('0xe'));}_0x415ae1(null,_0x2a973d);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index bba1e9e..6f0b619 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 _0x8211=['spread','AddTags','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','register','request','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','UpdateWhatsappInteraction','update','body','options','attributes','limit','WhatsappInteraction','find','where','then','addTags','ids','omit'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8211,0x1c6));var _0x1821=function(_0x5bab96,_0x224682){_0x5bab96=_0x5bab96-0x0;var _0x128459=_0x8211[_0x5bab96];return _0x128459;};'use strict';var _=require(_0x1821('0x0'));var util=require(_0x1821('0x1'));var moment=require(_0x1821('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1821('0x3'));var db=require(_0x1821('0x4'))['db'];var utils=require(_0x1821('0x5'));var logger=require(_0x1821('0x6'))(_0x1821('0x7'));var config=require(_0x1821('0x8'));var jayson=require(_0x1821('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x1821('0xa')]=_[_0x1821('0xb')](config['redis'],{'host':_0x1821('0xc'),'port':0x18eb});var socket=require(_0x1821('0xd'))(new Redis(config[_0x1821('0xa')]));require('./whatsappInteraction.socket')[_0x1821('0xe')](socket);function respondWithRpcPromise(_0xfbe120,_0x1d82c0,_0x5cfcd1){return new BPromise(function(_0x58b57c,_0x2f7b07){return client[_0x1821('0xf')](_0xfbe120,_0x5cfcd1)['then'](function(_0x259c03){logger[_0x1821('0x10')](_0x1821('0x11'),_0x1d82c0,_0x1821('0x12'));logger[_0x1821('0x13')](_0x1821('0x14'),_0x1d82c0,_0x1821('0x12'),JSON[_0x1821('0x15')](_0x259c03));if(_0x259c03['error']){if(_0x259c03['error']['code']===0x1f4){logger['error'](_0x1821('0x11'),_0x1d82c0,_0x259c03[_0x1821('0x16')]['message']);return _0x2f7b07(_0x259c03['error'][_0x1821('0x17')]);}logger[_0x1821('0x16')](_0x1821('0x11'),_0x1d82c0,_0x259c03['error'][_0x1821('0x17')]);return _0x58b57c(_0x259c03['error']['message']);}else{logger[_0x1821('0x10')](_0x1821('0x11'),_0x1d82c0,_0x1821('0x12'));_0x58b57c(_0x259c03[_0x1821('0x18')][_0x1821('0x17')]);}})['catch'](function(_0x2249d8){logger[_0x1821('0x16')](_0x1821('0x11'),_0x1d82c0,_0x2249d8);_0x2f7b07(_0x2249d8);});});}exports[_0x1821('0x19')]=function(_0x63c298){var _0x42193c=this;return new Promise(function(_0x19c7df,_0x199795){return db['WhatsappInteraction'][_0x1821('0x1a')](_0x63c298[_0x1821('0x1b')],{'raw':_0x63c298[_0x1821('0x1c')]?_0x63c298[_0x1821('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x63c298[_0x1821('0x1c')]?_0x63c298[_0x1821('0x1c')]['where']||null:null,'attributes':_0x63c298['options']?_0x63c298[_0x1821('0x1c')][_0x1821('0x1d')]||null:null,'limit':_0x63c298[_0x1821('0x1c')]?_0x63c298[_0x1821('0x1c')][_0x1821('0x1e')]||null:null})['then'](function(_0x2c313a){logger['info'](_0x1821('0x19'),_0x63c298);logger[_0x1821('0x13')](_0x1821('0x19'),_0x63c298,JSON[_0x1821('0x15')](_0x2c313a));_0x19c7df(_0x2c313a);})['catch'](function(_0x2f6e6d){logger['error'](_0x1821('0x19'),_0x2f6e6d['message'],_0x63c298);_0x199795(_0x42193c[_0x1821('0x16')](0x1f4,_0x2f6e6d[_0x1821('0x17')]));});});};exports['AddTagsToWhatsappInteraction']=function(_0x46afda){return new Promise(function(_0x1cac86,_0x5e06ad){return db[_0x1821('0x1f')][_0x1821('0x20')]({'where':_0x46afda['options']?_0x46afda['options'][_0x1821('0x21')]||null:null})[_0x1821('0x22')](function(_0x1857ad){if(_0x1857ad){return _0x1857ad[_0x1821('0x23')](_0x46afda[_0x1821('0x1b')][_0x1821('0x24')],_[_0x1821('0x25')](_0x46afda[_0x1821('0x1b')],['ids','id'])||{});}})[_0x1821('0x26')](function(_0x397007){logger[_0x1821('0x10')](_0x1821('0x27'),_0x46afda);logger['debug'](_0x1821('0x27'),_0x46afda,JSON[_0x1821('0x15')](_0x397007));_0x1cac86(_0x397007);})[_0x1821('0x28')](function(_0x5f1f98){logger['error']('AddTags',_0x5f1f98[_0x1821('0x17')],_0x46afda);_0x5e06ad(_this['error'](0x1f4,_0x5f1f98[_0x1821('0x17')]));});});}; \ No newline at end of file +var _0xfbaa=['register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateWhatsappInteraction','update','body','options','raw','where','limit','AddTagsToWhatsappInteraction','WhatsappInteraction','find','addTags','ids','omit','spread','AddTags','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter'];(function(_0xe36749,_0x2a45c8){var _0x5d86b7=function(_0x1219e5){while(--_0x1219e5){_0xe36749['push'](_0xe36749['shift']());}};_0x5d86b7(++_0x2a45c8);}(_0xfbaa,0x75));var _0xafba=function(_0x55d8c5,_0x10287a){_0x55d8c5=_0x55d8c5-0x0;var _0x225ae5=_0xfbaa[_0x55d8c5];return _0x225ae5;};'use strict';var _=require(_0xafba('0x0'));var util=require(_0xafba('0x1'));var moment=require(_0xafba('0x2'));var BPromise=require('bluebird');var rs=require(_0xafba('0x3'));var fs=require('fs');var Redis=require(_0xafba('0x4'));var db=require(_0xafba('0x5'))['db'];var utils=require(_0xafba('0x6'));var logger=require('../../config/logger')(_0xafba('0x7'));var config=require(_0xafba('0x8'));var jayson=require(_0xafba('0x9'));var client=jayson[_0xafba('0xa')][_0xafba('0xb')]({'port':0x232a});config['redis']=_[_0xafba('0xc')](config['redis'],{'host':_0xafba('0xd'),'port':0x18eb});var socket=require(_0xafba('0xe'))(new Redis(config['redis']));require('./whatsappInteraction.socket')[_0xafba('0xf')](socket);function respondWithRpcPromise(_0x8c9671,_0xbd8bf4,_0x51c7b2){return new BPromise(function(_0x1f8f08,_0x16822f){return client[_0xafba('0x10')](_0x8c9671,_0x51c7b2)[_0xafba('0x11')](function(_0xfb698b){logger[_0xafba('0x12')](_0xafba('0x13'),_0xbd8bf4,_0xafba('0x14'));logger[_0xafba('0x15')](_0xafba('0x16'),_0xbd8bf4,'request\x20sent',JSON[_0xafba('0x17')](_0xfb698b));if(_0xfb698b[_0xafba('0x18')]){if(_0xfb698b[_0xafba('0x18')][_0xafba('0x19')]===0x1f4){logger[_0xafba('0x18')]('WhatsappInteraction,\x20%s,\x20%s',_0xbd8bf4,_0xfb698b[_0xafba('0x18')][_0xafba('0x1a')]);return _0x16822f(_0xfb698b['error'][_0xafba('0x1a')]);}logger[_0xafba('0x18')](_0xafba('0x13'),_0xbd8bf4,_0xfb698b[_0xafba('0x18')][_0xafba('0x1a')]);return _0x1f8f08(_0xfb698b[_0xafba('0x18')][_0xafba('0x1a')]);}else{logger['info'](_0xafba('0x13'),_0xbd8bf4,_0xafba('0x14'));_0x1f8f08(_0xfb698b[_0xafba('0x1b')][_0xafba('0x1a')]);}})[_0xafba('0x1c')](function(_0x8a43c9){logger[_0xafba('0x18')](_0xafba('0x13'),_0xbd8bf4,_0x8a43c9);_0x16822f(_0x8a43c9);});});}exports[_0xafba('0x1d')]=function(_0x3fa1be){var _0xe716ea=this;return new Promise(function(_0x1ddd15,_0x4266be){return db['WhatsappInteraction'][_0xafba('0x1e')](_0x3fa1be[_0xafba('0x1f')],{'raw':_0x3fa1be[_0xafba('0x20')]?_0x3fa1be['options'][_0xafba('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3fa1be[_0xafba('0x20')]?_0x3fa1be['options'][_0xafba('0x22')]||null:null,'attributes':_0x3fa1be[_0xafba('0x20')]?_0x3fa1be[_0xafba('0x20')]['attributes']||null:null,'limit':_0x3fa1be[_0xafba('0x20')]?_0x3fa1be[_0xafba('0x20')][_0xafba('0x23')]||null:null})['then'](function(_0x13f119){logger['info'](_0xafba('0x1d'),_0x3fa1be);logger[_0xafba('0x15')](_0xafba('0x1d'),_0x3fa1be,JSON[_0xafba('0x17')](_0x13f119));_0x1ddd15(_0x13f119);})[_0xafba('0x1c')](function(_0x515609){logger[_0xafba('0x18')](_0xafba('0x1d'),_0x515609[_0xafba('0x1a')],_0x3fa1be);_0x4266be(_0xe716ea['error'](0x1f4,_0x515609['message']));});});};exports[_0xafba('0x24')]=function(_0x49c980){return new Promise(function(_0x426c42,_0x265437){return db[_0xafba('0x25')][_0xafba('0x26')]({'where':_0x49c980[_0xafba('0x20')]?_0x49c980[_0xafba('0x20')]['where']||null:null})[_0xafba('0x11')](function(_0xc767f2){if(_0xc767f2){return _0xc767f2[_0xafba('0x27')](_0x49c980[_0xafba('0x1f')][_0xafba('0x28')],_[_0xafba('0x29')](_0x49c980[_0xafba('0x1f')],['ids','id'])||{});}})[_0xafba('0x2a')](function(_0x50d8b6){logger[_0xafba('0x12')](_0xafba('0x2b'),_0x49c980);logger['debug'](_0xafba('0x2b'),_0x49c980,JSON['stringify'](_0x50d8b6));_0x426c42(_0x50d8b6);})[_0xafba('0x1c')](function(_0x6d5afc){logger[_0xafba('0x18')]('AddTags',_0x6d5afc['message'],_0x49c980);_0x265437(_this['error'](0x1f4,_0x6d5afc[_0xafba('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 893fd8d..29f086c 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 _0x18ea=['length','./whatsappInteraction.events','save','remove','update','emit','register'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x18ea,0x151));var _0xa18e=function(_0x4e50e9,_0x52ed05){_0x4e50e9=_0x4e50e9-0x0;var _0x503e0c=_0x18ea[_0x4e50e9];return _0x503e0c;};'use strict';var WhatsappInteractionEvents=require(_0xa18e('0x0'));var events=[_0xa18e('0x1'),_0xa18e('0x2'),_0xa18e('0x3')];function createListener(_0x5e4476,_0x24f860){return function(_0x54352c){_0x24f860[_0xa18e('0x4')](_0x5e4476,_0x54352c);};}function removeListener(_0x3c5b7a,_0x3aa51a){return function(){WhatsappInteractionEvents['removeListener'](_0x3c5b7a,_0x3aa51a);};}exports[_0xa18e('0x5')]=function(_0x910327){for(var _0x13ea34=0x0,_0x5cf21c=events[_0xa18e('0x6')];_0x13ea34<_0x5cf21c;_0x13ea34++){var _0x34ff2e=events[_0x13ea34];var _0x419cd0=createListener('whatsappInteraction:'+_0x34ff2e,_0x910327);WhatsappInteractionEvents['on'](_0x34ff2e,_0x419cd0);}}; \ No newline at end of file +var _0xcfbb=['emit','removeListener','register','whatsappInteraction:','save','remove','update'];(function(_0x481604,_0x276ff8){var _0x1ca4ed=function(_0x136e9d){while(--_0x136e9d){_0x481604['push'](_0x481604['shift']());}};_0x1ca4ed(++_0x276ff8);}(_0xcfbb,0x6d));var _0xbcfb=function(_0x3a5511,_0x46ee32){_0x3a5511=_0x3a5511-0x0;var _0x5e85a6=_0xcfbb[_0x3a5511];return _0x5e85a6;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=[_0xbcfb('0x0'),_0xbcfb('0x1'),_0xbcfb('0x2')];function createListener(_0x5a9d57,_0x1d715b){return function(_0x3df086){_0x1d715b[_0xbcfb('0x3')](_0x5a9d57,_0x3df086);};}function removeListener(_0x394132,_0x5c57fc){return function(){WhatsappInteractionEvents[_0xbcfb('0x4')](_0x394132,_0x5c57fc);};}exports[_0xbcfb('0x5')]=function(_0x54405b){for(var _0x2822fb=0x0,_0x5863c1=events['length'];_0x2822fb<_0x5863c1;_0x2822fb++){var _0x280bfb=events[_0x2822fb];var _0x45ddd1=createListener(_0xbcfb('0x6')+_0x280bfb,_0x54405b);WhatsappInteractionEvents['on'](_0x280bfb,_0x45ddd1);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 1986c58..724ccb1 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 _0x68ca=['destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','/describe','describe','/:id','show','post','tracked','whatsapp','whatsappmessage:create','create','/:id/status','status','put','/:id/accept','reject','delete'];(function(_0x3eae23,_0x32b7bd){var _0x24d8b2=function(_0x4966bc){while(--_0x4966bc){_0x3eae23['push'](_0x3eae23['shift']());}};_0x24d8b2(++_0x32b7bd);}(_0x68ca,0xe9));var _0xa68c=function(_0x32df1c,_0x136e0f){_0x32df1c=_0x32df1c-0x0;var _0x32949e=_0x68ca[_0x32df1c];return _0x32949e;};'use strict';var multer=require(_0xa68c('0x0'));var util=require(_0xa68c('0x1'));var path=require(_0xa68c('0x2'));var timeout=require(_0xa68c('0x3'));var express=require(_0xa68c('0x4'));var router=express[_0xa68c('0x5')]();var fs_extra=require(_0xa68c('0x6'));var auth=require(_0xa68c('0x7'));var interaction=require(_0xa68c('0x8'));var config=require(_0xa68c('0x9'));var controller=require(_0xa68c('0xa'));router[_0xa68c('0xb')]('/',auth[_0xa68c('0xc')](),controller['index']);router['get'](_0xa68c('0xd'),auth[_0xa68c('0xc')](),controller[_0xa68c('0xe')]);router[_0xa68c('0xb')](_0xa68c('0xf'),auth['isAuthenticated'](),controller[_0xa68c('0x10')]);router[_0xa68c('0x11')]('/',auth['isAuthenticated'](),interaction[_0xa68c('0x12')](_0xa68c('0x13'),_0xa68c('0x14')),controller[_0xa68c('0x15')]);router[_0xa68c('0x11')](_0xa68c('0x16'),controller[_0xa68c('0x17')]);router[_0xa68c('0x18')]('/:id',auth[_0xa68c('0xc')](),controller['update']);router[_0xa68c('0x18')](_0xa68c('0x19'),auth[_0xa68c('0xc')](),controller['accept']);router['put']('/:id/reject',auth[_0xa68c('0xc')](),controller[_0xa68c('0x1a')]);router[_0xa68c('0x1b')](_0xa68c('0xf'),auth['isAuthenticated'](),controller[_0xa68c('0x1c')]);module['exports']=router; \ No newline at end of file +var _0xbd3c=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','index','/describe','isAuthenticated','describe','show','post','tracked','whatsapp','whatsappmessage:create','create','/:id/status','put','/:id','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer'];(function(_0x20c52e,_0x86162d){var _0x2b0651=function(_0xdab9dc){while(--_0xdab9dc){_0x20c52e['push'](_0x20c52e['shift']());}};_0x2b0651(++_0x86162d);}(_0xbd3c,0xe7));var _0xcbd3=function(_0x201ef0,_0xae1e89){_0x201ef0=_0x201ef0-0x0;var _0x5a5bae=_0xbd3c[_0x201ef0];return _0x5a5bae;};'use strict';var multer=require(_0xcbd3('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xcbd3('0x1'));var router=express['Router']();var fs_extra=require(_0xcbd3('0x2'));var auth=require(_0xcbd3('0x3'));var interaction=require(_0xcbd3('0x4'));var config=require(_0xcbd3('0x5'));var controller=require(_0xcbd3('0x6'));router[_0xcbd3('0x7')]('/',auth['isAuthenticated'](),controller[_0xcbd3('0x8')]);router[_0xcbd3('0x7')](_0xcbd3('0x9'),auth[_0xcbd3('0xa')](),controller[_0xcbd3('0xb')]);router[_0xcbd3('0x7')]('/:id',auth[_0xcbd3('0xa')](),controller[_0xcbd3('0xc')]);router[_0xcbd3('0xd')]('/',auth[_0xcbd3('0xa')](),interaction[_0xcbd3('0xe')](_0xcbd3('0xf'),_0xcbd3('0x10')),controller[_0xcbd3('0x11')]);router['post'](_0xcbd3('0x12'),controller['status']);router[_0xcbd3('0x13')](_0xcbd3('0x14'),auth[_0xcbd3('0xa')](),controller[_0xcbd3('0x15')]);router['put'](_0xcbd3('0x16'),auth[_0xcbd3('0xa')](),controller[_0xcbd3('0x17')]);router['put'](_0xcbd3('0x18'),auth[_0xcbd3('0xa')](),controller[_0xcbd3('0x19')]);router[_0xcbd3('0x1a')](_0xcbd3('0x14'),auth[_0xcbd3('0xa')](),controller[_0xcbd3('0x1b')]);module[_0xcbd3('0x1c')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 9bca0b6..c7f441e 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 _0xb926=['out','STRING','BOOLEAN','sequelize','exports','TEXT','medium','ENUM'];(function(_0xdd4ba8,_0x562501){var _0x274c2b=function(_0x1fdbcf){while(--_0x1fdbcf){_0xdd4ba8['push'](_0xdd4ba8['shift']());}};_0x274c2b(++_0x562501);}(_0xb926,0x83));var _0x6b92=function(_0x8db051,_0x201329){_0x8db051=_0x8db051-0x0;var _0x5be9c0=_0xb926[_0x8db051];return _0x5be9c0;};'use strict';var Sequelize=require(_0x6b92('0x0'));module[_0x6b92('0x1')]={'body':{'type':Sequelize[_0x6b92('0x2')](_0x6b92('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x6b92('0x4')]('in',_0x6b92('0x5')),'defaultValue':_0x6b92('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x6b92('0x6')](0xbe)},'phone':{'type':Sequelize[_0x6b92('0x6')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0x6b92('0x7')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x6b92('0x6')]},'providerResponse':{'type':Sequelize[_0x6b92('0x2')]}}; \ No newline at end of file +var _0xa453=['TEXT','ENUM','out','STRING','DATE','sequelize','exports'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xa453,0x1a2));var _0x3a45=function(_0x172cf7,_0x33592f){_0x172cf7=_0x172cf7-0x0;var _0x560d16=_0xa453[_0x172cf7];return _0x560d16;};'use strict';var Sequelize=require(_0x3a45('0x0'));module[_0x3a45('0x1')]={'body':{'type':Sequelize[_0x3a45('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x3a45('0x3')]('in',_0x3a45('0x4')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0x3a45('0x5')]},'readAt':{'type':Sequelize[_0x3a45('0x6')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'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 a2854ad..14d305b 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 _0x6c09=['AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','reject','WhatsappInteraction','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','rejectmessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./whatsappMessage.socket','register','client','http','request','then','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','destroy','stack','name','send','index','map','WhatsappMessage','rawAttributes','type','key','model','keys','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','filter','merge','include','findAll','rows','show','includeAll','options','find','create','body','params','describe','whatsapp-interactions','accept','whatsapp','read','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','WhatsappInteractionId','read1stAt','format','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role'];(function(_0x256c1b,_0x544d4e){var _0x3f6386=function(_0x247839){while(--_0x247839){_0x256c1b['push'](_0x256c1b['shift']());}};_0x3f6386(++_0x544d4e);}(_0x6c09,0x1e1));var _0x96c0=function(_0x628203,_0x69a379){_0x628203=_0x628203-0x0;var _0x3fd8d9=_0x6c09[_0x628203];return _0x3fd8d9;};'use strict';var emlformat=require(_0x96c0('0x0'));var rimraf=require(_0x96c0('0x1'));var zipdir=require(_0x96c0('0x2'));var jsonpatch=require(_0x96c0('0x3'));var rp=require(_0x96c0('0x4'));var moment=require(_0x96c0('0x5'));var BPromise=require(_0x96c0('0x6'));var Mustache=require(_0x96c0('0x7'));var util=require(_0x96c0('0x8'));var path=require(_0x96c0('0x9'));var sox=require(_0x96c0('0xa'));var csv=require(_0x96c0('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x96c0('0xc'));var _=require(_0x96c0('0xd'));var squel=require('squel');var crypto=require(_0x96c0('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x96c0('0xf'));var toCsv=require(_0x96c0('0xb'));var querystring=require(_0x96c0('0x10'));var Papa=require(_0x96c0('0x11'));var Redis=require(_0x96c0('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x96c0('0x13'));var as=require(_0x96c0('0x14'));var hardwareService=require(_0x96c0('0x15'));var logger=require(_0x96c0('0x16'))(_0x96c0('0x17'));var utils=require(_0x96c0('0x18'));var config=require(_0x96c0('0x19'));var licenseUtil=require(_0x96c0('0x1a'));var db=require(_0x96c0('0x1b'))['db'];config[_0x96c0('0x1c')]=_[_0x96c0('0x1d')](config[_0x96c0('0x1c')],{'host':_0x96c0('0x1e'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x96c0('0x1c')]));require(_0x96c0('0x1f'))[_0x96c0('0x20')](socket);var jayson=require('jayson/promise');var client=jayson[_0x96c0('0x21')][_0x96c0('0x22')]({'port':0x232c});var client9002=jayson[_0x96c0('0x21')][_0x96c0('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x265920,_0x44bd1d,_0x283f52,_0x344885){return new BPromise(function(_0x23cf67,_0x31292c){var _0x45c8ad=_0x344885||client;return _0x45c8ad[_0x96c0('0x23')](_0x265920,_0x283f52)[_0x96c0('0x24')](function(_0x4737){logger['info'](_0x96c0('0x25'),_0x44bd1d,_0x96c0('0x26'));logger[_0x96c0('0x27')](_0x96c0('0x28'),_0x44bd1d,'request\x20sent',JSON[_0x96c0('0x29')](_0x4737));if(_0x4737[_0x96c0('0x2a')]){if(_0x4737['error'][_0x96c0('0x2b')]===0x1f4){logger['error'](_0x96c0('0x25'),_0x44bd1d,_0x4737['error']['message']);return _0x31292c(_0x4737[_0x96c0('0x2a')][_0x96c0('0x2c')]);}logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x44bd1d,_0x4737[_0x96c0('0x2a')][_0x96c0('0x2c')]);return _0x23cf67(_0x4737[_0x96c0('0x2a')][_0x96c0('0x2c')]);}else{logger[_0x96c0('0x2d')]('WhatsappMessage,\x20%s,\x20%s',_0x44bd1d,'request\x20sent');_0x23cf67(_0x4737[_0x96c0('0x2e')][_0x96c0('0x2c')]);}})[_0x96c0('0x2f')](function(_0x364273){logger[_0x96c0('0x2a')](_0x96c0('0x25'),_0x44bd1d,_0x364273);_0x31292c(_0x364273);});});}function respondWithStatusCode(_0x50d1bd,_0x4be59e){_0x4be59e=_0x4be59e||0xcc;return function(_0x544bd0){if(_0x544bd0){return _0x50d1bd[_0x96c0('0x30')](_0x4be59e);}return _0x50d1bd[_0x96c0('0x31')](_0x4be59e)[_0x96c0('0x32')]();};}function respondWithResult(_0x2a2893,_0x5ab05e){_0x5ab05e=_0x5ab05e||0xc8;return function(_0x4c6f24){if(_0x4c6f24){return _0x2a2893[_0x96c0('0x31')](_0x5ab05e)['json'](_0x4c6f24);}};}function respondWithFilteredResult(_0x2e9f9c,_0x5a73a9){return function(_0x38f11f){if(_0x38f11f){var _0x136657=typeof _0x5a73a9[_0x96c0('0x33')]===_0x96c0('0x34')&&typeof _0x5a73a9[_0x96c0('0x35')]===_0x96c0('0x34');var _0x5b5a0b=_0x38f11f[_0x96c0('0x36')];var _0x37197f=_0x136657?0x0:_0x5a73a9[_0x96c0('0x33')];var _0x13fce0=_0x136657?_0x38f11f['count']:_0x5a73a9[_0x96c0('0x33')]+_0x5a73a9[_0x96c0('0x35')];var _0x17a257;if(_0x13fce0>=_0x5b5a0b){_0x13fce0=_0x5b5a0b;_0x17a257=0xc8;}else{_0x17a257=0xce;}_0x2e9f9c[_0x96c0('0x31')](_0x17a257);return _0x2e9f9c[_0x96c0('0x37')](_0x96c0('0x38'),_0x37197f+'-'+_0x13fce0+'/'+_0x5b5a0b)[_0x96c0('0x39')](_0x38f11f);}return null;};}function patchUpdates(_0x136bc0){return function(_0x5ac16e){try{jsonpatch[_0x96c0('0x3a')](_0x5ac16e,_0x136bc0,!![]);}catch(_0xb66334){return BPromise['reject'](_0xb66334);}return _0x5ac16e[_0x96c0('0x3b')]();};}function saveUpdates(_0x311453,_0x4b326b){return function(_0x541e46){if(_0x541e46){return _0x541e46[_0x96c0('0x3c')](_0x311453)['then'](function(_0x2077e0){return _0x2077e0;});}return null;};}function removeEntity(_0x2c2c7a,_0x372d0e){return function(_0x38ed1f){if(_0x38ed1f){return _0x38ed1f[_0x96c0('0x3d')]()[_0x96c0('0x24')](function(){_0x2c2c7a['status'](0xcc)[_0x96c0('0x32')]();});}};}function handleEntityNotFound(_0xbbc34f,_0x4fd7c9){return function(_0x583ce0){if(!_0x583ce0){_0xbbc34f['sendStatus'](0x194);}return _0x583ce0;};}function handleError(_0x2dfdd1,_0x547c86){_0x547c86=_0x547c86||0x1f4;return function(_0x3843a2){logger[_0x96c0('0x2a')](_0x3843a2[_0x96c0('0x3e')]);if(_0x3843a2[_0x96c0('0x3f')]){delete _0x3843a2[_0x96c0('0x3f')];}_0x2dfdd1[_0x96c0('0x31')](_0x547c86)[_0x96c0('0x40')](_0x3843a2);};}exports[_0x96c0('0x41')]=function(_0xa4b8c8,_0x162c21){var _0x1ab8a4={},_0x34d98e={},_0xdd2d92={'count':0x0,'rows':[]};var _0x4fafb5=_[_0x96c0('0x42')](db[_0x96c0('0x43')][_0x96c0('0x44')],function(_0x164981){return{'name':_0x164981['fieldName'],'type':_0x164981[_0x96c0('0x45')][_0x96c0('0x46')]};});_0x34d98e[_0x96c0('0x47')]=_[_0x96c0('0x42')](_0x4fafb5,'name');_0x34d98e['query']=_[_0x96c0('0x48')](_0xa4b8c8[_0x96c0('0x49')]);_0x34d98e[_0x96c0('0x4a')]=_[_0x96c0('0x4b')](_0x34d98e[_0x96c0('0x47')],_0x34d98e[_0x96c0('0x49')]);_0x1ab8a4['attributes']=_[_0x96c0('0x4b')](_0x34d98e[_0x96c0('0x47')],qs[_0x96c0('0x4c')](_0xa4b8c8[_0x96c0('0x49')]['fields']));_0x1ab8a4[_0x96c0('0x4d')]=_0x1ab8a4[_0x96c0('0x4d')][_0x96c0('0x4e')]?_0x1ab8a4[_0x96c0('0x4d')]:_0x34d98e['model'];if(!_0xa4b8c8[_0x96c0('0x49')]['hasOwnProperty'](_0x96c0('0x4f'))){_0x1ab8a4[_0x96c0('0x35')]=qs[_0x96c0('0x35')](_0xa4b8c8[_0x96c0('0x49')][_0x96c0('0x35')]);_0x1ab8a4[_0x96c0('0x33')]=qs[_0x96c0('0x33')](_0xa4b8c8[_0x96c0('0x49')]['offset']);}_0x1ab8a4[_0x96c0('0x50')]=qs[_0x96c0('0x51')](_0xa4b8c8[_0x96c0('0x49')]['sort']);_0x1ab8a4[_0x96c0('0x52')]=qs[_0x96c0('0x4a')](_['pick'](_0xa4b8c8[_0x96c0('0x49')],_0x34d98e[_0x96c0('0x4a')]),_0x4fafb5);if(_0xa4b8c8['query']['filter']){_0x1ab8a4['where']=_['merge'](_0x1ab8a4[_0x96c0('0x52')],{'$or':_[_0x96c0('0x42')](_0x4fafb5,function(_0x4f31b5){if(_0x4f31b5[_0x96c0('0x45')]!=='VIRTUAL'){var _0x262bf2={};_0x262bf2[_0x4f31b5[_0x96c0('0x3f')]]={'$like':'%'+_0xa4b8c8[_0x96c0('0x49')][_0x96c0('0x53')]+'%'};return _0x262bf2;}})});}_0x1ab8a4=_[_0x96c0('0x54')]({},_0x1ab8a4,_0xa4b8c8['options']);var _0x5b5572={'where':_0x1ab8a4[_0x96c0('0x52')]};return db[_0x96c0('0x43')][_0x96c0('0x36')](_0x5b5572)['then'](function(_0x3032b9){_0xdd2d92[_0x96c0('0x36')]=_0x3032b9;if(_0xa4b8c8[_0x96c0('0x49')]['includeAll']){_0x1ab8a4[_0x96c0('0x55')]=[{'all':!![]}];}return db[_0x96c0('0x43')][_0x96c0('0x56')](_0x1ab8a4);})[_0x96c0('0x24')](function(_0x1a4bc8){_0xdd2d92[_0x96c0('0x57')]=_0x1a4bc8;return _0xdd2d92;})[_0x96c0('0x24')](respondWithFilteredResult(_0x162c21,_0x1ab8a4))['catch'](handleError(_0x162c21,null));};exports[_0x96c0('0x58')]=function(_0x250650,_0x49a0c2){var _0x2481f9={'raw':!![],'where':{'id':_0x250650['params']['id']}},_0xf5edc4={};_0xf5edc4[_0x96c0('0x47')]=_[_0x96c0('0x48')](db['WhatsappMessage'][_0x96c0('0x44')]);_0xf5edc4[_0x96c0('0x49')]=_['keys'](_0x250650[_0x96c0('0x49')]);_0xf5edc4[_0x96c0('0x4a')]=_['intersection'](_0xf5edc4[_0x96c0('0x47')],_0xf5edc4[_0x96c0('0x49')]);_0x2481f9['attributes']=_[_0x96c0('0x4b')](_0xf5edc4['model'],qs['fields'](_0x250650[_0x96c0('0x49')][_0x96c0('0x4c')]));_0x2481f9[_0x96c0('0x4d')]=_0x2481f9[_0x96c0('0x4d')][_0x96c0('0x4e')]?_0x2481f9[_0x96c0('0x4d')]:_0xf5edc4[_0x96c0('0x47')];if(_0x250650[_0x96c0('0x49')][_0x96c0('0x59')]){_0x2481f9[_0x96c0('0x55')]=[{'all':!![]}];}_0x2481f9=_['merge']({},_0x2481f9,_0x250650[_0x96c0('0x5a')]);return db[_0x96c0('0x43')][_0x96c0('0x5b')](_0x2481f9)['then'](handleEntityNotFound(_0x49a0c2,null))[_0x96c0('0x24')](respondWithResult(_0x49a0c2,null))[_0x96c0('0x2f')](handleError(_0x49a0c2,null));};exports[_0x96c0('0x5c')]=function(_0x1f644c,_0x633285){return db[_0x96c0('0x43')][_0x96c0('0x5c')](_0x1f644c[_0x96c0('0x5d')],{})[_0x96c0('0x24')](respondWithResult(_0x633285,0xc9))[_0x96c0('0x2f')](handleError(_0x633285,null));};exports[_0x96c0('0x3c')]=function(_0x53bd32,_0x4bbe0e){if(_0x53bd32[_0x96c0('0x5d')]['id']){delete _0x53bd32[_0x96c0('0x5d')]['id'];}return db[_0x96c0('0x43')][_0x96c0('0x5b')]({'where':{'id':_0x53bd32[_0x96c0('0x5e')]['id']}})[_0x96c0('0x24')](handleEntityNotFound(_0x4bbe0e,null))[_0x96c0('0x24')](saveUpdates(_0x53bd32['body'],null))[_0x96c0('0x24')](respondWithResult(_0x4bbe0e,null))[_0x96c0('0x2f')](handleError(_0x4bbe0e,null));};exports[_0x96c0('0x3d')]=function(_0x22e662,_0x2fc252){return db[_0x96c0('0x43')][_0x96c0('0x5b')]({'where':{'id':_0x22e662[_0x96c0('0x5e')]['id']}})['then'](handleEntityNotFound(_0x2fc252,null))[_0x96c0('0x24')](removeEntity(_0x2fc252,null))[_0x96c0('0x2f')](handleError(_0x2fc252,null));};exports[_0x96c0('0x5f')]=function(_0x29b393,_0x5af573){return db[_0x96c0('0x43')][_0x96c0('0x5f')]()['then'](respondWithResult(_0x5af573,null))[_0x96c0('0x2f')](handleError(_0x5af573,null));};var interaction_log=require(_0x96c0('0x16'))(_0x96c0('0x60'));exports[_0x96c0('0x61')]=function(_0x3cfacd,_0x2c2117,_0x593770){var _0x3a430a={'agent':{},'channel':_0x96c0('0x62')};if(_0x3cfacd[_0x96c0('0x5d')]['id']){delete _0x3cfacd[_0x96c0('0x5d')]['id'];}_0x3cfacd[_0x96c0('0x5d')][_0x96c0('0x63')]=!![];_0x3cfacd[_0x96c0('0x5d')]['readAt']=moment()['format'](_0x96c0('0x64'));_0x3cfacd[_0x96c0('0x5d')][_0x96c0('0x65')]=_0x3cfacd[_0x96c0('0x5d')][_0x96c0('0x65')]||_0x3cfacd[_0x96c0('0x66')]['id'];_0x3a430a[_0x96c0('0x67')]['id']=_0x3cfacd['body']['UserId'];return db[_0x96c0('0x43')][_0x96c0('0x5b')]({'where':{'id':_0x3cfacd[_0x96c0('0x5e')]['id'],'UserId':null}})[_0x96c0('0x24')](handleEntityNotFound(_0x2c2117,null))[_0x96c0('0x24')](saveUpdates(_0x3cfacd['body'],null))[_0x96c0('0x24')](function(_0x1968c7){if(_0x1968c7){_0x3a430a['message']=_0x1968c7[_0x96c0('0x68')]({'plain':!![]});return db['WhatsappInteraction']['find']({'where':{'id':_0x1968c7[_0x96c0('0x69')]}});}return null;})[_0x96c0('0x24')](handleEntityNotFound(_0x2c2117,null))[_0x96c0('0x24')](function(_0x8f8ac9){if(_0x8f8ac9){return _0x8f8ac9[_0x96c0('0x3c')]({'UserId':_0x3cfacd[_0x96c0('0x5d')][_0x96c0('0x65')],'read1stAt':_['isNil'](_0x8f8ac9[_0x96c0('0x6a')])?moment()[_0x96c0('0x6b')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x96c0('0x24')](function(_0x219f7){if(_0x219f7){_0x3a430a[_0x96c0('0x6c')]=_0x219f7[_0x96c0('0x68')]({'plain':!![]});interaction_log[_0x96c0('0x2d')](_0x96c0('0x6d'),_0x3cfacd[_0x96c0('0x66')]['id'],_0x3cfacd['user'][_0x96c0('0x3f')],_0x3cfacd[_0x96c0('0x66')][_0x96c0('0x6e')],_0x3a430a[_0x96c0('0x6c')]['id'],_0x3cfacd[_0x96c0('0x5d')]?JSON['stringify'](_0x3cfacd[_0x96c0('0x5d')]):'null');return respondWithRpcPromise(_0x96c0('0x6f'),'acceptMessage',_0x3a430a);}return null;})[_0x96c0('0x24')](function(_0x46ecfa){var _0x392716=_0x96c0('0x70')+_0x46ecfa['message'][_0x96c0('0x71')];return db[_0x96c0('0x72')][_0x96c0('0x49')](_0x392716,{'type':db[_0x96c0('0x73')][_0x96c0('0x74')][_0x96c0('0x75')],'raw':!![]})['then'](function(_0x27e0ed){return _0x27e0ed;});})[_0x96c0('0x24')](function(_0x21ce9d){if(_0x21ce9d){_0x3a430a[_0x96c0('0x2c')][_0x96c0('0x76')]=_0x21ce9d[0x0];if(!_0x3cfacd['body'][_0x96c0('0x65')])return;return db[_0x96c0('0x77')][_0x96c0('0x5b')]({'where':{'id':_0x3cfacd[_0x96c0('0x5d')]['UserId'],'role':'agent'},'attributes':['id','name',_0x96c0('0x78'),_0x96c0('0x79'),_0x96c0('0x7a')],'raw':!![]});}return null;})[_0x96c0('0x24')](function(_0x34260b){if(!_0x34260b)return null;_0x3a430a[_0x96c0('0x2c')][_0x96c0('0x67')]=_0x34260b;return _0x3a430a;})[_0x96c0('0x24')](function(_0x5f1825){if(_0x5f1825){if(_0x3cfacd['body'][_0x96c0('0x7b')]){_0x3a430a['message'][_0x96c0('0x7c')]=util['format'](_0x96c0('0x7d'),_0x3cfacd[_0x96c0('0x66')][_0x96c0('0x3f')]);_0x3a430a[_0x96c0('0x2c')][_0x96c0('0x7e')]=_0x3a430a[_0x96c0('0x7e')];_0x3a430a[_0x96c0('0x2c')][_0x96c0('0x7f')]=_0x3a430a[_0x96c0('0x7e')];_0x3a430a[_0x96c0('0x2c')][_0x96c0('0x80')]=_0x96c0('0x61');return respondWithRpcPromise(_0x96c0('0x81'),_0x96c0('0x81'),{'event':_0x96c0('0x82'),'message':_0x3a430a[_0x96c0('0x2c')]},client9002)[_0x96c0('0x24')](function(){return _0x3a430a;});}return _0x3a430a;}return null;})[_0x96c0('0x24')](respondWithResult(_0x2c2117,null))[_0x96c0('0x2f')](handleError(_0x2c2117,null));};var interaction_log=require(_0x96c0('0x16'))(_0x96c0('0x60'));exports[_0x96c0('0x83')]=function(_0x176461,_0x25f07c,_0xd73875){var _0x381c4c={'agent':{},'channel':_0x96c0('0x62')};if(_0x176461[_0x96c0('0x5d')]['id']){delete _0x176461[_0x96c0('0x5d')]['id'];}_0x176461[_0x96c0('0x5d')][_0x96c0('0x65')]=_0x176461[_0x96c0('0x5d')]['UserId']||_0x176461[_0x96c0('0x66')]['id'];_0x381c4c[_0x96c0('0x67')]['id']=_0x176461[_0x96c0('0x5d')][_0x96c0('0x65')];return db['WhatsappMessage']['find']({'where':{'id':_0x176461['params']['id'],'UserId':null}})[_0x96c0('0x24')](handleEntityNotFound(_0x25f07c,null))['then'](function(_0x5bc125){if(_0x5bc125){_0x381c4c['message']=_0x5bc125[_0x96c0('0x68')]({'plain':!![]});return db[_0x96c0('0x84')][_0x96c0('0x5b')]({'where':{'id':_0x5bc125['WhatsappInteractionId']}});}return null;})[_0x96c0('0x24')](handleEntityNotFound(_0x25f07c,null))[_0x96c0('0x24')](function(_0x5a8f67){if(_0x5a8f67){_0x381c4c['interaction']=_0x5a8f67['get']({'plain':!![]});interaction_log[_0x96c0('0x2d')](_0x96c0('0x85'),_0x176461[_0x96c0('0x66')]['id'],_0x176461[_0x96c0('0x66')][_0x96c0('0x3f')],_0x176461['user'][_0x96c0('0x6e')],_0x381c4c[_0x96c0('0x6c')]['id'],_0x176461[_0x96c0('0x5d')]?JSON[_0x96c0('0x29')](_0x176461[_0x96c0('0x5d')]):_0x96c0('0x86'));return respondWithRpcPromise(_0x96c0('0x87'),_0x96c0('0x88'),_0x381c4c);}return null;})['then'](function(_0x41df33){var _0x1d34ef=_0x96c0('0x70')+_0x41df33[_0x96c0('0x2c')][_0x96c0('0x71')];return db[_0x96c0('0x72')][_0x96c0('0x49')](_0x1d34ef,{'type':db[_0x96c0('0x73')][_0x96c0('0x74')][_0x96c0('0x75')],'raw':!![]})[_0x96c0('0x24')](function(_0x40b5aa){return _0x40b5aa;});})[_0x96c0('0x24')](function(_0x3d004f){if(_0x3d004f){_0x381c4c[_0x96c0('0x2c')][_0x96c0('0x76')]=_0x3d004f[0x0];if(!_0x176461[_0x96c0('0x5d')][_0x96c0('0x65')])return;return db[_0x96c0('0x77')]['find']({'where':{'id':_0x176461[_0x96c0('0x5d')][_0x96c0('0x65')],'role':_0x96c0('0x67')},'attributes':['id',_0x96c0('0x3f'),'fullname',_0x96c0('0x79'),'internal'],'raw':!![]});}return null;})[_0x96c0('0x24')](function(_0xe63c05){if(!_0xe63c05)return null;_0x381c4c['message'][_0x96c0('0x67')]=_0xe63c05;return _0x381c4c;})[_0x96c0('0x24')](function(_0x19c6fe){if(_0x19c6fe){_0x19c6fe['message'][_0x96c0('0x7c')]=util[_0x96c0('0x6b')](_0x96c0('0x7d'),_0x176461['user'][_0x96c0('0x3f')]);_0x19c6fe[_0x96c0('0x2c')][_0x96c0('0x7e')]=_0x381c4c[_0x96c0('0x7e')];_0x19c6fe[_0x96c0('0x2c')][_0x96c0('0x7f')]=_0x381c4c['channel'];_0x19c6fe[_0x96c0('0x2c')]['event']=_0x96c0('0x83');respondWithRpcPromise(_0x96c0('0x81'),_0x96c0('0x81'),{'event':_0x96c0('0x89'),'message':_0x19c6fe[_0x96c0('0x2c')]},client9002);return _0x381c4c;}return null;})[_0x96c0('0x24')](respondWithResult(_0x25f07c,null))[_0x96c0('0x2f')](handleError(_0x25f07c,null));};exports[_0x96c0('0x31')]=function(_0x3acd88,_0xe58c53,_0x4272a3){if(_0x3acd88['body']['id']){delete _0x3acd88[_0x96c0('0x5d')]['id'];}var _0x17daf5;return db[_0x96c0('0x43')]['find']({'where':{'id':_0x3acd88[_0x96c0('0x5e')]['id']}})['then'](handleEntityNotFound(_0xe58c53,null))[_0x96c0('0x24')](function(_0x5d5a8b){if(_0x5d5a8b){_0x17daf5=_0x5d5a8b;return db[_0x96c0('0x8a')][_0x96c0('0x5b')]({'where':{'id':_0x5d5a8b[_0x96c0('0x8b')]}});}})['then'](handleEntityNotFound(_0xe58c53,null))[_0x96c0('0x24')](function(_0x26f3a0){if(_0x26f3a0){logger[_0x96c0('0x27')](_0x96c0('0x8c'),_0x96c0('0x31'),_0x96c0('0x8d'),_0x26f3a0['type'],util[_0x96c0('0x8e')](_0x3acd88[_0x96c0('0x5d')],{'showHidden':![],'depth':null}));switch(_0x26f3a0[_0x96c0('0x45')]){case _0x96c0('0x8f'):if(_0x3acd88[_0x96c0('0x5d')][_0x96c0('0x90')]&&_0x3acd88[_0x96c0('0x5d')][_0x96c0('0x90')]===_0x17daf5[_0x96c0('0x91')]&&_0x3acd88['body'][_0x96c0('0x92')]&&_0x3acd88[_0x96c0('0x5d')]['MessageStatus']==='read'){return _0x17daf5[_0x96c0('0x3c')]({'read':!![]});}else{logger[_0x96c0('0x2a')](_0x96c0('0x93'),_0x96c0('0x31'),_0x96c0('0x8f'),util[_0x96c0('0x8e')](_0x3acd88[_0x96c0('0x5d')],{'showHidden':![],'depth':null}));}break;}return _0x17daf5;}})['then'](respondWithResult(_0xe58c53,null))['catch'](handleError(_0xe58c53,null));}; \ No newline at end of file +var _0xb5db=['agent','fullname','email','interface','SIP/%s','channel','motionChannel','event','accept','EventManager','acceptmessage','reject','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','Sequelize','internal','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','twilio','inspect','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./whatsappMessage.socket','register','client','http','request','then','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','save','destroy','name','send','map','WhatsappMessage','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','rawAttributes','keys','find','create','body','update','params','describe','../../config/logger','whatsapp-interactions','whatsapp','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','format','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','contact','User'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xb5db,0xaa));var _0xbb5d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb5db[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbb5d('0x0'));var zipdir=require(_0xbb5d('0x1'));var jsonpatch=require(_0xbb5d('0x2'));var rp=require(_0xbb5d('0x3'));var moment=require(_0xbb5d('0x4'));var BPromise=require(_0xbb5d('0x5'));var Mustache=require(_0xbb5d('0x6'));var util=require('util');var path=require(_0xbb5d('0x7'));var sox=require(_0xbb5d('0x8'));var csv=require(_0xbb5d('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbb5d('0xa'));var _=require(_0xbb5d('0xb'));var squel=require('squel');var crypto=require(_0xbb5d('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xbb5d('0xd'));var toCsv=require(_0xbb5d('0x9'));var querystring=require(_0xbb5d('0xe'));var Papa=require(_0xbb5d('0xf'));var Redis=require(_0xbb5d('0x10'));var authService=require(_0xbb5d('0x11'));var qs=require(_0xbb5d('0x12'));var as=require(_0xbb5d('0x13'));var hardwareService=require(_0xbb5d('0x14'));var logger=require('../../config/logger')(_0xbb5d('0x15'));var utils=require('../../config/utils');var config=require(_0xbb5d('0x16'));var licenseUtil=require(_0xbb5d('0x17'));var db=require(_0xbb5d('0x18'))['db'];config[_0xbb5d('0x19')]=_['defaults'](config[_0xbb5d('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xbb5d('0x1a'))(new Redis(config[_0xbb5d('0x19')]));require(_0xbb5d('0x1b'))[_0xbb5d('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson[_0xbb5d('0x1d')]['http']({'port':0x232c});var client9002=jayson[_0xbb5d('0x1d')][_0xbb5d('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x5196b0,_0x5f2206,_0x48cea0,_0x2cc866){return new BPromise(function(_0x19ea85,_0x56de0b){var _0x262cc5=_0x2cc866||client;return _0x262cc5[_0xbb5d('0x1f')](_0x5196b0,_0x48cea0)[_0xbb5d('0x20')](function(_0x238e83){logger['info'](_0xbb5d('0x21'),_0x5f2206,_0xbb5d('0x22'));logger[_0xbb5d('0x23')](_0xbb5d('0x24'),_0x5f2206,'request\x20sent',JSON[_0xbb5d('0x25')](_0x238e83));if(_0x238e83[_0xbb5d('0x26')]){if(_0x238e83[_0xbb5d('0x26')][_0xbb5d('0x27')]===0x1f4){logger[_0xbb5d('0x26')](_0xbb5d('0x21'),_0x5f2206,_0x238e83[_0xbb5d('0x26')][_0xbb5d('0x28')]);return _0x56de0b(_0x238e83[_0xbb5d('0x26')][_0xbb5d('0x28')]);}logger['error'](_0xbb5d('0x21'),_0x5f2206,_0x238e83[_0xbb5d('0x26')][_0xbb5d('0x28')]);return _0x19ea85(_0x238e83[_0xbb5d('0x26')][_0xbb5d('0x28')]);}else{logger[_0xbb5d('0x29')]('WhatsappMessage,\x20%s,\x20%s',_0x5f2206,_0xbb5d('0x22'));_0x19ea85(_0x238e83[_0xbb5d('0x2a')][_0xbb5d('0x28')]);}})['catch'](function(_0x3fe963){logger['error'](_0xbb5d('0x21'),_0x5f2206,_0x3fe963);_0x56de0b(_0x3fe963);});});}function respondWithStatusCode(_0x559651,_0x4d8077){_0x4d8077=_0x4d8077||0xcc;return function(_0x2318d4){if(_0x2318d4){return _0x559651['sendStatus'](_0x4d8077);}return _0x559651[_0xbb5d('0x2b')](_0x4d8077)[_0xbb5d('0x2c')]();};}function respondWithResult(_0x176d4c,_0x27f6da){_0x27f6da=_0x27f6da||0xc8;return function(_0x372c3a){if(_0x372c3a){return _0x176d4c[_0xbb5d('0x2b')](_0x27f6da)['json'](_0x372c3a);}};}function respondWithFilteredResult(_0x425ec2,_0x2bdc53){return function(_0x527e99){if(_0x527e99){var _0xa098f1=typeof _0x2bdc53['offset']===_0xbb5d('0x2d')&&typeof _0x2bdc53[_0xbb5d('0x2e')]===_0xbb5d('0x2d');var _0x3ec514=_0x527e99[_0xbb5d('0x2f')];var _0x810e7e=_0xa098f1?0x0:_0x2bdc53[_0xbb5d('0x30')];var _0x585e3a=_0xa098f1?_0x527e99[_0xbb5d('0x2f')]:_0x2bdc53['offset']+_0x2bdc53['limit'];var _0x1039c1;if(_0x585e3a>=_0x3ec514){_0x585e3a=_0x3ec514;_0x1039c1=0xc8;}else{_0x1039c1=0xce;}_0x425ec2[_0xbb5d('0x2b')](_0x1039c1);return _0x425ec2[_0xbb5d('0x31')](_0xbb5d('0x32'),_0x810e7e+'-'+_0x585e3a+'/'+_0x3ec514)[_0xbb5d('0x33')](_0x527e99);}return null;};}function patchUpdates(_0x13824e){return function(_0x4d348f){try{jsonpatch[_0xbb5d('0x34')](_0x4d348f,_0x13824e,!![]);}catch(_0x237267){return BPromise['reject'](_0x237267);}return _0x4d348f[_0xbb5d('0x35')]();};}function saveUpdates(_0x169689,_0x1dff54){return function(_0x59fe92){if(_0x59fe92){return _0x59fe92['update'](_0x169689)[_0xbb5d('0x20')](function(_0xd9b197){return _0xd9b197;});}return null;};}function removeEntity(_0x671b2,_0x102eac){return function(_0x22ad94){if(_0x22ad94){return _0x22ad94[_0xbb5d('0x36')]()['then'](function(){_0x671b2[_0xbb5d('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x55b4ae,_0x1486a5){return function(_0x47affc){if(!_0x47affc){_0x55b4ae['sendStatus'](0x194);}return _0x47affc;};}function handleError(_0x31eac8,_0x5a8aee){_0x5a8aee=_0x5a8aee||0x1f4;return function(_0x4c40be){logger['error'](_0x4c40be['stack']);if(_0x4c40be['name']){delete _0x4c40be[_0xbb5d('0x37')];}_0x31eac8[_0xbb5d('0x2b')](_0x5a8aee)[_0xbb5d('0x38')](_0x4c40be);};}exports['index']=function(_0x1f00dd,_0x4d19a0){var _0x17327a={},_0x2e1f91={},_0x586eab={'count':0x0,'rows':[]};var _0x3f4912=_[_0xbb5d('0x39')](db[_0xbb5d('0x3a')]['rawAttributes'],function(_0x3f6dcf){return{'name':_0x3f6dcf[_0xbb5d('0x3b')],'type':_0x3f6dcf[_0xbb5d('0x3c')][_0xbb5d('0x3d')]};});_0x2e1f91[_0xbb5d('0x3e')]=_[_0xbb5d('0x39')](_0x3f4912,_0xbb5d('0x37'));_0x2e1f91[_0xbb5d('0x3f')]=_['keys'](_0x1f00dd[_0xbb5d('0x3f')]);_0x2e1f91[_0xbb5d('0x40')]=_[_0xbb5d('0x41')](_0x2e1f91['model'],_0x2e1f91[_0xbb5d('0x3f')]);_0x17327a[_0xbb5d('0x42')]=_[_0xbb5d('0x41')](_0x2e1f91['model'],qs[_0xbb5d('0x43')](_0x1f00dd[_0xbb5d('0x3f')][_0xbb5d('0x43')]));_0x17327a[_0xbb5d('0x42')]=_0x17327a[_0xbb5d('0x42')][_0xbb5d('0x44')]?_0x17327a[_0xbb5d('0x42')]:_0x2e1f91[_0xbb5d('0x3e')];if(!_0x1f00dd[_0xbb5d('0x3f')][_0xbb5d('0x45')](_0xbb5d('0x46'))){_0x17327a[_0xbb5d('0x2e')]=qs[_0xbb5d('0x2e')](_0x1f00dd[_0xbb5d('0x3f')][_0xbb5d('0x2e')]);_0x17327a['offset']=qs[_0xbb5d('0x30')](_0x1f00dd[_0xbb5d('0x3f')][_0xbb5d('0x30')]);}_0x17327a['order']=qs[_0xbb5d('0x47')](_0x1f00dd[_0xbb5d('0x3f')]['sort']);_0x17327a[_0xbb5d('0x48')]=qs['filters'](_['pick'](_0x1f00dd[_0xbb5d('0x3f')],_0x2e1f91['filters']),_0x3f4912);if(_0x1f00dd[_0xbb5d('0x3f')][_0xbb5d('0x49')]){_0x17327a['where']=_[_0xbb5d('0x4a')](_0x17327a[_0xbb5d('0x48')],{'$or':_['map'](_0x3f4912,function(_0xd6e49d){if(_0xd6e49d['type']!==_0xbb5d('0x4b')){var _0x5d1917={};_0x5d1917[_0xd6e49d['name']]={'$like':'%'+_0x1f00dd[_0xbb5d('0x3f')]['filter']+'%'};return _0x5d1917;}})});}_0x17327a=_[_0xbb5d('0x4a')]({},_0x17327a,_0x1f00dd[_0xbb5d('0x4c')]);var _0x19c5f7={'where':_0x17327a[_0xbb5d('0x48')]};return db[_0xbb5d('0x3a')][_0xbb5d('0x2f')](_0x19c5f7)[_0xbb5d('0x20')](function(_0x268f48){_0x586eab[_0xbb5d('0x2f')]=_0x268f48;if(_0x1f00dd[_0xbb5d('0x3f')][_0xbb5d('0x4d')]){_0x17327a[_0xbb5d('0x4e')]=[{'all':!![]}];}return db[_0xbb5d('0x3a')][_0xbb5d('0x4f')](_0x17327a);})['then'](function(_0x19b4af){_0x586eab[_0xbb5d('0x50')]=_0x19b4af;return _0x586eab;})[_0xbb5d('0x20')](respondWithFilteredResult(_0x4d19a0,_0x17327a))[_0xbb5d('0x51')](handleError(_0x4d19a0,null));};exports[_0xbb5d('0x52')]=function(_0x257885,_0x42cc3d){var _0x1860ff={'raw':!![],'where':{'id':_0x257885['params']['id']}},_0x35dce6={};_0x35dce6['model']=_['keys'](db['WhatsappMessage'][_0xbb5d('0x53')]);_0x35dce6[_0xbb5d('0x3f')]=_[_0xbb5d('0x54')](_0x257885[_0xbb5d('0x3f')]);_0x35dce6[_0xbb5d('0x40')]=_['intersection'](_0x35dce6[_0xbb5d('0x3e')],_0x35dce6[_0xbb5d('0x3f')]);_0x1860ff[_0xbb5d('0x42')]=_[_0xbb5d('0x41')](_0x35dce6['model'],qs[_0xbb5d('0x43')](_0x257885[_0xbb5d('0x3f')][_0xbb5d('0x43')]));_0x1860ff[_0xbb5d('0x42')]=_0x1860ff['attributes'][_0xbb5d('0x44')]?_0x1860ff[_0xbb5d('0x42')]:_0x35dce6[_0xbb5d('0x3e')];if(_0x257885[_0xbb5d('0x3f')][_0xbb5d('0x4d')]){_0x1860ff[_0xbb5d('0x4e')]=[{'all':!![]}];}_0x1860ff=_[_0xbb5d('0x4a')]({},_0x1860ff,_0x257885['options']);return db['WhatsappMessage'][_0xbb5d('0x55')](_0x1860ff)[_0xbb5d('0x20')](handleEntityNotFound(_0x42cc3d,null))[_0xbb5d('0x20')](respondWithResult(_0x42cc3d,null))['catch'](handleError(_0x42cc3d,null));};exports['create']=function(_0x4c8f95,_0x51caec){return db[_0xbb5d('0x3a')][_0xbb5d('0x56')](_0x4c8f95[_0xbb5d('0x57')],{})[_0xbb5d('0x20')](respondWithResult(_0x51caec,0xc9))[_0xbb5d('0x51')](handleError(_0x51caec,null));};exports[_0xbb5d('0x58')]=function(_0x37b299,_0x16e948){if(_0x37b299[_0xbb5d('0x57')]['id']){delete _0x37b299[_0xbb5d('0x57')]['id'];}return db['WhatsappMessage']['find']({'where':{'id':_0x37b299[_0xbb5d('0x59')]['id']}})[_0xbb5d('0x20')](handleEntityNotFound(_0x16e948,null))['then'](saveUpdates(_0x37b299[_0xbb5d('0x57')],null))['then'](respondWithResult(_0x16e948,null))[_0xbb5d('0x51')](handleError(_0x16e948,null));};exports[_0xbb5d('0x36')]=function(_0x29732d,_0x47d87d){return db[_0xbb5d('0x3a')][_0xbb5d('0x55')]({'where':{'id':_0x29732d[_0xbb5d('0x59')]['id']}})[_0xbb5d('0x20')](handleEntityNotFound(_0x47d87d,null))[_0xbb5d('0x20')](removeEntity(_0x47d87d,null))[_0xbb5d('0x51')](handleError(_0x47d87d,null));};exports[_0xbb5d('0x5a')]=function(_0x2b4d53,_0x46a9d5){return db[_0xbb5d('0x3a')]['describe']()[_0xbb5d('0x20')](respondWithResult(_0x46a9d5,null))[_0xbb5d('0x51')](handleError(_0x46a9d5,null));};var interaction_log=require(_0xbb5d('0x5b'))(_0xbb5d('0x5c'));exports['accept']=function(_0x19d293,_0x55a452,_0x330a0e){var _0x4914d7={'agent':{},'channel':_0xbb5d('0x5d')};if(_0x19d293[_0xbb5d('0x57')]['id']){delete _0x19d293['body']['id'];}_0x19d293[_0xbb5d('0x57')][_0xbb5d('0x5e')]=!![];_0x19d293[_0xbb5d('0x57')][_0xbb5d('0x5f')]=moment()['format'](_0xbb5d('0x60'));_0x19d293['body'][_0xbb5d('0x61')]=_0x19d293[_0xbb5d('0x57')][_0xbb5d('0x61')]||_0x19d293[_0xbb5d('0x62')]['id'];_0x4914d7['agent']['id']=_0x19d293[_0xbb5d('0x57')][_0xbb5d('0x61')];return db[_0xbb5d('0x3a')][_0xbb5d('0x55')]({'where':{'id':_0x19d293['params']['id'],'UserId':null}})[_0xbb5d('0x20')](handleEntityNotFound(_0x55a452,null))[_0xbb5d('0x20')](saveUpdates(_0x19d293[_0xbb5d('0x57')],null))['then'](function(_0x4e760b){if(_0x4e760b){_0x4914d7['message']=_0x4e760b[_0xbb5d('0x63')]({'plain':!![]});return db[_0xbb5d('0x64')][_0xbb5d('0x55')]({'where':{'id':_0x4e760b[_0xbb5d('0x65')]}});}return null;})[_0xbb5d('0x20')](handleEntityNotFound(_0x55a452,null))[_0xbb5d('0x20')](function(_0x1f80f1){if(_0x1f80f1){return _0x1f80f1[_0xbb5d('0x58')]({'UserId':_0x19d293[_0xbb5d('0x57')][_0xbb5d('0x61')],'read1stAt':_[_0xbb5d('0x66')](_0x1f80f1[_0xbb5d('0x67')])?moment()[_0xbb5d('0x68')](_0xbb5d('0x60')):undefined});}return null;})['then'](function(_0x4e81f1){if(_0x4e81f1){_0x4914d7['interaction']=_0x4e81f1[_0xbb5d('0x63')]({'plain':!![]});interaction_log['info'](_0xbb5d('0x69'),_0x19d293[_0xbb5d('0x62')]['id'],_0x19d293[_0xbb5d('0x62')][_0xbb5d('0x37')],_0x19d293['user'][_0xbb5d('0x6a')],_0x4914d7[_0xbb5d('0x6b')]['id'],_0x19d293[_0xbb5d('0x57')]?JSON[_0xbb5d('0x25')](_0x19d293['body']):_0xbb5d('0x6c'));return respondWithRpcPromise(_0xbb5d('0x6d'),_0xbb5d('0x6e'),_0x4914d7);}return null;})[_0xbb5d('0x20')](function(_0x110d7f){var _0x1cbeb0=_0xbb5d('0x6f')+_0x110d7f['message'][_0xbb5d('0x70')];return db[_0xbb5d('0x71')]['query'](_0x1cbeb0,{'type':db['Sequelize'][_0xbb5d('0x72')][_0xbb5d('0x73')],'raw':!![]})['then'](function(_0xca9015){return _0xca9015;});})['then'](function(_0x4b9e2a){if(_0x4b9e2a){_0x4914d7[_0xbb5d('0x28')][_0xbb5d('0x74')]=_0x4b9e2a[0x0];if(!_0x19d293[_0xbb5d('0x57')][_0xbb5d('0x61')])return;return db[_0xbb5d('0x75')]['find']({'where':{'id':_0x19d293['body'][_0xbb5d('0x61')],'role':_0xbb5d('0x76')},'attributes':['id',_0xbb5d('0x37'),_0xbb5d('0x77'),_0xbb5d('0x78'),'internal'],'raw':!![]});}return null;})[_0xbb5d('0x20')](function(_0x192f34){if(!_0x192f34)return null;_0x4914d7[_0xbb5d('0x28')][_0xbb5d('0x76')]=_0x192f34;return _0x4914d7;})[_0xbb5d('0x20')](function(_0x45f3b2){if(_0x45f3b2){if(_0x19d293[_0xbb5d('0x57')]['manual']){_0x4914d7[_0xbb5d('0x28')][_0xbb5d('0x79')]=util[_0xbb5d('0x68')](_0xbb5d('0x7a'),_0x19d293['user'][_0xbb5d('0x37')]);_0x4914d7[_0xbb5d('0x28')][_0xbb5d('0x7b')]=_0x4914d7[_0xbb5d('0x7b')];_0x4914d7[_0xbb5d('0x28')][_0xbb5d('0x7c')]=_0x4914d7[_0xbb5d('0x7b')];_0x4914d7['message'][_0xbb5d('0x7d')]=_0xbb5d('0x7e');return respondWithRpcPromise(_0xbb5d('0x7f'),'EventManager',{'event':_0xbb5d('0x80'),'message':_0x4914d7['message']},client9002)['then'](function(){return _0x4914d7;});}return _0x4914d7;}return null;})['then'](respondWithResult(_0x55a452,null))['catch'](handleError(_0x55a452,null));};var interaction_log=require('../../config/logger')(_0xbb5d('0x5c'));exports[_0xbb5d('0x81')]=function(_0x308a3e,_0x1b40a0,_0x1980b3){var _0x5385da={'agent':{},'channel':_0xbb5d('0x5d')};if(_0x308a3e[_0xbb5d('0x57')]['id']){delete _0x308a3e[_0xbb5d('0x57')]['id'];}_0x308a3e['body'][_0xbb5d('0x61')]=_0x308a3e[_0xbb5d('0x57')][_0xbb5d('0x61')]||_0x308a3e['user']['id'];_0x5385da[_0xbb5d('0x76')]['id']=_0x308a3e[_0xbb5d('0x57')][_0xbb5d('0x61')];return db[_0xbb5d('0x3a')][_0xbb5d('0x55')]({'where':{'id':_0x308a3e[_0xbb5d('0x59')]['id'],'UserId':null}})[_0xbb5d('0x20')](handleEntityNotFound(_0x1b40a0,null))['then'](function(_0x4a18eb){if(_0x4a18eb){_0x5385da[_0xbb5d('0x28')]=_0x4a18eb[_0xbb5d('0x63')]({'plain':!![]});return db['WhatsappInteraction'][_0xbb5d('0x55')]({'where':{'id':_0x4a18eb[_0xbb5d('0x65')]}});}return null;})['then'](handleEntityNotFound(_0x1b40a0,null))['then'](function(_0x21703c){if(_0x21703c){_0x5385da[_0xbb5d('0x6b')]=_0x21703c[_0xbb5d('0x63')]({'plain':!![]});interaction_log['info'](_0xbb5d('0x82'),_0x308a3e[_0xbb5d('0x62')]['id'],_0x308a3e[_0xbb5d('0x62')][_0xbb5d('0x37')],_0x308a3e[_0xbb5d('0x62')][_0xbb5d('0x6a')],_0x5385da[_0xbb5d('0x6b')]['id'],_0x308a3e[_0xbb5d('0x57')]?JSON[_0xbb5d('0x25')](_0x308a3e[_0xbb5d('0x57')]):_0xbb5d('0x6c'));return respondWithRpcPromise(_0xbb5d('0x83'),_0xbb5d('0x84'),_0x5385da);}return null;})['then'](function(_0x131ac4){var _0x34efb9=_0xbb5d('0x6f')+_0x131ac4[_0xbb5d('0x28')]['ContactId'];return db[_0xbb5d('0x71')][_0xbb5d('0x3f')](_0x34efb9,{'type':db[_0xbb5d('0x85')][_0xbb5d('0x72')][_0xbb5d('0x73')],'raw':!![]})[_0xbb5d('0x20')](function(_0xc76227){return _0xc76227;});})[_0xbb5d('0x20')](function(_0x341347){if(_0x341347){_0x5385da[_0xbb5d('0x28')][_0xbb5d('0x74')]=_0x341347[0x0];if(!_0x308a3e['body'][_0xbb5d('0x61')])return;return db[_0xbb5d('0x75')][_0xbb5d('0x55')]({'where':{'id':_0x308a3e[_0xbb5d('0x57')][_0xbb5d('0x61')],'role':_0xbb5d('0x76')},'attributes':['id',_0xbb5d('0x37'),_0xbb5d('0x77'),_0xbb5d('0x78'),_0xbb5d('0x86')],'raw':!![]});}return null;})[_0xbb5d('0x20')](function(_0x3b99df){if(!_0x3b99df)return null;_0x5385da[_0xbb5d('0x28')][_0xbb5d('0x76')]=_0x3b99df;return _0x5385da;})[_0xbb5d('0x20')](function(_0x42a101){if(_0x42a101){_0x42a101['message'][_0xbb5d('0x79')]=util['format']('SIP/%s',_0x308a3e[_0xbb5d('0x62')][_0xbb5d('0x37')]);_0x42a101[_0xbb5d('0x28')]['channel']=_0x5385da[_0xbb5d('0x7b')];_0x42a101[_0xbb5d('0x28')][_0xbb5d('0x7c')]=_0x5385da[_0xbb5d('0x7b')];_0x42a101[_0xbb5d('0x28')][_0xbb5d('0x7d')]='reject';respondWithRpcPromise(_0xbb5d('0x7f'),_0xbb5d('0x7f'),{'event':'rejectmessage','message':_0x42a101[_0xbb5d('0x28')]},client9002);return _0x5385da;}return null;})[_0xbb5d('0x20')](respondWithResult(_0x1b40a0,null))[_0xbb5d('0x51')](handleError(_0x1b40a0,null));};exports[_0xbb5d('0x2b')]=function(_0x1a94bc,_0x12e3ff,_0x18fd82){if(_0x1a94bc['body']['id']){delete _0x1a94bc[_0xbb5d('0x57')]['id'];}var _0x16e72b;return db[_0xbb5d('0x3a')][_0xbb5d('0x55')]({'where':{'id':_0x1a94bc[_0xbb5d('0x59')]['id']}})['then'](handleEntityNotFound(_0x12e3ff,null))[_0xbb5d('0x20')](function(_0x5e0dd5){if(_0x5e0dd5){_0x16e72b=_0x5e0dd5;return db['WhatsappAccount'][_0xbb5d('0x55')]({'where':{'id':_0x5e0dd5[_0xbb5d('0x87')]}});}})['then'](handleEntityNotFound(_0x12e3ff,null))[_0xbb5d('0x20')](function(_0xf451de){if(_0xf451de){logger[_0xbb5d('0x23')](_0xbb5d('0x88'),'status',_0xbb5d('0x89'),_0xf451de[_0xbb5d('0x3c')],util['inspect'](_0x1a94bc[_0xbb5d('0x57')],{'showHidden':![],'depth':null}));switch(_0xf451de[_0xbb5d('0x3c')]){case'twilio':if(_0x1a94bc[_0xbb5d('0x57')][_0xbb5d('0x8a')]&&_0x1a94bc['body'][_0xbb5d('0x8a')]===_0x16e72b[_0xbb5d('0x8b')]&&_0x1a94bc[_0xbb5d('0x57')][_0xbb5d('0x8c')]&&_0x1a94bc['body'][_0xbb5d('0x8c')]==='read'){return _0x16e72b[_0xbb5d('0x58')]({'read':!![]});}else{logger[_0xbb5d('0x26')](_0xbb5d('0x8d'),_0xbb5d('0x2b'),_0xbb5d('0x8e'),util[_0xbb5d('0x8f')](_0x1a94bc[_0xbb5d('0x57')],{'showHidden':![],'depth':null}));}break;}return _0x16e72b;}})[_0xbb5d('0x20')](respondWithResult(_0x12e3ff,null))[_0xbb5d('0x51')](handleError(_0x12e3ff,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index d772402..31096fd 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 _0x131e=['hasOwnProperty','hook','setMaxListeners','save','update','remove','emit'];(function(_0x302d0b,_0x2c7dbb){var _0x3b9e1d=function(_0x598beb){while(--_0x598beb){_0x302d0b['push'](_0x302d0b['shift']());}};_0x3b9e1d(++_0x2c7dbb);}(_0x131e,0x1ec));var _0xe131=function(_0x410e06,_0x191c0d){_0x410e06=_0x410e06-0x0;var _0xd159cd=_0x131e[_0x410e06];return _0xd159cd;};'use strict';var EventEmitter=require('events');var WhatsappMessage=require('../../mysqldb')['db']['WhatsappMessage'];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xe131('0x0')](0x0);var events={'afterCreate':_0xe131('0x1'),'afterUpdate':_0xe131('0x2'),'afterDestroy':_0xe131('0x3')};function emitEvent(_0x30486b){return function(_0x761c,_0x4ff7f7,_0x2fc440){WhatsappMessageEvents[_0xe131('0x4')](_0x30486b+':'+_0x761c['id'],_0x761c);WhatsappMessageEvents[_0xe131('0x4')](_0x30486b,_0x761c);_0x2fc440(null);};}for(var e in events){if(events[_0xe131('0x5')](e)){var event=events[e];WhatsappMessage[_0xe131('0x6')](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file +var _0x97c1=['../../mysqldb','setMaxListeners','remove','hasOwnProperty','hook','exports','events'];(function(_0x1745e7,_0x38e6c){var _0x10845e=function(_0x4970cc){while(--_0x4970cc){_0x1745e7['push'](_0x1745e7['shift']());}};_0x10845e(++_0x38e6c);}(_0x97c1,0xdf));var _0x197c=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x97c1[_0x21a9d9];return _0x46adce;};'use strict';var EventEmitter=require(_0x197c('0x0'));var WhatsappMessage=require(_0x197c('0x1'))['db']['WhatsappMessage'];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x197c('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x197c('0x3')};function emitEvent(_0xbb081d){return function(_0x26833e,_0x37ac05,_0x40863c){WhatsappMessageEvents['emit'](_0xbb081d+':'+_0x26833e['id'],_0x26833e);WhatsappMessageEvents['emit'](_0xbb081d,_0x26833e);_0x40863c(null);};}for(var e in events){if(events[_0x197c('0x4')](e)){var event=events[e];WhatsappMessage[_0x197c('0x5')](e,emitEvent(event));}}module[_0x197c('0x6')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 07ef6fd..92c92ca 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 _0x4ed4=['accountSid','authToken','messages','create','whatsapp:','phone','remote','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','sinch','baseUrl','/whatsapp/v1/','/messages/','text','Bearer\x20','application/json','statuses','message_id','err','finally','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','node-fetch','rimraf','./whatsappMessage.attributes','WhatsappMessage','messageId','fti_whatsapp_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','findOne','WhatsappInteractionId','then','update','createdAt','catch','error','WhatsappAccount','find','WhatsappAccountId','type','twilio'];(function(_0x5c883c,_0x513ad1){var _0xfe7d27=function(_0x3bc06e){while(--_0x3bc06e){_0x5c883c['push'](_0x5c883c['shift']());}};_0xfe7d27(++_0x513ad1);}(_0x4ed4,0xbf));var _0x44ed=function(_0x392dae,_0x28fabc){_0x392dae=_0x392dae-0x0;var _0x340750=_0x4ed4[_0x392dae];return _0x340750;};'use strict';var _=require('lodash');var util=require(_0x44ed('0x0'));var logger=require(_0x44ed('0x1'))(_0x44ed('0x2'));var moment=require(_0x44ed('0x3'));var BPromise=require(_0x44ed('0x4'));var rp=require(_0x44ed('0x5'));var fetch=require(_0x44ed('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x44ed('0x7'));var config=require('../../config/environment');var attributes=require(_0x44ed('0x8'));module['exports']=function(_0x438adf,_0x319878){return _0x438adf['define'](_0x44ed('0x9'),attributes,{'tableName':'whatsapp_messages','paranoid':![],'indexes':[{'name':_0x44ed('0xa'),'fields':['messageId']},{'name':_0x44ed('0xb'),'fields':[_0x44ed('0xc')],'type':_0x44ed('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x16283a,_0x57ef7c,_0x58819d){var _0x5b97f9=_0x438adf[_0x44ed('0xe')];var _0x2b2241=_0x16283a[_0x44ed('0xf')]({'plain':!![]});if(_0x2b2241[_0x44ed('0x10')][_0x44ed('0x11')]()==='in'||_0x2b2241[_0x44ed('0x10')]['toLowerCase']()===_0x44ed('0x12')&&!_0x2b2241[_0x44ed('0x13')]&&!_[_0x44ed('0x14')](_0x2b2241['UserId'])){_0x5b97f9['WhatsappInteraction'][_0x44ed('0x15')]({'where':{'id':_0x2b2241[_0x44ed('0x16')]}})[_0x44ed('0x17')](function(_0x1c8497){if(_0x1c8497){_0x1c8497[_0x44ed('0x18')]({'lastMsgAt':_0x2b2241[_0x44ed('0x19')],'lastMsgDirection':_0x2b2241[_0x44ed('0x10')][_0x44ed('0x11')]()});}})[_0x44ed('0x1a')](function(_0x56f9ac){console[_0x44ed('0x1b')](_0x56f9ac);});}if(_0x2b2241[_0x44ed('0x10')]===_0x44ed('0x12')&&!_0x2b2241[_0x44ed('0x13')]){var _0x1f6bb5;_0x5b97f9[_0x44ed('0x1c')][_0x44ed('0x1d')]({'where':{'id':_0x2b2241[_0x44ed('0x1e')]},'raw':!![]})[_0x44ed('0x17')](function(_0x14c526){_0x1f6bb5=_0x14c526;if(_0x1f6bb5&&_0x1f6bb5[_0x44ed('0x1f')]){switch(_0x1f6bb5['type']){case'twilio':var _0x4cd988=require(_0x44ed('0x20'));if(_0x1f6bb5[_0x44ed('0x21')]&&_0x1f6bb5[_0x44ed('0x22')]&&_0x1f6bb5['phone']){var _0x3c6d3f=new _0x4cd988(_0x1f6bb5[_0x44ed('0x21')],_0x1f6bb5[_0x44ed('0x22')]);_0x3c6d3f[_0x44ed('0x23')][_0x44ed('0x24')]({'body':_0x2b2241[_0x44ed('0xc')],'to':_0x44ed('0x25')+_0x2b2241[_0x44ed('0x26')],'from':_0x44ed('0x25')+_0x1f6bb5[_0x44ed('0x26')],'statusCallback':_0x1f6bb5[_0x44ed('0x27')]+'/api/whatsapp/messages/'+_0x2b2241['id']+'/status?token='+_0x1f6bb5['token']})['then'](function(_0x47d564){if(_0x47d564[_0x44ed('0x28')]){return _0x16283a[_0x44ed('0x18')]({'messageId':_0x47d564[_0x44ed('0x28')]});}})[_0x44ed('0x1a')](function(_0x5befef){logger['error'](_0x44ed('0x29'),'afterCreate','twilio',util['inspect'](_0x5befef,{'showHidden':![],'depth':null}));});}else{logger[_0x44ed('0x1b')](_0x44ed('0x29'),_0x44ed('0x2a'),_0x44ed('0x20'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0x44ed('0x2b'):var _0x5edd9a=_0x1f6bb5[_0x44ed('0x21')];var _0x8b120c=_0x1f6bb5[_0x44ed('0x22')];var _0x4495d1=_0x1f6bb5[_0x44ed('0x2c')]+_0x44ed('0x2d')+_0x5edd9a+_0x44ed('0x2e');var _0x271cad={'to':[_0x2b2241[_0x44ed('0x26')]],'message':{'type':_0x44ed('0x2f'),'text':_0x2b2241[_0x44ed('0xc')]}};var _0x255e0d={'method':'POST','uri':_0x4495d1,'headers':{'Authorization':_0x44ed('0x30')+_0x8b120c,'Content-Type':_0x44ed('0x31')},'body':_0x271cad,'json':!![]};rp(_0x255e0d)['then'](function(_0x3b14d4){if(_0x3b14d4[_0x44ed('0x32')][0x0][_0x44ed('0x33')]){return _0x16283a[_0x44ed('0x18')]({'messageId':_0x3b14d4[_0x44ed('0x32')][0x0][_0x44ed('0x33')]});}})[_0x44ed('0x1a')](function(_0x518ce4){logger[_0x44ed('0x34')]('WhatsappMessage,\x20%s',_0x518ce4);});break;}}})[_0x44ed('0x35')](function(){_0x58819d();});}else{_0x58819d();}}},'charset':_0x44ed('0x36'),'collate':_0x44ed('0x37')});}; \ No newline at end of file +var _0xc2de=['out','UserId','WhatsappInteraction','findOne','then','error','secret','WhatsappAccount','find','type','twilio','accountSid','authToken','phone','create','whatsapp:','remote','token','update','sid','catch','WhatsappMessage,\x20%s,\x20%s,\x20%s','inspect','sinch','baseUrl','/whatsapp/v1/','POST','Bearer\x20','application/json','statuses','message_id','err','WhatsappMessage,\x20%s','finally','util','../../config/logger','request-promise','node-fetch','path','rimraf','../../config/environment','exports','define','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','models','get','direction','toLowerCase'];(function(_0x48bb15,_0x2df9f8){var _0x584eb0=function(_0x22f00c){while(--_0x22f00c){_0x48bb15['push'](_0x48bb15['shift']());}};_0x584eb0(++_0x2df9f8);}(_0xc2de,0x18e));var _0xec2d=function(_0x3a0a3e,_0x4f3b6e){_0x3a0a3e=_0x3a0a3e-0x0;var _0x2ca634=_0xc2de[_0x3a0a3e];return _0x2ca634;};'use strict';var _=require('lodash');var util=require(_0xec2d('0x0'));var logger=require(_0xec2d('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xec2d('0x2'));var fetch=require(_0xec2d('0x3'));var fs=require('fs');var path=require(_0xec2d('0x4'));var rimraf=require(_0xec2d('0x5'));var config=require(_0xec2d('0x6'));var attributes=require('./whatsappMessage.attributes');module[_0xec2d('0x7')]=function(_0x4b7d61,_0x5e3299){return _0x4b7d61[_0xec2d('0x8')]('WhatsappMessage',attributes,{'tableName':_0xec2d('0x9'),'paranoid':![],'indexes':[{'name':_0xec2d('0xa'),'fields':[_0xec2d('0xa')]},{'name':_0xec2d('0xb'),'fields':[_0xec2d('0xc')],'type':_0xec2d('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5a5762,_0x2f6e1e,_0x32bc1e){var _0x1c8c01=_0x4b7d61[_0xec2d('0xe')];var _0x5abcb6=_0x5a5762[_0xec2d('0xf')]({'plain':!![]});if(_0x5abcb6[_0xec2d('0x10')][_0xec2d('0x11')]()==='in'||_0x5abcb6[_0xec2d('0x10')][_0xec2d('0x11')]()===_0xec2d('0x12')&&!_0x5abcb6['secret']&&!_['isNil'](_0x5abcb6[_0xec2d('0x13')])){_0x1c8c01[_0xec2d('0x14')][_0xec2d('0x15')]({'where':{'id':_0x5abcb6['WhatsappInteractionId']}})[_0xec2d('0x16')](function(_0x37fbd0){if(_0x37fbd0){_0x37fbd0['update']({'lastMsgAt':_0x5abcb6['createdAt'],'lastMsgDirection':_0x5abcb6[_0xec2d('0x10')][_0xec2d('0x11')]()});}})['catch'](function(_0xe5888b){console[_0xec2d('0x17')](_0xe5888b);});}if(_0x5abcb6[_0xec2d('0x10')]===_0xec2d('0x12')&&!_0x5abcb6[_0xec2d('0x18')]){var _0x471ae4;_0x1c8c01[_0xec2d('0x19')][_0xec2d('0x1a')]({'where':{'id':_0x5abcb6['WhatsappAccountId']},'raw':!![]})['then'](function(_0x5a593a){_0x471ae4=_0x5a593a;if(_0x471ae4&&_0x471ae4[_0xec2d('0x1b')]){switch(_0x471ae4[_0xec2d('0x1b')]){case _0xec2d('0x1c'):var _0x4ef545=require('twilio');if(_0x471ae4[_0xec2d('0x1d')]&&_0x471ae4[_0xec2d('0x1e')]&&_0x471ae4[_0xec2d('0x1f')]){var _0x466948=new _0x4ef545(_0x471ae4[_0xec2d('0x1d')],_0x471ae4['authToken']);_0x466948['messages'][_0xec2d('0x20')]({'body':_0x5abcb6[_0xec2d('0xc')],'to':_0xec2d('0x21')+_0x5abcb6[_0xec2d('0x1f')],'from':_0xec2d('0x21')+_0x471ae4['phone'],'statusCallback':_0x471ae4[_0xec2d('0x22')]+'/api/whatsapp/messages/'+_0x5abcb6['id']+'/status?token='+_0x471ae4[_0xec2d('0x23')]})['then'](function(_0x2fe500){if(_0x2fe500['sid']){return _0x5a5762[_0xec2d('0x24')]({'messageId':_0x2fe500[_0xec2d('0x25')]});}})[_0xec2d('0x26')](function(_0x1b11cd){logger[_0xec2d('0x17')](_0xec2d('0x27'),'afterCreate',_0xec2d('0x1c'),util[_0xec2d('0x28')](_0x1b11cd,{'showHidden':![],'depth':null}));});}else{logger[_0xec2d('0x17')]('WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','twilio','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0xec2d('0x29'):var _0x1ba9a5=_0x471ae4[_0xec2d('0x1d')];var _0x390631=_0x471ae4['authToken'];var _0x3805a2=_0x471ae4[_0xec2d('0x2a')]+_0xec2d('0x2b')+_0x1ba9a5+'/messages/';var _0x15defd={'to':[_0x5abcb6['phone']],'message':{'type':'text','text':_0x5abcb6[_0xec2d('0xc')]}};var _0x519568={'method':_0xec2d('0x2c'),'uri':_0x3805a2,'headers':{'Authorization':_0xec2d('0x2d')+_0x390631,'Content-Type':_0xec2d('0x2e')},'body':_0x15defd,'json':!![]};rp(_0x519568)['then'](function(_0x27de20){if(_0x27de20[_0xec2d('0x2f')][0x0][_0xec2d('0x30')]){return _0x5a5762['update']({'messageId':_0x27de20[_0xec2d('0x2f')][0x0][_0xec2d('0x30')]});}})[_0xec2d('0x26')](function(_0x3066f5){logger[_0xec2d('0x31')](_0xec2d('0x32'),_0x3066f5);});break;}}})[_0xec2d('0x33')](function(){_0x32bc1e();});}else{_0x32bc1e();}}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 5b4429b..bcc4092 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 _0x6a1f=['http','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateWhatsappMessage','WhatsappMessage','create','body','options','lodash','util','moment','bluebird','../../config/logger','../../config/environment','client'];(function(_0x1835c8,_0x46f0a3){var _0x26164b=function(_0x4170fb){while(--_0x4170fb){_0x1835c8['push'](_0x1835c8['shift']());}};_0x26164b(++_0x46f0a3);}(_0x6a1f,0x119));var _0xf6a1=function(_0x284afb,_0x59f428){_0x284afb=_0x284afb-0x0;var _0x41a471=_0x6a1f[_0x284afb];return _0x41a471;};'use strict';var _=require(_0xf6a1('0x0'));var util=require(_0xf6a1('0x1'));var moment=require(_0xf6a1('0x2'));var BPromise=require(_0xf6a1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf6a1('0x4'))('rpc');var config=require(_0xf6a1('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xf6a1('0x6')][_0xf6a1('0x7')]({'port':0x232a});config[_0xf6a1('0x8')]=_[_0xf6a1('0x9')](config['redis'],{'host':_0xf6a1('0xa'),'port':0x18eb});var socket=require(_0xf6a1('0xb'))(new Redis(config[_0xf6a1('0x8')]));require(_0xf6a1('0xc'))[_0xf6a1('0xd')](socket);function respondWithRpcPromise(_0x1acc48,_0x4ec830,_0x1669af){return new BPromise(function(_0x3a02d0,_0x41b157){return client[_0xf6a1('0xe')](_0x1acc48,_0x1669af)[_0xf6a1('0xf')](function(_0x1b0b32){logger[_0xf6a1('0x10')](_0xf6a1('0x11'),_0x4ec830,_0xf6a1('0x12'));logger[_0xf6a1('0x13')](_0xf6a1('0x14'),_0x4ec830,'request\x20sent',JSON[_0xf6a1('0x15')](_0x1b0b32));if(_0x1b0b32[_0xf6a1('0x16')]){if(_0x1b0b32[_0xf6a1('0x16')][_0xf6a1('0x17')]===0x1f4){logger['error'](_0xf6a1('0x11'),_0x4ec830,_0x1b0b32[_0xf6a1('0x16')][_0xf6a1('0x18')]);return _0x41b157(_0x1b0b32[_0xf6a1('0x16')][_0xf6a1('0x18')]);}logger[_0xf6a1('0x16')]('WhatsappMessage,\x20%s,\x20%s',_0x4ec830,_0x1b0b32['error'][_0xf6a1('0x18')]);return _0x3a02d0(_0x1b0b32['error'][_0xf6a1('0x18')]);}else{logger[_0xf6a1('0x10')](_0xf6a1('0x11'),_0x4ec830,_0xf6a1('0x12'));_0x3a02d0(_0x1b0b32[_0xf6a1('0x19')][_0xf6a1('0x18')]);}})[_0xf6a1('0x1a')](function(_0x57f9bf){logger[_0xf6a1('0x16')](_0xf6a1('0x11'),_0x4ec830,_0x57f9bf);_0x41b157(_0x57f9bf);});});}exports[_0xf6a1('0x1b')]=function(_0x4f1410){var _0x15d2db=this;return new Promise(function(_0x36a7bb,_0x5f43a6){return db[_0xf6a1('0x1c')][_0xf6a1('0x1d')](_0x4f1410[_0xf6a1('0x1e')],{'raw':_0x4f1410[_0xf6a1('0x1f')]?_0x4f1410[_0xf6a1('0x1f')]['raw']===undefined?!![]:![]:!![]})[_0xf6a1('0xf')](function(_0x340066){logger[_0xf6a1('0x10')](_0xf6a1('0x1b'),_0x4f1410);logger[_0xf6a1('0x13')](_0xf6a1('0x1b'),_0x4f1410,JSON['stringify'](_0x340066));_0x36a7bb(_0x340066);})[_0xf6a1('0x1a')](function(_0x50d4ea){logger[_0xf6a1('0x16')](_0xf6a1('0x1b'),_0x50d4ea[_0xf6a1('0x18')],_0x4f1410);_0x5f43a6(_0x15d2db[_0xf6a1('0x16')](0x1f4,_0x50d4ea['message']));});});}; \ No newline at end of file +var _0x18ab=['localhost','socket.io-emitter','./whatsappMessage.socket','register','request','then','info','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','WhatsappMessage,\x20%s,\x20%s','CreateWhatsappMessage','WhatsappMessage','create','body','options','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis'];(function(_0x4953da,_0x5adaca){var _0x2d3780=function(_0x458f36){while(--_0x458f36){_0x4953da['push'](_0x4953da['shift']());}};_0x2d3780(++_0x5adaca);}(_0x18ab,0xec));var _0xb18a=function(_0x52dc17,_0x49b82e){_0x52dc17=_0x52dc17-0x0;var _0x41fbb4=_0x18ab[_0x52dc17];return _0x41fbb4;};'use strict';var _=require(_0xb18a('0x0'));var util=require(_0xb18a('0x1'));var moment=require('moment');var BPromise=require(_0xb18a('0x2'));var rs=require(_0xb18a('0x3'));var fs=require('fs');var Redis=require(_0xb18a('0x4'));var db=require(_0xb18a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb18a('0x6'))(_0xb18a('0x7'));var config=require(_0xb18a('0x8'));var jayson=require(_0xb18a('0x9'));var client=jayson['client'][_0xb18a('0xa')]({'port':0x232a});config[_0xb18a('0xb')]=_['defaults'](config[_0xb18a('0xb')],{'host':_0xb18a('0xc'),'port':0x18eb});var socket=require(_0xb18a('0xd'))(new Redis(config[_0xb18a('0xb')]));require(_0xb18a('0xe'))[_0xb18a('0xf')](socket);function respondWithRpcPromise(_0x2ede67,_0x23cf00,_0x213432){return new BPromise(function(_0x1981aa,_0x1f664f){return client[_0xb18a('0x10')](_0x2ede67,_0x213432)[_0xb18a('0x11')](function(_0x252284){logger[_0xb18a('0x12')]('WhatsappMessage,\x20%s,\x20%s',_0x23cf00,_0xb18a('0x13'));logger['debug'](_0xb18a('0x14'),_0x23cf00,_0xb18a('0x13'),JSON[_0xb18a('0x15')](_0x252284));if(_0x252284[_0xb18a('0x16')]){if(_0x252284[_0xb18a('0x16')]['code']===0x1f4){logger[_0xb18a('0x16')]('WhatsappMessage,\x20%s,\x20%s',_0x23cf00,_0x252284['error']['message']);return _0x1f664f(_0x252284[_0xb18a('0x16')][_0xb18a('0x17')]);}logger[_0xb18a('0x16')]('WhatsappMessage,\x20%s,\x20%s',_0x23cf00,_0x252284[_0xb18a('0x16')][_0xb18a('0x17')]);return _0x1981aa(_0x252284[_0xb18a('0x16')]['message']);}else{logger[_0xb18a('0x12')]('WhatsappMessage,\x20%s,\x20%s',_0x23cf00,_0xb18a('0x13'));_0x1981aa(_0x252284['result']['message']);}})['catch'](function(_0x55e7eb){logger[_0xb18a('0x16')](_0xb18a('0x18'),_0x23cf00,_0x55e7eb);_0x1f664f(_0x55e7eb);});});}exports[_0xb18a('0x19')]=function(_0x10aa51){var _0x960ce6=this;return new Promise(function(_0x52731a,_0x53c1c4){return db[_0xb18a('0x1a')][_0xb18a('0x1b')](_0x10aa51[_0xb18a('0x1c')],{'raw':_0x10aa51['options']?_0x10aa51[_0xb18a('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0xb18a('0x11')](function(_0x5cc863){logger[_0xb18a('0x12')](_0xb18a('0x19'),_0x10aa51);logger['debug'](_0xb18a('0x19'),_0x10aa51,JSON[_0xb18a('0x15')](_0x5cc863));_0x52731a(_0x5cc863);})[_0xb18a('0x1e')](function(_0x243918){logger['error'](_0xb18a('0x19'),_0x243918[_0xb18a('0x17')],_0x10aa51);_0x53c1c4(_0x960ce6[_0xb18a('0x16')](0x1f4,_0x243918[_0xb18a('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index ad2f939..36d2f59 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 _0x3855=['removeListener','length','whatsappMessage:','./whatsappMessage.events','save','remove','emit'];(function(_0x14023c,_0x5c98a2){var _0x13ab69=function(_0x13028e){while(--_0x13028e){_0x14023c['push'](_0x14023c['shift']());}};_0x13ab69(++_0x5c98a2);}(_0x3855,0x1ed));var _0x5385=function(_0x44c12d,_0x2b7771){_0x44c12d=_0x44c12d-0x0;var _0x441880=_0x3855[_0x44c12d];return _0x441880;};'use strict';var WhatsappMessageEvents=require(_0x5385('0x0'));var events=[_0x5385('0x1'),_0x5385('0x2'),'update'];function createListener(_0x24a407,_0x22e711){return function(_0x20bbc1){_0x22e711[_0x5385('0x3')](_0x24a407,_0x20bbc1);};}function removeListener(_0xb3c5b0,_0x31a881){return function(){WhatsappMessageEvents[_0x5385('0x4')](_0xb3c5b0,_0x31a881);};}exports['register']=function(_0x26fbc1){for(var _0x1888c3=0x0,_0x540929=events[_0x5385('0x5')];_0x1888c3<_0x540929;_0x1888c3++){var _0x108362=events[_0x1888c3];var _0x228d29=createListener(_0x5385('0x6')+_0x108362,_0x26fbc1);WhatsappMessageEvents['on'](_0x108362,_0x228d29);}}; \ No newline at end of file +var _0x8936=['./whatsappMessage.events','save','update','emit','removeListener','register','whatsappMessage:'];(function(_0x163d8f,_0x168394){var _0x3f3c38=function(_0x17318e){while(--_0x17318e){_0x163d8f['push'](_0x163d8f['shift']());}};_0x3f3c38(++_0x168394);}(_0x8936,0x1c0));var _0x6893=function(_0x7ecc0,_0x3c5cc5){_0x7ecc0=_0x7ecc0-0x0;var _0x5d016b=_0x8936[_0x7ecc0];return _0x5d016b;};'use strict';var WhatsappMessageEvents=require(_0x6893('0x0'));var events=[_0x6893('0x1'),'remove',_0x6893('0x2')];function createListener(_0x1eeaf9,_0x2ee749){return function(_0x504a5){_0x2ee749[_0x6893('0x3')](_0x1eeaf9,_0x504a5);};}function removeListener(_0x3efeb2,_0x364a78){return function(){WhatsappMessageEvents[_0x6893('0x4')](_0x3efeb2,_0x364a78);};}exports[_0x6893('0x5')]=function(_0x891071){for(var _0x143415=0x0,_0x153982=events['length'];_0x143415<_0x153982;_0x143415++){var _0x5ea7b8=events[_0x143415];var _0x53533f=createListener(_0x6893('0x6')+_0x5ea7b8,_0x891071);WhatsappMessageEvents['on'](_0x5ea7b8,_0x53533f);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 42f8417..c446fca 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 _0xc824=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','isAuthenticated','index','get','/describe','show','/:id/members','getMembers','/:id/teams','getTeams','getAgents','post','create','addTeams','/:id/users','addAgents','/:id','update','delete','destroy','removeTeams','removeAgents','exports','multer'];(function(_0x51ce14,_0x5cd58b){var _0x301a2d=function(_0x85fdf){while(--_0x85fdf){_0x51ce14['push'](_0x51ce14['shift']());}};_0x301a2d(++_0x5cd58b);}(_0xc824,0xe6));var _0x4c82=function(_0x23b06b,_0x294859){_0x23b06b=_0x23b06b-0x0;var _0x26805e=_0xc824[_0x23b06b];return _0x26805e;};'use strict';var multer=require(_0x4c82('0x0'));var util=require(_0x4c82('0x1'));var path=require(_0x4c82('0x2'));var timeout=require(_0x4c82('0x3'));var express=require(_0x4c82('0x4'));var router=express[_0x4c82('0x5')]();var fs_extra=require(_0x4c82('0x6'));var auth=require(_0x4c82('0x7'));var interaction=require(_0x4c82('0x8'));var config=require(_0x4c82('0x9'));var controller=require(_0x4c82('0xa'));router['get']('/',auth[_0x4c82('0xb')](),controller[_0x4c82('0xc')]);router[_0x4c82('0xd')](_0x4c82('0xe'),auth[_0x4c82('0xb')](),controller['describe']);router['get']('/:id',auth[_0x4c82('0xb')](),controller[_0x4c82('0xf')]);router['get'](_0x4c82('0x10'),auth[_0x4c82('0xb')](),controller[_0x4c82('0x11')]);router[_0x4c82('0xd')](_0x4c82('0x12'),auth[_0x4c82('0xb')](),controller[_0x4c82('0x13')]);router['get']('/:id/users',auth[_0x4c82('0xb')](),controller[_0x4c82('0x14')]);router[_0x4c82('0x15')]('/',auth[_0x4c82('0xb')](),controller[_0x4c82('0x16')]);router[_0x4c82('0x15')](_0x4c82('0x12'),auth['isAuthenticated'](),controller[_0x4c82('0x17')]);router[_0x4c82('0x15')](_0x4c82('0x18'),auth['isAuthenticated'](),controller[_0x4c82('0x19')]);router['put'](_0x4c82('0x1a'),auth['isAuthenticated'](),controller[_0x4c82('0x1b')]);router[_0x4c82('0x1c')](_0x4c82('0x1a'),auth['isAuthenticated'](),controller[_0x4c82('0x1d')]);router[_0x4c82('0x1c')](_0x4c82('0x12'),auth['isAuthenticated'](),controller[_0x4c82('0x1e')]);router[_0x4c82('0x1c')](_0x4c82('0x18'),auth[_0x4c82('0xb')](),controller[_0x4c82('0x1f')]);module[_0x4c82('0x20')]=router; \ No newline at end of file +var _0xbba8=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappQueue.controller','isAuthenticated','get','/describe','/:id','show','getMembers','/:id/teams','getTeams','getAgents','post','create','addTeams','/:id/users','addAgents','put','update','delete','removeTeams','exports','path'];(function(_0x3a2fe5,_0x4f3adf){var _0x5aacd1=function(_0x329940){while(--_0x329940){_0x3a2fe5['push'](_0x3a2fe5['shift']());}};_0x5aacd1(++_0x4f3adf);}(_0xbba8,0x1da));var _0x8bba=function(_0x3185a8,_0xf4f8d5){_0x3185a8=_0x3185a8-0x0;var _0x4e8bd3=_0xbba8[_0x3185a8];return _0x4e8bd3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8bba('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8bba('0x1')]();var fs_extra=require(_0x8bba('0x2'));var auth=require(_0x8bba('0x3'));var interaction=require(_0x8bba('0x4'));var config=require('../../config/environment');var controller=require(_0x8bba('0x5'));router['get']('/',auth[_0x8bba('0x6')](),controller['index']);router[_0x8bba('0x7')](_0x8bba('0x8'),auth[_0x8bba('0x6')](),controller['describe']);router[_0x8bba('0x7')](_0x8bba('0x9'),auth[_0x8bba('0x6')](),controller[_0x8bba('0xa')]);router[_0x8bba('0x7')]('/:id/members',auth['isAuthenticated'](),controller[_0x8bba('0xb')]);router[_0x8bba('0x7')](_0x8bba('0xc'),auth[_0x8bba('0x6')](),controller[_0x8bba('0xd')]);router[_0x8bba('0x7')]('/:id/users',auth[_0x8bba('0x6')](),controller[_0x8bba('0xe')]);router[_0x8bba('0xf')]('/',auth[_0x8bba('0x6')](),controller[_0x8bba('0x10')]);router[_0x8bba('0xf')](_0x8bba('0xc'),auth[_0x8bba('0x6')](),controller[_0x8bba('0x11')]);router[_0x8bba('0xf')](_0x8bba('0x12'),auth[_0x8bba('0x6')](),controller[_0x8bba('0x13')]);router[_0x8bba('0x14')](_0x8bba('0x9'),auth['isAuthenticated'](),controller[_0x8bba('0x15')]);router[_0x8bba('0x16')](_0x8bba('0x9'),auth['isAuthenticated'](),controller['destroy']);router[_0x8bba('0x16')](_0x8bba('0xc'),auth[_0x8bba('0x6')](),controller[_0x8bba('0x17')]);router[_0x8bba('0x16')](_0x8bba('0x12'),auth[_0x8bba('0x6')](),controller['removeAgents']);module[_0x8bba('0x18')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index a46621f..414baed 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 _0x3164=['beepall','roundrobin','sequelize','exports','STRING','name','INTEGER','rrmemory'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3164,0x182));var _0x4316=function(_0x34f254,_0x2e31b4){_0x34f254=_0x34f254-0x0;var _0x31ea95=_0x3164[_0x34f254];return _0x31ea95;};'use strict';var Sequelize=require(_0x4316('0x0'));module[_0x4316('0x1')]={'name':{'type':Sequelize[_0x4316('0x2')],'unique':_0x4316('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x4316('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x4316('0x5'),_0x4316('0x6'),_0x4316('0x7'))},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3402=['name','INTEGER','beepall','roundrobin','sequelize','STRING'];(function(_0x528579,_0x199ff2){var _0x53f491=function(_0x527b78){while(--_0x527b78){_0x528579['push'](_0x528579['shift']());}};_0x53f491(++_0x199ff2);}(_0x3402,0x1f0));var _0x2340=function(_0x3be8a8,_0x2e2ce1){_0x3be8a8=_0x3be8a8-0x0;var _0x1aed30=_0x3402[_0x3be8a8];return _0x1aed30;};'use strict';var Sequelize=require(_0x2340('0x0'));module['exports']={'name':{'type':Sequelize[_0x2340('0x1')],'unique':_0x2340('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x2340('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0x2340('0x4'),_0x2340('0x5'))},'description':{'type':Sequelize[_0x2340('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 06855af..fcf5af0 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 _0xa283=['json','offset','undefined','count','limit','status','set','Content-Range','update','then','destroy','get','WhatsappQueues','UserProfileResource','error','stack','name','index','map','WhatsappQueue','fieldName','type','where','include','query','rows','show','params','model','rawAttributes','keys','filters','attributes','intersection','length','includeAll','merge','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserWhatsappQueue','fields','hasOwnProperty','nolimit','sort','pick','filter','findAll','User','findAndCountAll','UserId','agent','updatedAt','createdAt','format','%s/%s','SIP','whatsappPause','getTeams','findOne','Team','addTeams','ids','Agents','online','voicePause','sequelize','each','findOrCreate','forEach','emit','userWhatsappQueue:save','select','field','tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','compact','transaction','removeTeams','removeAgents','userWhatsappQueue:remove','addAgents','isArray','getAgents','order','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','sendStatus'];(function(_0x43aab6,_0x5cf1dd){var _0x5c31ce=function(_0x5a55a7){while(--_0x5a55a7){_0x43aab6['push'](_0x43aab6['shift']());}};_0x5c31ce(++_0x5cf1dd);}(_0xa283,0x6d));var _0x3a28=function(_0x5f58ad,_0x3a6cbd){_0x5f58ad=_0x5f58ad-0x0;var _0x2c20da=_0xa283[_0x5f58ad];return _0x2c20da;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require(_0x3a28('0x0'));var squel=require(_0x3a28('0x1'));var Redis=require(_0x3a28('0x2'));var qs=require(_0x3a28('0x3'));var logger=require(_0x3a28('0x4'))(_0x3a28('0x5'));var config=require(_0x3a28('0x6'));var db=require('../../mysqldb')['db'];config[_0x3a28('0x7')]=_[_0x3a28('0x8')](config[_0x3a28('0x7')],{'host':_0x3a28('0x9'),'port':0x18eb});var socket=require(_0x3a28('0xa'))(new Redis(config['redis']));require('./whatsappQueue.socket')[_0x3a28('0xb')](socket);function respondWithStatusCode(_0x2a1a01,_0x2ad508){_0x2ad508=_0x2ad508||0xcc;return function(_0x57536b){if(_0x57536b){return _0x2a1a01[_0x3a28('0xc')](_0x2ad508);}return _0x2a1a01['status'](_0x2ad508)['end']();};}function respondWithResult(_0x51c8f0,_0x1d5245){_0x1d5245=_0x1d5245||0xc8;return function(_0x316b08){if(_0x316b08){return _0x51c8f0['status'](_0x1d5245)[_0x3a28('0xd')](_0x316b08);}};}function respondWithFilteredResult(_0x16e64a,_0x79eec0){return function(_0x366365){if(_0x366365){var _0x50b4e0=typeof _0x79eec0[_0x3a28('0xe')]===_0x3a28('0xf')&&typeof _0x79eec0['limit']===_0x3a28('0xf');var _0x575fa1=_0x366365['count'];var _0x32f9a4=_0x50b4e0?0x0:_0x79eec0['offset'];var _0x280d3b=_0x50b4e0?_0x366365[_0x3a28('0x10')]:_0x79eec0['offset']+_0x79eec0[_0x3a28('0x11')];var _0x21af68;if(_0x280d3b>=_0x575fa1){_0x280d3b=_0x575fa1;_0x21af68=0xc8;}else{_0x21af68=0xce;}_0x16e64a[_0x3a28('0x12')](_0x21af68);return _0x16e64a[_0x3a28('0x13')](_0x3a28('0x14'),_0x32f9a4+'-'+_0x280d3b+'/'+_0x575fa1)[_0x3a28('0xd')](_0x366365);}return null;};}function saveUpdates(_0x3fff16){return function(_0x1d4eb6){if(_0x1d4eb6){return _0x1d4eb6[_0x3a28('0x15')](_0x3fff16)[_0x3a28('0x16')](function(_0xe39b66){return _0xe39b66;});}return null;};}function removeEntity(_0x2092c7){return function(_0x516383){if(_0x516383){return _0x516383[_0x3a28('0x17')]()[_0x3a28('0x16')](function(){var _0x133d02=_0x516383[_0x3a28('0x18')]({'plain':!![]});var _0x155212=_0x3a28('0x19');return db[_0x3a28('0x1a')][_0x3a28('0x17')]({'where':{'type':_0x155212,'resourceId':_0x133d02['id']}})[_0x3a28('0x16')](function(){return _0x516383;});})[_0x3a28('0x16')](function(){_0x2092c7['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5dbb02){return function(_0x54566d){if(!_0x54566d){_0x5dbb02[_0x3a28('0xc')](0x194);}return _0x54566d;};}function handleError(_0x4471b4,_0x3dda95){_0x3dda95=_0x3dda95||0x1f4;return function(_0x4c1e70){logger[_0x3a28('0x1b')](_0x4c1e70[_0x3a28('0x1c')]);if(_0x4c1e70[_0x3a28('0x1d')]){delete _0x4c1e70[_0x3a28('0x1d')];}_0x4471b4['status'](_0x3dda95)['send'](_0x4c1e70);};}exports[_0x3a28('0x1e')]=function(_0x12fbd0,_0x5d60dc){var _0x294d6e={};var _0x509b67={'count':0x0,'rows':[]};var _0x1c0734=_[_0x3a28('0x1f')](db[_0x3a28('0x20')]['rawAttributes'],function(_0x1d48b5){return{'name':_0x1d48b5[_0x3a28('0x21')],'type':_0x1d48b5[_0x3a28('0x22')]['key']};});_0x294d6e=qs['getOptions'](_0x1c0734,_0x12fbd0);var _0x252ff2={'where':_0x294d6e[_0x3a28('0x23')]};return db[_0x3a28('0x20')][_0x3a28('0x10')](_0x252ff2)[_0x3a28('0x16')](function(_0x976360){_0x509b67[_0x3a28('0x10')]=_0x976360;_0x294d6e[_0x3a28('0x24')]=qs[_0x3a28('0x24')](_0x12fbd0[_0x3a28('0x25')]);return db[_0x3a28('0x20')]['findAll'](_0x294d6e);})[_0x3a28('0x16')](function(_0x21caea){_0x509b67[_0x3a28('0x26')]=_0x21caea;return _0x509b67;})[_0x3a28('0x16')](respondWithFilteredResult(_0x5d60dc,_0x294d6e))['catch'](handleError(_0x5d60dc,null));};exports[_0x3a28('0x27')]=function(_0x475a24,_0x3a02aa){var _0x4efa2d={'raw':!![],'where':{'id':_0x475a24[_0x3a28('0x28')]['id']}},_0x2bc2db={};_0x2bc2db[_0x3a28('0x29')]=_['keys'](db['WhatsappQueue'][_0x3a28('0x2a')]);_0x2bc2db['query']=_[_0x3a28('0x2b')](_0x475a24[_0x3a28('0x25')]);_0x2bc2db[_0x3a28('0x2c')]=_['intersection'](_0x2bc2db[_0x3a28('0x29')],_0x2bc2db[_0x3a28('0x25')]);_0x4efa2d[_0x3a28('0x2d')]=_[_0x3a28('0x2e')](_0x2bc2db[_0x3a28('0x29')],qs['fields'](_0x475a24[_0x3a28('0x25')]['fields']));_0x4efa2d[_0x3a28('0x2d')]=_0x4efa2d['attributes'][_0x3a28('0x2f')]?_0x4efa2d[_0x3a28('0x2d')]:_0x2bc2db['model'];if(_0x475a24['query'][_0x3a28('0x30')]){_0x4efa2d[_0x3a28('0x24')]=[{'all':!![]}];}_0x4efa2d=_[_0x3a28('0x31')]({},_0x4efa2d,_0x475a24[_0x3a28('0x32')]);return db[_0x3a28('0x20')][_0x3a28('0x33')](_0x4efa2d)['then'](handleEntityNotFound(_0x3a02aa,null))['then'](respondWithResult(_0x3a02aa,null))['catch'](handleError(_0x3a02aa,null));};exports[_0x3a28('0x34')]=function(_0x3a2c2f,_0x2585e3){return db['WhatsappQueue']['create'](_0x3a2c2f[_0x3a28('0x35')],{})['then'](function(_0x22eada){var _0x348fb7=_0x3a2c2f[_0x3a28('0x36')][_0x3a28('0x18')]({'plain':!![]});if(!_0x348fb7)throw new Error(_0x3a28('0x37'));if(_0x348fb7[_0x3a28('0x38')]==='user'){var _0x2354fe=_0x22eada['get']({'plain':!![]});var _0x385461='WhatsappQueues';return db[_0x3a28('0x39')][_0x3a28('0x33')]({'where':{'name':_0x385461,'userProfileId':_0x348fb7['userProfileId']},'raw':!![]})[_0x3a28('0x16')](function(_0x3c2461){if(_0x3c2461&&_0x3c2461[_0x3a28('0x3a')]===0x0){return db[_0x3a28('0x1a')][_0x3a28('0x34')]({'name':_0x2354fe['name'],'resourceId':_0x2354fe['id'],'type':_0x3c2461[_0x3a28('0x1d')],'sectionId':_0x3c2461['id']},{})[_0x3a28('0x16')](function(){return _0x22eada;});}else{return _0x22eada;}})[_0x3a28('0x3b')](function(_0x4a27de){logger[_0x3a28('0x1b')](_0x3a28('0x3c'),_0x4a27de);throw _0x4a27de;});}return _0x22eada;})[_0x3a28('0x16')](respondWithResult(_0x2585e3,0xc9))[_0x3a28('0x3b')](handleError(_0x2585e3,null));};exports[_0x3a28('0x15')]=function(_0x1ddb5a,_0xc5aa3a){if(_0x1ddb5a[_0x3a28('0x35')]['id']){delete _0x1ddb5a[_0x3a28('0x35')]['id'];}return db[_0x3a28('0x20')]['find']({'where':{'id':_0x1ddb5a['params']['id']}})[_0x3a28('0x16')](handleEntityNotFound(_0xc5aa3a,null))['then'](saveUpdates(_0x1ddb5a[_0x3a28('0x35')],null))[_0x3a28('0x16')](respondWithResult(_0xc5aa3a,null))['catch'](handleError(_0xc5aa3a,null));};exports['destroy']=function(_0x409528,_0x48f7ce){return db[_0x3a28('0x20')][_0x3a28('0x33')]({'where':{'id':_0x409528['params']['id']}})[_0x3a28('0x16')](handleEntityNotFound(_0x48f7ce,null))[_0x3a28('0x16')](removeEntity(_0x48f7ce,null))[_0x3a28('0x3b')](handleError(_0x48f7ce,null));};exports[_0x3a28('0x3d')]=function(_0x3e2b58,_0x29695f){return db[_0x3a28('0x20')][_0x3a28('0x3d')]()[_0x3a28('0x16')](respondWithResult(_0x29695f,null))[_0x3a28('0x3b')](handleError(_0x29695f,null));};exports[_0x3a28('0x3e')]=function(_0x38770b,_0x5d3f4e){var _0x186d56={'raw':!![],'where':{}},_0x5fbafc={},_0x59461c;return db[_0x3a28('0x20')]['findOne']({'where':{'id':_0x38770b[_0x3a28('0x28')]['id']}})['then'](handleEntityNotFound(_0x5d3f4e,null))[_0x3a28('0x16')](function(_0x58e7aa){if(_0x58e7aa){_0x59461c=_0x58e7aa['get']({'plain':!![]});_0x5fbafc[_0x3a28('0x29')]=_[_0x3a28('0x2b')](db[_0x3a28('0x3f')][_0x3a28('0x2a')]);_0x5fbafc[_0x3a28('0x25')]=_[_0x3a28('0x2b')](_0x38770b[_0x3a28('0x25')]);_0x5fbafc['filters']=_[_0x3a28('0x2e')](_0x5fbafc[_0x3a28('0x29')],_0x5fbafc[_0x3a28('0x25')]);_0x186d56[_0x3a28('0x2d')]=_[_0x3a28('0x2e')](_0x5fbafc[_0x3a28('0x29')],qs['fields'](_0x38770b[_0x3a28('0x25')][_0x3a28('0x40')]));_0x186d56[_0x3a28('0x2d')]=_0x186d56[_0x3a28('0x2d')][_0x3a28('0x2f')]?_0x186d56[_0x3a28('0x2d')]:_0x5fbafc[_0x3a28('0x29')];if(!_0x38770b['query'][_0x3a28('0x41')](_0x3a28('0x42'))){_0x186d56[_0x3a28('0x11')]=qs[_0x3a28('0x11')](_0x38770b[_0x3a28('0x25')][_0x3a28('0x11')]);_0x186d56[_0x3a28('0xe')]=qs[_0x3a28('0xe')](_0x38770b[_0x3a28('0x25')][_0x3a28('0xe')]);}_0x186d56['order']=qs['sort'](_0x38770b['query'][_0x3a28('0x43')]);_0x186d56['where']=qs[_0x3a28('0x2c')](_[_0x3a28('0x44')](_0x38770b[_0x3a28('0x25')],_0x5fbafc[_0x3a28('0x2c')]));_0x186d56[_0x3a28('0x23')]['WhatsappQueueId']=_0x58e7aa['id'];if(_0x38770b['query'][_0x3a28('0x45')]){_0x186d56[_0x3a28('0x23')]=_[_0x3a28('0x31')](_0x186d56[_0x3a28('0x23')],{'$or':_[_0x3a28('0x1f')](_0x186d56[_0x3a28('0x2d')],function(_0x496c09){var _0x4b8d87={};_0x4b8d87[_0x496c09]={'$like':'%'+_0x38770b[_0x3a28('0x25')][_0x3a28('0x45')]+'%'};return _0x4b8d87;})});}_0x186d56=_['merge']({},_0x186d56,_0x38770b[_0x3a28('0x32')]);return db[_0x3a28('0x3f')][_0x3a28('0x46')](_0x186d56);}})[_0x3a28('0x16')](function(_0x1b38b3){if(_0x1b38b3){return db[_0x3a28('0x47')][_0x3a28('0x48')]({'where':{'id':_[_0x3a28('0x1f')](_0x1b38b3,_0x3a28('0x49')),'role':_0x3a28('0x4a')},'attributes':['id',_0x3a28('0x1d'),'whatsappPause',_0x3a28('0x4b'),_0x3a28('0x4c')]});}})[_0x3a28('0x16')](function(_0x4e303f){if(_0x4e303f){return{'count':_0x4e303f['count'],'rows':_[_0x3a28('0x1f')](_0x4e303f[_0x3a28('0x26')],function(_0x1d8705){return{'membername':_0x1d8705[_0x3a28('0x1d')],'UserId':_0x1d8705['id'],'queue_name':_0x59461c[_0x3a28('0x1d')],'WhatsappQueueId':_0x59461c['id'],'interface':util[_0x3a28('0x4d')](_0x3a28('0x4e'),_0x3a28('0x4f'),_0x1d8705['name']),'penalty':0x0,'paused':_0x1d8705[_0x3a28('0x50')],'createdAt':_0x1d8705[_0x3a28('0x4c')],'updatedAt':_0x1d8705[_0x3a28('0x4b')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x5d3f4e,_0x186d56))[_0x3a28('0x3b')](handleError(_0x5d3f4e,null));};exports[_0x3a28('0x51')]=function(_0x3842dc,_0x360e17){var _0x36481f={};var _0x168335={};var _0x3a749a;var _0xd1ce9a;return db[_0x3a28('0x20')][_0x3a28('0x52')]({'where':{'id':_0x3842dc['params']['id']}})['then'](handleEntityNotFound(_0x360e17,null))[_0x3a28('0x16')](function(_0x4a096a){if(_0x4a096a){_0x3a749a=_0x4a096a;_0x168335[_0x3a28('0x29')]=_['keys'](db[_0x3a28('0x53')]['rawAttributes']);_0x168335[_0x3a28('0x25')]=_[_0x3a28('0x2b')](_0x3842dc[_0x3a28('0x25')]);_0x168335[_0x3a28('0x2c')]=_[_0x3a28('0x2e')](_0x168335[_0x3a28('0x29')],_0x168335[_0x3a28('0x25')]);_0x36481f[_0x3a28('0x2d')]=_[_0x3a28('0x2e')](_0x168335[_0x3a28('0x29')],qs[_0x3a28('0x40')](_0x3842dc[_0x3a28('0x25')][_0x3a28('0x40')]));_0x36481f[_0x3a28('0x2d')]=_0x36481f[_0x3a28('0x2d')][_0x3a28('0x2f')]?_0x36481f[_0x3a28('0x2d')]:_0x168335[_0x3a28('0x29')];_0x36481f['order']=qs[_0x3a28('0x43')](_0x3842dc[_0x3a28('0x25')][_0x3a28('0x43')]);_0x36481f['where']=qs[_0x3a28('0x2c')](_[_0x3a28('0x44')](_0x3842dc[_0x3a28('0x25')],_0x168335[_0x3a28('0x2c')]));if(_0x3842dc[_0x3a28('0x25')][_0x3a28('0x45')]){_0x36481f['where']=_[_0x3a28('0x31')](_0x36481f['where'],{'$or':_[_0x3a28('0x1f')](_0x36481f[_0x3a28('0x2d')],function(_0x55787d){var _0x16fba4={};_0x16fba4[_0x55787d]={'$like':'%'+_0x3842dc[_0x3a28('0x25')][_0x3a28('0x45')]+'%'};return _0x16fba4;})});}_0x36481f=_[_0x3a28('0x31')]({},_0x36481f,_0x3842dc[_0x3a28('0x32')]);return _0x3a749a[_0x3a28('0x51')](_0x36481f);}})[_0x3a28('0x16')](function(_0x2396d4){if(_0x2396d4){_0xd1ce9a=_0x2396d4[_0x3a28('0x2f')];if(!_0x3842dc[_0x3a28('0x25')][_0x3a28('0x41')](_0x3a28('0x42'))){_0x36481f[_0x3a28('0x11')]=qs['limit'](_0x3842dc['query']['limit']);_0x36481f[_0x3a28('0xe')]=qs[_0x3a28('0xe')](_0x3842dc['query']['offset']);}return _0x3a749a[_0x3a28('0x51')](_0x36481f);}})[_0x3a28('0x16')](function(_0x976cec){if(_0x976cec){return _0x976cec?{'count':_0xd1ce9a,'rows':_0x976cec}:null;}})['then'](respondWithResult(_0x360e17,null))[_0x3a28('0x3b')](handleError(_0x360e17,null));};exports[_0x3a28('0x54')]=function(_0x3b6279,_0x585ad8){var _0x4438e5=_0x3b6279[_0x3a28('0x35')][_0x3a28('0x55')];return db[_0x3a28('0x53')][_0x3a28('0x46')]({'where':{'id':_0x4438e5},'attributes':['id'],'include':[{'model':db[_0x3a28('0x47')],'as':_0x3a28('0x56'),'attributes':['id',_0x3a28('0x1d'),_0x3a28('0x57'),_0x3a28('0x58'),'interface'],'raw':!![]}]})[_0x3a28('0x16')](function(_0x4ebbf3){if(_0x4ebbf3){var _0x139a12=_['flatMap'](_0x4ebbf3,function(_0x354996){var _0x26aa33=_0x354996[_0x3a28('0x18')]({'plain':!![]});return _0x26aa33[_0x3a28('0x56')];});return db[_0x3a28('0x20')][_0x3a28('0x33')]({'where':{'id':_0x3b6279[_0x3a28('0x28')]['id']}})[_0x3a28('0x16')](function(_0x515f2e){return db[_0x3a28('0x59')]['transaction'](function(_0x14519b){return _0x515f2e['addTeams'](_0x4438e5,{'transaction':_0x14519b})[_0x3a28('0x16')](function(){return BPromise[_0x3a28('0x5a')](_0x139a12,function(_0x9d457e){return db[_0x3a28('0x3f')][_0x3a28('0x5b')]({'where':{'UserId':_0x9d457e['id'],'WhatsappQueueId':_0x3b6279['params']['id']},'transaction':_0x14519b});});})[_0x3a28('0x16')](function(){_0x139a12[_0x3a28('0x5c')](function(_0x4db929){socket[_0x3a28('0x5d')](_0x3a28('0x5e'),{'UserId':_0x4db929['id'],'WhatsappQueueId':_0x515f2e['id']});});});});});}})['then'](respondWithStatusCode(_0x585ad8,null))[_0x3a28('0x3b')](handleError(_0x585ad8,null));};exports['removeTeams']=function(_0x51a414,_0x2e6c24){return db[_0x3a28('0x53')][_0x3a28('0x46')]({'where':{'id':_0x51a414[_0x3a28('0x25')][_0x3a28('0x55')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x3a28('0x56'),'attributes':['id'],'raw':!![]}]})[_0x3a28('0x16')](handleEntityNotFound(_0x2e6c24,null))[_0x3a28('0x16')](function(_0x5728be){var _0x295352=_['map'](_0x5728be,'id');var _0x31c63f=[];var _0x3a1faa=[];var _0x56c754=squel[_0x3a28('0x5f')]();_0x56c754[_0x3a28('0x60')](_0x3a28('0x61'))[_0x3a28('0x62')](_0x3a28('0x63'),'tq')[_0x3a28('0x64')](_0x3a28('0x65'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x3a28('0x66'),_0x51a414['params']['id']);for(var _0x38e72e=0x0;_0x38e72e<_0x5728be['length'];_0x38e72e+=0x1){let _0x5ad888=_0x5728be[_0x38e72e];for(var _0x2bfbe9=0x0;_0x2bfbe9<_0x5ad888[_0x3a28('0x56')][_0x3a28('0x2f')];_0x2bfbe9+=0x1){let _0x4566e2=_0x5ad888[_0x3a28('0x56')][_0x2bfbe9];var _0x570ea9=_0x56c754[_0x3a28('0x67')]();_0x570ea9[_0x3a28('0x23')](_0x3a28('0x68'),_0x4566e2['id']);_0x3a1faa[_0x3a28('0x69')](db['sequelize'][_0x3a28('0x25')](_0x570ea9[_0x3a28('0x6a')](),{'type':db[_0x3a28('0x59')][_0x3a28('0x6b')][_0x3a28('0x6c')]})[_0x3a28('0x16')](function(_0x47e207){if(_0x47e207[_0x3a28('0x2f')]===0x1){return _0x4566e2['id'];}else{var _0x102ab3=_[_0x3a28('0x6d')](_[_0x3a28('0x1f')](_0x47e207,_0x3a28('0x6e')),function(_0x5e6b68){return _[_0x3a28('0x6f')](_0x295352,_0x5e6b68);});if(_0x102ab3){return _0x4566e2['id'];}}}));}}return BPromise[_0x3a28('0x70')](_0x3a1faa)[_0x3a28('0x16')](function(_0x45c893){_0x31c63f=_(_0x31c63f)['union'](_0x45c893)[_0x3a28('0x71')]()['value']();return db[_0x3a28('0x20')][_0x3a28('0x33')]({'where':{'id':_0x51a414[_0x3a28('0x28')]['id']}})[_0x3a28('0x16')](function(_0xdc3edd){return db['sequelize'][_0x3a28('0x72')](function(_0x374075){return _0xdc3edd[_0x3a28('0x73')](_0x51a414[_0x3a28('0x25')]['ids'],{'transaction':_0x374075})['then'](function(){if(!_['isEmpty'](_0x31c63f)){return _0xdc3edd[_0x3a28('0x74')](_0x31c63f,{'transaction':_0x374075});}})[_0x3a28('0x16')](function(){_0x31c63f[_0x3a28('0x5c')](function(_0x3d6d32){socket[_0x3a28('0x5d')](_0x3a28('0x75'),{'UserId':_0x3d6d32,'WhatsappQueueId':_0xdc3edd['id']});});});});});});})[_0x3a28('0x16')](respondWithStatusCode(_0x2e6c24,null))['catch'](handleError(_0x2e6c24,null));};exports[_0x3a28('0x76')]=function(_0x4dda9f,_0x5d8e2d){return db[_0x3a28('0x20')][_0x3a28('0x33')]({'where':{'id':_0x4dda9f[_0x3a28('0x28')]['id']}})['then'](handleEntityNotFound(_0x5d8e2d,null))[_0x3a28('0x16')](function(_0x44220e){if(_0x44220e){return _0x44220e['addAgents'](_0x4dda9f[_0x3a28('0x35')][_0x3a28('0x55')],_['omit'](_0x4dda9f[_0x3a28('0x35')],[_0x3a28('0x55'),'id'])||{})['spread'](function(_0x58fdc0){for(var _0xf1d5df=0x0;_0xf1d5df<_0x4dda9f[_0x3a28('0x35')][_0x3a28('0x55')][_0x3a28('0x2f')];_0xf1d5df+=0x1){socket[_0x3a28('0x5d')](_0x3a28('0x5e'),{'UserId':Number(_0x4dda9f[_0x3a28('0x35')][_0x3a28('0x55')][_0xf1d5df]),'WhatsappQueueId':Number(_0x4dda9f[_0x3a28('0x28')]['id'])});}return _0x58fdc0;});}})[_0x3a28('0x16')](respondWithResult(_0x5d8e2d,null))['catch'](handleError(_0x5d8e2d,null));};exports[_0x3a28('0x74')]=function(_0x118420,_0x340a2d){return db[_0x3a28('0x20')][_0x3a28('0x33')]({'where':{'id':_0x118420[_0x3a28('0x28')]['id']}})[_0x3a28('0x16')](handleEntityNotFound(_0x340a2d,null))[_0x3a28('0x16')](function(_0x3da661){if(_0x3da661){return _0x3da661['removeAgents'](_0x118420[_0x3a28('0x25')][_0x3a28('0x55')])['then'](function(){if(_[_0x3a28('0x77')](_0x118420[_0x3a28('0x25')][_0x3a28('0x55')])){for(var _0x46b9d4=0x0;_0x46b9d4<_0x118420['query'][_0x3a28('0x55')][_0x3a28('0x2f')];_0x46b9d4+=0x1){socket['emit'](_0x3a28('0x75'),{'UserId':Number(_0x118420['query'][_0x3a28('0x55')][_0x46b9d4]),'WhatsappQueueId':Number(_0x118420['params']['id'])});}}else{socket['emit'](_0x3a28('0x75'),{'UserId':Number(_0x118420[_0x3a28('0x25')][_0x3a28('0x55')]),'WhatsappQueueId':Number(_0x118420[_0x3a28('0x28')]['id'])});}});}})['then'](respondWithStatusCode(_0x340a2d,null))[_0x3a28('0x3b')](handleError(_0x340a2d,null));};exports[_0x3a28('0x78')]=function(_0x356387,_0x1156bf){var _0x312333={};var _0x275af8={};var _0xcab321;var _0x55142b;return db['WhatsappQueue'][_0x3a28('0x52')]({'where':{'id':_0x356387[_0x3a28('0x28')]['id']}})[_0x3a28('0x16')](handleEntityNotFound(_0x1156bf,null))[_0x3a28('0x16')](function(_0x3ffdbc){if(_0x3ffdbc){_0xcab321=_0x3ffdbc;_0x275af8[_0x3a28('0x29')]=_[_0x3a28('0x2b')](db[_0x3a28('0x47')]['rawAttributes']);_0x275af8[_0x3a28('0x25')]=_[_0x3a28('0x2b')](_0x356387[_0x3a28('0x25')]);_0x275af8[_0x3a28('0x2c')]=_[_0x3a28('0x2e')](_0x275af8[_0x3a28('0x29')],_0x275af8['query']);_0x312333[_0x3a28('0x2d')]=_[_0x3a28('0x2e')](_0x275af8[_0x3a28('0x29')],qs[_0x3a28('0x40')](_0x356387[_0x3a28('0x25')][_0x3a28('0x40')]));_0x312333[_0x3a28('0x2d')]=_0x312333['attributes'][_0x3a28('0x2f')]?_0x312333[_0x3a28('0x2d')]:_0x275af8[_0x3a28('0x29')];_0x312333[_0x3a28('0x79')]=qs[_0x3a28('0x43')](_0x356387[_0x3a28('0x25')][_0x3a28('0x43')]);_0x312333[_0x3a28('0x23')]=qs[_0x3a28('0x2c')](_[_0x3a28('0x44')](_0x356387[_0x3a28('0x25')],_0x275af8[_0x3a28('0x2c')]));if(_0x356387[_0x3a28('0x25')][_0x3a28('0x45')]){_0x312333['where']=_['merge'](_0x312333[_0x3a28('0x23')],{'$or':_[_0x3a28('0x1f')](_0x312333['attributes'],function(_0x1ca177){var _0x340f00={};_0x340f00[_0x1ca177]={'$like':'%'+_0x356387[_0x3a28('0x25')]['filter']+'%'};return _0x340f00;})});}_0x312333=_[_0x3a28('0x31')]({},_0x312333,_0x356387[_0x3a28('0x32')]);return _0xcab321['getAgents'](_0x312333);}})[_0x3a28('0x16')](function(_0x5ea172){if(_0x5ea172){_0x55142b=_0x5ea172[_0x3a28('0x2f')];if(!_0x356387[_0x3a28('0x25')][_0x3a28('0x41')](_0x3a28('0x42'))){_0x312333[_0x3a28('0x11')]=qs['limit'](_0x356387[_0x3a28('0x25')][_0x3a28('0x11')]);_0x312333['offset']=qs[_0x3a28('0xe')](_0x356387[_0x3a28('0x25')][_0x3a28('0xe')]);}return _0xcab321[_0x3a28('0x78')](_0x312333);}})[_0x3a28('0x16')](function(_0x329848){if(_0x329848){return _0x329848?{'count':_0x55142b,'rows':_0x329848}:null;}})[_0x3a28('0x16')](respondWithResult(_0x1156bf,null))['catch'](handleError(_0x1156bf,null));}; \ No newline at end of file +var _0x525a=['agent','updatedAt','createdAt','format','SIP','whatsappPause','getTeams','Team','filter','ids','Agents','online','voicePause','flatMap','sequelize','transaction','each','findOrCreate','forEach','userWhatsappQueue:save','select','field','tq.TeamId','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','push','toString','SELECT','every','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','emit','addAgents','omit','spread','isArray','userWhatsappQueue:remove','getAgents','findOne','bluebird','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','redis','localhost','socket.io-emitter','./whatsappQueue.socket','offset','undefined','limit','count','status','set','json','update','then','destroy','get','WhatsappQueues','UserProfileResource','end','stack','name','send','index','map','WhatsappQueue','rawAttributes','fieldName','type','getOptions','where','include','findAll','rows','catch','show','params','model','keys','filters','intersection','fields','query','attributes','length','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','error','getMembers','UserWhatsappQueue','hasOwnProperty','nolimit','order','sort','pick','WhatsappQueueId','merge','User','findAndCountAll','UserId'];(function(_0x569caa,_0x5174ce){var _0x44cb5a=function(_0x456df4){while(--_0x456df4){_0x569caa['push'](_0x569caa['shift']());}};_0x44cb5a(++_0x5174ce);}(_0x525a,0xa9));var _0xa525=function(_0x247fa1,_0x4ec37c){_0x247fa1=_0x247fa1-0x0;var _0x244f35=_0x525a[_0x247fa1];return _0x244f35;};'use strict';var BPromise=require(_0xa525('0x0'));var util=require('util');var _=require(_0xa525('0x1'));var squel=require(_0xa525('0x2'));var Redis=require(_0xa525('0x3'));var qs=require(_0xa525('0x4'));var logger=require(_0xa525('0x5'))(_0xa525('0x6'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0xa525('0x7')],{'host':_0xa525('0x8'),'port':0x18eb});var socket=require(_0xa525('0x9'))(new Redis(config['redis']));require(_0xa525('0xa'))['register'](socket);function respondWithStatusCode(_0x4fd78a,_0x128466){_0x128466=_0x128466||0xcc;return function(_0xb39c47){if(_0xb39c47){return _0x4fd78a['sendStatus'](_0x128466);}return _0x4fd78a['status'](_0x128466)['end']();};}function respondWithResult(_0x137bc1,_0x1b5aa8){_0x1b5aa8=_0x1b5aa8||0xc8;return function(_0x2e617a){if(_0x2e617a){return _0x137bc1['status'](_0x1b5aa8)['json'](_0x2e617a);}};}function respondWithFilteredResult(_0x140a20,_0x51c739){return function(_0x24f5ed){if(_0x24f5ed){var _0x4d7453=typeof _0x51c739[_0xa525('0xb')]===_0xa525('0xc')&&typeof _0x51c739[_0xa525('0xd')]==='undefined';var _0x37a86f=_0x24f5ed[_0xa525('0xe')];var _0x11139c=_0x4d7453?0x0:_0x51c739[_0xa525('0xb')];var _0x4d55be=_0x4d7453?_0x24f5ed[_0xa525('0xe')]:_0x51c739[_0xa525('0xb')]+_0x51c739[_0xa525('0xd')];var _0x17295e;if(_0x4d55be>=_0x37a86f){_0x4d55be=_0x37a86f;_0x17295e=0xc8;}else{_0x17295e=0xce;}_0x140a20[_0xa525('0xf')](_0x17295e);return _0x140a20[_0xa525('0x10')]('Content-Range',_0x11139c+'-'+_0x4d55be+'/'+_0x37a86f)[_0xa525('0x11')](_0x24f5ed);}return null;};}function saveUpdates(_0x5c9e48){return function(_0x5acd6d){if(_0x5acd6d){return _0x5acd6d[_0xa525('0x12')](_0x5c9e48)[_0xa525('0x13')](function(_0xb2cdfc){return _0xb2cdfc;});}return null;};}function removeEntity(_0x39579b){return function(_0x2e137a){if(_0x2e137a){return _0x2e137a[_0xa525('0x14')]()[_0xa525('0x13')](function(){var _0x2c77a5=_0x2e137a[_0xa525('0x15')]({'plain':!![]});var _0x1cfe0e=_0xa525('0x16');return db[_0xa525('0x17')]['destroy']({'where':{'type':_0x1cfe0e,'resourceId':_0x2c77a5['id']}})[_0xa525('0x13')](function(){return _0x2e137a;});})[_0xa525('0x13')](function(){_0x39579b['status'](0xcc)[_0xa525('0x18')]();});}};}function handleEntityNotFound(_0xe00da2){return function(_0x38dc21){if(!_0x38dc21){_0xe00da2['sendStatus'](0x194);}return _0x38dc21;};}function handleError(_0x21ad14,_0x574fdf){_0x574fdf=_0x574fdf||0x1f4;return function(_0x16c7ef){logger['error'](_0x16c7ef[_0xa525('0x19')]);if(_0x16c7ef[_0xa525('0x1a')]){delete _0x16c7ef[_0xa525('0x1a')];}_0x21ad14[_0xa525('0xf')](_0x574fdf)[_0xa525('0x1b')](_0x16c7ef);};}exports[_0xa525('0x1c')]=function(_0x2a1e9c,_0xd18905){var _0x1998f3={};var _0x46608a={'count':0x0,'rows':[]};var _0x42c701=_[_0xa525('0x1d')](db[_0xa525('0x1e')][_0xa525('0x1f')],function(_0x2bbb01){return{'name':_0x2bbb01[_0xa525('0x20')],'type':_0x2bbb01[_0xa525('0x21')]['key']};});_0x1998f3=qs[_0xa525('0x22')](_0x42c701,_0x2a1e9c);var _0x21fb2d={'where':_0x1998f3[_0xa525('0x23')]};return db[_0xa525('0x1e')][_0xa525('0xe')](_0x21fb2d)[_0xa525('0x13')](function(_0x2306c7){_0x46608a['count']=_0x2306c7;_0x1998f3['include']=qs[_0xa525('0x24')](_0x2a1e9c['query']);return db[_0xa525('0x1e')][_0xa525('0x25')](_0x1998f3);})['then'](function(_0x357704){_0x46608a[_0xa525('0x26')]=_0x357704;return _0x46608a;})[_0xa525('0x13')](respondWithFilteredResult(_0xd18905,_0x1998f3))[_0xa525('0x27')](handleError(_0xd18905,null));};exports[_0xa525('0x28')]=function(_0x5e4d16,_0x154f99){var _0x1b4b6c={'raw':!![],'where':{'id':_0x5e4d16[_0xa525('0x29')]['id']}},_0x64e5eb={};_0x64e5eb[_0xa525('0x2a')]=_[_0xa525('0x2b')](db[_0xa525('0x1e')]['rawAttributes']);_0x64e5eb['query']=_[_0xa525('0x2b')](_0x5e4d16['query']);_0x64e5eb[_0xa525('0x2c')]=_[_0xa525('0x2d')](_0x64e5eb[_0xa525('0x2a')],_0x64e5eb['query']);_0x1b4b6c['attributes']=_['intersection'](_0x64e5eb[_0xa525('0x2a')],qs[_0xa525('0x2e')](_0x5e4d16[_0xa525('0x2f')]['fields']));_0x1b4b6c['attributes']=_0x1b4b6c[_0xa525('0x30')][_0xa525('0x31')]?_0x1b4b6c[_0xa525('0x30')]:_0x64e5eb[_0xa525('0x2a')];if(_0x5e4d16['query'][_0xa525('0x32')]){_0x1b4b6c[_0xa525('0x24')]=[{'all':!![]}];}_0x1b4b6c=_['merge']({},_0x1b4b6c,_0x5e4d16[_0xa525('0x33')]);return db[_0xa525('0x1e')][_0xa525('0x34')](_0x1b4b6c)[_0xa525('0x13')](handleEntityNotFound(_0x154f99,null))['then'](respondWithResult(_0x154f99,null))[_0xa525('0x27')](handleError(_0x154f99,null));};exports[_0xa525('0x35')]=function(_0x1adad1,_0x33e2d9){return db[_0xa525('0x1e')][_0xa525('0x35')](_0x1adad1[_0xa525('0x36')],{})[_0xa525('0x13')](function(_0x17996a){var _0xb6ac97=_0x1adad1[_0xa525('0x37')][_0xa525('0x15')]({'plain':!![]});if(!_0xb6ac97)throw new Error(_0xa525('0x38'));if(_0xb6ac97[_0xa525('0x39')]===_0xa525('0x37')){var _0x3f1dcb=_0x17996a[_0xa525('0x15')]({'plain':!![]});var _0xc76a30='WhatsappQueues';return db[_0xa525('0x3a')][_0xa525('0x34')]({'where':{'name':_0xc76a30,'userProfileId':_0xb6ac97[_0xa525('0x3b')]},'raw':!![]})['then'](function(_0x15e6a1){if(_0x15e6a1&&_0x15e6a1['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x3f1dcb['name'],'resourceId':_0x3f1dcb['id'],'type':_0x15e6a1[_0xa525('0x1a')],'sectionId':_0x15e6a1['id']},{})[_0xa525('0x13')](function(){return _0x17996a;});}else{return _0x17996a;}})[_0xa525('0x27')](function(_0x398b5c){logger[_0xa525('0x3c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x398b5c);throw _0x398b5c;});}return _0x17996a;})['then'](respondWithResult(_0x33e2d9,0xc9))['catch'](handleError(_0x33e2d9,null));};exports[_0xa525('0x12')]=function(_0x47ce35,_0x5a960e){if(_0x47ce35[_0xa525('0x36')]['id']){delete _0x47ce35['body']['id'];}return db[_0xa525('0x1e')][_0xa525('0x34')]({'where':{'id':_0x47ce35['params']['id']}})[_0xa525('0x13')](handleEntityNotFound(_0x5a960e,null))[_0xa525('0x13')](saveUpdates(_0x47ce35[_0xa525('0x36')],null))['then'](respondWithResult(_0x5a960e,null))[_0xa525('0x27')](handleError(_0x5a960e,null));};exports[_0xa525('0x14')]=function(_0x3dea22,_0x377e07){return db[_0xa525('0x1e')][_0xa525('0x34')]({'where':{'id':_0x3dea22[_0xa525('0x29')]['id']}})[_0xa525('0x13')](handleEntityNotFound(_0x377e07,null))[_0xa525('0x13')](removeEntity(_0x377e07,null))['catch'](handleError(_0x377e07,null));};exports['describe']=function(_0x1b94ea,_0x5e9f40){return db[_0xa525('0x1e')]['describe']()[_0xa525('0x13')](respondWithResult(_0x5e9f40,null))['catch'](handleError(_0x5e9f40,null));};exports[_0xa525('0x3d')]=function(_0x31b332,_0x1e9673){var _0x480f2a={'raw':!![],'where':{}},_0x5cc693={},_0x3f34d5;return db[_0xa525('0x1e')]['findOne']({'where':{'id':_0x31b332[_0xa525('0x29')]['id']}})[_0xa525('0x13')](handleEntityNotFound(_0x1e9673,null))[_0xa525('0x13')](function(_0x5d35f3){if(_0x5d35f3){_0x3f34d5=_0x5d35f3[_0xa525('0x15')]({'plain':!![]});_0x5cc693[_0xa525('0x2a')]=_[_0xa525('0x2b')](db[_0xa525('0x3e')]['rawAttributes']);_0x5cc693[_0xa525('0x2f')]=_[_0xa525('0x2b')](_0x31b332[_0xa525('0x2f')]);_0x5cc693[_0xa525('0x2c')]=_[_0xa525('0x2d')](_0x5cc693[_0xa525('0x2a')],_0x5cc693[_0xa525('0x2f')]);_0x480f2a[_0xa525('0x30')]=_[_0xa525('0x2d')](_0x5cc693[_0xa525('0x2a')],qs[_0xa525('0x2e')](_0x31b332[_0xa525('0x2f')]['fields']));_0x480f2a[_0xa525('0x30')]=_0x480f2a[_0xa525('0x30')]['length']?_0x480f2a[_0xa525('0x30')]:_0x5cc693[_0xa525('0x2a')];if(!_0x31b332[_0xa525('0x2f')][_0xa525('0x3f')](_0xa525('0x40'))){_0x480f2a['limit']=qs[_0xa525('0xd')](_0x31b332['query'][_0xa525('0xd')]);_0x480f2a['offset']=qs['offset'](_0x31b332[_0xa525('0x2f')][_0xa525('0xb')]);}_0x480f2a[_0xa525('0x41')]=qs[_0xa525('0x42')](_0x31b332['query'][_0xa525('0x42')]);_0x480f2a[_0xa525('0x23')]=qs[_0xa525('0x2c')](_[_0xa525('0x43')](_0x31b332['query'],_0x5cc693[_0xa525('0x2c')]));_0x480f2a[_0xa525('0x23')][_0xa525('0x44')]=_0x5d35f3['id'];if(_0x31b332[_0xa525('0x2f')]['filter']){_0x480f2a[_0xa525('0x23')]=_['merge'](_0x480f2a[_0xa525('0x23')],{'$or':_['map'](_0x480f2a['attributes'],function(_0x1186cb){var _0x5d0c7e={};_0x5d0c7e[_0x1186cb]={'$like':'%'+_0x31b332[_0xa525('0x2f')]['filter']+'%'};return _0x5d0c7e;})});}_0x480f2a=_[_0xa525('0x45')]({},_0x480f2a,_0x31b332[_0xa525('0x33')]);return db[_0xa525('0x3e')][_0xa525('0x25')](_0x480f2a);}})[_0xa525('0x13')](function(_0x26a855){if(_0x26a855){return db[_0xa525('0x46')][_0xa525('0x47')]({'where':{'id':_[_0xa525('0x1d')](_0x26a855,_0xa525('0x48')),'role':_0xa525('0x49')},'attributes':['id',_0xa525('0x1a'),'whatsappPause',_0xa525('0x4a'),_0xa525('0x4b')]});}})[_0xa525('0x13')](function(_0x151b8f){if(_0x151b8f){return{'count':_0x151b8f['count'],'rows':_[_0xa525('0x1d')](_0x151b8f[_0xa525('0x26')],function(_0xa469ec){return{'membername':_0xa469ec[_0xa525('0x1a')],'UserId':_0xa469ec['id'],'queue_name':_0x3f34d5[_0xa525('0x1a')],'WhatsappQueueId':_0x3f34d5['id'],'interface':util[_0xa525('0x4c')]('%s/%s',_0xa525('0x4d'),_0xa469ec[_0xa525('0x1a')]),'penalty':0x0,'paused':_0xa469ec[_0xa525('0x4e')],'createdAt':_0xa469ec[_0xa525('0x4b')],'updatedAt':_0xa469ec['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xa525('0x13')](respondWithFilteredResult(_0x1e9673,_0x480f2a))[_0xa525('0x27')](handleError(_0x1e9673,null));};exports[_0xa525('0x4f')]=function(_0xb2668d,_0x3533f6){var _0x3c8e82={};var _0x58673d={};var _0x1f5f9b;var _0x3af4ad;return db['WhatsappQueue']['findOne']({'where':{'id':_0xb2668d[_0xa525('0x29')]['id']}})['then'](handleEntityNotFound(_0x3533f6,null))['then'](function(_0x58edf5){if(_0x58edf5){_0x1f5f9b=_0x58edf5;_0x58673d[_0xa525('0x2a')]=_[_0xa525('0x2b')](db[_0xa525('0x50')]['rawAttributes']);_0x58673d[_0xa525('0x2f')]=_['keys'](_0xb2668d[_0xa525('0x2f')]);_0x58673d['filters']=_[_0xa525('0x2d')](_0x58673d[_0xa525('0x2a')],_0x58673d['query']);_0x3c8e82[_0xa525('0x30')]=_[_0xa525('0x2d')](_0x58673d[_0xa525('0x2a')],qs[_0xa525('0x2e')](_0xb2668d[_0xa525('0x2f')][_0xa525('0x2e')]));_0x3c8e82[_0xa525('0x30')]=_0x3c8e82[_0xa525('0x30')]['length']?_0x3c8e82['attributes']:_0x58673d[_0xa525('0x2a')];_0x3c8e82[_0xa525('0x41')]=qs['sort'](_0xb2668d[_0xa525('0x2f')]['sort']);_0x3c8e82[_0xa525('0x23')]=qs[_0xa525('0x2c')](_[_0xa525('0x43')](_0xb2668d[_0xa525('0x2f')],_0x58673d[_0xa525('0x2c')]));if(_0xb2668d['query'][_0xa525('0x51')]){_0x3c8e82[_0xa525('0x23')]=_['merge'](_0x3c8e82['where'],{'$or':_[_0xa525('0x1d')](_0x3c8e82[_0xa525('0x30')],function(_0x4ed16f){var _0x11c3f5={};_0x11c3f5[_0x4ed16f]={'$like':'%'+_0xb2668d['query'][_0xa525('0x51')]+'%'};return _0x11c3f5;})});}_0x3c8e82=_['merge']({},_0x3c8e82,_0xb2668d[_0xa525('0x33')]);return _0x1f5f9b[_0xa525('0x4f')](_0x3c8e82);}})[_0xa525('0x13')](function(_0x32b403){if(_0x32b403){_0x3af4ad=_0x32b403['length'];if(!_0xb2668d[_0xa525('0x2f')]['hasOwnProperty'](_0xa525('0x40'))){_0x3c8e82[_0xa525('0xd')]=qs['limit'](_0xb2668d[_0xa525('0x2f')][_0xa525('0xd')]);_0x3c8e82[_0xa525('0xb')]=qs['offset'](_0xb2668d[_0xa525('0x2f')][_0xa525('0xb')]);}return _0x1f5f9b[_0xa525('0x4f')](_0x3c8e82);}})[_0xa525('0x13')](function(_0x46bc2c){if(_0x46bc2c){return _0x46bc2c?{'count':_0x3af4ad,'rows':_0x46bc2c}:null;}})[_0xa525('0x13')](respondWithResult(_0x3533f6,null))[_0xa525('0x27')](handleError(_0x3533f6,null));};exports['addTeams']=function(_0x58db17,_0x1878bd){var _0x222df7=_0x58db17[_0xa525('0x36')][_0xa525('0x52')];return db[_0xa525('0x50')][_0xa525('0x25')]({'where':{'id':_0x222df7},'attributes':['id'],'include':[{'model':db[_0xa525('0x46')],'as':_0xa525('0x53'),'attributes':['id',_0xa525('0x1a'),_0xa525('0x54'),_0xa525('0x55'),'interface'],'raw':!![]}]})[_0xa525('0x13')](function(_0x2d5d9a){if(_0x2d5d9a){var _0xef84f1=_[_0xa525('0x56')](_0x2d5d9a,function(_0x242b39){var _0x944927=_0x242b39['get']({'plain':!![]});return _0x944927[_0xa525('0x53')];});return db[_0xa525('0x1e')]['find']({'where':{'id':_0x58db17[_0xa525('0x29')]['id']}})['then'](function(_0x173523){return db[_0xa525('0x57')][_0xa525('0x58')](function(_0x32b509){return _0x173523['addTeams'](_0x222df7,{'transaction':_0x32b509})[_0xa525('0x13')](function(){return BPromise[_0xa525('0x59')](_0xef84f1,function(_0x34f0e9){return db['UserWhatsappQueue'][_0xa525('0x5a')]({'where':{'UserId':_0x34f0e9['id'],'WhatsappQueueId':_0x58db17[_0xa525('0x29')]['id']},'transaction':_0x32b509});});})[_0xa525('0x13')](function(){_0xef84f1[_0xa525('0x5b')](function(_0x47d10d){socket['emit'](_0xa525('0x5c'),{'UserId':_0x47d10d['id'],'WhatsappQueueId':_0x173523['id']});});});});});}})[_0xa525('0x13')](respondWithStatusCode(_0x1878bd,null))[_0xa525('0x27')](handleError(_0x1878bd,null));};exports['removeTeams']=function(_0x177915,_0x108a9a){return db[_0xa525('0x50')][_0xa525('0x25')]({'where':{'id':_0x177915[_0xa525('0x2f')][_0xa525('0x52')]},'attributes':['id'],'include':[{'model':db[_0xa525('0x46')],'as':_0xa525('0x53'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x108a9a,null))['then'](function(_0x480ce0){var _0x10b9c9=_['map'](_0x480ce0,'id');var _0x2591e0=[];var _0x27efc2=[];var _0x54c80=squel[_0xa525('0x5d')]();_0x54c80[_0xa525('0x5e')](_0xa525('0x5f'))['from'](_0xa525('0x60'),'tq')[_0xa525('0x61')](_0xa525('0x62'),'ut',_0xa525('0x63'))['where'](_0xa525('0x64'),_0x177915['params']['id']);for(var _0x4f72c3=0x0;_0x4f72c3<_0x480ce0[_0xa525('0x31')];_0x4f72c3+=0x1){let _0x1f674a=_0x480ce0[_0x4f72c3];for(var _0x1537ea=0x0;_0x1537ea<_0x1f674a[_0xa525('0x53')][_0xa525('0x31')];_0x1537ea+=0x1){let _0x5a0073=_0x1f674a[_0xa525('0x53')][_0x1537ea];var _0x4bbcff=_0x54c80['clone']();_0x4bbcff[_0xa525('0x23')]('ut.UserId\x20=\x20?',_0x5a0073['id']);_0x27efc2[_0xa525('0x65')](db['sequelize'][_0xa525('0x2f')](_0x4bbcff[_0xa525('0x66')](),{'type':db[_0xa525('0x57')]['QueryTypes'][_0xa525('0x67')]})['then'](function(_0x3d2336){if(_0x3d2336[_0xa525('0x31')]===0x1){return _0x5a0073['id'];}else{var _0x20d84b=_[_0xa525('0x68')](_[_0xa525('0x1d')](_0x3d2336,_0xa525('0x69')),function(_0x4934da){return _[_0xa525('0x6a')](_0x10b9c9,_0x4934da);});if(_0x20d84b){return _0x5a0073['id'];}}}));}}return BPromise[_0xa525('0x6b')](_0x27efc2)[_0xa525('0x13')](function(_0x59a675){_0x2591e0=_(_0x2591e0)[_0xa525('0x6c')](_0x59a675)[_0xa525('0x6d')]()[_0xa525('0x6e')]();return db[_0xa525('0x1e')][_0xa525('0x34')]({'where':{'id':_0x177915['params']['id']}})[_0xa525('0x13')](function(_0x704ec9){return db[_0xa525('0x57')][_0xa525('0x58')](function(_0x4dfacf){return _0x704ec9['removeTeams'](_0x177915[_0xa525('0x2f')][_0xa525('0x52')],{'transaction':_0x4dfacf})[_0xa525('0x13')](function(){if(!_[_0xa525('0x6f')](_0x2591e0)){return _0x704ec9[_0xa525('0x70')](_0x2591e0,{'transaction':_0x4dfacf});}})[_0xa525('0x13')](function(){_0x2591e0[_0xa525('0x5b')](function(_0x3229ed){socket[_0xa525('0x71')]('userWhatsappQueue:remove',{'UserId':_0x3229ed,'WhatsappQueueId':_0x704ec9['id']});});});});});});})[_0xa525('0x13')](respondWithStatusCode(_0x108a9a,null))['catch'](handleError(_0x108a9a,null));};exports['addAgents']=function(_0x3c43ab,_0x30c0d5){return db[_0xa525('0x1e')][_0xa525('0x34')]({'where':{'id':_0x3c43ab[_0xa525('0x29')]['id']}})[_0xa525('0x13')](handleEntityNotFound(_0x30c0d5,null))['then'](function(_0x393e4d){if(_0x393e4d){return _0x393e4d[_0xa525('0x72')](_0x3c43ab[_0xa525('0x36')][_0xa525('0x52')],_[_0xa525('0x73')](_0x3c43ab['body'],['ids','id'])||{})[_0xa525('0x74')](function(_0x6a563a){for(var _0x1075fb=0x0;_0x1075fb<_0x3c43ab[_0xa525('0x36')][_0xa525('0x52')][_0xa525('0x31')];_0x1075fb+=0x1){socket[_0xa525('0x71')](_0xa525('0x5c'),{'UserId':Number(_0x3c43ab[_0xa525('0x36')][_0xa525('0x52')][_0x1075fb]),'WhatsappQueueId':Number(_0x3c43ab[_0xa525('0x29')]['id'])});}return _0x6a563a;});}})[_0xa525('0x13')](respondWithResult(_0x30c0d5,null))[_0xa525('0x27')](handleError(_0x30c0d5,null));};exports[_0xa525('0x70')]=function(_0x27c9c9,_0x106fda){return db[_0xa525('0x1e')][_0xa525('0x34')]({'where':{'id':_0x27c9c9[_0xa525('0x29')]['id']}})[_0xa525('0x13')](handleEntityNotFound(_0x106fda,null))[_0xa525('0x13')](function(_0x3077c3){if(_0x3077c3){return _0x3077c3[_0xa525('0x70')](_0x27c9c9['query']['ids'])[_0xa525('0x13')](function(){if(_[_0xa525('0x75')](_0x27c9c9['query'][_0xa525('0x52')])){for(var _0x1d7827=0x0;_0x1d7827<_0x27c9c9['query'][_0xa525('0x52')][_0xa525('0x31')];_0x1d7827+=0x1){socket[_0xa525('0x71')]('userWhatsappQueue:remove',{'UserId':Number(_0x27c9c9['query'][_0xa525('0x52')][_0x1d7827]),'WhatsappQueueId':Number(_0x27c9c9[_0xa525('0x29')]['id'])});}}else{socket[_0xa525('0x71')](_0xa525('0x76'),{'UserId':Number(_0x27c9c9[_0xa525('0x2f')][_0xa525('0x52')]),'WhatsappQueueId':Number(_0x27c9c9[_0xa525('0x29')]['id'])});}});}})[_0xa525('0x13')](respondWithStatusCode(_0x106fda,null))[_0xa525('0x27')](handleError(_0x106fda,null));};exports[_0xa525('0x77')]=function(_0x2210e3,_0x3396f4){var _0x3ab802={};var _0x351bf7={};var _0x21d831;var _0x5c70f6;return db[_0xa525('0x1e')][_0xa525('0x78')]({'where':{'id':_0x2210e3['params']['id']}})[_0xa525('0x13')](handleEntityNotFound(_0x3396f4,null))['then'](function(_0x3fa4d9){if(_0x3fa4d9){_0x21d831=_0x3fa4d9;_0x351bf7[_0xa525('0x2a')]=_[_0xa525('0x2b')](db[_0xa525('0x46')][_0xa525('0x1f')]);_0x351bf7[_0xa525('0x2f')]=_['keys'](_0x2210e3[_0xa525('0x2f')]);_0x351bf7[_0xa525('0x2c')]=_[_0xa525('0x2d')](_0x351bf7[_0xa525('0x2a')],_0x351bf7[_0xa525('0x2f')]);_0x3ab802[_0xa525('0x30')]=_[_0xa525('0x2d')](_0x351bf7[_0xa525('0x2a')],qs[_0xa525('0x2e')](_0x2210e3[_0xa525('0x2f')]['fields']));_0x3ab802['attributes']=_0x3ab802['attributes'][_0xa525('0x31')]?_0x3ab802['attributes']:_0x351bf7[_0xa525('0x2a')];_0x3ab802['order']=qs['sort'](_0x2210e3[_0xa525('0x2f')][_0xa525('0x42')]);_0x3ab802[_0xa525('0x23')]=qs[_0xa525('0x2c')](_['pick'](_0x2210e3[_0xa525('0x2f')],_0x351bf7['filters']));if(_0x2210e3[_0xa525('0x2f')][_0xa525('0x51')]){_0x3ab802[_0xa525('0x23')]=_['merge'](_0x3ab802[_0xa525('0x23')],{'$or':_[_0xa525('0x1d')](_0x3ab802[_0xa525('0x30')],function(_0x5f4c01){var _0x106839={};_0x106839[_0x5f4c01]={'$like':'%'+_0x2210e3[_0xa525('0x2f')][_0xa525('0x51')]+'%'};return _0x106839;})});}_0x3ab802=_[_0xa525('0x45')]({},_0x3ab802,_0x2210e3[_0xa525('0x33')]);return _0x21d831[_0xa525('0x77')](_0x3ab802);}})[_0xa525('0x13')](function(_0x1a76ce){if(_0x1a76ce){_0x5c70f6=_0x1a76ce[_0xa525('0x31')];if(!_0x2210e3[_0xa525('0x2f')][_0xa525('0x3f')](_0xa525('0x40'))){_0x3ab802[_0xa525('0xd')]=qs[_0xa525('0xd')](_0x2210e3[_0xa525('0x2f')][_0xa525('0xd')]);_0x3ab802['offset']=qs[_0xa525('0xb')](_0x2210e3[_0xa525('0x2f')][_0xa525('0xb')]);}return _0x21d831[_0xa525('0x77')](_0x3ab802);}})[_0xa525('0x13')](function(_0x39e33f){if(_0x39e33f){return _0x39e33f?{'count':_0x5c70f6,'rows':_0x39e33f}:null;}})[_0xa525('0x13')](respondWithResult(_0x3396f4,null))['catch'](handleError(_0x3396f4,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 9573657..2b07895 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 _0x8a80=['hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappQueue','setMaxListeners','save','update','remove','emit'];(function(_0x312b1c,_0x3c43f5){var _0x55e43d=function(_0x4c5158){while(--_0x4c5158){_0x312b1c['push'](_0x312b1c['shift']());}};_0x55e43d(++_0x3c43f5);}(_0x8a80,0xb3));var _0x08a8=function(_0x447564,_0x593817){_0x447564=_0x447564-0x0;var _0x388295=_0x8a80[_0x447564];return _0x388295;};'use strict';var EventEmitter=require(_0x08a8('0x0'));var WhatsappQueue=require(_0x08a8('0x1'))['db'][_0x08a8('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x08a8('0x3')](0x0);var events={'afterCreate':_0x08a8('0x4'),'afterUpdate':_0x08a8('0x5'),'afterDestroy':_0x08a8('0x6')};function emitEvent(_0x1c3778){return function(_0x2d6a2c,_0xc84b1,_0x3f1d2e){WhatsappQueueEvents['emit'](_0x1c3778+':'+_0x2d6a2c['id'],_0x2d6a2c);WhatsappQueueEvents[_0x08a8('0x7')](_0x1c3778,_0x2d6a2c);_0x3f1d2e(null);};}for(var e in events){if(events[_0x08a8('0x8')](e)){var event=events[e];WhatsappQueue[_0x08a8('0x9')](e,emitEvent(event));}}module[_0x08a8('0xa')]=WhatsappQueueEvents; \ No newline at end of file +var _0xfcd3=['remove','emit','hasOwnProperty','exports','events','../../mysqldb','WhatsappQueue','save','update'];(function(_0x48c22f,_0x5a5b3b){var _0xf15e7a=function(_0x235672){while(--_0x235672){_0x48c22f['push'](_0x48c22f['shift']());}};_0xf15e7a(++_0x5a5b3b);}(_0xfcd3,0x124));var _0x3fcd=function(_0x2df724,_0x411382){_0x2df724=_0x2df724-0x0;var _0x1b2504=_0xfcd3[_0x2df724];return _0x1b2504;};'use strict';var EventEmitter=require(_0x3fcd('0x0'));var WhatsappQueue=require(_0x3fcd('0x1'))['db'][_0x3fcd('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3fcd('0x3'),'afterUpdate':_0x3fcd('0x4'),'afterDestroy':_0x3fcd('0x5')};function emitEvent(_0x3b56ca){return function(_0xd8e426,_0xce9081,_0xeab38f){WhatsappQueueEvents[_0x3fcd('0x6')](_0x3b56ca+':'+_0xd8e426['id'],_0xd8e426);WhatsappQueueEvents['emit'](_0x3b56ca,_0xd8e426);_0xeab38f(null);};}for(var e in events){if(events[_0x3fcd('0x7')](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module[_0x3fcd('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 35ca02d..6ba9fc1 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 _0x60ff=['request-promise','../../config/environment','./whatsappQueue.attributes','exports','define','WhatsappQueue','whatsapp_queues','lodash','util','../../config/logger','api','moment'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x60ff,0x193));var _0xf60f=function(_0x439773,_0x2a297b){_0x439773=_0x439773-0x0;var _0x5c2021=_0x60ff[_0x439773];return _0x5c2021;};'use strict';var _=require(_0xf60f('0x0'));var util=require(_0xf60f('0x1'));var logger=require(_0xf60f('0x2'))(_0xf60f('0x3'));var moment=require(_0xf60f('0x4'));var BPromise=require('bluebird');var rp=require(_0xf60f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xf60f('0x6'));var attributes=require(_0xf60f('0x7'));module[_0xf60f('0x8')]=function(_0x50cbf2,_0x48ef70){return _0x50cbf2[_0xf60f('0x9')](_0xf60f('0xa'),attributes,{'tableName':_0xf60f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe2ec=['path','rimraf','../../config/environment','./whatsappQueue.attributes','exports','define','WhatsappQueue','whatsapp_queues','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x2cc569,_0x4e9568){var _0x1bfc2e=function(_0x5b8fcb){while(--_0x5b8fcb){_0x2cc569['push'](_0x2cc569['shift']());}};_0x1bfc2e(++_0x4e9568);}(_0xe2ec,0x166));var _0xce2e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xe2ec[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0xce2e('0x0'));var util=require(_0xce2e('0x1'));var logger=require(_0xce2e('0x2'))('api');var moment=require(_0xce2e('0x3'));var BPromise=require(_0xce2e('0x4'));var rp=require(_0xce2e('0x5'));var fs=require('fs');var path=require(_0xce2e('0x6'));var rimraf=require(_0xce2e('0x7'));var config=require(_0xce2e('0x8'));var attributes=require(_0xce2e('0x9'));module[_0xce2e('0xa')]=function(_0x275fab,_0x2fe3c8){return _0x275fab[_0xce2e('0xb')](_0xce2e('0xc'),attributes,{'tableName':_0xce2e('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.rpc.js b/server/api/whatsappQueue/whatsappQueue.rpc.js index 1824492..b7fe76f 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 _0x93c0=['options','raw','where','attributes','include','map','model','debug','stringify','ShowWhatsappQueue','WhatsappQueue','info','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./whatsappQueue.socket','request','then','WhatsappQueue,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetWhatsappQueue','findAll'];(function(_0x78a19a,_0x424bce){var _0x13b4f0=function(_0x43d10d){while(--_0x43d10d){_0x78a19a['push'](_0x78a19a['shift']());}};_0x13b4f0(++_0x424bce);}(_0x93c0,0x13c));var _0x093c=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x93c0[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x093c('0x0'));var util=require('util');var moment=require(_0x093c('0x1'));var BPromise=require('bluebird');var rs=require(_0x093c('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x093c('0x3'))['db'];var utils=require(_0x093c('0x4'));var logger=require(_0x093c('0x5'))(_0x093c('0x6'));var config=require(_0x093c('0x7'));var jayson=require(_0x093c('0x8'));var client=jayson[_0x093c('0x9')][_0x093c('0xa')]({'port':0x232a});config[_0x093c('0xb')]=_[_0x093c('0xc')](config['redis'],{'host':_0x093c('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x093c('0xb')]));require(_0x093c('0xe'))['register'](socket);function respondWithRpcPromise(_0x1a36b7,_0x35ba3e,_0xa609e8){return new BPromise(function(_0x54d9ec,_0x7eb8a0){return client[_0x093c('0xf')](_0x1a36b7,_0xa609e8)[_0x093c('0x10')](function(_0xbeb50c){logger['info'](_0x093c('0x11'),_0x35ba3e,'request\x20sent');logger['debug']('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0x35ba3e,_0x093c('0x12'),JSON['stringify'](_0xbeb50c));if(_0xbeb50c[_0x093c('0x13')]){if(_0xbeb50c['error'][_0x093c('0x14')]===0x1f4){logger[_0x093c('0x13')](_0x093c('0x11'),_0x35ba3e,_0xbeb50c[_0x093c('0x13')][_0x093c('0x15')]);return _0x7eb8a0(_0xbeb50c[_0x093c('0x13')]['message']);}logger[_0x093c('0x13')]('WhatsappQueue,\x20%s,\x20%s',_0x35ba3e,_0xbeb50c['error'][_0x093c('0x15')]);return _0x54d9ec(_0xbeb50c['error'][_0x093c('0x15')]);}else{logger['info'](_0x093c('0x11'),_0x35ba3e,_0x093c('0x12'));_0x54d9ec(_0xbeb50c[_0x093c('0x16')][_0x093c('0x15')]);}})[_0x093c('0x17')](function(_0x14c3f1){logger[_0x093c('0x13')](_0x093c('0x11'),_0x35ba3e,_0x14c3f1);_0x7eb8a0(_0x14c3f1);});});}exports[_0x093c('0x18')]=function(_0x4c0327){var _0x3e49aa=this;return new Promise(function(_0x315ab8,_0x5a5995){return db['WhatsappQueue'][_0x093c('0x19')]({'raw':_0x4c0327[_0x093c('0x1a')]?_0x4c0327[_0x093c('0x1a')][_0x093c('0x1b')]===undefined?!![]:![]:!![],'where':_0x4c0327[_0x093c('0x1a')]?_0x4c0327[_0x093c('0x1a')][_0x093c('0x1c')]||null:null,'attributes':_0x4c0327[_0x093c('0x1a')]?_0x4c0327['options'][_0x093c('0x1d')]||null:null,'limit':_0x4c0327[_0x093c('0x1a')]?_0x4c0327['options']['limit']||null:null,'include':_0x4c0327[_0x093c('0x1a')]?_0x4c0327[_0x093c('0x1a')][_0x093c('0x1e')]?_[_0x093c('0x1f')](_0x4c0327[_0x093c('0x1a')][_0x093c('0x1e')],function(_0x2e176e){return{'model':db[_0x2e176e['model']],'as':_0x2e176e['as'],'attributes':_0x2e176e['attributes'],'include':_0x2e176e[_0x093c('0x1e')]?_['map'](_0x2e176e['include'],function(_0x237a40){return{'model':db[_0x237a40[_0x093c('0x20')]],'as':_0x237a40['as'],'attributes':_0x237a40[_0x093c('0x1d')],'include':_0x237a40[_0x093c('0x1e')]?_[_0x093c('0x1f')](_0x237a40['include'],function(_0x1074a6){return{'model':db[_0x1074a6[_0x093c('0x20')]],'as':_0x1074a6['as'],'attributes':_0x1074a6[_0x093c('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x093c('0x10')](function(_0xe62304){logger['info'](_0x093c('0x18'),_0x4c0327);logger[_0x093c('0x21')](_0x093c('0x18'),_0x4c0327,JSON[_0x093c('0x22')](_0xe62304));_0x315ab8(_0xe62304);})[_0x093c('0x17')](function(_0x27cbb4){logger[_0x093c('0x13')]('GetWhatsappQueue',_0x27cbb4[_0x093c('0x15')],_0x4c0327);_0x5a5995(_0x3e49aa[_0x093c('0x13')](0x1f4,_0x27cbb4[_0x093c('0x15')]));});});};exports[_0x093c('0x23')]=function(_0x5254ca){var _0x1255df=this;return new Promise(function(_0x2376c0,_0x1b2eea){return db[_0x093c('0x24')]['find']({'raw':_0x5254ca[_0x093c('0x1a')]?_0x5254ca[_0x093c('0x1a')][_0x093c('0x1b')]===undefined?!![]:![]:!![],'where':_0x5254ca[_0x093c('0x1a')]?_0x5254ca[_0x093c('0x1a')][_0x093c('0x1c')]||null:null,'attributes':_0x5254ca[_0x093c('0x1a')]?_0x5254ca[_0x093c('0x1a')][_0x093c('0x1d')]||null:null,'include':_0x5254ca[_0x093c('0x1a')]?_0x5254ca['options']['include']?_[_0x093c('0x1f')](_0x5254ca[_0x093c('0x1a')][_0x093c('0x1e')],function(_0x367696){return{'model':db[_0x367696['model']],'as':_0x367696['as'],'attributes':_0x367696[_0x093c('0x1d')],'include':_0x367696[_0x093c('0x1e')]?_[_0x093c('0x1f')](_0x367696[_0x093c('0x1e')],function(_0x42d188){return{'model':db[_0x42d188[_0x093c('0x20')]],'as':_0x42d188['as'],'attributes':_0x42d188[_0x093c('0x1d')],'include':_0x42d188['include']?_[_0x093c('0x1f')](_0x42d188[_0x093c('0x1e')],function(_0x1afc8c){return{'model':db[_0x1afc8c[_0x093c('0x20')]],'as':_0x1afc8c['as'],'attributes':_0x1afc8c[_0x093c('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x093c('0x10')](function(_0x56946f){logger[_0x093c('0x25')](_0x093c('0x23'),_0x5254ca);logger['debug'](_0x093c('0x23'),_0x5254ca,JSON['stringify'](_0x56946f));_0x2376c0(_0x56946f);})[_0x093c('0x17')](function(_0x3d1831){logger[_0x093c('0x13')](_0x093c('0x23'),_0x3d1831[_0x093c('0x15')],_0x5254ca);_0x1b2eea(_0x1255df[_0x093c('0x13')](0x1f4,_0x3d1831[_0x093c('0x15')]));});});}; \ No newline at end of file +var _0xedde=['../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','request','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetWhatsappQueue','findAll','options','attributes','limit','include','map','model','then','ShowWhatsappQueue','where','util','moment','randomstring','../../mysqldb'];(function(_0x516510,_0x48f18a){var _0x5c5246=function(_0x3ea365){while(--_0x3ea365){_0x516510['push'](_0x516510['shift']());}};_0x5c5246(++_0x48f18a);}(_0xedde,0x1f4));var _0xeedd=function(_0x6c05d2,_0x5c0e9f){_0x6c05d2=_0x6c05d2-0x0;var _0x1aefee=_0xedde[_0x6c05d2];return _0x1aefee;};'use strict';var _=require('lodash');var util=require(_0xeedd('0x0'));var moment=require(_0xeedd('0x1'));var BPromise=require('bluebird');var rs=require(_0xeedd('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xeedd('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xeedd('0x4'))(_0xeedd('0x5'));var config=require('../../config/environment');var jayson=require(_0xeedd('0x6'));var client=jayson[_0xeedd('0x7')][_0xeedd('0x8')]({'port':0x232a});config[_0xeedd('0x9')]=_[_0xeedd('0xa')](config[_0xeedd('0x9')],{'host':_0xeedd('0xb'),'port':0x18eb});var socket=require(_0xeedd('0xc'))(new Redis(config[_0xeedd('0x9')]));require(_0xeedd('0xd'))[_0xeedd('0xe')](socket);function respondWithRpcPromise(_0x5b4363,_0x1ea318,_0x3cdd08){return new BPromise(function(_0x3ac9b6,_0x14cacb){return client[_0xeedd('0xf')](_0x5b4363,_0x3cdd08)['then'](function(_0x3e49da){logger[_0xeedd('0x10')](_0xeedd('0x11'),_0x1ea318,_0xeedd('0x12'));logger[_0xeedd('0x13')](_0xeedd('0x14'),_0x1ea318,'request\x20sent',JSON[_0xeedd('0x15')](_0x3e49da));if(_0x3e49da['error']){if(_0x3e49da[_0xeedd('0x16')]['code']===0x1f4){logger['error']('WhatsappQueue,\x20%s,\x20%s',_0x1ea318,_0x3e49da[_0xeedd('0x16')]['message']);return _0x14cacb(_0x3e49da['error'][_0xeedd('0x17')]);}logger[_0xeedd('0x16')](_0xeedd('0x11'),_0x1ea318,_0x3e49da['error'][_0xeedd('0x17')]);return _0x3ac9b6(_0x3e49da[_0xeedd('0x16')][_0xeedd('0x17')]);}else{logger[_0xeedd('0x10')](_0xeedd('0x11'),_0x1ea318,_0xeedd('0x12'));_0x3ac9b6(_0x3e49da['result'][_0xeedd('0x17')]);}})[_0xeedd('0x18')](function(_0x512cc1){logger[_0xeedd('0x16')]('WhatsappQueue,\x20%s,\x20%s',_0x1ea318,_0x512cc1);_0x14cacb(_0x512cc1);});});}exports[_0xeedd('0x19')]=function(_0x19f721){var _0x454a41=this;return new Promise(function(_0x3d8137,_0x4e5db6){return db['WhatsappQueue'][_0xeedd('0x1a')]({'raw':_0x19f721[_0xeedd('0x1b')]?_0x19f721[_0xeedd('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x19f721[_0xeedd('0x1b')]?_0x19f721[_0xeedd('0x1b')]['where']||null:null,'attributes':_0x19f721[_0xeedd('0x1b')]?_0x19f721['options'][_0xeedd('0x1c')]||null:null,'limit':_0x19f721[_0xeedd('0x1b')]?_0x19f721['options'][_0xeedd('0x1d')]||null:null,'include':_0x19f721['options']?_0x19f721[_0xeedd('0x1b')][_0xeedd('0x1e')]?_['map'](_0x19f721[_0xeedd('0x1b')]['include'],function(_0x24431c){return{'model':db[_0x24431c['model']],'as':_0x24431c['as'],'attributes':_0x24431c[_0xeedd('0x1c')],'include':_0x24431c[_0xeedd('0x1e')]?_['map'](_0x24431c[_0xeedd('0x1e')],function(_0x449ecf){return{'model':db[_0x449ecf['model']],'as':_0x449ecf['as'],'attributes':_0x449ecf[_0xeedd('0x1c')],'include':_0x449ecf[_0xeedd('0x1e')]?_[_0xeedd('0x1f')](_0x449ecf[_0xeedd('0x1e')],function(_0x59977e){return{'model':db[_0x59977e[_0xeedd('0x20')]],'as':_0x59977e['as'],'attributes':_0x59977e[_0xeedd('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xeedd('0x21')](function(_0x66d8b8){logger[_0xeedd('0x10')]('GetWhatsappQueue',_0x19f721);logger['debug'](_0xeedd('0x19'),_0x19f721,JSON[_0xeedd('0x15')](_0x66d8b8));_0x3d8137(_0x66d8b8);})['catch'](function(_0xe36dac){logger[_0xeedd('0x16')](_0xeedd('0x19'),_0xe36dac[_0xeedd('0x17')],_0x19f721);_0x4e5db6(_0x454a41['error'](0x1f4,_0xe36dac[_0xeedd('0x17')]));});});};exports[_0xeedd('0x22')]=function(_0x2d8f38){var _0x26c0bb=this;return new Promise(function(_0x251fca,_0x3515be){return db['WhatsappQueue']['find']({'raw':_0x2d8f38['options']?_0x2d8f38[_0xeedd('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x2d8f38[_0xeedd('0x1b')]?_0x2d8f38[_0xeedd('0x1b')][_0xeedd('0x23')]||null:null,'attributes':_0x2d8f38[_0xeedd('0x1b')]?_0x2d8f38['options'][_0xeedd('0x1c')]||null:null,'include':_0x2d8f38[_0xeedd('0x1b')]?_0x2d8f38[_0xeedd('0x1b')][_0xeedd('0x1e')]?_['map'](_0x2d8f38[_0xeedd('0x1b')]['include'],function(_0x1432cc){return{'model':db[_0x1432cc['model']],'as':_0x1432cc['as'],'attributes':_0x1432cc[_0xeedd('0x1c')],'include':_0x1432cc[_0xeedd('0x1e')]?_[_0xeedd('0x1f')](_0x1432cc[_0xeedd('0x1e')],function(_0x2f6d95){return{'model':db[_0x2f6d95['model']],'as':_0x2f6d95['as'],'attributes':_0x2f6d95[_0xeedd('0x1c')],'include':_0x2f6d95[_0xeedd('0x1e')]?_[_0xeedd('0x1f')](_0x2f6d95[_0xeedd('0x1e')],function(_0x32858f){return{'model':db[_0x32858f[_0xeedd('0x20')]],'as':_0x32858f['as'],'attributes':_0x32858f['attributes']};}):[]};}):[]};}):[]:[]})[_0xeedd('0x21')](function(_0x5cb2ca){logger['info']('ShowWhatsappQueue',_0x2d8f38);logger[_0xeedd('0x13')](_0xeedd('0x22'),_0x2d8f38,JSON['stringify'](_0x5cb2ca));_0x251fca(_0x5cb2ca);})[_0xeedd('0x18')](function(_0x464927){logger[_0xeedd('0x16')](_0xeedd('0x22'),_0x464927[_0xeedd('0x17')],_0x2d8f38);_0x3515be(_0x26c0bb['error'](0x1f4,_0x464927[_0xeedd('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index bd0c169..b42ed0f 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 _0x2ea0=['emit','length','./whatsappQueue.events','save','remove'];(function(_0x5935ca,_0x18999e){var _0x2e6bde=function(_0x5a5269){while(--_0x5a5269){_0x5935ca['push'](_0x5935ca['shift']());}};_0x2e6bde(++_0x18999e);}(_0x2ea0,0xcf));var _0x02ea=function(_0x10bb45,_0xa57a18){_0x10bb45=_0x10bb45-0x0;var _0x4f1846=_0x2ea0[_0x10bb45];return _0x4f1846;};'use strict';var WhatsappQueueEvents=require(_0x02ea('0x0'));var events=[_0x02ea('0x1'),_0x02ea('0x2'),'update'];function createListener(_0x31567a,_0xa0e5c0){return function(_0x3907fb){_0xa0e5c0[_0x02ea('0x3')](_0x31567a,_0x3907fb);};}function removeListener(_0x591cc8,_0x5c57aa){return function(){WhatsappQueueEvents['removeListener'](_0x591cc8,_0x5c57aa);};}exports['register']=function(_0x410ee5){for(var _0x2fe1f6=0x0,_0x2cfd14=events[_0x02ea('0x4')];_0x2fe1f6<_0x2cfd14;_0x2fe1f6++){var _0xf80c1a=events[_0x2fe1f6];var _0x404066=createListener('whatsappQueue:'+_0xf80c1a,_0x410ee5);WhatsappQueueEvents['on'](_0xf80c1a,_0x404066);}}; \ No newline at end of file +var _0x9bef=['whatsappQueue:','./whatsappQueue.events','save','remove','emit','removeListener','length'];(function(_0x13fd57,_0x31c3ef){var _0x37e515=function(_0x213e0c){while(--_0x213e0c){_0x13fd57['push'](_0x13fd57['shift']());}};_0x37e515(++_0x31c3ef);}(_0x9bef,0xa2));var _0xf9be=function(_0x3138f8,_0x569f01){_0x3138f8=_0x3138f8-0x0;var _0x4b6a20=_0x9bef[_0x3138f8];return _0x4b6a20;};'use strict';var WhatsappQueueEvents=require(_0xf9be('0x0'));var events=[_0xf9be('0x1'),_0xf9be('0x2'),'update'];function createListener(_0xf32c7f,_0x402351){return function(_0x5e642e){_0x402351[_0xf9be('0x3')](_0xf32c7f,_0x5e642e);};}function removeListener(_0xdcd047,_0x20832d){return function(){WhatsappQueueEvents[_0xf9be('0x4')](_0xdcd047,_0x20832d);};}exports['register']=function(_0x30f005){for(var _0x3fc0fd=0x0,_0x4e06bd=events[_0xf9be('0x5')];_0x3fc0fd<_0x4e06bd;_0x3fc0fd++){var _0x52f9f6=events[_0x3fc0fd];var _0x254c68=createListener(_0xf9be('0x6')+_0x52f9f6,_0x30f005);WhatsappQueueEvents['on'](_0x52f9f6,_0x254c68);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 7e60570..8cc27fc 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 _0x14bd=['isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../config/environment','./whatsappQueueReport.controller','get'];(function(_0x1cd44a,_0x3b8662){var _0x1ffe4f=function(_0x43e284){while(--_0x43e284){_0x1cd44a['push'](_0x1cd44a['shift']());}};_0x1ffe4f(++_0x3b8662);}(_0x14bd,0x1b0));var _0xd14b=function(_0x1750a9,_0x373841){_0x1750a9=_0x1750a9-0x0;var _0x409942=_0x14bd[_0x1750a9];return _0x409942;};'use strict';var multer=require(_0xd14b('0x0'));var util=require(_0xd14b('0x1'));var path=require(_0xd14b('0x2'));var timeout=require(_0xd14b('0x3'));var express=require('express');var router=express[_0xd14b('0x4')]();var fs_extra=require(_0xd14b('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd14b('0x6'));var controller=require(_0xd14b('0x7'));router[_0xd14b('0x8')]('/',auth[_0xd14b('0x9')](),controller[_0xd14b('0xa')]);router[_0xd14b('0x8')](_0xd14b('0xb'),auth[_0xd14b('0x9')](),controller[_0xd14b('0xc')]);router[_0xd14b('0x8')](_0xd14b('0xd'),auth['isAuthenticated'](),controller[_0xd14b('0xe')]);router[_0xd14b('0xf')]('/',auth['isAuthenticated'](),controller[_0xd14b('0x10')]);router[_0xd14b('0x11')](_0xd14b('0xd'),auth[_0xd14b('0x9')](),controller[_0xd14b('0x12')]);router[_0xd14b('0x13')]('/:id',auth[_0xd14b('0x9')](),controller[_0xd14b('0x14')]);module['exports']=router; \ No newline at end of file +var _0x61f0=['get','isAuthenticated','index','/describe','describe','/:id','post','create','put','update','delete','destroy','exports','path','connect-timeout','Router','../../components/auth/service','./whatsappQueueReport.controller'];(function(_0x4ddfc9,_0x7aceaf){var _0x23ae50=function(_0x3aa9a1){while(--_0x3aa9a1){_0x4ddfc9['push'](_0x4ddfc9['shift']());}};_0x23ae50(++_0x7aceaf);}(_0x61f0,0x67));var _0x061f=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x61f0[_0x3b380d];return _0x54502b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x061f('0x0'));var timeout=require(_0x061f('0x1'));var express=require('express');var router=express[_0x061f('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x061f('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x061f('0x4'));router[_0x061f('0x5')]('/',auth[_0x061f('0x6')](),controller[_0x061f('0x7')]);router[_0x061f('0x5')](_0x061f('0x8'),auth['isAuthenticated'](),controller[_0x061f('0x9')]);router[_0x061f('0x5')](_0x061f('0xa'),auth[_0x061f('0x6')](),controller['show']);router[_0x061f('0xb')]('/',auth[_0x061f('0x6')](),controller[_0x061f('0xc')]);router[_0x061f('0xd')](_0x061f('0xa'),auth['isAuthenticated'](),controller[_0x061f('0xe')]);router[_0x061f('0xf')]('/:id',auth[_0x061f('0x6')](),controller[_0x061f('0x10')]);module[_0x061f('0x11')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 2742bcb..192dd9b 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['STRING','DATE','sequelize','exports'];(function(_0x25d7c8,_0x5e658d){var _0x3b1a2b=function(_0x7e5b1d){while(--_0x7e5b1d){_0x25d7c8['push'](_0x25d7c8['shift']());}};_0x3b1a2b(++_0x5e658d);}(_0x7a54,0x106));var _0x47a5=function(_0x3e6709,_0x38edc4){_0x3e6709=_0x3e6709-0x0;var _0xd98897=_0x7a54[_0x3e6709];return _0xd98897;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'uniqueid':{'type':Sequelize[_0x47a5('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x47a5('0x3')]},'leaveAt':{'type':Sequelize[_0x47a5('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x47a5('0x3')]},'reason':{'type':Sequelize[_0x47a5('0x2')]}}; \ No newline at end of file +var _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x4ea52a,_0x419ea1){var _0x1ac9d0=function(_0x52b11d){while(--_0x52b11d){_0x4ea52a['push'](_0x4ea52a['shift']());}};_0x1ac9d0(++_0x419ea1);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index eaf9801..effa1dc 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 _0x373d=['order','sort','pick','filter','where','VIRTUAL','merge','include','findAll','rows','show','rawAttributes','includeAll','options','catch','create','body','find','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','WhatsappQueueReport','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x133922,_0x8b4965){var _0xea7017=function(_0x513b83){while(--_0x513b83){_0x133922['push'](_0x133922['shift']());}};_0xea7017(++_0x8b4965);}(_0x373d,0x1e2));var _0xd373=function(_0x2634a7,_0x118508){_0x2634a7=_0x2634a7-0x0;var _0xa52e2c=_0x373d[_0x2634a7];return _0xa52e2c;};'use strict';var emlformat=require(_0xd373('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd373('0x1'));var jsonpatch=require(_0xd373('0x2'));var rp=require(_0xd373('0x3'));var moment=require(_0xd373('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd373('0x5'));var util=require(_0xd373('0x6'));var path=require(_0xd373('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd373('0x8'));var fs=require('fs');var fs_extra=require(_0xd373('0x9'));var _=require(_0xd373('0xa'));var squel=require(_0xd373('0xb'));var crypto=require('crypto');var jsforce=require(_0xd373('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd373('0xd'));var Redis=require(_0xd373('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xd373('0xf'));var as=require(_0xd373('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd373('0x11'));var utils=require(_0xd373('0x12'));var config=require(_0xd373('0x13'));var licenseUtil=require(_0xd373('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4c7f91,_0x5ab89c){_0x5ab89c=_0x5ab89c||0xcc;return function(_0xcd9b8c){if(_0xcd9b8c){return _0x4c7f91[_0xd373('0x15')](_0x5ab89c);}return _0x4c7f91['status'](_0x5ab89c)[_0xd373('0x16')]();};}function respondWithResult(_0x129475,_0x27c161){_0x27c161=_0x27c161||0xc8;return function(_0x23ed86){if(_0x23ed86){return _0x129475[_0xd373('0x17')](_0x27c161)[_0xd373('0x18')](_0x23ed86);}};}function respondWithFilteredResult(_0x20aca5,_0x2eacb1){return function(_0x5a286a){if(_0x5a286a){var _0x2c5854=typeof _0x2eacb1[_0xd373('0x19')]===_0xd373('0x1a')&&typeof _0x2eacb1[_0xd373('0x1b')]==='undefined';var _0x1e26cf=_0x5a286a['count'];var _0x460259=_0x2c5854?0x0:_0x2eacb1[_0xd373('0x19')];var _0x55c5c7=_0x2c5854?_0x5a286a[_0xd373('0x1c')]:_0x2eacb1['offset']+_0x2eacb1['limit'];var _0x23fada;if(_0x55c5c7>=_0x1e26cf){_0x55c5c7=_0x1e26cf;_0x23fada=0xc8;}else{_0x23fada=0xce;}_0x20aca5[_0xd373('0x17')](_0x23fada);return _0x20aca5[_0xd373('0x1d')](_0xd373('0x1e'),_0x460259+'-'+_0x55c5c7+'/'+_0x1e26cf)[_0xd373('0x18')](_0x5a286a);}return null;};}function patchUpdates(_0x181eb2){return function(_0x4ba510){try{jsonpatch[_0xd373('0x1f')](_0x4ba510,_0x181eb2,!![]);}catch(_0xd808f8){return BPromise[_0xd373('0x20')](_0xd808f8);}return _0x4ba510[_0xd373('0x21')]();};}function saveUpdates(_0x165e21,_0x3aa1c5){return function(_0x4f64bd){if(_0x4f64bd){return _0x4f64bd[_0xd373('0x22')](_0x165e21)[_0xd373('0x23')](function(_0x157f81){return _0x157f81;});}return null;};}function removeEntity(_0x209ca7,_0x217ee7){return function(_0x238ffd){if(_0x238ffd){return _0x238ffd[_0xd373('0x24')]()[_0xd373('0x23')](function(){_0x209ca7[_0xd373('0x17')](0xcc)[_0xd373('0x16')]();});}};}function handleEntityNotFound(_0x437110,_0x34f05a){return function(_0x388182){if(!_0x388182){_0x437110[_0xd373('0x15')](0x194);}return _0x388182;};}function handleError(_0x18d7ab,_0x38ba50){_0x38ba50=_0x38ba50||0x1f4;return function(_0x50b987){logger[_0xd373('0x25')](_0x50b987[_0xd373('0x26')]);if(_0x50b987[_0xd373('0x27')]){delete _0x50b987[_0xd373('0x27')];}_0x18d7ab[_0xd373('0x17')](_0x38ba50)[_0xd373('0x28')](_0x50b987);};}exports[_0xd373('0x29')]=function(_0xf85ca8,_0x2869e5){var _0x158825={},_0xbc420b={},_0x2ee37c={'count':0x0,'rows':[]};var _0x7dad3e=_['map'](db[_0xd373('0x2a')]['rawAttributes'],function(_0x498aaa){return{'name':_0x498aaa[_0xd373('0x2b')],'type':_0x498aaa[_0xd373('0x2c')][_0xd373('0x2d')]};});_0xbc420b[_0xd373('0x2e')]=_[_0xd373('0x2f')](_0x7dad3e,'name');_0xbc420b[_0xd373('0x30')]=_[_0xd373('0x31')](_0xf85ca8['query']);_0xbc420b[_0xd373('0x32')]=_[_0xd373('0x33')](_0xbc420b[_0xd373('0x2e')],_0xbc420b[_0xd373('0x30')]);_0x158825[_0xd373('0x34')]=_[_0xd373('0x33')](_0xbc420b[_0xd373('0x2e')],qs[_0xd373('0x35')](_0xf85ca8[_0xd373('0x30')]['fields']));_0x158825[_0xd373('0x34')]=_0x158825[_0xd373('0x34')][_0xd373('0x36')]?_0x158825[_0xd373('0x34')]:_0xbc420b[_0xd373('0x2e')];if(!_0xf85ca8[_0xd373('0x30')][_0xd373('0x37')](_0xd373('0x38'))){_0x158825[_0xd373('0x1b')]=qs[_0xd373('0x1b')](_0xf85ca8[_0xd373('0x30')][_0xd373('0x1b')]);_0x158825[_0xd373('0x19')]=qs[_0xd373('0x19')](_0xf85ca8[_0xd373('0x30')]['offset']);}_0x158825[_0xd373('0x39')]=qs[_0xd373('0x3a')](_0xf85ca8[_0xd373('0x30')][_0xd373('0x3a')]);_0x158825['where']=qs[_0xd373('0x32')](_[_0xd373('0x3b')](_0xf85ca8[_0xd373('0x30')],_0xbc420b[_0xd373('0x32')]),_0x7dad3e);if(_0xf85ca8[_0xd373('0x30')][_0xd373('0x3c')]){_0x158825['where']=_['merge'](_0x158825[_0xd373('0x3d')],{'$or':_['map'](_0x7dad3e,function(_0x37c97e){if(_0x37c97e[_0xd373('0x2c')]!==_0xd373('0x3e')){var _0x51ba69={};_0x51ba69[_0x37c97e[_0xd373('0x27')]]={'$like':'%'+_0xf85ca8[_0xd373('0x30')][_0xd373('0x3c')]+'%'};return _0x51ba69;}})});}_0x158825=_[_0xd373('0x3f')]({},_0x158825,_0xf85ca8['options']);var _0x513038={'where':_0x158825['where']};return db[_0xd373('0x2a')]['count'](_0x513038)[_0xd373('0x23')](function(_0x2fa6c4){_0x2ee37c['count']=_0x2fa6c4;if(_0xf85ca8['query']['includeAll']){_0x158825[_0xd373('0x40')]=[{'all':!![]}];}return db[_0xd373('0x2a')][_0xd373('0x41')](_0x158825);})['then'](function(_0x5c3b22){_0x2ee37c[_0xd373('0x42')]=_0x5c3b22;return _0x2ee37c;})[_0xd373('0x23')](respondWithFilteredResult(_0x2869e5,_0x158825))['catch'](handleError(_0x2869e5,null));};exports[_0xd373('0x43')]=function(_0x2ee75f,_0x1e3de1){var _0x9989e4={'raw':!![],'where':{'id':_0x2ee75f['params']['id']}},_0x2d8c7d={};_0x2d8c7d['model']=_[_0xd373('0x31')](db[_0xd373('0x2a')][_0xd373('0x44')]);_0x2d8c7d[_0xd373('0x30')]=_['keys'](_0x2ee75f[_0xd373('0x30')]);_0x2d8c7d['filters']=_[_0xd373('0x33')](_0x2d8c7d[_0xd373('0x2e')],_0x2d8c7d[_0xd373('0x30')]);_0x9989e4[_0xd373('0x34')]=_[_0xd373('0x33')](_0x2d8c7d['model'],qs[_0xd373('0x35')](_0x2ee75f[_0xd373('0x30')]['fields']));_0x9989e4[_0xd373('0x34')]=_0x9989e4[_0xd373('0x34')][_0xd373('0x36')]?_0x9989e4[_0xd373('0x34')]:_0x2d8c7d[_0xd373('0x2e')];if(_0x2ee75f[_0xd373('0x30')][_0xd373('0x45')]){_0x9989e4[_0xd373('0x40')]=[{'all':!![]}];}_0x9989e4=_[_0xd373('0x3f')]({},_0x9989e4,_0x2ee75f[_0xd373('0x46')]);return db['WhatsappQueueReport']['find'](_0x9989e4)[_0xd373('0x23')](handleEntityNotFound(_0x1e3de1,null))['then'](respondWithResult(_0x1e3de1,null))[_0xd373('0x47')](handleError(_0x1e3de1,null));};exports['create']=function(_0x5e5279,_0x5cbc16){return db[_0xd373('0x2a')][_0xd373('0x48')](_0x5e5279[_0xd373('0x49')],{})[_0xd373('0x23')](respondWithResult(_0x5cbc16,0xc9))[_0xd373('0x47')](handleError(_0x5cbc16,null));};exports[_0xd373('0x22')]=function(_0x1855aa,_0x4d1088){if(_0x1855aa[_0xd373('0x49')]['id']){delete _0x1855aa['body']['id'];}return db[_0xd373('0x2a')][_0xd373('0x4a')]({'where':{'id':_0x1855aa['params']['id']}})[_0xd373('0x23')](handleEntityNotFound(_0x4d1088,null))['then'](saveUpdates(_0x1855aa[_0xd373('0x49')],null))[_0xd373('0x23')](respondWithResult(_0x4d1088,null))[_0xd373('0x47')](handleError(_0x4d1088,null));};exports[_0xd373('0x24')]=function(_0xe22cbd,_0x4bc631){return db['WhatsappQueueReport']['find']({'where':{'id':_0xe22cbd[_0xd373('0x4b')]['id']}})[_0xd373('0x23')](handleEntityNotFound(_0x4bc631,null))['then'](removeEntity(_0x4bc631,null))[_0xd373('0x47')](handleError(_0x4bc631,null));};exports[_0xd373('0x4c')]=function(_0x4d7020,_0xae7067){return db[_0xd373('0x2a')][_0xd373('0x4c')]()[_0xd373('0x23')](respondWithResult(_0xae7067,null))[_0xd373('0x47')](handleError(_0xae7067,null));}; \ No newline at end of file +var _0xb03e=['destroy','error','stack','name','send','fieldName','query','keys','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','options','WhatsappQueueReport','includeAll','include','findAll','rows','catch','show','rawAttributes','create','body','find','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','save','update','then'];(function(_0x555552,_0x576279){var _0x5b280d=function(_0x2ef8ef){while(--_0x2ef8ef){_0x555552['push'](_0x555552['shift']());}};_0x5b280d(++_0x576279);}(_0xb03e,0x1eb));var _0xeb03=function(_0x1649dd,_0x2b7c73){_0x1649dd=_0x1649dd-0x0;var _0x518df7=_0xb03e[_0x1649dd];return _0x518df7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xeb03('0x0'));var zipdir=require(_0xeb03('0x1'));var jsonpatch=require(_0xeb03('0x2'));var rp=require(_0xeb03('0x3'));var moment=require(_0xeb03('0x4'));var BPromise=require(_0xeb03('0x5'));var Mustache=require(_0xeb03('0x6'));var util=require(_0xeb03('0x7'));var path=require(_0xeb03('0x8'));var sox=require(_0xeb03('0x9'));var csv=require(_0xeb03('0xa'));var ejs=require(_0xeb03('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xeb03('0xc'));var squel=require(_0xeb03('0xd'));var crypto=require(_0xeb03('0xe'));var jsforce=require(_0xeb03('0xf'));var deskjs=require(_0xeb03('0x10'));var toCsv=require(_0xeb03('0xa'));var querystring=require('querystring');var Papa=require(_0xeb03('0x11'));var Redis=require(_0xeb03('0x12'));var authService=require(_0xeb03('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xeb03('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xeb03('0x15'))(_0xeb03('0x16'));var utils=require(_0xeb03('0x17'));var config=require(_0xeb03('0x18'));var licenseUtil=require(_0xeb03('0x19'));var db=require(_0xeb03('0x1a'))['db'];function respondWithStatusCode(_0x367d36,_0x384cbe){_0x384cbe=_0x384cbe||0xcc;return function(_0x97f46d){if(_0x97f46d){return _0x367d36[_0xeb03('0x1b')](_0x384cbe);}return _0x367d36[_0xeb03('0x1c')](_0x384cbe)[_0xeb03('0x1d')]();};}function respondWithResult(_0x4d9c8e,_0x212082){_0x212082=_0x212082||0xc8;return function(_0x100bef){if(_0x100bef){return _0x4d9c8e[_0xeb03('0x1c')](_0x212082)[_0xeb03('0x1e')](_0x100bef);}};}function respondWithFilteredResult(_0x52be5b,_0x15f4fe){return function(_0x36f5d8){if(_0x36f5d8){var _0x3f26ef=typeof _0x15f4fe['offset']===_0xeb03('0x1f')&&typeof _0x15f4fe[_0xeb03('0x20')]===_0xeb03('0x1f');var _0x44716c=_0x36f5d8[_0xeb03('0x21')];var _0x1b4cbd=_0x3f26ef?0x0:_0x15f4fe[_0xeb03('0x22')];var _0x8d6725=_0x3f26ef?_0x36f5d8[_0xeb03('0x21')]:_0x15f4fe[_0xeb03('0x22')]+_0x15f4fe[_0xeb03('0x20')];var _0x2c238d;if(_0x8d6725>=_0x44716c){_0x8d6725=_0x44716c;_0x2c238d=0xc8;}else{_0x2c238d=0xce;}_0x52be5b[_0xeb03('0x1c')](_0x2c238d);return _0x52be5b[_0xeb03('0x23')]('Content-Range',_0x1b4cbd+'-'+_0x8d6725+'/'+_0x44716c)[_0xeb03('0x1e')](_0x36f5d8);}return null;};}function patchUpdates(_0x3855dd){return function(_0x413d3e){try{jsonpatch[_0xeb03('0x24')](_0x413d3e,_0x3855dd,!![]);}catch(_0xe5a1c2){return BPromise[_0xeb03('0x25')](_0xe5a1c2);}return _0x413d3e[_0xeb03('0x26')]();};}function saveUpdates(_0x2c795b,_0x3c3d09){return function(_0x5a704b){if(_0x5a704b){return _0x5a704b[_0xeb03('0x27')](_0x2c795b)[_0xeb03('0x28')](function(_0x11ea85){return _0x11ea85;});}return null;};}function removeEntity(_0x300dc0,_0x2f99e6){return function(_0x5dcda3){if(_0x5dcda3){return _0x5dcda3[_0xeb03('0x29')]()[_0xeb03('0x28')](function(){_0x300dc0[_0xeb03('0x1c')](0xcc)[_0xeb03('0x1d')]();});}};}function handleEntityNotFound(_0x3f276a,_0x119697){return function(_0xb04f34){if(!_0xb04f34){_0x3f276a[_0xeb03('0x1b')](0x194);}return _0xb04f34;};}function handleError(_0xbb7ff,_0x4984f6){_0x4984f6=_0x4984f6||0x1f4;return function(_0x832372){logger[_0xeb03('0x2a')](_0x832372[_0xeb03('0x2b')]);if(_0x832372[_0xeb03('0x2c')]){delete _0x832372['name'];}_0xbb7ff['status'](_0x4984f6)[_0xeb03('0x2d')](_0x832372);};}exports['index']=function(_0x31a622,_0x8bd544){var _0x160a37={},_0x5db8bb={},_0xd4c8ec={'count':0x0,'rows':[]};var _0x5de53a=_['map'](db['WhatsappQueueReport']['rawAttributes'],function(_0x421a27){return{'name':_0x421a27[_0xeb03('0x2e')],'type':_0x421a27['type']['key']};});_0x5db8bb['model']=_['map'](_0x5de53a,_0xeb03('0x2c'));_0x5db8bb[_0xeb03('0x2f')]=_[_0xeb03('0x30')](_0x31a622[_0xeb03('0x2f')]);_0x5db8bb[_0xeb03('0x31')]=_['intersection'](_0x5db8bb[_0xeb03('0x32')],_0x5db8bb['query']);_0x160a37[_0xeb03('0x33')]=_[_0xeb03('0x34')](_0x5db8bb[_0xeb03('0x32')],qs[_0xeb03('0x35')](_0x31a622[_0xeb03('0x2f')][_0xeb03('0x35')]));_0x160a37[_0xeb03('0x33')]=_0x160a37[_0xeb03('0x33')]['length']?_0x160a37[_0xeb03('0x33')]:_0x5db8bb['model'];if(!_0x31a622[_0xeb03('0x2f')][_0xeb03('0x36')](_0xeb03('0x37'))){_0x160a37[_0xeb03('0x20')]=qs[_0xeb03('0x20')](_0x31a622[_0xeb03('0x2f')]['limit']);_0x160a37[_0xeb03('0x22')]=qs['offset'](_0x31a622['query']['offset']);}_0x160a37[_0xeb03('0x38')]=qs[_0xeb03('0x39')](_0x31a622[_0xeb03('0x2f')][_0xeb03('0x39')]);_0x160a37[_0xeb03('0x3a')]=qs['filters'](_[_0xeb03('0x3b')](_0x31a622[_0xeb03('0x2f')],_0x5db8bb[_0xeb03('0x31')]),_0x5de53a);if(_0x31a622['query']['filter']){_0x160a37[_0xeb03('0x3a')]=_[_0xeb03('0x3c')](_0x160a37[_0xeb03('0x3a')],{'$or':_['map'](_0x5de53a,function(_0x328f72){if(_0x328f72[_0xeb03('0x3d')]!=='VIRTUAL'){var _0x49edb3={};_0x49edb3[_0x328f72[_0xeb03('0x2c')]]={'$like':'%'+_0x31a622[_0xeb03('0x2f')]['filter']+'%'};return _0x49edb3;}})});}_0x160a37=_[_0xeb03('0x3c')]({},_0x160a37,_0x31a622[_0xeb03('0x3e')]);var _0x3fa3de={'where':_0x160a37[_0xeb03('0x3a')]};return db[_0xeb03('0x3f')][_0xeb03('0x21')](_0x3fa3de)[_0xeb03('0x28')](function(_0x3c1c21){_0xd4c8ec[_0xeb03('0x21')]=_0x3c1c21;if(_0x31a622[_0xeb03('0x2f')][_0xeb03('0x40')]){_0x160a37[_0xeb03('0x41')]=[{'all':!![]}];}return db[_0xeb03('0x3f')][_0xeb03('0x42')](_0x160a37);})[_0xeb03('0x28')](function(_0x6b95dd){_0xd4c8ec[_0xeb03('0x43')]=_0x6b95dd;return _0xd4c8ec;})[_0xeb03('0x28')](respondWithFilteredResult(_0x8bd544,_0x160a37))[_0xeb03('0x44')](handleError(_0x8bd544,null));};exports[_0xeb03('0x45')]=function(_0x43e530,_0x2f83c3){var _0x2879b0={'raw':!![],'where':{'id':_0x43e530['params']['id']}},_0x5bb7d9={};_0x5bb7d9[_0xeb03('0x32')]=_[_0xeb03('0x30')](db[_0xeb03('0x3f')][_0xeb03('0x46')]);_0x5bb7d9[_0xeb03('0x2f')]=_[_0xeb03('0x30')](_0x43e530[_0xeb03('0x2f')]);_0x5bb7d9[_0xeb03('0x31')]=_['intersection'](_0x5bb7d9[_0xeb03('0x32')],_0x5bb7d9[_0xeb03('0x2f')]);_0x2879b0[_0xeb03('0x33')]=_[_0xeb03('0x34')](_0x5bb7d9[_0xeb03('0x32')],qs['fields'](_0x43e530['query'][_0xeb03('0x35')]));_0x2879b0['attributes']=_0x2879b0['attributes']['length']?_0x2879b0[_0xeb03('0x33')]:_0x5bb7d9[_0xeb03('0x32')];if(_0x43e530[_0xeb03('0x2f')][_0xeb03('0x40')]){_0x2879b0[_0xeb03('0x41')]=[{'all':!![]}];}_0x2879b0=_[_0xeb03('0x3c')]({},_0x2879b0,_0x43e530['options']);return db[_0xeb03('0x3f')]['find'](_0x2879b0)['then'](handleEntityNotFound(_0x2f83c3,null))[_0xeb03('0x28')](respondWithResult(_0x2f83c3,null))[_0xeb03('0x44')](handleError(_0x2f83c3,null));};exports[_0xeb03('0x47')]=function(_0x54d7ce,_0x404191){return db[_0xeb03('0x3f')][_0xeb03('0x47')](_0x54d7ce[_0xeb03('0x48')],{})[_0xeb03('0x28')](respondWithResult(_0x404191,0xc9))['catch'](handleError(_0x404191,null));};exports[_0xeb03('0x27')]=function(_0x4dc1f6,_0x13c295){if(_0x4dc1f6[_0xeb03('0x48')]['id']){delete _0x4dc1f6[_0xeb03('0x48')]['id'];}return db[_0xeb03('0x3f')][_0xeb03('0x49')]({'where':{'id':_0x4dc1f6[_0xeb03('0x4a')]['id']}})[_0xeb03('0x28')](handleEntityNotFound(_0x13c295,null))[_0xeb03('0x28')](saveUpdates(_0x4dc1f6[_0xeb03('0x48')],null))[_0xeb03('0x28')](respondWithResult(_0x13c295,null))[_0xeb03('0x44')](handleError(_0x13c295,null));};exports[_0xeb03('0x29')]=function(_0x2f2066,_0x345a98){return db[_0xeb03('0x3f')][_0xeb03('0x49')]({'where':{'id':_0x2f2066[_0xeb03('0x4a')]['id']}})[_0xeb03('0x28')](handleEntityNotFound(_0x345a98,null))[_0xeb03('0x28')](removeEntity(_0x345a98,null))[_0xeb03('0x44')](handleError(_0x345a98,null));};exports[_0xeb03('0x4b')]=function(_0x333fba,_0x1761ab){return db[_0xeb03('0x3f')]['describe']()[_0xeb03('0x28')](respondWithResult(_0x1761ab,null))[_0xeb03('0x44')](handleError(_0x1761ab,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 8354249..85d13ef 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 _0x80dd=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid'];(function(_0x4c9168,_0x380c8a){var _0x6dd1=function(_0x4d0131){while(--_0x4d0131){_0x4c9168['push'](_0x4c9168['shift']());}};_0x6dd1(++_0x380c8a);}(_0x80dd,0xa5));var _0xd80d=function(_0x3bd107,_0x280907){_0x3bd107=_0x3bd107-0x0;var _0x3b7443=_0x80dd[_0x3bd107];return _0x3b7443;};'use strict';var _=require(_0xd80d('0x0'));var util=require(_0xd80d('0x1'));var logger=require('../../config/logger')(_0xd80d('0x2'));var moment=require(_0xd80d('0x3'));var BPromise=require(_0xd80d('0x4'));var rp=require(_0xd80d('0x5'));var fs=require('fs');var path=require(_0xd80d('0x6'));var rimraf=require(_0xd80d('0x7'));var config=require(_0xd80d('0x8'));var attributes=require(_0xd80d('0x9'));module[_0xd80d('0xa')]=function(_0x5ee0e7,_0x14c256){return _0x5ee0e7[_0xd80d('0xb')](_0xd80d('0xc'),attributes,{'tableName':_0xd80d('0xd'),'paranoid':![],'indexes':[{'name':_0xd80d('0xe'),'fields':[_0xd80d('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xee29=['../../config/logger','api','bluebird','path','rimraf','../../config/environment','./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport','uniqueid','lodash','util'];(function(_0x24e428,_0x43bfae){var _0xfe15d2=function(_0x5c2690){while(--_0x5c2690){_0x24e428['push'](_0x24e428['shift']());}};_0xfe15d2(++_0x43bfae);}(_0xee29,0x1d2));var _0x9ee2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xee29[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x9ee2('0x0'));var util=require(_0x9ee2('0x1'));var logger=require(_0x9ee2('0x2'))(_0x9ee2('0x3'));var moment=require('moment');var BPromise=require(_0x9ee2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9ee2('0x5'));var rimraf=require(_0x9ee2('0x6'));var config=require(_0x9ee2('0x7'));var attributes=require(_0x9ee2('0x8'));module[_0x9ee2('0x9')]=function(_0x24ca28,_0x30e4e7){return _0x24ca28[_0x9ee2('0xa')](_0x9ee2('0xb'),attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':_0x9ee2('0xc'),'fields':[_0x9ee2('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 096d6a1..43c7b8f 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 _0x4ea6=['../../config/environment','jayson/promise','client','http','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','body','options','raw','debug','UpdateWhatsappQueueReport','update','where','attributes','limit','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x26bf33,_0xb8c458){var _0x2c916e=function(_0x529809){while(--_0x529809){_0x26bf33['push'](_0x26bf33['shift']());}};_0x2c916e(++_0xb8c458);}(_0x4ea6,0x7c));var _0x64ea=function(_0x166d93,_0x301f09){_0x166d93=_0x166d93-0x0;var _0xba708=_0x4ea6[_0x166d93];return _0xba708;};'use strict';var _=require(_0x64ea('0x0'));var util=require('util');var moment=require(_0x64ea('0x1'));var BPromise=require(_0x64ea('0x2'));var rs=require(_0x64ea('0x3'));var fs=require('fs');var Redis=require(_0x64ea('0x4'));var db=require(_0x64ea('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x64ea('0x6'))(_0x64ea('0x7'));var config=require(_0x64ea('0x8'));var jayson=require(_0x64ea('0x9'));var client=jayson[_0x64ea('0xa')][_0x64ea('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4adc93,_0x80cef1,_0x3e1f7e){return new BPromise(function(_0x34b176,_0x801b15){return client['request'](_0x4adc93,_0x3e1f7e)[_0x64ea('0xc')](function(_0x4925f2){logger[_0x64ea('0xd')](_0x64ea('0xe'),_0x80cef1,_0x64ea('0xf'));logger['debug']('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x80cef1,_0x64ea('0xf'),JSON[_0x64ea('0x10')](_0x4925f2));if(_0x4925f2['error']){if(_0x4925f2[_0x64ea('0x11')][_0x64ea('0x12')]===0x1f4){logger[_0x64ea('0x11')]('WhatsappQueueReport,\x20%s,\x20%s',_0x80cef1,_0x4925f2[_0x64ea('0x11')][_0x64ea('0x13')]);return _0x801b15(_0x4925f2['error'][_0x64ea('0x13')]);}logger['error']('WhatsappQueueReport,\x20%s,\x20%s',_0x80cef1,_0x4925f2[_0x64ea('0x11')][_0x64ea('0x13')]);return _0x34b176(_0x4925f2['error'][_0x64ea('0x13')]);}else{logger[_0x64ea('0xd')]('WhatsappQueueReport,\x20%s,\x20%s',_0x80cef1,_0x64ea('0xf'));_0x34b176(_0x4925f2[_0x64ea('0x14')][_0x64ea('0x13')]);}})[_0x64ea('0x15')](function(_0x59c33b){logger[_0x64ea('0x11')](_0x64ea('0xe'),_0x80cef1,_0x59c33b);_0x801b15(_0x59c33b);});});}exports[_0x64ea('0x16')]=function(_0x184170){var _0x40c472=this;return new Promise(function(_0x12cc2d,_0x5be942){return db[_0x64ea('0x17')]['create'](_0x184170[_0x64ea('0x18')],{'raw':_0x184170[_0x64ea('0x19')]?_0x184170[_0x64ea('0x19')][_0x64ea('0x1a')]===undefined?!![]:![]:!![]})[_0x64ea('0xc')](function(_0x5ee52c){logger[_0x64ea('0xd')](_0x64ea('0x16'),_0x184170);logger[_0x64ea('0x1b')](_0x64ea('0x16'),_0x184170,JSON[_0x64ea('0x10')](_0x5ee52c));_0x12cc2d(_0x5ee52c);})[_0x64ea('0x15')](function(_0x2381e8){logger[_0x64ea('0x11')]('CreateWhatsappQueueReport',_0x2381e8[_0x64ea('0x13')],_0x184170);_0x5be942(_0x40c472['error'](0x1f4,_0x2381e8[_0x64ea('0x13')]));});});};exports[_0x64ea('0x1c')]=function(_0x3ce0d6){var _0x402f7c=this;return new Promise(function(_0x1beb7f,_0x2d3113){return db[_0x64ea('0x17')][_0x64ea('0x1d')](_0x3ce0d6[_0x64ea('0x18')],{'raw':_0x3ce0d6['options']?_0x3ce0d6[_0x64ea('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3ce0d6[_0x64ea('0x19')]?_0x3ce0d6['options'][_0x64ea('0x1e')]||null:null,'attributes':_0x3ce0d6[_0x64ea('0x19')]?_0x3ce0d6[_0x64ea('0x19')][_0x64ea('0x1f')]||null:null,'limit':_0x3ce0d6[_0x64ea('0x19')]?_0x3ce0d6[_0x64ea('0x19')][_0x64ea('0x20')]||null:null})['then'](function(_0x5ce547){logger[_0x64ea('0xd')](_0x64ea('0x1c'),_0x3ce0d6);logger[_0x64ea('0x1b')]('UpdateWhatsappQueueReport',_0x3ce0d6,JSON[_0x64ea('0x10')](_0x5ce547));_0x1beb7f(_0x5ce547);})['catch'](function(_0x2b6c38){logger['error'](_0x64ea('0x1c'),_0x2b6c38[_0x64ea('0x13')],_0x3ce0d6);_0x2d3113(_0x402f7c[_0x64ea('0x11')](0x1f4,_0x2b6c38['message']));});});}; \ No newline at end of file +var _0x823a=['catch','UpdateWhatsappQueueReport','update','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','WhatsappQueueReport,\x20%s,\x20%s','message','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','raw'];(function(_0xb7a71f,_0xdb3ac1){var _0x346f5a=function(_0xa96cd){while(--_0xa96cd){_0xb7a71f['push'](_0xb7a71f['shift']());}};_0x346f5a(++_0xdb3ac1);}(_0x823a,0x14a));var _0xa823=function(_0x879e31,_0x139d02){_0x879e31=_0x879e31-0x0;var _0x3467e8=_0x823a[_0x879e31];return _0x3467e8;};'use strict';var _=require(_0xa823('0x0'));var util=require(_0xa823('0x1'));var moment=require(_0xa823('0x2'));var BPromise=require(_0xa823('0x3'));var rs=require(_0xa823('0x4'));var fs=require('fs');var Redis=require(_0xa823('0x5'));var db=require(_0xa823('0x6'))['db'];var utils=require(_0xa823('0x7'));var logger=require(_0xa823('0x8'))(_0xa823('0x9'));var config=require(_0xa823('0xa'));var jayson=require(_0xa823('0xb'));var client=jayson[_0xa823('0xc')][_0xa823('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x3e6049,_0x5d1591,_0x3724fa){return new BPromise(function(_0x1dc85e,_0x5b0a6f){return client[_0xa823('0xe')](_0x3e6049,_0x3724fa)[_0xa823('0xf')](function(_0x5c486f){logger[_0xa823('0x10')]('WhatsappQueueReport,\x20%s,\x20%s',_0x5d1591,_0xa823('0x11'));logger[_0xa823('0x12')](_0xa823('0x13'),_0x5d1591,_0xa823('0x11'),JSON[_0xa823('0x14')](_0x5c486f));if(_0x5c486f[_0xa823('0x15')]){if(_0x5c486f[_0xa823('0x15')]['code']===0x1f4){logger[_0xa823('0x15')](_0xa823('0x16'),_0x5d1591,_0x5c486f[_0xa823('0x15')][_0xa823('0x17')]);return _0x5b0a6f(_0x5c486f['error'][_0xa823('0x17')]);}logger[_0xa823('0x15')](_0xa823('0x16'),_0x5d1591,_0x5c486f[_0xa823('0x15')][_0xa823('0x17')]);return _0x1dc85e(_0x5c486f[_0xa823('0x15')][_0xa823('0x17')]);}else{logger[_0xa823('0x10')](_0xa823('0x16'),_0x5d1591,_0xa823('0x11'));_0x1dc85e(_0x5c486f['result'][_0xa823('0x17')]);}})['catch'](function(_0x20ca5d){logger[_0xa823('0x15')]('WhatsappQueueReport,\x20%s,\x20%s',_0x5d1591,_0x20ca5d);_0x5b0a6f(_0x20ca5d);});});}exports[_0xa823('0x18')]=function(_0x2995a4){var _0x191282=this;return new Promise(function(_0x41ce0d,_0x22669b){return db[_0xa823('0x19')][_0xa823('0x1a')](_0x2995a4[_0xa823('0x1b')],{'raw':_0x2995a4['options']?_0x2995a4[_0xa823('0x1c')][_0xa823('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x515bc1){logger[_0xa823('0x10')](_0xa823('0x18'),_0x2995a4);logger[_0xa823('0x12')](_0xa823('0x18'),_0x2995a4,JSON[_0xa823('0x14')](_0x515bc1));_0x41ce0d(_0x515bc1);})[_0xa823('0x1e')](function(_0x35caad){logger['error'](_0xa823('0x18'),_0x35caad[_0xa823('0x17')],_0x2995a4);_0x22669b(_0x191282[_0xa823('0x15')](0x1f4,_0x35caad[_0xa823('0x17')]));});});};exports[_0xa823('0x1f')]=function(_0x5b5c56){var _0x375455=this;return new Promise(function(_0x378d78,_0x152286){return db['WhatsappQueueReport'][_0xa823('0x20')](_0x5b5c56['body'],{'raw':_0x5b5c56['options']?_0x5b5c56[_0xa823('0x1c')][_0xa823('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5b5c56[_0xa823('0x1c')]?_0x5b5c56[_0xa823('0x1c')][_0xa823('0x21')]||null:null,'attributes':_0x5b5c56[_0xa823('0x1c')]?_0x5b5c56[_0xa823('0x1c')][_0xa823('0x22')]||null:null,'limit':_0x5b5c56[_0xa823('0x1c')]?_0x5b5c56[_0xa823('0x1c')][_0xa823('0x23')]||null:null})[_0xa823('0xf')](function(_0x96fa6f){logger['info'](_0xa823('0x1f'),_0x5b5c56);logger[_0xa823('0x12')]('UpdateWhatsappQueueReport',_0x5b5c56,JSON[_0xa823('0x14')](_0x96fa6f));_0x378d78(_0x96fa6f);})[_0xa823('0x1e')](function(_0x2edb04){logger[_0xa823('0x15')]('UpdateWhatsappQueueReport',_0x2edb04[_0xa823('0x17')],_0x5b5c56);_0x152286(_0x375455[_0xa823('0x15')](0x1f4,_0x2edb04['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 1701a71..15dee2c 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 _0xc65a=['update','destroy','exports','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','isAuthenticated','get','describe','show','post','put','/:id'];(function(_0xadc756,_0x2ccf88){var _0xe74dd5=function(_0x55c4b6){while(--_0x55c4b6){_0xadc756['push'](_0xadc756['shift']());}};_0xe74dd5(++_0x2ccf88);}(_0xc65a,0x133));var _0xac65=function(_0x458329,_0x38c463){_0x458329=_0x458329-0x0;var _0xe7e4a0=_0xc65a[_0x458329];return _0xe7e4a0;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xac65('0x0'));var router=express[_0xac65('0x1')]();var fs_extra=require('fs-extra');var auth=require(_0xac65('0x2'));var interaction=require(_0xac65('0x3'));var config=require(_0xac65('0x4'));var controller=require(_0xac65('0x5'));router['get']('/',auth[_0xac65('0x6')](),controller['index']);router[_0xac65('0x7')]('/describe',auth['isAuthenticated'](),controller[_0xac65('0x8')]);router[_0xac65('0x7')]('/:id',auth[_0xac65('0x6')](),controller[_0xac65('0x9')]);router[_0xac65('0xa')]('/',auth['isAuthenticated'](),controller['create']);router[_0xac65('0xb')](_0xac65('0xc'),auth[_0xac65('0x6')](),controller[_0xac65('0xd')]);router['delete'](_0xac65('0xc'),auth['isAuthenticated'](),controller[_0xac65('0xe')]);module[_0xac65('0xf')]=router; \ No newline at end of file +var _0x499c=['connect-timeout','express','Router','../../config/environment','./whatsappTransferReport.controller','get','index','isAuthenticated','describe','/:id','show','post','put','update','delete','exports','multer','util','path'];(function(_0x5e0914,_0x481afe){var _0x5eebff=function(_0x34c6f3){while(--_0x34c6f3){_0x5e0914['push'](_0x5e0914['shift']());}};_0x5eebff(++_0x481afe);}(_0x499c,0xe1));var _0xc499=function(_0x472e85,_0x5a8191){_0x472e85=_0x472e85-0x0;var _0x3109f1=_0x499c[_0x472e85];return _0x3109f1;};'use strict';var multer=require(_0xc499('0x0'));var util=require(_0xc499('0x1'));var path=require(_0xc499('0x2'));var timeout=require(_0xc499('0x3'));var express=require(_0xc499('0x4'));var router=express[_0xc499('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc499('0x6'));var controller=require(_0xc499('0x7'));router[_0xc499('0x8')]('/',auth['isAuthenticated'](),controller[_0xc499('0x9')]);router[_0xc499('0x8')]('/describe',auth[_0xc499('0xa')](),controller[_0xc499('0xb')]);router['get'](_0xc499('0xc'),auth[_0xc499('0xa')](),controller[_0xc499('0xd')]);router[_0xc499('0xe')]('/',auth[_0xc499('0xa')](),controller['create']);router[_0xc499('0xf')](_0xc499('0xc'),auth['isAuthenticated'](),controller[_0xc499('0x10')]);router[_0xc499('0x11')](_0xc499('0xc'),auth[_0xc499('0xa')](),controller['destroy']);module[_0xc499('0x12')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 508bcbc..69308f3 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 _0xac35=['DATE','sequelize','exports','STRING','ENUM','account','agent','queue'];(function(_0x1734e2,_0x1cc2f5){var _0x1d7d5f=function(_0x2669d1){while(--_0x2669d1){_0x1734e2['push'](_0x1734e2['shift']());}};_0x1d7d5f(++_0x1cc2f5);}(_0xac35,0x141));var _0x5ac3=function(_0x555431,_0x24a7f6){_0x555431=_0x555431-0x0;var _0x5da873=_0xac35[_0x555431];return _0x5da873;};'use strict';var Sequelize=require(_0x5ac3('0x0'));module[_0x5ac3('0x1')]={'uniqueid':{'type':Sequelize[_0x5ac3('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x5ac3('0x3')](_0x5ac3('0x4'),_0x5ac3('0x5'),_0x5ac3('0x6')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x5ac3('0x7')]}}; \ No newline at end of file +var _0x5d86=['account','queue','DATE','sequelize','exports'];(function(_0x2ec37e,_0x93586a){var _0x3c5980=function(_0x555fb8){while(--_0x555fb8){_0x2ec37e['push'](_0x2ec37e['shift']());}};_0x3c5980(++_0x93586a);}(_0x5d86,0x76));var _0x65d8=function(_0x31659b,_0x3f07a1){_0x31659b=_0x31659b-0x0;var _0x48b140=_0x5d86[_0x31659b];return _0x48b140;};'use strict';var Sequelize=require(_0x65d8('0x0'));module[_0x65d8('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x65d8('0x2'),'agent',_0x65d8('0x3')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x65d8('0x4')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 1f5ce05..cfff6d5 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 _0xd190=['type','merge','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','find','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','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','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','Content-Range','json','apply','save','update','then','destroy','end','error','send','index','map','WhatsappTransferReport','fieldName','key','name','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter'];(function(_0x25e1d2,_0x3d90b){var _0x2dd86=function(_0x77b497){while(--_0x77b497){_0x25e1d2['push'](_0x25e1d2['shift']());}};_0x2dd86(++_0x3d90b);}(_0xd190,0xa7));var _0x0d19=function(_0x19e087,_0x18c45a){_0x19e087=_0x19e087-0x0;var _0x5b0033=_0xd190[_0x19e087];return _0x5b0033;};'use strict';var emlformat=require(_0x0d19('0x0'));var rimraf=require(_0x0d19('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0d19('0x2'));var rp=require(_0x0d19('0x3'));var moment=require(_0x0d19('0x4'));var BPromise=require(_0x0d19('0x5'));var Mustache=require(_0x0d19('0x6'));var util=require(_0x0d19('0x7'));var path=require('path');var sox=require(_0x0d19('0x8'));var csv=require(_0x0d19('0x9'));var ejs=require(_0x0d19('0xa'));var fs=require('fs');var fs_extra=require(_0x0d19('0xb'));var _=require('lodash');var squel=require(_0x0d19('0xc'));var crypto=require(_0x0d19('0xd'));var jsforce=require(_0x0d19('0xe'));var deskjs=require(_0x0d19('0xf'));var toCsv=require(_0x0d19('0x9'));var querystring=require(_0x0d19('0x10'));var Papa=require(_0x0d19('0x11'));var Redis=require(_0x0d19('0x12'));var authService=require(_0x0d19('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x0d19('0x14'));var hardwareService=require(_0x0d19('0x15'));var logger=require(_0x0d19('0x16'))(_0x0d19('0x17'));var utils=require(_0x0d19('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x0d19('0x19'));var db=require(_0x0d19('0x1a'))['db'];function respondWithStatusCode(_0x2188e1,_0x12c143){_0x12c143=_0x12c143||0xcc;return function(_0x42cc12){if(_0x42cc12){return _0x2188e1[_0x0d19('0x1b')](_0x12c143);}return _0x2188e1[_0x0d19('0x1c')](_0x12c143)['end']();};}function respondWithResult(_0x45ffc1,_0x4018e8){_0x4018e8=_0x4018e8||0xc8;return function(_0x5a007d){if(_0x5a007d){return _0x45ffc1[_0x0d19('0x1c')](_0x4018e8)['json'](_0x5a007d);}};}function respondWithFilteredResult(_0x18d4f9,_0x34fabc){return function(_0x351890){if(_0x351890){var _0x4c63aa=typeof _0x34fabc[_0x0d19('0x1d')]===_0x0d19('0x1e')&&typeof _0x34fabc[_0x0d19('0x1f')]===_0x0d19('0x1e');var _0x9981c=_0x351890[_0x0d19('0x20')];var _0x43763e=_0x4c63aa?0x0:_0x34fabc['offset'];var _0x3d3313=_0x4c63aa?_0x351890[_0x0d19('0x20')]:_0x34fabc[_0x0d19('0x1d')]+_0x34fabc[_0x0d19('0x1f')];var _0x2b56fb;if(_0x3d3313>=_0x9981c){_0x3d3313=_0x9981c;_0x2b56fb=0xc8;}else{_0x2b56fb=0xce;}_0x18d4f9[_0x0d19('0x1c')](_0x2b56fb);return _0x18d4f9['set'](_0x0d19('0x21'),_0x43763e+'-'+_0x3d3313+'/'+_0x9981c)[_0x0d19('0x22')](_0x351890);}return null;};}function patchUpdates(_0xfa5f6e){return function(_0x394d01){try{jsonpatch[_0x0d19('0x23')](_0x394d01,_0xfa5f6e,!![]);}catch(_0x459434){return BPromise['reject'](_0x459434);}return _0x394d01[_0x0d19('0x24')]();};}function saveUpdates(_0x33d37c,_0x2f3189){return function(_0x42afdd){if(_0x42afdd){return _0x42afdd[_0x0d19('0x25')](_0x33d37c)[_0x0d19('0x26')](function(_0xdf96bf){return _0xdf96bf;});}return null;};}function removeEntity(_0xd45eb8,_0x36840d){return function(_0x3a1c91){if(_0x3a1c91){return _0x3a1c91[_0x0d19('0x27')]()[_0x0d19('0x26')](function(){_0xd45eb8[_0x0d19('0x1c')](0xcc)[_0x0d19('0x28')]();});}};}function handleEntityNotFound(_0x23b203,_0x1f3157){return function(_0x1d7c94){if(!_0x1d7c94){_0x23b203['sendStatus'](0x194);}return _0x1d7c94;};}function handleError(_0x445e22,_0x4c6699){_0x4c6699=_0x4c6699||0x1f4;return function(_0x38d31c){logger[_0x0d19('0x29')](_0x38d31c['stack']);if(_0x38d31c['name']){delete _0x38d31c['name'];}_0x445e22[_0x0d19('0x1c')](_0x4c6699)[_0x0d19('0x2a')](_0x38d31c);};}exports[_0x0d19('0x2b')]=function(_0x548acd,_0x23b23a){var _0x1c342c={},_0x4e27ec={},_0x1459ed={'count':0x0,'rows':[]};var _0x5022ac=_[_0x0d19('0x2c')](db[_0x0d19('0x2d')]['rawAttributes'],function(_0x437803){return{'name':_0x437803[_0x0d19('0x2e')],'type':_0x437803['type'][_0x0d19('0x2f')]};});_0x4e27ec['model']=_[_0x0d19('0x2c')](_0x5022ac,_0x0d19('0x30'));_0x4e27ec[_0x0d19('0x31')]=_[_0x0d19('0x32')](_0x548acd[_0x0d19('0x31')]);_0x4e27ec[_0x0d19('0x33')]=_['intersection'](_0x4e27ec[_0x0d19('0x34')],_0x4e27ec['query']);_0x1c342c[_0x0d19('0x35')]=_[_0x0d19('0x36')](_0x4e27ec[_0x0d19('0x34')],qs[_0x0d19('0x37')](_0x548acd['query'][_0x0d19('0x37')]));_0x1c342c[_0x0d19('0x35')]=_0x1c342c[_0x0d19('0x35')][_0x0d19('0x38')]?_0x1c342c[_0x0d19('0x35')]:_0x4e27ec[_0x0d19('0x34')];if(!_0x548acd[_0x0d19('0x31')][_0x0d19('0x39')](_0x0d19('0x3a'))){_0x1c342c[_0x0d19('0x1f')]=qs[_0x0d19('0x1f')](_0x548acd[_0x0d19('0x31')][_0x0d19('0x1f')]);_0x1c342c['offset']=qs[_0x0d19('0x1d')](_0x548acd[_0x0d19('0x31')][_0x0d19('0x1d')]);}_0x1c342c[_0x0d19('0x3b')]=qs[_0x0d19('0x3c')](_0x548acd[_0x0d19('0x31')]['sort']);_0x1c342c[_0x0d19('0x3d')]=qs['filters'](_[_0x0d19('0x3e')](_0x548acd['query'],_0x4e27ec[_0x0d19('0x33')]),_0x5022ac);if(_0x548acd['query'][_0x0d19('0x3f')]){_0x1c342c['where']=_['merge'](_0x1c342c[_0x0d19('0x3d')],{'$or':_[_0x0d19('0x2c')](_0x5022ac,function(_0x50bc6f){if(_0x50bc6f[_0x0d19('0x40')]!=='VIRTUAL'){var _0x1701e5={};_0x1701e5[_0x50bc6f[_0x0d19('0x30')]]={'$like':'%'+_0x548acd[_0x0d19('0x31')]['filter']+'%'};return _0x1701e5;}})});}_0x1c342c=_[_0x0d19('0x41')]({},_0x1c342c,_0x548acd['options']);var _0x3f69c={'where':_0x1c342c[_0x0d19('0x3d')]};return db[_0x0d19('0x2d')][_0x0d19('0x20')](_0x3f69c)[_0x0d19('0x26')](function(_0x4ca828){_0x1459ed[_0x0d19('0x20')]=_0x4ca828;if(_0x548acd[_0x0d19('0x31')][_0x0d19('0x42')]){_0x1c342c[_0x0d19('0x43')]=[{'all':!![]}];}return db['WhatsappTransferReport'][_0x0d19('0x44')](_0x1c342c);})['then'](function(_0x1bf668){_0x1459ed[_0x0d19('0x45')]=_0x1bf668;return _0x1459ed;})[_0x0d19('0x26')](respondWithFilteredResult(_0x23b23a,_0x1c342c))[_0x0d19('0x46')](handleError(_0x23b23a,null));};exports[_0x0d19('0x47')]=function(_0x42ad74,_0x403068){var _0x86f73e={'raw':!![],'where':{'id':_0x42ad74[_0x0d19('0x48')]['id']}},_0x380604={};_0x380604[_0x0d19('0x34')]=_[_0x0d19('0x32')](db[_0x0d19('0x2d')][_0x0d19('0x49')]);_0x380604[_0x0d19('0x31')]=_[_0x0d19('0x32')](_0x42ad74[_0x0d19('0x31')]);_0x380604[_0x0d19('0x33')]=_['intersection'](_0x380604[_0x0d19('0x34')],_0x380604['query']);_0x86f73e[_0x0d19('0x35')]=_[_0x0d19('0x36')](_0x380604[_0x0d19('0x34')],qs[_0x0d19('0x37')](_0x42ad74[_0x0d19('0x31')][_0x0d19('0x37')]));_0x86f73e[_0x0d19('0x35')]=_0x86f73e[_0x0d19('0x35')]['length']?_0x86f73e[_0x0d19('0x35')]:_0x380604['model'];if(_0x42ad74[_0x0d19('0x31')][_0x0d19('0x42')]){_0x86f73e[_0x0d19('0x43')]=[{'all':!![]}];}_0x86f73e=_['merge']({},_0x86f73e,_0x42ad74['options']);return db[_0x0d19('0x2d')]['find'](_0x86f73e)[_0x0d19('0x26')](handleEntityNotFound(_0x403068,null))[_0x0d19('0x26')](respondWithResult(_0x403068,null))['catch'](handleError(_0x403068,null));};exports[_0x0d19('0x4a')]=function(_0x3ac1f7,_0x35cde6){return db[_0x0d19('0x2d')][_0x0d19('0x4a')](_0x3ac1f7['body'],{})[_0x0d19('0x26')](respondWithResult(_0x35cde6,0xc9))[_0x0d19('0x46')](handleError(_0x35cde6,null));};exports['update']=function(_0x2799bf,_0x1c599c){if(_0x2799bf[_0x0d19('0x4b')]['id']){delete _0x2799bf['body']['id'];}return db[_0x0d19('0x2d')][_0x0d19('0x4c')]({'where':{'id':_0x2799bf['params']['id']}})[_0x0d19('0x26')](handleEntityNotFound(_0x1c599c,null))[_0x0d19('0x26')](saveUpdates(_0x2799bf[_0x0d19('0x4b')],null))['then'](respondWithResult(_0x1c599c,null))[_0x0d19('0x46')](handleError(_0x1c599c,null));};exports[_0x0d19('0x27')]=function(_0x1ac58d,_0x30c514){return db['WhatsappTransferReport']['find']({'where':{'id':_0x1ac58d['params']['id']}})[_0x0d19('0x26')](handleEntityNotFound(_0x30c514,null))[_0x0d19('0x26')](removeEntity(_0x30c514,null))['catch'](handleError(_0x30c514,null));};exports['describe']=function(_0x4349e3,_0x49700d){return db['WhatsappTransferReport']['describe']()[_0x0d19('0x26')](respondWithResult(_0x49700d,null))['catch'](handleError(_0x49700d,null));}; \ No newline at end of file +var _0xcead=['api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','reject','save','then','error','stack','send','map','WhatsappTransferReport','fieldName','key','name','query','keys','model','intersection','fields','attributes','length','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','rawAttributes','options','find','create','body','params','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x87fcc8,_0x21918e){var _0x5cb1dc=function(_0x139fbf){while(--_0x139fbf){_0x87fcc8['push'](_0x87fcc8['shift']());}};_0x5cb1dc(++_0x21918e);}(_0xcead,0x160));var _0xdcea=function(_0x1ae1fb,_0x81c2ec){_0x1ae1fb=_0x1ae1fb-0x0;var _0x57166=_0xcead[_0x1ae1fb];return _0x57166;};'use strict';var emlformat=require(_0xdcea('0x0'));var rimraf=require(_0xdcea('0x1'));var zipdir=require(_0xdcea('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdcea('0x3'));var moment=require(_0xdcea('0x4'));var BPromise=require(_0xdcea('0x5'));var Mustache=require(_0xdcea('0x6'));var util=require(_0xdcea('0x7'));var path=require(_0xdcea('0x8'));var sox=require(_0xdcea('0x9'));var csv=require('to-csv');var ejs=require(_0xdcea('0xa'));var fs=require('fs');var fs_extra=require(_0xdcea('0xb'));var _=require(_0xdcea('0xc'));var squel=require(_0xdcea('0xd'));var crypto=require(_0xdcea('0xe'));var jsforce=require(_0xdcea('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xdcea('0x10'));var querystring=require('querystring');var Papa=require(_0xdcea('0x11'));var Redis=require(_0xdcea('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xdcea('0x13'));var as=require(_0xdcea('0x14'));var hardwareService=require(_0xdcea('0x15'));var logger=require(_0xdcea('0x16'))(_0xdcea('0x17'));var utils=require('../../config/utils');var config=require(_0xdcea('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xdcea('0x19'))['db'];function respondWithStatusCode(_0x2f78b0,_0x3477d0){_0x3477d0=_0x3477d0||0xcc;return function(_0x25ba76){if(_0x25ba76){return _0x2f78b0[_0xdcea('0x1a')](_0x3477d0);}return _0x2f78b0[_0xdcea('0x1b')](_0x3477d0)[_0xdcea('0x1c')]();};}function respondWithResult(_0x2f6e49,_0x8a7d47){_0x8a7d47=_0x8a7d47||0xc8;return function(_0xd28624){if(_0xd28624){return _0x2f6e49['status'](_0x8a7d47)[_0xdcea('0x1d')](_0xd28624);}};}function respondWithFilteredResult(_0xb1ef94,_0x2eb527){return function(_0x20f873){if(_0x20f873){var _0x139dfb=typeof _0x2eb527[_0xdcea('0x1e')]===_0xdcea('0x1f')&&typeof _0x2eb527[_0xdcea('0x20')]===_0xdcea('0x1f');var _0x304fab=_0x20f873[_0xdcea('0x21')];var _0x31fc30=_0x139dfb?0x0:_0x2eb527['offset'];var _0x2df73b=_0x139dfb?_0x20f873['count']:_0x2eb527['offset']+_0x2eb527[_0xdcea('0x20')];var _0x304961;if(_0x2df73b>=_0x304fab){_0x2df73b=_0x304fab;_0x304961=0xc8;}else{_0x304961=0xce;}_0xb1ef94[_0xdcea('0x1b')](_0x304961);return _0xb1ef94['set']('Content-Range',_0x31fc30+'-'+_0x2df73b+'/'+_0x304fab)[_0xdcea('0x1d')](_0x20f873);}return null;};}function patchUpdates(_0x39bfa4){return function(_0x37da12){try{jsonpatch['apply'](_0x37da12,_0x39bfa4,!![]);}catch(_0x316d73){return BPromise[_0xdcea('0x22')](_0x316d73);}return _0x37da12[_0xdcea('0x23')]();};}function saveUpdates(_0x2162e0,_0x1ba27b){return function(_0x27fb95){if(_0x27fb95){return _0x27fb95['update'](_0x2162e0)[_0xdcea('0x24')](function(_0x34eaf6){return _0x34eaf6;});}return null;};}function removeEntity(_0x57c6ae,_0x367583){return function(_0x38a5a6){if(_0x38a5a6){return _0x38a5a6['destroy']()['then'](function(){_0x57c6ae[_0xdcea('0x1b')](0xcc)[_0xdcea('0x1c')]();});}};}function handleEntityNotFound(_0x2b715c,_0x29a432){return function(_0x1ef9ef){if(!_0x1ef9ef){_0x2b715c[_0xdcea('0x1a')](0x194);}return _0x1ef9ef;};}function handleError(_0x1a5377,_0x15a270){_0x15a270=_0x15a270||0x1f4;return function(_0x18da7d){logger[_0xdcea('0x25')](_0x18da7d[_0xdcea('0x26')]);if(_0x18da7d['name']){delete _0x18da7d['name'];}_0x1a5377[_0xdcea('0x1b')](_0x15a270)[_0xdcea('0x27')](_0x18da7d);};}exports['index']=function(_0x5e519d,_0x44e563){var _0x10bed2={},_0x5cf427={},_0x3bbb0f={'count':0x0,'rows':[]};var _0x1fb961=_[_0xdcea('0x28')](db[_0xdcea('0x29')]['rawAttributes'],function(_0x266bc3){return{'name':_0x266bc3[_0xdcea('0x2a')],'type':_0x266bc3['type'][_0xdcea('0x2b')]};});_0x5cf427['model']=_['map'](_0x1fb961,_0xdcea('0x2c'));_0x5cf427[_0xdcea('0x2d')]=_[_0xdcea('0x2e')](_0x5e519d['query']);_0x5cf427['filters']=_['intersection'](_0x5cf427[_0xdcea('0x2f')],_0x5cf427[_0xdcea('0x2d')]);_0x10bed2['attributes']=_[_0xdcea('0x30')](_0x5cf427[_0xdcea('0x2f')],qs[_0xdcea('0x31')](_0x5e519d[_0xdcea('0x2d')][_0xdcea('0x31')]));_0x10bed2['attributes']=_0x10bed2[_0xdcea('0x32')][_0xdcea('0x33')]?_0x10bed2[_0xdcea('0x32')]:_0x5cf427[_0xdcea('0x2f')];if(!_0x5e519d[_0xdcea('0x2d')]['hasOwnProperty'](_0xdcea('0x34'))){_0x10bed2[_0xdcea('0x20')]=qs[_0xdcea('0x20')](_0x5e519d[_0xdcea('0x2d')][_0xdcea('0x20')]);_0x10bed2['offset']=qs[_0xdcea('0x1e')](_0x5e519d[_0xdcea('0x2d')][_0xdcea('0x1e')]);}_0x10bed2[_0xdcea('0x35')]=qs[_0xdcea('0x36')](_0x5e519d[_0xdcea('0x2d')][_0xdcea('0x36')]);_0x10bed2[_0xdcea('0x37')]=qs[_0xdcea('0x38')](_[_0xdcea('0x39')](_0x5e519d[_0xdcea('0x2d')],_0x5cf427[_0xdcea('0x38')]),_0x1fb961);if(_0x5e519d[_0xdcea('0x2d')][_0xdcea('0x3a')]){_0x10bed2[_0xdcea('0x37')]=_[_0xdcea('0x3b')](_0x10bed2['where'],{'$or':_[_0xdcea('0x28')](_0x1fb961,function(_0x1a3a7f){if(_0x1a3a7f[_0xdcea('0x3c')]!==_0xdcea('0x3d')){var _0x33f5c3={};_0x33f5c3[_0x1a3a7f[_0xdcea('0x2c')]]={'$like':'%'+_0x5e519d[_0xdcea('0x2d')]['filter']+'%'};return _0x33f5c3;}})});}_0x10bed2=_[_0xdcea('0x3b')]({},_0x10bed2,_0x5e519d['options']);var _0x103028={'where':_0x10bed2[_0xdcea('0x37')]};return db['WhatsappTransferReport'][_0xdcea('0x21')](_0x103028)[_0xdcea('0x24')](function(_0x38fa8e){_0x3bbb0f[_0xdcea('0x21')]=_0x38fa8e;if(_0x5e519d[_0xdcea('0x2d')][_0xdcea('0x3e')]){_0x10bed2[_0xdcea('0x3f')]=[{'all':!![]}];}return db['WhatsappTransferReport'][_0xdcea('0x40')](_0x10bed2);})[_0xdcea('0x24')](function(_0x4904ab){_0x3bbb0f[_0xdcea('0x41')]=_0x4904ab;return _0x3bbb0f;})[_0xdcea('0x24')](respondWithFilteredResult(_0x44e563,_0x10bed2))[_0xdcea('0x42')](handleError(_0x44e563,null));};exports[_0xdcea('0x43')]=function(_0x518f42,_0x3840f0){var _0x1113de={'raw':!![],'where':{'id':_0x518f42['params']['id']}},_0x5e4849={};_0x5e4849['model']=_[_0xdcea('0x2e')](db[_0xdcea('0x29')][_0xdcea('0x44')]);_0x5e4849[_0xdcea('0x2d')]=_[_0xdcea('0x2e')](_0x518f42[_0xdcea('0x2d')]);_0x5e4849[_0xdcea('0x38')]=_['intersection'](_0x5e4849[_0xdcea('0x2f')],_0x5e4849[_0xdcea('0x2d')]);_0x1113de[_0xdcea('0x32')]=_[_0xdcea('0x30')](_0x5e4849['model'],qs[_0xdcea('0x31')](_0x518f42[_0xdcea('0x2d')]['fields']));_0x1113de['attributes']=_0x1113de[_0xdcea('0x32')][_0xdcea('0x33')]?_0x1113de[_0xdcea('0x32')]:_0x5e4849['model'];if(_0x518f42[_0xdcea('0x2d')][_0xdcea('0x3e')]){_0x1113de[_0xdcea('0x3f')]=[{'all':!![]}];}_0x1113de=_[_0xdcea('0x3b')]({},_0x1113de,_0x518f42[_0xdcea('0x45')]);return db['WhatsappTransferReport'][_0xdcea('0x46')](_0x1113de)['then'](handleEntityNotFound(_0x3840f0,null))[_0xdcea('0x24')](respondWithResult(_0x3840f0,null))[_0xdcea('0x42')](handleError(_0x3840f0,null));};exports[_0xdcea('0x47')]=function(_0x55fe2b,_0x356740){return db[_0xdcea('0x29')][_0xdcea('0x47')](_0x55fe2b[_0xdcea('0x48')],{})[_0xdcea('0x24')](respondWithResult(_0x356740,0xc9))[_0xdcea('0x42')](handleError(_0x356740,null));};exports['update']=function(_0x471e76,_0x4ace3f){if(_0x471e76[_0xdcea('0x48')]['id']){delete _0x471e76[_0xdcea('0x48')]['id'];}return db[_0xdcea('0x29')][_0xdcea('0x46')]({'where':{'id':_0x471e76[_0xdcea('0x49')]['id']}})['then'](handleEntityNotFound(_0x4ace3f,null))[_0xdcea('0x24')](saveUpdates(_0x471e76[_0xdcea('0x48')],null))[_0xdcea('0x24')](respondWithResult(_0x4ace3f,null))[_0xdcea('0x42')](handleError(_0x4ace3f,null));};exports['destroy']=function(_0x35c8bd,_0xe40d25){return db[_0xdcea('0x29')][_0xdcea('0x46')]({'where':{'id':_0x35c8bd['params']['id']}})['then'](handleEntityNotFound(_0xe40d25,null))[_0xdcea('0x24')](removeEntity(_0xe40d25,null))[_0xdcea('0x42')](handleError(_0xe40d25,null));};exports[_0xdcea('0x4a')]=function(_0x2c3d21,_0x3eb49f){return db[_0xdcea('0x29')][_0xdcea('0x4a')]()['then'](respondWithResult(_0x3eb49f,null))[_0xdcea('0x42')](handleError(_0x3eb49f,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 8277c43..78542a7 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 _0x681b=['define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','util','../../config/logger','api','moment','path','rimraf','./whatsappTransferReport.attributes'];(function(_0x303ac4,_0x437429){var _0x4d5cec=function(_0x2647d0){while(--_0x2647d0){_0x303ac4['push'](_0x303ac4['shift']());}};_0x4d5cec(++_0x437429);}(_0x681b,0x1cc));var _0xb681=function(_0x118a53,_0x2b509b){_0x118a53=_0x118a53-0x0;var _0x35e194=_0x681b[_0x118a53];return _0x35e194;};'use strict';var _=require(_0xb681('0x0'));var util=require(_0xb681('0x1'));var logger=require(_0xb681('0x2'))(_0xb681('0x3'));var moment=require(_0xb681('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb681('0x5'));var rimraf=require(_0xb681('0x6'));var config=require('../../config/environment');var attributes=require(_0xb681('0x7'));module['exports']=function(_0x1b522e,_0x29ac54){return _0x1b522e[_0xb681('0x8')](_0xb681('0x9'),attributes,{'tableName':_0xb681('0xa'),'paranoid':![],'indexes':[{'name':_0xb681('0xb'),'fields':[_0xb681('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4fce=['report_whatsapp_transfer','uniqueid','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappTransferReport.attributes','exports','define'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4fce,0x80));var _0xe4fc=function(_0x4bc921,_0x11a57f){_0x4bc921=_0x4bc921-0x0;var _0x2250ef=_0x4fce[_0x4bc921];return _0x2250ef;};'use strict';var _=require(_0xe4fc('0x0'));var util=require(_0xe4fc('0x1'));var logger=require('../../config/logger')(_0xe4fc('0x2'));var moment=require(_0xe4fc('0x3'));var BPromise=require(_0xe4fc('0x4'));var rp=require(_0xe4fc('0x5'));var fs=require('fs');var path=require(_0xe4fc('0x6'));var rimraf=require(_0xe4fc('0x7'));var config=require(_0xe4fc('0x8'));var attributes=require(_0xe4fc('0x9'));module[_0xe4fc('0xa')]=function(_0x156e9e,_0x478108){return _0x156e9e[_0xe4fc('0xb')]('WhatsappTransferReport',attributes,{'tableName':_0xe4fc('0xc'),'paranoid':![],'indexes':[{'name':_0xe4fc('0xd'),'fields':[_0xe4fc('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 ab27362..32b4962 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 _0x84ff=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','WhatsappTransferReport,\x20%s,\x20%s','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','bluebird','randomstring'];(function(_0x211dba,_0x487d76){var _0x217af2=function(_0x5278aa){while(--_0x5278aa){_0x211dba['push'](_0x211dba['shift']());}};_0x217af2(++_0x487d76);}(_0x84ff,0x156));var _0xf84f=function(_0x1324d3,_0x3e5337){_0x1324d3=_0x1324d3-0x0;var _0x324455=_0x84ff[_0x1324d3];return _0x324455;};'use strict';var _=require('lodash');var util=require(_0xf84f('0x0'));var moment=require('moment');var BPromise=require(_0xf84f('0x1'));var rs=require(_0xf84f('0x2'));var fs=require('fs');var Redis=require(_0xf84f('0x3'));var db=require(_0xf84f('0x4'))['db'];var utils=require(_0xf84f('0x5'));var logger=require(_0xf84f('0x6'))('rpc');var config=require(_0xf84f('0x7'));var jayson=require(_0xf84f('0x8'));var client=jayson[_0xf84f('0x9')][_0xf84f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4157e0,_0x3963cf,_0x12a96b){return new BPromise(function(_0x5c3e66,_0x5b0a1e){return client[_0xf84f('0xb')](_0x4157e0,_0x12a96b)['then'](function(_0x430652){logger[_0xf84f('0xc')](_0xf84f('0xd'),_0x3963cf,'request\x20sent');logger[_0xf84f('0xe')](_0xf84f('0xf'),_0x3963cf,_0xf84f('0x10'),JSON[_0xf84f('0x11')](_0x430652));if(_0x430652[_0xf84f('0x12')]){if(_0x430652[_0xf84f('0x12')][_0xf84f('0x13')]===0x1f4){logger[_0xf84f('0x12')](_0xf84f('0xd'),_0x3963cf,_0x430652['error'][_0xf84f('0x14')]);return _0x5b0a1e(_0x430652['error'][_0xf84f('0x14')]);}logger[_0xf84f('0x12')](_0xf84f('0xd'),_0x3963cf,_0x430652[_0xf84f('0x12')][_0xf84f('0x14')]);return _0x5c3e66(_0x430652[_0xf84f('0x12')][_0xf84f('0x14')]);}else{logger[_0xf84f('0xc')]('WhatsappTransferReport,\x20%s,\x20%s',_0x3963cf,_0xf84f('0x10'));_0x5c3e66(_0x430652[_0xf84f('0x15')][_0xf84f('0x14')]);}})[_0xf84f('0x16')](function(_0x1e45e6){logger['error']('WhatsappTransferReport,\x20%s,\x20%s',_0x3963cf,_0x1e45e6);_0x5b0a1e(_0x1e45e6);});});} \ No newline at end of file +var _0x194f=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','then','info','request\x20sent','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','WhatsappTransferReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment'];(function(_0x17f09f,_0xbada9d){var _0x2c456c=function(_0x281ea5){while(--_0x281ea5){_0x17f09f['push'](_0x17f09f['shift']());}};_0x2c456c(++_0xbada9d);}(_0x194f,0x75));var _0xf194=function(_0x2fdb61,_0x3f8308){_0x2fdb61=_0x2fdb61-0x0;var _0x1f1922=_0x194f[_0x2fdb61];return _0x1f1922;};'use strict';var _=require(_0xf194('0x0'));var util=require(_0xf194('0x1'));var moment=require(_0xf194('0x2'));var BPromise=require(_0xf194('0x3'));var rs=require(_0xf194('0x4'));var fs=require('fs');var Redis=require(_0xf194('0x5'));var db=require(_0xf194('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xf194('0x7'))(_0xf194('0x8'));var config=require(_0xf194('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4c25b6,_0x1635c8,_0x43d002){return new BPromise(function(_0x390c55,_0x19880c){return client['request'](_0x4c25b6,_0x43d002)[_0xf194('0xa')](function(_0x22bcac){logger[_0xf194('0xb')]('WhatsappTransferReport,\x20%s,\x20%s',_0x1635c8,_0xf194('0xc'));logger['debug'](_0xf194('0xd'),_0x1635c8,_0xf194('0xc'),JSON[_0xf194('0xe')](_0x22bcac));if(_0x22bcac['error']){if(_0x22bcac[_0xf194('0xf')]['code']===0x1f4){logger[_0xf194('0xf')](_0xf194('0x10'),_0x1635c8,_0x22bcac[_0xf194('0xf')][_0xf194('0x11')]);return _0x19880c(_0x22bcac['error'][_0xf194('0x11')]);}logger['error'](_0xf194('0x10'),_0x1635c8,_0x22bcac[_0xf194('0xf')][_0xf194('0x11')]);return _0x390c55(_0x22bcac[_0xf194('0xf')][_0xf194('0x11')]);}else{logger[_0xf194('0xb')](_0xf194('0x10'),_0x1635c8,_0xf194('0xc'));_0x390c55(_0x22bcac[_0xf194('0x12')][_0xf194('0x11')]);}})[_0xf194('0x13')](function(_0x5390ca){logger[_0xf194('0xf')]('WhatsappTransferReport,\x20%s,\x20%s',_0x1635c8,_0x5390ca);_0x19880c(_0x5390ca);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 3988685..0132cf6 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x692c=['then','seedDB','default','listen','info','start','filter','exitCode','number','length','map','pm2_env','Online\x20apps:','online','name','join','Offline\x20apps:','status','None','log','App\x20Ready!','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./config/seedDB','./config/license','./rpc','./config/environment','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','sequelize','sync'];(function(_0xa421f,_0xc77565){var _0x4ed51e=function(_0x21a628){while(--_0x21a628){_0xa421f['push'](_0xa421f['shift']());}};_0x4ed51e(++_0xc77565);}(_0x692c,0x6a));var _0xc692=function(_0x23794d,_0x522fbf){_0x23794d=_0x23794d-0x0;var _0x11b304=_0x692c[_0x23794d];return _0x11b304;};'use strict';var _=require(_0xc692('0x0'));var db=require(_0xc692('0x1'))['db'];var seedDb=require(_0xc692('0x2'));var checkLicense=require(_0xc692('0x3'));var rpc=require(_0xc692('0x4'));var config=require(_0xc692('0x5'));var logger=require('./config/logger')(_0xc692('0x6'));var pm2=require(_0xc692('0x7'));var pm2Config=require(_0xc692('0x8'));var schedule=require(_0xc692('0x9'));var chat=require(_0xc692('0xa'));var whatsapp=require(_0xc692('0xb'));var transcribe=require('./config/schedule/transcribe');var provider=require('./config/schedule/cloud-provider');function main(){return db[_0xc692('0xc')][_0xc692('0xd')]()[_0xc692('0xe')](function(){if(config[_0xc692('0xf')]){return seedDb[_0xc692('0x10')]();}})[_0xc692('0xe')](function(){return checkLicense[_0xc692('0x10')]();})['then'](function(){return rpc[_0xc692('0x11')]();})[_0xc692('0xe')](function(_0x280ced){logger[_0xc692('0x12')](_0x280ced);return chat[_0xc692('0x13')]();})['then'](function(){return whatsapp[_0xc692('0x13')]();})[_0xc692('0xe')](function(){return schedule[_0xc692('0x13')]();})['then'](function(){return transcribe[_0xc692('0x13')]();})['then'](function(){return provider[_0xc692('0x13')]();})[_0xc692('0xe')](function(_0x56b9f8){logger[_0xc692('0x12')](_0x56b9f8);return pm2[_0xc692('0x13')](pm2Config);})[_0xc692('0xe')](function(_0x40df47){var _0x224409=_0x40df47[_0xc692('0x14')](function(_0x18aac7){return typeof _0x18aac7[_0xc692('0x15')]===_0xc692('0x16')&&_0x18aac7['exitCode']>=0x0;});if(_0x224409[_0xc692('0x17')]>0x0){throw new Error(_0x224409[_0xc692('0x17')]+'\x20processes\x20failed\x20at\x20startup:\x20'+_[_0xc692('0x18')](_0x224409,function(_0x4ea727){return'\x22'+_0x4ea727[_0xc692('0x19')]['name']+'\x22';}));}logger[_0xc692('0x12')](_0xc692('0x1a'),_['map'](_[_0xc692('0x14')](_0x40df47,{'status':_0xc692('0x1b')}),_0xc692('0x1c'))[_0xc692('0x1d')]());logger[_0xc692('0x12')](_0xc692('0x1e'),_[_0xc692('0x18')](_[_0xc692('0x14')](_0x40df47,function(_0x15269e){return _0x15269e[_0xc692('0x1f')]!==_0xc692('0x1b');}),'name')[_0xc692('0x1d')]()||_0xc692('0x20'));console[_0xc692('0x21')](_0xc692('0x22'));})[_0xc692('0x23')](function(_0x5b22a1){console['log'](_0xc692('0x24'),_0x5b22a1);logger[_0xc692('0x25')](_0xc692('0x26'),_0x5b22a1);process[_0xc692('0x27')](0x1);});}main(); \ No newline at end of file +var _0x3148=['sync','seedDB','default','then','info','start','filter','exitCode','number','length','\x20processes\x20failed\x20at\x20startup:\x20','map','pm2_env','name','Online\x20apps:','online','join','Offline\x20apps:','status','None','log','App\x20Ready!','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./config/license','./rpc','./config/environment','./config/logger','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','./config/schedule/cloud-provider'];(function(_0x289b08,_0x562de1){var _0x1d3ed5=function(_0x5b2e51){while(--_0x5b2e51){_0x289b08['push'](_0x289b08['shift']());}};_0x1d3ed5(++_0x562de1);}(_0x3148,0x1d3));var _0x8314=function(_0x3fbeef,_0x2840b4){_0x3fbeef=_0x3fbeef-0x0;var _0x14ec1f=_0x3148[_0x3fbeef];return _0x14ec1f;};'use strict';var _=require(_0x8314('0x0'));var db=require(_0x8314('0x1'))['db'];var seedDb=require('./config/seedDB');var checkLicense=require(_0x8314('0x2'));var rpc=require(_0x8314('0x3'));var config=require(_0x8314('0x4'));var logger=require(_0x8314('0x5'))('app');var pm2=require(_0x8314('0x6'));var pm2Config=require(_0x8314('0x7'));var schedule=require(_0x8314('0x8'));var chat=require(_0x8314('0x9'));var whatsapp=require(_0x8314('0xa'));var transcribe=require(_0x8314('0xb'));var provider=require(_0x8314('0xc'));function main(){return db['sequelize'][_0x8314('0xd')]()['then'](function(){if(config[_0x8314('0xe')]){return seedDb[_0x8314('0xf')]();}})[_0x8314('0x10')](function(){return checkLicense[_0x8314('0xf')]();})[_0x8314('0x10')](function(){return rpc['listen']();})['then'](function(_0xfaf56c){logger[_0x8314('0x11')](_0xfaf56c);return chat[_0x8314('0x12')]();})[_0x8314('0x10')](function(){return whatsapp['start']();})[_0x8314('0x10')](function(){return schedule[_0x8314('0x12')]();})['then'](function(){return transcribe[_0x8314('0x12')]();})['then'](function(){return provider['start']();})[_0x8314('0x10')](function(_0xc924ca){logger[_0x8314('0x11')](_0xc924ca);return pm2[_0x8314('0x12')](pm2Config);})['then'](function(_0x9e90a6){var _0x2e7098=_0x9e90a6[_0x8314('0x13')](function(_0x136e09){return typeof _0x136e09[_0x8314('0x14')]===_0x8314('0x15')&&_0x136e09['exitCode']>=0x0;});if(_0x2e7098['length']>0x0){throw new Error(_0x2e7098[_0x8314('0x16')]+_0x8314('0x17')+_[_0x8314('0x18')](_0x2e7098,function(_0x570db3){return'\x22'+_0x570db3[_0x8314('0x19')][_0x8314('0x1a')]+'\x22';}));}logger['info'](_0x8314('0x1b'),_[_0x8314('0x18')](_['filter'](_0x9e90a6,{'status':_0x8314('0x1c')}),'name')[_0x8314('0x1d')]());logger[_0x8314('0x11')](_0x8314('0x1e'),_['map'](_['filter'](_0x9e90a6,function(_0x240f4b){return _0x240f4b[_0x8314('0x1f')]!==_0x8314('0x1c');}),_0x8314('0x1a'))[_0x8314('0x1d')]()||_0x8314('0x20'));console[_0x8314('0x21')](_0x8314('0x22'));})[_0x8314('0x23')](function(_0x1e9869){console['log'](_0x8314('0x24'),_0x1e9869);logger[_0x8314('0x25')](_0x8314('0x26'),_0x1e9869);process[_0x8314('0x27')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index a8714c7..03ded0c 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 _0x8f4c=['randomBytes','toString','hex','floor','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','lodash','express-jwt','composable-middleware','basic-auth','bluebird','session','fullname','name','internal','email','userpic','md5secret','voicePause','chatPause','mailPause','smsPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','interface','settingsEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswer','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswer','whatsappAutoanswerDelay','messengerSoundNotification','isChatInteractionAuthorized','isAuthenticated','user','findOne','closed','then','status','disposition','unmanaged','json','Unmanaged.','catch','use','headers','startsWith','User','find','authenticate','pass','Wrong\x20credentials.','Bearer','query','apikey','getUuid','sub','Setting','allowedLoginAttempts','blockDuration','apiKeyNonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','add','minutes','User\x20object\x20not\x20found.','Forbidden','isWebrtcLicence','webrtc','isMiddleware','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','/dashboards/general','send','retrieveApiKey','isNil','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','split','toLowerCase','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','length','unshift','encryptString','join','promisify','sign','secret','secrets','options','verify'];(function(_0x14e53c,_0x424b22){var _0x148571=function(_0x4564db){while(--_0x4564db){_0x14e53c['push'](_0x14e53c['shift']());}};_0x148571(++_0x424b22);}(_0x8f4c,0x113));var _0xc8f4=function(_0x1998f5,_0x4aae86){_0x1998f5=_0x1998f5-0x0;var _0x3f768e=_0x8f4c[_0x1998f5];return _0x3f768e;};'use strict';var db=require(_0xc8f4('0x0'))['db'];var config=require(_0xc8f4('0x1'));var hardwareConf=require(_0xc8f4('0x2'));var licenseUtil=require(_0xc8f4('0x3'));var encryptor=require(_0xc8f4('0x4'));var _=require(_0xc8f4('0x5'));var jwt=require('jsonwebtoken');var expressJwt=require(_0xc8f4('0x6'));var compose=require(_0xc8f4('0x7'));var basicAuth=require(_0xc8f4('0x8'));var crypto=require('crypto');var BPromise=require(_0xc8f4('0x9'));var util=require('util');var moment=require('moment');var validateJwt=expressJwt({'secret':config['secrets'][_0xc8f4('0xa')]});var userAttributes=['id','role',_0xc8f4('0xb'),_0xc8f4('0xc'),_0xc8f4('0xd'),_0xc8f4('0xe'),_0xc8f4('0xf'),'permissions',_0xc8f4('0x10'),_0xc8f4('0x11'),_0xc8f4('0x12'),_0xc8f4('0x13'),'faxPause',_0xc8f4('0x14'),'openchannelPause',_0xc8f4('0x15'),_0xc8f4('0x16'),_0xc8f4('0x17'),_0xc8f4('0x18'),_0xc8f4('0x19'),'allowmessenger',_0xc8f4('0x1a'),_0xc8f4('0x1b'),_0xc8f4('0x1c'),_0xc8f4('0x1d'),_0xc8f4('0x1e'),_0xc8f4('0x1f'),'phoneBarEnableDtmfTone',_0xc8f4('0x20'),_0xc8f4('0x21'),_0xc8f4('0x22'),_0xc8f4('0x23'),_0xc8f4('0x24'),'hotdesk',_0xc8f4('0x25'),'userProfileId','privacyEnabled',_0xc8f4('0x26'),_0xc8f4('0x27'),_0xc8f4('0x28'),_0xc8f4('0x29'),_0xc8f4('0x2a'),_0xc8f4('0x2b'),_0xc8f4('0x2c'),_0xc8f4('0x2d'),_0xc8f4('0x2e'),_0xc8f4('0x2f'),_0xc8f4('0x30'),_0xc8f4('0x31'),_0xc8f4('0x32'),'openchannelAutoanswer',_0xc8f4('0x33'),_0xc8f4('0x34'),_0xc8f4('0x35'),_0xc8f4('0x36'),_0xc8f4('0x37'),_0xc8f4('0x38')];exports[_0xc8f4('0x39')]=function(){return this[_0xc8f4('0x3a')](!![])['use'](function(_0x4463aa,_0x205c41,_0x3195ff){if(_0x4463aa[_0xc8f4('0x3b')]){_0x3195ff();}else{return db['ChatInteraction'][_0xc8f4('0x3c')]({'where':{'id':_0x4463aa['params']['id']},'attributes':['id',_0xc8f4('0x3d'),'disposition'],'raw':!![]})[_0xc8f4('0x3e')](function(_0x3dd717){if(_0x3dd717&&_0x3dd717['closed']){return _0x205c41[_0xc8f4('0x3f')](_0x3dd717[_0xc8f4('0x40')]===_0xc8f4('0x41')?0x195:0x193)[_0xc8f4('0x42')]({'message':_0x3dd717['disposition']===_0xc8f4('0x41')?_0xc8f4('0x43'):'Forbidden.'});}else{_0x3195ff();}})[_0xc8f4('0x44')](function(_0x37957c){_0x3195ff(_0x37957c);});}});};exports[_0xc8f4('0x3a')]=function isAuthenticated(_0x1b70bc){return compose()[_0xc8f4('0x45')](function(_0x385e41,_0x4a25da,_0x45f972){var _0x24bb78;if(_0x385e41[_0xc8f4('0x46')]['authorization']){if(_[_0xc8f4('0x47')](_0x385e41[_0xc8f4('0x46')]['authorization'],'Basic')){var _0x4d6c43=basicAuth(_0x385e41);db[_0xc8f4('0x48')][_0xc8f4('0x49')]({'where':{'name':_0x4d6c43[_0xc8f4('0xc')]}})[_0xc8f4('0x3e')](function(_0x273e73){if(!_0x273e73||!_0x273e73[_0xc8f4('0x4a')](_0x4d6c43[_0xc8f4('0x4b')])){return _0x4a25da[_0xc8f4('0x3f')](0x191)['json']({'message':_0xc8f4('0x4c')});}_0x385e41[_0xc8f4('0x3b')]={'id':_0x273e73['id']};_0x45f972();})[_0xc8f4('0x44')](function(_0x5cb6ce){_0x45f972(_0x5cb6ce);});}else if(_[_0xc8f4('0x47')](_0x385e41[_0xc8f4('0x46')]['authorization'],_0xc8f4('0x4d'))){validateJwt(_0x385e41,_0x4a25da,_0x45f972);}else{if(_0x1b70bc){_0x45f972();}else{return _0x4a25da[_0xc8f4('0x3f')](0x193)[_0xc8f4('0x42')]({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x385e41[_0xc8f4('0x4e')][_0xc8f4('0x4f')]){try{var _0x126731={'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0xc8f4('0x50')]()};verifyJwt(_0x385e41[_0xc8f4('0x4e')][_0xc8f4('0x4f')],_0x126731)[_0xc8f4('0x3e')](function(_0x215203){return db[_0xc8f4('0x48')][_0xc8f4('0x49')]({'where':{'id':_0x215203[_0xc8f4('0x51')]}})[_0xc8f4('0x3e')](function(_0x2b0ee1){_0x24bb78=_0x2b0ee1;return db[_0xc8f4('0x52')][_0xc8f4('0x3c')]({'where':{'id':0x1},'attributes':[_0xc8f4('0x53'),_0xc8f4('0x54')],'raw':!![]});})[_0xc8f4('0x3e')](function(_0x453640){if(!_0x24bb78||!_['isEqual'](_0x24bb78[_0xc8f4('0x55')],_0x215203['nonce'])){return _0x4a25da[_0xc8f4('0x3f')](0x191)['json']({'message':_0xc8f4('0x56')});}if(_0x24bb78[_0xc8f4('0x57')]){return _0x4a25da[_0xc8f4('0x3f')](0x191)[_0xc8f4('0x42')]({'message':_0xc8f4('0x58')});}if(_0x24bb78[_0xc8f4('0x59')]){if(_0x453640[_0xc8f4('0x54')]>0x0){if(moment(_0x24bb78['blockedAt'])[_0xc8f4('0x5a')](_0x453640[_0xc8f4('0x54')],_0xc8f4('0x5b'))>moment()){return _0x4a25da[_0xc8f4('0x3f')](0x191)['json']({'message':_0xc8f4('0x58')});}}else{return _0x4a25da[_0xc8f4('0x3f')](0x191)[_0xc8f4('0x42')]({'message':_0xc8f4('0x58')});}}_0x385e41[_0xc8f4('0x3b')]={'id':_0x24bb78['id']};_0x45f972();});})[_0xc8f4('0x44')](function(){return _0x4a25da[_0xc8f4('0x3f')](0x191)[_0xc8f4('0x42')]({'message':_0xc8f4('0x58')});});}catch(_0x30478d){_0x45f972(_0x30478d);}}else if(_0x1b70bc){_0x45f972();}else{return _0x4a25da[_0xc8f4('0x3f')](0x193)[_0xc8f4('0x42')]({'message':'Unknown\x20authorization\x20format'});}})[_0xc8f4('0x45')](function(_0x32e067,_0x405597,_0x275f4a){if(_0x32e067['user']){db['User'][_0xc8f4('0x49')]({'where':{'id':_0x32e067[_0xc8f4('0x3b')]['id']},'attributes':userAttributes})['then'](function(_0x1c0f2e){if(!_0x1c0f2e){return _0x405597[_0xc8f4('0x3f')](0x194)['json']({'message':'User\x20not\x20found.'});}_0x32e067[_0xc8f4('0x3b')]=_0x1c0f2e;_0x275f4a();})[_0xc8f4('0x44')](function(_0x3353f6){_0x275f4a(_0x3353f6);});}else if(_0x1b70bc){_0x275f4a();}else{return _0x405597[_0xc8f4('0x3f')](0x194)[_0xc8f4('0x42')]({'message':_0xc8f4('0x5c')});}});};exports['canUpdate']=function canUpdate(){return compose()['use'](function(_0x705792,_0x8c82a5,_0x28b4d6){return licenseUtil['getLicense']()['then'](function(_0x5a1a99){if(_0x5a1a99['update']){_0x28b4d6();}else{return _0x8c82a5['status'](0x193)[_0xc8f4('0x42')]({'message':_0xc8f4('0x5d')});}})[_0xc8f4('0x44')](function(_0x2781b5){_0x28b4d6(_0x2781b5);});});};exports[_0xc8f4('0x5e')]=function isWebrtcLicence(){return compose()[_0xc8f4('0x45')](function(_0x511129,_0xdd7c1a,_0x33b7ac){return licenseUtil['getLicense']()['then'](function(_0x724f47){if(_0x724f47[_0xc8f4('0x5f')]){_0x33b7ac();}else{return _0xdd7c1a[_0xc8f4('0x3f')](0x193)[_0xc8f4('0x42')]({'message':'Forbidden'});}})['catch'](function(_0xe1dd97){_0x33b7ac(_0xe1dd97);});});};exports[_0xc8f4('0x60')]=function(_0x162316,_0x2bc4db,_0x141f81){_0x162316[_0xc8f4('0x60')]=!![];return _0x141f81();};exports['signToken']=function signToken(_0x5e998e){return signJwt(_0x5e998e);};exports[_0xc8f4('0x61')]=function(_0x447473,_0x199b7d){if(!_0x447473[_0xc8f4('0x3b')]){return _0x199b7d[_0xc8f4('0x3f')](0x194)[_0xc8f4('0x42')]({'message':_0xc8f4('0x62')});}var _0x1798a1={'payload':{'id':_0x447473[_0xc8f4('0x3b')]['id'],'role':_0x447473['user']['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x1798a1)[_0xc8f4('0x3e')](function(_0xc11ff5){_0x199b7d[_0xc8f4('0x63')](_0xc8f4('0x64'),_0xc11ff5);_0x199b7d[_0xc8f4('0x65')](_0xc8f4('0x66'));})[_0xc8f4('0x44')](function(_0x36c304){return _0x199b7d[_0xc8f4('0x3f')](0x1f4)[_0xc8f4('0x67')](_0x36c304);});};exports[_0xc8f4('0x68')]=function(_0x3bca90){if(_[_0xc8f4('0x69')](_0x3bca90['apiKeyNonce'])||_[_0xc8f4('0x69')](_0x3bca90[_0xc8f4('0x6a')])){return null;}else{return createJwt(_0x3bca90);}};exports[_0xc8f4('0x6b')]=function(_0x1602d3){_0x1602d3['apiKeyNonce']=generateNonce();_0x1602d3[_0xc8f4('0x6a')]=generateIssuedAt();return createJwt(_0x1602d3);};exports[_0xc8f4('0x6c')]=function(_0x4b4de3,_0x47995c){var _0x405391=_0x4b4de3['query'][_0xc8f4('0x4f')];if(_0x405391){var _0x29f8f4={'nonce':_0x47995c[_0xc8f4('0x55')],'iat':_0x47995c[_0xc8f4('0x6a')],'audience':hardwareConf[_0xc8f4('0x50')](),'issuer':hardwareConf[_0xc8f4('0x50')]()};return verifyJwt(_0x405391,_0x29f8f4)[_0xc8f4('0x3e')](function(){return generateApiKey(_0x47995c);});}else{throw{'message':_0xc8f4('0x6d')};}};exports[_0xc8f4('0x6e')]=function(_0x305edb){var _0x408d56=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x408d56['test'](_0x305edb))throw new db[(_0xc8f4('0x6f'))][(_0xc8f4('0x70'))](_0xc8f4('0x71'));return;};exports[_0xc8f4('0x72')]=function(_0x4f4b35,_0x423431,_0x4f3e41){var _0x5b52f7=encryptor[_0xc8f4('0x73')](_0x423431)[_0xc8f4('0x74')](',');for(var _0x192bbc=0x0;_0x192bbc<_0x4f3e41;_0x192bbc++){if(!_0x5b52f7[_0x192bbc])break;if(_0x4f4b35[_0xc8f4('0x75')]()===_0x5b52f7[_0x192bbc][_0xc8f4('0x75')]()){var _0x23023d=util['format']('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0x4f3e41);if(_0x4f3e41===0x1){_0x23023d=_0xc8f4('0x76');}throw new db[(_0xc8f4('0x6f'))][(_0xc8f4('0x70'))](_0x23023d);}}return;};exports[_0xc8f4('0x77')]=function(_0x25369e,_0x19a024){var _0x443148=_0x19a024?encryptor['decryptString'](_0x19a024)[_0xc8f4('0x74')](','):[];if(_0x443148[_0xc8f4('0x78')]===0x5){_0x443148['splice'](-0x1,0x1);}_0x443148[_0xc8f4('0x79')](_0x25369e);return encryptor[_0xc8f4('0x7a')](_0x443148[_0xc8f4('0x7b')](','));};function signJwt(_0x5b8bf4){var _0x368798=BPromise[_0xc8f4('0x7c')](jwt[_0xc8f4('0x7d')],{'context':jwt});var _0x4d05cb=_0x5b8bf4[_0xc8f4('0x7e')]||config[_0xc8f4('0x7f')]['session'];return new BPromise(function(_0x52e295,_0x3a44bc){_0x368798(_0x5b8bf4['payload'],_0x4d05cb,_0x5b8bf4[_0xc8f4('0x80')])[_0xc8f4('0x3e')](function(_0x5694eb){_0x52e295(_0x5694eb);})['catch'](function(_0x57ad51){_0x3a44bc(_0x57ad51);});});}function verifyJwt(_0x490b8b,_0x4b619c,_0x4f66d1){var _0x32665c=BPromise['promisify'](jwt[_0xc8f4('0x81')],{'context':jwt});var _0x357e45=_0x4f66d1||config[_0xc8f4('0x7f')][_0xc8f4('0xa')];return new BPromise(function(_0x5ea840,_0x3f2596){_0x32665c(_0x490b8b,_0x357e45,_0x4b619c)[_0xc8f4('0x3e')](function(_0x3ca2ca){_0x5ea840(_0x3ca2ca);})[_0xc8f4('0x44')](function(_0x4ae72e){_0x3f2596(_0x4ae72e);});});}function generateNonce(){return crypto[_0xc8f4('0x82')](0x10)[_0xc8f4('0x83')](_0xc8f4('0x84'));}function generateIssuedAt(){return Math[_0xc8f4('0x85')](Date['now']()/0x3e8)[_0xc8f4('0x83')]();}function createJwt(_0x196231){var _0x4f2bf9={'payload':{'iat':_0x196231[_0xc8f4('0x6a')],'nonce':_0x196231[_0xc8f4('0x55')]},'options':{'algorithm':_0xc8f4('0x86'),'subject':_0x196231['id'][_0xc8f4('0x83')](),'issuer':hardwareConf[_0xc8f4('0x50')](),'audience':hardwareConf[_0xc8f4('0x50')]()}};return signJwt(_0x4f2bf9)['then'](function(_0xc0422a){return{'iat':_0x196231[_0xc8f4('0x6a')],'nonce':_0x196231[_0xc8f4('0x55')],'token':_0xc0422a};});} \ No newline at end of file +var _0xd4a2=['downloadOmnichannelInteractions','chatAutoanswer','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswer','whatsappAutoanswerDelay','messengerSoundNotification','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','findOne','params','closed','disposition','status','unmanaged','json','Unmanaged.','Forbidden.','catch','headers','authorization','startsWith','Basic','User','find','authenticate','pass','Unknown\x20authorization\x20format','query','apikey','getUuid','then','sub','Setting','allowedLoginAttempts','blockDuration','apiKeyNonce','disabled','Invalid\x20API\x20access\x20key','blocked','blockedAt','add','minutes','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','update','Forbidden','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','/dashboards/general','retrieveApiKey','isNil','apiKeyIat','generateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','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.','ValidationError','updatePasswordsHistory','length','splice','unshift','encryptString','join','promisify','sign','secrets','payload','options','verify','randomBytes','hex','toString','HS512','../../mysqldb','../../config/license/util','lodash','express-jwt','basic-auth','crypto','bluebird','util','moment','session','role','fullname','name','internal','email','userpic','permissions','md5secret','voicePause','chatPause','mailPause','openchannelPause','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarEnableRecording','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','hotdesk','userProfileId','settingsEnabled','wssPort','downloadVoiceRecordings'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0xd4a2,0x173));var _0x2d4a=function(_0x264e59,_0x2e081a){_0x264e59=_0x264e59-0x0;var _0x33cc1b=_0xd4a2[_0x264e59];return _0x33cc1b;};'use strict';var db=require(_0x2d4a('0x0'))['db'];var config=require('../../config/environment');var hardwareConf=require('../../config/license/hardware');var licenseUtil=require(_0x2d4a('0x1'));var encryptor=require('../encryptor');var _=require(_0x2d4a('0x2'));var jwt=require('jsonwebtoken');var expressJwt=require(_0x2d4a('0x3'));var compose=require('composable-middleware');var basicAuth=require(_0x2d4a('0x4'));var crypto=require(_0x2d4a('0x5'));var BPromise=require(_0x2d4a('0x6'));var util=require(_0x2d4a('0x7'));var moment=require(_0x2d4a('0x8'));var validateJwt=expressJwt({'secret':config['secrets'][_0x2d4a('0x9')]});var userAttributes=['id',_0x2d4a('0xa'),_0x2d4a('0xb'),_0x2d4a('0xc'),_0x2d4a('0xd'),_0x2d4a('0xe'),_0x2d4a('0xf'),_0x2d4a('0x10'),_0x2d4a('0x11'),_0x2d4a('0x12'),_0x2d4a('0x13'),_0x2d4a('0x14'),'faxPause','smsPause',_0x2d4a('0x15'),'pauseType',_0x2d4a('0x16'),_0x2d4a('0x17'),_0x2d4a('0x18'),_0x2d4a('0x19'),_0x2d4a('0x1a'),_0x2d4a('0x1b'),_0x2d4a('0x1c'),_0x2d4a('0x1d'),'phoneBarAutoAnswerDelay','phoneBarDnd',_0x2d4a('0x1e'),'phoneBarEnableDtmfTone',_0x2d4a('0x1f'),_0x2d4a('0x20'),_0x2d4a('0x21'),_0x2d4a('0x22'),'phoneBarRemoteControlPort',_0x2d4a('0x23'),'interface',_0x2d4a('0x24'),'privacyEnabled',_0x2d4a('0x25'),_0x2d4a('0x26'),_0x2d4a('0x27'),_0x2d4a('0x28'),'downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign',_0x2d4a('0x29'),_0x2d4a('0x2a'),_0x2d4a('0x2b'),_0x2d4a('0x2c'),_0x2d4a('0x2d'),_0x2d4a('0x2e'),'openchannelAutoanswer','openchannelAutoanswerDelay',_0x2d4a('0x2f'),_0x2d4a('0x30'),_0x2d4a('0x31'),_0x2d4a('0x32'),_0x2d4a('0x33')];exports[_0x2d4a('0x34')]=function(){return this[_0x2d4a('0x35')](!![])[_0x2d4a('0x36')](function(_0x5d5daa,_0x26e7b8,_0x3240a2){if(_0x5d5daa[_0x2d4a('0x37')]){_0x3240a2();}else{return db[_0x2d4a('0x38')][_0x2d4a('0x39')]({'where':{'id':_0x5d5daa[_0x2d4a('0x3a')]['id']},'attributes':['id',_0x2d4a('0x3b'),_0x2d4a('0x3c')],'raw':!![]})['then'](function(_0x544b9b){if(_0x544b9b&&_0x544b9b['closed']){return _0x26e7b8[_0x2d4a('0x3d')](_0x544b9b['disposition']===_0x2d4a('0x3e')?0x195:0x193)[_0x2d4a('0x3f')]({'message':_0x544b9b[_0x2d4a('0x3c')]===_0x2d4a('0x3e')?_0x2d4a('0x40'):_0x2d4a('0x41')});}else{_0x3240a2();}})[_0x2d4a('0x42')](function(_0x27b358){_0x3240a2(_0x27b358);});}});};exports['isAuthenticated']=function isAuthenticated(_0x436f53){return compose()['use'](function(_0x221602,_0x9bac28,_0xc497ce){var _0x20b87d;if(_0x221602[_0x2d4a('0x43')][_0x2d4a('0x44')]){if(_[_0x2d4a('0x45')](_0x221602[_0x2d4a('0x43')]['authorization'],_0x2d4a('0x46'))){var _0x3d94b7=basicAuth(_0x221602);db[_0x2d4a('0x47')][_0x2d4a('0x48')]({'where':{'name':_0x3d94b7[_0x2d4a('0xc')]}})['then'](function(_0x217653){if(!_0x217653||!_0x217653[_0x2d4a('0x49')](_0x3d94b7[_0x2d4a('0x4a')])){return _0x9bac28[_0x2d4a('0x3d')](0x191)[_0x2d4a('0x3f')]({'message':'Wrong\x20credentials.'});}_0x221602[_0x2d4a('0x37')]={'id':_0x217653['id']};_0xc497ce();})[_0x2d4a('0x42')](function(_0x46b623){_0xc497ce(_0x46b623);});}else if(_[_0x2d4a('0x45')](_0x221602[_0x2d4a('0x43')][_0x2d4a('0x44')],'Bearer')){validateJwt(_0x221602,_0x9bac28,_0xc497ce);}else{if(_0x436f53){_0xc497ce();}else{return _0x9bac28[_0x2d4a('0x3d')](0x193)[_0x2d4a('0x3f')]({'message':_0x2d4a('0x4b')});}}}else if(_0x221602[_0x2d4a('0x4c')][_0x2d4a('0x4d')]){try{var _0x4b20e4={'audience':hardwareConf[_0x2d4a('0x4e')](),'issuer':hardwareConf[_0x2d4a('0x4e')]()};verifyJwt(_0x221602['query'][_0x2d4a('0x4d')],_0x4b20e4)[_0x2d4a('0x4f')](function(_0x3dae78){return db[_0x2d4a('0x47')][_0x2d4a('0x48')]({'where':{'id':_0x3dae78[_0x2d4a('0x50')]}})['then'](function(_0x52106e){_0x20b87d=_0x52106e;return db[_0x2d4a('0x51')][_0x2d4a('0x39')]({'where':{'id':0x1},'attributes':[_0x2d4a('0x52'),_0x2d4a('0x53')],'raw':!![]});})[_0x2d4a('0x4f')](function(_0x5b49f9){if(!_0x20b87d||!_['isEqual'](_0x20b87d[_0x2d4a('0x54')],_0x3dae78['nonce'])){return _0x9bac28[_0x2d4a('0x3d')](0x191)[_0x2d4a('0x3f')]({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}if(_0x20b87d[_0x2d4a('0x55')]){return _0x9bac28[_0x2d4a('0x3d')](0x191)[_0x2d4a('0x3f')]({'message':_0x2d4a('0x56')});}if(_0x20b87d[_0x2d4a('0x57')]){if(_0x5b49f9[_0x2d4a('0x53')]>0x0){if(moment(_0x20b87d[_0x2d4a('0x58')])[_0x2d4a('0x59')](_0x5b49f9[_0x2d4a('0x53')],_0x2d4a('0x5a'))>moment()){return _0x9bac28[_0x2d4a('0x3d')](0x191)['json']({'message':_0x2d4a('0x56')});}}else{return _0x9bac28[_0x2d4a('0x3d')](0x191)[_0x2d4a('0x3f')]({'message':_0x2d4a('0x56')});}}_0x221602[_0x2d4a('0x37')]={'id':_0x20b87d['id']};_0xc497ce();});})['catch'](function(){return _0x9bac28['status'](0x191)['json']({'message':'Invalid\x20API\x20access\x20key'});});}catch(_0x20650d){_0xc497ce(_0x20650d);}}else if(_0x436f53){_0xc497ce();}else{return _0x9bac28[_0x2d4a('0x3d')](0x193)[_0x2d4a('0x3f')]({'message':_0x2d4a('0x4b')});}})['use'](function(_0x155f2d,_0x3df6b4,_0x5e9704){if(_0x155f2d[_0x2d4a('0x37')]){db[_0x2d4a('0x47')][_0x2d4a('0x48')]({'where':{'id':_0x155f2d[_0x2d4a('0x37')]['id']},'attributes':userAttributes})[_0x2d4a('0x4f')](function(_0x2c91e1){if(!_0x2c91e1){return _0x3df6b4['status'](0x194)[_0x2d4a('0x3f')]({'message':_0x2d4a('0x5b')});}_0x155f2d[_0x2d4a('0x37')]=_0x2c91e1;_0x5e9704();})[_0x2d4a('0x42')](function(_0x61bb3a){_0x5e9704(_0x61bb3a);});}else if(_0x436f53){_0x5e9704();}else{return _0x3df6b4[_0x2d4a('0x3d')](0x194)['json']({'message':_0x2d4a('0x5c')});}});};exports[_0x2d4a('0x5d')]=function canUpdate(){return compose()[_0x2d4a('0x36')](function(_0x4e1901,_0x2585db,_0x4a7b30){return licenseUtil[_0x2d4a('0x5e')]()[_0x2d4a('0x4f')](function(_0x336984){if(_0x336984[_0x2d4a('0x5f')]){_0x4a7b30();}else{return _0x2585db[_0x2d4a('0x3d')](0x193)['json']({'message':'Forbidden'});}})[_0x2d4a('0x42')](function(_0x3b579e){_0x4a7b30(_0x3b579e);});});};exports['isWebrtcLicence']=function isWebrtcLicence(){return compose()[_0x2d4a('0x36')](function(_0x5b0008,_0x16b858,_0x13f768){return licenseUtil[_0x2d4a('0x5e')]()['then'](function(_0x38d795){if(_0x38d795['webrtc']){_0x13f768();}else{return _0x16b858[_0x2d4a('0x3d')](0x193)[_0x2d4a('0x3f')]({'message':_0x2d4a('0x60')});}})[_0x2d4a('0x42')](function(_0x1325ea){_0x13f768(_0x1325ea);});});};exports[_0x2d4a('0x61')]=function(_0x92842c,_0x2b2f4b,_0x1ffb96){_0x92842c[_0x2d4a('0x61')]=!![];return _0x1ffb96();};exports[_0x2d4a('0x62')]=function signToken(_0x5e2f07){return signJwt(_0x5e2f07);};exports[_0x2d4a('0x63')]=function(_0x26a070,_0x3336b2){if(!_0x26a070[_0x2d4a('0x37')]){return _0x3336b2[_0x2d4a('0x3d')](0x194)['json']({'message':_0x2d4a('0x64')});}var _0x6629cd={'payload':{'id':_0x26a070[_0x2d4a('0x37')]['id'],'role':_0x26a070[_0x2d4a('0x37')][_0x2d4a('0xa')]},'options':{'expiresIn':0x15180}};return signJwt(_0x6629cd)['then'](function(_0x4b9a52){_0x3336b2[_0x2d4a('0x65')](_0x2d4a('0x66'),_0x4b9a52);_0x3336b2['redirect'](_0x2d4a('0x67'));})[_0x2d4a('0x42')](function(_0x7f0807){return _0x3336b2[_0x2d4a('0x3d')](0x1f4)['send'](_0x7f0807);});};exports[_0x2d4a('0x68')]=function(_0x4e0198){if(_[_0x2d4a('0x69')](_0x4e0198[_0x2d4a('0x54')])||_[_0x2d4a('0x69')](_0x4e0198[_0x2d4a('0x6a')])){return null;}else{return createJwt(_0x4e0198);}};exports[_0x2d4a('0x6b')]=function(_0x3103ca){_0x3103ca[_0x2d4a('0x54')]=generateNonce();_0x3103ca[_0x2d4a('0x6a')]=generateIssuedAt();return createJwt(_0x3103ca);};exports['regenerateApiKey']=function(_0x255a82,_0x2cbe03){var _0x98046f=_0x255a82[_0x2d4a('0x4c')][_0x2d4a('0x4d')];if(_0x98046f){var _0x334d6a={'nonce':_0x2cbe03[_0x2d4a('0x54')],'iat':_0x2cbe03[_0x2d4a('0x6a')],'audience':hardwareConf[_0x2d4a('0x4e')](),'issuer':hardwareConf[_0x2d4a('0x4e')]()};return verifyJwt(_0x98046f,_0x334d6a)[_0x2d4a('0x4f')](function(){return generateApiKey(_0x2cbe03);});}else{throw{'message':_0x2d4a('0x6c')};}};exports[_0x2d4a('0x6d')]=function(_0xf3df0f){var _0x1ce950=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x1ce950[_0x2d4a('0x6e')](_0xf3df0f))throw new db[(_0x2d4a('0x6f'))]['ValidationError'](_0x2d4a('0x70'));return;};exports[_0x2d4a('0x71')]=function(_0x5aafa4,_0x477ffd,_0x343f25){var _0x1f0b2b=encryptor[_0x2d4a('0x72')](_0x477ffd)[_0x2d4a('0x73')](',');for(var _0x206c30=0x0;_0x206c30<_0x343f25;_0x206c30++){if(!_0x1f0b2b[_0x206c30])break;if(_0x5aafa4[_0x2d4a('0x74')]()===_0x1f0b2b[_0x206c30][_0x2d4a('0x74')]()){var _0x22afb4=util[_0x2d4a('0x75')](_0x2d4a('0x76'),_0x343f25);if(_0x343f25===0x1){_0x22afb4=_0x2d4a('0x77');}throw new db['Sequelize'][(_0x2d4a('0x78'))](_0x22afb4);}}return;};exports[_0x2d4a('0x79')]=function(_0x48c1f9,_0xb5042d){var _0x3f42eb=_0xb5042d?encryptor[_0x2d4a('0x72')](_0xb5042d)[_0x2d4a('0x73')](','):[];if(_0x3f42eb[_0x2d4a('0x7a')]===0x5){_0x3f42eb[_0x2d4a('0x7b')](-0x1,0x1);}_0x3f42eb[_0x2d4a('0x7c')](_0x48c1f9);return encryptor[_0x2d4a('0x7d')](_0x3f42eb[_0x2d4a('0x7e')](','));};function signJwt(_0x282df8){var _0x5bbc96=BPromise[_0x2d4a('0x7f')](jwt[_0x2d4a('0x80')],{'context':jwt});var _0x20445e=_0x282df8['secret']||config[_0x2d4a('0x81')][_0x2d4a('0x9')];return new BPromise(function(_0x153914,_0x2f6851){_0x5bbc96(_0x282df8[_0x2d4a('0x82')],_0x20445e,_0x282df8[_0x2d4a('0x83')])[_0x2d4a('0x4f')](function(_0x3e05c3){_0x153914(_0x3e05c3);})[_0x2d4a('0x42')](function(_0x508648){_0x2f6851(_0x508648);});});}function verifyJwt(_0x21b8e9,_0x17ade0,_0x2a876b){var _0x17ef80=BPromise[_0x2d4a('0x7f')](jwt[_0x2d4a('0x84')],{'context':jwt});var _0x53f52b=_0x2a876b||config[_0x2d4a('0x81')][_0x2d4a('0x9')];return new BPromise(function(_0x22707f,_0x4809af){_0x17ef80(_0x21b8e9,_0x53f52b,_0x17ade0)[_0x2d4a('0x4f')](function(_0x442691){_0x22707f(_0x442691);})['catch'](function(_0x2b0e4c){_0x4809af(_0x2b0e4c);});});}function generateNonce(){return crypto[_0x2d4a('0x85')](0x10)['toString'](_0x2d4a('0x86'));}function generateIssuedAt(){return Math['floor'](Date['now']()/0x3e8)[_0x2d4a('0x87')]();}function createJwt(_0x4158ae){var _0x3b5bb9={'payload':{'iat':_0x4158ae[_0x2d4a('0x6a')],'nonce':_0x4158ae['apiKeyNonce']},'options':{'algorithm':_0x2d4a('0x88'),'subject':_0x4158ae['id'][_0x2d4a('0x87')](),'issuer':hardwareConf[_0x2d4a('0x4e')](),'audience':hardwareConf[_0x2d4a('0x4e')]()}};return signJwt(_0x3b5bb9)['then'](function(_0x4d8111){return{'iat':_0x4158ae[_0x2d4a('0x6a')],'nonce':_0x4158ae[_0x2d4a('0x54')],'token':_0x4d8111};});} \ No newline at end of file diff --git a/server/components/contacts/index.js b/server/components/contacts/index.js index 4412b0c..273aae9 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 _0x6dbd=['cf_','map','CmCustomField','findOne','slice','all','fieldType','type','keys','lodash','findAll','resolve','getContactsSubquery','then','parseAdvancedSearchFilter','parseQueryParameters','where','default','fields','filter','clause','tags','user','skip','checkListsRestrictions','search','ids','tag','countFilteredContacts','count','User','rows','catch','describe','CmContact','startsWith'];(function(_0x39def1,_0xe38627){var _0x40ad14=function(_0x1cf573){while(--_0x1cf573){_0x39def1['push'](_0x39def1['shift']());}};_0x40ad14(++_0xe38627);}(_0x6dbd,0x75));var _0xd6db=function(_0x2e4cbf,_0x8763d3){_0x2e4cbf=_0x2e4cbf-0x0;var _0x52840f=_0x6dbd[_0x2e4cbf];return _0x52840f;};'use strict';var _=require(_0xd6db('0x0'));var sqlUtils=require('./sql-utils');var db=require('../../mysqldb')['db'];exports[_0xd6db('0x1')]=function(_0x474560,_0x36cf91,_0x3f1118,_0x2bde3f){var _0x53586c={'count':0x0,'rows':[]};var _0x32ee8e=sqlUtils['skipContactsQuery'](_0x36cf91,_0x474560);if(_0x32ee8e){return Promise[_0xd6db('0x2')](_0x53586c);}var _0x5a2f63=sqlUtils[_0xd6db('0x3')]();var _0x3f7265={};var _0x2a3d97=![];var _0x23c0bc=![];return Promise[_0xd6db('0x2')]()[_0xd6db('0x4')](function(){if(_0x474560['search']){return sqlUtils[_0xd6db('0x5')](_0x474560['search'],_0x2bde3f);}else{return sqlUtils[_0xd6db('0x6')](_0x474560,_0x2bde3f);}})[_0xd6db('0x4')](function(_0x46e4c1){_0x5a2f63[_0xd6db('0x7')](_0x46e4c1[_0xd6db('0x8')]);_0x5a2f63['where'](_0x46e4c1[_0xd6db('0x9')]);_0x5a2f63['where'](_0x46e4c1[_0xd6db('0xa')]);_0x5a2f63[_0xd6db('0x7')](_0x46e4c1['user'][_0xd6db('0xb')]);_0x3f7265=_0x46e4c1[_0xd6db('0xc')];_0x23c0bc=_0x46e4c1[_0xd6db('0xd')][_0xd6db('0xe')];return sqlUtils[_0xd6db('0xf')](_0x36cf91,_0x474560,_0x23c0bc);})[_0xd6db('0x4')](function(_0x489841){_0x5a2f63[_0xd6db('0x7')](_0x489841);var _0x20886f=_0x474560[_0xd6db('0x10')]?_0x3f7265[_0xd6db('0x11')]:_0x474560[_0xd6db('0x12')];_0x2a3d97=_0x20886f?!![]:![];return sqlUtils[_0xd6db('0x13')](_0x5a2f63,_0x20886f);})['then'](function(_0x7dccd4){_0x53586c['count']=_0x7dccd4;if(_0x53586c[_0xd6db('0x14')]===0x0){return;}if(_0x474560[_0xd6db('0x15')]){_0x23c0bc=!![];}return sqlUtils['buildContactsQuery'](_0x5a2f63,_0x474560['fields'],_0x3f1118,_0x2a3d97,_0x3f7265[_0xd6db('0xb')],_0x23c0bc);})[_0xd6db('0x4')](function(_0x361207){if(!_0x361207){return[];}return sqlUtils['getFilteredContacts'](_0x361207,_0x474560,_0x3f1118);})['then'](function(_0x5dc036){_0x53586c[_0xd6db('0x16')]=_0x5dc036;return _0x53586c;})[_0xd6db('0x17')](function(_0x270b23){throw _0x270b23;});};exports[_0xd6db('0x18')]=function(){var _0x3bf07c={};var _0x1d47af=[];return db[_0xd6db('0x19')][_0xd6db('0x18')]()['then'](function(_0x331ded){_0x3bf07c=_0x331ded;var _0x3e4a24=Object['keys'](_0x3bf07c)[_0xd6db('0xa')](function(_0x1a7204){return _[_0xd6db('0x1a')](_0x1a7204,_0xd6db('0x1b'))?_0x1a7204:undefined;});var _0x521892=_0x3e4a24[_0xd6db('0x1c')](function(_0xb92e58){return db[_0xd6db('0x1d')][_0xd6db('0x1e')]({'where':{'id':_0xb92e58[_0xd6db('0x1f')](0x3)},'raw':!![]});});return Promise[_0xd6db('0x20')](_0x521892);})[_0xd6db('0x4')](function(_0x35bd52){for(var _0x1fc37a=0x0;_0x1fc37a<_0x35bd52['length'];_0x1fc37a++){if(_0x35bd52[_0x1fc37a]){var _0x359a3d=_0xd6db('0x1b')+_0x35bd52[_0x1fc37a]['id'];_0x3bf07c[_0x359a3d][_0xd6db('0x21')]=_0x35bd52[_0x1fc37a][_0xd6db('0x22')];}}_0x1d47af=_[_0xd6db('0x1c')](Object[_0xd6db('0x23')](_0x3bf07c),function(_0x426dca){return{'name':_0x426dca,'type':_0x3bf07c[_0x426dca][_0xd6db('0x22')]};});return _0x1d47af;})[_0xd6db('0x17')](function(_0x3246d0){throw _0x3246d0;});}; \ No newline at end of file +var _0x8e8a=['lodash','./sql-utils','findAll','skipContactsQuery','resolve','getContactsSubquery','search','parseAdvancedSearchFilter','parseQueryParameters','default','where','fields','filter','user','clause','then','ids','tag','countFilteredContacts','count','User','buildContactsQuery','rows','describe','CmContact','keys','startsWith','cf_','map','findOne','all','length','type','catch'];(function(_0x2ea356,_0x4c373b){var _0x1439d5=function(_0x1dab2c){while(--_0x1dab2c){_0x2ea356['push'](_0x2ea356['shift']());}};_0x1439d5(++_0x4c373b);}(_0x8e8a,0x1ba));var _0xa8e8=function(_0x216a6e,_0x5d85ac){_0x216a6e=_0x216a6e-0x0;var _0x2e5f85=_0x8e8a[_0x216a6e];return _0x2e5f85;};'use strict';var _=require(_0xa8e8('0x0'));var sqlUtils=require(_0xa8e8('0x1'));var db=require('../../mysqldb')['db'];exports[_0xa8e8('0x2')]=function(_0x15caed,_0x33e32a,_0x38ccd9,_0x5de256){var _0x323cf1={'count':0x0,'rows':[]};var _0x3c8469=sqlUtils[_0xa8e8('0x3')](_0x33e32a,_0x15caed);if(_0x3c8469){return Promise[_0xa8e8('0x4')](_0x323cf1);}var _0x1a21e1=sqlUtils[_0xa8e8('0x5')]();var _0x2d9c61={};var _0x411000=![];var _0x372a72=![];return Promise[_0xa8e8('0x4')]()['then'](function(){if(_0x15caed[_0xa8e8('0x6')]){return sqlUtils[_0xa8e8('0x7')](_0x15caed[_0xa8e8('0x6')],_0x5de256);}else{return sqlUtils[_0xa8e8('0x8')](_0x15caed,_0x5de256);}})['then'](function(_0x3a60e7){_0x1a21e1['where'](_0x3a60e7[_0xa8e8('0x9')]);_0x1a21e1[_0xa8e8('0xa')](_0x3a60e7[_0xa8e8('0xb')]);_0x1a21e1['where'](_0x3a60e7[_0xa8e8('0xc')]);_0x1a21e1[_0xa8e8('0xa')](_0x3a60e7[_0xa8e8('0xd')][_0xa8e8('0xe')]);_0x2d9c61=_0x3a60e7['tags'];_0x372a72=_0x3a60e7[_0xa8e8('0xd')]['skip'];return sqlUtils['checkListsRestrictions'](_0x33e32a,_0x15caed,_0x372a72);})[_0xa8e8('0xf')](function(_0x490640){_0x1a21e1[_0xa8e8('0xa')](_0x490640);var _0x59eaba=_0x15caed[_0xa8e8('0x6')]?_0x2d9c61[_0xa8e8('0x10')]:_0x15caed[_0xa8e8('0x11')];_0x411000=_0x59eaba?!![]:![];return sqlUtils[_0xa8e8('0x12')](_0x1a21e1,_0x59eaba);})['then'](function(_0x5012a3){_0x323cf1[_0xa8e8('0x13')]=_0x5012a3;if(_0x323cf1['count']===0x0){return;}if(_0x15caed[_0xa8e8('0x14')]){_0x372a72=!![];}return sqlUtils[_0xa8e8('0x15')](_0x1a21e1,_0x15caed[_0xa8e8('0xb')],_0x38ccd9,_0x411000,_0x2d9c61[_0xa8e8('0xe')],_0x372a72);})[_0xa8e8('0xf')](function(_0x24f346){if(!_0x24f346){return[];}return sqlUtils['getFilteredContacts'](_0x24f346,_0x15caed,_0x38ccd9);})[_0xa8e8('0xf')](function(_0x5546e0){_0x323cf1[_0xa8e8('0x16')]=_0x5546e0;return _0x323cf1;})['catch'](function(_0x5e221c){throw _0x5e221c;});};exports[_0xa8e8('0x17')]=function(){var _0x360672={};var _0x43628f=[];return db[_0xa8e8('0x18')][_0xa8e8('0x17')]()[_0xa8e8('0xf')](function(_0x1b6e71){_0x360672=_0x1b6e71;var _0x3cfdd1=Object[_0xa8e8('0x19')](_0x360672)['filter'](function(_0x8307d8){return _[_0xa8e8('0x1a')](_0x8307d8,_0xa8e8('0x1b'))?_0x8307d8:undefined;});var _0x3cdcea=_0x3cfdd1[_0xa8e8('0x1c')](function(_0x3d6b87){return db['CmCustomField'][_0xa8e8('0x1d')]({'where':{'id':_0x3d6b87['slice'](0x3)},'raw':!![]});});return Promise[_0xa8e8('0x1e')](_0x3cdcea);})['then'](function(_0x1effc5){for(var _0x114267=0x0;_0x114267<_0x1effc5[_0xa8e8('0x1f')];_0x114267++){if(_0x1effc5[_0x114267]){var _0x57aefb=_0xa8e8('0x1b')+_0x1effc5[_0x114267]['id'];_0x360672[_0x57aefb]['fieldType']=_0x1effc5[_0x114267]['type'];}}_0x43628f=_[_0xa8e8('0x1c')](Object[_0xa8e8('0x19')](_0x360672),function(_0x108927){return{'name':_0x108927,'type':_0x360672[_0x108927][_0xa8e8('0x20')]};});return _0x43628f;})[_0xa8e8('0x21')](function(_0x43c415){throw _0x43c415;});}; \ No newline at end of file diff --git a/server/components/contacts/sql-utils.js b/server/components/contacts/sql-utils.js index 887f9d0..fd8108c 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 _0xa489=['end','Tag','clause','and','tags','ids','User','user','uc.UserId\x20=\x20?','skip','some','compact','Contact','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','resolve','fields','tag','then','filter','getLists','c.ListId\x20IS\x20NULL','c.ListId\x20IN\x20?','map','attributes','limit','offset','group','having','order','DESC','subqry.','color','SELECT','CmContact','query','toString','Tags','clone','COUNT(*)','c.id','t.id\x20IN\x20?','QueryTypes','sequelize','exports','squel','../interaction/utils','role','agent','search','ListId','autocomplete','true','select','from','cm_contacts','where','c.deletedAt\x20IS\x20NULL','subqry','cm_user_has_contacts','uc.CmContactId\x20=\x20','.id','left_join','ct.CmContactId\x20=\x20','firstName','lastName','phone','mobile','fax','email','createdAt','TagIds','includes','push','forEach','field','expr','getSelectedTags','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.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','length','conditions','name','dateOfBirth','datetime','DATE','buildExpression','type','default','start','value'];(function(_0x55fa03,_0xcb96c2){var _0x2cd7cd=function(_0x56611f){while(--_0x56611f){_0x55fa03['push'](_0x55fa03['shift']());}};_0x2cd7cd(++_0xcb96c2);}(_0xa489,0x1bd));var _0x9a48=function(_0x213e44,_0x27f4e3){_0x213e44=_0x213e44-0x0;var _0x426e10=_0xa489[_0x213e44];return _0x426e10;};'use strict';var _=require('lodash');var squel=require(_0x9a48('0x0'));var as=require('../parsers/advancedSearch');var qs=require('../parsers/qs');var utils=require(_0x9a48('0x1'));var db=require('../../mysqldb')['db'];function skipContactsQuery(_0x334309,_0x47615d){var _0xa1dd18=![];if(_0x334309[_0x9a48('0x2')]===_0x9a48('0x3')&&!_0x47615d[_0x9a48('0x4')]&&!_0x47615d[_0x9a48('0x5')]&&_0x47615d[_0x9a48('0x6')]!==_0x9a48('0x7')){_0xa1dd18=!![];}return _0xa1dd18;}function getContactsSubquery(){return squel[_0x9a48('0x8')]()[_0x9a48('0x9')](_0x9a48('0xa'),'c')[_0x9a48('0xb')](_0x9a48('0xc'));}function applyJoinClauses(_0x576e4b,_0x28b418){var _0x5ae663=_0x28b418?'c':_0x9a48('0xd');_0x576e4b['left_join'](_0x9a48('0xe'),'uc',_0x9a48('0xf')+_0x5ae663+_0x9a48('0x10'))[_0x9a48('0x11')]('cm_contact_has_tags','ct',_0x9a48('0x12')+_0x5ae663+'.id')[_0x9a48('0x11')]('tools_tags','t','t.id\x20=\x20ct.TagId');return _0x576e4b;}function addFieldsToQuery(_0x340446,_0x7a52c7,_0x122e42,_0x497c75,_0x2b7b51){var _0xbfc11a=_0x2b7b51?'c':_0x9a48('0xd');if(!_0x7a52c7){_0x7a52c7=['id',_0x9a48('0x13'),_0x9a48('0x14'),_0x9a48('0x15'),_0x9a48('0x16'),_0x9a48('0x17'),_0x9a48('0x18'),_0x9a48('0x5'),'CompanyId',_0x9a48('0x19'),'updatedAt','deletedAt',_0x9a48('0x1a')];}else if(!_0x7a52c7[_0x9a48('0x1b')]('id')){_0x7a52c7[_0x9a48('0x1c')]('id');}var _0x2655ec=_0x122e42&&_0x2b7b51||!_0x122e42&&!_0x2b7b51;if(_0x497c75){_0x2655ec=_0x497c75&&_0x2b7b51||!_0x497c75&&!_0x2b7b51;}_0x7a52c7[_0x9a48('0x1d')](function(_0x35425d){if(_0x35425d==='TagIds'){if(_0x2655ec){_0x340446['field']('GROUP_CONCAT(DISTINCT\x20t.id)',_0x35425d);}else if(_0x122e42||_0x497c75){_0x340446[_0x9a48('0x1e')](_0xbfc11a+'.'+_0x35425d);}}else{_0x340446[_0x9a48('0x1e')](_0xbfc11a+'.'+_0x35425d);}});return _0x340446;}function getSqlClauses(){var _0x5a93cc={'default':squel[_0x9a48('0x1f')](),'fields':squel[_0x9a48('0x1f')](),'filter':squel[_0x9a48('0x1f')](),'tags':{'clause':squel[_0x9a48('0x1f')](),'ids':null},'user':{'clause':squel[_0x9a48('0x1f')](),'skip':![]}};return _0x5a93cc;}function parseTagParameter(_0x13d6df){var _0x52dc34=squel[_0x9a48('0x1f')]();if(_0x13d6df){var _0x5b5ee3=utils[_0x9a48('0x20')](_0x13d6df);_0x5b5ee3[_0x9a48('0x1d')](function(_0x14cbc1){_0x52dc34['or']('CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x14cbc1+',%');});}return _0x52dc34;}function parseSearchFilter(_0x3ccc9d){var _0x2bb51c=squel[_0x9a48('0x1f')]();if(_0x3ccc9d){var _0x4df810=_0x3ccc9d[_0x9a48('0x21')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(_0x4df810[_0x9a48('0x22')]('\x20')['length']>0x1){_0x2bb51c['or'](_0x9a48('0x23'),qs[_0x9a48('0x24')](_0x4df810,!![]),null);}else{if(qs[_0x9a48('0x25')](_0x4df810)){_0x2bb51c['or'](_0x9a48('0x26'),_0x4df810+'%');_0x2bb51c['or']('c.phone\x20LIKE\x20?',_0x4df810+'%');_0x2bb51c['or']('c.mobile\x20LIKE\x20?',_0x4df810+'%');_0x2bb51c['or'](_0x9a48('0x27'),_0x4df810+'%');}else if(qs[_0x9a48('0x28')](_0x4df810)){_0x2bb51c['or'](_0x9a48('0x29'),_0x4df810+'%');}else{_0x2bb51c['or'](_0x9a48('0x2a'),'%'+_0x4df810+'%');_0x2bb51c['or'](_0x9a48('0x2b'),'%'+_0x4df810+'%');_0x2bb51c['or'](_0x9a48('0x29'),'%'+_0x4df810+'%');}}}return _0x2bb51c;}function parseAdvancedSearchFilter(_0x84da7f,_0x995f88){var _0x2e9dec=getSqlClauses();var _0x4e8314=as['parseSearch'](_0x84da7f);var _0x2a45bf=_0x4e8314['sqlOperator'];for(var _0x520d51=0x0;_0x520d51<_0x4e8314['conditions'][_0x9a48('0x2c')];_0x520d51++){var _0x13554a=_0x4e8314[_0x9a48('0x2d')][_0x520d51];var _0x432ef5='c';var _0x2bc476=_['find'](_0x995f88,[_0x9a48('0x2e'),_0x13554a[_0x9a48('0x1e')]]);if(_0x2bc476){if(_0x13554a[_0x9a48('0x1e')]===_0x9a48('0x2f')||_0x2bc476['fieldType']===_0x9a48('0x30')){_0x13554a['castTo']=_0x9a48('0x31');}var _0x6caa3c=as[_0x9a48('0x32')](_0x432ef5,_0x2bc476[_0x9a48('0x33')],_0x13554a);_0x2e9dec[_0x9a48('0x34')][_0x2a45bf](_0x6caa3c['text'],_0x6caa3c['value'][_0x9a48('0x35')],_0x6caa3c[_0x9a48('0x36')][_0x9a48('0x37')]);}else{if(_0x13554a['field']===_0x9a48('0x38')){var _0x3a0e2a=_0x13554a['value'][_0x9a48('0x22')](',')['map'](function(_0x122437){return Number(_0x122437);});var _0xcd377a=parseTagParameter(_0x3a0e2a);_0x2e9dec['tags'][_0x9a48('0x39')][_0x9a48('0x3a')](_0xcd377a);_0x2e9dec[_0x9a48('0x3b')][_0x9a48('0x3c')]=_0x3a0e2a;}else if(_0x13554a[_0x9a48('0x1e')]===_0x9a48('0x3d')){_0x2e9dec[_0x9a48('0x3e')][_0x9a48('0x39')]['and'](_0x9a48('0x3f'),_0x13554a[_0x9a48('0x36')]);_0x2e9dec[_0x9a48('0x3e')][_0x9a48('0x40')]=!![];}}}return _0x2e9dec;}function parseModelFields(_0x34c672,_0x4464df){var _0x2235ec=squel[_0x9a48('0x1f')]();var _0x41d45b=_(_0x34c672)['keys']()['map'](function(_0x4f8334){return _[_0x9a48('0x41')](_0x4464df,[_0x9a48('0x2e'),_0x4f8334])?_0x4f8334:undefined;})[_0x9a48('0x42')]()[_0x9a48('0x36')]();if(_0x34c672[_0x9a48('0x43')]){_0x41d45b[_0x9a48('0x1c')](_0x9a48('0x43'));}if(_0x34c672['User']){_0x41d45b[_0x9a48('0x1c')](_0x9a48('0x3d'));}if(_0x41d45b[_0x9a48('0x2c')]>0x0){_0x41d45b[_0x9a48('0x1d')](function(_0x4006cb){if(_0x4006cb==='ListId'){_0x2235ec[_0x9a48('0x3a')]('c.ListId\x20IN\x20?',[][_0x9a48('0x44')](_0x34c672[_0x4006cb]));}else if(_0x4006cb===_0x9a48('0x43')){var _0x4d2e1b='%'+_0x34c672[_0x4006cb]+'%';_0x2235ec[_0x9a48('0x3a')](_0x9a48('0x45'),_0x4d2e1b);}else if(_0x4006cb==='User'){_0x2235ec[_0x9a48('0x3a')](_0x9a48('0x3f'),_0x34c672[_0x4006cb]);}else{_0x2235ec['and']('c.'+_0x4006cb+'\x20=\x20?',_0x34c672[_0x4006cb]);}});}return _0x2235ec;}function parseQueryParameters(_0x1342b0,_0x228055){var _0x58c21c=getSqlClauses();return Promise[_0x9a48('0x46')]()['then'](function(){return parseModelFields(_0x1342b0,_0x228055);})['then'](function(_0x37a4e4){_0x58c21c[_0x9a48('0x47')][_0x9a48('0x3a')](_0x37a4e4);return parseTagParameter(_0x1342b0[_0x9a48('0x48')]);})[_0x9a48('0x49')](function(_0x59f13a){_0x58c21c['tags'][_0x9a48('0x39')][_0x9a48('0x3a')](_0x59f13a);return parseSearchFilter(_0x1342b0[_0x9a48('0x4a')]);})['then'](function(_0x166383){_0x58c21c[_0x9a48('0x4a')]=_0x166383;return _0x58c21c;});}function checkListsRestrictions(_0x29d1f7,_0x29d0f1,_0x2c91c6){var _0x4bd667=squel[_0x9a48('0x1f')]();return Promise[_0x9a48('0x46')]()[_0x9a48('0x49')](function(){if(_0x29d0f1[_0x9a48('0x4')]&&_0x29d1f7[_0x9a48('0x2')]===_0x9a48('0x3')&&!_0x2c91c6){return _0x29d1f7[_0x9a48('0x4b')]({'attributes':['id'],'raw':!![]});}})[_0x9a48('0x49')](function(_0x53e10e){if(_0x53e10e){if(_0x53e10e[_0x9a48('0x2c')]===0x0){_0x4bd667[_0x9a48('0x3a')](_0x9a48('0x4c'));}else{_0x4bd667[_0x9a48('0x3a')](_0x9a48('0x4d'),_[_0x9a48('0x4e')](_0x53e10e,'id'));}}})[_0x9a48('0x49')](function(){return _0x4bd667;});}function buildContactsQuery(_0x386e5f,_0x4e513c,_0xb05a19,_0x55c55a,_0x190881,_0x1db69f){if(_0x4e513c){_0x4e513c=_0xb05a19[_0x9a48('0x4f')];}_0x386e5f=addFieldsToQuery(_0x386e5f,_0x4e513c,_0x55c55a,_0x1db69f,!![]);var _0x32ea2a=squel[_0x9a48('0x8')]();_0x32ea2a=addFieldsToQuery(_0x32ea2a,_0x4e513c,_0x55c55a,_0x1db69f,![]);if(_0x55c55a||_0x1db69f){_0x386e5f=applyJoinClauses(_0x386e5f,!![]);_0x386e5f['group']('c.id');if(_0xb05a19[_0x9a48('0x50')]){_0x32ea2a['limit'](_0xb05a19[_0x9a48('0x50')]);}if(_0xb05a19[_0x9a48('0x51')]){_0x32ea2a[_0x9a48('0x51')](_0xb05a19['offset']);}}else{_0x32ea2a=applyJoinClauses(_0x32ea2a,![]);_0x32ea2a[_0x9a48('0x52')]('subqry.id');if(_0xb05a19[_0x9a48('0x50')]){_0x386e5f[_0x9a48('0x50')](_0xb05a19[_0x9a48('0x50')]);}if(_0xb05a19[_0x9a48('0x51')]){_0x386e5f[_0x9a48('0x51')](_0xb05a19[_0x9a48('0x51')]);}}_0x32ea2a[_0x9a48('0x53')](_0x190881);if(_0xb05a19['order']){_0xb05a19[_0x9a48('0x54')][_0x9a48('0x1d')](function(_0x575819){_0x386e5f[_0x9a48('0x54')]('c.'+_0x575819[0x0],_0x575819[0x1]===_0x9a48('0x55')?![]:!![]);_0x32ea2a[_0x9a48('0x54')](_0x9a48('0x56')+_0x575819[0x0],_0x575819[0x1]===_0x9a48('0x55')?![]:!![]);});}_0x32ea2a[_0x9a48('0x9')](_0x386e5f,_0x9a48('0xd'));return _0x32ea2a;}function getFilteredContacts(_0x143459){var _0x4c8c20=[];return db[_0x9a48('0x38')]['findAll']({'attributes':['id',_0x9a48('0x2e'),_0x9a48('0x57')],'raw':!![]})['then'](function(_0x4cc442){_0x4c8c20=_['keyBy'](_0x4cc442,'id');var _0x96b56e={'type':db['Sequelize']['QueryTypes'][_0x9a48('0x58')],'model':db[_0x9a48('0x59')],'mapToModel':!![],'nest':!![],'raw':!![]};return db['sequelize'][_0x9a48('0x5a')](_0x143459[_0x9a48('0x5b')](),_0x96b56e);})[_0x9a48('0x49')](function(_0x5cf320){_0x5cf320[_0x9a48('0x1d')](function(_0x2508c1){if(_0x2508c1[_0x9a48('0x1a')]){_0x2508c1[_0x9a48('0x5c')]=[];_0x2508c1[_0x9a48('0x1a')]['split'](',')['forEach'](function(_0x19e3de){_0x2508c1[_0x9a48('0x5c')][_0x9a48('0x1c')](_0x4c8c20[_0x19e3de]);});}delete _0x2508c1[_0x9a48('0x1a')];});return _0x5cf320;});}function countFilteredContacts(_0x35e0e2,_0x25d0ba){var _0x11852e=_0x35e0e2[_0x9a48('0x5d')]();_0x11852e[_0x9a48('0x1e')](_0x9a48('0x5e'));_0x11852e=applyJoinClauses(_0x11852e,!![]);_0x35e0e2[_0x9a48('0x52')](_0x9a48('0x5f'));var _0x55ff4d=utils[_0x9a48('0x20')](_0x25d0ba);if(!_['isEmpty'](_0x55ff4d)){_0x11852e[_0x9a48('0xb')](_0x9a48('0x60'),_0x55ff4d);}var _0x24f474={'type':db['Sequelize'][_0x9a48('0x61')][_0x9a48('0x58')],'raw':!![]};return db[_0x9a48('0x62')][_0x9a48('0x5a')](_0x11852e[_0x9a48('0x5b')](),_0x24f474)[_0x9a48('0x49')](function(_0x4463f6){return _0x4463f6[0x0][_0x9a48('0x5e')];});}module[_0x9a48('0x63')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file +var _0x809b=['some','name','compact','Contact','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','resolve','then','filter','getLists','c.ListId\x20IS\x20NULL','attributes','c.id','limit','group','having','order','DESC','findAll','color','SELECT','CmContact','sequelize','query','toString','Tags','isEmpty','QueryTypes','COUNT(*)','exports','squel','../parsers/advancedSearch','../parsers/qs','../interaction/utils','../../mysqldb','role','agent','search','ListId','autocomplete','true','select','from','where','c.deletedAt\x20IS\x20NULL','subqry','left_join','cm_user_has_contacts','.id','cm_contact_has_tags','ct.CmContactId\x20=\x20','tools_tags','t.id\x20=\x20ct.TagId','firstName','phone','mobile','fax','CompanyId','createdAt','updatedAt','includes','push','TagIds','field','GROUP_CONCAT(DISTINCT\x20t.id)','expr','getSelectedTags','forEach','replace','split','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.firstName\x20LIKE\x20?','parseSearch','sqlOperator','conditions','find','dateOfBirth','fieldType','datetime','castTo','buildExpression','type','default','text','value','start','end','Tag','clause','and','tags','ids','User','user','uc.UserId\x20=\x20?','keys'];(function(_0x2f32c4,_0x531dc6){var _0x3f3018=function(_0x406998){while(--_0x406998){_0x2f32c4['push'](_0x2f32c4['shift']());}};_0x3f3018(++_0x531dc6);}(_0x809b,0x1bb));var _0xb809=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x809b[_0x16b9ed];return _0x66b1f8;};'use strict';var _=require('lodash');var squel=require(_0xb809('0x0'));var as=require(_0xb809('0x1'));var qs=require(_0xb809('0x2'));var utils=require(_0xb809('0x3'));var db=require(_0xb809('0x4'))['db'];function skipContactsQuery(_0x280c34,_0x39635b){var _0x4ad5fa=![];if(_0x280c34[_0xb809('0x5')]===_0xb809('0x6')&&!_0x39635b[_0xb809('0x7')]&&!_0x39635b[_0xb809('0x8')]&&_0x39635b[_0xb809('0x9')]!==_0xb809('0xa')){_0x4ad5fa=!![];}return _0x4ad5fa;}function getContactsSubquery(){return squel[_0xb809('0xb')]()[_0xb809('0xc')]('cm_contacts','c')[_0xb809('0xd')](_0xb809('0xe'));}function applyJoinClauses(_0x4966cd,_0x6e8ae){var _0x502887=_0x6e8ae?'c':_0xb809('0xf');_0x4966cd[_0xb809('0x10')](_0xb809('0x11'),'uc','uc.CmContactId\x20=\x20'+_0x502887+_0xb809('0x12'))['left_join'](_0xb809('0x13'),'ct',_0xb809('0x14')+_0x502887+'.id')[_0xb809('0x10')](_0xb809('0x15'),'t',_0xb809('0x16'));return _0x4966cd;}function addFieldsToQuery(_0x248aba,_0x32e289,_0x5dffb3,_0x2eb132,_0xb2f1cb){var _0x17d5e9=_0xb2f1cb?'c':_0xb809('0xf');if(!_0x32e289){_0x32e289=['id',_0xb809('0x17'),'lastName',_0xb809('0x18'),_0xb809('0x19'),_0xb809('0x1a'),'email','ListId',_0xb809('0x1b'),_0xb809('0x1c'),_0xb809('0x1d'),'deletedAt','TagIds'];}else if(!_0x32e289[_0xb809('0x1e')]('id')){_0x32e289[_0xb809('0x1f')]('id');}var _0x3d1153=_0x5dffb3&&_0xb2f1cb||!_0x5dffb3&&!_0xb2f1cb;if(_0x2eb132){_0x3d1153=_0x2eb132&&_0xb2f1cb||!_0x2eb132&&!_0xb2f1cb;}_0x32e289['forEach'](function(_0x31ef94){if(_0x31ef94===_0xb809('0x20')){if(_0x3d1153){_0x248aba[_0xb809('0x21')](_0xb809('0x22'),_0x31ef94);}else if(_0x5dffb3||_0x2eb132){_0x248aba[_0xb809('0x21')](_0x17d5e9+'.'+_0x31ef94);}}else{_0x248aba[_0xb809('0x21')](_0x17d5e9+'.'+_0x31ef94);}});return _0x248aba;}function getSqlClauses(){var _0x490f75={'default':squel['expr'](),'fields':squel[_0xb809('0x23')](),'filter':squel['expr'](),'tags':{'clause':squel[_0xb809('0x23')](),'ids':null},'user':{'clause':squel['expr'](),'skip':![]}};return _0x490f75;}function parseTagParameter(_0x36d8d5){var _0x2ba2f8=squel[_0xb809('0x23')]();if(_0x36d8d5){var _0x4ef581=utils[_0xb809('0x24')](_0x36d8d5);_0x4ef581[_0xb809('0x25')](function(_0x42cdb7){_0x2ba2f8['or']('CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x42cdb7+',%');});}return _0x2ba2f8;}function parseSearchFilter(_0x3c5e2c){var _0x58061c=squel['expr']();if(_0x3c5e2c){var _0x3daa0c=_0x3c5e2c[_0xb809('0x26')]('\x5c','\x5c\x5c')[_0xb809('0x26')](/'/g,'\x27\x27');if(_0x3daa0c[_0xb809('0x27')]('\x20')[_0xb809('0x28')]>0x1){_0x58061c['or'](_0xb809('0x29'),qs[_0xb809('0x2a')](_0x3daa0c,!![]),null);}else{if(qs[_0xb809('0x2b')](_0x3daa0c)){_0x58061c['or'](_0xb809('0x2c'),_0x3daa0c+'%');_0x58061c['or']('c.phone\x20LIKE\x20?',_0x3daa0c+'%');_0x58061c['or']('c.mobile\x20LIKE\x20?',_0x3daa0c+'%');_0x58061c['or'](_0xb809('0x2d'),_0x3daa0c+'%');}else if(qs[_0xb809('0x2e')](_0x3daa0c)){_0x58061c['or']('c.email\x20LIKE\x20?',_0x3daa0c+'%');}else{_0x58061c['or'](_0xb809('0x2f'),'%'+_0x3daa0c+'%');_0x58061c['or']('c.lastName\x20LIKE\x20?','%'+_0x3daa0c+'%');_0x58061c['or']('c.email\x20LIKE\x20?','%'+_0x3daa0c+'%');}}}return _0x58061c;}function parseAdvancedSearchFilter(_0x4b5036,_0x1d1fc8){var _0x3ddf9d=getSqlClauses();var _0x17be54=as[_0xb809('0x30')](_0x4b5036);var _0x126b4a=_0x17be54[_0xb809('0x31')];for(var _0x11b455=0x0;_0x11b455<_0x17be54[_0xb809('0x32')][_0xb809('0x28')];_0x11b455++){var _0x145e95=_0x17be54['conditions'][_0x11b455];var _0x1ec17a='c';var _0x2b5770=_[_0xb809('0x33')](_0x1d1fc8,['name',_0x145e95[_0xb809('0x21')]]);if(_0x2b5770){if(_0x145e95[_0xb809('0x21')]===_0xb809('0x34')||_0x2b5770[_0xb809('0x35')]===_0xb809('0x36')){_0x145e95[_0xb809('0x37')]='DATE';}var _0x4d7b50=as[_0xb809('0x38')](_0x1ec17a,_0x2b5770[_0xb809('0x39')],_0x145e95);_0x3ddf9d[_0xb809('0x3a')][_0x126b4a](_0x4d7b50[_0xb809('0x3b')],_0x4d7b50[_0xb809('0x3c')][_0xb809('0x3d')],_0x4d7b50['value'][_0xb809('0x3e')]);}else{if(_0x145e95[_0xb809('0x21')]===_0xb809('0x3f')){var _0x3a5442=_0x145e95[_0xb809('0x3c')][_0xb809('0x27')](',')['map'](function(_0x1acf24){return Number(_0x1acf24);});var _0x3fc879=parseTagParameter(_0x3a5442);_0x3ddf9d['tags'][_0xb809('0x40')][_0xb809('0x41')](_0x3fc879);_0x3ddf9d[_0xb809('0x42')][_0xb809('0x43')]=_0x3a5442;}else if(_0x145e95[_0xb809('0x21')]===_0xb809('0x44')){_0x3ddf9d[_0xb809('0x45')][_0xb809('0x40')][_0xb809('0x41')](_0xb809('0x46'),_0x145e95[_0xb809('0x3c')]);_0x3ddf9d['user']['skip']=!![];}}}return _0x3ddf9d;}function parseModelFields(_0x3cc02c,_0x4620b1){var _0x71afc=squel[_0xb809('0x23')]();var _0x2f2c30=_(_0x3cc02c)[_0xb809('0x47')]()['map'](function(_0x50c14a){return _[_0xb809('0x48')](_0x4620b1,[_0xb809('0x49'),_0x50c14a])?_0x50c14a:undefined;})[_0xb809('0x4a')]()['value']();if(_0x3cc02c[_0xb809('0x4b')]){_0x2f2c30[_0xb809('0x1f')](_0xb809('0x4b'));}if(_0x3cc02c[_0xb809('0x44')]){_0x2f2c30['push']('User');}if(_0x2f2c30[_0xb809('0x28')]>0x0){_0x2f2c30['forEach'](function(_0x3201f3){if(_0x3201f3==='ListId'){_0x71afc[_0xb809('0x41')](_0xb809('0x4c'),[][_0xb809('0x4d')](_0x3cc02c[_0x3201f3]));}else if(_0x3201f3===_0xb809('0x4b')){var _0x1e25c0='%'+_0x3cc02c[_0x3201f3]+'%';_0x71afc['and'](_0xb809('0x4e'),_0x1e25c0);}else if(_0x3201f3===_0xb809('0x44')){_0x71afc['and']('uc.UserId\x20=\x20?',_0x3cc02c[_0x3201f3]);}else{_0x71afc['and']('c.'+_0x3201f3+'\x20=\x20?',_0x3cc02c[_0x3201f3]);}});}return _0x71afc;}function parseQueryParameters(_0x33241a,_0x226cdc){var _0x31fe42=getSqlClauses();return Promise[_0xb809('0x4f')]()[_0xb809('0x50')](function(){return parseModelFields(_0x33241a,_0x226cdc);})[_0xb809('0x50')](function(_0x50823d){_0x31fe42['fields'][_0xb809('0x41')](_0x50823d);return parseTagParameter(_0x33241a['tag']);})['then'](function(_0x4276e3){_0x31fe42[_0xb809('0x42')]['clause']['and'](_0x4276e3);return parseSearchFilter(_0x33241a['filter']);})['then'](function(_0x1814ce){_0x31fe42[_0xb809('0x51')]=_0x1814ce;return _0x31fe42;});}function checkListsRestrictions(_0x3fcb45,_0x190b43,_0x1d46e1){var _0x45ab44=squel[_0xb809('0x23')]();return Promise[_0xb809('0x4f')]()[_0xb809('0x50')](function(){if(_0x190b43[_0xb809('0x7')]&&_0x3fcb45['role']===_0xb809('0x6')&&!_0x1d46e1){return _0x3fcb45[_0xb809('0x52')]({'attributes':['id'],'raw':!![]});}})['then'](function(_0xb13e50){if(_0xb13e50){if(_0xb13e50['length']===0x0){_0x45ab44[_0xb809('0x41')](_0xb809('0x53'));}else{_0x45ab44[_0xb809('0x41')]('c.ListId\x20IN\x20?',_['map'](_0xb13e50,'id'));}}})[_0xb809('0x50')](function(){return _0x45ab44;});}function buildContactsQuery(_0x5baed0,_0x4aca70,_0x1dd6eb,_0x5e50a2,_0x573b8c,_0x1921f9){if(_0x4aca70){_0x4aca70=_0x1dd6eb[_0xb809('0x54')];}_0x5baed0=addFieldsToQuery(_0x5baed0,_0x4aca70,_0x5e50a2,_0x1921f9,!![]);var _0x2e9197=squel['select']();_0x2e9197=addFieldsToQuery(_0x2e9197,_0x4aca70,_0x5e50a2,_0x1921f9,![]);if(_0x5e50a2||_0x1921f9){_0x5baed0=applyJoinClauses(_0x5baed0,!![]);_0x5baed0['group'](_0xb809('0x55'));if(_0x1dd6eb['limit']){_0x2e9197[_0xb809('0x56')](_0x1dd6eb['limit']);}if(_0x1dd6eb['offset']){_0x2e9197['offset'](_0x1dd6eb['offset']);}}else{_0x2e9197=applyJoinClauses(_0x2e9197,![]);_0x2e9197[_0xb809('0x57')]('subqry.id');if(_0x1dd6eb[_0xb809('0x56')]){_0x5baed0[_0xb809('0x56')](_0x1dd6eb[_0xb809('0x56')]);}if(_0x1dd6eb['offset']){_0x5baed0['offset'](_0x1dd6eb['offset']);}}_0x2e9197[_0xb809('0x58')](_0x573b8c);if(_0x1dd6eb['order']){_0x1dd6eb[_0xb809('0x59')][_0xb809('0x25')](function(_0x839248){_0x5baed0[_0xb809('0x59')]('c.'+_0x839248[0x0],_0x839248[0x1]===_0xb809('0x5a')?![]:!![]);_0x2e9197['order']('subqry.'+_0x839248[0x0],_0x839248[0x1]==='DESC'?![]:!![]);});}_0x2e9197['from'](_0x5baed0,'subqry');return _0x2e9197;}function getFilteredContacts(_0x4b8321){var _0x4e6721=[];return db['Tag'][_0xb809('0x5b')]({'attributes':['id','name',_0xb809('0x5c')],'raw':!![]})[_0xb809('0x50')](function(_0x718da6){_0x4e6721=_['keyBy'](_0x718da6,'id');var _0x4f397d={'type':db['Sequelize']['QueryTypes'][_0xb809('0x5d')],'model':db[_0xb809('0x5e')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0xb809('0x5f')][_0xb809('0x60')](_0x4b8321[_0xb809('0x61')](),_0x4f397d);})['then'](function(_0x3c78d7){_0x3c78d7[_0xb809('0x25')](function(_0x2eabd4){if(_0x2eabd4[_0xb809('0x20')]){_0x2eabd4[_0xb809('0x62')]=[];_0x2eabd4[_0xb809('0x20')][_0xb809('0x27')](',')[_0xb809('0x25')](function(_0x200ed9){_0x2eabd4['Tags'][_0xb809('0x1f')](_0x4e6721[_0x200ed9]);});}delete _0x2eabd4[_0xb809('0x20')];});return _0x3c78d7;});}function countFilteredContacts(_0x14bd1f,_0x59f4a1){var _0x3b4ab3=_0x14bd1f['clone']();_0x3b4ab3[_0xb809('0x21')]('COUNT(*)');_0x3b4ab3=applyJoinClauses(_0x3b4ab3,!![]);_0x14bd1f[_0xb809('0x57')](_0xb809('0x55'));var _0x4b3ccb=utils[_0xb809('0x24')](_0x59f4a1);if(!_[_0xb809('0x63')](_0x4b3ccb)){_0x3b4ab3[_0xb809('0xd')]('t.id\x20IN\x20?',_0x4b3ccb);}var _0x31afaa={'type':db['Sequelize'][_0xb809('0x64')][_0xb809('0x5d')],'raw':!![]};return db[_0xb809('0x5f')]['query'](_0x3b4ab3[_0xb809('0x61')](),_0x31afaa)[_0xb809('0x50')](function(_0x5d708f){return _0x5d708f[0x0][_0xb809('0x65')];});}module[_0xb809('0x66')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 5aee918..ca0ffa8 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 _0xc989=['close','decryptFile','createDecipher','update','unlink','encryptString','secret','utf8','base64','decryptString','crypto','bluebird','app','secrets','aes-256-ctr','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','getCiphers','filter','indexOf','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','data','binary','end','final','write'];(function(_0x3e478c,_0x152670){var _0x29ef89=function(_0x3d0d77){while(--_0x3d0d77){_0x3e478c['push'](_0x3e478c['shift']());}};_0x29ef89(++_0x152670);}(_0xc989,0x133));var _0x9c98=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xc989[_0x397e5f];return _0x5302b8;};'use strict';var crypto=require(_0x9c98('0x0'));var fs=require('fs');var BPromise=require(_0x9c98('0x1'));var _=require('lodash');var config=require('../../config/environment');var logger=require('../../config/logger')(_0x9c98('0x2'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x9c98('0x3')]['session'],'algorithm':_0x9c98('0x4')};const fileOptions={'algorithm':'aes192'};if(config['encrypt']&&config['encrypt']['algorithm']){var isSupported=isAlgorithmSupported(config[_0x9c98('0x5')][_0x9c98('0x6')]);if(isSupported){fileOptions[_0x9c98('0x6')]=config[_0x9c98('0x5')][_0x9c98('0x6')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x9c98('0x7')](',\x20');logger[_0x9c98('0x8')](config[_0x9c98('0x5')][_0x9c98('0x6')],_0x9c98('0x9'),supportedAlgorithms);}}function isASupportedCipher(_0xdcc922){return AES_SUPPORTED_RX['test'](_0xdcc922);}function getSupportedCiphers(){return crypto[_0x9c98('0xa')]()[_0x9c98('0xb')](isASupportedCipher);}function isAlgorithmSupported(_0x110f63){return getSupportedCiphers()[_0x9c98('0xc')](_0x110f63)>-0x1;}function combineOptions(_0x40f2b0){var _0x8a2bca={};for(var _0x5f5a2e in fileOptions){if(fileOptions[_0x9c98('0xd')](_0x5f5a2e)){_0x8a2bca[_0x5f5a2e]=fileOptions[_0x5f5a2e];}}if(_0x40f2b0){for(var _0x3029d3 in _0x40f2b0){if(_0x40f2b0[_0x9c98('0xd')](_0x3029d3)){_0x8a2bca[_0x3029d3]=_0x40f2b0[_0x3029d3];}}}return _0x8a2bca;}exports[_0x9c98('0xe')]=function(_0x11c959,_0x17e54d,_0x50b573,_0x493e8f){return new BPromise(function(_0x58b523,_0x217f6f){_0x493e8f=combineOptions(_0x493e8f);var _0x21e74b=new Buffer(_0x50b573);var _0xfa258f=fs[_0x9c98('0xf')](_0x11c959);var _0x44fd7e=fs[_0x9c98('0x10')](_0x17e54d);var _0x15033c=crypto[_0x9c98('0x11')](_0x493e8f['algorithm'],_0x21e74b);_0xfa258f['on'](_0x9c98('0x12'),function(_0x35c473){var _0x2fcc4a=new Buffer(_0x15033c['update'](_0x35c473),_0x9c98('0x13'));_0x44fd7e['write'](_0x2fcc4a);});_0xfa258f['on'](_0x9c98('0x14'),function(){try{var _0x4fa367=new Buffer(_0x15033c[_0x9c98('0x15')](_0x9c98('0x13')),_0x9c98('0x13'));_0x44fd7e[_0x9c98('0x16')](_0x4fa367);_0x44fd7e[_0x9c98('0x14')]();_0x44fd7e['on'](_0x9c98('0x17'),function(){return _0x58b523(_0x17e54d);});}catch(_0x1587ca){fs['unlink'](_0x17e54d);return _0x217f6f(_0x1587ca);}});});};exports[_0x9c98('0x18')]=function(_0x47ff6a,_0x46bf3e,_0x17e8f9,_0xa32a40){return new BPromise(function(_0x1dd85d,_0x58f185){_0xa32a40=combineOptions(_0xa32a40);var _0x56ac03=new Buffer(_0x17e8f9);var _0x477ec8=fs[_0x9c98('0xf')](_0x47ff6a);var _0x264b4a=fs[_0x9c98('0x10')](_0x46bf3e);var _0x433c9c=crypto[_0x9c98('0x19')](_0xa32a40[_0x9c98('0x6')],_0x56ac03);_0x477ec8['on']('data',function(_0x10d82){var _0x5edc18=new Buffer(_0x433c9c[_0x9c98('0x1a')](_0x10d82),_0x9c98('0x13'));_0x264b4a[_0x9c98('0x16')](_0x5edc18);});_0x477ec8['on']('end',function(){try{var _0xd7cb90=new Buffer(_0x433c9c[_0x9c98('0x15')](_0x9c98('0x13')),_0x9c98('0x13'));_0x264b4a[_0x9c98('0x16')](_0xd7cb90);_0x264b4a[_0x9c98('0x14')]();_0x264b4a['on'](_0x9c98('0x17'),function(){return _0x1dd85d(_0x46bf3e);});}catch(_0x4d30dc){fs[_0x9c98('0x1b')](_0x46bf3e);return _0x58f185(_0x4d30dc);}});});};exports[_0x9c98('0x1c')]=function(_0x2be0e7,_0xbebb1e,_0x340b44){var _0x451092=_0x340b44||stringOptions[_0x9c98('0x6')];var _0x544cdf=_0xbebb1e||stringOptions[_0x9c98('0x1d')];var _0x33c75b=crypto[_0x9c98('0x11')](_0x451092,_0x544cdf);var _0x161fa1=_0x33c75b[_0x9c98('0x1a')](_0x2be0e7,_0x9c98('0x1e'),_0x9c98('0x1f'));_0x161fa1+=_0x33c75b[_0x9c98('0x15')]('base64');return _0x161fa1;};exports[_0x9c98('0x20')]=function(_0x11205f,_0x4634dd,_0x4390ef){var _0x4d6841=_0x4390ef||stringOptions[_0x9c98('0x6')];var _0x2c0e75=_0x4634dd||stringOptions[_0x9c98('0x1d')];var _0x274d5c=crypto[_0x9c98('0x19')](_0x4d6841,_0x2c0e75);var _0x11cfa5=_0x274d5c[_0x9c98('0x1a')](_0x11205f,_0x9c98('0x1f'),_0x9c98('0x1e'));_0x11cfa5+=_0x274d5c[_0x9c98('0x15')](_0x9c98('0x1e'));return _0x11cfa5;}; \ No newline at end of file +var _0x0264=['aes-256-ctr','encrypt','algorithm','join','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','getCiphers','filter','indexOf','hasOwnProperty','createReadStream','createWriteStream','createCipher','data','update','end','final','binary','write','close','decryptFile','createDecipher','encryptString','secret','utf8','base64','decryptString','crypto','bluebird','lodash','../../config/environment','../../config/logger','app','session'];(function(_0x2a2686,_0x49923b){var _0x4aff96=function(_0x10fc50){while(--_0x10fc50){_0x2a2686['push'](_0x2a2686['shift']());}};_0x4aff96(++_0x49923b);}(_0x0264,0x7d));var _0x4026=function(_0x53cf7f,_0x1121ca){_0x53cf7f=_0x53cf7f-0x0;var _0x299f5=_0x0264[_0x53cf7f];return _0x299f5;};'use strict';var crypto=require(_0x4026('0x0'));var fs=require('fs');var BPromise=require(_0x4026('0x1'));var _=require(_0x4026('0x2'));var config=require(_0x4026('0x3'));var logger=require(_0x4026('0x4'))(_0x4026('0x5'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config['secrets'][_0x4026('0x6')],'algorithm':_0x4026('0x7')};const fileOptions={'algorithm':'aes192'};if(config[_0x4026('0x8')]&&config[_0x4026('0x8')]['algorithm']){var isSupported=isAlgorithmSupported(config[_0x4026('0x8')][_0x4026('0x9')]);if(isSupported){fileOptions['algorithm']=config[_0x4026('0x8')]['algorithm'];}else{var supportedAlgorithms=getSupportedCiphers()[_0x4026('0xa')](',\x20');logger['error'](config[_0x4026('0x8')][_0x4026('0x9')],_0x4026('0xb'),supportedAlgorithms);}}function isASupportedCipher(_0x367b70){return AES_SUPPORTED_RX['test'](_0x367b70);}function getSupportedCiphers(){return crypto[_0x4026('0xc')]()[_0x4026('0xd')](isASupportedCipher);}function isAlgorithmSupported(_0xbfb809){return getSupportedCiphers()[_0x4026('0xe')](_0xbfb809)>-0x1;}function combineOptions(_0x39de76){var _0x1d6406={};for(var _0x4ff3e2 in fileOptions){if(fileOptions[_0x4026('0xf')](_0x4ff3e2)){_0x1d6406[_0x4ff3e2]=fileOptions[_0x4ff3e2];}}if(_0x39de76){for(var _0x30f9bb in _0x39de76){if(_0x39de76[_0x4026('0xf')](_0x30f9bb)){_0x1d6406[_0x30f9bb]=_0x39de76[_0x30f9bb];}}}return _0x1d6406;}exports['encryptFile']=function(_0x39c76d,_0x1d660c,_0x5c4b22,_0x1cc206){return new BPromise(function(_0x25b7e7,_0xcc32ff){_0x1cc206=combineOptions(_0x1cc206);var _0x4f42c7=new Buffer(_0x5c4b22);var _0x424417=fs[_0x4026('0x10')](_0x39c76d);var _0x26ddef=fs[_0x4026('0x11')](_0x1d660c);var _0x596d09=crypto[_0x4026('0x12')](_0x1cc206['algorithm'],_0x4f42c7);_0x424417['on'](_0x4026('0x13'),function(_0x305938){var _0x2ef30e=new Buffer(_0x596d09[_0x4026('0x14')](_0x305938),'binary');_0x26ddef['write'](_0x2ef30e);});_0x424417['on'](_0x4026('0x15'),function(){try{var _0xd819d1=new Buffer(_0x596d09[_0x4026('0x16')]('binary'),_0x4026('0x17'));_0x26ddef[_0x4026('0x18')](_0xd819d1);_0x26ddef['end']();_0x26ddef['on'](_0x4026('0x19'),function(){return _0x25b7e7(_0x1d660c);});}catch(_0x43d363){fs['unlink'](_0x1d660c);return _0xcc32ff(_0x43d363);}});});};exports[_0x4026('0x1a')]=function(_0x4e3463,_0x132661,_0x571082,_0x59839c){return new BPromise(function(_0x422fbd,_0x4cea00){_0x59839c=combineOptions(_0x59839c);var _0x16d8c3=new Buffer(_0x571082);var _0x36dc9c=fs['createReadStream'](_0x4e3463);var _0x32d036=fs['createWriteStream'](_0x132661);var _0x5ce456=crypto[_0x4026('0x1b')](_0x59839c[_0x4026('0x9')],_0x16d8c3);_0x36dc9c['on']('data',function(_0x4ec591){var _0x24a496=new Buffer(_0x5ce456['update'](_0x4ec591),_0x4026('0x17'));_0x32d036[_0x4026('0x18')](_0x24a496);});_0x36dc9c['on'](_0x4026('0x15'),function(){try{var _0x1ff942=new Buffer(_0x5ce456['final']('binary'),_0x4026('0x17'));_0x32d036['write'](_0x1ff942);_0x32d036[_0x4026('0x15')]();_0x32d036['on'](_0x4026('0x19'),function(){return _0x422fbd(_0x132661);});}catch(_0x27e655){fs['unlink'](_0x132661);return _0x4cea00(_0x27e655);}});});};exports[_0x4026('0x1c')]=function(_0x46df94,_0x106e8c,_0x5b42ff){var _0x31f753=_0x5b42ff||stringOptions[_0x4026('0x9')];var _0x278d1a=_0x106e8c||stringOptions[_0x4026('0x1d')];var _0x178f3d=crypto[_0x4026('0x12')](_0x31f753,_0x278d1a);var _0x38393f=_0x178f3d[_0x4026('0x14')](_0x46df94,_0x4026('0x1e'),_0x4026('0x1f'));_0x38393f+=_0x178f3d[_0x4026('0x16')](_0x4026('0x1f'));return _0x38393f;};exports[_0x4026('0x20')]=function(_0x3b2c21,_0x22e336,_0x5d012f){var _0x1a8925=_0x5d012f||stringOptions[_0x4026('0x9')];var _0x5dec7=_0x22e336||stringOptions[_0x4026('0x1d')];var _0x263834=crypto[_0x4026('0x1b')](_0x1a8925,_0x5dec7);var _0x2a57ae=_0x263834[_0x4026('0x14')](_0x3b2c21,_0x4026('0x1f'),_0x4026('0x1e'));_0x2a57ae+=_0x263834['final']('utf8');return _0x2a57ae;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 4ad9ed9..ce312af 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 _0xcd1d=['argv','savename','update','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','split','splitSizeCsv','then','sequelize','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','num','length','range','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','query','dirname','basename','.csv','existsSync','mkdirSync','each','%s%d.%s','csv','join','%s.%s','writeFileSync','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','zip','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','util','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics'];(function(_0x18ab7b,_0x4d5424){var _0x31f3e6=function(_0x1774b4){while(--_0x1774b4){_0x18ab7b['push'](_0x18ab7b['shift']());}};_0x31f3e6(++_0x4d5424);}(_0xcd1d,0x12b));var _0xdcd1=function(_0x36f9a6,_0x36d990){_0x36f9a6=_0x36f9a6-0x0;var _0x1d85d5=_0xcd1d[_0x36f9a6];return _0x1d85d5;};'use strict';var util=require(_0xdcd1('0x0'));var path=require('path');var _=require('lodash');var csv=require('to-csv');var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0xdcd1('0x1'));var rimraf=require(_0xdcd1('0x2'));var db=require('../../mysqldb')['db'];var dbH=require(_0xdcd1('0x3'))[_0xdcd1('0x4')];var logger=require(_0xdcd1('0x5'))(_0xdcd1('0x6'));var EXTRACTED_REPORT_ID=Number(process[_0xdcd1('0x7')][0x2]);var QUERY=process[_0xdcd1('0x7')][0x3];var PATH=process[_0xdcd1('0x7')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x1d3f23,_0x228dbf){var _0x204ed4={'status':_0x1d3f23};var _0x105bd8={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x228dbf){_0x204ed4[_0xdcd1('0x8')]=_0x228dbf;}return db['AnalyticExtractedReport'][_0xdcd1('0x9')](_0x204ed4,_0x105bd8);}function main(){var _0x463714=0x1388;var _0x2a2af9;logger[_0xdcd1('0xa')](util['format'](_0xdcd1('0xb'),EXTRACTED_REPORT_ID,_0xdcd1('0xc')));return db[_0xdcd1('0xd')][_0xdcd1('0xe')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xdcd1('0xf'),_0xdcd1('0x10')]})['then'](function(_0x49fdfe){if(_0x49fdfe){_0x2a2af9=_0x49fdfe;_0x463714=_0x2a2af9[_0xdcd1('0x10')]||0x1388;}})[_0xdcd1('0x11')](function(){return dbH[_0xdcd1('0x12')]['query'](util[_0xdcd1('0x13')](_0xdcd1('0x14'),QUERY),{'type':dbH[_0xdcd1('0x12')][_0xdcd1('0x15')]['SELECT']});})[_0xdcd1('0x11')](function(_0x3f1660){if(!_0x3f1660[0x0][_0xdcd1('0x16')]){return analyticExtractedReport('Empty');}var _0x1ae4cf=[];var _0x5c81ba=0x0;if(_0x2a2af9[_0xdcd1('0xf')]){if(_0x3f1660&&_0x3f1660[_0xdcd1('0x17')]){var _0x330f5b=_[_0xdcd1('0x18')](_0x3f1660[0x0][_0xdcd1('0x16')]/_0x463714);var _0x39516f=Number[_0xdcd1('0x19')](_0x3f1660[0x0]['num']/_0x463714)?_0x3f1660[0x0][_0xdcd1('0x16')]%_0x463714:0x0;_0x330f5b[_0xdcd1('0x1a')](function(_0x1d14ca){if(_0x1d14ca>0x0){_0x5c81ba+=_0x463714;}_0x1ae4cf[_0xdcd1('0x1b')](dbH[_0xdcd1('0x12')]['query'](util[_0xdcd1('0x13')](_0xdcd1('0x1c'),QUERY,_0x463714,_0x5c81ba),{'type':dbH['sequelize'][_0xdcd1('0x15')][_0xdcd1('0x1d')]}));});if(_0x39516f>0x0){_0x5c81ba+=_0x463714;_0x1ae4cf[_0xdcd1('0x1b')](dbH[_0xdcd1('0x12')][_0xdcd1('0x1e')](util[_0xdcd1('0x13')](_0xdcd1('0x1c'),QUERY,_0x39516f,_0x5c81ba),{'type':dbH[_0xdcd1('0x12')][_0xdcd1('0x15')][_0xdcd1('0x1d')]}));}}}else{_0x1ae4cf[_0xdcd1('0x1b')](dbH[_0xdcd1('0x12')][_0xdcd1('0x1e')](QUERY,{'type':dbH[_0xdcd1('0x12')][_0xdcd1('0x15')][_0xdcd1('0x1d')]}));}var _0x43534b=path[_0xdcd1('0x1f')](PATH);var _0x2f3044=path[_0xdcd1('0x20')](PATH,_0xdcd1('0x21'));var _0x5d76e7=_0x2a2af9[_0xdcd1('0xf')]&&_0x1ae4cf[_0xdcd1('0x17')]>0x1;var _0x2d695e=[];if(!fs[_0xdcd1('0x22')](path['join'](_0x43534b,_0x2f3044))&&_0x5d76e7){fs[_0xdcd1('0x23')](path['join'](_0x43534b,_0x2f3044));}return BPromise[_0xdcd1('0x24')](_0x1ae4cf,function(_0xe20c46){_0x2d695e[_0xdcd1('0x1b')](_0xe20c46);})[_0xdcd1('0x11')](function(){for(var _0x3bda60=0x0;_0x3bda60<_0x2d695e[_0xdcd1('0x17')];_0x3bda60+=0x1){var _0x2711fd;var _0x11cc6d=_0x2d695e[_0x3bda60];if(_0x5d76e7){_0x2711fd=path['join'](_0x43534b,_0x2f3044,util['format'](_0xdcd1('0x25'),_0x2f3044,_0x3bda60,_0xdcd1('0x26')));}else{_0x2711fd=path[_0xdcd1('0x27')](_0x43534b,util[_0xdcd1('0x13')](_0xdcd1('0x28'),_0x2f3044,_0xdcd1('0x26')));}fs[_0xdcd1('0x29')](_0x2711fd,csv(_0x11cc6d));}})[_0xdcd1('0x11')](function(){if(_0x5d76e7){return new Promise(function(_0x313077){zipdir(path[_0xdcd1('0x27')](_0x43534b,_0x2f3044),{'saveTo':path['join'](_0x43534b,util[_0xdcd1('0x13')](_0xdcd1('0x28'),_0x2f3044,'zip'))},function(_0x1ca82d,_0x13ac7e){rimraf(path['join'](_0x43534b,_0x2f3044),function(){});_0x313077(_0xdcd1('0x2a'));});});}})[_0xdcd1('0x11')](function(){logger[_0xdcd1('0xa')](util[_0xdcd1('0x13')](_0xdcd1('0x2b'),EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport('Completed',_0x5d76e7?util[_0xdcd1('0x13')](_0xdcd1('0x28'),_0x2f3044,_0x5d76e7?_0xdcd1('0x2c'):_0xdcd1('0x26')):null);});})[_0xdcd1('0x2d')](function(_0x52919c){logger[_0xdcd1('0xa')](util['format'](_0xdcd1('0x2e'),EXTRACTED_REPORT_ID,_0xdcd1('0xc')),util[_0xdcd1('0x2f')](_0x52919c,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xdcd1('0x30'));})[_0xdcd1('0x31')](function(){process[_0xdcd1('0x32')](EXIT_CODE);});}main(); \ No newline at end of file +var _0xd11c=['format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','find','split','splitSizeCsv','then','sequelize','SELECT','num','length','isInteger','forEach','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','push','dirname','basename','.csv','existsSync','join','mkdirSync','each','%s%d.%s','csv','%s.%s','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','inspect','Failed','finally','exit','util','path','lodash','to-csv','bluebird','zip-dir','rimraf','dbH','../../config/logger','analytics','argv','AnalyticExtractedReport','info'];(function(_0x166742,_0x55520c){var _0xb7814a=function(_0x18feaf){while(--_0x18feaf){_0x166742['push'](_0x166742['shift']());}};_0xb7814a(++_0x55520c);}(_0xd11c,0x86));var _0xcd11=function(_0x49e283,_0x1c8a0b){_0x49e283=_0x49e283-0x0;var _0x6d7b4e=_0xd11c[_0x49e283];return _0x6d7b4e;};'use strict';var util=require(_0xcd11('0x0'));var path=require(_0xcd11('0x1'));var _=require(_0xcd11('0x2'));var csv=require(_0xcd11('0x3'));var fs=require('fs');var BPromise=require(_0xcd11('0x4'));var zipdir=require(_0xcd11('0x5'));var rimraf=require(_0xcd11('0x6'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')[_0xcd11('0x7')];var logger=require(_0xcd11('0x8'))(_0xcd11('0x9'));var EXTRACTED_REPORT_ID=Number(process[_0xcd11('0xa')][0x2]);var QUERY=process['argv'][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x59e4bd,_0x1811e6){var _0x459c06={'status':_0x59e4bd};var _0x3a99fd={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1811e6){_0x459c06['savename']=_0x1811e6;}return db[_0xcd11('0xb')]['update'](_0x459c06,_0x3a99fd);}function main(){var _0x295851=0x1388;var _0x31d700;logger[_0xcd11('0xc')](util[_0xcd11('0xd')](_0xcd11('0xe'),EXTRACTED_REPORT_ID,'CSV'));return db[_0xcd11('0xf')][_0xcd11('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xcd11('0x11'),_0xcd11('0x12')]})[_0xcd11('0x13')](function(_0x1ddee3){if(_0x1ddee3){_0x31d700=_0x1ddee3;_0x295851=_0x31d700[_0xcd11('0x12')]||0x1388;}})[_0xcd11('0x13')](function(){return dbH[_0xcd11('0x14')]['query'](util[_0xcd11('0xd')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0xcd11('0x14')]['QueryTypes'][_0xcd11('0x15')]});})[_0xcd11('0x13')](function(_0x4d6400){if(!_0x4d6400[0x0][_0xcd11('0x16')]){return analyticExtractedReport('Empty');}var _0x24a24c=[];var _0xa8d025=0x0;if(_0x31d700['split']){if(_0x4d6400&&_0x4d6400[_0xcd11('0x17')]){var _0x1549ce=_['range'](_0x4d6400[0x0][_0xcd11('0x16')]/_0x295851);var _0x4a6867=Number[_0xcd11('0x18')](_0x4d6400[0x0]['num']/_0x295851)?_0x4d6400[0x0]['num']%_0x295851:0x0;_0x1549ce[_0xcd11('0x19')](function(_0x22b48b){if(_0x22b48b>0x0){_0xa8d025+=_0x295851;}_0x24a24c['push'](dbH['sequelize'][_0xcd11('0x1a')](util[_0xcd11('0xd')](_0xcd11('0x1b'),QUERY,_0x295851,_0xa8d025),{'type':dbH[_0xcd11('0x14')]['QueryTypes'][_0xcd11('0x15')]}));});if(_0x4a6867>0x0){_0xa8d025+=_0x295851;_0x24a24c['push'](dbH[_0xcd11('0x14')]['query'](util[_0xcd11('0xd')](_0xcd11('0x1b'),QUERY,_0x4a6867,_0xa8d025),{'type':dbH[_0xcd11('0x14')][_0xcd11('0x1c')][_0xcd11('0x15')]}));}}}else{_0x24a24c[_0xcd11('0x1d')](dbH[_0xcd11('0x14')]['query'](QUERY,{'type':dbH['sequelize']['QueryTypes'][_0xcd11('0x15')]}));}var _0x3068e8=path[_0xcd11('0x1e')](PATH);var _0x374bda=path[_0xcd11('0x1f')](PATH,_0xcd11('0x20'));var _0x24f5ff=_0x31d700[_0xcd11('0x11')]&&_0x24a24c[_0xcd11('0x17')]>0x1;var _0x1f998b=[];if(!fs[_0xcd11('0x21')](path[_0xcd11('0x22')](_0x3068e8,_0x374bda))&&_0x24f5ff){fs[_0xcd11('0x23')](path[_0xcd11('0x22')](_0x3068e8,_0x374bda));}return BPromise[_0xcd11('0x24')](_0x24a24c,function(_0x423830){_0x1f998b[_0xcd11('0x1d')](_0x423830);})['then'](function(){for(var _0x54a438=0x0;_0x54a438<_0x1f998b[_0xcd11('0x17')];_0x54a438+=0x1){var _0x524b9d;var _0x133586=_0x1f998b[_0x54a438];if(_0x24f5ff){_0x524b9d=path[_0xcd11('0x22')](_0x3068e8,_0x374bda,util['format'](_0xcd11('0x25'),_0x374bda,_0x54a438,_0xcd11('0x26')));}else{_0x524b9d=path[_0xcd11('0x22')](_0x3068e8,util[_0xcd11('0xd')](_0xcd11('0x27'),_0x374bda,'csv'));}fs['writeFileSync'](_0x524b9d,csv(_0x133586));}})[_0xcd11('0x13')](function(){if(_0x24f5ff){return new Promise(function(_0x580f41){zipdir(path[_0xcd11('0x22')](_0x3068e8,_0x374bda),{'saveTo':path[_0xcd11('0x22')](_0x3068e8,util[_0xcd11('0xd')](_0xcd11('0x27'),_0x374bda,_0xcd11('0x28')))},function(_0x2da2b1,_0x3c7d5a){rimraf(path[_0xcd11('0x22')](_0x3068e8,_0x374bda),function(){});_0x580f41('zip\x20finished');});});}})[_0xcd11('0x13')](function(){logger[_0xcd11('0xc')](util['format'](_0xcd11('0x29'),EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport('Completed',_0x24f5ff?util['format']('%s.%s',_0x374bda,_0x24f5ff?'zip':_0xcd11('0x26')):null);});})[_0xcd11('0x2a')](function(_0x51de0b){logger[_0xcd11('0xc')](util[_0xcd11('0xd')](_0xcd11('0x2b'),EXTRACTED_REPORT_ID,_0xcd11('0x2c')),util[_0xcd11('0x2d')](_0x51de0b,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xcd11('0x2e'));})[_0xcd11('0x2f')](function(){process[_0xcd11('0x30')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 401c418..7897149 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 _0x0c25=['map','pick','toString','value','fill','length','body','push','concat','chunk','keys','forEach','format','startDate','endDate','header','pageBreak','before','margin','landscape','\x20/\x20','footer','Arial','black','right','num','Empty','find','split','then','splitSizePdf','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','dirname','basename','.pdf','existsSync','join','mkdirSync','each','flatten','createPdfKitDocument','%s%d.%s','pdf','all','%s.%s','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','PDF','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','channel','interactionId','YYYY-MM-DD','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','createWriteStream','finish','error','end','createPdfFromHTML','path','lodash','util','moment','html-to-pdfmake','pdfmake/src/printer','zip-dir','jsdom','JSDOM','window','bluebird','../../mysqldb','dbH','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport'];(function(_0x108379,_0x17b7a9){var _0x2d8fc9=function(_0x2e808e){while(--_0x2e808e){_0x108379['push'](_0x108379['shift']());}};_0x2d8fc9(++_0x17b7a9);}(_0x0c25,0x1ca));var _0x50c2=function(_0x38a3d6,_0x52e305){_0x38a3d6=_0x38a3d6-0x0;var _0x3768d7=_0x0c25[_0x38a3d6];return _0x3768d7;};'use strict';var _=require(_0x50c2('0x0'));var fs=require('fs');var util=require(_0x50c2('0x1'));var path=require('path');var moment=require(_0x50c2('0x2'));var htmlToPdfmake=require(_0x50c2('0x3'));var PdfPrinter=require(_0x50c2('0x4'));var zipdir=require(_0x50c2('0x5'));var rimraf=require('rimraf');var JSDOM=require(_0x50c2('0x6'))[_0x50c2('0x7')];var window=new JSDOM('')[_0x50c2('0x8')];var BPromise=require(_0x50c2('0x9'));var db=require(_0x50c2('0xa'))['db'];var dbH=require('../../mysqldb')[_0x50c2('0xb')];var logger=require('../../config/logger')(_0x50c2('0xc'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x50c2('0xd')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0x50c2('0xd')][0x5];var FORMAT=_0x50c2('0xe');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x48f559,_0x4990e0){var _0x460a76={'status':_0x48f559};var _0x26b597={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x4990e0){_0x460a76[_0x50c2('0xf')]=_0x4990e0;}return db[_0x50c2('0x10')]['update'](_0x460a76,_0x26b597);}function getHeaders(_0x19840c){return _[_0x50c2('0x11')](_0x19840c,function(_0x45be6b){return{'text':_0x45be6b,'style':'tableHeader'};});}function getRows(_0x45a70e,_0x24154a){return _[_0x50c2('0x11')](_0x24154a,function(_0x4d243d){return _(_0x4d243d)[_0x50c2('0x12')](_0x45a70e)[_0x50c2('0x11')](function(_0x3fb053){return _0x3fb053?_[_0x50c2('0x13')](_0x3fb053):'';})[_0x50c2('0x14')]();});}function createTable(_0x1f162e,_0x538b2a){var _0x45ee0f={'widths':_[_0x50c2('0x15')](Array(_0x1f162e[_0x50c2('0x16')]),0x91),'heights':function(_0x45ac7d){return _0x45ac7d===0x0?'auto':0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x5e666c=getHeaders(_0x1f162e);_0x45ee0f[_0x50c2('0x17')][_0x50c2('0x18')](_0x5e666c);var _0xcd4c50=getRows(_0x1f162e,_0x538b2a);_0x45ee0f['body']=_0x45ee0f[_0x50c2('0x17')][_0x50c2('0x19')](_0xcd4c50);return _0x45ee0f;}function createTables(_0x38c727){var _0x175eda=[];var _0x1104ee=_[_0x50c2('0x1a')](Object[_0x50c2('0x1b')](_0x38c727[0x0]),0x5);_0x1104ee[_0x50c2('0x1c')](function(_0x4d4b81){_0x175eda[_0x50c2('0x18')](createTable(_0x4d4b81,_0x38c727));});return _0x175eda;}function getPDFDocDefinition(_0x5c7a0c){var _0x273700=util[_0x50c2('0x1d')]('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,EXTRACTED_REPORT['name'],moment(EXTRACTED_REPORT[_0x50c2('0x1e')])[_0x50c2('0x1d')](FORMAT),moment(EXTRACTED_REPORT[_0x50c2('0x1f')])[_0x50c2('0x1d')](FORMAT));var _0x52ce15=[];for(var _0x40283a=0x0;_0x40283a<_0x5c7a0c[_0x50c2('0x16')];_0x40283a++){var _0x5078f8=[];if(_0x40283a===0x0){_0x5078f8[_0x50c2('0x18')]({'text':_0x273700,'style':_0x50c2('0x20')});}var _0x2f632b={'table':_0x5c7a0c[_0x40283a]};if(_0x40283a>0x0){_0x2f632b[_0x50c2('0x21')]=_0x50c2('0x22');_0x2f632b[_0x50c2('0x23')]=[0x0,0x46,0x0,0x0];}_0x5078f8[_0x50c2('0x18')](_0x2f632b);_0x52ce15[_0x50c2('0x18')](_0x5078f8);}return{'pageSize':'A4','pageOrientation':_0x50c2('0x24'),'content':_0x52ce15,'footer':function(_0x1d884e,_0x370062){return{'text':_0x1d884e[_0x50c2('0x13')]()+_0x50c2('0x25')+_0x370062,'style':_0x50c2('0x26')};},'defaultStyle':{'font':_0x50c2('0x27')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x50c2('0x28')},'footer':{'alignment':_0x50c2('0x29'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x455e71){var _0x7c1df1=0x1388;var _0x504758;if(!_0x455e71[0x0][_0x50c2('0x2a')]){return analyticExtractedReport(_0x50c2('0x2b'));}return db['Setting'][_0x50c2('0x2c')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x50c2('0x2d'),'splitSizePdf']})[_0x50c2('0x2e')](function(_0x10e38c){if(_0x10e38c){_0x504758=_0x10e38c;_0x7c1df1=_0x504758[_0x50c2('0x2f')]||0x3e8;}})[_0x50c2('0x2e')](function(){var _0x78336e=[];var _0x8f13db=0x0;if(_0x504758[_0x50c2('0x2d')]){if(_0x455e71&&_0x455e71[_0x50c2('0x16')]){var _0x3bdedc=_['range'](_0x455e71[0x0][_0x50c2('0x2a')]/_0x7c1df1);var _0x28e5ae=Number['isInteger'](_0x455e71[0x0]['num']/_0x7c1df1)?_0x455e71[0x0][_0x50c2('0x2a')]%_0x7c1df1:0x0;_0x3bdedc[_0x50c2('0x1c')](function(_0x18c17f){if(_0x18c17f>0x0){_0x8f13db+=_0x7c1df1;}_0x78336e[_0x50c2('0x18')](dbH[_0x50c2('0x30')][_0x50c2('0x31')](util[_0x50c2('0x1d')](_0x50c2('0x32'),QUERY,_0x7c1df1,_0x8f13db),{'type':dbH[_0x50c2('0x30')][_0x50c2('0x33')][_0x50c2('0x34')]}));});if(_0x28e5ae>0x0){_0x8f13db+=_0x7c1df1;_0x78336e['push'](dbH[_0x50c2('0x30')][_0x50c2('0x31')](util[_0x50c2('0x1d')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x28e5ae,_0x8f13db),{'type':dbH[_0x50c2('0x30')]['QueryTypes']['SELECT']}));}}}else{_0x78336e[_0x50c2('0x18')](dbH[_0x50c2('0x30')][_0x50c2('0x31')](QUERY,{'type':dbH['sequelize']['QueryTypes'][_0x50c2('0x34')]}));}var _0x1c9a60=path[_0x50c2('0x35')](PATH);var _0x52a766=path[_0x50c2('0x36')](PATH,_0x50c2('0x37'));var _0x384622=_0x504758[_0x50c2('0x2d')]&&_0x78336e['length']>0x1;var _0x187743=[];if(!fs[_0x50c2('0x38')](path[_0x50c2('0x39')](_0x1c9a60,_0x52a766))&&_0x384622){fs[_0x50c2('0x3a')](path[_0x50c2('0x39')](_0x1c9a60,_0x52a766));}return BPromise[_0x50c2('0x3b')](_0x78336e,function(_0x49e67d){_0x187743[_0x50c2('0x18')](_0x49e67d);})[_0x50c2('0x2e')](function(){var _0x59605a=[];for(var _0x5ba96f=0x0;_0x5ba96f<_0x187743['length'];_0x5ba96f+=0x1){var _0xc187=_0x187743[_0x5ba96f];var _0x361e3d=createTables(_[_0x50c2('0x3c')](_0xc187));var _0x2c95f8;var _0x250135=getPDFDocDefinition(_0x361e3d);var _0xb5035f=getPDFPrinter();var _0x2534ed=_0xb5035f[_0x50c2('0x3d')](_0x250135);if(_0x384622){_0x2c95f8=path[_0x50c2('0x39')](_0x1c9a60,_0x52a766,util['format'](_0x50c2('0x3e'),_0x52a766,_0x5ba96f,_0x50c2('0x3f')));}else{_0x2c95f8=path[_0x50c2('0x39')](_0x1c9a60,util['format']('%s.%s',_0x52a766,'pdf'));}_0x59605a[_0x50c2('0x18')](writePDFDocument(_0x2534ed,_0x2c95f8));}return Promise[_0x50c2('0x40')](_0x59605a);})[_0x50c2('0x2e')](function(){if(_0x384622){return new Promise(function(_0x4c2969){zipdir(path['join'](_0x1c9a60,_0x52a766),{'saveTo':path[_0x50c2('0x39')](_0x1c9a60,util['format'](_0x50c2('0x41'),_0x52a766,_0x50c2('0x42')))},function(){rimraf(path['join'](_0x1c9a60,_0x52a766),function(){});_0x4c2969(_0x50c2('0x43'));});});}})[_0x50c2('0x2e')](function(){if(!_0x384622)return;rimraf(path['join'](_0x1c9a60,_0x52a766),function(){});})[_0x50c2('0x2e')](function(){logger[_0x50c2('0x44')](util[_0x50c2('0x1d')](_0x50c2('0x45'),EXTRACTED_REPORT_ID,'PDF'));return analyticExtractedReport(_0x50c2('0x46'),_0x384622?util[_0x50c2('0x1d')](_0x50c2('0x41'),_0x52a766,_0x384622?'zip':_0x50c2('0x3f')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger['info'](util[_0x50c2('0x1d')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x50c2('0x47')));return db[_0x50c2('0x10')][_0x50c2('0x48')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x50c2('0x2e')](function(_0x259431){EXTRACTED_REPORT=_0x259431;return dbH[_0x50c2('0x30')]['query'](util[_0x50c2('0x1d')](_0x50c2('0x49'),QUERY),{'type':dbH['sequelize']['QueryTypes'][_0x50c2('0x34')]});})[_0x50c2('0x2e')](extractReport)[_0x50c2('0x4a')](function(_0x3a9399){logger[_0x50c2('0x44')](util[_0x50c2('0x1d')](_0x50c2('0x4b'),EXTRACTED_REPORT_ID,_0x50c2('0x47')),util[_0x50c2('0x4c')](_0x3a9399,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x50c2('0x4d'));})[_0x50c2('0x4e')](function(){process['exit'](EXIT_CODE);});}main();function getPDFPrinter(){var _0x25da53=new PdfPrinter({'Arial':{'normal':__dirname+'/fonts/arial-regular.ttf','bold':__dirname+_0x50c2('0x4f'),'italics':__dirname+_0x50c2('0x50'),'bolditalics':__dirname+_0x50c2('0x51')}});return _0x25da53;}function getPDFDocDefinitionFromHTML(_0x12ca90,_0xc10f9e){var _0x1d8b67=util[_0x50c2('0x1d')]('%s\x20#%d',_0xc10f9e[_0x50c2('0x52')],_0xc10f9e[_0x50c2('0x53')]);var _0x1f0277=moment()[_0x50c2('0x1d')](_0x50c2('0x54'))[_0x50c2('0x13')]();var _0x5e1b59=htmlToPdfmake(_0x12ca90,{'window':window,'tableAutoSize':!![]});return{'content':[_0x5e1b59],'defaultStyle':{'font':_0x50c2('0x27')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x50c2('0x55'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x50c2('0x55'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':'center'}},'header':function(){return[{'text':_0x50c2('0x56'),'style':'header'}];},'footer':function(_0x3d3512,_0x2054a0){return[{'text':util['format'](_0x50c2('0x57'),_0x1d8b67,_0x3d3512,_0x2054a0,_0x1f0277),'style':_0x50c2('0x26')}];}};}function writePDFDocument(_0x28be84,_0x1c3823){return new Promise(function(_0x3d1c10,_0x4e30c7){var _0x33f72d=_0x28be84[_0x50c2('0x58')](fs[_0x50c2('0x59')](_0x1c3823));_0x33f72d['on']('finish',function(){_0x3d1c10(_0x50c2('0x5a'));});_0x33f72d['on'](_0x50c2('0x5b'),function(_0x2a8c12){_0x4e30c7(_0x2a8c12);});_0x28be84[_0x50c2('0x5c')]();});}exports[_0x50c2('0x5d')]=function(_0x25febb,_0x3e6d2e){var _0x1821ea=getPDFPrinter();var _0x5c35f6=getPDFDocDefinitionFromHTML(_0x25febb,_0x3e6d2e);var _0x588fa6=_0x1821ea[_0x50c2('0x3d')](_0x5c35f6);return writePDFDocument(_0x588fa6,_0x3e6d2e[_0x50c2('0x5e')])[_0x50c2('0x4a')](function(_0x44c0a9){throw _0x44c0a9;});}; \ No newline at end of file +var _0x36bb=['zip-dir','rimraf','jsdom','bluebird','../../mysqldb','dbH','argv','savename','update','map','tableHeader','pick','fill','length','auto','body','push','concat','chunk','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','startDate','endDate','header','pageBreak','before','margin','landscape','\x20/\x20','footer','Arial','black','right','num','Empty','Setting','find','split','splitSizePdf','then','isInteger','forEach','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','.pdf','join','mkdirSync','each','flatten','%s%d.%s','pdf','%s.%s','all','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','zip','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','AnalyticExtractedReport','SELECT','catch','PDF','inspect','Failed','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','interactionId','YYYY-MM-DD','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','createWriteStream','finish','error','createPdfFromHTML','lodash','util','path','moment','html-to-pdfmake','pdfmake/src/printer'];(function(_0x5665f0,_0x5708f1){var _0x13d0d2=function(_0x231d3f){while(--_0x231d3f){_0x5665f0['push'](_0x5665f0['shift']());}};_0x13d0d2(++_0x5708f1);}(_0x36bb,0x102));var _0xb36b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x36bb[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb36b('0x0'));var fs=require('fs');var util=require(_0xb36b('0x1'));var path=require(_0xb36b('0x2'));var moment=require(_0xb36b('0x3'));var htmlToPdfmake=require(_0xb36b('0x4'));var PdfPrinter=require(_0xb36b('0x5'));var zipdir=require(_0xb36b('0x6'));var rimraf=require(_0xb36b('0x7'));var JSDOM=require(_0xb36b('0x8'))['JSDOM'];var window=new JSDOM('')['window'];var BPromise=require(_0xb36b('0x9'));var db=require(_0xb36b('0xa'))['db'];var dbH=require('../../mysqldb')[_0xb36b('0xb')];var logger=require('../../config/logger')('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xb36b('0xc')][0x2]);var QUERY=process[_0xb36b('0xc')][0x3];var PATH=process[_0xb36b('0xc')][0x4];var NAME=process[_0xb36b('0xc')][0x5];var FORMAT='MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a';var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x50072e,_0x341904){var _0x53dda1={'status':_0x50072e};var _0x26fc2f={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x341904){_0x53dda1[_0xb36b('0xd')]=_0x341904;}return db['AnalyticExtractedReport'][_0xb36b('0xe')](_0x53dda1,_0x26fc2f);}function getHeaders(_0x51e344){return _[_0xb36b('0xf')](_0x51e344,function(_0x4d1177){return{'text':_0x4d1177,'style':_0xb36b('0x10')};});}function getRows(_0x3e06e4,_0x3027c6){return _[_0xb36b('0xf')](_0x3027c6,function(_0x39bcb2){return _(_0x39bcb2)[_0xb36b('0x11')](_0x3e06e4)[_0xb36b('0xf')](function(_0x2ff22c){return _0x2ff22c?_['toString'](_0x2ff22c):'';})['value']();});}function createTable(_0x55b97c,_0x55fdbd){var _0x36d302={'widths':_[_0xb36b('0x12')](Array(_0x55b97c[_0xb36b('0x13')]),0x91),'heights':function(_0x11b72e){return _0x11b72e===0x0?_0xb36b('0x14'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x34b471=getHeaders(_0x55b97c);_0x36d302[_0xb36b('0x15')][_0xb36b('0x16')](_0x34b471);var _0x3ca5c2=getRows(_0x55b97c,_0x55fdbd);_0x36d302[_0xb36b('0x15')]=_0x36d302[_0xb36b('0x15')][_0xb36b('0x17')](_0x3ca5c2);return _0x36d302;}function createTables(_0x5d0b8d){var _0x3b758a=[];var _0x5e025b=_[_0xb36b('0x18')](Object['keys'](_0x5d0b8d[0x0]),0x5);_0x5e025b['forEach'](function(_0x35cf7b){_0x3b758a['push'](createTable(_0x35cf7b,_0x5d0b8d));});return _0x3b758a;}function getPDFDocDefinition(_0x11fd73){var _0x47bf64=util[_0xb36b('0x19')](_0xb36b('0x1a'),NAME,EXTRACTED_REPORT['name'],moment(EXTRACTED_REPORT[_0xb36b('0x1b')])[_0xb36b('0x19')](FORMAT),moment(EXTRACTED_REPORT[_0xb36b('0x1c')])['format'](FORMAT));var _0x38e3be=[];for(var _0x3cf1af=0x0;_0x3cf1af<_0x11fd73[_0xb36b('0x13')];_0x3cf1af++){var _0x25b06d=[];if(_0x3cf1af===0x0){_0x25b06d[_0xb36b('0x16')]({'text':_0x47bf64,'style':_0xb36b('0x1d')});}var _0x3283fc={'table':_0x11fd73[_0x3cf1af]};if(_0x3cf1af>0x0){_0x3283fc[_0xb36b('0x1e')]=_0xb36b('0x1f');_0x3283fc[_0xb36b('0x20')]=[0x0,0x46,0x0,0x0];}_0x25b06d['push'](_0x3283fc);_0x38e3be[_0xb36b('0x16')](_0x25b06d);}return{'pageSize':'A4','pageOrientation':_0xb36b('0x21'),'content':_0x38e3be,'footer':function(_0x5f52f9,_0x3d9482){return{'text':_0x5f52f9['toString']()+_0xb36b('0x22')+_0x3d9482,'style':_0xb36b('0x23')};},'defaultStyle':{'font':_0xb36b('0x24')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xb36b('0x25')},'footer':{'alignment':_0xb36b('0x26'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x574eb3){var _0x20b374=0x1388;var _0x4a5fed;if(!_0x574eb3[0x0][_0xb36b('0x27')]){return analyticExtractedReport(_0xb36b('0x28'));}return db[_0xb36b('0x29')][_0xb36b('0x2a')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xb36b('0x2b'),_0xb36b('0x2c')]})[_0xb36b('0x2d')](function(_0x203a73){if(_0x203a73){_0x4a5fed=_0x203a73;_0x20b374=_0x4a5fed[_0xb36b('0x2c')]||0x3e8;}})[_0xb36b('0x2d')](function(){var _0x10243f=[];var _0x383e58=0x0;if(_0x4a5fed[_0xb36b('0x2b')]){if(_0x574eb3&&_0x574eb3['length']){var _0x36156a=_['range'](_0x574eb3[0x0][_0xb36b('0x27')]/_0x20b374);var _0x5452cc=Number[_0xb36b('0x2e')](_0x574eb3[0x0]['num']/_0x20b374)?_0x574eb3[0x0][_0xb36b('0x27')]%_0x20b374:0x0;_0x36156a[_0xb36b('0x2f')](function(_0x482cf4){if(_0x482cf4>0x0){_0x383e58+=_0x20b374;}_0x10243f['push'](dbH[_0xb36b('0x30')][_0xb36b('0x31')](util['format'](_0xb36b('0x32'),QUERY,_0x20b374,_0x383e58),{'type':dbH[_0xb36b('0x30')][_0xb36b('0x33')]['SELECT']}));});if(_0x5452cc>0x0){_0x383e58+=_0x20b374;_0x10243f[_0xb36b('0x16')](dbH['sequelize'][_0xb36b('0x31')](util[_0xb36b('0x19')](_0xb36b('0x32'),QUERY,_0x5452cc,_0x383e58),{'type':dbH[_0xb36b('0x30')][_0xb36b('0x33')]['SELECT']}));}}}else{_0x10243f[_0xb36b('0x16')](dbH[_0xb36b('0x30')][_0xb36b('0x31')](QUERY,{'type':dbH['sequelize']['QueryTypes']['SELECT']}));}var _0x950cb6=path['dirname'](PATH);var _0x20c5e2=path['basename'](PATH,_0xb36b('0x34'));var _0x59076c=_0x4a5fed[_0xb36b('0x2b')]&&_0x10243f[_0xb36b('0x13')]>0x1;var _0x1539c9=[];if(!fs['existsSync'](path[_0xb36b('0x35')](_0x950cb6,_0x20c5e2))&&_0x59076c){fs[_0xb36b('0x36')](path[_0xb36b('0x35')](_0x950cb6,_0x20c5e2));}return BPromise[_0xb36b('0x37')](_0x10243f,function(_0x126a98){_0x1539c9[_0xb36b('0x16')](_0x126a98);})['then'](function(){var _0x2c8166=[];for(var _0x27803c=0x0;_0x27803c<_0x1539c9[_0xb36b('0x13')];_0x27803c+=0x1){var _0x348905=_0x1539c9[_0x27803c];var _0x3d3c0c=createTables(_[_0xb36b('0x38')](_0x348905));var _0x255378;var _0x1a9568=getPDFDocDefinition(_0x3d3c0c);var _0x892afc=getPDFPrinter();var _0x4bf372=_0x892afc['createPdfKitDocument'](_0x1a9568);if(_0x59076c){_0x255378=path['join'](_0x950cb6,_0x20c5e2,util[_0xb36b('0x19')](_0xb36b('0x39'),_0x20c5e2,_0x27803c,_0xb36b('0x3a')));}else{_0x255378=path[_0xb36b('0x35')](_0x950cb6,util[_0xb36b('0x19')](_0xb36b('0x3b'),_0x20c5e2,_0xb36b('0x3a')));}_0x2c8166['push'](writePDFDocument(_0x4bf372,_0x255378));}return Promise[_0xb36b('0x3c')](_0x2c8166);})[_0xb36b('0x2d')](function(){if(_0x59076c){return new Promise(function(_0x65d3b3){zipdir(path['join'](_0x950cb6,_0x20c5e2),{'saveTo':path[_0xb36b('0x35')](_0x950cb6,util[_0xb36b('0x19')](_0xb36b('0x3b'),_0x20c5e2,'zip'))},function(){rimraf(path['join'](_0x950cb6,_0x20c5e2),function(){});_0x65d3b3(_0xb36b('0x3d'));});});}})[_0xb36b('0x2d')](function(){if(!_0x59076c)return;rimraf(path['join'](_0x950cb6,_0x20c5e2),function(){});})['then'](function(){logger[_0xb36b('0x3e')](util[_0xb36b('0x19')](_0xb36b('0x3f'),EXTRACTED_REPORT_ID,'PDF'));return analyticExtractedReport(_0xb36b('0x40'),_0x59076c?util['format'](_0xb36b('0x3b'),_0x20c5e2,_0x59076c?_0xb36b('0x41'):_0xb36b('0x3a')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0xb36b('0x3e')](util['format'](_0xb36b('0x42'),EXTRACTED_REPORT_ID,'PDF'));return db[_0xb36b('0x43')]['findOne']({'where':{'id':EXTRACTED_REPORT_ID}})[_0xb36b('0x2d')](function(_0x156705){EXTRACTED_REPORT=_0x156705;return dbH[_0xb36b('0x30')][_0xb36b('0x31')](util[_0xb36b('0x19')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0xb36b('0x30')][_0xb36b('0x33')][_0xb36b('0x44')]});})[_0xb36b('0x2d')](extractReport)[_0xb36b('0x45')](function(_0x5a7faf){logger['info'](util[_0xb36b('0x19')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xb36b('0x46')),util[_0xb36b('0x47')](_0x5a7faf,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xb36b('0x48'));})[_0xb36b('0x49')](function(){process[_0xb36b('0x4a')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x55ec67=new PdfPrinter({'Arial':{'normal':__dirname+_0xb36b('0x4b'),'bold':__dirname+'/fonts/arial-bold.ttf','italics':__dirname+'/fonts/arial-italic.ttf','bolditalics':__dirname+_0xb36b('0x4c')}});return _0x55ec67;}function getPDFDocDefinitionFromHTML(_0x14885c,_0x2e4574){var _0x56d703=util['format'](_0xb36b('0x4d'),_0x2e4574['channel'],_0x2e4574[_0xb36b('0x4e')]);var _0x317c5a=moment()['format'](_0xb36b('0x4f'))['toString']();var _0x1b6bf5=htmlToPdfmake(_0x14885c,{'window':window,'tableAutoSize':!![]});return{'content':[_0x1b6bf5],'defaultStyle':{'font':_0xb36b('0x24')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0xb36b('0x50'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0xb36b('0x50'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0xb36b('0x50')}},'header':function(){return[{'text':_0xb36b('0x51'),'style':_0xb36b('0x1d')}];},'footer':function(_0xa99276,_0x3bd131){return[{'text':util[_0xb36b('0x19')](_0xb36b('0x52'),_0x56d703,_0xa99276,_0x3bd131,_0x317c5a),'style':'footer'}];}};}function writePDFDocument(_0x3f7de1,_0x12ad2b){return new Promise(function(_0xe7078a,_0x4e89fb){var _0x12439c=_0x3f7de1[_0xb36b('0x53')](fs[_0xb36b('0x54')](_0x12ad2b));_0x12439c['on']('finish',function(){_0xe7078a(_0xb36b('0x55'));});_0x12439c['on'](_0xb36b('0x56'),function(_0x5a0a78){_0x4e89fb(_0x5a0a78);});_0x3f7de1['end']();});}exports[_0xb36b('0x57')]=function(_0x388a1a,_0x31fea7){var _0x3b098e=getPDFPrinter();var _0x16edb7=getPDFDocDefinitionFromHTML(_0x388a1a,_0x31fea7);var _0x5db552=_0x3b098e['createPdfKitDocument'](_0x16edb7);return writePDFDocument(_0x5db552,_0x31fea7['path'])[_0xb36b('0x45')](function(_0x3d53f4){throw _0x3d53f4;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index b778594..822edab 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 _0x6acf=['dirname','basename','.xlsx','split','existsSync','join','%s%d.%s','xlsx','%s.%s','writeFileSync','binary','zip','zip\x20finished','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','finally','exit','util','path','lodash','json2xls','zip-dir','rimraf','../../mysqldb','argv','savename','update','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','splitSizeXlsx','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','length','range','isInteger','forEach','push','format','%s\x20limit\x20%d\x20OFFSET\x20%d'];(function(_0x2ea625,_0x55f9fa){var _0x5a8ab6=function(_0x94156){while(--_0x94156){_0x2ea625['push'](_0x2ea625['shift']());}};_0x5a8ab6(++_0x55f9fa);}(_0x6acf,0x1d5));var _0xf6ac=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6acf[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0xf6ac('0x0'));var path=require(_0xf6ac('0x1'));var _=require(_0xf6ac('0x2'));var fs=require('fs');var json2xls=require(_0xf6ac('0x3'));var BPromise=require('bluebird');var zipdir=require(_0xf6ac('0x4'));var rimraf=require(_0xf6ac('0x5'));var db=require('../../mysqldb')['db'];var dbH=require(_0xf6ac('0x6'))['dbH'];var logger=require('../../config/logger')('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xf6ac('0x7')][0x2]);var QUERY=process[_0xf6ac('0x7')][0x3];var PATH=process[_0xf6ac('0x7')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x4467f2,_0x59462f){var _0x2a4155={'status':_0x4467f2};var _0x554a70={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x59462f){_0x2a4155[_0xf6ac('0x8')]=_0x59462f;}return db['AnalyticExtractedReport'][_0xf6ac('0x9')](_0x2a4155,_0x554a70);}function main(){var _0x3ead3e=0x1388;var _0x54a353;logger[_0xf6ac('0xa')](util['format'](_0xf6ac('0xb'),EXTRACTED_REPORT_ID,_0xf6ac('0xc')));return db[_0xf6ac('0xd')][_0xf6ac('0xe')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0xf6ac('0xf')]})['then'](function(_0x411e1d){if(_0x411e1d){_0x54a353=_0x411e1d;_0x3ead3e=_0x54a353['splitSizeXlsx']||0x1388;}})[_0xf6ac('0x10')](function(){return dbH[_0xf6ac('0x11')][_0xf6ac('0x12')](util['format'](_0xf6ac('0x13'),QUERY),{'type':dbH[_0xf6ac('0x11')][_0xf6ac('0x14')][_0xf6ac('0x15')]});})[_0xf6ac('0x10')](function(_0x126783){if(!_0x126783[0x0][_0xf6ac('0x16')]){return analyticExtractedReport(_0xf6ac('0x17'));}var _0x8745ba=[];var _0x494ce8=0x0;if(_0x54a353['split']){if(_0x126783&&_0x126783[_0xf6ac('0x18')]){var _0x442760=_[_0xf6ac('0x19')](_0x126783[0x0][_0xf6ac('0x16')]/_0x3ead3e);var _0x5f1b22=Number[_0xf6ac('0x1a')](_0x126783[0x0]['num']/_0x3ead3e)?_0x126783[0x0][_0xf6ac('0x16')]%_0x3ead3e:0x0;_0x442760[_0xf6ac('0x1b')](function(_0x23dab8){if(_0x23dab8>0x0){_0x494ce8+=_0x3ead3e;}_0x8745ba[_0xf6ac('0x1c')](dbH[_0xf6ac('0x11')][_0xf6ac('0x12')](util[_0xf6ac('0x1d')](_0xf6ac('0x1e'),QUERY,_0x3ead3e,_0x494ce8),{'type':dbH['sequelize'][_0xf6ac('0x14')][_0xf6ac('0x15')]}));});if(_0x5f1b22>0x0){_0x494ce8+=_0x3ead3e;_0x8745ba[_0xf6ac('0x1c')](dbH[_0xf6ac('0x11')][_0xf6ac('0x12')](util[_0xf6ac('0x1d')](_0xf6ac('0x1e'),QUERY,_0x5f1b22,_0x494ce8),{'type':dbH['sequelize'][_0xf6ac('0x14')][_0xf6ac('0x15')]}));}}}else{_0x8745ba[_0xf6ac('0x1c')](dbH[_0xf6ac('0x11')][_0xf6ac('0x12')](QUERY,{'type':dbH[_0xf6ac('0x11')][_0xf6ac('0x14')][_0xf6ac('0x15')]}));}var _0x53857e=path[_0xf6ac('0x1f')](PATH);var _0x563738=path[_0xf6ac('0x20')](PATH,_0xf6ac('0x21'));var _0x3aab25=_0x54a353[_0xf6ac('0x22')]&&_0x8745ba[_0xf6ac('0x18')]>0x1;var _0x5dba48=[];if(!fs[_0xf6ac('0x23')](path[_0xf6ac('0x24')](_0x53857e,_0x563738))&&_0x3aab25){fs['mkdirSync'](path[_0xf6ac('0x24')](_0x53857e,_0x563738));}return BPromise['each'](_0x8745ba,function(_0x3197ad){_0x5dba48[_0xf6ac('0x1c')](_0x3197ad);})['then'](function(){for(var _0x2b7708=0x0;_0x2b7708<_0x5dba48[_0xf6ac('0x18')];_0x2b7708+=0x1){var _0x4c8d0e;var _0x53f922=_0x5dba48[_0x2b7708];if(_0x3aab25){_0x4c8d0e=path[_0xf6ac('0x24')](_0x53857e,_0x563738,util[_0xf6ac('0x1d')](_0xf6ac('0x25'),_0x563738,_0x2b7708,_0xf6ac('0x26')));}else{_0x4c8d0e=path[_0xf6ac('0x24')](_0x53857e,util[_0xf6ac('0x1d')](_0xf6ac('0x27'),_0x563738,_0xf6ac('0x26')));}fs[_0xf6ac('0x28')](_0x4c8d0e,json2xls(_0x53f922),_0xf6ac('0x29'));}})['then'](function(){if(_0x3aab25){return new Promise(function(_0x37b284){zipdir(path['join'](_0x53857e,_0x563738),{'saveTo':path[_0xf6ac('0x24')](_0x53857e,util['format'](_0xf6ac('0x27'),_0x563738,_0xf6ac('0x2a')))},function(_0x1b5c09,_0x5311b2){rimraf(path[_0xf6ac('0x24')](_0x53857e,_0x563738),function(){});_0x37b284(_0xf6ac('0x2b'));});});}})[_0xf6ac('0x10')](function(){logger[_0xf6ac('0xa')](util[_0xf6ac('0x1d')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0xf6ac('0xc')));return analyticExtractedReport(_0xf6ac('0x2c'),_0x3aab25?util[_0xf6ac('0x1d')](_0xf6ac('0x27'),_0x563738,_0x3aab25?'zip':_0xf6ac('0x26')):null);});})[_0xf6ac('0x2d')](function(_0x58614){logger['info'](util['format'](_0xf6ac('0x2e'),EXTRACTED_REPORT_ID,'XLSX'),util['inspect'](_0x58614,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xf6ac('0x2f'));})[_0xf6ac('0x30')](function(){process[_0xf6ac('0x31')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x4034=['json2xls','zip-dir','../../mysqldb','../../config/logger','argv','update','info','format','XLSX','Setting','find','splitSizeXlsx','then','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','SELECT','num','Empty','split','range','isInteger','QueryTypes','push','%s\x20limit\x20%d\x20OFFSET\x20%d','basename','.xlsx','length','each','%s%d.%s','xlsx','join','writeFileSync','binary','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','%s.%s','catch','inspect','Failed','finally','exit','path','lodash'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x4034,0x166));var _0x4403=function(_0x42d0ed,_0x91a115){_0x42d0ed=_0x42d0ed-0x0;var _0x3f63f6=_0x4034[_0x42d0ed];return _0x3f63f6;};'use strict';var util=require('util');var path=require(_0x4403('0x0'));var _=require(_0x4403('0x1'));var fs=require('fs');var json2xls=require(_0x4403('0x2'));var BPromise=require('bluebird');var zipdir=require(_0x4403('0x3'));var rimraf=require('rimraf');var db=require(_0x4403('0x4'))['db'];var dbH=require(_0x4403('0x4'))['dbH'];var logger=require(_0x4403('0x5'))('analytics');var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x4403('0x6')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x538c95,_0xfd91ca){var _0x517d90={'status':_0x538c95};var _0x4cdc07={'where':{'id':EXTRACTED_REPORT_ID}};if(_0xfd91ca){_0x517d90['savename']=_0xfd91ca;}return db['AnalyticExtractedReport'][_0x4403('0x7')](_0x517d90,_0x4cdc07);}function main(){var _0x2b91b5=0x1388;var _0x5f3756;logger[_0x4403('0x8')](util[_0x4403('0x9')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x4403('0xa')));return db[_0x4403('0xb')][_0x4403('0xc')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x4403('0xd')]})[_0x4403('0xe')](function(_0x461d33){if(_0x461d33){_0x5f3756=_0x461d33;_0x2b91b5=_0x5f3756[_0x4403('0xd')]||0x1388;}})[_0x4403('0xe')](function(){return dbH['sequelize'][_0x4403('0xf')](util['format'](_0x4403('0x10'),QUERY),{'type':dbH[_0x4403('0x11')]['QueryTypes'][_0x4403('0x12')]});})[_0x4403('0xe')](function(_0x26b124){if(!_0x26b124[0x0][_0x4403('0x13')]){return analyticExtractedReport(_0x4403('0x14'));}var _0xee64a6=[];var _0x1086fb=0x0;if(_0x5f3756[_0x4403('0x15')]){if(_0x26b124&&_0x26b124['length']){var _0x56ae70=_[_0x4403('0x16')](_0x26b124[0x0][_0x4403('0x13')]/_0x2b91b5);var _0x5ed2dc=Number[_0x4403('0x17')](_0x26b124[0x0][_0x4403('0x13')]/_0x2b91b5)?_0x26b124[0x0]['num']%_0x2b91b5:0x0;_0x56ae70['forEach'](function(_0x1eb151){if(_0x1eb151>0x0){_0x1086fb+=_0x2b91b5;}_0xee64a6['push'](dbH[_0x4403('0x11')][_0x4403('0xf')](util[_0x4403('0x9')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x2b91b5,_0x1086fb),{'type':dbH[_0x4403('0x11')][_0x4403('0x18')][_0x4403('0x12')]}));});if(_0x5ed2dc>0x0){_0x1086fb+=_0x2b91b5;_0xee64a6[_0x4403('0x19')](dbH['sequelize'][_0x4403('0xf')](util[_0x4403('0x9')](_0x4403('0x1a'),QUERY,_0x5ed2dc,_0x1086fb),{'type':dbH[_0x4403('0x11')][_0x4403('0x18')][_0x4403('0x12')]}));}}}else{_0xee64a6['push'](dbH[_0x4403('0x11')][_0x4403('0xf')](QUERY,{'type':dbH[_0x4403('0x11')][_0x4403('0x18')][_0x4403('0x12')]}));}var _0x3e037d=path['dirname'](PATH);var _0x5e4e60=path[_0x4403('0x1b')](PATH,_0x4403('0x1c'));var _0x2c263c=_0x5f3756['split']&&_0xee64a6[_0x4403('0x1d')]>0x1;var _0x59f0ea=[];if(!fs['existsSync'](path['join'](_0x3e037d,_0x5e4e60))&&_0x2c263c){fs['mkdirSync'](path['join'](_0x3e037d,_0x5e4e60));}return BPromise[_0x4403('0x1e')](_0xee64a6,function(_0x5998c6){_0x59f0ea['push'](_0x5998c6);})['then'](function(){for(var _0x24b8a5=0x0;_0x24b8a5<_0x59f0ea[_0x4403('0x1d')];_0x24b8a5+=0x1){var _0x36307d;var _0x2a13e7=_0x59f0ea[_0x24b8a5];if(_0x2c263c){_0x36307d=path['join'](_0x3e037d,_0x5e4e60,util[_0x4403('0x9')](_0x4403('0x1f'),_0x5e4e60,_0x24b8a5,_0x4403('0x20')));}else{_0x36307d=path[_0x4403('0x21')](_0x3e037d,util[_0x4403('0x9')]('%s.%s',_0x5e4e60,'xlsx'));}fs[_0x4403('0x22')](_0x36307d,json2xls(_0x2a13e7),_0x4403('0x23'));}})[_0x4403('0xe')](function(){if(_0x2c263c){return new Promise(function(_0x117422){zipdir(path[_0x4403('0x21')](_0x3e037d,_0x5e4e60),{'saveTo':path['join'](_0x3e037d,util['format']('%s.%s',_0x5e4e60,_0x4403('0x24')))},function(_0x179514,_0x452f2d){rimraf(path[_0x4403('0x21')](_0x3e037d,_0x5e4e60),function(){});_0x117422('zip\x20finished');});});}})[_0x4403('0xe')](function(){logger['info'](util[_0x4403('0x9')](_0x4403('0x25'),EXTRACTED_REPORT_ID,_0x4403('0xa')));return analyticExtractedReport(_0x4403('0x26'),_0x2c263c?util[_0x4403('0x9')](_0x4403('0x27'),_0x5e4e60,_0x2c263c?'zip':_0x4403('0x20')):null);});})[_0x4403('0x28')](function(_0xfd6dc2){logger[_0x4403('0x8')](util[_0x4403('0x9')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x4403('0xa')),util[_0x4403('0x29')](_0xfd6dc2,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x4403('0x2a'));})[_0x4403('0x2b')](function(){process[_0x4403('0x2c')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index dff4b71..ed8faaa 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 _0x5807=['_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','createdAt','updatedAt','interval','*,*,*,*','map','tag','callerID','length','indexOf','app','toLowerCase','appType','custom','answer','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','destroy','bulkCreate','sortBy','catch','rewrite','lodash','models','Interval','findAll','then','intervals','IntervalId','VoiceExtension','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback','hasOwnProperty','priority','extensions','extension','type','format','CDR(type)=%s','context','push','CDR(routeid)=','VoiceExtensionId','outbound','Set','cutdigits','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=noprefix','recordingFormat','none'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x5807,0x1c1));var _0x7580=function(_0x346737,_0x3e6081){_0x346737=_0x346737-0x0;var _0x1ade2e=_0x5807[_0x346737];return _0x1ade2e;};'use strict';var _=require(_0x7580('0x0'));var util=require('util');function rewrite(_0x58b89c,_0x145287){var _0x3a2936=this;return _0x58b89c[_0x7580('0x1')][_0x7580('0x2')][_0x7580('0x3')]({'raw':!![]})[_0x7580('0x4')](function(_0x4503af){_0x3a2936[_0x7580('0x5')]=_0x4503af;return _0x58b89c[_0x7580('0x1')]['VoiceExtension']['findAll']({'where':{'IntervalId':_0x145287[_0x7580('0x6')]},'raw':!![]});})['then'](function(_0x50f767){return _0x58b89c[_0x7580('0x1')][_0x7580('0x7')][_0x7580('0x3')]({'where':{'exten':{'$in':_['uniq'](_['map'](_0x50f767,_0x7580('0x8')))}},'order':[{'raw':_0x7580('0x9')}],'raw':!![]});})[_0x7580('0x4')](function(_0x18e85b){var _0x2f8e7d=_[_0x7580('0xa')](_0x18e85b,{'priority':'1'});var _0xbbea1a=_[_0x7580('0xa')](_0x18e85b,{'isApp':0x1});var _0x10413f=_[_0x7580('0xb')](_0xbbea1a,_0x7580('0x8'));var _0x12e3ca=[_0x7580('0xc'),_0x7580('0xd')];var _0x1a2afb=[];var _0x4093a3=[];for(var _0x1f3d4d in _0x10413f){if(_0x10413f[_0x7580('0xe')](_0x1f3d4d)){_0x3a2936[_0x7580('0xf')]=0x2;_0x3a2936[_0x7580('0x10')]=[];_0x3a2936[_0x7580('0x11')]=_['find'](_0x2f8e7d,{'exten':_0x10413f[_0x1f3d4d][0x0]['exten']});_0x3a2936[_0x7580('0x10')]['push']({'type':_0x10413f[_0x1f3d4d][0x0][_0x7580('0x12')],'app':'Set','appdata':util[_0x7580('0x13')](_0x7580('0x14'),_0x10413f[_0x1f3d4d][0x0][_0x7580('0x12')]),'context':_0x10413f[_0x1f3d4d][0x0][_0x7580('0x15')],'exten':_0x10413f[_0x1f3d4d][0x0][_0x7580('0x8')],'priority':_0x3a2936[_0x7580('0xf')]++,'VoiceExtensionId':_0x10413f[_0x1f3d4d][0x0]['VoiceExtensionId']});if(_0x10413f[_0x1f3d4d][0x0][_0x7580('0x12')]==='inbound'){_0x3a2936[_0x7580('0x10')][_0x7580('0x16')]({'type':_0x10413f[_0x1f3d4d][0x0][_0x7580('0x12')],'app':'Set','appdata':_0x7580('0x17')+_0x10413f[_0x1f3d4d][0x0][_0x7580('0x18')],'context':_0x10413f[_0x1f3d4d][0x0][_0x7580('0x15')],'exten':_0x10413f[_0x1f3d4d][0x0]['exten'],'priority':_0x3a2936['priority']++,'VoiceExtensionId':_0x10413f[_0x1f3d4d][0x0][_0x7580('0x18')]});}else if(_0x10413f[_0x1f3d4d][0x0][_0x7580('0x12')]===_0x7580('0x19')){if(_0x3a2936['extension']){_0x3a2936[_0x7580('0x10')]['push']({'type':_0x10413f[_0x1f3d4d][0x0][_0x7580('0x12')],'app':_0x7580('0x1a'),'appdata':'CDR(destination)='+(_0x3a2936[_0x7580('0x11')][_0x7580('0x1b')]?'${EXTEN:'+_0x3a2936[_0x7580('0x11')][_0x7580('0x1b')]+'}':'${EXTEN}'),'context':_0x10413f[_0x1f3d4d][0x0]['context'],'exten':_0x10413f[_0x1f3d4d][0x0]['exten'],'priority':_0x3a2936[_0x7580('0xf')]++,'VoiceExtensionId':_0x10413f[_0x1f3d4d][0x0][_0x7580('0x18')]});}_0x3a2936[_0x7580('0x10')]['push']({'type':_0x10413f[_0x1f3d4d][0x0]['type'],'app':_0x7580('0x1a'),'appdata':_0x7580('0x17')+_0x10413f[_0x1f3d4d][0x0]['VoiceExtensionId'],'context':_0x10413f[_0x1f3d4d][0x0]['context'],'exten':_0x10413f[_0x1f3d4d][0x0][_0x7580('0x8')],'priority':_0x3a2936[_0x7580('0xf')]++,'VoiceExtensionId':_0x10413f[_0x1f3d4d][0x0][_0x7580('0x18')]});var _0x3be2b6=_0x3a2936[_0x7580('0xf')]++;_0x3a2936[_0x7580('0x10')][_0x7580('0x16')]({'type':_0x10413f[_0x1f3d4d][0x0][_0x7580('0x12')],'app':_0x7580('0x1c'),'appdata':_0x7580('0x1d')+(_0x3be2b6+0x2)+_0x7580('0x1e')+(_0x3be2b6+0x1)+')','context':_0x10413f[_0x1f3d4d][0x0][_0x7580('0x15')],'exten':_0x10413f[_0x1f3d4d][0x0][_0x7580('0x8')],'priority':_0x3be2b6,'VoiceExtensionId':_0x10413f[_0x1f3d4d][0x0][_0x7580('0x18')]});if(_0x3a2936['extension']){_0x3a2936[_0x7580('0x10')]['push']({'type':_0x10413f[_0x1f3d4d][0x0][_0x7580('0x12')],'app':'Set','appdata':_0x3a2936[_0x7580('0x11')][_0x7580('0x1b')]?'CDR(prefix)=${EXTEN:0:'+_0x3a2936['extension'][_0x7580('0x1b')]+'}':_0x7580('0x1f'),'context':_0x10413f[_0x1f3d4d][0x0][_0x7580('0x15')],'exten':_0x10413f[_0x1f3d4d][0x0]['exten'],'priority':_0x3a2936[_0x7580('0xf')]++,'VoiceExtensionId':_0x10413f[_0x1f3d4d][0x0][_0x7580('0x18')]});}_0x3a2936[_0x7580('0x10')][_0x7580('0x16')]({'type':_0x10413f[_0x1f3d4d][0x0][_0x7580('0x12')],'app':_0x7580('0x1a'),'appdata':'outboundrouteid='+_0x10413f[_0x1f3d4d][0x0]['VoiceExtensionId'],'context':_0x10413f[_0x1f3d4d][0x0]['context'],'exten':_0x10413f[_0x1f3d4d][0x0][_0x7580('0x8')],'priority':_0x3a2936[_0x7580('0xf')]++,'VoiceExtensionId':_0x10413f[_0x1f3d4d][0x0][_0x7580('0x18')]});if(_0x3a2936[_0x7580('0x11')]&&_0x3a2936[_0x7580('0x11')]['hasOwnProperty'](_0x7580('0x20'))&&_0x3a2936['extension']['recordingFormat']!==_0x7580('0x21')){_0x3a2936[_0x7580('0x10')][_0x7580('0x16')]({'type':_0x10413f[_0x1f3d4d][0x0][_0x7580('0x12')],'app':'Set','appdata':_0x7580('0x22'),'context':_0x10413f[_0x1f3d4d][0x0][_0x7580('0x15')],'exten':_0x10413f[_0x1f3d4d][0x0][_0x7580('0x8')],'priority':_0x3a2936[_0x7580('0xf')]++,'VoiceExtensionId':_0x10413f[_0x1f3d4d][0x0][_0x7580('0x18')]});_0x3a2936[_0x7580('0x10')][_0x7580('0x16')]({'type':_0x10413f[_0x1f3d4d][0x0][_0x7580('0x12')],'app':'Set','appdata':_0x7580('0x23')+_0x3a2936[_0x7580('0x11')][_0x7580('0x20')]||_0x7580('0x24'),'context':_0x10413f[_0x1f3d4d][0x0][_0x7580('0x15')],'exten':_0x10413f[_0x1f3d4d][0x0]['exten'],'priority':_0x3a2936['priority']++,'VoiceExtensionId':_0x10413f[_0x1f3d4d][0x0][_0x7580('0x18')]});}}_0x3a2936[_0x7580('0x10')]['push']({'type':_0x10413f[_0x1f3d4d][0x0][_0x7580('0x12')],'app':_0x7580('0x1a'),'appdata':_0x7580('0x25'),'context':_0x10413f[_0x1f3d4d][0x0][_0x7580('0x15')],'exten':_0x10413f[_0x1f3d4d][0x0][_0x7580('0x8')],'priority':_0x3a2936[_0x7580('0xf')]++,'VoiceExtensionId':_0x10413f[_0x1f3d4d][0x0][_0x7580('0x18')]});_0x3a2936['extensions'][_0x7580('0x16')]({'type':_0x10413f[_0x1f3d4d][0x0][_0x7580('0x12')],'app':'Set','appdata':_0x7580('0x26'),'context':_0x10413f[_0x1f3d4d][0x0][_0x7580('0x15')],'exten':_0x10413f[_0x1f3d4d][0x0]['exten'],'priority':_0x3a2936[_0x7580('0xf')]++,'VoiceExtensionId':_0x10413f[_0x1f3d4d][0x0]['VoiceExtensionId']});_0x3a2936['extensions'][_0x7580('0x16')]({'type':_0x10413f[_0x1f3d4d][0x0][_0x7580('0x12')],'app':_0x7580('0x1a'),'appdata':'MONITOR_OPTIONS=ab','context':_0x10413f[_0x1f3d4d][0x0]['context'],'exten':_0x10413f[_0x1f3d4d][0x0][_0x7580('0x8')],'priority':_0x3a2936[_0x7580('0xf')]++,'VoiceExtensionId':_0x10413f[_0x1f3d4d][0x0][_0x7580('0x18')]});for(var _0x406e00=0x0,_0x5c64f6=0x0;_0x406e00<_0x10413f[_0x1f3d4d]['length'];_0x406e00+=0x1,_0x5c64f6=0x0){var _0x3f36e2=_0x10413f[_0x1f3d4d][_0x406e00];if(_0x3f36e2[_0x7580('0x12')]){_0x3f36e2[_0x7580('0x12')]=_0x3f36e2[_0x7580('0x12')]['toLowerCase']();}var _0x17e59f=[];var _0x4773ee=[];delete _0x3f36e2['id'];delete _0x3f36e2[_0x7580('0x27')];delete _0x3f36e2[_0x7580('0x28')];var _0x457b4e=_0x3f36e2[_0x7580('0x29')]!==_0x7580('0x2a')?[_0x3f36e2['interval']]:_0x3f36e2[_0x7580('0x6')]?_[_0x7580('0x2b')](_[_0x7580('0xa')](_0x3a2936['intervals'],{'IntervalId':_0x3f36e2[_0x7580('0x6')]}),_0x7580('0x29')):[];if(_0x3f36e2[_0x7580('0xe')](_0x7580('0x2c'))){if(_0x3f36e2['tag']&&_0x3f36e2['tag']!=='--'){_0x17e59f[_0x7580('0x16')]({'type':_0x3f36e2['type'],'app':_0x7580('0x1a'),'appdata':'CDR(tag)='+_0x3f36e2[_0x7580('0x2c')],'context':_0x3f36e2[_0x7580('0x15')],'exten':_0x3f36e2['exten'],'priority':_0x457b4e['length']+_0x3a2936[_0x7580('0xf')]+_0x5c64f6++,'VoiceExtensionId':_0x3f36e2['VoiceExtensionId']});}}if(_0x3f36e2[_0x7580('0x12')]===_0x7580('0x19')&&_0x3f36e2['hasOwnProperty'](_0x7580('0x2d'))){if(_0x3f36e2['callerID']){_0x17e59f[_0x7580('0x16')]({'type':_0x3f36e2['type'],'app':_0x7580('0x1c'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x3f36e2[_0x7580('0x2d')]+')','context':_0x3f36e2[_0x7580('0x15')],'exten':_0x3f36e2['exten'],'priority':_0x457b4e[_0x7580('0x2e')]+_0x3a2936['priority']+_0x5c64f6++,'VoiceExtensionId':_0x3f36e2[_0x7580('0x18')]});}else{_0x17e59f[_0x7580('0x16')]({'type':_0x3f36e2[_0x7580('0x12')],'app':_0x7580('0x1c'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0x3f36e2['context'],'exten':_0x3f36e2[_0x7580('0x8')],'priority':_0x457b4e[_0x7580('0x2e')]+_0x3a2936[_0x7580('0xf')]+_0x5c64f6++,'VoiceExtensionId':_0x3f36e2[_0x7580('0x18')]});}}if(_0x3f36e2[_0x7580('0xe')]('answer')){if(_0x12e3ca[_0x7580('0x2f')](_0x3f36e2[_0x7580('0x30')][_0x7580('0x31')]())>=0x0&&_0x3f36e2[_0x7580('0x32')]!==_0x7580('0x33')){if(_0x3f36e2[_0x7580('0x34')]){_0x17e59f[_0x7580('0x16')]({'type':_0x3f36e2[_0x7580('0x12')],'app':_0x7580('0x1c'),'appdata':_0x7580('0x35'),'context':_0x3f36e2[_0x7580('0x15')],'exten':_0x3f36e2[_0x7580('0x8')],'priority':_0x457b4e[_0x7580('0x2e')]+_0x3a2936['priority']+_0x5c64f6++,'VoiceExtensionId':_0x3f36e2[_0x7580('0x18')]});_0x17e59f[_0x7580('0x16')]({'type':_0x3f36e2['type'],'app':_0x7580('0x1a'),'appdata':_0x7580('0x36'),'context':_0x3f36e2[_0x7580('0x15')],'exten':_0x3f36e2[_0x7580('0x8')],'priority':_0x457b4e[_0x7580('0x2e')]+_0x3a2936[_0x7580('0xf')]+_0x5c64f6++,'VoiceExtensionId':_0x3f36e2[_0x7580('0x18')]});}else{_0x17e59f[_0x7580('0x16')]({'type':_0x3f36e2[_0x7580('0x12')],'app':_0x7580('0x1c'),'appdata':_0x7580('0x37'),'context':_0x3f36e2[_0x7580('0x15')],'exten':_0x3f36e2[_0x7580('0x8')],'priority':_0x457b4e[_0x7580('0x2e')]+_0x3a2936[_0x7580('0xf')]+_0x5c64f6++,'VoiceExtensionId':_0x3f36e2[_0x7580('0x18')]});_0x17e59f[_0x7580('0x16')]({'type':_0x3f36e2['type'],'app':'Set','appdata':_0x7580('0x38'),'context':_0x3f36e2[_0x7580('0x15')],'exten':_0x3f36e2['exten'],'priority':_0x457b4e[_0x7580('0x2e')]+_0x3a2936['priority']+_0x5c64f6++,'VoiceExtensionId':_0x3f36e2[_0x7580('0x18')]});}}}for(var _0x1e00c3=0x0;_0x1e00c3<_0x457b4e[_0x7580('0x2e')];_0x1e00c3+=0x1){var _0x363323=_0x3a2936['priority']+_0x457b4e[_0x7580('0x2e')];var _0x492429=_0x1e00c3===_0x457b4e[_0x7580('0x2e')]-0x1?_0x3a2936['priority']+_0x17e59f[_0x7580('0x2e')]+_0x4773ee[_0x7580('0x2e')]+0x2:_0x3a2936[_0x7580('0xf')]+_0x1e00c3+0x1;_0x17e59f[_0x7580('0x39')](_0x1e00c3,0x0,{'type':_0x3f36e2[_0x7580('0x12')],'app':_0x7580('0x3a'),'appdata':_0x457b4e[_0x1e00c3]+'?'+_0x3f36e2['context']+_0x7580('0x3b')+_0x363323+':'+_0x3f36e2[_0x7580('0x15')]+_0x7580('0x3b')+_0x492429,'exten':_0x3f36e2[_0x7580('0x8')],'context':_0x3f36e2[_0x7580('0x15')],'priority':_0x3a2936[_0x7580('0xf')]+_0x1e00c3,'VoiceExtensionId':_0x10413f[_0x1f3d4d][0x0][_0x7580('0x18')]});}_0x3f36e2[_0x7580('0xf')]=_0x17e59f[_0x7580('0x2e')]?_[_0x7580('0x3c')](_0x17e59f)[_0x7580('0xf')]+0x1:_0x3a2936['priority'];_0x3a2936[_0x7580('0xf')]=(_0x4773ee[_0x7580('0x2e')]?_[_0x7580('0x3c')](_0x4773ee)[_0x7580('0xf')]:_0x3f36e2[_0x7580('0xf')])+0x1;_0x3a2936[_0x7580('0x10')]=_[_0x7580('0x3d')](_0x3a2936[_0x7580('0x10')],_0x17e59f,[_0x3f36e2],_0x4773ee);}_0x3a2936['extensions'][_0x7580('0x16')]({'type':_0x10413f[_0x1f3d4d][0x0]['type'],'app':_0x7580('0x3e'),'exten':_0x10413f[_0x1f3d4d][0x0][_0x7580('0x8')],'context':_0x10413f[_0x1f3d4d][0x0][_0x7580('0x15')],'priority':_0x3a2936['priority'],'VoiceExtensionId':_0x10413f[_0x1f3d4d][0x0][_0x7580('0x18')]});_0x1a2afb['push'](_0x10413f[_0x1f3d4d][0x0]['VoiceExtensionId']);_0x4093a3=_[_0x7580('0x3d')](_0x4093a3,_0x3a2936[_0x7580('0x10')]);}}return _0x58b89c[_0x7580('0x3f')](function(_0x49a965){return _0x58b89c[_0x7580('0x1')][_0x7580('0x7')][_0x7580('0x40')]({'where':{'VoiceExtensionId':{'$in':_0x1a2afb}},'transaction':_0x49a965})[_0x7580('0x4')](function(_0x5bda47){return _0x58b89c[_0x7580('0x1')]['VoiceExtension'][_0x7580('0x41')](_[_0x7580('0x42')](_0x4093a3,_0x7580('0xf')),{'transaction':_0x49a965});});});})[_0x7580('0x43')](function(_0x14c3fd){console['error'](_0x14c3fd);});}exports[_0x7580('0x44')]=rewrite; \ No newline at end of file +var _0x7b07=['VoiceExtensionId','CDR(routeid)=','outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','extension','CDR(prefix)=${EXTEN:0:','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','updatedAt','interval','*,*,*,*','IntervalId','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','answer','indexOf','app','appType','custom','XCALLY-MOTION-ANSWER=1','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','destroy','catch','error','rewrite','util','models','Interval','findAll','then','intervals','VoiceExtension','uniq','map','exten','filter','groupBy','queue','playback','hasOwnProperty','priority','extensions','find','push','type','Set','CDR(type)=%s','context'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7b07,0x71));var _0x77b0=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x7b07[_0x17d9e3];return _0x14192d;};'use strict';var _=require('lodash');var util=require(_0x77b0('0x0'));function rewrite(_0x391b4a,_0x1d5f83){var _0x4b8ab9=this;return _0x391b4a[_0x77b0('0x1')][_0x77b0('0x2')][_0x77b0('0x3')]({'raw':!![]})[_0x77b0('0x4')](function(_0x27aeb6){_0x4b8ab9[_0x77b0('0x5')]=_0x27aeb6;return _0x391b4a[_0x77b0('0x1')]['VoiceExtension'][_0x77b0('0x3')]({'where':{'IntervalId':_0x1d5f83['IntervalId']},'raw':!![]});})[_0x77b0('0x4')](function(_0x38c144){return _0x391b4a[_0x77b0('0x1')][_0x77b0('0x6')]['findAll']({'where':{'exten':{'$in':_[_0x77b0('0x7')](_[_0x77b0('0x8')](_0x38c144,_0x77b0('0x9')))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})[_0x77b0('0x4')](function(_0x10a9c9){var _0x4f4b9c=_[_0x77b0('0xa')](_0x10a9c9,{'priority':'1'});var _0x1221a4=_[_0x77b0('0xa')](_0x10a9c9,{'isApp':0x1});var _0x156e82=_[_0x77b0('0xb')](_0x1221a4,_0x77b0('0x9'));var _0x4ec11a=[_0x77b0('0xc'),_0x77b0('0xd')];var _0x4b4e36=[];var _0x4dce24=[];for(var _0x568b8e in _0x156e82){if(_0x156e82[_0x77b0('0xe')](_0x568b8e)){_0x4b8ab9[_0x77b0('0xf')]=0x2;_0x4b8ab9[_0x77b0('0x10')]=[];_0x4b8ab9['extension']=_[_0x77b0('0x11')](_0x4f4b9c,{'exten':_0x156e82[_0x568b8e][0x0][_0x77b0('0x9')]});_0x4b8ab9[_0x77b0('0x10')][_0x77b0('0x12')]({'type':_0x156e82[_0x568b8e][0x0][_0x77b0('0x13')],'app':_0x77b0('0x14'),'appdata':util['format'](_0x77b0('0x15'),_0x156e82[_0x568b8e][0x0]['type']),'context':_0x156e82[_0x568b8e][0x0][_0x77b0('0x16')],'exten':_0x156e82[_0x568b8e][0x0][_0x77b0('0x9')],'priority':_0x4b8ab9[_0x77b0('0xf')]++,'VoiceExtensionId':_0x156e82[_0x568b8e][0x0][_0x77b0('0x17')]});if(_0x156e82[_0x568b8e][0x0]['type']==='inbound'){_0x4b8ab9[_0x77b0('0x10')][_0x77b0('0x12')]({'type':_0x156e82[_0x568b8e][0x0][_0x77b0('0x13')],'app':'Set','appdata':_0x77b0('0x18')+_0x156e82[_0x568b8e][0x0][_0x77b0('0x17')],'context':_0x156e82[_0x568b8e][0x0][_0x77b0('0x16')],'exten':_0x156e82[_0x568b8e][0x0][_0x77b0('0x9')],'priority':_0x4b8ab9[_0x77b0('0xf')]++,'VoiceExtensionId':_0x156e82[_0x568b8e][0x0][_0x77b0('0x17')]});}else if(_0x156e82[_0x568b8e][0x0]['type']===_0x77b0('0x19')){if(_0x4b8ab9['extension']){_0x4b8ab9['extensions'][_0x77b0('0x12')]({'type':_0x156e82[_0x568b8e][0x0]['type'],'app':_0x77b0('0x14'),'appdata':_0x77b0('0x1a')+(_0x4b8ab9['extension'][_0x77b0('0x1b')]?_0x77b0('0x1c')+_0x4b8ab9['extension'][_0x77b0('0x1b')]+'}':_0x77b0('0x1d')),'context':_0x156e82[_0x568b8e][0x0]['context'],'exten':_0x156e82[_0x568b8e][0x0][_0x77b0('0x9')],'priority':_0x4b8ab9[_0x77b0('0xf')]++,'VoiceExtensionId':_0x156e82[_0x568b8e][0x0][_0x77b0('0x17')]});}_0x4b8ab9['extensions']['push']({'type':_0x156e82[_0x568b8e][0x0][_0x77b0('0x13')],'app':_0x77b0('0x14'),'appdata':'CDR(routeid)='+_0x156e82[_0x568b8e][0x0][_0x77b0('0x17')],'context':_0x156e82[_0x568b8e][0x0][_0x77b0('0x16')],'exten':_0x156e82[_0x568b8e][0x0][_0x77b0('0x9')],'priority':_0x4b8ab9[_0x77b0('0xf')]++,'VoiceExtensionId':_0x156e82[_0x568b8e][0x0][_0x77b0('0x17')]});var _0x15ae2e=_0x4b8ab9[_0x77b0('0xf')]++;_0x4b8ab9[_0x77b0('0x10')][_0x77b0('0x12')]({'type':_0x156e82[_0x568b8e][0x0]['type'],'app':_0x77b0('0x1e'),'appdata':_0x77b0('0x1f')+(_0x15ae2e+0x2)+_0x77b0('0x20')+(_0x15ae2e+0x1)+')','context':_0x156e82[_0x568b8e][0x0][_0x77b0('0x16')],'exten':_0x156e82[_0x568b8e][0x0][_0x77b0('0x9')],'priority':_0x15ae2e,'VoiceExtensionId':_0x156e82[_0x568b8e][0x0][_0x77b0('0x17')]});if(_0x4b8ab9[_0x77b0('0x21')]){_0x4b8ab9[_0x77b0('0x10')][_0x77b0('0x12')]({'type':_0x156e82[_0x568b8e][0x0]['type'],'app':_0x77b0('0x14'),'appdata':_0x4b8ab9['extension'][_0x77b0('0x1b')]?_0x77b0('0x22')+_0x4b8ab9[_0x77b0('0x21')]['cutdigits']+'}':'CDR(prefix)=noprefix','context':_0x156e82[_0x568b8e][0x0][_0x77b0('0x16')],'exten':_0x156e82[_0x568b8e][0x0][_0x77b0('0x9')],'priority':_0x4b8ab9[_0x77b0('0xf')]++,'VoiceExtensionId':_0x156e82[_0x568b8e][0x0][_0x77b0('0x17')]});}_0x4b8ab9[_0x77b0('0x10')]['push']({'type':_0x156e82[_0x568b8e][0x0][_0x77b0('0x13')],'app':'Set','appdata':'outboundrouteid='+_0x156e82[_0x568b8e][0x0][_0x77b0('0x17')],'context':_0x156e82[_0x568b8e][0x0][_0x77b0('0x16')],'exten':_0x156e82[_0x568b8e][0x0][_0x77b0('0x9')],'priority':_0x4b8ab9[_0x77b0('0xf')]++,'VoiceExtensionId':_0x156e82[_0x568b8e][0x0][_0x77b0('0x17')]});if(_0x4b8ab9[_0x77b0('0x21')]&&_0x4b8ab9[_0x77b0('0x21')][_0x77b0('0xe')](_0x77b0('0x23'))&&_0x4b8ab9[_0x77b0('0x21')]['recordingFormat']!=='none'){_0x4b8ab9[_0x77b0('0x10')][_0x77b0('0x12')]({'type':_0x156e82[_0x568b8e][0x0][_0x77b0('0x13')],'app':_0x77b0('0x14'),'appdata':_0x77b0('0x24'),'context':_0x156e82[_0x568b8e][0x0][_0x77b0('0x16')],'exten':_0x156e82[_0x568b8e][0x0]['exten'],'priority':_0x4b8ab9[_0x77b0('0xf')]++,'VoiceExtensionId':_0x156e82[_0x568b8e][0x0][_0x77b0('0x17')]});_0x4b8ab9[_0x77b0('0x10')][_0x77b0('0x12')]({'type':_0x156e82[_0x568b8e][0x0][_0x77b0('0x13')],'app':'Set','appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x4b8ab9[_0x77b0('0x21')][_0x77b0('0x23')]||'wav','context':_0x156e82[_0x568b8e][0x0][_0x77b0('0x16')],'exten':_0x156e82[_0x568b8e][0x0][_0x77b0('0x9')],'priority':_0x4b8ab9['priority']++,'VoiceExtensionId':_0x156e82[_0x568b8e][0x0][_0x77b0('0x17')]});}}_0x4b8ab9[_0x77b0('0x10')][_0x77b0('0x12')]({'type':_0x156e82[_0x568b8e][0x0][_0x77b0('0x13')],'app':_0x77b0('0x14'),'appdata':_0x77b0('0x25'),'context':_0x156e82[_0x568b8e][0x0][_0x77b0('0x16')],'exten':_0x156e82[_0x568b8e][0x0][_0x77b0('0x9')],'priority':_0x4b8ab9[_0x77b0('0xf')]++,'VoiceExtensionId':_0x156e82[_0x568b8e][0x0][_0x77b0('0x17')]});_0x4b8ab9[_0x77b0('0x10')][_0x77b0('0x12')]({'type':_0x156e82[_0x568b8e][0x0]['type'],'app':_0x77b0('0x14'),'appdata':_0x77b0('0x26'),'context':_0x156e82[_0x568b8e][0x0][_0x77b0('0x16')],'exten':_0x156e82[_0x568b8e][0x0][_0x77b0('0x9')],'priority':_0x4b8ab9[_0x77b0('0xf')]++,'VoiceExtensionId':_0x156e82[_0x568b8e][0x0][_0x77b0('0x17')]});_0x4b8ab9['extensions'][_0x77b0('0x12')]({'type':_0x156e82[_0x568b8e][0x0][_0x77b0('0x13')],'app':'Set','appdata':_0x77b0('0x27'),'context':_0x156e82[_0x568b8e][0x0][_0x77b0('0x16')],'exten':_0x156e82[_0x568b8e][0x0]['exten'],'priority':_0x4b8ab9['priority']++,'VoiceExtensionId':_0x156e82[_0x568b8e][0x0]['VoiceExtensionId']});for(var _0x3ba062=0x0,_0x742c1d=0x0;_0x3ba062<_0x156e82[_0x568b8e][_0x77b0('0x28')];_0x3ba062+=0x1,_0x742c1d=0x0){var _0x2586ae=_0x156e82[_0x568b8e][_0x3ba062];if(_0x2586ae[_0x77b0('0x13')]){_0x2586ae[_0x77b0('0x13')]=_0x2586ae[_0x77b0('0x13')][_0x77b0('0x29')]();}var _0x58ad1b=[];var _0x3db8e3=[];delete _0x2586ae['id'];delete _0x2586ae[_0x77b0('0x2a')];delete _0x2586ae[_0x77b0('0x2b')];var _0x1bd726=_0x2586ae[_0x77b0('0x2c')]!==_0x77b0('0x2d')?[_0x2586ae[_0x77b0('0x2c')]]:_0x2586ae['IntervalId']?_[_0x77b0('0x8')](_[_0x77b0('0xa')](_0x4b8ab9['intervals'],{'IntervalId':_0x2586ae[_0x77b0('0x2e')]}),_0x77b0('0x2c')):[];if(_0x2586ae[_0x77b0('0xe')](_0x77b0('0x2f'))){if(_0x2586ae['tag']&&_0x2586ae[_0x77b0('0x2f')]!=='--'){_0x58ad1b[_0x77b0('0x12')]({'type':_0x2586ae[_0x77b0('0x13')],'app':_0x77b0('0x14'),'appdata':_0x77b0('0x30')+_0x2586ae[_0x77b0('0x2f')],'context':_0x2586ae[_0x77b0('0x16')],'exten':_0x2586ae[_0x77b0('0x9')],'priority':_0x1bd726[_0x77b0('0x28')]+_0x4b8ab9[_0x77b0('0xf')]+_0x742c1d++,'VoiceExtensionId':_0x2586ae['VoiceExtensionId']});}}if(_0x2586ae['type']===_0x77b0('0x19')&&_0x2586ae[_0x77b0('0xe')](_0x77b0('0x31'))){if(_0x2586ae[_0x77b0('0x31')]){_0x58ad1b[_0x77b0('0x12')]({'type':_0x2586ae[_0x77b0('0x13')],'app':_0x77b0('0x1e'),'appdata':_0x77b0('0x32')+_0x2586ae[_0x77b0('0x31')]+')','context':_0x2586ae['context'],'exten':_0x2586ae[_0x77b0('0x9')],'priority':_0x1bd726[_0x77b0('0x28')]+_0x4b8ab9[_0x77b0('0xf')]+_0x742c1d++,'VoiceExtensionId':_0x2586ae[_0x77b0('0x17')]});}else{_0x58ad1b[_0x77b0('0x12')]({'type':_0x2586ae[_0x77b0('0x13')],'app':_0x77b0('0x1e'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0x2586ae[_0x77b0('0x16')],'exten':_0x2586ae['exten'],'priority':_0x1bd726[_0x77b0('0x28')]+_0x4b8ab9['priority']+_0x742c1d++,'VoiceExtensionId':_0x2586ae[_0x77b0('0x17')]});}}if(_0x2586ae[_0x77b0('0xe')](_0x77b0('0x33'))){if(_0x4ec11a[_0x77b0('0x34')](_0x2586ae[_0x77b0('0x35')][_0x77b0('0x29')]())>=0x0&&_0x2586ae[_0x77b0('0x36')]!==_0x77b0('0x37')){if(_0x2586ae[_0x77b0('0x33')]){_0x58ad1b['push']({'type':_0x2586ae[_0x77b0('0x13')],'app':_0x77b0('0x1e'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x2586ae[_0x77b0('0x16')],'exten':_0x2586ae['exten'],'priority':_0x1bd726[_0x77b0('0x28')]+_0x4b8ab9[_0x77b0('0xf')]+_0x742c1d++,'VoiceExtensionId':_0x2586ae[_0x77b0('0x17')]});_0x58ad1b[_0x77b0('0x12')]({'type':_0x2586ae[_0x77b0('0x13')],'app':'Set','appdata':_0x77b0('0x38'),'context':_0x2586ae[_0x77b0('0x16')],'exten':_0x2586ae[_0x77b0('0x9')],'priority':_0x1bd726['length']+_0x4b8ab9['priority']+_0x742c1d++,'VoiceExtensionId':_0x2586ae[_0x77b0('0x17')]});}else{_0x58ad1b[_0x77b0('0x12')]({'type':_0x2586ae[_0x77b0('0x13')],'app':_0x77b0('0x1e'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x2586ae[_0x77b0('0x16')],'exten':_0x2586ae[_0x77b0('0x9')],'priority':_0x1bd726['length']+_0x4b8ab9[_0x77b0('0xf')]+_0x742c1d++,'VoiceExtensionId':_0x2586ae[_0x77b0('0x17')]});_0x58ad1b[_0x77b0('0x12')]({'type':_0x2586ae[_0x77b0('0x13')],'app':_0x77b0('0x14'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x2586ae[_0x77b0('0x16')],'exten':_0x2586ae[_0x77b0('0x9')],'priority':_0x1bd726[_0x77b0('0x28')]+_0x4b8ab9[_0x77b0('0xf')]+_0x742c1d++,'VoiceExtensionId':_0x2586ae[_0x77b0('0x17')]});}}}for(var _0x3c488e=0x0;_0x3c488e<_0x1bd726[_0x77b0('0x28')];_0x3c488e+=0x1){var _0x1dd3ec=_0x4b8ab9[_0x77b0('0xf')]+_0x1bd726[_0x77b0('0x28')];var _0x47d510=_0x3c488e===_0x1bd726[_0x77b0('0x28')]-0x1?_0x4b8ab9[_0x77b0('0xf')]+_0x58ad1b[_0x77b0('0x28')]+_0x3db8e3[_0x77b0('0x28')]+0x2:_0x4b8ab9[_0x77b0('0xf')]+_0x3c488e+0x1;_0x58ad1b[_0x77b0('0x39')](_0x3c488e,0x0,{'type':_0x2586ae[_0x77b0('0x13')],'app':_0x77b0('0x3a'),'appdata':_0x1bd726[_0x3c488e]+'?'+_0x2586ae[_0x77b0('0x16')]+_0x77b0('0x3b')+_0x1dd3ec+':'+_0x2586ae[_0x77b0('0x16')]+_0x77b0('0x3b')+_0x47d510,'exten':_0x2586ae['exten'],'context':_0x2586ae[_0x77b0('0x16')],'priority':_0x4b8ab9['priority']+_0x3c488e,'VoiceExtensionId':_0x156e82[_0x568b8e][0x0][_0x77b0('0x17')]});}_0x2586ae[_0x77b0('0xf')]=_0x58ad1b[_0x77b0('0x28')]?_['last'](_0x58ad1b)['priority']+0x1:_0x4b8ab9[_0x77b0('0xf')];_0x4b8ab9['priority']=(_0x3db8e3['length']?_[_0x77b0('0x3c')](_0x3db8e3)[_0x77b0('0xf')]:_0x2586ae['priority'])+0x1;_0x4b8ab9[_0x77b0('0x10')]=_[_0x77b0('0x3d')](_0x4b8ab9[_0x77b0('0x10')],_0x58ad1b,[_0x2586ae],_0x3db8e3);}_0x4b8ab9[_0x77b0('0x10')][_0x77b0('0x12')]({'type':_0x156e82[_0x568b8e][0x0][_0x77b0('0x13')],'app':_0x77b0('0x3e'),'exten':_0x156e82[_0x568b8e][0x0][_0x77b0('0x9')],'context':_0x156e82[_0x568b8e][0x0]['context'],'priority':_0x4b8ab9[_0x77b0('0xf')],'VoiceExtensionId':_0x156e82[_0x568b8e][0x0][_0x77b0('0x17')]});_0x4b4e36[_0x77b0('0x12')](_0x156e82[_0x568b8e][0x0][_0x77b0('0x17')]);_0x4dce24=_[_0x77b0('0x3d')](_0x4dce24,_0x4b8ab9['extensions']);}}return _0x391b4a[_0x77b0('0x3f')](function(_0xb4c626){return _0x391b4a[_0x77b0('0x1')][_0x77b0('0x6')][_0x77b0('0x40')]({'where':{'VoiceExtensionId':{'$in':_0x4b4e36}},'transaction':_0xb4c626})[_0x77b0('0x4')](function(_0x519dba){return _0x391b4a[_0x77b0('0x1')][_0x77b0('0x6')]['bulkCreate'](_['sortBy'](_0x4dce24,_0x77b0('0xf')),{'transaction':_0xb4c626});});});})[_0x77b0('0x41')](function(_0x44ff7d){console[_0x77b0('0x42')](_0x44ff7d);});}exports[_0x77b0('0x43')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 7e10b7e..3c47343 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 _0xd089=['papaparse','ioredis','../../../config/environment','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','index','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','join','data','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email\x20format\x20is\x20not\x20valid!','find','duplicate','CmContact','create','keys','then','push','Error\x20while\x20creating\x20contact:\x20','stringify','checkHopper','insert','into','cm_hopper','fromQuery','ListId','createdAt','updatedAt','field','NOW()','ContactId','toString','where','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','select','from','\x20=\x20?','scheduledAt','cm_contacts','deletedAt\x20IS\x20NULL','id\x20IN\x20?','calleridnum','cm_hopper_final','phone\x20NOT\x20IN\x20(?)','str','cm_hopper_black','VoiceQueue','findAll','dialCheckDuplicateType','CmList','Lists','get','always','catch','onlyIfOpen','sequelize','query','VoiceQueueId','outbound','BlackLists','all','Campaign','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','message','Error\x20processing\x20rows\x20block:','emit','contact:csv_','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','CSV\x20import\x20process\x20stopped!','resolve','createReadStream','parse','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','squel'];(function(_0x4155a7,_0x13fa04){var _0xe2320c=function(_0x25dece){while(--_0x25dece){_0x4155a7['push'](_0x4155a7['shift']());}};_0xe2320c(++_0x13fa04);}(_0xd089,0x143));var _0x9d08=function(_0x2c663e,_0x4cf0d5){_0x2c663e=_0x2c663e-0x0;var _0x356515=_0xd089[_0x2c663e];return _0x356515;};'use strict';var BPromise=require(_0x9d08('0x0'));var util=require(_0x9d08('0x1'));var _=require(_0x9d08('0x2'));var fs=require('fs');var squel=require(_0x9d08('0x3'));var Papa=require(_0x9d08('0x4'));var Redis=require(_0x9d08('0x5'));var db=require('../../../mysqldb')['db'];var config=require(_0x9d08('0x6'));var logger=require(_0x9d08('0x7'))(_0x9d08('0x8'));config[_0x9d08('0x9')]=_[_0x9d08('0xa')](config[_0x9d08('0x9')],{'host':_0x9d08('0xb'),'port':0x18eb});var socket=require(_0x9d08('0xc'))(new Redis(config[_0x9d08('0x9')]));require(_0x9d08('0xd'))[_0x9d08('0xe')](socket);try{if(!process[_0x9d08('0xf')][0x2]||process[_0x9d08('0xf')][0x2]===_0x9d08('0x10')||process[_0x9d08('0xf')][0x2]===_0x9d08('0x11')){throw new Error(_0x9d08('0x12'));}var FILEPATH=process['argv'][0x2];if(!process[_0x9d08('0xf')][0x3]||process[_0x9d08('0xf')][0x3]===_0x9d08('0x10')||process[_0x9d08('0xf')][0x3]===_0x9d08('0x11')||!process[_0x9d08('0xf')][0x4]||process[_0x9d08('0xf')][0x4]===_0x9d08('0x10')||process[_0x9d08('0xf')][0x4]===_0x9d08('0x11')){throw new Error('Missing\x20binding\x20parameters!');}var FIELDS=_[_0x9d08('0x13')](process[_0x9d08('0xf')][0x3][_0x9d08('0x14')](','),process[_0x9d08('0xf')][0x4]['split'](','));if(!process['argv'][0x5]||process['argv'][0x5]===_0x9d08('0x10')||process[_0x9d08('0xf')][0x5]===_0x9d08('0x11')){throw new Error(_0x9d08('0x15'));}var LISTID=process[_0x9d08('0xf')][0x5];var COMPANYID=process[_0x9d08('0xf')][0x6]&&process['argv'][0x6]!==_0x9d08('0x10')&&process[_0x9d08('0xf')][0x6]!==_0x9d08('0x11')?process[_0x9d08('0xf')][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process[_0x9d08('0xf')][0x7]!=='undefined'&&process[_0x9d08('0xf')][0x7]!==_0x9d08('0x11')?process[_0x9d08('0xf')][0x7]:null;if(!process[_0x9d08('0xf')][0x8]||process[_0x9d08('0xf')][0x8]===_0x9d08('0x10')||process[_0x9d08('0xf')][0x8]===_0x9d08('0x11')){throw new Error(_0x9d08('0x16'));}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0xdc2bbb){logger[_0x9d08('0x17')](_0xdc2bbb);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(_0x962624,_0x24c6d0,_0x2f0808,_0xe4acc3){var _0x20f335={'message':_0x24c6d0};_0x20f335[_0x962624]=!![];if(_0x2f0808){_0x20f335['contact']=_0x2f0808;}if(_0xe4acc3){_0x20f335[_0x9d08('0x18')]=_0xe4acc3;}return _0x20f335;}function isEmail(_0x52f9dc){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))*$/[_0x9d08('0x19')](_0x52f9dc);}function checkRow(_0x3fc0d8,_0x21d51e,_0xe8cb47){return new BPromise(function(_0x2bc1d0,_0x2b24a5){if(_[_0x9d08('0x1a')](_0x3fc0d8)){return _0x2b24a5(handleCheckRowError(_0x9d08('0x17'),_0x9d08('0x1b'),null,_0xe8cb47));}if(_0x3fc0d8[_0x9d08('0x1c')]&&_0x3fc0d8[_0x9d08('0x1c')][_0x9d08('0x1d')]){var _0x29678b=_[_0x9d08('0x1e')](_0x3fc0d8[_0x9d08('0x1c')],'message')[_0x9d08('0x1f')](';');return _0x2b24a5(handleCheckRowError('error',_0x29678b,null,_0xe8cb47));}var _0x105ad6={};for(var _0x4b6156 in FIELDS){if(FIELDS['hasOwnProperty'](_0x4b6156)&&FIELDS[_0x4b6156]){_0x105ad6[_0x4b6156]=_0x3fc0d8[_0x9d08('0x20')][0x0][FIELDS[_0x4b6156]]||_0x3fc0d8[_0x9d08('0x20')][0x0]['\ufeff'+FIELDS[_0x4b6156]];}}if(!_0x105ad6['firstName']){return _0x2b24a5(handleCheckRowError(_0x9d08('0x17'),'firstName\x20not\x20specified!',null,_0xe8cb47));}if(!_0x105ad6[_0x9d08('0x21')]){return _0x2b24a5(handleCheckRowError(_0x9d08('0x17'),_0x9d08('0x22'),null,_0xe8cb47));}if(_0x105ad6[_0x9d08('0x23')]){var _0x4c16fa=moment(_0x105ad6[_0x9d08('0x23')],_0x9d08('0x24'));if(!_0x4c16fa[_0x9d08('0x25')]()){return _0x2b24a5(handleCheckRowError('error',_0x9d08('0x26'),null,_0xe8cb47));}}if(_0x105ad6['email']){if(!isEmail(_0x105ad6['email'])){return _0x2b24a5(handleCheckRowError(_0x9d08('0x17'),_0x9d08('0x27'),null,_0xe8cb47));}}_0x105ad6['ListId']=LISTID;_0x105ad6['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x9d08('0x1d')]&&_0x21d51e){var _0x45ae74={};for(var _0x4e554d=0x0,_0x12b95f=DUPLICATES[_0x9d08('0x1d')];_0x4e554d<_0x12b95f;_0x4e554d+=0x1){_0x45ae74[DUPLICATES[_0x4e554d]]=_0x105ad6[DUPLICATES[_0x4e554d]];}var _0x11fc4a=_[_0x9d08('0x28')](_0x21d51e,_0x45ae74);if(_0x11fc4a){return _0x2b24a5(handleCheckRowError(_0x9d08('0x29'),'Duplicate\x20Contact',_0x11fc4a,_0xe8cb47));}}return db[_0x9d08('0x2a')][_0x9d08('0x2b')](_0x105ad6,{'raw':!![],'hooks':![],'fields':_[_0x9d08('0x2c')](_0x105ad6)})[_0x9d08('0x2d')](function(_0x2c4d45){if(DUPLICATES&&DUPLICATES['length']&&_0x21d51e){_0x21d51e[_0x9d08('0x2e')](_['pick'](_0x105ad6,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x2c4d45['id'];return _0x2bc1d0();})['catch'](function(_0x3015f5){return _0x2b24a5(handleCheckRowError(_0x9d08('0x17'),_0x9d08('0x2f')+(_0x3015f5['message']||JSON[_0x9d08('0x30')](_0x3015f5)),null,_0xe8cb47));});});}function checkHopper(){function _0x1ad7eb(){return function(_0x19f1ec){logger['error']('cmContact',_0x9d08('0x31'),util['inspect'](_0x19f1ec,{'showHidden':![],'depth':null}));};}var _0x3844f4=function(_0x9c17f0,_0x23a71a){var _0x51ce51=squel[_0x9d08('0x32')]()[_0x9d08('0x33')](_0x9d08('0x34'))[_0x9d08('0x35')]([_0x9d08('0x21'),'scheduledAt','ContactId',_0x9d08('0x36'),_0x23a71a,_0x9d08('0x37'),_0x9d08('0x38')],squel['select']()[_0x9d08('0x39')]('phone',_0x9d08('0x21'))[_0x9d08('0x39')](_0x9d08('0x3a'),'scheduledAt')[_0x9d08('0x39')]('id',_0x9d08('0x3b'))[_0x9d08('0x39')](LISTID[_0x9d08('0x3c')](),_0x9d08('0x36'))['field'](_0x9c17f0['id'][_0x9d08('0x3c')](),_0x23a71a)['field']('NOW()',_0x9d08('0x37'))[_0x9d08('0x39')]('NOW()','updatedAt')['from']('cm_contacts')[_0x9d08('0x3d')]('deletedAt\x20IS\x20NULL')[_0x9d08('0x3d')](_0x9d08('0x3e'),LISTID['toString']())[_0x9d08('0x3d')](_0x9d08('0x3f'))[_0x9d08('0x3d')]('phone\x20NOT\x20IN\x20(?)',squel[_0x9d08('0x40')]()[_0x9d08('0x39')](_0x9d08('0x21'))[_0x9d08('0x41')](_0x9d08('0x34'))[_0x9d08('0x3d')](_0x23a71a+_0x9d08('0x42'),_0x9c17f0['id'][_0x9d08('0x3c')]())))['toString']();return _0x51ce51;};var _0x1bc00f=function(_0xd84c73,_0x56e7ba){var _0x4c43e6=squel[_0x9d08('0x32')]()[_0x9d08('0x33')](_0x9d08('0x34'))[_0x9d08('0x35')]([_0x9d08('0x21'),_0x9d08('0x43'),'ContactId',_0x9d08('0x36'),_0x56e7ba,_0x9d08('0x37'),_0x9d08('0x38')],squel[_0x9d08('0x40')]()[_0x9d08('0x39')](_0x9d08('0x21'),_0x9d08('0x21'))['field'](_0x9d08('0x3a'),'scheduledAt')['field']('id','ContactId')[_0x9d08('0x39')](LISTID[_0x9d08('0x3c')](),'ListId')['field'](_0xd84c73['id'][_0x9d08('0x3c')](),_0x56e7ba)['field']('NOW()','createdAt')[_0x9d08('0x39')](_0x9d08('0x3a'),_0x9d08('0x38'))[_0x9d08('0x41')](_0x9d08('0x44'))[_0x9d08('0x3d')](_0x9d08('0x45'))['where'](_0x9d08('0x3e'),LISTID['toString']())[_0x9d08('0x3d')](_0x9d08('0x46'),squel['str'](hopperContacts))[_0x9d08('0x3d')](_0x9d08('0x3f'))[_0x9d08('0x3d')]('phone\x20NOT\x20IN\x20(?)',squel[_0x9d08('0x40')]()[_0x9d08('0x39')](_0x9d08('0x47'))['from'](_0x9d08('0x48'))[_0x9d08('0x3d')](_0x56e7ba+'\x20=\x20?',_0xd84c73['id'][_0x9d08('0x3c')]()))[_0x9d08('0x3d')](_0x9d08('0x49'),squel['select']()[_0x9d08('0x39')](_0x9d08('0x21'))[_0x9d08('0x41')](_0x9d08('0x34'))[_0x9d08('0x3d')](_0x56e7ba+_0x9d08('0x42'),_0xd84c73['id']['toString']())))[_0x9d08('0x3c')]();return _0x4c43e6;};function _0x5a1637(_0x220382,_0x20c2e0){var _0x348095=squel[_0x9d08('0x32')]()[_0x9d08('0x33')](_0x9d08('0x34'))[_0x9d08('0x35')]([_0x9d08('0x21'),_0x9d08('0x43'),'ContactId','ListId',_0x20c2e0,_0x9d08('0x37'),_0x9d08('0x38')],squel[_0x9d08('0x40')]()[_0x9d08('0x39')](_0x9d08('0x21'),_0x9d08('0x21'))[_0x9d08('0x39')](_0x9d08('0x3a'),_0x9d08('0x43'))[_0x9d08('0x39')]('id',_0x9d08('0x3b'))[_0x9d08('0x39')](LISTID[_0x9d08('0x3c')](),_0x9d08('0x36'))['field'](_0x220382['id'][_0x9d08('0x3c')](),_0x20c2e0)[_0x9d08('0x39')](_0x9d08('0x3a'),_0x9d08('0x37'))[_0x9d08('0x39')]('NOW()',_0x9d08('0x38'))[_0x9d08('0x41')](_0x9d08('0x44'))[_0x9d08('0x3d')](_0x9d08('0x45'))[_0x9d08('0x3d')](_0x9d08('0x3e'),LISTID[_0x9d08('0x3c')]())[_0x9d08('0x3d')](_0x9d08('0x46'),squel[_0x9d08('0x4a')](hopperContacts))[_0x9d08('0x3d')](_0x9d08('0x3f')))[_0x9d08('0x3c')]();return _0x348095;}function _0x7b309e(_0x49f30e,_0x6b8887){var _0x5c5e65=squel[_0x9d08('0x32')]()[_0x9d08('0x33')](_0x9d08('0x4b'))[_0x9d08('0x35')]([_0x9d08('0x21'),_0x9d08('0x3b'),_0x9d08('0x36'),_0x6b8887,_0x9d08('0x37'),_0x9d08('0x38')],squel['select']()[_0x9d08('0x39')](_0x9d08('0x21'),'phone')['field']('id',_0x9d08('0x3b'))[_0x9d08('0x39')](LISTID['toString'](),_0x9d08('0x36'))[_0x9d08('0x39')](_0x49f30e['id'][_0x9d08('0x3c')](),_0x6b8887)[_0x9d08('0x39')]('NOW()',_0x9d08('0x37'))[_0x9d08('0x39')]('NOW()','updatedAt')[_0x9d08('0x41')](_0x9d08('0x44'))[_0x9d08('0x3d')](_0x9d08('0x45'))[_0x9d08('0x3d')](_0x9d08('0x3e'),LISTID['toString']())['where'](_0x9d08('0x46'),squel[_0x9d08('0x4a')](hopperContacts))[_0x9d08('0x3d')](_0x9d08('0x3f')))[_0x9d08('0x3c')]();return _0x5c5e65;}return db[_0x9d08('0x4c')][_0x9d08('0x4d')]({'where':{'type':'outbound'},'attributes':['id',_0x9d08('0x4e')],'include':[{'model':db[_0x9d08('0x4f')],'as':_0x9d08('0x50'),'where':{'id':LISTID}}]})[_0x9d08('0x2d')](function(_0x40974c){var _0x5cd334=[];if(_0x40974c){var _0x34e9b1;for(var _0x3f58ce=0x0,_0x196b73;_0x3f58ce<_0x40974c['length'];_0x3f58ce+=0x1){_0x196b73=_0x40974c[_0x3f58ce][_0x9d08('0x51')]({'plain':!![]});switch(_0x196b73[_0x9d08('0x4e')]){case _0x9d08('0x52'):_0x5cd334[_0x9d08('0x2e')](db['sequelize']['query'](_0x1bc00f(_0x196b73,'VoiceQueueId'))[_0x9d08('0x2d')](function(){})[_0x9d08('0x53')](_0x1ad7eb()));break;case _0x9d08('0x54'):_0x5cd334[_0x9d08('0x2e')](db[_0x9d08('0x55')][_0x9d08('0x56')](_0x3844f4(_0x196b73,_0x9d08('0x57')))[_0x9d08('0x2d')](function(){})[_0x9d08('0x53')](_0x1ad7eb()));break;default:_0x5cd334[_0x9d08('0x2e')](db[_0x9d08('0x55')][_0x9d08('0x56')](_0x5a1637(_0x196b73,_0x9d08('0x57')))[_0x9d08('0x2d')](function(){})[_0x9d08('0x53')](_0x1ad7eb()));}}}return _0x5cd334;})['all']()[_0x9d08('0x2d')](function(){return db[_0x9d08('0x4c')][_0x9d08('0x4d')]({'where':{'type':_0x9d08('0x58')},'attributes':['id'],'include':[{'model':db[_0x9d08('0x4f')],'as':_0x9d08('0x59'),'where':{'id':LISTID}}]})[_0x9d08('0x2d')](function(_0x503270){var _0x9ed3e1=[];if(_0x503270){var _0x46f901;for(var _0x59c136=0x0,_0x4a793f;_0x59c136<_0x503270[_0x9d08('0x1d')];_0x59c136+=0x1){_0x4a793f=_0x503270[_0x59c136][_0x9d08('0x51')]({'plain':!![]});_0x9ed3e1['push'](db[_0x9d08('0x55')]['query'](_0x7b309e(_0x4a793f,_0x9d08('0x57')))[_0x9d08('0x2d')](function(){})[_0x9d08('0x53')](_0x1ad7eb()));}}return _0x9ed3e1;})[_0x9d08('0x5a')]();})[_0x9d08('0x2d')](function(){return db[_0x9d08('0x5b')]['findAll']({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x9d08('0x4f')],'as':_0x9d08('0x50'),'where':{'id':LISTID}}]})['then'](function(_0x3b5ee5){var _0x4eff23=[];if(_0x3b5ee5){for(var _0x20235b=0x0,_0x1df1bc;_0x20235b<_0x3b5ee5[_0x9d08('0x1d')];_0x20235b+=0x1){_0x1df1bc=_0x3b5ee5[_0x20235b][_0x9d08('0x51')]({'plain':!![]});switch(_0x1df1bc['dialCheckDuplicateType']){case'always':_0x4eff23[_0x9d08('0x2e')](db[_0x9d08('0x55')]['query'](_0x1bc00f(_0x1df1bc,'CampaignId'))[_0x9d08('0x2d')](function(){})['catch'](_0x1ad7eb()));break;case _0x9d08('0x54'):_0x4eff23[_0x9d08('0x2e')](db[_0x9d08('0x55')][_0x9d08('0x56')](_0x3844f4(_0x1df1bc,_0x9d08('0x5c')))[_0x9d08('0x2d')](function(){})[_0x9d08('0x53')](_0x1ad7eb()));break;default:_0x4eff23['push'](db[_0x9d08('0x55')][_0x9d08('0x56')](_0x5a1637(_0x1df1bc,_0x9d08('0x5c')))['then'](function(){})[_0x9d08('0x53')](_0x1ad7eb()));}}}return _0x4eff23;})[_0x9d08('0x5a')]();})[_0x9d08('0x2d')](function(){return db[_0x9d08('0x5b')][_0x9d08('0x4d')]({'attributes':['id'],'include':[{'model':db[_0x9d08('0x4f')],'as':_0x9d08('0x59'),'where':{'id':LISTID}}]})[_0x9d08('0x2d')](function(_0x5949f8){var _0x7d37ac=[];if(_0x5949f8){for(var _0x5b55b9=0x0,_0x38b66c;_0x5b55b9<_0x5949f8[_0x9d08('0x1d')];_0x5b55b9+=0x1){_0x38b66c=_0x5949f8[_0x5b55b9][_0x9d08('0x51')]({'plain':!![]});_0x7d37ac[_0x9d08('0x2e')](db[_0x9d08('0x55')][_0x9d08('0x56')](_0x7b309e(_0x38b66c,_0x9d08('0x5c')))[_0x9d08('0x2d')](function(){})[_0x9d08('0x53')](_0x1ad7eb()));}}return _0x7d37ac;})[_0x9d08('0x5a')]();})['catch'](function(_0x2c274e){logger['error'](_0x9d08('0x5d'),_0x9d08('0x5e'),_0x2c274e[_0x9d08('0x5f')]);});}var processPromises=function(_0x4c162e){return BPromise[_0x9d08('0x5a')](promises)[_0x9d08('0x2d')](function(_0x3539a3){})[_0x9d08('0x53')](function(_0x3c8f78){logger[_0x9d08('0x17')](_0x9d08('0x60'),JSON[_0x9d08('0x30')](_0x3c8f78));})['finally'](function(){socket[_0x9d08('0x61')](_0x9d08('0x62')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x4c162e){return _0x4c162e['resume']();}});};var endCsv=function(){return BPromise['resolve']()['then'](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket['emit'](_0x9d08('0x62')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs['unlinkSync'](FILEPATH);}catch(_0x4512ef){logger['error'](_0x9d08('0x63'),JSON[_0x9d08('0x30')](_0x4512ef));}finally{process[_0x9d08('0x64')](0x0);}});};process['on'](_0x9d08('0x65'),function(){logger['info'](_0x9d08('0x66'));endCsv();});function main(){return BPromise[_0x9d08('0x67')]()[_0x9d08('0x2d')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES['split'](',');return db[_0x9d08('0x2a')][_0x9d08('0x4d')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x9d08('0x2d')](function(_0x3d3beb){var _0x246776=fs[_0x9d08('0x68')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x9d08('0x69')](_0x246776,{'header':!![],'skipEmptyLines':!![],'step':function(_0x3c8f12,_0x21af3d){total+=0x1;var _0x1ac309=total;promises[_0x9d08('0x2e')](checkRow(_0x3c8f12,_0x3d3beb,_0x1ac309)['then'](function(){success+=0x1;})[_0x9d08('0x53')](function(_0x4d8229){if(_0x4d8229['error']){errors+=0x1;delete _0x4d8229[_0x9d08('0x17')];}else if(_0x4d8229[_0x9d08('0x29')]){duplicates+=0x1;delete _0x4d8229['duplicate'];}rows[_0x9d08('0x2e')](_0x4d8229);}));if(total%0xc8===0x0){_0x21af3d['pause']();return processPromises(_0x21af3d);}},'complete':function(){return processPromises()['then'](function(){logger['info'](_0x9d08('0x6a'));endCsv();});},'error':function(_0x2679ae,_0x4f1c92){logger['info'](_0x9d08('0x6b'),JSON[_0x9d08('0x30')](_0x2679ae));endCsv();}});})[_0x9d08('0x53')](function(_0x33c30c){logger[_0x9d08('0x17')](_0x9d08('0x6c'),JSON[_0x9d08('0x30')](_0x33c30c));});}main(); \ No newline at end of file +var _0x366d=['cm_hopper_final','createdAt','str','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','Lists','then','get','sequelize','VoiceQueueId','onlyIfOpen','query','all','Campaign','CmList','CampaignId','BlackLists','generalCheckHopper','emit','contact:csv_','resolve','unlinkSync','SIGINT','info','CSV\x20import\x20process\x20stopped!','createReadStream','parse','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','lodash','papaparse','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','redis','localhost','../../../api/cmContact/cmContact.socket','argv','undefined','Missing\x20filepath\x20parameter!','null','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','contact','index','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','CompanyId','length','find','duplicate','Duplicate\x20Contact','create','keys','push','catch','Error\x20while\x20creating\x20contact:\x20','message','stringify','cmContact','inspect','insert','cm_hopper','phone','scheduledAt','ContactId','ListId','updatedAt','select','field','NOW()','toString','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','into','fromQuery','id\x20IN\x20?','calleridnum'];(function(_0x396cad,_0x258a5a){var _0x276b0f=function(_0x51d2fd){while(--_0x51d2fd){_0x396cad['push'](_0x396cad['shift']());}};_0x276b0f(++_0x258a5a);}(_0x366d,0x8e));var _0xd366=function(_0x218388,_0x35e0e6){_0x218388=_0x218388-0x0;var _0x323fac=_0x366d[_0x218388];return _0x323fac;};'use strict';var BPromise=require(_0xd366('0x0'));var util=require('util');var _=require(_0xd366('0x1'));var fs=require('fs');var squel=require('squel');var Papa=require(_0xd366('0x2'));var Redis=require(_0xd366('0x3'));var db=require(_0xd366('0x4'))['db'];var config=require(_0xd366('0x5'));var logger=require(_0xd366('0x6'))('api');config[_0xd366('0x7')]=_['defaults'](config[_0xd366('0x7')],{'host':_0xd366('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd366('0x7')]));require(_0xd366('0x9'))['register'](socket);try{if(!process[_0xd366('0xa')][0x2]||process[_0xd366('0xa')][0x2]===_0xd366('0xb')||process['argv'][0x2]==='null'){throw new Error(_0xd366('0xc'));}var FILEPATH=process['argv'][0x2];if(!process[_0xd366('0xa')][0x3]||process[_0xd366('0xa')][0x3]===_0xd366('0xb')||process[_0xd366('0xa')][0x3]===_0xd366('0xd')||!process['argv'][0x4]||process[_0xd366('0xa')][0x4]===_0xd366('0xb')||process[_0xd366('0xa')][0x4]===_0xd366('0xd')){throw new Error(_0xd366('0xe'));}var FIELDS=_[_0xd366('0xf')](process[_0xd366('0xa')][0x3]['split'](','),process[_0xd366('0xa')][0x4][_0xd366('0x10')](','));if(!process[_0xd366('0xa')][0x5]||process['argv'][0x5]===_0xd366('0xb')||process[_0xd366('0xa')][0x5]===_0xd366('0xd')){throw new Error(_0xd366('0x11'));}var LISTID=process[_0xd366('0xa')][0x5];var COMPANYID=process[_0xd366('0xa')][0x6]&&process[_0xd366('0xa')][0x6]!==_0xd366('0xb')&&process[_0xd366('0xa')][0x6]!==_0xd366('0xd')?process[_0xd366('0xa')][0x6]:null;var DUPLICATES=process[_0xd366('0xa')][0x7]&&process[_0xd366('0xa')][0x7]!==_0xd366('0xb')&&process[_0xd366('0xa')][0x7]!==_0xd366('0xd')?process[_0xd366('0xa')][0x7]:null;if(!process[_0xd366('0xa')][0x8]||process[_0xd366('0xa')][0x8]===_0xd366('0xb')||process['argv'][0x8]===_0xd366('0xd')){throw new Error(_0xd366('0x12'));}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0x19a36b){logger[_0xd366('0x13')](_0x19a36b);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(_0x5cdaed,_0x4f832e,_0x159a28,_0x946800){var _0x38d234={'message':_0x4f832e};_0x38d234[_0x5cdaed]=!![];if(_0x159a28){_0x38d234[_0xd366('0x14')]=_0x159a28;}if(_0x946800){_0x38d234[_0xd366('0x15')]=_0x946800;}return _0x38d234;}function isEmail(_0x4b8543){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))*$/[_0xd366('0x16')](_0x4b8543);}function checkRow(_0x2a8052,_0x1c1f18,_0x56566c){return new BPromise(function(_0x36b533,_0x2c8a20){if(_[_0xd366('0x17')](_0x2a8052)){return _0x2c8a20(handleCheckRowError('error',_0xd366('0x18'),null,_0x56566c));}if(_0x2a8052[_0xd366('0x19')]&&_0x2a8052[_0xd366('0x19')]['length']){var _0x3b7e6a=_['map'](_0x2a8052[_0xd366('0x19')],'message')['join'](';');return _0x2c8a20(handleCheckRowError(_0xd366('0x13'),_0x3b7e6a,null,_0x56566c));}var _0x485269={};for(var _0x11cb94 in FIELDS){if(FIELDS[_0xd366('0x1a')](_0x11cb94)&&FIELDS[_0x11cb94]){_0x485269[_0x11cb94]=_0x2a8052[_0xd366('0x1b')][0x0][FIELDS[_0x11cb94]]||_0x2a8052[_0xd366('0x1b')][0x0]['\ufeff'+FIELDS[_0x11cb94]];}}if(!_0x485269[_0xd366('0x1c')]){return _0x2c8a20(handleCheckRowError(_0xd366('0x13'),_0xd366('0x1d'),null,_0x56566c));}if(!_0x485269['phone']){return _0x2c8a20(handleCheckRowError(_0xd366('0x13'),_0xd366('0x1e'),null,_0x56566c));}if(_0x485269[_0xd366('0x1f')]){var _0x397da8=moment(_0x485269['birthDate'],_0xd366('0x20'));if(!_0x397da8[_0xd366('0x21')]()){return _0x2c8a20(handleCheckRowError(_0xd366('0x13'),_0xd366('0x22'),null,_0x56566c));}}if(_0x485269['email']){if(!isEmail(_0x485269[_0xd366('0x23')])){return _0x2c8a20(handleCheckRowError(_0xd366('0x13'),_0xd366('0x24'),null,_0x56566c));}}_0x485269['ListId']=LISTID;_0x485269[_0xd366('0x25')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0xd366('0x26')]&&_0x1c1f18){var _0x35d4c9={};for(var _0x73edbf=0x0,_0x48113c=DUPLICATES[_0xd366('0x26')];_0x73edbf<_0x48113c;_0x73edbf+=0x1){_0x35d4c9[DUPLICATES[_0x73edbf]]=_0x485269[DUPLICATES[_0x73edbf]];}var _0x22aabf=_[_0xd366('0x27')](_0x1c1f18,_0x35d4c9);if(_0x22aabf){return _0x2c8a20(handleCheckRowError(_0xd366('0x28'),_0xd366('0x29'),_0x22aabf,_0x56566c));}}return db['CmContact'][_0xd366('0x2a')](_0x485269,{'raw':!![],'hooks':![],'fields':_[_0xd366('0x2b')](_0x485269)})['then'](function(_0x2cf74c){if(DUPLICATES&&DUPLICATES[_0xd366('0x26')]&&_0x1c1f18){_0x1c1f18[_0xd366('0x2c')](_['pick'](_0x485269,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x2cf74c['id'];return _0x36b533();})[_0xd366('0x2d')](function(_0xb18bb5){return _0x2c8a20(handleCheckRowError(_0xd366('0x13'),_0xd366('0x2e')+(_0xb18bb5[_0xd366('0x2f')]||JSON[_0xd366('0x30')](_0xb18bb5)),null,_0x56566c));});});}function checkHopper(){function _0x419371(){return function(_0x47819c){logger[_0xd366('0x13')](_0xd366('0x31'),'checkHopper',util[_0xd366('0x32')](_0x47819c,{'showHidden':![],'depth':null}));};}var _0x4ce15b=function(_0x5e8089,_0x3275c3){var _0x297ea6=squel[_0xd366('0x33')]()['into'](_0xd366('0x34'))['fromQuery']([_0xd366('0x35'),_0xd366('0x36'),_0xd366('0x37'),_0xd366('0x38'),_0x3275c3,'createdAt',_0xd366('0x39')],squel[_0xd366('0x3a')]()[_0xd366('0x3b')](_0xd366('0x35'),_0xd366('0x35'))[_0xd366('0x3b')](_0xd366('0x3c'),_0xd366('0x36'))['field']('id',_0xd366('0x37'))[_0xd366('0x3b')](LISTID['toString'](),_0xd366('0x38'))['field'](_0x5e8089['id'][_0xd366('0x3d')](),_0x3275c3)[_0xd366('0x3b')]('NOW()','createdAt')[_0xd366('0x3b')]('NOW()',_0xd366('0x39'))[_0xd366('0x3e')](_0xd366('0x3f'))[_0xd366('0x40')](_0xd366('0x41'))[_0xd366('0x40')](_0xd366('0x42'),LISTID['toString']())[_0xd366('0x40')](_0xd366('0x43'))[_0xd366('0x40')](_0xd366('0x44'),squel[_0xd366('0x3a')]()[_0xd366('0x3b')](_0xd366('0x35'))[_0xd366('0x3e')](_0xd366('0x34'))['where'](_0x3275c3+_0xd366('0x45'),_0x5e8089['id'][_0xd366('0x3d')]())))[_0xd366('0x3d')]();return _0x297ea6;};var _0x4e2e9f=function(_0x45dc67,_0x263fd5){var _0x22627f=squel[_0xd366('0x33')]()[_0xd366('0x46')](_0xd366('0x34'))[_0xd366('0x47')]([_0xd366('0x35'),'scheduledAt',_0xd366('0x37'),_0xd366('0x38'),_0x263fd5,'createdAt',_0xd366('0x39')],squel['select']()[_0xd366('0x3b')](_0xd366('0x35'),'phone')[_0xd366('0x3b')](_0xd366('0x3c'),'scheduledAt')[_0xd366('0x3b')]('id',_0xd366('0x37'))[_0xd366('0x3b')](LISTID[_0xd366('0x3d')](),_0xd366('0x38'))[_0xd366('0x3b')](_0x45dc67['id'][_0xd366('0x3d')](),_0x263fd5)[_0xd366('0x3b')](_0xd366('0x3c'),'createdAt')['field'](_0xd366('0x3c'),_0xd366('0x39'))[_0xd366('0x3e')](_0xd366('0x3f'))[_0xd366('0x40')](_0xd366('0x41'))['where'](_0xd366('0x42'),LISTID[_0xd366('0x3d')]())[_0xd366('0x40')](_0xd366('0x48'),squel['str'](hopperContacts))[_0xd366('0x40')](_0xd366('0x43'))[_0xd366('0x40')]('phone\x20NOT\x20IN\x20(?)',squel[_0xd366('0x3a')]()[_0xd366('0x3b')](_0xd366('0x49'))[_0xd366('0x3e')](_0xd366('0x4a'))['where'](_0x263fd5+_0xd366('0x45'),_0x45dc67['id']['toString']()))['where'](_0xd366('0x44'),squel['select']()[_0xd366('0x3b')]('phone')[_0xd366('0x3e')](_0xd366('0x34'))[_0xd366('0x40')](_0x263fd5+_0xd366('0x45'),_0x45dc67['id'][_0xd366('0x3d')]())))['toString']();return _0x22627f;};function _0x12c99f(_0x39c167,_0x4d0b3b){var _0x317fef=squel[_0xd366('0x33')]()[_0xd366('0x46')](_0xd366('0x34'))[_0xd366('0x47')](['phone','scheduledAt',_0xd366('0x37'),_0xd366('0x38'),_0x4d0b3b,'createdAt',_0xd366('0x39')],squel['select']()['field'](_0xd366('0x35'),'phone')[_0xd366('0x3b')]('NOW()','scheduledAt')[_0xd366('0x3b')]('id',_0xd366('0x37'))[_0xd366('0x3b')](LISTID[_0xd366('0x3d')](),'ListId')['field'](_0x39c167['id'][_0xd366('0x3d')](),_0x4d0b3b)['field']('NOW()',_0xd366('0x4b'))[_0xd366('0x3b')](_0xd366('0x3c'),'updatedAt')['from'](_0xd366('0x3f'))['where'](_0xd366('0x41'))['where'](_0xd366('0x42'),LISTID[_0xd366('0x3d')]())['where'](_0xd366('0x48'),squel[_0xd366('0x4c')](hopperContacts))[_0xd366('0x40')]('phone\x20IS\x20NOT\x20NULL'))['toString']();return _0x317fef;}function _0x570383(_0x4448e7,_0x1d4294){var _0x226a75=squel[_0xd366('0x33')]()[_0xd366('0x46')](_0xd366('0x4d'))[_0xd366('0x47')]([_0xd366('0x35'),'ContactId',_0xd366('0x38'),_0x1d4294,_0xd366('0x4b'),_0xd366('0x39')],squel[_0xd366('0x3a')]()[_0xd366('0x3b')](_0xd366('0x35'),'phone')[_0xd366('0x3b')]('id','ContactId')['field'](LISTID[_0xd366('0x3d')](),_0xd366('0x38'))[_0xd366('0x3b')](_0x4448e7['id'][_0xd366('0x3d')](),_0x1d4294)[_0xd366('0x3b')](_0xd366('0x3c'),_0xd366('0x4b'))[_0xd366('0x3b')](_0xd366('0x3c'),_0xd366('0x39'))[_0xd366('0x3e')]('cm_contacts')[_0xd366('0x40')]('deletedAt\x20IS\x20NULL')[_0xd366('0x40')](_0xd366('0x42'),LISTID['toString']())[_0xd366('0x40')]('id\x20IN\x20?',squel['str'](hopperContacts))[_0xd366('0x40')](_0xd366('0x43')))['toString']();return _0x226a75;}return db[_0xd366('0x4e')][_0xd366('0x4f')]({'where':{'type':_0xd366('0x50')},'attributes':['id',_0xd366('0x51')],'include':[{'model':db['CmList'],'as':_0xd366('0x52'),'where':{'id':LISTID}}]})[_0xd366('0x53')](function(_0x7a3c95){var _0x569a5e=[];if(_0x7a3c95){var _0x340852;for(var _0x3302e7=0x0,_0x55e2b4;_0x3302e7<_0x7a3c95[_0xd366('0x26')];_0x3302e7+=0x1){_0x55e2b4=_0x7a3c95[_0x3302e7][_0xd366('0x54')]({'plain':!![]});switch(_0x55e2b4['dialCheckDuplicateType']){case'always':_0x569a5e[_0xd366('0x2c')](db[_0xd366('0x55')]['query'](_0x4e2e9f(_0x55e2b4,_0xd366('0x56')))['then'](function(){})[_0xd366('0x2d')](_0x419371()));break;case _0xd366('0x57'):_0x569a5e['push'](db['sequelize'][_0xd366('0x58')](_0x4ce15b(_0x55e2b4,_0xd366('0x56')))['then'](function(){})[_0xd366('0x2d')](_0x419371()));break;default:_0x569a5e['push'](db[_0xd366('0x55')]['query'](_0x12c99f(_0x55e2b4,_0xd366('0x56')))[_0xd366('0x53')](function(){})['catch'](_0x419371()));}}}return _0x569a5e;})[_0xd366('0x59')]()['then'](function(){return db[_0xd366('0x4e')]['findAll']({'where':{'type':_0xd366('0x50')},'attributes':['id'],'include':[{'model':db['CmList'],'as':'BlackLists','where':{'id':LISTID}}]})[_0xd366('0x53')](function(_0x36868f){var _0x44acdc=[];if(_0x36868f){var _0xb381e0;for(var _0x56cc3f=0x0,_0x28d375;_0x56cc3f<_0x36868f[_0xd366('0x26')];_0x56cc3f+=0x1){_0x28d375=_0x36868f[_0x56cc3f][_0xd366('0x54')]({'plain':!![]});_0x44acdc['push'](db['sequelize'][_0xd366('0x58')](_0x570383(_0x28d375,'VoiceQueueId'))[_0xd366('0x53')](function(){})['catch'](_0x419371()));}}return _0x44acdc;})[_0xd366('0x59')]();})[_0xd366('0x53')](function(){return db[_0xd366('0x5a')][_0xd366('0x4f')]({'attributes':['id',_0xd366('0x51')],'include':[{'model':db[_0xd366('0x5b')],'as':_0xd366('0x52'),'where':{'id':LISTID}}]})[_0xd366('0x53')](function(_0x4c0232){var _0x54b6f1=[];if(_0x4c0232){for(var _0x475574=0x0,_0x3a3b61;_0x475574<_0x4c0232[_0xd366('0x26')];_0x475574+=0x1){_0x3a3b61=_0x4c0232[_0x475574][_0xd366('0x54')]({'plain':!![]});switch(_0x3a3b61[_0xd366('0x51')]){case'always':_0x54b6f1[_0xd366('0x2c')](db[_0xd366('0x55')]['query'](_0x4e2e9f(_0x3a3b61,'CampaignId'))[_0xd366('0x53')](function(){})['catch'](_0x419371()));break;case _0xd366('0x57'):_0x54b6f1['push'](db[_0xd366('0x55')][_0xd366('0x58')](_0x4ce15b(_0x3a3b61,_0xd366('0x5c')))[_0xd366('0x53')](function(){})[_0xd366('0x2d')](_0x419371()));break;default:_0x54b6f1[_0xd366('0x2c')](db['sequelize']['query'](_0x12c99f(_0x3a3b61,'CampaignId'))[_0xd366('0x53')](function(){})[_0xd366('0x2d')](_0x419371()));}}}return _0x54b6f1;})[_0xd366('0x59')]();})['then'](function(){return db[_0xd366('0x5a')][_0xd366('0x4f')]({'attributes':['id'],'include':[{'model':db[_0xd366('0x5b')],'as':_0xd366('0x5d'),'where':{'id':LISTID}}]})[_0xd366('0x53')](function(_0x4c3941){var _0x1f9d8e=[];if(_0x4c3941){for(var _0x5df08f=0x0,_0x3e51a4;_0x5df08f<_0x4c3941[_0xd366('0x26')];_0x5df08f+=0x1){_0x3e51a4=_0x4c3941[_0x5df08f][_0xd366('0x54')]({'plain':!![]});_0x1f9d8e[_0xd366('0x2c')](db['sequelize'][_0xd366('0x58')](_0x570383(_0x3e51a4,_0xd366('0x5c')))[_0xd366('0x53')](function(){})[_0xd366('0x2d')](_0x419371()));}}return _0x1f9d8e;})[_0xd366('0x59')]();})[_0xd366('0x2d')](function(_0x1fb73f){logger[_0xd366('0x13')]('cmContact,\x20%s,\x20%s',_0xd366('0x5e'),_0x1fb73f['message']);});}var processPromises=function(_0x4db43a){return BPromise[_0xd366('0x59')](promises)['then'](function(_0x4af2a6){})['catch'](function(_0x1f0fca){logger[_0xd366('0x13')]('Error\x20processing\x20rows\x20block:',JSON['stringify'](_0x1f0fca));})['finally'](function(){socket[_0xd366('0x5f')](_0xd366('0x60')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x4db43a){return _0x4db43a['resume']();}});};var endCsv=function(){return BPromise[_0xd366('0x61')]()['then'](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket[_0xd366('0x5f')]('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0xd366('0x62')](FILEPATH);}catch(_0x16ab0f){logger[_0xd366('0x13')]('Unable\x20to\x20delete\x20temp\x20file:',JSON[_0xd366('0x30')](_0x16ab0f));}finally{process['exit'](0x0);}});};process['on'](_0xd366('0x63'),function(){logger[_0xd366('0x64')](_0xd366('0x65'));endCsv();});function main(){return BPromise[_0xd366('0x61')]()[_0xd366('0x53')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0xd366('0x10')](',');return db['CmContact'][_0xd366('0x4f')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0xd366('0x53')](function(_0x17993c){var _0x35f26d=fs[_0xd366('0x66')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0xd366('0x67')](_0x35f26d,{'header':!![],'skipEmptyLines':!![],'step':function(_0x1c6401,_0x62b8a4){total+=0x1;var _0x244367=total;promises[_0xd366('0x2c')](checkRow(_0x1c6401,_0x17993c,_0x244367)[_0xd366('0x53')](function(){success+=0x1;})[_0xd366('0x2d')](function(_0x1173b1){if(_0x1173b1[_0xd366('0x13')]){errors+=0x1;delete _0x1173b1['error'];}else if(_0x1173b1['duplicate']){duplicates+=0x1;delete _0x1173b1['duplicate'];}rows[_0xd366('0x2c')](_0x1173b1);}));if(total%0xc8===0x0){_0x62b8a4[_0xd366('0x68')]();return processPromises(_0x62b8a4);}},'complete':function(){return processPromises()[_0xd366('0x53')](function(){logger[_0xd366('0x64')](_0xd366('0x69'));endCsv();});},'error':function(_0x5c0f85,_0x3938d9){logger['info'](_0xd366('0x6a'),JSON['stringify'](_0x5c0f85));endCsv();}});})['catch'](function(_0x206011){logger[_0xd366('0x13')](_0xd366('0x6b'),JSON[_0xd366('0x30')](_0x206011));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index fe1df47..5197d23 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 _0x1f19=['sequelize','query','campaigns','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','spread','catch','voice_queues.id','voice_queues.dialTimezone','voice_queues','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','timezones','isNil','set','dialTimezone','stringify','send','start','binding','clone','socket_timestamp','server/files/tmp','.csv','includes','ContactItemType','findAll','name','_description','writeFileSync','parse','createReadStream','rows','find','hasOwnProperty','data','trim','isValid','isNaN','agent\x20not\x20exists','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','utcOffset','\x20not\x20specified','replace','itemTypeId','description','SystemRow','emit','contact:import:','Abort\x20parser','abort','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','CompanyId',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','contactTypeId','orderBy','VoiceQueueId','CampaignId','voice_queues_has_cm_blacklists','campaigns_has_cm_blacklists','finish','affectedRows','unlink','exit','complete','argv','arguments\x20\x20\x20','root','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','firstName','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','path','lodash','papaparse','util','bluebird','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/environment/shared','../../../config/logger','import','redis','defaults','localhost','format','YYYY-MM-DD\x20HH:mm:ss','select','phone','from','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','AdditionalPhones','length','push','all','split','then','CmContactHasItem','findOne','update','updated','create','inserted','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','into','cm_hopper','fromQuery','scheduledat','ListId','createdAt','updatedAt','priority','UserId','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','cm_hopper_black','ContactId','field','ListId\x20=\x20?','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','cm_contacts.id','insert','recallme','toString','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','keys','scheduledAt',')\x20NOT\x20IN\x20?','id\x20IN\x20?','MIN(id)','min_id','info','Received\x20SIGINT','error','message','errors','code'];(function(_0x4cd226,_0x489a22){var _0x19c008=function(_0x14a9e2){while(--_0x14a9e2){_0x4cd226['push'](_0x4cd226['shift']());}};_0x19c008(++_0x489a22);}(_0x1f19,0x114));var _0x91f1=function(_0x2dbe70,_0x4097c4){_0x2dbe70=_0x2dbe70-0x0;var _0x16ed01=_0x1f19[_0x2dbe70];return _0x16ed01;};'use strict';var fs=require('fs');var path=require(_0x91f1('0x0'));var _=require(_0x91f1('0x1'));var Papa=require(_0x91f1('0x2'));var util=require(_0x91f1('0x3'));var BPromise=require(_0x91f1('0x4'));var moment=require('moment');var squel=require(_0x91f1('0x5'));var Redis=require(_0x91f1('0x6'));var db=require(_0x91f1('0x7'))['db'];var config=require(_0x91f1('0x8'));var shared=require(_0x91f1('0x9'));var logger=require(_0x91f1('0xa'))(_0x91f1('0xb'));config[_0x91f1('0xc')]=_[_0x91f1('0xd')](config[_0x91f1('0xc')],{'host':_0x91f1('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x91f1('0xf')](_0x91f1('0x10'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x91f1('0xf')](_0x91f1('0x10'));function isEmail(_0x3f89cd){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'](_0x3f89cd);}function selectNotIn(_0x4054d8,_0x2d8540,_0xd8e980,_0x449a12,_0x2117f1){return squel[_0x91f1('0x11')]()['field'](_0x91f1('0x12'))[_0x91f1('0x13')](_0x449a12)[_0x91f1('0x14')](_0x2d8540,null,_0x2d8540+_0x91f1('0x15')+_0x449a12+'.'+_0xd8e980)[_0x91f1('0x16')](_0x449a12+'.'+_0xd8e980+_0x91f1('0x17')+_0x4054d8+'.'+_0xd8e980)[_0x91f1('0x16')](_0x2d8540+_0x91f1('0x18')+_0x2117f1[_0x91f1('0x14')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x4a6b07,_0xa113a9){promisesAdditionalPhones=[];return db['CmContact']['findAll']({'raw':!![],'attributes':['id',_0x91f1('0x19')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})['then'](function(_0x19e3c3){if(_0x19e3c3!==null){var _0x1a34a3=[];for(var _0x361ac2=0x0;_0x361ac2<_0x19e3c3[_0x91f1('0x1a')];_0x361ac2++){var _0x3829e3=_0x19e3c3[_0x361ac2];_0x1a34a3[_0x91f1('0x1b')](insertAdditionalPhones(_0x3829e3));}}Promise[_0x91f1('0x1c')](_0x1a34a3)['then'](function(){_0x4a6b07({'val':0x1});});});});}function insertAdditionalPhones(_0x98251d){return new Promise(function(_0x3a3f9e,_0x5e1066){var _0x24150b=_0x98251d['AdditionalPhones'];var _0x350b98=_0x24150b[_0x91f1('0x1d')](';');var _0x2e3f9e=[];orderBy=0x0;for(var _0x55c2af=0x0;_0x55c2af<_0x350b98['length'];_0x55c2af++){_0x2e3f9e[_0x91f1('0x1b')](splitAdditionalPhone(_0x98251d['id'],_0x350b98[_0x55c2af]));}Promise[_0x91f1('0x1c')](_0x2e3f9e)[_0x91f1('0x1e')](function(){_0x3a3f9e({'val':_0x350b98[_0x91f1('0x1a')]});});});}function splitAdditionalPhone(_0x5a3b59,_0x124d6a){return new Promise(function(_0x524372,_0x21c084){var _0x35f00c=_0x124d6a[_0x91f1('0x1d')](':');var _0xc8265b=_0x35f00c[0x0];var _0x3f628e=_0x35f00c[0x1];if(!_['isNil'](_0x3f628e)){var _0x498dd8=_0x3f628e[_0x91f1('0x1d')]('|');var _0x1db676=[];for(var _0x32fecc=0x0;_0x32fecc<_0x498dd8[_0x91f1('0x1a')];_0x32fecc++){if(_0x498dd8[_0x32fecc]!==''){var _0x21eef3=_['filter'](promisesAdditionalPhones,{'contactId':_0x5a3b59,'phone':_0x498dd8[_0x32fecc]});if(_0x21eef3['length']==0x0){orderBy++;promisesAdditionalPhones[_0x91f1('0x1b')]({'contactId':_0x5a3b59,'contactTypeId':_0xc8265b,'phone':_0x498dd8[_0x32fecc],'orderBy':orderBy});}}}_0x524372({'ok':0x1});}else _0x524372({'res':0x0});});}function createAdditionalPhone(_0x46a6f3,_0x4388aa,_0x11303e,_0x101ef8){var _0x385082='';var _0x14730c='';var _0x58d664=_0x11303e['split']('§');_0x385082=_0x58d664[0x0];if(_0x58d664[_0x91f1('0x1a')]==0x2)_0x14730c=_0x58d664[0x1];return new Promise(function(_0x5c3edf,_0x2a290d){return db[_0x91f1('0x1f')][_0x91f1('0x20')]({'where':{'CmContactId':_0x46a6f3,'item':_0x385082}})[_0x91f1('0x1e')](function(_0x5e5e51){if(_0x5e5e51){return db[_0x91f1('0x1f')][_0x91f1('0x21')]({'ItemTypeId':_0x4388aa,'description':_0x14730c,'OrderBy':_0x101ef8},{'where':{'CmContactId':_0x46a6f3,'item':_0x385082}})[_0x91f1('0x1e')](function(_0x4723de){_0x5c3edf({'res':_0x91f1('0x22')});});}else{return db[_0x91f1('0x1f')][_0x91f1('0x23')]({'CmContactId':_0x46a6f3,'item':_0x385082,'description':_0x14730c,'ItemTypeId':_0x4388aa,'OrderBy':_0x101ef8,'ItemClass':'PHONE'})[_0x91f1('0x1e')](function(_0xf792c6){_0x5c3edf({'res':_0x91f1('0x24')});});}});});}function insertCmHopper(_0x2644d4,_0x51cef7,_0x10256e,_0x54bf03,_0x4fc449){var _0x29679e=[_0x91f1('0x25'),_0x91f1('0x26'),'cm_contacts.id',_0x91f1('0x27'),_0x51cef7+'.'+_0x54bf03,_0x91f1('0x28'),_0x91f1('0x29'),_0x91f1('0x2a'),_0x91f1('0x2b'),'\x22'+_0x4fc449+'\x22'];return squel['insert']()[_0x91f1('0x2c')](_0x91f1('0x2d'))[_0x91f1('0x2e')](['phone',_0x91f1('0x2f'),'ContactId',_0x91f1('0x30'),_0x54bf03,_0x91f1('0x31'),_0x91f1('0x32'),_0x91f1('0x33'),_0x91f1('0x34'),'recallme'],squel[_0x91f1('0x11')]()[_0x91f1('0x35')](_0x29679e)[_0x91f1('0x13')](_0x51cef7)[_0x91f1('0x14')](_0x91f1('0x36'),null,_0x91f1('0x37')+_0x51cef7+_0x91f1('0x38'))[_0x91f1('0x14')](_0x10256e,null,_0x10256e+_0x91f1('0x15')+_0x51cef7+'.'+_0x54bf03)[_0x91f1('0x16')](_0x51cef7+_0x91f1('0x39'),_0x2644d4)['where'](_0x91f1('0x3a'),NOW)[_0x91f1('0x16')](_0x91f1('0x3b'),selectNotIn(_0x51cef7,_0x10256e,_0x54bf03,'cm_hopper',[_0x91f1('0x3c'),_0x91f1('0x3d')]))[_0x91f1('0x16')](_0x91f1('0x3b'),selectNotIn(_0x51cef7,_0x10256e,_0x54bf03,_0x91f1('0x2d'),[_0x91f1('0x3c')])))['toString']();}function insertCmHopperBlack(_0x4aa803,_0x5c4fb0,_0x44aba2,_0x2466cc){var _0x299b5e=[_0x91f1('0x25'),'cm_contacts.id',_0x91f1('0x27'),_0x5c4fb0+'.'+_0x2466cc,_0x91f1('0x28'),_0x91f1('0x29')];return squel['insert']()['into'](_0x91f1('0x3e'))[_0x91f1('0x2e')]([_0x91f1('0x12'),_0x91f1('0x3f'),_0x91f1('0x30'),_0x2466cc,_0x91f1('0x31'),'updatedAt'],squel[_0x91f1('0x11')]()['fields'](_0x299b5e)[_0x91f1('0x13')](_0x5c4fb0)[_0x91f1('0x14')](_0x91f1('0x36'),null,_0x91f1('0x37')+_0x5c4fb0+_0x91f1('0x38'))[_0x91f1('0x14')](_0x44aba2,null,_0x44aba2+_0x91f1('0x15')+_0x5c4fb0+'.'+_0x2466cc)['where'](_0x5c4fb0+_0x91f1('0x39'),_0x4aa803)[_0x91f1('0x16')](_0x91f1('0x3a'),NOW)[_0x91f1('0x16')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x91f1('0x11')]()[_0x91f1('0x40')](_0x91f1('0x12'))['from'](_0x91f1('0x3e'))[_0x91f1('0x16')](_0x91f1('0x41'),_0x4aa803)[_0x91f1('0x16')](_0x2466cc+_0x91f1('0x17')+_0x5c4fb0+'.'+_0x2466cc)))['toString']();}function insertTzCmHopper(_0x1b6255,_0x1fa368,_0x12fa5b,_0x3ab45b,_0x5361e3,_0x129172){var _0x26e11b=[_0x91f1('0x25'),_0x91f1('0x42')+_0x129172+_0x91f1('0x43'),_0x91f1('0x44'),_0x91f1('0x27'),_0x1fa368+'.'+_0x3ab45b,'cm_contacts.createdAt',_0x91f1('0x29'),_0x91f1('0x2a'),_0x91f1('0x2b'),'\x22'+_0x5361e3+'\x22'];var _0x3e6261=squel[_0x91f1('0x45')]()[_0x91f1('0x2c')](_0x91f1('0x2d'))[_0x91f1('0x2e')]([_0x91f1('0x12'),'scheduledat',_0x91f1('0x3f'),_0x91f1('0x30'),_0x3ab45b,_0x91f1('0x31'),_0x91f1('0x32'),_0x91f1('0x33'),_0x91f1('0x34'),_0x91f1('0x46')],squel[_0x91f1('0x11')]()['fields'](_0x26e11b)[_0x91f1('0x13')](_0x1fa368)[_0x91f1('0x14')](_0x91f1('0x36'),null,_0x91f1('0x37')+_0x1fa368+'.CmListId')[_0x91f1('0x14')](_0x12fa5b,null,_0x12fa5b+_0x91f1('0x15')+_0x1fa368+'.'+_0x3ab45b)[_0x91f1('0x14')](_0x129172,null,_0x129172+_0x91f1('0x15')+_0x1fa368+'.'+_0x3ab45b)[_0x91f1('0x16')](_0x1fa368+_0x91f1('0x39'),_0x1b6255)[_0x91f1('0x16')](_0x91f1('0x3a'),NOW)[_0x91f1('0x16')](_0x91f1('0x3b'),selectNotIn(_0x1fa368,_0x12fa5b,_0x3ab45b,_0x91f1('0x2d'),['\x22always\x22',_0x91f1('0x3d')]))[_0x91f1('0x16')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x1fa368,_0x12fa5b,_0x3ab45b,_0x91f1('0x2d'),[_0x91f1('0x3c')])))['toString']();return _0x3e6261;}function insertTzCmHopperBlack(_0x452000,_0x2cbde3,_0x51a049,_0xa28593){var _0x1b55ea=[_0x91f1('0x25'),_0x91f1('0x44'),_0x91f1('0x27'),_0x2cbde3+'.'+_0xa28593,_0x91f1('0x28'),_0x91f1('0x29')];return squel[_0x91f1('0x45')]()[_0x91f1('0x2c')](_0x91f1('0x3e'))[_0x91f1('0x2e')]([_0x91f1('0x12'),_0x91f1('0x3f'),'ListId',_0xa28593,_0x91f1('0x31'),_0x91f1('0x32')],squel[_0x91f1('0x11')]()[_0x91f1('0x35')](_0x1b55ea)[_0x91f1('0x13')](_0x2cbde3)[_0x91f1('0x14')](_0x91f1('0x36'),null,_0x91f1('0x37')+_0x2cbde3+_0x91f1('0x38'))[_0x91f1('0x14')](_0x51a049,null,_0x51a049+_0x91f1('0x15')+_0x2cbde3+'.'+_0xa28593)[_0x91f1('0x16')](_0x2cbde3+_0x91f1('0x39'),_0x452000)[_0x91f1('0x16')](_0x91f1('0x3a'),NOW)[_0x91f1('0x16')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x91f1('0x11')]()[_0x91f1('0x40')]('phone')[_0x91f1('0x13')](_0x91f1('0x3e'))[_0x91f1('0x16')]('ListId\x20=\x20?',_0x452000)[_0x91f1('0x16')](_0xa28593+_0x91f1('0x17')+_0x2cbde3+'.'+_0xa28593)))[_0x91f1('0x47')]();}function insertCmHopperAdditionalPhones(_0x19c2dc){var _0x36f32e=[_0x91f1('0x48'),_0x91f1('0x49'),'cm_contact_has_items.OrderBy',_0x91f1('0x4a'),_0x91f1('0x4b')];return squel['insert']()['into'](_0x91f1('0x4c'))['fromQuery']([_0x91f1('0x4d'),_0x91f1('0x12'),_0x91f1('0x4e'),_0x91f1('0x31'),_0x91f1('0x32')],squel[_0x91f1('0x11')]()[_0x91f1('0x35')](_0x36f32e)[_0x91f1('0x13')](_0x91f1('0x2d'))[_0x91f1('0x14')](_0x91f1('0x36'),null,_0x91f1('0x4f'))[_0x91f1('0x14')](_0x91f1('0x50'),null,_0x91f1('0x51'))[_0x91f1('0x16')](_0x91f1('0x52'),_0x19c2dc)[_0x91f1('0x16')](_0x91f1('0x3a'),NOW))['toString']();}function insertCmContact(_0x38763b,_0x5c0732,_0x68e732,_0x2ba7eb){var _0x2d2ee7=_[_0x91f1('0x53')](_[_0x91f1('0x54')](_0x2ba7eb),[_0x91f1('0x30'),'CompanyId',_0x91f1('0x31'),'updatedAt',_0x91f1('0x55')]);return squel[_0x91f1('0x45')]()[_0x91f1('0x2c')](_0x91f1('0x36'))[_0x91f1('0x2e')](_0x2d2ee7,squel[_0x91f1('0x11')]()[_0x91f1('0x35')](_0x2d2ee7)['from'](_0x5c0732)[_0x91f1('0x16')]('('+_0x68e732[_0x91f1('0x14')](',')+_0x91f1('0x56'),squel[_0x91f1('0x11')]()[_0x91f1('0x35')](_0x68e732)[_0x91f1('0x13')](_0x91f1('0x36'))[_0x91f1('0x16')](_0x91f1('0x41'),_0x38763b)['where']('deletedAt\x20IS\x20NULL'))[_0x91f1('0x16')](_0x91f1('0x57'),squel[_0x91f1('0x11')]()[_0x91f1('0x40')](_0x91f1('0x58'),_0x91f1('0x59'))[_0x91f1('0x13')](_0x5c0732)['group'](_0x68e732[_0x91f1('0x14')](','))))[_0x91f1('0x47')]();}function handleStop(){logger[_0x91f1('0x5a')](_0x91f1('0x5b'));stopped=!![];}function handleUncaughtException(_0x5c7da8){logger[_0x91f1('0x5c')](_0x5c7da8[_0x91f1('0x5d')]);process['exit'](0x1);}function handleError(_0x2ad66e,_0x2cc73c){stats[_0x91f1('0x5e')][_0x91f1('0x1b')]({'name':_0x2cc73c[_0x91f1('0x5f')],'message':_0x2cc73c[_0x91f1('0x5d')],'row':_0x2ad66e});}function handleQuery(_0x1b3213){logger[_0x91f1('0x5a')](_0x1b3213);return db[_0x91f1('0x60')][_0x91f1('0x61')](_0x1b3213)['spread'](function(_0x2528b5){results['push'](_0x2528b5);})['catch'](function(_0x23d920){logger[_0x91f1('0x5c')](_0x23d920[_0x91f1('0x5d')]);});}function updateTzCampaigns(_0x187da7){return new Promise(function(_0x4a0054,_0x2d0268){var _0x4003a5=squel['select']()['fields'](['campaigns.id','campaigns.dialTimezone'])[_0x91f1('0x13')](_0x91f1('0x62'))[_0x91f1('0x14')](_0x91f1('0x63'),null,_0x91f1('0x64'))[_0x91f1('0x16')](_0x91f1('0x65')+_0x187da7);db[_0x91f1('0x60')]['query'](_0x4003a5[_0x91f1('0x47')]())[_0x91f1('0x66')](function(_0x1164e7){var _0x37e456=[];for(var _0x2cbc4d=0x0;_0x2cbc4d<_0x1164e7[_0x91f1('0x1a')];_0x2cbc4d++){_0x37e456[_0x91f1('0x1b')](getTimezoneData(_0x1164e7[_0x2cbc4d],tmp_campaigns));}BPromise[_0x91f1('0x1c')](_0x37e456)[_0x91f1('0x1e')](function(){_0x4a0054({'val':0x1});});})[_0x91f1('0x67')](function(_0x5c7e55){logger[_0x91f1('0x5c')](_0x5c7e55[_0x91f1('0x5d')]);_0x4a0054({'val':0x0});});});}function updateTzVoiceQueues(_0x5bc94d){return new Promise(function(_0x462d89,_0x3bd38e){var _0x90211=squel[_0x91f1('0x11')]()['fields']([_0x91f1('0x68'),_0x91f1('0x69')])[_0x91f1('0x13')](_0x91f1('0x6a'))[_0x91f1('0x14')](_0x91f1('0x6b'),null,_0x91f1('0x6c'))['where']('voice_queues_has_cm_lists.CmListId='+_0x5bc94d);db[_0x91f1('0x60')][_0x91f1('0x61')](_0x90211[_0x91f1('0x47')]())[_0x91f1('0x66')](function(_0x4aad83){var _0x577358=[];for(var _0x25e74c=0x0;_0x25e74c<_0x4aad83['length'];_0x25e74c++){_0x577358[_0x91f1('0x1b')](getTimezoneData(_0x4aad83[_0x25e74c],tmp_voice_queues));}BPromise['all'](_0x577358)[_0x91f1('0x1e')](function(){_0x462d89({'val':0x1});});})['catch'](function(_0x23d04a){logger[_0x91f1('0x5c')](_0x23d04a['message']);_0x462d89({'val':0x0});});});}function getTimezoneData(_0x313303,_0x37d50b){return new Promise(function(_0xa0dbc7,_0x30b8ab){var _0x3f7195=shared[_0x91f1('0x6d')];var _0x43c586=_0x3f7195[_0x313303['dialTimezone']];if(_[_0x91f1('0x6e')](_0x43c586)){_0xa0dbc7({'ret':0x1});}else{var _0x51ea2d=_0x43c586['utcOffset'];var _0x1a507c=squel[_0x91f1('0x45')]()['into'](_0x37d50b)['set']('id',_0x313303['id'])['set']('offset',_0x51ea2d)[_0x91f1('0x6f')](_0x91f1('0x70'),_0x313303['dialTimezone'])['toString']();return db[_0x91f1('0x60')][_0x91f1('0x61')](_0x1a507c)[_0x91f1('0x66')](function(_0x27b89c){_0xa0dbc7({'ret':0x1});})[_0x91f1('0x67')](function(_0x4af9db){logger['error'](_0x4af9db[_0x91f1('0x5d')]);_0x30b8ab({'ret':0x1});});}});}function handleTZQuery(_0x3e2906){logger['info'](_0x3e2906);return db['sequelize'][_0x91f1('0x61')](_0x3e2906)[_0x91f1('0x66')](function(_0x159fe8){})[_0x91f1('0x67')](function(_0x1f3150){logger[_0x91f1('0x5c')](_0x1f3150['message']);});}function main(_0x287c59,_0x4dff7f,_0x3d8cd9,_0x1a2d28){logger[_0x91f1('0x5a')]('main',_0x287c59,JSON[_0x91f1('0x71')](_0x4dff7f));process[_0x91f1('0x72')](_0x91f1('0x73'));var _0x13ad55=_0x4dff7f[_0x91f1('0x74')];var _0x9c3d03=_[_0x91f1('0x75')](_0x13ad55);var _0x3e9137=_0x4dff7f[_0x91f1('0x76')];var _0x18f117=path[_0x91f1('0x14')](config['root'],_0x91f1('0x77'),_0x3e9137+_0x91f1('0x78'));hasTZ=_[_0x91f1('0x54')](_0x13ad55)[_0x91f1('0x79')](_0x91f1('0x70'));var _0xf51534=_[_0x91f1('0x54')](_0x13ad55)[_0x91f1('0x14')]();logger['info']('header',_0xf51534);db[_0x91f1('0x7a')][_0x91f1('0x7b')]({'raw':!![],'attributes':['id','name']})[_0x91f1('0x1e')](function(_0x35dbf9){for(var _0x59ed29=0x0;_0x59ed29<_0x35dbf9[_0x91f1('0x1a')];_0x59ed29++){if(_0x35dbf9[_0x59ed29]['name']in _0x13ad55){contactItemTypes[_0x91f1('0x1b')](_0x35dbf9[_0x59ed29]);delete _0x9c3d03[_0x35dbf9[_0x59ed29][_0x91f1('0x7c')]];hasAdditionalPhones=!![];}for(var _0x5eb105 in _0x13ad55){if(_0x35dbf9[_0x59ed29][_0x91f1('0x7c')]+_0x91f1('0x7d')===_0x5eb105){phoneDescriptions[_0x91f1('0x1b')]({'itemTypeId':_0x35dbf9[_0x59ed29]['id'],'description':_0x5eb105});delete _0x9c3d03[_0x5eb105];}}}if(hasAdditionalPhones)_0x9c3d03[_0x91f1('0x19')]='';var _0x355159=_[_0x91f1('0x54')](_0x9c3d03)[_0x91f1('0x14')]();logger[_0x91f1('0x5a')]('header',_0x355159);fs[_0x91f1('0x7e')](_0x18f117,_0x355159+'\x0a');Papa[_0x91f1('0x7f')](fs[_0x91f1('0x80')](_0x287c59),{'header':!![],'skipEmptyLines':!![],'step':function(_0x366a9c,_0x2b37fb){try{for(var _0xa3519=0x0,_0x440172=[];_0xa3519<_0x366a9c['data'][_0x91f1('0x1a')];_0xa3519++){stats[_0x91f1('0x81')]+=0x1;if(_0x366a9c[_0x91f1('0x5e')][_0xa3519]){handleError(_0x366a9c['data'][_0xa3519],_0x366a9c[_0x91f1('0x5e')][_0xa3519]);}else{var _0x1bf319=[];var _0x2604cb=[];var _0x3a35b2={};for(var _0x41568a in _0x13ad55){let _0x230b33=contactItemTypes[_0x91f1('0x82')](_0x4b2663=>_0x4b2663[_0x91f1('0x7c')]===_0x41568a);let _0x37942a=contactItemTypes[_0x91f1('0x82')](_0x41cf60=>_0x41cf60['name']+_0x91f1('0x7d')===_0x41568a);if(_[_0x91f1('0x6e')](_0x230b33)&&_[_0x91f1('0x6e')](_0x37942a)){if(_0x13ad55[_0x91f1('0x83')](_0x41568a)){if(_0x366a9c[_0x91f1('0x84')][_0xa3519][_0x13ad55[_0x41568a]]){var _0x4ecc3d=_[_0x91f1('0x85')](_0x366a9c['data'][_0xa3519][_0x13ad55[_0x41568a]]['replace'](/"/g,'\x27'));switch(_0x41568a){case _0x91f1('0x2f'):var _0x5c814a=moment(_0x4ecc3d,_0x91f1('0x10'),!![]);if(_0x5c814a[_0x91f1('0x86')]()){_0x440172['push']('\x22'+_0x4ecc3d+'\x22');}else{_0x1bf319[_0x91f1('0x1b')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0x91f1('0x33'):var _0x360599=parseInt(_0x4ecc3d);_0x4ecc3d=_[_0x91f1('0x87')](_0x360599)||_0x360599<0x0||_0x360599>0x4?_0x1a2d28?0x3:0x2:_0x360599;_0x440172[_0x91f1('0x1b')]('\x22'+_0x4ecc3d+'\x22');break;case _0x91f1('0x34'):var _0x16acb6=parseInt(_0x4ecc3d);if(_['isNumber'](_0x16acb6)&&_[_0x91f1('0x79')](_0x3d8cd9,_0x16acb6)){_0x440172[_0x91f1('0x1b')]('\x22'+_0x16acb6+'\x22');}else{_0x1bf319[_0x91f1('0x1b')](_0x91f1('0x88'));}break;case'email':if(isEmail(_0x4ecc3d)){_0x440172['push']('\x22'+_0x4ecc3d+'\x22');}else{_0x1bf319[_0x91f1('0x1b')]('email\x20wrong\x20format');}break;case _0x91f1('0x89'):var _0x243b7c=moment(_0x4ecc3d,_0x91f1('0x8a'),!![]);if(_0x243b7c[_0x91f1('0x86')]()){_0x440172[_0x91f1('0x1b')]('\x22'+_0x4ecc3d+'\x22');}else{_0x1bf319[_0x91f1('0x1b')](_0x91f1('0x8b'));}break;case _0x91f1('0x70'):var _0x2d020b=shared[_0x91f1('0x6d')];var _0x4563a5=_0x2d020b[_0x4ecc3d];if(!_[_0x91f1('0x6e')](_0x4563a5)){var _0x2af506=_0x4563a5[_0x91f1('0x8c')];_0x440172[_0x91f1('0x1b')]('\x22'+_0x4ecc3d+'\x22');_0x440172['push']('\x22'+_0x2af506+'\x22');}break;default:_0x440172[_0x91f1('0x1b')]('\x22'+_0x4ecc3d+'\x22');}}else{switch(_0x41568a){case'firstName':case _0x91f1('0x12'):_0x1bf319['push'](_0x41568a+_0x91f1('0x8d'));break;default:_0x440172[_0x91f1('0x1b')]('\x22\x22');}}}}else{var _0x41ae0b='';if(!_[_0x91f1('0x6e')](_0x230b33)){if(!_0x3a35b2[_0x91f1('0x83')](_0x230b33['id'])){if(!_[_0x91f1('0x6e')](_0x366a9c['data'][_0xa3519][_0x13ad55[_0x41568a]])){var _0x4ecc3d=_[_0x91f1('0x85')](_0x366a9c['data'][_0xa3519][_0x13ad55[_0x41568a]][_0x91f1('0x8e')](/"/g,'\x27'));var _0x2b28c0=phoneDescriptions[_0x91f1('0x82')](_0x32e6e0=>_0x32e6e0[_0x91f1('0x8f')]===_0x230b33['id']);if(!_[_0x91f1('0x6e')](_0x2b28c0)){var _0x451abd=_[_0x91f1('0x85')](_0x366a9c[_0x91f1('0x84')][_0xa3519][_0x13ad55[_0x2b28c0[_0x91f1('0x90')]]][_0x91f1('0x8e')](/"/g,'\x27'));if(!_['isNil'](_0x451abd))_0x4ecc3d=_0x4ecc3d+'§'+_0x451abd;}if(_0x41ae0b=='')_0x41ae0b=_0x4ecc3d;else _0x41ae0b+='|'+_0x4ecc3d;}_0x2604cb[_0x91f1('0x1b')](_0x230b33['id']+':'+_0x41ae0b);_0x3a35b2[_0x230b33['id']]=0x1;}}}}if(hasAdditionalPhones){_0x440172[_0x91f1('0x1b')]('\x22'+_0x2604cb[_0x91f1('0x14')](';')+'\x22');}if(_0x1bf319['length']){handleError(_0x366a9c[_0x91f1('0x84')][_0xa3519],{'code':_0x91f1('0x91'),'message':_0x1bf319['join']()});}else{fs['appendFileSync'](_0x18f117,_0x440172[_0x91f1('0x14')]()+'\x0a');}_0x440172=[];}if(!(stats[_0x91f1('0x81')]%0xc8)){socket[_0x91f1('0x92')](_0x91f1('0x93')+_0x3e9137,stats);stats[_0x91f1('0x5e')]=[];}}if(stopped){logger[_0x91f1('0x5a')](_0x91f1('0x94'));_0x2b37fb[_0x91f1('0x95')]();}}catch(_0x540174){handleError(_0x366a9c[_0x91f1('0x84')][_0xa3519],{'code':'SystemError','message':_0x540174[_0x91f1('0x5d')]});logger[_0x91f1('0x5c')]('step',_0x540174[_0x91f1('0x5d')]);}},'complete':function(){try{var _0x61754=[];var _0x290c76=[];var _0x365c99=_0x91f1('0x36');if(_0x4dff7f[_0x91f1('0x96')]&&_0x4dff7f['duplicates'][_0x91f1('0x1a')]){_0x365c99=_0x91f1('0x97')+_0x3e9137;_0x61754[_0x91f1('0x1b')]('CREATE\x20TABLE\x20'+_0x365c99+_0x91f1('0x98'));}tmp_campaigns='campaigns_'+_0x3e9137;tmp_voice_queues=_0x91f1('0x99')+_0x3e9137;_0x290c76[_0x91f1('0x1b')](_0x91f1('0x9a')+tmp_campaigns+_0x91f1('0x9b'));_0x290c76[_0x91f1('0x1b')]('CREATE\x20TABLE\x20'+tmp_voice_queues+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');BPromise[_0x91f1('0x9c')](_0x290c76,handleTZQuery)[_0x91f1('0x1e')](function(_0x25a986){updateTzCampaigns(_0x4dff7f[_0x91f1('0x30')])[_0x91f1('0x1e')](function(_0x5367b5){updateTzVoiceQueues(_0x4dff7f['ListId'])[_0x91f1('0x1e')](function(_0x2e4cef){if(hasTZ)_0x355159=_0x355159[_0x91f1('0x8e')](_0x91f1('0x70'),_0x91f1('0x9d'));var _0x477b20=util['format'](_0x91f1('0x9e'),_0x18f117,_0x365c99,_0x355159,_0x4dff7f[_0x91f1('0x30')],_0x4dff7f[_0x91f1('0x9f')]||null,NOW,NOW);if(_[_0x91f1('0x6e')](_0x13ad55[_0x91f1('0x2f')])){_0x477b20+=_0x91f1('0xa0');}_0x61754[_0x91f1('0x1b')](_0x477b20);if(_0x4dff7f['duplicates']&&_0x4dff7f[_0x91f1('0x96')][_0x91f1('0x1a')]){_0x61754[_0x91f1('0x1b')](insertCmContact(_0x4dff7f[_0x91f1('0x30')],_0x365c99,_0x4dff7f[_0x91f1('0x96')],_0x13ad55));_0x61754[_0x91f1('0x1b')](_0x91f1('0xa1')+_0x365c99+';');}BPromise[_0x91f1('0x9c')](_0x61754,handleQuery)[_0x91f1('0x1e')](function(_0x391ab9){BPromise['all']([handleAdditionalPhones()])['then'](function(){_0x61754=[];for(var _0x41e7d3=0x0;_0x41e7d3_0x52372a['name']===_0x43a02d);let _0x58a529=contactItemTypes[_0x5ef2('0x7c')](_0x4e58a9=>_0x4e58a9[_0x5ef2('0x75')]+_0x5ef2('0x76')===_0x43a02d);if(_[_0x5ef2('0x64')](_0x3889d7)&&_['isNil'](_0x58a529)){if(_0x3b5863[_0x5ef2('0x7d')](_0x43a02d)){if(_0x53ad2e[_0x5ef2('0x7b')][_0x506e97][_0x3b5863[_0x43a02d]]){var _0x338512=_[_0x5ef2('0x7e')](_0x53ad2e[_0x5ef2('0x7b')][_0x506e97][_0x3b5863[_0x43a02d]]['replace'](/"/g,'\x27'));switch(_0x43a02d){case _0x5ef2('0x2c'):var _0x2e6d15=moment(_0x338512,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x2e6d15['isValid']()){_0x3454d3[_0x5ef2('0x18')]('\x22'+_0x338512+'\x22');}else{_0x7f29a4[_0x5ef2('0x18')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0x5ef2('0x31'):var _0x36648e=parseInt(_0x338512);_0x338512=_[_0x5ef2('0x7f')](_0x36648e)||_0x36648e<0x0||_0x36648e>0x4?_0x1ae278?0x3:0x2:_0x36648e;_0x3454d3['push']('\x22'+_0x338512+'\x22');break;case'UserId':var _0x4d8e74=parseInt(_0x338512);if(_[_0x5ef2('0x80')](_0x4d8e74)&&_[_0x5ef2('0x72')](_0x1ef79a,_0x4d8e74)){_0x3454d3[_0x5ef2('0x18')]('\x22'+_0x4d8e74+'\x22');}else{_0x7f29a4[_0x5ef2('0x18')]('agent\x20not\x20exists');}break;case'email':if(isEmail(_0x338512)){_0x3454d3[_0x5ef2('0x18')]('\x22'+_0x338512+'\x22');}else{_0x7f29a4[_0x5ef2('0x18')](_0x5ef2('0x81'));}break;case _0x5ef2('0x82'):var _0x312879=moment(_0x338512,_0x5ef2('0x83'),!![]);if(_0x312879[_0x5ef2('0x84')]()){_0x3454d3[_0x5ef2('0x18')]('\x22'+_0x338512+'\x22');}else{_0x7f29a4[_0x5ef2('0x18')](_0x5ef2('0x85'));}break;case'dialTimezone':var _0x524ef1=shared['timezones'];var _0x24a2f6=_0x524ef1[_0x338512];if(!_[_0x5ef2('0x64')](_0x24a2f6)){var _0x41ee85=_0x24a2f6[_0x5ef2('0x65')];_0x3454d3['push']('\x22'+_0x338512+'\x22');_0x3454d3[_0x5ef2('0x18')]('\x22'+_0x41ee85+'\x22');}break;default:_0x3454d3[_0x5ef2('0x18')]('\x22'+_0x338512+'\x22');}}else{switch(_0x43a02d){case'firstName':case'phone':_0x7f29a4[_0x5ef2('0x18')](_0x43a02d+_0x5ef2('0x86'));break;default:_0x3454d3[_0x5ef2('0x18')]('\x22\x22');}}}}else{var _0x1fa329='';if(!_[_0x5ef2('0x64')](_0x3889d7)){if(!_0x233356[_0x5ef2('0x7d')](_0x3889d7['id'])){if(!_[_0x5ef2('0x64')](_0x53ad2e['data'][_0x506e97][_0x3b5863[_0x43a02d]])){var _0x338512=_[_0x5ef2('0x7e')](_0x53ad2e['data'][_0x506e97][_0x3b5863[_0x43a02d]]['replace'](/"/g,'\x27'));var _0x4b41ab=phoneDescriptions[_0x5ef2('0x7c')](_0x14df8d=>_0x14df8d[_0x5ef2('0x87')]===_0x3889d7['id']);if(!_[_0x5ef2('0x64')](_0x4b41ab)){var _0x290dd8=_[_0x5ef2('0x7e')](_0x53ad2e[_0x5ef2('0x7b')][_0x506e97][_0x3b5863[_0x4b41ab['description']]][_0x5ef2('0x88')](/"/g,'\x27'));if(!_['isNil'](_0x290dd8))_0x338512=_0x338512+'§'+_0x290dd8;}if(_0x1fa329=='')_0x1fa329=_0x338512;else _0x1fa329+='|'+_0x338512;}_0x13d347[_0x5ef2('0x18')](_0x3889d7['id']+':'+_0x1fa329);_0x233356[_0x3889d7['id']]=0x1;}}}}if(hasAdditionalPhones){_0x3454d3[_0x5ef2('0x18')]('\x22'+_0x13d347[_0x5ef2('0x12')](';')+'\x22');}if(_0x7f29a4['length']){handleError(_0x53ad2e[_0x5ef2('0x7b')][_0x506e97],{'code':_0x5ef2('0x89'),'message':_0x7f29a4[_0x5ef2('0x12')]()});}else{fs[_0x5ef2('0x8a')](_0x4ffe3e,_0x3454d3[_0x5ef2('0x12')]()+'\x0a');}_0x3454d3=[];}if(!(stats[_0x5ef2('0x8b')]%0xc8)){socket['emit'](_0x5ef2('0x8c')+_0x2a6f60,stats);stats[_0x5ef2('0x58')]=[];}}if(stopped){logger[_0x5ef2('0x54')](_0x5ef2('0x8d'));_0x38e45c['abort']();}}catch(_0x385e0f){handleError(_0x53ad2e['data'][_0x506e97],{'code':_0x5ef2('0x8e'),'message':_0x385e0f[_0x5ef2('0x57')]});logger[_0x5ef2('0x56')]('step',_0x385e0f[_0x5ef2('0x57')]);}},'complete':function(){try{var _0x484095=[];var _0x54b179=[];var _0x1d577d=_0x5ef2('0x3c');if(_0x58be4a['duplicates']&&_0x58be4a[_0x5ef2('0x8f')]['length']){_0x1d577d=_0x5ef2('0x90')+_0x2a6f60;_0x484095[_0x5ef2('0x18')](_0x5ef2('0x91')+_0x1d577d+_0x5ef2('0x92'));}tmp_campaigns=_0x5ef2('0x93')+_0x2a6f60;tmp_voice_queues='voice_queues_'+_0x2a6f60;_0x54b179['push'](_0x5ef2('0x91')+tmp_campaigns+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');_0x54b179[_0x5ef2('0x18')]('CREATE\x20TABLE\x20'+tmp_voice_queues+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');BPromise['each'](_0x54b179,handleTZQuery)[_0x5ef2('0x17')](function(_0x18806e){updateTzCampaigns(_0x58be4a['ListId'])['then'](function(_0x33c8c6){updateTzVoiceQueues(_0x58be4a[_0x5ef2('0x2e')])[_0x5ef2('0x17')](function(_0x3eb472){if(hasTZ)_0x1d2330=_0x1d2330[_0x5ef2('0x88')](_0x5ef2('0x63'),'dialTimezone,utcOffset');var _0x438f90=util[_0x5ef2('0xd')]('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',_0x4ffe3e,_0x1d577d,_0x1d2330,_0x58be4a['ListId'],_0x58be4a[_0x5ef2('0x4f')]||null,NOW,NOW);if(_[_0x5ef2('0x64')](_0x3b5863[_0x5ef2('0x2c')])){_0x438f90+=',\x20scheduledAt\x20=\x20NOW()';}_0x484095[_0x5ef2('0x18')](_0x438f90);if(_0x58be4a['duplicates']&&_0x58be4a[_0x5ef2('0x8f')][_0x5ef2('0x1a')]){_0x484095['push'](insertCmContact(_0x58be4a[_0x5ef2('0x2e')],_0x1d577d,_0x58be4a[_0x5ef2('0x8f')],_0x3b5863));_0x484095['push']('DROP\x20TABLE\x20'+_0x1d577d+';');}BPromise['each'](_0x484095,handleQuery)['then'](function(_0x40c38d){BPromise[_0x5ef2('0x1b')]([handleAdditionalPhones()])[_0x5ef2('0x17')](function(){_0x484095=[];for(var _0x2eb460=0x0;_0x2eb460\x20\x20');}var _0x41d4a5=path[_0x5ef2('0x12')](config['root'],_0x5ef2('0x70'),process['argv'][0x2]);if(!fs[_0x5ef2('0xa3')](_0x41d4a5)){throw new Error(_0x5ef2('0xa4'));}var _0x585768={};try{_0x585768=JSON[_0x5ef2('0x79')](process['argv'][0x3]);if(!_0x585768[_0x5ef2('0x6d')]){throw new Error(_0x5ef2('0xa5'));}if(!_0x585768[_0x5ef2('0x6d')][_0x5ef2('0x10')]){throw new Error(_0x5ef2('0xa6'));}if(!_0x585768[_0x5ef2('0x6d')][_0x5ef2('0xa7')]){throw new Error(_0x5ef2('0xa8'));}var _0x27ce48=0x0;if(_0x585768[_0x5ef2('0x6d')]['UserId']){_0x27ce48=0x1;}if(!_0x585768[_0x5ef2('0x2e')]){throw new Error(_0x5ef2('0xa9'));}}catch(_0x2347f9){throw new Error('body\x20id\x20mandatory');}var _0x13c8ba=[];try{_0x13c8ba=_[_0x5ef2('0xaa')](JSON[_0x5ef2('0x79')](process[_0x5ef2('0xa2')][0x4]),'id');}catch(_0x5adb23){logger[_0x5ef2('0x54')](_0x5ef2('0xab'));}main(_0x41d4a5,_0x585768,_0x13c8ba,_0x27ce48);}validate();process['on'](_0x5ef2('0xac'),handleStop);process['on'](_0x5ef2('0xad'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/import/cm/csvUpdates.js b/server/components/import/cm/csvUpdates.js index 9dcb65b..7f81b5c 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 _0x390a=['hasOwnProperty','trim','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','\x20not\x20specified','itemTypeId','SystemRow','appendFileSync','rows','emit','contact:import:','Abort\x20parser','SystemError','step','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;',',\x20scheduledAt\x20=\x20NOW()','each','contact','contactId','orderBy','DROP\x20TABLE\x20','finish','catch','complete','argv','arguments\x20\x20\x20','existsSync','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','SIGINT','uncaughtException','path','lodash','papaparse','util','moment','squel','ioredis','../../../mysqldb','../../../config/logger','import','redis','localhost','format','YYYY-MM-DD\x20HH:mm:ss','cm_contacts_temp_','YYYYMMDDHHmmss','select','phone','from','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','sequelize','select\x20*\x20from\x20','spread','isNil','AdditionalPhones','push','all','error','split','length','filter','CmContactHasItem','findOne','then','create','PHONE','CmContact','CmHopper','update','cm_contacts.scheduledat','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','insert','cm_hopper','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','UserId','fields','join','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.id\x20=\x20','.CmListId\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','toString','cm_contacts.phone','cm_contacts.id','into','cm_hopper_black','fromQuery','cm_contacts.createdAt\x20=\x20?','field','ListId\x20=\x20?','\x20=\x20?','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','CmHopperId','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','id\x20IN\x20?','group','Received\x20SIGINT','exit','errors','code','message','info','query','main','stringify','send','start','binding','socket_timestamp','root','server/files/tmp','.csv','body','ContactItemType','findAll','name','header','parse','createReadStream','data','find','_description'];(function(_0x326b2f,_0x298488){var _0x3ca13d=function(_0x476c07){while(--_0x476c07){_0x326b2f['push'](_0x326b2f['shift']());}};_0x3ca13d(++_0x298488);}(_0x390a,0xc9));var _0xa390=function(_0x148da0,_0x266d84){_0x148da0=_0x148da0-0x0;var _0x29d12f=_0x390a[_0x148da0];return _0x29d12f;};'use strict';var fs=require('fs');var path=require(_0xa390('0x0'));var _=require(_0xa390('0x1'));var Papa=require(_0xa390('0x2'));var util=require(_0xa390('0x3'));var BPromise=require('bluebird');var moment=require(_0xa390('0x4'));var squel=require(_0xa390('0x5'));var Redis=require(_0xa390('0x6'));var db=require(_0xa390('0x7'))['db'];var config=require('../../../config/environment');var logger=require(_0xa390('0x8'))(_0xa390('0x9'));config[_0xa390('0xa')]=_['defaults'](config[_0xa390('0xa')],{'host':_0xa390('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));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()[_0xa390('0xc')](_0xa390('0xd'));var tempTableName=_0xa390('0xe')+moment()[_0xa390('0xc')](_0xa390('0xf'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x5106eb){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'](_0x5106eb);}function selectNotIn(_0x735319,_0x34f0fe,_0x1ecd8b,_0x484b38,_0x41f9f2){return squel[_0xa390('0x10')]()['field'](_0xa390('0x11'))[_0xa390('0x12')](_0x484b38)['join'](_0x34f0fe,null,_0x34f0fe+'.id\x20=\x20'+_0x484b38+'.'+_0x1ecd8b)[_0xa390('0x13')](_0x484b38+'.'+_0x1ecd8b+_0xa390('0x14')+_0x735319+'.'+_0x1ecd8b)['where'](_0x34f0fe+_0xa390('0x15')+_0x41f9f2['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x554b6b,_0x4afb20){promisesAdditionalPhones=[];promisesContact=[];return db[_0xa390('0x16')]['query'](_0xa390('0x17')+tempTableName)[_0xa390('0x18')](function(_0x4d4d74){if(_0x4d4d74!==null){var _0x15204e=[];for(var _0x180429=0x0;_0x180429<_0x4d4d74['length'];_0x180429++){var _0x2f12b7=_0x4d4d74[_0x180429];if(!_['isNil'](_0x2f12b7[_0xa390('0x11')])){if(!_[_0xa390('0x19')](_0x2f12b7[_0xa390('0x1a')]))_0x15204e[_0xa390('0x1b')](insertAdditionalPhones(_0x2f12b7));promisesContact['push']({'contact':_0x2f12b7});}}}Promise[_0xa390('0x1c')](_0x15204e)['then'](function(){_0x554b6b({'val':0x1});});})['catch'](function(_0x4969c9){logger[_0xa390('0x1d')](_0x4969c9['message']);});});}function insertAdditionalPhones(_0x3815bd){return new Promise(function(_0xb10495,_0x5aa3d5){var _0x134ace=_0x3815bd[_0xa390('0x1a')];if(_['isNil'](_0x134ace))_0x5aa3d5({'val':0x0});else{var _0x5222bd=_0x134ace[_0xa390('0x1e')](';');var _0x374ea9=[];orderBy=0x0;for(var _0x130355=0x0;_0x130355<_0x5222bd['length'];_0x130355++){_0x374ea9['push'](splitAdditionalPhone(_0x3815bd['id'],_0x5222bd[_0x130355]));}Promise[_0xa390('0x1c')](_0x374ea9)['then'](function(){_0xb10495({'val':_0x5222bd[_0xa390('0x1f')]});});}});}function splitAdditionalPhone(_0x11a069,_0x2aeb9f){return new Promise(function(_0x5ea2de,_0x1abdc2){var _0x4541a6=_0x2aeb9f[_0xa390('0x1e')](':');var _0x576bf2=_0x4541a6[0x0];var _0x2684ef=_0x4541a6[0x1];if(_0x2684ef!==''){var _0x5a92bd=_0x2684ef[_0xa390('0x1e')]('|');var _0x506cac=[];for(var _0x22ec39=0x0;_0x22ec39<_0x5a92bd[_0xa390('0x1f')];_0x22ec39++){if(_0x5a92bd[_0x22ec39]!==''){var _0x7cfd06=_[_0xa390('0x20')](promisesAdditionalPhones,{'contactId':_0x11a069,'phone':_0x5a92bd[_0x22ec39]});if(_0x7cfd06[_0xa390('0x1f')]==0x0){orderBy++;promisesAdditionalPhones[_0xa390('0x1b')]({'contactId':_0x11a069,'contactTypeId':_0x576bf2,'phone':_0x5a92bd[_0x22ec39],'orderBy':orderBy});}}}_0x5ea2de({'ok':0x1});}else _0x5ea2de({'res':0x0});});}function createAdditionalPhone(_0x55e360,_0x58a01a,_0x36424a,_0x5022aa){var _0x45e70a='';var _0x45d572='';var _0x2c8350=_0x36424a[_0xa390('0x1e')]('§');_0x45e70a=_0x2c8350[0x0];if(_0x2c8350[_0xa390('0x1f')]==0x2)_0x45d572=_0x2c8350[0x1];return new Promise(function(_0x35e44e,_0x4d942f){return db[_0xa390('0x21')][_0xa390('0x22')]({'where':{'CmContactId':_0x55e360,'item':_0x45e70a}})['then'](function(_0x2b2448){if(_0x2b2448){return db[_0xa390('0x21')]['update']({'ItemTypeId':_0x58a01a,'description':_0x45d572,'OrderBy':_0x5022aa},{'where':{'CmContactId':_0x55e360,'item':_0x45e70a}})[_0xa390('0x23')](function(_0x3b890a){_0x35e44e({'res':'updated'});});}else{return db[_0xa390('0x21')][_0xa390('0x24')]({'CmContactId':_0x55e360,'item':_0x45e70a,'ItemTypeId':_0x58a01a,'description':_0x45d572,'OrderBy':_0x5022aa,'ItemClass':_0xa390('0x25')})[_0xa390('0x23')](function(_0x4caa89){_0x35e44e({'res':'inserted'});});}});});}function updateContact(_0x5ce271){return new Promise(function(_0x372f19,_0x48bd0c){var _0x48344b=_0x5ce271['id'];delete _0x5ce271['id'];return db[_0xa390('0x26')]['update'](_0x5ce271,{'where':{'id':_0x48344b}})[_0xa390('0x23')](function(_0x3f8d83){updatedRows+=0x1;return db[_0xa390('0x27')][_0xa390('0x28')]({'phone':_0x5ce271[_0xa390('0x11')]},{'where':{'ContactId':_0x48344b}})[_0xa390('0x23')](function(_0x385cfc){_0x372f19({'ret':'OK'});});});});}function insertCmHopper(_0x9ffa55,_0x231616,_0x32ba94,_0x209f82,_0x57e821){var _0x3000c1=['cm_contacts.phone',_0xa390('0x29'),'cm_contacts.id',_0xa390('0x2a'),_0x231616+'.'+_0x209f82,_0xa390('0x2b'),_0xa390('0x2c'),_0xa390('0x2d'),'cm_contacts.UserId','\x22'+_0x57e821+'\x22'];return squel[_0xa390('0x2e')]()['into'](_0xa390('0x2f'))['fromQuery']([_0xa390('0x11'),_0xa390('0x30'),_0xa390('0x31'),_0xa390('0x32'),_0x209f82,_0xa390('0x33'),_0xa390('0x34'),_0xa390('0x35'),_0xa390('0x36'),'recallme'],squel['select']()[_0xa390('0x37')](_0x3000c1)[_0xa390('0x12')](_0x231616)[_0xa390('0x38')](_0xa390('0x39'),null,_0xa390('0x3a')+_0x231616+_0xa390('0x3b'))['join'](_0x32ba94,null,_0x32ba94+_0xa390('0x3c')+_0x231616+'.'+_0x209f82)[_0xa390('0x13')](_0x231616+_0xa390('0x3d'),_0x9ffa55)[_0xa390('0x13')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0xa390('0x13')](_0xa390('0x3e'),selectNotIn(_0x231616,_0x32ba94,_0x209f82,'cm_hopper',['\x22always\x22','\x22onlyIfOpen\x22']))[_0xa390('0x13')](_0xa390('0x3e'),selectNotIn(_0x231616,_0x32ba94,_0x209f82,_0xa390('0x2f'),[_0xa390('0x3f')])))[_0xa390('0x40')]();}function insertCmHopperBlack(_0x42bf4e,_0x2df325,_0x2b4247,_0x2e772a){var _0x4f7103=[_0xa390('0x41'),_0xa390('0x42'),_0xa390('0x2a'),_0x2df325+'.'+_0x2e772a,_0xa390('0x2b'),_0xa390('0x2c')];return squel[_0xa390('0x2e')]()[_0xa390('0x43')](_0xa390('0x44'))[_0xa390('0x45')]([_0xa390('0x11'),_0xa390('0x31'),_0xa390('0x32'),_0x2e772a,_0xa390('0x33'),_0xa390('0x34')],squel[_0xa390('0x10')]()[_0xa390('0x37')](_0x4f7103)[_0xa390('0x12')](_0x2df325)[_0xa390('0x38')](_0xa390('0x39'),null,_0xa390('0x3a')+_0x2df325+_0xa390('0x3b'))['join'](_0x2b4247,null,_0x2b4247+_0xa390('0x3c')+_0x2df325+'.'+_0x2e772a)[_0xa390('0x13')](_0x2df325+_0xa390('0x3d'),_0x42bf4e)[_0xa390('0x13')](_0xa390('0x46'),NOW)[_0xa390('0x13')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0xa390('0x10')]()[_0xa390('0x47')](_0xa390('0x11'))['from'](_0xa390('0x44'))[_0xa390('0x13')](_0xa390('0x48'),_0x42bf4e)['where'](_0x2e772a+_0xa390('0x49'),_0x2df325+'.'+_0x2e772a)))[_0xa390('0x40')]();}function insertCmHopperAdditionalPhones(_0x17764f){var _0x108948=[_0xa390('0x4a'),_0xa390('0x4b'),_0xa390('0x4c'),_0xa390('0x4d'),_0xa390('0x4e')];return squel[_0xa390('0x2e')]()[_0xa390('0x43')](_0xa390('0x4f'))[_0xa390('0x45')]([_0xa390('0x50'),'phone','OrderBy',_0xa390('0x33'),_0xa390('0x34')],squel['select']()[_0xa390('0x37')](_0x108948)[_0xa390('0x12')](_0xa390('0x2f'))[_0xa390('0x38')](_0xa390('0x39'),null,_0xa390('0x51'))[_0xa390('0x38')](_0xa390('0x52'),null,_0xa390('0x53'))['where'](_0xa390('0x54'),_0x17764f)[_0xa390('0x13')]('cm_contacts.createdAt\x20=\x20?',NOW))['toString']();}function insertCmContact(_0x398b01,_0x119d25,_0x1ca22c,_0x54ef97){var _0x55abc7=_[_0xa390('0x55')](_[_0xa390('0x56')](_0x54ef97),[_0xa390('0x32'),_0xa390('0x57'),_0xa390('0x33'),'updatedAt']);return squel[_0xa390('0x2e')]()[_0xa390('0x43')](_0xa390('0x39'))[_0xa390('0x45')](_0x55abc7,squel[_0xa390('0x10')]()[_0xa390('0x37')](_0x55abc7)[_0xa390('0x12')](_0x119d25)[_0xa390('0x13')]('('+_0x1ca22c[_0xa390('0x38')](',')+_0xa390('0x58'),squel['select']()[_0xa390('0x37')](_0x1ca22c)[_0xa390('0x12')](_0xa390('0x39'))[_0xa390('0x13')](_0xa390('0x48'),_0x398b01))[_0xa390('0x13')](_0xa390('0x59'),squel[_0xa390('0x10')]()[_0xa390('0x47')]('MIN(id)','min_id')[_0xa390('0x12')](_0x119d25)[_0xa390('0x5a')](_0x1ca22c['join'](','))))[_0xa390('0x40')]();}function handleStop(){logger['info'](_0xa390('0x5b'));stopped=!![];}function handleUncaughtException(_0x9eb2de){logger[_0xa390('0x1d')](_0x9eb2de['message']);process[_0xa390('0x5c')](0x1);}function handleError(_0x1d40b4,_0x53444a){stats[_0xa390('0x5d')][_0xa390('0x1b')]({'name':_0x53444a[_0xa390('0x5e')],'message':_0x53444a[_0xa390('0x5f')],'row':_0x1d40b4});}function handleQuery(_0x5df752){logger[_0xa390('0x60')](_0x5df752);return db[_0xa390('0x16')][_0xa390('0x61')](_0x5df752)[_0xa390('0x18')](function(_0x6a4449){results[_0xa390('0x1b')](_0x6a4449);})['catch'](function(_0x25d7b2){logger[_0xa390('0x1d')](_0x25d7b2[_0xa390('0x5f')]);});}function main(_0x2f07da,_0x227d84,_0x428537,_0x505fee){logger[_0xa390('0x60')](_0xa390('0x62'),_0x2f07da,JSON[_0xa390('0x63')](_0x227d84));process[_0xa390('0x64')](_0xa390('0x65'));var _0x882578=_0x227d84[_0xa390('0x66')];var _0x425f72=_['clone'](_0x882578);var _0x24a367=_0x227d84[_0xa390('0x67')];var _0x4bf374=path[_0xa390('0x38')](config[_0xa390('0x68')],_0xa390('0x69'),_0x24a367+_0xa390('0x6a'));logger[_0xa390('0x60')](_0xa390('0x6b'),_0x227d84);db[_0xa390('0x6c')][_0xa390('0x6d')]({'raw':!![],'attributes':['id','name']})['then'](function(_0xa2a560){for(var _0x31a0b5=0x0;_0x31a0b5<_0xa2a560[_0xa390('0x1f')];_0x31a0b5++){if(_0xa2a560[_0x31a0b5][_0xa390('0x6e')]in _0x882578){contactItemTypes['push'](_0xa2a560[_0x31a0b5]);delete _0x425f72[_0xa2a560[_0x31a0b5][_0xa390('0x6e')]];hasAdditionalPhones=!![];}for(var _0x27c0c0 in _0x882578){if(_0xa2a560[_0x31a0b5]['name']+'_description'===_0x27c0c0){phoneDescriptions[_0xa390('0x1b')]({'itemTypeId':_0xa2a560[_0x31a0b5]['id'],'description':_0x27c0c0});delete _0x425f72[_0x27c0c0];}}}if(hasAdditionalPhones)_0x425f72[_0xa390('0x1a')]='';var _0x3d508c=_[_0xa390('0x56')](_0x425f72)['join']();logger[_0xa390('0x60')](_0xa390('0x6f'),_0x3d508c);fs['writeFileSync'](_0x4bf374,_0x3d508c+'\x0a');Papa[_0xa390('0x70')](fs[_0xa390('0x71')](_0x2f07da),{'header':!![],'skipEmptyLines':!![],'step':function(_0x509712,_0x132b75){try{for(var _0x2c7d66=0x0,_0x33de25=[];_0x2c7d66<_0x509712['data'][_0xa390('0x1f')];_0x2c7d66++){stats['rows']+=0x1;if(_0x509712['errors'][_0x2c7d66]){handleError(_0x509712[_0xa390('0x72')][_0x2c7d66],_0x509712[_0xa390('0x5d')][_0x2c7d66]);}else{var _0x42bd71=[];var _0xc8a762=[];var _0x2f3a21={};for(var _0x16587a in _0x882578){let _0x513ee0=contactItemTypes['find'](_0x5dfacc=>_0x5dfacc[_0xa390('0x6e')]===_0x16587a);let _0x45dc4e=contactItemTypes[_0xa390('0x73')](_0x156b33=>_0x156b33['name']+_0xa390('0x74')===_0x16587a);if(_[_0xa390('0x19')](_0x513ee0)&&_[_0xa390('0x19')](_0x45dc4e)){if(_0x882578[_0xa390('0x75')](_0x16587a)){if(_0x509712[_0xa390('0x72')][_0x2c7d66][_0x882578[_0x16587a]]){var _0x4a4442=_[_0xa390('0x76')](_0x509712['data'][_0x2c7d66][_0x882578[_0x16587a]][_0xa390('0x77')](/"/g,'\x27'));switch(_0x16587a){case'scheduledat':var _0x2ef3ca=moment(_0x4a4442,_0xa390('0xd'),!![]);if(_0x2ef3ca[_0xa390('0x78')]()){_0x33de25[_0xa390('0x1b')]('\x22'+_0x4a4442+'\x22');}else{_0x42bd71['push'](_0xa390('0x79'));}break;case _0xa390('0x35'):var _0x563af5=parseInt(_0x4a4442);_0x4a4442=_[_0xa390('0x7a')](_0x563af5)||_0x563af5<0x0||_0x563af5>0x4?_0x505fee?0x3:0x2:_0x563af5;_0x33de25[_0xa390('0x1b')]('\x22'+_0x4a4442+'\x22');break;case'UserId':var _0x3d644f=parseInt(_0x4a4442);if(_[_0xa390('0x7b')](_0x3d644f)&&_[_0xa390('0x7c')](_0x428537,_0x3d644f)){_0x33de25[_0xa390('0x1b')]('\x22'+_0x3d644f+'\x22');}else{_0x42bd71[_0xa390('0x1b')](_0xa390('0x7d'));}break;case _0xa390('0x7e'):if(isEmail(_0x4a4442)){_0x33de25[_0xa390('0x1b')]('\x22'+_0x4a4442+'\x22');}else{_0x42bd71[_0xa390('0x1b')](_0xa390('0x7f'));}break;case _0xa390('0x80'):var _0x31d4bf=moment(_0x4a4442,'YYYY-MM-DD',!![]);if(_0x31d4bf[_0xa390('0x78')]()){_0x33de25[_0xa390('0x1b')]('\x22'+_0x4a4442+'\x22');}else{_0x42bd71[_0xa390('0x1b')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x33de25[_0xa390('0x1b')]('\x22'+_0x4a4442+'\x22');}}else{switch(_0x16587a){case'firstName':case _0xa390('0x11'):_0x42bd71['push'](_0x16587a+_0xa390('0x81'));break;default:_0x33de25[_0xa390('0x1b')]('\x22\x22');}}}}else{var _0x13df2a='';if(!_[_0xa390('0x19')](_0x513ee0)){if(!_0x2f3a21[_0xa390('0x75')](_0x513ee0['id'])){for(var _0x16bfc3=0x0;_0x16bfc3<_0x882578[_0x16587a][_0xa390('0x1f')];_0x16bfc3++){var _0x4a4442=_['trim'](_0x509712['data'][_0x2c7d66][_0x882578[_0x16587a][_0x16bfc3]]['replace'](/"/g,'\x27'));var _0x597e40=phoneDescriptions[_0xa390('0x73')](_0x50b1cc=>_0x50b1cc[_0xa390('0x82')]===_0x513ee0['id']);if(!_[_0xa390('0x19')](_0x597e40)){var _0x1ae9d7=_[_0xa390('0x76')](_0x509712[_0xa390('0x72')][_0x2c7d66][_0x882578[_0x597e40['description']][0x0]][_0xa390('0x77')](/"/g,'\x27'));if(!_[_0xa390('0x19')](_0x1ae9d7))_0x4a4442=_0x4a4442+'§'+_0x1ae9d7;}if(_0x13df2a=='')_0x13df2a=_0x4a4442;else _0x13df2a+='|'+_0x4a4442;}_0xc8a762[_0xa390('0x1b')](_0x513ee0['id']+':'+_0x13df2a);_0x2f3a21[_0x513ee0['id']]=0x1;}}}}if(hasAdditionalPhones){_0x33de25[_0xa390('0x1b')]('\x22'+_0xc8a762[_0xa390('0x38')](';')+'\x22');}if(_0x42bd71['length']){handleError(_0x509712[_0xa390('0x72')][_0x2c7d66],{'code':_0xa390('0x83'),'message':_0x42bd71[_0xa390('0x38')]()});}else{fs[_0xa390('0x84')](_0x4bf374,_0x33de25[_0xa390('0x38')]()+'\x0a');}_0x33de25=[];}if(!(stats[_0xa390('0x85')]%0xc8)){socket[_0xa390('0x86')](_0xa390('0x87')+_0x24a367,stats);stats[_0xa390('0x5d')]=[];}}if(stopped){logger['info'](_0xa390('0x88'));_0x132b75['abort']();}}catch(_0x2a8f7c){handleError(_0x509712['data'][_0x2c7d66],{'code':_0xa390('0x89'),'message':_0x2a8f7c['message']});logger[_0xa390('0x1d')](_0xa390('0x8a'),_0x2a8f7c[_0xa390('0x5f')]);}},'complete':function(){try{var _0x1fcaf6=[];var _0x41a032=tempTableName;_0x1fcaf6[_0xa390('0x1b')](_0xa390('0x8b')+_0x41a032+_0xa390('0x8c'));logger[_0xa390('0x60')]('CIS\x20len',contactItemTypes['length']);var _0x5bbb7a=util['format']('LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',_0x4bf374,_0x41a032,_0x3d508c,_0x227d84['ListId'],_0x227d84[_0xa390('0x57')]||null,NOW,NOW);if(_[_0xa390('0x19')](_0x882578[_0xa390('0x30')])){_0x5bbb7a+=_0xa390('0x8d');}_0x1fcaf6[_0xa390('0x1b')](_0x5bbb7a);BPromise[_0xa390('0x8e')](_0x1fcaf6,handleQuery)[_0xa390('0x23')](function(_0x2e4177){BPromise['all']([handleAdditionalPhones()])['then'](function(){_0x1fcaf6=[];for(var _0x527b3c=0x0;_0x527b3c\x20\x20','root','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','No\x20agent\x20available','uncaughtException','util','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','import','defaults','redis','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','cm_contacts_temp_','YYYYMMDDHHmmss','test','field','from','join','.id\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','sequelize','query','select\x20*\x20from\x20','spread','length','isNil','phone','AdditionalPhones','push','all','then','catch','error','message','split','findOne','CmContactHasItem','updated','PHONE','CmContact'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x117c,0x71));var _0xc117=function(_0x1ec3fe,_0x2bbc3d){_0x1ec3fe=_0x1ec3fe-0x0;var _0x23d25b=_0x117c[_0x1ec3fe];return _0x23d25b;};'use strict';var fs=require('fs');var path=require('path');var _=require('lodash');var Papa=require('papaparse');var util=require(_0xc117('0x0'));var BPromise=require('bluebird');var moment=require('moment');var squel=require(_0xc117('0x1'));var Redis=require(_0xc117('0x2'));var db=require(_0xc117('0x3'))['db'];var config=require(_0xc117('0x4'));var logger=require(_0xc117('0x5'))(_0xc117('0x6'));config['redis']=_[_0xc117('0x7')](config[_0xc117('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0xc117('0x9'))(new Redis(config['redis']));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()[_0xc117('0xa')](_0xc117('0xb'));var tempTableName=_0xc117('0xc')+moment()[_0xc117('0xa')](_0xc117('0xd'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x4a1e04){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))*$/[_0xc117('0xe')](_0x4a1e04);}function selectNotIn(_0x574c99,_0x44d812,_0x597df9,_0x41b20e,_0x25d4ff){return squel['select']()[_0xc117('0xf')]('phone')[_0xc117('0x10')](_0x41b20e)[_0xc117('0x11')](_0x44d812,null,_0x44d812+_0xc117('0x12')+_0x41b20e+'.'+_0x597df9)[_0xc117('0x13')](_0x41b20e+'.'+_0x597df9+'\x20=\x20'+_0x574c99+'.'+_0x597df9)[_0xc117('0x13')](_0x44d812+_0xc117('0x14')+_0x25d4ff[_0xc117('0x11')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x9dec18,_0x534955){promisesAdditionalPhones=[];promisesContact=[];return db[_0xc117('0x15')][_0xc117('0x16')](_0xc117('0x17')+tempTableName)[_0xc117('0x18')](function(_0x58bce8){if(_0x58bce8!==null){var _0x5350e9=[];for(var _0x1dfaa6=0x0;_0x1dfaa6<_0x58bce8[_0xc117('0x19')];_0x1dfaa6++){var _0x3eaf68=_0x58bce8[_0x1dfaa6];if(!_[_0xc117('0x1a')](_0x3eaf68[_0xc117('0x1b')])){if(!_[_0xc117('0x1a')](_0x3eaf68[_0xc117('0x1c')]))_0x5350e9[_0xc117('0x1d')](insertAdditionalPhones(_0x3eaf68));promisesContact[_0xc117('0x1d')]({'contact':_0x3eaf68});}}}Promise[_0xc117('0x1e')](_0x5350e9)[_0xc117('0x1f')](function(){_0x9dec18({'val':0x1});});})[_0xc117('0x20')](function(_0x547deb){logger[_0xc117('0x21')](_0x547deb[_0xc117('0x22')]);});});}function insertAdditionalPhones(_0xf5307f){return new Promise(function(_0x1a5ba0,_0x3946cb){var _0x37d9de=_0xf5307f[_0xc117('0x1c')];if(_['isNil'](_0x37d9de))_0x3946cb({'val':0x0});else{var _0x4f7594=_0x37d9de[_0xc117('0x23')](';');var _0x24bb40=[];orderBy=0x0;for(var _0x1492d0=0x0;_0x1492d0<_0x4f7594[_0xc117('0x19')];_0x1492d0++){_0x24bb40[_0xc117('0x1d')](splitAdditionalPhone(_0xf5307f['id'],_0x4f7594[_0x1492d0]));}Promise[_0xc117('0x1e')](_0x24bb40)['then'](function(){_0x1a5ba0({'val':_0x4f7594['length']});});}});}function splitAdditionalPhone(_0x3d670e,_0x481e10){return new Promise(function(_0xa0ee6b,_0x7545d){var _0x216370=_0x481e10['split'](':');var _0x3d71f8=_0x216370[0x0];var _0xfefce5=_0x216370[0x1];if(_0xfefce5!==''){var _0x41e376=_0xfefce5[_0xc117('0x23')]('|');var _0x2cc134=[];for(var _0x28575b=0x0;_0x28575b<_0x41e376['length'];_0x28575b++){if(_0x41e376[_0x28575b]!==''){var _0x334041=_['filter'](promisesAdditionalPhones,{'contactId':_0x3d670e,'phone':_0x41e376[_0x28575b]});if(_0x334041['length']==0x0){orderBy++;promisesAdditionalPhones[_0xc117('0x1d')]({'contactId':_0x3d670e,'contactTypeId':_0x3d71f8,'phone':_0x41e376[_0x28575b],'orderBy':orderBy});}}}_0xa0ee6b({'ok':0x1});}else _0xa0ee6b({'res':0x0});});}function createAdditionalPhone(_0x35efea,_0x280c72,_0x52c152,_0x211fb1){var _0x5db129='';var _0x4a2a10='';var _0x459b8a=_0x52c152[_0xc117('0x23')]('§');_0x5db129=_0x459b8a[0x0];if(_0x459b8a[_0xc117('0x19')]==0x2)_0x4a2a10=_0x459b8a[0x1];return new Promise(function(_0x4e8630,_0x416074){return db['CmContactHasItem'][_0xc117('0x24')]({'where':{'CmContactId':_0x35efea,'item':_0x5db129}})[_0xc117('0x1f')](function(_0x21eb0f){if(_0x21eb0f){return db[_0xc117('0x25')]['update']({'ItemTypeId':_0x280c72,'description':_0x4a2a10,'OrderBy':_0x211fb1},{'where':{'CmContactId':_0x35efea,'item':_0x5db129}})[_0xc117('0x1f')](function(_0x3aaf53){_0x4e8630({'res':_0xc117('0x26')});});}else{return db[_0xc117('0x25')]['create']({'CmContactId':_0x35efea,'item':_0x5db129,'ItemTypeId':_0x280c72,'description':_0x4a2a10,'OrderBy':_0x211fb1,'ItemClass':_0xc117('0x27')})['then'](function(_0x29ab11){_0x4e8630({'res':'inserted'});});}});});}function updateContact(_0x3e8ce7){return new Promise(function(_0x5a00ae,_0x450583){var _0x5ae0d6=_0x3e8ce7['id'];delete _0x3e8ce7['id'];return db[_0xc117('0x28')][_0xc117('0x29')](_0x3e8ce7,{'where':{'id':_0x5ae0d6}})[_0xc117('0x1f')](function(_0x4ede76){updatedRows+=0x1;return db[_0xc117('0x2a')][_0xc117('0x29')]({'phone':_0x3e8ce7[_0xc117('0x1b')]},{'where':{'ContactId':_0x5ae0d6}})[_0xc117('0x1f')](function(_0x44942a){_0x5a00ae({'ret':'OK'});});});});}function insertCmHopper(_0x31e654,_0x36cd65,_0x3302b9,_0x4c0135,_0x1222d6){var _0x15858e=[_0xc117('0x2b'),'cm_contacts.scheduledat',_0xc117('0x2c'),_0xc117('0x2d'),_0x36cd65+'.'+_0x4c0135,_0xc117('0x2e'),_0xc117('0x2f'),_0xc117('0x30'),_0xc117('0x31'),'\x22'+_0x1222d6+'\x22'];return squel[_0xc117('0x32')]()['into'](_0xc117('0x33'))[_0xc117('0x34')](['phone',_0xc117('0x35'),_0xc117('0x36'),_0xc117('0x37'),_0x4c0135,'createdAt','updatedAt','priority',_0xc117('0x38'),'recallme'],squel[_0xc117('0x39')]()[_0xc117('0x3a')](_0x15858e)[_0xc117('0x10')](_0x36cd65)[_0xc117('0x11')](_0xc117('0x3b'),null,_0xc117('0x3c')+_0x36cd65+'.CmListId')[_0xc117('0x11')](_0x3302b9,null,_0x3302b9+_0xc117('0x12')+_0x36cd65+'.'+_0x4c0135)['where'](_0x36cd65+_0xc117('0x3d'),_0x31e654)['where'](_0xc117('0x3e'),NOW)[_0xc117('0x13')](_0xc117('0x3f'),selectNotIn(_0x36cd65,_0x3302b9,_0x4c0135,'cm_hopper',[_0xc117('0x40'),_0xc117('0x41')]))[_0xc117('0x13')](_0xc117('0x3f'),selectNotIn(_0x36cd65,_0x3302b9,_0x4c0135,'cm_hopper',[_0xc117('0x40')])))[_0xc117('0x42')]();}function insertCmHopperBlack(_0x4e6c89,_0x2880b8,_0x2066cf,_0x5128ef){var _0x180af9=['cm_contacts.phone',_0xc117('0x2c'),_0xc117('0x2d'),_0x2880b8+'.'+_0x5128ef,_0xc117('0x2e'),_0xc117('0x2f')];return squel['insert']()['into']('cm_hopper_black')[_0xc117('0x34')]([_0xc117('0x1b'),'ContactId','ListId',_0x5128ef,'createdAt',_0xc117('0x43')],squel[_0xc117('0x39')]()[_0xc117('0x3a')](_0x180af9)[_0xc117('0x10')](_0x2880b8)[_0xc117('0x11')](_0xc117('0x3b'),null,'cm_contacts.ListId\x20=\x20'+_0x2880b8+'.CmListId')[_0xc117('0x11')](_0x2066cf,null,_0x2066cf+_0xc117('0x12')+_0x2880b8+'.'+_0x5128ef)['where'](_0x2880b8+'.CmListId\x20=\x20?',_0x4e6c89)[_0xc117('0x13')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0xc117('0x13')](_0xc117('0x3f'),squel[_0xc117('0x39')]()[_0xc117('0xf')]('phone')[_0xc117('0x10')](_0xc117('0x44'))['where'](_0xc117('0x45'),_0x4e6c89)[_0xc117('0x13')](_0x5128ef+'\x20=\x20?',_0x2880b8+'.'+_0x5128ef)))['toString']();}function insertCmHopperAdditionalPhones(_0x4bb482){var _0x21d80e=[_0xc117('0x46'),_0xc117('0x47'),_0xc117('0x48'),_0xc117('0x49'),_0xc117('0x4a')];return squel['insert']()['into'](_0xc117('0x4b'))[_0xc117('0x34')]([_0xc117('0x4c'),_0xc117('0x1b'),_0xc117('0x4d'),_0xc117('0x4e'),'updatedAt'],squel[_0xc117('0x39')]()[_0xc117('0x3a')](_0x21d80e)[_0xc117('0x10')](_0xc117('0x33'))[_0xc117('0x11')](_0xc117('0x3b'),null,_0xc117('0x4f'))[_0xc117('0x11')](_0xc117('0x50'),null,_0xc117('0x51'))['where'](_0xc117('0x52'),_0x4bb482)['where'](_0xc117('0x3e'),NOW))['toString']();}function insertCmContact(_0x3e6ae5,_0x42b55b,_0x932653,_0xdca56a){var _0x3374fe=_['concat'](_[_0xc117('0x53')](_0xdca56a),[_0xc117('0x37'),'CompanyId',_0xc117('0x4e'),_0xc117('0x43')]);return squel['insert']()[_0xc117('0x54')]('cm_contacts')[_0xc117('0x34')](_0x3374fe,squel['select']()[_0xc117('0x3a')](_0x3374fe)['from'](_0x42b55b)[_0xc117('0x13')]('('+_0x932653[_0xc117('0x11')](',')+_0xc117('0x55'),squel[_0xc117('0x39')]()[_0xc117('0x3a')](_0x932653)[_0xc117('0x10')]('cm_contacts')['where'](_0xc117('0x45'),_0x3e6ae5))['where'](_0xc117('0x56'),squel[_0xc117('0x39')]()[_0xc117('0xf')]('MIN(id)',_0xc117('0x57'))[_0xc117('0x10')](_0x42b55b)['group'](_0x932653[_0xc117('0x11')](','))))[_0xc117('0x42')]();}function handleStop(){logger[_0xc117('0x58')](_0xc117('0x59'));stopped=!![];}function handleUncaughtException(_0x14529d){logger[_0xc117('0x21')](_0x14529d[_0xc117('0x22')]);process[_0xc117('0x5a')](0x1);}function handleError(_0x23c4b0,_0x26a8f5){stats[_0xc117('0x5b')][_0xc117('0x1d')]({'name':_0x26a8f5[_0xc117('0x5c')],'message':_0x26a8f5['message'],'row':_0x23c4b0});}function handleQuery(_0x56706a){logger[_0xc117('0x58')](_0x56706a);return db[_0xc117('0x15')]['query'](_0x56706a)[_0xc117('0x18')](function(_0x45d86e){results[_0xc117('0x1d')](_0x45d86e);})[_0xc117('0x20')](function(_0x21d5ac){logger[_0xc117('0x21')](_0x21d5ac[_0xc117('0x22')]);});}function main(_0x33587a,_0xf040d1,_0x7f7504,_0x25ff8c){logger['info'](_0xc117('0x5d'),_0x33587a,JSON[_0xc117('0x5e')](_0xf040d1));process[_0xc117('0x5f')](_0xc117('0x60'));var _0x31f81e=_0xf040d1[_0xc117('0x61')];var _0x28901b=_[_0xc117('0x62')](_0x31f81e);var _0x1a010e=_0xf040d1[_0xc117('0x63')];var _0x59df9f=path[_0xc117('0x11')](config['root'],_0xc117('0x64'),_0x1a010e+_0xc117('0x65'));logger[_0xc117('0x58')](_0xc117('0x66'),_0xf040d1);db[_0xc117('0x67')][_0xc117('0x68')]({'raw':!![],'attributes':['id','name']})[_0xc117('0x1f')](function(_0x45ea48){for(var _0xea89d2=0x0;_0xea89d2<_0x45ea48[_0xc117('0x19')];_0xea89d2++){if(_0x45ea48[_0xea89d2][_0xc117('0x69')]in _0x31f81e){contactItemTypes[_0xc117('0x1d')](_0x45ea48[_0xea89d2]);delete _0x28901b[_0x45ea48[_0xea89d2][_0xc117('0x69')]];hasAdditionalPhones=!![];}for(var _0xcdc443 in _0x31f81e){if(_0x45ea48[_0xea89d2][_0xc117('0x69')]+_0xc117('0x6a')===_0xcdc443){phoneDescriptions[_0xc117('0x1d')]({'itemTypeId':_0x45ea48[_0xea89d2]['id'],'description':_0xcdc443});delete _0x28901b[_0xcdc443];}}}if(hasAdditionalPhones)_0x28901b['AdditionalPhones']='';var _0x2aebbd=_[_0xc117('0x53')](_0x28901b)['join']();logger[_0xc117('0x58')]('header',_0x2aebbd);fs['writeFileSync'](_0x59df9f,_0x2aebbd+'\x0a');Papa[_0xc117('0x6b')](fs[_0xc117('0x6c')](_0x33587a),{'header':!![],'skipEmptyLines':!![],'step':function(_0x3b45ba,_0x5e92ec){try{for(var _0x5300a0=0x0,_0x2b5061=[];_0x5300a0<_0x3b45ba[_0xc117('0x6d')]['length'];_0x5300a0++){stats[_0xc117('0x6e')]+=0x1;if(_0x3b45ba[_0xc117('0x5b')][_0x5300a0]){handleError(_0x3b45ba[_0xc117('0x6d')][_0x5300a0],_0x3b45ba['errors'][_0x5300a0]);}else{var _0x1bfc80=[];var _0x54100c=[];var _0x3a6327={};for(var _0x549690 in _0x31f81e){let _0x488f16=contactItemTypes[_0xc117('0x6f')](_0x120df9=>_0x120df9[_0xc117('0x69')]===_0x549690);let _0x24f523=contactItemTypes[_0xc117('0x6f')](_0x29e084=>_0x29e084[_0xc117('0x69')]+_0xc117('0x6a')===_0x549690);if(_[_0xc117('0x1a')](_0x488f16)&&_[_0xc117('0x1a')](_0x24f523)){if(_0x31f81e[_0xc117('0x70')](_0x549690)){if(_0x3b45ba[_0xc117('0x6d')][_0x5300a0][_0x31f81e[_0x549690]]){var _0x1466b9=_[_0xc117('0x71')](_0x3b45ba[_0xc117('0x6d')][_0x5300a0][_0x31f81e[_0x549690]][_0xc117('0x72')](/"/g,'\x27'));switch(_0x549690){case _0xc117('0x35'):var _0x1514b2=moment(_0x1466b9,_0xc117('0xb'),!![]);if(_0x1514b2[_0xc117('0x73')]()){_0x2b5061['push']('\x22'+_0x1466b9+'\x22');}else{_0x1bfc80[_0xc117('0x1d')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0xc117('0x74'):var _0x3aa02f=parseInt(_0x1466b9);_0x1466b9=_[_0xc117('0x75')](_0x3aa02f)||_0x3aa02f<0x0||_0x3aa02f>0x4?_0x25ff8c?0x3:0x2:_0x3aa02f;_0x2b5061[_0xc117('0x1d')]('\x22'+_0x1466b9+'\x22');break;case _0xc117('0x38'):var _0x2f7ac7=parseInt(_0x1466b9);if(_[_0xc117('0x76')](_0x2f7ac7)&&_[_0xc117('0x77')](_0x7f7504,_0x2f7ac7)){_0x2b5061['push']('\x22'+_0x2f7ac7+'\x22');}else{_0x1bfc80[_0xc117('0x1d')](_0xc117('0x78'));}break;case'email':if(isEmail(_0x1466b9)){_0x2b5061[_0xc117('0x1d')]('\x22'+_0x1466b9+'\x22');}else{_0x1bfc80['push'](_0xc117('0x79'));}break;case _0xc117('0x7a'):var _0x16f04e=moment(_0x1466b9,'YYYY-MM-DD',!![]);if(_0x16f04e['isValid']()){_0x2b5061[_0xc117('0x1d')]('\x22'+_0x1466b9+'\x22');}else{_0x1bfc80[_0xc117('0x1d')](_0xc117('0x7b'));}break;default:_0x2b5061['push']('\x22'+_0x1466b9+'\x22');}}else{switch(_0x549690){case _0xc117('0x7c'):case _0xc117('0x1b'):_0x1bfc80[_0xc117('0x1d')](_0x549690+'\x20not\x20specified');break;default:_0x2b5061['push']('\x22\x22');}}}}else{var _0x5edc3f='';if(!_[_0xc117('0x1a')](_0x488f16)){if(!_0x3a6327[_0xc117('0x70')](_0x488f16['id'])){for(var _0x278195=0x0;_0x278195<_0x31f81e[_0x549690][_0xc117('0x19')];_0x278195++){var _0x1466b9=_[_0xc117('0x71')](_0x3b45ba[_0xc117('0x6d')][_0x5300a0][_0x31f81e[_0x549690][_0x278195]][_0xc117('0x72')](/"/g,'\x27'));var _0x872ecb=phoneDescriptions['find'](_0x3b0d94=>_0x3b0d94[_0xc117('0x7d')]===_0x488f16['id']);if(!_[_0xc117('0x1a')](_0x872ecb)){var _0x406f9f=_[_0xc117('0x71')](_0x3b45ba['data'][_0x5300a0][_0x31f81e[_0x872ecb[_0xc117('0x7e')]][0x0]][_0xc117('0x72')](/"/g,'\x27'));if(!_[_0xc117('0x1a')](_0x406f9f))_0x1466b9=_0x1466b9+'§'+_0x406f9f;}if(_0x5edc3f=='')_0x5edc3f=_0x1466b9;else _0x5edc3f+='|'+_0x1466b9;}_0x54100c['push'](_0x488f16['id']+':'+_0x5edc3f);_0x3a6327[_0x488f16['id']]=0x1;}}}}if(hasAdditionalPhones){_0x2b5061[_0xc117('0x1d')]('\x22'+_0x54100c[_0xc117('0x11')](';')+'\x22');}if(_0x1bfc80[_0xc117('0x19')]){handleError(_0x3b45ba['data'][_0x5300a0],{'code':'SystemRow','message':_0x1bfc80[_0xc117('0x11')]()});}else{fs[_0xc117('0x7f')](_0x59df9f,_0x2b5061['join']()+'\x0a');}_0x2b5061=[];}if(!(stats['rows']%0xc8)){socket['emit']('contact:import:'+_0x1a010e,stats);stats[_0xc117('0x5b')]=[];}}if(stopped){logger[_0xc117('0x58')](_0xc117('0x80'));_0x5e92ec['abort']();}}catch(_0x39d014){handleError(_0x3b45ba['data'][_0x5300a0],{'code':'SystemError','message':_0x39d014['message']});logger['error'](_0xc117('0x81'),_0x39d014[_0xc117('0x22')]);}},'complete':function(){try{var _0x9f271a=[];var _0x504f5c=tempTableName;_0x9f271a[_0xc117('0x1d')]('CREATE\x20TABLE\x20'+_0x504f5c+_0xc117('0x82'));logger['info'](_0xc117('0x83'),contactItemTypes[_0xc117('0x19')]);var _0x4bd6fa=util[_0xc117('0xa')](_0xc117('0x84'),_0x59df9f,_0x504f5c,_0x2aebbd,_0xf040d1['ListId'],_0xf040d1[_0xc117('0x85')]||null,NOW,NOW);if(_[_0xc117('0x1a')](_0x31f81e[_0xc117('0x35')])){_0x4bd6fa+=_0xc117('0x86');}_0x9f271a[_0xc117('0x1d')](_0x4bd6fa);BPromise[_0xc117('0x87')](_0x9f271a,handleQuery)[_0xc117('0x1f')](function(_0x284a87){BPromise[_0xc117('0x1e')]([handleAdditionalPhones()])['then'](function(){_0x9f271a=[];for(var _0x4a7a81=0x0;_0x4a7a81\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.id','i.createdAt','i.updatedAt','i.closedAt','i.attach','i.lastMsgAt','i.lastMsgDirection','i.substatus','i.ContactId','i.MailAccountId','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','i.*','c.lastName','Contact.lastName','c.email','Contact.phone','c.mobile','c.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset','Setting','enableEmailPreview'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0xe1a7,0x1eb));var _0x7e1a=function(_0x23a9c4,_0x287dbf){_0x23a9c4=_0x23a9c4-0x0;var _0x54edc1=_0xe1a7[_0x23a9c4];return _0x54edc1;};'use strict';var _=require('lodash');var squel=require(_0x7e1a('0x0'));var as=require(_0x7e1a('0x1'));var qs=require(_0x7e1a('0x2'));var updateInteraction=require('./update-interaction')[_0x7e1a('0x3')];var utils=require('./utils');var db=require(_0x7e1a('0x4'))['db'];function skipInteractionsQuery(_0x1aa39b,_0x3f53a8,_0x36a967){var _0x29e99d=![];var _0x4ef679=utils[_0x7e1a('0x5')](_0x1aa39b);if(_0x3f53a8[_0x7e1a('0x6')]===_0x7e1a('0x7')&&!_0x36a967[_0x7e1a('0x8')]&&!_0x36a967[_0x4ef679]){_0x29e99d=!![];}return _0x29e99d;}function getTagsQuery(){return squel[_0x7e1a('0x9')]()[_0x7e1a('0xa')]('id')[_0x7e1a('0xa')](_0x7e1a('0xb'))[_0x7e1a('0xa')](_0x7e1a('0xc'))['from']('tools_tags');}function getUsersQuery(_0x278ecf,_0x41ba2c){var _0x130bee=utils[_0x7e1a('0xd')](_0x278ecf);var _0x1f5819=_0x7e1a('0xe')+_0x278ecf+_0x7e1a('0xf');var _0x393c89=squel[_0x7e1a('0x9')]()[_0x7e1a('0xa')](_0x7e1a('0x10'))[_0x7e1a('0xa')]('u.fullname')['field']('ui.'+_0x130bee)[_0x7e1a('0x11')](_0x1f5819,'ui')[_0x7e1a('0x12')](_0x7e1a('0x13'),'u',_0x7e1a('0x14'));if(_0x41ba2c[_0x7e1a('0x15')]>0x0){_0x393c89['where'](_0x7e1a('0x16')+_0x130bee+_0x7e1a('0x17'),_[_0x7e1a('0x18')](_0x41ba2c,'id'));}return _0x393c89;}function getInteractionsQuery(_0x30c06d){var _0x154eaa=utils['getInteractionsTables'](_0x30c06d);var _0x46b7da=utils[_0x7e1a('0x5')](_0x30c06d);var _0x3239d4=utils[_0x7e1a('0xd')](_0x30c06d);return squel[_0x7e1a('0x9')]()[_0x7e1a('0x11')](_0x154eaa[_0x7e1a('0x19')],'i')[_0x7e1a('0x12')](_0x7e1a('0x1a'),'c',_0x7e1a('0x1b'))[_0x7e1a('0x12')](_0x7e1a('0x13'),'o',_0x7e1a('0x1c'))[_0x7e1a('0x12')](_0x154eaa[_0x7e1a('0x1d')],'a','a.id\x20=\x20i.'+_0x46b7da)[_0x7e1a('0x12')](_0x154eaa[_0x7e1a('0x1e')],'me',_0x7e1a('0x1f')+_0x3239d4+_0x7e1a('0x20'))['left_join'](_0x154eaa[_0x7e1a('0x21')],'it',_0x7e1a('0x22')+_0x3239d4+_0x7e1a('0x20'))['left_join'](_0x7e1a('0x23'),'t',_0x7e1a('0x24'));}function getSqlClauses(){var _0x2bcce0={'body':squel[_0x7e1a('0x25')](),'contact':squel[_0x7e1a('0x25')](),'default':squel['expr'](),'fields':squel['expr'](),'filter':squel[_0x7e1a('0x25')](),'read':squel['expr'](),'tags':{'clause':squel[_0x7e1a('0x25')](),'ids':null},'user':squel['expr']()};return _0x2bcce0;}function parseTagParameter(_0x21db85){var _0x1d2184=squel[_0x7e1a('0x25')]();if(_0x21db85){var _0x1efec5=utils[_0x7e1a('0x26')](_0x21db85);_0x1efec5[_0x7e1a('0x27')](function(_0x31cb57){_0x1d2184['or'](_0x7e1a('0x28'),'%,'+_0x31cb57+',%');});}return _0x1d2184;}function parseReadParameter(_0x1dc1b4){var _0x282837='';if(_0x1dc1b4){_0x282837=_0x7e1a('0x29');if(_0x1dc1b4==='1'){_0x282837=_0x282837[_0x7e1a('0x2a')](_0x7e1a('0x2b'),'=');}else{_0x282837=_0x282837[_0x7e1a('0x2a')](_0x7e1a('0x2b'),'>');}}return _0x282837;}function parseSearchFilter(_0x24de3b,_0x9f0c13){var _0x4d5ffd=squel['expr']();if(_0x9f0c13){var _0x1cea02=_0x9f0c13[_0x7e1a('0x2a')]('\x5c','\x5c\x5c')[_0x7e1a('0x2a')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x1cea02)){_0x4d5ffd['or'](_0x7e1a('0x2c'),_0x1cea02+'%');if(['sms',_0x7e1a('0x2d')][_0x7e1a('0x2e')](_0x24de3b)){_0x4d5ffd['or']('i.phone\x20LIKE\x20?',_0x1cea02+'%');}else if(_0x24de3b===_0x7e1a('0x2f')){_0x4d5ffd['or'](_0x7e1a('0x30'),_0x1cea02+'%');}else if(_0x24de3b===_0x7e1a('0x31')){_0x4d5ffd['or']('i.from\x20LIKE\x20?',_0x1cea02+'%');}}else if(_0x24de3b==='mail'&&qs['isEmail'](_0x1cea02)){_0x4d5ffd['or'](_0x7e1a('0x32'),_0x1cea02+'%');}else{if(_0x24de3b==='mail'){_0x4d5ffd['or'](_0x7e1a('0x33'),qs[_0x7e1a('0x34')](_0x1cea02,!![]))['or'](_0x7e1a('0x35'),qs[_0x7e1a('0x34')](_0x1cea02));}else if(_0x24de3b!==_0x7e1a('0x2f')){_0x4d5ffd['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x7e1a('0x34')](_0x1cea02));}_0x4d5ffd['or'](_0x7e1a('0x36'),qs[_0x7e1a('0x34')](_0x1cea02,!![]),null);}}return _0x4d5ffd;}function parseAdvancedSearchFilter(_0x4e65b2,_0x20aca1){var _0xef6133=getSqlClauses();var _0xecd1b7=as[_0x7e1a('0x37')](_0x4e65b2);var _0x409c91=_0xecd1b7[_0x7e1a('0x38')];for(var _0x5902a6=0x0;_0x5902a6<_0xecd1b7[_0x7e1a('0x39')][_0x7e1a('0x15')];_0x5902a6++){var _0x3683f1=_0xecd1b7['conditions'][_0x5902a6];var _0x4d7e58='i';var _0x5b16a6=_[_0x7e1a('0x3a')](_0x20aca1,[_0x7e1a('0xb'),_0x3683f1[_0x7e1a('0xa')]]);if(_0x5b16a6){var _0xdda388=as[_0x7e1a('0x3b')](_0x4d7e58,_0x5b16a6[_0x7e1a('0x3c')],_0x3683f1);_0xef6133[_0x7e1a('0x3d')][_0x409c91](_0xdda388['text'],_0xdda388['value'][_0x7e1a('0x3e')],_0xdda388[_0x7e1a('0x3f')][_0x7e1a('0x40')]);}else{switch(_0x3683f1[_0x7e1a('0xa')]){case'unreadMessages':var _0x46f927=parseReadParameter(_0x3683f1['value']);_0xef6133['read'][_0x7e1a('0x41')](_0x46f927);break;case _0x7e1a('0x42'):if(_0x3683f1[_0x7e1a('0x43')]===_0x7e1a('0x44')){if(_0x3683f1[_0x7e1a('0x3f')][_0x7e1a('0x45')]('\x20')[_0x7e1a('0x15')]>0x1){_0xef6133[_0x7e1a('0x46')][_0x409c91](_0x7e1a('0x36'),qs[_0x7e1a('0x34')](_0x3683f1[_0x7e1a('0x3f')],!![]),null);}else{var _0x40ccb9='%'+_0x3683f1['value']+'%';_0xef6133[_0x7e1a('0x46')][_0x409c91]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x40ccb9,_0x40ccb9,_0x40ccb9);}}else{_0x5b16a6=_[_0x7e1a('0x3a')](_0x20aca1,[_0x7e1a('0xb'),_0x7e1a('0x47')]);_0x3683f1[_0x7e1a('0xa')]=_0x7e1a('0x47');_0xdda388=as[_0x7e1a('0x3b')](_0x4d7e58,_0x5b16a6[_0x7e1a('0x3c')],_0x3683f1);_0xef6133[_0x7e1a('0x46')][_0x409c91](_0xdda388['text'],_0xdda388[_0x7e1a('0x3f')][_0x7e1a('0x3e')],_0xdda388[_0x7e1a('0x3f')]['end']);}break;case _0x7e1a('0x48'):var _0x2055c0=_0x3683f1[_0x7e1a('0x3f')]['split'](',')[_0x7e1a('0x18')](function(_0x168c3b){return Number(_0x168c3b);});var _0xfd9edd=parseTagParameter(_0x2055c0);_0xef6133['tags']['clause'][_0x7e1a('0x41')](_0xfd9edd);_0xef6133[_0x7e1a('0x49')][_0x7e1a('0x4a')]=_0x2055c0;break;case _0x7e1a('0x4b'):if(_0x3683f1[_0x7e1a('0x43')]===_0x7e1a('0x44')){_0xef6133[_0x7e1a('0x4c')][_0x409c91](_0x7e1a('0x4d'),'%'+_0x3683f1['value']+'%',null);}else{_0x5b16a6=_[_0x7e1a('0x3a')](_0x20aca1,['name',_0x7e1a('0x4e')]);_0x3683f1[_0x7e1a('0xa')]=_0x7e1a('0x4e');_0xdda388=as[_0x7e1a('0x3b')](_0x4d7e58,_0x5b16a6[_0x7e1a('0x3c')],_0x3683f1);_0xef6133['user'][_0x409c91](_0xdda388['text'],_0xdda388['value'][_0x7e1a('0x3e')],_0xdda388[_0x7e1a('0x3f')]['end']);}break;case _0x7e1a('0x4f'):case _0x7e1a('0x50'):_0xdda388=as[_0x7e1a('0x3b')]('me',null,_0x3683f1);_0xef6133[_0x7e1a('0x4f')][_0x409c91](_0xdda388['text'],_0xdda388[_0x7e1a('0x3f')][_0x7e1a('0x3e')],_0xdda388[_0x7e1a('0x3f')][_0x7e1a('0x40')]);break;}}}return _0xef6133;}function parseModelFields(_0x50054a,_0x145569,_0x46f719){var _0x100eed=utils['getAccountFK'](_0x50054a);var _0x3e6ac2=squel[_0x7e1a('0x25')]();var _0x69c069=_(_0x145569)['keys']()[_0x7e1a('0x18')](function(_0x19fbbe){return _[_0x7e1a('0x51')](_0x46f719,['name',_0x19fbbe])?_0x19fbbe:undefined;})['compact']()[_0x7e1a('0x3f')]();if(_0x69c069[_0x7e1a('0x15')]>0x0){_0x69c069['forEach'](function(_0x270e8d){if(_0x270e8d===_0x100eed){_0x3e6ac2['and']('i.'+_0x100eed+_0x7e1a('0x17'),[][_0x7e1a('0x52')](_0x145569[_0x270e8d]));}else if(_0x270e8d===_0x7e1a('0x53')){var _0x16638c=JSON[_0x7e1a('0x54')](_0x145569[_0x270e8d])[_0x7e1a('0x55')];var _0x57ee5a=JSON[_0x7e1a('0x54')](_0x145569[_0x270e8d])[_0x7e1a('0x56')];_0x3e6ac2[_0x7e1a('0x41')](_0x7e1a('0x57'),_0x16638c,_0x57ee5a);}else{if(_0x145569[_0x270e8d]===_0x7e1a('0x58')){_0x3e6ac2['and']('i.'+_0x270e8d+'\x20IS\x20NULL');}else{_0x3e6ac2['and']('i.'+_0x270e8d+_0x7e1a('0x59'),_0x145569[_0x270e8d]);}}});}return _0x3e6ac2;}function parseQueryParameters(_0x557433,_0x5d46e1,_0x33f7cf){var _0x487a33=getSqlClauses();return Promise[_0x7e1a('0x5a')]()['then'](function(){return parseModelFields(_0x557433,_0x5d46e1,_0x33f7cf);})[_0x7e1a('0x5b')](function(_0x53a3ca){_0x487a33[_0x7e1a('0x5c')][_0x7e1a('0x41')](_0x53a3ca);return parseReadParameter(_0x5d46e1[_0x7e1a('0x5d')]);})[_0x7e1a('0x5b')](function(_0x458be4){_0x487a33[_0x7e1a('0x5d')][_0x7e1a('0x41')](_0x458be4);return parseTagParameter(_0x5d46e1[_0x7e1a('0x5e')]);})['then'](function(_0x1bdd62){_0x487a33[_0x7e1a('0x49')][_0x7e1a('0x5f')][_0x7e1a('0x41')](_0x1bdd62);return parseSearchFilter(_0x557433,_0x5d46e1[_0x7e1a('0x60')]);})[_0x7e1a('0x5b')](function(_0x459d50){_0x487a33[_0x7e1a('0x60')]=_0x459d50;return _0x487a33;});}function checkAccountsRestrictions(_0x38f174,_0x104ddf,_0x5728be){var _0x1665f4=utils[_0x7e1a('0x5')](_0x38f174);var _0x40d48c='get'+_[_0x7e1a('0x61')](_0x38f174)+(_0x38f174===_0x7e1a('0x62')?_0x7e1a('0x63'):_0x7e1a('0x64'));var _0x4a9607=squel[_0x7e1a('0x25')]();return Promise[_0x7e1a('0x5a')]()['then'](function(){if(_0x5728be[_0x7e1a('0x8')]&&_0x104ddf[_0x7e1a('0x6')]===_0x7e1a('0x7')){return _0x104ddf[_0x40d48c]({'attributes':['id'],'raw':!![]});}})[_0x7e1a('0x5b')](function(_0x41c1e7){if(_0x41c1e7){if(_0x41c1e7[_0x7e1a('0x15')]===0x0){_0x4a9607[_0x7e1a('0x41')]('i.'+_0x1665f4+_0x7e1a('0x65'));}else{_0x4a9607[_0x7e1a('0x41')]('i.'+_0x1665f4+_0x7e1a('0x17'),_[_0x7e1a('0x18')](_0x41c1e7,'id'));}}else if(!_0x5728be[_0x1665f4]){_0x4a9607[_0x7e1a('0x41')]('i.'+_0x1665f4+'\x20IS\x20NOT\x20NULL');}})[_0x7e1a('0x5b')](function(){return _0x4a9607;});}function getClosedOrderClause(_0x7d5a4a,_0x2a335c){var _0x2e0898='';var _0x597cf0=[_0x7e1a('0x66'),_0x7e1a('0x67'),_0x7e1a('0x68')];if(_0x7d5a4a===_0x7e1a('0x69')){_0x597cf0[_0x7e1a('0x6a')]('i.substatus');}if(_0x2a335c[_0x7e1a('0x6b')]==='0'&&_0x7d5a4a===_0x7e1a('0x69')){_0x2e0898='i.substatus';}else{if(_0x2a335c[_0x7e1a('0x6b')]==='1'){_0x597cf0['shift']();}_0x2e0898='CONCAT_WS(\x27\x27,\x20'+_0x597cf0['join'](',\x20')+')';}return _0x2e0898;}function getFilteredInteractions(_0x28c2c9,_0x335534,_0x41cb83,_0x4d8d2c){var _0x2a62ef=utils[_0x7e1a('0xd')](_0x28c2c9);var _0x3917e7=_['capitalize'](_0x28c2c9)+_0x7e1a('0x6c');var _0x21a0c4=[];var _0x11f373=getTagsQuery();var _0x505bb4={'type':db[_0x7e1a('0x6d')]['QueryTypes']['SELECT'],'raw':!![]};var _0x2194a9=[];var _0xac6ccb=[];return db[_0x7e1a('0x6e')][_0x7e1a('0x6f')](_0x11f373[_0x7e1a('0x70')](),_0x505bb4)[_0x7e1a('0x5b')](function(_0x3b1ce3){_0x21a0c4=_[_0x7e1a('0x71')](_0x3b1ce3,'id');_0x505bb4=_[_0x7e1a('0x72')](_0x505bb4,{'model':db[_0x3917e7],'mapToModel':!![],'nest':!![]});if(_0x41cb83[_0x7e1a('0x5c')]){_0x4d8d2c[_0x7e1a('0x73')][_0x7e1a('0x27')](function(_0x1919cd){_0x335534['field']('i.'+_0x1919cd);});}else{_0x335534[_0x7e1a('0xa')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x7e1a('0x74'));_0x335534[_0x7e1a('0xa')](_0x7e1a('0x75'),_0x7e1a('0x76'));_0x335534['field'](_0x7e1a('0x77'),_0x7e1a('0x78'));if(_0x28c2c9===_0x7e1a('0x69')){_0x335534[_0x7e1a('0xa')]('a.email',_0x7e1a('0x79'));_0x335534[_0x7e1a('0xa')](_0x7e1a('0x7a'),_0x7e1a('0x7b'));_0x335534[_0x7e1a('0xa')](_0x7e1a('0x7c'));_0x335534['field'](_0x7e1a('0x7d'));_0x335534[_0x7e1a('0xa')](_0x7e1a('0x7e'));_0x335534[_0x7e1a('0xa')]('i.closed');_0x335534[_0x7e1a('0xa')](_0x7e1a('0x7f'));_0x335534[_0x7e1a('0xa')](_0x7e1a('0x80'));_0x335534[_0x7e1a('0xa')](_0x7e1a('0x81'));_0x335534[_0x7e1a('0xa')](_0x7e1a('0x82'));_0x335534[_0x7e1a('0xa')]('i.subject');_0x335534['field'](_0x7e1a('0x68'));_0x335534[_0x7e1a('0xa')](_0x7e1a('0x67'));_0x335534[_0x7e1a('0xa')]('i.thirdDisposition');_0x335534[_0x7e1a('0xa')](_0x7e1a('0x83'));_0x335534['field']('i.to');_0x335534[_0x7e1a('0xa')](_0x7e1a('0x84'));_0x335534[_0x7e1a('0xa')](_0x7e1a('0x85'));_0x335534[_0x7e1a('0xa')](_0x7e1a('0x86'));}else if(_0x28c2c9===_0x7e1a('0x31')){_0x335534[_0x7e1a('0xa')](_0x7e1a('0x87'),_0x7e1a('0x7b'));}else{_0x335534[_0x7e1a('0xa')]('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',_0x7e1a('0x7b'));}if(_0x28c2c9!==_0x7e1a('0x69')){_0x335534[_0x7e1a('0xa')](_0x7e1a('0x88'));}_0x335534[_0x7e1a('0xa')]('c.firstName','Contact.firstName');_0x335534[_0x7e1a('0xa')](_0x7e1a('0x89'),_0x7e1a('0x8a'));_0x335534[_0x7e1a('0xa')](_0x7e1a('0x8b'),'Contact.email');_0x335534['field']('c.phone',_0x7e1a('0x8c'));_0x335534[_0x7e1a('0xa')](_0x7e1a('0x8d'),'Contact.mobile');_0x335534[_0x7e1a('0xa')](_0x7e1a('0x8e'),'Contact.fax');_0x335534[_0x7e1a('0xa')](_0x7e1a('0x8f'),_0x7e1a('0x90'));_0x335534[_0x7e1a('0xa')](_0x7e1a('0x91'),_0x7e1a('0x92'));_0x335534[_0x7e1a('0xa')](_0x7e1a('0x93'),_0x7e1a('0x94'));}if(_0x4d8d2c[_0x7e1a('0x95')]){_0x335534['limit'](_0x4d8d2c[_0x7e1a('0x95')]);}if(_0x4d8d2c[_0x7e1a('0x96')]){_0x335534[_0x7e1a('0x96')](_0x4d8d2c[_0x7e1a('0x96')]);}return db['sequelize'][_0x7e1a('0x6f')](_0x335534[_0x7e1a('0x70')](),_0x505bb4);})['then'](function(_0x4515c8){_0x2194a9=_0x4515c8;var _0x4069c3=getUsersQuery(_0x28c2c9,_0x2194a9);return db[_0x7e1a('0x6e')]['query'](_0x4069c3[_0x7e1a('0x70')](),_0x505bb4);})[_0x7e1a('0x5b')](function(_0x11f601){_0xac6ccb=_['groupBy'](_0x11f601,_0x2a62ef);if(_0x28c2c9===_0x7e1a('0x69')){return db[_0x7e1a('0x97')]['findOne']({'attributes':[_0x7e1a('0x98')],'raw':!![]});}})[_0x7e1a('0x5b')](function(_0x21fbbc){var _0x8bd0c6=_0x21fbbc?_0x21fbbc[_0x7e1a('0x98')]:undefined;var _0x56a724=_0x2194a9[_0x7e1a('0x18')](function(_0x3daab4){return updateInteraction(_0x3daab4,_0x21a0c4,_0xac6ccb,_0x8bd0c6);});return Promise[_0x7e1a('0x99')](_0x56a724);});}function countFilteredInteractions(_0x3607af,_0x1eb4b3){var _0xe9c65f=_0x3607af[_0x7e1a('0x9a')]();_0xe9c65f[_0x7e1a('0xa')]('COUNT(*)');_0xe9c65f[_0x7e1a('0xa')](_0x7e1a('0x9b'),_0x7e1a('0x74'));var _0x3875b4=utils['getSelectedTags'](_0x1eb4b3);if(!_['isEmpty'](_0x3875b4)){_0xe9c65f[_0x7e1a('0x9c')](_0x7e1a('0x9d'),_0x3875b4);}var _0x48b7a7={'type':db[_0x7e1a('0x6d')][_0x7e1a('0x9e')][_0x7e1a('0x9f')],'raw':!![]};return db['sequelize'][_0x7e1a('0x6f')](_0xe9c65f[_0x7e1a('0x70')](),_0x48b7a7);}module[_0x7e1a('0xa0')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file +var _0x0982=['SELECT','exports','lodash','squel','../parsers/qs','./update-interaction','updateInteraction','./utils','getAccountFK','agent','select','field','color','from','tools_tags','getInteractionFK','user_has_','_interactions','u.id','u.fullname','ui.','left_join','length','where','map','getInteractionsTables','interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','accounts','a.id\x20=\x20i.','messages','\x20=\x20i.id','interactionsTags','it.','expr','forEach','unreadMessages\x20{OPERATOR}\x200','replace','{OPERATOR}','i.id\x20LIKE\x20?','sms','includes','i.fax\x20LIKE\x20?','i.from\x20LIKE\x20?','mail','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','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','find','name','type','default','value','start','end','unreadMessages','read','and','operator','$substring','contact','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','Tag','split','tags','ids','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','user','body','keys','some','\x20IN\x20?','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','resolve','then','tag','clause','filter','capitalize','chat','Websites','Accounts','search','role','\x20IS\x20NULL','\x20IS\x20NOT\x20NULL','i.secondDisposition','i.disposition','unshift','i.substatus','closed','shift','CONCAT_WS(\x27\x27,\x20','join','Sequelize','QueryTypes','sequelize','toString','keyBy','fields','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','a.email','Account.email','contactName','i.id','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.lastMsgAt','i.subject','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.mobile','Contact.mobile','c.fax','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset','query','groupBy','Setting','enableEmailPreview','clone','COUNT(*)','t.id\x20IN\x20?'];(function(_0x44b340,_0x312603){var _0x44878b=function(_0x3f1c8b){while(--_0x3f1c8b){_0x44b340['push'](_0x44b340['shift']());}};_0x44878b(++_0x312603);}(_0x0982,0x1ee));var _0x2098=function(_0x26c099,_0x1da185){_0x26c099=_0x26c099-0x0;var _0x42cb2e=_0x0982[_0x26c099];return _0x42cb2e;};'use strict';var _=require(_0x2098('0x0'));var squel=require(_0x2098('0x1'));var as=require('../parsers/advancedSearch');var qs=require(_0x2098('0x2'));var updateInteraction=require(_0x2098('0x3'))[_0x2098('0x4')];var utils=require(_0x2098('0x5'));var db=require('../../mysqldb')['db'];function skipInteractionsQuery(_0x8e0d99,_0x35d06e,_0x16f76d){var _0x345621=![];var _0x32adac=utils[_0x2098('0x6')](_0x8e0d99);if(_0x35d06e['role']===_0x2098('0x7')&&!_0x16f76d['search']&&!_0x16f76d[_0x32adac]){_0x345621=!![];}return _0x345621;}function getTagsQuery(){return squel[_0x2098('0x8')]()[_0x2098('0x9')]('id')['field']('name')[_0x2098('0x9')](_0x2098('0xa'))[_0x2098('0xb')](_0x2098('0xc'));}function getUsersQuery(_0x5ae2ee,_0x4c5d4d){var _0x41f8b5=utils[_0x2098('0xd')](_0x5ae2ee);var _0x59de5b=_0x2098('0xe')+_0x5ae2ee+_0x2098('0xf');var _0x5036b6=squel[_0x2098('0x8')]()[_0x2098('0x9')](_0x2098('0x10'))['field'](_0x2098('0x11'))[_0x2098('0x9')](_0x2098('0x12')+_0x41f8b5)[_0x2098('0xb')](_0x59de5b,'ui')[_0x2098('0x13')]('users','u','u.id\x20=\x20ui.UserId');if(_0x4c5d4d[_0x2098('0x14')]>0x0){_0x5036b6[_0x2098('0x15')]('ui.'+_0x41f8b5+'\x20IN\x20?',_[_0x2098('0x16')](_0x4c5d4d,'id'));}return _0x5036b6;}function getInteractionsQuery(_0x17b8f1){var _0x1f3a87=utils[_0x2098('0x17')](_0x17b8f1);var _0x589341=utils[_0x2098('0x6')](_0x17b8f1);var _0x505e34=utils['getInteractionFK'](_0x17b8f1);return squel[_0x2098('0x8')]()[_0x2098('0xb')](_0x1f3a87[_0x2098('0x18')],'i')[_0x2098('0x13')](_0x2098('0x19'),'c',_0x2098('0x1a'))[_0x2098('0x13')](_0x2098('0x1b'),'o',_0x2098('0x1c'))[_0x2098('0x13')](_0x1f3a87[_0x2098('0x1d')],'a',_0x2098('0x1e')+_0x589341)[_0x2098('0x13')](_0x1f3a87[_0x2098('0x1f')],'me','me.'+_0x505e34+_0x2098('0x20'))[_0x2098('0x13')](_0x1f3a87[_0x2098('0x21')],'it',_0x2098('0x22')+_0x505e34+_0x2098('0x20'))[_0x2098('0x13')]('tools_tags','t','t.id\x20=\x20it.TagId');}function getSqlClauses(){var _0x149d41={'body':squel[_0x2098('0x23')](),'contact':squel[_0x2098('0x23')](),'default':squel[_0x2098('0x23')](),'fields':squel[_0x2098('0x23')](),'filter':squel['expr'](),'read':squel[_0x2098('0x23')](),'tags':{'clause':squel['expr'](),'ids':null},'user':squel['expr']()};return _0x149d41;}function parseTagParameter(_0x3313dc){var _0x5c955d=squel[_0x2098('0x23')]();if(_0x3313dc){var _0x139050=utils['getSelectedTags'](_0x3313dc);_0x139050[_0x2098('0x24')](function(_0x5394ce){_0x5c955d['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x5394ce+',%');});}return _0x5c955d;}function parseReadParameter(_0x2cb73f){var _0x44728b='';if(_0x2cb73f){_0x44728b=_0x2098('0x25');if(_0x2cb73f==='1'){_0x44728b=_0x44728b[_0x2098('0x26')](_0x2098('0x27'),'=');}else{_0x44728b=_0x44728b[_0x2098('0x26')](_0x2098('0x27'),'>');}}return _0x44728b;}function parseSearchFilter(_0x1edf3d,_0x31480e){var _0x18d648=squel[_0x2098('0x23')]();if(_0x31480e){var _0x35049f=_0x31480e[_0x2098('0x26')]('\x5c','\x5c\x5c')[_0x2098('0x26')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x35049f)){_0x18d648['or'](_0x2098('0x28'),_0x35049f+'%');if([_0x2098('0x29'),'whatsapp'][_0x2098('0x2a')](_0x1edf3d)){_0x18d648['or']('i.phone\x20LIKE\x20?',_0x35049f+'%');}else if(_0x1edf3d==='fax'){_0x18d648['or'](_0x2098('0x2b'),_0x35049f+'%');}else if(_0x1edf3d==='openchannel'){_0x18d648['or'](_0x2098('0x2c'),_0x35049f+'%');}}else if(_0x1edf3d===_0x2098('0x2d')&&qs[_0x2098('0x2e')](_0x35049f)){_0x18d648['or'](_0x2098('0x2f'),_0x35049f+'%');}else{if(_0x1edf3d===_0x2098('0x2d')){_0x18d648['or'](_0x2098('0x30'),qs[_0x2098('0x31')](_0x35049f,!![]))['or'](_0x2098('0x32'),qs[_0x2098('0x31')](_0x35049f));}else if(_0x1edf3d!==_0x2098('0x33')){_0x18d648['or'](_0x2098('0x34'),qs['getFullTextValue'](_0x35049f));}_0x18d648['or'](_0x2098('0x35'),qs[_0x2098('0x31')](_0x35049f,!![]),null);}}return _0x18d648;}function parseAdvancedSearchFilter(_0x4fa3fa,_0x2e3aec){var _0xcae40d=getSqlClauses();var _0x1a6131=as[_0x2098('0x36')](_0x4fa3fa);var _0x2433c5=_0x1a6131[_0x2098('0x37')];for(var _0x4121e7=0x0;_0x4121e7<_0x1a6131[_0x2098('0x38')][_0x2098('0x14')];_0x4121e7++){var _0x591b09=_0x1a6131['conditions'][_0x4121e7];var _0xd5c0f='i';var _0x6b26f2=_[_0x2098('0x39')](_0x2e3aec,[_0x2098('0x3a'),_0x591b09[_0x2098('0x9')]]);if(_0x6b26f2){var _0x32d72f=as['buildExpression'](_0xd5c0f,_0x6b26f2[_0x2098('0x3b')],_0x591b09);_0xcae40d[_0x2098('0x3c')][_0x2433c5](_0x32d72f['text'],_0x32d72f[_0x2098('0x3d')][_0x2098('0x3e')],_0x32d72f[_0x2098('0x3d')][_0x2098('0x3f')]);}else{switch(_0x591b09[_0x2098('0x9')]){case _0x2098('0x40'):var _0x47d624=parseReadParameter(_0x591b09[_0x2098('0x3d')]);_0xcae40d[_0x2098('0x41')][_0x2098('0x42')](_0x47d624);break;case'Contact':if(_0x591b09[_0x2098('0x43')]===_0x2098('0x44')){if(_0x591b09[_0x2098('0x3d')]['split']('\x20')[_0x2098('0x14')]>0x1){_0xcae40d['contact'][_0x2433c5](_0x2098('0x35'),qs[_0x2098('0x31')](_0x591b09[_0x2098('0x3d')],!![]),null);}else{var _0x1563b7='%'+_0x591b09[_0x2098('0x3d')]+'%';_0xcae40d[_0x2098('0x45')][_0x2433c5](_0x2098('0x46'),_0x1563b7,_0x1563b7,_0x1563b7);}}else{_0x6b26f2=_[_0x2098('0x39')](_0x2e3aec,['name','ContactId']);_0x591b09[_0x2098('0x9')]=_0x2098('0x47');_0x32d72f=as[_0x2098('0x48')](_0xd5c0f,_0x6b26f2['type'],_0x591b09);_0xcae40d[_0x2098('0x45')][_0x2433c5](_0x32d72f[_0x2098('0x49')],_0x32d72f[_0x2098('0x3d')][_0x2098('0x3e')],_0x32d72f[_0x2098('0x3d')]['end']);}break;case _0x2098('0x4a'):var _0x4c98d7=_0x591b09['value'][_0x2098('0x4b')](',')[_0x2098('0x16')](function(_0x518973){return Number(_0x518973);});var _0x3696b0=parseTagParameter(_0x4c98d7);_0xcae40d[_0x2098('0x4c')]['clause'][_0x2098('0x42')](_0x3696b0);_0xcae40d['tags'][_0x2098('0x4d')]=_0x4c98d7;break;case _0x2098('0x4e'):if(_0x591b09[_0x2098('0x43')]===_0x2098('0x44')){_0xcae40d['user'][_0x2433c5](_0x2098('0x4f'),'%'+_0x591b09[_0x2098('0x3d')]+'%',null);}else{_0x6b26f2=_[_0x2098('0x39')](_0x2e3aec,['name',_0x2098('0x50')]);_0x591b09[_0x2098('0x9')]='UserId';_0x32d72f=as[_0x2098('0x48')](_0xd5c0f,_0x6b26f2[_0x2098('0x3b')],_0x591b09);_0xcae40d[_0x2098('0x51')][_0x2433c5](_0x32d72f[_0x2098('0x49')],_0x32d72f[_0x2098('0x3d')][_0x2098('0x3e')],_0x32d72f[_0x2098('0x3d')][_0x2098('0x3f')]);}break;case _0x2098('0x52'):case'plainBody':_0x32d72f=as[_0x2098('0x48')]('me',null,_0x591b09);_0xcae40d[_0x2098('0x52')][_0x2433c5](_0x32d72f[_0x2098('0x49')],_0x32d72f[_0x2098('0x3d')][_0x2098('0x3e')],_0x32d72f['value'][_0x2098('0x3f')]);break;}}}return _0xcae40d;}function parseModelFields(_0xc789ff,_0x59a874,_0x196144){var _0x57a2a1=utils[_0x2098('0x6')](_0xc789ff);var _0x2d0a0f=squel['expr']();var _0x1707c7=_(_0x59a874)[_0x2098('0x53')]()[_0x2098('0x16')](function(_0x110107){return _[_0x2098('0x54')](_0x196144,['name',_0x110107])?_0x110107:undefined;})['compact']()[_0x2098('0x3d')]();if(_0x1707c7[_0x2098('0x14')]>0x0){_0x1707c7[_0x2098('0x24')](function(_0x542b30){if(_0x542b30===_0x57a2a1){_0x2d0a0f[_0x2098('0x42')]('i.'+_0x57a2a1+_0x2098('0x55'),[][_0x2098('0x56')](_0x59a874[_0x542b30]));}else if(_0x542b30===_0x2098('0x57')){var _0x256f76=JSON['parse'](_0x59a874[_0x542b30])['$gte'];var _0x294168=JSON[_0x2098('0x58')](_0x59a874[_0x542b30])[_0x2098('0x59')];_0x2d0a0f[_0x2098('0x42')](_0x2098('0x5a'),_0x256f76,_0x294168);}else{if(_0x59a874[_0x542b30]===_0x2098('0x5b')){_0x2d0a0f[_0x2098('0x42')]('i.'+_0x542b30+'\x20IS\x20NULL');}else{_0x2d0a0f[_0x2098('0x42')]('i.'+_0x542b30+_0x2098('0x5c'),_0x59a874[_0x542b30]);}}});}return _0x2d0a0f;}function parseQueryParameters(_0x2359f5,_0xed053,_0x13423e){var _0x2fe7f8=getSqlClauses();return Promise[_0x2098('0x5d')]()['then'](function(){return parseModelFields(_0x2359f5,_0xed053,_0x13423e);})[_0x2098('0x5e')](function(_0x91e5a4){_0x2fe7f8['fields'][_0x2098('0x42')](_0x91e5a4);return parseReadParameter(_0xed053[_0x2098('0x41')]);})[_0x2098('0x5e')](function(_0x51ce3c){_0x2fe7f8['read'][_0x2098('0x42')](_0x51ce3c);return parseTagParameter(_0xed053[_0x2098('0x5f')]);})['then'](function(_0x15c246){_0x2fe7f8[_0x2098('0x4c')][_0x2098('0x60')][_0x2098('0x42')](_0x15c246);return parseSearchFilter(_0x2359f5,_0xed053['filter']);})[_0x2098('0x5e')](function(_0xef5dcc){_0x2fe7f8[_0x2098('0x61')]=_0xef5dcc;return _0x2fe7f8;});}function checkAccountsRestrictions(_0x4f0b56,_0x584ac2,_0x511e57){var _0x86cace=utils['getAccountFK'](_0x4f0b56);var _0x939ec2='get'+_[_0x2098('0x62')](_0x4f0b56)+(_0x4f0b56===_0x2098('0x63')?_0x2098('0x64'):_0x2098('0x65'));var _0x11c6cb=squel[_0x2098('0x23')]();return Promise[_0x2098('0x5d')]()[_0x2098('0x5e')](function(){if(_0x511e57[_0x2098('0x66')]&&_0x584ac2[_0x2098('0x67')]===_0x2098('0x7')){return _0x584ac2[_0x939ec2]({'attributes':['id'],'raw':!![]});}})[_0x2098('0x5e')](function(_0x3c1727){if(_0x3c1727){if(_0x3c1727[_0x2098('0x14')]===0x0){_0x11c6cb[_0x2098('0x42')]('i.'+_0x86cace+_0x2098('0x68'));}else{_0x11c6cb[_0x2098('0x42')]('i.'+_0x86cace+'\x20IN\x20?',_['map'](_0x3c1727,'id'));}}else if(!_0x511e57[_0x86cace]){_0x11c6cb[_0x2098('0x42')]('i.'+_0x86cace+_0x2098('0x69'));}})[_0x2098('0x5e')](function(){return _0x11c6cb;});}function getClosedOrderClause(_0x1f9b06,_0x27db3b){var _0x2abcfa='';var _0x2f10e7=['i.thirdDisposition',_0x2098('0x6a'),_0x2098('0x6b')];if(_0x1f9b06===_0x2098('0x2d')){_0x2f10e7[_0x2098('0x6c')](_0x2098('0x6d'));}if(_0x27db3b[_0x2098('0x6e')]==='0'&&_0x1f9b06===_0x2098('0x2d')){_0x2abcfa=_0x2098('0x6d');}else{if(_0x27db3b[_0x2098('0x6e')]==='1'){_0x2f10e7[_0x2098('0x6f')]();}_0x2abcfa=_0x2098('0x70')+_0x2f10e7[_0x2098('0x71')](',\x20')+')';}return _0x2abcfa;}function getFilteredInteractions(_0x39e8f3,_0x105d84,_0x4119ff,_0x298de1){var _0x48d1f3=utils[_0x2098('0xd')](_0x39e8f3);var _0x418f94=_[_0x2098('0x62')](_0x39e8f3)+'Interaction';var _0x5eac26=[];var _0x1262b0=getTagsQuery();var _0x2e2d50={'type':db[_0x2098('0x72')][_0x2098('0x73')]['SELECT'],'raw':!![]};var _0x5e9fbc=[];var _0x852248=[];return db[_0x2098('0x74')]['query'](_0x1262b0[_0x2098('0x75')](),_0x2e2d50)[_0x2098('0x5e')](function(_0x507880){_0x5eac26=_[_0x2098('0x76')](_0x507880,'id');_0x2e2d50=_['merge'](_0x2e2d50,{'model':db[_0x418f94],'mapToModel':!![],'nest':!![]});if(_0x4119ff[_0x2098('0x77')]){_0x298de1['attributes']['forEach'](function(_0x535021){_0x105d84[_0x2098('0x9')]('i.'+_0x535021);});}else{_0x105d84['field'](_0x2098('0x78'),'unreadMessages');_0x105d84[_0x2098('0x9')]('a.key',_0x2098('0x79'));_0x105d84[_0x2098('0x9')](_0x2098('0x7a'),_0x2098('0x7b'));if(_0x39e8f3===_0x2098('0x2d')){_0x105d84[_0x2098('0x9')](_0x2098('0x7c'),_0x2098('0x7d'));_0x105d84[_0x2098('0x9')]('CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END',_0x2098('0x7e'));_0x105d84[_0x2098('0x9')](_0x2098('0x7f'));_0x105d84['field'](_0x2098('0x80'));_0x105d84[_0x2098('0x9')](_0x2098('0x81'));_0x105d84[_0x2098('0x9')](_0x2098('0x82'));_0x105d84[_0x2098('0x9')](_0x2098('0x83'));_0x105d84[_0x2098('0x9')]('i.attach');_0x105d84[_0x2098('0x9')](_0x2098('0x84'));_0x105d84[_0x2098('0x9')]('i.lastMsgDirection');_0x105d84[_0x2098('0x9')](_0x2098('0x85'));_0x105d84[_0x2098('0x9')](_0x2098('0x6b'));_0x105d84[_0x2098('0x9')](_0x2098('0x6a'));_0x105d84[_0x2098('0x9')]('i.thirdDisposition');_0x105d84[_0x2098('0x9')](_0x2098('0x6d'));_0x105d84[_0x2098('0x9')](_0x2098('0x86'));_0x105d84[_0x2098('0x9')](_0x2098('0x87'));_0x105d84[_0x2098('0x9')]('i.MailAccountId');_0x105d84[_0x2098('0x9')](_0x2098('0x88'));}else if(_0x39e8f3==='openchannel'){_0x105d84['field'](_0x2098('0x89'),'contactName');}else{_0x105d84['field'](_0x2098('0x8a'),_0x2098('0x7e'));}if(_0x39e8f3!==_0x2098('0x2d')){_0x105d84['field'](_0x2098('0x8b'));}_0x105d84[_0x2098('0x9')](_0x2098('0x8c'),_0x2098('0x8d'));_0x105d84[_0x2098('0x9')](_0x2098('0x8e'),_0x2098('0x8f'));_0x105d84[_0x2098('0x9')](_0x2098('0x90'),_0x2098('0x91'));_0x105d84['field']('c.phone','Contact.phone');_0x105d84[_0x2098('0x9')](_0x2098('0x92'),_0x2098('0x93'));_0x105d84[_0x2098('0x9')](_0x2098('0x94'),'Contact.fax');_0x105d84[_0x2098('0x9')]('o.fullname','Owner.fullname');_0x105d84[_0x2098('0x9')](_0x2098('0x95'),_0x2098('0x96'));_0x105d84[_0x2098('0x9')](_0x2098('0x97'),_0x2098('0x98'));}if(_0x298de1['limit']){_0x105d84[_0x2098('0x99')](_0x298de1[_0x2098('0x99')]);}if(_0x298de1[_0x2098('0x9a')]){_0x105d84[_0x2098('0x9a')](_0x298de1['offset']);}return db[_0x2098('0x74')]['query'](_0x105d84[_0x2098('0x75')](),_0x2e2d50);})['then'](function(_0x4ad029){_0x5e9fbc=_0x4ad029;var _0x6656ea=getUsersQuery(_0x39e8f3,_0x5e9fbc);return db['sequelize'][_0x2098('0x9b')](_0x6656ea[_0x2098('0x75')](),_0x2e2d50);})[_0x2098('0x5e')](function(_0xa585cb){_0x852248=_[_0x2098('0x9c')](_0xa585cb,_0x48d1f3);if(_0x39e8f3===_0x2098('0x2d')){return db[_0x2098('0x9d')]['findOne']({'attributes':[_0x2098('0x9e')],'raw':!![]});}})['then'](function(_0x31942e){var _0x2bdf2c=_0x31942e?_0x31942e[_0x2098('0x9e')]:undefined;var _0x317ab7=_0x5e9fbc['map'](function(_0x306f60){return updateInteraction(_0x306f60,_0x5eac26,_0x852248,_0x2bdf2c);});return Promise['all'](_0x317ab7);});}function countFilteredInteractions(_0x1bb907,_0x13b9f3){var _0x34a6e2=_0x1bb907[_0x2098('0x9f')]();_0x34a6e2[_0x2098('0x9')](_0x2098('0xa0'));_0x34a6e2[_0x2098('0x9')](_0x2098('0x78'),_0x2098('0x40'));var _0x51ac08=utils['getSelectedTags'](_0x13b9f3);if(!_['isEmpty'](_0x51ac08)){_0x34a6e2[_0x2098('0x15')](_0x2098('0xa1'),_0x51ac08);}var _0x442a81={'type':db[_0x2098('0x72')][_0x2098('0x73')][_0x2098('0xa2')],'raw':!![]};return db['sequelize'][_0x2098('0x9b')](_0x34a6e2['toString'](),_0x442a81);}module[_0x2098('0xa3')]={'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 fa05d9a..8e556dc 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 _0xb524=['waiting','answered','unmanaged','total','disposition','abandoned','UserId','talking','MailMessage','findOne','plainBody','-id','then','lastMsgText','trimStart','catch','updateInteraction','Users','TagIds','Tags','lodash','map','push'];(function(_0x5c9785,_0x368a32){var _0x3111a9=function(_0x143660){while(--_0x143660){_0x5c9785['push'](_0x5c9785['shift']());}};_0x3111a9(++_0x368a32);}(_0xb524,0x184));var _0x4b52=function(_0x3180dd,_0x5db862){_0x3180dd=_0x3180dd-0x0;var _0x5c286d=_0xb524[_0x3180dd];return _0x5c286d;};'use strict';var _=require(_0x4b52('0x0'));var db=require('../../mysqldb')['db'];function getInteractionUsers(_0x2aebdd,_0x567c52){return new Promise(function(_0x65c2cc,_0x87ef76){try{var _0x773635=[];if(_0x567c52[_0x2aebdd]){_0x773635=_0x567c52[_0x2aebdd][_0x4b52('0x1')](function(_0x32701c){return{'id':_0x32701c['id'],'fullname':_0x32701c['fullname']};});}return _0x65c2cc(_0x773635);}catch(_0x1cab57){_0x87ef76(_0x1cab57);}});}function getInteractionTags(_0xd57f77,_0xc875d6){var _0x1eb8df=[];if(_0xd57f77){_0xd57f77['split'](',')['forEach'](function(_0x50110b){_0x1eb8df[_0x4b52('0x2')](_0xc875d6[_0x50110b]);});}return _0x1eb8df;}function updateWaitingCounter(_0x1b6d9c){if(_0x1b6d9c[_0x4b52('0x3')]){_0x1b6d9c['waiting']-=0x1;}}function updateInteractionCounters(_0x20493a){_0x20493a['waiting']=0x0;_0x20493a['talking']=0x0;_0x20493a[_0x4b52('0x4')]=0x0;_0x20493a[_0x4b52('0x5')]=0x0;_0x20493a['abandoned']=0x0;_0x20493a[_0x4b52('0x6')]=0x0;if(_0x20493a['closed']){if(_0x20493a[_0x4b52('0x7')]===_0x4b52('0x8')){_0x20493a[_0x4b52('0x8')]+=0x1;updateWaitingCounter(_0x20493a);}if(_0x20493a[_0x4b52('0x9')]){_0x20493a[_0x4b52('0x4')]+=0x1;if(_0x20493a[_0x4b52('0xa')]){_0x20493a[_0x4b52('0xa')]-=0x1;}}else{if(_0x20493a[_0x4b52('0x7')]){_0x20493a[_0x4b52('0x5')]+=0x1;updateWaitingCounter(_0x20493a);}}}else{if(!_0x20493a[_0x4b52('0x9')]){_0x20493a[_0x4b52('0x3')]+=0x1;}if(_0x20493a[_0x4b52('0x9')]){_0x20493a[_0x4b52('0xa')]+=0x1;updateWaitingCounter(_0x20493a);}}_0x20493a[_0x4b52('0x6')]+=0x1;return _0x20493a;}function getLastMessageText(_0x270866){return db[_0x4b52('0xb')][_0x4b52('0xc')]({'where':{'$and':[{'MailInteractionId':_0x270866['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':'out'},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x4b52('0xd')],'order':_0x4b52('0xe'),'raw':!![]})[_0x4b52('0xf')](function(_0x5e7367){if(_0x5e7367&&_0x5e7367['plainBody']){_0x270866[_0x4b52('0x10')]=_[_0x4b52('0x11')](_0x5e7367[_0x4b52('0xd')]);}return _0x270866;})[_0x4b52('0x12')](function(_0x59dfea){throw _0x59dfea;});}exports[_0x4b52('0x13')]=function(_0x41c815,_0x4e650e,_0x305a5c,_0x4420b1){return new Promise(function(_0x323952,_0x4af20b){return getInteractionUsers(_0x41c815['id'],_0x305a5c)['then'](function(_0x26a213){_0x41c815[_0x4b52('0x14')]=_0x26a213;return getInteractionTags(_0x41c815[_0x4b52('0x15')],_0x4e650e);})[_0x4b52('0xf')](function(_0xdead00){_0x41c815[_0x4b52('0x16')]=_0xdead00;delete _0x41c815[_0x4b52('0x15')];return updateInteractionCounters(_0x41c815);})['then'](function(_0x49a3c8){if(_0x4420b1){return getLastMessageText(_0x49a3c8);}else{return _0x49a3c8;}})[_0x4b52('0xf')](function(_0x5c0fb3){_0x323952(_0x5c0fb3);})[_0x4b52('0x12')](function(_0x856ed0){_0x4af20b(_0x856ed0);});});}; \ No newline at end of file +var _0xb6b8=['push','waiting','answered','unmanaged','abandoned','total','closed','UserId','talking','MailMessage','findOne','out','lastMsgText','trimStart','catch','updateInteraction','then','Users','TagIds','lodash','../../mysqldb','fullname','split','forEach'];(function(_0x13e6ab,_0x5906d1){var _0x4d52ed=function(_0x5a0709){while(--_0x5a0709){_0x13e6ab['push'](_0x13e6ab['shift']());}};_0x4d52ed(++_0x5906d1);}(_0xb6b8,0x11b));var _0x8b6b=function(_0x3faad0,_0x19f136){_0x3faad0=_0x3faad0-0x0;var _0x3aaa10=_0xb6b8[_0x3faad0];return _0x3aaa10;};'use strict';var _=require(_0x8b6b('0x0'));var db=require(_0x8b6b('0x1'))['db'];function getInteractionUsers(_0x35487d,_0x43ccce){return new Promise(function(_0x764a87,_0x2731fc){try{var _0xa8a1bb=[];if(_0x43ccce[_0x35487d]){_0xa8a1bb=_0x43ccce[_0x35487d]['map'](function(_0x3cb2ef){return{'id':_0x3cb2ef['id'],'fullname':_0x3cb2ef[_0x8b6b('0x2')]};});}return _0x764a87(_0xa8a1bb);}catch(_0xd0048c){_0x2731fc(_0xd0048c);}});}function getInteractionTags(_0x4f4025,_0x2b24db){var _0x5dc958=[];if(_0x4f4025){_0x4f4025[_0x8b6b('0x3')](',')[_0x8b6b('0x4')](function(_0x2a1baa){_0x5dc958[_0x8b6b('0x5')](_0x2b24db[_0x2a1baa]);});}return _0x5dc958;}function updateWaitingCounter(_0x5097cc){if(_0x5097cc[_0x8b6b('0x6')]){_0x5097cc[_0x8b6b('0x6')]-=0x1;}}function updateInteractionCounters(_0x2548b6){_0x2548b6[_0x8b6b('0x6')]=0x0;_0x2548b6['talking']=0x0;_0x2548b6[_0x8b6b('0x7')]=0x0;_0x2548b6[_0x8b6b('0x8')]=0x0;_0x2548b6[_0x8b6b('0x9')]=0x0;_0x2548b6[_0x8b6b('0xa')]=0x0;if(_0x2548b6[_0x8b6b('0xb')]){if(_0x2548b6['disposition']===_0x8b6b('0x9')){_0x2548b6[_0x8b6b('0x9')]+=0x1;updateWaitingCounter(_0x2548b6);}if(_0x2548b6[_0x8b6b('0xc')]){_0x2548b6['answered']+=0x1;if(_0x2548b6[_0x8b6b('0xd')]){_0x2548b6['talking']-=0x1;}}else{if(_0x2548b6['disposition']){_0x2548b6[_0x8b6b('0x8')]+=0x1;updateWaitingCounter(_0x2548b6);}}}else{if(!_0x2548b6[_0x8b6b('0xc')]){_0x2548b6[_0x8b6b('0x6')]+=0x1;}if(_0x2548b6[_0x8b6b('0xc')]){_0x2548b6[_0x8b6b('0xd')]+=0x1;updateWaitingCounter(_0x2548b6);}}_0x2548b6[_0x8b6b('0xa')]+=0x1;return _0x2548b6;}function getLastMessageText(_0x611662){return db[_0x8b6b('0xe')][_0x8b6b('0xf')]({'where':{'$and':[{'MailInteractionId':_0x611662['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x8b6b('0x10')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':'-id','raw':!![]})['then'](function(_0x47b71e){if(_0x47b71e&&_0x47b71e['plainBody']){_0x611662[_0x8b6b('0x11')]=_[_0x8b6b('0x12')](_0x47b71e['plainBody']);}return _0x611662;})[_0x8b6b('0x13')](function(_0xe03337){throw _0xe03337;});}exports[_0x8b6b('0x14')]=function(_0x32a859,_0x5c82f3,_0x440291,_0x1585bc){return new Promise(function(_0x3968b0,_0x595192){return getInteractionUsers(_0x32a859['id'],_0x440291)[_0x8b6b('0x15')](function(_0x1dcb45){_0x32a859[_0x8b6b('0x16')]=_0x1dcb45;return getInteractionTags(_0x32a859[_0x8b6b('0x17')],_0x5c82f3);})[_0x8b6b('0x15')](function(_0xf98703){_0x32a859['Tags']=_0xf98703;delete _0x32a859[_0x8b6b('0x17')];return updateInteractionCounters(_0x32a859);})['then'](function(_0x14e48f){if(_0x1585bc){return getLastMessageText(_0x14e48f);}else{return _0x14e48f;}})[_0x8b6b('0x15')](function(_0x1eab2a){_0x3968b0(_0x1eab2a);})[_0x8b6b('0x13')](function(_0x47bf02){_0x595192(_0x47bf02);});});}; \ No newline at end of file diff --git a/server/components/interaction/utils.js b/server/components/interaction/utils.js index fdad46a..d0f3ee0 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 _0x4109=['error','exports','lodash','../../config/logger','mail-interactions','fax-interactions','sms-interactions','whatsapp-interactions','capitalize','chat','Website','Account','upperFirst','unknown','accounts','_interactions','_interaction_has_tags','_messages','user_has_','isArray','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','name','role','stringify','null','findOne','then','info'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x4109,0x93));var _0x9410=function(_0x21ab61,_0xeebcb0){_0x21ab61=_0x21ab61-0x0;var _0x2f7fec=_0x4109[_0x21ab61];return _0x2f7fec;};'use strict';var _=require(_0x9410('0x0'));var db=require('../../mysqldb')['db'];var loggers={'openchannel':require('../../config/logger')('openchannel-interactions'),'mail':require(_0x9410('0x1'))(_0x9410('0x2')),'fax':require(_0x9410('0x1'))(_0x9410('0x3')),'sms':require('../../config/logger')(_0x9410('0x4')),'chat':require('../../config/logger')('chat-interactions'),'whatsapp':require(_0x9410('0x1'))(_0x9410('0x5'))};function getAccountFK(_0x2f8822){return _[_0x9410('0x6')](_0x2f8822)+(_0x2f8822===_0x9410('0x7')?_0x9410('0x8'):_0x9410('0x9'))+'Id';}function getInteractionFK(_0x429c44){return _[_0x9410('0x6')](_0x429c44)+'InteractionId';}function getInteractionId(_0x574abe,_0x2fe803,_0x39efe8){if(_0x574abe&&_0x574abe[_[_0x9410('0xa')](_0x39efe8)+'InteractionId']){return _0x574abe[_['upperFirst'](_0x39efe8)+'InteractionId'];}else if(_0x574abe&&_0x574abe['id']){return _0x574abe['id'];}else if(_0x2fe803&&_0x2fe803['id']){return _0x2fe803['id'];}else{return _0x9410('0xb');}}function getInteractionsTables(_0x485d22){return{'accounts':_0x485d22+'_'+(_0x485d22===_0x9410('0x7')?'websites':_0x9410('0xc')),'interactions':_0x485d22+_0x9410('0xd'),'interactionsTags':_0x485d22+_0x9410('0xe'),'messages':_0x485d22+_0x9410('0xf'),'userInteractions':_0x9410('0x10')+_0x485d22+'_interactions'};}function getSelectedTags(_0x480fdd){var _0x47b992=[];if(_0x480fdd){_0x47b992=Array[_0x9410('0x11')](_0x480fdd)?_0x480fdd:[_0x480fdd];}return _0x47b992;}function log(_0x3ca491,_0x4d7cc9,_0x1f10df,_0x4b87a4,_0x24f5d7,_0x42b7af){loggers[_0x24f5d7[_0x9410('0x12')]()][_0x3ca491](_0x9410('0x13'),_0x42b7af['toUpperCase'](),_0x4d7cc9?_0x4d7cc9['id']:null,_0x4d7cc9?_0x4d7cc9[_0x9410('0x14')]:null,_0x4d7cc9?_0x4d7cc9[_0x9410('0x15')]:null,getInteractionId(_0x1f10df,_0x4b87a4,_0x24f5d7),_0x1f10df?JSON[_0x9410('0x16')](_0x1f10df):_0x9410('0x17'));}function updateUser(_0x55a2fb,_0x30f76f,_0x2f7db9,_0x34dd26,_0x5ba722){db[_[_0x9410('0xa')](_0x34dd26)+'Interaction'][_0x9410('0x18')]({'where':{'id':getInteractionId(_0x30f76f,_0x2f7db9,_0x34dd26)}})[_0x9410('0x19')](function(_0x422abf){if(_0x422abf){return _0x422abf['update']({'UserId':_0x55a2fb?_0x55a2fb['id']:null});}})['then'](function(_0x4523ff){if(_0x4523ff){log(_0x9410('0x1a'),_0x55a2fb,_0x30f76f,_0x2f7db9,_0x34dd26,_0x5ba722);}})['catch'](function(){log(_0x9410('0x1b'),_0x55a2fb,_0x30f76f,_0x2f7db9,_0x34dd26,_0x5ba722);});}module[_0x9410('0x1c')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file +var _0x943d=['stringify','null','Interaction','findOne','then','update','info','catch','error','exports','../../mysqldb','../../config/logger','mail-interactions','fax-interactions','whatsapp-interactions','Website','InteractionId','unknown','chat','websites','accounts','_interactions','_messages','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x943d,0x19f));var _0xd943=function(_0x52096b,_0x20bab4){_0x52096b=_0x52096b-0x0;var _0x2b1cc7=_0x943d[_0x52096b];return _0x2b1cc7;};'use strict';var _=require('lodash');var db=require(_0xd943('0x0'))['db'];var loggers={'openchannel':require('../../config/logger')('openchannel-interactions'),'mail':require(_0xd943('0x1'))(_0xd943('0x2')),'fax':require(_0xd943('0x1'))(_0xd943('0x3')),'sms':require(_0xd943('0x1'))('sms-interactions'),'chat':require(_0xd943('0x1'))('chat-interactions'),'whatsapp':require('../../config/logger')(_0xd943('0x4'))};function getAccountFK(_0x1ba2fe){return _['capitalize'](_0x1ba2fe)+(_0x1ba2fe==='chat'?_0xd943('0x5'):'Account')+'Id';}function getInteractionFK(_0x4222cf){return _['capitalize'](_0x4222cf)+'InteractionId';}function getInteractionId(_0x4087b6,_0x34fd85,_0x58223f){if(_0x4087b6&&_0x4087b6[_['upperFirst'](_0x58223f)+_0xd943('0x6')]){return _0x4087b6[_['upperFirst'](_0x58223f)+_0xd943('0x6')];}else if(_0x4087b6&&_0x4087b6['id']){return _0x4087b6['id'];}else if(_0x34fd85&&_0x34fd85['id']){return _0x34fd85['id'];}else{return _0xd943('0x7');}}function getInteractionsTables(_0x3e6779){return{'accounts':_0x3e6779+'_'+(_0x3e6779===_0xd943('0x8')?_0xd943('0x9'):_0xd943('0xa')),'interactions':_0x3e6779+_0xd943('0xb'),'interactionsTags':_0x3e6779+'_interaction_has_tags','messages':_0x3e6779+_0xd943('0xc'),'userInteractions':'user_has_'+_0x3e6779+'_interactions'};}function getSelectedTags(_0x6e4d45){var _0x468c0a=[];if(_0x6e4d45){_0x468c0a=Array['isArray'](_0x6e4d45)?_0x6e4d45:[_0x6e4d45];}return _0x468c0a;}function log(_0xe175e8,_0xffb9e1,_0x1cf0a3,_0x5a0a9d,_0x7282bc,_0x31fcd9){loggers[_0x7282bc[_0xd943('0xd')]()][_0xe175e8](_0xd943('0xe'),_0x31fcd9[_0xd943('0xf')](),_0xffb9e1?_0xffb9e1['id']:null,_0xffb9e1?_0xffb9e1[_0xd943('0x10')]:null,_0xffb9e1?_0xffb9e1['role']:null,getInteractionId(_0x1cf0a3,_0x5a0a9d,_0x7282bc),_0x1cf0a3?JSON[_0xd943('0x11')](_0x1cf0a3):_0xd943('0x12'));}function updateUser(_0x1ef714,_0x4f4bb3,_0x17180b,_0xdbcb0e,_0x4ca57a){db[_['upperFirst'](_0xdbcb0e)+_0xd943('0x13')][_0xd943('0x14')]({'where':{'id':getInteractionId(_0x4f4bb3,_0x17180b,_0xdbcb0e)}})[_0xd943('0x15')](function(_0x1cd58f){if(_0x1cd58f){return _0x1cd58f[_0xd943('0x16')]({'UserId':_0x1ef714?_0x1ef714['id']:null});}})['then'](function(_0x40b1ff){if(_0x40b1ff){log(_0xd943('0x17'),_0x1ef714,_0x4f4bb3,_0x17180b,_0xdbcb0e,_0x4ca57a);}})[_0xd943('0x18')](function(){log(_0xd943('0x19'),_0x1ef714,_0x4f4bb3,_0x17180b,_0xdbcb0e,_0x4ca57a);});}module[_0xd943('0x1a')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index 0e180ce..87f37b0 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 _0x6cd0=['split','createDecipher','aes-256-ctr','update','base64','utf8','final','hasOwnProperty','use','findOne','then','count','status','format','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','isUserLimit','util','../../mysqldb','../../config/environment','data1','license'];(function(_0x33080e,_0x1c600a){var _0x407395=function(_0x5b62fd){while(--_0x5b62fd){_0x33080e['push'](_0x33080e['shift']());}};_0x407395(++_0x1c600a);}(_0x6cd0,0x10f));var _0x06cd=function(_0x5100bc,_0x35e471){_0x5100bc=_0x5100bc-0x0;var _0x1d6ec6=_0x6cd0[_0x5100bc];return _0x1d6ec6;};'use strict';var crypto=require('crypto');var util=require(_0x06cd('0x0'));var compose=require('composable-middleware');var db=require(_0x06cd('0x1'))['db'];var config=require(_0x06cd('0x2'));function getValueFromLicense(_0x5378cb,_0x70cc){if(_0x5378cb&&_0x70cc){if(_0x70cc[_0x06cd('0x3')]&&_0x70cc['license']){var _0x228eb5=_0x70cc['data1'];var _0x3693d0=_0x70cc[_0x06cd('0x4')];var _0x1720c2=_0x228eb5[_0x06cd('0x5')]('-')[0x4];var _0x500996=_0x228eb5[_0x06cd('0x5')]('-')[0x0];var _0x38bfa3=crypto[_0x06cd('0x6')](_0x06cd('0x7'),util['format']('%s:%s:%s',_0x1720c2,_0x228eb5,_0x500996));var _0x259199=_0x38bfa3[_0x06cd('0x8')](_0x3693d0,_0x06cd('0x9'),_0x06cd('0xa'));_0x259199+=_0x38bfa3[_0x06cd('0xb')](_0x06cd('0xa'));var _0x4bdd84=JSON['parse'](_0x259199);return _0x4bdd84[_0x06cd('0xc')](_0x5378cb)?_0x4bdd84[_0x5378cb]:null;}}return null;}function isLimit(_0x1a1ca2,_0x5def30,_0x179dc7,_0x477b5c){var _0x349a5c=_0x5def30;return compose()[_0x06cd('0xd')](function(_0x4ae35a,_0x303ba0,_0x397a64){return db['License'][_0x06cd('0xe')]({'where':{'id':0x1},'raw':!![]})[_0x06cd('0xf')](function(_0xb9e8c1){var _0x3313b6=getValueFromLicense(_0x1a1ca2,_0xb9e8c1);return _0x3313b6?_0x3313b6:_0x349a5c;})[_0x06cd('0xf')](function(_0x4a763d){_0x349a5c=_0x4a763d;return _0x179dc7[_0x06cd('0x10')](_0x477b5c);})[_0x06cd('0xf')](function(_0x11b77c){if(_0x11b77c>=_0x349a5c){return _0x303ba0[_0x06cd('0x11')](0x193)['json']({'message':util[_0x06cd('0x12')](_0x06cd('0x13'),_0x1a1ca2)});}_0x397a64();})[_0x06cd('0x14')](function(_0x3b2855){_0x397a64(_0x3b2855);});});}function isUserLimit(){return isLimit(_0x06cd('0x15'),0x1,db['User'],{'where':{'$or':[{'role':'admin'},{'role':'user'}]}});}exports[_0x06cd('0x16')]=isUserLimit; \ No newline at end of file +var _0x3e03=['utf8','hasOwnProperty','use','License','findOne','then','count','status','format','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','user','isUserLimit','crypto','util','composable-middleware','../../mysqldb','../../config/environment','data1','split','createDecipher','aes-256-ctr','%s:%s:%s','update','base64'];(function(_0x47159c,_0x1c8216){var _0x454dbe=function(_0x2b54f7){while(--_0x2b54f7){_0x47159c['push'](_0x47159c['shift']());}};_0x454dbe(++_0x1c8216);}(_0x3e03,0x160));var _0x33e0=function(_0x5d6270,_0x83b57a){_0x5d6270=_0x5d6270-0x0;var _0x168f26=_0x3e03[_0x5d6270];return _0x168f26;};'use strict';var crypto=require(_0x33e0('0x0'));var util=require(_0x33e0('0x1'));var compose=require(_0x33e0('0x2'));var db=require(_0x33e0('0x3'))['db'];var config=require(_0x33e0('0x4'));function getValueFromLicense(_0x465d99,_0x48f029){if(_0x465d99&&_0x48f029){if(_0x48f029['data1']&&_0x48f029['license']){var _0xd1fc72=_0x48f029[_0x33e0('0x5')];var _0x55ed12=_0x48f029['license'];var _0x48aec2=_0xd1fc72[_0x33e0('0x6')]('-')[0x4];var _0x3b621a=_0xd1fc72[_0x33e0('0x6')]('-')[0x0];var _0x5916da=crypto[_0x33e0('0x7')](_0x33e0('0x8'),util['format'](_0x33e0('0x9'),_0x48aec2,_0xd1fc72,_0x3b621a));var _0x5e2b79=_0x5916da[_0x33e0('0xa')](_0x55ed12,_0x33e0('0xb'),_0x33e0('0xc'));_0x5e2b79+=_0x5916da['final']('utf8');var _0x2f5de2=JSON['parse'](_0x5e2b79);return _0x2f5de2[_0x33e0('0xd')](_0x465d99)?_0x2f5de2[_0x465d99]:null;}}return null;}function isLimit(_0x2386ec,_0xb65d1d,_0x46e85b,_0x32b333){var _0x5acd13=_0xb65d1d;return compose()[_0x33e0('0xe')](function(_0x31dcde,_0x924bfc,_0x5e0cac){return db[_0x33e0('0xf')][_0x33e0('0x10')]({'where':{'id':0x1},'raw':!![]})['then'](function(_0x174bfa){var _0x41d97a=getValueFromLicense(_0x2386ec,_0x174bfa);return _0x41d97a?_0x41d97a:_0x5acd13;})[_0x33e0('0x11')](function(_0x349573){_0x5acd13=_0x349573;return _0x46e85b[_0x33e0('0x12')](_0x32b333);})['then'](function(_0x5ea47e){if(_0x5ea47e>=_0x5acd13){return _0x924bfc[_0x33e0('0x13')](0x193)['json']({'message':util[_0x33e0('0x14')](_0x33e0('0x15'),_0x2386ec)});}_0x5e0cac();})[_0x33e0('0x16')](function(_0x155a47){_0x5e0cac(_0x155a47);});});}function isUserLimit(){return isLimit(_0x33e0('0x17'),0x1,db['User'],{'where':{'$or':[{'role':'admin'},{'role':_0x33e0('0x18')}]}});}exports[_0x33e0('0x19')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index bf01bcc..124cd98 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 _0x5562=['parseSearch','sqlOperator','startsWith','[$or]','and','replace','[$and]','split','forEach','shift','match','filter','indexOf','map','conditions','push','buildExpression','operator','$eq','$between','value','$gt','$lte','add','days','format','YYYY-MM-DD','castTo','text','CAST(','field','\x20AS\x20','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','NOT\x20IN\x20?','=\x20?','<>\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','>\x20?','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','pop','DATE','utcOffset','minutes'];(function(_0xc6be3a,_0x540e05){var _0x56a310=function(_0x50a144){while(--_0x50a144){_0xc6be3a['push'](_0xc6be3a['shift']());}};_0x56a310(++_0x540e05);}(_0x5562,0x6c));var _0x2556=function(_0x4b3753,_0x2316fc){_0x4b3753=_0x4b3753-0x0;var _0xc3703f=_0x5562[_0x4b3753];return _0xc3703f;};'use strict';var _=require('lodash');var moment=require('moment');exports[_0x2556('0x0')]=function(_0x44e064){var _0x12ea3c={'conditions':[]};_0x12ea3c[_0x2556('0x1')]=_[_0x2556('0x2')](_0x44e064,_0x2556('0x3'))?'or':_0x2556('0x4');var _0x218402=_0x44e064[_0x2556('0x5')](_0x2556('0x6'),'')[_0x2556('0x5')](_0x2556('0x3'),'')[_0x2556('0x7')]('||');for(var _0x317562=0x0;_0x317562<_0x218402['length'];_0x317562++){var _0x2423a9=_0x218402[_0x317562]['split'](':=');var _0x34409a=_0x2423a9[0x0];var _0x1b1774=_0x2423a9['slice'](0x1);_0x1b1774[_0x2556('0x8')](function(_0x24adb4){var _0x5da8d1=_0x24adb4[_0x2556('0x7')]('[')[_0x2556('0x9')]();var _0x2e0b36=_0x24adb4[_0x2556('0xa')](/\[(.*?)\]/g);_0x2e0b36[_0x2556('0x8')](function(_0x3d1d47){var _0x17a1c9=_0x3d1d47['split']('[')[_0x2556('0xb')](function(_0x1d343d){return _0x1d343d[_0x2556('0xc')](']')>-0x1;})[_0x2556('0xd')](function(_0x58b378){return _0x58b378[_0x2556('0x7')](']')[0x0];})[0x0];_0x12ea3c[_0x2556('0xe')][_0x2556('0xf')]({'field':_0x34409a,'operator':_0x5da8d1,'value':_0x17a1c9});});});}return _0x12ea3c;};exports[_0x2556('0x10')]=function(_0x5f0a16,_0x1e2977,_0x496c2e){var _0x4c72c1={};if(_0x1e2977==='DATE'){if(_0x496c2e[_0x2556('0x11')]===_0x2556('0x12')){_0x496c2e[_0x2556('0x11')]=_0x2556('0x13');_0x496c2e['value']+=','+_0x496c2e[_0x2556('0x14')];}else if(_['includes']([_0x2556('0x15'),_0x2556('0x16')],_0x496c2e[_0x2556('0x11')])){_0x496c2e[_0x2556('0x14')]=moment(_0x496c2e[_0x2556('0x14')])[_0x2556('0x17')](0x1,_0x2556('0x18'))[_0x2556('0x19')](_0x2556('0x1a'));}}if(_0x496c2e[_0x2556('0x1b')]){_0x1e2977=_0x496c2e['castTo'];_0x4c72c1[_0x2556('0x1c')]=_0x2556('0x1d')+_0x5f0a16+'.'+_0x496c2e[_0x2556('0x1e')]+_0x2556('0x1f')+_0x496c2e[_0x2556('0x1b')]+')\x20'+parseOperator(_0x496c2e['operator']);}else{_0x4c72c1['text']=_0x5f0a16+'.'+_0x496c2e[_0x2556('0x1e')]+'\x20'+parseOperator(_0x496c2e[_0x2556('0x11')]);}if(_['includes']([_0x2556('0x20'),_0x2556('0x21')],_0x496c2e[_0x2556('0x11')]))_0x4c72c1[_0x2556('0x1c')]='('+_0x4c72c1[_0x2556('0x1c')]+_0x2556('0x22')+_0x5f0a16+'.'+_0x496c2e[_0x2556('0x1e')]+_0x2556('0x23');_0x4c72c1[_0x2556('0x14')]=parseValue(_0x1e2977,_0x496c2e[_0x2556('0x11')],_0x496c2e[_0x2556('0x14')]);return _0x4c72c1;};function parseOperator(_0xc8d468){var _0x2e7afd;switch(_0xc8d468){case _0x2556('0x24'):_0x2e7afd='IN\x20?';break;case _0x2556('0x21'):_0x2e7afd=_0x2556('0x25');break;case'$eq':_0x2e7afd=_0x2556('0x26');break;case _0x2556('0x20'):_0x2e7afd=_0x2556('0x27');break;case _0x2556('0x28'):case _0x2556('0x29'):case _0x2556('0x2a'):_0x2e7afd=_0x2556('0x2b');break;case'$lt':_0x2e7afd='<\x20?';break;case _0x2556('0x15'):_0x2e7afd=_0x2556('0x2c');break;case _0x2556('0x16'):_0x2e7afd=_0x2556('0x2d');break;case _0x2556('0x2e'):_0x2e7afd=_0x2556('0x2f');break;case _0x2556('0x13'):_0x2e7afd=_0x2556('0x30');break;}return _0x2e7afd;}function parseValue(_0x4a3c04,_0x3bdba4,_0x3d9daf){var _0xc38310={'start':undefined,'end':undefined};switch(_0x3bdba4){case'$in':case'$notIn':_0xc38310[_0x2556('0x31')]=_0x3d9daf[_0x2556('0x7')](',');break;case _0x2556('0x28'):_0xc38310[_0x2556('0x31')]='%'+_0x3d9daf+'%';break;case _0x2556('0x29'):_0xc38310['start']=_0x3d9daf+'%';break;case _0x2556('0x2a'):_0xc38310[_0x2556('0x31')]='%'+_0x3d9daf;break;case _0x2556('0x13'):var _0x5d788a=_0x3d9daf[_0x2556('0x7')](',');var _0x3d9daf=_0x5d788a['shift']();var _0x5c4880=_0x5d788a[_0x2556('0x32')]();if(_0x4a3c04===_0x2556('0x33')){_0x3d9daf=moment(_0x3d9daf)[_0x2556('0x34')](0x0,!![])[_0x2556('0x19')]();_0x5c4880=moment(_0x5c4880)[_0x2556('0x34')](0x0,!![])[_0x2556('0x17')](0x17,'hours')[_0x2556('0x17')](0x3b,_0x2556('0x35'))['add'](0x3b,'seconds')[_0x2556('0x19')]();}_0xc38310={'start':_0x3d9daf,'end':_0x5c4880};break;default:_0xc38310[_0x2556('0x31')]=_0x3d9daf;break;}return _0xc38310;} \ No newline at end of file +var _0xb0d7=['moment','parseSearch','sqlOperator','startsWith','replace','length','split','slice','shift','match','forEach','filter','map','operator','$eq','value','$lte','add','format','castTo','text','\x20AS\x20','includes','$ne','$notIn','\x20OR\x20','field','\x20IS\x20NULL)','$in','IN\x20?','=\x20?','<>\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','<\x20?','$gt','>\x20?','<=\x20?','$gte','>=\x20?','$between','BETWEEN\x20?\x20AND\x20?','start','DATE','utcOffset','hours','minutes','seconds'];(function(_0x3e6a06,_0x5ddcd6){var _0xcdc571=function(_0x5b0d06){while(--_0x5b0d06){_0x3e6a06['push'](_0x3e6a06['shift']());}};_0xcdc571(++_0x5ddcd6);}(_0xb0d7,0x132));var _0x7b0d=function(_0x383af0,_0x4f27b5){_0x383af0=_0x383af0-0x0;var _0x154aef=_0xb0d7[_0x383af0];return _0x154aef;};'use strict';var _=require('lodash');var moment=require(_0x7b0d('0x0'));exports[_0x7b0d('0x1')]=function(_0x54ea72){var _0x566f07={'conditions':[]};_0x566f07[_0x7b0d('0x2')]=_[_0x7b0d('0x3')](_0x54ea72,'[$or]')?'or':'and';var _0xcd6d09=_0x54ea72[_0x7b0d('0x4')]('[$and]','')[_0x7b0d('0x4')]('[$or]','')['split']('||');for(var _0x1beabd=0x0;_0x1beabd<_0xcd6d09[_0x7b0d('0x5')];_0x1beabd++){var _0x454683=_0xcd6d09[_0x1beabd][_0x7b0d('0x6')](':=');var _0x4ab3bc=_0x454683[0x0];var _0x1f24db=_0x454683[_0x7b0d('0x7')](0x1);_0x1f24db['forEach'](function(_0x2425e3){var _0x37e77b=_0x2425e3['split']('[')[_0x7b0d('0x8')]();var _0x975e9b=_0x2425e3[_0x7b0d('0x9')](/\[(.*?)\]/g);_0x975e9b[_0x7b0d('0xa')](function(_0x533934){var _0x38f9a9=_0x533934[_0x7b0d('0x6')]('[')[_0x7b0d('0xb')](function(_0x5dbf16){return _0x5dbf16['indexOf'](']')>-0x1;})[_0x7b0d('0xc')](function(_0x217ba5){return _0x217ba5[_0x7b0d('0x6')](']')[0x0];})[0x0];_0x566f07['conditions']['push']({'field':_0x4ab3bc,'operator':_0x37e77b,'value':_0x38f9a9});});});}return _0x566f07;};exports['buildExpression']=function(_0x3d7aaa,_0x4a9f42,_0x3f3fdf){var _0x3bfa25={};if(_0x4a9f42==='DATE'){if(_0x3f3fdf[_0x7b0d('0xd')]===_0x7b0d('0xe')){_0x3f3fdf[_0x7b0d('0xd')]='$between';_0x3f3fdf[_0x7b0d('0xf')]+=','+_0x3f3fdf[_0x7b0d('0xf')];}else if(_['includes'](['$gt',_0x7b0d('0x10')],_0x3f3fdf[_0x7b0d('0xd')])){_0x3f3fdf[_0x7b0d('0xf')]=moment(_0x3f3fdf['value'])[_0x7b0d('0x11')](0x1,'days')[_0x7b0d('0x12')]('YYYY-MM-DD');}}if(_0x3f3fdf[_0x7b0d('0x13')]){_0x4a9f42=_0x3f3fdf[_0x7b0d('0x13')];_0x3bfa25[_0x7b0d('0x14')]='CAST('+_0x3d7aaa+'.'+_0x3f3fdf['field']+_0x7b0d('0x15')+_0x3f3fdf[_0x7b0d('0x13')]+')\x20'+parseOperator(_0x3f3fdf['operator']);}else{_0x3bfa25['text']=_0x3d7aaa+'.'+_0x3f3fdf['field']+'\x20'+parseOperator(_0x3f3fdf[_0x7b0d('0xd')]);}if(_[_0x7b0d('0x16')]([_0x7b0d('0x17'),_0x7b0d('0x18')],_0x3f3fdf[_0x7b0d('0xd')]))_0x3bfa25[_0x7b0d('0x14')]='('+_0x3bfa25[_0x7b0d('0x14')]+_0x7b0d('0x19')+_0x3d7aaa+'.'+_0x3f3fdf[_0x7b0d('0x1a')]+_0x7b0d('0x1b');_0x3bfa25[_0x7b0d('0xf')]=parseValue(_0x4a9f42,_0x3f3fdf['operator'],_0x3f3fdf[_0x7b0d('0xf')]);return _0x3bfa25;};function parseOperator(_0x4c79dc){var _0x1d8924;switch(_0x4c79dc){case _0x7b0d('0x1c'):_0x1d8924=_0x7b0d('0x1d');break;case _0x7b0d('0x18'):_0x1d8924='NOT\x20IN\x20?';break;case'$eq':_0x1d8924=_0x7b0d('0x1e');break;case _0x7b0d('0x17'):_0x1d8924=_0x7b0d('0x1f');break;case _0x7b0d('0x20'):case _0x7b0d('0x21'):case _0x7b0d('0x22'):_0x1d8924=_0x7b0d('0x23');break;case _0x7b0d('0x24'):_0x1d8924=_0x7b0d('0x25');break;case _0x7b0d('0x26'):_0x1d8924=_0x7b0d('0x27');break;case _0x7b0d('0x10'):_0x1d8924=_0x7b0d('0x28');break;case _0x7b0d('0x29'):_0x1d8924=_0x7b0d('0x2a');break;case _0x7b0d('0x2b'):_0x1d8924=_0x7b0d('0x2c');break;}return _0x1d8924;}function parseValue(_0x288e8f,_0x20565f,_0x599464){var _0x2ee1c4={'start':undefined,'end':undefined};switch(_0x20565f){case _0x7b0d('0x1c'):case _0x7b0d('0x18'):_0x2ee1c4[_0x7b0d('0x2d')]=_0x599464[_0x7b0d('0x6')](',');break;case _0x7b0d('0x20'):_0x2ee1c4[_0x7b0d('0x2d')]='%'+_0x599464+'%';break;case _0x7b0d('0x21'):_0x2ee1c4[_0x7b0d('0x2d')]=_0x599464+'%';break;case _0x7b0d('0x22'):_0x2ee1c4[_0x7b0d('0x2d')]='%'+_0x599464;break;case _0x7b0d('0x2b'):var _0x7f1ee7=_0x599464[_0x7b0d('0x6')](',');var _0x599464=_0x7f1ee7[_0x7b0d('0x8')]();var _0x1bfd36=_0x7f1ee7['pop']();if(_0x288e8f===_0x7b0d('0x2e')){_0x599464=moment(_0x599464)[_0x7b0d('0x2f')](0x0,!![])[_0x7b0d('0x12')]();_0x1bfd36=moment(_0x1bfd36)[_0x7b0d('0x2f')](0x0,!![])[_0x7b0d('0x11')](0x17,_0x7b0d('0x30'))['add'](0x3b,_0x7b0d('0x31'))['add'](0x3b,_0x7b0d('0x32'))[_0x7b0d('0x12')]();}_0x2ee1c4={'start':_0x599464,'end':_0x1bfd36};break;default:_0x2ee1c4[_0x7b0d('0x2d')]=_0x599464;break;}return _0x2ee1c4;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 85e9ece..07694ec 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 _0xdbd0=['where','pick','filter','object','columns','merge','VIRTUAL','lower','options','include','lodash','sequelize','moment','../../mysqldb','parse','includes','keys','model','raw','fields','split','filters','isEmpty','forOwn','find','type','DATE','isPlainObject','$gte','utc','format','YYYY-MM-DD','name','uniqueid','isArray','limit','sort','map','indexOf','priority','cast','unsigned','DESC','col','ASC','omit','isObject','unset','hasOwnProperty','match','^[+]?[0-9]*$','getFullTextValue','\x22{EXPR}\x22','forEach','push','{EXPR}','getOptions','query','$id','intersection','attributes','nolimit','offset'];(function(_0x3647e6,_0x493da0){var _0x428ab2=function(_0x391540){while(--_0x391540){_0x3647e6['push'](_0x3647e6['shift']());}};_0x428ab2(++_0x493da0);}(_0xdbd0,0x88));var _0x0dbd=function(_0x44459a,_0x51b571){_0x44459a=_0x44459a-0x0;var _0x342532=_0xdbd0[_0x44459a];return _0x342532;};'use strict';var _=require(_0x0dbd('0x0'));var sequelize=require(_0x0dbd('0x1'));var moment=require(_0x0dbd('0x2'));var db=require(_0x0dbd('0x3'))['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x4392ca){var _0x58ef9e=['ne'];try{var _0x3ac5c2=JSON[_0x0dbd('0x4')](_0x4392ca);var _0x1aeffb=Object['keys'](_0x3ac5c2)[0x0];return _0x58ef9e[_0x0dbd('0x5')](_0x1aeffb);}catch(_0x153856){return![];}}function getOperatorValue(_0xcd515f){var _0x3bd770=JSON['parse'](_0xcd515f);var _0x47e742=Object[_0x0dbd('0x6')](_0x3bd770)[0x0];var _0x3b3f21=_0x3bd770[_0x47e742];return{['$'+_0x47e742]:_0x3b3f21};}function parseIncludeModel(_0x1a957e){var _0x1b041f=JSON[_0x0dbd('0x4')](_0x1a957e);return{'model':db[_0x1b041f[_0x0dbd('0x7')]],'as':_0x1b041f['alias'],'attributes':_0x1b041f['fields'],'raw':_0x1b041f[_0x0dbd('0x8')]};}exports[_0x0dbd('0x9')]=function(_0x86fd0){var _0x38d767=null;if(_0x86fd0){_0x38d767=_0x86fd0[_0x0dbd('0xa')](',');}return _0x38d767;};exports[_0x0dbd('0xb')]=function(_0x1e0006,_0x46c818){var _0x4d6073={};if(!_[_0x0dbd('0xc')](_0x1e0006)){_[_0x0dbd('0xd')](_0x1e0006,function(_0xbeeb88,_0x59f880){try{if(_0x46c818){var _0x1f358a=_[_0x0dbd('0xe')](_0x46c818,{'name':_0x59f880})||{};if(hasSequelizeOperator(_0xbeeb88)){_0x4d6073[_0x59f880]=getOperatorValue(_0xbeeb88);}else if(_0x1f358a[_0x0dbd('0xf')]===_0x0dbd('0x10')&&_[_0x0dbd('0x11')](_0xbeeb88)){var _0x3b1327=JSON[_0x0dbd('0x4')](_0xbeeb88);var _0xce4a93={'$gte':moment(moment(_0x3b1327[_0x0dbd('0x12')])['format']('YYYY-MM-DD'))[_0x0dbd('0x13')]()[_0x0dbd('0x14')](),'$lte':moment(moment(_0x3b1327['$lte'])[_0x0dbd('0x14')](_0x0dbd('0x15')))['utc']()['subtract'](0x1,'s')[_0x0dbd('0x14')]()};_0x4d6073[_0x59f880]=_0xce4a93;}else if(_0x1f358a[_0x0dbd('0x16')]===_0x0dbd('0x17')){_0x4d6073[_0x59f880]=_0xbeeb88;}else{_0x4d6073[_0x59f880]=_['isArray'](_0xbeeb88)?_0xbeeb88:JSON[_0x0dbd('0x4')](_0xbeeb88);}}else{_0x4d6073[_0x59f880]=_[_0x0dbd('0x18')](_0xbeeb88)?_0xbeeb88:JSON['parse'](_0xbeeb88);}}catch(_0x48ef90){_0x4d6073[_0x59f880]=_0xbeeb88[_0x0dbd('0xa')](',');}});}return _0x4d6073;};exports[_0x0dbd('0x19')]=function(_0x3b9fc6){_0x3b9fc6=parseInt(_0x3b9fc6,0xa);if(!_0x3b9fc6||_0x3b9fc6<0x0){_0x3b9fc6=LIMIT_VALUE;}return _0x3b9fc6;};exports['offset']=function(_0x4a0193){_0x4a0193=parseInt(_0x4a0193,0xa);if(!_0x4a0193||_0x4a0193<0x0){_0x4a0193=0x0;}return _0x4a0193;};exports[_0x0dbd('0x1a')]=function(_0x2eb28e){var _0x4e5f3e,_0x5bea28=null;if(_0x2eb28e){_0x4e5f3e=_0x2eb28e[_0x0dbd('0xa')](',');_0x5bea28=_[_0x0dbd('0x1b')](_0x4e5f3e,function(_0x48ab50){if(_0x48ab50[_0x0dbd('0x1c')]('-')===0x0){return[_0x48ab50===_0x0dbd('0x1d')?sequelize[_0x0dbd('0x1e')](sequelize['col'](_0x0dbd('0x1d')),_0x0dbd('0x1f')):_0x48ab50['substr'](0x1),_0x0dbd('0x20')];}else{return[_0x48ab50===_0x0dbd('0x1d')?sequelize[_0x0dbd('0x1e')](sequelize[_0x0dbd('0x21')](_0x0dbd('0x1d')),'unsigned'):_0x48ab50,_0x0dbd('0x22')];}});}return _0x5bea28;};exports[_0x0dbd('0x23')]=function(_0x66a345,_0x1e528f){if(_[_0x0dbd('0xc')](_0x66a345)){return _0x66a345;}if(_[_0x0dbd('0x18')](_0x66a345)){for(var _0x4938d9=0x0;_0x4938d9<_0x66a345['length'];_0x4938d9+=0x1){_0x66a345[_0x4938d9]=this['omit'](_0x66a345[_0x4938d9],_0x1e528f);}return _0x66a345;}if(!_[_0x0dbd('0x24')](_0x66a345)){return _0x66a345;}if(_['isString'](_0x1e528f)){_0x1e528f=[_0x1e528f];}if(!_[_0x0dbd('0x18')](_0x1e528f)){return _0x66a345;}for(var _0x518cff=0x0;_0x518cff<_0x1e528f['length'];_0x518cff+=0x1){_[_0x0dbd('0x25')](_0x66a345,_0x1e528f[_0x518cff]);}for(var _0x193f03 in _0x66a345){if(_0x66a345[_0x0dbd('0x26')](_0x193f03)){_0x66a345[_0x193f03]=this[_0x0dbd('0x23')](_0x66a345[_0x193f03],_0x1e528f);}}return _0x66a345;};exports['isNumeric']=function(_0x32d41a){return _0x32d41a[_0x0dbd('0x27')](RegExp(_0x0dbd('0x28')))?!![]:![];};exports['isEmail']=function(_0x467d49){return _0x467d49[_0x0dbd('0x27')](/^\S+@\S+$/)?!![]:![];};exports[_0x0dbd('0x29')]=function(_0x3688c6,_0x4e34fa){var _0x2d9109=[];var _0x17ed82=/[ `!@#$%^&*()_\-?~]/;var _0x2b27f8=_0x4e34fa?_0x0dbd('0x2a'):'{EXPR}';_0x3688c6[_0x0dbd('0xa')](/[ ,]+/)[_0x0dbd('0x2b')](function(_0x1a400a){_0x1a400a=_0x1a400a['replace'](/([^:]")"+/g,'$1');_0x1a400a='+'+_0x1a400a+'*';var _0x4302e1=_0x1a400a[_0x0dbd('0x27')](_0x17ed82);if(_0x4302e1){_0x1a400a='\x22'+_0x1a400a+'\x22';}_0x2d9109[_0x0dbd('0x2c')](_0x1a400a);});_0x2b27f8=_0x2b27f8['replace'](_0x0dbd('0x2d'),_0x2d9109['join']('\x20'));return _0x2b27f8;};exports[_0x0dbd('0x2e')]=function(_0x596649,_0x49ae6f,_0x4da660){var _0x5a5f09={},_0x15a6e9={};if(_0x49ae6f[_0x0dbd('0x2f')]['$id']){_0x49ae6f[_0x0dbd('0x2f')]['id']=_0x49ae6f[_0x0dbd('0x2f')]['$id'];delete _0x49ae6f[_0x0dbd('0x2f')][_0x0dbd('0x30')];}_0x5a5f09[_0x0dbd('0x7')]=_['map'](_0x596649,'name');_0x5a5f09['query']=_[_0x0dbd('0x6')](_0x49ae6f['query']);_0x5a5f09['filters']=_[_0x0dbd('0x31')](_0x5a5f09['model'],_0x5a5f09[_0x0dbd('0x2f')]);_0x15a6e9[_0x0dbd('0x32')]=_[_0x0dbd('0x31')](_0x5a5f09[_0x0dbd('0x7')],this[_0x0dbd('0x9')](_0x49ae6f[_0x0dbd('0x2f')][_0x0dbd('0x9')]));_0x15a6e9[_0x0dbd('0x32')]=_0x15a6e9[_0x0dbd('0x32')]['length']?_0x15a6e9[_0x0dbd('0x32')]:_0x5a5f09[_0x0dbd('0x7')];if(!_0x49ae6f[_0x0dbd('0x2f')][_0x0dbd('0x26')](_0x0dbd('0x33'))){_0x15a6e9[_0x0dbd('0x19')]=this[_0x0dbd('0x19')](_0x49ae6f[_0x0dbd('0x2f')]['limit']);_0x15a6e9[_0x0dbd('0x34')]=this['offset'](_0x49ae6f[_0x0dbd('0x2f')][_0x0dbd('0x34')]);}_0x15a6e9['order']=this[_0x0dbd('0x1a')](_0x49ae6f[_0x0dbd('0x2f')][_0x0dbd('0x1a')]);_0x15a6e9[_0x0dbd('0x35')]=this['filters'](_[_0x0dbd('0x36')](_0x49ae6f['query'],_0x5a5f09[_0x0dbd('0xb')]),_0x596649);if(_0x49ae6f[_0x0dbd('0x2f')][_0x0dbd('0x37')]){var _0x720658=_0x596649;var _0x460e1c=_0x49ae6f['query'][_0x0dbd('0x37')];if(typeof _0x460e1c===_0x0dbd('0x38')){_0x720658=_[_0x0dbd('0x37')](_0x596649,function(_0x29e0ea){return _[_0x0dbd('0x5')](_0x460e1c[_0x0dbd('0x39')],_0x29e0ea[_0x0dbd('0x16')]);});_0x460e1c=_0x460e1c['value'];}_0x15a6e9['where']=_[_0x0dbd('0x3a')](_0x15a6e9[_0x0dbd('0x35')],{'$or':_[_0x0dbd('0x1b')](_0x720658,function(_0x1f7eae){if(_0x1f7eae['type']!==_0x0dbd('0x3b')){if(_0x4da660){return sequelize['where'](sequelize['fn'](_0x0dbd('0x3c'),sequelize[_0x0dbd('0x21')](_0x1f7eae['name'])),{'$like':sequelize['fn']('lower','%'+_0x49ae6f[_0x0dbd('0x2f')]['filter']+'%')});}else{var _0xcb84ed={};_0xcb84ed[_0x1f7eae['name']]={'$like':'%'+_0x49ae6f[_0x0dbd('0x2f')][_0x0dbd('0x37')]+'%'};return _0xcb84ed;}}})});}_0x15a6e9=_[_0x0dbd('0x3a')]({},_0x15a6e9,_0x49ae6f[_0x0dbd('0x3d')]);return _0x15a6e9;};exports['include']=function(_0x4541d6){var _0x2863b7=[];if(_0x4541d6['includeAll']){_0x2863b7[_0x0dbd('0x2c')]({'all':!![]});}else if(_0x4541d6[_0x0dbd('0x3e')]){if(Array[_0x0dbd('0x18')](_0x4541d6[_0x0dbd('0x3e')])){_0x2863b7=Object['keys'](_0x4541d6[_0x0dbd('0x3e')])[_0x0dbd('0x1b')](function(_0x1b8ba5){return parseIncludeModel(_0x4541d6[_0x0dbd('0x3e')][_0x1b8ba5]);});}else{var _0x522396=parseIncludeModel(_0x4541d6['include']);_0x2863b7[_0x0dbd('0x2c')](_0x522396);}}return _0x2863b7;}; \ No newline at end of file +var _0x9dc0=['DATE','isPlainObject','format','YYYY-MM-DD','utc','$lte','subtract','name','isArray','limit','offset','sort','indexOf','priority','col','unsigned','length','omit','isObject','isString','unset','isNumeric','match','^[+]?[0-9]*$','\x22{EXPR}\x22','{EXPR}','forEach','push','getOptions','query','$id','model','intersection','attributes','nolimit','order','where','pick','filter','object','merge','map','VIRTUAL','lower','include','includeAll','moment','parse','keys','alias','fields','raw','split','filters','isEmpty','find'];(function(_0x7a9158,_0x5a0ec8){var _0x548348=function(_0x25c037){while(--_0x25c037){_0x7a9158['push'](_0x7a9158['shift']());}};_0x548348(++_0x5a0ec8);}(_0x9dc0,0xd6));var _0x09dc=function(_0x1e50fc,_0x3d2684){_0x1e50fc=_0x1e50fc-0x0;var _0x497f51=_0x9dc0[_0x1e50fc];return _0x497f51;};'use strict';var _=require('lodash');var sequelize=require('sequelize');var moment=require(_0x09dc('0x0'));var db=require('../../mysqldb')['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x31f3dc){var _0x402dc2=['ne'];try{var _0x2eba33=JSON[_0x09dc('0x1')](_0x31f3dc);var _0x5bac1e=Object[_0x09dc('0x2')](_0x2eba33)[0x0];return _0x402dc2['includes'](_0x5bac1e);}catch(_0xb95f64){return![];}}function getOperatorValue(_0x1e0784){var _0x1a4b66=JSON[_0x09dc('0x1')](_0x1e0784);var _0x5daeae=Object['keys'](_0x1a4b66)[0x0];var _0x5e3c5d=_0x1a4b66[_0x5daeae];return{['$'+_0x5daeae]:_0x5e3c5d};}function parseIncludeModel(_0x58b855){var _0x59682=JSON[_0x09dc('0x1')](_0x58b855);return{'model':db[_0x59682['model']],'as':_0x59682[_0x09dc('0x3')],'attributes':_0x59682[_0x09dc('0x4')],'raw':_0x59682[_0x09dc('0x5')]};}exports['fields']=function(_0x189b79){var _0x314f60=null;if(_0x189b79){_0x314f60=_0x189b79[_0x09dc('0x6')](',');}return _0x314f60;};exports[_0x09dc('0x7')]=function(_0x75b59a,_0xb8b6d1){var _0x1b1f78={};if(!_[_0x09dc('0x8')](_0x75b59a)){_['forOwn'](_0x75b59a,function(_0x260130,_0x489ee0){try{if(_0xb8b6d1){var _0x323d13=_[_0x09dc('0x9')](_0xb8b6d1,{'name':_0x489ee0})||{};if(hasSequelizeOperator(_0x260130)){_0x1b1f78[_0x489ee0]=getOperatorValue(_0x260130);}else if(_0x323d13['type']===_0x09dc('0xa')&&_[_0x09dc('0xb')](_0x260130)){var _0x1efe92=JSON['parse'](_0x260130);var _0x5e28a6={'$gte':moment(moment(_0x1efe92['$gte'])[_0x09dc('0xc')](_0x09dc('0xd')))[_0x09dc('0xe')]()['format'](),'$lte':moment(moment(_0x1efe92[_0x09dc('0xf')])[_0x09dc('0xc')]('YYYY-MM-DD'))[_0x09dc('0xe')]()[_0x09dc('0x10')](0x1,'s')[_0x09dc('0xc')]()};_0x1b1f78[_0x489ee0]=_0x5e28a6;}else if(_0x323d13[_0x09dc('0x11')]==='uniqueid'){_0x1b1f78[_0x489ee0]=_0x260130;}else{_0x1b1f78[_0x489ee0]=_[_0x09dc('0x12')](_0x260130)?_0x260130:JSON[_0x09dc('0x1')](_0x260130);}}else{_0x1b1f78[_0x489ee0]=_[_0x09dc('0x12')](_0x260130)?_0x260130:JSON[_0x09dc('0x1')](_0x260130);}}catch(_0x542960){_0x1b1f78[_0x489ee0]=_0x260130[_0x09dc('0x6')](',');}});}return _0x1b1f78;};exports[_0x09dc('0x13')]=function(_0x5382ad){_0x5382ad=parseInt(_0x5382ad,0xa);if(!_0x5382ad||_0x5382ad<0x0){_0x5382ad=LIMIT_VALUE;}return _0x5382ad;};exports[_0x09dc('0x14')]=function(_0x556669){_0x556669=parseInt(_0x556669,0xa);if(!_0x556669||_0x556669<0x0){_0x556669=0x0;}return _0x556669;};exports[_0x09dc('0x15')]=function(_0x37bc7b){var _0x6e8314,_0x27c68b=null;if(_0x37bc7b){_0x6e8314=_0x37bc7b['split'](',');_0x27c68b=_['map'](_0x6e8314,function(_0x16822a){if(_0x16822a[_0x09dc('0x16')]('-')===0x0){return[_0x16822a===_0x09dc('0x17')?sequelize['cast'](sequelize[_0x09dc('0x18')](_0x09dc('0x17')),_0x09dc('0x19')):_0x16822a['substr'](0x1),'DESC'];}else{return[_0x16822a==='priority'?sequelize['cast'](sequelize['col'](_0x09dc('0x17')),_0x09dc('0x19')):_0x16822a,'ASC'];}});}return _0x27c68b;};exports['omit']=function(_0xa405b9,_0x2e9bc5){if(_['isEmpty'](_0xa405b9)){return _0xa405b9;}if(_[_0x09dc('0x12')](_0xa405b9)){for(var _0x2bae56=0x0;_0x2bae56<_0xa405b9[_0x09dc('0x1a')];_0x2bae56+=0x1){_0xa405b9[_0x2bae56]=this[_0x09dc('0x1b')](_0xa405b9[_0x2bae56],_0x2e9bc5);}return _0xa405b9;}if(!_[_0x09dc('0x1c')](_0xa405b9)){return _0xa405b9;}if(_[_0x09dc('0x1d')](_0x2e9bc5)){_0x2e9bc5=[_0x2e9bc5];}if(!_['isArray'](_0x2e9bc5)){return _0xa405b9;}for(var _0x1b4a4a=0x0;_0x1b4a4a<_0x2e9bc5[_0x09dc('0x1a')];_0x1b4a4a+=0x1){_[_0x09dc('0x1e')](_0xa405b9,_0x2e9bc5[_0x1b4a4a]);}for(var _0x495ea4 in _0xa405b9){if(_0xa405b9['hasOwnProperty'](_0x495ea4)){_0xa405b9[_0x495ea4]=this[_0x09dc('0x1b')](_0xa405b9[_0x495ea4],_0x2e9bc5);}}return _0xa405b9;};exports[_0x09dc('0x1f')]=function(_0x577bba){return _0x577bba[_0x09dc('0x20')](RegExp(_0x09dc('0x21')))?!![]:![];};exports['isEmail']=function(_0x5d3450){return _0x5d3450[_0x09dc('0x20')](/^\S+@\S+$/)?!![]:![];};exports['getFullTextValue']=function(_0x3df8cd,_0xfd361d){var _0x27ec2c=[];var _0x158c1c=/[ `!@#$%^&*()_\-?~]/;var _0x51a35e=_0xfd361d?_0x09dc('0x22'):_0x09dc('0x23');_0x3df8cd[_0x09dc('0x6')](/[ ,]+/)[_0x09dc('0x24')](function(_0x1f5057){_0x1f5057=_0x1f5057['replace'](/([^:]")"+/g,'$1');_0x1f5057='+'+_0x1f5057+'*';var _0xf8ea4=_0x1f5057[_0x09dc('0x20')](_0x158c1c);if(_0xf8ea4){_0x1f5057='\x22'+_0x1f5057+'\x22';}_0x27ec2c[_0x09dc('0x25')](_0x1f5057);});_0x51a35e=_0x51a35e['replace'](_0x09dc('0x23'),_0x27ec2c['join']('\x20'));return _0x51a35e;};exports[_0x09dc('0x26')]=function(_0x2c0468,_0x3e298b,_0x2e6809){var _0x336296={},_0x15233a={};if(_0x3e298b[_0x09dc('0x27')]['$id']){_0x3e298b[_0x09dc('0x27')]['id']=_0x3e298b['query'][_0x09dc('0x28')];delete _0x3e298b[_0x09dc('0x27')][_0x09dc('0x28')];}_0x336296[_0x09dc('0x29')]=_['map'](_0x2c0468,_0x09dc('0x11'));_0x336296['query']=_['keys'](_0x3e298b['query']);_0x336296[_0x09dc('0x7')]=_[_0x09dc('0x2a')](_0x336296[_0x09dc('0x29')],_0x336296[_0x09dc('0x27')]);_0x15233a[_0x09dc('0x2b')]=_['intersection'](_0x336296['model'],this['fields'](_0x3e298b['query'][_0x09dc('0x4')]));_0x15233a['attributes']=_0x15233a['attributes'][_0x09dc('0x1a')]?_0x15233a[_0x09dc('0x2b')]:_0x336296[_0x09dc('0x29')];if(!_0x3e298b[_0x09dc('0x27')]['hasOwnProperty'](_0x09dc('0x2c'))){_0x15233a[_0x09dc('0x13')]=this['limit'](_0x3e298b[_0x09dc('0x27')][_0x09dc('0x13')]);_0x15233a[_0x09dc('0x14')]=this[_0x09dc('0x14')](_0x3e298b[_0x09dc('0x27')][_0x09dc('0x14')]);}_0x15233a[_0x09dc('0x2d')]=this[_0x09dc('0x15')](_0x3e298b[_0x09dc('0x27')][_0x09dc('0x15')]);_0x15233a[_0x09dc('0x2e')]=this['filters'](_[_0x09dc('0x2f')](_0x3e298b[_0x09dc('0x27')],_0x336296[_0x09dc('0x7')]),_0x2c0468);if(_0x3e298b[_0x09dc('0x27')][_0x09dc('0x30')]){var _0x340358=_0x2c0468;var _0x15ac3c=_0x3e298b[_0x09dc('0x27')][_0x09dc('0x30')];if(typeof _0x15ac3c===_0x09dc('0x31')){_0x340358=_[_0x09dc('0x30')](_0x2c0468,function(_0x48adf5){return _['includes'](_0x15ac3c['columns'],_0x48adf5[_0x09dc('0x11')]);});_0x15ac3c=_0x15ac3c['value'];}_0x15233a[_0x09dc('0x2e')]=_[_0x09dc('0x32')](_0x15233a[_0x09dc('0x2e')],{'$or':_[_0x09dc('0x33')](_0x340358,function(_0x35b152){if(_0x35b152['type']!==_0x09dc('0x34')){if(_0x2e6809){return sequelize['where'](sequelize['fn'](_0x09dc('0x35'),sequelize[_0x09dc('0x18')](_0x35b152[_0x09dc('0x11')])),{'$like':sequelize['fn']('lower','%'+_0x3e298b['query'][_0x09dc('0x30')]+'%')});}else{var _0x97404={};_0x97404[_0x35b152[_0x09dc('0x11')]]={'$like':'%'+_0x3e298b['query']['filter']+'%'};return _0x97404;}}})});}_0x15233a=_[_0x09dc('0x32')]({},_0x15233a,_0x3e298b['options']);return _0x15233a;};exports[_0x09dc('0x36')]=function(_0x358f28){var _0x871359=[];if(_0x358f28[_0x09dc('0x37')]){_0x871359[_0x09dc('0x25')]({'all':!![]});}else if(_0x358f28[_0x09dc('0x36')]){if(Array['isArray'](_0x358f28[_0x09dc('0x36')])){_0x871359=Object[_0x09dc('0x2')](_0x358f28[_0x09dc('0x36')])[_0x09dc('0x33')](function(_0x2518b6){return parseIncludeModel(_0x358f28[_0x09dc('0x36')][_0x2518b6]);});}else{var _0xe55175=parseIncludeModel(_0x358f28[_0x09dc('0x36')]);_0x871359[_0x09dc('0x25')](_0xe55175);}}return _0x871359;}; \ No newline at end of file diff --git a/server/components/realtime/agents.js b/server/components/realtime/agents.js index 019059d..2806984 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 _0x2675=['whatsappCurrentCapacity','faxCurrentCapacity','chatStatusTime','openchannelStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','queue','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','routealias','pick','value','filterAgentAttributes','role','userpic','voiceStatusTime','destconnectedlinenum','onhold','lodash','http','client','chatPause','faxPause','mailPause','openchannelPause','smsPause','voicePause','every','length','idle','unavailable','isNil','voiceStatus','pause','chatStatus','faxStatus','mailStatus','openchannelStatus','smsStatus','whatsappStatus','then','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','request','Agents','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','unknown','*pause','busy','map','findOne','getAgents','all','uniq','getAgentIdsByQueues','filter','includes','getAgentIdsByStatus','resolve','User','findAll','name','fullname','whatsappPause','pauseType','find','globalStatus','catch','getSortedAgentsIdsByStatus','split','order','startsWith','DESC','getUpdatedSortOptions','fullname,internal','internal','substring','indexOf','toLowerCase','online','lastPauseAt','chatCapacity','openchannelCapacity','mailCapacity','smsCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity'];(function(_0x48f76f,_0x269018){var _0x5007fc=function(_0x88e93c){while(--_0x88e93c){_0x48f76f['push'](_0x48f76f['shift']());}};_0x5007fc(++_0x269018);}(_0x2675,0x75));var _0x5267=function(_0x5142f2,_0x501f9e){_0x5142f2=_0x5142f2-0x0;var _0x448bc3=_0x2675[_0x5142f2];return _0x448bc3;};'use strict';var _=require(_0x5267('0x0'));var jayson=require('jayson/promise');var db=require('../../mysqldb')['db'];var amiClient=jayson['client'][_0x5267('0x1')]({'port':0x232a});var routingClient=jayson[_0x5267('0x2')]['http']({'port':0x232c});function isAgentPaused(_0x4600fa,_0x36bdf0){var _0x4e2548=[_0x4600fa[_0x5267('0x3')],_0x4600fa[_0x5267('0x4')],_0x4600fa[_0x5267('0x5')],_0x4600fa[_0x5267('0x6')],_0x4600fa[_0x5267('0x7')],_0x4600fa[_0x5267('0x8')],_0x4600fa['whatsappPause']];if(!_0x36bdf0)return _[_0x5267('0x9')](_0x4e2548);var _0x46bfdf=_['filter'](_0x4e2548);return _0x46bfdf[_0x5267('0xa')]>0x0&&_0x46bfdf['length']<_0x4e2548[_0x5267('0xa')]?!![]:![];}function isIdle(_0x207d47){return _0x207d47===_0x5267('0xb')||_0x207d47==='unknown'||_0x207d47===_0x5267('0xc')||_0x207d47==='ringing'||_[_0x5267('0xd')](_0x207d47);}function isAgentIdle(_0x5bbf00){if(_0x5bbf00[_0x5267('0xe')]!==_0x5267('0xb')&&_0x5bbf00[_0x5267('0x8')]){_0x5bbf00[_0x5267('0xe')]=_0x5267('0xf');return![];}return _[_0x5267('0x9')]([_0x5bbf00[_0x5267('0x10')],_0x5bbf00[_0x5267('0x11')],_0x5bbf00[_0x5267('0x12')],_0x5bbf00[_0x5267('0x13')],_0x5bbf00[_0x5267('0x14')],_0x5bbf00[_0x5267('0xe')],_0x5bbf00[_0x5267('0x15')]],isIdle);}function getRealtimeAgents(){return amiClient['request']('Agents',{})[_0x5267('0x16')](function(_0x40d897){if(_0x40d897[_0x5267('0x17')]){throw new Error(_0x5267('0x18'));}var _0x46b2c2=_0x40d897[_0x5267('0x19')];return routingClient[_0x5267('0x1a')](_0x5267('0x1b'),{})[_0x5267('0x16')](function(_0xb1c97a){if(_0xb1c97a[_0x5267('0x17')]){throw new Error(_0x5267('0x1c'));}var _0x528d61=_0xb1c97a[_0x5267('0x19')];return _[_0x5267('0x1d')]({},_0x46b2c2,_0x528d61);});})['catch'](function(_0x20cb50){throw _0x20cb50;});}exports['getRealtimeAgents']=getRealtimeAgents;function getAgentStatus(_0x1cf835){var _0x1019e7=_0x5267('0x1e');if(isAgentPaused(_0x1cf835))_0x1019e7=_0x5267('0xf');else if(isAgentPaused(_0x1cf835,!![]))_0x1019e7=_0x5267('0x1f');else if(isAgentIdle(_0x1cf835))_0x1019e7='idle';else _0x1019e7=_0x5267('0x20');return _0x1019e7;}exports['getAgentStatus']=getAgentStatus;function getAgentIdsByQueues(_0xa32663,_0x420fb8){var _0x3b53ac=_['isArray'](_0xa32663)?_0xa32663:[_0xa32663];var _0x499f19=_['startCase'](_0x420fb8)+'Queue';var _0x5ea6a6=_[_0x5267('0x21')](_0x3b53ac,function(_0x399e64){return db[_0x499f19][_0x5267('0x22')]({'where':{'id':_0x399e64}})[_0x5267('0x16')](function(_0x11c8ea){if(!_0x11c8ea)return[];return _0x11c8ea[_0x5267('0x23')]({'attributes':['id'],'raw':!![]});});});return Promise[_0x5267('0x24')](_0x5ea6a6)[_0x5267('0x16')](function(_0x2cdc45){var _0x59f112=_(_0x2cdc45)['flatten']()[_0x5267('0x21')]('id')[_0x5267('0x25')]()['value']();return _0x59f112;});}exports[_0x5267('0x26')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x52504e,_0x4d7c2a,_0x43e7e7){try{if(_0x4d7c2a[_0x5267('0xa')]>0x0){_0x52504e=_0x52504e[_0x5267('0x27')](function(_0x2d2ace){return _0x4d7c2a[_0x5267('0x28')](_0x2d2ace['id']);});}var _0x4f3d4d=_0x52504e['filter'](function(_0x18020c){var _0x10a68c=_0x5267('0x20');if(isAgentIdle(_0x18020c)){_0x10a68c='idle';}return _0x10a68c===_0x43e7e7;});return _['map'](_0x4f3d4d,'id');}catch(_0xbe7922){throw _0xbe7922;}}exports[_0x5267('0x29')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x1fa725,_0x5bec7e,_0x59b091){return Promise[_0x5267('0x2a')]()[_0x5267('0x16')](function(){if(_0x5bec7e[_0x5267('0xa')]>0x0){_0x1fa725=_0x1fa725[_0x5267('0x27')](function(_0x5bbb83){return _0x5bec7e[_0x5267('0x28')](_0x5bbb83['id']);});}return _0x1fa725;})[_0x5267('0x16')](function(){return db[_0x5267('0x2b')][_0x5267('0x2c')]({'attributes':['id',_0x5267('0x2d'),_0x5267('0x2e'),_0x5267('0x3'),_0x5267('0x4'),'mailPause','openchannelPause',_0x5267('0x7'),'voicePause',_0x5267('0x2f'),_0x5267('0x30')],'where':{'id':{'$in':_[_0x5267('0x21')](_0x1fa725,'id')}},'raw':!![]});})[_0x5267('0x16')](function(_0x4ac4a0){return _0x4ac4a0[_0x5267('0x21')](function(_0xdd06f){var _0x3c6c1a=_[_0x5267('0x31')](_0x1fa725,['id',_0xdd06f['id']]);var _0x35fd12=filterAgentAttributes(_0x3c6c1a);_[_0x5267('0x1d')](_0xdd06f,_0x35fd12);_0xdd06f[_0x5267('0x32')]=getAgentStatus(_0xdd06f);return _0xdd06f;});})[_0x5267('0x16')](function(_0x484b77){var _0x1b297c=sortAgentsByStatus(_0x484b77,_0x59b091);return _['map'](_0x1b297c,'id');})[_0x5267('0x33')](function(_0x335c0e){throw _0x335c0e;});}exports[_0x5267('0x34')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x365d98){var _0x41e58b={'fields':[],'order':null};var _0x33ecd7=_0x365d98[_0x5267('0x35')](',');_0x41e58b['fields']=_[_0x5267('0x27')](_0x33ecd7,function(_0x3a2e07){if(!_0x3a2e07[_0x5267('0x28')](_0x5267('0x32'))){return!![];}_0x41e58b[_0x5267('0x36')]=_[_0x5267('0x37')](_0x3a2e07,'-')?_0x5267('0x38'):'ASC';return![];});return _0x41e58b;}exports[_0x5267('0x39')]=getUpdatedSortOptions;function validateSortParameter(_0x5ef02e){if(!_0x5ef02e){_0x5ef02e=_0x5267('0x3a');}if(_0x5ef02e['includes']('fullname')&&!_0x5ef02e['includes'](_0x5267('0x3b'))){var _0x50302f=_0x5ef02e[_0x5267('0x3c')](0x0,_0x5ef02e[_0x5267('0x3d')](_0x5267('0x2e')));_0x5ef02e+=','+_0x50302f+_0x5267('0x3b');}return _0x5ef02e;}exports['validateSortParameter']=validateSortParameter;function sortAgentsByStatus(_0x456b33,_0x805587){var _0x588edf=_0x456b33['sort'](function(_0x3e1483,_0x560cdf){if(_0x3e1483[_0x5267('0x32')]===_0x560cdf[_0x5267('0x32')]){if(_0x3e1483[_0x5267('0x32')]===_0x5267('0xf')){if(_0x805587===_0x5267('0x38')){return(_0x3e1483[_0x5267('0x30')]||'')<(_0x560cdf[_0x5267('0x30')]||'')||_0x3e1483['fullname']['toLowerCase']()>_0x560cdf[_0x5267('0x2e')]['toLowerCase']()?0x1:-0x1;}else{return(_0x3e1483[_0x5267('0x30')]||'')<(_0x560cdf[_0x5267('0x30')]||'')||_0x3e1483['fullname'][_0x5267('0x3e')]()>_0x560cdf[_0x5267('0x2e')][_0x5267('0x3e')]()?-0x1:0x1;}}else{if(_0x805587===_0x5267('0x38')){return _0x3e1483[_0x5267('0x2e')][_0x5267('0x3e')]()<_0x560cdf[_0x5267('0x2e')][_0x5267('0x3e')]()?0x1:-0x1;}else{return _0x3e1483[_0x5267('0x2e')]['toLowerCase']()<_0x560cdf[_0x5267('0x2e')][_0x5267('0x3e')]()?-0x1:0x1;}}}else{if(_0x805587===_0x5267('0x38')){return _0x3e1483[_0x5267('0x32')]<_0x560cdf[_0x5267('0x32')]?0x1:-0x1;}else{return _0x3e1483['globalStatus']<_0x560cdf[_0x5267('0x32')]?-0x1:0x1;}}});return _0x588edf;}exports['sortAgentsByStatus']=sortAgentsByStatus;function filterAgentAttributes(_0x21e2cb){var _0x5cda8c=['userpic',_0x5267('0x3f'),'lastLoginAt',_0x5267('0x40'),_0x5267('0x30'),_0x5267('0x40'),_0x5267('0x3b'),'address',_0x5267('0x3'),'openchannelPause','mailPause',_0x5267('0x7'),_0x5267('0x2f'),'faxPause','voicePause',_0x5267('0x41'),_0x5267('0x42'),_0x5267('0x43'),_0x5267('0x44'),_0x5267('0x45'),_0x5267('0x46'),_0x5267('0x47'),_0x5267('0x48'),_0x5267('0x49'),_0x5267('0x4a'),_0x5267('0x4b'),_0x5267('0x4c'),_0x5267('0x10'),_0x5267('0x13'),'mailStatus',_0x5267('0x14'),_0x5267('0x15'),_0x5267('0x11'),'voiceStatus',_0x5267('0x4d'),_0x5267('0x4e'),_0x5267('0x4f'),_0x5267('0x50'),_0x5267('0x51'),_0x5267('0x52'),'voiceStatusTime',_0x5267('0x53'),'destconnectedlinenum',_0x5267('0x54'),_0x5267('0x55'),_0x5267('0x56'),_0x5267('0x57')];var _0x91b932=[_0x5267('0x3'),_0x5267('0x6'),'mailPause','smsPause',_0x5267('0x2f'),_0x5267('0x4'),'voicePause',_0x5267('0x3f')];var _0x578e4e=_(_0x21e2cb)['omit'](_0x91b932)[_0x5267('0x58')](_0x5cda8c)[_0x5267('0x59')]();return _0x578e4e;}exports[_0x5267('0x5a')]=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id',_0x5267('0x2d'),_0x5267('0x2e'),_0x5267('0x5b'),_0x5267('0x3b'),_0x5267('0x3f'),_0x5267('0x32'),_0x5267('0x5c'),'lastLoginAt',_0x5267('0x30'),_0x5267('0x40'),_0x5267('0x4'),_0x5267('0x3'),_0x5267('0x5'),_0x5267('0x6'),'smsPause',_0x5267('0x8'),'whatsappPause',_0x5267('0x10'),_0x5267('0x11'),_0x5267('0x12'),'openchannelStatus',_0x5267('0x14'),_0x5267('0xe'),_0x5267('0x15'),_0x5267('0x4d'),_0x5267('0x52'),_0x5267('0x4f'),'openchannelStatusTime',_0x5267('0x50'),_0x5267('0x5d'),_0x5267('0x51'),_0x5267('0x41'),'faxCapacity','mailCapacity',_0x5267('0x42'),'smsCapacity',_0x5267('0x45'),_0x5267('0x47'),'faxCurrentCapacity','mailCurrentCapacity',_0x5267('0x48'),_0x5267('0x4a'),_0x5267('0x4b'),'phoneBarEnableScreenRecordingByAgent',_0x5267('0x56'),_0x5267('0x5e'),_0x5267('0x5f'),_0x5267('0x53'),'routealias','screenrecording'];}exports['getRealtimeAgentsQueryFields']=getRealtimeAgentsQueryFields; \ No newline at end of file +var _0x46ed=['map','findOne','getAgents','all','flatten','value','getAgentIdsByQueues','includes','getAgentIdsByStatus','resolve','findAll','name','pauseType','find','globalStatus','split','order','startsWith','DESC','ASC','fullname,internal','fullname','validateSortParameter','toLowerCase','sortAgentsByStatus','userpic','online','lastPauseAt','internal','address','chatCapacity','openchannelCapacity','smsCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','chatStatusTime','openchannelStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','voiceStatusTime','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','omit','pick','role','lastLoginAt','faxStatus','mailCurrentCapacity','smsCurrentCapacity','onhold','queue','routealias','lodash','jayson/promise','client','http','chatPause','faxPause','mailPause','openchannelPause','smsPause','voicePause','whatsappPause','every','filter','length','unknown','unavailable','ringing','isNil','voiceStatus','chatStatus','openchannelStatus','smsStatus','whatsappStatus','Agents','then','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','request','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','catch','getRealtimeAgents','pause','*pause','idle','busy','isArray','startCase','Queue'];(function(_0xcee3a0,_0x5b6b04){var _0x39a43e=function(_0x3cfc09){while(--_0x3cfc09){_0xcee3a0['push'](_0xcee3a0['shift']());}};_0x39a43e(++_0x5b6b04);}(_0x46ed,0x168));var _0xd46e=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x46ed[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0xd46e('0x0'));var jayson=require(_0xd46e('0x1'));var db=require('../../mysqldb')['db'];var amiClient=jayson[_0xd46e('0x2')][_0xd46e('0x3')]({'port':0x232a});var routingClient=jayson[_0xd46e('0x2')]['http']({'port':0x232c});function isAgentPaused(_0x2e6b84,_0x4518b8){var _0x54ef98=[_0x2e6b84[_0xd46e('0x4')],_0x2e6b84[_0xd46e('0x5')],_0x2e6b84[_0xd46e('0x6')],_0x2e6b84[_0xd46e('0x7')],_0x2e6b84[_0xd46e('0x8')],_0x2e6b84[_0xd46e('0x9')],_0x2e6b84[_0xd46e('0xa')]];if(!_0x4518b8)return _[_0xd46e('0xb')](_0x54ef98);var _0x31259b=_[_0xd46e('0xc')](_0x54ef98);return _0x31259b[_0xd46e('0xd')]>0x0&&_0x31259b['length']<_0x54ef98[_0xd46e('0xd')]?!![]:![];}function isIdle(_0x81235b){return _0x81235b==='idle'||_0x81235b===_0xd46e('0xe')||_0x81235b===_0xd46e('0xf')||_0x81235b===_0xd46e('0x10')||_[_0xd46e('0x11')](_0x81235b);}function isAgentIdle(_0x1ad723){if(_0x1ad723[_0xd46e('0x12')]!=='idle'&&_0x1ad723[_0xd46e('0x9')]){_0x1ad723['voiceStatus']='pause';return![];}return _[_0xd46e('0xb')]([_0x1ad723[_0xd46e('0x13')],_0x1ad723['faxStatus'],_0x1ad723['mailStatus'],_0x1ad723[_0xd46e('0x14')],_0x1ad723[_0xd46e('0x15')],_0x1ad723[_0xd46e('0x12')],_0x1ad723[_0xd46e('0x16')]],isIdle);}function getRealtimeAgents(){return amiClient['request'](_0xd46e('0x17'),{})[_0xd46e('0x18')](function(_0x417402){if(_0x417402[_0xd46e('0x19')]){throw new Error(_0xd46e('0x1a'));}var _0x47fa8f=_0x417402[_0xd46e('0x1b')];return routingClient[_0xd46e('0x1c')](_0xd46e('0x17'),{})['then'](function(_0x5ddd04){if(_0x5ddd04[_0xd46e('0x19')]){throw new Error(_0xd46e('0x1d'));}var _0x488690=_0x5ddd04['result'];return _[_0xd46e('0x1e')]({},_0x47fa8f,_0x488690);});})[_0xd46e('0x1f')](function(_0x362885){throw _0x362885;});}exports[_0xd46e('0x20')]=getRealtimeAgents;function getAgentStatus(_0x409010){var _0x312d6f=_0xd46e('0xe');if(isAgentPaused(_0x409010))_0x312d6f=_0xd46e('0x21');else if(isAgentPaused(_0x409010,!![]))_0x312d6f=_0xd46e('0x22');else if(isAgentIdle(_0x409010))_0x312d6f=_0xd46e('0x23');else _0x312d6f=_0xd46e('0x24');return _0x312d6f;}exports['getAgentStatus']=getAgentStatus;function getAgentIdsByQueues(_0x259072,_0x1c83fa){var _0x79aa51=_[_0xd46e('0x25')](_0x259072)?_0x259072:[_0x259072];var _0x128246=_[_0xd46e('0x26')](_0x1c83fa)+_0xd46e('0x27');var _0x8a1be=_[_0xd46e('0x28')](_0x79aa51,function(_0x4cf899){return db[_0x128246][_0xd46e('0x29')]({'where':{'id':_0x4cf899}})['then'](function(_0x4b8f6a){if(!_0x4b8f6a)return[];return _0x4b8f6a[_0xd46e('0x2a')]({'attributes':['id'],'raw':!![]});});});return Promise[_0xd46e('0x2b')](_0x8a1be)[_0xd46e('0x18')](function(_0x42afc7){var _0x247b9f=_(_0x42afc7)[_0xd46e('0x2c')]()[_0xd46e('0x28')]('id')['uniq']()[_0xd46e('0x2d')]();return _0x247b9f;});}exports[_0xd46e('0x2e')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0xddbce9,_0x17db79,_0x96f15c){try{if(_0x17db79[_0xd46e('0xd')]>0x0){_0xddbce9=_0xddbce9['filter'](function(_0x465d54){return _0x17db79[_0xd46e('0x2f')](_0x465d54['id']);});}var _0x2d1afe=_0xddbce9[_0xd46e('0xc')](function(_0x106edc){var _0x423ea3=_0xd46e('0x24');if(isAgentIdle(_0x106edc)){_0x423ea3=_0xd46e('0x23');}return _0x423ea3===_0x96f15c;});return _[_0xd46e('0x28')](_0x2d1afe,'id');}catch(_0x45ea47){throw _0x45ea47;}}exports[_0xd46e('0x30')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x504324,_0x2f4a1b,_0x5ed8dc){return Promise[_0xd46e('0x31')]()[_0xd46e('0x18')](function(){if(_0x2f4a1b[_0xd46e('0xd')]>0x0){_0x504324=_0x504324[_0xd46e('0xc')](function(_0x5ef248){return _0x2f4a1b[_0xd46e('0x2f')](_0x5ef248['id']);});}return _0x504324;})[_0xd46e('0x18')](function(){return db['User'][_0xd46e('0x32')]({'attributes':['id',_0xd46e('0x33'),'fullname',_0xd46e('0x4'),_0xd46e('0x5'),_0xd46e('0x6'),'openchannelPause','smsPause',_0xd46e('0x9'),_0xd46e('0xa'),_0xd46e('0x34')],'where':{'id':{'$in':_[_0xd46e('0x28')](_0x504324,'id')}},'raw':!![]});})[_0xd46e('0x18')](function(_0x423de9){return _0x423de9[_0xd46e('0x28')](function(_0xf8b746){var _0x527a2f=_[_0xd46e('0x35')](_0x504324,['id',_0xf8b746['id']]);var _0x1a1181=filterAgentAttributes(_0x527a2f);_[_0xd46e('0x1e')](_0xf8b746,_0x1a1181);_0xf8b746[_0xd46e('0x36')]=getAgentStatus(_0xf8b746);return _0xf8b746;});})[_0xd46e('0x18')](function(_0x1e0897){var _0x42ddde=sortAgentsByStatus(_0x1e0897,_0x5ed8dc);return _['map'](_0x42ddde,'id');})[_0xd46e('0x1f')](function(_0x357212){throw _0x357212;});}exports['getSortedAgentsIdsByStatus']=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x14447e){var _0x96b0f9={'fields':[],'order':null};var _0x12ccf8=_0x14447e[_0xd46e('0x37')](',');_0x96b0f9['fields']=_[_0xd46e('0xc')](_0x12ccf8,function(_0x3ecf34){if(!_0x3ecf34[_0xd46e('0x2f')](_0xd46e('0x36'))){return!![];}_0x96b0f9[_0xd46e('0x38')]=_[_0xd46e('0x39')](_0x3ecf34,'-')?_0xd46e('0x3a'):_0xd46e('0x3b');return![];});return _0x96b0f9;}exports['getUpdatedSortOptions']=getUpdatedSortOptions;function validateSortParameter(_0x232e6f){if(!_0x232e6f){_0x232e6f=_0xd46e('0x3c');}if(_0x232e6f[_0xd46e('0x2f')](_0xd46e('0x3d'))&&!_0x232e6f[_0xd46e('0x2f')]('internal')){var _0x964c66=_0x232e6f['substring'](0x0,_0x232e6f['indexOf']('fullname'));_0x232e6f+=','+_0x964c66+'internal';}return _0x232e6f;}exports[_0xd46e('0x3e')]=validateSortParameter;function sortAgentsByStatus(_0x54949f,_0x3b76e0){var _0x40720e=_0x54949f['sort'](function(_0x462477,_0x4114e6){if(_0x462477[_0xd46e('0x36')]===_0x4114e6[_0xd46e('0x36')]){if(_0x462477[_0xd46e('0x36')]===_0xd46e('0x21')){if(_0x3b76e0===_0xd46e('0x3a')){return(_0x462477[_0xd46e('0x34')]||'')<(_0x4114e6[_0xd46e('0x34')]||'')||_0x462477[_0xd46e('0x3d')][_0xd46e('0x3f')]()>_0x4114e6['fullname']['toLowerCase']()?0x1:-0x1;}else{return(_0x462477['pauseType']||'')<(_0x4114e6[_0xd46e('0x34')]||'')||_0x462477['fullname'][_0xd46e('0x3f')]()>_0x4114e6[_0xd46e('0x3d')][_0xd46e('0x3f')]()?-0x1:0x1;}}else{if(_0x3b76e0===_0xd46e('0x3a')){return _0x462477[_0xd46e('0x3d')][_0xd46e('0x3f')]()<_0x4114e6[_0xd46e('0x3d')][_0xd46e('0x3f')]()?0x1:-0x1;}else{return _0x462477['fullname'][_0xd46e('0x3f')]()<_0x4114e6['fullname'][_0xd46e('0x3f')]()?-0x1:0x1;}}}else{if(_0x3b76e0===_0xd46e('0x3a')){return _0x462477[_0xd46e('0x36')]<_0x4114e6[_0xd46e('0x36')]?0x1:-0x1;}else{return _0x462477[_0xd46e('0x36')]<_0x4114e6['globalStatus']?-0x1:0x1;}}});return _0x40720e;}exports[_0xd46e('0x40')]=sortAgentsByStatus;function filterAgentAttributes(_0xfcd7f9){var _0x2acb83=[_0xd46e('0x41'),_0xd46e('0x42'),'lastLoginAt',_0xd46e('0x43'),_0xd46e('0x34'),_0xd46e('0x43'),_0xd46e('0x44'),_0xd46e('0x45'),'chatPause',_0xd46e('0x7'),_0xd46e('0x6'),_0xd46e('0x8'),_0xd46e('0xa'),_0xd46e('0x5'),_0xd46e('0x9'),_0xd46e('0x46'),_0xd46e('0x47'),'mailCapacity',_0xd46e('0x48'),_0xd46e('0x49'),_0xd46e('0x4a'),_0xd46e('0x4b'),_0xd46e('0x4c'),'mailCurrentCapacity','smsCurrentCapacity',_0xd46e('0x4d'),_0xd46e('0x4e'),_0xd46e('0x13'),'openchannelStatus','mailStatus',_0xd46e('0x15'),_0xd46e('0x16'),'faxStatus',_0xd46e('0x12'),_0xd46e('0x4f'),_0xd46e('0x50'),_0xd46e('0x51'),_0xd46e('0x52'),_0xd46e('0x53'),_0xd46e('0x54'),_0xd46e('0x55'),'queue',_0xd46e('0x56'),_0xd46e('0x57'),_0xd46e('0x58'),_0xd46e('0x59'),'routealias'];var _0x56dd9a=[_0xd46e('0x4'),'openchannelPause',_0xd46e('0x6'),_0xd46e('0x8'),_0xd46e('0xa'),_0xd46e('0x5'),_0xd46e('0x9'),_0xd46e('0x42')];var _0x492329=_(_0xfcd7f9)[_0xd46e('0x5a')](_0x56dd9a)[_0xd46e('0x5b')](_0x2acb83)[_0xd46e('0x2d')]();return _0x492329;}exports['filterAgentAttributes']=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id',_0xd46e('0x33'),_0xd46e('0x3d'),_0xd46e('0x5c'),_0xd46e('0x44'),_0xd46e('0x42'),_0xd46e('0x36'),_0xd46e('0x41'),_0xd46e('0x5d'),_0xd46e('0x34'),_0xd46e('0x43'),_0xd46e('0x5'),_0xd46e('0x4'),_0xd46e('0x6'),_0xd46e('0x7'),'smsPause',_0xd46e('0x9'),_0xd46e('0xa'),_0xd46e('0x13'),_0xd46e('0x5e'),'mailStatus',_0xd46e('0x14'),_0xd46e('0x15'),_0xd46e('0x12'),_0xd46e('0x16'),'chatStatusTime',_0xd46e('0x54'),_0xd46e('0x51'),'openchannelStatusTime','smsStatusTime',_0xd46e('0x55'),_0xd46e('0x53'),_0xd46e('0x46'),'faxCapacity','mailCapacity',_0xd46e('0x47'),_0xd46e('0x48'),_0xd46e('0x49'),_0xd46e('0x4b'),_0xd46e('0x4e'),_0xd46e('0x5f'),_0xd46e('0x4c'),_0xd46e('0x60'),_0xd46e('0x4d'),_0xd46e('0x58'),_0xd46e('0x59'),_0xd46e('0x56'),_0xd46e('0x61'),_0xd46e('0x62'),_0xd46e('0x63'),_0xd46e('0x57')];}exports['getRealtimeAgentsQueryFields']=getRealtimeAgentsQueryFields; \ No newline at end of file diff --git a/server/components/realtime/queues.js b/server/components/realtime/queues.js index cc940f2..5a2668c 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 _0xdc53=['jayson/promise','client','http','available','loggedIn','paused','waiting','inUse','loggedInDb','onHold','ringing','talking','unavailable','unknown','pTalking','message','statusMessage','dialMethod','Trunk','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','voice','startCase','then','error','format','result','catch','inbound','outbound','find','pick','initializeQueues','lodash'];(function(_0x3865f4,_0x39cb7a){var _0xe6b18a=function(_0x1c0860){while(--_0x1c0860){_0x3865f4['push'](_0x3865f4['shift']());}};_0xe6b18a(++_0x39cb7a);}(_0xdc53,0x113));var _0x3dc5=function(_0x4ae625,_0xf396d0){_0x4ae625=_0x4ae625-0x0;var _0x31accf=_0xdc53[_0x4ae625];return _0x31accf;};'use strict';var _=require(_0x3dc5('0x0'));var jayson=require(_0x3dc5('0x1'));var util=require('util');var amiClient=jayson[_0x3dc5('0x2')][_0x3dc5('0x3')]({'port':0x232a});var routingClient=jayson['client'][_0x3dc5('0x3')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0x3dc5('0x4'),_0x3dc5('0x5'),_0x3dc5('0x6'),_0x3dc5('0x7')];var VOICE_QUEUE_ATTRIBUTES=['busy',_0x3dc5('0x8'),'invalid',_0x3dc5('0x9'),'notInUse',_0x3dc5('0xa'),_0x3dc5('0xb'),'ringInUse',_0x3dc5('0xc'),_0x3dc5('0xd'),_0x3dc5('0xe')];var OUTBOUND_QUEUE_ATTRIBUTES=[_0x3dc5('0xf'),'originated',_0x3dc5('0x10'),_0x3dc5('0x11'),'dialActive',_0x3dc5('0x12'),_0x3dc5('0x13'),_0x3dc5('0x14'),_0x3dc5('0x15'),_0x3dc5('0x16'),_0x3dc5('0x17'),'erlangAbandonmentRate',_0x3dc5('0x18'),_0x3dc5('0x19'),_0x3dc5('0x1a'),_0x3dc5('0x1b'),_0x3dc5('0x1c'),_0x3dc5('0x1d'),_0x3dc5('0x1e'),'predictiveIntervalDroppedCallsTimeout',_0x3dc5('0x1f'),_0x3dc5('0x20'),_0x3dc5('0x21')];function getRealtimeQueues(_0x47c9f1,_0x222816){var _0x2987dc=_0x222816===_0x3dc5('0x22')?amiClient:routingClient;return _0x2987dc['request'](_[_0x3dc5('0x23')](_0x222816)+'Queues',_0x47c9f1)[_0x3dc5('0x24')](function(_0x8056fc){if(_0x8056fc[_0x3dc5('0x25')])throw new Error(util[_0x3dc5('0x26')]('Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues',_0x222816));return _0x8056fc[_0x3dc5('0x27')];})[_0x3dc5('0x28')](function(_0x4032f9){throw _0x4032f9;});}exports['getRealtimeQueues']=getRealtimeQueues;function initializeQueues(_0x24e8e8,_0x2323ea,_0x8c1ddd,_0x538efb){var _0xae4e73=DEFAULT_QUEUE_ATTRIBUTES;if(_0x8c1ddd===_0x3dc5('0x22')){if(_0x538efb===_0x3dc5('0x29')){_0xae4e73=_0xae4e73['concat'](VOICE_QUEUE_ATTRIBUTES);}else if(_0x538efb===_0x3dc5('0x2a')){_0xae4e73=_0xae4e73['concat'](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x24e8e8['map'](function(_0x52b4f5){var _0x6af45a=_0x52b4f5['get']({'plain':!![]});_0x6af45a['paused']=0x0;_0x6af45a['loggedInDb']=0x0;_0x6af45a[_0x3dc5('0x5')]=0x0;_0x6af45a['available']=0x0;_0x6af45a[_0x3dc5('0x7')]=0x0;if(_0x8c1ddd===_0x3dc5('0x22')){_0x6af45a['talking']=0x0;_0x6af45a['busy']=0x0;if(_0x538efb===_0x3dc5('0x2a')){_0x6af45a[_0x3dc5('0xf')]=0x0;_0x6af45a['originated']=0x0;}}var _0xa49ab5=_[_0x3dc5('0x2b')](_0x2323ea,['id',_0x6af45a['id']]);if(_0xa49ab5){_['merge'](_0x6af45a,_[_0x3dc5('0x2c')](_0xa49ab5,_0xae4e73));}return _0x6af45a;});}exports[_0x3dc5('0x2d')]=initializeQueues; \ No newline at end of file +var _0x11b3=['unknown','pTalking','originated','statusMessage','Trunk','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgTalktime','voice','request','startCase','then','error','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','catch','getRealtimeQueues','inbound','concat','outbound','get','talking','busy','pick','initializeQueues','jayson/promise','util','client','http','available','loggedIn','paused','waiting','inUse','invalid','notInUse','ringing','ringInUse','unavailable'];(function(_0x146625,_0x35db16){var _0x44ac58=function(_0x595365){while(--_0x595365){_0x146625['push'](_0x146625['shift']());}};_0x44ac58(++_0x35db16);}(_0x11b3,0xe7));var _0x311b=function(_0x44351e,_0x3a1378){_0x44351e=_0x44351e-0x0;var _0x274ac3=_0x11b3[_0x44351e];return _0x274ac3;};'use strict';var _=require('lodash');var jayson=require(_0x311b('0x0'));var util=require(_0x311b('0x1'));var amiClient=jayson[_0x311b('0x2')][_0x311b('0x3')]({'port':0x232a});var routingClient=jayson[_0x311b('0x2')][_0x311b('0x3')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0x311b('0x4'),_0x311b('0x5'),_0x311b('0x6'),_0x311b('0x7')];var VOICE_QUEUE_ATTRIBUTES=['busy',_0x311b('0x8'),_0x311b('0x9'),'loggedInDb',_0x311b('0xa'),'onHold',_0x311b('0xb'),_0x311b('0xc'),'talking',_0x311b('0xd'),_0x311b('0xe')];var OUTBOUND_QUEUE_ATTRIBUTES=[_0x311b('0xf'),_0x311b('0x10'),'message',_0x311b('0x11'),'dialActive','dialMethod',_0x311b('0x12'),_0x311b('0x13'),_0x311b('0x14'),_0x311b('0x15'),_0x311b('0x16'),_0x311b('0x17'),_0x311b('0x18'),_0x311b('0x19'),_0x311b('0x1a'),_0x311b('0x1b'),_0x311b('0x1c'),'predictiveIntervalTotalCalls',_0x311b('0x1d'),'predictiveIntervalDroppedCallsTimeout',_0x311b('0x1e'),'predictiveIntervalAvgHoldtime',_0x311b('0x1f')];function getRealtimeQueues(_0xd6fd2f,_0x352e62){var _0x23871c=_0x352e62===_0x311b('0x20')?amiClient:routingClient;return _0x23871c[_0x311b('0x21')](_[_0x311b('0x22')](_0x352e62)+'Queues',_0xd6fd2f)[_0x311b('0x23')](function(_0x5d6e94){if(_0x5d6e94[_0x311b('0x24')])throw new Error(util['format'](_0x311b('0x25'),_0x352e62));return _0x5d6e94[_0x311b('0x26')];})[_0x311b('0x27')](function(_0x1174f2){throw _0x1174f2;});}exports[_0x311b('0x28')]=getRealtimeQueues;function initializeQueues(_0x2f0746,_0x27b06d,_0x496a22,_0x380e54){var _0x3b05bd=DEFAULT_QUEUE_ATTRIBUTES;if(_0x496a22===_0x311b('0x20')){if(_0x380e54===_0x311b('0x29')){_0x3b05bd=_0x3b05bd[_0x311b('0x2a')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x380e54===_0x311b('0x2b')){_0x3b05bd=_0x3b05bd['concat'](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x2f0746['map'](function(_0x3bceb6){var _0x44da51=_0x3bceb6[_0x311b('0x2c')]({'plain':!![]});_0x44da51[_0x311b('0x6')]=0x0;_0x44da51['loggedInDb']=0x0;_0x44da51[_0x311b('0x5')]=0x0;_0x44da51[_0x311b('0x4')]=0x0;_0x44da51['waiting']=0x0;if(_0x496a22===_0x311b('0x20')){_0x44da51[_0x311b('0x2d')]=0x0;_0x44da51[_0x311b('0x2e')]=0x0;if(_0x380e54===_0x311b('0x2b')){_0x44da51[_0x311b('0xf')]=0x0;_0x44da51[_0x311b('0x10')]=0x0;}}var _0x5c9113=_['find'](_0x27b06d,['id',_0x44da51['id']]);if(_0x5c9113){_['merge'](_0x44da51,_[_0x311b('0x2f')](_0x5c9113,_0x3b05bd));}return _0x44da51;});}exports[_0x311b('0x30')]=initializeQueues; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index b4468b8..0cc82c4 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['root','public','test','join','client','use','json\x20replacer','toISOString','split','static','/server/views','engine','html','ejs','renderFile','view\x20engine','urlencoded','json','50mb','express','method-override','cookie-parser','errorhandler','passport','cors','./environment','default','get','env','production','set','appPath'];(function(_0x24af20,_0xb1b03b){var _0x20bbc5=function(_0x11d66c){while(--_0x11d66c){_0x24af20['push'](_0x24af20['shift']());}};_0x20bbc5(++_0xb1b03b);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var express=require(_0x7995('0x0'));var methodOverride=require(_0x7995('0x1'));var cookieParser=require(_0x7995('0x2'));var errorHandler=require(_0x7995('0x3'));var path=require('path');var passport=require(_0x7995('0x4'));var cors=require(_0x7995('0x5'));var config=require(_0x7995('0x6'));exports[_0x7995('0x7')]=function(_0x576d89){var _0x744bea=_0x576d89[_0x7995('0x8')](_0x7995('0x9'));if(_0x744bea===_0x7995('0xa')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path['join'](config[_0x7995('0xd')],_0x7995('0xe')));}if(_0x744bea==='development'||_0x744bea===_0x7995('0xf')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path[_0x7995('0x10')](config[_0x7995('0xd')],_0x7995('0x11')));_0x576d89[_0x7995('0x12')](errorHandler());}_0x576d89['set'](_0x7995('0x13'),function(_0x41c652,_0x581f22){if(this[_0x41c652]instanceof Date){_0x581f22=this[_0x41c652][_0x7995('0x14')]()[_0x7995('0x15')]('.')[0x0]+'Z';}return _0x581f22;});_0x576d89[_0x7995('0x12')](express[_0x7995('0x16')](_0x576d89[_0x7995('0x8')](_0x7995('0xc'))));_0x576d89[_0x7995('0xb')]('views',config['root']+_0x7995('0x17'));_0x576d89[_0x7995('0x18')](_0x7995('0x19'),require(_0x7995('0x1a'))[_0x7995('0x1b')]);_0x576d89[_0x7995('0xb')](_0x7995('0x1c'),_0x7995('0x19'));_0x576d89['use'](express[_0x7995('0x1d')]({'limit':'50mb','extended':!![]}));_0x576d89[_0x7995('0x12')](express[_0x7995('0x1e')]({'limit':_0x7995('0x1f')}));_0x576d89[_0x7995('0x12')](cors());_0x576d89[_0x7995('0x12')](methodOverride());_0x576d89[_0x7995('0x12')](cookieParser());_0x576d89['use'](passport['initialize']());}; \ No newline at end of file +var _0x9957=['root','public','test','join','client','use','json\x20replacer','toISOString','split','static','/server/views','engine','html','ejs','renderFile','view\x20engine','urlencoded','json','50mb','express','method-override','cookie-parser','errorhandler','passport','cors','./environment','default','get','env','production','set','appPath'];(function(_0x3b29d5,_0x12faa2){var _0x20b96d=function(_0x284207){while(--_0x284207){_0x3b29d5['push'](_0x3b29d5['shift']());}};_0x20b96d(++_0x12faa2);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var express=require(_0x7995('0x0'));var methodOverride=require(_0x7995('0x1'));var cookieParser=require(_0x7995('0x2'));var errorHandler=require(_0x7995('0x3'));var path=require('path');var passport=require(_0x7995('0x4'));var cors=require(_0x7995('0x5'));var config=require(_0x7995('0x6'));exports[_0x7995('0x7')]=function(_0x576d89){var _0x744bea=_0x576d89[_0x7995('0x8')](_0x7995('0x9'));if(_0x744bea===_0x7995('0xa')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path['join'](config[_0x7995('0xd')],_0x7995('0xe')));}if(_0x744bea==='development'||_0x744bea===_0x7995('0xf')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path[_0x7995('0x10')](config[_0x7995('0xd')],_0x7995('0x11')));_0x576d89[_0x7995('0x12')](errorHandler());}_0x576d89['set'](_0x7995('0x13'),function(_0x41c652,_0x581f22){if(this[_0x41c652]instanceof Date){_0x581f22=this[_0x41c652][_0x7995('0x14')]()[_0x7995('0x15')]('.')[0x0]+'Z';}return _0x581f22;});_0x576d89[_0x7995('0x12')](express[_0x7995('0x16')](_0x576d89[_0x7995('0x8')](_0x7995('0xc'))));_0x576d89[_0x7995('0xb')]('views',config['root']+_0x7995('0x17'));_0x576d89[_0x7995('0x18')](_0x7995('0x19'),require(_0x7995('0x1a'))[_0x7995('0x1b')]);_0x576d89[_0x7995('0xb')](_0x7995('0x1c'),_0x7995('0x19'));_0x576d89['use'](express[_0x7995('0x1d')]({'limit':'50mb','extended':!![]}));_0x576d89[_0x7995('0x12')](express[_0x7995('0x1e')]({'limit':_0x7995('0x1f')}));_0x576d89[_0x7995('0x12')](cors());_0x576d89[_0x7995('0x12')](methodOverride());_0x576d89[_0x7995('0x12')](cookieParser());_0x576d89['use'](passport['initialize']());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 64276b1..0702ed8 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 _0x4a3e=['internal','head','mac','00:00:00:00:00:00','address','getFirstInterface','cpus','map','model','join','createHash','md5','digest','hex','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','update','substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync','../environment','networkInterfaces','orderBy','keys','length','filter','IPv4'];(function(_0x1d930e,_0x20d8b8){var _0x5bbd66=function(_0x3c7488){while(--_0x3c7488){_0x1d930e['push'](_0x1d930e['shift']());}};_0x5bbd66(++_0x20d8b8);}(_0x4a3e,0x1de));var _0xe4a3=function(_0x2a7af7,_0x21a372){_0x2a7af7=_0x2a7af7-0x0;var _0x370620=_0x4a3e[_0x2a7af7];return _0x370620;};'use strict';var _=require(_0xe4a3('0x0'));var os=require('os');var crypto=require(_0xe4a3('0x1'));var machine=require(_0xe4a3('0x2'));var exec=require(_0xe4a3('0x3'))[_0xe4a3('0x4')];var config=require(_0xe4a3('0x5'));function getInterfaces(){var _0x1ceb26=[];var _0x5e9799=os[_0xe4a3('0x6')]();var _0x483e77=_[_0xe4a3('0x7')](_[_0xe4a3('0x8')](_0x5e9799));for(var _0x348f2e=0x0;_0x348f2e<_0x483e77[_0xe4a3('0x9')];_0x348f2e++){var _0x590d2e=_0x5e9799[_0x483e77[_0x348f2e]][_0xe4a3('0xa')](function(_0x5c0ff7){return _0x5c0ff7['family']===_0xe4a3('0xb')&&_0x5c0ff7[_0xe4a3('0xc')]===![];});_0x1ceb26=_0x1ceb26['concat'](_0x590d2e);}return _0x1ceb26;}function getFirstInterface(){var _0x1e374d=_[_0xe4a3('0xd')](getInterfaces());return{'macAddress':_0x1e374d&&_0x1e374d[_0xe4a3('0xe')]?_0x1e374d['mac']:_0xe4a3('0xf'),'ipAddress':_0x1e374d&&_0x1e374d[_0xe4a3('0x10')]?_0x1e374d[_0xe4a3('0x10')]:'127.0.0.1'};}exports[_0xe4a3('0x11')]=getFirstInterface;function getCPUhash(){var _0x5d1377=_['orderBy'](os[_0xe4a3('0x12')]()[_0xe4a3('0x13')](function(_0x33471f){return _0x33471f[_0xe4a3('0x14')];}))[_0xe4a3('0x15')](':');return crypto[_0xe4a3('0x16')](_0xe4a3('0x17'))['update'](_0x5d1377)[_0xe4a3('0x18')](_0xe4a3('0x19'));}exports['getUuid']=function(){var _0x4a786a=os['platform']();var _0x298117=/[0-9a-f-]{36}/;if(config[_0xe4a3('0x1a')]&&_0x298117[_0xe4a3('0x1b')](config[_0xe4a3('0x1a')])){return config[_0xe4a3('0x1a')];}else if(_0x4a786a===_0xe4a3('0x1c')){return exec(_0xe4a3('0x1d'),{'encoding':_0xe4a3('0x1e')})[_0xe4a3('0x1f')]('\x0d\x0a','');}else{var _0x59e2e3=getFirstInterface();var _0xc91510=getCPUhash();var _0x483b2a=_0xc91510+'|'+os[_0xe4a3('0x20')]()+'|'+_0x59e2e3['macAddress']+'|'+_0x59e2e3['ipAddress'];var _0x3d8d62=crypto[_0xe4a3('0x16')]('md5')[_0xe4a3('0x21')](_0x483b2a)['digest'](_0xe4a3('0x19'));return _0x3d8d62[_0xe4a3('0x22')](0x0,0x8)+'-'+_0x3d8d62[_0xe4a3('0x22')](0x8,0xc)+'-'+_0x3d8d62['substring'](0xc,0x10)+'-'+_0x3d8d62[_0xe4a3('0x22')](0x10,0x14)+'-'+_0x3d8d62[_0xe4a3('0x22')](0x14);}}; \ No newline at end of file +var _0xbf63=['hostname','macAddress','ipAddress','hex','substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync','../environment','networkInterfaces','family','IPv4','concat','head','mac','00:00:00:00:00:00','address','getFirstInterface','orderBy','cpus','map','model','join','createHash','md5','update','digest','getUuid','platform','test','licenseToken','win32','utf8','replace'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xbf63,0x1d9));var _0x3bf6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbf63[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3bf6('0x0'));var os=require('os');var crypto=require(_0x3bf6('0x1'));var machine=require(_0x3bf6('0x2'));var exec=require(_0x3bf6('0x3'))[_0x3bf6('0x4')];var config=require(_0x3bf6('0x5'));function getInterfaces(){var _0x2b73e2=[];var _0x4fcb89=os[_0x3bf6('0x6')]();var _0x1f95d8=_['orderBy'](_['keys'](_0x4fcb89));for(var _0x5498af=0x0;_0x5498af<_0x1f95d8['length'];_0x5498af++){var _0x8bedab=_0x4fcb89[_0x1f95d8[_0x5498af]]['filter'](function(_0x2c4a8f){return _0x2c4a8f[_0x3bf6('0x7')]===_0x3bf6('0x8')&&_0x2c4a8f['internal']===![];});_0x2b73e2=_0x2b73e2[_0x3bf6('0x9')](_0x8bedab);}return _0x2b73e2;}function getFirstInterface(){var _0x4ac603=_[_0x3bf6('0xa')](getInterfaces());return{'macAddress':_0x4ac603&&_0x4ac603[_0x3bf6('0xb')]?_0x4ac603['mac']:_0x3bf6('0xc'),'ipAddress':_0x4ac603&&_0x4ac603[_0x3bf6('0xd')]?_0x4ac603['address']:'127.0.0.1'};}exports[_0x3bf6('0xe')]=getFirstInterface;function getCPUhash(){var _0x1775f6=_[_0x3bf6('0xf')](os[_0x3bf6('0x10')]()[_0x3bf6('0x11')](function(_0x2e1ca3){return _0x2e1ca3[_0x3bf6('0x12')];}))[_0x3bf6('0x13')](':');return crypto[_0x3bf6('0x14')](_0x3bf6('0x15'))[_0x3bf6('0x16')](_0x1775f6)[_0x3bf6('0x17')]('hex');}exports[_0x3bf6('0x18')]=function(){var _0x909de4=os[_0x3bf6('0x19')]();var _0x22798f=/[0-9a-f-]{36}/;if(config['licenseToken']&&_0x22798f[_0x3bf6('0x1a')](config[_0x3bf6('0x1b')])){return config[_0x3bf6('0x1b')];}else if(_0x909de4===_0x3bf6('0x1c')){return exec('dmidecode\x20--string\x20system-uuid',{'encoding':_0x3bf6('0x1d')})[_0x3bf6('0x1e')]('\x0d\x0a','');}else{var _0x5bdd90=getFirstInterface();var _0x45a33e=getCPUhash();var _0x4b5c8d=_0x45a33e+'|'+os[_0x3bf6('0x1f')]()+'|'+_0x5bdd90[_0x3bf6('0x20')]+'|'+_0x5bdd90[_0x3bf6('0x21')];var _0x1d4bcd=crypto['createHash'](_0x3bf6('0x15'))[_0x3bf6('0x16')](_0x4b5c8d)[_0x3bf6('0x17')](_0x3bf6('0x22'));return _0x1d4bcd[_0x3bf6('0x23')](0x0,0x8)+'-'+_0x1d4bcd[_0x3bf6('0x23')](0x8,0xc)+'-'+_0x1d4bcd[_0x3bf6('0x23')](0xc,0x10)+'-'+_0x1d4bcd[_0x3bf6('0x23')](0x10,0x14)+'-'+_0x1d4bcd[_0x3bf6('0x23')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index c9d5fe6..34ead3a 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 _0xa53f=['%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','diff','days','DEMO\x20START\x20AT\x20%s','error','message','finally','getUuid','findOrCreate','spread','default','util','request-promise','pkginfo','version','../../mysqldb','../../components/encryptor','./hardware','../logger','https://www.xcallymotion.com','format','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','catch','get','data1','active','license','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xa53f,0x1d5));var _0xfa53=function(_0x24aa69,_0x347a72){_0x24aa69=_0x24aa69-0x0;var _0x390a7a=_0xa53f[_0x24aa69];return _0x390a7a;};'use strict';var util=require(_0xfa53('0x0'));var moment=require('moment');var rp=require(_0xfa53('0x1'));var BPromise=require('bluebird');var pkginfo=require(_0xfa53('0x2'))(module,_0xfa53('0x3'));var db=require(_0xfa53('0x4'))['db'];var encryptor=require(_0xfa53('0x5'));var hardware=require(_0xfa53('0x6'));var logger=require(_0xfa53('0x7'))('license');var HOST=_0xfa53('0x8');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x269b7e){return new BPromise(function(_0x293ba8,_0x4e5621){var _0x23573a=util[_0xfa53('0x9')]('%s/api/servers/%s/check?version=%s',HOST,_0x269b7e,module[_0xfa53('0xa')]['version']);if(oldToken){_0x23573a=util[_0xfa53('0x9')](_0xfa53('0xb'),HOST,_0x269b7e,module[_0xfa53('0xa')]['version'],oldToken);}var _0x482ed5={'uri':_0x23573a,'method':_0xfa53('0xc'),'timeout':0xea60,'json':!![]};return rp(_0x482ed5)['then'](function(_0x95783c){_0x293ba8(_0x95783c);})[_0xfa53('0xd')](function(_0x18e5ef){_0x4e5621(_0x18e5ef);});});}function manageLicense(_0x470f2b,_0x516562){var _0xf8d9af=_0x516562[_0xfa53('0xe')]({'plain':!![]});if(!isOldTokenSent&&_0xf8d9af['data1']!==_0x470f2b&&!_0xf8d9af['data2']){oldToken=_0xf8d9af[_0xfa53('0xf')];}httpRequest(_0x470f2b)['then'](function(_0x3c9c8e){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x3c9c8e[_0xfa53('0x10')]){isOldTokenSent=![];if(!_0xf8d9af[_0xfa53('0x11')]&&_0xf8d9af[_0xfa53('0x11')]!=_0x3c9c8e[_0xfa53('0x11')]||_0xf8d9af[_0xfa53('0x11')]&&_0xf8d9af[_0xfa53('0x12')]){logger[_0xfa53('0x13')]('THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED');}if(_0xf8d9af[_0xfa53('0x11')]&&!_0xf8d9af['data2']&&_0xf8d9af[_0xfa53('0x11')]!=_0x3c9c8e['license']){logger['info'](_0xfa53('0x14'));}if(_0xf8d9af[_0xfa53('0x11')]&&!_0xf8d9af[_0xfa53('0x12')]&&_0xf8d9af[_0xfa53('0x11')]==_0x3c9c8e[_0xfa53('0x11')]){return _0x516562;}return _0x516562[_0xfa53('0x15')]({'data1':_0x470f2b,'data2':null,'license':_0x3c9c8e[_0xfa53('0x11')]});}else{if(_0x3c9c8e['license']||_0xf8d9af[_0xfa53('0x11')]){if(!_0xf8d9af['data2']){if(_0xf8d9af[_0xfa53('0xf')]==_0x470f2b){GRAY_PERIOD_REASON=_0xfa53('0x16');logger[_0xfa53('0x13')](_0xfa53('0x17'));}else{GRAY_PERIOD_REASON='Changed';logger[_0xfa53('0x13')](_0xfa53('0x18'),_0xf8d9af[_0xfa53('0xf')],_0x470f2b);}logger['info'](_0xfa53('0x19'),GRAY_PERIOD_REASON[_0xfa53('0x1a')](),moment()[_0xfa53('0x9')](_0xfa53('0x1b')));return _0x516562[_0xfa53('0x15')]({'data2':encryptor['encryptString'](moment()[_0xfa53('0x9')](_0xfa53('0x1b')))});}else{if(moment()[_0xfa53('0x1c')](encryptor['decryptString'](_0xf8d9af[_0xfa53('0x12')]),_0xfa53('0x1d'))>DAYS){logger[_0xfa53('0x13')](_0xfa53('0x1e'),moment()[_0xfa53('0x9')](_0xfa53('0x1b')));isOldTokenSent=![];return _0x516562[_0xfa53('0x15')]({'data1':_0x470f2b,'data2':null,'license':null});}}}else{if(_0xf8d9af[_0xfa53('0xf')]!=_0x470f2b){logger[_0xfa53('0x13')](_0xfa53('0x18'),_0xf8d9af[_0xfa53('0xf')],_0x470f2b);return _0x516562[_0xfa53('0x15')]({'data1':_0x470f2b,'data2':null,'license':null});}}}return _0x516562;})['then'](function(_0x20b210){_0x516562=_0x20b210;})['catch'](function(_0x3f8a97){logger[_0xfa53('0x1f')](_0x3f8a97[_0xfa53('0x20')]);})[_0xfa53('0x21')](function(){setTimeout(function(){manageLicense(hardware[_0xfa53('0x22')](),_0x516562);},TIME);});}function defaultLicense(){var _0x3f33e5=hardware['getUuid']();if(_0x3f33e5){return db['License'][_0xfa53('0x23')]({'where':{'id':0x1},'defaults':{'data1':_0x3f33e5}})[_0xfa53('0x24')](function(_0x171c21,_0x38bd88){logger['info']('SERVICE\x20LICENSE\x20STARTED\x20%s',_0x3f33e5);manageLicense(_0x3f33e5,_0x171c21);})['catch'](function(_0x5cc517){logger[_0xfa53('0x1f')](_0x5cc517[_0xfa53('0x20')]);});}}exports[_0xfa53('0x25')]=defaultLicense; \ No newline at end of file +var _0x51cf=['../../components/encryptor','./hardware','../logger','license','https://www.xcallymotion.com','%s/api/servers/%s/check?version=%s','version','format','then','catch','get','data1','data2','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','error','message','finally','getUuid','License','findOrCreate','SERVICE\x20LICENSE\x20STARTED\x20%s','default','moment','request-promise','pkginfo','../../mysqldb'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0x51cf,0x11b));var _0xf51c=function(_0x34cdd0,_0x2c4759){_0x34cdd0=_0x34cdd0-0x0;var _0x5664b3=_0x51cf[_0x34cdd0];return _0x5664b3;};'use strict';var util=require('util');var moment=require(_0xf51c('0x0'));var rp=require(_0xf51c('0x1'));var BPromise=require('bluebird');var pkginfo=require(_0xf51c('0x2'))(module,'version');var db=require(_0xf51c('0x3'))['db'];var encryptor=require(_0xf51c('0x4'));var hardware=require(_0xf51c('0x5'));var logger=require(_0xf51c('0x6'))(_0xf51c('0x7'));var HOST=_0xf51c('0x8');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x35c3a0){return new BPromise(function(_0x14eb2e,_0x19c71c){var _0x5a62e8=util['format'](_0xf51c('0x9'),HOST,_0x35c3a0,module['exports'][_0xf51c('0xa')]);if(oldToken){_0x5a62e8=util[_0xf51c('0xb')]('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0x35c3a0,module['exports'][_0xf51c('0xa')],oldToken);}var _0x31818a={'uri':_0x5a62e8,'method':'GET','timeout':0xea60,'json':!![]};return rp(_0x31818a)[_0xf51c('0xc')](function(_0x79258e){_0x14eb2e(_0x79258e);})[_0xf51c('0xd')](function(_0x137877){_0x19c71c(_0x137877);});});}function manageLicense(_0x7d3e4b,_0x4ab49d){var _0x58ae6f=_0x4ab49d[_0xf51c('0xe')]({'plain':!![]});if(!isOldTokenSent&&_0x58ae6f[_0xf51c('0xf')]!==_0x7d3e4b&&!_0x58ae6f[_0xf51c('0x10')]){oldToken=_0x58ae6f[_0xf51c('0xf')];}httpRequest(_0x7d3e4b)[_0xf51c('0xc')](function(_0x4a2ffd){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x4a2ffd[_0xf51c('0x11')]){isOldTokenSent=![];if(!_0x58ae6f['license']&&_0x58ae6f[_0xf51c('0x7')]!=_0x4a2ffd[_0xf51c('0x7')]||_0x58ae6f[_0xf51c('0x7')]&&_0x58ae6f[_0xf51c('0x10')]){logger[_0xf51c('0x12')](_0xf51c('0x13'));}if(_0x58ae6f['license']&&!_0x58ae6f[_0xf51c('0x10')]&&_0x58ae6f[_0xf51c('0x7')]!=_0x4a2ffd[_0xf51c('0x7')]){logger[_0xf51c('0x12')](_0xf51c('0x14'));}if(_0x58ae6f[_0xf51c('0x7')]&&!_0x58ae6f[_0xf51c('0x10')]&&_0x58ae6f[_0xf51c('0x7')]==_0x4a2ffd[_0xf51c('0x7')]){return _0x4ab49d;}return _0x4ab49d[_0xf51c('0x15')]({'data1':_0x7d3e4b,'data2':null,'license':_0x4a2ffd[_0xf51c('0x7')]});}else{if(_0x4a2ffd[_0xf51c('0x7')]||_0x58ae6f[_0xf51c('0x7')]){if(!_0x58ae6f[_0xf51c('0x10')]){if(_0x58ae6f['data1']==_0x7d3e4b){GRAY_PERIOD_REASON=_0xf51c('0x16');logger[_0xf51c('0x12')]('THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED');}else{GRAY_PERIOD_REASON=_0xf51c('0x17');logger[_0xf51c('0x12')](_0xf51c('0x18'),_0x58ae6f[_0xf51c('0xf')],_0x7d3e4b);}logger[_0xf51c('0x12')](_0xf51c('0x19'),GRAY_PERIOD_REASON[_0xf51c('0x1a')](),moment()['format'](_0xf51c('0x1b')));return _0x4ab49d['update']({'data2':encryptor[_0xf51c('0x1c')](moment()[_0xf51c('0xb')]('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()[_0xf51c('0x1d')](encryptor[_0xf51c('0x1e')](_0x58ae6f[_0xf51c('0x10')]),_0xf51c('0x1f'))>DAYS){logger['info'](_0xf51c('0x20'),moment()[_0xf51c('0xb')]('YYYY-MM-DD\x20HH:mm'));isOldTokenSent=![];return _0x4ab49d[_0xf51c('0x15')]({'data1':_0x7d3e4b,'data2':null,'license':null});}}}else{if(_0x58ae6f['data1']!=_0x7d3e4b){logger[_0xf51c('0x12')](_0xf51c('0x18'),_0x58ae6f[_0xf51c('0xf')],_0x7d3e4b);return _0x4ab49d[_0xf51c('0x15')]({'data1':_0x7d3e4b,'data2':null,'license':null});}}}return _0x4ab49d;})[_0xf51c('0xc')](function(_0x28242b){_0x4ab49d=_0x28242b;})[_0xf51c('0xd')](function(_0x4711b5){logger[_0xf51c('0x21')](_0x4711b5[_0xf51c('0x22')]);})[_0xf51c('0x23')](function(){setTimeout(function(){manageLicense(hardware[_0xf51c('0x24')](),_0x4ab49d);},TIME);});}function defaultLicense(){var _0xd82d45=hardware['getUuid']();if(_0xd82d45){return db[_0xf51c('0x25')][_0xf51c('0x26')]({'where':{'id':0x1},'defaults':{'data1':_0xd82d45}})['spread'](function(_0x263c97,_0x590008){logger[_0xf51c('0x12')](_0xf51c('0x27'),_0xd82d45);manageLicense(_0xd82d45,_0x263c97);})['catch'](function(_0x59b3c8){logger[_0xf51c('0x21')](_0x59b3c8[_0xf51c('0x22')]);});}}exports[_0xf51c('0x28')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 9d60c32..991bbb9 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 _0x288d=['License\x20limit\x20reached\x20for\x20users','exports','util','lodash','bluebird','./hardware','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','License','find','then','catch','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','decryptString','%s:%s:%s','demo','uuid','gray','add','days','format','grayReason','machineUuid','changed','disabled','message','User','role','sequelize','COUNT','count','admin','user','users','telephones','forEach','pick','countBy','telephone'];(function(_0x14d762,_0x2e1e94){var _0x165b2c=function(_0x7176c8){while(--_0x7176c8){_0x14d762['push'](_0x14d762['shift']());}};_0x165b2c(++_0x2e1e94);}(_0x288d,0x11c));var _0xd288=function(_0x49b3d,_0x27fe20){_0x49b3d=_0x49b3d-0x0;var _0x5a223b=_0x288d[_0x49b3d];return _0x5a223b;};'use strict';var util=require(_0xd288('0x0'));var _=require(_0xd288('0x1'));var moment=require('moment');var BPromise=require(_0xd288('0x2'));var hardware=require(_0xd288('0x3'));var encryptor=require('../../components/encryptor');var db=require(_0xd288('0x4'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xd288('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xd288('0x6'),'machineUuid':hardware[_0xd288('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xd288('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xd288('0x8'),'machineUuid':hardware[_0xd288('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x240513){return new BPromise(function(_0x5aa9f3,_0x5b76da){return db[_0xd288('0x9')][_0xd288('0xa')](_['defaults'](_0x240513,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x4b260d){return checkLicense(_0x4b260d,null);})[_0xd288('0xb')](function(_0x422af0){_0x5aa9f3(_0x422af0);return;})[_0xd288('0xc')](function(_0x26d576){_0x5b76da(_0x26d576);});});}function checkLicense(_0x2e52cc,_0x198cc3){if(!_0x2e52cc){demoLicense['uuid']=_0x2e52cc[_0xd288('0xd')];return demoLicense;}try{var _0x18784b=_0x198cc3||_0x2e52cc[_0xd288('0xe')];if(_[_0xd288('0xf')](_0x18784b)){throw new Error(_0xd288('0x10'));}var _0x28e4b3=_0x2e52cc['data1'];var _0x1c7dcc=_0x2e52cc[_0xd288('0x11')];var _0x2fc2ee=_0x28e4b3[_0xd288('0x12')]('-')[0x4];var _0x517991=_0x28e4b3[_0xd288('0x12')]('-')[0x0];var _0x25d4dc=encryptor[_0xd288('0x13')](_0x18784b,util['format'](_0xd288('0x14'),_0x2fc2ee,_0x28e4b3,_0x517991));var _0x126df3=JSON['parse'](_0x25d4dc);_0x126df3[_0xd288('0x15')]=![];_0x126df3[_0xd288('0x16')]=_0x28e4b3;_0x126df3['machineUuid']=hardware[_0xd288('0x7')]();if(_0x1c7dcc){var _0x1e919e=encryptor[_0xd288('0x13')](_0x1c7dcc);_0x126df3[_0xd288('0x17')]=_0x1e919e;_0x126df3['deadline']=moment(_0x1e919e)[_0xd288('0x18')](0x7,_0xd288('0x19'))[_0xd288('0x1a')]();_0x126df3[_0xd288('0x1b')]=_0x126df3[_0xd288('0x16')]!=_0x126df3[_0xd288('0x1c')]?_0xd288('0x1d'):_0xd288('0x1e');}return _0x126df3;}catch(_0x2e0397){breakingLicense[_0xd288('0x16')]=_0x2e52cc[_0xd288('0xd')];breakingLicense[_0xd288('0x1f')]=_0x2e0397['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x5475a6,_0x56a625){getLicense()['then'](function(_0x2a43a7){return db[_0xd288('0x20')]['findAll']({'attributes':[_0xd288('0x21'),[db[_0xd288('0x22')]['fn'](_0xd288('0x23'),db[_0xd288('0x22')]['col']('role')),_0xd288('0x24')]],'group':_0xd288('0x21'),'where':{'role':{'$or':[_0xd288('0x25'),_0xd288('0x26'),'telephone']}},'raw':!![]})[_0xd288('0xb')](function(_0x1df745){var _0xe510e9={'user':_0x2a43a7[_0xd288('0x27')]||0x0,'telephone':_0x2a43a7[_0xd288('0x28')]||0x0};_0x1df745[_0xd288('0x29')](function(_0x586428){var _0x5f4cdd=_0x586428['role']===_0xd288('0x25')?'user':_0x586428[_0xd288('0x21')];_0xe510e9[_0x5f4cdd]-=_0x586428[_0xd288('0x24')];if(_0xe510e9[_0x5f4cdd]<0x0)_0xe510e9[_0x5f4cdd]=0x0;});_0x5475a6(_0xe510e9);return;});})['catch'](function(_0x18df17){_0x56a625(_0x18df17);});});}function checkUserLimits(_0x2afd1a){return new BPromise(function(_0x4f8b82,_0x2ec5d4){getLimits()[_0xd288('0xb')](function(_0x5c8dee){var _0x70e87c=_[_0xd288('0x2a')](_[_0xd288('0x2b')](_0x2afd1a,'role'),['admin',_0xd288('0x26'),_0xd288('0x2c')]);var _0x3246c1=(_0x70e87c[_0xd288('0x25')]||0x0)+(_0x70e87c['user']||0x0);var _0x3b8a10=_0x70e87c[_0xd288('0x2c')]||0x0;if(_0x3246c1>_0x5c8dee[_0xd288('0x26')])return _0x2ec5d4(_0xd288('0x2d'));if(_0x3b8a10>_0x5c8dee[_0xd288('0x2c')])return _0x2ec5d4('License\x20limit\x20reached\x20for\x20telephones');return _0x4f8b82();})[_0xd288('0xc')](function(_0xdbde37){_0x2ec5d4(_0xdbde37);});});}module[_0xd288('0x2e')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x3cc8=['License','find','defaults','then','catch','uuid','license','License\x20key\x20value\x20not\x20found','data1','data2','split','decryptString','parse','demo','gray','deadline','add','days','format','grayReason','machineUuid','disabled','message','User','findAll','sequelize','COUNT','count','admin','user','telephone','users','telephones','forEach','role','pick','countBy','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','moment','bluebird','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license'];(function(_0x379ee5,_0x336c42){var _0x114694=function(_0x55b2f5){while(--_0x55b2f5){_0x379ee5['push'](_0x379ee5['shift']());}};_0x114694(++_0x336c42);}(_0x3cc8,0xef));var _0x83cc=function(_0x2ea5b0,_0x29bf0a){_0x2ea5b0=_0x2ea5b0-0x0;var _0x16671e=_0x3cc8[_0x2ea5b0];return _0x16671e;};'use strict';var util=require(_0x83cc('0x0'));var _=require(_0x83cc('0x1'));var moment=require(_0x83cc('0x2'));var BPromise=require(_0x83cc('0x3'));var hardware=require(_0x83cc('0x4'));var encryptor=require(_0x83cc('0x5'));var db=require(_0x83cc('0x6'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x83cc('0x7'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x83cc('0x8'),'machineUuid':hardware[_0x83cc('0x9')](),'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':_0x83cc('0xa'),'machineUuid':hardware[_0x83cc('0x9')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x15e9ce){return new BPromise(function(_0x470d5f,_0x2a6b9b){return db[_0x83cc('0xb')][_0x83cc('0xc')](_[_0x83cc('0xd')](_0x15e9ce,{'raw':!![],'where':{'id':0x1}}))[_0x83cc('0xe')](function(_0x2ce1af){return checkLicense(_0x2ce1af,null);})[_0x83cc('0xe')](function(_0xd86df){_0x470d5f(_0xd86df);return;})[_0x83cc('0xf')](function(_0xc374d7){_0x2a6b9b(_0xc374d7);});});}function checkLicense(_0x171197,_0x202d73){if(!_0x171197){demoLicense[_0x83cc('0x10')]=_0x171197['data1'];return demoLicense;}try{var _0x264813=_0x202d73||_0x171197[_0x83cc('0x11')];if(_['isEmpty'](_0x264813)){throw new Error(_0x83cc('0x12'));}var _0x356ad2=_0x171197[_0x83cc('0x13')];var _0x4ff922=_0x171197[_0x83cc('0x14')];var _0xe88ea9=_0x356ad2[_0x83cc('0x15')]('-')[0x4];var _0x50c5cb=_0x356ad2[_0x83cc('0x15')]('-')[0x0];var _0x4645a1=encryptor[_0x83cc('0x16')](_0x264813,util['format']('%s:%s:%s',_0xe88ea9,_0x356ad2,_0x50c5cb));var _0x4d561e=JSON[_0x83cc('0x17')](_0x4645a1);_0x4d561e[_0x83cc('0x18')]=![];_0x4d561e[_0x83cc('0x10')]=_0x356ad2;_0x4d561e['machineUuid']=hardware[_0x83cc('0x9')]();if(_0x4ff922){var _0x3f3026=encryptor[_0x83cc('0x16')](_0x4ff922);_0x4d561e[_0x83cc('0x19')]=_0x3f3026;_0x4d561e[_0x83cc('0x1a')]=moment(_0x3f3026)[_0x83cc('0x1b')](0x7,_0x83cc('0x1c'))[_0x83cc('0x1d')]();_0x4d561e[_0x83cc('0x1e')]=_0x4d561e[_0x83cc('0x10')]!=_0x4d561e[_0x83cc('0x1f')]?'changed':_0x83cc('0x20');}return _0x4d561e;}catch(_0x118beb){breakingLicense[_0x83cc('0x10')]=_0x171197[_0x83cc('0x13')];breakingLicense[_0x83cc('0x21')]=_0x118beb[_0x83cc('0x21')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x2b32c4,_0x141ffa){getLicense()[_0x83cc('0xe')](function(_0x15dbdb){return db[_0x83cc('0x22')][_0x83cc('0x23')]({'attributes':['role',[db[_0x83cc('0x24')]['fn'](_0x83cc('0x25'),db[_0x83cc('0x24')]['col']('role')),_0x83cc('0x26')]],'group':'role','where':{'role':{'$or':[_0x83cc('0x27'),_0x83cc('0x28'),_0x83cc('0x29')]}},'raw':!![]})[_0x83cc('0xe')](function(_0x41de43){var _0x29d6fb={'user':_0x15dbdb[_0x83cc('0x2a')]||0x0,'telephone':_0x15dbdb[_0x83cc('0x2b')]||0x0};_0x41de43[_0x83cc('0x2c')](function(_0x14f9bc){var _0x277b4a=_0x14f9bc[_0x83cc('0x2d')]===_0x83cc('0x27')?_0x83cc('0x28'):_0x14f9bc[_0x83cc('0x2d')];_0x29d6fb[_0x277b4a]-=_0x14f9bc[_0x83cc('0x26')];if(_0x29d6fb[_0x277b4a]<0x0)_0x29d6fb[_0x277b4a]=0x0;});_0x2b32c4(_0x29d6fb);return;});})[_0x83cc('0xf')](function(_0x56ef05){_0x141ffa(_0x56ef05);});});}function checkUserLimits(_0x37fa48){return new BPromise(function(_0x141a5a,_0xb36485){getLimits()['then'](function(_0x37f464){var _0x1cee46=_[_0x83cc('0x2e')](_[_0x83cc('0x2f')](_0x37fa48,'role'),[_0x83cc('0x27'),_0x83cc('0x28'),_0x83cc('0x29')]);var _0x2c081f=(_0x1cee46[_0x83cc('0x27')]||0x0)+(_0x1cee46['user']||0x0);var _0x56dbb8=_0x1cee46[_0x83cc('0x29')]||0x0;if(_0x2c081f>_0x37f464['user'])return _0xb36485('License\x20limit\x20reached\x20for\x20users');if(_0x56dbb8>_0x37f464[_0x83cc('0x29')])return _0xb36485(_0x83cc('0x30'));return _0x141a5a();})[_0x83cc('0xf')](function(_0x4371c2){_0xb36485(_0x4371c2);});});}module[_0x83cc('0x31')]={'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 6229708..44d5734 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 _0xfb11=['exports','myappanuglar-secret','app-id'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0xfb11,0x1ad));var _0x1fb1=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xfb11[_0x2dafbe];return _0x58a45a;};'use strict';module[_0x1fb1('0x0')]={'DOMAIN':'http://localhost:9000','SESSION_SECRET':_0x1fb1('0x1'),'GOOGLE_ID':_0x1fb1('0x2'),'GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file +var _0x02ce=['exports','http://localhost:9000','myappanuglar-secret','secret'];(function(_0x2e030e,_0x62bebe){var _0x219b15=function(_0x1300ef){while(--_0x1300ef){_0x2e030e['push'](_0x2e030e['shift']());}};_0x219b15(++_0x62bebe);}(_0x02ce,0x1ac));var _0xe02c=function(_0x33fe2f,_0x5e2a6c){_0x33fe2f=_0x33fe2f-0x0;var _0x3e559b=_0x02ce[_0x33fe2f];return _0x3e559b;};'use strict';module[_0xe02c('0x0')]={'DOMAIN':_0xe02c('0x1'),'SESSION_SECRET':_0xe02c('0x2'),'GOOGLE_ID':'app-id','GOOGLE_SECRET':_0xe02c('0x3'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index e740c5d..2652e16 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3ab0=['fileLogger','../utils/loggers'];(function(_0x448637,_0x53a5d1){var _0x20ff53=function(_0x4c5c21){while(--_0x4c5c21){_0x448637['push'](_0x448637['shift']());}};_0x20ff53(++_0x53a5d1);}(_0x3ab0,0x133));var _0x03ab=function(_0x37b3ea,_0x38e2e2){_0x37b3ea=_0x37b3ea-0x0;var _0x1235d1=_0x3ab0[_0x37b3ea];return _0x1235d1;};'use strict';var fileLogger=require(_0x03ab('0x0'))[_0x03ab('0x1')];module['exports']=fileLogger; \ No newline at end of file +var _0x7685=['exports','../utils/loggers'];(function(_0x377e63,_0xd021b7){var _0x4b65af=function(_0x260035){while(--_0x260035){_0x377e63['push'](_0x377e63['shift']());}};_0x4b65af(++_0xd021b7);}(_0x7685,0x123));var _0x5768=function(_0x236ab2,_0x2e4675){_0x236ab2=_0x236ab2-0x0;var _0x54a047=_0x7685[_0x236ab2];return _0x54a047;};'use strict';var fileLogger=require(_0x5768('0x0'))['fileLogger'];module[_0x5768('0x1')]=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index e9afb72..2f0a695 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 _0xb854=['../../services/express/index.js','../../services/agi/index.js','email','routing','../../services/routing/index.js','xdr','../../services/xdr/index.js','exports','path','../../config/environment','resolve','join','root','legacy-libs','express'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0xb854,0x134));var _0x4b85=function(_0x5affbd,_0x594b38){_0x5affbd=_0x5affbd-0x0;var _0x5093a8=_0xb854[_0x5affbd];return _0x5093a8;};'use strict';var path=require(_0x4b85('0x0'));var cfg=require(_0x4b85('0x1'));var env={'NODE_PATH':path[_0x4b85('0x2')](path[_0x4b85('0x3')](cfg[_0x4b85('0x4')],_0x4b85('0x5')))};var pm2config={'apps':[{'name':_0x4b85('0x6'),'script':path[_0x4b85('0x3')](__dirname,_0x4b85('0x7')),'env':env},{'name':'ami','script':path['join'](__dirname,'../../services/ami/index.js'),'env':env},{'name':'agi','script':path[_0x4b85('0x3')](__dirname,_0x4b85('0x8')),'env':env},{'name':_0x4b85('0x9'),'script':path[_0x4b85('0x3')](__dirname,'../../services/email/index.js'),'env':env},{'name':_0x4b85('0xa'),'script':path[_0x4b85('0x3')](__dirname,_0x4b85('0xb')),'env':env},{'name':_0x4b85('0xc'),'script':path[_0x4b85('0x3')](__dirname,_0x4b85('0xd')),'env':env}]};module[_0x4b85('0xe')]=pm2config; \ No newline at end of file +var _0xcc03=['../../services/routing/index.js','xdr','../../services/xdr/index.js','exports','path','../../config/environment','resolve','root','legacy-libs','express','../../services/express/index.js','join','../../services/ami/index.js','../../services/agi/index.js','email','../../services/email/index.js','routing'];(function(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0xcc03,0x1e0));var _0x3cc0=function(_0x507403,_0x3f954d){_0x507403=_0x507403-0x0;var _0x1327c=_0xcc03[_0x507403];return _0x1327c;};'use strict';var path=require(_0x3cc0('0x0'));var cfg=require(_0x3cc0('0x1'));var env={'NODE_PATH':path[_0x3cc0('0x2')](path['join'](cfg[_0x3cc0('0x3')],_0x3cc0('0x4')))};var pm2config={'apps':[{'name':_0x3cc0('0x5'),'script':path['join'](__dirname,_0x3cc0('0x6')),'env':env},{'name':'ami','script':path[_0x3cc0('0x7')](__dirname,_0x3cc0('0x8')),'env':env},{'name':'agi','script':path[_0x3cc0('0x7')](__dirname,_0x3cc0('0x9')),'env':env},{'name':_0x3cc0('0xa'),'script':path[_0x3cc0('0x7')](__dirname,_0x3cc0('0xb')),'env':env},{'name':_0x3cc0('0xc'),'script':path[_0x3cc0('0x7')](__dirname,_0x3cc0('0xd')),'env':env},{'name':_0x3cc0('0xe'),'script':path[_0x3cc0('0x7')](__dirname,_0x3cc0('0xf')),'env':env}]};module[_0x3cc0('0x10')]=pm2config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index ea65504..955bd33 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 _0x2a9c=['saved','pm2','bluebird','./config','connected','start','then','disconnect','stop','restart','list','describe','delete','dump'];(function(_0x408393,_0x8dc565){var _0x98f75e=function(_0x13191b){while(--_0x13191b){_0x408393['push'](_0x408393['shift']());}};_0x98f75e(++_0x8dc565);}(_0x2a9c,0xd3));var _0xc2a9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2a9c[_0x3dd15e];return _0x231fd0;};'use strict';var pm2=require(_0xc2a9('0x0'));var BPromise=require(_0xc2a9('0x1'));var config=require(_0xc2a9('0x2'));function connect(){return new BPromise(function(_0x4c4dd4,_0x52cb0a){return pm2['connect'](function(_0x378e4e){if(_0x378e4e){return _0x52cb0a(_0x378e4e);}return _0x4c4dd4(_0xc2a9('0x3'));});});};exports[_0xc2a9('0x4')]=function(_0x1d458d){return connect()[_0xc2a9('0x5')](function(){return new BPromise(function(_0x4b4d7a,_0x292905){return pm2[_0xc2a9('0x4')](_0x1d458d,function(_0x59b1f2,_0x2c78a7){if(_0x59b1f2){return _0x292905(_0x59b1f2);}pm2[_0xc2a9('0x6')]();return _0x4b4d7a(_0x2c78a7);});});});};exports[_0xc2a9('0x7')]=function(_0x4479ef){return connect()['then'](function(){return new BPromise(function(_0x3906b4,_0xefb703){return pm2[_0xc2a9('0x7')](_0x4479ef,function(_0x4d6421,_0x2a0ef5){if(_0x4d6421){return _0xefb703(_0x4d6421);}pm2[_0xc2a9('0x6')]();return _0x3906b4(_0x2a0ef5);});});});};exports[_0xc2a9('0x8')]=function(_0x38b56d){return connect()[_0xc2a9('0x5')](function(){return new BPromise(function(_0x3c227c,_0x3f2e65){return pm2['restart'](_0x38b56d,function(_0xe650d7,_0x3d43e9){if(_0xe650d7){return _0x3f2e65(_0xe650d7);}pm2['disconnect']();return _0x3c227c(_0x3d43e9);});});});};exports[_0xc2a9('0x9')]=function(){return connect()[_0xc2a9('0x5')](function(){return new BPromise(function(_0x283e14,_0x14aeb3){return pm2[_0xc2a9('0x9')](function(_0x428f45,_0x1c6439){if(_0x428f45){return _0x14aeb3(_0x428f45);}pm2[_0xc2a9('0x6')]();return _0x283e14(_0x1c6439);});});});};exports[_0xc2a9('0xa')]=function(_0x2ac7dd){return connect()[_0xc2a9('0x5')](function(){return new BPromise(function(_0x121389,_0x19a772){return pm2[_0xc2a9('0xa')](_0x2ac7dd,function(_0x246b35,_0x2dbf71){if(_0x246b35){return _0x19a772(_0x246b35);}pm2[_0xc2a9('0x6')]();return _0x121389(_0x2dbf71);});});});};exports[_0xc2a9('0xb')]=function(_0x3ce800){return connect()['then'](function(){return new BPromise(function(_0x3f48ec,_0x1ef75d){return pm2['delete'](_0x3ce800,function(_0x52b779,_0x4cbf02){if(_0x52b779){return _0x1ef75d(_0x52b779);}pm2[_0xc2a9('0x6')]();return _0x3f48ec(_0x4cbf02);});});});};exports[_0xc2a9('0xc')]=function(){return connect()[_0xc2a9('0x5')](function(){return new BPromise(function(_0x419eca,_0x11cf95){return pm2[_0xc2a9('0xc')](function(_0x803364){if(_0x803364){return _0x11cf95(_0x803364);}return _0x419eca(_0xc2a9('0xd'));});});});}; \ No newline at end of file +var _0xd601=['connected','start','then','disconnect','restart','list','describe','delete','dump','saved','pm2','bluebird'];(function(_0x5460c1,_0x33a8e1){var _0x4ba58a=function(_0x16fe89){while(--_0x16fe89){_0x5460c1['push'](_0x5460c1['shift']());}};_0x4ba58a(++_0x33a8e1);}(_0xd601,0x17e));var _0x1d60=function(_0x204b4c,_0x24a4dd){_0x204b4c=_0x204b4c-0x0;var _0x4dcb77=_0xd601[_0x204b4c];return _0x4dcb77;};'use strict';var pm2=require(_0x1d60('0x0'));var BPromise=require(_0x1d60('0x1'));var config=require('./config');function connect(){return new BPromise(function(_0x22582e,_0x87b013){return pm2['connect'](function(_0x307b64){if(_0x307b64){return _0x87b013(_0x307b64);}return _0x22582e(_0x1d60('0x2'));});});};exports[_0x1d60('0x3')]=function(_0x3b9341){return connect()[_0x1d60('0x4')](function(){return new BPromise(function(_0x585914,_0x496a2a){return pm2[_0x1d60('0x3')](_0x3b9341,function(_0x5c2b5f,_0x247b81){if(_0x5c2b5f){return _0x496a2a(_0x5c2b5f);}pm2[_0x1d60('0x5')]();return _0x585914(_0x247b81);});});});};exports['stop']=function(_0xe69be7){return connect()['then'](function(){return new BPromise(function(_0x38388e,_0x5f46e4){return pm2['stop'](_0xe69be7,function(_0x2976d2,_0x4ecb5c){if(_0x2976d2){return _0x5f46e4(_0x2976d2);}pm2[_0x1d60('0x5')]();return _0x38388e(_0x4ecb5c);});});});};exports[_0x1d60('0x6')]=function(_0x3d9600){return connect()[_0x1d60('0x4')](function(){return new BPromise(function(_0x1e86f5,_0xb0ce0){return pm2[_0x1d60('0x6')](_0x3d9600,function(_0xbcb039,_0x19f51c){if(_0xbcb039){return _0xb0ce0(_0xbcb039);}pm2[_0x1d60('0x5')]();return _0x1e86f5(_0x19f51c);});});});};exports[_0x1d60('0x7')]=function(){return connect()['then'](function(){return new BPromise(function(_0x59ca88,_0x38d59b){return pm2[_0x1d60('0x7')](function(_0x201892,_0x11bd7a){if(_0x201892){return _0x38d59b(_0x201892);}pm2[_0x1d60('0x5')]();return _0x59ca88(_0x11bd7a);});});});};exports['describe']=function(_0x5e454d){return connect()['then'](function(){return new BPromise(function(_0x13c667,_0x48c8f8){return pm2[_0x1d60('0x8')](_0x5e454d,function(_0xdff446,_0x193b64){if(_0xdff446){return _0x48c8f8(_0xdff446);}pm2[_0x1d60('0x5')]();return _0x13c667(_0x193b64);});});});};exports[_0x1d60('0x9')]=function(_0x2696cb){return connect()['then'](function(){return new BPromise(function(_0x26b607,_0x14b8bf){return pm2[_0x1d60('0x9')](_0x2696cb,function(_0x4cf594,_0x3339c7){if(_0x4cf594){return _0x14b8bf(_0x4cf594);}pm2[_0x1d60('0x5')]();return _0x26b607(_0x3339c7);});});});};exports[_0x1d60('0xa')]=function(){return connect()[_0x1d60('0x4')](function(){return new BPromise(function(_0x3a1317,_0x3b2b64){return pm2[_0x1d60('0xa')](function(_0x137656){if(_0x137656){return _0x3b2b64(_0x137656);}return _0x3a1317(_0x1d60('0xb'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index d1ba177..16bd75e 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 _0x969a=['then','ChatInteraction','findAll','lastMsgAt','subtract','minutes','length','map','info','join','update','system','timeout','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','catch','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','localhost','socket.io-emitter','Setting','find','chatTimeout'];(function(_0x2e7f96,_0x2ffe43){var _0x315277=function(_0x26bcae){while(--_0x26bcae){_0x2e7f96['push'](_0x2e7f96['shift']());}};_0x315277(++_0x2ffe43);}(_0x969a,0xed));var _0xa969=function(_0x384c8e,_0x247af6){_0x384c8e=_0x384c8e-0x0;var _0x186c6f=_0x969a[_0x384c8e];return _0x186c6f;};'use strict';var _=require(_0xa969('0x0'));var moment=require(_0xa969('0x1'));var Redis=require(_0xa969('0x2'));var util=require(_0xa969('0x3'));var config=require(_0xa969('0x4'));var db=require(_0xa969('0x5'))['db'];var logger=require(_0xa969('0x6'))(_0xa969('0x7'));config[_0xa969('0x8')]=_[_0xa969('0x9')](config[_0xa969('0x8')],{'host':_0xa969('0xa'),'port':0x18eb});var io=require(_0xa969('0xb'))(new Redis(config[_0xa969('0x8')]));function closeInteractions(){var _0x5c6eac=0x0;var _0x2a4442=[];return db[_0xa969('0xc')][_0xa969('0xd')]({'raw':!![],'attributes':['id',_0xa969('0xe')],'where':{'id':0x1}})[_0xa969('0xf')](function(_0x384d7a){_0x5c6eac=_0x384d7a['chatTimeout'];if(_0x5c6eac){return db[_0xa969('0x10')][_0xa969('0x11')]({'raw':!![],'attributes':['id',_0xa969('0x12')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xa969('0x13')](_0x384d7a[_0xa969('0xe')],_0xa969('0x14'))}}});}else{return[];}})[_0xa969('0xf')](function(_0x43ae35){if(_0x43ae35&&_0x43ae35[_0xa969('0x15')]){_0x2a4442=_[_0xa969('0x16')](_0x43ae35||[],'id');logger[_0xa969('0x17')]('[CHAT]\x20Interactions\x20to\x20close:',_0x2a4442[_0xa969('0x18')]());return db[_0xa969('0x10')][_0xa969('0x19')]({'closeReason':_0xa969('0x1a'),'disposition':_0xa969('0x1b'),'closed':!![],'closedAt':moment()['format'](_0xa969('0x1c'))},{'where':{'id':_0x2a4442}});}})[_0xa969('0xf')](function(){if(_0x2a4442&&_0x2a4442['length']){logger[_0xa969('0x17')](_0xa969('0x1d'),_0x2a4442['join']());for(var _0x578e1b=0x0;_0x578e1b<_0x2a4442['length'];_0x578e1b++){io[_0xa969('0x1e')](_0xa969('0x1f'),{'id':_0x2a4442[_0x578e1b],'closed':!![]});}}})[_0xa969('0x20')](function(_0x29a7fe){logger['error'](_0xa969('0x21'),_0x29a7fe?util[_0xa969('0x22')](_0x29a7fe,{'showHidden':![],'depth':null}):'');});}exports[_0xa969('0x23')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xa8bc=['error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','util','../../config/environment','../logger','schedule','redis','defaults','localhost','socket.io-emitter','Setting','find','chatTimeout','ChatInteraction','findAll','lastMsgAt','subtract','then','map','[CHAT]\x20Interactions\x20to\x20close:','join','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','length','info','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','catch'];(function(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0xa8bc,0x100));var _0xca8b=function(_0x301dab,_0x38050a){_0x301dab=_0x301dab-0x0;var _0x2500a2=_0xa8bc[_0x301dab];return _0x2500a2;};'use strict';var _=require(_0xca8b('0x0'));var moment=require(_0xca8b('0x1'));var Redis=require(_0xca8b('0x2'));var util=require(_0xca8b('0x3'));var config=require(_0xca8b('0x4'));var db=require('../../mysqldb')['db'];var logger=require(_0xca8b('0x5'))(_0xca8b('0x6'));config[_0xca8b('0x7')]=_[_0xca8b('0x8')](config['redis'],{'host':_0xca8b('0x9'),'port':0x18eb});var io=require(_0xca8b('0xa'))(new Redis(config[_0xca8b('0x7')]));function closeInteractions(){var _0x1e3372=0x0;var _0x5332c7=[];return db[_0xca8b('0xb')][_0xca8b('0xc')]({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})['then'](function(_0x15b626){_0x1e3372=_0x15b626[_0xca8b('0xd')];if(_0x1e3372){return db[_0xca8b('0xe')][_0xca8b('0xf')]({'raw':!![],'attributes':['id',_0xca8b('0x10')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xca8b('0x11')](_0x15b626[_0xca8b('0xd')],'minutes')}}});}else{return[];}})[_0xca8b('0x12')](function(_0x9806a8){if(_0x9806a8&&_0x9806a8['length']){_0x5332c7=_[_0xca8b('0x13')](_0x9806a8||[],'id');logger['info'](_0xca8b('0x14'),_0x5332c7[_0xca8b('0x15')]());return db[_0xca8b('0xe')]['update']({'closeReason':_0xca8b('0x16'),'disposition':_0xca8b('0x17'),'closed':!![],'closedAt':moment()[_0xca8b('0x18')](_0xca8b('0x19'))},{'where':{'id':_0x5332c7}});}})['then'](function(){if(_0x5332c7&&_0x5332c7[_0xca8b('0x1a')]){logger[_0xca8b('0x1b')](_0xca8b('0x1c'),_0x5332c7['join']());for(var _0x393f73=0x0;_0x393f73<_0x5332c7[_0xca8b('0x1a')];_0x393f73++){io[_0xca8b('0x1d')](_0xca8b('0x1e'),{'id':_0x5332c7[_0x393f73],'closed':!![]});}}})[_0xca8b('0x1f')](function(_0x588391){logger[_0xca8b('0x20')](_0xca8b('0x21'),_0x588391?util[_0xca8b('0x22')](_0x588391,{'showHidden':![],'depth':null}):'');});}exports[_0xca8b('0x23')]=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 83882c2..e362fa2 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 _0xb178=['exports','../../api/cloudProvider/cloudProvider.oauth.js'];(function(_0x1ddedd,_0x485606){var _0xa3e1ac=function(_0x580444){while(--_0x580444){_0x1ddedd['push'](_0x1ddedd['shift']());}};_0xa3e1ac(++_0x485606);}(_0xb178,0x1b9));var _0x8b17=function(_0x403fc7,_0x32931a){_0x403fc7=_0x403fc7-0x0;var _0x5d0827=_0xb178[_0x403fc7];return _0x5d0827;};'use strict';function start(){var _0x554b64=require(_0x8b17('0x0'));return _0x554b64['startAllRefreshIntervals']();}module[_0x8b17('0x1')]={'intervals':{},'start':start}; \ No newline at end of file +var _0x3646=['../../api/cloudProvider/cloudProvider.oauth.js','startAllRefreshIntervals','exports'];(function(_0x2ddef8,_0x2675a4){var _0x38745d=function(_0x2d1f25){while(--_0x2d1f25){_0x2ddef8['push'](_0x2ddef8['shift']());}};_0x38745d(++_0x2675a4);}(_0x3646,0x7e));var _0x6364=function(_0xab992a,_0x5c91f2){_0xab992a=_0xab992a-0x0;var _0x358cfe=_0x3646[_0xab992a];return _0x358cfe;};'use strict';function start(){var _0x1eb3c7=require(_0x6364('0x0'));return _0x1eb3c7[_0x6364('0x1')]();}module[_0x6364('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 615a6e5..60c4ef0 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 _0x3a51=['subtractNumber','subtractNumber\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','scheduled','DefaultReportId','exec\x20defaul\x20report\x20id:%s','catch','CustomReportId','exec\x20custom\x20report\x20id:%s','runReport','no\x20report\x20id','Schedule','findAll','CloudProvider','keys','jobs','map','toString','difference','intersection','length','exists','stop','delete\x20cron','toRun','my\x20id','resolve','run\x20job','cron','active','isBetween','startAt','add','start','add\x20cron','deleteJob','stop\x20cron','endAt','update','update\x20cron','run','util','path','cron-job-manager','jayson/promise','bluebird','../logger','schedule','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','email','MailAccount','getSmtpOptions','format','\x22%s\x22\x20<%s>','name','Smtp','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractUnit','../../files/reports','savename','%s.%s','extname','zip','join','existsSync','Sent','message','attachments','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','status','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','request','SendMail','then','email\x20sent','error','error\x20mail','isNil'];(function(_0x123e7c,_0x37da85){var _0x38ef47=function(_0x558717){while(--_0x558717){_0x123e7c['push'](_0x123e7c['shift']());}};_0x38ef47(++_0x37da85);}(_0x3a51,0xd5));var _0x13a5=function(_0x353a1b,_0x58ce15){_0x353a1b=_0x353a1b-0x0;var _0x5472b9=_0x3a51[_0x353a1b];return _0x5472b9;};'use strict';var fs=require('fs');var util=require(_0x13a5('0x0'));var path=require(_0x13a5('0x1'));var _=require('lodash');var moment=require('moment');var CronJobManager=require(_0x13a5('0x2'));var jayson=require(_0x13a5('0x3'));var BPromise=require(_0x13a5('0x4'));var logger=require(_0x13a5('0x5'))(_0x13a5('0x6'));var db=require('../../mysqldb')['db'];var analyticCustomReportController=require(_0x13a5('0x7'));var analyticDefaultReportController=require(_0x13a5('0x8'));var client=jayson[_0x13a5('0x9')][_0x13a5('0xa')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x5f3c52,_0x19a765){return function(){logger[_0x13a5('0xb')]('Try\x20to\x20send\x20a\x20mail\x20to',_0x5f3c52[_0x13a5('0xc')]);var _0x349508=!![];var _0x5e3bb0=_0x5f3c52[_0x13a5('0xd')][_0x13a5('0xe')]();var _0x132303={'account':_0x5e3bb0,'message':{'from':util[_0x13a5('0xf')](_0x13a5('0x10'),_0x5f3c52[_0x13a5('0xd')][_0x13a5('0x11')],_0x5f3c52[_0x13a5('0xd')][_0x13a5('0xc')]||_0x5f3c52[_0x13a5('0xd')][_0x13a5('0x12')]['user']),'to':_0x5f3c52[_0x13a5('0xc')],'cc':_0x5f3c52['cc'],'bcc':_0x5f3c52[_0x13a5('0x13')],'subject':util[_0x13a5('0xf')](_0x13a5('0x14'),_0x19a765['name'],_0x5f3c52['subtractNumber'],_0x5f3c52[_0x13a5('0x15')])}};var _0x2b5340=path['join'](__dirname,_0x13a5('0x16'));var _0x56c4f9=_0x19a765[_0x13a5('0x17')];var _0x4ef0db=util['format'](_0x13a5('0x18'),path['basename'](_0x19a765[_0x13a5('0x17')],path[_0x13a5('0x19')](_0x19a765[_0x13a5('0x17')])),_0x13a5('0x1a'));var _0x1b3ef6=path[_0x13a5('0x1b')](_0x2b5340,_0x56c4f9);var _0x5aeed3=path[_0x13a5('0x1b')](_0x2b5340,_0x4ef0db);if(fs[_0x13a5('0x1c')](_0x1b3ef6)){_0x19a765['status']=_0x13a5('0x1d');_0x132303[_0x13a5('0x1e')][_0x13a5('0x1f')]=[{'filename':_0x56c4f9,'path':_0x1b3ef6}];_0x132303['message']['text']=util[_0x13a5('0xf')](_0x13a5('0x20'),JSON[_0x13a5('0x21')](_0x19a765,null,0x2));}else if(fs['existsSync'](_0x5aeed3)){_0x19a765[_0x13a5('0x22')]='Sent';_0x132303[_0x13a5('0x1e')][_0x13a5('0x1f')]=[{'filename':_0x4ef0db,'path':_0x5aeed3}];}else{_0x132303[_0x13a5('0x1e')]['text']=_0x13a5('0x23');if(!_0x5f3c52[_0x13a5('0x24')]){_0x349508=![];logger[_0x13a5('0xb')](_0x13a5('0x25'));}}if(_0x349508){return client[_0x13a5('0x26')](_0x13a5('0x27'),_0x132303)[_0x13a5('0x28')](function(_0x1c2e62){if(_0x1c2e62['error']){return logger['error']('error\x20mail',JSON[_0x13a5('0x21')](_0x1c2e62));}return logger[_0x13a5('0xb')](_0x13a5('0x29'));})['catch'](function(_0x257686){return logger[_0x13a5('0x2a')](_0x13a5('0x2b'),JSON['stringify'](_0x257686));});}};}function handleError(){return function(_0x49902b){return logger['error'](JSON['stringify'](_0x49902b));};}function handleResult(_0x38be07){return function(_0x58f5a6){logger[_0x13a5('0xb')]('data',JSON['stringify'](_0x58f5a6));if(_0x38be07[_0x13a5('0xd')]&&_0x38be07[_0x13a5('0xd')][_0x13a5('0x12')]&&!_[_0x13a5('0x2c')](_0x38be07[_0x13a5('0xc')])){setTimeout(handleSendEmail(_0x38be07,_0x58f5a6),0x3c*0x3e8);}};}function handleJob(_0x31bdf8){return function(){try{if(_[_0x13a5('0x2c')](_0x31bdf8[_0x13a5('0x2d')])){return logger[_0x13a5('0xb')](_0x13a5('0x2e'));}if(_[_0x13a5('0x2c')](_0x31bdf8[_0x13a5('0x15')])){return logger['info']('subtractUnit\x20null\x20or\x20undefined');}var _0x109d97={'startDate':moment()['subtract'](_0x31bdf8[_0x13a5('0x2d')],_0x31bdf8['subtractUnit'])[_0x13a5('0xf')](_0x13a5('0x2f')),'endDate':moment()['format'](_0x13a5('0x2f')),'type':_0x13a5('0x30'),'output':_0x31bdf8['output'],'name':_0x31bdf8['name']};if(!_['isNil'](_0x31bdf8[_0x13a5('0x31')])){logger[_0x13a5('0xb')](_0x13a5('0x32'),_0x31bdf8[_0x13a5('0x31')]);return analyticDefaultReportController['runReport']({'id':_0x31bdf8[_0x13a5('0x31')]},_0x109d97)[_0x13a5('0x28')](handleResult(_0x31bdf8))[_0x13a5('0x33')](handleError());}if(!_[_0x13a5('0x2c')](_0x31bdf8[_0x13a5('0x34')])){logger[_0x13a5('0xb')](_0x13a5('0x35'),_0x31bdf8['CustomReportId']);return analyticCustomReportController[_0x13a5('0x36')]({'id':_0x31bdf8[_0x13a5('0x34')]},_0x109d97)[_0x13a5('0x28')](handleResult(_0x31bdf8))['catch'](handleError());}}catch(_0x48c0d2){logger[_0x13a5('0x2a')](JSON[_0x13a5('0x21')](_0x48c0d2));}return logger[_0x13a5('0xb')](_0x13a5('0x37'));};}function getJobs(_0x1033ff){var _0x3370f7={};if(_0x1033ff){_0x3370f7['id']=_0x1033ff;}return db[_0x13a5('0x38')][_0x13a5('0x39')]({'where':_0x3370f7,'include':[{'model':db[_0x13a5('0xd')],'attributes':['id',_0x13a5('0x11'),_0x13a5('0xc')],'include':[{'model':db['MailServerOut'],'as':'Smtp','include':[{'model':db[_0x13a5('0x3a')],'as':'CloudProvider'}]}]}]})[_0x13a5('0x28')](function(_0x539d36){var _0xf51da8=_[_0x13a5('0x3b')](manager[_0x13a5('0x3c')]);var _0x227ab7=_[_0x13a5('0x3d')](_0x539d36,function(_0x1fc8fa){return _0x1fc8fa['id'][_0x13a5('0x3e')]();});var _0x2488d2=_['keyBy'](_0x539d36,function(_0x23084e){return _0x23084e['id'][_0x13a5('0x3e')]();});var _0x1a5e07=_0x1033ff?_0x227ab7:_[_0x13a5('0x3f')](_0x227ab7,_0xf51da8);var _0xdea780=_[_0x13a5('0x40')](_0x227ab7,_0xf51da8);var _0x117dc7=_[_0x13a5('0x3f')](_0xf51da8,_0x227ab7);var _0x2bad2c;var _0x427139;for(_0x2bad2c=0x0;_0x2bad2c<_0x117dc7[_0x13a5('0x41')]&&!_0x1033ff;_0x2bad2c+=0x1){_0x427139=_0x117dc7[_0x2bad2c][_0x13a5('0x3e')]();if(manager[_0x13a5('0x42')](_0x427139)){manager[_0x13a5('0x43')](_0x427139);manager['deleteJob'](_0x427139);logger[_0x13a5('0xb')](_0x13a5('0x44'),_0x427139);}}logger[_0x13a5('0xb')](_0x13a5('0x45'),JSON[_0x13a5('0x21')](_0x1a5e07));for(_0x2bad2c=0x0;_0x2bad2c<_0x1a5e07[_0x13a5('0x41')];_0x2bad2c+=0x1){_0x427139=_0x1a5e07[_0x2bad2c][_0x13a5('0x3e')]();logger[_0x13a5('0xb')]('index',_0x427139);if(_0x1033ff){logger[_0x13a5('0xb')](_0x13a5('0x46'),_0x1033ff);logger[_0x13a5('0xb')](JSON[_0x13a5('0x21')](_0x2488d2[_0x427139]));BPromise[_0x13a5('0x47')]()[_0x13a5('0x28')](handleJob(_0x2488d2[_0x427139]));logger[_0x13a5('0xb')](_0x13a5('0x48'),_0x2488d2[_0x427139][_0x13a5('0x11')],_0x2488d2[_0x427139][_0x13a5('0x49')]);}else if(_0x2488d2[_0x427139][_0x13a5('0x49')]&&_0x2488d2[_0x427139][_0x13a5('0x4a')]&&moment()[_0x13a5('0x4b')](_0x2488d2[_0x427139][_0x13a5('0x4c')],_0x2488d2[_0x427139]['endAt'])){manager[_0x13a5('0x4d')](_0x427139,_0x2488d2[_0x427139][_0x13a5('0x49')],handleJob(_0x2488d2[_0x427139]));manager[_0x13a5('0x4e')](_0x427139);logger[_0x13a5('0xb')](_0x13a5('0x4f'),_0x2488d2[_0x427139][_0x13a5('0x11')],_0x2488d2[_0x427139][_0x13a5('0x49')]);}else if(manager[_0x13a5('0x42')](_0x427139)){manager[_0x13a5('0x43')](_0x427139);manager[_0x13a5('0x50')](_0x427139);logger[_0x13a5('0xb')](_0x13a5('0x51'),_0x2488d2[_0x427139][_0x13a5('0x11')],_0x2488d2[_0x427139][_0x13a5('0x49')]);}}for(_0x2bad2c=0x0,_0x427139;_0x2bad2c<_0xdea780[_0x13a5('0x41')]&&!_0x1033ff;_0x2bad2c+=0x1){_0x427139=_0xdea780[_0x2bad2c][_0x13a5('0x3e')]();if(manager[_0x13a5('0x42')](_0x427139)){if(_0x2488d2[_0x427139][_0x13a5('0x49')]&&_0x2488d2[_0x427139][_0x13a5('0x4a')]&&moment()[_0x13a5('0x4b')](_0x2488d2[_0x427139][_0x13a5('0x4c')],_0x2488d2[_0x427139][_0x13a5('0x52')])){manager[_0x13a5('0x53')](_0x427139,_0x2488d2[_0x427139][_0x13a5('0x49')],handleJob(_0x2488d2[_0x427139]));logger[_0x13a5('0xb')](_0x13a5('0x54'),_0x2488d2[_0x427139]['name'],_0x2488d2[_0x427139]['cron']);}else{manager[_0x13a5('0x43')](_0x427139);manager[_0x13a5('0x50')](_0x427139);logger[_0x13a5('0xb')](_0x13a5('0x51'),_0x2488d2[_0x427139][_0x13a5('0x11')],_0x2488d2[_0x427139][_0x13a5('0x49')]);}}}})[_0x13a5('0x33')](function(_0xcd5175){logger[_0x13a5('0x2a')](JSON[_0x13a5('0x21')](_0xcd5175));});}exports[_0x13a5('0x55')]=function(_0x2f8106){return getJobs(_0x2f8106);};exports[_0x13a5('0x4e')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0xfd4d=['exists','deleteJob','stop\x20cron','active','startAt','update\x20cron','run','util','path','lodash','moment','cron-job-manager','jayson/promise','bluebird','schedule','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','getSmtpOptions','format','MailAccount','name','Smtp','user','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractUnit','join','../../files/reports','savename','%s.%s','basename','extname','zip','existsSync','Sent','message','attachments','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','status','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','request','then','error','error\x20mail','email\x20sent','catch','data','isNil','subtractNumber','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','DefaultReportId','runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','findAll','MailServerOut','CloudProvider','keys','jobs','toString','keyBy','difference','length','stop','delete\x20cron','index','my\x20id','resolve','cron','isBetween','endAt','add','start','add\x20cron'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0xfd4d,0x167));var _0xdfd4=function(_0x224a98,_0x7d4589){_0x224a98=_0x224a98-0x0;var _0x462ed6=_0xfd4d[_0x224a98];return _0x462ed6;};'use strict';var fs=require('fs');var util=require(_0xdfd4('0x0'));var path=require(_0xdfd4('0x1'));var _=require(_0xdfd4('0x2'));var moment=require(_0xdfd4('0x3'));var CronJobManager=require(_0xdfd4('0x4'));var jayson=require(_0xdfd4('0x5'));var BPromise=require(_0xdfd4('0x6'));var logger=require('../logger')(_0xdfd4('0x7'));var db=require('../../mysqldb')['db'];var analyticCustomReportController=require(_0xdfd4('0x8'));var analyticDefaultReportController=require(_0xdfd4('0x9'));var client=jayson[_0xdfd4('0xa')][_0xdfd4('0xb')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x7ab167,_0x433d15){return function(){logger[_0xdfd4('0xc')](_0xdfd4('0xd'),_0x7ab167[_0xdfd4('0xe')]);var _0x16d7df=!![];var _0x3119ab=_0x7ab167['MailAccount'][_0xdfd4('0xf')]();var _0x5cd43b={'account':_0x3119ab,'message':{'from':util[_0xdfd4('0x10')]('\x22%s\x22\x20<%s>',_0x7ab167[_0xdfd4('0x11')][_0xdfd4('0x12')],_0x7ab167[_0xdfd4('0x11')][_0xdfd4('0xe')]||_0x7ab167[_0xdfd4('0x11')][_0xdfd4('0x13')][_0xdfd4('0x14')]),'to':_0x7ab167[_0xdfd4('0xe')],'cc':_0x7ab167['cc'],'bcc':_0x7ab167[_0xdfd4('0x15')],'subject':util[_0xdfd4('0x10')](_0xdfd4('0x16'),_0x433d15['name'],_0x7ab167['subtractNumber'],_0x7ab167[_0xdfd4('0x17')])}};var _0x36f99d=path[_0xdfd4('0x18')](__dirname,_0xdfd4('0x19'));var _0x52fedb=_0x433d15[_0xdfd4('0x1a')];var _0x4dde09=util[_0xdfd4('0x10')](_0xdfd4('0x1b'),path[_0xdfd4('0x1c')](_0x433d15['savename'],path[_0xdfd4('0x1d')](_0x433d15[_0xdfd4('0x1a')])),_0xdfd4('0x1e'));var _0x1591c7=path[_0xdfd4('0x18')](_0x36f99d,_0x52fedb);var _0xa2735d=path[_0xdfd4('0x18')](_0x36f99d,_0x4dde09);if(fs[_0xdfd4('0x1f')](_0x1591c7)){_0x433d15['status']=_0xdfd4('0x20');_0x5cd43b[_0xdfd4('0x21')][_0xdfd4('0x22')]=[{'filename':_0x52fedb,'path':_0x1591c7}];_0x5cd43b[_0xdfd4('0x21')][_0xdfd4('0x23')]=util['format'](_0xdfd4('0x24'),JSON[_0xdfd4('0x25')](_0x433d15,null,0x2));}else if(fs[_0xdfd4('0x1f')](_0xa2735d)){_0x433d15[_0xdfd4('0x26')]=_0xdfd4('0x20');_0x5cd43b[_0xdfd4('0x21')][_0xdfd4('0x22')]=[{'filename':_0x4dde09,'path':_0xa2735d}];}else{_0x5cd43b[_0xdfd4('0x21')]['text']=_0xdfd4('0x27');if(!_0x7ab167[_0xdfd4('0x28')]){_0x16d7df=![];logger[_0xdfd4('0xc')](_0xdfd4('0x29'));}}if(_0x16d7df){return client[_0xdfd4('0x2a')]('SendMail',_0x5cd43b)[_0xdfd4('0x2b')](function(_0x2566a0){if(_0x2566a0[_0xdfd4('0x2c')]){return logger[_0xdfd4('0x2c')](_0xdfd4('0x2d'),JSON[_0xdfd4('0x25')](_0x2566a0));}return logger['info'](_0xdfd4('0x2e'));})[_0xdfd4('0x2f')](function(_0x2d3dc2){return logger[_0xdfd4('0x2c')]('error\x20mail',JSON[_0xdfd4('0x25')](_0x2d3dc2));});}};}function handleError(){return function(_0xe77280){return logger[_0xdfd4('0x2c')](JSON[_0xdfd4('0x25')](_0xe77280));};}function handleResult(_0x4af4ba){return function(_0x4ec36c){logger[_0xdfd4('0xc')](_0xdfd4('0x30'),JSON['stringify'](_0x4ec36c));if(_0x4af4ba[_0xdfd4('0x11')]&&_0x4af4ba['MailAccount'][_0xdfd4('0x13')]&&!_[_0xdfd4('0x31')](_0x4af4ba[_0xdfd4('0xe')])){setTimeout(handleSendEmail(_0x4af4ba,_0x4ec36c),0x3c*0x3e8);}};}function handleJob(_0x45e45f){return function(){try{if(_[_0xdfd4('0x31')](_0x45e45f[_0xdfd4('0x32')])){return logger['info'](_0xdfd4('0x33'));}if(_[_0xdfd4('0x31')](_0x45e45f[_0xdfd4('0x17')])){return logger['info'](_0xdfd4('0x34'));}var _0x4602b8={'startDate':moment()[_0xdfd4('0x35')](_0x45e45f['subtractNumber'],_0x45e45f[_0xdfd4('0x17')])['format'](_0xdfd4('0x36')),'endDate':moment()[_0xdfd4('0x10')](_0xdfd4('0x36')),'type':'scheduled','output':_0x45e45f['output'],'name':_0x45e45f[_0xdfd4('0x12')]};if(!_[_0xdfd4('0x31')](_0x45e45f[_0xdfd4('0x37')])){logger['info']('exec\x20defaul\x20report\x20id:%s',_0x45e45f[_0xdfd4('0x37')]);return analyticDefaultReportController[_0xdfd4('0x38')]({'id':_0x45e45f[_0xdfd4('0x37')]},_0x4602b8)['then'](handleResult(_0x45e45f))['catch'](handleError());}if(!_[_0xdfd4('0x31')](_0x45e45f[_0xdfd4('0x39')])){logger['info'](_0xdfd4('0x3a'),_0x45e45f[_0xdfd4('0x39')]);return analyticCustomReportController[_0xdfd4('0x38')]({'id':_0x45e45f['CustomReportId']},_0x4602b8)[_0xdfd4('0x2b')](handleResult(_0x45e45f))[_0xdfd4('0x2f')](handleError());}}catch(_0x4fde2d){logger[_0xdfd4('0x2c')](JSON[_0xdfd4('0x25')](_0x4fde2d));}return logger[_0xdfd4('0xc')](_0xdfd4('0x3b'));};}function getJobs(_0x2a134a){var _0x4c5221={};if(_0x2a134a){_0x4c5221['id']=_0x2a134a;}return db[_0xdfd4('0x3c')][_0xdfd4('0x3d')]({'where':_0x4c5221,'include':[{'model':db[_0xdfd4('0x11')],'attributes':['id',_0xdfd4('0x12'),_0xdfd4('0xe')],'include':[{'model':db[_0xdfd4('0x3e')],'as':'Smtp','include':[{'model':db[_0xdfd4('0x3f')],'as':_0xdfd4('0x3f')}]}]}]})[_0xdfd4('0x2b')](function(_0x344947){var _0x20cf09=_[_0xdfd4('0x40')](manager[_0xdfd4('0x41')]);var _0x3cb605=_['map'](_0x344947,function(_0x38ff8c){return _0x38ff8c['id'][_0xdfd4('0x42')]();});var _0x5a3c0a=_[_0xdfd4('0x43')](_0x344947,function(_0x58da98){return _0x58da98['id']['toString']();});var _0x41396a=_0x2a134a?_0x3cb605:_[_0xdfd4('0x44')](_0x3cb605,_0x20cf09);var _0x38dd08=_['intersection'](_0x3cb605,_0x20cf09);var _0x52bfb2=_['difference'](_0x20cf09,_0x3cb605);var _0x4b28d7;var _0x570289;for(_0x4b28d7=0x0;_0x4b28d7<_0x52bfb2[_0xdfd4('0x45')]&&!_0x2a134a;_0x4b28d7+=0x1){_0x570289=_0x52bfb2[_0x4b28d7]['toString']();if(manager['exists'](_0x570289)){manager[_0xdfd4('0x46')](_0x570289);manager['deleteJob'](_0x570289);logger[_0xdfd4('0xc')](_0xdfd4('0x47'),_0x570289);}}logger[_0xdfd4('0xc')]('toRun',JSON['stringify'](_0x41396a));for(_0x4b28d7=0x0;_0x4b28d7<_0x41396a[_0xdfd4('0x45')];_0x4b28d7+=0x1){_0x570289=_0x41396a[_0x4b28d7][_0xdfd4('0x42')]();logger['info'](_0xdfd4('0x48'),_0x570289);if(_0x2a134a){logger[_0xdfd4('0xc')](_0xdfd4('0x49'),_0x2a134a);logger[_0xdfd4('0xc')](JSON[_0xdfd4('0x25')](_0x5a3c0a[_0x570289]));BPromise[_0xdfd4('0x4a')]()[_0xdfd4('0x2b')](handleJob(_0x5a3c0a[_0x570289]));logger['info']('run\x20job',_0x5a3c0a[_0x570289][_0xdfd4('0x12')],_0x5a3c0a[_0x570289][_0xdfd4('0x4b')]);}else if(_0x5a3c0a[_0x570289][_0xdfd4('0x4b')]&&_0x5a3c0a[_0x570289]['active']&&moment()[_0xdfd4('0x4c')](_0x5a3c0a[_0x570289]['startAt'],_0x5a3c0a[_0x570289][_0xdfd4('0x4d')])){manager[_0xdfd4('0x4e')](_0x570289,_0x5a3c0a[_0x570289][_0xdfd4('0x4b')],handleJob(_0x5a3c0a[_0x570289]));manager[_0xdfd4('0x4f')](_0x570289);logger[_0xdfd4('0xc')](_0xdfd4('0x50'),_0x5a3c0a[_0x570289]['name'],_0x5a3c0a[_0x570289][_0xdfd4('0x4b')]);}else if(manager[_0xdfd4('0x51')](_0x570289)){manager[_0xdfd4('0x46')](_0x570289);manager[_0xdfd4('0x52')](_0x570289);logger[_0xdfd4('0xc')](_0xdfd4('0x53'),_0x5a3c0a[_0x570289][_0xdfd4('0x12')],_0x5a3c0a[_0x570289][_0xdfd4('0x4b')]);}}for(_0x4b28d7=0x0,_0x570289;_0x4b28d7<_0x38dd08['length']&&!_0x2a134a;_0x4b28d7+=0x1){_0x570289=_0x38dd08[_0x4b28d7]['toString']();if(manager[_0xdfd4('0x51')](_0x570289)){if(_0x5a3c0a[_0x570289]['cron']&&_0x5a3c0a[_0x570289][_0xdfd4('0x54')]&&moment()[_0xdfd4('0x4c')](_0x5a3c0a[_0x570289][_0xdfd4('0x55')],_0x5a3c0a[_0x570289]['endAt'])){manager['update'](_0x570289,_0x5a3c0a[_0x570289][_0xdfd4('0x4b')],handleJob(_0x5a3c0a[_0x570289]));logger[_0xdfd4('0xc')](_0xdfd4('0x56'),_0x5a3c0a[_0x570289][_0xdfd4('0x12')],_0x5a3c0a[_0x570289][_0xdfd4('0x4b')]);}else{manager['stop'](_0x570289);manager['deleteJob'](_0x570289);logger[_0xdfd4('0xc')](_0xdfd4('0x53'),_0x5a3c0a[_0x570289][_0xdfd4('0x12')],_0x5a3c0a[_0x570289][_0xdfd4('0x4b')]);}}}})['catch'](function(_0x1b749d){logger[_0xdfd4('0x2c')](JSON['stringify'](_0x1b749d));});}exports[_0xdfd4('0x57')]=function(_0xa507a3){return getJobs(_0xa507a3);};exports['start']=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file diff --git a/server/config/schedule/transcribe.js b/server/config/schedule/transcribe.js index 1e541d1..bca39d0 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 _0x8ba6=['request-promise','bluebird','../../mysqldb','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','transcribeRegion','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','fileText','TranscriptionJob','TranscriptionJobStatus','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','results','transcripts','transcript','update','tempSentiment','ValidationError','sentiment','sentimentAccountId','language','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','data2','Sequelize','Cloud\x20Provider\x20not\x20configured','sentimentRegion','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','SentimentScore','Positive','Neutral','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','FAILED','FailureReason','Sentiment\x20Analysis\x20not\x20requested','bucket','CloudProvider','Cloud\x20Provider\x20not\x20available','Sentiment','Negative','Mixed','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','length','No\x20transcribe\x20job\x20to\x20check','Setting','findOne','Settings\x20not\x20available','transcribeAccountId','forEach','all','catch','lodash'];(function(_0x1d558c,_0x1e497c){var _0x15767d=function(_0x26326d){while(--_0x26326d){_0x1d558c['push'](_0x1d558c['shift']());}};_0x15767d(++_0x1e497c);}(_0x8ba6,0x11b));var _0x68ba=function(_0x3f2eb0,_0x5dcfec){_0x3f2eb0=_0x3f2eb0-0x0;var _0x8b14ed=_0x8ba6[_0x3f2eb0];return _0x8b14ed;};var _=require(_0x68ba('0x0'));var AWS=require('aws-sdk');var rp=require(_0x68ba('0x1'));var util=require('util');var BPromise=require(_0x68ba('0x2'));var db=require(_0x68ba('0x3'))['db'];var logger=require(_0x68ba('0x4'))(_0x68ba('0x5'));function getTranscriptionJob(_0x59c60c,_0x4a5138,_0x77a639,_0x26f306){return new Promise(function(_0x14f5f6,_0x183957){var _0x2ad848=new AWS[(_0x68ba('0x6'))]({'accessKeyId':_0x4a5138,'secretAccessKey':_0x59c60c,'region':_0x77a639});_0x2ad848[_0x68ba('0x7')]({'TranscriptionJobName':_0x26f306},function(_0xc67bf0,_0x5aa5bd){if(_0xc67bf0){return _0x183957(_0xc67bf0);}else{return _0x14f5f6(_0x5aa5bd);}});});}function sentiment(_0x33891a,_0x31bec9,_0x1ec922,_0xdb9d36,_0x930fe0){return new Promise(function(_0x21daf0,_0x3b2a69){var _0x2cbef4=new AWS[(_0x68ba('0x8'))]({'accessKeyId':_0x31bec9,'secretAccessKey':_0x33891a,'region':_0x1ec922});_0x2cbef4[_0x68ba('0x9')]({'Text':_0xdb9d36,'LanguageCode':_0x930fe0['substring'](0x0,0x2)},function(_0x1a9aeb,_0x24a88b){if(_0x1a9aeb){return _0x3b2a69(_0x1a9aeb);}else{return _0x21daf0(_0x24a88b);}});});}function checkTranscribeJob(_0x505116,_0x57ba2c,_0x1ae736){var _0x577fe8;return new BPromise(function(_0xfe6f53,_0xdfa5da){logger[_0x68ba('0xa')](util[_0x68ba('0xb')](_0x68ba('0xc'),_0x505116['id'],_0x505116[_0x68ba('0xd')]));return getTranscriptionJob(_0x1ae736[_0x68ba('0xe')],_0x1ae736['data2'],_0x57ba2c[_0x68ba('0xf')],_0x505116[_0x68ba('0xd')])[_0x68ba('0x10')](function(_0x438dcc){logger[_0x68ba('0xa')](util['format'](_0x68ba('0x11'),_0x505116['id'],_0x505116[_0x68ba('0xd')],_0x438dcc['TranscriptionJob']['TranscriptionJobStatus']));if(!_0x505116[_0x68ba('0x12')]){switch(_0x438dcc[_0x68ba('0x13')][_0x68ba('0x14')]){case _0x68ba('0x15'):var _0x23df55={'transcribeStatus':_0x438dcc[_0x68ba('0x13')][_0x68ba('0x14')],'fileUri':_0x438dcc[_0x68ba('0x13')][_0x68ba('0x16')][_0x68ba('0x17')]};logger[_0x68ba('0xa')](util[_0x68ba('0xb')](_0x68ba('0x18'),_0x505116['id']));return rp({'uri':_0x438dcc['TranscriptionJob']['Transcript'][_0x68ba('0x17')],'json':!![]})['then'](function(_0x27ed6a){logger[_0x68ba('0xa')](util[_0x68ba('0xb')]('[RECORDING:%d]\x20Transcript\x20downloaded',_0x505116['id']));if(_0x27ed6a&&_0x27ed6a['results']&&_0x27ed6a[_0x68ba('0x19')][_0x68ba('0x1a')]&&_0x27ed6a[_0x68ba('0x19')][_0x68ba('0x1a')]['length']){_0x23df55['fileText']='';for(var _0x10d265=0x0;_0x10d265<_0x27ed6a[_0x68ba('0x19')][_0x68ba('0x1a')]['length'];_0x10d265++){_0x23df55[_0x68ba('0x12')]+=_0x27ed6a['results'][_0x68ba('0x1a')][_0x10d265][_0x68ba('0x1b')]+'';}}return _0x505116[_0x68ba('0x1c')](_0x23df55);})['then'](function(){logger[_0x68ba('0xa')](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x505116['id']));if(!_0x505116[_0x68ba('0x1d')]){throw new db['Sequelize'][(_0x68ba('0x1e'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x57ba2c[_0x68ba('0x1f')]||!_0x57ba2c[_0x68ba('0x20')]||!_0x57ba2c['sentimentRegion']||!_0x57ba2c[_0x68ba('0x21')]||!_0x57ba2c['bucket']){throw new db['Sequelize'][(_0x68ba('0x1e'))](_0x68ba('0x22'));}if(!_0x23df55[_0x68ba('0x12')]){throw new Error(_0x68ba('0x23'));}if(_0x57ba2c['sentimentAccountId']===_0x1ae736['id']){return _0x1ae736;}else{return db['CloudProvider']['findOne']({'where':{'id':_settings[_0x68ba('0x20')]}});}})[_0x68ba('0x10')](function(_0x4974e0){if(!_0x4974e0){throw new db['Sequelize']['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0x4974e0[_0x68ba('0xe')]||!_0x4974e0[_0x68ba('0x24')]){throw new db[(_0x68ba('0x25'))][(_0x68ba('0x1e'))](_0x68ba('0x26'));}_0x577fe8=_0x4974e0;logger[_0x68ba('0xa')](util['format']('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x505116['id']));return sentiment(_0x577fe8[_0x68ba('0xe')],_0x577fe8[_0x68ba('0x24')],_0x57ba2c[_0x68ba('0x27')],_0x23df55[_0x68ba('0x12')],_0x57ba2c[_0x68ba('0x21')]);})[_0x68ba('0x10')](function(_0x57fa43){logger[_0x68ba('0xa')](util[_0x68ba('0xb')](_0x68ba('0x28'),_0x505116['id']));return _0x505116[_0x68ba('0x1c')]({'sentiment':_0x57fa43['Sentiment'],'sPositive':_0x57fa43[_0x68ba('0x29')][_0x68ba('0x2a')],'sNegative':_0x57fa43[_0x68ba('0x29')]['Negative'],'sMixed':_0x57fa43['SentimentScore']['Mixed'],'sNeutral':_0x57fa43[_0x68ba('0x29')][_0x68ba('0x2b')]});})[_0x68ba('0x10')](function(){logger['info'](util[_0x68ba('0xb')](_0x68ba('0x2c'),_0x505116['id']));_0xfe6f53();});case'FAILED':return _0x505116[_0x68ba('0x1c')]({'transcribeStatus':_0x68ba('0x2d'),'failureReason':_0x438dcc[_0x68ba('0x13')][_0x68ba('0x2e')]})[_0x68ba('0x10')](function(){logger[_0x68ba('0xa')](util[_0x68ba('0xb')](_0x68ba('0x2c'),_0x505116['id']));_0xfe6f53();});default:logger[_0x68ba('0xa')](util[_0x68ba('0xb')]('[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed',_0x505116['id']));break;}}else{return BPromise['resolve']()[_0x68ba('0x10')](function(){if(!_0x505116[_0x68ba('0x1d')]){throw new db[(_0x68ba('0x25'))][(_0x68ba('0x1e'))](_0x68ba('0x2f'));}if(!_0x57ba2c[_0x68ba('0x1f')]||!_0x57ba2c[_0x68ba('0x20')]||!_0x57ba2c[_0x68ba('0x27')]||!_0x57ba2c[_0x68ba('0x21')]||!_0x57ba2c[_0x68ba('0x30')]){throw new db['Sequelize']['ValidationError'](_0x68ba('0x22'));}if(!_0x505116[_0x68ba('0x12')]){throw new Error(_0x68ba('0x23'));}if(_0x57ba2c['sentimentAccountId']===_0x1ae736['id']){return _0x1ae736;}else{return db[_0x68ba('0x31')]['findOne']({'where':{'id':_settings[_0x68ba('0x20')]}});}})[_0x68ba('0x10')](function(_0x37ea9b){if(!_0x37ea9b){throw new db[(_0x68ba('0x25'))][(_0x68ba('0x1e'))](_0x68ba('0x32'));}if(!_0x37ea9b[_0x68ba('0xe')]||!_0x37ea9b[_0x68ba('0x24')]){throw new db[(_0x68ba('0x25'))]['ValidationError'](_0x68ba('0x26'));}_0x577fe8=_0x37ea9b;logger[_0x68ba('0xa')](util[_0x68ba('0xb')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x505116['id']));return sentiment(_0x577fe8[_0x68ba('0xe')],_0x577fe8[_0x68ba('0x24')],_0x57ba2c[_0x68ba('0x27')],_0x505116[_0x68ba('0x12')],_0x57ba2c[_0x68ba('0x21')]);})['then'](function(_0x2e7625){logger[_0x68ba('0xa')](util[_0x68ba('0xb')](_0x68ba('0x28'),_0x505116['id']));return _0x505116[_0x68ba('0x1c')]({'sentiment':_0x2e7625[_0x68ba('0x33')],'sPositive':_0x2e7625[_0x68ba('0x29')][_0x68ba('0x2a')],'sNegative':_0x2e7625['SentimentScore'][_0x68ba('0x34')],'sMixed':_0x2e7625['SentimentScore'][_0x68ba('0x35')],'sNeutral':_0x2e7625[_0x68ba('0x29')][_0x68ba('0x2b')],'transcribeStatus':'COMPLETED'});})[_0x68ba('0x10')](function(){logger[_0x68ba('0xa')](util[_0x68ba('0xb')](_0x68ba('0x2c'),_0x505116['id']));_0xfe6f53();});}})['catch'](function(_0x522b74){if(_0x522b74){if(!_0x522b74[_0x68ba('0x36')]||_0x522b74[_0x68ba('0x36')]!==_0x68ba('0x37')){logger[_0x68ba('0x38')](util['format'](_0x68ba('0x39'),_0x505116['id']),util[_0x68ba('0x3a')](_0x522b74,{'showHidden':![],'depth':null}));}}_0xfe6f53();});});}function checkTranscribe(){var _0x137c0c;var _0x1e0a2a;var _0x388ff2;return db[_0x68ba('0x3b')][_0x68ba('0x3c')]({'where':{'transcribeStatus':_0x68ba('0x3d')}})[_0x68ba('0x10')](function(_0x13f056){if(!_0x13f056||!_0x13f056[_0x68ba('0x3e')]){throw new db[(_0x68ba('0x25'))]['ValidationError'](_0x68ba('0x3f'));}_0x137c0c=_0x13f056;return db[_0x68ba('0x40')][_0x68ba('0x41')]({'where':{'id':0x1}});})[_0x68ba('0x10')](function(_0x158732){if(!_0x158732){throw new db[(_0x68ba('0x25'))]['ValidationError'](_0x68ba('0x42'));}_0x1e0a2a=_0x158732;if(!_0x1e0a2a['transcribe']||!_0x1e0a2a[_0x68ba('0x43')]||!_0x1e0a2a[_0x68ba('0xf')]||!_0x1e0a2a[_0x68ba('0x21')]||!_0x1e0a2a[_0x68ba('0x30')]){throw new db[(_0x68ba('0x25'))][(_0x68ba('0x1e'))]('Transcribe\x20not\x20configured');}return db[_0x68ba('0x31')][_0x68ba('0x41')]({'where':{'id':_0x1e0a2a['transcribeAccountId']}});})['then'](function(_0x375f98){if(!_0x375f98){throw new db[(_0x68ba('0x25'))][(_0x68ba('0x1e'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x375f98['data1']||!_0x375f98[_0x68ba('0x24')]){throw new db[(_0x68ba('0x25'))][(_0x68ba('0x1e'))](_0x68ba('0x26'));}_0x388ff2=_0x375f98;var _0x46b6ba=[];_0x137c0c[_0x68ba('0x44')](function(_0x480eb7){_0x46b6ba['push'](checkTranscribeJob(_0x480eb7,_0x1e0a2a,_0x388ff2));});return BPromise[_0x68ba('0x45')](_0x46b6ba);})[_0x68ba('0x46')](function(_0x5067ac){if(_0x5067ac){if(!_0x5067ac[_0x68ba('0x36')]||_0x5067ac[_0x68ba('0x36')]!==_0x68ba('0x37')){logger['error'](util[_0x68ba('0x3a')](_0x5067ac,{'showHidden':![],'depth':null}));}}});}exports['start']=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x1df7=['[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','update','tempSentiment','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','bucket','Sequelize','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','Sentiment','SentimentScore','Negative','Mixed','Neutral','FailureReason','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','resolve','language','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Positive','name','SequelizeValidationError','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','IN_PROGRESS','Settings\x20not\x20available','Transcribe\x20not\x20configured','transcribeAccountId','push','all','catch','start','aws-sdk','request-promise','util','bluebird','../../mysqldb','../../config/logger','transcribe','getTranscriptionJob','detectSentiment','substring','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','transcribeRegion','then','info','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','TranscriptFileUri'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x1df7,0x6e));var _0x71df=function(_0x4585c8,_0xe158ee){_0x4585c8=_0x4585c8-0x0;var _0x50d4dc=_0x1df7[_0x4585c8];return _0x50d4dc;};var _=require('lodash');var AWS=require(_0x71df('0x0'));var rp=require(_0x71df('0x1'));var util=require(_0x71df('0x2'));var BPromise=require(_0x71df('0x3'));var db=require(_0x71df('0x4'))['db'];var logger=require(_0x71df('0x5'))(_0x71df('0x6'));function getTranscriptionJob(_0x3e3a06,_0x20c662,_0x2b8342,_0x343763){return new Promise(function(_0x4364ea,_0x481a2f){var _0x2fe258=new AWS['TranscribeService']({'accessKeyId':_0x20c662,'secretAccessKey':_0x3e3a06,'region':_0x2b8342});_0x2fe258[_0x71df('0x7')]({'TranscriptionJobName':_0x343763},function(_0x88acfd,_0x4a21c4){if(_0x88acfd){return _0x481a2f(_0x88acfd);}else{return _0x4364ea(_0x4a21c4);}});});}function sentiment(_0x32f8cd,_0x4a4575,_0x3cb3be,_0x58b68c,_0x50c892){return new Promise(function(_0x23bc36,_0x3515f5){var _0x6fa316=new AWS['Comprehend']({'accessKeyId':_0x4a4575,'secretAccessKey':_0x32f8cd,'region':_0x3cb3be});_0x6fa316[_0x71df('0x8')]({'Text':_0x58b68c,'LanguageCode':_0x50c892[_0x71df('0x9')](0x0,0x2)},function(_0x4aacdc,_0x2dbd3e){if(_0x4aacdc){return _0x3515f5(_0x4aacdc);}else{return _0x23bc36(_0x2dbd3e);}});});}function checkTranscribeJob(_0x349233,_0xca1e85,_0x5d5776){var _0x50de5b;return new BPromise(function(_0x43cae3,_0x1374cc){logger['info'](util[_0x71df('0xa')](_0x71df('0xb'),_0x349233['id'],_0x349233[_0x71df('0xc')]));return getTranscriptionJob(_0x5d5776[_0x71df('0xd')],_0x5d5776[_0x71df('0xe')],_0xca1e85[_0x71df('0xf')],_0x349233[_0x71df('0xc')])[_0x71df('0x10')](function(_0x20e521){logger[_0x71df('0x11')](util[_0x71df('0xa')](_0x71df('0x12'),_0x349233['id'],_0x349233['transcribeName'],_0x20e521[_0x71df('0x13')][_0x71df('0x14')]));if(!_0x349233[_0x71df('0x15')]){switch(_0x20e521[_0x71df('0x13')]['TranscriptionJobStatus']){case _0x71df('0x16'):var _0x414b70={'transcribeStatus':_0x20e521[_0x71df('0x13')][_0x71df('0x14')],'fileUri':_0x20e521[_0x71df('0x13')]['Transcript'][_0x71df('0x17')]};logger[_0x71df('0x11')](util[_0x71df('0xa')]('[RECORDING:%d]\x20Get\x20transcript',_0x349233['id']));return rp({'uri':_0x20e521[_0x71df('0x13')]['Transcript']['TranscriptFileUri'],'json':!![]})[_0x71df('0x10')](function(_0x573738){logger['info'](util[_0x71df('0xa')](_0x71df('0x18'),_0x349233['id']));if(_0x573738&&_0x573738['results']&&_0x573738[_0x71df('0x19')][_0x71df('0x1a')]&&_0x573738['results'][_0x71df('0x1a')][_0x71df('0x1b')]){_0x414b70[_0x71df('0x15')]='';for(var _0xf59cdc=0x0;_0xf59cdc<_0x573738[_0x71df('0x19')]['transcripts'][_0x71df('0x1b')];_0xf59cdc++){_0x414b70[_0x71df('0x15')]+=_0x573738['results'][_0x71df('0x1a')][_0xf59cdc]['transcript']+'';}}return _0x349233[_0x71df('0x1c')](_0x414b70);})[_0x71df('0x10')](function(){logger[_0x71df('0x11')](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x349233['id']));if(!_0x349233[_0x71df('0x1d')]){throw new db['Sequelize'][(_0x71df('0x1e'))](_0x71df('0x1f'));}if(!_0xca1e85[_0x71df('0x20')]||!_0xca1e85[_0x71df('0x21')]||!_0xca1e85[_0x71df('0x22')]||!_0xca1e85['language']||!_0xca1e85[_0x71df('0x23')]){throw new db[(_0x71df('0x24'))][(_0x71df('0x1e'))](_0x71df('0x25'));}if(!_0x414b70['fileText']){throw new Error(_0x71df('0x26'));}if(_0xca1e85['sentimentAccountId']===_0x5d5776['id']){return _0x5d5776;}else{return db[_0x71df('0x27')][_0x71df('0x28')]({'where':{'id':_settings[_0x71df('0x21')]}});}})[_0x71df('0x10')](function(_0x489fb7){if(!_0x489fb7){throw new db[(_0x71df('0x24'))][(_0x71df('0x1e'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x489fb7[_0x71df('0xd')]||!_0x489fb7[_0x71df('0xe')]){throw new db['Sequelize'][(_0x71df('0x1e'))](_0x71df('0x29'));}_0x50de5b=_0x489fb7;logger[_0x71df('0x11')](util[_0x71df('0xa')](_0x71df('0x2a'),_0x349233['id']));return sentiment(_0x50de5b[_0x71df('0xd')],_0x50de5b[_0x71df('0xe')],_0xca1e85[_0x71df('0x22')],_0x414b70[_0x71df('0x15')],_0xca1e85['language']);})[_0x71df('0x10')](function(_0x4c8552){logger[_0x71df('0x11')](util[_0x71df('0xa')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x349233['id']));return _0x349233[_0x71df('0x1c')]({'sentiment':_0x4c8552[_0x71df('0x2b')],'sPositive':_0x4c8552['SentimentScore']['Positive'],'sNegative':_0x4c8552[_0x71df('0x2c')][_0x71df('0x2d')],'sMixed':_0x4c8552[_0x71df('0x2c')][_0x71df('0x2e')],'sNeutral':_0x4c8552['SentimentScore'][_0x71df('0x2f')]});})[_0x71df('0x10')](function(){logger[_0x71df('0x11')](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x349233['id']));_0x43cae3();});case'FAILED':return _0x349233['update']({'transcribeStatus':'FAILED','failureReason':_0x20e521[_0x71df('0x13')][_0x71df('0x30')]})[_0x71df('0x10')](function(){logger[_0x71df('0x11')](util['format'](_0x71df('0x31'),_0x349233['id']));_0x43cae3();});default:logger[_0x71df('0x11')](util[_0x71df('0xa')]('[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed',_0x349233['id']));break;}}else{return BPromise[_0x71df('0x32')]()[_0x71df('0x10')](function(){if(!_0x349233[_0x71df('0x1d')]){throw new db[(_0x71df('0x24'))]['ValidationError'](_0x71df('0x1f'));}if(!_0xca1e85['sentiment']||!_0xca1e85[_0x71df('0x21')]||!_0xca1e85['sentimentRegion']||!_0xca1e85['language']||!_0xca1e85[_0x71df('0x23')]){throw new db[(_0x71df('0x24'))]['ValidationError'](_0x71df('0x25'));}if(!_0x349233['fileText']){throw new Error(_0x71df('0x26'));}if(_0xca1e85['sentimentAccountId']===_0x5d5776['id']){return _0x5d5776;}else{return db[_0x71df('0x27')][_0x71df('0x28')]({'where':{'id':_settings[_0x71df('0x21')]}});}})[_0x71df('0x10')](function(_0x57b975){if(!_0x57b975){throw new db['Sequelize'][(_0x71df('0x1e'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x57b975[_0x71df('0xd')]||!_0x57b975[_0x71df('0xe')]){throw new db['Sequelize'][(_0x71df('0x1e'))](_0x71df('0x29'));}_0x50de5b=_0x57b975;logger['info'](util[_0x71df('0xa')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x349233['id']));return sentiment(_0x50de5b['data1'],_0x50de5b[_0x71df('0xe')],_0xca1e85[_0x71df('0x22')],_0x349233[_0x71df('0x15')],_0xca1e85[_0x71df('0x33')]);})[_0x71df('0x10')](function(_0x4e3f7b){logger[_0x71df('0x11')](util['format'](_0x71df('0x34'),_0x349233['id']));return _0x349233[_0x71df('0x1c')]({'sentiment':_0x4e3f7b[_0x71df('0x2b')],'sPositive':_0x4e3f7b[_0x71df('0x2c')][_0x71df('0x35')],'sNegative':_0x4e3f7b[_0x71df('0x2c')][_0x71df('0x2d')],'sMixed':_0x4e3f7b[_0x71df('0x2c')][_0x71df('0x2e')],'sNeutral':_0x4e3f7b[_0x71df('0x2c')]['Neutral'],'transcribeStatus':_0x71df('0x16')});})[_0x71df('0x10')](function(){logger[_0x71df('0x11')](util[_0x71df('0xa')](_0x71df('0x31'),_0x349233['id']));_0x43cae3();});}})['catch'](function(_0x4ce38c){if(_0x4ce38c){if(!_0x4ce38c[_0x71df('0x36')]||_0x4ce38c['name']!==_0x71df('0x37')){logger['error'](util[_0x71df('0xa')](_0x71df('0x38'),_0x349233['id']),util[_0x71df('0x39')](_0x4ce38c,{'showHidden':![],'depth':null}));}}_0x43cae3();});});}function checkTranscribe(){var _0x4e1bd7;var _0x31372d;var _0x10cd2f;return db[_0x71df('0x3a')]['findAll']({'where':{'transcribeStatus':_0x71df('0x3b')}})['then'](function(_0x3ca940){if(!_0x3ca940||!_0x3ca940[_0x71df('0x1b')]){throw new db[(_0x71df('0x24'))][(_0x71df('0x1e'))]('No\x20transcribe\x20job\x20to\x20check');}_0x4e1bd7=_0x3ca940;return db['Setting'][_0x71df('0x28')]({'where':{'id':0x1}});})['then'](function(_0x146543){if(!_0x146543){throw new db[(_0x71df('0x24'))][(_0x71df('0x1e'))](_0x71df('0x3c'));}_0x31372d=_0x146543;if(!_0x31372d['transcribe']||!_0x31372d['transcribeAccountId']||!_0x31372d[_0x71df('0xf')]||!_0x31372d['language']||!_0x31372d[_0x71df('0x23')]){throw new db[(_0x71df('0x24'))][(_0x71df('0x1e'))](_0x71df('0x3d'));}return db[_0x71df('0x27')][_0x71df('0x28')]({'where':{'id':_0x31372d[_0x71df('0x3e')]}});})[_0x71df('0x10')](function(_0x253aab){if(!_0x253aab){throw new db[(_0x71df('0x24'))][(_0x71df('0x1e'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x253aab[_0x71df('0xd')]||!_0x253aab[_0x71df('0xe')]){throw new db[(_0x71df('0x24'))][(_0x71df('0x1e'))](_0x71df('0x29'));}_0x10cd2f=_0x253aab;var _0x3e9df3=[];_0x4e1bd7['forEach'](function(_0x1bb880){_0x3e9df3[_0x71df('0x3f')](checkTranscribeJob(_0x1bb880,_0x31372d,_0x10cd2f));});return BPromise[_0x71df('0x40')](_0x3e9df3);})[_0x71df('0x41')](function(_0x3722c8){if(_0x3722c8){if(!_0x3722c8[_0x71df('0x36')]||_0x3722c8[_0x71df('0x36')]!==_0x71df('0x37')){logger['error'](util[_0x71df('0x39')](_0x3722c8,{'showHidden':![],'depth':null}));}}});}exports[_0x71df('0x42')]=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 a3a3560..07b0a2d 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 _0xc60b=['hours','then','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','WhatsappInteraction','update','timeout','YYYY-MM-DD\x20HH:mm:ss','length','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','catch','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','ioredis','util','../../config/environment','../../mysqldb','redis','defaults','localhost','findAll','lastMsgAt','subtract'];(function(_0x5c2eac,_0x566843){var _0x7f47f9=function(_0x19612c){while(--_0x19612c){_0x5c2eac['push'](_0x5c2eac['shift']());}};_0x7f47f9(++_0x566843);}(_0xc60b,0x1c1));var _0xbc60=function(_0x2da149,_0x1d02f3){_0x2da149=_0x2da149-0x0;var _0x3b9b8d=_0xc60b[_0x2da149];return _0x3b9b8d;};'use strict';var _=require('lodash');var moment=require('moment');var Redis=require(_0xbc60('0x0'));var util=require(_0xbc60('0x1'));var config=require(_0xbc60('0x2'));var db=require(_0xbc60('0x3'))['db'];var logger=require('../logger')('schedule');config[_0xbc60('0x4')]=_[_0xbc60('0x5')](config[_0xbc60('0x4')],{'host':_0xbc60('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function closeInteractions(){var _0x3ff9a7=[];return db['WhatsappInteraction'][_0xbc60('0x7')]({'raw':!![],'attributes':['id',_0xbc60('0x8')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xbc60('0x9')](0x18,_0xbc60('0xa'))}}})[_0xbc60('0xb')](function(_0x5e33fc){if(_0x5e33fc&&_0x5e33fc['length']){_0x3ff9a7=_['map'](_0x5e33fc||[],'id');logger[_0xbc60('0xc')](_0xbc60('0xd'),_0x3ff9a7[_0xbc60('0xe')]());return db[_0xbc60('0xf')][_0xbc60('0x10')]({'closeReason':'system','disposition':_0xbc60('0x11'),'closed':!![],'closedAt':moment()['format'](_0xbc60('0x12'))},{'where':{'id':_0x3ff9a7}});}})[_0xbc60('0xb')](function(){if(_0x3ff9a7&&_0x3ff9a7[_0xbc60('0x13')]){logger[_0xbc60('0xc')](_0xbc60('0x14'),_0x3ff9a7[_0xbc60('0xe')]());for(var _0x338a7e=0x0;_0x338a7e<_0x3ff9a7[_0xbc60('0x13')];_0x338a7e++){io[_0xbc60('0x15')](_0xbc60('0x16'),{'id':_0x3ff9a7[_0x338a7e],'closed':!![]});}}})[_0xbc60('0x17')](function(_0x3a0ad2){logger['error'](_0xbc60('0x18'),_0x3a0ad2?util[_0xbc60('0x19')](_0x3a0ad2,{'showHidden':![],'depth':null}):'');});}exports[_0xbc60('0x1a')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xf7ec=['../logger','schedule','redis','localhost','socket.io-emitter','WhatsappInteraction','lastMsgAt','hours','then','length','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','emit','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','moment','ioredis','../../config/environment','../../mysqldb'];(function(_0x28ecad,_0x25fed2){var _0x5dd722=function(_0x5e9152){while(--_0x5e9152){_0x28ecad['push'](_0x28ecad['shift']());}};_0x5dd722(++_0x25fed2);}(_0xf7ec,0x1cc));var _0xcf7e=function(_0x26c55a,_0x3a8983){_0x26c55a=_0x26c55a-0x0;var _0x267a21=_0xf7ec[_0x26c55a];return _0x267a21;};'use strict';var _=require('lodash');var moment=require(_0xcf7e('0x0'));var Redis=require(_0xcf7e('0x1'));var util=require('util');var config=require(_0xcf7e('0x2'));var db=require(_0xcf7e('0x3'))['db'];var logger=require(_0xcf7e('0x4'))(_0xcf7e('0x5'));config[_0xcf7e('0x6')]=_['defaults'](config['redis'],{'host':_0xcf7e('0x7'),'port':0x18eb});var io=require(_0xcf7e('0x8'))(new Redis(config[_0xcf7e('0x6')]));function closeInteractions(){var _0x447bd5=[];return db[_0xcf7e('0x9')]['findAll']({'raw':!![],'attributes':['id',_0xcf7e('0xa')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()['subtract'](0x18,_0xcf7e('0xb'))}}})[_0xcf7e('0xc')](function(_0x2ea2b7){if(_0x2ea2b7&&_0x2ea2b7[_0xcf7e('0xd')]){_0x447bd5=_['map'](_0x2ea2b7||[],'id');logger[_0xcf7e('0xe')](_0xcf7e('0xf'),_0x447bd5[_0xcf7e('0x10')]());return db[_0xcf7e('0x9')][_0xcf7e('0x11')]({'closeReason':_0xcf7e('0x12'),'disposition':_0xcf7e('0x13'),'closed':!![],'closedAt':moment()[_0xcf7e('0x14')](_0xcf7e('0x15'))},{'where':{'id':_0x447bd5}});}})[_0xcf7e('0xc')](function(){if(_0x447bd5&&_0x447bd5['length']){logger[_0xcf7e('0xe')]('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0x447bd5[_0xcf7e('0x10')]());for(var _0x324700=0x0;_0x324700<_0x447bd5[_0xcf7e('0xd')];_0x324700++){io[_0xcf7e('0x16')](_0xcf7e('0x17'),{'id':_0x447bd5[_0x324700],'closed':!![]});}}})[_0xcf7e('0x18')](function(_0x51e391){logger[_0xcf7e('0x19')](_0xcf7e('0x1a'),_0x51e391?util[_0xcf7e('0x1b')](_0x51e391,{'showHidden':![],'depth':null}):'');});}exports[_0xcf7e('0x1c')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/seedContact.js b/server/config/seedContact.js index ea0020b..79c349b 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8346=['util','../mysqldb','Innocenzo','push','now','innocenzo.biondo','@xcally.com','destroy','then','CmContact','bulkCreate','log','finished\x20populating','contacts1','CmHopper','contacts2'];(function(_0x390e59,_0x17fb61){var _0x3b4a3c=function(_0x4e1ce6){while(--_0x4e1ce6){_0x390e59['push'](_0x390e59['shift']());}};_0x3b4a3c(++_0x17fb61);}(_0x8346,0x120));var _0x6834=function(_0x4cd12d,_0x109c1f){_0x4cd12d=_0x4cd12d-0x0;var _0x53749c=_0x8346[_0x4cd12d];return _0x53749c;};'use strict';var util=require(_0x6834('0x0'));var db=require(_0x6834('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':_0x6834('0x2')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+'@xcally.com'});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x6834('0x3')]({'id':i,'active':![],'scheduledat':Date[_0x6834('0x4')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x6834('0x4')](),'updatedAt':Date[_0x6834('0x4')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x6834('0x3')]({'id':i,'firstName':'Innocenzo'+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0x6834('0x5')+i+_0x6834('0x6')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date[_0x6834('0x4')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x6834('0x4')](),'updatedAt':Date[_0x6834('0x4')]()});}db['CmContact'][_0x6834('0x7')]({'where':{}})[_0x6834('0x8')](function(){return db[_0x6834('0x9')][_0x6834('0xa')](contacts);})['then'](function(){console[_0x6834('0xb')](_0x6834('0xc'),_0x6834('0xd'));return db['CmHopper'][_0x6834('0x7')]({'where':{}});})[_0x6834('0x8')](function(){return db[_0x6834('0xe')][_0x6834('0xa')](hopper);})[_0x6834('0x8')](function(){console[_0x6834('0xb')](_0x6834('0xc'),'hopper1');return db[_0x6834('0x9')][_0x6834('0xa')](contacts2);})['then'](function(){console[_0x6834('0xb')]('finished\x20populating',_0x6834('0xf'));return db[_0x6834('0xe')][_0x6834('0xa')](hopper2);})[_0x6834('0x8')](function(){console[_0x6834('0xb')](_0x6834('0xc'),'hopper2');})['catch'](function(_0x3ab97c){console[_0x6834('0xb')](_0x3ab97c);}); \ No newline at end of file +var _0x67d8=['destroy','bulkCreate','then','log','hopper1','contacts2','CmHopper','hopper2','util','push','innocenzo.biondo','now','Innocenzo','@xcally.com','CmContact'];(function(_0x544f22,_0x4d4ad8){var _0x47090b=function(_0x216ba5){while(--_0x216ba5){_0x544f22['push'](_0x544f22['shift']());}};_0x47090b(++_0x4d4ad8);}(_0x67d8,0x116));var _0x867d=function(_0x27cc66,_0x5d9e16){_0x27cc66=_0x27cc66-0x0;var _0x2c275e=_0x67d8[_0x27cc66];return _0x2c275e;};'use strict';var util=require(_0x867d('0x0'));var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x867d('0x1')]({'id':i,'firstName':'Innocenzo'+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0x867d('0x2')+i+'@xcally.com'});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x867d('0x1')]({'id':i,'active':![],'scheduledat':Date[_0x867d('0x3')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0x867d('0x4')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0x867d('0x2')+i+_0x867d('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x867d('0x1')]({'id':i,'active':![],'scheduledat':Date[_0x867d('0x3')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x867d('0x3')]()});}db[_0x867d('0x6')][_0x867d('0x7')]({'where':{}})['then'](function(){return db['CmContact'][_0x867d('0x8')](contacts);})[_0x867d('0x9')](function(){console[_0x867d('0xa')]('finished\x20populating','contacts1');return db['CmHopper'][_0x867d('0x7')]({'where':{}});})[_0x867d('0x9')](function(){return db['CmHopper']['bulkCreate'](hopper);})['then'](function(){console[_0x867d('0xa')]('finished\x20populating',_0x867d('0xb'));return db[_0x867d('0x6')][_0x867d('0x8')](contacts2);})['then'](function(){console[_0x867d('0xa')]('finished\x20populating',_0x867d('0xc'));return db[_0x867d('0xd')][_0x867d('0x8')](hopper2);})[_0x867d('0x9')](function(){console[_0x867d('0xa')]('finished\x20populating',_0x867d('0xe'));})['catch'](function(_0xbe4422){console[_0x867d('0xa')](_0xbe4422);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 46e3591..97754f3 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8507=['%s%s','agent','friend','wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','User','then','log','add\x20user','catch','../mysqldb','push','format'];(function(_0x264891,_0x162549){var _0x4968de=function(_0x5a4606){while(--_0x5a4606){_0x264891['push'](_0x264891['shift']());}};_0x4968de(++_0x162549);}(_0x8507,0xd5));var _0x7850=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8507[_0x20a584];return _0x4b41a8;};'use strict';var util=require('util');var db=require(_0x7850('0x0'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x7850('0x1')]({'name':util[_0x7850('0x2')](_0x7850('0x3'),_0x7850('0x4'),i),'fullname':util[_0x7850('0x2')]('%s%s',_0x7850('0x4'),i),'email':util['format']('%s%s@xcally.com',_0x7850('0x4'),i),'role':_0x7850('0x4'),'password':'password','internal':0xfa0+i,'type':_0x7850('0x5'),'transport':['udp','ws',_0x7850('0x6')],'disallow':[_0x7850('0x7')],'allow':[_0x7850('0x8')],'defaultuser':util['format']('%s%s',_0x7850('0x4'),i),'encryption':'yes','avpf':_0x7850('0x9'),'force_avp':_0x7850('0x9'),'icesupport':_0x7850('0x9'),'dtlsenable':_0x7850('0x9'),'dtlsverify':'no','dtlscertfile':_0x7850('0xa'),'dtlsprivatekey':_0x7850('0xb'),'dtlssetup':_0x7850('0xc'),'callerid':util['format']('\x22%s\x22\x20<%s>',util[_0x7850('0x2')]('%s%s',_0x7850('0x4'),i),0xfa0+i)});}db[_0x7850('0xd')]['bulkCreate'](users)[_0x7850('0xe')](function(){console[_0x7850('0xf')](_0x7850('0x10'));})[_0x7850('0x11')](function(_0x321dfe){console['log'](_0x321dfe);}); \ No newline at end of file +var _0x5e0d=['yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','%s%s','User','bulkCreate','then','log','add\x20user','catch','util','../mysqldb','agent','format','friend','udp','wss','all'];(function(_0x5608a3,_0x5b33c5){var _0x1ed50a=function(_0x959171){while(--_0x959171){_0x5608a3['push'](_0x5608a3['shift']());}};_0x1ed50a(++_0x5b33c5);}(_0x5e0d,0x19a));var _0xd5e0=function(_0x2faddb,_0xc18b78){_0x2faddb=_0x2faddb-0x0;var _0x273c05=_0x5e0d[_0x2faddb];return _0x273c05;};'use strict';var util=require(_0xd5e0('0x0'));var db=require(_0xd5e0('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util['format']('%s%s',_0xd5e0('0x2'),i),'fullname':util['format']('%s%s',_0xd5e0('0x2'),i),'email':util[_0xd5e0('0x3')]('%s%s@xcally.com',_0xd5e0('0x2'),i),'role':_0xd5e0('0x2'),'password':'password','internal':0xfa0+i,'type':_0xd5e0('0x4'),'transport':[_0xd5e0('0x5'),'ws',_0xd5e0('0x6')],'disallow':[_0xd5e0('0x7')],'allow':['ulaw'],'defaultuser':util[_0xd5e0('0x3')]('%s%s',_0xd5e0('0x2'),i),'encryption':_0xd5e0('0x8'),'avpf':_0xd5e0('0x8'),'force_avp':_0xd5e0('0x8'),'icesupport':_0xd5e0('0x8'),'dtlsenable':_0xd5e0('0x8'),'dtlsverify':'no','dtlscertfile':_0xd5e0('0x9'),'dtlsprivatekey':_0xd5e0('0xa'),'dtlssetup':_0xd5e0('0xb'),'callerid':util[_0xd5e0('0x3')]('\x22%s\x22\x20<%s>',util['format'](_0xd5e0('0xc'),_0xd5e0('0x2'),i),0xfa0+i)});}db[_0xd5e0('0xd')][_0xd5e0('0xe')](users)[_0xd5e0('0xf')](function(){console[_0xd5e0('0x10')](_0xd5e0('0x11'));})[_0xd5e0('0x12')](function(_0x31696f){console[_0xd5e0('0x10')](_0x31696f);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 3d288eb..f7920ca 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5d95=['removeOpenchannelInteractions','user_has_whatsapp_interactions:remove','catch','log','join','default','address','request','connection','remotePort','connectedAt','SocketIO\x20','nsp','disconnect','DISCONNECTED','CONNECTED','lodash','util','../mysqldb','./environment','name','Agents','User','role','telephone','UserProfileSection','findOne','then','autoAssociation','VoiceQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','Trunks','UserProfileResource','resourceId','map','where','Campaign','type','ivr','%s:queue:%s','length','format','user:%s','handshake','query','find','userProfileId','ChatInteraction','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','OpenchannelInteraction','WhatsappInteractions','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','ChatQueues','FaxQueues','IvrCampaigns','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getWhatsappQueues','voice','fax','sms','mail','openchannel','whatsapp','telephone:%s','agent','trunk:%s','campaign:%s:%s','leave','ChatInteractions','removeChatInteractions','emit','user_has_chat_interactions:remove','removeMailInteractions','user_has_mail_interactions:remove','removeSmsInteractions','OpenchannelInteractions'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x5d95,0x77));var _0x55d9=function(_0x1ea2e3,_0x1f7d08){_0x1ea2e3=_0x1ea2e3-0x0;var _0x341c7d=_0x5d95[_0x1ea2e3];return _0x341c7d;};'use strict';var _=require(_0x55d9('0x0'));var util=require(_0x55d9('0x1'));var BPromise=require('bluebird');var db=require(_0x55d9('0x2'))['db'];var config=require(_0x55d9('0x3'));var queryQueues={'attributes':['id',_0x55d9('0x4')],'include':[{'as':_0x55d9('0x5'),'model':db[_0x55d9('0x6')],'attributes':['id','name',_0x55d9('0x7')],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':_0x55d9('0x8')}};var queryTrunks={'raw':!![],'attributes':['id',_0x55d9('0x4')]};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id','name','type'],'where':{'type':'ivr'}};function getAssociatedResources(_0x2cece4,_0x52188f,_0x4d52fa){return db[_0x55d9('0x9')][_0x55d9('0xa')]({'where':{'name':_0x2cece4,'userProfileId':_0x52188f},'raw':!![]})[_0x55d9('0xb')](function(_0xfd0f08){if(_0xfd0f08){if(_0xfd0f08[_0x55d9('0xc')]){switch(_0x2cece4){case _0x55d9('0xd'):case'ChatQueues':case'FaxQueues':case _0x55d9('0xe'):case _0x55d9('0xf'):case _0x55d9('0x10'):case _0x55d9('0x11'):return db[_0x4d52fa][_0x55d9('0x12')](queryQueues);case _0x55d9('0x13'):return db[_0x4d52fa][_0x55d9('0x12')](queryTelephones);case _0x55d9('0x14'):return db[_0x4d52fa][_0x55d9('0x12')](queryTrunks);case'IvrCampaigns':return db[_0x4d52fa][_0x55d9('0x12')](queryCampaigns);}}else{return db[_0x55d9('0x15')][_0x55d9('0x12')]({'attributes':[_0x55d9('0x16')],'where':{'sectionId':_0xfd0f08['id']},'raw':!![]})[_0x55d9('0xb')](function(_0x3ec410){if(_0x3ec410){var _0x25fcf7={'where':{'id':_[_0x55d9('0x17')](_0x3ec410,_0x55d9('0x16'))},'raw':!![]};switch(_0x4d52fa){case _0x55d9('0x6'):_0x25fcf7[_0x55d9('0x18')][_0x55d9('0x7')]=_0x55d9('0x8');break;case _0x55d9('0x19'):_0x25fcf7['where'][_0x55d9('0x1a')]=_0x55d9('0x1b');break;}return db[_0x4d52fa]['findAll'](_0x25fcf7);}else{return[];}});}}else{return[];}})['then'](function(_0x5c56de){return _0x5c56de;});}function joinOrLeaveQueues(_0xed70ef,_0x1fbc68,_0x191c3e,_0x3e9645){_0xed70ef[_0x1fbc68](util['format'](_0x55d9('0x1c'),_0x191c3e,_0x3e9645[_0x55d9('0x4')]));if(_0x3e9645[_0x55d9('0x5')]){for(var _0x556d6f=0x0;_0x556d6f<_0x3e9645[_0x55d9('0x5')][_0x55d9('0x1d')];_0x556d6f+=0x1){_0xed70ef[_0x1fbc68](util[_0x55d9('0x1e')](_0x55d9('0x1f'),_0x3e9645['Agents'][_0x556d6f]['name']));}}}function joinOrLeave(_0x33ba58,_0x416cc6,_0x1f1b46){var _0x3e1eef;if(_0x33ba58[_0x55d9('0x20')][_0x55d9('0x21')]['id']){db[_0x55d9('0x6')][_0x55d9('0x22')]({'attributes':['id',_0x55d9('0x4'),'role',_0x55d9('0x23')],'where':{'id':_0x33ba58[_0x55d9('0x20')]['query']['id']},'include':[{'model':db[_0x55d9('0x24')],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x55d9('0x25')],'as':_0x55d9('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0x55d9('0x27')],'as':_0x55d9('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0x55d9('0x29')],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x55d9('0x2a')],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db['WhatsappInteraction'],'as':_0x55d9('0x2b'),'attributes':['id'],'raw':!![]}]})[_0x55d9('0xb')](function(_0x1b18bb){if(_0x1b18bb){_0x3e1eef=_0x1b18bb;_0x33ba58[_0x416cc6](util['format'](_0x55d9('0x1f'),_0x1b18bb[_0x55d9('0x4')]));var _0x3e2438=[];switch(_0x1b18bb[_0x55d9('0x7')]){case _0x55d9('0x2c'):_0x33ba58[_0x416cc6](_0x55d9('0x2d'));_0x33ba58[_0x416cc6](_0x55d9('0x2e'));if(queryQueues[_0x55d9('0x2f')](_0x55d9('0x30'))){delete queryQueues[_0x55d9('0x30')];}_0x3e2438[_0x55d9('0x31')](db[_0x55d9('0x32')][_0x55d9('0x12')](queryQueues));_0x3e2438[_0x55d9('0x31')](db[_0x55d9('0x33')][_0x55d9('0x12')](queryQueues));_0x3e2438[_0x55d9('0x31')](db[_0x55d9('0x34')][_0x55d9('0x12')](queryQueues));_0x3e2438[_0x55d9('0x31')](db[_0x55d9('0x35')][_0x55d9('0x12')](queryQueues));_0x3e2438[_0x55d9('0x31')](db[_0x55d9('0x36')]['findAll'](queryQueues));_0x3e2438['push'](db[_0x55d9('0x37')][_0x55d9('0x12')](queryQueues));_0x3e2438[_0x55d9('0x31')](db[_0x55d9('0x38')][_0x55d9('0x12')](queryQueues));_0x3e2438[_0x55d9('0x31')](db[_0x55d9('0x6')][_0x55d9('0x12')](queryTelephones));_0x3e2438['push'](db[_0x55d9('0x39')][_0x55d9('0x12')](queryTrunks));_0x3e2438[_0x55d9('0x31')](db[_0x55d9('0x19')][_0x55d9('0x12')](queryCampaigns));_0x3e2438['push'](db[_0x55d9('0x6')][_0x55d9('0x12')](queryAgents));break;case _0x55d9('0x3a'):_0x33ba58[_0x416cc6](_0x55d9('0x2d'));_0x33ba58[_0x416cc6](_0x55d9('0x2e'));_0x3e2438[_0x55d9('0x31')](getAssociatedResources(_0x55d9('0xd'),_0x1b18bb[_0x55d9('0x23')],_0x55d9('0x32')));_0x3e2438[_0x55d9('0x31')](getAssociatedResources(_0x55d9('0x3b'),_0x1b18bb[_0x55d9('0x23')],_0x55d9('0x33')));_0x3e2438[_0x55d9('0x31')](getAssociatedResources(_0x55d9('0x3c'),_0x1b18bb[_0x55d9('0x23')],_0x55d9('0x34')));_0x3e2438['push'](getAssociatedResources(_0x55d9('0xe'),_0x1b18bb['userProfileId'],_0x55d9('0x35')));_0x3e2438[_0x55d9('0x31')](getAssociatedResources(_0x55d9('0xf'),_0x1b18bb[_0x55d9('0x23')],'MailQueue'));_0x3e2438[_0x55d9('0x31')](getAssociatedResources(_0x55d9('0x10'),_0x1b18bb[_0x55d9('0x23')],_0x55d9('0x37')));_0x3e2438['push'](getAssociatedResources('WhatsappQueues',_0x1b18bb[_0x55d9('0x23')],_0x55d9('0x38')));_0x3e2438['push'](getAssociatedResources('Telephones',_0x1b18bb[_0x55d9('0x23')],_0x55d9('0x6')));_0x3e2438[_0x55d9('0x31')](getAssociatedResources(_0x55d9('0x14'),_0x1b18bb[_0x55d9('0x23')],_0x55d9('0x39')));_0x3e2438['push'](getAssociatedResources(_0x55d9('0x3d'),_0x1b18bb[_0x55d9('0x23')],_0x55d9('0x19')));_0x3e2438[_0x55d9('0x31')](db[_0x55d9('0x6')]['findAll'](queryAgents));break;case'agent':_0x33ba58[_0x416cc6](_0x55d9('0x2d'));_0x33ba58[_0x416cc6](_0x55d9('0x2e'));_0x3e2438[_0x55d9('0x31')](_0x1b18bb[_0x55d9('0x3e')]({'attributes':['id',_0x55d9('0x4')]}));_0x3e2438[_0x55d9('0x31')](_0x1b18bb[_0x55d9('0x3f')]({'attributes':['id','name']}));_0x3e2438[_0x55d9('0x31')](_0x1b18bb[_0x55d9('0x40')]({'attributes':['id',_0x55d9('0x4')]}));_0x3e2438[_0x55d9('0x31')](_0x1b18bb[_0x55d9('0x41')]({'attributes':['id','name']}));_0x3e2438['push'](_0x1b18bb[_0x55d9('0x42')]({'attributes':['id','name']}));_0x3e2438[_0x55d9('0x31')](_0x1b18bb['getOpenchannelQueues']({'attributes':['id',_0x55d9('0x4')]}));_0x3e2438[_0x55d9('0x31')](_0x1b18bb[_0x55d9('0x43')]({'attributes':['id',_0x55d9('0x4')]}));break;}return BPromise['all'](_0x3e2438);}})[_0x55d9('0xb')](function(_0x48cb80){if(_0x48cb80&&_0x48cb80['length']){for(var _0x5c0509=0x0;_0x5c0509<_0x48cb80[_0x55d9('0x1d')];_0x5c0509+=0x1){for(var _0x15e625=0x0;_0x15e625<_0x48cb80[_0x5c0509]['length'];_0x15e625+=0x1){switch(_0x5c0509){case 0x0:joinOrLeaveQueues(_0x33ba58,_0x416cc6,_0x55d9('0x44'),_0x48cb80[_0x5c0509][_0x15e625]);break;case 0x1:joinOrLeaveQueues(_0x33ba58,_0x416cc6,'chat',_0x48cb80[_0x5c0509][_0x15e625]);break;case 0x2:joinOrLeaveQueues(_0x33ba58,_0x416cc6,_0x55d9('0x45'),_0x48cb80[_0x5c0509][_0x15e625]);break;case 0x3:joinOrLeaveQueues(_0x33ba58,_0x416cc6,_0x55d9('0x46'),_0x48cb80[_0x5c0509][_0x15e625]);break;case 0x4:joinOrLeaveQueues(_0x33ba58,_0x416cc6,_0x55d9('0x47'),_0x48cb80[_0x5c0509][_0x15e625]);break;case 0x5:joinOrLeaveQueues(_0x33ba58,_0x416cc6,_0x55d9('0x48'),_0x48cb80[_0x5c0509][_0x15e625]);break;case 0x6:joinOrLeaveQueues(_0x33ba58,_0x416cc6,_0x55d9('0x49'),_0x48cb80[_0x5c0509][_0x15e625]);break;case 0x7:if(_0x3e1eef['role']!=='agent')_0x33ba58[_0x416cc6](util[_0x55d9('0x1e')](_0x55d9('0x4a'),_0x48cb80[_0x5c0509][_0x15e625][_0x55d9('0x4')]));break;case 0x8:if(_0x3e1eef[_0x55d9('0x7')]!==_0x55d9('0x4b'))_0x33ba58[_0x416cc6](util['format'](_0x55d9('0x4c'),_0x48cb80[_0x5c0509][_0x15e625][_0x55d9('0x4')]));break;case 0x9:if(_0x3e1eef[_0x55d9('0x7')]!==_0x55d9('0x4b'))_0x33ba58[_0x416cc6](util[_0x55d9('0x1e')](_0x55d9('0x4d'),_0x48cb80[_0x5c0509][_0x15e625][_0x55d9('0x1a')],_0x48cb80[_0x5c0509][_0x15e625]['name']));break;case 0xa:_0x33ba58[_0x416cc6](util[_0x55d9('0x1e')](_0x55d9('0x1f'),_0x48cb80[_0x5c0509][_0x15e625][_0x55d9('0x4')]));break;}}}}})[_0x55d9('0xb')](function(){if(_0x416cc6===_0x55d9('0x4e')){var _0x580f63=_[_0x55d9('0x17')](_0x3e1eef[_0x55d9('0x4f')],'id');return _0x3e1eef[_0x55d9('0x50')](_0x580f63)[_0x55d9('0xb')](function(){for(var _0x3c4f57=0x0;_0x3c4f57<_0x580f63[_0x55d9('0x1d')];_0x3c4f57+=0x1){_0x1f1b46[_0x55d9('0x51')](_0x55d9('0x52'),{'ChatInteractionId':Number(_0x580f63[_0x3c4f57]),'UserId':Number(_0x3e1eef['id'])});}});}})[_0x55d9('0xb')](function(){if(_0x416cc6===_0x55d9('0x4e')){var _0x1b7d6c=_[_0x55d9('0x17')](_0x3e1eef[_0x55d9('0x26')],'id');return _0x3e1eef[_0x55d9('0x53')](_0x1b7d6c)['then'](function(){for(var _0x2f6088=0x0;_0x2f6088<_0x1b7d6c[_0x55d9('0x1d')];_0x2f6088+=0x1){_0x1f1b46[_0x55d9('0x51')](_0x55d9('0x54'),{'MailInteractionId':Number(_0x1b7d6c[_0x2f6088]),'UserId':Number(_0x3e1eef['id'])});}});}})[_0x55d9('0xb')](function(){if(_0x416cc6===_0x55d9('0x4e')){var _0x4ce101=_['map'](_0x3e1eef[_0x55d9('0x28')],'id');return _0x3e1eef['removeFaxInteractions'](_0x4ce101)[_0x55d9('0xb')](function(){for(var _0x3d6c10=0x0;_0x3d6c10<_0x4ce101[_0x55d9('0x1d')];_0x3d6c10+=0x1){_0x1f1b46[_0x55d9('0x51')]('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x4ce101[_0x3d6c10]),'UserId':Number(_0x3e1eef['id'])});}});}})[_0x55d9('0xb')](function(){if(_0x416cc6==='leave'){var _0xc752a9=_['map'](_0x3e1eef['SmsInteractions'],'id');return _0x3e1eef[_0x55d9('0x55')](_0xc752a9)[_0x55d9('0xb')](function(){for(var _0x45c758=0x0;_0x45c758<_0xc752a9[_0x55d9('0x1d')];_0x45c758+=0x1){_0x1f1b46[_0x55d9('0x51')]('user_has_sms_interactions:remove',{'SmsInteractionId':Number(_0xc752a9[_0x45c758]),'UserId':Number(_0x3e1eef['id'])});}});}})[_0x55d9('0xb')](function(){if(_0x416cc6==='leave'){var _0x55eaf5=_[_0x55d9('0x17')](_0x3e1eef[_0x55d9('0x56')],'id');return _0x3e1eef[_0x55d9('0x57')](_0x55eaf5)[_0x55d9('0xb')](function(){for(var _0x10055d=0x0;_0x10055d<_0x55eaf5['length'];_0x10055d+=0x1){_0x1f1b46[_0x55d9('0x51')]('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x55eaf5[_0x10055d]),'UserId':Number(_0x3e1eef['id'])});}});}})['then'](function(){if(_0x416cc6===_0x55d9('0x4e')){var _0x292f65=_[_0x55d9('0x17')](_0x3e1eef[_0x55d9('0x2b')],'id');return _0x3e1eef['removeWhatsappInteractions'](_0x292f65)[_0x55d9('0xb')](function(){for(var _0x1472d2=0x0;_0x1472d2<_0x292f65['length'];_0x1472d2+=0x1){_0x1f1b46[_0x55d9('0x51')](_0x55d9('0x58'),{'WhatsappInteractionId':Number(_0x292f65[_0x1472d2]),'UserId':Number(_0x3e1eef['id'])});}});}})[_0x55d9('0x59')](function(_0xaed3e6){_0x33ba58[_0x55d9('0x5a')](_0xaed3e6);});}}function onDisconnect(_0x5a8edb,_0xee25ee){joinOrLeave(_0x5a8edb,_0x55d9('0x4e'),_0xee25ee);}function onConnect(_0x4b4e58){joinOrLeave(_0x4b4e58,_0x55d9('0x5b'));}exports[_0x55d9('0x5c')]=function(_0x347af3){_0x347af3['on']('connection',function(_0x20ce30){_0x20ce30['setMaxListeners'](0x0);_0x20ce30[_0x55d9('0x5d')]=_0x20ce30[_0x55d9('0x5e')]['connection']['remoteAddress']+':'+_0x20ce30['request'][_0x55d9('0x5f')][_0x55d9('0x60')];_0x20ce30[_0x55d9('0x61')]=new Date();_0x20ce30[_0x55d9('0x5a')]=function(_0x1a0178){console['log'](_0x55d9('0x62')+_0x20ce30[_0x55d9('0x63')][_0x55d9('0x4')]+'['+_0x20ce30[_0x55d9('0x5d')]+']',_0x1a0178);};_0x20ce30['on'](_0x55d9('0x64'),function(){onDisconnect(_0x20ce30,_0x347af3);_0x20ce30[_0x55d9('0x5a')](_0x55d9('0x65'));});onConnect(_0x20ce30);_0x20ce30[_0x55d9('0x5a')](_0x55d9('0x66'));});}; \ No newline at end of file +var _0x9416=['user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','join','default','connection','setMaxListeners','address','remoteAddress','request','remotePort','SocketIO\x20','nsp','disconnect','DISCONNECTED','CONNECTED','lodash','util','bluebird','../mysqldb','./environment','name','Agents','User','role','agent','telephone','type','UserProfileSection','findOne','then','autoAssociation','VoiceQueues','FaxQueues','WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','map','where','ivr','format','length','user:%s','handshake','query','find','ChatInteraction','ChatInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','voice:outbound','hasOwnProperty','include','VoiceQueue','push','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','Trunk','Campaign','user','userProfileId','SmsQueues','OpenchannelQueues','WhatsappQueue','getVoiceQueues','getChatQueues','getMailQueues','all','voice','fax','mail','openchannel','telephone:%s','trunk:%s','campaign:%s:%s','leave','removeChatInteractions','emit','user_has_chat_interactions:remove','MailInteractions','removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions'];(function(_0x54ea7a,_0x19df9b){var _0x65a10d=function(_0x1bf936){while(--_0x1bf936){_0x54ea7a['push'](_0x54ea7a['shift']());}};_0x65a10d(++_0x19df9b);}(_0x9416,0xde));var _0x6941=function(_0x9a9370,_0x25cd69){_0x9a9370=_0x9a9370-0x0;var _0x1418af=_0x9416[_0x9a9370];return _0x1418af;};'use strict';var _=require(_0x6941('0x0'));var util=require(_0x6941('0x1'));var BPromise=require(_0x6941('0x2'));var db=require(_0x6941('0x3'))['db'];var config=require(_0x6941('0x4'));var queryQueues={'attributes':['id',_0x6941('0x5')],'include':[{'as':_0x6941('0x6'),'model':db[_0x6941('0x7')],'attributes':['id',_0x6941('0x5'),_0x6941('0x8')],'raw':!![],'where':{'role':_0x6941('0x9')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x6941('0x5')],'where':{'role':_0x6941('0xa')}};var queryTrunks={'raw':!![],'attributes':['id',_0x6941('0x5')]};var queryAgents={'raw':!![],'attributes':['id',_0x6941('0x5')],'where':{'role':_0x6941('0x9')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x6941('0x5'),_0x6941('0xb')],'where':{'type':'ivr'}};function getAssociatedResources(_0x291004,_0x2762de,_0x15ba10){return db[_0x6941('0xc')][_0x6941('0xd')]({'where':{'name':_0x291004,'userProfileId':_0x2762de},'raw':!![]})[_0x6941('0xe')](function(_0x208d7d){if(_0x208d7d){if(_0x208d7d[_0x6941('0xf')]){switch(_0x291004){case _0x6941('0x10'):case'ChatQueues':case _0x6941('0x11'):case'SmsQueues':case'MailQueues':case'OpenchannelQueues':case _0x6941('0x12'):return db[_0x15ba10][_0x6941('0x13')](queryQueues);case _0x6941('0x14'):return db[_0x15ba10][_0x6941('0x13')](queryTelephones);case _0x6941('0x15'):return db[_0x15ba10][_0x6941('0x13')](queryTrunks);case _0x6941('0x16'):return db[_0x15ba10][_0x6941('0x13')](queryCampaigns);}}else{return db[_0x6941('0x17')][_0x6941('0x13')]({'attributes':[_0x6941('0x18')],'where':{'sectionId':_0x208d7d['id']},'raw':!![]})['then'](function(_0x4ce783){if(_0x4ce783){var _0x37bc45={'where':{'id':_[_0x6941('0x19')](_0x4ce783,_0x6941('0x18'))},'raw':!![]};switch(_0x15ba10){case _0x6941('0x7'):_0x37bc45[_0x6941('0x1a')][_0x6941('0x8')]=_0x6941('0xa');break;case'Campaign':_0x37bc45[_0x6941('0x1a')][_0x6941('0xb')]=_0x6941('0x1b');break;}return db[_0x15ba10][_0x6941('0x13')](_0x37bc45);}else{return[];}});}}else{return[];}})['then'](function(_0x2242d0){return _0x2242d0;});}function joinOrLeaveQueues(_0xe965,_0x473a6c,_0x336968,_0x165f9a){_0xe965[_0x473a6c](util[_0x6941('0x1c')]('%s:queue:%s',_0x336968,_0x165f9a[_0x6941('0x5')]));if(_0x165f9a['Agents']){for(var _0x4beff4=0x0;_0x4beff4<_0x165f9a[_0x6941('0x6')][_0x6941('0x1d')];_0x4beff4+=0x1){_0xe965[_0x473a6c](util['format'](_0x6941('0x1e'),_0x165f9a[_0x6941('0x6')][_0x4beff4]['name']));}}}function joinOrLeave(_0x54dd4c,_0x4572f5,_0x596211){var _0x1ab6dd;if(_0x54dd4c[_0x6941('0x1f')][_0x6941('0x20')]['id']){db[_0x6941('0x7')][_0x6941('0x21')]({'attributes':['id',_0x6941('0x5'),_0x6941('0x8'),'userProfileId'],'where':{'id':_0x54dd4c[_0x6941('0x1f')][_0x6941('0x20')]['id']},'include':[{'model':db[_0x6941('0x22')],'as':_0x6941('0x23'),'attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x6941('0x24')],'as':_0x6941('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0x6941('0x26')],'as':_0x6941('0x27'),'attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':_0x6941('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0x6941('0x29')],'as':_0x6941('0x2a'),'attributes':['id'],'raw':!![]}]})[_0x6941('0xe')](function(_0x5a1a15){if(_0x5a1a15){_0x1ab6dd=_0x5a1a15;_0x54dd4c[_0x4572f5](util['format']('user:%s',_0x5a1a15[_0x6941('0x5')]));var _0x441c9f=[];switch(_0x5a1a15[_0x6941('0x8')]){case _0x6941('0x2b'):_0x54dd4c[_0x4572f5](_0x6941('0x2c'));_0x54dd4c[_0x4572f5](_0x6941('0x2d'));if(queryQueues[_0x6941('0x2e')](_0x6941('0x2f'))){delete queryQueues[_0x6941('0x2f')];}_0x441c9f['push'](db[_0x6941('0x30')][_0x6941('0x13')](queryQueues));_0x441c9f[_0x6941('0x31')](db['ChatQueue'][_0x6941('0x13')](queryQueues));_0x441c9f[_0x6941('0x31')](db[_0x6941('0x32')][_0x6941('0x13')](queryQueues));_0x441c9f[_0x6941('0x31')](db[_0x6941('0x33')][_0x6941('0x13')](queryQueues));_0x441c9f[_0x6941('0x31')](db[_0x6941('0x34')][_0x6941('0x13')](queryQueues));_0x441c9f[_0x6941('0x31')](db[_0x6941('0x35')][_0x6941('0x13')](queryQueues));_0x441c9f[_0x6941('0x31')](db['WhatsappQueue'][_0x6941('0x13')](queryQueues));_0x441c9f[_0x6941('0x31')](db[_0x6941('0x7')][_0x6941('0x13')](queryTelephones));_0x441c9f[_0x6941('0x31')](db[_0x6941('0x36')]['findAll'](queryTrunks));_0x441c9f['push'](db[_0x6941('0x37')][_0x6941('0x13')](queryCampaigns));_0x441c9f[_0x6941('0x31')](db[_0x6941('0x7')][_0x6941('0x13')](queryAgents));break;case _0x6941('0x38'):_0x54dd4c[_0x4572f5](_0x6941('0x2c'));_0x54dd4c[_0x4572f5](_0x6941('0x2d'));_0x441c9f[_0x6941('0x31')](getAssociatedResources(_0x6941('0x10'),_0x5a1a15[_0x6941('0x39')],_0x6941('0x30')));_0x441c9f[_0x6941('0x31')](getAssociatedResources('ChatQueues',_0x5a1a15[_0x6941('0x39')],'ChatQueue'));_0x441c9f[_0x6941('0x31')](getAssociatedResources(_0x6941('0x11'),_0x5a1a15[_0x6941('0x39')],'FaxQueue'));_0x441c9f[_0x6941('0x31')](getAssociatedResources(_0x6941('0x3a'),_0x5a1a15['userProfileId'],_0x6941('0x33')));_0x441c9f['push'](getAssociatedResources('MailQueues',_0x5a1a15['userProfileId'],_0x6941('0x34')));_0x441c9f[_0x6941('0x31')](getAssociatedResources(_0x6941('0x3b'),_0x5a1a15['userProfileId'],'OpenchannelQueue'));_0x441c9f[_0x6941('0x31')](getAssociatedResources(_0x6941('0x12'),_0x5a1a15['userProfileId'],_0x6941('0x3c')));_0x441c9f[_0x6941('0x31')](getAssociatedResources(_0x6941('0x14'),_0x5a1a15['userProfileId'],_0x6941('0x7')));_0x441c9f['push'](getAssociatedResources(_0x6941('0x15'),_0x5a1a15['userProfileId'],_0x6941('0x36')));_0x441c9f[_0x6941('0x31')](getAssociatedResources(_0x6941('0x16'),_0x5a1a15['userProfileId'],_0x6941('0x37')));_0x441c9f['push'](db['User'][_0x6941('0x13')](queryAgents));break;case'agent':_0x54dd4c[_0x4572f5]('voice:inbound');_0x54dd4c[_0x4572f5](_0x6941('0x2d'));_0x441c9f[_0x6941('0x31')](_0x5a1a15[_0x6941('0x3d')]({'attributes':['id',_0x6941('0x5')]}));_0x441c9f['push'](_0x5a1a15[_0x6941('0x3e')]({'attributes':['id',_0x6941('0x5')]}));_0x441c9f[_0x6941('0x31')](_0x5a1a15['getFaxQueues']({'attributes':['id',_0x6941('0x5')]}));_0x441c9f['push'](_0x5a1a15['getSmsQueues']({'attributes':['id',_0x6941('0x5')]}));_0x441c9f[_0x6941('0x31')](_0x5a1a15[_0x6941('0x3f')]({'attributes':['id',_0x6941('0x5')]}));_0x441c9f[_0x6941('0x31')](_0x5a1a15['getOpenchannelQueues']({'attributes':['id',_0x6941('0x5')]}));_0x441c9f[_0x6941('0x31')](_0x5a1a15['getWhatsappQueues']({'attributes':['id',_0x6941('0x5')]}));break;}return BPromise[_0x6941('0x40')](_0x441c9f);}})[_0x6941('0xe')](function(_0x1c193d){if(_0x1c193d&&_0x1c193d[_0x6941('0x1d')]){for(var _0x543673=0x0;_0x543673<_0x1c193d[_0x6941('0x1d')];_0x543673+=0x1){for(var _0x41c647=0x0;_0x41c647<_0x1c193d[_0x543673][_0x6941('0x1d')];_0x41c647+=0x1){switch(_0x543673){case 0x0:joinOrLeaveQueues(_0x54dd4c,_0x4572f5,_0x6941('0x41'),_0x1c193d[_0x543673][_0x41c647]);break;case 0x1:joinOrLeaveQueues(_0x54dd4c,_0x4572f5,'chat',_0x1c193d[_0x543673][_0x41c647]);break;case 0x2:joinOrLeaveQueues(_0x54dd4c,_0x4572f5,_0x6941('0x42'),_0x1c193d[_0x543673][_0x41c647]);break;case 0x3:joinOrLeaveQueues(_0x54dd4c,_0x4572f5,'sms',_0x1c193d[_0x543673][_0x41c647]);break;case 0x4:joinOrLeaveQueues(_0x54dd4c,_0x4572f5,_0x6941('0x43'),_0x1c193d[_0x543673][_0x41c647]);break;case 0x5:joinOrLeaveQueues(_0x54dd4c,_0x4572f5,_0x6941('0x44'),_0x1c193d[_0x543673][_0x41c647]);break;case 0x6:joinOrLeaveQueues(_0x54dd4c,_0x4572f5,'whatsapp',_0x1c193d[_0x543673][_0x41c647]);break;case 0x7:if(_0x1ab6dd[_0x6941('0x8')]!==_0x6941('0x9'))_0x54dd4c[_0x4572f5](util[_0x6941('0x1c')](_0x6941('0x45'),_0x1c193d[_0x543673][_0x41c647]['name']));break;case 0x8:if(_0x1ab6dd[_0x6941('0x8')]!==_0x6941('0x9'))_0x54dd4c[_0x4572f5](util['format'](_0x6941('0x46'),_0x1c193d[_0x543673][_0x41c647]['name']));break;case 0x9:if(_0x1ab6dd['role']!==_0x6941('0x9'))_0x54dd4c[_0x4572f5](util[_0x6941('0x1c')](_0x6941('0x47'),_0x1c193d[_0x543673][_0x41c647][_0x6941('0xb')],_0x1c193d[_0x543673][_0x41c647][_0x6941('0x5')]));break;case 0xa:_0x54dd4c[_0x4572f5](util[_0x6941('0x1c')]('user:%s',_0x1c193d[_0x543673][_0x41c647][_0x6941('0x5')]));break;}}}}})[_0x6941('0xe')](function(){if(_0x4572f5===_0x6941('0x48')){var _0x3a4ab7=_[_0x6941('0x19')](_0x1ab6dd[_0x6941('0x23')],'id');return _0x1ab6dd[_0x6941('0x49')](_0x3a4ab7)[_0x6941('0xe')](function(){for(var _0x54b409=0x0;_0x54b409<_0x3a4ab7[_0x6941('0x1d')];_0x54b409+=0x1){_0x596211[_0x6941('0x4a')](_0x6941('0x4b'),{'ChatInteractionId':Number(_0x3a4ab7[_0x54b409]),'UserId':Number(_0x1ab6dd['id'])});}});}})['then'](function(){if(_0x4572f5===_0x6941('0x48')){var _0x27e78f=_['map'](_0x1ab6dd[_0x6941('0x4c')],'id');return _0x1ab6dd[_0x6941('0x4d')](_0x27e78f)[_0x6941('0xe')](function(){for(var _0x3c37bd=0x0;_0x3c37bd<_0x27e78f[_0x6941('0x1d')];_0x3c37bd+=0x1){_0x596211['emit'](_0x6941('0x4e'),{'MailInteractionId':Number(_0x27e78f[_0x3c37bd]),'UserId':Number(_0x1ab6dd['id'])});}});}})['then'](function(){if(_0x4572f5===_0x6941('0x48')){var _0xb6bc05=_[_0x6941('0x19')](_0x1ab6dd['FaxInteractions'],'id');return _0x1ab6dd[_0x6941('0x4f')](_0xb6bc05)['then'](function(){for(var _0x53a301=0x0;_0x53a301<_0xb6bc05['length'];_0x53a301+=0x1){_0x596211[_0x6941('0x4a')](_0x6941('0x50'),{'FaxInteractionId':Number(_0xb6bc05[_0x53a301]),'UserId':Number(_0x1ab6dd['id'])});}});}})['then'](function(){if(_0x4572f5===_0x6941('0x48')){var _0x2fd495=_[_0x6941('0x19')](_0x1ab6dd[_0x6941('0x27')],'id');return _0x1ab6dd[_0x6941('0x51')](_0x2fd495)['then'](function(){for(var _0x4e814e=0x0;_0x4e814e<_0x2fd495[_0x6941('0x1d')];_0x4e814e+=0x1){_0x596211['emit'](_0x6941('0x52'),{'SmsInteractionId':Number(_0x2fd495[_0x4e814e]),'UserId':Number(_0x1ab6dd['id'])});}});}})[_0x6941('0xe')](function(){if(_0x4572f5===_0x6941('0x48')){var _0x2138f5=_['map'](_0x1ab6dd[_0x6941('0x28')],'id');return _0x1ab6dd[_0x6941('0x53')](_0x2138f5)[_0x6941('0xe')](function(){for(var _0x577248=0x0;_0x577248<_0x2138f5[_0x6941('0x1d')];_0x577248+=0x1){_0x596211[_0x6941('0x4a')](_0x6941('0x54'),{'OpenchannelInteractionId':Number(_0x2138f5[_0x577248]),'UserId':Number(_0x1ab6dd['id'])});}});}})['then'](function(){if(_0x4572f5===_0x6941('0x48')){var _0x31a9a0=_[_0x6941('0x19')](_0x1ab6dd['WhatsappInteractions'],'id');return _0x1ab6dd[_0x6941('0x55')](_0x31a9a0)['then'](function(){for(var _0x4a4634=0x0;_0x4a4634<_0x31a9a0[_0x6941('0x1d')];_0x4a4634+=0x1){_0x596211[_0x6941('0x4a')](_0x6941('0x56'),{'WhatsappInteractionId':Number(_0x31a9a0[_0x4a4634]),'UserId':Number(_0x1ab6dd['id'])});}});}})[_0x6941('0x57')](function(_0x30b6ad){_0x54dd4c[_0x6941('0x58')](_0x30b6ad);});}}function onDisconnect(_0x1eea76,_0x4ed6a9){joinOrLeave(_0x1eea76,'leave',_0x4ed6a9);}function onConnect(_0x3bdaf5){joinOrLeave(_0x3bdaf5,_0x6941('0x59'));}exports[_0x6941('0x5a')]=function(_0x1ed594){_0x1ed594['on'](_0x6941('0x5b'),function(_0x2baa24){_0x2baa24[_0x6941('0x5c')](0x0);_0x2baa24[_0x6941('0x5d')]=_0x2baa24['request']['connection'][_0x6941('0x5e')]+':'+_0x2baa24[_0x6941('0x5f')][_0x6941('0x5b')][_0x6941('0x60')];_0x2baa24['connectedAt']=new Date();_0x2baa24[_0x6941('0x58')]=function(_0x58edea){console[_0x6941('0x58')](_0x6941('0x61')+_0x2baa24[_0x6941('0x62')][_0x6941('0x5')]+'['+_0x2baa24['address']+']',_0x58edea);};_0x2baa24['on'](_0x6941('0x63'),function(){onDisconnect(_0x2baa24,_0x1ed594);_0x2baa24[_0x6941('0x58')](_0x6941('0x64'));});onConnect(_0x2baa24);_0x2baa24[_0x6941('0x58')](_0x6941('0x65'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index af4778e..ac1b7b1 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 _0xb943=['offlineMessage','channel','opened','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','SELECT','AfterCreate','changed','closed','substatus','format','AfterUpdate','User','find','email','internal','length','hasOwnProperty','model','hook','condition','../../mysqldb','../logger','client','http','Chat','ChatInteraction','afterCreate','newinteraction','afterUpdate','closedinteraction','ChatMessage','newmessage','ChatOfflineMessage','Sms','SmsInteraction','SmsMessage','Whatsapp','WhatsappInteraction','WhatsappMessage','Fax','FaxInteraction','Mail','MailInteraction','MailMessage','Openchannel','OpenchannelInteraction','request','then','info','Trigger,\x20%s','error','code','EventManager','catch','get','event','direction','resolve','undefined','ContactId','query','QueryTypes','contact','UserId','interface','SIP/%s','name','agent','incomingmessage','AfterCreateMessage','motionChannel'];(function(_0x54bbd2,_0x9cc107){var _0x39cb15=function(_0x4d67bb){while(--_0x4d67bb){_0x54bbd2['push'](_0x54bbd2['shift']());}};_0x39cb15(++_0x9cc107);}(_0xb943,0xa8));var _0x3b94=function(_0x2923bb,_0x1dcaa2){_0x2923bb=_0x2923bb-0x0;var _0x4d0d8a=_0xb943[_0x2923bb];return _0x4d0d8a;};'use strict';var util=require('util');var db=require(_0x3b94('0x0'))['db'];var jayson=require('jayson/promise');var logger=require(_0x3b94('0x1'))('triggers');var client=jayson[_0x3b94('0x2')][_0x3b94('0x3')]({'port':0x232a});var triggers=[{'channel':_0x3b94('0x4'),'model':_0x3b94('0x5'),'event':_0x3b94('0x6'),'condition':_0x3b94('0x7'),'callback':afterCreate},{'channel':_0x3b94('0x4'),'model':_0x3b94('0x5'),'event':_0x3b94('0x8'),'condition':_0x3b94('0x9'),'callback':afterUpdate},{'channel':_0x3b94('0x4'),'model':_0x3b94('0xa'),'event':_0x3b94('0x6'),'condition':_0x3b94('0xb'),'callback':afterCreateMessage},{'channel':'Chat','model':_0x3b94('0xc'),'event':_0x3b94('0x6'),'condition':'newmessage','callback':afterCreateOfflineMessage},{'channel':_0x3b94('0xd'),'model':_0x3b94('0xe'),'event':'afterCreate','condition':'newinteraction','callback':afterCreate},{'channel':_0x3b94('0xd'),'model':_0x3b94('0xe'),'event':_0x3b94('0x8'),'condition':_0x3b94('0x9'),'callback':afterUpdate},{'channel':_0x3b94('0xd'),'model':_0x3b94('0xf'),'event':'afterCreate','condition':'newmessage','callback':afterCreateMessage},{'channel':_0x3b94('0x10'),'model':_0x3b94('0x11'),'event':_0x3b94('0x6'),'condition':_0x3b94('0x7'),'callback':afterCreate},{'channel':_0x3b94('0x10'),'model':_0x3b94('0x11'),'event':'afterUpdate','condition':_0x3b94('0x9'),'callback':afterUpdate},{'channel':_0x3b94('0x10'),'model':_0x3b94('0x12'),'event':_0x3b94('0x6'),'condition':_0x3b94('0xb'),'callback':afterCreateMessage},{'channel':_0x3b94('0x13'),'model':_0x3b94('0x14'),'event':_0x3b94('0x6'),'condition':_0x3b94('0x7'),'callback':afterCreate},{'channel':_0x3b94('0x13'),'model':'FaxInteraction','event':_0x3b94('0x8'),'condition':_0x3b94('0x9'),'callback':afterUpdate},{'channel':_0x3b94('0x13'),'model':'FaxMessage','event':_0x3b94('0x6'),'condition':_0x3b94('0xb'),'callback':afterCreateMessage},{'channel':_0x3b94('0x15'),'model':_0x3b94('0x16'),'event':'afterCreate','condition':_0x3b94('0x7'),'callback':afterCreate},{'channel':_0x3b94('0x15'),'model':'MailInteraction','event':'afterUpdate','condition':_0x3b94('0x9'),'callback':afterUpdate},{'channel':'Mail','model':_0x3b94('0x17'),'event':_0x3b94('0x6'),'condition':_0x3b94('0xb'),'callback':afterCreateMessage},{'channel':_0x3b94('0x18'),'model':'OpenchannelInteraction','event':_0x3b94('0x6'),'condition':_0x3b94('0x7'),'callback':afterCreate},{'channel':_0x3b94('0x18'),'model':_0x3b94('0x19'),'event':'afterUpdate','condition':'closedinteraction','callback':afterUpdate},{'channel':_0x3b94('0x18'),'model':'OpenchannelMessage','event':_0x3b94('0x6'),'condition':_0x3b94('0xb'),'callback':afterCreateMessage}];function request(_0x141b54){return client[_0x3b94('0x1a')]('EventManager',_0x141b54)[_0x3b94('0x1b')](function(_0x285d1f){logger[_0x3b94('0x1c')](_0x3b94('0x1d'),'EventManager',_0x285d1f);if(_0x285d1f['error']){if(_0x285d1f[_0x3b94('0x1e')][_0x3b94('0x1f')]===0x1f4){logger[_0x3b94('0x1e')]('Trigger,\x20%s',_0x3b94('0x20'),_0x285d1f[_0x3b94('0x1e')]);}}})[_0x3b94('0x21')](function(_0x5a00c7){logger[_0x3b94('0x1e')](_0x3b94('0x1d'),_0x3b94('0x20'),_0x5a00c7);});}function afterCreateMessage(_0x1d6003){return function(_0x37f0fd){_0x37f0fd=_0x37f0fd[_0x3b94('0x22')]({'plain':!![]});_0x37f0fd['channel']=_0x1d6003;_0x37f0fd['motionChannel']=_0x1d6003;_0x37f0fd[_0x3b94('0x23')]=_0x37f0fd[_0x3b94('0x24')];Promise[_0x3b94('0x25')]()[_0x3b94('0x1b')](function(){if(typeof _0x37f0fd['ContactId']===_0x3b94('0x26'))return null;var _0x128263='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x37f0fd[_0x3b94('0x27')];return db['sequelize'][_0x3b94('0x28')](_0x128263,{'type':db['Sequelize'][_0x3b94('0x29')]['SELECT'],'raw':!![]});})[_0x3b94('0x1b')](function(_0x363ef4){if(_0x363ef4){_0x37f0fd[_0x3b94('0x2a')]=_0x363ef4[0x0];}if(typeof _0x37f0fd[_0x3b94('0x2b')]==='undefined')return;return getAgent(_0x37f0fd['UserId']);})[_0x3b94('0x1b')](function(_0x31bfbc){if(_0x31bfbc){_0x37f0fd[_0x3b94('0x2c')]=util['format'](_0x3b94('0x2d'),_0x31bfbc[_0x3b94('0x2e')]);_0x37f0fd[_0x3b94('0x2f')]=_0x31bfbc;_0x37f0fd['channel']=_0x1d6003;return request({'event':_0x3b94('0x30'),'message':_0x37f0fd});}else{return request({'event':'outgoingmessage','message':_0x37f0fd});}})[_0x3b94('0x21')](function(_0x1244b0){logger[_0x3b94('0x1e')](_0x3b94('0x1d'),_0x3b94('0x31'),_0x1244b0);});};}function afterCreateOfflineMessage(_0x27a281){return function(_0x130c17){_0x130c17=_0x130c17[_0x3b94('0x22')]({'plain':!![]});_0x130c17['channel']=_0x27a281;_0x130c17[_0x3b94('0x32')]=_0x27a281;_0x130c17[_0x3b94('0x23')]=_0x3b94('0x33');return request({'event':_0x130c17[_0x3b94('0x23')],'message':_0x130c17});};}function afterCreate(_0x2bf386,_0x98c98f){return function(_0x4138de){_0x4138de=_0x4138de[_0x3b94('0x22')]({'plain':!![]});_0x4138de[_0x3b94('0x34')]=_0x2bf386;_0x4138de[_0x3b94('0x32')]=_0x2bf386;_0x4138de['event']=_0x3b94('0x35');Promise[_0x3b94('0x25')]()[_0x3b94('0x1b')](function(){var _0x261ea9=_0x3b94('0x36')+_0x4138de['ContactId'];return db[_0x3b94('0x37')][_0x3b94('0x28')](_0x261ea9,{'type':db[_0x3b94('0x38')][_0x3b94('0x29')][_0x3b94('0x39')],'raw':!![]});})[_0x3b94('0x1b')](function(_0xa000d2){if(_0xa000d2){_0x4138de[_0x3b94('0x2a')]=_0xa000d2[0x0];}if(typeof _0x4138de['UserId']===_0x3b94('0x26'))return;return getAgent(_0x4138de[_0x3b94('0x2b')]);})[_0x3b94('0x1b')](function(_0x3a7549){if(_0x3a7549){_0x4138de[_0x3b94('0x2c')]=util['format'](_0x3b94('0x2d'),_0x3a7549['name']);_0x4138de[_0x3b94('0x2f')]=_0x3a7549;}return request({'event':_0x98c98f,'message':_0x4138de});})['catch'](function(_0x45ebcf){logger[_0x3b94('0x1e')](_0x3b94('0x1d'),_0x3b94('0x3a'),_0x45ebcf);});};}function afterUpdate(_0x13ee14){return function(_0x3c7614){var _0x3239ef=_0x3c7614[_0x3b94('0x3b')](_0x3b94('0x3c'))&&_0x3c7614[_0x3b94('0x3c')];var _0xd32e55=_0x3c7614['changed']('substatus');if(_0x3239ef||_0xd32e55){var _0x2b1a56=_0x3239ef?_0x3b94('0x9'):'substatus';var _0x1803ba=_0x3c7614['get']({'plain':!![]});_0x1803ba[_0x3b94('0x34')]=_0x13ee14;_0x1803ba['motionChannel']=_0x13ee14;_0x1803ba[_0x3b94('0x23')]=_0x3239ef?_0x3b94('0x3c'):_0x3b94('0x3d');var _0x4cdfd4='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x1803ba['ContactId'];return db[_0x3b94('0x37')][_0x3b94('0x28')](_0x4cdfd4,{'type':db[_0x3b94('0x38')][_0x3b94('0x29')][_0x3b94('0x39')],'raw':!![]})['then'](function(_0x5ca9c7){if(_0x5ca9c7){_0x1803ba[_0x3b94('0x2a')]=_0x5ca9c7[0x0];}if(typeof _0x1803ba[_0x3b94('0x2b')]===_0x3b94('0x26'))return;return getAgent(_0x1803ba[_0x3b94('0x2b')]);})['then'](function(_0x4f2922){if(_0x4f2922){_0x1803ba['interface']=util[_0x3b94('0x3e')](_0x3b94('0x2d'),_0x4f2922[_0x3b94('0x2e')]);_0x1803ba[_0x3b94('0x2f')]=_0x4f2922;}return request({'event':_0x2b1a56,'message':_0x1803ba});})[_0x3b94('0x21')](function(_0x1f7543){logger[_0x3b94('0x1e')](_0x3b94('0x1d'),_0x3b94('0x3f'),_0x1f7543);});}};}function getAgent(_0x2e1600){return db[_0x3b94('0x40')][_0x3b94('0x41')]({'where':{'id':_0x2e1600},'attributes':['id',_0x3b94('0x2e'),'fullname',_0x3b94('0x42'),_0x3b94('0x43')],'raw':!![]})[_0x3b94('0x1b')](function(_0x20f592){return _0x20f592;});}exports['default']=function(){for(var _0x3ad049=0x0;_0x3ad049=_0x265f99[_0x4089('0x11')]){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x59c346(_0x513056);})['catch'](function(_0x463b91){_0xf8093a(_0x463b91);});});}; \ No newline at end of file +var _0xaad4=['voice','fax','sms','openchannel','toLowerCase','clearBlockUser','blockedAt','getLicense','agent','User','count','then','agents','Maximum\x20login\x20has\x20been\x20reached','catch','bluebird','../mysqldb','./license/util'];(function(_0x2062f8,_0x11bb77){var _0x3f5c1d=function(_0x2ae2ae){while(--_0x2ae2ae){_0x2062f8['push'](_0x2062f8['shift']());}};_0x3f5c1d(++_0x11bb77);}(_0xaad4,0xd5));var _0x4aad=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xaad4[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var BPromise=require(_0x4aad('0x0'));var db=require(_0x4aad('0x1'))['db'];var util=require(_0x4aad('0x2'));var channels=[_0x4aad('0x3'),'mail','chat',_0x4aad('0x4'),_0x4aad('0x5'),'whatsapp',_0x4aad('0x6')];exports['getChannels']=function(){return channels;};exports['isValidChannel']=function(_0xc08063){_0xc08063=_0xc08063[_0x4aad('0x7')]();return _['includes'](channels,_0xc08063);};exports[_0x4aad('0x8')]=function(_0x4fcbb2,_0x270207,_0x3cfb22,_0x2dd980){var _0x234a06={'loginAttempts':_0x270207,'blocked':_0x3cfb22};if(!_['isUndefined'](_0x2dd980)){_0x234a06[_0x4aad('0x9')]=_0x2dd980;}return _0x4fcbb2['updateAttributes'](_0x234a06);};exports[_0x4aad('0xa')]=function(_0x326b7c){return new BPromise(function(_0x3e6f10,_0x4f8d88){var _0x490af6=0x0;if(_0x326b7c['role']!==_0x4aad('0xb')){_0x3e6f10(_0x326b7c);}db[_0x4aad('0xc')][_0x4aad('0xd')]({'where':{'role':'agent','online':!![],'id':{'$ne':_0x326b7c['id']}}})['then'](function(_0xd1f239){_0x490af6=_0xd1f239;return util[_0x4aad('0xa')]();})[_0x4aad('0xe')](function(_0x4da01f){if(_0x4da01f&&_0x4da01f[_0x4aad('0xf')]&&_0x490af6>=_0x4da01f['agents']){throw Error(_0x4aad('0x10'));}_0x3e6f10(_0x326b7c);})[_0x4aad('0x11')](function(_0x534d22){_0x4f8d88(_0x534d22);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index e4b0bd7..40a6bfa 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['Not\x20Found','Message\x20sent\x20outside\x20a\x20valid\x20interval','Out\x20Of\x20Interval','error','statusMessage','status','send','exports','../config/logger','message','name','Error','inherits','Bad\x20Request','Entity\x20not\x20found'];(function(_0x53ef7c,_0x53e487){var _0x3f956a=function(_0x3bf543){while(--_0x3bf543){_0x53ef7c['push'](_0x53ef7c['shift']());}};_0x3f956a(++_0x53e487);}(_0xadb5,0xad));var _0x5adb=function(_0x3fa8f9,_0x387a28){_0x3fa8f9=_0x3fa8f9-0x0;var _0x2c2584=_0xadb5[_0x3fa8f9];return _0x2c2584;};'use strict';var util=require('util');var logger=require(_0x5adb('0x0'))('api');var APIError=function(_0x3d6340,_0x38f67f){this[_0x5adb('0x1')]=_0x3d6340||'Internal\x20Server\x20Error';this[_0x5adb('0x2')]=_0x38f67f||_0x5adb('0x3');util[_0x5adb('0x4')](APIError,Error);};var APIBadRequestError=function(_0x4cb1d1){this[_0x5adb('0x1')]=_0x4cb1d1||_0x5adb('0x5');this[_0x5adb('0x2')]=_0x5adb('0x5');util[_0x5adb('0x4')](APIBadRequestError,APIError);};var APINotFoundError=function(_0x353885){this[_0x5adb('0x1')]=_0x353885||_0x5adb('0x6');this[_0x5adb('0x2')]=_0x5adb('0x7');util[_0x5adb('0x4')](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x336bad){this[_0x5adb('0x1')]=_0x336bad||_0x5adb('0x8');this['name']='Out\x20Of\x20Interval';util[_0x5adb('0x4')](APIOutOfIntervalError,APIError);};function getStatusCode(_0x1ea238){switch(_0x1ea238){case _0x5adb('0x5'):return 0x190;case'Forbidden',_0x5adb('0x9'):return 0x193;case'Not\x20Found':return 0x194;default:return 0x1f4;}}function getCustomStatusMessage(_0x2a0b70){if(_0x2a0b70==='Out\x20Of\x20Interval')return _0x2a0b70;return null;}function handleError(_0x8cfcc6){return function(_0x39a0b3){logger[_0x5adb('0xa')](_0x39a0b3['stack']);var _0x2a545b=getStatusCode(_0x39a0b3[_0x5adb('0x2')]);var _0xf82f72=getCustomStatusMessage(_0x39a0b3['name']);if(_0x39a0b3[_0x5adb('0x2')])delete _0x39a0b3['name'];if(_0xf82f72)_0x8cfcc6[_0x5adb('0xb')]=_0xf82f72;return _0x8cfcc6[_0x5adb('0xc')](_0x2a545b)[_0x5adb('0xd')](_0x39a0b3);};}module[_0x5adb('0xe')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIOutOfIntervalError':APIOutOfIntervalError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file +var _0xef96=['message','Error','Bad\x20Request','name','inherits','Entity\x20not\x20found','Message\x20sent\x20outside\x20a\x20valid\x20interval','code','details','OutOfInterval','Forbidden','Out\x20Of\x20Interval','Not\x20Found','error','stack','statusMessage','send','exports','util','../config/logger','api'];(function(_0x43ceb7,_0x20ed3c){var _0x4bfee7=function(_0x43f666){while(--_0x43f666){_0x43ceb7['push'](_0x43ceb7['shift']());}};_0x4bfee7(++_0x20ed3c);}(_0xef96,0x162));var _0x6ef9=function(_0x2d43c3,_0x1388b9){_0x2d43c3=_0x2d43c3-0x0;var _0x5dd447=_0xef96[_0x2d43c3];return _0x5dd447;};'use strict';var util=require(_0x6ef9('0x0'));var logger=require(_0x6ef9('0x1'))(_0x6ef9('0x2'));var APIError=function(_0x3e7456,_0x18a22e){this[_0x6ef9('0x3')]=_0x3e7456||'Internal\x20Server\x20Error';this['name']=_0x18a22e||_0x6ef9('0x4');util['inherits'](APIError,Error);};var APIBadRequestError=function(_0x500b0c){this[_0x6ef9('0x3')]=_0x500b0c||_0x6ef9('0x5');this[_0x6ef9('0x6')]='Bad\x20Request';util[_0x6ef9('0x7')](APIBadRequestError,APIError);};var APINotFoundError=function(_0x5c8945){this[_0x6ef9('0x3')]=_0x5c8945||_0x6ef9('0x8');this[_0x6ef9('0x6')]='Not\x20Found';util[_0x6ef9('0x7')](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x4ccb23){this[_0x6ef9('0x3')]=_0x4ccb23||_0x6ef9('0x9');this[_0x6ef9('0x6')]='Out\x20Of\x20Interval';this[_0x6ef9('0xa')]=0x193;this[_0x6ef9('0xb')]={'type':_0x6ef9('0xc')};util[_0x6ef9('0x7')](APIOutOfIntervalError,APIError);};function getStatusCode(_0x4f68f2){switch(_0x4f68f2){case _0x6ef9('0x5'):return 0x190;case _0x6ef9('0xd'),_0x6ef9('0xe'):return 0x193;case _0x6ef9('0xf'):return 0x194;default:return 0x1f4;}}function getCustomStatusMessage(_0x2d26ac){if(_0x2d26ac===_0x6ef9('0xe'))return _0x2d26ac;return null;}function handleError(_0x41928e){return function(_0x5e2fc1){logger[_0x6ef9('0x10')](_0x5e2fc1[_0x6ef9('0x11')]);var _0x1f3793=getStatusCode(_0x5e2fc1[_0x6ef9('0x6')]);var _0xce5672=getCustomStatusMessage(_0x5e2fc1[_0x6ef9('0x6')]);if(_0x5e2fc1[_0x6ef9('0x6')]){delete _0x5e2fc1[_0x6ef9('0x6')];}if(_0xce5672){_0x41928e[_0x6ef9('0x12')]=_0xce5672;}return _0x41928e['status'](_0x1f3793)[_0x6ef9('0x13')](_0x5e2fc1);};}module[_0x6ef9('0x14')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APINotFoundError':APINotFoundError,'APIOutOfIntervalError':APIOutOfIntervalError,'handleError':handleError}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 078036f..682caec 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7703=['render','send','exports','status'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0x7703,0x1ba));var _0x3770=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0x7703[_0x279d37];return _0x530173;};'use strict';module[_0x3770('0x0')][0x194]=function pageNotFound(_0x202011,_0x3b20ca){var _0x5b8c55='404';var _0x445793=0x194;var _0x37c0e6={'status':_0x445793};_0x3b20ca[_0x3770('0x1')](_0x37c0e6['status']);_0x3b20ca[_0x3770('0x2')](_0x5b8c55,{},function(_0x1ff67e,_0x22a6b2){if(_0x1ff67e){return _0x3b20ca['status'](_0x37c0e6[_0x3770('0x1')])['json'](_0x37c0e6);}_0x3b20ca[_0x3770('0x3')](_0x22a6b2);});}; \ No newline at end of file +var _0xf2d0=['send','404','status','render','json'];(function(_0x208a85,_0x148862){var _0xe2cc29=function(_0x2171e1){while(--_0x2171e1){_0x208a85['push'](_0x208a85['shift']());}};_0xe2cc29(++_0x148862);}(_0xf2d0,0x137));var _0x0f2d=function(_0x5d79f7,_0x15cc21){_0x5d79f7=_0x5d79f7-0x0;var _0x30ec31=_0xf2d0[_0x5d79f7];return _0x30ec31;};'use strict';module['exports'][0x194]=function pageNotFound(_0x118153,_0x28a869){var _0x155898=_0x0f2d('0x0');var _0x19305c=0x194;var _0x444d5a={'status':_0x19305c};_0x28a869[_0x0f2d('0x1')](_0x444d5a[_0x0f2d('0x1')]);_0x28a869[_0x0f2d('0x2')](_0x155898,{},function(_0x57020c,_0x27e73f){if(_0x57020c){return _0x28a869[_0x0f2d('0x1')](_0x444d5a[_0x0f2d('0x1')])[_0x0f2d('0x3')](_0x444d5a);}_0x28a869[_0x0f2d('0x4')](_0x27e73f);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 51c759f..7b7f281 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','License','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','../api/cmList/cmList.model','VoicePrefix','UserProfile','UserProfileSection','UserProfileResource','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','hasOne','VoiceMail','userSetting','cascade','UserId','hasMany','VoiceRecording','Recordings','VoiceQueuesRt','Extensions','HopperFinals','CmHopperHistory','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteraction','MailInteraction','MailInteractions','WhatsappInteractions','UserNotifications','SenderId','belongsToMany','Groups','chat_group_has_users','CmContact','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','Team','user_has_teams','user_has_mail_interactions','FaxInteractions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefixes','ChatQueues','UserChatQueue','FaxQueues','SmsQueues','OpenchannelQueue','WhatsappQueues','CmList','ChatWebsites','user_has_chat_websites','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','ChanSpyId','VoiceContext','Applications','Sounds','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperBlacks','JscriptySessions','TrunkId','belongsTo','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPauseId','Teams','BlackLists','voice_queues_has_cm_blacklists','Messages','mailbox','mailboxuser','VoiceCallReport','QueueCalls','uniqueid','VoiceAgentReport','AgentReports','Contact','MailAccountId','CloudProviderId','MailServerOut','restrict','Imap','Smtp','Disposition','Dispositions','Answers','Interactions','MailApplication','List','ListId','TemplateId','mandatoryDispositionPause','Agents','team_has_mail_queues','ContactId','mail_interaction_has_tags','Tags','ThroughTags','Users','MailInteractionId','Attachments','Interaction','ChatWebsiteId','Interval','MailQueueReport','Dashboard','CannedAnswer','FaxAccountId','Exntensions','TagId','FaxInteractionId','Account','Owner','fax_interaction_has_tags','AttachmentId','team_has_fax_queues','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','team_has_openchannel_queues','ChatProactiveAction','ProactiveActions','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','user_has_chat_interactions','ChatOfflineMessageId','team_has_chat_queues','ChatGroupId','CmContactId','HopperHistories','CmCompany','Company','cm_contact_has_tags','CmHopperAdditionalPhone','AdditionalPhones','CmHopperId','Campaign','OwnerId','CampaignId','All','OneAll','OneAny','Actions','ParentId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','openchannel_interaction_has_tags','whatsapp_interaction_has_tags','CmContactHasItem','ItemType','ItemTypeId','Hopper','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','AnalyticCustomReport','Fields','MetricId','Configurations','Subjects','DescriptionId','FieldId','AccountId','Subject','SubjectId','Description','Field','SugarcrmField','Descriptions','VariableId','DeskAccount','ZendeskConfiguration','int_zendesk_configuration_has_tags','FreshdeskAccount','FreshdeskConfiguration','int_freshdesk_configuration_has_tags','VtigerAccount','ServicenowField','ToId','JscriptyQuestionReport','JscriptyProject','ProjectId','MailQueues','OpenchannelQueues','team_has_whatsapp_queues','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromAccount','FromAgent','ToUserId','ToAgent','ToMailAccountId','ToAccount','FromChatWebsiteId','FromUserId','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToQueue','FromSmsAccountId','CmCustomField','CustomFields','voice_queues_has_cm_lists','userProfileId','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','WhatsappTransferReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','UserSetting','user','../config/environment','sequelize','lodash','motion2','xcall','xC@LL1234','127.0.0.1','utf8mb4','name','utf8','defaultsDeep','mysql','username','password','options','database','sequelizeHistory','User','import','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','ScreenRecording','../api/screenRecording/screenRecording.model','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','Trunk','../api/trunk/trunk.model','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerOut/mailServerOut.model','MailAccount','MailQueue','MailSubstatus','MailMessage','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','OpenchannelMessage','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','ChatApplication','ChatInteraction','ChatMessage','ChatOfflineMessage','ChatQueue','ChatGroup','../api/chatGroup/chatGroup.model','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','ReportAgentPreview','Action','../api/action/action.model','Automation','../api/automation/automation.model','../api/cannedAnswer/cannedAnswer.model','../api/disposition/disposition.model','Condition','../api/condition/condition.model','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','../api/cmContactHasItem/cmContactHasItem.model','Template','../api/template/template.model','Trigger','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','../api/integrationReport/integrationReport.model','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','SugarcrmAccount','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','../api/intSugarcrmField/intSugarcrmField.model','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','VtigerField','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','Dynamics365Account','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','../api/squareOdbc/squareOdbc.model','SquareProject'];(function(_0x413727,_0x17adb1){var _0x5f46d7=function(_0xbb668e){while(--_0xbb668e){_0x413727['push'](_0x413727['shift']());}};_0x5f46d7(++_0x17adb1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0xa9e0[_0x5037ab];return _0x512adb;};'use strict';var config=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var jstz=require('jstz');var timezone=jstz['determine']();config[_0x0a9e('0x1')]=_['defaultsDeep'](config[_0x0a9e('0x1')],{'database':_0x0a9e('0x3'),'username':_0x0a9e('0x4'),'password':_0x0a9e('0x5'),'options':{'host':_0x0a9e('0x6'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x0a9e('0x7')},'logging':![],'timezone':timezone[_0x0a9e('0x8')](),'define':{'charset':_0x0a9e('0x9'),'collate':'utf8_general_ci'}}});config['sequelizeHistory']=_[_0x0a9e('0xa')](config['sequelizeHistory'],{'database':'motion2','username':_0x0a9e('0x4'),'password':_0x0a9e('0x5'),'options':{'host':_0x0a9e('0x6'),'port':0xcea,'dialect':_0x0a9e('0xb'),'dialectOptions':{'charset':_0x0a9e('0x7')},'logging':![],'timezone':timezone[_0x0a9e('0x8')](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize']['database'],config[_0x0a9e('0x1')][_0x0a9e('0xc')],config[_0x0a9e('0x1')][_0x0a9e('0xd')],config[_0x0a9e('0x1')][_0x0a9e('0xe')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0x0a9e('0xf')],config[_0x0a9e('0x10')][_0x0a9e('0xc')],config[_0x0a9e('0x10')][_0x0a9e('0xd')],config[_0x0a9e('0x10')]['options'])};db[_0x0a9e('0x11')]=db['sequelize'][_0x0a9e('0x12')]('../api/user/user.model');db[_0x0a9e('0x13')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x14'));db['VoiceContext']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x15'));db[_0x0a9e('0x16')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x17'));db[_0x0a9e('0x18')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x19'));db[_0x0a9e('0x1a')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x1b'));db['VoiceRecording']=db[_0x0a9e('0x1')]['import']('../api/voiceRecording/voiceRecording.model');db[_0x0a9e('0x1c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x1d'));db['VoiceMail']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x1e'));db[_0x0a9e('0x1f')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x20'));db['VoiceCallReport']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x21'));db[_0x0a9e('0x22')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x23'));db['VoiceAgentReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x24'));db[_0x0a9e('0x25')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x26'));db[_0x0a9e('0x27')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/memberReport/memberReport.model');db[_0x0a9e('0x28')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x29'));db['VoiceTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2a'));db[_0x0a9e('0x2b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2c'));db[_0x0a9e('0x2d')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x2e'));db['UserChatQueue']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2f'));db[_0x0a9e('0x30')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x31'));db[_0x0a9e('0x32')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x33'));db[_0x0a9e('0x34')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userSmsQueue/userSmsQueue.model');db[_0x0a9e('0x35')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x36'));db[_0x0a9e('0x37')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x38'));db[_0x0a9e('0x39')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailServerIn/mailServerIn.model');db['MailServerOut']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x3a'));db[_0x0a9e('0x3b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailAccount/mailAccount.model');db[_0x0a9e('0x3c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailQueue/mailQueue.model');db[_0x0a9e('0x3d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailSubstatus/mailSubstatus.model');db['MailInteraction']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailInteraction/mailInteraction.model');db[_0x0a9e('0x3e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x3f'));db['MailApplication']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x40'));db['MailQueueReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x41'));db['Dashboard']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x42'));db[_0x0a9e('0x43')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x44'));db[_0x0a9e('0x45')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x46'));db[_0x0a9e('0x47')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x48'));db['FaxInteraction']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x49'));db[_0x0a9e('0x4a')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x4b'));db[_0x0a9e('0x4c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x4d'));db[_0x0a9e('0x4e')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x4f'));db[_0x0a9e('0x50')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x51'));db[_0x0a9e('0x52')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/smsApplication/smsApplication.model');db[_0x0a9e('0x53')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x54'));db[_0x0a9e('0x55')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x56'));db[_0x0a9e('0x57')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x58'));db[_0x0a9e('0x59')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x5a'));db[_0x0a9e('0x5b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x5c'));db[_0x0a9e('0x5d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/openchannelInteraction/openchannelInteraction.model');db[_0x0a9e('0x5e')]=db[_0x0a9e('0x1')]['import']('../api/openchannelMessage/openchannelMessage.model');db['OpenchannelQueue']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x5f'));db[_0x0a9e('0x60')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x61'));db[_0x0a9e('0x62')]=db['sequelize']['import']('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0x0a9e('0x63')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/chatApplication/chatApplication.model');db[_0x0a9e('0x64')]=db[_0x0a9e('0x1')]['import']('../api/chatInteraction/chatInteraction.model');db[_0x0a9e('0x65')]=db['sequelize'][_0x0a9e('0x12')]('../api/chatMessage/chatMessage.model');db[_0x0a9e('0x66')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0x0a9e('0x67')]=db[_0x0a9e('0x1')]['import']('../api/chatQueue/chatQueue.model');db[_0x0a9e('0x68')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x69'));db['ChatProactiveAction']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x6a'));db['CmCompany']=db['sequelize']['import'](_0x0a9e('0x6b'));db['CmContact']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x6c'));db[_0x0a9e('0x6d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x6e'));db[_0x0a9e('0x6f')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x70'));db[_0x0a9e('0x71')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x72'));db['CmHopperHistory']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/cmHopperHistory/cmHopperHistory.model');db[_0x0a9e('0x73')]=db['sequelize'][_0x0a9e('0x12')]('../api/reportAgentPreview/reportAgentPreview.model');db['CmCustomField']=db['sequelize'][_0x0a9e('0x12')]('../api/cmCustomField/cmCustomField.model');db[_0x0a9e('0x74')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x75'));db[_0x0a9e('0x76')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x77'));db['CannedAnswer']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x78'));db['Disposition']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x79'));db[_0x0a9e('0x7a')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x7b'));db['Interval']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x7c'));db[_0x0a9e('0x7d')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x7e'));db[_0x0a9e('0x7f')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x80'));db['VoiceQueuesLog']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x81'));db[_0x0a9e('0x82')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x83'));db[_0x0a9e('0x84')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x85'));db[_0x0a9e('0x86')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x87'));db[_0x0a9e('0x88')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x89'));db['CmContactHasItem']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8a'));db['CmHopperAdditionalPhone']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model');db[_0x0a9e('0x8b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8c'));db[_0x0a9e('0x8d')]=db['sequelize']['import']('../api/trigger/trigger.model');db[_0x0a9e('0x8e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8f'));db[_0x0a9e('0x90')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x91'));db['IntegrationReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x92'));db['AnalyticCustomReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x93'));db[_0x0a9e('0x94')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x95'));db[_0x0a9e('0x96')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x97'));db[_0x0a9e('0x98')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/analyticMetric/analyticMetric.model');db[_0x0a9e('0x99')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9a'));db['AnalyticTreeReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9b'));db[_0x0a9e('0x9c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9d'));db[_0x0a9e('0x9e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9f'));db[_0x0a9e('0xa0')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intSalesforceField/intSalesforceField.model');db[_0x0a9e('0xa1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0x0a9e('0xa2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xa3'));db['SugarcrmField']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xa4'));db['DeskAccount']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xa5'));db[_0x0a9e('0xa6')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xa7'));db[_0x0a9e('0xa8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xa9'));db[_0x0a9e('0xaa')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xab'));db[_0x0a9e('0xac')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xad'));db[_0x0a9e('0xae')]=db['sequelize'][_0x0a9e('0x12')]('../api/intZohoField/intZohoField.model');db[_0x0a9e('0xaf')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xb0'));db['ZendeskConfiguration']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb1'));db[_0x0a9e('0xb2')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb3'));db['FreshdeskAccount']=db['sequelize'][_0x0a9e('0x12')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db['FreshdeskConfiguration']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb4'));db[_0x0a9e('0xb5')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xb6'));db['VtigerAccount']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xb7'));db[_0x0a9e('0xb8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0x0a9e('0xb9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intVtigerField/intVtigerField.model');db[_0x0a9e('0xba')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xbb'));db[_0x0a9e('0xbc')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xbd'));db['ServicenowField']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intServicenowField/intServicenowField.model');db[_0x0a9e('0xbe')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intDynamics365Account/intDynamics365Account.model');db[_0x0a9e('0xbf')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xc0'));db[_0x0a9e('0xc1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc2'));db[_0x0a9e('0xc3')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xc4'));db[_0x0a9e('0xc5')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc6'));db[_0x0a9e('0xc7')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc8'));db[_0x0a9e('0x90')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x91'));db['Network']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc9'));db[_0x0a9e('0xca')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xcb'));db[_0x0a9e('0xcc')]=db['sequelize'][_0x0a9e('0x12')]('../api/chatInternalMessage/chatInternalMessage.model');db[_0x0a9e('0xcd')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xce'));db['JscriptyQuestionReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xcf'));db[_0x0a9e('0xd0')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xd1'));db[_0x0a9e('0xd2')]=db['sequelize']['import'](_0x0a9e('0xd3'));db[_0x0a9e('0xd4')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xd5'));db[_0x0a9e('0xd6')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xd7'));db['JscriptyProject']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xd8'));db[_0x0a9e('0xd9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xda'));db['SquareOdbc']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xdb'));db[_0x0a9e('0xdc')]=db[_0x0a9e('0x1')]['import']('../api/squareProject/squareProject.model');db[_0x0a9e('0xdd')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xde'));db[_0x0a9e('0xdf')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe0'));db['Team']=db['sequelize'][_0x0a9e('0x12')]('../api/team/team.model');db[_0x0a9e('0xe1')]=db['sequelize'][_0x0a9e('0x12')]('../api/license/license.model');db['Campaign']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/campaign/campaign.model');db[_0x0a9e('0xe2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe3'));db[_0x0a9e('0xe4')]=db['sequelize']['import'](_0x0a9e('0xe5'));db[_0x0a9e('0xe6')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe7'));db['MailTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailTransferReport/mailTransferReport.model');db[_0x0a9e('0xe8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe9'));db[_0x0a9e('0xea')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xeb'));db[_0x0a9e('0xec')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xed'));db[_0x0a9e('0xee')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xef'));db['CmList']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xf0'));db[_0x0a9e('0xf1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/voicePrefix/voicePrefix.model');db[_0x0a9e('0xf2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userProfile/userProfile.model');db[_0x0a9e('0xf3')]=db['sequelize'][_0x0a9e('0x12')]('../api/userProfileSection/userProfileSection.model');db[_0x0a9e('0xf4')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userProfileResource/userProfileResource.model');db[_0x0a9e('0xf5')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xf6'));db[_0x0a9e('0xf7')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xf8'));db[_0x0a9e('0xf9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xfa'));db[_0x0a9e('0xfb')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xfc'));db[_0x0a9e('0xfd')]=db[_0x0a9e('0x1')]['import']('../api/whatsappMessage/whatsappMessage.model');db[_0x0a9e('0xfe')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xff'));db['WhatsappTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x100'));db[_0x0a9e('0x101')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x102'));db[_0x0a9e('0x103')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x104'));db[_0x0a9e('0x105')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x106'));db[_0x0a9e('0x107')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x108'));db[_0x0a9e('0x109')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x10a'));db['UserSetting']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/user-setting/user-setting.model');db[_0x0a9e('0x11')][_0x0a9e('0x10b')](db[_0x0a9e('0x10c')],{'as':'VoiceMail','onDelete':'cascade','foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x10b')](db['UserSetting'],{'as':_0x0a9e('0x10d'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db[_0x0a9e('0x111')],{'as':_0x0a9e('0x112'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x2b')],{'as':_0x0a9e('0x113'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db['VoiceExtension'],{'as':_0x0a9e('0x114'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':_0x0a9e('0x117'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':_0x0a9e('0x118'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x53')],{'as':_0x0a9e('0x11a'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':'FaxInteractions','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x11d'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0xfb')],{'as':_0x0a9e('0x11e'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0xf5')],{'as':_0x0a9e('0x11f'),'foreignKey':_0x0a9e('0x120')});db[_0x0a9e('0x11')]['belongsTo'](db[_0x0a9e('0xf2')],{'as':'UserProfile','foreignKey':'userProfileId'});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x68')],{'as':_0x0a9e('0x122'),'through':_0x0a9e('0x123')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x125'),'through':_0x0a9e('0x126')});db[_0x0a9e('0x11')]['belongsToMany'](db['CmList'],{'as':_0x0a9e('0x127'),'through':_0x0a9e('0x128')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x12a')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x11d'),'through':_0x0a9e('0x12b')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'through':'user_has_chat_interactions'});db['User']['belongsToMany'](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x12c'),'through':_0x0a9e('0x12d')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x53')],{'as':'SmsInteractions','through':_0x0a9e('0x12e')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db['OpenchannelInteraction'],{'as':_0x0a9e('0x118'),'through':_0x0a9e('0x12f')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0xfb')],{'as':'WhatsappInteractions','through':_0x0a9e('0x130')});db['User'][_0x0a9e('0x121')](db['VoiceQueue'],{'as':_0x0a9e('0x131'),'through':_0x0a9e('0x2d'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0xf1')],{'as':_0x0a9e('0x132'),'through':_0x0a9e('0x109'),'required':![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x3c')],{'as':'MailQueues','through':_0x0a9e('0x30'),'required':![]});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x67')],{'as':_0x0a9e('0x133'),'through':_0x0a9e('0x134'),'required':![],'hooks':!![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x4c')],{'as':_0x0a9e('0x135'),'through':_0x0a9e('0x32'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x57')],{'as':_0x0a9e('0x136'),'through':_0x0a9e('0x34'),'required':![]});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x137')],{'as':'OpenchannelQueues','through':_0x0a9e('0x35'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x101')],{'as':_0x0a9e('0x138'),'through':_0x0a9e('0x37'),'required':![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'through':_0x0a9e('0x128')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x13a'),'through':_0x0a9e('0x13b')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x45')],{'as':'FaxAccounts','through':_0x0a9e('0x13c')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x13d'),'through':_0x0a9e('0x13e')});db[_0x0a9e('0x11')]['belongsToMany'](db['OpenchannelAccount'],{'as':_0x0a9e('0x13f'),'through':_0x0a9e('0x140')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x50')],{'as':_0x0a9e('0x141'),'through':_0x0a9e('0x142')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x143'),'through':_0x0a9e('0x144')});db[_0x0a9e('0x13')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':'SpiedAgents','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x145')});db[_0x0a9e('0x146')]['hasMany'](db[_0x0a9e('0x16')],{'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x16')][_0x0a9e('0x110')](db['VoiceExtension'],{'as':_0x0a9e('0x147'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x18')][_0x0a9e('0x121')](db[_0x0a9e('0x84')],{'as':_0x0a9e('0x148'),'through':_0x0a9e('0x149')});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x2b')],{'as':_0x0a9e('0x14a'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')]['hasMany'](db['CmHopper'],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':'VoiceQueueId'});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x116')],{'as':'HopperHistories','foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')][_0x0a9e('0x110')](db['CmHopperBlack'],{'as':_0x0a9e('0x14d'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'as':_0x0a9e('0x14e'),'foreignKey':_0x0a9e('0x14b')});db['VoiceQueue']['belongsTo'](db[_0x0a9e('0x28')],{'as':'Trunk','foreignKey':_0x0a9e('0x14f')});db[_0x0a9e('0x1a')][_0x0a9e('0x150')](db[_0x0a9e('0x28')],{'as':_0x0a9e('0x151'),'foreignKey':_0x0a9e('0x152')});db['VoiceQueue'][_0x0a9e('0x150')](db['Interval'],{'as':'Interval','foreignKey':_0x0a9e('0x153')});db['VoiceQueue'][_0x0a9e('0x150')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db['VoiceQueue'][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x127'),'through':'voice_queues_has_cm_lists'});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':'UserVoiceQueue'});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'as':_0x0a9e('0x155'),'through':_0x0a9e('0x105')});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x156'),'through':_0x0a9e('0x157')});db['VoiceRecording']['belongsTo'](db['User'],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x1c')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x10c')]['hasMany'](db['VoiceMailMessage'],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'mailboxuser','sourceKey':_0x0a9e('0x159')});db[_0x0a9e('0x1f')][_0x0a9e('0x150')](db[_0x0a9e('0x10c')],{'foreignKey':_0x0a9e('0x15a'),'targetKey':_0x0a9e('0x159')});db[_0x0a9e('0x15b')][_0x0a9e('0x110')](db[_0x0a9e('0x25')],{'as':_0x0a9e('0x15c'),'foreignKey':_0x0a9e('0x15d'),'constraints':![]});db[_0x0a9e('0x15b')]['hasMany'](db[_0x0a9e('0x15e')],{'as':_0x0a9e('0x15f'),'foreignKey':_0x0a9e('0x15d'),'constraints':![]});db[_0x0a9e('0x15b')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x15b')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db['MailServerIn'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x39')][_0x0a9e('0x150')](db[_0x0a9e('0x103')],{'as':'CloudProvider','foreignKey':_0x0a9e('0x162'),'onDelete':'restrict'});db[_0x0a9e('0x163')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x163')][_0x0a9e('0x150')](db[_0x0a9e('0x103')],{'as':_0x0a9e('0x103'),'foreignKey':_0x0a9e('0x162'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x3b')][_0x0a9e('0x10b')](db[_0x0a9e('0x39')],{'as':_0x0a9e('0x165'),'onDelete':_0x0a9e('0x10e')});db['MailAccount']['hasOne'](db[_0x0a9e('0x163')],{'as':_0x0a9e('0x166'),'onDelete':'cascade'});db['MailAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':'MailAccountId','onDelete':_0x0a9e('0x10e')});db['MailAccount'][_0x0a9e('0x110')](db['CannedAnswer'],{'as':_0x0a9e('0x169'),'foreignKey':'MailAccountId'});db[_0x0a9e('0x3b')][_0x0a9e('0x110')](db[_0x0a9e('0x3e')],{'as':'Messages','foreignKey':_0x0a9e('0x161')});db['MailAccount']['hasMany'](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x3b')][_0x0a9e('0x110')](db[_0x0a9e('0x16b')],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x161'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x3b')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x3b')][_0x0a9e('0x150')](db[_0x0a9e('0x8b')],{'as':_0x0a9e('0x8b'),'foreignKey':_0x0a9e('0x16e')});db[_0x0a9e('0x3b')]['belongsTo'](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x3b')]['belongsToMany'](db['User'],{'as':'Agents','through':_0x0a9e('0x13e')});db['MailQueue'][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x30')});db[_0x0a9e('0x3c')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x171'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x11c')]['hasMany'](db[_0x0a9e('0x3e')],{'as':'Messages','onDelete':_0x0a9e('0x10e'),'foreignKey':'MailInteractionId'});db[_0x0a9e('0x11c')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':'Account','foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x11c')]['belongsTo'](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x11c')]['belongsTo'](db['User'],{'as':'Owner','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x173'),'as':_0x0a9e('0x174')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x173'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x12b'),'foreignKey':_0x0a9e('0x177')});db[_0x0a9e('0x3e')]['hasMany'](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0x178'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':'User'});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x179'),'foreignKey':'MailInteractionId'});db['MailMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':'Account','foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x3e')]['belongsTo'](db[_0x0a9e('0x60')],{'as':'ChatWebsite','foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x3e')]['belongsTo'](db[_0x0a9e('0x66')],{'as':_0x0a9e('0x66'),'foreignKey':'ChatOfflineMessageId'});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x16b')]['belongsTo'](db[_0x0a9e('0x3b')],{'onDelete':_0x0a9e('0x164')});db['MailApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':'TagId'});db['MailQueueReport']['belongsTo'](db['MailAccount'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['CmList'],{'as':'List','foreignKey':_0x0a9e('0x16d')});db['MailQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['MailInteraction'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['MailMessage'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{});db[_0x0a9e('0x17d')]['hasMany'](db[_0x0a9e('0x43')],{'as':'Items','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x45')]['hasMany'](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':'FaxAccountId','onDelete':_0x0a9e('0x10e')});db['FaxAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x17e')],{'as':'Answers','foreignKey':_0x0a9e('0x17f')});db['FaxAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x45')][_0x0a9e('0x110')](db[_0x0a9e('0x47')],{'as':_0x0a9e('0x147'),'foreignKey':'FaxAccountId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x45')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x180'),'onDelete':'cascade'});db[_0x0a9e('0x45')]['hasMany'](db['FaxMessage'],{'as':_0x0a9e('0x158')});db['FaxAccount'][_0x0a9e('0x150')](db[_0x0a9e('0x28')],{'as':'Trunk'});db[_0x0a9e('0x45')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x45')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x0a9e('0x45')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'user_has_fax_accounts'});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':'restrict'});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x4c')],{'onDelete':'restrict'});db[_0x0a9e('0x47')]['belongsTo'](db[_0x0a9e('0x45')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db['FaxInteraction'][_0x0a9e('0x110')](db[_0x0a9e('0x4a')],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x182')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17f')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':'fax_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x185'),'as':'ThroughTags'});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x12d'),'foreignKey':_0x0a9e('0x182')});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x11')});db['FaxMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x179'),'foreignKey':'FaxInteractionId'});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':'Contact'});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0xe4'),'foreignKey':_0x0a9e('0x186')});db['FaxMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'as':'Account','foreignKey':_0x0a9e('0x17f')});db[_0x0a9e('0x4c')][_0x0a9e('0x121')](db['User'],{'as':'Agents','through':_0x0a9e('0x32')});db[_0x0a9e('0x4c')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x187'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db['FaxAccount'],{});db['FaxQueueReport'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db['FaxQueueReport'][_0x0a9e('0x150')](db['FaxInteraction'],{});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db[_0x0a9e('0x4a')],{});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db['FaxQueueReport'][_0x0a9e('0x150')](db['FaxQueue'],{});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x188'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x50')]['hasMany'](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db['SmsMessage'],{'as':_0x0a9e('0x158'),'foreignKey':_0x0a9e('0x188')});db['SmsAccount']['hasMany'](db[_0x0a9e('0x53')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db[_0x0a9e('0x52')],{'as':_0x0a9e('0x147'),'foreignKey':'SmsAccountId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x50')][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x50')][_0x0a9e('0x150')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x50')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x142')});db[_0x0a9e('0x52')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x164')});db['SmsApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x57')],{'onDelete':_0x0a9e('0x164')});db['SmsApplication']['belongsTo'](db[_0x0a9e('0x50')],{'onDelete':'restrict'});db[_0x0a9e('0x52')]['belongsTo'](db['Interval'],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x52')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x53')][_0x0a9e('0x110')](db[_0x0a9e('0x55')],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x189')});db['SmsInteraction']['belongsTo'](db[_0x0a9e('0x50')],{'as':'Account','foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x53')][_0x0a9e('0x150')](db['CmContact'],{'as':'Contact','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x53')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x53')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':'sms_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x53')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x18a'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x53')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Users','through':_0x0a9e('0x12e'),'foreignKey':_0x0a9e('0x189')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x55')][_0x0a9e('0x150')](db[_0x0a9e('0x53')],{'onDelete':'cascade','as':'Interaction','foreignKey':_0x0a9e('0x189')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x50')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x57')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x34'),'foreignKey':_0x0a9e('0x18b')});db[_0x0a9e('0x57')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x18c'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x59')]['hasMany'](db['Disposition'],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x18d'),'onDelete':_0x0a9e('0x10e')});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x59')][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':_0x0a9e('0x16a'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x5e')],{'as':'Messages','foreignKey':_0x0a9e('0x18d')});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x5b')],{'as':'Applications','foreignKey':_0x0a9e('0x18d'),'onDelete':_0x0a9e('0x10e')});db['OpenchannelAccount'][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x59')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x59')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x140')});db[_0x0a9e('0x5b')]['belongsTo'](db['User'],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x5b')][_0x0a9e('0x150')](db['OpenchannelQueue'],{'onDelete':'restrict','foreignKey':_0x0a9e('0x18e')});db['OpenchannelApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x5b')][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db['OpenchannelApplication']['belongsTo'](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x5d')][_0x0a9e('0x110')](db[_0x0a9e('0x5e')],{'as':'Messages','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x18f')});db[_0x0a9e('0x5d')]['belongsTo'](db[_0x0a9e('0x59')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x18d')});db['OpenchannelInteraction'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x5d')][_0x0a9e('0x150')](db['User'],{'as':'Owner','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x0a9e('0x175')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':'user_has_openchannel_interactions','foreignKey':_0x0a9e('0x18f')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':'cascade','as':_0x0a9e('0x11')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x5e')]['belongsTo'](db[_0x0a9e('0x5d')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x179'),'foreignKey':'OpenchannelInteractionId'});db[_0x0a9e('0x5e')]['belongsTo'](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0xe4'),'foreignKey':_0x0a9e('0x186')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x137')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x35'),'foreignKey':_0x0a9e('0x18e')});db[_0x0a9e('0x137')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x190'),'as':_0x0a9e('0x155')});db['ChatWebsite'][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x17a'),'onDelete':'cascade'});db[_0x0a9e('0x60')]['hasMany'](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x17a')});db['ChatWebsite'][_0x0a9e('0x110')](db[_0x0a9e('0x191')],{'as':_0x0a9e('0x192')});db[_0x0a9e('0x60')]['hasMany'](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x60')][_0x0a9e('0x110')](db[_0x0a9e('0x63')],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x17a'),'onDelete':'cascade'});db[_0x0a9e('0x60')][_0x0a9e('0x110')](db[_0x0a9e('0x65')],{'as':_0x0a9e('0x158')});db['ChatWebsite'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x60')][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'as':_0x0a9e('0x17b'),'foreignKey':_0x0a9e('0x153')});db['ChatWebsite'][_0x0a9e('0x150')](db['MailAccount'],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db['ChatWebsite'][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':_0x0a9e('0x154')});db['ChatWebsite'][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x13b')});db['OpenchannelQueueReport']['belongsTo'](db['OpenchannelAccount'],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db['OpenchannelQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x5d')],{});db['OpenchannelQueueReport'][_0x0a9e('0x150')](db['OpenchannelMessage'],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x137')],{});db['ChatApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x193'),'foreignKey':'UserId','onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x67')],{'as':_0x0a9e('0x194'),'foreignKey':_0x0a9e('0x195'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x196'),'foreignKey':_0x0a9e('0x17a'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x64')][_0x0a9e('0x110')](db['ChatMessage'],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x197')});db[_0x0a9e('0x64')]['belongsTo'](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x64')]['belongsTo'](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x64')]['belongsTo'](db['User'],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x198'),'as':_0x0a9e('0x174')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x198'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x199'),'foreignKey':_0x0a9e('0x197')});db['ChatMessage']['belongsTo'](db[_0x0a9e('0x11')],{'onDelete':'cascade','as':_0x0a9e('0x11')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':'cascade','as':'Contact','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x64')],{'onDelete':'cascade','as':_0x0a9e('0x179'),'foreignKey':_0x0a9e('0x197')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0xe4')],{'as':'Attachment','foreignKey':'AttachmentId'});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x66')][_0x0a9e('0x110')](db['Attachment'],{'as':_0x0a9e('0x178'),'foreignKey':_0x0a9e('0x19a'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db['ChatOfflineMessage']['belongsTo'](db['CmContact'],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db[_0x0a9e('0x66')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0x0a9e('0x67')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'UserChatQueue','hooks':!![]});db[_0x0a9e('0x67')]['belongsToMany'](db['Team'],{'through':_0x0a9e('0x19b'),'as':'Teams'});db[_0x0a9e('0x68')][_0x0a9e('0x110')](db[_0x0a9e('0xcc')],{'as':'Messages','foreignKey':_0x0a9e('0x19c'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x68')]['belongsToMany'](db['User'],{'as':_0x0a9e('0x14a'),'through':_0x0a9e('0x123')});db[_0x0a9e('0x191')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x196'),'foreignKey':'ChatWebsiteId'});db['CmCompany'][_0x0a9e('0x110')](db[_0x0a9e('0x124')],{'as':'Contacts','foreignKey':'CompanyId'});db['CmContact']['hasMany'](db['CmContactHasItem'],{'as':'Phones','foreignKey':_0x0a9e('0x19d')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':'HopperFinals','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':_0x0a9e('0x19e'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x172')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'as':'JscriptySessions','foreignKey':_0x0a9e('0x172')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':'OpenchannelInteractions','foreignKey':'ContactId','onDelete':_0x0a9e('0x164')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db['CmContact'][_0x0a9e('0x110')](db['SmsInteraction'],{'as':'SmsInteractions','foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':'FaxInteractions','foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db['MailInteraction'],{'as':_0x0a9e('0x11d'),'foreignKey':_0x0a9e('0x172'),'onDelete':'restrict'});db[_0x0a9e('0x124')][_0x0a9e('0x150')](db[_0x0a9e('0x19f')],{'as':_0x0a9e('0x1a0'),'foreignKey':'CompanyId'});db[_0x0a9e('0x124')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d'),'onDelete':'cascade'});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x176'),'through':'cm_user_has_contacts'});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'as':_0x0a9e('0x174'),'through':_0x0a9e('0x1a1')});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x1a1'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x6d')][_0x0a9e('0x110')](db[_0x0a9e('0x1a2')],{'as':_0x0a9e('0x1a3'),'foreignKey':_0x0a9e('0x1a4')});db['CmHopper'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':'List','foreignKey':'ListId','onDelete':'cascade'});db['CmHopper'][_0x0a9e('0x150')](db['User'],{'as':'Agent','foreignKey':'UserId'});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x1a')],{'as':_0x0a9e('0x194'),'foreignKey':'VoiceQueueId','onDelete':'cascade'});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x1a5')],{'as':_0x0a9e('0x1a5'),'foreignKey':'CampaignId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x1a6')});db['CmHopperBlack'][_0x0a9e('0x150')](db['CmContact'],{'as':'Contact','foreignKey':_0x0a9e('0x172'),'onDelete':'cascade'});db[_0x0a9e('0x6f')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6f')][_0x0a9e('0x150')](db[_0x0a9e('0x1a')],{'as':'Queue','foreignKey':_0x0a9e('0x14b'),'onDelete':_0x0a9e('0x10e')});db['CmHopperBlack'][_0x0a9e('0x150')](db[_0x0a9e('0x1a5')],{'as':_0x0a9e('0x1a5'),'foreignKey':_0x0a9e('0x1a7'),'onDelete':'cascade'});db[_0x0a9e('0x76')][_0x0a9e('0x110')](db[_0x0a9e('0x7a')],{'as':{'plural':_0x0a9e('0x1a8'),'singular':_0x0a9e('0x1a9')},'foreignKey':'AutomationAllId','onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x76')]['hasMany'](db[_0x0a9e('0x7a')],{'as':{'plural':'Any','singular':_0x0a9e('0x1aa')},'foreignKey':'AutomationAnyId','onDelete':_0x0a9e('0x10e'),'hooks':!![]});db['Automation'][_0x0a9e('0x110')](db[_0x0a9e('0x74')],{'as':_0x0a9e('0x1ab'),'foreignKey':'AutomationId','onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x167')]['hasMany'](db[_0x0a9e('0x167')],{'as':'Dispositions','foreignKey':_0x0a9e('0x1ac'),'onDelete':'cascade'});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db['Interval'],{'as':_0x0a9e('0x1ad'),'foreignKey':_0x0a9e('0x153'),'onDelete':_0x0a9e('0x10e'),'hooks':!![],'required':![]});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x114'),'foreignKey':_0x0a9e('0x153'),'onDelete':_0x0a9e('0x164')});db['Interval'][_0x0a9e('0x110')](db[_0x0a9e('0x16b')],{'as':_0x0a9e('0x1ae'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x17b')]['hasMany'](db['ChatApplication'],{'as':_0x0a9e('0x1af'),'foreignKey':'IntervalId'});db[_0x0a9e('0x17b')]['hasMany'](db[_0x0a9e('0x47')],{'as':_0x0a9e('0x1b0'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db[_0x0a9e('0x52')],{'as':_0x0a9e('0x1b1'),'foreignKey':'IntervalId'});db['Schedule'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{});db['Schedule'][_0x0a9e('0x150')](db[_0x0a9e('0x94')],{'foreignKey':_0x0a9e('0x1b2')});db['Schedule']['belongsTo'](db['AnalyticCustomReport'],{'foreignKey':_0x0a9e('0x1b3')});db[_0x0a9e('0x84')][_0x0a9e('0x121')](db[_0x0a9e('0x18')],{'as':'Mohs','through':_0x0a9e('0x149'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x86')]['belongsToMany'](db[_0x0a9e('0x124')],{'through':'cm_contact_has_tags'});db['Tag'][_0x0a9e('0x121')](db[_0x0a9e('0x64')],{'through':'chat_interaction_has_tags'});db['Tag'][_0x0a9e('0x121')](db['MailInteraction'],{'through':_0x0a9e('0x173')});db['Tag'][_0x0a9e('0x121')](db[_0x0a9e('0x53')],{'through':_0x0a9e('0x18a')});db['Tag']['belongsToMany'](db[_0x0a9e('0x11b')],{'through':_0x0a9e('0x185')});db[_0x0a9e('0x86')][_0x0a9e('0x121')](db['OpenchannelInteraction'],{'through':_0x0a9e('0x1b4')});db[_0x0a9e('0x86')]['belongsToMany'](db[_0x0a9e('0xfb')],{'through':_0x0a9e('0x1b5')});db[_0x0a9e('0x1b6')]['belongsTo'](db[_0x0a9e('0x88')],{'as':_0x0a9e('0x1b7'),'foreignKey':_0x0a9e('0x1b8')});db[_0x0a9e('0x1a2')][_0x0a9e('0x150')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x1b9'),'foreignKey':_0x0a9e('0x1a4')});db[_0x0a9e('0x1b6')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x19d')});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db[_0x0a9e('0x7a')],{'as':{'plural':_0x0a9e('0x1ba'),'singular':_0x0a9e('0x1bb')},'foreignKey':_0x0a9e('0x1bc'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db['Condition'],{'as':{'plural':_0x0a9e('0x1bd'),'singular':_0x0a9e('0x1be')},'foreignKey':_0x0a9e('0x1bf'),'onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db[_0x0a9e('0x74')],{'as':_0x0a9e('0x1ab'),'foreignKey':'TriggerId','onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x1c0')]['hasMany'](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'CustomReportId','hooks':!![]});db['AnalyticDefaultReport'][_0x0a9e('0x110')](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':'DefaultReportId'});db[_0x0a9e('0x98')][_0x0a9e('0x110')](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c2')});db['AnalyticFieldReport']['belongsTo'](db[_0x0a9e('0x98')],{'foreignKey':_0x0a9e('0x1c2')});db[_0x0a9e('0x9c')]['hasMany'](db[_0x0a9e('0x9e')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'AccountId'});db['SalesforceConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1c4'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0x0a9e('0x9e')]['hasMany'](db['SalesforceField'],{'as':'Descriptions','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x9e')]['hasMany'](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c6')});db['SalesforceConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0x9c')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa0')][_0x0a9e('0x110')](db['SalesforceField'],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa0')]['hasMany'](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['SalesforceField'][_0x0a9e('0x110')](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xa0')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xa1')][_0x0a9e('0x110')](db[_0x0a9e('0xa2')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa2')]['hasMany'](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa2')][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db['SugarcrmConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db['SugarcrmConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0xa1')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db['SugarcrmField']['hasMany'](db['SugarcrmField'],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db['SugarcrmField'][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1cc')]['hasMany'](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db['SugarcrmField'][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1cf')]['hasMany'](db[_0x0a9e('0xa6')],{'as':'Configurations','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa6')][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa6')]['hasMany'](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1cd'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'DescriptionId'});db['DeskConfiguration']['hasMany'](db['DeskField'],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':'FieldId'});db[_0x0a9e('0xa6')][_0x0a9e('0x150')](db[_0x0a9e('0x1cf')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa6')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':'int_desk_configuration_has_tags'});db['DeskField'][_0x0a9e('0x110')](db['DeskField'],{'as':_0x0a9e('0x1c8'),'foreignKey':'SubjectId'});db[_0x0a9e('0xa8')][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['DeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':'Field','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xa8')]['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0xaa')][_0x0a9e('0x110')](db[_0x0a9e('0xac')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xac')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':'Subjects','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xac')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1cd'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c5')});db['ZohoConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xac')][_0x0a9e('0x150')](db[_0x0a9e('0xaa')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1c8'),'foreignKey':'SubjectId'});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xae')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xaf')][_0x0a9e('0x110')](db['ZendeskConfiguration'],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'AccountId'});db['ZendeskConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1c4'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d0')]['hasMany'](db[_0x0a9e('0xb2')],{'as':'Descriptions','foreignKey':'DescriptionId'});db['ZendeskConfiguration'][_0x0a9e('0x110')](db['ZendeskField'],{'as':'Fields','foreignKey':'FieldId'});db[_0x0a9e('0x1d0')][_0x0a9e('0x150')](db[_0x0a9e('0xaf')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0x1d0')]['belongsToMany'](db['Tag'],{'through':_0x0a9e('0x1d1')});db[_0x0a9e('0xb2')][_0x0a9e('0x110')](db['ZendeskField'],{'as':'Subject','foreignKey':'SubjectId'});db[_0x0a9e('0xb2')][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['ZendeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb2')][_0x0a9e('0x150')](db['Variable'],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1d2')][_0x0a9e('0x110')](db[_0x0a9e('0x1d3')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0x1d3')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d3')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1d3')]['hasMany'](db['FreshdeskField'],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db['FreshdeskConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0x1d2')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db['FreshdeskConfiguration'][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x1d4')});db[_0x0a9e('0xb5')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xb5')][_0x0a9e('0x110')](db['FreshdeskField'],{'as':'Description','foreignKey':'DescriptionId'});db['FreshdeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb5')]['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1d5')]['hasMany'](db[_0x0a9e('0xb8')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xb8')]['hasMany'](db[_0x0a9e('0xb9')],{'as':_0x0a9e('0x1c4'),'foreignKey':_0x0a9e('0x1c9')});db['VtigerConfiguration'][_0x0a9e('0x110')](db['VtigerField'],{'as':_0x0a9e('0x1cd'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xb8')][_0x0a9e('0x110')](db[_0x0a9e('0xb9')],{'as':'Fields','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb8')][_0x0a9e('0x150')](db[_0x0a9e('0x1d5')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0xb9')][_0x0a9e('0x110')](db[_0x0a9e('0xb9')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db['VtigerField']['hasMany'](db[_0x0a9e('0xb9')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xb9')][_0x0a9e('0x110')](db['VtigerField'],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb9')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0xba')]['hasMany'](db[_0x0a9e('0xbc')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xbc')]['hasMany'](db['ServicenowField'],{'as':_0x0a9e('0x1c4'),'foreignKey':'SubjectId'});db[_0x0a9e('0xbc')][_0x0a9e('0x110')](db['ServicenowField'],{'as':_0x0a9e('0x1cd'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xbc')]['hasMany'](db[_0x0a9e('0x1d6')],{'as':_0x0a9e('0x1c1'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xbc')][_0x0a9e('0x150')](db[_0x0a9e('0xba')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db['ServicenowField'][_0x0a9e('0x110')](db[_0x0a9e('0x1d6')],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d6')]['hasMany'](db[_0x0a9e('0x1d6')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1d6')][_0x0a9e('0x110')](db['ServicenowField'],{'as':_0x0a9e('0x1cb'),'foreignKey':'FieldId'});db[_0x0a9e('0x1d6')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xbe')]['hasMany'](db[_0x0a9e('0xbf')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xbe')][_0x0a9e('0x150')](db['CloudProvider'],{'as':_0x0a9e('0x103'),'foreignKey':'CloudProviderId'});db[_0x0a9e('0xbf')][_0x0a9e('0x110')](db['Dynamics365Field'],{'as':'Subjects','onDelete':'cascade','foreignKey':'SubjectId'});db[_0x0a9e('0xbf')][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db['Dynamics365Configuration'][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xbf')][_0x0a9e('0x150')](db[_0x0a9e('0xbe')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db['Dynamics365Field'][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc1')][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xc1')][_0x0a9e('0x110')](db['Dynamics365Field'],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xc1')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db['FreshsalesAccount'][_0x0a9e('0x110')](db[_0x0a9e('0xc5')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xc5')][_0x0a9e('0x110')](db['FreshsalesField'],{'as':'Subjects','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc5')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1cd'),'foreignKey':'DescriptionId'});db[_0x0a9e('0xc5')]['hasMany'](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1c1'),'foreignKey':'FieldId'});db[_0x0a9e('0xc5')]['belongsTo'](db[_0x0a9e('0xc3')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0xc7')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc7')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['FreshsalesField'][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db['FreshsalesField']['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db['ChatQueueReport']['belongsTo'](db[_0x0a9e('0x60')],{});db['ChatQueueReport']['belongsTo'](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':'ListId'});db[_0x0a9e('0xca')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x64')],{});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x65')],{});db[_0x0a9e('0xca')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x67')],{});db['ChatInternalMessage']['belongsTo'](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x10e'),'foreignKey':'FromId'});db['ChatInternalMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1d7')});db[_0x0a9e('0xd0')]['hasMany'](db[_0x0a9e('0x1d8')],{'foreignKey':'SessionId','onDelete':'cascade'});db[_0x0a9e('0xd0')]['hasMany'](db[_0x0a9e('0xcd')],{'foreignKey':'SessionId','onDelete':_0x0a9e('0x10e')});db['SmsQueueReport']['belongsTo'](db[_0x0a9e('0x50')],{});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db[_0x0a9e('0xd2')]['belongsTo'](db[_0x0a9e('0x53')],{});db[_0x0a9e('0xd2')]['belongsTo'](db['SmsMessage'],{});db['SmsQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db[_0x0a9e('0x57')],{});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'foreignKey':_0x0a9e('0x1da')});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db[_0x0a9e('0x1d8')],{'foreignKey':_0x0a9e('0x1da')});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db['JscriptyAnswerReport'],{'foreignKey':'ProjectId'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'user_has_teams'});db[_0x0a9e('0x129')]['belongsToMany'](db[_0x0a9e('0x1a')],{'through':'TeamVoiceQueue','as':_0x0a9e('0x131')});db['Team']['belongsToMany'](db[_0x0a9e('0x3c')],{'through':_0x0a9e('0x171'),'as':_0x0a9e('0x1db')});db[_0x0a9e('0x129')]['belongsToMany'](db['ChatQueue'],{'through':_0x0a9e('0x19b'),'as':'ChatQueues'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db['FaxQueue'],{'through':_0x0a9e('0x187'),'as':'FaxQueues'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x57')],{'through':_0x0a9e('0x18c'),'as':_0x0a9e('0x136')});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x137')],{'through':_0x0a9e('0x190'),'as':_0x0a9e('0x1dc')});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x101')],{'through':_0x0a9e('0x1dd'),'as':_0x0a9e('0x138')});db[_0x0a9e('0x129')]['belongsToMany'](db[_0x0a9e('0xf1')],{'through':_0x0a9e('0x107'),'as':_0x0a9e('0x132')});db['Campaign'][_0x0a9e('0x110')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')][_0x0a9e('0x110')](db['CmHopperHistory'],{'as':_0x0a9e('0x19e'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')]['hasMany'](db[_0x0a9e('0x6f')],{'as':'HopperBlacks','foreignKey':'CampaignId'});db[_0x0a9e('0x1a5')]['belongsTo'](db[_0x0a9e('0x28')],{'as':'Trunk','foreignKey':_0x0a9e('0x14f')});db[_0x0a9e('0x1a5')][_0x0a9e('0x150')](db['Trunk'],{'as':_0x0a9e('0x151'),'foreignKey':'TrunkBackupId'});db['Campaign'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'as':_0x0a9e('0x17b'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x1a5')][_0x0a9e('0x150')](db['SquareProject'],{'as':_0x0a9e('0xdc'),'foreignKey':_0x0a9e('0x1de')});db[_0x0a9e('0x1a5')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':'Lists','through':_0x0a9e('0x1df')});db[_0x0a9e('0x1a5')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x156'),'through':_0x0a9e('0x1e0')});db[_0x0a9e('0xe4')][_0x0a9e('0x150')](db[_0x0a9e('0x66')],{'as':_0x0a9e('0x66'),'foreignKey':_0x0a9e('0x19a')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db['MailMessage'],{});db['MailTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0x11c')],{});db['MailTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'foreignKey':_0x0a9e('0x1e2'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0x1e1')]['belongsTo'](db['User'],{'foreignKey':'FromUserId','as':_0x0a9e('0x1e4')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{'foreignKey':'ToMailQueueId','as':'ToQueue'});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'foreignKey':_0x0a9e('0x1e7'),'as':_0x0a9e('0x1e8')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db[_0x0a9e('0x65')],{});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db['ChatInteraction'],{});db[_0x0a9e('0xe8')]['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x0a9e('0x1e9'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0xe8')]['belongsTo'](db[_0x0a9e('0x67')],{'foreignKey':_0x0a9e('0x1eb'),'as':'ToQueue'});db['ChatTransferReport']['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x0a9e('0x1ec'),'as':_0x0a9e('0x1e8')});db['FaxTransferReport'][_0x0a9e('0x150')](db['FaxMessage'],{});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11b')],{});db['FaxTransferReport']['belongsTo'](db[_0x0a9e('0x45')],{'foreignKey':_0x0a9e('0x1ed'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0xea')]['belongsTo'](db['FaxQueue'],{'foreignKey':_0x0a9e('0x1ee'),'as':_0x0a9e('0x1ef')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'foreignKey':'ToFaxAccountId','as':_0x0a9e('0x1e8')});db[_0x0a9e('0xec')]['belongsTo'](db[_0x0a9e('0x5e')],{});db['OpenchannelTransferReport']['belongsTo'](db['OpenchannelInteraction'],{});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db['OpenchannelAccount'],{'foreignKey':'FromOpenchannelAccountId','as':_0x0a9e('0x1e3')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'FromUserId','as':_0x0a9e('0x1e4')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x137')],{'foreignKey':'ToOpenchannelQueueId','as':'ToQueue'});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'foreignKey':'ToOpenchannelAccountId','as':'ToAccount'});db['SmsTransferReport']['belongsTo'](db[_0x0a9e('0x55')],{});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db[_0x0a9e('0x53')],{});db[_0x0a9e('0xee')]['belongsTo'](db[_0x0a9e('0x50')],{'foreignKey':_0x0a9e('0x1f0'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0xee')]['belongsTo'](db['SmsQueue'],{'foreignKey':'ToSmsQueueId','as':_0x0a9e('0x1ef')});db[_0x0a9e('0xee')]['belongsTo'](db[_0x0a9e('0x50')],{'foreignKey':'ToSmsAccountId','as':'ToAccount'});db['CmList']['hasMany'](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x16d'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x1f1')],{'as':_0x0a9e('0x1f2'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db['CmContact'],{'as':_0x0a9e('0x125'),'onDelete':'cascade','foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':'HopperHistory','foreignKey':'ListId'});db['CmList'][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':'ListId'});db[_0x0a9e('0x139')][_0x0a9e('0x121')](db[_0x0a9e('0x1a')],{'as':'Queues','through':_0x0a9e('0x1f3')});db[_0x0a9e('0x139')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x128')});db[_0x0a9e('0xf1')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x114'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf1')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'UserVoicePrefix'});db[_0x0a9e('0xf1')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':'TeamVoicePrefix','as':_0x0a9e('0x155')});db[_0x0a9e('0xf2')][_0x0a9e('0x110')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'foreignKey':_0x0a9e('0x1f4')});db['UserProfile'][_0x0a9e('0x110')](db['UserProfileSection'],{'as':_0x0a9e('0x1f5'),'foreignKey':_0x0a9e('0x1f4'),'onDelete':_0x0a9e('0x10e')});db['UserProfileSection']['hasMany'](db['UserProfileResource'],{'as':_0x0a9e('0x1f6'),'foreignKey':_0x0a9e('0x1f7'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':'Dispositions','foreignKey':_0x0a9e('0x1f8'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db['CannedAnswer'],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x1f8')});db['WhatsappAccount'][_0x0a9e('0x110')](db[_0x0a9e('0xfd')],{'as':_0x0a9e('0x158'),'foreignKey':'WhatsappAccountId'});db[_0x0a9e('0xf7')]['hasMany'](db[_0x0a9e('0xfb')],{'as':'Interactions'});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db['WhatsappApplication'],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x1f8'),'onDelete':_0x0a9e('0x10e')});db['WhatsappAccount'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0xf7')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0xf7')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x144')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db[_0x0a9e('0x101')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db['WhatsappAccount'],{'onDelete':_0x0a9e('0x164')});db['WhatsappApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0xf9')]['belongsTo'](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db['WhatsappInteraction'][_0x0a9e('0x110')](db['WhatsappMessage'],{'as':'Messages','onDelete':'cascade','foreignKey':_0x0a9e('0x1f9')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1f8')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0xfb')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x1b5'),'as':_0x0a9e('0x174')});db['WhatsappInteraction'][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x1b5'),'as':_0x0a9e('0x175')});db[_0x0a9e('0xfb')]['belongsToMany'](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x130'),'foreignKey':'WhatsappInteractionId'});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11')});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':'cascade','as':_0x0a9e('0x160')});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db['WhatsappInteraction'],{'onDelete':'cascade','as':_0x0a9e('0x179'),'foreignKey':_0x0a9e('0x1f9')});db[_0x0a9e('0xfd')]['belongsTo'](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1f8')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db[_0x0a9e('0xf7')],{});db['WhatsappQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db['WhatsappInteraction'],{});db['WhatsappQueueReport']['belongsTo'](db[_0x0a9e('0x101')],{});db[_0x0a9e('0xfe')]['belongsTo'](db['WhatsappMessage'],{});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db['User'],{});db['WhatsappTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0xfd')],{});db['WhatsappTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0xfb')],{});db[_0x0a9e('0x1fa')]['belongsTo'](db['WhatsappAccount'],{'foreignKey':_0x0a9e('0x1fb'),'as':_0x0a9e('0x1e3')});db['WhatsappTransferReport']['belongsTo'](db[_0x0a9e('0xf7')],{'foreignKey':_0x0a9e('0x1fc'),'as':'ToAccount'});db[_0x0a9e('0x1fa')]['belongsTo'](db['WhatsappQueue'],{'foreignKey':_0x0a9e('0x1fd'),'as':_0x0a9e('0x1ef')});db['WhatsappTransferReport']['belongsTo'](db['User'],{'foreignKey':_0x0a9e('0x1ea'),'as':'FromAgent'});db[_0x0a9e('0x1fa')][_0x0a9e('0x150')](db['User'],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0x101')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x37'),'foreignKey':'WhatsappQueueId'});db[_0x0a9e('0x101')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x1dd'),'as':'Teams'});db[_0x0a9e('0x1fe')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x1ff'),'foreignKey':_0x0a9e('0x10f'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x103')][_0x0a9e('0x10b')](db['Dynamics365Account'],{'as':_0x0a9e('0xbe'),'onDelete':_0x0a9e('0x164')});db['CloudProvider'][_0x0a9e('0x10b')](db['MailServerIn'],{'as':'Imap','onDelete':_0x0a9e('0x164')});db['CloudProvider']['hasOne'](db['MailServerOut'],{'as':'Smtp','onDelete':_0x0a9e('0x164')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file +var _0xa9e0=['SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','License','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','../api/cmList/cmList.model','VoicePrefix','UserProfile','UserProfileSection','UserProfileResource','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','hasOne','VoiceMail','userSetting','cascade','UserId','hasMany','VoiceRecording','Recordings','VoiceQueuesRt','Extensions','HopperFinals','CmHopperHistory','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteraction','MailInteraction','MailInteractions','WhatsappInteractions','UserNotifications','SenderId','belongsToMany','Groups','chat_group_has_users','CmContact','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','Team','user_has_teams','user_has_mail_interactions','FaxInteractions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefixes','ChatQueues','UserChatQueue','FaxQueues','SmsQueues','OpenchannelQueue','WhatsappQueues','CmList','ChatWebsites','user_has_chat_websites','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','ChanSpyId','VoiceContext','Applications','Sounds','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperBlacks','JscriptySessions','TrunkId','belongsTo','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPauseId','Teams','BlackLists','voice_queues_has_cm_blacklists','Messages','mailbox','mailboxuser','VoiceCallReport','QueueCalls','uniqueid','VoiceAgentReport','AgentReports','Contact','MailAccountId','CloudProviderId','MailServerOut','restrict','Imap','Smtp','Disposition','Dispositions','Answers','Interactions','MailApplication','List','ListId','TemplateId','mandatoryDispositionPause','Agents','team_has_mail_queues','ContactId','mail_interaction_has_tags','Tags','ThroughTags','Users','MailInteractionId','Attachments','Interaction','ChatWebsiteId','Interval','MailQueueReport','Dashboard','CannedAnswer','FaxAccountId','Exntensions','TagId','FaxInteractionId','Account','Owner','fax_interaction_has_tags','AttachmentId','team_has_fax_queues','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','team_has_openchannel_queues','ChatProactiveAction','ProactiveActions','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','user_has_chat_interactions','ChatOfflineMessageId','team_has_chat_queues','ChatGroupId','CmContactId','HopperHistories','CmCompany','Company','cm_contact_has_tags','CmHopperAdditionalPhone','AdditionalPhones','CmHopperId','Campaign','OwnerId','CampaignId','All','OneAll','OneAny','Actions','ParentId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','openchannel_interaction_has_tags','whatsapp_interaction_has_tags','CmContactHasItem','ItemType','ItemTypeId','Hopper','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','AnalyticCustomReport','Fields','MetricId','Configurations','Subjects','DescriptionId','FieldId','AccountId','Subject','SubjectId','Description','Field','SugarcrmField','Descriptions','VariableId','DeskAccount','ZendeskConfiguration','int_zendesk_configuration_has_tags','FreshdeskAccount','FreshdeskConfiguration','int_freshdesk_configuration_has_tags','VtigerAccount','ServicenowField','ToId','JscriptyQuestionReport','JscriptyProject','ProjectId','MailQueues','OpenchannelQueues','team_has_whatsapp_queues','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromAccount','FromAgent','ToUserId','ToAgent','ToMailAccountId','ToAccount','FromChatWebsiteId','FromUserId','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToQueue','FromSmsAccountId','CmCustomField','CustomFields','voice_queues_has_cm_lists','userProfileId','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','WhatsappTransferReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','UserSetting','user','../config/environment','sequelize','lodash','motion2','xcall','xC@LL1234','127.0.0.1','utf8mb4','name','utf8','defaultsDeep','mysql','username','password','options','database','sequelizeHistory','User','import','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','ScreenRecording','../api/screenRecording/screenRecording.model','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','Trunk','../api/trunk/trunk.model','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerOut/mailServerOut.model','MailAccount','MailQueue','MailSubstatus','MailMessage','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','OpenchannelMessage','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','ChatApplication','ChatInteraction','ChatMessage','ChatOfflineMessage','ChatQueue','ChatGroup','../api/chatGroup/chatGroup.model','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','ReportAgentPreview','Action','../api/action/action.model','Automation','../api/automation/automation.model','../api/cannedAnswer/cannedAnswer.model','../api/disposition/disposition.model','Condition','../api/condition/condition.model','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','../api/cmContactHasItem/cmContactHasItem.model','Template','../api/template/template.model','Trigger','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','../api/integrationReport/integrationReport.model','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','SugarcrmAccount','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','../api/intSugarcrmField/intSugarcrmField.model','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','VtigerField','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','Dynamics365Account','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','../api/squareOdbc/squareOdbc.model','SquareProject'];(function(_0x967959,_0x53c5c1){var _0x5c4489=function(_0x1ae5c6){while(--_0x1ae5c6){_0x967959['push'](_0x967959['shift']());}};_0x5c4489(++_0x53c5c1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'use strict';var config=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var jstz=require('jstz');var timezone=jstz['determine']();config[_0x0a9e('0x1')]=_['defaultsDeep'](config[_0x0a9e('0x1')],{'database':_0x0a9e('0x3'),'username':_0x0a9e('0x4'),'password':_0x0a9e('0x5'),'options':{'host':_0x0a9e('0x6'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x0a9e('0x7')},'logging':![],'timezone':timezone[_0x0a9e('0x8')](),'define':{'charset':_0x0a9e('0x9'),'collate':'utf8_general_ci'}}});config['sequelizeHistory']=_[_0x0a9e('0xa')](config['sequelizeHistory'],{'database':'motion2','username':_0x0a9e('0x4'),'password':_0x0a9e('0x5'),'options':{'host':_0x0a9e('0x6'),'port':0xcea,'dialect':_0x0a9e('0xb'),'dialectOptions':{'charset':_0x0a9e('0x7')},'logging':![],'timezone':timezone[_0x0a9e('0x8')](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize']['database'],config[_0x0a9e('0x1')][_0x0a9e('0xc')],config[_0x0a9e('0x1')][_0x0a9e('0xd')],config[_0x0a9e('0x1')][_0x0a9e('0xe')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0x0a9e('0xf')],config[_0x0a9e('0x10')][_0x0a9e('0xc')],config[_0x0a9e('0x10')][_0x0a9e('0xd')],config[_0x0a9e('0x10')]['options'])};db[_0x0a9e('0x11')]=db['sequelize'][_0x0a9e('0x12')]('../api/user/user.model');db[_0x0a9e('0x13')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x14'));db['VoiceContext']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x15'));db[_0x0a9e('0x16')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x17'));db[_0x0a9e('0x18')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x19'));db[_0x0a9e('0x1a')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x1b'));db['VoiceRecording']=db[_0x0a9e('0x1')]['import']('../api/voiceRecording/voiceRecording.model');db[_0x0a9e('0x1c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x1d'));db['VoiceMail']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x1e'));db[_0x0a9e('0x1f')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x20'));db['VoiceCallReport']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x21'));db[_0x0a9e('0x22')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x23'));db['VoiceAgentReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x24'));db[_0x0a9e('0x25')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x26'));db[_0x0a9e('0x27')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/memberReport/memberReport.model');db[_0x0a9e('0x28')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x29'));db['VoiceTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2a'));db[_0x0a9e('0x2b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2c'));db[_0x0a9e('0x2d')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x2e'));db['UserChatQueue']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2f'));db[_0x0a9e('0x30')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x31'));db[_0x0a9e('0x32')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x33'));db[_0x0a9e('0x34')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userSmsQueue/userSmsQueue.model');db[_0x0a9e('0x35')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x36'));db[_0x0a9e('0x37')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x38'));db[_0x0a9e('0x39')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailServerIn/mailServerIn.model');db['MailServerOut']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x3a'));db[_0x0a9e('0x3b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailAccount/mailAccount.model');db[_0x0a9e('0x3c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailQueue/mailQueue.model');db[_0x0a9e('0x3d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailSubstatus/mailSubstatus.model');db['MailInteraction']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailInteraction/mailInteraction.model');db[_0x0a9e('0x3e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x3f'));db['MailApplication']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x40'));db['MailQueueReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x41'));db['Dashboard']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x42'));db[_0x0a9e('0x43')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x44'));db[_0x0a9e('0x45')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x46'));db[_0x0a9e('0x47')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x48'));db['FaxInteraction']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x49'));db[_0x0a9e('0x4a')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x4b'));db[_0x0a9e('0x4c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x4d'));db[_0x0a9e('0x4e')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x4f'));db[_0x0a9e('0x50')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x51'));db[_0x0a9e('0x52')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/smsApplication/smsApplication.model');db[_0x0a9e('0x53')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x54'));db[_0x0a9e('0x55')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x56'));db[_0x0a9e('0x57')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x58'));db[_0x0a9e('0x59')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x5a'));db[_0x0a9e('0x5b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x5c'));db[_0x0a9e('0x5d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/openchannelInteraction/openchannelInteraction.model');db[_0x0a9e('0x5e')]=db[_0x0a9e('0x1')]['import']('../api/openchannelMessage/openchannelMessage.model');db['OpenchannelQueue']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x5f'));db[_0x0a9e('0x60')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x61'));db[_0x0a9e('0x62')]=db['sequelize']['import']('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0x0a9e('0x63')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/chatApplication/chatApplication.model');db[_0x0a9e('0x64')]=db[_0x0a9e('0x1')]['import']('../api/chatInteraction/chatInteraction.model');db[_0x0a9e('0x65')]=db['sequelize'][_0x0a9e('0x12')]('../api/chatMessage/chatMessage.model');db[_0x0a9e('0x66')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0x0a9e('0x67')]=db[_0x0a9e('0x1')]['import']('../api/chatQueue/chatQueue.model');db[_0x0a9e('0x68')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x69'));db['ChatProactiveAction']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x6a'));db['CmCompany']=db['sequelize']['import'](_0x0a9e('0x6b'));db['CmContact']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x6c'));db[_0x0a9e('0x6d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x6e'));db[_0x0a9e('0x6f')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x70'));db[_0x0a9e('0x71')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x72'));db['CmHopperHistory']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/cmHopperHistory/cmHopperHistory.model');db[_0x0a9e('0x73')]=db['sequelize'][_0x0a9e('0x12')]('../api/reportAgentPreview/reportAgentPreview.model');db['CmCustomField']=db['sequelize'][_0x0a9e('0x12')]('../api/cmCustomField/cmCustomField.model');db[_0x0a9e('0x74')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x75'));db[_0x0a9e('0x76')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x77'));db['CannedAnswer']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x78'));db['Disposition']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x79'));db[_0x0a9e('0x7a')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x7b'));db['Interval']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x7c'));db[_0x0a9e('0x7d')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x7e'));db[_0x0a9e('0x7f')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x80'));db['VoiceQueuesLog']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x81'));db[_0x0a9e('0x82')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x83'));db[_0x0a9e('0x84')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x85'));db[_0x0a9e('0x86')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x87'));db[_0x0a9e('0x88')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x89'));db['CmContactHasItem']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8a'));db['CmHopperAdditionalPhone']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model');db[_0x0a9e('0x8b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8c'));db[_0x0a9e('0x8d')]=db['sequelize']['import']('../api/trigger/trigger.model');db[_0x0a9e('0x8e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8f'));db[_0x0a9e('0x90')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x91'));db['IntegrationReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x92'));db['AnalyticCustomReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x93'));db[_0x0a9e('0x94')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x95'));db[_0x0a9e('0x96')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x97'));db[_0x0a9e('0x98')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/analyticMetric/analyticMetric.model');db[_0x0a9e('0x99')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9a'));db['AnalyticTreeReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9b'));db[_0x0a9e('0x9c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9d'));db[_0x0a9e('0x9e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9f'));db[_0x0a9e('0xa0')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intSalesforceField/intSalesforceField.model');db[_0x0a9e('0xa1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0x0a9e('0xa2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xa3'));db['SugarcrmField']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xa4'));db['DeskAccount']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xa5'));db[_0x0a9e('0xa6')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xa7'));db[_0x0a9e('0xa8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xa9'));db[_0x0a9e('0xaa')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xab'));db[_0x0a9e('0xac')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xad'));db[_0x0a9e('0xae')]=db['sequelize'][_0x0a9e('0x12')]('../api/intZohoField/intZohoField.model');db[_0x0a9e('0xaf')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xb0'));db['ZendeskConfiguration']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb1'));db[_0x0a9e('0xb2')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb3'));db['FreshdeskAccount']=db['sequelize'][_0x0a9e('0x12')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db['FreshdeskConfiguration']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb4'));db[_0x0a9e('0xb5')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xb6'));db['VtigerAccount']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xb7'));db[_0x0a9e('0xb8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0x0a9e('0xb9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intVtigerField/intVtigerField.model');db[_0x0a9e('0xba')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xbb'));db[_0x0a9e('0xbc')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xbd'));db['ServicenowField']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intServicenowField/intServicenowField.model');db[_0x0a9e('0xbe')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intDynamics365Account/intDynamics365Account.model');db[_0x0a9e('0xbf')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xc0'));db[_0x0a9e('0xc1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc2'));db[_0x0a9e('0xc3')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xc4'));db[_0x0a9e('0xc5')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc6'));db[_0x0a9e('0xc7')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc8'));db[_0x0a9e('0x90')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x91'));db['Network']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc9'));db[_0x0a9e('0xca')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xcb'));db[_0x0a9e('0xcc')]=db['sequelize'][_0x0a9e('0x12')]('../api/chatInternalMessage/chatInternalMessage.model');db[_0x0a9e('0xcd')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xce'));db['JscriptyQuestionReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xcf'));db[_0x0a9e('0xd0')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xd1'));db[_0x0a9e('0xd2')]=db['sequelize']['import'](_0x0a9e('0xd3'));db[_0x0a9e('0xd4')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xd5'));db[_0x0a9e('0xd6')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xd7'));db['JscriptyProject']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xd8'));db[_0x0a9e('0xd9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xda'));db['SquareOdbc']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xdb'));db[_0x0a9e('0xdc')]=db[_0x0a9e('0x1')]['import']('../api/squareProject/squareProject.model');db[_0x0a9e('0xdd')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xde'));db[_0x0a9e('0xdf')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe0'));db['Team']=db['sequelize'][_0x0a9e('0x12')]('../api/team/team.model');db[_0x0a9e('0xe1')]=db['sequelize'][_0x0a9e('0x12')]('../api/license/license.model');db['Campaign']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/campaign/campaign.model');db[_0x0a9e('0xe2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe3'));db[_0x0a9e('0xe4')]=db['sequelize']['import'](_0x0a9e('0xe5'));db[_0x0a9e('0xe6')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe7'));db['MailTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailTransferReport/mailTransferReport.model');db[_0x0a9e('0xe8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe9'));db[_0x0a9e('0xea')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xeb'));db[_0x0a9e('0xec')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xed'));db[_0x0a9e('0xee')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xef'));db['CmList']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xf0'));db[_0x0a9e('0xf1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/voicePrefix/voicePrefix.model');db[_0x0a9e('0xf2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userProfile/userProfile.model');db[_0x0a9e('0xf3')]=db['sequelize'][_0x0a9e('0x12')]('../api/userProfileSection/userProfileSection.model');db[_0x0a9e('0xf4')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userProfileResource/userProfileResource.model');db[_0x0a9e('0xf5')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xf6'));db[_0x0a9e('0xf7')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xf8'));db[_0x0a9e('0xf9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xfa'));db[_0x0a9e('0xfb')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xfc'));db[_0x0a9e('0xfd')]=db[_0x0a9e('0x1')]['import']('../api/whatsappMessage/whatsappMessage.model');db[_0x0a9e('0xfe')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xff'));db['WhatsappTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x100'));db[_0x0a9e('0x101')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x102'));db[_0x0a9e('0x103')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x104'));db[_0x0a9e('0x105')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x106'));db[_0x0a9e('0x107')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x108'));db[_0x0a9e('0x109')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x10a'));db['UserSetting']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/user-setting/user-setting.model');db[_0x0a9e('0x11')][_0x0a9e('0x10b')](db[_0x0a9e('0x10c')],{'as':'VoiceMail','onDelete':'cascade','foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x10b')](db['UserSetting'],{'as':_0x0a9e('0x10d'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db[_0x0a9e('0x111')],{'as':_0x0a9e('0x112'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x2b')],{'as':_0x0a9e('0x113'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db['VoiceExtension'],{'as':_0x0a9e('0x114'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':_0x0a9e('0x117'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':_0x0a9e('0x118'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x53')],{'as':_0x0a9e('0x11a'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':'FaxInteractions','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x11d'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0xfb')],{'as':_0x0a9e('0x11e'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0xf5')],{'as':_0x0a9e('0x11f'),'foreignKey':_0x0a9e('0x120')});db[_0x0a9e('0x11')]['belongsTo'](db[_0x0a9e('0xf2')],{'as':'UserProfile','foreignKey':'userProfileId'});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x68')],{'as':_0x0a9e('0x122'),'through':_0x0a9e('0x123')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x125'),'through':_0x0a9e('0x126')});db[_0x0a9e('0x11')]['belongsToMany'](db['CmList'],{'as':_0x0a9e('0x127'),'through':_0x0a9e('0x128')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x12a')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x11d'),'through':_0x0a9e('0x12b')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'through':'user_has_chat_interactions'});db['User']['belongsToMany'](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x12c'),'through':_0x0a9e('0x12d')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x53')],{'as':'SmsInteractions','through':_0x0a9e('0x12e')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db['OpenchannelInteraction'],{'as':_0x0a9e('0x118'),'through':_0x0a9e('0x12f')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0xfb')],{'as':'WhatsappInteractions','through':_0x0a9e('0x130')});db['User'][_0x0a9e('0x121')](db['VoiceQueue'],{'as':_0x0a9e('0x131'),'through':_0x0a9e('0x2d'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0xf1')],{'as':_0x0a9e('0x132'),'through':_0x0a9e('0x109'),'required':![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x3c')],{'as':'MailQueues','through':_0x0a9e('0x30'),'required':![]});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x67')],{'as':_0x0a9e('0x133'),'through':_0x0a9e('0x134'),'required':![],'hooks':!![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x4c')],{'as':_0x0a9e('0x135'),'through':_0x0a9e('0x32'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x57')],{'as':_0x0a9e('0x136'),'through':_0x0a9e('0x34'),'required':![]});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x137')],{'as':'OpenchannelQueues','through':_0x0a9e('0x35'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x101')],{'as':_0x0a9e('0x138'),'through':_0x0a9e('0x37'),'required':![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'through':_0x0a9e('0x128')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x13a'),'through':_0x0a9e('0x13b')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x45')],{'as':'FaxAccounts','through':_0x0a9e('0x13c')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x13d'),'through':_0x0a9e('0x13e')});db[_0x0a9e('0x11')]['belongsToMany'](db['OpenchannelAccount'],{'as':_0x0a9e('0x13f'),'through':_0x0a9e('0x140')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x50')],{'as':_0x0a9e('0x141'),'through':_0x0a9e('0x142')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x143'),'through':_0x0a9e('0x144')});db[_0x0a9e('0x13')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':'SpiedAgents','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x145')});db[_0x0a9e('0x146')]['hasMany'](db[_0x0a9e('0x16')],{'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x16')][_0x0a9e('0x110')](db['VoiceExtension'],{'as':_0x0a9e('0x147'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x18')][_0x0a9e('0x121')](db[_0x0a9e('0x84')],{'as':_0x0a9e('0x148'),'through':_0x0a9e('0x149')});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x2b')],{'as':_0x0a9e('0x14a'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')]['hasMany'](db['CmHopper'],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':'VoiceQueueId'});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x116')],{'as':'HopperHistories','foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')][_0x0a9e('0x110')](db['CmHopperBlack'],{'as':_0x0a9e('0x14d'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'as':_0x0a9e('0x14e'),'foreignKey':_0x0a9e('0x14b')});db['VoiceQueue']['belongsTo'](db[_0x0a9e('0x28')],{'as':'Trunk','foreignKey':_0x0a9e('0x14f')});db[_0x0a9e('0x1a')][_0x0a9e('0x150')](db[_0x0a9e('0x28')],{'as':_0x0a9e('0x151'),'foreignKey':_0x0a9e('0x152')});db['VoiceQueue'][_0x0a9e('0x150')](db['Interval'],{'as':'Interval','foreignKey':_0x0a9e('0x153')});db['VoiceQueue'][_0x0a9e('0x150')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db['VoiceQueue'][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x127'),'through':'voice_queues_has_cm_lists'});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':'UserVoiceQueue'});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'as':_0x0a9e('0x155'),'through':_0x0a9e('0x105')});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x156'),'through':_0x0a9e('0x157')});db['VoiceRecording']['belongsTo'](db['User'],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x1c')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x10c')]['hasMany'](db['VoiceMailMessage'],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'mailboxuser','sourceKey':_0x0a9e('0x159')});db[_0x0a9e('0x1f')][_0x0a9e('0x150')](db[_0x0a9e('0x10c')],{'foreignKey':_0x0a9e('0x15a'),'targetKey':_0x0a9e('0x159')});db[_0x0a9e('0x15b')][_0x0a9e('0x110')](db[_0x0a9e('0x25')],{'as':_0x0a9e('0x15c'),'foreignKey':_0x0a9e('0x15d'),'constraints':![]});db[_0x0a9e('0x15b')]['hasMany'](db[_0x0a9e('0x15e')],{'as':_0x0a9e('0x15f'),'foreignKey':_0x0a9e('0x15d'),'constraints':![]});db[_0x0a9e('0x15b')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x15b')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db['MailServerIn'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x39')][_0x0a9e('0x150')](db[_0x0a9e('0x103')],{'as':'CloudProvider','foreignKey':_0x0a9e('0x162'),'onDelete':'restrict'});db[_0x0a9e('0x163')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x163')][_0x0a9e('0x150')](db[_0x0a9e('0x103')],{'as':_0x0a9e('0x103'),'foreignKey':_0x0a9e('0x162'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x3b')][_0x0a9e('0x10b')](db[_0x0a9e('0x39')],{'as':_0x0a9e('0x165'),'onDelete':_0x0a9e('0x10e')});db['MailAccount']['hasOne'](db[_0x0a9e('0x163')],{'as':_0x0a9e('0x166'),'onDelete':'cascade'});db['MailAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':'MailAccountId','onDelete':_0x0a9e('0x10e')});db['MailAccount'][_0x0a9e('0x110')](db['CannedAnswer'],{'as':_0x0a9e('0x169'),'foreignKey':'MailAccountId'});db[_0x0a9e('0x3b')][_0x0a9e('0x110')](db[_0x0a9e('0x3e')],{'as':'Messages','foreignKey':_0x0a9e('0x161')});db['MailAccount']['hasMany'](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x3b')][_0x0a9e('0x110')](db[_0x0a9e('0x16b')],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x161'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x3b')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x3b')][_0x0a9e('0x150')](db[_0x0a9e('0x8b')],{'as':_0x0a9e('0x8b'),'foreignKey':_0x0a9e('0x16e')});db[_0x0a9e('0x3b')]['belongsTo'](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x3b')]['belongsToMany'](db['User'],{'as':'Agents','through':_0x0a9e('0x13e')});db['MailQueue'][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x30')});db[_0x0a9e('0x3c')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x171'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x11c')]['hasMany'](db[_0x0a9e('0x3e')],{'as':'Messages','onDelete':_0x0a9e('0x10e'),'foreignKey':'MailInteractionId'});db[_0x0a9e('0x11c')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':'Account','foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x11c')]['belongsTo'](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x11c')]['belongsTo'](db['User'],{'as':'Owner','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x173'),'as':_0x0a9e('0x174')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x173'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x12b'),'foreignKey':_0x0a9e('0x177')});db[_0x0a9e('0x3e')]['hasMany'](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0x178'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':'User'});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x179'),'foreignKey':'MailInteractionId'});db['MailMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':'Account','foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x3e')]['belongsTo'](db[_0x0a9e('0x60')],{'as':'ChatWebsite','foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x3e')]['belongsTo'](db[_0x0a9e('0x66')],{'as':_0x0a9e('0x66'),'foreignKey':'ChatOfflineMessageId'});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x16b')]['belongsTo'](db[_0x0a9e('0x3b')],{'onDelete':_0x0a9e('0x164')});db['MailApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':'TagId'});db['MailQueueReport']['belongsTo'](db['MailAccount'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['CmList'],{'as':'List','foreignKey':_0x0a9e('0x16d')});db['MailQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['MailInteraction'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['MailMessage'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{});db[_0x0a9e('0x17d')]['hasMany'](db[_0x0a9e('0x43')],{'as':'Items','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x45')]['hasMany'](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':'FaxAccountId','onDelete':_0x0a9e('0x10e')});db['FaxAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x17e')],{'as':'Answers','foreignKey':_0x0a9e('0x17f')});db['FaxAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x45')][_0x0a9e('0x110')](db[_0x0a9e('0x47')],{'as':_0x0a9e('0x147'),'foreignKey':'FaxAccountId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x45')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x180'),'onDelete':'cascade'});db[_0x0a9e('0x45')]['hasMany'](db['FaxMessage'],{'as':_0x0a9e('0x158')});db['FaxAccount'][_0x0a9e('0x150')](db[_0x0a9e('0x28')],{'as':'Trunk'});db[_0x0a9e('0x45')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x45')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x0a9e('0x45')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'user_has_fax_accounts'});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':'restrict'});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x4c')],{'onDelete':'restrict'});db[_0x0a9e('0x47')]['belongsTo'](db[_0x0a9e('0x45')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db['FaxInteraction'][_0x0a9e('0x110')](db[_0x0a9e('0x4a')],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x182')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17f')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':'fax_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x185'),'as':'ThroughTags'});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x12d'),'foreignKey':_0x0a9e('0x182')});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x11')});db['FaxMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x179'),'foreignKey':'FaxInteractionId'});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':'Contact'});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0xe4'),'foreignKey':_0x0a9e('0x186')});db['FaxMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'as':'Account','foreignKey':_0x0a9e('0x17f')});db[_0x0a9e('0x4c')][_0x0a9e('0x121')](db['User'],{'as':'Agents','through':_0x0a9e('0x32')});db[_0x0a9e('0x4c')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x187'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db['FaxAccount'],{});db['FaxQueueReport'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db['FaxQueueReport'][_0x0a9e('0x150')](db['FaxInteraction'],{});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db[_0x0a9e('0x4a')],{});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db['FaxQueueReport'][_0x0a9e('0x150')](db['FaxQueue'],{});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x188'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x50')]['hasMany'](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db['SmsMessage'],{'as':_0x0a9e('0x158'),'foreignKey':_0x0a9e('0x188')});db['SmsAccount']['hasMany'](db[_0x0a9e('0x53')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db[_0x0a9e('0x52')],{'as':_0x0a9e('0x147'),'foreignKey':'SmsAccountId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x50')][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x50')][_0x0a9e('0x150')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x50')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x142')});db[_0x0a9e('0x52')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x164')});db['SmsApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x57')],{'onDelete':_0x0a9e('0x164')});db['SmsApplication']['belongsTo'](db[_0x0a9e('0x50')],{'onDelete':'restrict'});db[_0x0a9e('0x52')]['belongsTo'](db['Interval'],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x52')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x53')][_0x0a9e('0x110')](db[_0x0a9e('0x55')],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x189')});db['SmsInteraction']['belongsTo'](db[_0x0a9e('0x50')],{'as':'Account','foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x53')][_0x0a9e('0x150')](db['CmContact'],{'as':'Contact','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x53')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x53')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':'sms_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x53')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x18a'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x53')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Users','through':_0x0a9e('0x12e'),'foreignKey':_0x0a9e('0x189')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x55')][_0x0a9e('0x150')](db[_0x0a9e('0x53')],{'onDelete':'cascade','as':'Interaction','foreignKey':_0x0a9e('0x189')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x50')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x57')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x34'),'foreignKey':_0x0a9e('0x18b')});db[_0x0a9e('0x57')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x18c'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x59')]['hasMany'](db['Disposition'],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x18d'),'onDelete':_0x0a9e('0x10e')});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x59')][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':_0x0a9e('0x16a'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x5e')],{'as':'Messages','foreignKey':_0x0a9e('0x18d')});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x5b')],{'as':'Applications','foreignKey':_0x0a9e('0x18d'),'onDelete':_0x0a9e('0x10e')});db['OpenchannelAccount'][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x59')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x59')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x140')});db[_0x0a9e('0x5b')]['belongsTo'](db['User'],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x5b')][_0x0a9e('0x150')](db['OpenchannelQueue'],{'onDelete':'restrict','foreignKey':_0x0a9e('0x18e')});db['OpenchannelApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x5b')][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db['OpenchannelApplication']['belongsTo'](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x5d')][_0x0a9e('0x110')](db[_0x0a9e('0x5e')],{'as':'Messages','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x18f')});db[_0x0a9e('0x5d')]['belongsTo'](db[_0x0a9e('0x59')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x18d')});db['OpenchannelInteraction'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x5d')][_0x0a9e('0x150')](db['User'],{'as':'Owner','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x0a9e('0x175')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':'user_has_openchannel_interactions','foreignKey':_0x0a9e('0x18f')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':'cascade','as':_0x0a9e('0x11')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x5e')]['belongsTo'](db[_0x0a9e('0x5d')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x179'),'foreignKey':'OpenchannelInteractionId'});db[_0x0a9e('0x5e')]['belongsTo'](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0xe4'),'foreignKey':_0x0a9e('0x186')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x137')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x35'),'foreignKey':_0x0a9e('0x18e')});db[_0x0a9e('0x137')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x190'),'as':_0x0a9e('0x155')});db['ChatWebsite'][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x17a'),'onDelete':'cascade'});db[_0x0a9e('0x60')]['hasMany'](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x17a')});db['ChatWebsite'][_0x0a9e('0x110')](db[_0x0a9e('0x191')],{'as':_0x0a9e('0x192')});db[_0x0a9e('0x60')]['hasMany'](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x60')][_0x0a9e('0x110')](db[_0x0a9e('0x63')],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x17a'),'onDelete':'cascade'});db[_0x0a9e('0x60')][_0x0a9e('0x110')](db[_0x0a9e('0x65')],{'as':_0x0a9e('0x158')});db['ChatWebsite'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x60')][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'as':_0x0a9e('0x17b'),'foreignKey':_0x0a9e('0x153')});db['ChatWebsite'][_0x0a9e('0x150')](db['MailAccount'],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db['ChatWebsite'][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':_0x0a9e('0x154')});db['ChatWebsite'][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x13b')});db['OpenchannelQueueReport']['belongsTo'](db['OpenchannelAccount'],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db['OpenchannelQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x5d')],{});db['OpenchannelQueueReport'][_0x0a9e('0x150')](db['OpenchannelMessage'],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x137')],{});db['ChatApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x193'),'foreignKey':'UserId','onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x67')],{'as':_0x0a9e('0x194'),'foreignKey':_0x0a9e('0x195'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x196'),'foreignKey':_0x0a9e('0x17a'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x64')][_0x0a9e('0x110')](db['ChatMessage'],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x197')});db[_0x0a9e('0x64')]['belongsTo'](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x64')]['belongsTo'](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x64')]['belongsTo'](db['User'],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x198'),'as':_0x0a9e('0x174')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x198'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x199'),'foreignKey':_0x0a9e('0x197')});db['ChatMessage']['belongsTo'](db[_0x0a9e('0x11')],{'onDelete':'cascade','as':_0x0a9e('0x11')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':'cascade','as':'Contact','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x64')],{'onDelete':'cascade','as':_0x0a9e('0x179'),'foreignKey':_0x0a9e('0x197')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0xe4')],{'as':'Attachment','foreignKey':'AttachmentId'});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x66')][_0x0a9e('0x110')](db['Attachment'],{'as':_0x0a9e('0x178'),'foreignKey':_0x0a9e('0x19a'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db['ChatOfflineMessage']['belongsTo'](db['CmContact'],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db[_0x0a9e('0x66')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0x0a9e('0x67')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'UserChatQueue','hooks':!![]});db[_0x0a9e('0x67')]['belongsToMany'](db['Team'],{'through':_0x0a9e('0x19b'),'as':'Teams'});db[_0x0a9e('0x68')][_0x0a9e('0x110')](db[_0x0a9e('0xcc')],{'as':'Messages','foreignKey':_0x0a9e('0x19c'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x68')]['belongsToMany'](db['User'],{'as':_0x0a9e('0x14a'),'through':_0x0a9e('0x123')});db[_0x0a9e('0x191')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x196'),'foreignKey':'ChatWebsiteId'});db['CmCompany'][_0x0a9e('0x110')](db[_0x0a9e('0x124')],{'as':'Contacts','foreignKey':'CompanyId'});db['CmContact']['hasMany'](db['CmContactHasItem'],{'as':'Phones','foreignKey':_0x0a9e('0x19d')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':'HopperFinals','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':_0x0a9e('0x19e'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x172')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'as':'JscriptySessions','foreignKey':_0x0a9e('0x172')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':'OpenchannelInteractions','foreignKey':'ContactId','onDelete':_0x0a9e('0x164')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db['CmContact'][_0x0a9e('0x110')](db['SmsInteraction'],{'as':'SmsInteractions','foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':'FaxInteractions','foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db['MailInteraction'],{'as':_0x0a9e('0x11d'),'foreignKey':_0x0a9e('0x172'),'onDelete':'restrict'});db[_0x0a9e('0x124')][_0x0a9e('0x150')](db[_0x0a9e('0x19f')],{'as':_0x0a9e('0x1a0'),'foreignKey':'CompanyId'});db[_0x0a9e('0x124')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d'),'onDelete':'cascade'});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x176'),'through':'cm_user_has_contacts'});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'as':_0x0a9e('0x174'),'through':_0x0a9e('0x1a1')});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x1a1'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x6d')][_0x0a9e('0x110')](db[_0x0a9e('0x1a2')],{'as':_0x0a9e('0x1a3'),'foreignKey':_0x0a9e('0x1a4')});db['CmHopper'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':'List','foreignKey':'ListId','onDelete':'cascade'});db['CmHopper'][_0x0a9e('0x150')](db['User'],{'as':'Agent','foreignKey':'UserId'});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x1a')],{'as':_0x0a9e('0x194'),'foreignKey':'VoiceQueueId','onDelete':'cascade'});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x1a5')],{'as':_0x0a9e('0x1a5'),'foreignKey':'CampaignId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x1a6')});db['CmHopperBlack'][_0x0a9e('0x150')](db['CmContact'],{'as':'Contact','foreignKey':_0x0a9e('0x172'),'onDelete':'cascade'});db[_0x0a9e('0x6f')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6f')][_0x0a9e('0x150')](db[_0x0a9e('0x1a')],{'as':'Queue','foreignKey':_0x0a9e('0x14b'),'onDelete':_0x0a9e('0x10e')});db['CmHopperBlack'][_0x0a9e('0x150')](db[_0x0a9e('0x1a5')],{'as':_0x0a9e('0x1a5'),'foreignKey':_0x0a9e('0x1a7'),'onDelete':'cascade'});db[_0x0a9e('0x76')][_0x0a9e('0x110')](db[_0x0a9e('0x7a')],{'as':{'plural':_0x0a9e('0x1a8'),'singular':_0x0a9e('0x1a9')},'foreignKey':'AutomationAllId','onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x76')]['hasMany'](db[_0x0a9e('0x7a')],{'as':{'plural':'Any','singular':_0x0a9e('0x1aa')},'foreignKey':'AutomationAnyId','onDelete':_0x0a9e('0x10e'),'hooks':!![]});db['Automation'][_0x0a9e('0x110')](db[_0x0a9e('0x74')],{'as':_0x0a9e('0x1ab'),'foreignKey':'AutomationId','onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x167')]['hasMany'](db[_0x0a9e('0x167')],{'as':'Dispositions','foreignKey':_0x0a9e('0x1ac'),'onDelete':'cascade'});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db['Interval'],{'as':_0x0a9e('0x1ad'),'foreignKey':_0x0a9e('0x153'),'onDelete':_0x0a9e('0x10e'),'hooks':!![],'required':![]});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x114'),'foreignKey':_0x0a9e('0x153'),'onDelete':_0x0a9e('0x164')});db['Interval'][_0x0a9e('0x110')](db[_0x0a9e('0x16b')],{'as':_0x0a9e('0x1ae'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x17b')]['hasMany'](db['ChatApplication'],{'as':_0x0a9e('0x1af'),'foreignKey':'IntervalId'});db[_0x0a9e('0x17b')]['hasMany'](db[_0x0a9e('0x47')],{'as':_0x0a9e('0x1b0'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db[_0x0a9e('0x52')],{'as':_0x0a9e('0x1b1'),'foreignKey':'IntervalId'});db['Schedule'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{});db['Schedule'][_0x0a9e('0x150')](db[_0x0a9e('0x94')],{'foreignKey':_0x0a9e('0x1b2')});db['Schedule']['belongsTo'](db['AnalyticCustomReport'],{'foreignKey':_0x0a9e('0x1b3')});db[_0x0a9e('0x84')][_0x0a9e('0x121')](db[_0x0a9e('0x18')],{'as':'Mohs','through':_0x0a9e('0x149'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x86')]['belongsToMany'](db[_0x0a9e('0x124')],{'through':'cm_contact_has_tags'});db['Tag'][_0x0a9e('0x121')](db[_0x0a9e('0x64')],{'through':'chat_interaction_has_tags'});db['Tag'][_0x0a9e('0x121')](db['MailInteraction'],{'through':_0x0a9e('0x173')});db['Tag'][_0x0a9e('0x121')](db[_0x0a9e('0x53')],{'through':_0x0a9e('0x18a')});db['Tag']['belongsToMany'](db[_0x0a9e('0x11b')],{'through':_0x0a9e('0x185')});db[_0x0a9e('0x86')][_0x0a9e('0x121')](db['OpenchannelInteraction'],{'through':_0x0a9e('0x1b4')});db[_0x0a9e('0x86')]['belongsToMany'](db[_0x0a9e('0xfb')],{'through':_0x0a9e('0x1b5')});db[_0x0a9e('0x1b6')]['belongsTo'](db[_0x0a9e('0x88')],{'as':_0x0a9e('0x1b7'),'foreignKey':_0x0a9e('0x1b8')});db[_0x0a9e('0x1a2')][_0x0a9e('0x150')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x1b9'),'foreignKey':_0x0a9e('0x1a4')});db[_0x0a9e('0x1b6')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x19d')});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db[_0x0a9e('0x7a')],{'as':{'plural':_0x0a9e('0x1ba'),'singular':_0x0a9e('0x1bb')},'foreignKey':_0x0a9e('0x1bc'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db['Condition'],{'as':{'plural':_0x0a9e('0x1bd'),'singular':_0x0a9e('0x1be')},'foreignKey':_0x0a9e('0x1bf'),'onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db[_0x0a9e('0x74')],{'as':_0x0a9e('0x1ab'),'foreignKey':'TriggerId','onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x1c0')]['hasMany'](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'CustomReportId','hooks':!![]});db['AnalyticDefaultReport'][_0x0a9e('0x110')](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':'DefaultReportId'});db[_0x0a9e('0x98')][_0x0a9e('0x110')](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c2')});db['AnalyticFieldReport']['belongsTo'](db[_0x0a9e('0x98')],{'foreignKey':_0x0a9e('0x1c2')});db[_0x0a9e('0x9c')]['hasMany'](db[_0x0a9e('0x9e')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'AccountId'});db['SalesforceConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1c4'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0x0a9e('0x9e')]['hasMany'](db['SalesforceField'],{'as':'Descriptions','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x9e')]['hasMany'](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c6')});db['SalesforceConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0x9c')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa0')][_0x0a9e('0x110')](db['SalesforceField'],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa0')]['hasMany'](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['SalesforceField'][_0x0a9e('0x110')](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xa0')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xa1')][_0x0a9e('0x110')](db[_0x0a9e('0xa2')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa2')]['hasMany'](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa2')][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db['SugarcrmConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db['SugarcrmConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0xa1')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db['SugarcrmField']['hasMany'](db['SugarcrmField'],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db['SugarcrmField'][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1cc')]['hasMany'](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db['SugarcrmField'][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1cf')]['hasMany'](db[_0x0a9e('0xa6')],{'as':'Configurations','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa6')][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa6')]['hasMany'](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1cd'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'DescriptionId'});db['DeskConfiguration']['hasMany'](db['DeskField'],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':'FieldId'});db[_0x0a9e('0xa6')][_0x0a9e('0x150')](db[_0x0a9e('0x1cf')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa6')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':'int_desk_configuration_has_tags'});db['DeskField'][_0x0a9e('0x110')](db['DeskField'],{'as':_0x0a9e('0x1c8'),'foreignKey':'SubjectId'});db[_0x0a9e('0xa8')][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['DeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':'Field','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xa8')]['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0xaa')][_0x0a9e('0x110')](db[_0x0a9e('0xac')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xac')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':'Subjects','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xac')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1cd'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c5')});db['ZohoConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xac')][_0x0a9e('0x150')](db[_0x0a9e('0xaa')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1c8'),'foreignKey':'SubjectId'});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xae')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xaf')][_0x0a9e('0x110')](db['ZendeskConfiguration'],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'AccountId'});db['ZendeskConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1c4'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d0')]['hasMany'](db[_0x0a9e('0xb2')],{'as':'Descriptions','foreignKey':'DescriptionId'});db['ZendeskConfiguration'][_0x0a9e('0x110')](db['ZendeskField'],{'as':'Fields','foreignKey':'FieldId'});db[_0x0a9e('0x1d0')][_0x0a9e('0x150')](db[_0x0a9e('0xaf')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0x1d0')]['belongsToMany'](db['Tag'],{'through':_0x0a9e('0x1d1')});db[_0x0a9e('0xb2')][_0x0a9e('0x110')](db['ZendeskField'],{'as':'Subject','foreignKey':'SubjectId'});db[_0x0a9e('0xb2')][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['ZendeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb2')][_0x0a9e('0x150')](db['Variable'],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1d2')][_0x0a9e('0x110')](db[_0x0a9e('0x1d3')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0x1d3')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d3')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1d3')]['hasMany'](db['FreshdeskField'],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db['FreshdeskConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0x1d2')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db['FreshdeskConfiguration'][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x1d4')});db[_0x0a9e('0xb5')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xb5')][_0x0a9e('0x110')](db['FreshdeskField'],{'as':'Description','foreignKey':'DescriptionId'});db['FreshdeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb5')]['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1d5')]['hasMany'](db[_0x0a9e('0xb8')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xb8')]['hasMany'](db[_0x0a9e('0xb9')],{'as':_0x0a9e('0x1c4'),'foreignKey':_0x0a9e('0x1c9')});db['VtigerConfiguration'][_0x0a9e('0x110')](db['VtigerField'],{'as':_0x0a9e('0x1cd'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xb8')][_0x0a9e('0x110')](db[_0x0a9e('0xb9')],{'as':'Fields','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb8')][_0x0a9e('0x150')](db[_0x0a9e('0x1d5')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0xb9')][_0x0a9e('0x110')](db[_0x0a9e('0xb9')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db['VtigerField']['hasMany'](db[_0x0a9e('0xb9')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xb9')][_0x0a9e('0x110')](db['VtigerField'],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb9')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0xba')]['hasMany'](db[_0x0a9e('0xbc')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xbc')]['hasMany'](db['ServicenowField'],{'as':_0x0a9e('0x1c4'),'foreignKey':'SubjectId'});db[_0x0a9e('0xbc')][_0x0a9e('0x110')](db['ServicenowField'],{'as':_0x0a9e('0x1cd'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xbc')]['hasMany'](db[_0x0a9e('0x1d6')],{'as':_0x0a9e('0x1c1'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xbc')][_0x0a9e('0x150')](db[_0x0a9e('0xba')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db['ServicenowField'][_0x0a9e('0x110')](db[_0x0a9e('0x1d6')],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d6')]['hasMany'](db[_0x0a9e('0x1d6')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1d6')][_0x0a9e('0x110')](db['ServicenowField'],{'as':_0x0a9e('0x1cb'),'foreignKey':'FieldId'});db[_0x0a9e('0x1d6')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xbe')]['hasMany'](db[_0x0a9e('0xbf')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xbe')][_0x0a9e('0x150')](db['CloudProvider'],{'as':_0x0a9e('0x103'),'foreignKey':'CloudProviderId'});db[_0x0a9e('0xbf')][_0x0a9e('0x110')](db['Dynamics365Field'],{'as':'Subjects','onDelete':'cascade','foreignKey':'SubjectId'});db[_0x0a9e('0xbf')][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db['Dynamics365Configuration'][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xbf')][_0x0a9e('0x150')](db[_0x0a9e('0xbe')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db['Dynamics365Field'][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc1')][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xc1')][_0x0a9e('0x110')](db['Dynamics365Field'],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xc1')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db['FreshsalesAccount'][_0x0a9e('0x110')](db[_0x0a9e('0xc5')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xc5')][_0x0a9e('0x110')](db['FreshsalesField'],{'as':'Subjects','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc5')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1cd'),'foreignKey':'DescriptionId'});db[_0x0a9e('0xc5')]['hasMany'](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1c1'),'foreignKey':'FieldId'});db[_0x0a9e('0xc5')]['belongsTo'](db[_0x0a9e('0xc3')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0xc7')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc7')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['FreshsalesField'][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db['FreshsalesField']['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db['ChatQueueReport']['belongsTo'](db[_0x0a9e('0x60')],{});db['ChatQueueReport']['belongsTo'](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':'ListId'});db[_0x0a9e('0xca')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x64')],{});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x65')],{});db[_0x0a9e('0xca')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x67')],{});db['ChatInternalMessage']['belongsTo'](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x10e'),'foreignKey':'FromId'});db['ChatInternalMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1d7')});db[_0x0a9e('0xd0')]['hasMany'](db[_0x0a9e('0x1d8')],{'foreignKey':'SessionId','onDelete':'cascade'});db[_0x0a9e('0xd0')]['hasMany'](db[_0x0a9e('0xcd')],{'foreignKey':'SessionId','onDelete':_0x0a9e('0x10e')});db['SmsQueueReport']['belongsTo'](db[_0x0a9e('0x50')],{});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db[_0x0a9e('0xd2')]['belongsTo'](db[_0x0a9e('0x53')],{});db[_0x0a9e('0xd2')]['belongsTo'](db['SmsMessage'],{});db['SmsQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db[_0x0a9e('0x57')],{});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'foreignKey':_0x0a9e('0x1da')});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db[_0x0a9e('0x1d8')],{'foreignKey':_0x0a9e('0x1da')});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db['JscriptyAnswerReport'],{'foreignKey':'ProjectId'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'user_has_teams'});db[_0x0a9e('0x129')]['belongsToMany'](db[_0x0a9e('0x1a')],{'through':'TeamVoiceQueue','as':_0x0a9e('0x131')});db['Team']['belongsToMany'](db[_0x0a9e('0x3c')],{'through':_0x0a9e('0x171'),'as':_0x0a9e('0x1db')});db[_0x0a9e('0x129')]['belongsToMany'](db['ChatQueue'],{'through':_0x0a9e('0x19b'),'as':'ChatQueues'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db['FaxQueue'],{'through':_0x0a9e('0x187'),'as':'FaxQueues'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x57')],{'through':_0x0a9e('0x18c'),'as':_0x0a9e('0x136')});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x137')],{'through':_0x0a9e('0x190'),'as':_0x0a9e('0x1dc')});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x101')],{'through':_0x0a9e('0x1dd'),'as':_0x0a9e('0x138')});db[_0x0a9e('0x129')]['belongsToMany'](db[_0x0a9e('0xf1')],{'through':_0x0a9e('0x107'),'as':_0x0a9e('0x132')});db['Campaign'][_0x0a9e('0x110')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')][_0x0a9e('0x110')](db['CmHopperHistory'],{'as':_0x0a9e('0x19e'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')]['hasMany'](db[_0x0a9e('0x6f')],{'as':'HopperBlacks','foreignKey':'CampaignId'});db[_0x0a9e('0x1a5')]['belongsTo'](db[_0x0a9e('0x28')],{'as':'Trunk','foreignKey':_0x0a9e('0x14f')});db[_0x0a9e('0x1a5')][_0x0a9e('0x150')](db['Trunk'],{'as':_0x0a9e('0x151'),'foreignKey':'TrunkBackupId'});db['Campaign'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'as':_0x0a9e('0x17b'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x1a5')][_0x0a9e('0x150')](db['SquareProject'],{'as':_0x0a9e('0xdc'),'foreignKey':_0x0a9e('0x1de')});db[_0x0a9e('0x1a5')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':'Lists','through':_0x0a9e('0x1df')});db[_0x0a9e('0x1a5')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x156'),'through':_0x0a9e('0x1e0')});db[_0x0a9e('0xe4')][_0x0a9e('0x150')](db[_0x0a9e('0x66')],{'as':_0x0a9e('0x66'),'foreignKey':_0x0a9e('0x19a')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db['MailMessage'],{});db['MailTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0x11c')],{});db['MailTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'foreignKey':_0x0a9e('0x1e2'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0x1e1')]['belongsTo'](db['User'],{'foreignKey':'FromUserId','as':_0x0a9e('0x1e4')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{'foreignKey':'ToMailQueueId','as':'ToQueue'});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'foreignKey':_0x0a9e('0x1e7'),'as':_0x0a9e('0x1e8')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db[_0x0a9e('0x65')],{});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db['ChatInteraction'],{});db[_0x0a9e('0xe8')]['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x0a9e('0x1e9'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0xe8')]['belongsTo'](db[_0x0a9e('0x67')],{'foreignKey':_0x0a9e('0x1eb'),'as':'ToQueue'});db['ChatTransferReport']['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x0a9e('0x1ec'),'as':_0x0a9e('0x1e8')});db['FaxTransferReport'][_0x0a9e('0x150')](db['FaxMessage'],{});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11b')],{});db['FaxTransferReport']['belongsTo'](db[_0x0a9e('0x45')],{'foreignKey':_0x0a9e('0x1ed'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0xea')]['belongsTo'](db['FaxQueue'],{'foreignKey':_0x0a9e('0x1ee'),'as':_0x0a9e('0x1ef')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'foreignKey':'ToFaxAccountId','as':_0x0a9e('0x1e8')});db[_0x0a9e('0xec')]['belongsTo'](db[_0x0a9e('0x5e')],{});db['OpenchannelTransferReport']['belongsTo'](db['OpenchannelInteraction'],{});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db['OpenchannelAccount'],{'foreignKey':'FromOpenchannelAccountId','as':_0x0a9e('0x1e3')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'FromUserId','as':_0x0a9e('0x1e4')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x137')],{'foreignKey':'ToOpenchannelQueueId','as':'ToQueue'});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'foreignKey':'ToOpenchannelAccountId','as':'ToAccount'});db['SmsTransferReport']['belongsTo'](db[_0x0a9e('0x55')],{});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db[_0x0a9e('0x53')],{});db[_0x0a9e('0xee')]['belongsTo'](db[_0x0a9e('0x50')],{'foreignKey':_0x0a9e('0x1f0'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0xee')]['belongsTo'](db['SmsQueue'],{'foreignKey':'ToSmsQueueId','as':_0x0a9e('0x1ef')});db[_0x0a9e('0xee')]['belongsTo'](db[_0x0a9e('0x50')],{'foreignKey':'ToSmsAccountId','as':'ToAccount'});db['CmList']['hasMany'](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x16d'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x1f1')],{'as':_0x0a9e('0x1f2'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db['CmContact'],{'as':_0x0a9e('0x125'),'onDelete':'cascade','foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':'HopperHistory','foreignKey':'ListId'});db['CmList'][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':'ListId'});db[_0x0a9e('0x139')][_0x0a9e('0x121')](db[_0x0a9e('0x1a')],{'as':'Queues','through':_0x0a9e('0x1f3')});db[_0x0a9e('0x139')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x128')});db[_0x0a9e('0xf1')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x114'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf1')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'UserVoicePrefix'});db[_0x0a9e('0xf1')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':'TeamVoicePrefix','as':_0x0a9e('0x155')});db[_0x0a9e('0xf2')][_0x0a9e('0x110')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'foreignKey':_0x0a9e('0x1f4')});db['UserProfile'][_0x0a9e('0x110')](db['UserProfileSection'],{'as':_0x0a9e('0x1f5'),'foreignKey':_0x0a9e('0x1f4'),'onDelete':_0x0a9e('0x10e')});db['UserProfileSection']['hasMany'](db['UserProfileResource'],{'as':_0x0a9e('0x1f6'),'foreignKey':_0x0a9e('0x1f7'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':'Dispositions','foreignKey':_0x0a9e('0x1f8'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db['CannedAnswer'],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x1f8')});db['WhatsappAccount'][_0x0a9e('0x110')](db[_0x0a9e('0xfd')],{'as':_0x0a9e('0x158'),'foreignKey':'WhatsappAccountId'});db[_0x0a9e('0xf7')]['hasMany'](db[_0x0a9e('0xfb')],{'as':'Interactions'});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db['WhatsappApplication'],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x1f8'),'onDelete':_0x0a9e('0x10e')});db['WhatsappAccount'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0xf7')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0xf7')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x144')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db[_0x0a9e('0x101')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db['WhatsappAccount'],{'onDelete':_0x0a9e('0x164')});db['WhatsappApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0xf9')]['belongsTo'](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db['WhatsappInteraction'][_0x0a9e('0x110')](db['WhatsappMessage'],{'as':'Messages','onDelete':'cascade','foreignKey':_0x0a9e('0x1f9')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1f8')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0xfb')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x1b5'),'as':_0x0a9e('0x174')});db['WhatsappInteraction'][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x1b5'),'as':_0x0a9e('0x175')});db[_0x0a9e('0xfb')]['belongsToMany'](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x130'),'foreignKey':'WhatsappInteractionId'});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11')});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':'cascade','as':_0x0a9e('0x160')});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db['WhatsappInteraction'],{'onDelete':'cascade','as':_0x0a9e('0x179'),'foreignKey':_0x0a9e('0x1f9')});db[_0x0a9e('0xfd')]['belongsTo'](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1f8')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db[_0x0a9e('0xf7')],{});db['WhatsappQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db['WhatsappInteraction'],{});db['WhatsappQueueReport']['belongsTo'](db[_0x0a9e('0x101')],{});db[_0x0a9e('0xfe')]['belongsTo'](db['WhatsappMessage'],{});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db['User'],{});db['WhatsappTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0xfd')],{});db['WhatsappTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0xfb')],{});db[_0x0a9e('0x1fa')]['belongsTo'](db['WhatsappAccount'],{'foreignKey':_0x0a9e('0x1fb'),'as':_0x0a9e('0x1e3')});db['WhatsappTransferReport']['belongsTo'](db[_0x0a9e('0xf7')],{'foreignKey':_0x0a9e('0x1fc'),'as':'ToAccount'});db[_0x0a9e('0x1fa')]['belongsTo'](db['WhatsappQueue'],{'foreignKey':_0x0a9e('0x1fd'),'as':_0x0a9e('0x1ef')});db['WhatsappTransferReport']['belongsTo'](db['User'],{'foreignKey':_0x0a9e('0x1ea'),'as':'FromAgent'});db[_0x0a9e('0x1fa')][_0x0a9e('0x150')](db['User'],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0x101')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x37'),'foreignKey':'WhatsappQueueId'});db[_0x0a9e('0x101')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x1dd'),'as':'Teams'});db[_0x0a9e('0x1fe')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x1ff'),'foreignKey':_0x0a9e('0x10f'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x103')][_0x0a9e('0x10b')](db['Dynamics365Account'],{'as':_0x0a9e('0xbe'),'onDelete':_0x0a9e('0x164')});db['CloudProvider'][_0x0a9e('0x10b')](db['MailServerIn'],{'as':'Imap','onDelete':_0x0a9e('0x164')});db['CloudProvider']['hasOne'](db['MailServerOut'],{'as':'Smtp','onDelete':_0x0a9e('0x164')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 3f14d86..aeda20f 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6c29=['./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','./api/faxQueueReport','/api/sms/accounts','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','./api/smsMessage','./api/smsQueue','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/chatWebsite','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/automations','/api/canned_answers','./api/disposition','/api/conditions','./api/condition','/api/intervals','./api/interval','./api/pause','./api/cdr','./api/voiceQueuesLog','./api/schedule','./api/sound','/api/tags','./api/tag','./api/contactItemType','/api/cm_contact_has_items','./api/cmContactHasItem','/api/cm_hopper_additional_phones','./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/analyticCustomReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','./api/analyticTreeReport','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/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/chatInternalMessage','/api/jscripty/answers/reports','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','./api/jscriptySessionReport','/api/sms/reports/queue','/api/square/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/attachments','/api/plugins','/api/mail/reports/transfer','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./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-setting','/api/auth/local','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','./api/jira','/api/rpc','./api/rpc','./api/version','./api/system','/api/pm2','/api/webbar','./api/webbar','/api/logs','static','join','root','/apidoc','/www','/demo','/snippet','snippet','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','appPath','/index.html','path','express','./errors','./utils/client-side-logger','setupLoggers','./api/client-side-logs','then','use','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','/api/voice/mails/messages','./api/voiceMailMessage','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus'];(function(_0x24d160,_0x3f0799){var _0x560dff=function(_0x460bd9){while(--_0x460bd9){_0x24d160['push'](_0x24d160['shift']());}};_0x560dff(++_0x3f0799);}(_0x6c29,0xf3));var _0x96c2=function(_0x5d07ff,_0x1f976f){_0x5d07ff=_0x5d07ff-0x0;var _0x5226ad=_0x6c29[_0x5d07ff];return _0x5226ad;};'use strict';var path=require(_0x96c2('0x0'));var express=require(_0x96c2('0x1'));var errors=require(_0x96c2('0x2'));var config=require('./config/environment');var setupLoggers=require(_0x96c2('0x3'))[_0x96c2('0x4')];var clientSideLogs=require(_0x96c2('0x5'));exports['default']=function(_0x4e75cc){return setupLoggers(_0x4e75cc)[_0x96c2('0x6')](function(){_0x4e75cc[_0x96c2('0x7')](_0x96c2('0x8'),require(_0x96c2('0x9')));_0x4e75cc['use'](_0x96c2('0xa'),require(_0x96c2('0xb')));_0x4e75cc['use'](_0x96c2('0xc'),require('./api/voiceContext'));_0x4e75cc[_0x96c2('0x7')](_0x96c2('0xd'),require(_0x96c2('0xe')));_0x4e75cc[_0x96c2('0x7')](_0x96c2('0xf'),require(_0x96c2('0x10')));_0x4e75cc[_0x96c2('0x7')](_0x96c2('0x11'),require('./api/voiceQueue'));_0x4e75cc['use'](_0x96c2('0x12'),require(_0x96c2('0x13')));_0x4e75cc[_0x96c2('0x7')](_0x96c2('0x14'),require(_0x96c2('0x15')));_0x4e75cc['use'](_0x96c2('0x16'),require('./api/voiceMail'));_0x4e75cc[_0x96c2('0x7')](_0x96c2('0x17'),require(_0x96c2('0x18')));_0x4e75cc[_0x96c2('0x7')]('/api/voice/calls/reports',require(_0x96c2('0x19')));_0x4e75cc[_0x96c2('0x7')](_0x96c2('0x1a'),require(_0x96c2('0x1b')));_0x4e75cc['use'](_0x96c2('0x1c'),require(_0x96c2('0x1d')));_0x4e75cc[_0x96c2('0x7')](_0x96c2('0x1e'),require(_0x96c2('0x1f')));_0x4e75cc[_0x96c2('0x7')](_0x96c2('0x20'),require(_0x96c2('0x21')));_0x4e75cc[_0x96c2('0x7')](_0x96c2('0x22'),require(_0x96c2('0x23')));_0x4e75cc[_0x96c2('0x7')](_0x96c2('0x24'),require('./api/voiceTransferReport'));_0x4e75cc[_0x96c2('0x7')](_0x96c2('0x25'),require(_0x96c2('0x26')));_0x4e75cc['use'](_0x96c2('0x27'),require(_0x96c2('0x28')));_0x4e75cc[_0x96c2('0x7')]('/api/mail/queues',require(_0x96c2('0x29')));_0x4e75cc[_0x96c2('0x7')](_0x96c2('0x2a'),require(_0x96c2('0x2b')));_0x4e75cc['use']('/api/mail/interactions',require(_0x96c2('0x2c')));_0x4e75cc[_0x96c2('0x7')](_0x96c2('0x2d'),require(_0x96c2('0x2e')));_0x4e75cc[_0x96c2('0x7')](_0x96c2('0x2f'),require(_0x96c2('0x30')));_0x4e75cc['use']('/api/mail/reports/queue',require('./api/mailQueueReport'));_0x4e75cc['use'](_0x96c2('0x31'),require(_0x96c2('0x32')));_0x4e75cc[_0x96c2('0x7')](_0x96c2('0x33'),require(_0x96c2('0x34')));_0x4e75cc['use'](_0x96c2('0x35'),require(_0x96c2('0x36')));_0x4e75cc[_0x96c2('0x7')](_0x96c2('0x37'),require(_0x96c2('0x38')));_0x4e75cc[_0x96c2('0x7')](_0x96c2('0x39'),require(_0x96c2('0x3a')));_0x4e75cc['use'](_0x96c2('0x3b'),require(_0x96c2('0x3c')));_0x4e75cc['use'](_0x96c2('0x3d'),require(_0x96c2('0x3e')));_0x4e75cc[_0x96c2('0x7')]('/api/fax/reports/queue',require(_0x96c2('0x3f')));_0x4e75cc[_0x96c2('0x7')](_0x96c2('0x40'),require('./api/smsAccount'));_0x4e75cc[_0x96c2('0x7')](_0x96c2('0x41'),require(_0x96c2('0x42')));_0x4e75cc[_0x96c2('0x7')](_0x96c2('0x43'),require(_0x96c2('0x44')));_0x4e75cc[_0x96c2('0x7')]('/api/sms/messages',require(_0x96c2('0x45')));_0x4e75cc[_0x96c2('0x7')]('/api/sms/queues',require(_0x96c2('0x46')));_0x4e75cc['use']('/api/openchannel/accounts',require('./api/openchannelAccount'));_0x4e75cc[_0x96c2('0x7')](_0x96c2('0x47'),require(_0x96c2('0x48')));_0x4e75cc[_0x96c2('0x7')](_0x96c2('0x49'),require(_0x96c2('0x4a')));_0x4e75cc[_0x96c2('0x7')](_0x96c2('0x4b'),require(_0x96c2('0x4c')));_0x4e75cc[_0x96c2('0x7')](_0x96c2('0x4d'),require('./api/openchannelQueue'));_0x4e75cc['use']('/api/chat/websites',require(_0x96c2('0x4e')));_0x4e75cc['use']('/api/openchannel/reports/queue',require(_0x96c2('0x4f')));_0x4e75cc[_0x96c2('0x7')](_0x96c2('0x50'),require(_0x96c2('0x51')));_0x4e75cc['use'](_0x96c2('0x52'),require(_0x96c2('0x53')));_0x4e75cc[_0x96c2('0x7')](_0x96c2('0x54'),require(_0x96c2('0x55')));_0x4e75cc[_0x96c2('0x7')](_0x96c2('0x56'),require(_0x96c2('0x57')));_0x4e75cc['use'](_0x96c2('0x58'),require(_0x96c2('0x59')));_0x4e75cc[_0x96c2('0x7')]('/api/chat/groups',require('./api/chatGroup'));_0x4e75cc[_0x96c2('0x7')](_0x96c2('0x5a'),require(_0x96c2('0x5b')));_0x4e75cc[_0x96c2('0x7')](_0x96c2('0x5c'),require(_0x96c2('0x5d')));_0x4e75cc[_0x96c2('0x7')](_0x96c2('0x5e'),require(_0x96c2('0x5f')));_0x4e75cc[_0x96c2('0x7')](_0x96c2('0x60'),require('./api/cmHopper'));_0x4e75cc['use'](_0x96c2('0x61'),require(_0x96c2('0x62')));_0x4e75cc['use'](_0x96c2('0x63'),require('./api/cmHopperFinal'));_0x4e75cc[_0x96c2('0x7')]('/api/cm/hopper_history',require(_0x96c2('0x64')));_0x4e75cc['use'](_0x96c2('0x65'),require(_0x96c2('0x66')));_0x4e75cc['use'](_0x96c2('0x67'),require(_0x96c2('0x68')));_0x4e75cc[_0x96c2('0x7')](_0x96c2('0x69'),require('./api/automation'));_0x4e75cc[_0x96c2('0x7')](_0x96c2('0x6a'),require('./api/cannedAnswer'));_0x4e75cc[_0x96c2('0x7')]('/api/dispositions',require(_0x96c2('0x6b')));_0x4e75cc['use'](_0x96c2('0x6c'),require(_0x96c2('0x6d')));_0x4e75cc[_0x96c2('0x7')](_0x96c2('0x6e'),require(_0x96c2('0x6f')));_0x4e75cc['use']('/api/pauses',require(_0x96c2('0x70')));_0x4e75cc['use']('/api/cdr',require(_0x96c2('0x71')));_0x4e75cc[_0x96c2('0x7')]('/api/voiceQueuesLog',require(_0x96c2('0x72')));_0x4e75cc[_0x96c2('0x7')]('/api/schedules',require(_0x96c2('0x73')));_0x4e75cc[_0x96c2('0x7')]('/api/sounds',require(_0x96c2('0x74')));_0x4e75cc['use'](_0x96c2('0x75'),require(_0x96c2('0x76')));_0x4e75cc[_0x96c2('0x7')]('/api/contact_item_types',require(_0x96c2('0x77')));_0x4e75cc[_0x96c2('0x7')](_0x96c2('0x78'),require(_0x96c2('0x79')));_0x4e75cc[_0x96c2('0x7')](_0x96c2('0x7a'),require(_0x96c2('0x7b')));_0x4e75cc[_0x96c2('0x7')](_0x96c2('0x7c'),require(_0x96c2('0x7d')));_0x4e75cc[_0x96c2('0x7')](_0x96c2('0x7e'),require(_0x96c2('0x7f')));_0x4e75cc['use'](_0x96c2('0x80'),require('./api/variable'));_0x4e75cc[_0x96c2('0x7')](_0x96c2('0x81'),require(_0x96c2('0x82')));_0x4e75cc[_0x96c2('0x7')](_0x96c2('0x83'),require(_0x96c2('0x84')));_0x4e75cc[_0x96c2('0x7')](_0x96c2('0x85'),require(_0x96c2('0x86')));_0x4e75cc['use']('/api/analytics/default_reports',require('./api/analyticDefaultReport'));_0x4e75cc['use'](_0x96c2('0x87'),require(_0x96c2('0x88')));_0x4e75cc[_0x96c2('0x7')](_0x96c2('0x89'),require(_0x96c2('0x8a')));_0x4e75cc['use'](_0x96c2('0x8b'),require(_0x96c2('0x8c')));_0x4e75cc['use']('/api/analytics/tree_reports',require(_0x96c2('0x8d')));_0x4e75cc[_0x96c2('0x7')]('/api/integrations/salesforce/accounts',require(_0x96c2('0x8e')));_0x4e75cc[_0x96c2('0x7')](_0x96c2('0x8f'),require(_0x96c2('0x90')));_0x4e75cc['use'](_0x96c2('0x91'),require(_0x96c2('0x92')));_0x4e75cc[_0x96c2('0x7')](_0x96c2('0x93'),require(_0x96c2('0x94')));_0x4e75cc['use']('/api/integrations/sugarcrm/configurations',require(_0x96c2('0x95')));_0x4e75cc[_0x96c2('0x7')](_0x96c2('0x96'),require('./api/intSugarcrmField'));_0x4e75cc['use'](_0x96c2('0x97'),require(_0x96c2('0x98')));_0x4e75cc[_0x96c2('0x7')](_0x96c2('0x99'),require('./api/intDeskConfiguration'));_0x4e75cc[_0x96c2('0x7')](_0x96c2('0x9a'),require(_0x96c2('0x9b')));_0x4e75cc[_0x96c2('0x7')](_0x96c2('0x9c'),require(_0x96c2('0x9d')));_0x4e75cc[_0x96c2('0x7')](_0x96c2('0x9e'),require('./api/intZohoConfiguration'));_0x4e75cc['use']('/api/integrations/zoho/fields',require(_0x96c2('0x9f')));_0x4e75cc[_0x96c2('0x7')](_0x96c2('0xa0'),require(_0x96c2('0xa1')));_0x4e75cc[_0x96c2('0x7')](_0x96c2('0xa2'),require(_0x96c2('0xa3')));_0x4e75cc['use']('/api/integrations/zendesk/fields',require(_0x96c2('0xa4')));_0x4e75cc['use'](_0x96c2('0xa5'),require(_0x96c2('0xa6')));_0x4e75cc[_0x96c2('0x7')](_0x96c2('0xa7'),require(_0x96c2('0xa8')));_0x4e75cc[_0x96c2('0x7')](_0x96c2('0xa9'),require(_0x96c2('0xaa')));_0x4e75cc[_0x96c2('0x7')](_0x96c2('0xab'),require(_0x96c2('0xac')));_0x4e75cc['use'](_0x96c2('0xad'),require(_0x96c2('0xae')));_0x4e75cc[_0x96c2('0x7')](_0x96c2('0xaf'),require('./api/intVtigerField'));_0x4e75cc[_0x96c2('0x7')](_0x96c2('0xb0'),require(_0x96c2('0xb1')));_0x4e75cc[_0x96c2('0x7')](_0x96c2('0xb2'),require('./api/intServicenowConfiguration'));_0x4e75cc[_0x96c2('0x7')](_0x96c2('0xb3'),require(_0x96c2('0xb4')));_0x4e75cc['use'](_0x96c2('0xb5'),require(_0x96c2('0xb6')));_0x4e75cc[_0x96c2('0x7')](_0x96c2('0xb7'),require(_0x96c2('0xb8')));_0x4e75cc[_0x96c2('0x7')](_0x96c2('0xb9'),require(_0x96c2('0xba')));_0x4e75cc['use'](_0x96c2('0xbb'),require('./api/intFreshsalesAccount'));_0x4e75cc[_0x96c2('0x7')](_0x96c2('0xbc'),require(_0x96c2('0xbd')));_0x4e75cc[_0x96c2('0x7')](_0x96c2('0xbe'),require('./api/intFreshsalesField'));_0x4e75cc[_0x96c2('0x7')](_0x96c2('0xbf'),require(_0x96c2('0xc0')));_0x4e75cc[_0x96c2('0x7')](_0x96c2('0xc1'),require('./api/chatQueueReport'));_0x4e75cc['use']('/api/chat/internal/messages',require(_0x96c2('0xc2')));_0x4e75cc[_0x96c2('0x7')](_0x96c2('0xc3'),require('./api/jscriptyAnswerReport'));_0x4e75cc[_0x96c2('0x7')](_0x96c2('0xc4'),require(_0x96c2('0xc5')));_0x4e75cc[_0x96c2('0x7')]('/api/jscripty/sessions/reports',require(_0x96c2('0xc6')));_0x4e75cc[_0x96c2('0x7')](_0x96c2('0xc7'),require('./api/smsQueueReport'));_0x4e75cc[_0x96c2('0x7')](_0x96c2('0xc8'),require('./api/squareReport'));_0x4e75cc[_0x96c2('0x7')]('/api/square/details/reports',require(_0x96c2('0xc9')));_0x4e75cc[_0x96c2('0x7')](_0x96c2('0xca'),require(_0x96c2('0xcb')));_0x4e75cc[_0x96c2('0x7')](_0x96c2('0xcc'),require(_0x96c2('0xcd')));_0x4e75cc[_0x96c2('0x7')](_0x96c2('0xce'),require(_0x96c2('0xcf')));_0x4e75cc[_0x96c2('0x7')](_0x96c2('0xd0'),require('./api/squareProject'));_0x4e75cc['use'](_0x96c2('0xd1'),require(_0x96c2('0xd2')));_0x4e75cc['use'](_0x96c2('0xd3'),require(_0x96c2('0xd4')));_0x4e75cc[_0x96c2('0x7')]('/api/teams',require(_0x96c2('0xd5')));_0x4e75cc[_0x96c2('0x7')](_0x96c2('0xd6'),require(_0x96c2('0xd7')));_0x4e75cc[_0x96c2('0x7')](_0x96c2('0xd8'),require(_0x96c2('0xd9')));_0x4e75cc[_0x96c2('0x7')](_0x96c2('0xda'),require(_0x96c2('0xdb')));_0x4e75cc[_0x96c2('0x7')](_0x96c2('0xdc'),require('./api/attachment'));_0x4e75cc['use'](_0x96c2('0xdd'),require('./api/plugin'));_0x4e75cc[_0x96c2('0x7')](_0x96c2('0xde'),require('./api/mailTransferReport'));_0x4e75cc[_0x96c2('0x7')](_0x96c2('0xdf'),require(_0x96c2('0xe0')));_0x4e75cc[_0x96c2('0x7')](_0x96c2('0xe1'),require(_0x96c2('0xe2')));_0x4e75cc[_0x96c2('0x7')](_0x96c2('0xe3'),require(_0x96c2('0xe4')));_0x4e75cc[_0x96c2('0x7')]('/api/sms/reports/transfer',require(_0x96c2('0xe5')));_0x4e75cc[_0x96c2('0x7')](_0x96c2('0xe6'),require(_0x96c2('0xe7')));_0x4e75cc[_0x96c2('0x7')](_0x96c2('0xe8'),require(_0x96c2('0xe9')));_0x4e75cc['use'](_0x96c2('0xea'),require(_0x96c2('0xeb')));_0x4e75cc[_0x96c2('0x7')](_0x96c2('0xec'),require(_0x96c2('0xed')));_0x4e75cc[_0x96c2('0x7')](_0x96c2('0xee'),require(_0x96c2('0xef')));_0x4e75cc[_0x96c2('0x7')](_0x96c2('0xf0'),require(_0x96c2('0xf1')));_0x4e75cc[_0x96c2('0x7')](_0x96c2('0xf2'),require(_0x96c2('0xf3')));_0x4e75cc[_0x96c2('0x7')]('/api/whatsapp/applications',require(_0x96c2('0xf4')));_0x4e75cc[_0x96c2('0x7')](_0x96c2('0xf5'),require(_0x96c2('0xf6')));_0x4e75cc[_0x96c2('0x7')](_0x96c2('0xf7'),require(_0x96c2('0xf8')));_0x4e75cc[_0x96c2('0x7')](_0x96c2('0xf9'),require(_0x96c2('0xfa')));_0x4e75cc[_0x96c2('0x7')]('/api/whatsapp/reports/transfer',require(_0x96c2('0xfb')));_0x4e75cc['use'](_0x96c2('0xfc'),require('./api/whatsappQueue'));_0x4e75cc['use'](_0x96c2('0xfd'),require('./api/cloudProvider'));_0x4e75cc[_0x96c2('0x7')]('/api/realtime',require(_0x96c2('0xfe')));_0x4e75cc[_0x96c2('0x7')]('/api/user-settings',require(_0x96c2('0xff')));_0x4e75cc[_0x96c2('0x7')](_0x96c2('0x100'),require('./api/authLocal'));_0x4e75cc[_0x96c2('0x7')]('/api/auth/google',require(_0x96c2('0x101')));_0x4e75cc[_0x96c2('0x7')](_0x96c2('0x102'),require(_0x96c2('0x103')));_0x4e75cc[_0x96c2('0x7')](_0x96c2('0x104'),require(_0x96c2('0x105')));_0x4e75cc[_0x96c2('0x7')](_0x96c2('0x106'),require(_0x96c2('0x107')));_0x4e75cc['use']('/api/version',require(_0x96c2('0x108')));_0x4e75cc[_0x96c2('0x7')]('/api/system',require(_0x96c2('0x109')));_0x4e75cc['use'](_0x96c2('0x10a'),require('./api/pm2'));_0x4e75cc[_0x96c2('0x7')](_0x96c2('0x10b'),require(_0x96c2('0x10c')));_0x4e75cc[_0x96c2('0x7')](_0x96c2('0x10d'),clientSideLogs);_0x4e75cc['use']('/apidoc',express[_0x96c2('0x10e')](path[_0x96c2('0x10f')](config[_0x96c2('0x110')],_0x96c2('0x111'))));_0x4e75cc['use']('/www',express[_0x96c2('0x10e')](path['join'](config[_0x96c2('0x110')],_0x96c2('0x112'))));_0x4e75cc[_0x96c2('0x7')](_0x96c2('0x113'),express[_0x96c2('0x10e')](path[_0x96c2('0x10f')](config[_0x96c2('0x110')],_0x96c2('0x113'))));_0x4e75cc['use'](_0x96c2('0x114'),express[_0x96c2('0x10e')](path[_0x96c2('0x10f')](config[_0x96c2('0x110')],_0x96c2('0x115'),'3.7.0')));_0x4e75cc[_0x96c2('0x7')](_0x96c2('0x116'),express['static'](path['join'](config['root'],_0x96c2('0x117'))));_0x4e75cc[_0x96c2('0x118')](_0x96c2('0x119'))[_0x96c2('0x11a')](errors[0x194]);_0x4e75cc['route']('/*')[_0x96c2('0x11a')](function(_0xd9fb61,_0x40e7e0){_0x40e7e0[_0x96c2('0x11b')](path[_0x96c2('0x11c')](_0x4e75cc['get'](_0x96c2('0x11d'))+_0x96c2('0x11e')));});return _0x4e75cc;});}; \ No newline at end of file +var _0xd032=['join','/demo','snippet','3.7.0','/plugins','/server/files/plugins','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','/index.html','path','express','./errors','./config/environment','./api/client-side-logs','default','then','use','/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/screenRecording','/api/voice/mails','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','/api/voice/agents/reports','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','/api/trunks','./api/trunk','/api/voice/transfers/reports','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','./api/dashboard','/api/dashboards/items','./api/dashboardItem','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','./api/faxQueueReport','./api/smsAccount','/api/sms/applications','./api/smsApplication','./api/smsInteraction','/api/sms/messages','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','./api/chatOfflineMessage','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','./api/condition','./api/interval','/api/pauses','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','/api/schedules','/api/tags','/api/contact_item_types','/api/cm_contact_has_items','./api/cmContactHasItem','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','/api/templates','./api/template','./api/trigger','/api/variables','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','/api/integrations/desk/configurations','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','./api/intZohoConfiguration','/api/integrations/zoho/fields','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','/api/integrations/vtiger/fields','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','/api/integrations/freshsales/fields','./api/network','/api/chat/reports/queue','/api/chat/internal/messages','./api/jscriptyQuestionReport','./api/jscriptySessionReport','./api/smsQueueReport','/api/square/reports','./api/squareReport','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','/api/square/recordings','./api/squareRecording','./api/squareMessage','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/attachments','./api/attachment','./api/plugin','/api/mail/reports/transfer','/api/chat/reports/transfer','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','/api/user-settings','./api/user-setting','./api/authLocal','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','/api/rpc','./api/rpc','/api/version','/api/system','./api/system','./api/pm2','/api/webbar','./api/webbar','/apidoc','root','/www','static'];(function(_0xce2442,_0xc56943){var _0x5d5f61=function(_0x343186){while(--_0x343186){_0xce2442['push'](_0xce2442['shift']());}};_0x5d5f61(++_0xc56943);}(_0xd032,0x113));var _0x2d03=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xd032[_0x413feb];return _0x40ee88;};'use strict';var path=require(_0x2d03('0x0'));var express=require(_0x2d03('0x1'));var errors=require(_0x2d03('0x2'));var config=require(_0x2d03('0x3'));var setupLoggers=require('./utils/client-side-logger')['setupLoggers'];var clientSideLogs=require(_0x2d03('0x4'));exports[_0x2d03('0x5')]=function(_0x1bddc2){return setupLoggers(_0x1bddc2)[_0x2d03('0x6')](function(){_0x1bddc2[_0x2d03('0x7')]('/api/users',require('./api/user'));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0x8'),require(_0x2d03('0x9')));_0x1bddc2['use']('/api/voice/contexts',require(_0x2d03('0xa')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0xb'),require(_0x2d03('0xc')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0xd'),require(_0x2d03('0xe')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0xf'),require('./api/voiceQueue'));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0x10'),require(_0x2d03('0x11')));_0x1bddc2['use'](_0x2d03('0x12'),require(_0x2d03('0x13')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0x14'),require('./api/voiceMail'));_0x1bddc2[_0x2d03('0x7')]('/api/voice/mails/messages',require(_0x2d03('0x15')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0x16'),require(_0x2d03('0x17')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0x18'),require('./api/voiceDialReport'));_0x1bddc2['use'](_0x2d03('0x19'),require('./api/voiceAgentReport'));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0x1a'),require(_0x2d03('0x1b')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0x1c'),require('./api/memberReport'));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0x1d'),require(_0x2d03('0x1e')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0x1f'),require('./api/voiceTransferReport'));_0x1bddc2[_0x2d03('0x7')]('/api/mail/out_servers',require('./api/mailServerOut'));_0x1bddc2[_0x2d03('0x7')]('/api/mail/accounts',require('./api/mailAccount'));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0x20'),require(_0x2d03('0x21')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0x22'),require(_0x2d03('0x23')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0x24'),require(_0x2d03('0x25')));_0x1bddc2[_0x2d03('0x7')]('/api/mail/messages',require('./api/mailMessage'));_0x1bddc2[_0x2d03('0x7')]('/api/mail/applications',require(_0x2d03('0x26')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0x27'),require(_0x2d03('0x28')));_0x1bddc2[_0x2d03('0x7')]('/api/dashboards',require(_0x2d03('0x29')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0x2a'),require(_0x2d03('0x2b')));_0x1bddc2[_0x2d03('0x7')]('/api/fax/accounts',require(_0x2d03('0x2c')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0x2d'),require(_0x2d03('0x2e')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0x2f'),require(_0x2d03('0x30')));_0x1bddc2['use'](_0x2d03('0x31'),require(_0x2d03('0x32')));_0x1bddc2['use'](_0x2d03('0x33'),require(_0x2d03('0x34')));_0x1bddc2[_0x2d03('0x7')]('/api/fax/reports/queue',require(_0x2d03('0x35')));_0x1bddc2[_0x2d03('0x7')]('/api/sms/accounts',require(_0x2d03('0x36')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0x37'),require(_0x2d03('0x38')));_0x1bddc2[_0x2d03('0x7')]('/api/sms/interactions',require(_0x2d03('0x39')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0x3a'),require('./api/smsMessage'));_0x1bddc2['use']('/api/sms/queues',require(_0x2d03('0x3b')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0x3c'),require(_0x2d03('0x3d')));_0x1bddc2['use']('/api/openchannel/applications',require('./api/openchannelApplication'));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0x3e'),require(_0x2d03('0x3f')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0x40'),require(_0x2d03('0x41')));_0x1bddc2['use'](_0x2d03('0x42'),require(_0x2d03('0x43')));_0x1bddc2[_0x2d03('0x7')]('/api/chat/websites',require(_0x2d03('0x44')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0x45'),require(_0x2d03('0x46')));_0x1bddc2[_0x2d03('0x7')]('/api/chat/applications',require('./api/chatApplication'));_0x1bddc2['use'](_0x2d03('0x47'),require(_0x2d03('0x48')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0x49'),require(_0x2d03('0x4a')));_0x1bddc2[_0x2d03('0x7')]('/api/chat/offline_messages',require(_0x2d03('0x4b')));_0x1bddc2[_0x2d03('0x7')]('/api/chat/queues',require(_0x2d03('0x4c')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0x4d'),require(_0x2d03('0x4e')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0x4f'),require(_0x2d03('0x50')));_0x1bddc2['use'](_0x2d03('0x51'),require(_0x2d03('0x52')));_0x1bddc2['use'](_0x2d03('0x53'),require(_0x2d03('0x54')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0x55'),require(_0x2d03('0x56')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0x57'),require(_0x2d03('0x58')));_0x1bddc2['use'](_0x2d03('0x59'),require('./api/cmHopperFinal'));_0x1bddc2[_0x2d03('0x7')]('/api/cm/hopper_history',require(_0x2d03('0x5a')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0x5b'),require(_0x2d03('0x5c')));_0x1bddc2[_0x2d03('0x7')]('/api/actions',require('./api/action'));_0x1bddc2['use']('/api/automations',require(_0x2d03('0x5d')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0x5e'),require(_0x2d03('0x5f')));_0x1bddc2['use'](_0x2d03('0x60'),require(_0x2d03('0x61')));_0x1bddc2[_0x2d03('0x7')]('/api/conditions',require(_0x2d03('0x62')));_0x1bddc2[_0x2d03('0x7')]('/api/intervals',require(_0x2d03('0x63')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0x64'),require(_0x2d03('0x65')));_0x1bddc2['use'](_0x2d03('0x66'),require(_0x2d03('0x67')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0x68'),require('./api/voiceQueuesLog'));_0x1bddc2['use'](_0x2d03('0x69'),require('./api/schedule'));_0x1bddc2['use']('/api/sounds',require('./api/sound'));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0x6a'),require('./api/tag'));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0x6b'),require('./api/contactItemType'));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0x6c'),require(_0x2d03('0x6d')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0x6e'),require(_0x2d03('0x6f')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0x70'),require(_0x2d03('0x71')));_0x1bddc2[_0x2d03('0x7')]('/api/triggers',require(_0x2d03('0x72')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0x73'),require(_0x2d03('0x74')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0x75'),require(_0x2d03('0x76')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0x77'),require(_0x2d03('0x78')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0x79'),require(_0x2d03('0x7a')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0x7b'),require(_0x2d03('0x7c')));_0x1bddc2[_0x2d03('0x7')]('/api/analytics/extracted_reports',require(_0x2d03('0x7d')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0x7e'),require(_0x2d03('0x7f')));_0x1bddc2[_0x2d03('0x7')]('/api/analytics/field_reports',require(_0x2d03('0x80')));_0x1bddc2['use'](_0x2d03('0x81'),require(_0x2d03('0x82')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0x83'),require(_0x2d03('0x84')));_0x1bddc2['use'](_0x2d03('0x85'),require(_0x2d03('0x86')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0x87'),require(_0x2d03('0x88')));_0x1bddc2['use'](_0x2d03('0x89'),require(_0x2d03('0x8a')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0x8b'),require('./api/intSugarcrmConfiguration'));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0x8c'),require(_0x2d03('0x8d')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0x8e'),require('./api/intDeskAccount'));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0x8f'),require('./api/intDeskConfiguration'));_0x1bddc2[_0x2d03('0x7')]('/api/integrations/desk/fields',require(_0x2d03('0x90')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0x91'),require(_0x2d03('0x92')));_0x1bddc2[_0x2d03('0x7')]('/api/integrations/zoho/configurations',require(_0x2d03('0x93')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0x94'),require('./api/intZohoField'));_0x1bddc2['use']('/api/integrations/zendesk/accounts',require('./api/intZendeskAccount'));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0x95'),require(_0x2d03('0x96')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0x97'),require(_0x2d03('0x98')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0x99'),require(_0x2d03('0x9a')));_0x1bddc2['use']('/api/integrations/freshdesk/configurations',require(_0x2d03('0x9b')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0x9c'),require('./api/intFreshdeskField'));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0x9d'),require(_0x2d03('0x9e')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0x9f'),require('./api/intVtigerConfiguration'));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0xa0'),require('./api/intVtigerField'));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0xa1'),require(_0x2d03('0xa2')));_0x1bddc2['use'](_0x2d03('0xa3'),require(_0x2d03('0xa4')));_0x1bddc2[_0x2d03('0x7')]('/api/integrations/servicenow/fields',require('./api/intServicenowField'));_0x1bddc2['use'](_0x2d03('0xa5'),require(_0x2d03('0xa6')));_0x1bddc2[_0x2d03('0x7')]('/api/integrations/dynamics365/configurations',require('./api/intDynamics365Configuration'));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0xa7'),require(_0x2d03('0xa8')));_0x1bddc2['use'](_0x2d03('0xa9'),require(_0x2d03('0xaa')));_0x1bddc2['use'](_0x2d03('0xab'),require('./api/intFreshsalesConfiguration'));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0xac'),require('./api/intFreshsalesField'));_0x1bddc2[_0x2d03('0x7')]('/api/networks',require(_0x2d03('0xad')));_0x1bddc2['use'](_0x2d03('0xae'),require('./api/chatQueueReport'));_0x1bddc2['use'](_0x2d03('0xaf'),require('./api/chatInternalMessage'));_0x1bddc2['use']('/api/jscripty/answers/reports',require('./api/jscriptyAnswerReport'));_0x1bddc2[_0x2d03('0x7')]('/api/jscripty/questions/reports',require(_0x2d03('0xb0')));_0x1bddc2[_0x2d03('0x7')]('/api/jscripty/sessions/reports',require(_0x2d03('0xb1')));_0x1bddc2[_0x2d03('0x7')]('/api/sms/reports/queue',require(_0x2d03('0xb2')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0xb3'),require(_0x2d03('0xb4')));_0x1bddc2[_0x2d03('0x7')]('/api/square/details/reports',require(_0x2d03('0xb5')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0xb6'),require(_0x2d03('0xb7')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0xb8'),require(_0x2d03('0xb9')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0xba'),require(_0x2d03('0xbb')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0xbc'),require('./api/squareProject'));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0xbd'),require(_0x2d03('0xbe')));_0x1bddc2[_0x2d03('0x7')]('/api/square/messages',require(_0x2d03('0xbf')));_0x1bddc2['use']('/api/teams',require(_0x2d03('0xc0')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0xc1'),require(_0x2d03('0xc2')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0xc3'),require(_0x2d03('0xc4')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0xc5'),require(_0x2d03('0xc6')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0xc7'),require(_0x2d03('0xc8')));_0x1bddc2[_0x2d03('0x7')]('/api/plugins',require(_0x2d03('0xc9')));_0x1bddc2['use'](_0x2d03('0xca'),require('./api/mailTransferReport'));_0x1bddc2['use'](_0x2d03('0xcb'),require('./api/chatTransferReport'));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0xcc'),require(_0x2d03('0xcd')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0xce'),require('./api/openchannelTransferReport'));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0xcf'),require(_0x2d03('0xd0')));_0x1bddc2['use'](_0x2d03('0xd1'),require(_0x2d03('0xd2')));_0x1bddc2[_0x2d03('0x7')]('/api/voice/prefixes',require(_0x2d03('0xd3')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0xd4'),require(_0x2d03('0xd5')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0xd6'),require(_0x2d03('0xd7')));_0x1bddc2['use'](_0x2d03('0xd8'),require(_0x2d03('0xd9')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0xda'),require(_0x2d03('0xdb')));_0x1bddc2[_0x2d03('0x7')]('/api/whatsapp/accounts',require('./api/whatsappAccount'));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0xdc'),require(_0x2d03('0xdd')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0xde'),require(_0x2d03('0xdf')));_0x1bddc2[_0x2d03('0x7')]('/api/whatsapp/messages',require(_0x2d03('0xe0')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0xe1'),require(_0x2d03('0xe2')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0xe3'),require(_0x2d03('0xe4')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0xe5'),require('./api/whatsappQueue'));_0x1bddc2['use'](_0x2d03('0xe6'),require(_0x2d03('0xe7')));_0x1bddc2['use'](_0x2d03('0xe8'),require(_0x2d03('0xe9')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0xea'),require(_0x2d03('0xeb')));_0x1bddc2['use']('/api/auth/local',require(_0x2d03('0xec')));_0x1bddc2[_0x2d03('0x7')]('/api/auth/google',require(_0x2d03('0xed')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0xee'),require(_0x2d03('0xef')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0xf0'),require('./api/jira'));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0xf1'),require(_0x2d03('0xf2')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0xf3'),require('./api/version'));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0xf4'),require(_0x2d03('0xf5')));_0x1bddc2[_0x2d03('0x7')]('/api/pm2',require(_0x2d03('0xf6')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0xf7'),require(_0x2d03('0xf8')));_0x1bddc2['use']('/api/logs',clientSideLogs);_0x1bddc2[_0x2d03('0x7')](_0x2d03('0xf9'),express['static'](path['join'](config[_0x2d03('0xfa')],_0x2d03('0xf9'))));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0xfb'),express[_0x2d03('0xfc')](path[_0x2d03('0xfd')](config[_0x2d03('0xfa')],_0x2d03('0xfb'))));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0xfe'),express[_0x2d03('0xfc')](path[_0x2d03('0xfd')](config[_0x2d03('0xfa')],_0x2d03('0xfe'))));_0x1bddc2[_0x2d03('0x7')]('/snippet',express[_0x2d03('0xfc')](path[_0x2d03('0xfd')](config[_0x2d03('0xfa')],_0x2d03('0xff'),_0x2d03('0x100'))));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0x101'),express[_0x2d03('0xfc')](path[_0x2d03('0xfd')](config[_0x2d03('0xfa')],_0x2d03('0x102'))));_0x1bddc2['route'](_0x2d03('0x103'))[_0x2d03('0x104')](errors[0x194]);_0x1bddc2['route']('/*')['get'](function(_0x27c3a8,_0x37e081){_0x37e081[_0x2d03('0x105')](path[_0x2d03('0x106')](_0x1bddc2[_0x2d03('0x104')]('appPath')+_0x2d03('0x107')));});return _0x1bddc2;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index acf6f92..d99e277 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xad1c=['../api/campaign/campaign.rpc','../api/plugin/plugin.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','localhost','error','listen','log','default','lodash','merge','../api/user/user.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc'];(function(_0x1ce1f8,_0x18190a){var _0x1db20b=function(_0x28e873){while(--_0x28e873){_0x1ce1f8['push'](_0x1ce1f8['shift']());}};_0x1db20b(++_0x18190a);}(_0xad1c,0x1c8));var _0xcad1=function(_0x4bb66f,_0x3cd682){_0x4bb66f=_0x4bb66f-0x0;var _0xf2772f=_0xad1c[_0x4bb66f];return _0xf2772f;};'use strict';var jayson=require('jayson/promise');var _=require(_0xcad1('0x0'));var config=require('../config/environment');exports['listen']=function(){return new Promise(function(_0x3273cb,_0x1db454){var _0x28e8e8={};_0x28e8e8=_[_0xcad1('0x1')](_0x28e8e8,require(_0xcad1('0x2')));_0x28e8e8=_[_0xcad1('0x1')](_0x28e8e8,require('../api/voiceExtension/voiceExtension.rpc'));_0x28e8e8=_[_0xcad1('0x1')](_0x28e8e8,require('../api/voiceQueue/voiceQueue.rpc'));_0x28e8e8=_['merge'](_0x28e8e8,require('../api/voiceRecording/voiceRecording.rpc'));_0x28e8e8=_[_0xcad1('0x1')](_0x28e8e8,require('../api/voiceCallReport/voiceCallReport.rpc'));_0x28e8e8=_[_0xcad1('0x1')](_0x28e8e8,require(_0xcad1('0x3')));_0x28e8e8=_['merge'](_0x28e8e8,require(_0xcad1('0x4')));_0x28e8e8=_['merge'](_0x28e8e8,require(_0xcad1('0x5')));_0x28e8e8=_[_0xcad1('0x1')](_0x28e8e8,require(_0xcad1('0x6')));_0x28e8e8=_[_0xcad1('0x1')](_0x28e8e8,require(_0xcad1('0x7')));_0x28e8e8=_[_0xcad1('0x1')](_0x28e8e8,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x28e8e8=_[_0xcad1('0x1')](_0x28e8e8,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x28e8e8=_['merge'](_0x28e8e8,require('../api/mailServerIn/mailServerIn.rpc'));_0x28e8e8=_[_0xcad1('0x1')](_0x28e8e8,require('../api/mailAccount/mailAccount.rpc'));_0x28e8e8=_[_0xcad1('0x1')](_0x28e8e8,require('../api/mailQueue/mailQueue.rpc'));_0x28e8e8=_[_0xcad1('0x1')](_0x28e8e8,require(_0xcad1('0x8')));_0x28e8e8=_[_0xcad1('0x1')](_0x28e8e8,require('../api/mailMessage/mailMessage.rpc'));_0x28e8e8=_[_0xcad1('0x1')](_0x28e8e8,require('../api/mailApplication/mailApplication.rpc'));_0x28e8e8=_['merge'](_0x28e8e8,require(_0xcad1('0x9')));_0x28e8e8=_[_0xcad1('0x1')](_0x28e8e8,require(_0xcad1('0xa')));_0x28e8e8=_[_0xcad1('0x1')](_0x28e8e8,require('../api/faxApplication/faxApplication.rpc'));_0x28e8e8=_[_0xcad1('0x1')](_0x28e8e8,require(_0xcad1('0xb')));_0x28e8e8=_[_0xcad1('0x1')](_0x28e8e8,require(_0xcad1('0xc')));_0x28e8e8=_[_0xcad1('0x1')](_0x28e8e8,require(_0xcad1('0xd')));_0x28e8e8=_[_0xcad1('0x1')](_0x28e8e8,require('../api/faxQueueReport/faxQueueReport.rpc'));_0x28e8e8=_[_0xcad1('0x1')](_0x28e8e8,require(_0xcad1('0xe')));_0x28e8e8=_[_0xcad1('0x1')](_0x28e8e8,require(_0xcad1('0xf')));_0x28e8e8=_[_0xcad1('0x1')](_0x28e8e8,require(_0xcad1('0x10')));_0x28e8e8=_[_0xcad1('0x1')](_0x28e8e8,require(_0xcad1('0x11')));_0x28e8e8=_[_0xcad1('0x1')](_0x28e8e8,require(_0xcad1('0x12')));_0x28e8e8=_['merge'](_0x28e8e8,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0x28e8e8=_[_0xcad1('0x1')](_0x28e8e8,require(_0xcad1('0x13')));_0x28e8e8=_['merge'](_0x28e8e8,require(_0xcad1('0x14')));_0x28e8e8=_[_0xcad1('0x1')](_0x28e8e8,require(_0xcad1('0x15')));_0x28e8e8=_[_0xcad1('0x1')](_0x28e8e8,require(_0xcad1('0x16')));_0x28e8e8=_[_0xcad1('0x1')](_0x28e8e8,require('../api/chatMessage/chatMessage.rpc'));_0x28e8e8=_[_0xcad1('0x1')](_0x28e8e8,require(_0xcad1('0x17')));_0x28e8e8=_[_0xcad1('0x1')](_0x28e8e8,require(_0xcad1('0x18')));_0x28e8e8=_[_0xcad1('0x1')](_0x28e8e8,require(_0xcad1('0x19')));_0x28e8e8=_[_0xcad1('0x1')](_0x28e8e8,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0x28e8e8=_[_0xcad1('0x1')](_0x28e8e8,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x28e8e8=_[_0xcad1('0x1')](_0x28e8e8,require('../api/cmHopperHistory/cmHopperHistory.rpc'));_0x28e8e8=_[_0xcad1('0x1')](_0x28e8e8,require(_0xcad1('0x1a')));_0x28e8e8=_['merge'](_0x28e8e8,require(_0xcad1('0x1b')));_0x28e8e8=_[_0xcad1('0x1')](_0x28e8e8,require(_0xcad1('0x1c')));_0x28e8e8=_[_0xcad1('0x1')](_0x28e8e8,require(_0xcad1('0x1d')));_0x28e8e8=_[_0xcad1('0x1')](_0x28e8e8,require(_0xcad1('0x1e')));_0x28e8e8=_[_0xcad1('0x1')](_0x28e8e8,require(_0xcad1('0x1f')));_0x28e8e8=_['merge'](_0x28e8e8,require('../api/trigger/trigger.rpc'));_0x28e8e8=_[_0xcad1('0x1')](_0x28e8e8,require(_0xcad1('0x20')));_0x28e8e8=_['merge'](_0x28e8e8,require(_0xcad1('0x21')));_0x28e8e8=_[_0xcad1('0x1')](_0x28e8e8,require(_0xcad1('0x22')));_0x28e8e8=_[_0xcad1('0x1')](_0x28e8e8,require('../api/intDeskAccount/intDeskAccount.rpc'));_0x28e8e8=_['merge'](_0x28e8e8,require(_0xcad1('0x23')));_0x28e8e8=_[_0xcad1('0x1')](_0x28e8e8,require('../api/intZendeskAccount/intZendeskAccount.rpc'));_0x28e8e8=_[_0xcad1('0x1')](_0x28e8e8,require(_0xcad1('0x24')));_0x28e8e8=_['merge'](_0x28e8e8,require(_0xcad1('0x25')));_0x28e8e8=_[_0xcad1('0x1')](_0x28e8e8,require(_0xcad1('0x26')));_0x28e8e8=_[_0xcad1('0x1')](_0x28e8e8,require(_0xcad1('0x27')));_0x28e8e8=_[_0xcad1('0x1')](_0x28e8e8,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x28e8e8=_[_0xcad1('0x1')](_0x28e8e8,require(_0xcad1('0x28')));_0x28e8e8=_[_0xcad1('0x1')](_0x28e8e8,require(_0xcad1('0x29')));_0x28e8e8=_[_0xcad1('0x1')](_0x28e8e8,require('../api/squareReport/squareReport.rpc'));_0x28e8e8=_[_0xcad1('0x1')](_0x28e8e8,require(_0xcad1('0x2a')));_0x28e8e8=_[_0xcad1('0x1')](_0x28e8e8,require(_0xcad1('0x2b')));_0x28e8e8=_['merge'](_0x28e8e8,require(_0xcad1('0x2c')));_0x28e8e8=_[_0xcad1('0x1')](_0x28e8e8,require(_0xcad1('0x2d')));_0x28e8e8=_[_0xcad1('0x1')](_0x28e8e8,require(_0xcad1('0x2e')));_0x28e8e8=_[_0xcad1('0x1')](_0x28e8e8,require(_0xcad1('0x2f')));_0x28e8e8=_[_0xcad1('0x1')](_0x28e8e8,require(_0xcad1('0x30')));_0x28e8e8=_[_0xcad1('0x1')](_0x28e8e8,require('../api/attachment/attachment.rpc'));_0x28e8e8=_['merge'](_0x28e8e8,require(_0xcad1('0x31')));_0x28e8e8=_['merge'](_0x28e8e8,require('../api/whatsappAccount/whatsappAccount.rpc'));_0x28e8e8=_[_0xcad1('0x1')](_0x28e8e8,require(_0xcad1('0x32')));_0x28e8e8=_[_0xcad1('0x1')](_0x28e8e8,require(_0xcad1('0x33')));_0x28e8e8=_[_0xcad1('0x1')](_0x28e8e8,require(_0xcad1('0x34')));_0x28e8e8=_[_0xcad1('0x1')](_0x28e8e8,require(_0xcad1('0x35')));var _0x460e83=jayson[_0xcad1('0x36')](_0x28e8e8)[_0xcad1('0x37')]();var _0x176314=config[_0xcad1('0x38')][_0xcad1('0x39')]||config[_0xcad1('0x39')]+0x1;var _0x32631e=config['rpc']['ip']||_0xcad1('0x3a');_0x460e83['on'](_0xcad1('0x3b'),function(_0x478ced){return _0x1db454(_0x478ced);});_0x460e83[_0xcad1('0x3c')](_0x176314,_0x32631e,function(){console[_0xcad1('0x3d')]('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0x32631e,_0x176314);require('../config/triggers')[_0xcad1('0x3e')]();return _0x3273cb('RPC\x20listening\x20on\x20'+_0x32631e+':'+_0x176314);});});}; \ No newline at end of file +var _0x346e=['../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxApplication/faxApplication.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsMessage/smsMessage.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmHopper/cmHopper.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/intDeskAccount/intDeskAccount.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/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareMessage/squareMessage.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','http','rpc','port','localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','lodash','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc'];(function(_0x3cea78,_0x4a6751){var _0x33b66b=function(_0x1f45cd){while(--_0x1f45cd){_0x3cea78['push'](_0x3cea78['shift']());}};_0x33b66b(++_0x4a6751);}(_0x346e,0x18f));var _0xe346=function(_0x2f482c,_0x243739){_0x2f482c=_0x2f482c-0x0;var _0x1ee791=_0x346e[_0x2f482c];return _0x1ee791;};'use strict';var jayson=require('jayson/promise');var _=require(_0xe346('0x0'));var config=require('../config/environment');exports[_0xe346('0x1')]=function(){return new Promise(function(_0x34468c,_0x29b43f){var _0x2208d7={};_0x2208d7=_[_0xe346('0x2')](_0x2208d7,require(_0xe346('0x3')));_0x2208d7=_[_0xe346('0x2')](_0x2208d7,require(_0xe346('0x4')));_0x2208d7=_['merge'](_0x2208d7,require(_0xe346('0x5')));_0x2208d7=_[_0xe346('0x2')](_0x2208d7,require('../api/voiceRecording/voiceRecording.rpc'));_0x2208d7=_[_0xe346('0x2')](_0x2208d7,require(_0xe346('0x6')));_0x2208d7=_[_0xe346('0x2')](_0x2208d7,require(_0xe346('0x7')));_0x2208d7=_[_0xe346('0x2')](_0x2208d7,require(_0xe346('0x8')));_0x2208d7=_[_0xe346('0x2')](_0x2208d7,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0x2208d7=_[_0xe346('0x2')](_0x2208d7,require(_0xe346('0x9')));_0x2208d7=_[_0xe346('0x2')](_0x2208d7,require(_0xe346('0xa')));_0x2208d7=_[_0xe346('0x2')](_0x2208d7,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x2208d7=_[_0xe346('0x2')](_0x2208d7,require(_0xe346('0xb')));_0x2208d7=_[_0xe346('0x2')](_0x2208d7,require(_0xe346('0xc')));_0x2208d7=_[_0xe346('0x2')](_0x2208d7,require('../api/mailAccount/mailAccount.rpc'));_0x2208d7=_['merge'](_0x2208d7,require('../api/mailQueue/mailQueue.rpc'));_0x2208d7=_[_0xe346('0x2')](_0x2208d7,require(_0xe346('0xd')));_0x2208d7=_[_0xe346('0x2')](_0x2208d7,require(_0xe346('0xe')));_0x2208d7=_[_0xe346('0x2')](_0x2208d7,require('../api/mailApplication/mailApplication.rpc'));_0x2208d7=_[_0xe346('0x2')](_0x2208d7,require(_0xe346('0xf')));_0x2208d7=_[_0xe346('0x2')](_0x2208d7,require('../api/faxAccount/faxAccount.rpc'));_0x2208d7=_[_0xe346('0x2')](_0x2208d7,require(_0xe346('0x10')));_0x2208d7=_['merge'](_0x2208d7,require('../api/faxInteraction/faxInteraction.rpc'));_0x2208d7=_[_0xe346('0x2')](_0x2208d7,require('../api/faxMessage/faxMessage.rpc'));_0x2208d7=_['merge'](_0x2208d7,require(_0xe346('0x11')));_0x2208d7=_['merge'](_0x2208d7,require(_0xe346('0x12')));_0x2208d7=_[_0xe346('0x2')](_0x2208d7,require('../api/smsAccount/smsAccount.rpc'));_0x2208d7=_[_0xe346('0x2')](_0x2208d7,require('../api/smsInteraction/smsInteraction.rpc'));_0x2208d7=_[_0xe346('0x2')](_0x2208d7,require(_0xe346('0x13')));_0x2208d7=_[_0xe346('0x2')](_0x2208d7,require('../api/smsQueue/smsQueue.rpc'));_0x2208d7=_[_0xe346('0x2')](_0x2208d7,require(_0xe346('0x14')));_0x2208d7=_[_0xe346('0x2')](_0x2208d7,require(_0xe346('0x15')));_0x2208d7=_[_0xe346('0x2')](_0x2208d7,require(_0xe346('0x16')));_0x2208d7=_['merge'](_0x2208d7,require('../api/openchannelQueue/openchannelQueue.rpc'));_0x2208d7=_[_0xe346('0x2')](_0x2208d7,require(_0xe346('0x17')));_0x2208d7=_[_0xe346('0x2')](_0x2208d7,require('../api/chatInteraction/chatInteraction.rpc'));_0x2208d7=_[_0xe346('0x2')](_0x2208d7,require(_0xe346('0x18')));_0x2208d7=_['merge'](_0x2208d7,require(_0xe346('0x19')));_0x2208d7=_[_0xe346('0x2')](_0x2208d7,require('../api/cmContact/cmContact.rpc'));_0x2208d7=_['merge'](_0x2208d7,require(_0xe346('0x1a')));_0x2208d7=_[_0xe346('0x2')](_0x2208d7,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0x2208d7=_[_0xe346('0x2')](_0x2208d7,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x2208d7=_['merge'](_0x2208d7,require(_0xe346('0x1b')));_0x2208d7=_[_0xe346('0x2')](_0x2208d7,require(_0xe346('0x1c')));_0x2208d7=_[_0xe346('0x2')](_0x2208d7,require(_0xe346('0x1d')));_0x2208d7=_['merge'](_0x2208d7,require(_0xe346('0x1e')));_0x2208d7=_['merge'](_0x2208d7,require(_0xe346('0x1f')));_0x2208d7=_[_0xe346('0x2')](_0x2208d7,require(_0xe346('0x20')));_0x2208d7=_[_0xe346('0x2')](_0x2208d7,require(_0xe346('0x21')));_0x2208d7=_[_0xe346('0x2')](_0x2208d7,require(_0xe346('0x22')));_0x2208d7=_[_0xe346('0x2')](_0x2208d7,require(_0xe346('0x23')));_0x2208d7=_[_0xe346('0x2')](_0x2208d7,require(_0xe346('0x24')));_0x2208d7=_['merge'](_0x2208d7,require(_0xe346('0x25')));_0x2208d7=_[_0xe346('0x2')](_0x2208d7,require(_0xe346('0x26')));_0x2208d7=_['merge'](_0x2208d7,require(_0xe346('0x27')));_0x2208d7=_[_0xe346('0x2')](_0x2208d7,require(_0xe346('0x28')));_0x2208d7=_[_0xe346('0x2')](_0x2208d7,require(_0xe346('0x29')));_0x2208d7=_[_0xe346('0x2')](_0x2208d7,require(_0xe346('0x2a')));_0x2208d7=_[_0xe346('0x2')](_0x2208d7,require(_0xe346('0x2b')));_0x2208d7=_[_0xe346('0x2')](_0x2208d7,require(_0xe346('0x2c')));_0x2208d7=_[_0xe346('0x2')](_0x2208d7,require(_0xe346('0x2d')));_0x2208d7=_[_0xe346('0x2')](_0x2208d7,require(_0xe346('0x2e')));_0x2208d7=_[_0xe346('0x2')](_0x2208d7,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x2208d7=_[_0xe346('0x2')](_0x2208d7,require('../api/squareReport/squareReport.rpc'));_0x2208d7=_['merge'](_0x2208d7,require(_0xe346('0x2f')));_0x2208d7=_[_0xe346('0x2')](_0x2208d7,require(_0xe346('0x30')));_0x2208d7=_[_0xe346('0x2')](_0x2208d7,require(_0xe346('0x31')));_0x2208d7=_['merge'](_0x2208d7,require(_0xe346('0x32')));_0x2208d7=_[_0xe346('0x2')](_0x2208d7,require('../api/squareRecording/squareRecording.rpc'));_0x2208d7=_[_0xe346('0x2')](_0x2208d7,require(_0xe346('0x33')));_0x2208d7=_['merge'](_0x2208d7,require('../api/campaign/campaign.rpc'));_0x2208d7=_[_0xe346('0x2')](_0x2208d7,require(_0xe346('0x34')));_0x2208d7=_[_0xe346('0x2')](_0x2208d7,require(_0xe346('0x35')));_0x2208d7=_['merge'](_0x2208d7,require(_0xe346('0x36')));_0x2208d7=_[_0xe346('0x2')](_0x2208d7,require(_0xe346('0x37')));_0x2208d7=_[_0xe346('0x2')](_0x2208d7,require(_0xe346('0x38')));_0x2208d7=_[_0xe346('0x2')](_0x2208d7,require(_0xe346('0x39')));_0x2208d7=_[_0xe346('0x2')](_0x2208d7,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0x1b0e02=jayson['server'](_0x2208d7)[_0xe346('0x3a')]();var _0x499f1d=config[_0xe346('0x3b')]['port']||config[_0xe346('0x3c')]+0x1;var _0x215686=config['rpc']['ip']||_0xe346('0x3d');_0x1b0e02['on'](_0xe346('0x3e'),function(_0x128034){return _0x29b43f(_0x128034);});_0x1b0e02[_0xe346('0x1')](_0x499f1d,_0x215686,function(){console[_0xe346('0x3f')](_0xe346('0x40'),_0x215686,_0x499f1d);require(_0xe346('0x41'))[_0xe346('0x42')]();return _0x34468c(_0xe346('0x43')+_0x215686+':'+_0x499f1d);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 3bf5057..8fd1845 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 _0x60ad=['close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','command','write','inherits','prototype','sendRequest','sync','answer','ANSWER','getData','beep','format','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','setVariable','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','sayDigits','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','util','lodash','events','EventEmitter','./reply','./error','setEncoding','utf8','setTimeout','headers','emit','line','hangup','substring','function','replace','indexOf','substr','startsWith','length','error','code'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x60ad,0x112));var _0xd60a=function(_0x48a928,_0x3705be){_0x48a928=_0x48a928-0x0;var _0x281509=_0x60ad[_0x48a928];return _0x281509;};'use strict';var util=require(_0xd60a('0x0'));var _=require(_0xd60a('0x1'));var EventEmitter=require(_0xd60a('0x2'))[_0xd60a('0x3')];var AGIReply=require(_0xd60a('0x4'));var AGIError=require(_0xd60a('0x5'));function AGIChannel(_0x322983){var _0x16962a=this,_0x4506d8=new AGIReply(),_0x5cd3ca=![],_0x4d4c73={};EventEmitter['call'](_0x16962a);_0x322983[_0xd60a('0x6')](_0xd60a('0x7'));_0x322983[_0xd60a('0x8')](0x8*0x3c*0x3c*0x3e8);_0x4506d8[_0xd60a('0x6')](_0xd60a('0x7'));_0x4506d8['on'](_0xd60a('0x9'),function(_0x37d3ed){for(var _0x1d8fd8 in _0x37d3ed){_0x16962a[_0x1d8fd8]=_0x37d3ed[_0x1d8fd8];}_0x16962a[_0xd60a('0xa')]('ready');});_0x4506d8['on'](_0xd60a('0xb'),function(_0x27d339){if(_0x27d339['toLowerCase']()==_0xd60a('0xc')){_0x16962a[_0xd60a('0xa')](_0xd60a('0xc'));return;}if(_0x27d339[_0xd60a('0xd')](0x0,0xb)=='520-Invalid'){_0x5cd3ca=!![];}if(_0x5cd3ca){_0x4d4c73['rx']+=_0x27d339+'\x0a';if(_0x27d339['search']('520\x20End\x20of\x20proper')!=-0x1){_0x5cd3ca=![];}}else{_0x4d4c73['rx']=_0x27d339;}if(_0x5cd3ca){return;}if(typeof _0x4d4c73['cb']==_0xd60a('0xe')){var _0x164449=_0x4d4c73['rx']['substring'](0x0,0x3),_0x5f34d4=null,_0x2d762e=null;_0x164449=parseInt(_0x164449);if(isNaN(_0x164449)){_0x4d4c73['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0x164449!=0xc8){_0x4d4c73['cb'](null,{'code':_0x164449,'result':-0x1,'extra':'KO'});return;}_0x5f34d4=_0x4d4c73['rx'][_0xd60a('0xd')](0x4)[_0xd60a('0xf')]('result=','');if(_0x5f34d4[_0xd60a('0x10')]('\x20')!=-0x1){_0x5f34d4=_0x5f34d4[_0xd60a('0x11')](0x0,_0x5f34d4['indexOf']('\x20'));}if(_[_0xd60a('0x12')](_0x5f34d4,'-1')){_0x5f34d4=parseInt(_0x5f34d4);}_0x2d762e=_0x4d4c73['rx']['split']('\x20');if(_0x2d762e[_0xd60a('0x13')]==0x3){_0x2d762e=_0x2d762e[0x2][_0xd60a('0xd')](0x1,_0x2d762e[0x2]['length']-0x1);}else if(_0x2d762e[_0xd60a('0x13')]>0x3){var _0x10374d=/\((.+)\)/;var _0x3b63fa=_0x4d4c73['rx']['match'](_0x10374d);if(_0x3b63fa){_0x2d762e=_0x3b63fa[0x1];}else{_0x2d762e=null;}}else{_0x2d762e=null;}_0x4d4c73['cb'](null,{'code':_0x164449,'result':_0x5f34d4,'extra':_0x2d762e});}});_0x322983['on']('error',function(_0x1ec166){_0x16962a[_0xd60a('0xa')](_0xd60a('0x14'),new AGIError('E_AGI_SOCKET_ERROR',_0x1ec166[_0xd60a('0x15')]));});_0x322983['on'](_0xd60a('0x16'),function(){_0x16962a[_0xd60a('0xa')](_0xd60a('0x16'),new AGIError(_0xd60a('0x17')));});_0x322983['on'](_0xd60a('0x18'),function(){_0x16962a['emit'](_0xd60a('0x18'),new AGIError(_0xd60a('0x19')));_0x322983[_0xd60a('0x1a')]();});_0x322983['pipe'](_0x4506d8);this[_0xd60a('0x1b')]=function(_0x265587,_0x4302b8){var _0x265587=_0x265587||'',_0x4302b8=typeof _0x4302b8=='function'?_0x4302b8:new Function();_0x4d4c73={'tx':_0x265587,'rx':'','cb':_0x4302b8};_0x322983[_0xd60a('0x1c')](_0x265587+'\x0a');},this['close']=function(){_0x322983[_0xd60a('0x1a')]();};}util[_0xd60a('0x1d')](AGIChannel,EventEmitter);AGIChannel[_0xd60a('0x1e')][_0xd60a('0x1f')]=function(_0x53520a){return this[_0xd60a('0x1b')][_0xd60a('0x20')](this,_0x53520a);};AGIChannel[_0xd60a('0x1e')][_0xd60a('0x21')]=function(){return this[_0xd60a('0x1f')](_0xd60a('0x22'));};AGIChannel[_0xd60a('0x1e')][_0xd60a('0x23')]=function(_0x5f095b,_0x4ec26a,_0x251e36){_0x5f095b=_0x5f095b===undefined?_0xd60a('0x24'):_0x5f095b;_0x4ec26a=_0x4ec26a===undefined?'5':_0x4ec26a;_0x251e36=_0x251e36===undefined?'1':_0x251e36;return this[_0xd60a('0x1f')](util[_0xd60a('0x25')]('GET\x20DATA\x20\x22%s\x22\x20%s\x20%s',_0x5f095b,_0x4ec26a*0x3e8,_0x251e36));};AGIChannel[_0xd60a('0x1e')][_0xd60a('0x26')]=function(_0x2b08c0){_0x2b08c0=_0x2b08c0||_0xd60a('0x27');return this['sendRequest'](util[_0xd60a('0x25')](_0xd60a('0x28'),_0x2b08c0));};AGIChannel[_0xd60a('0x1e')][_0xd60a('0x29')]=function(_0x291e66,_0x1ee2a7){if(_[_0xd60a('0x2a')](_0x1ee2a7)){return this[_0xd60a('0x1f')](util[_0xd60a('0x25')](_0xd60a('0x2b'),_0x291e66,_0x1ee2a7['join'](',')));}return this[_0xd60a('0x1f')](util[_0xd60a('0x25')]('EXEC\x20%s\x20%s',_0x291e66,_0x1ee2a7));};AGIChannel[_0xd60a('0x1e')][_0xd60a('0x2c')]=function(_0x156d94){return this[_0xd60a('0x1f')](util[_0xd60a('0x25')](_0xd60a('0x2d'),_0x156d94));};AGIChannel[_0xd60a('0x1e')][_0xd60a('0x2e')]=function(_0x26b5f6){return this['sendRequest'](util[_0xd60a('0x25')](_0xd60a('0x2f'),_0x26b5f6));};AGIChannel[_0xd60a('0x1e')][_0xd60a('0x30')]=function(_0x72a3c1){return this[_0xd60a('0x1f')](util[_0xd60a('0x25')](_0xd60a('0x31'),_0x72a3c1));};AGIChannel[_0xd60a('0x1e')][_0xd60a('0xc')]=function(){return this[_0xd60a('0x1f')]('HANGUP');};AGIChannel['prototype'][_0xd60a('0x32')]=function(_0xbc88d8,_0x1c87f0){var _0x186492=_[_0xd60a('0x33')](_0x1c87f0)||_[_0xd60a('0x34')](_0x1c87f0)?_0x1c87f0[_0xd60a('0x35')]():_0x1c87f0;return this['sendRequest'](util[_0xd60a('0x25')](_0xd60a('0x36'),_0xbc88d8,_0x186492?_0x186492['toString']()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0xd60a('0x1e')][_0xd60a('0x37')]=function(_0x452a42,_0x5bffa1){return this['sendRequest'](util['format']('SAY\x20NUMBER\x20%s\x20%s',_0x452a42,_0x5bffa1));};AGIChannel[_0xd60a('0x1e')][_0xd60a('0x38')]=function(_0x90b0ca,_0x13dd0f){return this[_0xd60a('0x1f')](util['format']('SAY\x20DIGITS\x20%s\x20%s',_0x90b0ca,_0x13dd0f));};AGIChannel[_0xd60a('0x1e')][_0xd60a('0x39')]=function(_0x232308,_0x5af8a6){return this[_0xd60a('0x1f')](util['format'](_0xd60a('0x3a'),_0x232308,_0x5af8a6));};AGIChannel[_0xd60a('0x1e')][_0xd60a('0x3b')]=function(_0x49e73c,_0x27d7c8,_0x41fc13){_0x27d7c8=_0x27d7c8||this[_0xd60a('0x3c')];_0x41fc13=_0x41fc13||0x1;this[_0xd60a('0x2c')](_0x49e73c);this[_0xd60a('0x2e')](_0x27d7c8);this[_0xd60a('0x30')](_0x41fc13);return this[_0xd60a('0x26')](util['format']('GOTO\x20%s\x20%s\x20%s',_0x49e73c,_0x27d7c8,_0x41fc13));};AGIChannel['prototype']['getVariable']=function(_0x801f97){return this[_0xd60a('0x1f')](util[_0xd60a('0x25')](_0xd60a('0x3d'),_0x801f97));};AGIChannel['prototype'][_0xd60a('0x3e')]=function(_0x25c754,_0x94a2f0,_0x4fad76,_0xb9ade4,_0x4797c3,_0x314f2b){_0x94a2f0=_0x94a2f0||_0xd60a('0x3f');_0x4fad76=_0x4fad76||'';_0xb9ade4=_0xb9ade4===undefined?-0x1:_0xb9ade4==='-1'?-0x1:_0xb9ade4*0x3e8;_0x4797c3=_0x4797c3===undefined?'':'s='+_0x4797c3;_0x314f2b=_0x314f2b?_0xd60a('0x40'):'';return this[_0xd60a('0x1f')](util['format'](_0xd60a('0x41'),_0x25c754,_0x94a2f0,_0x4fad76,_0xb9ade4,_0x314f2b,_0x4797c3));};AGIChannel[_0xd60a('0x1e')][_0xd60a('0x42')]=function(_0xf229b,_0x2c624b){_0x2c624b=_0x2c624b||'';return this['sendRequest'](util[_0xd60a('0x25')](_0xd60a('0x43'),_0xf229b,_0x2c624b));};AGIChannel[_0xd60a('0x1e')][_0xd60a('0x44')]=function(_0x57058a){return this[_0xd60a('0x29')](_0xd60a('0x45'),_0x57058a);};AGIChannel['prototype'][_0xd60a('0x46')]=function(_0x443539){return this[_0xd60a('0x29')](_0xd60a('0x47'),_0x443539);};AGIChannel['prototype'][_0xd60a('0x14')]=function(_0x530b55,_0x480cc0){this[_0xd60a('0x26')](util['format'](_0xd60a('0x48'),_0x530b55['id'],_0x530b55[_0xd60a('0x49')],_0x480cc0));return{'code':0x1f4,'result':'-1','extra':''};};module['exports']=AGIChannel; \ No newline at end of file +var _0x5502=['HANGUP','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','setContext','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','lodash','events','EventEmitter','./reply','./error','call','setEncoding','setTimeout','headers','emit','line','toLowerCase','hangup','520-Invalid','search','520\x20End\x20of\x20proper','function','no\x20code','substring','replace','result=','indexOf','substr','startsWith','split','length','match','error','code','close','E_AGI_SOCKET_CLOSE','timeout','pipe','command','write','inherits','prototype','answer','sendRequest','ANSWER','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','join','setExtension','SET\x20EXTENSION\x20%s','SET\x20PRIORITY\x20%s'];(function(_0x4a32bf,_0x17127b){var _0x309e43=function(_0x46a03c){while(--_0x46a03c){_0x4a32bf['push'](_0x4a32bf['shift']());}};_0x309e43(++_0x17127b);}(_0x5502,0x69));var _0x2550=function(_0x1d5ea8,_0x207732){_0x1d5ea8=_0x1d5ea8-0x0;var _0x42a9d6=_0x5502[_0x1d5ea8];return _0x42a9d6;};'use strict';var util=require(_0x2550('0x0'));var _=require(_0x2550('0x1'));var EventEmitter=require(_0x2550('0x2'))[_0x2550('0x3')];var AGIReply=require(_0x2550('0x4'));var AGIError=require(_0x2550('0x5'));function AGIChannel(_0x185ad3){var _0x2a80f8=this,_0x18739d=new AGIReply(),_0x30a166=![],_0x2dbee8={};EventEmitter[_0x2550('0x6')](_0x2a80f8);_0x185ad3[_0x2550('0x7')]('utf8');_0x185ad3[_0x2550('0x8')](0x8*0x3c*0x3c*0x3e8);_0x18739d['setEncoding']('utf8');_0x18739d['on'](_0x2550('0x9'),function(_0x40ead6){for(var _0x4fa582 in _0x40ead6){_0x2a80f8[_0x4fa582]=_0x40ead6[_0x4fa582];}_0x2a80f8[_0x2550('0xa')]('ready');});_0x18739d['on'](_0x2550('0xb'),function(_0xd9345){if(_0xd9345[_0x2550('0xc')]()==_0x2550('0xd')){_0x2a80f8[_0x2550('0xa')](_0x2550('0xd'));return;}if(_0xd9345['substring'](0x0,0xb)==_0x2550('0xe')){_0x30a166=!![];}if(_0x30a166){_0x2dbee8['rx']+=_0xd9345+'\x0a';if(_0xd9345[_0x2550('0xf')](_0x2550('0x10'))!=-0x1){_0x30a166=![];}}else{_0x2dbee8['rx']=_0xd9345;}if(_0x30a166){return;}if(typeof _0x2dbee8['cb']==_0x2550('0x11')){var _0x4ee238=_0x2dbee8['rx']['substring'](0x0,0x3),_0x3bc4f0=null,_0xcd1bbb=null;_0x4ee238=parseInt(_0x4ee238);if(isNaN(_0x4ee238)){_0x2dbee8['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x2550('0x12')});return;}if(_0x4ee238!=0xc8){_0x2dbee8['cb'](null,{'code':_0x4ee238,'result':-0x1,'extra':'KO'});return;}_0x3bc4f0=_0x2dbee8['rx'][_0x2550('0x13')](0x4)[_0x2550('0x14')](_0x2550('0x15'),'');if(_0x3bc4f0[_0x2550('0x16')]('\x20')!=-0x1){_0x3bc4f0=_0x3bc4f0[_0x2550('0x17')](0x0,_0x3bc4f0['indexOf']('\x20'));}if(_[_0x2550('0x18')](_0x3bc4f0,'-1')){_0x3bc4f0=parseInt(_0x3bc4f0);}_0xcd1bbb=_0x2dbee8['rx'][_0x2550('0x19')]('\x20');if(_0xcd1bbb[_0x2550('0x1a')]==0x3){_0xcd1bbb=_0xcd1bbb[0x2][_0x2550('0x13')](0x1,_0xcd1bbb[0x2][_0x2550('0x1a')]-0x1);}else if(_0xcd1bbb[_0x2550('0x1a')]>0x3){var _0x4fcabb=/\((.+)\)/;var _0x1aedfd=_0x2dbee8['rx'][_0x2550('0x1b')](_0x4fcabb);if(_0x1aedfd){_0xcd1bbb=_0x1aedfd[0x1];}else{_0xcd1bbb=null;}}else{_0xcd1bbb=null;}_0x2dbee8['cb'](null,{'code':_0x4ee238,'result':_0x3bc4f0,'extra':_0xcd1bbb});}});_0x185ad3['on'](_0x2550('0x1c'),function(_0x5c1bcb){_0x2a80f8[_0x2550('0xa')]('error',new AGIError('E_AGI_SOCKET_ERROR',_0x5c1bcb[_0x2550('0x1d')]));});_0x185ad3['on']('close',function(){_0x2a80f8[_0x2550('0xa')](_0x2550('0x1e'),new AGIError(_0x2550('0x1f')));});_0x185ad3['on'](_0x2550('0x20'),function(){_0x2a80f8[_0x2550('0xa')]('timeout',new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x185ad3['destroy']();});_0x185ad3[_0x2550('0x21')](_0x18739d);this[_0x2550('0x22')]=function(_0x364568,_0x295f3b){var _0x364568=_0x364568||'',_0x295f3b=typeof _0x295f3b==_0x2550('0x11')?_0x295f3b:new Function();_0x2dbee8={'tx':_0x364568,'rx':'','cb':_0x295f3b};_0x185ad3[_0x2550('0x23')](_0x364568+'\x0a');},this[_0x2550('0x1e')]=function(){_0x185ad3['destroy']();};}util[_0x2550('0x24')](AGIChannel,EventEmitter);AGIChannel[_0x2550('0x25')]['sendRequest']=function(_0x1adb08){return this[_0x2550('0x22')]['sync'](this,_0x1adb08);};AGIChannel[_0x2550('0x25')][_0x2550('0x26')]=function(){return this[_0x2550('0x27')](_0x2550('0x28'));};AGIChannel[_0x2550('0x25')][_0x2550('0x29')]=function(_0x66ac37,_0x46d52e,_0x2839f2){_0x66ac37=_0x66ac37===undefined?_0x2550('0x2a'):_0x66ac37;_0x46d52e=_0x46d52e===undefined?'5':_0x46d52e;_0x2839f2=_0x2839f2===undefined?'1':_0x2839f2;return this[_0x2550('0x27')](util[_0x2550('0x2b')](_0x2550('0x2c'),_0x66ac37,_0x46d52e*0x3e8,_0x2839f2));};AGIChannel['prototype'][_0x2550('0x2d')]=function(_0x1f05d6){_0x1f05d6=_0x1f05d6||_0x2550('0x2e');return this[_0x2550('0x27')](util[_0x2550('0x2b')](_0x2550('0x2f'),_0x1f05d6));};AGIChannel[_0x2550('0x25')][_0x2550('0x30')]=function(_0x2beed7,_0x256509){if(_[_0x2550('0x31')](_0x256509)){return this[_0x2550('0x27')](util['format'](_0x2550('0x32'),_0x2beed7,_0x256509[_0x2550('0x33')](',')));}return this[_0x2550('0x27')](util[_0x2550('0x2b')](_0x2550('0x32'),_0x2beed7,_0x256509));};AGIChannel['prototype']['setContext']=function(_0x3504ed){return this[_0x2550('0x27')](util[_0x2550('0x2b')]('SET\x20CONTEXT\x20%s',_0x3504ed));};AGIChannel[_0x2550('0x25')][_0x2550('0x34')]=function(_0x1f331e){return this['sendRequest'](util[_0x2550('0x2b')](_0x2550('0x35'),_0x1f331e));};AGIChannel[_0x2550('0x25')]['setPriority']=function(_0x5303c6){return this['sendRequest'](util[_0x2550('0x2b')](_0x2550('0x36'),_0x5303c6));};AGIChannel[_0x2550('0x25')]['hangup']=function(){return this[_0x2550('0x27')](_0x2550('0x37'));};AGIChannel['prototype']['setVariable']=function(_0x2d782c,_0x40105b){var _0xe40e1c=_[_0x2550('0x38')](_0x40105b)||_[_0x2550('0x39')](_0x40105b)?_0x40105b[_0x2550('0x3a')]():_0x40105b;return this[_0x2550('0x27')](util[_0x2550('0x2b')](_0x2550('0x3b'),_0x2d782c,_0xe40e1c?_0xe40e1c[_0x2550('0x3a')]()[_0x2550('0x14')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x2550('0x25')][_0x2550('0x3c')]=function(_0x295625,_0x44127b){return this['sendRequest'](util['format'](_0x2550('0x3d'),_0x295625,_0x44127b));};AGIChannel['prototype'][_0x2550('0x3e')]=function(_0x4fb49d,_0x1d4b15){return this[_0x2550('0x27')](util[_0x2550('0x2b')]('SAY\x20DIGITS\x20%s\x20%s',_0x4fb49d,_0x1d4b15));};AGIChannel['prototype']['sayPhonetic']=function(_0x5ae274,_0x3ad5cd){return this['sendRequest'](util[_0x2550('0x2b')](_0x2550('0x3f'),_0x5ae274,_0x3ad5cd));};AGIChannel[_0x2550('0x25')][_0x2550('0x40')]=function(_0x87b5c0,_0x40f761,_0x57d7e4){_0x40f761=_0x40f761||this[_0x2550('0x41')];_0x57d7e4=_0x57d7e4||0x1;this[_0x2550('0x42')](_0x87b5c0);this[_0x2550('0x34')](_0x40f761);this['setPriority'](_0x57d7e4);return this[_0x2550('0x2d')](util['format'](_0x2550('0x43'),_0x87b5c0,_0x40f761,_0x57d7e4));};AGIChannel[_0x2550('0x25')][_0x2550('0x44')]=function(_0x31f3fa){return this[_0x2550('0x27')](util[_0x2550('0x2b')](_0x2550('0x45'),_0x31f3fa));};AGIChannel[_0x2550('0x25')]['recordFile']=function(_0x4b4360,_0x145c65,_0x4131de,_0x4542e4,_0x40d2fb,_0x5cb562){_0x145c65=_0x145c65||'wav';_0x4131de=_0x4131de||'';_0x4542e4=_0x4542e4===undefined?-0x1:_0x4542e4==='-1'?-0x1:_0x4542e4*0x3e8;_0x40d2fb=_0x40d2fb===undefined?'':'s='+_0x40d2fb;_0x5cb562=_0x5cb562?_0x2550('0x46'):'';return this[_0x2550('0x27')](util[_0x2550('0x2b')](_0x2550('0x47'),_0x4b4360,_0x145c65,_0x4131de,_0x4542e4,_0x5cb562,_0x40d2fb));};AGIChannel[_0x2550('0x25')][_0x2550('0x48')]=function(_0x4ada98,_0x4363d6){_0x4363d6=_0x4363d6||'';return this[_0x2550('0x27')](util[_0x2550('0x2b')](_0x2550('0x49'),_0x4ada98,_0x4363d6));};AGIChannel['prototype']['agi']=function(_0x5ea85f){return this['exec'](_0x2550('0x4a'),_0x5ea85f);};AGIChannel[_0x2550('0x25')][_0x2550('0x4b')]=function(_0x89e527){return this[_0x2550('0x30')](_0x2550('0x4c'),_0x89e527);};AGIChannel[_0x2550('0x25')][_0x2550('0x1c')]=function(_0x4b987b,_0x1d8cc0){this[_0x2550('0x2d')](util[_0x2550('0x2b')](_0x2550('0x4d'),_0x4b987b['id'],_0x4b987b[_0x2550('0x4e')],_0x1d8cc0));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x2550('0x4f')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 05f6793..db1fbd7 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 _0x6189=['push','message','name','exports','util','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','[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.entry\x27\x20menu.','E_AGI_UNDEFINED'];(function(_0x5e0f5e,_0x4a2eea){var _0x2606f0=function(_0x770e5){while(--_0x770e5){_0x5e0f5e['push'](_0x5e0f5e['shift']());}};_0x2606f0(++_0x4a2eea);}(_0x6189,0x1ee));var _0x9618=function(_0x5cbbd1,_0x231e88){_0x5cbbd1=_0x5cbbd1-0x0;var _0x53f57e=_0x6189[_0x5cbbd1];return _0x53f57e;};'use strict';var util=require(_0x9618('0x0'));var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':_0x9618('0x1'),'E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':_0x9618('0x2'),'E_AGI_SERVER_VOICE_DISABLED':_0x9618('0x3'),'E_AGI_SOCKET_ERROR':_0x9618('0x4'),'E_AGI_SOCKET_CLOSE':_0x9618('0x5'),'E_AGI_SOCKET_TIMEOUT':_0x9618('0x6'),'E_AGI_COMMAND_EMPTY':_0x9618('0x7'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':_0x9618('0x8')};function AGIError(_0x30eff5){var _0x30eff5=_0x30eff5||null,_0x142b0b=_0x142b0b||[],_0x1229b7=0x1,_0x536634='';if(!error[_0x30eff5]){_0x30eff5=_0x9618('0x9');}_0x142b0b['push'](error[_0x30eff5]);while(arguments[_0x1229b7]){_0x142b0b[_0x9618('0xa')](arguments[_0x1229b7]);_0x1229b7++;}_0x536634=util['format']['apply'](util,_0x142b0b);this[_0x9618('0xb')]=_0x536634;this[_0x9618('0xc')]=_0x30eff5;}module[_0x9618('0xd')]=AGIError; \ No newline at end of file +var _0x470a=['Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','name','exports','util','Server\x20error.\x20Code:\x20%s.','Socket\x20error.\x20Code:\x20%s.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.'];(function(_0x5cc860,_0x924d8d){var _0x15bef6=function(_0x4df6a9){while(--_0x4df6a9){_0x5cc860['push'](_0x5cc860['shift']());}};_0x15bef6(++_0x924d8d);}(_0x470a,0xf7));var _0xa470=function(_0x3c0fe4,_0x171061){_0x3c0fe4=_0x3c0fe4-0x0;var _0xb2d90f=_0x470a[_0x3c0fe4];return _0xb2d90f;};'use strict';var util=require(_0xa470('0x0'));var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':_0xa470('0x1'),'E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':_0xa470('0x2'),'E_AGI_SOCKET_CLOSE':'Socket\x20closed.','E_AGI_SOCKET_TIMEOUT':_0xa470('0x3'),'E_AGI_COMMAND_EMPTY':_0xa470('0x4'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xa470('0x5'),'E_AGI_IVR_ENTRY':_0xa470('0x6')};function AGIError(_0x34a86a){var _0x34a86a=_0x34a86a||null,_0x11fc84=_0x11fc84||[],_0x9940d0=0x1,_0x2f64f3='';if(!error[_0x34a86a]){_0x34a86a=_0xa470('0x7');}_0x11fc84[_0xa470('0x8')](error[_0x34a86a]);while(arguments[_0x9940d0]){_0x11fc84[_0xa470('0x8')](arguments[_0x9940d0]);_0x9940d0++;}_0x2f64f3=util['format']['apply'](util,_0x11fc84);this['message']=_0x2f64f3;this[_0xa470('0x9')]=_0x34a86a;}module[_0xa470('0xa')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index 850333d..3949384 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 _0x1d9d=['exports','lodash','events','EventEmitter','ioredis','./error','redis','defaults','localhost','subscribe','agi','emit','error','message','parse','projectUpdate','E_AGI_SERVER_ERROR'];(function(_0x53ff74,_0x487d82){var _0x4ec01f=function(_0x178aac){while(--_0x178aac){_0x53ff74['push'](_0x53ff74['shift']());}};_0x4ec01f(++_0x487d82);}(_0x1d9d,0xcd));var _0xd1d9=function(_0x445f4b,_0x207f54){_0x445f4b=_0x445f4b-0x0;var _0x557112=_0x1d9d[_0x445f4b];return _0x557112;};'use strict';var _=require(_0xd1d9('0x0'));var EventEmitter=require(_0xd1d9('0x1'))[_0xd1d9('0x2')];var Redis=require(_0xd1d9('0x3'));var AGIError=require(_0xd1d9('0x4'));var config=require('../../config/environment');config[_0xd1d9('0x5')]=_[_0xd1d9('0x6')](config['redis'],{'host':_0xd1d9('0x7'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0xd1d9('0x5')]);sub[_0xd1d9('0x8')](_0xd1d9('0x9'),function(_0x1f4f3f){if(_0x1f4f3f)return eventEmitter[_0xd1d9('0xa')](_0xd1d9('0xb'),new AGIError('E_AGI_SERVER_ERROR',_0x1f4f3f));});sub['on'](_0xd1d9('0xc'),function(_0x108d4a,_0x4b784a){if(_0x108d4a!==_0xd1d9('0x9'))return;try{var _0x1fe9b2=JSON[_0xd1d9('0xd')](_0x4b784a);eventEmitter[_0xd1d9('0xa')](_0xd1d9('0xe'),_0x1fe9b2);}catch(_0x57fae0){eventEmitter[_0xd1d9('0xa')](_0xd1d9('0xb'),new AGIError(_0xd1d9('0xf'),_0x57fae0));}});module[_0xd1d9('0x10')]={'EventEmitter':eventEmitter}; \ No newline at end of file +var _0xcf5b=['events','ioredis','../../config/environment','defaults','redis','localhost','subscribe','agi','error','E_AGI_SERVER_ERROR','parse','emit','projectUpdate','lodash'];(function(_0x11e05d,_0x3a4491){var _0x335588=function(_0x35ec3f){while(--_0x35ec3f){_0x11e05d['push'](_0x11e05d['shift']());}};_0x335588(++_0x3a4491);}(_0xcf5b,0x6f));var _0xbcf5=function(_0x17bb31,_0x2fc6f8){_0x17bb31=_0x17bb31-0x0;var _0x505c71=_0xcf5b[_0x17bb31];return _0x505c71;};'use strict';var _=require(_0xbcf5('0x0'));var EventEmitter=require(_0xbcf5('0x1'))['EventEmitter'];var Redis=require(_0xbcf5('0x2'));var AGIError=require('./error');var config=require(_0xbcf5('0x3'));config['redis']=_[_0xbcf5('0x4')](config[_0xbcf5('0x5')],{'host':_0xbcf5('0x6'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0xbcf5('0x5')]);sub[_0xbcf5('0x7')](_0xbcf5('0x8'),function(_0x415338){if(_0x415338)return eventEmitter['emit'](_0xbcf5('0x9'),new AGIError(_0xbcf5('0xa'),_0x415338));});sub['on']('message',function(_0x374a05,_0x26f740){if(_0x374a05!=='agi')return;try{var _0x4b7ee5=JSON[_0xbcf5('0xb')](_0x26f740);eventEmitter[_0xbcf5('0xc')](_0xbcf5('0xd'),_0x4b7ee5);}catch(_0x2aa4f8){eventEmitter[_0xbcf5('0xc')](_0xbcf5('0x9'),new AGIError(_0xbcf5('0xa'),_0x2aa4f8));}});module['exports']={'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 b340d2f..54530ad 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 _0xcb33=['exports','agi','menu','getdigits','getsecretdigits','vertices','edges','numberOfEdges','prototype','addVertex','addEdge','size','relations','getVertex','traverseBFS','info','length','no\x20edge/s\x20available','condition','split','agicommand','vswitch','target','invalid','default\x20on\x20switch\x20not\x20found','max\x20retry\x20reach','condition\x20not\x20found'];(function(_0x480391,_0x13c3ad){var _0x18a535=function(_0x7e146d){while(--_0x7e146d){_0x480391['push'](_0x480391['shift']());}};_0x18a535(++_0x13c3ad);}(_0xcb33,0x1cc));var _0x3cb3=function(_0x3fe5fa,_0x4e0289){_0x3fe5fa=_0x3fe5fa-0x0;var _0x17ac6b=_0xcb33[_0x3fe5fa];return _0x17ac6b;};'use strict';var _=require('lodash');var logger=require('../../../config/logger')(_0x3cb3('0x0'));var verticesWithRetry=[_0x3cb3('0x1'),_0x3cb3('0x2'),_0x3cb3('0x3')];var Graph=function(){this[_0x3cb3('0x4')]={};this[_0x3cb3('0x5')]={};this[_0x3cb3('0x6')]=0x0;};Graph[_0x3cb3('0x7')][_0x3cb3('0x8')]=function(_0x50ed88){this[_0x3cb3('0x4')][_0x50ed88['id']]=_0x50ed88;this[_0x3cb3('0x5')][_0x50ed88['id']]=[];};Graph[_0x3cb3('0x7')][_0x3cb3('0x9')]=function(_0x8545ef,_0x2d2913,_0x3666dd){this['edges'][_0x8545ef]['push']({'target':_0x2d2913,'condition':_0x3666dd});this['numberOfEdges']+=0x1;};Graph[_0x3cb3('0x7')][_0x3cb3('0xa')]=function(){return _[_0x3cb3('0xa')](this[_0x3cb3('0x4')]);};Graph['prototype'][_0x3cb3('0xb')]=function(){return this[_0x3cb3('0x6')];};Graph[_0x3cb3('0x7')][_0x3cb3('0xc')]=function(_0xfa15ea){return this['vertices'][_0xfa15ea];};Graph[_0x3cb3('0x7')][_0x3cb3('0xd')]=function(_0x195161,_0x17e725){if(!this[_0x3cb3('0x4')][_0x195161]){return logger['info']('no\x20vertex\x20found');}var _0x10f385=_0x17e725(this[_0x3cb3('0x4')][_0x195161]);if(!_0x10f385){return logger[_0x3cb3('0xe')]('stop\x20traverse');}if(this['edges'][_0x195161][_0x3cb3('0xf')]===0x0){return logger[_0x3cb3('0xe')](_0x3cb3('0x10'));}for(var _0x262a4b=0x0,_0x4eaede=[],_0xbe35af=![];_0x262a4b\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','dnid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','callerid','uniqueid','evtHangup','catch','indexOf','substring','debug','variables','stringify','close','timeout','hangup','find','handleUnpublished','initialize','voice','callysquare','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','then','getAll','[LICENSE]','finally','listening','connection','lodash','syncho','util','../../config/environment','./project','./events','EventEmitter','agi','defaults','127.0.0.1','projectUpdate','error','stack','findIndex','splice','push','log','info'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x84c4,0x1dd));var _0x484c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x84c4[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x484c('0x0'));var syncho=require(_0x484c('0x1'));var util=require(_0x484c('0x2'));var config=require(_0x484c('0x3'));var logger=require('../../config/logger')('agi');var utilLicense=require('../../config/license/util');var rpc=require('./rpc');var Project=require(_0x484c('0x4'));var AGIEmitter=require(_0x484c('0x5'))[_0x484c('0x6')];var projects=[];config[_0x484c('0x7')]=_[_0x484c('0x8')](config[_0x484c('0x7')],{'ip':_0x484c('0x9'),'port':0x11dd});AGIEmitter['on'](_0x484c('0xa'),projectUpdateHandler);function connectionHandler(_0x4e0b0a){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0x4e0b0a);agiHandler(_0x4e0b0a);}catch(_0x2173a1){logger[_0x484c('0xb')](_0x2173a1[_0x484c('0xc')]);}});});}function projectUpdateHandler(_0x2fc94f){try{var _0x587c54=_[_0x484c('0xd')](projects,['id',_0x2fc94f['id']]);if(_0x587c54>-0x1){if(_0x2fc94f['deleted']===!![]){projects[_0x484c('0xe')](_0x587c54,0x1);}else{projects[_0x587c54]=_0x2fc94f;}}else{projects[_0x484c('0xf')](_0x2fc94f);}}catch(_0x2e6c51){logger[_0x484c('0xb')](_0x2e6c51['stack']);}}function listeningHandler(){console[_0x484c('0x10')]('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config['agi']['port']);logger[_0x484c('0x11')](util[_0x484c('0x12')]('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',config[_0x484c('0x7')]['ip'],config[_0x484c('0x7')][_0x484c('0x13')]));}function errorHandler(_0x27d5f5){if(_0x27d5f5&&_0x27d5f5['name']&&_0x27d5f5['message']){logger[_0x484c('0xb')](util[_0x484c('0x12')](_0x484c('0x14'),_0x27d5f5[_0x484c('0x15')],_0x27d5f5[_0x484c('0x16')]));}else{logger[_0x484c('0xb')](util['format'](_0x484c('0x17'),_0x27d5f5[_0x484c('0xc')]));}}function closeHandler(){logger[_0x484c('0x11')](util[_0x484c('0x12')](_0x484c('0x18'),this['arg_1'],this['calleridname'],this['callerid'],this[_0x484c('0x19')],this['uniqueid']));try{createSquareReport(this);}catch(_0x19eea8){logger[_0x484c('0xb')](_0x19eea8[_0x484c('0xc')]);}}function timeoutHandler(){logger[_0x484c('0x11')](util[_0x484c('0x12')](_0x484c('0x1a'),this[_0x484c('0x1b')],this['calleridname'],this['callerid'],this[_0x484c('0x19')],this['uniqueid']));}function hangupHandler(){logger[_0x484c('0x11')](util['format'](_0x484c('0x1c'),this[_0x484c('0x1b')],this[_0x484c('0x1d')],this[_0x484c('0x1e')],this[_0x484c('0x19')],this[_0x484c('0x1f')]));this[_0x484c('0x20')]=!![];}function createSquareReport(_0x599468,_0x556815){rpc['createSquareReport'](_0x599468)['then'](function(_0x58ed50){if(_0x556815){_0x556815(null,_0x58ed50);}})[_0x484c('0x21')](function(_0x861484){if(_0x556815){_0x556815(null,_0x861484);}});}function setChannelVariables(_0x576011){for(var _0x3a373b in _0x576011){if(_0x576011['hasOwnProperty'](_0x3a373b)){if(_0x3a373b[_0x484c('0x22')]('agi_')===0x0){_0x576011[_0x3a373b[_0x484c('0x23')](0x4)]=_0x576011[_0x3a373b];delete _0x576011[_0x3a373b];}}}}function agiHandler(_0xeb96cd){logger[_0x484c('0x24')](_0x484c('0x25'),JSON[_0x484c('0x26')](_0xeb96cd,null,0x2));logger[_0x484c('0x11')](util['format']('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0xeb96cd['arg_1'],_0xeb96cd[_0x484c('0x1d')],_0xeb96cd[_0x484c('0x1e')],_0xeb96cd[_0x484c('0x19')],_0xeb96cd[_0x484c('0x1f')]));_0xeb96cd['on'](_0x484c('0xb'),errorHandler);_0xeb96cd['on'](_0x484c('0x27'),closeHandler);_0xeb96cd['on'](_0x484c('0x28'),timeoutHandler);_0xeb96cd[_0x484c('0x20')]=![];_0xeb96cd['on'](_0x484c('0x29'),hangupHandler);var _0x566f64=_[_0x484c('0x2a')](projects,['name',_0xeb96cd[_0x484c('0x1b')]]);if(!_0x566f64)return Project['handleNotFound'](_0xeb96cd);if(!_0x566f64['production'])return Project[_0x484c('0x2b')](_0xeb96cd);return Project[_0x484c('0x2c')](_0x566f64,_0xeb96cd);}function main(){var _0x555d00;return utilLicense['getLicense']()['then'](function(_0x4318ff){if(!_0x4318ff)return;if(_0x4318ff[_0x484c('0x2d')]){if(_0x4318ff['callysquare']&&_0x4318ff[_0x484c('0x2e')]>0x0){logger[_0x484c('0x11')](util['format']('[LICENSE]\x20CHANNELS:\x20%s',_0x4318ff['callysquare']));_0x555d00=_0x4318ff[_0x484c('0x2e')];}else{logger[_0x484c('0x11')](_0x484c('0x2f'));}}else{logger['info'](_0x484c('0x30'));_0x555d00=-0x1;}})[_0x484c('0x31')](function(){return Project[_0x484c('0x32')]();})[_0x484c('0x31')](function(_0x498038){projects=_0x498038;return;})[_0x484c('0x21')](function(_0xe23dcb){logger[_0x484c('0xb')](_0x484c('0x33'),_0xe23dcb[_0x484c('0xc')]);})[_0x484c('0x34')](function(){var _0x14a6a0=require('./server')(config[_0x484c('0x7')][_0x484c('0x13')],config[_0x484c('0x7')]['ip'],_0x555d00);_0x14a6a0['on']('error',errorHandler);_0x14a6a0['on'](_0x484c('0x35'),listeningHandler);_0x14a6a0['on'](_0x484c('0x36'),connectionHandler);_0x14a6a0['on']('close',closeHandler);});}main(); \ No newline at end of file +var _0xb11c=['defaults','127.0.0.1','projectUpdate','nextTick','error','stack','findIndex','deleted','splice','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','callerid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','dnid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','createSquareReport','then','catch','hasOwnProperty','indexOf','agi_','substring','debug','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','timeout','evtHangup','handleNotFound','initialize','getLicense','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','getAll','[LICENSE]','./server','listening','connection','close','lodash','syncho','util','../../config/logger','./rpc','./events','EventEmitter','agi'];(function(_0x218e60,_0x1a0056){var _0x22615a=function(_0x3a221c){while(--_0x3a221c){_0x218e60['push'](_0x218e60['shift']());}};_0x22615a(++_0x1a0056);}(_0xb11c,0x15a));var _0xcb11=function(_0x24d3aa,_0x5ea498){_0x24d3aa=_0x24d3aa-0x0;var _0x55c360=_0xb11c[_0x24d3aa];return _0x55c360;};'use strict';var _=require(_0xcb11('0x0'));var syncho=require(_0xcb11('0x1'));var util=require(_0xcb11('0x2'));var config=require('../../config/environment');var logger=require(_0xcb11('0x3'))('agi');var utilLicense=require('../../config/license/util');var rpc=require(_0xcb11('0x4'));var Project=require('./project');var AGIEmitter=require(_0xcb11('0x5'))[_0xcb11('0x6')];var projects=[];config[_0xcb11('0x7')]=_[_0xcb11('0x8')](config['agi'],{'ip':_0xcb11('0x9'),'port':0x11dd});AGIEmitter['on'](_0xcb11('0xa'),projectUpdateHandler);function connectionHandler(_0x4c7354){process[_0xcb11('0xb')](function(){syncho(function(){try{setChannelVariables(_0x4c7354);agiHandler(_0x4c7354);}catch(_0x4a5eb2){logger[_0xcb11('0xc')](_0x4a5eb2[_0xcb11('0xd')]);}});});}function projectUpdateHandler(_0x340748){try{var _0x5d35cd=_[_0xcb11('0xe')](projects,['id',_0x340748['id']]);if(_0x5d35cd>-0x1){if(_0x340748[_0xcb11('0xf')]===!![]){projects[_0xcb11('0x10')](_0x5d35cd,0x1);}else{projects[_0x5d35cd]=_0x340748;}}else{projects['push'](_0x340748);}}catch(_0x56bdf6){logger[_0xcb11('0xc')](_0x56bdf6[_0xcb11('0xd')]);}}function listeningHandler(){console['log'](_0xcb11('0x11'),config['agi'][_0xcb11('0x12')]);logger[_0xcb11('0x13')](util[_0xcb11('0x14')](_0xcb11('0x15'),config[_0xcb11('0x7')]['ip'],config[_0xcb11('0x7')][_0xcb11('0x12')]));}function errorHandler(_0x23a74f){if(_0x23a74f&&_0x23a74f[_0xcb11('0x16')]&&_0x23a74f[_0xcb11('0x17')]){logger[_0xcb11('0xc')](util[_0xcb11('0x14')]('[%s]\x20%s',_0x23a74f[_0xcb11('0x16')],_0x23a74f[_0xcb11('0x17')]));}else{logger['error'](util[_0xcb11('0x14')](_0xcb11('0x18'),_0x23a74f[_0xcb11('0xd')]));}}function closeHandler(){logger[_0xcb11('0x13')](util['format'](_0xcb11('0x19'),this['arg_1'],this[_0xcb11('0x1a')],this[_0xcb11('0x1b')],this['dnid'],this[_0xcb11('0x1c')]));try{createSquareReport(this);}catch(_0x630116){logger['error'](_0x630116[_0xcb11('0xd')]);}}function timeoutHandler(){logger[_0xcb11('0x13')](util[_0xcb11('0x14')](_0xcb11('0x1d'),this[_0xcb11('0x1e')],this[_0xcb11('0x1a')],this[_0xcb11('0x1b')],this[_0xcb11('0x1f')],this[_0xcb11('0x1c')]));}function hangupHandler(){logger['info'](util[_0xcb11('0x14')](_0xcb11('0x20'),this[_0xcb11('0x1e')],this[_0xcb11('0x1a')],this['callerid'],this['dnid'],this[_0xcb11('0x1c')]));this['evtHangup']=!![];}function createSquareReport(_0x263291,_0x4ac314){rpc[_0xcb11('0x21')](_0x263291)[_0xcb11('0x22')](function(_0x458eb9){if(_0x4ac314){_0x4ac314(null,_0x458eb9);}})[_0xcb11('0x23')](function(_0x457055){if(_0x4ac314){_0x4ac314(null,_0x457055);}});}function setChannelVariables(_0x4c09fa){for(var _0x4576ce in _0x4c09fa){if(_0x4c09fa[_0xcb11('0x24')](_0x4576ce)){if(_0x4576ce[_0xcb11('0x25')](_0xcb11('0x26'))===0x0){_0x4c09fa[_0x4576ce[_0xcb11('0x27')](0x4)]=_0x4c09fa[_0x4576ce];delete _0x4c09fa[_0x4576ce];}}}}function agiHandler(_0x285967){logger[_0xcb11('0x28')](_0xcb11('0x29'),JSON[_0xcb11('0x2a')](_0x285967,null,0x2));logger[_0xcb11('0x13')](util[_0xcb11('0x14')](_0xcb11('0x2b'),_0x285967[_0xcb11('0x1e')],_0x285967['calleridname'],_0x285967[_0xcb11('0x1b')],_0x285967['dnid'],_0x285967[_0xcb11('0x1c')]));_0x285967['on'](_0xcb11('0xc'),errorHandler);_0x285967['on']('close',closeHandler);_0x285967['on'](_0xcb11('0x2c'),timeoutHandler);_0x285967[_0xcb11('0x2d')]=![];_0x285967['on']('hangup',hangupHandler);var _0x1a5efd=_['find'](projects,[_0xcb11('0x16'),_0x285967[_0xcb11('0x1e')]]);if(!_0x1a5efd)return Project[_0xcb11('0x2e')](_0x285967);if(!_0x1a5efd['production'])return Project['handleUnpublished'](_0x285967);return Project[_0xcb11('0x2f')](_0x1a5efd,_0x285967);}function main(){var _0x16d091;return utilLicense[_0xcb11('0x30')]()[_0xcb11('0x22')](function(_0x127b60){if(!_0x127b60)return;if(_0x127b60['voice']){if(_0x127b60[_0xcb11('0x31')]&&_0x127b60[_0xcb11('0x31')]>0x0){logger[_0xcb11('0x13')](util['format'](_0xcb11('0x32'),_0x127b60[_0xcb11('0x31')]));_0x16d091=_0x127b60['callysquare'];}else{logger[_0xcb11('0x13')](_0xcb11('0x33'));}}else{logger[_0xcb11('0x13')](_0xcb11('0x34'));_0x16d091=-0x1;}})[_0xcb11('0x22')](function(){return Project[_0xcb11('0x35')]();})[_0xcb11('0x22')](function(_0x5e0994){projects=_0x5e0994;return;})[_0xcb11('0x23')](function(_0x11ccbd){logger[_0xcb11('0xc')](_0xcb11('0x36'),_0x11ccbd[_0xcb11('0xd')]);})['finally'](function(){var _0xdef914=require(_0xcb11('0x37'))(config[_0xcb11('0x7')][_0xcb11('0x12')],config[_0xcb11('0x7')]['ip'],_0x16d091);_0xdef914['on']('error',errorHandler);_0xdef914['on'](_0xcb11('0x38'),listeningHandler);_0xdef914['on'](_0xcb11('0x39'),connectionHandler);_0xdef914['on'](_0xcb11('0x3a'),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 138f829..cb9a5bc 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 _0x6b56=['catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','request','then','error','message','result'];(function(_0x395c14,_0x3f13b2){var _0x8d63a1=function(_0x2468de){while(--_0x2468de){_0x395c14['push'](_0x395c14['shift']());}};_0x8d63a1(++_0x3f13b2);}(_0x6b56,0xd4));var _0x66b5=function(_0x42868d,_0x165917){_0x42868d=_0x42868d-0x0;var _0xd29bb1=_0x6b56[_0x42868d];return _0xd29bb1;};'use strict';var BPromise=require(_0x66b5('0x0'));var jayson=require(_0x66b5('0x1'));var client=jayson[_0x66b5('0x2')]['http']({'port':0x232b});function request(_0x451007,_0x4aabc6){return new BPromise(function(_0x4c6b1c,_0x590477){return client[_0x66b5('0x3')](_0x451007,_0x4aabc6)[_0x66b5('0x4')](function(_0x3f9000){if(_0x3f9000[_0x66b5('0x5')]){return _0x590477(_0x3f9000['error'][_0x66b5('0x6')]);}else{return _0x4c6b1c(_0x3f9000[_0x66b5('0x7')]);}})[_0x66b5('0x8')](function(_0x1fbb90){return _0x590477(_0x1fbb90);});});}exports[_0x66b5('0x9')]=function(_0x276575,_0x44aadd){return request(_0x66b5('0xa'),{'account':_0x276575,'message':_0x44aadd});}; \ No newline at end of file +var _0x9d55=['catch','sendMailMessage','SendMail','client','http','then','error','message','result'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9d55,0x1c5));var _0x59d5=function(_0xbaf35f,_0x48730e){_0xbaf35f=_0xbaf35f-0x0;var _0x3651d1=_0x9d55[_0xbaf35f];return _0x3651d1;};'use strict';var BPromise=require('bluebird');var jayson=require('jayson/promise');var client=jayson[_0x59d5('0x0')][_0x59d5('0x1')]({'port':0x232b});function request(_0x1fdc8b,_0x262c49){return new BPromise(function(_0x3a2729,_0x4886d1){return client['request'](_0x1fdc8b,_0x262c49)[_0x59d5('0x2')](function(_0x567fef){if(_0x567fef[_0x59d5('0x3')]){return _0x4886d1(_0x567fef['error'][_0x59d5('0x4')]);}else{return _0x3a2729(_0x567fef[_0x59d5('0x5')]);}})[_0x59d5('0x6')](function(_0xe6aff6){return _0x4886d1(_0xe6aff6);});});}exports[_0x59d5('0x7')]=function(_0x457525,_0x4f8762){return request(_0x59d5('0x8'),{'account':_0x457525,'message':_0x4f8762});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index 12c0656..e653651 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 _0x42fa=['gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','result','isUndefined','toString','stack','finally','format','agicommand\x20not\x20found','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','Project\x20%s\x20not\x20found','close','Project\x20%s\x20not\x20published','moment','xml2json','util','../../config/logger','agi','./rpc','./mailRpc','./graph','./vertices','getSquareProjects','catch','error','agicommand','hasOwnProperty','retry','maxRetry','addVertex','mxCell','length','target','value','toJson','mxGraphModel','root','inspect','production','start','YYYY-MM-DD\x20HH:mm:ss','omit','info','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','traverseBFS','clear','debug','vertex','stringify','gotoc'];(function(_0x145f21,_0x1296bd){var _0x90912d=function(_0x69e9cc){while(--_0x69e9cc){_0x145f21['push'](_0x145f21['shift']());}};_0x90912d(++_0x1296bd);}(_0x42fa,0x17a));var _0xa42f=function(_0x4a8f4b,_0x2e5c36){_0x4a8f4b=_0x4a8f4b-0x0;var _0x58a9ef=_0x42fa[_0x4a8f4b];return _0x58a9ef;};'use strict';var _=require('lodash');var moment=require(_0xa42f('0x0'));var parser=require(_0xa42f('0x1'));var util=require(_0xa42f('0x2'));var logger=require(_0xa42f('0x3'))(_0xa42f('0x4'));var rpc=require(_0xa42f('0x5'));var mailRpc=require(_0xa42f('0x6'));var Graph=require(_0xa42f('0x7'));var Vertices=require(_0xa42f('0x8'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0xa42f('0x9')]()[_0xa42f('0xa')](function(_0x3e5295){logger[_0xa42f('0xb')]('Unable\x20to\x20download\x20CallySquare\x20projects',_0x3e5295['stack']);return[];});}function addVertex(_0x1d0be5,_0x5acf55,_0x38e4e0){_0x5acf55[_0xa42f('0xc')]=_0x38e4e0;if(_0x5acf55[_0xa42f('0xd')](_0xa42f('0xe'))){_0x5acf55[_0xa42f('0xf')]=parseInt(_0x5acf55[_0xa42f('0xe')],0xa);}_0x1d0be5[_0xa42f('0x10')](_['omit'](_0x5acf55,_0xa42f('0x11')));}function initGraph(_0x2d966f,_0x738ce6){var _0xc0d25d=new Graph();for(var _0x806412 in _0x2d966f){if(_0x2d966f[_0xa42f('0xd')](_0x806412)){if(_['isArray'](_0x2d966f[_0x806412])){for(var _0x59eae5=0x0;_0x59eae5<_0x2d966f[_0x806412]['length'];_0x59eae5+=0x1){addVertex(_0xc0d25d,_0x2d966f[_0x806412][_0x59eae5],_0x806412);}}else{addVertex(_0xc0d25d,_0x2d966f[_0x806412],_0x806412);}}}for(var _0x4c5ab7=0x0;_0x4c5ab7<_0x738ce6[_0xa42f('0x12')];_0x4c5ab7+=0x1){if(_0x738ce6[_0x4c5ab7]['source']&&_0x738ce6[_0x4c5ab7][_0xa42f('0x13')]){_0xc0d25d['addEdge'](_0x738ce6[_0x4c5ab7]['source'],_0x738ce6[_0x4c5ab7]['target'],_0x738ce6[_0x4c5ab7][_0xa42f('0x14')]);}}return _0xc0d25d;}function getRoot(_0xe426db){return parser[_0xa42f('0x15')](_0xe426db,{'object':!![]})[_0xa42f('0x16')][_0xa42f('0x17')];}function inspect(_0x3f3455){return util[_0xa42f('0x18')](_0x3f3455,{'showHidden':![],'depth':null});}function initialize(_0x39cad2,_0x41737e){var _0xde4304=getRoot(_0x39cad2[_0xa42f('0x19')]);if(!_0xde4304||!_0xde4304[_0xa42f('0x1a')])return;var _0x30cbc4,_0x408d13,_0x3d92e2;logger['debug']('root',JSON['stringify'](_0xde4304,null,0x2));_0x41737e['joinAt']=moment()['format'](_0xa42f('0x1b'));_0x30cbc4=initGraph(_[_0xa42f('0x1c')](_0xde4304,_0xa42f('0x11')),_0xde4304[_0xa42f('0x11')]);_0x408d13=new Vertices(_0x41737e,rpc,mailRpc);logger[_0xa42f('0x1d')](util['format'](_0xa42f('0x1e'),_0x41737e[_0xa42f('0x1f')],_0x41737e[_0xa42f('0x20')],_0x41737e[_0xa42f('0x21')],_0x41737e[_0xa42f('0x22')],_0x41737e[_0xa42f('0x23')]));_0x30cbc4[_0xa42f('0x24')](_0xde4304[_0xa42f('0x1a')]['id'],function(_0x25416f){try{_0x25416f=_0x408d13[_0xa42f('0x25')](_0x25416f);logger[_0xa42f('0x26')](_0xa42f('0x27'),JSON[_0xa42f('0x28')](_0x25416f,null,0x2));if(_0x25416f['agicommand']===_0xa42f('0x29')){logger['info'](_0xa42f('0x2a'));_0x41737e[_0xa42f('0x2b')]=_0x25416f[_0xa42f('0x2b')]||_0x41737e['context'];_0x41737e[_0xa42f('0x2c')]=_0x25416f[_0xa42f('0x2c')];_0x41737e[_0xa42f('0x2d')]=_0x25416f[_0xa42f('0x2d')]?_0x25416f[_0xa42f('0x2d')]-0x1:0x1;return null;}else if(_0x25416f&&_0x408d13[_0x25416f[_0xa42f('0xc')]]){_0x3d92e2=_0x408d13[_0x25416f[_0xa42f('0xc')]](_0x25416f);logger[_0xa42f('0x1d')](_0xa42f('0x2e'),JSON[_0xa42f('0x28')](_0x3d92e2,null,0x2));if(_0x3d92e2&&_0x3d92e2['code']===AGI_CODE_SUCCESS&&_0x3d92e2[_0xa42f('0x2f')]!==AGI_RESULT_ERROR&&!_0x41737e['evtHangup']){logger['debug'](_0xa42f('0x2e'),inspect(_0x3d92e2));return _[_0xa42f('0x30')](_0x3d92e2[_0xa42f('0x2f')])?null:_0x3d92e2[_0xa42f('0x2f')][_0xa42f('0x31')]();}else{logger[_0xa42f('0xb')]('response',inspect(_0x3d92e2));return null;}}else{logger['error']('agicommand\x20not\x20found');return null;}}catch(_0x519206){logger[_0xa42f('0xb')](_0x519206[_0xa42f('0x32')]);return null;}});if(_0xde4304[_0xa42f('0x33')]){logger[_0xa42f('0x1d')](util[_0xa42f('0x34')]('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x41737e[_0xa42f('0x1f')],_0x41737e[_0xa42f('0x20')],_0x41737e[_0xa42f('0x21')],_0x41737e[_0xa42f('0x22')],_0x41737e[_0xa42f('0x23')]));_0x30cbc4['traverseBFS'](_0xde4304['finally']['id'],function(_0x1068e5){try{_0x1068e5=_0x408d13[_0xa42f('0x25')](_0x1068e5);logger['debug'](_0xa42f('0x27'),JSON[_0xa42f('0x28')](_0x1068e5,null,0x2));if(_0x1068e5&&_0x408d13[_0x1068e5[_0xa42f('0xc')]]){_0x3d92e2=_0x408d13[_0x1068e5[_0xa42f('0xc')]](_0x1068e5);if(_0x3d92e2){logger[_0xa42f('0x26')](_0xa42f('0x2e'),inspect(_0x3d92e2));return _[_0xa42f('0x30')](_0x3d92e2[_0xa42f('0x2f')])?null:_0x3d92e2['result'][_0xa42f('0x31')]();}else{logger[_0xa42f('0xb')](_0xa42f('0x2e'),inspect(_0x3d92e2));return null;}}else{logger['error'](_0xa42f('0x35'));return null;}}catch(_0x43c669){logger[_0xa42f('0xb')](_0x43c669[_0xa42f('0x32')]);return null;}});}logger[_0xa42f('0x1d')](util['format'](_0xa42f('0x36'),_0x41737e[_0xa42f('0x1f')],_0x41737e[_0xa42f('0x20')],_0x41737e['callerid'],_0x41737e['dnid'],_0x41737e['uniqueid']));logger['info'](util[_0xa42f('0x34')](_0xa42f('0x37'),_0x41737e[_0xa42f('0x2b')],_0x41737e[_0xa42f('0x2c')],parseInt(_0x41737e[_0xa42f('0x2d')],0xa)+0x1));_0x41737e[_0xa42f('0x38')](_0x41737e[_0xa42f('0x2b')],_0x41737e[_0xa42f('0x2c')],parseInt(_0x41737e[_0xa42f('0x2d')],0xa)+0x1);_0x41737e['close']();}function handleNotFound(_0x3b51c4){logger[_0xa42f('0xb')](util[_0xa42f('0x34')](_0xa42f('0x39'),_0x3b51c4[_0xa42f('0x1f')]));_0x3b51c4['continueAt'](_0x3b51c4[_0xa42f('0x2b')],_0x3b51c4[_0xa42f('0x2c')],parseInt(_0x3b51c4[_0xa42f('0x2d')],0xa)+0x1);_0x3b51c4[_0xa42f('0x3a')]();}function handleUnpublished(_0x19f180){logger[_0xa42f('0xb')](util[_0xa42f('0x34')](_0xa42f('0x3b'),_0x19f180[_0xa42f('0x1f')]));_0x19f180['continueAt'](_0x19f180[_0xa42f('0x2b')],_0x19f180[_0xa42f('0x2c')],parseInt(_0x19f180['priority'],0xa)+0x1);_0x19f180[_0xa42f('0x3a')]();}module['exports']={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +var _0x192b=['callerid','dnid','traverseBFS','clear','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','result','evtHangup','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','vertex','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','Project\x20%s\x20not\x20found','close','exports','lodash','moment','xml2json','util','../../config/logger','agi','./rpc','./mailRpc','./graph','./vertices','error','Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand','hasOwnProperty','retry','omit','mxCell','isArray','target','addEdge','value','toJson','production','start','debug','root','stringify','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','arg_1','calleridname'];(function(_0x393733,_0x487cc9){var _0x400bce=function(_0x4a822e){while(--_0x4a822e){_0x393733['push'](_0x393733['shift']());}};_0x400bce(++_0x487cc9);}(_0x192b,0x1b5));var _0xb192=function(_0x1cb690,_0x5592e3){_0x1cb690=_0x1cb690-0x0;var _0x3bebd4=_0x192b[_0x1cb690];return _0x3bebd4;};'use strict';var _=require(_0xb192('0x0'));var moment=require(_0xb192('0x1'));var parser=require(_0xb192('0x2'));var util=require(_0xb192('0x3'));var logger=require(_0xb192('0x4'))(_0xb192('0x5'));var rpc=require(_0xb192('0x6'));var mailRpc=require(_0xb192('0x7'));var Graph=require(_0xb192('0x8'));var Vertices=require(_0xb192('0x9'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc['getSquareProjects']()['catch'](function(_0x2d2300){logger[_0xb192('0xa')](_0xb192('0xb'),_0x2d2300[_0xb192('0xc')]);return[];});}function addVertex(_0x3134af,_0x5ae090,_0x121f52){_0x5ae090[_0xb192('0xd')]=_0x121f52;if(_0x5ae090[_0xb192('0xe')]('retry')){_0x5ae090['maxRetry']=parseInt(_0x5ae090[_0xb192('0xf')],0xa);}_0x3134af['addVertex'](_[_0xb192('0x10')](_0x5ae090,_0xb192('0x11')));}function initGraph(_0x16c533,_0x3e56b7){var _0x131f43=new Graph();for(var _0x4c3fe6 in _0x16c533){if(_0x16c533[_0xb192('0xe')](_0x4c3fe6)){if(_[_0xb192('0x12')](_0x16c533[_0x4c3fe6])){for(var _0x3142c6=0x0;_0x3142c6<_0x16c533[_0x4c3fe6]['length'];_0x3142c6+=0x1){addVertex(_0x131f43,_0x16c533[_0x4c3fe6][_0x3142c6],_0x4c3fe6);}}else{addVertex(_0x131f43,_0x16c533[_0x4c3fe6],_0x4c3fe6);}}}for(var _0x45acbf=0x0;_0x45acbf<_0x3e56b7['length'];_0x45acbf+=0x1){if(_0x3e56b7[_0x45acbf]['source']&&_0x3e56b7[_0x45acbf][_0xb192('0x13')]){_0x131f43[_0xb192('0x14')](_0x3e56b7[_0x45acbf]['source'],_0x3e56b7[_0x45acbf][_0xb192('0x13')],_0x3e56b7[_0x45acbf][_0xb192('0x15')]);}}return _0x131f43;}function getRoot(_0x4ed894){return parser[_0xb192('0x16')](_0x4ed894,{'object':!![]})['mxGraphModel']['root'];}function inspect(_0x53b773){return util['inspect'](_0x53b773,{'showHidden':![],'depth':null});}function initialize(_0x5657f6,_0x5759c0){var _0x124504=getRoot(_0x5657f6[_0xb192('0x17')]);if(!_0x124504||!_0x124504[_0xb192('0x18')])return;var _0x3beb51,_0x18b802,_0x5de826;logger[_0xb192('0x19')](_0xb192('0x1a'),JSON[_0xb192('0x1b')](_0x124504,null,0x2));_0x5759c0[_0xb192('0x1c')]=moment()[_0xb192('0x1d')](_0xb192('0x1e'));_0x3beb51=initGraph(_[_0xb192('0x10')](_0x124504,'mxCell'),_0x124504[_0xb192('0x11')]);_0x18b802=new Vertices(_0x5759c0,rpc,mailRpc);logger[_0xb192('0x1f')](util['format'](_0xb192('0x20'),_0x5759c0[_0xb192('0x21')],_0x5759c0[_0xb192('0x22')],_0x5759c0[_0xb192('0x23')],_0x5759c0[_0xb192('0x24')],_0x5759c0['uniqueid']));_0x3beb51[_0xb192('0x25')](_0x124504[_0xb192('0x18')]['id'],function(_0xbcce63){try{_0xbcce63=_0x18b802[_0xb192('0x26')](_0xbcce63);logger[_0xb192('0x19')]('vertex',JSON[_0xb192('0x1b')](_0xbcce63,null,0x2));if(_0xbcce63[_0xb192('0xd')]===_0xb192('0x27')){logger[_0xb192('0x1f')](_0xb192('0x28'));_0x5759c0[_0xb192('0x29')]=_0xbcce63[_0xb192('0x29')]||_0x5759c0['context'];_0x5759c0[_0xb192('0x2a')]=_0xbcce63['extension'];_0x5759c0[_0xb192('0x2b')]=_0xbcce63[_0xb192('0x2b')]?_0xbcce63[_0xb192('0x2b')]-0x1:0x1;return null;}else if(_0xbcce63&&_0x18b802[_0xbcce63[_0xb192('0xd')]]){_0x5de826=_0x18b802[_0xbcce63[_0xb192('0xd')]](_0xbcce63);logger['info'](_0xb192('0x2c'),JSON[_0xb192('0x1b')](_0x5de826,null,0x2));if(_0x5de826&&_0x5de826['code']===AGI_CODE_SUCCESS&&_0x5de826[_0xb192('0x2d')]!==AGI_RESULT_ERROR&&!_0x5759c0[_0xb192('0x2e')]){logger[_0xb192('0x19')](_0xb192('0x2c'),inspect(_0x5de826));return _[_0xb192('0x2f')](_0x5de826[_0xb192('0x2d')])?null:_0x5de826[_0xb192('0x2d')][_0xb192('0x30')]();}else{logger[_0xb192('0xa')]('response',inspect(_0x5de826));return null;}}else{logger[_0xb192('0xa')](_0xb192('0x31'));return null;}}catch(_0x239418){logger[_0xb192('0xa')](_0x239418[_0xb192('0xc')]);return null;}});if(_0x124504[_0xb192('0x32')]){logger[_0xb192('0x1f')](util[_0xb192('0x1d')](_0xb192('0x33'),_0x5759c0[_0xb192('0x21')],_0x5759c0[_0xb192('0x22')],_0x5759c0[_0xb192('0x23')],_0x5759c0[_0xb192('0x24')],_0x5759c0['uniqueid']));_0x3beb51[_0xb192('0x25')](_0x124504['finally']['id'],function(_0x31e9ff){try{_0x31e9ff=_0x18b802[_0xb192('0x26')](_0x31e9ff);logger['debug'](_0xb192('0x34'),JSON[_0xb192('0x1b')](_0x31e9ff,null,0x2));if(_0x31e9ff&&_0x18b802[_0x31e9ff[_0xb192('0xd')]]){_0x5de826=_0x18b802[_0x31e9ff['agicommand']](_0x31e9ff);if(_0x5de826){logger[_0xb192('0x19')](_0xb192('0x2c'),inspect(_0x5de826));return _[_0xb192('0x2f')](_0x5de826[_0xb192('0x2d')])?null:_0x5de826['result'][_0xb192('0x30')]();}else{logger[_0xb192('0xa')](_0xb192('0x2c'),inspect(_0x5de826));return null;}}else{logger['error'](_0xb192('0x31'));return null;}}catch(_0x335c5c){logger['error'](_0x335c5c['stack']);return null;}});}logger[_0xb192('0x1f')](util[_0xb192('0x1d')](_0xb192('0x35'),_0x5759c0[_0xb192('0x21')],_0x5759c0[_0xb192('0x22')],_0x5759c0[_0xb192('0x23')],_0x5759c0['dnid'],_0x5759c0['uniqueid']));logger[_0xb192('0x1f')](util['format'](_0xb192('0x36'),_0x5759c0[_0xb192('0x29')],_0x5759c0[_0xb192('0x2a')],parseInt(_0x5759c0[_0xb192('0x2b')],0xa)+0x1));_0x5759c0[_0xb192('0x37')](_0x5759c0[_0xb192('0x29')],_0x5759c0['extension'],parseInt(_0x5759c0[_0xb192('0x2b')],0xa)+0x1);_0x5759c0['close']();}function handleNotFound(_0x5d3fb5){logger[_0xb192('0xa')](util[_0xb192('0x1d')](_0xb192('0x38'),_0x5d3fb5[_0xb192('0x21')]));_0x5d3fb5[_0xb192('0x37')](_0x5d3fb5[_0xb192('0x29')],_0x5d3fb5[_0xb192('0x2a')],parseInt(_0x5d3fb5[_0xb192('0x2b')],0xa)+0x1);_0x5d3fb5[_0xb192('0x39')]();}function handleUnpublished(_0x50e15c){logger[_0xb192('0xa')](util[_0xb192('0x1d')]('Project\x20%s\x20not\x20published',_0x50e15c['arg_1']));_0x50e15c[_0xb192('0x37')](_0x50e15c[_0xb192('0x29')],_0x50e15c[_0xb192('0x2a')],parseInt(_0x50e15c[_0xb192('0x2b')],0xa)+0x1);_0x50e15c[_0xb192('0x39')]();}module[_0xb192('0x3a')]={'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 f9d98b1..d20e532 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 _0x12ae=['_transform','\x0d\x0a\x0d\x0a','_localBuffer','toString','indexOf','substring','length','slice','trim','emit','headers','line','exports','stream','Transform','_inBody','inherits','prototype'];(function(_0x335983,_0x34b20a){var _0x2d281b=function(_0x535693){while(--_0x535693){_0x335983['push'](_0x335983['shift']());}};_0x2d281b(++_0x34b20a);}(_0x12ae,0x175));var _0xe12a=function(_0x24f3d0,_0x197c65){_0x24f3d0=_0x24f3d0-0x0;var _0x3f22ea=_0x12ae[_0x24f3d0];return _0x3f22ea;};'use strict';var util=require('util');var Transform=require(_0xe12a('0x0'))[_0xe12a('0x1')];function AGIReply(_0x59fc5a){Transform['call'](this,_0x59fc5a);this['_localBuffer']='';this[_0xe12a('0x2')]=![];}util[_0xe12a('0x3')](AGIReply,Transform);AGIReply[_0xe12a('0x4')][_0xe12a('0x5')]=function(_0x2c1744,_0x5a2c91,_0x334f17){var _0xca8264='\x0a',_0x296caf=['\x0a\x0a',_0xe12a('0x6')],_0x39a0d3=-0x1,_0x234fa5=-0x1,_0x23503e='',_0x15750a=0x0,_0x5bd523='',_0x5155af='';this[_0xe12a('0x7')]+=_0x2c1744[_0xe12a('0x8')]();_0x5bd523=this[_0xe12a('0x7')];if(!this[_0xe12a('0x2')]){_0x15750a=0x0;while(_0x296caf[_0x15750a]){while((_0x234fa5=_0x5bd523[_0xe12a('0x9')](_0x296caf[_0x15750a]))!=-0x1){_0x23503e=_0x296caf[_0x15750a];_0x5155af=_0x5bd523[_0xe12a('0xa')](0x0,_0x234fa5);_0x5bd523=_0x5bd523[_0xe12a('0xa')](_0x234fa5+_0x23503e[_0xe12a('0xb')]);var _0x4817ec=_0x5155af['split'](_0xca8264),_0x2ce9c7=0x0,_0x2592c2={},_0x5cbb82='',_0x47442c='',_0x2f0205=-0x1;while(_0x4817ec[_0x2ce9c7]){_0x2f0205=_0x4817ec[_0x2ce9c7][_0xe12a('0x9')](':');if(_0x2f0205!=-0x1){_0x5cbb82=_0x4817ec[_0x2ce9c7][_0xe12a('0xc')](0x0,_0x2f0205)['trim']();_0x47442c=_0x4817ec[_0x2ce9c7][_0xe12a('0xc')](_0x2f0205+0x1)[_0xe12a('0xd')]();if(_0x5cbb82[_0xe12a('0xb')]>0x0){_0x2592c2[_0x5cbb82]=_0x47442c;}}else{}_0x2ce9c7++;}this[_0xe12a('0xe')](_0xe12a('0xf'),_0x2592c2);this['_inBody']=!![];}_0x15750a++;}this[_0xe12a('0x7')]=_0x5bd523;}else{while((_0x39a0d3=_0x5bd523['indexOf'](_0xca8264))!=-0x1){_0x5155af=_0x5bd523[_0xe12a('0xa')](0x0,_0x39a0d3);this['emit'](_0xe12a('0x10'),_0x5155af);_0x5bd523=_0x5bd523[_0xe12a('0xa')](_0x39a0d3+_0xca8264[_0xe12a('0xb')]);}this['_localBuffer']=_0x5bd523;}_0x334f17();};module[_0xe12a('0x11')]=AGIReply; \ No newline at end of file +var _0xb1b9=['emit','headers','line','exports','util','Transform','_localBuffer','prototype','_transform','_inBody','indexOf','substring','length','split','slice','trim'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0xb1b9,0x64));var _0x9b1b=function(_0x38867f,_0x1e0ec7){_0x38867f=_0x38867f-0x0;var _0x41c3f0=_0xb1b9[_0x38867f];return _0x41c3f0;};'use strict';var util=require(_0x9b1b('0x0'));var Transform=require('stream')[_0x9b1b('0x1')];function AGIReply(_0x3e8c36){Transform['call'](this,_0x3e8c36);this[_0x9b1b('0x2')]='';this['_inBody']=![];}util['inherits'](AGIReply,Transform);AGIReply[_0x9b1b('0x3')][_0x9b1b('0x4')]=function(_0x19585c,_0x46ad0e,_0x50964e){var _0x48e807='\x0a',_0x28ec9d=['\x0a\x0a','\x0d\x0a\x0d\x0a'],_0x4592bb=-0x1,_0x102890=-0x1,_0x2ad282='',_0x12246d=0x0,_0x186f6a='',_0x550b1f='';this['_localBuffer']+=_0x19585c['toString']();_0x186f6a=this[_0x9b1b('0x2')];if(!this[_0x9b1b('0x5')]){_0x12246d=0x0;while(_0x28ec9d[_0x12246d]){while((_0x102890=_0x186f6a[_0x9b1b('0x6')](_0x28ec9d[_0x12246d]))!=-0x1){_0x2ad282=_0x28ec9d[_0x12246d];_0x550b1f=_0x186f6a[_0x9b1b('0x7')](0x0,_0x102890);_0x186f6a=_0x186f6a['substring'](_0x102890+_0x2ad282[_0x9b1b('0x8')]);var _0x18c3ba=_0x550b1f[_0x9b1b('0x9')](_0x48e807),_0x49831f=0x0,_0x4d446c={},_0xbed86='',_0x4290e6='',_0x523323=-0x1;while(_0x18c3ba[_0x49831f]){_0x523323=_0x18c3ba[_0x49831f]['indexOf'](':');if(_0x523323!=-0x1){_0xbed86=_0x18c3ba[_0x49831f][_0x9b1b('0xa')](0x0,_0x523323)[_0x9b1b('0xb')]();_0x4290e6=_0x18c3ba[_0x49831f][_0x9b1b('0xa')](_0x523323+0x1)['trim']();if(_0xbed86[_0x9b1b('0x8')]>0x0){_0x4d446c[_0xbed86]=_0x4290e6;}}else{}_0x49831f++;}this[_0x9b1b('0xc')](_0x9b1b('0xd'),_0x4d446c);this[_0x9b1b('0x5')]=!![];}_0x12246d++;}this[_0x9b1b('0x2')]=_0x186f6a;}else{while((_0x4592bb=_0x186f6a[_0x9b1b('0x6')](_0x48e807))!=-0x1){_0x550b1f=_0x186f6a['substring'](0x0,_0x4592bb);this[_0x9b1b('0xc')](_0x9b1b('0xe'),_0x550b1f);_0x186f6a=_0x186f6a[_0x9b1b('0x7')](_0x4592bb+_0x48e807[_0x9b1b('0x8')]);}this[_0x9b1b('0x2')]=_0x186f6a;}_0x50964e();};module[_0x9b1b('0xf')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 27633b3..9c94246 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 _0x740a=['getContactByPhone','getTrunkById','ShowTrunk','save_name','getIntervalById','ShowInterval','Interval','Intervals','getSmsAccountById','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','createSquareReport','merge','arg_1','arg_2','format','createSquareRecording','CreateSquareRecording','createSquareMessage','createCmContact','phone','then','CreateCmContact','getPauseById','agentLogin','LoginUser','agentPause','agentUnpause','agentLogout','LogoutUser','lodash','moment','jayson/promise','client','http','request','error','message','result','catch','getSquareProjects','name','production','getSquareProject','ShowSquareProject','MailServerOut','Smtp','CloudProvider','getVoiceQueueById','ShowVoiceQueue','getVariableById','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','ShowUser'];(function(_0x3df788,_0x1e0043){var _0x3db3ef=function(_0x4be904){while(--_0x4be904){_0x3df788['push'](_0x3df788['shift']());}};_0x3db3ef(++_0x1e0043);}(_0x740a,0x175));var _0xa740=function(_0x46f509,_0x11b011){_0x46f509=_0x46f509-0x0;var _0x19ff66=_0x740a[_0x46f509];return _0x19ff66;};'use strict';var _=require(_0xa740('0x0'));var moment=require(_0xa740('0x1'));var jayson=require(_0xa740('0x2'));var client=jayson[_0xa740('0x3')][_0xa740('0x4')]({'port':0x2329});function request(_0x2e7f6c,_0x23caee){return new Promise(function(_0xd73d1e,_0x4e3da6){return client[_0xa740('0x5')](_0x2e7f6c,_0x23caee)['then'](function(_0x58e749){if(_0x58e749[_0xa740('0x6')]){return _0x4e3da6(_0x58e749[_0xa740('0x6')][_0xa740('0x7')]);}else{return _0xd73d1e(_0x58e749[_0xa740('0x8')]);}})[_0xa740('0x9')](function(_0x74b3cd){return _0x4e3da6(_0x74b3cd);});});}exports[_0xa740('0xa')]=function(){return request('GetSquareProjects',{'options':{'raw':![],'attributes':['id',_0xa740('0xb'),_0xa740('0xc')]}});};exports[_0xa740('0xd')]=function(_0x21705e){return request(_0xa740('0xe'),{'options':{'raw':![],'where':{'name':_0x21705e},'attributes':['production']}});};exports['getMailAccountById']=function(_0x5d1f12){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x5d1f12},'include':[{'model':_0xa740('0xf'),'as':_0xa740('0x10'),'include':[{'model':_0xa740('0x11'),'as':_0xa740('0x11')}]}],'attributes':['id','name','email'],'smtp':!![]}});};exports['getSquareProjectById']=function(_0x1dcb1f){return request(_0xa740('0xe'),{'options':{'where':{'id':_0x1dcb1f},'attributes':[_0xa740('0xb')]}});};exports[_0xa740('0x12')]=function(_0x1df901){return request(_0xa740('0x13'),{'options':{'where':{'id':_0x1df901},'attributes':[_0xa740('0xb')]}});};exports[_0xa740('0x14')]=function(_0x276d26){return request('ShowVariable',{'options':{'where':{'id':_0x276d26},'attributes':['name']}});};exports[_0xa740('0x15')]=function(_0x59fd75){return request(_0xa740('0x16'),{'options':{'where':{'id':_0x59fd75},'attributes':[_0xa740('0x17')]}});};exports[_0xa740('0x18')]=function(_0x19f510){return request(_0xa740('0x19'),{'options':{'where':{'id':_0x19f510},'attributes':[_0xa740('0xb')]}});};exports[_0xa740('0x1a')]=function(_0x35ff22){return request('GetContactByPhone',{'options':{'where':{'phone':_0x35ff22['phone']},'attributes':['id']}});};exports[_0xa740('0x1b')]=function(_0x2909d0){return request(_0xa740('0x1c'),{'options':{'where':{'id':_0x2909d0},'attributes':[_0xa740('0xb')]}});};exports['getSoundById']=function(_0x3c9b48){return request('ShowSound',{'options':{'where':{'id':_0x3c9b48},'attributes':[_0xa740('0x1d')]}});};exports[_0xa740('0x1e')]=function(_0x3c2bcb){return request(_0xa740('0x1f'),{'options':{'raw':![],'where':{'id':_0x3c2bcb},'include':[{'model':_0xa740('0x20'),'as':_0xa740('0x21')}]}});};exports[_0xa740('0x22')]=function(_0xb6ecca){return request('ShowSmsAccount',{'options':{'where':{'id':_0xb6ecca},'attributes':['id',_0xa740('0xb')]}});};exports[_0xa740('0x23')]=function(_0x40b0f6){return request(_0xa740('0x24'),{'body':_0x40b0f6});};exports[_0xa740('0x25')]=function(_0x53d329){return request('CreateSquareDetailsReport',{'body':_0x53d329});};exports[_0xa740('0x26')]=function(_0x4991aa){return request('CreateSquareReport',{'body':_[_0xa740('0x27')](_0x4991aa,{'project_name':_0x4991aa[_0xa740('0x28')],'prev_project_name':_0x4991aa['arg_2']||'','is_subproject':_0x4991aa[_0xa740('0x29')]?!![]:![],'leaveAt':moment()[_0xa740('0x2a')]('YYYY-MM-DD\x20HH:mm:ss')})});};exports[_0xa740('0x2b')]=function(_0x391b9d){return request(_0xa740('0x2c'),{'body':_0x391b9d});};exports[_0xa740('0x2d')]=function(_0x5555db){return request('CreateSquareMessage',{'body':_0x5555db});};exports[_0xa740('0x2e')]=function(_0x228d88){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x228d88[_0xa740('0x2f')],'ListId':_0x228d88['ListId']}}})[_0xa740('0x30')](function(_0x1b15c1){if(_0x1b15c1){return _0x1b15c1;}return request(_0xa740('0x31'),{'body':_0x228d88});});};exports[_0xa740('0x32')]=function(_0x944557){return request('ShowPause',{'options':{'where':{'id':_0x944557},'attributes':['name']}});};exports[_0xa740('0x33')]=function(_0x13cdfc,_0x34b7ea){return request(_0xa740('0x34'),{'body':{'interface':_0x34b7ea},'options':{'where':_0x13cdfc}});};exports[_0xa740('0x35')]=function(_0x48a1b2,_0x2f12b3,_0x3d1fc1){return request('PauseUser',{'body':{'type':_0x2f12b3,'uniqueid':_0x3d1fc1},'options':{'where':_0x48a1b2}});};exports[_0xa740('0x36')]=function(_0x452da9){return request('UnpauseUser',{'body':{},'options':{'where':_0x452da9}});};exports[_0xa740('0x37')]=function(_0x3d5829){return request(_0xa740('0x38'),{'body':{},'options':{'where':_0x3d5829}});}; \ No newline at end of file +var _0x45d1=['getTrunkById','ShowTrunk','getSoundById','save_name','getIntervalById','getSmsAccountById','ShowSmsAccount','CreateSmsMessage','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createCmContact','ShowCmHopper','phone','ListId','CreateCmContact','agentLogin','LoginUser','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','lodash','moment','client','http','request','then','error','message','result','catch','name','production','getSquareProject','ShowSquareProject','getMailAccountById','ShowMailAccount','MailServerOut','CloudProvider','email','getSquareProjectById','ShowVoiceQueue','ShowVariable','getSquareOdbcById','dsn','getUserById','getContactByPhone','GetContactByPhone'];(function(_0x36df24,_0x35e373){var _0x339584=function(_0x4b9097){while(--_0x4b9097){_0x36df24['push'](_0x36df24['shift']());}};_0x339584(++_0x35e373);}(_0x45d1,0x1cb));var _0x145d=function(_0x1a7e4b,_0x2fbd40){_0x1a7e4b=_0x1a7e4b-0x0;var _0x37a8fd=_0x45d1[_0x1a7e4b];return _0x37a8fd;};'use strict';var _=require(_0x145d('0x0'));var moment=require(_0x145d('0x1'));var jayson=require('jayson/promise');var client=jayson[_0x145d('0x2')][_0x145d('0x3')]({'port':0x2329});function request(_0x4f5dd4,_0x22f728){return new Promise(function(_0x55eb4e,_0x3076c2){return client[_0x145d('0x4')](_0x4f5dd4,_0x22f728)[_0x145d('0x5')](function(_0x211a9d){if(_0x211a9d[_0x145d('0x6')]){return _0x3076c2(_0x211a9d[_0x145d('0x6')][_0x145d('0x7')]);}else{return _0x55eb4e(_0x211a9d[_0x145d('0x8')]);}})[_0x145d('0x9')](function(_0x47eadc){return _0x3076c2(_0x47eadc);});});}exports['getSquareProjects']=function(){return request('GetSquareProjects',{'options':{'raw':![],'attributes':['id',_0x145d('0xa'),_0x145d('0xb')]}});};exports[_0x145d('0xc')]=function(_0x583865){return request(_0x145d('0xd'),{'options':{'raw':![],'where':{'name':_0x583865},'attributes':['production']}});};exports[_0x145d('0xe')]=function(_0x470c3e){return request(_0x145d('0xf'),{'options':{'raw':![],'where':{'id':_0x470c3e},'include':[{'model':_0x145d('0x10'),'as':'Smtp','include':[{'model':_0x145d('0x11'),'as':_0x145d('0x11')}]}],'attributes':['id','name',_0x145d('0x12')],'smtp':!![]}});};exports[_0x145d('0x13')]=function(_0x45577b){return request(_0x145d('0xd'),{'options':{'where':{'id':_0x45577b},'attributes':['name']}});};exports['getVoiceQueueById']=function(_0x100e7d){return request(_0x145d('0x14'),{'options':{'where':{'id':_0x100e7d},'attributes':[_0x145d('0xa')]}});};exports['getVariableById']=function(_0x24eaa2){return request(_0x145d('0x15'),{'options':{'where':{'id':_0x24eaa2},'attributes':[_0x145d('0xa')]}});};exports[_0x145d('0x16')]=function(_0xf4ff35){return request('ShowSquareOdbc',{'options':{'where':{'id':_0xf4ff35},'attributes':[_0x145d('0x17')]}});};exports[_0x145d('0x18')]=function(_0x2f2353){return request('ShowUser',{'options':{'where':{'id':_0x2f2353},'attributes':[_0x145d('0xa')]}});};exports[_0x145d('0x19')]=function(_0x197b53){return request(_0x145d('0x1a'),{'options':{'where':{'phone':_0x197b53['phone']},'attributes':['id']}});};exports[_0x145d('0x1b')]=function(_0x295918){return request(_0x145d('0x1c'),{'options':{'where':{'id':_0x295918},'attributes':['name']}});};exports[_0x145d('0x1d')]=function(_0x46fbd8){return request('ShowSound',{'options':{'where':{'id':_0x46fbd8},'attributes':[_0x145d('0x1e')]}});};exports[_0x145d('0x1f')]=function(_0x21b57f){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x21b57f},'include':[{'model':'Interval','as':'Intervals'}]}});};exports[_0x145d('0x20')]=function(_0x11bf8b){return request(_0x145d('0x21'),{'options':{'where':{'id':_0x11bf8b},'attributes':['id',_0x145d('0xa')]}});};exports['createSmsMessage']=function(_0x1a6cd2){return request(_0x145d('0x22'),{'body':_0x1a6cd2});};exports['createSquareDetailsReport']=function(_0x869b49){return request('CreateSquareDetailsReport',{'body':_0x869b49});};exports['createSquareReport']=function(_0xe1390f){return request('CreateSquareReport',{'body':_[_0x145d('0x23')](_0xe1390f,{'project_name':_0xe1390f[_0x145d('0x24')],'prev_project_name':_0xe1390f[_0x145d('0x25')]||'','is_subproject':_0xe1390f[_0x145d('0x25')]?!![]:![],'leaveAt':moment()[_0x145d('0x26')](_0x145d('0x27'))})});};exports[_0x145d('0x28')]=function(_0x5dbccb){return request(_0x145d('0x29'),{'body':_0x5dbccb});};exports['createSquareMessage']=function(_0x1f1557){return request('CreateSquareMessage',{'body':_0x1f1557});};exports[_0x145d('0x2a')]=function(_0x571909){return request(_0x145d('0x2b'),{'options':{'raw':![],'where':{'phone':_0x571909[_0x145d('0x2c')],'ListId':_0x571909[_0x145d('0x2d')]}}})[_0x145d('0x5')](function(_0x19757f){if(_0x19757f){return _0x19757f;}return request(_0x145d('0x2e'),{'body':_0x571909});});};exports['getPauseById']=function(_0x5d73e5){return request('ShowPause',{'options':{'where':{'id':_0x5d73e5},'attributes':[_0x145d('0xa')]}});};exports[_0x145d('0x2f')]=function(_0x22ebaa,_0xac4fd4){return request(_0x145d('0x30'),{'body':{'interface':_0xac4fd4},'options':{'where':_0x22ebaa}});};exports['agentPause']=function(_0x5af47f,_0x50fb6c,_0x43ca25){return request(_0x145d('0x31'),{'body':{'type':_0x50fb6c,'uniqueid':_0x43ca25},'options':{'where':_0x5af47f}});};exports[_0x145d('0x32')]=function(_0x9d99fe){return request(_0x145d('0x33'),{'body':{},'options':{'where':_0x9d99fe}});};exports[_0x145d('0x34')]=function(_0x4546e4){return request(_0x145d('0x35'),{'body':{},'options':{'where':_0x4546e4}});}; \ 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 862a403..ac13b10 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 _0x8585=['exports','./polly','./lex'];(function(_0x1f1733,_0x7f67cd){var _0x4ed2f3=function(_0x5280aa){while(--_0x5280aa){_0x1f1733['push'](_0x1f1733['shift']());}};_0x4ed2f3(++_0x7f67cd);}(_0x8585,0x64));var _0x5858=function(_0x345a34,_0x17591e){_0x345a34=_0x345a34-0x0;var _0xf1a016=_0x8585[_0x345a34];return _0xf1a016;};var polly=require(_0x5858('0x0'));var lex=require(_0x5858('0x1'));module[_0x5858('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0xbacd=['./lex','./polly'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xbacd,0x1c5));var _0xdbac=function(_0x2089ec,_0x57b828){_0x2089ec=_0x2089ec-0x0;var _0x5698b9=_0xbacd[_0x2089ec];return _0x5698b9;};var polly=require(_0xdbac('0x0'));var lex=require(_0xdbac('0x1'));module['exports']={'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 a9ec881..ccba7a2 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. * // * * // ************************************************************************* -'use strict';var lex=require('./lib/api');module['exports']=function(_0x2c1d27,_0x4c4c00,_0x4b5765,_0x29e4c8,_0x110824,_0x394a1e){return lex(_0x2c1d27,_0x4c4c00,_0x4b5765,_0x29e4c8,_0x110824,_0x394a1e);}; \ No newline at end of file +var _0x6c76=['./lib/api','exports'];(function(_0x41c96c,_0x5df7cb){var _0x5a2565=function(_0xa3d120){while(--_0xa3d120){_0x41c96c['push'](_0x41c96c['shift']());}};_0x5a2565(++_0x5df7cb);}(_0x6c76,0x184));var _0x66c7=function(_0x5971ca,_0x54b79a){_0x5971ca=_0x5971ca-0x0;var _0x46c0b6=_0x6c76[_0x5971ca];return _0x46c0b6;};'use strict';var lex=require(_0x66c7('0x0'));module[_0x66c7('0x1')]=function(_0x10a050,_0x55604c,_0x203e75,_0xd49f21,_0x519756,_0x572a2b){return lex(_0x10a050,_0x55604c,_0x203e75,_0xd49f21,_0x519756,_0x572a2b);}; \ 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 98c7a06..44308b6 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(_0x56b77f,_0x5ce63c){var _0x43cd96=function(_0x3efd12){while(--_0x3efd12){_0x56b77f['push'](_0x56b77f['shift']());}};_0x43cd96(++_0x5ce63c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xa9e0[_0x56482c];return _0x5aae7a;};'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(_0x501265,_0x58d0bb){var _0x4b59b6=function(_0x1855f7){while(--_0x1855f7){_0x501265['push'](_0x501265['shift']());}};_0x4b59b6(++_0x58d0bb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xa9e0[_0x47e7cb];return _0x2a8874;};'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 964972a..f7f6417 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 _0x14bf=['exports','./lib/api'];(function(_0x2601b4,_0x315e78){var _0x3e3661=function(_0x13b45b){while(--_0x13b45b){_0x2601b4['push'](_0x2601b4['shift']());}};_0x3e3661(++_0x315e78);}(_0x14bf,0x75));var _0xf14b=function(_0x5886ba,_0x1a49bc){_0x5886ba=_0x5886ba-0x0;var _0x20c127=_0x14bf[_0x5886ba];return _0x20c127;};'use strict';var polly=require(_0xf14b('0x0'));module[_0xf14b('0x1')]=function(_0x30cf4e,_0x28d79f,_0x3cffc7,_0x16f415,_0x33e7cb,_0x3dcfd0,_0x1a22f7){return polly(_0x30cf4e,_0x28d79f,_0x3cffc7,_0x16f415,_0x33e7cb,_0x3dcfd0,_0x1a22f7);}; \ No newline at end of file +var _0x81cc=['exports','./lib/api'];(function(_0xe26f14,_0x2c5710){var _0x204593=function(_0x49baa5){while(--_0x49baa5){_0xe26f14['push'](_0xe26f14['shift']());}};_0x204593(++_0x2c5710);}(_0x81cc,0x1d5));var _0xc81c=function(_0xb654c9,_0xa7baea){_0xb654c9=_0xb654c9-0x0;var _0x3c97bc=_0x81cc[_0xb654c9];return _0x3c97bc;};'use strict';var polly=require(_0xc81c('0x0'));module[_0xc81c('0x1')]=function(_0x3de810,_0x4c8b75,_0x1e3977,_0x1aac0b,_0x4e8aa2,_0x59ed9c,_0x1df51f){return polly(_0x3de810,_0x4c8b75,_0x1e3977,_0x1aac0b,_0x4e8aa2,_0x59ed9c,_0x1df51f);}; \ 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 b6b3aec..63e8ec0 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 _0x5fd6=['Polly','mp3','bluebird','randomstring','aws-sdk','synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports'];(function(_0x5d547f,_0x50a029){var _0x66efe3=function(_0x53d84f){while(--_0x53d84f){_0x5d547f['push'](_0x5d547f['shift']());}};_0x66efe3(++_0x50a029);}(_0x5fd6,0x1db));var _0x65fd=function(_0x2dac8c,_0xb33255){_0x2dac8c=_0x2dac8c-0x0;var _0x1ab6bd=_0x5fd6[_0x2dac8c];return _0x1ab6bd;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require(_0x65fd('0x0'));var rs=require(_0x65fd('0x1'));var AWS=require(_0x65fd('0x2'));function pollyResult(_0x55dbd9,_0x574a92,_0x5914b1){return new BPromise(function(_0x4cf625,_0x42c6fe){_0x55dbd9[_0x65fd('0x3')](_0x574a92,function(_0x4fe9fc,_0x53c369){if(_0x4fe9fc){_0x42c6fe(_0x4fe9fc);}else if(_0x53c369){if(_0x53c369[_0x65fd('0x4')]instanceof Buffer){fs[_0x65fd('0x5')](_0x5914b1,_0x53c369['AudioStream'],function(_0x4d96ee){if(_0x4d96ee){_0x42c6fe(_0x4d96ee);}else{_0x4cf625();}});}else{_0x42c6fe(new Error(_0x65fd('0x6')));}}else{_0x42c6fe(new Error(_0x65fd('0x7')));}});});}module[_0x65fd('0x8')]=function(_0x303f82,_0x3b2ce8,_0x3b197b,_0x43eadf,_0x56dbda,_0x3c7f4c,_0x409e9e){var _0xd244dd=new AWS[(_0x65fd('0x9'))]({'accessKeyId':_0x303f82,'secretAccessKey':_0x3b2ce8,'region':_0x3b197b});var _0x102f56={'Text':_0x56dbda,'TextType':_0x3c7f4c||'text','OutputFormat':_0x65fd('0xa'),'VoiceId':_0x43eadf};return pollyResult(_0xd244dd,_0x102f56,_0x409e9e);}; \ No newline at end of file +var _0x9594=['path','bluebird','randomstring','aws-sdk','synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','mp3'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9594,0x8f));var _0x4959=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0x9594[_0x298ed3];return _0x5aad28;};'use strict';var fs=require('fs');var path=require(_0x4959('0x0'));var BPromise=require(_0x4959('0x1'));var rs=require(_0x4959('0x2'));var AWS=require(_0x4959('0x3'));function pollyResult(_0x5a6cd8,_0x3d1e84,_0x133551){return new BPromise(function(_0x2e8ce8,_0x1b882e){_0x5a6cd8[_0x4959('0x4')](_0x3d1e84,function(_0x142746,_0x30ce09){if(_0x142746){_0x1b882e(_0x142746);}else if(_0x30ce09){if(_0x30ce09[_0x4959('0x5')]instanceof Buffer){fs[_0x4959('0x6')](_0x133551,_0x30ce09[_0x4959('0x5')],function(_0x252d8c){if(_0x252d8c){_0x1b882e(_0x252d8c);}else{_0x2e8ce8();}});}else{_0x1b882e(new Error(_0x4959('0x7')));}}else{_0x1b882e(new Error(_0x4959('0x8')));}});});}module[_0x4959('0x9')]=function(_0x48af17,_0x35fcf7,_0x348a0f,_0x3f8af7,_0x3fb9fb,_0xc09370,_0x215903){var _0x12c981=new AWS[(_0x4959('0xa'))]({'accessKeyId':_0x48af17,'secretAccessKey':_0x35fcf7,'region':_0x348a0f});var _0x26d179={'Text':_0x3fb9fb,'TextType':_0xc09370||_0x4959('0xb'),'OutputFormat':_0x4959('0xc'),'VoiceId':_0x3f8af7};return pollyResult(_0x12c981,_0x26d179,_0x215903);}; \ 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 bf4b14e..8c2d0c9 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 _0xd221=['./lib/api'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0xd221,0x178));var _0x1d22=function(_0x13bb7a,_0x56e931){_0x13bb7a=_0x13bb7a-0x0;var _0x517d05=_0xd221[_0x13bb7a];return _0x517d05;};'use strict';var asr=require(_0x1d22('0x0'));module['exports']=function(_0x603ac5,_0x514192,_0x1d0cbd,_0x3870f9){return asr(_0x603ac5,_0x514192,_0x1d0cbd);}; \ No newline at end of file +var _0x4020=['exports','./lib/api'];(function(_0x487496,_0x249683){var _0x539dc8=function(_0x2c38e1){while(--_0x2c38e1){_0x487496['push'](_0x487496['shift']());}};_0x539dc8(++_0x249683);}(_0x4020,0x123));var _0x0402=function(_0x55b6f8,_0x2e3831){_0x55b6f8=_0x55b6f8-0x0;var _0x2b52c4=_0x4020[_0x55b6f8];return _0x2b52c4;};'use strict';var asr=require(_0x0402('0x0'));module[_0x0402('0x1')]=function(_0x865435,_0x276b94,_0x310c78,_0x51cd72){return asr(_0x865435,_0x276b94,_0x310c78);}; \ 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 17a100c..9234fe2 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 _0x7794=['string','length','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','POST','/v1/speech:recognize?key=','LINEAR16','8000','bluebird','https://speech.googleapis.com','exports'];(function(_0x52f1ed,_0x5bf03a){var _0x56b8d6=function(_0x1a403d){while(--_0x1a403d){_0x52f1ed['push'](_0x52f1ed['shift']());}};_0x56b8d6(++_0x5bf03a);}(_0x7794,0x7b));var _0x4779=function(_0x48611c,_0x180498){_0x48611c=_0x48611c-0x0;var _0x1adbe0=_0x7794[_0x48611c];return _0x1adbe0;};'use strict';var url=require('url');var BPromise=require(_0x4779('0x0'));var fs=require('fs');var host=_0x4779('0x1');module[_0x4779('0x2')]=function(_0xa47992,_0x493318,_0x309b79){return new BPromise(function(_0x1e9fdc,_0x4d3b05){var _0x40e5f9;if(typeof _0xa47992!=='string'||_0xa47992['length']===0x0){return _0x4d3b05('filepath\x20should\x20be\x20a\x20string');}if(typeof _0x493318!==_0x4779('0x3')||_0x493318[_0x4779('0x4')]===0x0){return _0x4d3b05('key\x20should\x20be\x20a\x20string');}if(typeof _0x309b79!==_0x4779('0x5')&&(typeof _0x309b79!==_0x4779('0x3')||_0x309b79[_0x4779('0x4')]===0x0)){return _0x4d3b05(_0x4779('0x6'));}try{_0x40e5f9=fs[_0x4779('0x7')](_0xa47992)[_0x4779('0x8')](_0x4779('0x9'));}catch(_0x5e4992){return _0x4d3b05(_0x5e4992);}return _0x1e9fdc({'method':_0x4779('0xa'),'uri':host+_0x4779('0xb')+_0x493318,'body':{'config':{'encoding':_0x4779('0xc'),'sampleRateHertz':_0x4779('0xd'),'languageCode':_0x309b79},'audio':{'content':_0x40e5f9}},'json':!![]});});}; \ No newline at end of file +var _0x2dae=['https://speech.googleapis.com','exports','string','length','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString','POST','/v1/speech:recognize?key=','LINEAR16','8000','url'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2dae,0xc3));var _0xe2da=function(_0x2265da,_0xfbbd2e){_0x2265da=_0x2265da-0x0;var _0x430c2b=_0x2dae[_0x2265da];return _0x430c2b;};'use strict';var url=require(_0xe2da('0x0'));var BPromise=require('bluebird');var fs=require('fs');var host=_0xe2da('0x1');module[_0xe2da('0x2')]=function(_0xcd0055,_0x167432,_0x99b46f){return new BPromise(function(_0x481d97,_0x25b9f2){var _0x439b5d;if(typeof _0xcd0055!==_0xe2da('0x3')||_0xcd0055[_0xe2da('0x4')]===0x0){return _0x25b9f2('filepath\x20should\x20be\x20a\x20string');}if(typeof _0x167432!==_0xe2da('0x3')||_0x167432[_0xe2da('0x4')]===0x0){return _0x25b9f2(_0xe2da('0x5'));}if(typeof _0x99b46f!==_0xe2da('0x6')&&(typeof _0x99b46f!==_0xe2da('0x3')||_0x99b46f[_0xe2da('0x4')]===0x0)){return _0x25b9f2(_0xe2da('0x7'));}try{_0x439b5d=fs[_0xe2da('0x8')](_0xcd0055)[_0xe2da('0x9')]('base64');}catch(_0x52e650){return _0x25b9f2(_0x52e650);}return _0x481d97({'method':_0xe2da('0xa'),'uri':host+_0xe2da('0xb')+_0x167432,'body':{'config':{'encoding':_0xe2da('0xc'),'sampleRateHertz':_0xe2da('0xd'),'languageCode':_0x99b46f},'audio':{'content':_0x439b5d}},'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 162bfa3..921f998 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 _0x7e36=['exports','./asr'];(function(_0x29fc45,_0x1d010b){var _0x512a89=function(_0x3722f2){while(--_0x3722f2){_0x29fc45['push'](_0x29fc45['shift']());}};_0x512a89(++_0x1d010b);}(_0x7e36,0x18d));var _0x67e3=function(_0x1df79c,_0x5ad8fd){_0x1df79c=_0x1df79c-0x0;var _0x2f23e4=_0x7e36[_0x1df79c];return _0x2f23e4;};var asr=require(_0x67e3('0x0'));module[_0x67e3('0x1')]={'asr':asr}; \ No newline at end of file +var _0xd108=['./asr'];(function(_0x34d3c3,_0x122bb9){var _0x19b256=function(_0x409be5){while(--_0x409be5){_0x34d3c3['push'](_0x34d3c3['shift']());}};_0x19b256(++_0x122bb9);}(_0xd108,0x1d4));var _0x8d10=function(_0x436bc5,_0x47b676){_0x436bc5=_0x436bc5-0x0;var _0x3795fc=_0xd108[_0x436bc5];return _0x3795fc;};var asr=require(_0x8d10('0x0'));module['exports']={'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 71e5510..edf1226 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 _0x042a=['text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','.mp3','writeFileSync','goggleTTS\x20path','googleASR','asr','uri','results','alternatives','transcript','join','confidence','googleASR\x20transcription','catch','[%s]\x20%s:%s','name','message','googleDialogflow','result','source','resolvedQuery','action','actionIncomplete','fulfillment','speech','status','code','metadata','endConversation','isFallbackIntent','googleDialogflowV2','SessionsClient','sessionPath','Dialogflow\x20V2\x20response:','queryResult','diagnosticInfo','end_conversation','boolValue','intent','displayName','isFallback','languageCode','responseId','intentDetectionConfidence','fulfillmentText','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','lex','format','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','sestekNDA','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','audiofile','dirName','bluebird','https','md5','path','querystring','request-promise','randomstring','sox','google-tts-api','url','parse','./aws','./google','./sestek','../../../config/logger','agi','protocol','https:','host','WHAT_EVER','get','statusCode','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','finish','info','close','error','unlink','download\x20error','pipe','end','data','error\x20convert','finish\x20to\x20convert','start','resolve','tmp','generate','.wav','base64','then','chmodSync','777','split','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','ssml','input','audioConfig','MP3','text:synthesize','POST','from','audioContent','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','null','slice','length'];(function(_0x44ad7c,_0xcc06a0){var _0x133b32=function(_0x59a40e){while(--_0x59a40e){_0x44ad7c['push'](_0x44ad7c['shift']());}};_0x133b32(++_0xcc06a0);}(_0x042a,0xc6));var _0xa042=function(_0x11061e,_0xa51d9b){_0x11061e=_0x11061e-0x0;var _0xb22e07=_0x042a[_0x11061e];return _0xb22e07;};'use strict';var apiai=require('apiai-promise');var BPromise=require(_0xa042('0x0'));var dialogflow=require('dialogflow');var fs=require('fs');var http=require('http');var https=require(_0xa042('0x1'));var md5=require(_0xa042('0x2'));var path=require(_0xa042('0x3'));var querystring=require(_0xa042('0x4'));var rp=require(_0xa042('0x5'));var rs=require(_0xa042('0x6'));var sox=require(_0xa042('0x7'));var tts=require(_0xa042('0x8'));var urlParse=require(_0xa042('0x9'))[_0xa042('0xa')];var util=require('util');var aws=require(_0xa042('0xb'));var google=require(_0xa042('0xc'));var sestek=require(_0xa042('0xd'));var tilde=require('./tilde');var logger=require(_0xa042('0xe'))(_0xa042('0xf'));var ISPEECH_API='https://api.ispeech.org/api/rest';function downloadFile(_0x5ecd14,_0x17c360){return new BPromise(function(_0x49cbb8,_0xb7116a){var _0xc3362b=urlParse(_0x5ecd14);var _0x5aef70=_0xc3362b[_0xa042('0x10')]===_0xa042('0x11')?https:http;var _0x10871d={'host':_0xc3362b[_0xa042('0x12')],'path':_0xc3362b['path'],'headers':{'user-agent':_0xa042('0x13')}};_0x5aef70[_0xa042('0x14')](_0x10871d,function(_0x73202a){if(_0x73202a[_0xa042('0x15')]!==0xc8){logger['error'](_0xa042('0x16')+_0x5ecd14+_0xa042('0x17')+_0x73202a['statusCode']+'\x20('+_0x73202a[_0xa042('0x18')]+')');_0xb7116a(new Error(_0xa042('0x16')+_0x5ecd14+_0xa042('0x17')+_0x73202a[_0xa042('0x15')]+'\x20('+_0x73202a['statusMessage']+')'));return;}var _0x6b631d=fs['createWriteStream'](_0x17c360);_0x6b631d['on'](_0xa042('0x19'),function(){logger[_0xa042('0x1a')]('finish\x20download\x20file');_0x6b631d[_0xa042('0x1b')](_0x49cbb8);});_0x6b631d['on'](_0xa042('0x1c'),function(_0x580b6a){fs[_0xa042('0x1d')](_0x17c360);logger[_0xa042('0x1c')](_0xa042('0x1e'),_0x580b6a);_0xb7116a(_0x580b6a);});_0x73202a[_0xa042('0x1f')](_0x6b631d);})['on'](_0xa042('0x1c'),function(_0x5c4892){logger[_0xa042('0x1c')](_0x5c4892);_0xb7116a(_0x5c4892);})[_0xa042('0x20')]();});}function uploadFile(_0x1a544a){return new BPromise(function(_0x3e952f,_0x33d295){var _0x4edb9a=urlParse(_0x1a544a);var _0x3cbfe4=_0x4edb9a[_0xa042('0x10')]===_0xa042('0x11')?https:http;var _0xc08a={'host':_0x4edb9a[_0xa042('0x12')],'path':_0x4edb9a[_0xa042('0x3')],'headers':{'user-agent':_0xa042('0x13')}};_0x3cbfe4['get'](_0xc08a,function(_0x223775){if(_0x223775[_0xa042('0x15')]!==0xc8){_0x33d295(new Error(_0xa042('0x16')+_0x1a544a+'\x20failed,\x20status\x20code\x20=\x20'+_0x223775[_0xa042('0x15')]+'\x20('+_0x223775[_0xa042('0x18')]+')'));return;}var _0x55cae0='';_0x223775['on'](_0xa042('0x21'),function(_0x569b1a){_0x55cae0+=_0x569b1a;});_0x223775['on'](_0xa042('0x20'),function(){_0x3e952f(_0x55cae0);});})['on'](_0xa042('0x1c'),function(_0x533263){_0x33d295(_0x533263);})['end']();});}function convertFile(_0x1c5597,_0xfb1027){return new BPromise(function(_0x216c60,_0x49c76d){var _0xdbdf90=sox['transcode'](_0x1c5597,_0xfb1027,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0xdbdf90['on'](_0xa042('0x1c'),function(_0x38a0d6){logger['error'](_0xa042('0x22'),_0x38a0d6);_0x49c76d(_0x38a0d6);});_0xdbdf90['on']('end',function(){logger[_0xa042('0x1a')](_0xa042('0x23'));_0x216c60();});_0xdbdf90[_0xa042('0x24')]();});}function base64Decode(_0x38e735,_0x50235c){var _0xc153c2=path[_0xa042('0x25')](__dirname,_0xa042('0x26'),rs[_0xa042('0x27')](0x4)+_0xa042('0x28'));fs['writeFileSync'](_0xc153c2,_0x38e735,_0xa042('0x29'));return convertFile(_0xc153c2,_0x50235c)[_0xa042('0x2a')](function(){try{fs[_0xa042('0x1d')](_0xc153c2);fs[_0xa042('0x2b')](_0x50235c,_0xa042('0x2c'));}catch(_0x459673){logger['error'](_0x459673);}return _0x50235c[_0xa042('0x2d')]('.')[0x0];});}function base64Encode(_0xc24422){var _0x86b808=fs['readFileSync'](_0xc24422);return new Buffer(_0x86b808)[_0xa042('0x2e')](_0xa042('0x29'));}exports[_0xa042('0x2f')]=function(_0x543d36,_0x17ac0a,_0x3f95a4,_0x432177,_0xf87dbf,_0x23020a){var _0x544f56,_0xbb6051;var _0x28168e=_0xa042('0x30');var _0x170610='?key='+_0x543d36;var _0x58b59d={};if(_0x17ac0a===_0xa042('0x31')){_0x58b59d[_0xa042('0x32')]={'ssml':_0x3f95a4};}else{_0x58b59d[_0xa042('0x32')]={'text':_0x3f95a4};};_0x58b59d['voice']={'languageCode':_0x432177,'ssmlGender':_0xf87dbf};_0x58b59d[_0xa042('0x33')]={'audioEncoding':_0xa042('0x34'),'sampleRateHertz':0x1f40};var _0x4e41df={'url':_0x28168e+_0xa042('0x35')+_0x170610,'method':_0xa042('0x36'),'json':!![],'body':_0x58b59d};return rp(_0x4e41df)[_0xa042('0x2a')](function(_0x532354){return new BPromise(function(_0x4362fc,_0x353076){_0x544f56=path[_0xa042('0x25')](__dirname,_0xa042('0x26'),rs[_0xa042('0x27')](0x4)+'.mp3');var _0xbb6445=Buffer[_0xa042('0x37')](_0x532354[_0xa042('0x38')],_0xa042('0x29'));return fs['writeFile'](_0x544f56,_0xbb6445,function(_0x317b64){_0x353076(_0x317b64);},function(_0x488bda){fs[_0xa042('0x2b')](_0x544f56,_0xa042('0x2c'));_0x4362fc(_0x488bda);});});})[_0xa042('0x2a')](function(_0x246884){_0xbb6051=path[_0xa042('0x25')](__dirname,_0xa042('0x26'),rs['generate'](0x4)+_0xa042('0x28'));return convertFile(_0x544f56,_0xbb6051);})['then'](function(){try{fs[_0xa042('0x1d')](_0x544f56);fs[_0xa042('0x2b')](_0xbb6051,_0xa042('0x2c'));}catch(_0x15c887){logger['error'](_0x15c887);}logger[_0xa042('0x1a')](_0xa042('0x39'),_0xbb6051[_0xa042('0x2d')]('.')[0x0]);return _0xbb6051['split']('.')[0x0];});};exports[_0xa042('0x3a')]=function(_0x261e48,_0x40350c){var _0x3cd462=_0xa042('0x3b');var _0x2c1adb,_0x31d04e;var _0x3ee293;var _0x263de0={'encoding':_0xa042('0x3c'),'method':_0xa042('0x36'),'timeout':0x2710,'url':_0x3cd462,'headers':{'Content-Type':_0xa042('0x3d')},'body':_0xa042('0x3e')+encodeURIComponent(JSON[_0xa042('0x3f')]([[[_0xa042('0x40'),JSON[_0xa042('0x3f')]([_0x261e48,_0x40350c||'en',![],_0xa042('0x41')]),null,'generic']]]))};return rp(_0x263de0)[_0xa042('0x2a')](function(_0x20aae0){try{_0x3ee293=eval(_0x20aae0[_0xa042('0x42')](0x5))[0x0][0x2];}catch(_0x3992cd){throw new Error('parse\x20response\x20failed:\x0a'+_0x20aae0['data']);}if(!_0x3ee293){if(_0x261e48[_0xa042('0x43')]>0xc8){throw new Error(_0xa042('0x44'));}else{throw new Error(_0xa042('0x45')+_0x40350c+_0xa042('0x46'));}}try{_0x3ee293=eval(_0x3ee293)[0x0];}catch(_0x1536f5){throw new Error('parse\x20response\x20failed:\x0a'+res['data']);}const _0x3923b2=_0x3ee293;_0x2c1adb=path[_0xa042('0x25')](__dirname,_0xa042('0x26'),rs[_0xa042('0x27')](0x4)+_0xa042('0x47'));fs[_0xa042('0x48')](_0x2c1adb,_0x3ee293,{'encoding':_0xa042('0x29')});_0x31d04e=path[_0xa042('0x25')](__dirname,_0xa042('0x26'),rs[_0xa042('0x27')](0x4)+_0xa042('0x28'));return convertFile(_0x2c1adb,_0x31d04e);})[_0xa042('0x2a')](function(){try{fs['unlink'](_0x2c1adb);fs[_0xa042('0x2b')](_0x31d04e,_0xa042('0x2c'));}catch(_0x3d2b8b){logger[_0xa042('0x1c')](_0x3d2b8b);}logger[_0xa042('0x1a')](_0xa042('0x49'),_0x31d04e[_0xa042('0x2d')]('.')[0x0]);return _0x31d04e['split']('.')[0x0];});};exports[_0xa042('0x4a')]=function(_0x18e316,_0x411a82,_0x17ded2){return google[_0xa042('0x4b')](_0x18e316,_0x411a82,_0x17ded2)[_0xa042('0x2a')](function(_0x3dd937){logger[_0xa042('0x1a')](_0x3dd937[_0xa042('0x4c')]);return rp(_0x3dd937);})[_0xa042('0x2a')](function(_0xaf474d){var _0xa01ed4='';var _0x237c83=0x0;try{fs['unlink'](_0x18e316);}catch(_0x1d998c){logger[_0xa042('0x1c')](_0x1d998c);}if(_0xaf474d&&_0xaf474d[_0xa042('0x4d')]){_0xa01ed4=_0xaf474d['results']['map'](function(_0x4d5f26){return _0x4d5f26&&_0x4d5f26[_0xa042('0x4e')][0x0]&&_0x4d5f26['alternatives'][0x0][_0xa042('0x4f')]?_0x4d5f26[_0xa042('0x4e')][0x0]['transcript']:'';})[_0xa042('0x50')]('\x0a');_0x237c83=_0xaf474d['results']['map'](function(_0xafea08){return _0xafea08&&_0xafea08[_0xa042('0x4e')][0x0]&&_0xafea08[_0xa042('0x4e')][0x0][_0xa042('0x51')]?_0xafea08[_0xa042('0x4e')][0x0][_0xa042('0x51')]:0x0;})['join']('\x0a');}logger[_0xa042('0x1a')](_0xa042('0x52'),_0xa01ed4);logger[_0xa042('0x1a')]('googleASR\x20confidence',_0x237c83);return{'transcript':_0xa01ed4,'confidence':_0x237c83};})[_0xa042('0x53')](function(_0x171cf1){logger[_0xa042('0x1c')](_0xa042('0x54'),_0x171cf1[_0xa042('0x15')],_0x171cf1[_0xa042('0x55')],_0x171cf1[_0xa042('0x56')]);});};exports[_0xa042('0x57')]=function(_0x41b6e5,_0x4fba22,_0x493666,_0x36447d){var _0x3a7b40=apiai(_0x4fba22,{'language':_0x36447d||'en'});return _0x3a7b40['textRequest'](_0x493666,{'sessionId':md5(_0x41b6e5)})[_0xa042('0x2a')](function(_0xd33503){logger[_0xa042('0x1a')](JSON[_0xa042('0x3f')](_0xd33503));return{'source':_0xd33503[_0xa042('0x58')][_0xa042('0x59')],'resolvedQuery':_0xd33503[_0xa042('0x58')][_0xa042('0x5a')],'action':_0xd33503['result'][_0xa042('0x5b')],'actionIncomplete':_0xd33503[_0xa042('0x58')][_0xa042('0x5c')],'speech':_0xd33503[_0xa042('0x58')][_0xa042('0x5d')][_0xa042('0x5e')],'score':_0xd33503[_0xa042('0x58')]['score'],'statusCode':_0xd33503[_0xa042('0x5f')][_0xa042('0x60')],'endConversation':_0xd33503[_0xa042('0x58')][_0xa042('0x61')][_0xa042('0x62')]||![],'isFallbackIntent':_0xd33503[_0xa042('0x58')][_0xa042('0x61')][_0xa042('0x63')]};});};exports[_0xa042('0x64')]=function(_0x4816b7,_0x289824,_0x3471c0,_0x392872,_0x5951fc,_0x442509){var _0x1d922f=_0x392872['replace'](/\\n/g,'\x0a');var _0x4ba5cb={'credentials':{'private_key':_0x1d922f,'client_email':_0x3471c0}};var _0x2159b6=new dialogflow[(_0xa042('0x65'))](_0x4ba5cb);var _0x31f34c=_0x2159b6[_0xa042('0x66')](_0x289824,md5(_0x4816b7));var _0x29fb24={'session':_0x31f34c,'queryInput':{'text':{'text':_0x5951fc,'languageCode':_0x442509}}};return _0x2159b6['detectIntent'](_0x29fb24)[_0xa042('0x2a')](function(_0x1e98d7){if(_0x1e98d7&&_0x1e98d7['length']){logger[_0xa042('0x1a')](_0xa042('0x67'),JSON[_0xa042('0x3f')](_0x1e98d7));var _0x2cdaf5=_0x1e98d7[0x0];if(_0x2cdaf5){var _0x595a47={'action':_0x2cdaf5[_0xa042('0x68')][_0xa042('0x5b')],'allRequiredParamsPresent':_0x2cdaf5['queryResult']['allRequiredParamsPresent'],'endConversation':_0x2cdaf5[_0xa042('0x68')][_0xa042('0x69')]&&_0x2cdaf5[_0xa042('0x68')][_0xa042('0x69')]['fields']?_0x2cdaf5[_0xa042('0x68')][_0xa042('0x69')]['fields'][_0xa042('0x6a')][_0xa042('0x6b')]:![],'fulfillmentText':_0x2cdaf5['queryResult']['fulfillmentText'],'intentName':_0x2cdaf5[_0xa042('0x68')][_0xa042('0x6c')][_0xa042('0x55')],'intentDisplayName':_0x2cdaf5[_0xa042('0x68')][_0xa042('0x6c')][_0xa042('0x6d')],'isFallbackIntent':_0x2cdaf5[_0xa042('0x68')][_0xa042('0x6c')][_0xa042('0x6e')],'languageCode':_0x2cdaf5['queryResult'][_0xa042('0x6f')],'queryText':_0x2cdaf5[_0xa042('0x68')]['queryText'],'responseId':_0x2cdaf5[_0xa042('0x70')],'score':_0x2cdaf5[_0xa042('0x68')][_0xa042('0x71')],'speech':_0x2cdaf5[_0xa042('0x68')][_0xa042('0x72')],'providerResponse':JSON[_0xa042('0x3f')](_0x1e98d7)};return _0x595a47;}}});};exports[_0xa042('0x73')]=function(_0x3cc532,_0x546508,_0xefa348,_0x5780b6){return tilde[_0xa042('0x4b')](_0x3cc532,_0x546508,_0xefa348,_0x5780b6)['then'](function(_0x3ac982){try{fs[_0xa042('0x1d')](_0x3cc532);}catch(_0xca09b8){logger[_0xa042('0x1c')](_0xca09b8);}logger[_0xa042('0x1a')](_0xa042('0x74'),_0x3ac982['transcript']);logger[_0xa042('0x1a')](_0xa042('0x75'),_0x3ac982[_0xa042('0x51')]);return _0x3ac982;});};exports[_0xa042('0x76')]=function(_0xa19784,_0x504683,_0x14d75b,_0x4bc8b6,_0x48b0d9,_0x10c2f7){var _0x115c19=path[_0xa042('0x25')](__dirname,_0xa042('0x26'),rs[_0xa042('0x27')](0x4)+'.mp3');var _0x1b002b;return aws['polly'](_0xa19784,_0x504683,_0x14d75b,_0x4bc8b6,_0x48b0d9,_0x10c2f7,_0x115c19)[_0xa042('0x2a')](function(){_0x1b002b=path[_0xa042('0x25')](__dirname,_0xa042('0x26'),rs[_0xa042('0x27')](0x4)+_0xa042('0x28'));return convertFile(_0x115c19,_0x1b002b);})[_0xa042('0x2a')](function(){try{fs['unlink'](_0x115c19);fs[_0xa042('0x2b')](_0x1b002b,_0xa042('0x2c'));}catch(_0x4ea402){logger[_0xa042('0x1c')](_0x4ea402);}return _0x1b002b[_0xa042('0x2d')]('.')[0x0];});};exports['awsLex']=function(_0x3968d1,_0x418d75,_0x26c726,_0x17e3c0,_0x4e6d71,_0x3feef4){return aws[_0xa042('0x77')](_0x3968d1,_0x418d75,_0x26c726,_0x17e3c0,_0x4e6d71,_0x3feef4)[_0xa042('0x2a')](function(_0x27da7d){logger[_0xa042('0x1a')](JSON[_0xa042('0x3f')](_0x27da7d));return _0x27da7d;});};exports['ispeechTTS']=function(_0x14b180,_0x100424,_0x53c749,_0x5bef54){var _0x1442b2=util[_0xa042('0x78')]('%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3',ISPEECH_API,_0x14b180,encodeURIComponent(_0x100424),_0x53c749,_0x5bef54);var _0x569a47=path[_0xa042('0x25')](__dirname,_0xa042('0x26'),rs[_0xa042('0x27')](0x4)+_0xa042('0x47'));var _0x2a83c4;return downloadFile(_0x1442b2,_0x569a47)[_0xa042('0x2a')](function(){_0x2a83c4=path[_0xa042('0x25')](__dirname,_0xa042('0x26'),rs[_0xa042('0x27')](0x4)+_0xa042('0x28'));return convertFile(_0x569a47,_0x2a83c4);})[_0xa042('0x2a')](function(){try{fs['unlink'](_0x569a47);fs[_0xa042('0x2b')](_0x2a83c4,'777');}catch(_0x540a54){logger[_0xa042('0x1c')](_0x540a54);}return _0x2a83c4[_0xa042('0x2d')]('.')[0x0];});};exports['ispeechASR']=function(_0x55bb42,_0x561b1c,_0x42cfc0,_0x569f38){var _0x262395=util[_0xa042('0x78')](_0xa042('0x79'),ISPEECH_API,_0x561b1c,_0x42cfc0,base64Encode(_0x55bb42),_0x569f38?util[_0xa042('0x78')](_0xa042('0x7a'),encodeURIComponent(_0x569f38)):_0xa042('0x7b'));return uploadFile(_0x262395)['then'](function(_0x2ff9ac){return querystring[_0xa042('0xa')](_0x2ff9ac);});};exports[_0xa042('0x7c')]=function(_0x5d9c1b,_0x100031){return sestek[_0xa042('0x7d')](_0x5d9c1b,_0x100031)['then'](function(_0x4f1499){logger[_0xa042('0x1a')](JSON[_0xa042('0x3f')](_0x4f1499));var _0xf683ae={'speech':_0x4f1499[_0xa042('0x7e')],'action':_0x4f1499['channelData']?_0x4f1499[_0xa042('0x7f')][_0xa042('0x80')]:undefined,'actiondata':_0x4f1499[_0xa042('0x7f')]?_0x4f1499[_0xa042('0x7f')][_0xa042('0x81')]:undefined};if(_0x4f1499[_0xa042('0x7f')]&&_0x4f1499[_0xa042('0x7f')][_0xa042('0x82')]){return base64Decode(_0x4f1499[_0xa042('0x7f')][_0xa042('0x82')]['Data'],path[_0xa042('0x25')](__dirname,_0xa042('0x26'),rs[_0xa042('0x27')](0x4)+'.wav'))['then'](function(_0x46ae7c){_0xf683ae[_0xa042('0x83')]=_0x46ae7c;return _0xf683ae;});}return _0xf683ae;});};exports[_0xa042('0x84')]=function(){return __dirname;}; \ No newline at end of file +var _0x8752=['unlink','chmodSync','777','split','toString','base64','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','text:synthesize','POST','from','audioContent','writeFile','generate','googleCloudTTS\x20path','utf8','application/x-www-form-urlencoded','stringify','jQ1olc','null','generic','slice','data','length','text\x20length\x20limit\x20reached','lang\x20\x22','parse\x20response\x20failed:\x0a','goggleTTS\x20path','googleASR','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','name','message','googleDialogflow','textRequest','result','source','action','fulfillment','speech','metadata','endConversation','isFallbackIntent','replace','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','fields','diagnosticInfo','end_conversation','boolValue','fulfillmentText','intent','displayName','isFallback','queryText','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','lex','ispeechTTS','format','.mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','sestekNDA','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName','dialogflow','http','https','md5','path','request-promise','randomstring','parse','./aws','./google','./sestek','./tilde','agi','https://api.ispeech.org/api/rest','protocol','https:','host','WHAT_EVER','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','finish','info','finish\x20download\x20file','close','pipe','end','transcode','error\x20convert','finish\x20to\x20convert','start','resolve','tmp','.wav','writeFileSync','then'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8752,0xe7));var _0x2875=function(_0xe92745,_0x5ca465){_0xe92745=_0xe92745-0x0;var _0x5721d8=_0x8752[_0xe92745];return _0x5721d8;};'use strict';var apiai=require('apiai-promise');var BPromise=require('bluebird');var dialogflow=require(_0x2875('0x0'));var fs=require('fs');var http=require(_0x2875('0x1'));var https=require(_0x2875('0x2'));var md5=require(_0x2875('0x3'));var path=require(_0x2875('0x4'));var querystring=require('querystring');var rp=require(_0x2875('0x5'));var rs=require(_0x2875('0x6'));var sox=require('sox');var tts=require('google-tts-api');var urlParse=require('url')[_0x2875('0x7')];var util=require('util');var aws=require(_0x2875('0x8'));var google=require(_0x2875('0x9'));var sestek=require(_0x2875('0xa'));var tilde=require(_0x2875('0xb'));var logger=require('../../../config/logger')(_0x2875('0xc'));var ISPEECH_API=_0x2875('0xd');function downloadFile(_0x2c7245,_0x1b26c9){return new BPromise(function(_0x10c752,_0x3df2e2){var _0x18e7a2=urlParse(_0x2c7245);var _0x159f8e=_0x18e7a2[_0x2875('0xe')]===_0x2875('0xf')?https:http;var _0x204f68={'host':_0x18e7a2[_0x2875('0x10')],'path':_0x18e7a2[_0x2875('0x4')],'headers':{'user-agent':_0x2875('0x11')}};_0x159f8e[_0x2875('0x12')](_0x204f68,function(_0x36e9d9){if(_0x36e9d9[_0x2875('0x13')]!==0xc8){logger[_0x2875('0x14')](_0x2875('0x15')+_0x2c7245+_0x2875('0x16')+_0x36e9d9['statusCode']+'\x20('+_0x36e9d9[_0x2875('0x17')]+')');_0x3df2e2(new Error(_0x2875('0x15')+_0x2c7245+_0x2875('0x16')+_0x36e9d9[_0x2875('0x13')]+'\x20('+_0x36e9d9[_0x2875('0x17')]+')'));return;}var _0x2a480a=fs['createWriteStream'](_0x1b26c9);_0x2a480a['on'](_0x2875('0x18'),function(){logger[_0x2875('0x19')](_0x2875('0x1a'));_0x2a480a[_0x2875('0x1b')](_0x10c752);});_0x2a480a['on'](_0x2875('0x14'),function(_0x1f36ae){fs['unlink'](_0x1b26c9);logger['error']('download\x20error',_0x1f36ae);_0x3df2e2(_0x1f36ae);});_0x36e9d9[_0x2875('0x1c')](_0x2a480a);})['on'](_0x2875('0x14'),function(_0x3aec2d){logger['error'](_0x3aec2d);_0x3df2e2(_0x3aec2d);})['end']();});}function uploadFile(_0x20ff2d){return new BPromise(function(_0x3ca49d,_0x485eb7){var _0x368819=urlParse(_0x20ff2d);var _0x5cccd0=_0x368819['protocol']===_0x2875('0xf')?https:http;var _0x18970f={'host':_0x368819[_0x2875('0x10')],'path':_0x368819[_0x2875('0x4')],'headers':{'user-agent':'WHAT_EVER'}};_0x5cccd0[_0x2875('0x12')](_0x18970f,function(_0x583680){if(_0x583680[_0x2875('0x13')]!==0xc8){_0x485eb7(new Error('request\x20to\x20'+_0x20ff2d+_0x2875('0x16')+_0x583680['statusCode']+'\x20('+_0x583680[_0x2875('0x17')]+')'));return;}var _0x519431='';_0x583680['on']('data',function(_0x1532db){_0x519431+=_0x1532db;});_0x583680['on'](_0x2875('0x1d'),function(){_0x3ca49d(_0x519431);});})['on']('error',function(_0x43c41a){_0x485eb7(_0x43c41a);})[_0x2875('0x1d')]();});}function convertFile(_0x390d09,_0x4bd76b){return new BPromise(function(_0x163f93,_0x47057b){var _0xa060=sox[_0x2875('0x1e')](_0x390d09,_0x4bd76b,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0xa060['on'](_0x2875('0x14'),function(_0x3f91dd){logger['error'](_0x2875('0x1f'),_0x3f91dd);_0x47057b(_0x3f91dd);});_0xa060['on']('end',function(){logger[_0x2875('0x19')](_0x2875('0x20'));_0x163f93();});_0xa060[_0x2875('0x21')]();});}function base64Decode(_0x294ac7,_0x2f9441){var _0xdc8a75=path[_0x2875('0x22')](__dirname,_0x2875('0x23'),rs['generate'](0x4)+_0x2875('0x24'));fs[_0x2875('0x25')](_0xdc8a75,_0x294ac7,'base64');return convertFile(_0xdc8a75,_0x2f9441)[_0x2875('0x26')](function(){try{fs[_0x2875('0x27')](_0xdc8a75);fs[_0x2875('0x28')](_0x2f9441,_0x2875('0x29'));}catch(_0x29ded7){logger['error'](_0x29ded7);}return _0x2f9441[_0x2875('0x2a')]('.')[0x0];});}function base64Encode(_0x639e00){var _0x15e4e8=fs['readFileSync'](_0x639e00);return new Buffer(_0x15e4e8)[_0x2875('0x2b')](_0x2875('0x2c'));}exports[_0x2875('0x2d')]=function(_0x45062e,_0x41a714,_0x1d2e70,_0x32915,_0x42ea97,_0x29e34f){var _0x373c20,_0xc142;var _0x1651cf=_0x2875('0x2e');var _0x3289f6=_0x2875('0x2f')+_0x45062e;var _0x4a456f={};if(_0x41a714===_0x2875('0x30')){_0x4a456f[_0x2875('0x31')]={'ssml':_0x1d2e70};}else{_0x4a456f['input']={'text':_0x1d2e70};};_0x4a456f[_0x2875('0x32')]={'languageCode':_0x32915,'ssmlGender':_0x42ea97};_0x4a456f['audioConfig']={'audioEncoding':'MP3','sampleRateHertz':0x1f40};var _0x154a78={'url':_0x1651cf+_0x2875('0x33')+_0x3289f6,'method':_0x2875('0x34'),'json':!![],'body':_0x4a456f};return rp(_0x154a78)[_0x2875('0x26')](function(_0x4653eb){return new BPromise(function(_0x513a2b,_0x13a620){_0x373c20=path[_0x2875('0x22')](__dirname,_0x2875('0x23'),rs['generate'](0x4)+'.mp3');var _0x28c0cd=Buffer[_0x2875('0x35')](_0x4653eb[_0x2875('0x36')],_0x2875('0x2c'));return fs[_0x2875('0x37')](_0x373c20,_0x28c0cd,function(_0x370aa3){_0x13a620(_0x370aa3);},function(_0x548d96){fs['chmodSync'](_0x373c20,'777');_0x513a2b(_0x548d96);});});})[_0x2875('0x26')](function(_0x7ef56f){_0xc142=path[_0x2875('0x22')](__dirname,_0x2875('0x23'),rs[_0x2875('0x38')](0x4)+_0x2875('0x24'));return convertFile(_0x373c20,_0xc142);})['then'](function(){try{fs[_0x2875('0x27')](_0x373c20);fs['chmodSync'](_0xc142,'777');}catch(_0x22c49d){logger[_0x2875('0x14')](_0x22c49d);}logger[_0x2875('0x19')](_0x2875('0x39'),_0xc142['split']('.')[0x0]);return _0xc142[_0x2875('0x2a')]('.')[0x0];});};exports['googleTTS']=function(_0x5388a9,_0x17f121){var _0x3e1e7a='https://translate.google.com/_/TranslateWebserverUi/data/batchexecute';var _0x345aa4,_0x1e05de;var _0x3ca01e;var _0x564940={'encoding':_0x2875('0x3a'),'method':_0x2875('0x34'),'timeout':0x2710,'url':_0x3e1e7a,'headers':{'Content-Type':_0x2875('0x3b')},'body':'f.req='+encodeURIComponent(JSON[_0x2875('0x3c')]([[[_0x2875('0x3d'),JSON[_0x2875('0x3c')]([_0x5388a9,_0x17f121||'en',![],_0x2875('0x3e')]),null,_0x2875('0x3f')]]]))};return rp(_0x564940)['then'](function(_0x3585d0){try{_0x3ca01e=eval(_0x3585d0[_0x2875('0x40')](0x5))[0x0][0x2];}catch(_0x4c5f01){throw new Error('parse\x20response\x20failed:\x0a'+_0x3585d0[_0x2875('0x41')]);}if(!_0x3ca01e){if(_0x5388a9[_0x2875('0x42')]>0xc8){throw new Error(_0x2875('0x43'));}else{throw new Error(_0x2875('0x44')+_0x17f121+'\x22\x20might\x20not\x20exist');}}try{_0x3ca01e=eval(_0x3ca01e)[0x0];}catch(_0x2f071c){throw new Error(_0x2875('0x45')+res[_0x2875('0x41')]);}const _0x368bb5=_0x3ca01e;_0x345aa4=path['resolve'](__dirname,_0x2875('0x23'),rs[_0x2875('0x38')](0x4)+'.mp3');fs[_0x2875('0x25')](_0x345aa4,_0x3ca01e,{'encoding':'base64'});_0x1e05de=path[_0x2875('0x22')](__dirname,_0x2875('0x23'),rs[_0x2875('0x38')](0x4)+_0x2875('0x24'));return convertFile(_0x345aa4,_0x1e05de);})[_0x2875('0x26')](function(){try{fs[_0x2875('0x27')](_0x345aa4);fs[_0x2875('0x28')](_0x1e05de,_0x2875('0x29'));}catch(_0x15b203){logger[_0x2875('0x14')](_0x15b203);}logger[_0x2875('0x19')](_0x2875('0x46'),_0x1e05de[_0x2875('0x2a')]('.')[0x0]);return _0x1e05de[_0x2875('0x2a')]('.')[0x0];});};exports[_0x2875('0x47')]=function(_0x54b04f,_0x2dc7bc,_0x1fedac){return google[_0x2875('0x48')](_0x54b04f,_0x2dc7bc,_0x1fedac)['then'](function(_0x1078a3){logger[_0x2875('0x19')](_0x1078a3[_0x2875('0x49')]);return rp(_0x1078a3);})[_0x2875('0x26')](function(_0x362054){var _0x53ab20='';var _0x53bf0e=0x0;try{fs[_0x2875('0x27')](_0x54b04f);}catch(_0x59e72a){logger[_0x2875('0x14')](_0x59e72a);}if(_0x362054&&_0x362054[_0x2875('0x4a')]){_0x53ab20=_0x362054[_0x2875('0x4a')][_0x2875('0x4b')](function(_0x3779b6){return _0x3779b6&&_0x3779b6['alternatives'][0x0]&&_0x3779b6[_0x2875('0x4c')][0x0]['transcript']?_0x3779b6[_0x2875('0x4c')][0x0][_0x2875('0x4d')]:'';})[_0x2875('0x4e')]('\x0a');_0x53bf0e=_0x362054[_0x2875('0x4a')][_0x2875('0x4b')](function(_0x4af87c){return _0x4af87c&&_0x4af87c['alternatives'][0x0]&&_0x4af87c[_0x2875('0x4c')][0x0][_0x2875('0x4f')]?_0x4af87c[_0x2875('0x4c')][0x0][_0x2875('0x4f')]:0x0;})[_0x2875('0x4e')]('\x0a');}logger[_0x2875('0x19')](_0x2875('0x50'),_0x53ab20);logger[_0x2875('0x19')](_0x2875('0x51'),_0x53bf0e);return{'transcript':_0x53ab20,'confidence':_0x53bf0e};})[_0x2875('0x52')](function(_0x2e9c53){logger[_0x2875('0x14')]('[%s]\x20%s:%s',_0x2e9c53[_0x2875('0x13')],_0x2e9c53[_0x2875('0x53')],_0x2e9c53[_0x2875('0x54')]);});};exports[_0x2875('0x55')]=function(_0x40304b,_0x13097d,_0x2a7cf3,_0xaafbd7){var _0x1e81bd=apiai(_0x13097d,{'language':_0xaafbd7||'en'});return _0x1e81bd[_0x2875('0x56')](_0x2a7cf3,{'sessionId':md5(_0x40304b)})[_0x2875('0x26')](function(_0x6ab811){logger[_0x2875('0x19')](JSON[_0x2875('0x3c')](_0x6ab811));return{'source':_0x6ab811[_0x2875('0x57')][_0x2875('0x58')],'resolvedQuery':_0x6ab811[_0x2875('0x57')]['resolvedQuery'],'action':_0x6ab811[_0x2875('0x57')][_0x2875('0x59')],'actionIncomplete':_0x6ab811['result']['actionIncomplete'],'speech':_0x6ab811['result'][_0x2875('0x5a')][_0x2875('0x5b')],'score':_0x6ab811['result']['score'],'statusCode':_0x6ab811['status']['code'],'endConversation':_0x6ab811['result'][_0x2875('0x5c')][_0x2875('0x5d')]||![],'isFallbackIntent':_0x6ab811[_0x2875('0x57')][_0x2875('0x5c')][_0x2875('0x5e')]};});};exports['googleDialogflowV2']=function(_0x77dd17,_0xe25daa,_0x512ab5,_0x574735,_0x103986,_0x9a2c5d){var _0x6220ab=_0x574735[_0x2875('0x5f')](/\\n/g,'\x0a');var _0x59e8c4={'credentials':{'private_key':_0x6220ab,'client_email':_0x512ab5}};var _0x3944e4=new dialogflow[(_0x2875('0x60'))](_0x59e8c4);var _0x149f22=_0x3944e4[_0x2875('0x61')](_0xe25daa,md5(_0x77dd17));var _0x529ac1={'session':_0x149f22,'queryInput':{'text':{'text':_0x103986,'languageCode':_0x9a2c5d}}};return _0x3944e4[_0x2875('0x62')](_0x529ac1)[_0x2875('0x26')](function(_0x12c226){if(_0x12c226&&_0x12c226[_0x2875('0x42')]){logger[_0x2875('0x19')](_0x2875('0x63'),JSON[_0x2875('0x3c')](_0x12c226));var _0x400a15=_0x12c226[0x0];if(_0x400a15){var _0x4d4412={'action':_0x400a15[_0x2875('0x64')][_0x2875('0x59')],'allRequiredParamsPresent':_0x400a15[_0x2875('0x64')]['allRequiredParamsPresent'],'endConversation':_0x400a15['queryResult']['diagnosticInfo']&&_0x400a15[_0x2875('0x64')]['diagnosticInfo'][_0x2875('0x65')]?_0x400a15[_0x2875('0x64')][_0x2875('0x66')][_0x2875('0x65')][_0x2875('0x67')][_0x2875('0x68')]:![],'fulfillmentText':_0x400a15['queryResult'][_0x2875('0x69')],'intentName':_0x400a15[_0x2875('0x64')][_0x2875('0x6a')][_0x2875('0x53')],'intentDisplayName':_0x400a15['queryResult'][_0x2875('0x6a')][_0x2875('0x6b')],'isFallbackIntent':_0x400a15[_0x2875('0x64')][_0x2875('0x6a')][_0x2875('0x6c')],'languageCode':_0x400a15['queryResult']['languageCode'],'queryText':_0x400a15[_0x2875('0x64')][_0x2875('0x6d')],'responseId':_0x400a15[_0x2875('0x6e')],'score':_0x400a15['queryResult'][_0x2875('0x6f')],'speech':_0x400a15[_0x2875('0x64')][_0x2875('0x69')],'providerResponse':JSON['stringify'](_0x12c226)};return _0x4d4412;}}});};exports[_0x2875('0x70')]=function(_0x564f28,_0xda696e,_0x3587ba,_0x1a2eb0){return tilde[_0x2875('0x48')](_0x564f28,_0xda696e,_0x3587ba,_0x1a2eb0)['then'](function(_0x2a01d7){try{fs[_0x2875('0x27')](_0x564f28);}catch(_0x357327){logger[_0x2875('0x14')](_0x357327);}logger[_0x2875('0x19')](_0x2875('0x71'),_0x2a01d7[_0x2875('0x4d')]);logger[_0x2875('0x19')](_0x2875('0x72'),_0x2a01d7['confidence']);return _0x2a01d7;});};exports[_0x2875('0x73')]=function(_0x40e2cc,_0x1c96e9,_0x5c8a7a,_0x259ae5,_0x1a7c67,_0x243573){var _0x515542=path[_0x2875('0x22')](__dirname,'tmp',rs[_0x2875('0x38')](0x4)+'.mp3');var _0x494858;return aws[_0x2875('0x74')](_0x40e2cc,_0x1c96e9,_0x5c8a7a,_0x259ae5,_0x1a7c67,_0x243573,_0x515542)[_0x2875('0x26')](function(){_0x494858=path[_0x2875('0x22')](__dirname,_0x2875('0x23'),rs[_0x2875('0x38')](0x4)+'.wav');return convertFile(_0x515542,_0x494858);})[_0x2875('0x26')](function(){try{fs['unlink'](_0x515542);fs['chmodSync'](_0x494858,_0x2875('0x29'));}catch(_0x11fbe7){logger[_0x2875('0x14')](_0x11fbe7);}return _0x494858[_0x2875('0x2a')]('.')[0x0];});};exports[_0x2875('0x75')]=function(_0x98270d,_0x415ce5,_0x4c009e,_0x402836,_0x65f03,_0x9748e6){return aws[_0x2875('0x76')](_0x98270d,_0x415ce5,_0x4c009e,_0x402836,_0x65f03,_0x9748e6)[_0x2875('0x26')](function(_0x3958c6){logger['info'](JSON[_0x2875('0x3c')](_0x3958c6));return _0x3958c6;});};exports[_0x2875('0x77')]=function(_0x41c9a5,_0x5c6d82,_0x10a545,_0x526966){var _0x31b46f=util[_0x2875('0x78')]('%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3',ISPEECH_API,_0x41c9a5,encodeURIComponent(_0x5c6d82),_0x10a545,_0x526966);var _0x360abe=path[_0x2875('0x22')](__dirname,'tmp',rs[_0x2875('0x38')](0x4)+_0x2875('0x79'));var _0x47afe2;return downloadFile(_0x31b46f,_0x360abe)[_0x2875('0x26')](function(){_0x47afe2=path[_0x2875('0x22')](__dirname,_0x2875('0x23'),rs[_0x2875('0x38')](0x4)+_0x2875('0x24'));return convertFile(_0x360abe,_0x47afe2);})[_0x2875('0x26')](function(){try{fs[_0x2875('0x27')](_0x360abe);fs[_0x2875('0x28')](_0x47afe2,'777');}catch(_0x5f37b3){logger[_0x2875('0x14')](_0x5f37b3);}return _0x47afe2['split']('.')[0x0];});};exports[_0x2875('0x7a')]=function(_0x39cc9f,_0x3308c3,_0x36d8ae,_0x5cee59){var _0x1851f1=util['format'](_0x2875('0x7b'),ISPEECH_API,_0x3308c3,_0x36d8ae,base64Encode(_0x39cc9f),_0x5cee59?util[_0x2875('0x78')](_0x2875('0x7c'),encodeURIComponent(_0x5cee59)):'freeform=3');return uploadFile(_0x1851f1)[_0x2875('0x26')](function(_0x2c8d){return querystring['parse'](_0x2c8d);});};exports[_0x2875('0x7d')]=function(_0xfe5529,_0x3b1de2){return sestek[_0x2875('0x7e')](_0xfe5529,_0x3b1de2)['then'](function(_0xd6cb45){logger['info'](JSON[_0x2875('0x3c')](_0xd6cb45));var _0x42f2ab={'speech':_0xd6cb45[_0x2875('0x7f')],'action':_0xd6cb45['channelData']?_0xd6cb45[_0x2875('0x80')][_0x2875('0x81')]:undefined,'actiondata':_0xd6cb45['channelData']?_0xd6cb45['channelData'][_0x2875('0x82')]:undefined};if(_0xd6cb45[_0x2875('0x80')]&&_0xd6cb45[_0x2875('0x80')]['AudioFromTts']){return base64Decode(_0xd6cb45['channelData'][_0x2875('0x83')][_0x2875('0x84')],path['resolve'](__dirname,_0x2875('0x23'),rs[_0x2875('0x38')](0x4)+'.wav'))[_0x2875('0x26')](function(_0x30496f){_0x42f2ab[_0x2875('0x85')]=_0x30496f;return _0x42f2ab;});}return _0x42f2ab;});};exports[_0x2875('0x86')]=function(){return __dirname;}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/index.js b/server/services/agi/scripts/sestek/index.js index 44d6570..56fa018 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 _0xdb3a=['./nda','exports'];(function(_0x46dbfc,_0x51d994){var _0x68392e=function(_0xc600af){while(--_0xc600af){_0x46dbfc['push'](_0x46dbfc['shift']());}};_0x68392e(++_0x51d994);}(_0xdb3a,0x1b6));var _0xadb3=function(_0x5d9c31,_0x46a08d){_0x5d9c31=_0x5d9c31-0x0;var _0x579098=_0xdb3a[_0x5d9c31];return _0x579098;};var nda=require(_0xadb3('0x0'));module[_0xadb3('0x1')]={'nda':nda}; \ No newline at end of file +var _0x7575=['exports'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x7575,0x123));var _0x5757=function(_0x3a23c0,_0x1fb53d){_0x3a23c0=_0x3a23c0-0x0;var _0x400db1=_0x7575[_0x3a23c0];return _0x400db1;};var nda=require('./nda');module[_0x5757('0x0')]={'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 4b37ca6..874cef4 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 _0xbefe=['AudioOutputSettings','audio/wav','custom_action','CustomAction','custom_action_data','CustomActionData','info','stringify','url','agi','exports','POST','resolve','ndauth_url','password','username','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','callerid','calleridname','extension','text','Bearer\x20','access_token','project','ndagenerate_audio','body','channelData'];(function(_0xd6a1c9,_0x203324){var _0x51ea29=function(_0x165a30){while(--_0x165a30){_0xd6a1c9['push'](_0xd6a1c9['shift']());}};_0x51ea29(++_0x203324);}(_0xbefe,0x168));var _0xebef=function(_0x3adafa,_0x1ff5ea){_0x3adafa=_0x3adafa-0x0;var _0x229947=_0xbefe[_0x3adafa];return _0x229947;};'use strict';var rp=require('request-promise');var url=require(_0xebef('0x0'));var logger=require('../../../../../config/logger')(_0xebef('0x1'));module[_0xebef('0x2')]=function(_0x2f814c,_0x2cd3bf){var _0x1da4cd={'method':_0xebef('0x3'),'uri':url[_0xebef('0x4')](_0x2cd3bf[_0xebef('0x5')],'/token'),'form':{'grant_type':_0xebef('0x6'),'username':_0x2cd3bf[_0xebef('0x7')],'password':_0x2cd3bf[_0xebef('0x6')]},'json':!![]};return rp(_0x1da4cd)['then'](function(_0x4286bf){var _0x2fbd2c={'method':'POST','uri':url['resolve'](_0x2cd3bf[_0xebef('0x8')],_0xebef('0x9')),'body':{'type':_0x2cd3bf[_0xebef('0xa')]||_0xebef('0xb'),'channelId':_0xebef('0xc'),'conversation':{'id':_0x2f814c[_0xebef('0xd')]},'from':{'id':_0x2f814c[_0xebef('0xe')],'name':_0x2f814c[_0xebef('0xf')]},'recipient':{'id':_0x2f814c['dnid'],'name':_0x2f814c[_0xebef('0x10')]},'text':_0x2cd3bf[_0xebef('0x11')],'channelData':{}},'headers':{'Authorization':_0xebef('0x12')+_0x4286bf[_0xebef('0x13')]},'json':!![]};if(_0x2cd3bf[_0xebef('0x14')]){_0x2fbd2c['body']['channelData']['ProjectName']=_0x2cd3bf['project'];}if(_0x2cd3bf[_0xebef('0x15')]=='1'){_0x2fbd2c[_0xebef('0x16')][_0xebef('0x17')][_0xebef('0x18')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xebef('0x19')};}if(_0x2cd3bf[_0xebef('0x1a')]){_0x2fbd2c['body'][_0xebef('0x17')][_0xebef('0x1b')]=_0x2cd3bf[_0xebef('0x1a')];if(_0x2cd3bf[_0xebef('0x1c')]){_0x2fbd2c[_0xebef('0x16')][_0xebef('0x17')][_0xebef('0x1d')]=_0x2cd3bf[_0xebef('0x1c')];}}logger[_0xebef('0x1e')](JSON[_0xebef('0x1f')](_0x2fbd2c));return rp(_0x2fbd2c);});}; \ No newline at end of file +var _0xb332=['ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','Nda','uniqueid','callerid','calleridname','dnid','extension','text','Bearer\x20','access_token','project','body','ProjectName','ndagenerate_audio','channelData','audio/wav','custom_action','custom_action_data','CustomActionData','request-promise','../../../../../config/logger','agi','resolve','/token','password','username'];(function(_0x1bda09,_0x1d8be5){var _0x17be2d=function(_0x637732){while(--_0x637732){_0x1bda09['push'](_0x1bda09['shift']());}};_0x17be2d(++_0x1d8be5);}(_0xb332,0xd9));var _0x2b33=function(_0x770f7,_0x3af003){_0x770f7=_0x770f7-0x0;var _0xe797c6=_0xb332[_0x770f7];return _0xe797c6;};'use strict';var rp=require(_0x2b33('0x0'));var url=require('url');var logger=require(_0x2b33('0x1'))(_0x2b33('0x2'));module['exports']=function(_0xf8c6a7,_0x548a70){var _0x1fe6b1={'method':'POST','uri':url[_0x2b33('0x3')](_0x548a70['ndauth_url'],_0x2b33('0x4')),'form':{'grant_type':_0x2b33('0x5'),'username':_0x548a70[_0x2b33('0x6')],'password':_0x548a70[_0x2b33('0x5')]},'json':!![]};return rp(_0x1fe6b1)['then'](function(_0x5ccf2d){var _0x4302b7={'method':'POST','uri':url[_0x2b33('0x3')](_0x548a70[_0x2b33('0x7')],_0x2b33('0x8')),'body':{'type':_0x548a70[_0x2b33('0x9')]||'message','channelId':_0x2b33('0xa'),'conversation':{'id':_0xf8c6a7[_0x2b33('0xb')]},'from':{'id':_0xf8c6a7[_0x2b33('0xc')],'name':_0xf8c6a7[_0x2b33('0xd')]},'recipient':{'id':_0xf8c6a7[_0x2b33('0xe')],'name':_0xf8c6a7[_0x2b33('0xf')]},'text':_0x548a70[_0x2b33('0x10')],'channelData':{}},'headers':{'Authorization':_0x2b33('0x11')+_0x5ccf2d[_0x2b33('0x12')]},'json':!![]};if(_0x548a70[_0x2b33('0x13')]){_0x4302b7[_0x2b33('0x14')]['channelData'][_0x2b33('0x15')]=_0x548a70[_0x2b33('0x13')];}if(_0x548a70[_0x2b33('0x16')]=='1'){_0x4302b7['body'][_0x2b33('0x17')]['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x2b33('0x18')};}if(_0x548a70[_0x2b33('0x19')]){_0x4302b7[_0x2b33('0x14')]['channelData']['CustomAction']=_0x548a70[_0x2b33('0x19')];if(_0x548a70[_0x2b33('0x1a')]){_0x4302b7[_0x2b33('0x14')][_0x2b33('0x17')][_0x2b33('0x1b')]=_0x548a70['custom_action_data'];}}logger['info'](JSON['stringify'](_0x4302b7));return rp(_0x4302b7);});}; \ 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 dd6f6fa..32f12ce 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 _0x242c=['exports','./lib/api'];(function(_0x2d9922,_0x59fd51){var _0xaecfe=function(_0x58aafd){while(--_0x58aafd){_0x2d9922['push'](_0x2d9922['shift']());}};_0xaecfe(++_0x59fd51);}(_0x242c,0xfb));var _0xc242=function(_0x55f4db,_0x480aec){_0x55f4db=_0x55f4db-0x0;var _0x3b6dba=_0x242c[_0x55f4db];return _0x3b6dba;};'use strict';var asr=require(_0xc242('0x0'));module[_0xc242('0x1')]=function(_0x3db272,_0x42688e,_0x33a97d,_0x594687){return asr(_0x3db272,_0x42688e,_0x33a97d,_0x594687);}; \ No newline at end of file +var _0x4a4a=['exports','./lib/api'];(function(_0x44d809,_0x67e8da){var _0x28ce91=function(_0x5b5960){while(--_0x5b5960){_0x44d809['push'](_0x44d809['shift']());}};_0x28ce91(++_0x67e8da);}(_0x4a4a,0x147));var _0xa4a4=function(_0x47ba5d,_0x7e3870){_0x47ba5d=_0x47ba5d-0x0;var _0x54875e=_0x4a4a[_0x47ba5d];return _0x54875e;};'use strict';var asr=require(_0xa4a4('0x0'));module[_0xa4a4('0x1')]=function(_0x172328,_0x1c3826,_0x250c6c,_0x1688e3){return asr(_0x172328,_0x1c3826,_0x250c6c,_0x1688e3);}; \ 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 b513e75..de703ee 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 _0x2318=['crypto','../../../../../../config/logger','agi','exports','Tilde\x20URI','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','update','hex','info','Open\x20Tilde\x20ASR\x20socket','unix','createReadStream','data','send','close','EOS','error','Tilde\x20ASR\x20send\x20error','parse','status','result','final','Tilde\x20ASR\x20hypoteses','stringify','hypotheses','transcript','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','terminate','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','bluebird','lodash','moment'];(function(_0x2151b3,_0x4479e8){var _0x2ff4ae=function(_0x1a7f27){while(--_0x1a7f27){_0x2151b3['push'](_0x2151b3['shift']());}};_0x2ff4ae(++_0x4479e8);}(_0x2318,0xa1));var _0x8231=function(_0x51ef67,_0x2babdf){_0x51ef67=_0x51ef67-0x0;var _0x4193ca=_0x2318[_0x51ef67];return _0x4193ca;};'use strict';var BPromise=require(_0x8231('0x0'));var _=require(_0x8231('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x8231('0x2'));var crypto=require(_0x8231('0x3'));var logger=require(_0x8231('0x4'))(_0x8231('0x5'));module[_0x8231('0x6')]=function(_0x35193c,_0x2aaa4d,_0x668360,_0x1aa72b){return new BPromise(function(_0xb0f256,_0x1eb0ff){logger['info'](_0x8231('0x7'),_0x1aa72b||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x4d16e4=new WebSocket(_0x1aa72b||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x3e6446='';var _0x5e137b='0';var _0x5f13b1='1';var _0x493146=_0x8231('0x8');function _0x1e53f4(_0x4946ab){var _0x1f1607=crypto['createHash']('sha1');_0x1f1607[_0x8231('0x9')](_0x4946ab);return _0x1f1607['digest'](_0x8231('0xa'));}function _0x2eff2c(){try{logger[_0x8231('0xb')](_0x8231('0xc'));var _0x463a32=moment()[_0x8231('0xd')]();var _0x41778c=_0x1e53f4(_0x463a32+_0x2aaa4d+_0x668360);_0x4d16e4['send'](JSON['stringify']({'appID':_0x2aaa4d,'timestamp':_0x463a32,'appKey':_0x41778c}));var _0x334446=fs[_0x8231('0xe')](_0x35193c);_0x334446['on'](_0x8231('0xf'),function(_0x503a06){_0x4d16e4[_0x8231('0x10')](_0x503a06);});_0x334446['on'](_0x8231('0x11'),function(){_0x4d16e4[_0x8231('0x10')](_0x8231('0x12'));});}catch(_0x5e0aa8){logger[_0x8231('0x13')](_0x8231('0x14'),JSON['stringify'](_0x5e0aa8));_0x4d16e4['terminate']();}}function _0x2958f6(_0x5e7a4d){try{if(_0x5e7a4d){var _0xbf150b=JSON[_0x8231('0x15')](_0x5e7a4d);switch(_0xbf150b[_0x8231('0x16')]){case 0x0:if(_0xbf150b[_0x8231('0x17')]){if(_0xbf150b[_0x8231('0x17')][_0x8231('0x18')]){logger[_0x8231('0xb')](_0x8231('0x19'),JSON[_0x8231('0x1a')](_0xbf150b[_0x8231('0x17')][_0x8231('0x1b')]));_0x3e6446=_0xbf150b['result'][_0x8231('0x1b')][0x0][_0x8231('0x1c')];_0x5e137b=_0xbf150b[_0x8231('0x17')][_0x8231('0x1b')][0x0]['likelihood'];_0x5f13b1='0';_0x493146=_0x8231('0x1d');_0x4d16e4['terminate']();}}break;case 0x1:logger[_0x8231('0xb')](_0x8231('0x8'));_0x5f13b1='1';_0x493146=_0x8231('0x8');break;case 0x2:logger['info'](_0x8231('0x1e'));_0x5f13b1='2';_0x493146=_0x8231('0x1e');break;case 0x9:logger['info']('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x5f13b1='9';_0x493146=_0x8231('0x1f');break;case 0xa:logger[_0x8231('0xb')](_0x8231('0x20'));_0x5f13b1='10';_0x493146=_0x8231('0x20');break;case 0xb:logger[_0x8231('0xb')](_0x8231('0x21'));_0x5f13b1='11';_0x493146=_0x8231('0x21');}}}catch(_0x32af28){logger['error'](_0x8231('0x22'),JSON[_0x8231('0x1a')](_0x32af28));_0x4d16e4[_0x8231('0x23')]();}}function _0x1dbb29(){logger['info'](_0x8231('0x24'));_0xb0f256({'transcript':_0x3e6446,'confidence':_0x5e137b,'status':_0x5f13b1,'status_message':_0x493146});}function _0x4d2769(_0x59f2bb){logger[_0x8231('0x13')](_0x8231('0x25'));if(!_[_0x8231('0x26')](_0x59f2bb)){logger[_0x8231('0x13')](_[_0x8231('0x27')](_0x59f2bb)?JSON[_0x8231('0x1a')](_0x59f2bb):_0x59f2bb);}}_0x4d16e4['on'](_0x8231('0x28'),_0x2eff2c);_0x4d16e4['on']('message',_0x2958f6);_0x4d16e4['on'](_0x8231('0x11'),_0x1dbb29);_0x4d16e4['on'](_0x8231('0x13'),_0x4d2769);});}; \ No newline at end of file +var _0xca18=['crypto','agi','exports','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','digest','hex','info','unix','send','stringify','createReadStream','data','close','EOS','error','terminate','parse','status','result','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isObject','open','message','lodash','moment'];(function(_0x725b8e,_0xc22b48){var _0x43ac45=function(_0x46bb4a){while(--_0x46bb4a){_0x725b8e['push'](_0x725b8e['shift']());}};_0x43ac45(++_0xc22b48);}(_0xca18,0x18e));var _0x8ca1=function(_0x4bacb6,_0x2b299d){_0x4bacb6=_0x4bacb6-0x0;var _0x58c029=_0xca18[_0x4bacb6];return _0x58c029;};'use strict';var BPromise=require('bluebird');var _=require(_0x8ca1('0x0'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x8ca1('0x1'));var crypto=require(_0x8ca1('0x2'));var logger=require('../../../../../../config/logger')(_0x8ca1('0x3'));module[_0x8ca1('0x4')]=function(_0x11b246,_0x189e58,_0x5ca03f,_0x905eb6){return new BPromise(function(_0x52a36c,_0x43a052){logger['info'](_0x8ca1('0x5'),_0x905eb6||_0x8ca1('0x6'));var _0x340d2=new WebSocket(_0x905eb6||_0x8ca1('0x6'),{'perMessageDeflate':![]});var _0x648fc6='';var _0x25b4eb='0';var _0xae2b62='1';var _0x1a6cb8=_0x8ca1('0x7');function _0x3a2439(_0x5db3c9){var _0x49e7bb=crypto[_0x8ca1('0x8')](_0x8ca1('0x9'));_0x49e7bb['update'](_0x5db3c9);return _0x49e7bb[_0x8ca1('0xa')](_0x8ca1('0xb'));}function _0x7a59dc(){try{logger[_0x8ca1('0xc')]('Open\x20Tilde\x20ASR\x20socket');var _0x1093b0=moment()[_0x8ca1('0xd')]();var _0x4c324d=_0x3a2439(_0x1093b0+_0x189e58+_0x5ca03f);_0x340d2[_0x8ca1('0xe')](JSON[_0x8ca1('0xf')]({'appID':_0x189e58,'timestamp':_0x1093b0,'appKey':_0x4c324d}));var _0x389e01=fs[_0x8ca1('0x10')](_0x11b246);_0x389e01['on'](_0x8ca1('0x11'),function(_0x1aaa4c){_0x340d2[_0x8ca1('0xe')](_0x1aaa4c);});_0x389e01['on'](_0x8ca1('0x12'),function(){_0x340d2[_0x8ca1('0xe')](_0x8ca1('0x13'));});}catch(_0x3e3af2){logger[_0x8ca1('0x14')]('Tilde\x20ASR\x20send\x20error',JSON[_0x8ca1('0xf')](_0x3e3af2));_0x340d2[_0x8ca1('0x15')]();}}function _0x50fc82(_0x1b65b1){try{if(_0x1b65b1){var _0x1b76d5=JSON[_0x8ca1('0x16')](_0x1b65b1);switch(_0x1b76d5[_0x8ca1('0x17')]){case 0x0:if(_0x1b76d5[_0x8ca1('0x18')]){if(_0x1b76d5['result']['final']){logger[_0x8ca1('0xc')](_0x8ca1('0x19'),JSON[_0x8ca1('0xf')](_0x1b76d5['result'][_0x8ca1('0x1a')]));_0x648fc6=_0x1b76d5[_0x8ca1('0x18')][_0x8ca1('0x1a')][0x0][_0x8ca1('0x1b')];_0x25b4eb=_0x1b76d5[_0x8ca1('0x18')]['hypotheses'][0x0][_0x8ca1('0x1c')];_0xae2b62='0';_0x1a6cb8=_0x8ca1('0x1d');_0x340d2[_0x8ca1('0x15')]();}}break;case 0x1:logger[_0x8ca1('0xc')](_0x8ca1('0x7'));_0xae2b62='1';_0x1a6cb8=_0x8ca1('0x7');break;case 0x2:logger[_0x8ca1('0xc')](_0x8ca1('0x1e'));_0xae2b62='2';_0x1a6cb8='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger[_0x8ca1('0xc')](_0x8ca1('0x1f'));_0xae2b62='9';_0x1a6cb8=_0x8ca1('0x1f');break;case 0xa:logger[_0x8ca1('0xc')](_0x8ca1('0x20'));_0xae2b62='10';_0x1a6cb8=_0x8ca1('0x20');break;case 0xb:logger[_0x8ca1('0xc')](_0x8ca1('0x21'));_0xae2b62='11';_0x1a6cb8=_0x8ca1('0x21');}}}catch(_0x2783e8){logger[_0x8ca1('0x14')](_0x8ca1('0x22'),JSON[_0x8ca1('0xf')](_0x2783e8));_0x340d2['terminate']();}}function _0x439ba9(){logger[_0x8ca1('0xc')](_0x8ca1('0x23'));_0x52a36c({'transcript':_0x648fc6,'confidence':_0x25b4eb,'status':_0xae2b62,'status_message':_0x1a6cb8});}function _0x33fa3d(_0x20231e){logger[_0x8ca1('0x14')](_0x8ca1('0x24'));if(!_['isNil'](_0x20231e)){logger['error'](_[_0x8ca1('0x25')](_0x20231e)?JSON[_0x8ca1('0xf')](_0x20231e):_0x20231e);}}_0x340d2['on'](_0x8ca1('0x26'),_0x7a59dc);_0x340d2['on'](_0x8ca1('0x27'),_0x50fc82);_0x340d2['on'](_0x8ca1('0x12'),_0x439ba9);_0x340d2['on']('error',_0x33fa3d);});}; \ 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 cf41797..72bd4a1 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 _0xd349=['exports','./asr'];(function(_0x414df0,_0x3b902f){var _0x2cf357=function(_0x528c3c){while(--_0x528c3c){_0x414df0['push'](_0x414df0['shift']());}};_0x2cf357(++_0x3b902f);}(_0xd349,0x11f));var _0x9d34=function(_0x138c93,_0x31dd87){_0x138c93=_0x138c93-0x0;var _0x1b2e78=_0xd349[_0x138c93];return _0x1b2e78;};var asr=require(_0x9d34('0x0'));module[_0x9d34('0x1')]={'asr':asr}; \ No newline at end of file +var _0x879d=['./asr','exports'];(function(_0x3f1cd3,_0x23e4bb){var _0x27b27b=function(_0x283485){while(--_0x283485){_0x3f1cd3['push'](_0x3f1cd3['shift']());}};_0x27b27b(++_0x23e4bb);}(_0x879d,0x66));var _0xd879=function(_0x3eae3e,_0x57f222){_0x3eae3e=_0x3eae3e-0x0;var _0x4f732b=_0x879d[_0x3eae3e];return _0x4f732b;};var asr=require(_0xd879('0x0'));module[_0xd879('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index b19894b..18dbf21 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 _0x34e8=['E_AGI_ARGUMENT_PORT','createServer','listen','listening','connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','close','nextTick','inherits','exports','util','net','events','EventEmitter','./channel','call','emit','error'];(function(_0x58f29c,_0x5d293c){var _0x52f5c9=function(_0x7b6c8a){while(--_0x7b6c8a){_0x58f29c['push'](_0x58f29c['shift']());}};_0x52f5c9(++_0x5d293c);}(_0x34e8,0x12c));var _0x834e=function(_0x8b8425,_0x3420ea){_0x8b8425=_0x8b8425-0x0;var _0x1668e7=_0x34e8[_0x8b8425];return _0x1668e7;};'use strict';var util=require(_0x834e('0x0'));var net=require(_0x834e('0x1'));var EventEmitter=require(_0x834e('0x2'))[_0x834e('0x3')];var AGIError=require('./error');var AGIChannel=require(_0x834e('0x4'));var AGIServer=function(_0x21e2e0,_0x472111,_0x31bf20){var _0x289ef2=this;var _0x19a3e0=null;var _0x398bee=0x0;if(!_0x21e2e0)_0x21e2e0=0x11dd;if(!_0x472111)_0x472111='127.0.0.1';EventEmitter[_0x834e('0x5')](_0x289ef2);function _0x52056d(){if(!_0x21e2e0){_0x289ef2[_0x834e('0x6')](_0x834e('0x7'),new AGIError(_0x834e('0x8')));return![];}_0x19a3e0=net[_0x834e('0x9')]();_0x19a3e0[_0x834e('0xa')](_0x21e2e0,_0x472111);_0x19a3e0['on'](_0x834e('0xb'),function(){_0x289ef2[_0x834e('0x6')](_0x834e('0xb'));});_0x19a3e0['on'](_0x834e('0xc'),function(_0x186b3b){_0x19a3e0[_0x834e('0xd')](function(_0x36e124,_0x14038b){if(_0x36e124){_0x289ef2[_0x834e('0x6')](_0x834e('0x7'),new AGIError(_0x834e('0xe'),_0x36e124));}else if(_0x31bf20&&_0x31bf20<0x0){_0x289ef2[_0x834e('0x6')]('error',new AGIError(_0x834e('0xf')));_0x186b3b[_0x834e('0x10')]();}else if(_0x31bf20&&_0x31bf20>0x0&&_0x31bf20<_0x14038b){_0x398bee+=0x1;_0x289ef2['emit'](_0x834e('0x7'),new AGIError(_0x834e('0x11'),_0x398bee));_0x186b3b[_0x834e('0x10')]();}else{var _0x21cc0a=new AGIChannel(_0x186b3b);_0x21cc0a['on']('ready',function(){_0x289ef2[_0x834e('0x6')](_0x834e('0xc'),_0x21cc0a);});}});});_0x19a3e0['on']('error',function(_0x316205){_0x289ef2['emit'](_0x834e('0x7'),new AGIError(_0x834e('0xe'),_0x316205['code']));});_0x19a3e0['on'](_0x834e('0x12'),function(){_0x289ef2[_0x834e('0x6')](_0x834e('0x12'),new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0x834e('0x13')](function(){_0x52056d();});};util[_0x834e('0x14')](AGIServer,EventEmitter);module[_0x834e('0x15')]=function(_0xb993a1,_0x237947,_0x254677){return new AGIServer(_0xb993a1,_0x237947,_0x254677);}; \ No newline at end of file +var _0x34e8=['E_AGI_ARGUMENT_PORT','createServer','listen','listening','connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','close','nextTick','inherits','exports','util','net','events','EventEmitter','./channel','call','emit','error'];(function(_0x1bbda2,_0x3de852){var _0x4e59f6=function(_0x23b41b){while(--_0x23b41b){_0x1bbda2['push'](_0x1bbda2['shift']());}};_0x4e59f6(++_0x3de852);}(_0x34e8,0x12c));var _0x834e=function(_0x214af9,_0x18250d){_0x214af9=_0x214af9-0x0;var _0x14270f=_0x34e8[_0x214af9];return _0x14270f;};'use strict';var util=require(_0x834e('0x0'));var net=require(_0x834e('0x1'));var EventEmitter=require(_0x834e('0x2'))[_0x834e('0x3')];var AGIError=require('./error');var AGIChannel=require(_0x834e('0x4'));var AGIServer=function(_0x21e2e0,_0x472111,_0x31bf20){var _0x289ef2=this;var _0x19a3e0=null;var _0x398bee=0x0;if(!_0x21e2e0)_0x21e2e0=0x11dd;if(!_0x472111)_0x472111='127.0.0.1';EventEmitter[_0x834e('0x5')](_0x289ef2);function _0x52056d(){if(!_0x21e2e0){_0x289ef2[_0x834e('0x6')](_0x834e('0x7'),new AGIError(_0x834e('0x8')));return![];}_0x19a3e0=net[_0x834e('0x9')]();_0x19a3e0[_0x834e('0xa')](_0x21e2e0,_0x472111);_0x19a3e0['on'](_0x834e('0xb'),function(){_0x289ef2[_0x834e('0x6')](_0x834e('0xb'));});_0x19a3e0['on'](_0x834e('0xc'),function(_0x186b3b){_0x19a3e0[_0x834e('0xd')](function(_0x36e124,_0x14038b){if(_0x36e124){_0x289ef2[_0x834e('0x6')](_0x834e('0x7'),new AGIError(_0x834e('0xe'),_0x36e124));}else if(_0x31bf20&&_0x31bf20<0x0){_0x289ef2[_0x834e('0x6')]('error',new AGIError(_0x834e('0xf')));_0x186b3b[_0x834e('0x10')]();}else if(_0x31bf20&&_0x31bf20>0x0&&_0x31bf20<_0x14038b){_0x398bee+=0x1;_0x289ef2['emit'](_0x834e('0x7'),new AGIError(_0x834e('0x11'),_0x398bee));_0x186b3b[_0x834e('0x10')]();}else{var _0x21cc0a=new AGIChannel(_0x186b3b);_0x21cc0a['on']('ready',function(){_0x289ef2[_0x834e('0x6')](_0x834e('0xc'),_0x21cc0a);});}});});_0x19a3e0['on']('error',function(_0x316205){_0x289ef2['emit'](_0x834e('0x7'),new AGIError(_0x834e('0xe'),_0x316205['code']));});_0x19a3e0['on'](_0x834e('0x12'),function(){_0x289ef2[_0x834e('0x6')](_0x834e('0x12'),new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0x834e('0x13')](function(){_0x52056d();});};util[_0x834e('0x14')](AGIServer,EventEmitter);module[_0x834e('0x15')]=function(_0xb993a1,_0x237947,_0x254677){return new AGIServer(_0xb993a1,_0x237947,_0x254677);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 3a70025..87ea8c5 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 _0x0fda=['arg_1','createSquareRecording','callerid','calleridname','extension','priority','accountcode','createSquareMessage','createCmContact','isNil','callback_','random','isEmpty','lastName','scheduledAt','callback','toString','getPause','getPauseById','agentPause','agentUnpause','agent','agentLogout','internal','LOCAL','agentLogin','exec','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','MALE','audioEncoding','googleTTS','google_tts_language','restAPI','url','method','timeout','number','includes','POST','PUT','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','rawHeaders','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','stringify','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','model','awsPolly','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_access_key_id','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','clear','hasOwnProperty','isString','replaceObjectAllVariables','recursiveNodeIndex','length','saveRestApiResult','isPlainObject','%s.%s','isArray','setVariable','replaceAllVariables','split','replaceAll','extra','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','isConfigured','maxRetry','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','MRCPSynth','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','Executed\x20command\x20MRCPRecog\x20%s','agi','Enter\x20in\x20AGI\x20(%s)\x20block','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','list_id','no\x20list\x20selected','add','delay','minutes','callback_priority','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','phone','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','Executed\x20command\x20MRCPSynth\x20%s','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','LUMENVOX_ASR_CONFIDENCE','RECOG_INPUT()','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','no\x20database\x20selected','no\x20odbc\x20database\x20found','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','forEach','%s[%s][%s]','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','no\x20user\x20selected','sip_id','no\x20user\x20found','DIAL','SIP/%s','opts','Executed\x20command\x20%s','dialogflow','no\x20key\x20configured','no\x20text\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','toUpperCase','speech','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20client_email\x20configured','private_key','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','out','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','username','no\x20username\x20configured','password','ndassistant_url','Trying\x20SestekNDA:\x20%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','trunk_name','SIP/%s/%s','Enter\x20in\x20FINALLY\x20(%s)\x20block','finally','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','retry','file_id','no\x20file\x20audio\x20selected','getData','response','maxdigit','test','mindigit','no\x20variable\x20found','hiddendigitsnum','generate','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','beep','recordFile','intKey','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appsecret\x20configured','NOBEEP','tilde\x20%s\x20file\x20created','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','context','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','no\x20condition\x20configured','condition','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','interval_id','no\x20interval\x20configured','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','no\x20find\x20by\x20configured','math','Enter\x20in\x20MATH\x20(%s)\x20block','no\x20operation\x20configured','math\x20%s','operation','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','no\x20file\x20audio\x20found','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','Enter\x20in\x20PAUSE\x20(%s)\x20block','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','getSound','indexOf','QUEUE','gosub','Enter\x20in\x20RECORD\x20(%s)\x20block','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','no\x20mail\x20account\x20configured','account_id','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','user','bcc','subject','template_id','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','getSmsAccount','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','no\x20variable\x20selected','variable_value','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','XMCS-UNIQUEID','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','agi://%s/square,\x22%s\x22,\x22%s\x22','host','127.0.0.1','system','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','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20is\x20unreachable','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','util','shelljs','odbc','randomstring','moment','mustache','request-promise','../../config/logger','./scripts','rawBody','menu','getdigits','getsecretdigits','channel','rpc','prototype','getVariable','getVariableById','then','name','getVoiceQueue','getVoiceQueueById','catch','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUser','getUserById','getTrunk','getSoundPath','getMailAccount','getMailAccountById','getIntervals','getIntervalById','IntervalId','map','format','getQueryOdbc','open','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','error','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand'];(function(_0x2a1b19,_0x2af50a){var _0x515e02=function(_0x34b856){while(--_0x34b856){_0x2a1b19['push'](_0x2a1b19['shift']());}};_0x515e02(++_0x2af50a);}(_0x0fda,0x1a0));var _0xa0fd=function(_0x4b6f51,_0x2c8a37){_0x4b6f51=_0x4b6f51-0x0;var _0xab8919=_0x0fda[_0x4b6f51];return _0xab8919;};'use strict';var fs=require('fs');var util=require(_0xa0fd('0x0'));var _=require('lodash');var sh=require(_0xa0fd('0x1'));var odbc=require(_0xa0fd('0x2'))();var rs=require(_0xa0fd('0x3'));var moment=require(_0xa0fd('0x4'));var Mustache=require(_0xa0fd('0x5'));var rp=require(_0xa0fd('0x6'));var logger=require(_0xa0fd('0x7'))('agi');var config=require('../../config/environment');var scripts=require(_0xa0fd('0x8'));var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=['rawHeaders',_0xa0fd('0x9')];var verticesWithRetry=[_0xa0fd('0xa'),_0xa0fd('0xb'),_0xa0fd('0xc')];var AGIVertices=function(_0x5d996b,_0x29da4c,_0xe93771){this[_0xa0fd('0xd')]=_0x5d996b;this[_0xa0fd('0xe')]=_0x29da4c;this['mailRpc']=_0xe93771;};AGIVertices[_0xa0fd('0xf')][_0xa0fd('0x10')]=function(_0x36634c,_0x5c1786){this[_0xa0fd('0xe')][_0xa0fd('0x11')](_0x36634c)[_0xa0fd('0x12')](function(_0x2af372){_0x5c1786(null,_0x2af372?_0x2af372[_0xa0fd('0x13')]:![]);})['catch'](function(_0x490112){_0x5c1786(_0x490112);});};AGIVertices[_0xa0fd('0xf')][_0xa0fd('0x14')]=function(_0x5a7274,_0x21acc2){this[_0xa0fd('0xe')][_0xa0fd('0x15')](_0x5a7274)[_0xa0fd('0x12')](function(_0x2b0993){_0x21acc2(null,_0x2b0993?_0x2b0993[_0xa0fd('0x13')]:![]);})[_0xa0fd('0x16')](function(_0x4fe62c){_0x21acc2(_0x4fe62c);});};AGIVertices[_0xa0fd('0xf')][_0xa0fd('0x17')]=function(_0x5605ae,_0x50aa6d){this[_0xa0fd('0xe')][_0xa0fd('0x18')](_0x5605ae)['then'](function(_0x2b8d15){_0x50aa6d(null,_0x2b8d15?_0x2b8d15[_0xa0fd('0x13')]:![]);})[_0xa0fd('0x16')](function(_0x5073a8){_0x50aa6d(_0x5073a8);});};AGIVertices['prototype'][_0xa0fd('0x19')]=function(_0x558109,_0x40e288){this[_0xa0fd('0xe')][_0xa0fd('0x1a')](_0x558109)[_0xa0fd('0x12')](function(_0x263591){_0x40e288(null,_0x263591?_0x263591[_0xa0fd('0x1b')]:![]);})[_0xa0fd('0x16')](function(_0x515b0d){_0x40e288(_0x515b0d);});};AGIVertices[_0xa0fd('0xf')][_0xa0fd('0x1c')]=function(_0x701d7,_0x18eaa8){this[_0xa0fd('0xe')][_0xa0fd('0x1d')](_0x701d7)[_0xa0fd('0x12')](function(_0x411205){_0x18eaa8(null,_0x411205?_0x411205[_0xa0fd('0x13')]:![]);})[_0xa0fd('0x16')](function(_0x28dbda){_0x18eaa8(_0x28dbda);});};AGIVertices[_0xa0fd('0xf')][_0xa0fd('0x1e')]=function(_0x54cacc,_0x37177b){this[_0xa0fd('0xe')]['getTrunkById'](_0x54cacc)[_0xa0fd('0x12')](function(_0x3cd5b0){_0x37177b(null,_0x3cd5b0?_0x3cd5b0['name']:![]);})['catch'](function(_0x2e9b0d){_0x37177b(_0x2e9b0d);});};AGIVertices[_0xa0fd('0xf')]['getSound']=function(_0x5c70fb,_0x5b50c0){var _0x58b786=this;this[_0xa0fd('0xe')]['getSoundById'](_0x5c70fb)[_0xa0fd('0x12')](function(_0x1db300){_0x5b50c0(null,_0x1db300?_0x58b786[_0xa0fd('0x1f')](_0x1db300['save_name']):![]);})[_0xa0fd('0x16')](function(_0x19c352){_0x5b50c0(_0x19c352);});};AGIVertices[_0xa0fd('0xf')][_0xa0fd('0x20')]=function(_0x26e39c,_0x58ddb3){this[_0xa0fd('0xe')][_0xa0fd('0x21')](_0x26e39c)[_0xa0fd('0x12')](function(_0x2993aa){_0x58ddb3(null,_0x2993aa?_0x2993aa:![]);})['catch'](function(_0x33785f){_0x58ddb3(_0x33785f);});};AGIVertices[_0xa0fd('0xf')]['sendMailMessage']=function(_0x4fddf9,_0x581071,_0x1fc249){this['mailRpc']['sendMailMessage'](_0x4fddf9,_0x581071)[_0xa0fd('0x12')](function(){_0x1fc249(null);})['catch'](function(_0xbaa5d2){_0x1fc249(_0xbaa5d2);});};AGIVertices[_0xa0fd('0xf')][_0xa0fd('0x22')]=function(_0x2081dc,_0x1f6e72){this[_0xa0fd('0xe')][_0xa0fd('0x23')](_0x2081dc)[_0xa0fd('0x12')](function(_0x4ce77f){if(_0x4ce77f){if(_0x4ce77f[_0xa0fd('0x24')]){_0x1f6e72(null,[_0x4ce77f['interval']]);}else{_0x1f6e72(null,_[_0xa0fd('0x25')](_0x4ce77f['Intervals'],'interval'));}}else{_0x1f6e72(null,![]);}})[_0xa0fd('0x16')](function(_0x4bcec1){_0x1f6e72(_0x4bcec1);});};AGIVertices[_0xa0fd('0xf')][_0xa0fd('0x1f')]=function(_0x431d31){return util[_0xa0fd('0x26')]('%s/sounds/converted/%s',FILES_PATH,_0x431d31);};AGIVertices[_0xa0fd('0xf')][_0xa0fd('0x27')]=function(_0x3b06ef,_0x3f6146,_0x2e3cfa){odbc[_0xa0fd('0x28')](_0x3b06ef,function(_0x41feca){if(_0x41feca){logger['error']('Error\x20getting\x20ODBC\x20connection\x20%s',_0x41feca);_0x2e3cfa(_0x41feca);}else{logger[_0xa0fd('0x29')](_0xa0fd('0x2a'));odbc[_0xa0fd('0x2b')](_0x3f6146,function(_0x155f5,_0x5e1a77){if(_0x155f5){logger[_0xa0fd('0x29')](_0xa0fd('0x2c'),_0x3f6146);_0x2e3cfa(_0x155f5);}else{logger[_0xa0fd('0x29')](_0xa0fd('0x2d'),_0x3f6146);odbc[_0xa0fd('0x2e')](function(_0x5d5fdd){if(_0x5d5fdd){logger[_0xa0fd('0x2f')](_0xa0fd('0x30'),_0x5d5fdd);}_0x2e3cfa(null,_0x5e1a77);});}});}});};AGIVertices['prototype']['getSmsAccount']=function(_0x27082a,_0x163023){this[_0xa0fd('0xe')][_0xa0fd('0x31')](_0x27082a)[_0xa0fd('0x12')](function(_0xbeca16){_0x163023(null,_0xbeca16?_0xbeca16:![]);})[_0xa0fd('0x16')](function(_0xc147b5){_0x163023(_0xc147b5);});};AGIVertices[_0xa0fd('0xf')][_0xa0fd('0x32')]=function(_0x12d66a,_0x1c9bba){this[_0xa0fd('0xe')][_0xa0fd('0x32')](_0x12d66a)[_0xa0fd('0x12')](function(_0x515449){_0x1c9bba(null,_0x515449);})['catch'](function(_0x4dd042){_0x1c9bba(_0x4dd042);});};AGIVertices[_0xa0fd('0xf')][_0xa0fd('0x33')]=function(_0x399eb1,_0x54fb8c,_0x428255){this[_0xa0fd('0xe')][_0xa0fd('0x33')]({'uniqueid':this['channel'][_0xa0fd('0x34')],'node':_0x399eb1[_0xa0fd('0x35')],'application':_0x399eb1[_0xa0fd('0x36')],'data':_0x54fb8c||null,'project_name':this[_0xa0fd('0xd')][_0xa0fd('0x37')],'callerid':this[_0xa0fd('0xd')]['callerid']})[_0xa0fd('0x12')](function(_0x2b58a0){if(_0x428255){_0x428255(null,_0x2b58a0);}})[_0xa0fd('0x16')](function(_0x2498da){if(_0x428255){_0x428255(_0x2498da);}});};AGIVertices[_0xa0fd('0xf')][_0xa0fd('0x38')]=function(_0x56cfca,_0x2ccdf7,_0x781be5,_0xf1c674){this[_0xa0fd('0xe')][_0xa0fd('0x38')]({'uniqueid':this['channel']['uniqueid'],'callerid':this[_0xa0fd('0xd')][_0xa0fd('0x39')],'calleridname':this[_0xa0fd('0xd')][_0xa0fd('0x3a')],'context':this[_0xa0fd('0xd')]['context'],'extension':this[_0xa0fd('0xd')][_0xa0fd('0x3b')],'priority':this[_0xa0fd('0xd')][_0xa0fd('0x3c')],'accountcode':this[_0xa0fd('0xd')][_0xa0fd('0x3d')],'dnid':this['channel']['dnid'],'projectName':this['channel'][_0xa0fd('0x37')],'saveName':_0x2ccdf7,'filename':_0x56cfca['file']||_0x2ccdf7,'savePath':_0x781be5})['then'](function(_0xcf725e){_0xf1c674(null,_0xcf725e);})['catch'](function(_0x357324){_0xf1c674(_0x357324);});};AGIVertices[_0xa0fd('0xf')]['createSquareMessage']=function(_0x4abff8,_0x213e67,_0x38a66b,_0x42376a,_0x167503){this[_0xa0fd('0xe')][_0xa0fd('0x3e')]({'uniqueid':this['channel']['uniqueid'],'body':_0x4abff8,'direction':_0x213e67,'providerName':_0x38a66b,'providerResponse':_0x42376a})['then'](function(_0x59742b){if(_0x167503){_0x167503(null,_0x59742b);}})[_0xa0fd('0x16')](function(_0x43fc4a){if(_0x167503){_0x167503(_0x43fc4a);}});};AGIVertices[_0xa0fd('0xf')][_0xa0fd('0x3f')]=function(_0x32d251,_0x53c1a2){this['rpc']['createCmContact']({'firstName':_['isEmpty'](_0x32d251['name'])||_[_0xa0fd('0x40')](_0x32d251[_0xa0fd('0x13')])?_0xa0fd('0x41')+Math[_0xa0fd('0x42')]():_0x32d251[_0xa0fd('0x13')],'lastName':_[_0xa0fd('0x43')](_0x32d251[_0xa0fd('0x44')])||_[_0xa0fd('0x40')](_0x32d251[_0xa0fd('0x44')])?null:_0x32d251[_0xa0fd('0x44')],'phone':_0x32d251['phone'],'ListId':_0x32d251['list_id'],'scheduledat':_0x32d251[_0xa0fd('0x45')],'callbackUniqueid':this[_0xa0fd('0xd')][_0xa0fd('0x34')],'tags':_0xa0fd('0x46'),'description':'Callback\x20scheduled\x20at\x20'+_0x32d251[_0xa0fd('0x45')][_0xa0fd('0x47')](),'priority':_0x32d251['callback_priority']})[_0xa0fd('0x12')](function(_0x4a662a){_0x53c1a2(null,_0x4a662a);})[_0xa0fd('0x16')](function(_0x39578a){_0x53c1a2(_0x39578a);});};AGIVertices['prototype'][_0xa0fd('0x48')]=function(_0x2d658e,_0x10d3c3){this[_0xa0fd('0xe')][_0xa0fd('0x49')](_0x2d658e)[_0xa0fd('0x12')](function(_0x47675b){_0x10d3c3(null,_0x47675b?_0x47675b[_0xa0fd('0x13')]:![]);})['catch'](function(_0x201fd5){_0x10d3c3(_0x201fd5);});};AGIVertices['prototype'][_0xa0fd('0x4a')]=function(_0x4205ac,_0x2e3344,_0x1483d5){var _0xa37ca9={'role':'agent'};_0xa37ca9[_0x4205ac]=this[_0xa0fd('0xd')][_0xa0fd('0x39')];this['rpc'][_0xa0fd('0x4a')](_0xa37ca9,_0x2e3344,this[_0xa0fd('0xd')][_0xa0fd('0x34')])['then'](function(_0x44083d){_0x1483d5(null,_['isNil'](_0x44083d)?![]:!![]);})[_0xa0fd('0x16')](function(_0x5e720f){logger[_0xa0fd('0x2f')](_0x5e720f);_0x1483d5(null,![]);});};AGIVertices['prototype'][_0xa0fd('0x4b')]=function(_0x62c3e7,_0x3f9d1e){var _0x981780={'role':_0xa0fd('0x4c')};_0x981780[_0x62c3e7]=this[_0xa0fd('0xd')][_0xa0fd('0x39')];this['rpc'][_0xa0fd('0x4b')](_0x981780)[_0xa0fd('0x12')](function(_0x221c5b){_0x3f9d1e(null,_[_0xa0fd('0x40')](_0x221c5b)?![]:!![]);})[_0xa0fd('0x16')](function(_0x587adf){logger['error'](_0x587adf);_0x3f9d1e(null,![]);});};AGIVertices['prototype'][_0xa0fd('0x4d')]=function(_0x5e3b77,_0x420d66){var _0x589433={'role':_0xa0fd('0x4c')};_0x589433[_0x5e3b77]=this[_0xa0fd('0xd')][_0xa0fd('0x39')];this[_0xa0fd('0xe')][_0xa0fd('0x4d')](_0x589433)[_0xa0fd('0x12')](function(_0x471a34){_0x420d66(null,_[_0xa0fd('0x40')](_0x471a34)?![]:!![]);})[_0xa0fd('0x16')](function(_0x39b8e8){logger[_0xa0fd('0x2f')](_0x39b8e8);_0x420d66(null,![]);});};AGIVertices[_0xa0fd('0xf')]['agentLogin']=function(_0x5366d0,_0x385b00){var _0x1169a0={'role':_0xa0fd('0x4c')};_0x1169a0[_0x5366d0]=this[_0xa0fd('0xd')][_0xa0fd('0x39')];var _0x40186a=_0x5366d0!=_0xa0fd('0x4e')?util[_0xa0fd('0x26')]('%s/%s@from-sip/n',_0xa0fd('0x4f'),this[_0xa0fd('0xd')][_0xa0fd('0x39')]):undefined;this[_0xa0fd('0xe')][_0xa0fd('0x50')](_0x1169a0,_0x40186a)[_0xa0fd('0x12')](function(_0x45f7df){_0x385b00(null,_[_0xa0fd('0x40')](_0x45f7df)?![]:!![]);})[_0xa0fd('0x16')](function(_0x1bc5db){logger[_0xa0fd('0x2f')](_0x1bc5db);_0x385b00(null,![]);});};AGIVertices[_0xa0fd('0xf')]['shellCommand']=function(_0x436f4f,_0x3cd5a5){sh[_0xa0fd('0x51')](_[_0xa0fd('0x52')](_0x436f4f),function(_0x4147b4,_0x1c73ca){var _0x2d70a7=_0x1c73ca[_0xa0fd('0x53')](/(\r\n|\n|\r)/gm,'');_0x3cd5a5(null,_0x2d70a7);});};AGIVertices[_0xa0fd('0xf')][_0xa0fd('0x54')]=function(_0x4d97eb,_0x174f31){scripts[_0xa0fd('0x54')](_0x4d97eb[_0xa0fd('0x55')],_0x4d97eb[_0xa0fd('0x56')]||_0xa0fd('0x57'),_0x4d97eb[_0xa0fd('0x57')],_0x4d97eb[_0xa0fd('0x58')]||_0xa0fd('0x59'),_0x4d97eb['ssmlGender']||_0xa0fd('0x5a'),_0x4d97eb[_0xa0fd('0x5b')]||'MP3')[_0xa0fd('0x12')](function(_0x1b9799){_0x174f31(null,_0x1b9799);})[_0xa0fd('0x16')](function(_0x62efea){_0x174f31(_0x62efea);});};AGIVertices[_0xa0fd('0xf')]['googleTTS']=function(_0xb6fed,_0x306ca1){scripts[_0xa0fd('0x5c')](_0xb6fed[_0xa0fd('0x57')],_0xb6fed[_0xa0fd('0x5d')]||'en',0x1)[_0xa0fd('0x12')](function(_0x34ae5a){_0x306ca1(null,_0x34ae5a);})[_0xa0fd('0x16')](function(_0xaaeabf){_0x306ca1(_0xaaeabf);});};AGIVertices[_0xa0fd('0xf')][_0xa0fd('0x5e')]=function(_0x245012,_0x36452c){var _0x7d5b1d={'uri':_0x245012[_0xa0fd('0x5f')],'method':_0x245012[_0xa0fd('0x60')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x245012[_0xa0fd('0x61')])===_0xa0fd('0x62')&&parseInt(_0x245012[_0xa0fd('0x61')])>=0x1?parseInt(_0x245012['timeout'])*0x3e8:0x5*0x3e8};if(_[_0xa0fd('0x63')]([_0xa0fd('0x64'),_0xa0fd('0x65')],_0x7d5b1d[_0xa0fd('0x60')]['toUpperCase']())){try{_0x7d5b1d[_0xa0fd('0x66')]=_0x245012[_0xa0fd('0x9')]?JSON[_0xa0fd('0x67')](_0x245012[_0xa0fd('0x9')]):{};}catch(_0xc2f803){logger['error'](_0xa0fd('0x68'),_0xc2f803);}}try{_0x7d5b1d[_0xa0fd('0x69')]=_0x245012['rawHeaders']?JSON['parse'](_0x245012[_0xa0fd('0x6a')]):{};}catch(_0x5aa5eb){logger['error'](_0xa0fd('0x6b'),_0x5aa5eb);}if(_0x245012[_0xa0fd('0x6c')]){try{var _0x576c79=require(_0x245012[_0xa0fd('0x6c')])[_0xa0fd('0x6d')](this,_0x7d5b1d);_0x7d5b1d[_0xa0fd('0x6e')]=Mustache[_0xa0fd('0x6f')](_0x245012[_0xa0fd('0x5f')],_0x576c79,{},['$$','$$']);if(_0x7d5b1d['headers']){_0x7d5b1d[_0xa0fd('0x69')]=JSON[_0xa0fd('0x67')](Mustache['render'](JSON[_0xa0fd('0x70')](_0x7d5b1d[_0xa0fd('0x69')]),_0x576c79,{},['$$','$$']));}if(_0x7d5b1d[_0xa0fd('0x66')]){_0x7d5b1d['body']=JSON[_0xa0fd('0x67')](Mustache['render'](JSON[_0xa0fd('0x70')](_0x7d5b1d[_0xa0fd('0x66')]),_0x576c79,{},['$$','$$']));}}catch(_0xe9600b){logger[_0xa0fd('0x2f')]('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0xe9600b);}}rp(_0x7d5b1d)[_0xa0fd('0x12')](function(_0x2d8792){var _0x438fc3={'statusCode':_0x2d8792[_0xa0fd('0x71')]||0xc8,'statusMessage':_0x2d8792[_0xa0fd('0x72')]||'OK','headers':_0x2d8792[_0xa0fd('0x69')]||{},'body':_0x2d8792['body']||{}};_0x36452c(null,_0x438fc3);})[_0xa0fd('0x16')](function(_0x33c39f){var _0x2a32d5={'statusCode':_0x33c39f[_0xa0fd('0x71')]||0x1f4,'statusMessage':_0x33c39f[_0xa0fd('0x73')]||_0xa0fd('0x74'),'headers':_0x33c39f['options']['headers']||{},'body':_0x33c39f[_0xa0fd('0x75')][_0xa0fd('0x66')]||{}};_0x36452c(null,_0x2a32d5);});};AGIVertices['prototype'][_0xa0fd('0x76')]=function(_0x42a27d,_0x1bdcb){scripts[_0xa0fd('0x76')](this[_0xa0fd('0xd')][_0xa0fd('0x34')],_0x42a27d[_0xa0fd('0x77')],_0x42a27d[_0xa0fd('0x57')],_0x42a27d[_0xa0fd('0x78')]||'en')['then'](function(_0x2f8807){_0x1bdcb(null,_0x2f8807);})[_0xa0fd('0x16')](function(_0x379af6){_0x1bdcb(_0x379af6);});};AGIVertices['prototype'][_0xa0fd('0x79')]=function(_0x23e557,_0x4c3da0){scripts['googleDialogflowV2'](this[_0xa0fd('0xd')][_0xa0fd('0x34')],_0x23e557[_0xa0fd('0x7a')],_0x23e557[_0xa0fd('0x7b')],_0x23e557['private_key'],_0x23e557['text'],_0x23e557[_0xa0fd('0x7c')]||'en')[_0xa0fd('0x12')](function(_0x316177){_0x4c3da0(null,_0x316177);})[_0xa0fd('0x16')](function(_0x31cf5e){_0x4c3da0(_0x31cf5e);});};AGIVertices['prototype']['sestekNDA']=function(_0x2b3963,_0x1e9404){scripts[_0xa0fd('0x7d')](this[_0xa0fd('0xd')],_0x2b3963)[_0xa0fd('0x12')](function(_0x3daa8f){_0x1e9404(null,_0x3daa8f);})[_0xa0fd('0x16')](function(_0x392700){_0x1e9404(_0x392700);});};AGIVertices[_0xa0fd('0xf')][_0xa0fd('0x7e')]=function(_0x369fa2,_0x227b1b){scripts[_0xa0fd('0x7e')](_0x369fa2[_0xa0fd('0x77')],_0x369fa2['text'],_0x369fa2[_0xa0fd('0x7f')]||_0xa0fd('0x59'),_0x369fa2[_0xa0fd('0x80')])[_0xa0fd('0x12')](function(_0x5706c5){_0x227b1b(null,_0x5706c5);})['catch'](function(_0x785ba5){_0x227b1b(_0x785ba5);});};AGIVertices['prototype'][_0xa0fd('0x81')]=function(_0x18c33e,_0x11eef0,_0x18046f){scripts['ispeechASR'](_0x11eef0,_0x18c33e['key'],_0x18c33e['ispeech_asr_language']||'en-US',this['isConfigured'](_0x18c33e['model'])?_0x18c33e[_0xa0fd('0x82')]:undefined)[_0xa0fd('0x12')](function(_0xabf058){_0x18046f(null,_0xabf058);})['catch'](function(_0x3b22d1){_0x18046f(_0x3b22d1);});};AGIVertices['prototype'][_0xa0fd('0x83')]=function(_0x47115d,_0xc12eb7){scripts[_0xa0fd('0x83')](_0x47115d['aws_access_key_id'],_0x47115d[_0xa0fd('0x84')],_0x47115d[_0xa0fd('0x85')],_0x47115d[_0xa0fd('0x86')]||_0xa0fd('0x87'),_0x47115d[_0xa0fd('0x57')],_0x47115d[_0xa0fd('0x88')]||'text')[_0xa0fd('0x12')](function(_0x2e4ec0){_0xc12eb7(null,_0x2e4ec0);})[_0xa0fd('0x16')](function(_0x33cfc6){_0xc12eb7(_0x33cfc6);});};AGIVertices[_0xa0fd('0xf')][_0xa0fd('0x89')]=function(_0x2d46f2,_0x2276f5){scripts['awsLex'](this[_0xa0fd('0xd')]['uniqueid'],_0x2d46f2[_0xa0fd('0x8a')],_0x2d46f2[_0xa0fd('0x84')],_0x2d46f2[_0xa0fd('0x8b')],_0x2d46f2['text'],_0x2d46f2[_0xa0fd('0x8c')])[_0xa0fd('0x12')](function(_0x3cee7a){_0x2276f5(null,_0x3cee7a);})[_0xa0fd('0x16')](function(_0x598374){_0x2276f5(_0x598374);});};AGIVertices['prototype'][_0xa0fd('0x8d')]=function(_0x50503e,_0xc54804,_0x3f7ce0){scripts[_0xa0fd('0x8d')](_0xc54804,_0x50503e['key'],_0x50503e[_0xa0fd('0x8e')]||_0xa0fd('0x59'))['then'](function(_0x333844){_0x3f7ce0(null,_0x333844);})['catch'](function(_0x58614d){_0x3f7ce0(_0x58614d);});};AGIVertices[_0xa0fd('0xf')][_0xa0fd('0x8f')]=function(_0x2438a0,_0x4dcb19,_0x2fb169){scripts['tildeASR'](_0x4dcb19,_0x2438a0[_0xa0fd('0x90')],_0x2438a0[_0xa0fd('0x91')],_0x2438a0[_0xa0fd('0x6e')])[_0xa0fd('0x12')](function(_0x342216){_0x2fb169(null,_0x342216);})['catch'](function(_0xb491e6){_0x2fb169(_0xb491e6);});};AGIVertices[_0xa0fd('0xf')][_0xa0fd('0x92')]=function(_0x2f712f){var _0x3f630a=_[_0xa0fd('0x63')](verticesWithRetry,_0x2f712f[_0xa0fd('0x36')])?_0x2f712f:_['clone'](_0x2f712f);for(var _0xc9573f in _0x3f630a){if(_0x3f630a[_0xa0fd('0x93')](_0xc9573f)){if(_0x3f630a[_0xc9573f]&&_[_0xa0fd('0x94')](_0x3f630a[_0xc9573f])){if(_[_0xa0fd('0x63')](recursiveMapAttributes,_0xc9573f)){_0x3f630a[_0xc9573f]=this[_0xa0fd('0x95')](_0x3f630a[_0xc9573f]);}else{_0x3f630a[_0xc9573f]=this['replaceAllVariables'](_0x3f630a[_0xc9573f]);}}}}return _0x3f630a;};AGIVertices[_0xa0fd('0xf')][_0xa0fd('0x96')]=function(_0x14ea72){for(var _0x2c7bdf in _0x14ea72){if(_0x14ea72['hasOwnProperty'](_0x2c7bdf)){if(_['isPlainObject'](_0x14ea72[_0x2c7bdf])){this[_0xa0fd('0x96')](_0x14ea72[_0x2c7bdf]);}else if(_['isArray'](_0x14ea72[_0x2c7bdf])){for(var _0x345ed6=0x0;_0x345ed6<_0x14ea72[_0x2c7bdf][_0xa0fd('0x97')];_0x345ed6++){this['recursiveNodeIndex'](_0x14ea72[_0x2c7bdf][_0x345ed6]);}}else if(_[_0xa0fd('0x94')](_0x14ea72[_0x2c7bdf])){_0x14ea72[_0x2c7bdf]=this['replaceAllVariables'](_0x14ea72[_0x2c7bdf]);}}}};AGIVertices[_0xa0fd('0xf')][_0xa0fd('0x98')]=function(_0x4e335c,_0x545f2f){for(var _0x108fa0 in _0x4e335c){if(_0x4e335c['hasOwnProperty'](_0x108fa0)){if(_[_0xa0fd('0x99')](_0x4e335c[_0x108fa0])){if(!_['isEmpty'](_0x4e335c[_0x108fa0])){this[_0xa0fd('0x98')](_0x4e335c[_0x108fa0],util['format'](_0xa0fd('0x9a'),_0x545f2f,_0x108fa0));}}else if(_[_0xa0fd('0x9b')](_0x4e335c[_0x108fa0])){for(var _0x2ca1c9=0x0;_0x2ca1c9<_0x4e335c[_0x108fa0][_0xa0fd('0x97')];_0x2ca1c9++){this['saveRestApiResult'](_0x4e335c[_0x108fa0][_0x2ca1c9],util[_0xa0fd('0x26')](_0xa0fd('0x9a'),_0x545f2f,_0x108fa0+'['+_0x2ca1c9+']'));}}else{if(!_['isNil'](_0x4e335c[_0x108fa0])){this[_0xa0fd('0xd')][_0xa0fd('0x9c')](util['format'](_0xa0fd('0x9a'),_0x545f2f,_0x108fa0),_0x4e335c[_0x108fa0]);}}}}};AGIVertices[_0xa0fd('0xf')]['replaceObjectAllVariables']=function(_0x7ba27f){try{var _0x384c86=JSON[_0xa0fd('0x67')](_0x7ba27f);this[_0xa0fd('0x96')](_0x384c86);return JSON[_0xa0fd('0x70')](_0x384c86);}catch(_0xf65b43){return this[_0xa0fd('0x9d')](_0x7ba27f);}};AGIVertices[_0xa0fd('0xf')][_0xa0fd('0x9d')]=function(_0x4875de){var _0x197a0e=_0x4875de[_0xa0fd('0x9e')]('{');for(var _0x4a7beb=0x1;_0x4a7beb<_0x197a0e['length'];_0x4a7beb+=0x1){var _0x45861e=_0x197a0e[_0x4a7beb][_0xa0fd('0x9e')]('}');if(_0x45861e[_0xa0fd('0x97')]>0x1){_0x4875de=_0x4875de[_0xa0fd('0x9f')]('{'+_0x45861e[0x0]+'}',this[_0xa0fd('0xd')]['getVariable'](_0x45861e[0x0])[_0xa0fd('0xa0')]||_0x45861e[0x0]);}}if(_0x197a0e[_0xa0fd('0x97')]===0x1){return _0x4875de[_0xa0fd('0x47')]();}return this['replaceAllVariables'](_0x4875de);};AGIVertices['prototype'][_0xa0fd('0xa1')]=function(_0x4418c5,_0x1b0de8){var _0x7698a0=this[_0xa0fd('0xd')]['getVariable'](_0x4418c5);if(_0x7698a0[_0xa0fd('0xa2')]===-0x1){return _0x7698a0;}logger[_0xa0fd('0x29')](util[_0xa0fd('0x26')](_0xa0fd('0xa3'),_0x1b0de8,_0x7698a0[_0xa0fd('0xa0')]));return this[_0xa0fd('0xd')]['setVariable'](_0x1b0de8,_0x7698a0[_0xa0fd('0xa0')]);};AGIVertices[_0xa0fd('0xf')][_0xa0fd('0xa4')]=function(_0x3f6f09){return _0x3f6f09&&_0x3f6f09!=='0'&&_0x3f6f09!=='-1'&&_0x3f6f09!=='';};AGIVertices[_0xa0fd('0xf')][_0xa0fd('0xa5')]=function(_0x294b03){this['createSquareDetailsReport'][_0xa0fd('0x6d')](this,_0x294b03,'-');_0x294b03['retry']=_0x294b03['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices['prototype']['mrcpsynth']=function(_0x54b24f){logger['info'](util[_0xa0fd('0x26')](_0xa0fd('0xa6'),_0x54b24f['label']));if(!this[_0xa0fd('0xa4')](_0x54b24f[_0xa0fd('0x57')])){return this[_0xa0fd('0xd')][_0xa0fd('0xa7')]('no\x20text\x20configured');}var _0xbbbadb='\x22'+_0x54b24f[_0xa0fd('0x57')]+'\x22';if(this[_0xa0fd('0xa4')](_0x54b24f[_0xa0fd('0x75')])){_0xbbbadb+=','+_0x54b24f[_0xa0fd('0x75')];}var _0x239982=this['channel'][_0xa0fd('0x51')](_0xa0fd('0xa8'),_0xbbbadb);if(_0x239982[_0xa0fd('0xa2')]===-0x1){return _0x239982;}return this[_0xa0fd('0xd')][_0xa0fd('0xa7')](util[_0xa0fd('0x26')]('Executed\x20command\x20MRCPSynth\x20%s',_0xbbbadb));};AGIVertices[_0xa0fd('0xf')][_0xa0fd('0xa9')]=function(_0x4bbe91){logger[_0xa0fd('0x29')](util['format'](_0xa0fd('0xaa'),_0x4bbe91['label']));if(!this['isConfigured'](_0x4bbe91[_0xa0fd('0xab')])){return this[_0xa0fd('0xd')][_0xa0fd('0xa7')](_0xa0fd('0xac'));}var _0x22619c=_0x4bbe91[_0xa0fd('0xab')];if(this[_0xa0fd('0xa4')](_0x4bbe91['options'])){_0x22619c+=','+_0x4bbe91[_0xa0fd('0x75')];}var _0x5d87ad=this[_0xa0fd('0xd')]['exec'](_0xa0fd('0xad'),_0x22619c);if(_0x5d87ad[_0xa0fd('0xa2')]===-0x1){return _0x5d87ad;}var _0x2a15f2=this[_0xa0fd('0xa1')](_0xa0fd('0xae'),'MRCP_RECOG_CONFIDENCE');if(_0x2a15f2[_0xa0fd('0xa2')]===-0x1){return _0x2a15f2;}var _0x5d847d=this[_0xa0fd('0xa1')]('RECOG_INPUT()',_0xa0fd('0xaf'));if(_0x5d847d['result']===-0x1){return _0x5d847d;}var _0x269b52=this['getAndSetVariable'](_0xa0fd('0xb0'),'MRCP_RECOG_INSTANCE');if(_0x269b52[_0xa0fd('0xa2')]===-0x1){return _0x269b52;}return this['channel']['noop'](util[_0xa0fd('0x26')](_0xa0fd('0xb1'),_0x22619c));};AGIVertices['prototype'][_0xa0fd('0xb2')]=function(_0x585bc9){logger['info'](util['format'](_0xa0fd('0xb3'),_0x585bc9['label']));return this['channel'][_0xa0fd('0xb2')]([_0x585bc9['command'],_0x585bc9[_0xa0fd('0xb4')]]);};AGIVertices[_0xa0fd('0xf')][_0xa0fd('0xb5')]=function(_0x575f53){logger[_0xa0fd('0x29')](util[_0xa0fd('0x26')](_0xa0fd('0xb6'),_0x575f53[_0xa0fd('0x35')]));if(this[_0xa0fd('0xa4')](_0x575f53[_0xa0fd('0x61')])){logger[_0xa0fd('0x29')](util[_0xa0fd('0x26')](_0xa0fd('0xb7'),_0x575f53[_0xa0fd('0x61')]));var _0x52e4c8=this[_0xa0fd('0xd')][_0xa0fd('0xb8')](_0x575f53[_0xa0fd('0x61')]);if(_0x52e4c8['result']===-0x1){return _0x52e4c8;}}return this[_0xa0fd('0xd')]['answer']();};AGIVertices[_0xa0fd('0xf')][_0xa0fd('0x46')]=function(_0x333c83){logger[_0xa0fd('0x29')](util['format'](_0xa0fd('0xb9'),_0x333c83[_0xa0fd('0x35')]));if(!this[_0xa0fd('0xa4')](_0x333c83[_0xa0fd('0xba')])){return this['channel'][_0xa0fd('0x2f')](_0x333c83,_0xa0fd('0xbb'));}_0x333c83[_0xa0fd('0x45')]=moment();if(this['isConfigured'](_0x333c83['delay'])){_0x333c83[_0xa0fd('0x45')]=moment()[_0xa0fd('0xbc')](_0x333c83[_0xa0fd('0xbd')],_0xa0fd('0xbe'));}if(!this[_0xa0fd('0xa4')](_0x333c83[_0xa0fd('0xbf')])){_0x333c83[_0xa0fd('0xbf')]=0x2;}this[_0xa0fd('0x3f')][_0xa0fd('0x6d')](this,_0x333c83);return this[_0xa0fd('0xd')][_0xa0fd('0xa7')](util[_0xa0fd('0x26')](_0xa0fd('0xc0'),_0x333c83[_0xa0fd('0xc1')],_0x333c83['list_id'],_0x333c83[_0xa0fd('0x45')]));};AGIVertices[_0xa0fd('0xf')][_0xa0fd('0xc2')]=function(_0x45e291){logger[_0xa0fd('0x29')](util['format'](_0xa0fd('0xc3'),_0x45e291[_0xa0fd('0x35')]));var _0x2b6d98=this[_0xa0fd('0xd')][_0xa0fd('0x51')](_0x45e291[_0xa0fd('0xc4')],_0x45e291[_0xa0fd('0x75')]);if(_0x2b6d98[_0xa0fd('0xa2')]===-0x1){return _0x2b6d98;}return this[_0xa0fd('0xd')][_0xa0fd('0xa7')](util[_0xa0fd('0x26')](_0xa0fd('0xc5'),_0x45e291[_0xa0fd('0xc4')],_0x45e291[_0xa0fd('0x75')]));};AGIVertices[_0xa0fd('0xf')]['lumenvoxtts']=function(_0x4a8690){logger[_0xa0fd('0x29')](util[_0xa0fd('0x26')](_0xa0fd('0xc6'),_0x4a8690['label']));if(!this['isConfigured'](_0x4a8690['text'])){return this[_0xa0fd('0xd')][_0xa0fd('0xa7')]('no\x20text\x20configured');}var _0x3e028e='\x22'+_0x4a8690[_0xa0fd('0x57')]+'\x22';if(this[_0xa0fd('0xa4')](_0x4a8690[_0xa0fd('0x75')])){_0x3e028e+=','+_0x4a8690[_0xa0fd('0x75')];}var _0xd6ecdd=this[_0xa0fd('0xd')][_0xa0fd('0x51')](_0xa0fd('0xa8'),_0x3e028e);if(_0xd6ecdd[_0xa0fd('0xa2')]===-0x1){return _0xd6ecdd;}return this[_0xa0fd('0xd')][_0xa0fd('0xa7')](util['format'](_0xa0fd('0xc7'),_0x3e028e));};AGIVertices[_0xa0fd('0xf')][_0xa0fd('0xc8')]=function(_0x827eed){logger[_0xa0fd('0x29')](util[_0xa0fd('0x26')](_0xa0fd('0xc9'),_0x827eed[_0xa0fd('0x35')]));if(!this[_0xa0fd('0xa4')](_0x827eed[_0xa0fd('0x57')])){return this['channel'][_0xa0fd('0xa7')]('no\x20text\x20configured');}var _0x582997='\x22'+_0x827eed['text']+'\x22';if(this[_0xa0fd('0xa4')](_0x827eed[_0xa0fd('0x75')])){_0x582997+=','+_0x827eed[_0xa0fd('0x75')];}var _0x51ec05=this['channel'][_0xa0fd('0x51')](_0xa0fd('0xa8'),_0x582997);if(_0x51ec05[_0xa0fd('0xa2')]===-0x1){return _0x51ec05;}return this['channel'][_0xa0fd('0xa7')](util[_0xa0fd('0x26')](_0xa0fd('0xc7'),_0x582997));};AGIVertices[_0xa0fd('0xf')][_0xa0fd('0xca')]=function(_0x3077ff){logger[_0xa0fd('0x29')](util['format']('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x3077ff[_0xa0fd('0x35')]));if(!this[_0xa0fd('0xa4')](_0x3077ff[_0xa0fd('0xab')])){return this['channel']['noop']('no\x20grammar\x20configured');}var _0x2ddfa6=_0x3077ff['grammar'];if(this[_0xa0fd('0xa4')](_0x3077ff[_0xa0fd('0x75')])){_0x2ddfa6+=','+_0x3077ff['options'];}var _0x2a5d54=this[_0xa0fd('0xd')][_0xa0fd('0x51')](_0xa0fd('0xad'),_0x2ddfa6);if(_0x2a5d54[_0xa0fd('0xa2')]===-0x1){return _0x2a5d54;}var _0x483258=this[_0xa0fd('0xa1')](_0xa0fd('0xae'),_0xa0fd('0xcb'));if(_0x483258[_0xa0fd('0xa2')]===-0x1){return _0x483258;}var _0x5251be=this[_0xa0fd('0xa1')](_0xa0fd('0xcc'),_0xa0fd('0xcd'));if(_0x5251be[_0xa0fd('0xa2')]===-0x1){return _0x5251be;}var _0x2cbf51=this[_0xa0fd('0xa1')]('RECOG_INSTANCE()',_0xa0fd('0xce'));if(_0x2cbf51[_0xa0fd('0xa2')]===-0x1){return _0x2cbf51;}return this['channel'][_0xa0fd('0xa7')](util['format'](_0xa0fd('0xb1'),_0x2ddfa6));};AGIVertices[_0xa0fd('0xf')][_0xa0fd('0xcf')]=function(_0x43324d){logger['info'](util[_0xa0fd('0x26')](_0xa0fd('0xd0'),_0x43324d[_0xa0fd('0x35')]));if(!this[_0xa0fd('0xa4')](_0x43324d['grammar'])){return this['channel'][_0xa0fd('0xa7')]('no\x20grammar\x20configured');}var _0x69ebb3=_0x43324d[_0xa0fd('0xab')];if(this[_0xa0fd('0xa4')](_0x43324d[_0xa0fd('0x75')])){_0x69ebb3+=','+_0x43324d[_0xa0fd('0x75')];}var _0x389ce9=this[_0xa0fd('0xd')]['exec'](_0xa0fd('0xad'),_0x69ebb3);if(_0x389ce9[_0xa0fd('0xa2')]===-0x1){return _0x389ce9;}var _0x43d934=this[_0xa0fd('0xa1')]('RECOG_CONFIDENCE()',_0xa0fd('0xd1'));if(_0x43d934[_0xa0fd('0xa2')]===-0x1){return _0x43d934;}var _0x13e0fd=this[_0xa0fd('0xa1')](_0xa0fd('0xcc'),_0xa0fd('0xd2'));if(_0x13e0fd[_0xa0fd('0xa2')]===-0x1){return _0x13e0fd;}var _0x39c4c4=this['getAndSetVariable'](_0xa0fd('0xb0'),_0xa0fd('0xd3'));if(_0x39c4c4[_0xa0fd('0xa2')]===-0x1){return _0x39c4c4;}return this[_0xa0fd('0xd')][_0xa0fd('0xa7')](util['format'](_0xa0fd('0xb1'),_0x69ebb3));};AGIVertices[_0xa0fd('0xf')][_0xa0fd('0xd4')]=function(_0x5bbfb9){logger['info'](util['format'](_0xa0fd('0xd5'),_0x5bbfb9[_0xa0fd('0x35')]));if(!this[_0xa0fd('0xa4')](_0x5bbfb9['odbc_id'])){return this[_0xa0fd('0xd')]['error'](_0x5bbfb9,_0xa0fd('0xd6'));}var _0x5d506d=this['getSquareOdbc']['sync'](this,_0x5bbfb9['odbc_id']);if(!_0x5d506d){return this['channel'][_0xa0fd('0x2f')](_0x5bbfb9,_0xa0fd('0xd7'));}if(!this[_0xa0fd('0xa4')](_0x5bbfb9['query'])){return this[_0xa0fd('0xd')][_0xa0fd('0x2f')](_0x5bbfb9,'no\x20query\x20configured');}var _0x41bcb3=_0x5bbfb9['query'][_0xa0fd('0x53')](/(\r\n|\n|\r)/gm,'\x20');this['channel'][_0xa0fd('0xa7')](util['format'](_0xa0fd('0xd8'),_0x41bcb3));var _0x5ca26c=this[_0xa0fd('0x27')][_0xa0fd('0x6d')](this,_0x5d506d,_0x41bcb3);this[_0xa0fd('0x33')][_0xa0fd('0x6d')](this,_0x5bbfb9,_0x41bcb3);if(!this['isConfigured'](_0x5bbfb9[_0xa0fd('0xd9')])){return this[_0xa0fd('0xd')][_0xa0fd('0xa7')](_0xa0fd('0xda'));}var _0x226ad4=this[_0xa0fd('0x10')][_0xa0fd('0x6d')](this,_0x5bbfb9['variable_id']);if(!_0x226ad4){return this[_0xa0fd('0xd')][_0xa0fd('0x2f')](_0x5bbfb9,'no\x20variable\x20found');}var _0x2a48b2=this;_0x5ca26c[_0xa0fd('0xdb')](function(_0x34bb25,_0xf5dff9){Object['keys'](_0x34bb25)[_0xa0fd('0xdb')](function(_0x2acc74){_0x2a48b2[_0xa0fd('0xd')][_0xa0fd('0x9c')](util[_0xa0fd('0x26')](_0xa0fd('0xdc'),_0x226ad4,_0xf5dff9,_0x2acc74),_0x34bb25[_0x2acc74]);});});this[_0xa0fd('0xd')]['setVariable'](util[_0xa0fd('0x26')]('%s_ROWS_COUNT',_0x226ad4),_0x5ca26c[_0xa0fd('0x97')]);return this['channel']['noop'](util['format'](_0xa0fd('0xdd'),_0x226ad4));};AGIVertices['prototype'][_0xa0fd('0xde')]=function(_0x2b6727){logger[_0xa0fd('0xdf')](util[_0xa0fd('0x26')](_0xa0fd('0xe0'),_0x2b6727[_0xa0fd('0x35')]));if(!this['isConfigured'](_0x2b6727['sip_id'])){return this[_0xa0fd('0xd')][_0xa0fd('0x2f')](_0x2b6727,_0xa0fd('0xe1'));}var _0x4c940d=this[_0xa0fd('0x1c')]['sync'](this,_0x2b6727[_0xa0fd('0xe2')]);if(!_0x4c940d){return this[_0xa0fd('0xd')][_0xa0fd('0x2f')](_0x2b6727,_0xa0fd('0xe3'));}var _0x285d31=this[_0xa0fd('0xd')][_0xa0fd('0x51')](_0xa0fd('0xe4'),[util[_0xa0fd('0x26')](_0xa0fd('0xe5'),_0x4c940d),_0x2b6727[_0xa0fd('0x61')],_0x2b6727[_0xa0fd('0xe6')],_0x2b6727[_0xa0fd('0x5f')]]);if(_0x285d31['result']===-0x1){return _0x285d31;}return this['channel'][_0xa0fd('0xa7')](util[_0xa0fd('0x26')](_0xa0fd('0xe7'),_0xa0fd('0xe4')));};AGIVertices[_0xa0fd('0xf')][_0xa0fd('0xe8')]=function(_0x4c4e40){logger[_0xa0fd('0x29')](util[_0xa0fd('0x26')]('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x4c4e40[_0xa0fd('0x35')]));if(!this[_0xa0fd('0xa4')](_0x4c4e40[_0xa0fd('0x77')])){return this[_0xa0fd('0xd')][_0xa0fd('0xa7')](_0xa0fd('0xe9'));}if(!this[_0xa0fd('0xa4')](_0x4c4e40[_0xa0fd('0x57')])){return this[_0xa0fd('0xd')][_0xa0fd('0xa7')](_0xa0fd('0xea'));}this[_0xa0fd('0xd')][_0xa0fd('0xeb')]=!![];this[_0xa0fd('0x33')](_0x4c4e40);this[_0xa0fd('0x3e')](_0x4c4e40['text'],'in','','');this['channel'][_0xa0fd('0xa7')](util[_0xa0fd('0x26')](_0xa0fd('0xec'),_0x4c4e40[_0xa0fd('0x57')]));var _0x4dfc2f=this['googleDialogflow'][_0xa0fd('0x6d')](this,_0x4c4e40);if(_0x4dfc2f){for(var _0x19bc9b in _0x4dfc2f){if(_0x4dfc2f[_0xa0fd('0x93')](_0x19bc9b)){this[_0xa0fd('0xd')]['setVariable'](util[_0xa0fd('0x26')](_0xa0fd('0xed'),_0x19bc9b[_0xa0fd('0xee')]()),_0x4dfc2f[_0x19bc9b]);}}this[_0xa0fd('0x3e')](_0x4dfc2f[_0xa0fd('0xef')],'out',_0xa0fd('0xe8'),'');return this['channel'][_0xa0fd('0xa7')](util['format'](_0xa0fd('0xf0'),_0x4dfc2f[_0xa0fd('0xef')]));}return this[_0xa0fd('0xd')]['error'](_0x4c4e40,_0xa0fd('0xf1'));};AGIVertices[_0xa0fd('0xf')][_0xa0fd('0xf2')]=function(_0x33852f){logger[_0xa0fd('0x29')](util[_0xa0fd('0x26')](_0xa0fd('0xf3'),_0x33852f[_0xa0fd('0x35')]));if(!this['isConfigured'](_0x33852f[_0xa0fd('0x7a')])){return this[_0xa0fd('0xd')]['noop'](_0xa0fd('0xf4'));}if(!this[_0xa0fd('0xa4')](_0x33852f[_0xa0fd('0x7b')])){return this[_0xa0fd('0xd')][_0xa0fd('0xa7')](_0xa0fd('0xf5'));}if(!this[_0xa0fd('0xa4')](_0x33852f[_0xa0fd('0xf6')])){return this[_0xa0fd('0xd')][_0xa0fd('0xa7')]('no\x20private_key\x20configured');}if(!this[_0xa0fd('0xa4')](_0x33852f[_0xa0fd('0x7c')])){return this[_0xa0fd('0xd')][_0xa0fd('0xa7')](_0xa0fd('0xf7'));}if(!this[_0xa0fd('0xa4')](_0x33852f['text'])){return this[_0xa0fd('0xd')][_0xa0fd('0xa7')]('no\x20text\x20configured');}this[_0xa0fd('0xd')]['bot']=!![];this[_0xa0fd('0x33')](_0x33852f);this[_0xa0fd('0x3e')](_0x33852f[_0xa0fd('0x57')],'in','','');this[_0xa0fd('0xd')][_0xa0fd('0xa7')](util[_0xa0fd('0x26')](_0xa0fd('0xf8'),_0x33852f[_0xa0fd('0x57')]));var _0xa60500=this[_0xa0fd('0x79')][_0xa0fd('0x6d')](this,_0x33852f);if(_0xa60500){for(var _0x2590c4 in _0xa60500){if(_0xa60500[_0xa0fd('0x93')](_0x2590c4)){if(_0x2590c4!==_0xa0fd('0xf9')){this['channel']['setVariable'](util[_0xa0fd('0x26')](_0xa0fd('0xed'),_0x2590c4[_0xa0fd('0xee')]()),_0xa60500[_0x2590c4]);}}}this['createSquareMessage'](_0xa60500[_0xa0fd('0xef')],_0xa0fd('0xfa'),'dialogflowV2',_0xa60500[_0xa0fd('0xf9')]);return this['channel'][_0xa0fd('0xa7')](util[_0xa0fd('0x26')](_0xa0fd('0xfb'),_0xa60500[_0xa0fd('0xef')]));}return this[_0xa0fd('0xd')][_0xa0fd('0x2f')](_0x33852f,_0xa0fd('0xfc'));};AGIVertices[_0xa0fd('0xf')][_0xa0fd('0xfd')]=function(_0x549ac2){logger['info'](util['format'](_0xa0fd('0xfe'),_0x549ac2[_0xa0fd('0x35')]));if(!this[_0xa0fd('0xa4')](_0x549ac2[_0xa0fd('0xff')])){return this['channel']['noop']('no\x20ndauth\x20url\x20configured');}if(!this[_0xa0fd('0xa4')](_0x549ac2[_0xa0fd('0x100')])){return this[_0xa0fd('0xd')][_0xa0fd('0xa7')](_0xa0fd('0x101'));}if(!this['isConfigured'](_0x549ac2[_0xa0fd('0x102')])){return this['channel'][_0xa0fd('0xa7')]('no\x20password\x20configured');}if(!this[_0xa0fd('0xa4')](_0x549ac2[_0xa0fd('0x103')])){return this[_0xa0fd('0xd')]['noop'](_0xa0fd('0xea'));}this['channel'][_0xa0fd('0xeb')]=!![];this['createSquareDetailsReport'](_0x549ac2);this[_0xa0fd('0x3e')](_0x549ac2[_0xa0fd('0x57')],'in','','');this['channel'][_0xa0fd('0xa7')](util[_0xa0fd('0x26')](_0xa0fd('0x104'),_0x549ac2[_0xa0fd('0x57')]));var _0x14df37=this[_0xa0fd('0x7d')][_0xa0fd('0x6d')](this,_0x549ac2);if(_0x14df37){for(var _0x861438 in _0x14df37){if(_0x14df37[_0xa0fd('0x93')](_0x861438)){this[_0xa0fd('0xd')][_0xa0fd('0x9c')](util[_0xa0fd('0x26')]('SESTEK_NDA_%s',_0x861438['toUpperCase']()),_0x14df37[_0x861438]);}}this[_0xa0fd('0x3e')](_0x14df37[_0xa0fd('0xef')],'out',_0xa0fd('0xfd'),'');if(_0x14df37[_0xa0fd('0x105')]){this['channel'][_0xa0fd('0xa7')](util[_0xa0fd('0x26')](_0xa0fd('0x106'),_0x14df37[_0xa0fd('0x105')]));var _0x434d65=this[_0xa0fd('0xd')][_0xa0fd('0x107')](_0x14df37[_0xa0fd('0x105')]);try{fs[_0xa0fd('0x108')](_0x14df37[_0xa0fd('0x105')]+_0xa0fd('0x109'));}catch(_0x384fd9){logger[_0xa0fd('0x2f')](_0x384fd9);}return _0x434d65;}else{return this['channel'][_0xa0fd('0xa7')](util[_0xa0fd('0x26')](_0xa0fd('0x10a'),_0x14df37[_0xa0fd('0xef')]));}}return this['channel'][_0xa0fd('0x2f')](_0x549ac2,_0xa0fd('0x10b'));};AGIVertices[_0xa0fd('0xf')][_0xa0fd('0x10c')]=function(_0x548cd1){logger['info'](util[_0xa0fd('0x26')](_0xa0fd('0x10d'),_0x548cd1['label']));return this['channel'][_0xa0fd('0xa7')](_0xa0fd('0x10c'));};AGIVertices['prototype']['ext_dial']=function(_0x33639b){logger[_0xa0fd('0x29')](util[_0xa0fd('0x26')](_0xa0fd('0x10e'),_0x33639b[_0xa0fd('0x35')]));var _0x426988='';if(_0x33639b[_0xa0fd('0x10f')]){if(!this[_0xa0fd('0xa4')](_0x33639b['trunk_id'])){return this[_0xa0fd('0xd')][_0xa0fd('0x2f')](_0x33639b,_0xa0fd('0x110'));}else{var _0x3de6da=parseInt(_0x33639b[_0xa0fd('0x10f')],0xa);if(isNaN(_0x3de6da)){_0x426988=_0x33639b[_0xa0fd('0x10f')];}else{_0x426988=this['getTrunk'][_0xa0fd('0x6d')](this,_0x33639b[_0xa0fd('0x10f')]);if(!_0x426988){return this[_0xa0fd('0xd')][_0xa0fd('0x2f')](_0x33639b,'no\x20trunk\x20found');}}}}else if(_0x33639b['trunk_name']){_0x426988=_0x33639b[_0xa0fd('0x111')];}else{return this[_0xa0fd('0xd')]['error'](_0x33639b,_0xa0fd('0x110'));}var _0x3b43b3=this[_0xa0fd('0xd')][_0xa0fd('0x51')](_0xa0fd('0xe4'),[util[_0xa0fd('0x26')](_0xa0fd('0x112'),_0x426988,_0x33639b[_0xa0fd('0xc1')]),_0x33639b[_0xa0fd('0x61')],_0x33639b[_0xa0fd('0xe6')],_0x33639b['url']]);if(_0x3b43b3['result']===-0x1){return _0x3b43b3;}return this[_0xa0fd('0xd')][_0xa0fd('0xa7')](util[_0xa0fd('0x26')](_0xa0fd('0xe7'),_0xa0fd('0xe4')));};AGIVertices['prototype']['finally']=function(_0x362771){logger[_0xa0fd('0x29')](util['format'](_0xa0fd('0x113'),_0x362771[_0xa0fd('0x35')]));return this['channel']['noop'](_0xa0fd('0x114'));};AGIVertices[_0xa0fd('0xf')][_0xa0fd('0xb')]=function(_0x39e2bf){logger['info'](util[_0xa0fd('0x26')](_0xa0fd('0x115'),_0x39e2bf[_0xa0fd('0x35')]));if(_0x39e2bf[_0xa0fd('0x116')]===0x0){return this[_0xa0fd('0xa5')](_0x39e2bf);}_0x39e2bf[_0xa0fd('0x116')]-=0x1;if(!this[_0xa0fd('0xa4')](_0x39e2bf[_0xa0fd('0x117')])){return this[_0xa0fd('0xd')]['error'](_0x39e2bf,_0xa0fd('0x118'));}var _0x2990ab=this['getSound'][_0xa0fd('0x6d')](this,_0x39e2bf['file_id']);if(!_0x2990ab){return this[_0xa0fd('0xd')][_0xa0fd('0x2f')](_0x39e2bf,'no\x20file\x20audio\x20found');}if(!this[_0xa0fd('0xa4')](_0x39e2bf[_0xa0fd('0xd9')])){return this[_0xa0fd('0xd')][_0xa0fd('0x2f')](_0xa0fd('0xda'));}var _0x55ff3f=this['channel'][_0xa0fd('0x119')](_0x2990ab,_0x39e2bf[_0xa0fd('0x11a')],_0x39e2bf[_0xa0fd('0x11b')]);var _0x45b2e1=_0x55ff3f[_0xa0fd('0xa2')]?_0x55ff3f[_0xa0fd('0xa2')][_0xa0fd('0x47')]():'';logger['info'](_0xa0fd('0x11c'),JSON[_0xa0fd('0x70')](_0x55ff3f));if(_0x55ff3f[_0xa0fd('0xa2')]===-0x1){this[_0xa0fd('0x33')][_0xa0fd('0x6d')](this,_0x39e2bf,_0x45b2e1);return _0x55ff3f;}else if(_0x55ff3f['extra']===_0xa0fd('0x61')){_0x55ff3f[_0xa0fd('0xa2')]=_0x45b2e1[_0xa0fd('0x97')]>=parseInt(_0x39e2bf[_0xa0fd('0x11d')])?'x':'i';}else{_0x55ff3f[_0xa0fd('0xa2')]=_0x45b2e1[_0xa0fd('0x97')]>=parseInt(_0x39e2bf['mindigit'])&&_0x45b2e1[_0xa0fd('0x97')]<=parseInt(_0x39e2bf['maxdigit'])?'x':'i';}var _0x5ced4f=this[_0xa0fd('0x10')][_0xa0fd('0x6d')](this,_0x39e2bf['variable_id']);if(!_0x5ced4f){return this[_0xa0fd('0xd')][_0xa0fd('0x2f')](_0x39e2bf,_0xa0fd('0x11e'));}this[_0xa0fd('0xd')][_0xa0fd('0x9c')](_0x5ced4f,_0x45b2e1);if(this[_0xa0fd('0xa4')](_0x39e2bf[_0xa0fd('0x11f')])){var _0x84c94=parseInt(_0x39e2bf['hiddendigitsnum'],0xa);var _0x6fec6c=rs[_0xa0fd('0x120')]({'charset':'*','length':_0x84c94});var _0xfd47ab=_0x45b2e1['length'];if(_0xfd47ab>0x0){if(_0xfd47ab>_0x84c94){this[_0xa0fd('0x33')][_0xa0fd('0x6d')](this,_0x39e2bf,_0x39e2bf['hiddendigitspos']===_0xa0fd('0x121')?_0x6fec6c+_0x45b2e1[_0xa0fd('0x122')](_0x84c94):_0x45b2e1[_0xa0fd('0x122')](0x0,_0xfd47ab-_0x84c94)+_0x6fec6c);}else{this['createSquareDetailsReport'][_0xa0fd('0x6d')](this,_0x39e2bf,rs[_0xa0fd('0x120')]({'charset':'*','length':_0xfd47ab}));}}else{this['createSquareDetailsReport'][_0xa0fd('0x6d')](this,_0x39e2bf,'');}}else{this[_0xa0fd('0x33')][_0xa0fd('0x6d')](this,_0x39e2bf,_0x45b2e1);}return _0x55ff3f;};AGIVertices[_0xa0fd('0xf')]['getsecretdigits']=function(_0x499956){logger['info'](util['format'](_0xa0fd('0x123'),_0x499956[_0xa0fd('0x35')]));return this[_0xa0fd('0xb')](_0x499956);};AGIVertices[_0xa0fd('0xf')][_0xa0fd('0x124')]=function(_0xebb0e0){logger[_0xa0fd('0x29')](util[_0xa0fd('0x26')](_0xa0fd('0x125'),_0xebb0e0[_0xa0fd('0x35')]));this['createSquareDetailsReport'][_0xa0fd('0x6d')](this,_0xebb0e0,_0xebb0e0[_0xa0fd('0x126')]);return this['channel'][_0xa0fd('0xa7')](util['format'](_0xa0fd('0x127'),_0xebb0e0[_0xa0fd('0x126')]));};AGIVertices['prototype']['awspolly']=function(_0x184747){logger[_0xa0fd('0x29')](util[_0xa0fd('0x26')](_0xa0fd('0x128'),_0x184747[_0xa0fd('0x35')]));if(!this[_0xa0fd('0xa4')](_0x184747[_0xa0fd('0x8a')])||!this[_0xa0fd('0xa4')](_0x184747['aws_secret_access_key'])){return this[_0xa0fd('0xd')][_0xa0fd('0xa7')](_0xa0fd('0x129'));}if(!this[_0xa0fd('0xa4')](_0x184747['text'])){return this[_0xa0fd('0xd')][_0xa0fd('0xa7')](_0xa0fd('0xea'));}this['channel'][_0xa0fd('0xa7')](util[_0xa0fd('0x26')](_0xa0fd('0x12a'),_0x184747[_0xa0fd('0x57')]));var _0x169292=this['awsPolly'][_0xa0fd('0x6d')](this,_0x184747);if(_0x169292){this['channel'][_0xa0fd('0xa7')](util[_0xa0fd('0x26')](_0xa0fd('0x12b'),_0x169292));var _0x1540d0=this[_0xa0fd('0xd')][_0xa0fd('0x107')](_0x169292);try{fs[_0xa0fd('0x108')](_0x169292+_0xa0fd('0x109'));}catch(_0x23945a){logger[_0xa0fd('0x2f')](_0x23945a);}return _0x1540d0;}return this[_0xa0fd('0xd')][_0xa0fd('0x2f')](_0x184747,_0xa0fd('0x12c'));};AGIVertices[_0xa0fd('0xf')][_0xa0fd('0x12d')]=function(_0x206d47){logger[_0xa0fd('0x29')](util['format'](_0xa0fd('0x12e'),_0x206d47['label']));if(!this[_0xa0fd('0xa4')](_0x206d47[_0xa0fd('0x8a')])||!this['isConfigured'](_0x206d47['aws_secret_access_key'])){return this[_0xa0fd('0xd')][_0xa0fd('0xa7')](_0xa0fd('0x129'));}if(!this[_0xa0fd('0xa4')](_0x206d47[_0xa0fd('0x8c')])){return this[_0xa0fd('0xd')]['noop'](_0xa0fd('0x12f'));}if(!this[_0xa0fd('0xa4')](_0x206d47['text'])){return this[_0xa0fd('0xd')][_0xa0fd('0xa7')](_0xa0fd('0xea'));}this['channel'][_0xa0fd('0xeb')]=!![];this[_0xa0fd('0x33')](_0x206d47);this[_0xa0fd('0x3e')](_0x206d47['text'],'in','','');this[_0xa0fd('0xd')]['noop'](util[_0xa0fd('0x26')](_0xa0fd('0x130'),_0x206d47[_0xa0fd('0x57')]));var _0x1ed7c4=this[_0xa0fd('0x89')][_0xa0fd('0x6d')](this,_0x206d47);if(_0x1ed7c4){for(var _0xe2fb30 in _0x1ed7c4){if(_0x1ed7c4[_0xa0fd('0x93')](_0xe2fb30)&&_[_0xa0fd('0x94')](_0x1ed7c4[_0xe2fb30])){this[_0xa0fd('0xd')][_0xa0fd('0x9c')](util[_0xa0fd('0x26')](_0xa0fd('0x131'),_0xe2fb30[_0xa0fd('0xee')]()),_0x1ed7c4[_0xe2fb30]);}}if(_['isNil'](_0x1ed7c4[_0xa0fd('0x73')])){return this[_0xa0fd('0xd')][_0xa0fd('0xa7')](_0xa0fd('0x132'));}else{this[_0xa0fd('0x3e')](_0x1ed7c4[_0xa0fd('0x73')],_0xa0fd('0xfa'),_0xa0fd('0x133'),'');return this[_0xa0fd('0xd')]['noop'](util[_0xa0fd('0x26')]('Amazon\x20Lex\x20Result\x20%s',_0x1ed7c4[_0xa0fd('0x73')]));}}return this[_0xa0fd('0xd')]['error'](_0x206d47,'Amazon\x20Lex\x20is\x20unreachable');};AGIVertices['prototype'][_0xa0fd('0x134')]=function(_0x5a6a2c){logger[_0xa0fd('0x29')](util[_0xa0fd('0x26')](_0xa0fd('0x135'),_0x5a6a2c[_0xa0fd('0x35')],_0x5a6a2c[_0xa0fd('0x61')]));if(!this[_0xa0fd('0xa4')](_0x5a6a2c[_0xa0fd('0x77')])){return this[_0xa0fd('0xd')][_0xa0fd('0xa7')]('no\x20key\x20configured');}var _0x29de9b=_0xa0fd('0x136');var _0x4d1788=util[_0xa0fd('0x26')](_0xa0fd('0x137'),FILES_PATH,rs['generate'](0x4));var _0x21ce41=util[_0xa0fd('0x26')]('%s.%s',_0x4d1788,_0x29de9b);var _0x97e736=!![];if(_0x5a6a2c[_0xa0fd('0x138')]==='NOBEEP'){_0x97e736=![];}var _0x2b257c=this[_0xa0fd('0xd')][_0xa0fd('0x139')](_0x4d1788,_0x29de9b,_0x5a6a2c[_0xa0fd('0x13a')],_0x5a6a2c[_0xa0fd('0x61')],undefined,_0x97e736);if(_0x2b257c[_0xa0fd('0xa2')]!==-0x1){this[_0xa0fd('0xd')][_0xa0fd('0xa7')](util[_0xa0fd('0x26')]('google\x20%s\x20file\x20created',_0x21ce41));var _0x411298=this[_0xa0fd('0x8d')][_0xa0fd('0x6d')](this,_0x5a6a2c,_0x21ce41);if(_0x411298){for(var _0x1b9688 in _0x411298){if(_0x411298['hasOwnProperty'](_0x1b9688)){this[_0xa0fd('0xd')][_0xa0fd('0x9c')](util[_0xa0fd('0x26')](_0xa0fd('0x13b'),_0x1b9688[_0xa0fd('0xee')]()),_0x411298[_0x1b9688]);}}return this[_0xa0fd('0xd')]['noop'](util[_0xa0fd('0x26')](_0xa0fd('0x13c'),JSON[_0xa0fd('0x70')](_0x411298)));}}return _0x2b257c;};AGIVertices[_0xa0fd('0xf')][_0xa0fd('0x13d')]=function(_0x5c2b1a){logger[_0xa0fd('0x29')](util[_0xa0fd('0x26')](_0xa0fd('0x13e'),_0x5c2b1a[_0xa0fd('0x35')]));if(!this[_0xa0fd('0xa4')](_0x5c2b1a['appid'])){return this[_0xa0fd('0xd')][_0xa0fd('0xa7')]('no\x20appid\x20configured');}if(!this[_0xa0fd('0xa4')](_0x5c2b1a[_0xa0fd('0x91')])){return this[_0xa0fd('0xd')][_0xa0fd('0xa7')](_0xa0fd('0x13f'));}var _0x3af596=_0xa0fd('0x136');var _0x4ba0ea=util[_0xa0fd('0x26')](_0xa0fd('0x137'),FILES_PATH,rs[_0xa0fd('0x120')](0x4));var _0x493f9c=util[_0xa0fd('0x26')](_0xa0fd('0x9a'),_0x4ba0ea,_0x3af596);var _0x4a7236=!![];if(_0x5c2b1a[_0xa0fd('0x138')]===_0xa0fd('0x140')){_0x4a7236=![];}var _0x5b631b=this[_0xa0fd('0xd')][_0xa0fd('0x139')](_0x4ba0ea,_0x3af596,_0x5c2b1a[_0xa0fd('0x13a')],_0x5c2b1a[_0xa0fd('0x61')],undefined,_0x4a7236);if(_0x5b631b[_0xa0fd('0xa2')]!==-0x1){this[_0xa0fd('0xd')]['noop'](util['format'](_0xa0fd('0x141'),_0x493f9c));var _0x5265fa=this[_0xa0fd('0x8f')][_0xa0fd('0x6d')](this,_0x5c2b1a,_0x493f9c);if(_0x5265fa){for(var _0x3f4953 in _0x5265fa){if(_0x5265fa[_0xa0fd('0x93')](_0x3f4953)){this[_0xa0fd('0xd')]['setVariable'](util[_0xa0fd('0x26')]('TILDE_ASR_%s',_0x3f4953['toUpperCase']()),_0x5265fa[_0x3f4953]);}}return this[_0xa0fd('0xd')][_0xa0fd('0xa7')](util['format'](_0xa0fd('0x142'),JSON['stringify'](_0x5265fa)));}}return _0x5b631b;};AGIVertices['prototype'][_0xa0fd('0x143')]=function(_0x14a866){logger[_0xa0fd('0x29')](util[_0xa0fd('0x26')](_0xa0fd('0x144'),_0x14a866[_0xa0fd('0x35')]));return this[_0xa0fd('0xd')][_0xa0fd('0x145')](_0x14a866[_0xa0fd('0x146')],_0x14a866[_0xa0fd('0x3b')],_0x14a866['priority']);};AGIVertices[_0xa0fd('0xf')][_0xa0fd('0x147')]=function(_0x2ff3aa){logger[_0xa0fd('0x29')](util[_0xa0fd('0x26')](_0xa0fd('0x148'),_0x2ff3aa[_0xa0fd('0x35')]));if(!this[_0xa0fd('0xa4')](_0x2ff3aa['condition'])){return this['channel'][_0xa0fd('0x2f')](_0x2ff3aa,_0xa0fd('0x149'));}try{var _0x2f0838=eval(_0x2ff3aa[_0xa0fd('0x14a')])?_0xa0fd('0x14b'):_0xa0fd('0x14c');this[_0xa0fd('0xd')]['noop'](util['format'](_0xa0fd('0x14d'),_0x2ff3aa[_0xa0fd('0x14a')],_0x2f0838));return{'code':0xc8,'result':_0x2f0838};}catch(_0x1c90ca){return{'code':0xc8,'result':_0xa0fd('0x14c')};}};AGIVertices[_0xa0fd('0xf')][_0xa0fd('0x14e')]=function(_0x50150f){logger['info'](util[_0xa0fd('0x26')]('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x50150f[_0xa0fd('0x35')]));if(!this['isConfigured'](_0x50150f[_0xa0fd('0x14f')])){return this[_0xa0fd('0xd')][_0xa0fd('0x2f')](_0x50150f,_0xa0fd('0x150'));}var _0x39b66b=this[_0xa0fd('0x22')]['sync'](this,_0x50150f[_0xa0fd('0x14f')]);if(!_0x39b66b){return this['channel'][_0xa0fd('0x2f')](_0x50150f,'no\x20intervals\x20found');}for(var _0x41a1ac=0x0;_0x41a1ac<_0x39b66b['length'];_0x41a1ac+=0x1){var _0x1c831d=this[_0xa0fd('0xd')][_0xa0fd('0x10')](util[_0xa0fd('0x26')](_0xa0fd('0x151'),_0x39b66b[_0x41a1ac]));if(_0x1c831d['result']===-0x1){return _0x1c831d;}logger[_0xa0fd('0x29')](util[_0xa0fd('0x26')](_0xa0fd('0x152'),_0x39b66b[_0x41a1ac],_0x1c831d[_0xa0fd('0xa0')]));if(_0x1c831d[_0xa0fd('0xa0')]===_0xa0fd('0x14b')){logger[_0xa0fd('0x29')](util[_0xa0fd('0x26')](_0xa0fd('0x152'),_0x39b66b[_0x41a1ac],_0xa0fd('0x14b')));this[_0xa0fd('0xd')][_0xa0fd('0xa7')](util['format'](_0xa0fd('0x152'),_0x39b66b[_0x41a1ac],_0xa0fd('0x14b')));return{'code':0xc8,'result':_0xa0fd('0x14b')};}else{logger['info'](util['format'](_0xa0fd('0x152'),_0x39b66b[_0x41a1ac],_0xa0fd('0x14c')));this[_0xa0fd('0xd')][_0xa0fd('0xa7')](util['format'](_0xa0fd('0x152'),_0x39b66b[_0x41a1ac],_0xa0fd('0x14c')));}}return{'code':0xc8,'result':_0xa0fd('0x14c')};};AGIVertices[_0xa0fd('0xf')][_0xa0fd('0x153')]=function(_0x34f530){logger['info'](util[_0xa0fd('0x26')](_0xa0fd('0x154'),_0x34f530[_0xa0fd('0x35')]));return this[_0xa0fd('0xd')][_0xa0fd('0x153')]();};AGIVertices[_0xa0fd('0xf')][_0xa0fd('0x155')]=function(_0x117444){logger['info'](util['format'](_0xa0fd('0x156'),_0x117444['label']));if(!this[_0xa0fd('0xa4')](_0x117444[_0xa0fd('0x77')])){return this['channel']['noop'](_0xa0fd('0xe9'));}var _0x46f6dd='wav';var _0x32bde5=util['format'](_0xa0fd('0x137'),FILES_PATH,rs[_0xa0fd('0x120')](0x4));var _0x2a7bdf=util['format']('%s.%s',_0x32bde5,_0x46f6dd);var _0x5e1a61=!![];if(_0x117444['beep']===_0xa0fd('0x140')){_0x5e1a61=![];}var _0x53b749=this[_0xa0fd('0xd')][_0xa0fd('0x139')](_0x32bde5,_0x46f6dd,_0x117444[_0xa0fd('0x13a')],_0x117444['timeout'],undefined,_0x5e1a61);if(_0x53b749[_0xa0fd('0xa2')]!==-0x1){this[_0xa0fd('0xd')]['noop'](util['format'](_0xa0fd('0x157'),_0x2a7bdf));var _0x322e36=this[_0xa0fd('0x81')][_0xa0fd('0x6d')](this,_0x117444,_0x2a7bdf);if(_0x322e36){for(var _0x23fe02 in _0x322e36){if(_0x322e36[_0xa0fd('0x93')](_0x23fe02)){this[_0xa0fd('0xd')][_0xa0fd('0x9c')](util[_0xa0fd('0x26')](_0xa0fd('0x158'),_0x23fe02[_0xa0fd('0xee')]()),_0x322e36[_0x23fe02]);}}return this[_0xa0fd('0xd')][_0xa0fd('0xa7')](util[_0xa0fd('0x26')]('IspeechASR\x20Result\x20%s',JSON[_0xa0fd('0x70')](_0x322e36)));}}return _0x53b749;};AGIVertices[_0xa0fd('0xf')][_0xa0fd('0x159')]=function(_0x2d4dc4){logger[_0xa0fd('0x29')](util[_0xa0fd('0x26')](_0xa0fd('0x15a'),_0x2d4dc4[_0xa0fd('0x35')]));if(!this[_0xa0fd('0xa4')](_0x2d4dc4[_0xa0fd('0x77')])){return this[_0xa0fd('0xd')]['noop']('no\x20key\x20configured');}if(!this[_0xa0fd('0xa4')](_0x2d4dc4[_0xa0fd('0x57')])){return this[_0xa0fd('0xd')][_0xa0fd('0xa7')](_0xa0fd('0xea'));}this[_0xa0fd('0xd')]['noop'](util['format'](_0xa0fd('0x15b'),_0x2d4dc4[_0xa0fd('0x57')]));var _0x267854=this['ispeechTTS'][_0xa0fd('0x6d')](this,_0x2d4dc4);if(_0x267854){this[_0xa0fd('0xd')][_0xa0fd('0xa7')](util['format']('ispeech\x20%s\x20file\x20created',_0x267854));var _0x288573=this[_0xa0fd('0xd')][_0xa0fd('0x107')](_0x267854,_0x2d4dc4['intKey']);try{fs[_0xa0fd('0x108')](_0x267854+_0xa0fd('0x109'));}catch(_0x1de3fe){logger[_0xa0fd('0x2f')](_0x1de3fe);}return _0x288573;}return this[_0xa0fd('0xd')][_0xa0fd('0x2f')](_0x2d4dc4,_0xa0fd('0x15c'));};AGIVertices['prototype'][_0xa0fd('0x15d')]=function(_0x35ce77){logger['info'](util[_0xa0fd('0x26')](_0xa0fd('0x15e'),_0x35ce77[_0xa0fd('0x35')]));if(!this['isConfigured'](_0x35ce77[_0xa0fd('0x15f')])){return this[_0xa0fd('0xd')][_0xa0fd('0x2f')](_0x35ce77,'no\x20find\x20by\x20configured');}logger[_0xa0fd('0x29')](util[_0xa0fd('0x26')](_0xa0fd('0x160'),this[_0xa0fd('0xd')]['callerid'],_0x35ce77[_0xa0fd('0x15f')]));var _0x7810b9=this[_0xa0fd('0x50')][_0xa0fd('0x6d')](this,_0x35ce77['findBy']);if(_0x7810b9){logger[_0xa0fd('0x29')](util[_0xa0fd('0x26')](_0xa0fd('0x161'),this[_0xa0fd('0xd')][_0xa0fd('0x39')],_0x35ce77[_0xa0fd('0x15f')]));this['channel'][_0xa0fd('0xa7')](util[_0xa0fd('0x26')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xa0fd('0xd')]['callerid'],_0x35ce77[_0xa0fd('0x15f')]));return{'code':0xc8,'result':_0xa0fd('0x162')};}else{logger[_0xa0fd('0x29')](util[_0xa0fd('0x26')](_0xa0fd('0x163'),this[_0xa0fd('0xd')][_0xa0fd('0x39')],_0x35ce77[_0xa0fd('0x15f')]));this['channel']['noop'](util[_0xa0fd('0x26')](_0xa0fd('0x163'),this['channel'][_0xa0fd('0x39')],_0x35ce77['findBy']));return{'code':0xc8,'result':_0xa0fd('0x164')};}};AGIVertices[_0xa0fd('0xf')][_0xa0fd('0x165')]=function(_0x3a263a){logger[_0xa0fd('0x29')](util[_0xa0fd('0x26')]('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0x3a263a[_0xa0fd('0x35')]));if(!this['isConfigured'](_0x3a263a[_0xa0fd('0x15f')])){return this['channel'][_0xa0fd('0x2f')](_0x3a263a,_0xa0fd('0x166'));}logger['info'](util['format'](_0xa0fd('0x160'),this[_0xa0fd('0xd')][_0xa0fd('0x39')],_0x3a263a['findBy']));var _0xe40db=this['agentLogout'][_0xa0fd('0x6d')](this,_0x3a263a[_0xa0fd('0x15f')]);if(_0xe40db){logger[_0xa0fd('0x29')](util[_0xa0fd('0x26')](_0xa0fd('0x161'),this[_0xa0fd('0xd')][_0xa0fd('0x39')],_0x3a263a[_0xa0fd('0x15f')]));this[_0xa0fd('0xd')][_0xa0fd('0xa7')](util[_0xa0fd('0x26')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xa0fd('0xd')][_0xa0fd('0x39')],_0x3a263a[_0xa0fd('0x15f')]));return{'code':0xc8,'result':_0xa0fd('0x162')};}else{logger['info'](util['format'](_0xa0fd('0x163'),this[_0xa0fd('0xd')][_0xa0fd('0x39')],_0x3a263a[_0xa0fd('0x15f')]));this[_0xa0fd('0xd')][_0xa0fd('0xa7')](util['format'](_0xa0fd('0x163'),this[_0xa0fd('0xd')][_0xa0fd('0x39')],_0x3a263a['findBy']));return{'code':0xc8,'result':_0xa0fd('0x164')};}};AGIVertices['prototype'][_0xa0fd('0x167')]=function(_0x7ec6c7){logger[_0xa0fd('0x29')](util[_0xa0fd('0x26')](_0xa0fd('0x168'),_0x7ec6c7[_0xa0fd('0x35')]));if(!this[_0xa0fd('0xa4')](_0x7ec6c7['operation'])){return this[_0xa0fd('0xd')][_0xa0fd('0x2f')](_0x7ec6c7,_0xa0fd('0x169'));}this['channel'][_0xa0fd('0xa7')](util[_0xa0fd('0x26')](_0xa0fd('0x16a'),_0x7ec6c7[_0xa0fd('0x16b')]));var _0x5e205e=eval(_0x7ec6c7[_0xa0fd('0x16b')]);if(!this['isConfigured'](_0x7ec6c7[_0xa0fd('0xd9')])){return this[_0xa0fd('0xd')][_0xa0fd('0xa7')](_0xa0fd('0xda'));}var _0x3bef47=this[_0xa0fd('0x10')][_0xa0fd('0x6d')](this,_0x7ec6c7[_0xa0fd('0xd9')]);if(!_0x3bef47){return this[_0xa0fd('0xd')][_0xa0fd('0x2f')](_0x7ec6c7,_0xa0fd('0x11e'));}if(_['isArray'](_0x5e205e)){var _0x1afbef=this;_0x5e205e[_0xa0fd('0xdb')](function(_0x30325f,_0x457f84){_0x1afbef[_0xa0fd('0xd')][_0xa0fd('0x9c')](util[_0xa0fd('0x26')](_0xa0fd('0x16c'),_0x3bef47,_0x457f84),_0x30325f);});return this[_0xa0fd('0xd')][_0xa0fd('0xa7')](util[_0xa0fd('0x26')](_0xa0fd('0x16d'),_0x3bef47));}else{return this['channel']['setVariable'](_0x3bef47,_0x5e205e);}};AGIVertices['prototype'][_0xa0fd('0xa')]=function(_0x14dce9){logger[_0xa0fd('0x29')](util[_0xa0fd('0x26')](_0xa0fd('0x16e'),_0x14dce9[_0xa0fd('0x35')]));if(_0x14dce9[_0xa0fd('0x116')]===0x0){return this[_0xa0fd('0xa5')](_0x14dce9);}_0x14dce9['retry']-=0x1;if(!this['isConfigured'](_0x14dce9[_0xa0fd('0x117')])){return this[_0xa0fd('0xd')][_0xa0fd('0x2f')](_0x14dce9,_0xa0fd('0x118'));}var _0x257777=this['getSound'][_0xa0fd('0x6d')](this,_0x14dce9['file_id']);if(!_0x257777){return this[_0xa0fd('0xd')][_0xa0fd('0x2f')](_0x14dce9,_0xa0fd('0x16f'));}var _0x8a3e07=this[_0xa0fd('0xd')][_0xa0fd('0x119')](_0x257777,_0x14dce9[_0xa0fd('0x11a')],_0x14dce9[_0xa0fd('0x170')]);var _0x6225e4=_0x8a3e07[_0xa0fd('0xa2')];if(_0x8a3e07[_0xa0fd('0xa2')]===-0x1){this['createSquareDetailsReport'][_0xa0fd('0x6d')](this,_0x14dce9,'-1');return _0x8a3e07;}else if(_0x8a3e07['extra']==='timeout'){_0x8a3e07[_0xa0fd('0xa2')]=_0x8a3e07[_0xa0fd('0xa2')]['length']>0x0?_0x8a3e07['result']:'t';}else if(_[_0xa0fd('0x43')](_0x8a3e07[_0xa0fd('0xa2')])){_0x8a3e07['result']='#';_0x6225e4='#';}if(!this[_0xa0fd('0xa4')](_0x14dce9['variable_id'])){this[_0xa0fd('0xd')]['noop'](_0xa0fd('0xda'));}else{var _0x34c989=this[_0xa0fd('0x10')][_0xa0fd('0x6d')](this,_0x14dce9[_0xa0fd('0xd9')]);if(!_0x34c989){return this[_0xa0fd('0xd')][_0xa0fd('0x2f')](_0x14dce9,_0xa0fd('0x11e'));}this[_0xa0fd('0xd')][_0xa0fd('0x9c')](_0x34c989,_0x6225e4);}this['createSquareDetailsReport']['sync'](this,_0x14dce9,_0x6225e4);return _0x8a3e07;};AGIVertices[_0xa0fd('0xf')]['noop']=function(_0x429fd6){logger[_0xa0fd('0x29')](util['format'](_0xa0fd('0x171'),_0x429fd6[_0xa0fd('0x35')]));return this[_0xa0fd('0xd')]['noop'](_0x429fd6[_0xa0fd('0x172')]||_0x429fd6[_0xa0fd('0x35')]);};AGIVertices['prototype']['pause']=function(_0x19561e){logger['info'](util[_0xa0fd('0x26')](_0xa0fd('0x173'),_0x19561e[_0xa0fd('0x35')]));if(!this[_0xa0fd('0xa4')](_0x19561e['findBy'])){return this[_0xa0fd('0xd')]['error'](_0x19561e,_0xa0fd('0x166'));}logger[_0xa0fd('0x29')](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xa0fd('0xd')]['callerid'],_0x19561e[_0xa0fd('0x15f')]));var _0x45dfa1=this[_0xa0fd('0x48')]['sync'](this,_0x19561e['pause_id']);var _0x3361ba=this['agentPause'][_0xa0fd('0x6d')](this,_0x19561e[_0xa0fd('0x15f')],_0x45dfa1);if(_0x3361ba){logger[_0xa0fd('0x29')](util[_0xa0fd('0x26')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xa0fd('0xd')]['callerid'],_0x19561e[_0xa0fd('0x15f')]));this[_0xa0fd('0xd')][_0xa0fd('0xa7')](util[_0xa0fd('0x26')](_0xa0fd('0x161'),this[_0xa0fd('0xd')]['callerid'],_0x19561e[_0xa0fd('0x15f')]));return{'code':0xc8,'result':_0xa0fd('0x162')};}else{logger[_0xa0fd('0x29')](util[_0xa0fd('0x26')](_0xa0fd('0x163'),this['channel'][_0xa0fd('0x39')],_0x19561e[_0xa0fd('0x15f')]));this[_0xa0fd('0xd')][_0xa0fd('0xa7')](util[_0xa0fd('0x26')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xa0fd('0xd')]['callerid'],_0x19561e['findBy']));return{'code':0xc8,'result':_0xa0fd('0x164')};}};AGIVertices[_0xa0fd('0xf')][_0xa0fd('0x174')]=function(_0x2db8f9){logger[_0xa0fd('0x29')](util['format'](_0xa0fd('0x175'),_0x2db8f9[_0xa0fd('0x35')]));if(!this[_0xa0fd('0xa4')](_0x2db8f9[_0xa0fd('0x117')])){return this[_0xa0fd('0xd')][_0xa0fd('0x2f')](_0x2db8f9,_0xa0fd('0x118'));}var _0x27d3a1=this['getSound'][_0xa0fd('0x6d')](this,_0x2db8f9['file_id']);if(!_0x27d3a1){return this[_0xa0fd('0xd')][_0xa0fd('0x2f')](_0x2db8f9,'no\x20file\x20audio\x20found');}var _0xbfa39d=this[_0xa0fd('0xd')][_0xa0fd('0x51')](_0xa0fd('0x176'),[_0x27d3a1,_0x2db8f9[_0xa0fd('0xe6')]]);if(_0xbfa39d[_0xa0fd('0xa2')]===-0x1){return _0xbfa39d;}return this[_0xa0fd('0xd')][_0xa0fd('0xa7')](util['format'](_0xa0fd('0xc5'),_0xa0fd('0x176'),_0x27d3a1));};AGIVertices[_0xa0fd('0xf')][_0xa0fd('0x177')]=function(_0x7abf6e){logger[_0xa0fd('0x29')](util['format'](_0xa0fd('0x178'),_0x7abf6e[_0xa0fd('0x35')]));if(!this[_0xa0fd('0xa4')](_0x7abf6e[_0xa0fd('0x179')])){return this[_0xa0fd('0xd')]['error'](_0x7abf6e,_0xa0fd('0x17a'));}var _0x5f6c33='';var _0x40397e=parseInt(_0x7abf6e[_0xa0fd('0x179')],0xa);if(isNaN(_0x40397e)){_0x5f6c33=_0x7abf6e['queue_id'];}else{_0x5f6c33=this[_0xa0fd('0x14')][_0xa0fd('0x6d')](this,_0x7abf6e[_0xa0fd('0x179')]);if(!_0x5f6c33){return this[_0xa0fd('0xd')][_0xa0fd('0x2f')](_0x7abf6e,_0xa0fd('0x17b'));}}var _0x5b6bcf='';if(this[_0xa0fd('0xa4')](_0x7abf6e[_0xa0fd('0x117')])){var _0x314951=this[_0xa0fd('0x17c')][_0xa0fd('0x6d')](this,_0x7abf6e['file_id']);if(_0x314951){_0x5b6bcf=_0x314951;}}this['createSquareDetailsReport'][_0xa0fd('0x6d')](this,_0x7abf6e,_0x5f6c33);if(_0x7abf6e[_0xa0fd('0xe6')]['indexOf']('x')<0x0){_0x7abf6e[_0xa0fd('0xe6')]+='x';}if(_0x7abf6e[_0xa0fd('0xe6')][_0xa0fd('0x17d')]('X')<0x0){_0x7abf6e[_0xa0fd('0xe6')]+='X';}this[_0xa0fd('0xd')]['setVariable']('XMCS-QUEUE',_0x5f6c33?_0x5f6c33['toLowerCase']():'');var _0x3200b3=this[_0xa0fd('0xd')][_0xa0fd('0x51')](_0xa0fd('0x17e'),[_0x5f6c33,_0x7abf6e['opts'],_0x7abf6e[_0xa0fd('0x5f')],_0x5b6bcf,_0x7abf6e['timeout'],_0x7abf6e['agi'],_0x7abf6e['macro'],_0x7abf6e[_0xa0fd('0x17f')],'',_0x7abf6e['position']]);if(_0x3200b3[_0xa0fd('0xa2')]===-0x1){return _0x3200b3;}return this[_0xa0fd('0xd')][_0xa0fd('0xa7')](util[_0xa0fd('0x26')](_0xa0fd('0xc5'),_0xa0fd('0x17e'),_0x5f6c33));};AGIVertices[_0xa0fd('0xf')]['record']=function(_0x208d9a){logger[_0xa0fd('0x29')](util[_0xa0fd('0x26')](_0xa0fd('0x180'),_0x208d9a['label']));var _0x1a8a69=_0x208d9a['recordingFormat']||_0xa0fd('0x136');var _0x3596a6=util['format']('%s_%s',this['channel']['uniqueid'],rs[_0xa0fd('0x120')](0x5));var _0x1fb42a=util[_0xa0fd('0x26')](_0xa0fd('0x181'),FILES_PATH,_0x3596a6,_0x1a8a69);var _0xc21460=util['format'](_0xa0fd('0x137'),FILES_PATH,_0x3596a6);this[_0xa0fd('0x38')]['sync'](this,_0x208d9a,_0x3596a6,_0x1fb42a);this[_0xa0fd('0xd')][_0xa0fd('0x9c')](_0xa0fd('0x182'),_0x3596a6);logger[_0xa0fd('0x29')](_0xa0fd('0x183'),_0xc21460,_0x1a8a69,_0x208d9a[_0xa0fd('0x184')],_0x208d9a[_0xa0fd('0x61')]);return this[_0xa0fd('0xd')][_0xa0fd('0x139')](_0xc21460,_0x1a8a69,_0x208d9a['escape_digits'],_0x208d9a['timeout'],undefined,!![]);};AGIVertices[_0xa0fd('0xf')][_0xa0fd('0x185')]=function(_0x4b5d48){logger[_0xa0fd('0x29')](util[_0xa0fd('0x26')](_0xa0fd('0x186'),_0x4b5d48['label']));if(!this[_0xa0fd('0xa4')](_0x4b5d48[_0xa0fd('0x5f')])){return this[_0xa0fd('0xd')][_0xa0fd('0xa7')](_0xa0fd('0x187'));}var _0x2c8689=this['restAPI'][_0xa0fd('0x6d')](this,_0x4b5d48);logger['info'](util[_0xa0fd('0x26')](_0xa0fd('0x188'),util['inspect'](_0x2c8689,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x4b5d48[_0xa0fd('0xd9')])){return this[_0xa0fd('0xd')][_0xa0fd('0xa7')](_0xa0fd('0x189'));}var _0x266c55=this[_0xa0fd('0x10')][_0xa0fd('0x6d')](this,_0x4b5d48[_0xa0fd('0xd9')]);if(!_0x266c55){return this['channel'][_0xa0fd('0x2f')](_0x4b5d48,'no\x20variable\x20found');}this[_0xa0fd('0xd')]['setVariable'](util['format'](_0xa0fd('0x18a'),_0x266c55),_0x2c8689[_0xa0fd('0x71')]?_0x2c8689['statusCode']:_0xa0fd('0x18b'));this[_0xa0fd('0xd')][_0xa0fd('0x9c')](util[_0xa0fd('0x26')](_0xa0fd('0x18c'),_0x266c55),_0x2c8689['statusMessage']?_0x2c8689[_0xa0fd('0x72')]:'OK');if(_0x2c8689[_0xa0fd('0x66')]){try{this[_0xa0fd('0x98')](_0x2c8689[_0xa0fd('0x66')],_0x266c55);}catch(_0x4ac077){logger[_0xa0fd('0x2f')](util[_0xa0fd('0x26')](_0xa0fd('0x18d'),_0x266c55));}}return this['channel'][_0xa0fd('0xa7')](util[_0xa0fd('0x26')](_0xa0fd('0xdd'),_0x266c55));};AGIVertices[_0xa0fd('0xf')][_0xa0fd('0x18e')]=function(_0x2cd9dc){logger[_0xa0fd('0x29')](util[_0xa0fd('0x26')]('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x2cd9dc['label']));return this[_0xa0fd('0xd')][_0xa0fd('0x18f')](_0x2cd9dc[_0xa0fd('0x190')][_0xa0fd('0x53')](/\s+/g,''),_0x2cd9dc['escape_digits']);};AGIVertices['prototype'][_0xa0fd('0x191')]=function(_0x5c330c){logger[_0xa0fd('0x29')](util[_0xa0fd('0x26')](_0xa0fd('0x192'),_0x5c330c['label']));return this['channel']['sayNumber'](_0x5c330c['number'][_0xa0fd('0x53')](/\s+/g,''),_0x5c330c[_0xa0fd('0x184')]);};AGIVertices['prototype']['sayphonetic']=function(_0x36dc23){logger[_0xa0fd('0x29')](util[_0xa0fd('0x26')]('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0x36dc23['label']));return this[_0xa0fd('0xd')][_0xa0fd('0x193')](_0x36dc23[_0xa0fd('0x57')],_0x36dc23[_0xa0fd('0x184')]);};AGIVertices['prototype'][_0xa0fd('0x194')]=function(_0x4a4414){logger['info'](util[_0xa0fd('0x26')](_0xa0fd('0x195'),_0x4a4414[_0xa0fd('0x35')]));if(!this[_0xa0fd('0xa4')](_0x4a4414['account_id'])){return this[_0xa0fd('0xd')]['noop'](_0xa0fd('0x196'));}var _0x3a2d25=this[_0xa0fd('0x20')][_0xa0fd('0x6d')](this,_0x4a4414[_0xa0fd('0x197')]);if(!_0x3a2d25||!_0x3a2d25[_0xa0fd('0x198')]){return this['channel'][_0xa0fd('0x2f')](_0x4a4414,_0xa0fd('0x199'));}var _0x47c31a={'from':util[_0xa0fd('0x26')](_0xa0fd('0x19a'),_0x3a2d25['name'],_0x3a2d25[_0xa0fd('0x19b')]||_0x3a2d25[_0xa0fd('0x198')][_0xa0fd('0x19c')]),'to':_0x4a4414['to']||'','cc':_0x4a4414['cc']||'','bcc':_0x4a4414[_0xa0fd('0x19d')]||'','subject':_0x4a4414[_0xa0fd('0x19e')],'html':_0x4a4414[_0xa0fd('0x57')],'text':_0x4a4414[_0xa0fd('0x57')]};if(this['isConfigured'](_0x4a4414[_0xa0fd('0x19f')])){}logger[_0xa0fd('0xdf')]('sendMail\x20message',JSON['stringify'](_0x47c31a));this[_0xa0fd('0x33')][_0xa0fd('0x6d')](this,_0x4a4414,_0x4a4414['account_id']);this[_0xa0fd('0xd')][_0xa0fd('0xa7')](util[_0xa0fd('0x26')](_0xa0fd('0x1a0'),_0x3a2d25[_0xa0fd('0x13')]));this['sendMailMessage']['sync'](this,_0x3a2d25[_0xa0fd('0x1a1')],_0x47c31a);return this[_0xa0fd('0xd')][_0xa0fd('0xa7')](_0xa0fd('0x1a2'));};AGIVertices[_0xa0fd('0xf')][_0xa0fd('0x1a3')]=function(_0xf2b24){logger[_0xa0fd('0x29')](util[_0xa0fd('0x26')](_0xa0fd('0x1a4'),_0xf2b24[_0xa0fd('0x35')]));return this[_0xa0fd('0xd')][_0xa0fd('0xa7')](_0xa0fd('0x1a5'));};AGIVertices[_0xa0fd('0xf')]['sendSMS']=function(_0x128b61){logger['info'](util[_0xa0fd('0x26')](_0xa0fd('0x1a6'),_0x128b61[_0xa0fd('0x35')]));if(!this['isConfigured'](_0x128b61[_0xa0fd('0x1a7')])){return this['channel'][_0xa0fd('0xa7')]('no\x20sms\x20account\x20configured');}var _0x2579de=this[_0xa0fd('0x1a8')][_0xa0fd('0x6d')](this,_0x128b61[_0xa0fd('0x1a7')]);if(!_0x2579de){return this[_0xa0fd('0xd')]['error'](_0x128b61,_0xa0fd('0x1a9'));}var _0x3dde5f={'body':_0x128b61[_0xa0fd('0x1aa')],'phone':_0x128b61['to']||'','SmsAccountId':_0x2579de['id']};logger[_0xa0fd('0xdf')](_0xa0fd('0x1ab'),JSON[_0xa0fd('0x70')](_0x3dde5f));this[_0xa0fd('0x33')][_0xa0fd('0x6d')](this,_0x128b61,_0x128b61[_0xa0fd('0x1a7')]);this[_0xa0fd('0xd')][_0xa0fd('0xa7')](util['format']('Trying\x20SendSMS\x20with\x20account\x20%s',_0x2579de[_0xa0fd('0x13')]));this[_0xa0fd('0x32')]['sync'](this,_0x3dde5f);return this[_0xa0fd('0xd')][_0xa0fd('0xa7')](_0xa0fd('0x1ac'));};AGIVertices['prototype'][_0xa0fd('0x1ad')]=function(_0x478038){logger[_0xa0fd('0x29')](util[_0xa0fd('0x26')]('Enter\x20in\x20SET\x20(%s)\x20block',_0x478038[_0xa0fd('0x35')]));if(!this[_0xa0fd('0xa4')](_0x478038[_0xa0fd('0xd9')])){return this[_0xa0fd('0xd')]['error'](_0x478038,_0xa0fd('0x1ae'));}var _0x357903=this[_0xa0fd('0x10')][_0xa0fd('0x6d')](this,_0x478038[_0xa0fd('0xd9')]);if(!_0x357903){return this[_0xa0fd('0xd')][_0xa0fd('0x2f')](_0x478038,_0xa0fd('0x11e'));}return this[_0xa0fd('0xd')][_0xa0fd('0x9c')](_0x357903,_0x478038[_0xa0fd('0x1af')]);};AGIVertices[_0xa0fd('0xf')]['start']=function(_0x28abd9){logger[_0xa0fd('0x29')](util[_0xa0fd('0x26')](_0xa0fd('0x1b0'),_0x28abd9[_0xa0fd('0x35')]));this[_0xa0fd('0xd')][_0xa0fd('0xa7')](_0xa0fd('0x1b1'));var _0x3a8193=this['channel'][_0xa0fd('0x10')](_0xa0fd('0x1b2'));if(!_['isEmpty'](_0x3a8193[_0xa0fd('0xa0')])){this['channel'][_0xa0fd('0x34')]=_0x3a8193[_0xa0fd('0xa0')];}if(_0x28abd9[_0xa0fd('0xb5')]===_0xa0fd('0x1b3')){this[_0xa0fd('0xd')][_0xa0fd('0xa7')](_0xa0fd('0x1b4'));return this['channel'][_0xa0fd('0xb5')]();}return this[_0xa0fd('0xd')]['noop'](_0xa0fd('0x1b5'));};AGIVertices[_0xa0fd('0xf')][_0xa0fd('0x1b6')]=function(_0x467a4e){logger['info'](util[_0xa0fd('0x26')](_0xa0fd('0x1b7'),_0x467a4e[_0xa0fd('0x35')]));if(!this[_0xa0fd('0xa4')](_0x467a4e[_0xa0fd('0x1b8')])){return this[_0xa0fd('0xd')][_0xa0fd('0x2f')](_0x467a4e,_0xa0fd('0x1b9'));}var _0x36ba6c=this[_0xa0fd('0x17')][_0xa0fd('0x6d')](this,_0x467a4e[_0xa0fd('0x1b8')]);if(!this[_0xa0fd('0xa4')](_0x36ba6c)){return this[_0xa0fd('0xd')][_0xa0fd('0x2f')](_0x467a4e,util[_0xa0fd('0x26')](_0xa0fd('0x1ba'),_0x467a4e[_0xa0fd('0x1b8')]));}if(_0x36ba6c===this[_0xa0fd('0xd')][_0xa0fd('0x37')]){return this[_0xa0fd('0xd')][_0xa0fd('0x2f')](_0x467a4e,_0xa0fd('0x1bb'));}this['createSquareDetailsReport'][_0xa0fd('0x6d')](this,_0x467a4e,_0x36ba6c);var _0x4f8331=this['channel'][_0xa0fd('0x51')](_0xa0fd('0x1bc'),util['format'](_0xa0fd('0x1bd'),config[_0xa0fd('0xb2')][_0xa0fd('0x1be')]||_0xa0fd('0x1bf'),_0x36ba6c,this[_0xa0fd('0xd')][_0xa0fd('0x37')]));if(_0x4f8331[_0xa0fd('0xa2')]===-0x1){return _0x4f8331;}return this['channel']['noop'](util[_0xa0fd('0x26')](_0xa0fd('0xc5'),_0xa0fd('0x1bc'),_0x36ba6c));};AGIVertices[_0xa0fd('0xf')][_0xa0fd('0x1c0')]=function(_0x325cb6){logger[_0xa0fd('0x29')](util['format'](_0xa0fd('0x1c1'),_0x325cb6[_0xa0fd('0x35')]));var _0x433ea9=this[_0xa0fd('0x1c2')][_0xa0fd('0x6d')](this,_0x325cb6[_0xa0fd('0x1c3')]);this['createSquareDetailsReport'][_0xa0fd('0x6d')](this,_0x325cb6,_0x325cb6['command']);if(this[_0xa0fd('0xa4')](_0x325cb6[_0xa0fd('0xd9')])){var _0xa7a535=this[_0xa0fd('0x10')][_0xa0fd('0x6d')](this,_0x325cb6['variable_id']);if(_0xa7a535){this[_0xa0fd('0xd')][_0xa0fd('0x9c')](_0xa7a535,_0x433ea9);return this['channel'][_0xa0fd('0xa7')](util['format'](_0xa0fd('0x1c4'),_0x325cb6['command'],_0xa7a535));}}return this['channel'][_0xa0fd('0xa7')](util[_0xa0fd('0x26')](_0xa0fd('0x1c5'),_0x325cb6[_0xa0fd('0x1c3')]));};AGIVertices['prototype'][_0xa0fd('0x1c6')]=function(_0x5497bc){logger[_0xa0fd('0x29')](util[_0xa0fd('0x26')](_0xa0fd('0x1c7'),_0x5497bc['label']));_0x5497bc[_0xa0fd('0x57')]=_0x5497bc[_0xa0fd('0x57')][_0xa0fd('0x53')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xa0fd('0xa4')](_0x5497bc['apiKey'])){return this[_0xa0fd('0xd')][_0xa0fd('0xa7')](_0xa0fd('0x1c8'));}if(!this[_0xa0fd('0xa4')](_0x5497bc[_0xa0fd('0x57')])){return this[_0xa0fd('0xd')][_0xa0fd('0xa7')](_0xa0fd('0xea'));}this[_0xa0fd('0xd')][_0xa0fd('0xa7')](util[_0xa0fd('0x26')](_0xa0fd('0x1c9'),_0x5497bc[_0xa0fd('0x57')]));var _0x451f28=this[_0xa0fd('0x54')][_0xa0fd('0x6d')](this,_0x5497bc);if(_0x451f28){this[_0xa0fd('0xd')][_0xa0fd('0xa7')](util['format'](_0xa0fd('0x1ca'),_0x451f28));var _0x1c1ed8=this[_0xa0fd('0xd')][_0xa0fd('0x107')](_0x451f28);try{fs[_0xa0fd('0x108')](_0x451f28+_0xa0fd('0x109'));}catch(_0x3fbbd9){logger[_0xa0fd('0x2f')](_0x3fbbd9);}return _0x1c1ed8;}return this['channel'][_0xa0fd('0x2f')](_0x5497bc,'Google\x20Cloud\x20TTS\x20is\x20unreachable');};AGIVertices[_0xa0fd('0xf')]['tts']=function(_0x5066ce){logger[_0xa0fd('0x29')](util[_0xa0fd('0x26')](_0xa0fd('0x1cb'),_0x5066ce[_0xa0fd('0x35')]));_0x5066ce['text']=_0x5066ce[_0xa0fd('0x57')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xa0fd('0xa4')](_0x5066ce[_0xa0fd('0x57')])){return this[_0xa0fd('0xd')][_0xa0fd('0xa7')]('no\x20text\x20configured');}this[_0xa0fd('0xd')]['noop'](util[_0xa0fd('0x26')](_0xa0fd('0x1cc'),_0x5066ce[_0xa0fd('0x57')]));var _0xb6f230=this['googleTTS']['sync'](this,_0x5066ce);if(_0xb6f230){this['channel'][_0xa0fd('0xa7')](util[_0xa0fd('0x26')]('Google\x20TTS\x20%s\x20file\x20created',_0xb6f230));var _0x55d3e4=this[_0xa0fd('0xd')][_0xa0fd('0x107')](_0xb6f230);try{fs[_0xa0fd('0x108')](_0xb6f230+_0xa0fd('0x109'));}catch(_0xf14d25){logger[_0xa0fd('0x2f')](_0xf14d25);}return _0x55d3e4;}return this[_0xa0fd('0xd')][_0xa0fd('0x2f')](_0x5066ce,_0xa0fd('0x1cd'));};AGIVertices[_0xa0fd('0xf')]['unpause']=function(_0x45a67a){logger[_0xa0fd('0x29')](util[_0xa0fd('0x26')](_0xa0fd('0x1ce'),_0x45a67a['label']));if(!this['isConfigured'](_0x45a67a[_0xa0fd('0x15f')])){return this[_0xa0fd('0xd')][_0xa0fd('0x2f')](_0x45a67a,_0xa0fd('0x166'));}logger[_0xa0fd('0x29')](util['format'](_0xa0fd('0x160'),this[_0xa0fd('0xd')][_0xa0fd('0x39')],_0x45a67a['findBy']));var _0x2b4fd3=this[_0xa0fd('0x4b')][_0xa0fd('0x6d')](this,_0x45a67a[_0xa0fd('0x15f')]);if(_0x2b4fd3){logger[_0xa0fd('0x29')](util['format'](_0xa0fd('0x161'),this['channel'][_0xa0fd('0x39')],_0x45a67a[_0xa0fd('0x15f')]));this[_0xa0fd('0xd')][_0xa0fd('0xa7')](util[_0xa0fd('0x26')](_0xa0fd('0x161'),this[_0xa0fd('0xd')][_0xa0fd('0x39')],_0x45a67a['findBy']));return{'code':0xc8,'result':_0xa0fd('0x162')};}else{logger[_0xa0fd('0x29')](util[_0xa0fd('0x26')](_0xa0fd('0x163'),this[_0xa0fd('0xd')]['callerid'],_0x45a67a[_0xa0fd('0x15f')]));this[_0xa0fd('0xd')][_0xa0fd('0xa7')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0xa0fd('0x39')],_0x45a67a[_0xa0fd('0x15f')]));return{'code':0xc8,'result':_0xa0fd('0x164')};}};AGIVertices[_0xa0fd('0xf')][_0xa0fd('0x1cf')]=function(_0x1504d1){logger[_0xa0fd('0x29')](util['format'](_0xa0fd('0x1d0'),_0x1504d1[_0xa0fd('0x35')]));var _0x40cd22=this[_0xa0fd('0xd')][_0xa0fd('0x51')](_0xa0fd('0x1d1'),[_0x1504d1[_0xa0fd('0x1d2')],_0x1504d1[_0xa0fd('0x75')]]);if(_0x40cd22[_0xa0fd('0xa2')]===-0x1){return _0x40cd22;}return this['channel'][_0xa0fd('0xa7')](util[_0xa0fd('0x26')](_0xa0fd('0xc5'),_0xa0fd('0x1d1'),_0x1504d1['mailbox']));};AGIVertices['prototype'][_0xa0fd('0x1d3')]=function(_0x349e85){logger[_0xa0fd('0x29')](util['format'](_0xa0fd('0x1d4'),_0x349e85[_0xa0fd('0x35')]));if(!this[_0xa0fd('0xa4')](_0x349e85[_0xa0fd('0xd9')])){return this[_0xa0fd('0xd')][_0xa0fd('0x2f')](_0x349e85,_0xa0fd('0x1ae'));}var _0x4f099f=this[_0xa0fd('0x10')][_0xa0fd('0x6d')](this,_0x349e85['variable_id']);if(!_0x4f099f){return this[_0xa0fd('0xd')]['error'](_0x349e85,_0xa0fd('0x11e'));}var _0x122cad=this['channel']['getVariable'](_0x4f099f);return{'code':0xc8,'result':_0x122cad[_0xa0fd('0xa0')]?_0x122cad[_0xa0fd('0xa0')]:'-'};};String['prototype'][_0xa0fd('0x9f')]=function(_0x36287,_0x4d804e){return this[_0xa0fd('0x9e')](_0x36287)[_0xa0fd('0x1d5')](_0x4d804e);};module[_0xa0fd('0x1d6')]=AGIVertices; \ No newline at end of file +var _0x1af3=['moment','mustache','request-promise','../../config/logger','agi','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','getdigits','getsecretdigits','channel','rpc','mailRpc','prototype','getVariable','getVariableById','then','name','catch','getVoiceQueue','getVoiceQueueById','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUser','getUserById','getTrunk','getSound','getSoundById','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','map','Intervals','getSoundPath','format','%s/sounds/converted/%s','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','arg_1','callerid','createSquareRecording','calleridname','context','priority','accountcode','file','createSquareMessage','createCmContact','isEmpty','callback_','random','lastName','isNil','phone','list_id','scheduledAt','callback','toString','callback_priority','getPause','getPauseById','agent','agentLogout','agentLogin','internal','LOCAL','shellCommand','exec','trim','replace','googleCloudTTS','apiKey','text','languageCode','en-US','ssmlGender','audioEncoding','MP3','googleTTS','google_tts_language','url','method','number','POST','PUT','toUpperCase','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','render','stringify','statusCode','statusMessage','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','private_key','dialogflowV2_language','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','awsLex','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','uri','includes','agicommand','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','length','saveRestApiResult','%s.%s','isArray','setVariable','split','replaceAll','extra','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','grammar','no\x20grammar\x20configured','MRCPRecog','getAndSetVariable','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','Enter\x20in\x20AGI\x20(%s)\x20block','command','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','timeout','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','delay','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','query','no\x20query\x20configured','query:\x20%s','getQueryOdbc','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','no\x20user\x20selected','sip_id','DIAL','SIP/%s','opts','Executed\x20command\x20%s','dialogflow','no\x20key\x20configured','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','client_email','no\x20client_email\x20configured','no\x20anguage\x20configured','bot','providerResponse','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','no\x20password\x20configured','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','no\x20trunk\x20selected','trunk_id','no\x20trunk\x20found','trunk_name','SIP/%s/%s','finally','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','retry','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','getData','maxdigit','test','mindigit','no\x20variable\x20found','hiddendigitsnum','generate','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','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','no\x20valid\x20credentials\x20configured','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','message','amazonlex','Amazon\x20Lex\x20Result\x20%s','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','beep','recordFile','intKey','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','interval_id','no\x20intervals\x20found','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','NOBEEP','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','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','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','menu','Enter\x20in\x20MENU\x20(%s)\x20block','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','PLAYBACK','Executed\x20command\x20%s\x20%s','queue','queue_id','no\x20queue\x20selected','indexOf','XMCS-QUEUE','QUEUE','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','restAPI','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','sayDigits','digits','saynumber','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','user','bcc','subject','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','Enter\x20in\x20SENDSMS\x20(%s)\x20block','getSmsAccount','sms_account_id','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','Enter\x20in\x20START\x20(%s)\x20block','yes','Skipped\x20Answer','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','host','127.0.0.1','system','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','agentUnpause','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','exports','util','lodash','shelljs','odbc','randomstring'];(function(_0x31c2d1,_0x33007f){var _0xef604b=function(_0x740d31){while(--_0x740d31){_0x31c2d1['push'](_0x31c2d1['shift']());}};_0xef604b(++_0x33007f);}(_0x1af3,0x1ca));var _0x31af=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0x1af3[_0x1caf6a];return _0x1bf493;};'use strict';var fs=require('fs');var util=require(_0x31af('0x0'));var _=require(_0x31af('0x1'));var sh=require(_0x31af('0x2'));var odbc=require(_0x31af('0x3'))();var rs=require(_0x31af('0x4'));var moment=require(_0x31af('0x5'));var Mustache=require(_0x31af('0x6'));var rp=require(_0x31af('0x7'));var logger=require(_0x31af('0x8'))(_0x31af('0x9'));var config=require('../../config/environment');var scripts=require(_0x31af('0xa'));var FILES_PATH=_0x31af('0xb');var recursiveMapAttributes=[_0x31af('0xc'),_0x31af('0xd')];var verticesWithRetry=['menu',_0x31af('0xe'),_0x31af('0xf')];var AGIVertices=function(_0x406dd8,_0x524d00,_0x21c951){this[_0x31af('0x10')]=_0x406dd8;this[_0x31af('0x11')]=_0x524d00;this[_0x31af('0x12')]=_0x21c951;};AGIVertices[_0x31af('0x13')][_0x31af('0x14')]=function(_0x1fa064,_0x33b4a5){this['rpc'][_0x31af('0x15')](_0x1fa064)[_0x31af('0x16')](function(_0xc077e6){_0x33b4a5(null,_0xc077e6?_0xc077e6[_0x31af('0x17')]:![]);})[_0x31af('0x18')](function(_0x481f20){_0x33b4a5(_0x481f20);});};AGIVertices[_0x31af('0x13')][_0x31af('0x19')]=function(_0x5c18b4,_0x4b801f){this[_0x31af('0x11')][_0x31af('0x1a')](_0x5c18b4)[_0x31af('0x16')](function(_0x10b9c6){_0x4b801f(null,_0x10b9c6?_0x10b9c6[_0x31af('0x17')]:![]);})[_0x31af('0x18')](function(_0x369934){_0x4b801f(_0x369934);});};AGIVertices[_0x31af('0x13')][_0x31af('0x1b')]=function(_0x5a651f,_0x375ea2){this['rpc'][_0x31af('0x1c')](_0x5a651f)[_0x31af('0x16')](function(_0x3a2305){_0x375ea2(null,_0x3a2305?_0x3a2305[_0x31af('0x17')]:![]);})[_0x31af('0x18')](function(_0x30a112){_0x375ea2(_0x30a112);});};AGIVertices[_0x31af('0x13')][_0x31af('0x1d')]=function(_0x3246c6,_0x550870){this[_0x31af('0x11')][_0x31af('0x1e')](_0x3246c6)[_0x31af('0x16')](function(_0x2ce4c2){_0x550870(null,_0x2ce4c2?_0x2ce4c2[_0x31af('0x1f')]:![]);})['catch'](function(_0x1a0bd0){_0x550870(_0x1a0bd0);});};AGIVertices[_0x31af('0x13')][_0x31af('0x20')]=function(_0x2e600a,_0x394d13){this[_0x31af('0x11')][_0x31af('0x21')](_0x2e600a)[_0x31af('0x16')](function(_0x3f673f){_0x394d13(null,_0x3f673f?_0x3f673f[_0x31af('0x17')]:![]);})[_0x31af('0x18')](function(_0x1a67e3){_0x394d13(_0x1a67e3);});};AGIVertices[_0x31af('0x13')][_0x31af('0x22')]=function(_0x32f189,_0x5ae495){this['rpc']['getTrunkById'](_0x32f189)[_0x31af('0x16')](function(_0x2b3bad){_0x5ae495(null,_0x2b3bad?_0x2b3bad['name']:![]);})[_0x31af('0x18')](function(_0x8f9f60){_0x5ae495(_0x8f9f60);});};AGIVertices['prototype'][_0x31af('0x23')]=function(_0x21e227,_0x53b726){var _0x171b7f=this;this[_0x31af('0x11')][_0x31af('0x24')](_0x21e227)[_0x31af('0x16')](function(_0x3326a7){_0x53b726(null,_0x3326a7?_0x171b7f['getSoundPath'](_0x3326a7[_0x31af('0x25')]):![]);})[_0x31af('0x18')](function(_0x1e6df8){_0x53b726(_0x1e6df8);});};AGIVertices[_0x31af('0x13')][_0x31af('0x26')]=function(_0x3e885e,_0x149d01){this[_0x31af('0x11')][_0x31af('0x27')](_0x3e885e)[_0x31af('0x16')](function(_0x388e9c){_0x149d01(null,_0x388e9c?_0x388e9c:![]);})[_0x31af('0x18')](function(_0x57d570){_0x149d01(_0x57d570);});};AGIVertices[_0x31af('0x13')][_0x31af('0x28')]=function(_0x4d5166,_0x4cabed,_0x50dd99){this[_0x31af('0x12')]['sendMailMessage'](_0x4d5166,_0x4cabed)[_0x31af('0x16')](function(){_0x50dd99(null);})[_0x31af('0x18')](function(_0x2899a0){_0x50dd99(_0x2899a0);});};AGIVertices[_0x31af('0x13')][_0x31af('0x29')]=function(_0x4bfbe9,_0x52f251){this[_0x31af('0x11')][_0x31af('0x2a')](_0x4bfbe9)[_0x31af('0x16')](function(_0x7481ca){if(_0x7481ca){if(_0x7481ca[_0x31af('0x2b')]){_0x52f251(null,[_0x7481ca[_0x31af('0x2c')]]);}else{_0x52f251(null,_[_0x31af('0x2d')](_0x7481ca[_0x31af('0x2e')],'interval'));}}else{_0x52f251(null,![]);}})[_0x31af('0x18')](function(_0x57af86){_0x52f251(_0x57af86);});};AGIVertices[_0x31af('0x13')][_0x31af('0x2f')]=function(_0x254f1a){return util[_0x31af('0x30')](_0x31af('0x31'),FILES_PATH,_0x254f1a);};AGIVertices['prototype']['getQueryOdbc']=function(_0x53bb6d,_0x318005,_0x1ce300){odbc[_0x31af('0x32')](_0x53bb6d,function(_0x1cfdd3){if(_0x1cfdd3){logger[_0x31af('0x33')](_0x31af('0x34'),_0x1cfdd3);_0x1ce300(_0x1cfdd3);}else{logger[_0x31af('0x35')](_0x31af('0x36'));odbc['query'](_0x318005,function(_0x3d7cf2,_0x16f3e1){if(_0x3d7cf2){logger[_0x31af('0x35')](_0x31af('0x37'),_0x318005);_0x1ce300(_0x3d7cf2);}else{logger[_0x31af('0x35')](_0x31af('0x38'),_0x318005);odbc[_0x31af('0x39')](function(_0xe90ba9){if(_0xe90ba9){logger[_0x31af('0x33')]('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0xe90ba9);}_0x1ce300(null,_0x16f3e1);});}});}});};AGIVertices[_0x31af('0x13')]['getSmsAccount']=function(_0x447a01,_0x5405e3){this['rpc'][_0x31af('0x3a')](_0x447a01)[_0x31af('0x16')](function(_0x110f38){_0x5405e3(null,_0x110f38?_0x110f38:![]);})[_0x31af('0x18')](function(_0x188e34){_0x5405e3(_0x188e34);});};AGIVertices[_0x31af('0x13')][_0x31af('0x3b')]=function(_0x4fd8c4,_0x33b1ea){this[_0x31af('0x11')][_0x31af('0x3b')](_0x4fd8c4)['then'](function(_0x44e10e){_0x33b1ea(null,_0x44e10e);})[_0x31af('0x18')](function(_0x1d8d27){_0x33b1ea(_0x1d8d27);});};AGIVertices[_0x31af('0x13')][_0x31af('0x3c')]=function(_0x57da2c,_0x12357c,_0x3b10ef){this[_0x31af('0x11')][_0x31af('0x3c')]({'uniqueid':this['channel'][_0x31af('0x3d')],'node':_0x57da2c[_0x31af('0x3e')],'application':_0x57da2c['agicommand'],'data':_0x12357c||null,'project_name':this[_0x31af('0x10')][_0x31af('0x3f')],'callerid':this[_0x31af('0x10')][_0x31af('0x40')]})[_0x31af('0x16')](function(_0x334b95){if(_0x3b10ef){_0x3b10ef(null,_0x334b95);}})[_0x31af('0x18')](function(_0x3a349f){if(_0x3b10ef){_0x3b10ef(_0x3a349f);}});};AGIVertices[_0x31af('0x13')][_0x31af('0x41')]=function(_0x52a602,_0x48f7b4,_0x19cbc0,_0x492725){this[_0x31af('0x11')][_0x31af('0x41')]({'uniqueid':this[_0x31af('0x10')]['uniqueid'],'callerid':this['channel'][_0x31af('0x40')],'calleridname':this['channel'][_0x31af('0x42')],'context':this[_0x31af('0x10')][_0x31af('0x43')],'extension':this[_0x31af('0x10')]['extension'],'priority':this['channel'][_0x31af('0x44')],'accountcode':this[_0x31af('0x10')][_0x31af('0x45')],'dnid':this[_0x31af('0x10')]['dnid'],'projectName':this[_0x31af('0x10')][_0x31af('0x3f')],'saveName':_0x48f7b4,'filename':_0x52a602[_0x31af('0x46')]||_0x48f7b4,'savePath':_0x19cbc0})['then'](function(_0x5a1cbe){_0x492725(null,_0x5a1cbe);})[_0x31af('0x18')](function(_0xdccf27){_0x492725(_0xdccf27);});};AGIVertices[_0x31af('0x13')][_0x31af('0x47')]=function(_0x2880f3,_0x198969,_0x39201e,_0x275780,_0x1ac4ae){this[_0x31af('0x11')]['createSquareMessage']({'uniqueid':this[_0x31af('0x10')][_0x31af('0x3d')],'body':_0x2880f3,'direction':_0x198969,'providerName':_0x39201e,'providerResponse':_0x275780})[_0x31af('0x16')](function(_0xe75210){if(_0x1ac4ae){_0x1ac4ae(null,_0xe75210);}})[_0x31af('0x18')](function(_0x896839){if(_0x1ac4ae){_0x1ac4ae(_0x896839);}});};AGIVertices[_0x31af('0x13')][_0x31af('0x48')]=function(_0x1a6438,_0x25369b){this[_0x31af('0x11')][_0x31af('0x48')]({'firstName':_[_0x31af('0x49')](_0x1a6438[_0x31af('0x17')])||_['isNil'](_0x1a6438[_0x31af('0x17')])?_0x31af('0x4a')+Math[_0x31af('0x4b')]():_0x1a6438['name'],'lastName':_[_0x31af('0x49')](_0x1a6438[_0x31af('0x4c')])||_[_0x31af('0x4d')](_0x1a6438['lastName'])?null:_0x1a6438[_0x31af('0x4c')],'phone':_0x1a6438[_0x31af('0x4e')],'ListId':_0x1a6438[_0x31af('0x4f')],'scheduledat':_0x1a6438[_0x31af('0x50')],'callbackUniqueid':this[_0x31af('0x10')][_0x31af('0x3d')],'tags':_0x31af('0x51'),'description':'Callback\x20scheduled\x20at\x20'+_0x1a6438[_0x31af('0x50')][_0x31af('0x52')](),'priority':_0x1a6438[_0x31af('0x53')]})[_0x31af('0x16')](function(_0x58c0ff){_0x25369b(null,_0x58c0ff);})['catch'](function(_0x4b57bc){_0x25369b(_0x4b57bc);});};AGIVertices['prototype'][_0x31af('0x54')]=function(_0x152e4f,_0x202634){this[_0x31af('0x11')][_0x31af('0x55')](_0x152e4f)[_0x31af('0x16')](function(_0x5cc45b){_0x202634(null,_0x5cc45b?_0x5cc45b[_0x31af('0x17')]:![]);})['catch'](function(_0x19015d){_0x202634(_0x19015d);});};AGIVertices[_0x31af('0x13')]['agentPause']=function(_0x439171,_0xc6511,_0x5c5834){var _0x820339={'role':_0x31af('0x56')};_0x820339[_0x439171]=this[_0x31af('0x10')][_0x31af('0x40')];this['rpc']['agentPause'](_0x820339,_0xc6511,this[_0x31af('0x10')][_0x31af('0x3d')])['then'](function(_0x345469){_0x5c5834(null,_[_0x31af('0x4d')](_0x345469)?![]:!![]);})[_0x31af('0x18')](function(_0x209038){logger[_0x31af('0x33')](_0x209038);_0x5c5834(null,![]);});};AGIVertices[_0x31af('0x13')]['agentUnpause']=function(_0x28f6ee,_0x45e195){var _0x453db0={'role':_0x31af('0x56')};_0x453db0[_0x28f6ee]=this[_0x31af('0x10')][_0x31af('0x40')];this[_0x31af('0x11')]['agentUnpause'](_0x453db0)[_0x31af('0x16')](function(_0x7e9169){_0x45e195(null,_[_0x31af('0x4d')](_0x7e9169)?![]:!![]);})[_0x31af('0x18')](function(_0x4b1d51){logger[_0x31af('0x33')](_0x4b1d51);_0x45e195(null,![]);});};AGIVertices['prototype'][_0x31af('0x57')]=function(_0x4c71b3,_0x3d3f66){var _0x441679={'role':_0x31af('0x56')};_0x441679[_0x4c71b3]=this[_0x31af('0x10')][_0x31af('0x40')];this[_0x31af('0x11')][_0x31af('0x57')](_0x441679)[_0x31af('0x16')](function(_0x107aba){_0x3d3f66(null,_[_0x31af('0x4d')](_0x107aba)?![]:!![]);})['catch'](function(_0x5d9c73){logger[_0x31af('0x33')](_0x5d9c73);_0x3d3f66(null,![]);});};AGIVertices[_0x31af('0x13')][_0x31af('0x58')]=function(_0x3610a8,_0x1de9ac){var _0x50d8f1={'role':_0x31af('0x56')};_0x50d8f1[_0x3610a8]=this[_0x31af('0x10')]['callerid'];var _0x172f45=_0x3610a8!=_0x31af('0x59')?util[_0x31af('0x30')]('%s/%s@from-sip/n',_0x31af('0x5a'),this[_0x31af('0x10')][_0x31af('0x40')]):undefined;this[_0x31af('0x11')][_0x31af('0x58')](_0x50d8f1,_0x172f45)[_0x31af('0x16')](function(_0x5cccfe){_0x1de9ac(null,_[_0x31af('0x4d')](_0x5cccfe)?![]:!![]);})['catch'](function(_0x4c833a){logger[_0x31af('0x33')](_0x4c833a);_0x1de9ac(null,![]);});};AGIVertices[_0x31af('0x13')][_0x31af('0x5b')]=function(_0x51a7dc,_0x1972c7){sh[_0x31af('0x5c')](_[_0x31af('0x5d')](_0x51a7dc),function(_0x27241d,_0x30e9b5){var _0x2a13d4=_0x30e9b5[_0x31af('0x5e')](/(\r\n|\n|\r)/gm,'');_0x1972c7(null,_0x2a13d4);});};AGIVertices[_0x31af('0x13')][_0x31af('0x5f')]=function(_0x342426,_0x1dbc50){scripts[_0x31af('0x5f')](_0x342426[_0x31af('0x60')],_0x342426['google_cloud_tts_text_type']||_0x31af('0x61'),_0x342426[_0x31af('0x61')],_0x342426[_0x31af('0x62')]||_0x31af('0x63'),_0x342426[_0x31af('0x64')]||'MALE',_0x342426[_0x31af('0x65')]||_0x31af('0x66'))[_0x31af('0x16')](function(_0x52b54a){_0x1dbc50(null,_0x52b54a);})[_0x31af('0x18')](function(_0x4f6354){_0x1dbc50(_0x4f6354);});};AGIVertices['prototype']['googleTTS']=function(_0x26ddb0,_0x147a74){scripts[_0x31af('0x67')](_0x26ddb0[_0x31af('0x61')],_0x26ddb0[_0x31af('0x68')]||'en',0x1)[_0x31af('0x16')](function(_0x625679){_0x147a74(null,_0x625679);})[_0x31af('0x18')](function(_0x499b43){_0x147a74(_0x499b43);});};AGIVertices[_0x31af('0x13')]['restAPI']=function(_0x20ded5,_0x443ad5){var _0x251e98={'uri':_0x20ded5[_0x31af('0x69')],'method':_0x20ded5[_0x31af('0x6a')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x20ded5['timeout'])===_0x31af('0x6b')&&parseInt(_0x20ded5['timeout'])>=0x1?parseInt(_0x20ded5['timeout'])*0x3e8:0x5*0x3e8};if(_['includes']([_0x31af('0x6c'),_0x31af('0x6d')],_0x251e98[_0x31af('0x6a')][_0x31af('0x6e')]())){try{_0x251e98[_0x31af('0x6f')]=_0x20ded5[_0x31af('0xd')]?JSON[_0x31af('0x70')](_0x20ded5['rawBody']):{};}catch(_0x20ce38){logger[_0x31af('0x33')](_0x31af('0x71'),_0x20ce38);}}try{_0x251e98[_0x31af('0x72')]=_0x20ded5[_0x31af('0xc')]?JSON[_0x31af('0x70')](_0x20ded5[_0x31af('0xc')]):{};}catch(_0x38943b){logger[_0x31af('0x33')](_0x31af('0x73'),_0x38943b);}if(_0x20ded5[_0x31af('0x74')]){try{var _0x39f7fd=require(_0x20ded5[_0x31af('0x74')])[_0x31af('0x75')](this,_0x251e98);_0x251e98['uri']=Mustache[_0x31af('0x76')](_0x20ded5['url'],_0x39f7fd,{},['$$','$$']);if(_0x251e98[_0x31af('0x72')]){_0x251e98['headers']=JSON[_0x31af('0x70')](Mustache['render'](JSON['stringify'](_0x251e98[_0x31af('0x72')]),_0x39f7fd,{},['$$','$$']));}if(_0x251e98[_0x31af('0x6f')]){_0x251e98[_0x31af('0x6f')]=JSON[_0x31af('0x70')](Mustache[_0x31af('0x76')](JSON[_0x31af('0x77')](_0x251e98[_0x31af('0x6f')]),_0x39f7fd,{},['$$','$$']));}}catch(_0x17a278){logger['error']('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x17a278);}}rp(_0x251e98)[_0x31af('0x16')](function(_0x2f308e){var _0x85ec13={'statusCode':_0x2f308e[_0x31af('0x78')]||0xc8,'statusMessage':_0x2f308e[_0x31af('0x79')]||'OK','headers':_0x2f308e[_0x31af('0x72')]||{},'body':_0x2f308e[_0x31af('0x6f')]||{}};_0x443ad5(null,_0x85ec13);})['catch'](function(_0xf1a1bf){var _0x2dd7ac={'statusCode':_0xf1a1bf[_0x31af('0x78')]||0x1f4,'statusMessage':_0xf1a1bf['message']||_0x31af('0x7a'),'headers':_0xf1a1bf[_0x31af('0x7b')]['headers']||{},'body':_0xf1a1bf[_0x31af('0x7b')][_0x31af('0x6f')]||{}};_0x443ad5(null,_0x2dd7ac);});};AGIVertices[_0x31af('0x13')]['googleDialogflow']=function(_0x58db8e,_0x68efb7){scripts[_0x31af('0x7c')](this['channel'][_0x31af('0x3d')],_0x58db8e[_0x31af('0x7d')],_0x58db8e['text'],_0x58db8e[_0x31af('0x7e')]||'en')['then'](function(_0x4c2512){_0x68efb7(null,_0x4c2512);})['catch'](function(_0x2f5a27){_0x68efb7(_0x2f5a27);});};AGIVertices[_0x31af('0x13')][_0x31af('0x7f')]=function(_0x3dc355,_0x5bcd7b){scripts['googleDialogflowV2'](this[_0x31af('0x10')][_0x31af('0x3d')],_0x3dc355[_0x31af('0x80')],_0x3dc355['client_email'],_0x3dc355[_0x31af('0x81')],_0x3dc355['text'],_0x3dc355[_0x31af('0x82')]||'en')[_0x31af('0x16')](function(_0x5e10ec){_0x5bcd7b(null,_0x5e10ec);})[_0x31af('0x18')](function(_0x7105d4){_0x5bcd7b(_0x7105d4);});};AGIVertices[_0x31af('0x13')][_0x31af('0x83')]=function(_0x1b940a,_0xbf906e){scripts[_0x31af('0x83')](this[_0x31af('0x10')],_0x1b940a)['then'](function(_0x12810b){_0xbf906e(null,_0x12810b);})[_0x31af('0x18')](function(_0x108c5d){_0xbf906e(_0x108c5d);});};AGIVertices[_0x31af('0x13')][_0x31af('0x84')]=function(_0x1a2d1f,_0x3f3798){scripts[_0x31af('0x84')](_0x1a2d1f[_0x31af('0x7d')],_0x1a2d1f['text'],_0x1a2d1f[_0x31af('0x85')]||_0x31af('0x63'),_0x1a2d1f[_0x31af('0x86')])[_0x31af('0x16')](function(_0x53499f){_0x3f3798(null,_0x53499f);})[_0x31af('0x18')](function(_0x5c23ae){_0x3f3798(_0x5c23ae);});};AGIVertices[_0x31af('0x13')][_0x31af('0x87')]=function(_0x4e09db,_0x97e9d1,_0xb471ad){scripts[_0x31af('0x87')](_0x97e9d1,_0x4e09db[_0x31af('0x7d')],_0x4e09db[_0x31af('0x88')]||'en-US',this[_0x31af('0x89')](_0x4e09db[_0x31af('0x8a')])?_0x4e09db[_0x31af('0x8a')]:undefined)[_0x31af('0x16')](function(_0x23fca2){_0xb471ad(null,_0x23fca2);})[_0x31af('0x18')](function(_0x1e6afa){_0xb471ad(_0x1e6afa);});};AGIVertices[_0x31af('0x13')][_0x31af('0x8b')]=function(_0x473338,_0x650e83){scripts[_0x31af('0x8b')](_0x473338[_0x31af('0x8c')],_0x473338[_0x31af('0x8d')],_0x473338[_0x31af('0x8e')],_0x473338[_0x31af('0x8f')]||_0x31af('0x90'),_0x473338[_0x31af('0x61')],_0x473338['aws_text_type']||_0x31af('0x61'))[_0x31af('0x16')](function(_0x2a78a9){_0x650e83(null,_0x2a78a9);})[_0x31af('0x18')](function(_0x553442){_0x650e83(_0x553442);});};AGIVertices[_0x31af('0x13')][_0x31af('0x91')]=function(_0x4ffaa2,_0x402290){scripts[_0x31af('0x91')](this[_0x31af('0x10')][_0x31af('0x3d')],_0x4ffaa2[_0x31af('0x8c')],_0x4ffaa2['aws_secret_access_key'],_0x4ffaa2['aws_lex_region'],_0x4ffaa2[_0x31af('0x61')],_0x4ffaa2[_0x31af('0x92')])[_0x31af('0x16')](function(_0x2198d9){_0x402290(null,_0x2198d9);})[_0x31af('0x18')](function(_0x562e31){_0x402290(_0x562e31);});};AGIVertices[_0x31af('0x13')][_0x31af('0x93')]=function(_0x574d4a,_0x4a6833,_0x5a6cd5){scripts[_0x31af('0x93')](_0x4a6833,_0x574d4a[_0x31af('0x7d')],_0x574d4a[_0x31af('0x94')]||_0x31af('0x63'))['then'](function(_0x2ae2f0){_0x5a6cd5(null,_0x2ae2f0);})[_0x31af('0x18')](function(_0x58db7b){_0x5a6cd5(_0x58db7b);});};AGIVertices['prototype'][_0x31af('0x95')]=function(_0x1c6cb9,_0x5eff1f,_0x2ad67a){scripts[_0x31af('0x95')](_0x5eff1f,_0x1c6cb9[_0x31af('0x96')],_0x1c6cb9[_0x31af('0x97')],_0x1c6cb9[_0x31af('0x98')])[_0x31af('0x16')](function(_0x50a967){_0x2ad67a(null,_0x50a967);})['catch'](function(_0x436b7b){_0x2ad67a(_0x436b7b);});};AGIVertices[_0x31af('0x13')]['clear']=function(_0xb600ef){var _0x23792f=_[_0x31af('0x99')](verticesWithRetry,_0xb600ef[_0x31af('0x9a')])?_0xb600ef:_[_0x31af('0x9b')](_0xb600ef);for(var _0x758084 in _0x23792f){if(_0x23792f[_0x31af('0x9c')](_0x758084)){if(_0x23792f[_0x758084]&&_[_0x31af('0x9d')](_0x23792f[_0x758084])){if(_[_0x31af('0x99')](recursiveMapAttributes,_0x758084)){_0x23792f[_0x758084]=this[_0x31af('0x9e')](_0x23792f[_0x758084]);}else{_0x23792f[_0x758084]=this[_0x31af('0x9f')](_0x23792f[_0x758084]);}}}}return _0x23792f;};AGIVertices[_0x31af('0x13')][_0x31af('0xa0')]=function(_0x1035a0){for(var _0x3cc775 in _0x1035a0){if(_0x1035a0[_0x31af('0x9c')](_0x3cc775)){if(_[_0x31af('0xa1')](_0x1035a0[_0x3cc775])){this[_0x31af('0xa0')](_0x1035a0[_0x3cc775]);}else if(_['isArray'](_0x1035a0[_0x3cc775])){for(var _0x54d549=0x0;_0x54d549<_0x1035a0[_0x3cc775][_0x31af('0xa2')];_0x54d549++){this[_0x31af('0xa0')](_0x1035a0[_0x3cc775][_0x54d549]);}}else if(_[_0x31af('0x9d')](_0x1035a0[_0x3cc775])){_0x1035a0[_0x3cc775]=this[_0x31af('0x9f')](_0x1035a0[_0x3cc775]);}}}};AGIVertices[_0x31af('0x13')][_0x31af('0xa3')]=function(_0x580ad9,_0xcdbb6b){for(var _0x22de90 in _0x580ad9){if(_0x580ad9[_0x31af('0x9c')](_0x22de90)){if(_['isPlainObject'](_0x580ad9[_0x22de90])){if(!_[_0x31af('0x49')](_0x580ad9[_0x22de90])){this[_0x31af('0xa3')](_0x580ad9[_0x22de90],util[_0x31af('0x30')](_0x31af('0xa4'),_0xcdbb6b,_0x22de90));}}else if(_[_0x31af('0xa5')](_0x580ad9[_0x22de90])){for(var _0x1c254e=0x0;_0x1c254e<_0x580ad9[_0x22de90][_0x31af('0xa2')];_0x1c254e++){this[_0x31af('0xa3')](_0x580ad9[_0x22de90][_0x1c254e],util[_0x31af('0x30')](_0x31af('0xa4'),_0xcdbb6b,_0x22de90+'['+_0x1c254e+']'));}}else{if(!_['isNil'](_0x580ad9[_0x22de90])){this['channel'][_0x31af('0xa6')](util[_0x31af('0x30')](_0x31af('0xa4'),_0xcdbb6b,_0x22de90),_0x580ad9[_0x22de90]);}}}}};AGIVertices[_0x31af('0x13')][_0x31af('0x9e')]=function(_0x429027){try{var _0x25ef0b=JSON['parse'](_0x429027);this['recursiveNodeIndex'](_0x25ef0b);return JSON[_0x31af('0x77')](_0x25ef0b);}catch(_0x287578){return this[_0x31af('0x9f')](_0x429027);}};AGIVertices[_0x31af('0x13')]['replaceAllVariables']=function(_0x56b4c1){var _0x537e5a=_0x56b4c1[_0x31af('0xa7')]('{');for(var _0x176686=0x1;_0x176686<_0x537e5a['length'];_0x176686+=0x1){var _0x454c6c=_0x537e5a[_0x176686][_0x31af('0xa7')]('}');if(_0x454c6c[_0x31af('0xa2')]>0x1){_0x56b4c1=_0x56b4c1[_0x31af('0xa8')]('{'+_0x454c6c[0x0]+'}',this[_0x31af('0x10')][_0x31af('0x14')](_0x454c6c[0x0])[_0x31af('0xa9')]||_0x454c6c[0x0]);}}if(_0x537e5a[_0x31af('0xa2')]===0x1){return _0x56b4c1['toString']();}return this[_0x31af('0x9f')](_0x56b4c1);};AGIVertices[_0x31af('0x13')]['getAndSetVariable']=function(_0x1a3aa6,_0x27834a){var _0x33cdac=this[_0x31af('0x10')]['getVariable'](_0x1a3aa6);if(_0x33cdac[_0x31af('0xaa')]===-0x1){return _0x33cdac;}logger[_0x31af('0x35')](util[_0x31af('0x30')](_0x31af('0xab'),_0x27834a,_0x33cdac[_0x31af('0xa9')]));return this['channel'][_0x31af('0xa6')](_0x27834a,_0x33cdac['extra']);};AGIVertices['prototype'][_0x31af('0x89')]=function(_0x2dfda4){return _0x2dfda4&&_0x2dfda4!=='0'&&_0x2dfda4!=='-1'&&_0x2dfda4!=='';};AGIVertices[_0x31af('0x13')][_0x31af('0xac')]=function(_0x759c19){this[_0x31af('0x3c')]['sync'](this,_0x759c19,'-');_0x759c19['retry']=_0x759c19[_0x31af('0xac')];return{'code':0xc8,'result':'-'};};AGIVertices['prototype']['mrcpsynth']=function(_0x517893){logger[_0x31af('0x35')](util[_0x31af('0x30')](_0x31af('0xad'),_0x517893[_0x31af('0x3e')]));if(!this[_0x31af('0x89')](_0x517893[_0x31af('0x61')])){return this[_0x31af('0x10')][_0x31af('0xae')](_0x31af('0xaf'));}var _0x2823cb='\x22'+_0x517893[_0x31af('0x61')]+'\x22';if(this['isConfigured'](_0x517893[_0x31af('0x7b')])){_0x2823cb+=','+_0x517893[_0x31af('0x7b')];}var _0x42f5d3=this[_0x31af('0x10')][_0x31af('0x5c')](_0x31af('0xb0'),_0x2823cb);if(_0x42f5d3[_0x31af('0xaa')]===-0x1){return _0x42f5d3;}return this[_0x31af('0x10')]['noop'](util[_0x31af('0x30')](_0x31af('0xb1'),_0x2823cb));};AGIVertices[_0x31af('0x13')][_0x31af('0xb2')]=function(_0x58a8f6){logger['info'](util[_0x31af('0x30')]('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x58a8f6[_0x31af('0x3e')]));if(!this[_0x31af('0x89')](_0x58a8f6[_0x31af('0xb3')])){return this[_0x31af('0x10')][_0x31af('0xae')](_0x31af('0xb4'));}var _0x103a8e=_0x58a8f6[_0x31af('0xb3')];if(this[_0x31af('0x89')](_0x58a8f6[_0x31af('0x7b')])){_0x103a8e+=','+_0x58a8f6[_0x31af('0x7b')];}var _0x28ba13=this[_0x31af('0x10')][_0x31af('0x5c')](_0x31af('0xb5'),_0x103a8e);if(_0x28ba13['result']===-0x1){return _0x28ba13;}var _0x25ebed=this[_0x31af('0xb6')](_0x31af('0xb7'),_0x31af('0xb8'));if(_0x25ebed[_0x31af('0xaa')]===-0x1){return _0x25ebed;}var _0xa855d1=this['getAndSetVariable'](_0x31af('0xb9'),_0x31af('0xba'));if(_0xa855d1[_0x31af('0xaa')]===-0x1){return _0xa855d1;}var _0x5bf030=this[_0x31af('0xb6')]('RECOG_INSTANCE()','MRCP_RECOG_INSTANCE');if(_0x5bf030['result']===-0x1){return _0x5bf030;}return this[_0x31af('0x10')]['noop'](util[_0x31af('0x30')]('Executed\x20command\x20MRCPRecog\x20%s',_0x103a8e));};AGIVertices[_0x31af('0x13')][_0x31af('0x9')]=function(_0x4925c7){logger['info'](util[_0x31af('0x30')](_0x31af('0xbb'),_0x4925c7[_0x31af('0x3e')]));return this[_0x31af('0x10')]['agi']([_0x4925c7[_0x31af('0xbc')],_0x4925c7['args']]);};AGIVertices[_0x31af('0x13')][_0x31af('0xbd')]=function(_0x901ab3){logger['info'](util[_0x31af('0x30')](_0x31af('0xbe'),_0x901ab3[_0x31af('0x3e')]));if(this[_0x31af('0x89')](_0x901ab3[_0x31af('0xbf')])){logger['info'](util['format'](_0x31af('0xc0'),_0x901ab3['timeout']));var _0x11c047=this['channel'][_0x31af('0xc1')](_0x901ab3[_0x31af('0xbf')]);if(_0x11c047[_0x31af('0xaa')]===-0x1){return _0x11c047;}}return this[_0x31af('0x10')][_0x31af('0xbd')]();};AGIVertices['prototype'][_0x31af('0x51')]=function(_0x472ed9){logger[_0x31af('0x35')](util[_0x31af('0x30')](_0x31af('0xc2'),_0x472ed9['label']));if(!this[_0x31af('0x89')](_0x472ed9['list_id'])){return this[_0x31af('0x10')][_0x31af('0x33')](_0x472ed9,'no\x20list\x20selected');}_0x472ed9['scheduledAt']=moment();if(this['isConfigured'](_0x472ed9[_0x31af('0xc3')])){_0x472ed9[_0x31af('0x50')]=moment()['add'](_0x472ed9[_0x31af('0xc3')],_0x31af('0xc4'));}if(!this['isConfigured'](_0x472ed9[_0x31af('0x53')])){_0x472ed9[_0x31af('0x53')]=0x2;}this[_0x31af('0x48')][_0x31af('0x75')](this,_0x472ed9);return this[_0x31af('0x10')]['noop'](util[_0x31af('0x30')](_0x31af('0xc5'),_0x472ed9[_0x31af('0x4e')],_0x472ed9[_0x31af('0x4f')],_0x472ed9[_0x31af('0x50')]));};AGIVertices[_0x31af('0x13')][_0x31af('0xc6')]=function(_0x1a3049){logger['info'](util[_0x31af('0x30')](_0x31af('0xc7'),_0x1a3049[_0x31af('0x3e')]));var _0x2751d6=this[_0x31af('0x10')]['exec'](_0x1a3049['application'],_0x1a3049['options']);if(_0x2751d6['result']===-0x1){return _0x2751d6;}return this['channel'][_0x31af('0xae')](util['format']('Executed\x20command\x20%s\x20%s',_0x1a3049[_0x31af('0xc8')],_0x1a3049['options']));};AGIVertices['prototype'][_0x31af('0xc9')]=function(_0x55183d){logger['info'](util[_0x31af('0x30')](_0x31af('0xca'),_0x55183d[_0x31af('0x3e')]));if(!this[_0x31af('0x89')](_0x55183d[_0x31af('0x61')])){return this[_0x31af('0x10')][_0x31af('0xae')](_0x31af('0xaf'));}var _0x1dccc5='\x22'+_0x55183d[_0x31af('0x61')]+'\x22';if(this[_0x31af('0x89')](_0x55183d[_0x31af('0x7b')])){_0x1dccc5+=','+_0x55183d[_0x31af('0x7b')];}var _0x398174=this[_0x31af('0x10')][_0x31af('0x5c')](_0x31af('0xb0'),_0x1dccc5);if(_0x398174[_0x31af('0xaa')]===-0x1){return _0x398174;}return this['channel'][_0x31af('0xae')](util['format']('Executed\x20command\x20MRCPSynth\x20%s',_0x1dccc5));};AGIVertices[_0x31af('0x13')][_0x31af('0xcb')]=function(_0xae3285){logger[_0x31af('0x35')](util[_0x31af('0x30')](_0x31af('0xcc'),_0xae3285[_0x31af('0x3e')]));if(!this[_0x31af('0x89')](_0xae3285[_0x31af('0x61')])){return this[_0x31af('0x10')][_0x31af('0xae')]('no\x20text\x20configured');}var _0x4607a2='\x22'+_0xae3285[_0x31af('0x61')]+'\x22';if(this[_0x31af('0x89')](_0xae3285[_0x31af('0x7b')])){_0x4607a2+=','+_0xae3285[_0x31af('0x7b')];}var _0x50ab11=this[_0x31af('0x10')][_0x31af('0x5c')](_0x31af('0xb0'),_0x4607a2);if(_0x50ab11[_0x31af('0xaa')]===-0x1){return _0x50ab11;}return this[_0x31af('0x10')][_0x31af('0xae')](util[_0x31af('0x30')]('Executed\x20command\x20MRCPSynth\x20%s',_0x4607a2));};AGIVertices[_0x31af('0x13')]['lumenvoxasr']=function(_0xb69db4){logger[_0x31af('0x35')](util[_0x31af('0x30')](_0x31af('0xcd'),_0xb69db4[_0x31af('0x3e')]));if(!this[_0x31af('0x89')](_0xb69db4[_0x31af('0xb3')])){return this[_0x31af('0x10')]['noop']('no\x20grammar\x20configured');}var _0x37cbda=_0xb69db4['grammar'];if(this[_0x31af('0x89')](_0xb69db4[_0x31af('0x7b')])){_0x37cbda+=','+_0xb69db4[_0x31af('0x7b')];}var _0xfc89a7=this['channel'][_0x31af('0x5c')]('MRCPRecog',_0x37cbda);if(_0xfc89a7['result']===-0x1){return _0xfc89a7;}var _0x226ae0=this['getAndSetVariable'](_0x31af('0xb7'),_0x31af('0xce'));if(_0x226ae0[_0x31af('0xaa')]===-0x1){return _0x226ae0;}var _0x583288=this[_0x31af('0xb6')](_0x31af('0xb9'),_0x31af('0xcf'));if(_0x583288[_0x31af('0xaa')]===-0x1){return _0x583288;}var _0x50f27c=this['getAndSetVariable'](_0x31af('0xd0'),_0x31af('0xd1'));if(_0x50f27c[_0x31af('0xaa')]===-0x1){return _0x50f27c;}return this[_0x31af('0x10')][_0x31af('0xae')](util[_0x31af('0x30')]('Executed\x20command\x20MRCPRecog\x20%s',_0x37cbda));};AGIVertices[_0x31af('0x13')]['sestekasr']=function(_0xec1a1e){logger[_0x31af('0x35')](util[_0x31af('0x30')](_0x31af('0xd2'),_0xec1a1e[_0x31af('0x3e')]));if(!this[_0x31af('0x89')](_0xec1a1e[_0x31af('0xb3')])){return this[_0x31af('0x10')]['noop'](_0x31af('0xb4'));}var _0x596c49=_0xec1a1e[_0x31af('0xb3')];if(this['isConfigured'](_0xec1a1e['options'])){_0x596c49+=','+_0xec1a1e[_0x31af('0x7b')];}var _0x261f0b=this['channel'][_0x31af('0x5c')](_0x31af('0xb5'),_0x596c49);if(_0x261f0b['result']===-0x1){return _0x261f0b;}var _0xa23096=this[_0x31af('0xb6')](_0x31af('0xb7'),_0x31af('0xd3'));if(_0xa23096[_0x31af('0xaa')]===-0x1){return _0xa23096;}var _0x39422f=this['getAndSetVariable'](_0x31af('0xb9'),_0x31af('0xd4'));if(_0x39422f['result']===-0x1){return _0x39422f;}var _0x2b6a24=this[_0x31af('0xb6')]('RECOG_INSTANCE()',_0x31af('0xd5'));if(_0x2b6a24[_0x31af('0xaa')]===-0x1){return _0x2b6a24;}return this[_0x31af('0x10')][_0x31af('0xae')](util[_0x31af('0x30')]('Executed\x20command\x20MRCPRecog\x20%s',_0x596c49));};AGIVertices['prototype'][_0x31af('0xd6')]=function(_0x5bee36){logger[_0x31af('0x35')](util[_0x31af('0x30')]('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0x5bee36[_0x31af('0x3e')]));if(!this[_0x31af('0x89')](_0x5bee36[_0x31af('0xd7')])){return this['channel'][_0x31af('0x33')](_0x5bee36,_0x31af('0xd8'));}var _0x2203c8=this[_0x31af('0x1d')]['sync'](this,_0x5bee36[_0x31af('0xd7')]);if(!_0x2203c8){return this[_0x31af('0x10')][_0x31af('0x33')](_0x5bee36,_0x31af('0xd9'));}if(!this['isConfigured'](_0x5bee36[_0x31af('0xda')])){return this[_0x31af('0x10')][_0x31af('0x33')](_0x5bee36,_0x31af('0xdb'));}var _0x59380d=_0x5bee36[_0x31af('0xda')]['replace'](/(\r\n|\n|\r)/gm,'\x20');this[_0x31af('0x10')][_0x31af('0xae')](util[_0x31af('0x30')](_0x31af('0xdc'),_0x59380d));var _0x550442=this[_0x31af('0xdd')][_0x31af('0x75')](this,_0x2203c8,_0x59380d);this[_0x31af('0x3c')][_0x31af('0x75')](this,_0x5bee36,_0x59380d);if(!this[_0x31af('0x89')](_0x5bee36[_0x31af('0xde')])){return this[_0x31af('0x10')][_0x31af('0xae')](_0x31af('0xdf'));}var _0x49b136=this[_0x31af('0x14')][_0x31af('0x75')](this,_0x5bee36[_0x31af('0xde')]);if(!_0x49b136){return this['channel']['error'](_0x5bee36,'no\x20variable\x20found');}var _0x422cfa=this;_0x550442[_0x31af('0xe0')](function(_0x2a7f25,_0x29691a){Object[_0x31af('0xe1')](_0x2a7f25)['forEach'](function(_0x2a3213){_0x422cfa[_0x31af('0x10')][_0x31af('0xa6')](util['format'](_0x31af('0xe2'),_0x49b136,_0x29691a,_0x2a3213),_0x2a7f25[_0x2a3213]);});});this['channel'][_0x31af('0xa6')](util[_0x31af('0x30')](_0x31af('0xe3'),_0x49b136),_0x550442[_0x31af('0xa2')]);return this[_0x31af('0x10')][_0x31af('0xae')](util[_0x31af('0x30')](_0x31af('0xe4'),_0x49b136));};AGIVertices[_0x31af('0x13')][_0x31af('0xe5')]=function(_0x2e8ffd){logger[_0x31af('0xe6')](util[_0x31af('0x30')](_0x31af('0xe7'),_0x2e8ffd['label']));if(!this['isConfigured'](_0x2e8ffd['sip_id'])){return this[_0x31af('0x10')][_0x31af('0x33')](_0x2e8ffd,_0x31af('0xe8'));}var _0x132096=this[_0x31af('0x20')][_0x31af('0x75')](this,_0x2e8ffd[_0x31af('0xe9')]);if(!_0x132096){return this[_0x31af('0x10')][_0x31af('0x33')](_0x2e8ffd,'no\x20user\x20found');}var _0x39a7f3=this['channel']['exec'](_0x31af('0xea'),[util['format'](_0x31af('0xeb'),_0x132096),_0x2e8ffd[_0x31af('0xbf')],_0x2e8ffd[_0x31af('0xec')],_0x2e8ffd[_0x31af('0x69')]]);if(_0x39a7f3[_0x31af('0xaa')]===-0x1){return _0x39a7f3;}return this[_0x31af('0x10')][_0x31af('0xae')](util['format'](_0x31af('0xed'),_0x31af('0xea')));};AGIVertices['prototype'][_0x31af('0xee')]=function(_0x1d7815){logger['info'](util['format']('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x1d7815['label']));if(!this[_0x31af('0x89')](_0x1d7815['key'])){return this[_0x31af('0x10')]['noop'](_0x31af('0xef'));}if(!this[_0x31af('0x89')](_0x1d7815[_0x31af('0x61')])){return this[_0x31af('0x10')]['noop'](_0x31af('0xaf'));}this[_0x31af('0x10')]['bot']=!![];this[_0x31af('0x3c')](_0x1d7815);this[_0x31af('0x47')](_0x1d7815['text'],'in','','');this[_0x31af('0x10')][_0x31af('0xae')](util['format'](_0x31af('0xf0'),_0x1d7815[_0x31af('0x61')]));var _0x4ca7e7=this[_0x31af('0x7c')]['sync'](this,_0x1d7815);if(_0x4ca7e7){for(var _0x398ac1 in _0x4ca7e7){if(_0x4ca7e7[_0x31af('0x9c')](_0x398ac1)){this[_0x31af('0x10')][_0x31af('0xa6')](util[_0x31af('0x30')](_0x31af('0xf1'),_0x398ac1[_0x31af('0x6e')]()),_0x4ca7e7[_0x398ac1]);}}this['createSquareMessage'](_0x4ca7e7[_0x31af('0xf2')],_0x31af('0xf3'),_0x31af('0xee'),'');return this[_0x31af('0x10')][_0x31af('0xae')](util[_0x31af('0x30')]('Dialogflow\x20Result\x20%s',_0x4ca7e7[_0x31af('0xf2')]));}return this['channel'][_0x31af('0x33')](_0x1d7815,'Dialogflow\x20is\x20unreachable');};AGIVertices[_0x31af('0x13')][_0x31af('0xf4')]=function(_0x7daa3a){logger['info'](util[_0x31af('0x30')](_0x31af('0xf5'),_0x7daa3a[_0x31af('0x3e')]));if(!this['isConfigured'](_0x7daa3a[_0x31af('0x80')])){return this['channel'][_0x31af('0xae')](_0x31af('0xf6'));}if(!this['isConfigured'](_0x7daa3a[_0x31af('0xf7')])){return this[_0x31af('0x10')][_0x31af('0xae')](_0x31af('0xf8'));}if(!this[_0x31af('0x89')](_0x7daa3a['private_key'])){return this[_0x31af('0x10')][_0x31af('0xae')]('no\x20private_key\x20configured');}if(!this[_0x31af('0x89')](_0x7daa3a[_0x31af('0x82')])){return this[_0x31af('0x10')][_0x31af('0xae')](_0x31af('0xf9'));}if(!this[_0x31af('0x89')](_0x7daa3a['text'])){return this['channel'][_0x31af('0xae')](_0x31af('0xaf'));}this[_0x31af('0x10')][_0x31af('0xfa')]=!![];this['createSquareDetailsReport'](_0x7daa3a);this['createSquareMessage'](_0x7daa3a[_0x31af('0x61')],'in','','');this['channel'][_0x31af('0xae')](util['format']('Trying\x20DialogflowV2:\x20%s',_0x7daa3a[_0x31af('0x61')]));var _0x32f99c=this[_0x31af('0x7f')]['sync'](this,_0x7daa3a);if(_0x32f99c){for(var _0x5b9481 in _0x32f99c){if(_0x32f99c[_0x31af('0x9c')](_0x5b9481)){if(_0x5b9481!==_0x31af('0xfb')){this['channel'][_0x31af('0xa6')](util[_0x31af('0x30')](_0x31af('0xf1'),_0x5b9481['toUpperCase']()),_0x32f99c[_0x5b9481]);}}}this[_0x31af('0x47')](_0x32f99c[_0x31af('0xf2')],_0x31af('0xf3'),'dialogflowV2',_0x32f99c[_0x31af('0xfb')]);return this['channel'][_0x31af('0xae')](util[_0x31af('0x30')]('DialogflowV2\x20Result\x20%s',_0x32f99c['speech']));}return this[_0x31af('0x10')][_0x31af('0x33')](_0x7daa3a,_0x31af('0xfc'));};AGIVertices[_0x31af('0x13')][_0x31af('0xfd')]=function(_0x4152ba){logger[_0x31af('0x35')](util[_0x31af('0x30')](_0x31af('0xfe'),_0x4152ba[_0x31af('0x3e')]));if(!this['isConfigured'](_0x4152ba[_0x31af('0xff')])){return this['channel'][_0x31af('0xae')](_0x31af('0x100'));}if(!this[_0x31af('0x89')](_0x4152ba[_0x31af('0x101')])){return this['channel'][_0x31af('0xae')](_0x31af('0x102'));}if(!this['isConfigured'](_0x4152ba[_0x31af('0x103')])){return this['channel'][_0x31af('0xae')](_0x31af('0x104'));}if(!this[_0x31af('0x89')](_0x4152ba['ndassistant_url'])){return this['channel'][_0x31af('0xae')](_0x31af('0xaf'));}this['channel'][_0x31af('0xfa')]=!![];this[_0x31af('0x3c')](_0x4152ba);this[_0x31af('0x47')](_0x4152ba[_0x31af('0x61')],'in','','');this[_0x31af('0x10')][_0x31af('0xae')](util[_0x31af('0x30')](_0x31af('0x105'),_0x4152ba[_0x31af('0x61')]));var _0x245f0f=this['sestekNDA'][_0x31af('0x75')](this,_0x4152ba);if(_0x245f0f){for(var _0x54bd26 in _0x245f0f){if(_0x245f0f[_0x31af('0x9c')](_0x54bd26)){this['channel'][_0x31af('0xa6')](util[_0x31af('0x30')](_0x31af('0x106'),_0x54bd26['toUpperCase']()),_0x245f0f[_0x54bd26]);}}this[_0x31af('0x47')](_0x245f0f['speech'],_0x31af('0xf3'),_0x31af('0xfd'),'');if(_0x245f0f[_0x31af('0x107')]){this['channel'][_0x31af('0xae')](util[_0x31af('0x30')](_0x31af('0x108'),_0x245f0f[_0x31af('0x107')]));var _0x5361d6=this['channel'][_0x31af('0x109')](_0x245f0f[_0x31af('0x107')]);try{fs[_0x31af('0x10a')](_0x245f0f[_0x31af('0x107')]+_0x31af('0x10b'));}catch(_0xca933f){logger[_0x31af('0x33')](_0xca933f);}return _0x5361d6;}else{return this[_0x31af('0x10')][_0x31af('0xae')](util[_0x31af('0x30')](_0x31af('0x10c'),_0x245f0f[_0x31af('0xf2')]));}}return this['channel'][_0x31af('0x33')](_0x4152ba,_0x31af('0x10d'));};AGIVertices[_0x31af('0x13')][_0x31af('0x10e')]=function(_0x3d18e7){logger[_0x31af('0x35')](util[_0x31af('0x30')](_0x31af('0x10f'),_0x3d18e7[_0x31af('0x3e')]));return this['channel'][_0x31af('0xae')](_0x31af('0x10e'));};AGIVertices[_0x31af('0x13')]['ext_dial']=function(_0x24c5d5){logger['info'](util[_0x31af('0x30')](_0x31af('0x110'),_0x24c5d5[_0x31af('0x3e')]));var _0x3c9dad='';if(_0x24c5d5['trunk_id']){if(!this[_0x31af('0x89')](_0x24c5d5['trunk_id'])){return this[_0x31af('0x10')][_0x31af('0x33')](_0x24c5d5,_0x31af('0x111'));}else{var _0x513617=parseInt(_0x24c5d5[_0x31af('0x112')],0xa);if(isNaN(_0x513617)){_0x3c9dad=_0x24c5d5[_0x31af('0x112')];}else{_0x3c9dad=this[_0x31af('0x22')][_0x31af('0x75')](this,_0x24c5d5[_0x31af('0x112')]);if(!_0x3c9dad){return this['channel'][_0x31af('0x33')](_0x24c5d5,_0x31af('0x113'));}}}}else if(_0x24c5d5[_0x31af('0x114')]){_0x3c9dad=_0x24c5d5[_0x31af('0x114')];}else{return this[_0x31af('0x10')][_0x31af('0x33')](_0x24c5d5,_0x31af('0x111'));}var _0x579c71=this[_0x31af('0x10')][_0x31af('0x5c')]('DIAL',[util[_0x31af('0x30')](_0x31af('0x115'),_0x3c9dad,_0x24c5d5[_0x31af('0x4e')]),_0x24c5d5['timeout'],_0x24c5d5['opts'],_0x24c5d5['url']]);if(_0x579c71[_0x31af('0xaa')]===-0x1){return _0x579c71;}return this[_0x31af('0x10')]['noop'](util[_0x31af('0x30')](_0x31af('0xed'),_0x31af('0xea')));};AGIVertices[_0x31af('0x13')]['finally']=function(_0x210d4d){logger[_0x31af('0x35')](util[_0x31af('0x30')]('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x210d4d['label']));return this[_0x31af('0x10')][_0x31af('0xae')](_0x31af('0x116'));};AGIVertices[_0x31af('0x13')][_0x31af('0xe')]=function(_0xa48379){logger[_0x31af('0x35')](util[_0x31af('0x30')](_0x31af('0x117'),_0xa48379[_0x31af('0x3e')]));if(_0xa48379[_0x31af('0x118')]===0x0){return this[_0x31af('0xac')](_0xa48379);}_0xa48379[_0x31af('0x118')]-=0x1;if(!this[_0x31af('0x89')](_0xa48379[_0x31af('0x119')])){return this[_0x31af('0x10')]['error'](_0xa48379,_0x31af('0x11a'));}var _0xb478f3=this[_0x31af('0x23')]['sync'](this,_0xa48379[_0x31af('0x119')]);if(!_0xb478f3){return this[_0x31af('0x10')]['error'](_0xa48379,_0x31af('0x11b'));}if(!this['isConfigured'](_0xa48379[_0x31af('0xde')])){return this[_0x31af('0x10')][_0x31af('0x33')](_0x31af('0xdf'));}var _0x4a149f=this[_0x31af('0x10')][_0x31af('0x11c')](_0xb478f3,_0xa48379['response'],_0xa48379[_0x31af('0x11d')]);var _0x2af1a9=_0x4a149f['result']?_0x4a149f[_0x31af('0xaa')][_0x31af('0x52')]():'';logger[_0x31af('0x35')](_0x31af('0x11e'),JSON['stringify'](_0x4a149f));if(_0x4a149f['result']===-0x1){this[_0x31af('0x3c')][_0x31af('0x75')](this,_0xa48379,_0x2af1a9);return _0x4a149f;}else if(_0x4a149f[_0x31af('0xa9')]===_0x31af('0xbf')){_0x4a149f[_0x31af('0xaa')]=_0x2af1a9[_0x31af('0xa2')]>=parseInt(_0xa48379[_0x31af('0x11f')])?'x':'i';}else{_0x4a149f[_0x31af('0xaa')]=_0x2af1a9['length']>=parseInt(_0xa48379[_0x31af('0x11f')])&&_0x2af1a9[_0x31af('0xa2')]<=parseInt(_0xa48379[_0x31af('0x11d')])?'x':'i';}var _0x3de225=this['getVariable'][_0x31af('0x75')](this,_0xa48379[_0x31af('0xde')]);if(!_0x3de225){return this[_0x31af('0x10')][_0x31af('0x33')](_0xa48379,_0x31af('0x120'));}this[_0x31af('0x10')][_0x31af('0xa6')](_0x3de225,_0x2af1a9);if(this[_0x31af('0x89')](_0xa48379[_0x31af('0x121')])){var _0x55d1fb=parseInt(_0xa48379[_0x31af('0x121')],0xa);var _0x1fa7e0=rs[_0x31af('0x122')]({'charset':'*','length':_0x55d1fb});var _0x1a09c6=_0x2af1a9[_0x31af('0xa2')];if(_0x1a09c6>0x0){if(_0x1a09c6>_0x55d1fb){this[_0x31af('0x3c')][_0x31af('0x75')](this,_0xa48379,_0xa48379[_0x31af('0x123')]===_0x31af('0x124')?_0x1fa7e0+_0x2af1a9['substr'](_0x55d1fb):_0x2af1a9[_0x31af('0x125')](0x0,_0x1a09c6-_0x55d1fb)+_0x1fa7e0);}else{this[_0x31af('0x3c')][_0x31af('0x75')](this,_0xa48379,rs[_0x31af('0x122')]({'charset':'*','length':_0x1a09c6}));}}else{this[_0x31af('0x3c')][_0x31af('0x75')](this,_0xa48379,'');}}else{this['createSquareDetailsReport'][_0x31af('0x75')](this,_0xa48379,_0x2af1a9);}return _0x4a149f;};AGIVertices[_0x31af('0x13')][_0x31af('0xf')]=function(_0x293f4a){logger['info'](util['format'](_0x31af('0x126'),_0x293f4a[_0x31af('0x3e')]));return this[_0x31af('0xe')](_0x293f4a);};AGIVertices['prototype']['goal']=function(_0x334c75){logger['info'](util['format']('Enter\x20in\x20GOAL\x20(%s)\x20block',_0x334c75['label']));this[_0x31af('0x3c')]['sync'](this,_0x334c75,_0x334c75[_0x31af('0x127')]);return this['channel'][_0x31af('0xae')](util[_0x31af('0x30')](_0x31af('0x128'),_0x334c75[_0x31af('0x127')]));};AGIVertices[_0x31af('0x13')][_0x31af('0x129')]=function(_0x2ae295){logger[_0x31af('0x35')](util['format'](_0x31af('0x12a'),_0x2ae295[_0x31af('0x3e')]));if(!this[_0x31af('0x89')](_0x2ae295[_0x31af('0x8c')])||!this[_0x31af('0x89')](_0x2ae295[_0x31af('0x8d')])){return this[_0x31af('0x10')][_0x31af('0xae')]('no\x20valid\x20credentials\x20configured');}if(!this['isConfigured'](_0x2ae295[_0x31af('0x61')])){return this['channel'][_0x31af('0xae')]('no\x20text\x20configured');}this[_0x31af('0x10')]['noop'](util[_0x31af('0x30')](_0x31af('0x12b'),_0x2ae295['text']));var _0x4136c0=this[_0x31af('0x8b')][_0x31af('0x75')](this,_0x2ae295);if(_0x4136c0){this[_0x31af('0x10')][_0x31af('0xae')](util[_0x31af('0x30')](_0x31af('0x12c'),_0x4136c0));var _0x539ce3=this[_0x31af('0x10')][_0x31af('0x109')](_0x4136c0);try{fs['unlink'](_0x4136c0+_0x31af('0x10b'));}catch(_0x2ea778){logger[_0x31af('0x33')](_0x2ea778);}return _0x539ce3;}return this[_0x31af('0x10')][_0x31af('0x33')](_0x2ae295,_0x31af('0x12d'));};AGIVertices['prototype']['awslex']=function(_0x378c06){logger['info'](util[_0x31af('0x30')]('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x378c06[_0x31af('0x3e')]));if(!this['isConfigured'](_0x378c06[_0x31af('0x8c')])||!this[_0x31af('0x89')](_0x378c06[_0x31af('0x8d')])){return this['channel']['noop'](_0x31af('0x12e'));}if(!this[_0x31af('0x89')](_0x378c06[_0x31af('0x92')])){return this[_0x31af('0x10')][_0x31af('0xae')](_0x31af('0x12f'));}if(!this[_0x31af('0x89')](_0x378c06[_0x31af('0x61')])){return this[_0x31af('0x10')]['noop'](_0x31af('0xaf'));}this[_0x31af('0x10')][_0x31af('0xfa')]=!![];this[_0x31af('0x3c')](_0x378c06);this[_0x31af('0x47')](_0x378c06[_0x31af('0x61')],'in','','');this[_0x31af('0x10')][_0x31af('0xae')](util['format'](_0x31af('0x130'),_0x378c06[_0x31af('0x61')]));var _0x5cc479=this[_0x31af('0x91')][_0x31af('0x75')](this,_0x378c06);if(_0x5cc479){for(var _0x25e488 in _0x5cc479){if(_0x5cc479[_0x31af('0x9c')](_0x25e488)&&_['isString'](_0x5cc479[_0x25e488])){this[_0x31af('0x10')][_0x31af('0xa6')](util[_0x31af('0x30')]('AWS_LEX_%s',_0x25e488[_0x31af('0x6e')]()),_0x5cc479[_0x25e488]);}}if(_[_0x31af('0x4d')](_0x5cc479[_0x31af('0x131')])){return this['channel']['noop']('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this[_0x31af('0x47')](_0x5cc479['message'],_0x31af('0xf3'),_0x31af('0x132'),'');return this[_0x31af('0x10')]['noop'](util[_0x31af('0x30')](_0x31af('0x133'),_0x5cc479[_0x31af('0x131')]));}}return this['channel'][_0x31af('0x33')](_0x378c06,'Amazon\x20Lex\x20is\x20unreachable');};AGIVertices[_0x31af('0x13')]['googleasr']=function(_0x5ee9c4){logger[_0x31af('0x35')](util[_0x31af('0x30')](_0x31af('0x134'),_0x5ee9c4[_0x31af('0x3e')],_0x5ee9c4[_0x31af('0xbf')]));if(!this[_0x31af('0x89')](_0x5ee9c4[_0x31af('0x7d')])){return this[_0x31af('0x10')][_0x31af('0xae')](_0x31af('0xef'));}var _0x369724=_0x31af('0x135');var _0x1244e2=util[_0x31af('0x30')](_0x31af('0x136'),FILES_PATH,rs[_0x31af('0x122')](0x4));var _0x52dfb5=util[_0x31af('0x30')]('%s.%s',_0x1244e2,_0x369724);var _0x25fd41=!![];if(_0x5ee9c4[_0x31af('0x137')]==='NOBEEP'){_0x25fd41=![];}var _0x34f52d=this['channel'][_0x31af('0x138')](_0x1244e2,_0x369724,_0x5ee9c4[_0x31af('0x139')],_0x5ee9c4[_0x31af('0xbf')],undefined,_0x25fd41);if(_0x34f52d[_0x31af('0xaa')]!==-0x1){this[_0x31af('0x10')]['noop'](util[_0x31af('0x30')]('google\x20%s\x20file\x20created',_0x52dfb5));var _0x47a056=this[_0x31af('0x93')][_0x31af('0x75')](this,_0x5ee9c4,_0x52dfb5);if(_0x47a056){for(var _0x1fdb84 in _0x47a056){if(_0x47a056[_0x31af('0x9c')](_0x1fdb84)){this[_0x31af('0x10')][_0x31af('0xa6')](util[_0x31af('0x30')](_0x31af('0x13a'),_0x1fdb84[_0x31af('0x6e')]()),_0x47a056[_0x1fdb84]);}}return this['channel']['noop'](util[_0x31af('0x30')](_0x31af('0x13b'),JSON[_0x31af('0x77')](_0x47a056)));}}return _0x34f52d;};AGIVertices['prototype'][_0x31af('0x13c')]=function(_0xdb4fe7){logger[_0x31af('0x35')](util[_0x31af('0x30')](_0x31af('0x13d'),_0xdb4fe7[_0x31af('0x3e')]));if(!this[_0x31af('0x89')](_0xdb4fe7['appid'])){return this['channel']['noop'](_0x31af('0x13e'));}if(!this[_0x31af('0x89')](_0xdb4fe7[_0x31af('0x97')])){return this['channel'][_0x31af('0xae')](_0x31af('0x13f'));}var _0x3149f4=_0x31af('0x135');var _0x2ad480=util[_0x31af('0x30')]('%s/recordings/%s',FILES_PATH,rs[_0x31af('0x122')](0x4));var _0x4d06f4=util['format']('%s.%s',_0x2ad480,_0x3149f4);var _0x139379=!![];if(_0xdb4fe7[_0x31af('0x137')]==='NOBEEP'){_0x139379=![];}var _0x1331be=this[_0x31af('0x10')][_0x31af('0x138')](_0x2ad480,_0x3149f4,_0xdb4fe7[_0x31af('0x139')],_0xdb4fe7[_0x31af('0xbf')],undefined,_0x139379);if(_0x1331be['result']!==-0x1){this[_0x31af('0x10')][_0x31af('0xae')](util['format']('tilde\x20%s\x20file\x20created',_0x4d06f4));var _0x209ed9=this[_0x31af('0x95')]['sync'](this,_0xdb4fe7,_0x4d06f4);if(_0x209ed9){for(var _0x3301f7 in _0x209ed9){if(_0x209ed9[_0x31af('0x9c')](_0x3301f7)){this['channel'][_0x31af('0xa6')](util[_0x31af('0x30')](_0x31af('0x140'),_0x3301f7['toUpperCase']()),_0x209ed9[_0x3301f7]);}}return this[_0x31af('0x10')]['noop'](util['format'](_0x31af('0x141'),JSON[_0x31af('0x77')](_0x209ed9)));}}return _0x1331be;};AGIVertices['prototype'][_0x31af('0x142')]=function(_0x4690e6){logger['info'](util[_0x31af('0x30')](_0x31af('0x143'),_0x4690e6[_0x31af('0x3e')]));return this[_0x31af('0x10')][_0x31af('0x144')](_0x4690e6[_0x31af('0x43')],_0x4690e6['extension'],_0x4690e6[_0x31af('0x44')]);};AGIVertices[_0x31af('0x13')]['gotoif']=function(_0x2a7a52){logger['info'](util[_0x31af('0x30')](_0x31af('0x145'),_0x2a7a52[_0x31af('0x3e')]));if(!this[_0x31af('0x89')](_0x2a7a52[_0x31af('0x146')])){return this[_0x31af('0x10')][_0x31af('0x33')](_0x2a7a52,_0x31af('0x147'));}try{var _0x38bb3b=eval(_0x2a7a52[_0x31af('0x146')])?_0x31af('0x148'):_0x31af('0x149');this[_0x31af('0x10')][_0x31af('0xae')](util['format'](_0x31af('0x14a'),_0x2a7a52['condition'],_0x38bb3b));return{'code':0xc8,'result':_0x38bb3b};}catch(_0x5bf376){return{'code':0xc8,'result':'false'};}};AGIVertices[_0x31af('0x13')][_0x31af('0x14b')]=function(_0x753a4b){logger[_0x31af('0x35')](util['format']('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x753a4b[_0x31af('0x3e')]));if(!this[_0x31af('0x89')](_0x753a4b[_0x31af('0x14c')])){return this[_0x31af('0x10')][_0x31af('0x33')](_0x753a4b,'no\x20interval\x20configured');}var _0x4a4e13=this[_0x31af('0x29')][_0x31af('0x75')](this,_0x753a4b['interval_id']);if(!_0x4a4e13){return this[_0x31af('0x10')][_0x31af('0x33')](_0x753a4b,_0x31af('0x14d'));}for(var _0x441dd4=0x0;_0x441dd4<_0x4a4e13[_0x31af('0xa2')];_0x441dd4+=0x1){var _0x3c36aa=this[_0x31af('0x10')]['getVariable'](util[_0x31af('0x30')]('IFTIME(%s?true:false)',_0x4a4e13[_0x441dd4]));if(_0x3c36aa['result']===-0x1){return _0x3c36aa;}logger['info'](util[_0x31af('0x30')](_0x31af('0x14e'),_0x4a4e13[_0x441dd4],_0x3c36aa[_0x31af('0xa9')]));if(_0x3c36aa[_0x31af('0xa9')]===_0x31af('0x148')){logger[_0x31af('0x35')](util[_0x31af('0x30')](_0x31af('0x14e'),_0x4a4e13[_0x441dd4],_0x31af('0x148')));this[_0x31af('0x10')][_0x31af('0xae')](util['format'](_0x31af('0x14e'),_0x4a4e13[_0x441dd4],_0x31af('0x148')));return{'code':0xc8,'result':_0x31af('0x148')};}else{logger[_0x31af('0x35')](util['format'](_0x31af('0x14e'),_0x4a4e13[_0x441dd4],'false'));this['channel'][_0x31af('0xae')](util[_0x31af('0x30')]('IFTIME\x20%s\x20%s',_0x4a4e13[_0x441dd4],_0x31af('0x149')));}}return{'code':0xc8,'result':_0x31af('0x149')};};AGIVertices[_0x31af('0x13')][_0x31af('0x14f')]=function(_0xde04c6){logger[_0x31af('0x35')](util[_0x31af('0x30')](_0x31af('0x150'),_0xde04c6[_0x31af('0x3e')]));return this['channel'][_0x31af('0x14f')]();};AGIVertices[_0x31af('0x13')][_0x31af('0x151')]=function(_0x101a60){logger[_0x31af('0x35')](util[_0x31af('0x30')](_0x31af('0x152'),_0x101a60[_0x31af('0x3e')]));if(!this[_0x31af('0x89')](_0x101a60['key'])){return this[_0x31af('0x10')][_0x31af('0xae')]('no\x20key\x20configured');}var _0x31a7a1=_0x31af('0x135');var _0x37d651=util[_0x31af('0x30')](_0x31af('0x136'),FILES_PATH,rs[_0x31af('0x122')](0x4));var _0x397951=util[_0x31af('0x30')](_0x31af('0xa4'),_0x37d651,_0x31a7a1);var _0x4914ae=!![];if(_0x101a60[_0x31af('0x137')]===_0x31af('0x153')){_0x4914ae=![];}var _0x31d544=this['channel']['recordFile'](_0x37d651,_0x31a7a1,_0x101a60[_0x31af('0x139')],_0x101a60[_0x31af('0xbf')],undefined,_0x4914ae);if(_0x31d544[_0x31af('0xaa')]!==-0x1){this[_0x31af('0x10')][_0x31af('0xae')](util['format'](_0x31af('0x154'),_0x397951));var _0x593a34=this['ispeechASR'][_0x31af('0x75')](this,_0x101a60,_0x397951);if(_0x593a34){for(var _0x2ee23d in _0x593a34){if(_0x593a34['hasOwnProperty'](_0x2ee23d)){this['channel'][_0x31af('0xa6')](util[_0x31af('0x30')](_0x31af('0x155'),_0x2ee23d[_0x31af('0x6e')]()),_0x593a34[_0x2ee23d]);}}return this['channel']['noop'](util['format']('IspeechASR\x20Result\x20%s',JSON['stringify'](_0x593a34)));}}return _0x31d544;};AGIVertices['prototype']['ispeechtts']=function(_0x321fde){logger['info'](util[_0x31af('0x30')](_0x31af('0x156'),_0x321fde[_0x31af('0x3e')]));if(!this[_0x31af('0x89')](_0x321fde[_0x31af('0x7d')])){return this[_0x31af('0x10')][_0x31af('0xae')]('no\x20key\x20configured');}if(!this['isConfigured'](_0x321fde[_0x31af('0x61')])){return this['channel']['noop'](_0x31af('0xaf'));}this[_0x31af('0x10')]['noop'](util[_0x31af('0x30')](_0x31af('0x157'),_0x321fde[_0x31af('0x61')]));var _0xcd5d74=this[_0x31af('0x84')][_0x31af('0x75')](this,_0x321fde);if(_0xcd5d74){this[_0x31af('0x10')][_0x31af('0xae')](util[_0x31af('0x30')]('ispeech\x20%s\x20file\x20created',_0xcd5d74));var _0xc85309=this['channel']['streamFile'](_0xcd5d74,_0x321fde[_0x31af('0x139')]);try{fs['unlink'](_0xcd5d74+'.wav');}catch(_0x1247aa){logger[_0x31af('0x33')](_0x1247aa);}return _0xc85309;}return this[_0x31af('0x10')][_0x31af('0x33')](_0x321fde,_0x31af('0x158'));};AGIVertices[_0x31af('0x13')][_0x31af('0x159')]=function(_0xa40daa){logger[_0x31af('0x35')](util['format']('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0xa40daa['label']));if(!this['isConfigured'](_0xa40daa[_0x31af('0x15a')])){return this[_0x31af('0x10')]['error'](_0xa40daa,_0x31af('0x15b'));}logger[_0x31af('0x35')](util['format'](_0x31af('0x15c'),this[_0x31af('0x10')][_0x31af('0x40')],_0xa40daa['findBy']));var _0x27ac1d=this[_0x31af('0x58')][_0x31af('0x75')](this,_0xa40daa['findBy']);if(_0x27ac1d){logger['info'](util[_0x31af('0x30')](_0x31af('0x15d'),this['channel']['callerid'],_0xa40daa[_0x31af('0x15a')]));this['channel']['noop'](util['format'](_0x31af('0x15d'),this[_0x31af('0x10')][_0x31af('0x40')],_0xa40daa['findBy']));return{'code':0xc8,'result':_0x31af('0x15e')};}else{logger[_0x31af('0x35')](util[_0x31af('0x30')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x31af('0x10')]['callerid'],_0xa40daa['findBy']));this[_0x31af('0x10')][_0x31af('0xae')](util[_0x31af('0x30')](_0x31af('0x15f'),this[_0x31af('0x10')][_0x31af('0x40')],_0xa40daa['findBy']));return{'code':0xc8,'result':_0x31af('0x160')};}};AGIVertices['prototype'][_0x31af('0x161')]=function(_0x37561d){logger[_0x31af('0x35')](util[_0x31af('0x30')](_0x31af('0x162'),_0x37561d[_0x31af('0x3e')]));if(!this[_0x31af('0x89')](_0x37561d[_0x31af('0x15a')])){return this[_0x31af('0x10')]['error'](_0x37561d,_0x31af('0x15b'));}logger[_0x31af('0x35')](util['format'](_0x31af('0x15c'),this[_0x31af('0x10')][_0x31af('0x40')],_0x37561d[_0x31af('0x15a')]));var _0x41d55b=this['agentLogout'][_0x31af('0x75')](this,_0x37561d[_0x31af('0x15a')]);if(_0x41d55b){logger[_0x31af('0x35')](util['format'](_0x31af('0x15d'),this[_0x31af('0x10')][_0x31af('0x40')],_0x37561d[_0x31af('0x15a')]));this[_0x31af('0x10')]['noop'](util[_0x31af('0x30')](_0x31af('0x15d'),this['channel'][_0x31af('0x40')],_0x37561d['findBy']));return{'code':0xc8,'result':_0x31af('0x15e')};}else{logger[_0x31af('0x35')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x31af('0x10')][_0x31af('0x40')],_0x37561d[_0x31af('0x15a')]));this[_0x31af('0x10')][_0x31af('0xae')](util[_0x31af('0x30')](_0x31af('0x15f'),this[_0x31af('0x10')][_0x31af('0x40')],_0x37561d['findBy']));return{'code':0xc8,'result':_0x31af('0x160')};}};AGIVertices[_0x31af('0x13')][_0x31af('0x163')]=function(_0x5a9dfe){logger[_0x31af('0x35')](util['format']('Enter\x20in\x20MATH\x20(%s)\x20block',_0x5a9dfe[_0x31af('0x3e')]));if(!this[_0x31af('0x89')](_0x5a9dfe[_0x31af('0x164')])){return this[_0x31af('0x10')]['error'](_0x5a9dfe,_0x31af('0x165'));}this[_0x31af('0x10')][_0x31af('0xae')](util[_0x31af('0x30')](_0x31af('0x166'),_0x5a9dfe[_0x31af('0x164')]));var _0xb7714=eval(_0x5a9dfe[_0x31af('0x164')]);if(!this[_0x31af('0x89')](_0x5a9dfe[_0x31af('0xde')])){return this[_0x31af('0x10')][_0x31af('0xae')](_0x31af('0xdf'));}var _0x1384bd=this[_0x31af('0x14')][_0x31af('0x75')](this,_0x5a9dfe[_0x31af('0xde')]);if(!_0x1384bd){return this[_0x31af('0x10')][_0x31af('0x33')](_0x5a9dfe,_0x31af('0x120'));}if(_[_0x31af('0xa5')](_0xb7714)){var _0x5a7a9d=this;_0xb7714['forEach'](function(_0x2e7b87,_0xbc511b){_0x5a7a9d[_0x31af('0x10')][_0x31af('0xa6')](util[_0x31af('0x30')](_0x31af('0x167'),_0x1384bd,_0xbc511b),_0x2e7b87);});return this[_0x31af('0x10')][_0x31af('0xae')](util[_0x31af('0x30')](_0x31af('0x168'),_0x1384bd));}else{return this[_0x31af('0x10')][_0x31af('0xa6')](_0x1384bd,_0xb7714);}};AGIVertices[_0x31af('0x13')][_0x31af('0x169')]=function(_0x3fecbf){logger[_0x31af('0x35')](util[_0x31af('0x30')](_0x31af('0x16a'),_0x3fecbf['label']));if(_0x3fecbf[_0x31af('0x118')]===0x0){return this[_0x31af('0xac')](_0x3fecbf);}_0x3fecbf['retry']-=0x1;if(!this[_0x31af('0x89')](_0x3fecbf[_0x31af('0x119')])){return this[_0x31af('0x10')][_0x31af('0x33')](_0x3fecbf,_0x31af('0x11a'));}var _0x3d50ef=this[_0x31af('0x23')]['sync'](this,_0x3fecbf['file_id']);if(!_0x3d50ef){return this[_0x31af('0x10')]['error'](_0x3fecbf,_0x31af('0x11b'));}var _0x34c65f=this[_0x31af('0x10')][_0x31af('0x11c')](_0x3d50ef,_0x3fecbf['response'],_0x3fecbf[_0x31af('0x16b')]);var _0x46fd42=_0x34c65f['result'];if(_0x34c65f[_0x31af('0xaa')]===-0x1){this[_0x31af('0x3c')][_0x31af('0x75')](this,_0x3fecbf,'-1');return _0x34c65f;}else if(_0x34c65f['extra']===_0x31af('0xbf')){_0x34c65f[_0x31af('0xaa')]=_0x34c65f['result'][_0x31af('0xa2')]>0x0?_0x34c65f['result']:'t';}else if(_[_0x31af('0x49')](_0x34c65f[_0x31af('0xaa')])){_0x34c65f[_0x31af('0xaa')]='#';_0x46fd42='#';}if(!this[_0x31af('0x89')](_0x3fecbf[_0x31af('0xde')])){this[_0x31af('0x10')][_0x31af('0xae')](_0x31af('0xdf'));}else{var _0x4b457e=this[_0x31af('0x14')][_0x31af('0x75')](this,_0x3fecbf[_0x31af('0xde')]);if(!_0x4b457e){return this[_0x31af('0x10')]['error'](_0x3fecbf,_0x31af('0x120'));}this[_0x31af('0x10')]['setVariable'](_0x4b457e,_0x46fd42);}this[_0x31af('0x3c')][_0x31af('0x75')](this,_0x3fecbf,_0x46fd42);return _0x34c65f;};AGIVertices[_0x31af('0x13')][_0x31af('0xae')]=function(_0x256514){logger[_0x31af('0x35')](util[_0x31af('0x30')](_0x31af('0x16c'),_0x256514[_0x31af('0x3e')]));return this[_0x31af('0x10')][_0x31af('0xae')](_0x256514[_0x31af('0x16d')]||_0x256514['label']);};AGIVertices[_0x31af('0x13')][_0x31af('0x16e')]=function(_0x4a69ce){logger[_0x31af('0x35')](util[_0x31af('0x30')](_0x31af('0x16f'),_0x4a69ce[_0x31af('0x3e')]));if(!this['isConfigured'](_0x4a69ce[_0x31af('0x15a')])){return this[_0x31af('0x10')][_0x31af('0x33')](_0x4a69ce,_0x31af('0x15b'));}logger[_0x31af('0x35')](util[_0x31af('0x30')](_0x31af('0x15c'),this[_0x31af('0x10')]['callerid'],_0x4a69ce[_0x31af('0x15a')]));var _0x3db92e=this[_0x31af('0x54')][_0x31af('0x75')](this,_0x4a69ce[_0x31af('0x170')]);var _0x2b48d0=this['agentPause'][_0x31af('0x75')](this,_0x4a69ce[_0x31af('0x15a')],_0x3db92e);if(_0x2b48d0){logger[_0x31af('0x35')](util['format'](_0x31af('0x15d'),this['channel'][_0x31af('0x40')],_0x4a69ce[_0x31af('0x15a')]));this[_0x31af('0x10')]['noop'](util[_0x31af('0x30')](_0x31af('0x15d'),this['channel'][_0x31af('0x40')],_0x4a69ce[_0x31af('0x15a')]));return{'code':0xc8,'result':'success'};}else{logger[_0x31af('0x35')](util[_0x31af('0x30')](_0x31af('0x15f'),this[_0x31af('0x10')]['callerid'],_0x4a69ce[_0x31af('0x15a')]));this[_0x31af('0x10')]['noop'](util[_0x31af('0x30')](_0x31af('0x15d'),this[_0x31af('0x10')][_0x31af('0x40')],_0x4a69ce[_0x31af('0x15a')]));return{'code':0xc8,'result':_0x31af('0x160')};}};AGIVertices[_0x31af('0x13')]['playback']=function(_0x877523){logger[_0x31af('0x35')](util[_0x31af('0x30')]('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x877523[_0x31af('0x3e')]));if(!this['isConfigured'](_0x877523[_0x31af('0x119')])){return this[_0x31af('0x10')][_0x31af('0x33')](_0x877523,_0x31af('0x11a'));}var _0xed11e7=this['getSound'][_0x31af('0x75')](this,_0x877523[_0x31af('0x119')]);if(!_0xed11e7){return this[_0x31af('0x10')]['error'](_0x877523,_0x31af('0x11b'));}var _0x4902ed=this[_0x31af('0x10')][_0x31af('0x5c')](_0x31af('0x171'),[_0xed11e7,_0x877523[_0x31af('0xec')]]);if(_0x4902ed[_0x31af('0xaa')]===-0x1){return _0x4902ed;}return this['channel'][_0x31af('0xae')](util['format'](_0x31af('0x172'),'PLAYBACK',_0xed11e7));};AGIVertices[_0x31af('0x13')][_0x31af('0x173')]=function(_0x291870){logger['info'](util[_0x31af('0x30')]('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0x291870['label']));if(!this[_0x31af('0x89')](_0x291870[_0x31af('0x174')])){return this[_0x31af('0x10')][_0x31af('0x33')](_0x291870,_0x31af('0x175'));}var _0x5508d1='';var _0x20a0b0=parseInt(_0x291870[_0x31af('0x174')],0xa);if(isNaN(_0x20a0b0)){_0x5508d1=_0x291870[_0x31af('0x174')];}else{_0x5508d1=this['getVoiceQueue'][_0x31af('0x75')](this,_0x291870[_0x31af('0x174')]);if(!_0x5508d1){return this[_0x31af('0x10')][_0x31af('0x33')](_0x291870,'no\x20queue\x20found');}}var _0x5ba987='';if(this[_0x31af('0x89')](_0x291870[_0x31af('0x119')])){var _0x5e2cdb=this['getSound'][_0x31af('0x75')](this,_0x291870[_0x31af('0x119')]);if(_0x5e2cdb){_0x5ba987=_0x5e2cdb;}}this[_0x31af('0x3c')][_0x31af('0x75')](this,_0x291870,_0x5508d1);if(_0x291870[_0x31af('0xec')][_0x31af('0x176')]('x')<0x0){_0x291870[_0x31af('0xec')]+='x';}if(_0x291870['opts'][_0x31af('0x176')]('X')<0x0){_0x291870[_0x31af('0xec')]+='X';}this[_0x31af('0x10')][_0x31af('0xa6')](_0x31af('0x177'),_0x5508d1?_0x5508d1['toLowerCase']():'');var _0x22cffd=this['channel'][_0x31af('0x5c')](_0x31af('0x178'),[_0x5508d1,_0x291870[_0x31af('0xec')],_0x291870[_0x31af('0x69')],_0x5ba987,_0x291870[_0x31af('0xbf')],_0x291870[_0x31af('0x9')],_0x291870['macro'],_0x291870[_0x31af('0x179')],'',_0x291870[_0x31af('0x17a')]]);if(_0x22cffd[_0x31af('0xaa')]===-0x1){return _0x22cffd;}return this[_0x31af('0x10')][_0x31af('0xae')](util[_0x31af('0x30')]('Executed\x20command\x20%s\x20%s',_0x31af('0x178'),_0x5508d1));};AGIVertices[_0x31af('0x13')][_0x31af('0x17b')]=function(_0x3d261e){logger[_0x31af('0x35')](util[_0x31af('0x30')](_0x31af('0x17c'),_0x3d261e[_0x31af('0x3e')]));var _0x5ab585=_0x3d261e['recordingFormat']||'wav';var _0x53ba59=util[_0x31af('0x30')](_0x31af('0x17d'),this[_0x31af('0x10')]['uniqueid'],rs['generate'](0x5));var _0x2a8d6b=util[_0x31af('0x30')](_0x31af('0x17e'),FILES_PATH,_0x53ba59,_0x5ab585);var _0x2842b3=util[_0x31af('0x30')]('%s/recordings/%s',FILES_PATH,_0x53ba59);this[_0x31af('0x41')][_0x31af('0x75')](this,_0x3d261e,_0x53ba59,_0x2a8d6b);this['channel'][_0x31af('0xa6')](_0x31af('0x17f'),_0x53ba59);logger[_0x31af('0x35')](_0x31af('0x180'),_0x2842b3,_0x5ab585,_0x3d261e[_0x31af('0x181')],_0x3d261e['timeout']);return this[_0x31af('0x10')][_0x31af('0x138')](_0x2842b3,_0x5ab585,_0x3d261e[_0x31af('0x181')],_0x3d261e[_0x31af('0xbf')],undefined,!![]);};AGIVertices[_0x31af('0x13')][_0x31af('0x182')]=function(_0x163f46){logger[_0x31af('0x35')](util['format'](_0x31af('0x183'),_0x163f46['label']));if(!this[_0x31af('0x89')](_0x163f46[_0x31af('0x69')])){return this['channel'][_0x31af('0xae')](_0x31af('0x184'));}var _0x112b0a=this[_0x31af('0x185')]['sync'](this,_0x163f46);logger[_0x31af('0x35')](util[_0x31af('0x30')](_0x31af('0x186'),util[_0x31af('0x187')](_0x112b0a,{'showHidden':![],'depth':null})));if(!this[_0x31af('0x89')](_0x163f46[_0x31af('0xde')])){return this[_0x31af('0x10')][_0x31af('0xae')](_0x31af('0x188'));}var _0x3b39bf=this[_0x31af('0x14')][_0x31af('0x75')](this,_0x163f46[_0x31af('0xde')]);if(!_0x3b39bf){return this[_0x31af('0x10')][_0x31af('0x33')](_0x163f46,_0x31af('0x120'));}this[_0x31af('0x10')]['setVariable'](util[_0x31af('0x30')](_0x31af('0x189'),_0x3b39bf),_0x112b0a[_0x31af('0x78')]?_0x112b0a[_0x31af('0x78')]:_0x31af('0x18a'));this['channel'][_0x31af('0xa6')](util['format']('%s_STATUS_MESSAGE',_0x3b39bf),_0x112b0a['statusMessage']?_0x112b0a['statusMessage']:'OK');if(_0x112b0a[_0x31af('0x6f')]){try{this[_0x31af('0xa3')](_0x112b0a['body'],_0x3b39bf);}catch(_0x134c24){logger[_0x31af('0x33')](util[_0x31af('0x30')](_0x31af('0x18b'),_0x3b39bf));}}return this['channel']['noop'](util[_0x31af('0x30')](_0x31af('0xe4'),_0x3b39bf));};AGIVertices[_0x31af('0x13')]['saydigits']=function(_0x1b6d93){logger[_0x31af('0x35')](util[_0x31af('0x30')]('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x1b6d93[_0x31af('0x3e')]));return this[_0x31af('0x10')][_0x31af('0x18c')](_0x1b6d93[_0x31af('0x18d')]['replace'](/\s+/g,''),_0x1b6d93[_0x31af('0x181')]);};AGIVertices[_0x31af('0x13')][_0x31af('0x18e')]=function(_0x31d152){logger['info'](util['format']('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0x31d152[_0x31af('0x3e')]));return this[_0x31af('0x10')][_0x31af('0x18f')](_0x31d152['number'][_0x31af('0x5e')](/\s+/g,''),_0x31d152[_0x31af('0x181')]);};AGIVertices[_0x31af('0x13')][_0x31af('0x190')]=function(_0x49d166){logger['info'](util[_0x31af('0x30')](_0x31af('0x191'),_0x49d166['label']));return this[_0x31af('0x10')][_0x31af('0x192')](_0x49d166[_0x31af('0x61')],_0x49d166[_0x31af('0x181')]);};AGIVertices[_0x31af('0x13')][_0x31af('0x193')]=function(_0xf76463){logger[_0x31af('0x35')](util[_0x31af('0x30')](_0x31af('0x194'),_0xf76463[_0x31af('0x3e')]));if(!this[_0x31af('0x89')](_0xf76463[_0x31af('0x195')])){return this[_0x31af('0x10')][_0x31af('0xae')](_0x31af('0x196'));}var _0x15cf7a=this[_0x31af('0x26')][_0x31af('0x75')](this,_0xf76463['account_id']);if(!_0x15cf7a||!_0x15cf7a[_0x31af('0x197')]){return this[_0x31af('0x10')][_0x31af('0x33')](_0xf76463,_0x31af('0x198'));}var _0x2ffa72={'from':util[_0x31af('0x30')](_0x31af('0x199'),_0x15cf7a['name'],_0x15cf7a[_0x31af('0x19a')]||_0x15cf7a[_0x31af('0x197')][_0x31af('0x19b')]),'to':_0xf76463['to']||'','cc':_0xf76463['cc']||'','bcc':_0xf76463[_0x31af('0x19c')]||'','subject':_0xf76463[_0x31af('0x19d')],'html':_0xf76463[_0x31af('0x61')],'text':_0xf76463[_0x31af('0x61')]};if(this[_0x31af('0x89')](_0xf76463[_0x31af('0x19e')])){}logger[_0x31af('0xe6')](_0x31af('0x19f'),JSON['stringify'](_0x2ffa72));this[_0x31af('0x3c')]['sync'](this,_0xf76463,_0xf76463[_0x31af('0x195')]);this[_0x31af('0x10')][_0x31af('0xae')](util['format'](_0x31af('0x1a0'),_0x15cf7a[_0x31af('0x17')]));this[_0x31af('0x28')][_0x31af('0x75')](this,_0x15cf7a[_0x31af('0x1a1')],_0x2ffa72);return this[_0x31af('0x10')][_0x31af('0xae')](_0x31af('0x1a2'));};AGIVertices[_0x31af('0x13')]['sendFax']=function(_0x4156ba){logger[_0x31af('0x35')](util[_0x31af('0x30')](_0x31af('0x1a3'),_0x4156ba[_0x31af('0x3e')]));return this[_0x31af('0x10')]['noop'](_0x31af('0x1a4'));};AGIVertices['prototype']['sendSMS']=function(_0x38f1b0){logger['info'](util['format'](_0x31af('0x1a5'),_0x38f1b0[_0x31af('0x3e')]));if(!this['isConfigured'](_0x38f1b0['sms_account_id'])){return this[_0x31af('0x10')][_0x31af('0xae')]('no\x20sms\x20account\x20configured');}var _0x37ccbb=this[_0x31af('0x1a6')]['sync'](this,_0x38f1b0[_0x31af('0x1a7')]);if(!_0x37ccbb){return this['channel'][_0x31af('0x33')](_0x38f1b0,_0x31af('0x1a8'));}var _0x241971={'body':_0x38f1b0[_0x31af('0x1a9')],'phone':_0x38f1b0['to']||'','SmsAccountId':_0x37ccbb['id']};logger[_0x31af('0xe6')](_0x31af('0x1aa'),JSON['stringify'](_0x241971));this[_0x31af('0x3c')][_0x31af('0x75')](this,_0x38f1b0,_0x38f1b0[_0x31af('0x1a7')]);this[_0x31af('0x10')][_0x31af('0xae')](util[_0x31af('0x30')](_0x31af('0x1ab'),_0x37ccbb[_0x31af('0x17')]));this['createSmsMessage'][_0x31af('0x75')](this,_0x241971);return this[_0x31af('0x10')]['noop'](_0x31af('0x1ac'));};AGIVertices[_0x31af('0x13')][_0x31af('0x1ad')]=function(_0x49d9f2){logger[_0x31af('0x35')](util['format'](_0x31af('0x1ae'),_0x49d9f2['label']));if(!this[_0x31af('0x89')](_0x49d9f2[_0x31af('0xde')])){return this[_0x31af('0x10')]['error'](_0x49d9f2,_0x31af('0x1af'));}var _0x3fa16b=this['getVariable'][_0x31af('0x75')](this,_0x49d9f2[_0x31af('0xde')]);if(!_0x3fa16b){return this[_0x31af('0x10')][_0x31af('0x33')](_0x49d9f2,_0x31af('0x120'));}return this[_0x31af('0x10')][_0x31af('0xa6')](_0x3fa16b,_0x49d9f2[_0x31af('0x1b0')]);};AGIVertices[_0x31af('0x13')]['start']=function(_0x40184a){logger[_0x31af('0x35')](util['format'](_0x31af('0x1b1'),_0x40184a[_0x31af('0x3e')]));this['channel'][_0x31af('0xae')]('START\x20CALLY\x20SQUARE');var _0x2b95b0=this['channel'][_0x31af('0x14')]('XMCS-UNIQUEID');if(!_['isEmpty'](_0x2b95b0['extra'])){this[_0x31af('0x10')][_0x31af('0x3d')]=_0x2b95b0[_0x31af('0xa9')];}if(_0x40184a[_0x31af('0xbd')]===_0x31af('0x1b2')){this[_0x31af('0x10')][_0x31af('0xae')]('Answer');return this[_0x31af('0x10')][_0x31af('0xbd')]();}return this[_0x31af('0x10')][_0x31af('0xae')](_0x31af('0x1b3'));};AGIVertices[_0x31af('0x13')]['subproject']=function(_0x427f3a){logger[_0x31af('0x35')](util[_0x31af('0x30')]('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0x427f3a[_0x31af('0x3e')]));if(!this['isConfigured'](_0x427f3a[_0x31af('0x1b4')])){return this['channel'][_0x31af('0x33')](_0x427f3a,_0x31af('0x1b5'));}var _0x17d8ab=this['getSquareProject'][_0x31af('0x75')](this,_0x427f3a[_0x31af('0x1b4')]);if(!this[_0x31af('0x89')](_0x17d8ab)){return this[_0x31af('0x10')][_0x31af('0x33')](_0x427f3a,util[_0x31af('0x30')](_0x31af('0x1b6'),_0x427f3a[_0x31af('0x1b4')]));}if(_0x17d8ab===this[_0x31af('0x10')][_0x31af('0x3f')]){return this[_0x31af('0x10')][_0x31af('0x33')](_0x427f3a,_0x31af('0x1b7'));}this['createSquareDetailsReport'][_0x31af('0x75')](this,_0x427f3a,_0x17d8ab);var _0x49885a=this[_0x31af('0x10')]['exec'](_0x31af('0x1b8'),util[_0x31af('0x30')]('agi://%s/square,\x22%s\x22,\x22%s\x22',config[_0x31af('0x9')][_0x31af('0x1b9')]||_0x31af('0x1ba'),_0x17d8ab,this['channel'][_0x31af('0x3f')]));if(_0x49885a[_0x31af('0xaa')]===-0x1){return _0x49885a;}return this[_0x31af('0x10')]['noop'](util['format'](_0x31af('0x172'),_0x31af('0x1b8'),_0x17d8ab));};AGIVertices['prototype'][_0x31af('0x1bb')]=function(_0xf8a9de){logger[_0x31af('0x35')](util[_0x31af('0x30')]('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0xf8a9de[_0x31af('0x3e')]));var _0x529d7e=this[_0x31af('0x5b')][_0x31af('0x75')](this,_0xf8a9de[_0x31af('0xbc')]);this['createSquareDetailsReport'][_0x31af('0x75')](this,_0xf8a9de,_0xf8a9de[_0x31af('0xbc')]);if(this[_0x31af('0x89')](_0xf8a9de[_0x31af('0xde')])){var _0x31d449=this[_0x31af('0x14')][_0x31af('0x75')](this,_0xf8a9de[_0x31af('0xde')]);if(_0x31d449){this[_0x31af('0x10')][_0x31af('0xa6')](_0x31d449,_0x529d7e);return this['channel'][_0x31af('0xae')](util['format'](_0x31af('0x1bc'),_0xf8a9de[_0x31af('0xbc')],_0x31d449));}}return this[_0x31af('0x10')][_0x31af('0xae')](util[_0x31af('0x30')]('sh\x20command:\x20%s\x20result\x20no\x20stored',_0xf8a9de[_0x31af('0xbc')]));};AGIVertices[_0x31af('0x13')][_0x31af('0x1bd')]=function(_0x3dc988){logger[_0x31af('0x35')](util['format'](_0x31af('0x1be'),_0x3dc988[_0x31af('0x3e')]));_0x3dc988['text']=_0x3dc988[_0x31af('0x61')][_0x31af('0x5e')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x3dc988[_0x31af('0x60')])){return this[_0x31af('0x10')]['noop'](_0x31af('0x1bf'));}if(!this[_0x31af('0x89')](_0x3dc988[_0x31af('0x61')])){return this[_0x31af('0x10')]['noop'](_0x31af('0xaf'));}this['channel'][_0x31af('0xae')](util[_0x31af('0x30')](_0x31af('0x1c0'),_0x3dc988['text']));var _0x549ce0=this[_0x31af('0x5f')][_0x31af('0x75')](this,_0x3dc988);if(_0x549ce0){this[_0x31af('0x10')]['noop'](util[_0x31af('0x30')]('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x549ce0));var _0x3e9d1c=this[_0x31af('0x10')][_0x31af('0x109')](_0x549ce0);try{fs[_0x31af('0x10a')](_0x549ce0+'.wav');}catch(_0xa26e2b){logger[_0x31af('0x33')](_0xa26e2b);}return _0x3e9d1c;}return this['channel'][_0x31af('0x33')](_0x3dc988,'Google\x20Cloud\x20TTS\x20is\x20unreachable');};AGIVertices[_0x31af('0x13')][_0x31af('0x1c1')]=function(_0x18e19b){logger['info'](util[_0x31af('0x30')](_0x31af('0x1c2'),_0x18e19b[_0x31af('0x3e')]));_0x18e19b[_0x31af('0x61')]=_0x18e19b[_0x31af('0x61')][_0x31af('0x5e')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x31af('0x89')](_0x18e19b[_0x31af('0x61')])){return this[_0x31af('0x10')][_0x31af('0xae')]('no\x20text\x20configured');}this['channel'][_0x31af('0xae')](util[_0x31af('0x30')](_0x31af('0x1c3'),_0x18e19b[_0x31af('0x61')]));var _0x2e11ba=this['googleTTS'][_0x31af('0x75')](this,_0x18e19b);if(_0x2e11ba){this[_0x31af('0x10')][_0x31af('0xae')](util[_0x31af('0x30')](_0x31af('0x1c4'),_0x2e11ba));var _0x133e7c=this[_0x31af('0x10')][_0x31af('0x109')](_0x2e11ba);try{fs['unlink'](_0x2e11ba+'.wav');}catch(_0x36bf8d){logger[_0x31af('0x33')](_0x36bf8d);}return _0x133e7c;}return this[_0x31af('0x10')][_0x31af('0x33')](_0x18e19b,_0x31af('0x1c5'));};AGIVertices[_0x31af('0x13')][_0x31af('0x1c6')]=function(_0x351aa2){logger[_0x31af('0x35')](util[_0x31af('0x30')]('Enter\x20in\x20UNPAUSE\x20(%s)\x20block',_0x351aa2['label']));if(!this[_0x31af('0x89')](_0x351aa2[_0x31af('0x15a')])){return this[_0x31af('0x10')]['error'](_0x351aa2,_0x31af('0x15b'));}logger[_0x31af('0x35')](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x31af('0x10')][_0x31af('0x40')],_0x351aa2[_0x31af('0x15a')]));var _0x14bfb9=this[_0x31af('0x1c7')]['sync'](this,_0x351aa2[_0x31af('0x15a')]);if(_0x14bfb9){logger[_0x31af('0x35')](util[_0x31af('0x30')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x31af('0x10')]['callerid'],_0x351aa2['findBy']));this[_0x31af('0x10')]['noop'](util['format'](_0x31af('0x15d'),this[_0x31af('0x10')][_0x31af('0x40')],_0x351aa2['findBy']));return{'code':0xc8,'result':'success'};}else{logger[_0x31af('0x35')](util[_0x31af('0x30')](_0x31af('0x15f'),this[_0x31af('0x10')][_0x31af('0x40')],_0x351aa2[_0x31af('0x15a')]));this[_0x31af('0x10')][_0x31af('0xae')](util[_0x31af('0x30')](_0x31af('0x15f'),this[_0x31af('0x10')]['callerid'],_0x351aa2['findBy']));return{'code':0xc8,'result':_0x31af('0x160')};}};AGIVertices['prototype'][_0x31af('0x1c8')]=function(_0x229aab){logger['info'](util['format'](_0x31af('0x1c9'),_0x229aab[_0x31af('0x3e')]));var _0x1f467d=this[_0x31af('0x10')][_0x31af('0x5c')](_0x31af('0x1ca'),[_0x229aab[_0x31af('0x1cb')],_0x229aab[_0x31af('0x7b')]]);if(_0x1f467d[_0x31af('0xaa')]===-0x1){return _0x1f467d;}return this[_0x31af('0x10')]['noop'](util['format'](_0x31af('0x172'),_0x31af('0x1ca'),_0x229aab['mailbox']));};AGIVertices[_0x31af('0x13')][_0x31af('0x1cc')]=function(_0x541be3){logger[_0x31af('0x35')](util['format'](_0x31af('0x1cd'),_0x541be3[_0x31af('0x3e')]));if(!this['isConfigured'](_0x541be3['variable_id'])){return this['channel'][_0x31af('0x33')](_0x541be3,'no\x20variable\x20selected');}var _0x23bf0d=this['getVariable']['sync'](this,_0x541be3[_0x31af('0xde')]);if(!_0x23bf0d){return this['channel'][_0x31af('0x33')](_0x541be3,'no\x20variable\x20found');}var _0x1a6c97=this['channel'][_0x31af('0x14')](_0x23bf0d);return{'code':0xc8,'result':_0x1a6c97[_0x31af('0xa9')]?_0x1a6c97[_0x31af('0xa9')]:'-'};};String['prototype'][_0x31af('0xa8')]=function(_0xf8daa4,_0xd25d4d){return this[_0x31af('0xa7')](_0xf8daa4)['join'](_0xd25d4d);};module[_0x31af('0x1ce')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index a98d1cc..3d7393b 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 _0x6f44=['lastPauseAt','update','then','info','[%s][UPDATE][ACWTIME:%s]','error','[%s][UPDATE][ERRORS:%s]','finally','interface','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','resolve','getAgent','attended','destlinkedid','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','timer','stopAcw','acwTimeout','format','uniqueid','updateAcw','[ACW][START]\x20%s','message','saveUnpause','catch','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','[ACW][STOP]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','startAcw','linkedid','[%s][HANGUP:LINKEDID]','syncHangup','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','stringify','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','savePause','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','lodash','moment','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','hanguprequest','syncHangupRequest','hangup','bind','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype'];(function(_0x421cf8,_0x23152c){var _0x145c48=function(_0x565862){while(--_0x565862){_0x421cf8['push'](_0x421cf8['shift']());}};_0x145c48(++_0x23152c);}(_0x6f44,0x1ea));var _0x46f4=function(_0x504ea3,_0x262b83){_0x504ea3=_0x504ea3-0x0;var _0x2a9def=_0x6f44[_0x504ea3];return _0x2a9def;};'use strict';var _=require(_0x46f4('0x0'));var moment=require(_0x46f4('0x1'));var ami=require('../ami');var logger=require(_0x46f4('0x2'))(_0x46f4('0x3'));var RpcUser=require(_0x46f4('0x4'));var RpcVoiceAgentReport=require(_0x46f4('0x5'));function Acw(_0x4099a9){this[_0x46f4('0x6')]=_0x4099a9[_0x46f4('0x6')];this[_0x46f4('0x7')]=_0x4099a9[_0x46f4('0x7')];this['timers']=_0x4099a9[_0x46f4('0x8')];this[_0x46f4('0x9')]={};ami['on'](_0x46f4('0xa'),this['syncAgentConnect']['bind'](this));ami['on'](_0x46f4('0xb'),this[_0x46f4('0xc')]['bind'](this));ami['on'](_0x46f4('0xd'),this['syncHangup'][_0x46f4('0xe')](this));ami['on']('agentringnoanswer',this[_0x46f4('0xf')][_0x46f4('0xe')](this));ami['on'](_0x46f4('0x10'),this[_0x46f4('0x11')][_0x46f4('0xe')](this));ami['on'](_0x46f4('0x12'),this[_0x46f4('0x13')][_0x46f4('0xe')](this));ami['on'](_0x46f4('0x14'),this[_0x46f4('0x15')][_0x46f4('0xe')](this));}function getDiff(_0x1262f6){var _0x5649ad=moment()[_0x46f4('0x16')](0x0);var _0x33f73c=moment(_0x1262f6)['milliseconds'](0x0);return _0x5649ad[_0x46f4('0x17')](_0x33f73c,_0x46f4('0x18'));}Acw[_0x46f4('0x19')]['updateAcw']=function(_0x3dc516,_0x4e0661){var _0x4e84ce=this;var _0x45917e=getDiff(_0x4e84ce[_0x46f4('0x8')][_0x3dc516][_0x46f4('0x1a')]);clearTimeout(_0x4e84ce['timers'][_0x3dc516]['timer']);_0x4e84ce['timers'][_0x3dc516]['timer']=![];return RpcVoiceAgentReport[_0x46f4('0x1b')]({'acwtime':_0x45917e},_0x4e84ce[_0x46f4('0x8')][_0x3dc516]['uniqueid'],_0x3dc516)[_0x46f4('0x1c')](function(_0x108e6d){logger[_0x46f4('0x1d')](_0x46f4('0x1e'),_0x4e0661,_0x45917e,_0x108e6d);})['catch'](function(_0x1af169){logger[_0x46f4('0x1f')](_0x46f4('0x20'),_0x4e0661,_0x1af169);})[_0x46f4('0x21')](function(){delete _0x4e84ce[_0x46f4('0x8')][_0x3dc516];});};Acw[_0x46f4('0x19')]['startAcw']=function(_0x4bae60){try{var _0x2b88d3=this;var _0x39760b=this['channels'][_0x4bae60][_0x46f4('0x22')];var _0x2d54f2=this[_0x46f4('0x9')][_0x4bae60][_0x46f4('0x23')];var _0x36092e=this[_0x46f4('0x6')][_0x2d54f2];var _0x204db6=![];var _0x58d27d=_0x46f4('0x24');if(_0x36092e[_0x46f4('0x25')]&&_0x36092e[_0x46f4('0x26')][_0x46f4('0x27')]){_0x204db6=!![];_0x58d27d=_0x36092e[_0x46f4('0x26')]['name'];}if(!_0x2b88d3[_0x46f4('0x7')][_0x39760b]){return Promise[_0x46f4('0x28')]();}return RpcUser[_0x46f4('0x29')](_0x2b88d3[_0x46f4('0x7')][_0x39760b]['id'])[_0x46f4('0x1c')](function(_0x33a7c5){if(!_0x33a7c5||_0x33a7c5['voicePause']){logger[_0x46f4('0x1d')]('[%s][INPAUSE][AGENT:%s][QUEUE:%s]',_0x4bae60,_0x39760b,_0x2d54f2);return;}logger['info']('[%s][START][AGENT:%s][QUEUE:%s]',_0x4bae60,_0x39760b,_0x2d54f2);var _0x2cf22c=_0x2b88d3['channels'][_0x4bae60][_0x46f4('0x2a')]&&_0x2b88d3[_0x46f4('0x9')][_0x4bae60][_0x46f4('0x2b')]?_0x2b88d3[_0x46f4('0x9')][_0x4bae60][_0x46f4('0x2b')]:_0x4bae60;return RpcUser['savePause'](_0x2b88d3[_0x46f4('0x7')][_0x39760b],_0x58d27d,_0x2cf22c);})[_0x46f4('0x1c')](function(_0x1c1329){if(_0x204db6||!_0x1c1329){return;}_0x2b88d3['timers'][_0x39760b]={};logger[_0x46f4('0x1d')](_0x46f4('0x2c'),_0x4bae60,_0x2b88d3[_0x46f4('0x6')][_0x2d54f2]['acwTimeout'],_0x39760b,_0x2d54f2);_0x2b88d3['timers'][_0x39760b][_0x46f4('0x2d')]=setTimeout(_0x2b88d3[_0x46f4('0x2e')][_0x46f4('0xe')](_0x2b88d3,_0x39760b),_0x2b88d3['voiceQueues'][_0x2d54f2][_0x46f4('0x2f')]*0x3e8);_0x2b88d3[_0x46f4('0x8')][_0x39760b]['lastPauseAt']=moment()[_0x46f4('0x30')]('YYYY-MM-DD\x20HH:mm:ss');_0x2b88d3[_0x46f4('0x8')][_0x39760b][_0x46f4('0x31')]=_0x4bae60;_0x2b88d3[_0x46f4('0x8')][_0x39760b][_0x46f4('0x23')]=_0x2d54f2;_0x2b88d3[_0x46f4('0x8')][_0x39760b]['updateAcw']=_0x2b88d3[_0x46f4('0x32')][_0x46f4('0xe')](_0x2b88d3,_0x39760b,_0x4bae60);})['catch'](function(){logger[_0x46f4('0x1f')](_0x46f4('0x2c'),_0x4bae60,_0x2b88d3[_0x46f4('0x6')][_0x2d54f2][_0x46f4('0x2f')],_0x39760b,_0x2d54f2);})['finally'](function(){delete _0x2b88d3[_0x46f4('0x9')][_0x4bae60];});}catch(_0x584abf){logger[_0x46f4('0x1f')](_0x46f4('0x33'),_0x584abf[_0x46f4('0x34')]);}};Acw[_0x46f4('0x19')]['stopAcw']=function(_0x447689){try{var _0x5cf06f=this;if(_0x5cf06f['timers'][_0x447689]){_0x5cf06f[_0x46f4('0x8')][_0x447689]['timer']=![];var _0x520f05=_0x5cf06f[_0x46f4('0x8')][_0x447689][_0x46f4('0x31')];var _0x5ed740=_0x5cf06f[_0x46f4('0x8')][_0x447689]['queue'];var _0x1449d0=_0x5cf06f[_0x46f4('0x6')][_0x5ed740][_0x46f4('0x2f')];logger[_0x46f4('0x1d')]('[%s][TIMER][STOP][AGENT:%s]',_0x520f05,_0x447689);RpcUser[_0x46f4('0x35')](this[_0x46f4('0x7')][_0x447689]);RpcVoiceAgentReport[_0x46f4('0x1b')]({'acwtime':_0x1449d0,'agentacw':!![]},_0x520f05,_0x447689)['then'](function(_0x5ebe87){logger['info'](_0x46f4('0x1e'),_0x520f05,_0x1449d0,_0x5ebe87);})[_0x46f4('0x36')](function(_0x73adba){logger[_0x46f4('0x1f')]('[%s][UPDATE][ERRORS:%s]',_0x520f05,_0x73adba);});}else{logger[_0x46f4('0x1f')](_0x46f4('0x37'),_0x447689);if(_0x5cf06f[_0x46f4('0x8')]){logger[_0x46f4('0x1d')](_0x46f4('0x38'),JSON['stringify'](_0x5cf06f[_0x46f4('0x8')]));}}}catch(_0x306400){logger[_0x46f4('0x1f')](_0x46f4('0x39'),_0x306400[_0x46f4('0x34')]);}};Acw['prototype']['syncAgentConnect']=function(_0x4e11cb){try{if(this[_0x46f4('0x6')][_0x4e11cb[_0x46f4('0x23')]]&&(this[_0x46f4('0x6')][_0x4e11cb['queue']][_0x46f4('0x3')]||this[_0x46f4('0x6')][_0x4e11cb[_0x46f4('0x23')]][_0x46f4('0x25')])){if(this[_0x46f4('0x7')][_0x4e11cb[_0x46f4('0x22')]]){this[_0x46f4('0x9')][_0x4e11cb[_0x46f4('0x31')]]={'queue':_0x4e11cb[_0x46f4('0x23')],'interface':_0x4e11cb[_0x46f4('0x22')],'destlinkedid':_0x4e11cb[_0x46f4('0x2b')]};}}}catch(_0x47633b){logger[_0x46f4('0x1f')]('[ACW][syncAgentConnect]\x20%s',_0x47633b[_0x46f4('0x34')]);}};Acw[_0x46f4('0x19')][_0x46f4('0x15')]=function(_0x21bbce){try{if(this[_0x46f4('0x6')][_0x21bbce[_0x46f4('0x23')]]&&(this['voiceQueues'][_0x21bbce['queue']]['acw']||this[_0x46f4('0x6')][_0x21bbce[_0x46f4('0x23')]][_0x46f4('0x25')])){if(this[_0x46f4('0x7')][_0x21bbce[_0x46f4('0x22')]]){this[_0x46f4('0x9')][_0x21bbce[_0x46f4('0x31')]]={'queue':_0x21bbce[_0x46f4('0x23')],'interface':_0x21bbce[_0x46f4('0x22')]};}}}catch(_0xf73c15){logger[_0x46f4('0x1f')](_0x46f4('0x3a'),_0xf73c15['message']);}};Acw[_0x46f4('0x19')][_0x46f4('0xc')]=function(_0x159fa8){try{if(this['channels'][_0x159fa8['uniqueid']]&&_[_0x46f4('0x3b')](this[_0x46f4('0x9')][_0x159fa8[_0x46f4('0x31')]]['attended'])){logger['info'](_0x46f4('0x3c'),_0x159fa8[_0x46f4('0x31')]);this[_0x46f4('0x3d')](_0x159fa8[_0x46f4('0x31')]);}else if(this[_0x46f4('0x9')][_0x159fa8[_0x46f4('0x3e')]]&&_['isUndefined'](this[_0x46f4('0x9')][_0x159fa8[_0x46f4('0x3e')]][_0x46f4('0x2a')])){logger['info'](_0x46f4('0x3f'),_0x159fa8[_0x46f4('0x3e')]);this[_0x46f4('0x3d')](_0x159fa8[_0x46f4('0x3e')]);}}catch(_0x48d279){logger[_0x46f4('0x1f')]('[ACW][syncHangupRequest]\x20%s',_0x48d279[_0x46f4('0x34')]);}};Acw[_0x46f4('0x19')][_0x46f4('0x40')]=function(_0x4e7a1e){try{if(this[_0x46f4('0x9')][_0x4e7a1e[_0x46f4('0x31')]]&&this['channels'][_0x4e7a1e[_0x46f4('0x31')]]['attended']){logger['info'](_0x46f4('0x41'),_0x4e7a1e[_0x46f4('0x31')]);this[_0x46f4('0x3d')](_0x4e7a1e[_0x46f4('0x31')]);}else if(this['channels'][_0x4e7a1e['linkedid']]&&this['channels'][_0x4e7a1e[_0x46f4('0x3e')]][_0x46f4('0x2a')]){logger['info'](_0x46f4('0x42'),_0x4e7a1e[_0x46f4('0x3e')]);this[_0x46f4('0x3d')](_0x4e7a1e[_0x46f4('0x3e')]);}}catch(_0x4ef2d7){logger[_0x46f4('0x1f')]('[ACW][syncHangup]\x20%s',_0x4ef2d7[_0x46f4('0x34')]);}};Acw[_0x46f4('0x19')][_0x46f4('0x11')]=function(_0x260f47){try{if(!_[_0x46f4('0x43')](this[_0x46f4('0x9')][_0x260f47[_0x46f4('0x44')]])){this[_0x46f4('0x3d')](_0x260f47[_0x46f4('0x44')]);if(this[_0x46f4('0x9')][_0x260f47[_0x46f4('0x45')]]){this[_0x46f4('0x9')][_0x260f47[_0x46f4('0x45')]]['attended']=!![];this[_0x46f4('0x9')][_0x260f47[_0x46f4('0x46')]]=this['channels'][_0x260f47['secondtransfereruniqueid']];delete this[_0x46f4('0x9')][_0x260f47[_0x46f4('0x45')]];}}else if(!_['isNil'](this['channels'][_0x260f47[_0x46f4('0x46')]])){this['startAcw'](_0x260f47[_0x46f4('0x46')]);if(this[_0x46f4('0x9')][_0x260f47[_0x46f4('0x47')]]){this[_0x46f4('0x9')][_0x260f47[_0x46f4('0x47')]]['attended']=!![];this[_0x46f4('0x9')][_0x260f47['transfereeuniqueid']]=this['channels'][_0x260f47[_0x46f4('0x47')]];delete this[_0x46f4('0x9')][_0x260f47[_0x46f4('0x47')]];}}}catch(_0x2e648b){logger[_0x46f4('0x1f')](_0x46f4('0x48'),_0x2e648b['message']);}};Acw[_0x46f4('0x19')][_0x46f4('0x13')]=function(_0x4041e4){try{if(this[_0x46f4('0x9')][_0x4041e4[_0x46f4('0x49')]]){logger[_0x46f4('0x1d')](_0x46f4('0x4a'),JSON[_0x46f4('0x4b')](_0x4041e4[_0x46f4('0x49')]));this[_0x46f4('0x3d')](_0x4041e4[_0x46f4('0x49')]);}else if(this[_0x46f4('0x9')][_0x4041e4[_0x46f4('0x4c')]]){logger[_0x46f4('0x1d')](_0x46f4('0x4d'),JSON[_0x46f4('0x4b')](_0x4041e4[_0x46f4('0x4c')]));this[_0x46f4('0x3d')](_0x4041e4['transfererlinkedid']);}}catch(_0x477f9b){logger[_0x46f4('0x1f')](_0x46f4('0x4e'),_0x477f9b[_0x46f4('0x34')]);}};Acw[_0x46f4('0x19')]['syncAgentRingNoAnswer']=function(_0xa2c778){try{if(this[_0x46f4('0x6')][_0xa2c778[_0x46f4('0x23')]]&&this[_0x46f4('0x6')][_0xa2c778[_0x46f4('0x23')]][_0x46f4('0x4f')]===_0x46f4('0x50')){if(this[_0x46f4('0x7')][_0xa2c778[_0x46f4('0x22')]]){logger[_0x46f4('0x1d')](_0x46f4('0x51'),_0xa2c778[_0x46f4('0x31')],_0xa2c778[_0x46f4('0x22')],_0xa2c778[_0x46f4('0x23')]);return RpcUser[_0x46f4('0x52')](this[_0x46f4('0x7')][_0xa2c778[_0x46f4('0x22')]],_0x46f4('0x53'),_0xa2c778[_0x46f4('0x31')]);}}}catch(_0x238749){logger[_0x46f4('0x1f')](_0x46f4('0x54'),_0x238749[_0x46f4('0x34')]);}};module[_0x46f4('0x55')]=Acw; \ No newline at end of file +var _0x2ef3=['transfertargetuniqueid','origtransfereruniqueid','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','[%s][BLINDTRANSFER:LINKEDID]','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','syncAgentRingNoAnswer','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','lodash','moment','../ami','../../../config/logger','acw','../rpc/user','voiceQueues','agents','channels','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','syncHangup','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','custom:agentConnectPreview','diff','seconds','prototype','updateAcw','timers','lastPauseAt','timer','update','uniqueid','then','info','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','startAcw','interface','queue','ACW','name','mandatoryDispositionPause','resolve','getAgent','voicePause','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','stopAcw','format','finally','[ACW][START]\x20%s','message','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','mandatoryDisposition','[ACW][syncAgentConnect]\x20%s','syncAgentConnectPreview','[ACW][syncAgentConnectPreview]\x20%s','[%s][HANGUP:UNIQUEID]','linkedid','isUndefined','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid'];(function(_0x4cccae,_0x4b68a5){var _0x3833c3=function(_0x151ab3){while(--_0x151ab3){_0x4cccae['push'](_0x4cccae['shift']());}};_0x3833c3(++_0x4b68a5);}(_0x2ef3,0xba));var _0x32ef=function(_0x36948a,_0xf70e7a){_0x36948a=_0x36948a-0x0;var _0x1d96e1=_0x2ef3[_0x36948a];return _0x1d96e1;};'use strict';var _=require(_0x32ef('0x0'));var moment=require(_0x32ef('0x1'));var ami=require(_0x32ef('0x2'));var logger=require(_0x32ef('0x3'))(_0x32ef('0x4'));var RpcUser=require(_0x32ef('0x5'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x38f865){this[_0x32ef('0x6')]=_0x38f865['voiceQueues'];this[_0x32ef('0x7')]=_0x38f865[_0x32ef('0x7')];this['timers']=_0x38f865['timers'];this[_0x32ef('0x8')]={};ami['on'](_0x32ef('0x9'),this[_0x32ef('0xa')][_0x32ef('0xb')](this));ami['on'](_0x32ef('0xc'),this[_0x32ef('0xd')][_0x32ef('0xb')](this));ami['on'](_0x32ef('0xe'),this[_0x32ef('0xf')][_0x32ef('0xb')](this));ami['on']('agentringnoanswer',this['syncAgentRingNoAnswer'][_0x32ef('0xb')](this));ami['on'](_0x32ef('0x10'),this[_0x32ef('0x11')][_0x32ef('0xb')](this));ami['on']('blindtransfer',this[_0x32ef('0x12')]['bind'](this));ami['on'](_0x32ef('0x13'),this['syncAgentConnectPreview'][_0x32ef('0xb')](this));}function getDiff(_0x1ef1ae){var _0x5c3eb9=moment()['milliseconds'](0x0);var _0x19ce1=moment(_0x1ef1ae)['milliseconds'](0x0);return _0x5c3eb9[_0x32ef('0x14')](_0x19ce1,_0x32ef('0x15'));}Acw[_0x32ef('0x16')][_0x32ef('0x17')]=function(_0x57aff1,_0x55bf0b){var _0x531e30=this;var _0x13db1a=getDiff(_0x531e30[_0x32ef('0x18')][_0x57aff1][_0x32ef('0x19')]);clearTimeout(_0x531e30['timers'][_0x57aff1]['timer']);_0x531e30[_0x32ef('0x18')][_0x57aff1][_0x32ef('0x1a')]=![];return RpcVoiceAgentReport[_0x32ef('0x1b')]({'acwtime':_0x13db1a},_0x531e30['timers'][_0x57aff1][_0x32ef('0x1c')],_0x57aff1)[_0x32ef('0x1d')](function(_0x4f4c98){logger[_0x32ef('0x1e')](_0x32ef('0x1f'),_0x55bf0b,_0x13db1a,_0x4f4c98);})[_0x32ef('0x20')](function(_0x251084){logger[_0x32ef('0x21')](_0x32ef('0x22'),_0x55bf0b,_0x251084);})['finally'](function(){delete _0x531e30[_0x32ef('0x18')][_0x57aff1];});};Acw['prototype'][_0x32ef('0x23')]=function(_0x3a20ca){try{var _0x49f2d8=this;var _0x1af371=this[_0x32ef('0x8')][_0x3a20ca][_0x32ef('0x24')];var _0x55f7f2=this['channels'][_0x3a20ca][_0x32ef('0x25')];var _0xb30fab=this[_0x32ef('0x6')][_0x55f7f2];var _0x478bef=![];var _0x59585f=_0x32ef('0x26');if(_0xb30fab['mandatoryDisposition']&&_0xb30fab['mandatoryDispositionPause'][_0x32ef('0x27')]){_0x478bef=!![];_0x59585f=_0xb30fab[_0x32ef('0x28')][_0x32ef('0x27')];}if(!_0x49f2d8[_0x32ef('0x7')][_0x1af371]){return Promise[_0x32ef('0x29')]();}return RpcUser[_0x32ef('0x2a')](_0x49f2d8[_0x32ef('0x7')][_0x1af371]['id'])[_0x32ef('0x1d')](function(_0x338f19){if(!_0x338f19||_0x338f19[_0x32ef('0x2b')]){logger[_0x32ef('0x1e')](_0x32ef('0x2c'),_0x3a20ca,_0x1af371,_0x55f7f2);return;}logger['info'](_0x32ef('0x2d'),_0x3a20ca,_0x1af371,_0x55f7f2);var _0x2f5d06=_0x49f2d8['channels'][_0x3a20ca][_0x32ef('0x2e')]&&_0x49f2d8[_0x32ef('0x8')][_0x3a20ca][_0x32ef('0x2f')]?_0x49f2d8[_0x32ef('0x8')][_0x3a20ca]['destlinkedid']:_0x3a20ca;return RpcUser[_0x32ef('0x30')](_0x49f2d8[_0x32ef('0x7')][_0x1af371],_0x59585f,_0x2f5d06);})[_0x32ef('0x1d')](function(_0x2ac686){if(_0x478bef||!_0x2ac686){return;}_0x49f2d8[_0x32ef('0x18')][_0x1af371]={};logger[_0x32ef('0x1e')](_0x32ef('0x31'),_0x3a20ca,_0x49f2d8['voiceQueues'][_0x55f7f2][_0x32ef('0x32')],_0x1af371,_0x55f7f2);_0x49f2d8['timers'][_0x1af371][_0x32ef('0x1a')]=setTimeout(_0x49f2d8[_0x32ef('0x33')]['bind'](_0x49f2d8,_0x1af371),_0x49f2d8[_0x32ef('0x6')][_0x55f7f2][_0x32ef('0x32')]*0x3e8);_0x49f2d8[_0x32ef('0x18')][_0x1af371][_0x32ef('0x19')]=moment()[_0x32ef('0x34')]('YYYY-MM-DD\x20HH:mm:ss');_0x49f2d8['timers'][_0x1af371][_0x32ef('0x1c')]=_0x3a20ca;_0x49f2d8['timers'][_0x1af371][_0x32ef('0x25')]=_0x55f7f2;_0x49f2d8[_0x32ef('0x18')][_0x1af371][_0x32ef('0x17')]=_0x49f2d8[_0x32ef('0x17')][_0x32ef('0xb')](_0x49f2d8,_0x1af371,_0x3a20ca);})[_0x32ef('0x20')](function(){logger['error']('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x3a20ca,_0x49f2d8['voiceQueues'][_0x55f7f2][_0x32ef('0x32')],_0x1af371,_0x55f7f2);})[_0x32ef('0x35')](function(){delete _0x49f2d8[_0x32ef('0x8')][_0x3a20ca];});}catch(_0x5f2443){logger['error'](_0x32ef('0x36'),_0x5f2443[_0x32ef('0x37')]);}};Acw[_0x32ef('0x16')]['stopAcw']=function(_0x4abbd6){try{var _0xcbdec8=this;if(_0xcbdec8[_0x32ef('0x18')][_0x4abbd6]){_0xcbdec8[_0x32ef('0x18')][_0x4abbd6][_0x32ef('0x1a')]=![];var _0x3a7c49=_0xcbdec8[_0x32ef('0x18')][_0x4abbd6][_0x32ef('0x1c')];var _0x21da90=_0xcbdec8[_0x32ef('0x18')][_0x4abbd6]['queue'];var _0x3a4a99=_0xcbdec8[_0x32ef('0x6')][_0x21da90][_0x32ef('0x32')];logger['info'](_0x32ef('0x38'),_0x3a7c49,_0x4abbd6);RpcUser[_0x32ef('0x39')](this[_0x32ef('0x7')][_0x4abbd6]);RpcVoiceAgentReport[_0x32ef('0x1b')]({'acwtime':_0x3a4a99,'agentacw':!![]},_0x3a7c49,_0x4abbd6)[_0x32ef('0x1d')](function(_0x33a0fb){logger[_0x32ef('0x1e')](_0x32ef('0x1f'),_0x3a7c49,_0x3a4a99,_0x33a0fb);})[_0x32ef('0x20')](function(_0x57a3c0){logger[_0x32ef('0x21')](_0x32ef('0x22'),_0x3a7c49,_0x57a3c0);});}else{logger['error'](_0x32ef('0x3a'),_0x4abbd6);if(_0xcbdec8[_0x32ef('0x18')]){logger[_0x32ef('0x1e')](_0x32ef('0x3b'),JSON[_0x32ef('0x3c')](_0xcbdec8[_0x32ef('0x18')]));}}}catch(_0x3c0e44){logger['error']('[ACW][STOP]\x20%s',_0x3c0e44[_0x32ef('0x37')]);}};Acw[_0x32ef('0x16')][_0x32ef('0xa')]=function(_0x765c63){try{if(this['voiceQueues'][_0x765c63[_0x32ef('0x25')]]&&(this[_0x32ef('0x6')][_0x765c63['queue']][_0x32ef('0x4')]||this['voiceQueues'][_0x765c63[_0x32ef('0x25')]][_0x32ef('0x3d')])){if(this[_0x32ef('0x7')][_0x765c63[_0x32ef('0x24')]]){this[_0x32ef('0x8')][_0x765c63[_0x32ef('0x1c')]]={'queue':_0x765c63[_0x32ef('0x25')],'interface':_0x765c63[_0x32ef('0x24')],'destlinkedid':_0x765c63[_0x32ef('0x2f')]};}}}catch(_0x37da36){logger['error'](_0x32ef('0x3e'),_0x37da36['message']);}};Acw[_0x32ef('0x16')][_0x32ef('0x3f')]=function(_0x2dd94f){try{if(this['voiceQueues'][_0x2dd94f[_0x32ef('0x25')]]&&(this[_0x32ef('0x6')][_0x2dd94f[_0x32ef('0x25')]][_0x32ef('0x4')]||this[_0x32ef('0x6')][_0x2dd94f[_0x32ef('0x25')]][_0x32ef('0x3d')])){if(this['agents'][_0x2dd94f['interface']]){this[_0x32ef('0x8')][_0x2dd94f[_0x32ef('0x1c')]]={'queue':_0x2dd94f[_0x32ef('0x25')],'interface':_0x2dd94f[_0x32ef('0x24')]};}}}catch(_0x209361){logger[_0x32ef('0x21')](_0x32ef('0x40'),_0x209361[_0x32ef('0x37')]);}};Acw[_0x32ef('0x16')][_0x32ef('0xd')]=function(_0x35a294){try{if(this[_0x32ef('0x8')][_0x35a294[_0x32ef('0x1c')]]&&_['isUndefined'](this[_0x32ef('0x8')][_0x35a294[_0x32ef('0x1c')]][_0x32ef('0x2e')])){logger[_0x32ef('0x1e')](_0x32ef('0x41'),_0x35a294[_0x32ef('0x1c')]);this[_0x32ef('0x23')](_0x35a294[_0x32ef('0x1c')]);}else if(this[_0x32ef('0x8')][_0x35a294[_0x32ef('0x42')]]&&_[_0x32ef('0x43')](this[_0x32ef('0x8')][_0x35a294[_0x32ef('0x42')]][_0x32ef('0x2e')])){logger[_0x32ef('0x1e')](_0x32ef('0x44'),_0x35a294[_0x32ef('0x42')]);this[_0x32ef('0x23')](_0x35a294['linkedid']);}}catch(_0x515ac9){logger[_0x32ef('0x21')](_0x32ef('0x45'),_0x515ac9[_0x32ef('0x37')]);}};Acw[_0x32ef('0x16')][_0x32ef('0xf')]=function(_0x42fc82){try{if(this[_0x32ef('0x8')][_0x42fc82[_0x32ef('0x1c')]]&&this[_0x32ef('0x8')][_0x42fc82[_0x32ef('0x1c')]][_0x32ef('0x2e')]){logger['info'](_0x32ef('0x46'),_0x42fc82[_0x32ef('0x1c')]);this[_0x32ef('0x23')](_0x42fc82[_0x32ef('0x1c')]);}else if(this[_0x32ef('0x8')][_0x42fc82[_0x32ef('0x42')]]&&this['channels'][_0x42fc82[_0x32ef('0x42')]][_0x32ef('0x2e')]){logger[_0x32ef('0x1e')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x42fc82[_0x32ef('0x42')]);this['startAcw'](_0x42fc82[_0x32ef('0x42')]);}}catch(_0xbe35b){logger['error'](_0x32ef('0x47'),_0xbe35b['message']);}};Acw[_0x32ef('0x16')][_0x32ef('0x11')]=function(_0x2bff39){try{if(!_[_0x32ef('0x48')](this[_0x32ef('0x8')][_0x2bff39[_0x32ef('0x49')]])){this[_0x32ef('0x23')](_0x2bff39['transfereeuniqueid']);if(this['channels'][_0x2bff39[_0x32ef('0x4a')]]){this['channels'][_0x2bff39['secondtransfereruniqueid']][_0x32ef('0x2e')]=!![];this[_0x32ef('0x8')][_0x2bff39[_0x32ef('0x4b')]]=this[_0x32ef('0x8')][_0x2bff39[_0x32ef('0x4a')]];delete this[_0x32ef('0x8')][_0x2bff39[_0x32ef('0x4a')]];}}else if(!_[_0x32ef('0x48')](this[_0x32ef('0x8')][_0x2bff39[_0x32ef('0x4b')]])){this['startAcw'](_0x2bff39['transfertargetuniqueid']);if(this[_0x32ef('0x8')][_0x2bff39[_0x32ef('0x4c')]]){this['channels'][_0x2bff39[_0x32ef('0x4c')]][_0x32ef('0x2e')]=!![];this[_0x32ef('0x8')][_0x2bff39['transfereeuniqueid']]=this[_0x32ef('0x8')][_0x2bff39[_0x32ef('0x4c')]];delete this[_0x32ef('0x8')][_0x2bff39['origtransfereruniqueid']];}}}catch(_0x5e6030){logger[_0x32ef('0x21')]('[ACW][syncAttendedTransfer]\x20%s',_0x5e6030[_0x32ef('0x37')]);}};Acw['prototype']['syncBlindTransfer']=function(_0x24cf09){try{if(this[_0x32ef('0x8')][_0x24cf09[_0x32ef('0x4d')]]){logger['info'](_0x32ef('0x4e'),JSON[_0x32ef('0x3c')](_0x24cf09[_0x32ef('0x4d')]));this['startAcw'](_0x24cf09[_0x32ef('0x4d')]);}else if(this[_0x32ef('0x8')][_0x24cf09['transfererlinkedid']]){logger['info'](_0x32ef('0x4f'),JSON[_0x32ef('0x3c')](_0x24cf09[_0x32ef('0x50')]));this[_0x32ef('0x23')](_0x24cf09[_0x32ef('0x50')]);}}catch(_0x40700e){logger['error'](_0x32ef('0x51'),_0x40700e[_0x32ef('0x37')]);}};Acw[_0x32ef('0x16')][_0x32ef('0x52')]=function(_0x21e930){try{if(this[_0x32ef('0x6')][_0x21e930[_0x32ef('0x25')]]&&this[_0x32ef('0x6')][_0x21e930[_0x32ef('0x25')]]['autopause']===_0x32ef('0x53')){if(this[_0x32ef('0x7')][_0x21e930[_0x32ef('0x24')]]){logger[_0x32ef('0x1e')](_0x32ef('0x54'),_0x21e930['uniqueid'],_0x21e930['interface'],_0x21e930[_0x32ef('0x25')]);return RpcUser[_0x32ef('0x30')](this[_0x32ef('0x7')][_0x21e930[_0x32ef('0x24')]],_0x32ef('0x55'),_0x21e930['uniqueid']);}}}catch(_0x3372d9){logger['error'](_0x32ef('0x56'),_0x3372d9[_0x32ef('0x37')]);}};module['exports']=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 50360d3..f3f828a 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 _0x2283=['username','password','Action','action','error','format','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','devicestatelist','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionSipPeerStatus','catch','[ami.js][fullybooted]','close','exports','asterisk-manager','bluebird','util','../../config/logger','ami','asterisk','port'];(function(_0x5264fd,_0x1cfed9){var _0x1f97c1=function(_0x1501cd){while(--_0x1501cd){_0x5264fd['push'](_0x5264fd['shift']());}};_0x1f97c1(++_0x1cfed9);}(_0x2283,0x121));var _0x3228=function(_0x5ccc25,_0x1bac75){_0x5ccc25=_0x5ccc25-0x0;var _0x3d5901=_0x2283[_0x5ccc25];return _0x3d5901;};'use strict';var Manager=require(_0x3228('0x0'));var BPromise=require(_0x3228('0x1'));var util=require(_0x3228('0x2'));var logger=require(_0x3228('0x3'))(_0x3228('0x4'));var config=require('../../config/environment');var ami=new Manager(config[_0x3228('0x5')][_0x3228('0x6')],config[_0x3228('0x5')]['ip'],config[_0x3228('0x5')][_0x3228('0x7')],config['asterisk'][_0x3228('0x8')],!![]);ami['keepConnected']();ami[_0x3228('0x9')]=BPromise['promisify'](ami[_0x3228('0xa')]);function error(_0x4629e3){logger[_0x3228('0xb')](util[_0x3228('0xc')]('Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s',config[_0x3228('0x5')][_0x3228('0x7')],config[_0x3228('0x5')]['ip'],config[_0x3228('0x5')][_0x3228('0x6')],util[_0x3228('0xd')](_0x4629e3,![],null)));}function close(){logger[_0x3228('0xb')](util[_0x3228('0xc')](_0x3228('0xe'),config[_0x3228('0x5')][_0x3228('0x7')],config['asterisk']['ip'],config['asterisk']['port']));}ami[_0x3228('0xf')]=function(){return function(){return ami[_0x3228('0x9')]({'action':_0x3228('0x10')});};};ami[_0x3228('0x11')]=function(){return function(){return ami['Action']({'action':_0x3228('0x12')});};};ami['actionSipPeerStatus']=function(){return function(){return ami[_0x3228('0x9')]({'action':_0x3228('0x13')});};};ami[_0x3228('0x14')]=function(){return function(){return ami[_0x3228('0x9')]({'action':_0x3228('0x15')});};};ami[_0x3228('0x16')]=function(){return function(){return ami[_0x3228('0x9')]({'action':'coreshowchannels'});};};function connect(){logger[_0x3228('0x17')](util['format'](_0x3228('0x18'),config[_0x3228('0x5')]['username'],config['asterisk']['ip'],config[_0x3228('0x5')][_0x3228('0x6')]));ami[_0x3228('0x19')](_0x3228('0xb'),error);ami[_0x3228('0x19')]('close',close);}ami['on']('connect',connect);ami['on'](_0x3228('0x1a'),function(_0x26d29a){logger[_0x3228('0x17')](util[_0x3228('0xc')](_0x3228('0x1b'),config['asterisk'][_0x3228('0x7')],config[_0x3228('0x5')]['ip'],config['asterisk'][_0x3228('0x6')],util[_0x3228('0xd')](_0x26d29a,![],null)));});ami['on'](_0x3228('0x1c'),function(){logger[_0x3228('0x17')](util[_0x3228('0xc')](_0x3228('0x1d'),config[_0x3228('0x5')][_0x3228('0x7')],config[_0x3228('0x5')]['ip'],config[_0x3228('0x5')]['port']));return Promise[_0x3228('0x1e')]()[_0x3228('0x1f')](ami[_0x3228('0xf')]())[_0x3228('0x1f')](ami['actionDeviceStateList']())[_0x3228('0x1f')](ami[_0x3228('0x20')]())[_0x3228('0x1f')](ami[_0x3228('0x14')]())['then'](ami['actionCoreShowChannels']())[_0x3228('0x21')](function(_0x495bee){logger[_0x3228('0xb')](_0x3228('0x22'),util[_0x3228('0xd')](_0x495bee,{'showHidden':![],'depth':null}));});});ami['once']('error',error);ami[_0x3228('0x19')](_0x3228('0x23'),close);module[_0x3228('0x24')]=ami; \ No newline at end of file +var _0x6d78=['once','close','connect','shutdown','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionDeviceStateList','actionQueueSummary','catch','[ami.js][fullybooted]','exports','asterisk-manager','bluebird','util','../../config/logger','../../config/environment','asterisk','port','username','password','keepConnected','Action','promisify','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','error','actionSipShowRegistry','sipshowregistry','actionSipPeerStatus','sippeerstatus','actionCoreShowChannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s'];(function(_0x24b131,_0x177a65){var _0x5e7699=function(_0x1897db){while(--_0x1897db){_0x24b131['push'](_0x24b131['shift']());}};_0x5e7699(++_0x177a65);}(_0x6d78,0x13e));var _0x86d7=function(_0x239eaf,_0x1968b4){_0x239eaf=_0x239eaf-0x0;var _0x8863f7=_0x6d78[_0x239eaf];return _0x8863f7;};'use strict';var Manager=require(_0x86d7('0x0'));var BPromise=require(_0x86d7('0x1'));var util=require(_0x86d7('0x2'));var logger=require(_0x86d7('0x3'))('ami');var config=require(_0x86d7('0x4'));var ami=new Manager(config[_0x86d7('0x5')][_0x86d7('0x6')],config[_0x86d7('0x5')]['ip'],config[_0x86d7('0x5')][_0x86d7('0x7')],config['asterisk'][_0x86d7('0x8')],!![]);ami[_0x86d7('0x9')]();ami[_0x86d7('0xa')]=BPromise[_0x86d7('0xb')](ami['action']);function error(_0x4c97e0){logger['error'](util[_0x86d7('0xc')](_0x86d7('0xd'),config[_0x86d7('0x5')][_0x86d7('0x7')],config[_0x86d7('0x5')]['ip'],config[_0x86d7('0x5')][_0x86d7('0x6')],util['inspect'](_0x4c97e0,![],null)));}function close(){logger[_0x86d7('0xe')](util[_0x86d7('0xc')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config[_0x86d7('0x5')]['username'],config['asterisk']['ip'],config[_0x86d7('0x5')][_0x86d7('0x6')]));}ami[_0x86d7('0xf')]=function(){return function(){return ami[_0x86d7('0xa')]({'action':_0x86d7('0x10')});};};ami['actionDeviceStateList']=function(){return function(){return ami['Action']({'action':'devicestatelist'});};};ami[_0x86d7('0x11')]=function(){return function(){return ami[_0x86d7('0xa')]({'action':_0x86d7('0x12')});};};ami['actionQueueSummary']=function(){return function(){return ami[_0x86d7('0xa')]({'action':'queuesummary'});};};ami[_0x86d7('0x13')]=function(){return function(){return ami[_0x86d7('0xa')]({'action':'coreshowchannels'});};};function connect(){logger[_0x86d7('0x14')](util[_0x86d7('0xc')](_0x86d7('0x15'),config[_0x86d7('0x5')]['username'],config[_0x86d7('0x5')]['ip'],config[_0x86d7('0x5')]['port']));ami[_0x86d7('0x16')](_0x86d7('0xe'),error);ami[_0x86d7('0x16')](_0x86d7('0x17'),close);}ami['on'](_0x86d7('0x18'),connect);ami['on'](_0x86d7('0x19'),function(_0x36f995){logger[_0x86d7('0x14')](util[_0x86d7('0xc')]('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config[_0x86d7('0x5')][_0x86d7('0x7')],config['asterisk']['ip'],config['asterisk'][_0x86d7('0x6')],util['inspect'](_0x36f995,![],null)));});ami['on']('fullybooted',function(){logger[_0x86d7('0x14')](util['format'](_0x86d7('0x1a'),config[_0x86d7('0x5')][_0x86d7('0x7')],config[_0x86d7('0x5')]['ip'],config[_0x86d7('0x5')][_0x86d7('0x6')]));return Promise[_0x86d7('0x1b')]()[_0x86d7('0x1c')](ami[_0x86d7('0xf')]())['then'](ami[_0x86d7('0x1d')]())['then'](ami[_0x86d7('0x11')]())[_0x86d7('0x1c')](ami[_0x86d7('0x1e')]())['then'](ami[_0x86d7('0x13')]())[_0x86d7('0x1f')](function(_0x55d546){logger[_0x86d7('0xe')](_0x86d7('0x20'),util['inspect'](_0x55d546,{'showHidden':![],'depth':null}));});});ami[_0x86d7('0x16')]('error',error);ami[_0x86d7('0x16')](_0x86d7('0x17'),close);module[_0x86d7('0x21')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index be38a7e..e1e43fc 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 _0xe706=['result','catch','exports','jayson/promise','bluebird','../../config/logger','client','http','Request','request','then','debug','rpc','memberReport','error','message'];(function(_0x57b236,_0x30614e){var _0x4feb29=function(_0x26d3e6){while(--_0x26d3e6){_0x57b236['push'](_0x57b236['shift']());}};_0x4feb29(++_0x30614e);}(_0xe706,0xa3));var _0x6e70=function(_0x68fd87,_0x17f037){_0x68fd87=_0x68fd87-0x0;var _0x559470=_0xe706[_0x68fd87];return _0x559470;};'use strict';var jayson=require(_0x6e70('0x0'));var BPromise=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('ami');var client=jayson[_0x6e70('0x3')][_0x6e70('0x4')]({'port':0x2329});client[_0x6e70('0x5')]=function(_0x7dfbc3,_0x142c27){return new BPromise(function(_0x2164a4,_0x376a8d){return client[_0x6e70('0x6')](_0x7dfbc3,_0x142c27)[_0x6e70('0x7')](function(_0x4381d1){logger[_0x6e70('0x8')](_0x6e70('0x9'),_0x6e70('0xa'),_0x7dfbc3,_0x142c27,_0x4381d1);if(_0x4381d1[_0x6e70('0xb')]){logger[_0x6e70('0xb')](_0x6e70('0x9'),_0x6e70('0xa'),_0x7dfbc3,_0x4381d1[_0x6e70('0xb')][_0x6e70('0xc')],_0x142c27);return _0x376a8d(_0x4381d1[_0x6e70('0xb')][_0x6e70('0xc')]);}else{return _0x2164a4(_0x4381d1[_0x6e70('0xd')]);}})[_0x6e70('0xe')](function(_0x4600f9){logger['error']('rpc',_0x6e70('0xa'),_0x7dfbc3,_0x4600f9,_0x142c27);return _0x376a8d(_0x4600f9);});});};module[_0x6e70('0xf')]=client; \ No newline at end of file +var _0xb7e7=['exports','jayson/promise','../../config/logger','client','Request','debug','rpc','error','memberReport','message','result','catch'];(function(_0x1c9c24,_0x2a517b){var _0x349c69=function(_0x259ff7){while(--_0x259ff7){_0x1c9c24['push'](_0x1c9c24['shift']());}};_0x349c69(++_0x2a517b);}(_0xb7e7,0x121));var _0x7b7e=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0xb7e7[_0x36eaaa];return _0x461349;};'use strict';var jayson=require(_0x7b7e('0x0'));var BPromise=require('bluebird');var logger=require(_0x7b7e('0x1'))('ami');var client=jayson[_0x7b7e('0x2')]['http']({'port':0x2329});client[_0x7b7e('0x3')]=function(_0x556d68,_0x31d0ed){return new BPromise(function(_0x118577,_0x1d9384){return client['request'](_0x556d68,_0x31d0ed)['then'](function(_0x333fa4){logger[_0x7b7e('0x4')](_0x7b7e('0x5'),'memberReport',_0x556d68,_0x31d0ed,_0x333fa4);if(_0x333fa4[_0x7b7e('0x6')]){logger[_0x7b7e('0x6')](_0x7b7e('0x5'),_0x7b7e('0x7'),_0x556d68,_0x333fa4[_0x7b7e('0x6')][_0x7b7e('0x8')],_0x31d0ed);return _0x1d9384(_0x333fa4[_0x7b7e('0x6')]['message']);}else{return _0x118577(_0x333fa4[_0x7b7e('0x9')]);}})[_0x7b7e('0xa')](function(_0x10a666){logger[_0x7b7e('0x6')](_0x7b7e('0x5'),_0x7b7e('0x7'),_0x556d68,_0x10a666,_0x31d0ed);return _0x1d9384(_0x10a666);});});};module[_0x7b7e('0xb')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 90a2b71..569b0aa 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 _0xc42e=['syncQueueCallerAbandon','droptime','responsetime','dialQueueTimeout','predictiveIntervalErlangCallsDroppedCalls','dropreason','TIMEOUT','agiafterat','countdropretry','callAdditionalPhoneAfterMin','voiceQueue','additional','rescheduleContact','add','dialDropRetryFrequency','ContactId','VoiceQueueId','CampaignId','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','swapAdditionalPhones','predictiveIntervalDroppedCallsCallersExit','outboundDropCallsDayCallersExit','Abandoned','CALLEREXIT','countglobal','dialAbandonedRetryFrequency','verifyAdditionalPhones','countabandonedretry','dialAbandonedMaxRetry','queueCallerAbandonCreateState','minutes','ListId','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','channel','actionid','roundrobin','locked','paused','stateinterface','rrmemory','isNil','merge','idHopper','strategy','run','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','[Catch][Preview][syncQueueStatusComplete]','[booked][RR][finaly]','contactAgent-idHopper:\x20','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','syncOriginateResponse','response','callProgressDetecting','[callProgressDetecting]\x20','syncVarSet','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','outboundAnswerAgiCallsDay','HangupInAMD','buildObj','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','Machine','membername','AMD','countmachineretry','amd','custom:amd','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','dialGlobalMaxRetry','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','dialMachineRetryFrequency','[rescheduleContact][Machine]','HANGUP','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','[syncAgentComplete][createHistory][0]','countagentrejectretry','stateGlobal','ivrAnswerCallsDay','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','outboundUnknownCallsDay','[syncHangupIvr][createHistory]','running','isPreviewCampaign','statusMessage','getQueueCampaignStatusMessage','available','inUse','talking','ACTIVE','compareToOutboundQueue','queueSummaryCountersUpdated','assign','throttle','dialPreviewRecallmeReminder','filter','online','handlePreviewRecallNotifications','map','Agent','user:%s','checkPreviewRecallReminder','loopClearZombieChannels','clearZombieChannels','[actions]','No\x20such\x20channel','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','undefined','[updateOriginated]\x20object\x20originated\x20is\x20negative','loggerHandler','emptyContact','notFound','saveInDb','UserId','[syncQueueCallerAbandon]\x20[Drop]','user:dialPreviewRecallReminder','actionOriginate','object','voiceQueue\x20is\x20undefine','phone','originate','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','isOutboundQueue','\x22%s,%s%s,,,%s\x22','dialQueueOptions','XMD-AMDINITIALSILENCE','XMD-AMDGREETING','dialAMDGreeting','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','XMD-AMDSILENCETHRESHOLD','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','Contact','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','TrunkBackup','dialOriginateCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','extractCalleridName','XMD-ORIGINATECALLERIDNUM','variables','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','from-sip','dialOriginateTimeout','outboundOriginateFailureCallsDay','OriginateError','[originate][error]','Error','originate\x20action\x20Error','checkRetriveMax','dialNoAnswerMaxRetry','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','[rescheduleContact][NoSuchNumber]','[rescheduleContact][Drop]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','custom:agentnosuchnumber','nosuchnumber','dialNoSuchNumberRetryFrequency','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','buildNoAnswerEventPayload','custom:agentnoanswer','dialNoAnswerRetryFrequency','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','outboundCongestionCallsDay','custom:agentcongestion','congestion','reason\x208\x20congestion','reason\x2011\x20abandoned','outboundRejectCallsDay','agentreject','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','Success','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','outboundDropCallsDayTimeout','round','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','floor','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','check\x20predictive\x20is\x20not\x20undefine','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','dropRate','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(','predictiveIntervalAvgHoldtime','predictiveIntervalAnsweredCalls','agentBusyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','loggedIn','outboundQueuePauses','[CatchErlangB]','one\x20call\x20every:','milliseconds','[handlePredictive]','checkContactBlack','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','[booked][checkContactBlack][else]','[unlockOriginate][syncQueueStatusComplete]','scheduledat','dialRecallMeTimeout','outboundReCallsDay','QUEUE_RECALL','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','handleIvr','limitCalls','getContactDialerIvr','checkContactEmpty','[getContactCampaign2][Empty]','RUNNING','[getContactCampaign2]','dialLimitQueue','pTalking','not_inuse','getContactDialer','countReScheduled','[countReScheduled]\x20','[actionOriginate]\x20','checkIsBlackList','[getContactDialer2]','tryOriginatePredictive','dialOrderByScheduledAt','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','abandonmentRate','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','p\x20=\x20','Amax\x20=\x20','erlangb','busyFactor','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','interval\x20=\x20','Umin\x20=\x20','util','uuid','moment','ioredis','./utils','./utils/hopper','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictive','predictiveCalls','syncQueueSummary','../ami','redis','defaults','socket.io-emitter','../rpc/cmHopper','../rpc/voiceQueueRt','../rpc/setting','../rpc/interval','./models/history','./models/final','./models/agentComplete','127.0.0.1','prototype','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','optionPredictive','startPredictive','startProgressive','queueBooked','queueBookedRR','queuesSummary','syncAgentConnect','bind','queuecallerabandon','originateresponse','agentcomplete','syncAgentComplete','custom:queuesummary','syncQueueSummaryComplete','hangup','syncHangup','newexten','syncNewExten','varset','queuemember','syncQueueMember','syncQueueStatusComplete','loopCampaigns','getSettings','then','previewRecallmeReminderInterval','emit','type','outbound','debug','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','inspect','name','voice_queue:save','isEmpty','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','---------------------------','isUndefined','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\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','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','getSeconds','startProgressive\x20value\x20cleared','handlePredictive','error','checkContactLowerLimitOriginate','temp','CAMPAIGN_STATUS','[getContactDialer2][ReScheduled]','contactsRescheduled','contacts','message','NO_AVAILABLE_CONTACTS','[getContactDialer2][Empty]','state','statedesc','endtime','starttime','queueStatusComplete','stringify','pick','Interval','\x20INTERVAL_IS_NULL','NULL_INTERVAL','Intervals','isIVRCampaignActive','\x20NOT\x20Active','campaign:ivr:%s','campaign:save','originated','sendMessageOneNotActive','INACTIVE','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','DISACTIVED','is\x20disactive','isTrunkReachable','active','format','SIP/%s','status','reachable','checkIsTrunkReachable','Trunk','TRUNK_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTimeIvr','checkIfTimeIntervals','ifTime','\x20Intervals\x20is\x20null\x20','EMPTY_INTERVAL','Failure','\x20Intervals\x20is\x20empty\x20','timezones','UNKNOWN_TIMEZONE','length','push','Action','command','iftime\x20%s,%s','interval','indexOf','true','catch','content','all','some','OVERTIME_GLOBAL_INTERVAL','OVERTIME_INTERVAL','[ifTime][promiseAll]','\x20Interval\x20is\x20overtime:\x20','resetActiveCalls','syncCampaigns','isIVRCampaign','resolve','dialGlobalInterval','dialTimezone','launchHandleIvr','[syncCampaigns]','checkDialMethod','dialMethod','progressive','power','handlePower','dialPowerLevel','Queue','method\x20not\x20recognized','silly','Voice\x20Queue\x20%s\x20$s','Global:\x20','Timezone:\x20','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','isGlobal','AMI\x20IfTime','[ifTime][Action]','uniqueId','uniqueid','ivr','updateOriginated','queue','answertime','YYYY-MM-DD\x20HH:mm:ss','outboundAnswerCallsDay','reason','agent','dialQueueProject2','createHistory','[syncAgentComplete][createHistory]','moveContactManagedDialer','[syncAgentComplete]'];(function(_0x5d71f0,_0x11c21e){var _0x2d236d=function(_0x5d217d){while(--_0x5d217d){_0x5d71f0['push'](_0x5d71f0['shift']());}};_0x2d236d(++_0x11c21e);}(_0xc42e,0x14d));var _0xec42=function(_0x3f8743,_0x33973f){_0x3f8743=_0x3f8743-0x0;var _0x1f844c=_0xc42e[_0x3f8743];return _0x1f844c;};'use strict';var util=require(_0xec42('0x0'));var _=require('lodash');var uuid=require(_0xec42('0x1'));var moment=require(_0xec42('0x2'));var rr=require('rr');var Redis=require(_0xec42('0x3'));var utils=require(_0xec42('0x4'));var hopperUtils=require(_0xec42('0x5'));var ut=require(_0xec42('0x6'));var config=require(_0xec42('0x7'));var logger=require(_0xec42('0x8'))(_0xec42('0x9'));var loggerBooked=require(_0xec42('0x8'))(_0xec42('0xa'));var loggerPredictive=require(_0xec42('0x8'))(_0xec42('0xb'));var loggerPredictiveCalls=require(_0xec42('0x8'))(_0xec42('0xc'));var loggerSyncQueueSummary=require(_0xec42('0x8'))(_0xec42('0xd'));var ami=require(_0xec42('0xe'));config[_0xec42('0xf')]=_[_0xec42('0x10')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xec42('0x11'))(new Redis(config[_0xec42('0xf')]));var cmHopper=require(_0xec42('0x12'));var voiceQueueRt=require(_0xec42('0x13'));var RpcSetting=require(_0xec42('0x14'));var Interval=require(_0xec42('0x15'));var Action=require('./models/action');var History=require(_0xec42('0x16'));var Final=require(_0xec42('0x17'));var AgentComplete=require(_0xec42('0x18'));var QueueCallerAbandon=require('./models/queueCallerAbandon');var Hangup=require('./models/hangup');var ipAgi=process['env']['XCALLY_IP_AGI']||_0xec42('0x19');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0xec42('0x1a')]['enqueue']=function(_0x1b2eb6){this[_0xec42('0x1b')]=this[_0xec42('0x1b')]?this[_0xec42('0x1b')][_0xec42('0x1c')](_0x1b2eb6):_0x1b2eb6();};function Dialer(_0x5e48a3,_0x5da0a3){this[_0xec42('0x1d')]=new Sequence();this[_0xec42('0x1e')]=_0x5da0a3;this[_0xec42('0x1f')]=_0x5e48a3['voiceQueues'];this[_0xec42('0x20')]=_0x5e48a3['campaigns'];this[_0xec42('0x21')]=_0x5e48a3[_0xec42('0x21')];this[_0xec42('0x22')]=_0x5e48a3['trunks'];this[_0xec42('0x23')]=config[_0xec42('0x23')]||0x2;this[_0xec42('0x24')]={};this[_0xec42('0x25')]={};this[_0xec42('0x26')]={};this['uniqueId']={};this[_0xec42('0x27')]={};this[_0xec42('0x28')]={};this[_0xec42('0x29')]={};this['ivrOriginated']={};this[_0xec42('0x2a')]={};this[_0xec42('0x2b')]={};this[_0xec42('0x2c')]={};ami['on']('agentconnect',this[_0xec42('0x2d')][_0xec42('0x2e')](this));ami['on'](_0xec42('0x2f'),this['syncQueueCallerAbandon']['bind'](this));ami['on'](_0xec42('0x30'),this['syncOriginateResponse'][_0xec42('0x2e')](this));ami['on'](_0xec42('0x31'),this[_0xec42('0x32')][_0xec42('0x2e')](this));ami['on'](_0xec42('0x33'),this[_0xec42('0xd')]['bind'](this));ami['on']('custom:queuesummarycomplete',this[_0xec42('0x34')][_0xec42('0x2e')](this));ami['on'](_0xec42('0x35'),this[_0xec42('0x36')][_0xec42('0x2e')](this));ami['on'](_0xec42('0x37'),this[_0xec42('0x38')][_0xec42('0x2e')](this));ami['on'](_0xec42('0x39'),this['syncVarSet'][_0xec42('0x2e')](this));ami['on'](_0xec42('0x3a'),this[_0xec42('0x3b')]['bind'](this));ami['on']('queuestatuscomplete',this[_0xec42('0x3c')][_0xec42('0x2e')](this));this[_0xec42('0x3d')]();this['loopClearZombieChannels']();RpcSetting[_0xec42('0x3e')]()[_0xec42('0x3f')](function(_0x320029){previewRecallmeReminderInterval=_0x320029[_0xec42('0x40')];});}function isNotNull(_0x13a237){return _0x13a237!==null&&!_['isUndefined'](_0x13a237);}function msgResponse(_0x46dec3,_0x480974,_0x2fb987){return{'action':_0x46dec3,'response':_0x480974,'message':_0x2fb987,'stack':_0x2fb987};}function emit(_0x29c9fd,_0x5ccf53,_0x36ede5){io['to'](_0x29c9fd)[_0xec42('0x41')](_0x5ccf53,_0x36ede5);}function emitOutboundVoiceQueueSummary(_0x549f94){if(_0x549f94[_0xec42('0x42')]===_0xec42('0x43')){logger[_0xec42('0x44')](_0xec42('0x45'),util[_0xec42('0x46')](_0x549f94,{'showHidden':![],'depth':null}));emit(util['format']('voice:queue:%s',_0x549f94[_0xec42('0x47')]),_0xec42('0x48'),_0x549f94);}}function checkGetDataPredictive(_0x4c4cbb){if(isNotNull(_0x4c4cbb)&&!_[_0xec42('0x49')](_0x4c4cbb)){loggerPredictive[_0xec42('0x4a')](_0xec42('0x4b'));loggerPredictive[_0xec42('0x4a')](_0xec42('0x4c'),_0x4c4cbb[_0xec42('0x4d')]);loggerPredictive[_0xec42('0x4a')](_0xec42('0x4e'),_0x4c4cbb['predictiveIntervalAnsweredCalls']);loggerPredictive[_0xec42('0x4a')]('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4c4cbb[_0xec42('0x4f')]);loggerPredictive[_0xec42('0x4a')]('Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4c4cbb['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive[_0xec42('0x4a')](_0xec42('0x50'),_0x4c4cbb['predictiveIntervalAvgHoldtime']);loggerPredictive[_0xec42('0x4a')](_0xec42('0x51'),_0x4c4cbb[_0xec42('0x52')]);loggerPredictive[_0xec42('0x4a')](_0xec42('0x53'));if(_0x4c4cbb[_0xec42('0x4d')]>0x0){if(!_[_0xec42('0x54')](_0x4c4cbb['predictiveIntervalAvgTalktime'])&&_0x4c4cbb[_0xec42('0x52')]>0x0){return!![];}loggerPredictive[_0xec42('0x4a')](_0xec42('0x55'));if(!_[_0xec42('0x54')](_0x4c4cbb['predictiveIntervalAvgHoldtime'])&&_0x4c4cbb['predictiveIntervalAvgHoldtime']>0x0){return!![];}loggerPredictive[_0xec42('0x4a')](_0xec42('0x56'));}else{loggerPredictive[_0xec42('0x4a')](_0xec42('0x57'));}}else{loggerPredictive[_0xec42('0x4a')](_0xec42('0x58'));}return![];}function mergeDataErlangB(_0x19db79){return function(_0x105187){loggerPredictive[_0xec42('0x4a')](_0xec42('0x59'));loggerPredictive[_0xec42('0x4a')](_0xec42('0x5a'),_0x105187[_0xec42('0x5b')]);loggerPredictive['info'](_0xec42('0x5c'),_0x105187[_0xec42('0x5d')]);loggerPredictive[_0xec42('0x4a')](_0xec42('0x5e'),_0x105187[_0xec42('0x5f')]);loggerPredictive[_0xec42('0x4a')](_0xec42('0x60'),_0x105187[_0xec42('0x61')]);loggerPredictive['info']('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x105187['erlangAbandonmentRate']);loggerPredictive['info'](_0xec42('0x53'));_['merge'](_0x19db79,_0x105187);};}function ifInterval(_0x458a02,_0x4f056c){if(_[_0xec42('0x54')](_0x4f056c)){return![];}return utils[_0xec42('0x62')](undefined,_0x4f056c)<_0x458a02*0x3c;}function clearPredictiveAttributes(_0x5ebdc2){if(_0x5ebdc2[_0xec42('0x29')]){_0x5ebdc2[_0xec42('0x29')]=undefined;loggerPredictive['debug'](_0x5ebdc2[_0xec42('0x47')],_0xec42('0x63'));}if(_0x5ebdc2[_0xec42('0x28')]){_0x5ebdc2['startPredictive']=undefined;loggerPredictive[_0xec42('0x44')](_0x5ebdc2[_0xec42('0x47')],'startPredictive\x20value\x20cleared');}if(_0x5ebdc2['handlePredictive']){clearInterval(_0x5ebdc2[_0xec42('0x64')]);_0x5ebdc2[_0xec42('0x64')]=undefined;loggerPredictive[_0xec42('0x44')](_0x5ebdc2[_0xec42('0x47')],'handlePredictive\x20interval\x20cleared');}}function loggerCatchPredictive(_0x1f24a2,_0x2b8667){return function(_0x4e12e1){loggerPredictive[_0xec42('0x65')](_0x2b8667[_0xec42('0x47')],_0x1f24a2);loggerPredictive['error'](_0x4e12e1['stack']);clearPredictiveAttributes(_0x2b8667);};}function loggerCatch(_0x4cd788){return function(_0x273d25){logger[_0xec42('0x65')](_0x4cd788,util[_0xec42('0x46')](_0x273d25,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x103f4c,_0x21e687,_0x473a3b){return function(_0x2dc4fb){utils[_0xec42('0x66')](_0x21e687,_0x473a3b,0x0);_0x21e687[_0xec42('0x67')]=0x0;logger[_0xec42('0x65')](_0x103f4c,util[_0xec42('0x46')](_0x2dc4fb,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x3b13d0){return function(_0x4299e7){if(isNotNull(_0x4299e7)&&isNotNull(_0x4299e7[0x0])){if(_0x4299e7[0x0]['contactsRescheduled']>0x0){_0x3b13d0['message']=utils[_0xec42('0x68')]['CONTACTS_RESCHEDULED'];logger['info'](_0xec42('0x69')+_0x3b13d0[_0xec42('0x47')],_0x4299e7[0x0][_0xec42('0x6a')],_0xec42('0x6b'));}else{_0x3b13d0[_0xec42('0x6c')]=utils[_0xec42('0x68')][_0xec42('0x6d')];logger['info'](_0xec42('0x6e')+_0x3b13d0['name']);}}};}function createObjHistory(_0x368a47,_0x5c149a,_0x3e5436,_0x4e4e71,_0x5e4c4b){_0x368a47[_0xec42('0x6c')]=_0x3e5436;var _0x582256=new Action(_0x368a47,_0x5c149a);var _0x181b8b=new History(_0x582256);_0x181b8b[_0xec42('0x6f')]=_0x4e4e71;_0x181b8b[_0xec42('0x70')]=_0x5e4c4b;_0x181b8b[_0xec42('0x71')]=_0x582256[_0xec42('0x72')];return _0x181b8b;}function unlockQueueStatus(_0xd82f1d,_0x3b0cf8){setTimeout(function(){if(_[_0xec42('0x54')](_0xd82f1d[_0xec42('0x73')])){loggerBooked['error']('[unlockQueueStatus][undefined]',_0x3b0cf8);}_0xd82f1d[_0xec42('0x73')]=!![];loggerBooked[_0xec42('0x4a')]('[booked][unlockQueueStatus]',_0x3b0cf8,JSON[_0xec42('0x74')](_[_0xec42('0x75')](_0xd82f1d,[_0xec42('0x47'),_0xec42('0x73')])));},0x1f3);}function checkInterval(_0x46b786){return function(){if(!isNotNull(_0x46b786[_0xec42('0x76')])){_0x46b786[_0xec42('0x6c')]=utils[_0xec42('0x68')]['NULL_INTERVAL'];throw _0x46b786[_0xec42('0x47')]+_0xec42('0x77');}if(!isNotNull(_0x46b786['Interval']['Intervals'])){_0x46b786[_0xec42('0x6c')]=utils[_0xec42('0x68')][_0xec42('0x78')];throw _0x46b786[_0xec42('0x47')]+_0xec42('0x77');}if(!isNotNull(_[_0xec42('0x49')](_0x46b786[_0xec42('0x76')][_0xec42('0x79')]))){_0x46b786[_0xec42('0x6c')]=utils[_0xec42('0x68')][_0xec42('0x78')];throw _0x46b786['name']+_0xec42('0x77');}};}function checkIsIVRCampaignActive(_0x14b6d9){return function(){if(!utils[_0xec42('0x7a')](_0x14b6d9)){_0x14b6d9['message']=utils['CAMPAIGN_STATUS']['INACTIVE'];throw _0x14b6d9[_0xec42('0x47')]+_0xec42('0x7b');}};}function emitCampaignSummary(_0x49f102){if(utils['isIVRCampaign'](_0x49f102)){emit(util['format'](_0xec42('0x7c'),_0x49f102[_0xec42('0x47')]),_0xec42('0x7d'),_0x49f102);}}function loggerCatchQueueSummary(_0x591bae,_0x37636d){return function(_0x3e2811){clearPredictiveAttributes(_0x37636d);emitCampaignSummary(_0x37636d);loggerSyncQueueSummary['debug'](_0x591bae,util[_0xec42('0x46')](_0x3e2811,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x571b88){if(_0x571b88['sendMessageOneNotActive']){if(_0x571b88[_0xec42('0x7e')]===0x0){_0x571b88[_0xec42('0x7f')]=![];_0x571b88[_0xec42('0x6c')]=utils[_0xec42('0x68')][_0xec42('0x80')];loggerSyncQueueSummary['debug'](_0xec42('0x81'),_0x571b88['name'],_0xec42('0x82'));}else{_0x571b88['message']=utils['CAMPAIGN_STATUS'][_0xec42('0x83')];loggerSyncQueueSummary['debug'](_0xec42('0x81'),_0x571b88['name'],_0xec42('0x84'));}emitCampaignSummary(_0x571b88);}}function myreject(_0x367389){return function(_0x2893a8){return _0x367389(msgResponse('[ifTime][Action]','Error',JSON[_0xec42('0x74')](_0x2893a8)));};}Dialer[_0xec42('0x1a')][_0xec42('0x85')]=function(_0x59607f){return!_[_0xec42('0x54')](_0x59607f)&&_0x59607f&&!_['isUndefined'](_0x59607f[_0xec42('0x47')])&&!_[_0xec42('0x54')](_0x59607f[_0xec42('0x86')])&&_0x59607f[_0xec42('0x86')]&&(this[_0xec42('0x22')][util[_0xec42('0x87')](_0xec42('0x88'),_0x59607f['name'])][_0xec42('0x89')]===_0xec42('0x8a')||this[_0xec42('0x22')][util['format'](_0xec42('0x88'),_0x59607f[_0xec42('0x47')])][_0xec42('0x89')]==='unmonitored');};Dialer[_0xec42('0x1a')][_0xec42('0x8b')]=function(_0x4abbf9){var _0x34abbb=this;return function(){if(!_0x34abbb[_0xec42('0x85')](_0x4abbf9[_0xec42('0x8c')])){if(!_0x34abbb['isTrunkReachable'](_0x4abbf9['TrunkBackup'])){_0x4abbf9[_0xec42('0x6c')]=utils[_0xec42('0x68')][_0xec42('0x8d')];throw _0x4abbf9[_0xec42('0x47')]+_0xec42('0x8e');}}};};Dialer[_0xec42('0x1a')][_0xec42('0x8f')]=function(_0x4857de,_0x2736bf,_0xe0f5d1,_0x16b590){var _0x55e6fb=this;return function(){var _0x3661c1=!![];return _0x55e6fb[_0xec42('0x90')](_0x4857de,_0x2736bf,_0xe0f5d1,_0x16b590,_0x3661c1);};};Dialer[_0xec42('0x1a')][_0xec42('0x91')]=function(_0x12b8b4,_0x344304,_0x13f321,_0x3a0010){var _0x4f91db=this;return function(){var _0x1e2f98=![];return _0x4f91db[_0xec42('0x90')](_0x12b8b4[_0xec42('0x79')],_0x344304,_0x13f321,_0x3a0010,_0x1e2f98);};};Dialer[_0xec42('0x1a')][_0xec42('0x90')]=function(_0x3850b8,_0x231396,_0x3a375a,_0x4b29b6,_0x1925cb){var _0x46128e=[];return new Promise(function(_0x211c70,_0x2c8c60){if(!isNotNull(_0x3850b8)){_0x4b29b6['message']=utils[_0xec42('0x68')][_0xec42('0x78')];return _0x2c8c60(msgResponse(_0xec42('0x92'),'Failure',_0x3a375a+_0xec42('0x93')));}if(_[_0xec42('0x49')](_0x3850b8)){_0x4b29b6[_0xec42('0x6c')]=utils[_0xec42('0x68')][_0xec42('0x94')];return _0x2c8c60(msgResponse(_0xec42('0x92'),_0xec42('0x95'),_0x3a375a+_0xec42('0x96')));}if(_0x231396&&_[_0xec42('0x54')](config[_0xec42('0x97')][_0x231396])){_0x4b29b6[_0xec42('0x6c')]=utils[_0xec42('0x68')][_0xec42('0x98')];return _0x2c8c60(msgResponse(_0xec42('0x92'),'Failure',_0x3a375a+'\x20Timezone\x20unknow\x20'+_0x231396));}if(_['isArray'](_0x3850b8)){for(var _0x30d7a0=0x0;_0x30d7a0<_0x3850b8[_0xec42('0x99')];_0x30d7a0+=0x1){_0x46128e[_0xec42('0x9a')](ami[_0xec42('0x9b')]({'action':_0xec42('0x9c'),'command':util[_0xec42('0x87')](_0xec42('0x9d'),_0x3850b8[_0x30d7a0][_0xec42('0x9e')],!_[_0xec42('0x54')](config[_0xec42('0x97')][_0x231396])?_0x231396:'')})[_0xec42('0x3f')](function(_0x2d6a75){return _0x2d6a75['content'][_0xec42('0x9f')](_0xec42('0xa0'))>=0x0;})[_0xec42('0xa1')](myreject(_0x2c8c60)));}}else{_0x46128e[_0xec42('0x9a')](ami[_0xec42('0x9b')]({'action':_0xec42('0x9c'),'command':util[_0xec42('0x87')](_0xec42('0x9d'),_0x3850b8,!_[_0xec42('0x54')](config[_0xec42('0x97')][_0x231396])?_0x231396:'')})['then'](function(_0x3b1500){return _0x3b1500[_0xec42('0xa2')]['indexOf']('true')>=0x0;})[_0xec42('0xa1')](myreject(_0x2c8c60)));}Promise[_0xec42('0xa3')](_0x46128e)[_0xec42('0x3f')](function(_0xcfda9b){var _0x261d4e=_[_0xec42('0xa4')](_0xcfda9b);if(_0x261d4e){return _0x211c70(_0x261d4e);}else{_0x4b29b6[_0xec42('0x6c')]=_0x1925cb?utils['CAMPAIGN_STATUS'][_0xec42('0xa5')]:utils[_0xec42('0x68')][_0xec42('0xa6')];return _0x2c8c60(msgResponse(_0xec42('0xa7'),_0xec42('0x95'),'Global:\x20'+_0x1925cb+'\x20'+_0x3a375a+_0xec42('0xa8')+util[_0xec42('0x46')](_0x3850b8,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x231396));}})['catch'](function(_0x528de0){return _0x2c8c60(msgResponse(_0xec42('0x92'),_0xec42('0x95'),JSON[_0xec42('0x74')](_0x528de0)));});});};Dialer[_0xec42('0x1a')][_0xec42('0x3d')]=function(){var _0x19f873=this;return cmHopper[_0xec42('0xa9')]({'active':![]},{'where':{'active':!![]}})['then'](function(){setInterval(function(){_0x19f873[_0xec42('0xaa')]();},0x3e8);});};Dialer[_0xec42('0x1a')]['syncCampaigns']=function(){var _0x5717f3=this;var _0xef9147;for(var _0x1311ab in this[_0xec42('0x20')]){if(typeof this[_0xec42('0x20')][_0x1311ab]!=='undefined'){_0xef9147=this[_0xec42('0x20')][_0x1311ab];if(utils[_0xec42('0xab')](_0xef9147)&&utils['isIVRCampaignActive'](_0xef9147)){_0xef9147[_0xec42('0x7f')]=!![];Promise[_0xec42('0xac')]()[_0xec42('0x3f')](checkIsIVRCampaignActive(_0xef9147))[_0xec42('0x3f')](checkInterval(_0xef9147))[_0xec42('0x3f')](_0x5717f3['checkIsTrunkReachable'](_0xef9147))[_0xec42('0x3f')](_0x5717f3['checkIfTime'](_0xef9147[_0xec42('0xad')],_0xef9147[_0xec42('0xae')],_0xef9147['name'],_0xef9147))[_0xec42('0x3f')](_0x5717f3[_0xec42('0x91')](_0xef9147[_0xec42('0x76')],_0xef9147[_0xec42('0xae')],_0xef9147['name'],_0xef9147))[_0xec42('0x3f')](_0x5717f3[_0xec42('0xaf')](_0xef9147))[_0xec42('0xa1')](loggerCatchQueueSummary(_0xec42('0xb0'),_0xef9147));}else{notSendMessagesCampaign(_0xef9147);}}}};Dialer['prototype'][_0xec42('0xb1')]=function(_0x679514){if(_0x679514[_0xec42('0xb2')]!==_0xec42('0xb')){clearPredictiveAttributes(_0x679514);}switch(_0x679514['dialMethod']){case _0xec42('0xb3'):this['handlePower'](_0x679514,0x1);break;case _0xec42('0xb4'):this[_0xec42('0xb5')](_0x679514,_0x679514[_0xec42('0xb6')]);break;case _0xec42('0xb'):this[_0xec42('0xb')](_0x679514);break;case _0xec42('0xa'):this[_0xec42('0xb5')](_0x679514,0x1);break;default:logger[_0xec42('0x65')](_0xec42('0xb7'),_0x679514['name'],_0xec42('0xb8'));}};Dialer[_0xec42('0x1a')][_0xec42('0x92')]=function(_0x4334d3,_0x152876){var _0x9267f8=_0x4334d3[_0xec42('0xae')];var _0x339765=_0x152876?_0x4334d3[_0xec42('0xad')]:_0x4334d3['Interval'][_0xec42('0x79')];logger[_0xec42('0xb9')]('Dialer::ifTime()',_0x339765,_0x9267f8,_0x4334d3[_0xec42('0x47')],util[_0xec42('0x87')](_0xec42('0xba'),_0x4334d3['name'],_0x4334d3['id']));var _0xa15732=null;return Interval['intervalIftime'](_0x339765,_0x9267f8)[_0xec42('0x3f')](function(_0x33023f){if(_0x33023f===!![]){return _0x33023f;}else{_0x4334d3[_0xec42('0x6c')]=_0x152876?utils[_0xec42('0x68')][_0xec42('0xa5')]:utils[_0xec42('0x68')]['OVERTIME_INTERVAL'];_0xa15732=msgResponse(_0xec42('0xa7'),_0xec42('0x95'),_0xec42('0xbb')+_0x152876+'\x20'+_0x4334d3['name']+'\x20Interval\x20is\x20overtime:\x20'+util[_0xec42('0x46')](_0x339765,{'showHidden':![],'depth':null})+_0xec42('0xbc')+_0x9267f8);}if(_0xa15732!==null){logger['silly'](_0xec42('0xbd'),_0xa15732);_0xa15732[_0xec42('0xbe')]=_0x152876;throw _0xa15732;}})[_0xec42('0xa1')](function(_0x14815c){logger[_0xec42('0x65')](_0xec42('0xbf'),_0x14815c);throw msgResponse(_0xec42('0xc0'),'Error',util['inspect'](_0x14815c,{'showHidden':![],'depth':null}));});};Dialer[_0xec42('0x1a')][_0xec42('0x2d')]=function(_0x2d43d9){if(this[_0xec42('0x1f')][_0x2d43d9['queue']]){if(this[_0xec42('0xc1')][_0x2d43d9[_0xec42('0xc2')]]&&this[_0xec42('0xc1')][_0x2d43d9[_0xec42('0xc2')]][_0xec42('0x42')]!==_0xec42('0xc3')){this[_0xec42('0xc4')](this[_0xec42('0x1f')][_0x2d43d9[_0xec42('0xc5')]]);this[_0xec42('0xc1')][_0x2d43d9['uniqueid']][_0xec42('0xc6')]=moment()[_0xec42('0x87')](_0xec42('0xc7'));}}};Dialer['prototype'][_0xec42('0x32')]=function(_0x1617c6){var _0xf25452=this[_0xec42('0xc1')][_0x1617c6[_0xec42('0xc2')]];if(this[_0xec42('0x1f')][_0x1617c6['queue']]){if(_0xf25452&&_0xf25452[_0xec42('0x42')]!==_0xec42('0xc3')){delete this[_0xec42('0xc1')][_0x1617c6[_0xec42('0xc2')]];this[_0xec42('0x1f')][_0x1617c6['queue']][_0xec42('0xc8')]+=0x1;var _0x2e9a7d=new AgentComplete(_0xf25452,_0x1617c6);if(_0x1617c6[_0xec42('0xc9')]===_0xec42('0xca')){_0x2e9a7d['agiafterat']=this['voiceQueues'][_0x1617c6['queue']][_0xec42('0xcb')]&&this[_0xec42('0x1f')][_0x1617c6[_0xec42('0xc5')]]['dialAgiAfterHangupAgent']?moment()[_0xec42('0x87')](_0xec42('0xc7')):undefined;}hopperUtils[_0xec42('0xcc')](_0x2e9a7d)[_0xec42('0xa1')](loggerCatch(_0xec42('0xcd')));hopperUtils[_0xec42('0xce')](_0x2e9a7d)[_0xec42('0xa1')](loggerCatch(_0xec42('0xcf')));}}};Dialer[_0xec42('0x1a')][_0xec42('0xd0')]=function(_0x4d308f){var _0x39ede2=this['uniqueId'][_0x4d308f[_0xec42('0xc2')]];var _0x14e755=this;var _0x13e651=![];var _0x52e9b0;var _0x4ea112;if(this[_0xec42('0x1f')][_0x4d308f[_0xec42('0xc5')]]){if(_0x39ede2&&_0x39ede2[_0xec42('0x42')]!=='ivr'){delete this[_0xec42('0xc1')][_0x4d308f[_0xec42('0xc2')]];this[_0xec42('0xc4')](this[_0xec42('0x1f')][_0x4d308f[_0xec42('0xc5')]]);_0x39ede2[_0xec42('0xd1')]=moment()[_0xec42('0x87')](_0xec42('0xc7'));var _0x26f4c8=new QueueCallerAbandon(_0x39ede2,_0x4d308f);if(utils['getSeconds'](_0x39ede2[_0xec42('0xd1')],_0x39ede2[_0xec42('0xd2')])>=_0x39ede2[_0xec42('0xd3')]){this['voiceQueues'][_0x4d308f['queue']][_0xec42('0x4f')]+=0x1;this[_0xec42('0x1f')][_0x4d308f[_0xec42('0xc5')]]['outboundDropCallsDayTimeout']+=0x1;this[_0xec42('0x1f')][_0x4d308f[_0xec42('0xc5')]][_0xec42('0xd4')]+=0x1;_0x26f4c8[_0xec42('0x6f')]=0xa;_0x26f4c8['statedesc']='Drop';_0x26f4c8[_0xec42('0xd5')]=_0xec42('0xd6');_0x26f4c8[_0xec42('0xd7')]=this[_0xec42('0x1f')][_0x4d308f[_0xec42('0xc5')]][_0xec42('0xcb')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x26f4c8[_0xec42('0xd8')]+=0x1;_0x26f4c8['countglobal']+=0x1;_0x52e9b0=this['voiceQueues'][_0x4d308f['queue']]['dialDropRetryFrequency'];_0x4ea112=this['voiceQueues'][_0x4d308f[_0xec42('0xc5')]][_0xec42('0xd9')];hopperUtils['verifyAdditionalPhones'](_0x26f4c8,_0x26f4c8[_0xec42('0x6f')],_0x39ede2[_0xec42('0xda')])[_0xec42('0x3f')](function(_0x33fa1c){_0x13e651=_0x33fa1c[_0xec42('0xdb')]==0x1;if(_0x26f4c8[_0xec42('0xd8')]>=_0x14e755[_0xec42('0x1f')][_0x4d308f[_0xec42('0xc5')]]['dialDropMaxRetry']){_0x14e755['queueCallerAbandonCreateState'](_0x26f4c8,_0x33fa1c[_0xec42('0xdb')]);}else{hopperUtils[_0xec42('0xdc')]({'active':![],'countdropretry':_0x26f4c8['countdropretry'],'scheduledat':moment()[_0xec42('0xdd')](_0x14e755[_0xec42('0x1f')][_0x4d308f[_0xec42('0xc5')]][_0xec42('0xde')],'minutes')[_0xec42('0x87')](_0xec42('0xc7')),'ContactId':_0x39ede2[_0xec42('0xdf')],'ListId':_0x39ede2['ListId'],'VoiceQueueId':_0x39ede2[_0xec42('0xe0')]||undefined,'CampaignId':_0x39ede2[_0xec42('0xe1')]||undefined})[_0xec42('0xa1')](loggerCatch('[rescheduleContact][Drop]'));var _0x197301=new History(_0x26f4c8);_0x197301[_0xec42('0x6f')]=0xa;_0x197301[_0xec42('0x70')]='Drop';_0x197301['starttime']=moment()[_0xec42('0x87')](_0xec42('0xc7'));_0x197301['endtime']=_0x197301[_0xec42('0x72')];_0x197301[_0xec42('0xe2')]=_0x26f4c8[_0xec42('0xe2')];_0x197301[_0xec42('0xe3')]=_0x26f4c8[_0xec42('0xe3')];hopperUtils[_0xec42('0xcc')](_0x197301)['catch'](loggerCatch(_0xec42('0xe4')));}})['then'](function(){if(_0x13e651)hopperUtils[_0xec42('0xe5')](_0x26f4c8,_0x52e9b0,_0x4ea112)[_0xec42('0x3f')](function(){return 0x1;});});}else{this[_0xec42('0x1f')][_0x4d308f[_0xec42('0xc5')]][_0xec42('0xe6')]+=0x1;this['voiceQueues'][_0x4d308f[_0xec42('0xc5')]][_0xec42('0xe7')]+=0x1;_0x26f4c8[_0xec42('0x6f')]=0xb;_0x26f4c8[_0xec42('0x70')]=_0xec42('0xe8');_0x26f4c8[_0xec42('0xd5')]=_0xec42('0xe9');_0x26f4c8['countabandonedretry']+=0x1;_0x26f4c8[_0xec42('0xea')]+=0x1;_0x52e9b0=this['voiceQueues'][_0x4d308f[_0xec42('0xc5')]][_0xec42('0xeb')];_0x4ea112=this[_0xec42('0x1f')][_0x4d308f[_0xec42('0xc5')]][_0xec42('0xd9')];hopperUtils[_0xec42('0xec')](_0x26f4c8,_0x26f4c8[_0xec42('0x6f')],_0x39ede2['voiceQueue'])[_0xec42('0x3f')](function(_0x530432){if(_0x26f4c8[_0xec42('0xed')]>=_0x14e755[_0xec42('0x1f')][_0x4d308f[_0xec42('0xc5')]][_0xec42('0xee')]){_0x14e755[_0xec42('0xef')](_0x26f4c8,_0x530432[_0xec42('0xdb')]);}else{hopperUtils[_0xec42('0xdc')]({'active':![],'countabandonedretry':_0x26f4c8['countabandonedretry'],'scheduledat':moment()[_0xec42('0xdd')](_0x14e755['voiceQueues'][_0x4d308f[_0xec42('0xc5')]][_0xec42('0xeb')],_0xec42('0xf0'))[_0xec42('0x87')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x39ede2[_0xec42('0xdf')],'ListId':_0x39ede2[_0xec42('0xf1')],'VoiceQueueId':_0x39ede2[_0xec42('0xe0')]||undefined,'CampaignId':_0x39ede2[_0xec42('0xe1')]||undefined})[_0xec42('0xa1')](loggerCatch(_0xec42('0xf2')));var _0x5e1af8=new History(_0x26f4c8);_0x5e1af8[_0xec42('0x6f')]=0xb;_0x5e1af8[_0xec42('0x70')]=_0xec42('0xe8');_0x5e1af8[_0xec42('0x72')]=moment()[_0xec42('0x87')](_0xec42('0xc7'));_0x5e1af8[_0xec42('0x71')]=_0x5e1af8['starttime'];_0x5e1af8['calleridname']=_0x26f4c8['calleridname'];_0x5e1af8['calleridnum']=_0x26f4c8['calleridnum'];hopperUtils[_0xec42('0xcc')](_0x5e1af8)[_0xec42('0xa1')](loggerCatch(_0xec42('0xf3')));}})[_0xec42('0x3f')](function(){if(_0x13e651)hopperUtils[_0xec42('0xe5')](_0x26f4c8,_0x52e9b0,_0x4ea112)[_0xec42('0x3f')](function(){return 0x1;});});}}}};Dialer[_0xec42('0x1a')][_0xec42('0x38')]=function(_0x39fb34){if(this[_0xec42('0x25')][_0x39fb34[_0xec42('0xc2')]]){this['actions'][_0x39fb34['uniqueid']][_0xec42('0xf4')]=_0x39fb34[_0xec42('0xf4')];}if(this['uniqueId'][_0x39fb34[_0xec42('0xc2')]]){this[_0xec42('0xc1')][_0x39fb34[_0xec42('0xc2')]][_0xec42('0xf4')]=_0x39fb34[_0xec42('0xf4')];}};Dialer[_0xec42('0x1a')][_0xec42('0x3b')]=function(_0x5e9b5b){if(!this['actions'][_0x5e9b5b[_0xec42('0xf5')]]){return;}var _0x26ebc0=this['voiceQueues'][this[_0xec42('0x25')][_0x5e9b5b[_0xec42('0xf5')]][_0xec42('0xc5')]]['strategy']||'rrmemory';if(_0x26ebc0===_0xec42('0xf6')){if(this['actions'][_0x5e9b5b[_0xec42('0xf5')]]&&_['isNil'](this[_0xec42('0x25')][_0x5e9b5b[_0xec42('0xf5')]][_0xec42('0xf7')])&&_0x5e9b5b[_0xec42('0x89')]==='1'&&_0x5e9b5b[_0xec42('0xf8')]==='0'){if(this[_0xec42('0x21')][_0x5e9b5b[_0xec42('0xf9')]]){if(!this[_0xec42('0x21')][_0x5e9b5b[_0xec42('0xf9')]][_0xec42('0xf7')]){this[_0xec42('0x21')][_0x5e9b5b[_0xec42('0xf9')]][_0xec42('0xf7')]=!![];this[_0xec42('0x25')][_0x5e9b5b[_0xec42('0xf5')]][_0xec42('0xf7')]=!![];this[_0xec42('0x25')][_0x5e9b5b[_0xec42('0xf5')]][_0xec42('0xf9')]=_0x5e9b5b['stateinterface'];}}}}else if(_0x26ebc0===_0xec42('0xfa')){if(this[_0xec42('0x25')][_0x5e9b5b['actionid']]){if(this['agents'][_0x5e9b5b[_0xec42('0xf9')]]){this['actions'][_0x5e9b5b[_0xec42('0xf5')]][_0xec42('0xf9')]=_0x5e9b5b['stateinterface'];if(_[_0xec42('0xfb')](this[_0xec42('0x2a')][this[_0xec42('0x25')][_0x5e9b5b[_0xec42('0xf5')]][_0xec42('0xc5')]])){this[_0xec42('0x2a')][this['actions'][_0x5e9b5b[_0xec42('0xf5')]][_0xec42('0xc5')]]=[];}this[_0xec42('0x2a')][this['actions'][_0x5e9b5b['actionid']][_0xec42('0xc5')]][_0xec42('0x9a')](_[_0xec42('0xfc')](_['pick'](this[_0xec42('0x25')][_0x5e9b5b[_0xec42('0xf5')]],[_0xec42('0xfd'),_0xec42('0xf9')]),{'status':_0x5e9b5b['status'],'paused':_0x5e9b5b['paused']}));}}}};Dialer[_0xec42('0x1a')][_0xec42('0x3c')]=function(_0x37b28a){if(!this['actions'][_0x37b28a[_0xec42('0xf5')]]){return;}var _0x45668d=this;var _0x584c40=this[_0xec42('0x1f')][this['actions'][_0x37b28a['actionid']][_0xec42('0xc5')]];var _0x25499b=_0x584c40[_0xec42('0xfe')]||_0xec42('0xfa');if(_0x25499b==='roundrobin'){if(this[_0xec42('0x25')][_0x37b28a[_0xec42('0xf5')]]&&this[_0xec42('0x25')][_0x37b28a[_0xec42('0xf5')]][_0xec42('0xf9')]){this['preview'][_0xec42('0xff')](this[_0xec42('0x25')][_0x37b28a[_0xec42('0xf5')]][_0xec42('0xfd')],this[_0xec42('0x25')][_0x37b28a[_0xec42('0xf5')]][_0xec42('0xf9')])[_0xec42('0xa1')](function(_0x8aeb45){logger['error']('[Catch][Preview][syncQueueStatusComplete]',util[_0xec42('0x46')](_0x8aeb45,{'showHidden':![],'depth':null}));})[_0xec42('0x1c')](function(){_0x45668d[_0xec42('0xc4')](_0x45668d['voiceQueues'][_0x45668d[_0xec42('0x25')][_0x37b28a[_0xec42('0xf5')]][_0xec42('0xc5')]]);_0x45668d[_0xec42('0x21')][_0x45668d['actions'][_0x37b28a[_0xec42('0xf5')]]['stateinterface']][_0xec42('0xf7')]=![];delete _0x45668d[_0xec42('0x25')][_0x37b28a[_0xec42('0xf5')]];unlockQueueStatus(_0x584c40);});}else{this[_0xec42('0xc4')](this[_0xec42('0x1f')][this[_0xec42('0x25')][_0x37b28a[_0xec42('0xf5')]][_0xec42('0xc5')]]);hopperUtils[_0xec42('0xdc')]({'active':![],'ContactId':this[_0xec42('0x25')][_0x37b28a['actionid']]['ContactId'],'ListId':this[_0xec42('0x25')][_0x37b28a['actionid']][_0xec42('0xf1')],'VoiceQueueId':this[_0xec42('0x25')][_0x37b28a[_0xec42('0xf5')]][_0xec42('0xe0')]||undefined,'CampaignId':this[_0xec42('0x25')][_0x37b28a['actionid']][_0xec42('0xe1')]||undefined})[_0xec42('0xa1')](loggerCatch(_0xec42('0x100')));delete this[_0xec42('0x25')][_0x37b28a[_0xec42('0xf5')]];unlockQueueStatus(_0x584c40);}}else if(_0x25499b==='rrmemory'){var _0x47e150;if(this[_0xec42('0x25')][_0x37b28a[_0xec42('0xf5')]]&&!_[_0xec42('0x49')](this[_0xec42('0x2a')][this[_0xec42('0x25')][_0x37b28a[_0xec42('0xf5')]][_0xec42('0xc5')]])){if(this[_0xec42('0x2b')][_0x45668d[_0xec42('0x25')][_0x37b28a[_0xec42('0xf5')]]['queue']]){this[_0xec42('0x2b')][_0x45668d[_0xec42('0x25')][_0x37b28a[_0xec42('0xf5')]]['queue']]=this[_0xec42('0x2b')][this[_0xec42('0x25')][_0x37b28a[_0xec42('0xf5')]][_0xec42('0xc5')]]?this[_0xec42('0x2b')][this[_0xec42('0x25')][_0x37b28a[_0xec42('0xf5')]][_0xec42('0xc5')]]:this['queueBooked'][this[_0xec42('0x25')][_0x37b28a[_0xec42('0xf5')]][_0xec42('0xc5')]]?this[_0xec42('0x2a')][this[_0xec42('0x25')][_0x37b28a[_0xec42('0xf5')]][_0xec42('0xc5')]][_0xec42('0x101')]||0x0:0x0;}this[_0xec42('0x2a')][this[_0xec42('0x25')][_0x37b28a[_0xec42('0xf5')]][_0xec42('0xc5')]]['_rr']=this['queueBookedRR'][this['actions'][_0x37b28a['actionid']][_0xec42('0xc5')]];for(var _0x3d6ce9=0x0;_0x3d6ce9=_0x5eb539[_0xec42('0x128')]){_0x400500['stateGlobal'](_0x780948,_0x745009,_0x493ec8,_0xec42('0x129'));}else{if(_0x780948[_0xec42('0x121')]>=_0x5eb539[_0xec42('0x12a')]){_0x400500[_0xec42('0x12b')](_0x780948,_0x745009,_0x493ec8,_0xec42('0x12c'));}else{hopperUtils[_0xec42('0xdc')]({'active':![],'countmachineretry':_0x780948[_0xec42('0x121')],'scheduledat':moment()['add'](_0x5eb539[_0xec42('0x12d')],_0xec42('0xf0'))[_0xec42('0x87')](_0xec42('0xc7')),'ContactId':_0x780948['ContactId'],'ListId':_0x780948[_0xec42('0xf1')],'VoiceQueueId':_0x780948[_0xec42('0xe0')]||undefined,'CampaignId':_0x780948[_0xec42('0xe1')]||undefined})['catch'](loggerCatch(_0xec42('0x12e')));_0x745009({'reschedule':0x1});}}});}if(_0x5a50f5[_0xec42('0x42')]===_0xec42('0xc3')&&this[_0xec42('0x20')][_0x5a50f5[_0xec42('0xc5')]][_0xec42('0x116')]&&_0x53b9bf[_0xec42('0x117')]===_0xec42('0x12f')){delete this[_0xec42('0xc1')][_0x53b9bf[_0xec42('0xc2')]];this[_0xec42('0xc4')](this[_0xec42('0x20')][_0x5a50f5[_0xec42('0xc5')]]);_0x12f37c=new Hangup(_0x5a50f5,_0x53b9bf);_0x12f37c[_0xec42('0x6f')]=0x12;_0x12f37c['statedesc']=_0xec42('0x119');_0x12f37c[_0xec42('0x11f')]=_0xec42('0x120');ami[_0xec42('0x41')](_0xec42('0x123'),ut[_0xec42('0x11a')](_0x12f37c,_0xec42('0x122')));this['saveInDb'](_0x12f37c,_0xec42('0x130'),_0xec42('0x131'));}if(_0x5a50f5[_0xec42('0x42')]==='ivr'&&this[_0xec42('0x20')][_0x5a50f5[_0xec42('0xc5')]]['dialAMDActive']&&_0x53b9bf[_0xec42('0x117')]===_0xec42('0x11d')){return new Promise(function(_0x24a2c3,_0x120c0a){delete _0x400500[_0xec42('0xc1')][_0x53b9bf[_0xec42('0xc2')]];_0x400500[_0xec42('0xc4')](_0x400500[_0xec42('0x20')][_0x5a50f5['queue']]);_0x400500[_0xec42('0x20')][_0x5a50f5[_0xec42('0xc5')]][_0xec42('0xc8')]+=0x1;_0x400500[_0xec42('0x20')][_0x5a50f5['queue']][_0xec42('0x118')]+=0x1;var _0x397e4d=_0x400500[_0xec42('0x20')][_0x5a50f5[_0xec42('0xc5')]];var _0x116646=new Hangup(_0x5a50f5,_0x53b9bf);_0x116646[_0xec42('0x6f')]=0x13;_0x116646['statedesc']='Machine';_0x116646['membername']='AMD';_0x116646[_0xec42('0x121')]+=0x1;_0x116646[_0xec42('0xea')]+=0x1;_0x116646[_0xec42('0x122')]=!![];ami[_0xec42('0x41')](_0xec42('0x123'),ut[_0xec42('0x11a')](_0x116646,'amd'));hopperUtils['createHistory'](_0x116646)['catch'](loggerCatch(_0xec42('0x132')));if(_0x116646[_0xec42('0x124')]+_0x116646[_0xec42('0x125')]+_0x116646[_0xec42('0x126')]+_0x116646[_0xec42('0x127')]+_0x116646['countdropretry']+_0x116646[_0xec42('0xed')]+_0x116646[_0xec42('0x121')]+_0x116646[_0xec42('0x133')]>=_0x397e4d[_0xec42('0x128')]){_0x400500[_0xec42('0x134')](_0x116646,_0x24a2c3,_0x120c0a,_0xec42('0x129'));}else{if(_0x116646[_0xec42('0x121')]>=_0x397e4d['dialMachineMaxRetry']){_0x400500[_0xec42('0x12b')](_0x116646,_0x24a2c3,_0x120c0a,_0xec42('0x12c'));}else{hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x116646['countmachineretry'],'scheduledat':moment()['add'](_0x397e4d[_0xec42('0x12d')],_0xec42('0xf0'))[_0xec42('0x87')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x116646[_0xec42('0xdf')],'ListId':_0x116646['ListId'],'VoiceQueueId':_0x116646[_0xec42('0xe0')]||undefined,'CampaignId':_0x116646['CampaignId']||undefined})[_0xec42('0xa1')](loggerCatch(_0xec42('0x12e')));_0x24a2c3({'reschedule':0x1});}}});}}};Dialer['prototype'][_0xec42('0x36')]=function(_0x2aa286){var _0x433d7a=this[_0xec42('0xc1')][_0x2aa286[_0xec42('0xc2')]];var _0xfc9ebf;if(_0x433d7a&&_0x433d7a['type']==='ivr'){delete this[_0xec42('0xc1')][_0x2aa286['uniqueid']];this[_0xec42('0xc4')](this[_0xec42('0x20')][_0x433d7a[_0xec42('0xc5')]]);this[_0xec42('0x20')][_0x433d7a['queue']][_0xec42('0x135')]+=0x1;_0xfc9ebf=new Hangup(_0x433d7a,_0x2aa286);hopperUtils[_0xec42('0xcc')](_0xfc9ebf)[_0xec42('0xa1')](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils[_0xec42('0xce')](_0xfc9ebf)[_0xec42('0xa1')](loggerCatch(_0xec42('0x136')));}if(_0x433d7a&&_0x433d7a['type']!=='ivr'&&isNotNull(this[_0xec42('0x1f')][_0x433d7a[_0xec42('0xc5')]][_0xec42('0x137')])){delete this[_0xec42('0xc1')][_0x2aa286[_0xec42('0xc2')]];this['updateOriginated'](this[_0xec42('0x1f')][_0x433d7a[_0xec42('0xc5')]]);this[_0xec42('0x1f')][_0x433d7a['queue']][_0xec42('0xc8')]+=0x1;this[_0xec42('0x1f')][_0x433d7a[_0xec42('0xc5')]][_0xec42('0x118')]+=0x1;_0xfc9ebf=new Hangup(_0x433d7a,_0x2aa286);_0xfc9ebf[_0xec42('0x6f')]=0x10;_0xfc9ebf[_0xec42('0x70')]=_0xec42('0x138');_0xfc9ebf[_0xec42('0x11f')]=_0xec42('0x139');hopperUtils[_0xec42('0xcc')](_0xfc9ebf)[_0xec42('0xa1')](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils[_0xec42('0xce')](_0xfc9ebf)[_0xec42('0xa1')](loggerCatch('[syncHangupIvr]'));}if(_0x433d7a&&_0x433d7a[_0xec42('0x42')]!=='ivr'&&!isNotNull(this[_0xec42('0x1f')][_0x433d7a[_0xec42('0xc5')]][_0xec42('0x137')])){delete this['uniqueId'][_0x2aa286['uniqueid']];this['updateOriginated'](this[_0xec42('0x1f')][_0x433d7a[_0xec42('0xc5')]]);this['voiceQueues'][_0x433d7a[_0xec42('0xc5')]][_0xec42('0x13a')]+=0x1;_0xfc9ebf=new Hangup(_0x433d7a,_0x2aa286);_0xfc9ebf[_0xec42('0x6f')]=0xc;_0xfc9ebf['statedesc']=_0x2aa286['cause-txt'];_0xfc9ebf[_0xec42('0x11f')]='Unknow';hopperUtils[_0xec42('0xcc')](_0xfc9ebf)[_0xec42('0xa1')](loggerCatch(_0xec42('0x13b')));hopperUtils[_0xec42('0xce')](_0xfc9ebf)[_0xec42('0xa1')](loggerCatch(_0xec42('0x136')));}};Dialer[_0xec42('0x1a')][_0xec42('0xd')]=function(_0x2e821d){var _0x530152=this;if(!_0x530152[_0xec42('0x2c')][_0x2e821d[_0xec42('0x47')]]){_0x530152[_0xec42('0x2c')][_0x2e821d[_0xec42('0x47')]]={'running':![]};}else if(_0x530152[_0xec42('0x2c')][_0x2e821d[_0xec42('0x47')]][_0xec42('0x13c')]===!![]){return;}else if(_0x530152[_0xec42('0x2c')][_0x2e821d[_0xec42('0x47')]][_0xec42('0x13c')]===![]){_0x530152[_0xec42('0x2c')][_0x2e821d['name']][_0xec42('0x13c')]=!![];}var _0x41cc73=_0x530152[_0xec42('0x1f')][_0x2e821d[_0xec42('0x47')]];var _0x2d6572=_0x41cc73[_0xec42('0x6c')]!==utils['CAMPAIGN_STATUS'][_0xec42('0x80')];var _0x223466=utils[_0xec42('0x13d')](_0x41cc73);_0x41cc73[_0xec42('0x13e')]=utils[_0xec42('0x13f')](_0x41cc73,_0x530152['trunks']);Promise[_0xec42('0xac')]()['then'](function(){if(_0x41cc73[_0xec42('0x13e')]===utils['CAMPAIGN_STATUS'][_0xec42('0x80')]){if(_0x2d6572){clearPredictiveAttributes(_0x41cc73);_0x2e821d[_0xec42('0x28')]=undefined;_0x2e821d[_0xec42('0x29')]=undefined;}if(_0x41cc73[_0xec42('0x13e')]===utils[_0xec42('0x68')][_0xec42('0x80')]){_0x2e821d[_0xec42('0x140')]=0x0;_0x2e821d[_0xec42('0xf8')]=0x0;_0x2e821d[_0xec42('0x141')]=0x0;_0x2e821d[_0xec42('0x142')]=0x0;_0x2e821d['pTalking']=0x0;}}else if(_0x41cc73['statusMessage']===utils['CAMPAIGN_STATUS'][_0xec42('0x143')]&&!_0x223466){return _0x530152[_0xec42('0x92')](_0x41cc73,!![])[_0xec42('0x3f')](function(){return _0x530152['ifTime'](_0x41cc73,![]);})[_0xec42('0x3f')](function(){return _0x530152[_0xec42('0xb1')](_0x41cc73);})[_0xec42('0xa1')](function(_0x574f50){loggerSyncQueueSummary[_0xec42('0x44')]('[syncQueueSummary]',util[_0xec42('0x46')](_0x574f50,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x41cc73);});}else{clearPredictiveAttributes(_0x41cc73);}})[_0xec42('0x3f')](function(){var _0x210fc4=_0x2e821d[_0xec42('0x144')](_0x41cc73);if(_0x210fc4||_0x41cc73['queueSummaryCountersUpdated']){_0x41cc73[_0xec42('0x145')]=![];_0x2e821d['updateReportFromOutboundQueue'](_0x41cc73);Object[_0xec42('0x146')](_0x41cc73,_0x2e821d);emitOutboundVoiceQueueSummary(_0x2e821d);}_0x530152[_0xec42('0x2c')][_0x41cc73[_0xec42('0x47')]]['running']=![];})[_0xec42('0xa1')](function(_0x145afc){logger['error']('[syncQueueSummary]',util[_0xec42('0x46')](_0x145afc,{'showHidden':![],'depth':null}));_0x530152[_0xec42('0x2c')][_0x41cc73[_0xec42('0x47')]][_0xec42('0x13c')]=![];});};Dialer[_0xec42('0x1a')][_0xec42('0x34')]=_[_0xec42('0x147')](function(){var _0x5b4d6a=_['filter'](this[_0xec42('0x1f')],function(_0x102b57){return _0x102b57[_0xec42('0x148')];});var _0x2d4902=_[_0xec42('0x149')](this[_0xec42('0x21')],function(_0x3bd2d2){return _0x3bd2d2[_0xec42('0x14a')]&&_0x3bd2d2[_0xec42('0x89')]==='reachable';});if(_0x5b4d6a[_0xec42('0x99')]>0x0&&_0x2d4902[_0xec42('0x99')]>0x0){return Promise[_0xec42('0xac')]()[_0xec42('0x3f')](cmHopper[_0xec42('0x14b')](_[_0xec42('0x14c')](_0x5b4d6a,'id'),previewRecallmeReminderInterval,_[_0xec42('0x14c')](_0x2d4902,'id')))[_0xec42('0x3f')](function(_0x1c94b4){for(var _0x5cbc07=0x0;_0x5cbc07<_0x1c94b4[_0xec42('0x99')];_0x5cbc07++){var _0x4fcbb2=_0x1c94b4[_0x5cbc07][_0xec42('0x14d')][_0xec42('0x47')];if(_0x4fcbb2)io['to'](util[_0xec42('0x87')](_0xec42('0x14e'),_0x4fcbb2))['emit']('user:dialPreviewRecallReminder',{'hopper':_0x1c94b4[_0x5cbc07]});}})['catch'](function(_0x1af32e){logger[_0xec42('0x65')](_0xec42('0x14f'),_0x1af32e);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0xec42('0x1a')][_0xec42('0x150')]=function(){var _0x54eb05=this;setInterval(function(){_0x54eb05['clearZombieChannels'](_0x54eb05[_0xec42('0xc1')],'[uniqueid]');_0x54eb05[_0xec42('0x151')](_0x54eb05[_0xec42('0x25')],_0xec42('0x152'));},0x32c8);};Dialer[_0xec42('0x1a')][_0xec42('0x151')]=function(_0x2f334c,_0x431ba2){var _0x2475b7=this;for(var _0x11f895 in _0x2f334c){if(typeof _0x2f334c[_0x11f895]!=='undefined'){this['sequence']['enqueue'](function(){if(!_[_0xec42('0xfb')](_0x2f334c[_0x11f895])){return ami[_0xec42('0x9b')]({'action':'status','channel':_0x2f334c[_0x11f895][_0xec42('0xf4')]})['catch'](function(_0x459cbe){if(_0x459cbe[_0xec42('0x6c')]===_0xec42('0x153')){setTimeout(function(){if(_0x2f334c[_0x11f895]&&_0x2f334c[_0x11f895][_0xec42('0x42')]!=='ivr'){_0x2475b7[_0xec42('0xc4')](_0x2475b7[_0xec42('0x1f')][_0x2f334c[_0x11f895]['queue']]);logger['error'](_0xec42('0x154'),_0x431ba2,_0x11f895,_0x2f334c[_0x11f895][_0xec42('0xc5')]);delete _0x2f334c[_0x11f895];}if(_0x2f334c[_0x11f895]&&_0x2f334c[_0x11f895][_0xec42('0x42')]===_0xec42('0xc3')){_0x2475b7[_0xec42('0xc4')](_0x2475b7[_0xec42('0x20')][_0x2f334c[_0x11f895][_0xec42('0xc5')]]);logger[_0xec42('0x65')](_0xec42('0x155'),_0x431ba2,_0x11f895,_0x2f334c[_0x11f895][_0xec42('0xc5')]);delete _0x2f334c[_0x11f895];}},0x2328);}});}});}}};Dialer[_0xec42('0x1a')]['getVoiceQueueRtPauses']=function(_0x21908f){return Promise['resolve']()[_0xec42('0x3f')](voiceQueueRt[_0xec42('0x156')](_0x21908f))[_0xec42('0xa1')](loggerCatch(_0xec42('0x157')));};Dialer[_0xec42('0x1a')][_0xec42('0xc4')]=function(_0x4f6594){if(!_[_0xec42('0x54')](_0x4f6594)&&_0x4f6594!==null){if(typeof _0x4f6594[_0xec42('0x7e')]!==_0xec42('0x158')){if(_0x4f6594['originated']>0x0){_0x4f6594[_0xec42('0x7e')]-=0x1;}else{logger[_0xec42('0x65')](_0xec42('0x159'));}}}else{logger['error']('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer[_0xec42('0x1a')][_0xec42('0x15a')]=function(_0x3c41fc,_0x925980){var _0x55aba0=this;return function(_0x5d7813){_0x55aba0[_0xec42('0xc4')](_0x925980);logger[_0xec42('0x65')](_0x3c41fc,util[_0xec42('0x46')](_0x5d7813,{'showHidden':![],'depth':null}));};};Dialer[_0xec42('0x1a')][_0xec42('0x15b')]=function(_0x53e847,_0x6bec58,_0x51e8f4){var _0x23db88={'state':0x19,'statedesc':_0xec42('0x15c')};this['updateOriginated'](_0x6bec58);this[_0xec42('0x15d')](_[_0xec42('0xfc')](_0x23db88,_['pick'](_0x51e8f4,[_0xec42('0xdf'),'ListId',_0xec42('0x15e'),_0xec42('0xe0'),_0xec42('0xe1')])),'[emptyContact][createHistory]','[emptyContact]');logger[_0xec42('0x65')](_0x53e847);};Dialer[_0xec42('0x1a')][_0xec42('0x15d')]=function(_0x3d8c9e,_0x3a9dfc,_0x40cf88){hopperUtils[_0xec42('0xcc')](_0x3d8c9e)[_0xec42('0xa1')](loggerCatch(_0x3a9dfc));hopperUtils[_0xec42('0xce')](_0x3d8c9e)[_0xec42('0xa1')](loggerCatch(_0x40cf88));};Dialer[_0xec42('0x1a')][_0xec42('0xef')]=function(_0x4d619d,_0x3bf8d2){hopperUtils['createHistory'](_0x4d619d)[_0xec42('0xa1')](loggerCatch(_0xec42('0xcd')));if(_0x3bf8d2==0x0){hopperUtils[_0xec42('0xce')](_0x4d619d)[_0xec42('0xa1')](loggerCatch(_0xec42('0x15f')));}};Dialer[_0xec42('0x1a')]['checkPreviewRecallReminder']=function(_0x4dfd7b){return Promise[_0xec42('0xac')]()[_0xec42('0x3f')](cmHopper['handlePreviewRecallNotifications'](_0x4dfd7b['id'],previewRecallmeReminderInterval))[_0xec42('0x3f')](function(_0x426174){for(var _0x189cd1=0x0;_0x189cd1<_0x426174[_0xec42('0x99')];_0x189cd1++){var _0x5ad2d5=_0x426174[_0x189cd1][_0xec42('0x14d')][_0xec42('0x47')];if(_0x5ad2d5)io['to'](util[_0xec42('0x87')](_0xec42('0x14e'),_0x5ad2d5))[_0xec42('0x41')](_0xec42('0x160'),{'hopper':_0x426174[_0x189cd1]});}})[_0xec42('0xa1')](function(){});};Dialer['prototype'][_0xec42('0xaf')]=function(_0x1df724){var _0x23134e=this;return function(){_0x23134e['handleIvr'](_0x1df724);};};Dialer['prototype'][_0xec42('0x161')]=function(_0x2dec9e,_0x1ed574){var _0x4bdeff=this;var _0x281b94=uuid['v4']();this[_0xec42('0x25')][_0x281b94]=new Action(_0x2dec9e,_0x1ed574,_0x281b94);return new Promise(function(_0x5b8cc6,_0x4ec8f5){if(_[_0xec42('0x54')](_0x2dec9e)&&typeof _0x2dec9e!==_0xec42('0x162')){return _0x4ec8f5(msgResponse('originate',_0xec42('0x95'),_0xec42('0x163')));}if(_[_0xec42('0x54')](_0x1ed574[_0xec42('0x164')])||_0x1ed574[_0xec42('0x164')]===null){return _0x4ec8f5(msgResponse(_0xec42('0x165'),_0xec42('0x95'),_0xec42('0x166')));}var _0x111077={'XMD-CALLERID':_0x4bdeff[_0xec42('0x25')][_0x281b94][_0xec42('0x167')](),'XMD-AGI':_0x2dec9e['dialQueueProject']?util['format'](_0xec42('0x168'),ipAgi,_0x2dec9e[_0xec42('0x137')]):_0xec42('0x169'),'XMD-AGIAFTER':_0x2dec9e[_0xec42('0xcb')]?util[_0xec42('0x87')](_0xec42('0x168'),ipAgi,_0x2dec9e['dialQueueProject2']):_0xec42('0x169'),'XMD-QUEUE':utils[_0xec42('0x16a')](_0x2dec9e)?util['format'](_0xec42('0x16b'),_0x2dec9e[_0xec42('0x47')],_0x2dec9e[_0xec42('0x16c')]||'',_0x2dec9e['dialAgiAfterHangupAgent']?'c':'',_0x2dec9e[_0xec42('0xd3')]||0x3):_0xec42('0x169'),'XMD-CONTACTID':_0x1ed574[_0xec42('0xdf')],'XMD-CDRTYPE':_0xec42('0x9'),'CALLERID(all)':_0x4bdeff[_0xec42('0x25')][_0x281b94]['getCaller'](),'XMD-AMD':_0x2dec9e[_0xec42('0x116')]?_0xec42('0x143'):_0xec42('0x169'),'XMD-DESTINATION':_0xec42('0x115')};if(_0x2dec9e[_0xec42('0x116')]){_0x111077[_0xec42('0x16d')]=_0x2dec9e['dialAMDInitialSilence']||0x9c4;_0x111077[_0xec42('0x16e')]=_0x2dec9e[_0xec42('0x16f')]||0x5dc;_0x111077['XMD-AMDAFTERGREETINGSILENCE']=_0x2dec9e[_0xec42('0x170')]||0x320;_0x111077[_0xec42('0x171')]=_0x2dec9e[_0xec42('0x172')]||0x1388;_0x111077[_0xec42('0x173')]=_0x2dec9e[_0xec42('0x174')]||0x64;_0x111077[_0xec42('0x175')]=_0x2dec9e[_0xec42('0x176')]||0x32;_0x111077[_0xec42('0x177')]=_0x2dec9e['dialAMDMaximumNumberOfWords']||0x3;_0x111077[_0xec42('0x178')]=_0x2dec9e['dialAMDSilenceThreshold']||0x100;_0x111077[_0xec42('0x179')]=_0x2dec9e[_0xec42('0x17a')]||0x1388;}if(utils[_0xec42('0x16a')](_0x2dec9e)){_0x111077[_0xec42('0x17b')]=_0x1ed574[_0xec42('0xe0')];}else{_0x111077['XMD-CAMPAIGNID']=_0x1ed574[_0xec42('0xe1')];}var _0x72cd9e=utils['setXMDContactVariables'](_0x1ed574[_0xec42('0x17c')]);Object[_0xec42('0x146')](_0x111077,_0x72cd9e);var _0x390a36=_0x4bdeff[_0xec42('0x85')](_0x2dec9e[_0xec42('0x8c')])?utils[_0xec42('0x17d')](_0x2dec9e[_0xec42('0x8c')][_0xec42('0x17e')],_0x2dec9e[_0xec42('0x17f')],_0x2dec9e[_0xec42('0x180')]>0x0?utils[_0xec42('0x181')](_0x2dec9e['dialOriginateCallerIdNumber'],_0x2dec9e[_0xec42('0x180')]):_0x2dec9e['dialOriginateCallerIdNumber']):utils[_0xec42('0x17d')](_[_0xec42('0xfb')](_0x2dec9e[_0xec42('0x182')])?_0x2dec9e[_0xec42('0x8c')][_0xec42('0x17e')]:_0x2dec9e['TrunkBackup'][_0xec42('0x17e')],_0x2dec9e[_0xec42('0x17f')],_0x2dec9e['dialRandomLastDigitCallerIdNumber']>0x0?utils[_0xec42('0x181')](_0x2dec9e[_0xec42('0x183')],_0x2dec9e[_0xec42('0x180')]):_0x2dec9e[_0xec42('0x183')]);if(_0x390a36){_0x111077[_0xec42('0x184')]=_0x4bdeff[_0xec42('0x25')][_0x281b94][_0xec42('0x185')]=utils[_0xec42('0x186')](_0x390a36);_0x111077[_0xec42('0x187')]=_0x1ed574[_0xec42('0x164')];}_0x2dec9e[_0xec42('0x188')]=_0x111077;return ami[_0xec42('0x9b')]({'actionid':_0x281b94,'action':'originate','channel':_0x4bdeff[_0xec42('0x85')](_0x2dec9e[_0xec42('0x8c')])?util[_0xec42('0x87')](_0xec42('0x189'),_0x2dec9e[_0xec42('0x8c')][_0xec42('0x47')],isNotNull(_0x2dec9e['dialPrefix'])?_0x2dec9e[_0xec42('0x18a')][_0xec42('0x18b')]()||'':'',_0x2dec9e[_0xec42('0x18c')]>0x0?_0x1ed574[_0xec42('0x164')][_0xec42('0x18d')](_0x2dec9e[_0xec42('0x18c')]):_0x1ed574[_0xec42('0x164')]):util['format']('SIP/%s/%s%s',_[_0xec42('0xfb')](_0x2dec9e[_0xec42('0x182')])?_0x2dec9e['Trunk'][_0xec42('0x47')]:_0x2dec9e[_0xec42('0x182')]['name'],isNotNull(_0x2dec9e[_0xec42('0x18a')])?_0x2dec9e[_0xec42('0x18a')][_0xec42('0x18b')]()||'':'',_0x2dec9e[_0xec42('0x18c')]>0x0?_0x1ed574[_0xec42('0x164')]['substring'](_0x2dec9e[_0xec42('0x18c')]):_0x1ed574[_0xec42('0x164')]),'callerid':_0x390a36,'Exten':'xcally-motion-dialer','Context':_0xec42('0x18e'),'Priority':'1','variable':_0x111077,'timeout':(_0x2dec9e[_0xec42('0x18f')]||0x1e)*0x3e8,'async':!![],'channelid':_0x281b94})[_0xec42('0x3f')](function(_0x25f846){return _0x5b8cc6(_0x25f846);})[_0xec42('0xa1')](function(_0x4e2463){_0x2dec9e[_0xec42('0x190')]+=0x1;var _0x3d2831=new History(_0x4bdeff[_0xec42('0x25')][_0x281b94]);logger[_0xec42('0x65')](util['format']('[originateError]:\x20%s',JSON[_0xec42('0x74')](_0x4e2463)));_0x3d2831['state']=0xe;_0x3d2831[_0xec42('0x70')]=_0xec42('0x191');_0x3d2831[_0xec42('0x72')]=moment()[_0xec42('0x87')](_0xec42('0xc7'));_0x3d2831[_0xec42('0x71')]=_0x3d2831[_0xec42('0x72')];hopperUtils[_0xec42('0xcc')](_0x3d2831)['catch'](loggerCatch(_0xec42('0x192')));_0x4bdeff[_0xec42('0xce')](_0x3d2831)[_0xec42('0xa1')](loggerCatch(_0xec42('0x192')))[_0xec42('0x1c')](function(){delete _0x4bdeff[_0xec42('0x25')][_0x281b94];return _0x4ec8f5(msgResponse(_0xec42('0x165'),_0xec42('0x193'),_0xec42('0x194')));});});});};Dialer['prototype'][_0xec42('0x195')]=function(_0xcd40b3,_0x52e6dd,_0x1244fa){var _0x3e16fe=new History(_0x52e6dd);if(_0x3e16fe[_0xec42('0x124')]+_0x3e16fe[_0xec42('0x125')]+_0x3e16fe[_0xec42('0x126')]+_0x3e16fe[_0xec42('0x127')]+_0x3e16fe[_0xec42('0xd8')]+_0x3e16fe['countabandonedretry']+_0x3e16fe['countmachineretry']+_0x3e16fe[_0xec42('0x133')]>=_0x1244fa[_0xec42('0x128')]-0x1){return!![];}switch(_0xcd40b3){case 0x3:if(_0x3e16fe['countnoanswerretry']>=_0x1244fa[_0xec42('0x196')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countnoanswerretry':_0x3e16fe[_0xec42('0x126')]+=0x1,'scheduledat':moment()[_0xec42('0xdd')](_0x1244fa['dialNoAnswerRetryFrequency'],_0xec42('0xf0'))[_0xec42('0x87')](_0xec42('0xc7')),'ContactId':_0x3e16fe[_0xec42('0xdf')],'ListId':_0x3e16fe[_0xec42('0xf1')],'VoiceQueueId':_0x3e16fe['VoiceQueueId']||undefined,'CampaignId':_0x3e16fe[_0xec42('0xe1')]||undefined})['catch'](loggerCatch(_0xec42('0x197')));break;case 0x5:if(_0x3e16fe[_0xec42('0x124')]>=_0x1244fa[_0xec42('0x198')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countbusyretry':_0x3e16fe[_0xec42('0x124')]+=0x1,'scheduledat':moment()['add'](_0x1244fa['dialBusyRetryFrequency'],_0xec42('0xf0'))[_0xec42('0x87')](_0xec42('0xc7')),'ContactId':_0x3e16fe[_0xec42('0xdf')],'ListId':_0x3e16fe[_0xec42('0xf1')],'VoiceQueueId':_0x3e16fe[_0xec42('0xe0')]||undefined,'CampaignId':_0x3e16fe['CampaignId']||undefined})[_0xec42('0xa1')](loggerCatch(_0xec42('0x199')));break;case 0x8:if(_0x3e16fe[_0xec42('0x125')]>=_0x1244fa[_0xec42('0x19a')]-0x1){return!![];}hopperUtils[_0xec42('0xdc')]({'active':![],'countcongestionretry':_0x3e16fe[_0xec42('0x125')]+=0x1,'scheduledat':moment()['add'](_0x1244fa[_0xec42('0x19b')],_0xec42('0xf0'))[_0xec42('0x87')](_0xec42('0xc7')),'ContactId':_0x3e16fe[_0xec42('0xdf')],'ListId':_0x3e16fe[_0xec42('0xf1')],'VoiceQueueId':_0x3e16fe[_0xec42('0xe0')]||undefined,'CampaignId':_0x3e16fe[_0xec42('0xe1')]||undefined})['catch'](loggerCatch(_0xec42('0x19c')));break;case 0x0:if(_0x3e16fe[_0xec42('0x127')]>=_0x1244fa[_0xec42('0x19d')]-0x1){return!![];}else{hopperUtils[_0xec42('0xdc')]({'active':![],'countnosuchnumberretry':_0x3e16fe[_0xec42('0x127')]+=0x1,'scheduledat':moment()[_0xec42('0xdd')](_0x1244fa['dialNoSuchNumberRetryFrequency'],_0xec42('0xf0'))[_0xec42('0x87')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3e16fe[_0xec42('0xdf')],'ListId':_0x3e16fe[_0xec42('0xf1')],'VoiceQueueId':_0x3e16fe['VoiceQueueId']||undefined,'CampaignId':_0x3e16fe[_0xec42('0xe1')]||undefined})[_0xec42('0xa1')](loggerCatch(_0xec42('0x19e')));}break;case 0xa:if(_0x3e16fe[_0xec42('0xd8')]>=_0x1244fa['dialDropMaxRetry']-0x1){return!![];}hopperUtils[_0xec42('0xdc')]({'active':![],'countdropretry':_0x3e16fe[_0xec42('0xd8')]+=0x1,'scheduledat':moment()[_0xec42('0xdd')](_0x1244fa[_0xec42('0xde')],_0xec42('0xf0'))[_0xec42('0x87')](_0xec42('0xc7')),'ContactId':_0x3e16fe['ContactId'],'ListId':_0x3e16fe[_0xec42('0xf1')],'VoiceQueueId':_0x3e16fe[_0xec42('0xe0')]||undefined,'CampaignId':_0x3e16fe[_0xec42('0xe1')]||undefined})[_0xec42('0xa1')](loggerCatch(_0xec42('0x19f')));break;case 0xb:if(_0x3e16fe[_0xec42('0xed')]>=_0x1244fa[_0xec42('0xee')]-0x1){return!![];}hopperUtils[_0xec42('0xdc')]({'active':![],'countabandonedretry':_0x3e16fe[_0xec42('0xed')]+=0x1,'scheduledat':moment()[_0xec42('0xdd')](_0x1244fa['dialAbandonedRetryFrequency'],_0xec42('0xf0'))[_0xec42('0x87')](_0xec42('0xc7')),'ContactId':_0x3e16fe[_0xec42('0xdf')],'ListId':_0x3e16fe[_0xec42('0xf1')],'VoiceQueueId':_0x3e16fe['VoiceQueueId']||undefined,'CampaignId':_0x3e16fe['CampaignId']||undefined})[_0xec42('0xa1')](loggerCatch(_0xec42('0xf2')));break;case 0x13:if(_0x3e16fe[_0xec42('0x121')]>=_0x1244fa[_0xec42('0x12a')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x3e16fe[_0xec42('0x121')]+=0x1,'scheduledat':moment()[_0xec42('0xdd')](_0x1244fa[_0xec42('0x12d')],_0xec42('0xf0'))['format'](_0xec42('0xc7')),'ContactId':_0x3e16fe['ContactId'],'ListId':_0x3e16fe[_0xec42('0xf1')],'VoiceQueueId':_0x3e16fe[_0xec42('0xe0')]||undefined,'CampaignId':_0x3e16fe[_0xec42('0xe1')]||undefined})[_0xec42('0xa1')](loggerCatch('[rescheduleContact][Machine]'));break;case 0x14:if(_0x3e16fe['countagentrejectretry']>=_0x1244fa[_0xec42('0x1a0')]-0x1){return!![];}hopperUtils[_0xec42('0xdc')]({'active':![],'countagentrejectretry':_0x3e16fe[_0xec42('0x133')]+=0x1,'scheduledat':moment()[_0xec42('0xdd')](_0x1244fa[_0xec42('0x1a1')],_0xec42('0xf0'))[_0xec42('0x87')](_0xec42('0xc7')),'ContactId':_0x3e16fe[_0xec42('0xdf')],'ListId':_0x3e16fe[_0xec42('0xf1')],'VoiceQueueId':_0x3e16fe['VoiceQueueId']||undefined,'CampaignId':_0x3e16fe[_0xec42('0xe1')]||undefined})[_0xec42('0xa1')](loggerCatch(_0xec42('0x1a2')));break;default:return!![];}};Dialer[_0xec42('0x1a')]['callProgressDetecting']=function(_0x593923,_0x10a742,_0x5b2938){var _0xfe68a0=this;var _0x25380b=new History(_0x593923);var _0xcbad64=![];var _0x1b0dfa;var _0x27a07d;return new Promise(function(_0x3fd880,_0xb9458){if(_['isUndefined'](_0x10a742)&&typeof _0x10a742!==_0xec42('0x162')){return _0xb9458(msgResponse(_0xec42('0x1a3'),_0xec42('0x95'),_0xec42('0x1a4')));}if(_[_0xec42('0x54')](_0x5b2938)&&typeof _0x5b2938!==_0xec42('0x162')){return _0xb9458(msgResponse('[callProgressDetecting]',_0xec42('0x95'),'evt\x20is\x20undefine'));}hopperUtils[_0xec42('0xec')](_0x25380b,_0x5b2938[_0xec42('0xc9')],_0x10a742)['then'](function(_0xa195d6){if(_0xa195d6[_0xec42('0xdb')]==0x1)_0xcbad64=!![];switch(_0x5b2938['reason']){case'0':_0x10a742['outboundNoSuchCallsDay']+=0x1;_0x25380b[_0xec42('0x6f')]=0x0;_0x25380b[_0xec42('0x70')]='NoSuchNumber';_0x25380b['countnosuchnumberretry']+=0x1;_0x25380b[_0xec42('0xea')]+=0x1;ami[_0xec42('0x41')](_0xec42('0x1a5'),ut['buildObj'](_0x593923,_0xec42('0x1a6')));_0x1b0dfa=_0x10a742[_0xec42('0x1a7')];_0x27a07d=_0x10a742[_0xec42('0xd9')];hopperUtils[_0xec42('0xcc')](_0x25380b)[_0xec42('0xa1')](loggerCatch(_0xec42('0x132')));if(_0xfe68a0[_0xec42('0x195')](0x0,_0x593923,_0x10a742)&&!_0xcbad64){if(_0x25380b[_0xec42('0x127')]>=_0x10a742[_0xec42('0x19d')]){_0xfe68a0['createStateFinal'](_0x25380b,_0x3fd880,_0xb9458,_0xec42('0x1a8'));}else{_0xfe68a0[_0xec42('0x134')](_0x25380b,_0x3fd880,_0xb9458,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x10a742[_0xec42('0x1a9')]+=0x1;_0x25380b['state']=0x3;_0x25380b[_0xec42('0x70')]='NoAnswer';_0x25380b['countnoanswerretry']+=0x1;_0x25380b[_0xec42('0xea')]+=0x1;var _0x9771f6=ut[_0xec42('0x1aa')](_0x593923,_0x10a742);ami[_0xec42('0x41')](_0xec42('0x1ab'),_0x9771f6);_0x1b0dfa=_0x10a742[_0xec42('0x1ac')];_0x27a07d=_0x10a742[_0xec42('0xd9')];hopperUtils[_0xec42('0xcc')](_0x25380b)[_0xec42('0xa1')](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0xfe68a0[_0xec42('0x195')](0x3,_0x593923,_0x10a742)&&!_0xcbad64){if(_0x25380b[_0xec42('0x126')]>=_0x10a742[_0xec42('0x196')]){_0xfe68a0[_0xec42('0x12b')](_0x25380b,_0x3fd880,_0xb9458,'reason\x203\x20ringing\x20no\x20answer');}else{_0xfe68a0[_0xec42('0x134')](_0x25380b,_0x3fd880,_0xb9458,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x10a742['outboundBusyCallsDay']+=0x1;_0x25380b[_0xec42('0x6f')]=0x5;_0x25380b['statedesc']=_0xec42('0x1ad');_0x25380b['countbusyretry']+=0x1;_0x25380b[_0xec42('0xea')]+=0x1;ami[_0xec42('0x41')](_0xec42('0x1ae'),ut[_0xec42('0x11a')](_0x593923,_0xec42('0x1af')));_0x1b0dfa=_0x10a742['dialBusyRetryFrequency'];_0x27a07d=_0x10a742['callAdditionalPhoneAfterMin'];hopperUtils[_0xec42('0xcc')](_0x25380b)[_0xec42('0xa1')](loggerCatch(_0xec42('0x1b0')));if(_0xfe68a0[_0xec42('0x195')](0x5,_0x593923,_0x10a742)&&!_0xcbad64){if(_0x25380b['countbusyretry']>=_0x10a742['dialBusyMaxRetry']){_0xfe68a0[_0xec42('0x12b')](_0x25380b,_0x3fd880,_0xb9458,'reason\x205\x20busy');}else{_0xfe68a0[_0xec42('0x134')](_0x25380b,_0x3fd880,_0xb9458,_0xec42('0x1b1'));}}break;case'8':_0x10a742[_0xec42('0x1b2')]+=0x1;_0x25380b['state']=0x8;_0x25380b[_0xec42('0x70')]='Congestion';_0x25380b['countcongestionretry']+=0x1;_0x25380b[_0xec42('0xea')]+=0x1;_0x1b0dfa=_0x10a742['dialCongestionRetryFrequency'];_0x27a07d=_0x10a742[_0xec42('0xd9')];ami[_0xec42('0x41')](_0xec42('0x1b3'),ut['buildObj'](_0x593923,_0xec42('0x1b4')));hopperUtils[_0xec42('0xcc')](_0x25380b)['catch'](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0xfe68a0[_0xec42('0x195')](0x8,_0x593923,_0x10a742)&&!_0xcbad64){if(_0x25380b[_0xec42('0x125')]>=_0x10a742[_0xec42('0x19a')]){_0xfe68a0['createStateFinal'](_0x25380b,_0x3fd880,_0xb9458,_0xec42('0x1b5'));}else{_0xfe68a0[_0xec42('0x134')](_0x25380b,_0x3fd880,_0xb9458,'reason\x208\x20congestion');}}break;case'11':_0x10a742['outboundAbandonedCallsDay']+=0x1;_0x25380b['state']=0xb;_0x25380b['statedesc']='Abandoned';_0x25380b[_0xec42('0xed')]+=0x1;_0x25380b[_0xec42('0xea')]+=0x1;_0x1b0dfa=_0x10a742[_0xec42('0xeb')];_0x27a07d=_0x10a742[_0xec42('0xd9')];hopperUtils[_0xec42('0xcc')](_0x25380b)[_0xec42('0xa1')](loggerCatch('[syncAgentComplete][createHistory][11]'));if(_0xfe68a0[_0xec42('0x195')](0xb,_0x593923,_0x10a742)&&!_0xcbad64){if(_0x25380b['countabandonedretry']>=_0x10a742[_0xec42('0xee')]){_0xfe68a0[_0xec42('0x12b')](_0x25380b,_0x3fd880,_0xb9458,'reason\x2011\x20abandoned');}else{_0xfe68a0['stateGlobal'](_0x25380b,_0x3fd880,_0xb9458,_0xec42('0x1b6'));}}break;case'20':_0x10a742[_0xec42('0x1b7')]+=0x1;_0x25380b[_0xec42('0x6f')]=0x14;_0x25380b['statedesc']='AgentReject';_0x25380b[_0xec42('0x133')]+=0x1;_0x25380b[_0xec42('0xea')]+=0x1;_0x1b0dfa=_0x10a742[_0xec42('0x1a1')];_0x27a07d=_0x10a742[_0xec42('0xd9')];ami[_0xec42('0x41')]('custom:agentreject',ut[_0xec42('0x11a')](_0x593923,_0xec42('0x1b8')));hopperUtils[_0xec42('0xcc')](_0x25380b)['catch'](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0xfe68a0['checkRetriveMax'](0x14,_0x593923,_0x10a742)&&!_0xcbad64){if(_0x25380b[_0xec42('0x133')]>=_0x10a742['dialAgentRejectMaxRetry']){_0xfe68a0[_0xec42('0x12b')](_0x25380b,_0x3fd880,_0xb9458,_0xec42('0x1b9'));}else{_0xfe68a0[_0xec42('0x134')](_0x25380b,_0x3fd880,_0xb9458,_0xec42('0x1b9'));}}break;default:_0x10a742[_0xec42('0x13a')]+=0x1;_0x25380b[_0xec42('0x6f')]=0xc;_0x25380b[_0xec42('0x70')]=_0x5b2938[_0xec42('0xc9')];_0x1b0dfa=_0x10a742[_0xec42('0x1a1')];_0x27a07d=_0x10a742[_0xec42('0xd9')];hopperUtils[_0xec42('0xcc')](_0x25380b)[_0xec42('0xa1')](loggerCatch(_0xec42('0x1ba')));if(_0xfe68a0[_0xec42('0x195')](_0x5b2938[_0xec42('0xc9')],_0x593923,_0x10a742)&&!_0xcbad64){if(_0x25380b[_0xec42('0x124')]+_0x25380b[_0xec42('0x125')]+_0x25380b[_0xec42('0x126')]+_0x25380b['countnosuchnumberretry']+_0x25380b['countdropretry']+_0x25380b[_0xec42('0xed')]+_0x25380b[_0xec42('0x121')]+_0x25380b[_0xec42('0x133')]>=_0x10a742[_0xec42('0x128')]){_0xfe68a0[_0xec42('0x134')](_0x25380b,_0x3fd880,_0xb9458,_0x5b2938['reason']);}else{_0xfe68a0[_0xec42('0x12b')](_0x25380b,_0x3fd880,_0xb9458,_0x5b2938['reason']);}}}})['then'](function(){if(_0xcbad64){hopperUtils[_0xec42('0xe5')](_0x25380b,_0x1b0dfa,_0x27a07d)['then'](function(){return _0x3fd880(0x1);});}});});};Dialer[_0xec42('0x1a')][_0xec42('0x134')]=function(_0x242749,_0x34d641,_0x1262a1,_0x246603){var _0x5f3618=new Final(_0x242749);_0x5f3618['state']=0xf;_0x5f3618['statedesc']=_0xec42('0x1bb');this[_0xec42('0x12b')](_0x5f3618,_0x34d641,_0x1262a1,_0x246603);};Dialer[_0xec42('0x1a')][_0xec42('0x12b')]=function(_0x75ae3c,_0x437b97,_0x3a0025,_0x2abc9b){hopperUtils[_0xec42('0xce')](_0x75ae3c)[_0xec42('0x3f')](function(){return _0x437b97(msgResponse(_0xec42('0x1a3'),_0xec42('0x1bc'),_0x2abc9b));})[_0xec42('0xa1')](function(){return _0x3a0025(msgResponse(_0xec42('0x1bd'),_0xec42('0x95'),_0xec42('0x1be')));});};Dialer['prototype'][_0xec42('0xb')]=function(_0x51b871){var _0x2016c9=_0x51b871[_0xec42('0x1bf')]/0x64;var _0x4c0509=_0x51b871[_0xec42('0x1c0')]/(_0x51b871[_0xec42('0x1c0')]+_0x51b871[_0xec42('0xc8')]);var _0x3445d3=Math[_0xec42('0x1c1')](_0x51b871[_0xec42('0x1c2')]*(_0x51b871[_0xec42('0x1c3')]/0x64));var _0xacad=Math[_0xec42('0x1c1')](_0x51b871[_0xec42('0x1c2')]*(_0x51b871['predictiveIntervalMinThreshold']/0x64));var _0x2d4c6e=_0x51b871[_0xec42('0x140')]+_0x51b871[_0xec42('0x142')];var _0x7f0681=Math[_0xec42('0x1c4')](_0x51b871[_0xec42('0x5b')]*_0x51b871[_0xec42('0x5f')]*_0x51b871[_0xec42('0x1c5')]*_0x51b871[_0xec42('0x1c6')]);if(_[_0xec42('0x54')](_0x51b871['startProgressive'])){if(!_[_0xec42('0x54')](_0x51b871['startPredictive'])){_0x51b871[_0xec42('0x28')]=undefined;loggerPredictive['error']('[startMethodPredictive][StartProgressive]',_0xec42('0x1c7'));}if(!_[_0xec42('0x54')](_0x51b871[_0xec42('0x64')])){loggerPredictive['error'](_0xec42('0x1c8'),_0xec42('0x1c9'));clearInterval(_0x51b871[_0xec42('0x64')]);_0x51b871[_0xec42('0x64')]=undefined;}_0x51b871[_0xec42('0x29')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0xec42('0x4a')](_0x51b871['name'],_0xec42('0x1ca'),_0x51b871['startProgressive']);this[_0xec42('0xb5')](_0x51b871,0x1);}else if(ifInterval(_0x51b871[_0xec42('0x1cb')],_0x51b871['startProgressive'])){this[_0xec42('0xb5')](_0x51b871,0x1);loggerPredictiveCalls[_0xec42('0x4a')]('[startMethodPredictive][StartProgressive][Loop]',_0x51b871[_0xec42('0x29')],_0x51b871[_0xec42('0x47')]);_0x51b871[_0xec42('0x5b')]=0x0;_0x51b871['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x2016c9<_0x4c0509&&_0x51b871[_0xec42('0x1cc')]==='dropRate'){clearPredictiveAttributes(_0x51b871);loggerPredictive[_0xec42('0x4a')](_0xec42('0x1cd'),_0xec42('0x1ce'),_0x4c0509,'startProgressive',_0x51b871[_0xec42('0x47')]);}else if(_0x7f0681<_0x51b871[_0xec42('0xd4')]&&_0x51b871[_0xec42('0x1cc')]===_0xec42('0x1cf')){clearPredictiveAttributes(_0x51b871);loggerPredictive[_0xec42('0x4a')]('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]',_0xec42('0x1d0'),_0x7f0681,_0xec42('0x1d1'),_0x51b871[_0xec42('0xd4')],_0xec42('0x29'),_0x51b871[_0xec42('0x47')]);}else if(!ifInterval(_0x51b871[_0xec42('0x1cb')],_0x51b871[_0xec42('0x29')])&&_[_0xec42('0x54')](_0x51b871['startPredictive'])&&!_[_0xec42('0x54')](_0x51b871[_0xec42('0x29')])){_0x51b871[_0xec42('0x28')]=moment()['format'](_0xec42('0xc7'));loggerPredictive['info'](_0x51b871[_0xec42('0x47')],_0xec42('0x1d2'),_0x51b871[_0xec42('0x28')]);hopperUtils['avgHandleTime'](_0x51b871[_0xec42('0x1cb')])[_0xec42('0x3f')](this[_0xec42('0x1d3')](_0x51b871))[_0xec42('0x3f')](mergeDataErlangB(_0x51b871))[_0xec42('0x3f')](this[_0xec42('0x1d4')](_0x51b871))[_0xec42('0xa1')](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x51b871));}else if(!ifInterval(_0x51b871['dialPredictiveInterval'],_0x51b871[_0xec42('0x28')])){_0x51b871['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x51b871['startPredictive']=moment()[_0xec42('0x87')](_0xec42('0xc7'));loggerPredictive[_0xec42('0x4a')](_0x51b871[_0xec42('0x47')],_0xec42('0x1d5'),_0x51b871['startPredictive']);clearInterval(_0x51b871[_0xec42('0x64')]);_0x51b871[_0xec42('0x64')]=undefined;hopperUtils['avgHandleTime'](_0x51b871[_0xec42('0x1cb')])[_0xec42('0x3f')](this[_0xec42('0x1d3')](_0x51b871))[_0xec42('0x3f')](mergeDataErlangB(_0x51b871))[_0xec42('0x3f')](this[_0xec42('0x1d4')](_0x51b871))[_0xec42('0xa1')](loggerCatchPredictive(_0xec42('0x1d6'),_0x51b871));}else if(_0x51b871[_0xec42('0x1c2')]&&_0x2d4c6e<_0x51b871['predictiveIntervalAvailable']-_0xacad){clearPredictiveAttributes(_0x51b871);loggerPredictive['info'](_0x51b871[_0xec42('0x47')],_0xec42('0x1d7'),_0x2d4c6e,')\x20are\x20less\x20than\x20threshold\x20(',_0x51b871[_0xec42('0x1c2')],'-',_0xacad,'=',_0x51b871[_0xec42('0x1c2')]-_0xacad,')');}else if(_0x51b871[_0xec42('0x1c2')]&&_0x2d4c6e>_0x51b871[_0xec42('0x1c2')]+_0x3445d3){clearPredictiveAttributes(_0x51b871);loggerPredictive[_0xec42('0x4a')](_0x51b871[_0xec42('0x47')],_0xec42('0x1d7'),_0x2d4c6e,')\x20are\x20more\x20than\x20threshold\x20(',_0x51b871[_0xec42('0x1c2')],'+',_0x3445d3,'=',_0x51b871[_0xec42('0x1c2')]+_0x3445d3,')');}};Dialer[_0xec42('0x1a')][_0xec42('0x1d3')]=function(_0xf9b6fe){var _0xc72d36=this;return function(_0x92a096){return new Promise(function(_0x3e6209,_0x17e04e){_[_0xec42('0xfc')](_0xf9b6fe,_0x92a096[0x0]);if(checkGetDataPredictive(_0x92a096[0x0])){var _0x52aec2=_0xf9b6fe[_0xec42('0x1c2')]=_0xf9b6fe[_0xec42('0x142')]+_0xf9b6fe[_0xec42('0x140')];var _0x1990df=_0xf9b6fe[_0xec42('0x1cb')]*0x3c;var _0x29ef9a=_0x92a096[0x0][_0xec42('0x52')]+_0x92a096[0x0][_0xec42('0x1d8')];var _0x43b5e9=(_0x92a096[0x0][_0xec42('0x1d9')]+_0x92a096[0x0][_0xec42('0x4f')]+_0x92a096[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x92a096[0x0][_0xec42('0x4d')];_0xf9b6fe[_0xec42('0x1c5')]=_0x43b5e9>0x0?_0x43b5e9:0x1;switch(_0xf9b6fe['dialPredictiveOptimization']){case _0xec42('0x1cf'):var _0x4e85fa=_0xf9b6fe['dialPredictiveOptimizationPercentage']/0x64;return _0xc72d36['abandonmentRate'](_0x52aec2,_0x1990df,_0x29ef9a,_0x43b5e9,_0x4e85fa)[_0xec42('0x3f')](function(_0x23a974){return _0x3e6209(_0x23a974);});case _0xec42('0x1da'):var _0x24da28=_0xf9b6fe['dialPredictiveOptimizationPercentage']/0x64;return _0xc72d36['busyFactor'](_0x52aec2,_0x1990df,_0x29ef9a,_0x43b5e9,_0x24da28)[_0xec42('0x3f')](function(_0x54ea1f){return _0x3e6209(_0x54ea1f);});default:return _0x17e04e(msgResponse(_0xec42('0x1db'),_0xec42('0x95'),_0xec42('0x1dc')));}}else{return _0x17e04e(msgResponse(_0xec42('0x1db'),'Failure',_0xec42('0x1dd')));}});};};Dialer[_0xec42('0x1a')]['getDataPredictiveOld']=function(_0x38f85d){var _0x1d358b=this;return function(_0x160387){return new Promise(function(_0x119889,_0x3e4e67){_[_0xec42('0xfc')](_0x38f85d,_0x160387[0x0]);if(checkGetDataPredictive(_0x160387[0x0])){loggerPredictive[_0xec42('0x4a')](JSON['stringify'](_0x160387[0x0]));if(_0x38f85d[_0xec42('0x1cc')]===_0xec42('0x1cf')){return _0x1d358b[_0xec42('0x156')](_0x38f85d['id'])['then'](function(_0x566e7d){var _0x3e4d17=_0x38f85d[_0xec42('0x1de')]-_0x566e7d[0x0][_0xec42('0x1df')];var _0x579ab6=_0x38f85d['dialPredictiveInterval']*0x3c;var _0x5caa78=_0x160387[0x0]['predictiveIntervalAvgTalktime']+_0x160387[0x0]['predictiveIntervalAvgHoldtime'];var _0x26c8c6=(_0x160387[0x0]['predictiveIntervalAnsweredCalls']+_0x160387[0x0][_0xec42('0x4f')]+_0x160387[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x160387[0x0][_0xec42('0x4d')];var _0x377305=_0x38f85d[_0xec42('0x1bf')]/0x64;_0x38f85d['predictiveIntervalPauses']=_0x566e7d[0x0][_0xec42('0x1df')]||0x0;_0x38f85d[_0xec42('0x1c5')]=_0x26c8c6>0x0?_0x26c8c6:0x1;return _0x1d358b['abandonmentRate'](_0x3e4d17,_0x579ab6,_0x5caa78,_0x26c8c6,_0x377305);})[_0xec42('0x3f')](function(_0x13a0d1){return _0x119889(_0x13a0d1);})[_0xec42('0xa1')](function(_0x500d75){return _0x3e4e67(msgResponse(_0xec42('0x1e0'),'Failure',JSON[_0xec42('0x74')](_0x500d75)));});}if(_0x38f85d[_0xec42('0x1cc')]===_0xec42('0x1da')){return _0x1d358b[_0xec42('0x156')](_0x38f85d['id'])[_0xec42('0x3f')](function(_0x282fca){var _0x1e2554=_0x38f85d[_0xec42('0x1de')]-_0x282fca[0x0][_0xec42('0x1df')];var _0xf2c954=_0x38f85d[_0xec42('0x1cb')]*0x3c;var _0x2b7d9f=_0x160387[0x0][_0xec42('0x52')]+_0x160387[0x0][_0xec42('0x1d8')];var _0x188dbb=(_0x160387[0x0][_0xec42('0x1d9')]+_0x160387[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x160387[0x0][_0xec42('0xe6')])/_0x160387[0x0][_0xec42('0x4d')];var _0x1272b3=_0x38f85d[_0xec42('0x1bf')]/0x64;_0x38f85d['predictiveIntervalPauses']=_0x282fca[0x0][_0xec42('0x1df')]||0x0;_0x38f85d[_0xec42('0x1c5')]=_0x188dbb>0x0?_0x188dbb:0x1;return _0x1d358b['busyFactor'](_0x1e2554,_0xf2c954,_0x2b7d9f,_0x188dbb,_0x1272b3);})[_0xec42('0x3f')](function(_0xfb6077){return _0x119889(_0xfb6077);})[_0xec42('0xa1')](function(_0x528ff8){return _0x3e4e67(msgResponse(_0xec42('0x1e0'),_0xec42('0x95'),JSON[_0xec42('0x74')](_0x528ff8)));});}}else{return _0x3e4e67(msgResponse(_0xec42('0x1db'),_0xec42('0x95'),_0xec42('0x1dd')));}});};};Dialer[_0xec42('0x1a')][_0xec42('0x1d4')]=function(_0x244129){var _0x2fc90f=this;return function(){var _0x50caa1=0x0;var _0x759870=Math[_0xec42('0x1c4')](_0x244129[_0xec42('0x5d')]*0x3e8);if(_0x759870>0x0){_0x759870=_0x759870<0x64?0x64:_0x759870;loggerPredictive[_0xec42('0x4a')](_0x244129[_0xec42('0x47')],_0xec42('0x1e1'),_0x759870,_0xec42('0x1e2'));_0x244129[_0xec42('0x64')]=setInterval(function(){_0x2fc90f[_0xec42('0x64')](_0x244129);loggerPredictiveCalls[_0xec42('0x4a')](_0xec42('0x1e3'),_0x50caa1+=0x1);},_0x759870);}else{loggerPredictive[_0xec42('0x4a')](_0x244129['name'],'fail\x20to\x20scheduled\x20calls');}};};Dialer[_0xec42('0x1a')][_0xec42('0x1e4')]=function(_0x489641,_0x2e2514){var _0x510bb6=this;return function(_0x4a2538){if(_[_0xec42('0x49')](_0x4a2538)){if(_['isNil'](_0x2e2514['UserId'])||!_0x2e2514['recallme']){if(_0x489641[_0xec42('0xb2')]===_0xec42('0xa')){_0x489641[_0xec42('0x73')]=_[_0xec42('0x54')](_0x489641[_0xec42('0x73')])?!![]:_0x489641[_0xec42('0x73')];var _0x24ba55=uuid['v4']();_0x510bb6[_0xec42('0x25')][_0x24ba55]=new Action(_0x489641,_0x2e2514,_0x24ba55);loggerBooked[_0xec42('0x4a')](_0xec42('0x1e5'),_0x24ba55,_0xec42('0x1e6'),JSON[_0xec42('0x74')](_0x489641['queueStatusComplete']),_0xec42('0x1e7'),_0x489641['name']);if(_0x489641[_0xec42('0x73')]){_0x489641[_0xec42('0x73')]=![];_0x510bb6['queueBooked'][_0x510bb6[_0xec42('0x25')][_0x24ba55][_0xec42('0xc5')]]=[];ami['Action']({'actionid':_0x24ba55,'action':'queuestatus','queue':_0x489641[_0xec42('0x47')]})[_0xec42('0xa1')](function(){_0x510bb6[_0xec42('0xc4')](_0x489641);hopperUtils['rescheduleContact']({'active':![],'ContactId':_0x510bb6[_0xec42('0x25')][_0x24ba55][_0xec42('0xdf')],'ListId':_0x510bb6['actions'][_0x24ba55][_0xec42('0xf1')],'VoiceQueueId':_0x510bb6[_0xec42('0x25')][_0x24ba55][_0xec42('0xe0')]||undefined,'CampaignId':_0x510bb6[_0xec42('0x25')][_0x24ba55][_0xec42('0xe1')]||undefined})[_0xec42('0xa1')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x510bb6[_0xec42('0x25')][_0x24ba55];});}else{loggerBooked[_0xec42('0x4a')](_0xec42('0x1e8'),JSON[_0xec42('0x74')](_0x489641[_0xec42('0x73')]),'Queue:\x20',_0x489641[_0xec42('0x47')]);_0x510bb6[_0xec42('0xc4')](_0x489641);hopperUtils[_0xec42('0xdc')]({'active':![],'ContactId':_0x510bb6['actions'][_0x24ba55][_0xec42('0xdf')],'ListId':_0x510bb6[_0xec42('0x25')][_0x24ba55][_0xec42('0xf1')],'VoiceQueueId':_0x510bb6['actions'][_0x24ba55][_0xec42('0xe0')]||undefined,'CampaignId':_0x510bb6[_0xec42('0x25')][_0x24ba55][_0xec42('0xe1')]||undefined})[_0xec42('0xa1')](loggerCatch(_0xec42('0x1e9')));delete _0x510bb6[_0xec42('0x25')][_0x24ba55];}}else{return _0x510bb6['actionOriginate'](_0x489641,_0x2e2514);}}else{if(utils['getSeconds'](undefined,_0x2e2514[_0xec42('0x1ea')])<_0x489641[_0xec42('0x1eb')]*0x3c){if(_0x2e2514[_0xec42('0x14d')]&&!_0x2e2514[_0xec42('0x14d')]['voicePause']){_0x510bb6[_0xec42('0x1e')][_0xec42('0xff')](_0x2e2514['id'])[_0xec42('0x1c')](function(){_0x510bb6[_0xec42('0xc4')](_0x489641);});}else{hopperUtils['unlockContact']({'active':![]},_0x2e2514['id'],0x1)[_0xec42('0x1c')](function(){_0x510bb6[_0xec42('0xc4')](_0x489641);});}}else{_0x489641[_0xec42('0x1ec')]+=0x1;_0x510bb6[_0xec42('0xc4')](_0x489641);if(_0x489641['dialRecallInQueue']){hopperUtils[_0xec42('0xdc')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x2e2514[_0xec42('0xdf')],'ListId':_0x2e2514[_0xec42('0xf1')],'VoiceQueueId':_0x2e2514[_0xec42('0xe0')]||undefined,'CampaignId':_0x2e2514[_0xec42('0xe1')]||undefined})[_0xec42('0xa1')](loggerCatch('[rescheduleContact][dialRecallInQueue]'));hopperUtils[_0xec42('0xcc')](createObjHistory(_0x489641,_0x2e2514,utils['CAMPAIGN_STATUS'][_0xec42('0x1ed')],0x17,_0xec42('0x1ee')))['catch'](loggerCatch(_0xec42('0x1ef')));}else{_0x510bb6['saveInDb'](createObjHistory(_0x489641,_0x2e2514,utils[_0xec42('0x68')][_0xec42('0x1f0')],0x16,_0xec42('0x1f1')),_0xec42('0x1f2'),_0xec42('0x1f3'));}}}}else{_0x489641['outboundBlacklistCallsDay']+=0x1;_0x510bb6[_0xec42('0x15d')](createObjHistory(_0x489641,_0x2e2514,utils[_0xec42('0x68')]['BLACKLIST'],0xd,'Blacklist'),_0xec42('0x1f4'),_0xec42('0x1f5'));throw _0xec42('0x1f6');}};};Dialer[_0xec42('0x1a')][_0xec42('0x1f7')]=function(_0x523aa2){var _0x2606a6=this;var _0xc8faf5=_0x523aa2[_0xec42('0x1f8')]-_0x523aa2[_0xec42('0x7e')];emitCampaignSummary(_0x523aa2);if(_0xc8faf5>0x0&&_0x523aa2[_0xec42('0x67')]==0x0){if(_0xc8faf5>this[_0xec42('0x23')]){_0xc8faf5=this[_0xec42('0x23')];}_0x523aa2[_0xec42('0x67')]=0x1;hopperUtils[_0xec42('0x1f9')](_0x523aa2,_0xc8faf5)[_0xec42('0x3f')](function(_0x58ee5f){_0x523aa2[_0xec42('0x67')]=0x0;if(_0x58ee5f){if(!utils[_0xec42('0x1fa')](_0x58ee5f)){_0x523aa2['message']=utils['CAMPAIGN_STATUS'][_0xec42('0x6d')];logger[_0xec42('0x4a')](_0xec42('0x1fb')+_0x523aa2[_0xec42('0x47')]);}else{_0x523aa2[_0xec42('0x7e')]+=_0x58ee5f[_0xec42('0x99')];_0x523aa2[_0xec42('0x6c')]=utils[_0xec42('0x68')][_0xec42('0x1fc')];for(var _0x16f07a=0x0;_0x16f07a<_0x58ee5f[_0xec42('0x99')];_0x16f07a+=0x1){_0x523aa2['ivrTotalCallsDays']+=0x1;if(_[_0xec42('0xfb')](_0x58ee5f[_0x16f07a])||_['isNil'](_0x58ee5f[_0x16f07a]['Contact'])||_[_0xec42('0xfb')](_0x58ee5f[_0x16f07a][_0xec42('0x164')])){_0x2606a6[_0xec42('0x15b')]('[actionOriginate]\x20',_0x523aa2,_0x58ee5f[_0x16f07a]);}else{hopperUtils['checkIsBlackListIvr'](_[_0xec42('0x75')](_0x58ee5f[_0x16f07a],[_0xec42('0xe1'),_0xec42('0x164')]))[_0xec42('0x3f')](_0x2606a6['checkContactBlack'](_0x523aa2,_0x58ee5f[_0x16f07a]))['catch'](_0x2606a6[_0xec42('0x15a')]('[actionOriginateIvr]\x20',_0x523aa2));}}}}})[_0xec42('0xa1')](loggerGetContactDialer(_0xec42('0x1fd'),_0x523aa2,_0xc8faf5));}};Dialer[_0xec42('0x1a')]['handlePower']=function(_0x3b341b,_0x57154b){var _0x48d34b=this;var _0x1821ed=[];if(_0x57154b<0x1||_0x3b341b[_0xec42('0xb2')]==='booked'){_0x57154b=0x1;}var _0x15d36e=Math[_0xec42('0x1c4')](_0x3b341b[_0xec42('0x140')]*_0x57154b)-_0x3b341b[_0xec42('0x7e')];if(_0x3b341b[_0xec42('0x1fe')]>0x0){var _0xe5ca2b=_0x3b341b['dialLimitQueue']-_0x3b341b[_0xec42('0x7e')]-_0x3b341b['talking']-_0x3b341b[_0xec42('0x1ff')];if(_0x15d36e>_0xe5ca2b){_0x15d36e=_0xe5ca2b;}}if(_0x15d36e>0x0&&_0x3b341b['temp']==0x0){if(_0x3b341b[_0xec42('0xb2')]===_0xec42('0xa')){_0x15d36e=0x1;}if(_0x15d36e>this[_0xec42('0x23')]){_0x15d36e=this['maxNumberOriginate'];}for(var _0x384224 in this[_0xec42('0x21')]){if(typeof this[_0xec42('0x21')][_0x384224]!=='undefined'){if(this[_0xec42('0x21')][_0x384224][_0xec42('0x6f')]===_0xec42('0x200')&&this[_0xec42('0x21')][_0x384224]['status']==='reachable'){_0x1821ed[_0xec42('0x9a')](this[_0xec42('0x21')][_0x384224]['id']);}}}_0x3b341b['temp']=0x1;hopperUtils[_0xec42('0x201')](_0x3b341b,_0x1821ed,_0x15d36e)['then'](function(_0x4f3730){_0x3b341b[_0xec42('0x67')]=0x0;if(_0x4f3730){if(!utils[_0xec42('0x1fa')](_0x4f3730)){hopperUtils[_0xec42('0x202')](_0x3b341b)['then'](sendMessageReschedule(_0x3b341b))['catch'](loggerCatch(_0xec42('0x203')));}else{_0x3b341b[_0xec42('0x7e')]+=_0x4f3730[_0xec42('0x99')];_0x3b341b[_0xec42('0x6c')]=_0x3b341b[_0xec42('0xb2')]===_0xec42('0xa')?utils[_0xec42('0x68')][_0xec42('0x143')]:utils[_0xec42('0x68')]['RUNNING'];for(var _0x33bec0=0x0;_0x33bec0<_0x4f3730[_0xec42('0x99')];_0x33bec0+=0x1){if(_['isNil'](_0x4f3730[_0x33bec0])||_[_0xec42('0xfb')](_0x4f3730[_0x33bec0][_0xec42('0x17c')])||_[_0xec42('0xfb')](_0x4f3730[_0x33bec0][_0xec42('0x164')])){_0x48d34b['emptyContact'](_0xec42('0x204'),_0x3b341b,_0x4f3730[_0x33bec0]);}else{hopperUtils[_0xec42('0x205')](_['pick'](_0x4f3730[_0x33bec0],[_0xec42('0xe0'),'phone']))[_0xec42('0x3f')](_0x48d34b[_0xec42('0x1e4')](_0x3b341b,_0x4f3730[_0x33bec0]))['catch'](_0x48d34b['loggerHandler'](_0xec42('0x204'),_0x3b341b));}}}}})[_0xec42('0xa1')](loggerGetContactDialer(_0xec42('0x206'),_0x3b341b,_0x15d36e));}};Dialer['prototype'][_0xec42('0x64')]=function(_0x4f7fb7){if(_0x4f7fb7[_0xec42('0x1fe')]>0x0){var _0x3f110d=_0x4f7fb7[_0xec42('0x1fe')]-_0x4f7fb7[_0xec42('0x7e')]-_0x4f7fb7[_0xec42('0x142')];if(_0x3f110d>0x0&&_0x4f7fb7[_0xec42('0x67')]==0x0){this['tryOriginatePredictive'](_0x4f7fb7);}else{loggerPredictiveCalls[_0xec42('0x4a')]('[handlePredictive][limitChannel]');}}else{this[_0xec42('0x207')](_0x4f7fb7);}};Dialer[_0xec42('0x1a')]['tryOriginatePredictive']=function(_0x1bc380){var _0x54b20a=this;var _0x2b2106=[];_0x1bc380['originated']+=0x1;for(var _0x18cdcb in this[_0xec42('0x21')]){if(typeof this[_0xec42('0x21')][_0x18cdcb]!==_0xec42('0x158')){if(this['agents'][_0x18cdcb]['state']===_0xec42('0x200')&&this[_0xec42('0x21')][_0x18cdcb][_0xec42('0x89')]===_0xec42('0x8a')){_0x2b2106[_0xec42('0x9a')](this[_0xec42('0x21')][_0x18cdcb]['id']);}}}_0x1bc380[_0xec42('0x67')]=0x1;return this['getContactDialer'](_0x1bc380['id'],_0x2b2106,0x1,_0x1bc380[_0xec42('0x208')],_0x1bc380)[_0xec42('0x3f')](function(_0x2682f0){_0x1bc380[_0xec42('0x67')]=0x1;if(_0x2682f0){if(!utils[_0xec42('0x1fa')](_0x2682f0)){utils[_0xec42('0x66')](_0x1bc380,0x1,0x0);return hopperUtils['countReScheduled'](_0x1bc380)['then'](sendMessageReschedule(_0x1bc380))['catch'](loggerCatch('[countReScheduled]\x20'));}else{_0x1bc380[_0xec42('0x6c')]=utils['CAMPAIGN_STATUS'][_0xec42('0x1fc')];if(_[_0xec42('0xfb')](_0x2682f0[0x0])||_[_0xec42('0xfb')](_0x2682f0[0x0][_0xec42('0x17c')])||_['isNil'](_0x2682f0[0x0][_0xec42('0x164')])){_0x54b20a[_0xec42('0x15b')](_0xec42('0x204'),_0x1bc380,_0x2682f0[0x0]);}else{return hopperUtils[_0xec42('0x205')](_[_0xec42('0x75')](_0x2682f0[0x0],[_0xec42('0xe0'),_0xec42('0x164')]))['then'](_0x54b20a['checkContactBlack'](_0x1bc380,_0x2682f0[0x0]))[_0xec42('0xa1')](_0x54b20a[_0xec42('0x15a')](_0xec42('0x209'),_0x1bc380));}}}})[_0xec42('0xa1')](loggerGetContactDialer(_0xec42('0x20a'),_0x1bc380,0x1));};Dialer[_0xec42('0x1a')][_0xec42('0x20b')]=function(_0xe7d925,_0x5cb8ce,_0x73e591,_0x589699,_0x12cb5a,_0x744818){loggerPredictive[_0xec42('0x4a')](_0xec42('0x20c'));loggerPredictive[_0xec42('0x4a')](_0xec42('0x20d'),_0xe7d925);loggerPredictive['info'](_0xec42('0x20e'),_0x5cb8ce);loggerPredictive[_0xec42('0x4a')](_0xec42('0x20f'),_0x73e591);loggerPredictive[_0xec42('0x4a')](_0xec42('0x210'),_0x589699);loggerPredictive[_0xec42('0x4a')](_0xec42('0x211'),_0x12cb5a);loggerPredictive[_0xec42('0x4a')](_0xec42('0x53'));return new Promise(function(_0x18181b,_0x29f040){if(_0xe7d925<=0x0||isNaN(_0xe7d925)){return _0x29f040(msgResponse(_0xec42('0x212'),_0xec42('0x193'),_0xec42('0x213')+_0xe7d925));}if(_0x73e591<=0x0||isNaN(_0x73e591)){return _0x29f040(msgResponse(_0xec42('0x212'),'Error',_0xec42('0x214')+_0x73e591));}if(_0x589699<=0x0||isNaN(_0x589699)){return _0x29f040(msgResponse(_0xec42('0x212'),_0xec42('0x193'),_0xec42('0x215')+_0x589699));}if(_0x5cb8ce<=0x0||isNaN(_0x5cb8ce)){return _0x29f040(msgResponse(_0xec42('0x212'),'Error','interval\x20=\x20'+_0x5cb8ce));}if(_0x12cb5a<=0x0||isNaN(_0x12cb5a)){return _0x29f040(msgResponse(_0xec42('0x212'),_0xec42('0x193'),_0xec42('0x216')+_0x12cb5a));}_0x744818=_0x744818||0x0;var _0xea4363=0x1/_0x73e591;var _0x4ff06f=0x0;var _0x5c8bfa=0x0;var _0x23d040=0x0;var _0x2662b2=0x0;for(var _0x27ccee=0x0;_0x23d040<_0x12cb5a;_0x27ccee+=0x1){_0x5c8bfa=_0x27ccee/_0x5cb8ce;_0x4ff06f=(_0x589699*_0x5c8bfa+_0x744818)/_0xea4363;_0x23d040=utils['erlangb'](_0x4ff06f,_0xe7d925);_0x2662b2=_0x4ff06f/_0xe7d925*(0x1-utils[_0xec42('0x217')](_0x4ff06f,_0xe7d925));}return _0x18181b({'erlangCalls':_0x27ccee,'erlangCallToSecond':_0x5cb8ce/_0x27ccee,'erlangAbandonmentRate':_0x23d040,'erlangBusyFactor':_0x2662b2});});};Dialer[_0xec42('0x1a')][_0xec42('0x218')]=function(_0xd4cf00,_0x202dd0,_0x516280,_0x481a4a,_0x1e1ac6,_0x249913){loggerPredictive['info']('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive[_0xec42('0x4a')](_0xec42('0x20d'),_0xd4cf00);loggerPredictive[_0xec42('0x4a')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x202dd0);loggerPredictive[_0xec42('0x4a')](_0xec42('0x20f'),_0x516280);loggerPredictive['info'](_0xec42('0x210'),_0x481a4a);loggerPredictive[_0xec42('0x4a')](_0xec42('0x219'),_0x1e1ac6);loggerPredictive[_0xec42('0x4a')](_0xec42('0x53'));return new Promise(function(_0xda026a,_0x4fa600){if(_0xd4cf00<=0x0||isNaN(_0xd4cf00)){return _0x4fa600(msgResponse('[busyFactor]',_0xec42('0x193'),_0xec42('0x213')+_0xd4cf00));}if(_0x516280<=0x0||isNaN(_0x516280)){return _0x4fa600(msgResponse('[busyFactor]',_0xec42('0x193'),_0xec42('0x214')+_0x516280));}if(_0x481a4a<=0x0||isNaN(_0x481a4a)){return _0x4fa600(msgResponse(_0xec42('0x21a'),'Error',_0xec42('0x215')+_0x481a4a));}if(_0x202dd0<=0x0||isNaN(_0x202dd0)){return _0x4fa600(msgResponse(_0xec42('0x21a'),_0xec42('0x193'),_0xec42('0x21b')+_0x202dd0));}if(_0x1e1ac6<=0x0||isNaN(_0x1e1ac6)){return _0x4fa600(msgResponse(_0xec42('0x21a'),'Error',_0xec42('0x21c')+_0x1e1ac6));}_0x249913=_0x249913||0x0;var _0x7625cd=0x1/_0x516280;var _0x260848=0x0;var _0x5cec8=0x0;var _0x5c186a=0x0;var _0x3db761=0x0;for(var _0x510fdb=0x0;_0x3db761<_0x1e1ac6;_0x510fdb+=0x1){_0x5cec8=_0x510fdb/_0x202dd0;_0x260848=(_0x481a4a*_0x5cec8+_0x249913)/_0x7625cd;_0x5c186a=utils[_0xec42('0x217')](_0x260848,_0xd4cf00);_0x3db761=_0x260848/_0xd4cf00*(0x1-utils[_0xec42('0x217')](_0x260848,_0xd4cf00));}return _0xda026a({'erlangCalls':_0x510fdb,'erlangCallToSecond':_0x202dd0/_0x510fdb,'erlangAbandonmentRate':_0x5c186a,'erlangBusyFactor':_0x3db761});});};module['exports']=Dialer; \ No newline at end of file +var _0xd875=['setXMDContactVariables','Contact','getCallerId','callerid','getCallerIdRandom','dialOriginateCallerIdNumber','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','extractCalleridName','XMD-ORIGINATECALLERIDNUM','variables','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','from-sip','dialOriginateTimeout','[originate][error]','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','object','entity\x20is\x20undefine','[callProgressDetecting]','outboundNoSuchCallsDay','custom:agentnosuchnumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','buildNoAnswerEventPayload','custom:agentnoanswer','checkRetriveMax','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','AgentReject','custom:agentreject','[syncAgentComplete][createHistory][20]','dialAgentRejectMaxRetry','reason\x2020\x20agentreject','Global','Success','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','outboundDropCallsDayTimeout','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','erlangCalls','erlangAbandonmentRate','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','avgHandleTime','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','talking','predictiveIntervalHitRate','dialPredictiveOptimization','abandonmentRate','agentBusyFactor','Unknown\x20Predictive','[getDataPredictive]','check\x20failure','getDataPredictiveOld','loggedIn','outboundQueuePauses','[CatchErlangB]','predictiveIntervalPauses','one\x20call\x20every:','milliseconds','checkContactBlack','recallme','queueStatusComplete','[booked][checkContactBlack]','queueStatusComplete:\x20','queuestatus','[booked][checkContactBlack][else]','Queue:\x20','[unlockOriginate][syncQueueStatusComplete]','scheduledat','dialRecallMeTimeout','voicePause','unlockContact','outboundReCallsDay','dialRecallInQueue','QUEUE_RECALL','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','BLACKLIST','Blacklist','[Originate][MoveBlacklist]','inBlackList','handleIvr','getContactDialerIvr','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','emptyContact','[actionOriginate]\x20','checkIsBlackListIvr','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','getContactDialer','countReScheduled','[countReScheduled]\x20','checkIsBlackList','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','checkContactEmpty','[actionOriginatePredictive]\x20','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','erlangb','busyFactor','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Ts\x20=\x20','Umin\x20=\x20','exports','util','lodash','uuid','ioredis','./utils','./utils/hopper','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictive','predictiveCalls','syncQueueSummary','redis','defaults','localhost','socket.io-emitter','../rpc/voiceQueueRt','../rpc/setting','../rpc/interval','./models/agentComplete','./models/queueCallerAbandon','./models/hangup','env','XCALLY_IP_AGI','127.0.0.1','prototype','enqueue','tail','finally','sequence','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','uniqueId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','queuesSummary','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','syncAgentComplete','custom:queuesummary','custom:queuesummarycomplete','syncQueueSummaryComplete','hangup','syncHangup','newexten','syncNewExten','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','getSettings','previewRecallmeReminderInterval','isUndefined','emit','type','outbound','debug','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','format','name','voice_queue:save','isEmpty','info','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgHoldtime','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','merge','getSeconds','startPredictive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','error','stack','temp','inspect','contactsRescheduled','message','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','NO_AVAILABLE_CONTACTS','[getContactDialer2][Empty]','statedesc','endtime','starttime','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','pick','Interval','NULL_INTERVAL','Intervals','\x20INTERVAL_IS_NULL','isIVRCampaignActive','INACTIVE','\x20NOT\x20Active','isIVRCampaign','campaign:ivr:%s','campaign:save','originated','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','[ifTime][Action]','stringify','isTrunkReachable','active','SIP/%s','status','reachable','checkIsTrunkReachable','Trunk','TrunkBackup','TRUNK_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','checkIfTimeIntervals','ifTimeIvr','ifTime','Failure','\x20Intervals\x20is\x20null\x20','EMPTY_INTERVAL','UNKNOWN_TIMEZONE','\x20Timezone\x20unknow\x20','isArray','length','push','Action','iftime\x20%s,%s','timezones','then','content','indexOf','catch','command','true','some','OVERTIME_GLOBAL_INTERVAL','[ifTime][promiseAll]','\x20Interval\x20is\x20overtime:\x20','syncCampaigns','resolve','dialGlobalInterval','launchHandleIvr','[syncCampaigns]','checkDialMethod','dialMethod','progressive','power','dialPowerLevel','handlePower','method\x20not\x20recognized','silly','Dialer::ifTime()','intervalIftime','OVERTIME_INTERVAL','Global:\x20','Timezone:\x20','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','isGlobal','AMI\x20IfTime','Error','syncAgentConnect','queue','uniqueid','updateOriginated','answertime','ivr','outboundAnswerCallsDay','reason','agent','agiafterat','dialQueueProject2','YYYY-MM-DD\x20HH:mm:ss','moveContactManagedDialer','[syncAgentComplete]','droptime','responsetime','dialQueueTimeout','predictiveIntervalErlangCallsDroppedCalls','state','Drop','dropreason','TIMEOUT','countglobal','dialDropRetryFrequency','callAdditionalPhoneAfterMin','verifyAdditionalPhones','additional','queueCallerAbandonCreateState','rescheduleContact','countdropretry','add','minutes','ContactId','ListId','VoiceQueueId','[rescheduleContact][Drop]','calleridname','calleridnum','createHistory','[syncAgentComplete][createHistory][10]','swapAdditionalPhones','predictiveIntervalDroppedCallsCallersExit','outboundDropCallsDayCallersExit','CALLEREXIT','countabandonedretry','dialAbandonedRetryFrequency','voiceQueue','dialAbandonedMaxRetry','CampaignId','[rescheduleContact][Abandoned]','Abandoned','[syncAgentComplete][createHistory][11]','channel','actionid','strategy','rrmemory','roundrobin','isNil','locked','paused','stateinterface','idHopper','[unlock][syncQueueStatusComplete]','queueBookedRR','_rr','unlockRR','[booked][RR]','contactAgent-idHopper:\x20','preview','run','[Catch][Preview][syncQueueStatusComplete]','[booked][RR][finaly]','Agent:\x20','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','getQueue','response','callProgressDetecting','syncVarSet','amdstatus','xcally-motion-dialer','dialAMDActive','value','HANGUP','outboundAnswerAgiCallsDay','HangupInAMD','membername','AMD','custom:amd','buildObj','amd','saveInDb','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','Machine','countmachineretry','[syncAgentComplete][createHistory][0]','countbusyretry','countnoanswerretry','countagentrejectretry','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','[rescheduleContact][Machine]','[syncHangupInAMDIvr][createHistory]','MACHINE','countcongestionretry','countnosuchnumberretry','dialGlobalMaxRetry','stateGlobal','dialMachineRetryFrequency','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','outboundUnknownCallsDay','cause-txt','Unknow','running','isPreviewCampaign','statusMessage','getQueueCampaignStatusMessage','available','inUse','pTalking','[syncQueueSummary]','queueSummaryCountersUpdated','updateReportFromOutboundQueue','assign','throttle','dialPreviewRecallmeReminder','filter','online','map','Agent','user:%s','user:dialPreviewRecallReminder','checkPreviewRecallReminder','clearZombieChannels','[uniqueid]','No\x20such\x20channel','getVoiceQueueRtPauses','undefined','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','notFound','UserId','[emptyContact][createHistory]','[emptyContact]','[syncAgentComplete][createHistory]','[syncQueueCallerAbandon]\x20[Drop]','handlePreviewRecallNotifications','actionOriginate','originate','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','isOutboundQueue','dialAgiAfterHangupAgent','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-VOICEQUEUEID','XMD-CAMPAIGNID'];(function(_0x5b593a,_0xdc32aa){var _0x494058=function(_0x928b59){while(--_0x928b59){_0x5b593a['push'](_0x5b593a['shift']());}};_0x494058(++_0xdc32aa);}(_0xd875,0xac));var _0x5d87=function(_0x4e8dfc,_0x448b97){_0x4e8dfc=_0x4e8dfc-0x0;var _0x3c47e0=_0xd875[_0x4e8dfc];return _0x3c47e0;};'use strict';var util=require(_0x5d87('0x0'));var _=require(_0x5d87('0x1'));var uuid=require(_0x5d87('0x2'));var moment=require('moment');var rr=require('rr');var Redis=require(_0x5d87('0x3'));var utils=require(_0x5d87('0x4'));var hopperUtils=require(_0x5d87('0x5'));var ut=require(_0x5d87('0x6'));var config=require(_0x5d87('0x7'));var logger=require(_0x5d87('0x8'))(_0x5d87('0x9'));var loggerBooked=require(_0x5d87('0x8'))(_0x5d87('0xa'));var loggerPredictive=require(_0x5d87('0x8'))(_0x5d87('0xb'));var loggerPredictiveCalls=require('../../../config/logger')(_0x5d87('0xc'));var loggerSyncQueueSummary=require(_0x5d87('0x8'))(_0x5d87('0xd'));var ami=require('../ami');config[_0x5d87('0xe')]=_[_0x5d87('0xf')](config[_0x5d87('0xe')],{'host':_0x5d87('0x10'),'port':0x18eb});var io=require(_0x5d87('0x11'))(new Redis(config[_0x5d87('0xe')]));var cmHopper=require('../rpc/cmHopper');var voiceQueueRt=require(_0x5d87('0x12'));var RpcSetting=require(_0x5d87('0x13'));var Interval=require(_0x5d87('0x14'));var Action=require('./models/action');var History=require('./models/history');var Final=require('./models/final');var AgentComplete=require(_0x5d87('0x15'));var QueueCallerAbandon=require(_0x5d87('0x16'));var Hangup=require(_0x5d87('0x17'));var ipAgi=process[_0x5d87('0x18')][_0x5d87('0x19')]||_0x5d87('0x1a');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x5d87('0x1b')][_0x5d87('0x1c')]=function(_0x5445cc){this[_0x5d87('0x1d')]=this[_0x5d87('0x1d')]?this[_0x5d87('0x1d')][_0x5d87('0x1e')](_0x5445cc):_0x5445cc();};function Dialer(_0x1304cd,_0x492c93){this[_0x5d87('0x1f')]=new Sequence();this['preview']=_0x492c93;this[_0x5d87('0x20')]=_0x1304cd['voiceQueues'];this[_0x5d87('0x21')]=_0x1304cd[_0x5d87('0x21')];this[_0x5d87('0x22')]=_0x1304cd[_0x5d87('0x22')];this['trunks']=_0x1304cd[_0x5d87('0x23')];this[_0x5d87('0x24')]=config['maxNumberOriginate']||0x2;this[_0x5d87('0x25')]={};this[_0x5d87('0x26')]={};this['contactsId']={};this[_0x5d87('0x27')]={};this[_0x5d87('0x28')]={};this[_0x5d87('0x29')]={};this[_0x5d87('0x2a')]={};this[_0x5d87('0x2b')]={};this[_0x5d87('0x2c')]={};this['queueBookedRR']={};this[_0x5d87('0x2d')]={};ami['on']('agentconnect',this['syncAgentConnect'][_0x5d87('0x2e')](this));ami['on'](_0x5d87('0x2f'),this[_0x5d87('0x30')][_0x5d87('0x2e')](this));ami['on'](_0x5d87('0x31'),this[_0x5d87('0x32')][_0x5d87('0x2e')](this));ami['on']('agentcomplete',this[_0x5d87('0x33')][_0x5d87('0x2e')](this));ami['on'](_0x5d87('0x34'),this[_0x5d87('0xd')][_0x5d87('0x2e')](this));ami['on'](_0x5d87('0x35'),this[_0x5d87('0x36')][_0x5d87('0x2e')](this));ami['on'](_0x5d87('0x37'),this[_0x5d87('0x38')][_0x5d87('0x2e')](this));ami['on'](_0x5d87('0x39'),this[_0x5d87('0x3a')][_0x5d87('0x2e')](this));ami['on']('varset',this['syncVarSet']['bind'](this));ami['on']('queuemember',this[_0x5d87('0x3b')][_0x5d87('0x2e')](this));ami['on'](_0x5d87('0x3c'),this[_0x5d87('0x3d')][_0x5d87('0x2e')](this));this[_0x5d87('0x3e')]();this[_0x5d87('0x3f')]();RpcSetting[_0x5d87('0x40')]()['then'](function(_0x7c290f){previewRecallmeReminderInterval=_0x7c290f[_0x5d87('0x41')];});}function isNotNull(_0x1fbf7b){return _0x1fbf7b!==null&&!_[_0x5d87('0x42')](_0x1fbf7b);}function msgResponse(_0x3cd327,_0x1ef22f,_0x2c4376){return{'action':_0x3cd327,'response':_0x1ef22f,'message':_0x2c4376,'stack':_0x2c4376};}function emit(_0x108f89,_0x4603f2,_0x2825df){io['to'](_0x108f89)[_0x5d87('0x43')](_0x4603f2,_0x2825df);}function emitOutboundVoiceQueueSummary(_0x3223ea){if(_0x3223ea[_0x5d87('0x44')]===_0x5d87('0x45')){logger[_0x5d87('0x46')](_0x5d87('0x47'),util['inspect'](_0x3223ea,{'showHidden':![],'depth':null}));emit(util[_0x5d87('0x48')]('voice:queue:%s',_0x3223ea[_0x5d87('0x49')]),_0x5d87('0x4a'),_0x3223ea);}}function checkGetDataPredictive(_0x597a40){if(isNotNull(_0x597a40)&&!_[_0x5d87('0x4b')](_0x597a40)){loggerPredictive['info']('-----\x20Stats\x20Predictive\x20---');loggerPredictive[_0x5d87('0x4c')]('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x597a40[_0x5d87('0x4d')]);loggerPredictive['info']('Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x597a40[_0x5d87('0x4e')]);loggerPredictive['info'](_0x5d87('0x4f'),_0x597a40[_0x5d87('0x50')]);loggerPredictive[_0x5d87('0x4c')]('Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x597a40['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive[_0x5d87('0x4c')](_0x5d87('0x51'),_0x597a40[_0x5d87('0x52')]);loggerPredictive['info'](_0x5d87('0x53'),_0x597a40[_0x5d87('0x54')]);loggerPredictive[_0x5d87('0x4c')](_0x5d87('0x55'));if(_0x597a40[_0x5d87('0x4d')]>0x0){if(!_['isUndefined'](_0x597a40['predictiveIntervalAvgTalktime'])&&_0x597a40[_0x5d87('0x54')]>0x0){return!![];}loggerPredictive[_0x5d87('0x4c')](_0x5d87('0x56'));if(!_[_0x5d87('0x42')](_0x597a40[_0x5d87('0x52')])&&_0x597a40[_0x5d87('0x52')]>0x0){return!![];}loggerPredictive[_0x5d87('0x4c')](_0x5d87('0x57'));}else{loggerPredictive[_0x5d87('0x4c')](_0x5d87('0x58'));}}else{loggerPredictive[_0x5d87('0x4c')](_0x5d87('0x59'));}return![];}function mergeDataErlangB(_0xac1944){return function(_0x58a33a){loggerPredictive[_0x5d87('0x4c')](_0x5d87('0x5a'));loggerPredictive['info']('Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x58a33a['erlangCalls']);loggerPredictive[_0x5d87('0x4c')](_0x5d87('0x5b'),_0x58a33a[_0x5d87('0x5c')]);loggerPredictive[_0x5d87('0x4c')](_0x5d87('0x5d'),_0x58a33a['erlangAbandonmentRate']);loggerPredictive['info'](_0x5d87('0x5e'),_0x58a33a[_0x5d87('0x5f')]);loggerPredictive[_0x5d87('0x4c')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x58a33a['erlangAbandonmentRate']);loggerPredictive[_0x5d87('0x4c')](_0x5d87('0x55'));_[_0x5d87('0x60')](_0xac1944,_0x58a33a);};}function ifInterval(_0x16241d,_0x301d0d){if(_[_0x5d87('0x42')](_0x301d0d)){return![];}return utils[_0x5d87('0x61')](undefined,_0x301d0d)<_0x16241d*0x3c;}function clearPredictiveAttributes(_0x152233){if(_0x152233['startProgressive']){_0x152233['startProgressive']=undefined;loggerPredictive[_0x5d87('0x46')](_0x152233[_0x5d87('0x49')],'startProgressive\x20value\x20cleared');}if(_0x152233[_0x5d87('0x29')]){_0x152233[_0x5d87('0x29')]=undefined;loggerPredictive[_0x5d87('0x46')](_0x152233[_0x5d87('0x49')],_0x5d87('0x62'));}if(_0x152233[_0x5d87('0x63')]){clearInterval(_0x152233[_0x5d87('0x63')]);_0x152233[_0x5d87('0x63')]=undefined;loggerPredictive['debug'](_0x152233[_0x5d87('0x49')],_0x5d87('0x64'));}}function loggerCatchPredictive(_0x570549,_0x5e74bb){return function(_0x30280d){loggerPredictive[_0x5d87('0x65')](_0x5e74bb['name'],_0x570549);loggerPredictive[_0x5d87('0x65')](_0x30280d[_0x5d87('0x66')]);clearPredictiveAttributes(_0x5e74bb);};}function loggerCatch(_0xbb0d53){return function(_0x471c43){logger[_0x5d87('0x65')](_0xbb0d53,util['inspect'](_0x471c43,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x350ecc,_0xcec190,_0xcbb53a){return function(_0x1a0d35){utils['checkContactLowerLimitOriginate'](_0xcec190,_0xcbb53a,0x0);_0xcec190[_0x5d87('0x67')]=0x0;logger['error'](_0x350ecc,util[_0x5d87('0x68')](_0x1a0d35,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x3d097d){return function(_0x1d9fbd){if(isNotNull(_0x1d9fbd)&&isNotNull(_0x1d9fbd[0x0])){if(_0x1d9fbd[0x0][_0x5d87('0x69')]>0x0){_0x3d097d[_0x5d87('0x6a')]=utils[_0x5d87('0x6b')][_0x5d87('0x6c')];logger['info'](_0x5d87('0x6d')+_0x3d097d[_0x5d87('0x49')],_0x1d9fbd[0x0][_0x5d87('0x69')],'contacts');}else{_0x3d097d[_0x5d87('0x6a')]=utils[_0x5d87('0x6b')][_0x5d87('0x6e')];logger[_0x5d87('0x4c')](_0x5d87('0x6f')+_0x3d097d[_0x5d87('0x49')]);}}};}function createObjHistory(_0x3db8a0,_0x35b85b,_0x1d309a,_0x24bb2a,_0x29a6dc){_0x3db8a0[_0x5d87('0x6a')]=_0x1d309a;var _0x5672d6=new Action(_0x3db8a0,_0x35b85b);var _0x3d4871=new History(_0x5672d6);_0x3d4871['state']=_0x24bb2a;_0x3d4871[_0x5d87('0x70')]=_0x29a6dc;_0x3d4871[_0x5d87('0x71')]=_0x5672d6[_0x5d87('0x72')];return _0x3d4871;}function unlockQueueStatus(_0x163af3,_0x43de3a){setTimeout(function(){if(_['isUndefined'](_0x163af3['queueStatusComplete'])){loggerBooked[_0x5d87('0x65')](_0x5d87('0x73'),_0x43de3a);}_0x163af3['queueStatusComplete']=!![];loggerBooked[_0x5d87('0x4c')](_0x5d87('0x74'),_0x43de3a,JSON['stringify'](_[_0x5d87('0x75')](_0x163af3,[_0x5d87('0x49'),'queueStatusComplete'])));},0x1f3);}function checkInterval(_0x482074){return function(){if(!isNotNull(_0x482074[_0x5d87('0x76')])){_0x482074['message']=utils[_0x5d87('0x6b')][_0x5d87('0x77')];throw _0x482074[_0x5d87('0x49')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x482074[_0x5d87('0x76')][_0x5d87('0x78')])){_0x482074[_0x5d87('0x6a')]=utils['CAMPAIGN_STATUS'][_0x5d87('0x77')];throw _0x482074[_0x5d87('0x49')]+_0x5d87('0x79');}if(!isNotNull(_[_0x5d87('0x4b')](_0x482074[_0x5d87('0x76')][_0x5d87('0x78')]))){_0x482074[_0x5d87('0x6a')]=utils['CAMPAIGN_STATUS']['NULL_INTERVAL'];throw _0x482074[_0x5d87('0x49')]+_0x5d87('0x79');}};}function checkIsIVRCampaignActive(_0x5cffa8){return function(){if(!utils[_0x5d87('0x7a')](_0x5cffa8)){_0x5cffa8['message']=utils[_0x5d87('0x6b')][_0x5d87('0x7b')];throw _0x5cffa8[_0x5d87('0x49')]+_0x5d87('0x7c');}};}function emitCampaignSummary(_0x2273a9){if(utils[_0x5d87('0x7d')](_0x2273a9)){emit(util['format'](_0x5d87('0x7e'),_0x2273a9[_0x5d87('0x49')]),_0x5d87('0x7f'),_0x2273a9);}}function loggerCatchQueueSummary(_0x29131d,_0x3f9911){return function(_0x572606){clearPredictiveAttributes(_0x3f9911);emitCampaignSummary(_0x3f9911);loggerSyncQueueSummary['debug'](_0x29131d,util[_0x5d87('0x68')](_0x572606,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x3e9fbe){if(_0x3e9fbe['sendMessageOneNotActive']){if(_0x3e9fbe[_0x5d87('0x80')]===0x0){_0x3e9fbe[_0x5d87('0x81')]=![];_0x3e9fbe['message']=utils[_0x5d87('0x6b')][_0x5d87('0x7b')];loggerSyncQueueSummary['debug'](_0x5d87('0x82'),_0x3e9fbe[_0x5d87('0x49')],_0x5d87('0x83'));}else{_0x3e9fbe['message']=utils[_0x5d87('0x6b')]['DISACTIVED'];loggerSyncQueueSummary[_0x5d87('0x46')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x3e9fbe[_0x5d87('0x49')],'is\x20disactive');}emitCampaignSummary(_0x3e9fbe);}}function myreject(_0x3fc0e7){return function(_0x54d89c){return _0x3fc0e7(msgResponse(_0x5d87('0x84'),'Error',JSON[_0x5d87('0x85')](_0x54d89c)));};}Dialer[_0x5d87('0x1b')][_0x5d87('0x86')]=function(_0x49cb9f){return!_['isUndefined'](_0x49cb9f)&&_0x49cb9f&&!_[_0x5d87('0x42')](_0x49cb9f[_0x5d87('0x49')])&&!_[_0x5d87('0x42')](_0x49cb9f[_0x5d87('0x87')])&&_0x49cb9f['active']&&(this[_0x5d87('0x23')][util[_0x5d87('0x48')](_0x5d87('0x88'),_0x49cb9f[_0x5d87('0x49')])][_0x5d87('0x89')]===_0x5d87('0x8a')||this[_0x5d87('0x23')][util[_0x5d87('0x48')]('SIP/%s',_0x49cb9f[_0x5d87('0x49')])][_0x5d87('0x89')]==='unmonitored');};Dialer['prototype'][_0x5d87('0x8b')]=function(_0x14c3d6){var _0x24148b=this;return function(){if(!_0x24148b[_0x5d87('0x86')](_0x14c3d6[_0x5d87('0x8c')])){if(!_0x24148b['isTrunkReachable'](_0x14c3d6[_0x5d87('0x8d')])){_0x14c3d6[_0x5d87('0x6a')]=utils[_0x5d87('0x6b')][_0x5d87('0x8e')];throw _0x14c3d6[_0x5d87('0x49')]+_0x5d87('0x8f');}}};};Dialer[_0x5d87('0x1b')][_0x5d87('0x90')]=function(_0xa46424,_0x25a4d9,_0xef8c22,_0xc879b1){var _0x4602dc=this;return function(){var _0x219dde=!![];return _0x4602dc['ifTimeIvr'](_0xa46424,_0x25a4d9,_0xef8c22,_0xc879b1,_0x219dde);};};Dialer['prototype'][_0x5d87('0x91')]=function(_0x47c52c,_0x227b0f,_0x4cfec8,_0x2cf3a0){var _0x4aac48=this;return function(){var _0x145d00=![];return _0x4aac48[_0x5d87('0x92')](_0x47c52c['Intervals'],_0x227b0f,_0x4cfec8,_0x2cf3a0,_0x145d00);};};Dialer['prototype'][_0x5d87('0x92')]=function(_0x260158,_0x3a0d3a,_0x49e485,_0xface77,_0x42fe11){var _0x234206=[];return new Promise(function(_0x2964d4,_0x8cd24f){if(!isNotNull(_0x260158)){_0xface77[_0x5d87('0x6a')]=utils[_0x5d87('0x6b')][_0x5d87('0x77')];return _0x8cd24f(msgResponse(_0x5d87('0x93'),_0x5d87('0x94'),_0x49e485+_0x5d87('0x95')));}if(_[_0x5d87('0x4b')](_0x260158)){_0xface77[_0x5d87('0x6a')]=utils[_0x5d87('0x6b')][_0x5d87('0x96')];return _0x8cd24f(msgResponse('ifTime',_0x5d87('0x94'),_0x49e485+'\x20Intervals\x20is\x20empty\x20'));}if(_0x3a0d3a&&_[_0x5d87('0x42')](config['timezones'][_0x3a0d3a])){_0xface77[_0x5d87('0x6a')]=utils[_0x5d87('0x6b')][_0x5d87('0x97')];return _0x8cd24f(msgResponse(_0x5d87('0x93'),_0x5d87('0x94'),_0x49e485+_0x5d87('0x98')+_0x3a0d3a));}if(_[_0x5d87('0x99')](_0x260158)){for(var _0x5a651a=0x0;_0x5a651a<_0x260158[_0x5d87('0x9a')];_0x5a651a+=0x1){_0x234206[_0x5d87('0x9b')](ami[_0x5d87('0x9c')]({'action':'command','command':util['format'](_0x5d87('0x9d'),_0x260158[_0x5a651a]['interval'],!_[_0x5d87('0x42')](config[_0x5d87('0x9e')][_0x3a0d3a])?_0x3a0d3a:'')})[_0x5d87('0x9f')](function(_0x5be901){return _0x5be901[_0x5d87('0xa0')][_0x5d87('0xa1')]('true')>=0x0;})[_0x5d87('0xa2')](myreject(_0x8cd24f)));}}else{_0x234206[_0x5d87('0x9b')](ami[_0x5d87('0x9c')]({'action':_0x5d87('0xa3'),'command':util['format']('iftime\x20%s,%s',_0x260158,!_[_0x5d87('0x42')](config['timezones'][_0x3a0d3a])?_0x3a0d3a:'')})[_0x5d87('0x9f')](function(_0x9b319a){return _0x9b319a[_0x5d87('0xa0')][_0x5d87('0xa1')](_0x5d87('0xa4'))>=0x0;})[_0x5d87('0xa2')](myreject(_0x8cd24f)));}Promise['all'](_0x234206)[_0x5d87('0x9f')](function(_0x1275c2){var _0x3859b2=_[_0x5d87('0xa5')](_0x1275c2);if(_0x3859b2){return _0x2964d4(_0x3859b2);}else{_0xface77[_0x5d87('0x6a')]=_0x42fe11?utils[_0x5d87('0x6b')][_0x5d87('0xa6')]:utils[_0x5d87('0x6b')]['OVERTIME_INTERVAL'];return _0x8cd24f(msgResponse(_0x5d87('0xa7'),_0x5d87('0x94'),'Global:\x20'+_0x42fe11+'\x20'+_0x49e485+_0x5d87('0xa8')+util[_0x5d87('0x68')](_0x260158,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x3a0d3a));}})[_0x5d87('0xa2')](function(_0x15c1bb){return _0x8cd24f(msgResponse('ifTime',_0x5d87('0x94'),JSON['stringify'](_0x15c1bb)));});});};Dialer[_0x5d87('0x1b')][_0x5d87('0x3e')]=function(){var _0x4929ae=this;return cmHopper['resetActiveCalls']({'active':![]},{'where':{'active':!![]}})[_0x5d87('0x9f')](function(){setInterval(function(){_0x4929ae[_0x5d87('0xa9')]();},0x3e8);});};Dialer[_0x5d87('0x1b')][_0x5d87('0xa9')]=function(){var _0x761549=this;var _0x3c44ec;for(var _0x272eac in this[_0x5d87('0x21')]){if(typeof this[_0x5d87('0x21')][_0x272eac]!=='undefined'){_0x3c44ec=this[_0x5d87('0x21')][_0x272eac];if(utils['isIVRCampaign'](_0x3c44ec)&&utils[_0x5d87('0x7a')](_0x3c44ec)){_0x3c44ec[_0x5d87('0x81')]=!![];Promise[_0x5d87('0xaa')]()['then'](checkIsIVRCampaignActive(_0x3c44ec))[_0x5d87('0x9f')](checkInterval(_0x3c44ec))['then'](_0x761549[_0x5d87('0x8b')](_0x3c44ec))[_0x5d87('0x9f')](_0x761549[_0x5d87('0x90')](_0x3c44ec[_0x5d87('0xab')],_0x3c44ec['dialTimezone'],_0x3c44ec['name'],_0x3c44ec))['then'](_0x761549[_0x5d87('0x91')](_0x3c44ec[_0x5d87('0x76')],_0x3c44ec['dialTimezone'],_0x3c44ec[_0x5d87('0x49')],_0x3c44ec))[_0x5d87('0x9f')](_0x761549[_0x5d87('0xac')](_0x3c44ec))['catch'](loggerCatchQueueSummary(_0x5d87('0xad'),_0x3c44ec));}else{notSendMessagesCampaign(_0x3c44ec);}}}};Dialer[_0x5d87('0x1b')][_0x5d87('0xae')]=function(_0x58d49d){if(_0x58d49d[_0x5d87('0xaf')]!==_0x5d87('0xb')){clearPredictiveAttributes(_0x58d49d);}switch(_0x58d49d[_0x5d87('0xaf')]){case _0x5d87('0xb0'):this['handlePower'](_0x58d49d,0x1);break;case _0x5d87('0xb1'):this['handlePower'](_0x58d49d,_0x58d49d[_0x5d87('0xb2')]);break;case _0x5d87('0xb'):this[_0x5d87('0xb')](_0x58d49d);break;case _0x5d87('0xa'):this[_0x5d87('0xb3')](_0x58d49d,0x1);break;default:logger[_0x5d87('0x65')]('Queue',_0x58d49d[_0x5d87('0x49')],_0x5d87('0xb4'));}};Dialer[_0x5d87('0x1b')][_0x5d87('0x93')]=function(_0x746462,_0x41a9d7){var _0x4be582=_0x746462['dialTimezone'];var _0x1d992b=_0x41a9d7?_0x746462[_0x5d87('0xab')]:_0x746462[_0x5d87('0x76')]['Intervals'];logger[_0x5d87('0xb5')](_0x5d87('0xb6'),_0x1d992b,_0x4be582,_0x746462['name'],util[_0x5d87('0x48')]('Voice\x20Queue\x20%s\x20$s',_0x746462[_0x5d87('0x49')],_0x746462['id']));var _0x459910=null;return Interval[_0x5d87('0xb7')](_0x1d992b,_0x4be582)['then'](function(_0x4dadbd){if(_0x4dadbd===!![]){return _0x4dadbd;}else{_0x746462[_0x5d87('0x6a')]=_0x41a9d7?utils[_0x5d87('0x6b')][_0x5d87('0xa6')]:utils['CAMPAIGN_STATUS'][_0x5d87('0xb8')];_0x459910=msgResponse(_0x5d87('0xa7'),_0x5d87('0x94'),_0x5d87('0xb9')+_0x41a9d7+'\x20'+_0x746462['name']+_0x5d87('0xa8')+util[_0x5d87('0x68')](_0x1d992b,{'showHidden':![],'depth':null})+_0x5d87('0xba')+_0x4be582);}if(_0x459910!==null){logger['silly'](_0x5d87('0xbb'),_0x459910);_0x459910[_0x5d87('0xbc')]=_0x41a9d7;throw _0x459910;}})[_0x5d87('0xa2')](function(_0x556a6c){logger[_0x5d87('0x65')](_0x5d87('0xbd'),_0x556a6c);throw msgResponse(_0x5d87('0x84'),_0x5d87('0xbe'),util[_0x5d87('0x68')](_0x556a6c,{'showHidden':![],'depth':null}));});};Dialer[_0x5d87('0x1b')][_0x5d87('0xbf')]=function(_0x2f4aae){if(this[_0x5d87('0x20')][_0x2f4aae[_0x5d87('0xc0')]]){if(this[_0x5d87('0x27')][_0x2f4aae[_0x5d87('0xc1')]]&&this['uniqueId'][_0x2f4aae[_0x5d87('0xc1')]][_0x5d87('0x44')]!=='ivr'){this[_0x5d87('0xc2')](this[_0x5d87('0x20')][_0x2f4aae[_0x5d87('0xc0')]]);this[_0x5d87('0x27')][_0x2f4aae[_0x5d87('0xc1')]][_0x5d87('0xc3')]=moment()[_0x5d87('0x48')]('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer[_0x5d87('0x1b')][_0x5d87('0x33')]=function(_0x12d485){var _0x16ed27=this['uniqueId'][_0x12d485['uniqueid']];if(this['voiceQueues'][_0x12d485[_0x5d87('0xc0')]]){if(_0x16ed27&&_0x16ed27[_0x5d87('0x44')]!==_0x5d87('0xc4')){delete this['uniqueId'][_0x12d485[_0x5d87('0xc1')]];this[_0x5d87('0x20')][_0x12d485[_0x5d87('0xc0')]][_0x5d87('0xc5')]+=0x1;var _0x5cfc84=new AgentComplete(_0x16ed27,_0x12d485);if(_0x12d485[_0x5d87('0xc6')]===_0x5d87('0xc7')){_0x5cfc84[_0x5d87('0xc8')]=this['voiceQueues'][_0x12d485['queue']][_0x5d87('0xc9')]&&this[_0x5d87('0x20')][_0x12d485[_0x5d87('0xc0')]]['dialAgiAfterHangupAgent']?moment()[_0x5d87('0x48')](_0x5d87('0xca')):undefined;}hopperUtils['createHistory'](_0x5cfc84)[_0x5d87('0xa2')](loggerCatch('[syncAgentComplete][createHistory]'));hopperUtils[_0x5d87('0xcb')](_0x5cfc84)[_0x5d87('0xa2')](loggerCatch(_0x5d87('0xcc')));}}};Dialer['prototype'][_0x5d87('0x30')]=function(_0x19788c){var _0x50091a=this['uniqueId'][_0x19788c[_0x5d87('0xc1')]];var _0x4ba29b=this;var _0x3b6e38=![];var _0x5ee047;var _0x24a6e9;if(this[_0x5d87('0x20')][_0x19788c[_0x5d87('0xc0')]]){if(_0x50091a&&_0x50091a[_0x5d87('0x44')]!==_0x5d87('0xc4')){delete this['uniqueId'][_0x19788c[_0x5d87('0xc1')]];this['updateOriginated'](this[_0x5d87('0x20')][_0x19788c[_0x5d87('0xc0')]]);_0x50091a['droptime']=moment()[_0x5d87('0x48')](_0x5d87('0xca'));var _0x7082a0=new QueueCallerAbandon(_0x50091a,_0x19788c);if(utils[_0x5d87('0x61')](_0x50091a[_0x5d87('0xcd')],_0x50091a[_0x5d87('0xce')])>=_0x50091a[_0x5d87('0xcf')]){this[_0x5d87('0x20')][_0x19788c[_0x5d87('0xc0')]][_0x5d87('0x50')]+=0x1;this[_0x5d87('0x20')][_0x19788c[_0x5d87('0xc0')]]['outboundDropCallsDayTimeout']+=0x1;this[_0x5d87('0x20')][_0x19788c[_0x5d87('0xc0')]][_0x5d87('0xd0')]+=0x1;_0x7082a0[_0x5d87('0xd1')]=0xa;_0x7082a0[_0x5d87('0x70')]=_0x5d87('0xd2');_0x7082a0[_0x5d87('0xd3')]=_0x5d87('0xd4');_0x7082a0[_0x5d87('0xc8')]=this['voiceQueues'][_0x19788c[_0x5d87('0xc0')]][_0x5d87('0xc9')]?moment()['format'](_0x5d87('0xca')):undefined;_0x7082a0['countdropretry']+=0x1;_0x7082a0[_0x5d87('0xd5')]+=0x1;_0x5ee047=this[_0x5d87('0x20')][_0x19788c[_0x5d87('0xc0')]][_0x5d87('0xd6')];_0x24a6e9=this[_0x5d87('0x20')][_0x19788c['queue']][_0x5d87('0xd7')];hopperUtils[_0x5d87('0xd8')](_0x7082a0,_0x7082a0[_0x5d87('0xd1')],_0x50091a['voiceQueue'])[_0x5d87('0x9f')](function(_0x3facdc){_0x3b6e38=_0x3facdc[_0x5d87('0xd9')]==0x1;if(_0x7082a0['countdropretry']>=_0x4ba29b[_0x5d87('0x20')][_0x19788c[_0x5d87('0xc0')]]['dialDropMaxRetry']){_0x4ba29b[_0x5d87('0xda')](_0x7082a0,_0x3facdc['additional']);}else{hopperUtils[_0x5d87('0xdb')]({'active':![],'countdropretry':_0x7082a0[_0x5d87('0xdc')],'scheduledat':moment()[_0x5d87('0xdd')](_0x4ba29b[_0x5d87('0x20')][_0x19788c[_0x5d87('0xc0')]][_0x5d87('0xd6')],_0x5d87('0xde'))[_0x5d87('0x48')](_0x5d87('0xca')),'ContactId':_0x50091a[_0x5d87('0xdf')],'ListId':_0x50091a[_0x5d87('0xe0')],'VoiceQueueId':_0x50091a[_0x5d87('0xe1')]||undefined,'CampaignId':_0x50091a['CampaignId']||undefined})[_0x5d87('0xa2')](loggerCatch(_0x5d87('0xe2')));var _0x43c1e9=new History(_0x7082a0);_0x43c1e9['state']=0xa;_0x43c1e9[_0x5d87('0x70')]='Drop';_0x43c1e9[_0x5d87('0x72')]=moment()['format'](_0x5d87('0xca'));_0x43c1e9['endtime']=_0x43c1e9['starttime'];_0x43c1e9['calleridname']=_0x7082a0[_0x5d87('0xe3')];_0x43c1e9[_0x5d87('0xe4')]=_0x7082a0[_0x5d87('0xe4')];hopperUtils[_0x5d87('0xe5')](_0x43c1e9)[_0x5d87('0xa2')](loggerCatch(_0x5d87('0xe6')));}})[_0x5d87('0x9f')](function(){if(_0x3b6e38)hopperUtils[_0x5d87('0xe7')](_0x7082a0,_0x5ee047,_0x24a6e9)[_0x5d87('0x9f')](function(){return 0x1;});});}else{this['voiceQueues'][_0x19788c[_0x5d87('0xc0')]][_0x5d87('0xe8')]+=0x1;this[_0x5d87('0x20')][_0x19788c[_0x5d87('0xc0')]][_0x5d87('0xe9')]+=0x1;_0x7082a0[_0x5d87('0xd1')]=0xb;_0x7082a0[_0x5d87('0x70')]='Abandoned';_0x7082a0[_0x5d87('0xd3')]=_0x5d87('0xea');_0x7082a0[_0x5d87('0xeb')]+=0x1;_0x7082a0[_0x5d87('0xd5')]+=0x1;_0x5ee047=this[_0x5d87('0x20')][_0x19788c[_0x5d87('0xc0')]][_0x5d87('0xec')];_0x24a6e9=this[_0x5d87('0x20')][_0x19788c[_0x5d87('0xc0')]]['callAdditionalPhoneAfterMin'];hopperUtils[_0x5d87('0xd8')](_0x7082a0,_0x7082a0[_0x5d87('0xd1')],_0x50091a[_0x5d87('0xed')])['then'](function(_0x32b831){if(_0x7082a0[_0x5d87('0xeb')]>=_0x4ba29b[_0x5d87('0x20')][_0x19788c[_0x5d87('0xc0')]][_0x5d87('0xee')]){_0x4ba29b[_0x5d87('0xda')](_0x7082a0,_0x32b831[_0x5d87('0xd9')]);}else{hopperUtils[_0x5d87('0xdb')]({'active':![],'countabandonedretry':_0x7082a0[_0x5d87('0xeb')],'scheduledat':moment()[_0x5d87('0xdd')](_0x4ba29b[_0x5d87('0x20')][_0x19788c['queue']][_0x5d87('0xec')],_0x5d87('0xde'))['format'](_0x5d87('0xca')),'ContactId':_0x50091a[_0x5d87('0xdf')],'ListId':_0x50091a['ListId'],'VoiceQueueId':_0x50091a[_0x5d87('0xe1')]||undefined,'CampaignId':_0x50091a[_0x5d87('0xef')]||undefined})[_0x5d87('0xa2')](loggerCatch(_0x5d87('0xf0')));var _0x380fb7=new History(_0x7082a0);_0x380fb7[_0x5d87('0xd1')]=0xb;_0x380fb7['statedesc']=_0x5d87('0xf1');_0x380fb7[_0x5d87('0x72')]=moment()[_0x5d87('0x48')]('YYYY-MM-DD\x20HH:mm:ss');_0x380fb7[_0x5d87('0x71')]=_0x380fb7[_0x5d87('0x72')];_0x380fb7[_0x5d87('0xe3')]=_0x7082a0[_0x5d87('0xe3')];_0x380fb7[_0x5d87('0xe4')]=_0x7082a0[_0x5d87('0xe4')];hopperUtils[_0x5d87('0xe5')](_0x380fb7)[_0x5d87('0xa2')](loggerCatch(_0x5d87('0xf2')));}})['then'](function(){if(_0x3b6e38)hopperUtils[_0x5d87('0xe7')](_0x7082a0,_0x5ee047,_0x24a6e9)[_0x5d87('0x9f')](function(){return 0x1;});});}}}};Dialer['prototype'][_0x5d87('0x3a')]=function(_0x18491e){if(this[_0x5d87('0x26')][_0x18491e['uniqueid']]){this[_0x5d87('0x26')][_0x18491e[_0x5d87('0xc1')]]['channel']=_0x18491e['channel'];}if(this[_0x5d87('0x27')][_0x18491e[_0x5d87('0xc1')]]){this['uniqueId'][_0x18491e[_0x5d87('0xc1')]][_0x5d87('0xf3')]=_0x18491e['channel'];}};Dialer[_0x5d87('0x1b')][_0x5d87('0x3b')]=function(_0x387573){if(!this[_0x5d87('0x26')][_0x387573[_0x5d87('0xf4')]]){return;}var _0xe96510=this[_0x5d87('0x20')][this[_0x5d87('0x26')][_0x387573[_0x5d87('0xf4')]]['queue']][_0x5d87('0xf5')]||_0x5d87('0xf6');if(_0xe96510===_0x5d87('0xf7')){if(this[_0x5d87('0x26')][_0x387573['actionid']]&&_[_0x5d87('0xf8')](this['actions'][_0x387573[_0x5d87('0xf4')]][_0x5d87('0xf9')])&&_0x387573[_0x5d87('0x89')]==='1'&&_0x387573[_0x5d87('0xfa')]==='0'){if(this['agents'][_0x387573[_0x5d87('0xfb')]]){if(!this[_0x5d87('0x22')][_0x387573[_0x5d87('0xfb')]][_0x5d87('0xf9')]){this[_0x5d87('0x22')][_0x387573[_0x5d87('0xfb')]][_0x5d87('0xf9')]=!![];this[_0x5d87('0x26')][_0x387573['actionid']][_0x5d87('0xf9')]=!![];this[_0x5d87('0x26')][_0x387573[_0x5d87('0xf4')]][_0x5d87('0xfb')]=_0x387573[_0x5d87('0xfb')];}}}}else if(_0xe96510==='rrmemory'){if(this[_0x5d87('0x26')][_0x387573[_0x5d87('0xf4')]]){if(this[_0x5d87('0x22')][_0x387573['stateinterface']]){this[_0x5d87('0x26')][_0x387573[_0x5d87('0xf4')]]['stateinterface']=_0x387573[_0x5d87('0xfb')];if(_['isNil'](this[_0x5d87('0x2c')][this[_0x5d87('0x26')][_0x387573['actionid']][_0x5d87('0xc0')]])){this[_0x5d87('0x2c')][this[_0x5d87('0x26')][_0x387573[_0x5d87('0xf4')]]['queue']]=[];}this[_0x5d87('0x2c')][this[_0x5d87('0x26')][_0x387573[_0x5d87('0xf4')]][_0x5d87('0xc0')]][_0x5d87('0x9b')](_[_0x5d87('0x60')](_[_0x5d87('0x75')](this[_0x5d87('0x26')][_0x387573[_0x5d87('0xf4')]],[_0x5d87('0xfc'),_0x5d87('0xfb')]),{'status':_0x387573['status'],'paused':_0x387573[_0x5d87('0xfa')]}));}}}};Dialer['prototype'][_0x5d87('0x3d')]=function(_0x3c8aef){if(!this[_0x5d87('0x26')][_0x3c8aef[_0x5d87('0xf4')]]){return;}var _0xb9946e=this;var _0xd296aa=this['voiceQueues'][this['actions'][_0x3c8aef['actionid']][_0x5d87('0xc0')]];var _0x414f58=_0xd296aa[_0x5d87('0xf5')]||'rrmemory';if(_0x414f58===_0x5d87('0xf7')){if(this[_0x5d87('0x26')][_0x3c8aef[_0x5d87('0xf4')]]&&this[_0x5d87('0x26')][_0x3c8aef['actionid']][_0x5d87('0xfb')]){this['preview']['run'](this['actions'][_0x3c8aef['actionid']][_0x5d87('0xfc')],this[_0x5d87('0x26')][_0x3c8aef[_0x5d87('0xf4')]][_0x5d87('0xfb')])['catch'](function(_0x58e5e6){logger[_0x5d87('0x65')]('[Catch][Preview][syncQueueStatusComplete]',util[_0x5d87('0x68')](_0x58e5e6,{'showHidden':![],'depth':null}));})[_0x5d87('0x1e')](function(){_0xb9946e[_0x5d87('0xc2')](_0xb9946e['voiceQueues'][_0xb9946e['actions'][_0x3c8aef[_0x5d87('0xf4')]][_0x5d87('0xc0')]]);_0xb9946e[_0x5d87('0x22')][_0xb9946e[_0x5d87('0x26')][_0x3c8aef[_0x5d87('0xf4')]][_0x5d87('0xfb')]][_0x5d87('0xf9')]=![];delete _0xb9946e[_0x5d87('0x26')][_0x3c8aef['actionid']];unlockQueueStatus(_0xd296aa);});}else{this[_0x5d87('0xc2')](this['voiceQueues'][this[_0x5d87('0x26')][_0x3c8aef[_0x5d87('0xf4')]]['queue']]);hopperUtils[_0x5d87('0xdb')]({'active':![],'ContactId':this[_0x5d87('0x26')][_0x3c8aef[_0x5d87('0xf4')]][_0x5d87('0xdf')],'ListId':this[_0x5d87('0x26')][_0x3c8aef[_0x5d87('0xf4')]][_0x5d87('0xe0')],'VoiceQueueId':this[_0x5d87('0x26')][_0x3c8aef['actionid']][_0x5d87('0xe1')]||undefined,'CampaignId':this[_0x5d87('0x26')][_0x3c8aef[_0x5d87('0xf4')]]['CampaignId']||undefined})[_0x5d87('0xa2')](loggerCatch(_0x5d87('0xfd')));delete this[_0x5d87('0x26')][_0x3c8aef[_0x5d87('0xf4')]];unlockQueueStatus(_0xd296aa);}}else if(_0x414f58===_0x5d87('0xf6')){var _0x361017;if(this[_0x5d87('0x26')][_0x3c8aef[_0x5d87('0xf4')]]&&!_[_0x5d87('0x4b')](this[_0x5d87('0x2c')][this['actions'][_0x3c8aef[_0x5d87('0xf4')]][_0x5d87('0xc0')]])){if(this[_0x5d87('0xfe')][_0xb9946e[_0x5d87('0x26')][_0x3c8aef['actionid']]['queue']]){this[_0x5d87('0xfe')][_0xb9946e[_0x5d87('0x26')][_0x3c8aef['actionid']][_0x5d87('0xc0')]]=this['queueBookedRR'][this[_0x5d87('0x26')][_0x3c8aef['actionid']][_0x5d87('0xc0')]]?this['queueBookedRR'][this[_0x5d87('0x26')][_0x3c8aef[_0x5d87('0xf4')]]['queue']]:this[_0x5d87('0x2c')][this[_0x5d87('0x26')][_0x3c8aef[_0x5d87('0xf4')]][_0x5d87('0xc0')]]?this['queueBooked'][this[_0x5d87('0x26')][_0x3c8aef[_0x5d87('0xf4')]][_0x5d87('0xc0')]][_0x5d87('0xff')]||0x0:0x0;}this[_0x5d87('0x2c')][this[_0x5d87('0x26')][_0x3c8aef['actionid']][_0x5d87('0xc0')]][_0x5d87('0xff')]=this['queueBookedRR'][this[_0x5d87('0x26')][_0x3c8aef[_0x5d87('0xf4')]]['queue']];for(var _0x1fbaa3=0x0;_0x1fbaa3=_0x20470e['dialGlobalMaxRetry']){_0x4bb33a['stateGlobal'](_0x434775,_0x1c0b06,_0xefcac6,_0x5d87('0x126'));}else{if(_0x434775[_0x5d87('0x121')]>=_0x20470e[_0x5d87('0x127')]){_0x4bb33a[_0x5d87('0x128')](_0x434775,_0x1c0b06,_0xefcac6,_0x5d87('0x129'));}else{hopperUtils[_0x5d87('0xdb')]({'active':![],'countmachineretry':_0x434775[_0x5d87('0x121')],'scheduledat':moment()[_0x5d87('0xdd')](_0x20470e['dialMachineRetryFrequency'],_0x5d87('0xde'))[_0x5d87('0x48')](_0x5d87('0xca')),'ContactId':_0x434775['ContactId'],'ListId':_0x434775[_0x5d87('0xe0')],'VoiceQueueId':_0x434775[_0x5d87('0xe1')]||undefined,'CampaignId':_0x434775[_0x5d87('0xef')]||undefined})[_0x5d87('0xa2')](loggerCatch(_0x5d87('0x12a')));_0x1c0b06({'reschedule':0x1});}}});}if(_0x4671f5['type']===_0x5d87('0xc4')&&this[_0x5d87('0x21')][_0x4671f5[_0x5d87('0xc0')]][_0x5d87('0x113')]&&_0x4baa5f[_0x5d87('0x114')]===_0x5d87('0x115')){delete this['uniqueId'][_0x4baa5f[_0x5d87('0xc1')]];this[_0x5d87('0xc2')](this[_0x5d87('0x21')][_0x4671f5['queue']]);_0x54e0cc=new Hangup(_0x4671f5,_0x4baa5f);_0x54e0cc[_0x5d87('0xd1')]=0x12;_0x54e0cc[_0x5d87('0x70')]='HangupInAMD';_0x54e0cc['membername']=_0x5d87('0x119');ami[_0x5d87('0x43')](_0x5d87('0x11a'),ut[_0x5d87('0x11b')](_0x54e0cc,'amd'));this[_0x5d87('0x11d')](_0x54e0cc,_0x5d87('0x12b'),'[syncHangupInAMDIvr]');}if(_0x4671f5['type']===_0x5d87('0xc4')&&this[_0x5d87('0x21')][_0x4671f5[_0x5d87('0xc0')]][_0x5d87('0x113')]&&_0x4baa5f[_0x5d87('0x114')]===_0x5d87('0x12c')){return new Promise(function(_0x17f622,_0x2acb6e){delete _0x4bb33a[_0x5d87('0x27')][_0x4baa5f[_0x5d87('0xc1')]];_0x4bb33a[_0x5d87('0xc2')](_0x4bb33a['campaigns'][_0x4671f5[_0x5d87('0xc0')]]);_0x4bb33a[_0x5d87('0x21')][_0x4671f5[_0x5d87('0xc0')]][_0x5d87('0xc5')]+=0x1;_0x4bb33a[_0x5d87('0x21')][_0x4671f5[_0x5d87('0xc0')]][_0x5d87('0x116')]+=0x1;var _0x339ff9=_0x4bb33a[_0x5d87('0x21')][_0x4671f5[_0x5d87('0xc0')]];var _0x373539=new Hangup(_0x4671f5,_0x4baa5f);_0x373539[_0x5d87('0xd1')]=0x13;_0x373539[_0x5d87('0x70')]=_0x5d87('0x120');_0x373539[_0x5d87('0x118')]='AMD';_0x373539['countmachineretry']+=0x1;_0x373539['countglobal']+=0x1;_0x373539[_0x5d87('0x11c')]=!![];ami[_0x5d87('0x43')](_0x5d87('0x11a'),ut[_0x5d87('0x11b')](_0x373539,'amd'));hopperUtils[_0x5d87('0xe5')](_0x373539)[_0x5d87('0xa2')](loggerCatch(_0x5d87('0x122')));if(_0x373539[_0x5d87('0x123')]+_0x373539[_0x5d87('0x12d')]+_0x373539[_0x5d87('0x124')]+_0x373539[_0x5d87('0x12e')]+_0x373539[_0x5d87('0xdc')]+_0x373539[_0x5d87('0xeb')]+_0x373539[_0x5d87('0x121')]+_0x373539[_0x5d87('0x125')]>=_0x339ff9[_0x5d87('0x12f')]){_0x4bb33a[_0x5d87('0x130')](_0x373539,_0x17f622,_0x2acb6e,'reason19\x20machine....');}else{if(_0x373539[_0x5d87('0x121')]>=_0x339ff9[_0x5d87('0x127')]){_0x4bb33a['createStateFinal'](_0x373539,_0x17f622,_0x2acb6e,'reason\x2019\x20machine....');}else{hopperUtils[_0x5d87('0xdb')]({'active':![],'countmachineretry':_0x373539[_0x5d87('0x121')],'scheduledat':moment()[_0x5d87('0xdd')](_0x339ff9[_0x5d87('0x131')],_0x5d87('0xde'))['format'](_0x5d87('0xca')),'ContactId':_0x373539[_0x5d87('0xdf')],'ListId':_0x373539[_0x5d87('0xe0')],'VoiceQueueId':_0x373539[_0x5d87('0xe1')]||undefined,'CampaignId':_0x373539[_0x5d87('0xef')]||undefined})[_0x5d87('0xa2')](loggerCatch(_0x5d87('0x12a')));_0x17f622({'reschedule':0x1});}}});}}};Dialer[_0x5d87('0x1b')][_0x5d87('0x38')]=function(_0xc46d4e){var _0x756083=this['uniqueId'][_0xc46d4e[_0x5d87('0xc1')]];var _0x2a0145;if(_0x756083&&_0x756083[_0x5d87('0x44')]===_0x5d87('0xc4')){delete this[_0x5d87('0x27')][_0xc46d4e[_0x5d87('0xc1')]];this[_0x5d87('0xc2')](this[_0x5d87('0x21')][_0x756083['queue']]);this[_0x5d87('0x21')][_0x756083[_0x5d87('0xc0')]][_0x5d87('0x132')]+=0x1;_0x2a0145=new Hangup(_0x756083,_0xc46d4e);hopperUtils[_0x5d87('0xe5')](_0x2a0145)['catch'](loggerCatch(_0x5d87('0x133')));hopperUtils[_0x5d87('0xcb')](_0x2a0145)[_0x5d87('0xa2')](loggerCatch(_0x5d87('0x134')));}if(_0x756083&&_0x756083[_0x5d87('0x44')]!==_0x5d87('0xc4')&&isNotNull(this[_0x5d87('0x20')][_0x756083[_0x5d87('0xc0')]][_0x5d87('0x135')])){delete this[_0x5d87('0x27')][_0xc46d4e[_0x5d87('0xc1')]];this[_0x5d87('0xc2')](this['voiceQueues'][_0x756083[_0x5d87('0xc0')]]);this[_0x5d87('0x20')][_0x756083[_0x5d87('0xc0')]][_0x5d87('0xc5')]+=0x1;this[_0x5d87('0x20')][_0x756083[_0x5d87('0xc0')]][_0x5d87('0x116')]+=0x1;_0x2a0145=new Hangup(_0x756083,_0xc46d4e);_0x2a0145[_0x5d87('0xd1')]=0x10;_0x2a0145['statedesc']=_0x5d87('0x136');_0x2a0145[_0x5d87('0x118')]=_0x5d87('0x137');hopperUtils[_0x5d87('0xe5')](_0x2a0145)['catch'](loggerCatch(_0x5d87('0x133')));hopperUtils[_0x5d87('0xcb')](_0x2a0145)[_0x5d87('0xa2')](loggerCatch(_0x5d87('0x134')));}if(_0x756083&&_0x756083[_0x5d87('0x44')]!==_0x5d87('0xc4')&&!isNotNull(this[_0x5d87('0x20')][_0x756083['queue']]['dialQueueProject'])){delete this['uniqueId'][_0xc46d4e[_0x5d87('0xc1')]];this[_0x5d87('0xc2')](this[_0x5d87('0x20')][_0x756083['queue']]);this['voiceQueues'][_0x756083[_0x5d87('0xc0')]][_0x5d87('0x138')]+=0x1;_0x2a0145=new Hangup(_0x756083,_0xc46d4e);_0x2a0145[_0x5d87('0xd1')]=0xc;_0x2a0145[_0x5d87('0x70')]=_0xc46d4e[_0x5d87('0x139')];_0x2a0145[_0x5d87('0x118')]=_0x5d87('0x13a');hopperUtils[_0x5d87('0xe5')](_0x2a0145)['catch'](loggerCatch(_0x5d87('0x133')));hopperUtils['moveContactManagedDialer'](_0x2a0145)[_0x5d87('0xa2')](loggerCatch(_0x5d87('0x134')));}};Dialer[_0x5d87('0x1b')]['syncQueueSummary']=function(_0x5d67d6){var _0x3fbb50=this;if(!_0x3fbb50['queuesSummary'][_0x5d67d6['name']]){_0x3fbb50['queuesSummary'][_0x5d67d6[_0x5d87('0x49')]]={'running':![]};}else if(_0x3fbb50['queuesSummary'][_0x5d67d6['name']]['running']===!![]){return;}else if(_0x3fbb50[_0x5d87('0x2d')][_0x5d67d6[_0x5d87('0x49')]][_0x5d87('0x13b')]===![]){_0x3fbb50[_0x5d87('0x2d')][_0x5d67d6['name']][_0x5d87('0x13b')]=!![];}var _0x56a10c=_0x3fbb50[_0x5d87('0x20')][_0x5d67d6['name']];var _0x127ef2=_0x56a10c[_0x5d87('0x6a')]!==utils[_0x5d87('0x6b')]['INACTIVE'];var _0x4ba440=utils[_0x5d87('0x13c')](_0x56a10c);_0x56a10c[_0x5d87('0x13d')]=utils[_0x5d87('0x13e')](_0x56a10c,_0x3fbb50[_0x5d87('0x23')]);Promise[_0x5d87('0xaa')]()['then'](function(){if(_0x56a10c['statusMessage']===utils[_0x5d87('0x6b')][_0x5d87('0x7b')]){if(_0x127ef2){clearPredictiveAttributes(_0x56a10c);_0x5d67d6[_0x5d87('0x29')]=undefined;_0x5d67d6[_0x5d87('0x2a')]=undefined;}if(_0x56a10c[_0x5d87('0x13d')]===utils['CAMPAIGN_STATUS'][_0x5d87('0x7b')]){_0x5d67d6[_0x5d87('0x13f')]=0x0;_0x5d67d6['paused']=0x0;_0x5d67d6[_0x5d87('0x140')]=0x0;_0x5d67d6['talking']=0x0;_0x5d67d6[_0x5d87('0x141')]=0x0;}}else if(_0x56a10c['statusMessage']===utils[_0x5d87('0x6b')]['ACTIVE']&&!_0x4ba440){return _0x3fbb50[_0x5d87('0x93')](_0x56a10c,!![])['then'](function(){return _0x3fbb50['ifTime'](_0x56a10c,![]);})[_0x5d87('0x9f')](function(){return _0x3fbb50[_0x5d87('0xae')](_0x56a10c);})[_0x5d87('0xa2')](function(_0x4f6a95){loggerSyncQueueSummary['debug'](_0x5d87('0x142'),util[_0x5d87('0x68')](_0x4f6a95,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x56a10c);});}else{clearPredictiveAttributes(_0x56a10c);}})[_0x5d87('0x9f')](function(){var _0x6c2e02=_0x5d67d6['compareToOutboundQueue'](_0x56a10c);if(_0x6c2e02||_0x56a10c['queueSummaryCountersUpdated']){_0x56a10c[_0x5d87('0x143')]=![];_0x5d67d6[_0x5d87('0x144')](_0x56a10c);Object[_0x5d87('0x145')](_0x56a10c,_0x5d67d6);emitOutboundVoiceQueueSummary(_0x5d67d6);}_0x3fbb50['queuesSummary'][_0x56a10c[_0x5d87('0x49')]][_0x5d87('0x13b')]=![];})[_0x5d87('0xa2')](function(_0x51b5db){logger['error']('[syncQueueSummary]',util['inspect'](_0x51b5db,{'showHidden':![],'depth':null}));_0x3fbb50[_0x5d87('0x2d')][_0x56a10c[_0x5d87('0x49')]][_0x5d87('0x13b')]=![];});};Dialer['prototype'][_0x5d87('0x36')]=_[_0x5d87('0x146')](function(){var _0x54b797=_['filter'](this[_0x5d87('0x20')],function(_0x1b2b51){return _0x1b2b51[_0x5d87('0x147')];});var _0x310c43=_[_0x5d87('0x148')](this[_0x5d87('0x22')],function(_0xb0e1ff){return _0xb0e1ff[_0x5d87('0x149')]&&_0xb0e1ff[_0x5d87('0x89')]==='reachable';});if(_0x54b797['length']>0x0&&_0x310c43[_0x5d87('0x9a')]>0x0){return Promise[_0x5d87('0xaa')]()[_0x5d87('0x9f')](cmHopper['handlePreviewRecallNotifications'](_[_0x5d87('0x14a')](_0x54b797,'id'),previewRecallmeReminderInterval,_[_0x5d87('0x14a')](_0x310c43,'id')))[_0x5d87('0x9f')](function(_0x25fbb8){for(var _0x2a6a74=0x0;_0x2a6a74<_0x25fbb8[_0x5d87('0x9a')];_0x2a6a74++){var _0x29ddd0=_0x25fbb8[_0x2a6a74][_0x5d87('0x14b')][_0x5d87('0x49')];if(_0x29ddd0)io['to'](util[_0x5d87('0x48')](_0x5d87('0x14c'),_0x29ddd0))[_0x5d87('0x43')](_0x5d87('0x14d'),{'hopper':_0x25fbb8[_0x2a6a74]});}})[_0x5d87('0xa2')](function(_0x4542c7){logger[_0x5d87('0x65')](_0x5d87('0x14e'),_0x4542c7);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x5d87('0x1b')][_0x5d87('0x3f')]=function(){var _0x37a638=this;setInterval(function(){_0x37a638[_0x5d87('0x14f')](_0x37a638['uniqueId'],_0x5d87('0x150'));_0x37a638[_0x5d87('0x14f')](_0x37a638[_0x5d87('0x26')],'[actions]');},0x32c8);};Dialer['prototype']['clearZombieChannels']=function(_0x1c54a1,_0xfed87c){var _0x512772=this;for(var _0x73c8ac in _0x1c54a1){if(typeof _0x1c54a1[_0x73c8ac]!=='undefined'){this[_0x5d87('0x1f')][_0x5d87('0x1c')](function(){if(!_['isNil'](_0x1c54a1[_0x73c8ac])){return ami[_0x5d87('0x9c')]({'action':'status','channel':_0x1c54a1[_0x73c8ac][_0x5d87('0xf3')]})[_0x5d87('0xa2')](function(_0x22d631){if(_0x22d631['message']===_0x5d87('0x151')){setTimeout(function(){if(_0x1c54a1[_0x73c8ac]&&_0x1c54a1[_0x73c8ac][_0x5d87('0x44')]!==_0x5d87('0xc4')){_0x512772[_0x5d87('0xc2')](_0x512772[_0x5d87('0x20')][_0x1c54a1[_0x73c8ac][_0x5d87('0xc0')]]);logger[_0x5d87('0x65')]('[Dialer][checkChannel]',_0xfed87c,_0x73c8ac,_0x1c54a1[_0x73c8ac][_0x5d87('0xc0')]);delete _0x1c54a1[_0x73c8ac];}if(_0x1c54a1[_0x73c8ac]&&_0x1c54a1[_0x73c8ac][_0x5d87('0x44')]===_0x5d87('0xc4')){_0x512772[_0x5d87('0xc2')](_0x512772[_0x5d87('0x21')][_0x1c54a1[_0x73c8ac][_0x5d87('0xc0')]]);logger[_0x5d87('0x65')]('[Dialer][checkChannel][ivr]',_0xfed87c,_0x73c8ac,_0x1c54a1[_0x73c8ac][_0x5d87('0xc0')]);delete _0x1c54a1[_0x73c8ac];}},0x2328);}});}});}}};Dialer[_0x5d87('0x1b')][_0x5d87('0x152')]=function(_0x216568){return Promise[_0x5d87('0xaa')]()[_0x5d87('0x9f')](voiceQueueRt[_0x5d87('0x152')](_0x216568))[_0x5d87('0xa2')](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer[_0x5d87('0x1b')][_0x5d87('0xc2')]=function(_0x5f322e){if(!_['isUndefined'](_0x5f322e)&&_0x5f322e!==null){if(typeof _0x5f322e['originated']!==_0x5d87('0x153')){if(_0x5f322e[_0x5d87('0x80')]>0x0){_0x5f322e['originated']-=0x1;}else{logger[_0x5d87('0x65')](_0x5d87('0x154'));}}}else{logger[_0x5d87('0x65')](_0x5d87('0x155'));}};Dialer[_0x5d87('0x1b')][_0x5d87('0x156')]=function(_0x52004b,_0xf46247){var _0xabb888=this;return function(_0x283a12){_0xabb888[_0x5d87('0xc2')](_0xf46247);logger[_0x5d87('0x65')](_0x52004b,util[_0x5d87('0x68')](_0x283a12,{'showHidden':![],'depth':null}));};};Dialer[_0x5d87('0x1b')]['emptyContact']=function(_0x5d8e35,_0xac16ae,_0x480927){var _0x5d547f={'state':0x19,'statedesc':_0x5d87('0x157')};this[_0x5d87('0xc2')](_0xac16ae);this[_0x5d87('0x11d')](_[_0x5d87('0x60')](_0x5d547f,_[_0x5d87('0x75')](_0x480927,[_0x5d87('0xdf'),'ListId',_0x5d87('0x158'),_0x5d87('0xe1'),'CampaignId'])),_0x5d87('0x159'),_0x5d87('0x15a'));logger[_0x5d87('0x65')](_0x5d8e35);};Dialer[_0x5d87('0x1b')][_0x5d87('0x11d')]=function(_0x568048,_0x2220ef,_0x39ae09){hopperUtils[_0x5d87('0xe5')](_0x568048)[_0x5d87('0xa2')](loggerCatch(_0x2220ef));hopperUtils[_0x5d87('0xcb')](_0x568048)['catch'](loggerCatch(_0x39ae09));};Dialer[_0x5d87('0x1b')][_0x5d87('0xda')]=function(_0x48f3ed,_0xa58d9c){hopperUtils[_0x5d87('0xe5')](_0x48f3ed)['catch'](loggerCatch(_0x5d87('0x15b')));if(_0xa58d9c==0x0){hopperUtils[_0x5d87('0xcb')](_0x48f3ed)[_0x5d87('0xa2')](loggerCatch(_0x5d87('0x15c')));}};Dialer[_0x5d87('0x1b')][_0x5d87('0x14e')]=function(_0xfff238){return Promise['resolve']()[_0x5d87('0x9f')](cmHopper[_0x5d87('0x15d')](_0xfff238['id'],previewRecallmeReminderInterval))[_0x5d87('0x9f')](function(_0x1bb209){for(var _0x34a437=0x0;_0x34a437<_0x1bb209[_0x5d87('0x9a')];_0x34a437++){var _0x47efa1=_0x1bb209[_0x34a437][_0x5d87('0x14b')][_0x5d87('0x49')];if(_0x47efa1)io['to'](util[_0x5d87('0x48')](_0x5d87('0x14c'),_0x47efa1))[_0x5d87('0x43')](_0x5d87('0x14d'),{'hopper':_0x1bb209[_0x34a437]});}})['catch'](function(){});};Dialer['prototype']['launchHandleIvr']=function(_0x204380){var _0x4b3e2a=this;return function(){_0x4b3e2a['handleIvr'](_0x204380);};};Dialer[_0x5d87('0x1b')][_0x5d87('0x15e')]=function(_0xecd07f,_0x450c34){var _0x5e43fe=this;var _0x55547e=uuid['v4']();this[_0x5d87('0x26')][_0x55547e]=new Action(_0xecd07f,_0x450c34,_0x55547e);return new Promise(function(_0x364b07,_0x3c0d31){if(_[_0x5d87('0x42')](_0xecd07f)&&typeof _0xecd07f!=='object'){return _0x3c0d31(msgResponse(_0x5d87('0x15f'),'Failure','voiceQueue\x20is\x20undefine'));}if(_[_0x5d87('0x42')](_0x450c34['phone'])||_0x450c34[_0x5d87('0x160')]===null){return _0x3c0d31(msgResponse(_0x5d87('0x15f'),'Failure',_0x5d87('0x161')));}var _0x3325c3={'XMD-CALLERID':_0x5e43fe[_0x5d87('0x26')][_0x55547e][_0x5d87('0x162')](),'XMD-AGI':_0xecd07f['dialQueueProject']?util[_0x5d87('0x48')](_0x5d87('0x163'),ipAgi,_0xecd07f[_0x5d87('0x135')]):'NONE','XMD-AGIAFTER':_0xecd07f[_0x5d87('0xc9')]?util[_0x5d87('0x48')](_0x5d87('0x163'),ipAgi,_0xecd07f[_0x5d87('0xc9')]):_0x5d87('0x164'),'XMD-QUEUE':utils[_0x5d87('0x165')](_0xecd07f)?util[_0x5d87('0x48')]('\x22%s,%s%s,,,%s\x22',_0xecd07f[_0x5d87('0x49')],_0xecd07f['dialQueueOptions']||'',_0xecd07f[_0x5d87('0x166')]?'c':'',_0xecd07f['dialQueueTimeout']||0x3):_0x5d87('0x164'),'XMD-CONTACTID':_0x450c34[_0x5d87('0xdf')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x5e43fe[_0x5d87('0x26')][_0x55547e][_0x5d87('0x162')](),'XMD-AMD':_0xecd07f[_0x5d87('0x113')]?_0x5d87('0x167'):_0x5d87('0x164'),'XMD-DESTINATION':'xcally-motion-dialer'};if(_0xecd07f[_0x5d87('0x113')]){_0x3325c3[_0x5d87('0x168')]=_0xecd07f[_0x5d87('0x169')]||0x9c4;_0x3325c3[_0x5d87('0x16a')]=_0xecd07f[_0x5d87('0x16b')]||0x5dc;_0x3325c3[_0x5d87('0x16c')]=_0xecd07f[_0x5d87('0x16d')]||0x320;_0x3325c3[_0x5d87('0x16e')]=_0xecd07f['dialAMDTotalAnalysisTime']||0x1388;_0x3325c3[_0x5d87('0x16f')]=_0xecd07f[_0x5d87('0x170')]||0x64;_0x3325c3[_0x5d87('0x171')]=_0xecd07f[_0x5d87('0x172')]||0x32;_0x3325c3['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0xecd07f[_0x5d87('0x173')]||0x3;_0x3325c3[_0x5d87('0x174')]=_0xecd07f[_0x5d87('0x175')]||0x100;_0x3325c3['XMD-AMDMAXIMUMWORDLENGTH']=_0xecd07f['dialAMDMaximumWordLength']||0x1388;}if(utils['isOutboundQueue'](_0xecd07f)){_0x3325c3[_0x5d87('0x176')]=_0x450c34[_0x5d87('0xe1')];}else{_0x3325c3[_0x5d87('0x177')]=_0x450c34[_0x5d87('0xef')];}var _0x47f67b=utils[_0x5d87('0x178')](_0x450c34[_0x5d87('0x179')]);Object['assign'](_0x3325c3,_0x47f67b);var _0x574d64=_0x5e43fe[_0x5d87('0x86')](_0xecd07f[_0x5d87('0x8c')])?utils[_0x5d87('0x17a')](_0xecd07f[_0x5d87('0x8c')][_0x5d87('0x17b')],_0xecd07f['dialOriginateCallerIdName'],_0xecd07f['dialRandomLastDigitCallerIdNumber']>0x0?utils[_0x5d87('0x17c')](_0xecd07f[_0x5d87('0x17d')],_0xecd07f['dialRandomLastDigitCallerIdNumber']):_0xecd07f[_0x5d87('0x17d')]):utils[_0x5d87('0x17a')](_[_0x5d87('0xf8')](_0xecd07f['TrunkBackup'])?_0xecd07f[_0x5d87('0x8c')][_0x5d87('0x17b')]:_0xecd07f[_0x5d87('0x8d')][_0x5d87('0x17b')],_0xecd07f[_0x5d87('0x17e')],_0xecd07f[_0x5d87('0x17f')]>0x0?utils[_0x5d87('0x17c')](_0xecd07f['dialOriginateCallerIdNumber'],_0xecd07f[_0x5d87('0x17f')]):_0xecd07f[_0x5d87('0x17d')]);if(_0x574d64){_0x3325c3['XMD-ORIGINATECALLERIDNAME']=_0x5e43fe[_0x5d87('0x26')][_0x55547e]['originatecalleridname']=utils[_0x5d87('0x180')](_0x574d64);_0x3325c3[_0x5d87('0x181')]=_0x450c34[_0x5d87('0x160')];}_0xecd07f[_0x5d87('0x182')]=_0x3325c3;return ami[_0x5d87('0x9c')]({'actionid':_0x55547e,'action':'originate','channel':_0x5e43fe['isTrunkReachable'](_0xecd07f[_0x5d87('0x8c')])?util[_0x5d87('0x48')](_0x5d87('0x183'),_0xecd07f[_0x5d87('0x8c')][_0x5d87('0x49')],isNotNull(_0xecd07f[_0x5d87('0x184')])?_0xecd07f[_0x5d87('0x184')][_0x5d87('0x185')]()||'':'',_0xecd07f[_0x5d87('0x186')]>0x0?_0x450c34[_0x5d87('0x160')][_0x5d87('0x187')](_0xecd07f['dialCutDigit']):_0x450c34[_0x5d87('0x160')]):util[_0x5d87('0x48')](_0x5d87('0x183'),_['isNil'](_0xecd07f[_0x5d87('0x8d')])?_0xecd07f[_0x5d87('0x8c')][_0x5d87('0x49')]:_0xecd07f[_0x5d87('0x8d')]['name'],isNotNull(_0xecd07f[_0x5d87('0x184')])?_0xecd07f[_0x5d87('0x184')]['trim']()||'':'',_0xecd07f[_0x5d87('0x186')]>0x0?_0x450c34[_0x5d87('0x160')][_0x5d87('0x187')](_0xecd07f[_0x5d87('0x186')]):_0x450c34[_0x5d87('0x160')]),'callerid':_0x574d64,'Exten':'xcally-motion-dialer','Context':_0x5d87('0x188'),'Priority':'1','variable':_0x3325c3,'timeout':(_0xecd07f[_0x5d87('0x189')]||0x1e)*0x3e8,'async':!![],'channelid':_0x55547e})[_0x5d87('0x9f')](function(_0x16380f){return _0x364b07(_0x16380f);})[_0x5d87('0xa2')](function(_0x163d1c){_0xecd07f['outboundOriginateFailureCallsDay']+=0x1;var _0x2f76fc=new History(_0x5e43fe[_0x5d87('0x26')][_0x55547e]);logger[_0x5d87('0x65')](util['format']('[originateError]:\x20%s',JSON['stringify'](_0x163d1c)));_0x2f76fc[_0x5d87('0xd1')]=0xe;_0x2f76fc[_0x5d87('0x70')]='OriginateError';_0x2f76fc[_0x5d87('0x72')]=moment()[_0x5d87('0x48')](_0x5d87('0xca'));_0x2f76fc['endtime']=_0x2f76fc['starttime'];hopperUtils[_0x5d87('0xe5')](_0x2f76fc)['catch'](loggerCatch(_0x5d87('0x18a')));_0x5e43fe[_0x5d87('0xcb')](_0x2f76fc)[_0x5d87('0xa2')](loggerCatch(_0x5d87('0x18a')))[_0x5d87('0x1e')](function(){delete _0x5e43fe[_0x5d87('0x26')][_0x55547e];return _0x3c0d31(msgResponse(_0x5d87('0x15f'),_0x5d87('0xbe'),'originate\x20action\x20Error'));});});});};Dialer[_0x5d87('0x1b')]['checkRetriveMax']=function(_0xabae60,_0x450be1,_0x49470d){var _0x1f7800=new History(_0x450be1);if(_0x1f7800['countbusyretry']+_0x1f7800['countcongestionretry']+_0x1f7800[_0x5d87('0x124')]+_0x1f7800['countnosuchnumberretry']+_0x1f7800[_0x5d87('0xdc')]+_0x1f7800[_0x5d87('0xeb')]+_0x1f7800[_0x5d87('0x121')]+_0x1f7800[_0x5d87('0x125')]>=_0x49470d[_0x5d87('0x12f')]-0x1){return!![];}switch(_0xabae60){case 0x3:if(_0x1f7800[_0x5d87('0x124')]>=_0x49470d[_0x5d87('0x18b')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countnoanswerretry':_0x1f7800['countnoanswerretry']+=0x1,'scheduledat':moment()[_0x5d87('0xdd')](_0x49470d[_0x5d87('0x18c')],_0x5d87('0xde'))[_0x5d87('0x48')](_0x5d87('0xca')),'ContactId':_0x1f7800['ContactId'],'ListId':_0x1f7800[_0x5d87('0xe0')],'VoiceQueueId':_0x1f7800[_0x5d87('0xe1')]||undefined,'CampaignId':_0x1f7800[_0x5d87('0xef')]||undefined})[_0x5d87('0xa2')](loggerCatch(_0x5d87('0x18d')));break;case 0x5:if(_0x1f7800[_0x5d87('0x123')]>=_0x49470d[_0x5d87('0x18e')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countbusyretry':_0x1f7800['countbusyretry']+=0x1,'scheduledat':moment()['add'](_0x49470d[_0x5d87('0x18f')],_0x5d87('0xde'))[_0x5d87('0x48')](_0x5d87('0xca')),'ContactId':_0x1f7800[_0x5d87('0xdf')],'ListId':_0x1f7800['ListId'],'VoiceQueueId':_0x1f7800[_0x5d87('0xe1')]||undefined,'CampaignId':_0x1f7800[_0x5d87('0xef')]||undefined})[_0x5d87('0xa2')](loggerCatch(_0x5d87('0x190')));break;case 0x8:if(_0x1f7800['countcongestionretry']>=_0x49470d[_0x5d87('0x191')]-0x1){return!![];}hopperUtils[_0x5d87('0xdb')]({'active':![],'countcongestionretry':_0x1f7800['countcongestionretry']+=0x1,'scheduledat':moment()['add'](_0x49470d[_0x5d87('0x192')],_0x5d87('0xde'))[_0x5d87('0x48')](_0x5d87('0xca')),'ContactId':_0x1f7800[_0x5d87('0xdf')],'ListId':_0x1f7800[_0x5d87('0xe0')],'VoiceQueueId':_0x1f7800[_0x5d87('0xe1')]||undefined,'CampaignId':_0x1f7800[_0x5d87('0xef')]||undefined})[_0x5d87('0xa2')](loggerCatch('[rescheduleContact]\x20[Congestion]'));break;case 0x0:if(_0x1f7800[_0x5d87('0x12e')]>=_0x49470d[_0x5d87('0x193')]-0x1){return!![];}else{hopperUtils['rescheduleContact']({'active':![],'countnosuchnumberretry':_0x1f7800[_0x5d87('0x12e')]+=0x1,'scheduledat':moment()['add'](_0x49470d[_0x5d87('0x194')],_0x5d87('0xde'))[_0x5d87('0x48')](_0x5d87('0xca')),'ContactId':_0x1f7800[_0x5d87('0xdf')],'ListId':_0x1f7800['ListId'],'VoiceQueueId':_0x1f7800[_0x5d87('0xe1')]||undefined,'CampaignId':_0x1f7800[_0x5d87('0xef')]||undefined})[_0x5d87('0xa2')](loggerCatch(_0x5d87('0x195')));}break;case 0xa:if(_0x1f7800[_0x5d87('0xdc')]>=_0x49470d['dialDropMaxRetry']-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countdropretry':_0x1f7800['countdropretry']+=0x1,'scheduledat':moment()[_0x5d87('0xdd')](_0x49470d[_0x5d87('0xd6')],_0x5d87('0xde'))[_0x5d87('0x48')](_0x5d87('0xca')),'ContactId':_0x1f7800['ContactId'],'ListId':_0x1f7800[_0x5d87('0xe0')],'VoiceQueueId':_0x1f7800[_0x5d87('0xe1')]||undefined,'CampaignId':_0x1f7800['CampaignId']||undefined})['catch'](loggerCatch(_0x5d87('0xe2')));break;case 0xb:if(_0x1f7800[_0x5d87('0xeb')]>=_0x49470d[_0x5d87('0xee')]-0x1){return!![];}hopperUtils[_0x5d87('0xdb')]({'active':![],'countabandonedretry':_0x1f7800[_0x5d87('0xeb')]+=0x1,'scheduledat':moment()[_0x5d87('0xdd')](_0x49470d[_0x5d87('0xec')],_0x5d87('0xde'))[_0x5d87('0x48')](_0x5d87('0xca')),'ContactId':_0x1f7800[_0x5d87('0xdf')],'ListId':_0x1f7800[_0x5d87('0xe0')],'VoiceQueueId':_0x1f7800['VoiceQueueId']||undefined,'CampaignId':_0x1f7800['CampaignId']||undefined})[_0x5d87('0xa2')](loggerCatch(_0x5d87('0xf0')));break;case 0x13:if(_0x1f7800['countmachineretry']>=_0x49470d['dialMachineMaxRetry']-0x1){return!![];}hopperUtils[_0x5d87('0xdb')]({'active':![],'countmachineretry':_0x1f7800[_0x5d87('0x121')]+=0x1,'scheduledat':moment()[_0x5d87('0xdd')](_0x49470d['dialMachineRetryFrequency'],_0x5d87('0xde'))[_0x5d87('0x48')](_0x5d87('0xca')),'ContactId':_0x1f7800[_0x5d87('0xdf')],'ListId':_0x1f7800[_0x5d87('0xe0')],'VoiceQueueId':_0x1f7800[_0x5d87('0xe1')]||undefined,'CampaignId':_0x1f7800[_0x5d87('0xef')]||undefined})[_0x5d87('0xa2')](loggerCatch(_0x5d87('0x12a')));break;case 0x14:if(_0x1f7800[_0x5d87('0x125')]>=_0x49470d['dialAgentRejectMaxRetry']-0x1){return!![];}hopperUtils[_0x5d87('0xdb')]({'active':![],'countagentrejectretry':_0x1f7800[_0x5d87('0x125')]+=0x1,'scheduledat':moment()[_0x5d87('0xdd')](_0x49470d[_0x5d87('0x196')],_0x5d87('0xde'))[_0x5d87('0x48')](_0x5d87('0xca')),'ContactId':_0x1f7800[_0x5d87('0xdf')],'ListId':_0x1f7800[_0x5d87('0xe0')],'VoiceQueueId':_0x1f7800['VoiceQueueId']||undefined,'CampaignId':_0x1f7800[_0x5d87('0xef')]||undefined})[_0x5d87('0xa2')](loggerCatch(_0x5d87('0x197')));break;default:return!![];}};Dialer[_0x5d87('0x1b')][_0x5d87('0x10f')]=function(_0xb0a5bc,_0xe8dffb,_0x16c54f){var _0x4fae0b=this;var _0x427afa=new History(_0xb0a5bc);var _0x72c5e4=![];var _0x13048f;var _0x593870;return new Promise(function(_0x41c717,_0x47f668){if(_['isUndefined'](_0xe8dffb)&&typeof _0xe8dffb!==_0x5d87('0x198')){return _0x47f668(msgResponse('[callProgressDetecting]','Failure',_0x5d87('0x199')));}if(_[_0x5d87('0x42')](_0x16c54f)&&typeof _0x16c54f!==_0x5d87('0x198')){return _0x47f668(msgResponse(_0x5d87('0x19a'),'Failure','evt\x20is\x20undefine'));}hopperUtils['verifyAdditionalPhones'](_0x427afa,_0x16c54f[_0x5d87('0xc6')],_0xe8dffb)[_0x5d87('0x9f')](function(_0x41118a){if(_0x41118a[_0x5d87('0xd9')]==0x1)_0x72c5e4=!![];switch(_0x16c54f[_0x5d87('0xc6')]){case'0':_0xe8dffb[_0x5d87('0x19b')]+=0x1;_0x427afa[_0x5d87('0xd1')]=0x0;_0x427afa[_0x5d87('0x70')]='NoSuchNumber';_0x427afa[_0x5d87('0x12e')]+=0x1;_0x427afa[_0x5d87('0xd5')]+=0x1;ami[_0x5d87('0x43')](_0x5d87('0x19c'),ut[_0x5d87('0x11b')](_0xb0a5bc,_0x5d87('0x19d')));_0x13048f=_0xe8dffb[_0x5d87('0x194')];_0x593870=_0xe8dffb[_0x5d87('0xd7')];hopperUtils[_0x5d87('0xe5')](_0x427afa)[_0x5d87('0xa2')](loggerCatch(_0x5d87('0x122')));if(_0x4fae0b['checkRetriveMax'](0x0,_0xb0a5bc,_0xe8dffb)&&!_0x72c5e4){if(_0x427afa['countnosuchnumberretry']>=_0xe8dffb['dialNoSuchNumberMaxRetry']){_0x4fae0b[_0x5d87('0x128')](_0x427afa,_0x41c717,_0x47f668,'reason\x200\x20no\x20such\x20number....');}else{_0x4fae0b[_0x5d87('0x130')](_0x427afa,_0x41c717,_0x47f668,_0x5d87('0x19e'));}}break;case'3':_0xe8dffb[_0x5d87('0x19f')]+=0x1;_0x427afa[_0x5d87('0xd1')]=0x3;_0x427afa[_0x5d87('0x70')]='NoAnswer';_0x427afa['countnoanswerretry']+=0x1;_0x427afa[_0x5d87('0xd5')]+=0x1;var _0x2acbf1=ut[_0x5d87('0x1a0')](_0xb0a5bc,_0xe8dffb);ami[_0x5d87('0x43')](_0x5d87('0x1a1'),_0x2acbf1);_0x13048f=_0xe8dffb['dialNoAnswerRetryFrequency'];_0x593870=_0xe8dffb['callAdditionalPhoneAfterMin'];hopperUtils[_0x5d87('0xe5')](_0x427afa)[_0x5d87('0xa2')](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0x4fae0b[_0x5d87('0x1a2')](0x3,_0xb0a5bc,_0xe8dffb)&&!_0x72c5e4){if(_0x427afa[_0x5d87('0x124')]>=_0xe8dffb[_0x5d87('0x18b')]){_0x4fae0b[_0x5d87('0x128')](_0x427afa,_0x41c717,_0x47f668,_0x5d87('0x1a3'));}else{_0x4fae0b[_0x5d87('0x130')](_0x427afa,_0x41c717,_0x47f668,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0xe8dffb[_0x5d87('0x1a4')]+=0x1;_0x427afa[_0x5d87('0xd1')]=0x5;_0x427afa[_0x5d87('0x70')]='Busy';_0x427afa[_0x5d87('0x123')]+=0x1;_0x427afa[_0x5d87('0xd5')]+=0x1;ami[_0x5d87('0x43')](_0x5d87('0x1a5'),ut[_0x5d87('0x11b')](_0xb0a5bc,_0x5d87('0x1a6')));_0x13048f=_0xe8dffb[_0x5d87('0x18f')];_0x593870=_0xe8dffb[_0x5d87('0xd7')];hopperUtils[_0x5d87('0xe5')](_0x427afa)[_0x5d87('0xa2')](loggerCatch(_0x5d87('0x1a7')));if(_0x4fae0b[_0x5d87('0x1a2')](0x5,_0xb0a5bc,_0xe8dffb)&&!_0x72c5e4){if(_0x427afa['countbusyretry']>=_0xe8dffb[_0x5d87('0x18e')]){_0x4fae0b[_0x5d87('0x128')](_0x427afa,_0x41c717,_0x47f668,'reason\x205\x20busy');}else{_0x4fae0b['stateGlobal'](_0x427afa,_0x41c717,_0x47f668,_0x5d87('0x1a8'));}}break;case'8':_0xe8dffb['outboundCongestionCallsDay']+=0x1;_0x427afa[_0x5d87('0xd1')]=0x8;_0x427afa[_0x5d87('0x70')]=_0x5d87('0x1a9');_0x427afa['countcongestionretry']+=0x1;_0x427afa[_0x5d87('0xd5')]+=0x1;_0x13048f=_0xe8dffb['dialCongestionRetryFrequency'];_0x593870=_0xe8dffb['callAdditionalPhoneAfterMin'];ami['emit'](_0x5d87('0x1aa'),ut[_0x5d87('0x11b')](_0xb0a5bc,_0x5d87('0x1ab')));hopperUtils['createHistory'](_0x427afa)[_0x5d87('0xa2')](loggerCatch(_0x5d87('0x1ac')));if(_0x4fae0b['checkRetriveMax'](0x8,_0xb0a5bc,_0xe8dffb)&&!_0x72c5e4){if(_0x427afa[_0x5d87('0x12d')]>=_0xe8dffb['dialCongestionMaxRetry']){_0x4fae0b[_0x5d87('0x128')](_0x427afa,_0x41c717,_0x47f668,_0x5d87('0x1ad'));}else{_0x4fae0b[_0x5d87('0x130')](_0x427afa,_0x41c717,_0x47f668,_0x5d87('0x1ad'));}}break;case'11':_0xe8dffb[_0x5d87('0x1ae')]+=0x1;_0x427afa['state']=0xb;_0x427afa[_0x5d87('0x70')]='Abandoned';_0x427afa[_0x5d87('0xeb')]+=0x1;_0x427afa['countglobal']+=0x1;_0x13048f=_0xe8dffb[_0x5d87('0xec')];_0x593870=_0xe8dffb[_0x5d87('0xd7')];hopperUtils[_0x5d87('0xe5')](_0x427afa)[_0x5d87('0xa2')](loggerCatch('[syncAgentComplete][createHistory][11]'));if(_0x4fae0b[_0x5d87('0x1a2')](0xb,_0xb0a5bc,_0xe8dffb)&&!_0x72c5e4){if(_0x427afa[_0x5d87('0xeb')]>=_0xe8dffb[_0x5d87('0xee')]){_0x4fae0b[_0x5d87('0x128')](_0x427afa,_0x41c717,_0x47f668,_0x5d87('0x1af'));}else{_0x4fae0b[_0x5d87('0x130')](_0x427afa,_0x41c717,_0x47f668,_0x5d87('0x1af'));}}break;case'20':_0xe8dffb['outboundRejectCallsDay']+=0x1;_0x427afa[_0x5d87('0xd1')]=0x14;_0x427afa[_0x5d87('0x70')]=_0x5d87('0x1b0');_0x427afa[_0x5d87('0x125')]+=0x1;_0x427afa[_0x5d87('0xd5')]+=0x1;_0x13048f=_0xe8dffb[_0x5d87('0x196')];_0x593870=_0xe8dffb[_0x5d87('0xd7')];ami[_0x5d87('0x43')](_0x5d87('0x1b1'),ut[_0x5d87('0x11b')](_0xb0a5bc,'agentreject'));hopperUtils[_0x5d87('0xe5')](_0x427afa)[_0x5d87('0xa2')](loggerCatch(_0x5d87('0x1b2')));if(_0x4fae0b[_0x5d87('0x1a2')](0x14,_0xb0a5bc,_0xe8dffb)&&!_0x72c5e4){if(_0x427afa[_0x5d87('0x125')]>=_0xe8dffb[_0x5d87('0x1b3')]){_0x4fae0b[_0x5d87('0x128')](_0x427afa,_0x41c717,_0x47f668,_0x5d87('0x1b4'));}else{_0x4fae0b[_0x5d87('0x130')](_0x427afa,_0x41c717,_0x47f668,'reason\x2020\x20agentreject');}}break;default:_0xe8dffb[_0x5d87('0x138')]+=0x1;_0x427afa[_0x5d87('0xd1')]=0xc;_0x427afa['statedesc']=_0x16c54f[_0x5d87('0xc6')];_0x13048f=_0xe8dffb[_0x5d87('0x196')];_0x593870=_0xe8dffb['callAdditionalPhoneAfterMin'];hopperUtils[_0x5d87('0xe5')](_0x427afa)[_0x5d87('0xa2')](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x4fae0b[_0x5d87('0x1a2')](_0x16c54f['reason'],_0xb0a5bc,_0xe8dffb)&&!_0x72c5e4){if(_0x427afa[_0x5d87('0x123')]+_0x427afa[_0x5d87('0x12d')]+_0x427afa[_0x5d87('0x124')]+_0x427afa[_0x5d87('0x12e')]+_0x427afa['countdropretry']+_0x427afa['countabandonedretry']+_0x427afa[_0x5d87('0x121')]+_0x427afa['countagentrejectretry']>=_0xe8dffb['dialGlobalMaxRetry']){_0x4fae0b[_0x5d87('0x130')](_0x427afa,_0x41c717,_0x47f668,_0x16c54f['reason']);}else{_0x4fae0b[_0x5d87('0x128')](_0x427afa,_0x41c717,_0x47f668,_0x16c54f[_0x5d87('0xc6')]);}}}})[_0x5d87('0x9f')](function(){if(_0x72c5e4){hopperUtils[_0x5d87('0xe7')](_0x427afa,_0x13048f,_0x593870)[_0x5d87('0x9f')](function(){return _0x41c717(0x1);});}});});};Dialer['prototype']['stateGlobal']=function(_0x5af3db,_0x4e6202,_0x588c18,_0x1c42cc){var _0x1bd3be=new Final(_0x5af3db);_0x1bd3be[_0x5d87('0xd1')]=0xf;_0x1bd3be[_0x5d87('0x70')]=_0x5d87('0x1b5');this[_0x5d87('0x128')](_0x1bd3be,_0x4e6202,_0x588c18,_0x1c42cc);};Dialer[_0x5d87('0x1b')][_0x5d87('0x128')]=function(_0x21f052,_0x449aef,_0x23467d,_0x1452ac){hopperUtils[_0x5d87('0xcb')](_0x21f052)[_0x5d87('0x9f')](function(){return _0x449aef(msgResponse(_0x5d87('0x19a'),_0x5d87('0x1b6'),_0x1452ac));})[_0x5d87('0xa2')](function(){return _0x23467d(msgResponse(_0x5d87('0x1b7'),_0x5d87('0x94'),_0x5d87('0x1b8')));});};Dialer[_0x5d87('0x1b')][_0x5d87('0xb')]=function(_0x582f06){var _0x571183=_0x582f06[_0x5d87('0x1b9')]/0x64;var _0x2d13bc=_0x582f06[_0x5d87('0x1ba')]/(_0x582f06[_0x5d87('0x1ba')]+_0x582f06[_0x5d87('0xc5')]);var _0x250c73=Math['round'](_0x582f06[_0x5d87('0x1bb')]*(_0x582f06[_0x5d87('0x1bc')]/0x64));var _0x4bc36a=Math['round'](_0x582f06['predictiveIntervalAvailable']*(_0x582f06[_0x5d87('0x1bd')]/0x64));var _0x2241ce=_0x582f06[_0x5d87('0x13f')]+_0x582f06['talking'];var _0x4a046b=Math[_0x5d87('0x1be')](_0x582f06[_0x5d87('0x1bf')]*_0x582f06[_0x5d87('0x1c0')]*_0x582f06['predictiveIntervalHitRate']*_0x582f06[_0x5d87('0x1c1')]);if(_['isUndefined'](_0x582f06[_0x5d87('0x2a')])){if(!_['isUndefined'](_0x582f06['startPredictive'])){_0x582f06[_0x5d87('0x29')]=undefined;loggerPredictive[_0x5d87('0x65')](_0x5d87('0x1c2'),'check\x20predictive\x20is\x20not\x20undefine');}if(!_['isUndefined'](_0x582f06[_0x5d87('0x63')])){loggerPredictive[_0x5d87('0x65')](_0x5d87('0x1c2'),_0x5d87('0x1c3'));clearInterval(_0x582f06['handlePredictive']);_0x582f06[_0x5d87('0x63')]=undefined;}_0x582f06[_0x5d87('0x2a')]=moment()['format'](_0x5d87('0xca'));loggerPredictive[_0x5d87('0x4c')](_0x582f06[_0x5d87('0x49')],_0x5d87('0x1c4'),_0x582f06[_0x5d87('0x2a')]);this[_0x5d87('0xb3')](_0x582f06,0x1);}else if(ifInterval(_0x582f06[_0x5d87('0x1c5')],_0x582f06['startProgressive'])){this[_0x5d87('0xb3')](_0x582f06,0x1);loggerPredictiveCalls[_0x5d87('0x4c')](_0x5d87('0x1c6'),_0x582f06['startProgressive'],_0x582f06[_0x5d87('0x49')]);_0x582f06[_0x5d87('0x1bf')]=0x0;_0x582f06['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x571183<_0x2d13bc&&_0x582f06['dialPredictiveOptimization']===_0x5d87('0x1c7')){clearPredictiveAttributes(_0x582f06);loggerPredictive[_0x5d87('0x4c')](_0x5d87('0x1c8'),_0x5d87('0x1c9'),_0x2d13bc,_0x5d87('0x2a'),_0x582f06['name']);}else if(_0x4a046b<_0x582f06[_0x5d87('0xd0')]&&_0x582f06['dialPredictiveOptimization']===_0x5d87('0x1c7')){clearPredictiveAttributes(_0x582f06);loggerPredictive[_0x5d87('0x4c')](_0x5d87('0x1ca'),_0x5d87('0x1cb'),_0x4a046b,_0x5d87('0x1cc'),_0x582f06[_0x5d87('0xd0')],_0x5d87('0x2a'),_0x582f06[_0x5d87('0x49')]);}else if(!ifInterval(_0x582f06[_0x5d87('0x1c5')],_0x582f06[_0x5d87('0x2a')])&&_['isUndefined'](_0x582f06[_0x5d87('0x29')])&&!_[_0x5d87('0x42')](_0x582f06[_0x5d87('0x2a')])){_0x582f06[_0x5d87('0x29')]=moment()[_0x5d87('0x48')](_0x5d87('0xca'));loggerPredictive['info'](_0x582f06[_0x5d87('0x49')],'started\x20in\x20predictive\x20at',_0x582f06[_0x5d87('0x29')]);hopperUtils[_0x5d87('0x1cd')](_0x582f06['dialPredictiveInterval'])[_0x5d87('0x9f')](this[_0x5d87('0x1ce')](_0x582f06))[_0x5d87('0x9f')](mergeDataErlangB(_0x582f06))['then'](this[_0x5d87('0x1cf')](_0x582f06))[_0x5d87('0xa2')](loggerCatchPredictive(_0x5d87('0x1d0'),_0x582f06));}else if(!ifInterval(_0x582f06[_0x5d87('0x1c5')],_0x582f06[_0x5d87('0x29')])){_0x582f06[_0x5d87('0xd0')]=0x0;_0x582f06[_0x5d87('0x29')]=moment()[_0x5d87('0x48')](_0x5d87('0xca'));loggerPredictive[_0x5d87('0x4c')](_0x582f06[_0x5d87('0x49')],_0x5d87('0x1d1'),_0x582f06['startPredictive']);clearInterval(_0x582f06['handlePredictive']);_0x582f06['handlePredictive']=undefined;hopperUtils[_0x5d87('0x1cd')](_0x582f06['dialPredictiveInterval'])['then'](this[_0x5d87('0x1ce')](_0x582f06))['then'](mergeDataErlangB(_0x582f06))[_0x5d87('0x9f')](this[_0x5d87('0x1cf')](_0x582f06))['catch'](loggerCatchPredictive(_0x5d87('0x1d2'),_0x582f06));}else if(_0x582f06[_0x5d87('0x1bb')]&&_0x2241ce<_0x582f06[_0x5d87('0x1bb')]-_0x4bc36a){clearPredictiveAttributes(_0x582f06);loggerPredictive['info'](_0x582f06[_0x5d87('0x49')],_0x5d87('0x1d3'),_0x2241ce,_0x5d87('0x1d4'),_0x582f06[_0x5d87('0x1bb')],'-',_0x4bc36a,'=',_0x582f06[_0x5d87('0x1bb')]-_0x4bc36a,')');}else if(_0x582f06[_0x5d87('0x1bb')]&&_0x2241ce>_0x582f06[_0x5d87('0x1bb')]+_0x250c73){clearPredictiveAttributes(_0x582f06);loggerPredictive[_0x5d87('0x4c')](_0x582f06['name'],_0x5d87('0x1d3'),_0x2241ce,_0x5d87('0x1d5'),_0x582f06[_0x5d87('0x1bb')],'+',_0x250c73,'=',_0x582f06['predictiveIntervalAvailable']+_0x250c73,')');}};Dialer[_0x5d87('0x1b')][_0x5d87('0x1ce')]=function(_0x3ca2ec){var _0x2fe622=this;return function(_0xca3177){return new Promise(function(_0x591126,_0x3d5036){_['merge'](_0x3ca2ec,_0xca3177[0x0]);if(checkGetDataPredictive(_0xca3177[0x0])){var _0x446b40=_0x3ca2ec[_0x5d87('0x1bb')]=_0x3ca2ec[_0x5d87('0x1d6')]+_0x3ca2ec['available'];var _0x46e596=_0x3ca2ec[_0x5d87('0x1c5')]*0x3c;var _0x2549f1=_0xca3177[0x0][_0x5d87('0x54')]+_0xca3177[0x0][_0x5d87('0x52')];var _0x357f56=(_0xca3177[0x0][_0x5d87('0x4e')]+_0xca3177[0x0]['predictiveIntervalDroppedCallsTimeout']+_0xca3177[0x0][_0x5d87('0xe8')])/_0xca3177[0x0][_0x5d87('0x4d')];_0x3ca2ec[_0x5d87('0x1d7')]=_0x357f56>0x0?_0x357f56:0x1;switch(_0x3ca2ec[_0x5d87('0x1d8')]){case _0x5d87('0x1c7'):var _0xf5dac9=_0x3ca2ec[_0x5d87('0x1b9')]/0x64;return _0x2fe622[_0x5d87('0x1d9')](_0x446b40,_0x46e596,_0x2549f1,_0x357f56,_0xf5dac9)[_0x5d87('0x9f')](function(_0x15aa2b){return _0x591126(_0x15aa2b);});case _0x5d87('0x1da'):var _0xf663a1=_0x3ca2ec[_0x5d87('0x1b9')]/0x64;return _0x2fe622['busyFactor'](_0x446b40,_0x46e596,_0x2549f1,_0x357f56,_0xf663a1)['then'](function(_0xf6a55b){return _0x591126(_0xf6a55b);});default:return _0x3d5036(msgResponse('[getDataPredictive]',_0x5d87('0x94'),_0x5d87('0x1db')));}}else{return _0x3d5036(msgResponse(_0x5d87('0x1dc'),_0x5d87('0x94'),_0x5d87('0x1dd')));}});};};Dialer[_0x5d87('0x1b')][_0x5d87('0x1de')]=function(_0x45c414){var _0x1a01aa=this;return function(_0x28f350){return new Promise(function(_0xbe5ce1,_0x45c87d){_[_0x5d87('0x60')](_0x45c414,_0x28f350[0x0]);if(checkGetDataPredictive(_0x28f350[0x0])){loggerPredictive[_0x5d87('0x4c')](JSON[_0x5d87('0x85')](_0x28f350[0x0]));if(_0x45c414['dialPredictiveOptimization']===_0x5d87('0x1c7')){return _0x1a01aa[_0x5d87('0x152')](_0x45c414['id'])['then'](function(_0x460258){var _0x5a8819=_0x45c414[_0x5d87('0x1df')]-_0x460258[0x0][_0x5d87('0x1e0')];var _0x1ef750=_0x45c414['dialPredictiveInterval']*0x3c;var _0x2ed785=_0x28f350[0x0][_0x5d87('0x54')]+_0x28f350[0x0]['predictiveIntervalAvgHoldtime'];var _0x25f30b=(_0x28f350[0x0]['predictiveIntervalAnsweredCalls']+_0x28f350[0x0][_0x5d87('0x50')]+_0x28f350[0x0][_0x5d87('0xe8')])/_0x28f350[0x0][_0x5d87('0x4d')];var _0x41f49b=_0x45c414[_0x5d87('0x1b9')]/0x64;_0x45c414['predictiveIntervalPauses']=_0x460258[0x0]['outboundQueuePauses']||0x0;_0x45c414[_0x5d87('0x1d7')]=_0x25f30b>0x0?_0x25f30b:0x1;return _0x1a01aa['abandonmentRate'](_0x5a8819,_0x1ef750,_0x2ed785,_0x25f30b,_0x41f49b);})['then'](function(_0x17f021){return _0xbe5ce1(_0x17f021);})[_0x5d87('0xa2')](function(_0x1fe378){return _0x45c87d(msgResponse(_0x5d87('0x1e1'),_0x5d87('0x94'),JSON[_0x5d87('0x85')](_0x1fe378)));});}if(_0x45c414[_0x5d87('0x1d8')]===_0x5d87('0x1da')){return _0x1a01aa[_0x5d87('0x152')](_0x45c414['id'])['then'](function(_0x2e9481){var _0x434a21=_0x45c414[_0x5d87('0x1df')]-_0x2e9481[0x0][_0x5d87('0x1e0')];var _0x2744ef=_0x45c414[_0x5d87('0x1c5')]*0x3c;var _0x45dbda=_0x28f350[0x0]['predictiveIntervalAvgTalktime']+_0x28f350[0x0][_0x5d87('0x52')];var _0x3d21e8=(_0x28f350[0x0][_0x5d87('0x4e')]+_0x28f350[0x0][_0x5d87('0x50')]+_0x28f350[0x0][_0x5d87('0xe8')])/_0x28f350[0x0][_0x5d87('0x4d')];var _0x32bdfd=_0x45c414[_0x5d87('0x1b9')]/0x64;_0x45c414[_0x5d87('0x1e2')]=_0x2e9481[0x0][_0x5d87('0x1e0')]||0x0;_0x45c414[_0x5d87('0x1d7')]=_0x3d21e8>0x0?_0x3d21e8:0x1;return _0x1a01aa['busyFactor'](_0x434a21,_0x2744ef,_0x45dbda,_0x3d21e8,_0x32bdfd);})['then'](function(_0x1141eb){return _0xbe5ce1(_0x1141eb);})['catch'](function(_0x552a03){return _0x45c87d(msgResponse('[CatchErlangB]','Failure',JSON['stringify'](_0x552a03)));});}}else{return _0x45c87d(msgResponse(_0x5d87('0x1dc'),'Failure',_0x5d87('0x1dd')));}});};};Dialer['prototype']['startMethodPredictive']=function(_0x124f01){var _0xb682c0=this;return function(){var _0x29acfd=0x0;var _0x2b00fb=Math['floor'](_0x124f01['erlangCallToSecond']*0x3e8);if(_0x2b00fb>0x0){_0x2b00fb=_0x2b00fb<0x64?0x64:_0x2b00fb;loggerPredictive[_0x5d87('0x4c')](_0x124f01[_0x5d87('0x49')],_0x5d87('0x1e3'),_0x2b00fb,_0x5d87('0x1e4'));_0x124f01['handlePredictive']=setInterval(function(){_0xb682c0['handlePredictive'](_0x124f01);loggerPredictiveCalls[_0x5d87('0x4c')]('[handlePredictive]',_0x29acfd+=0x1);},_0x2b00fb);}else{loggerPredictive['info'](_0x124f01[_0x5d87('0x49')],'fail\x20to\x20scheduled\x20calls');}};};Dialer[_0x5d87('0x1b')][_0x5d87('0x1e5')]=function(_0xfb07c3,_0x38d810){var _0x2a9f14=this;return function(_0x8a4fb9){if(_[_0x5d87('0x4b')](_0x8a4fb9)){if(_[_0x5d87('0xf8')](_0x38d810['UserId'])||!_0x38d810[_0x5d87('0x1e6')]){if(_0xfb07c3[_0x5d87('0xaf')]===_0x5d87('0xa')){_0xfb07c3['queueStatusComplete']=_['isUndefined'](_0xfb07c3[_0x5d87('0x1e7')])?!![]:_0xfb07c3[_0x5d87('0x1e7')];var _0x271220=uuid['v4']();_0x2a9f14['actions'][_0x271220]=new Action(_0xfb07c3,_0x38d810,_0x271220);loggerBooked[_0x5d87('0x4c')](_0x5d87('0x1e8'),_0x271220,_0x5d87('0x1e9'),JSON[_0x5d87('0x85')](_0xfb07c3[_0x5d87('0x1e7')]),'Queue:\x20',_0xfb07c3[_0x5d87('0x49')]);if(_0xfb07c3[_0x5d87('0x1e7')]){_0xfb07c3[_0x5d87('0x1e7')]=![];_0x2a9f14[_0x5d87('0x2c')][_0x2a9f14[_0x5d87('0x26')][_0x271220]['queue']]=[];ami[_0x5d87('0x9c')]({'actionid':_0x271220,'action':_0x5d87('0x1ea'),'queue':_0xfb07c3['name']})[_0x5d87('0xa2')](function(){_0x2a9f14[_0x5d87('0xc2')](_0xfb07c3);hopperUtils['rescheduleContact']({'active':![],'ContactId':_0x2a9f14['actions'][_0x271220][_0x5d87('0xdf')],'ListId':_0x2a9f14[_0x5d87('0x26')][_0x271220][_0x5d87('0xe0')],'VoiceQueueId':_0x2a9f14[_0x5d87('0x26')][_0x271220][_0x5d87('0xe1')]||undefined,'CampaignId':_0x2a9f14[_0x5d87('0x26')][_0x271220][_0x5d87('0xef')]||undefined})[_0x5d87('0xa2')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x2a9f14[_0x5d87('0x26')][_0x271220];});}else{loggerBooked['info'](_0x5d87('0x1eb'),JSON[_0x5d87('0x85')](_0xfb07c3[_0x5d87('0x1e7')]),_0x5d87('0x1ec'),_0xfb07c3['name']);_0x2a9f14['updateOriginated'](_0xfb07c3);hopperUtils[_0x5d87('0xdb')]({'active':![],'ContactId':_0x2a9f14[_0x5d87('0x26')][_0x271220][_0x5d87('0xdf')],'ListId':_0x2a9f14[_0x5d87('0x26')][_0x271220][_0x5d87('0xe0')],'VoiceQueueId':_0x2a9f14[_0x5d87('0x26')][_0x271220][_0x5d87('0xe1')]||undefined,'CampaignId':_0x2a9f14[_0x5d87('0x26')][_0x271220][_0x5d87('0xef')]||undefined})[_0x5d87('0xa2')](loggerCatch(_0x5d87('0x1ed')));delete _0x2a9f14['actions'][_0x271220];}}else{return _0x2a9f14['actionOriginate'](_0xfb07c3,_0x38d810);}}else{if(utils[_0x5d87('0x61')](undefined,_0x38d810[_0x5d87('0x1ee')])<_0xfb07c3[_0x5d87('0x1ef')]*0x3c){if(_0x38d810['Agent']&&!_0x38d810['Agent'][_0x5d87('0x1f0')]){_0x2a9f14['preview'][_0x5d87('0x104')](_0x38d810['id'])[_0x5d87('0x1e')](function(){_0x2a9f14[_0x5d87('0xc2')](_0xfb07c3);});}else{hopperUtils[_0x5d87('0x1f1')]({'active':![]},_0x38d810['id'],0x1)['finally'](function(){_0x2a9f14[_0x5d87('0xc2')](_0xfb07c3);});}}else{_0xfb07c3[_0x5d87('0x1f2')]+=0x1;_0x2a9f14[_0x5d87('0xc2')](_0xfb07c3);if(_0xfb07c3[_0x5d87('0x1f3')]){hopperUtils['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x38d810[_0x5d87('0xdf')],'ListId':_0x38d810['ListId'],'VoiceQueueId':_0x38d810['VoiceQueueId']||undefined,'CampaignId':_0x38d810[_0x5d87('0xef')]||undefined})[_0x5d87('0xa2')](loggerCatch('[rescheduleContact][dialRecallInQueue]'));hopperUtils[_0x5d87('0xe5')](createObjHistory(_0xfb07c3,_0x38d810,utils[_0x5d87('0x6b')][_0x5d87('0x1f4')],0x17,_0x5d87('0x1f5')))[_0x5d87('0xa2')](loggerCatch(_0x5d87('0x1f6')));}else{_0x2a9f14[_0x5d87('0x11d')](createObjHistory(_0xfb07c3,_0x38d810,utils[_0x5d87('0x6b')]['RECALL_TIMEOUT'],0x16,_0x5d87('0x1f7')),'[Originate][HistoryRecallClose][historyCatch]',_0x5d87('0x1f8'));}}}}else{_0xfb07c3[_0x5d87('0x1f9')]+=0x1;_0x2a9f14[_0x5d87('0x11d')](createObjHistory(_0xfb07c3,_0x38d810,utils[_0x5d87('0x6b')][_0x5d87('0x1fa')],0xd,_0x5d87('0x1fb')),'[Originate][historyBlacklist]',_0x5d87('0x1fc'));throw _0x5d87('0x1fd');}};};Dialer[_0x5d87('0x1b')][_0x5d87('0x1fe')]=function(_0x549d19){var _0x1e7c32=this;var _0x3352e5=_0x549d19['limitCalls']-_0x549d19['originated'];emitCampaignSummary(_0x549d19);if(_0x3352e5>0x0&&_0x549d19[_0x5d87('0x67')]==0x0){if(_0x3352e5>this[_0x5d87('0x24')]){_0x3352e5=this['maxNumberOriginate'];}_0x549d19[_0x5d87('0x67')]=0x1;hopperUtils[_0x5d87('0x1ff')](_0x549d19,_0x3352e5)[_0x5d87('0x9f')](function(_0x22ec56){_0x549d19[_0x5d87('0x67')]=0x0;if(_0x22ec56){if(!utils['checkContactEmpty'](_0x22ec56)){_0x549d19[_0x5d87('0x6a')]=utils[_0x5d87('0x6b')]['NO_AVAILABLE_CONTACTS'];logger[_0x5d87('0x4c')](_0x5d87('0x200')+_0x549d19['name']);}else{_0x549d19['originated']+=_0x22ec56['length'];_0x549d19[_0x5d87('0x6a')]=utils[_0x5d87('0x6b')][_0x5d87('0x201')];for(var _0xd65cee=0x0;_0xd65cee<_0x22ec56[_0x5d87('0x9a')];_0xd65cee+=0x1){_0x549d19[_0x5d87('0x202')]+=0x1;if(_[_0x5d87('0xf8')](_0x22ec56[_0xd65cee])||_[_0x5d87('0xf8')](_0x22ec56[_0xd65cee][_0x5d87('0x179')])||_['isNil'](_0x22ec56[_0xd65cee][_0x5d87('0x160')])){_0x1e7c32[_0x5d87('0x203')](_0x5d87('0x204'),_0x549d19,_0x22ec56[_0xd65cee]);}else{hopperUtils[_0x5d87('0x205')](_[_0x5d87('0x75')](_0x22ec56[_0xd65cee],['CampaignId','phone']))['then'](_0x1e7c32[_0x5d87('0x1e5')](_0x549d19,_0x22ec56[_0xd65cee]))['catch'](_0x1e7c32[_0x5d87('0x156')](_0x5d87('0x206'),_0x549d19));}}}}})[_0x5d87('0xa2')](loggerGetContactDialer(_0x5d87('0x207'),_0x549d19,_0x3352e5));}};Dialer[_0x5d87('0x1b')][_0x5d87('0xb3')]=function(_0x20d85c,_0x2b9f0a){var _0x3b823e=this;var _0x8799a9=[];if(_0x2b9f0a<0x1||_0x20d85c[_0x5d87('0xaf')]===_0x5d87('0xa')){_0x2b9f0a=0x1;}var _0x214567=Math[_0x5d87('0x1be')](_0x20d85c['available']*_0x2b9f0a)-_0x20d85c[_0x5d87('0x80')];if(_0x20d85c['dialLimitQueue']>0x0){var _0x3bf207=_0x20d85c[_0x5d87('0x208')]-_0x20d85c['originated']-_0x20d85c[_0x5d87('0x1d6')]-_0x20d85c[_0x5d87('0x141')];if(_0x214567>_0x3bf207){_0x214567=_0x3bf207;}}if(_0x214567>0x0&&_0x20d85c[_0x5d87('0x67')]==0x0){if(_0x20d85c[_0x5d87('0xaf')]===_0x5d87('0xa')){_0x214567=0x1;}if(_0x214567>this[_0x5d87('0x24')]){_0x214567=this[_0x5d87('0x24')];}for(var _0x4ce18b in this[_0x5d87('0x22')]){if(typeof this[_0x5d87('0x22')][_0x4ce18b]!==_0x5d87('0x153')){if(this[_0x5d87('0x22')][_0x4ce18b][_0x5d87('0xd1')]===_0x5d87('0x209')&&this[_0x5d87('0x22')][_0x4ce18b]['status']===_0x5d87('0x8a')){_0x8799a9[_0x5d87('0x9b')](this[_0x5d87('0x22')][_0x4ce18b]['id']);}}}_0x20d85c[_0x5d87('0x67')]=0x1;hopperUtils[_0x5d87('0x20a')](_0x20d85c,_0x8799a9,_0x214567)['then'](function(_0x1ded2f){_0x20d85c['temp']=0x0;if(_0x1ded2f){if(!utils['checkContactEmpty'](_0x1ded2f)){hopperUtils[_0x5d87('0x20b')](_0x20d85c)[_0x5d87('0x9f')](sendMessageReschedule(_0x20d85c))[_0x5d87('0xa2')](loggerCatch(_0x5d87('0x20c')));}else{_0x20d85c[_0x5d87('0x80')]+=_0x1ded2f['length'];_0x20d85c[_0x5d87('0x6a')]=_0x20d85c[_0x5d87('0xaf')]===_0x5d87('0xa')?utils[_0x5d87('0x6b')]['ACTIVE']:utils[_0x5d87('0x6b')][_0x5d87('0x201')];for(var _0x34c6f4=0x0;_0x34c6f4<_0x1ded2f['length'];_0x34c6f4+=0x1){if(_['isNil'](_0x1ded2f[_0x34c6f4])||_[_0x5d87('0xf8')](_0x1ded2f[_0x34c6f4]['Contact'])||_[_0x5d87('0xf8')](_0x1ded2f[_0x34c6f4][_0x5d87('0x160')])){_0x3b823e[_0x5d87('0x203')](_0x5d87('0x204'),_0x20d85c,_0x1ded2f[_0x34c6f4]);}else{hopperUtils[_0x5d87('0x20d')](_[_0x5d87('0x75')](_0x1ded2f[_0x34c6f4],[_0x5d87('0xe1'),_0x5d87('0x160')]))[_0x5d87('0x9f')](_0x3b823e[_0x5d87('0x1e5')](_0x20d85c,_0x1ded2f[_0x34c6f4]))[_0x5d87('0xa2')](_0x3b823e[_0x5d87('0x156')](_0x5d87('0x204'),_0x20d85c));}}}}})[_0x5d87('0xa2')](loggerGetContactDialer(_0x5d87('0x20e'),_0x20d85c,_0x214567));}};Dialer[_0x5d87('0x1b')][_0x5d87('0x63')]=function(_0x29bab8){if(_0x29bab8[_0x5d87('0x208')]>0x0){var _0x3d4793=_0x29bab8[_0x5d87('0x208')]-_0x29bab8[_0x5d87('0x80')]-_0x29bab8[_0x5d87('0x1d6')];if(_0x3d4793>0x0&&_0x29bab8[_0x5d87('0x67')]==0x0){this[_0x5d87('0x20f')](_0x29bab8);}else{loggerPredictiveCalls[_0x5d87('0x4c')](_0x5d87('0x210'));}}else{this['tryOriginatePredictive'](_0x29bab8);}};Dialer['prototype'][_0x5d87('0x20f')]=function(_0x1a0eff){var _0x1f1ab0=this;var _0x4a7d6e=[];_0x1a0eff['originated']+=0x1;for(var _0xfa0379 in this[_0x5d87('0x22')]){if(typeof this[_0x5d87('0x22')][_0xfa0379]!==_0x5d87('0x153')){if(this[_0x5d87('0x22')][_0xfa0379][_0x5d87('0xd1')]===_0x5d87('0x209')&&this[_0x5d87('0x22')][_0xfa0379][_0x5d87('0x89')]===_0x5d87('0x8a')){_0x4a7d6e[_0x5d87('0x9b')](this[_0x5d87('0x22')][_0xfa0379]['id']);}}}_0x1a0eff[_0x5d87('0x67')]=0x1;return this['getContactDialer'](_0x1a0eff['id'],_0x4a7d6e,0x1,_0x1a0eff['dialOrderByScheduledAt'],_0x1a0eff)['then'](function(_0x34be4d){_0x1a0eff[_0x5d87('0x67')]=0x1;if(_0x34be4d){if(!utils[_0x5d87('0x211')](_0x34be4d)){utils['checkContactLowerLimitOriginate'](_0x1a0eff,0x1,0x0);return hopperUtils[_0x5d87('0x20b')](_0x1a0eff)[_0x5d87('0x9f')](sendMessageReschedule(_0x1a0eff))[_0x5d87('0xa2')](loggerCatch('[countReScheduled]\x20'));}else{_0x1a0eff[_0x5d87('0x6a')]=utils['CAMPAIGN_STATUS'][_0x5d87('0x201')];if(_[_0x5d87('0xf8')](_0x34be4d[0x0])||_[_0x5d87('0xf8')](_0x34be4d[0x0][_0x5d87('0x179')])||_[_0x5d87('0xf8')](_0x34be4d[0x0]['phone'])){_0x1f1ab0[_0x5d87('0x203')](_0x5d87('0x204'),_0x1a0eff,_0x34be4d[0x0]);}else{return hopperUtils[_0x5d87('0x20d')](_[_0x5d87('0x75')](_0x34be4d[0x0],[_0x5d87('0xe1'),_0x5d87('0x160')]))['then'](_0x1f1ab0['checkContactBlack'](_0x1a0eff,_0x34be4d[0x0]))[_0x5d87('0xa2')](_0x1f1ab0[_0x5d87('0x156')](_0x5d87('0x212'),_0x1a0eff));}}}})[_0x5d87('0xa2')](loggerGetContactDialer('[getContactDialerPredictive]',_0x1a0eff,0x1));};Dialer[_0x5d87('0x1b')][_0x5d87('0x1d9')]=function(_0x3951be,_0x1f14d4,_0x3adac6,_0x59da7c,_0x11ae07,_0x592e52){loggerPredictive[_0x5d87('0x4c')](_0x5d87('0x213'));loggerPredictive['info'](_0x5d87('0x214'),_0x3951be);loggerPredictive[_0x5d87('0x4c')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1f14d4);loggerPredictive[_0x5d87('0x4c')](_0x5d87('0x215'),_0x3adac6);loggerPredictive[_0x5d87('0x4c')](_0x5d87('0x216'),_0x59da7c);loggerPredictive['info'](_0x5d87('0x217'),_0x11ae07);loggerPredictive[_0x5d87('0x4c')](_0x5d87('0x55'));return new Promise(function(_0x38eb51,_0x1fcd56){if(_0x3951be<=0x0||isNaN(_0x3951be)){return _0x1fcd56(msgResponse(_0x5d87('0x218'),'Error',_0x5d87('0x219')+_0x3951be));}if(_0x3adac6<=0x0||isNaN(_0x3adac6)){return _0x1fcd56(msgResponse(_0x5d87('0x218'),_0x5d87('0xbe'),'Ts\x20=\x20'+_0x3adac6));}if(_0x59da7c<=0x0||isNaN(_0x59da7c)){return _0x1fcd56(msgResponse(_0x5d87('0x218'),_0x5d87('0xbe'),_0x5d87('0x21a')+_0x59da7c));}if(_0x1f14d4<=0x0||isNaN(_0x1f14d4)){return _0x1fcd56(msgResponse(_0x5d87('0x218'),_0x5d87('0xbe'),_0x5d87('0x21b')+_0x1f14d4));}if(_0x11ae07<=0x0||isNaN(_0x11ae07)){return _0x1fcd56(msgResponse('[abandonmentRate]',_0x5d87('0xbe'),_0x5d87('0x21c')+_0x11ae07));}_0x592e52=_0x592e52||0x0;var _0x2fd8ce=0x1/_0x3adac6;var _0x5d0001=0x0;var _0x397076=0x0;var _0x16f8fc=0x0;var _0x35de1f=0x0;for(var _0x535700=0x0;_0x16f8fc<_0x11ae07;_0x535700+=0x1){_0x397076=_0x535700/_0x1f14d4;_0x5d0001=(_0x59da7c*_0x397076+_0x592e52)/_0x2fd8ce;_0x16f8fc=utils['erlangb'](_0x5d0001,_0x3951be);_0x35de1f=_0x5d0001/_0x3951be*(0x1-utils[_0x5d87('0x21d')](_0x5d0001,_0x3951be));}return _0x38eb51({'erlangCalls':_0x535700,'erlangCallToSecond':_0x1f14d4/_0x535700,'erlangAbandonmentRate':_0x16f8fc,'erlangBusyFactor':_0x35de1f});});};Dialer['prototype'][_0x5d87('0x21e')]=function(_0x972dc8,_0x14b6d4,_0x84ddc6,_0x477549,_0x830e7e,_0x1f2ffd){loggerPredictive[_0x5d87('0x4c')]('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive[_0x5d87('0x4c')](_0x5d87('0x214'),_0x972dc8);loggerPredictive[_0x5d87('0x4c')](_0x5d87('0x21f'),_0x14b6d4);loggerPredictive['info'](_0x5d87('0x215'),_0x84ddc6);loggerPredictive[_0x5d87('0x4c')](_0x5d87('0x216'),_0x477549);loggerPredictive[_0x5d87('0x4c')]('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x830e7e);loggerPredictive[_0x5d87('0x4c')](_0x5d87('0x55'));return new Promise(function(_0x5e1356,_0x233432){if(_0x972dc8<=0x0||isNaN(_0x972dc8)){return _0x233432(msgResponse(_0x5d87('0x220'),_0x5d87('0xbe'),_0x5d87('0x219')+_0x972dc8));}if(_0x84ddc6<=0x0||isNaN(_0x84ddc6)){return _0x233432(msgResponse('[busyFactor]',_0x5d87('0xbe'),_0x5d87('0x221')+_0x84ddc6));}if(_0x477549<=0x0||isNaN(_0x477549)){return _0x233432(msgResponse(_0x5d87('0x220'),_0x5d87('0xbe'),'p\x20=\x20'+_0x477549));}if(_0x14b6d4<=0x0||isNaN(_0x14b6d4)){return _0x233432(msgResponse(_0x5d87('0x220'),_0x5d87('0xbe'),'interval\x20=\x20'+_0x14b6d4));}if(_0x830e7e<=0x0||isNaN(_0x830e7e)){return _0x233432(msgResponse(_0x5d87('0x220'),_0x5d87('0xbe'),_0x5d87('0x222')+_0x830e7e));}_0x1f2ffd=_0x1f2ffd||0x0;var _0x31c8a5=0x1/_0x84ddc6;var _0x3b51b0=0x0;var _0x46fb52=0x0;var _0x14e882=0x0;var _0x1d8da2=0x0;for(var _0x11f46f=0x0;_0x1d8da2<_0x830e7e;_0x11f46f+=0x1){_0x46fb52=_0x11f46f/_0x14b6d4;_0x3b51b0=(_0x477549*_0x46fb52+_0x1f2ffd)/_0x31c8a5;_0x14e882=utils[_0x5d87('0x21d')](_0x3b51b0,_0x972dc8);_0x1d8da2=_0x3b51b0/_0x972dc8*(0x1-utils[_0x5d87('0x21d')](_0x3b51b0,_0x972dc8));}return _0x5e1356({'erlangCalls':_0x11f46f,'erlangCallToSecond':_0x14b6d4/_0x11f46f,'erlangAbandonmentRate':_0x14e882,'erlangBusyFactor':_0x1d8da2});});};module[_0x5d87('0x223')]=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 844ae8c..02b6b89 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 _0x5fa2=['countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','ContactFirstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','voiceQueue','dialCutDigit','substring','util','moment','isNil','string','uniqueid','name','Contact','firstName','number','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry'];(function(_0x3ce44d,_0x32f61c){var _0x24b7b5=function(_0x4b7509){while(--_0x4b7509){_0x3ce44d['push'](_0x3ce44d['shift']());}};_0x24b7b5(++_0x32f61c);}(_0x5fa2,0x10e));var _0x25fa=function(_0x59c531,_0x2e1264){_0x59c531=_0x59c531-0x0;var _0x17368d=_0x5fa2[_0x59c531];return _0x17368d;};'use strict';var util=require(_0x25fa('0x0'));var _=require('lodash');var moment=require(_0x25fa('0x1'));function checkNameSurname(_0x110b4c,_0x236b6a,_0x2bb353){var _0x254376='';if(!_[_0x25fa('0x2')](_0x236b6a)&&'string'===typeof _0x236b6a){_0x254376+=_0x236b6a;}if(!_['isNil'](_0x2bb353)&&_0x25fa('0x3')===typeof _0x2bb353){_0x254376+='\x20'+_0x2bb353;}if(_0x254376!==''){return _0x254376;}return _0x110b4c;}function Action(_0x2f896d,_0x1a89c8,_0x3fdd8b){this['voiceQueue']=_0x2f896d;this[_0x25fa('0x4')]=_0x3fdd8b||undefined;this[_0x25fa('0x5')]=checkNameSurname(_0x1a89c8[_0x25fa('0x6')]['phone'],_0x1a89c8[_0x25fa('0x6')][_0x25fa('0x7')],_0x1a89c8[_0x25fa('0x6')]['lastName']);this[_0x25fa('0x8')]=_0x1a89c8['phone'];this[_0x25fa('0x9')]=_0x2f896d[_0x25fa('0x5')];this['active']=_0x1a89c8[_0x25fa('0xa')]||![];this['type']=_0x2f896d[_0x25fa('0xb')];this[_0x25fa('0xc')]=_0x2f896d['dialQueueTimeout']||0x3;this[_0x25fa('0xd')]=_0x1a89c8[_0x25fa('0xd')];this['countbusyretry']=_0x1a89c8[_0x25fa('0xe')];this[_0x25fa('0xf')]=_0x1a89c8['countcongestionretry'];this[_0x25fa('0x10')]=_0x1a89c8[_0x25fa('0x10')];this[_0x25fa('0x11')]=_0x1a89c8[_0x25fa('0x11')];this['countdropretry']=_0x1a89c8['countdropretry'];this[_0x25fa('0x12')]=_0x1a89c8[_0x25fa('0x12')];this['countmachineretry']=_0x1a89c8[_0x25fa('0x13')];this[_0x25fa('0x14')]=_0x1a89c8[_0x25fa('0x14')];this[_0x25fa('0x15')]=_0x1a89c8['ContactId'];this[_0x25fa('0x16')]=_0x1a89c8[_0x25fa('0x16')];this['UserId']=_0x1a89c8[_0x25fa('0x17')];this[_0x25fa('0x18')]=_0x1a89c8[_0x25fa('0x18')];this[_0x25fa('0x19')]=_0x1a89c8['CampaignId'];this['idHopper']=_0x1a89c8['id'];this[_0x25fa('0x1a')]=_0x1a89c8[_0x25fa('0x6')][_0x25fa('0x7')]||'';this[_0x25fa('0x1b')]=moment()[_0x25fa('0x1c')](_0x25fa('0x1d'));this[_0x25fa('0x1e')]=_0x1a89c8[_0x25fa('0x1e')];this[_0x25fa('0x1f')]=_0x1a89c8[_0x25fa('0x1f')];this[_0x25fa('0x20')]=_0x1a89c8[_0x25fa('0x20')];this[_0x25fa('0x21')]=_0x1a89c8[_0x25fa('0x21')];this['originatecalleridnum']='';this[_0x25fa('0x22')]='';}Action[_0x25fa('0x23')][_0x25fa('0x24')]=function(){return util['format'](_0x25fa('0x25'),this[_0x25fa('0x5')],this[_0x25fa('0x26')][_0x25fa('0x27')]>0x0?this[_0x25fa('0x8')][_0x25fa('0x28')](this[_0x25fa('0x26')][_0x25fa('0x27')]):this[_0x25fa('0x8')]);};Action['prototype']['getQueue']=function(){return this[_0x25fa('0x9')];};module['exports']=Action; \ No newline at end of file +var _0xb9d0=['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','prototype','getCaller','\x22%s\x22\x20<%s>','substring','dialCutDigit','getQueue','exports','lodash','moment','isNil','voiceQueue','uniqueid','name','phone','Contact','firstName','lastName','number','queue','active','type','dialQueueTimeout'];(function(_0x1e8bac,_0x26553c){var _0x2c8cdd=function(_0xd6dcca){while(--_0xd6dcca){_0x1e8bac['push'](_0x1e8bac['shift']());}};_0x2c8cdd(++_0x26553c);}(_0xb9d0,0x161));var _0x0b9d=function(_0x137d94,_0x264352){_0x137d94=_0x137d94-0x0;var _0x203863=_0xb9d0[_0x137d94];return _0x203863;};'use strict';var util=require('util');var _=require(_0x0b9d('0x0'));var moment=require(_0x0b9d('0x1'));function checkNameSurname(_0x42c179,_0x5dcd76,_0x33bc74){var _0x42a176='';if(!_[_0x0b9d('0x2')](_0x5dcd76)&&'string'===typeof _0x5dcd76){_0x42a176+=_0x5dcd76;}if(!_[_0x0b9d('0x2')](_0x33bc74)&&'string'===typeof _0x33bc74){_0x42a176+='\x20'+_0x33bc74;}if(_0x42a176!==''){return _0x42a176;}return _0x42c179;}function Action(_0x158e6f,_0x5ba78d,_0x32b050){this[_0x0b9d('0x3')]=_0x158e6f;this[_0x0b9d('0x4')]=_0x32b050||undefined;this[_0x0b9d('0x5')]=checkNameSurname(_0x5ba78d['Contact'][_0x0b9d('0x6')],_0x5ba78d[_0x0b9d('0x7')][_0x0b9d('0x8')],_0x5ba78d[_0x0b9d('0x7')][_0x0b9d('0x9')]);this[_0x0b9d('0xa')]=_0x5ba78d[_0x0b9d('0x6')];this[_0x0b9d('0xb')]=_0x158e6f['name'];this[_0x0b9d('0xc')]=_0x5ba78d[_0x0b9d('0xc')]||![];this['type']=_0x158e6f[_0x0b9d('0xd')];this[_0x0b9d('0xe')]=_0x158e6f[_0x0b9d('0xe')]||0x3;this[_0x0b9d('0xf')]=_0x5ba78d['scheduledat'];this[_0x0b9d('0x10')]=_0x5ba78d['countbusyretry'];this[_0x0b9d('0x11')]=_0x5ba78d[_0x0b9d('0x11')];this[_0x0b9d('0x12')]=_0x5ba78d[_0x0b9d('0x12')];this['countnosuchnumberretry']=_0x5ba78d[_0x0b9d('0x13')];this[_0x0b9d('0x14')]=_0x5ba78d[_0x0b9d('0x14')];this[_0x0b9d('0x15')]=_0x5ba78d[_0x0b9d('0x15')];this[_0x0b9d('0x16')]=_0x5ba78d[_0x0b9d('0x16')];this[_0x0b9d('0x17')]=_0x5ba78d[_0x0b9d('0x17')];this[_0x0b9d('0x18')]=_0x5ba78d[_0x0b9d('0x18')];this[_0x0b9d('0x19')]=_0x5ba78d[_0x0b9d('0x19')];this['UserId']=_0x5ba78d[_0x0b9d('0x1a')];this['VoiceQueueId']=_0x5ba78d[_0x0b9d('0x1b')];this['CampaignId']=_0x5ba78d[_0x0b9d('0x1c')];this[_0x0b9d('0x1d')]=_0x5ba78d['id'];this[_0x0b9d('0x1e')]=_0x5ba78d['Contact']['firstName']||'';this['starttime']=moment()[_0x0b9d('0x1f')](_0x0b9d('0x20'));this[_0x0b9d('0x21')]=_0x5ba78d['callback'];this[_0x0b9d('0x22')]=_0x5ba78d[_0x0b9d('0x22')];this[_0x0b9d('0x23')]=_0x5ba78d[_0x0b9d('0x23')];this['recallme']=_0x5ba78d[_0x0b9d('0x24')];this[_0x0b9d('0x25')]='';this[_0x0b9d('0x26')]='';}Action[_0x0b9d('0x27')][_0x0b9d('0x28')]=function(){return util['format'](_0x0b9d('0x29'),this[_0x0b9d('0x5')],this[_0x0b9d('0x3')]['dialCutDigit']>0x0?this[_0x0b9d('0xa')][_0x0b9d('0x2a')](this[_0x0b9d('0x3')][_0x0b9d('0x2b')]):this[_0x0b9d('0xa')]);};Action[_0x0b9d('0x27')][_0x0b9d('0x2c')]=function(){return this[_0x0b9d('0xb')];};module[_0x0b9d('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 4135470..cff5337 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 _0x9390=['countcongestionretry','countglobal','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countdropretry','countagentrejectretry','uniqueid','calleridname','name','number','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','holdtime','talktime','queue','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','exports','moment','../utils','state','statedesc','scheduledat','type','campaigntype','countbusyretry'];(function(_0x1c61c3,_0x59e425){var _0x38e02f=function(_0x57ddd1){while(--_0x57ddd1){_0x1c61c3['push'](_0x1c61c3['shift']());}};_0x38e02f(++_0x59e425);}(_0x9390,0x1c4));var _0x0939=function(_0x49c288,_0x3cdc7e){_0x49c288=_0x49c288-0x0;var _0x589e41=_0x9390[_0x49c288];return _0x589e41;};'use strict';var moment=require(_0x0939('0x0'));var utils=require(_0x0939('0x1'));function AgentComplete(_0x4bc28d,_0x29c087){this[_0x0939('0x2')]=0x4;this[_0x0939('0x3')]='Answer';this[_0x0939('0x4')]=_0x4bc28d[_0x0939('0x4')];this[_0x0939('0x5')]=_0x4bc28d['type'];this[_0x0939('0x6')]=_0x4bc28d[_0x0939('0x5')]==='outbound'?'queue':_0x4bc28d[_0x0939('0x5')];this[_0x0939('0x7')]=_0x4bc28d[_0x0939('0x7')];this['countcongestionretry']=_0x4bc28d[_0x0939('0x8')];this['countnoanswerretry']=_0x4bc28d['countnoanswerretry'];this[_0x0939('0x9')]=_0x4bc28d[_0x0939('0x7')]+_0x4bc28d['countcongestionretry']+_0x4bc28d[_0x0939('0xa')]+_0x4bc28d[_0x0939('0xb')]+_0x4bc28d['countdropretry']+_0x4bc28d[_0x0939('0xc')]+_0x4bc28d[_0x0939('0xd')]+_0x4bc28d['countagentrejectretry'];this[_0x0939('0xb')]=_0x4bc28d[_0x0939('0xb')];this[_0x0939('0xe')]=_0x4bc28d[_0x0939('0xe')];this[_0x0939('0xc')]=_0x4bc28d[_0x0939('0xc')];this['countmachineretry']=_0x4bc28d[_0x0939('0xd')];this[_0x0939('0xf')]=_0x4bc28d[_0x0939('0xf')];this[_0x0939('0x10')]=_0x29c087[_0x0939('0x10')];this[_0x0939('0x11')]=_0x4bc28d[_0x0939('0x12')];this['calleridnum']=_0x4bc28d[_0x0939('0x13')];this[_0x0939('0x14')]=_0x4bc28d[_0x0939('0x14')];this['responsetime']=_0x4bc28d[_0x0939('0x15')];this[_0x0939('0x16')]=_0x4bc28d[_0x0939('0x16')];this[_0x0939('0x17')]=moment()[_0x0939('0x18')](_0x0939('0x19'));this[_0x0939('0x1a')]=utils[_0x0939('0x1b')](_0x4bc28d[_0x0939('0x15')],_0x4bc28d['starttime']);this[_0x0939('0x1c')]=utils['getSeconds'](_0x4bc28d['answertime'],_0x4bc28d[_0x0939('0x15')]);this[_0x0939('0x1d')]=utils['getSeconds'](this['endtime'],_0x4bc28d[_0x0939('0x16')]);this[_0x0939('0x1e')]=_0x29c087[_0x0939('0x1e')];this['membername']=_0x29c087[_0x0939('0x1f')];this[_0x0939('0x20')]=_0x29c087[_0x0939('0x20')];this['callback']=_0x4bc28d[_0x0939('0x21')];this[_0x0939('0x22')]=_0x4bc28d['callbackuniqueid'];this['callbackat']=_0x4bc28d[_0x0939('0x23')];this[_0x0939('0x24')]=_0x4bc28d[_0x0939('0x24')];this[_0x0939('0x25')]=_0x4bc28d[_0x0939('0x25')];this['ListId']=_0x4bc28d[_0x0939('0x26')];this[_0x0939('0x27')]=_0x4bc28d['UserId'];this[_0x0939('0x28')]=_0x4bc28d['VoiceQueueId'];this[_0x0939('0x29')]=_0x4bc28d[_0x0939('0x29')];this[_0x0939('0x2a')]=_0x4bc28d[_0x0939('0x2a')]||'';this[_0x0939('0x2b')]=_0x4bc28d[_0x0939('0x2b')]||'';this[_0x0939('0x2c')]=_0x4bc28d[_0x0939('0x2c')];}module[_0x0939('0x2d')]=AgentComplete; \ No newline at end of file +var _0x11e0=['countnoanswerretry','countglobal','countdropretry','countmachineretry','countnosuchnumberretry','countabandonedretry','countagentrejectretry','uniqueid','calleridname','calleridnum','number','starttime','responsetime','answertime','format','YYYY-MM-DD\x20HH:mm:ss','getSeconds','holdtime','talktime','endtime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','agiafterat','exports','moment','../utils','Answer','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry'];(function(_0x5a6e4c,_0x21e51d){var _0x20674b=function(_0x25582f){while(--_0x25582f){_0x5a6e4c['push'](_0x5a6e4c['shift']());}};_0x20674b(++_0x21e51d);}(_0x11e0,0x17a));var _0x011e=function(_0x53b0d1,_0xffa3c9){_0x53b0d1=_0x53b0d1-0x0;var _0x37bc3d=_0x11e0[_0x53b0d1];return _0x37bc3d;};'use strict';var moment=require(_0x011e('0x0'));var utils=require(_0x011e('0x1'));function AgentComplete(_0x2cb610,_0x191ccc){this['state']=0x4;this['statedesc']=_0x011e('0x2');this[_0x011e('0x3')]=_0x2cb610['scheduledat'];this[_0x011e('0x4')]=_0x2cb610[_0x011e('0x4')];this['campaigntype']=_0x2cb610[_0x011e('0x4')]===_0x011e('0x5')?_0x011e('0x6'):_0x2cb610['type'];this[_0x011e('0x7')]=_0x2cb610[_0x011e('0x7')];this[_0x011e('0x8')]=_0x2cb610[_0x011e('0x8')];this[_0x011e('0x9')]=_0x2cb610[_0x011e('0x9')];this[_0x011e('0xa')]=_0x2cb610['countbusyretry']+_0x2cb610[_0x011e('0x8')]+_0x2cb610[_0x011e('0x9')]+_0x2cb610['countnosuchnumberretry']+_0x2cb610[_0x011e('0xb')]+_0x2cb610['countabandonedretry']+_0x2cb610[_0x011e('0xc')]+_0x2cb610['countagentrejectretry'];this[_0x011e('0xd')]=_0x2cb610[_0x011e('0xd')];this[_0x011e('0xb')]=_0x2cb610[_0x011e('0xb')];this['countabandonedretry']=_0x2cb610[_0x011e('0xe')];this[_0x011e('0xc')]=_0x2cb610[_0x011e('0xc')];this[_0x011e('0xf')]=_0x2cb610[_0x011e('0xf')];this[_0x011e('0x10')]=_0x191ccc[_0x011e('0x10')];this[_0x011e('0x11')]=_0x2cb610['name'];this[_0x011e('0x12')]=_0x2cb610[_0x011e('0x13')];this[_0x011e('0x14')]=_0x2cb610[_0x011e('0x14')];this[_0x011e('0x15')]=_0x2cb610[_0x011e('0x15')];this[_0x011e('0x16')]=_0x2cb610[_0x011e('0x16')];this['endtime']=moment()[_0x011e('0x17')](_0x011e('0x18'));this['ringtime']=utils[_0x011e('0x19')](_0x2cb610[_0x011e('0x15')],_0x2cb610[_0x011e('0x14')]);this[_0x011e('0x1a')]=utils[_0x011e('0x19')](_0x2cb610[_0x011e('0x16')],_0x2cb610[_0x011e('0x15')]);this[_0x011e('0x1b')]=utils[_0x011e('0x19')](this[_0x011e('0x1c')],_0x2cb610[_0x011e('0x16')]);this['queue']=_0x191ccc[_0x011e('0x6')];this[_0x011e('0x1d')]=_0x191ccc[_0x011e('0x1d')];this[_0x011e('0x1e')]=_0x191ccc['reason'];this[_0x011e('0x1f')]=_0x2cb610[_0x011e('0x1f')];this[_0x011e('0x20')]=_0x2cb610[_0x011e('0x20')];this[_0x011e('0x21')]=_0x2cb610['callbackat'];this[_0x011e('0x22')]=_0x2cb610[_0x011e('0x22')];this[_0x011e('0x23')]=_0x2cb610[_0x011e('0x23')];this['ListId']=_0x2cb610[_0x011e('0x24')];this[_0x011e('0x25')]=_0x2cb610[_0x011e('0x25')];this[_0x011e('0x26')]=_0x2cb610[_0x011e('0x26')];this[_0x011e('0x27')]=_0x2cb610['CampaignId'];this[_0x011e('0x28')]=_0x2cb610[_0x011e('0x28')]||'';this['originatecalleridname']=_0x2cb610['originatecalleridname']||'';this[_0x011e('0x29')]=_0x2cb610[_0x011e('0x29')];}module[_0x011e('0x2a')]=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 7cb5d69..354ca3f 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 _0x8042=['countmachineretry','calleridname','calleridnum','starttime','responsetime','endtime','holdtime','talktime','callback','callbackuniqueid','callbackat','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countagentrejectretry','countnosuchnumberretry','countabandonedretry'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0x8042,0x1c2));var _0x2804=function(_0x3686f4,_0xd4a373){_0x3686f4=_0x3686f4-0x0;var _0x168f2b=_0x8042[_0x3686f4];return _0x168f2b;};'use strict';function Final(_0x34708b){this[_0x2804('0x0')]=_0x34708b[_0x2804('0x0')];this[_0x2804('0x1')]=_0x34708b[_0x2804('0x1')];this[_0x2804('0x2')]=_0x34708b['type'];this['campaigntype']=_0x34708b['type']==='outbound'?_0x2804('0x3'):_0x34708b[_0x2804('0x2')];this[_0x2804('0x4')]=_0x34708b[_0x2804('0x4')];this[_0x2804('0x5')]=_0x34708b['countcongestionretry'];this[_0x2804('0x6')]=_0x34708b['countnoanswerretry'];this[_0x2804('0x7')]=_0x34708b[_0x2804('0x4')]+_0x34708b[_0x2804('0x5')]+_0x34708b[_0x2804('0x6')]+_0x34708b['countnosuchnumberretry']+_0x34708b[_0x2804('0x8')]+_0x34708b['countabandonedretry']+_0x34708b['countmachineretry']+_0x34708b[_0x2804('0x9')];this['countnosuchnumberretry']=_0x34708b[_0x2804('0xa')];this[_0x2804('0x8')]=_0x34708b[_0x2804('0x8')];this[_0x2804('0xb')]=_0x34708b[_0x2804('0xb')];this[_0x2804('0xc')]=_0x34708b[_0x2804('0xc')];this[_0x2804('0x9')]=_0x34708b['countagentrejectretry'];this[_0x2804('0x3')]=_0x34708b[_0x2804('0x3')];this[_0x2804('0xd')]=_0x34708b[_0x2804('0xd')];this['calleridnum']=_0x34708b[_0x2804('0xe')];this[_0x2804('0xf')]=_0x34708b['starttime'];this[_0x2804('0x10')]=_0x34708b[_0x2804('0x10')];this[_0x2804('0x11')]=_0x34708b[_0x2804('0x10')];this['ringtime']=_0x34708b['ringtime']||0x0;this[_0x2804('0x12')]=_0x34708b[_0x2804('0x12')]||0x0;this[_0x2804('0x13')]=_0x34708b[_0x2804('0x13')]||0x0;this[_0x2804('0x14')]=_0x34708b[_0x2804('0x14')];this[_0x2804('0x15')]=_0x34708b[_0x2804('0x15')];this[_0x2804('0x16')]=_0x34708b[_0x2804('0x16')];this['recallme']=_0x34708b['recallme'];this[_0x2804('0x17')]=_0x34708b[_0x2804('0x17')];this[_0x2804('0x18')]=_0x34708b[_0x2804('0x18')];this['UserId']=_0x34708b[_0x2804('0x19')];this['VoiceQueueId']=_0x34708b[_0x2804('0x1a')];this[_0x2804('0x1b')]=_0x34708b[_0x2804('0x1b')];this[_0x2804('0x1c')]=_0x34708b[_0x2804('0x1c')]||'';this[_0x2804('0x1d')]=_0x34708b[_0x2804('0x1d')]||'';this[_0x2804('0x1e')]=_0x34708b[_0x2804('0x1e')];this[_0x2804('0x1f')]=_0x34708b[_0x2804('0x1f')];}module[_0x2804('0x20')]=Final; \ No newline at end of file +var _0x96b6=['originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum'];(function(_0x7c3553,_0x58020e){var _0x3d2fc5=function(_0x1197d1){while(--_0x1197d1){_0x7c3553['push'](_0x7c3553['shift']());}};_0x3d2fc5(++_0x58020e);}(_0x96b6,0x1cb));var _0x696b=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x96b6[_0x167cc1];return _0x10bc4b;};'use strict';function Final(_0x4d2480){this['uniqueid']=_0x4d2480[_0x696b('0x0')];this['scheduledat']=_0x4d2480[_0x696b('0x1')];this[_0x696b('0x2')]=_0x4d2480[_0x696b('0x2')];this[_0x696b('0x3')]=_0x4d2480['type']===_0x696b('0x4')?_0x696b('0x5'):_0x4d2480[_0x696b('0x2')];this[_0x696b('0x6')]=_0x4d2480[_0x696b('0x6')];this['countcongestionretry']=_0x4d2480[_0x696b('0x7')];this[_0x696b('0x8')]=_0x4d2480[_0x696b('0x8')];this[_0x696b('0x9')]=_0x4d2480[_0x696b('0x6')]+_0x4d2480['countcongestionretry']+_0x4d2480[_0x696b('0x8')]+_0x4d2480[_0x696b('0xa')]+_0x4d2480[_0x696b('0xb')]+_0x4d2480[_0x696b('0xc')]+_0x4d2480[_0x696b('0xd')]+_0x4d2480['countagentrejectretry'];this[_0x696b('0xa')]=_0x4d2480['countnosuchnumberretry'];this[_0x696b('0xb')]=_0x4d2480[_0x696b('0xb')];this['countabandonedretry']=_0x4d2480[_0x696b('0xc')];this[_0x696b('0xd')]=_0x4d2480[_0x696b('0xd')];this['countagentrejectretry']=_0x4d2480['countagentrejectretry'];this[_0x696b('0x5')]=_0x4d2480['queue'];this['calleridname']=_0x4d2480[_0x696b('0xe')];this[_0x696b('0xf')]=_0x4d2480['calleridnum'];this['starttime']=_0x4d2480[_0x696b('0x10')];this[_0x696b('0x11')]=_0x4d2480[_0x696b('0x11')];this[_0x696b('0x12')]=_0x4d2480['responsetime'];this[_0x696b('0x13')]=_0x4d2480['ringtime']||0x0;this[_0x696b('0x14')]=_0x4d2480[_0x696b('0x14')]||0x0;this[_0x696b('0x15')]=_0x4d2480[_0x696b('0x15')]||0x0;this[_0x696b('0x16')]=_0x4d2480['callback'];this[_0x696b('0x17')]=_0x4d2480[_0x696b('0x17')];this[_0x696b('0x18')]=_0x4d2480[_0x696b('0x18')];this['recallme']=_0x4d2480['recallme'];this['ContactId']=_0x4d2480[_0x696b('0x19')];this[_0x696b('0x1a')]=_0x4d2480[_0x696b('0x1a')];this[_0x696b('0x1b')]=_0x4d2480[_0x696b('0x1b')];this[_0x696b('0x1c')]=_0x4d2480['VoiceQueueId'];this[_0x696b('0x1d')]=_0x4d2480[_0x696b('0x1d')];this[_0x696b('0x1e')]=_0x4d2480['originatecalleridnum']||'';this[_0x696b('0x1f')]=_0x4d2480[_0x696b('0x1f')]||'';this[_0x696b('0x20')]=_0x4d2480[_0x696b('0x20')];this[_0x696b('0x21')]=_0x4d2480[_0x696b('0x21')];}module[_0x696b('0x22')]=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 bd9dc80..d547afc 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 _0x8875=['countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','holdtime','talktime','queue','membername','IVR','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','moment','../utils','state','statedesc','Answer','scheduledat','type','outbound','amd','countbusyretry','countcongestionretry','countnoanswerretry'];(function(_0x40a825,_0x3bac79){var _0x273a54=function(_0x5628d8){while(--_0x5628d8){_0x40a825['push'](_0x40a825['shift']());}};_0x273a54(++_0x3bac79);}(_0x8875,0xd5));var _0x5887=function(_0x4db924,_0x53fe30){_0x4db924=_0x4db924-0x0;var _0x11edcf=_0x8875[_0x4db924];return _0x11edcf;};'use strict';var moment=require(_0x5887('0x0'));var utils=require(_0x5887('0x1'));function Hangup(_0x59908d,_0x20573a){this[_0x5887('0x2')]=0x4;this[_0x5887('0x3')]=_0x5887('0x4');this[_0x5887('0x5')]=_0x59908d[_0x5887('0x5')];this['type']=_0x59908d[_0x5887('0x6')];this['campaigntype']=_0x59908d[_0x5887('0x6')]===_0x5887('0x7')?'queue':_0x59908d[_0x5887('0x6')];this[_0x5887('0x8')]=_0x59908d[_0x5887('0x8')]||![];this['countbusyretry']=_0x59908d[_0x5887('0x9')];this[_0x5887('0xa')]=_0x59908d[_0x5887('0xa')];this[_0x5887('0xb')]=_0x59908d['countnoanswerretry'];this[_0x5887('0xc')]=_0x59908d[_0x5887('0x9')]+_0x59908d['countcongestionretry']+_0x59908d['countnoanswerretry']+_0x59908d[_0x5887('0xd')]+_0x59908d[_0x5887('0xe')]+_0x59908d[_0x5887('0xf')]+_0x59908d['countmachineretry']+_0x59908d[_0x5887('0x10')];this['countnosuchnumberretry']=_0x59908d['countnosuchnumberretry'];this[_0x5887('0xe')]=_0x59908d[_0x5887('0xe')];this['countabandonedretry']=_0x59908d[_0x5887('0xf')];this[_0x5887('0x11')]=_0x59908d[_0x5887('0x11')];this[_0x5887('0x10')]=_0x59908d[_0x5887('0x10')];this[_0x5887('0x12')]=_0x20573a[_0x5887('0x12')];this[_0x5887('0x13')]=_0x59908d[_0x5887('0x14')];this[_0x5887('0x15')]=_0x59908d[_0x5887('0x16')];this['starttime']=_0x59908d[_0x5887('0x17')];this[_0x5887('0x18')]=_0x59908d[_0x5887('0x18')];this[_0x5887('0x19')]=moment()['format'](_0x5887('0x1a'));this[_0x5887('0x1b')]=utils[_0x5887('0x1c')](_0x59908d[_0x5887('0x18')],_0x59908d['starttime']);this[_0x5887('0x1d')]=0x0;this[_0x5887('0x1e')]=utils[_0x5887('0x1c')](this[_0x5887('0x19')],_0x59908d[_0x5887('0x18')]);this[_0x5887('0x1f')]=_0x59908d[_0x5887('0x1f')];this[_0x5887('0x20')]=_0x5887('0x21');this[_0x5887('0x22')]=_0x20573a['cause-txt'];this[_0x5887('0x23')]=_0x59908d[_0x5887('0x23')];this['callbackuniqueid']=_0x59908d[_0x5887('0x24')];this[_0x5887('0x25')]=_0x59908d[_0x5887('0x25')];this[_0x5887('0x26')]=_0x59908d['recallme'];this[_0x5887('0x27')]=_0x59908d[_0x5887('0x27')];this[_0x5887('0x28')]=_0x59908d[_0x5887('0x28')];this[_0x5887('0x29')]=_0x59908d['UserId'];this[_0x5887('0x2a')]=_0x59908d[_0x5887('0x2a')];this[_0x5887('0x2b')]=_0x59908d['CampaignId'];}module[_0x5887('0x2c')]=Hangup; \ No newline at end of file +var _0xc569=['outbound','queue','amd','countbusyretry','countcongestionretry','countglobal','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','talktime','membername','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','CampaignId','moment','../utils','state','statedesc','scheduledat','type','campaigntype'];(function(_0x3b76ae,_0x1f110e){var _0x11ab0f=function(_0x3ebed0){while(--_0x3ebed0){_0x3b76ae['push'](_0x3b76ae['shift']());}};_0x11ab0f(++_0x1f110e);}(_0xc569,0x159));var _0x9c56=function(_0x41fe86,_0x474bdf){_0x41fe86=_0x41fe86-0x0;var _0xa62556=_0xc569[_0x41fe86];return _0xa62556;};'use strict';var moment=require(_0x9c56('0x0'));var utils=require(_0x9c56('0x1'));function Hangup(_0x78e9ad,_0x5e6b42){this[_0x9c56('0x2')]=0x4;this[_0x9c56('0x3')]='Answer';this[_0x9c56('0x4')]=_0x78e9ad[_0x9c56('0x4')];this[_0x9c56('0x5')]=_0x78e9ad['type'];this[_0x9c56('0x6')]=_0x78e9ad[_0x9c56('0x5')]===_0x9c56('0x7')?_0x9c56('0x8'):_0x78e9ad['type'];this[_0x9c56('0x9')]=_0x78e9ad[_0x9c56('0x9')]||![];this[_0x9c56('0xa')]=_0x78e9ad[_0x9c56('0xa')];this[_0x9c56('0xb')]=_0x78e9ad['countcongestionretry'];this['countnoanswerretry']=_0x78e9ad['countnoanswerretry'];this[_0x9c56('0xc')]=_0x78e9ad[_0x9c56('0xa')]+_0x78e9ad['countcongestionretry']+_0x78e9ad[_0x9c56('0xd')]+_0x78e9ad['countnosuchnumberretry']+_0x78e9ad[_0x9c56('0xe')]+_0x78e9ad[_0x9c56('0xf')]+_0x78e9ad[_0x9c56('0x10')]+_0x78e9ad[_0x9c56('0x11')];this[_0x9c56('0x12')]=_0x78e9ad[_0x9c56('0x12')];this[_0x9c56('0xe')]=_0x78e9ad['countdropretry'];this[_0x9c56('0xf')]=_0x78e9ad[_0x9c56('0xf')];this[_0x9c56('0x10')]=_0x78e9ad[_0x9c56('0x10')];this[_0x9c56('0x11')]=_0x78e9ad['countagentrejectretry'];this[_0x9c56('0x13')]=_0x5e6b42['uniqueid'];this[_0x9c56('0x14')]=_0x78e9ad[_0x9c56('0x15')];this[_0x9c56('0x16')]=_0x78e9ad[_0x9c56('0x17')];this[_0x9c56('0x18')]=_0x78e9ad[_0x9c56('0x18')];this[_0x9c56('0x19')]=_0x78e9ad[_0x9c56('0x19')];this[_0x9c56('0x1a')]=moment()[_0x9c56('0x1b')](_0x9c56('0x1c'));this[_0x9c56('0x1d')]=utils[_0x9c56('0x1e')](_0x78e9ad[_0x9c56('0x19')],_0x78e9ad[_0x9c56('0x18')]);this['holdtime']=0x0;this[_0x9c56('0x1f')]=utils[_0x9c56('0x1e')](this[_0x9c56('0x1a')],_0x78e9ad['responsetime']);this[_0x9c56('0x8')]=_0x78e9ad[_0x9c56('0x8')];this[_0x9c56('0x20')]=_0x9c56('0x21');this[_0x9c56('0x22')]=_0x5e6b42[_0x9c56('0x23')];this[_0x9c56('0x24')]=_0x78e9ad[_0x9c56('0x24')];this[_0x9c56('0x25')]=_0x78e9ad['callbackuniqueid'];this[_0x9c56('0x26')]=_0x78e9ad[_0x9c56('0x26')];this['recallme']=_0x78e9ad[_0x9c56('0x27')];this[_0x9c56('0x28')]=_0x78e9ad[_0x9c56('0x28')];this[_0x9c56('0x29')]=_0x78e9ad[_0x9c56('0x29')];this['UserId']=_0x78e9ad['UserId'];this[_0x9c56('0x2a')]=_0x78e9ad[_0x9c56('0x2a')];this['CampaignId']=_0x78e9ad[_0x9c56('0x2b')];}module['exports']=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 78ce63d..a20f1de 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 _0x48c9=['countmachineretry','countagentrejectretry','countdropretry','countabandonedretry','calleridname','calleridnum','number','starttime','responsetime','ringtime','getSeconds','holdtime','talktime','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','state','statedesc','exports','../utils','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry'];(function(_0x31dde9,_0x12e816){var _0x1fbf2d=function(_0x1d1bf6){while(--_0x1d1bf6){_0x31dde9['push'](_0x31dde9['shift']());}};_0x1fbf2d(++_0x12e816);}(_0x48c9,0x1c9));var _0x948c=function(_0x872f6f,_0x5efe7b){_0x872f6f=_0x872f6f-0x0;var _0x59a5f4=_0x48c9[_0x872f6f];return _0x59a5f4;};'use strict';var utils=require(_0x948c('0x0'));function History(_0x4217ce){this[_0x948c('0x1')]=_0x4217ce[_0x948c('0x1')];this['scheduledat']=_0x4217ce[_0x948c('0x2')]||undefined;this['type']=_0x4217ce[_0x948c('0x3')];this[_0x948c('0x4')]=_0x4217ce[_0x948c('0x3')]===_0x948c('0x5')?_0x948c('0x6'):_0x4217ce[_0x948c('0x3')];this[_0x948c('0x7')]=_0x4217ce['countbusyretry'];this[_0x948c('0x8')]=_0x4217ce['countcongestionretry'];this[_0x948c('0x9')]=_0x4217ce['countnoanswerretry'];this['countglobal']=_0x4217ce[_0x948c('0x7')]+_0x4217ce[_0x948c('0x8')]+_0x4217ce[_0x948c('0x9')]+_0x4217ce[_0x948c('0xa')]+_0x4217ce['countdropretry']+_0x4217ce['countabandonedretry']+_0x4217ce[_0x948c('0xb')]+_0x4217ce[_0x948c('0xc')];this['countnosuchnumberretry']=_0x4217ce[_0x948c('0xa')];this[_0x948c('0xd')]=_0x4217ce[_0x948c('0xd')];this[_0x948c('0xe')]=_0x4217ce[_0x948c('0xe')];this['countmachineretry']=_0x4217ce[_0x948c('0xb')];this[_0x948c('0xc')]=_0x4217ce[_0x948c('0xc')];this['queue']=_0x4217ce[_0x948c('0x6')];this[_0x948c('0xf')]=_0x4217ce['name'];this[_0x948c('0x10')]=_0x4217ce[_0x948c('0x11')];this[_0x948c('0x12')]=_0x4217ce[_0x948c('0x12')];this['responsetime']=_0x4217ce[_0x948c('0x13')];this['endtime']=_0x4217ce['responsetime'];this[_0x948c('0x14')]=utils[_0x948c('0x15')](_0x4217ce['responsetime'],_0x4217ce['starttime']);this[_0x948c('0x16')]=0x0;this[_0x948c('0x17')]=0x0;this[_0x948c('0x18')]=_0x4217ce[_0x948c('0x18')];this[_0x948c('0x19')]=_0x4217ce[_0x948c('0x19')];this['callbackat']=_0x4217ce['callbackat'];this[_0x948c('0x1a')]=_0x4217ce['recallme'];this[_0x948c('0x1b')]=_0x4217ce[_0x948c('0x1b')];this[_0x948c('0x1c')]=_0x4217ce[_0x948c('0x1c')];this['UserId']=_0x4217ce[_0x948c('0x1d')];this[_0x948c('0x1e')]=_0x4217ce[_0x948c('0x1e')];this['CampaignId']=_0x4217ce['CampaignId'];this['originatecalleridnum']=_0x4217ce[_0x948c('0x1f')]||'';this['originatecalleridname']=_0x4217ce[_0x948c('0x20')]||'';this[_0x948c('0x21')]=_0x4217ce[_0x948c('0x21')];this[_0x948c('0x22')]=_0x4217ce[_0x948c('0x22')];}module[_0x948c('0x23')]=History; \ No newline at end of file +var _0x72a8=['countnosuchnumberretry','countdropretry','queue','calleridname','name','calleridnum','number','starttime','responsetime','endtime','getSeconds','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','statedesc','exports','uniqueid','scheduledat','type','campaigntype','outbound','countbusyretry','countnoanswerretry','countglobal','countcongestionretry','countabandonedretry','countmachineretry','countagentrejectretry'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0x72a8,0x66));var _0x872a=function(_0x295e6a,_0x32d249){_0x295e6a=_0x295e6a-0x0;var _0x5af7df=_0x72a8[_0x295e6a];return _0x5af7df;};'use strict';var utils=require('../utils');function History(_0x11bad9){this[_0x872a('0x0')]=_0x11bad9[_0x872a('0x0')];this[_0x872a('0x1')]=_0x11bad9['scheduledat']||undefined;this[_0x872a('0x2')]=_0x11bad9[_0x872a('0x2')];this[_0x872a('0x3')]=_0x11bad9[_0x872a('0x2')]===_0x872a('0x4')?'queue':_0x11bad9[_0x872a('0x2')];this[_0x872a('0x5')]=_0x11bad9[_0x872a('0x5')];this['countcongestionretry']=_0x11bad9['countcongestionretry'];this['countnoanswerretry']=_0x11bad9[_0x872a('0x6')];this[_0x872a('0x7')]=_0x11bad9[_0x872a('0x5')]+_0x11bad9[_0x872a('0x8')]+_0x11bad9[_0x872a('0x6')]+_0x11bad9['countnosuchnumberretry']+_0x11bad9['countdropretry']+_0x11bad9[_0x872a('0x9')]+_0x11bad9[_0x872a('0xa')]+_0x11bad9[_0x872a('0xb')];this[_0x872a('0xc')]=_0x11bad9[_0x872a('0xc')];this['countdropretry']=_0x11bad9[_0x872a('0xd')];this['countabandonedretry']=_0x11bad9[_0x872a('0x9')];this[_0x872a('0xa')]=_0x11bad9[_0x872a('0xa')];this[_0x872a('0xb')]=_0x11bad9['countagentrejectretry'];this['queue']=_0x11bad9[_0x872a('0xe')];this[_0x872a('0xf')]=_0x11bad9[_0x872a('0x10')];this[_0x872a('0x11')]=_0x11bad9[_0x872a('0x12')];this[_0x872a('0x13')]=_0x11bad9[_0x872a('0x13')];this[_0x872a('0x14')]=_0x11bad9[_0x872a('0x14')];this[_0x872a('0x15')]=_0x11bad9[_0x872a('0x14')];this['ringtime']=utils[_0x872a('0x16')](_0x11bad9['responsetime'],_0x11bad9[_0x872a('0x13')]);this[_0x872a('0x17')]=0x0;this[_0x872a('0x18')]=0x0;this[_0x872a('0x19')]=_0x11bad9[_0x872a('0x19')];this[_0x872a('0x1a')]=_0x11bad9['callbackuniqueid'];this[_0x872a('0x1b')]=_0x11bad9[_0x872a('0x1b')];this[_0x872a('0x1c')]=_0x11bad9[_0x872a('0x1c')];this[_0x872a('0x1d')]=_0x11bad9[_0x872a('0x1d')];this[_0x872a('0x1e')]=_0x11bad9[_0x872a('0x1e')];this['UserId']=_0x11bad9[_0x872a('0x1f')];this[_0x872a('0x20')]=_0x11bad9[_0x872a('0x20')];this[_0x872a('0x21')]=_0x11bad9['CampaignId'];this[_0x872a('0x22')]=_0x11bad9['originatecalleridnum']||'';this[_0x872a('0x23')]=_0x11bad9[_0x872a('0x23')]||'';this['state']=_0x11bad9['state'];this[_0x872a('0x24')]=_0x11bad9[_0x872a('0x24')];}module[_0x872a('0x25')]=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 cbe7c2e..3c8bd1b 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 _0x3fca=['CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countglobal','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','number','responsetime','droptime','dropreason','endtime','ringtime','getSeconds','starttime','holdtime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId'];(function(_0x38eb67,_0x48661f){var _0x4e477e=function(_0x15f0e5){while(--_0x15f0e5){_0x38eb67['push'](_0x38eb67['shift']());}};_0x4e477e(++_0x48661f);}(_0x3fca,0x12c));var _0xa3fc=function(_0x28eff5,_0x4822f1){_0x28eff5=_0x28eff5-0x0;var _0x78bf00=_0x3fca[_0x28eff5];return _0x78bf00;};'use strict';var utils=require('../utils');function QueueCallerAbandon(_0x2b24fc,_0x13f445){this[_0xa3fc('0x0')]=_0x2b24fc[_0xa3fc('0x0')];this[_0xa3fc('0x1')]=_0x2b24fc['type'];this[_0xa3fc('0x2')]=_0x2b24fc[_0xa3fc('0x1')]===_0xa3fc('0x3')?_0xa3fc('0x4'):_0x2b24fc['type'];this[_0xa3fc('0x5')]=_0x2b24fc[_0xa3fc('0x5')];this['countcongestionretry']=_0x2b24fc[_0xa3fc('0x6')];this['countnoanswerretry']=_0x2b24fc['countnoanswerretry'];this[_0xa3fc('0x7')]=_0x2b24fc[_0xa3fc('0x5')]+_0x2b24fc[_0xa3fc('0x6')]+_0x2b24fc[_0xa3fc('0x8')]+_0x2b24fc[_0xa3fc('0x9')]+_0x2b24fc[_0xa3fc('0xa')]+_0x2b24fc[_0xa3fc('0xb')]+_0x2b24fc[_0xa3fc('0xc')]+_0x2b24fc[_0xa3fc('0xd')];this[_0xa3fc('0x9')]=_0x2b24fc[_0xa3fc('0x9')];this[_0xa3fc('0xa')]=_0x2b24fc['countdropretry'];this[_0xa3fc('0xb')]=_0x2b24fc[_0xa3fc('0xb')];this[_0xa3fc('0xc')]=_0x2b24fc[_0xa3fc('0xc')];this[_0xa3fc('0xd')]=_0x2b24fc[_0xa3fc('0xd')];this[_0xa3fc('0xe')]=_0x13f445[_0xa3fc('0xe')];this[_0xa3fc('0xf')]=_0x2b24fc[_0xa3fc('0x10')];this['calleridnum']=_0x2b24fc[_0xa3fc('0x11')];this['starttime']=_0x2b24fc['starttime'];this[_0xa3fc('0x12')]=_0x2b24fc['responsetime'];this[_0xa3fc('0x13')]=_0x2b24fc[_0xa3fc('0x13')];this[_0xa3fc('0x14')]=_0x2b24fc[_0xa3fc('0x14')];this[_0xa3fc('0x15')]=this['droptime'];this[_0xa3fc('0x16')]=utils[_0xa3fc('0x17')](_0x2b24fc[_0xa3fc('0x12')],_0x2b24fc[_0xa3fc('0x18')]);this[_0xa3fc('0x19')]=utils[_0xa3fc('0x17')](this['droptime'],_0x2b24fc[_0xa3fc('0x12')]);this['talktime']=0x0;this[_0xa3fc('0x4')]=_0x13f445[_0xa3fc('0x4')];this[_0xa3fc('0x1a')]=_0x13f445['connectedlinename'];this['reason']=_0x13f445[_0xa3fc('0x1b')];this[_0xa3fc('0x1c')]=_0x2b24fc[_0xa3fc('0x1c')];this[_0xa3fc('0x1d')]=_0x2b24fc[_0xa3fc('0x1d')];this[_0xa3fc('0x1e')]=_0x2b24fc[_0xa3fc('0x1e')];this[_0xa3fc('0x1f')]=_0x2b24fc[_0xa3fc('0x1f')];this['ContactId']=_0x2b24fc[_0xa3fc('0x20')];this[_0xa3fc('0x21')]=_0x2b24fc[_0xa3fc('0x21')];this[_0xa3fc('0x22')]=_0x2b24fc['UserId'];this[_0xa3fc('0x23')]=_0x2b24fc['VoiceQueueId'];this[_0xa3fc('0x24')]=_0x2b24fc[_0xa3fc('0x24')];this[_0xa3fc('0x25')]=_0x2b24fc[_0xa3fc('0x25')]||'';this['originatecalleridname']=_0x2b24fc[_0xa3fc('0x26')]||'';this[_0xa3fc('0x27')]=_0x2b24fc[_0xa3fc('0x27')];this[_0xa3fc('0x28')]=_0x2b24fc[_0xa3fc('0x28')];this['statedesc']=_0x2b24fc[_0xa3fc('0x29')];}module['exports']=QueueCallerAbandon; \ No newline at end of file +var _0x8017=['queue','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','../utils','scheduledat','type','campaigntype','outbound','countcongestionretry','countnoanswerretry','countabandonedretry','countagentrejectretry','countnosuchnumberretry','countdropretry','countmachineretry','uniqueid','calleridname','number','starttime','responsetime','droptime','dropreason','endtime','ringtime','getSeconds','holdtime','talktime'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x8017,0xb5));var _0x7801=function(_0x9cfe28,_0x1a335c){_0x9cfe28=_0x9cfe28-0x0;var _0x54a1d0=_0x8017[_0x9cfe28];return _0x54a1d0;};'use strict';var utils=require(_0x7801('0x0'));function QueueCallerAbandon(_0x749711,_0x474a7c){this['scheduledat']=_0x749711[_0x7801('0x1')];this[_0x7801('0x2')]=_0x749711[_0x7801('0x2')];this[_0x7801('0x3')]=_0x749711[_0x7801('0x2')]===_0x7801('0x4')?'queue':_0x749711[_0x7801('0x2')];this['countbusyretry']=_0x749711['countbusyretry'];this[_0x7801('0x5')]=_0x749711['countcongestionretry'];this[_0x7801('0x6')]=_0x749711[_0x7801('0x6')];this['countglobal']=_0x749711['countbusyretry']+_0x749711[_0x7801('0x5')]+_0x749711[_0x7801('0x6')]+_0x749711['countnosuchnumberretry']+_0x749711['countdropretry']+_0x749711[_0x7801('0x7')]+_0x749711['countmachineretry']+_0x749711[_0x7801('0x8')];this['countnosuchnumberretry']=_0x749711[_0x7801('0x9')];this['countdropretry']=_0x749711[_0x7801('0xa')];this[_0x7801('0x7')]=_0x749711[_0x7801('0x7')];this['countmachineretry']=_0x749711[_0x7801('0xb')];this[_0x7801('0x8')]=_0x749711['countagentrejectretry'];this[_0x7801('0xc')]=_0x474a7c[_0x7801('0xc')];this[_0x7801('0xd')]=_0x749711['name'];this['calleridnum']=_0x749711[_0x7801('0xe')];this[_0x7801('0xf')]=_0x749711['starttime'];this[_0x7801('0x10')]=_0x749711[_0x7801('0x10')];this[_0x7801('0x11')]=_0x749711[_0x7801('0x11')];this[_0x7801('0x12')]=_0x749711[_0x7801('0x12')];this[_0x7801('0x13')]=this[_0x7801('0x11')];this[_0x7801('0x14')]=utils[_0x7801('0x15')](_0x749711[_0x7801('0x10')],_0x749711['starttime']);this[_0x7801('0x16')]=utils[_0x7801('0x15')](this[_0x7801('0x11')],_0x749711['responsetime']);this[_0x7801('0x17')]=0x0;this[_0x7801('0x18')]=_0x474a7c[_0x7801('0x18')];this[_0x7801('0x19')]=_0x474a7c['connectedlinename'];this[_0x7801('0x1a')]=_0x474a7c['reason'];this['callback']=_0x749711[_0x7801('0x1b')];this[_0x7801('0x1c')]=_0x749711[_0x7801('0x1c')];this[_0x7801('0x1d')]=_0x749711[_0x7801('0x1d')];this[_0x7801('0x1e')]=_0x749711['recallme'];this[_0x7801('0x1f')]=_0x749711[_0x7801('0x1f')];this[_0x7801('0x20')]=_0x749711['ListId'];this[_0x7801('0x21')]=_0x749711[_0x7801('0x21')];this[_0x7801('0x22')]=_0x749711[_0x7801('0x22')];this[_0x7801('0x23')]=_0x749711[_0x7801('0x23')];this[_0x7801('0x24')]=_0x749711[_0x7801('0x24')]||'';this['originatecalleridname']=_0x749711[_0x7801('0x25')]||'';this[_0x7801('0x26')]=_0x749711[_0x7801('0x26')];this[_0x7801('0x27')]=_0x749711['state'];this['statedesc']=_0x749711[_0x7801('0x28')];}module['exports']=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/dialer/utils/hopper.js b/server/services/ami/dialer/utils/hopper.js index 214671f..b9719c0 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 _0x4137=['countReScheduled','[countReScheduled]','[rescheduleContact]','rescheduleContact','unlockContact','moveContactManagedDialer','checkIsBlackList','[checkIsBlackList]','checkIsBlackListIvr','verifyAdditionalPhones','[verifyAdditionalPhone]','[swapAdditionalPhone]','swapAdditionalPhones','avgHandleTime','[avgHandleTime]','createHistory','[createHistory]','util','../../../../config/logger','dialer','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperBlack','../../rpc/cmHopperHistory','inspect','dialOrderByScheduledAt','catch','temp','[getContactDialer]','getContactDialer','getContactDialerIvr','error','[getContactDialerIvr]'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4137,0xf8));var _0x7413=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x4137[_0x57b54c];return _0x59cc19;};'use strict';var util=require(_0x7413('0x0'));var logger=require(_0x7413('0x1'))(_0x7413('0x2'));var cmHopper=require(_0x7413('0x3'));var cmHopperAdditionalPhone=require(_0x7413('0x4'));var cmHopperBlack=require(_0x7413('0x5'));var cmHopperHistory=require(_0x7413('0x6'));function inspectError(_0x299eea){return util[_0x7413('0x7')](_0x299eea,{'showHidden':![],'depth':null});}function getContactDialer(_0x3dc48a,_0x451a96,_0x3bb181){return cmHopper['getContactDialer'](_0x3dc48a['id'],_0x451a96,_0x3bb181,_0x3dc48a[_0x7413('0x8')])[_0x7413('0x9')](function(_0x5b39ac){_0x3dc48a[_0x7413('0xa')]=0x0;logger['error'](_0x7413('0xb'),inspectError(_0x5b39ac));});}exports[_0x7413('0xc')]=getContactDialer;function getContactDialerIvr(_0x4e320b,_0x422bf5){return cmHopper[_0x7413('0xd')](_0x4e320b['id'],_0x422bf5,_0x4e320b['dialOrderByScheduledAt'])[_0x7413('0x9')](function(_0x427b3b){_0x4e320b[_0x7413('0xa')]=0x0;logger[_0x7413('0xe')](_0x7413('0xf'),inspectError(_0x427b3b));});}exports['getContactDialerIvr']=getContactDialerIvr;function countReScheduled(_0xa25d72){return cmHopper[_0x7413('0x10')](_0xa25d72)['catch'](function(_0x18a874){logger[_0x7413('0xe')](_0x7413('0x11'),inspectError(_0x18a874));});}exports['countReScheduled']=countReScheduled;function rescheduleContact(_0x5956b0){return cmHopper['rescheduleContact'](_0x5956b0)[_0x7413('0x9')](function(_0x336c4c){logger['error'](_0x7413('0x12'),inspectError(_0x336c4c));});}exports[_0x7413('0x13')]=rescheduleContact;function unlockContact(_0x4955d3,_0x38b3d1,_0x50f301){return cmHopper['unlockContact'](_0x4955d3,_0x38b3d1,_0x50f301)[_0x7413('0x9')](function(_0x568d1f){logger[_0x7413('0xe')]('[unlockContact]',inspectError(_0x568d1f));});}exports[_0x7413('0x14')]=unlockContact;function moveContactManagedDialer(_0x3230d8){return cmHopper[_0x7413('0x15')](_0x3230d8)[_0x7413('0x9')](function(_0x2a3417){logger[_0x7413('0xe')]('[moveContactManagedDialer]',inspectError(_0x2a3417));});}exports[_0x7413('0x15')]=moveContactManagedDialer;function checkIsBlackList(_0x17c062){return cmHopperBlack[_0x7413('0x16')](_0x17c062)[_0x7413('0x9')](function(_0x5bee15){logger[_0x7413('0xe')](_0x7413('0x17'),inspectError(_0x5bee15));});}exports[_0x7413('0x16')]=checkIsBlackList;function checkIsBlackListIvr(_0x20d3d2){return cmHopperBlack[_0x7413('0x18')](_0x20d3d2)[_0x7413('0x9')](function(_0x4886e3){logger[_0x7413('0xe')]('[checkIsBlackListIvr]',inspectError(_0x4886e3));});}exports['checkIsBlackListIvr']=checkIsBlackListIvr;function verifyAdditionalPhones(_0x138508,_0x599654,_0x1585ba){return cmHopperAdditionalPhone[_0x7413('0x19')](_0x138508,_0x599654,_0x1585ba)[_0x7413('0x9')](function(_0x2fc0f4){logger[_0x7413('0xe')](_0x7413('0x1a'),inspectError(_0x2fc0f4));});}exports[_0x7413('0x19')]=verifyAdditionalPhones;function swapAdditionalPhones(_0x41cb5d,_0x1d455b,_0x5a8329){return cmHopperAdditionalPhone['swapAdditionalPhones'](_0x41cb5d,_0x1d455b,_0x5a8329)[_0x7413('0x9')](function(_0x48c2dc){logger[_0x7413('0xe')](_0x7413('0x1b'),inspectError(_0x48c2dc));});}exports[_0x7413('0x1c')]=swapAdditionalPhones;function avgHandleTime(_0x4c2e90){return cmHopperHistory[_0x7413('0x1d')](_0x4c2e90)[_0x7413('0x9')](function(_0x79cab6){logger[_0x7413('0xe')](_0x7413('0x1e'),inspectError(_0x79cab6));});}exports[_0x7413('0x1d')]=avgHandleTime;function createHistory(_0x5eb4d9){return cmHopperHistory[_0x7413('0x1f')](_0x5eb4d9)['catch'](function(_0x1d0bde){logger[_0x7413('0xe')](_0x7413('0x20'),inspectError(_0x1d0bde));});}exports[_0x7413('0x1f')]=createHistory; \ No newline at end of file +var _0xb091=['swapAdditionalPhones','[swapAdditionalPhone]','avgHandleTime','[avgHandleTime]','createHistory','[createHistory]','../../../../config/logger','dialer','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperHistory','getContactDialer','dialOrderByScheduledAt','catch','temp','error','[getContactDialer]','getContactDialerIvr','[getContactDialerIvr]','[countReScheduled]','countReScheduled','rescheduleContact','[rescheduleContact]','unlockContact','[unlockContact]','moveContactManagedDialer','[checkIsBlackList]','checkIsBlackList','checkIsBlackListIvr','verifyAdditionalPhones'];(function(_0x57c13b,_0x203d33){var _0x5d5346=function(_0x536f04){while(--_0x536f04){_0x57c13b['push'](_0x57c13b['shift']());}};_0x5d5346(++_0x203d33);}(_0xb091,0x16e));var _0x1b09=function(_0x54aa14,_0x5e2519){_0x54aa14=_0x54aa14-0x0;var _0x1e3f27=_0xb091[_0x54aa14];return _0x1e3f27;};'use strict';var util=require('util');var logger=require(_0x1b09('0x0'))(_0x1b09('0x1'));var cmHopper=require(_0x1b09('0x2'));var cmHopperAdditionalPhone=require(_0x1b09('0x3'));var cmHopperBlack=require('../../rpc/cmHopperBlack');var cmHopperHistory=require(_0x1b09('0x4'));function inspectError(_0x59af61){return util['inspect'](_0x59af61,{'showHidden':![],'depth':null});}function getContactDialer(_0x295863,_0x24d22c,_0x4e252c){return cmHopper[_0x1b09('0x5')](_0x295863['id'],_0x24d22c,_0x4e252c,_0x295863[_0x1b09('0x6')])[_0x1b09('0x7')](function(_0x5ce726){_0x295863[_0x1b09('0x8')]=0x0;logger[_0x1b09('0x9')](_0x1b09('0xa'),inspectError(_0x5ce726));});}exports[_0x1b09('0x5')]=getContactDialer;function getContactDialerIvr(_0x159b95,_0x3362e4){return cmHopper[_0x1b09('0xb')](_0x159b95['id'],_0x3362e4,_0x159b95[_0x1b09('0x6')])[_0x1b09('0x7')](function(_0x36aa1b){_0x159b95[_0x1b09('0x8')]=0x0;logger['error'](_0x1b09('0xc'),inspectError(_0x36aa1b));});}exports[_0x1b09('0xb')]=getContactDialerIvr;function countReScheduled(_0x5690cb){return cmHopper['countReScheduled'](_0x5690cb)[_0x1b09('0x7')](function(_0x4284ad){logger[_0x1b09('0x9')](_0x1b09('0xd'),inspectError(_0x4284ad));});}exports[_0x1b09('0xe')]=countReScheduled;function rescheduleContact(_0x3a44f1){return cmHopper[_0x1b09('0xf')](_0x3a44f1)['catch'](function(_0x37fdb2){logger['error'](_0x1b09('0x10'),inspectError(_0x37fdb2));});}exports[_0x1b09('0xf')]=rescheduleContact;function unlockContact(_0x11ab46,_0x37673e,_0x10b7eb){return cmHopper[_0x1b09('0x11')](_0x11ab46,_0x37673e,_0x10b7eb)[_0x1b09('0x7')](function(_0x33129b){logger[_0x1b09('0x9')](_0x1b09('0x12'),inspectError(_0x33129b));});}exports[_0x1b09('0x11')]=unlockContact;function moveContactManagedDialer(_0x231ef6){return cmHopper[_0x1b09('0x13')](_0x231ef6)['catch'](function(_0x214c6b){logger[_0x1b09('0x9')]('[moveContactManagedDialer]',inspectError(_0x214c6b));});}exports['moveContactManagedDialer']=moveContactManagedDialer;function checkIsBlackList(_0xe93ac4){return cmHopperBlack['checkIsBlackList'](_0xe93ac4)[_0x1b09('0x7')](function(_0x5bb127){logger[_0x1b09('0x9')](_0x1b09('0x14'),inspectError(_0x5bb127));});}exports[_0x1b09('0x15')]=checkIsBlackList;function checkIsBlackListIvr(_0x1e8f97){return cmHopperBlack[_0x1b09('0x16')](_0x1e8f97)[_0x1b09('0x7')](function(_0x363e78){logger[_0x1b09('0x9')]('[checkIsBlackListIvr]',inspectError(_0x363e78));});}exports['checkIsBlackListIvr']=checkIsBlackListIvr;function verifyAdditionalPhones(_0x27f4f5,_0x41c786,_0x4ce7dc){return cmHopperAdditionalPhone[_0x1b09('0x17')](_0x27f4f5,_0x41c786,_0x4ce7dc)[_0x1b09('0x7')](function(_0x6e132c){logger[_0x1b09('0x9')]('[verifyAdditionalPhone]',inspectError(_0x6e132c));});}exports[_0x1b09('0x17')]=verifyAdditionalPhones;function swapAdditionalPhones(_0x15be49,_0x4936d0,_0x2d3b86){return cmHopperAdditionalPhone[_0x1b09('0x18')](_0x15be49,_0x4936d0,_0x2d3b86)['catch'](function(_0x13c89c){logger[_0x1b09('0x9')](_0x1b09('0x19'),inspectError(_0x13c89c));});}exports[_0x1b09('0x18')]=swapAdditionalPhones;function avgHandleTime(_0x547fbb){return cmHopperHistory[_0x1b09('0x1a')](_0x547fbb)[_0x1b09('0x7')](function(_0x532589){logger[_0x1b09('0x9')](_0x1b09('0x1b'),inspectError(_0x532589));});}exports[_0x1b09('0x1a')]=avgHandleTime;function createHistory(_0x1cbbd5){return cmHopperHistory[_0x1b09('0x1c')](_0x1cbbd5)[_0x1b09('0x7')](function(_0x34620f){logger['error'](_0x1b09('0x1d'),inspectError(_0x34620f));});}exports[_0x1b09('0x1c')]=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 9482520..dab925a 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 _0xc8d3=['INTERVAL_IS_NULL','GLOBAL_INTERVAL_IS_OVERTIME','RECALLINQUEUE','TIMEZONE_UNKNOW','CAMPAIGN_STATUS','dialMethod','preview','isPreviewCampaign','type','ivr','isIVRCampaign','dialActive','isQueueCampaignActive','active','isIVRCampaignActive','milliseconds','seconds','getSeconds','message','available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','originated','Trunk','name','hasQueueCampaignDataChanged','dialTimezone','isNil','dialGlobalInterval','Interval','Intervals','NULL_INTERVAL','isEmpty','EMPTY_INTERVAL','UNKNOWN_TIMEZONE','SIP/','reachable','unmonitored','includes','status','TrunkBackup','INACTIVE','DISACTIVED','NO_AGENTS_LOGGED','UNREACHABLE_TRUNK','getQueueCampaignActiveStatusMessage','match','isUndefined','string','format','\x22\x22\x20<>','getCallerId','\x5cw{0,','pow','replace','random','toString','getCallerIdRandom','error','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','decrementOriginate','length','checkContactEmpty','erlangb','checkContactLowerLimitOriginate','createdAt','description','tags','updatedAt','undefined','%s%s','toUpperCase','setXMDContactVariables','lodash','util','../../../../config/logger','dialer','../../../../config/environment/shared','ACTIVE','BLACKLIST','RESCHEDULED_CONTACTS','DEACTIVATED','IS_DISACTIVED','INTERVAL_IS_EMPTY','AGENTS_NOT_LOGGED','AVAILABLE_CONTACTS_FINISHED'];(function(_0x506aef,_0xb1161c){var _0x579eea=function(_0x162add){while(--_0x162add){_0x506aef['push'](_0x506aef['shift']());}};_0x579eea(++_0xb1161c);}(_0xc8d3,0x104));var _0x3c8d=function(_0x3c8e9a,_0x384306){_0x3c8e9a=_0x3c8e9a-0x0;var _0x2d4c57=_0xc8d3[_0x3c8e9a];return _0x2d4c57;};'use strict';var _=require(_0x3c8d('0x0'));var moment=require('moment');var util=require(_0x3c8d('0x1'));var logger=require(_0x3c8d('0x2'))(_0x3c8d('0x3'));var timezones=require(_0x3c8d('0x4'))['timezones'];var CAMPAIGN_STATUS={'ACTIVE':_0x3c8d('0x5'),'BLACKLIST':_0x3c8d('0x6'),'CONTACTS_RESCHEDULED':_0x3c8d('0x7'),'DEACTIVATED':_0x3c8d('0x8'),'DISACTIVED':_0x3c8d('0x9'),'EMPTY_INTERVAL':_0x3c8d('0xa'),'INACTIVE':'NOT_ACTIVE','NO_AGENTS_LOGGED':_0x3c8d('0xb'),'NO_AVAILABLE_CONTACTS':_0x3c8d('0xc'),'NULL_INTERVAL':_0x3c8d('0xd'),'OVERTIME_INTERVAL':'INTERVAL_IS_OVERTIME','OVERTIME_GLOBAL_INTERVAL':_0x3c8d('0xe'),'QUEUE_RECALL':_0x3c8d('0xf'),'RECALL_TIMEOUT':'RECALLFAILEDTIMEOUT','RUNNING':'RUNNING','UNKNOWN_TIMEZONE':_0x3c8d('0x10'),'UNREACHABLE_TRUNK':'TRUNK_IS_NOT_REACHABLE'};exports[_0x3c8d('0x11')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x3572e4){return _0x3572e4[_0x3c8d('0x12')]===_0x3c8d('0x13');}exports[_0x3c8d('0x14')]=isPreviewCampaign;function isIVRCampaign(_0x8f8cab){return _0x8f8cab[_0x3c8d('0x15')]===_0x3c8d('0x16');}exports[_0x3c8d('0x17')]=isIVRCampaign;function isOutboundQueue(_0x1577db){return _0x1577db[_0x3c8d('0x15')]==='outbound';}exports['isOutboundQueue']=isOutboundQueue;function isQueueCampaignActive(_0x2efbcb){return _0x2efbcb[_0x3c8d('0x18')];}exports[_0x3c8d('0x19')]=isQueueCampaignActive;function isIVRCampaignActive(_0x2632f5){return _0x2632f5[_0x3c8d('0x1a')];}exports[_0x3c8d('0x1b')]=isIVRCampaignActive;function getSeconds(_0x3a6334,_0x422981){var _0x1c63f6=moment(_0x3a6334)[_0x3c8d('0x1c')](0x0);var _0x3ffded=moment(_0x422981)[_0x3c8d('0x1c')](0x0);return _0x1c63f6['diff'](_0x3ffded,_0x3c8d('0x1d'));}exports[_0x3c8d('0x1e')]=getSeconds;function hasQueueCampaignDataChanged(_0x2f57f6,_0x4a0bfd){var _0x10a7f9=![];var _0x195b30=_0x2f57f6[_0x3c8d('0x12')]!==_0x4a0bfd['dialMethod']||_0x2f57f6[_0x3c8d('0x18')]!==_0x4a0bfd[_0x3c8d('0x18')]||_0x2f57f6[_0x3c8d('0x1f')]!==_0x4a0bfd['message'];var _0x2e2667=_0x2f57f6[_0x3c8d('0x20')]!==_0x4a0bfd[_0x3c8d('0x20')]||_0x2f57f6[_0x3c8d('0x21')]!==_0x4a0bfd[_0x3c8d('0x21')]||_0x2f57f6[_0x3c8d('0x22')]!==_0x4a0bfd[_0x3c8d('0x22')]||_0x2f57f6[_0x3c8d('0x23')]!==_0x4a0bfd[_0x3c8d('0x23')]||_0x2f57f6[_0x3c8d('0x24')]!==_0x4a0bfd[_0x3c8d('0x24')]||_0x2f57f6['pTalking']!==_0x4a0bfd[_0x3c8d('0x25')]||_0x2f57f6[_0x3c8d('0x26')]!==_0x4a0bfd[_0x3c8d('0x26')]||_0x2f57f6[_0x3c8d('0x27')]!==_0x4a0bfd[_0x3c8d('0x27')]||_0x2f57f6[_0x3c8d('0x28')]!==_0x4a0bfd[_0x3c8d('0x28')];if(_0x2f57f6[_0x3c8d('0x29')]&&_0x4a0bfd[_0x3c8d('0x29')]){_0x10a7f9=_0x2f57f6['Trunk'][_0x3c8d('0x2a')]!==_0x4a0bfd[_0x3c8d('0x29')][_0x3c8d('0x2a')]||_0x2f57f6['Trunk'][_0x3c8d('0x1a')]!==_0x4a0bfd['Trunk'][_0x3c8d('0x1a')];}return _0x195b30||_0x2e2667||_0x10a7f9;}exports[_0x3c8d('0x2b')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x32f7d8){var _0x4963a5=null;var _0x4cdcae=_0x32f7d8[_0x3c8d('0x2c')];if(_[_0x3c8d('0x2d')](_0x32f7d8[_0x3c8d('0x2e')])||_[_0x3c8d('0x2d')](_0x32f7d8['Interval'])||_[_0x3c8d('0x2d')](_0x32f7d8[_0x3c8d('0x2f')][_0x3c8d('0x30')])){_0x4963a5=CAMPAIGN_STATUS[_0x3c8d('0x31')];}else if(_[_0x3c8d('0x32')](_0x32f7d8[_0x3c8d('0x2e')])||_[_0x3c8d('0x32')](_0x32f7d8['Interval'][_0x3c8d('0x30')])){_0x4963a5=CAMPAIGN_STATUS[_0x3c8d('0x33')];}else if(_0x4cdcae&&!timezones[_0x4cdcae]){_0x4963a5=CAMPAIGN_STATUS[_0x3c8d('0x34')];}return _0x4963a5;}function checkAnyValidTrunk(_0x12a105,_0x4f1196){var _0x461eeb=null;var _0x3f5032=_0x3c8d('0x35');var _0x37354f=[_0x3c8d('0x36'),_0x3c8d('0x37')];var _0x31e560=!![];if(_0x12a105['Trunk']&&_0x12a105[_0x3c8d('0x29')][_0x3c8d('0x1a')]){_0x3f5032+=_0x12a105[_0x3c8d('0x29')][_0x3c8d('0x2a')];_0x461eeb=_0x4f1196[_0x3f5032];_0x31e560=_0x37354f[_0x3c8d('0x38')](_0x461eeb[_0x3c8d('0x39')]);}else if(_0x12a105[_0x3c8d('0x3a')]&&_0x12a105[_0x3c8d('0x3a')][_0x3c8d('0x1a')]){_0x3f5032+=_0x12a105[_0x3c8d('0x3a')]['name'];_0x461eeb=_0x4f1196[_0x3f5032];_0x31e560=_0x37354f['includes'](_0x461eeb['status']);}return _0x31e560;}function getQueueCampaignStatusMessage(_0xaeabc8,_0x5a3b7c){var _0x147a69=CAMPAIGN_STATUS[_0x3c8d('0x5')];var _0x346dbb=isPreviewCampaign(_0xaeabc8);if(!isQueueCampaignActive(_0xaeabc8)){if(_0x346dbb){_0x147a69=CAMPAIGN_STATUS['INACTIVE'];}else{if(_0xaeabc8[_0x3c8d('0x28')]===0x0&&_0xaeabc8[_0x3c8d('0x24')]===0x0&&_0xaeabc8[_0x3c8d('0x26')]===0x0&&(_0xaeabc8[_0x3c8d('0x25')]||0x0)===0x0){_0x147a69=CAMPAIGN_STATUS[_0x3c8d('0x3b')];}else{_0x147a69=CAMPAIGN_STATUS[_0x3c8d('0x3c')];}}}else if(_0xaeabc8[_0x3c8d('0x21')]===0x0){_0x147a69=CAMPAIGN_STATUS[_0x3c8d('0x3d')];}else if(!checkAnyValidTrunk(_0xaeabc8,_0x5a3b7c)){_0x147a69=CAMPAIGN_STATUS[_0x3c8d('0x3e')];}else if(!isPreviewCampaign(_0xaeabc8)){var _0x535b39=checkAnyValidQueueCampaignInterval(_0xaeabc8);if(_0x535b39){_0x147a69=_0x535b39;}}return _0x147a69;}exports['getQueueCampaignStatusMessage']=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x3a9983){var _0x5c0c65=CAMPAIGN_STATUS[_0x3c8d('0x3c')];if(_0x3a9983[_0x3c8d('0x28')]===0x0&&_0x3a9983[_0x3c8d('0x24')]===0x0&&_0x3a9983[_0x3c8d('0x26')]===0x0&&(_0x3a9983[_0x3c8d('0x25')]||0x0)===0x0){_0x5c0c65=CAMPAIGN_STATUS[_0x3c8d('0x3b')];}return _0x5c0c65;}exports[_0x3c8d('0x3f')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x3c4982){var _0x10eb38=_0x3c4982[_0x3c8d('0x40')](/"(.*?)"/);return _0x10eb38?_0x10eb38[0x1]:_0x3c4982;}exports['extractCalleridName']=extractCalleridName;function getCallerId(_0x3aaffc,_0x732360,_0x10cac1){if(!_[_0x3c8d('0x41')](_0x10cac1)&&typeof _0x10cac1===_0x3c8d('0x42')&&!_[_0x3c8d('0x32')](_0x10cac1)){if(!_[_0x3c8d('0x41')](_0x732360)&&typeof _0x732360===_0x3c8d('0x42')&&!_[_0x3c8d('0x32')](_0x732360)){return util[_0x3c8d('0x43')]('\x22%s\x22\x20<%s>',_0x732360,_0x10cac1);}return util['format']('\x22%s\x22\x20<%s>',_0x10cac1,_0x10cac1);}if(!_[_0x3c8d('0x41')](_0x3aaffc)&&typeof _0x3aaffc==='string'&&!_[_0x3c8d('0x32')](_0x3aaffc)){return _0x3aaffc;}return _0x3c8d('0x44');}exports[_0x3c8d('0x45')]=getCallerId;function getCallerIdRandom(_0x28172a,_0x1e4200){var _0x1fca4f;var _0x40d828;var _0x3508fa;if(_0x1e4200<=0x0){_0x1e4200=0x1;}_0x1fca4f=new RegExp(_0x3c8d('0x46')+_0x1e4200+'}$');_0x40d828=Math[_0x3c8d('0x47')](0xa,_0x1e4200-0x1);_0x3508fa=Math[_0x3c8d('0x47')](0xa,_0x1e4200)-0x1;return util[_0x3c8d('0x43')]('%s',_[_0x3c8d('0x48')](_0x28172a,_0x1fca4f,_[_0x3c8d('0x49')](_0x40d828,_0x3508fa)[_0x3c8d('0x4a')]()));}exports[_0x3c8d('0x4b')]=getCallerIdRandom;function decrementOriginate(_0x544db8){if(_0x544db8[_0x3c8d('0x28')]&&_0x544db8[_0x3c8d('0x28')]>0x0){_0x544db8[_0x3c8d('0x28')]-=0x1;}else{logger[_0x3c8d('0x4c')](_0x3c8d('0x4d'));}}exports[_0x3c8d('0x4e')]=decrementOriginate;function checkContactEmpty(_0x31d828){return _0x31d828&&_0x31d828[_0x3c8d('0x4f')]>0x0;}exports[_0x3c8d('0x50')]=checkContactEmpty;function erlangb(_0x148fce,_0x4c63be){if(_0x4c63be===0x0){return 0x0;}var _0x36c830=0x1;for(var _0x111a5f=0x1;_0x111a5f<=_0x4c63be;_0x111a5f+=0x1){_0x36c830=0x1+_0x36c830*_0x111a5f/_0x148fce;}return 0x1/_0x36c830;}exports[_0x3c8d('0x51')]=erlangb;function checkContactLowerLimitOriginate(_0x38a62f,_0x342fe6,_0x45a407){if(_0x342fe6>_0x45a407){for(var _0x2084c1=0x0;_0x2084c1<_0x342fe6-_0x45a407;_0x2084c1+=0x1){decrementOriginate(_0x38a62f);}}}exports[_0x3c8d('0x52')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x2d7d00){var _0x48f095={};var _0x521d43=['id',_0x3c8d('0x53'),_0x3c8d('0x54'),_0x3c8d('0x55'),_0x3c8d('0x56')];if(_0x2d7d00){for(var _0x5bf696 in _0x2d7d00){if(typeof _0x2d7d00[_0x5bf696]!==_0x3c8d('0x57')){if(!_['isNil'](_0x2d7d00[_0x5bf696])&&!_0x521d43['includes'](_0x5bf696)){_0x48f095[util[_0x3c8d('0x43')](_0x3c8d('0x58'),'XMD-',_0x5bf696[_0x3c8d('0x59')]())]=_0x2d7d00[_0x5bf696];}}}}return _0x48f095;}exports[_0x3c8d('0x5a')]=setXMDContactVariables; \ No newline at end of file +var _0x841d=['milliseconds','seconds','message','available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','originated','Trunk','name','active','hasQueueCampaignDataChanged','dialGlobalInterval','isNil','Interval','Intervals','NULL_INTERVAL','isEmpty','EMPTY_INTERVAL','reachable','unmonitored','includes','status','TrunkBackup','INACTIVE','NO_AGENTS_LOGGED','UNREACHABLE_TRUNK','DISACTIVED','getQueueCampaignActiveStatusMessage','match','extractCalleridName','isUndefined','string','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','getCallerId','\x5cw{0,','pow','replace','random','getCallerIdRandom','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','length','checkContactEmpty','createdAt','description','tags','updatedAt','%s%s','moment','util','../../../../config/logger','dialer','timezones','ACTIVE','BLACKLIST','RESCHEDULED_CONTACTS','DEACTIVATED','IS_DISACTIVED','INTERVAL_IS_EMPTY','NOT_ACTIVE','INTERVAL_IS_NULL','INTERVAL_IS_OVERTIME','GLOBAL_INTERVAL_IS_OVERTIME','RECALLFAILEDTIMEOUT','RUNNING','TRUNK_IS_NOT_REACHABLE','dialMethod','preview','isPreviewCampaign','type','ivr','dialActive'];(function(_0x18ae71,_0x3d7d6b){var _0x15381f=function(_0x55dda3){while(--_0x55dda3){_0x18ae71['push'](_0x18ae71['shift']());}};_0x15381f(++_0x3d7d6b);}(_0x841d,0x120));var _0xd841=function(_0x513021,_0x2342ea){_0x513021=_0x513021-0x0;var _0x5d27c2=_0x841d[_0x513021];return _0x5d27c2;};'use strict';var _=require('lodash');var moment=require(_0xd841('0x0'));var util=require(_0xd841('0x1'));var logger=require(_0xd841('0x2'))(_0xd841('0x3'));var timezones=require('../../../../config/environment/shared')[_0xd841('0x4')];var CAMPAIGN_STATUS={'ACTIVE':_0xd841('0x5'),'BLACKLIST':_0xd841('0x6'),'CONTACTS_RESCHEDULED':_0xd841('0x7'),'DEACTIVATED':_0xd841('0x8'),'DISACTIVED':_0xd841('0x9'),'EMPTY_INTERVAL':_0xd841('0xa'),'INACTIVE':_0xd841('0xb'),'NO_AGENTS_LOGGED':'AGENTS_NOT_LOGGED','NO_AVAILABLE_CONTACTS':'AVAILABLE_CONTACTS_FINISHED','NULL_INTERVAL':_0xd841('0xc'),'OVERTIME_INTERVAL':_0xd841('0xd'),'OVERTIME_GLOBAL_INTERVAL':_0xd841('0xe'),'QUEUE_RECALL':'RECALLINQUEUE','RECALL_TIMEOUT':_0xd841('0xf'),'RUNNING':_0xd841('0x10'),'UNKNOWN_TIMEZONE':'TIMEZONE_UNKNOW','UNREACHABLE_TRUNK':_0xd841('0x11')};exports['CAMPAIGN_STATUS']=CAMPAIGN_STATUS;function isPreviewCampaign(_0x390666){return _0x390666[_0xd841('0x12')]===_0xd841('0x13');}exports[_0xd841('0x14')]=isPreviewCampaign;function isIVRCampaign(_0x495d75){return _0x495d75[_0xd841('0x15')]===_0xd841('0x16');}exports['isIVRCampaign']=isIVRCampaign;function isOutboundQueue(_0x4f44fa){return _0x4f44fa[_0xd841('0x15')]==='outbound';}exports['isOutboundQueue']=isOutboundQueue;function isQueueCampaignActive(_0xafee69){return _0xafee69[_0xd841('0x17')];}exports['isQueueCampaignActive']=isQueueCampaignActive;function isIVRCampaignActive(_0x239b77){return _0x239b77['active'];}exports['isIVRCampaignActive']=isIVRCampaignActive;function getSeconds(_0x30176a,_0x5209ae){var _0x31b1d7=moment(_0x30176a)['milliseconds'](0x0);var _0x35172b=moment(_0x5209ae)[_0xd841('0x18')](0x0);return _0x31b1d7['diff'](_0x35172b,_0xd841('0x19'));}exports['getSeconds']=getSeconds;function hasQueueCampaignDataChanged(_0x3b98f8,_0x360b44){var _0x237e90=![];var _0x29b0b3=_0x3b98f8[_0xd841('0x12')]!==_0x360b44['dialMethod']||_0x3b98f8['dialActive']!==_0x360b44[_0xd841('0x17')]||_0x3b98f8[_0xd841('0x1a')]!==_0x360b44[_0xd841('0x1a')];var _0x55e0d8=_0x3b98f8[_0xd841('0x1b')]!==_0x360b44[_0xd841('0x1b')]||_0x3b98f8[_0xd841('0x1c')]!==_0x360b44[_0xd841('0x1c')]||_0x3b98f8[_0xd841('0x1d')]!==_0x360b44[_0xd841('0x1d')]||_0x3b98f8['paused']!==_0x360b44[_0xd841('0x1e')]||_0x3b98f8[_0xd841('0x1f')]!==_0x360b44[_0xd841('0x1f')]||_0x3b98f8[_0xd841('0x20')]!==_0x360b44[_0xd841('0x20')]||_0x3b98f8[_0xd841('0x21')]!==_0x360b44['waiting']||_0x3b98f8['inUse']!==_0x360b44[_0xd841('0x22')]||_0x3b98f8[_0xd841('0x23')]!==_0x360b44[_0xd841('0x23')];if(_0x3b98f8[_0xd841('0x24')]&&_0x360b44[_0xd841('0x24')]){_0x237e90=_0x3b98f8[_0xd841('0x24')][_0xd841('0x25')]!==_0x360b44[_0xd841('0x24')][_0xd841('0x25')]||_0x3b98f8['Trunk'][_0xd841('0x26')]!==_0x360b44[_0xd841('0x24')][_0xd841('0x26')];}return _0x29b0b3||_0x55e0d8||_0x237e90;}exports[_0xd841('0x27')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x335134){var _0x76186a=null;var _0x111b90=_0x335134['dialTimezone'];if(_['isNil'](_0x335134[_0xd841('0x28')])||_[_0xd841('0x29')](_0x335134[_0xd841('0x2a')])||_['isNil'](_0x335134[_0xd841('0x2a')][_0xd841('0x2b')])){_0x76186a=CAMPAIGN_STATUS[_0xd841('0x2c')];}else if(_[_0xd841('0x2d')](_0x335134[_0xd841('0x28')])||_[_0xd841('0x2d')](_0x335134[_0xd841('0x2a')][_0xd841('0x2b')])){_0x76186a=CAMPAIGN_STATUS[_0xd841('0x2e')];}else if(_0x111b90&&!timezones[_0x111b90]){_0x76186a=CAMPAIGN_STATUS['UNKNOWN_TIMEZONE'];}return _0x76186a;}function checkAnyValidTrunk(_0x13b5b9,_0x2c4d87){var _0x474851=null;var _0x149316='SIP/';var _0x4720d7=[_0xd841('0x2f'),_0xd841('0x30')];var _0x13fd1c=!![];if(_0x13b5b9[_0xd841('0x24')]&&_0x13b5b9[_0xd841('0x24')][_0xd841('0x26')]){_0x149316+=_0x13b5b9[_0xd841('0x24')][_0xd841('0x25')];_0x474851=_0x2c4d87[_0x149316];_0x13fd1c=_0x4720d7[_0xd841('0x31')](_0x474851[_0xd841('0x32')]);}else if(_0x13b5b9[_0xd841('0x33')]&&_0x13b5b9[_0xd841('0x33')][_0xd841('0x26')]){_0x149316+=_0x13b5b9[_0xd841('0x33')][_0xd841('0x25')];_0x474851=_0x2c4d87[_0x149316];_0x13fd1c=_0x4720d7[_0xd841('0x31')](_0x474851[_0xd841('0x32')]);}return _0x13fd1c;}function getQueueCampaignStatusMessage(_0x200e77,_0x1e318c){var _0x2885ca=CAMPAIGN_STATUS[_0xd841('0x5')];var _0x158b44=isPreviewCampaign(_0x200e77);if(!isQueueCampaignActive(_0x200e77)){if(_0x158b44){_0x2885ca=CAMPAIGN_STATUS['INACTIVE'];}else{if(_0x200e77[_0xd841('0x23')]===0x0&&_0x200e77['talking']===0x0&&_0x200e77[_0xd841('0x21')]===0x0&&(_0x200e77[_0xd841('0x20')]||0x0)===0x0){_0x2885ca=CAMPAIGN_STATUS[_0xd841('0x34')];}else{_0x2885ca=CAMPAIGN_STATUS['DISACTIVED'];}}}else if(_0x200e77['loggedIn']===0x0){_0x2885ca=CAMPAIGN_STATUS[_0xd841('0x35')];}else if(!checkAnyValidTrunk(_0x200e77,_0x1e318c)){_0x2885ca=CAMPAIGN_STATUS[_0xd841('0x36')];}else if(!isPreviewCampaign(_0x200e77)){var _0x2dc2aa=checkAnyValidQueueCampaignInterval(_0x200e77);if(_0x2dc2aa){_0x2885ca=_0x2dc2aa;}}return _0x2885ca;}exports['getQueueCampaignStatusMessage']=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x409200){var _0x13cfae=CAMPAIGN_STATUS[_0xd841('0x37')];if(_0x409200[_0xd841('0x23')]===0x0&&_0x409200[_0xd841('0x1f')]===0x0&&_0x409200[_0xd841('0x21')]===0x0&&(_0x409200[_0xd841('0x20')]||0x0)===0x0){_0x13cfae=CAMPAIGN_STATUS['INACTIVE'];}return _0x13cfae;}exports[_0xd841('0x38')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x2e7e27){var _0x4a5d71=_0x2e7e27[_0xd841('0x39')](/"(.*?)"/);return _0x4a5d71?_0x4a5d71[0x1]:_0x2e7e27;}exports[_0xd841('0x3a')]=extractCalleridName;function getCallerId(_0x10cc71,_0x316de2,_0x130f4f){if(!_[_0xd841('0x3b')](_0x130f4f)&&typeof _0x130f4f==='string'&&!_[_0xd841('0x2d')](_0x130f4f)){if(!_[_0xd841('0x3b')](_0x316de2)&&typeof _0x316de2===_0xd841('0x3c')&&!_[_0xd841('0x2d')](_0x316de2)){return util[_0xd841('0x3d')]('\x22%s\x22\x20<%s>',_0x316de2,_0x130f4f);}return util[_0xd841('0x3d')](_0xd841('0x3e'),_0x130f4f,_0x130f4f);}if(!_[_0xd841('0x3b')](_0x10cc71)&&typeof _0x10cc71===_0xd841('0x3c')&&!_['isEmpty'](_0x10cc71)){return _0x10cc71;}return _0xd841('0x3f');}exports[_0xd841('0x40')]=getCallerId;function getCallerIdRandom(_0x3d0426,_0x7d33da){var _0x28041a;var _0x2ed052;var _0xac810b;if(_0x7d33da<=0x0){_0x7d33da=0x1;}_0x28041a=new RegExp(_0xd841('0x41')+_0x7d33da+'}$');_0x2ed052=Math[_0xd841('0x42')](0xa,_0x7d33da-0x1);_0xac810b=Math[_0xd841('0x42')](0xa,_0x7d33da)-0x1;return util[_0xd841('0x3d')]('%s',_[_0xd841('0x43')](_0x3d0426,_0x28041a,_[_0xd841('0x44')](_0x2ed052,_0xac810b)['toString']()));}exports[_0xd841('0x45')]=getCallerIdRandom;function decrementOriginate(_0x30ddc4){if(_0x30ddc4[_0xd841('0x23')]&&_0x30ddc4[_0xd841('0x23')]>0x0){_0x30ddc4[_0xd841('0x23')]-=0x1;}else{logger['error'](_0xd841('0x46'));}}exports['decrementOriginate']=decrementOriginate;function checkContactEmpty(_0x11dc51){return _0x11dc51&&_0x11dc51[_0xd841('0x47')]>0x0;}exports[_0xd841('0x48')]=checkContactEmpty;function erlangb(_0x562cfd,_0x548e8c){if(_0x548e8c===0x0){return 0x0;}var _0x1db8d9=0x1;for(var _0xc82786=0x1;_0xc82786<=_0x548e8c;_0xc82786+=0x1){_0x1db8d9=0x1+_0x1db8d9*_0xc82786/_0x562cfd;}return 0x1/_0x1db8d9;}exports['erlangb']=erlangb;function checkContactLowerLimitOriginate(_0xc0bc9d,_0x226e26,_0x2cd3e9){if(_0x226e26>_0x2cd3e9){for(var _0x481f51=0x0;_0x481f51<_0x226e26-_0x2cd3e9;_0x481f51+=0x1){decrementOriginate(_0xc0bc9d);}}}exports['checkContactLowerLimitOriginate']=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x466d79){var _0x17ada3={};var _0x53a2d6=['id',_0xd841('0x49'),_0xd841('0x4a'),_0xd841('0x4b'),_0xd841('0x4c')];if(_0x466d79){for(var _0x5b78c1 in _0x466d79){if(typeof _0x466d79[_0x5b78c1]!=='undefined'){if(!_[_0xd841('0x29')](_0x466d79[_0x5b78c1])&&!_0x53a2d6['includes'](_0x5b78c1)){_0x17ada3[util[_0xd841('0x3d')](_0xd841('0x4d'),'XMD-',_0x5b78c1['toUpperCase']())]=_0x466d79[_0x5b78c1];}}}}return _0x17ada3;}exports['setXMDContactVariables']=setXMDContactVariables; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index c2ac652..7339518 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(_0x2e3849,_0x442dee){var _0x38478a=function(_0x1735af){while(--_0x1735af){_0x2e3849['push'](_0x2e3849['shift']());}};_0x38478a(++_0x442dee);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xa9e0[_0x3c2a69];return _0x596bc8;};'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(_0x1d4238,_0x3e09ce){var _0xaae823=function(_0x243b9f){while(--_0x243b9f){_0x1d4238['push'](_0x1d4238['shift']());}};_0xaae823(++_0x3e09ce);}(_0xa9e0,0x123));var _0x0a9e=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xa9e0[_0x49ca18];return _0x145d54;};'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 05229ef..c8e39fe 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 _0xfe46=['gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif','dir','XMF-PATH','Action','variablesAction','addVariables','ext','isTrunkReachable','isNil','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','fax','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','util','bluebird','moment','path','./util/gs','../../../config/logger','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','faxAccounts','trunks','actions','newchannel','syncNewchannel','syncVarSet','bind','newstate','syncNewState','newexten','syncNewExten','faxstatus','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','context','hasOwnProperty','exten','localstationid','channels','uniqueid','channel','name','\x20syncNewchannel\x20','info','prototype','variable','channelstate','channelstatedesc','value','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','application/pdf','then','calleridnum','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','merge','pick','response','reason','AttachmentId','update','logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SENDING\x20FAILED:\x20','faxstatusstring','SENDING\x20FAILED','send','execOriginate','[Fax][execOriginate][success]','[Fax][execOriginate][failure]','Fax\x20failed','checkTrunk','FaxAccountId','Trunk','Trunk\x20Reachable','format'];(function(_0x5397f4,_0x3f2c05){var _0x4cba07=function(_0x20b72d){while(--_0x20b72d){_0x5397f4['push'](_0x5397f4['shift']());}};_0x4cba07(++_0x3f2c05);}(_0xfe46,0x8c));var _0x6fe4=function(_0x1bffda,_0x3f58d2){_0x1bffda=_0x1bffda-0x0;var _0xbb8fc9=_0xfe46[_0x1bffda];return _0xbb8fc9;};'use strict';var util=require(_0x6fe4('0x0'));var _=require('lodash');var BPromise=require(_0x6fe4('0x1'));var uuid=require('uuid');var moment=require(_0x6fe4('0x2'));var path=require(_0x6fe4('0x3'));var tiff2pdf=require('tiff2pdf');var gs=require(_0x6fe4('0x4'));var logger=require(_0x6fe4('0x5'))('fax');var ami=require('../ami');var rpcDb=require('./rpcDb');var Channel=require('./channel');var ut=require(_0x6fe4('0x6'));var Action=require(_0x6fe4('0x7'));var faxAccount=require(_0x6fe4('0x8'));var attachment=require(_0x6fe4('0x9'));var faxMessage=require(_0x6fe4('0xa'));function Fax(_0x5de25f){this['channels']={};this[_0x6fe4('0xb')]=_0x5de25f[_0x6fe4('0xb')];this[_0x6fe4('0xc')]=_0x5de25f['trunks'];this[_0x6fe4('0xd')]={};ami['on'](_0x6fe4('0xe'),this[_0x6fe4('0xf')]['bind'](this));ami['on']('varset',this[_0x6fe4('0x10')][_0x6fe4('0x11')](this));ami['on'](_0x6fe4('0x12'),this[_0x6fe4('0x13')][_0x6fe4('0x11')](this));ami['on'](_0x6fe4('0x14'),this[_0x6fe4('0x15')][_0x6fe4('0x11')](this));ami['on'](_0x6fe4('0x16'),this['syncFaxStatus']['bind'](this));ami['on'](_0x6fe4('0x17'),this[_0x6fe4('0x18')][_0x6fe4('0x11')](this));ami['on'](_0x6fe4('0x19'),this[_0x6fe4('0x1a')][_0x6fe4('0x11')](this));ami['on'](_0x6fe4('0x1b'),this[_0x6fe4('0x1c')][_0x6fe4('0x11')](this));}Fax['prototype']['syncNewchannel']=function(_0x47bbc1){if(_0x47bbc1[_0x6fe4('0x1d')]==='from-voip-provider'){for(var _0x426f68 in this['faxAccounts']){if(this[_0x6fe4('0xb')][_0x6fe4('0x1e')](_0x426f68)){if(_0x47bbc1[_0x6fe4('0x1f')]===this[_0x6fe4('0xb')][_0x426f68][_0x6fe4('0x20')]){this[_0x6fe4('0x21')][_0x47bbc1['uniqueid']]={};this[_0x6fe4('0x21')][_0x47bbc1[_0x6fe4('0x22')]][_0x6fe4('0x23')]=_0x47bbc1[_0x6fe4('0x23')];this['channels'][_0x47bbc1[_0x6fe4('0x22')]]['id']=this[_0x6fe4('0xb')][_0x426f68]['id'];this[_0x6fe4('0x21')][_0x47bbc1[_0x6fe4('0x22')]][_0x6fe4('0x24')]=this['faxAccounts'][_0x426f68][_0x6fe4('0x24')];logger['info'](_0x47bbc1['uniqueid'],_0x6fe4('0x25'));}}}}if(this[_0x6fe4('0xd')][_0x47bbc1[_0x6fe4('0x22')]]){this['channels'][_0x47bbc1[_0x6fe4('0x22')]]={};this[_0x6fe4('0x21')][_0x47bbc1['uniqueid']][_0x6fe4('0x23')]=_0x47bbc1[_0x6fe4('0x23')];logger[_0x6fe4('0x26')](_0x47bbc1[_0x6fe4('0x22')],_0x6fe4('0x25'));}};Fax[_0x6fe4('0x27')][_0x6fe4('0x10')]=function(_0xe382ef){if(this[_0x6fe4('0x21')][_0xe382ef[_0x6fe4('0x22')]]){for(var _0x206f97 in _0xe382ef[_0x6fe4('0x28')]){if(_0xe382ef[_0x6fe4('0x28')][_0x6fe4('0x1e')](_0x206f97)){this[_0x6fe4('0x21')][_0xe382ef[_0x6fe4('0x22')]][_0x206f97]=_0xe382ef['value'];}}}};Fax['prototype'][_0x6fe4('0x13')]=function(_0x2264a7){if(this[_0x6fe4('0x21')][_0x2264a7[_0x6fe4('0x22')]]){this[_0x6fe4('0x21')][_0x2264a7[_0x6fe4('0x22')]][_0x6fe4('0x29')]=_0x2264a7[_0x6fe4('0x29')];this[_0x6fe4('0x21')][_0x2264a7['uniqueid']][_0x6fe4('0x2a')]=_0x2264a7[_0x6fe4('0x2a')];}};Fax[_0x6fe4('0x27')][_0x6fe4('0x15')]=function(_0x167b42){if(this[_0x6fe4('0x21')][_0x167b42['uniqueid']]){for(var _0x54e7dd in _0x167b42[_0x6fe4('0x28')]){if(_0x167b42['variable'][_0x6fe4('0x1e')](_0x54e7dd)){this[_0x6fe4('0x21')][_0x167b42[_0x6fe4('0x22')]][_0x54e7dd]=_0x167b42[_0x6fe4('0x2b')];}}}};Fax['prototype']['syncFaxStatus']=function(_0x231112){if(this[_0x6fe4('0x21')][_0x231112[_0x6fe4('0x22')]]){this[_0x6fe4('0x21')][_0x231112['uniqueid']]['operation']=_0x231112[_0x6fe4('0x2c')];this[_0x6fe4('0x21')][_0x231112[_0x6fe4('0x22')]][_0x6fe4('0x2d')]=_0x231112['status'];this[_0x6fe4('0x21')][_0x231112['uniqueid']][_0x6fe4('0x20')]=_0x231112[_0x6fe4('0x20')];this['channels'][_0x231112[_0x6fe4('0x22')]][_0x6fe4('0x2e')]=_0x231112[_0x6fe4('0x2e')];logger[_0x6fe4('0x26')](_0x231112['uniqueid'],_0x6fe4('0x2f'));}};Fax[_0x6fe4('0x27')]['syncReceiveFax']=function(_0x5b739c){var _0x7d67d1=this;if(this[_0x6fe4('0x21')][_0x5b739c[_0x6fe4('0x22')]]){var _0x3e9ac9=this[_0x6fe4('0x21')][_0x5b739c[_0x6fe4('0x22')]]['id'];this[_0x6fe4('0x21')][_0x5b739c[_0x6fe4('0x22')]]['remotestationid']=_0x5b739c[_0x6fe4('0x30')];this[_0x6fe4('0x21')][_0x5b739c[_0x6fe4('0x22')]]['pagestransferred']=_0x5b739c[_0x6fe4('0x31')];this[_0x6fe4('0x21')][_0x5b739c[_0x6fe4('0x22')]][_0x6fe4('0x20')]=_0x5b739c['localstationid'];this[_0x6fe4('0x21')][_0x5b739c['uniqueid']][_0x6fe4('0x32')]=_0x5b739c[_0x6fe4('0x32')];this['channels'][_0x5b739c['uniqueid']][_0x6fe4('0x33')]=_0x5b739c['transferrate'];this[_0x6fe4('0x21')][_0x5b739c[_0x6fe4('0x22')]]['filename']=_0x5b739c[_0x6fe4('0x2e')];this[_0x6fe4('0x21')][_0x5b739c[_0x6fe4('0x22')]]['calleridnum']=_0x5b739c['calleridnum'];if(this[_0x6fe4('0x21')][_0x5b739c[_0x6fe4('0x22')]][_0x6fe4('0x31')]>0x0){tiff2pdf(_0x5b739c[_0x6fe4('0x2e')],'/var/opt/motion2/server/files/attachments/',function(_0x406b00){logger[_0x6fe4('0x26')](_0x5b739c['uniqueid'],_0x6fe4('0x34'),_0x406b00[_0x6fe4('0x35')]);attachment[_0x6fe4('0x36')]({'name':path[_0x6fe4('0x37')](_0x5b739c[_0x6fe4('0x2e')])['name'],'basename':path[_0x6fe4('0x37')](_0x5b739c[_0x6fe4('0x2e')])[_0x6fe4('0x24')]+_0x6fe4('0x38'),'type':_0x6fe4('0x39')})[_0x6fe4('0x3a')](function(_0xf57c6f){faxAccount['notify'](_0x3e9ac9,{'from':_0x5b739c[_0x6fe4('0x3b')],'mapKey':'fax','body':path[_0x6fe4('0x37')](_0x5b739c[_0x6fe4('0x2e')])[_0x6fe4('0x24')]+'.pdf','AttachmentId':_0xf57c6f['id']})[_0x6fe4('0x3c')](function(_0x15cd24){logger[_0x6fe4('0x3d')](_0x5b739c[_0x6fe4('0x22')],_0x6fe4('0x3e'),JSON[_0x6fe4('0x3f')](_0x15cd24));});})['catch'](function(_0x31488b){logger[_0x6fe4('0x3d')](_0x5b739c[_0x6fe4('0x22')],_0x6fe4('0x40'),JSON[_0x6fe4('0x3f')](_0x31488b));});});}logger[_0x6fe4('0x26')](_0x5b739c['uniqueid'],_0x6fe4('0x40'));}};Fax[_0x6fe4('0x27')][_0x6fe4('0x1c')]=function(_0x2ce765){if(this[_0x6fe4('0xd')][_0x2ce765['uniqueid']]){_[_0x6fe4('0x41')](this[_0x6fe4('0x21')][_0x2ce765[_0x6fe4('0x22')]],_[_0x6fe4('0x42')](_0x2ce765,[_0x6fe4('0x43'),_0x6fe4('0x44')]));}};function updateStatus(_0x1b14e0){if(_0x1b14e0[_0x6fe4('0x45')]){faxMessage[_0x6fe4('0x46')](_0x1b14e0[_0x6fe4('0x45')],{'failMessage':'SENDING\x20FAILED\x20'})['then'](function(_0x22da96){ut['logger']('[Fax][Message][Error][Updated]',_0x22da96);})[_0x6fe4('0x3c')](function(_0x29c1c8){ut[_0x6fe4('0x47')](_0x6fe4('0x48'),_0x29c1c8);});}else{ut[_0x6fe4('0x47')](_0x6fe4('0x49'));}}Fax[_0x6fe4('0x27')][_0x6fe4('0x4a')]=function(_0xd9f669,_0xd2dfd1,_0x2eaf2f){var _0x4c1a43=this;var _0x43db59={};if(_0xd2dfd1){_0x43db59={'read':_0xd2dfd1};}else{_0x43db59={'failMessage':_0x2eaf2f};}if(this[_0x6fe4('0xd')][_0xd9f669][_0x6fe4('0x45')]){faxMessage[_0x6fe4('0x46')](this[_0x6fe4('0xd')][_0xd9f669][_0x6fe4('0x45')],_0x43db59)['then'](function(_0x20bb2f){ut[_0x6fe4('0x47')](_0x6fe4('0x4b'),_0x20bb2f);})[_0x6fe4('0x3c')](function(_0x5c0308){ut[_0x6fe4('0x47')](_0x6fe4('0x4c'),_0x5c0308);})[_0x6fe4('0x4d')](function(){delete _0x4c1a43[_0x6fe4('0x21')][_0xd9f669];delete _0x4c1a43['actions'][_0xd9f669];});}else{ut[_0x6fe4('0x47')]('[Fax][Message][NoUpdate2]');delete this[_0x6fe4('0x21')][_0xd9f669];delete this[_0x6fe4('0xd')][_0xd9f669];}};Fax[_0x6fe4('0x27')][_0x6fe4('0x1a')]=function(_0x33a812){var _0x39acde=this;if(this[_0x6fe4('0x21')][_0x33a812[_0x6fe4('0x22')]]){if(this['actions'][_0x33a812[_0x6fe4('0x22')]]){this['channels'][_0x33a812['uniqueid']]['id']=this['actions'][_0x33a812['uniqueid']]['id'];this[_0x6fe4('0x21')][_0x33a812[_0x6fe4('0x22')]][_0x6fe4('0x24')]=this[_0x6fe4('0xd')][_0x33a812[_0x6fe4('0x22')]]['name'];}logger[_0x6fe4('0x26')](_0x33a812[_0x6fe4('0x22')],this[_0x6fe4('0xd')][_0x33a812['uniqueid']]?_0x6fe4('0x4e'):_0x6fe4('0x4f'),JSON['stringify'](this[_0x6fe4('0x21')][_0x33a812[_0x6fe4('0x22')]]));if(this[_0x6fe4('0xd')][_0x33a812[_0x6fe4('0x22')]]){if(this[_0x6fe4('0x21')][_0x33a812[_0x6fe4('0x22')]][_0x6fe4('0x50')]>0x0&&this[_0x6fe4('0x21')][_0x33a812[_0x6fe4('0x22')]]['faxstatus']==='SUCCESS'){this[_0x6fe4('0x4a')](_0x33a812[_0x6fe4('0x22')],!![]);}else{this[_0x6fe4('0x4a')](_0x33a812[_0x6fe4('0x22')],![],this[_0x6fe4('0x21')][_0x33a812[_0x6fe4('0x22')]]['faxstatusstring']?_0x6fe4('0x51')+this[_0x6fe4('0x21')][_0x33a812['uniqueid']][_0x6fe4('0x52')]:_0x6fe4('0x53'));}}}};Fax[_0x6fe4('0x27')][_0x6fe4('0x54')]=function(_0x28752a){var _0x231a2f=this;return new BPromise(function(_0x4b302a,_0x8c2690){_0x231a2f[_0x6fe4('0x55')](_0x28752a,_0x231a2f['faxAccounts'][_0x28752a['FaxAccountId']])[_0x6fe4('0x3a')](function(_0x15b038){ut['logger'](_0x6fe4('0x56'),_0x15b038);_0x4b302a(ut['message']('Fax\x20received'));})[_0x6fe4('0x3c')](function(_0x4c653e){ut[_0x6fe4('0x47')](_0x6fe4('0x57'),_0x4c653e);updateStatus(_0x28752a);_0x8c2690(ut[_0x6fe4('0x35')](_0x6fe4('0x58')));});});};Fax[_0x6fe4('0x27')]['checkAfterSend']=function(_0x2a08d9){var _0x2b3945=this;return new BPromise(function(_0x5590e4,_0x481b69){var _0x4a53d5=_0x2b3945[_0x6fe4('0x59')](_0x2b3945[_0x6fe4('0xb')][_0x2a08d9[_0x6fe4('0x5a')]][_0x6fe4('0x5b')],_0x2a08d9);if(_0x4a53d5['isValid']){_0x5590e4(ut['message'](_0x6fe4('0x5c')));}else{_0x481b69(ut[_0x6fe4('0x35')](_0x4a53d5['message']));}});};function originate(_0x198d90,_0x1397a6,_0x59e77d){return new BPromise(function(_0x24e02d,_0x140c8b){if(_0x59e77d){var _0x434a9b=util[_0x6fe4('0x5d')](_0x6fe4('0x5e'),path[_0x6fe4('0x37')](_0x198d90[_0x6fe4('0x3')])[_0x6fe4('0x24')],_0x198d90[_0x6fe4('0x3')]);gs[_0x6fe4('0x5f')](_0x434a9b)[_0x6fe4('0x3a')](function(){_0x198d90[_0x6fe4('0x3')]=util['format'](_0x6fe4('0x60'),path[_0x6fe4('0x37')](_0x198d90[_0x6fe4('0x3')])[_0x6fe4('0x61')],path[_0x6fe4('0x37')](_0x198d90[_0x6fe4('0x3')])[_0x6fe4('0x24')]);_0x1397a6[_0x6fe4('0x62')]=_0x198d90['path'];ut[_0x6fe4('0x47')]('Convert\x20pdf\x20to\x20tif','');ami[_0x6fe4('0x63')](ut[_0x6fe4('0x64')](_0x198d90,_0x1397a6))['then'](function(_0x5dfe78){_0x24e02d(_0x5dfe78);})[_0x6fe4('0x3c')](function(_0x50cbbd){_0x140c8b(_0x50cbbd);});})[_0x6fe4('0x3c')](function(_0x3c4147){_0x140c8b(_0x3c4147);});}else{ami[_0x6fe4('0x63')](ut[_0x6fe4('0x64')](_0x198d90,_0x1397a6))[_0x6fe4('0x3a')](function(_0x4919cf){_0x24e02d(_0x4919cf);})[_0x6fe4('0x3c')](function(_0x2fe0f7){_0x140c8b(_0x2fe0f7);});}});}Fax[_0x6fe4('0x27')]['execOriginate']=function(_0x30f3dc,_0xf7c1f5){var _0x3ac1cf=this;return new BPromise(function(_0x52cb0a,_0x3ed3d1){var _0x3bcf24=uuid['v4']();var _0x1f2cea=ut[_0x6fe4('0x65')](_0x30f3dc,_0xf7c1f5);_0x3ac1cf['actions'][_0x3bcf24]=new Action(_0x3bcf24,_0xf7c1f5,_0x30f3dc);var _0x52e1f9=_0x3ac1cf[_0x6fe4('0xd')][_0x3bcf24];if(path[_0x6fe4('0x37')](_0x30f3dc[_0x6fe4('0x3')])[_0x6fe4('0x66')]===_0x6fe4('0x38')){originate(_0x52e1f9,_0x1f2cea,!![])['then'](function(_0x2f24aa){_0x52cb0a(_0x2f24aa);})['catch'](function(_0x5b9332){_0x3ed3d1(_0x5b9332);});}else{originate(_0x52e1f9,_0x1f2cea,![])[_0x6fe4('0x3a')](function(_0x30cbb8){_0x52cb0a(_0x30cbb8);})[_0x6fe4('0x3c')](function(_0x53209e){_0x3ed3d1(_0x53209e);});}});};Fax['prototype'][_0x6fe4('0x67')]=function(_0x58aa65){return!_[_0x6fe4('0x68')](_0x58aa65)&&!_['isNil'](_0x58aa65[_0x6fe4('0x24')])&&!_[_0x6fe4('0x68')](_0x58aa65['active'])&&_0x58aa65['active']&&!_['isNil'](this[_0x6fe4('0xc')][util['format'](_0x6fe4('0x69'),_0x58aa65['name'])])&&!_[_0x6fe4('0x68')](this[_0x6fe4('0xc')][util['format'](_0x6fe4('0x69'),_0x58aa65[_0x6fe4('0x24')])][_0x6fe4('0x2d')])&&(this[_0x6fe4('0xc')][util['format']('SIP/%s',_0x58aa65[_0x6fe4('0x24')])][_0x6fe4('0x2d')]===_0x6fe4('0x6a')||this[_0x6fe4('0xc')][util['format'](_0x6fe4('0x69'),_0x58aa65['name'])]['status']===_0x6fe4('0x6b'));};Fax['prototype']['checkTrunk']=function(_0xe2e638,_0xce9d70){if(!this['isTrunkReachable'](_0xe2e638)){ut[_0x6fe4('0x47')](_0x6fe4('0x6c'),_[_0x6fe4('0x68')](_0xe2e638)?'':_0xe2e638[_0x6fe4('0x24')]+_0x6fe4('0x6d'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}if(_[_0x6fe4('0x68')](_0xce9d70[_0x6fe4('0x6e')])){ut['logger'](_0x6fe4('0x6f'),JSON[_0x6fe4('0x3f')](_0xce9d70));return{'isValid':![],'message':_0x6fe4('0x70')};}if(_[_0x6fe4('0x68')](_0xce9d70[_0x6fe4('0x3')])){ut['logger'](_0x6fe4('0x71'),JSON['stringify'](_0xce9d70));return{'isValid':![],'message':_0x6fe4('0x72')};}return{'isValid':!![],'message':_0x6fe4('0x73')};};module[_0x6fe4('0x74')]=Fax; \ No newline at end of file +var _0xf614=['XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','bluebird','uuid','path','tiff2pdf','../../../config/logger','../ami','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','syncVarSet','bind','syncNewState','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','syncOriginateResponse','syncNewchannel','context','from-voip-provider','exten','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','hasOwnProperty','value','prototype','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','notify','fax','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','merge','pick','reason','AttachmentId','update','SENDING\x20FAILED\x20','then','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','message','Fax\x20received','Fax\x20failed','checkAfterSend','checkTrunk','Trunk','isValid','Trunk\x20Reachable','format','execute','%s/%s.tif','dir'];(function(_0x54cf77,_0x29de53){var _0x38823c=function(_0x1a7ae1){while(--_0x1a7ae1){_0x54cf77['push'](_0x54cf77['shift']());}};_0x38823c(++_0x29de53);}(_0xf614,0x187));var _0x4f61=function(_0x59f0dc,_0x1e2497){_0x59f0dc=_0x59f0dc-0x0;var _0x5b5445=_0xf614[_0x59f0dc];return _0x5b5445;};'use strict';var util=require('util');var _=require('lodash');var BPromise=require(_0x4f61('0x0'));var uuid=require(_0x4f61('0x1'));var moment=require('moment');var path=require(_0x4f61('0x2'));var tiff2pdf=require(_0x4f61('0x3'));var gs=require('./util/gs');var logger=require(_0x4f61('0x4'))('fax');var ami=require(_0x4f61('0x5'));var rpcDb=require(_0x4f61('0x6'));var Channel=require(_0x4f61('0x7'));var ut=require(_0x4f61('0x8'));var Action=require(_0x4f61('0x9'));var faxAccount=require(_0x4f61('0xa'));var attachment=require(_0x4f61('0xb'));var faxMessage=require(_0x4f61('0xc'));function Fax(_0x481b5c){this[_0x4f61('0xd')]={};this[_0x4f61('0xe')]=_0x481b5c[_0x4f61('0xe')];this[_0x4f61('0xf')]=_0x481b5c[_0x4f61('0xf')];this[_0x4f61('0x10')]={};ami['on'](_0x4f61('0x11'),this['syncNewchannel']['bind'](this));ami['on']('varset',this[_0x4f61('0x12')][_0x4f61('0x13')](this));ami['on']('newstate',this[_0x4f61('0x14')][_0x4f61('0x13')](this));ami['on']('newexten',this['syncNewExten'][_0x4f61('0x13')](this));ami['on'](_0x4f61('0x15'),this[_0x4f61('0x16')][_0x4f61('0x13')](this));ami['on'](_0x4f61('0x17'),this[_0x4f61('0x18')]['bind'](this));ami['on'](_0x4f61('0x19'),this[_0x4f61('0x1a')][_0x4f61('0x13')](this));ami['on']('originateresponse',this[_0x4f61('0x1b')]['bind'](this));}Fax['prototype'][_0x4f61('0x1c')]=function(_0x3815f4){if(_0x3815f4[_0x4f61('0x1d')]===_0x4f61('0x1e')){for(var _0x5ee7a3 in this['faxAccounts']){if(this[_0x4f61('0xe')]['hasOwnProperty'](_0x5ee7a3)){if(_0x3815f4[_0x4f61('0x1f')]===this['faxAccounts'][_0x5ee7a3][_0x4f61('0x20')]){this[_0x4f61('0xd')][_0x3815f4[_0x4f61('0x21')]]={};this[_0x4f61('0xd')][_0x3815f4[_0x4f61('0x21')]][_0x4f61('0x22')]=_0x3815f4[_0x4f61('0x22')];this[_0x4f61('0xd')][_0x3815f4[_0x4f61('0x21')]]['id']=this[_0x4f61('0xe')][_0x5ee7a3]['id'];this[_0x4f61('0xd')][_0x3815f4[_0x4f61('0x21')]][_0x4f61('0x23')]=this[_0x4f61('0xe')][_0x5ee7a3][_0x4f61('0x23')];logger[_0x4f61('0x24')](_0x3815f4[_0x4f61('0x21')],_0x4f61('0x25'));}}}}if(this[_0x4f61('0x10')][_0x3815f4[_0x4f61('0x21')]]){this[_0x4f61('0xd')][_0x3815f4[_0x4f61('0x21')]]={};this['channels'][_0x3815f4[_0x4f61('0x21')]]['channel']=_0x3815f4[_0x4f61('0x22')];logger[_0x4f61('0x24')](_0x3815f4['uniqueid'],_0x4f61('0x25'));}};Fax['prototype'][_0x4f61('0x12')]=function(_0x27b80c){if(this[_0x4f61('0xd')][_0x27b80c[_0x4f61('0x21')]]){for(var _0x152504 in _0x27b80c[_0x4f61('0x26')]){if(_0x27b80c[_0x4f61('0x26')][_0x4f61('0x27')](_0x152504)){this[_0x4f61('0xd')][_0x27b80c['uniqueid']][_0x152504]=_0x27b80c[_0x4f61('0x28')];}}}};Fax[_0x4f61('0x29')][_0x4f61('0x14')]=function(_0xb4163c){if(this[_0x4f61('0xd')][_0xb4163c[_0x4f61('0x21')]]){this['channels'][_0xb4163c[_0x4f61('0x21')]][_0x4f61('0x2a')]=_0xb4163c[_0x4f61('0x2a')];this[_0x4f61('0xd')][_0xb4163c[_0x4f61('0x21')]][_0x4f61('0x2b')]=_0xb4163c['channelstatedesc'];}};Fax[_0x4f61('0x29')][_0x4f61('0x2c')]=function(_0x2ccc46){if(this['channels'][_0x2ccc46[_0x4f61('0x21')]]){for(var _0xb45d47 in _0x2ccc46[_0x4f61('0x26')]){if(_0x2ccc46[_0x4f61('0x26')][_0x4f61('0x27')](_0xb45d47)){this['channels'][_0x2ccc46[_0x4f61('0x21')]][_0xb45d47]=_0x2ccc46[_0x4f61('0x28')];}}}};Fax[_0x4f61('0x29')][_0x4f61('0x16')]=function(_0x34244b){if(this[_0x4f61('0xd')][_0x34244b['uniqueid']]){this[_0x4f61('0xd')][_0x34244b[_0x4f61('0x21')]]['operation']=_0x34244b[_0x4f61('0x2d')];this[_0x4f61('0xd')][_0x34244b['uniqueid']][_0x4f61('0x2e')]=_0x34244b['status'];this[_0x4f61('0xd')][_0x34244b[_0x4f61('0x21')]]['localstationid']=_0x34244b[_0x4f61('0x20')];this[_0x4f61('0xd')][_0x34244b[_0x4f61('0x21')]][_0x4f61('0x2f')]=_0x34244b['filename'];logger[_0x4f61('0x24')](_0x34244b['uniqueid'],_0x4f61('0x30'));}};Fax[_0x4f61('0x29')][_0x4f61('0x18')]=function(_0x398eb8){var _0x1140dd=this;if(this[_0x4f61('0xd')][_0x398eb8[_0x4f61('0x21')]]){var _0x52c1d4=this[_0x4f61('0xd')][_0x398eb8[_0x4f61('0x21')]]['id'];this['channels'][_0x398eb8['uniqueid']][_0x4f61('0x31')]=_0x398eb8[_0x4f61('0x31')];this[_0x4f61('0xd')][_0x398eb8['uniqueid']][_0x4f61('0x32')]=_0x398eb8[_0x4f61('0x32')];this['channels'][_0x398eb8[_0x4f61('0x21')]][_0x4f61('0x20')]=_0x398eb8[_0x4f61('0x20')];this['channels'][_0x398eb8[_0x4f61('0x21')]][_0x4f61('0x33')]=_0x398eb8[_0x4f61('0x33')];this[_0x4f61('0xd')][_0x398eb8[_0x4f61('0x21')]][_0x4f61('0x34')]=_0x398eb8[_0x4f61('0x34')];this[_0x4f61('0xd')][_0x398eb8[_0x4f61('0x21')]][_0x4f61('0x2f')]=_0x398eb8[_0x4f61('0x2f')];this[_0x4f61('0xd')][_0x398eb8[_0x4f61('0x21')]][_0x4f61('0x35')]=_0x398eb8['calleridnum'];if(this['channels'][_0x398eb8['uniqueid']][_0x4f61('0x32')]>0x0){tiff2pdf(_0x398eb8[_0x4f61('0x2f')],_0x4f61('0x36'),function(_0x341150){logger[_0x4f61('0x24')](_0x398eb8[_0x4f61('0x21')],_0x4f61('0x37'),_0x341150['message']);attachment[_0x4f61('0x38')]({'name':path['parse'](_0x398eb8[_0x4f61('0x2f')])[_0x4f61('0x23')],'basename':path[_0x4f61('0x39')](_0x398eb8[_0x4f61('0x2f')])[_0x4f61('0x23')]+_0x4f61('0x3a'),'type':_0x4f61('0x3b')})['then'](function(_0xad91fd){faxAccount[_0x4f61('0x3c')](_0x52c1d4,{'from':_0x398eb8[_0x4f61('0x35')],'mapKey':_0x4f61('0x3d'),'body':path[_0x4f61('0x39')](_0x398eb8['filename'])[_0x4f61('0x23')]+_0x4f61('0x3a'),'AttachmentId':_0xad91fd['id']})[_0x4f61('0x3e')](function(_0x343414){logger[_0x4f61('0x3f')](_0x398eb8[_0x4f61('0x21')],_0x4f61('0x40'),JSON[_0x4f61('0x41')](_0x343414));});})[_0x4f61('0x3e')](function(_0x527313){logger['error'](_0x398eb8[_0x4f61('0x21')],_0x4f61('0x42'),JSON[_0x4f61('0x41')](_0x527313));});});}logger[_0x4f61('0x24')](_0x398eb8[_0x4f61('0x21')],_0x4f61('0x42'));}};Fax[_0x4f61('0x29')]['syncOriginateResponse']=function(_0x44963e){if(this[_0x4f61('0x10')][_0x44963e[_0x4f61('0x21')]]){_[_0x4f61('0x43')](this[_0x4f61('0xd')][_0x44963e[_0x4f61('0x21')]],_[_0x4f61('0x44')](_0x44963e,['response',_0x4f61('0x45')]));}};function updateStatus(_0x8db6d){if(_0x8db6d[_0x4f61('0x46')]){faxMessage[_0x4f61('0x47')](_0x8db6d[_0x4f61('0x46')],{'failMessage':_0x4f61('0x48')})[_0x4f61('0x49')](function(_0x5dac9e){ut[_0x4f61('0x4a')](_0x4f61('0x4b'),_0x5dac9e);})['catch'](function(_0x4e10f9){ut['logger'](_0x4f61('0x4c'),_0x4e10f9);});}else{ut[_0x4f61('0x4a')](_0x4f61('0x4d'));}}Fax['prototype'][_0x4f61('0x4e')]=function(_0x46bd2b,_0x56fbab,_0xa97b68){var _0x45e51b=this;var _0x5aa91a={};if(_0x56fbab){_0x5aa91a={'read':_0x56fbab};}else{_0x5aa91a={'failMessage':_0xa97b68};}if(this[_0x4f61('0x10')][_0x46bd2b][_0x4f61('0x46')]){faxMessage[_0x4f61('0x47')](this[_0x4f61('0x10')][_0x46bd2b][_0x4f61('0x46')],_0x5aa91a)['then'](function(_0x176de6){ut[_0x4f61('0x4a')](_0x4f61('0x4f'),_0x176de6);})[_0x4f61('0x3e')](function(_0x13a786){ut[_0x4f61('0x4a')](_0x4f61('0x50'),_0x13a786);})['finally'](function(){delete _0x45e51b['channels'][_0x46bd2b];delete _0x45e51b[_0x4f61('0x10')][_0x46bd2b];});}else{ut['logger'](_0x4f61('0x51'));delete this['channels'][_0x46bd2b];delete this[_0x4f61('0x10')][_0x46bd2b];}};Fax[_0x4f61('0x29')][_0x4f61('0x1a')]=function(_0x62af7d){var _0xcffe9b=this;if(this[_0x4f61('0xd')][_0x62af7d['uniqueid']]){if(this[_0x4f61('0x10')][_0x62af7d[_0x4f61('0x21')]]){this[_0x4f61('0xd')][_0x62af7d[_0x4f61('0x21')]]['id']=this[_0x4f61('0x10')][_0x62af7d[_0x4f61('0x21')]]['id'];this[_0x4f61('0xd')][_0x62af7d['uniqueid']][_0x4f61('0x23')]=this[_0x4f61('0x10')][_0x62af7d['uniqueid']][_0x4f61('0x23')];}logger[_0x4f61('0x24')](_0x62af7d[_0x4f61('0x21')],this[_0x4f61('0x10')][_0x62af7d['uniqueid']]?_0x4f61('0x52'):_0x4f61('0x53'),JSON[_0x4f61('0x41')](this[_0x4f61('0xd')][_0x62af7d[_0x4f61('0x21')]]));if(this[_0x4f61('0x10')][_0x62af7d['uniqueid']]){if(this['channels'][_0x62af7d[_0x4f61('0x21')]][_0x4f61('0x54')]>0x0&&this['channels'][_0x62af7d['uniqueid']][_0x4f61('0x15')]===_0x4f61('0x55')){this[_0x4f61('0x4e')](_0x62af7d[_0x4f61('0x21')],!![]);}else{this[_0x4f61('0x4e')](_0x62af7d['uniqueid'],![],this[_0x4f61('0xd')][_0x62af7d[_0x4f61('0x21')]][_0x4f61('0x56')]?_0x4f61('0x57')+this['channels'][_0x62af7d[_0x4f61('0x21')]][_0x4f61('0x56')]:_0x4f61('0x58'));}}}};Fax[_0x4f61('0x29')][_0x4f61('0x59')]=function(_0x57dc90){var _0x3d105b=this;return new BPromise(function(_0x479d40,_0x461f60){_0x3d105b[_0x4f61('0x5a')](_0x57dc90,_0x3d105b[_0x4f61('0xe')][_0x57dc90[_0x4f61('0x5b')]])[_0x4f61('0x49')](function(_0x3e0aa8){ut['logger'](_0x4f61('0x5c'),_0x3e0aa8);_0x479d40(ut[_0x4f61('0x5d')](_0x4f61('0x5e')));})[_0x4f61('0x3e')](function(_0x463547){ut[_0x4f61('0x4a')]('[Fax][execOriginate][failure]',_0x463547);updateStatus(_0x57dc90);_0x461f60(ut[_0x4f61('0x5d')](_0x4f61('0x5f')));});});};Fax[_0x4f61('0x29')][_0x4f61('0x60')]=function(_0x2dfbe6){var _0x5dd0fd=this;return new BPromise(function(_0x520069,_0x4595c2){var _0x3d7582=_0x5dd0fd[_0x4f61('0x61')](_0x5dd0fd[_0x4f61('0xe')][_0x2dfbe6[_0x4f61('0x5b')]][_0x4f61('0x62')],_0x2dfbe6);if(_0x3d7582[_0x4f61('0x63')]){_0x520069(ut['message'](_0x4f61('0x64')));}else{_0x4595c2(ut[_0x4f61('0x5d')](_0x3d7582[_0x4f61('0x5d')]));}});};function originate(_0x4724f3,_0xe25a68,_0x1bd78d){return new BPromise(function(_0x353796,_0xa78ee4){if(_0x1bd78d){var _0x20d580=util[_0x4f61('0x65')]('gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit',path[_0x4f61('0x39')](_0x4724f3[_0x4f61('0x2')])[_0x4f61('0x23')],_0x4724f3[_0x4f61('0x2')]);gs[_0x4f61('0x66')](_0x20d580)[_0x4f61('0x49')](function(){_0x4724f3[_0x4f61('0x2')]=util[_0x4f61('0x65')](_0x4f61('0x67'),path[_0x4f61('0x39')](_0x4724f3['path'])[_0x4f61('0x68')],path[_0x4f61('0x39')](_0x4724f3[_0x4f61('0x2')])['name']);_0xe25a68[_0x4f61('0x69')]=_0x4724f3[_0x4f61('0x2')];ut[_0x4f61('0x4a')](_0x4f61('0x6a'),'');ami[_0x4f61('0x6b')](ut[_0x4f61('0x6c')](_0x4724f3,_0xe25a68))['then'](function(_0x3ac595){_0x353796(_0x3ac595);})[_0x4f61('0x3e')](function(_0x1e31df){_0xa78ee4(_0x1e31df);});})['catch'](function(_0x5ba984){_0xa78ee4(_0x5ba984);});}else{ami[_0x4f61('0x6b')](ut[_0x4f61('0x6c')](_0x4724f3,_0xe25a68))['then'](function(_0x2b52cb){_0x353796(_0x2b52cb);})[_0x4f61('0x3e')](function(_0x4c0605){_0xa78ee4(_0x4c0605);});}});}Fax[_0x4f61('0x29')][_0x4f61('0x5a')]=function(_0x541df2,_0x594489){var _0xdbf77e=this;return new BPromise(function(_0x112b13,_0x181819){var _0x238883=uuid['v4']();var _0x425e93=ut[_0x4f61('0x6d')](_0x541df2,_0x594489);_0xdbf77e[_0x4f61('0x10')][_0x238883]=new Action(_0x238883,_0x594489,_0x541df2);var _0x4b95eb=_0xdbf77e['actions'][_0x238883];if(path[_0x4f61('0x39')](_0x541df2['path'])[_0x4f61('0x6e')]==='.pdf'){originate(_0x4b95eb,_0x425e93,!![])[_0x4f61('0x49')](function(_0x18413e){_0x112b13(_0x18413e);})[_0x4f61('0x3e')](function(_0x721780){_0x181819(_0x721780);});}else{originate(_0x4b95eb,_0x425e93,![])[_0x4f61('0x49')](function(_0x164452){_0x112b13(_0x164452);})[_0x4f61('0x3e')](function(_0x5bac37){_0x181819(_0x5bac37);});}});};Fax[_0x4f61('0x29')][_0x4f61('0x6f')]=function(_0x3b767b){return!_[_0x4f61('0x70')](_0x3b767b)&&!_['isNil'](_0x3b767b[_0x4f61('0x23')])&&!_[_0x4f61('0x70')](_0x3b767b[_0x4f61('0x71')])&&_0x3b767b[_0x4f61('0x71')]&&!_[_0x4f61('0x70')](this[_0x4f61('0xf')][util['format'](_0x4f61('0x72'),_0x3b767b[_0x4f61('0x23')])])&&!_[_0x4f61('0x70')](this[_0x4f61('0xf')][util[_0x4f61('0x65')](_0x4f61('0x72'),_0x3b767b[_0x4f61('0x23')])]['status'])&&(this['trunks'][util[_0x4f61('0x65')](_0x4f61('0x72'),_0x3b767b[_0x4f61('0x23')])][_0x4f61('0x2e')]==='reachable'||this[_0x4f61('0xf')][util['format']('SIP/%s',_0x3b767b[_0x4f61('0x23')])][_0x4f61('0x2e')]===_0x4f61('0x73'));};Fax[_0x4f61('0x29')][_0x4f61('0x61')]=function(_0xd33f7a,_0x10086e){if(!this[_0x4f61('0x6f')](_0xd33f7a)){ut['logger'](_0x4f61('0x74'),_['isNil'](_0xd33f7a)?'':_0xd33f7a['name']+_0x4f61('0x75'));return{'isValid':![],'message':_0x4f61('0x76')};}if(_['isNil'](_0x10086e[_0x4f61('0x3d')])){ut['logger'](_0x4f61('0x77'),JSON[_0x4f61('0x41')](_0x10086e));return{'isValid':![],'message':'Empty\x20Fax'};}if(_[_0x4f61('0x70')](_0x10086e[_0x4f61('0x2')])){ut[_0x4f61('0x4a')](_0x4f61('0x78'),JSON['stringify'](_0x10086e));return{'isValid':![],'message':_0x4f61('0x79')};}return{'isValid':!![],'message':_0x4f61('0x7a')};};module[_0x4f61('0x7b')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 86d088f..8c7217e 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 _0x307b=['[Notify]\x20','util','../../../config/logger','preview','lodash','../rpc/faxAccount','error','notify','resolve','catch'];(function(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0x307b,0xd3));var _0xb307=function(_0x296fb0,_0x47a0fa){_0x296fb0=_0x296fb0-0x0;var _0x451e5b=_0x307b[_0x296fb0];return _0x451e5b;};'use strict';var util=require(_0xb307('0x0'));var BPromise=require('bluebird');var logger=require(_0xb307('0x1'))(_0xb307('0x2'));var _=require(_0xb307('0x3'));var faxAccount=require(_0xb307('0x4'));function loggerCatch(_0x20c366){return function(_0x46785d){logger[_0xb307('0x5')](_0x20c366,util['inspect'](_0x46785d,{'showHidden':![],'depth':null}));};}exports[_0xb307('0x6')]=function(_0x3c1a13,_0xaeb787){return BPromise[_0xb307('0x7')]()['then'](faxAccount[_0xb307('0x6')](_0x3c1a13,_0xaeb787))[_0xb307('0x8')](loggerCatch(_0xb307('0x9')));}; \ No newline at end of file +var _0x77ba=['../rpc/faxAccount','error','notify','resolve','then','catch','[Notify]\x20','util','bluebird','preview','lodash'];(function(_0x98f43,_0x36258c){var _0x39e1fa=function(_0x204e2a){while(--_0x204e2a){_0x98f43['push'](_0x98f43['shift']());}};_0x39e1fa(++_0x36258c);}(_0x77ba,0x19e));var _0xa77b=function(_0x104a84,_0x285970){_0x104a84=_0x104a84-0x0;var _0x4973ff=_0x77ba[_0x104a84];return _0x4973ff;};'use strict';var util=require(_0xa77b('0x0'));var BPromise=require(_0xa77b('0x1'));var logger=require('../../../config/logger')(_0xa77b('0x2'));var _=require(_0xa77b('0x3'));var faxAccount=require(_0xa77b('0x4'));function loggerCatch(_0x536349){return function(_0x4b0f06){logger[_0xa77b('0x5')](_0x536349,util['inspect'](_0x4b0f06,{'showHidden':![],'depth':null}));};}exports[_0xa77b('0x6')]=function(_0x526070,_0x383faf){return BPromise[_0xa77b('0x7')]()[_0xa77b('0x8')](faxAccount[_0xa77b('0x6')](_0x526070,_0x383faf))[_0xa77b('0x9')](loggerCatch(_0xa77b('0xa')));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index e783292..dc309a2 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 _0x536c=['../../../../config/logger','exec','execute','info','Exec\x20gs','\x20Error\x20:','util'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x536c,0x1e2));var _0xc536=function(_0x1c73d4,_0x908a5f){_0x1c73d4=_0x1c73d4-0x0;var _0x40d2ab=_0x536c[_0x1c73d4];return _0x40d2ab;};'use strict';var util=require(_0xc536('0x0'));var logger=require(_0xc536('0x1'))('fax');var BPromise=require('bluebird');var exec=require('child_process')[_0xc536('0x2')];exports[_0xc536('0x3')]=function(_0x5008c4){return new BPromise(function(_0x284276,_0x329c15){exec(_0x5008c4,function(_0x39eb5b,_0x631a2a,_0x21060f){logger[_0xc536('0x4')](_0xc536('0x5'),_0x631a2a);if(_0x39eb5b){logger[_0xc536('0x4')]('Exec\x20gs',_0xc536('0x6'),util['inspect'](_0x39eb5b,{'showHidden':![],'depth':null}),_0x631a2a,_0x21060f);_0x329c15(_0x39eb5b);}_0x284276(_0x631a2a);});});}; \ No newline at end of file +var _0xbf4f=['util','bluebird','info','inspect'];(function(_0x49392e,_0x441b28){var _0xe978bb=function(_0x4404d1){while(--_0x4404d1){_0x49392e['push'](_0x49392e['shift']());}};_0xe978bb(++_0x441b28);}(_0xbf4f,0xa0));var _0xfbf4=function(_0x4de5bc,_0x50fa9f){_0x4de5bc=_0x4de5bc-0x0;var _0x1d498c=_0xbf4f[_0x4de5bc];return _0x1d498c;};'use strict';var util=require(_0xfbf4('0x0'));var logger=require('../../../../config/logger')('fax');var BPromise=require(_0xfbf4('0x1'));var exec=require('child_process')['exec'];exports['execute']=function(_0x405f57){return new BPromise(function(_0x366531,_0x356761){exec(_0x405f57,function(_0x3ed720,_0x6654a8,_0x292181){logger[_0xfbf4('0x2')]('Exec\x20gs',_0x6654a8);if(_0x3ed720){logger[_0xfbf4('0x2')]('Exec\x20gs','\x20Error\x20:',util[_0xfbf4('0x3')](_0x3ed720,{'showHidden':![],'depth':null}),_0x6654a8,_0x292181);_0x356761(_0x3ed720);}_0x366531(_0x6654a8);});});}; \ 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 c9fcb29..ae0e9ee 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 _0xcf92=['logger','info','inspect','headerinfo','minrate','maxrate','format','\x22%s\x22','modem','gateway','t38timeout','localstationid','path','variablesAction','uniqueid','originate','channel','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','lodash','moment','../../../../config/logger'];(function(_0x552fa4,_0x5dea1d){var _0x5ed4f3=function(_0x1c02c5){while(--_0x1c02c5){_0x552fa4['push'](_0x552fa4['shift']());}};_0x5ed4f3(++_0x5dea1d);}(_0xcf92,0xb5));var _0x2cf9=function(_0x3b2d80,_0x13a761){_0x3b2d80=_0x3b2d80-0x0;var _0xe26193=_0xcf92[_0x3b2d80];return _0xe26193;};'use strict';var util=require('util');var _=require(_0x2cf9('0x0'));var moment=require(_0x2cf9('0x1'));var logger=require(_0x2cf9('0x2'))('fax');exports['message']=function(_0x30df67){return{'message':_0x30df67};};exports[_0x2cf9('0x3')]=function(_0x194f6a,_0x4ba4fd){logger[_0x2cf9('0x4')](_0x194f6a,util[_0x2cf9('0x5')](_0x4ba4fd,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x212dc6,_0x443a66){var _0x5e1c8a={'XMF-ECM':_0x443a66['ecm'],'XMF-HEADERINFO':_0x443a66[_0x2cf9('0x6')],'XMF-MINRATE':_0x443a66[_0x2cf9('0x7')],'XMF-MAXRATE':_0x443a66[_0x2cf9('0x8')],'XMF-MODEM':util[_0x2cf9('0x9')](_0x2cf9('0xa'),_0x443a66[_0x2cf9('0xb')]),'XMF-GATEWAY':_0x443a66[_0x2cf9('0xc')],'XMF-FAXDETECT':_0x443a66['faxdetect'],'XMF-T38TIMEOUT':_0x443a66[_0x2cf9('0xd')],'XMF-LOCALSTATIONID':_0x443a66[_0x2cf9('0xe')],'XMF-PATH':_0x212dc6[_0x2cf9('0xf')]};return _0x5e1c8a;};exports[_0x2cf9('0x10')]=function(_0x4276c1,_0x416adf){return{'actionid':_0x4276c1[_0x2cf9('0x11')],'action':_0x2cf9('0x12'),'channel':_0x4276c1[_0x2cf9('0x13')],'Exten':_0x2cf9('0x14'),'Context':_0x2cf9('0x15'),'Priority':'1','callerid':util[_0x2cf9('0x9')](_0x2cf9('0x16'),_0x4276c1[_0x2cf9('0x6')]?_0x4276c1[_0x2cf9('0x6')]:'',_0x4276c1['localstationid']),'variable':_0x416adf,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x4276c1[_0x2cf9('0x11')]};}; \ No newline at end of file +var _0x3dc8=['localstationid','path','variablesAction','uniqueid','originate','channel','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','headerinfo','util','moment','../../../../config/logger','fax','info','inspect','addVariables','ecm','minrate','maxrate','format','\x22%s\x22','modem','t38timeout'];(function(_0x3b5ae0,_0xd04a45){var _0x24da45=function(_0x14c2cb){while(--_0x14c2cb){_0x3b5ae0['push'](_0x3b5ae0['shift']());}};_0x24da45(++_0xd04a45);}(_0x3dc8,0x82));var _0x83dc=function(_0x5463e6,_0x21bf14){_0x5463e6=_0x5463e6-0x0;var _0x2a6827=_0x3dc8[_0x5463e6];return _0x2a6827;};'use strict';var util=require(_0x83dc('0x0'));var _=require('lodash');var moment=require(_0x83dc('0x1'));var logger=require(_0x83dc('0x2'))(_0x83dc('0x3'));exports['message']=function(_0x1a9fd9){return{'message':_0x1a9fd9};};exports['logger']=function(_0x3f30dd,_0x1de141){logger[_0x83dc('0x4')](_0x3f30dd,util[_0x83dc('0x5')](_0x1de141,{'showHidden':![],'depth':null}));};exports[_0x83dc('0x6')]=function(_0x430ee7,_0x34780c){var _0x1354ec={'XMF-ECM':_0x34780c[_0x83dc('0x7')],'XMF-HEADERINFO':_0x34780c['headerinfo'],'XMF-MINRATE':_0x34780c[_0x83dc('0x8')],'XMF-MAXRATE':_0x34780c[_0x83dc('0x9')],'XMF-MODEM':util[_0x83dc('0xa')](_0x83dc('0xb'),_0x34780c[_0x83dc('0xc')]),'XMF-GATEWAY':_0x34780c['gateway'],'XMF-FAXDETECT':_0x34780c['faxdetect'],'XMF-T38TIMEOUT':_0x34780c[_0x83dc('0xd')],'XMF-LOCALSTATIONID':_0x34780c[_0x83dc('0xe')],'XMF-PATH':_0x430ee7[_0x83dc('0xf')]};return _0x1354ec;};exports[_0x83dc('0x10')]=function(_0x1385c0,_0xd3d811){return{'actionid':_0x1385c0[_0x83dc('0x11')],'action':_0x83dc('0x12'),'channel':_0x1385c0[_0x83dc('0x13')],'Exten':_0x83dc('0x14'),'Context':_0x83dc('0x15'),'Priority':'1','callerid':util['format'](_0x83dc('0x16'),_0x1385c0[_0x83dc('0x17')]?_0x1385c0[_0x83dc('0x17')]:'',_0x1385c0[_0x83dc('0xe')]),'variable':_0xd3d811,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x1385c0['uniqueid']};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 9452cc6..0b954d4 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 _0xb227=['getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','catch','error','[index.js][initParams]','inspect','listen','sync','[index.js][main]','util','moment','./realtime','./report','./acw','./dialer','./preview','./fax','./rpc/user','./rpc/trunk','./rpc/trigger','./rpc/cmHopperHistory','./rpc/voiceExtension','./rpc/integrations/desk','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger','ami','get','hour','resolve','then','getTelephones','initTelephones','initTrunks','getVoiceQueues','initVoiceQueues','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts'];(function(_0x4780fd,_0x336f2a){var _0x429dbf=function(_0x3f150c){while(--_0x3f150c){_0x4780fd['push'](_0x4780fd['shift']());}};_0x429dbf(++_0x336f2a);}(_0xb227,0xa1));var _0x7b22=function(_0x3199af,_0x302582){_0x3199af=_0x3199af-0x0;var _0x439553=_0xb227[_0x3199af];return _0x439553;};'use strict';var util=require(_0x7b22('0x0'));var moment=require(_0x7b22('0x1'));var server=require('./server');var Realtime=require(_0x7b22('0x2'));var Report=require(_0x7b22('0x3'));var Acw=require(_0x7b22('0x4'));var Trigger=require('./trigger');var Dialer=require(_0x7b22('0x5'));var Preview=require(_0x7b22('0x6'));var Fax=require(_0x7b22('0x7'));var user=require(_0x7b22('0x8'));var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require(_0x7b22('0x9'));var trigger=require(_0x7b22('0xa'));var template=require('./rpc/template');var cmHopperHistory=require(_0x7b22('0xb'));var campaign=require('./rpc/campaign');var voiceExtension=require(_0x7b22('0xc'));var faxAccount=require('./rpc/faxAccount');var zendesk=require('./rpc/integrations/zendesk');var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require('./rpc/integrations/freshdesk');var desk=require(_0x7b22('0xd'));var zoho=require('./rpc/integrations/zoho');var vtiger=require('./rpc/integrations/vtiger');var freshsales=require(_0x7b22('0xe'));var servicenow=require(_0x7b22('0xf'));var dynamics365=require(_0x7b22('0x10'));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(_0x7b22('0x11'))(_0x7b22('0x12'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x7b22('0x13')](_0x7b22('0x14'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x7b22('0x13')](_0x7b22('0x14'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0x7b22('0x15')]()[_0x7b22('0x16')](user['getAgents']())[_0x7b22('0x16')](realtime['initAgents']())[_0x7b22('0x16')](user[_0x7b22('0x17')]())['then'](realtime[_0x7b22('0x18')]())[_0x7b22('0x16')](trunk['getTrunks']())[_0x7b22('0x16')](realtime[_0x7b22('0x19')]())[_0x7b22('0x16')](voiceQueue[_0x7b22('0x1a')]())[_0x7b22('0x16')](realtime[_0x7b22('0x1b')]())['then'](trigger['getTriggers']())[_0x7b22('0x16')](realtime[_0x7b22('0x1c')]())[_0x7b22('0x16')](template[_0x7b22('0x1d')]())[_0x7b22('0x16')](realtime[_0x7b22('0x1e')]())[_0x7b22('0x16')](zendesk[_0x7b22('0x1f')]())[_0x7b22('0x16')](realtime[_0x7b22('0x20')]())[_0x7b22('0x16')](salesforce[_0x7b22('0x21')]())['then'](realtime['initSalesforceAccounts']())['then'](sugarcrm[_0x7b22('0x22')]())[_0x7b22('0x16')](realtime[_0x7b22('0x23')]())[_0x7b22('0x16')](freshdesk[_0x7b22('0x24')]())[_0x7b22('0x16')](realtime[_0x7b22('0x25')]())[_0x7b22('0x16')](desk[_0x7b22('0x26')]())['then'](realtime[_0x7b22('0x27')]())['then'](zoho[_0x7b22('0x28')]())[_0x7b22('0x16')](realtime[_0x7b22('0x29')]())[_0x7b22('0x16')](vtiger[_0x7b22('0x2a')]())[_0x7b22('0x16')](realtime[_0x7b22('0x2b')]())['then'](freshsales[_0x7b22('0x2c')]())[_0x7b22('0x16')](realtime[_0x7b22('0x2d')]())[_0x7b22('0x16')](servicenow[_0x7b22('0x2e')]())[_0x7b22('0x16')](realtime[_0x7b22('0x2f')]())['then'](dynamics365[_0x7b22('0x30')]())['then'](realtime[_0x7b22('0x31')]())[_0x7b22('0x16')](campaign[_0x7b22('0x32')]())[_0x7b22('0x16')](realtime[_0x7b22('0x33')]())['then'](voiceExtension[_0x7b22('0x34')]())[_0x7b22('0x16')](realtime[_0x7b22('0x35')]())[_0x7b22('0x16')](faxAccount[_0x7b22('0x36')]())[_0x7b22('0x16')](realtime[_0x7b22('0x37')]())[_0x7b22('0x16')](function(){return realtime;});}function initParams(){return Promise[_0x7b22('0x15')]()[_0x7b22('0x16')](voiceQueueReport[_0x7b22('0x38')]())[_0x7b22('0x16')](realtime[_0x7b22('0x39')]())['then'](cmHopperHistory['getVoiceQueueHopperHistory']())[_0x7b22('0x16')](realtime[_0x7b22('0x3a')]())[_0x7b22('0x16')](cmHopperHistory[_0x7b22('0x3b')]())[_0x7b22('0x16')](realtime[_0x7b22('0x3c')]())[_0x7b22('0x16')](voiceCallReport[_0x7b22('0x3d')]())['then'](realtime['initVoiceCallReports']())[_0x7b22('0x3e')](function(_0x31e7af){logger[_0x7b22('0x3f')](_0x7b22('0x40'),util[_0x7b22('0x41')](_0x31e7af,{'showHidden':![],'depth':null}));});}function main(){return server[_0x7b22('0x42')](realtime,preview,fax)[_0x7b22('0x16')](function(){return initRealtime();})[_0x7b22('0x16')](function(){return initParams();})[_0x7b22('0x16')](function(){report[_0x7b22('0x43')]();setInterval(initRealtime,0x1388);})[_0x7b22('0x3e')](function(_0x260b69){logger['error'](_0x7b22('0x44'),util[_0x7b22('0x41')](_0x260b69,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0x8887=['./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceCallReport','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/servicenow','ami','get','hour','resolve','then','getAgents','initAgents','getTelephones','initTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','initTriggers','getTemplates','initTemplates','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','error','[index.js][initParams]','sync','catch','util','moment','./server','./realtime','./report','./acw','./dialer','./preview'];(function(_0x2ee570,_0x19a04d){var _0x173c06=function(_0x5d33ee){while(--_0x5d33ee){_0x2ee570['push'](_0x2ee570['shift']());}};_0x173c06(++_0x19a04d);}(_0x8887,0x15b));var _0x7888=function(_0x2aaead,_0x2438c6){_0x2aaead=_0x2aaead-0x0;var _0x5bcc3c=_0x8887[_0x2aaead];return _0x5bcc3c;};'use strict';var util=require(_0x7888('0x0'));var moment=require(_0x7888('0x1'));var server=require(_0x7888('0x2'));var Realtime=require(_0x7888('0x3'));var Report=require(_0x7888('0x4'));var Acw=require(_0x7888('0x5'));var Trigger=require('./trigger');var Dialer=require(_0x7888('0x6'));var Preview=require(_0x7888('0x7'));var Fax=require(_0x7888('0x8'));var user=require(_0x7888('0x9'));var voiceQueue=require(_0x7888('0xa'));var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require(_0x7888('0xb'));var trunk=require('./rpc/trunk');var trigger=require(_0x7888('0xc'));var template=require(_0x7888('0xd'));var cmHopperHistory=require(_0x7888('0xe'));var campaign=require('./rpc/campaign');var voiceExtension=require(_0x7888('0xf'));var faxAccount=require(_0x7888('0x10'));var zendesk=require(_0x7888('0x11'));var salesforce=require(_0x7888('0x12'));var sugarcrm=require(_0x7888('0x13'));var freshdesk=require(_0x7888('0x14'));var desk=require(_0x7888('0x15'));var zoho=require('./rpc/integrations/zoho');var vtiger=require('./rpc/integrations/vtiger');var freshsales=require('./rpc/integrations/freshsales');var servicenow=require(_0x7888('0x16'));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('../../config/logger')(_0x7888('0x17'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x7888('0x18')](_0x7888('0x19'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x7888('0x18')]('hour')===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0x7888('0x1a')]()[_0x7888('0x1b')](user[_0x7888('0x1c')]())[_0x7888('0x1b')](realtime[_0x7888('0x1d')]())['then'](user[_0x7888('0x1e')]())[_0x7888('0x1b')](realtime[_0x7888('0x1f')]())[_0x7888('0x1b')](trunk[_0x7888('0x20')]())['then'](realtime[_0x7888('0x21')]())[_0x7888('0x1b')](voiceQueue[_0x7888('0x22')]())['then'](realtime[_0x7888('0x23')]())[_0x7888('0x1b')](trigger['getTriggers']())[_0x7888('0x1b')](realtime[_0x7888('0x24')]())['then'](template[_0x7888('0x25')]())[_0x7888('0x1b')](realtime[_0x7888('0x26')]())[_0x7888('0x1b')](zendesk['getZendeskAccounts']())['then'](realtime[_0x7888('0x27')]())['then'](salesforce[_0x7888('0x28')]())[_0x7888('0x1b')](realtime[_0x7888('0x29')]())[_0x7888('0x1b')](sugarcrm[_0x7888('0x2a')]())[_0x7888('0x1b')](realtime[_0x7888('0x2b')]())[_0x7888('0x1b')](freshdesk[_0x7888('0x2c')]())[_0x7888('0x1b')](realtime[_0x7888('0x2d')]())[_0x7888('0x1b')](desk['getDeskAccounts']())[_0x7888('0x1b')](realtime[_0x7888('0x2e')]())[_0x7888('0x1b')](zoho[_0x7888('0x2f')]())['then'](realtime[_0x7888('0x30')]())[_0x7888('0x1b')](vtiger[_0x7888('0x31')]())[_0x7888('0x1b')](realtime[_0x7888('0x32')]())[_0x7888('0x1b')](freshsales[_0x7888('0x33')]())[_0x7888('0x1b')](realtime[_0x7888('0x34')]())[_0x7888('0x1b')](servicenow['getServicenowAccounts']())[_0x7888('0x1b')](realtime['initServicenowAccounts']())[_0x7888('0x1b')](dynamics365[_0x7888('0x35')]())[_0x7888('0x1b')](realtime[_0x7888('0x36')]())[_0x7888('0x1b')](campaign[_0x7888('0x37')]())['then'](realtime[_0x7888('0x38')]())[_0x7888('0x1b')](voiceExtension[_0x7888('0x39')]())[_0x7888('0x1b')](realtime[_0x7888('0x3a')]())['then'](faxAccount['getFaxAccounts']())[_0x7888('0x1b')](realtime[_0x7888('0x3b')]())[_0x7888('0x1b')](function(){return realtime;});}function initParams(){return Promise[_0x7888('0x1a')]()[_0x7888('0x1b')](voiceQueueReport[_0x7888('0x3c')]())[_0x7888('0x1b')](realtime[_0x7888('0x3d')]())[_0x7888('0x1b')](cmHopperHistory[_0x7888('0x3e')]())[_0x7888('0x1b')](realtime[_0x7888('0x3f')]())['then'](cmHopperHistory[_0x7888('0x40')]())[_0x7888('0x1b')](realtime['initCampaignHopperHistory']())['then'](voiceCallReport[_0x7888('0x41')]())[_0x7888('0x1b')](realtime[_0x7888('0x42')]())['catch'](function(_0x2018bc){logger[_0x7888('0x43')](_0x7888('0x44'),util['inspect'](_0x2018bc,{'showHidden':![],'depth':null}));});}function main(){return server['listen'](realtime,preview,fax)[_0x7888('0x1b')](function(){return initRealtime();})[_0x7888('0x1b')](function(){return initParams();})[_0x7888('0x1b')](function(){report[_0x7888('0x45')]();setInterval(initRealtime,0x1388);})[_0x7888('0x46')](function(_0x1c5a83){logger['error']('[index.js][main]',util['inspect'](_0x1c5a83,{'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 9174cc5..2fb1d06 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 _0x70c2=['util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','email','accountcode','fullname','state','stateTime','status','unknown','address','phone','interface','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','md5','prototype','updateStatusRealtime','toLowerCase','not_inuse','inuse','talking','toNumber','format','stringify','user:ami:update','omit','emit','user:presence','exports','lodash'];(function(_0x3d34bb,_0xb5dc81){var _0x2ee411=function(_0x2ba3c5){while(--_0x2ba3c5){_0x3d34bb['push'](_0x3d34bb['shift']());}};_0x2ee411(++_0xb5dc81);}(_0x70c2,0x13f));var _0x270c=function(_0x35464c,_0x1e1a4e){_0x35464c=_0x35464c-0x0;var _0x1be291=_0x70c2[_0x35464c];return _0x1be291;};'use strict';var _=require(_0x270c('0x0'));var util=require(_0x270c('0x1'));var moment=require('moment');var md5=require('md5');var Redis=require(_0x270c('0x2'));var config=require(_0x270c('0x3'));config[_0x270c('0x4')]=_[_0x270c('0x5')](config[_0x270c('0x4')],{'host':_0x270c('0x6'),'port':0x18eb});var io=require(_0x270c('0x7'))(new Redis(config['redis']));function Agent(_0x1b2fb8){this['id']=_0x1b2fb8['id']||0x0;this[_0x270c('0x8')]=_0x1b2fb8[_0x270c('0x8')]||'';this[_0x270c('0x9')]=_0x1b2fb8[_0x270c('0x9')]||'';this[_0x270c('0xa')]=_0x1b2fb8[_0x270c('0xa')]||'';this[_0x270c('0xb')]=_0x1b2fb8[_0x270c('0xb')]||'';this[_0x270c('0xc')]='unknown';this[_0x270c('0xd')]=0x0;this[_0x270c('0xe')]=_0x270c('0xf');this[_0x270c('0x10')]='';this[_0x270c('0x11')]='';this['mobile']='';this[_0x270c('0x12')]='';this[_0x270c('0x13')]=_0x1b2fb8[_0x270c('0x13')]||![];this[_0x270c('0x14')]=_0x270c('0xf');this[_0x270c('0x15')]=0x0;this[_0x270c('0x16')]='';this[_0x270c('0x17')]='';this[_0x270c('0x18')]=![];this['local']=![];this[_0x270c('0x19')]='';}Agent[_0x270c('0x1a')][_0x270c('0x1b')]=function(_0x53d25f){var _0x450ec8;if(_0x53d25f&&_0x53d25f[_0x270c('0xc')]){_0x450ec8=_0x53d25f[_0x270c('0xc')][_0x270c('0x1c')]();switch(_0x450ec8){case _0x270c('0x1d'):_0x450ec8='idle';break;case _0x270c('0x1e'):_0x450ec8=_0x270c('0x1f');break;}}if(_0x450ec8&&this['voiceStatus']!==_0x450ec8||_0x53d25f['statePause']){this[_0x270c('0x15')]=_[_0x270c('0x20')](moment()[_0x270c('0x21')]('x'));}if(_0x450ec8){this[_0x270c('0x14')]=_0x450ec8;}var _0x3d0409={'id':this['id'],'name':this[_0x270c('0x8')],'email':this[_0x270c('0x9')],'accountcode':this[_0x270c('0xa')],'fullname':this[_0x270c('0xb')],'state':this[_0x270c('0xc')],'stateTime':this[_0x270c('0xd')],'status':this[_0x270c('0xe')],'address':this['address'],'online':this[_0x270c('0x13')],'voiceStatus':this[_0x270c('0x14')],'voiceStatusTime':this[_0x270c('0x15')],'voiceStatusCallerIdNumber':this[_0x270c('0x16')],'voiceStatusQueue':this[_0x270c('0x17')],'interface':this[_0x270c('0x12')],'onhold':this[_0x270c('0x18')]};var _0x21a773=md5(JSON[_0x270c('0x22')](_0x3d0409));if(this[_0x270c('0x19')]!==_0x21a773){this[_0x270c('0x19')]=_0x21a773;io['to'](util['format']('user:%s',_0x3d0409[_0x270c('0x8')]))['emit'](_0x270c('0x23'),_[_0x270c('0x24')](_0x3d0409,[_0x270c('0x13')]));io[_0x270c('0x25')](_0x270c('0x26'),_0x3d0409);}};module[_0x270c('0x27')]=Agent; \ No newline at end of file +var _0x4c6c=['talking','voiceStatus','statePause','toNumber','format','stateTime','address','voiceStatusQueue','stringify','user:%s','emit','user:ami:update','omit','user:presence','exports','lodash','util','moment','md5','ioredis','../../../config/environment','defaults','localhost','redis','name','email','accountcode','fullname','state','status','unknown','phone','interface','online','voiceStatusTime','voiceStatusCallerIdNumber','onhold','local','updateStatusRealtime','toLowerCase','idle','inuse'];(function(_0x3f4568,_0x9eb0ee){var _0xee2340=function(_0xdefabb){while(--_0xdefabb){_0x3f4568['push'](_0x3f4568['shift']());}};_0xee2340(++_0x9eb0ee);}(_0x4c6c,0xb7));var _0xc4c6=function(_0x3b2216,_0x806bce){_0x3b2216=_0x3b2216-0x0;var _0x3c15dc=_0x4c6c[_0x3b2216];return _0x3c15dc;};'use strict';var _=require(_0xc4c6('0x0'));var util=require(_0xc4c6('0x1'));var moment=require(_0xc4c6('0x2'));var md5=require(_0xc4c6('0x3'));var Redis=require(_0xc4c6('0x4'));var config=require(_0xc4c6('0x5'));config['redis']=_[_0xc4c6('0x6')](config['redis'],{'host':_0xc4c6('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xc4c6('0x8')]));function Agent(_0x3744a8){this['id']=_0x3744a8['id']||0x0;this['name']=_0x3744a8[_0xc4c6('0x9')]||'';this['email']=_0x3744a8[_0xc4c6('0xa')]||'';this[_0xc4c6('0xb')]=_0x3744a8[_0xc4c6('0xb')]||'';this[_0xc4c6('0xc')]=_0x3744a8['fullname']||'';this[_0xc4c6('0xd')]='unknown';this['stateTime']=0x0;this[_0xc4c6('0xe')]=_0xc4c6('0xf');this['address']='';this[_0xc4c6('0x10')]='';this['mobile']='';this[_0xc4c6('0x11')]='';this['online']=_0x3744a8[_0xc4c6('0x12')]||![];this['voiceStatus']='unknown';this[_0xc4c6('0x13')]=0x0;this[_0xc4c6('0x14')]='';this['voiceStatusQueue']='';this[_0xc4c6('0x15')]=![];this[_0xc4c6('0x16')]=![];this[_0xc4c6('0x3')]='';}Agent['prototype'][_0xc4c6('0x17')]=function(_0x545a00){var _0x4192a4;if(_0x545a00&&_0x545a00[_0xc4c6('0xd')]){_0x4192a4=_0x545a00[_0xc4c6('0xd')][_0xc4c6('0x18')]();switch(_0x4192a4){case'not_inuse':_0x4192a4=_0xc4c6('0x19');break;case _0xc4c6('0x1a'):_0x4192a4=_0xc4c6('0x1b');break;}}if(_0x4192a4&&this[_0xc4c6('0x1c')]!==_0x4192a4||_0x545a00[_0xc4c6('0x1d')]){this['voiceStatusTime']=_[_0xc4c6('0x1e')](moment()[_0xc4c6('0x1f')]('x'));}if(_0x4192a4){this[_0xc4c6('0x1c')]=_0x4192a4;}var _0x3f91cd={'id':this['id'],'name':this['name'],'email':this['email'],'accountcode':this[_0xc4c6('0xb')],'fullname':this[_0xc4c6('0xc')],'state':this[_0xc4c6('0xd')],'stateTime':this[_0xc4c6('0x20')],'status':this['status'],'address':this[_0xc4c6('0x21')],'online':this['online'],'voiceStatus':this[_0xc4c6('0x1c')],'voiceStatusTime':this['voiceStatusTime'],'voiceStatusCallerIdNumber':this[_0xc4c6('0x14')],'voiceStatusQueue':this[_0xc4c6('0x22')],'interface':this[_0xc4c6('0x11')],'onhold':this[_0xc4c6('0x15')]};var _0x2f3d6e=md5(JSON[_0xc4c6('0x23')](_0x3f91cd));if(this[_0xc4c6('0x3')]!==_0x2f3d6e){this[_0xc4c6('0x3')]=_0x2f3d6e;io['to'](util[_0xc4c6('0x1f')](_0xc4c6('0x24'),_0x3f91cd[_0xc4c6('0x9')]))[_0xc4c6('0x25')](_0xc4c6('0x26'),_[_0xc4c6('0x27')](_0x3f91cd,['online']));io[_0xc4c6('0x25')](_0xc4c6('0x28'),_0x3f91cd);}};module[_0xc4c6('0x29')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index ba95a05..5aee20a 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 _0xfc41=['dialQueueProject','dialAMDActive','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','temp','ivrAnswerCallsDay','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject'];(function(_0x4d58ce,_0x47fb4f){var _0x504769=function(_0x53d920){while(--_0x53d920){_0x4d58ce['push'](_0x4d58ce['shift']());}};_0x504769(++_0x47fb4f);}(_0xfc41,0x6f));var _0x1fc4=function(_0x3a60fd,_0x2e41d6){_0x3a60fd=_0x3a60fd-0x0;var _0xe20b16=_0xfc41[_0x3a60fd];return _0xe20b16;};'use strict';function Campaign(_0x3a1885){this['id']=_0x3a1885['id']||0x0;this[_0x1fc4('0x0')]=_0x3a1885[_0x1fc4('0x0')]||'';this[_0x1fc4('0x1')]=_0x3a1885['type']||_0x1fc4('0x2');this[_0x1fc4('0x3')]=0x0;this[_0x1fc4('0x4')]=0x0;this[_0x1fc4('0x5')]=0x0;this['ivrTotalCallsDays']=0x0;this[_0x1fc4('0x6')]='';this[_0x1fc4('0x7')]=!![];this[_0x1fc4('0x8')]=_0x3a1885[_0x1fc4('0x8')];this['limitCalls']=_0x3a1885[_0x1fc4('0x9')];this[_0x1fc4('0xa')]=_0x3a1885[_0x1fc4('0xa')]||null;this[_0x1fc4('0xb')]=_0x3a1885[_0x1fc4('0xb')]?_0x3a1885[_0x1fc4('0xb')]:null;this['dialOriginateCallerIdName']=_0x3a1885[_0x1fc4('0xc')];this[_0x1fc4('0xd')]=_0x3a1885[_0x1fc4('0xd')];this[_0x1fc4('0xe')]=_0x3a1885[_0x1fc4('0xe')]||0x1e;this[_0x1fc4('0xf')]=_0x3a1885[_0x1fc4('0xf')];this['dialCongestionRetryFrequency']=_0x3a1885['dialCongestionRetryFrequency'];this['dialBusyMaxRetry']=_0x3a1885[_0x1fc4('0x10')];this[_0x1fc4('0x11')]=_0x3a1885[_0x1fc4('0x11')];this[_0x1fc4('0x12')]=_0x3a1885[_0x1fc4('0x12')];this[_0x1fc4('0x13')]=_0x3a1885[_0x1fc4('0x13')];this[_0x1fc4('0x14')]=_0x3a1885[_0x1fc4('0x14')];this[_0x1fc4('0x15')]=_0x3a1885['dialNoSuchNumberMaxRetry']||0x3;this['dialNoSuchNumberRetryFrequency']=_0x3a1885['dialNoSuchNumberRetryFrequency']||0x96;this['dialDropMaxRetry']=_0x3a1885[_0x1fc4('0x16')]||0x3;this['dialDropRetryFrequency']=_0x3a1885[_0x1fc4('0x17')]||0x96;this[_0x1fc4('0x18')]=_0x3a1885[_0x1fc4('0x18')]||0x3;this[_0x1fc4('0x19')]=_0x3a1885['dialAbandonedRetryFrequency']||0x96;this[_0x1fc4('0x1a')]=_0x3a1885[_0x1fc4('0x1a')]||0x3;this[_0x1fc4('0x1b')]=_0x3a1885[_0x1fc4('0x1b')]||0x96;this['dialAgentRejectMaxRetry']=_0x3a1885[_0x1fc4('0x1c')]||0x3;this[_0x1fc4('0x1d')]=_0x3a1885['dialAgentRejectRetryFrequency']||0x96;this[_0x1fc4('0x1e')]=_0x3a1885[_0x1fc4('0x1e')]||_0x1fc4('0x1f');this[_0x1fc4('0x20')]=_0x3a1885[_0x1fc4('0x20')]||undefined;this[_0x1fc4('0x21')]=_0x3a1885[_0x1fc4('0x21')]||undefined;this[_0x1fc4('0x22')]=_0x3a1885[_0x1fc4('0x22')]||undefined;this['TrunkBackup']=_0x3a1885[_0x1fc4('0x23')]?_0x3a1885[_0x1fc4('0x23')]:undefined;this[_0x1fc4('0x24')]=_0x3a1885[_0x1fc4('0x24')]?_0x3a1885['Trunk']:undefined;this['Interval']=_0x3a1885[_0x1fc4('0x25')]?_0x3a1885['Interval']:undefined;this['SquareProject']=_0x3a1885[_0x1fc4('0x26')]?_0x3a1885[_0x1fc4('0x26')]:undefined;this[_0x1fc4('0x27')]=_0x3a1885['SquareProject']?_0x3a1885[_0x1fc4('0x26')][_0x1fc4('0x0')]:undefined;this[_0x1fc4('0x28')]=_0x3a1885[_0x1fc4('0x28')]||![];this['dialAMDInitialSilence']=_0x3a1885['dialAMDInitialSilence'];this[_0x1fc4('0x29')]=_0x3a1885[_0x1fc4('0x29')];this[_0x1fc4('0x2a')]=_0x3a1885[_0x1fc4('0x2a')];this['dialAMDTotalAnalysisTime']=_0x3a1885[_0x1fc4('0x2b')];this[_0x1fc4('0x2c')]=_0x3a1885[_0x1fc4('0x2c')];this[_0x1fc4('0x2d')]=_0x3a1885[_0x1fc4('0x2d')];this[_0x1fc4('0x2e')]=_0x3a1885[_0x1fc4('0x2e')];this[_0x1fc4('0x2f')]=_0x3a1885[_0x1fc4('0x2f')];this['dialAMDMaximumWordLength']=_0x3a1885[_0x1fc4('0x30')];}module[_0x1fc4('0x31')]=Campaign; \ No newline at end of file +var _0x4a9b=['dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength','exports','name','type','campaign','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry'];(function(_0x2cb8b9,_0x19cd8f){var _0x37bb76=function(_0x463433){while(--_0x463433){_0x2cb8b9['push'](_0x2cb8b9['shift']());}};_0x37bb76(++_0x19cd8f);}(_0x4a9b,0x7c));var _0xb4a9=function(_0x2307d3,_0x3743ed){_0x2307d3=_0x2307d3-0x0;var _0x5828df=_0x4a9b[_0x2307d3];return _0x5828df;};'use strict';function Campaign(_0x1076ca){this['id']=_0x1076ca['id']||0x0;this[_0xb4a9('0x0')]=_0x1076ca[_0xb4a9('0x0')]||'';this[_0xb4a9('0x1')]=_0x1076ca[_0xb4a9('0x1')]||_0xb4a9('0x2');this[_0xb4a9('0x3')]=0x0;this[_0xb4a9('0x4')]=0x0;this[_0xb4a9('0x5')]=0x0;this[_0xb4a9('0x6')]=0x0;this[_0xb4a9('0x7')]='';this[_0xb4a9('0x8')]=!![];this[_0xb4a9('0x9')]=_0x1076ca[_0xb4a9('0x9')];this[_0xb4a9('0xa')]=_0x1076ca[_0xb4a9('0xa')];this[_0xb4a9('0xb')]=_0x1076ca['dialTimezone']||null;this[_0xb4a9('0xc')]=_0x1076ca[_0xb4a9('0xc')]?_0x1076ca[_0xb4a9('0xc')]:null;this[_0xb4a9('0xd')]=_0x1076ca['dialOriginateCallerIdName'];this[_0xb4a9('0xe')]=_0x1076ca[_0xb4a9('0xe')];this['dialOriginateTimeout']=_0x1076ca[_0xb4a9('0xf')]||0x1e;this[_0xb4a9('0x10')]=_0x1076ca['dialCongestionMaxRetry'];this[_0xb4a9('0x11')]=_0x1076ca[_0xb4a9('0x11')];this[_0xb4a9('0x12')]=_0x1076ca['dialBusyMaxRetry'];this[_0xb4a9('0x13')]=_0x1076ca[_0xb4a9('0x13')];this[_0xb4a9('0x14')]=_0x1076ca['dialNoAnswerMaxRetry'];this['dialNoAnswerRetryFrequency']=_0x1076ca[_0xb4a9('0x15')];this['dialGlobalMaxRetry']=_0x1076ca['dialGlobalMaxRetry'];this[_0xb4a9('0x16')]=_0x1076ca[_0xb4a9('0x16')]||0x3;this[_0xb4a9('0x17')]=_0x1076ca['dialNoSuchNumberRetryFrequency']||0x96;this[_0xb4a9('0x18')]=_0x1076ca['dialDropMaxRetry']||0x3;this[_0xb4a9('0x19')]=_0x1076ca['dialDropRetryFrequency']||0x96;this[_0xb4a9('0x1a')]=_0x1076ca[_0xb4a9('0x1a')]||0x3;this[_0xb4a9('0x1b')]=_0x1076ca[_0xb4a9('0x1b')]||0x96;this[_0xb4a9('0x1c')]=_0x1076ca[_0xb4a9('0x1c')]||0x3;this[_0xb4a9('0x1d')]=_0x1076ca[_0xb4a9('0x1d')]||0x96;this[_0xb4a9('0x1e')]=_0x1076ca[_0xb4a9('0x1e')]||0x3;this[_0xb4a9('0x1f')]=_0x1076ca[_0xb4a9('0x1f')]||0x96;this[_0xb4a9('0x20')]=_0x1076ca[_0xb4a9('0x20')]||_0xb4a9('0x21');this[_0xb4a9('0x22')]=_0x1076ca[_0xb4a9('0x22')]||undefined;this[_0xb4a9('0x23')]=_0x1076ca[_0xb4a9('0x23')]||undefined;this[_0xb4a9('0x24')]=_0x1076ca[_0xb4a9('0x24')]||undefined;this['TrunkBackup']=_0x1076ca['TrunkBackup']?_0x1076ca['TrunkBackup']:undefined;this[_0xb4a9('0x25')]=_0x1076ca[_0xb4a9('0x25')]?_0x1076ca[_0xb4a9('0x25')]:undefined;this[_0xb4a9('0x26')]=_0x1076ca[_0xb4a9('0x26')]?_0x1076ca[_0xb4a9('0x26')]:undefined;this['SquareProject']=_0x1076ca['SquareProject']?_0x1076ca[_0xb4a9('0x27')]:undefined;this[_0xb4a9('0x28')]=_0x1076ca[_0xb4a9('0x27')]?_0x1076ca[_0xb4a9('0x27')]['name']:undefined;this[_0xb4a9('0x29')]=_0x1076ca[_0xb4a9('0x29')]||![];this[_0xb4a9('0x2a')]=_0x1076ca[_0xb4a9('0x2a')];this[_0xb4a9('0x2b')]=_0x1076ca[_0xb4a9('0x2b')];this['dialAMDAfterGreetingSilence']=_0x1076ca[_0xb4a9('0x2c')];this[_0xb4a9('0x2d')]=_0x1076ca[_0xb4a9('0x2d')];this[_0xb4a9('0x2e')]=_0x1076ca[_0xb4a9('0x2e')];this[_0xb4a9('0x2f')]=_0x1076ca['dialAMDBetweenWordsSilence'];this[_0xb4a9('0x30')]=_0x1076ca['dialAMDMaximumNumberOfWords'];this['dialAMDSilenceThreshold']=_0x1076ca['dialAMDSilenceThreshold'];this[_0xb4a9('0x31')]=_0x1076ca[_0xb4a9('0x31')];}module[_0xb4a9('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 05c1810..c7933bc 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 _0xa282=['calleridnum','connectedlinenum','accountcode','context','uniqueid','linkedid','exten','answered','answertime','endtime','unmanaged','abandoned','lastapplication','lastdata','duration','holdtime','tag','disposition','monitor','monitorFilename','queue','monitors','transfercalleridnum','mohtime','starttime'];(function(_0x4bc98,_0x3d11dd){var _0x17fabe=function(_0x4b5104){while(--_0x4b5104){_0x4bc98['push'](_0x4bc98['shift']());}};_0x17fabe(++_0x3d11dd);}(_0xa282,0x1f3));var _0x2a28=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0xa282[_0x16b9ed];return _0x66b1f8;};'use strict';function Channel(){this[_0x2a28('0x0')]=null;this['channel']='';this['destinationchannel']='';this[_0x2a28('0x1')]=0x0;this['calleridname']='';this[_0x2a28('0x2')]=undefined;this['connectedlinename']=undefined;this[_0x2a28('0x3')]=0x0;this[_0x2a28('0x4')]='';this[_0x2a28('0x5')]=0x0;this[_0x2a28('0x6')]=0x0;this[_0x2a28('0x7')]=0x0;this[_0x2a28('0x8')]=![];this[_0x2a28('0x9')]=null;this[_0x2a28('0xa')]=null;this[_0x2a28('0xb')]=![];this[_0x2a28('0xc')]=![];this[_0x2a28('0xd')]='';this[_0x2a28('0xe')]='';this[_0x2a28('0xf')]=0x0;this['billableseconds']=0x0;this[_0x2a28('0x10')]=0x0;this['type']=null;this[_0x2a28('0x11')]=null;this[_0x2a28('0x12')]=null;this[_0x2a28('0x13')]=![];this[_0x2a28('0x14')]=null;this[_0x2a28('0x15')]=null;this[_0x2a28('0x16')]=[];this[_0x2a28('0x17')]=undefined;this['transferconnectedlinenum']=undefined;this['transferType']=undefined;this[_0x2a28('0x18')]=0x0;}module['exports']=Channel; \ No newline at end of file +var _0xa67e=['disposition','monitor','monitorFilename','transferType','mohtime','exports','channel','calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode','linkedid','exten','answered','answertime','endtime','unmanaged','abandoned','lastapplication','lastdata','duration','billableseconds','type','tag'];(function(_0x99882d,_0x274dbb){var _0x12a00c=function(_0x2672d8){while(--_0x2672d8){_0x99882d['push'](_0x99882d['shift']());}};_0x12a00c(++_0x274dbb);}(_0xa67e,0xce));var _0xea67=function(_0x1282d5,_0x3f4224){_0x1282d5=_0x1282d5-0x0;var _0x5590de=_0xa67e[_0x1282d5];return _0x5590de;};'use strict';function Channel(){this['starttime']=null;this[_0xea67('0x0')]='';this['destinationchannel']='';this[_0xea67('0x1')]=0x0;this[_0xea67('0x2')]='';this[_0xea67('0x3')]=undefined;this[_0xea67('0x4')]=undefined;this[_0xea67('0x5')]=0x0;this['context']='';this['uniqueid']=0x0;this[_0xea67('0x6')]=0x0;this[_0xea67('0x7')]=0x0;this[_0xea67('0x8')]=![];this[_0xea67('0x9')]=null;this[_0xea67('0xa')]=null;this[_0xea67('0xb')]=![];this[_0xea67('0xc')]=![];this[_0xea67('0xd')]='';this[_0xea67('0xe')]='';this[_0xea67('0xf')]=0x0;this[_0xea67('0x10')]=0x0;this['holdtime']=0x0;this[_0xea67('0x11')]=null;this[_0xea67('0x12')]=null;this[_0xea67('0x13')]=null;this[_0xea67('0x14')]=![];this[_0xea67('0x15')]=null;this['queue']=null;this['monitors']=[];this['transfercalleridnum']=undefined;this['transferconnectedlinenum']=undefined;this[_0xea67('0x16')]=undefined;this[_0xea67('0x17')]=0x0;}module[_0xea67('0x18')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 780ddb1..adec288 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 _0x8f6a=['token','tokenSecret','type','serverUrl','Configurations','exports','name','remoteUri','authType','password','consumerKey','consumerSecret'];(function(_0x4d62d0,_0x46d0f9){var _0xd31940=function(_0xac4b8a){while(--_0xac4b8a){_0x4d62d0['push'](_0x4d62d0['shift']());}};_0xd31940(++_0x46d0f9);}(_0x8f6a,0x126));var _0xa8f6=function(_0x16277f,_0x5453e4){_0x16277f=_0x16277f-0x0;var _0x309d57=_0x8f6a[_0x16277f];return _0x309d57;};'use strict';function DeskAccount(_0x28152b){this['id']=_0x28152b['id']||0x0;this[_0xa8f6('0x0')]=_0x28152b['name']||'';this['username']=_0x28152b['username']||'';this[_0xa8f6('0x1')]=_0x28152b[_0xa8f6('0x1')]||'';this[_0xa8f6('0x2')]=_0x28152b['authType']||'';this[_0xa8f6('0x3')]=_0x28152b['password']||'';this[_0xa8f6('0x4')]=_0x28152b[_0xa8f6('0x4')]||'';this[_0xa8f6('0x5')]=_0x28152b[_0xa8f6('0x5')]||'';this[_0xa8f6('0x6')]=_0x28152b[_0xa8f6('0x6')]||'';this[_0xa8f6('0x7')]=_0x28152b[_0xa8f6('0x7')]||'';this['type']=_0x28152b[_0xa8f6('0x8')]||'';this[_0xa8f6('0x9')]=_0x28152b['serverUrl']||'';this[_0xa8f6('0xa')]=_0x28152b[_0xa8f6('0xa')]||{};}module[_0xa8f6('0xb')]=DeskAccount; \ No newline at end of file +var _0x525b=['type','serverUrl','Configurations','exports','name','username','remoteUri','authType','password','consumerKey','token','tokenSecret'];(function(_0x19616a,_0x545c46){var _0x57bfb4=function(_0x9ab37b){while(--_0x9ab37b){_0x19616a['push'](_0x19616a['shift']());}};_0x57bfb4(++_0x545c46);}(_0x525b,0x64));var _0xb525=function(_0x3ebf8d,_0x2b0c31){_0x3ebf8d=_0x3ebf8d-0x0;var _0x59d8ae=_0x525b[_0x3ebf8d];return _0x59d8ae;};'use strict';function DeskAccount(_0x3741ac){this['id']=_0x3741ac['id']||0x0;this[_0xb525('0x0')]=_0x3741ac[_0xb525('0x0')]||'';this[_0xb525('0x1')]=_0x3741ac['username']||'';this[_0xb525('0x2')]=_0x3741ac[_0xb525('0x2')]||'';this['authType']=_0x3741ac[_0xb525('0x3')]||'';this[_0xb525('0x4')]=_0x3741ac[_0xb525('0x4')]||'';this['consumerKey']=_0x3741ac[_0xb525('0x5')]||'';this['consumerSecret']=_0x3741ac['consumerSecret']||'';this[_0xb525('0x6')]=_0x3741ac[_0xb525('0x6')]||'';this[_0xb525('0x7')]=_0x3741ac[_0xb525('0x7')]||'';this[_0xb525('0x8')]=_0x3741ac['type']||'';this['serverUrl']=_0x3741ac[_0xb525('0x9')]||'';this[_0xb525('0xa')]=_0x3741ac[_0xb525('0xa')]||{};}module[_0xb525('0xb')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 5d0d8df..51b7015 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 _0x9fb7=['modernAuthentication','Configurations','CloudProvider','exports','name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl'];(function(_0x13b3f2,_0x1f230e){var _0x476495=function(_0x34670c){while(--_0x34670c){_0x13b3f2['push'](_0x13b3f2['shift']());}};_0x476495(++_0x1f230e);}(_0x9fb7,0x124));var _0x79fb=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x9fb7[_0x16b9ed];return _0x66b1f8;};'use strict';function Dynamics365Account(_0x591cfc){this['id']=_0x591cfc['id']||0x0;this[_0x79fb('0x0')]=_0x591cfc[_0x79fb('0x0')]||'';this[_0x79fb('0x1')]=_0x591cfc[_0x79fb('0x1')]||'';this[_0x79fb('0x2')]=_0x591cfc[_0x79fb('0x2')]||'';this[_0x79fb('0x3')]=_0x591cfc['remoteUri']||'';this[_0x79fb('0x4')]=_0x591cfc[_0x79fb('0x4')]||'';this[_0x79fb('0x5')]=_0x591cfc[_0x79fb('0x5')]||'';this[_0x79fb('0x6')]=_0x591cfc['clientSecret']||{};this[_0x79fb('0x7')]=_0x591cfc['serverUrl']||'';this[_0x79fb('0x8')]=_0x591cfc[_0x79fb('0x8')]||![];this['Configurations']=_0x591cfc[_0x79fb('0x9')]||{};this[_0x79fb('0xa')]=_0x591cfc[_0x79fb('0xa')]||{};}module[_0x79fb('0xb')]=Dynamics365Account; \ No newline at end of file +var _0x5a70=['name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider','exports'];(function(_0x23604f,_0xa8b11f){var _0x44f5fb=function(_0x244311){while(--_0x244311){_0x23604f['push'](_0x23604f['shift']());}};_0x44f5fb(++_0xa8b11f);}(_0x5a70,0x15c));var _0x05a7=function(_0x5275b8,_0x51e5dd){_0x5275b8=_0x5275b8-0x0;var _0x568a9b=_0x5a70[_0x5275b8];return _0x568a9b;};'use strict';function Dynamics365Account(_0x1d67a4){this['id']=_0x1d67a4['id']||0x0;this[_0x05a7('0x0')]=_0x1d67a4['name']||'';this[_0x05a7('0x1')]=_0x1d67a4['username']||'';this['password']=_0x1d67a4[_0x05a7('0x2')]||'';this['remoteUri']=_0x1d67a4[_0x05a7('0x3')]||'';this[_0x05a7('0x4')]=_0x1d67a4[_0x05a7('0x4')]||'';this['clientId']=_0x1d67a4[_0x05a7('0x5')]||'';this['clientSecret']=_0x1d67a4[_0x05a7('0x6')]||{};this[_0x05a7('0x7')]=_0x1d67a4[_0x05a7('0x7')]||'';this['modernAuthentication']=_0x1d67a4[_0x05a7('0x8')]||![];this[_0x05a7('0x9')]=_0x1d67a4[_0x05a7('0x9')]||{};this[_0x05a7('0xa')]=_0x1d67a4[_0x05a7('0xa')]||{};}module[_0x05a7('0xb')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 4fd03be..f2bcb55 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 _0x7828=['headerinfo','localstationid','minrate','maxrate','modem','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','exports','name','description','ecm'];(function(_0x3f489b,_0x31ccef){var _0x53a380=function(_0x1ca4d1){while(--_0x1ca4d1){_0x3f489b['push'](_0x3f489b['shift']());}};_0x53a380(++_0x31ccef);}(_0x7828,0xc9));var _0x8782=function(_0x3b5713,_0x385157){_0x3b5713=_0x3b5713-0x0;var _0x579961=_0x7828[_0x3b5713];return _0x579961;};'use strict';function FaxAccount(_0x1f8410){this['id']=_0x1f8410['id']||0x0;this[_0x8782('0x0')]=_0x1f8410[_0x8782('0x0')]||'';this[_0x8782('0x1')]=_0x1f8410['description'];this[_0x8782('0x2')]=_0x1f8410[_0x8782('0x2')];this[_0x8782('0x3')]=_0x1f8410[_0x8782('0x3')];this[_0x8782('0x4')]=_0x1f8410[_0x8782('0x4')];this[_0x8782('0x5')]=_0x1f8410['minrate']||0x960;this[_0x8782('0x6')]=_0x1f8410[_0x8782('0x6')]||0x3840;this[_0x8782('0x7')]=_0x1f8410[_0x8782('0x7')]||'v17,v27,v29';this['gateway']=_0x1f8410[_0x8782('0x8')]||'no';this[_0x8782('0x9')]=_0x1f8410['faxdetect']||'no';this['t38timeout']=_0x1f8410[_0x8782('0xa')]||0x1388;this[_0x8782('0xb')]=_0x1f8410['tech']||_0x8782('0xc');this[_0x8782('0xd')]=_0x1f8410[_0x8782('0xd')]?_0x1f8410['Trunk']:undefined;this[_0x8782('0xe')]=_0x1f8410[_0x8782('0xe')];this[_0x8782('0xf')]=_0x1f8410[_0x8782('0xf')];}module[_0x8782('0x10')]=FaxAccount; \ No newline at end of file +var _0x273e=['v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','ListId','key','exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem'];(function(_0x3a903c,_0x3a6675){var _0x3889d7=function(_0x773810){while(--_0x773810){_0x3a903c['push'](_0x3a903c['shift']());}};_0x3889d7(++_0x3a6675);}(_0x273e,0x1b2));var _0xe273=function(_0x41b6c7,_0x1caccb){_0x41b6c7=_0x41b6c7-0x0;var _0x5787fa=_0x273e[_0x41b6c7];return _0x5787fa;};'use strict';function FaxAccount(_0x2c24d7){this['id']=_0x2c24d7['id']||0x0;this[_0xe273('0x0')]=_0x2c24d7['name']||'';this[_0xe273('0x1')]=_0x2c24d7['description'];this['ecm']=_0x2c24d7[_0xe273('0x2')];this[_0xe273('0x3')]=_0x2c24d7[_0xe273('0x3')];this[_0xe273('0x4')]=_0x2c24d7[_0xe273('0x4')];this[_0xe273('0x5')]=_0x2c24d7[_0xe273('0x5')]||0x960;this[_0xe273('0x6')]=_0x2c24d7[_0xe273('0x6')]||0x3840;this[_0xe273('0x7')]=_0x2c24d7[_0xe273('0x7')]||_0xe273('0x8');this[_0xe273('0x9')]=_0x2c24d7[_0xe273('0x9')]||'no';this[_0xe273('0xa')]=_0x2c24d7[_0xe273('0xa')]||'no';this[_0xe273('0xb')]=_0x2c24d7[_0xe273('0xb')]||0x1388;this[_0xe273('0xc')]=_0x2c24d7[_0xe273('0xc')]||_0xe273('0xd');this['Trunk']=_0x2c24d7['Trunk']?_0x2c24d7['Trunk']:undefined;this[_0xe273('0xe')]=_0x2c24d7[_0xe273('0xe')];this[_0xe273('0xf')]=_0x2c24d7[_0xe273('0xf')];}module[_0xe273('0x10')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index cffbf6c..fcb4b23 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 _0x28d9=['serverUrl','Configurations','exports','name','username'];(function(_0x1a4f04,_0x4fade4){var _0x3adb7a=function(_0x2126bc){while(--_0x2126bc){_0x1a4f04['push'](_0x1a4f04['shift']());}};_0x3adb7a(++_0x4fade4);}(_0x28d9,0xcb));var _0x928d=function(_0x3ef53e,_0x41917e){_0x3ef53e=_0x3ef53e-0x0;var _0x1bb262=_0x28d9[_0x3ef53e];return _0x1bb262;};'use strict';function FreshdeskAccount(_0x2f4c8a){this['id']=_0x2f4c8a['id']||0x0;this[_0x928d('0x0')]=_0x2f4c8a[_0x928d('0x0')]||'';this[_0x928d('0x1')]=_0x2f4c8a[_0x928d('0x1')]||'';this['apiKey']=_0x2f4c8a['token']||'';this['remoteUri']=_0x2f4c8a['remoteUri']||'';this[_0x928d('0x2')]=_0x2f4c8a[_0x928d('0x2')]||'';this[_0x928d('0x3')]=_0x2f4c8a[_0x928d('0x3')]||{};}module[_0x928d('0x4')]=FreshdeskAccount; \ No newline at end of file +var _0x8cf1=['Configurations','exports','name','username','apiKey','token','remoteUri','serverUrl'];(function(_0x1bc865,_0x3c4d88){var _0x572649=function(_0x3d74fa){while(--_0x3d74fa){_0x1bc865['push'](_0x1bc865['shift']());}};_0x572649(++_0x3c4d88);}(_0x8cf1,0x82));var _0x18cf=function(_0x220be9,_0x2701c8){_0x220be9=_0x220be9-0x0;var _0x2573c8=_0x8cf1[_0x220be9];return _0x2573c8;};'use strict';function FreshdeskAccount(_0x495da2){this['id']=_0x495da2['id']||0x0;this[_0x18cf('0x0')]=_0x495da2[_0x18cf('0x0')]||'';this['username']=_0x495da2[_0x18cf('0x1')]||'';this[_0x18cf('0x2')]=_0x495da2[_0x18cf('0x3')]||'';this[_0x18cf('0x4')]=_0x495da2[_0x18cf('0x4')]||'';this['serverUrl']=_0x495da2[_0x18cf('0x5')]||'';this['Configurations']=_0x495da2[_0x18cf('0x6')]||{};}module[_0x18cf('0x7')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index ac0b424..57a82c0 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 _0x383d=['exports','name','username','token','remoteUri','serverUrl','Configurations'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x383d,0x86));var _0xd383=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x383d[_0x14add3];return _0x4a174f;};'use strict';function FreshsalesAccount(_0x26f5cd){this['id']=_0x26f5cd['id']||0x0;this['name']=_0x26f5cd[_0xd383('0x0')]||'';this[_0xd383('0x1')]=_0x26f5cd[_0xd383('0x1')]||'';this['apiKey']=_0x26f5cd[_0xd383('0x2')]||'';this[_0xd383('0x3')]=_0x26f5cd[_0xd383('0x3')]||'';this[_0xd383('0x4')]=_0x26f5cd[_0xd383('0x4')]||'';this[_0xd383('0x5')]=_0x26f5cd['Configurations']||{};}module[_0xd383('0x6')]=FreshsalesAccount; \ No newline at end of file +var _0xe35c=['serverUrl','Configurations','name','username','apiKey','remoteUri'];(function(_0x55e840,_0x475895){var _0x1bebb4=function(_0x4b48b5){while(--_0x4b48b5){_0x55e840['push'](_0x55e840['shift']());}};_0x1bebb4(++_0x475895);}(_0xe35c,0x146));var _0xce35=function(_0x415819,_0x239f17){_0x415819=_0x415819-0x0;var _0x27fe93=_0xe35c[_0x415819];return _0x27fe93;};'use strict';function FreshsalesAccount(_0x4a3813){this['id']=_0x4a3813['id']||0x0;this[_0xce35('0x0')]=_0x4a3813[_0xce35('0x0')]||'';this[_0xce35('0x1')]=_0x4a3813[_0xce35('0x1')]||'';this[_0xce35('0x2')]=_0x4a3813['token']||'';this['remoteUri']=_0x4a3813[_0xce35('0x3')]||'';this['serverUrl']=_0x4a3813[_0xce35('0x4')]||'';this[_0xce35('0x5')]=_0x4a3813[_0xce35('0x5')]||{};}module['exports']=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index f9c24e2..78f1d95 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 _0xaeab=['exports','type','inbound','uniqueid','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinenum','connectedlinename','accountcode','context','exten','priority','holdtime','assigned','lastAssignedTo','motionChannel','voice','routealias','mohtime','variables'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0xaeab,0x121));var _0xbaea=function(_0x36f231,_0x44d0c5){_0x36f231=_0x36f231-0x0;var _0x42c283=_0xaeab[_0x36f231];return _0x42c283;};'use strict';function QueueReport(){this[_0xbaea('0x0')]=_0xbaea('0x1');this[_0xbaea('0x2')]='';this['calleridnum']='';this[_0xbaea('0x3')]='';this[_0xbaea('0x4')]='';this[_0xbaea('0x5')]=null;this[_0xbaea('0x6')]=null;this[_0xbaea('0x7')]=0x1;this[_0xbaea('0x8')]=0x1;this[_0xbaea('0x9')]=![];this[_0xbaea('0xa')]=null;this[_0xbaea('0xb')]=![];this[_0xbaea('0xc')]=null;this[_0xbaea('0xd')]=![];this[_0xbaea('0xe')]=null;this[_0xbaea('0xf')]=0x1;this[_0xbaea('0x10')]='';this[_0xbaea('0x11')]='';this[_0xbaea('0x12')]='';this[_0xbaea('0x13')]='';this[_0xbaea('0x14')]='';this[_0xbaea('0x15')]='';this[_0xbaea('0x16')]='';this[_0xbaea('0x17')]=0x0;this[_0xbaea('0x18')]=![];this[_0xbaea('0x19')]='';this[_0xbaea('0x1a')]=_0xbaea('0x1b');this[_0xbaea('0x1c')]=null;this[_0xbaea('0x1d')]=0x0;this[_0xbaea('0x1e')]={};}module[_0xbaea('0x1f')]=QueueReport; \ No newline at end of file +var _0xa337=['lastAssignedTo','motionChannel','voice','routealias','mohtime','variables','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallerexit','queuecallerexitAt','originalposition','connectedlinename','context','exten','priority','assigned'];(function(_0x4ac8df,_0xb279c7){var _0x3d4cf7=function(_0x3fc8ba){while(--_0x3fc8ba){_0x4ac8df['push'](_0x4ac8df['shift']());}};_0x3d4cf7(++_0xb279c7);}(_0xa337,0xe7));var _0x7a33=function(_0x5712a5,_0x2a12cb){_0x5712a5=_0x5712a5-0x0;var _0x521ca6=_0xa337[_0x5712a5];return _0x521ca6;};'use strict';function QueueReport(){this[_0x7a33('0x0')]='inbound';this[_0x7a33('0x1')]='';this[_0x7a33('0x2')]='';this[_0x7a33('0x3')]='';this[_0x7a33('0x4')]='';this[_0x7a33('0x5')]=null;this[_0x7a33('0x6')]=null;this[_0x7a33('0x7')]=0x1;this[_0x7a33('0x8')]=0x1;this[_0x7a33('0x9')]=![];this[_0x7a33('0xa')]=null;this['queuecallercomplete']=![];this['queuecallercompleteAt']=null;this[_0x7a33('0xb')]=![];this[_0x7a33('0xc')]=null;this[_0x7a33('0xd')]=0x1;this['channel']='';this['connectedlinenum']='';this[_0x7a33('0xe')]='';this['accountcode']='';this[_0x7a33('0xf')]='';this[_0x7a33('0x10')]='';this[_0x7a33('0x11')]='';this['holdtime']=0x0;this[_0x7a33('0x12')]=![];this[_0x7a33('0x13')]='';this[_0x7a33('0x14')]=_0x7a33('0x15');this[_0x7a33('0x16')]=null;this[_0x7a33('0x17')]=0x0;this[_0x7a33('0x18')]={};}module['exports']=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 7dbabd6..8eee289 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 _0xd868=['clientId','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','exports','name','remoteUri','password'];(function(_0xf361a3,_0x438658){var _0x8db071=function(_0x5c54cf){while(--_0x5c54cf){_0xf361a3['push'](_0xf361a3['shift']());}};_0x8db071(++_0x438658);}(_0xd868,0x1ec));var _0x8d86=function(_0x1eda20,_0x1149f4){_0x1eda20=_0x1eda20-0x0;var _0x31b953=_0xd868[_0x1eda20];return _0x31b953;};'use strict';function SalesforceAccount(_0x5b2d7b){this['id']=_0x5b2d7b['id']||0x0;this['name']=_0x5b2d7b[_0x8d86('0x0')]||'';this['username']=_0x5b2d7b['username']||'';this[_0x8d86('0x1')]=_0x5b2d7b[_0x8d86('0x1')]||'';this[_0x8d86('0x2')]=_0x5b2d7b['password']||'';this[_0x8d86('0x3')]=_0x5b2d7b[_0x8d86('0x3')]||'';this['clientSecret']=_0x5b2d7b[_0x8d86('0x4')]||'';this[_0x8d86('0x5')]=_0x5b2d7b[_0x8d86('0x5')]||'';this[_0x8d86('0x6')]=_0x5b2d7b[_0x8d86('0x6')]||_0x8d86('0x7');this[_0x8d86('0x8')]=_0x5b2d7b[_0x8d86('0x8')]||'';this[_0x8d86('0x9')]=_0x5b2d7b[_0x8d86('0x9')]||{};}module[_0x8d86('0xa')]=SalesforceAccount; \ No newline at end of file +var _0xd90d=['username','remoteUri','password','clientId','clientSecret','type','integrationTab','serverUrl','Configurations','exports','name'];(function(_0x3eb54d,_0x5364ff){var _0x2d7e00=function(_0x5c6b34){while(--_0x5c6b34){_0x3eb54d['push'](_0x3eb54d['shift']());}};_0x2d7e00(++_0x5364ff);}(_0xd90d,0x180));var _0xdd90=function(_0xdc37a1,_0x53ebb9){_0xdc37a1=_0xdc37a1-0x0;var _0x99b4fe=_0xd90d[_0xdc37a1];return _0x99b4fe;};'use strict';function SalesforceAccount(_0x18c473){this['id']=_0x18c473['id']||0x0;this[_0xdd90('0x0')]=_0x18c473['name']||'';this[_0xdd90('0x1')]=_0x18c473[_0xdd90('0x1')]||'';this[_0xdd90('0x2')]=_0x18c473[_0xdd90('0x2')]||'';this[_0xdd90('0x3')]=_0x18c473[_0xdd90('0x3')]||'';this[_0xdd90('0x4')]=_0x18c473[_0xdd90('0x4')]||'';this[_0xdd90('0x5')]=_0x18c473[_0xdd90('0x5')]||'';this['securityToken']=_0x18c473['securityToken']||'';this['type']=_0x18c473[_0xdd90('0x6')]||_0xdd90('0x7');this[_0xdd90('0x8')]=_0x18c473[_0xdd90('0x8')]||'';this[_0xdd90('0x9')]=_0x18c473[_0xdd90('0x9')]||{};}module[_0xdd90('0xa')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index 7e40c7d..7ffcfd6 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 _0x4628=['name','username','password','remoteUri','serverUrl','Configurations','exports'];(function(_0x33c637,_0x597c26){var _0x14aa20=function(_0x32a8b5){while(--_0x32a8b5){_0x33c637['push'](_0x33c637['shift']());}};_0x14aa20(++_0x597c26);}(_0x4628,0xe0));var _0x8462=function(_0x264551,_0x4ecdbf){_0x264551=_0x264551-0x0;var _0x2c72a5=_0x4628[_0x264551];return _0x2c72a5;};'use strict';function ServicenowAccount(_0x5d0399){this['id']=_0x5d0399['id']||0x0;this[_0x8462('0x0')]=_0x5d0399['name']||'';this[_0x8462('0x1')]=_0x5d0399['username']||'';this[_0x8462('0x2')]=_0x5d0399[_0x8462('0x2')]||'';this[_0x8462('0x3')]=_0x5d0399[_0x8462('0x3')]||'';this[_0x8462('0x4')]=_0x5d0399[_0x8462('0x4')]||'';this[_0x8462('0x5')]=_0x5d0399[_0x8462('0x5')]||{};}module[_0x8462('0x6')]=ServicenowAccount; \ No newline at end of file +var _0x0432=['serverUrl','Configurations','username','password','remoteUri'];(function(_0x4de337,_0x5db3a4){var _0x1a2e95=function(_0xcb2526){while(--_0xcb2526){_0x4de337['push'](_0x4de337['shift']());}};_0x1a2e95(++_0x5db3a4);}(_0x0432,0x1ce));var _0x2043=function(_0x51de17,_0x7e9562){_0x51de17=_0x51de17-0x0;var _0x5429df=_0x0432[_0x51de17];return _0x5429df;};'use strict';function ServicenowAccount(_0x18eebb){this['id']=_0x18eebb['id']||0x0;this['name']=_0x18eebb['name']||'';this['username']=_0x18eebb[_0x2043('0x0')]||'';this[_0x2043('0x1')]=_0x18eebb['password']||'';this[_0x2043('0x2')]=_0x18eebb['remoteUri']||'';this[_0x2043('0x3')]=_0x18eebb['serverUrl']||'';this[_0x2043('0x4')]=_0x18eebb[_0x2043('0x4')]||{};}module['exports']=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index 438fb33..e504b20 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 _0x824e=['name','username','password','remoteUri','serverUrl','Configurations','exports'];(function(_0x101237,_0x448f24){var _0x50ede4=function(_0x4d858d){while(--_0x4d858d){_0x101237['push'](_0x101237['shift']());}};_0x50ede4(++_0x448f24);}(_0x824e,0x16c));var _0xe824=function(_0x57c9c7,_0xb70a91){_0x57c9c7=_0x57c9c7-0x0;var _0x48ad8b=_0x824e[_0x57c9c7];return _0x48ad8b;};'use strict';function SugarcrmAccount(_0x360357){this['id']=_0x360357['id']||0x0;this[_0xe824('0x0')]=_0x360357['name']||'';this[_0xe824('0x1')]=_0x360357[_0xe824('0x1')]||'';this[_0xe824('0x2')]=_0x360357[_0xe824('0x2')]||'';this[_0xe824('0x3')]=_0x360357['remoteUri']||'';this['serverUrl']=_0x360357[_0xe824('0x4')]||'';this[_0xe824('0x5')]=_0x360357[_0xe824('0x5')]||{};}module[_0xe824('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0x57ef=['username','password','remoteUri','serverUrl','Configurations','name'];(function(_0x8ba5d2,_0x22debd){var _0x5d53c1=function(_0x39b33c){while(--_0x39b33c){_0x8ba5d2['push'](_0x8ba5d2['shift']());}};_0x5d53c1(++_0x22debd);}(_0x57ef,0x1e5));var _0xf57e=function(_0x35924e,_0x5c7e7e){_0x35924e=_0x35924e-0x0;var _0x4dc17b=_0x57ef[_0x35924e];return _0x4dc17b;};'use strict';function SugarcrmAccount(_0x27e15d){this['id']=_0x27e15d['id']||0x0;this[_0xf57e('0x0')]=_0x27e15d['name']||'';this[_0xf57e('0x1')]=_0x27e15d[_0xf57e('0x1')]||'';this['password']=_0x27e15d[_0xf57e('0x2')]||'';this[_0xf57e('0x3')]=_0x27e15d['remoteUri']||'';this[_0xf57e('0x4')]=_0x27e15d[_0xf57e('0x4')]||'';this[_0xf57e('0x5')]=_0x27e15d[_0xf57e('0x5')]||{};}module['exports']=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index 72fa52f..4e98478 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 _0xd959=['status','address','name','accountcode','state','unknown','stateTime'];(function(_0x20a38e,_0x26d83f){var _0x278b67=function(_0x3d77cd){while(--_0x3d77cd){_0x20a38e['push'](_0x20a38e['shift']());}};_0x278b67(++_0x26d83f);}(_0xd959,0x1f3));var _0x9d95=function(_0x5eb7e6,_0x4f9191){_0x5eb7e6=_0x5eb7e6-0x0;var _0x106114=_0xd959[_0x5eb7e6];return _0x106114;};'use strict';function Telephone(_0x302e8a){this['id']=_0x302e8a['id']||0x0;this[_0x9d95('0x0')]=_0x302e8a[_0x9d95('0x0')]||'';this[_0x9d95('0x1')]=_0x302e8a[_0x9d95('0x1')]||'';this[_0x9d95('0x2')]=_0x9d95('0x3');this[_0x9d95('0x4')]=0x0;this[_0x9d95('0x5')]='unknown';this[_0x9d95('0x6')]='';}module['exports']=Telephone; \ No newline at end of file +var _0x7e7b=['status','address','exports','name','accountcode','state','unknown','stateTime'];(function(_0x4f1f35,_0x357ae2){var _0x215471=function(_0x545af4){while(--_0x545af4){_0x4f1f35['push'](_0x4f1f35['shift']());}};_0x215471(++_0x357ae2);}(_0x7e7b,0x133));var _0xb7e7=function(_0x1b1eba,_0x71b70){_0x1b1eba=_0x1b1eba-0x0;var _0x2a59b7=_0x7e7b[_0x1b1eba];return _0x2a59b7;};'use strict';function Telephone(_0x3741bf){this['id']=_0x3741bf['id']||0x0;this[_0xb7e7('0x0')]=_0x3741bf['name']||'';this[_0xb7e7('0x1')]=_0x3741bf[_0xb7e7('0x1')]||'';this[_0xb7e7('0x2')]=_0xb7e7('0x3');this[_0xb7e7('0x4')]=0x0;this[_0xb7e7('0x5')]=_0xb7e7('0x3');this[_0xb7e7('0x6')]='';}module[_0xb7e7('0x7')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 5f4a34e..ee8eb5a 100644 --- a/server/services/ami/model/template.js +++ b/server/services/ami/model/template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['exports','name'];(function(_0x4b9106,_0x2d1ded){var _0x122de=function(_0x52e4c0){while(--_0x52e4c0){_0x4b9106['push'](_0x4b9106['shift']());}};_0x122de(++_0x2d1ded);}(_0xa9e0,0x123));var _0x0a9e=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xa9e0[_0x521929];return _0x632436;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template; \ No newline at end of file +var _0xa9e0=['exports','name'];(function(_0x1db89b,_0x27f90b){var _0x5d9256=function(_0x290112){while(--_0x290112){_0x1db89b['push'](_0x1db89b['shift']());}};_0x5d9256(++_0x27f90b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xa9e0[_0x4ea69d];return _0x5318e0;};'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 82573e7..9eb09ac 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 _0x8603=['exports','name','channel','status','AllConditions','AnyConditions','Actions'];(function(_0x1b7bb8,_0x86eade){var _0x2a21c1=function(_0x4a42f5){while(--_0x4a42f5){_0x1b7bb8['push'](_0x1b7bb8['shift']());}};_0x2a21c1(++_0x86eade);}(_0x8603,0x190));var _0x3860=function(_0x3a0ed6,_0x776939){_0x3a0ed6=_0x3a0ed6-0x0;var _0x446ca=_0x8603[_0x3a0ed6];return _0x446ca;};'use strict';function Trigger(_0xba4b79){this['id']=_0xba4b79['id']||0x0;this[_0x3860('0x0')]=_0xba4b79[_0x3860('0x0')]||'';this[_0x3860('0x1')]=_0xba4b79['channel']||'voice';this[_0x3860('0x2')]=_0xba4b79[_0x3860('0x2')]||![];this[_0x3860('0x3')]=_0xba4b79['AllConditions']||[];this[_0x3860('0x4')]=_0xba4b79['AnyConditions']||[];this[_0x3860('0x5')]=_0xba4b79[_0x3860('0x5')]||[];}module[_0x3860('0x6')]=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(_0xa1e3ca,_0x559022){_0xa1e3ca=_0xa1e3ca-0x0;var _0x5005ab=_0x0b0e[_0xa1e3ca];return _0x5005ab;};'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 89e3c8a..30c19de 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 _0x26cb=['defaultuser','exports','active','name','state','unknown','stateTime','status','registry','split','domain','domainport','refresh','registrationtime','address'];(function(_0x49d41c,_0x2bdc35){var _0xb64c5f=function(_0x28f535){while(--_0x28f535){_0x49d41c['push'](_0x49d41c['shift']());}};_0xb64c5f(++_0x2bdc35);}(_0x26cb,0x179));var _0xb26c=function(_0x44f024,_0x194319){_0x44f024=_0x44f024-0x0;var _0x203558=_0x26cb[_0x44f024];return _0x203558;};'use strict';function Trunk(_0x4a1f18){this['id']=_0x4a1f18['id']||0x0;this[_0xb26c('0x0')]=_0x4a1f18[_0xb26c('0x0')]||![];this[_0xb26c('0x1')]=_0x4a1f18[_0xb26c('0x1')]||'';this[_0xb26c('0x2')]=_0xb26c('0x3');this[_0xb26c('0x4')]=0x0;this[_0xb26c('0x5')]=_0xb26c('0x3');this[_0xb26c('0x6')]=_0x4a1f18[_0xb26c('0x6')]&&_0x4a1f18[_0xb26c('0x6')]['indexOf'](':')?_0x4a1f18[_0xb26c('0x6')][_0xb26c('0x7')](':')[0x0]:'';this['host']='';this['port']='';this[_0xb26c('0x8')]='';this[_0xb26c('0x9')]='';this[_0xb26c('0xa')]='';this['stateRegistry']=_0xb26c('0x3');this[_0xb26c('0xb')]='';this[_0xb26c('0xc')]='';this['defaultuser']=_0x4a1f18[_0xb26c('0xd')]||'';}module[_0xb26c('0xe')]=Trunk; \ No newline at end of file +var _0x856d=['stateRegistry','registrationtime','address','defaultuser','name','state','stateTime','unknown','registry','indexOf','host','port','domain','domainport','refresh'];(function(_0x4759ad,_0x478563){var _0x352621=function(_0x7565fb){while(--_0x7565fb){_0x4759ad['push'](_0x4759ad['shift']());}};_0x352621(++_0x478563);}(_0x856d,0x112));var _0xd856=function(_0x4a1efe,_0x42d252){_0x4a1efe=_0x4a1efe-0x0;var _0x2983e7=_0x856d[_0x4a1efe];return _0x2983e7;};'use strict';function Trunk(_0x524d65){this['id']=_0x524d65['id']||0x0;this['active']=_0x524d65['active']||![];this[_0xd856('0x0')]=_0x524d65[_0xd856('0x0')]||'';this[_0xd856('0x1')]='unknown';this[_0xd856('0x2')]=0x0;this['status']=_0xd856('0x3');this[_0xd856('0x4')]=_0x524d65['registry']&&_0x524d65[_0xd856('0x4')][_0xd856('0x5')](':')?_0x524d65[_0xd856('0x4')]['split'](':')[0x0]:'';this[_0xd856('0x6')]='';this[_0xd856('0x7')]='';this[_0xd856('0x8')]='';this[_0xd856('0x9')]='';this[_0xd856('0xa')]='';this[_0xd856('0xb')]=_0xd856('0x3');this[_0xd856('0xc')]='';this[_0xd856('0xd')]='';this[_0xd856('0xe')]=_0x524d65[_0xd856('0xe')]||'';}module['exports']=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index c3cd29f..8f390a5 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 _0x6a68=['exports','exten','recordingFormat','none','mandatoryDisposition'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x6a68,0x19b));var _0x86a6=function(_0x1b5aea,_0x3f04b7){_0x1b5aea=_0x1b5aea-0x0;var _0x15cfc6=_0x6a68[_0x1b5aea];return _0x15cfc6;};'use strict';function voiceExtension(_0x383360){this['id']=_0x383360['id']||0x0;this[_0x86a6('0x0')]=_0x383360[_0x86a6('0x0')]||'';this[_0x86a6('0x1')]=_0x383360[_0x86a6('0x1')]||_0x86a6('0x2');this['mandatoryDisposition']=_0x383360[_0x86a6('0x3')]||![];}module[_0x86a6('0x4')]=voiceExtension; \ No newline at end of file +var _0x05b3=['none','mandatoryDisposition','exten','recordingFormat'];(function(_0x37c309,_0x55978f){var _0x509c24=function(_0x12523d){while(--_0x12523d){_0x37c309['push'](_0x37c309['shift']());}};_0x509c24(++_0x55978f);}(_0x05b3,0x1ae));var _0x305b=function(_0x5751e6,_0x125e5e){_0x5751e6=_0x5751e6-0x0;var _0x4199e4=_0x05b3[_0x5751e6];return _0x4199e4;};'use strict';function voiceExtension(_0xa77798){this['id']=_0xa77798['id']||0x0;this[_0x305b('0x0')]=_0xa77798['exten']||'';this[_0x305b('0x1')]=_0xa77798['recordingFormat']||_0x305b('0x2');this[_0x305b('0x3')]=_0xa77798['mandatoryDisposition']||![];}module['exports']=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index 52b02b4..8ca2074 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 _0xcbef=['outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalHitRate','erlangCalls','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav49','gsm','leastrecent','linear','random','ringall','roundrobin','rrmemory','rrordered','name','monitor_format','type','inbound','waiting','total','sumDuration','sumHoldTime','sumBillable','abandoned','available','loggedIn','onHold','paused','ringing','ringInUse','unknown','acw','acwTimeout','autopause','message','statusMessage','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','outboundRejectCallsDay','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0xcbef,0x11a));var _0xfcbe=function(_0x4a0f62,_0x19f781){_0x4a0f62=_0x4a0f62-0x0;var _0x3ffcc1=_0xcbef[_0x4a0f62];return _0x3ffcc1;};'use strict';var monitorFormat={'wav':'wav','wav49':_0xfcbe('0x0'),'gsm':_0xfcbe('0x1')};var strategy={'fewestcalls':'fewestcalls','leastrecent':_0xfcbe('0x2'),'linear':_0xfcbe('0x3'),'random':_0xfcbe('0x4'),'ringall':_0xfcbe('0x5'),'rr':_0xfcbe('0x6'),'rrmemory':_0xfcbe('0x7'),'rrordered':_0xfcbe('0x8'),'wrandom':'wrandom'};function VoiceQueue(_0x501b25){this['id']=_0x501b25['id']||0x0;this[_0xfcbe('0x9')]=_0x501b25[_0xfcbe('0x9')]||'';this[_0xfcbe('0xa')]=_0x501b25[_0xfcbe('0xa')]||'';this[_0xfcbe('0xb')]=_0x501b25[_0xfcbe('0xb')]||_0xfcbe('0xc');this[_0xfcbe('0xd')]=0x0;this[_0xfcbe('0xe')]=0x0;this['answered']=0x0;this[_0xfcbe('0xf')]=0x0;this[_0xfcbe('0x10')]=0x0;this[_0xfcbe('0x11')]=0x0;this['unmanaged']=0x0;this[_0xfcbe('0x12')]=0x0;this[_0xfcbe('0x13')]=0x0;this['busy']=0x0;this['inUse']=0x0;this['invalid']=0x0;this[_0xfcbe('0x14')]=0x0;this['notInUse']=0x0;this[_0xfcbe('0x15')]=0x0;this[_0xfcbe('0x16')]=0x0;this[_0xfcbe('0x17')]=0x0;this[_0xfcbe('0x18')]=0x0;this['talking']=0x0;this['unavailable']=0x0;this[_0xfcbe('0x19')]=0x0;this[_0xfcbe('0x1a')]=_0x501b25['acw']||![];this['acwTimeout']=_0x501b25[_0xfcbe('0x1b')]||0xa;this[_0xfcbe('0x1c')]=_0x501b25[_0xfcbe('0x1c')]||'no';this['sendMessageOneNotActive']=!![];this[_0xfcbe('0x1d')]='';this[_0xfcbe('0x1e')]='';this[_0xfcbe('0x1f')]=0x0;this[_0xfcbe('0x20')]=0x0;this[_0xfcbe('0x21')]=_0x501b25['dialTimezone']||null;this[_0xfcbe('0x22')]=_0x501b25[_0xfcbe('0x22')]?_0x501b25[_0xfcbe('0x22')]:null;this[_0xfcbe('0x23')]=_0x501b25[_0xfcbe('0x23')];this['dialMethod']=_0x501b25[_0xfcbe('0x24')]||'progressive';this['dialLimitChannel']=_0x501b25[_0xfcbe('0x25')]||0x0;this[_0xfcbe('0x26')]=_0x501b25[_0xfcbe('0x26')]||0x0;this[_0xfcbe('0x27')]=_0x501b25[_0xfcbe('0x27')]||0x1;this[_0xfcbe('0x28')]=_0x501b25['dialPredictiveOptimization']||_0xfcbe('0x29');this[_0xfcbe('0x2a')]=_0x501b25[_0xfcbe('0x2a')]||0.03;this[_0xfcbe('0x2b')]=_0x501b25[_0xfcbe('0x2b')]||0x258;this[_0xfcbe('0x2c')]=_0x501b25['dialOriginateCallerIdName']||_0xfcbe('0x2d');this['dialOriginateCallerIdNumber']=_0x501b25['dialOriginateCallerIdNumber']||_0xfcbe('0x2d');this[_0xfcbe('0x2e')]=_0x501b25[_0xfcbe('0x2e')]||0x1e;this[_0xfcbe('0x2f')]=_0x501b25[_0xfcbe('0x2f')]||_0xfcbe('0x30');this['dialQueueTimeout']=_0x501b25['dialQueueTimeout']||0x3;this[_0xfcbe('0x31')]=_0x501b25['dialQueueProject']||undefined;this[_0xfcbe('0x32')]=_0x501b25[_0xfcbe('0x32')]||0x3;this[_0xfcbe('0x33')]=_0x501b25[_0xfcbe('0x33')]||0x96;this['dialBusyMaxRetry']=_0x501b25['dialBusyMaxRetry']||0x3;this[_0xfcbe('0x34')]=_0x501b25[_0xfcbe('0x34')]||0x96;this[_0xfcbe('0x35')]=_0x501b25['dialNoAnswerMaxRetry']||0x3;this[_0xfcbe('0x36')]=_0x501b25[_0xfcbe('0x36')]||0x96;this[_0xfcbe('0x37')]=_0x501b25[_0xfcbe('0x37')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x501b25[_0xfcbe('0x38')]||0x96;this[_0xfcbe('0x39')]=_0x501b25[_0xfcbe('0x39')]||0x3;this[_0xfcbe('0x3a')]=_0x501b25[_0xfcbe('0x3a')]||0x96;this[_0xfcbe('0x3b')]=_0x501b25[_0xfcbe('0x3b')]||0x3;this[_0xfcbe('0x3c')]=_0x501b25[_0xfcbe('0x3c')]||0x96;this[_0xfcbe('0x3d')]=_0x501b25[_0xfcbe('0x3d')]||0x3;this[_0xfcbe('0x3e')]=_0x501b25[_0xfcbe('0x3e')]||0x96;this['dialAgentRejectMaxRetry']=_0x501b25[_0xfcbe('0x3f')]||0x3;this[_0xfcbe('0x40')]=_0x501b25[_0xfcbe('0x40')]||0x96;this[_0xfcbe('0x41')]=_0x501b25[_0xfcbe('0x41')]||0x3;this[_0xfcbe('0x42')]=_0x501b25['dialGlobalMaxRetry']||0x4;this[_0xfcbe('0x43')]=_0x501b25[_0xfcbe('0x43')]?_0x501b25[_0xfcbe('0x43')]:undefined;this[_0xfcbe('0x44')]=_0x501b25[_0xfcbe('0x44')]?_0x501b25[_0xfcbe('0x44')]:undefined;this[_0xfcbe('0x45')]=_0x501b25[_0xfcbe('0x45')]||undefined;this[_0xfcbe('0x46')]=_0x501b25[_0xfcbe('0x46')]?_0x501b25[_0xfcbe('0x46')]:undefined;this[_0xfcbe('0x47')]=_0x501b25['dialOrderByScheduledAt']||_0xfcbe('0x48');this[_0xfcbe('0x49')]=_0x501b25['dialRandomLastDigitCallerIdNumber']||undefined;this[_0xfcbe('0x4a')]=_0x501b25[_0xfcbe('0x4a')]||undefined;this['strategy']=strategy[_0x501b25[_0xfcbe('0x4b')]];this['queueStatusComplete']=!![];this[_0xfcbe('0x4c')]=_0x501b25['dialAMDActive']||![];this['dialAMDInitialSilence']=_0x501b25[_0xfcbe('0x4d')];this['dialAMDGreeting']=_0x501b25[_0xfcbe('0x4e')];this[_0xfcbe('0x4f')]=_0x501b25[_0xfcbe('0x4f')];this['dialAMDTotalAnalysisTime']=_0x501b25['dialAMDTotalAnalysisTime'];this[_0xfcbe('0x50')]=_0x501b25[_0xfcbe('0x50')];this[_0xfcbe('0x51')]=_0x501b25['dialAMDBetweenWordsSilence'];this[_0xfcbe('0x52')]=_0x501b25[_0xfcbe('0x52')];this[_0xfcbe('0x53')]=_0x501b25['dialAMDSilenceThreshold'];this['dialAMDMaximumWordLength']=_0x501b25['dialAMDMaximumWordLength'];this[_0xfcbe('0x54')]=0x0;this['pTalking']=0x0;this[_0xfcbe('0x55')]=_0x501b25[_0xfcbe('0x55')];this[_0xfcbe('0x56')]=0x0;this[_0xfcbe('0x57')]=0x0;this[_0xfcbe('0x58')]=0x0;this['outboundBusyCallsDay']=0x0;this[_0xfcbe('0x59')]=0x0;this[_0xfcbe('0x5a')]=0x0;this[_0xfcbe('0x5b')]=0x0;this[_0xfcbe('0x5c')]=0x0;this[_0xfcbe('0x5d')]=0x0;this[_0xfcbe('0x5e')]=0x0;this[_0xfcbe('0x5f')]=0x0;this['outboundDropCallsDayACS']=0x0;this[_0xfcbe('0x60')]=0x0;this[_0xfcbe('0x61')]=0x0;this[_0xfcbe('0x62')]=undefined;this[_0xfcbe('0x63')]=undefined;this[_0xfcbe('0x64')]=undefined;this[_0xfcbe('0x65')]=1.05;this[_0xfcbe('0x66')]=0x0;this[_0xfcbe('0x67')]=0x0;this[_0xfcbe('0x68')]=0x0;this[_0xfcbe('0x69')]=0x0;this[_0xfcbe('0x6a')]=0x0;this[_0xfcbe('0x6b')]=0x0;this['predictiveIntervalPauses']=0x0;this['predictiveIntervalAvailable']=0x0;this[_0xfcbe('0x6c')]=_0x501b25['dialPredictiveIntervalMaxThreshold']||0x14;this[_0xfcbe('0x6d')]=_0x501b25[_0xfcbe('0x6e')]||0xa;this[_0xfcbe('0x6f')]=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this[_0xfcbe('0x70')]=0x1;this[_0xfcbe('0x71')]=0x0;this['erlangCallToSecond']=0x0;this['erlangAbandonmentRate']=0x0;this[_0xfcbe('0x72')]=0x0;this[_0xfcbe('0x73')]=_0x501b25[_0xfcbe('0x73')]||0x1e;this[_0xfcbe('0x74')]=_0x501b25[_0xfcbe('0x74')]||![];this[_0xfcbe('0x75')]=!!_0x501b25['dialPreviewAutoRecallMe']||![];this[_0xfcbe('0x76')]=!!_0x501b25[_0xfcbe('0x76')]||![];this[_0xfcbe('0x77')]=_0x501b25[_0xfcbe('0x77')]||undefined;this[_0xfcbe('0x78')]=_0x501b25[_0xfcbe('0x78')]||![];this[_0xfcbe('0x79')]=_0x501b25[_0xfcbe('0x79')]||![];this['monitor_format']=monitorFormat[_0x501b25['monitor_format']]?monitorFormat[_0x501b25['monitor_format']]:undefined;this['mandatoryDisposition']=_0x501b25[_0xfcbe('0x7a')]||![];this['mandatoryDispositionPause']=_0x501b25[_0xfcbe('0x7b')]?_0x501b25['mandatoryDispositionPause']:undefined;this[_0xfcbe('0x7c')]=![];}module[_0xfcbe('0x7d')]=VoiceQueue; \ No newline at end of file +var _0xa786=['answered','sumDuration','sumBillable','unmanaged','abandoned','busy','inUse','invalid','loggedIn','notInUse','paused','ringing','ringInUse','unavailable','unknown','acw','acwTimeout','autopause','sendMessageOneNotActive','statusMessage','originated','temp','dialTimezone','dialGlobalInterval','dialMethod','progressive','dialLimitQueue','dialPowerLevel','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundReCallsDay','startProgressive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav','wav49','gsm','leastrecent','ringall','roundrobin','rrmemory','rrordered','wrandom','name','monitor_format','type','inbound','waiting','total'];(function(_0x3b6abe,_0x543c02){var _0x122e98=function(_0x12bf9d){while(--_0x12bf9d){_0x3b6abe['push'](_0x3b6abe['shift']());}};_0x122e98(++_0x543c02);}(_0xa786,0x71));var _0x6a78=function(_0x472a38,_0x387db0){_0x472a38=_0x472a38-0x0;var _0x316440=_0xa786[_0x472a38];return _0x316440;};'use strict';var monitorFormat={'wav':_0x6a78('0x0'),'wav49':_0x6a78('0x1'),'gsm':_0x6a78('0x2')};var strategy={'fewestcalls':'fewestcalls','leastrecent':_0x6a78('0x3'),'linear':'linear','random':'random','ringall':_0x6a78('0x4'),'rr':_0x6a78('0x5'),'rrmemory':_0x6a78('0x6'),'rrordered':_0x6a78('0x7'),'wrandom':_0x6a78('0x8')};function VoiceQueue(_0x112e35){this['id']=_0x112e35['id']||0x0;this[_0x6a78('0x9')]=_0x112e35['name']||'';this[_0x6a78('0xa')]=_0x112e35[_0x6a78('0xa')]||'';this[_0x6a78('0xb')]=_0x112e35[_0x6a78('0xb')]||_0x6a78('0xc');this[_0x6a78('0xd')]=0x0;this[_0x6a78('0xe')]=0x0;this[_0x6a78('0xf')]=0x0;this[_0x6a78('0x10')]=0x0;this['sumHoldTime']=0x0;this[_0x6a78('0x11')]=0x0;this[_0x6a78('0x12')]=0x0;this[_0x6a78('0x13')]=0x0;this['available']=0x0;this[_0x6a78('0x14')]=0x0;this[_0x6a78('0x15')]=0x0;this[_0x6a78('0x16')]=0x0;this[_0x6a78('0x17')]=0x0;this[_0x6a78('0x18')]=0x0;this['onHold']=0x0;this[_0x6a78('0x19')]=0x0;this[_0x6a78('0x1a')]=0x0;this[_0x6a78('0x1b')]=0x0;this['talking']=0x0;this[_0x6a78('0x1c')]=0x0;this[_0x6a78('0x1d')]=0x0;this['acw']=_0x112e35[_0x6a78('0x1e')]||![];this[_0x6a78('0x1f')]=_0x112e35[_0x6a78('0x1f')]||0xa;this[_0x6a78('0x20')]=_0x112e35[_0x6a78('0x20')]||'no';this[_0x6a78('0x21')]=!![];this['message']='';this[_0x6a78('0x22')]='';this[_0x6a78('0x23')]=0x0;this[_0x6a78('0x24')]=0x0;this[_0x6a78('0x25')]=_0x112e35['dialTimezone']||null;this['dialGlobalInterval']=_0x112e35[_0x6a78('0x26')]?_0x112e35['dialGlobalInterval']:null;this['dialActive']=_0x112e35['dialActive'];this[_0x6a78('0x27')]=_0x112e35[_0x6a78('0x27')]||_0x6a78('0x28');this['dialLimitChannel']=_0x112e35['dialLimitChannel']||0x0;this[_0x6a78('0x29')]=_0x112e35[_0x6a78('0x29')]||0x0;this[_0x6a78('0x2a')]=_0x112e35[_0x6a78('0x2a')]||0x1;this['dialPredictiveOptimization']=_0x112e35['dialPredictiveOptimization']||'dropRate';this[_0x6a78('0x2b')]=_0x112e35['dialPredictiveOptimizationPercentage']||0.03;this[_0x6a78('0x2c')]=_0x112e35[_0x6a78('0x2c')]||0x258;this[_0x6a78('0x2d')]=_0x112e35['dialOriginateCallerIdName']||_0x6a78('0x2e');this[_0x6a78('0x2f')]=_0x112e35[_0x6a78('0x2f')]||_0x6a78('0x2e');this[_0x6a78('0x30')]=_0x112e35[_0x6a78('0x30')]||0x1e;this[_0x6a78('0x31')]=_0x112e35[_0x6a78('0x31')]||'tTxX';this[_0x6a78('0x32')]=_0x112e35[_0x6a78('0x32')]||0x3;this[_0x6a78('0x33')]=_0x112e35['dialQueueProject']||undefined;this[_0x6a78('0x34')]=_0x112e35['dialCongestionMaxRetry']||0x3;this[_0x6a78('0x35')]=_0x112e35[_0x6a78('0x35')]||0x96;this['dialBusyMaxRetry']=_0x112e35[_0x6a78('0x36')]||0x3;this[_0x6a78('0x37')]=_0x112e35[_0x6a78('0x37')]||0x96;this[_0x6a78('0x38')]=_0x112e35['dialNoAnswerMaxRetry']||0x3;this[_0x6a78('0x39')]=_0x112e35[_0x6a78('0x39')]||0x96;this[_0x6a78('0x3a')]=_0x112e35[_0x6a78('0x3a')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x112e35[_0x6a78('0x3b')]||0x96;this[_0x6a78('0x3c')]=_0x112e35[_0x6a78('0x3c')]||0x3;this['dialDropRetryFrequency']=_0x112e35[_0x6a78('0x3d')]||0x96;this[_0x6a78('0x3e')]=_0x112e35['dialAbandonedMaxRetry']||0x3;this[_0x6a78('0x3f')]=_0x112e35[_0x6a78('0x3f')]||0x96;this[_0x6a78('0x40')]=_0x112e35[_0x6a78('0x40')]||0x3;this[_0x6a78('0x41')]=_0x112e35['dialMachineRetryFrequency']||0x96;this[_0x6a78('0x42')]=_0x112e35[_0x6a78('0x42')]||0x3;this['dialAgentRejectRetryFrequency']=_0x112e35[_0x6a78('0x43')]||0x96;this[_0x6a78('0x44')]=_0x112e35[_0x6a78('0x44')]||0x3;this[_0x6a78('0x45')]=_0x112e35[_0x6a78('0x45')]||0x4;this[_0x6a78('0x46')]=_0x112e35['Trunk']?_0x112e35[_0x6a78('0x46')]:undefined;this['TrunkBackup']=_0x112e35[_0x6a78('0x47')]?_0x112e35[_0x6a78('0x47')]:undefined;this[_0x6a78('0x48')]=_0x112e35[_0x6a78('0x48')]||undefined;this[_0x6a78('0x49')]=_0x112e35[_0x6a78('0x49')]?_0x112e35[_0x6a78('0x49')]:undefined;this[_0x6a78('0x4a')]=_0x112e35[_0x6a78('0x4a')]||'DESC';this['dialRandomLastDigitCallerIdNumber']=_0x112e35[_0x6a78('0x4b')]||undefined;this['dialCutDigit']=_0x112e35[_0x6a78('0x4c')]||undefined;this[_0x6a78('0x4d')]=strategy[_0x112e35[_0x6a78('0x4d')]];this[_0x6a78('0x4e')]=!![];this[_0x6a78('0x4f')]=_0x112e35[_0x6a78('0x4f')]||![];this[_0x6a78('0x50')]=_0x112e35[_0x6a78('0x50')];this['dialAMDGreeting']=_0x112e35[_0x6a78('0x51')];this[_0x6a78('0x52')]=_0x112e35[_0x6a78('0x52')];this['dialAMDTotalAnalysisTime']=_0x112e35[_0x6a78('0x53')];this['dialAMDMinWordLength']=_0x112e35[_0x6a78('0x54')];this[_0x6a78('0x55')]=_0x112e35[_0x6a78('0x55')];this[_0x6a78('0x56')]=_0x112e35['dialAMDMaximumNumberOfWords'];this['dialAMDSilenceThreshold']=_0x112e35['dialAMDSilenceThreshold'];this[_0x6a78('0x57')]=_0x112e35[_0x6a78('0x57')];this['outboundRejectCallsDay']=0x0;this[_0x6a78('0x58')]=0x0;this[_0x6a78('0x59')]=_0x112e35[_0x6a78('0x59')];this[_0x6a78('0x5a')]=0x0;this[_0x6a78('0x5b')]=0x0;this[_0x6a78('0x5c')]=0x0;this['outboundBusyCallsDay']=0x0;this[_0x6a78('0x5d')]=0x0;this[_0x6a78('0x5e')]=0x0;this[_0x6a78('0x5f')]=0x0;this[_0x6a78('0x60')]=0x0;this[_0x6a78('0x61')]=0x0;this[_0x6a78('0x62')]=0x0;this[_0x6a78('0x63')]=0x0;this['outboundDropCallsDayACS']=0x0;this[_0x6a78('0x64')]=0x0;this['outboundAbandonedDay']=0x0;this[_0x6a78('0x65')]=undefined;this['startPredictive']=undefined;this['handlePredictive']=undefined;this[_0x6a78('0x66')]=1.05;this[_0x6a78('0x67')]=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this[_0x6a78('0x68')]=0x0;this[_0x6a78('0x69')]=0x0;this[_0x6a78('0x6a')]=0x0;this[_0x6a78('0x6b')]=0x0;this[_0x6a78('0x6c')]=0x0;this['predictiveIntervalAvailable']=0x0;this['predictiveIntervalMaxThreshold']=_0x112e35[_0x6a78('0x6d')]||0x14;this[_0x6a78('0x6e')]=_0x112e35[_0x6a78('0x6d')]||0xa;this[_0x6a78('0x6f')]=0x0;this[_0x6a78('0x70')]=0x0;this[_0x6a78('0x71')]=0x1;this[_0x6a78('0x72')]=0x0;this['erlangCallToSecond']=0x0;this[_0x6a78('0x73')]=0x0;this[_0x6a78('0x74')]=0x0;this['dialRecallMeTimeout']=_0x112e35[_0x6a78('0x75')]||0x1e;this[_0x6a78('0x76')]=_0x112e35[_0x6a78('0x76')]||![];this[_0x6a78('0x77')]=!!_0x112e35[_0x6a78('0x77')]||![];this[_0x6a78('0x78')]=!!_0x112e35['dialPreviewRecallmeReminder']||![];this[_0x6a78('0x79')]=_0x112e35[_0x6a78('0x79')]||undefined;this[_0x6a78('0x7a')]=_0x112e35[_0x6a78('0x7a')]||![];this[_0x6a78('0x7b')]=_0x112e35['dialAgiAfterHangupAgent']||![];this[_0x6a78('0xa')]=monitorFormat[_0x112e35['monitor_format']]?monitorFormat[_0x112e35[_0x6a78('0xa')]]:undefined;this[_0x6a78('0x7c')]=_0x112e35['mandatoryDisposition']||![];this[_0x6a78('0x7d')]=_0x112e35['mandatoryDispositionPause']?_0x112e35[_0x6a78('0x7d')]:undefined;this[_0x6a78('0x7e')]=![];}module[_0x6a78('0x7f')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueueSummary.js b/server/services/ami/model/voiceQueueSummary.js index 0b0d9f8..fde6b9b 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 _0xe5d5=['waiting','answered','inUse','loggedIn','originated','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','paused','talking','sumBillable','total','name','strategy','abandoned','available','busy','invalid','onHold','notInUse','ringInUse','sumDuration','sumHoldTime','type','unavailable','unknown','pTalking','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','active','callerid','prototype','loggedin','callers','length','SIP/','online','incall','includes','status','booked','queue','xcally-motion-preview','compareToOutboundQueue','updateReportFromOutboundQueue','exports','loggedInDb','ringing'];(function(_0x105919,_0x1a5358){var _0x4de64d=function(_0x246203){while(--_0x246203){_0x105919['push'](_0x105919['shift']());}};_0x4de64d(++_0x1a5358);}(_0xe5d5,0x156));var _0x5e5d=function(_0xa19dcc,_0x5cea62){_0xa19dcc=_0xa19dcc-0x0;var _0x48d0e2=_0xe5d5[_0xa19dcc];return _0x48d0e2;};'use strict';var INBOUND_COUNTERS=['available','loggedIn',_0x5e5d('0x0'),'paused',_0x5e5d('0x1'),'talking',_0x5e5d('0x2')];var OUTBOUND_COUNTERS=['available',_0x5e5d('0x3'),_0x5e5d('0x4'),_0x5e5d('0x5'),_0x5e5d('0x0'),_0x5e5d('0x6'),_0x5e5d('0x7'),_0x5e5d('0x8'),_0x5e5d('0x9'),_0x5e5d('0xa'),_0x5e5d('0xb'),_0x5e5d('0xc'),_0x5e5d('0xd'),_0x5e5d('0xe'),_0x5e5d('0xf'),'outboundUnknownCallsDay',_0x5e5d('0x10'),'pTalking',_0x5e5d('0x11'),_0x5e5d('0x12'),'sumDuration',_0x5e5d('0x13'),_0x5e5d('0x2')];function VoiceQueueSummary(_0x6b036a){this['id']=_0x6b036a['id'];this[_0x5e5d('0x14')]=_0x6b036a['name'];this['strategy']=_0x6b036a[_0x5e5d('0x15')];this[_0x5e5d('0x16')]=_0x6b036a['abandoned']||0x0;this[_0x5e5d('0x3')]=_0x6b036a[_0x5e5d('0x3')]||0x0;this['available']=_0x6b036a[_0x5e5d('0x17')]||0x0;this[_0x5e5d('0x18')]=_0x6b036a['busy']||0x0;this['inUse']=_0x6b036a['inUse']||0x0;this[_0x5e5d('0x19')]=_0x6b036a[_0x5e5d('0x19')]||0x0;this[_0x5e5d('0x5')]=_0x6b036a[_0x5e5d('0x5')]||0x0;this['loggedInDb']=_0x6b036a[_0x5e5d('0x0')]||0x0;this[_0x5e5d('0x1a')]=_0x6b036a[_0x5e5d('0x1a')]||0x0;this[_0x5e5d('0x1b')]=_0x6b036a[_0x5e5d('0x1b')]||0x0;this[_0x5e5d('0x10')]=_0x6b036a[_0x5e5d('0x10')]||0x0;this[_0x5e5d('0x1')]=_0x6b036a['ringing']||0x0;this[_0x5e5d('0x1c')]=_0x6b036a[_0x5e5d('0x1c')];this[_0x5e5d('0x12')]=_0x6b036a[_0x5e5d('0x12')];this[_0x5e5d('0x1d')]=_0x6b036a[_0x5e5d('0x1d')];this['sumHoldTime']=_0x6b036a[_0x5e5d('0x1e')]||0x0;this['talking']=_0x6b036a[_0x5e5d('0x11')]||0x0;this[_0x5e5d('0x13')]=_0x6b036a[_0x5e5d('0x13')]||0x0;this['type']=_0x6b036a[_0x5e5d('0x1f')];this['unavailable']=_0x6b036a[_0x5e5d('0x20')]||0x0;this[_0x5e5d('0x21')]=_0x6b036a[_0x5e5d('0x21')]||0x0;this['unmanaged']=_0x6b036a['unmanaged']||0x0;this[_0x5e5d('0x2')]=_0x6b036a[_0x5e5d('0x2')]||0x0;if(_0x6b036a['type']==='outbound'){this[_0x5e5d('0x22')]=_0x6b036a[_0x5e5d('0x22')]||0x0;this[_0x5e5d('0x23')]=_0x6b036a['dialActive'];this[_0x5e5d('0x24')]=_0x6b036a['dialMethod'];this[_0x5e5d('0x25')]=_0x6b036a['dialOriginateCallerIdName'];this[_0x5e5d('0x26')]=_0x6b036a[_0x5e5d('0x26')];this[_0x5e5d('0x27')]=_0x6b036a[_0x5e5d('0x27')];this[_0x5e5d('0x28')]=_0x6b036a[_0x5e5d('0x28')];this[_0x5e5d('0x29')]=_0x6b036a['temp'];this[_0x5e5d('0x2a')]=_0x6b036a[_0x5e5d('0x2a')];this[_0x5e5d('0x8')]=_0x6b036a[_0x5e5d('0x8')];this[_0x5e5d('0x9')]=_0x6b036a[_0x5e5d('0x9')];this[_0x5e5d('0xa')]=_0x6b036a[_0x5e5d('0xa')];this[_0x5e5d('0xb')]=_0x6b036a['outboundCongestionCallsDay'];this[_0x5e5d('0x2b')]=_0x6b036a['outboundDropCallsDayACS'];this['outboundDropCallsDayCallersExit']=_0x6b036a[_0x5e5d('0x2c')];this[_0x5e5d('0x2d')]=_0x6b036a[_0x5e5d('0x2d')];this[_0x5e5d('0xc')]=_0x6b036a[_0x5e5d('0xc')];this['outboundNoSuchCallsDay']=_0x6b036a[_0x5e5d('0xd')];this[_0x5e5d('0x2e')]=_0x6b036a[_0x5e5d('0x2e')];this[_0x5e5d('0xe')]=_0x6b036a[_0x5e5d('0xe')];this[_0x5e5d('0xf')]=_0x6b036a[_0x5e5d('0xf')];this['outboundUnknownCallsDay']=_0x6b036a[_0x5e5d('0x2f')];this[_0x5e5d('0x30')]=_0x6b036a['predictiveIntervalAnsweredCalls'];this['predictiveIntervalAvgHoldtime']=_0x6b036a[_0x5e5d('0x31')];this[_0x5e5d('0x32')]=_0x6b036a[_0x5e5d('0x32')];this[_0x5e5d('0x33')]=_0x6b036a[_0x5e5d('0x33')];this[_0x5e5d('0x34')]=_0x6b036a['predictiveIntervalDroppedCallsTimeout'];this[_0x5e5d('0x35')]=_0x6b036a['predictiveIntervalErlangCalls'];this[_0x5e5d('0x36')]=_0x6b036a[_0x5e5d('0x36')];this[_0x5e5d('0x37')]=_0x6b036a[_0x5e5d('0x37')];this[_0x5e5d('0x38')]=_0x6b036a['predictiveIntervalMultiplicativeFactor'];this[_0x5e5d('0x39')]=_0x6b036a[_0x5e5d('0x39')];this['predictiveIntervalAvailable']=_0x6b036a[_0x5e5d('0x3a')];this['predictiveIntervalTotalCalls']=_0x6b036a[_0x5e5d('0x3b')];this[_0x5e5d('0x6')]=_0x6b036a[_0x5e5d('0x6')];this[_0x5e5d('0x3c')]=_0x6b036a[_0x5e5d('0x3c')];this[_0x5e5d('0x3d')]=_0x6b036a[_0x5e5d('0x3d')];this[_0x5e5d('0x3e')]=_0x6b036a[_0x5e5d('0x3e')];this[_0x5e5d('0x3f')]=_0x6b036a[_0x5e5d('0x3f')];this[_0x5e5d('0x40')]=_0x6b036a['startPredictive'];this[_0x5e5d('0x41')]=_0x6b036a[_0x5e5d('0x41')];this[_0x5e5d('0x42')]=_0x6b036a[_0x5e5d('0x42')];this[_0x5e5d('0x43')]=_0x6b036a[_0x5e5d('0x43')];}if(_0x6b036a['Trunk']){this[_0x5e5d('0x44')]={'id':_0x6b036a[_0x5e5d('0x44')]['id'],'name':_0x6b036a['Trunk'][_0x5e5d('0x14')],'active':_0x6b036a[_0x5e5d('0x44')][_0x5e5d('0x45')],'callerid':_0x6b036a[_0x5e5d('0x44')][_0x5e5d('0x46')]};}}VoiceQueueSummary[_0x5e5d('0x47')]['createReport']=function(_0x502aac,_0x1032bc,_0x58fe19,_0x3c0ad6){this['loggedInDb']=0x0;this['talking']=0x0;this[_0x5e5d('0x10')]=0x0;this['unknown']=0x0;this['notInUse']=0x0;this[_0x5e5d('0x4')]=0x0;this[_0x5e5d('0x18')]=0x0;this[_0x5e5d('0x19')]=0x0;this[_0x5e5d('0x20')]=0x0;this[_0x5e5d('0x1')]=0x0;this[_0x5e5d('0x1c')]=0x0;this['onHold']=0x0;if(_0x58fe19){if(_0x58fe19['available']){this['available']=Number(_0x58fe19[_0x5e5d('0x17')]);}if(_0x58fe19['loggedin']){this[_0x5e5d('0x5')]=Number(_0x58fe19[_0x5e5d('0x48')]);}if(_0x58fe19['callers']){this[_0x5e5d('0x2')]=Number(_0x58fe19[_0x5e5d('0x49')]);}}for(var _0x5469c0=0x0;_0x5469c0<_0x502aac[_0x5e5d('0x4a')];_0x5469c0++){var _0x729878=_0x1032bc[_0x5e5d('0x4b')+_0x502aac[_0x5469c0][_0x5e5d('0x14')]];if(_0x729878&&_0x729878[_0x5e5d('0x4c')]){this['loggedInDb']+=0x1;}if(_0x502aac[_0x5469c0][_0x5e5d('0x4d')]==='1'){this[_0x5e5d('0x11')]+=0x1;}if(_0x502aac[_0x5469c0][_0x5e5d('0x10')]==='1'&&!['2','7','8'][_0x5e5d('0x4e')](_0x502aac[_0x5469c0][_0x5e5d('0x4f')])){this[_0x5e5d('0x10')]+=0x1;}switch(_0x502aac[_0x5469c0][_0x5e5d('0x4f')]){case'0':this[_0x5e5d('0x21')]+=0x1;break;case'1':this['notInUse']+=0x1;break;case'2':this[_0x5e5d('0x4')]+=0x1;break;case'3':this[_0x5e5d('0x18')]+=0x1;break;case'4':this[_0x5e5d('0x19')]+=0x1;break;case'5':this['unavailable']+=0x1;break;case'6':this[_0x5e5d('0x1')]+=0x1;break;case'7':this[_0x5e5d('0x1c')]+=0x1;break;case'8':this['onHold']+=0x1;break;}}if(this[_0x5e5d('0x24')]===_0x5e5d('0x50')){var _0x2ca071=Object['keys'](_0x3c0ad6);for(var _0x3df625=0x0;_0x3df625<_0x2ca071[_0x5e5d('0x4a')];_0x3df625++){var _0x3d971b=_0x2ca071[_0x3df625];var _0xff3d66=_0x3c0ad6[_0x3d971b];if(_0xff3d66[_0x5e5d('0x51')]===this['name']&&_0xff3d66[_0x5e5d('0x1f')]==='dialer'&&_0xff3d66['exten']===_0x5e5d('0x52')){this['talking']+=0x1;}}if(this[_0x5e5d('0x11')]>this[_0x5e5d('0x4')]){this['talking']=this[_0x5e5d('0x4')];}this[_0x5e5d('0x22')]=0x0;}return this;};VoiceQueueSummary['prototype']['compareToInboundQueue']=function(_0x2923ab){var _0x1be209=![];if(_0x2923ab){_0x1be209=INBOUND_COUNTERS['some'](function(_0x25065c){return this[_0x25065c]!==_0x2923ab[_0x25065c];},this);}return _0x1be209;};VoiceQueueSummary[_0x5e5d('0x47')][_0x5e5d('0x53')]=function(_0x5f4793){var _0x29472f=![];var _0x1eebd8=![];var _0x144492=![];if(_0x5f4793){_0x29472f=this['dialMethod']!==_0x5f4793[_0x5e5d('0x24')]||this[_0x5e5d('0x23')]!==_0x5f4793[_0x5e5d('0x23')]||this['message']!==_0x5f4793['message']||this['statusMessage']!==_0x5f4793[_0x5e5d('0x43')];_0x1eebd8=OUTBOUND_COUNTERS['some'](function(_0x343e13){return this[_0x343e13]!==_0x5f4793[_0x343e13];},this);if(this['Trunk']&&_0x5f4793[_0x5e5d('0x44')]){_0x144492=this['Trunk'][_0x5e5d('0x14')]!==_0x5f4793[_0x5e5d('0x44')]['name']||this[_0x5e5d('0x44')]['active']!==_0x5f4793['Trunk']['active'];}}return _0x29472f||_0x1eebd8||_0x144492;};VoiceQueueSummary[_0x5e5d('0x47')][_0x5e5d('0x54')]=function(_0x5d6e70){this[_0x5e5d('0x3')]=_0x5d6e70[_0x5e5d('0x3')];this[_0x5e5d('0x42')]=_0x5d6e70[_0x5e5d('0x42')];this[_0x5e5d('0x43')]=_0x5d6e70[_0x5e5d('0x43')];this['originated']=_0x5d6e70[_0x5e5d('0x6')];this[_0x5e5d('0x7')]=_0x5d6e70['outboundAbandonedCallsDay'];this['outboundAnswerCallsDay']=_0x5d6e70[_0x5e5d('0x8')];this[_0x5e5d('0x9')]=_0x5d6e70[_0x5e5d('0x9')];this[_0x5e5d('0xa')]=_0x5d6e70[_0x5e5d('0xa')];this['outboundCongestionCallsDay']=_0x5d6e70[_0x5e5d('0xb')];this['outboundNoAnswerCallsDay']=_0x5d6e70[_0x5e5d('0xc')];this[_0x5e5d('0xd')]=_0x5d6e70[_0x5e5d('0xd')];this[_0x5e5d('0xe')]=_0x5d6e70[_0x5e5d('0xe')];this[_0x5e5d('0xf')]=_0x5d6e70['outboundRejectCallsDay'];this[_0x5e5d('0x2f')]=_0x5d6e70['outboundUnknownCallsDay'];this['sumBillable']=_0x5d6e70[_0x5e5d('0x12')];this[_0x5e5d('0x1d')]=_0x5d6e70[_0x5e5d('0x1d')];this[_0x5e5d('0x13')]=_0x5d6e70[_0x5e5d('0x13')];if(this[_0x5e5d('0x24')]==='preview'){this[_0x5e5d('0x22')]=_0x5d6e70[_0x5e5d('0x22')];}};module[_0x5e5d('0x55')]=VoiceQueueSummary; \ No newline at end of file +var _0x3fc6=['exports','available','loggedIn','loggedInDb','ringing','talking','waiting','answered','inUse','originated','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','paused','pTalking','sumBillable','sumDuration','total','name','abandoned','busy','invalid','onHold','notInUse','ringInUse','sumHoldTime','type','unavailable','unknown','unmanaged','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialPrefix','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startProgressive','message','statusMessage','Trunk','active','callerid','createReport','loggedin','callers','length','SIP/','incall','includes','booked','keys','queue','dialer','exten','prototype','compareToInboundQueue','some','compareToOutboundQueue','updateReportFromOutboundQueue'];(function(_0x29fbb7,_0x9a8ad){var _0x3153fe=function(_0x4fab0c){while(--_0x4fab0c){_0x29fbb7['push'](_0x29fbb7['shift']());}};_0x3153fe(++_0x9a8ad);}(_0x3fc6,0x159));var _0x63fc=function(_0x4e383d,_0x5c3e02){_0x4e383d=_0x4e383d-0x0;var _0x55bad4=_0x3fc6[_0x4e383d];return _0x55bad4;};'use strict';var INBOUND_COUNTERS=[_0x63fc('0x0'),_0x63fc('0x1'),_0x63fc('0x2'),'paused',_0x63fc('0x3'),_0x63fc('0x4'),_0x63fc('0x5')];var OUTBOUND_COUNTERS=[_0x63fc('0x0'),_0x63fc('0x6'),_0x63fc('0x7'),'loggedIn','loggedInDb',_0x63fc('0x8'),_0x63fc('0x9'),_0x63fc('0xa'),'outboundBlacklistCallsDay',_0x63fc('0xb'),_0x63fc('0xc'),'outboundNoAnswerCallsDay',_0x63fc('0xd'),_0x63fc('0xe'),_0x63fc('0xf'),_0x63fc('0x10'),_0x63fc('0x11'),_0x63fc('0x12'),_0x63fc('0x4'),_0x63fc('0x13'),_0x63fc('0x14'),_0x63fc('0x15'),'waiting'];function VoiceQueueSummary(_0x45d080){this['id']=_0x45d080['id'];this[_0x63fc('0x16')]=_0x45d080[_0x63fc('0x16')];this['strategy']=_0x45d080['strategy'];this[_0x63fc('0x17')]=_0x45d080[_0x63fc('0x17')]||0x0;this[_0x63fc('0x6')]=_0x45d080[_0x63fc('0x6')]||0x0;this[_0x63fc('0x0')]=_0x45d080[_0x63fc('0x0')]||0x0;this['busy']=_0x45d080[_0x63fc('0x18')]||0x0;this[_0x63fc('0x7')]=_0x45d080[_0x63fc('0x7')]||0x0;this[_0x63fc('0x19')]=_0x45d080['invalid']||0x0;this[_0x63fc('0x1')]=_0x45d080['loggedIn']||0x0;this[_0x63fc('0x2')]=_0x45d080[_0x63fc('0x2')]||0x0;this[_0x63fc('0x1a')]=_0x45d080[_0x63fc('0x1a')]||0x0;this[_0x63fc('0x1b')]=_0x45d080['notInUse']||0x0;this[_0x63fc('0x11')]=_0x45d080[_0x63fc('0x11')]||0x0;this[_0x63fc('0x3')]=_0x45d080['ringing']||0x0;this['ringInUse']=_0x45d080[_0x63fc('0x1c')];this[_0x63fc('0x13')]=_0x45d080['sumBillable'];this[_0x63fc('0x14')]=_0x45d080['sumDuration'];this[_0x63fc('0x1d')]=_0x45d080[_0x63fc('0x1d')]||0x0;this[_0x63fc('0x4')]=_0x45d080[_0x63fc('0x4')]||0x0;this[_0x63fc('0x15')]=_0x45d080[_0x63fc('0x15')]||0x0;this[_0x63fc('0x1e')]=_0x45d080['type'];this[_0x63fc('0x1f')]=_0x45d080[_0x63fc('0x1f')]||0x0;this[_0x63fc('0x20')]=_0x45d080[_0x63fc('0x20')]||0x0;this[_0x63fc('0x21')]=_0x45d080['unmanaged']||0x0;this['waiting']=_0x45d080[_0x63fc('0x5')]||0x0;if(_0x45d080[_0x63fc('0x1e')]===_0x63fc('0x22')){this[_0x63fc('0x12')]=_0x45d080['pTalking']||0x0;this[_0x63fc('0x23')]=_0x45d080[_0x63fc('0x23')];this[_0x63fc('0x24')]=_0x45d080[_0x63fc('0x24')];this[_0x63fc('0x25')]=_0x45d080[_0x63fc('0x25')];this[_0x63fc('0x26')]=_0x45d080[_0x63fc('0x26')];this['dialOriginateTimeout']=_0x45d080['dialOriginateTimeout'];this[_0x63fc('0x27')]=_0x45d080[_0x63fc('0x27')];this['temp']=_0x45d080['temp'];this['outboundAnswerAgiCallsDay']=_0x45d080[_0x63fc('0x28')];this[_0x63fc('0xa')]=_0x45d080[_0x63fc('0xa')];this[_0x63fc('0x29')]=_0x45d080[_0x63fc('0x29')];this[_0x63fc('0xb')]=_0x45d080[_0x63fc('0xb')];this['outboundCongestionCallsDay']=_0x45d080[_0x63fc('0xc')];this[_0x63fc('0x2a')]=_0x45d080['outboundDropCallsDayACS'];this[_0x63fc('0x2b')]=_0x45d080[_0x63fc('0x2b')];this[_0x63fc('0x2c')]=_0x45d080['outboundDropCallsDayTimeout'];this[_0x63fc('0x2d')]=_0x45d080['outboundNoAnswerCallsDay'];this[_0x63fc('0xd')]=_0x45d080[_0x63fc('0xd')];this[_0x63fc('0x2e')]=_0x45d080['outboundOriginateFailureCallsDay'];this[_0x63fc('0xe')]=_0x45d080[_0x63fc('0xe')];this[_0x63fc('0xf')]=_0x45d080['outboundRejectCallsDay'];this[_0x63fc('0x10')]=_0x45d080['outboundUnknownCallsDay'];this[_0x63fc('0x2f')]=_0x45d080[_0x63fc('0x2f')];this[_0x63fc('0x30')]=_0x45d080['predictiveIntervalAvgHoldtime'];this[_0x63fc('0x31')]=_0x45d080[_0x63fc('0x31')];this[_0x63fc('0x32')]=_0x45d080['predictiveIntervalDroppedCallsCallersExit'];this[_0x63fc('0x33')]=_0x45d080['predictiveIntervalDroppedCallsTimeout'];this[_0x63fc('0x34')]=_0x45d080[_0x63fc('0x34')];this['predictiveIntervalErlangCallsDroppedCalls']=_0x45d080[_0x63fc('0x35')];this[_0x63fc('0x36')]=_0x45d080['predictiveIntervalHitRate'];this[_0x63fc('0x37')]=_0x45d080['predictiveIntervalMultiplicativeFactor'];this['predictiveIntervalPauses']=_0x45d080['predictiveIntervalPauses'];this['predictiveIntervalAvailable']=_0x45d080[_0x63fc('0x38')];this[_0x63fc('0x39')]=_0x45d080[_0x63fc('0x39')];this['originated']=_0x45d080[_0x63fc('0x8')];this[_0x63fc('0x3a')]=_0x45d080['erlangCalls'];this['erlangCallToSecond']=_0x45d080[_0x63fc('0x3b')];this[_0x63fc('0x3c')]=_0x45d080['erlangAbandonmentRate'];this[_0x63fc('0x3d')]=_0x45d080[_0x63fc('0x3d')];this['startPredictive']=_0x45d080['startPredictive'];this[_0x63fc('0x3e')]=_0x45d080[_0x63fc('0x3e')];this[_0x63fc('0x3f')]=_0x45d080[_0x63fc('0x3f')];this[_0x63fc('0x40')]=_0x45d080[_0x63fc('0x40')];}if(_0x45d080[_0x63fc('0x41')]){this[_0x63fc('0x41')]={'id':_0x45d080[_0x63fc('0x41')]['id'],'name':_0x45d080[_0x63fc('0x41')]['name'],'active':_0x45d080[_0x63fc('0x41')][_0x63fc('0x42')],'callerid':_0x45d080[_0x63fc('0x41')][_0x63fc('0x43')]};}}VoiceQueueSummary['prototype'][_0x63fc('0x44')]=function(_0x1a3f04,_0x282f7a,_0x3e6936,_0x2f2933){this[_0x63fc('0x2')]=0x0;this['talking']=0x0;this[_0x63fc('0x11')]=0x0;this[_0x63fc('0x20')]=0x0;this[_0x63fc('0x1b')]=0x0;this[_0x63fc('0x7')]=0x0;this[_0x63fc('0x18')]=0x0;this['invalid']=0x0;this[_0x63fc('0x1f')]=0x0;this[_0x63fc('0x3')]=0x0;this[_0x63fc('0x1c')]=0x0;this[_0x63fc('0x1a')]=0x0;if(_0x3e6936){if(_0x3e6936[_0x63fc('0x0')]){this[_0x63fc('0x0')]=Number(_0x3e6936[_0x63fc('0x0')]);}if(_0x3e6936[_0x63fc('0x45')]){this[_0x63fc('0x1')]=Number(_0x3e6936[_0x63fc('0x45')]);}if(_0x3e6936[_0x63fc('0x46')]){this['waiting']=Number(_0x3e6936[_0x63fc('0x46')]);}}for(var _0x5db4d2=0x0;_0x5db4d2<_0x1a3f04[_0x63fc('0x47')];_0x5db4d2++){var _0x59a993=_0x282f7a[_0x63fc('0x48')+_0x1a3f04[_0x5db4d2]['name']];if(_0x59a993&&_0x59a993['online']){this['loggedInDb']+=0x1;}if(_0x1a3f04[_0x5db4d2][_0x63fc('0x49')]==='1'){this['talking']+=0x1;}if(_0x1a3f04[_0x5db4d2]['paused']==='1'&&!['2','7','8'][_0x63fc('0x4a')](_0x1a3f04[_0x5db4d2]['status'])){this['paused']+=0x1;}switch(_0x1a3f04[_0x5db4d2]['status']){case'0':this[_0x63fc('0x20')]+=0x1;break;case'1':this[_0x63fc('0x1b')]+=0x1;break;case'2':this['inUse']+=0x1;break;case'3':this[_0x63fc('0x18')]+=0x1;break;case'4':this['invalid']+=0x1;break;case'5':this[_0x63fc('0x1f')]+=0x1;break;case'6':this['ringing']+=0x1;break;case'7':this[_0x63fc('0x1c')]+=0x1;break;case'8':this[_0x63fc('0x1a')]+=0x1;break;}}if(this[_0x63fc('0x24')]===_0x63fc('0x4b')){var _0x350257=Object[_0x63fc('0x4c')](_0x2f2933);for(var _0x5574e9=0x0;_0x5574e9<_0x350257[_0x63fc('0x47')];_0x5574e9++){var _0x1944d6=_0x350257[_0x5574e9];var _0x245a0c=_0x2f2933[_0x1944d6];if(_0x245a0c[_0x63fc('0x4d')]===this['name']&&_0x245a0c[_0x63fc('0x1e')]===_0x63fc('0x4e')&&_0x245a0c[_0x63fc('0x4f')]==='xcally-motion-preview'){this[_0x63fc('0x4')]+=0x1;}}if(this[_0x63fc('0x4')]>this[_0x63fc('0x7')]){this[_0x63fc('0x4')]=this[_0x63fc('0x7')];}this[_0x63fc('0x12')]=0x0;}return this;};VoiceQueueSummary[_0x63fc('0x50')][_0x63fc('0x51')]=function(_0x8e86a2){var _0x28ee76=![];if(_0x8e86a2){_0x28ee76=INBOUND_COUNTERS[_0x63fc('0x52')](function(_0x2a7a59){return this[_0x2a7a59]!==_0x8e86a2[_0x2a7a59];},this);}return _0x28ee76;};VoiceQueueSummary[_0x63fc('0x50')][_0x63fc('0x53')]=function(_0x56d123){var _0x439167=![];var _0x13f902=![];var _0x35559b=![];if(_0x56d123){_0x439167=this['dialMethod']!==_0x56d123[_0x63fc('0x24')]||this[_0x63fc('0x23')]!==_0x56d123[_0x63fc('0x23')]||this[_0x63fc('0x3f')]!==_0x56d123[_0x63fc('0x3f')]||this[_0x63fc('0x40')]!==_0x56d123[_0x63fc('0x40')];_0x13f902=OUTBOUND_COUNTERS[_0x63fc('0x52')](function(_0x6ca2e8){return this[_0x6ca2e8]!==_0x56d123[_0x6ca2e8];},this);if(this[_0x63fc('0x41')]&&_0x56d123['Trunk']){_0x35559b=this[_0x63fc('0x41')][_0x63fc('0x16')]!==_0x56d123[_0x63fc('0x41')][_0x63fc('0x16')]||this[_0x63fc('0x41')][_0x63fc('0x42')]!==_0x56d123[_0x63fc('0x41')][_0x63fc('0x42')];}}return _0x439167||_0x13f902||_0x35559b;};VoiceQueueSummary[_0x63fc('0x50')][_0x63fc('0x54')]=function(_0x1a6fe8){this[_0x63fc('0x6')]=_0x1a6fe8[_0x63fc('0x6')];this[_0x63fc('0x3f')]=_0x1a6fe8[_0x63fc('0x3f')];this[_0x63fc('0x40')]=_0x1a6fe8['statusMessage'];this[_0x63fc('0x8')]=_0x1a6fe8[_0x63fc('0x8')];this['outboundAbandonedCallsDay']=_0x1a6fe8['outboundAbandonedCallsDay'];this['outboundAnswerCallsDay']=_0x1a6fe8['outboundAnswerCallsDay'];this[_0x63fc('0x29')]=_0x1a6fe8['outboundBlacklistCallsDay'];this[_0x63fc('0xb')]=_0x1a6fe8[_0x63fc('0xb')];this[_0x63fc('0xc')]=_0x1a6fe8['outboundCongestionCallsDay'];this[_0x63fc('0x2d')]=_0x1a6fe8[_0x63fc('0x2d')];this[_0x63fc('0xd')]=_0x1a6fe8[_0x63fc('0xd')];this[_0x63fc('0xe')]=_0x1a6fe8[_0x63fc('0xe')];this['outboundRejectCallsDay']=_0x1a6fe8['outboundRejectCallsDay'];this[_0x63fc('0x10')]=_0x1a6fe8[_0x63fc('0x10')];this[_0x63fc('0x13')]=_0x1a6fe8[_0x63fc('0x13')];this[_0x63fc('0x14')]=_0x1a6fe8['sumDuration'];this['total']=_0x1a6fe8['total'];if(this['dialMethod']==='preview'){this['pTalking']=_0x1a6fe8['pTalking'];}};module[_0x63fc('0x55')]=VoiceQueueSummary; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 911ddc3..85a3cd3 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 _0x93e9=['exports','name','username','accessKey','remoteUri','serverUrl','Configurations'];(function(_0x44454f,_0x4bfbe8){var _0x475150=function(_0x1cde13){while(--_0x1cde13){_0x44454f['push'](_0x44454f['shift']());}};_0x475150(++_0x4bfbe8);}(_0x93e9,0xda));var _0x993e=function(_0x472d7c,_0x2e897f){_0x472d7c=_0x472d7c-0x0;var _0x3351bc=_0x93e9[_0x472d7c];return _0x3351bc;};'use strict';function VtigerAccount(_0x37d0a8){this['id']=_0x37d0a8['id']||0x0;this[_0x993e('0x0')]=_0x37d0a8[_0x993e('0x0')]||'';this['username']=_0x37d0a8[_0x993e('0x1')]||'';this[_0x993e('0x2')]=_0x37d0a8[_0x993e('0x2')]||'';this[_0x993e('0x3')]=_0x37d0a8[_0x993e('0x3')]||'';this[_0x993e('0x4')]=_0x37d0a8['serverUrl']||'';this[_0x993e('0x5')]=_0x37d0a8[_0x993e('0x5')]||{};}module[_0x993e('0x6')]=VtigerAccount; \ No newline at end of file +var _0x03f4=['accessKey','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x347a4a,_0x2b263d){var _0x35e2a8=function(_0x269b1c){while(--_0x269b1c){_0x347a4a['push'](_0x347a4a['shift']());}};_0x35e2a8(++_0x2b263d);}(_0x03f4,0xc9));var _0x403f=function(_0x506fd2,_0x27b863){_0x506fd2=_0x506fd2-0x0;var _0x3e0349=_0x03f4[_0x506fd2];return _0x3e0349;};'use strict';function VtigerAccount(_0x335bf8){this['id']=_0x335bf8['id']||0x0;this[_0x403f('0x0')]=_0x335bf8[_0x403f('0x0')]||'';this['username']=_0x335bf8[_0x403f('0x1')]||'';this[_0x403f('0x2')]=_0x335bf8['accessKey']||'';this[_0x403f('0x3')]=_0x335bf8['remoteUri']||'';this['serverUrl']=_0x335bf8[_0x403f('0x4')]||'';this['Configurations']=_0x335bf8[_0x403f('0x5')]||{};}module[_0x403f('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 6c25160..c7d48d2 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 _0x0aac=['Configurations','exports','name','username','password','token','remoteUri','authType','type','integrationTab','serverUrl'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x0aac,0x18e));var _0xc0aa=function(_0x441a91,_0x1a55e3){_0x441a91=_0x441a91-0x0;var _0x1c3bff=_0x0aac[_0x441a91];return _0x1c3bff;};'use strict';function ZendeskAccount(_0x52e533){this['id']=_0x52e533['id']||0x0;this[_0xc0aa('0x0')]=_0x52e533['name']||'';this[_0xc0aa('0x1')]=_0x52e533['username']||'';this[_0xc0aa('0x2')]=_0x52e533[_0xc0aa('0x2')]||'';this[_0xc0aa('0x3')]=_0x52e533[_0xc0aa('0x3')]||'';this[_0xc0aa('0x4')]=_0x52e533['remoteUri']||'';this[_0xc0aa('0x5')]=_0x52e533['authType']||'';this[_0xc0aa('0x6')]=_0x52e533[_0xc0aa('0x6')]||_0xc0aa('0x7');this[_0xc0aa('0x8')]=_0x52e533[_0xc0aa('0x8')]||'';this[_0xc0aa('0x9')]=_0x52e533['Configurations']||{};}module[_0xc0aa('0xa')]=ZendeskAccount; \ No newline at end of file +var _0x9002=['serverUrl','exports','name','password','token','remoteUri','authType','type','integrationTab'];(function(_0x2a58aa,_0x87cb84){var _0x488e54=function(_0x4f907f){while(--_0x4f907f){_0x2a58aa['push'](_0x2a58aa['shift']());}};_0x488e54(++_0x87cb84);}(_0x9002,0xf5));var _0x2900=function(_0x1ade7a,_0x3085be){_0x1ade7a=_0x1ade7a-0x0;var _0x59c625=_0x9002[_0x1ade7a];return _0x59c625;};'use strict';function ZendeskAccount(_0x479f85){this['id']=_0x479f85['id']||0x0;this['name']=_0x479f85[_0x2900('0x0')]||'';this['username']=_0x479f85['username']||'';this[_0x2900('0x1')]=_0x479f85['password']||'';this[_0x2900('0x2')]=_0x479f85[_0x2900('0x2')]||'';this[_0x2900('0x3')]=_0x479f85[_0x2900('0x3')]||'';this[_0x2900('0x4')]=_0x479f85[_0x2900('0x4')]||'';this[_0x2900('0x5')]=_0x479f85[_0x2900('0x5')]||_0x2900('0x6');this[_0x2900('0x7')]=_0x479f85[_0x2900('0x7')]||'';this['Configurations']=_0x479f85['Configurations']||{};}module[_0x2900('0x8')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index 43845b1..a4f5b00 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 _0x4066=['serverUrl','code','Configurations','exports','description','host','zone','clientId','clientSecret'];(function(_0x6ed19a,_0x28bd72){var _0x5d6e51=function(_0x297c7b){while(--_0x297c7b){_0x6ed19a['push'](_0x6ed19a['shift']());}};_0x5d6e51(++_0x28bd72);}(_0x4066,0x1e1));var _0x6406=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x4066[_0xa464c9];return _0x3d73c4;};'use strict';function ZohoAccount(_0x2fde48){this['id']=_0x2fde48['id']||0x0;this['name']=_0x2fde48['name']||'';this[_0x6406('0x0')]=_0x2fde48[_0x6406('0x0')]||'';this[_0x6406('0x1')]=_0x2fde48[_0x6406('0x1')]||'';this[_0x6406('0x2')]=_0x2fde48[_0x6406('0x2')]||'';this[_0x6406('0x3')]=_0x2fde48[_0x6406('0x3')]||'';this[_0x6406('0x4')]=_0x2fde48[_0x6406('0x4')]||'';this['serverUrl']=_0x2fde48[_0x6406('0x5')]||'';this[_0x6406('0x6')]=_0x2fde48[_0x6406('0x6')]||'';this['refreshToken']=_0x2fde48['refreshToken']||'';this[_0x6406('0x7')]=_0x2fde48['Configurations']||{};}module[_0x6406('0x8')]=ZohoAccount; \ No newline at end of file +var _0x3a51=['host','clientId','clientSecret','serverUrl','code','refreshToken','Configurations','exports','name','description'];(function(_0x114c1c,_0x5bfd6d){var _0x50a0a6=function(_0x4f97f0){while(--_0x4f97f0){_0x114c1c['push'](_0x114c1c['shift']());}};_0x50a0a6(++_0x5bfd6d);}(_0x3a51,0x17a));var _0x13a5=function(_0x40ce6e,_0x506035){_0x40ce6e=_0x40ce6e-0x0;var _0x5e6c0e=_0x3a51[_0x40ce6e];return _0x5e6c0e;};'use strict';function ZohoAccount(_0x104b88){this['id']=_0x104b88['id']||0x0;this[_0x13a5('0x0')]=_0x104b88[_0x13a5('0x0')]||'';this[_0x13a5('0x1')]=_0x104b88[_0x13a5('0x1')]||'';this['host']=_0x104b88[_0x13a5('0x2')]||'';this['zone']=_0x104b88['zone']||'';this[_0x13a5('0x3')]=_0x104b88[_0x13a5('0x3')]||'';this[_0x13a5('0x4')]=_0x104b88[_0x13a5('0x4')]||'';this[_0x13a5('0x5')]=_0x104b88[_0x13a5('0x5')]||'';this[_0x13a5('0x6')]=_0x104b88[_0x13a5('0x6')]||'';this[_0x13a5('0x7')]=_0x104b88['refreshToken']||'';this['Configurations']=_0x104b88[_0x13a5('0x8')]||{};}module[_0x13a5('0x9')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index 20f77a2..e65e5f3 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 _0xd943=['countglobal','countnosuchnumberretry','countabandonedretry','countagentrejectretry','countdropretry','countmachineretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','exports','util','lodash','moment','isNil','string','uniqueid','idContact','type','campaigntype','dialAnswer','Agent','name','channelAgent','membername','format','SIP/%s','calleridname','Contact','phone','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry'];(function(_0x286726,_0x20a337){var _0xcd4fe9=function(_0x4d7da6){while(--_0x4d7da6){_0x286726['push'](_0x286726['shift']());}};_0xcd4fe9(++_0x20a337);}(_0xd943,0x15d));var _0x3d94=function(_0x1485d7,_0x3a830e){_0x1485d7=_0x1485d7-0x0;var _0xa4bac1=_0xd943[_0x1485d7];return _0xa4bac1;};'use strict';var util=require(_0x3d94('0x0'));var _=require(_0x3d94('0x1'));var moment=require(_0x3d94('0x2'));function checkNameSurname(_0x440dd8,_0x5495df,_0x691e28){var _0x3edd1b='';if(!_[_0x3d94('0x3')](_0x5495df)&&_0x3d94('0x4')===typeof _0x5495df){_0x3edd1b+=_0x5495df;}if(!_[_0x3d94('0x3')](_0x691e28)&&'string'===typeof _0x691e28){_0x3edd1b+='\x20'+_0x691e28;}if(_0x3edd1b!==''){return _0x3edd1b;}return _0x440dd8;}function Action(_0x54e692,_0x34c9c3,_0x51cf1f,_0x54e81f,_0x4d29e7){this[_0x3d94('0x5')]=_0x51cf1f||undefined;this[_0x3d94('0x6')]=_0x54e692['id'];this['queue']=_0x34c9c3['name'];this[_0x3d94('0x7')]=_0x34c9c3[_0x3d94('0x7')];this[_0x3d94('0x8')]='queue';this[_0x3d94('0x9')]=![];this['membername']=_[_0x3d94('0x3')](_0x54e692[_0x3d94('0xa')])?undefined:_0x54e692['Agent'][_0x3d94('0xb')];this[_0x3d94('0xc')]=this[_0x3d94('0xd')]?util[_0x3d94('0xe')](_0x3d94('0xf'),this['membername']):_0x54e81f||undefined;this[_0x3d94('0x10')]=checkNameSurname(_0x54e692[_0x3d94('0x11')][_0x3d94('0x12')],_0x54e692['Contact'][_0x3d94('0x13')],_0x54e692[_0x3d94('0x11')][_0x3d94('0x14')]);this['active']=_0x54e692[_0x3d94('0x15')]||![];this[_0x3d94('0x16')]=_0x54e692[_0x3d94('0x12')];this[_0x3d94('0x17')]=_0x54e692[_0x3d94('0x17')];this[_0x3d94('0x18')]=_0x54e692[_0x3d94('0x18')]||0x0;this[_0x3d94('0x19')]=_0x54e692['countcongestionretry']||0x0;this[_0x3d94('0x1a')]=_0x54e692[_0x3d94('0x1a')]||0x0;this[_0x3d94('0x1b')]=(_0x54e692[_0x3d94('0x18')]||0x0)+(_0x54e692[_0x3d94('0x19')]||0x0)+(_0x54e692[_0x3d94('0x1a')]||0x0)+(_0x54e692[_0x3d94('0x1c')]||0x0)+(_0x54e692['countdropretry']||0x0)+(_0x54e692[_0x3d94('0x1d')]||0x0)+(_0x54e692['countmachineretry']||0x0)+(_0x54e692[_0x3d94('0x1e')]||0x0);this[_0x3d94('0x1c')]=_0x54e692[_0x3d94('0x1c')]||0x0;this[_0x3d94('0x1f')]=_0x54e692[_0x3d94('0x1f')]||0x0;this['countabandonedretry']=_0x54e692['countabandonedretry']||0x0;this[_0x3d94('0x20')]=_0x54e692[_0x3d94('0x20')]||0x0;this[_0x3d94('0x1e')]=_0x54e692['countagentrejectretry']||0x0;this[_0x3d94('0x21')]=_0x54e692[_0x3d94('0x21')];this[_0x3d94('0x22')]=_0x54e692[_0x3d94('0x22')];this[_0x3d94('0x23')]=_0x54e692[_0x3d94('0x23')];this[_0x3d94('0x24')]=_0x54e692[_0x3d94('0x24')];this[_0x3d94('0x25')]=_0x54e692[_0x3d94('0x25')];this[_0x3d94('0x26')]=_0x54e692[_0x3d94('0x26')];this[_0x3d94('0x27')]=_[_0x3d94('0x3')](_0x54e692[_0x3d94('0xa')])?_0x54e692['UserId']:_0x54e692[_0x3d94('0xa')]['id'];this['VoiceQueueId']=_0x54e692[_0x3d94('0x28')];this[_0x3d94('0x29')]='';this[_0x3d94('0x2a')]='';}Action[_0x3d94('0x2b')][_0x3d94('0x2c')]=function(){return util[_0x3d94('0xe')](_0x3d94('0x2d'),this['calleridname'],this['number']);};module[_0x3d94('0x2e')]=Action; \ No newline at end of file +var _0x1967=['type','campaigntype','queue','Agent','channelAgent','membername','format','SIP/%s','calleridname','Contact','firstName','lastName','active','phone','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','prototype','getCaller','exports','lodash','moment','isNil','string','uniqueid','idContact','name'];(function(_0x2e0854,_0x52544a){var _0x4d0ff9=function(_0x3647fb){while(--_0x3647fb){_0x2e0854['push'](_0x2e0854['shift']());}};_0x4d0ff9(++_0x52544a);}(_0x1967,0x173));var _0x7196=function(_0x16d346,_0x19111d){_0x16d346=_0x16d346-0x0;var _0x55f6f0=_0x1967[_0x16d346];return _0x55f6f0;};'use strict';var util=require('util');var _=require(_0x7196('0x0'));var moment=require(_0x7196('0x1'));function checkNameSurname(_0x4d0a98,_0x35803d,_0x3319fa){var _0xa80a3f='';if(!_[_0x7196('0x2')](_0x35803d)&&_0x7196('0x3')===typeof _0x35803d){_0xa80a3f+=_0x35803d;}if(!_[_0x7196('0x2')](_0x3319fa)&&_0x7196('0x3')===typeof _0x3319fa){_0xa80a3f+='\x20'+_0x3319fa;}if(_0xa80a3f!==''){return _0xa80a3f;}return _0x4d0a98;}function Action(_0x5c128f,_0x36b01e,_0x186175,_0x194746,_0x40e0af){this[_0x7196('0x4')]=_0x186175||undefined;this[_0x7196('0x5')]=_0x5c128f['id'];this['queue']=_0x36b01e[_0x7196('0x6')];this[_0x7196('0x7')]=_0x36b01e[_0x7196('0x7')];this[_0x7196('0x8')]=_0x7196('0x9');this['dialAnswer']=![];this['membername']=_[_0x7196('0x2')](_0x5c128f[_0x7196('0xa')])?undefined:_0x5c128f[_0x7196('0xa')][_0x7196('0x6')];this[_0x7196('0xb')]=this[_0x7196('0xc')]?util[_0x7196('0xd')](_0x7196('0xe'),this[_0x7196('0xc')]):_0x194746||undefined;this[_0x7196('0xf')]=checkNameSurname(_0x5c128f[_0x7196('0x10')]['phone'],_0x5c128f[_0x7196('0x10')][_0x7196('0x11')],_0x5c128f[_0x7196('0x10')][_0x7196('0x12')]);this['active']=_0x5c128f[_0x7196('0x13')]||![];this['calleridnum']=_0x5c128f[_0x7196('0x14')];this[_0x7196('0x15')]=_0x5c128f[_0x7196('0x15')];this[_0x7196('0x16')]=_0x5c128f[_0x7196('0x16')]||0x0;this[_0x7196('0x17')]=_0x5c128f[_0x7196('0x17')]||0x0;this[_0x7196('0x18')]=_0x5c128f[_0x7196('0x18')]||0x0;this[_0x7196('0x19')]=(_0x5c128f[_0x7196('0x16')]||0x0)+(_0x5c128f['countcongestionretry']||0x0)+(_0x5c128f['countnoanswerretry']||0x0)+(_0x5c128f[_0x7196('0x1a')]||0x0)+(_0x5c128f[_0x7196('0x1b')]||0x0)+(_0x5c128f[_0x7196('0x1c')]||0x0)+(_0x5c128f['countmachineretry']||0x0)+(_0x5c128f[_0x7196('0x1d')]||0x0);this['countnosuchnumberretry']=_0x5c128f['countnosuchnumberretry']||0x0;this[_0x7196('0x1b')]=_0x5c128f[_0x7196('0x1b')]||0x0;this[_0x7196('0x1c')]=_0x5c128f['countabandonedretry']||0x0;this['countmachineretry']=_0x5c128f[_0x7196('0x1e')]||0x0;this[_0x7196('0x1d')]=_0x5c128f['countagentrejectretry']||0x0;this[_0x7196('0x1f')]=_0x5c128f[_0x7196('0x1f')];this[_0x7196('0x20')]=_0x5c128f[_0x7196('0x20')];this[_0x7196('0x21')]=_0x5c128f['callbackat'];this[_0x7196('0x22')]=_0x5c128f['recallme'];this[_0x7196('0x23')]=_0x5c128f[_0x7196('0x23')];this[_0x7196('0x24')]=_0x5c128f[_0x7196('0x24')];this[_0x7196('0x25')]=_[_0x7196('0x2')](_0x5c128f['Agent'])?_0x5c128f['UserId']:_0x5c128f[_0x7196('0xa')]['id'];this[_0x7196('0x26')]=_0x5c128f[_0x7196('0x26')];this['originatecalleridnum']='';this['originatecalleridname']='';}Action[_0x7196('0x27')][_0x7196('0x28')]=function(){return util[_0x7196('0xd')]('\x22%s\x22\x20<%s>',this[_0x7196('0xf')],this['number']);};module[_0x7196('0x29')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 8e95b34..527eb26 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 _0x7abe=['paused','message','CAMPAIGN_STATUS','INACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','DEACTIVATED','\x20is\x20deactivated','syncCampaigns','hasOwnProperty','dialMethod','type','outbound','setMessage','clearZombieChannel','sequence','isNil','[clearZombieChannels][talking]','Queue','queue','originated:\x20','pTalking:\x20','actions','pick','contactId','UserId','VoiceQueueId','ListId','Action','status','channel','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','dialAnswer','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','clearZombieChannels','[action]','size','recallMe','getContactRecallMe','agentReadyId','getDiff','scheduledat','dialRecallMeTimeout','Agent','voicePause','then','logger2','[RecallMe]','catch','disableContact','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','IsNotLoggedIn','loggedIn','isActive','dialActive','isTrunkReachable','ACTIVE','callProgressDetectingCustomer','outboundNoSuchCallsDay','countglobal','totalGlobal','NoSuchNumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','countnosuchnumberretry','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','unlockAgent','activeContact','linkedid','actioncountonusuch','incrementPreviewCounters','idContact','swapAdditionalPhones','ANSWER','responsetime','answertime','uniqueid','custom:agentconnect','connect','acw','buildAcw','custom:agentcomplete','complete','outboundAnswerCallsDay','total','answered','decrementTalkink','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','talktime','sumBillable','[syncHangup][talking][decrement]','outboundBusyCallsDay','countbusyretry','Busy','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','[callProgressDetectingCustomer][logBusy]','NOANSWER','outboundNoAnswerCallsDay','countnoanswerretry','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','dialNoAnswerMaxRetry','CONGESTION','outboundCongestionCallsDay','countcongestionretry','Congestion','dialCongestionRetryFrequency','congestion','[callProgressDetectingCustomer][logCongestion]','dialCongestionMaxRetry','dialBusyRetryFrequency','CANCEL','outboundRejectCallsDay','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','outboundAbandonedCallsDay','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','countabandonedretry','dialAbandonedRetryFrequency','outboundUnknownCallsDay','cause-txt','dialstatus','amd','[callProgressDetectingCustomer][hangupInAMD]','custom:amd','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','\x20Queue','destlinkedid','queueSummaryCountersUpdated','object','isUndefined','reason','logAgent','[callProgressDetectingAgent][logNoSuch]','NoAnswer','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','resolve','[incrementPreviewCounters]\x20','checkInBlack','Contact','phone','lookAgent','isEmpty','execCall','Queue:\x20','\x20IdHopper:\x20','called','Calling','[Preview][execCall][failure]','outboundBlacklistCallsDay','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','reachable','unmonitored','run','execRun','unlock','unlockContact','getContactPreview','recallme','validateContact','isValid','[Preview][checkIsBlackList]','[Preview][getContactPreview]','Call\x20unsuccessful','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','Trunk','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','TrunkBackup','Trunk\x20not\x20working\x20correctly','[Preview][validateContact][Campaign\x20Active]','campaign\x20Name:\x20','\x20Not\x20Active','dialPrefix','trim','dialCutDigit','SIP/%s/%s%s','substring','getCallerId','callerid','getCallerIdRandom','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','dialOriginateCallerIdName','originatecalleridname','extractCalleridName','extractCalleridNumber','addVariables','setXMDContactVariables','assign','merge','toLowerVariables','starttime','variables','variablesAction','[originated][increment]','[originateFailure][logOriginateFailure]','syncNewExten','syncOriginateResponse','actionid','logLookAgent','response','callProgressDetectingAgent','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','addVariable','filterKey','keys','variable','value','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','uuid','../../../config/environment','../../../config/logger','preview','../ami','./rpcDb','../rpc/cmHopperAdditionalPhone','./action','./util/util','../dialer/utils','redis','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','finally','trunks','agents','clockClearZombieChannels','bind','hangup','syncHangup','hanguprequest','syncHangupRequest','syncDialEnd','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','loopCampaigns','campaignsPreview','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','format','name','voice_queue_channel:remove','emit','voice_queue_presence:remove','sendMessageOneNotActive','originated','pTalking','available'];(function(_0x2b412a,_0x748829){var _0x31b031=function(_0x3c47e4){while(--_0x3c47e4){_0x2b412a['push'](_0x2b412a['shift']());}};_0x31b031(++_0x748829);}(_0x7abe,0x117));var _0xe7ab=function(_0x44ac5b,_0x274757){_0x44ac5b=_0x44ac5b-0x0;var _0x385b1a=_0x7abe[_0x44ac5b];return _0x385b1a;};'use strict';var util=require(_0xe7ab('0x0'));var _=require(_0xe7ab('0x1'));var uuid=require(_0xe7ab('0x2'));var moment=require('moment');var Redis=require('ioredis');var config=require(_0xe7ab('0x3'));var logger=require(_0xe7ab('0x4'))(_0xe7ab('0x5'));var loggerAction=require('../../../config/logger')('actionPreview');var ami=require(_0xe7ab('0x6'));var rpcDb=require(_0xe7ab('0x7'));var cmHopperAdditionalPhone=require(_0xe7ab('0x8'));var Action=require(_0xe7ab('0x9'));var ut=require(_0xe7ab('0xa'));var utils=require(_0xe7ab('0xb'));config[_0xe7ab('0xc')]=_[_0xe7ab('0xd')](config[_0xe7ab('0xc')],{'host':_0xe7ab('0xe'),'port':0x18eb});var io=require(_0xe7ab('0xf'))(new Redis(config[_0xe7ab('0xc')]));var Sequence=function(){};Sequence[_0xe7ab('0x10')][_0xe7ab('0x11')]=function(_0x23898e){this[_0xe7ab('0x12')]=this[_0xe7ab('0x12')]?this['tail'][_0xe7ab('0x13')](_0x23898e):_0x23898e();};function Preview(_0x57c364){this['sequence']=new Sequence();this['campaignsPreview']=_0x57c364['voiceQueues'];this['trunks']=_0x57c364[_0xe7ab('0x14')];this['actions']={};this[_0xe7ab('0x15')]=_0x57c364[_0xe7ab('0x15')];this[_0xe7ab('0x16')]=0x0;ami['on']('originateresponse',this['syncOriginateResponse'][_0xe7ab('0x17')](this));ami['on'](_0xe7ab('0x18'),this[_0xe7ab('0x19')][_0xe7ab('0x17')](this));ami['on'](_0xe7ab('0x1a'),this[_0xe7ab('0x1b')][_0xe7ab('0x17')](this));ami['on']('dialend',this[_0xe7ab('0x1c')][_0xe7ab('0x17')](this));ami['on']('newexten',this['syncNewExten'][_0xe7ab('0x17')](this));ami['on'](_0xe7ab('0x1d'),this[_0xe7ab('0x1e')][_0xe7ab('0x17')](this));ami['on'](_0xe7ab('0x1f'),this[_0xe7ab('0x20')][_0xe7ab('0x17')](this));ami['on'](_0xe7ab('0x21'),this['syncBlindTransfer'][_0xe7ab('0x17')](this));this[_0xe7ab('0x22')](this[_0xe7ab('0x23')]);}function emit(_0x8e2647,_0xff0ada,_0x31ac2a){io['to'](_0x8e2647)['emit'](_0xff0ada,_0x31ac2a);}function emitVoiceQueueChannelRemove(_0x26aabf){logger[_0xe7ab('0x24')](_0xe7ab('0x25'),JSON[_0xe7ab('0x26')](_0x26aabf));emit(util[_0xe7ab('0x27')]('voice:queue:%s',_0x26aabf[_0xe7ab('0x28')]),_0xe7ab('0x29'),_0x26aabf);io[_0xe7ab('0x2a')](_0xe7ab('0x2b'),_0x26aabf);}function notSendMessagesQueue(_0x442c54){if(_0x442c54[_0xe7ab('0x2c')]){if(_0x442c54[_0xe7ab('0x2d')]===0x0&&_0x442c54[_0xe7ab('0x2e')]===0x0){_0x442c54[_0xe7ab('0x2c')]=![];_0x442c54[_0xe7ab('0x2f')]=0x0;_0x442c54[_0xe7ab('0x30')]=0x0;_0x442c54[_0xe7ab('0x31')]=utils[_0xe7ab('0x32')][_0xe7ab('0x33')];ut[_0xe7ab('0x34')](_0xe7ab('0x35'),_0x442c54[_0xe7ab('0x28')]+_0xe7ab('0x36'));}else{_0x442c54[_0xe7ab('0x31')]=utils[_0xe7ab('0x32')][_0xe7ab('0x37')];ut['logger'](_0xe7ab('0x35'),_0x442c54[_0xe7ab('0x28')]+_0xe7ab('0x38'));}}}Preview[_0xe7ab('0x10')][_0xe7ab('0x22')]=function(){var _0x4d5551=this;setInterval(function(){_0x4d5551['syncCampaigns']();},0x7cf);};Preview[_0xe7ab('0x10')][_0xe7ab('0x39')]=function(){var _0x429308=this[_0xe7ab('0x23')];this[_0xe7ab('0x16')]+=0x1;for(var _0x36739d in _0x429308){if(_0x429308[_0xe7ab('0x3a')](_0x36739d)&&(_0x429308[_0x36739d][_0xe7ab('0x3b')]===_0xe7ab('0x5')||_0x429308[_0x36739d][_0xe7ab('0x3b')]==='booked')&&_0x429308[_0x36739d][_0xe7ab('0x3c')]==='outbound'){if(this['clockClearZombieChannels']>0x7){this['clockClearZombieChannels']=0x0;this['clearZombieChannels']();}}if(_0x429308['hasOwnProperty'](_0x36739d)&&_0x429308[_0x36739d][_0xe7ab('0x3b')]===_0xe7ab('0x5')&&_0x429308[_0x36739d][_0xe7ab('0x3c')]===_0xe7ab('0x3d')){if(_0x429308[_0x36739d]['dialActive']){this[_0xe7ab('0x3e')](_0x429308[_0x36739d]);if(_0x429308[_0x36739d]['dialPreviewAutoRecallMe'])this['recallMe'](_0x429308[_0x36739d]);}else{notSendMessagesQueue(_0x429308[_0x36739d]);}}}};Preview[_0xe7ab('0x10')][_0xe7ab('0x3f')]=function(_0x471d77){var _0x1d7bb1=this;this[_0xe7ab('0x40')][_0xe7ab('0x11')](function(){if(!_[_0xe7ab('0x41')](_0x1d7bb1['actions'][_0x471d77])){loggerAction[_0xe7ab('0x24')](_0xe7ab('0x42'),_0x471d77,_0xe7ab('0x43'),_0x1d7bb1['actions'][_0x471d77][_0xe7ab('0x44')],_0xe7ab('0x45'),JSON[_0xe7ab('0x26')](_0x1d7bb1[_0xe7ab('0x23')][_0x1d7bb1['actions'][_0x471d77][_0xe7ab('0x44')]][_0xe7ab('0x2d')]),_0xe7ab('0x46'),JSON[_0xe7ab('0x26')](_0x1d7bb1[_0xe7ab('0x23')][_0x1d7bb1[_0xe7ab('0x47')][_0x471d77]['queue']][_0xe7ab('0x2e')]),JSON[_0xe7ab('0x26')](_0x1d7bb1[_0xe7ab('0x47')][_0x471d77]['dialAnswer']),JSON[_0xe7ab('0x26')](_[_0xe7ab('0x48')](_0x1d7bb1['actions'][_0x471d77],[_0xe7ab('0x49'),_0xe7ab('0x4a'),_0xe7ab('0x4b'),_0xe7ab('0x4c')])));return ami[_0xe7ab('0x4d')]({'action':_0xe7ab('0x4e'),'channel':_0x1d7bb1[_0xe7ab('0x47')][_0x471d77][_0xe7ab('0x4f')]})['catch'](function(_0x45c52d){if(_0x45c52d[_0xe7ab('0x31')]===_0xe7ab('0x50')){setTimeout(function(){if(_0x1d7bb1[_0xe7ab('0x47')][_0x471d77]){ut[_0xe7ab('0x51')](_0x1d7bb1[_0xe7ab('0x23')][_0x1d7bb1[_0xe7ab('0x47')][_0x471d77][_0xe7ab('0x44')]],_0xe7ab('0x52'));if(_0x1d7bb1[_0xe7ab('0x47')][_0x471d77][_0xe7ab('0x53')]===!![]){ut['decrementTalkink'](_0x1d7bb1[_0xe7ab('0x23')][_0x1d7bb1[_0xe7ab('0x47')][_0x471d77]['queue']],'[clearZombieChannel]');ut[_0xe7ab('0x54')](_0xe7ab('0x55')+_0x471d77,_0x1d7bb1['actions'][_0x471d77]['queue']);}ut[_0xe7ab('0x54')](_0xe7ab('0x56')+_0x471d77,_0x1d7bb1[_0xe7ab('0x47')][_0x471d77][_0xe7ab('0x44')]);delete _0x1d7bb1[_0xe7ab('0x47')][_0x471d77];}},0x2328);}});}});};Preview[_0xe7ab('0x10')][_0xe7ab('0x57')]=function(){var _0x3e1ffc=this;loggerAction['info'](_0xe7ab('0x58'),_[_0xe7ab('0x59')](this['actions']));for(var _0x6a60c4 in this[_0xe7ab('0x47')]){if(_0x3e1ffc['actions'][_0xe7ab('0x3a')](_0x6a60c4)){_0x3e1ffc[_0xe7ab('0x3f')](_0x6a60c4);}}};Preview[_0xe7ab('0x10')][_0xe7ab('0x5a')]=function(_0x17d71e){var _0x1f9ed3=this;rpcDb[_0xe7ab('0x5b')](_0x17d71e['id'],ut[_0xe7ab('0x5c')](this[_0xe7ab('0x15')]))['then'](function(_0x2d4f77){if(!_[_0xe7ab('0x41')](_0x2d4f77)){for(var _0x352fa4=0x0;_0x352fa4<_0x2d4f77['length'];_0x352fa4+=0x1){if(ut[_0xe7ab('0x5d')](_0x2d4f77[_0x352fa4][_0xe7ab('0x5e')])<_0x17d71e[_0xe7ab('0x5f')]*0x3c){if(_0x2d4f77[_0x352fa4][_0xe7ab('0x60')]&&!_0x2d4f77[_0x352fa4]['Agent'][_0xe7ab('0x61')]){_0x1f9ed3['run'](_0x2d4f77[_0x352fa4]['id'])[_0xe7ab('0x62')](ut[_0xe7ab('0x63')](_0xe7ab('0x64')))[_0xe7ab('0x65')](ut[_0xe7ab('0x63')](_0xe7ab('0x64')));}else{rpcDb[_0xe7ab('0x66')](_0x2d4f77[_0x352fa4]['id']);}}else{var _0x227339=new Action(_0x2d4f77[_0x352fa4],_0x17d71e);_0x227339['starttime']=moment()[_0xe7ab('0x27')](_0xe7ab('0x67'));_0x17d71e[_0xe7ab('0x68')]+=0x1;ut[_0xe7ab('0x69')](_0x227339,0x17,_0xe7ab('0x6a'));if(_0x17d71e['dialRecallInQueue']){rpcDb[_0xe7ab('0x6b')](ut[_0xe7ab('0x6c')](_0x2d4f77[_0x352fa4]));rpcDb[_0xe7ab('0x6d')](_0x227339,_0xe7ab('0x6e'));}else{ut[_0xe7ab('0x69')](_0x227339,0x16,_0xe7ab('0x6f'));rpcDb[_0xe7ab('0x6d')](_0x227339,_0xe7ab('0x70'));rpcDb[_0xe7ab('0x71')](_0x227339,_0xe7ab('0x70'));}}}}})[_0xe7ab('0x65')](ut[_0xe7ab('0x63')]('[getContactRecallMe]'));};Preview[_0xe7ab('0x10')][_0xe7ab('0x3e')]=function(_0x141303){_0x141303['sendMessageOneNotActive']=!![];if(ut[_0xe7ab('0x72')](_0x141303[_0xe7ab('0x73')])){_0x141303['message']=utils[_0xe7ab('0x32')]['NO_AGENTS_LOGGED'];}else if(!ut[_0xe7ab('0x74')](_0x141303[_0xe7ab('0x75')])){_0x141303[_0xe7ab('0x31')]=utils[_0xe7ab('0x32')]['INACTIVE'];}else if(!this[_0xe7ab('0x76')](_0x141303['Trunk'])){if(!this['isTrunkReachable'](_0x141303['TrunkBackup'])){_0x141303[_0xe7ab('0x31')]=utils[_0xe7ab('0x32')]['UNREACHABLE_TRUNK'];}else{_0x141303[_0xe7ab('0x31')]=utils[_0xe7ab('0x32')]['ACTIVE'];}}else{_0x141303[_0xe7ab('0x31')]=utils[_0xe7ab('0x32')][_0xe7ab('0x77')];}};Preview[_0xe7ab('0x10')][_0xe7ab('0x78')]=function(_0x5c662e,_0x5f2218,_0x274d87){var _0x318237=this;var _0x52f67b=this[_0xe7ab('0x47')][_0x5f2218];var _0x4f7a51=this[_0xe7ab('0x23')][_0x52f67b[_0xe7ab('0x44')]];var _0x1228ea;var _0x67253=![];var _0x1cb718=0x2;var _0x70b137=0x3;if(_0x4f7a51){switch(_0x274d87){case'1':_0x4f7a51[_0xe7ab('0x79')]+=0x1;_0x52f67b['countnosuchnumberretry']+=0x1;_0x52f67b[_0xe7ab('0x7a')]=ut[_0xe7ab('0x7b')](_0x52f67b);ut[_0xe7ab('0x69')](_0x52f67b,0x0,_0xe7ab('0x7c'));ami[_0xe7ab('0x2a')]('custom:agentnosuchnumber',ut[_0xe7ab('0x7d')](_0x52f67b,_0xe7ab('0x7e')));rpcDb[_0xe7ab('0x6d')](_0x52f67b,_0xe7ab('0x7f'));_0x318237[_0xe7ab('0x80')](_0x52f67b,'0',_0x4f7a51)[_0xe7ab('0x62')](function(_0x433c15){_0x67253=_0x433c15[_0xe7ab('0x81')]==0x1;_0x1cb718=_0x4f7a51['dialNoSuchNumberRetryFrequency'];_0x70b137=_0x4f7a51[_0xe7ab('0x82')];if(!_0x67253){if(ut[_0xe7ab('0x7b')](_0x52f67b)>=_0x4f7a51[_0xe7ab('0x83')]){_0x1228ea=ut[_0xe7ab('0x84')](_0x52f67b,0xf,_0xe7ab('0x85'));rpcDb[_0xe7ab('0x71')](_0x1228ea,_0xe7ab('0x86'));}else{if(_0x52f67b[_0xe7ab('0x87')]>=_0x4f7a51[_0xe7ab('0x88')]){rpcDb[_0xe7ab('0x71')](_0x52f67b,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{rpcDb[_0xe7ab('0x89')](ut[_0xe7ab('0x8a')](_0x52f67b,'countnosuchnumberretry',_0x4f7a51['dialNoSuchNumberRetryFrequency']),_0x52f67b[_0xe7ab('0x8b')],_0x52f67b[_0xe7ab('0x8c')]);}}delete this[_0xe7ab('0x47')][_0x5c662e[_0xe7ab('0x8d')]];}else{_0x52f67b['countnosuchnumberretry']++;logger[_0xe7ab('0x24')](_0xe7ab('0x8e'),_0x52f67b[_0xe7ab('0x87')]);logger[_0xe7ab('0x24')]('id',_0x52f67b['idContact']);_0x318237[_0xe7ab('0x8f')]({'id':_0x52f67b[_0xe7ab('0x90')],'field':{'countnosuchnumberretry':_0x52f67b['countnosuchnumberretry']}})[_0xe7ab('0x62')](function(){_0x318237[_0xe7ab('0x91')](_0x52f67b,_0x1cb718,_0x70b137)[_0xe7ab('0x62')](function(){});});}});break;case _0xe7ab('0x92'):var _0x27740a=moment()[_0xe7ab('0x27')]('YYYY-MM-DD\x20HH:mm:ss');_0x52f67b[_0xe7ab('0x93')]=_0x27740a;_0x52f67b[_0xe7ab('0x94')]=_0x27740a;_0x52f67b[_0xe7ab('0x53')]=!![];_0x4f7a51[_0xe7ab('0x2e')]+=0x1;logger[_0xe7ab('0x24')]('[syncHangup][talking][increment]',_0x52f67b[_0xe7ab('0x95')],'\x20Queue',_0x4f7a51[_0xe7ab('0x28')],_0xe7ab('0x46'),_0x4f7a51[_0xe7ab('0x2e')]);ami[_0xe7ab('0x2a')](_0xe7ab('0x96'),ut[_0xe7ab('0x7d')](_0x52f67b,_0xe7ab('0x97'),this['campaignsPreview'][_0x52f67b['queue']]));if(_0x4f7a51[_0xe7ab('0x98')]){ami[_0xe7ab('0x2a')]('custom:agentConnectPreview',ut[_0xe7ab('0x99')](_0x52f67b));}break;case'16':ami[_0xe7ab('0x2a')](_0xe7ab('0x9a'),ut[_0xe7ab('0x7d')](_0x52f67b,_0xe7ab('0x9b'),this[_0xe7ab('0x23')][_0x52f67b[_0xe7ab('0x44')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x52f67b,'complete'));_0x4f7a51[_0xe7ab('0x9c')]+=0x1;_0x4f7a51[_0xe7ab('0x9d')]+=0x1;_0x4f7a51[_0xe7ab('0x9e')]+=0x1;ut[_0xe7ab('0x9f')](_0x4f7a51,_0xe7ab('0xa0'));_0x52f67b['countglobal']=ut[_0xe7ab('0x7b')](_0x52f67b);ut[_0xe7ab('0x69')](_0x52f67b,0x4,_0xe7ab('0xa1'));rpcDb[_0xe7ab('0x6d')](_0x52f67b,_0xe7ab('0xa2'));rpcDb[_0xe7ab('0x71')](_0x52f67b,_0xe7ab('0xa3'));rpcDb[_0xe7ab('0xa4')](_0x52f67b);_0x4f7a51[_0xe7ab('0xa5')]+=_0x52f67b[_0xe7ab('0xa6')];_0x4f7a51[_0xe7ab('0xa7')]+=_0x52f67b[_0xe7ab('0xa6')];logger[_0xe7ab('0x24')](_0xe7ab('0xa8'),_0x52f67b[_0xe7ab('0x95')],'\x20Queue',_0x4f7a51[_0xe7ab('0x28')],'pTalking:\x20',_0x4f7a51[_0xe7ab('0x2e')]);delete this[_0xe7ab('0x47')][_0x5c662e[_0xe7ab('0x8d')]];break;case'BUSY':_0x4f7a51[_0xe7ab('0xa9')]+=0x1;_0x52f67b[_0xe7ab('0xaa')]+=0x1;_0x52f67b['countglobal']=ut[_0xe7ab('0x7b')](_0x52f67b);ut[_0xe7ab('0x69')](_0x52f67b,0x5,_0xe7ab('0xab'));_0x1cb718=_0x4f7a51['dialBusyRetryFrequency'];_0x70b137=_0x4f7a51[_0xe7ab('0x82')];ami[_0xe7ab('0x2a')](_0xe7ab('0xac'),ut[_0xe7ab('0x7d')](_0x52f67b,_0xe7ab('0xad')));rpcDb['createCustomerHistory'](_0x52f67b,'[callProgressDetectingCustomer][logBusy]');_0x318237[_0xe7ab('0x80')](_0x52f67b,'5',_0x4f7a51)[_0xe7ab('0x62')](function(_0x1b9fe9){_0x67253=_0x1b9fe9[_0xe7ab('0x81')]==0x1;if(!_0x67253){if(ut['totalGlobal'](_0x52f67b)>=_0x4f7a51['dialGlobalMaxRetry']){_0x1228ea=ut['cloneAction'](_0x52f67b,0xf,_0xe7ab('0x85'));rpcDb[_0xe7ab('0x71')](_0x1228ea,_0xe7ab('0xae'));}else{if(_0x52f67b[_0xe7ab('0xaa')]>=_0x4f7a51[_0xe7ab('0xaf')]){rpcDb[_0xe7ab('0x71')](_0x52f67b,_0xe7ab('0xb0'));}else{rpcDb[_0xe7ab('0x89')](ut[_0xe7ab('0x8a')](_0x52f67b,_0xe7ab('0xaa'),_0x4f7a51['dialBusyRetryFrequency']),_0x52f67b['unlockAgent'],_0x52f67b[_0xe7ab('0x8c')]);}}}else{_0x52f67b[_0xe7ab('0xaa')]++;_0x318237[_0xe7ab('0x8f')]({'id':_0x52f67b[_0xe7ab('0x90')],'field':{'countbusyretry':_0x52f67b[_0xe7ab('0xaa')]}})[_0xe7ab('0x62')](function(){_0x318237['swapAdditionalPhones'](_0x52f67b,_0x1cb718,_0x70b137)[_0xe7ab('0x62')](function(){});});}});break;case _0xe7ab('0xb1'):_0x4f7a51[_0xe7ab('0xb2')]+=0x1;_0x52f67b[_0xe7ab('0xb3')]+=0x1;_0x52f67b['countglobal']=ut['totalGlobal'](_0x52f67b);ut[_0xe7ab('0x69')](_0x52f67b,0x3,'NoAnswer');_0x1cb718=_0x4f7a51[_0xe7ab('0xb4')];_0x70b137=_0x4f7a51['callAdditionalPhoneAfterMin'];var _0x176bcd=ut[_0xe7ab('0xb5')](_0x52f67b,_0x4f7a51);ami[_0xe7ab('0x2a')](_0xe7ab('0xb6'),_0x176bcd);rpcDb['createCustomerHistory'](_0x52f67b,'[callProgressDetectingCustomer][logNoAnswer]');_0x318237['verifyAdditionalPhones'](_0x52f67b,'3',_0x4f7a51)[_0xe7ab('0x62')](function(_0x36ac24){_0x67253=_0x36ac24[_0xe7ab('0x81')]==0x1;if(!_0x67253){if(ut[_0xe7ab('0x7b')](_0x52f67b)>=_0x4f7a51['dialGlobalMaxRetry']){_0x1228ea=ut[_0xe7ab('0x84')](_0x52f67b,0xf,_0xe7ab('0x85'));rpcDb['createCustomerFinal'](_0x1228ea,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x52f67b[_0xe7ab('0xb3')]>=_0x4f7a51[_0xe7ab('0xb7')]){rpcDb[_0xe7ab('0x71')](_0x52f67b,'[callProgressDetectingCustomer][logNoAnswer]');}else{rpcDb[_0xe7ab('0x89')](ut[_0xe7ab('0x8a')](_0x52f67b,'countnoanswerretry',_0x4f7a51[_0xe7ab('0xb4')]),_0x52f67b[_0xe7ab('0x8b')],_0x52f67b[_0xe7ab('0x8c')]);}}}else{_0x52f67b['countnoanswerretry']++;_0x318237[_0xe7ab('0x8f')]({'id':_0x52f67b[_0xe7ab('0x90')],'field':{'countnoanswerretry':_0x52f67b[_0xe7ab('0xb3')]}})[_0xe7ab('0x62')](function(){_0x318237[_0xe7ab('0x91')](_0x52f67b,_0x1cb718,_0x70b137)['then'](function(){});});}});break;case _0xe7ab('0xb8'):_0x4f7a51[_0xe7ab('0xb9')]+=0x1;_0x52f67b[_0xe7ab('0xba')]+=0x1;_0x52f67b['countglobal']=ut[_0xe7ab('0x7b')](_0x52f67b);ut[_0xe7ab('0x69')](_0x52f67b,0x8,_0xe7ab('0xbb'));_0x1cb718=_0x4f7a51[_0xe7ab('0xbc')];_0x70b137=_0x4f7a51[_0xe7ab('0x82')];ami[_0xe7ab('0x2a')]('custom:agentcongestion',ut[_0xe7ab('0x7d')](_0x52f67b,_0xe7ab('0xbd')));rpcDb[_0xe7ab('0x6d')](_0x52f67b,_0xe7ab('0xbe'));_0x318237[_0xe7ab('0x80')](_0x52f67b,'8',_0x4f7a51)[_0xe7ab('0x62')](function(_0x131354){_0x67253=_0x131354[_0xe7ab('0x81')]==0x1;if(!_0x67253){if(ut['totalGlobal'](_0x52f67b)>=_0x4f7a51[_0xe7ab('0x83')]){_0x1228ea=ut[_0xe7ab('0x84')](_0x52f67b,0xf,_0xe7ab('0x85'));rpcDb[_0xe7ab('0x71')](_0x1228ea,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0x52f67b[_0xe7ab('0xba')]>=_0x4f7a51[_0xe7ab('0xbf')]){rpcDb[_0xe7ab('0x71')](_0x52f67b,_0xe7ab('0xbe'));}else{rpcDb[_0xe7ab('0x89')](ut['scheduledAt'](_0x52f67b,_0xe7ab('0xba'),_0x4f7a51[_0xe7ab('0xc0')]),_0x52f67b[_0xe7ab('0x8b')],_0x52f67b[_0xe7ab('0x8c')]);}}}else{_0x52f67b[_0xe7ab('0xba')]++;_0x318237[_0xe7ab('0x8f')]({'id':_0x52f67b[_0xe7ab('0x90')],'field':{'countcongestionretry':_0x52f67b[_0xe7ab('0xba')]}})[_0xe7ab('0x62')](function(){_0x318237[_0xe7ab('0x91')](_0x52f67b,_0x1cb718,_0x70b137)[_0xe7ab('0x62')](function(){});});}});break;case _0xe7ab('0xc1'):_0x4f7a51[_0xe7ab('0xc2')]+=0x1;_0x52f67b[_0xe7ab('0xc3')]+=0x1;_0x52f67b['countglobal']=ut['totalGlobal'](_0x52f67b);ut[_0xe7ab('0x69')](_0x52f67b,0x14,_0xe7ab('0xc4'));_0x1cb718=_0x4f7a51[_0xe7ab('0xc5')];_0x70b137=_0x4f7a51['callAdditionalPhoneAfterMin'];ami['emit']('custom:agentreject',ut[_0xe7ab('0x7d')](_0x52f67b,'agentreject'));rpcDb[_0xe7ab('0x6d')](_0x52f67b,_0xe7ab('0xc6'));_0x318237[_0xe7ab('0x80')](_0x52f67b,'20',_0x4f7a51)['then'](function(_0x3f297f){_0x67253=_0x3f297f[_0xe7ab('0x81')]==0x1;if(!_0x67253){if(ut[_0xe7ab('0x7b')](_0x52f67b)>=_0x4f7a51[_0xe7ab('0x83')]){_0x1228ea=ut[_0xe7ab('0x84')](_0x52f67b,0x14,_0xe7ab('0xc4'));rpcDb[_0xe7ab('0x71')](_0x1228ea,_0xe7ab('0xc7'));}else{if(_0x52f67b[_0xe7ab('0xc3')]>=_0x4f7a51[_0xe7ab('0xc8')]){rpcDb[_0xe7ab('0x71')](_0x52f67b,_0xe7ab('0xc7'));}else{rpcDb[_0xe7ab('0x89')](ut[_0xe7ab('0x8a')](_0x52f67b,_0xe7ab('0xc3'),_0x4f7a51[_0xe7ab('0xc5')]),_0x52f67b[_0xe7ab('0x8b')],_0x52f67b[_0xe7ab('0x8c')]);}}}else{_0x52f67b['countnoanswerretry']++;_0x318237[_0xe7ab('0x8f')]({'id':_0x52f67b[_0xe7ab('0x90')],'field':{'countnoanswerretry':_0x52f67b['countnoanswerretry']}})[_0xe7ab('0x62')](function(){_0x318237[_0xe7ab('0x91')](_0x52f67b,_0x1cb718,_0x70b137)[_0xe7ab('0x62')](function(){});});}});break;case'ABANDONED':_0x4f7a51[_0xe7ab('0xc9')]+=0x1;_0x52f67b['countabandonedretry']+=0x1;_0x52f67b[_0xe7ab('0x7a')]=ut[_0xe7ab('0x7b')](_0x52f67b);ut['logCustomer'](_0x52f67b,0xb,_0xe7ab('0xca'));rpcDb[_0xe7ab('0x6d')](_0x52f67b,_0xe7ab('0xcb'));_0x318237[_0xe7ab('0x80')](_0x52f67b,'11',_0x4f7a51)[_0xe7ab('0x62')](function(_0x5d9445){_0x67253=_0x5d9445[_0xe7ab('0x81')]==0x1;if(!_0x67253){if(ut['totalGlobal'](_0x52f67b)>=_0x4f7a51[_0xe7ab('0x83')]){_0x1228ea=ut[_0xe7ab('0x84')](_0x52f67b,0xf,_0xe7ab('0x85'));rpcDb[_0xe7ab('0x71')](_0x1228ea,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x52f67b[_0xe7ab('0xcc')]>=_0x4f7a51['dialAbandonedMaxRety']){rpcDb['createCustomerFinal'](_0x52f67b,_0xe7ab('0xcb'));}else{rpcDb['rescheduleContact'](ut[_0xe7ab('0x8a')](_0x52f67b,_0xe7ab('0xcd'),_0x4f7a51[_0xe7ab('0xce')]),_0x52f67b[_0xe7ab('0x8b')],_0x52f67b[_0xe7ab('0x8c')]);}}}else{_0x52f67b[_0xe7ab('0xb3')]++;_0x318237[_0xe7ab('0x8f')]({'id':_0x52f67b['idContact'],'field':{'countnoanswerretry':_0x52f67b[_0xe7ab('0xb3')]}})[_0xe7ab('0x62')](function(){_0x318237[_0xe7ab('0x91')](_0x52f67b,_0x1cb718,_0x70b137)[_0xe7ab('0x62')](function(){});});}});break;case'18':_0x4f7a51[_0xe7ab('0xcf')]+=0x1;_0x52f67b['countmachineretry']+=0x1;_0x52f67b[_0xe7ab('0x7a')]=ut[_0xe7ab('0x7b')](_0x52f67b);ut['logCustomer'](_0x52f67b,0x12,_0x5c662e[_0xe7ab('0xd0')]||_0x5c662e[_0xe7ab('0xd1')]);ami[_0xe7ab('0x2a')]('custom:amd',ut['buildObj'](_0x52f67b,_0xe7ab('0xd2')));rpcDb['createCustomerHistory'](_0x52f67b,'[callProgressDetectingCustomer][hangupInAMD]');_0x318237[_0xe7ab('0x80')](_0x52f67b,'18',_0x4f7a51)[_0xe7ab('0x62')](function(_0x3be604){_0x67253=_0x3be604[_0xe7ab('0x81')]==0x1;if(!_0x67253){if(ut[_0xe7ab('0x7b')](_0x52f67b)>=_0x4f7a51[_0xe7ab('0x83')]){_0x1228ea=ut['cloneAction'](_0x52f67b,0x12,_0xe7ab('0x85'));rpcDb[_0xe7ab('0x71')](_0x1228ea,_0xe7ab('0xd3'));}else{rpcDb['createCustomerFinal'](_0x52f67b,'[callProgressDetectingCustomer][hangupInAMD]');}}else{_0x52f67b[_0xe7ab('0xb3')]++;_0x318237['incrementPreviewCounters']({'id':_0x52f67b[_0xe7ab('0x90')],'field':{'countnoanswerretry':_0x52f67b['countnoanswerretry']}})[_0xe7ab('0x62')](function(){_0x318237[_0xe7ab('0x91')](_0x52f67b,_0x1cb718,_0x70b137)['then'](function(){});});}});delete this[_0xe7ab('0x47')][_0x5c662e['linkedid']];break;case'19':_0x4f7a51[_0xe7ab('0xcf')]+=0x1;_0x52f67b['countglobal']=ut[_0xe7ab('0x7b')](_0x52f67b);ut[_0xe7ab('0x69')](_0x52f67b,0x13,_0x5c662e[_0xe7ab('0xd0')]||_0x5c662e[_0xe7ab('0xd1')]);ami['emit'](_0xe7ab('0xd4'),ut[_0xe7ab('0x7d')](_0x52f67b,'amd'));rpcDb[_0xe7ab('0x6d')](_0x52f67b,_0xe7ab('0xd5'));_0x318237[_0xe7ab('0x80')](_0x52f67b,'18',_0x4f7a51)[_0xe7ab('0x62')](function(_0x77f6b8){_0x67253=_0x77f6b8[_0xe7ab('0x81')]==0x1;if(!_0x67253){if(ut['totalGlobal'](_0x52f67b)>=_0x4f7a51[_0xe7ab('0x83')]){_0x1228ea=ut['cloneAction'](_0x52f67b,0xf,_0xe7ab('0x85'));rpcDb[_0xe7ab('0x71')](_0x1228ea,_0xe7ab('0xd5'));}else{rpcDb['createCustomerFinal'](_0x52f67b,_0xe7ab('0xd5'));}}else{_0x52f67b[_0xe7ab('0xb3')]++;_0x318237[_0xe7ab('0x8f')]({'id':_0x52f67b['idContact'],'field':{'countnoanswerretry':_0x52f67b[_0xe7ab('0xb3')]}})[_0xe7ab('0x62')](function(){_0x318237[_0xe7ab('0x91')](_0x52f67b,_0x1cb718,_0x70b137)[_0xe7ab('0x62')](function(){});});}});delete this[_0xe7ab('0x47')][_0x5c662e['linkedid']];break;default:if(_0x52f67b[_0xe7ab('0x53')]){ut[_0xe7ab('0x9f')](_0x4f7a51,_0xe7ab('0xd6'));ut[_0xe7ab('0x54')](_0xe7ab('0xd7')+_0x4f7a51['name'],_0x5c662e);}_0x4f7a51['outboundUnknownCallsDay']+=0x1;_0x52f67b[_0xe7ab('0x7a')]=ut['totalGlobal'](_0x52f67b);ut[_0xe7ab('0x69')](_0x52f67b,0xc,_0x5c662e['cause-txt']||_0x5c662e[_0xe7ab('0xd1')]);_0x1cb718=_0x4f7a51[_0xe7ab('0xc5')];_0x70b137=_0x4f7a51[_0xe7ab('0x82')];rpcDb['createCustomerHistory'](_0x52f67b,_0xe7ab('0xd8'));_0x318237[_0xe7ab('0x80')](_0x52f67b,'20',_0x4f7a51)[_0xe7ab('0x62')](function(_0xe366cc){_0x67253=_0xe366cc[_0xe7ab('0x81')]==0x1;if(!_0x67253){if(ut[_0xe7ab('0x7b')](_0x52f67b)>=_0x4f7a51[_0xe7ab('0x83')]){_0x1228ea=ut[_0xe7ab('0x84')](_0x52f67b,0xf,_0xe7ab('0x85'));rpcDb[_0xe7ab('0x71')](_0x1228ea,_0xe7ab('0xd9'));}else{rpcDb[_0xe7ab('0x71')](_0x52f67b,_0xe7ab('0xd9'));}delete this[_0xe7ab('0x47')][_0x5c662e[_0xe7ab('0x8d')]];}else{_0x318237['swapAdditionalPhones'](_0x52f67b,_0x1cb718,_0x70b137)[_0xe7ab('0x62')](function(){});}});}if(!(_0x52f67b['dialAnswer']&&_0x274d87==='16')){ut[_0xe7ab('0x51')](_0x4f7a51,_0xe7ab('0xda'));logger[_0xe7ab('0x24')]('[originated][decrement][callProgressDetectingCustomer]',_0x52f67b[_0xe7ab('0x95')],_0xe7ab('0xdb'),_0x4f7a51[_0xe7ab('0x28')],'originated:\x20',_0x4f7a51[_0xe7ab('0x2d')]);}if(_0x274d87!==_0xe7ab('0x92')){delete this['actions'][_0x5c662e[_0xe7ab('0x8d')]];delete this[_0xe7ab('0x47')][_0x5c662e[_0xe7ab('0xdc')]];}_0x4f7a51[_0xe7ab('0xdd')]=!![];}};Preview[_0xe7ab('0x10')]['callProgressDetectingAgent']=function(_0x190444,_0x2f70d0,_0x222033){if(_['isUndefined'](_0x2f70d0)&&_0xe7ab('0xde')!==typeof _0x2f70d0){return;}if(_[_0xe7ab('0xdf')](_0x222033)&&_0xe7ab('0xde')!==typeof _0x222033){return;}switch(_0x222033[_0xe7ab('0xe0')]){case'0':ut[_0xe7ab('0xe1')](_0x190444,0x0,_0xe7ab('0x7c'));rpcDb['createAgentHistory'](_0x190444,_0xe7ab('0xe2'));break;case'3':ut[_0xe7ab('0xe1')](_0x190444,0x3,_0xe7ab('0xe3'));rpcDb[_0xe7ab('0xe4')](_0x190444,_0xe7ab('0xe5'));break;case'5':ut[_0xe7ab('0xe1')](_0x190444,0x5,_0xe7ab('0xab'));rpcDb[_0xe7ab('0xe4')](_0x190444,_0xe7ab('0xe6'));break;case'8':ut['logAgent'](_0x190444,0x8,_0xe7ab('0xbb'));rpcDb[_0xe7ab('0xe4')](_0x190444,_0xe7ab('0xe7'));break;case'22':ut[_0xe7ab('0xe1')](_0x190444,0x16,_0xe7ab('0xe8'));rpcDb[_0xe7ab('0xe4')](_0x190444,_0xe7ab('0xe9'));break;default:ut[_0xe7ab('0xe1')](_0x190444,0xc,_0x222033[_0xe7ab('0xe0')]);rpcDb['createAgentHistory'](_0x190444,'[callProgressDetectingAgent][logCongestion]');}ut[_0xe7ab('0x51')](_0x2f70d0,_0xe7ab('0xea'));logger['info'](_0xe7ab('0xeb'),_0x190444[_0xe7ab('0x95')],_0xe7ab('0xdb'),_0x2f70d0[_0xe7ab('0x28')],_0xe7ab('0x45'),_0x2f70d0['originated']);delete this[_0xe7ab('0x47')][_0x190444[_0xe7ab('0x95')]];};Preview['prototype']['verifyAdditionalPhones']=function(_0x1d5db7,_0x21696c,_0x3aa740){return cmHopperAdditionalPhone[_0xe7ab('0x80')](_0x1d5db7,_0x21696c,_0x3aa740)[_0xe7ab('0x65')](logger[_0xe7ab('0x24')]('[verifyAdditionalPhone]\x20'));};Preview[_0xe7ab('0x10')][_0xe7ab('0x91')]=function(_0x4d4c52,_0x884fb3,_0x492727){return cmHopperAdditionalPhone[_0xe7ab('0x91')](_0x4d4c52,_0x884fb3,_0x492727)['catch'](logger[_0xe7ab('0x24')]('[swapAdditionalPhone]\x20'));};Preview[_0xe7ab('0x10')][_0xe7ab('0x8f')]=function(_0x38530e){return Promise[_0xe7ab('0xec')]()[_0xe7ab('0x62')](cmHopperAdditionalPhone[_0xe7ab('0x8f')](_0x38530e))['catch'](logger[_0xe7ab('0x24')](_0xe7ab('0xed')));};Preview[_0xe7ab('0x10')][_0xe7ab('0xee')]=function(_0x55cf7a,_0x311aa8,_0x184399,_0x5ba162,_0x3b6d0a){var _0x3b638f=this;return new Promise(function(_0x3881fd,_0x3c60a3){if(_[_0xe7ab('0x41')](_0x311aa8)||_[_0xe7ab('0x41')](_0x311aa8[_0xe7ab('0xef')])||_[_0xe7ab('0x41')](_0x311aa8[_0xe7ab('0xf0')])||_[_0xe7ab('0x41')](_0x311aa8[_0xe7ab('0x4b')])){_0x3c60a3(ut[_0xe7ab('0x31')]('Contact\x20is\x20undefined',_0x5ba162,_0x3b6d0a));return;}var _0x4beb74=uuid['v4']();var _0x2790c4=_0x3b638f[_0xe7ab('0x23')][_0x311aa8[_0xe7ab('0x43')][_0xe7ab('0x28')]];var _0x46500f=_0x184399?_0x3b638f[_0xe7ab('0x15')][_0x184399]['id']:undefined;_0x3b638f['actions'][_0x4beb74]=new Action(_0x311aa8,_0x2790c4,_0x4beb74,_0x184399,_0x46500f);var _0x8f8aeb=_0x3b638f[_0xe7ab('0x47')][_0x4beb74];_0x8f8aeb['unlockAgent']=_0x5ba162;_0x8f8aeb[_0xe7ab('0x8c')]=_0x3b6d0a;_0x8f8aeb[_0xe7ab('0xf1')]=_0x184399;if(_[_0xe7ab('0xf2')](_0x55cf7a)){_0x3b638f[_0xe7ab('0xf3')](_0x8f8aeb,_0x2790c4,_0x311aa8,_0x184399)[_0xe7ab('0x62')](function(_0x3f401c){logger['info']('[Preview][execCall][success]',_0xe7ab('0xf4')+_0x8f8aeb[_0xe7ab('0x44')]+_0xe7ab('0xf5')+_0x8f8aeb[_0xe7ab('0x90')],JSON['stringify'](_0x3f401c));ami['emit']('custom:agentcalled',ut['buildObj'](_0x8f8aeb,_0xe7ab('0xf6'),_0x3b638f[_0xe7ab('0x23')][_0x8f8aeb[_0xe7ab('0x44')]]));_0x3881fd(ut['message'](_0xe7ab('0xf7')));})['catch'](function(_0x581dd3){ut[_0xe7ab('0x34')](_0xe7ab('0xf8'),_0x581dd3);_0x3c60a3(ut[_0xe7ab('0x31')]('Call\x20failed',_0x5ba162,_0x3b6d0a));});}else{_0x2790c4[_0xe7ab('0xf9')]+=0x1;ut['logBlacklist'](_0x8f8aeb);rpcDb[_0xe7ab('0xfa')](_0x8f8aeb,_0xe7ab('0xfb'));delete _0x3b638f['actions'][_0x4beb74];_0x3c60a3(ut[_0xe7ab('0x31')](_0xe7ab('0xfc'),_0x5ba162,_0x3b6d0a));}});};Preview['prototype'][_0xe7ab('0x76')]=function(_0x485126){return!_[_0xe7ab('0x41')](_0x485126)&&!_[_0xe7ab('0x41')](_0x485126['name'])&&!_[_0xe7ab('0x41')](_0x485126[_0xe7ab('0xfd')])&&_0x485126[_0xe7ab('0xfd')]&&!_['isNil'](this[_0xe7ab('0x14')][util[_0xe7ab('0x27')]('SIP/%s',_0x485126['name'])])&&!_[_0xe7ab('0x41')](this['trunks'][util['format'](_0xe7ab('0xfe'),_0x485126[_0xe7ab('0x28')])][_0xe7ab('0x4e')])&&(this['trunks'][util[_0xe7ab('0x27')]('SIP/%s',_0x485126[_0xe7ab('0x28')])][_0xe7ab('0x4e')]===_0xe7ab('0xff')||this[_0xe7ab('0x14')][util['format'](_0xe7ab('0xfe'),_0x485126[_0xe7ab('0x28')])][_0xe7ab('0x4e')]===_0xe7ab('0x100'));};Preview[_0xe7ab('0x10')][_0xe7ab('0x101')]=function(_0x17dddd,_0x61c912){return this[_0xe7ab('0x102')](_0x17dddd,_0x61c912)[_0xe7ab('0x62')](function(_0x2ec071){return _[_0xe7ab('0x48')](_0x2ec071,[_0xe7ab('0x31')]);})[_0xe7ab('0x65')](function(_0x406974){if(_0x406974[_0xe7ab('0x103')]){rpcDb[_0xe7ab('0x104')](_0x17dddd);}if(_0x406974[_0xe7ab('0xfd')]){rpcDb[_0xe7ab('0x66')](_0x17dddd);}throw _['pick'](_0x406974,['message']);});};Preview['prototype'][_0xe7ab('0x102')]=function(_0x5a15e4,_0x9fe0b){var _0x4bf172=this;var _0x276996,_0x4ff718;return rpcDb[_0xe7ab('0x105')](_0x5a15e4)[_0xe7ab('0x62')](function(_0x395a81){if(!_[_0xe7ab('0x41')](_0x395a81[0x0])){_0x4ff718=_0x395a81[0x0]['recallme']?![]:!![];_0x276996=_0x395a81[0x0][_0xe7ab('0x106')]?!![]:![];_0x276996=_0x9fe0b?!![]:_0x276996;}var _0x232034=_0x4bf172[_0xe7ab('0x107')](_0x395a81);if(_0x232034[_0xe7ab('0x108')]){rpcDb['checkIsBlackList'](_['pick'](_0x395a81[0x0],[_0xe7ab('0x4b'),_0xe7ab('0xf0')]))[_0xe7ab('0x62')](function(_0x2e9210){_0x4bf172[_0xe7ab('0xee')](_0x2e9210,_0x395a81[0x0],_0x9fe0b,_0x4ff718,_0x276996)[_0xe7ab('0x62')](function(_0x3e2316){return _0x3e2316;})[_0xe7ab('0x65')](function(_0x4c197e){throw _0x4c197e;});})[_0xe7ab('0x65')](function(_0x259397){ut['logger'](_0xe7ab('0x109'),_0x259397);throw ut[_0xe7ab('0x31')]('Call\x20unsuccessful',_0x4ff718,_0x276996);});}else{throw ut[_0xe7ab('0x31')](_0x232034['message'],_0x4ff718,_0x276996);}})[_0xe7ab('0x65')](function(_0x26f8aa){ut[_0xe7ab('0x34')](_0xe7ab('0x10a'),_0x26f8aa);throw ut[_0xe7ab('0x31')](_0xe7ab('0x10b'),![],!![]);});};Preview[_0xe7ab('0x10')]['validateContact']=function(_0x5496a3){if(_[_0xe7ab('0x41')](_0x5496a3)||_['isEmpty'](_0x5496a3)||!_[_0xe7ab('0x41')](_0x5496a3[0x0][_0xe7ab('0x60')])&&_[_0xe7ab('0x41')](_0x5496a3[0x0]['Agent'][_0xe7ab('0x28')])){ut['logger']('[Preview][validateContact][Empty\x20Contact]',_0x5496a3);return{'isValid':![],'message':_0xe7ab('0x10c')};}var _0x4fb902=this[_0xe7ab('0x23')][_0x5496a3[0x0][_0xe7ab('0x43')][_0xe7ab('0x28')]];_0x4fb902[_0xe7ab('0x31')]=utils[_0xe7ab('0x32')][_0xe7ab('0x77')];if(_['isNil'](_0x4fb902)){ut['logger'](_0xe7ab('0x10d'),_0x4fb902);return{'isValid':![],'message':_0xe7ab('0x10e')};}if(!this['isTrunkReachable'](_0x4fb902[_0xe7ab('0x10f')])){ut[_0xe7ab('0x34')](_0xe7ab('0x110'),'campaign\x20Name:\x20'+_0x4fb902[_0xe7ab('0x28')]+_0xe7ab('0x111'));if(!this[_0xe7ab('0x76')](_0x4fb902[_0xe7ab('0x112')])){ut[_0xe7ab('0x34')](_0xe7ab('0x110'),_0x4fb902[_0xe7ab('0x28')]+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':_0xe7ab('0x113')};}}if(!ut[_0xe7ab('0x74')](_0x4fb902[_0xe7ab('0x75')])){ut[_0xe7ab('0x34')](_0xe7ab('0x114'),_0x4fb902[_0xe7ab('0x28')]+'\x20Not\x20Active');return{'isValid':![],'message':_0xe7ab('0x115')+_0x4fb902['name']+_0xe7ab('0x116')};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0xe7ab('0x10')]['execCall']=function(_0x561b85,_0x2b28bc,_0x219a51,_0x4e2b6a){var _0x137d83=this;return new Promise(function(_0x9db569,_0x3a822f){var _0x332b33=_0x561b85[_0xe7ab('0x95')];var _0x5ca0f0=_0x137d83[_0xe7ab('0x76')](_0x2b28bc[_0xe7ab('0x10f')])?util['format']('SIP/%s/%s%s',_0x2b28bc[_0xe7ab('0x10f')][_0xe7ab('0x28')],_[_0xe7ab('0x41')](_0x2b28bc[_0xe7ab('0x117')])?'':_0x2b28bc[_0xe7ab('0x117')][_0xe7ab('0x118')]()||'',_0x2b28bc[_0xe7ab('0x119')]>0x0?_0x219a51[_0xe7ab('0xf0')]['substring'](_0x2b28bc['dialCutDigit']):_0x219a51[_0xe7ab('0xf0')]):util[_0xe7ab('0x27')](_0xe7ab('0x11a'),_[_0xe7ab('0x41')](_0x2b28bc[_0xe7ab('0x112')])?_0x2b28bc[_0xe7ab('0x10f')][_0xe7ab('0x28')]:_0x2b28bc[_0xe7ab('0x112')][_0xe7ab('0x28')],_[_0xe7ab('0x41')](_0x2b28bc[_0xe7ab('0x117')])?'':_0x2b28bc[_0xe7ab('0x117')][_0xe7ab('0x118')]()||'',_0x2b28bc[_0xe7ab('0x119')]>0x0?_0x219a51[_0xe7ab('0xf0')][_0xe7ab('0x11b')](_0x2b28bc[_0xe7ab('0x119')]):_0x219a51['phone']);var _0x1a2405=_0x137d83[_0xe7ab('0x76')](_0x2b28bc[_0xe7ab('0x10f')])?ut[_0xe7ab('0x11c')](_0x2b28bc[_0xe7ab('0x10f')][_0xe7ab('0x11d')],_0x2b28bc['dialOriginateCallerIdName'],_0x2b28bc['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0xe7ab('0x11e')](_0x2b28bc['dialOriginateCallerIdNumber'],_0x2b28bc[_0xe7ab('0x11f')]):_0x2b28bc[_0xe7ab('0x120')]):ut['getCallerId'](_[_0xe7ab('0x41')](_0x2b28bc[_0xe7ab('0x112')])?_0x2b28bc[_0xe7ab('0x10f')]['callerid']:_0x2b28bc[_0xe7ab('0x112')][_0xe7ab('0x11d')],_0x2b28bc[_0xe7ab('0x121')],_0x2b28bc['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0xe7ab('0x11e')](_0x2b28bc[_0xe7ab('0x120')],_0x2b28bc[_0xe7ab('0x11f')]):_0x2b28bc[_0xe7ab('0x120')]);if(_0x1a2405){_0x561b85[_0xe7ab('0x122')]=ut[_0xe7ab('0x123')](_0x1a2405);_0x561b85['originatecalleridnum']=ut[_0xe7ab('0x124')](_0x1a2405);}var _0x47a9ce=ut[_0xe7ab('0x125')](_0x2b28bc,_0x219a51,_0x5ca0f0,_0x1a2405,_0x332b33,_0x561b85);var _0x17fc39=utils[_0xe7ab('0x126')](_0x219a51['Contact']);Object[_0xe7ab('0x127')](_0x47a9ce,_0x17fc39);_[_0xe7ab('0x128')](_0x561b85,ut[_0xe7ab('0x129')](_0x47a9ce));_0x561b85[_0xe7ab('0x12a')]=moment()[_0xe7ab('0x27')]('YYYY-MM-DD\x20HH:mm:ss');_0x2b28bc[_0xe7ab('0x12b')]=_0x47a9ce;var _0x4fadb6=ut[_0xe7ab('0x12c')](_0x561b85,_0x2b28bc,_0x47a9ce,_0x561b85[_0xe7ab('0x8c')],_0x4e2b6a);return ami[_0xe7ab('0x4d')](_0x4fadb6)[_0xe7ab('0x62')](function(_0x2e9cbb){_0x2b28bc[_0xe7ab('0x2d')]+=0x1;logger[_0xe7ab('0x24')](_0xe7ab('0x12d'),_0x332b33,_0xe7ab('0xdb'),_0x2b28bc[_0xe7ab('0x28')],_0xe7ab('0x45'),_0x2b28bc[_0xe7ab('0x2d')]);_0x9db569(_0x2e9cbb);})[_0xe7ab('0x65')](function(_0x3fbc59){ut['logAgent'](_0x561b85,0xe,'OriginateError');rpcDb['createAgentHistory'](_0x561b85,_0xe7ab('0x12e'));_0x3a822f(_0x3fbc59);});});};Preview[_0xe7ab('0x10')][_0xe7ab('0x12f')]=function(_0x1502a3){if(this[_0xe7ab('0x47')][_0x1502a3[_0xe7ab('0x8d')]]){this['actions'][_0x1502a3[_0xe7ab('0x8d')]]['channel']=_0x1502a3[_0xe7ab('0x4f')];}};Preview[_0xe7ab('0x10')][_0xe7ab('0x130')]=function(_0x25fa63){var _0xd7ee64=this;var _0x56c3ed=this['actions'][_0x25fa63[_0xe7ab('0x131')]];if(_0x56c3ed){if(_0x56c3ed[_0xe7ab('0xf1')]&&this[_0xe7ab('0x15')][_0x56c3ed[_0xe7ab('0xf1')]]){ut[_0xe7ab('0x132')](_0x56c3ed,this['agents'][_0x56c3ed[_0xe7ab('0xf1')]][_0xe7ab('0x28')],this[_0xe7ab('0x15')][_0x56c3ed[_0xe7ab('0xf1')]]['id']);}var _0x21fe93=_['clone'](_0x56c3ed);_0x21fe93[_0xe7ab('0x93')]=moment()[_0xe7ab('0x27')](_0xe7ab('0x67'));var _0x40bf2c=_0xd7ee64['campaignsPreview'][_0x56c3ed['queue']];if(ut['isFailure'](_0x25fa63[_0xe7ab('0x133')])){if(_0x56c3ed['unlockAgent']){rpcDb[_0xe7ab('0x104')](_0x56c3ed[_0xe7ab('0x90')]);}if(_0x56c3ed[_0xe7ab('0x8c')]){rpcDb[_0xe7ab('0x66')](_0x56c3ed[_0xe7ab('0x90')]);}ami[_0xe7ab('0x2a')]('custom:agentringnoanswer',ut[_0xe7ab('0x7d')](_0x56c3ed,'rejected',this['campaignsPreview'][_0x56c3ed['queue']]));this[_0xe7ab('0x134')](_0x21fe93,_0x40bf2c,_0x25fa63);}else{_0x56c3ed[_0xe7ab('0x12a')]=moment()[_0xe7ab('0x27')]('YYYY-MM-DD\x20HH:mm:ss');ut[_0xe7ab('0xe1')](_0x21fe93,0x4,_0xe7ab('0xa1'));rpcDb['createAgentHistory'](_0x21fe93,'[callProgressDetectingAgent][logAnswer]');}}};Preview['prototype']['syncHangup']=function(_0x398c5f){var _0xae5a5f=this[_0xe7ab('0x47')][_0x398c5f[_0xe7ab('0x8d')]];var _0x21029a;if(_0xae5a5f){_0x21029a=this[_0xe7ab('0x23')][_0xae5a5f[_0xe7ab('0x44')]];logger[_0xe7ab('0x24')](_0xe7ab('0x135'),_0x398c5f[_0xe7ab('0x8d')],_0xe7ab('0xdb'),_0x21029a['name'],'pTalking:\x20',_0x21029a['pTalking']);}if(this[_0xe7ab('0x47')][_0x398c5f[_0xe7ab('0x8d')]]&&_0x398c5f['linkedid']!==_0x398c5f[_0xe7ab('0x95')]){if(_0x398c5f[_0xe7ab('0x136')]==='16'&&this[_0xe7ab('0x47')][_0x398c5f[_0xe7ab('0x8d')]]['dialAnswer']){this[_0xe7ab('0x78')](_0x398c5f,_0x398c5f['linkedid'],_0x398c5f[_0xe7ab('0x136')]);}else if(this[_0xe7ab('0x47')][_0x398c5f[_0xe7ab('0x8d')]]['dialAnswer']){logger[_0xe7ab('0x24')](_0xe7ab('0x137'),_0x398c5f[_0xe7ab('0x8d')],_0x398c5f['cause'],'\x20Queue',_0x21029a['name'],_0xe7ab('0x46'),_0x21029a[_0xe7ab('0x2e')]);this['callProgressDetectingCustomer'](_0x398c5f,_0x398c5f[_0xe7ab('0x8d')],_0x398c5f[_0xe7ab('0x136')]);}}else if(_0xae5a5f&&_[_0xe7ab('0x41')](_0xae5a5f[_0xe7ab('0x138')])&&_0x21029a[_0xe7ab('0x139')]&&_0x398c5f[_0xe7ab('0x8d')]===_0x398c5f['uniqueid']&&_['isNil'](_0x398c5f['reason'])&&_0x398c5f[_0xe7ab('0x136')]==='16'&&_0x398c5f[_0xe7ab('0x13a')]==='6'&&_[_0xe7ab('0xdf')](_0xae5a5f[_0xe7ab('0x13b')])){if(_0xae5a5f['unlockAgent']){rpcDb['unlockContact'](_0xae5a5f[_0xe7ab('0x90')]);}if(_0xae5a5f[_0xe7ab('0x8c')]){rpcDb[_0xe7ab('0x66')](_0xae5a5f[_0xe7ab('0x90')]);}_0x398c5f[_0xe7ab('0xe0')]='22';this[_0xe7ab('0x134')](_0xae5a5f,_0x21029a,_0x398c5f);}else if(_0xae5a5f&&_0xae5a5f['transfer']){if(_0x398c5f[_0xe7ab('0x136')]==='16'&&this['actions'][_0x398c5f[_0xe7ab('0x8d')]][_0xe7ab('0x53')]){logger[_0xe7ab('0x24')](_0xe7ab('0x13c'),_0x398c5f['linkedid'],_0x398c5f[_0xe7ab('0x136')],_0xe7ab('0xdb'),_0x21029a[_0xe7ab('0x28')],_0xe7ab('0x46'),_0x21029a[_0xe7ab('0x2e')]);this[_0xe7ab('0x78')](_0x398c5f,_0x398c5f[_0xe7ab('0x8d')],_0x398c5f[_0xe7ab('0x136')]);}else if(this[_0xe7ab('0x47')][_0x398c5f[_0xe7ab('0x8d')]][_0xe7ab('0x53')]){logger['info'](_0xe7ab('0x137'),_0x398c5f[_0xe7ab('0x8d')],_0x398c5f['cause'],_0xe7ab('0xdb'),_0x21029a[_0xe7ab('0x28')],'pTalking:\x20',_0x21029a[_0xe7ab('0x2e')]);this[_0xe7ab('0x78')](_0x398c5f,_0x398c5f['linkedid'],_0x398c5f[_0xe7ab('0x136')]);}}};Preview[_0xe7ab('0x10')][_0xe7ab('0x1c')]=function(_0x772b99){if(this[_0xe7ab('0x47')][_0x772b99[_0xe7ab('0xdc')]]&&_0x772b99[_0xe7ab('0xdc')]!==_0x772b99['destuniqueid']){this[_0xe7ab('0x78')](_0x772b99,_0x772b99[_0xe7ab('0xdc')],_0x772b99['dialstatus']);}};Preview[_0xe7ab('0x10')][_0xe7ab('0x1b')]=function(_0x59c13a){if(this[_0xe7ab('0x47')][_0x59c13a[_0xe7ab('0x8d')]]&&_0x59c13a['linkedid']!==_0x59c13a[_0xe7ab('0x95')]&&!this[_0xe7ab('0x47')][_0x59c13a[_0xe7ab('0x8d')]][_0xe7ab('0x53')]){if(_0x59c13a['cause']==='1'){this[_0xe7ab('0x78')](_0x59c13a,_0x59c13a[_0xe7ab('0x8d')],_0x59c13a['cause']);}}};Preview[_0xe7ab('0x10')][_0xe7ab('0x13d')]=function(_0x2c4382,_0x3c2120,_0x3b9c88){if(this[_0xe7ab('0x47')][_0x2c4382]){if(_['isNil'](this[_0xe7ab('0x47')][_0x2c4382]['variables'])){this['actions'][_0x2c4382]['variables']={};}this['actions'][_0x2c4382][_0xe7ab('0x12b')][_0x3c2120]=_0x3b9c88;}};Preview[_0xe7ab('0x10')][_0xe7ab('0x1e')]=function(_0x194c5a){try{if(!_[_0xe7ab('0x41')](_0x194c5a)){if(ut[_0xe7ab('0x13e')](_[_0xe7ab('0x13f')](_0x194c5a[_0xe7ab('0x140')])[0x0])){this[_0xe7ab('0x13d')](_0x194c5a[_0xe7ab('0x95')],_['keys'](_0x194c5a[_0xe7ab('0x140')])[0x0],_0x194c5a[_0xe7ab('0x141')]);}}}catch(_0x29b6dc){logger['error'](_0xe7ab('0x142'),util[_0xe7ab('0x143')](_0x29b6dc,{'showHidden':![],'depth':null}));}};Preview[_0xe7ab('0x10')][_0xe7ab('0x20')]=function(_0x1499ae){if(_0x1499ae){if(this[_0xe7ab('0x47')][_0x1499ae[_0xe7ab('0x144')]]){this[_0xe7ab('0x47')][_0x1499ae[_0xe7ab('0x144')]][_0xe7ab('0x13b')]=!![];}}};Preview[_0xe7ab('0x10')]['syncBlindTransfer']=function(_0x11fdb8){if(_0x11fdb8){if(this[_0xe7ab('0x47')][_0x11fdb8[_0xe7ab('0x145')]]){this['actions'][_0x11fdb8[_0xe7ab('0x145')]][_0xe7ab('0x13b')]=!![];}}};module[_0xe7ab('0x146')]=Preview; \ No newline at end of file +var _0xc53e=['unmonitored','unlock','pick','execRun','recallme','isValid','checkIsBlackList','checkInBlack','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','validateContact','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','ACTIVE','[Preview][validateContact][Empty\x20Campaign]','Trunk','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','campaign\x20Name:\x20','execCall','SIP/%s/%s%s','dialPrefix','trim','phone','dialCutDigit','substring','getCallerId','callerid','dialOriginateCallerIdName','getCallerIdRandom','dialOriginateCallerIdNumber','dialRandomLastDigitCallerIdNumber','originatecalleridname','originatecalleridnum','addVariables','Contact','assign','merge','toLowerVariables','variables','OriginateError','channel','syncOriginateResponse','logLookAgent','isFailure','response','unlockContact','rejected','[callProgressDetectingAgent][logAnswer]','callProgressDetectingCustomer','cause','statedesc','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','syncDialEnd','destuniqueid','filterKey','variable','addVariable','value','inspect','syncAttendedTransfer','transfertargetlinkedid','transfererlinkedid','exports','util','uuid','ioredis','../../../config/environment','../../../config/logger','../ami','./rpcDb','../rpc/cmHopperAdditionalPhone','./action','./util/util','redis','defaults','socket.io-emitter','tail','sequence','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncHangup','bind','hanguprequest','syncHangupRequest','dialend','newexten','syncNewExten','varset','syncVarSet','attendedtransfer','syncBlindTransfer','campaignsPreview','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','format','voice:queue:%s','name','emit','voice_queue_presence:remove','sendMessageOneNotActive','originated','pTalking','available','paused','message','CAMPAIGN_STATUS','INACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','DEACTIVATED','\x20is\x20deactivated','prototype','loopCampaigns','syncCampaigns','hasOwnProperty','preview','dialMethod','booked','type','clearZombieChannels','outbound','setMessage','recallMe','enqueue','[clearZombieChannels][talking]','Queue','queue','dialAnswer','UserId','VoiceQueueId','Action','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','clearZombieChannel','getContactRecallMe','agentReadyId','then','isNil','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','run','[RecallMe]','catch','logger2','disableContact','starttime','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','IsNotLoggedIn','loggedIn','NO_AGENTS_LOGGED','isActive','dialActive','isTrunkReachable','UNREACHABLE_TRUNK','outboundNoSuchCallsDay','countglobal','totalGlobal','NoSuchNumber','buildObj','nosuchnumber','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','activeContact','linkedid','countnosuchnumberretry','idContact','incrementPreviewCounters','ANSWER','YYYY-MM-DD\x20HH:mm:ss','responsetime','custom:agentconnect','connect','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','outboundAnswerCallsDay','answered','Answer','[callProgressDetectingCustomer][logAnswerGlobal]','talktime','[syncHangup][talking][decrement]','uniqueid','\x20Queue','pTalking:\x20','outboundBusyCallsDay','countbusyretry','Busy','busy','[callProgressDetectingCustomer][logBusy]','dialBusyMaxRetry','dialBusyRetryFrequency','unlockAgent','swapAdditionalPhones','NOANSWER','outboundNoAnswerCallsDay','countnoanswerretry','NoAnswer','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswer]','dialNoAnswerMaxRetry','CONGESTION','outboundCongestionCallsDay','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','countcongestionretry','CANCEL','countagentrejectretry','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','AgentReject','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','ABANDONED','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','outboundUnknownCallsDay','countmachineretry','cause-txt','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','[callProgressDetectingCustomer][machine]','decrementTalkink','[default]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','originated:\x20','destlinkedid','queueSummaryCountersUpdated','callProgressDetectingAgent','object','isUndefined','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','resolve','[incrementPreviewCounters]\x20','Contact\x20is\x20undefined','lookAgent','isEmpty','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','createHistory','active','SIP/%s','status'];(function(_0x570602,_0x4878b4){var _0x5f4573=function(_0x5a1cf1){while(--_0x5a1cf1){_0x570602['push'](_0x570602['shift']());}};_0x5f4573(++_0x4878b4);}(_0xc53e,0x183));var _0xec53=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xc53e[_0x521929];return _0x632436;};'use strict';var util=require(_0xec53('0x0'));var _=require('lodash');var uuid=require(_0xec53('0x1'));var moment=require('moment');var Redis=require(_0xec53('0x2'));var config=require(_0xec53('0x3'));var logger=require(_0xec53('0x4'))('preview');var loggerAction=require('../../../config/logger')('actionPreview');var ami=require(_0xec53('0x5'));var rpcDb=require(_0xec53('0x6'));var cmHopperAdditionalPhone=require(_0xec53('0x7'));var Action=require(_0xec53('0x8'));var ut=require(_0xec53('0x9'));var utils=require('../dialer/utils');config[_0xec53('0xa')]=_[_0xec53('0xb')](config[_0xec53('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0xec53('0xc'))(new Redis(config[_0xec53('0xa')]));var Sequence=function(){};Sequence['prototype']['enqueue']=function(_0x2388a2){this[_0xec53('0xd')]=this[_0xec53('0xd')]?this[_0xec53('0xd')]['finally'](_0x2388a2):_0x2388a2();};function Preview(_0x2eb1b0){this[_0xec53('0xe')]=new Sequence();this['campaignsPreview']=_0x2eb1b0[_0xec53('0xf')];this[_0xec53('0x10')]=_0x2eb1b0[_0xec53('0x10')];this[_0xec53('0x11')]={};this['agents']=_0x2eb1b0[_0xec53('0x12')];this[_0xec53('0x13')]=0x0;ami['on'](_0xec53('0x14'),this['syncOriginateResponse']['bind'](this));ami['on']('hangup',this[_0xec53('0x15')][_0xec53('0x16')](this));ami['on'](_0xec53('0x17'),this[_0xec53('0x18')][_0xec53('0x16')](this));ami['on'](_0xec53('0x19'),this['syncDialEnd'][_0xec53('0x16')](this));ami['on'](_0xec53('0x1a'),this[_0xec53('0x1b')]['bind'](this));ami['on'](_0xec53('0x1c'),this[_0xec53('0x1d')][_0xec53('0x16')](this));ami['on'](_0xec53('0x1e'),this['syncAttendedTransfer'][_0xec53('0x16')](this));ami['on']('blindtransfer',this[_0xec53('0x1f')]['bind'](this));this['loopCampaigns'](this[_0xec53('0x20')]);}function emit(_0x512c4b,_0x422270,_0x58ad73){io['to'](_0x512c4b)['emit'](_0x422270,_0x58ad73);}function emitVoiceQueueChannelRemove(_0x59c7af){logger[_0xec53('0x21')](_0xec53('0x22'),JSON[_0xec53('0x23')](_0x59c7af));emit(util[_0xec53('0x24')](_0xec53('0x25'),_0x59c7af[_0xec53('0x26')]),'voice_queue_channel:remove',_0x59c7af);io[_0xec53('0x27')](_0xec53('0x28'),_0x59c7af);}function notSendMessagesQueue(_0x3064aa){if(_0x3064aa[_0xec53('0x29')]){if(_0x3064aa[_0xec53('0x2a')]===0x0&&_0x3064aa[_0xec53('0x2b')]===0x0){_0x3064aa[_0xec53('0x29')]=![];_0x3064aa[_0xec53('0x2c')]=0x0;_0x3064aa[_0xec53('0x2d')]=0x0;_0x3064aa[_0xec53('0x2e')]=utils[_0xec53('0x2f')][_0xec53('0x30')];ut[_0xec53('0x31')](_0xec53('0x32'),_0x3064aa[_0xec53('0x26')]+_0xec53('0x33'));}else{_0x3064aa[_0xec53('0x2e')]=utils[_0xec53('0x2f')][_0xec53('0x34')];ut[_0xec53('0x31')](_0xec53('0x32'),_0x3064aa[_0xec53('0x26')]+_0xec53('0x35'));}}}Preview[_0xec53('0x36')][_0xec53('0x37')]=function(){var _0x366d30=this;setInterval(function(){_0x366d30['syncCampaigns']();},0x7cf);};Preview[_0xec53('0x36')][_0xec53('0x38')]=function(){var _0x3ef90a=this[_0xec53('0x20')];this[_0xec53('0x13')]+=0x1;for(var _0x46a682 in _0x3ef90a){if(_0x3ef90a[_0xec53('0x39')](_0x46a682)&&(_0x3ef90a[_0x46a682]['dialMethod']===_0xec53('0x3a')||_0x3ef90a[_0x46a682][_0xec53('0x3b')]===_0xec53('0x3c'))&&_0x3ef90a[_0x46a682][_0xec53('0x3d')]==='outbound'){if(this[_0xec53('0x13')]>0x7){this[_0xec53('0x13')]=0x0;this[_0xec53('0x3e')]();}}if(_0x3ef90a[_0xec53('0x39')](_0x46a682)&&_0x3ef90a[_0x46a682][_0xec53('0x3b')]==='preview'&&_0x3ef90a[_0x46a682][_0xec53('0x3d')]===_0xec53('0x3f')){if(_0x3ef90a[_0x46a682]['dialActive']){this[_0xec53('0x40')](_0x3ef90a[_0x46a682]);if(_0x3ef90a[_0x46a682]['dialPreviewAutoRecallMe'])this[_0xec53('0x41')](_0x3ef90a[_0x46a682]);}else{notSendMessagesQueue(_0x3ef90a[_0x46a682]);}}}};Preview[_0xec53('0x36')]['clearZombieChannel']=function(_0x364aca){var _0x43a9e3=this;this[_0xec53('0xe')][_0xec53('0x42')](function(){if(!_['isNil'](_0x43a9e3[_0xec53('0x11')][_0x364aca])){loggerAction[_0xec53('0x21')](_0xec53('0x43'),_0x364aca,_0xec53('0x44'),_0x43a9e3[_0xec53('0x11')][_0x364aca][_0xec53('0x45')],'originated:\x20',JSON['stringify'](_0x43a9e3[_0xec53('0x20')][_0x43a9e3[_0xec53('0x11')][_0x364aca][_0xec53('0x45')]][_0xec53('0x2a')]),'pTalking:\x20',JSON[_0xec53('0x23')](_0x43a9e3[_0xec53('0x20')][_0x43a9e3[_0xec53('0x11')][_0x364aca][_0xec53('0x45')]][_0xec53('0x2b')]),JSON[_0xec53('0x23')](_0x43a9e3[_0xec53('0x11')][_0x364aca][_0xec53('0x46')]),JSON['stringify'](_['pick'](_0x43a9e3[_0xec53('0x11')][_0x364aca],['contactId',_0xec53('0x47'),_0xec53('0x48'),'ListId'])));return ami[_0xec53('0x49')]({'action':'status','channel':_0x43a9e3[_0xec53('0x11')][_0x364aca]['channel']})['catch'](function(_0x3bb35c){if(_0x3bb35c[_0xec53('0x2e')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x43a9e3['actions'][_0x364aca]){ut['updateOriginated'](_0x43a9e3['campaignsPreview'][_0x43a9e3[_0xec53('0x11')][_0x364aca][_0xec53('0x45')]],'[clearZombieChannel]');if(_0x43a9e3['actions'][_0x364aca][_0xec53('0x46')]===!![]){ut['decrementTalkink'](_0x43a9e3[_0xec53('0x20')][_0x43a9e3[_0xec53('0x11')][_0x364aca][_0xec53('0x45')]],_0xec53('0x4a'));ut[_0xec53('0x4b')](_0xec53('0x4c')+_0x364aca,_0x43a9e3[_0xec53('0x11')][_0x364aca][_0xec53('0x45')]);}ut[_0xec53('0x4b')](_0xec53('0x4d')+_0x364aca,_0x43a9e3[_0xec53('0x11')][_0x364aca]['queue']);delete _0x43a9e3['actions'][_0x364aca];}},0x2328);}});}});};Preview[_0xec53('0x36')][_0xec53('0x3e')]=function(){var _0xd192df=this;loggerAction[_0xec53('0x21')](_0xec53('0x4e'),_['size'](this[_0xec53('0x11')]));for(var _0x1fb939 in this[_0xec53('0x11')]){if(_0xd192df[_0xec53('0x11')][_0xec53('0x39')](_0x1fb939)){_0xd192df[_0xec53('0x4f')](_0x1fb939);}}};Preview['prototype']['recallMe']=function(_0x127675){var _0x5bf7d1=this;rpcDb[_0xec53('0x50')](_0x127675['id'],ut[_0xec53('0x51')](this[_0xec53('0x12')]))[_0xec53('0x52')](function(_0x396587){if(!_[_0xec53('0x53')](_0x396587)){for(var _0x2af028=0x0;_0x2af028<_0x396587[_0xec53('0x54')];_0x2af028+=0x1){if(ut[_0xec53('0x55')](_0x396587[_0x2af028][_0xec53('0x56')])<_0x127675[_0xec53('0x57')]*0x3c){if(_0x396587[_0x2af028][_0xec53('0x58')]&&!_0x396587[_0x2af028][_0xec53('0x58')]['voicePause']){_0x5bf7d1[_0xec53('0x59')](_0x396587[_0x2af028]['id'])[_0xec53('0x52')](ut['logger2'](_0xec53('0x5a')))[_0xec53('0x5b')](ut[_0xec53('0x5c')](_0xec53('0x5a')));}else{rpcDb[_0xec53('0x5d')](_0x396587[_0x2af028]['id']);}}else{var _0x1b1dfb=new Action(_0x396587[_0x2af028],_0x127675);_0x1b1dfb[_0xec53('0x5e')]=moment()[_0xec53('0x24')]('YYYY-MM-DD\x20HH:mm:ss');_0x127675[_0xec53('0x5f')]+=0x1;ut[_0xec53('0x60')](_0x1b1dfb,0x17,_0xec53('0x61'));if(_0x127675[_0xec53('0x62')]){rpcDb[_0xec53('0x63')](ut['createBody'](_0x396587[_0x2af028]));rpcDb[_0xec53('0x64')](_0x1b1dfb,_0xec53('0x65'));}else{ut[_0xec53('0x60')](_0x1b1dfb,0x16,_0xec53('0x66'));rpcDb[_0xec53('0x64')](_0x1b1dfb,_0xec53('0x67'));rpcDb[_0xec53('0x68')](_0x1b1dfb,'[HistoryRecallClose]');}}}}})[_0xec53('0x5b')](ut[_0xec53('0x5c')]('[getContactRecallMe]'));};Preview[_0xec53('0x36')][_0xec53('0x40')]=function(_0x22404a){_0x22404a[_0xec53('0x29')]=!![];if(ut[_0xec53('0x69')](_0x22404a[_0xec53('0x6a')])){_0x22404a[_0xec53('0x2e')]=utils[_0xec53('0x2f')][_0xec53('0x6b')];}else if(!ut[_0xec53('0x6c')](_0x22404a[_0xec53('0x6d')])){_0x22404a[_0xec53('0x2e')]=utils[_0xec53('0x2f')]['INACTIVE'];}else if(!this[_0xec53('0x6e')](_0x22404a['Trunk'])){if(!this[_0xec53('0x6e')](_0x22404a['TrunkBackup'])){_0x22404a[_0xec53('0x2e')]=utils[_0xec53('0x2f')][_0xec53('0x6f')];}else{_0x22404a[_0xec53('0x2e')]=utils[_0xec53('0x2f')]['ACTIVE'];}}else{_0x22404a[_0xec53('0x2e')]=utils[_0xec53('0x2f')]['ACTIVE'];}};Preview['prototype']['callProgressDetectingCustomer']=function(_0x115798,_0x212e72,_0x134053){var _0x291ab0=this;var _0x12f8ef=this[_0xec53('0x11')][_0x212e72];var _0x5432e1=this[_0xec53('0x20')][_0x12f8ef[_0xec53('0x45')]];var _0x1adf89;var _0x21c93f=![];var _0x135225=0x2;var _0x3440a5=0x3;if(_0x5432e1){switch(_0x134053){case'1':_0x5432e1[_0xec53('0x70')]+=0x1;_0x12f8ef['countnosuchnumberretry']+=0x1;_0x12f8ef[_0xec53('0x71')]=ut[_0xec53('0x72')](_0x12f8ef);ut[_0xec53('0x60')](_0x12f8ef,0x0,_0xec53('0x73'));ami[_0xec53('0x27')]('custom:agentnosuchnumber',ut[_0xec53('0x74')](_0x12f8ef,_0xec53('0x75')));rpcDb['createCustomerHistory'](_0x12f8ef,'[callProgressDetectingCustomer][logNoSuch]');_0x291ab0[_0xec53('0x76')](_0x12f8ef,'0',_0x5432e1)[_0xec53('0x52')](function(_0x1c8e52){_0x21c93f=_0x1c8e52[_0xec53('0x77')]==0x1;_0x135225=_0x5432e1[_0xec53('0x78')];_0x3440a5=_0x5432e1[_0xec53('0x79')];if(!_0x21c93f){if(ut['totalGlobal'](_0x12f8ef)>=_0x5432e1[_0xec53('0x7a')]){_0x1adf89=ut[_0xec53('0x7b')](_0x12f8ef,0xf,_0xec53('0x7c'));rpcDb[_0xec53('0x68')](_0x1adf89,_0xec53('0x7d'));}else{if(_0x12f8ef['countnosuchnumberretry']>=_0x5432e1[_0xec53('0x7e')]){rpcDb[_0xec53('0x68')](_0x12f8ef,_0xec53('0x7d'));}else{rpcDb[_0xec53('0x7f')](ut[_0xec53('0x80')](_0x12f8ef,'countnosuchnumberretry',_0x5432e1[_0xec53('0x78')]),_0x12f8ef['unlockAgent'],_0x12f8ef[_0xec53('0x81')]);}}delete this[_0xec53('0x11')][_0x115798[_0xec53('0x82')]];}else{_0x12f8ef['countnosuchnumberretry']++;logger[_0xec53('0x21')]('actioncountonusuch',_0x12f8ef[_0xec53('0x83')]);logger['info']('id',_0x12f8ef[_0xec53('0x84')]);_0x291ab0[_0xec53('0x85')]({'id':_0x12f8ef[_0xec53('0x84')],'field':{'countnosuchnumberretry':_0x12f8ef['countnosuchnumberretry']}})[_0xec53('0x52')](function(){_0x291ab0['swapAdditionalPhones'](_0x12f8ef,_0x135225,_0x3440a5)[_0xec53('0x52')](function(){});});}});break;case _0xec53('0x86'):var _0x155f1f=moment()[_0xec53('0x24')](_0xec53('0x87'));_0x12f8ef[_0xec53('0x88')]=_0x155f1f;_0x12f8ef['answertime']=_0x155f1f;_0x12f8ef['dialAnswer']=!![];_0x5432e1[_0xec53('0x2b')]+=0x1;logger[_0xec53('0x21')]('[syncHangup][talking][increment]',_0x12f8ef['uniqueid'],'\x20Queue',_0x5432e1['name'],'pTalking:\x20',_0x5432e1[_0xec53('0x2b')]);ami[_0xec53('0x27')](_0xec53('0x89'),ut[_0xec53('0x74')](_0x12f8ef,_0xec53('0x8a'),this[_0xec53('0x20')][_0x12f8ef[_0xec53('0x45')]]));if(_0x5432e1['acw']){ami[_0xec53('0x27')](_0xec53('0x8b'),ut[_0xec53('0x8c')](_0x12f8ef));}break;case'16':ami['emit'](_0xec53('0x8d'),ut[_0xec53('0x74')](_0x12f8ef,_0xec53('0x8e'),this[_0xec53('0x20')][_0x12f8ef[_0xec53('0x45')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x12f8ef,_0xec53('0x8e')));_0x5432e1[_0xec53('0x8f')]+=0x1;_0x5432e1['total']+=0x1;_0x5432e1[_0xec53('0x90')]+=0x1;ut['decrementTalkink'](_0x5432e1,'[16]');_0x12f8ef['countglobal']=ut[_0xec53('0x72')](_0x12f8ef);ut['logCustomer'](_0x12f8ef,0x4,_0xec53('0x91'));rpcDb[_0xec53('0x64')](_0x12f8ef,'[callProgressDetectingCustomer][logAnswer]');rpcDb[_0xec53('0x68')](_0x12f8ef,_0xec53('0x92'));rpcDb['crateCustomerReportQueue'](_0x12f8ef);_0x5432e1['sumDuration']+=_0x12f8ef[_0xec53('0x93')];_0x5432e1['sumBillable']+=_0x12f8ef[_0xec53('0x93')];logger[_0xec53('0x21')](_0xec53('0x94'),_0x12f8ef[_0xec53('0x95')],_0xec53('0x96'),_0x5432e1[_0xec53('0x26')],_0xec53('0x97'),_0x5432e1[_0xec53('0x2b')]);delete this[_0xec53('0x11')][_0x115798[_0xec53('0x82')]];break;case'BUSY':_0x5432e1[_0xec53('0x98')]+=0x1;_0x12f8ef[_0xec53('0x99')]+=0x1;_0x12f8ef[_0xec53('0x71')]=ut[_0xec53('0x72')](_0x12f8ef);ut[_0xec53('0x60')](_0x12f8ef,0x5,_0xec53('0x9a'));_0x135225=_0x5432e1['dialBusyRetryFrequency'];_0x3440a5=_0x5432e1[_0xec53('0x79')];ami[_0xec53('0x27')]('custom:agentbusy',ut[_0xec53('0x74')](_0x12f8ef,_0xec53('0x9b')));rpcDb[_0xec53('0x64')](_0x12f8ef,_0xec53('0x9c'));_0x291ab0['verifyAdditionalPhones'](_0x12f8ef,'5',_0x5432e1)[_0xec53('0x52')](function(_0x50efa9){_0x21c93f=_0x50efa9[_0xec53('0x77')]==0x1;if(!_0x21c93f){if(ut[_0xec53('0x72')](_0x12f8ef)>=_0x5432e1[_0xec53('0x7a')]){_0x1adf89=ut['cloneAction'](_0x12f8ef,0xf,_0xec53('0x7c'));rpcDb[_0xec53('0x68')](_0x1adf89,'[callProgressDetectingCustomer][logBusyGlobal]');}else{if(_0x12f8ef[_0xec53('0x99')]>=_0x5432e1[_0xec53('0x9d')]){rpcDb[_0xec53('0x68')](_0x12f8ef,_0xec53('0x9c'));}else{rpcDb[_0xec53('0x7f')](ut[_0xec53('0x80')](_0x12f8ef,_0xec53('0x99'),_0x5432e1[_0xec53('0x9e')]),_0x12f8ef[_0xec53('0x9f')],_0x12f8ef['activeContact']);}}}else{_0x12f8ef[_0xec53('0x99')]++;_0x291ab0[_0xec53('0x85')]({'id':_0x12f8ef[_0xec53('0x84')],'field':{'countbusyretry':_0x12f8ef[_0xec53('0x99')]}})[_0xec53('0x52')](function(){_0x291ab0[_0xec53('0xa0')](_0x12f8ef,_0x135225,_0x3440a5)[_0xec53('0x52')](function(){});});}});break;case _0xec53('0xa1'):_0x5432e1[_0xec53('0xa2')]+=0x1;_0x12f8ef[_0xec53('0xa3')]+=0x1;_0x12f8ef[_0xec53('0x71')]=ut[_0xec53('0x72')](_0x12f8ef);ut[_0xec53('0x60')](_0x12f8ef,0x3,_0xec53('0xa4'));_0x135225=_0x5432e1[_0xec53('0xa5')];_0x3440a5=_0x5432e1[_0xec53('0x79')];var _0x8e0d30=ut[_0xec53('0xa6')](_0x12f8ef,_0x5432e1);ami[_0xec53('0x27')](_0xec53('0xa7'),_0x8e0d30);rpcDb[_0xec53('0x64')](_0x12f8ef,_0xec53('0xa8'));_0x291ab0[_0xec53('0x76')](_0x12f8ef,'3',_0x5432e1)['then'](function(_0x486f42){_0x21c93f=_0x486f42['additional']==0x1;if(!_0x21c93f){if(ut[_0xec53('0x72')](_0x12f8ef)>=_0x5432e1[_0xec53('0x7a')]){_0x1adf89=ut[_0xec53('0x7b')](_0x12f8ef,0xf,_0xec53('0x7c'));rpcDb['createCustomerFinal'](_0x1adf89,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x12f8ef['countnoanswerretry']>=_0x5432e1[_0xec53('0xa9')]){rpcDb[_0xec53('0x68')](_0x12f8ef,'[callProgressDetectingCustomer][logNoAnswer]');}else{rpcDb[_0xec53('0x7f')](ut[_0xec53('0x80')](_0x12f8ef,_0xec53('0xa3'),_0x5432e1[_0xec53('0xa5')]),_0x12f8ef['unlockAgent'],_0x12f8ef[_0xec53('0x81')]);}}}else{_0x12f8ef['countnoanswerretry']++;_0x291ab0[_0xec53('0x85')]({'id':_0x12f8ef['idContact'],'field':{'countnoanswerretry':_0x12f8ef[_0xec53('0xa3')]}})['then'](function(){_0x291ab0[_0xec53('0xa0')](_0x12f8ef,_0x135225,_0x3440a5)[_0xec53('0x52')](function(){});});}});break;case _0xec53('0xaa'):_0x5432e1[_0xec53('0xab')]+=0x1;_0x12f8ef['countcongestionretry']+=0x1;_0x12f8ef[_0xec53('0x71')]=ut[_0xec53('0x72')](_0x12f8ef);ut['logCustomer'](_0x12f8ef,0x8,_0xec53('0xac'));_0x135225=_0x5432e1[_0xec53('0xad')];_0x3440a5=_0x5432e1[_0xec53('0x79')];ami[_0xec53('0x27')](_0xec53('0xae'),ut[_0xec53('0x74')](_0x12f8ef,_0xec53('0xaf')));rpcDb['createCustomerHistory'](_0x12f8ef,_0xec53('0xb0'));_0x291ab0['verifyAdditionalPhones'](_0x12f8ef,'8',_0x5432e1)[_0xec53('0x52')](function(_0x3c2311){_0x21c93f=_0x3c2311['additional']==0x1;if(!_0x21c93f){if(ut[_0xec53('0x72')](_0x12f8ef)>=_0x5432e1['dialGlobalMaxRetry']){_0x1adf89=ut['cloneAction'](_0x12f8ef,0xf,_0xec53('0x7c'));rpcDb[_0xec53('0x68')](_0x1adf89,_0xec53('0xb1'));}else{if(_0x12f8ef[_0xec53('0xb2')]>=_0x5432e1['dialCongestionMaxRetry']){rpcDb[_0xec53('0x68')](_0x12f8ef,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb[_0xec53('0x7f')](ut[_0xec53('0x80')](_0x12f8ef,'countcongestionretry',_0x5432e1[_0xec53('0x9e')]),_0x12f8ef[_0xec53('0x9f')],_0x12f8ef[_0xec53('0x81')]);}}}else{_0x12f8ef['countcongestionretry']++;_0x291ab0[_0xec53('0x85')]({'id':_0x12f8ef[_0xec53('0x84')],'field':{'countcongestionretry':_0x12f8ef['countcongestionretry']}})['then'](function(){_0x291ab0[_0xec53('0xa0')](_0x12f8ef,_0x135225,_0x3440a5)[_0xec53('0x52')](function(){});});}});break;case _0xec53('0xb3'):_0x5432e1['outboundRejectCallsDay']+=0x1;_0x12f8ef[_0xec53('0xb4')]+=0x1;_0x12f8ef[_0xec53('0x71')]=ut[_0xec53('0x72')](_0x12f8ef);ut[_0xec53('0x60')](_0x12f8ef,0x14,'AgentReject');_0x135225=_0x5432e1[_0xec53('0xb5')];_0x3440a5=_0x5432e1['callAdditionalPhoneAfterMin'];ami[_0xec53('0x27')](_0xec53('0xb6'),ut['buildObj'](_0x12f8ef,_0xec53('0xb7')));rpcDb[_0xec53('0x64')](_0x12f8ef,_0xec53('0xb8'));_0x291ab0[_0xec53('0x76')](_0x12f8ef,'20',_0x5432e1)[_0xec53('0x52')](function(_0x5f29c1){_0x21c93f=_0x5f29c1[_0xec53('0x77')]==0x1;if(!_0x21c93f){if(ut['totalGlobal'](_0x12f8ef)>=_0x5432e1['dialGlobalMaxRetry']){_0x1adf89=ut[_0xec53('0x7b')](_0x12f8ef,0x14,_0xec53('0xb9'));rpcDb[_0xec53('0x68')](_0x1adf89,_0xec53('0xba'));}else{if(_0x12f8ef[_0xec53('0xb4')]>=_0x5432e1[_0xec53('0xbb')]){rpcDb['createCustomerFinal'](_0x12f8ef,_0xec53('0xba'));}else{rpcDb[_0xec53('0x7f')](ut[_0xec53('0x80')](_0x12f8ef,_0xec53('0xb4'),_0x5432e1[_0xec53('0xb5')]),_0x12f8ef[_0xec53('0x9f')],_0x12f8ef[_0xec53('0x81')]);}}}else{_0x12f8ef[_0xec53('0xa3')]++;_0x291ab0['incrementPreviewCounters']({'id':_0x12f8ef[_0xec53('0x84')],'field':{'countnoanswerretry':_0x12f8ef['countnoanswerretry']}})[_0xec53('0x52')](function(){_0x291ab0['swapAdditionalPhones'](_0x12f8ef,_0x135225,_0x3440a5)[_0xec53('0x52')](function(){});});}});break;case _0xec53('0xbc'):_0x5432e1['outboundAbandonedCallsDay']+=0x1;_0x12f8ef[_0xec53('0xbd')]+=0x1;_0x12f8ef['countglobal']=ut['totalGlobal'](_0x12f8ef);ut[_0xec53('0x60')](_0x12f8ef,0xb,_0xec53('0xbe'));rpcDb['createCustomerHistory'](_0x12f8ef,_0xec53('0xbf'));_0x291ab0[_0xec53('0x76')](_0x12f8ef,'11',_0x5432e1)[_0xec53('0x52')](function(_0x1a774e){_0x21c93f=_0x1a774e[_0xec53('0x77')]==0x1;if(!_0x21c93f){if(ut[_0xec53('0x72')](_0x12f8ef)>=_0x5432e1[_0xec53('0x7a')]){_0x1adf89=ut[_0xec53('0x7b')](_0x12f8ef,0xf,'Global');rpcDb[_0xec53('0x68')](_0x1adf89,_0xec53('0xbf'));}else{if(_0x12f8ef[_0xec53('0xc0')]>=_0x5432e1[_0xec53('0xc1')]){rpcDb['createCustomerFinal'](_0x12f8ef,'[callProgressDetectingCustomer][logAbandoned]');}else{rpcDb[_0xec53('0x7f')](ut[_0xec53('0x80')](_0x12f8ef,_0xec53('0xbd'),_0x5432e1[_0xec53('0xc2')]),_0x12f8ef[_0xec53('0x9f')],_0x12f8ef[_0xec53('0x81')]);}}}else{_0x12f8ef[_0xec53('0xa3')]++;_0x291ab0[_0xec53('0x85')]({'id':_0x12f8ef[_0xec53('0x84')],'field':{'countnoanswerretry':_0x12f8ef[_0xec53('0xa3')]}})[_0xec53('0x52')](function(){_0x291ab0[_0xec53('0xa0')](_0x12f8ef,_0x135225,_0x3440a5)[_0xec53('0x52')](function(){});});}});break;case'18':_0x5432e1[_0xec53('0xc3')]+=0x1;_0x12f8ef[_0xec53('0xc4')]+=0x1;_0x12f8ef[_0xec53('0x71')]=ut[_0xec53('0x72')](_0x12f8ef);ut[_0xec53('0x60')](_0x12f8ef,0x12,_0x115798[_0xec53('0xc5')]||_0x115798[_0xec53('0xc6')]);ami[_0xec53('0x27')](_0xec53('0xc7'),ut['buildObj'](_0x12f8ef,_0xec53('0xc8')));rpcDb[_0xec53('0x64')](_0x12f8ef,_0xec53('0xc9'));_0x291ab0[_0xec53('0x76')](_0x12f8ef,'18',_0x5432e1)[_0xec53('0x52')](function(_0x1084cd){_0x21c93f=_0x1084cd[_0xec53('0x77')]==0x1;if(!_0x21c93f){if(ut[_0xec53('0x72')](_0x12f8ef)>=_0x5432e1[_0xec53('0x7a')]){_0x1adf89=ut[_0xec53('0x7b')](_0x12f8ef,0x12,_0xec53('0x7c'));rpcDb['createCustomerFinal'](_0x1adf89,_0xec53('0xc9'));}else{rpcDb[_0xec53('0x68')](_0x12f8ef,'[callProgressDetectingCustomer][hangupInAMD]');}}else{_0x12f8ef['countnoanswerretry']++;_0x291ab0[_0xec53('0x85')]({'id':_0x12f8ef['idContact'],'field':{'countnoanswerretry':_0x12f8ef[_0xec53('0xa3')]}})[_0xec53('0x52')](function(){_0x291ab0['swapAdditionalPhones'](_0x12f8ef,_0x135225,_0x3440a5)['then'](function(){});});}});delete this[_0xec53('0x11')][_0x115798[_0xec53('0x82')]];break;case'19':_0x5432e1[_0xec53('0xc3')]+=0x1;_0x12f8ef[_0xec53('0x71')]=ut[_0xec53('0x72')](_0x12f8ef);ut[_0xec53('0x60')](_0x12f8ef,0x13,_0x115798[_0xec53('0xc5')]||_0x115798[_0xec53('0xc6')]);ami[_0xec53('0x27')](_0xec53('0xc7'),ut[_0xec53('0x74')](_0x12f8ef,_0xec53('0xc8')));rpcDb['createCustomerHistory'](_0x12f8ef,_0xec53('0xca'));_0x291ab0['verifyAdditionalPhones'](_0x12f8ef,'18',_0x5432e1)['then'](function(_0x254935){_0x21c93f=_0x254935['additional']==0x1;if(!_0x21c93f){if(ut[_0xec53('0x72')](_0x12f8ef)>=_0x5432e1[_0xec53('0x7a')]){_0x1adf89=ut['cloneAction'](_0x12f8ef,0xf,_0xec53('0x7c'));rpcDb[_0xec53('0x68')](_0x1adf89,_0xec53('0xca'));}else{rpcDb['createCustomerFinal'](_0x12f8ef,'[callProgressDetectingCustomer][machine]');}}else{_0x12f8ef[_0xec53('0xa3')]++;_0x291ab0[_0xec53('0x85')]({'id':_0x12f8ef['idContact'],'field':{'countnoanswerretry':_0x12f8ef[_0xec53('0xa3')]}})[_0xec53('0x52')](function(){_0x291ab0[_0xec53('0xa0')](_0x12f8ef,_0x135225,_0x3440a5)[_0xec53('0x52')](function(){});});}});delete this[_0xec53('0x11')][_0x115798[_0xec53('0x82')]];break;default:if(_0x12f8ef['dialAnswer']){ut[_0xec53('0xcb')](_0x5432e1,_0xec53('0xcc'));ut['loggerError']('[Dialer][decrementTalkink][no\x20Hangup][Preview]'+_0x5432e1[_0xec53('0x26')],_0x115798);}_0x5432e1[_0xec53('0xc3')]+=0x1;_0x12f8ef['countglobal']=ut[_0xec53('0x72')](_0x12f8ef);ut[_0xec53('0x60')](_0x12f8ef,0xc,_0x115798['cause-txt']||_0x115798[_0xec53('0xc6')]);_0x135225=_0x5432e1[_0xec53('0xb5')];_0x3440a5=_0x5432e1['callAdditionalPhoneAfterMin'];rpcDb['createCustomerHistory'](_0x12f8ef,'[callProgressDetectingCustomer][logUnknown]');_0x291ab0['verifyAdditionalPhones'](_0x12f8ef,'20',_0x5432e1)[_0xec53('0x52')](function(_0x2f3613){_0x21c93f=_0x2f3613['additional']==0x1;if(!_0x21c93f){if(ut[_0xec53('0x72')](_0x12f8ef)>=_0x5432e1[_0xec53('0x7a')]){_0x1adf89=ut[_0xec53('0x7b')](_0x12f8ef,0xf,_0xec53('0x7c'));rpcDb[_0xec53('0x68')](_0x1adf89,_0xec53('0xcd'));}else{rpcDb[_0xec53('0x68')](_0x12f8ef,_0xec53('0xcd'));}delete this['actions'][_0x115798['linkedid']];}else{_0x291ab0[_0xec53('0xa0')](_0x12f8ef,_0x135225,_0x3440a5)[_0xec53('0x52')](function(){});}});}if(!(_0x12f8ef[_0xec53('0x46')]&&_0x134053==='16')){ut[_0xec53('0xce')](_0x5432e1,'[callProgressDetectingCustomer]');logger[_0xec53('0x21')]('[originated][decrement][callProgressDetectingCustomer]',_0x12f8ef['uniqueid'],_0xec53('0x96'),_0x5432e1[_0xec53('0x26')],_0xec53('0xcf'),_0x5432e1['originated']);}if(_0x134053!==_0xec53('0x86')){delete this['actions'][_0x115798[_0xec53('0x82')]];delete this[_0xec53('0x11')][_0x115798[_0xec53('0xd0')]];}_0x5432e1[_0xec53('0xd1')]=!![];}};Preview['prototype'][_0xec53('0xd2')]=function(_0x17b482,_0x497f94,_0xd3cbb){if(_['isUndefined'](_0x497f94)&&_0xec53('0xd3')!==typeof _0x497f94){return;}if(_[_0xec53('0xd4')](_0xd3cbb)&&'object'!==typeof _0xd3cbb){return;}switch(_0xd3cbb[_0xec53('0xd5')]){case'0':ut[_0xec53('0xd6')](_0x17b482,0x0,'NoSuchNumber');rpcDb[_0xec53('0xd7')](_0x17b482,_0xec53('0xd8'));break;case'3':ut['logAgent'](_0x17b482,0x3,'NoAnswer');rpcDb['createAgentHistory'](_0x17b482,'[callProgressDetectingAgent][logNoAnswer]');break;case'5':ut[_0xec53('0xd6')](_0x17b482,0x5,_0xec53('0x9a'));rpcDb[_0xec53('0xd7')](_0x17b482,_0xec53('0xd9'));break;case'8':ut['logAgent'](_0x17b482,0x8,_0xec53('0xac'));rpcDb['createAgentHistory'](_0x17b482,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut[_0xec53('0xd6')](_0x17b482,0x16,'AnswerAGI');rpcDb[_0xec53('0xd7')](_0x17b482,_0xec53('0xda'));break;default:ut['logAgent'](_0x17b482,0xc,_0xd3cbb[_0xec53('0xd5')]);rpcDb['createAgentHistory'](_0x17b482,_0xec53('0xdb'));}ut['updateOriginated'](_0x497f94,_0xec53('0xdc'));logger['info'](_0xec53('0xdd'),_0x17b482[_0xec53('0x95')],_0xec53('0x96'),_0x497f94[_0xec53('0x26')],_0xec53('0xcf'),_0x497f94['originated']);delete this['actions'][_0x17b482['uniqueid']];};Preview[_0xec53('0x36')][_0xec53('0x76')]=function(_0x2f425c,_0xd68563,_0x562caa){return cmHopperAdditionalPhone[_0xec53('0x76')](_0x2f425c,_0xd68563,_0x562caa)[_0xec53('0x5b')](logger[_0xec53('0x21')](_0xec53('0xde')));};Preview[_0xec53('0x36')]['swapAdditionalPhones']=function(_0x23378b,_0xaacf10,_0x1cece6){return cmHopperAdditionalPhone[_0xec53('0xa0')](_0x23378b,_0xaacf10,_0x1cece6)[_0xec53('0x5b')](logger[_0xec53('0x21')](_0xec53('0xdf')));};Preview['prototype'][_0xec53('0x85')]=function(_0x3b51eb){return Promise[_0xec53('0xe0')]()[_0xec53('0x52')](cmHopperAdditionalPhone[_0xec53('0x85')](_0x3b51eb))[_0xec53('0x5b')](logger[_0xec53('0x21')](_0xec53('0xe1')));};Preview['prototype']['checkInBlack']=function(_0x570326,_0x1bfe3f,_0x1516e3,_0x44d677,_0x3d0fe){var _0x5a6340=this;return new Promise(function(_0x137914,_0x3b9226){if(_[_0xec53('0x53')](_0x1bfe3f)||_[_0xec53('0x53')](_0x1bfe3f['Contact'])||_[_0xec53('0x53')](_0x1bfe3f['phone'])||_['isNil'](_0x1bfe3f['VoiceQueueId'])){_0x3b9226(ut[_0xec53('0x2e')](_0xec53('0xe2'),_0x44d677,_0x3d0fe));return;}var _0x4295c9=uuid['v4']();var _0x32ef05=_0x5a6340[_0xec53('0x20')][_0x1bfe3f[_0xec53('0x44')][_0xec53('0x26')]];var _0x392968=_0x1516e3?_0x5a6340['agents'][_0x1516e3]['id']:undefined;_0x5a6340[_0xec53('0x11')][_0x4295c9]=new Action(_0x1bfe3f,_0x32ef05,_0x4295c9,_0x1516e3,_0x392968);var _0x163b96=_0x5a6340['actions'][_0x4295c9];_0x163b96[_0xec53('0x9f')]=_0x44d677;_0x163b96[_0xec53('0x81')]=_0x3d0fe;_0x163b96[_0xec53('0xe3')]=_0x1516e3;if(_[_0xec53('0xe4')](_0x570326)){_0x5a6340['execCall'](_0x163b96,_0x32ef05,_0x1bfe3f,_0x1516e3)[_0xec53('0x52')](function(_0x9fcc1c){logger['info'](_0xec53('0xe5'),_0xec53('0xe6')+_0x163b96['queue']+_0xec53('0xe7')+_0x163b96['idContact'],JSON[_0xec53('0x23')](_0x9fcc1c));ami['emit'](_0xec53('0xe8'),ut[_0xec53('0x74')](_0x163b96,_0xec53('0xe9'),_0x5a6340[_0xec53('0x20')][_0x163b96[_0xec53('0x45')]]));_0x137914(ut[_0xec53('0x2e')](_0xec53('0xea')));})[_0xec53('0x5b')](function(_0xb3591){ut[_0xec53('0x31')](_0xec53('0xeb'),_0xb3591);_0x3b9226(ut[_0xec53('0x2e')](_0xec53('0xec'),_0x44d677,_0x3d0fe));});}else{_0x32ef05['outboundBlacklistCallsDay']+=0x1;ut['logBlacklist'](_0x163b96);rpcDb[_0xec53('0xed')](_0x163b96,'[Blacklist][error]');delete _0x5a6340[_0xec53('0x11')][_0x4295c9];_0x3b9226(ut[_0xec53('0x2e')]('Contact\x20in\x20black\x20List',_0x44d677,_0x3d0fe));}});};Preview[_0xec53('0x36')][_0xec53('0x6e')]=function(_0x215c7b){return!_[_0xec53('0x53')](_0x215c7b)&&!_[_0xec53('0x53')](_0x215c7b[_0xec53('0x26')])&&!_['isNil'](_0x215c7b[_0xec53('0xee')])&&_0x215c7b['active']&&!_['isNil'](this['trunks'][util['format'](_0xec53('0xef'),_0x215c7b[_0xec53('0x26')])])&&!_[_0xec53('0x53')](this[_0xec53('0x10')][util[_0xec53('0x24')]('SIP/%s',_0x215c7b[_0xec53('0x26')])]['status'])&&(this[_0xec53('0x10')][util['format'](_0xec53('0xef'),_0x215c7b['name'])]['status']==='reachable'||this[_0xec53('0x10')][util[_0xec53('0x24')](_0xec53('0xef'),_0x215c7b[_0xec53('0x26')])][_0xec53('0xf0')]===_0xec53('0xf1'));};Preview[_0xec53('0x36')][_0xec53('0x59')]=function(_0x5b5fe3,_0x327d4a){return this['execRun'](_0x5b5fe3,_0x327d4a)[_0xec53('0x52')](function(_0x3ee66a){return _['pick'](_0x3ee66a,[_0xec53('0x2e')]);})[_0xec53('0x5b')](function(_0x2a4a23){if(_0x2a4a23[_0xec53('0xf2')]){rpcDb['unlockContact'](_0x5b5fe3);}if(_0x2a4a23[_0xec53('0xee')]){rpcDb[_0xec53('0x5d')](_0x5b5fe3);}throw _[_0xec53('0xf3')](_0x2a4a23,[_0xec53('0x2e')]);});};Preview[_0xec53('0x36')][_0xec53('0xf4')]=function(_0x31cfb8,_0x366965){var _0x11fa68=this;var _0x5e53a7,_0x1e1a17;return rpcDb['getContactPreview'](_0x31cfb8)[_0xec53('0x52')](function(_0x2d37a3){if(!_[_0xec53('0x53')](_0x2d37a3[0x0])){_0x1e1a17=_0x2d37a3[0x0]['recallme']?![]:!![];_0x5e53a7=_0x2d37a3[0x0][_0xec53('0xf5')]?!![]:![];_0x5e53a7=_0x366965?!![]:_0x5e53a7;}var _0x45099f=_0x11fa68['validateContact'](_0x2d37a3);if(_0x45099f[_0xec53('0xf6')]){rpcDb[_0xec53('0xf7')](_[_0xec53('0xf3')](_0x2d37a3[0x0],[_0xec53('0x48'),'phone']))[_0xec53('0x52')](function(_0x79151){_0x11fa68[_0xec53('0xf8')](_0x79151,_0x2d37a3[0x0],_0x366965,_0x1e1a17,_0x5e53a7)[_0xec53('0x52')](function(_0xbc0f25){return _0xbc0f25;})[_0xec53('0x5b')](function(_0x449489){throw _0x449489;});})[_0xec53('0x5b')](function(_0x4df892){ut[_0xec53('0x31')](_0xec53('0xf9'),_0x4df892);throw ut[_0xec53('0x2e')](_0xec53('0xfa'),_0x1e1a17,_0x5e53a7);});}else{throw ut[_0xec53('0x2e')](_0x45099f[_0xec53('0x2e')],_0x1e1a17,_0x5e53a7);}})['catch'](function(_0x25b43d){ut['logger'](_0xec53('0xfb'),_0x25b43d);throw ut[_0xec53('0x2e')]('Call\x20unsuccessful',![],!![]);});};Preview['prototype'][_0xec53('0xfc')]=function(_0x3b8d5b){if(_[_0xec53('0x53')](_0x3b8d5b)||_['isEmpty'](_0x3b8d5b)||!_[_0xec53('0x53')](_0x3b8d5b[0x0][_0xec53('0x58')])&&_[_0xec53('0x53')](_0x3b8d5b[0x0]['Agent'][_0xec53('0x26')])){ut[_0xec53('0x31')](_0xec53('0xfd'),_0x3b8d5b);return{'isValid':![],'message':_0xec53('0xfe')};}var _0x25df5a=this[_0xec53('0x20')][_0x3b8d5b[0x0][_0xec53('0x44')][_0xec53('0x26')]];_0x25df5a[_0xec53('0x2e')]=utils[_0xec53('0x2f')][_0xec53('0xff')];if(_[_0xec53('0x53')](_0x25df5a)){ut[_0xec53('0x31')](_0xec53('0x100'),_0x25df5a);return{'isValid':![],'message':'Empty\x20Campaign'};}if(!this['isTrunkReachable'](_0x25df5a[_0xec53('0x101')])){ut['logger'](_0xec53('0x102'),'campaign\x20Name:\x20'+_0x25df5a['name']+_0xec53('0x103'));if(!this[_0xec53('0x6e')](_0x25df5a[_0xec53('0x104')])){ut[_0xec53('0x31')](_0xec53('0x102'),_0x25df5a[_0xec53('0x26')]+_0xec53('0x105'));return{'isValid':![],'message':_0xec53('0x106')};}}if(!ut[_0xec53('0x6c')](_0x25df5a[_0xec53('0x6d')])){ut[_0xec53('0x31')](_0xec53('0x107'),_0x25df5a[_0xec53('0x26')]+_0xec53('0x108'));return{'isValid':![],'message':_0xec53('0x109')+_0x25df5a[_0xec53('0x26')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0xec53('0x36')][_0xec53('0x10a')]=function(_0x4ec7c8,_0x3b8b57,_0xb2659b,_0x535ece){var _0x45a633=this;return new Promise(function(_0x390117,_0x185f44){var _0x324b94=_0x4ec7c8[_0xec53('0x95')];var _0x282465=_0x45a633[_0xec53('0x6e')](_0x3b8b57[_0xec53('0x101')])?util[_0xec53('0x24')](_0xec53('0x10b'),_0x3b8b57[_0xec53('0x101')][_0xec53('0x26')],_[_0xec53('0x53')](_0x3b8b57[_0xec53('0x10c')])?'':_0x3b8b57[_0xec53('0x10c')][_0xec53('0x10d')]()||'',_0x3b8b57['dialCutDigit']>0x0?_0xb2659b[_0xec53('0x10e')]['substring'](_0x3b8b57[_0xec53('0x10f')]):_0xb2659b['phone']):util[_0xec53('0x24')](_0xec53('0x10b'),_[_0xec53('0x53')](_0x3b8b57[_0xec53('0x104')])?_0x3b8b57[_0xec53('0x101')][_0xec53('0x26')]:_0x3b8b57[_0xec53('0x104')]['name'],_['isNil'](_0x3b8b57[_0xec53('0x10c')])?'':_0x3b8b57[_0xec53('0x10c')][_0xec53('0x10d')]()||'',_0x3b8b57[_0xec53('0x10f')]>0x0?_0xb2659b['phone'][_0xec53('0x110')](_0x3b8b57[_0xec53('0x10f')]):_0xb2659b[_0xec53('0x10e')]);var _0x303932=_0x45a633[_0xec53('0x6e')](_0x3b8b57['Trunk'])?ut[_0xec53('0x111')](_0x3b8b57[_0xec53('0x101')][_0xec53('0x112')],_0x3b8b57[_0xec53('0x113')],_0x3b8b57['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0xec53('0x114')](_0x3b8b57[_0xec53('0x115')],_0x3b8b57[_0xec53('0x116')]):_0x3b8b57[_0xec53('0x115')]):ut[_0xec53('0x111')](_[_0xec53('0x53')](_0x3b8b57['TrunkBackup'])?_0x3b8b57[_0xec53('0x101')][_0xec53('0x112')]:_0x3b8b57['TrunkBackup']['callerid'],_0x3b8b57['dialOriginateCallerIdName'],_0x3b8b57[_0xec53('0x116')]>0x0?ut[_0xec53('0x114')](_0x3b8b57[_0xec53('0x115')],_0x3b8b57[_0xec53('0x116')]):_0x3b8b57[_0xec53('0x115')]);if(_0x303932){_0x4ec7c8[_0xec53('0x117')]=ut['extractCalleridName'](_0x303932);_0x4ec7c8[_0xec53('0x118')]=ut['extractCalleridNumber'](_0x303932);}var _0x42bc2e=ut[_0xec53('0x119')](_0x3b8b57,_0xb2659b,_0x282465,_0x303932,_0x324b94,_0x4ec7c8);var _0x5d0346=utils['setXMDContactVariables'](_0xb2659b[_0xec53('0x11a')]);Object[_0xec53('0x11b')](_0x42bc2e,_0x5d0346);_[_0xec53('0x11c')](_0x4ec7c8,ut[_0xec53('0x11d')](_0x42bc2e));_0x4ec7c8[_0xec53('0x5e')]=moment()[_0xec53('0x24')](_0xec53('0x87'));_0x3b8b57[_0xec53('0x11e')]=_0x42bc2e;var _0x49cf28=ut['variablesAction'](_0x4ec7c8,_0x3b8b57,_0x42bc2e,_0x4ec7c8[_0xec53('0x81')],_0x535ece);return ami[_0xec53('0x49')](_0x49cf28)[_0xec53('0x52')](function(_0x1da10c){_0x3b8b57[_0xec53('0x2a')]+=0x1;logger[_0xec53('0x21')]('[originated][increment]',_0x324b94,_0xec53('0x96'),_0x3b8b57[_0xec53('0x26')],_0xec53('0xcf'),_0x3b8b57[_0xec53('0x2a')]);_0x390117(_0x1da10c);})[_0xec53('0x5b')](function(_0x170b64){ut[_0xec53('0xd6')](_0x4ec7c8,0xe,_0xec53('0x11f'));rpcDb[_0xec53('0xd7')](_0x4ec7c8,'[originateFailure][logOriginateFailure]');_0x185f44(_0x170b64);});});};Preview[_0xec53('0x36')]['syncNewExten']=function(_0x3524c5){if(this[_0xec53('0x11')][_0x3524c5[_0xec53('0x82')]]){this['actions'][_0x3524c5[_0xec53('0x82')]][_0xec53('0x120')]=_0x3524c5[_0xec53('0x120')];}};Preview[_0xec53('0x36')][_0xec53('0x121')]=function(_0x23940f){var _0x3874ae=this;var _0x54b7d2=this[_0xec53('0x11')][_0x23940f['actionid']];if(_0x54b7d2){if(_0x54b7d2[_0xec53('0xe3')]&&this[_0xec53('0x12')][_0x54b7d2['lookAgent']]){ut[_0xec53('0x122')](_0x54b7d2,this[_0xec53('0x12')][_0x54b7d2['lookAgent']][_0xec53('0x26')],this[_0xec53('0x12')][_0x54b7d2[_0xec53('0xe3')]]['id']);}var _0x38f427=_['clone'](_0x54b7d2);_0x38f427[_0xec53('0x88')]=moment()[_0xec53('0x24')](_0xec53('0x87'));var _0x57e91c=_0x3874ae[_0xec53('0x20')][_0x54b7d2[_0xec53('0x45')]];if(ut[_0xec53('0x123')](_0x23940f[_0xec53('0x124')])){if(_0x54b7d2[_0xec53('0x9f')]){rpcDb[_0xec53('0x125')](_0x54b7d2[_0xec53('0x84')]);}if(_0x54b7d2['activeContact']){rpcDb[_0xec53('0x5d')](_0x54b7d2[_0xec53('0x84')]);}ami[_0xec53('0x27')]('custom:agentringnoanswer',ut[_0xec53('0x74')](_0x54b7d2,_0xec53('0x126'),this[_0xec53('0x20')][_0x54b7d2[_0xec53('0x45')]]));this['callProgressDetectingAgent'](_0x38f427,_0x57e91c,_0x23940f);}else{_0x54b7d2[_0xec53('0x5e')]=moment()[_0xec53('0x24')]('YYYY-MM-DD\x20HH:mm:ss');ut[_0xec53('0xd6')](_0x38f427,0x4,_0xec53('0x91'));rpcDb[_0xec53('0xd7')](_0x38f427,_0xec53('0x127'));}}};Preview[_0xec53('0x36')][_0xec53('0x15')]=function(_0x59460b){var _0x4b978c=this[_0xec53('0x11')][_0x59460b['linkedid']];var _0x2b943e;if(_0x4b978c){_0x2b943e=this['campaignsPreview'][_0x4b978c[_0xec53('0x45')]];logger[_0xec53('0x21')]('[syncHangup][talking]',_0x59460b[_0xec53('0x82')],_0xec53('0x96'),_0x2b943e['name'],_0xec53('0x97'),_0x2b943e[_0xec53('0x2b')]);}if(this['actions'][_0x59460b[_0xec53('0x82')]]&&_0x59460b[_0xec53('0x82')]!==_0x59460b['uniqueid']){if(_0x59460b['cause']==='16'&&this['actions'][_0x59460b[_0xec53('0x82')]][_0xec53('0x46')]){this[_0xec53('0x128')](_0x59460b,_0x59460b[_0xec53('0x82')],_0x59460b[_0xec53('0x129')]);}else if(this[_0xec53('0x11')][_0x59460b[_0xec53('0x82')]][_0xec53('0x46')]){logger[_0xec53('0x21')]('[syncHangup][talking][cause]',_0x59460b[_0xec53('0x82')],_0x59460b['cause'],_0xec53('0x96'),_0x2b943e[_0xec53('0x26')],_0xec53('0x97'),_0x2b943e[_0xec53('0x2b')]);this['callProgressDetectingCustomer'](_0x59460b,_0x59460b[_0xec53('0x82')],_0x59460b[_0xec53('0x129')]);}}else if(_0x4b978c&&_[_0xec53('0x53')](_0x4b978c[_0xec53('0x12a')])&&_0x2b943e[_0xec53('0x12b')]&&_0x59460b[_0xec53('0x82')]===_0x59460b['uniqueid']&&_[_0xec53('0x53')](_0x59460b['reason'])&&_0x59460b['cause']==='16'&&_0x59460b[_0xec53('0x12c')]==='6'&&_[_0xec53('0xd4')](_0x4b978c[_0xec53('0x12d')])){if(_0x4b978c[_0xec53('0x9f')]){rpcDb['unlockContact'](_0x4b978c[_0xec53('0x84')]);}if(_0x4b978c[_0xec53('0x81')]){rpcDb[_0xec53('0x5d')](_0x4b978c[_0xec53('0x84')]);}_0x59460b[_0xec53('0xd5')]='22';this[_0xec53('0xd2')](_0x4b978c,_0x2b943e,_0x59460b);}else if(_0x4b978c&&_0x4b978c[_0xec53('0x12d')]){if(_0x59460b['cause']==='16'&&this[_0xec53('0x11')][_0x59460b['linkedid']][_0xec53('0x46')]){logger['info'](_0xec53('0x12e'),_0x59460b[_0xec53('0x82')],_0x59460b[_0xec53('0x129')],_0xec53('0x96'),_0x2b943e[_0xec53('0x26')],_0xec53('0x97'),_0x2b943e[_0xec53('0x2b')]);this[_0xec53('0x128')](_0x59460b,_0x59460b['linkedid'],_0x59460b[_0xec53('0x129')]);}else if(this[_0xec53('0x11')][_0x59460b['linkedid']][_0xec53('0x46')]){logger['info']('[syncHangup][talking][cause]',_0x59460b['linkedid'],_0x59460b[_0xec53('0x129')],_0xec53('0x96'),_0x2b943e[_0xec53('0x26')],'pTalking:\x20',_0x2b943e[_0xec53('0x2b')]);this[_0xec53('0x128')](_0x59460b,_0x59460b[_0xec53('0x82')],_0x59460b[_0xec53('0x129')]);}}};Preview['prototype'][_0xec53('0x12f')]=function(_0x500114){if(this[_0xec53('0x11')][_0x500114[_0xec53('0xd0')]]&&_0x500114['destlinkedid']!==_0x500114[_0xec53('0x130')]){this[_0xec53('0x128')](_0x500114,_0x500114[_0xec53('0xd0')],_0x500114[_0xec53('0xc6')]);}};Preview[_0xec53('0x36')]['syncHangupRequest']=function(_0x11c102){if(this[_0xec53('0x11')][_0x11c102[_0xec53('0x82')]]&&_0x11c102['linkedid']!==_0x11c102[_0xec53('0x95')]&&!this['actions'][_0x11c102[_0xec53('0x82')]][_0xec53('0x46')]){if(_0x11c102['cause']==='1'){this[_0xec53('0x128')](_0x11c102,_0x11c102[_0xec53('0x82')],_0x11c102[_0xec53('0x129')]);}}};Preview[_0xec53('0x36')]['addVariable']=function(_0x406183,_0x2ce925,_0x308835){if(this[_0xec53('0x11')][_0x406183]){if(_[_0xec53('0x53')](this[_0xec53('0x11')][_0x406183]['variables'])){this['actions'][_0x406183]['variables']={};}this['actions'][_0x406183][_0xec53('0x11e')][_0x2ce925]=_0x308835;}};Preview[_0xec53('0x36')][_0xec53('0x1d')]=function(_0x31699a){try{if(!_[_0xec53('0x53')](_0x31699a)){if(ut[_0xec53('0x131')](_['keys'](_0x31699a[_0xec53('0x132')])[0x0])){this[_0xec53('0x133')](_0x31699a['uniqueid'],_['keys'](_0x31699a[_0xec53('0x132')])[0x0],_0x31699a[_0xec53('0x134')]);}}}catch(_0x13d064){logger['error']('[syncVarSet][Preview]',util[_0xec53('0x135')](_0x13d064,{'showHidden':![],'depth':null}));}};Preview[_0xec53('0x36')][_0xec53('0x136')]=function(_0xe44663){if(_0xe44663){if(this[_0xec53('0x11')][_0xe44663[_0xec53('0x137')]]){this[_0xec53('0x11')][_0xe44663['transfertargetlinkedid']][_0xec53('0x12d')]=!![];}}};Preview[_0xec53('0x36')][_0xec53('0x1f')]=function(_0x52dbab){if(_0x52dbab){if(this[_0xec53('0x11')][_0x52dbab[_0xec53('0x138')]]){this[_0xec53('0x11')][_0x52dbab[_0xec53('0x138')]][_0xec53('0x12d')]=!![];}}};module[_0xec53('0x139')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 90b20ae..c24fa2d 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 _0x6b49=['from-sip','xcally-motion-preview','holdtime','assigned','queuecallerexitreason','create','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','preview','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','createHistory','catch','[createHistory]\x20','resolve','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','then','createAgentHistory','createCustomerHistory','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','context'];(function(_0x14a582,_0x57066d){var _0x3a82db=function(_0xe3652c){while(--_0xe3652c){_0x14a582['push'](_0x14a582['shift']());}};_0x3a82db(++_0x57066d);}(_0x6b49,0x184));var _0x96b4=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0x6b49[_0xbe200f];return _0x192597;};'use strict';var util=require(_0x96b4('0x0'));var BPromise=require(_0x96b4('0x1'));var logger=require(_0x96b4('0x2'))(_0x96b4('0x3'));var cmHopper=require('../rpc/cmHopper');var cmHopperHistory=require(_0x96b4('0x4'));var cmHopperBlack=require(_0x96b4('0x5'));var agentReportPreview=require(_0x96b4('0x6'));var voiceQueueReport=require(_0x96b4('0x7'));function loggerCatch(_0x4f84f7){return function(_0x2e293b){logger[_0x96b4('0x8')](_0x4f84f7,util[_0x96b4('0x9')](_0x2e293b,{'showHidden':![],'depth':null}));};}function create(_0x261f9a){return cmHopperHistory[_0x96b4('0xa')](_0x261f9a)[_0x96b4('0xb')](loggerCatch(_0x96b4('0xc')));}function createAgent(_0x400783){return BPromise[_0x96b4('0xd')]()['then'](agentReportPreview['createHistory'](_0x400783))[_0x96b4('0xb')](loggerCatch(_0x96b4('0xc')));}function moveContact(_0xa58d12){return cmHopper[_0x96b4('0xe')](_0xa58d12,!![])[_0x96b4('0xb')](loggerCatch(_0x96b4('0xf')));}exports[_0x96b4('0x10')]=function(_0x14ba91){return cmHopperBlack[_0x96b4('0x10')](_0x14ba91)['catch'](loggerCatch(_0x96b4('0x11')));};exports['getContactPreview']=function(_0x42c631){return BPromise[_0x96b4('0xd')]()[_0x96b4('0x12')](cmHopper['getContactPreview'](_0x42c631))[_0x96b4('0xb')](loggerCatch('[getContactPreview]\x20'));};exports[_0x96b4('0xa')]=function(_0x4c9f2a,_0x3971cd){create(_0x4c9f2a)[_0x96b4('0xb')](loggerCatch(_0x3971cd));moveContact(_0x4c9f2a)[_0x96b4('0xb')](loggerCatch(_0x3971cd));};exports[_0x96b4('0x13')]=function(_0x5505b,_0x249dd8){createAgent(_0x5505b)[_0x96b4('0xb')](loggerCatch(_0x249dd8));};exports[_0x96b4('0x14')]=function(_0x3a89f4,_0x5b9605){create(_0x3a89f4)[_0x96b4('0xb')](loggerCatch(_0x5b9605));};exports['createCustomerFinal']=function(_0x411189,_0x5111b7){moveContact(_0x411189)[_0x96b4('0xb')](loggerCatch(_0x5111b7));};exports[_0x96b4('0x15')]=function(_0x1c8c9a,_0x482787,_0x5683df){if(_0x482787){_0x1c8c9a[_0x96b4('0x16')]=null;}if(_0x5683df){_0x1c8c9a[_0x96b4('0x17')]=![];}return cmHopper[_0x96b4('0x15')](_0x1c8c9a)[_0x96b4('0xb')](loggerCatch(_0x96b4('0x18')));};exports['countReScheduled']=function(_0xdd64ed){return cmHopper[_0x96b4('0x19')](_0xdd64ed)[_0x96b4('0xb')](loggerCatch(_0x96b4('0x1a')));};exports[_0x96b4('0x1b')]=function(_0x4b8c6a){return cmHopper[_0x96b4('0x1b')]({'UserId':null},_0x4b8c6a,0x1)[_0x96b4('0xb')](loggerCatch('[unlockContact]\x20'));};exports[_0x96b4('0x1c')]=function(_0x5c790a){return cmHopper[_0x96b4('0x1b')]({'active':![]},_0x5c790a,0x1)['catch'](loggerCatch(_0x96b4('0x1d')));};exports[_0x96b4('0x1e')]=function(_0x1db727){var _0x896463={};_0x896463[_0x96b4('0x1f')]=_0x1db727['type'];_0x896463[_0x96b4('0x20')]=_0x1db727[_0x96b4('0x20')];_0x896463[_0x96b4('0x21')]=_0x1db727[_0x96b4('0x21')];_0x896463[_0x96b4('0x22')]=_0x1db727[_0x96b4('0x22')];_0x896463[_0x96b4('0x23')]=_0x1db727[_0x96b4('0x23')];_0x896463[_0x96b4('0x24')]=_0x1db727[_0x96b4('0x25')];_0x896463['queuecallerleaveAt']=_0x1db727[_0x96b4('0x25')];_0x896463[_0x96b4('0x26')]=0x1;_0x896463[_0x96b4('0x27')]=_0x1db727[_0x96b4('0x28')];_0x896463[_0x96b4('0x29')]=_0x1db727[_0x96b4('0x2a')];_0x896463[_0x96b4('0x2b')]=_0x96b4('0x2c');_0x896463['exten']=_0x96b4('0x2d');_0x896463[_0x96b4('0x2e')]=0x0;_0x896463[_0x96b4('0x2f')]=0x1;_0x896463['lastAssignedTo']=_0x1db727[_0x96b4('0x2a')];_0x896463[_0x96b4('0x30')]='COMPLETED';return BPromise[_0x96b4('0xd')]()['then'](voiceQueueReport[_0x96b4('0x31')](_0x896463))[_0x96b4('0xb')](loggerCatch('[voiceQueueReport]\x20'));};exports[_0x96b4('0x32')]=function(_0x28c8f4,_0x5a3964){return BPromise[_0x96b4('0xd')]()[_0x96b4('0x12')](cmHopper[_0x96b4('0x32')](_0x28c8f4,_0x5a3964))[_0x96b4('0xb')](loggerCatch(_0x96b4('0x33')));};exports[_0x96b4('0x34')]=function(_0x3dc90b){return cmHopper['rescheduleContact'](_0x3dc90b,!![],!![])['catch'](loggerCatch(_0x96b4('0x35')));}; \ No newline at end of file +var _0x36d7=['membername','context','from-sip','xcally-motion-preview','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','[rescheduleContactInQueue]\x20','../../../config/logger','preview','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','error','inspect','createHistory','catch','then','[moveContactManagedDialer]\x20','checkIsBlackList','getContactPreview','resolve','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','UserId','active','rescheduleContact','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','disableContact','unlockContact','crateCustomerReportQueue','type','uniqueid','calleridnum','queue','queuecallerjoinAt','answertime','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename'];(function(_0x1586ee,_0x5dbc2d){var _0x44bfe=function(_0x4e114c){while(--_0x4e114c){_0x1586ee['push'](_0x1586ee['shift']());}};_0x44bfe(++_0x5dbc2d);}(_0x36d7,0xd0));var _0x736d=function(_0x4164f2,_0x38669f){_0x4164f2=_0x4164f2-0x0;var _0x2575c7=_0x36d7[_0x4164f2];return _0x2575c7;};'use strict';var util=require('util');var BPromise=require('bluebird');var logger=require(_0x736d('0x0'))(_0x736d('0x1'));var cmHopper=require(_0x736d('0x2'));var cmHopperHistory=require(_0x736d('0x3'));var cmHopperBlack=require(_0x736d('0x4'));var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x5eaac7){return function(_0x509877){logger[_0x736d('0x5')](_0x5eaac7,util[_0x736d('0x6')](_0x509877,{'showHidden':![],'depth':null}));};}function create(_0x260cea){return cmHopperHistory[_0x736d('0x7')](_0x260cea)[_0x736d('0x8')](loggerCatch('[createHistory]\x20'));}function createAgent(_0x56a929){return BPromise['resolve']()[_0x736d('0x9')](agentReportPreview[_0x736d('0x7')](_0x56a929))['catch'](loggerCatch('[createHistory]\x20'));}function moveContact(_0xb46417){return cmHopper['moveContactManagedDialer'](_0xb46417,!![])[_0x736d('0x8')](loggerCatch(_0x736d('0xa')));}exports[_0x736d('0xb')]=function(_0xc97c31){return cmHopperBlack['checkIsBlackList'](_0xc97c31)['catch'](loggerCatch('[checkIsBlackList]\x20'));};exports[_0x736d('0xc')]=function(_0x1be2a8){return BPromise[_0x736d('0xd')]()[_0x736d('0x9')](cmHopper[_0x736d('0xc')](_0x1be2a8))[_0x736d('0x8')](loggerCatch(_0x736d('0xe')));};exports[_0x736d('0x7')]=function(_0x36fb9e,_0x2165cc){create(_0x36fb9e)[_0x736d('0x8')](loggerCatch(_0x2165cc));moveContact(_0x36fb9e)[_0x736d('0x8')](loggerCatch(_0x2165cc));};exports[_0x736d('0xf')]=function(_0x3bdf17,_0x170c9c){createAgent(_0x3bdf17)[_0x736d('0x8')](loggerCatch(_0x170c9c));};exports[_0x736d('0x10')]=function(_0x275928,_0x576216){create(_0x275928)[_0x736d('0x8')](loggerCatch(_0x576216));};exports[_0x736d('0x11')]=function(_0x3a7209,_0x5e7c68){moveContact(_0x3a7209)[_0x736d('0x8')](loggerCatch(_0x5e7c68));};exports['rescheduleContact']=function(_0xcd0ffa,_0x153d78,_0x220cd2){if(_0x153d78){_0xcd0ffa[_0x736d('0x12')]=null;}if(_0x220cd2){_0xcd0ffa[_0x736d('0x13')]=![];}return cmHopper[_0x736d('0x14')](_0xcd0ffa)[_0x736d('0x8')](loggerCatch(_0x736d('0x15')));};exports[_0x736d('0x16')]=function(_0x3dca49){return cmHopper['countReScheduled'](_0x3dca49)[_0x736d('0x8')](loggerCatch(_0x736d('0x17')));};exports['unlockContact']=function(_0x2c72b9){return cmHopper['unlockContact']({'UserId':null},_0x2c72b9,0x1)['catch'](loggerCatch('[unlockContact]\x20'));};exports[_0x736d('0x18')]=function(_0x38435e){return cmHopper[_0x736d('0x19')]({'active':![]},_0x38435e,0x1)[_0x736d('0x8')](loggerCatch('[activeContact]\x20'));};exports[_0x736d('0x1a')]=function(_0x41ec57){var _0x479641={};_0x479641[_0x736d('0x1b')]=_0x41ec57['type'];_0x479641['uniqueid']=_0x41ec57[_0x736d('0x1c')];_0x479641[_0x736d('0x1d')]=_0x41ec57[_0x736d('0x1d')];_0x479641['calleridname']=_0x41ec57['calleridname'];_0x479641[_0x736d('0x1e')]=_0x41ec57[_0x736d('0x1e')];_0x479641[_0x736d('0x1f')]=_0x41ec57[_0x736d('0x20')];_0x479641['queuecallerleaveAt']=_0x41ec57['answertime'];_0x479641[_0x736d('0x21')]=0x1;_0x479641[_0x736d('0x22')]=_0x41ec57[_0x736d('0x23')];_0x479641[_0x736d('0x24')]=_0x41ec57[_0x736d('0x25')];_0x479641[_0x736d('0x26')]=_0x736d('0x27');_0x479641['exten']=_0x736d('0x28');_0x479641['holdtime']=0x0;_0x479641[_0x736d('0x29')]=0x1;_0x479641[_0x736d('0x2a')]=_0x41ec57[_0x736d('0x25')];_0x479641[_0x736d('0x2b')]=_0x736d('0x2c');return BPromise[_0x736d('0xd')]()[_0x736d('0x9')](voiceQueueReport['create'](_0x479641))['catch'](loggerCatch(_0x736d('0x2d')));};exports['getContactRecallMe']=function(_0x3b47ad,_0x494bde){return BPromise[_0x736d('0xd')]()[_0x736d('0x9')](cmHopper[_0x736d('0x2e')](_0x3b47ad,_0x494bde))['catch'](loggerCatch(_0x736d('0x2f')));};exports['rescheduleContactInQueue']=function(_0x1bfc35){return cmHopper['rescheduleContact'](_0x1bfc35,!![],!![])[_0x736d('0x8')](loggerCatch(_0x736d('0x30')));}; \ 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 5828ef1..34613cf 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 _0x0910=['buildAcw','queue','not_inuse','status','push','getDiff','milliseconds','diff','seconds','CampaignId','idContact','type','campaigntype','dialAnswer','countglobal','callback','callbackuniqueid','callbackat','recallme','UserId','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','replace','random','extractCalleridName','match','noanswer','variables','keys','forEach','toLowerCase','lodash','moment','env','XCALLY_IP_AGI','127.0.0.1','error','inspect','logger','info','loggerError','logger2','message','getCallerId','string','isEmpty','\x22%s\x22\x20<%s>','isActive','Queue','name','format','calleridname','calleridnum','ContactId','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','monitor_format','_XCALLY_MIXMONITOR_UNIQUEID','toLowerVariables','hasOwnProperty','toLower','isNil','originated','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','starttime','responsetime','endtime','logAgent','ringtime','getSeconds','logLookAgent','membername','talktime','answertime','isFailure','Failure','RECALL','uniqueid','originate','channelAgent','timeout','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','clone','Global','scheduledAt','active','scheduledat','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','IsNotLoggedIn','lastevent','interface','motionChannel','voice','mandatoryDisposition'];(function(_0x3a5f9e,_0xe93d3e){var _0x22ed51=function(_0x3d2565){while(--_0x3d2565){_0x3a5f9e['push'](_0x3a5f9e['shift']());}};_0x22ed51(++_0xe93d3e);}(_0x0910,0x14e));var _0x0091=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0910[_0x3dd15e];return _0x231fd0;};'use strict';var util=require('util');var _=require(_0x0091('0x0'));var moment=require(_0x0091('0x1'));var logger=require('../../../../config/logger')('preview');var ipAgi=process[_0x0091('0x2')][_0x0091('0x3')]||_0x0091('0x4');var utils=require('../../dialer/utils');exports['loggerCatch']=function(_0x2bf123){return function(_0x3314a0){logger[_0x0091('0x5')](_0x2bf123,util[_0x0091('0x6')](_0x3314a0,{'showHidden':![],'depth':null}));};};exports[_0x0091('0x7')]=function(_0x992df7,_0x3e8699){logger[_0x0091('0x8')](_0x992df7,util['inspect'](_0x3e8699,{'showHidden':![],'depth':null}));};exports[_0x0091('0x9')]=function(_0x473a41,_0x3912dc){logger['error'](_0x473a41,util[_0x0091('0x6')](_0x3912dc,{'showHidden':![],'depth':null}));};exports[_0x0091('0xa')]=function(_0x48b947){return function(_0x3a4c2e){logger[_0x0091('0x8')](_0x48b947,util[_0x0091('0x6')](_0x3a4c2e,{'showHidden':![],'depth':null}));};};exports[_0x0091('0xb')]=function(_0x3a0c0a,_0xfa543c,_0x19f3df){return{'message':_0x3a0c0a,'unlock':_0xfa543c,'active':_0x19f3df};};exports[_0x0091('0xc')]=function(_0x2323aa,_0x385f37,_0x3ce8ad){if(!_['isUndefined'](_0x3ce8ad)&&_0x0091('0xd')===typeof _0x3ce8ad&&!_[_0x0091('0xe')](_0x3ce8ad)){if(!_['isUndefined'](_0x385f37)&&_0x0091('0xd')===typeof _0x385f37&&!_[_0x0091('0xe')](_0x385f37)){return util['format'](_0x0091('0xf'),_0x385f37,_0x3ce8ad);}return util['format'](_0x0091('0xf'),_0x3ce8ad,_0x3ce8ad);}if(!_['isUndefined'](_0x2323aa)&&_0x0091('0xd')===typeof _0x2323aa&&!_['isEmpty'](_0x2323aa)){return _0x2323aa;}return'\x22\x22\x20<>';};exports[_0x0091('0x10')]=function(_0x18e5ce){if(_['isNil'](_0x18e5ce)){return![];}return _0x18e5ce;};exports['addVariables']=function(_0x545392,_0x10a94a,_0x4b3e0d,_0x4f7997,_0x24aa13,_0x541709){var _0x54697c={'XMD-QUEUE':_0x10a94a[_0x0091('0x11')]?_0x10a94a[_0x0091('0x11')][_0x0091('0x12')]:'','XMD-CALLERID':_0x4f7997,'XMD-CALLERID-PREVIEW':_0x541709?util[_0x0091('0x13')](_0x0091('0xf'),_0x541709[_0x0091('0x14')],_0x541709[_0x0091('0x15')]):_0x4f7997,'XMD-DIALID':_0x24aa13,'XMD-CONTACTID':_0x10a94a[_0x0091('0x16')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x4f7997,'XMD-VOICEQUEUEID':_0x10a94a[_0x0091('0x17')],'XMD-DIALCHANNEL':_0x4b3e0d,'XMD-DIALTIMEOUT':_0x545392[_0x0091('0x18')]||0x1e,'XMD-DIALOPTIONS':util[_0x0091('0x13')](_0x0091('0x19'),_0x545392[_0x0091('0x1a')]?'g':'',_[_0x0091('0xe')](_0x545392['monitor_format'])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x545392['dialPreviewUrl']||'','XMD-AGI':_0x545392[_0x0091('0x1b')]?util[_0x0091('0x13')](_0x0091('0x1c'),ipAgi,_0x545392[_0x0091('0x1b')]):_0x0091('0x1d'),'XMD-AGIAFTER':_0x545392['dialQueueProject2']?util[_0x0091('0x13')](_0x0091('0x1c'),ipAgi,_0x545392[_0x0091('0x1a')]):_0x0091('0x1d'),'XMD-ORIGINATECALLERIDNUM':_0x541709?_0x541709[_0x0091('0x1e')]:'','XMD-ORIGINATECALLERIDNAME':_0x541709?_0x541709[_0x0091('0x1f')]:'','XMD-DESTINATION':_0x0091('0x20'),'SIPADDHEADER':_0x0091('0x21')};if(!_['isEmpty'](_0x545392['monitor_format'])){_0x54697c[util['format']('%s',_0x0091('0x22'))]=_0x545392[_0x0091('0x23')];_0x54697c[util[_0x0091('0x13')]('%s',_0x0091('0x24'))]=_0x24aa13;}return _0x54697c;};exports[_0x0091('0x25')]=function(_0x3d8f90){var _0x8afc5f={};for(var _0x5c61c5 in _0x3d8f90){if(_0x3d8f90[_0x0091('0x26')](_0x5c61c5)){_0x8afc5f[util['format']('%s',_[_0x0091('0x27')](_0x5c61c5))]=_0x3d8f90[_0x5c61c5];}}return{'variables':_0x8afc5f};};exports['updateOriginated']=function(_0x25923c,_0x556105){if(!_[_0x0091('0x28')](_0x25923c)){if(_0x25923c['hasOwnProperty']('originated')){if(_0x25923c[_0x0091('0x29')]>0x0){_0x25923c[_0x0091('0x29')]-=0x1;}else{logger[_0x0091('0x5')]('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0x556105);}}}else{logger[_0x0091('0x5')]('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x556105);}};exports[_0x0091('0x2a')]=function(_0x404d7d){var _0x1d19be=moment()[_0x0091('0x13')](_0x0091('0x2b'));_0x404d7d[_0x0091('0x2c')]=0xd;_0x404d7d[_0x0091('0x2d')]=_0x0091('0x2e');_0x404d7d[_0x0091('0x2f')]=_0x1d19be;_0x404d7d[_0x0091('0x30')]=_0x1d19be;_0x404d7d[_0x0091('0x31')]=_0x1d19be;};exports[_0x0091('0x32')]=function(_0x4a58c3,_0x79ebea,_0x58c01f){var _0x2bcfb7=moment()[_0x0091('0x13')](_0x0091('0x2b'));_0x4a58c3['state']=_0x79ebea;_0x4a58c3[_0x0091('0x2d')]=_0x58c01f;_0x4a58c3[_0x0091('0x30')]=_0x2bcfb7;_0x4a58c3[_0x0091('0x33')]=utils[_0x0091('0x34')](_0x4a58c3['responsetime'],_0x4a58c3[_0x0091('0x2f')]);};exports[_0x0091('0x35')]=function(_0x3fcf8f,_0xd90b86,_0x263329){_0x3fcf8f[_0x0091('0x36')]=_0xd90b86;_0x3fcf8f['UserId']=_0x263329;};exports['logCustomer']=function(_0x19c47a,_0x3b00e7,_0x3b61d){var _0x343efa=moment()[_0x0091('0x13')](_0x0091('0x2b'));_0x19c47a[_0x0091('0x2c')]=_0x3b00e7;_0x19c47a[_0x0091('0x2d')]=_0x3b61d;_0x19c47a[_0x0091('0x30')]=_0x19c47a['responsetime']?_0x19c47a[_0x0091('0x30')]:_0x343efa;_0x19c47a['endtime']=_0x19c47a[_0x0091('0x31')]?_0x19c47a['endtime']:_0x343efa;_0x19c47a[_0x0091('0x33')]=utils[_0x0091('0x34')](_0x19c47a[_0x0091('0x30')]||0x0,_0x19c47a[_0x0091('0x2f')]||0x0);_0x19c47a[_0x0091('0x37')]=_0x19c47a[_0x0091('0x38')]?utils[_0x0091('0x34')](_0x19c47a['endtime'],_0x19c47a[_0x0091('0x38')]):0x0;};exports[_0x0091('0x39')]=function(_0xac501f){return _0xac501f===_0x0091('0x3a');};exports['variablesAction']=function(_0x15ad50,_0x14bcd3,_0x2315b3,_0x325097,_0x425961){var _0x26b58b=_0x325097?_0x0091('0x3b'):_0x15ad50[_0x0091('0x14')];_0x26b58b=_0x425961?'BOOKED':_0x26b58b;return{'actionid':_0x15ad50[_0x0091('0x3c')],'action':_0x0091('0x3d'),'channel':_0x15ad50[_0x0091('0x3e')],'callerid':util['format'](_0x0091('0xf'),_0x26b58b,_0x15ad50['calleridnum']),'Exten':_0x0091('0x20'),'Context':'from-sip','Priority':'1','variable':_0x2315b3,'timeout':(_0x14bcd3[_0x0091('0x3f')]||0x1e)*0x3e8,'async':!![],'channelid':_0x15ad50[_0x0091('0x3c')]};};exports[_0x0091('0x40')]=function(_0x4790bf){return _0x4790bf[_0x0091('0x41')]+_0x4790bf[_0x0091('0x42')]+_0x4790bf[_0x0091('0x43')]+_0x4790bf[_0x0091('0x44')]+_0x4790bf[_0x0091('0x45')];};exports['cloneAction']=function(_0x2eb853){var _0x504807=_[_0x0091('0x46')](_0x2eb853);_0x504807['state']=0xf;_0x504807[_0x0091('0x2d')]=_0x0091('0x47');return _0x504807;};exports[_0x0091('0x48')]=function(_0x399bb0,_0x2ef6b3,_0x8a2c5d){var _0x17766f={};_0x17766f[_0x2ef6b3]=_0x399bb0[_0x2ef6b3];_0x17766f[_0x0091('0x49')]=![];_0x17766f[_0x0091('0x4a')]=moment()['add'](_0x8a2c5d,_0x0091('0x4b'))[_0x0091('0x13')](_0x0091('0x2b'));_0x17766f[_0x0091('0x16')]=_0x399bb0['ContactId'];_0x17766f['ListId']=_0x399bb0[_0x0091('0x4c')];_0x17766f[_0x0091('0x17')]=_0x399bb0[_0x0091('0x17')]||undefined;return _0x17766f;};exports[_0x0091('0x4d')]=function(_0x2e2fd7,_0x1c5ae6){if(!_[_0x0091('0x28')](_0x2e2fd7)){if(_0x2e2fd7[_0x0091('0x4e')]>0x0){_0x2e2fd7[_0x0091('0x4e')]-=0x1;}else{logger[_0x0091('0x5')](_0x1c5ae6,_0x0091('0x4f'));}}else{logger[_0x0091('0x5')](_0x1c5ae6,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports[_0x0091('0x50')]=function(_0x1c4975){if(_0x1c4975<=0x0){return!![];}return![];};function buildObj(_0x3c15ab,_0x5aa091,_0x467ae2){_0x3c15ab[_0x0091('0x51')]=_0x5aa091;_0x3c15ab[_0x0091('0x12')]=_0x3c15ab['queue'];_0x3c15ab[_0x0091('0x52')]=_0x3c15ab[_0x0091('0x3e')];_0x3c15ab[_0x0091('0x53')]=_0x0091('0x54');if(_0x467ae2){_0x3c15ab[_0x0091('0x55')]=_0x467ae2[_0x0091('0x55')];}return _0x3c15ab;}exports['buildObj']=buildObj;exports[_0x0091('0x56')]=function(_0x4f994c){var _0x5b9b06={};_0x5b9b06[_0x0091('0x57')]=_0x4f994c['queue'];_0x5b9b06['interface']=_0x4f994c[_0x0091('0x3e')];_0x5b9b06[_0x0091('0x3c')]=_0x4f994c['uniqueid'];return _0x5b9b06;};exports['agentReadyId']=function(_0x230fa7){var _0x16c360=[];for(var _0x2504a2 in _0x230fa7){if(_0x230fa7[_0x0091('0x26')](_0x2504a2)){if(!_[_0x0091('0x28')](_0x230fa7[_0x2504a2])&&_0x230fa7[_0x2504a2]['state']===_0x0091('0x58')&&_0x230fa7[_0x2504a2][_0x0091('0x59')]==='reachable'){_0x16c360[_0x0091('0x5a')](_0x230fa7[_0x2504a2]['id']);}}}return _0x16c360;};exports[_0x0091('0x5b')]=function(_0x416a23){var _0x408ae3=moment()[_0x0091('0x5c')](0x0);var _0x4b55f3=moment(_0x416a23)[_0x0091('0x5c')](0x0);return _0x408ae3[_0x0091('0x5d')](_0x4b55f3,_0x0091('0x5e'));};exports['createBody']=function(_0x2a655d){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x2a655d[_0x0091('0x16')],'ListId':_0x2a655d[_0x0091('0x4c')],'VoiceQueueId':_0x2a655d[_0x0091('0x17')]||undefined,'CampaignId':_0x2a655d[_0x0091('0x5f')]||undefined};};exports['filterKey']=function(_0x5e9478){if(_0x5e9478===_0x0091('0x3c')||_0x5e9478===_0x0091('0x60')||_0x5e9478===_0x0091('0x57')||_0x5e9478===_0x0091('0x61')||_0x5e9478===_0x0091('0x62')||_0x5e9478===_0x0091('0x63')||_0x5e9478===_0x0091('0x36')||_0x5e9478===_0x0091('0x3e')||_0x5e9478===_0x0091('0x14')||_0x5e9478==='active'||_0x5e9478===_0x0091('0x15')||_0x5e9478===_0x0091('0x4a')||_0x5e9478===_0x0091('0x41')||_0x5e9478===_0x0091('0x42')||_0x5e9478==='countnoanswerretry'||_0x5e9478===_0x0091('0x64')||_0x5e9478===_0x0091('0x65')||_0x5e9478===_0x0091('0x66')||_0x5e9478===_0x0091('0x67')||_0x5e9478===_0x0091('0x68')||_0x5e9478===_0x0091('0x16')||_0x5e9478===_0x0091('0x4c')||_0x5e9478===_0x0091('0x69')||_0x5e9478==='VoiceQueueId'||_0x5e9478===_0x0091('0x6a')||_0x5e9478===_0x0091('0x6b')||_0x5e9478===_0x0091('0x6c')||_0x5e9478===_0x0091('0x6d')||_0x5e9478===_0x0091('0x6e')||_0x5e9478===_0x0091('0x6f')||_0x5e9478===_0x0091('0x70')||_0x5e9478===_0x0091('0x71')||_0x5e9478===_0x0091('0x72')||_0x5e9478===_0x0091('0x73')||_0x5e9478==='xmd-contactid'||_0x5e9478==='xmd-cdrtype'||_0x5e9478===_0x0091('0x74')||_0x5e9478===_0x0091('0x75')||_0x5e9478===_0x0091('0x76')||_0x5e9478===_0x0091('0x77')||_0x5e9478==='rtpaudioqosbridged'||_0x5e9478==='rtpaudioqosjitter'||_0x5e9478==='rtpaudioqosjitterbridged'||_0x5e9478===_0x0091('0x78')||_0x5e9478===_0x0091('0x79')||_0x5e9478===_0x0091('0x7a')||_0x5e9478===_0x0091('0x7b')||_0x5e9478==='rtpaudioqos'||_0x5e9478===_0x0091('0x7c')||_0x5e9478===_0x0091('0x7d')||_0x5e9478===_0x0091('0x7e')||_0x5e9478===_0x0091('0x78')||_0x5e9478===_0x0091('0x79')||_0x5e9478===_0x0091('0x7a')||_0x5e9478===_0x0091('0x7b')||_0x5e9478===_0x0091('0x7f')||_0x5e9478===_0x0091('0x80')||_0x5e9478===_0x0091('0x2c')||_0x5e9478==='statedesc'){return![];}return!![];};exports[_0x0091('0x81')]=function(_0x2b2b21,_0x167efd){var _0x5ed2ba,_0x1ccc91,_0x130481;if(_0x167efd<=0x0){_0x167efd=0x1;}_0x5ed2ba=new RegExp(_0x0091('0x82')+_0x167efd+'}$');_0x1ccc91=Math['pow'](0xa,_0x167efd-0x1);_0x130481=Math['pow'](0xa,_0x167efd)-0x1;return util['format']('%s',_[_0x0091('0x83')](_0x2b2b21,_0x5ed2ba,_[_0x0091('0x84')](_0x1ccc91,_0x130481)));};exports[_0x0091('0x85')]=function(_0x15e043){var _0x45309f=_0x15e043[_0x0091('0x86')](/"(.*?)"/);return _0x45309f?_0x45309f[0x1]:_0x15e043;};exports['extractCalleridNumber']=function(_0x1d192d){var _0x4d8947=_0x1d192d[_0x0091('0x86')](/<(.*?)>/);return _0x4d8947?_0x4d8947[0x1]:_0x1d192d;};function buildNoAnswerEventPayload(_0x363a76,_0x2f4c3d){var _0x6ef3a7=buildObj(_0x363a76,_0x0091('0x87'));if(!_[_0x0091('0xe')](_0x2f4c3d[_0x0091('0x88')])){Object[_0x0091('0x89')](_0x2f4c3d['variables'])[_0x0091('0x8a')](function(_0x5a40f8){_0x6ef3a7[_0x5a40f8[_0x0091('0x8b')]()]=_0x2f4c3d['variables'][_0x5a40f8];});}return _0x6ef3a7;}exports['buildNoAnswerEventPayload']=buildNoAnswerEventPayload; \ No newline at end of file +var _0x93e5=['rtpaudioqosrttbridged','rtpaudioqosloss','bridgepeer','bridgepvtcallid','pow','replace','random','extractCalleridName','extractCalleridNumber','match','noanswer','variables','forEach','buildNoAnswerEventPayload','moment','../../../../config/logger','XCALLY_IP_AGI','127.0.0.1','loggerCatch','error','inspect','logger','loggerError','info','message','getCallerId','isUndefined','string','\x22%s\x22\x20<%s>','format','isEmpty','isActive','addVariables','Queue','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','dialQueueProject2','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','monitor_format','_XCALLY_MIXMONITOR_UNIQUEID','toLowerVariables','hasOwnProperty','toLower','updateOriginated','isNil','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','starttime','responsetime','logAgent','ringtime','getSeconds','logLookAgent','membername','UserId','endtime','talktime','answertime','isFailure','variablesAction','RECALL','uniqueid','originate','channelAgent','timeout','totalGlobal','countbusyretry','countcongestionretry','countnosuchnumberretry','cloneAction','clone','scheduledAt','active','scheduledat','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','IsNotLoggedIn','lastevent','name','queue','interface','motionChannel','voice','mandatoryDisposition','buildObj','buildAcw','agentReadyId','not_inuse','reachable','push','milliseconds','diff','seconds','createBody','type','campaigntype','countnoanswerretry','countglobal','callback','callbackuniqueid','recallme','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt'];(function(_0x77186e,_0x15e210){var _0x4efd1a=function(_0x46c86b){while(--_0x46c86b){_0x77186e['push'](_0x77186e['shift']());}};_0x4efd1a(++_0x15e210);}(_0x93e5,0x1ac));var _0x593e=function(_0x2cf16f,_0x5899df){_0x2cf16f=_0x2cf16f-0x0;var _0xfb99c6=_0x93e5[_0x2cf16f];return _0xfb99c6;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x593e('0x0'));var logger=require(_0x593e('0x1'))('preview');var ipAgi=process['env'][_0x593e('0x2')]||_0x593e('0x3');var utils=require('../../dialer/utils');exports[_0x593e('0x4')]=function(_0x24cb69){return function(_0x275e10){logger[_0x593e('0x5')](_0x24cb69,util[_0x593e('0x6')](_0x275e10,{'showHidden':![],'depth':null}));};};exports[_0x593e('0x7')]=function(_0x1cd46d,_0x471f97){logger['info'](_0x1cd46d,util[_0x593e('0x6')](_0x471f97,{'showHidden':![],'depth':null}));};exports[_0x593e('0x8')]=function(_0x4f62ab,_0x51f95e){logger[_0x593e('0x5')](_0x4f62ab,util[_0x593e('0x6')](_0x51f95e,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0xecf13f){return function(_0x4b7ccc){logger[_0x593e('0x9')](_0xecf13f,util[_0x593e('0x6')](_0x4b7ccc,{'showHidden':![],'depth':null}));};};exports[_0x593e('0xa')]=function(_0xb22ee8,_0x14d9c2,_0x1ae474){return{'message':_0xb22ee8,'unlock':_0x14d9c2,'active':_0x1ae474};};exports[_0x593e('0xb')]=function(_0x4e7970,_0x3d396f,_0x532051){if(!_[_0x593e('0xc')](_0x532051)&&_0x593e('0xd')===typeof _0x532051&&!_['isEmpty'](_0x532051)){if(!_[_0x593e('0xc')](_0x3d396f)&&_0x593e('0xd')===typeof _0x3d396f&&!_['isEmpty'](_0x3d396f)){return util['format'](_0x593e('0xe'),_0x3d396f,_0x532051);}return util[_0x593e('0xf')](_0x593e('0xe'),_0x532051,_0x532051);}if(!_['isUndefined'](_0x4e7970)&&'string'===typeof _0x4e7970&&!_[_0x593e('0x10')](_0x4e7970)){return _0x4e7970;}return'\x22\x22\x20<>';};exports[_0x593e('0x11')]=function(_0x55aa10){if(_['isNil'](_0x55aa10)){return![];}return _0x55aa10;};exports[_0x593e('0x12')]=function(_0x2b063d,_0x65365,_0x4b5323,_0x3aa14c,_0x28d9ea,_0x404fb0){var _0x518499={'XMD-QUEUE':_0x65365[_0x593e('0x13')]?_0x65365['Queue']['name']:'','XMD-CALLERID':_0x3aa14c,'XMD-CALLERID-PREVIEW':_0x404fb0?util[_0x593e('0xf')](_0x593e('0xe'),_0x404fb0[_0x593e('0x14')],_0x404fb0[_0x593e('0x15')]):_0x3aa14c,'XMD-DIALID':_0x28d9ea,'XMD-CONTACTID':_0x65365[_0x593e('0x16')],'XMD-CDRTYPE':_0x593e('0x17'),'CALLERID(all)':_0x3aa14c,'XMD-VOICEQUEUEID':_0x65365[_0x593e('0x18')],'XMD-DIALCHANNEL':_0x4b5323,'XMD-DIALTIMEOUT':_0x2b063d[_0x593e('0x19')]||0x1e,'XMD-DIALOPTIONS':util[_0x593e('0xf')]('\x22rtTxX%s%s\x22',_0x2b063d[_0x593e('0x1a')]?'g':'',_[_0x593e('0x10')](_0x2b063d['monitor_format'])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x2b063d[_0x593e('0x1b')]||'','XMD-AGI':_0x2b063d[_0x593e('0x1c')]?util[_0x593e('0xf')](_0x593e('0x1d'),ipAgi,_0x2b063d[_0x593e('0x1c')]):_0x593e('0x1e'),'XMD-AGIAFTER':_0x2b063d[_0x593e('0x1a')]?util[_0x593e('0xf')]('\x22agi://%s/square,%s\x22',ipAgi,_0x2b063d[_0x593e('0x1a')]):_0x593e('0x1e'),'XMD-ORIGINATECALLERIDNUM':_0x404fb0?_0x404fb0[_0x593e('0x1f')]:'','XMD-ORIGINATECALLERIDNAME':_0x404fb0?_0x404fb0[_0x593e('0x20')]:'','XMD-DESTINATION':_0x593e('0x21'),'SIPADDHEADER':_0x593e('0x22')};if(!_[_0x593e('0x10')](_0x2b063d[_0x593e('0x23')])){_0x518499[util[_0x593e('0xf')]('%s','_XCALLY_MIXMONITOR_FORMAT')]=_0x2b063d['monitor_format'];_0x518499[util[_0x593e('0xf')]('%s',_0x593e('0x24'))]=_0x28d9ea;}return _0x518499;};exports[_0x593e('0x25')]=function(_0x21ac92){var _0x5dd4c3={};for(var _0x1676ff in _0x21ac92){if(_0x21ac92[_0x593e('0x26')](_0x1676ff)){_0x5dd4c3[util[_0x593e('0xf')]('%s',_[_0x593e('0x27')](_0x1676ff))]=_0x21ac92[_0x1676ff];}}return{'variables':_0x5dd4c3};};exports[_0x593e('0x28')]=function(_0x180239,_0x5d2863){if(!_[_0x593e('0x29')](_0x180239)){if(_0x180239[_0x593e('0x26')](_0x593e('0x2a'))){if(_0x180239[_0x593e('0x2a')]>0x0){_0x180239[_0x593e('0x2a')]-=0x1;}else{logger[_0x593e('0x5')](_0x593e('0x2b'),_0x5d2863);}}}else{logger[_0x593e('0x5')](_0x593e('0x2c'),_0x5d2863);}};exports[_0x593e('0x2d')]=function(_0x3531df){var _0x4be09b=moment()[_0x593e('0xf')](_0x593e('0x2e'));_0x3531df[_0x593e('0x2f')]=0xd;_0x3531df[_0x593e('0x30')]=_0x593e('0x31');_0x3531df[_0x593e('0x32')]=_0x4be09b;_0x3531df[_0x593e('0x33')]=_0x4be09b;_0x3531df['endtime']=_0x4be09b;};exports[_0x593e('0x34')]=function(_0x1c4113,_0x502565,_0xd6391){var _0x44bc8a=moment()['format'](_0x593e('0x2e'));_0x1c4113[_0x593e('0x2f')]=_0x502565;_0x1c4113[_0x593e('0x30')]=_0xd6391;_0x1c4113[_0x593e('0x33')]=_0x44bc8a;_0x1c4113[_0x593e('0x35')]=utils[_0x593e('0x36')](_0x1c4113[_0x593e('0x33')],_0x1c4113[_0x593e('0x32')]);};exports[_0x593e('0x37')]=function(_0x1bedbf,_0xbe4d99,_0x560093){_0x1bedbf[_0x593e('0x38')]=_0xbe4d99;_0x1bedbf[_0x593e('0x39')]=_0x560093;};exports['logCustomer']=function(_0x1403d2,_0x1436e8,_0x3f9e34){var _0x2a0567=moment()[_0x593e('0xf')](_0x593e('0x2e'));_0x1403d2['state']=_0x1436e8;_0x1403d2['statedesc']=_0x3f9e34;_0x1403d2[_0x593e('0x33')]=_0x1403d2['responsetime']?_0x1403d2[_0x593e('0x33')]:_0x2a0567;_0x1403d2['endtime']=_0x1403d2[_0x593e('0x3a')]?_0x1403d2[_0x593e('0x3a')]:_0x2a0567;_0x1403d2['ringtime']=utils[_0x593e('0x36')](_0x1403d2['responsetime']||0x0,_0x1403d2['starttime']||0x0);_0x1403d2[_0x593e('0x3b')]=_0x1403d2[_0x593e('0x3c')]?utils[_0x593e('0x36')](_0x1403d2[_0x593e('0x3a')],_0x1403d2[_0x593e('0x3c')]):0x0;};exports[_0x593e('0x3d')]=function(_0x1e6a84){return _0x1e6a84==='Failure';};exports[_0x593e('0x3e')]=function(_0x389457,_0x428cd5,_0x1f1b91,_0x45e3a2,_0x4db929){var _0x2e8593=_0x45e3a2?_0x593e('0x3f'):_0x389457[_0x593e('0x14')];_0x2e8593=_0x4db929?'BOOKED':_0x2e8593;return{'actionid':_0x389457[_0x593e('0x40')],'action':_0x593e('0x41'),'channel':_0x389457[_0x593e('0x42')],'callerid':util['format'](_0x593e('0xe'),_0x2e8593,_0x389457['calleridnum']),'Exten':_0x593e('0x21'),'Context':'from-sip','Priority':'1','variable':_0x1f1b91,'timeout':(_0x428cd5[_0x593e('0x43')]||0x1e)*0x3e8,'async':!![],'channelid':_0x389457[_0x593e('0x40')]};};exports[_0x593e('0x44')]=function(_0x1559f0){return _0x1559f0[_0x593e('0x45')]+_0x1559f0[_0x593e('0x46')]+_0x1559f0['countnoanswerretry']+_0x1559f0['countagentrejectretry']+_0x1559f0[_0x593e('0x47')];};exports[_0x593e('0x48')]=function(_0x27c9d2){var _0x2404f5=_[_0x593e('0x49')](_0x27c9d2);_0x2404f5[_0x593e('0x2f')]=0xf;_0x2404f5[_0x593e('0x30')]='Global';return _0x2404f5;};exports[_0x593e('0x4a')]=function(_0x4811ae,_0xc25f36,_0x3ba017){var _0x5ab961={};_0x5ab961[_0xc25f36]=_0x4811ae[_0xc25f36];_0x5ab961[_0x593e('0x4b')]=![];_0x5ab961[_0x593e('0x4c')]=moment()['add'](_0x3ba017,_0x593e('0x4d'))['format'](_0x593e('0x2e'));_0x5ab961[_0x593e('0x16')]=_0x4811ae[_0x593e('0x16')];_0x5ab961[_0x593e('0x4e')]=_0x4811ae[_0x593e('0x4e')];_0x5ab961['VoiceQueueId']=_0x4811ae['VoiceQueueId']||undefined;return _0x5ab961;};exports[_0x593e('0x4f')]=function(_0x5986d6,_0x16cbfa){if(!_[_0x593e('0x29')](_0x5986d6)){if(_0x5986d6[_0x593e('0x50')]>0x0){_0x5986d6[_0x593e('0x50')]-=0x1;}else{logger[_0x593e('0x5')](_0x16cbfa,_0x593e('0x51'));}}else{logger[_0x593e('0x5')](_0x16cbfa,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports[_0x593e('0x52')]=function(_0x2398f5){if(_0x2398f5<=0x0){return!![];}return![];};function buildObj(_0x44bc23,_0x3d663a,_0xd1b20a){_0x44bc23[_0x593e('0x53')]=_0x3d663a;_0x44bc23[_0x593e('0x54')]=_0x44bc23[_0x593e('0x55')];_0x44bc23[_0x593e('0x56')]=_0x44bc23[_0x593e('0x42')];_0x44bc23[_0x593e('0x57')]=_0x593e('0x58');if(_0xd1b20a){_0x44bc23[_0x593e('0x59')]=_0xd1b20a[_0x593e('0x59')];}return _0x44bc23;}exports[_0x593e('0x5a')]=buildObj;exports[_0x593e('0x5b')]=function(_0x3f2f40){var _0x547817={};_0x547817['queue']=_0x3f2f40[_0x593e('0x55')];_0x547817[_0x593e('0x56')]=_0x3f2f40[_0x593e('0x42')];_0x547817[_0x593e('0x40')]=_0x3f2f40[_0x593e('0x40')];return _0x547817;};exports[_0x593e('0x5c')]=function(_0x11ff66){var _0x3965f3=[];for(var _0x123c5f in _0x11ff66){if(_0x11ff66[_0x593e('0x26')](_0x123c5f)){if(!_['isNil'](_0x11ff66[_0x123c5f])&&_0x11ff66[_0x123c5f][_0x593e('0x2f')]===_0x593e('0x5d')&&_0x11ff66[_0x123c5f]['status']===_0x593e('0x5e')){_0x3965f3[_0x593e('0x5f')](_0x11ff66[_0x123c5f]['id']);}}}return _0x3965f3;};exports['getDiff']=function(_0x951b61){var _0x493b96=moment()[_0x593e('0x60')](0x0);var _0x5dc24c=moment(_0x951b61)[_0x593e('0x60')](0x0);return _0x493b96[_0x593e('0x61')](_0x5dc24c,_0x593e('0x62'));};exports[_0x593e('0x63')]=function(_0x19bbc2){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x19bbc2['ContactId'],'ListId':_0x19bbc2[_0x593e('0x4e')],'VoiceQueueId':_0x19bbc2['VoiceQueueId']||undefined,'CampaignId':_0x19bbc2['CampaignId']||undefined};};exports['filterKey']=function(_0x58269a){if(_0x58269a===_0x593e('0x40')||_0x58269a==='idContact'||_0x58269a==='queue'||_0x58269a===_0x593e('0x64')||_0x58269a===_0x593e('0x65')||_0x58269a==='dialAnswer'||_0x58269a==='membername'||_0x58269a==='channelAgent'||_0x58269a===_0x593e('0x14')||_0x58269a===_0x593e('0x4b')||_0x58269a===_0x593e('0x15')||_0x58269a===_0x593e('0x4c')||_0x58269a==='countbusyretry'||_0x58269a===_0x593e('0x46')||_0x58269a===_0x593e('0x66')||_0x58269a===_0x593e('0x67')||_0x58269a===_0x593e('0x68')||_0x58269a===_0x593e('0x69')||_0x58269a==='callbackat'||_0x58269a===_0x593e('0x6a')||_0x58269a===_0x593e('0x16')||_0x58269a===_0x593e('0x4e')||_0x58269a===_0x593e('0x39')||_0x58269a==='VoiceQueueId'||_0x58269a==='sipcallid'||_0x58269a==='xmd-voicequeueid'||_0x58269a===_0x593e('0x6b')||_0x58269a===_0x593e('0x6c')||_0x58269a===_0x593e('0x6d')||_0x58269a===_0x593e('0x6e')||_0x58269a===_0x593e('0x6f')||_0x58269a===_0x593e('0x70')||_0x58269a==='xmd-dialid'||_0x58269a===_0x593e('0x71')||_0x58269a===_0x593e('0x72')||_0x58269a===_0x593e('0x73')||_0x58269a===_0x593e('0x74')||_0x58269a==='xmd-agiafter'||_0x58269a===_0x593e('0x75')||_0x58269a===_0x593e('0x76')||_0x58269a===_0x593e('0x77')||_0x58269a===_0x593e('0x78')||_0x58269a===_0x593e('0x79')||_0x58269a==='rtpaudioqosloss'||_0x58269a===_0x593e('0x7a')||_0x58269a===_0x593e('0x7b')||_0x58269a===_0x593e('0x7c')||_0x58269a==='rtpaudioqos'||_0x58269a===_0x593e('0x77')||_0x58269a==='rtpaudioqosjitter'||_0x58269a==='rtpaudioqosjitterbridged'||_0x58269a===_0x593e('0x7d')||_0x58269a==='rtpaudioqoslossbridged'||_0x58269a===_0x593e('0x7b')||_0x58269a==='rtpaudioqosrttbridged'||_0x58269a===_0x593e('0x7e')||_0x58269a===_0x593e('0x7f')||_0x58269a===_0x593e('0x2f')||_0x58269a===_0x593e('0x30')){return![];}return!![];};exports['getCallerIdRandom']=function(_0x5d1c6c,_0x38aa37){var _0x2792ca,_0x3c2e8d,_0x5653ec;if(_0x38aa37<=0x0){_0x38aa37=0x1;}_0x2792ca=new RegExp('\x5cw{0,'+_0x38aa37+'}$');_0x3c2e8d=Math[_0x593e('0x80')](0xa,_0x38aa37-0x1);_0x5653ec=Math['pow'](0xa,_0x38aa37)-0x1;return util[_0x593e('0xf')]('%s',_[_0x593e('0x81')](_0x5d1c6c,_0x2792ca,_[_0x593e('0x82')](_0x3c2e8d,_0x5653ec)));};exports[_0x593e('0x83')]=function(_0x541eea){var _0x577d6d=_0x541eea['match'](/"(.*?)"/);return _0x577d6d?_0x577d6d[0x1]:_0x541eea;};exports[_0x593e('0x84')]=function(_0x2d941e){var _0xb49a30=_0x2d941e[_0x593e('0x85')](/<(.*?)>/);return _0xb49a30?_0xb49a30[0x1]:_0x2d941e;};function buildNoAnswerEventPayload(_0x41ef89,_0x2bd401){var _0x4890f4=buildObj(_0x41ef89,_0x593e('0x86'));if(!_['isEmpty'](_0x2bd401[_0x593e('0x87')])){Object['keys'](_0x2bd401[_0x593e('0x87')])[_0x593e('0x88')](function(_0x44da46){_0x4890f4[_0x44da46['toLowerCase']()]=_0x2bd401[_0x593e('0x87')][_0x44da46];});}return _0x4890f4;}exports[_0x593e('0x89')]=buildNoAnswerEventPayload; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 0221fc3..1257fb5 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 _0xe4ed=['voicequeuechannel','voicequeuechannelhangup','queueadd','string','boolean','queuepause','reload'];(function(_0x44d4f6,_0x37c381){var _0x381625=function(_0x34af32){while(--_0x34af32){_0x44d4f6['push'](_0x44d4f6['shift']());}};_0x381625(++_0x37c381);}(_0xe4ed,0x87));var _0xde4e=function(_0x21321b,_0x52b3ba){_0x21321b=_0x21321b-0x0;var _0x383e4c=_0xe4ed[_0x21321b];return _0x383e4c;};'use strict';exports[_0xde4e('0x0')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0xde4e('0x1'),'required':!![]},'membername':{'type':_0xde4e('0x1'),'required':!![]},'penalty':{'type':'number','required':![]},'paused':{'type':_0xde4e('0x2'),'required':![]}};exports['queueremove']={'queue':{'type':_0xde4e('0x1'),'required':!![]},'interface':{'type':_0xde4e('0x1'),'required':!![]}};exports[_0xde4e('0x3')]={'interface':{'type':'string','required':!![]},'paused':{'type':_0xde4e('0x2')},'reason':{'type':'string','required':![]}};exports[_0xde4e('0x4')]={'module':{'type':_0xde4e('0x1'),'required':![]}};exports[_0xde4e('0x5')]={'uniqueid':{'type':'string','required':!![]}};exports['voicechannel']={'uniqueid':{'type':_0xde4e('0x1'),'required':!![]},'filename':{'type':_0xde4e('0x1')},'format':{'type':_0xde4e('0x1')},'mixmonitorid':{'type':_0xde4e('0x1')}};exports[_0xde4e('0x6')]={'uniqueid':{'type':_0xde4e('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0xde4e('0x1'),'required':!![]},'exten':{'type':_0xde4e('0x1'),'required':!![]},'context':{'type':_0xde4e('0x1')}}; \ No newline at end of file +var _0x2c3a=['number','boolean','queuepause','reload','voicequeuechannel','voicechannel','voicequeuechannelredirect','queueadd','string'];(function(_0x2493a8,_0x5a240d){var _0x2b06c9=function(_0x198d3c){while(--_0x198d3c){_0x2493a8['push'](_0x2493a8['shift']());}};_0x2b06c9(++_0x5a240d);}(_0x2c3a,0x1ed));var _0xa2c3=function(_0x2cf2a8,_0x45e93c){_0x2cf2a8=_0x2cf2a8-0x0;var _0x19c495=_0x2c3a[_0x2cf2a8];return _0x19c495;};'use strict';exports[_0xa2c3('0x0')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0xa2c3('0x1'),'required':!![]},'membername':{'type':_0xa2c3('0x1'),'required':!![]},'penalty':{'type':_0xa2c3('0x2'),'required':![]},'paused':{'type':_0xa2c3('0x3'),'required':![]}};exports['queueremove']={'queue':{'type':_0xa2c3('0x1'),'required':!![]},'interface':{'type':_0xa2c3('0x1'),'required':!![]}};exports[_0xa2c3('0x4')]={'interface':{'type':_0xa2c3('0x1'),'required':!![]},'paused':{'type':_0xa2c3('0x3')},'reason':{'type':_0xa2c3('0x1'),'required':![]}};exports[_0xa2c3('0x5')]={'module':{'type':_0xa2c3('0x1'),'required':![]}};exports[_0xa2c3('0x6')]={'uniqueid':{'type':_0xa2c3('0x1'),'required':!![]}};exports[_0xa2c3('0x7')]={'uniqueid':{'type':'string','required':!![]},'filename':{'type':_0xa2c3('0x1')},'format':{'type':_0xa2c3('0x1')},'mixmonitorid':{'type':_0xa2c3('0x1')}};exports['voicequeuechannelhangup']={'uniqueid':{'type':'string','required':!![]}};exports[_0xa2c3('0x8')]={'uniqueid':{'type':_0xa2c3('0x1'),'required':!![]},'exten':{'type':_0xa2c3('0x1'),'required':!![]},'context':{'type':_0xa2c3('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index a1d10bd..fe074a1 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 _0xadb5=['ivrTotalCallsDays','ivrAnswerCallsDay','unmanaged','sumBillable','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','prototype','initAgents','initTelephones','length','isUndefined','triggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initDeskAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','vtigerAccounts','initServicenowAccounts','dynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','voiceQueues','groupBy','uniqueid','queue','queuecallerexit','queuecallerabandon','abandoned','queuecallerleaveAt','diff','seconds','queuecallerabandonAt','queuecallerexitAt','queuecallerjoinAt','queuecallercomplete','queuecallercompleteAt','duration','ANSWERED','billableseconds','initCampaigns','dialQueueProject','initVoiceExtensions','voiceExtensions','initCampaignHopperHistory','initFaxAccounts','moment','../model/agent','../model/telephone','../model/trunk','../model/trigger','../model/template','../model/campaign','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','trunks','campaigns','templates','outbound','channels','outboundChannels','settings','zendeskAccounts','salesforceAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','servicenowAccounts','freshsalesAccounts','faxAccounts','mapKeys','name','hasOwnProperty','isNil','interface','format','SIP/%s','total','answered','sumHoldTime','sumDuration','isEmpty'];(function(_0x3840f3,_0x62ca1d){var _0x501d02=function(_0x5d74a3){while(--_0x5d74a3){_0x3840f3['push'](_0x3840f3['shift']());}};_0x501d02(++_0x62ca1d);}(_0xadb5,0xad));var _0x5adb=function(_0x1063e8,_0x3b73ce){_0x1063e8=_0x1063e8-0x0;var _0x162db4=_0xadb5[_0x1063e8];return _0x162db4;};'use strict';var _=require('lodash');var moment=require(_0x5adb('0x0'));var util=require('util');var Agent=require(_0x5adb('0x1'));var Telephone=require(_0x5adb('0x2'));var Trunk=require(_0x5adb('0x3'));var VoiceQueue=require('../model/voiceQueue');var Trigger=require(_0x5adb('0x4'));var Template=require(_0x5adb('0x5'));var Campaign=require(_0x5adb('0x6'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0x5adb('0x7'));var SalesforceAccount=require(_0x5adb('0x8'));var FreshdeskAccount=require(_0x5adb('0x9'));var SugarcrmAccount=require(_0x5adb('0xa'));var ZohoAccount=require(_0x5adb('0xb'));var DeskAccount=require(_0x5adb('0xc'));var VtigerAccount=require(_0x5adb('0xd'));var ServicenowAccount=require(_0x5adb('0xe'));var Dynamics365Account=require(_0x5adb('0xf'));var FreshsalesAccount=require(_0x5adb('0x10'));var FaxAccount=require(_0x5adb('0x11'));function Realtime(){this[_0x5adb('0x12')]={};this[_0x5adb('0x13')]={};this[_0x5adb('0x14')]={};this['voiceQueues']={};this['triggers']={};this[_0x5adb('0x15')]={};this[_0x5adb('0x16')]={};this[_0x5adb('0x17')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0x5adb('0x18')]={};this['queueChannels']={};this[_0x5adb('0x19')]={};this['timers']={};this[_0x5adb('0x1a')]={};this[_0x5adb('0x1b')]={};this[_0x5adb('0x1c')]={};this['sugarcrmAccounts']={};this[_0x5adb('0x1d')]={};this[_0x5adb('0x1e')]={};this[_0x5adb('0x1f')]={};this['vtigerAccounts']={};this[_0x5adb('0x20')]={};this['dynamics365Accounts']={};this[_0x5adb('0x21')]={};this[_0x5adb('0x22')]={};}function freeIsNotKey(_0x30614e,_0x304784,_0x1c0f97){var _0x39d24d=_[_0x5adb('0x23')](_0x30614e,function(_0x42f4c6){return _0x42f4c6[_0x1c0f97];});for(var _0xb953a6 in _0x304784){if(_0x304784['hasOwnProperty'](_0xb953a6)){if(!_0x39d24d[_0xb953a6]){delete _0x304784[_0xb953a6];}}}}function freeIsNotKeySip(_0x3fff62,_0x5de028){var _0x1d9e86=_['mapKeys'](_0x3fff62,function(_0x3ef465){return util['format']('SIP/%s',_0x3ef465[_0x5adb('0x24')]);});for(var _0x1bed20 in _0x5de028){if(_0x5de028[_0x5adb('0x25')](_0x1bed20)){if(!_0x1d9e86[_0x1bed20]){delete _0x5de028[_0x1bed20];}}}}function freeIsNotKeyAgent(_0x1fd4a7,_0x99bc6c){var _0x5af69d=_[_0x5adb('0x23')](_0x1fd4a7,function(_0x5c296e){var _0x4e9f16=_[_0x5adb('0x26')](_0x5c296e[_0x5adb('0x27')])?util[_0x5adb('0x28')](_0x5adb('0x29'),_0x5c296e[_0x5adb('0x24')]):_0x5c296e[_0x5adb('0x27')];return _0x4e9f16;});for(var _0xfd9bb9 in _0x99bc6c){if(_0x99bc6c['hasOwnProperty'](_0xfd9bb9)){if(!_0x5af69d[_0xfd9bb9]){delete _0x99bc6c[_0xfd9bb9];}}}}function clearVoiceCallReports(_0x4b1957){_0x4b1957[_0x5adb('0x2a')]=0x0;_0x4b1957[_0x5adb('0x2b')]=0x0;_0x4b1957[_0x5adb('0x2c')]=0x0;_0x4b1957[_0x5adb('0x2d')]=0x0;_0x4b1957['sumBillable']=0x0;}function clearCampaigns(_0x2fee18){if(!_[_0x5adb('0x2e')](_0x2fee18)){for(var _0x5aed76 in _0x2fee18){if(_0x2fee18[_0x5adb('0x25')](_0x5aed76)){_0x2fee18[_0x5aed76][_0x5adb('0x2f')]=0x0;_0x2fee18[_0x5aed76][_0x5adb('0x30')]=0x0;}}}}function clearVoiceQueues(_0x55b40a){if(!_[_0x5adb('0x2e')](_0x55b40a)){for(var _0xbe21b1 in _0x55b40a){if(_0x55b40a[_0x5adb('0x25')](_0xbe21b1)){_0x55b40a[_0xbe21b1][_0x5adb('0x2a')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x2b')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x31')]=0x0;_0x55b40a[_0xbe21b1]['abandoned']=0x0;_0x55b40a[_0xbe21b1]['sumHoldTime']=0x0;_0x55b40a[_0xbe21b1]['sumDuration']=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x32')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x33')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x34')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x35')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x36')]=0x0;_0x55b40a[_0xbe21b1]['outboundNoSuchCallsDay']=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x37')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x38')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x39')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3a')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3b')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3c')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3d')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x33')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3e')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3f')]=!![];}}}}Realtime['prototype'][_0x5adb('0x40')]=function(_0x4c8b2e,_0x12424d){for(var _0x20cde6 in _0x12424d){if(_0x4c8b2e['hasOwnProperty'](_0x20cde6)){_0x4c8b2e[_0x20cde6]=_0x12424d[_0x20cde6];}}};Realtime[_0x5adb('0x41')][_0x5adb('0x42')]=function(){var _0x461a39=this;return function(_0x4a3661){if(_0x4a3661){freeIsNotKeyAgent(_0x4a3661,_0x461a39[_0x5adb('0x12')]);for(var _0x14cf00=0x0,_0x4b5887={};_0x14cf00<_0x4a3661['length'];_0x14cf00+=0x1){_0x4b5887=_0x4a3661[_0x14cf00];var _0x1ed9ea=_['isNil'](_0x4b5887[_0x5adb('0x27')])?util[_0x5adb('0x28')](_0x5adb('0x29'),_0x4b5887[_0x5adb('0x24')]):_0x4b5887[_0x5adb('0x27')];if(_['isUndefined'](_0x461a39[_0x5adb('0x12')][_0x1ed9ea])){_0x461a39[_0x5adb('0x12')][_0x1ed9ea]=new Agent(_0x4b5887);}else{_0x461a39[_0x5adb('0x40')](_0x461a39['agents'][_0x1ed9ea],_0x4b5887);}}}return _0x461a39['agents'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x43')]=function(){var _0x586820=this;return function(_0x2355bc){if(_0x2355bc){freeIsNotKeySip(_0x2355bc,_0x586820['telephones']);for(var _0x199d3b=0x0,_0x58cc5d={};_0x199d3b<_0x2355bc[_0x5adb('0x44')];_0x199d3b+=0x1){_0x58cc5d=_0x2355bc[_0x199d3b];if(_['isUndefined'](_0x586820[_0x5adb('0x13')][util[_0x5adb('0x28')]('SIP/%s',_0x58cc5d[_0x5adb('0x24')])])){_0x586820['telephones'][util[_0x5adb('0x28')](_0x5adb('0x29'),_0x58cc5d[_0x5adb('0x24')])]=new Telephone(_0x58cc5d);}else{_0x586820['mergeFromDatabase'](_0x586820[_0x5adb('0x13')][util[_0x5adb('0x28')](_0x5adb('0x29'),_0x58cc5d[_0x5adb('0x24')])],_0x58cc5d);}}}return _0x586820[_0x5adb('0x13')];};};Realtime['prototype']['initTrunks']=function(){var _0x4f491a=this;return function(_0x599999){if(_0x599999){freeIsNotKeySip(_0x599999,_0x4f491a[_0x5adb('0x14')]);for(var _0x2fbe14=0x0,_0x3a104a={};_0x2fbe14<_0x599999[_0x5adb('0x44')];_0x2fbe14+=0x1){_0x3a104a=_0x599999[_0x2fbe14];if(_[_0x5adb('0x45')](_0x4f491a[_0x5adb('0x14')][util[_0x5adb('0x28')](_0x5adb('0x29'),_0x3a104a['name'])])){_0x4f491a['trunks'][util[_0x5adb('0x28')]('SIP/%s',_0x3a104a[_0x5adb('0x24')])]=new Trunk(_0x3a104a);}else{_0x4f491a[_0x5adb('0x40')](_0x4f491a[_0x5adb('0x14')][util[_0x5adb('0x28')](_0x5adb('0x29'),_0x3a104a['name'])],_0x3a104a);}}}return _0x4f491a[_0x5adb('0x14')];};};Realtime[_0x5adb('0x41')]['initTriggers']=function(){var _0x4160ad=this;return function(_0x1a256c){if(_0x1a256c){freeIsNotKey(_0x1a256c,_0x4160ad['triggers'],'id');for(var _0x120497=0x0,_0x407a4c={};_0x120497<_0x1a256c[_0x5adb('0x44')];_0x120497+=0x1){_0x407a4c=_0x1a256c[_0x120497];if(_[_0x5adb('0x45')](_0x4160ad[_0x5adb('0x46')][_0x407a4c['id']])){_0x4160ad[_0x5adb('0x46')][_0x407a4c['id']]=new Trigger(_0x407a4c);}else{_0x4160ad[_0x5adb('0x40')](_0x4160ad['triggers'][_0x407a4c['id']],_0x407a4c);}}}return _0x4160ad['triggers'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x47')]=function(){var _0x1cd0a3=this;return function(_0xb79d85){if(_0xb79d85){freeIsNotKey(_0xb79d85,_0x1cd0a3['templates'],'id');for(var _0x507e48=0x0,_0xaa32e4={};_0x507e48<_0xb79d85[_0x5adb('0x44')];_0x507e48+=0x1){_0xaa32e4=_0xb79d85[_0x507e48];if(_[_0x5adb('0x45')](_0x1cd0a3[_0x5adb('0x16')][_0xaa32e4['id']])){_0x1cd0a3[_0x5adb('0x16')][_0xaa32e4['id']]=new Template(_0xaa32e4);}else{_0x1cd0a3['mergeFromDatabase'](_0x1cd0a3[_0x5adb('0x16')][_0xaa32e4['id']],_0xaa32e4);}}}return _0x1cd0a3[_0x5adb('0x16')];};};Realtime['prototype'][_0x5adb('0x48')]=function(){var _0x251f45=this;return function(_0x1cdb03){if(_0x1cdb03){freeIsNotKey(_0x1cdb03,_0x251f45[_0x5adb('0x1b')],'id');for(var _0x186bd2=0x0,_0x3a5409={};_0x186bd2<_0x1cdb03[_0x5adb('0x44')];_0x186bd2+=0x1){_0x3a5409=_0x1cdb03[_0x186bd2];if(_[_0x5adb('0x45')](_0x251f45['zendeskAccounts'][_0x3a5409['id']])){_0x251f45[_0x5adb('0x1b')][_0x3a5409['id']]=new ZendeskAccount(_0x3a5409);}else{_0x251f45['mergeFromDatabase'](_0x251f45['zendeskAccounts'][_0x3a5409['id']],_0x3a5409);}}}return _0x251f45['zendeskAccounts'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x49')]=function(){var _0x207a81=this;return function(_0x4ba0b5){if(_0x4ba0b5){freeIsNotKey(_0x4ba0b5,_0x207a81[_0x5adb('0x1c')],'id');for(var _0x5cbab5=0x0,_0x177a81={};_0x5cbab5<_0x4ba0b5[_0x5adb('0x44')];_0x5cbab5+=0x1){_0x177a81=_0x4ba0b5[_0x5cbab5];if(_[_0x5adb('0x45')](_0x207a81['salesforceAccounts'][_0x177a81['id']])){_0x207a81[_0x5adb('0x1c')][_0x177a81['id']]=new SalesforceAccount(_0x177a81);}else{_0x207a81['mergeFromDatabase'](_0x207a81[_0x5adb('0x1c')][_0x177a81['id']],_0x177a81);}}}return _0x207a81[_0x5adb('0x1c')];};};Realtime['prototype'][_0x5adb('0x4a')]=function(){var _0x1ab97b=this;return function(_0x3594e3){if(_0x3594e3){freeIsNotKey(_0x3594e3,_0x1ab97b[_0x5adb('0x1d')],'id');for(var _0x372734=0x0,_0x4cb36c={};_0x372734<_0x3594e3[_0x5adb('0x44')];_0x372734+=0x1){_0x4cb36c=_0x3594e3[_0x372734];if(_[_0x5adb('0x45')](_0x1ab97b[_0x5adb('0x1d')][_0x4cb36c['id']])){_0x1ab97b[_0x5adb('0x1d')][_0x4cb36c['id']]=new FreshdeskAccount(_0x4cb36c);}else{_0x1ab97b['mergeFromDatabase'](_0x1ab97b[_0x5adb('0x1d')][_0x4cb36c['id']],_0x4cb36c);}}}return _0x1ab97b[_0x5adb('0x1d')];};};Realtime[_0x5adb('0x41')]['initZohoAccounts']=function(){var _0x2b34a8=this;return function(_0xd0e5b7){if(_0xd0e5b7){freeIsNotKey(_0xd0e5b7,_0x2b34a8[_0x5adb('0x1e')],'id');for(var _0xfd3471=0x0,_0x4f2da9={};_0xfd3471<_0xd0e5b7[_0x5adb('0x44')];_0xfd3471+=0x1){_0x4f2da9=_0xd0e5b7[_0xfd3471];if(_[_0x5adb('0x45')](_0x2b34a8[_0x5adb('0x1e')][_0x4f2da9['id']])){_0x2b34a8[_0x5adb('0x1e')][_0x4f2da9['id']]=new ZohoAccount(_0x4f2da9);}else{_0x2b34a8[_0x5adb('0x40')](_0x2b34a8['zohoAccounts'][_0x4f2da9['id']],_0x4f2da9);}}}return _0x2b34a8[_0x5adb('0x1e')];};};Realtime['prototype'][_0x5adb('0x4b')]=function(){var _0x4f7227=this;return function(_0x31ae72){if(_0x31ae72){freeIsNotKey(_0x31ae72,_0x4f7227[_0x5adb('0x1f')],'id');for(var _0x1a9358=0x0,_0x42f6d9={};_0x1a9358<_0x31ae72['length'];_0x1a9358+=0x1){_0x42f6d9=_0x31ae72[_0x1a9358];if(_[_0x5adb('0x45')](_0x4f7227[_0x5adb('0x1f')][_0x42f6d9['id']])){_0x4f7227[_0x5adb('0x1f')][_0x42f6d9['id']]=new DeskAccount(_0x42f6d9);}else{_0x4f7227['mergeFromDatabase'](_0x4f7227['deskAccounts'][_0x42f6d9['id']],_0x42f6d9);}}}return _0x4f7227['deskAccounts'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x4c')]=function(){var _0xa5ecc0=this;return function(_0x12a146){if(_0x12a146){freeIsNotKey(_0x12a146,_0xa5ecc0[_0x5adb('0x4d')],'id');for(var _0xb06bee=0x0,_0x204b9b={};_0xb06bee<_0x12a146[_0x5adb('0x44')];_0xb06bee+=0x1){_0x204b9b=_0x12a146[_0xb06bee];if(_[_0x5adb('0x45')](_0xa5ecc0[_0x5adb('0x4d')][_0x204b9b['id']])){_0xa5ecc0[_0x5adb('0x4d')][_0x204b9b['id']]=new SugarcrmAccount(_0x204b9b);}else{_0xa5ecc0[_0x5adb('0x40')](_0xa5ecc0[_0x5adb('0x4d')][_0x204b9b['id']],_0x204b9b);}}}return _0xa5ecc0['sugarcrmAccounts'];};};Realtime['prototype'][_0x5adb('0x4e')]=function(){var _0x27a8e4=this;return function(_0x43cde9){if(_0x43cde9){freeIsNotKey(_0x43cde9,_0x27a8e4[_0x5adb('0x4f')],'id');for(var _0x5d7a9f=0x0,_0xfba0d5={};_0x5d7a9f<_0x43cde9[_0x5adb('0x44')];_0x5d7a9f+=0x1){_0xfba0d5=_0x43cde9[_0x5d7a9f];if(_['isUndefined'](_0x27a8e4[_0x5adb('0x4f')][_0xfba0d5['id']])){_0x27a8e4[_0x5adb('0x4f')][_0xfba0d5['id']]=new VtigerAccount(_0xfba0d5);}else{_0x27a8e4[_0x5adb('0x40')](_0x27a8e4['vtigerAccounts'][_0xfba0d5['id']],_0xfba0d5);}}}return _0x27a8e4[_0x5adb('0x4f')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x50')]=function(){var _0x30c92c=this;return function(_0x330290){if(_0x330290){freeIsNotKey(_0x330290,_0x30c92c[_0x5adb('0x20')],'id');for(var _0x513f26=0x0,_0x836b91={};_0x513f26<_0x330290[_0x5adb('0x44')];_0x513f26+=0x1){_0x836b91=_0x330290[_0x513f26];if(_[_0x5adb('0x45')](_0x30c92c['servicenowAccounts'][_0x836b91['id']])){_0x30c92c[_0x5adb('0x20')][_0x836b91['id']]=new ServicenowAccount(_0x836b91);}else{_0x30c92c[_0x5adb('0x40')](_0x30c92c[_0x5adb('0x20')][_0x836b91['id']],_0x836b91);}}}return _0x30c92c['servicenowAccounts'];};};Realtime[_0x5adb('0x41')]['initDynamics365Accounts']=function(){var _0xa8ff64=this;return function(_0x1e7e3a){if(_0x1e7e3a){freeIsNotKey(_0x1e7e3a,_0xa8ff64[_0x5adb('0x51')],'id');for(var _0x57f0a4=0x0,_0x192b1f={};_0x57f0a4<_0x1e7e3a[_0x5adb('0x44')];_0x57f0a4+=0x1){_0x192b1f=_0x1e7e3a[_0x57f0a4];if(_['isUndefined'](_0xa8ff64[_0x5adb('0x51')][_0x192b1f['id']])){_0xa8ff64[_0x5adb('0x51')][_0x192b1f['id']]=new Dynamics365Account(_0x192b1f);}else{_0xa8ff64[_0x5adb('0x40')](_0xa8ff64[_0x5adb('0x51')][_0x192b1f['id']],_0x192b1f);}}}return _0xa8ff64['dynamics365Accounts'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x52')]=function(){var _0x307f07=this;return function(_0x16716e){if(_0x16716e){freeIsNotKey(_0x16716e,_0x307f07['freshsalesAccounts'],'id');for(var _0x53a4bc=0x0,_0x304512={};_0x53a4bc<_0x16716e['length'];_0x53a4bc+=0x1){_0x304512=_0x16716e[_0x53a4bc];if(_['isUndefined'](_0x307f07['freshsalesAccounts'][_0x304512['id']])){_0x307f07[_0x5adb('0x21')][_0x304512['id']]=new FreshsalesAccount(_0x304512);}else{_0x307f07[_0x5adb('0x40')](_0x307f07['freshsalesAccounts'][_0x304512['id']],_0x304512);}}}return _0x307f07[_0x5adb('0x21')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x53')]=function(){var _0xf6ef8a=this;return function(_0x358a23){for(var _0x126e38=0x0;_0x126e38<_0x358a23[_0x5adb('0x44')];_0x126e38+=0x1){_[_0x5adb('0x54')](_0xf6ef8a['voiceQueues'][_0x358a23[_0x126e38]['name']],_0x358a23[_0x126e38]);}return _0xf6ef8a['voiceQueues'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x55')]=function(){var _0x3a0d1b=this;return function(_0x2a55a3){clearVoiceQueues(_0x3a0d1b[_0x5adb('0x56')]);if(_0x2a55a3){_0x2a55a3=_[_0x5adb('0x57')](_0x2a55a3,_0x5adb('0x58'));for(var _0x25f761 in _0x2a55a3){if(_0x2a55a3['hasOwnProperty'](_0x25f761)){for(var _0x5e55c2=0x0;_0x5e55c2<_0x2a55a3[_0x25f761][_0x5adb('0x44')];_0x5e55c2+=0x1){var _0x56df90=_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x59')];if(_0x3a0d1b[_0x5adb('0x56')][_0x56df90]){if(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x5a')]){_0x3a0d1b[_0x5adb('0x56')][_0x56df90][_0x5adb('0x31')]+=0x1;}if(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x5b')]){_0x3a0d1b[_0x5adb('0x56')][_0x56df90][_0x5adb('0x5c')]+=0x1;}_0x3a0d1b['voiceQueues'][_0x56df90][_0x5adb('0x2c')]+=moment(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x5d')])[_0x5adb('0x5e')](moment(_0x2a55a3[_0x25f761][_0x5e55c2]['queuecallerjoinAt']),_0x5adb('0x5f'))||0x0;if(_0x5e55c2===_0x2a55a3[_0x25f761][_0x5adb('0x44')]-0x1){_0x3a0d1b['voiceQueues'][_0x56df90][_0x5adb('0x2d')]+=moment(_0x2a55a3[_0x25f761][_0x5e55c2]['queuecallercompleteAt']||_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x60')]||_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x61')])['diff'](moment(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x62')]),_0x5adb('0x5f'))||0x0;_0x3a0d1b[_0x5adb('0x56')][_0x56df90][_0x5adb('0x2a')]+=0x1;if(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x63')]){_0x3a0d1b[_0x5adb('0x56')][_0x56df90][_0x5adb('0x2b')]+=0x1;_0x3a0d1b[_0x5adb('0x56')][_0x56df90]['sumBillable']+=moment(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x64')])[_0x5adb('0x5e')](moment(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x5d')]),'seconds')||0x0;}}else{_0x3a0d1b['voiceQueues'][_0x56df90][_0x5adb('0x2d')]+=_0x3a0d1b['voiceQueues'][_0x56df90][_0x5adb('0x2c')]||0x0;}}}}}}return _0x3a0d1b[_0x5adb('0x56')];};};Realtime[_0x5adb('0x41')]['initVoiceCallReports']=function(){var _0x3a9735=this;return function(_0x288e4f){clearVoiceCallReports(_0x3a9735[_0x5adb('0x17')]);if(_0x288e4f){for(var _0x3ecc56=0x0;_0x3ecc56<_0x288e4f[_0x5adb('0x44')];_0x3ecc56+=0x1){_0x3a9735['outbound'][_0x5adb('0x2a')]+=0x1;_0x3a9735[_0x5adb('0x17')][_0x5adb('0x2d')]+=_0x288e4f[_0x3ecc56][_0x5adb('0x65')];if(_0x288e4f[_0x3ecc56]['disposition']===_0x5adb('0x66')){_0x3a9735[_0x5adb('0x17')][_0x5adb('0x2b')]+=0x1;_0x3a9735[_0x5adb('0x17')][_0x5adb('0x2c')]+=_0x288e4f[_0x3ecc56][_0x5adb('0x65')]-_0x288e4f[_0x3ecc56][_0x5adb('0x67')]||0x0;_0x3a9735['outbound'][_0x5adb('0x32')]+=_0x288e4f[_0x3ecc56][_0x5adb('0x67')];}}}return _0x3a9735['outbound'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x68')]=function(){var _0x4fc0d5=this;return function(_0x462fa0){if(_0x462fa0){freeIsNotKey(_0x462fa0,_0x4fc0d5['campaigns'],_0x5adb('0x24'));for(var _0x268df2=0x0,_0x4a2ebc={};_0x268df2<_0x462fa0[_0x5adb('0x44')];_0x268df2+=0x1){_0x4a2ebc=_0x462fa0[_0x268df2];if(_['isUndefined'](_0x4fc0d5[_0x5adb('0x15')][_0x4a2ebc[_0x5adb('0x24')]])){_0x4fc0d5[_0x5adb('0x15')][_0x4a2ebc[_0x5adb('0x24')]]=new Campaign(_0x4a2ebc);}else{_0x4fc0d5[_0x5adb('0x40')](_0x4fc0d5['campaigns'][_0x4a2ebc[_0x5adb('0x24')]],_0x4a2ebc);_0x4fc0d5[_0x5adb('0x15')][_0x4a2ebc[_0x5adb('0x24')]][_0x5adb('0x69')]=_0x4a2ebc['SquareProject']?_0x4a2ebc['SquareProject'][_0x5adb('0x24')]:undefined;}}}return _0x4fc0d5[_0x5adb('0x15')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x6a')]=function(){var _0x277668=this;return function(_0xc74e86){if(_0xc74e86){freeIsNotKey(_0xc74e86,_0x277668[_0x5adb('0x6b')],'id');for(var _0x514833=0x0,_0xda26cc={};_0x514833<_0xc74e86[_0x5adb('0x44')];_0x514833+=0x1){_0xda26cc=_0xc74e86[_0x514833];if(_[_0x5adb('0x45')](_0x277668[_0x5adb('0x6b')][_0xda26cc['id']])){_0x277668['voiceExtensions'][_0xda26cc['id']]=new VoiceExtension(_0xda26cc);}else{_0x277668[_0x5adb('0x40')](_0x277668[_0x5adb('0x6b')][_0xda26cc['id']],_0xda26cc);}}}return _0x277668[_0x5adb('0x6b')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x6c')]=function(){var _0x188cbd=this;return function(_0x315ac6){clearCampaigns(_0x188cbd[_0x5adb('0x15')]);for(var _0x1f753e=0x0;_0x1f753e<_0x315ac6['length'];_0x1f753e+=0x1){_[_0x5adb('0x54')](_0x188cbd[_0x5adb('0x15')][_0x315ac6[_0x1f753e]['name']],_0x315ac6[_0x1f753e]);}return _0x188cbd[_0x5adb('0x15')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x6d')]=function(){var _0x3bb3fc=this;return function(_0x200221){if(_0x200221){freeIsNotKey(_0x200221,_0x3bb3fc[_0x5adb('0x22')],'id');for(var _0x450516=0x0,_0x350bb1={};_0x450516<_0x200221['length'];_0x450516+=0x1){_0x350bb1=_0x200221[_0x450516];if(_[_0x5adb('0x45')](_0x3bb3fc[_0x5adb('0x22')][_0x350bb1['id']])){_0x3bb3fc['faxAccounts'][_0x350bb1['id']]=new FaxAccount(_0x350bb1);}else{_0x3bb3fc[_0x5adb('0x40')](_0x3bb3fc[_0x5adb('0x22')][_0x350bb1['id']],_0x350bb1);}}}return _0x3bb3fc[_0x5adb('0x22')];};};Realtime['prototype']['initVoiceQueues']=function(){var _0x2d7a9f=this;return function(_0x328851){if(_0x328851){freeIsNotKey(_0x328851,_0x2d7a9f[_0x5adb('0x56')],'name');for(var _0x14b36f=0x0,_0x321c3a={};_0x14b36f<_0x328851[_0x5adb('0x44')];_0x14b36f+=0x1){_0x321c3a=_0x328851[_0x14b36f];if(_[_0x5adb('0x45')](_0x2d7a9f[_0x5adb('0x56')][_0x321c3a[_0x5adb('0x24')]])){_0x2d7a9f[_0x5adb('0x56')][_0x321c3a[_0x5adb('0x24')]]=new VoiceQueue(_0x321c3a);}else{_0x2d7a9f[_0x5adb('0x40')](_0x2d7a9f[_0x5adb('0x56')][_0x321c3a[_0x5adb('0x24')]],_0x321c3a);}}}return _0x2d7a9f[_0x5adb('0x56')];};};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(_0x5ebe75,_0x178094){var _0x59ab2d=function(_0x35489d){while(--_0x35489d){_0x5ebe75['push'](_0x5ebe75['shift']());}};_0x59ab2d(++_0x178094);}(_0x5f2f,0x73));var _0xf5f2=function(_0x3374fd,_0x59a9bc){_0x3374fd=_0x3374fd-0x0;var _0xb10792=_0x5f2f[_0x3374fd];return _0xb10792;};'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 d254310..c19e36a 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 _0x9b17=['hasOwnProperty'];(function(_0x54248e,_0x364737){var _0x3bafc5=function(_0x1067a5){while(--_0x1067a5){_0x54248e['push'](_0x54248e['shift']());}};_0x3bafc5(++_0x364737);}(_0x9b17,0x10f));var _0x79b1=function(_0x2ef16b,_0x4b612a){_0x2ef16b=_0x2ef16b-0x0;var _0x53a7eb=_0x9b17[_0x2ef16b];return _0x53a7eb;};'use strict';function mergeDBDataToRealtime(_0x17bc48,_0x567296){var _0xb48cd=Object['assign']({},_0x17bc48);for(var _0x50d209 in _0x567296){if(_0xb48cd[_0x79b1('0x0')](_0x50d209)){_0xb48cd[_0x50d209]=_0x567296[_0x50d209];}}return _0xb48cd;}exports['mergeDBDataToRealtime']=mergeDBDataToRealtime; \ No newline at end of file +var _0x8feb=['mergeDBDataToRealtime','assign','hasOwnProperty'];(function(_0x29b609,_0x19d388){var _0x54c952=function(_0xb3c38d){while(--_0xb3c38d){_0x29b609['push'](_0x29b609['shift']());}};_0x54c952(++_0x19d388);}(_0x8feb,0x1d5));var _0xb8fe=function(_0x51edc6,_0x289ff5){_0x51edc6=_0x51edc6-0x0;var _0xd0e23c=_0x8feb[_0x51edc6];return _0xd0e23c;};'use strict';function mergeDBDataToRealtime(_0x115015,_0xf59104){var _0x4aa2b1=Object[_0xb8fe('0x0')]({},_0x115015);for(var _0x1d371d in _0xf59104){if(_0x4aa2b1[_0xb8fe('0x1')](_0x1d371d)){_0x4aa2b1[_0x1d371d]=_0xf59104[_0x1d371d];}}return _0x4aa2b1;}exports[_0xb8fe('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 c22d9d7..49edfec 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 _0x3b19=['../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','custom:voiceQueueReport','voiceQueueReport','bind','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','findAgent','accountcode','isNil','name','find','interface','format','length','assigned','SIP/%s','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','match','getAgentByInternal','keys','getCallType','channel','split','outbound','internal','destination','type','dialer','lastapplication','queue','lastdata','context','from-voip-provider','callerid','from-sip','xcally-motion-preview','calleridpreview','calleridnum','originatecalleridnum','destinationchannel','disposition','ANSWERED','connectedlinenum','calleridname','transfers','linkedid','transfereelinkedid','UserId','membername','create','monitor','monitors','filename','createdAt','connectedlinename','exten','xcally-motion-dialer','isArray','forEach','startsWith','Local','substring','indexOf','mobile','lastIndexOf','transfererlinkedid','lodash','util','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport'];(function(_0x22ca8e,_0x3e844e){var _0x476e60=function(_0x414a62){while(--_0x414a62){_0x22ca8e['push'](_0x22ca8e['shift']());}};_0x476e60(++_0x3e844e);}(_0x3b19,0x11a));var _0x93b1=function(_0x30a047,_0x3b5804){_0x30a047=_0x30a047-0x0;var _0x357cc1=_0x3b19[_0x30a047];return _0x357cc1;};'use strict';var _=require(_0x93b1('0x0'));var moment=require('moment');var util=require(_0x93b1('0x1'));var config=require(_0x93b1('0x2'));var ami=require(_0x93b1('0x3'));var RpcVoiceAgentReport=require(_0x93b1('0x4'));var RpcVoiceCallReport=require(_0x93b1('0x5'));var RpcVoiceDialReport=require('../rpc/voiceDialReport');var RpcMemberReport=require(_0x93b1('0x6'));var RpcVoiceQueueReport=require(_0x93b1('0x7'));var RpcVoiceRecording=require(_0x93b1('0x8'));var RpcVoiceTransferReport=require(_0x93b1('0x9'));var VoiceQueueReport=require(_0x93b1('0xa'));var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require(_0x93b1('0xb'));var VoiceDialReport=require(_0x93b1('0xc'));var UserReport=require(_0x93b1('0xd'));function Report(_0x5aa362){this[_0x93b1('0xe')]=_0x5aa362;this[_0x93b1('0xf')]=_0x5aa362[_0x93b1('0xf')];this[_0x93b1('0x10')]=_0x5aa362[_0x93b1('0x10')];}Report[_0x93b1('0x11')][_0x93b1('0x12')]=function(_0x522545){var _0x370d37=new VoiceQueueReport(this[_0x93b1('0xe')]);var _0x3968d7=new VoiceAgentReport(this[_0x93b1('0xe')]);var _0x405509=new VoiceDialReport(this[_0x93b1('0xe')]);var _0x125994=new VoiceCallReport(this[_0x93b1('0xe')]);var _0x4edf76=new UserReport(this['realtime']);if(config[_0x93b1('0x13')]&&config[_0x93b1('0x13')]['disabled']){ami['on'](_0x93b1('0x14'),this[_0x93b1('0x15')][_0x93b1('0x16')](this));ami['on']('custom:voiceCallReport',this[_0x93b1('0x17')]['bind'](this));ami['on'](_0x93b1('0x18'),this[_0x93b1('0x19')][_0x93b1('0x16')](this));ami['on'](_0x93b1('0x1a'),this[_0x93b1('0x1b')][_0x93b1('0x16')](this));ami['on'](_0x93b1('0x1c'),this[_0x93b1('0x1d')][_0x93b1('0x16')](this));ami['on'](_0x93b1('0x1e'),this[_0x93b1('0x1f')]['bind'](this));}};Report['prototype'][_0x93b1('0x20')]=function(_0x3f6dd3){var _0x118a7e;_0x118a7e=_['find'](this[_0x93b1('0xf')],function(_0x18fbfc){return _0x18fbfc[_0x93b1('0x21')]==_0x3f6dd3||_0x18fbfc['name']==_0x3f6dd3;});if(_[_0x93b1('0x22')](_0x118a7e)){var _0x1ec88f=_['find'](this['telephones'],function(_0x524667){return _0x524667[_0x93b1('0x21')]==_0x3f6dd3||_0x524667[_0x93b1('0x23')]==_0x3f6dd3;});if(_0x1ec88f){_0x118a7e=_[_0x93b1('0x24')](this[_0x93b1('0xf')],function(_0x59bd78){return _0x59bd78[_0x93b1('0x25')]==util[_0x93b1('0x26')]('SIP/%s',_0x1ec88f[_0x93b1('0x23')]);});}}return _0x118a7e;};Report[_0x93b1('0x11')]['voiceQueueReport']=function(_0x472ef3){for(var _0x1cfb82=0x0;_0x1cfb82<_0x472ef3[_0x93b1('0x27')];_0x1cfb82+=0x1){var _0x1850c7=this['findAgent'](_0x472ef3[_0x1cfb82]['connectedlinenum']);if(_0x1850c7){_0x472ef3[_0x1cfb82][_0x93b1('0x21')]=_0x1850c7[_0x93b1('0x21')];_0x472ef3[_0x1cfb82][_0x93b1('0x28')]=!![];_0x472ef3[_0x1cfb82]['lastAssignedTo']=_0x1850c7[_0x93b1('0x23')];_0x472ef3[_0x1cfb82][_0x93b1('0x25')]=_[_0x93b1('0x22')](_0x1850c7['interface'])?util[_0x93b1('0x26')](_0x93b1('0x29'),_0x1850c7[_0x93b1('0x23')]):_0x1850c7['interface'];if(_0x472ef3[_0x1cfb82][_0x93b1('0x2a')]){_0x472ef3[_0x1cfb82][_0x93b1('0x2b')]=moment()['format'](_0x93b1('0x2c'));}if(_0x472ef3[_0x1cfb82][_0x93b1('0x2d')]){_0x472ef3[_0x1cfb82][_0x93b1('0x2e')]=moment()[_0x93b1('0x26')](_0x93b1('0x2c'));}RpcMemberReport[_0x93b1('0x15')](_0x472ef3[_0x1cfb82]);}RpcVoiceQueueReport['create'](_0x472ef3[_0x1cfb82]);}};function extractCalleridNumber(_0x30f0d1){var _0x3f35bc=_0x30f0d1[_0x93b1('0x2f')](/<(.*?)>/);return _0x3f35bc?_0x3f35bc[0x1]:_0x30f0d1;}Report[_0x93b1('0x11')][_0x93b1('0x30')]=function(_0x28bbb7){for(var _0x3f14c5=0x0;_0x3f14c5',_0x557d5a[_0x93b1('0x49')],_0x557d5a[_0x93b1('0x43')]);}if(RpcVoiceTransferReport[_0x93b1('0x4a')][_0x557d5a[_0x93b1('0x4b')]]){var _0x14dfdc=RpcVoiceTransferReport[_0x93b1('0x4a')][_0x557d5a[_0x93b1('0x4b')]];_0x14dfdc[_0x93b1('0x4c')]=_0x557d5a['uniqueid'];RpcVoiceTransferReport[_0x93b1('0x1d')](_0x14dfdc);delete RpcVoiceTransferReport[_0x93b1('0x4a')][_0x557d5a['linkedid']];}if(_[_0x93b1('0x22')](_0x557d5a[_0x93b1('0x38')])){_0x557d5a[_0x93b1('0x38')]=this[_0x93b1('0x32')](_0x557d5a);}if(_[_0x93b1('0x22')](_0x557d5a['UserId'])){var _0x22dee0=_0x557d5a['channel'][_0x93b1('0x34')]('-')[0x0];var _0x340458=this[_0x93b1('0xf')][_0x22dee0];if(!_0x340458)_0x340458=this['getAgentByInternal'](_0x557d5a[_0x93b1('0x21')]);if(_0x340458){_0x557d5a[_0x93b1('0x4d')]=_0x340458['id'];_0x557d5a[_0x93b1('0x4e')]=_0x340458['name'];}}RpcVoiceCallReport[_0x93b1('0x4f')](_0x557d5a);if(_0x557d5a[_0x93b1('0x50')]){for(var _0x187e6f=0x0;_0x187e6f<_0x557d5a[_0x93b1('0x51')][_0x93b1('0x27')];_0x187e6f+=0x1){_0x557d5a['monitorFilename']=_0x557d5a['monitors'][_0x187e6f][_0x93b1('0x52')];_0x557d5a[_0x93b1('0x53')]=_0x557d5a['monitors'][_0x187e6f][_0x93b1('0x53')];if(_0x557d5a['exten']==_0x93b1('0x41')){_0x557d5a[_0x93b1('0x43')]=_0x557d5a[_0x93b1('0x48')];_0x557d5a['calleridname']=_0x557d5a['connectedlinename'];_0x557d5a[_0x93b1('0x48')]=_0x557d5a[_0x93b1('0x21')];_0x557d5a[_0x93b1('0x54')]=_0x557d5a[_0x93b1('0x4e')];_0x557d5a['exten']=_0x557d5a[_0x93b1('0x44')];}else if(_0x557d5a[_0x93b1('0x55')]==_0x93b1('0x56')){_0x557d5a[_0x93b1('0x43')]=_0x557d5a[_0x93b1('0x37')];_0x557d5a[_0x93b1('0x55')]=_0x557d5a[_0x93b1('0x44')];}RpcVoiceRecording[_0x93b1('0x4f')](_0x557d5a);}}};Report[_0x93b1('0x11')][_0x93b1('0x19')]=function(_0x2196c7){if(_[_0x93b1('0x57')](_0x2196c7)){_0x2196c7[_0x93b1('0x58')](function(_0x3ceada){RpcVoiceAgentReport[_0x93b1('0x4f')](_0x3ceada);});}else{RpcVoiceAgentReport['create'](_0x2196c7);}};Report[_0x93b1('0x11')][_0x93b1('0x1b')]=function(_0x434d19){RpcVoiceDialReport[_0x93b1('0x4f')](_0x434d19);var _0x4ee16d;var _0x55f9bd;var _0x4d686c=_0x434d19[_0x93b1('0x33')];if(_[_0x93b1('0x59')](_0x4d686c,_0x93b1('0x5a'))){_0x55f9bd=_0x4d686c[_0x93b1('0x5b')](_0x4d686c[_0x93b1('0x5c')]('/')+0x1,_0x4d686c[_0x93b1('0x5c')]('@'));_0x4ee16d=_[_0x93b1('0x24')](this[_0x93b1('0xf')],function(_0x5dfccd){return _0x5dfccd[_0x93b1('0x5d')]==_0x55f9bd||_0x5dfccd['phone']==_0x55f9bd||_0x5dfccd[_0x93b1('0x21')]==_0x55f9bd;});}else{_0x55f9bd=_0x4d686c[_0x93b1('0x5b')](_0x4d686c[_0x93b1('0x5c')]('/')+0x1,_0x4d686c[_0x93b1('0x5e')]('-'));_0x4ee16d=this[_0x93b1('0x20')](_0x55f9bd);}if(_0x4ee16d){_0x434d19[_0x93b1('0x25')]=_[_0x93b1('0x22')](_0x4ee16d[_0x93b1('0x25')])?util[_0x93b1('0x26')](_0x93b1('0x29'),_0x4ee16d['name']):_0x4ee16d[_0x93b1('0x25')];_0x434d19['membername']=_0x4ee16d[_0x93b1('0x23')];_0x434d19[_0x93b1('0x21')]=_0x4ee16d[_0x93b1('0x21')];RpcMemberReport[_0x93b1('0x1b')](_0x434d19);}};Report['prototype'][_0x93b1('0x1d')]=function(_0x42f2bf){RpcVoiceTransferReport[_0x93b1('0x4a')][_0x42f2bf[_0x93b1('0x5f')]]=_0x42f2bf;};Report[_0x93b1('0x11')][_0x93b1('0x1f')]=function(_0x5bca8d){RpcVoiceTransferReport[_0x93b1('0x1f')](_0x5bca8d);};module['exports']=Report; \ No newline at end of file +var _0xcc25=['linkedid','transfereelinkedid','uniqueid','type','create','monitor','monitors','monitorFilename','filename','createdAt','connectedlinenum','connectedlinename','membername','xcally-motion-dialer','isArray','forEach','startsWith','Local','substring','indexOf','mobile','phone','lastIndexOf','voiceDialReport','transfererlinkedid','exports','lodash','moment','util','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','realtime','agents','telephones','prototype','xdr','custom:voiceQueueReport','voiceQueueReport','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','bind','custom:voiceDialReport','blindtransfer','blindTransfer','attendedTransfer','findAgent','find','accountcode','name','isNil','interface','format','SIP/%s','length','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','match','keys','getCallType','split','getAgentByInternal','calleridnum','outbound','internal','destination','exten','lastapplication','queue','context','from-voip-provider','callerid','xcally-motion-preview','originatecalleridnum','destinationchannel','channel','calleridpreview','disposition','ANSWERED','calleridname','transfers'];(function(_0xfd917b,_0x5783a1){var _0x4202f5=function(_0x3cf391){while(--_0x3cf391){_0xfd917b['push'](_0xfd917b['shift']());}};_0x4202f5(++_0x5783a1);}(_0xcc25,0xd6));var _0x5cc2=function(_0x3898a4,_0x16e387){_0x3898a4=_0x3898a4-0x0;var _0x51a7ec=_0xcc25[_0x3898a4];return _0x51a7ec;};'use strict';var _=require(_0x5cc2('0x0'));var moment=require(_0x5cc2('0x1'));var util=require(_0x5cc2('0x2'));var config=require(_0x5cc2('0x3'));var ami=require(_0x5cc2('0x4'));var RpcVoiceAgentReport=require(_0x5cc2('0x5'));var RpcVoiceCallReport=require(_0x5cc2('0x6'));var RpcVoiceDialReport=require(_0x5cc2('0x7'));var RpcMemberReport=require(_0x5cc2('0x8'));var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require(_0x5cc2('0x9'));var RpcVoiceTransferReport=require(_0x5cc2('0xa'));var VoiceQueueReport=require(_0x5cc2('0xb'));var VoiceCallReport=require(_0x5cc2('0xc'));var VoiceAgentReport=require(_0x5cc2('0xd'));var VoiceDialReport=require(_0x5cc2('0xe'));var UserReport=require('./userReport');function Report(_0x3addbd){this[_0x5cc2('0xf')]=_0x3addbd;this[_0x5cc2('0x10')]=_0x3addbd['agents'];this[_0x5cc2('0x11')]=_0x3addbd[_0x5cc2('0x11')];}Report[_0x5cc2('0x12')]['sync']=function(_0x4e8830){var _0x391718=new VoiceQueueReport(this[_0x5cc2('0xf')]);var _0x1f80f3=new VoiceAgentReport(this[_0x5cc2('0xf')]);var _0x1e01ea=new VoiceDialReport(this[_0x5cc2('0xf')]);var _0x4b6d42=new VoiceCallReport(this[_0x5cc2('0xf')]);var _0x13838c=new UserReport(this['realtime']);if(config[_0x5cc2('0x13')]&&config[_0x5cc2('0x13')]['disabled']){ami['on'](_0x5cc2('0x14'),this[_0x5cc2('0x15')]['bind'](this));ami['on']('custom:voiceCallReport',this[_0x5cc2('0x16')]['bind'](this));ami['on'](_0x5cc2('0x17'),this[_0x5cc2('0x18')][_0x5cc2('0x19')](this));ami['on'](_0x5cc2('0x1a'),this['voiceDialReport'][_0x5cc2('0x19')](this));ami['on'](_0x5cc2('0x1b'),this[_0x5cc2('0x1c')][_0x5cc2('0x19')](this));ami['on']('attendedtransfer',this[_0x5cc2('0x1d')][_0x5cc2('0x19')](this));}};Report[_0x5cc2('0x12')][_0x5cc2('0x1e')]=function(_0x581f98){var _0x19adc7;_0x19adc7=_[_0x5cc2('0x1f')](this[_0x5cc2('0x10')],function(_0x31699c){return _0x31699c[_0x5cc2('0x20')]==_0x581f98||_0x31699c[_0x5cc2('0x21')]==_0x581f98;});if(_[_0x5cc2('0x22')](_0x19adc7)){var _0x2522a7=_[_0x5cc2('0x1f')](this['telephones'],function(_0x584cf7){return _0x584cf7['accountcode']==_0x581f98||_0x584cf7['name']==_0x581f98;});if(_0x2522a7){_0x19adc7=_[_0x5cc2('0x1f')](this[_0x5cc2('0x10')],function(_0x28134b){return _0x28134b[_0x5cc2('0x23')]==util[_0x5cc2('0x24')](_0x5cc2('0x25'),_0x2522a7['name']);});}}return _0x19adc7;};Report[_0x5cc2('0x12')][_0x5cc2('0x15')]=function(_0x21c53e){for(var _0x513072=0x0;_0x513072<_0x21c53e[_0x5cc2('0x26')];_0x513072+=0x1){var _0x3a1586=this[_0x5cc2('0x1e')](_0x21c53e[_0x513072]['connectedlinenum']);if(_0x3a1586){_0x21c53e[_0x513072][_0x5cc2('0x20')]=_0x3a1586[_0x5cc2('0x20')];_0x21c53e[_0x513072]['assigned']=!![];_0x21c53e[_0x513072]['lastAssignedTo']=_0x3a1586[_0x5cc2('0x21')];_0x21c53e[_0x513072][_0x5cc2('0x23')]=_[_0x5cc2('0x22')](_0x3a1586[_0x5cc2('0x23')])?util[_0x5cc2('0x24')](_0x5cc2('0x25'),_0x3a1586['name']):_0x3a1586[_0x5cc2('0x23')];if(_0x21c53e[_0x513072][_0x5cc2('0x27')]){_0x21c53e[_0x513072][_0x5cc2('0x28')]=moment()[_0x5cc2('0x24')](_0x5cc2('0x29'));}if(_0x21c53e[_0x513072][_0x5cc2('0x2a')]){_0x21c53e[_0x513072][_0x5cc2('0x2b')]=moment()[_0x5cc2('0x24')]('YYYY-MM-DD\x20HH:mm:ss');}RpcMemberReport['voiceQueueReport'](_0x21c53e[_0x513072]);}RpcVoiceQueueReport['create'](_0x21c53e[_0x513072]);}};function extractCalleridNumber(_0x1d351d){var _0xe28da2=_0x1d351d[_0x5cc2('0x2c')](/<(.*?)>/);return _0xe28da2?_0xe28da2[0x1]:_0x1d351d;}Report['prototype']['getAgentByInternal']=function(_0x3b7648){for(var _0xc67b46=0x0;_0xc67b46',_0x4c3520[_0x5cc2('0x42')],_0x4c3520[_0x5cc2('0x31')]);}if(RpcVoiceTransferReport[_0x5cc2('0x43')][_0x4c3520['linkedid']]){var _0x4faebe=RpcVoiceTransferReport[_0x5cc2('0x43')][_0x4c3520[_0x5cc2('0x44')]];_0x4faebe[_0x5cc2('0x45')]=_0x4c3520[_0x5cc2('0x46')];RpcVoiceTransferReport[_0x5cc2('0x1c')](_0x4faebe);delete RpcVoiceTransferReport['transfers'][_0x4c3520[_0x5cc2('0x44')]];}if(_['isNil'](_0x4c3520[_0x5cc2('0x47')])){_0x4c3520[_0x5cc2('0x47')]=this[_0x5cc2('0x2e')](_0x4c3520);}if(_[_0x5cc2('0x22')](_0x4c3520['UserId'])){var _0x16822a=_0x4c3520[_0x5cc2('0x3e')][_0x5cc2('0x2f')]('-')[0x0];var _0x3d0c2e=this[_0x5cc2('0x10')][_0x16822a];if(!_0x3d0c2e)_0x3d0c2e=this[_0x5cc2('0x30')](_0x4c3520[_0x5cc2('0x20')]);if(_0x3d0c2e){_0x4c3520['UserId']=_0x3d0c2e['id'];_0x4c3520['membername']=_0x3d0c2e[_0x5cc2('0x21')];}}RpcVoiceCallReport[_0x5cc2('0x48')](_0x4c3520);if(_0x4c3520[_0x5cc2('0x49')]){for(var _0x5335f6=0x0;_0x5335f6<_0x4c3520[_0x5cc2('0x4a')][_0x5cc2('0x26')];_0x5335f6+=0x1){_0x4c3520[_0x5cc2('0x4b')]=_0x4c3520['monitors'][_0x5335f6][_0x5cc2('0x4c')];_0x4c3520[_0x5cc2('0x4d')]=_0x4c3520[_0x5cc2('0x4a')][_0x5335f6]['createdAt'];if(_0x4c3520[_0x5cc2('0x35')]==_0x5cc2('0x3b')){_0x4c3520[_0x5cc2('0x31')]=_0x4c3520[_0x5cc2('0x4e')];_0x4c3520[_0x5cc2('0x42')]=_0x4c3520[_0x5cc2('0x4f')];_0x4c3520[_0x5cc2('0x4e')]=_0x4c3520['accountcode'];_0x4c3520[_0x5cc2('0x4f')]=_0x4c3520[_0x5cc2('0x50')];_0x4c3520[_0x5cc2('0x35')]=_0x4c3520[_0x5cc2('0x3c')];}else if(_0x4c3520[_0x5cc2('0x35')]==_0x5cc2('0x51')){_0x4c3520[_0x5cc2('0x31')]=_0x4c3520[_0x5cc2('0x34')];_0x4c3520[_0x5cc2('0x35')]=_0x4c3520[_0x5cc2('0x3c')];}RpcVoiceRecording[_0x5cc2('0x48')](_0x4c3520);}}};Report[_0x5cc2('0x12')][_0x5cc2('0x18')]=function(_0x2763a1){if(_[_0x5cc2('0x52')](_0x2763a1)){_0x2763a1[_0x5cc2('0x53')](function(_0x2739d3){RpcVoiceAgentReport[_0x5cc2('0x48')](_0x2739d3);});}else{RpcVoiceAgentReport['create'](_0x2763a1);}};Report[_0x5cc2('0x12')]['voiceDialReport']=function(_0x432835){RpcVoiceDialReport['create'](_0x432835);var _0x35863e;var _0x379edf;var _0x12392b=_0x432835['channel'];if(_[_0x5cc2('0x54')](_0x12392b,_0x5cc2('0x55'))){_0x379edf=_0x12392b[_0x5cc2('0x56')](_0x12392b[_0x5cc2('0x57')]('/')+0x1,_0x12392b[_0x5cc2('0x57')]('@'));_0x35863e=_[_0x5cc2('0x1f')](this[_0x5cc2('0x10')],function(_0x582664){return _0x582664[_0x5cc2('0x58')]==_0x379edf||_0x582664[_0x5cc2('0x59')]==_0x379edf||_0x582664['accountcode']==_0x379edf;});}else{_0x379edf=_0x12392b['substring'](_0x12392b[_0x5cc2('0x57')]('/')+0x1,_0x12392b[_0x5cc2('0x5a')]('-'));_0x35863e=this[_0x5cc2('0x1e')](_0x379edf);}if(_0x35863e){_0x432835[_0x5cc2('0x23')]=_[_0x5cc2('0x22')](_0x35863e[_0x5cc2('0x23')])?util['format'](_0x5cc2('0x25'),_0x35863e[_0x5cc2('0x21')]):_0x35863e[_0x5cc2('0x23')];_0x432835[_0x5cc2('0x50')]=_0x35863e[_0x5cc2('0x21')];_0x432835[_0x5cc2('0x20')]=_0x35863e[_0x5cc2('0x20')];RpcMemberReport[_0x5cc2('0x5b')](_0x432835);}};Report[_0x5cc2('0x12')][_0x5cc2('0x1c')]=function(_0x2f791a){RpcVoiceTransferReport['transfers'][_0x2f791a[_0x5cc2('0x5c')]]=_0x2f791a;};Report[_0x5cc2('0x12')]['attendedTransfer']=function(_0x38fd4a){RpcVoiceTransferReport[_0x5cc2('0x1d')](_0x38fd4a);};module[_0x5cc2('0x5d')]=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index 56f1400..185a1ea 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 _0x5c0d=['[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','trunk:save','Local','substring','indexOf','mobile','phone','accountcode','syncPeerStatus','peerstatus','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','peer','address','registered','status','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','[userReport][peerstatus]','exports','lodash','moment','util','ioredis','bluebird','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','localhost','socket.io-emitter','trunks','agents','registryentry','bind','registry','syncRegistry','devicestatechange','syncDeviceState','syncRealtimeShow','then','actionSipShowRegistry','catch','error','[userReport][sipshowregistry]','inspect','resolve','actionDeviceStateList','[userReport][devicestatelist]','actionSipPeerStatus','[userReport][sippeerstatus]','prototype','isNotNull','isUndefined','emit','info','[userReport][registry]\x20registry:%s\x20state:%s','username','state','find','event','actionid','debug','format','trunk:%s','name','device','[userReport][devicestatechange]','inuse','local','toLowerCase','toNumber','updateStatusRealtime','telephones','stateTime','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:%s','telephone:save'];(function(_0x1339a5,_0xc3c830){var _0x4281b2=function(_0x49169c){while(--_0x49169c){_0x1339a5['push'](_0x1339a5['shift']());}};_0x4281b2(++_0xc3c830);}(_0x5c0d,0xb1));var _0xd5c0=function(_0x11a55c,_0x4eced9){_0x11a55c=_0x11a55c-0x0;var _0x26c390=_0x5c0d[_0x11a55c];return _0x26c390;};'use strict';var _=require(_0xd5c0('0x0'));var moment=require(_0xd5c0('0x1'));var util=require(_0xd5c0('0x2'));var Redis=require(_0xd5c0('0x3'));var BPromise=require(_0xd5c0('0x4'));var config=require(_0xd5c0('0x5'));var logger=require(_0xd5c0('0x6'))(_0xd5c0('0x7'));var ami=require(_0xd5c0('0x8'));config[_0xd5c0('0x9')]=_[_0xd5c0('0xa')](config[_0xd5c0('0x9')],{'host':_0xd5c0('0xb'),'port':0x18eb});var io=require(_0xd5c0('0xc'))(new Redis(config[_0xd5c0('0x9')]));function UserReport(_0x140a83){this['trunks']=_0x140a83[_0xd5c0('0xd')];this['agents']=_0x140a83[_0xd5c0('0xe')];this['telephones']=_0x140a83['telephones'];ami['on'](_0xd5c0('0xf'),this['syncRegistry'][_0xd5c0('0x10')](this));ami['on'](_0xd5c0('0x11'),this[_0xd5c0('0x12')][_0xd5c0('0x10')](this));ami['on'](_0xd5c0('0x13'),this[_0xd5c0('0x14')][_0xd5c0('0x10')](this));ami['on']('peerstatus',this['syncPeerStatus'][_0xd5c0('0x10')](this));return this[_0xd5c0('0x15')]();}function showSipRegistrations(){Promise['resolve']()[_0xd5c0('0x16')](ami[_0xd5c0('0x17')]())[_0xd5c0('0x18')](function(_0x4c052e){logger[_0xd5c0('0x19')](_0xd5c0('0x1a'),util[_0xd5c0('0x1b')](_0x4c052e,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0xd5c0('0x1c')]()[_0xd5c0('0x16')](ami[_0xd5c0('0x1d')]())[_0xd5c0('0x18')](function(_0x31d31a){logger['error'](_0xd5c0('0x1e'),util[_0xd5c0('0x1b')](_0x31d31a,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0xd5c0('0x1c')]()['then'](ami[_0xd5c0('0x1f')]())[_0xd5c0('0x18')](function(_0x2beb1a){logger[_0xd5c0('0x19')](_0xd5c0('0x20'),util[_0xd5c0('0x1b')](_0x2beb1a,{'showHidden':![],'depth':null}));});}UserReport[_0xd5c0('0x21')][_0xd5c0('0x15')]=function(){setInterval(function(){BPromise['resolve']()[_0xd5c0('0x16')](showSipRegistrations())[_0xd5c0('0x16')](listDeviceStates())[_0xd5c0('0x16')](showPeersStatus());},0x32c8);};UserReport[_0xd5c0('0x21')][_0xd5c0('0x22')]=function(_0x39f80e){return _0x39f80e!==null&&!_[_0xd5c0('0x23')](_0x39f80e);};UserReport[_0xd5c0('0x21')][_0xd5c0('0x24')]=function(_0x20a49a,_0x1fc334,_0x192bd0){io['to'](_0x20a49a)[_0xd5c0('0x24')](_0x1fc334,_0x192bd0);};UserReport[_0xd5c0('0x21')][_0xd5c0('0x12')]=function(_0x3e0e22){try{if(this[_0xd5c0('0x22')](_0x3e0e22)){logger[_0xd5c0('0x25')](_0xd5c0('0x26'),_0x3e0e22[_0xd5c0('0x27')],_0x3e0e22[_0xd5c0('0x28')]);logger['debug']('[userReport][registry]',util[_0xd5c0('0x1b')](_0x3e0e22,{'showHidden':![],'depth':null}));var _0x38d0e4=_[_0xd5c0('0x29')](this[_0xd5c0('0xd')],{'defaultuser':_0x3e0e22[_0xd5c0('0x27')]});if(_0x38d0e4){_0x3e0e22['stateRegistry']=_0x3e0e22[_0xd5c0('0x28')];_['merge'](_0x38d0e4,_['omit'](_0x3e0e22,[_0xd5c0('0x2a'),_0xd5c0('0x2b'),_0xd5c0('0x27'),_0xd5c0('0x28')]));logger[_0xd5c0('0x2c')]('[userReport][registry]\x20sending\x20trunk:save\x20event:',util[_0xd5c0('0x1b')](_0x38d0e4,{'showHidden':![],'depth':null}));this[_0xd5c0('0x24')](util[_0xd5c0('0x2d')](_0xd5c0('0x2e'),_0x38d0e4[_0xd5c0('0x2f')]),'trunk:save',_0x38d0e4);}}}catch(_0x42eb94){logger[_0xd5c0('0x19')]('[userReport][registry]',util[_0xd5c0('0x1b')](_0x42eb94,{'showHidden':![],'depth':null}));}};UserReport[_0xd5c0('0x21')][_0xd5c0('0x14')]=function(_0x4bfc4c){try{if(this[_0xd5c0('0x22')](_0x4bfc4c)){logger[_0xd5c0('0x25')]('[userReport][devicestatechange]\x20device:%s\x20state:%s',_0x4bfc4c[_0xd5c0('0x30')],_0x4bfc4c[_0xd5c0('0x28')]);logger[_0xd5c0('0x2c')](_0xd5c0('0x31'),util[_0xd5c0('0x1b')](_0x4bfc4c,{'showHidden':![],'depth':null}));if(this[_0xd5c0('0xe')][_0x4bfc4c[_0xd5c0('0x30')]]){if(!this[_0xd5c0('0xe')][_0x4bfc4c[_0xd5c0('0x30')]]['local']||_0x4bfc4c[_0xd5c0('0x28')]['toLowerCase']()==_0xd5c0('0x32')){this[_0xd5c0('0xe')][_0x4bfc4c[_0xd5c0('0x30')]][_0xd5c0('0x33')]=![];if(this[_0xd5c0('0xe')][_0x4bfc4c[_0xd5c0('0x30')]][_0xd5c0('0x28')]!==_0x4bfc4c[_0xd5c0('0x28')][_0xd5c0('0x34')]()){this[_0xd5c0('0xe')][_0x4bfc4c[_0xd5c0('0x30')]]['stateTime']=_[_0xd5c0('0x35')](moment()[_0xd5c0('0x2d')]('x'));}this[_0xd5c0('0xe')][_0x4bfc4c['device']][_0xd5c0('0x28')]=_0x4bfc4c[_0xd5c0('0x28')][_0xd5c0('0x34')]();this[_0xd5c0('0xe')][_0x4bfc4c['device']][_0xd5c0('0x36')](_0x4bfc4c);}}else if(this[_0xd5c0('0x37')][_0x4bfc4c[_0xd5c0('0x30')]]){if(this['telephones'][_0x4bfc4c['device']][_0xd5c0('0x28')]!==_0x4bfc4c[_0xd5c0('0x28')][_0xd5c0('0x34')]()){this[_0xd5c0('0x37')][_0x4bfc4c[_0xd5c0('0x30')]][_0xd5c0('0x38')]=_[_0xd5c0('0x35')](moment()[_0xd5c0('0x2d')]('x'));}this['telephones'][_0x4bfc4c[_0xd5c0('0x30')]][_0xd5c0('0x28')]=_0x4bfc4c[_0xd5c0('0x28')][_0xd5c0('0x34')]();logger[_0xd5c0('0x2c')](_0xd5c0('0x39'),util['inspect'](this[_0xd5c0('0x37')][_0x4bfc4c[_0xd5c0('0x30')]],{'showHidden':![],'depth':null}));this['emit'](util[_0xd5c0('0x2d')](_0xd5c0('0x3a'),this[_0xd5c0('0x37')][_0x4bfc4c[_0xd5c0('0x30')]][_0xd5c0('0x2f')]),_0xd5c0('0x3b'),this[_0xd5c0('0x37')][_0x4bfc4c[_0xd5c0('0x30')]]);}else if(this[_0xd5c0('0xd')][_0x4bfc4c[_0xd5c0('0x30')]]){if(this[_0xd5c0('0xd')][_0x4bfc4c[_0xd5c0('0x30')]][_0xd5c0('0x28')]!==_0x4bfc4c[_0xd5c0('0x28')][_0xd5c0('0x34')]()){this[_0xd5c0('0xd')][_0x4bfc4c[_0xd5c0('0x30')]][_0xd5c0('0x38')]=_[_0xd5c0('0x35')](moment()[_0xd5c0('0x2d')]('x'));}this['trunks'][_0x4bfc4c[_0xd5c0('0x30')]]['state']=_0x4bfc4c[_0xd5c0('0x28')][_0xd5c0('0x34')]();logger[_0xd5c0('0x2c')](_0xd5c0('0x3c'),util[_0xd5c0('0x1b')](this[_0xd5c0('0xd')][_0x4bfc4c['device']],{'showHidden':![],'depth':null}));this[_0xd5c0('0x24')](util['format'](_0xd5c0('0x2e'),this[_0xd5c0('0xd')][_0x4bfc4c[_0xd5c0('0x30')]][_0xd5c0('0x2f')]),_0xd5c0('0x3d'),this[_0xd5c0('0xd')][_0x4bfc4c[_0xd5c0('0x30')]]);}else if(_['startsWith'](_0x4bfc4c[_0xd5c0('0x30')],_0xd5c0('0x3e'))){var _0x2fe920=_0x4bfc4c[_0xd5c0('0x30')];var _0x203b55=_0x2fe920[_0xd5c0('0x3f')](_0x2fe920[_0xd5c0('0x40')]('/')+0x1,_0x2fe920[_0xd5c0('0x40')]('@'));var _0x5ec174=_[_0xd5c0('0x29')](this['agents'],function(_0x19bd32){return _0x19bd32[_0xd5c0('0x41')]==_0x203b55||_0x19bd32[_0xd5c0('0x42')]==_0x203b55||_0x19bd32[_0xd5c0('0x43')]==_0x203b55;});if(_0x5ec174){if(_0x5ec174[_0xd5c0('0x28')]!==_0x4bfc4c[_0xd5c0('0x28')][_0xd5c0('0x34')]()){_0x5ec174[_0xd5c0('0x38')]=_[_0xd5c0('0x35')](moment()['format']('x'));}_0x5ec174[_0xd5c0('0x28')]=_0x4bfc4c[_0xd5c0('0x28')][_0xd5c0('0x34')]();_0x5ec174[_0xd5c0('0x33')]=!![];_0x5ec174[_0xd5c0('0x36')](_0x4bfc4c);}}}}catch(_0x2123a0){logger['error'](_0xd5c0('0x31'),util[_0xd5c0('0x1b')](_0x2123a0,{'showHidden':![],'depth':null}));}};UserReport[_0xd5c0('0x21')][_0xd5c0('0x44')]=function(_0x3dd9ae){try{if(this['isNotNull'](_0x3dd9ae)&&this[_0xd5c0('0x22')](_0x3dd9ae[_0xd5c0('0x45')])){logger[_0xd5c0('0x25')](_0xd5c0('0x46'),_0x3dd9ae[_0xd5c0('0x47')],_0x3dd9ae[_0xd5c0('0x48')],_0x3dd9ae[_0xd5c0('0x45')]);logger['debug']('[userReport][peerstatus]',util['inspect'](_0x3dd9ae,{'showHidden':![],'depth':null}));if(this[_0xd5c0('0xe')][_0x3dd9ae[_0xd5c0('0x47')]]){if(!this[_0xd5c0('0xe')][_0x3dd9ae['peer']][_0xd5c0('0x33')]||_0x3dd9ae['peerstatus'][_0xd5c0('0x34')]()==_0xd5c0('0x49')){this[_0xd5c0('0xe')][_0x3dd9ae[_0xd5c0('0x47')]]['local']=![];this['agents'][_0x3dd9ae[_0xd5c0('0x47')]]['status']=_0x3dd9ae[_0xd5c0('0x45')][_0xd5c0('0x34')]();this['agents'][_0x3dd9ae[_0xd5c0('0x47')]][_0xd5c0('0x48')]=_0x3dd9ae[_0xd5c0('0x48')];this['agents'][_0x3dd9ae[_0xd5c0('0x47')]][_0xd5c0('0x36')](_0x3dd9ae);}}else if(this[_0xd5c0('0x37')][_0x3dd9ae[_0xd5c0('0x47')]]){this[_0xd5c0('0x37')][_0x3dd9ae[_0xd5c0('0x47')]][_0xd5c0('0x4a')]=_0x3dd9ae[_0xd5c0('0x45')][_0xd5c0('0x34')]();this['telephones'][_0x3dd9ae[_0xd5c0('0x47')]][_0xd5c0('0x48')]=_0x3dd9ae['address'];logger[_0xd5c0('0x2c')](_0xd5c0('0x4b'),util[_0xd5c0('0x1b')](this['telephones'][_0x3dd9ae[_0xd5c0('0x47')]],{'showHidden':![],'depth':null}));this[_0xd5c0('0x24')](util[_0xd5c0('0x2d')](_0xd5c0('0x3a'),this['telephones'][_0x3dd9ae[_0xd5c0('0x47')]][_0xd5c0('0x2f')]),_0xd5c0('0x3b'),this[_0xd5c0('0x37')][_0x3dd9ae['peer']]);}else if(this[_0xd5c0('0xd')][_0x3dd9ae[_0xd5c0('0x47')]]){this['trunks'][_0x3dd9ae['peer']]['status']=_0x3dd9ae[_0xd5c0('0x45')][_0xd5c0('0x34')]();this[_0xd5c0('0xd')][_0x3dd9ae[_0xd5c0('0x47')]][_0xd5c0('0x48')]=_0x3dd9ae[_0xd5c0('0x48')];logger[_0xd5c0('0x2c')](_0xd5c0('0x4c'),util[_0xd5c0('0x1b')](this['trunks'][_0x3dd9ae[_0xd5c0('0x47')]],{'showHidden':![],'depth':null}));this['emit'](util[_0xd5c0('0x2d')](_0xd5c0('0x2e'),this['trunks'][_0x3dd9ae['peer']]['name']),_0xd5c0('0x3d'),this[_0xd5c0('0xd')][_0x3dd9ae[_0xd5c0('0x47')]]);}}}catch(_0x36afb3){logger[_0xd5c0('0x19')](_0xd5c0('0x4d'),util[_0xd5c0('0x1b')](_0x36afb3,{'showHidden':![],'depth':null}));}};module[_0xd5c0('0x4e')]=UserReport; \ No newline at end of file +var _0x7cc4=['status','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','exports','moment','util','ioredis','bluebird','../../../config/environment','../../../config/logger','ami','redis','localhost','trunks','agents','telephones','registryentry','syncRegistry','bind','registry','devicestatechange','syncDeviceState','peerstatus','syncRealtimeShow','catch','error','inspect','resolve','then','[userReport][devicestatelist]','actionSipPeerStatus','[userReport][sippeerstatus]','prototype','isNotNull','emit','info','username','state','debug','[userReport][registry]','find','stateRegistry','merge','[userReport][registry]\x20sending\x20trunk:save\x20event:','format','name','trunk:save','[userReport][devicestatechange]\x20device:%s\x20state:%s','device','[userReport][devicestatechange]','inuse','local','toLowerCase','stateTime','toNumber','updateStatusRealtime','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:%s','telephone:save','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','trunk:%s','startsWith','substring','phone','accountcode','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','peer','address','[userReport][peerstatus]','registered'];(function(_0x925e9b,_0x25310c){var _0x31c9ed=function(_0x1ac48e){while(--_0x1ac48e){_0x925e9b['push'](_0x925e9b['shift']());}};_0x31c9ed(++_0x25310c);}(_0x7cc4,0x1a8));var _0x47cc=function(_0x60df74,_0x458e29){_0x60df74=_0x60df74-0x0;var _0x5ee872=_0x7cc4[_0x60df74];return _0x5ee872;};'use strict';var _=require('lodash');var moment=require(_0x47cc('0x0'));var util=require(_0x47cc('0x1'));var Redis=require(_0x47cc('0x2'));var BPromise=require(_0x47cc('0x3'));var config=require(_0x47cc('0x4'));var logger=require(_0x47cc('0x5'))(_0x47cc('0x6'));var ami=require('../ami');config[_0x47cc('0x7')]=_['defaults'](config['redis'],{'host':_0x47cc('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x47cc('0x7')]));function UserReport(_0x30d4f5){this[_0x47cc('0x9')]=_0x30d4f5[_0x47cc('0x9')];this['agents']=_0x30d4f5[_0x47cc('0xa')];this[_0x47cc('0xb')]=_0x30d4f5['telephones'];ami['on'](_0x47cc('0xc'),this[_0x47cc('0xd')][_0x47cc('0xe')](this));ami['on'](_0x47cc('0xf'),this[_0x47cc('0xd')][_0x47cc('0xe')](this));ami['on'](_0x47cc('0x10'),this[_0x47cc('0x11')][_0x47cc('0xe')](this));ami['on'](_0x47cc('0x12'),this['syncPeerStatus'][_0x47cc('0xe')](this));return this[_0x47cc('0x13')]();}function showSipRegistrations(){Promise['resolve']()['then'](ami['actionSipShowRegistry']())[_0x47cc('0x14')](function(_0x528469){logger[_0x47cc('0x15')]('[userReport][sipshowregistry]',util[_0x47cc('0x16')](_0x528469,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0x47cc('0x17')]()[_0x47cc('0x18')](ami['actionDeviceStateList']())[_0x47cc('0x14')](function(_0x58320b){logger[_0x47cc('0x15')](_0x47cc('0x19'),util[_0x47cc('0x16')](_0x58320b,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0x47cc('0x17')]()[_0x47cc('0x18')](ami[_0x47cc('0x1a')]())['catch'](function(_0xc839d0){logger['error'](_0x47cc('0x1b'),util[_0x47cc('0x16')](_0xc839d0,{'showHidden':![],'depth':null}));});}UserReport[_0x47cc('0x1c')][_0x47cc('0x13')]=function(){setInterval(function(){BPromise[_0x47cc('0x17')]()['then'](showSipRegistrations())[_0x47cc('0x18')](listDeviceStates())[_0x47cc('0x18')](showPeersStatus());},0x32c8);};UserReport[_0x47cc('0x1c')][_0x47cc('0x1d')]=function(_0x5ca22e){return _0x5ca22e!==null&&!_['isUndefined'](_0x5ca22e);};UserReport[_0x47cc('0x1c')][_0x47cc('0x1e')]=function(_0x3fbf86,_0x37dc27,_0x2753fe){io['to'](_0x3fbf86)['emit'](_0x37dc27,_0x2753fe);};UserReport[_0x47cc('0x1c')][_0x47cc('0xd')]=function(_0x16c605){try{if(this[_0x47cc('0x1d')](_0x16c605)){logger[_0x47cc('0x1f')]('[userReport][registry]\x20registry:%s\x20state:%s',_0x16c605[_0x47cc('0x20')],_0x16c605[_0x47cc('0x21')]);logger[_0x47cc('0x22')](_0x47cc('0x23'),util['inspect'](_0x16c605,{'showHidden':![],'depth':null}));var _0x577e70=_[_0x47cc('0x24')](this[_0x47cc('0x9')],{'defaultuser':_0x16c605['username']});if(_0x577e70){_0x16c605[_0x47cc('0x25')]=_0x16c605[_0x47cc('0x21')];_[_0x47cc('0x26')](_0x577e70,_['omit'](_0x16c605,['event','actionid',_0x47cc('0x20'),_0x47cc('0x21')]));logger['debug'](_0x47cc('0x27'),util[_0x47cc('0x16')](_0x577e70,{'showHidden':![],'depth':null}));this[_0x47cc('0x1e')](util[_0x47cc('0x28')]('trunk:%s',_0x577e70[_0x47cc('0x29')]),_0x47cc('0x2a'),_0x577e70);}}}catch(_0x2f91db){logger[_0x47cc('0x15')](_0x47cc('0x23'),util[_0x47cc('0x16')](_0x2f91db,{'showHidden':![],'depth':null}));}};UserReport[_0x47cc('0x1c')]['syncDeviceState']=function(_0x131352){try{if(this[_0x47cc('0x1d')](_0x131352)){logger[_0x47cc('0x1f')](_0x47cc('0x2b'),_0x131352[_0x47cc('0x2c')],_0x131352['state']);logger[_0x47cc('0x22')](_0x47cc('0x2d'),util[_0x47cc('0x16')](_0x131352,{'showHidden':![],'depth':null}));if(this[_0x47cc('0xa')][_0x131352['device']]){if(!this[_0x47cc('0xa')][_0x131352['device']]['local']||_0x131352[_0x47cc('0x21')]['toLowerCase']()==_0x47cc('0x2e')){this[_0x47cc('0xa')][_0x131352[_0x47cc('0x2c')]][_0x47cc('0x2f')]=![];if(this[_0x47cc('0xa')][_0x131352[_0x47cc('0x2c')]]['state']!==_0x131352[_0x47cc('0x21')][_0x47cc('0x30')]()){this['agents'][_0x131352['device']][_0x47cc('0x31')]=_[_0x47cc('0x32')](moment()[_0x47cc('0x28')]('x'));}this[_0x47cc('0xa')][_0x131352[_0x47cc('0x2c')]][_0x47cc('0x21')]=_0x131352['state'][_0x47cc('0x30')]();this[_0x47cc('0xa')][_0x131352[_0x47cc('0x2c')]][_0x47cc('0x33')](_0x131352);}}else if(this[_0x47cc('0xb')][_0x131352[_0x47cc('0x2c')]]){if(this['telephones'][_0x131352[_0x47cc('0x2c')]][_0x47cc('0x21')]!==_0x131352['state'][_0x47cc('0x30')]()){this[_0x47cc('0xb')][_0x131352[_0x47cc('0x2c')]][_0x47cc('0x31')]=_['toNumber'](moment()['format']('x'));}this[_0x47cc('0xb')][_0x131352['device']][_0x47cc('0x21')]=_0x131352[_0x47cc('0x21')][_0x47cc('0x30')]();logger[_0x47cc('0x22')](_0x47cc('0x34'),util[_0x47cc('0x16')](this[_0x47cc('0xb')][_0x131352['device']],{'showHidden':![],'depth':null}));this[_0x47cc('0x1e')](util[_0x47cc('0x28')](_0x47cc('0x35'),this[_0x47cc('0xb')][_0x131352['device']][_0x47cc('0x29')]),_0x47cc('0x36'),this[_0x47cc('0xb')][_0x131352[_0x47cc('0x2c')]]);}else if(this['trunks'][_0x131352[_0x47cc('0x2c')]]){if(this[_0x47cc('0x9')][_0x131352[_0x47cc('0x2c')]][_0x47cc('0x21')]!==_0x131352[_0x47cc('0x21')][_0x47cc('0x30')]()){this[_0x47cc('0x9')][_0x131352['device']][_0x47cc('0x31')]=_[_0x47cc('0x32')](moment()[_0x47cc('0x28')]('x'));}this['trunks'][_0x131352[_0x47cc('0x2c')]][_0x47cc('0x21')]=_0x131352['state'][_0x47cc('0x30')]();logger[_0x47cc('0x22')](_0x47cc('0x37'),util[_0x47cc('0x16')](this[_0x47cc('0x9')][_0x131352[_0x47cc('0x2c')]],{'showHidden':![],'depth':null}));this['emit'](util['format'](_0x47cc('0x38'),this['trunks'][_0x131352['device']][_0x47cc('0x29')]),_0x47cc('0x2a'),this[_0x47cc('0x9')][_0x131352[_0x47cc('0x2c')]]);}else if(_[_0x47cc('0x39')](_0x131352[_0x47cc('0x2c')],'Local')){var _0x19eacb=_0x131352[_0x47cc('0x2c')];var _0x3ca656=_0x19eacb[_0x47cc('0x3a')](_0x19eacb['indexOf']('/')+0x1,_0x19eacb['indexOf']('@'));var _0x61b177=_[_0x47cc('0x24')](this[_0x47cc('0xa')],function(_0x38d020){return _0x38d020['mobile']==_0x3ca656||_0x38d020[_0x47cc('0x3b')]==_0x3ca656||_0x38d020[_0x47cc('0x3c')]==_0x3ca656;});if(_0x61b177){if(_0x61b177[_0x47cc('0x21')]!==_0x131352[_0x47cc('0x21')][_0x47cc('0x30')]()){_0x61b177[_0x47cc('0x31')]=_['toNumber'](moment()['format']('x'));}_0x61b177[_0x47cc('0x21')]=_0x131352[_0x47cc('0x21')]['toLowerCase']();_0x61b177['local']=!![];_0x61b177[_0x47cc('0x33')](_0x131352);}}}}catch(_0x35ab10){logger['error'](_0x47cc('0x2d'),util[_0x47cc('0x16')](_0x35ab10,{'showHidden':![],'depth':null}));}};UserReport[_0x47cc('0x1c')]['syncPeerStatus']=function(_0x13188f){try{if(this[_0x47cc('0x1d')](_0x13188f)&&this[_0x47cc('0x1d')](_0x13188f[_0x47cc('0x12')])){logger[_0x47cc('0x1f')](_0x47cc('0x3d'),_0x13188f[_0x47cc('0x3e')],_0x13188f[_0x47cc('0x3f')],_0x13188f['peerstatus']);logger[_0x47cc('0x22')](_0x47cc('0x40'),util['inspect'](_0x13188f,{'showHidden':![],'depth':null}));if(this[_0x47cc('0xa')][_0x13188f['peer']]){if(!this[_0x47cc('0xa')][_0x13188f['peer']][_0x47cc('0x2f')]||_0x13188f['peerstatus']['toLowerCase']()==_0x47cc('0x41')){this[_0x47cc('0xa')][_0x13188f[_0x47cc('0x3e')]][_0x47cc('0x2f')]=![];this[_0x47cc('0xa')][_0x13188f[_0x47cc('0x3e')]][_0x47cc('0x42')]=_0x13188f[_0x47cc('0x12')][_0x47cc('0x30')]();this[_0x47cc('0xa')][_0x13188f[_0x47cc('0x3e')]][_0x47cc('0x3f')]=_0x13188f[_0x47cc('0x3f')];this['agents'][_0x13188f[_0x47cc('0x3e')]]['updateStatusRealtime'](_0x13188f);}}else if(this[_0x47cc('0xb')][_0x13188f[_0x47cc('0x3e')]]){this[_0x47cc('0xb')][_0x13188f['peer']][_0x47cc('0x42')]=_0x13188f[_0x47cc('0x12')]['toLowerCase']();this['telephones'][_0x13188f[_0x47cc('0x3e')]][_0x47cc('0x3f')]=_0x13188f[_0x47cc('0x3f')];logger['debug'](_0x47cc('0x43'),util[_0x47cc('0x16')](this[_0x47cc('0xb')][_0x13188f[_0x47cc('0x3e')]],{'showHidden':![],'depth':null}));this[_0x47cc('0x1e')](util['format']('telephone:%s',this[_0x47cc('0xb')][_0x13188f[_0x47cc('0x3e')]]['name']),_0x47cc('0x36'),this[_0x47cc('0xb')][_0x13188f['peer']]);}else if(this[_0x47cc('0x9')][_0x13188f[_0x47cc('0x3e')]]){this[_0x47cc('0x9')][_0x13188f[_0x47cc('0x3e')]][_0x47cc('0x42')]=_0x13188f[_0x47cc('0x12')][_0x47cc('0x30')]();this[_0x47cc('0x9')][_0x13188f['peer']]['address']=_0x13188f[_0x47cc('0x3f')];logger[_0x47cc('0x22')](_0x47cc('0x44'),util[_0x47cc('0x16')](this['trunks'][_0x13188f[_0x47cc('0x3e')]],{'showHidden':![],'depth':null}));this[_0x47cc('0x1e')](util[_0x47cc('0x28')](_0x47cc('0x38'),this['trunks'][_0x13188f[_0x47cc('0x3e')]][_0x47cc('0x29')]),_0x47cc('0x2a'),this[_0x47cc('0x9')][_0x13188f[_0x47cc('0x3e')]]);}}}catch(_0x1786bd){logger[_0x47cc('0x15')](_0x47cc('0x40'),util[_0x47cc('0x16')](_0x1786bd,{'showHidden':![],'depth':null}));}};module[_0x47cc('0x45')]=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index 9b9edc2..cb893b3 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 _0x8c46=['[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20event:','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','complete','transfer','agent','talktime','acw','acwtime','agentacw','omit','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','custom:agentcomplete','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','destaccountcode','[%s][voiceAgentReport][agentcomplete]','syncVarSet','[%s][voiceAgentReport][varset]\x20event:','addVariable','keys','variable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','[%s][voiceAgentReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','membercalls','memberdynamic','memberpenalty','memberrealtime','isNil','[%s][voiceAgentReport][hangup]\x20event:','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','agentcompleteAt','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','custom:voiceAgentReport','values','[%s][voiceAgentReport][hangup]','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','secondtransfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','seconds','[%s][voiceAgentReport][blindtransfer]','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','substring','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstart]','[%s][voiceAgentReport][musiconholdstop]\x20event:','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','exports','lodash','util','ioredis','../../../config/environment','../../../config/logger','../ami','redis','defaults','channels','voiceQueues','agents','variables','bind','syncAgentConnect','agentringnoanswer','syncAgentRingNoAnswer','queuecallerabandon','syncQueueCallerAbandon','syncAgentComplete','varset','hangup','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','prototype','emit','isUndefined','syncAgentCalled','info','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','uniqueid','membername','[%s][voiceAgentReport][agentcalled]\x20event:','interface','destuniqueid','queue','YYYY-MM-DD\x20HH:mm:ss','called','mandatoryDisposition','type','voice','assign','privilege','debug','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','inspect','format','user:%s','[%s][voiceAgentReport][agentcalled]','isNotNull','hasOwnProperty','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','lastevent','voiceChannels','routealias','pick','destconnectedlinenum','name','accountcode','exten','custom:agentconnect','user:agentconnect','agentcomplete','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswerAt','answeredelsewheredestinationuniqueid','answered_elsewhere','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','[%s][voiceAgentReport][agentconnect]\x20Else\x20path\x20should\x20never\x20be\x20taken','error','[%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','reason','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon'];(function(_0x3801e6,_0x187b49){var _0x2284a9=function(_0x3933c8){while(--_0x3933c8){_0x3801e6['push'](_0x3801e6['shift']());}};_0x2284a9(++_0x187b49);}(_0x8c46,0xdd));var _0x68c4=function(_0x3ca476,_0x3066a0){_0x3ca476=_0x3ca476-0x0;var _0x32f811=_0x8c46[_0x3ca476];return _0x32f811;};'use strict';var _=require(_0x68c4('0x0'));var moment=require('moment');var util=require(_0x68c4('0x1'));var Redis=require(_0x68c4('0x2'));var config=require(_0x68c4('0x3'));var logger=require(_0x68c4('0x4'))('ami');var ami=require(_0x68c4('0x5'));config[_0x68c4('0x6')]=_[_0x68c4('0x7')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x68c4('0x6')]));function VoiceAgentReport(_0x2bc641){this[_0x68c4('0x8')]={};this['voiceChannels']=_0x2bc641[_0x68c4('0x8')];this[_0x68c4('0x9')]=_0x2bc641[_0x68c4('0x9')];this['agents']=_0x2bc641[_0x68c4('0xa')];this[_0x68c4('0xb')]={};ami['on']('agentcalled',this['syncAgentCalled'][_0x68c4('0xc')](this));ami['on']('agentconnect',this[_0x68c4('0xd')][_0x68c4('0xc')](this));ami['on'](_0x68c4('0xe'),this[_0x68c4('0xf')]['bind'](this));ami['on'](_0x68c4('0x10'),this[_0x68c4('0x11')][_0x68c4('0xc')](this));ami['on']('agentcomplete',this[_0x68c4('0x12')][_0x68c4('0xc')](this));ami['on'](_0x68c4('0x13'),this['syncVarSet'][_0x68c4('0xc')](this));ami['on'](_0x68c4('0x14'),this['syncHangup'][_0x68c4('0xc')](this));ami['on']('musiconholdstart',this[_0x68c4('0x15')][_0x68c4('0xc')](this));ami['on'](_0x68c4('0x16'),this[_0x68c4('0x17')]['bind'](this));ami['on'](_0x68c4('0x18'),this[_0x68c4('0x19')][_0x68c4('0xc')](this));ami['on'](_0x68c4('0x1a'),this[_0x68c4('0x1b')]['bind'](this));}VoiceAgentReport[_0x68c4('0x1c')][_0x68c4('0x1d')]=function(_0xe0fbf0,_0x1a6045,_0x3c0806){io['to'](_0xe0fbf0)['emit'](_0x1a6045,_0x3c0806);};VoiceAgentReport['prototype']['isNotNull']=function(_0x3f9d46){return _0x3f9d46!==null&&!_[_0x68c4('0x1e')](_0x3f9d46);};VoiceAgentReport['prototype'][_0x68c4('0x1f')]=function(_0x218cd2){try{if(this['isNotNull'](_0x218cd2)){logger[_0x68c4('0x20')](_0x68c4('0x21'),_0x218cd2[_0x68c4('0x22')],_0x218cd2[_0x68c4('0x23')],_0x218cd2['destuniqueid']);logger['debug'](_0x68c4('0x24'),_0x218cd2[_0x68c4('0x22')],util['inspect'](_0x218cd2,{'showHidden':![],'depth':null}));if(_[_0x68c4('0x1e')](this[_0x68c4('0x8')][_0x218cd2[_0x68c4('0x22')]])){this['channels'][_0x218cd2[_0x68c4('0x22')]]={};}var _0x10bbef=this['agents'][_0x218cd2[_0x68c4('0x25')]];var _0x572b64=this['channels'][_0x218cd2[_0x68c4('0x22')]][_0x218cd2[_0x68c4('0x26')]];var _0x2a37c8=this[_0x68c4('0x9')][_0x218cd2[_0x68c4('0x27')]];var _0x3c5e4b=this[_0x68c4('0xb')][_0x218cd2[_0x68c4('0x22')]];if(_[_0x68c4('0x1e')](_0x572b64)){_0x572b64={'agentcalledAt':moment()['format'](_0x68c4('0x28')),'lastevent':_0x68c4('0x29'),'mandatoryDisposition':_0x2a37c8&&_0x2a37c8[_0x68c4('0x2a')]?_0x2a37c8[_0x68c4('0x2a')]:![],'type':_0x2a37c8&&_0x2a37c8['type']?_0x2a37c8[_0x68c4('0x2b')]:'inbound','variables':_0x3c5e4b,'motionChannel':_0x68c4('0x2c')};}Object[_0x68c4('0x2d')](_0x572b64,_['omit'](_0x218cd2,['event',_0x68c4('0x2e')]));this[_0x68c4('0x8')][_0x218cd2[_0x68c4('0x22')]][_0x218cd2[_0x68c4('0x26')]]=_0x572b64;logger[_0x68c4('0x2f')](_0x68c4('0x30'),_0x218cd2[_0x68c4('0x22')],util['inspect'](_0x572b64,{'showHidden':![],'depth':null}));ami[_0x68c4('0x1d')](_0x68c4('0x31'),_0x572b64);var _0x33c2d9={'id':_0x10bbef['id'],'calleridnum':_0x572b64['calleridnum'],'queue':_0x572b64[_0x68c4('0x27')],'variables':_0x572b64[_0x68c4('0xb')],'uniqueid':_0x218cd2[_0x68c4('0x22')]};logger['debug'](_0x68c4('0x32'),_0x218cd2['uniqueid'],util[_0x68c4('0x33')](_0x33c2d9,{'showHidden':![],'depth':null}));this['emit'](util[_0x68c4('0x34')](_0x68c4('0x35'),_0x218cd2[_0x68c4('0x23')]),'user:called',_0x33c2d9);}}catch(_0x23f9de){logger['error'](_0x68c4('0x36'),_0x218cd2['uniqueid'],util[_0x68c4('0x33')](_0x23f9de,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncAgentConnect']=function(_0x4e6295){try{if(this[_0x68c4('0x37')](_0x4e6295)){if(this[_0x68c4('0x8')][_0x4e6295[_0x68c4('0x22')]]){for(var _0x368d2c in this[_0x68c4('0x8')][_0x4e6295[_0x68c4('0x22')]]){if(this[_0x68c4('0x8')][_0x4e6295['uniqueid']][_0x68c4('0x38')](_0x368d2c)){if(_0x4e6295[_0x68c4('0x26')]===_0x368d2c){logger[_0x68c4('0x20')]('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x4e6295[_0x68c4('0x22')],_0x4e6295[_0x68c4('0x23')],_0x4e6295[_0x68c4('0x26')]);this[_0x68c4('0x8')][_0x4e6295[_0x68c4('0x22')]][_0x368d2c][_0x68c4('0x39')]=moment()[_0x68c4('0x34')](_0x68c4('0x28'));this['channels'][_0x4e6295[_0x68c4('0x22')]][_0x368d2c][_0x68c4('0x3a')]=_0x4e6295[_0x68c4('0x3a')];this['channels'][_0x4e6295[_0x68c4('0x22')]][_0x368d2c]['connectedlinenum']=_0x4e6295[_0x68c4('0x3b')];this[_0x68c4('0x8')][_0x4e6295[_0x68c4('0x22')]][_0x368d2c][_0x68c4('0x3c')]=_0x4e6295['destchannelstate'];this['channels'][_0x4e6295[_0x68c4('0x22')]][_0x368d2c][_0x68c4('0x3d')]=_0x4e6295['destchannelstatedesc'];this['channels'][_0x4e6295[_0x68c4('0x22')]][_0x368d2c]['holdtime']=_0x4e6295[_0x68c4('0x3e')];this['channels'][_0x4e6295['uniqueid']][_0x368d2c][_0x68c4('0x3f')]='connect';if(this[_0x68c4('0x40')][this['channels'][_0x4e6295['uniqueid']][_0x368d2c]['uniqueid']]){var _0x306823=this[_0x68c4('0x40')][this[_0x68c4('0x8')][_0x4e6295[_0x68c4('0x22')]][_0x368d2c][_0x68c4('0x22')]]['routealias'];this[_0x68c4('0x8')][_0x4e6295[_0x68c4('0x22')]][_0x368d2c][_0x68c4('0x41')]=_0x306823;_0x4e6295['routealias']=_0x306823;}_['merge'](this[_0x68c4('0xa')][_0x4e6295[_0x68c4('0x25')]],_[_0x68c4('0x42')](_0x4e6295,['queue',_0x68c4('0x43'),_0x68c4('0x41')]));var _0x4f8a36=this[_0x68c4('0xa')][_0x4e6295['interface']];var _0x1771d1={'id':_0x4f8a36['id'],'name':_0x4f8a36[_0x68c4('0x44')],'agentconnected':!![],'destaccountcode':_0x4f8a36[_0x68c4('0x45')],'destconnectedlinenum':this[_0x68c4('0x8')][_0x4e6295['uniqueid']][_0x4e6295['destuniqueid']][_0x68c4('0x46')],'queue':this[_0x68c4('0x8')][_0x4e6295[_0x68c4('0x22')]][_0x4e6295[_0x68c4('0x26')]][_0x68c4('0x27')],'routealias':this[_0x68c4('0x8')][_0x4e6295[_0x68c4('0x22')]][_0x4e6295[_0x68c4('0x26')]][_0x68c4('0x41')],'uniqueid':this[_0x68c4('0x8')][_0x4e6295[_0x68c4('0x22')]][_0x4e6295[_0x68c4('0x26')]]['uniqueid']};ami['emit'](_0x68c4('0x47'),this[_0x68c4('0x8')][_0x4e6295[_0x68c4('0x22')]][_0x4e6295[_0x68c4('0x26')]]);this[_0x68c4('0x1d')](util[_0x68c4('0x34')](_0x68c4('0x35'),_0x4e6295[_0x68c4('0x23')]),_0x68c4('0x48'),_0x1771d1);}else if(!this['channels'][_0x4e6295[_0x68c4('0x22')]][_0x368d2c][_0x68c4('0xe')]&&!this[_0x68c4('0x8')][_0x4e6295[_0x68c4('0x22')]][_0x368d2c][_0x68c4('0x49')]){logger['info'](_0x68c4('0x4a'),_0x4e6295[_0x68c4('0x22')],this[_0x68c4('0x8')][_0x4e6295[_0x68c4('0x22')]][_0x368d2c][_0x68c4('0x23')],_0x368d2c);this[_0x68c4('0x8')][_0x4e6295['uniqueid']][_0x368d2c][_0x68c4('0xe')]=!![];this[_0x68c4('0x8')][_0x4e6295['uniqueid']][_0x368d2c][_0x68c4('0x4b')]=moment()[_0x68c4('0x34')](_0x68c4('0x28'));this[_0x68c4('0x8')][_0x4e6295[_0x68c4('0x22')]][_0x368d2c][_0x68c4('0x4c')]=_0x4e6295[_0x68c4('0x26')];this['channels'][_0x4e6295[_0x68c4('0x22')]][_0x368d2c]['answeredelsewheremembername']=_0x4e6295[_0x68c4('0x23')];this[_0x68c4('0x8')][_0x4e6295[_0x68c4('0x22')]][_0x368d2c]['lastevent']=_0x68c4('0x4d');this[_0x68c4('0x8')][_0x4e6295[_0x68c4('0x22')]][_0x368d2c]['reason']='answered_elsewhere';logger[_0x68c4('0x2f')](_0x68c4('0x4e'),_0x4e6295['uniqueid'],util[_0x68c4('0x33')](this[_0x68c4('0x8')][_0x4e6295['uniqueid']][_0x368d2c],{'showHidden':![],'depth':null}));ami[_0x68c4('0x1d')](_0x68c4('0x4f'),this[_0x68c4('0x8')][_0x4e6295['uniqueid']][_0x368d2c]);}else{logger[_0x68c4('0x2f')](_0x68c4('0x50'),_0x4e6295[_0x68c4('0x22')]);}}}}}}catch(_0x303532){logger[_0x68c4('0x51')]('[%s][voiceAgentReport][agentconnect]',_0x4e6295['uniqueid'],util[_0x68c4('0x33')](_0x303532,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncAgentRingNoAnswer']=function(_0x42714b){try{if(this[_0x68c4('0x37')](_0x42714b)){logger[_0x68c4('0x2f')](_0x68c4('0x52'),_0x42714b[_0x68c4('0x22')],util[_0x68c4('0x33')](_0x42714b,{'showHidden':![],'depth':null}));if(this[_0x68c4('0x8')][_0x42714b[_0x68c4('0x22')]]&&this['channels'][_0x42714b[_0x68c4('0x22')]][_0x42714b[_0x68c4('0x26')]]){logger[_0x68c4('0x20')]('[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected',_0x42714b['uniqueid'],_0x42714b[_0x68c4('0x23')],_0x42714b['destuniqueid']);var _0x4ce1a3=this[_0x68c4('0xa')][_0x42714b[_0x68c4('0x25')]];var _0x112601=this[_0x68c4('0x8')][_0x42714b[_0x68c4('0x22')]][_0x42714b[_0x68c4('0x26')]];_0x112601[_0x68c4('0xe')]=!![];_0x112601['agentringnoanswerAt']=moment()['format'](_0x68c4('0x28'));_0x112601[_0x68c4('0x3f')]=_0x68c4('0x53');_0x112601['reason']=_0x68c4('0x53');var _0x31f519={'id':_0x4ce1a3['id'],'name':_0x4ce1a3[_0x68c4('0x44')],'queue':_0x112601[_0x68c4('0x27')],'uniqueid':_0x112601[_0x68c4('0x22')]};logger[_0x68c4('0x2f')](_0x68c4('0x54'),_0x42714b[_0x68c4('0x22')],util[_0x68c4('0x33')](_0x31f519,{'showHidden':![],'depth':null}));this[_0x68c4('0x1d')](util[_0x68c4('0x34')](_0x68c4('0x35'),_0x4ce1a3[_0x68c4('0x44')]),_0x68c4('0x55'),_0x31f519);ami[_0x68c4('0x1d')](_0x68c4('0x56'),_0x112601);this['channels'][_0x42714b['uniqueid']][_0x42714b[_0x68c4('0x26')]]=Object[_0x68c4('0x2d')]({},_0x112601);}}}catch(_0x455579){logger['error']('[%s][voiceAgentReport][agentringnoanswer]',_0x42714b[_0x68c4('0x22')],util[_0x68c4('0x33')](_0x455579,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x68c4('0x1c')][_0x68c4('0x11')]=function(_0x294516){try{if(this[_0x68c4('0x37')](_0x294516)){logger['debug'](_0x68c4('0x57'),_0x294516[_0x68c4('0x22')],util['inspect'](_0x294516,{'showHidden':![],'depth':null}));if(this[_0x68c4('0x8')][_0x294516[_0x68c4('0x22')]]){for(var _0x26cb72 in this[_0x68c4('0x8')][_0x294516[_0x68c4('0x22')]]){if(this[_0x68c4('0x8')][_0x294516[_0x68c4('0x22')]][_0x68c4('0x38')](_0x26cb72)&&!this[_0x68c4('0x8')][_0x294516['uniqueid']][_0x26cb72]['agentringnoanswer']&&!this[_0x68c4('0x8')][_0x294516['uniqueid']][_0x26cb72][_0x68c4('0x49')]){logger['info'](_0x68c4('0x58'),_0x294516[_0x68c4('0x22')],this['channels'][_0x294516['uniqueid']][_0x26cb72][_0x68c4('0x23')],_0x26cb72);this[_0x68c4('0x8')][_0x294516[_0x68c4('0x22')]][_0x26cb72][_0x68c4('0xe')]=!![];this['channels'][_0x294516[_0x68c4('0x22')]][_0x26cb72][_0x68c4('0x4b')]=moment()[_0x68c4('0x34')](_0x68c4('0x28'));this[_0x68c4('0x8')][_0x294516[_0x68c4('0x22')]][_0x26cb72][_0x68c4('0x3f')]='abandoned';this['channels'][_0x294516['uniqueid']][_0x26cb72][_0x68c4('0x59')]=_0x68c4('0x5a');logger[_0x68c4('0x2f')](_0x68c4('0x5b'),_0x294516[_0x68c4('0x22')],util['inspect'](this[_0x68c4('0x8')][_0x294516[_0x68c4('0x22')]][_0x26cb72],{'showHidden':![],'depth':null}));ami[_0x68c4('0x1d')](_0x68c4('0x5c'),this['channels'][_0x294516[_0x68c4('0x22')]][_0x26cb72]);}}}}}catch(_0x5c8149){logger[_0x68c4('0x51')](_0x68c4('0x5d'),_0x294516[_0x68c4('0x22')],util[_0x68c4('0x33')](_0x5c8149,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncAgentComplete']=function(_0x221ce4){try{if(this[_0x68c4('0x37')](_0x221ce4)){logger[_0x68c4('0x2f')](_0x68c4('0x5e'),_0x221ce4[_0x68c4('0x22')],util[_0x68c4('0x33')](_0x221ce4,{'showHidden':![],'depth':null}));if(this[_0x68c4('0x8')][_0x221ce4[_0x68c4('0x22')]]){for(var _0x10a3e3 in this[_0x68c4('0x8')][_0x221ce4[_0x68c4('0x22')]]){if(this[_0x68c4('0x8')][_0x221ce4['uniqueid']]['hasOwnProperty'](_0x10a3e3)){if(this['channels'][_0x221ce4[_0x68c4('0x22')]][_0x10a3e3][_0x68c4('0x39')]&&!this[_0x68c4('0x8')][_0x221ce4[_0x68c4('0x22')]][_0x10a3e3]['agentcomplete']){logger[_0x68c4('0x20')](_0x68c4('0x5f'),_0x221ce4[_0x68c4('0x22')],this[_0x68c4('0x8')][_0x221ce4['uniqueid']][_0x10a3e3]['membername'],_0x10a3e3);this[_0x68c4('0x8')][_0x221ce4['uniqueid']][_0x10a3e3]['agentcomplete']=!![];this[_0x68c4('0x8')][_0x221ce4[_0x68c4('0x22')]][_0x10a3e3]['agentcompleteAt']=moment()[_0x68c4('0x34')](_0x68c4('0x28'));this['channels'][_0x221ce4[_0x68c4('0x22')]][_0x10a3e3][_0x68c4('0x3f')]=_0x68c4('0x60');this[_0x68c4('0x8')][_0x221ce4['uniqueid']][_0x10a3e3][_0x68c4('0x59')]=_0x221ce4['reason']==_0x68c4('0x61')?_0x68c4('0x62'):_0x221ce4[_0x68c4('0x59')];this[_0x68c4('0x8')][_0x221ce4[_0x68c4('0x22')]][_0x10a3e3][_0x68c4('0x63')]=_0x221ce4[_0x68c4('0x63')];if(this['voiceQueues'][_0x221ce4[_0x68c4('0x27')]]&&this[_0x68c4('0x9')][_0x221ce4[_0x68c4('0x27')]][_0x68c4('0x64')]){this[_0x68c4('0x8')][_0x221ce4[_0x68c4('0x22')]][_0x10a3e3][_0x68c4('0x65')]=this[_0x68c4('0x9')][_0x221ce4['queue']]['acwTimeout'];this['channels'][_0x221ce4[_0x68c4('0x22')]][_0x10a3e3][_0x68c4('0x66')]=!![];}this[_0x68c4('0xa')][_0x221ce4[_0x68c4('0x25')]]=_[_0x68c4('0x67')](this[_0x68c4('0xa')][_0x221ce4[_0x68c4('0x25')]],['queue',_0x68c4('0x43')]);logger[_0x68c4('0x2f')](_0x68c4('0x68'),_0x221ce4[_0x68c4('0x22')],util['inspect'](this[_0x68c4('0x8')][_0x221ce4[_0x68c4('0x22')]][_0x10a3e3],{'showHidden':![],'depth':null}));ami[_0x68c4('0x1d')](_0x68c4('0x69'),this[_0x68c4('0x8')][_0x221ce4[_0x68c4('0x22')]][_0x10a3e3]);logger[_0x68c4('0x2f')](_0x68c4('0x6a'),_0x221ce4[_0x68c4('0x22')],util[_0x68c4('0x33')]({'id':this[_0x68c4('0xa')][_0x221ce4[_0x68c4('0x25')]]['id'],'destaccountcode':_0x221ce4[_0x68c4('0x6b')]},{'showHidden':![],'depth':null}));this['emit'](util[_0x68c4('0x34')](_0x68c4('0x35'),_0x221ce4['membername']),'user:agentcomplete',{'id':this[_0x68c4('0xa')][_0x221ce4[_0x68c4('0x25')]]['id'],'destaccountcode':Number(_0x221ce4['destaccountcode'])});}}}}}}catch(_0x1f8130){logger[_0x68c4('0x51')](_0x68c4('0x6c'),_0x221ce4[_0x68c4('0x22')],util[_0x68c4('0x33')](_0x1f8130,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x68c4('0x1c')][_0x68c4('0x6d')]=function(_0x5d104d){try{if(this[_0x68c4('0x37')](_0x5d104d)){logger[_0x68c4('0x2f')](_0x68c4('0x6e'),_0x5d104d['uniqueid'],util[_0x68c4('0x33')](_0x5d104d,{'showHidden':![],'depth':null}));this[_0x68c4('0x6f')](_0x5d104d[_0x68c4('0x22')],_[_0x68c4('0x70')](_0x5d104d[_0x68c4('0x71')])[0x0],_0x5d104d[_0x68c4('0x72')]);if(this[_0x68c4('0x8')][_0x5d104d['uniqueid']]){for(var _0x3a5151 in this[_0x68c4('0x8')][_0x5d104d[_0x68c4('0x22')]]){if(this[_0x68c4('0x8')][_0x5d104d[_0x68c4('0x22')]][_0x68c4('0x38')](_0x3a5151)){logger[_0x68c4('0x20')](_0x68c4('0x73'),_0x5d104d[_0x68c4('0x22')],_0x3a5151,_[_0x68c4('0x70')](_0x5d104d['variable'])[0x0],_0x5d104d[_0x68c4('0x72')]);if(_['isUndefined'](this[_0x68c4('0x8')][_0x5d104d[_0x68c4('0x22')]][_0x3a5151][_0x68c4('0xb')])){this[_0x68c4('0x8')][_0x5d104d[_0x68c4('0x22')]][_0x3a5151][_0x68c4('0xb')]={};}this[_0x68c4('0x8')][_0x5d104d['uniqueid']][_0x3a5151][_0x68c4('0xb')]=this['variables'][_0x5d104d['uniqueid']];}}}}}catch(_0x5203b7){logger['error'](_0x68c4('0x74'),_0x5d104d[_0x68c4('0x22')],util['inspect'](_0x5203b7,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x68c4('0x1c')]['addVariable']=function(_0x53bc78,_0x947c6f,_0x161ab9){var _0x5ab537=[_0x68c4('0x75'),_0x68c4('0x76'),'rtpaudioqosjitter',_0x68c4('0x77'),_0x68c4('0x78'),'rtpaudioqoslossbridged','rtpaudioqosrtt',_0x68c4('0x79'),_0x68c4('0x7a'),_0x68c4('0x7b'),_0x68c4('0x7c'),'bridgepvtcallid',_0x68c4('0x7d'),_0x68c4('0x7e'),'memberinterface','memberlastcall',_0x68c4('0x23'),_0x68c4('0x7f'),_0x68c4('0x80')];if(!_[_0x68c4('0x81')](_0x947c6f)&&!_['includes'](_0x5ab537,_0x947c6f)){if(_[_0x68c4('0x1e')](this['variables'][_0x53bc78])){this[_0x68c4('0xb')][_0x53bc78]={};}this[_0x68c4('0xb')][_0x53bc78][_0x947c6f]=_0x161ab9;}};VoiceAgentReport[_0x68c4('0x1c')]['syncHangup']=function(_0x18b9ec){try{if(this[_0x68c4('0x37')](_0x18b9ec)){logger[_0x68c4('0x2f')](_0x68c4('0x82'),_0x18b9ec[_0x68c4('0x22')],util[_0x68c4('0x33')](_0x18b9ec,{'showHidden':![],'depth':null}));if(this[_0x68c4('0x8')][_0x18b9ec[_0x68c4('0x22')]]){for(var _0x34b7db in this[_0x68c4('0x8')][_0x18b9ec[_0x68c4('0x22')]]){if(this[_0x68c4('0x8')][_0x18b9ec[_0x68c4('0x22')]][_0x68c4('0x38')](_0x34b7db)){if(this['channels'][_0x18b9ec[_0x68c4('0x22')]][_0x34b7db]['reason']=='transfer'&&this['channels'][_0x18b9ec[_0x68c4('0x22')]][_0x34b7db]['agentcomplete']){logger['info'](_0x68c4('0x83'),_0x18b9ec[_0x68c4('0x22')],_0x34b7db);this['channels'][_0x18b9ec['uniqueid']][_0x34b7db][_0x68c4('0x84')]=moment()[_0x68c4('0x34')](_0x68c4('0x28'));}}}logger[_0x68c4('0x2f')](_0x68c4('0x85'),_0x18b9ec['uniqueid'],util['inspect'](_['values'](this[_0x68c4('0x8')][_0x18b9ec[_0x68c4('0x22')]]),{'showHidden':![],'depth':null}));ami['emit'](_0x68c4('0x86'),_[_0x68c4('0x87')](this[_0x68c4('0x8')][_0x18b9ec[_0x68c4('0x22')]]));delete this['channels'][_0x18b9ec['uniqueid']];}if(this[_0x68c4('0xb')][_0x18b9ec['uniqueid']]){delete this[_0x68c4('0xb')][_0x18b9ec['uniqueid']];}}}catch(_0x4fb13a){logger[_0x68c4('0x51')](_0x68c4('0x88'),_0x18b9ec['uniqueid'],util[_0x68c4('0x33')](_0x4fb13a,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x68c4('0x1c')]['syncAttendedTransfer']=function(_0x14c7a2){try{if(this[_0x68c4('0x37')](_0x14c7a2)){logger['debug'](_0x68c4('0x89'),_0x14c7a2[_0x68c4('0x22')],util[_0x68c4('0x33')](_0x14c7a2,{'showHidden':![],'depth':null}));if(this[_0x68c4('0x8')][_0x14c7a2[_0x68c4('0x8a')]]){for(var _0x3d9d3d in this[_0x68c4('0x8')][_0x14c7a2[_0x68c4('0x8a')]]){if(this[_0x68c4('0x8')][_0x14c7a2[_0x68c4('0x8a')]][_0x68c4('0x38')](_0x3d9d3d)){if(_0x14c7a2[_0x68c4('0x8b')]===_0x3d9d3d){logger['info'](_0x68c4('0x8c'),_0x14c7a2['uniqueid'],this['channels'][_0x14c7a2[_0x68c4('0x8a')]][_0x3d9d3d]['membername'],_0x3d9d3d);var _0x4512b7=moment();this[_0x68c4('0x8')][_0x14c7a2[_0x68c4('0x8a')]][_0x3d9d3d][_0x68c4('0x49')]=!![];this[_0x68c4('0x8')][_0x14c7a2[_0x68c4('0x8a')]][_0x3d9d3d][_0x68c4('0x84')]=moment()[_0x68c4('0x34')](_0x68c4('0x28'));this[_0x68c4('0x8')][_0x14c7a2['transfereeuniqueid']][_0x3d9d3d][_0x68c4('0x3f')]=_0x68c4('0x60');this[_0x68c4('0x8')][_0x14c7a2[_0x68c4('0x8a')]][_0x3d9d3d][_0x68c4('0x59')]=_0x68c4('0x61');this[_0x68c4('0x8')][_0x14c7a2['transfereeuniqueid']][_0x3d9d3d][_0x68c4('0x63')]=_0x4512b7[_0x68c4('0x8d')](this[_0x68c4('0x8')][_0x14c7a2[_0x68c4('0x8a')]][_0x3d9d3d][_0x68c4('0x39')],'seconds');}}}}if(this[_0x68c4('0x8')][_0x14c7a2[_0x68c4('0x8e')]]){var _0x3e99e3=this[_0x68c4('0x8')][_0x14c7a2['secondtransfereruniqueid']];this[_0x68c4('0x8')][_0x14c7a2['secondtransfereruniqueid']]=this['channels'][_0x14c7a2[_0x68c4('0x8a')]];this[_0x68c4('0x8')][_0x14c7a2[_0x68c4('0x8a')]]=_0x3e99e3;}}}catch(_0x3c89e9){logger[_0x68c4('0x51')]('[%s][voiceAgentReport][attendedtransfer]',_0x14c7a2[_0x68c4('0x22')],util['inspect'](_0x3c89e9,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x68c4('0x1c')][_0x68c4('0x1b')]=function(_0x1b1c4b){try{if(this[_0x68c4('0x37')](_0x1b1c4b)){logger[_0x68c4('0x2f')](_0x68c4('0x8f'),_0x1b1c4b[_0x68c4('0x22')],util['inspect'](_0x1b1c4b,{'showHidden':![],'depth':null}));if(this[_0x68c4('0x8')][_0x1b1c4b['transfereeuniqueid']]){for(var _0x10c08c in this['channels'][_0x1b1c4b['transfereeuniqueid']]){if(this[_0x68c4('0x8')][_0x1b1c4b[_0x68c4('0x8a')]][_0x68c4('0x38')](_0x10c08c)){if(_0x1b1c4b[_0x68c4('0x90')]===_0x10c08c){logger['info']('[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x1b1c4b[_0x68c4('0x22')],this[_0x68c4('0x8')][_0x1b1c4b['transfereeuniqueid']][_0x10c08c][_0x68c4('0x23')],_0x10c08c);var _0x85843c=moment();this[_0x68c4('0x8')][_0x1b1c4b['transfereeuniqueid']][_0x10c08c][_0x68c4('0x49')]=!![];this[_0x68c4('0x8')][_0x1b1c4b['transfereeuniqueid']][_0x10c08c]['agentcompleteAt']=_0x85843c;this[_0x68c4('0x8')][_0x1b1c4b[_0x68c4('0x8a')]][_0x10c08c][_0x68c4('0x3f')]='complete';this[_0x68c4('0x8')][_0x1b1c4b[_0x68c4('0x8a')]][_0x10c08c][_0x68c4('0x59')]='transfer';this[_0x68c4('0x8')][_0x1b1c4b[_0x68c4('0x8a')]][_0x10c08c][_0x68c4('0x63')]=_0x85843c[_0x68c4('0x8d')](this[_0x68c4('0x8')][_0x1b1c4b[_0x68c4('0x8a')]][_0x10c08c][_0x68c4('0x39')],_0x68c4('0x91'));}}}}}}catch(_0x1025e3){logger[_0x68c4('0x51')](_0x68c4('0x92'),_0x1b1c4b[_0x68c4('0x22')],util['inspect'](_0x1025e3,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncMusicOnHoldStart']=function(_0x2455a8){var _0x3f0779='';try{if(this[_0x68c4('0x37')](_0x2455a8)){logger[_0x68c4('0x2f')](_0x68c4('0x93'),_0x2455a8[_0x68c4('0x22')],util['inspect'](_0x2455a8,{'showHidden':![],'depth':null}));if(_0x2455a8[_0x68c4('0x94')]){_0x3f0779=_0x2455a8[_0x68c4('0x94')][_0x68c4('0x95')](0x0,_0x2455a8[_0x68c4('0x94')][_0x68c4('0x96')]('-'));if(this['agents'][_0x3f0779]){logger['info'](_0x68c4('0x97'),_0x2455a8['uniqueid'],_0x3f0779);this['agents'][_0x3f0779][_0x68c4('0x98')]=!![];}}}}catch(_0x39e6e4){logger[_0x68c4('0x51')](_0x68c4('0x99'),_0x2455a8[_0x68c4('0x22')],util[_0x68c4('0x33')](_0x39e6e4,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x68c4('0x1c')][_0x68c4('0x17')]=function(_0xbb924b){var _0x2efb9a='';try{if(this[_0x68c4('0x37')](_0xbb924b)){logger[_0x68c4('0x2f')](_0x68c4('0x9a'),_0xbb924b[_0x68c4('0x22')],util[_0x68c4('0x33')](_0xbb924b,{'showHidden':![],'depth':null}));if(_0xbb924b['channel']){_0x2efb9a=_0xbb924b['channel']['substring'](0x0,_0xbb924b[_0x68c4('0x94')][_0x68c4('0x96')]('-'));if(this['agents'][_0x2efb9a]){logger['info'](_0x68c4('0x9b'),_0xbb924b[_0x68c4('0x22')],_0x2efb9a);this[_0x68c4('0xa')][_0x2efb9a][_0x68c4('0x98')]=![];}}}}catch(_0x37f06c){logger['error']('[%s][voiceAgentReport][musiconholdstop]',_0xbb924b[_0x68c4('0x22')],util['inspect'](_0x37f06c,{'showHidden':![],'depth':null}));}};module[_0x68c4('0x9c')]=VoiceAgentReport; \ No newline at end of file +var _0xb76d=['rejected','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','user:agentringnoanswer','custom:agentringnoanswer','assign','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20event:','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','custom:agentqueuecallerabandon','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','transfer','agent','talktime','acw','acwtime','acwTimeout','agentacw','destconnectedlinenum','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','destaccountcode','user:agentcomplete','[%s][voiceAgentReport][agentcomplete]','addVariable','keys','variable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','[%s][voiceAgentReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','sipuri','bridgepeer','membercalls','memberdynamic','memberinterface','memberlastcall','memberrealtime','isNil','[%s][voiceAgentReport][hangup]\x20event:','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','agentcompleteAt','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','custom:voiceAgentReport','[%s][voiceAgentReport][hangup]','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','complete','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','substring','lastIndexOf','onhold','[%s][voiceAgentReport][musiconholdstop]\x20event:','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','exports','lodash','util','ioredis','../../../config/logger','../ami','redis','defaults','localhost','socket.io-emitter','channels','voiceChannels','voiceQueues','variables','agentcalled','agentconnect','syncAgentConnect','agentringnoanswer','syncAgentRingNoAnswer','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','bind','varset','hangup','syncHangup','syncMusicOnHoldStart','syncMusicOnHoldStop','syncAttendedTransfer','blindtransfer','syncBlindTransfer','prototype','emit','isNotNull','isUndefined','info','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','uniqueid','membername','debug','inspect','agents','interface','destuniqueid','format','YYYY-MM-DD\x20HH:mm:ss','called','mandatoryDisposition','type','inbound','voice','omit','event','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','user:%s','error','[%s][voiceAgentReport][agentcalled]','hasOwnProperty','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','pick','queue','name','exten','custom:agentconnect','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswerAt','answeredelsewheredestinationuniqueid','answeredelsewheremembername','lastevent','reason','answered_elsewhere','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','[%s][voiceAgentReport][agentconnect]\x20Else\x20path\x20should\x20never\x20be\x20taken','[%s][voiceAgentReport][agentringnoanswer]\x20event:','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected'];(function(_0x42e9fb,_0x150882){var _0x4df66f=function(_0x24f329){while(--_0x24f329){_0x42e9fb['push'](_0x42e9fb['shift']());}};_0x4df66f(++_0x150882);}(_0xb76d,0x17d));var _0xdb76=function(_0x2685cf,_0x24abf2){_0x2685cf=_0x2685cf-0x0;var _0x4ee252=_0xb76d[_0x2685cf];return _0x4ee252;};'use strict';var _=require(_0xdb76('0x0'));var moment=require('moment');var util=require(_0xdb76('0x1'));var Redis=require(_0xdb76('0x2'));var config=require('../../../config/environment');var logger=require(_0xdb76('0x3'))('ami');var ami=require(_0xdb76('0x4'));config[_0xdb76('0x5')]=_[_0xdb76('0x6')](config[_0xdb76('0x5')],{'host':_0xdb76('0x7'),'port':0x18eb});var io=require(_0xdb76('0x8'))(new Redis(config[_0xdb76('0x5')]));function VoiceAgentReport(_0x535677){this[_0xdb76('0x9')]={};this[_0xdb76('0xa')]=_0x535677[_0xdb76('0x9')];this[_0xdb76('0xb')]=_0x535677['voiceQueues'];this['agents']=_0x535677['agents'];this[_0xdb76('0xc')]={};ami['on'](_0xdb76('0xd'),this['syncAgentCalled']['bind'](this));ami['on'](_0xdb76('0xe'),this[_0xdb76('0xf')]['bind'](this));ami['on'](_0xdb76('0x10'),this[_0xdb76('0x11')]['bind'](this));ami['on'](_0xdb76('0x12'),this[_0xdb76('0x13')]['bind'](this));ami['on'](_0xdb76('0x14'),this[_0xdb76('0x15')][_0xdb76('0x16')](this));ami['on'](_0xdb76('0x17'),this['syncVarSet'][_0xdb76('0x16')](this));ami['on'](_0xdb76('0x18'),this[_0xdb76('0x19')][_0xdb76('0x16')](this));ami['on']('musiconholdstart',this[_0xdb76('0x1a')][_0xdb76('0x16')](this));ami['on']('musiconholdstop',this[_0xdb76('0x1b')][_0xdb76('0x16')](this));ami['on']('attendedtransfer',this[_0xdb76('0x1c')][_0xdb76('0x16')](this));ami['on'](_0xdb76('0x1d'),this[_0xdb76('0x1e')][_0xdb76('0x16')](this));}VoiceAgentReport[_0xdb76('0x1f')][_0xdb76('0x20')]=function(_0x383412,_0xdecfb2,_0x370385){io['to'](_0x383412)['emit'](_0xdecfb2,_0x370385);};VoiceAgentReport['prototype'][_0xdb76('0x21')]=function(_0x1473b9){return _0x1473b9!==null&&!_[_0xdb76('0x22')](_0x1473b9);};VoiceAgentReport[_0xdb76('0x1f')]['syncAgentCalled']=function(_0x5b9f11){try{if(this[_0xdb76('0x21')](_0x5b9f11)){logger[_0xdb76('0x23')](_0xdb76('0x24'),_0x5b9f11[_0xdb76('0x25')],_0x5b9f11[_0xdb76('0x26')],_0x5b9f11['destuniqueid']);logger[_0xdb76('0x27')]('[%s][voiceAgentReport][agentcalled]\x20event:',_0x5b9f11[_0xdb76('0x25')],util[_0xdb76('0x28')](_0x5b9f11,{'showHidden':![],'depth':null}));if(_[_0xdb76('0x22')](this[_0xdb76('0x9')][_0x5b9f11[_0xdb76('0x25')]])){this[_0xdb76('0x9')][_0x5b9f11[_0xdb76('0x25')]]={};}var _0x4f0d45=this[_0xdb76('0x29')][_0x5b9f11[_0xdb76('0x2a')]];var _0x47d0f7=this[_0xdb76('0x9')][_0x5b9f11[_0xdb76('0x25')]][_0x5b9f11[_0xdb76('0x2b')]];var _0x45f1f6=this[_0xdb76('0xb')][_0x5b9f11['queue']];var _0x508ea4=this['variables'][_0x5b9f11[_0xdb76('0x25')]];if(_[_0xdb76('0x22')](_0x47d0f7)){_0x47d0f7={'agentcalledAt':moment()[_0xdb76('0x2c')](_0xdb76('0x2d')),'lastevent':_0xdb76('0x2e'),'mandatoryDisposition':_0x45f1f6&&_0x45f1f6['mandatoryDisposition']?_0x45f1f6[_0xdb76('0x2f')]:![],'type':_0x45f1f6&&_0x45f1f6[_0xdb76('0x30')]?_0x45f1f6['type']:_0xdb76('0x31'),'variables':_0x508ea4,'motionChannel':_0xdb76('0x32')};}Object['assign'](_0x47d0f7,_[_0xdb76('0x33')](_0x5b9f11,[_0xdb76('0x34'),_0xdb76('0x35')]));this['channels'][_0x5b9f11[_0xdb76('0x25')]][_0x5b9f11[_0xdb76('0x2b')]]=_0x47d0f7;logger[_0xdb76('0x27')](_0xdb76('0x36'),_0x5b9f11[_0xdb76('0x25')],util[_0xdb76('0x28')](_0x47d0f7,{'showHidden':![],'depth':null}));ami['emit']('custom:agentcalled',_0x47d0f7);var _0x309aec={'id':_0x4f0d45['id'],'calleridnum':_0x47d0f7['calleridnum'],'queue':_0x47d0f7['queue'],'variables':_0x47d0f7[_0xdb76('0xc')],'uniqueid':_0x5b9f11['uniqueid']};logger[_0xdb76('0x27')](_0xdb76('0x37'),_0x5b9f11['uniqueid'],util[_0xdb76('0x28')](_0x309aec,{'showHidden':![],'depth':null}));this[_0xdb76('0x20')](util['format'](_0xdb76('0x38'),_0x5b9f11['membername']),'user:called',_0x309aec);}}catch(_0x52fd7e){logger[_0xdb76('0x39')](_0xdb76('0x3a'),_0x5b9f11[_0xdb76('0x25')],util[_0xdb76('0x28')](_0x52fd7e,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncAgentConnect']=function(_0x563e45){try{if(this['isNotNull'](_0x563e45)){if(this[_0xdb76('0x9')][_0x563e45[_0xdb76('0x25')]]){for(var _0x35ea92 in this[_0xdb76('0x9')][_0x563e45['uniqueid']]){if(this['channels'][_0x563e45[_0xdb76('0x25')]][_0xdb76('0x3b')](_0x35ea92)){if(_0x563e45[_0xdb76('0x2b')]===_0x35ea92){logger['info'](_0xdb76('0x3c'),_0x563e45[_0xdb76('0x25')],_0x563e45[_0xdb76('0x26')],_0x563e45[_0xdb76('0x2b')]);this[_0xdb76('0x9')][_0x563e45['uniqueid']][_0x35ea92][_0xdb76('0x3d')]=moment()[_0xdb76('0x2c')](_0xdb76('0x2d'));this[_0xdb76('0x9')][_0x563e45[_0xdb76('0x25')]][_0x35ea92][_0xdb76('0x3e')]=_0x563e45['connectedlinename'];this['channels'][_0x563e45['uniqueid']][_0x35ea92][_0xdb76('0x3f')]=_0x563e45['connectedlinenum'];this[_0xdb76('0x9')][_0x563e45[_0xdb76('0x25')]][_0x35ea92][_0xdb76('0x40')]=_0x563e45[_0xdb76('0x40')];this[_0xdb76('0x9')][_0x563e45[_0xdb76('0x25')]][_0x35ea92][_0xdb76('0x41')]=_0x563e45[_0xdb76('0x41')];this[_0xdb76('0x9')][_0x563e45[_0xdb76('0x25')]][_0x35ea92][_0xdb76('0x42')]=_0x563e45[_0xdb76('0x42')];this[_0xdb76('0x9')][_0x563e45['uniqueid']][_0x35ea92]['lastevent']='connect';if(this[_0xdb76('0xa')][this[_0xdb76('0x9')][_0x563e45[_0xdb76('0x25')]][_0x35ea92][_0xdb76('0x25')]]){var _0x52fea2=this[_0xdb76('0xa')][this[_0xdb76('0x9')][_0x563e45['uniqueid']][_0x35ea92][_0xdb76('0x25')]]['routealias'];this[_0xdb76('0x9')][_0x563e45[_0xdb76('0x25')]][_0x35ea92]['routealias']=_0x52fea2;_0x563e45['routealias']=_0x52fea2;}_['merge'](this['agents'][_0x563e45[_0xdb76('0x2a')]],_[_0xdb76('0x43')](_0x563e45,[_0xdb76('0x44'),'destconnectedlinenum','routealias']));var _0x2eadc4=this[_0xdb76('0x29')][_0x563e45[_0xdb76('0x2a')]];var _0x1df19b={'id':_0x2eadc4['id'],'name':_0x2eadc4[_0xdb76('0x45')],'agentconnected':!![],'destaccountcode':_0x2eadc4['accountcode'],'destconnectedlinenum':this[_0xdb76('0x9')][_0x563e45[_0xdb76('0x25')]][_0x563e45[_0xdb76('0x2b')]][_0xdb76('0x46')],'queue':this['channels'][_0x563e45[_0xdb76('0x25')]][_0x563e45[_0xdb76('0x2b')]]['queue'],'routealias':this[_0xdb76('0x9')][_0x563e45[_0xdb76('0x25')]][_0x563e45[_0xdb76('0x2b')]]['routealias'],'uniqueid':this[_0xdb76('0x9')][_0x563e45[_0xdb76('0x25')]][_0x563e45[_0xdb76('0x2b')]][_0xdb76('0x25')]};ami['emit'](_0xdb76('0x47'),this['channels'][_0x563e45['uniqueid']][_0x563e45['destuniqueid']]);this[_0xdb76('0x20')](util[_0xdb76('0x2c')](_0xdb76('0x38'),_0x563e45[_0xdb76('0x26')]),'user:agentconnect',_0x1df19b);}else if(!this[_0xdb76('0x9')][_0x563e45[_0xdb76('0x25')]][_0x35ea92][_0xdb76('0x10')]&&!this[_0xdb76('0x9')][_0x563e45[_0xdb76('0x25')]][_0x35ea92][_0xdb76('0x14')]){logger[_0xdb76('0x23')](_0xdb76('0x48'),_0x563e45[_0xdb76('0x25')],this[_0xdb76('0x9')][_0x563e45[_0xdb76('0x25')]][_0x35ea92]['membername'],_0x35ea92);this['channels'][_0x563e45[_0xdb76('0x25')]][_0x35ea92][_0xdb76('0x10')]=!![];this[_0xdb76('0x9')][_0x563e45['uniqueid']][_0x35ea92][_0xdb76('0x49')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0xdb76('0x9')][_0x563e45[_0xdb76('0x25')]][_0x35ea92][_0xdb76('0x4a')]=_0x563e45[_0xdb76('0x2b')];this[_0xdb76('0x9')][_0x563e45[_0xdb76('0x25')]][_0x35ea92][_0xdb76('0x4b')]=_0x563e45[_0xdb76('0x26')];this[_0xdb76('0x9')][_0x563e45['uniqueid']][_0x35ea92][_0xdb76('0x4c')]='answered_elsewhere';this[_0xdb76('0x9')][_0x563e45['uniqueid']][_0x35ea92][_0xdb76('0x4d')]=_0xdb76('0x4e');logger['debug'](_0xdb76('0x4f'),_0x563e45[_0xdb76('0x25')],util[_0xdb76('0x28')](this['channels'][_0x563e45[_0xdb76('0x25')]][_0x35ea92],{'showHidden':![],'depth':null}));ami[_0xdb76('0x20')](_0xdb76('0x50'),this[_0xdb76('0x9')][_0x563e45['uniqueid']][_0x35ea92]);}else{logger[_0xdb76('0x27')](_0xdb76('0x51'),_0x563e45[_0xdb76('0x25')]);}}}}}}catch(_0x12674c){logger[_0xdb76('0x39')]('[%s][voiceAgentReport][agentconnect]',_0x563e45[_0xdb76('0x25')],util[_0xdb76('0x28')](_0x12674c,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncAgentRingNoAnswer']=function(_0x43ddff){try{if(this['isNotNull'](_0x43ddff)){logger[_0xdb76('0x27')](_0xdb76('0x52'),_0x43ddff[_0xdb76('0x25')],util[_0xdb76('0x28')](_0x43ddff,{'showHidden':![],'depth':null}));if(this[_0xdb76('0x9')][_0x43ddff[_0xdb76('0x25')]]&&this['channels'][_0x43ddff['uniqueid']][_0x43ddff[_0xdb76('0x2b')]]){logger[_0xdb76('0x23')](_0xdb76('0x53'),_0x43ddff[_0xdb76('0x25')],_0x43ddff[_0xdb76('0x26')],_0x43ddff[_0xdb76('0x2b')]);var _0x8b8b57=this[_0xdb76('0x29')][_0x43ddff['interface']];var _0x82f172=this[_0xdb76('0x9')][_0x43ddff[_0xdb76('0x25')]][_0x43ddff['destuniqueid']];_0x82f172[_0xdb76('0x10')]=!![];_0x82f172[_0xdb76('0x49')]=moment()[_0xdb76('0x2c')](_0xdb76('0x2d'));_0x82f172['lastevent']=_0xdb76('0x54');_0x82f172[_0xdb76('0x4d')]=_0xdb76('0x54');var _0x5aa0ae={'id':_0x8b8b57['id'],'name':_0x8b8b57[_0xdb76('0x45')],'queue':_0x82f172['queue'],'uniqueid':_0x82f172[_0xdb76('0x25')]};logger[_0xdb76('0x27')](_0xdb76('0x55'),_0x43ddff[_0xdb76('0x25')],util['inspect'](_0x5aa0ae,{'showHidden':![],'depth':null}));this['emit'](util[_0xdb76('0x2c')](_0xdb76('0x38'),_0x8b8b57[_0xdb76('0x45')]),_0xdb76('0x56'),_0x5aa0ae);ami[_0xdb76('0x20')](_0xdb76('0x57'),_0x82f172);this[_0xdb76('0x9')][_0x43ddff['uniqueid']][_0x43ddff[_0xdb76('0x2b')]]=Object[_0xdb76('0x58')]({},_0x82f172);}}}catch(_0x555e3b){logger[_0xdb76('0x39')](_0xdb76('0x59'),_0x43ddff[_0xdb76('0x25')],util[_0xdb76('0x28')](_0x555e3b,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xdb76('0x1f')][_0xdb76('0x13')]=function(_0x2edf5d){try{if(this[_0xdb76('0x21')](_0x2edf5d)){logger[_0xdb76('0x27')](_0xdb76('0x5a'),_0x2edf5d[_0xdb76('0x25')],util[_0xdb76('0x28')](_0x2edf5d,{'showHidden':![],'depth':null}));if(this[_0xdb76('0x9')][_0x2edf5d[_0xdb76('0x25')]]){for(var _0x522cd5 in this[_0xdb76('0x9')][_0x2edf5d['uniqueid']]){if(this[_0xdb76('0x9')][_0x2edf5d['uniqueid']][_0xdb76('0x3b')](_0x522cd5)&&!this['channels'][_0x2edf5d['uniqueid']][_0x522cd5][_0xdb76('0x10')]&&!this[_0xdb76('0x9')][_0x2edf5d[_0xdb76('0x25')]][_0x522cd5][_0xdb76('0x14')]){logger[_0xdb76('0x23')](_0xdb76('0x5b'),_0x2edf5d['uniqueid'],this['channels'][_0x2edf5d[_0xdb76('0x25')]][_0x522cd5][_0xdb76('0x26')],_0x522cd5);this[_0xdb76('0x9')][_0x2edf5d[_0xdb76('0x25')]][_0x522cd5][_0xdb76('0x10')]=!![];this[_0xdb76('0x9')][_0x2edf5d['uniqueid']][_0x522cd5]['agentringnoanswerAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0xdb76('0x9')][_0x2edf5d['uniqueid']][_0x522cd5][_0xdb76('0x4c')]=_0xdb76('0x5c');this['channels'][_0x2edf5d[_0xdb76('0x25')]][_0x522cd5][_0xdb76('0x4d')]=_0xdb76('0x5c');logger[_0xdb76('0x27')]('[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:',_0x2edf5d[_0xdb76('0x25')],util['inspect'](this[_0xdb76('0x9')][_0x2edf5d[_0xdb76('0x25')]][_0x522cd5],{'showHidden':![],'depth':null}));ami[_0xdb76('0x20')](_0xdb76('0x5d'),this[_0xdb76('0x9')][_0x2edf5d[_0xdb76('0x25')]][_0x522cd5]);}}}}}catch(_0x664242){logger[_0xdb76('0x39')](_0xdb76('0x5e'),_0x2edf5d[_0xdb76('0x25')],util['inspect'](_0x664242,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xdb76('0x1f')][_0xdb76('0x15')]=function(_0x2093cf){try{if(this['isNotNull'](_0x2093cf)){logger[_0xdb76('0x27')]('[%s][voiceAgentReport][agentcomplete]\x20event:',_0x2093cf['uniqueid'],util[_0xdb76('0x28')](_0x2093cf,{'showHidden':![],'depth':null}));if(this[_0xdb76('0x9')][_0x2093cf[_0xdb76('0x25')]]){for(var _0x34a4fe in this[_0xdb76('0x9')][_0x2093cf[_0xdb76('0x25')]]){if(this['channels'][_0x2093cf[_0xdb76('0x25')]][_0xdb76('0x3b')](_0x34a4fe)){if(this[_0xdb76('0x9')][_0x2093cf[_0xdb76('0x25')]][_0x34a4fe][_0xdb76('0x3d')]&&!this[_0xdb76('0x9')][_0x2093cf['uniqueid']][_0x34a4fe][_0xdb76('0x14')]){logger[_0xdb76('0x23')](_0xdb76('0x5f'),_0x2093cf[_0xdb76('0x25')],this[_0xdb76('0x9')][_0x2093cf[_0xdb76('0x25')]][_0x34a4fe][_0xdb76('0x26')],_0x34a4fe);this[_0xdb76('0x9')][_0x2093cf[_0xdb76('0x25')]][_0x34a4fe][_0xdb76('0x14')]=!![];this[_0xdb76('0x9')][_0x2093cf[_0xdb76('0x25')]][_0x34a4fe]['agentcompleteAt']=moment()[_0xdb76('0x2c')](_0xdb76('0x2d'));this[_0xdb76('0x9')][_0x2093cf[_0xdb76('0x25')]][_0x34a4fe][_0xdb76('0x4c')]='complete';this['channels'][_0x2093cf[_0xdb76('0x25')]][_0x34a4fe][_0xdb76('0x4d')]=_0x2093cf[_0xdb76('0x4d')]==_0xdb76('0x60')?_0xdb76('0x61'):_0x2093cf[_0xdb76('0x4d')];this['channels'][_0x2093cf[_0xdb76('0x25')]][_0x34a4fe][_0xdb76('0x62')]=_0x2093cf[_0xdb76('0x62')];if(this[_0xdb76('0xb')][_0x2093cf['queue']]&&this[_0xdb76('0xb')][_0x2093cf['queue']][_0xdb76('0x63')]){this[_0xdb76('0x9')][_0x2093cf[_0xdb76('0x25')]][_0x34a4fe][_0xdb76('0x64')]=this[_0xdb76('0xb')][_0x2093cf['queue']][_0xdb76('0x65')];this[_0xdb76('0x9')][_0x2093cf['uniqueid']][_0x34a4fe][_0xdb76('0x66')]=!![];}this[_0xdb76('0x29')][_0x2093cf['interface']]=_[_0xdb76('0x33')](this['agents'][_0x2093cf[_0xdb76('0x2a')]],[_0xdb76('0x44'),_0xdb76('0x67')]);logger[_0xdb76('0x27')]('[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:',_0x2093cf[_0xdb76('0x25')],util[_0xdb76('0x28')](this['channels'][_0x2093cf[_0xdb76('0x25')]][_0x34a4fe],{'showHidden':![],'depth':null}));ami['emit']('custom:agentcomplete',this['channels'][_0x2093cf[_0xdb76('0x25')]][_0x34a4fe]);logger[_0xdb76('0x27')](_0xdb76('0x68'),_0x2093cf[_0xdb76('0x25')],util[_0xdb76('0x28')]({'id':this['agents'][_0x2093cf['interface']]['id'],'destaccountcode':_0x2093cf[_0xdb76('0x69')]},{'showHidden':![],'depth':null}));this[_0xdb76('0x20')](util['format'](_0xdb76('0x38'),_0x2093cf[_0xdb76('0x26')]),_0xdb76('0x6a'),{'id':this[_0xdb76('0x29')][_0x2093cf[_0xdb76('0x2a')]]['id'],'destaccountcode':Number(_0x2093cf['destaccountcode'])});}}}}}}catch(_0x289f18){logger[_0xdb76('0x39')](_0xdb76('0x6b'),_0x2093cf['uniqueid'],util['inspect'](_0x289f18,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xdb76('0x1f')]['syncVarSet']=function(_0x18628c){try{if(this['isNotNull'](_0x18628c)){logger['debug']('[%s][voiceAgentReport][varset]\x20event:',_0x18628c[_0xdb76('0x25')],util['inspect'](_0x18628c,{'showHidden':![],'depth':null}));this[_0xdb76('0x6c')](_0x18628c[_0xdb76('0x25')],_[_0xdb76('0x6d')](_0x18628c[_0xdb76('0x6e')])[0x0],_0x18628c[_0xdb76('0x6f')]);if(this[_0xdb76('0x9')][_0x18628c['uniqueid']]){for(var _0x105841 in this[_0xdb76('0x9')][_0x18628c[_0xdb76('0x25')]]){if(this[_0xdb76('0x9')][_0x18628c['uniqueid']][_0xdb76('0x3b')](_0x105841)){logger[_0xdb76('0x23')](_0xdb76('0x70'),_0x18628c[_0xdb76('0x25')],_0x105841,_[_0xdb76('0x6d')](_0x18628c[_0xdb76('0x6e')])[0x0],_0x18628c[_0xdb76('0x6f')]);if(_[_0xdb76('0x22')](this[_0xdb76('0x9')][_0x18628c[_0xdb76('0x25')]][_0x105841]['variables'])){this[_0xdb76('0x9')][_0x18628c['uniqueid']][_0x105841][_0xdb76('0xc')]={};}this['channels'][_0x18628c[_0xdb76('0x25')]][_0x105841][_0xdb76('0xc')]=this['variables'][_0x18628c[_0xdb76('0x25')]];}}}}}catch(_0x2d2650){logger[_0xdb76('0x39')](_0xdb76('0x71'),_0x18628c[_0xdb76('0x25')],util[_0xdb76('0x28')](_0x2d2650,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xdb76('0x1f')][_0xdb76('0x6c')]=function(_0x4072f9,_0x502cf8,_0x6c7e1b){var _0x2142d8=[_0xdb76('0x72'),_0xdb76('0x73'),_0xdb76('0x74'),_0xdb76('0x75'),_0xdb76('0x76'),_0xdb76('0x77'),_0xdb76('0x78'),'rtpaudioqosrttbridged','sipcallid',_0xdb76('0x79'),_0xdb76('0x7a'),'bridgepvtcallid',_0xdb76('0x7b'),_0xdb76('0x7c'),_0xdb76('0x7d'),_0xdb76('0x7e'),'membername','memberpenalty',_0xdb76('0x7f')];if(!_[_0xdb76('0x80')](_0x502cf8)&&!_['includes'](_0x2142d8,_0x502cf8)){if(_[_0xdb76('0x22')](this['variables'][_0x4072f9])){this['variables'][_0x4072f9]={};}this[_0xdb76('0xc')][_0x4072f9][_0x502cf8]=_0x6c7e1b;}};VoiceAgentReport[_0xdb76('0x1f')]['syncHangup']=function(_0x9b0311){try{if(this[_0xdb76('0x21')](_0x9b0311)){logger[_0xdb76('0x27')](_0xdb76('0x81'),_0x9b0311[_0xdb76('0x25')],util['inspect'](_0x9b0311,{'showHidden':![],'depth':null}));if(this[_0xdb76('0x9')][_0x9b0311['uniqueid']]){for(var _0x118768 in this[_0xdb76('0x9')][_0x9b0311['uniqueid']]){if(this[_0xdb76('0x9')][_0x9b0311['uniqueid']][_0xdb76('0x3b')](_0x118768)){if(this[_0xdb76('0x9')][_0x9b0311['uniqueid']][_0x118768][_0xdb76('0x4d')]=='transfer'&&this['channels'][_0x9b0311[_0xdb76('0x25')]][_0x118768][_0xdb76('0x14')]){logger[_0xdb76('0x23')](_0xdb76('0x82'),_0x9b0311['uniqueid'],_0x118768);this[_0xdb76('0x9')][_0x9b0311[_0xdb76('0x25')]][_0x118768][_0xdb76('0x83')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}}}logger[_0xdb76('0x27')](_0xdb76('0x84'),_0x9b0311[_0xdb76('0x25')],util[_0xdb76('0x28')](_[_0xdb76('0x85')](this[_0xdb76('0x9')][_0x9b0311[_0xdb76('0x25')]]),{'showHidden':![],'depth':null}));ami['emit'](_0xdb76('0x86'),_['values'](this[_0xdb76('0x9')][_0x9b0311[_0xdb76('0x25')]]));delete this[_0xdb76('0x9')][_0x9b0311[_0xdb76('0x25')]];}if(this[_0xdb76('0xc')][_0x9b0311['uniqueid']]){delete this[_0xdb76('0xc')][_0x9b0311[_0xdb76('0x25')]];}}}catch(_0x24e291){logger[_0xdb76('0x39')](_0xdb76('0x87'),_0x9b0311['uniqueid'],util[_0xdb76('0x28')](_0x24e291,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xdb76('0x1f')][_0xdb76('0x1c')]=function(_0x1c0787){try{if(this['isNotNull'](_0x1c0787)){logger[_0xdb76('0x27')](_0xdb76('0x88'),_0x1c0787[_0xdb76('0x25')],util['inspect'](_0x1c0787,{'showHidden':![],'depth':null}));if(this[_0xdb76('0x9')][_0x1c0787[_0xdb76('0x89')]]){for(var _0x165468 in this[_0xdb76('0x9')][_0x1c0787['transfereeuniqueid']]){if(this[_0xdb76('0x9')][_0x1c0787['transfereeuniqueid']][_0xdb76('0x3b')](_0x165468)){if(_0x1c0787[_0xdb76('0x8a')]===_0x165468){logger['info'](_0xdb76('0x8b'),_0x1c0787[_0xdb76('0x25')],this[_0xdb76('0x9')][_0x1c0787[_0xdb76('0x89')]][_0x165468]['membername'],_0x165468);var _0x4d8757=moment();this[_0xdb76('0x9')][_0x1c0787[_0xdb76('0x89')]][_0x165468][_0xdb76('0x14')]=!![];this[_0xdb76('0x9')][_0x1c0787['transfereeuniqueid']][_0x165468][_0xdb76('0x83')]=moment()[_0xdb76('0x2c')](_0xdb76('0x2d'));this['channels'][_0x1c0787[_0xdb76('0x89')]][_0x165468]['lastevent']=_0xdb76('0x8c');this[_0xdb76('0x9')][_0x1c0787[_0xdb76('0x89')]][_0x165468][_0xdb76('0x4d')]=_0xdb76('0x60');this['channels'][_0x1c0787[_0xdb76('0x89')]][_0x165468][_0xdb76('0x62')]=_0x4d8757[_0xdb76('0x8d')](this[_0xdb76('0x9')][_0x1c0787[_0xdb76('0x89')]][_0x165468][_0xdb76('0x3d')],_0xdb76('0x8e'));}}}}if(this[_0xdb76('0x9')][_0x1c0787[_0xdb76('0x8f')]]){var _0x2808e7=this[_0xdb76('0x9')][_0x1c0787[_0xdb76('0x8f')]];this[_0xdb76('0x9')][_0x1c0787['secondtransfereruniqueid']]=this[_0xdb76('0x9')][_0x1c0787[_0xdb76('0x89')]];this[_0xdb76('0x9')][_0x1c0787[_0xdb76('0x89')]]=_0x2808e7;}}}catch(_0x3ebace){logger['error'](_0xdb76('0x90'),_0x1c0787[_0xdb76('0x25')],util[_0xdb76('0x28')](_0x3ebace,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xdb76('0x1f')][_0xdb76('0x1e')]=function(_0x59ed8a){try{if(this[_0xdb76('0x21')](_0x59ed8a)){logger[_0xdb76('0x27')]('[%s][voiceAgentReport][blindtransfer]\x20event:',_0x59ed8a[_0xdb76('0x25')],util['inspect'](_0x59ed8a,{'showHidden':![],'depth':null}));if(this['channels'][_0x59ed8a[_0xdb76('0x89')]]){for(var _0xd6f5a1 in this[_0xdb76('0x9')][_0x59ed8a[_0xdb76('0x89')]]){if(this[_0xdb76('0x9')][_0x59ed8a[_0xdb76('0x89')]][_0xdb76('0x3b')](_0xd6f5a1)){if(_0x59ed8a[_0xdb76('0x91')]===_0xd6f5a1){logger[_0xdb76('0x23')]('[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x59ed8a[_0xdb76('0x25')],this['channels'][_0x59ed8a[_0xdb76('0x89')]][_0xd6f5a1]['membername'],_0xd6f5a1);var _0xa9b8a6=moment();this['channels'][_0x59ed8a[_0xdb76('0x89')]][_0xd6f5a1][_0xdb76('0x14')]=!![];this[_0xdb76('0x9')][_0x59ed8a['transfereeuniqueid']][_0xd6f5a1][_0xdb76('0x83')]=_0xa9b8a6;this['channels'][_0x59ed8a['transfereeuniqueid']][_0xd6f5a1][_0xdb76('0x4c')]=_0xdb76('0x8c');this[_0xdb76('0x9')][_0x59ed8a['transfereeuniqueid']][_0xd6f5a1]['reason']=_0xdb76('0x60');this[_0xdb76('0x9')][_0x59ed8a['transfereeuniqueid']][_0xd6f5a1][_0xdb76('0x62')]=_0xa9b8a6['diff'](this[_0xdb76('0x9')][_0x59ed8a['transfereeuniqueid']][_0xd6f5a1][_0xdb76('0x3d')],'seconds');}}}}}}catch(_0x5e463e){logger[_0xdb76('0x39')](_0xdb76('0x92'),_0x59ed8a[_0xdb76('0x25')],util[_0xdb76('0x28')](_0x5e463e,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xdb76('0x1f')]['syncMusicOnHoldStart']=function(_0x4496ee){var _0x228f8f='';try{if(this['isNotNull'](_0x4496ee)){logger['debug'](_0xdb76('0x93'),_0x4496ee[_0xdb76('0x25')],util[_0xdb76('0x28')](_0x4496ee,{'showHidden':![],'depth':null}));if(_0x4496ee[_0xdb76('0x94')]){_0x228f8f=_0x4496ee['channel'][_0xdb76('0x95')](0x0,_0x4496ee['channel'][_0xdb76('0x96')]('-'));if(this[_0xdb76('0x29')][_0x228f8f]){logger['info']('[%s][voiceAgentReport][musiconholdstart]\x20interface:%s',_0x4496ee[_0xdb76('0x25')],_0x228f8f);this['agents'][_0x228f8f][_0xdb76('0x97')]=!![];}}}}catch(_0x42955a){logger[_0xdb76('0x39')]('[%s][voiceAgentReport][musiconholdstart]',_0x4496ee[_0xdb76('0x25')],util['inspect'](_0x42955a,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xdb76('0x1f')]['syncMusicOnHoldStop']=function(_0x3cc7e2){var _0x3ae461='';try{if(this[_0xdb76('0x21')](_0x3cc7e2)){logger[_0xdb76('0x27')](_0xdb76('0x98'),_0x3cc7e2['uniqueid'],util[_0xdb76('0x28')](_0x3cc7e2,{'showHidden':![],'depth':null}));if(_0x3cc7e2[_0xdb76('0x94')]){_0x3ae461=_0x3cc7e2['channel'][_0xdb76('0x95')](0x0,_0x3cc7e2['channel'][_0xdb76('0x96')]('-'));if(this[_0xdb76('0x29')][_0x3ae461]){logger[_0xdb76('0x23')](_0xdb76('0x99'),_0x3cc7e2['uniqueid'],_0x3ae461);this[_0xdb76('0x29')][_0x3ae461][_0xdb76('0x97')]=![];}}}}catch(_0x14b3bc){logger[_0xdb76('0x39')]('[%s][voiceAgentReport][musiconholdstop]',_0x3cc7e2[_0xdb76('0x25')],util[_0xdb76('0x28')](_0x14b3bc,{'showHidden':![],'depth':null}));}};module[_0xdb76('0x9a')]=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index 800aa03..1186ea0 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 _0x3859=['FAILED','redis','defaults','localhost','socket.io-emitter','channels','agents','coreshowchannel','syncNewExten','bind','newexten','newchannel','newstate','syncNewState','varset','syncVarSet','hangup','syncHangup','newcallerid','attendedtransfer','syncAttendedTransfer','blindtransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','error','[voiceCallReport][coreshowchannels]','isNotNull','prototype','emit','info','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridname','calleridnum','debug','[%s][voiceCallReport][newcallerid]\x20event:','inspect','linkedid','isUndefined','keys','context','from-sip','channel','split','xcally-motion-preview','destconnectedlinenum','format','user:%s','name','user:agentconnect','accountcode','connectedlinenum','syncNewChannel','[%s][voiceCallReport][newchannel]\x20event:','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','exten','disposition','channelstate','merge','pick','undefined','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','[%s][voiceCallReport][newexten]\x20event:','OutgoingSpoolFailed','blindTransfers','application','toLowerCase','applicationdata','startsWith','CDR(routeAlias)','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','duration','subtract','seconds','YYYY-MM-DD\x20HH:mm:ss','includes','lastdata','match','isNil','[%s][voiceCallReport][newexten]','[%s][voiceCallReport][newstate]\x20event:','answered','starttime','holdtime','diff','connectedlinename','destinationchannel','toNumber','UserId','membername','answertime','routealias','[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','endsWith','.wav49','replace','monitors','rec','[%s][voiceCallReport][mixMonitorFilename]','variable','mixmonitor_filename','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','callerid','xmd-cdrtype','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','xmd-queue','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','xmd-originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','xmd-destination','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','destination','xmd-callerid-preview','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','calleridpreview','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','parse','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20reason:%s','cause-txt','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','length','transferType','transferToInternal','isEmpty','then','stopRecordingOnTransfer','Action','catch','StopMixMonitor','webbar:stopmonitors','event','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][hangup]','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereeuniqueid','transfercalleridnum','origtransferercalleridnum','transferconnectedlinenum','transfertargetcalleridnum','secondtransfereruniqueid','ATTENDED','origtransfereruniqueid','transfertargetuniqueid','origtransfererlinkedid','some','routeid','[%s][voiceCallReport][attendedtransfer]','syncBlindTransfer','transfereecalleridnum','extension','BLIND','transfereruniqueid','transfererchannel','[%s][voiceCallReport][musiconholdstart]\x20event:','mohstarttime','[%s][voiceCallReport][musiconholdstart]','[%s][voiceCallReport][musiconholdstop]\x20event:','mohtime','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','[%s][voiceCallReport][musiconholdstop]','exports','lodash','moment','util','path','../../../config/environment','../ami','../model/channel','../rpc/setting','set','queue','agi','voicemail','NO\x20ANSWER','ANSWERED','BUSY'];(function(_0x242172,_0x3c1f69){var _0x2f74af=function(_0x5e51d6){while(--_0x5e51d6){_0x242172['push'](_0x242172['shift']());}};_0x2f74af(++_0x3c1f69);}(_0x3859,0xb4));var _0x9385=function(_0x3f3f40,_0x4e745f){_0x3f3f40=_0x3f3f40-0x0;var _0x32c366=_0x3859[_0x3f3f40];return _0x32c366;};'use strict';var _=require(_0x9385('0x0'));var moment=require(_0x9385('0x1'));var util=require(_0x9385('0x2'));var path=require(_0x9385('0x3'));var Redis=require('ioredis');var config=require(_0x9385('0x4'));var logger=require('../../../config/logger')('ami');var ami=require(_0x9385('0x5'));var Channel=require(_0x9385('0x6'));var RpcSetting=require(_0x9385('0x7'));var applications=[_0x9385('0x8'),_0x9385('0x9'),_0x9385('0xa'),'dial','playback',_0x9385('0xb')];var dispositions=['NO\x20ANSWER','FAILED','FAILED',_0x9385('0xc'),'NO\x20ANSWER','NO\x20ANSWER',_0x9385('0xd'),_0x9385('0xe'),_0x9385('0xf'),_0x9385('0xf'),'FAILED'];config[_0x9385('0x10')]=_[_0x9385('0x11')](config['redis'],{'host':_0x9385('0x12'),'port':0x18eb});var io=require(_0x9385('0x13'))(new Redis(config[_0x9385('0x10')]));function VoiceCallReport(_0x811620){this['channels']=_0x811620[_0x9385('0x14')];this['agents']=_0x811620[_0x9385('0x15')];this['blindTransfers']={};ami['on'](_0x9385('0x16'),this[_0x9385('0x17')][_0x9385('0x18')](this));ami['on'](_0x9385('0x19'),this[_0x9385('0x17')][_0x9385('0x18')](this));ami['on'](_0x9385('0x1a'),this['syncNewChannel'][_0x9385('0x18')](this));ami['on'](_0x9385('0x1b'),this[_0x9385('0x1c')][_0x9385('0x18')](this));ami['on'](_0x9385('0x1d'),this[_0x9385('0x1e')][_0x9385('0x18')](this));ami['on'](_0x9385('0x1f'),this[_0x9385('0x20')][_0x9385('0x18')](this));ami['on'](_0x9385('0x21'),this['syncNewCallerId'][_0x9385('0x18')](this));ami['on'](_0x9385('0x22'),this[_0x9385('0x23')][_0x9385('0x18')](this));ami['on'](_0x9385('0x24'),this['syncBlindTransfer'][_0x9385('0x18')](this));ami['on'](_0x9385('0x25'),this[_0x9385('0x26')][_0x9385('0x18')](this));ami['on'](_0x9385('0x27'),this[_0x9385('0x28')][_0x9385('0x18')](this));try{logger['info'](_0x9385('0x29'));ami[_0x9385('0x2a')]();}catch(_0x3fbdb3){logger[_0x9385('0x2b')](_0x9385('0x2c'),util['inspect'](_0x3fbdb3,{'showHidden':![],'depth':null}));}}VoiceCallReport['prototype'][_0x9385('0x2d')]=function(_0x24aca7){return _0x24aca7!==null&&!_['isUndefined'](_0x24aca7);};VoiceCallReport[_0x9385('0x2e')][_0x9385('0x2f')]=function(_0x19bf3f,_0x18655f,_0x4ef9b6){io['to'](_0x19bf3f)[_0x9385('0x2f')](_0x18655f,_0x4ef9b6);};VoiceCallReport[_0x9385('0x2e')]['syncNewCallerId']=function(_0x2655b9){try{if(this[_0x9385('0x2d')](_0x2655b9)){logger[_0x9385('0x30')](_0x9385('0x31'),_0x2655b9[_0x9385('0x32')],_0x2655b9[_0x9385('0x33')],_0x2655b9[_0x9385('0x34')]);logger[_0x9385('0x35')](_0x9385('0x36'),_0x2655b9[_0x9385('0x32')],util[_0x9385('0x37')](_0x2655b9,{'showHidden':![],'depth':null}));if(_0x2655b9[_0x9385('0x32')]===_0x2655b9[_0x9385('0x38')]){if(!_[_0x9385('0x39')](this[_0x9385('0x14')][_0x2655b9['uniqueid']])){_['merge'](this[_0x9385('0x14')][_0x2655b9[_0x9385('0x32')]],_['pick'](_0x2655b9,_[_0x9385('0x3a')](this['channels'][_0x2655b9['uniqueid']])));}}if(_0x2655b9[_0x9385('0x3b')]===_0x9385('0x3c')){var _0x2e795b=this[_0x9385('0x15')][_0x2655b9[_0x9385('0x3d')][_0x9385('0x3e')]('-')[0x0]];if(_0x2e795b){if(_0x2655b9['exten']==_0x9385('0x3f')){_0x2e795b[_0x9385('0x40')]=_0x2655b9['connectedlinenum'];this[_0x9385('0x2f')](util[_0x9385('0x41')](_0x9385('0x42'),_0x2e795b[_0x9385('0x43')]),_0x9385('0x44'),{'id':_0x2e795b['id'],'destaccountcode':_0x2e795b[_0x9385('0x45')],'destconnectedlinenum':_0x2655b9[_0x9385('0x46')]});}}}}}catch(_0x1f045d){logger[_0x9385('0x2b')]('[%s][voiceCallReport][newcallerid]',_0x2655b9[_0x9385('0x32')],util['inspect'](_0x1f045d,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x9385('0x2e')][_0x9385('0x47')]=function(_0x1783ff){try{if(this[_0x9385('0x2d')](_0x1783ff)){logger['debug'](_0x9385('0x48'),_0x1783ff[_0x9385('0x32')],util[_0x9385('0x37')](_0x1783ff,{'showHidden':![],'depth':null}));if(this[_0x9385('0x14')][_0x1783ff[_0x9385('0x32')]]){return;}if(_0x1783ff[_0x9385('0x3d')]==='OutgoingSpoolFailed'){return;}if(_0x1783ff[_0x9385('0x32')]!==_0x1783ff[_0x9385('0x38')]&&!this['blindTransfers'][_0x1783ff[_0x9385('0x38')]]){return;}logger[_0x9385('0x30')](_0x9385('0x49'),_0x1783ff[_0x9385('0x32')],_0x1783ff['context'],_0x1783ff[_0x9385('0x4a')]);this['channels'][_0x1783ff[_0x9385('0x32')]]=new Channel();this[_0x9385('0x14')][_0x1783ff['uniqueid']]['starttime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x9385('0x14')][_0x1783ff[_0x9385('0x32')]][_0x9385('0x4b')]=dispositions[_['toNumber'](_0x1783ff[_0x9385('0x4c')])];_[_0x9385('0x4d')](this[_0x9385('0x14')][_0x1783ff[_0x9385('0x32')]],_[_0x9385('0x4e')](_0x1783ff,_[_0x9385('0x3a')](this[_0x9385('0x14')][_0x1783ff['uniqueid']])));if(_0x1783ff[_0x9385('0x3b')]===_0x9385('0x3c')){var _0x4ead19=this[_0x9385('0x15')][_0x1783ff[_0x9385('0x3d')][_0x9385('0x3e')]('-')[0x0]];if(_0x4ead19&&typeof _0x4ead19[_0x9385('0x40')]===_0x9385('0x4f')){_0x4ead19[_0x9385('0x40')]=_0x1783ff[_0x9385('0x4a')];logger['debug'](_0x9385('0x50'),_0x1783ff[_0x9385('0x32')],util[_0x9385('0x37')]({'id':_0x4ead19['id'],'destaccountcode':_0x4ead19[_0x9385('0x45')],'destconnectedlinenum':_0x1783ff['exten']},{'showHidden':![],'depth':null}));this[_0x9385('0x2f')](util[_0x9385('0x41')](_0x9385('0x42'),_0x4ead19[_0x9385('0x43')]),'user:agentconnect',{'id':_0x4ead19['id'],'destaccountcode':_0x4ead19[_0x9385('0x45')],'destconnectedlinenum':_0x1783ff[_0x9385('0x4a')]});}}}}catch(_0x1d4c4f){logger['error']('[%s][voiceCallReport][newchannel]',_0x1783ff[_0x9385('0x32')],util['inspect'](_0x1d4c4f,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x9385('0x2e')]['syncNewExten']=function(_0x8e87b3){try{if(this[_0x9385('0x2d')](_0x8e87b3)){logger[_0x9385('0x35')](_0x9385('0x51'),_0x8e87b3[_0x9385('0x32')],util[_0x9385('0x37')](_0x8e87b3,{'showHidden':![],'depth':null}));if(_0x8e87b3[_0x9385('0x3d')]===_0x9385('0x52')||_0x8e87b3[_0x9385('0x4a')]==='h')return;if(_0x8e87b3[_0x9385('0x32')]===_0x8e87b3['linkedid']||this[_0x9385('0x53')][_0x8e87b3[_0x9385('0x38')]]){_0x8e87b3[_0x9385('0x54')]=_0x8e87b3['application']?_0x8e87b3[_0x9385('0x54')][_0x9385('0x55')]():undefined;_0x8e87b3[_0x9385('0x56')]=_0x8e87b3['appdata']||_0x8e87b3[_0x9385('0x56')];if(_0x8e87b3['appdata']&&!_0x8e87b3['appdata'][_0x9385('0x57')](_0x9385('0x58'))&&_0x8e87b3[_0x9385('0x54')]!=='queue'){_0x8e87b3[_0x9385('0x56')]=_0x8e87b3['applicationdata'][_0x9385('0x55')]();}logger[_0x9385('0x30')](_0x9385('0x59'),_0x8e87b3[_0x9385('0x32')],_0x8e87b3[_0x9385('0x54')],_0x8e87b3[_0x9385('0x56')]);if(_[_0x9385('0x39')](this[_0x9385('0x14')][_0x8e87b3[_0x9385('0x32')]])){this[_0x9385('0x14')][_0x8e87b3[_0x9385('0x32')]]=new Channel();this[_0x9385('0x14')][_0x8e87b3['uniqueid']]['starttime']=_0x8e87b3[_0x9385('0x5a')]?moment()[_0x9385('0x5b')](moment[_0x9385('0x5a')](_0x8e87b3[_0x9385('0x5a')])[_0x9385('0x5c')](),'seconds')[_0x9385('0x41')](_0x9385('0x5d')):moment()['format'](_0x9385('0x5d'));this[_0x9385('0x14')][_0x8e87b3['uniqueid']][_0x9385('0x4b')]='NO\x20ANSWER';}_[_0x9385('0x4d')](this['channels'][_0x8e87b3['uniqueid']],_[_0x9385('0x4e')](_0x8e87b3,_[_0x9385('0x3a')](this[_0x9385('0x14')][_0x8e87b3['uniqueid']])));if(_[_0x9385('0x5e')](applications,_0x8e87b3[_0x9385('0x54')])){this[_0x9385('0x14')][_0x8e87b3['uniqueid']]['lastapplication']=_0x8e87b3[_0x9385('0x54')];this[_0x9385('0x14')][_0x8e87b3[_0x9385('0x32')]][_0x9385('0x5f')]=_0x8e87b3['applicationdata'];if(_0x8e87b3['application']===_0x9385('0x8')&&_['startsWith'](_0x8e87b3['applicationdata'][_0x9385('0x55')](),'cdr(')){var _0xf6c656=_0x8e87b3['applicationdata']['split']('=');var _0x1bc76e=_0xf6c656[0x0][_0x9385('0x55')]()[_0x9385('0x60')](/cdr\((.*)\)/);if(_0x1bc76e){if(_0x1bc76e[0x1]==='type'&&!_[_0x9385('0x61')](this[_0x9385('0x14')][_0x8e87b3['uniqueid']][_0x1bc76e[0x1]]))return;this[_0x9385('0x14')][_0x8e87b3[_0x9385('0x32')]][_0x1bc76e[0x1]]=_0xf6c656[0x1];}}else if(_0x8e87b3['application']===_0x9385('0x9')){this[_0x9385('0x14')][_0x8e87b3['uniqueid']][_0x9385('0x9')]=_0x8e87b3[_0x9385('0x56')][_0x9385('0x3e')](',')[0x0];}}}}}catch(_0x5f330a){logger[_0x9385('0x2b')](_0x9385('0x62'),_0x8e87b3[_0x9385('0x32')],util['inspect'](_0x5f330a,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x9385('0x2e')][_0x9385('0x1c')]=function(_0x5bae5c){try{if(this[_0x9385('0x2d')](_0x5bae5c)){logger[_0x9385('0x30')]('[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s',_0x5bae5c[_0x9385('0x32')],_0x5bae5c[_0x9385('0x38')],_0x5bae5c[_0x9385('0x33')],_0x5bae5c['calleridnum']);logger['debug'](_0x9385('0x63'),_0x5bae5c['uniqueid'],util[_0x9385('0x37')](_0x5bae5c,{'showHidden':![],'depth':null}));if(_0x5bae5c[_0x9385('0x4c')]!=='6')return;var _0xa6f776=this[_0x9385('0x15')][_0x5bae5c[_0x9385('0x3d')][_0x9385('0x3e')]('-')[0x0]];if(_0x5bae5c[_0x9385('0x32')]!==_0x5bae5c[_0x9385('0x38')]){var _0xbed69b=moment();if(this[_0x9385('0x14')][_0x5bae5c['linkedid']]){if(!this[_0x9385('0x14')][_0x5bae5c[_0x9385('0x38')]][_0x9385('0x64')]){this['channels'][_0x5bae5c[_0x9385('0x38')]]['answered']=!![];this[_0x9385('0x14')][_0x5bae5c[_0x9385('0x38')]]['answertime']=_0xbed69b['format'](_0x9385('0x5d'));if(this[_0x9385('0x14')][_0x5bae5c[_0x9385('0x38')]][_0x9385('0x65')]){this[_0x9385('0x14')][_0x5bae5c[_0x9385('0x38')]][_0x9385('0x66')]=_0xbed69b[_0x9385('0x67')](this[_0x9385('0x14')][_0x5bae5c[_0x9385('0x38')]]['starttime'],_0x9385('0x5c'));}}this[_0x9385('0x14')][_0x5bae5c[_0x9385('0x38')]][_0x9385('0x38')]=_0x5bae5c[_0x9385('0x32')];if(_0x5bae5c[_0x9385('0x34')]!==_0x9385('0x3f')){this['channels'][_0x5bae5c[_0x9385('0x38')]]['connectedlinenum']=_0x5bae5c[_0x9385('0x34')];}this[_0x9385('0x14')][_0x5bae5c[_0x9385('0x38')]][_0x9385('0x68')]=_0x5bae5c[_0x9385('0x33')];this[_0x9385('0x14')][_0x5bae5c[_0x9385('0x38')]][_0x9385('0x69')]=_0x5bae5c[_0x9385('0x3d')];this['channels'][_0x5bae5c[_0x9385('0x38')]]['disposition']=dispositions[_[_0x9385('0x6a')](_0x5bae5c['channelstate'])];if(_0xa6f776){this['channels'][_0x5bae5c[_0x9385('0x38')]][_0x9385('0x6b')]=_0xa6f776['id'];this[_0x9385('0x14')][_0x5bae5c['linkedid']][_0x9385('0x6c')]=_0xa6f776[_0x9385('0x43')];}}if(this[_0x9385('0x14')][_0x5bae5c[_0x9385('0x32')]]){if(!this['channels'][_0x5bae5c[_0x9385('0x32')]]['answered']){this[_0x9385('0x14')][_0x5bae5c[_0x9385('0x32')]]['answered']=!![];this[_0x9385('0x14')][_0x5bae5c[_0x9385('0x32')]][_0x9385('0x6d')]=_0xbed69b[_0x9385('0x41')](_0x9385('0x5d'));if(this[_0x9385('0x14')][_0x5bae5c[_0x9385('0x32')]][_0x9385('0x65')]){this[_0x9385('0x14')][_0x5bae5c[_0x9385('0x32')]][_0x9385('0x66')]=_0xbed69b[_0x9385('0x67')](this[_0x9385('0x14')][_0x5bae5c[_0x9385('0x32')]][_0x9385('0x65')],_0x9385('0x5c'));}}if(_0x5bae5c[_0x9385('0x34')]!==_0x9385('0x3f')){this[_0x9385('0x14')][_0x5bae5c[_0x9385('0x32')]][_0x9385('0x46')]=_0x5bae5c[_0x9385('0x34')];}this[_0x9385('0x14')][_0x5bae5c[_0x9385('0x32')]][_0x9385('0x68')]=_0x5bae5c[_0x9385('0x33')];this[_0x9385('0x14')][_0x5bae5c[_0x9385('0x32')]][_0x9385('0x69')]=_0x5bae5c[_0x9385('0x3d')];this[_0x9385('0x14')][_0x5bae5c[_0x9385('0x32')]][_0x9385('0x4b')]=dispositions[_[_0x9385('0x6a')](_0x5bae5c[_0x9385('0x4c')])];}}else{if(this[_0x9385('0x14')][_0x5bae5c[_0x9385('0x32')]]){if(_0xa6f776){this[_0x9385('0x14')][_0x5bae5c[_0x9385('0x32')]][_0x9385('0x6b')]=_0xa6f776['id'];this[_0x9385('0x14')][_0x5bae5c[_0x9385('0x32')]][_0x9385('0x6c')]=_0xa6f776[_0x9385('0x43')];}}}if(_0x5bae5c[_0x9385('0x3b')]===_0x9385('0x3c')){if(_0xa6f776){_0xa6f776[_0x9385('0x40')]=_0x5bae5c[_0x9385('0x4a')];var _0x2228d8,_0x3332db;if(this[_0x9385('0x14')][_0x5bae5c['uniqueid']]){_0x2228d8=this[_0x9385('0x14')][_0x5bae5c[_0x9385('0x32')]]['routealias'];_0x3332db=this['channels'][_0x5bae5c['uniqueid']]['queue'];}else if(this[_0x9385('0x14')][_0x5bae5c[_0x9385('0x38')]]){_0x2228d8=this['channels'][_0x5bae5c[_0x9385('0x38')]][_0x9385('0x6e')];_0x3332db=this[_0x9385('0x14')][_0x5bae5c[_0x9385('0x38')]][_0x9385('0x9')];}_0xa6f776[_0x9385('0x9')]=_0x3332db;_0xa6f776[_0x9385('0x6e')]=_0x2228d8;var _0xe8afb0={'id':_0xa6f776['id'],'name':_0xa6f776[_0x9385('0x43')],'agentconnected':!![],'destaccountcode':_0xa6f776[_0x9385('0x45')],'destconnectedlinenum':_0x5bae5c[_0x9385('0x4a')],'queue':_0x3332db||undefined,'routealias':_0x2228d8,'uniqueid':_0x5bae5c[_0x9385('0x38')]};logger[_0x9385('0x35')](_0x9385('0x6f'),_0x5bae5c['uniqueid'],util[_0x9385('0x37')](_0xe8afb0,{'showHidden':![],'depth':null}));this[_0x9385('0x2f')](util['format']('user:%s',_0xa6f776[_0x9385('0x43')]),_0x9385('0x44'),_0xe8afb0);}}}}catch(_0x149885){logger[_0x9385('0x2b')](_0x9385('0x70'),_0x5bae5c['uniqueid'],util[_0x9385('0x37')](_0x149885,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x9385('0x71')]=function(_0x14040a,_0x15a2ce){try{if(this[_0x9385('0x14')][_0x14040a]){logger[_0x9385('0x30')](_0x9385('0x72'),_0x14040a,_0x15a2ce);this['channels'][_0x14040a][_0x9385('0x73')]=!![];if(_[_0x9385('0x74')](_0x15a2ce,_0x9385('0x75'))){_0x15a2ce=_0x15a2ce[_0x9385('0x76')]('.wav49','.WAV');}this[_0x9385('0x14')][_0x14040a]['monitorFilename']=_0x15a2ce;var _0x1f3dac=_['find'](this[_0x9385('0x14')][_0x14040a][_0x9385('0x77')],{'filename':_0x15a2ce});if(_[_0x9385('0x61')](_0x1f3dac)){this[_0x9385('0x14')][_0x14040a][_0x9385('0x77')]['push']({'filename':_0x15a2ce,'createdAt':moment()[_0x9385('0x41')](_0x9385('0x5d')),'mixmonitorid':'','status':_0x9385('0x78')});}}}catch(_0x17def8){logger[_0x9385('0x2b')](_0x9385('0x79'),_0x14040a,util[_0x9385('0x37')](_0x17def8,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x9385('0x2e')][_0x9385('0x1e')]=function(_0x1e9d56){try{if(this[_0x9385('0x2d')](_0x1e9d56)){logger[_0x9385('0x35')]('[%s][voiceCallReport][varset]\x20event:',_0x1e9d56['uniqueid'],util[_0x9385('0x37')](_0x1e9d56,{'showHidden':![],'depth':null}));if(this[_0x9385('0x14')][_0x1e9d56[_0x9385('0x32')]]&&_0x1e9d56[_0x9385('0x3d')]!=_0x9385('0x52')){if(this['isNotNull'](_0x1e9d56[_0x9385('0x7a')])){if(this['isNotNull'](_0x1e9d56[_0x9385('0x7a')][_0x9385('0x7b')])){logger['info'](_0x9385('0x7c'),_0x1e9d56[_0x9385('0x32')],_0x1e9d56[_0x9385('0x7d')]);this[_0x9385('0x71')](_0x1e9d56['uniqueid'],_0x1e9d56[_0x9385('0x7d')]);}else if(this[_0x9385('0x2d')](_0x1e9d56['variable'][_0x9385('0x7e')])){logger[_0x9385('0x30')](_0x9385('0x7f'),_0x1e9d56[_0x9385('0x32')],_0x1e9d56[_0x9385('0x7d')]);this[_0x9385('0x14')][_0x1e9d56[_0x9385('0x32')]][_0x9385('0x34')]=_0x1e9d56[_0x9385('0x7d')];}else if(this[_0x9385('0x2d')](_0x1e9d56[_0x9385('0x7a')]['xmd-callerid'])){logger[_0x9385('0x30')](_0x9385('0x80'),_0x1e9d56[_0x9385('0x32')],_0x1e9d56[_0x9385('0x7d')]);this[_0x9385('0x14')][_0x1e9d56['uniqueid']][_0x9385('0x81')]=_0x1e9d56['value'];}else if(this[_0x9385('0x2d')](_0x1e9d56[_0x9385('0x7a')][_0x9385('0x82')])){logger[_0x9385('0x30')](_0x9385('0x83'),_0x1e9d56['uniqueid'],_0x1e9d56[_0x9385('0x7d')]);this[_0x9385('0x14')][_0x1e9d56[_0x9385('0x32')]]['type']=_0x1e9d56[_0x9385('0x7d')];}else if(this[_0x9385('0x2d')](_0x1e9d56[_0x9385('0x7a')][_0x9385('0x84')])){logger[_0x9385('0x30')](_0x9385('0x85'),_0x1e9d56[_0x9385('0x32')],_0x1e9d56[_0x9385('0x7d')]['split'](',')[0x0]);this[_0x9385('0x14')][_0x1e9d56[_0x9385('0x32')]][_0x9385('0x9')]=_0x1e9d56['value']['split'](',')[0x0];}else if(this[_0x9385('0x2d')](_0x1e9d56[_0x9385('0x7a')][_0x9385('0x86')])){logger[_0x9385('0x30')](_0x9385('0x87'),_0x1e9d56[_0x9385('0x32')],_0x1e9d56[_0x9385('0x7d')]);this[_0x9385('0x14')][_0x1e9d56[_0x9385('0x32')]]['originatecalleridnum']=_0x1e9d56[_0x9385('0x7d')];}else if(this['isNotNull'](_0x1e9d56[_0x9385('0x7a')][_0x9385('0x88')])){logger[_0x9385('0x30')](_0x9385('0x89'),_0x1e9d56['uniqueid'],_0x1e9d56[_0x9385('0x7d')]);this[_0x9385('0x14')][_0x1e9d56[_0x9385('0x32')]][_0x9385('0x8a')]=_0x1e9d56['value'];}else if(this[_0x9385('0x2d')](_0x1e9d56[_0x9385('0x7a')][_0x9385('0x8b')])){logger[_0x9385('0x30')](_0x9385('0x8c'),_0x1e9d56[_0x9385('0x32')],_0x1e9d56[_0x9385('0x7d')]);this[_0x9385('0x14')][_0x1e9d56[_0x9385('0x32')]][_0x9385('0x8d')]=_0x1e9d56[_0x9385('0x7d')];}else if(this[_0x9385('0x2d')](_0x1e9d56[_0x9385('0x7a')][_0x9385('0x8e')])){logger[_0x9385('0x30')]('[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s',_0x1e9d56[_0x9385('0x32')],_0x1e9d56[_0x9385('0x7d')]);this[_0x9385('0x14')][_0x1e9d56[_0x9385('0x32')]]['queue']=_0x1e9d56[_0x9385('0x7d')];}else if(this[_0x9385('0x2d')](_0x1e9d56['variable']['sipcallid'])){logger[_0x9385('0x30')](_0x9385('0x8f'),_0x1e9d56['uniqueid'],_0x1e9d56[_0x9385('0x7d')]);this[_0x9385('0x14')][_0x1e9d56[_0x9385('0x32')]]['sipcalluniqueid']=_0x1e9d56['value'];}}}else if(this['isNotNull'](_0x1e9d56[_0x9385('0x7a')]['mixmonitor_filename'])){if(_0x1e9d56['value']){var _0x20b1ef=path[_0x9385('0x90')](_0x1e9d56[_0x9385('0x7d')])['name'];logger[_0x9385('0x30')](_0x9385('0x7c'),_0x20b1ef,_0x1e9d56['value']);this[_0x9385('0x71')](_0x20b1ef,_0x1e9d56['value']);}}else if(this[_0x9385('0x14')][_0x1e9d56[_0x9385('0x38')]]){if(this[_0x9385('0x2d')](_0x1e9d56[_0x9385('0x7a')])){if(this[_0x9385('0x2d')](_0x1e9d56[_0x9385('0x7a')]['sipcallid'])){logger[_0x9385('0x30')](_0x9385('0x8f'),_0x1e9d56['linkedid'],_0x1e9d56[_0x9385('0x7d')]);this[_0x9385('0x14')][_0x1e9d56['linkedid']]['sipcalllinkedid']=_0x1e9d56[_0x9385('0x7d')];}}}}}catch(_0x5b6dac){logger[_0x9385('0x2b')](_0x9385('0x91'),_0x1e9d56[_0x9385('0x32')],util[_0x9385('0x37')](_0x5b6dac,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x9385('0x2e')][_0x9385('0x20')]=function(_0x2b041e){try{if(this[_0x9385('0x2d')](_0x2b041e)){logger[_0x9385('0x35')]('[%s][voiceCallReport][hangup]\x20event:',_0x2b041e['uniqueid'],util[_0x9385('0x37')](_0x2b041e,{'showHidden':![],'depth':null}));if(this['blindTransfers'][_0x2b041e['linkedid']]){if(this[_0x9385('0x14')][this[_0x9385('0x53')][_0x2b041e['linkedid']]['linkedid']]){this[_0x9385('0x14')][this[_0x9385('0x53')][_0x2b041e[_0x9385('0x38')]][_0x9385('0x38')]][_0x9385('0x32')]=_0x2b041e[_0x9385('0x32')];this[_0x9385('0x14')][this[_0x9385('0x53')][_0x2b041e[_0x9385('0x38')]][_0x9385('0x38')]][_0x9385('0x64')]=this[_0x9385('0x14')][_0x2b041e['uniqueid']][_0x9385('0x64')];this['channels'][this['blindTransfers'][_0x2b041e[_0x9385('0x38')]][_0x9385('0x38')]][_0x9385('0x6d')]=this[_0x9385('0x14')][_0x2b041e[_0x9385('0x32')]]['answertime'];this[_0x9385('0x14')][this['blindTransfers'][_0x2b041e[_0x9385('0x38')]][_0x9385('0x38')]][_0x9385('0x69')]=this[_0x9385('0x14')][this[_0x9385('0x53')][_0x2b041e[_0x9385('0x38')]][_0x9385('0x38')]][_0x9385('0x3d')];this['channels'][this['blindTransfers'][_0x2b041e[_0x9385('0x38')]][_0x9385('0x38')]][_0x9385('0x4b')]=this[_0x9385('0x14')][_0x2b041e['uniqueid']][_0x9385('0x4b')];this['channels'][_0x2b041e[_0x9385('0x32')]]=this[_0x9385('0x14')][this[_0x9385('0x53')][_0x2b041e[_0x9385('0x38')]][_0x9385('0x38')]];delete this[_0x9385('0x14')][this['blindTransfers'][_0x2b041e[_0x9385('0x38')]][_0x9385('0x38')]];}else if(this[_0x9385('0x14')][this[_0x9385('0x53')][_0x2b041e['linkedid']][_0x9385('0x32')]]){this['channels'][this[_0x9385('0x53')][_0x2b041e[_0x9385('0x38')]][_0x9385('0x32')]][_0x9385('0x32')]=[this['channels'][this[_0x9385('0x53')][_0x2b041e[_0x9385('0x38')]][_0x9385('0x32')]][_0x9385('0x38')],this[_0x9385('0x14')][this['blindTransfers'][_0x2b041e[_0x9385('0x38')]][_0x9385('0x32')]]['linkedid']=this[_0x9385('0x14')][this[_0x9385('0x53')][_0x2b041e[_0x9385('0x38')]][_0x9385('0x32')]][_0x9385('0x32')]][0x0];this[_0x9385('0x14')][this['blindTransfers'][_0x2b041e[_0x9385('0x38')]][_0x9385('0x32')]][_0x9385('0x64')]=this[_0x9385('0x14')][_0x2b041e[_0x9385('0x32')]]['answered'];this[_0x9385('0x14')][this[_0x9385('0x53')][_0x2b041e[_0x9385('0x38')]]['uniqueid']][_0x9385('0x6d')]=this[_0x9385('0x14')][_0x2b041e['uniqueid']][_0x9385('0x6d')];this[_0x9385('0x14')][this[_0x9385('0x53')][_0x2b041e[_0x9385('0x38')]][_0x9385('0x32')]]['destinationchannel']=this[_0x9385('0x14')][this[_0x9385('0x53')][_0x2b041e[_0x9385('0x38')]][_0x9385('0x32')]][_0x9385('0x3d')];this['channels'][this['blindTransfers'][_0x2b041e[_0x9385('0x38')]][_0x9385('0x32')]][_0x9385('0x4b')]=this[_0x9385('0x14')][_0x2b041e[_0x9385('0x32')]][_0x9385('0x4b')];this[_0x9385('0x14')][_0x2b041e[_0x9385('0x32')]]=this[_0x9385('0x14')][this['blindTransfers'][_0x2b041e['linkedid']][_0x9385('0x32')]];delete this[_0x9385('0x14')][this['blindTransfers'][_0x2b041e['linkedid']][_0x9385('0x32')]];}}if(this[_0x9385('0x14')][_0x2b041e[_0x9385('0x32')]]){logger['info'](_0x9385('0x92'),_0x2b041e[_0x9385('0x32')],_0x2b041e[_0x9385('0x93')]);var _0x185b43=moment();this[_0x9385('0x14')][_0x2b041e[_0x9385('0x32')]]['endtime']=_0x185b43[_0x9385('0x41')](_0x9385('0x5d'));this[_0x9385('0x14')][_0x2b041e[_0x9385('0x32')]]['duration']=_0x185b43['diff'](this[_0x9385('0x14')][_0x2b041e[_0x9385('0x32')]][_0x9385('0x65')],_0x9385('0x5c'));if(this['channels'][_0x2b041e[_0x9385('0x32')]]['answered']){this['channels'][_0x2b041e[_0x9385('0x32')]]['billableseconds']=_0x185b43['diff'](this[_0x9385('0x14')][_0x2b041e['uniqueid']][_0x9385('0x6d')],_0x9385('0x5c'));this['channels'][_0x2b041e['uniqueid']][_0x9385('0x66')]=this[_0x9385('0x14')][_0x2b041e['uniqueid']][_0x9385('0x5a')]-this['channels'][_0x2b041e[_0x9385('0x32')]]['billableseconds'];}if(_0x2b041e['context']===_0x9385('0x3c')){if(this['agents'][_0x2b041e[_0x9385('0x3d')][_0x9385('0x3e')]('-')[0x0]]){this[_0x9385('0x15')][_0x2b041e[_0x9385('0x3d')][_0x9385('0x3e')]('-')[0x0]]=_[_0x9385('0x94')](this[_0x9385('0x15')][_0x2b041e[_0x9385('0x3d')]['split']('-')[0x0]],[_0x9385('0x40')]);logger[_0x9385('0x35')](_0x9385('0x95'),_0x2b041e['uniqueid'],util['inspect']({'id':this['agents'][_0x2b041e[_0x9385('0x3d')][_0x9385('0x3e')]('-')[0x0]]['id'],'destaccountcode':this['agents'][_0x2b041e[_0x9385('0x3d')][_0x9385('0x3e')]('-')[0x0]][_0x9385('0x45')]},{'showHidden':![],'depth':null}));this[_0x9385('0x2f')](util[_0x9385('0x41')](_0x9385('0x42'),this[_0x9385('0x15')][_0x2b041e[_0x9385('0x3d')][_0x9385('0x3e')]('-')[0x0]]['name']),_0x9385('0x96'),{'id':this[_0x9385('0x15')][_0x2b041e[_0x9385('0x3d')][_0x9385('0x3e')]('-')[0x0]]['id'],'destaccountcode':this[_0x9385('0x15')][_0x2b041e['channel']['split']('-')[0x0]][_0x9385('0x45')]});for(var _0x2b79ee=0x0;_0x2b79ee0x0?!![]:![];if(!_0x4833f1){return this[_0xbe25('0x6a')](this[_0xbe25('0x18')][_0xbe25('0x6b')]);}};VoiceQueueReport['prototype'][_0xbe25('0x1c')]=function(_0x1804fb){var _0x46679c=this['summary']['id'];if(this['summary'][_0xbe25('0x5f')][_0x46679c]&&this[_0xbe25('0x18')][_0xbe25('0x5f')][_0x46679c][_0x1804fb[_0xbe25('0x5e')]]){this[_0xbe25('0x18')]['queuestatus'][_0x46679c][_0x1804fb['actionid']]['agents'][_0xbe25('0x6c')](_0x1804fb);}};VoiceQueueReport[_0xbe25('0xe')][_0xbe25('0x6d')]=function(_0x132516){var _0xcbec66=this;try{if(this[_0xbe25('0x58')](_0x132516)&&this[_0xbe25('0x58')](_0x132516['queue'])){logger[_0xbe25('0x47')](_0xbe25('0x6e'),util['inspect'](_0x132516,{'showHidden':![],'depth':null}));var _0x408de7=this[_0xbe25('0x16')][_0x132516[_0xbe25('0x4c')]];if(_0x408de7){logger[_0xbe25('0x47')](_0xbe25('0x6f'),_0x408de7[_0xbe25('0x56')]);this[_0xbe25('0x18')]['queues'][_0x408de7['name']]={'summaryEvent':_0x132516};this[_0xbe25('0x18')]['statusRequests']+=0x1;return ami[_0xbe25('0x38')]({'action':_0xbe25('0x5f'),'queue':_0x408de7[_0xbe25('0x56')]})[_0xbe25('0x5d')](function(_0x382f79){if(!_0xcbec66[_0xbe25('0x18')][_0xbe25('0x5f')][_0x132516[_0xbe25('0x5e')]]){_0xcbec66[_0xbe25('0x18')][_0xbe25('0x5f')][_0x132516['actionid']]={};}_0xcbec66['summary'][_0xbe25('0x5f')][_0x132516[_0xbe25('0x5e')]][_0x382f79['actionid']]={'queue':_0x408de7[_0xbe25('0x56')],'agents':[]};})[_0xbe25('0x3a')](function(_0x244e68){throw _0x244e68;});}}}catch(_0x2596bd){logger[_0xbe25('0x3d')](_0xbe25('0x70'),util['inspect'](_0x2596bd,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xbe25('0xe')][_0xbe25('0x6a')]=function(_0x2dc741){if(this[_0xbe25('0x18')]['statusRequests']>0x0){this[_0xbe25('0x18')]['completeEvent']=_0x2dc741;return;}logger[_0xbe25('0x47')](_0xbe25('0x71'),util[_0xbe25('0x3f')](_0x2dc741,{'showHidden':![],'depth':null}));this[_0xbe25('0x18')]=initializeSummary();ami['emit'](_0xbe25('0x72'),{});};VoiceQueueReport['prototype'][_0xbe25('0x73')]=function(_0x53fe78){try{if(this[_0xbe25('0x58')](_0x53fe78)){logger[_0xbe25('0x47')](_0xbe25('0x74'),_0x53fe78[_0xbe25('0x4a')],util['inspect'](_0x53fe78,{'showHidden':![],'depth':null}));if(_[_0xbe25('0x75')](this[_0xbe25('0x12')][_0x53fe78[_0xbe25('0x4a')]])){this['queueReports'][_0x53fe78['uniqueid']]=[];}if(_['isUndefined'](this['channels'][_0x53fe78[_0xbe25('0x4a')]])){this['channels'][_0x53fe78[_0xbe25('0x4a')]]={};}var _0x28af12=new QueueReport();_0x28af12[_0xbe25('0x4c')]=_0x53fe78[_0xbe25('0x4c')];_0x28af12[_0xbe25('0x55')]=this[_0xbe25('0x16')][_0x28af12[_0xbe25('0x4c')]]&&this['voiceQueues'][_0x28af12[_0xbe25('0x4c')]]['type']?this[_0xbe25('0x16')][_0x28af12[_0xbe25('0x4c')]][_0xbe25('0x55')]||'inbound':_0xbe25('0x66');_0x28af12[_0xbe25('0x76')]=moment()[_0xbe25('0x52')](_0xbe25('0x77'));_0x28af12[_0xbe25('0x78')]=_0x53fe78[_0xbe25('0x78')];_0x28af12[_0xbe25('0x79')]=_0x53fe78[_0xbe25('0x79')];_0x28af12[_0xbe25('0x4a')]=_0x53fe78['uniqueid'];_0x28af12[_0xbe25('0x7a')]=this['channels'][_0x53fe78['uniqueid']][_0xbe25('0x7a')];logger[_0xbe25('0x7b')](_0xbe25('0x7c'),_0x28af12[_0xbe25('0x4c')],_0x28af12[_0xbe25('0x55')]);Object[_0xbe25('0x64')](_0x28af12,_['pick'](_0x53fe78,_['keys'](_0x28af12)));this[_0xbe25('0x12')][_0x53fe78[_0xbe25('0x4a')]][_0xbe25('0x6c')](_0x28af12);this[_0xbe25('0x14')][_0x53fe78[_0xbe25('0x4a')]]=_0x28af12;this[_0xbe25('0x46')](_0x28af12,'queuecallerjoin');}}catch(_0x13c24b){logger[_0xbe25('0x3d')](_0xbe25('0x74'),_0x53fe78[_0xbe25('0x4a')],util[_0xbe25('0x3f')](_0x13c24b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xbe25('0xe')][_0xbe25('0x7d')]=function(_0x32f7b4){try{if(this[_0xbe25('0x58')](_0x32f7b4)){logger[_0xbe25('0x47')](_0xbe25('0x7e'),_0x32f7b4[_0xbe25('0x4a')],util[_0xbe25('0x3f')](_0x32f7b4,{'showHidden':![],'depth':null}));if(this[_0xbe25('0x12')][_0x32f7b4['uniqueid']]){var _0x2e1ddd=_[_0xbe25('0x7f')](this['queueReports'][_0x32f7b4['uniqueid']]);_0x2e1ddd['queuecallercomplete']=![];_0x2e1ddd[_0xbe25('0x80')]=null;_0x2e1ddd['holdtime']=_0x32f7b4['holdtime'];_0x2e1ddd[_0xbe25('0x81')]=_0x32f7b4['originalposition'];_0x2e1ddd[_0xbe25('0x20')]=!![];_0x2e1ddd[_0xbe25('0x82')]=moment()[_0xbe25('0x52')](_0xbe25('0x77'));_0x2e1ddd[_0xbe25('0x50')]=_0xbe25('0x83');_0x2e1ddd[_0xbe25('0x84')]=null;logger[_0xbe25('0x7b')]('[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s',_0x2e1ddd[_0xbe25('0x4c')],_0x2e1ddd[_0xbe25('0x55')]);this[_0xbe25('0x14')][_0x32f7b4['uniqueid']]=_0x2e1ddd;this['emitVoiceQueueChannelRemove'](_0x2e1ddd,_0xbe25('0x20'));}}}catch(_0x3f8e0d){logger[_0xbe25('0x3d')](_0xbe25('0x7e'),_0x32f7b4[_0xbe25('0x4a')],util[_0xbe25('0x3f')](_0x3f8e0d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xbe25('0xe')][_0xbe25('0x85')]=function(_0x4eeea1){try{if(this[_0xbe25('0x58')](_0x4eeea1)){logger['debug'](_0xbe25('0x86'),_0x4eeea1[_0xbe25('0x4a')],util[_0xbe25('0x3f')](_0x4eeea1,{'showHidden':![],'depth':null}));if(this[_0xbe25('0x12')][_0x4eeea1[_0xbe25('0x4a')]]){var _0x12b7f3=_['last'](this[_0xbe25('0x12')][_0x4eeea1[_0xbe25('0x4a')]]);_0x12b7f3[_0xbe25('0x87')]=moment()[_0xbe25('0x52')](_0xbe25('0x77'));_0x12b7f3[_0xbe25('0x88')]=_0x4eeea1['connectedlinenum'];_0x12b7f3[_0xbe25('0x89')]=_0x4eeea1['connectedlinename'];logger[_0xbe25('0x7b')](_0xbe25('0x8a'),_0x12b7f3[_0xbe25('0x4c')],_0x12b7f3[_0xbe25('0x55')],_0x4eeea1['connectedlinenum'],_0x4eeea1[_0xbe25('0x89')]);this[_0xbe25('0x14')][_0x4eeea1[_0xbe25('0x4a')]]=_0x12b7f3;this[_0xbe25('0x46')](_0x12b7f3,_0xbe25('0x21'));}}}catch(_0x1dba26){logger[_0xbe25('0x3d')](_0xbe25('0x86'),_0x4eeea1[_0xbe25('0x4a')],util[_0xbe25('0x3f')](_0x1dba26,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xbe25('0xe')][_0xbe25('0x25')]=function(_0x2bf0a9){try{if(this[_0xbe25('0x58')](_0x2bf0a9)){logger[_0xbe25('0x47')](_0xbe25('0x8b'),_0x2bf0a9[_0xbe25('0x4a')],util['inspect'](_0x2bf0a9,{'showHidden':![],'depth':null}));if(this[_0xbe25('0x12')][_0x2bf0a9[_0xbe25('0x4a')]]){var _0x37d5a9=_['last'](this[_0xbe25('0x12')][_0x2bf0a9[_0xbe25('0x4a')]]);_0x37d5a9[_0xbe25('0x37')]=!![];_0x37d5a9['queuecallerexitreason']=_0xbe25('0x8c');logger[_0xbe25('0x7b')]('[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT',_0x37d5a9[_0xbe25('0x4c')],_0x37d5a9[_0xbe25('0x55')]);}}}catch(_0x1c89fb){logger['error'](_0xbe25('0x8b'),_0x2bf0a9[_0xbe25('0x4a')],util[_0xbe25('0x3f')](_0x1c89fb,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xbe25('0x23')]=function(_0x4f6d3d){try{if(this[_0xbe25('0x58')](_0x4f6d3d)){logger[_0xbe25('0x47')]('[%s][voiceQueueReport][agentcomplete]',_0x4f6d3d[_0xbe25('0x4a')],util['inspect'](_0x4f6d3d,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x4f6d3d['uniqueid']]){var _0x48d3fa=_['last'](this[_0xbe25('0x12')][_0x4f6d3d[_0xbe25('0x4a')]]);_0x48d3fa[_0xbe25('0x20')]=![];_0x48d3fa['queuecallerabandonAt']=null;_0x48d3fa[_0xbe25('0x8d')]=!![];_0x48d3fa[_0xbe25('0x84')]=_0x4f6d3d['membername'];_0x48d3fa[_0xbe25('0x8e')]=_0x4f6d3d[_0xbe25('0x8e')];_0x48d3fa['queuecallercomplete']=!![];_0x48d3fa[_0xbe25('0x8f')]=![];_0x48d3fa[_0xbe25('0x90')]=null;if(!_0x48d3fa[_0xbe25('0x91')]){if(_0x4f6d3d[_0xbe25('0x92')]==_0xbe25('0x91')){_0x48d3fa[_0xbe25('0x50')]=_0xbe25('0x93');logger[_0xbe25('0x7b')](_0xbe25('0x94'),_0x48d3fa[_0xbe25('0x4c')],_0x48d3fa['type']);}else{if(_[_0xbe25('0x95')](_0x4f6d3d[_0xbe25('0x39')][_0xbe25('0x96')](),_0xbe25('0x97'))){if(this[_0xbe25('0x12')][_0x4f6d3d[_0xbe25('0x98')]]){var _0x5b994f=_[_0xbe25('0x7f')](this[_0xbe25('0x12')][_0x4f6d3d[_0xbe25('0x98')]]);_0x5b994f[_0xbe25('0x37')]=![];_0x5b994f[_0xbe25('0x8f')]=!![];_0x5b994f[_0xbe25('0x90')]=moment(_0x48d3fa[_0xbe25('0x76')])[_0xbe25('0x99')](_0x4f6d3d[_0xbe25('0x8e')],_0xbe25('0x9a'))[_0xbe25('0x52')](_0xbe25('0x77'));_0x5b994f[_0xbe25('0x50')]=_0xbe25('0x9b');_0x5b994f[_0xbe25('0x91')]=!![];_0x5b994f[_0xbe25('0x9c')]=_0xbe25('0x9d');_0x5b994f[_0xbe25('0x9e')]=_0x4f6d3d[_0xbe25('0x9f')];_0x5b994f['transferuniqueid']=_0x4f6d3d['uniqueid'];logger[_0xbe25('0x7b')](_0xbe25('0xa0'),_0x5b994f[_0xbe25('0x4c')],_0x5b994f[_0xbe25('0x55')]);var _0x345a20=this[_0xbe25('0x12')][_0x4f6d3d['linkedid']];this[_0xbe25('0x12')][_0x4f6d3d[_0xbe25('0x98')]]=this[_0xbe25('0x12')][_0x4f6d3d[_0xbe25('0x4a')]];this[_0xbe25('0x12')][_0x4f6d3d['uniqueid']]=_0x345a20;}}else{_0x48d3fa['queuecallerexitreason']='COMPLETEDBY'+_0x4f6d3d[_0xbe25('0x92')][_0xbe25('0xa1')]();logger[_0xbe25('0x7b')](_0xbe25('0xa2'),_0x48d3fa[_0xbe25('0x4c')],_0x48d3fa[_0xbe25('0x55')],_0x48d3fa[_0xbe25('0x50')]);}}}this[_0xbe25('0x14')][_0x4f6d3d[_0xbe25('0x4a')]]=_0x48d3fa;}}}catch(_0x4ca3de){logger[_0xbe25('0x3d')]('[%s][voiceQueueReport][agentcomplete]',_0x4f6d3d[_0xbe25('0x4a')],util[_0xbe25('0x3f')](_0x4ca3de,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xbe25('0xe')]['syncVarSet']=function(_0xd7d26f){try{if(this[_0xbe25('0x58')](_0xd7d26f)){logger[_0xbe25('0x47')](_0xbe25('0xa3'),_0xd7d26f[_0xbe25('0x4a')],util[_0xbe25('0x3f')](_0xd7d26f,{'showHidden':![],'depth':null}));this[_0xbe25('0xa4')](_0xd7d26f[_0xbe25('0x4a')],_[_0xbe25('0xa5')](_0xd7d26f[_0xbe25('0xa6')])[0x0],_0xd7d26f[_0xbe25('0xa7')]);if(this[_0xbe25('0x12')][_0xd7d26f[_0xbe25('0x4a')]]){var _0x35aac4=_[_0xbe25('0x7f')](this['queueReports'][_0xd7d26f[_0xbe25('0x4a')]]);if(_0x35aac4){if(this[_0xbe25('0x58')](_0xd7d26f['variable'])&&this[_0xbe25('0x58')](_0xd7d26f[_0xbe25('0xa6')][_0xbe25('0x5f')])){switch(_0xd7d26f[_0xbe25('0xa7')]){case _0xbe25('0xa8'):_0x35aac4[_0xbe25('0x8f')]=![];_0x35aac4[_0xbe25('0x90')]=null;break;case _0xbe25('0xa9'):_0x35aac4[_0xbe25('0xaa')]=_0xbe25('0xab');_0x35aac4[_0xbe25('0x8f')]=!![];_0x35aac4['queuecallerexitAt']=moment()[_0xbe25('0x52')]('YYYY-MM-DD\x20HH:mm:ss');_0x35aac4[_0xbe25('0x87')]=moment()[_0xbe25('0x52')](_0xbe25('0x77'));logger[_0xbe25('0x47')](_0xbe25('0xac'),_0xd7d26f[_0xbe25('0x4a')],util[_0xbe25('0x3f')](_0x35aac4,{'showHidden':![],'depth':null}));ami[_0xbe25('0x45')](_0xbe25('0xad'),_0x35aac4);break;default:_0x35aac4[_0xbe25('0x8f')]=!![];_0x35aac4[_0xbe25('0x90')]=moment()[_0xbe25('0x52')](_0xbe25('0x77'));_0x35aac4[_0xbe25('0x87')]=moment()[_0xbe25('0x52')]('YYYY-MM-DD\x20HH:mm:ss');}_0x35aac4[_0xbe25('0x20')]=![];_0x35aac4[_0xbe25('0x82')]=null;_0x35aac4[_0xbe25('0x50')]=_0xd7d26f[_0xbe25('0xa7')];this[_0xbe25('0x14')][_0xd7d26f[_0xbe25('0x4a')]]=_0x35aac4;this[_0xbe25('0x43')](_0x35aac4,_0xbe25('0x26'));}else if(this[_0xbe25('0x58')](_0xd7d26f[_0xbe25('0xa6')])&&this[_0xbe25('0x58')](_0xd7d26f[_0xbe25('0xa6')][_0xbe25('0xae')])){if(!_0x35aac4[_0xbe25('0x20')]){_0x35aac4[_0xbe25('0x8f')]=!![];_0x35aac4['queuecallerexitAt']=moment()[_0xbe25('0x52')](_0xbe25('0x77'));_0x35aac4[_0xbe25('0x50')]=_0xbe25('0xaf');_0x35aac4[_0xbe25('0x87')]=moment()[_0xbe25('0x52')](_0xbe25('0x77'));this['channels'][_0xd7d26f[_0xbe25('0x4a')]]=_0x35aac4;}}logger[_0xbe25('0x7b')]('[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s',_0xd7d26f[_0xbe25('0x4a')],_0x35aac4[_0xbe25('0x4c')],_0x35aac4[_0xbe25('0x55')],_[_0xbe25('0xa5')](_0xd7d26f[_0xbe25('0xa6')])[0x0],_0xd7d26f[_0xbe25('0xa7')]);_0x35aac4[_0xbe25('0x19')]=this[_0xbe25('0x19')][_0xd7d26f['uniqueid']];}}}}catch(_0x562724){logger['error'](_0xbe25('0xa3'),_0xd7d26f[_0xbe25('0x4a')],util['inspect'](_0x562724,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xbe25('0xe')][_0xbe25('0xa4')]=function(_0x338e6a,_0x27bdf7,_0x4dc2fb){var _0x5dc4b6=[_0xbe25('0xb0'),_0xbe25('0xb1'),_0xbe25('0xb2'),_0xbe25('0xb3'),_0xbe25('0xb4'),_0xbe25('0xb5'),_0xbe25('0xb6'),'rtpaudioqosrttbridged',_0xbe25('0xb7'),'sipuri',_0xbe25('0xb8'),_0xbe25('0xb9'),'membercalls',_0xbe25('0xba'),'memberinterface','memberlastcall',_0xbe25('0xbb'),_0xbe25('0xbc'),_0xbe25('0xbd')];if(!_[_0xbe25('0xbe')](_0x27bdf7)&&!_[_0xbe25('0xbf')](_0x5dc4b6,_0x27bdf7)){if(_[_0xbe25('0x75')](this[_0xbe25('0x19')][_0x338e6a])){this[_0xbe25('0x19')][_0x338e6a]={};}this[_0xbe25('0x19')][_0x338e6a][_0x27bdf7]=_0x4dc2fb;}};VoiceQueueReport[_0xbe25('0xe')][_0xbe25('0xc0')]=function(_0x56b869,_0x13b028,_0x1cf770){try{var _0x5a8ea7={};if(this[_0xbe25('0x12')][_0x56b869]){for(var _0x4b9d7a=0x0;_0x4b9d7a0x0?!![]:![];if(!_0x197044){return this[_0x5f83('0x15')](this[_0x5f83('0x11')][_0x5f83('0x6f')]);}};VoiceQueueReport[_0x5f83('0x9')][_0x5f83('0x18')]=function(_0x20d61f){var _0x534766=this[_0x5f83('0x11')]['id'];if(this['summary'][_0x5f83('0x64')][_0x534766]&&this[_0x5f83('0x11')][_0x5f83('0x64')][_0x534766][_0x20d61f[_0x5f83('0x63')]]){this[_0x5f83('0x11')][_0x5f83('0x64')][_0x534766][_0x20d61f[_0x5f83('0x63')]][_0x5f83('0xe')][_0x5f83('0x70')](_0x20d61f);}};VoiceQueueReport[_0x5f83('0x9')][_0x5f83('0x13')]=function(_0x456482){var _0x350cfa=this;try{if(this['isNotNull'](_0x456482)&&this[_0x5f83('0x5d')](_0x456482[_0x5f83('0x50')])){logger[_0x5f83('0x4b')](_0x5f83('0x71'),util[_0x5f83('0x44')](_0x456482,{'showHidden':![],'depth':null}));var _0x42e130=this[_0x5f83('0xf')][_0x456482[_0x5f83('0x50')]];if(_0x42e130){logger['debug'](_0x5f83('0x72'),_0x42e130['name']);this['summary']['queues'][_0x42e130[_0x5f83('0x5b')]]={'summaryEvent':_0x456482};this[_0x5f83('0x11')][_0x5f83('0x6e')]+=0x1;return ami[_0x5f83('0x39')]({'action':_0x5f83('0x64'),'queue':_0x42e130[_0x5f83('0x5b')]})[_0x5f83('0x62')](function(_0x187474){if(!_0x350cfa[_0x5f83('0x11')]['queuestatus'][_0x456482['actionid']]){_0x350cfa[_0x5f83('0x11')]['queuestatus'][_0x456482['actionid']]={};}_0x350cfa[_0x5f83('0x11')]['queuestatus'][_0x456482[_0x5f83('0x63')]][_0x187474[_0x5f83('0x63')]]={'queue':_0x42e130[_0x5f83('0x5b')],'agents':[]};})[_0x5f83('0x3c')](function(_0x248270){throw _0x248270;});}}}catch(_0x45dc86){logger[_0x5f83('0x3f')](_0x5f83('0x73'),util['inspect'](_0x45dc86,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x5f83('0x9')]['syncQueueSummaryComplete']=function(_0x4e0a17){if(this[_0x5f83('0x11')]['statusRequests']>0x0){this[_0x5f83('0x11')][_0x5f83('0x6f')]=_0x4e0a17;return;}logger['debug'](_0x5f83('0x74'),util[_0x5f83('0x44')](_0x4e0a17,{'showHidden':![],'depth':null}));this[_0x5f83('0x11')]=initializeSummary();ami[_0x5f83('0x49')](_0x5f83('0x75'),{});};VoiceQueueReport[_0x5f83('0x9')][_0x5f83('0x1b')]=function(_0x2fbe68){try{if(this['isNotNull'](_0x2fbe68)){logger[_0x5f83('0x4b')](_0x5f83('0x76'),_0x2fbe68[_0x5f83('0x4e')],util[_0x5f83('0x44')](_0x2fbe68,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0x5f83('0xd')][_0x2fbe68[_0x5f83('0x4e')]])){this[_0x5f83('0xd')][_0x2fbe68['uniqueid']]=[];}if(_['isUndefined'](this[_0x5f83('0x37')][_0x2fbe68['uniqueid']])){this[_0x5f83('0x37')][_0x2fbe68[_0x5f83('0x4e')]]={};}var _0x2d9c7f=new QueueReport();_0x2d9c7f[_0x5f83('0x50')]=_0x2fbe68[_0x5f83('0x50')];_0x2d9c7f['type']=this[_0x5f83('0xf')][_0x2d9c7f[_0x5f83('0x50')]]&&this[_0x5f83('0xf')][_0x2d9c7f[_0x5f83('0x50')]]['type']?this[_0x5f83('0xf')][_0x2d9c7f[_0x5f83('0x50')]][_0x5f83('0x6a')]||_0x5f83('0x5a'):_0x5f83('0x5a');_0x2d9c7f[_0x5f83('0x77')]=moment()[_0x5f83('0x56')]('YYYY-MM-DD\x20HH:mm:ss');_0x2d9c7f[_0x5f83('0x78')]=_0x2fbe68['position'];_0x2d9c7f[_0x5f83('0x79')]=_0x2fbe68['count'];_0x2d9c7f['uniqueid']=_0x2fbe68[_0x5f83('0x4e')];_0x2d9c7f[_0x5f83('0x7a')]=this[_0x5f83('0x37')][_0x2fbe68[_0x5f83('0x4e')]][_0x5f83('0x7a')];logger[_0x5f83('0x7b')](_0x5f83('0x7c'),_0x2d9c7f['queue'],_0x2d9c7f[_0x5f83('0x6a')]);Object['assign'](_0x2d9c7f,_['pick'](_0x2fbe68,_['keys'](_0x2d9c7f)));this[_0x5f83('0xd')][_0x2fbe68['uniqueid']][_0x5f83('0x70')](_0x2d9c7f);this['channels'][_0x2fbe68[_0x5f83('0x4e')]]=_0x2d9c7f;this[_0x5f83('0x4a')](_0x2d9c7f,_0x5f83('0x7d'));}}catch(_0x158f84){logger[_0x5f83('0x3f')](_0x5f83('0x76'),_0x2fbe68[_0x5f83('0x4e')],util[_0x5f83('0x44')](_0x158f84,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncQueueCallerAbandon']=function(_0x5e993e){try{if(this[_0x5f83('0x5d')](_0x5e993e)){logger['debug'](_0x5f83('0x7e'),_0x5e993e[_0x5f83('0x4e')],util['inspect'](_0x5e993e,{'showHidden':![],'depth':null}));if(this[_0x5f83('0xd')][_0x5e993e[_0x5f83('0x4e')]]){var _0x1b46fe=_[_0x5f83('0x7f')](this[_0x5f83('0xd')][_0x5e993e[_0x5f83('0x4e')]]);_0x1b46fe[_0x5f83('0x35')]=![];_0x1b46fe[_0x5f83('0x80')]=null;_0x1b46fe['holdtime']=_0x5e993e[_0x5f83('0x81')];_0x1b46fe[_0x5f83('0x82')]=_0x5e993e[_0x5f83('0x82')];_0x1b46fe['queuecallerabandon']=!![];_0x1b46fe[_0x5f83('0x83')]=moment()['format'](_0x5f83('0x84'));_0x1b46fe[_0x5f83('0x54')]=_0x5f83('0x85');_0x1b46fe['lastAssignedTo']=null;logger[_0x5f83('0x7b')](_0x5f83('0x86'),_0x1b46fe[_0x5f83('0x50')],_0x1b46fe[_0x5f83('0x6a')]);this[_0x5f83('0x37')][_0x5e993e[_0x5f83('0x4e')]]=_0x1b46fe;this[_0x5f83('0x47')](_0x1b46fe,_0x5f83('0x1c'));}}}catch(_0x4b244d){logger[_0x5f83('0x3f')](_0x5f83('0x7e'),_0x5e993e[_0x5f83('0x4e')],util['inspect'](_0x4b244d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x5f83('0x9')][_0x5f83('0x1f')]=function(_0xb0691b){try{if(this[_0x5f83('0x5d')](_0xb0691b)){logger[_0x5f83('0x4b')]('[%s][voiceQueueReport][queuecallerleave]',_0xb0691b['uniqueid'],util[_0x5f83('0x44')](_0xb0691b,{'showHidden':![],'depth':null}));if(this[_0x5f83('0xd')][_0xb0691b[_0x5f83('0x4e')]]){var _0x59c8bf=_['last'](this[_0x5f83('0xd')][_0xb0691b[_0x5f83('0x4e')]]);_0x59c8bf['queuecallerleaveAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x59c8bf['connectedlinenum']=_0xb0691b[_0x5f83('0x87')];_0x59c8bf[_0x5f83('0x88')]=_0xb0691b[_0x5f83('0x88')];logger[_0x5f83('0x7b')](_0x5f83('0x89'),_0x59c8bf[_0x5f83('0x50')],_0x59c8bf[_0x5f83('0x6a')],_0xb0691b['connectedlinenum'],_0xb0691b[_0x5f83('0x88')]);this[_0x5f83('0x37')][_0xb0691b[_0x5f83('0x4e')]]=_0x59c8bf;this[_0x5f83('0x4a')](_0x59c8bf,_0x5f83('0x1e'));}}}catch(_0x5b4f59){logger[_0x5f83('0x3f')](_0x5f83('0x8a'),_0xb0691b[_0x5f83('0x4e')],util[_0x5f83('0x44')](_0x5b4f59,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x5f83('0x22')]=function(_0x55ac44){try{if(this[_0x5f83('0x5d')](_0x55ac44)){logger['debug'](_0x5f83('0x8b'),_0x55ac44['uniqueid'],util[_0x5f83('0x44')](_0x55ac44,{'showHidden':![],'depth':null}));if(this[_0x5f83('0xd')][_0x55ac44[_0x5f83('0x4e')]]){var _0x3b3cd1=_[_0x5f83('0x7f')](this[_0x5f83('0xd')][_0x55ac44['uniqueid']]);_0x3b3cd1['queuecallercomplete']=!![];_0x3b3cd1['queuecallerexitreason']='COMPLETEDBYAGENT';logger[_0x5f83('0x7b')](_0x5f83('0x8c'),_0x3b3cd1[_0x5f83('0x50')],_0x3b3cd1[_0x5f83('0x6a')]);}}}catch(_0x3d31b8){logger['error'](_0x5f83('0x8b'),_0x55ac44[_0x5f83('0x4e')],util[_0x5f83('0x44')](_0x3d31b8,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x5f83('0x9')][_0x5f83('0x8d')]=function(_0x5c2c75){try{if(this[_0x5f83('0x5d')](_0x5c2c75)){logger['debug'](_0x5f83('0x8e'),_0x5c2c75[_0x5f83('0x4e')],util[_0x5f83('0x44')](_0x5c2c75,{'showHidden':![],'depth':null}));if(this[_0x5f83('0xd')][_0x5c2c75[_0x5f83('0x4e')]]){var _0x4a668e=_[_0x5f83('0x7f')](this[_0x5f83('0xd')][_0x5c2c75['uniqueid']]);_0x4a668e['queuecallerabandon']=![];_0x4a668e[_0x5f83('0x83')]=null;_0x4a668e[_0x5f83('0x8f')]=!![];_0x4a668e[_0x5f83('0x90')]=_0x5c2c75[_0x5f83('0x91')];_0x4a668e[_0x5f83('0x81')]=_0x5c2c75['holdtime'];_0x4a668e[_0x5f83('0x35')]=!![];_0x4a668e[_0x5f83('0x92')]=![];_0x4a668e[_0x5f83('0x93')]=null;if(!_0x4a668e['transfer']){if(_0x5c2c75[_0x5f83('0x94')]==_0x5f83('0x95')){_0x4a668e[_0x5f83('0x54')]='COMPLETED';logger[_0x5f83('0x7b')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0x4a668e[_0x5f83('0x50')],_0x4a668e[_0x5f83('0x6a')]);}else{if(_[_0x5f83('0x96')](_0x5c2c75[_0x5f83('0x3b')][_0x5f83('0x97')](),_0x5f83('0x98'))){if(this[_0x5f83('0xd')][_0x5c2c75[_0x5f83('0x99')]]){var _0x51a8da=_[_0x5f83('0x7f')](this[_0x5f83('0xd')][_0x5c2c75[_0x5f83('0x99')]]);_0x51a8da[_0x5f83('0x35')]=![];_0x51a8da[_0x5f83('0x92')]=!![];_0x51a8da[_0x5f83('0x93')]=moment(_0x4a668e[_0x5f83('0x77')])['add'](_0x5c2c75[_0x5f83('0x81')],_0x5f83('0x9a'))[_0x5f83('0x56')]('YYYY-MM-DD\x20HH:mm:ss');_0x51a8da[_0x5f83('0x54')]='FORWARDTRANSFER';_0x51a8da[_0x5f83('0x95')]=!![];_0x51a8da[_0x5f83('0x9b')]='FORWARD';_0x51a8da[_0x5f83('0x9c')]=_0x5c2c75[_0x5f83('0x9d')];_0x51a8da[_0x5f83('0x9e')]=_0x5c2c75[_0x5f83('0x4e')];logger['info'](_0x5f83('0x9f'),_0x51a8da[_0x5f83('0x50')],_0x51a8da[_0x5f83('0x6a')]);var _0x4408e7=this[_0x5f83('0xd')][_0x5c2c75[_0x5f83('0x99')]];this['queueReports'][_0x5c2c75[_0x5f83('0x99')]]=this[_0x5f83('0xd')][_0x5c2c75['uniqueid']];this['queueReports'][_0x5c2c75[_0x5f83('0x4e')]]=_0x4408e7;}}else{_0x4a668e[_0x5f83('0x54')]=_0x5f83('0xa0')+_0x5c2c75[_0x5f83('0x94')][_0x5f83('0xa1')]();logger[_0x5f83('0x7b')](_0x5f83('0xa2'),_0x4a668e[_0x5f83('0x50')],_0x4a668e['type'],_0x4a668e['queuecallerexitreason']);}}}this[_0x5f83('0x37')][_0x5c2c75[_0x5f83('0x4e')]]=_0x4a668e;}}}catch(_0x53804c){logger[_0x5f83('0x3f')](_0x5f83('0x8e'),_0x5c2c75[_0x5f83('0x4e')],util[_0x5f83('0x44')](_0x53804c,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x5f83('0xa3')]=function(_0x5d13b4){try{if(this[_0x5f83('0x5d')](_0x5d13b4)){logger[_0x5f83('0x4b')]('[%s][voiceQueueReport][varset]',_0x5d13b4[_0x5f83('0x4e')],util[_0x5f83('0x44')](_0x5d13b4,{'showHidden':![],'depth':null}));this['addVariable'](_0x5d13b4[_0x5f83('0x4e')],_[_0x5f83('0xa4')](_0x5d13b4[_0x5f83('0xa5')])[0x0],_0x5d13b4[_0x5f83('0xa6')]);if(this[_0x5f83('0xd')][_0x5d13b4[_0x5f83('0x4e')]]){var _0x54bfad=_[_0x5f83('0x7f')](this[_0x5f83('0xd')][_0x5d13b4[_0x5f83('0x4e')]]);if(_0x54bfad){if(this[_0x5f83('0x5d')](_0x5d13b4['variable'])&&this['isNotNull'](_0x5d13b4[_0x5f83('0xa5')]['queuestatus'])){switch(_0x5d13b4[_0x5f83('0xa6')]){case _0x5f83('0xa7'):_0x54bfad[_0x5f83('0x92')]=![];_0x54bfad[_0x5f83('0x93')]=null;break;case'TIMEOUT':_0x54bfad[_0x5f83('0xa8')]=_0x5f83('0xa9');_0x54bfad[_0x5f83('0x92')]=!![];_0x54bfad[_0x5f83('0x93')]=moment()[_0x5f83('0x56')]('YYYY-MM-DD\x20HH:mm:ss');_0x54bfad['queuecallerleaveAt']=moment()[_0x5f83('0x56')](_0x5f83('0x84'));logger['debug'](_0x5f83('0xaa'),_0x5d13b4['uniqueid'],util['inspect'](_0x54bfad,{'showHidden':![],'depth':null}));ami[_0x5f83('0x49')](_0x5f83('0xab'),_0x54bfad);break;default:_0x54bfad[_0x5f83('0x92')]=!![];_0x54bfad[_0x5f83('0x93')]=moment()[_0x5f83('0x56')]('YYYY-MM-DD\x20HH:mm:ss');_0x54bfad[_0x5f83('0xac')]=moment()[_0x5f83('0x56')](_0x5f83('0x84'));}_0x54bfad[_0x5f83('0x1c')]=![];_0x54bfad['queuecallerabandonAt']=null;_0x54bfad[_0x5f83('0x54')]=_0x5d13b4[_0x5f83('0xa6')];this[_0x5f83('0x37')][_0x5d13b4[_0x5f83('0x4e')]]=_0x54bfad;this[_0x5f83('0x47')](_0x54bfad,_0x5f83('0x23'));}else if(this[_0x5f83('0x5d')](_0x5d13b4['variable'])&&this['isNotNull'](_0x5d13b4['variable'][_0x5f83('0xad')])){if(!_0x54bfad[_0x5f83('0x1c')]){_0x54bfad[_0x5f83('0x92')]=!![];_0x54bfad['queuecallerexitAt']=moment()['format'](_0x5f83('0x84'));_0x54bfad[_0x5f83('0x54')]=_0x5f83('0xae');_0x54bfad[_0x5f83('0xac')]=moment()[_0x5f83('0x56')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x5d13b4['uniqueid']]=_0x54bfad;}}logger[_0x5f83('0x7b')](_0x5f83('0xaf'),_0x5d13b4[_0x5f83('0x4e')],_0x54bfad[_0x5f83('0x50')],_0x54bfad['type'],_[_0x5f83('0xa4')](_0x5d13b4[_0x5f83('0xa5')])[0x0],_0x5d13b4[_0x5f83('0xa6')]);_0x54bfad[_0x5f83('0x42')]=this[_0x5f83('0x42')][_0x5d13b4[_0x5f83('0x4e')]];}}}}catch(_0xe00ed3){logger['error'](_0x5f83('0xb0'),_0x5d13b4['uniqueid'],util[_0x5f83('0x44')](_0xe00ed3,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x5f83('0xb1')]=function(_0x4ea814,_0x3343f5,_0x17e11f){var _0x844000=[_0x5f83('0xb2'),'rtpaudioqosbridged',_0x5f83('0xb3'),_0x5f83('0xb4'),_0x5f83('0xb5'),'rtpaudioqoslossbridged','rtpaudioqosrtt',_0x5f83('0xb6'),_0x5f83('0xb7'),_0x5f83('0xb8'),_0x5f83('0xb9'),_0x5f83('0xba'),_0x5f83('0xbb'),_0x5f83('0xbc'),_0x5f83('0xbd'),_0x5f83('0xbe'),_0x5f83('0x91'),_0x5f83('0xbf'),_0x5f83('0xc0')];if(!_['isNil'](_0x3343f5)&&!_[_0x5f83('0xc1')](_0x844000,_0x3343f5)){if(_[_0x5f83('0x5e')](this[_0x5f83('0x42')][_0x4ea814])){this[_0x5f83('0x42')][_0x4ea814]={};}this[_0x5f83('0x42')][_0x4ea814][_0x3343f5]=_0x17e11f;}};VoiceQueueReport[_0x5f83('0x9')][_0x5f83('0xc2')]=function(_0x16239d,_0x3bec4d,_0x5bd7c4){try{var _0x5f4c20={};if(this[_0x5f83('0xd')][_0x16239d]){for(var _0x47db33=0x0;_0x47db33=0x0?moment(_0x307f76[_0xa803('0x17')])[_0xa803('0xd')](_0x307f76[_0xa803('0x16')],'seconds'):null,'data1':_0xa803('0x19'),'data2':_0x307f76[_0xa803('0x1a')],'data3':_0x307f76['exten'],'data4':_0x307f76[_0xa803('0x1b')]||null,'role':_0xa803('0x11'),'internal':_0x307f76[_0xa803('0x1a')]?_['toNumber'](_0x307f76[_0xa803('0x1a')]):undefined,'uniqueid':_0x307f76[_0xa803('0x13')]},'log':'CreateMemberReport'});}; \ No newline at end of file +var _0x40da=['membername','TALKING','starttime','seconds','endtime','outbound','toNumber','moment','lodash','util','../client','queuecallercompleteAt','queuecallerexitAt','Request','CreateMemberReport','voice','isNil','interface','format','SIP/%s','lastAssignedTo','queuecallerleaveAt','diff','inbound','calleridnum','queue','agent','accountcode','uniqueid'];(function(_0x62d97f,_0x167700){var _0x4426c3=function(_0x402789){while(--_0x402789){_0x62d97f['push'](_0x62d97f['shift']());}};_0x4426c3(++_0x167700);}(_0x40da,0x1f4));var _0xa40d=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x40da[_0x4b055c];return _0x4b62bb;};'use strict';var moment=require(_0xa40d('0x0'));var _=require(_0xa40d('0x1'));var util=require(_0xa40d('0x2'));var client=require(_0xa40d('0x3'));exports['voiceQueueReport']=function(_0x26c897){var _0x4dafb3=_0x26c897[_0xa40d('0x4')]||_0x26c897[_0xa40d('0x5')];return client[_0xa40d('0x6')](_0xa40d('0x7'),{'body':{'channel':_0xa40d('0x8'),'membername':_0x26c897['lastAssignedTo'],'interface':_[_0xa40d('0x9')](_0x26c897[_0xa40d('0xa')])?util[_0xa40d('0xb')](_0xa40d('0xc'),_0x26c897[_0xa40d('0xd')]):_0x26c897[_0xa40d('0xa')],'type':'TALKING','enterAt':_0x26c897[_0xa40d('0xe')],'exitAt':_0x4dafb3,'duration':moment(_0x4dafb3)[_0xa40d('0xf')](_0x26c897[_0xa40d('0xe')],'seconds'),'data1':_0xa40d('0x10'),'data2':_0x26c897[_0xa40d('0x11')],'data3':_0x26c897['exten'],'data4':null,'data5':_0x26c897[_0xa40d('0x12')],'role':_0xa40d('0x13'),'internal':_0x26c897[_0xa40d('0x14')]?_['toNumber'](_0x26c897[_0xa40d('0x14')]):undefined,'uniqueid':_0x26c897[_0xa40d('0x15')]},'log':_0xa40d('0x7')});};exports['voiceDialReport']=function(_0x46da9c){return client['Request'](_0xa40d('0x7'),{'body':{'channel':'voice','membername':_0x46da9c[_0xa40d('0x16')],'interface':_0x46da9c[_0xa40d('0xa')],'type':_0xa40d('0x17'),'enterAt':_0x46da9c[_0xa40d('0x18')],'exitAt':_0x46da9c['endtime'],'duration':moment(_0x46da9c['endtime'])[_0xa40d('0xf')](_0x46da9c[_0xa40d('0x18')],_0xa40d('0x19'))>=0x0?moment(_0x46da9c[_0xa40d('0x1a')])[_0xa40d('0xf')](_0x46da9c['starttime'],_0xa40d('0x19')):null,'data1':_0xa40d('0x1b'),'data2':_0x46da9c[_0xa40d('0x14')],'data3':_0x46da9c['exten'],'data4':_0x46da9c['dialstring']||null,'role':_0xa40d('0x13'),'internal':_0x46da9c[_0xa40d('0x14')]?_[_0xa40d('0x1c')](_0x46da9c[_0xa40d('0x14')]):undefined,'uniqueid':_0x46da9c['uniqueid']},'log':_0xa40d('0x7')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index 3642027..0dfe287 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 _0xfbb2=['../client','getSettings','Request','ShowSetting','previewRecallmeReminderInterval','GetSettings'];(function(_0x468308,_0x275efa){var _0x2e8ff4=function(_0x603d0e){while(--_0x603d0e){_0x468308['push'](_0x468308['shift']());}};_0x2e8ff4(++_0x275efa);}(_0xfbb2,0xae));var _0x2fbb=function(_0x459e81,_0x52aeb0){_0x459e81=_0x459e81-0x0;var _0x4fac6a=_0xfbb2[_0x459e81];return _0x4fac6a;};'use strict';var client=require(_0x2fbb('0x0'));exports[_0x2fbb('0x1')]=function(){return client[_0x2fbb('0x2')](_0x2fbb('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['stopRecordingOnTransfer',_0x2fbb('0x4')]},'log':_0x2fbb('0x5')});}; \ No newline at end of file +var _0x1b8e=['Request','stopRecordingOnTransfer','previewRecallmeReminderInterval','../client','getSettings'];(function(_0x25e680,_0x43ceeb){var _0x55a858=function(_0x1818c1){while(--_0x1818c1){_0x25e680['push'](_0x25e680['shift']());}};_0x55a858(++_0x43ceeb);}(_0x1b8e,0x10c));var _0xe1b8=function(_0x527804,_0x276ced){_0x527804=_0x527804-0x0;var _0x5ebba9=_0x1b8e[_0x527804];return _0x5ebba9;};'use strict';var client=require(_0xe1b8('0x0'));exports[_0xe1b8('0x1')]=function(){return client[_0xe1b8('0x2')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xe1b8('0x3'),_0xe1b8('0x4')]},'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 803c6d1..dd8d624 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 _0x33c4=['getTemplates','Request','GetTemplate','name','html','../client'];(function(_0x210775,_0x29d4fe){var _0xbbffde=function(_0x3a863d){while(--_0x3a863d){_0x210775['push'](_0x210775['shift']());}};_0xbbffde(++_0x29d4fe);}(_0x33c4,0xef));var _0x433c=function(_0x458066,_0x1d475f){_0x458066=_0x458066-0x0;var _0x442204=_0x33c4[_0x458066];return _0x442204;};'use strict';var client=require(_0x433c('0x0'));exports[_0x433c('0x1')]=function(_0x3fcbd7){return function(_0x230397){return client[_0x433c('0x2')](_0x433c('0x3'),{'options':{'raw':!![],'attributes':['id',_0x433c('0x4'),_0x433c('0x5')]},'log':'GetTemplate'});};}; \ No newline at end of file +var _0x3353=['getTemplates','Request','GetTemplate','name','html'];(function(_0x571fd6,_0x5223fc){var _0x4d6af6=function(_0xfc2c26){while(--_0xfc2c26){_0x571fd6['push'](_0x571fd6['shift']());}};_0x4d6af6(++_0x5223fc);}(_0x3353,0x1ef));var _0x3335=function(_0x5f588a,_0x2268d5){_0x5f588a=_0x5f588a-0x0;var _0x34980d=_0x3353[_0x5f588a];return _0x34980d;};'use strict';var client=require('../client');exports[_0x3335('0x0')]=function(_0x2c8f16){return function(_0x4e67de){return client[_0x3335('0x1')](_0x3335('0x2'),{'options':{'raw':!![],'attributes':['id',_0x3335('0x3'),_0x3335('0x4')]},'log':_0x3335('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index c33e47e..3607081 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 _0xc34f=['Action','Actions','action','data1','data2','data3','data5','data7','../client','getTriggers','Request','GetTrigger','channel','status','AllConditions','field','operator','value','Condition'];(function(_0x1992f1,_0x5c61f0){var _0x413dfe=function(_0x2136e5){while(--_0x2136e5){_0x1992f1['push'](_0x1992f1['shift']());}};_0x413dfe(++_0x5c61f0);}(_0xc34f,0x197));var _0xfc34=function(_0x27695c,_0x164d35){_0x27695c=_0x27695c-0x0;var _0x9ed423=_0xc34f[_0x27695c];return _0x9ed423;};'use strict';var client=require(_0xfc34('0x0'));exports[_0xfc34('0x1')]=function(_0x512d6f){return function(_0xfdbfd5){return client[_0xfc34('0x2')](_0xfc34('0x3'),{'options':{'raw':![],'attributes':['id','name',_0xfc34('0x4'),_0xfc34('0x5')],'include':[{'model':'Condition','as':_0xfc34('0x6'),'attributes':['id',_0xfc34('0x7'),_0xfc34('0x8'),_0xfc34('0x9')]},{'model':_0xfc34('0xa'),'as':'AnyConditions','attributes':['id',_0xfc34('0x7'),_0xfc34('0x8'),_0xfc34('0x9')]},{'model':_0xfc34('0xb'),'as':_0xfc34('0xc'),'attributes':['id',_0xfc34('0xd'),_0xfc34('0xe'),_0xfc34('0xf'),_0xfc34('0x10'),'data4',_0xfc34('0x11'),'data6',_0xfc34('0x12')]}]},'log':_0xfc34('0x3')});};}; \ No newline at end of file +var _0x51d1=['AllConditions','field','value','AnyConditions','operator','Action','action','data2','data4','data5','data6','data7','../client','getTriggers','Request','GetTrigger','name','channel','status','Condition'];(function(_0x1a1553,_0x108edd){var _0x54bbde=function(_0x5d441b){while(--_0x5d441b){_0x1a1553['push'](_0x1a1553['shift']());}};_0x54bbde(++_0x108edd);}(_0x51d1,0x188));var _0x151d=function(_0x46a38b,_0x16ffb5){_0x46a38b=_0x46a38b-0x0;var _0x346e75=_0x51d1[_0x46a38b];return _0x346e75;};'use strict';var client=require(_0x151d('0x0'));exports[_0x151d('0x1')]=function(_0x4664c0){return function(_0xdbe592){return client[_0x151d('0x2')](_0x151d('0x3'),{'options':{'raw':![],'attributes':['id',_0x151d('0x4'),_0x151d('0x5'),_0x151d('0x6')],'include':[{'model':_0x151d('0x7'),'as':_0x151d('0x8'),'attributes':['id',_0x151d('0x9'),'operator',_0x151d('0xa')]},{'model':_0x151d('0x7'),'as':_0x151d('0xb'),'attributes':['id','field',_0x151d('0xc'),_0x151d('0xa')]},{'model':_0x151d('0xd'),'as':'Actions','attributes':['id',_0x151d('0xe'),'data1',_0x151d('0xf'),'data3',_0x151d('0x10'),_0x151d('0x11'),_0x151d('0x12'),_0x151d('0x13')]}]},'log':_0x151d('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 6a5cc0d..a46c981 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 _0x7119=['getTrunks','GetTrunk','name','registry','defaultuser'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0x7119,0x1c7));var _0x9711=function(_0x1f109c,_0xd9952e){_0x1f109c=_0x1f109c-0x0;var _0x3984e8=_0x7119[_0x1f109c];return _0x3984e8;};'use strict';var client=require('../client');exports[_0x9711('0x0')]=function(_0x529e10){return function(_0x30d901){return client['Request'](_0x9711('0x1'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x9711('0x2'),_0x9711('0x3'),_0x9711('0x4')]},'log':'GetTrunk'});};}; \ No newline at end of file +var _0x528f=['getTrunks','Request','GetTrunk','registry'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x528f,0x140));var _0xf528=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x528f[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports[_0xf528('0x0')]=function(_0x27b610){return function(_0x303dad){return client[_0xf528('0x1')](_0xf528('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name',_0xf528('0x3'),'defaultuser']},'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 7cedc40..0af57fd 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 _0xedd9=['mobile','getTelephones','internal','PauseUser','savePause','saveUnpause','UnpauseUser','ShowUser','interface','getAgent','getAgents','Request','GetUser','agent','name','email','accountcode','fullname','lastLoginAt','pauseType','lastPauseAt','voicePause'];(function(_0x3885cc,_0x38da8a){var _0x38aef8=function(_0x4c0a54){while(--_0x4c0a54){_0x3885cc['push'](_0x3885cc['shift']());}};_0x38aef8(++_0x38da8a);}(_0xedd9,0xfc));var _0x9edd=function(_0x2053da,_0x295022){_0x2053da=_0x2053da-0x0;var _0x211529=_0xedd9[_0x2053da];return _0x211529;};'use strict';var client=require('../client');exports[_0x9edd('0x0')]=function(){return function(){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'options':{'raw':![],'where':{'role':_0x9edd('0x3')},'attributes':['id',_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6'),_0x9edd('0x7'),'online',_0x9edd('0x8'),_0x9edd('0x9'),_0x9edd('0xa'),_0x9edd('0xb'),'phone',_0x9edd('0xc'),'interface']},'log':_0x9edd('0x0')});};};exports[_0x9edd('0xd')]=function(){return function(){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x9edd('0x4'),'accountcode',_0x9edd('0xe')]},'log':_0x9edd('0xd')});};};exports['savePause']=function(_0xbf9da6,_0x13dc4f,_0x5b6c00){return client[_0x9edd('0x1')](_0x9edd('0xf'),{'body':{'type':_0x13dc4f,'uniqueid':_0x5b6c00},'options':{'where':{'id':_0xbf9da6['id']}},'log':_0x9edd('0x10')});};exports[_0x9edd('0x11')]=function(_0x287ddd){return client[_0x9edd('0x1')](_0x9edd('0x12'),{'body':{},'options':{'where':{'id':_0x287ddd['id']}},'log':_0x9edd('0x10')});};exports['getAgent']=function(_0x176bfa){return client[_0x9edd('0x1')](_0x9edd('0x13'),{'options':{'raw':![],'where':{'role':_0x9edd('0x3'),'id':_0x176bfa},'attributes':['id',_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6'),_0x9edd('0x7'),'online',_0x9edd('0x8'),_0x9edd('0x9'),_0x9edd('0xa'),'voicePause',_0x9edd('0x14')]},'log':_0x9edd('0x15')});}; \ No newline at end of file +var _0x70e0=['getAgents','Request','name','email','accountcode','fullname','lastLoginAt','lastPauseAt','interface','getTelephones','GetUser','telephone','savePause','PauseUser','saveUnpause','getAgent','agent','online','pauseType','../client'];(function(_0xf05eb,_0x57ad53){var _0x431e68=function(_0x250d9e){while(--_0x250d9e){_0xf05eb['push'](_0xf05eb['shift']());}};_0x431e68(++_0x57ad53);}(_0x70e0,0x17b));var _0x070e=function(_0x5ef2f3,_0x5cfc83){_0x5ef2f3=_0x5ef2f3-0x0;var _0x2490b8=_0x70e0[_0x5ef2f3];return _0x2490b8;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(){return function(){return client[_0x070e('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5'),_0x070e('0x6'),'online',_0x070e('0x7'),'pauseType',_0x070e('0x8'),'voicePause','phone','mobile',_0x070e('0x9')]},'log':_0x070e('0x1')});};};exports[_0x070e('0xa')]=function(){return function(){return client[_0x070e('0x2')](_0x070e('0xb'),{'options':{'raw':!![],'where':{'role':_0x070e('0xc')},'attributes':['id',_0x070e('0x3'),'accountcode','internal']},'log':_0x070e('0xa')});};};exports[_0x070e('0xd')]=function(_0x12bb37,_0xb8d819,_0xa927a2){return client[_0x070e('0x2')](_0x070e('0xe'),{'body':{'type':_0xb8d819,'uniqueid':_0xa927a2},'options':{'where':{'id':_0x12bb37['id']}},'log':_0x070e('0xd')});};exports[_0x070e('0xf')]=function(_0x5bf079){return client[_0x070e('0x2')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x5bf079['id']}},'log':'savePause'});};exports[_0x070e('0x10')]=function(_0x56c7ba){return client['Request']('ShowUser',{'options':{'raw':![],'where':{'role':_0x070e('0x11'),'id':_0x56c7ba},'attributes':['id',_0x070e('0x3'),'email','accountcode',_0x070e('0x6'),_0x070e('0x12'),_0x070e('0x7'),_0x070e('0x13'),'lastPauseAt','voicePause',_0x070e('0x9')]},'log':_0x070e('0x10')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 68c3f97..59d76ed 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 _0x671f=['CreateVoiceAgentReport','update','UpdateVoiceAgentReport','../client','create','Request'];(function(_0x5955e4,_0x5243c7){var _0x11e594=function(_0x193922){while(--_0x193922){_0x5955e4['push'](_0x5955e4['shift']());}};_0x11e594(++_0x5243c7);}(_0x671f,0x1a1));var _0xf671=function(_0x40cc61,_0xdd2841){_0x40cc61=_0x40cc61-0x0;var _0x4e9278=_0x671f[_0x40cc61];return _0x4e9278;};'use strict';var client=require(_0xf671('0x0'));exports[_0xf671('0x1')]=function(_0x2e391e){return client[_0xf671('0x2')](_0xf671('0x3'),{'body':_0x2e391e,'log':'CreateVoiceAgentReport'});};exports[_0xf671('0x4')]=function(_0x40be70,_0x1e6aee,_0x4176fe){return client[_0xf671('0x2')](_0xf671('0x5'),{'body':_0x40be70,'options':{'where':{'uniqueid':_0x1e6aee,'interface':_0x4176fe,'agentcomplete':!![]}},'log':'UpdateVoiceAgentReport'});}; \ No newline at end of file +var _0x6669=['CreateVoiceAgentReport','UpdateVoiceAgentReport','Request'];(function(_0x476bf4,_0x2a3755){var _0x788ffe=function(_0x13fa11){while(--_0x13fa11){_0x476bf4['push'](_0x476bf4['shift']());}};_0x788ffe(++_0x2a3755);}(_0x6669,0x173));var _0x9666=function(_0x51c819,_0xd812db){_0x51c819=_0x51c819-0x0;var _0x15c5d2=_0x6669[_0x51c819];return _0x15c5d2;};'use strict';var client=require('../client');exports['create']=function(_0x27ec38){return client[_0x9666('0x0')](_0x9666('0x1'),{'body':_0x27ec38,'log':_0x9666('0x1')});};exports['update']=function(_0x4d8443,_0x4a0e54,_0x47f77b){return client[_0x9666('0x0')]('UpdateVoiceAgentReport',{'body':_0x4d8443,'options':{'where':{'uniqueid':_0x4a0e54,'interface':_0x47f77b,'agentcomplete':!![]}},'log':_0x9666('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index d5180cd..a497edb 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 _0x0a55=['util','lodash','../client','create','Request','CreateVoiceCallReport','context','callerid','DOCUMENTATION','getVoiceCallReports','startOf','day','format','endOf','YYYY-MM-DD\x20HH:mm:ss','disposition','duration','GetVoiceCallReports','moment'];(function(_0x153c21,_0x2470c3){var _0x199608=function(_0x308f09){while(--_0x308f09){_0x153c21['push'](_0x153c21['shift']());}};_0x199608(++_0x2470c3);}(_0x0a55,0x1ed));var _0x50a5=function(_0x507f59,_0x3d23ae){_0x507f59=_0x507f59-0x0;var _0x2aed14=_0x0a55[_0x507f59];return _0x2aed14;};'use strict';var moment=require(_0x50a5('0x0'));var util=require(_0x50a5('0x1'));var _=require(_0x50a5('0x2'));var client=require(_0x50a5('0x3'));exports[_0x50a5('0x4')]=function(_0x35fb47){return client[_0x50a5('0x5')](_0x50a5('0x6'),{'body':_['merge'](_0x35fb47,{'source':_0x35fb47['calleridnum'],'destinationcontext':_0x35fb47[_0x50a5('0x7')],'callerid':_0x35fb47[_0x50a5('0x8')],'amaflags':_0x50a5('0x9')}),'log':_0x50a5('0x6')});};exports[_0x50a5('0xa')]=function(){return function(){return client[_0x50a5('0x5')]('GetVoiceCallReport',{'options':{'where':{'type':['outbound'],'createdAt':{'$between':[moment()[_0x50a5('0xb')](_0x50a5('0xc'))[_0x50a5('0xd')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0x50a5('0xe')](_0x50a5('0xc'))[_0x50a5('0xd')](_0x50a5('0xf'))]}},'attributes':['type',_0x50a5('0x10'),_0x50a5('0x11'),'billableseconds']},'log':_0x50a5('0x12')});};}; \ No newline at end of file +var _0xaf27=['outbound','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','type','GetVoiceCallReports','util','../client','create','Request','CreateVoiceCallReport','context','callerid','getVoiceCallReports'];(function(_0xc34cd4,_0x463064){var _0x128eaa=function(_0x221318){while(--_0x221318){_0xc34cd4['push'](_0xc34cd4['shift']());}};_0x128eaa(++_0x463064);}(_0xaf27,0x115));var _0x7af2=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xaf27[_0x1ddedd];return _0xa3e1ac;};'use strict';var moment=require('moment');var util=require(_0x7af2('0x0'));var _=require('lodash');var client=require(_0x7af2('0x1'));exports[_0x7af2('0x2')]=function(_0x40862f){return client[_0x7af2('0x3')](_0x7af2('0x4'),{'body':_['merge'](_0x40862f,{'source':_0x40862f['calleridnum'],'destinationcontext':_0x40862f[_0x7af2('0x5')],'callerid':_0x40862f[_0x7af2('0x6')],'amaflags':'DOCUMENTATION'}),'log':_0x7af2('0x4')});};exports[_0x7af2('0x7')]=function(){return function(){return client[_0x7af2('0x3')]('GetVoiceCallReport',{'options':{'where':{'type':[_0x7af2('0x8')],'createdAt':{'$between':[moment()['startOf'](_0x7af2('0x9'))[_0x7af2('0xa')](_0x7af2('0xb')),moment()[_0x7af2('0xc')](_0x7af2('0x9'))[_0x7af2('0xa')](_0x7af2('0xb'))]}},'attributes':[_0x7af2('0xd'),'disposition','duration','billableseconds']},'log':_0x7af2('0xe')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index f5c8cef..721cc69 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 _0x9702=['create','Request','CreateVoiceDialReport','../client'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0x9702,0x173));var _0x2970=function(_0x24cc3e,_0x434e0d){_0x24cc3e=_0x24cc3e-0x0;var _0x33715c=_0x9702[_0x24cc3e];return _0x33715c;};'use strict';var client=require(_0x2970('0x0'));exports[_0x2970('0x1')]=function(_0x1900f1){return client[_0x2970('0x2')](_0x2970('0x3'),{'body':_0x1900f1,'log':_0x2970('0x3')});}; \ No newline at end of file +var _0x1951=['../client','create','Request','CreateVoiceDialReport'];(function(_0x1ed7ac,_0x26b0aa){var _0x549644=function(_0x8669eb){while(--_0x8669eb){_0x1ed7ac['push'](_0x1ed7ac['shift']());}};_0x549644(++_0x26b0aa);}(_0x1951,0x124));var _0x1195=function(_0x1e48e7,_0xf3114b){_0x1e48e7=_0x1e48e7-0x0;var _0x3712d4=_0x1951[_0x1e48e7];return _0x3712d4;};'use strict';var client=require(_0x1195('0x0'));exports[_0x1195('0x1')]=function(_0x1f9ded){return client[_0x1195('0x2')](_0x1195('0x3'),{'body':_0x1f9ded,'log':_0x1195('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 71c5874..ce5870c 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 _0xd71d=['exten','../client','getVoiceExtensions','Request','GetVoiceExtension'];(function(_0x39957a,_0x353213){var _0x5a7231=function(_0x2c98e8){while(--_0x2c98e8){_0x39957a['push'](_0x39957a['shift']());}};_0x5a7231(++_0x353213);}(_0xd71d,0x1a5));var _0xdd71=function(_0x9fb081,_0x48f480){_0x9fb081=_0x9fb081-0x0;var _0x43f8b0=_0xd71d[_0x9fb081];return _0x43f8b0;};'use strict';var client=require(_0xdd71('0x0'));exports[_0xdd71('0x1')]=function(){return function(){return client[_0xdd71('0x2')](_0xdd71('0x3'),{'options':{'raw':!![],'attributes':['id',_0xdd71('0x4'),'recordingFormat'],'where':{'VoiceExtensionId':null}},'log':_0xdd71('0x1')});};}; \ No newline at end of file +var _0x3e5c=['getVoiceExtensions','Request','GetVoiceExtension','recordingFormat','../client'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3e5c,0x9a));var _0xc3e5=function(_0x9e3b6d,_0x26891c){_0x9e3b6d=_0x9e3b6d-0x0;var _0x46a361=_0x3e5c[_0x9e3b6d];return _0x46a361;};'use strict';var client=require(_0xc3e5('0x0'));exports[_0xc3e5('0x1')]=function(){return function(){return client[_0xc3e5('0x2')](_0xc3e5('0x3'),{'options':{'raw':!![],'attributes':['id','exten',_0xc3e5('0x4')],'where':{'VoiceExtensionId':null}},'log':_0xc3e5('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 5751e73..165b51c 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 _0x1b57=['../client','getVoiceQueues','Request','GetVoiceQueue','autopause','monitor_format','type','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialAMDActive','dialAMDInitialSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPreviewAutoRecallMe','Trunk','callerid','active','Pause','mandatoryDispositionPause','name','TrunkBackup','Interval','Intervals','interval'];(function(_0x4d8666,_0x2ff19d){var _0x37175b=function(_0x1b8de6){while(--_0x1b8de6){_0x4d8666['push'](_0x4d8666['shift']());}};_0x37175b(++_0x2ff19d);}(_0x1b57,0x1f0));var _0x71b5=function(_0x21247a,_0x4bd88b){_0x21247a=_0x21247a-0x0;var _0x39bd58=_0x1b57[_0x21247a];return _0x39bd58;};'use strict';var client=require(_0x71b5('0x0'));exports[_0x71b5('0x1')]=function(){return function(){return client[_0x71b5('0x2')](_0x71b5('0x3'),{'options':{'raw':![],'attributes':['id','name','acw','acwTimeout',_0x71b5('0x4'),_0x71b5('0x5'),_0x71b5('0x6'),_0x71b5('0x7'),_0x71b5('0x8'),_0x71b5('0x9'),_0x71b5('0xa'),_0x71b5('0xb'),_0x71b5('0xc'),_0x71b5('0xd'),'dialPredictiveInterval',_0x71b5('0xe'),_0x71b5('0xf'),_0x71b5('0x10'),_0x71b5('0x11'),_0x71b5('0x12'),_0x71b5('0x13'),_0x71b5('0x14'),'dialCongestionRetryFrequency','dialBusyMaxRetry',_0x71b5('0x15'),'dialNoAnswerMaxRetry',_0x71b5('0x16'),_0x71b5('0x17'),_0x71b5('0x18'),_0x71b5('0x19'),_0x71b5('0x1a'),'dialCheckDuplicateType',_0x71b5('0x1b'),_0x71b5('0x1c'),'dialAMDGreeting','dialAMDAfterGreetingSilence',_0x71b5('0x1d'),_0x71b5('0x1e'),_0x71b5('0x1f'),_0x71b5('0x20'),_0x71b5('0x21'),'dialAMDMaximumWordLength',_0x71b5('0x22'),_0x71b5('0x23'),_0x71b5('0x24'),_0x71b5('0x25'),'dialAgiAfterHangupAgent',_0x71b5('0x26'),_0x71b5('0x27'),_0x71b5('0x5'),_0x71b5('0x28'),'dialRandomLastDigitCallerIdNumber',_0x71b5('0x29'),_0x71b5('0x2a'),_0x71b5('0x2b'),_0x71b5('0x2c'),_0x71b5('0x2d'),_0x71b5('0x2e'),'dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency',_0x71b5('0x2f'),_0x71b5('0x30'),_0x71b5('0x31'),_0x71b5('0x32'),'dialPredictiveIntervalMinThreshold',_0x71b5('0x33'),'dialPreviewRecallmeReminder'],'include':[{'model':'Trunk','as':_0x71b5('0x34'),'attributes':['id','name',_0x71b5('0x35'),_0x71b5('0x36')]},{'model':_0x71b5('0x37'),'as':_0x71b5('0x38'),'attributes':['id',_0x71b5('0x39')]},{'model':_0x71b5('0x34'),'as':_0x71b5('0x3a'),'attributes':['id','name',_0x71b5('0x35'),_0x71b5('0x36')]},{'model':_0x71b5('0x3b'),'as':_0x71b5('0x3b'),'attributes':['id',_0x71b5('0x39')],'include':[{'model':_0x71b5('0x3b'),'as':_0x71b5('0x3c'),'attributes':['id',_0x71b5('0x39'),_0x71b5('0x3d')]}]}]},'log':_0x71b5('0x1')});};}; \ No newline at end of file +var _0x4c31=['dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','name','callerid','active','Pause','mandatoryDispositionPause','TrunkBackup','Interval','interval','../client','getVoiceQueues','Request','acw','monitor_format','type','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupClient','dialQueueProject2','dialCutDigit','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency'];(function(_0x3ec562,_0x458633){var _0x396681=function(_0x51dce8){while(--_0x51dce8){_0x3ec562['push'](_0x3ec562['shift']());}};_0x396681(++_0x458633);}(_0x4c31,0x95));var _0x14c3=function(_0x5a4dab,_0x525fd2){_0x5a4dab=_0x5a4dab-0x0;var _0x1112ed=_0x4c31[_0x5a4dab];return _0x1112ed;};'use strict';var client=require(_0x14c3('0x0'));exports[_0x14c3('0x1')]=function(){return function(){return client[_0x14c3('0x2')]('GetVoiceQueue',{'options':{'raw':![],'attributes':['id','name',_0x14c3('0x3'),'acwTimeout','autopause',_0x14c3('0x4'),_0x14c3('0x5'),_0x14c3('0x6'),_0x14c3('0x7'),_0x14c3('0x8'),_0x14c3('0x9'),_0x14c3('0xa'),_0x14c3('0xb'),_0x14c3('0xc'),_0x14c3('0xd'),_0x14c3('0xe'),'dialOriginateCallerIdNumber','dialOriginateTimeout',_0x14c3('0xf'),_0x14c3('0x10'),_0x14c3('0x11'),_0x14c3('0x12'),_0x14c3('0x13'),_0x14c3('0x14'),_0x14c3('0x15'),_0x14c3('0x16'),_0x14c3('0x17'),_0x14c3('0x18'),_0x14c3('0x19'),_0x14c3('0x1a'),_0x14c3('0x1b'),_0x14c3('0x1c'),_0x14c3('0x1d'),_0x14c3('0x1e'),_0x14c3('0x1f'),_0x14c3('0x20'),_0x14c3('0x21'),_0x14c3('0x22'),_0x14c3('0x23'),_0x14c3('0x24'),_0x14c3('0x25'),'dialAMDMaximumWordLength',_0x14c3('0x26'),_0x14c3('0x27'),_0x14c3('0x28'),_0x14c3('0x29'),'dialAgiAfterHangupAgent',_0x14c3('0x2a'),_0x14c3('0x2b'),'monitor_format','strategy','dialRandomLastDigitCallerIdNumber',_0x14c3('0x2c'),_0x14c3('0x2d'),'dialNoSuchNumberRetryFrequency',_0x14c3('0x2e'),'dialDropRetryFrequency',_0x14c3('0x2f'),_0x14c3('0x30'),_0x14c3('0x31'),_0x14c3('0x32'),_0x14c3('0x33'),'dialAgentRejectRetryFrequency',_0x14c3('0x34'),_0x14c3('0x35'),_0x14c3('0x36'),_0x14c3('0x37'),_0x14c3('0x38')],'include':[{'model':_0x14c3('0x39'),'as':'Trunk','attributes':['id',_0x14c3('0x3a'),_0x14c3('0x3b'),_0x14c3('0x3c')]},{'model':_0x14c3('0x3d'),'as':_0x14c3('0x3e'),'attributes':['id',_0x14c3('0x3a')]},{'model':_0x14c3('0x39'),'as':_0x14c3('0x3f'),'attributes':['id',_0x14c3('0x3a'),_0x14c3('0x3b'),_0x14c3('0x3c')]},{'model':_0x14c3('0x40'),'as':_0x14c3('0x40'),'attributes':['id','name'],'include':[{'model':_0x14c3('0x40'),'as':'Intervals','attributes':['id',_0x14c3('0x3a'),_0x14c3('0x41')]}]}]},'log':_0x14c3('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index cb309ac..d852ee5 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(_0x2f7614,_0x120014){var _0x5c6169=function(_0x30f84f){while(--_0x30f84f){_0x2f7614['push'](_0x2f7614['shift']());}};_0x5c6169(++_0x120014);}(_0xa9e0,0x123));var _0x0a9e=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xa9e0[_0xea8947];return _0x2455e9;};'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(_0x2c5eac,_0x319ede){var _0x13773d=function(_0xb912e4){while(--_0xb912e4){_0x2c5eac['push'](_0x2c5eac['shift']());}};_0x13773d(++_0x319ede);}(_0xa9e0,0x123));var _0x0a9e=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xa9e0[_0x110c3d];return _0x226d67;};'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 624c26e..c0b88f4 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 _0xc959=['getVoiceQueueRtPauses','../client','Request','GetVoiceQueueRtPauses'];(function(_0x37eac0,_0x4d0f2d){var _0x308f5e=function(_0x4fb06e){while(--_0x4fb06e){_0x37eac0['push'](_0x37eac0['shift']());}};_0x308f5e(++_0x4d0f2d);}(_0xc959,0x191));var _0x9c95=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0xc959[_0x4a747d];return _0x3a5b5c;};'use strict';var client=require(_0x9c95('0x0'));exports['getVoiceQueueRtPauses']=function(_0x1a4d0b){return function(){return client[_0x9c95('0x1')](_0x9c95('0x2'),{'options':{'where':{'VoiceQueueId':_0x1a4d0b,'paused':!![]},'raw':!![]},'log':_0x9c95('0x3')});};}; \ No newline at end of file +var _0xb258=['../client','getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses'];(function(_0x166742,_0x55520c){var _0xb7814a=function(_0x18feaf){while(--_0x18feaf){_0x166742['push'](_0x166742['shift']());}};_0xb7814a(++_0x55520c);}(_0xb258,0x1dc));var _0x8b25=function(_0x387248,_0x287910){_0x387248=_0x387248-0x0;var _0x14a192=_0xb258[_0x387248];return _0x14a192;};'use strict';var client=require(_0x8b25('0x0'));exports[_0x8b25('0x1')]=function(_0x5ced89){return function(){return client[_0x8b25('0x2')](_0x8b25('0x3'),{'options':{'where':{'VoiceQueueId':_0x5ced89,'paused':!![]},'raw':!![]},'log':_0x8b25('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index a3678f1..e4f9591 100644 --- a/server/services/ami/rpc/voiceRecording.js +++ b/server/services/ami/rpc/voiceRecording.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0x2251d8,_0x5b6861){var _0x1c5706=function(_0x4dd899){while(--_0x4dd899){_0x2251d8['push'](_0x2251d8['shift']());}};_0x1c5706(++_0x5b6861);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x7995('0x0'));var client=require(_0x7995('0x1'));exports[_0x7995('0x2')]=function(_0x10a05d){return client['Request'](_0x7995('0x3'),{'body':_[_0x7995('0x4')](_0x10a05d,{'value':_0x10a05d[_0x7995('0x5')]}),'log':_0x7995('0x3')});}; \ No newline at end of file +var _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0x3eb39a,_0x1ccf0e){var _0x407ef0=function(_0x416bb8){while(--_0x416bb8){_0x3eb39a['push'](_0x3eb39a['shift']());}};_0x407ef0(++_0x1ccf0e);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x7995('0x0'));var client=require(_0x7995('0x1'));exports[_0x7995('0x2')]=function(_0x10a05d){return client['Request'](_0x7995('0x3'),{'body':_[_0x7995('0x4')](_0x10a05d,{'value':_0x10a05d[_0x7995('0x5')]}),'log':_0x7995('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index e21d1a7..1855431 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 _0x44e5=['origtransfereraccountcode','secondtransferercontext','secondtransfererexten','transfertargetchannel','transfertargetcalleridnum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','../client','transfers','Request','CreateVoiceTransferReport','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','isexternal','extension','result','origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinenum'];(function(_0xadde88,_0x58ad47){var _0x3b8eb6=function(_0x15535a){while(--_0x15535a){_0xadde88['push'](_0xadde88['shift']());}};_0x3b8eb6(++_0x58ad47);}(_0x44e5,0xc6));var _0x544e=function(_0x189b3b,_0x484de8){_0x189b3b=_0x189b3b-0x0;var _0x7c4721=_0x44e5[_0x189b3b];return _0x7c4721;};'use strict';var client=require(_0x544e('0x0'));exports[_0x544e('0x1')]={};exports['blindTransfer']=function(_0x47b91c){return client[_0x544e('0x2')](_0x544e('0x3'),{'body':{'result':_0x47b91c['result'],'transfererchannel':_0x47b91c['transfererchannel'],'transferercalleridnum':_0x47b91c[_0x544e('0x4')],'transferercalleridname':_0x47b91c[_0x544e('0x5')],'transfererconnectedlinenum':_0x47b91c[_0x544e('0x6')],'transfererconnectedlinename':_0x47b91c[_0x544e('0x7')],'transfereraccountcode':_0x47b91c['transfereraccountcode'],'transferercontext':_0x47b91c[_0x544e('0x8')],'transfererexten':_0x47b91c[_0x544e('0x9')],'transfererlinkedid':_0x47b91c[_0x544e('0xa')],'transfereechannel':_0x47b91c[_0x544e('0xb')],'transfereecalleridnum':_0x47b91c[_0x544e('0xc')],'transfereecalleridname':_0x47b91c[_0x544e('0xd')],'transfereeconnectedlinenum':_0x47b91c['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x47b91c['transfereeconnectedlinename'],'transfereeaccountcode':_0x47b91c[_0x544e('0xe')],'transfereecontext':_0x47b91c[_0x544e('0xf')],'transfereeexten':_0x47b91c[_0x544e('0x10')],'transfereelinkedid':_0x47b91c[_0x544e('0x11')],'isexternal':_0x47b91c[_0x544e('0x12')],'context':_0x47b91c['context'],'extension':_0x47b91c[_0x544e('0x13')],'type':'blind'},'log':'CreateVoiceTransferReport'});};exports['attendedTransfer']=function(_0x53d9bc){return client[_0x544e('0x2')]('CreateVoiceTransferReport',{'body':{'result':_0x53d9bc[_0x544e('0x14')],'transfererchannel':_0x53d9bc[_0x544e('0x15')],'transferercalleridnum':_0x53d9bc[_0x544e('0x16')],'transferercalleridname':_0x53d9bc['origtransferercalleridname'],'transfererconnectedlinenum':_0x53d9bc[_0x544e('0x17')],'transfererconnectedlinename':_0x53d9bc['secondtransfererconnectedlinename'],'transfereraccountcode':_0x53d9bc[_0x544e('0x18')],'transferercontext':_0x53d9bc[_0x544e('0x19')],'transfererexten':_0x53d9bc[_0x544e('0x1a')],'transfererlinkedid':_0x53d9bc['origtransfererlinkedid'],'transfereechannel':_0x53d9bc[_0x544e('0x1b')],'transfereecalleridnum':_0x53d9bc[_0x544e('0x1c')],'transfereecalleridname':_0x53d9bc['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x53d9bc['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x53d9bc[_0x544e('0x1d')],'transfereeaccountcode':_0x53d9bc[_0x544e('0x1e')],'transfereecontext':_0x53d9bc[_0x544e('0x1f')],'transfereeexten':_0x53d9bc[_0x544e('0x20')],'transfereelinkedid':_0x53d9bc[_0x544e('0x21')],'isexternal':_0x53d9bc[_0x544e('0x12')],'context':_0x53d9bc[_0x544e('0x22')],'extension':_0x53d9bc[_0x544e('0x23')],'type':_0x544e('0x24')},'log':_0x544e('0x3')});}; \ No newline at end of file +var _0x8e3f=['transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','../client','transfers','blindTransfer','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinename','transferercontext','transfererexten','transfereecalleridname','transfereeconnectedlinenum','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','isexternal','context','attendedTransfer','origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum'];(function(_0x18d4ad,_0x552602){var _0x44ecd1=function(_0xbcc507){while(--_0xbcc507){_0x18d4ad['push'](_0x18d4ad['shift']());}};_0x44ecd1(++_0x552602);}(_0x8e3f,0xc0));var _0xf8e3=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x8e3f[_0x40a045];return _0x1a687c;};'use strict';var client=require(_0xf8e3('0x0'));exports[_0xf8e3('0x1')]={};exports[_0xf8e3('0x2')]=function(_0x3f5508){return client[_0xf8e3('0x3')](_0xf8e3('0x4'),{'body':{'result':_0x3f5508[_0xf8e3('0x5')],'transfererchannel':_0x3f5508[_0xf8e3('0x6')],'transferercalleridnum':_0x3f5508[_0xf8e3('0x7')],'transferercalleridname':_0x3f5508[_0xf8e3('0x8')],'transfererconnectedlinenum':_0x3f5508['transfererconnectedlinenum'],'transfererconnectedlinename':_0x3f5508[_0xf8e3('0x9')],'transfereraccountcode':_0x3f5508['transfereraccountcode'],'transferercontext':_0x3f5508[_0xf8e3('0xa')],'transfererexten':_0x3f5508[_0xf8e3('0xb')],'transfererlinkedid':_0x3f5508['transfererlinkedid'],'transfereechannel':_0x3f5508['transfereechannel'],'transfereecalleridnum':_0x3f5508['transfereecalleridnum'],'transfereecalleridname':_0x3f5508[_0xf8e3('0xc')],'transfereeconnectedlinenum':_0x3f5508[_0xf8e3('0xd')],'transfereeconnectedlinename':_0x3f5508['transfereeconnectedlinename'],'transfereeaccountcode':_0x3f5508[_0xf8e3('0xe')],'transfereecontext':_0x3f5508[_0xf8e3('0xf')],'transfereeexten':_0x3f5508[_0xf8e3('0x10')],'transfereelinkedid':_0x3f5508[_0xf8e3('0x11')],'isexternal':_0x3f5508[_0xf8e3('0x12')],'context':_0x3f5508[_0xf8e3('0x13')],'extension':_0x3f5508['extension'],'type':'blind'},'log':_0xf8e3('0x4')});};exports[_0xf8e3('0x14')]=function(_0x5dbc2f){return client[_0xf8e3('0x3')](_0xf8e3('0x4'),{'body':{'result':_0x5dbc2f[_0xf8e3('0x5')],'transfererchannel':_0x5dbc2f[_0xf8e3('0x15')],'transferercalleridnum':_0x5dbc2f['origtransferercalleridnum'],'transferercalleridname':_0x5dbc2f[_0xf8e3('0x16')],'transfererconnectedlinenum':_0x5dbc2f[_0xf8e3('0x17')],'transfererconnectedlinename':_0x5dbc2f[_0xf8e3('0x18')],'transfereraccountcode':_0x5dbc2f[_0xf8e3('0x19')],'transferercontext':_0x5dbc2f['secondtransferercontext'],'transfererexten':_0x5dbc2f[_0xf8e3('0x1a')],'transfererlinkedid':_0x5dbc2f['origtransfererlinkedid'],'transfereechannel':_0x5dbc2f['transfertargetchannel'],'transfereecalleridnum':_0x5dbc2f[_0xf8e3('0x1b')],'transfereecalleridname':_0x5dbc2f[_0xf8e3('0x1c')],'transfereeconnectedlinenum':_0x5dbc2f[_0xf8e3('0x1d')],'transfereeconnectedlinename':_0x5dbc2f[_0xf8e3('0x1e')],'transfereeaccountcode':_0x5dbc2f[_0xf8e3('0x1f')],'transfereecontext':_0x5dbc2f[_0xf8e3('0x20')],'transfereeexten':_0x5dbc2f[_0xf8e3('0x21')],'transfereelinkedid':_0x5dbc2f[_0xf8e3('0x22')],'isexternal':_0x5dbc2f[_0xf8e3('0x12')],'context':_0x5dbc2f[_0xf8e3('0x23')],'extension':_0x5dbc2f[_0xf8e3('0x24')],'type':'attended'},'log':_0xf8e3('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index d7de76b..0f709fa 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(_0x5d582e,_0x6b30ee){var _0x1ce5bf=function(_0x152c1d){while(--_0x152c1d){_0x5d582e['push'](_0x5d582e['shift']());}};_0x1ce5bf(++_0x6b30ee);}(_0x7a54,0x106));var _0x47a5=function(_0xa90372,_0x3fe504){_0xa90372=_0xa90372-0x0;var _0x4e5302=_0x7a54[_0xa90372];return _0x4e5302;};'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(_0x10404c,_0x363868){var _0x8665be=function(_0x288e65){while(--_0x288e65){_0x10404c['push'](_0x10404c['shift']());}};_0x8665be(++_0x363868);}(_0x7a54,0x106));var _0x47a5=function(_0x11f009,_0x3abb86){_0x11f009=_0x11f009-0x0;var _0x4583c5=_0x7a54[_0x11f009];return _0x4583c5;};'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 fce728f..181e9d8 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 _0xc771=['stringify','emit','exec','data2','isNil','xmd-contactid','ListId','data3','split','$or','map','routeId','destcalleridnum','calleridnum','firstName','phone','fax','createdAt','union','then','length','info','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','calleridname','destcalleridname','','Unknown','resolve','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','user:%s','name','format','trigger:%s','action','toLowerCase','lodash','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','defaults','redis','localhost','[CM][%s][%s]'];(function(_0x5424b1,_0xaa1835){var _0x4607e6=function(_0x4faa3d){while(--_0x4faa3d){_0x5424b1['push'](_0x5424b1['shift']());}};_0x4607e6(++_0xaa1835);}(_0xc771,0x100));var _0x1c77=function(_0xe174da,_0x658457){_0xe174da=_0xe174da-0x0;var _0x1ab073=_0xc771[_0xe174da];return _0x1ab073;};'use strict';var _=require(_0x1c77('0x0'));var BPromise=require('bluebird');var Redis=require('ioredis');var util=require('util');var config=require(_0x1c77('0x1'));var logger=require(_0x1c77('0x2'))(_0x1c77('0x3'));var cmContactRpc=require(_0x1c77('0x4'));config['redis']=_[_0x1c77('0x5')](config[_0x1c77('0x6')],{'host':_0x1c77('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x1c77('0x6')]));function emit(_0x4c6ca7,_0x157010,_0x56219f,_0x4731bb,_0x35bf78){logger['info'](_0x1c77('0x8'),_0x4c6ca7,_0x157010['id'],_0x56219f,_0x4731bb,JSON[_0x1c77('0x9')](_0x35bf78));io['to'](_0x56219f)[_0x1c77('0xa')](_0x4731bb,_0x35bf78);}exports[_0x1c77('0xb')]=function(_0x447daf,_0x5e436a,_0x26b2ad,_0x371c95){var _0x117a16,_0x4829b9;var _0x24d8f0={};var _0x30e7bb;var _0x16b0c8=Number(_0x26b2ad['data1']);var _0x134a0c=_0x26b2ad[_0x1c77('0xc')]?Boolean(Number(_0x26b2ad[_0x1c77('0xc')])):![];var _0x4155be;var _0x1dd630=![];if(!_[_0x1c77('0xd')](_0x26b2ad['data5'])){if(_0x26b2ad['data5']=='1')_0x1dd630=!![];}if(!_0x1dd630){if(_0x371c95['xmd-contactid']){_0x24d8f0['id']=_0x371c95[_0x1c77('0xe')];}}if(!_0x24d8f0['id']){_0x24d8f0[_0x1c77('0xf')]=_0x16b0c8;_0x4155be=_0x26b2ad[_0x1c77('0x10')]&&_0x26b2ad['data3']!=='0'?_0x26b2ad[_0x1c77('0x10')][_0x1c77('0x11')](','):['phone'];_0x24d8f0[_0x1c77('0x12')]=_[_0x1c77('0x13')](_0x4155be,function(_0x36d504){var _0x5225ae={};_0x5225ae[_0x36d504]=_0x371c95[_0x1c77('0x14')]?_0x371c95['destcalleridnum']:_0x371c95['calleridnum'];return _0x5225ae;});_0x30e7bb=_0x371c95[_0x1c77('0x14')]?_0x371c95[_0x1c77('0x15')]:_0x371c95[_0x1c77('0x16')];}var _0x518846=['id',_0x1c77('0x17'),'lastName',_0x1c77('0x18'),'mobile',_0x1c77('0x19'),_0x1c77('0xf'),_0x1c77('0x1a'),'scheduledAt','updatedAt'];var _0x2edec5=_[_0x1c77('0x1b')](_0x518846,_0x4155be);BPromise['resolve']()[_0x1c77('0x1c')](cmContactRpc['getContacts']({'attributes':_0x2edec5,'where':_0x24d8f0,'phone':_0x30e7bb}))[_0x1c77('0x1c')](function(_0x1f971d){_0x4829b9=_0x1f971d;if(!_['isEmpty'](_0x4829b9)){if(_0x4829b9[_0x1c77('0x1d')]===0x1){_0x117a16=_0x4829b9[0x0];logger[_0x1c77('0x1e')](_0x1c77('0x1f'),_0x371c95[_0x1c77('0x20')],_0x5e436a['id'],_0x117a16['id']);}else{logger[_0x1c77('0x1e')](_0x1c77('0x21'),_0x371c95[_0x1c77('0x20')],_0x5e436a['id'],_[_0x1c77('0x13')](_0x4829b9,'id')[_0x1c77('0x22')](','));}return;}else{logger[_0x1c77('0x1e')](_0x1c77('0x23'),_0x371c95[_0x1c77('0x20')],_0x5e436a['id']);var _0x36f235={'ListId':_0x16b0c8};var _0x2d5bbf=_0x26b2ad[_0x1c77('0x24')]&&_0x26b2ad[_0x1c77('0x24')]!=='0'?_0x26b2ad['data4']:'phone';if(_0x134a0c){logger[_0x1c77('0x1e')](_0x1c77('0x25'),_0x371c95[_0x1c77('0x20')],_0x5e436a['id']);_0x36f235[_0x2d5bbf]=_[_0x1c77('0xd')](_0x371c95['routeId'])?_0x371c95[_0x1c77('0x16')]:_0x371c95[_0x1c77('0x15')];if(_[_0x1c77('0xd')](_0x371c95[_0x1c77('0x14')])){_0x36f235[_0x1c77('0x17')]=_0x371c95[_0x1c77('0x26')]&&_0x371c95['calleridname']!==''?_0x371c95['calleridname']:'Unknown';}else{_0x36f235[_0x1c77('0x17')]=_0x371c95[_0x1c77('0x27')]&&_0x371c95[_0x1c77('0x27')]!==_0x1c77('0x28')?_0x371c95[_0x1c77('0x27')]:_0x1c77('0x29');}return BPromise[_0x1c77('0x2a')]()[_0x1c77('0x1c')](cmContactRpc[_0x1c77('0x2b')](_0x36f235))[_0x1c77('0x1c')](function(_0x1485e9){_0x117a16=_0x1485e9;_0x4829b9[_0x1c77('0x2c')](_0x1485e9);if(_0x117a16){logger[_0x1c77('0x1e')](_0x1c77('0x2d'),_0x371c95[_0x1c77('0x20')],_0x5e436a['id'],_0x117a16['id']);}return;});}else{logger[_0x1c77('0x1e')](_0x1c77('0x2e'),_0x371c95[_0x1c77('0x20')],_0x5e436a['id']);_0x36f235[_0x2d5bbf]=_[_0x1c77('0xd')](_0x371c95[_0x1c77('0x14')])?_0x371c95[_0x1c77('0x16')]:_0x371c95['destcalleridnum'];if(_['isNil'](_0x371c95[_0x1c77('0x14')])){_0x36f235[_0x1c77('0x17')]=_0x371c95[_0x1c77('0x26')]&&_0x371c95[_0x1c77('0x26')]!==_0x1c77('0x28')?_0x371c95['calleridname']:_0x1c77('0x29');}else{_0x36f235[_0x1c77('0x17')]=_0x371c95[_0x1c77('0x27')]&&_0x371c95[_0x1c77('0x27')]!==_0x1c77('0x28')?_0x371c95[_0x1c77('0x27')]:_0x1c77('0x29');}_0x117a16=_0x36f235;_0x4829b9[_0x1c77('0x2c')](_0x36f235);return;}}})[_0x1c77('0x1c')](function(){if(_0x447daf){emit(_0x371c95[_0x1c77('0x20')],_0x5e436a,util['format'](_0x1c77('0x2f'),_0x447daf[_0x1c77('0x30')]),util[_0x1c77('0x31')](_0x1c77('0x32'),_0x26b2ad[_0x1c77('0x33')][_0x1c77('0x34')]()),{'evt':_['merge'](_0x371c95,{'autoCreate':_0x134a0c}),'contact':_0x117a16===undefined?{}:_0x117a16,'contacts':_0x4829b9['length']===0x0?undefined:_0x4829b9});}});}; \ No newline at end of file +var _0x011a=['[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','calleridname','','destcalleridname','Unknown','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','format','user:%s','name','trigger:%s','action','toLowerCase','lodash','bluebird','../../../../config/environment','trigger','redis','localhost','socket.io-emitter','info','[CM][%s][%s]','stringify','emit','exec','data1','data2','isNil','data5','xmd-contactid','ListId','data3','split','phone','$or','map','routeId','destcalleridnum','calleridnum','firstName','lastName','mobile','createdAt','scheduledAt','union','resolve','then','getContacts','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join'];(function(_0x5be7d2,_0xebc786){var _0x49a38d=function(_0x19aa83){while(--_0x19aa83){_0x5be7d2['push'](_0x5be7d2['shift']());}};_0x49a38d(++_0xebc786);}(_0x011a,0x16d));var _0xa011=function(_0x1accf6,_0x4a9854){_0x1accf6=_0x1accf6-0x0;var _0x24e446=_0x011a[_0x1accf6];return _0x24e446;};'use strict';var _=require(_0xa011('0x0'));var BPromise=require(_0xa011('0x1'));var Redis=require('ioredis');var util=require('util');var config=require(_0xa011('0x2'));var logger=require('../../../../config/logger')(_0xa011('0x3'));var cmContactRpc=require('../../rpc/cmContact');config[_0xa011('0x4')]=_['defaults'](config[_0xa011('0x4')],{'host':_0xa011('0x5'),'port':0x18eb});var io=require(_0xa011('0x6'))(new Redis(config['redis']));function emit(_0x53a950,_0x14bbed,_0x413a52,_0x327bb3,_0x834c76){logger[_0xa011('0x7')](_0xa011('0x8'),_0x53a950,_0x14bbed['id'],_0x413a52,_0x327bb3,JSON[_0xa011('0x9')](_0x834c76));io['to'](_0x413a52)[_0xa011('0xa')](_0x327bb3,_0x834c76);}exports[_0xa011('0xb')]=function(_0x510167,_0x1309f6,_0x5c1021,_0x394334){var _0x3c23d7,_0xbdaff3;var _0x32aed6={};var _0x4b84f3;var _0x2478af=Number(_0x5c1021[_0xa011('0xc')]);var _0x5e83b8=_0x5c1021[_0xa011('0xd')]?Boolean(Number(_0x5c1021['data2'])):![];var _0x4405ef;var _0x14e076=![];if(!_[_0xa011('0xe')](_0x5c1021[_0xa011('0xf')])){if(_0x5c1021[_0xa011('0xf')]=='1')_0x14e076=!![];}if(!_0x14e076){if(_0x394334['xmd-contactid']){_0x32aed6['id']=_0x394334[_0xa011('0x10')];}}if(!_0x32aed6['id']){_0x32aed6[_0xa011('0x11')]=_0x2478af;_0x4405ef=_0x5c1021[_0xa011('0x12')]&&_0x5c1021['data3']!=='0'?_0x5c1021[_0xa011('0x12')][_0xa011('0x13')](','):[_0xa011('0x14')];_0x32aed6[_0xa011('0x15')]=_[_0xa011('0x16')](_0x4405ef,function(_0x48cdf7){var _0x3132c0={};_0x3132c0[_0x48cdf7]=_0x394334[_0xa011('0x17')]?_0x394334[_0xa011('0x18')]:_0x394334[_0xa011('0x19')];return _0x3132c0;});_0x4b84f3=_0x394334['routeId']?_0x394334[_0xa011('0x18')]:_0x394334[_0xa011('0x19')];}var _0x3b9beb=['id',_0xa011('0x1a'),_0xa011('0x1b'),_0xa011('0x14'),_0xa011('0x1c'),'fax','ListId',_0xa011('0x1d'),_0xa011('0x1e'),'updatedAt'];var _0x360062=_[_0xa011('0x1f')](_0x3b9beb,_0x4405ef);BPromise[_0xa011('0x20')]()[_0xa011('0x21')](cmContactRpc[_0xa011('0x22')]({'attributes':_0x360062,'where':_0x32aed6,'phone':_0x4b84f3}))[_0xa011('0x21')](function(_0x1002e2){_0xbdaff3=_0x1002e2;if(!_[_0xa011('0x23')](_0xbdaff3)){if(_0xbdaff3[_0xa011('0x24')]===0x1){_0x3c23d7=_0xbdaff3[0x0];logger[_0xa011('0x7')](_0xa011('0x25'),_0x394334[_0xa011('0x26')],_0x1309f6['id'],_0x3c23d7['id']);}else{logger[_0xa011('0x7')](_0xa011('0x27'),_0x394334[_0xa011('0x26')],_0x1309f6['id'],_[_0xa011('0x16')](_0xbdaff3,'id')[_0xa011('0x28')](','));}return;}else{logger[_0xa011('0x7')](_0xa011('0x29'),_0x394334[_0xa011('0x26')],_0x1309f6['id']);var _0x5d5e27={'ListId':_0x2478af};var _0x47d849=_0x5c1021[_0xa011('0x2a')]&&_0x5c1021[_0xa011('0x2a')]!=='0'?_0x5c1021[_0xa011('0x2a')]:'phone';if(_0x5e83b8){logger[_0xa011('0x7')](_0xa011('0x2b'),_0x394334[_0xa011('0x26')],_0x1309f6['id']);_0x5d5e27[_0x47d849]=_['isNil'](_0x394334[_0xa011('0x17')])?_0x394334[_0xa011('0x19')]:_0x394334[_0xa011('0x18')];if(_[_0xa011('0xe')](_0x394334[_0xa011('0x17')])){_0x5d5e27['firstName']=_0x394334[_0xa011('0x2c')]&&_0x394334['calleridname']!==_0xa011('0x2d')?_0x394334['calleridname']:'Unknown';}else{_0x5d5e27[_0xa011('0x1a')]=_0x394334[_0xa011('0x2e')]&&_0x394334['destcalleridname']!==''?_0x394334[_0xa011('0x2e')]:_0xa011('0x2f');}return BPromise[_0xa011('0x20')]()[_0xa011('0x21')](cmContactRpc[_0xa011('0x30')](_0x5d5e27))['then'](function(_0x490daf){_0x3c23d7=_0x490daf;_0xbdaff3[_0xa011('0x31')](_0x490daf);if(_0x3c23d7){logger[_0xa011('0x7')](_0xa011('0x32'),_0x394334[_0xa011('0x26')],_0x1309f6['id'],_0x3c23d7['id']);}return;});}else{logger[_0xa011('0x7')](_0xa011('0x33'),_0x394334[_0xa011('0x26')],_0x1309f6['id']);_0x5d5e27[_0x47d849]=_['isNil'](_0x394334[_0xa011('0x17')])?_0x394334['calleridnum']:_0x394334[_0xa011('0x18')];if(_[_0xa011('0xe')](_0x394334[_0xa011('0x17')])){_0x5d5e27[_0xa011('0x1a')]=_0x394334['calleridname']&&_0x394334[_0xa011('0x2c')]!==_0xa011('0x2d')?_0x394334['calleridname']:_0xa011('0x2f');}else{_0x5d5e27[_0xa011('0x1a')]=_0x394334['destcalleridname']&&_0x394334[_0xa011('0x2e')]!==_0xa011('0x2d')?_0x394334[_0xa011('0x2e')]:'Unknown';}_0x3c23d7=_0x5d5e27;_0xbdaff3[_0xa011('0x31')](_0x5d5e27);return;}}})[_0xa011('0x21')](function(){if(_0x510167){emit(_0x394334['uniqueid'],_0x1309f6,util[_0xa011('0x34')](_0xa011('0x35'),_0x510167[_0xa011('0x36')]),util[_0xa011('0x34')](_0xa011('0x37'),_0x5c1021[_0xa011('0x38')][_0xa011('0x39')]()),{'evt':_['merge'](_0x394334,{'autoCreate':_0x5e83b8}),'contact':_0x3c23d7===undefined?{}:_0x3c23d7,'contacts':_0xbdaff3[_0xa011('0x24')]===0x0?undefined:_0xbdaff3});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index b232d43..816934b 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 _0x7fbc=['vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','custom:agentcalled','syncCustomEvent','custom:agentconnect','bind','custom:agentbusy','custom:amd','custom:queuecallerabandon','custom:dialbegin','syncAgentDial','custom:dialconnect','custom:newinteraction','custom:closedinteraction','custom:substatus','custom:incomingmessage','custom:outgoingmessage','custom:acceptmessage','custom:offlineMessage','prototype','motionChannel','undefined','voice','debug','inspect','checkTriggers','hasOwnProperty','status','checkTrigger','variables','Actions','length','interface','action','toLowerCase','contactmanager','motionbar','browser','TemplateId','data2','html','template\x20not\x20found','uri','buildUri','isNil','data3','data4','location','data5','800','windowHeight','data6','600','winApplication','render','winArguments','emit','format','user:%s','name','trigger:%s:%s','data1','jscripty','trigger:%s','merge','exec','integration','queue','routeId','urlforward','script','parse','search','channel','AllConditions','checkConditions','AnyConditions','checkTrigger:\x20trigger','evt','field','account','chat','value','upperFirst','AccountId','interaction','operator','agent','membername','lastevent','mailSubstatus','null','offlineMessage','created','equals','exports','util','lodash','ioredis','./integration','./cmContact','./script','../../../config/logger','trigger','../ami','redis','localhost','socket.io-emitter','popup','url','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts'];(function(_0x49cd0f,_0x3663b9){var _0x5bd8d6=function(_0x4661a8){while(--_0x4661a8){_0x49cd0f['push'](_0x49cd0f['shift']());}};_0x5bd8d6(++_0x3663b9);}(_0x7fbc,0xdf));var _0xc7fb=function(_0x2a39e7,_0x1fb47c){_0x2a39e7=_0x2a39e7-0x0;var _0x1d512f=_0x7fbc[_0x2a39e7];return _0x1d512f;};'use strict';var util=require(_0xc7fb('0x0'));var _=require(_0xc7fb('0x1'));var url=require('url');var Mustache=require('mustache');var Redis=require(_0xc7fb('0x2'));var urlforward=require('./urlforward');var integration=require(_0xc7fb('0x3'));var cmContact=require(_0xc7fb('0x4'));var script=require(_0xc7fb('0x5'));var config=require('../../../config/environment');var logger=require(_0xc7fb('0x6'))(_0xc7fb('0x7'));var ami=require(_0xc7fb('0x8'));config[_0xc7fb('0x9')]=_['defaults'](config[_0xc7fb('0x9')],{'host':_0xc7fb('0xa'),'port':0x18eb});var io=require(_0xc7fb('0xb'))(new Redis(config[_0xc7fb('0x9')]));var operators={'equals':function(_0x1dd905,_0x18fca9){return _0x1dd905==_0x18fca9;},'not_equals':function(_0x3a1c56,_0x1de94b){return _0x3a1c56!=_0x1de94b;}};var barAndWebActions=[_0xc7fb('0xc'),_0xc7fb('0xd'),_0xc7fb('0xe')];function Trigger(_0x2eb105){this[_0xc7fb('0xf')]=_0x2eb105[_0xc7fb('0xf')];this[_0xc7fb('0x10')]=_0x2eb105[_0xc7fb('0x10')];this['voiceQueues']=_0x2eb105[_0xc7fb('0x11')];this[_0xc7fb('0x12')]=_0x2eb105[_0xc7fb('0x12')];this[_0xc7fb('0x13')]=_0x2eb105[_0xc7fb('0x13')];this[_0xc7fb('0x14')]=_0x2eb105['zendeskAccounts'];this[_0xc7fb('0x15')]=_0x2eb105[_0xc7fb('0x15')];this['salesforceAccounts']=_0x2eb105['salesforceAccounts'];this[_0xc7fb('0x16')]=_0x2eb105[_0xc7fb('0x16')];this[_0xc7fb('0x17')]=_0x2eb105[_0xc7fb('0x17')];this['deskAccounts']=_0x2eb105[_0xc7fb('0x18')];this[_0xc7fb('0x19')]=_0x2eb105[_0xc7fb('0x19')];this[_0xc7fb('0x1a')]=_0x2eb105[_0xc7fb('0x1a')];this[_0xc7fb('0x1b')]=_0x2eb105['dynamics365Accounts'];this[_0xc7fb('0x1c')]=_0x2eb105[_0xc7fb('0x1c')];this[_0xc7fb('0x1d')]={'zendesk':this[_0xc7fb('0x14')],'salesforce':this['salesforceAccounts'],'freshdesk':this[_0xc7fb('0x15')],'sugarcrm':this[_0xc7fb('0x16')],'zoho':this[_0xc7fb('0x17')],'desk':this[_0xc7fb('0x18')],'vtiger':this['vtigerAccounts'],'dynamics365':this['dynamics365Accounts'],'freshsales':this['freshsalesAccounts'],'servicenow':this[_0xc7fb('0x1a')]};ami['on'](_0xc7fb('0x1e'),this[_0xc7fb('0x1f')]['bind'](this));ami['on'](_0xc7fb('0x20'),this[_0xc7fb('0x1f')][_0xc7fb('0x21')](this));ami['on']('custom:agentringnoanswer',this[_0xc7fb('0x1f')][_0xc7fb('0x21')](this));ami['on']('custom:agentcomplete',this['syncCustomEvent'][_0xc7fb('0x21')](this));ami['on']('custom:agentnosuchnumber',this[_0xc7fb('0x1f')][_0xc7fb('0x21')](this));ami['on']('custom:agentnoanswer',this[_0xc7fb('0x1f')][_0xc7fb('0x21')](this));ami['on'](_0xc7fb('0x22'),this[_0xc7fb('0x1f')][_0xc7fb('0x21')](this));ami['on']('custom:agentcongestion',this['syncCustomEvent']['bind'](this));ami['on']('custom:agentreject',this['syncCustomEvent'][_0xc7fb('0x21')](this));ami['on'](_0xc7fb('0x23'),this[_0xc7fb('0x1f')][_0xc7fb('0x21')](this));ami['on'](_0xc7fb('0x24'),this[_0xc7fb('0x1f')]['bind'](this));ami['on']('custom:timeout',this[_0xc7fb('0x1f')][_0xc7fb('0x21')](this));ami['on'](_0xc7fb('0x25'),this[_0xc7fb('0x26')]['bind'](this));ami['on'](_0xc7fb('0x27'),this[_0xc7fb('0x26')][_0xc7fb('0x21')](this));ami['on']('custom:dialend',this['syncAgentDial'][_0xc7fb('0x21')](this));ami['on'](_0xc7fb('0x28'),this[_0xc7fb('0x1f')]['bind'](this));ami['on'](_0xc7fb('0x29'),this[_0xc7fb('0x1f')][_0xc7fb('0x21')](this));ami['on'](_0xc7fb('0x2a'),this[_0xc7fb('0x1f')][_0xc7fb('0x21')](this));ami['on'](_0xc7fb('0x2b'),this[_0xc7fb('0x1f')][_0xc7fb('0x21')](this));ami['on'](_0xc7fb('0x2c'),this['syncCustomEvent']['bind'](this));ami['on'](_0xc7fb('0x2d'),this[_0xc7fb('0x1f')]['bind'](this));ami['on']('custom:rejectmessage',this['syncCustomEvent'][_0xc7fb('0x21')](this));ami['on'](_0xc7fb('0x2e'),this[_0xc7fb('0x1f')][_0xc7fb('0x21')](this));}Trigger[_0xc7fb('0x2f')]['emit']=function(_0x4cc014,_0x8866a9,_0x52c83f){logger['info'](_0x4cc014,_0x8866a9,JSON['stringify'](_0x52c83f));io['to'](_0x4cc014)['emit'](_0x8866a9,_0x52c83f);};Trigger['prototype'][_0xc7fb('0x1f')]=function(_0x1470c0){var _0x493ed6=_['clone'](_0x1470c0);if(typeof _0x493ed6[_0xc7fb('0x30')]===_0xc7fb('0x31')){_0x493ed6[_0xc7fb('0x30')]=_0xc7fb('0x32');}logger[_0xc7fb('0x33')]('syncCustomEvent',util[_0xc7fb('0x34')](_0x493ed6,{'showHidden':!![],'depth':null}));this[_0xc7fb('0x35')](_0x493ed6);};Trigger[_0xc7fb('0x2f')][_0xc7fb('0x26')]=function(_0x4a37d8){if(this[_0xc7fb('0x10')][_0x4a37d8['interface']]){this['syncCustomEvent'](_0x4a37d8);}};Trigger[_0xc7fb('0x2f')]['checkTriggers']=function(_0x1735cc){var _0x158fe1;for(var _0x347433 in this[_0xc7fb('0xf')]){if(this['triggers'][_0xc7fb('0x36')](_0x347433)){if(this[_0xc7fb('0xf')][_0x347433][_0xc7fb('0x37')]){_0x158fe1=this[_0xc7fb('0x38')](this[_0xc7fb('0xf')][_0x347433],_0x1735cc);if(_0x158fe1){_['merge'](_0x1735cc,_0x1735cc[_0xc7fb('0x39')]);for(var _0x4272d3=0x0,_0x31a30f,_0x7a5340,_0xdbcb91;_0x4272d30x0){_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 _0x3e74=['customField','content','idField','custom_fields','variable','variableName','name','Variable','toLowerCase','priority','Creating\x20new\x20ticket...','getString','phone','new','xCALLY','Motion','CTI','concat','Descriptions','/api/v2/users/%d','user','Fields','%s/customers/%d/cases','stripTrailingSlash','serverUrl','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','integrationTab','user:%s','newTab','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','https://xcally.desk.com/web/agent/case/%d','error','Desk\x20account\x20type\x20not\x20recognized','catch','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridnum','The\x20Enduser\x20ID\x20is:','trigger:desk:display','trigger:browser:url','%s/agent/tickets/%s','stringify','unmanaged','monitor_format','lastevent','toUpperCase','calleridnum','lodash','md5','util','ioredis','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','emit','application/json','info','Getting\x20agent\x20with\x20email','%s/users','then','find','_embedded','entries','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','remoteUri','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','format','debug','[HTTP]','GET','authType','basic','%s:%s','username','password','token','Basic\x20%s','toString','base64','Searching\x20enduser\x20with\x20phone','total_entries','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','length','forEach','includes','string','picklist','type','nameField'];(function(_0x14ec9d,_0x5b19f4){var _0x521174=function(_0x46fa43){while(--_0x46fa43){_0x14ec9d['push'](_0x14ec9d['shift']());}};_0x521174(++_0x5b19f4);}(_0x3e74,0x175));var _0x43e7=function(_0x26c327,_0x107a8d){_0x26c327=_0x26c327-0x0;var _0x70f0b=_0x3e74[_0x26c327];return _0x70f0b;};'use strict';var _=require(_0x43e7('0x0'));var rp=require('request-promise');var md5=require(_0x43e7('0x1'));var util=require(_0x43e7('0x2'));var Redis=require(_0x43e7('0x3'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0x43e7('0x4'))('desk');config[_0x43e7('0x5')]=_[_0x43e7('0x6')](config[_0x43e7('0x5')],{'host':_0x43e7('0x7'),'port':0x18eb});var io=require(_0x43e7('0x8'))(new Redis(config['redis']));function emit(_0x45a0d1,_0x3491d6,_0x2ede2d){io['to'](_0x45a0d1)[_0x43e7('0x9')](_0x3491d6,_0x2ede2d);}var headers={'Content-Type':_0x43e7('0xa'),'Accept':'application/json'};function getUser(_0x212c6c,_0x554d44){if(intUtil['validateEmail'](_0x554d44)===!![]){logger[_0x43e7('0xb')](_0x43e7('0xc'),_0x554d44);return request({'uri':util['format'](_0x43e7('0xd'),_0x212c6c['remoteUri'])})[_0x43e7('0xe')](function(_0x37302c){if(_0x37302c['total_entries']){return _[_0x43e7('0xf')](_0x37302c[_0x43e7('0x10')][_0x43e7('0x11')],{'email':_0x554d44});}})[_0x43e7('0xe')](function(_0x4e008c){if(_0x4e008c){logger['info'](_0x43e7('0x12'));return _0x4e008c;}else{logger[_0x43e7('0xb')](_0x43e7('0x13'));return request({'uri':util['format']('%s/users/me',_0x212c6c[_0x43e7('0x14')])});}});}else{logger[_0x43e7('0xb')](_0x43e7('0x15'));return request({'uri':util[_0x43e7('0x16')]('%s/users/me',_0x212c6c['remoteUri'])});}}function request(_0xdf16c){logger[_0x43e7('0x17')](_0x43e7('0x18'),JSON['stringify'](_0xdf16c));return rp(_['defaults'](_0xdf16c,{'method':_0x43e7('0x19'),'headers':headers,'json':!![]}));}function getAuth(_0x1ca758){var _0x9037d3;if(_0x1ca758[_0x43e7('0x1a')]===_0x43e7('0x1b')){_0x9037d3=util[_0x43e7('0x16')](_0x43e7('0x1c'),_0x1ca758[_0x43e7('0x1d')],_0x1ca758[_0x43e7('0x1e')]);}else if(_0x1ca758[_0x43e7('0x1a')]===_0x43e7('0x1f')){_0x9037d3=util[_0x43e7('0x16')]('%s/token:%s',_0x1ca758[_0x43e7('0x1d')],_0x1ca758[_0x43e7('0x1f')]);}return util['format'](_0x43e7('0x20'),new Buffer(_0x9037d3)[_0x43e7('0x21')](_0x43e7('0x22')));}function getEndUser(_0x28aacc,_0x4077fb,_0x2f4cb4){logger['info'](_0x43e7('0x23'),_0x2f4cb4);return request({'uri':util['format']('%s/customers/search',_0x28aacc[_0x43e7('0x14')]),'qs':{'phone':_0x2f4cb4}})[_0x43e7('0xe')](function(_0x4b2b9f){if(_0x4b2b9f[_0x43e7('0x24')]){logger['info'](_0x43e7('0x25'));return _0x4b2b9f['_embedded'][_0x43e7('0x11')][0x0];}else{logger[_0x43e7('0xb')](_0x43e7('0x26'));return request({'uri':util[_0x43e7('0x16')]('%s/customers',_0x28aacc['remoteUri']),'method':_0x43e7('0x27'),'body':{'first_name':_0x4077fb,'title':_0x4077fb,'phone_numbers':[{'type':'work','value':_0x2f4cb4}]}});}});}function getTags(_0x2dd5f,_0x40dc8f){var _0x3565cf=[];if(_0x2dd5f&&_0x2dd5f[_0x43e7('0x28')]>0x0){_0x3565cf=_['map'](_0x2dd5f,_0x40dc8f);}return _0x3565cf;}function getCustomFields(_0x33a1a5,_0x4690a6){var _0x45b675=[];var _0x50f9f5={'custom_fields':{}};if(_0x33a1a5[_0x43e7('0x28')]>0x0){_[_0x43e7('0x29')](_0x33a1a5,function(_0x2b85a5){if(_[_0x43e7('0x2a')]([_0x43e7('0x2b'),_0x43e7('0x2c')],_0x2b85a5[_0x43e7('0x2d')])&&_0x2b85a5[_0x43e7('0x2e')]&&!_0x2b85a5[_0x43e7('0x2f')]){_0x50f9f5[_0x2b85a5[_0x43e7('0x2e')]['toLowerCase']()]=_0x2b85a5[_0x43e7('0x30')][_0x43e7('0x21')]();}else if(_[_0x43e7('0x2a')]([_0x43e7('0x2b'),_0x43e7('0x2c')],_0x2b85a5['type'])&&_0x2b85a5[_0x43e7('0x31')]&&_0x2b85a5[_0x43e7('0x2f')]){_0x50f9f5[_0x43e7('0x32')][_0x2b85a5[_0x43e7('0x31')]]=_0x2b85a5['content']['toString']();}else if(_0x2b85a5['type']===_0x43e7('0x33')&&_0x2b85a5[_0x43e7('0x34')]&&_0x2b85a5[_0x43e7('0x31')]&&_0x2b85a5[_0x43e7('0x2f')]){_0x4690a6[_0x2b85a5[_0x43e7('0x34')]]&&(_0x50f9f5[_0x43e7('0x32')][_0x2b85a5['idField']]=_0x4690a6[_0x2b85a5['variableName']]['toString']());}else if(_0x2b85a5['type']==='customVariable'&&_0x2b85a5['Variable']&&_0x2b85a5['Variable'][_0x43e7('0x35')]&&_0x2b85a5['idField']&&_0x2b85a5[_0x43e7('0x2f')]){_0x4690a6[_0x2b85a5[_0x43e7('0x36')][_0x43e7('0x35')][_0x43e7('0x37')]()]&&(_0x50f9f5[_0x43e7('0x32')][_0x2b85a5[_0x43e7('0x31')]]=_0x4690a6[_0x2b85a5[_0x43e7('0x36')]['name']['toLowerCase']()]['toString']());}});}if(_0x50f9f5[_0x43e7('0x38')]){_0x50f9f5[_0x43e7('0x38')]=Number(_0x50f9f5[_0x43e7('0x38')]);}return _0x50f9f5;}function getTicket(_0x16cdba,_0x1b1440,_0x1ed538,_0x1d4589,_0x2ffd43){logger['info'](_0x43e7('0x39'));var _0x2b0ffe=_['merge']({'subject':intUtil[_0x43e7('0x3a')](_0x1d4589['Subjects'],_0x2ffd43,'\x20'),'type':_0x43e7('0x3b'),'status':_0x43e7('0x3c'),'labels':[_0x43e7('0x3d'),_0x43e7('0x3e'),_0x43e7('0x3f')][_0x43e7('0x40')](getTags(_0x1d4589['Tags'],'name')),'description':intUtil[_0x43e7('0x3a')](_0x1d4589[_0x43e7('0x41')],_0x2ffd43,'\x0a'),'_links':{'assigned_user':{'href':util[_0x43e7('0x16')](_0x43e7('0x42'),_0x1b1440['id']),'class':_0x43e7('0x43')}},'message':{'direction':'in','body':intUtil['getString'](_0x1d4589[_0x43e7('0x41')],_0x2ffd43,'\x0a')}},getCustomFields(_0x1d4589[_0x43e7('0x44')],_0x2ffd43));return request({'uri':util['format'](_0x43e7('0x45'),_0x16cdba['remoteUri'],_0x1ed538['id']),'method':_0x43e7('0x27'),'body':_0x2b0ffe});}exports['queue']=function(_0x3d81ae,_0x3b4235,_0x3a5807,_0x1c2c6b,_0x49b866,_0x47d6a1){var _0x103393,_0x40c509;_0x47d6a1[_0x43e7('0x14')]=intUtil[_0x43e7('0x46')](_0x47d6a1['remoteUri']);_0x47d6a1['serverUrl']=intUtil['stripTrailingSlash'](_0x47d6a1[_0x43e7('0x47')]);if(_0x49b866&&_0x49b866['monitor_format']){logger[_0x43e7('0xb')]('[QUEUE]','Recording\x20is\x20enabled!');_0x3b4235[_0x43e7('0x48')]=util['format'](_0x43e7('0x49'),_0x47d6a1[_0x43e7('0x47')],_0x3b4235[_0x43e7('0x4a')],md5(_0x3b4235[_0x43e7('0x4a')]));}else{_0x3b4235['recordingURL']='';}headers[_0x43e7('0x4b')]=getAuth(_0x47d6a1);return getUser(_0x47d6a1,_0x1c2c6b[_0x43e7('0x4c')])[_0x43e7('0xe')](function(_0x1fd277){_0x103393=_0x1fd277;logger[_0x43e7('0xb')](_0x43e7('0x4d'),_0x103393['id']);return getEndUser(_0x47d6a1,_0x3b4235['calleridname'],_0x3b4235['calleridnum']);})[_0x43e7('0xe')](function(_0x36a09e){_0x40c509=_0x36a09e;logger[_0x43e7('0xb')]('The\x20Enduser\x20ID\x20is:',_0x40c509['id']);return getTicket(_0x47d6a1,_0x103393,_0x40c509,_0x3a5807,_0x3b4235);})['then'](function(_0x56489b){if(_0x56489b){logger[_0x43e7('0xb')](_0x43e7('0x4e'));logger['info'](_0x43e7('0x4f'),_0x56489b['id']);switch(_0x47d6a1[_0x43e7('0x2d')]){case _0x43e7('0x50'):logger['info']('[QUEUE]','Displaying\x20ticket\x20to\x20agent...');emit(util['format'](_0x43e7('0x51'),_0x1c2c6b[_0x43e7('0x35')]),'trigger:desk:display',{'recordId':_0x56489b['id']});break;case _0x43e7('0x52'):logger[_0x43e7('0xb')](_0x43e7('0x53'),_0x43e7('0x54'));emit(util['format'](_0x43e7('0x51'),_0x1c2c6b['name']),'trigger:browser:url',{'uri':util[_0x43e7('0x16')](_0x43e7('0x55'),_0x56489b['id'])});break;default:logger[_0x43e7('0x56')](_0x43e7('0x53'),_0x43e7('0x57'));}}})[_0x43e7('0x58')](function(_0x1cd87c){console[_0x43e7('0x56')](_0x1cd87c);logger[_0x43e7('0x56')](_0x43e7('0x53'),JSON['stringify'](_0x1cd87c));});};exports[_0x43e7('0x59')]=function(_0x46c910,_0x499c03,_0x39e3ca,_0x4e6f6d,_0x35b799,_0x520857,_0x34e2ec){var _0x1f561f,_0xfe13fa;_0x520857['remoteUri']=intUtil['stripTrailingSlash'](_0x520857[_0x43e7('0x14')]);_0x520857[_0x43e7('0x47')]=intUtil[_0x43e7('0x46')](_0x520857[_0x43e7('0x47')]);if(_0x34e2ec&&_0x34e2ec[_0x43e7('0x5a')]&&_0x34e2ec[_0x43e7('0x5a')]!==_0x43e7('0x5b')){logger[_0x43e7('0xb')](_0x43e7('0x5c'),_0x43e7('0x5d'));_0x499c03[_0x43e7('0x48')]=util['format'](_0x43e7('0x49'),_0x520857[_0x43e7('0x47')],_0x499c03['uniqueid'],md5(_0x499c03[_0x43e7('0x4a')]));}headers[_0x43e7('0x4b')]=getAuth(_0x520857);return getUser(_0x520857,_0x4e6f6d[_0x43e7('0x4c')])['then'](function(_0x5d63c6){_0x1f561f=_0x5d63c6;logger[_0x43e7('0xb')](_0x43e7('0x4d'),_0x1f561f['id']);return getEndUser(_0x520857,_0x499c03['destcalleridname'],_0x499c03[_0x43e7('0x5e')]);})['then'](function(_0x49a6ce){_0xfe13fa=_0x49a6ce;logger[_0x43e7('0xb')](_0x43e7('0x5f'),_0xfe13fa['id']);return getTicket(_0x520857,_0x1f561f,_0xfe13fa,_0x39e3ca,_0x499c03);})[_0x43e7('0xe')](function(_0x40155c){if(_0x40155c){logger[_0x43e7('0xb')]('Ticket\x20created!');logger[_0x43e7('0xb')](_0x43e7('0x4f'),_0x40155c['id']);switch(_0x520857['type']){case _0x43e7('0x50'):logger[_0x43e7('0xb')](_0x43e7('0x53'),'Displaying\x20ticket\x20to\x20agent...');emit(util['format']('user:%s',_0x4e6f6d[_0x43e7('0x35')]),_0x43e7('0x60'),{'recordId':_0x40155c['id']});break;case _0x43e7('0x52'):logger[_0x43e7('0xb')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x43e7('0x16')](_0x43e7('0x51'),_0x4e6f6d[_0x43e7('0x35')]),_0x43e7('0x61'),{'uri':util['format'](_0x43e7('0x62'),_0x520857[_0x43e7('0x14')],_0x40155c['id'])});break;default:logger[_0x43e7('0x56')](_0x43e7('0x5c'),_0x43e7('0x57'));}}})[_0x43e7('0x58')](function(_0x4665db){logger[_0x43e7('0x56')](_0x43e7('0x5c'),JSON[_0x43e7('0x63')](_0x4665db));});};exports[_0x43e7('0x64')]=function(_0x57fdfe,_0x5f3824,_0x2b0711,_0x58a3a8,_0x501616,_0x50edb2){var _0xb3e981,_0xe666b0;_0x50edb2['remoteUri']=intUtil[_0x43e7('0x46')](_0x50edb2[_0x43e7('0x14')]);_0x50edb2[_0x43e7('0x47')]=intUtil['stripTrailingSlash'](_0x50edb2[_0x43e7('0x47')]);if(_0x501616&&_0x501616[_0x43e7('0x65')]){logger[_0x43e7('0xb')]('['+_0x5f3824[_0x43e7('0x66')][_0x43e7('0x67')]()+']',_0x43e7('0x5d'));_0x5f3824[_0x43e7('0x48')]=util['format'](_0x43e7('0x49'),_0x50edb2[_0x43e7('0x47')],_0x5f3824[_0x43e7('0x4a')],md5(_0x5f3824['uniqueid']));}else{_0x5f3824['recordingURL']='';}headers[_0x43e7('0x4b')]=getAuth(_0x50edb2);return getUser(_0x50edb2)['then'](function(_0x5cb26e){_0xb3e981=_0x5cb26e;logger[_0x43e7('0xb')](_0x43e7('0x4d'),_0xb3e981['id']);return getEndUser(_0x50edb2,_0x5f3824['calleridname'],_0x5f3824[_0x43e7('0x68')]);})[_0x43e7('0xe')](function(_0x1e2fed){_0xe666b0=_0x1e2fed;logger[_0x43e7('0xb')](_0x43e7('0x5f'),_0xe666b0['id']);return getTicket(_0x50edb2,_0xb3e981,_0xe666b0,_0x2b0711,_0x5f3824);})[_0x43e7('0xe')](function(_0x398a78){if(_0x398a78){logger['info'](_0x43e7('0x4e'));logger[_0x43e7('0xb')]('The\x20Ticket\x20ID\x20is:',_0x398a78['id']);}})[_0x43e7('0x58')](function(_0x5c2c5f){logger[_0x43e7('0x56')]('['+_0x5f3824[_0x43e7('0x66')][_0x43e7('0x67')]()+']',JSON[_0x43e7('0x63')](_0x5c2c5f));});}; \ 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 580d10b..c6dcd80 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 _0x9cdb=['enduserId','toLowerCase','destcalleridnum','calleridnum','telephone1','&$filter=','\x20eq\x20\x27','replace','%2b','contactid','nothing','info','forEach','includes','string','type','customField','idField','indexOf','content','incident','incidents','getString','Subjects','/contacts(','Fields','ticketType','callDirection','queue','phonecalls','Descriptions','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','trigger:browser:url','modernAuthentication','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none',']\x20The\x20User\x20email\x20is:','moduleCreate',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','name','Error\x20running\x20Dynamics365\x20integration','request-promise','./util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','defaults','socket.io-emitter','remoteUri','CloudProvider','data7','tenantId','data2','data5','POST','clientId','password','clientSecret','access_token','error','toUpperCase',']\x20Wrong\x20credentials!','message','then','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','validateEmail','email','userEmail','length','systemuserid',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','username','internalemailaddress','userId','catch','outbound','contacts','/systemusers(','body','headers','odata-entityid','substring','lastIndexOf'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0x9cdb,0x105));var _0xb9cd=function(_0x1edfd5,_0x4379a2){_0x1edfd5=_0x1edfd5-0x0;var _0x2cfe40=_0x9cdb[_0x1edfd5];return _0x2cfe40;};'use strict';var _=require('lodash');var rp=require(_0xb9cd('0x0'));var util=require('util');var intUtil=require(_0xb9cd('0x1'));var md5=require(_0xb9cd('0x2'));var Redis=require(_0xb9cd('0x3'));var logger=require(_0xb9cd('0x4'))(_0xb9cd('0x5'));var config=require(_0xb9cd('0x6'));config['redis']=_[_0xb9cd('0x7')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xb9cd('0x8'))(new Redis(config['redis']));function getAuthToken(_0x2baf33,_0x898449,_0x1c7fe0){if(_0x2baf33['modernAuthentication']){_0x2baf33[_0xb9cd('0x9')]=_0x2baf33[_0xb9cd('0xa')][_0xb9cd('0xb')];_0x2baf33[_0xb9cd('0xc')]=_0x2baf33['CloudProvider'][_0xb9cd('0xd')];return Promise['resolve'](_0x2baf33[_0xb9cd('0xa')][_0xb9cd('0xe')]);}var _0x356d40={'method':_0xb9cd('0xf'),'uri':_0x898449,'form':{'client_id':_0x2baf33[_0xb9cd('0x10')],'resource':_0x2baf33['remoteUri'],'username':_0x2baf33['username'],'password':_0x2baf33[_0xb9cd('0x11')],'grant_type':_0xb9cd('0x11'),'client_secret':_0x2baf33[_0xb9cd('0x12')]},'json':!![]};return rp(_0x356d40)['then'](function(_0x4d9b79){return _0x4d9b79[_0xb9cd('0x13')];})['catch'](function(_0xd4756){logger[_0xb9cd('0x14')]('['+[_0x1c7fe0[_0xb9cd('0x15')]()]+_0xb9cd('0x16'));return _0xd4756[_0xb9cd('0x17')];});}function getUser(_0x37b783,_0x87d919,_0x2f42cf,_0x4c1819,_0x2d487c,_0x581c7c){return new Promise(function(_0x32b5b6,_0x5195c9){return getAuthToken(_0x87d919,_0x4c1819,_0x581c7c)[_0xb9cd('0x18')](function(_0x419122){var _0x3b6675={'method':_0xb9cd('0x19'),'uri':_0x2d487c+_0xb9cd('0x1a'),'headers':{'Authorization':_0xb9cd('0x1b')+_0x419122,'OData-Version':_0xb9cd('0x1c')},'json':!![]};return rp(_0x3b6675);})[_0xb9cd('0x18')](function(_0x2baf1f){var _0x2b96aa=_0x2baf1f[_0xb9cd('0x1d')];var _0x5ca431=![];var _0x1bee30=null;if(!_['isNil'](_0x2f42cf)){if(intUtil[_0xb9cd('0x1e')](_0x2f42cf[_0xb9cd('0x1f')])){_0x37b783[_0xb9cd('0x20')]=_0x2f42cf[_0xb9cd('0x1f')];for(_0x1bee30=0x0;_0x1bee30<_0x2b96aa[_0xb9cd('0x21')];_0x1bee30++){if(_0x2b96aa[_0x1bee30]['internalemailaddress']===_0x2f42cf['email']&&!_0x2b96aa[_0x1bee30]['isdisabled']){_0x5ca431=!![];logger['info']('['+[_0x581c7c[_0xb9cd('0x15')]()]+']\x20Agent\x20found\x20'+_0x2b96aa[_0x1bee30][_0xb9cd('0x22')]+'!');_0x37b783['userId']=_0x2b96aa[_0x1bee30]['systemuserid'];}}}}if(!_0x5ca431){logger['info']('['+[_0x581c7c[_0xb9cd('0x15')]()]+_0xb9cd('0x23'));_0x37b783[_0xb9cd('0x20')]=_0x87d919[_0xb9cd('0x24')];for(_0x1bee30=0x0;_0x1bee30<_0x2b96aa[_0xb9cd('0x21')];_0x1bee30++){if(_0x2b96aa[_0x1bee30][_0xb9cd('0x25')]===_0x87d919[_0xb9cd('0x24')]){_0x37b783[_0xb9cd('0x26')]=_0x2b96aa[_0x1bee30][_0xb9cd('0x22')];}}}_0x32b5b6(_0x37b783);})[_0xb9cd('0x27')](function(_0x292129){_0x5195c9(_0x292129['message']);});});}function createEndUser(_0x543ce1,_0x43fff9,_0xa0170f,_0x46764e,_0x73b5be,_0x5014b8,_0x1af6a9){return new Promise(function(_0x2955ef,_0x2c110b){return getAuthToken(_0x43fff9,_0xa0170f,_0x5014b8)['then'](function(_0x56ab75){var _0x36d3de=_0x5014b8['toLowerCase']()===_0xb9cd('0x28')?_0x73b5be['destcalleridnum']:_0x73b5be['calleridnum'];var _0x4c23cb={'method':'POST','uri':_0x46764e+_0xb9cd('0x29'),'body':{'fullname':_0x36d3de,'firstname':_0x36d3de,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0xb9cd('0x2a')+_0x543ce1[_0xb9cd('0x26')]+')'},'headers':{'Authorization':_0xb9cd('0x1b')+_0x56ab75,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};_0x4c23cb[_0xb9cd('0x2b')][_0x1af6a9]=_0x36d3de;return rp(_0x4c23cb);})[_0xb9cd('0x18')](function(_0x10bfa2){var _0x1c12e9=_0x10bfa2[_0xb9cd('0x2c')][_0xb9cd('0x2d')];var _0x45a03a=_0x1c12e9[_0xb9cd('0x2e')](_0x1c12e9[_0xb9cd('0x2f')]('(')+0x1,_0x1c12e9[_0xb9cd('0x2f')](')'));_0x543ce1[_0xb9cd('0x30')]=_0x45a03a;_0x2955ef(_0x543ce1);})['catch'](function(_0x282273){_0x2c110b(_0x282273[_0xb9cd('0x17')]);});});}function getEndUser(_0x50089e,_0x5d6df2,_0x1a6266,_0x4a10b2,_0x1ac37c,_0x5d6844,_0x2f4fbc,_0x11e85a){var _0x14cc8d=_0x5d6844[_0xb9cd('0x31')]()===_0xb9cd('0x28')?_0x1ac37c[_0xb9cd('0x32')]:_0x1ac37c[_0xb9cd('0x33')];return getAuthToken(_0x5d6df2,_0x1a6266,_0x5d6844)[_0xb9cd('0x18')](function(_0x1d0242){_0x11e85a=_0x11e85a?_0x11e85a:_0xb9cd('0x34');var _0x44f1c0={'method':_0xb9cd('0x19'),'uri':_0x4a10b2+'contacts?$select='+_0x11e85a+_0xb9cd('0x35')+_0x11e85a+_0xb9cd('0x36')+_0x14cc8d[_0xb9cd('0x37')]('+',_0xb9cd('0x38'))+'\x27','headers':{'Authorization':'Bearer\x20'+_0x1d0242,'If-None-Match':null,'OData-Version':_0xb9cd('0x1c')},'json':!![]};return rp(_0x44f1c0);})[_0xb9cd('0x18')](function(_0x3360bb){var _0x32c828=![];if(!_0x3360bb)return _0x32c828;var _0x218576=_0x3360bb[_0xb9cd('0x1d')];for(var _0x73c93b=0x0;_0x73c93b<_0x218576[_0xb9cd('0x21')];_0x73c93b++){if(_0x218576[_0x73c93b][_0x11e85a]===_0x14cc8d){_0x32c828=!![];_0x50089e[_0xb9cd('0x30')]=_0x218576[_0x73c93b][_0xb9cd('0x39')];}}return _0x32c828;})[_0xb9cd('0x18')](function(_0x24630a){if(_0x24630a)return _0x50089e;if(_0x2f4fbc===_0xb9cd('0x3a')){logger[_0xb9cd('0x3b')]('['+[_0x5d6844[_0xb9cd('0x15')]()]+']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing');return _0x50089e;}return createEndUser(_0x50089e,_0x5d6df2,_0x1a6266,_0x4a10b2,_0x1ac37c,_0x5d6844,_0x11e85a)['then'](function(_0x243d65){logger[_0xb9cd('0x3b')]('['+[_0x5d6844[_0xb9cd('0x15')]()]+']\x20Enduser\x20created!',_0x243d65[_0xb9cd('0x30')]);return _0x243d65;});});}function getCustomFields(_0x336cf0,_0x38ce89,_0x1c0feb){var _0x12178a={};if(_0x336cf0[_0xb9cd('0x21')]>0x0){_[_0xb9cd('0x3c')](_0x336cf0,function(_0x20f672){if(_[_0xb9cd('0x3d')]([_0xb9cd('0x3e'),'picklist'],_0x20f672[_0xb9cd('0x3f')])&&_0x20f672['nameField']&&!_0x20f672[_0xb9cd('0x40')]){var _0x28085a=_0x20f672[_0xb9cd('0x41')][_0xb9cd('0x31')]();var _0x31162e=_0x28085a[_0xb9cd('0x2e')](0x0,_0x28085a[_0xb9cd('0x42')]('_'));var _0x3c463c=_0x28085a['substring'](_0x28085a[_0xb9cd('0x42')]('_')+0x1);if(_0x31162e===_0x1c0feb){_0x12178a[_0x3c463c]=_0x20f672[_0xb9cd('0x43')];}}});}return _0x12178a;}function getTicket(_0xba2b26,_0x32a7c6,_0x15e57f,_0x836851,_0x346122,_0x50379f,_0x11eed5){return new Promise(function(_0x50c0b3,_0x1a1fbb){var _0x5ecb71;return getAuthToken(_0x32a7c6,_0x15e57f,_0x11eed5)['then'](function(_0x49a101){if(_0x50379f['ticketType']===_0xb9cd('0x44')){_0x5ecb71={'method':_0xb9cd('0xf'),'uri':_0x836851+_0xb9cd('0x45'),'body':Object['assign']({},{'title':intUtil[_0xb9cd('0x46')](_0x50379f[_0xb9cd('0x47')],_0x346122,'\x20'),'description':intUtil['getString'](_0x50379f['Descriptions'],_0x346122,'\x0a'),'customerid_contact@odata.bind':_0xba2b26[_0xb9cd('0x30')]?_0xb9cd('0x48')+_0xba2b26['enduserId']+')':undefined,'ownerid@odata.bind':'/systemusers('+_0xba2b26[_0xb9cd('0x26')]+')','caseorigincode':'1'},getCustomFields(_0x50379f[_0xb9cd('0x49')],_0x346122,_0x50379f['ticketType'])),'headers':{'Authorization':_0xb9cd('0x1b')+_0x49a101,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}if(_0x50379f[_0xb9cd('0x4a')]==='phonecall'){var _0x59fd76=_0xba2b26[_0xb9cd('0x30')]?[{'partyid_systemuser@odata.bind':_0xb9cd('0x2a')+_0xba2b26[_0xb9cd('0x26')]+')','participationtypemask':_0xba2b26[_0xb9cd('0x4b')]===_0xb9cd('0x4c')?0x2:0x1},{'partyid_contact@odata.bind':_0xb9cd('0x48')+_0xba2b26['enduserId']+')','participationtypemask':_0xba2b26['callDirection']===_0xb9cd('0x4c')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0xb9cd('0x2a')+_0xba2b26[_0xb9cd('0x26')]+')','participationtypemask':_0xba2b26[_0xb9cd('0x4b')]===_0xb9cd('0x4c')?0x2:0x1}];_0x5ecb71={'method':_0xb9cd('0xf'),'uri':_0x836851+_0xb9cd('0x4d'),'body':Object['assign']({},{'subject':intUtil[_0xb9cd('0x46')](_0x50379f[_0xb9cd('0x47')],_0x346122,'\x20'),'phonenumber':String(_0x346122['calleridnum']),'description':intUtil[_0xb9cd('0x46')](_0x50379f[_0xb9cd('0x4e')],_0x346122,'\x0a'),'regardingobjectid_contact@odata.bind':_0xba2b26[_0xb9cd('0x30')]?'/contacts('+_0xba2b26[_0xb9cd('0x30')]+')':undefined,'ownerid@odata.bind':_0xb9cd('0x2a')+_0xba2b26['userId']+')','directioncode':_0xba2b26[_0xb9cd('0x4b')]===_0xb9cd('0x4c')?![]:!![],'phonecall_activity_parties':_0x59fd76},getCustomFields(_0x50379f[_0xb9cd('0x49')],_0x346122,_0x50379f['ticketType'])),'headers':{'Authorization':'Bearer\x20'+_0x49a101,'OData-Version':_0xb9cd('0x1c')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x5ecb71);})[_0xb9cd('0x18')](function(_0x13000c){var _0x15680f=_0x13000c[_0xb9cd('0x2c')][_0xb9cd('0x2d')];var _0x1a777b=_0x15680f[_0xb9cd('0x2e')](_0x15680f[_0xb9cd('0x2f')]('(')+0x1,_0x15680f[_0xb9cd('0x2f')](')'));_0xba2b26[_0xb9cd('0x4f')]=_0x1a777b;_0x50c0b3(_0xba2b26);})['catch'](function(_0x5c4c2c){_0x1a1fbb(_0x5c4c2c['message']);});});}function emit(_0x5e54ec,_0x4fd5e4,_0x1265af,_0x27e9e8){var _0x12760d={'uri':util[_0xb9cd('0x50')](_0xb9cd('0x51'),_0x5e54ec,_0x1265af,_0x27e9e8)};io['to'](util[_0xb9cd('0x50')]('user:%s',_0x4fd5e4))['emit'](_0xb9cd('0x52'),_0x12760d);}exports['cs']=function(_0x2b325b,_0x36e90a,_0x50a438,_0x229797,_0x576a3c,_0x5577ff,_0x255487,_0x2b9adf){var _0x4c6882={};_0x5577ff[_0xb9cd('0x9')]=_0x5577ff[_0xb9cd('0x53')]?intUtil[_0xb9cd('0x54')](_0x5577ff[_0xb9cd('0xa')][_0xb9cd('0xb')]):intUtil['stripTrailingSlash'](_0x5577ff[_0xb9cd('0x9')]);_0x5577ff[_0xb9cd('0x55')]=intUtil[_0xb9cd('0x54')](_0x5577ff['serverUrl']);_0x4c6882[_0xb9cd('0x4b')]=_0x2b9adf===_0xb9cd('0x4c')||_0x2b9adf===_0xb9cd('0x56')?_0xb9cd('0x4c'):_0xb9cd('0x28');var _0x4e2a99=_0x5577ff[_0xb9cd('0x53')]?util[_0xb9cd('0x50')](_0xb9cd('0x57'),_0x5577ff['CloudProvider'][_0xb9cd('0xb')]):util['format'](_0xb9cd('0x57'),_0x5577ff[_0xb9cd('0x9')]);var _0x4fc071=util['format'](_0xb9cd('0x58'),_0x5577ff[_0xb9cd('0xc')]);var _0x1c9e2d=util[_0xb9cd('0x50')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5577ff[_0xb9cd('0x55')],_0x36e90a[_0xb9cd('0x59')],md5(_0x36e90a['uniqueid']));if(_0x576a3c&&_0x576a3c['monitor_format']){logger[_0xb9cd('0x3b')](_0xb9cd('0x5a'),_0xb9cd('0x5b'));_0x36e90a[_0xb9cd('0x5c')]=_0x1c9e2d;}else if(_0x255487&&_0x255487[_0xb9cd('0x5d')]&&_0x255487['recordingFormat']!==_0xb9cd('0x5e')){logger[_0xb9cd('0x3b')]('[OUTBOUND]',_0xb9cd('0x5b'));_0x36e90a[_0xb9cd('0x5c')]=_0x1c9e2d;}else{_0x36e90a[_0xb9cd('0x5c')]='';}return getUser(_0x4c6882,_0x5577ff,_0x229797,_0x4fc071,_0x4e2a99,_0x2b9adf)[_0xb9cd('0x18')](function(_0x24ce4a){logger[_0xb9cd('0x3b')]('['+_0x2b9adf['toUpperCase']()+']\x20The\x20User\x20ID\x20is:',_0x24ce4a[_0xb9cd('0x26')]);logger[_0xb9cd('0x3b')]('['+_0x2b9adf['toUpperCase']()+_0xb9cd('0x5f'),_0x24ce4a[_0xb9cd('0x20')]);return getEndUser(_0x24ce4a,_0x5577ff,_0x4fc071,_0x4e2a99,_0x36e90a,_0x2b9adf,_0x50a438[_0xb9cd('0x60')],_0x50a438['additionalSearchContact']);})[_0xb9cd('0x18')](function(_0x53af50){logger['info']('['+_0x2b9adf[_0xb9cd('0x15')]()+']\x20The\x20Enduser\x20ID\x20is:',_0x53af50[_0xb9cd('0x30')]);logger[_0xb9cd('0x3b')]('['+_0x2b9adf['toUpperCase']()+_0xb9cd('0x61'),_0x36e90a['calleridnum']);return getTicket(_0x53af50,_0x5577ff,_0x4fc071,_0x4e2a99,_0x36e90a,_0x50a438,_0x2b9adf);})[_0xb9cd('0x18')](function(_0x5a1302){logger[_0xb9cd('0x3b')](util[_0xb9cd('0x50')]('['+_0x2b9adf[_0xb9cd('0x15')]()+_0xb9cd('0x62'),_0x50a438[_0xb9cd('0x4a')],_0x5a1302[_0xb9cd('0x4f')]));logger['info'](util['format']('['+_0x2b9adf[_0xb9cd('0x15')]()+_0xb9cd('0x63'),_0x2b9adf));if(_0x2b9adf!=='unmanaged'&&_0x50a438['openNewTab']){logger[_0xb9cd('0x3b')]('['+_0x2b9adf[_0xb9cd('0x15')]()+']',_0xb9cd('0x64'));emit(_0x5577ff[_0xb9cd('0x9')],_0x229797[_0xb9cd('0x65')],_0x50a438['ticketType'],_0x5a1302[_0xb9cd('0x4f')]);}})['catch'](function(_0x4adaea){logger[_0xb9cd('0x14')]('['+_0x2b9adf[_0xb9cd('0x15')]()+']\x20Error\x20running\x20Dynamics365\x20integration',_0x4adaea[_0xb9cd('0x17')]);console[_0xb9cd('0x14')](_0xb9cd('0x66'),_0x4adaea);});}; \ No newline at end of file +var _0x67b5=['util','md5','dynamics365','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','modernAuthentication','remoteUri','data7','tenantId','data2','resolve','CloudProvider','data5','POST','clientId','username','password','clientSecret','catch','error','toUpperCase',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','then','value','isNil','email','length','internalemailaddress','isdisabled','info',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userEmail','outbound','destcalleridnum','calleridnum','contacts','headers','substring','lastIndexOf','enduserId','toLowerCase','telephone1','&$filter=','\x20eq\x20\x27','replace','%2b','contactid','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','forEach','includes','string','picklist','customField','idField','indexOf','content','assign','getString','Subjects','/contacts(','/systemusers(','Fields','ticketType','queue','callDirection','Descriptions','odata-entityid','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none',']\x20The\x20Enduser\x20ID\x20is:',']\x20Call\x20direction:\x20%s','openNewTab',']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','lodash'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x67b5,0x197));var _0x567b=function(_0x53b071,_0x1e4fcf){_0x53b071=_0x53b071-0x0;var _0xf1c6c1=_0x67b5[_0x53b071];return _0xf1c6c1;};'use strict';var _=require(_0x567b('0x0'));var rp=require('request-promise');var util=require(_0x567b('0x1'));var intUtil=require('./util');var md5=require(_0x567b('0x2'));var Redis=require('ioredis');var logger=require('../../../../config/logger')(_0x567b('0x3'));var config=require(_0x567b('0x4'));config[_0x567b('0x5')]=_[_0x567b('0x6')](config[_0x567b('0x5')],{'host':_0x567b('0x7'),'port':0x18eb});var io=require(_0x567b('0x8'))(new Redis(config[_0x567b('0x5')]));function getAuthToken(_0x447cb5,_0x85b574,_0x2683aa){if(_0x447cb5[_0x567b('0x9')]){_0x447cb5[_0x567b('0xa')]=_0x447cb5['CloudProvider'][_0x567b('0xb')];_0x447cb5[_0x567b('0xc')]=_0x447cb5['CloudProvider'][_0x567b('0xd')];return Promise[_0x567b('0xe')](_0x447cb5[_0x567b('0xf')][_0x567b('0x10')]);}var _0x1b9509={'method':_0x567b('0x11'),'uri':_0x85b574,'form':{'client_id':_0x447cb5[_0x567b('0x12')],'resource':_0x447cb5['remoteUri'],'username':_0x447cb5[_0x567b('0x13')],'password':_0x447cb5[_0x567b('0x14')],'grant_type':_0x567b('0x14'),'client_secret':_0x447cb5[_0x567b('0x15')]},'json':!![]};return rp(_0x1b9509)['then'](function(_0x498176){return _0x498176['access_token'];})[_0x567b('0x16')](function(_0x5c24c2){logger[_0x567b('0x17')]('['+[_0x2683aa[_0x567b('0x18')]()]+_0x567b('0x19'));return _0x5c24c2[_0x567b('0x1a')];});}function getUser(_0x48e2fc,_0x5edaa1,_0x57fa28,_0x304e74,_0x1bd59a,_0x5b3f69){return new Promise(function(_0xd0938e,_0x1a78ad){return getAuthToken(_0x5edaa1,_0x304e74,_0x5b3f69)['then'](function(_0x417a2c){var _0x194df5={'method':_0x567b('0x1b'),'uri':_0x1bd59a+_0x567b('0x1c'),'headers':{'Authorization':_0x567b('0x1d')+_0x417a2c,'OData-Version':_0x567b('0x1e')},'json':!![]};return rp(_0x194df5);})[_0x567b('0x1f')](function(_0x255d3f){var _0x5e7c3b=_0x255d3f[_0x567b('0x20')];var _0x158682=![];var _0x34e231=null;if(!_[_0x567b('0x21')](_0x57fa28)){if(intUtil['validateEmail'](_0x57fa28[_0x567b('0x22')])){_0x48e2fc['userEmail']=_0x57fa28['email'];for(_0x34e231=0x0;_0x34e231<_0x5e7c3b[_0x567b('0x23')];_0x34e231++){if(_0x5e7c3b[_0x34e231][_0x567b('0x24')]===_0x57fa28[_0x567b('0x22')]&&!_0x5e7c3b[_0x34e231][_0x567b('0x25')]){_0x158682=!![];logger[_0x567b('0x26')]('['+[_0x5b3f69['toUpperCase']()]+_0x567b('0x27')+_0x5e7c3b[_0x34e231][_0x567b('0x28')]+'!');_0x48e2fc[_0x567b('0x29')]=_0x5e7c3b[_0x34e231][_0x567b('0x28')];}}}}if(!_0x158682){logger[_0x567b('0x26')]('['+[_0x5b3f69['toUpperCase']()]+_0x567b('0x2a'));_0x48e2fc[_0x567b('0x2b')]=_0x5edaa1['username'];for(_0x34e231=0x0;_0x34e231<_0x5e7c3b[_0x567b('0x23')];_0x34e231++){if(_0x5e7c3b[_0x34e231][_0x567b('0x24')]===_0x5edaa1[_0x567b('0x13')]){_0x48e2fc[_0x567b('0x29')]=_0x5e7c3b[_0x34e231][_0x567b('0x28')];}}}_0xd0938e(_0x48e2fc);})[_0x567b('0x16')](function(_0x186fd5){_0x1a78ad(_0x186fd5['message']);});});}function createEndUser(_0x6fe46f,_0x357631,_0x384014,_0x3dcd29,_0x2df0b3,_0x18b5e3,_0x1578da){return new Promise(function(_0x75b0e5,_0xf5e84d){return getAuthToken(_0x357631,_0x384014,_0x18b5e3)[_0x567b('0x1f')](function(_0x8a60bb){var _0x4cda7f=_0x18b5e3['toLowerCase']()===_0x567b('0x2c')?_0x2df0b3[_0x567b('0x2d')]:_0x2df0b3[_0x567b('0x2e')];var _0x368c64={'method':'POST','uri':_0x3dcd29+_0x567b('0x2f'),'body':{'fullname':_0x4cda7f,'firstname':_0x4cda7f,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x6fe46f[_0x567b('0x29')]+')'},'headers':{'Authorization':'Bearer\x20'+_0x8a60bb,'OData-Version':_0x567b('0x1e')},'json':!![],'resolveWithFullResponse':!![]};_0x368c64['body'][_0x1578da]=_0x4cda7f;return rp(_0x368c64);})[_0x567b('0x1f')](function(_0x3af2c0){var _0x3f89be=_0x3af2c0[_0x567b('0x30')]['odata-entityid'];var _0x279efa=_0x3f89be[_0x567b('0x31')](_0x3f89be[_0x567b('0x32')]('(')+0x1,_0x3f89be['lastIndexOf'](')'));_0x6fe46f[_0x567b('0x33')]=_0x279efa;_0x75b0e5(_0x6fe46f);})[_0x567b('0x16')](function(_0x178e58){_0xf5e84d(_0x178e58[_0x567b('0x1a')]);});});}function getEndUser(_0x37d651,_0x359243,_0x455b22,_0xa098b1,_0x575851,_0x4b1205,_0x4bdb36,_0x265bd8){var _0x3f3d1d=_0x4b1205[_0x567b('0x34')]()===_0x567b('0x2c')?_0x575851[_0x567b('0x2d')]:_0x575851[_0x567b('0x2e')];return getAuthToken(_0x359243,_0x455b22,_0x4b1205)['then'](function(_0x346727){_0x265bd8=_0x265bd8?_0x265bd8:_0x567b('0x35');var _0x35c979={'method':'GET','uri':_0xa098b1+'contacts?$select='+_0x265bd8+_0x567b('0x36')+_0x265bd8+_0x567b('0x37')+_0x3f3d1d[_0x567b('0x38')]('+',_0x567b('0x39'))+'\x27','headers':{'Authorization':'Bearer\x20'+_0x346727,'If-None-Match':null,'OData-Version':_0x567b('0x1e')},'json':!![]};return rp(_0x35c979);})[_0x567b('0x1f')](function(_0x25345b){var _0xbc92f9=![];if(!_0x25345b)return _0xbc92f9;var _0x4a3075=_0x25345b[_0x567b('0x20')];for(var _0x4aa1db=0x0;_0x4aa1db<_0x4a3075['length'];_0x4aa1db++){if(_0x4a3075[_0x4aa1db][_0x265bd8]===_0x3f3d1d){_0xbc92f9=!![];_0x37d651[_0x567b('0x33')]=_0x4a3075[_0x4aa1db][_0x567b('0x3a')];}}return _0xbc92f9;})[_0x567b('0x1f')](function(_0x5fa1e1){if(_0x5fa1e1)return _0x37d651;if(_0x4bdb36===_0x567b('0x3b')){logger[_0x567b('0x26')]('['+[_0x4b1205[_0x567b('0x18')]()]+_0x567b('0x3c'));return _0x37d651;}return createEndUser(_0x37d651,_0x359243,_0x455b22,_0xa098b1,_0x575851,_0x4b1205,_0x265bd8)[_0x567b('0x1f')](function(_0x4df12e){logger[_0x567b('0x26')]('['+[_0x4b1205[_0x567b('0x18')]()]+_0x567b('0x3d'),_0x4df12e['enduserId']);return _0x4df12e;});});}function getCustomFields(_0x4e20f4,_0x100624,_0x7f896d){var _0x5c88cf={};if(_0x4e20f4[_0x567b('0x23')]>0x0){_[_0x567b('0x3e')](_0x4e20f4,function(_0x31c593){if(_[_0x567b('0x3f')]([_0x567b('0x40'),_0x567b('0x41')],_0x31c593['type'])&&_0x31c593['nameField']&&!_0x31c593[_0x567b('0x42')]){var _0x3c42af=_0x31c593[_0x567b('0x43')][_0x567b('0x34')]();var _0x1b6c00=_0x3c42af['substring'](0x0,_0x3c42af[_0x567b('0x44')]('_'));var _0x39e156=_0x3c42af[_0x567b('0x31')](_0x3c42af[_0x567b('0x44')]('_')+0x1);if(_0x1b6c00===_0x7f896d){_0x5c88cf[_0x39e156]=_0x31c593[_0x567b('0x45')];}}});}return _0x5c88cf;}function getTicket(_0x553a4f,_0x2ea047,_0x196bfa,_0x3d78b2,_0x4ac635,_0x4d9d7c,_0x5f28cf){return new Promise(function(_0x6dd55f,_0x1cba59){var _0x28114a;return getAuthToken(_0x2ea047,_0x196bfa,_0x5f28cf)[_0x567b('0x1f')](function(_0x5c39bf){if(_0x4d9d7c['ticketType']==='incident'){_0x28114a={'method':_0x567b('0x11'),'uri':_0x3d78b2+'incidents','body':Object[_0x567b('0x46')]({},{'title':intUtil[_0x567b('0x47')](_0x4d9d7c[_0x567b('0x48')],_0x4ac635,'\x20'),'description':intUtil['getString'](_0x4d9d7c['Descriptions'],_0x4ac635,'\x0a'),'customerid_contact@odata.bind':_0x553a4f[_0x567b('0x33')]?_0x567b('0x49')+_0x553a4f[_0x567b('0x33')]+')':undefined,'ownerid@odata.bind':_0x567b('0x4a')+_0x553a4f[_0x567b('0x29')]+')','caseorigincode':'1'},getCustomFields(_0x4d9d7c[_0x567b('0x4b')],_0x4ac635,_0x4d9d7c[_0x567b('0x4c')])),'headers':{'Authorization':'Bearer\x20'+_0x5c39bf,'OData-Version':_0x567b('0x1e')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x4d9d7c[_0x567b('0x4c')]==='phonecall'){var _0x25ff69=_0x553a4f['enduserId']?[{'partyid_systemuser@odata.bind':'/systemusers('+_0x553a4f['userId']+')','participationtypemask':_0x553a4f['callDirection']===_0x567b('0x4d')?0x2:0x1},{'partyid_contact@odata.bind':_0x567b('0x49')+_0x553a4f[_0x567b('0x33')]+')','participationtypemask':_0x553a4f[_0x567b('0x4e')]===_0x567b('0x4d')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x567b('0x4a')+_0x553a4f[_0x567b('0x29')]+')','participationtypemask':_0x553a4f[_0x567b('0x4e')]===_0x567b('0x4d')?0x2:0x1}];_0x28114a={'method':_0x567b('0x11'),'uri':_0x3d78b2+'phonecalls','body':Object[_0x567b('0x46')]({},{'subject':intUtil['getString'](_0x4d9d7c[_0x567b('0x48')],_0x4ac635,'\x20'),'phonenumber':String(_0x4ac635['calleridnum']),'description':intUtil[_0x567b('0x47')](_0x4d9d7c[_0x567b('0x4f')],_0x4ac635,'\x0a'),'regardingobjectid_contact@odata.bind':_0x553a4f[_0x567b('0x33')]?_0x567b('0x49')+_0x553a4f[_0x567b('0x33')]+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x553a4f[_0x567b('0x29')]+')','directioncode':_0x553a4f[_0x567b('0x4e')]==='queue'?![]:!![],'phonecall_activity_parties':_0x25ff69},getCustomFields(_0x4d9d7c[_0x567b('0x4b')],_0x4ac635,_0x4d9d7c[_0x567b('0x4c')])),'headers':{'Authorization':'Bearer\x20'+_0x5c39bf,'OData-Version':_0x567b('0x1e')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x28114a);})[_0x567b('0x1f')](function(_0x21d450){var _0x22335b=_0x21d450[_0x567b('0x30')][_0x567b('0x50')];var _0x2ce77d=_0x22335b[_0x567b('0x31')](_0x22335b[_0x567b('0x32')]('(')+0x1,_0x22335b[_0x567b('0x32')](')'));_0x553a4f[_0x567b('0x51')]=_0x2ce77d;_0x6dd55f(_0x553a4f);})[_0x567b('0x16')](function(_0x290130){_0x1cba59(_0x290130[_0x567b('0x1a')]);});});}function emit(_0x34cf4e,_0x2113f3,_0x30a2d3,_0x51e3df){var _0x62066d={'uri':util[_0x567b('0x52')](_0x567b('0x53'),_0x34cf4e,_0x30a2d3,_0x51e3df)};io['to'](util[_0x567b('0x52')](_0x567b('0x54'),_0x2113f3))[_0x567b('0x55')]('trigger:browser:url',_0x62066d);}exports['cs']=function(_0x4aecfe,_0x3abf2b,_0x1862f0,_0x37c4c6,_0x546724,_0x1cda03,_0x2a47b2,_0x1b0233){var _0x10b72d={};_0x1cda03['remoteUri']=_0x1cda03[_0x567b('0x9')]?intUtil['stripTrailingSlash'](_0x1cda03[_0x567b('0xf')][_0x567b('0xb')]):intUtil[_0x567b('0x56')](_0x1cda03[_0x567b('0xa')]);_0x1cda03[_0x567b('0x57')]=intUtil['stripTrailingSlash'](_0x1cda03[_0x567b('0x57')]);_0x10b72d[_0x567b('0x4e')]=_0x1b0233===_0x567b('0x4d')||_0x1b0233===_0x567b('0x58')?_0x567b('0x4d'):_0x567b('0x2c');var _0x40bee3=_0x1cda03[_0x567b('0x9')]?util[_0x567b('0x52')](_0x567b('0x59'),_0x1cda03[_0x567b('0xf')]['data7']):util['format'](_0x567b('0x59'),_0x1cda03[_0x567b('0xa')]);var _0x5c9d2b=util[_0x567b('0x52')](_0x567b('0x5a'),_0x1cda03[_0x567b('0xc')]);var _0x555d28=util[_0x567b('0x52')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1cda03[_0x567b('0x57')],_0x3abf2b[_0x567b('0x5b')],md5(_0x3abf2b[_0x567b('0x5b')]));if(_0x546724&&_0x546724[_0x567b('0x5c')]){logger[_0x567b('0x26')]('[QUEUE]',_0x567b('0x5d'));_0x3abf2b[_0x567b('0x5e')]=_0x555d28;}else if(_0x2a47b2&&_0x2a47b2[_0x567b('0x5f')]&&_0x2a47b2[_0x567b('0x5f')]!==_0x567b('0x60')){logger['info']('[OUTBOUND]','Recording\x20is\x20enabled!');_0x3abf2b[_0x567b('0x5e')]=_0x555d28;}else{_0x3abf2b['recordingURL']='';}return getUser(_0x10b72d,_0x1cda03,_0x37c4c6,_0x5c9d2b,_0x40bee3,_0x1b0233)['then'](function(_0x2d561c){logger[_0x567b('0x26')]('['+_0x1b0233[_0x567b('0x18')]()+']\x20The\x20User\x20ID\x20is:',_0x2d561c[_0x567b('0x29')]);logger[_0x567b('0x26')]('['+_0x1b0233[_0x567b('0x18')]()+']\x20The\x20User\x20email\x20is:',_0x2d561c[_0x567b('0x2b')]);return getEndUser(_0x2d561c,_0x1cda03,_0x5c9d2b,_0x40bee3,_0x3abf2b,_0x1b0233,_0x1862f0['moduleCreate'],_0x1862f0['additionalSearchContact']);})[_0x567b('0x1f')](function(_0x19e892){logger['info']('['+_0x1b0233[_0x567b('0x18')]()+_0x567b('0x61'),_0x19e892[_0x567b('0x33')]);logger['info']('['+_0x1b0233['toUpperCase']()+']\x20The\x20Enduser\x20phone\x20is:',_0x3abf2b[_0x567b('0x2e')]);return getTicket(_0x19e892,_0x1cda03,_0x5c9d2b,_0x40bee3,_0x3abf2b,_0x1862f0,_0x1b0233);})['then'](function(_0x10bdbf){logger[_0x567b('0x26')](util['format']('['+_0x1b0233[_0x567b('0x18')]()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x1862f0['ticketType'],_0x10bdbf[_0x567b('0x51')]));logger[_0x567b('0x26')](util['format']('['+_0x1b0233[_0x567b('0x18')]()+_0x567b('0x62'),_0x1b0233));if(_0x1b0233!==_0x567b('0x58')&&_0x1862f0[_0x567b('0x63')]){logger[_0x567b('0x26')]('['+_0x1b0233['toUpperCase']()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x1cda03[_0x567b('0xa')],_0x37c4c6['name'],_0x1862f0[_0x567b('0x4c')],_0x10bdbf['ticketId']);}})[_0x567b('0x16')](function(_0x38f1a2){logger['error']('['+_0x1b0233[_0x567b('0x18')]()+_0x567b('0x64'),_0x38f1a2['message']);console['error'](_0x567b('0x65'),_0x38f1a2);});}; \ 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 f73df2e..27f04a2 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 _0x259a=['getString','Descriptions','
','Tags','name','Fields','custom_fields','mapValues','keyBy','value','remoteUri','POST','then','validateEmail','%s/api/v2/agents','Agent\x20found!','find','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','apiKey','toString','base64','[HTTP]','stringify','GET','length','map','includes','string','type','nameField','customField','toLowerCase','idField','push','content','variable','variableName','Variable','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','outbound','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','error','unmanaged','toUpperCase','lastevent','lodash','request-promise','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','application/json','info','merge','format','Caller\x20-\x20%s','calleridname','calleridnum'];(function(_0x3dbfe1,_0x5e2275){var _0x537fb4=function(_0x1d07ff){while(--_0x1d07ff){_0x3dbfe1['push'](_0x3dbfe1['shift']());}};_0x537fb4(++_0x5e2275);}(_0x259a,0xa8));var _0xa259=function(_0x49fcfc,_0x104175){_0x49fcfc=_0x49fcfc-0x0;var _0x4ab162=_0x259a[_0x49fcfc];return _0x4ab162;};'use strict';var _=require(_0xa259('0x0'));var rp=require(_0xa259('0x1'));var md5=require('md5');var util=require('util');var Redis=require(_0xa259('0x2'));var intUtil=require(_0xa259('0x3'));var config=require(_0xa259('0x4'));var logger=require(_0xa259('0x5'))('freshdesk');config[_0xa259('0x6')]=_[_0xa259('0x7')](config[_0xa259('0x6')],{'host':_0xa259('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var headers={'Content-Type':_0xa259('0x9'),'Accept':_0xa259('0x9')};function emit(_0x58b38b,_0x2c54a9,_0x17f506){io['to'](_0x58b38b)['emit'](_0x2c54a9,_0x17f506);}function getTicket(_0x551484,_0x245154,_0x5b5d18,_0x325df6,_0xc85157){logger[_0xa259('0xa')]('Creating\x20new\x20ticket...');var _0xbefe2a=_[_0xa259('0xb')]({'responder_id':_0x245154['id'],'requester_id':_0x5b5d18['id'],'name':util[_0xa259('0xc')](_0xa259('0xd'),_0xc85157[_0xa259('0xe')]),'phone':_0xc85157[_0xa259('0xf')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x325df6['Subjects'],_0xc85157,'\x20'),'description':intUtil[_0xa259('0x10')](_0x325df6[_0xa259('0x11')],_0xc85157,_0xa259('0x12')),'tags':getTags(_0x325df6[_0xa259('0x13')],_0xa259('0x14'))},getCustomFields(_0x325df6[_0xa259('0x15')],_0xc85157));_0xbefe2a[_0xa259('0x16')]=_[_0xa259('0x17')](_[_0xa259('0x18')](_0xbefe2a[_0xa259('0x16')],'id'),_0xa259('0x19'));return request({'uri':util[_0xa259('0xc')]('%s/api/v2/tickets',_0x551484[_0xa259('0x1a')]),'method':_0xa259('0x1b'),'body':_0xbefe2a})[_0xa259('0x1c')](function(_0x497057){logger[_0xa259('0xa')]('Ticket\x20created!');return _0x497057;});}function getUser(_0x21d0e3,_0x494d1d){if(intUtil[_0xa259('0x1d')](_0x494d1d)){return request({'uri':util[_0xa259('0xc')](_0xa259('0x1e'),_0x21d0e3['remoteUri']),'qs':{'email':_0x494d1d}})[_0xa259('0x1c')](function(_0x4ffd48){if(_0x4ffd48['length']){logger['info'](_0xa259('0x1f'));return _[_0xa259('0x20')](_0x4ffd48,function(_0xa25c1d){return _0xa25c1d['contact'][_0xa259('0x21')]===_0x494d1d;});}else{logger[_0xa259('0xa')](_0xa259('0x22'));return request({'uri':util[_0xa259('0xc')](_0xa259('0x23'),_0x21d0e3['remoteUri'])})[_0xa259('0x1c')](function(_0x59ab19){logger[_0xa259('0xa')](_0xa259('0x24'));return _0x59ab19;});}});}else{logger[_0xa259('0xa')](_0xa259('0x25'));return request({'uri':util[_0xa259('0xc')](_0xa259('0x23'),_0x21d0e3['remoteUri'])})['then'](function(_0x1e1bab){logger[_0xa259('0xa')](_0xa259('0x24'));return _0x1e1bab;});}}function getEndUser(_0x13223f,_0x146ea9,_0x502f28){logger['info'](_0xa259('0x26'),_0x502f28);return request({'uri':util['format'](_0xa259('0x27'),_0x13223f['remoteUri']),'qs':{'phone':_0x502f28}})[_0xa259('0x1c')](function(_0x4cf002){if(_0x4cf002['length']){logger[_0xa259('0xa')](_0xa259('0x28'));return _[_0xa259('0x20')](_0x4cf002,{'phone':_0x502f28});}else{logger[_0xa259('0xa')](_0xa259('0x29'));return request({'uri':util[_0xa259('0xc')](_0xa259('0x27'),_0x13223f[_0xa259('0x1a')]),'method':_0xa259('0x1b'),'body':{'name':_0x146ea9,'phone':_0x502f28}})[_0xa259('0x1c')](function(_0x3fc6cc){logger[_0xa259('0xa')](_0xa259('0x2a'));return _0x3fc6cc;});}});}function getAuth(_0x1aee29){return util[_0xa259('0xc')](_0xa259('0x2b'),new Buffer(_0x1aee29[_0xa259('0x2c')]+':X')[_0xa259('0x2d')](_0xa259('0x2e')));}function request(_0x3707af){logger['debug'](_0xa259('0x2f'),JSON[_0xa259('0x30')](_0x3707af));return rp(_[_0xa259('0x7')](_0x3707af,{'method':_0xa259('0x31'),'headers':headers,'json':!![]}));}function getTags(_0x409119,_0x21179d){var _0x40f5dd=[];if(_0x409119&&_0x409119[_0xa259('0x32')]>0x0){_0x40f5dd=_[_0xa259('0x33')](_0x409119,_0x21179d);}return _0x40f5dd;}function getCustomFields(_0x51fc30,_0x313558){var _0x236652=[];var _0x14f1dd={'custom_fields':[]};if(_0x51fc30[_0xa259('0x32')]>0x0){_['forEach'](_0x51fc30,function(_0xb0b717){if(_[_0xa259('0x34')]([_0xa259('0x35'),'picklist'],_0xb0b717[_0xa259('0x36')])&&_0xb0b717[_0xa259('0x37')]&&!_0xb0b717[_0xa259('0x38')]){_0x14f1dd[_0xb0b717[_0xa259('0x37')][_0xa259('0x39')]()]=_0xb0b717['content'][_0xa259('0x2d')]();}else if(_['includes']([_0xa259('0x35'),'picklist'],_0xb0b717[_0xa259('0x36')])&&_0xb0b717[_0xa259('0x3a')]&&_0xb0b717[_0xa259('0x38')]){_0x14f1dd['custom_fields'][_0xa259('0x3b')]({'id':_0xb0b717['idField'],'value':_0xb0b717[_0xa259('0x3c')][_0xa259('0x2d')]()});}else if(_0xb0b717[_0xa259('0x36')]===_0xa259('0x3d')&&_0xb0b717[_0xa259('0x3e')]&&_0xb0b717[_0xa259('0x3a')]&&_0xb0b717[_0xa259('0x38')]){_0x313558[_0xb0b717[_0xa259('0x3e')]]&&_0x14f1dd[_0xa259('0x16')][_0xa259('0x3b')]({'id':_0xb0b717[_0xa259('0x3a')],'value':_0x313558[_0xb0b717['variableName']][_0xa259('0x2d')]()});}else if(_0xb0b717[_0xa259('0x36')]==='customVariable'&&_0xb0b717['Variable']&&_0xb0b717[_0xa259('0x3f')][_0xa259('0x14')]&&_0xb0b717[_0xa259('0x3a')]&&_0xb0b717['customField']){_0x313558[_0xb0b717[_0xa259('0x3f')][_0xa259('0x14')][_0xa259('0x39')]()]&&_0x14f1dd['custom_fields'][_0xa259('0x3b')]({'id':_0xb0b717['idField'],'value':_0x313558[_0xb0b717[_0xa259('0x3f')][_0xa259('0x14')][_0xa259('0x39')]()][_0xa259('0x2d')]()});}});}return _0x14f1dd;}exports['queue']=function(_0x25d17a,_0x4790c5,_0x5cc7a2,_0x275bce,_0x349e14,_0x198eec){var _0xb8ece,_0x35fb2b;_0x198eec[_0xa259('0x1a')]=intUtil[_0xa259('0x40')](_0x198eec[_0xa259('0x1a')]);_0x198eec[_0xa259('0x41')]=intUtil[_0xa259('0x40')](_0x198eec['serverUrl']);if(_0x349e14&&_0x349e14[_0xa259('0x42')]){logger['info'](_0xa259('0x43'),_0xa259('0x44'));_0x4790c5[_0xa259('0x45')]=util[_0xa259('0xc')](_0xa259('0x46'),_0x198eec['serverUrl'],_0x4790c5[_0xa259('0x47')],md5(_0x4790c5['uniqueid']));}else{_0x4790c5['recordingURL']='';}headers[_0xa259('0x48')]=getAuth(_0x198eec);return getUser(_0x198eec,_0x275bce[_0xa259('0x21')])[_0xa259('0x1c')](function(_0x56dc3b){_0xb8ece=_0x56dc3b;logger[_0xa259('0xa')]('The\x20User\x20ID\x20is:',_0xb8ece['id']);return getEndUser(_0x198eec,_0x4790c5[_0xa259('0xe')],_0x4790c5[_0xa259('0xf')]);})['then'](function(_0x345f85){_0x35fb2b=_0x345f85;logger[_0xa259('0xa')](_0xa259('0x49'),_0x35fb2b['id']);return getTicket(_0x198eec,_0xb8ece,_0x35fb2b,_0x5cc7a2,_0x4790c5);})[_0xa259('0x1c')](function(_0x1cd19a){if(_0x1cd19a&&_0x1cd19a['id']){logger['info']('Ticket\x20created!');logger[_0xa259('0xa')]('The\x20Ticket\x20ID\x20is:',_0x1cd19a['id']);logger['info'](_0xa259('0x43'),_0xa259('0x4a'));emit(util['format'](_0xa259('0x4b'),_0x275bce[_0xa259('0x14')]),_0xa259('0x4c'),{'uri':util[_0xa259('0xc')](_0xa259('0x4d'),_0x198eec[_0xa259('0x1a')],_0x1cd19a['id'])});}})[_0xa259('0x4e')](function(_0x58c0ef){logger['error']('[QUEUE]',JSON[_0xa259('0x30')](_0x58c0ef));});};exports[_0xa259('0x4f')]=function(_0x15268a,_0x384379,_0x2a4be4,_0x14e704,_0x5d8f63,_0x2a0a53,_0x3e6cd7){var _0x205dfd,_0x19bbbd;_0x2a0a53[_0xa259('0x1a')]=intUtil[_0xa259('0x40')](_0x2a0a53[_0xa259('0x1a')]);_0x2a0a53[_0xa259('0x41')]=intUtil[_0xa259('0x40')](_0x2a0a53[_0xa259('0x41')]);if(_0x3e6cd7&&_0x3e6cd7['recordingFormat']&&_0x3e6cd7[_0xa259('0x50')]!==_0xa259('0x51')){logger[_0xa259('0xa')](_0xa259('0x52'),_0xa259('0x44'));_0x384379[_0xa259('0x45')]=util[_0xa259('0xc')](_0xa259('0x46'),_0x2a0a53[_0xa259('0x41')],_0x384379[_0xa259('0x47')],md5(_0x384379[_0xa259('0x47')]));}headers[_0xa259('0x48')]=getAuth(_0x2a0a53);return getUser(_0x2a0a53,_0x14e704[_0xa259('0x21')])[_0xa259('0x1c')](function(_0x5738c8){_0x205dfd=_0x5738c8;logger['info'](_0xa259('0x53'),_0x205dfd['id']);return getEndUser(_0x2a0a53,_0x384379[_0xa259('0x54')],_0x384379[_0xa259('0x55')]);})[_0xa259('0x1c')](function(_0x50bc80){_0x19bbbd=_0x50bc80;logger[_0xa259('0xa')]('The\x20Enduser\x20ID\x20is:',_0x19bbbd['id']);return getTicket(_0x2a0a53,_0x205dfd,_0x19bbbd,_0x2a4be4,_0x384379);})[_0xa259('0x1c')](function(_0x2f9d97){if(_0x2f9d97&&_0x2f9d97['id']){logger[_0xa259('0xa')](_0xa259('0x56'));logger[_0xa259('0xa')](_0xa259('0x57'),_0x2f9d97['id']);logger[_0xa259('0xa')]('[OUTBOUND]',_0xa259('0x4a'));emit(util['format'](_0xa259('0x4b'),_0x14e704[_0xa259('0x14')]),'trigger:browser:url',{'uri':util[_0xa259('0xc')](_0xa259('0x4d'),_0x2a0a53[_0xa259('0x1a')],_0x2f9d97['id'])});}})[_0xa259('0x4e')](function(_0xc417f2){logger[_0xa259('0x58')](_0xa259('0x52'),JSON['stringify'](_0xc417f2));});};exports[_0xa259('0x59')]=function(_0x58b114,_0x327953,_0x4e3d77,_0x866c35,_0x3fc8c5,_0x305a31){var _0x49cc0f,_0x1f5f57;_0x305a31[_0xa259('0x1a')]=intUtil['stripTrailingSlash'](_0x305a31['remoteUri']);_0x305a31[_0xa259('0x41')]=intUtil['stripTrailingSlash'](_0x305a31['serverUrl']);if(_0x3fc8c5&&_0x3fc8c5[_0xa259('0x42')]){logger[_0xa259('0xa')]('['+_0x327953['lastevent'][_0xa259('0x5a')]()+']',_0xa259('0x44'));_0x327953['recordingURL']=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x305a31[_0xa259('0x41')],_0x327953[_0xa259('0x47')],md5(_0x327953[_0xa259('0x47')]));}else{_0x327953['recordingURL']='';}headers[_0xa259('0x48')]=getAuth(_0x305a31);return getUser(_0x305a31,'')[_0xa259('0x1c')](function(_0xecda52){_0x49cc0f=_0xecda52;logger[_0xa259('0xa')](_0xa259('0x53'),_0x49cc0f['id']);return getEndUser(_0x305a31,_0x327953[_0xa259('0xe')],_0x327953[_0xa259('0xf')]);})[_0xa259('0x1c')](function(_0xda7f4a){_0x1f5f57=_0xda7f4a;logger[_0xa259('0xa')](_0xa259('0x49'),_0x1f5f57['id']);return getTicket(_0x305a31,_0x49cc0f,_0x1f5f57,_0x4e3d77,_0x327953);})[_0xa259('0x1c')](function(_0x38aa08){if(_0x38aa08){logger['info'](_0xa259('0x56'));logger[_0xa259('0xa')]('The\x20Ticket\x20ID\x20is:',_0x38aa08['id']);}})['catch'](function(_0x121969){logger['error']('['+_0x327953[_0xa259('0x5b')][_0xa259('0x5a')]()+']',JSON[_0xa259('0x30')](_0x121969));});}; \ No newline at end of file +var _0x2bd1=['nameField','toLowerCase','content','type','idField','variable','variableName','push','customVariable','name','Variable','queue','stripTrailingSlash','serverUrl','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','calleridname','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','stringify','outbound','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','unmanaged','monitor_format','lastevent','toUpperCase','lodash','request-promise','ioredis','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','localhost','application/json','emit','info','Creating\x20new\x20ticket...','calleridnum','getString','Subjects','Descriptions','
','custom_fields','mapValues','value','format','%s/api/v2/tickets','remoteUri','then','Ticket\x20created!','validateEmail','%s/api/v2/agents','find','contact','email','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','length','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/api/v2/contacts','Enduser\x20created.','apiKey','toString','debug','[HTTP]','defaults','GET','forEach','includes','string','picklist','customField'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x2bd1,0x82));var _0x12bd=function(_0xd14582,_0x4dd7a7){_0xd14582=_0xd14582-0x0;var _0x3e2574=_0x2bd1[_0xd14582];return _0x3e2574;};'use strict';var _=require(_0x12bd('0x0'));var rp=require(_0x12bd('0x1'));var md5=require('md5');var util=require('util');var Redis=require(_0x12bd('0x2'));var intUtil=require(_0x12bd('0x3'));var config=require(_0x12bd('0x4'));var logger=require(_0x12bd('0x5'))(_0x12bd('0x6'));config['redis']=_['defaults'](config[_0x12bd('0x7')],{'host':_0x12bd('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x12bd('0x7')]));var headers={'Content-Type':_0x12bd('0x9'),'Accept':'application/json'};function emit(_0x47aa9f,_0x13b8ce,_0x3bb303){io['to'](_0x47aa9f)[_0x12bd('0xa')](_0x13b8ce,_0x3bb303);}function getTicket(_0x521e01,_0x2f0e28,_0x257e83,_0x130ce6,_0x4a7b71){logger[_0x12bd('0xb')](_0x12bd('0xc'));var _0x129f30=_['merge']({'responder_id':_0x2f0e28['id'],'requester_id':_0x257e83['id'],'name':util['format']('Caller\x20-\x20%s',_0x4a7b71['calleridname']),'phone':_0x4a7b71[_0x12bd('0xd')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x12bd('0xe')](_0x130ce6[_0x12bd('0xf')],_0x4a7b71,'\x20'),'description':intUtil[_0x12bd('0xe')](_0x130ce6[_0x12bd('0x10')],_0x4a7b71,_0x12bd('0x11')),'tags':getTags(_0x130ce6['Tags'],'name')},getCustomFields(_0x130ce6['Fields'],_0x4a7b71));_0x129f30[_0x12bd('0x12')]=_[_0x12bd('0x13')](_['keyBy'](_0x129f30[_0x12bd('0x12')],'id'),_0x12bd('0x14'));return request({'uri':util[_0x12bd('0x15')](_0x12bd('0x16'),_0x521e01[_0x12bd('0x17')]),'method':'POST','body':_0x129f30})[_0x12bd('0x18')](function(_0x2e8f5d){logger[_0x12bd('0xb')](_0x12bd('0x19'));return _0x2e8f5d;});}function getUser(_0x3afabb,_0x4c27f3){if(intUtil[_0x12bd('0x1a')](_0x4c27f3)){return request({'uri':util[_0x12bd('0x15')](_0x12bd('0x1b'),_0x3afabb[_0x12bd('0x17')]),'qs':{'email':_0x4c27f3}})[_0x12bd('0x18')](function(_0x1983f7){if(_0x1983f7['length']){logger[_0x12bd('0xb')]('Agent\x20found!');return _[_0x12bd('0x1c')](_0x1983f7,function(_0x45a201){return _0x45a201[_0x12bd('0x1d')][_0x12bd('0x1e')]===_0x4c27f3;});}else{logger[_0x12bd('0xb')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x12bd('0x15')](_0x12bd('0x1f'),_0x3afabb['remoteUri'])})[_0x12bd('0x18')](function(_0x29377f){logger['info'](_0x12bd('0x20'));return _0x29377f;});}});}else{logger[_0x12bd('0xb')](_0x12bd('0x21'));return request({'uri':util[_0x12bd('0x15')](_0x12bd('0x1f'),_0x3afabb[_0x12bd('0x17')])})[_0x12bd('0x18')](function(_0x4d1ccd){logger[_0x12bd('0xb')](_0x12bd('0x20'));return _0x4d1ccd;});}}function getEndUser(_0x5de3d4,_0x28e93a,_0x51e474){logger['info'](_0x12bd('0x22'),_0x51e474);return request({'uri':util[_0x12bd('0x15')]('%s/api/v2/contacts',_0x5de3d4[_0x12bd('0x17')]),'qs':{'phone':_0x51e474}})[_0x12bd('0x18')](function(_0x1e9084){if(_0x1e9084[_0x12bd('0x23')]){logger['info']('Enduser\x20found!');return _[_0x12bd('0x1c')](_0x1e9084,{'phone':_0x51e474});}else{logger[_0x12bd('0xb')](_0x12bd('0x24'));return request({'uri':util[_0x12bd('0x15')](_0x12bd('0x25'),_0x5de3d4['remoteUri']),'method':'POST','body':{'name':_0x28e93a,'phone':_0x51e474}})[_0x12bd('0x18')](function(_0x32bf02){logger[_0x12bd('0xb')](_0x12bd('0x26'));return _0x32bf02;});}});}function getAuth(_0x100831){return util[_0x12bd('0x15')]('Basic\x20%s',new Buffer(_0x100831[_0x12bd('0x27')]+':X')[_0x12bd('0x28')]('base64'));}function request(_0x146563){logger[_0x12bd('0x29')](_0x12bd('0x2a'),JSON['stringify'](_0x146563));return rp(_[_0x12bd('0x2b')](_0x146563,{'method':_0x12bd('0x2c'),'headers':headers,'json':!![]}));}function getTags(_0x21b774,_0x3eea58){var _0x446462=[];if(_0x21b774&&_0x21b774[_0x12bd('0x23')]>0x0){_0x446462=_['map'](_0x21b774,_0x3eea58);}return _0x446462;}function getCustomFields(_0x1729ba,_0x387343){var _0x211f49=[];var _0x443572={'custom_fields':[]};if(_0x1729ba[_0x12bd('0x23')]>0x0){_[_0x12bd('0x2d')](_0x1729ba,function(_0x10b694){if(_[_0x12bd('0x2e')]([_0x12bd('0x2f'),_0x12bd('0x30')],_0x10b694['type'])&&_0x10b694['nameField']&&!_0x10b694[_0x12bd('0x31')]){_0x443572[_0x10b694[_0x12bd('0x32')][_0x12bd('0x33')]()]=_0x10b694[_0x12bd('0x34')][_0x12bd('0x28')]();}else if(_[_0x12bd('0x2e')]([_0x12bd('0x2f'),_0x12bd('0x30')],_0x10b694[_0x12bd('0x35')])&&_0x10b694[_0x12bd('0x36')]&&_0x10b694[_0x12bd('0x31')]){_0x443572[_0x12bd('0x12')]['push']({'id':_0x10b694['idField'],'value':_0x10b694[_0x12bd('0x34')]['toString']()});}else if(_0x10b694[_0x12bd('0x35')]===_0x12bd('0x37')&&_0x10b694[_0x12bd('0x38')]&&_0x10b694[_0x12bd('0x36')]&&_0x10b694[_0x12bd('0x31')]){_0x387343[_0x10b694[_0x12bd('0x38')]]&&_0x443572['custom_fields'][_0x12bd('0x39')]({'id':_0x10b694[_0x12bd('0x36')],'value':_0x387343[_0x10b694[_0x12bd('0x38')]][_0x12bd('0x28')]()});}else if(_0x10b694[_0x12bd('0x35')]===_0x12bd('0x3a')&&_0x10b694['Variable']&&_0x10b694['Variable'][_0x12bd('0x3b')]&&_0x10b694[_0x12bd('0x36')]&&_0x10b694[_0x12bd('0x31')]){_0x387343[_0x10b694['Variable'][_0x12bd('0x3b')]['toLowerCase']()]&&_0x443572[_0x12bd('0x12')][_0x12bd('0x39')]({'id':_0x10b694[_0x12bd('0x36')],'value':_0x387343[_0x10b694[_0x12bd('0x3c')][_0x12bd('0x3b')]['toLowerCase']()][_0x12bd('0x28')]()});}});}return _0x443572;}exports[_0x12bd('0x3d')]=function(_0x4612d9,_0x52b196,_0x352ac1,_0x49a063,_0xfa5276,_0x20316a){var _0x4b2f87,_0x2e9399;_0x20316a['remoteUri']=intUtil[_0x12bd('0x3e')](_0x20316a[_0x12bd('0x17')]);_0x20316a[_0x12bd('0x3f')]=intUtil[_0x12bd('0x3e')](_0x20316a[_0x12bd('0x3f')]);if(_0xfa5276&&_0xfa5276['monitor_format']){logger[_0x12bd('0xb')](_0x12bd('0x40'),'Recording\x20is\x20enabled!');_0x52b196[_0x12bd('0x41')]=util[_0x12bd('0x15')](_0x12bd('0x42'),_0x20316a[_0x12bd('0x3f')],_0x52b196[_0x12bd('0x43')],md5(_0x52b196[_0x12bd('0x43')]));}else{_0x52b196[_0x12bd('0x41')]='';}headers[_0x12bd('0x44')]=getAuth(_0x20316a);return getUser(_0x20316a,_0x49a063[_0x12bd('0x1e')])[_0x12bd('0x18')](function(_0x379506){_0x4b2f87=_0x379506;logger[_0x12bd('0xb')]('The\x20User\x20ID\x20is:',_0x4b2f87['id']);return getEndUser(_0x20316a,_0x52b196[_0x12bd('0x45')],_0x52b196[_0x12bd('0xd')]);})[_0x12bd('0x18')](function(_0x1c02a9){_0x2e9399=_0x1c02a9;logger[_0x12bd('0xb')](_0x12bd('0x46'),_0x2e9399['id']);return getTicket(_0x20316a,_0x4b2f87,_0x2e9399,_0x352ac1,_0x52b196);})['then'](function(_0x5002ff){if(_0x5002ff&&_0x5002ff['id']){logger[_0x12bd('0xb')](_0x12bd('0x19'));logger['info'](_0x12bd('0x47'),_0x5002ff['id']);logger['info'](_0x12bd('0x40'),_0x12bd('0x48'));emit(util[_0x12bd('0x15')](_0x12bd('0x49'),_0x49a063['name']),_0x12bd('0x4a'),{'uri':util[_0x12bd('0x15')](_0x12bd('0x4b'),_0x20316a[_0x12bd('0x17')],_0x5002ff['id'])});}})[_0x12bd('0x4c')](function(_0x2eeadf){logger[_0x12bd('0x4d')](_0x12bd('0x40'),JSON[_0x12bd('0x4e')](_0x2eeadf));});};exports[_0x12bd('0x4f')]=function(_0x5934ce,_0x2c8177,_0x25a8fd,_0x211c90,_0x14fc27,_0x458b7f,_0x2b4865){var _0x4c7853,_0x19683b;_0x458b7f[_0x12bd('0x17')]=intUtil['stripTrailingSlash'](_0x458b7f[_0x12bd('0x17')]);_0x458b7f[_0x12bd('0x3f')]=intUtil[_0x12bd('0x3e')](_0x458b7f[_0x12bd('0x3f')]);if(_0x2b4865&&_0x2b4865[_0x12bd('0x50')]&&_0x2b4865[_0x12bd('0x50')]!=='none'){logger[_0x12bd('0xb')](_0x12bd('0x51'),_0x12bd('0x52'));_0x2c8177[_0x12bd('0x41')]=util['format'](_0x12bd('0x42'),_0x458b7f[_0x12bd('0x3f')],_0x2c8177[_0x12bd('0x43')],md5(_0x2c8177[_0x12bd('0x43')]));}headers[_0x12bd('0x44')]=getAuth(_0x458b7f);return getUser(_0x458b7f,_0x211c90[_0x12bd('0x1e')])[_0x12bd('0x18')](function(_0xeeb00b){_0x4c7853=_0xeeb00b;logger[_0x12bd('0xb')](_0x12bd('0x53'),_0x4c7853['id']);return getEndUser(_0x458b7f,_0x2c8177[_0x12bd('0x54')],_0x2c8177[_0x12bd('0x55')]);})[_0x12bd('0x18')](function(_0x2a2a68){_0x19683b=_0x2a2a68;logger['info'](_0x12bd('0x46'),_0x19683b['id']);return getTicket(_0x458b7f,_0x4c7853,_0x19683b,_0x25a8fd,_0x2c8177);})[_0x12bd('0x18')](function(_0x4adac0){if(_0x4adac0&&_0x4adac0['id']){logger[_0x12bd('0xb')](_0x12bd('0x19'));logger[_0x12bd('0xb')]('The\x20Ticket\x20ID\x20is:',_0x4adac0['id']);logger[_0x12bd('0xb')]('[OUTBOUND]',_0x12bd('0x48'));emit(util[_0x12bd('0x15')](_0x12bd('0x49'),_0x211c90[_0x12bd('0x3b')]),_0x12bd('0x4a'),{'uri':util[_0x12bd('0x15')]('%s/helpdesk/tickets/%d',_0x458b7f[_0x12bd('0x17')],_0x4adac0['id'])});}})['catch'](function(_0x2e8184){logger[_0x12bd('0x4d')](_0x12bd('0x51'),JSON[_0x12bd('0x4e')](_0x2e8184));});};exports[_0x12bd('0x56')]=function(_0x419fa6,_0x4e8872,_0x24c7fe,_0x5958d6,_0x506791,_0x3dcd09){var _0x5deabd,_0x589143;_0x3dcd09[_0x12bd('0x17')]=intUtil[_0x12bd('0x3e')](_0x3dcd09[_0x12bd('0x17')]);_0x3dcd09[_0x12bd('0x3f')]=intUtil[_0x12bd('0x3e')](_0x3dcd09[_0x12bd('0x3f')]);if(_0x506791&&_0x506791[_0x12bd('0x57')]){logger[_0x12bd('0xb')]('['+_0x4e8872[_0x12bd('0x58')][_0x12bd('0x59')]()+']','Recording\x20is\x20enabled!');_0x4e8872['recordingURL']=util[_0x12bd('0x15')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3dcd09[_0x12bd('0x3f')],_0x4e8872[_0x12bd('0x43')],md5(_0x4e8872[_0x12bd('0x43')]));}else{_0x4e8872[_0x12bd('0x41')]='';}headers[_0x12bd('0x44')]=getAuth(_0x3dcd09);return getUser(_0x3dcd09,'')[_0x12bd('0x18')](function(_0x50558a){_0x5deabd=_0x50558a;logger[_0x12bd('0xb')](_0x12bd('0x53'),_0x5deabd['id']);return getEndUser(_0x3dcd09,_0x4e8872[_0x12bd('0x45')],_0x4e8872[_0x12bd('0xd')]);})['then'](function(_0x3050f2){_0x589143=_0x3050f2;logger[_0x12bd('0xb')](_0x12bd('0x46'),_0x589143['id']);return getTicket(_0x3dcd09,_0x5deabd,_0x589143,_0x24c7fe,_0x4e8872);})[_0x12bd('0x18')](function(_0x58f2fa){if(_0x58f2fa){logger[_0x12bd('0xb')](_0x12bd('0x19'));logger[_0x12bd('0xb')]('The\x20Ticket\x20ID\x20is:',_0x58f2fa['id']);}})[_0x12bd('0x4c')](function(_0x4bc709){logger[_0x12bd('0x4d')]('['+_0x4e8872[_0x12bd('0x58')][_0x12bd('0x59')]()+']',JSON[_0x12bd('0x4e')](_0x4bc709));});}; \ 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 6903b5a..f95df59 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 _0x05dd=['[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','request-promise','md5','util','moment','bluebird','./util','../../../../config/environment','../../../../config/logger','freshsales','defaults','redis','socket.io-emitter','GET','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','length','email','adminEmail','adminId','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','Getting\x20user\x20list','agentEmail','userEmail','userId','User\x20found:','Admin\x20selected','&entities=contact','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','Contact\x20found\x20mobile_number:','endUserId','work_number','Contact\x20found\x20work_number:','Contact\x20created:','POST','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','/api/tasks','getString','Subjects','Descriptions','Contact','add','ticketId','Task\x20created:','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','serverUrl','username','toLowerCase','outbound','destcalleridnum','calleridnum','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format'];(function(_0x29af7f,_0x526734){var _0x28d95d=function(_0x1f32a5){while(--_0x1f32a5){_0x29af7f['push'](_0x29af7f['shift']());}};_0x28d95d(++_0x526734);}(_0x05dd,0x1a9));var _0xd05d=function(_0x46be7d,_0x4ee45c){_0x46be7d=_0x46be7d-0x0;var _0x428e45=_0x05dd[_0x46be7d];return _0x428e45;};'use strict';var _=require('lodash');var rp=require(_0xd05d('0x0'));var md5=require(_0xd05d('0x1'));var util=require(_0xd05d('0x2'));var moment=require(_0xd05d('0x3'));var Promise=require(_0xd05d('0x4'));var Redis=require('ioredis');var intUtil=require(_0xd05d('0x5'));var config=require(_0xd05d('0x6'));var logger=require(_0xd05d('0x7'))(_0xd05d('0x8'));config['redis']=_[_0xd05d('0x9')](config[_0xd05d('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0xd05d('0xb'))(new Redis(config[_0xd05d('0xa')]));function getAdminId(_0x43f18d,_0x1ea6c3,_0x40ec80,_0x3b88bc){return new Promise(function(_0x3dfe22,_0x1b20ba){var _0x596336=![];var _0x3a0640={'method':_0xd05d('0xc'),'uri':_0x3b88bc+_0xd05d('0xd'),'json':!![]};_0x3a0640[_0xd05d('0xe')]=_0x40ec80;logger[_0xd05d('0xf')](_0xd05d('0x10'));return rp(_0x3a0640)[_0xd05d('0x11')](function(_0xc1172e){if(_0xc1172e){var _0x455661=_0xc1172e['users'];var _0x33017b=null;for(_0x33017b=0x0;_0x33017b<_0x455661[_0xd05d('0x12')];_0x33017b++){if(_0x455661[_0x33017b][_0xd05d('0x13')]===_0x43f18d[_0xd05d('0x14')]){_0x43f18d[_0xd05d('0x15')]=_0x455661[_0x33017b]['id'];_0x596336=!![];}}if(_0x596336){logger['info']('Admin\x20found:',_0x43f18d[_0xd05d('0x15')]);_0x3dfe22(_0x43f18d);}else{_0x1b20ba({'statusCode':0x194,'message':_0xd05d('0x16')});}}else{_0x1b20ba({'statusCode':0x194,'message':_0xd05d('0x16')});}})[_0xd05d('0x17')](function(_0x2f2509){logger[_0xd05d('0x18')]('['+[_0x1ea6c3[_0xd05d('0x19')]()]+']',_0x2f2509[_0xd05d('0x1a')]);_0x1b20ba(_0x2f2509);});});}function getUser(_0x29fedc,_0x2f5c1e,_0x4bc351){return function(_0x2cf4bb){return new Promise(function(_0x29a792,_0x2a9114){var _0xd9c7bb={'method':_0xd05d('0xc'),'uri':_0x4bc351+_0xd05d('0xd'),'json':!![]};_0xd9c7bb['headers']=_0x2f5c1e;logger[_0xd05d('0xf')](_0xd05d('0x1b'));return rp(_0xd9c7bb)[_0xd05d('0x11')](function(_0x25d205){if(_0x25d205){var _0x1e6e64=_0x25d205['users'];var _0x515700=![];var _0x370343=null;if(_0x2cf4bb['agentEmail']!==null){logger[_0xd05d('0xf')]('Getting\x20user\x20with\x20email',_0x2cf4bb[_0xd05d('0x1c')]);_0x2cf4bb[_0xd05d('0x1d')]=_0x2cf4bb['agentEmail'];for(_0x370343=0x0;_0x370343<_0x1e6e64[_0xd05d('0x12')];_0x370343++){if(_0x1e6e64[_0x370343][_0xd05d('0x13')]===_0x2cf4bb['agentEmail']){_0x515700=!![];_0x2cf4bb[_0xd05d('0x1e')]=_0x1e6e64[_0x370343]['id'];logger['info'](_0xd05d('0x1f'),_0x2cf4bb[_0xd05d('0x1e')]);}}}if(!_0x515700){logger['info'](_0xd05d('0x20'));_0x2cf4bb['userEmail']=_0x2cf4bb[_0xd05d('0x14')];_0x2cf4bb[_0xd05d('0x1e')]=_0x2cf4bb[_0xd05d('0x15')];_0x515700=!![];}if(_0x515700){_0x29a792(_0x2cf4bb);}else{_0x2a9114({'statusCode':0x194,'message':_0xd05d('0x16')});}}else{_0x2a9114({'statusCode':0x194,'message':_0xd05d('0x16')});}})['catch'](function(_0x40314e){logger[_0xd05d('0x18')]('['+[_0x29fedc[_0xd05d('0x19')]()]+']',_0x40314e[_0xd05d('0x1a')]);_0x2a9114(_0x40314e);});});};}function searchContact(_0x43b6a3,_0x4d5b09,_0x9f2a07,_0x140516){return new Promise(function(_0x21afcf,_0x40db02){var _0x428d36={'method':_0xd05d('0xc'),'headers':_0x4d5b09,'uri':_0x43b6a3+'/api/lookup?q='+_0x140516+'&f='+_0x9f2a07+_0xd05d('0x21'),'json':!![]};rp(_0x428d36)['then'](function(_0xe98e82){var _0x5b5e34=_[_0xd05d('0x22')](_0xe98e82['contacts'][_0xd05d('0x23')],[_0x9f2a07,_0x140516]);_0x21afcf(_0x5b5e34);})[_0xd05d('0x17')](function(_0x431ed4){_0x40db02(_0x431ed4);});});}function getEndUser(_0x2d399d,_0x389e35,_0x2c6740){return function(_0x9d70fa){return new Promise(function(_0x3959fd,_0x759a45){logger[_0xd05d('0xf')](util[_0xd05d('0x24')](_0xd05d('0x25'),_0x9d70fa[_0xd05d('0x26')]));searchContact(_0x2c6740,_0x389e35,_0xd05d('0x27'),_0x9d70fa[_0xd05d('0x26')])['then'](function(_0x328dcf){if(_0x328dcf){_0x9d70fa['endUserId']=_0x328dcf['id'];logger[_0xd05d('0xf')](_0xd05d('0x28'),_0x9d70fa[_0xd05d('0x29')]);return _0x3959fd(_0x9d70fa);}searchContact(_0x2c6740,_0x389e35,_0xd05d('0x2a'),_0x9d70fa[_0xd05d('0x26')])['then'](function(_0xd0718d){if(_0xd0718d){_0x9d70fa['endUserId']=_0xd0718d['id'];logger[_0xd05d('0xf')](_0xd05d('0x2b'),_0x9d70fa['endUserId']);return _0x3959fd(_0x9d70fa);}createEndUser(_0x9d70fa,_0x2d399d,_0x389e35,_0x2c6740)[_0xd05d('0x11')](function(_0x50f14a){logger[_0xd05d('0xf')](_0xd05d('0x2c'),_0x50f14a[_0xd05d('0x29')]);return _0x3959fd(_0x50f14a);});});})[_0xd05d('0x17')](function(_0x13298a){_0x759a45(_0x13298a);});});};}function createEndUser(_0x1f6317,_0x27d2c5,_0x2d1961,_0x582b7c){return new Promise(function(_0xba42ce,_0x791033){var _0x2d827f=moment();var _0xe208fd={'method':_0xd05d('0x2d'),'uri':_0x582b7c+'/api/contacts','body':{'contact':{'last_name':_0x1f6317['contactNumber'],'work_number':_0x1f6317[_0xd05d('0x26')],'mobile_number':_0x1f6317[_0xd05d('0x26')],'owner_id':_0x1f6317[_0xd05d('0x1e')],'created_at':_0x2d827f[_0xd05d('0x24')](_0xd05d('0x2e'))}},'json':!![]};_0xe208fd[_0xd05d('0xe')]=_0x2d1961;logger[_0xd05d('0xf')](_0xd05d('0x2f'));return rp(_0xe208fd)[_0xd05d('0x11')](function(_0x2c2cc5){_0x1f6317[_0xd05d('0x29')]=_0x2c2cc5[_0xd05d('0x30')]['id'];_0xba42ce(_0x1f6317);})[_0xd05d('0x17')](function(_0x2e69f8){logger[_0xd05d('0x18')]('['+[_0x27d2c5['toUpperCase']()]+']',_0x2e69f8[_0xd05d('0x1a')]);_0x791033(_0x2e69f8[_0xd05d('0x1a')]);});});}function getTicket(_0x4194ab,_0x2ab25a,_0x264b0f,_0x2b9735,_0x271654){return function(_0x48f920){logger[_0xd05d('0xf')]('Creating\x20new\x20task');return new Promise(function(_0x138e25,_0x521f6d){var _0x21b481=moment();var _0x1f331e={'method':_0xd05d('0x2d'),'uri':_0x264b0f+_0xd05d('0x31'),'body':{'title':intUtil[_0xd05d('0x32')](_0x2b9735[_0xd05d('0x33')],_0x271654,'\x20'),'description':intUtil[_0xd05d('0x32')](_0x2b9735[_0xd05d('0x34')],_0x271654,'\x0a'),'owner_id':_0x48f920['userId'],'creater_id':_0x48f920[_0xd05d('0x15')],'targetable_id':_0x48f920[_0xd05d('0x29')],'targetable_type':_0xd05d('0x35'),'created_at':_0x21b481[_0xd05d('0x24')](_0xd05d('0x2e')),'due_date':_0x21b481[_0xd05d('0x36')](0x1e,'m')[_0xd05d('0x24')](_0xd05d('0x2e'))},'json':!![]};_0x1f331e[_0xd05d('0xe')]=_0x2ab25a;return rp(_0x1f331e)['then'](function(_0x9cc870){_0x48f920[_0xd05d('0x37')]=_0x9cc870['task']['id'];logger[_0xd05d('0xf')](_0xd05d('0x38'),_0x48f920['ticketId']);_0x138e25(_0x48f920);})[_0xd05d('0x17')](function(_0x38477f){logger[_0xd05d('0x18')]('['+[_0x4194ab[_0xd05d('0x19')]()]+']',_0x38477f[_0xd05d('0x1a')]);_0x521f6d(_0x38477f[_0xd05d('0x1a')]);});});};}function emit(_0x46b139,_0xeb3fda,_0x38c370){var _0x42b827={'uri':_0x46b139+'/contacts/'+_0x38c370};io['to'](util[_0xd05d('0x24')]('user:%s',_0xeb3fda))[_0xd05d('0x39')](_0xd05d('0x3a'),_0x42b827);}exports['cs']=function(_0x5097a8,_0x3afd89,_0x30a44c,_0x4980f4,_0x315556,_0x33d2e4,_0x18d166,_0x5b750a){var _0x4071ae={};var _0x1ed9b7={'Authorization':_0xd05d('0x3b')+_0x33d2e4[_0xd05d('0x3c')]};_0x33d2e4[_0xd05d('0x3d')]=intUtil['stripTrailingSlash'](_0x33d2e4[_0xd05d('0x3d')]);_0x33d2e4[_0xd05d('0x3e')]=intUtil['stripTrailingSlash'](_0x33d2e4['serverUrl']);var _0x998c24=_0x33d2e4[_0xd05d('0x3d')];_0x4071ae['adminEmail']=_0x33d2e4[_0xd05d('0x3f')];_0x4071ae[_0xd05d('0x26')]=_0x5b750a[_0xd05d('0x40')]()===_0xd05d('0x41')?_0x3afd89[_0xd05d('0x42')]:_0x3afd89[_0xd05d('0x43')];_0x4071ae['callDirection']=_0x5b750a===_0xd05d('0x44')||_0x5b750a===_0xd05d('0x45')?_0xd05d('0x44'):_0xd05d('0x41');if(_0x4980f4){_0x4071ae[_0xd05d('0x1c')]=_0x4980f4[_0xd05d('0x13')];}var _0x4bd615=util[_0xd05d('0x24')](_0xd05d('0x46'),_0x33d2e4[_0xd05d('0x3e')],_0x3afd89[_0xd05d('0x47')],md5(_0x3afd89[_0xd05d('0x47')]));if(_0x315556&&_0x315556[_0xd05d('0x48')]){logger[_0xd05d('0xf')](_0xd05d('0x49'),_0xd05d('0x4a'));_0x3afd89[_0xd05d('0x4b')]=_0x4bd615;}else if(_0x18d166&&_0x18d166['recordingFormat']&&_0x18d166[_0xd05d('0x4c')]!==_0xd05d('0x4d')){logger[_0xd05d('0xf')](_0xd05d('0x4e'),'Recording\x20is\x20enabled!');_0x3afd89['recordingURL']=_0x4bd615;}else{_0x3afd89[_0xd05d('0x4b')]='';}return getAdminId(_0x4071ae,_0x5b750a,_0x1ed9b7,_0x998c24)[_0xd05d('0x11')](getUser(_0x5b750a,_0x1ed9b7,_0x998c24))[_0xd05d('0x11')](getEndUser(_0x5b750a,_0x1ed9b7,_0x998c24))['then'](getTicket(_0x5b750a,_0x1ed9b7,_0x998c24,_0x30a44c,_0x3afd89))[_0xd05d('0x11')](function(_0x585d5e){logger[_0xd05d('0xf')](util[_0xd05d('0x24')]('The\x20ticket\x20ID\x20is:\x20%s',_0x585d5e[_0xd05d('0x37')]));if(_0x5b750a!=='unmanaged'){logger['info']('['+[_0x5b750a[_0xd05d('0x19')]()]+']',_0xd05d('0x4f'));emit(_0x998c24,_0x4980f4[_0xd05d('0x50')],_0x585d5e[_0xd05d('0x29')]);}})['catch'](function(_0x3f4e23){logger[_0xd05d('0x18')]('['+[_0x5b750a[_0xd05d('0x19')]()]+_0xd05d('0x51'),util[_0xd05d('0x52')](_0x3f4e23,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x6eb8=['toUpperCase','message','agentEmail','Getting\x20user\x20with\x20email','userId','User\x20found:','Admin\x20selected','userEmail','error','/api/lookup?q=','&f=','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','mobile_number','then','endUserId','Contact\x20found\x20mobile_number:','work_number','contactNumber','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','/api/tasks','getString','Subjects','Contact','add','task','Task\x20created:','ticketId','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','toLowerCase','outbound','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','md5','util','bluebird','./util','../../../../config/logger','freshsales','redis','defaults','localhost','socket.io-emitter','GET','headers','info','Getting\x20admin\x20information','users','length','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch'];(function(_0x5eca50,_0xc1e3f8){var _0x41fb84=function(_0x4ce3f3){while(--_0x4ce3f3){_0x5eca50['push'](_0x5eca50['shift']());}};_0x41fb84(++_0xc1e3f8);}(_0x6eb8,0x148));var _0x86eb=function(_0x41358a,_0x322144){_0x41358a=_0x41358a-0x0;var _0x8c40ce=_0x6eb8[_0x41358a];return _0x8c40ce;};'use strict';var _=require(_0x86eb('0x0'));var rp=require(_0x86eb('0x1'));var md5=require(_0x86eb('0x2'));var util=require(_0x86eb('0x3'));var moment=require('moment');var Promise=require(_0x86eb('0x4'));var Redis=require('ioredis');var intUtil=require(_0x86eb('0x5'));var config=require('../../../../config/environment');var logger=require(_0x86eb('0x6'))(_0x86eb('0x7'));config[_0x86eb('0x8')]=_[_0x86eb('0x9')](config[_0x86eb('0x8')],{'host':_0x86eb('0xa'),'port':0x18eb});var io=require(_0x86eb('0xb'))(new Redis(config[_0x86eb('0x8')]));function getAdminId(_0x3db396,_0xf6e6e3,_0x23d2d3,_0x516ca7){return new Promise(function(_0x358142,_0x3ac4e2){var _0x17d29f=![];var _0x9fe622={'method':_0x86eb('0xc'),'uri':_0x516ca7+'/api/selector/owners','json':!![]};_0x9fe622[_0x86eb('0xd')]=_0x23d2d3;logger[_0x86eb('0xe')](_0x86eb('0xf'));return rp(_0x9fe622)['then'](function(_0x1510ac){if(_0x1510ac){var _0x5cfea1=_0x1510ac[_0x86eb('0x10')];var _0x21460a=null;for(_0x21460a=0x0;_0x21460a<_0x5cfea1[_0x86eb('0x11')];_0x21460a++){if(_0x5cfea1[_0x21460a][_0x86eb('0x12')]===_0x3db396[_0x86eb('0x13')]){_0x3db396[_0x86eb('0x14')]=_0x5cfea1[_0x21460a]['id'];_0x17d29f=!![];}}if(_0x17d29f){logger['info'](_0x86eb('0x15'),_0x3db396[_0x86eb('0x14')]);_0x358142(_0x3db396);}else{_0x3ac4e2({'statusCode':0x194,'message':_0x86eb('0x16')});}}else{_0x3ac4e2({'statusCode':0x194,'message':_0x86eb('0x16')});}})[_0x86eb('0x17')](function(_0x331d3a){logger['error']('['+[_0xf6e6e3[_0x86eb('0x18')]()]+']',_0x331d3a[_0x86eb('0x19')]);_0x3ac4e2(_0x331d3a);});});}function getUser(_0x574d83,_0x30bb4a,_0x261bba){return function(_0x22f733){return new Promise(function(_0x4f0ca5,_0x3fe4ce){var _0x5cd0a0={'method':_0x86eb('0xc'),'uri':_0x261bba+'/api/selector/owners','json':!![]};_0x5cd0a0[_0x86eb('0xd')]=_0x30bb4a;logger[_0x86eb('0xe')]('Getting\x20user\x20list');return rp(_0x5cd0a0)['then'](function(_0xfb0e7c){if(_0xfb0e7c){var _0x3ce614=_0xfb0e7c[_0x86eb('0x10')];var _0x28e7a1=![];var _0x3795f6=null;if(_0x22f733[_0x86eb('0x1a')]!==null){logger[_0x86eb('0xe')](_0x86eb('0x1b'),_0x22f733[_0x86eb('0x1a')]);_0x22f733['userEmail']=_0x22f733['agentEmail'];for(_0x3795f6=0x0;_0x3795f6<_0x3ce614['length'];_0x3795f6++){if(_0x3ce614[_0x3795f6][_0x86eb('0x12')]===_0x22f733['agentEmail']){_0x28e7a1=!![];_0x22f733[_0x86eb('0x1c')]=_0x3ce614[_0x3795f6]['id'];logger[_0x86eb('0xe')](_0x86eb('0x1d'),_0x22f733[_0x86eb('0x1c')]);}}}if(!_0x28e7a1){logger[_0x86eb('0xe')](_0x86eb('0x1e'));_0x22f733[_0x86eb('0x1f')]=_0x22f733[_0x86eb('0x13')];_0x22f733['userId']=_0x22f733[_0x86eb('0x14')];_0x28e7a1=!![];}if(_0x28e7a1){_0x4f0ca5(_0x22f733);}else{_0x3fe4ce({'statusCode':0x194,'message':_0x86eb('0x16')});}}else{_0x3fe4ce({'statusCode':0x194,'message':_0x86eb('0x16')});}})[_0x86eb('0x17')](function(_0x588dfc){logger[_0x86eb('0x20')]('['+[_0x574d83[_0x86eb('0x18')]()]+']',_0x588dfc[_0x86eb('0x19')]);_0x3fe4ce(_0x588dfc);});});};}function searchContact(_0x4e93aa,_0x9702f4,_0x1fe9f4,_0x430d0d){return new Promise(function(_0x483f71,_0x3462f1){var _0x4207b8={'method':'GET','headers':_0x9702f4,'uri':_0x4e93aa+_0x86eb('0x21')+_0x430d0d+_0x86eb('0x22')+_0x1fe9f4+'&entities=contact','json':!![]};rp(_0x4207b8)['then'](function(_0x2821f0){var _0x425ba4=_['find'](_0x2821f0[_0x86eb('0x23')][_0x86eb('0x23')],[_0x1fe9f4,_0x430d0d]);_0x483f71(_0x425ba4);})[_0x86eb('0x17')](function(_0x2b1d6c){_0x3462f1(_0x2b1d6c);});});}function getEndUser(_0x85849,_0x3e579d,_0x11cd7d){return function(_0x47a6c1){return new Promise(function(_0x16db31,_0x2b0d89){logger[_0x86eb('0xe')](util[_0x86eb('0x24')](_0x86eb('0x25'),_0x47a6c1['contactNumber']));searchContact(_0x11cd7d,_0x3e579d,_0x86eb('0x26'),_0x47a6c1['contactNumber'])[_0x86eb('0x27')](function(_0x1ce649){if(_0x1ce649){_0x47a6c1[_0x86eb('0x28')]=_0x1ce649['id'];logger[_0x86eb('0xe')](_0x86eb('0x29'),_0x47a6c1[_0x86eb('0x28')]);return _0x16db31(_0x47a6c1);}searchContact(_0x11cd7d,_0x3e579d,_0x86eb('0x2a'),_0x47a6c1[_0x86eb('0x2b')])[_0x86eb('0x27')](function(_0x33584b){if(_0x33584b){_0x47a6c1['endUserId']=_0x33584b['id'];logger[_0x86eb('0xe')](_0x86eb('0x2c'),_0x47a6c1[_0x86eb('0x28')]);return _0x16db31(_0x47a6c1);}createEndUser(_0x47a6c1,_0x85849,_0x3e579d,_0x11cd7d)[_0x86eb('0x27')](function(_0x5a0b72){logger['info'](_0x86eb('0x2d'),_0x5a0b72['endUserId']);return _0x16db31(_0x5a0b72);});});})[_0x86eb('0x17')](function(_0x59ebc7){_0x2b0d89(_0x59ebc7);});});};}function createEndUser(_0x3da510,_0x2a4d4,_0x4dceb7,_0x11cb01){return new Promise(function(_0x151d27,_0x59e601){var _0x365bd0=moment();var _0x112931={'method':_0x86eb('0x2e'),'uri':_0x11cb01+_0x86eb('0x2f'),'body':{'contact':{'last_name':_0x3da510[_0x86eb('0x2b')],'work_number':_0x3da510[_0x86eb('0x2b')],'mobile_number':_0x3da510['contactNumber'],'owner_id':_0x3da510[_0x86eb('0x1c')],'created_at':_0x365bd0[_0x86eb('0x24')](_0x86eb('0x30'))}},'json':!![]};_0x112931['headers']=_0x4dceb7;logger[_0x86eb('0xe')](_0x86eb('0x31'));return rp(_0x112931)[_0x86eb('0x27')](function(_0x2ae5cb){_0x3da510[_0x86eb('0x28')]=_0x2ae5cb[_0x86eb('0x32')]['id'];_0x151d27(_0x3da510);})[_0x86eb('0x17')](function(_0x1c8bf7){logger['error']('['+[_0x2a4d4[_0x86eb('0x18')]()]+']',_0x1c8bf7[_0x86eb('0x19')]);_0x59e601(_0x1c8bf7['message']);});});}function getTicket(_0x4d83f7,_0x383a9b,_0x526a32,_0x2ffee0,_0x5d8bd6){return function(_0x220a4c){logger['info'](_0x86eb('0x33'));return new Promise(function(_0x151f9d,_0x39f5be){var _0xba68c=moment();var _0x44dc08={'method':'POST','uri':_0x526a32+_0x86eb('0x34'),'body':{'title':intUtil[_0x86eb('0x35')](_0x2ffee0[_0x86eb('0x36')],_0x5d8bd6,'\x20'),'description':intUtil[_0x86eb('0x35')](_0x2ffee0['Descriptions'],_0x5d8bd6,'\x0a'),'owner_id':_0x220a4c['userId'],'creater_id':_0x220a4c[_0x86eb('0x14')],'targetable_id':_0x220a4c['endUserId'],'targetable_type':_0x86eb('0x37'),'created_at':_0xba68c[_0x86eb('0x24')](_0x86eb('0x30')),'due_date':_0xba68c[_0x86eb('0x38')](0x1e,'m')[_0x86eb('0x24')](_0x86eb('0x30'))},'json':!![]};_0x44dc08['headers']=_0x383a9b;return rp(_0x44dc08)[_0x86eb('0x27')](function(_0x43f105){_0x220a4c['ticketId']=_0x43f105[_0x86eb('0x39')]['id'];logger['info'](_0x86eb('0x3a'),_0x220a4c[_0x86eb('0x3b')]);_0x151f9d(_0x220a4c);})[_0x86eb('0x17')](function(_0x11af68){logger['error']('['+[_0x4d83f7[_0x86eb('0x18')]()]+']',_0x11af68[_0x86eb('0x19')]);_0x39f5be(_0x11af68[_0x86eb('0x19')]);});});};}function emit(_0x50560a,_0x48164d,_0xad7eff){var _0x3c50f2={'uri':_0x50560a+'/contacts/'+_0xad7eff};io['to'](util[_0x86eb('0x24')](_0x86eb('0x3c'),_0x48164d))[_0x86eb('0x3d')](_0x86eb('0x3e'),_0x3c50f2);}exports['cs']=function(_0x1d8a08,_0x1eeea6,_0x5cebf9,_0x4a964d,_0x348798,_0x4474f9,_0x6d84bc,_0x50871f){var _0x385a7f={};var _0x477dbc={'Authorization':_0x86eb('0x3f')+_0x4474f9[_0x86eb('0x40')]};_0x4474f9[_0x86eb('0x41')]=intUtil[_0x86eb('0x42')](_0x4474f9[_0x86eb('0x41')]);_0x4474f9[_0x86eb('0x43')]=intUtil['stripTrailingSlash'](_0x4474f9[_0x86eb('0x43')]);var _0x99f2f5=_0x4474f9[_0x86eb('0x41')];_0x385a7f['adminEmail']=_0x4474f9['username'];_0x385a7f['contactNumber']=_0x50871f[_0x86eb('0x44')]()===_0x86eb('0x45')?_0x1eeea6['destcalleridnum']:_0x1eeea6[_0x86eb('0x46')];_0x385a7f[_0x86eb('0x47')]=_0x50871f===_0x86eb('0x48')||_0x50871f===_0x86eb('0x49')?_0x86eb('0x48'):_0x86eb('0x45');if(_0x4a964d){_0x385a7f[_0x86eb('0x1a')]=_0x4a964d[_0x86eb('0x12')];}var _0x3df99a=util['format'](_0x86eb('0x4a'),_0x4474f9[_0x86eb('0x43')],_0x1eeea6[_0x86eb('0x4b')],md5(_0x1eeea6[_0x86eb('0x4b')]));if(_0x348798&&_0x348798[_0x86eb('0x4c')]){logger[_0x86eb('0xe')](_0x86eb('0x4d'),_0x86eb('0x4e'));_0x1eeea6[_0x86eb('0x4f')]=_0x3df99a;}else if(_0x6d84bc&&_0x6d84bc[_0x86eb('0x50')]&&_0x6d84bc[_0x86eb('0x50')]!==_0x86eb('0x51')){logger[_0x86eb('0xe')](_0x86eb('0x52'),_0x86eb('0x4e'));_0x1eeea6[_0x86eb('0x4f')]=_0x3df99a;}else{_0x1eeea6[_0x86eb('0x4f')]='';}return getAdminId(_0x385a7f,_0x50871f,_0x477dbc,_0x99f2f5)[_0x86eb('0x27')](getUser(_0x50871f,_0x477dbc,_0x99f2f5))['then'](getEndUser(_0x50871f,_0x477dbc,_0x99f2f5))['then'](getTicket(_0x50871f,_0x477dbc,_0x99f2f5,_0x5cebf9,_0x1eeea6))[_0x86eb('0x27')](function(_0xd7e308){logger['info'](util[_0x86eb('0x24')](_0x86eb('0x53'),_0xd7e308[_0x86eb('0x3b')]));if(_0x50871f!==_0x86eb('0x49')){logger[_0x86eb('0xe')]('['+[_0x50871f[_0x86eb('0x18')]()]+']',_0x86eb('0x54'));emit(_0x99f2f5,_0x4a964d[_0x86eb('0x55')],_0xd7e308[_0x86eb('0x28')]);}})[_0x86eb('0x17')](function(_0x52ae19){logger[_0x86eb('0x20')]('['+[_0x50871f[_0x86eb('0x18')]()]+_0x86eb('0x56'),util[_0x86eb('0x57')](_0x52ae19,{'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 c7712c3..2950b92 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 _0xf22a=['data3','queue','routeId','outbound','log','unmanaged','salesforce','zoho','unknown\x20integration','error','%s\x20configuration\x20#%s\x20not\x20found','format','lodash','util','./zendesk','./sugarcrm','./freshdesk','./zoho','./dynamics365','zendesk','sugarcrm','freshdesk','desk','vtiger','dynamics365','servicenow','exec','data1','toLowerCase','data2','find','Configurations'];(function(_0xd958a5,_0x515491){var _0xa43f42=function(_0x2ea5ea){while(--_0x2ea5ea){_0xd958a5['push'](_0xd958a5['shift']());}};_0xa43f42(++_0x515491);}(_0xf22a,0x1cc));var _0xaf22=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0xf22a[_0x4b055c];return _0x4b62bb;};'use strict';var _=require(_0xaf22('0x0'));var util=require(_0xaf22('0x1'));var zendesk=require(_0xaf22('0x2'));var salesforce=require('./salesforce');var sugarcrm=require(_0xaf22('0x3'));var freshdesk=require(_0xaf22('0x4'));var zoho=require(_0xaf22('0x5'));var desk=require('./desk');var vtiger=require('./vtiger');var servicenow=require('./servicenow');var dynamics365=require(_0xaf22('0x6'));var freshsales=require('./freshsales');var integrations=[_0xaf22('0x7'),'salesforce',_0xaf22('0x8'),_0xaf22('0x9'),'zoho',_0xaf22('0xa'),_0xaf22('0xb'),_0xaf22('0xc'),'freshsales',_0xaf22('0xd')];exports[_0xaf22('0xe')]=function(_0x5d1a72,_0x45b879,_0x3a971d,_0x1009d3,_0x29f457,_0xc41866){if(_0x3a971d){if(_['includes'](integrations,_0x5d1a72[_0xaf22('0xf')][_0xaf22('0x10')]())){try{var _0x2d8caa=null;var _0x4dcf69='';var _0x3ada8f=_0x3a971d[_0x5d1a72[_0xaf22('0xf')][_0xaf22('0x10')]()];if(_0x3ada8f){var _0x552dc7=_0x3ada8f[_0x5d1a72[_0xaf22('0x11')]];if(_0x552dc7){var _0x4da77e=_[_0xaf22('0x12')](_0x552dc7[_0xaf22('0x13')],{'id':parseInt(_0x5d1a72[_0xaf22('0x14')],0xa)});if(_0x4da77e){if(_0x1009d3){if(_0x29f457&&_0x45b879[_0xaf22('0x15')]){_0x4dcf69=_0xaf22('0x15');}else if(_0x45b879[_0xaf22('0x16')]){_0x4dcf69=_0xaf22('0x17');}else{console[_0xaf22('0x18')]('EVENT\x20UNKNOWN',_0x45b879);}}else{_0x4dcf69=_0xaf22('0x19');}switch(_0x5d1a72[_0xaf22('0xf')][_0xaf22('0x10')]()){case _0xaf22('0x7'):zendesk[_0x4dcf69](_0x5d1a72,_0x45b879,_0x4da77e,_0x1009d3,_0x29f457,_0x552dc7,_0xc41866);break;case _0xaf22('0x1a'):salesforce[_0x4dcf69](_0x5d1a72,_0x45b879,_0x4da77e,_0x1009d3,_0x29f457,_0x552dc7,_0xc41866);break;case'sugarcrm':sugarcrm[_0x4dcf69](_0x5d1a72,_0x45b879,_0x4da77e,_0x1009d3,_0x29f457,_0x552dc7,_0xc41866);break;case'freshdesk':freshdesk[_0x4dcf69](_0x5d1a72,_0x45b879,_0x4da77e,_0x1009d3,_0x29f457,_0x552dc7,_0xc41866);break;case _0xaf22('0x1b'):zoho[_0x4dcf69](_0x5d1a72,_0x45b879,_0x4da77e,_0x1009d3,_0x29f457,_0x552dc7,_0xc41866);break;case _0xaf22('0xa'):desk[_0x4dcf69](_0x5d1a72,_0x45b879,_0x4da77e,_0x1009d3,_0x29f457,_0x552dc7,_0xc41866);break;case _0xaf22('0xb'):vtiger[_0x4dcf69](_0x5d1a72,_0x45b879,_0x4da77e,_0x1009d3,_0x29f457,_0x552dc7,_0xc41866);break;case'freshsales':freshsales['cs'](_0x5d1a72,_0x45b879,_0x4da77e,_0x1009d3,_0x29f457,_0x552dc7,_0xc41866,_0x4dcf69);break;case'servicenow':servicenow['cs'](_0x5d1a72,_0x45b879,_0x4da77e,_0x1009d3,_0x29f457,_0x552dc7,_0xc41866,_0x4dcf69);break;case _0xaf22('0xc'):dynamics365['cs'](_0x5d1a72,_0x45b879,_0x4da77e,_0x1009d3,_0x29f457,_0x552dc7,_0xc41866,_0x4dcf69);break;default:console[_0xaf22('0x18')](_0xaf22('0x1c'));}}else{_0x2d8caa=require('../../../../config/logger')(_0x5d1a72[_0xaf22('0xf')]['toLowerCase']());_0x2d8caa[_0xaf22('0x1d')]('[EXEC]',util['format'](_0xaf22('0x1e'),_0x5d1a72[_0xaf22('0xf')][_0xaf22('0x10')](),_0x5d1a72[_0xaf22('0x14')]));}}else{_0x2d8caa=require('../../../../config/logger')(_0x5d1a72[_0xaf22('0xf')][_0xaf22('0x10')]());_0x2d8caa[_0xaf22('0x1d')]('[EXEC]',util[_0xaf22('0x1f')]('%s\x20account\x20#%s\x20not\x20found',_0x5d1a72['data1'][_0xaf22('0x10')](),_0x5d1a72[_0xaf22('0x11')]));}}else{}}catch(_0x18c805){console[_0xaf22('0x1d')](_0x18c805);}}}}; \ No newline at end of file +var _0x7cee=['sugarcrm','freshdesk','zoho','desk','vtiger','freshsales','servicenow','exec','includes','data1','toLowerCase','find','Configurations','data3','queue','routeId','EVENT\x20UNKNOWN','unmanaged','unknown\x20integration','../../../../config/logger','error','format','[EXEC]','lodash','util','./zendesk','./salesforce','./sugarcrm','./zoho','./desk','./vtiger','./servicenow','./dynamics365','./freshsales','zendesk','salesforce'];(function(_0x529bce,_0x9f1c4c){var _0x46920c=function(_0x24c213){while(--_0x24c213){_0x529bce['push'](_0x529bce['shift']());}};_0x46920c(++_0x9f1c4c);}(_0x7cee,0x15b));var _0xe7ce=function(_0x29c3b2,_0x3c12ac){_0x29c3b2=_0x29c3b2-0x0;var _0x4b3aa7=_0x7cee[_0x29c3b2];return _0x4b3aa7;};'use strict';var _=require(_0xe7ce('0x0'));var util=require(_0xe7ce('0x1'));var zendesk=require(_0xe7ce('0x2'));var salesforce=require(_0xe7ce('0x3'));var sugarcrm=require(_0xe7ce('0x4'));var freshdesk=require('./freshdesk');var zoho=require(_0xe7ce('0x5'));var desk=require(_0xe7ce('0x6'));var vtiger=require(_0xe7ce('0x7'));var servicenow=require(_0xe7ce('0x8'));var dynamics365=require(_0xe7ce('0x9'));var freshsales=require(_0xe7ce('0xa'));var integrations=[_0xe7ce('0xb'),_0xe7ce('0xc'),_0xe7ce('0xd'),_0xe7ce('0xe'),_0xe7ce('0xf'),_0xe7ce('0x10'),_0xe7ce('0x11'),'dynamics365',_0xe7ce('0x12'),_0xe7ce('0x13')];exports[_0xe7ce('0x14')]=function(_0x1a0c89,_0x42a089,_0x1be863,_0x4ddc59,_0x55f4f6,_0x1daecb){if(_0x1be863){if(_[_0xe7ce('0x15')](integrations,_0x1a0c89[_0xe7ce('0x16')][_0xe7ce('0x17')]())){try{var _0xdaba4f=null;var _0x72c206='';var _0xdfc19d=_0x1be863[_0x1a0c89['data1'][_0xe7ce('0x17')]()];if(_0xdfc19d){var _0x5d39f0=_0xdfc19d[_0x1a0c89['data2']];if(_0x5d39f0){var _0x3782c4=_[_0xe7ce('0x18')](_0x5d39f0[_0xe7ce('0x19')],{'id':parseInt(_0x1a0c89[_0xe7ce('0x1a')],0xa)});if(_0x3782c4){if(_0x4ddc59){if(_0x55f4f6&&_0x42a089[_0xe7ce('0x1b')]){_0x72c206=_0xe7ce('0x1b');}else if(_0x42a089[_0xe7ce('0x1c')]){_0x72c206='outbound';}else{console['log'](_0xe7ce('0x1d'),_0x42a089);}}else{_0x72c206=_0xe7ce('0x1e');}switch(_0x1a0c89['data1'][_0xe7ce('0x17')]()){case _0xe7ce('0xb'):zendesk[_0x72c206](_0x1a0c89,_0x42a089,_0x3782c4,_0x4ddc59,_0x55f4f6,_0x5d39f0,_0x1daecb);break;case _0xe7ce('0xc'):salesforce[_0x72c206](_0x1a0c89,_0x42a089,_0x3782c4,_0x4ddc59,_0x55f4f6,_0x5d39f0,_0x1daecb);break;case _0xe7ce('0xd'):sugarcrm[_0x72c206](_0x1a0c89,_0x42a089,_0x3782c4,_0x4ddc59,_0x55f4f6,_0x5d39f0,_0x1daecb);break;case'freshdesk':freshdesk[_0x72c206](_0x1a0c89,_0x42a089,_0x3782c4,_0x4ddc59,_0x55f4f6,_0x5d39f0,_0x1daecb);break;case _0xe7ce('0xf'):zoho[_0x72c206](_0x1a0c89,_0x42a089,_0x3782c4,_0x4ddc59,_0x55f4f6,_0x5d39f0,_0x1daecb);break;case _0xe7ce('0x10'):desk[_0x72c206](_0x1a0c89,_0x42a089,_0x3782c4,_0x4ddc59,_0x55f4f6,_0x5d39f0,_0x1daecb);break;case _0xe7ce('0x11'):vtiger[_0x72c206](_0x1a0c89,_0x42a089,_0x3782c4,_0x4ddc59,_0x55f4f6,_0x5d39f0,_0x1daecb);break;case _0xe7ce('0x12'):freshsales['cs'](_0x1a0c89,_0x42a089,_0x3782c4,_0x4ddc59,_0x55f4f6,_0x5d39f0,_0x1daecb,_0x72c206);break;case'servicenow':servicenow['cs'](_0x1a0c89,_0x42a089,_0x3782c4,_0x4ddc59,_0x55f4f6,_0x5d39f0,_0x1daecb,_0x72c206);break;case'dynamics365':dynamics365['cs'](_0x1a0c89,_0x42a089,_0x3782c4,_0x4ddc59,_0x55f4f6,_0x5d39f0,_0x1daecb,_0x72c206);break;default:console['log'](_0xe7ce('0x1f'));}}else{_0xdaba4f=require(_0xe7ce('0x20'))(_0x1a0c89[_0xe7ce('0x16')][_0xe7ce('0x17')]());_0xdaba4f[_0xe7ce('0x21')]('[EXEC]',util[_0xe7ce('0x22')]('%s\x20configuration\x20#%s\x20not\x20found',_0x1a0c89[_0xe7ce('0x16')][_0xe7ce('0x17')](),_0x1a0c89[_0xe7ce('0x1a')]));}}else{_0xdaba4f=require(_0xe7ce('0x20'))(_0x1a0c89['data1']['toLowerCase']());_0xdaba4f['error'](_0xe7ce('0x23'),util[_0xe7ce('0x22')]('%s\x20account\x20#%s\x20not\x20found',_0x1a0c89[_0xe7ce('0x16')][_0xe7ce('0x17')](),_0x1a0c89['data2']));}}else{}}catch(_0x549a4a){console['error'](_0x549a4a);}}}}; \ 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 0d35d87..2659686 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 _0x84d7=['none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','trigger:browser:url','%s/%s/e','unmanaged','toUpperCase','lastevent','request-promise','moment','bluebird','md5','jsforce','ioredis','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','emit','assign','getString','Subjects','Descriptions','ticketType','Task','ActivityDate','utc','IsReminderSet','endUserType','WhoId','account','WhatId','Case','contact','ContactId','AccountId','leadId','Association\x20between\x20Case\x20and\x20Lead\x20skipped','create','isNil','validateEmail','find','execute','then','info','Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','$or','sobject','additionalSearchLead','Lead','additionalSearchAccount','Account','length','Contact','lead','first','attributes','type','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','format','Caller\x20-\x20%s','No\x20Company','upperFirst','forEach','includes','string','picklist','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','password','concat','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','login','username','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','uniqueid','email','calleridname','calleridnum','queue','[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','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','outbound','recordingFormat'];(function(_0x3aeb36,_0x312dc9){var _0xa2ef21=function(_0x50a46b){while(--_0x50a46b){_0x3aeb36['push'](_0x3aeb36['shift']());}};_0xa2ef21(++_0x312dc9);}(_0x84d7,0x192));var _0x784d=function(_0x59d89e,_0x55edf5){_0x59d89e=_0x59d89e-0x0;var _0x554e93=_0x84d7[_0x59d89e];return _0x554e93;};'use strict';var _=require('lodash');var rp=require(_0x784d('0x0'));var moment=require(_0x784d('0x1'));var BPromise=require(_0x784d('0x2'));var md5=require(_0x784d('0x3'));var jsforce=require(_0x784d('0x4'));var util=require('util');var Redis=require(_0x784d('0x5'));var intUtil=require('./util');var config=require(_0x784d('0x6'));var logger=require(_0x784d('0x7'))('salesforce');config[_0x784d('0x8')]=_[_0x784d('0x9')](config[_0x784d('0x8')],{'host':_0x784d('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x784d('0x8')]));function emit(_0x1f3782,_0x5dba72,_0x1a42e9){io['to'](_0x1f3782)[_0x784d('0xb')](_0x5dba72,_0x1a42e9);}function getTicket(_0x180b62,_0x69a76d,_0x298627,_0x487fee,_0x12df92,_0x5b0b28,_0x3ee930,_0x4acfa2){var _0x210b3d=Object[_0x784d('0xc')]({},{'OwnerId':_0x69a76d['id'],'Subject':intUtil[_0x784d('0xd')](_0x487fee[_0x784d('0xe')],_0x12df92,'\x20'),'Description':intUtil[_0x784d('0xd')](_0x487fee[_0x784d('0xf')],_0x12df92,'\x0a')},getCustomFields(_0x5b0b28,_0x12df92));if(_0x298627){if(_0x487fee[_0x784d('0x10')]===_0x784d('0x11')){_0x210b3d[_0x784d('0x12')]=moment[_0x784d('0x13')]();_0x210b3d[_0x784d('0x14')]=![];_0x210b3d['IsRecurrence']=![];if(_0x298627[_0x784d('0x15')]==='contact'||_0x298627[_0x784d('0x15')]==='lead'){_0x210b3d[_0x784d('0x16')]=_0x298627['id'];}else if(_0x298627['endUserType']===_0x784d('0x17')){_0x210b3d[_0x784d('0x18')]=_0x298627['id'];}}else if(_0x487fee[_0x784d('0x10')]===_0x784d('0x19')){if(_0x298627['endUserType']===_0x784d('0x1a')){_0x210b3d[_0x784d('0x1b')]=_0x298627['id'];}else if(_0x298627['endUserType']===_0x784d('0x17')){_0x210b3d[_0x784d('0x1c')]=_0x298627['id'];}else if(_0x298627['endUserType']==='lead'&&_0x487fee[_0x784d('0x1d')]){_0x210b3d[_0x487fee['leadId']]=_0x298627['id'];}else{logger['info'](_0x784d('0x1e'));}}}return _0x3ee930['sobject'](_0x487fee[_0x784d('0x10')])[_0x784d('0x1f')](_0x210b3d);}function getUser(_0x3149b1,_0x10c552,_0x3b2903){if(!_[_0x784d('0x20')](_0x10c552)&&intUtil[_0x784d('0x21')](_0x10c552)){var _0xcec530={'Email':_0x10c552};var _0x4ff9a2={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x3b2903['sobject']('User')[_0x784d('0x22')](_0xcec530,_0x4ff9a2)[_0x784d('0x23')]()[_0x784d('0x24')](function(_0x5de2ac){if(_0x5de2ac['length']){var _0x1078a4=_[_0x784d('0x22')](_0x5de2ac,function(_0x51666d){return _0x51666d['Email']===_0x10c552;});if(_0x1078a4){logger[_0x784d('0x25')](_0x784d('0x26'),_0x10c552);return BPromise[_0x784d('0x27')]({'id':_0x1078a4['Id'],'name':_0x1078a4[_0x784d('0x28')]});}}else{logger['info'](_0x784d('0x29'),_0x10c552);return _0x3b2903[_0x784d('0x2a')]()[_0x784d('0x24')](function(_0x319814){return BPromise[_0x784d('0x27')]({'id':_0x319814[_0x784d('0x2b')],'name':_0x319814['display_name']});});}});}else{logger[_0x784d('0x25')](_0x784d('0x29'),_0x10c552);return _0x3b2903[_0x784d('0x2a')]()[_0x784d('0x24')](function(_0x185608){return BPromise['resolve']({'id':_0x185608[_0x784d('0x2b')],'name':_0x185608[_0x784d('0x2c')]});});}}function getEndUser(_0x352375,_0x466db0,_0x52e1d2,_0x2bd33e,_0x5076dd){var _0x30f809={'$or':{'Phone':_0x2bd33e}};var _0x48d69f={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x784d('0x27')]()[_0x784d('0x24')](function(){logger[_0x784d('0x25')](_0x784d('0x2d'),_0x2bd33e,_0x466db0[_0x784d('0x2e')]);switch(_0x466db0[_0x784d('0x2e')]){case _0x784d('0x2f'):var _0x35644e=_[_0x784d('0x30')](_0x30f809);if(_0x466db0['additionalSearchContact']){var _0x29684d={};_0x29684d[_0x466db0[_0x784d('0x31')]]=_0x2bd33e;_[_0x784d('0x32')](_0x35644e[_0x784d('0x33')],_0x29684d);}return _0x5076dd[_0x784d('0x34')]('Contact')[_0x784d('0x22')](_0x35644e,_0x48d69f)[_0x784d('0x23')]()[_0x784d('0x24')](function(_0x52bfa1){if(_0x52bfa1&&_0x52bfa1['length']){return _0x52bfa1;}else{var _0x26038a=_[_0x784d('0x30')](_0x30f809);if(_0x466db0['additionalSearchLead']){var _0xd430b5={};_0xd430b5[_0x466db0[_0x784d('0x35')]]=_0x2bd33e;_[_0x784d('0x32')](_0x26038a['$or'],_0xd430b5);}return _0x5076dd[_0x784d('0x34')](_0x784d('0x36'))['find'](_0x26038a,_0x48d69f);}});case'account_contact_lead':var _0x5e7dcf=_['cloneDeep'](_0x30f809);if(_0x466db0[_0x784d('0x37')]){var _0x29684d={};_0x29684d[_0x466db0[_0x784d('0x37')]]=_0x2bd33e;_['merge'](_0x5e7dcf[_0x784d('0x33')],_0x29684d);}return _0x5076dd[_0x784d('0x34')](_0x784d('0x38'))['find'](_0x5e7dcf,_0x48d69f)['execute']()['then'](function(_0x25e544){if(_0x25e544&&_0x25e544[_0x784d('0x39')]){return _0x25e544;}else{var _0x9d449d=_[_0x784d('0x30')](_0x30f809);if(_0x466db0[_0x784d('0x31')]){var _0x599def={};_0x599def[_0x466db0[_0x784d('0x31')]]=_0x2bd33e;_[_0x784d('0x32')](_0x9d449d[_0x784d('0x33')],_0x599def);}return _0x5076dd[_0x784d('0x34')]('Contact')[_0x784d('0x22')](_0x9d449d,_0x48d69f)['then'](function(_0x2be62c){if(_0x2be62c&&_0x2be62c[_0x784d('0x39')]){return _0x2be62c;}else{var _0x581cbb=_['cloneDeep'](_0x30f809);if(_0x466db0[_0x784d('0x35')]){var _0x1e3cd3={};_0x1e3cd3[_0x466db0[_0x784d('0x35')]]=_0x2bd33e;_[_0x784d('0x32')](_0x581cbb['$or'],_0x1e3cd3);}return _0x5076dd['sobject'](_0x784d('0x36'))['find'](_0x581cbb,_0x48d69f);}});}});case'contact':var _0x35644e=_['cloneDeep'](_0x30f809);if(_0x466db0[_0x784d('0x31')]){var _0x29684d={};_0x29684d[_0x466db0[_0x784d('0x31')]]=_0x2bd33e;_[_0x784d('0x32')](_0x35644e[_0x784d('0x33')],_0x29684d);}return _0x5076dd[_0x784d('0x34')](_0x784d('0x3a'))[_0x784d('0x22')](_0x35644e,_0x48d69f)[_0x784d('0x23')]();case _0x784d('0x3b'):var _0x41ca71=_['cloneDeep'](_0x30f809);if(_0x466db0['additionalSearchLead']){var _0x29684d={};_0x29684d[_0x466db0[_0x784d('0x35')]]=_0x2bd33e;_[_0x784d('0x32')](_0x41ca71[_0x784d('0x33')],_0x29684d);}return _0x5076dd['sobject'](_0x784d('0x36'))[_0x784d('0x22')](_0x41ca71,_0x48d69f);case'account':var _0x5e7dcf=_[_0x784d('0x30')](_0x30f809);if(_0x466db0['additionalSearchAccount']){var _0x29684d={};_0x29684d[_0x466db0[_0x784d('0x37')]]=_0x2bd33e;_[_0x784d('0x32')](_0x5e7dcf[_0x784d('0x33')],_0x29684d);}return _0x5076dd[_0x784d('0x34')]('Account')['find'](_0x5e7dcf,_0x48d69f);default:return null;}})[_0x784d('0x24')](function(_0x5dc36e){if(_0x5dc36e&&_0x5dc36e[_0x784d('0x39')]){var _0x354342=_[_0x784d('0x3c')](_0x5dc36e);if(_0x354342){return BPromise[_0x784d('0x27')]({'id':_0x354342['Id'],'name':_0x354342[_0x784d('0x28')],'phone':_0x354342['Phone'],'endUserType':_0x354342[_0x784d('0x3d')][_0x784d('0x3e')]['toLowerCase']()});}}})[_0x784d('0x24')](function(_0x56a82d){if(_0x56a82d){logger[_0x784d('0x25')](_0x784d('0x3f'),_0x56a82d[_0x784d('0x15')],_0x2bd33e);return BPromise[_0x784d('0x27')](_0x56a82d);}else{logger['info'](_0x784d('0x40'),_0x2bd33e);var _0x48f897={'Phone':_0x2bd33e};if(_0x466db0[_0x784d('0x41')]){if(_0x466db0[_0x784d('0x41')]===_0x784d('0x1a')){logger[_0x784d('0x25')](_0x784d('0x42'),_0x2bd33e,_0x466db0[_0x784d('0x41')]);_0x48f897[_0x784d('0x43')]=_0x52e1d2!==_0x784d('0x44')?_0x52e1d2:util[_0x784d('0x45')](_0x784d('0x46'),_0x2bd33e);}else if(_0x466db0[_0x784d('0x41')]===_0x784d('0x3b')){logger['info'](_0x784d('0x42'),_0x2bd33e,_0x466db0[_0x784d('0x41')]);_0x48f897[_0x784d('0x43')]=_0x52e1d2!==_0x784d('0x44')?_0x52e1d2:util['format'](_0x784d('0x46'),_0x2bd33e);_0x48f897['Company']=_0x784d('0x47');}else if(_0x466db0[_0x784d('0x41')]===_0x784d('0x17')){logger[_0x784d('0x25')](_0x784d('0x42'),_0x2bd33e,_0x466db0['moduleCreate']);_0x48f897[_0x784d('0x28')]=_0x52e1d2!==_0x784d('0x44')?_0x52e1d2:util['format'](_0x784d('0x46'),_0x2bd33e);}else{return null;}}return _0x5076dd[_0x784d('0x34')](_[_0x784d('0x48')](_0x466db0[_0x784d('0x41')]))[_0x784d('0x1f')](_0x48f897)[_0x784d('0x24')](function(_0x3c8e61){return BPromise[_0x784d('0x27')]({'id':_0x3c8e61['id'],'endUserType':_0x466db0['moduleCreate']});});}});}function getCustomFields(_0x43df76,_0xe92b48){var _0x64c86={};if(_0x43df76['length']>0x0){_[_0x784d('0x49')](_0x43df76,function(_0x544d93){if(_[_0x784d('0x4a')]([_0x784d('0x4b'),_0x784d('0x4c')],_0x544d93[_0x784d('0x3e')])&&_0x544d93[_0x784d('0x4d')]){_0x64c86[_0x544d93[_0x784d('0x4d')]]=_0x544d93[_0x784d('0x4e')][_0x784d('0x4f')]();}else if(_0x544d93[_0x784d('0x3e')]===_0x784d('0x50')&&_0x544d93[_0x784d('0x51')]&&_0x544d93['idField']){_0xe92b48[_0x544d93[_0x784d('0x51')]]&&(_0x64c86[_0x544d93['idField']]=_0xe92b48[_0x544d93[_0x784d('0x51')]][_0x784d('0x4f')]());}else if(_0x544d93[_0x784d('0x3e')]===_0x784d('0x52')&&_0x544d93['Variable']&&_0x544d93[_0x784d('0x53')][_0x784d('0x54')]&&_0x544d93[_0x784d('0x4d')]){_0xe92b48[_0x544d93[_0x784d('0x53')][_0x784d('0x54')][_0x784d('0x55')]()]&&(_0x64c86[_0x544d93[_0x784d('0x4d')]]=_0xe92b48[_0x544d93[_0x784d('0x53')][_0x784d('0x54')][_0x784d('0x55')]()][_0x784d('0x4f')]());}});}return _0x64c86;}function getConnection(_0x359f8d){var _0x25a8e4=_0x359f8d[_0x784d('0x56')][_0x784d('0x57')](_0x359f8d[_0x784d('0x58')]);var _0xcf1c60=new jsforce[(_0x784d('0x59'))]({'oauth2':{'loginUrl':_0x359f8d[_0x784d('0x5a')]||_0x784d('0x5b'),'clientId':_0x359f8d[_0x784d('0x5c')],'clientSecret':_0x359f8d[_0x784d('0x5d')]}});return _0xcf1c60[_0x784d('0x5e')](_0x359f8d[_0x784d('0x5f')],_0x25a8e4)[_0x784d('0x24')](function(){logger[_0x784d('0x25')]('Connection\x20established.');return _0xcf1c60;});}exports['queue']=function(_0x46d1c1,_0x71b380,_0x35ab95,_0x57e56a,_0x458418,_0x38d9bc){var _0x5a9bd1,_0xf17f34,_0x27ba96,_0x43e3d6;_0x38d9bc['serverUrl']=intUtil[_0x784d('0x60')](_0x38d9bc[_0x784d('0x61')]);_0x38d9bc['remoteUri']=intUtil[_0x784d('0x60')](_0x38d9bc['remoteUri']);if(_0x458418&&_0x458418[_0x784d('0x62')]){logger[_0x784d('0x25')]('[QUEUE]',_0x784d('0x63'));_0x71b380[_0x784d('0x64')]=util[_0x784d('0x45')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x38d9bc['serverUrl'],_0x71b380['uniqueid'],md5(_0x71b380[_0x784d('0x65')]));}else{_0x71b380[_0x784d('0x64')]='';}return getConnection(_0x38d9bc)[_0x784d('0x24')](function(_0x297b3f){_0x43e3d6=_0x297b3f;return getUser(_0x38d9bc,_0x57e56a[_0x784d('0x66')],_0x43e3d6);})['then'](function(_0xb3d249){_0x5a9bd1=_0xb3d249;return getEndUser(_0x38d9bc,_0x35ab95,_0x71b380[_0x784d('0x67')],_0x71b380[_0x784d('0x68')],_0x43e3d6);})[_0x784d('0x24')](function(_0x379bd5){_0xf17f34=_0x379bd5;return getTicket(_0x38d9bc,_0x5a9bd1,_0xf17f34,_0x35ab95,_0x71b380,_0x35ab95['Fields'],_0x43e3d6,_0x784d('0x69'));})[_0x784d('0x24')](function(_0x16a330){_0x27ba96=_0x16a330;logger['info'](_0x784d('0x6a'),_0x27ba96['id']);logger['info'](_0x784d('0x6b'),_0x27ba96['id'],_0x57e56a[_0x784d('0x54')],_0x38d9bc[_0x784d('0x3e')]);switch(_0x38d9bc[_0x784d('0x3e')]){case _0x784d('0x6c'):emit(util[_0x784d('0x45')](_0x784d('0x6d'),_0x57e56a[_0x784d('0x54')]),_0x784d('0x6e'),{'recordId':_0x27ba96['id']});break;case _0x784d('0x6f'):emit(util['format'](_0x784d('0x6d'),_0x57e56a[_0x784d('0x54')]),'trigger:browser:url',{'uri':util['format']('%s/%s/e',_0x43e3d6[_0x784d('0x70')],_0x27ba96['id'])});break;default:logger[_0x784d('0x71')](_0x784d('0x72'));}})[_0x784d('0x73')](function(_0x23caf1){logger[_0x784d('0x71')]('[QUEUE]',_0x23caf1);});};exports[_0x784d('0x74')]=function(_0x2a98dc,_0x15a8f5,_0x3048c4,_0x1a934f,_0x1d97cb,_0x2e0a12,_0x683cb9){var _0x267f0e,_0x40ecc5,_0x3edda1,_0x49db30;_0x2e0a12[_0x784d('0x61')]=intUtil[_0x784d('0x60')](_0x2e0a12[_0x784d('0x61')]);_0x2e0a12[_0x784d('0x5a')]=intUtil[_0x784d('0x60')](_0x2e0a12['remoteUri']);if(_0x683cb9&&_0x683cb9[_0x784d('0x75')]&&_0x683cb9[_0x784d('0x75')]!==_0x784d('0x76')){logger[_0x784d('0x25')](_0x784d('0x77'),_0x784d('0x63'));_0x15a8f5['recordingURL']=util[_0x784d('0x45')](_0x784d('0x78'),_0x2e0a12[_0x784d('0x61')],_0x15a8f5[_0x784d('0x65')],md5(_0x15a8f5[_0x784d('0x65')]));}return getConnection(_0x2e0a12)[_0x784d('0x24')](function(_0x1d9a5c){_0x49db30=_0x1d9a5c;return getUser(_0x2e0a12,_0x1a934f[_0x784d('0x66')],_0x49db30);})[_0x784d('0x24')](function(_0x11b94e){_0x267f0e=_0x11b94e;return getEndUser(_0x2e0a12,_0x3048c4,_0x15a8f5[_0x784d('0x79')],_0x15a8f5[_0x784d('0x7a')],_0x49db30);})[_0x784d('0x24')](function(_0x396811){_0x40ecc5=_0x396811;return getTicket(_0x2e0a12,_0x267f0e,_0x40ecc5,_0x3048c4,_0x15a8f5,_0x3048c4['Fields'],_0x49db30,_0x784d('0x74'));})[_0x784d('0x24')](function(_0x4a6757){_0x3edda1=_0x4a6757;logger[_0x784d('0x25')](_0x784d('0x7b'),_0x3edda1['id']);logger[_0x784d('0x25')](_0x784d('0x7c'),_0x3edda1['id'],_0x1a934f[_0x784d('0x54')],_0x2e0a12[_0x784d('0x3e')]);switch(_0x2e0a12[_0x784d('0x3e')]){case'integrationTab':emit(util[_0x784d('0x45')](_0x784d('0x6d'),_0x1a934f[_0x784d('0x54')]),_0x784d('0x6e'),{'recordId':_0x3edda1['id']});break;case _0x784d('0x6f'):emit(util['format']('user:%s',_0x1a934f[_0x784d('0x54')]),_0x784d('0x7d'),{'uri':util[_0x784d('0x45')](_0x784d('0x7e'),_0x49db30[_0x784d('0x70')],_0x3edda1['id'])});break;default:logger['error'](_0x784d('0x77'),'Salesforce\x20account\x20type\x20not\x20recognized');}})[_0x784d('0x73')](function(_0x4540d1){logger['error'](_0x784d('0x77'),_0x4540d1);});};exports[_0x784d('0x7f')]=function(_0x240029,_0x4ec9d2,_0x5ae87f,_0x5746ea,_0xf3ecbe,_0x201a1c){var _0x5f3883,_0x5e5a9e,_0x481105,_0x18c354;_0x201a1c[_0x784d('0x61')]=intUtil[_0x784d('0x60')](_0x201a1c[_0x784d('0x61')]);_0x201a1c[_0x784d('0x5a')]=intUtil[_0x784d('0x60')](_0x201a1c[_0x784d('0x5a')]);if(_0xf3ecbe&&_0xf3ecbe[_0x784d('0x62')]){logger[_0x784d('0x25')]('['+_0x4ec9d2['lastevent']['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x4ec9d2[_0x784d('0x64')]=util['format'](_0x784d('0x78'),_0x201a1c['serverUrl'],_0x4ec9d2[_0x784d('0x65')],md5(_0x4ec9d2[_0x784d('0x65')]));}else{_0x4ec9d2[_0x784d('0x64')]='';}return getConnection(_0x201a1c)[_0x784d('0x24')](function(_0x1e6072){_0x18c354=_0x1e6072;if(!_[_0x784d('0x20')](_0x5746ea)){return getUser(_0x201a1c,_0x5746ea[_0x784d('0x54')],_0x18c354);}else{return getUser(_0x201a1c,null,_0x18c354);}})[_0x784d('0x24')](function(_0xb0ca19){_0x5f3883=_0xb0ca19;return getEndUser(_0x201a1c,_0x5ae87f,_0x4ec9d2['calleridname'],_0x4ec9d2['calleridnum'],_0x18c354);})[_0x784d('0x24')](function(_0x43498c){_0x5e5a9e=_0x43498c;return getTicket(_0x201a1c,_0x5f3883,_0x5e5a9e,_0x5ae87f,_0x4ec9d2,_0x5ae87f['Fields'],_0x18c354);})[_0x784d('0x24')](function(_0x479386){_0x481105=_0x479386;logger[_0x784d('0x25')]('['+_0x4ec9d2['lastevent'][_0x784d('0x80')]()+']\x20Ticket\x20%s\x20created.',_0x481105['id']);logger[_0x784d('0x25')]('['+_0x4ec9d2[_0x784d('0x81')]['toUpperCase']()+']\x20Integration\x20account\x20type\x20%s.',_0x201a1c[_0x784d('0x3e')]);})['catch'](function(_0x47ee37){logger[_0x784d('0x71')]('['+_0x4ec9d2[_0x784d('0x81')][_0x784d('0x80')]()+']',_0x47ee37);});}; \ No newline at end of file +var _0xea9b=['Contact','Lead','first','Name','Phone','attributes','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','format','Caller\x20-\x20%s','Company','No\x20Company','','upperFirst','create','forEach','includes','string','idField','content','toString','variable','variableName','customVariable','Variable','name','password','concat','securityToken','remoteUri','https://login.salesforce.com','clientId','login','username','queue','serverUrl','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','[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','trigger:browser:url','%s/%s/e','instanceUrl','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','error','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','Fields','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','newTab','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','toUpperCase','isNil','calleridnum',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','bluebird','jsforce','util','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','localhost','emit','assign','getString','Subjects','Descriptions','ticketType','ActivityDate','utc','IsRecurrence','endUserType','contact','WhoId','account','WhatId','Case','ContactId','AccountId','lead','leadId','info','sobject','validateEmail','User','find','execute','Email','Agent\x20%s\x20found.','resolve','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','then','user_id','display_name','additionalSearchContact','merge','$or','length','cloneDeep','additionalSearchLead','account_contact_lead','additionalSearchAccount','Account'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xea9b,0xd4));var _0xbea9=function(_0x5300b6,_0x4a5846){_0x5300b6=_0x5300b6-0x0;var _0x58980e=_0xea9b[_0x5300b6];return _0x58980e;};'use strict';var _=require(_0xbea9('0x0'));var rp=require(_0xbea9('0x1'));var moment=require(_0xbea9('0x2'));var BPromise=require(_0xbea9('0x3'));var md5=require('md5');var jsforce=require(_0xbea9('0x4'));var util=require(_0xbea9('0x5'));var Redis=require(_0xbea9('0x6'));var intUtil=require(_0xbea9('0x7'));var config=require(_0xbea9('0x8'));var logger=require(_0xbea9('0x9'))(_0xbea9('0xa'));config[_0xbea9('0xb')]=_[_0xbea9('0xc')](config['redis'],{'host':_0xbea9('0xd'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xbea9('0xb')]));function emit(_0x52ff40,_0x419da9,_0x3d0fa6){io['to'](_0x52ff40)[_0xbea9('0xe')](_0x419da9,_0x3d0fa6);}function getTicket(_0xfa7dbe,_0x666743,_0x1c6b84,_0x5e9a89,_0x1cfc7c,_0x4d4abd,_0x4b524f,_0xccbc2b){var _0x570f3e=Object[_0xbea9('0xf')]({},{'OwnerId':_0x666743['id'],'Subject':intUtil[_0xbea9('0x10')](_0x5e9a89[_0xbea9('0x11')],_0x1cfc7c,'\x20'),'Description':intUtil['getString'](_0x5e9a89[_0xbea9('0x12')],_0x1cfc7c,'\x0a')},getCustomFields(_0x4d4abd,_0x1cfc7c));if(_0x1c6b84){if(_0x5e9a89[_0xbea9('0x13')]==='Task'){_0x570f3e[_0xbea9('0x14')]=moment[_0xbea9('0x15')]();_0x570f3e['IsReminderSet']=![];_0x570f3e[_0xbea9('0x16')]=![];if(_0x1c6b84[_0xbea9('0x17')]===_0xbea9('0x18')||_0x1c6b84['endUserType']==='lead'){_0x570f3e[_0xbea9('0x19')]=_0x1c6b84['id'];}else if(_0x1c6b84['endUserType']===_0xbea9('0x1a')){_0x570f3e[_0xbea9('0x1b')]=_0x1c6b84['id'];}}else if(_0x5e9a89[_0xbea9('0x13')]===_0xbea9('0x1c')){if(_0x1c6b84['endUserType']===_0xbea9('0x18')){_0x570f3e[_0xbea9('0x1d')]=_0x1c6b84['id'];}else if(_0x1c6b84[_0xbea9('0x17')]===_0xbea9('0x1a')){_0x570f3e[_0xbea9('0x1e')]=_0x1c6b84['id'];}else if(_0x1c6b84[_0xbea9('0x17')]===_0xbea9('0x1f')&&_0x5e9a89[_0xbea9('0x20')]){_0x570f3e[_0x5e9a89[_0xbea9('0x20')]]=_0x1c6b84['id'];}else{logger[_0xbea9('0x21')]('Association\x20between\x20Case\x20and\x20Lead\x20skipped');}}}return _0x4b524f[_0xbea9('0x22')](_0x5e9a89[_0xbea9('0x13')])['create'](_0x570f3e);}function getUser(_0x2e090c,_0x5f04ac,_0x2d0f7a){if(!_['isNil'](_0x5f04ac)&&intUtil[_0xbea9('0x23')](_0x5f04ac)){var _0x480418={'Email':_0x5f04ac};var _0x46f7ea={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x2d0f7a['sobject'](_0xbea9('0x24'))[_0xbea9('0x25')](_0x480418,_0x46f7ea)[_0xbea9('0x26')]()['then'](function(_0x56914b){if(_0x56914b['length']){var _0x282263=_['find'](_0x56914b,function(_0x22aee4){return _0x22aee4[_0xbea9('0x27')]===_0x5f04ac;});if(_0x282263){logger[_0xbea9('0x21')](_0xbea9('0x28'),_0x5f04ac);return BPromise[_0xbea9('0x29')]({'id':_0x282263['Id'],'name':_0x282263['Name']});}}else{logger['info'](_0xbea9('0x2a'),_0x5f04ac);return _0x2d0f7a[_0xbea9('0x2b')]()[_0xbea9('0x2c')](function(_0x4e3101){return BPromise[_0xbea9('0x29')]({'id':_0x4e3101[_0xbea9('0x2d')],'name':_0x4e3101[_0xbea9('0x2e')]});});}});}else{logger['info'](_0xbea9('0x2a'),_0x5f04ac);return _0x2d0f7a['identity']()['then'](function(_0x2488c0){return BPromise[_0xbea9('0x29')]({'id':_0x2488c0[_0xbea9('0x2d')],'name':_0x2488c0[_0xbea9('0x2e')]});});}}function getEndUser(_0x105c88,_0x3b1fc8,_0x4896c9,_0x6108b2,_0x42eece){var _0x37872c={'$or':{'Phone':_0x6108b2}};var _0x314953={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xbea9('0x29')]()['then'](function(){logger[_0xbea9('0x21')]('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x6108b2,_0x3b1fc8['moduleSearch']);switch(_0x3b1fc8['moduleSearch']){case'contact_lead':var _0x309217=_['cloneDeep'](_0x37872c);if(_0x3b1fc8[_0xbea9('0x2f')]){var _0x58b787={};_0x58b787[_0x3b1fc8[_0xbea9('0x2f')]]=_0x6108b2;_[_0xbea9('0x30')](_0x309217[_0xbea9('0x31')],_0x58b787);}return _0x42eece['sobject']('Contact')[_0xbea9('0x25')](_0x309217,_0x314953)[_0xbea9('0x26')]()[_0xbea9('0x2c')](function(_0x4cc36f){if(_0x4cc36f&&_0x4cc36f[_0xbea9('0x32')]){return _0x4cc36f;}else{var _0x555445=_[_0xbea9('0x33')](_0x37872c);if(_0x3b1fc8['additionalSearchLead']){var _0x8adb6d={};_0x8adb6d[_0x3b1fc8[_0xbea9('0x34')]]=_0x6108b2;_['merge'](_0x555445['$or'],_0x8adb6d);}return _0x42eece[_0xbea9('0x22')]('Lead')[_0xbea9('0x25')](_0x555445,_0x314953);}});case _0xbea9('0x35'):var _0x2587fd=_[_0xbea9('0x33')](_0x37872c);if(_0x3b1fc8[_0xbea9('0x36')]){var _0x58b787={};_0x58b787[_0x3b1fc8['additionalSearchAccount']]=_0x6108b2;_[_0xbea9('0x30')](_0x2587fd[_0xbea9('0x31')],_0x58b787);}return _0x42eece[_0xbea9('0x22')](_0xbea9('0x37'))['find'](_0x2587fd,_0x314953)[_0xbea9('0x26')]()['then'](function(_0x19d1a8){if(_0x19d1a8&&_0x19d1a8[_0xbea9('0x32')]){return _0x19d1a8;}else{var _0x3a4a9b=_[_0xbea9('0x33')](_0x37872c);if(_0x3b1fc8['additionalSearchContact']){var _0x315cb0={};_0x315cb0[_0x3b1fc8['additionalSearchContact']]=_0x6108b2;_[_0xbea9('0x30')](_0x3a4a9b[_0xbea9('0x31')],_0x315cb0);}return _0x42eece['sobject'](_0xbea9('0x38'))[_0xbea9('0x25')](_0x3a4a9b,_0x314953)[_0xbea9('0x2c')](function(_0x370a30){if(_0x370a30&&_0x370a30[_0xbea9('0x32')]){return _0x370a30;}else{var _0x70de1=_[_0xbea9('0x33')](_0x37872c);if(_0x3b1fc8[_0xbea9('0x34')]){var _0x4ab968={};_0x4ab968[_0x3b1fc8['additionalSearchLead']]=_0x6108b2;_['merge'](_0x70de1['$or'],_0x4ab968);}return _0x42eece[_0xbea9('0x22')]('Lead')[_0xbea9('0x25')](_0x70de1,_0x314953);}});}});case _0xbea9('0x18'):var _0x309217=_[_0xbea9('0x33')](_0x37872c);if(_0x3b1fc8[_0xbea9('0x2f')]){var _0x58b787={};_0x58b787[_0x3b1fc8['additionalSearchContact']]=_0x6108b2;_[_0xbea9('0x30')](_0x309217['$or'],_0x58b787);}return _0x42eece[_0xbea9('0x22')]('Contact')[_0xbea9('0x25')](_0x309217,_0x314953)[_0xbea9('0x26')]();case _0xbea9('0x1f'):var _0x9109ce=_['cloneDeep'](_0x37872c);if(_0x3b1fc8['additionalSearchLead']){var _0x58b787={};_0x58b787[_0x3b1fc8[_0xbea9('0x34')]]=_0x6108b2;_[_0xbea9('0x30')](_0x9109ce['$or'],_0x58b787);}return _0x42eece['sobject'](_0xbea9('0x39'))[_0xbea9('0x25')](_0x9109ce,_0x314953);case'account':var _0x2587fd=_[_0xbea9('0x33')](_0x37872c);if(_0x3b1fc8[_0xbea9('0x36')]){var _0x58b787={};_0x58b787[_0x3b1fc8[_0xbea9('0x36')]]=_0x6108b2;_['merge'](_0x2587fd[_0xbea9('0x31')],_0x58b787);}return _0x42eece[_0xbea9('0x22')]('Account')[_0xbea9('0x25')](_0x2587fd,_0x314953);default:return null;}})['then'](function(_0x4602f3){if(_0x4602f3&&_0x4602f3[_0xbea9('0x32')]){var _0x4f2c52=_[_0xbea9('0x3a')](_0x4602f3);if(_0x4f2c52){return BPromise['resolve']({'id':_0x4f2c52['Id'],'name':_0x4f2c52[_0xbea9('0x3b')],'phone':_0x4f2c52[_0xbea9('0x3c')],'endUserType':_0x4f2c52[_0xbea9('0x3d')][_0xbea9('0x3e')][_0xbea9('0x3f')]()});}}})[_0xbea9('0x2c')](function(_0x136dee){if(_0x136dee){logger['info'](_0xbea9('0x40'),_0x136dee[_0xbea9('0x17')],_0x6108b2);return BPromise['resolve'](_0x136dee);}else{logger[_0xbea9('0x21')](_0xbea9('0x41'),_0x6108b2);var _0xd0cb4f={'Phone':_0x6108b2};if(_0x3b1fc8[_0xbea9('0x42')]){if(_0x3b1fc8[_0xbea9('0x42')]===_0xbea9('0x18')){logger[_0xbea9('0x21')](_0xbea9('0x43'),_0x6108b2,_0x3b1fc8['moduleCreate']);_0xd0cb4f[_0xbea9('0x44')]=_0x4896c9!==''?_0x4896c9:util[_0xbea9('0x45')](_0xbea9('0x46'),_0x6108b2);}else if(_0x3b1fc8[_0xbea9('0x42')]==='lead'){logger[_0xbea9('0x21')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x6108b2,_0x3b1fc8[_0xbea9('0x42')]);_0xd0cb4f[_0xbea9('0x44')]=_0x4896c9!==''?_0x4896c9:util[_0xbea9('0x45')](_0xbea9('0x46'),_0x6108b2);_0xd0cb4f[_0xbea9('0x47')]=_0xbea9('0x48');}else if(_0x3b1fc8[_0xbea9('0x42')]===_0xbea9('0x1a')){logger[_0xbea9('0x21')](_0xbea9('0x43'),_0x6108b2,_0x3b1fc8[_0xbea9('0x42')]);_0xd0cb4f[_0xbea9('0x3b')]=_0x4896c9!==_0xbea9('0x49')?_0x4896c9:util[_0xbea9('0x45')](_0xbea9('0x46'),_0x6108b2);}else{return null;}}return _0x42eece[_0xbea9('0x22')](_[_0xbea9('0x4a')](_0x3b1fc8['moduleCreate']))[_0xbea9('0x4b')](_0xd0cb4f)[_0xbea9('0x2c')](function(_0x7ce109){return BPromise['resolve']({'id':_0x7ce109['id'],'endUserType':_0x3b1fc8[_0xbea9('0x42')]});});}});}function getCustomFields(_0x35339e,_0x2f1a4d){var _0x2b5de1={};if(_0x35339e[_0xbea9('0x32')]>0x0){_[_0xbea9('0x4c')](_0x35339e,function(_0x4f727b){if(_[_0xbea9('0x4d')]([_0xbea9('0x4e'),'picklist'],_0x4f727b[_0xbea9('0x3e')])&&_0x4f727b[_0xbea9('0x4f')]){_0x2b5de1[_0x4f727b[_0xbea9('0x4f')]]=_0x4f727b[_0xbea9('0x50')][_0xbea9('0x51')]();}else if(_0x4f727b[_0xbea9('0x3e')]===_0xbea9('0x52')&&_0x4f727b[_0xbea9('0x53')]&&_0x4f727b[_0xbea9('0x4f')]){_0x2f1a4d[_0x4f727b[_0xbea9('0x53')]]&&(_0x2b5de1[_0x4f727b['idField']]=_0x2f1a4d[_0x4f727b['variableName']][_0xbea9('0x51')]());}else if(_0x4f727b['type']===_0xbea9('0x54')&&_0x4f727b[_0xbea9('0x55')]&&_0x4f727b['Variable']['name']&&_0x4f727b['idField']){_0x2f1a4d[_0x4f727b['Variable'][_0xbea9('0x56')]['toLowerCase']()]&&(_0x2b5de1[_0x4f727b[_0xbea9('0x4f')]]=_0x2f1a4d[_0x4f727b[_0xbea9('0x55')]['name'][_0xbea9('0x3f')]()][_0xbea9('0x51')]());}});}return _0x2b5de1;}function getConnection(_0x52eacd){var _0x3f3bcb=_0x52eacd[_0xbea9('0x57')][_0xbea9('0x58')](_0x52eacd[_0xbea9('0x59')]);var _0x1043f6=new jsforce['Connection']({'oauth2':{'loginUrl':_0x52eacd[_0xbea9('0x5a')]||_0xbea9('0x5b'),'clientId':_0x52eacd[_0xbea9('0x5c')],'clientSecret':_0x52eacd['clientSecret']}});return _0x1043f6[_0xbea9('0x5d')](_0x52eacd[_0xbea9('0x5e')],_0x3f3bcb)[_0xbea9('0x2c')](function(){logger[_0xbea9('0x21')]('Connection\x20established.');return _0x1043f6;});}exports[_0xbea9('0x5f')]=function(_0x3d9501,_0x1f692c,_0xb01b18,_0x16bec9,_0x25a169,_0x339305){var _0x5a7917,_0x1875d9,_0x265f29,_0xf72e32;_0x339305[_0xbea9('0x60')]=intUtil[_0xbea9('0x61')](_0x339305[_0xbea9('0x60')]);_0x339305[_0xbea9('0x5a')]=intUtil[_0xbea9('0x61')](_0x339305[_0xbea9('0x5a')]);if(_0x25a169&&_0x25a169[_0xbea9('0x62')]){logger[_0xbea9('0x21')]('[QUEUE]',_0xbea9('0x63'));_0x1f692c[_0xbea9('0x64')]=util['format'](_0xbea9('0x65'),_0x339305['serverUrl'],_0x1f692c[_0xbea9('0x66')],md5(_0x1f692c[_0xbea9('0x66')]));}else{_0x1f692c[_0xbea9('0x64')]='';}return getConnection(_0x339305)[_0xbea9('0x2c')](function(_0x1d9150){_0xf72e32=_0x1d9150;return getUser(_0x339305,_0x16bec9[_0xbea9('0x67')],_0xf72e32);})[_0xbea9('0x2c')](function(_0x4795eb){_0x5a7917=_0x4795eb;return getEndUser(_0x339305,_0xb01b18,_0x1f692c[_0xbea9('0x68')],_0x1f692c['calleridnum'],_0xf72e32);})[_0xbea9('0x2c')](function(_0x1efd99){_0x1875d9=_0x1efd99;return getTicket(_0x339305,_0x5a7917,_0x1875d9,_0xb01b18,_0x1f692c,_0xb01b18['Fields'],_0xf72e32,_0xbea9('0x5f'));})[_0xbea9('0x2c')](function(_0x462928){_0x265f29=_0x462928;logger['info'](_0xbea9('0x69'),_0x265f29['id']);logger['info'](_0xbea9('0x6a'),_0x265f29['id'],_0x16bec9[_0xbea9('0x56')],_0x339305['type']);switch(_0x339305['type']){case _0xbea9('0x6b'):emit(util[_0xbea9('0x45')](_0xbea9('0x6c'),_0x16bec9[_0xbea9('0x56')]),_0xbea9('0x6d'),{'recordId':_0x265f29['id']});break;case'newTab':emit(util[_0xbea9('0x45')]('user:%s',_0x16bec9[_0xbea9('0x56')]),_0xbea9('0x6e'),{'uri':util[_0xbea9('0x45')](_0xbea9('0x6f'),_0xf72e32[_0xbea9('0x70')],_0x265f29['id'])});break;default:logger['error'](_0xbea9('0x71'));}})[_0xbea9('0x72')](function(_0x15be02){logger[_0xbea9('0x73')]('[QUEUE]',_0x15be02);});};exports[_0xbea9('0x74')]=function(_0x277fd6,_0x3bff61,_0x1dc84b,_0x5603cf,_0x980907,_0x3c37f2,_0x5e62f1){var _0x4d8072,_0x41322e,_0xc4251d,_0xec6ee8;_0x3c37f2[_0xbea9('0x60')]=intUtil[_0xbea9('0x61')](_0x3c37f2[_0xbea9('0x60')]);_0x3c37f2[_0xbea9('0x5a')]=intUtil[_0xbea9('0x61')](_0x3c37f2['remoteUri']);if(_0x5e62f1&&_0x5e62f1[_0xbea9('0x75')]&&_0x5e62f1[_0xbea9('0x75')]!==_0xbea9('0x76')){logger[_0xbea9('0x21')](_0xbea9('0x77'),'Recording\x20is\x20enabled!');_0x3bff61['recordingURL']=util['format'](_0xbea9('0x65'),_0x3c37f2[_0xbea9('0x60')],_0x3bff61[_0xbea9('0x66')],md5(_0x3bff61[_0xbea9('0x66')]));}return getConnection(_0x3c37f2)[_0xbea9('0x2c')](function(_0x217a54){_0xec6ee8=_0x217a54;return getUser(_0x3c37f2,_0x5603cf[_0xbea9('0x67')],_0xec6ee8);})[_0xbea9('0x2c')](function(_0x25503b){_0x4d8072=_0x25503b;return getEndUser(_0x3c37f2,_0x1dc84b,_0x3bff61[_0xbea9('0x78')],_0x3bff61[_0xbea9('0x79')],_0xec6ee8);})[_0xbea9('0x2c')](function(_0x4d3559){_0x41322e=_0x4d3559;return getTicket(_0x3c37f2,_0x4d8072,_0x41322e,_0x1dc84b,_0x3bff61,_0x1dc84b[_0xbea9('0x7a')],_0xec6ee8,'outbound');})['then'](function(_0x56a51c){_0xc4251d=_0x56a51c;logger['info'](_0xbea9('0x7b'),_0xc4251d['id']);logger[_0xbea9('0x21')](_0xbea9('0x7c'),_0xc4251d['id'],_0x5603cf[_0xbea9('0x56')],_0x3c37f2[_0xbea9('0x3e')]);switch(_0x3c37f2['type']){case _0xbea9('0x6b'):emit(util[_0xbea9('0x45')](_0xbea9('0x6c'),_0x5603cf[_0xbea9('0x56')]),_0xbea9('0x6d'),{'recordId':_0xc4251d['id']});break;case _0xbea9('0x7d'):emit(util[_0xbea9('0x45')](_0xbea9('0x6c'),_0x5603cf[_0xbea9('0x56')]),_0xbea9('0x6e'),{'uri':util[_0xbea9('0x45')](_0xbea9('0x6f'),_0xec6ee8[_0xbea9('0x70')],_0xc4251d['id'])});break;default:logger[_0xbea9('0x73')]('[OUTBOUND]',_0xbea9('0x7e'));}})[_0xbea9('0x72')](function(_0xa6d167){logger[_0xbea9('0x73')](_0xbea9('0x77'),_0xa6d167);});};exports[_0xbea9('0x7f')]=function(_0x57ee9e,_0x46465d,_0x576ae7,_0x1b7c3d,_0x252d91,_0x36d0d6){var _0x4fe4df,_0xd514f4,_0x368fdd,_0x349265;_0x36d0d6[_0xbea9('0x60')]=intUtil['stripTrailingSlash'](_0x36d0d6[_0xbea9('0x60')]);_0x36d0d6[_0xbea9('0x5a')]=intUtil[_0xbea9('0x61')](_0x36d0d6['remoteUri']);if(_0x252d91&&_0x252d91[_0xbea9('0x62')]){logger[_0xbea9('0x21')]('['+_0x46465d[_0xbea9('0x80')][_0xbea9('0x81')]()+']','Recording\x20is\x20enabled!');_0x46465d[_0xbea9('0x64')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x36d0d6[_0xbea9('0x60')],_0x46465d[_0xbea9('0x66')],md5(_0x46465d[_0xbea9('0x66')]));}else{_0x46465d['recordingURL']='';}return getConnection(_0x36d0d6)[_0xbea9('0x2c')](function(_0x33b3fa){_0x349265=_0x33b3fa;if(!_[_0xbea9('0x82')](_0x1b7c3d)){return getUser(_0x36d0d6,_0x1b7c3d[_0xbea9('0x56')],_0x349265);}else{return getUser(_0x36d0d6,null,_0x349265);}})['then'](function(_0x10f867){_0x4fe4df=_0x10f867;return getEndUser(_0x36d0d6,_0x576ae7,_0x46465d[_0xbea9('0x68')],_0x46465d[_0xbea9('0x83')],_0x349265);})[_0xbea9('0x2c')](function(_0x37aaec){_0xd514f4=_0x37aaec;return getTicket(_0x36d0d6,_0x4fe4df,_0xd514f4,_0x576ae7,_0x46465d,_0x576ae7[_0xbea9('0x7a')],_0x349265);})[_0xbea9('0x2c')](function(_0x1188fd){_0x368fdd=_0x1188fd;logger[_0xbea9('0x21')]('['+_0x46465d[_0xbea9('0x80')][_0xbea9('0x81')]()+_0xbea9('0x84'),_0x368fdd['id']);logger['info']('['+_0x46465d[_0xbea9('0x80')]['toUpperCase']()+_0xbea9('0x85'),_0x36d0d6['type']);})['catch'](function(_0x2ec3ab){logger[_0xbea9('0x73')]('['+_0x46465d[_0xbea9('0x80')]['toUpperCase']()+']',_0x2ec3ab);});}; \ 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 156c840..47633ee 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 _0x96ae=['],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','length','true','userId','adminId','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','user','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','forEach','includes','string','picklist','nameField','customField','toLowerCase','content','idField','toString','variable','variableName','type','customVariable','name','Variable','outbound','incident','assign','getString','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number','label','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','map','%26sysparm_record_target%3Dincident','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','username','sysparm_limit=1','stripTrailingSlash','serverUrl','%s/api/now/table/','remoteUri','isNil','email','destcalleridnum','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingFormat','none','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','request-promise','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','socket.io-emitter','GET','then','result','sys_id','toUpperCase','catch','error','message','info'];(function(_0x4fda88,_0x1a4d19){var _0xe37511=function(_0x51f461){while(--_0x51f461){_0x4fda88['push'](_0x4fda88['shift']());}};_0xe37511(++_0x1a4d19);}(_0x96ae,0xb7));var _0xe96a=function(_0x2a0c21,_0x51ad5e){_0x2a0c21=_0x2a0c21-0x0;var _0x28f2ff=_0x96ae[_0x2a0c21];return _0x28f2ff;};'use strict';var _=require(_0xe96a('0x0'));var Promise=require(_0xe96a('0x1'));var rp=require(_0xe96a('0x2'));var util=require('util');var md5=require('md5');var Redis=require(_0xe96a('0x3'));var intUtil=require(_0xe96a('0x4'));var config=require(_0xe96a('0x5'));var logger=require(_0xe96a('0x6'))('servicenow');config[_0xe96a('0x7')]=_[_0xe96a('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xe96a('0x9'))(new Redis(config['redis']));function getAdminUser(_0xf71118,_0x3add56,_0x4f67eb,_0x426167,_0x2909e4,_0x26e3b0){return new Promise(function(_0x1ab6a9,_0x5e0b39){var _0x355a38={'method':_0xe96a('0xa'),'uri':_0x426167+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x2909e4+'&'+_0x26e3b0,'auth':_0x3add56,'json':!![]};return rp(_0x355a38)[_0xe96a('0xb')](function(_0x1eab79){if(_0x1eab79[_0xe96a('0xc')]['length']>0x0){_0x4f67eb['adminId']=_0x1eab79[_0xe96a('0xc')][0x0][_0xe96a('0xd')];}logger['info']('['+[_0xf71118[_0xe96a('0xe')]()]+'],\x20getAdminUser\x20crm',_0x4f67eb);_0x1ab6a9(_0x4f67eb);})[_0xe96a('0xf')](function(_0x38fe4b){logger[_0xe96a('0x10')]('['+[_0xf71118[_0xe96a('0xe')]()]+']',_0x38fe4b[_0xe96a('0x11')]);_0x5e0b39(_0x38fe4b['message']);});});}function getUser(_0x75ad39,_0x3bb4eb,_0xd42986,_0x30d9ad,_0x2730bf){return function(_0x5e69dc){logger[_0xe96a('0x12')]('['+[_0x75ad39[_0xe96a('0xe')]()]+_0xe96a('0x13'),_0x5e69dc);return new Promise(function(_0x316eb5,_0x391e65){if(intUtil[_0xe96a('0x14')](_0x5e69dc[_0xe96a('0x15')])){var _0x380096={'method':_0xe96a('0xa'),'uri':_0xd42986+_0xe96a('0x16')+_0x5e69dc[_0xe96a('0x15')]+'&'+_0x30d9ad+'&'+_0x2730bf,'auth':_0x3bb4eb,'json':!![]};logger[_0xe96a('0x12')]('['+[_0x75ad39[_0xe96a('0xe')]()]+_0xe96a('0x17'),_0x380096);return rp(_0x380096)[_0xe96a('0xb')](function(_0xb2008){logger[_0xe96a('0x12')]('['+[_0x75ad39[_0xe96a('0xe')]()]+_0xe96a('0x18'),_0xb2008);if(_0xb2008[_0xe96a('0xc')][_0xe96a('0x19')]>0x0&&String(_0xb2008[_0xe96a('0xc')][0x0]['active'])===_0xe96a('0x1a')){_0x5e69dc[_0xe96a('0x1b')]=_0xb2008[_0xe96a('0xc')][0x0][_0xe96a('0xd')];}else{_0x5e69dc['userId']=_0x5e69dc[_0xe96a('0x1c')];_0x5e69dc[_0xe96a('0x15')]=_0x5e69dc[_0xe96a('0x1d')];}logger[_0xe96a('0x12')]('['+[_0x75ad39['toUpperCase']()]+_0xe96a('0x1e'),_0x5e69dc);_0x316eb5(_0x5e69dc);})[_0xe96a('0xf')](function(_0x5e94bd){logger[_0xe96a('0x10')]('['+[_0x75ad39[_0xe96a('0xe')]()]+']',_0x5e94bd['message']);_0x391e65(_0x5e94bd[_0xe96a('0x11')]);});}else{logger['info']('['+[_0x75ad39[_0xe96a('0xe')]()]+_0xe96a('0x1f'));_0x5e69dc[_0xe96a('0x1b')]=_0x5e69dc[_0xe96a('0x1c')];_0x5e69dc[_0xe96a('0x15')]=_0x5e69dc[_0xe96a('0x1d')];_0x316eb5(_0x5e69dc);}});};}function createEndUser(_0x5c17ec,_0x534f22,_0x19d8ab,_0x28567a,_0x3de5de){logger[_0xe96a('0x12')]('['+[_0x5c17ec['toUpperCase']()]+_0xe96a('0x20'),_0x19d8ab);return new Promise(function(_0x41fb1d,_0x1ebf46){var _0xb3d674={'method':_0xe96a('0x21'),'uri':_0x28567a+_0xe96a('0x22')+_0x3de5de,'body':{'user_name':_0x19d8ab[_0xe96a('0x23')],'roles':_0xe96a('0x24'),'first_name':_0x19d8ab[_0xe96a('0x23')],'active':_0xe96a('0x1a'),'date_format':_0xe96a('0x25'),'phone':_0x19d8ab['endUserNumber']},'auth':_0x534f22,'json':!![]};return rp(_0xb3d674)[_0xe96a('0xb')](function(_0x5ee0e6){logger[_0xe96a('0x12')]('['+[_0x5c17ec['toUpperCase']()]+_0xe96a('0x26'),_0x5ee0e6[_0xe96a('0xc')]);_0x19d8ab[_0xe96a('0x27')]=_0x5ee0e6[_0xe96a('0xc')][_0xe96a('0xd')];_0x41fb1d(_0x19d8ab);})[_0xe96a('0xf')](function(_0x482876){logger[_0xe96a('0x10')]('['+[_0x5c17ec[_0xe96a('0xe')]()]+']',_0x482876[_0xe96a('0x11')]);_0x1ebf46(_0x482876[_0xe96a('0x11')]);});});}function getEndUser(_0x2ca006,_0x13e030,_0x5733e9,_0xcbdf4e,_0x54f853){return function(_0x4b3c3a){logger[_0xe96a('0x12')]('['+[_0x2ca006['toUpperCase']()]+_0xe96a('0x28'),_0x4b3c3a);return new Promise(function(_0x1e2e12,_0x3a175b){var _0x41ac57={'method':_0xe96a('0xa'),'uri':_0x5733e9+_0xe96a('0x29')+_0x4b3c3a[_0xe96a('0x23')]+'&'+_0xcbdf4e+'&'+_0x54f853,'auth':_0x13e030,'json':!![]};return rp(_0x41ac57)[_0xe96a('0xb')](function(_0x5eb855){if(_0x5eb855[_0xe96a('0xc')]['length']>0x0){_0x4b3c3a[_0xe96a('0x27')]=_0x5eb855[_0xe96a('0xc')][0x0][_0xe96a('0xd')];logger[_0xe96a('0x12')]('['+[_0x2ca006[_0xe96a('0xe')]()]+'],\x20getEndUser\x20crm',_0x4b3c3a);_0x1e2e12(_0x4b3c3a);}else{return createEndUser(_0x2ca006,_0x13e030,_0x4b3c3a,_0x5733e9,_0xcbdf4e)[_0xe96a('0xb')](function(_0x1e3cdd){logger[_0xe96a('0x12')]('['+[_0x2ca006[_0xe96a('0xe')]()]+'],\x20createEndUser\x20crm',_0x1e3cdd);_0x1e2e12(_0x1e3cdd);});}})[_0xe96a('0xf')](function(_0x283840){logger[_0xe96a('0x10')]('['+[_0x2ca006[_0xe96a('0xe')]()]+']',_0x283840[_0xe96a('0x11')]);_0x3a175b(_0x283840['message']);});});};}function getCustomFields(_0x142af3,_0x35d7bc){var _0x5606c0={};if(_0x142af3['length']>0x0){_[_0xe96a('0x2a')](_0x142af3,function(_0x72ef18){if(_[_0xe96a('0x2b')]([_0xe96a('0x2c'),_0xe96a('0x2d')],_0x72ef18['type'])&&_0x72ef18[_0xe96a('0x2e')]&&!_0x72ef18[_0xe96a('0x2f')]){_0x5606c0[_0x72ef18['nameField'][_0xe96a('0x30')]()]=_0x72ef18[_0xe96a('0x31')]['toString']();}else if(_[_0xe96a('0x2b')]([_0xe96a('0x2c'),_0xe96a('0x2d')],_0x72ef18['type'])&&_0x72ef18[_0xe96a('0x32')]&&_0x72ef18['customField']){_0x5606c0[_0x72ef18['idField'][_0xe96a('0x30')]()]=_0x72ef18['content'][_0xe96a('0x33')]();}else if(_0x72ef18['type']===_0xe96a('0x34')&&_0x72ef18['variableName']&&_0x72ef18[_0xe96a('0x32')]&&_0x72ef18[_0xe96a('0x2f')]){_0x5606c0[_0x72ef18[_0xe96a('0x32')]['toLowerCase']()]=_0x35d7bc[_0x72ef18[_0xe96a('0x35')]][_0xe96a('0x33')]();}else if(_0x72ef18[_0xe96a('0x36')]===_0xe96a('0x37')&&_0x72ef18['Variable']&&_0x72ef18['Variable'][_0xe96a('0x38')]&&_0x72ef18[_0xe96a('0x32')]&&_0x72ef18['customField']){_0x5606c0[_0x72ef18[_0xe96a('0x32')]['toLowerCase']()]=_0x35d7bc[_0x72ef18[_0xe96a('0x39')][_0xe96a('0x38')]['toLowerCase']()]['toString']();}});}return _0x5606c0;}function getTicket(_0x337df5,_0x20ac66,_0x3a7e3f,_0x373c29,_0x228949,_0xad3985){return function(_0x3638c1){logger[_0xe96a('0x12')]('['+[_0x337df5[_0xe96a('0xe')]()]+']\x20getTicket\x20input\x20crm',_0x3638c1);return new Promise(function(_0x1b59e8,_0x56922c){var _0x3ac7c5=_0x337df5[_0xe96a('0x30')]()===_0xe96a('0x3a')?_0x3638c1[_0xe96a('0x1b')]:_0x3638c1[_0xe96a('0x27')];var _0x2b06f7={'method':_0xe96a('0x21'),'uri':_0x3a7e3f+_0xe96a('0x3b')+'?'+_0xad3985,'body':Object[_0xe96a('0x3c')]({},{'active':_0xe96a('0x1a'),'caller_id':_0x3ac7c5,'assigned_to':_0x3638c1['userId'],'short_description':intUtil[_0xe96a('0x3d')](_0x373c29['Subjects'],_0x228949,'\x20'),'description':intUtil[_0xe96a('0x3d')](_0x373c29['Descriptions'],_0x228949,'\x0a')},getCustomFields(_0x373c29[_0xe96a('0x3e')],_0x228949)),'auth':_0x20ac66,'json':!![]};return rp(_0x2b06f7)['then'](function(_0x357303){logger[_0xe96a('0x12')]('['+[_0x337df5[_0xe96a('0xe')]()]+_0xe96a('0x3f'),_0x357303['result']);_0x3638c1[_0xe96a('0x40')]=_0x357303['result'][_0xe96a('0xd')];_0x3638c1[_0xe96a('0x41')]=_0x357303[_0xe96a('0xc')][_0xe96a('0x42')];logger[_0xe96a('0x12')]('['+[_0x337df5[_0xe96a('0xe')]()]+']\x20getTicket\x20crm',_0x3638c1);_0x1b59e8(_0x3638c1);})[_0xe96a('0xf')](function(_0x1c83a2){logger[_0xe96a('0x10')]('['+[_0x337df5[_0xe96a('0xe')]()]+']',_0x1c83a2['message']);_0x56922c(_0x1c83a2['message']);});});};}function createRemoteTag(_0x2ccee1,_0x577b9c,_0x3c2041,_0x4b82c4){return new Promise(function(_0x3602b8,_0x188a99){var _0x28b077={'method':_0xe96a('0x21'),'uri':_0x3c2041+_0xe96a('0x43')+'?'+_0x4b82c4,'body':{'short_description':_0x2ccee1,'global':!![],'active':!![],'name':_0x2ccee1},'auth':_0x577b9c,'json':!![]};return rp(_0x28b077)['then'](function(_0xbafcb6){var _0x49ff3f=_0xbafcb6['result']['sys_id'];_0x3602b8(_0x49ff3f);});});}function getRemoteTag(_0x65fd78,_0x3b08fe,_0x1feb1e,_0x43474b,_0x22f5f5){return new Promise(function(_0x33f6f8,_0x313a53){var _0x4c8001={'method':_0xe96a('0xa'),'uri':_0x1feb1e+_0xe96a('0x43')+'?sysparm_query=name%3D'+_0x65fd78+'&'+_0x43474b,'auth':_0x3b08fe,'json':!![]};return rp(_0x4c8001)[_0xe96a('0xb')](function(_0x1c9030){if(_0x1c9030[_0xe96a('0xc')][_0xe96a('0x19')]>0x0){var _0xb7a4cd=_0x1c9030['result'][0x0][_0xe96a('0xd')];_0x33f6f8(_0xb7a4cd);}else{return createRemoteTag(_0x65fd78,_0x3b08fe,_0x1feb1e,_0x43474b)[_0xe96a('0xb')](function(_0x155cde){_0x33f6f8(_0x155cde);});}});});}function assignTagToIncident(_0x25979d,_0x1a6282,_0x3a9d9b,_0x42f2e7,_0x5b395c){return new Promise(function(_0x1d95ce,_0x591774){var _0x19c2d8={'method':_0xe96a('0x21'),'uri':_0x3a9d9b+'label_entry'+'?'+_0x5b395c,'body':{'label':_0x25979d,'table':'incident','id_type':'Incident','table_key':_0x42f2e7[_0xe96a('0x40')],'title':'Incident\x20-\x20'+_0x42f2e7[_0xe96a('0x41')],'id_display':_0x42f2e7[_0xe96a('0x41')]},'auth':_0x1a6282,'json':!![]};return rp(_0x19c2d8)[_0xe96a('0xb')](function(_0x181a45){_0x1d95ce();})[_0xe96a('0xf')](function(){_0x1d95ce();});});}function manageTags(_0xb09dc4,_0x41f910,_0x2d6fe9,_0x3b85ab,_0x14088e,_0x4b7f3b,_0x5c3c79){return new Promise(function(_0x492e35,_0x587fff){var _0x26a0dd=[];_0x41f910['forEach'](function(_0x498bb6){_0x26a0dd[_0xe96a('0x44')](getRemoteTag(_0x498bb6,_0x2d6fe9,_0x3b85ab,_0x4b7f3b,_0x5c3c79));});return Promise[_0xe96a('0x45')](_0x26a0dd)[_0xe96a('0xb')](function(_0x3e63d1){if(_0x3e63d1[_0xe96a('0x19')]){logger[_0xe96a('0x12')]('['+[_0xb09dc4['toUpperCase']()]+_0xe96a('0x46'),_0x3e63d1);var _0x304eeb=[];_0x3e63d1[_0xe96a('0x2a')](function(_0x1e8c91){_0x304eeb['push'](assignTagToIncident(_0x1e8c91,_0x2d6fe9,_0x3b85ab,_0x14088e,_0x4b7f3b));});return Promise[_0xe96a('0x45')](_0x304eeb)['then'](function(){_0x492e35();})['catch'](function(){_0x492e35();});}else{_0x492e35();}});});}function getTags(_0x3077db,_0x5b1614,_0x531e71,_0x1fc221,_0x26fc97,_0x5a178a){return function(_0x19c26d){return new Promise(function(_0x58886e,_0x508136){var _0x12c6e7=[];var _0x5d1322=_0x1fc221['Tags'];if(_0x5d1322&&_0x5d1322[_0xe96a('0x19')]>0x0){_0x12c6e7=_[_0xe96a('0x47')](_0x5d1322,'name');}if(_0x12c6e7['length']>0x0){return manageTags(_0x3077db,_0x12c6e7,_0x5b1614,_0x531e71,_0x19c26d,_0x26fc97,_0x5a178a)[_0xe96a('0xb')](function(){_0x58886e(_0x19c26d);});}else{_0x58886e(_0x19c26d);}});};}function emit(_0x50ac48,_0x364593,_0x2267bf){var _0x224025=_0xe96a('0x48')+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+_0xe96a('0x49')+_0xe96a('0x4a');var _0x41801f={'uri':_0x50ac48+_0xe96a('0x4b')+_0x2267bf+_0x224025};io['to'](util[_0xe96a('0x4c')](_0xe96a('0x4d'),_0x364593))[_0xe96a('0x4e')]('trigger:browser:url',_0x41801f);}exports['cs']=function(_0x36d7f8,_0x14a92f,_0x149c77,_0x1c4e07,_0x12a3b1,_0x2346c4,_0x58d00b,_0x3d4629){var _0x54ecca={};var _0x3f418f={'user':_0x2346c4[_0xe96a('0x4f')],'pass':_0x2346c4['password']};var _0x9aecef=_0xe96a('0x50');var _0x50d974='sysparm_display_value=true';_0x2346c4['remoteUri']=intUtil[_0xe96a('0x51')](_0x2346c4['remoteUri']);_0x2346c4[_0xe96a('0x52')]=intUtil[_0xe96a('0x51')](_0x2346c4['serverUrl']);var _0x4ddd15=util[_0xe96a('0x4c')](_0xe96a('0x53'),_0x2346c4[_0xe96a('0x54')]);_0x54ecca[_0xe96a('0x15')]=!_[_0xe96a('0x55')](_0x1c4e07)?_0x1c4e07['email']:null;_0x54ecca[_0xe96a('0x1d')]=_0x2346c4[_0xe96a('0x56')];_0x54ecca[_0xe96a('0x23')]=_0x3d4629['toLowerCase']()===_0xe96a('0x3a')?_0x14a92f[_0xe96a('0x57')]:_0x14a92f['calleridnum'];_0x54ecca['callDirection']=_0x3d4629==='queue'||_0x3d4629==='unmanaged'?_0xe96a('0x58'):_0xe96a('0x3a');var _0x31cd72=util['format'](_0xe96a('0x59'),_0x2346c4['serverUrl'],_0x14a92f[_0xe96a('0x5a')],md5(_0x14a92f[_0xe96a('0x5a')]));if(_0x12a3b1&&_0x12a3b1[_0xe96a('0x5b')]){logger[_0xe96a('0x12')]('[QUEUE]',_0xe96a('0x5c'));_0x14a92f['recordingURL']=_0x31cd72;}else if(_0x58d00b&&_0x58d00b[_0xe96a('0x5d')]&&_0x58d00b[_0xe96a('0x5d')]!==_0xe96a('0x5e')){logger[_0xe96a('0x12')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x14a92f[_0xe96a('0x5f')]=_0x31cd72;}else{_0x14a92f[_0xe96a('0x5f')]='';}return getAdminUser(_0x3d4629,_0x3f418f,_0x54ecca,_0x4ddd15,_0x50d974,_0x9aecef)[_0xe96a('0xb')](getUser(_0x3d4629,_0x3f418f,_0x4ddd15,_0x50d974,_0x9aecef))[_0xe96a('0xb')](getEndUser(_0x3d4629,_0x3f418f,_0x4ddd15,_0x50d974,_0x9aecef))[_0xe96a('0xb')](getTicket(_0x3d4629,_0x3f418f,_0x4ddd15,_0x149c77,_0x14a92f,_0x50d974))['then'](function(_0x275ea4){logger['info'](util['format'](_0xe96a('0x60'),_0x275ea4[_0xe96a('0x40')]));logger['info'](util['format'](_0xe96a('0x61'),_0x3d4629));if(_0x3d4629!=='unmanaged'){logger[_0xe96a('0x12')]('['+[_0x3d4629['toUpperCase']()]+']',_0xe96a('0x62'));emit(_0x2346c4['remoteUri'],_0x1c4e07[_0xe96a('0x38')],_0x275ea4[_0xe96a('0x40')]);}})['catch'](function(_0x3c77bb){logger[_0xe96a('0x10')]('['+[_0x3d4629[_0xe96a('0xe')]()]+_0xe96a('0x63'),util[_0xe96a('0x64')](_0x3c77bb,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xcc02=['adminEmail','outbound','callDirection','unmanaged','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','request-promise','util','md5','ioredis','./util','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','then','length','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','GET','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','result','active','userId','adminId',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','sys_user?','endUserNumber','true','System','],\x20EndUser\x20schema','endUserId','sys_id','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','includes','string','picklist','type','customField','nameField','toLowerCase','content','idField','variableName','toString','Variable','name',']\x20getTicket\x20input\x20crm','incident','assign','getString','Descriptions',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number',']\x20getTicket\x20crm','POST','label','label_entry','Incident','Incident\x20-\x20','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','username','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','isNil','email'];(function(_0x74d0bc,_0x308a3d){var _0x35b209=function(_0x58f9a9){while(--_0x58f9a9){_0x74d0bc['push'](_0x74d0bc['shift']());}};_0x35b209(++_0x308a3d);}(_0xcc02,0x159));var _0x2cc0=function(_0xf76a8a,_0x24d323){_0xf76a8a=_0xf76a8a-0x0;var _0x33df5f=_0xcc02[_0xf76a8a];return _0x33df5f;};'use strict';var _=require(_0x2cc0('0x0'));var Promise=require('bluebird');var rp=require(_0x2cc0('0x1'));var util=require(_0x2cc0('0x2'));var md5=require(_0x2cc0('0x3'));var Redis=require(_0x2cc0('0x4'));var intUtil=require(_0x2cc0('0x5'));var config=require(_0x2cc0('0x6'));var logger=require('../../../../config/logger')('servicenow');config[_0x2cc0('0x7')]=_[_0x2cc0('0x8')](config[_0x2cc0('0x7')],{'host':_0x2cc0('0x9'),'port':0x18eb});var io=require(_0x2cc0('0xa'))(new Redis(config['redis']));function getAdminUser(_0x45d62e,_0x444ee2,_0x492c22,_0x36bc1a,_0x414bf4,_0xf75b6a){return new Promise(function(_0x3f6bd8,_0x435cbe){var _0x357ce5={'method':'GET','uri':_0x36bc1a+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x414bf4+'&'+_0xf75b6a,'auth':_0x444ee2,'json':!![]};return rp(_0x357ce5)[_0x2cc0('0xb')](function(_0x11b24a){if(_0x11b24a['result'][_0x2cc0('0xc')]>0x0){_0x492c22['adminId']=_0x11b24a['result'][0x0]['sys_id'];}logger[_0x2cc0('0xd')]('['+[_0x45d62e[_0x2cc0('0xe')]()]+_0x2cc0('0xf'),_0x492c22);_0x3f6bd8(_0x492c22);})[_0x2cc0('0x10')](function(_0x31ef7a){logger[_0x2cc0('0x11')]('['+[_0x45d62e[_0x2cc0('0xe')]()]+']',_0x31ef7a['message']);_0x435cbe(_0x31ef7a[_0x2cc0('0x12')]);});});}function getUser(_0x2a8c97,_0x46067b,_0x47412a,_0x41fed6,_0x490719){return function(_0x5f404f){logger[_0x2cc0('0xd')]('['+[_0x2a8c97[_0x2cc0('0xe')]()]+_0x2cc0('0x13'),_0x5f404f);return new Promise(function(_0x1aa205,_0x4b978){if(intUtil[_0x2cc0('0x14')](_0x5f404f[_0x2cc0('0x15')])){var _0x17e7ed={'method':_0x2cc0('0x16'),'uri':_0x47412a+_0x2cc0('0x17')+_0x5f404f[_0x2cc0('0x15')]+'&'+_0x41fed6+'&'+_0x490719,'auth':_0x46067b,'json':!![]};logger[_0x2cc0('0xd')]('['+[_0x2a8c97['toUpperCase']()]+_0x2cc0('0x18'),_0x17e7ed);return rp(_0x17e7ed)[_0x2cc0('0xb')](function(_0x579bc3){logger[_0x2cc0('0xd')]('['+[_0x2a8c97['toUpperCase']()]+_0x2cc0('0x19'),_0x579bc3);if(_0x579bc3[_0x2cc0('0x1a')]['length']>0x0&&String(_0x579bc3['result'][0x0][_0x2cc0('0x1b')])==='true'){_0x5f404f['userId']=_0x579bc3[_0x2cc0('0x1a')][0x0]['sys_id'];}else{_0x5f404f[_0x2cc0('0x1c')]=_0x5f404f[_0x2cc0('0x1d')];_0x5f404f['userEmail']=_0x5f404f['adminEmail'];}logger[_0x2cc0('0xd')]('['+[_0x2a8c97[_0x2cc0('0xe')]()]+'],\x20getUser\x20crm',_0x5f404f);_0x1aa205(_0x5f404f);})[_0x2cc0('0x10')](function(_0x3a7ab4){logger[_0x2cc0('0x11')]('['+[_0x2a8c97[_0x2cc0('0xe')]()]+']',_0x3a7ab4[_0x2cc0('0x12')]);_0x4b978(_0x3a7ab4[_0x2cc0('0x12')]);});}else{logger[_0x2cc0('0xd')]('['+[_0x2a8c97[_0x2cc0('0xe')]()]+_0x2cc0('0x1e'));_0x5f404f['userId']=_0x5f404f['adminId'];_0x5f404f[_0x2cc0('0x15')]=_0x5f404f['adminEmail'];_0x1aa205(_0x5f404f);}});};}function createEndUser(_0x318724,_0x6afcba,_0x2da6a8,_0x4b2f98,_0x49d445){logger[_0x2cc0('0xd')]('['+[_0x318724[_0x2cc0('0xe')]()]+_0x2cc0('0x1f'),_0x2da6a8);return new Promise(function(_0x1a988e,_0x3776fc){var _0x24896f={'method':'POST','uri':_0x4b2f98+_0x2cc0('0x20')+_0x49d445,'body':{'user_name':_0x2da6a8[_0x2cc0('0x21')],'roles':'user','first_name':_0x2da6a8['endUserNumber'],'active':_0x2cc0('0x22'),'date_format':_0x2cc0('0x23'),'phone':_0x2da6a8['endUserNumber']},'auth':_0x6afcba,'json':!![]};return rp(_0x24896f)[_0x2cc0('0xb')](function(_0x252bc0){logger['info']('['+[_0x318724[_0x2cc0('0xe')]()]+_0x2cc0('0x24'),_0x252bc0[_0x2cc0('0x1a')]);_0x2da6a8[_0x2cc0('0x25')]=_0x252bc0[_0x2cc0('0x1a')][_0x2cc0('0x26')];_0x1a988e(_0x2da6a8);})[_0x2cc0('0x10')](function(_0xb48ca1){logger[_0x2cc0('0x11')]('['+[_0x318724[_0x2cc0('0xe')]()]+']',_0xb48ca1[_0x2cc0('0x12')]);_0x3776fc(_0xb48ca1['message']);});});}function getEndUser(_0x1da876,_0x40eed1,_0x1238ee,_0x85b1d8,_0x64ebd4){return function(_0x4e3da9){logger['info']('['+[_0x1da876[_0x2cc0('0xe')]()]+'],\x20getEndUser\x20input\x20crm',_0x4e3da9);return new Promise(function(_0xae80a9,_0x1a7bb2){var _0x42d3bb={'method':_0x2cc0('0x16'),'uri':_0x1238ee+'sys_user?sysparm_query=phone%3D'+_0x4e3da9[_0x2cc0('0x21')]+'&'+_0x85b1d8+'&'+_0x64ebd4,'auth':_0x40eed1,'json':!![]};return rp(_0x42d3bb)[_0x2cc0('0xb')](function(_0xaa742){if(_0xaa742[_0x2cc0('0x1a')][_0x2cc0('0xc')]>0x0){_0x4e3da9[_0x2cc0('0x25')]=_0xaa742[_0x2cc0('0x1a')][0x0][_0x2cc0('0x26')];logger[_0x2cc0('0xd')]('['+[_0x1da876[_0x2cc0('0xe')]()]+_0x2cc0('0x27'),_0x4e3da9);_0xae80a9(_0x4e3da9);}else{return createEndUser(_0x1da876,_0x40eed1,_0x4e3da9,_0x1238ee,_0x85b1d8)['then'](function(_0x4f0c44){logger[_0x2cc0('0xd')]('['+[_0x1da876[_0x2cc0('0xe')]()]+_0x2cc0('0x28'),_0x4f0c44);_0xae80a9(_0x4f0c44);});}})[_0x2cc0('0x10')](function(_0x26ce54){logger[_0x2cc0('0x11')]('['+[_0x1da876[_0x2cc0('0xe')]()]+']',_0x26ce54[_0x2cc0('0x12')]);_0x1a7bb2(_0x26ce54[_0x2cc0('0x12')]);});});};}function getCustomFields(_0x6a91d5,_0x33b0fc){var _0x2889e3={};if(_0x6a91d5[_0x2cc0('0xc')]>0x0){_[_0x2cc0('0x29')](_0x6a91d5,function(_0x183e96){if(_[_0x2cc0('0x2a')]([_0x2cc0('0x2b'),_0x2cc0('0x2c')],_0x183e96[_0x2cc0('0x2d')])&&_0x183e96['nameField']&&!_0x183e96[_0x2cc0('0x2e')]){_0x2889e3[_0x183e96[_0x2cc0('0x2f')][_0x2cc0('0x30')]()]=_0x183e96[_0x2cc0('0x31')]['toString']();}else if(_['includes']([_0x2cc0('0x2b'),_0x2cc0('0x2c')],_0x183e96[_0x2cc0('0x2d')])&&_0x183e96[_0x2cc0('0x32')]&&_0x183e96['customField']){_0x2889e3[_0x183e96[_0x2cc0('0x32')][_0x2cc0('0x30')]()]=_0x183e96[_0x2cc0('0x31')]['toString']();}else if(_0x183e96['type']==='variable'&&_0x183e96[_0x2cc0('0x33')]&&_0x183e96['idField']&&_0x183e96[_0x2cc0('0x2e')]){_0x2889e3[_0x183e96['idField'][_0x2cc0('0x30')]()]=_0x33b0fc[_0x183e96[_0x2cc0('0x33')]][_0x2cc0('0x34')]();}else if(_0x183e96[_0x2cc0('0x2d')]==='customVariable'&&_0x183e96[_0x2cc0('0x35')]&&_0x183e96[_0x2cc0('0x35')][_0x2cc0('0x36')]&&_0x183e96[_0x2cc0('0x32')]&&_0x183e96[_0x2cc0('0x2e')]){_0x2889e3[_0x183e96[_0x2cc0('0x32')][_0x2cc0('0x30')]()]=_0x33b0fc[_0x183e96['Variable'][_0x2cc0('0x36')][_0x2cc0('0x30')]()][_0x2cc0('0x34')]();}});}return _0x2889e3;}function getTicket(_0x3e92f7,_0x4e92fd,_0x23c278,_0x204bae,_0x68848d,_0x1e4a8a){return function(_0x233224){logger['info']('['+[_0x3e92f7[_0x2cc0('0xe')]()]+_0x2cc0('0x37'),_0x233224);return new Promise(function(_0x22c678,_0x5e96c8){var _0x512d0b=_0x3e92f7['toLowerCase']()==='outbound'?_0x233224['userId']:_0x233224[_0x2cc0('0x25')];var _0x34c421={'method':'POST','uri':_0x23c278+_0x2cc0('0x38')+'?'+_0x1e4a8a,'body':Object[_0x2cc0('0x39')]({},{'active':_0x2cc0('0x22'),'caller_id':_0x512d0b,'assigned_to':_0x233224[_0x2cc0('0x1c')],'short_description':intUtil[_0x2cc0('0x3a')](_0x204bae['Subjects'],_0x68848d,'\x20'),'description':intUtil[_0x2cc0('0x3a')](_0x204bae[_0x2cc0('0x3b')],_0x68848d,'\x0a')},getCustomFields(_0x204bae['Fields'],_0x68848d)),'auth':_0x4e92fd,'json':!![]};return rp(_0x34c421)['then'](function(_0x2f1785){logger[_0x2cc0('0xd')]('['+[_0x3e92f7['toUpperCase']()]+_0x2cc0('0x3c'),_0x2f1785[_0x2cc0('0x1a')]);_0x233224[_0x2cc0('0x3d')]=_0x2f1785[_0x2cc0('0x1a')][_0x2cc0('0x26')];_0x233224[_0x2cc0('0x3e')]=_0x2f1785[_0x2cc0('0x1a')][_0x2cc0('0x3f')];logger[_0x2cc0('0xd')]('['+[_0x3e92f7[_0x2cc0('0xe')]()]+_0x2cc0('0x40'),_0x233224);_0x22c678(_0x233224);})[_0x2cc0('0x10')](function(_0xf2d72a){logger[_0x2cc0('0x11')]('['+[_0x3e92f7['toUpperCase']()]+']',_0xf2d72a[_0x2cc0('0x12')]);_0x5e96c8(_0xf2d72a['message']);});});};}function createRemoteTag(_0x3ab7d0,_0x3feae5,_0x24fba8,_0x12e009){return new Promise(function(_0x5bbbad,_0x139ac7){var _0x5eb103={'method':_0x2cc0('0x41'),'uri':_0x24fba8+_0x2cc0('0x42')+'?'+_0x12e009,'body':{'short_description':_0x3ab7d0,'global':!![],'active':!![],'name':_0x3ab7d0},'auth':_0x3feae5,'json':!![]};return rp(_0x5eb103)['then'](function(_0x353550){var _0x15f3c5=_0x353550[_0x2cc0('0x1a')][_0x2cc0('0x26')];_0x5bbbad(_0x15f3c5);});});}function getRemoteTag(_0x568046,_0x13fc90,_0x375712,_0x580f41,_0x3f1429){return new Promise(function(_0x1c2984,_0x55e836){var _0xbdaf0d={'method':_0x2cc0('0x16'),'uri':_0x375712+_0x2cc0('0x42')+'?sysparm_query=name%3D'+_0x568046+'&'+_0x580f41,'auth':_0x13fc90,'json':!![]};return rp(_0xbdaf0d)['then'](function(_0x5676d4){if(_0x5676d4[_0x2cc0('0x1a')][_0x2cc0('0xc')]>0x0){var _0x3945bb=_0x5676d4[_0x2cc0('0x1a')][0x0][_0x2cc0('0x26')];_0x1c2984(_0x3945bb);}else{return createRemoteTag(_0x568046,_0x13fc90,_0x375712,_0x580f41)[_0x2cc0('0xb')](function(_0xd3134c){_0x1c2984(_0xd3134c);});}});});}function assignTagToIncident(_0x51b036,_0x5a7535,_0x3bdce6,_0x9fb8be,_0x354592){return new Promise(function(_0x2c21a7,_0x98935e){var _0x6406d={'method':_0x2cc0('0x41'),'uri':_0x3bdce6+_0x2cc0('0x43')+'?'+_0x354592,'body':{'label':_0x51b036,'table':_0x2cc0('0x38'),'id_type':_0x2cc0('0x44'),'table_key':_0x9fb8be[_0x2cc0('0x3d')],'title':_0x2cc0('0x45')+_0x9fb8be[_0x2cc0('0x3e')],'id_display':_0x9fb8be[_0x2cc0('0x3e')]},'auth':_0x5a7535,'json':!![]};return rp(_0x6406d)['then'](function(_0x48bd37){_0x2c21a7();})[_0x2cc0('0x10')](function(){_0x2c21a7();});});}function manageTags(_0x2e3338,_0x21efbc,_0x26dbba,_0x58186e,_0x9240e9,_0x23992f,_0x22253e){return new Promise(function(_0x21471e,_0xe1f02a){var _0x188ed0=[];_0x21efbc[_0x2cc0('0x29')](function(_0x345e47){_0x188ed0[_0x2cc0('0x46')](getRemoteTag(_0x345e47,_0x26dbba,_0x58186e,_0x23992f,_0x22253e));});return Promise[_0x2cc0('0x47')](_0x188ed0)[_0x2cc0('0xb')](function(_0x317e64){if(_0x317e64['length']){logger[_0x2cc0('0xd')]('['+[_0x2e3338[_0x2cc0('0xe')]()]+_0x2cc0('0x48'),_0x317e64);var _0x5807d6=[];_0x317e64[_0x2cc0('0x29')](function(_0x1957fe){_0x5807d6['push'](assignTagToIncident(_0x1957fe,_0x26dbba,_0x58186e,_0x9240e9,_0x23992f));});return Promise[_0x2cc0('0x47')](_0x5807d6)['then'](function(){_0x21471e();})[_0x2cc0('0x10')](function(){_0x21471e();});}else{_0x21471e();}});});}function getTags(_0xd93a6a,_0x20863e,_0xd2f978,_0x272ba5,_0x5c64cd,_0x241d67){return function(_0x26c5d7){return new Promise(function(_0x2b4e89,_0xfa21c9){var _0x53da42=[];var _0xa9901e=_0x272ba5['Tags'];if(_0xa9901e&&_0xa9901e['length']>0x0){_0x53da42=_[_0x2cc0('0x49')](_0xa9901e,_0x2cc0('0x36'));}if(_0x53da42[_0x2cc0('0xc')]>0x0){return manageTags(_0xd93a6a,_0x53da42,_0x20863e,_0xd2f978,_0x26c5d7,_0x5c64cd,_0x241d67)[_0x2cc0('0xb')](function(){_0x2b4e89(_0x26c5d7);});}else{_0x2b4e89(_0x26c5d7);}});};}function emit(_0x101c74,_0x36bd55,_0x181d9b){var _0x835008=_0x2cc0('0x4a')+_0x2cc0('0x4b')+_0x2cc0('0x4c')+_0x2cc0('0x4d');var _0x17c59f={'uri':_0x101c74+_0x2cc0('0x4e')+_0x181d9b+_0x835008};io['to'](util[_0x2cc0('0x4f')](_0x2cc0('0x50'),_0x36bd55))[_0x2cc0('0x51')](_0x2cc0('0x52'),_0x17c59f);}exports['cs']=function(_0x4f2343,_0x3086d8,_0x34feba,_0x156dfe,_0xe42601,_0x4e447e,_0x27fd2f,_0x2c05a3){var _0x42f289={};var _0x49cf4d={'user':_0x4e447e[_0x2cc0('0x53')],'pass':_0x4e447e['password']};var _0x46d8e1='sysparm_limit=1';var _0x1615fc=_0x2cc0('0x54');_0x4e447e[_0x2cc0('0x55')]=intUtil[_0x2cc0('0x56')](_0x4e447e['remoteUri']);_0x4e447e['serverUrl']=intUtil[_0x2cc0('0x56')](_0x4e447e[_0x2cc0('0x57')]);var _0x1009eb=util['format'](_0x2cc0('0x58'),_0x4e447e[_0x2cc0('0x55')]);_0x42f289['userEmail']=!_[_0x2cc0('0x59')](_0x156dfe)?_0x156dfe[_0x2cc0('0x5a')]:null;_0x42f289[_0x2cc0('0x5b')]=_0x4e447e[_0x2cc0('0x5a')];_0x42f289['endUserNumber']=_0x2c05a3['toLowerCase']()===_0x2cc0('0x5c')?_0x3086d8['destcalleridnum']:_0x3086d8['calleridnum'];_0x42f289[_0x2cc0('0x5d')]=_0x2c05a3==='queue'||_0x2c05a3===_0x2cc0('0x5e')?_0x2cc0('0x5f'):_0x2cc0('0x5c');var _0x5e6f3a=util['format'](_0x2cc0('0x60'),_0x4e447e[_0x2cc0('0x57')],_0x3086d8['uniqueid'],md5(_0x3086d8[_0x2cc0('0x61')]));if(_0xe42601&&_0xe42601[_0x2cc0('0x62')]){logger[_0x2cc0('0xd')](_0x2cc0('0x63'),_0x2cc0('0x64'));_0x3086d8[_0x2cc0('0x65')]=_0x5e6f3a;}else if(_0x27fd2f&&_0x27fd2f['recordingFormat']&&_0x27fd2f['recordingFormat']!==_0x2cc0('0x66')){logger[_0x2cc0('0xd')](_0x2cc0('0x67'),_0x2cc0('0x64'));_0x3086d8[_0x2cc0('0x65')]=_0x5e6f3a;}else{_0x3086d8[_0x2cc0('0x65')]='';}return getAdminUser(_0x2c05a3,_0x49cf4d,_0x42f289,_0x1009eb,_0x1615fc,_0x46d8e1)[_0x2cc0('0xb')](getUser(_0x2c05a3,_0x49cf4d,_0x1009eb,_0x1615fc,_0x46d8e1))[_0x2cc0('0xb')](getEndUser(_0x2c05a3,_0x49cf4d,_0x1009eb,_0x1615fc,_0x46d8e1))['then'](getTicket(_0x2c05a3,_0x49cf4d,_0x1009eb,_0x34feba,_0x3086d8,_0x1615fc))['then'](function(_0x59e1ef){logger['info'](util[_0x2cc0('0x4f')](_0x2cc0('0x68'),_0x59e1ef['ticketId']));logger[_0x2cc0('0xd')](util['format'](_0x2cc0('0x69'),_0x2c05a3));if(_0x2c05a3!==_0x2cc0('0x5e')){logger[_0x2cc0('0xd')]('['+[_0x2c05a3[_0x2cc0('0xe')]()]+']',_0x2cc0('0x6a'));emit(_0x4e447e['remoteUri'],_0x156dfe[_0x2cc0('0x36')],_0x59e1ef['ticketId']);}})['catch'](function(_0x5c0f12){logger[_0x2cc0('0x11')]('['+[_0x2c05a3[_0x2cc0('0xe')]()]+_0x2cc0('0x6b'),util[_0x2cc0('0x6c')](_0x5c0f12,{'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 7c5c35c..c308a1a 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 _0x9791=['queue','remoteUri','serverUrl','stripTrailingSlash','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','contacts','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','catch','error','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','Outbound','user:%s','unmanaged','uri','lastevent','toUpperCase','calleridname','users','lodash','request-promise','bluebird','util','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','defaults','redis','POST','emit','info','Creating\x20new\x20ticket...','getString','Subjects','assigned_user_id','created_by','description','Descriptions','date_start','slice','replace','Contacts','parent_name','name','direction','length','forEach','push','idField','variableName','set_entry','JSON','format','Basic\x20%s','toString','base64','get_server_info','stringify','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','value','resolve','name_value_list','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','contacts.phone_home\x20=\x20\x22%s\x22','find','phone_home','Enduser\x20found!','first_name','debug','[HTTP]','merge','string','nameField','toLowerCase','type','customField','custom_fields','content','variable','customVariable','Variable','login','xCALLY\x20Motion\x20integration','sessionID','set_relationship'];(function(_0x3d2d31,_0x195696){var _0x290a88=function(_0x283095){while(--_0x283095){_0x3d2d31['push'](_0x3d2d31['shift']());}};_0x290a88(++_0x195696);}(_0x9791,0x9d));var _0x1979=function(_0x1a8e32,_0x17abcc){_0x1a8e32=_0x1a8e32-0x0;var _0x43256c=_0x9791[_0x1a8e32];return _0x43256c;};'use strict';var _=require(_0x1979('0x0'));var rp=require(_0x1979('0x1'));var BPromise=require(_0x1979('0x2'));var md5=require('md5');var util=require(_0x1979('0x3'));var Redis=require(_0x1979('0x4'));var intUtil=require(_0x1979('0x5'));var config=require(_0x1979('0x6'));var logger=require(_0x1979('0x7'))(_0x1979('0x8'));config['redis']=_[_0x1979('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x1979('0xa')]));var def={'method':_0x1979('0xb'),'json':!![]};function emit(_0x26e1ce,_0x47771a,_0x529a3a){io['to'](_0x26e1ce)[_0x1979('0xc')](_0x47771a,_0x529a3a);}function getTicket(_0x24091d,_0x24fe7b,_0x4d2cb4,_0x3a1b57,_0x2951a6,_0x167391,_0x3ecd2b,_0x5f34eb){logger[_0x1979('0xd')](_0x1979('0xe'));var _0x270f71=new Date();var _0x467e5c=[{'name':'name','value':intUtil[_0x1979('0xf')](_0x3a1b57[_0x1979('0x10')],_0x2951a6,'\x20')},{'name':_0x1979('0x11'),'value':_0x24fe7b['id']},{'name':_0x1979('0x12'),'value':_0x24fe7b['id']},{'name':_0x1979('0x13'),'value':intUtil[_0x1979('0xf')](_0x3a1b57[_0x1979('0x14')],_0x2951a6,'\x0a')},{'name':_0x1979('0x15'),'value':_0x270f71['toISOString']()[_0x1979('0x16')](0x0,0x13)[_0x1979('0x17')]('T','\x20')},{'name':'duration_hours','value':'0'},{'name':'duration_minutes','value':'15'},{'name':'parent_id','value':_0x4d2cb4['id']},{'name':'parent_type','value':_0x1979('0x18')},{'name':_0x1979('0x19'),'value':_0x4d2cb4[_0x1979('0x1a')]},{'name':_0x1979('0x1b'),'value':_0x5f34eb}];if(_0x167391[_0x1979('0x1c')]){_[_0x1979('0x1d')](_0x167391,function(_0x423b30){if(_0x2951a6[_0x423b30['variableName']]){_0x467e5c[_0x1979('0x1e')]({'name':_0x423b30[_0x1979('0x1f')],'value':_0x2951a6[_0x423b30[_0x1979('0x20')]]});}});}return request({'form':{'method':_0x1979('0x21'),'input_type':'JSON','response_type':_0x1979('0x22'),'rest_data':JSON['stringify']({'session':_0x3ecd2b['id'],'module_name':'Calls','name_value_list':_0x467e5c})}});}function getAuth(_0x37f007){return util[_0x1979('0x23')](_0x1979('0x24'),new Buffer(_0x37f007['apiKey']+':X')[_0x1979('0x25')](_0x1979('0x26')));}function getServerInfo(_0x19471f){return request({'form':{'method':_0x1979('0x27'),'input_type':_0x1979('0x22'),'response_type':'JSON','rest_data':JSON[_0x1979('0x28')]({'session':_0x19471f['id']})}});}function getUser(_0x5b8d00,_0xcf08a6,_0x5d11d4){if(!_[_0x1979('0x29')](_0xcf08a6)){logger[_0x1979('0xd')](_0x1979('0x2a'),_0xcf08a6);return request({'form':{'method':_0x1979('0x2b'),'input_type':_0x1979('0x22'),'response_type':'JSON','rest_data':JSON[_0x1979('0x28')]({'session':_0x5d11d4['id'],'module_name':_0x1979('0x2c'),'query':util[_0x1979('0x23')](_0x1979('0x2d'),_0xcf08a6),'order_by':'','offset':'0','select_fields':['id',_0x1979('0x1a'),_0x1979('0x2e')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x1979('0x2f')](function(_0x47c985){if(_0x47c985[_0x1979('0x30')]['length']){var _0x43d1a4=_['find'](_0x47c985['entry_list'],function(_0x11d79a){return _0x11d79a['name_value_list'][_0x1979('0x2e')][_0x1979('0x31')]===_0xcf08a6;});if(_0x43d1a4){logger[_0x1979('0xd')]('Agent\x20found!');return BPromise[_0x1979('0x32')]({'id':_0x43d1a4['name_value_list']['id']['value'],'name':_0x43d1a4[_0x1979('0x33')]['name']['value']});}}logger[_0x1979('0xd')](_0x1979('0x34'));return BPromise[_0x1979('0x32')]({'id':_0x5d11d4['name_value_list'][_0x1979('0x35')][_0x1979('0x31')],'name':_0x5d11d4['name_value_list'][_0x1979('0x2e')][_0x1979('0x31')]});});}else{logger[_0x1979('0xd')](_0x1979('0x36'));return BPromise['resolve']({'id':_0x5d11d4[_0x1979('0x33')][_0x1979('0x35')]['value'],'name':_0x5d11d4[_0x1979('0x33')]['user_name']['value']});}}function getEndUser(_0xf93235,_0x201bfa,_0x8b0f70,_0xceccdd){logger[_0x1979('0xd')]('Searching\x20enduser\x20with\x20phone',_0x8b0f70);return request({'form':{'method':'get_entry_list','input_type':_0x1979('0x22'),'response_type':_0x1979('0x22'),'rest_data':JSON[_0x1979('0x28')]({'session':_0xceccdd['id'],'module_name':'Contacts','query':util['format'](_0x1979('0x37'),_0x8b0f70),'order_by':'','offset':'0','select_fields':['id',_0x1979('0x1a'),'phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x1979('0x2f')](function(_0x22cf23){if(_0x22cf23['entry_list'][_0x1979('0x1c')]){var _0x179ca0=_[_0x1979('0x38')](_0x22cf23[_0x1979('0x30')],function(_0x159613){return _0x159613[_0x1979('0x33')][_0x1979('0x39')][_0x1979('0x31')]===_0x8b0f70;});if(_0x179ca0){logger['info'](_0x1979('0x3a'));return BPromise['resolve']({'id':_0x179ca0[_0x1979('0x33')]['id'][_0x1979('0x31')],'name':_0x179ca0[_0x1979('0x33')][_0x1979('0x1a')][_0x1979('0x31')],'phone':_0x179ca0[_0x1979('0x33')][_0x1979('0x39')][_0x1979('0x31')]});}}else{logger[_0x1979('0xd')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':'set_entry','input_type':_0x1979('0x22'),'response_type':_0x1979('0x22'),'rest_data':JSON['stringify']({'session':_0xceccdd['id'],'module_name':'Contacts','name_value_list':[{'name':'first_name','value':_0x201bfa!==''?_0x201bfa:util[_0x1979('0x23')]('Caller\x20-\x20%s',_0x8b0f70)},{'name':_0x1979('0x39'),'value':_0x8b0f70}]})}})[_0x1979('0x2f')](function(_0x4b4daf){logger['info']('Enduser\x20created.');return BPromise[_0x1979('0x32')]({'id':_0x4b4daf['id'],'name':_0x4b4daf[_0x1979('0x30')][_0x1979('0x3b')][_0x1979('0x31')],'phone':_0x4b4daf[_0x1979('0x30')]['phone_home']['value']});});}});}function request(_0x34f5db){logger[_0x1979('0x3c')](_0x1979('0x3d'),JSON[_0x1979('0x28')](_0x34f5db));return rp(_[_0x1979('0x3e')](def,_0x34f5db));}function getTags(_0x4aab99,_0x4f2d27){var _0x1c0f2b=[];if(_0x4aab99&&_0x4aab99[_0x1979('0x1c')]>0x0){_0x1c0f2b=_['map'](_0x4aab99,_0x4f2d27);}return _0x1c0f2b;}function getCustomFields(_0x58acfb,_0x1c59c0){var _0x5885ad=[];var _0x48037e={'custom_fields':[]};if(_0x58acfb[_0x1979('0x1c')]>0x0){_[_0x1979('0x1d')](_0x58acfb,function(_0x43a184){if(_0x43a184['type']===_0x1979('0x3f')&&_0x43a184[_0x1979('0x40')]&&!_0x43a184['customField']){_0x48037e[_0x43a184[_0x1979('0x40')][_0x1979('0x41')]()]=_0x43a184['content'][_0x1979('0x25')]();}else if(_0x43a184[_0x1979('0x42')]===_0x1979('0x3f')&&_0x43a184[_0x1979('0x1f')]&&_0x43a184[_0x1979('0x43')]){_0x48037e[_0x1979('0x44')]['push']({'id':_0x43a184[_0x1979('0x1f')],'value':_0x43a184[_0x1979('0x45')][_0x1979('0x25')]()});}else if(_0x43a184[_0x1979('0x42')]===_0x1979('0x46')&&_0x43a184[_0x1979('0x20')]&&_0x43a184[_0x1979('0x1f')]&&_0x43a184[_0x1979('0x43')]){_0x1c59c0[_0x43a184[_0x1979('0x20')]]&&_0x48037e[_0x1979('0x44')][_0x1979('0x1e')]({'id':_0x43a184[_0x1979('0x1f')],'value':_0x1c59c0[_0x43a184[_0x1979('0x20')]][_0x1979('0x25')]()});}else if(_0x43a184['type']===_0x1979('0x47')&&_0x43a184[_0x1979('0x48')]&&_0x43a184['Variable']['name']&&_0x43a184[_0x1979('0x1f')]&&_0x43a184['customField']){_0x1c59c0[_0x43a184[_0x1979('0x48')][_0x1979('0x1a')][_0x1979('0x41')]()]&&_0x48037e['custom_fields'][_0x1979('0x1e')]({'id':_0x43a184[_0x1979('0x1f')],'value':_0x1c59c0[_0x43a184[_0x1979('0x48')]['name'][_0x1979('0x41')]()][_0x1979('0x25')]()});}});}return _0x48037e;}function getConnection(_0x32d059){return request({'method':'POST','form':{'method':_0x1979('0x49'),'input_type':_0x1979('0x22'),'response_type':_0x1979('0x22'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x32d059['username'],'password':_0x32d059['password'],'encryption':'PLAIN'},'application':_0x1979('0x4a')})}})[_0x1979('0x2f')](function(_0x1ee80c){var _0x48114e=_0x1ee80c;if(_0x48114e['id']){def[_0x1979('0x4b')]=_0x48114e['id'];return BPromise[_0x1979('0x32')](_0x48114e);}else{throw new Error(util[_0x1979('0x23')]('Account\x20%d\x20is\x20not\x20valid',_0x32d059['id']));}});}function setRelationship(_0x545824,_0x31149b,_0x410ac1,_0x2e9df7){return request({'form':{'method':_0x1979('0x4c'),'input_type':_0x1979('0x22'),'response_type':_0x1979('0x22'),'rest_data':JSON['stringify']({'session':_0x545824['id'],'module_name':'Calls','module_id':_0x410ac1['id'],'link_field_name':_0x2e9df7,'related_ids':[_0x31149b['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x1979('0x4d')]=function(_0x48d334,_0x5d21e4,_0x402213,_0x5c1ee9,_0x19332d,_0x2be8d7){var _0x52d4c0,_0xecde4b,_0x335dac,_0x177d1a;_0x2be8d7[_0x1979('0x4e')]=intUtil['stripTrailingSlash'](_0x2be8d7[_0x1979('0x4e')]);_0x2be8d7[_0x1979('0x4f')]=intUtil[_0x1979('0x50')](_0x2be8d7[_0x1979('0x4f')]);def['uri']=util[_0x1979('0x23')](_0x1979('0x51'),_0x2be8d7['remoteUri']);if(_0x19332d&&_0x19332d[_0x1979('0x52')]){logger[_0x1979('0xd')](_0x1979('0x53'),_0x1979('0x54'));_0x5d21e4[_0x1979('0x55')]=util['format'](_0x1979('0x56'),_0x2be8d7[_0x1979('0x4f')],_0x5d21e4[_0x1979('0x57')],md5(_0x5d21e4[_0x1979('0x57')]));}else{_0x5d21e4[_0x1979('0x55')]='';}return getConnection(_0x2be8d7)[_0x1979('0x2f')](function(_0x27888f){_0x177d1a=_0x27888f;return getUser(_0x2be8d7,_0x5c1ee9[_0x1979('0x1a')],_0x177d1a);})[_0x1979('0x2f')](function(_0x3f6437){_0x52d4c0=_0x3f6437;logger['info'](_0x1979('0x58'),_0x52d4c0['id']);return getEndUser(_0x2be8d7,_0x5d21e4['calleridname'],_0x5d21e4[_0x1979('0x59')],_0x177d1a);})[_0x1979('0x2f')](function(_0x3d2d23){_0xecde4b=_0x3d2d23;logger[_0x1979('0xd')](_0x1979('0x5a'),_0xecde4b['id']);return getTicket(_0x2be8d7,_0x52d4c0,_0xecde4b,_0x402213,_0x5d21e4,_0x402213[_0x1979('0x5b')],_0x177d1a,_0x1979('0x5c'));})[_0x1979('0x2f')](function(_0x5499b6){_0x335dac=_0x5499b6;logger[_0x1979('0xd')](_0x1979('0x5d'));logger['info'](_0x1979('0x5e'),_0x335dac['id']);return setRelationship(_0x177d1a,_0x52d4c0,_0x335dac,'users');})['then'](function(){return setRelationship(_0x177d1a,_0xecde4b,_0x335dac,_0x1979('0x5f'));})[_0x1979('0x2f')](function(){return getServerInfo(_0x177d1a);})[_0x1979('0x2f')](function(_0x87ce70){var _0x5a4432=parseInt(_0x87ce70['version'][_0x1979('0x60')](0x0));var _0x3b5d64=util[_0x1979('0x23')](_0x1979('0x61'),_0x2be8d7[_0x1979('0x4e')],_0x335dac['id']);if(_0x5a4432>0x6){_0x3b5d64=util[_0x1979('0x23')](_0x1979('0x62'),_0x2be8d7[_0x1979('0x4e')],_0x335dac['id']);}logger[_0x1979('0xd')]('[QUEUE]',_0x1979('0x63'));emit(util[_0x1979('0x23')]('user:%s',_0x5c1ee9[_0x1979('0x1a')]),_0x1979('0x64'),{'uri':_0x3b5d64});})[_0x1979('0x65')](function(_0x16f632){logger[_0x1979('0x66')](_0x1979('0x53'),JSON['stringify'](_0x16f632));});};exports[_0x1979('0x67')]=function(_0x2c9966,_0x2af5b2,_0x48cabb,_0x4c59d9,_0x4c495b,_0x3085bf,_0x49740a){var _0x30f9d9,_0x2bd59a,_0x54e11,_0x2a0c20;_0x3085bf[_0x1979('0x4e')]=intUtil[_0x1979('0x50')](_0x3085bf['remoteUri']);_0x3085bf[_0x1979('0x4f')]=intUtil[_0x1979('0x50')](_0x3085bf[_0x1979('0x4f')]);def['uri']=util[_0x1979('0x23')](_0x1979('0x51'),_0x3085bf[_0x1979('0x4e')]);if(_0x49740a&&_0x49740a[_0x1979('0x68')]&&_0x49740a[_0x1979('0x68')]!==_0x1979('0x69')){logger['info'](_0x1979('0x6a'),_0x1979('0x54'));_0x2af5b2['recordingURL']=util[_0x1979('0x23')](_0x1979('0x56'),_0x3085bf[_0x1979('0x4f')],_0x2af5b2[_0x1979('0x57')],md5(_0x2af5b2['uniqueid']));}return getConnection(_0x3085bf)[_0x1979('0x2f')](function(_0x3beb97){_0x2a0c20=_0x3beb97;return getUser(_0x3085bf,_0x4c59d9[_0x1979('0x1a')],_0x2a0c20);})[_0x1979('0x2f')](function(_0x129dc1){_0x30f9d9=_0x129dc1;logger['info'](_0x1979('0x58'),_0x30f9d9['id']);return getEndUser(_0x3085bf,_0x2af5b2[_0x1979('0x6b')],_0x2af5b2[_0x1979('0x6c')],_0x2a0c20);})[_0x1979('0x2f')](function(_0x5e3634){_0x2bd59a=_0x5e3634;logger[_0x1979('0xd')](_0x1979('0x5a'),_0x2bd59a['id']);return getTicket(_0x3085bf,_0x30f9d9,_0x2bd59a,_0x48cabb,_0x2af5b2,_0x48cabb['Fields'],_0x2a0c20,_0x1979('0x6d'));})[_0x1979('0x2f')](function(_0x4fb3f7){_0x54e11=_0x4fb3f7;logger['info']('Ticket\x20created!');logger[_0x1979('0xd')](_0x1979('0x5e'),_0x54e11['id']);return setRelationship(_0x2a0c20,_0x30f9d9,_0x54e11,'users');})['then'](function(){return setRelationship(_0x2a0c20,_0x2bd59a,_0x54e11,_0x1979('0x5f'));})[_0x1979('0x2f')](function(){return getServerInfo(_0x2a0c20);})[_0x1979('0x2f')](function(_0x280728){var _0x275b19=parseInt(_0x280728['version'][_0x1979('0x60')](0x0));var _0xdd3af5=util[_0x1979('0x23')](_0x1979('0x61'),_0x3085bf['remoteUri'],_0x54e11['id']);if(_0x275b19>0x6){_0xdd3af5=util[_0x1979('0x23')](_0x1979('0x62'),_0x3085bf[_0x1979('0x4e')],_0x54e11['id']);}logger[_0x1979('0xd')](_0x1979('0x6a'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x1979('0x23')](_0x1979('0x6e'),_0x4c59d9['name']),'trigger:browser:url',{'uri':_0xdd3af5});})[_0x1979('0x65')](function(_0x441834){logger[_0x1979('0x66')](_0x1979('0x6a'),JSON[_0x1979('0x28')](_0x441834));});};exports[_0x1979('0x6f')]=function(_0x43f91e,_0x2ff285,_0x2eeecf,_0x34c3fb,_0x4f47ab,_0x349553){var _0x15d27b,_0x21bfa5,_0x154d62,_0x24a242;_0x349553[_0x1979('0x4e')]=intUtil['stripTrailingSlash'](_0x349553[_0x1979('0x4e')]);_0x349553['serverUrl']=intUtil['stripTrailingSlash'](_0x349553[_0x1979('0x4f')]);def[_0x1979('0x70')]=util[_0x1979('0x23')](_0x1979('0x51'),_0x349553['remoteUri']);if(_0x4f47ab&&_0x4f47ab[_0x1979('0x52')]){logger[_0x1979('0xd')]('['+_0x2ff285[_0x1979('0x71')][_0x1979('0x72')]()+']',_0x1979('0x54'));_0x2ff285['recordingURL']=util[_0x1979('0x23')](_0x1979('0x56'),_0x349553[_0x1979('0x4f')],_0x2ff285[_0x1979('0x57')],md5(_0x2ff285[_0x1979('0x57')]));}else{_0x2ff285[_0x1979('0x55')]='';}return getConnection(_0x349553)[_0x1979('0x2f')](function(_0x1a3924){_0x24a242=_0x1a3924;if(!_[_0x1979('0x29')](_0x34c3fb)){return getUser(_0x349553,_0x34c3fb[_0x1979('0x1a')],_0x24a242);}else{return getUser(_0x349553,null,_0x24a242);}})[_0x1979('0x2f')](function(_0x4115b3){_0x15d27b=_0x4115b3;logger[_0x1979('0xd')](_0x1979('0x58'),_0x15d27b['id']);return getEndUser(_0x349553,_0x2ff285[_0x1979('0x73')],_0x2ff285[_0x1979('0x59')],_0x24a242);})[_0x1979('0x2f')](function(_0x191632){_0x21bfa5=_0x191632;logger[_0x1979('0xd')](_0x1979('0x5a'),_0x21bfa5['id']);return getTicket(_0x349553,_0x15d27b,_0x21bfa5,_0x2eeecf,_0x2ff285,_0x2eeecf[_0x1979('0x5b')],_0x24a242,_0x1979('0x5c'));})[_0x1979('0x2f')](function(_0x32ea36){_0x154d62=_0x32ea36;logger[_0x1979('0xd')](_0x1979('0x5d'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x154d62['id']);return setRelationship(_0x24a242,_0x15d27b,_0x154d62,_0x1979('0x74'));})[_0x1979('0x2f')](function(){return setRelationship(_0x24a242,_0x21bfa5,_0x154d62,'contacts');})[_0x1979('0x2f')](function(){return getServerInfo(_0x24a242);})[_0x1979('0x65')](function(_0x461581){logger[_0x1979('0x66')]('['+_0x2ff285[_0x1979('0x71')][_0x1979('0x72')]()+']',JSON[_0x1979('0x28')](_0x461581));});}; \ No newline at end of file +var _0x2c47=['first_name','Caller\x20-\x20%s','Enduser\x20created.','debug','[HTTP]','merge','map','type','nameField','customField','toString','custom_fields','content','variable','customVariable','Variable','toLowerCase','POST','username','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','queue','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','version','charAt','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','user:%s','catch','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','recordingURL','destcalleridname','destcalleridnum','Outbound','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','error','unmanaged','lastevent','toUpperCase','isNil','lodash','bluebird','util','ioredis','./util','../../../../config/environment','sugarcrm','redis','defaults','socket.io-emitter','emit','info','Creating\x20new\x20ticket...','getString','Subjects','assigned_user_id','description','Descriptions','date_start','toISOString','replace','duration_minutes','parent_id','parent_type','Contacts','parent_name','direction','length','forEach','push','idField','variableName','set_entry','JSON','stringify','Calls','format','apiKey','base64','get_server_info','Getting\x20agent\x20with\x20name','get_entry_list','Employees','name','user_name','entry_list','find','Agent\x20found!','resolve','name_value_list','value','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','user_id','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','then','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!'];(function(_0x196f40,_0x417e6e){var _0x544d7b=function(_0x46c19c){while(--_0x46c19c){_0x196f40['push'](_0x196f40['shift']());}};_0x544d7b(++_0x417e6e);}(_0x2c47,0xbf));var _0x72c4=function(_0x2fc12c,_0x51228e){_0x2fc12c=_0x2fc12c-0x0;var _0x120436=_0x2c47[_0x2fc12c];return _0x120436;};'use strict';var _=require(_0x72c4('0x0'));var rp=require('request-promise');var BPromise=require(_0x72c4('0x1'));var md5=require('md5');var util=require(_0x72c4('0x2'));var Redis=require(_0x72c4('0x3'));var intUtil=require(_0x72c4('0x4'));var config=require(_0x72c4('0x5'));var logger=require('../../../../config/logger')(_0x72c4('0x6'));config[_0x72c4('0x7')]=_[_0x72c4('0x8')](config[_0x72c4('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x72c4('0x9'))(new Redis(config[_0x72c4('0x7')]));var def={'method':'POST','json':!![]};function emit(_0x5e3a21,_0x2e3e03,_0x2b6d44){io['to'](_0x5e3a21)[_0x72c4('0xa')](_0x2e3e03,_0x2b6d44);}function getTicket(_0x32f94d,_0x1fc98e,_0xab96d4,_0x471b09,_0x104237,_0x27e44a,_0x4b0285,_0x4c6a2c){logger[_0x72c4('0xb')](_0x72c4('0xc'));var _0x11d43d=new Date();var _0x4696e6=[{'name':'name','value':intUtil[_0x72c4('0xd')](_0x471b09[_0x72c4('0xe')],_0x104237,'\x20')},{'name':_0x72c4('0xf'),'value':_0x1fc98e['id']},{'name':'created_by','value':_0x1fc98e['id']},{'name':_0x72c4('0x10'),'value':intUtil['getString'](_0x471b09[_0x72c4('0x11')],_0x104237,'\x0a')},{'name':_0x72c4('0x12'),'value':_0x11d43d[_0x72c4('0x13')]()['slice'](0x0,0x13)[_0x72c4('0x14')]('T','\x20')},{'name':'duration_hours','value':'0'},{'name':_0x72c4('0x15'),'value':'15'},{'name':_0x72c4('0x16'),'value':_0xab96d4['id']},{'name':_0x72c4('0x17'),'value':_0x72c4('0x18')},{'name':_0x72c4('0x19'),'value':_0xab96d4['name']},{'name':_0x72c4('0x1a'),'value':_0x4c6a2c}];if(_0x27e44a[_0x72c4('0x1b')]){_[_0x72c4('0x1c')](_0x27e44a,function(_0x45dfa7){if(_0x104237[_0x45dfa7['variableName']]){_0x4696e6[_0x72c4('0x1d')]({'name':_0x45dfa7[_0x72c4('0x1e')],'value':_0x104237[_0x45dfa7[_0x72c4('0x1f')]]});}});}return request({'form':{'method':_0x72c4('0x20'),'input_type':_0x72c4('0x21'),'response_type':'JSON','rest_data':JSON[_0x72c4('0x22')]({'session':_0x4b0285['id'],'module_name':_0x72c4('0x23'),'name_value_list':_0x4696e6})}});}function getAuth(_0x34fe79){return util[_0x72c4('0x24')]('Basic\x20%s',new Buffer(_0x34fe79[_0x72c4('0x25')]+':X')['toString'](_0x72c4('0x26')));}function getServerInfo(_0x497ce7){return request({'form':{'method':_0x72c4('0x27'),'input_type':_0x72c4('0x21'),'response_type':_0x72c4('0x21'),'rest_data':JSON[_0x72c4('0x22')]({'session':_0x497ce7['id']})}});}function getUser(_0x4331c3,_0x393fb0,_0x59372e){if(!_['isNil'](_0x393fb0)){logger[_0x72c4('0xb')](_0x72c4('0x28'),_0x393fb0);return request({'form':{'method':_0x72c4('0x29'),'input_type':_0x72c4('0x21'),'response_type':'JSON','rest_data':JSON[_0x72c4('0x22')]({'session':_0x59372e['id'],'module_name':_0x72c4('0x2a'),'query':util[_0x72c4('0x24')]('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0x393fb0),'order_by':'','offset':'0','select_fields':['id',_0x72c4('0x2b'),_0x72c4('0x2c')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x3e8487){if(_0x3e8487[_0x72c4('0x2d')][_0x72c4('0x1b')]){var _0x42bb8c=_[_0x72c4('0x2e')](_0x3e8487['entry_list'],function(_0x4128be){return _0x4128be['name_value_list'][_0x72c4('0x2c')]['value']===_0x393fb0;});if(_0x42bb8c){logger[_0x72c4('0xb')](_0x72c4('0x2f'));return BPromise[_0x72c4('0x30')]({'id':_0x42bb8c[_0x72c4('0x31')]['id']['value'],'name':_0x42bb8c['name_value_list'][_0x72c4('0x2b')][_0x72c4('0x32')]});}}logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x72c4('0x30')]({'id':_0x59372e[_0x72c4('0x31')]['user_id'][_0x72c4('0x32')],'name':_0x59372e[_0x72c4('0x31')][_0x72c4('0x2c')][_0x72c4('0x32')]});});}else{logger[_0x72c4('0xb')](_0x72c4('0x33'));return BPromise[_0x72c4('0x30')]({'id':_0x59372e['name_value_list'][_0x72c4('0x34')][_0x72c4('0x32')],'name':_0x59372e[_0x72c4('0x31')]['user_name'][_0x72c4('0x32')]});}}function getEndUser(_0x149fcc,_0xa49c90,_0x31eef8,_0x598683){logger['info'](_0x72c4('0x35'),_0x31eef8);return request({'form':{'method':_0x72c4('0x29'),'input_type':_0x72c4('0x21'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x598683['id'],'module_name':'Contacts','query':util['format'](_0x72c4('0x36'),_0x31eef8),'order_by':'','offset':'0','select_fields':['id',_0x72c4('0x2b'),'phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x72c4('0x37')](function(_0x42797a){if(_0x42797a[_0x72c4('0x2d')][_0x72c4('0x1b')]){var _0x39b41b=_[_0x72c4('0x2e')](_0x42797a['entry_list'],function(_0x58ed25){return _0x58ed25[_0x72c4('0x31')][_0x72c4('0x38')][_0x72c4('0x32')]===_0x31eef8;});if(_0x39b41b){logger[_0x72c4('0xb')](_0x72c4('0x39'));return BPromise[_0x72c4('0x30')]({'id':_0x39b41b['name_value_list']['id']['value'],'name':_0x39b41b[_0x72c4('0x31')][_0x72c4('0x2b')][_0x72c4('0x32')],'phone':_0x39b41b['name_value_list'][_0x72c4('0x38')]['value']});}}else{logger['info'](_0x72c4('0x3a'));return request({'form':{'method':'set_entry','input_type':_0x72c4('0x21'),'response_type':_0x72c4('0x21'),'rest_data':JSON[_0x72c4('0x22')]({'session':_0x598683['id'],'module_name':_0x72c4('0x18'),'name_value_list':[{'name':_0x72c4('0x3b'),'value':_0xa49c90!==''?_0xa49c90:util[_0x72c4('0x24')](_0x72c4('0x3c'),_0x31eef8)},{'name':_0x72c4('0x38'),'value':_0x31eef8}]})}})[_0x72c4('0x37')](function(_0x12652e){logger['info'](_0x72c4('0x3d'));return BPromise[_0x72c4('0x30')]({'id':_0x12652e['id'],'name':_0x12652e[_0x72c4('0x2d')]['first_name']['value'],'phone':_0x12652e[_0x72c4('0x2d')][_0x72c4('0x38')][_0x72c4('0x32')]});});}});}function request(_0x4cfda3){logger[_0x72c4('0x3e')](_0x72c4('0x3f'),JSON[_0x72c4('0x22')](_0x4cfda3));return rp(_[_0x72c4('0x40')](def,_0x4cfda3));}function getTags(_0x101e8a,_0x1634c1){var _0x5dfd5c=[];if(_0x101e8a&&_0x101e8a['length']>0x0){_0x5dfd5c=_[_0x72c4('0x41')](_0x101e8a,_0x1634c1);}return _0x5dfd5c;}function getCustomFields(_0x346a52,_0x48951d){var _0x2920d8=[];var _0x543b35={'custom_fields':[]};if(_0x346a52[_0x72c4('0x1b')]>0x0){_['forEach'](_0x346a52,function(_0x2c451d){if(_0x2c451d[_0x72c4('0x42')]==='string'&&_0x2c451d[_0x72c4('0x43')]&&!_0x2c451d[_0x72c4('0x44')]){_0x543b35[_0x2c451d[_0x72c4('0x43')]['toLowerCase']()]=_0x2c451d['content'][_0x72c4('0x45')]();}else if(_0x2c451d[_0x72c4('0x42')]==='string'&&_0x2c451d['idField']&&_0x2c451d[_0x72c4('0x44')]){_0x543b35[_0x72c4('0x46')]['push']({'id':_0x2c451d[_0x72c4('0x1e')],'value':_0x2c451d[_0x72c4('0x47')][_0x72c4('0x45')]()});}else if(_0x2c451d[_0x72c4('0x42')]===_0x72c4('0x48')&&_0x2c451d[_0x72c4('0x1f')]&&_0x2c451d[_0x72c4('0x1e')]&&_0x2c451d[_0x72c4('0x44')]){_0x48951d[_0x2c451d[_0x72c4('0x1f')]]&&_0x543b35[_0x72c4('0x46')][_0x72c4('0x1d')]({'id':_0x2c451d['idField'],'value':_0x48951d[_0x2c451d[_0x72c4('0x1f')]][_0x72c4('0x45')]()});}else if(_0x2c451d[_0x72c4('0x42')]===_0x72c4('0x49')&&_0x2c451d[_0x72c4('0x4a')]&&_0x2c451d[_0x72c4('0x4a')][_0x72c4('0x2b')]&&_0x2c451d[_0x72c4('0x1e')]&&_0x2c451d[_0x72c4('0x44')]){_0x48951d[_0x2c451d[_0x72c4('0x4a')][_0x72c4('0x2b')]['toLowerCase']()]&&_0x543b35[_0x72c4('0x46')][_0x72c4('0x1d')]({'id':_0x2c451d[_0x72c4('0x1e')],'value':_0x48951d[_0x2c451d[_0x72c4('0x4a')][_0x72c4('0x2b')][_0x72c4('0x4b')]()]['toString']()});}});}return _0x543b35;}function getConnection(_0x565868){return request({'method':_0x72c4('0x4c'),'form':{'method':'login','input_type':'JSON','response_type':_0x72c4('0x21'),'rest_data':JSON[_0x72c4('0x22')]({'user_auth':{'user_name':_0x565868[_0x72c4('0x4d')],'password':_0x565868[_0x72c4('0x4e')],'encryption':_0x72c4('0x4f')},'application':_0x72c4('0x50')})}})[_0x72c4('0x37')](function(_0x4cb760){var _0x52e8ce=_0x4cb760;if(_0x52e8ce['id']){def[_0x72c4('0x51')]=_0x52e8ce['id'];return BPromise[_0x72c4('0x30')](_0x52e8ce);}else{throw new Error(util[_0x72c4('0x24')](_0x72c4('0x52'),_0x565868['id']));}});}function setRelationship(_0x1eec65,_0x51e7f2,_0x291a59,_0x1d2108){return request({'form':{'method':'set_relationship','input_type':_0x72c4('0x21'),'response_type':_0x72c4('0x21'),'rest_data':JSON[_0x72c4('0x22')]({'session':_0x1eec65['id'],'module_name':'Calls','module_id':_0x291a59['id'],'link_field_name':_0x1d2108,'related_ids':[_0x51e7f2['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x72c4('0x53')]=function(_0x1b7bce,_0x43d089,_0x39cb49,_0x251513,_0xf98fd,_0x24ba23){var _0x398565,_0x2345b7,_0x1384a2,_0x3905d5;_0x24ba23[_0x72c4('0x54')]=intUtil[_0x72c4('0x55')](_0x24ba23[_0x72c4('0x54')]);_0x24ba23['serverUrl']=intUtil[_0x72c4('0x55')](_0x24ba23[_0x72c4('0x56')]);def[_0x72c4('0x57')]=util[_0x72c4('0x24')](_0x72c4('0x58'),_0x24ba23[_0x72c4('0x54')]);if(_0xf98fd&&_0xf98fd[_0x72c4('0x59')]){logger[_0x72c4('0xb')](_0x72c4('0x5a'),'Recording\x20is\x20enabled!');_0x43d089['recordingURL']=util[_0x72c4('0x24')](_0x72c4('0x5b'),_0x24ba23[_0x72c4('0x56')],_0x43d089['uniqueid'],md5(_0x43d089[_0x72c4('0x5c')]));}else{_0x43d089['recordingURL']='';}return getConnection(_0x24ba23)[_0x72c4('0x37')](function(_0x3c0180){_0x3905d5=_0x3c0180;return getUser(_0x24ba23,_0x251513[_0x72c4('0x2b')],_0x3905d5);})[_0x72c4('0x37')](function(_0x1b4b60){_0x398565=_0x1b4b60;logger[_0x72c4('0xb')](_0x72c4('0x5d'),_0x398565['id']);return getEndUser(_0x24ba23,_0x43d089[_0x72c4('0x5e')],_0x43d089[_0x72c4('0x5f')],_0x3905d5);})['then'](function(_0x2212c0){_0x2345b7=_0x2212c0;logger[_0x72c4('0xb')](_0x72c4('0x60'),_0x2345b7['id']);return getTicket(_0x24ba23,_0x398565,_0x2345b7,_0x39cb49,_0x43d089,_0x39cb49[_0x72c4('0x61')],_0x3905d5,_0x72c4('0x62'));})[_0x72c4('0x37')](function(_0x1ee738){_0x1384a2=_0x1ee738;logger['info'](_0x72c4('0x63'));logger['info'](_0x72c4('0x64'),_0x1384a2['id']);return setRelationship(_0x3905d5,_0x398565,_0x1384a2,_0x72c4('0x65'));})['then'](function(){return setRelationship(_0x3905d5,_0x2345b7,_0x1384a2,_0x72c4('0x66'));})[_0x72c4('0x37')](function(){return getServerInfo(_0x3905d5);})[_0x72c4('0x37')](function(_0x1da266){var _0x1b3772=parseInt(_0x1da266[_0x72c4('0x67')][_0x72c4('0x68')](0x0));var _0x1d05ee=util[_0x72c4('0x24')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x24ba23['remoteUri'],_0x1384a2['id']);if(_0x1b3772>0x6){_0x1d05ee=util['format'](_0x72c4('0x69'),_0x24ba23[_0x72c4('0x54')],_0x1384a2['id']);}logger[_0x72c4('0xb')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x72c4('0x6a'),_0x251513[_0x72c4('0x2b')]),'trigger:browser:url',{'uri':_0x1d05ee});})[_0x72c4('0x6b')](function(_0x49833f){logger['error'](_0x72c4('0x5a'),JSON[_0x72c4('0x22')](_0x49833f));});};exports[_0x72c4('0x6c')]=function(_0x208fcc,_0x42c9b4,_0x231017,_0x190783,_0x121cc4,_0x32f737,_0xf60395){var _0xe8d836,_0x2bfc11,_0x416efc,_0x453994;_0x32f737[_0x72c4('0x54')]=intUtil[_0x72c4('0x55')](_0x32f737['remoteUri']);_0x32f737[_0x72c4('0x56')]=intUtil[_0x72c4('0x55')](_0x32f737['serverUrl']);def[_0x72c4('0x57')]=util['format'](_0x72c4('0x58'),_0x32f737[_0x72c4('0x54')]);if(_0xf60395&&_0xf60395[_0x72c4('0x6d')]&&_0xf60395[_0x72c4('0x6d')]!==_0x72c4('0x6e')){logger[_0x72c4('0xb')](_0x72c4('0x6f'),_0x72c4('0x70'));_0x42c9b4[_0x72c4('0x71')]=util['format'](_0x72c4('0x5b'),_0x32f737[_0x72c4('0x56')],_0x42c9b4[_0x72c4('0x5c')],md5(_0x42c9b4[_0x72c4('0x5c')]));}return getConnection(_0x32f737)[_0x72c4('0x37')](function(_0x45e546){_0x453994=_0x45e546;return getUser(_0x32f737,_0x190783[_0x72c4('0x2b')],_0x453994);})[_0x72c4('0x37')](function(_0x47a431){_0xe8d836=_0x47a431;logger['info'](_0x72c4('0x5d'),_0xe8d836['id']);return getEndUser(_0x32f737,_0x42c9b4[_0x72c4('0x72')],_0x42c9b4[_0x72c4('0x73')],_0x453994);})[_0x72c4('0x37')](function(_0x280c52){_0x2bfc11=_0x280c52;logger['info'](_0x72c4('0x60'),_0x2bfc11['id']);return getTicket(_0x32f737,_0xe8d836,_0x2bfc11,_0x231017,_0x42c9b4,_0x231017['Fields'],_0x453994,_0x72c4('0x74'));})['then'](function(_0x891aaa){_0x416efc=_0x891aaa;logger[_0x72c4('0xb')](_0x72c4('0x63'));logger[_0x72c4('0xb')]('The\x20Ticket\x20ID\x20is:',_0x416efc['id']);return setRelationship(_0x453994,_0xe8d836,_0x416efc,_0x72c4('0x65'));})[_0x72c4('0x37')](function(){return setRelationship(_0x453994,_0x2bfc11,_0x416efc,_0x72c4('0x66'));})[_0x72c4('0x37')](function(){return getServerInfo(_0x453994);})['then'](function(_0x8a782a){var _0x3749e7=parseInt(_0x8a782a['version'][_0x72c4('0x68')](0x0));var _0x1885b2=util[_0x72c4('0x24')](_0x72c4('0x75'),_0x32f737['remoteUri'],_0x416efc['id']);if(_0x3749e7>0x6){_0x1885b2=util[_0x72c4('0x24')](_0x72c4('0x69'),_0x32f737['remoteUri'],_0x416efc['id']);}logger[_0x72c4('0xb')](_0x72c4('0x6f'),_0x72c4('0x76'));emit(util['format'](_0x72c4('0x6a'),_0x190783[_0x72c4('0x2b')]),_0x72c4('0x77'),{'uri':_0x1885b2});})['catch'](function(_0x27f1b2){logger[_0x72c4('0x78')]('[OUTBOUND]',JSON[_0x72c4('0x22')](_0x27f1b2));});};exports[_0x72c4('0x79')]=function(_0x56da03,_0x1bc9d3,_0x18683d,_0x35847e,_0x3af255,_0x230e3c){var _0xbd075e,_0x63b7db,_0x19b35f,_0x681f1e;_0x230e3c[_0x72c4('0x54')]=intUtil['stripTrailingSlash'](_0x230e3c[_0x72c4('0x54')]);_0x230e3c[_0x72c4('0x56')]=intUtil[_0x72c4('0x55')](_0x230e3c['serverUrl']);def[_0x72c4('0x57')]=util[_0x72c4('0x24')]('%s/service/v4_1/rest.php',_0x230e3c[_0x72c4('0x54')]);if(_0x3af255&&_0x3af255[_0x72c4('0x59')]){logger[_0x72c4('0xb')]('['+_0x1bc9d3[_0x72c4('0x7a')][_0x72c4('0x7b')]()+']',_0x72c4('0x70'));_0x1bc9d3[_0x72c4('0x71')]=util['format'](_0x72c4('0x5b'),_0x230e3c[_0x72c4('0x56')],_0x1bc9d3['uniqueid'],md5(_0x1bc9d3['uniqueid']));}else{_0x1bc9d3[_0x72c4('0x71')]='';}return getConnection(_0x230e3c)[_0x72c4('0x37')](function(_0x41c69d){_0x681f1e=_0x41c69d;if(!_[_0x72c4('0x7c')](_0x35847e)){return getUser(_0x230e3c,_0x35847e[_0x72c4('0x2b')],_0x681f1e);}else{return getUser(_0x230e3c,null,_0x681f1e);}})[_0x72c4('0x37')](function(_0x2ab877){_0xbd075e=_0x2ab877;logger[_0x72c4('0xb')](_0x72c4('0x5d'),_0xbd075e['id']);return getEndUser(_0x230e3c,_0x1bc9d3[_0x72c4('0x5e')],_0x1bc9d3[_0x72c4('0x5f')],_0x681f1e);})[_0x72c4('0x37')](function(_0x5cbce3){_0x63b7db=_0x5cbce3;logger[_0x72c4('0xb')]('The\x20Enduser\x20ID\x20is:',_0x63b7db['id']);return getTicket(_0x230e3c,_0xbd075e,_0x63b7db,_0x18683d,_0x1bc9d3,_0x18683d['Fields'],_0x681f1e,'Inbound');})[_0x72c4('0x37')](function(_0x50f797){_0x19b35f=_0x50f797;logger['info']('Ticket\x20created!');logger[_0x72c4('0xb')](_0x72c4('0x64'),_0x19b35f['id']);return setRelationship(_0x681f1e,_0xbd075e,_0x19b35f,_0x72c4('0x65'));})[_0x72c4('0x37')](function(){return setRelationship(_0x681f1e,_0x63b7db,_0x19b35f,_0x72c4('0x66'));})['then'](function(){return getServerInfo(_0x681f1e);})[_0x72c4('0x6b')](function(_0x39f906){logger['error']('['+_0x1bc9d3[_0x72c4('0x7a')][_0x72c4('0x7b')]()+']',JSON[_0x72c4('0x22')](_0x39f906));});}; \ 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 5ad242a..a35970a 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 _0x8ece=['stripTrailingSlash','slice','substring','lastIndexOf','validateEmail','isNil','util','getString','length','type','push','content','variable','variableName','toString','customVariable','Variable','name','toLowerCase','keyValue','string','%s:\x20%s','key','keyContent','keyType','format','join'];(function(_0x263f4c,_0x438626){var _0x3a78d3=function(_0xbdb00f){while(--_0xbdb00f){_0x263f4c['push'](_0x263f4c['shift']());}};_0x3a78d3(++_0x438626);}(_0x8ece,0xc3));var _0xe8ec=function(_0x548fe0,_0x48e0a0){_0x548fe0=_0x548fe0-0x0;var _0x47fa5c=_0x8ece[_0x548fe0];return _0x47fa5c;};'use strict';var _=require('lodash');var util=require(_0xe8ec('0x0'));exports[_0xe8ec('0x1')]=function(_0x2427c3,_0x40d7ce,_0x424147){var _0x3e5f90=[];if(_0x2427c3[_0xe8ec('0x2')]>0x0){var _0x3b0a9f=_['sortBy'](_0x2427c3,['id']);for(var _0x3115de=0x0;_0x3115de<_0x3b0a9f[_0xe8ec('0x2')];_0x3115de++){var _0x2e2b7f=_0x3b0a9f[_0x3115de];if(_0x2e2b7f[_0xe8ec('0x3')]==='string'){_0x3e5f90[_0xe8ec('0x4')](_0x2e2b7f[_0xe8ec('0x5')]);}else if(_0x2e2b7f['type']===_0xe8ec('0x6')&&_0x2e2b7f[_0xe8ec('0x7')]){_0x40d7ce[_0x2e2b7f[_0xe8ec('0x7')]]&&_0x3e5f90[_0xe8ec('0x4')](_0x40d7ce[_0x2e2b7f[_0xe8ec('0x7')]][_0xe8ec('0x8')]());}else if(_0x2e2b7f[_0xe8ec('0x3')]===_0xe8ec('0x9')&&_0x2e2b7f['Variable']&&_0x2e2b7f[_0xe8ec('0xa')][_0xe8ec('0xb')]){_0x40d7ce[_0x2e2b7f[_0xe8ec('0xa')][_0xe8ec('0xb')][_0xe8ec('0xc')]()]&&_0x3e5f90['push'](_0x40d7ce[_0x2e2b7f[_0xe8ec('0xa')][_0xe8ec('0xb')][_0xe8ec('0xc')]()]['toString']());}else if(_0x2e2b7f[_0xe8ec('0x3')]===_0xe8ec('0xd')){if(_0x2e2b7f['keyType']===_0xe8ec('0xe')&&_0x2e2b7f['key']){_0x3e5f90[_0xe8ec('0x4')](util['format'](_0xe8ec('0xf'),_0x2e2b7f[_0xe8ec('0x10')],_0x2e2b7f[_0xe8ec('0x11')]));}else if(_0x2e2b7f[_0xe8ec('0x12')]===_0xe8ec('0x6')&&_0x2e2b7f[_0xe8ec('0x7')]&&_0x2e2b7f[_0xe8ec('0x10')]){_0x40d7ce[_0x2e2b7f[_0xe8ec('0x7')]]&&_0x3e5f90['push'](util[_0xe8ec('0x13')](_0xe8ec('0xf'),_0x2e2b7f['key'],_0x40d7ce[_0x2e2b7f[_0xe8ec('0x7')]]));}else if(_0x2e2b7f[_0xe8ec('0x12')]===_0xe8ec('0x9')&&_0x2e2b7f['Variable']&&_0x2e2b7f[_0xe8ec('0xa')][_0xe8ec('0xb')]&&_0x2e2b7f[_0xe8ec('0x10')]){_0x40d7ce[_0x2e2b7f[_0xe8ec('0xa')][_0xe8ec('0xb')][_0xe8ec('0xc')]()]&&_0x3e5f90['push'](util[_0xe8ec('0x13')](_0xe8ec('0xf'),_0x2e2b7f['key'],_0x40d7ce[_0x2e2b7f['Variable'][_0xe8ec('0xb')][_0xe8ec('0xc')]()]));}}}}return _0x3e5f90[_0xe8ec('0x14')](_0x424147);};exports[_0xe8ec('0x15')]=function(_0x35329c){var _0x281feb=_0x35329c[_0xe8ec('0x16')](-0x1);if(_0x281feb==='/'){_0x35329c=_0x35329c[_0xe8ec('0x17')](0x0,_0x35329c[_0xe8ec('0x18')](_0x281feb));}return _0x35329c;};exports[_0xe8ec('0x19')]=function(_0x29f875){if(!_[_0xe8ec('0x1a')](_0x29f875)&&_0x29f875!==''){var _0x26dc8a=/^(([^<>()\[\]\\.,;:\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 _0x26dc8a['test'](String(_0x29f875)[_0xe8ec('0xc')]());}else{return![];}}; \ No newline at end of file +var _0x6da4=['type','string','push','content','variable','variableName','toString','customVariable','Variable','name','toLowerCase','keyValue','keyType','key','format','%s:\x20%s','keyContent','join','stripTrailingSlash','slice','substring','lastIndexOf','test','lodash','getString','length'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x6da4,0x65));var _0x46da=function(_0x38bc1c,_0x4984f4){_0x38bc1c=_0x38bc1c-0x0;var _0x4fd39f=_0x6da4[_0x38bc1c];return _0x4fd39f;};'use strict';var _=require(_0x46da('0x0'));var util=require('util');exports[_0x46da('0x1')]=function(_0x3c9732,_0x19a970,_0x1d752b){var _0x388df4=[];if(_0x3c9732[_0x46da('0x2')]>0x0){var _0x545d18=_['sortBy'](_0x3c9732,['id']);for(var _0x18ad7c=0x0;_0x18ad7c<_0x545d18[_0x46da('0x2')];_0x18ad7c++){var _0x4a678e=_0x545d18[_0x18ad7c];if(_0x4a678e[_0x46da('0x3')]===_0x46da('0x4')){_0x388df4[_0x46da('0x5')](_0x4a678e[_0x46da('0x6')]);}else if(_0x4a678e[_0x46da('0x3')]===_0x46da('0x7')&&_0x4a678e['variableName']){_0x19a970[_0x4a678e[_0x46da('0x8')]]&&_0x388df4[_0x46da('0x5')](_0x19a970[_0x4a678e[_0x46da('0x8')]][_0x46da('0x9')]());}else if(_0x4a678e['type']===_0x46da('0xa')&&_0x4a678e[_0x46da('0xb')]&&_0x4a678e[_0x46da('0xb')][_0x46da('0xc')]){_0x19a970[_0x4a678e['Variable']['name'][_0x46da('0xd')]()]&&_0x388df4[_0x46da('0x5')](_0x19a970[_0x4a678e['Variable'][_0x46da('0xc')]['toLowerCase']()][_0x46da('0x9')]());}else if(_0x4a678e[_0x46da('0x3')]===_0x46da('0xe')){if(_0x4a678e[_0x46da('0xf')]===_0x46da('0x4')&&_0x4a678e[_0x46da('0x10')]){_0x388df4['push'](util[_0x46da('0x11')](_0x46da('0x12'),_0x4a678e[_0x46da('0x10')],_0x4a678e[_0x46da('0x13')]));}else if(_0x4a678e[_0x46da('0xf')]===_0x46da('0x7')&&_0x4a678e[_0x46da('0x8')]&&_0x4a678e[_0x46da('0x10')]){_0x19a970[_0x4a678e[_0x46da('0x8')]]&&_0x388df4[_0x46da('0x5')](util['format']('%s:\x20%s',_0x4a678e['key'],_0x19a970[_0x4a678e[_0x46da('0x8')]]));}else if(_0x4a678e[_0x46da('0xf')]===_0x46da('0xa')&&_0x4a678e[_0x46da('0xb')]&&_0x4a678e[_0x46da('0xb')][_0x46da('0xc')]&&_0x4a678e[_0x46da('0x10')]){_0x19a970[_0x4a678e[_0x46da('0xb')][_0x46da('0xc')][_0x46da('0xd')]()]&&_0x388df4[_0x46da('0x5')](util[_0x46da('0x11')](_0x46da('0x12'),_0x4a678e[_0x46da('0x10')],_0x19a970[_0x4a678e[_0x46da('0xb')]['name']['toLowerCase']()]));}}}}return _0x388df4[_0x46da('0x14')](_0x1d752b);};exports[_0x46da('0x15')]=function(_0x51b52a){var _0x126d2a=_0x51b52a[_0x46da('0x16')](-0x1);if(_0x126d2a==='/'){_0x51b52a=_0x51b52a[_0x46da('0x17')](0x0,_0x51b52a[_0x46da('0x18')](_0x126d2a));}return _0x51b52a;};exports['validateEmail']=function(_0x208653){if(!_['isNil'](_0x208653)&&_0x208653!==''){var _0xff750e=/^(([^<>()\[\]\\.,;:\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 _0xff750e[_0x46da('0x19')](String(_0x208653)[_0x46da('0xd')]());}else{return![];}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/vtiger.js b/server/services/ami/trigger/integration/vtiger.js index 3ea7987..07fa1fc 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 _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(_0x2d3465,_0x59d494){var _0x29dbc9=function(_0x3f57c0){while(--_0x3f57c0){_0x2d3465['push'](_0x2d3465['shift']());}};_0x29dbc9(++_0x59d494);}(_0xe706,0xa3));var _0x6e70=function(_0x78db5e,_0x3b9804){_0x78db5e=_0x78db5e-0x0;var _0x250b88=_0xe706[_0x78db5e];return _0x250b88;};'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 +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(_0x598058,_0x193439){var _0x253c54=function(_0x251dcd){while(--_0x251dcd){_0x598058['push'](_0x598058['shift']());}};_0x253c54(++_0x193439);}(_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 diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index b492295..a1e9be8 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 _0x3d3f=['Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Caller\x20-\x20%s','Enduser\x20created.','authType','password','token','%s/token:%s','username','Basic\x20%s','toString','base64','debug','[HTTP]','stringify','GET','map','forEach','includes','string','type','customField','toLowerCase','content','picklist','idField','push','variable','variableName','custom_fields','customVariable','Variable','name','queue','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','Authorization','calleridname','calleridnum','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','serverUrl','recordingFormat','none','email','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','[OUTBOUND]','trigger:browser:url','%s/agent/tickets/%s','replace','toUpperCase','lastevent','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','ioredis','../../../../config/environment','../../../../config/logger','zendesk','defaults','redis','localhost','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','POST','merge','getString','Descriptions','Fields','then','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','type:user\x20role:agent\x20email:%s','Agent\x20found!','find','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','%s/search.json','type:user\x20role:end-user\x20phone:%s','results','length','filter','end-user','first','Enduser\x20found!'];(function(_0x4b4d43,_0x1590f7){var _0x5706ba=function(_0x11d99b){while(--_0x11d99b){_0x4b4d43['push'](_0x4b4d43['shift']());}};_0x5706ba(++_0x1590f7);}(_0x3d3f,0x12b));var _0xf3d3=function(_0x7ed81a,_0x29022e){_0x7ed81a=_0x7ed81a-0x0;var _0xd4e97e=_0x3d3f[_0x7ed81a];return _0xd4e97e;};'use strict';var _=require(_0xf3d3('0x0'));var rp=require(_0xf3d3('0x1'));var md5=require(_0xf3d3('0x2'));var util=require(_0xf3d3('0x3'));var Redis=require(_0xf3d3('0x4'));var intUtil=require('./util');var config=require(_0xf3d3('0x5'));var logger=require(_0xf3d3('0x6'))(_0xf3d3('0x7'));config['redis']=_[_0xf3d3('0x8')](config[_0xf3d3('0x9')],{'host':_0xf3d3('0xa'),'port':0x18eb});var io=require(_0xf3d3('0xb'))(new Redis(config[_0xf3d3('0x9')]));function emit(_0x26b3d7,_0x35df0b,_0x4e20a5){io['to'](_0x26b3d7)[_0xf3d3('0xc')](_0x35df0b,_0x4e20a5);}var headers={'Content-Type':'application/json','Accept':_0xf3d3('0xd')};function getTicket(_0x78f49b,_0x45fecb,_0x185f12,_0xd34349,_0xd3ca65){logger[_0xf3d3('0xe')](_0xf3d3('0xf'));return request({'uri':util[_0xf3d3('0x10')](_0xf3d3('0x11'),_0x78f49b[_0xf3d3('0x12')]),'method':_0xf3d3('0x13'),'body':{'ticket':_[_0xf3d3('0x14')]({'requester_id':_0x185f12['id'],'submitter_id':_0x45fecb?_0x45fecb['id']:undefined,'assignee_id':_0x45fecb?_0x45fecb['id']:undefined,'tags':getTags(_0xd34349['Tags'],'name'),'subject':intUtil['getString'](_0xd34349['Subjects'],_0xd3ca65,'\x20'),'description':intUtil[_0xf3d3('0x15')](_0xd34349[_0xf3d3('0x16')],_0xd3ca65,'\x0a'),'comment':{'public':![],'body':intUtil[_0xf3d3('0x15')](_0xd34349[_0xf3d3('0x16')],_0xd3ca65,'\x0a')}},getCustomFields(_0xd34349[_0xf3d3('0x17')],_0xd3ca65))}})[_0xf3d3('0x18')](function(_0x5bd5b9){logger['info'](_0xf3d3('0x19'));return _0x5bd5b9[_0xf3d3('0x1a')];});}function getUser(_0x8d6271,_0x3b4841){if(intUtil[_0xf3d3('0x1b')](_0x3b4841)){logger['info'](_0xf3d3('0x1c'),_0x3b4841);return request({'uri':util[_0xf3d3('0x10')]('%s/search.json',_0x8d6271['remoteUri']),'qs':{'query':util[_0xf3d3('0x10')](_0xf3d3('0x1d'),_0x3b4841)}})['then'](function(_0x68b2c5){if(_0x68b2c5['count']){logger['info'](_0xf3d3('0x1e'));return _[_0xf3d3('0x1f')](_0x68b2c5['results'],{'email':_0x3b4841,'role':_0xf3d3('0x20')});}else{logger[_0xf3d3('0xe')](_0xf3d3('0x21'));return request({'uri':util[_0xf3d3('0x10')](_0xf3d3('0x22'),_0x8d6271[_0xf3d3('0x12')])})[_0xf3d3('0x18')](function(_0x155700){logger[_0xf3d3('0xe')](_0xf3d3('0x23'));return _0x155700[_0xf3d3('0x24')];});}});}else{logger['info'](_0xf3d3('0x21'));return request({'uri':util[_0xf3d3('0x10')](_0xf3d3('0x22'),_0x8d6271[_0xf3d3('0x12')])})[_0xf3d3('0x18')](function(_0x127766){logger[_0xf3d3('0xe')](_0xf3d3('0x23'));return _0x127766[_0xf3d3('0x24')];});}}function getEndUser(_0x9a1fbd,_0x475cc4,_0x31b960){logger[_0xf3d3('0xe')](_0xf3d3('0x25'),_0x31b960);return request({'uri':util[_0xf3d3('0x10')](_0xf3d3('0x26'),_0x9a1fbd[_0xf3d3('0x12')]),'qs':{'query':util[_0xf3d3('0x10')](_0xf3d3('0x27'),_0x31b960)}})[_0xf3d3('0x18')](function(_0x101c38){var _0x5e0f57;if(_0x101c38[_0xf3d3('0x28')][_0xf3d3('0x29')]){_0x101c38['results']=_[_0xf3d3('0x2a')](_0x101c38[_0xf3d3('0x28')],{'suspended':![],'role':_0xf3d3('0x2b')});if(_0x101c38[_0xf3d3('0x28')][_0xf3d3('0x29')]){_0x5e0f57=_[_0xf3d3('0x2c')](_0x101c38[_0xf3d3('0x28')]);}}if(_0x5e0f57){logger['info'](_0xf3d3('0x2d'));return _0x5e0f57;}else{logger[_0xf3d3('0xe')](_0xf3d3('0x2e'));return request({'uri':util[_0xf3d3('0x10')]('%s/users.json',_0x9a1fbd['remoteUri']),'method':'POST','body':{'user':{'role':_0xf3d3('0x2b'),'name':util[_0xf3d3('0x10')](_0xf3d3('0x2f'),_0x475cc4||_0x31b960),'phone':_0x31b960}}})[_0xf3d3('0x18')](function(_0x5968a7){logger[_0xf3d3('0xe')](_0xf3d3('0x30'));return _0x5968a7['user'];});}});}function getAuth(_0x37c7b8){var _0x3ff614;if(_0x37c7b8[_0xf3d3('0x31')]===_0xf3d3('0x32')){_0x3ff614=util[_0xf3d3('0x10')]('%s:%s',_0x37c7b8['username'],_0x37c7b8[_0xf3d3('0x32')]);}else if(_0x37c7b8['authType']===_0xf3d3('0x33')){_0x3ff614=util[_0xf3d3('0x10')](_0xf3d3('0x34'),_0x37c7b8[_0xf3d3('0x35')],_0x37c7b8[_0xf3d3('0x33')]);}return util[_0xf3d3('0x10')](_0xf3d3('0x36'),new Buffer(_0x3ff614)[_0xf3d3('0x37')](_0xf3d3('0x38')));}function request(_0x495d41){logger[_0xf3d3('0x39')](_0xf3d3('0x3a'),JSON[_0xf3d3('0x3b')](_0x495d41));return rp(_[_0xf3d3('0x8')](_0x495d41,{'method':_0xf3d3('0x3c'),'headers':headers,'json':!![]}));}function getTags(_0x2d542a,_0x4e6483){var _0x516aaf=[];if(_0x2d542a&&_0x2d542a[_0xf3d3('0x29')]>0x0){_0x516aaf=_[_0xf3d3('0x3d')](_0x2d542a,_0x4e6483);}return _0x516aaf;}function getCustomFields(_0x142ae4,_0x518ae8){var _0x1b1fea=[];var _0x4dee5e={'custom_fields':[]};if(_0x142ae4[_0xf3d3('0x29')]>0x0){_[_0xf3d3('0x3e')](_0x142ae4,function(_0xab9aa3){if(_[_0xf3d3('0x3f')]([_0xf3d3('0x40'),'picklist'],_0xab9aa3[_0xf3d3('0x41')])&&_0xab9aa3['nameField']&&!_0xab9aa3[_0xf3d3('0x42')]){_0x4dee5e[_0xab9aa3['nameField'][_0xf3d3('0x43')]()]=_0xab9aa3[_0xf3d3('0x44')][_0xf3d3('0x37')]();}else if(_[_0xf3d3('0x3f')]([_0xf3d3('0x40'),_0xf3d3('0x45')],_0xab9aa3[_0xf3d3('0x41')])&&_0xab9aa3[_0xf3d3('0x46')]&&_0xab9aa3['customField']){_0x4dee5e['custom_fields'][_0xf3d3('0x47')]({'id':_0xab9aa3[_0xf3d3('0x46')],'value':_0xab9aa3[_0xf3d3('0x44')][_0xf3d3('0x37')]()});}else if(_0xab9aa3[_0xf3d3('0x41')]===_0xf3d3('0x48')&&_0xab9aa3[_0xf3d3('0x49')]&&_0xab9aa3[_0xf3d3('0x46')]&&_0xab9aa3['customField']){_0x518ae8[_0xab9aa3[_0xf3d3('0x49')]]&&_0x4dee5e[_0xf3d3('0x4a')]['push']({'id':_0xab9aa3[_0xf3d3('0x46')],'value':_0x518ae8[_0xab9aa3[_0xf3d3('0x49')]][_0xf3d3('0x37')]()});}else if(_0xab9aa3['type']===_0xf3d3('0x4b')&&_0xab9aa3['Variable']&&_0xab9aa3[_0xf3d3('0x4c')][_0xf3d3('0x4d')]&&_0xab9aa3[_0xf3d3('0x46')]&&_0xab9aa3['customField']){_0x518ae8[_0xab9aa3[_0xf3d3('0x4c')]['name']['toLowerCase']()]&&_0x4dee5e[_0xf3d3('0x4a')][_0xf3d3('0x47')]({'id':_0xab9aa3['idField'],'value':_0x518ae8[_0xab9aa3[_0xf3d3('0x4c')][_0xf3d3('0x4d')][_0xf3d3('0x43')]()][_0xf3d3('0x37')]()});}});}return _0x4dee5e;}exports[_0xf3d3('0x4e')]=function(_0x5d24ed,_0x1782c4,_0x52bbe4,_0x49006a,_0x2845cc,_0x372b41){var _0x3d3943,_0x31caad;_0x372b41[_0xf3d3('0x12')]=intUtil['stripTrailingSlash'](_0x372b41[_0xf3d3('0x12')]);_0x372b41['serverUrl']=intUtil[_0xf3d3('0x4f')](_0x372b41['serverUrl']);if(_0x2845cc&&_0x2845cc[_0xf3d3('0x50')]){logger[_0xf3d3('0xe')](_0xf3d3('0x51'),_0xf3d3('0x52'));_0x1782c4[_0xf3d3('0x53')]=util[_0xf3d3('0x10')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x372b41['serverUrl'],_0x1782c4[_0xf3d3('0x54')],md5(_0x1782c4[_0xf3d3('0x54')]));}else{_0x1782c4[_0xf3d3('0x53')]='';}headers[_0xf3d3('0x55')]=getAuth(_0x372b41);return getUser(_0x372b41,_0x49006a['email'])['then'](function(_0x2dd296){_0x3d3943=_0x2dd296;logger[_0xf3d3('0xe')]('The\x20User\x20ID\x20is:',_0x3d3943['id']);return getEndUser(_0x372b41,_0x1782c4[_0xf3d3('0x56')],_0x1782c4[_0xf3d3('0x57')]);})[_0xf3d3('0x18')](function(_0x1be582){_0x31caad=_0x1be582;logger[_0xf3d3('0xe')]('The\x20Enduser\x20ID\x20is:',_0x31caad['id']);return getTicket(_0x372b41,_0x3d3943,_0x31caad,_0x52bbe4,_0x1782c4);})[_0xf3d3('0x18')](function(_0x2fc19e){if(_0x2fc19e){logger[_0xf3d3('0xe')](_0xf3d3('0x58'),_0x2fc19e['id']);switch(_0x372b41['type']){case _0xf3d3('0x59'):logger['info'](_0xf3d3('0x51'),_0xf3d3('0x5a'));return request({'uri':util[_0xf3d3('0x10')](_0xf3d3('0x5b'),_0x372b41[_0xf3d3('0x12')],_0x3d3943['id'],_0x2fc19e['id']),'method':_0xf3d3('0x13')});case'newTab':logger[_0xf3d3('0xe')](_0xf3d3('0x51'),_0xf3d3('0x5c'));emit(util[_0xf3d3('0x10')](_0xf3d3('0x5d'),_0x49006a[_0xf3d3('0x4d')]),'trigger:browser:url',{'uri':util['format']('%s/agent/tickets/%s',_0x372b41[_0xf3d3('0x12')]['replace'](_0xf3d3('0x5e'),''),_0x2fc19e['id'])});break;default:logger[_0xf3d3('0x5f')](_0xf3d3('0x51'),_0xf3d3('0x60'));}}})[_0xf3d3('0x61')](function(_0x3dc5de){logger[_0xf3d3('0x5f')](_0xf3d3('0x62'),util[_0xf3d3('0x63')](_0x3dc5de,{'showHidden':!![],'depth':null}));});};exports[_0xf3d3('0x64')]=function(_0x31b85b,_0x3e3ed3,_0x26fdab,_0x1329a9,_0x1db3c0,_0x41bec6,_0x3a8e1e){var _0x18fd16,_0x2062cc;_0x41bec6[_0xf3d3('0x12')]=intUtil['stripTrailingSlash'](_0x41bec6[_0xf3d3('0x12')]);_0x41bec6['serverUrl']=intUtil[_0xf3d3('0x4f')](_0x41bec6[_0xf3d3('0x65')]);if(_0x3a8e1e&&_0x3a8e1e[_0xf3d3('0x66')]&&_0x3a8e1e[_0xf3d3('0x66')]!==_0xf3d3('0x67')){logger[_0xf3d3('0xe')]('[OUTBOUND]',_0xf3d3('0x52'));_0x3e3ed3['recordingURL']=util[_0xf3d3('0x10')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x41bec6['serverUrl'],_0x3e3ed3[_0xf3d3('0x54')],md5(_0x3e3ed3[_0xf3d3('0x54')]));}headers['Authorization']=getAuth(_0x41bec6);return getUser(_0x41bec6,_0x1329a9[_0xf3d3('0x68')])[_0xf3d3('0x18')](function(_0x279189){_0x18fd16=_0x279189;logger[_0xf3d3('0xe')](_0xf3d3('0x69'),_0x18fd16['id']);return getEndUser(_0x41bec6,_0x3e3ed3[_0xf3d3('0x6a')],_0x3e3ed3[_0xf3d3('0x6b')]);})[_0xf3d3('0x18')](function(_0xcee73c){_0x2062cc=_0xcee73c;logger[_0xf3d3('0xe')]('The\x20Enduser\x20ID\x20is:',_0x2062cc['id']);return getTicket(_0x41bec6,_0x18fd16,_0x2062cc,_0x26fdab,_0x3e3ed3);})['then'](function(_0x4a391e){if(_0x4a391e){logger[_0xf3d3('0xe')](_0xf3d3('0x58'),_0x4a391e['id']);switch(_0x41bec6[_0xf3d3('0x41')]){case _0xf3d3('0x59'):logger['info']('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0xf3d3('0x10')](_0xf3d3('0x5b'),_0x41bec6[_0xf3d3('0x12')],_0x18fd16['id'],_0x4a391e['id']),'method':_0xf3d3('0x13')});case'newTab':logger[_0xf3d3('0xe')](_0xf3d3('0x6c'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xf3d3('0x10')](_0xf3d3('0x5d'),_0x1329a9[_0xf3d3('0x4d')]),_0xf3d3('0x6d'),{'uri':util['format'](_0xf3d3('0x6e'),_0x41bec6['remoteUri'][_0xf3d3('0x6f')](_0xf3d3('0x5e'),''),_0x4a391e['id'])});break;default:logger[_0xf3d3('0x5f')](_0xf3d3('0x6c'),_0xf3d3('0x60'));}}})[_0xf3d3('0x61')](function(_0x2b17af){logger['error']('[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration',util[_0xf3d3('0x63')](_0x2b17af,{'showHidden':!![],'depth':null}));});};exports['unmanaged']=function(_0x3f128d,_0x4e190c,_0x14e8c6,_0x36256f,_0x19287c,_0x480788){var _0xf1cc3,_0x11f2a5;_0x480788[_0xf3d3('0x12')]=intUtil[_0xf3d3('0x4f')](_0x480788[_0xf3d3('0x12')]);_0x480788[_0xf3d3('0x65')]=intUtil[_0xf3d3('0x4f')](_0x480788[_0xf3d3('0x65')]);if(_0x19287c&&_0x19287c[_0xf3d3('0x50')]){logger[_0xf3d3('0xe')]('['+_0x4e190c['lastevent'][_0xf3d3('0x70')]()+']',_0xf3d3('0x52'));_0x4e190c['recordingURL']=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x480788[_0xf3d3('0x65')],_0x4e190c[_0xf3d3('0x54')],md5(_0x4e190c['uniqueid']));}else{_0x4e190c[_0xf3d3('0x53')]='';}headers[_0xf3d3('0x55')]=getAuth(_0x480788);return getUser(_0x480788)['then'](function(_0x2a6436){_0xf1cc3=_0x2a6436;logger[_0xf3d3('0xe')](_0xf3d3('0x69'),_0xf1cc3['id']);return getEndUser(_0x480788,_0x4e190c['calleridname'],_0x4e190c['calleridnum']);})[_0xf3d3('0x18')](function(_0x26540b){_0x11f2a5=_0x26540b;logger['info']('The\x20Enduser\x20ID\x20is:',_0x11f2a5['id']);return getTicket(_0x480788,_0xf1cc3,_0x11f2a5,_0x14e8c6,_0x4e190c);})[_0xf3d3('0x18')](function(_0x374b03){if(_0x374b03){logger[_0xf3d3('0xe')](_0xf3d3('0x58'),_0x374b03['id']);}})[_0xf3d3('0x61')](function(_0x5c753b){logger[_0xf3d3('0x5f')]('['+_0x4e190c[_0xf3d3('0x71')]['toUpperCase']()+']'+_0xf3d3('0x72'),util[_0xf3d3('0x63')](_0x5c753b,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xfc29=['request-promise','md5','util','ioredis','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','Tags','name','getString','Descriptions','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','remoteUri','type:user\x20role:agent\x20email:%s','then','count','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','%s/search.json','length','filter','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','POST','Caller\x20-\x20%s','Enduser\x20created.','authType','%s:%s','password','token','%s/token:%s','username','Basic\x20%s','toString','base64','debug','[HTTP]','stringify','map','string','picklist','type','nameField','content','includes','customField','push','idField','variable','variableName','customVariable','Variable','toLowerCase','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','integrationTab','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','[OUTBOUND]','Displaying\x20ticket\x20to\x20agent...','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','toUpperCase','lodash'];(function(_0x33ed20,_0x5701d8){var _0x3913d5=function(_0x2ecb65){while(--_0x2ecb65){_0x33ed20['push'](_0x33ed20['shift']());}};_0x3913d5(++_0x5701d8);}(_0xfc29,0x1cb));var _0x9fc2=function(_0xde05fa,_0x40647f){_0xde05fa=_0xde05fa-0x0;var _0x3ab672=_0xfc29[_0xde05fa];return _0x3ab672;};'use strict';var _=require(_0x9fc2('0x0'));var rp=require(_0x9fc2('0x1'));var md5=require(_0x9fc2('0x2'));var util=require(_0x9fc2('0x3'));var Redis=require(_0x9fc2('0x4'));var intUtil=require('./util');var config=require(_0x9fc2('0x5'));var logger=require(_0x9fc2('0x6'))(_0x9fc2('0x7'));config[_0x9fc2('0x8')]=_[_0x9fc2('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x9fc2('0xa'))(new Redis(config[_0x9fc2('0x8')]));function emit(_0x133714,_0x38302e,_0x157437){io['to'](_0x133714)[_0x9fc2('0xb')](_0x38302e,_0x157437);}var headers={'Content-Type':_0x9fc2('0xc'),'Accept':_0x9fc2('0xc')};function getTicket(_0x5359b9,_0x7b07f4,_0x50adf3,_0x20d674,_0x30510b){logger[_0x9fc2('0xd')](_0x9fc2('0xe'));return request({'uri':util[_0x9fc2('0xf')](_0x9fc2('0x10'),_0x5359b9['remoteUri']),'method':'POST','body':{'ticket':_['merge']({'requester_id':_0x50adf3['id'],'submitter_id':_0x7b07f4?_0x7b07f4['id']:undefined,'assignee_id':_0x7b07f4?_0x7b07f4['id']:undefined,'tags':getTags(_0x20d674[_0x9fc2('0x11')],_0x9fc2('0x12')),'subject':intUtil['getString'](_0x20d674['Subjects'],_0x30510b,'\x20'),'description':intUtil[_0x9fc2('0x13')](_0x20d674[_0x9fc2('0x14')],_0x30510b,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x20d674[_0x9fc2('0x14')],_0x30510b,'\x0a')}},getCustomFields(_0x20d674['Fields'],_0x30510b))}})['then'](function(_0x77abd9){logger['info'](_0x9fc2('0x15'));return _0x77abd9[_0x9fc2('0x16')];});}function getUser(_0x5a622d,_0x1f0015){if(intUtil[_0x9fc2('0x17')](_0x1f0015)){logger[_0x9fc2('0xd')](_0x9fc2('0x18'),_0x1f0015);return request({'uri':util['format']('%s/search.json',_0x5a622d[_0x9fc2('0x19')]),'qs':{'query':util[_0x9fc2('0xf')](_0x9fc2('0x1a'),_0x1f0015)}})[_0x9fc2('0x1b')](function(_0x542377){if(_0x542377[_0x9fc2('0x1c')]){logger['info']('Agent\x20found!');return _[_0x9fc2('0x1d')](_0x542377[_0x9fc2('0x1e')],{'email':_0x1f0015,'role':_0x9fc2('0x1f')});}else{logger[_0x9fc2('0xd')](_0x9fc2('0x20'));return request({'uri':util[_0x9fc2('0xf')](_0x9fc2('0x21'),_0x5a622d['remoteUri'])})[_0x9fc2('0x1b')](function(_0x1d4fc8){logger[_0x9fc2('0xd')](_0x9fc2('0x22'));return _0x1d4fc8[_0x9fc2('0x23')];});}});}else{logger[_0x9fc2('0xd')](_0x9fc2('0x20'));return request({'uri':util['format'](_0x9fc2('0x21'),_0x5a622d[_0x9fc2('0x19')])})[_0x9fc2('0x1b')](function(_0x336393){logger[_0x9fc2('0xd')]('Admin\x20account\x20selected.');return _0x336393[_0x9fc2('0x23')];});}}function getEndUser(_0x385cd9,_0x7685c7,_0x362951){logger[_0x9fc2('0xd')](_0x9fc2('0x24'),_0x362951);return request({'uri':util[_0x9fc2('0xf')](_0x9fc2('0x25'),_0x385cd9[_0x9fc2('0x19')]),'qs':{'query':util[_0x9fc2('0xf')]('type:user\x20role:end-user\x20phone:%s',_0x362951)}})[_0x9fc2('0x1b')](function(_0x526944){var _0x27da0e;if(_0x526944['results'][_0x9fc2('0x26')]){_0x526944[_0x9fc2('0x1e')]=_[_0x9fc2('0x27')](_0x526944[_0x9fc2('0x1e')],{'suspended':![],'role':_0x9fc2('0x28')});if(_0x526944[_0x9fc2('0x1e')][_0x9fc2('0x26')]){_0x27da0e=_[_0x9fc2('0x29')](_0x526944[_0x9fc2('0x1e')]);}}if(_0x27da0e){logger[_0x9fc2('0xd')](_0x9fc2('0x2a'));return _0x27da0e;}else{logger[_0x9fc2('0xd')](_0x9fc2('0x2b'));return request({'uri':util[_0x9fc2('0xf')](_0x9fc2('0x2c'),_0x385cd9['remoteUri']),'method':_0x9fc2('0x2d'),'body':{'user':{'role':_0x9fc2('0x28'),'name':util['format'](_0x9fc2('0x2e'),_0x7685c7||_0x362951),'phone':_0x362951}}})[_0x9fc2('0x1b')](function(_0x89b013){logger[_0x9fc2('0xd')](_0x9fc2('0x2f'));return _0x89b013[_0x9fc2('0x23')];});}});}function getAuth(_0x262110){var _0x46f4ce;if(_0x262110[_0x9fc2('0x30')]==='password'){_0x46f4ce=util['format'](_0x9fc2('0x31'),_0x262110['username'],_0x262110[_0x9fc2('0x32')]);}else if(_0x262110[_0x9fc2('0x30')]===_0x9fc2('0x33')){_0x46f4ce=util[_0x9fc2('0xf')](_0x9fc2('0x34'),_0x262110[_0x9fc2('0x35')],_0x262110[_0x9fc2('0x33')]);}return util['format'](_0x9fc2('0x36'),new Buffer(_0x46f4ce)[_0x9fc2('0x37')](_0x9fc2('0x38')));}function request(_0x286955){logger[_0x9fc2('0x39')](_0x9fc2('0x3a'),JSON[_0x9fc2('0x3b')](_0x286955));return rp(_[_0x9fc2('0x9')](_0x286955,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x266511,_0x4bdadd){var _0x1f1c2e=[];if(_0x266511&&_0x266511[_0x9fc2('0x26')]>0x0){_0x1f1c2e=_[_0x9fc2('0x3c')](_0x266511,_0x4bdadd);}return _0x1f1c2e;}function getCustomFields(_0x13ae46,_0x17b137){var _0x18d4c2=[];var _0x61a594={'custom_fields':[]};if(_0x13ae46[_0x9fc2('0x26')]>0x0){_['forEach'](_0x13ae46,function(_0x45fc28){if(_['includes']([_0x9fc2('0x3d'),_0x9fc2('0x3e')],_0x45fc28[_0x9fc2('0x3f')])&&_0x45fc28[_0x9fc2('0x40')]&&!_0x45fc28['customField']){_0x61a594[_0x45fc28['nameField']['toLowerCase']()]=_0x45fc28[_0x9fc2('0x41')][_0x9fc2('0x37')]();}else if(_[_0x9fc2('0x42')]([_0x9fc2('0x3d'),'picklist'],_0x45fc28[_0x9fc2('0x3f')])&&_0x45fc28['idField']&&_0x45fc28[_0x9fc2('0x43')]){_0x61a594['custom_fields'][_0x9fc2('0x44')]({'id':_0x45fc28[_0x9fc2('0x45')],'value':_0x45fc28[_0x9fc2('0x41')]['toString']()});}else if(_0x45fc28[_0x9fc2('0x3f')]===_0x9fc2('0x46')&&_0x45fc28[_0x9fc2('0x47')]&&_0x45fc28['idField']&&_0x45fc28['customField']){_0x17b137[_0x45fc28[_0x9fc2('0x47')]]&&_0x61a594['custom_fields'][_0x9fc2('0x44')]({'id':_0x45fc28[_0x9fc2('0x45')],'value':_0x17b137[_0x45fc28['variableName']][_0x9fc2('0x37')]()});}else if(_0x45fc28[_0x9fc2('0x3f')]===_0x9fc2('0x48')&&_0x45fc28[_0x9fc2('0x49')]&&_0x45fc28[_0x9fc2('0x49')][_0x9fc2('0x12')]&&_0x45fc28[_0x9fc2('0x45')]&&_0x45fc28['customField']){_0x17b137[_0x45fc28['Variable'][_0x9fc2('0x12')][_0x9fc2('0x4a')]()]&&_0x61a594['custom_fields'][_0x9fc2('0x44')]({'id':_0x45fc28[_0x9fc2('0x45')],'value':_0x17b137[_0x45fc28[_0x9fc2('0x49')][_0x9fc2('0x12')]['toLowerCase']()][_0x9fc2('0x37')]()});}});}return _0x61a594;}exports[_0x9fc2('0x4b')]=function(_0x4bd528,_0x5ab63b,_0x284fe1,_0xc8eccb,_0x2336ef,_0x25fca3){var _0x1bf404,_0x32602e;_0x25fca3[_0x9fc2('0x19')]=intUtil[_0x9fc2('0x4c')](_0x25fca3['remoteUri']);_0x25fca3[_0x9fc2('0x4d')]=intUtil[_0x9fc2('0x4c')](_0x25fca3['serverUrl']);if(_0x2336ef&&_0x2336ef[_0x9fc2('0x4e')]){logger['info'](_0x9fc2('0x4f'),_0x9fc2('0x50'));_0x5ab63b[_0x9fc2('0x51')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x25fca3[_0x9fc2('0x4d')],_0x5ab63b['uniqueid'],md5(_0x5ab63b[_0x9fc2('0x52')]));}else{_0x5ab63b['recordingURL']='';}headers['Authorization']=getAuth(_0x25fca3);return getUser(_0x25fca3,_0xc8eccb[_0x9fc2('0x53')])[_0x9fc2('0x1b')](function(_0xc5e845){_0x1bf404=_0xc5e845;logger[_0x9fc2('0xd')](_0x9fc2('0x54'),_0x1bf404['id']);return getEndUser(_0x25fca3,_0x5ab63b[_0x9fc2('0x55')],_0x5ab63b[_0x9fc2('0x56')]);})[_0x9fc2('0x1b')](function(_0x33cb7d){_0x32602e=_0x33cb7d;logger[_0x9fc2('0xd')](_0x9fc2('0x57'),_0x32602e['id']);return getTicket(_0x25fca3,_0x1bf404,_0x32602e,_0x284fe1,_0x5ab63b);})[_0x9fc2('0x1b')](function(_0x26af26){if(_0x26af26){logger[_0x9fc2('0xd')]('The\x20Ticket\x20ID\x20is:',_0x26af26['id']);switch(_0x25fca3[_0x9fc2('0x3f')]){case _0x9fc2('0x58'):logger[_0x9fc2('0xd')](_0x9fc2('0x4f'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x9fc2('0xf')](_0x9fc2('0x59'),_0x25fca3[_0x9fc2('0x19')],_0x1bf404['id'],_0x26af26['id']),'method':_0x9fc2('0x2d')});case _0x9fc2('0x5a'):logger[_0x9fc2('0xd')](_0x9fc2('0x4f'),_0x9fc2('0x5b'));emit(util[_0x9fc2('0xf')](_0x9fc2('0x5c'),_0xc8eccb[_0x9fc2('0x12')]),_0x9fc2('0x5d'),{'uri':util[_0x9fc2('0xf')](_0x9fc2('0x5e'),_0x25fca3[_0x9fc2('0x19')][_0x9fc2('0x5f')](_0x9fc2('0x60'),''),_0x26af26['id'])});break;default:logger[_0x9fc2('0x61')](_0x9fc2('0x4f'),_0x9fc2('0x62'));}}})[_0x9fc2('0x63')](function(_0x2561f5){logger[_0x9fc2('0x61')](_0x9fc2('0x64'),util[_0x9fc2('0x65')](_0x2561f5,{'showHidden':!![],'depth':null}));});};exports[_0x9fc2('0x66')]=function(_0x445efa,_0x26bdfc,_0x47bfa9,_0x6489b,_0x1636fd,_0x2d5f72,_0x1614c2){var _0x5805b8,_0xfbf702;_0x2d5f72['remoteUri']=intUtil['stripTrailingSlash'](_0x2d5f72['remoteUri']);_0x2d5f72[_0x9fc2('0x4d')]=intUtil['stripTrailingSlash'](_0x2d5f72[_0x9fc2('0x4d')]);if(_0x1614c2&&_0x1614c2[_0x9fc2('0x67')]&&_0x1614c2['recordingFormat']!==_0x9fc2('0x68')){logger[_0x9fc2('0xd')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x26bdfc[_0x9fc2('0x51')]=util[_0x9fc2('0xf')](_0x9fc2('0x69'),_0x2d5f72[_0x9fc2('0x4d')],_0x26bdfc['uniqueid'],md5(_0x26bdfc['uniqueid']));}headers['Authorization']=getAuth(_0x2d5f72);return getUser(_0x2d5f72,_0x6489b[_0x9fc2('0x53')])[_0x9fc2('0x1b')](function(_0x39fe20){_0x5805b8=_0x39fe20;logger[_0x9fc2('0xd')](_0x9fc2('0x54'),_0x5805b8['id']);return getEndUser(_0x2d5f72,_0x26bdfc[_0x9fc2('0x6a')],_0x26bdfc[_0x9fc2('0x6b')]);})[_0x9fc2('0x1b')](function(_0x449387){_0xfbf702=_0x449387;logger['info'](_0x9fc2('0x57'),_0xfbf702['id']);return getTicket(_0x2d5f72,_0x5805b8,_0xfbf702,_0x47bfa9,_0x26bdfc);})[_0x9fc2('0x1b')](function(_0x79a102){if(_0x79a102){logger[_0x9fc2('0xd')](_0x9fc2('0x6c'),_0x79a102['id']);switch(_0x2d5f72[_0x9fc2('0x3f')]){case _0x9fc2('0x58'):logger['info'](_0x9fc2('0x6d'),_0x9fc2('0x6e'));return request({'uri':util[_0x9fc2('0xf')](_0x9fc2('0x59'),_0x2d5f72[_0x9fc2('0x19')],_0x5805b8['id'],_0x79a102['id']),'method':_0x9fc2('0x2d')});case _0x9fc2('0x5a'):logger['info'](_0x9fc2('0x6d'),_0x9fc2('0x5b'));emit(util[_0x9fc2('0xf')](_0x9fc2('0x5c'),_0x6489b[_0x9fc2('0x12')]),'trigger:browser:url',{'uri':util['format'](_0x9fc2('0x5e'),_0x2d5f72[_0x9fc2('0x19')]['replace']('/api/v2',''),_0x79a102['id'])});break;default:logger[_0x9fc2('0x61')]('[OUTBOUND]','Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x9fc2('0x63')](function(_0x248ce3){logger[_0x9fc2('0x61')](_0x9fc2('0x6f'),util[_0x9fc2('0x65')](_0x248ce3,{'showHidden':!![],'depth':null}));});};exports[_0x9fc2('0x70')]=function(_0x365be8,_0x135ec5,_0xaf5812,_0x2a9189,_0x2f52e1,_0x3e443d){var _0x558f60,_0x2af437;_0x3e443d[_0x9fc2('0x19')]=intUtil[_0x9fc2('0x4c')](_0x3e443d['remoteUri']);_0x3e443d[_0x9fc2('0x4d')]=intUtil['stripTrailingSlash'](_0x3e443d[_0x9fc2('0x4d')]);if(_0x2f52e1&&_0x2f52e1[_0x9fc2('0x4e')]){logger['info']('['+_0x135ec5[_0x9fc2('0x71')][_0x9fc2('0x72')]()+']',_0x9fc2('0x50'));_0x135ec5[_0x9fc2('0x51')]=util[_0x9fc2('0xf')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3e443d[_0x9fc2('0x4d')],_0x135ec5[_0x9fc2('0x52')],md5(_0x135ec5[_0x9fc2('0x52')]));}else{_0x135ec5['recordingURL']='';}headers['Authorization']=getAuth(_0x3e443d);return getUser(_0x3e443d)[_0x9fc2('0x1b')](function(_0x27169b){_0x558f60=_0x27169b;logger[_0x9fc2('0xd')](_0x9fc2('0x54'),_0x558f60['id']);return getEndUser(_0x3e443d,_0x135ec5[_0x9fc2('0x55')],_0x135ec5[_0x9fc2('0x56')]);})[_0x9fc2('0x1b')](function(_0x7ad9fd){_0x2af437=_0x7ad9fd;logger[_0x9fc2('0xd')](_0x9fc2('0x57'),_0x2af437['id']);return getTicket(_0x3e443d,_0x558f60,_0x2af437,_0xaf5812,_0x135ec5);})['then'](function(_0x21ba3f){if(_0x21ba3f){logger[_0x9fc2('0xd')](_0x9fc2('0x6c'),_0x21ba3f['id']);}})[_0x9fc2('0x63')](function(_0x2eb20c){logger[_0x9fc2('0x61')]('['+_0x135ec5[_0x9fc2('0x71')][_0x9fc2('0x72')]()+']'+'\x20Error\x20running\x20Zendesk\x20integration',util['inspect'](_0x2eb20c,{'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 522088f..3942556 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 _0xf171=['picklist','type','idField','toString','variable','variableName','customVariable','Variable','name','toLowerCase','indexOf','isNil','access_token','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','then','add','seconds','catch','error','stack','Search\x20user','GET','https://www.zohoapis.%s/crm/v2/users','Zoho-oauthtoken\x20','users','findIndex','email','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','user','info','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','code','SUCCESS','details','enduserType','The\x20failing\x20result\x20is','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','Creating\x20new\x20call...','Owner','Subject','getString','Description','Descriptions','Full_Name','First_Name','Last_Name','What_Id','$se_module','Call_Duration','utc','talktime','format','answertime','YYYY-MM-DDTHH:mm:ss','diff','mm:ss','called','Call_Result','Called','connect','Answered','rejected','Rejected','Timeout','Call_Start_Time','starttime','Call_Type','Inbound','merge','/crm/v2/Calls','err','queue','host','stripTrailingSlash','serverUrl','[QUEUE]','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','calleridname','calleridnum','The\x20Call\x20ID\x20is:','user:%s','trigger:browser:url','https://crm.','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridnum','Outbound','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','unmanaged','monitor_format','lastevent','lodash','md5','util','./util','moment','ioredis','bluebird','../../../../config/logger','zoho','redis','defaults','localhost','socket.io-emitter','debug','stringify','length','includes','string'];(function(_0x1407f3,_0x3a9dc1){var _0x4d8064=function(_0x438b91){while(--_0x438b91){_0x1407f3['push'](_0x1407f3['shift']());}};_0x4d8064(++_0x3a9dc1);}(_0xf171,0x116));var _0x1f17=function(_0x3b7b42,_0x31badd){_0x3b7b42=_0x3b7b42-0x0;var _0x1ebaad=_0xf171[_0x3b7b42];return _0x1ebaad;};'use strict';var _=require(_0x1f17('0x0'));var rp=require('request-promise');var md5=require(_0x1f17('0x1'));var util=require(_0x1f17('0x2'));var intUtil=require(_0x1f17('0x3'));var moment=require(_0x1f17('0x4'));var Redis=require(_0x1f17('0x5'));var BPromise=require(_0x1f17('0x6'));var config=require('../../../../config/environment');var logger=require(_0x1f17('0x7'))(_0x1f17('0x8'));config[_0x1f17('0x9')]=_[_0x1f17('0xa')](config[_0x1f17('0x9')],{'host':_0x1f17('0xb'),'port':0x18eb});var io=require(_0x1f17('0xc'))(new Redis(config['redis']));function emit(_0x29cf8a,_0x5c3010,_0x23f4f8){io['to'](_0x29cf8a)['emit'](_0x5c3010,_0x23f4f8);}function request(_0x266c45){logger[_0x1f17('0xd')]('[HTTP]',JSON[_0x1f17('0xe')](_0x266c45));return rp(_0x266c45);}function getCustomFields(_0xa718aa,_0x1503da){var _0x3c3d20={};if(_0xa718aa[_0x1f17('0xf')]>0x0){_['forEach'](_0xa718aa,function(_0x57b44d){if(_[_0x1f17('0x10')]([_0x1f17('0x11'),_0x1f17('0x12')],_0x57b44d[_0x1f17('0x13')])&&_0x57b44d['idField']){_0x3c3d20[_0x57b44d[_0x1f17('0x14')]]=_0x57b44d['content'][_0x1f17('0x15')]();}else if(_0x57b44d[_0x1f17('0x13')]===_0x1f17('0x16')&&_0x57b44d[_0x1f17('0x17')]&&_0x57b44d[_0x1f17('0x14')]&&_0x1503da[_0x57b44d['variableName']]){_0x3c3d20[_0x57b44d[_0x1f17('0x14')]]=_0x1503da[_0x57b44d['variableName']][_0x1f17('0x15')]();}else if(_0x57b44d[_0x1f17('0x13')]===_0x1f17('0x18')&&_0x57b44d['Variable']&&_0x57b44d[_0x1f17('0x19')][_0x1f17('0x1a')]&&_0x57b44d[_0x1f17('0x14')]&&_0x1503da[_0x57b44d[_0x1f17('0x19')][_0x1f17('0x1a')][_0x1f17('0x1b')]()]){_0x3c3d20[_0x57b44d['idField']]=_0x1503da[_0x57b44d['Variable'][_0x1f17('0x1a')][_0x1f17('0x1b')]()][_0x1f17('0x15')]();}});}return _0x3c3d20;}function getName(_0x23bb95){if(_0x23bb95[_0x1f17('0x1c')]('\x20')>0x0){var _0x524fa8=_0x23bb95['split'](/ (.+)/);if(_0x524fa8[0x1]){return _0x524fa8;}}return[_0x23bb95,_0x23bb95];}var accountsTokens={};function getAccessToken(_0x524027){return new Promise(function(_0x3dcfa9,_0x41e65d){if(!_[_0x1f17('0x1d')](accountsTokens[_0x524027['id']])&&!_[_0x1f17('0x1d')](accountsTokens[_0x524027['id']][_0x1f17('0x1e')])){if(moment()['isBefore'](accountsTokens[_0x524027['id']][_0x1f17('0x1f')])){_0x3dcfa9(accountsTokens[_0x524027['id']][_0x1f17('0x1e')]);}}var _0x36e0f4;switch(_0x524027[_0x1f17('0x20')]){case'US':_0x36e0f4=_0x1f17('0x21');break;case'AU':_0x36e0f4=_0x1f17('0x22');break;case'EU':_0x36e0f4=_0x1f17('0x23');break;case'IN':_0x36e0f4=_0x1f17('0x24');break;case'CN':_0x36e0f4='https://accounts.zoho.com.cn';break;default:_0x36e0f4=_0x1f17('0x23');break;}var _0x29f5f9={'method':_0x1f17('0x25'),'uri':_0x36e0f4+_0x1f17('0x26'),'qs':{'refresh_token':_0x524027[_0x1f17('0x27')],'client_id':_0x524027[_0x1f17('0x28')],'client_secret':_0x524027[_0x1f17('0x29')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x29f5f9)[_0x1f17('0x2a')](function(_0x243364){accountsTokens[_0x524027['id']]={'access_token':_0x243364[_0x1f17('0x1e')],'expires_in':moment()[_0x1f17('0x2b')](_0x243364[_0x1f17('0x1f')],_0x1f17('0x2c'))};_0x3dcfa9(_0x243364['access_token']);})[_0x1f17('0x2d')](function(_0x5795cc){logger[_0x1f17('0x2e')]('Failing\x20creating\x20the\x20access_token',_0x5795cc[_0x1f17('0x2f')]);_0x41e65d(_0x5795cc);});});}function getUser(_0x3f0e38,_0x2baaae,_0x487537,_0x5a3e5b){logger['info'](_0x1f17('0x30'));return request({'method':_0x1f17('0x31'),'uri':util['format'](_0x1f17('0x32'),_0x2baaae),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':_0x1f17('0x33')+_0x3f0e38},'json':!![]})[_0x1f17('0x2a')](function(_0x4847b0){if(_0x4847b0[_0x1f17('0x34')]){var _0x20008d=-0x1;if(_['isArrayLikeObject'](_0x4847b0[_0x1f17('0x34')])){if(!_[_0x1f17('0x1d')](_0x5a3e5b)){_0x20008d=_[_0x1f17('0x35')](_0x4847b0[_0x1f17('0x34')],function(_0x4c1aa1){return _0x4c1aa1[_0x1f17('0x36')]===_0x5a3e5b;});}if(_0x20008d>=0x0){logger['info'](_0x1f17('0x37'));}else{logger['info'](_0x1f17('0x38'));_0x20008d=_[_0x1f17('0x35')](_0x4847b0[_0x1f17('0x34')],function(_0x370035){return _0x370035[_0x1f17('0x39')]['name']===_0x1f17('0x3a');});}return _0x4847b0['users'][_0x20008d];}else{if(_0x4847b0[_0x1f17('0x3b')][_0x1f17('0x39')][_0x1f17('0x1a')]===_0x1f17('0x3a')){logger[_0x1f17('0x3c')](_0x1f17('0x38'));user=_0x4847b0[_0x1f17('0x3b')];return user;}else{logger['error']('The\x20failing\x20result\x20is',JSON[_0x1f17('0xe')](_0x4847b0));throw new Error(_0x1f17('0x3d')+JSON['stringify'](_0x4847b0));}}}else{logger[_0x1f17('0x2e')]('The\x20failing\x20result\x20is',JSON[_0x1f17('0xe')](_0x4847b0));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0x1f17('0xe')](_0x4847b0));}})['catch'](function(_0x5e277f){console[_0x1f17('0x2e')](_0x5e277f);});}function getZohoUser(_0x13e1b8,_0x20904f){return new BPromise(function(_0x751adb,_0x195ba5){request(_0x13e1b8)[_0x1f17('0x2a')](function(_0x21135e){var _0x3a5553=null;if(_0x21135e){_0x3a5553=_0x21135e[_0x1f17('0x3e')][0x0];_0x3a5553['enduserType']=_0x20904f;}_0x751adb(_0x3a5553);})[_0x1f17('0x2d')](function(_0x312629){_0x195ba5(_0x312629);});});}function createEndUser(_0x58cfa,_0x25bb70,_0x4f8f02,_0x413eaa,_0x4be088,_0xeb4413){var _0x4f8f02=getName(_0x4f8f02);return request({'method':_0x1f17('0x25'),'uri':_0x1f17('0x3f')+_0x25bb70+_0x1f17('0x40')+_[_0x1f17('0x41')](_0xeb4413[_0x1f17('0x42')])+'s','body':{'data':[{'Last_Name':_0x4f8f02[0x1],'First_Name':_0x4f8f02[0x0],'Phone':_0x413eaa,'Owner':{'name':!_[_0x1f17('0x1d')](_0x4be088['role'][_0x1f17('0x1a')])?_0x4be088[_0x1f17('0x43')][_0x1f17('0x1a')]:!_[_0x1f17('0x1d')](_0x4be088[_0x1f17('0x44')])?_0x4be088[_0x1f17('0x44')]+'\x20'+_0x4be088[_0x1f17('0x45')]:_0x4be088['last_name'],'id':_0x4be088['id']}}]},'headers':{'Authorization':_0x1f17('0x33')+_0x58cfa},'json':!![]})[_0x1f17('0x2a')](function(_0x5ae36e){if(_0x5ae36e&&_0x5ae36e[_0x1f17('0x3e')][0x0][_0x1f17('0x46')]===_0x1f17('0x47')){var _0xebf76c=_0x5ae36e[_0x1f17('0x3e')][0x0][_0x1f17('0x48')];_0xebf76c[_0x1f17('0x49')]=_[_0x1f17('0x41')](_0xeb4413[_0x1f17('0x42')])+'s';return _0xebf76c;}logger[_0x1f17('0x2e')](_0x1f17('0x4a'),JSON[_0x1f17('0xe')](data));throw new Error(_0x1f17('0x4b')+JSON['stringify'](data));})[_0x1f17('0x2d')](function(_0x3711de){console[_0x1f17('0x4c')](_0x1f17('0x4d'),_0x3711de);});}function getEndUser(_0x204c1b,_0x13ed8d,_0x1b1f87,_0x48edf6,_0x5c44b2,_0x241aae,_0x3f1de2){var _0x43115a={'method':_0x1f17('0x31'),'uri':'','headers':{'Authorization':_0x1f17('0x33')+_0x204c1b},'json':!![]};switch(_0x3f1de2[_0x1f17('0x4e')]){case'contact_lead':_0x43115a['uri']='https://www.zohoapis.'+_0x13ed8d+_0x1f17('0x4f')+_0x5c44b2+'))';return getZohoUser(_0x43115a,_0x1f17('0x50'))['then'](function(_0x33c87a){if(_0x33c87a)return _0x33c87a;_0x43115a[_0x1f17('0x51')]=_0x1f17('0x3f')+_0x13ed8d+_0x1f17('0x52')+_0x5c44b2+'))';return getZohoUser(_0x43115a,_0x1f17('0x53'))[_0x1f17('0x2a')](function(_0x295469){if(_0x295469)return _0x295469;if(_0x3f1de2[_0x1f17('0x42')]!=_0x1f17('0x54')){return createEndUser(_0x204c1b,_0x13ed8d,_0x48edf6,_0x5c44b2,_0x241aae,_0x3f1de2);}else{return{};}});});break;case _0x1f17('0x55'):_0x43115a['uri']='https://www.zohoapis.'+_0x13ed8d+_0x1f17('0x4f')+_0x5c44b2+'))';return getZohoUser(_0x43115a,'Contacts')[_0x1f17('0x2a')](function(_0x33db27){if(_0x33db27)return _0x33db27;if(_0x3f1de2['moduleCreate']!=_0x1f17('0x54')){return createEndUser(_0x204c1b,_0x13ed8d,_0x48edf6,_0x5c44b2,_0x241aae,_0x3f1de2);}else{return{};}});break;case'lead':_0x43115a[_0x1f17('0x51')]=_0x1f17('0x3f')+_0x13ed8d+_0x1f17('0x52')+_0x5c44b2+'))';return getZohoUser(_0x43115a,_0x1f17('0x53'))[_0x1f17('0x2a')](function(_0x3a51ee){if(_0x3a51ee)return _0x3a51ee;if(_0x3f1de2[_0x1f17('0x42')]!='nothing'){return createEndUser(_0x204c1b,_0x13ed8d,_0x48edf6,_0x5c44b2,_0x241aae,_0x3f1de2);}else{return{};}});break;}}function getCall(_0x5be37a,_0x49b9b5,_0xfd2fa0,_0x5e4f49,_0x189f88,_0x1d5ae3,_0x13f7ad,_0x2c97fc){logger['info'](_0x1f17('0x56'));var _0x448898={};_0x448898[_0x1f17('0x57')]={'name':!_['isNil'](_0x5e4f49[_0x1f17('0x43')][_0x1f17('0x1a')])&&!_[_0x1f17('0x1d')](_0x5e4f49['profile'][_0x1f17('0x1a')])&&_0x5e4f49[_0x1f17('0x39')][_0x1f17('0x1a')]==='administrator'?_0x5e4f49[_0x1f17('0x43')]['name']:!_['isNil'](_0x5e4f49[_0x1f17('0x44')])?_0x5e4f49[_0x1f17('0x44')]+'\x20'+_0x5e4f49[_0x1f17('0x45')]:_0x5e4f49['last_name'],'id':_0x5e4f49['id']};_0x448898[_0x1f17('0x58')]=intUtil[_0x1f17('0x59')](_0x1d5ae3['Subjects'],_0x13f7ad,'\x20');_0x448898[_0x1f17('0x5a')]=intUtil[_0x1f17('0x59')](_0x1d5ae3[_0x1f17('0x5b')],_0x13f7ad,'\x0a');if(_0x189f88[_0x1f17('0x49')]===_0x1f17('0x50')){_0x448898['Who_Id']={'name':!_[_0x1f17('0x1d')](_0x189f88[_0x1f17('0x5c')])?_0x189f88[_0x1f17('0x5c')]:!_[_0x1f17('0x1d')](_0x189f88[_0x1f17('0x5d')])?_0x189f88['First_Name']+'\x20'+_0x189f88[_0x1f17('0x5e')]:_0x189f88['Last_Name'],'id':_0x189f88['id']};}if(_0x189f88[_0x1f17('0x49')]===_0x1f17('0x53')){_0x448898[_0x1f17('0x5f')]={'name':!_[_0x1f17('0x1d')](_0x189f88[_0x1f17('0x5c')])?_0x189f88['Full_Name']:!_[_0x1f17('0x1d')](_0x189f88[_0x1f17('0x5d')])?_0x189f88[_0x1f17('0x5d')]+'\x20'+_0x189f88[_0x1f17('0x5e')]:_0x189f88['Last_Name'],'id':_0x189f88['id']};_0x448898[_0x1f17('0x60')]=_[_0x1f17('0x41')](_0x189f88['enduserType']);}if(_0x13f7ad['talktime']){_0x448898[_0x1f17('0x61')]=moment[_0x1f17('0x62')](parseInt(_0x13f7ad[_0x1f17('0x63')])*0x3e8)[_0x1f17('0x64')]('mm:ss');}else if(_0x13f7ad[_0x1f17('0x65')]&&_0x13f7ad['endtime']){_0x448898[_0x1f17('0x61')]=moment[_0x1f17('0x62')](moment(_0x13f7ad['endtime'],_0x1f17('0x66'))[_0x1f17('0x67')](moment(_0x13f7ad['starttime'],'YYYY-MM-DDTHH:mm:ss')))[_0x1f17('0x64')](_0x1f17('0x68'));}switch(_0x13f7ad['lastevent']){case _0x1f17('0x69'):_0x448898[_0x1f17('0x6a')]=_0x1f17('0x6b');break;case'complete':case _0x1f17('0x6c'):_0x448898['Call_Result']=_0x1f17('0x6d');break;case _0x1f17('0x6e'):_0x448898[_0x1f17('0x6a')]=_0x1f17('0x6f');break;case'abandoned':_0x448898[_0x1f17('0x6a')]='Abandoned';break;case'timeout':_0x448898[_0x1f17('0x6a')]=_0x1f17('0x70');default:}_0x448898[_0x1f17('0x71')]=(_0x2c97fc==='outbound'?moment(_0x13f7ad[_0x1f17('0x72')])[_0x1f17('0x64')](_0x1f17('0x66')):moment(_0x13f7ad['agentcalledAt'])[_0x1f17('0x64')](_0x1f17('0x66')))||moment()[_0x1f17('0x64')](_0x1f17('0x66'));_0x448898[_0x1f17('0x73')]=_0x2c97fc||_0x1f17('0x74');_0x448898=_[_0x1f17('0x75')](_0x448898,getCustomFields(_0x1d5ae3['Fields'],_0x13f7ad));return request({'method':'POST','uri':_0x1f17('0x3f')+_0x49b9b5+_0x1f17('0x76'),'headers':{'Authorization':_0x1f17('0x33')+_0x5be37a},'body':{'data':[_0x448898]},'json':!![]})[_0x1f17('0x2a')](function(_0x2b11b4){if(_0x2b11b4&&_0x2b11b4['data'][0x0][_0x1f17('0x46')]===_0x1f17('0x47')){logger['info']('Call\x20created!');return{'id':_0x2b11b4[_0x1f17('0x3e')][0x0][_0x1f17('0x48')]['id']};}})['catch'](function(_0x27be1a){logger[_0x1f17('0x3c')](_0x1f17('0x77'),_0x27be1a['stack']);console[_0x1f17('0x4c')](_0x1f17('0x77'),_0x27be1a);});}exports[_0x1f17('0x78')]=function(_0x176d78,_0x24df1d,_0x144412,_0x86a374,_0x424210,_0x467124){var _0xc3fce0,_0x129230,_0x2873a7;_0x467124[_0x1f17('0x79')]=intUtil[_0x1f17('0x7a')](_0x467124['host']);_0x467124[_0x1f17('0x7b')]=intUtil[_0x1f17('0x7a')](_0x467124['serverUrl']);if(_0x424210&&_0x424210['monitor_format']){logger[_0x1f17('0x3c')](_0x1f17('0x7c'),'Recording\x20is\x20enabled!');_0x24df1d[_0x1f17('0x7d')]=_0x467124['serverUrl']+_0x1f17('0x7e')+_0x24df1d[_0x1f17('0x7f')]+_0x1f17('0x80')+md5(_0x24df1d[_0x1f17('0x7f')]);}else{_0x24df1d['recordingURL']='';}var _0x4e299d=_0x467124['host']===_0x1f17('0x81')?'eu':_0x1f17('0x82');return getAccessToken(_0x467124)['then'](function(_0x5be95b){_0x2873a7=_0x5be95b;return getUser(_0x2873a7,_0x4e299d,_0x467124,_0x86a374['email']);})[_0x1f17('0x2a')](function(_0x13fef2){_0xc3fce0=_0x13fef2;logger[_0x1f17('0x3c')]('The\x20User\x20ID\x20is:',_0xc3fce0['id']);return getEndUser(_0x2873a7,_0x4e299d,_0x467124,_0x24df1d[_0x1f17('0x83')],_0x24df1d[_0x1f17('0x84')],_0xc3fce0,_0x144412);})['then'](function(_0x23d722){_0x129230=_0x23d722;return getCall(_0x2873a7,_0x4e299d,_0x467124,_0xc3fce0,_0x129230,_0x144412,_0x24df1d,_0x1f17('0x74'));})[_0x1f17('0x2a')](function(_0x4c423c){if(_0x4c423c){logger[_0x1f17('0x3c')](_0x1f17('0x85'),_0x4c423c['id']);logger[_0x1f17('0x3c')](_0x1f17('0x7c'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x1f17('0x86'),_0x86a374[_0x1f17('0x1a')]),_0x1f17('0x87'),{'uri':_0x1f17('0x88')+_0x467124['host']+'/crm/EntityInfo.do?module=Calls&id='+_0x4c423c['id']});}})[_0x1f17('0x2d')](function(_0x705ebd){logger[_0x1f17('0x2e')](_0x1f17('0x7c'),JSON['stringify'](_0x705ebd));});};exports[_0x1f17('0x89')]=function(_0x21bd93,_0x48ad54,_0x45de66,_0x24772d,_0x3d4c06,_0x14629b,_0x36f063){var _0x5a3e50,_0x4887f0,_0x147866;_0x14629b['host']=intUtil[_0x1f17('0x7a')](_0x14629b[_0x1f17('0x79')]);_0x14629b[_0x1f17('0x7b')]=intUtil[_0x1f17('0x7a')](_0x14629b[_0x1f17('0x7b')]);if(_0x36f063&&_0x36f063[_0x1f17('0x8a')]&&_0x36f063[_0x1f17('0x8a')]!==_0x1f17('0x8b')){logger[_0x1f17('0x3c')](_0x1f17('0x8c'),_0x1f17('0x8d'));_0x48ad54[_0x1f17('0x7d')]=_0x14629b[_0x1f17('0x7b')]+_0x1f17('0x7e')+_0x48ad54[_0x1f17('0x7f')]+_0x1f17('0x80')+md5(_0x48ad54[_0x1f17('0x7f')]);}var _0x3a7c1a=_0x14629b[_0x1f17('0x79')]===_0x1f17('0x81')?'eu':_0x1f17('0x82');return getAccessToken(_0x14629b)[_0x1f17('0x2a')](function(_0x52034c){_0x147866=_0x52034c;return getUser(_0x147866,_0x3a7c1a,_0x14629b,_0x24772d[_0x1f17('0x36')]);})['then'](function(_0x357e3f){_0x5a3e50=_0x357e3f;logger['info']('The\x20User\x20ID\x20is:',_0x5a3e50['id']);return getEndUser(_0x147866,_0x3a7c1a,_0x14629b,_0x48ad54['destcalleridname'],_0x48ad54[_0x1f17('0x8e')],_0x5a3e50,_0x45de66);})['then'](function(_0xd654ad){_0x4887f0=_0xd654ad;return getCall(_0x147866,_0x3a7c1a,_0x14629b,_0x5a3e50,_0x4887f0,_0x45de66,_0x48ad54,_0x1f17('0x8f'));})[_0x1f17('0x2a')](function(_0x364931){if(_0x364931){logger[_0x1f17('0x3c')]('The\x20Call\x20ID\x20is:',_0x364931['id']);logger[_0x1f17('0x3c')](_0x1f17('0x8c'),_0x1f17('0x90'));emit(util[_0x1f17('0x64')]('user:%s',_0x24772d[_0x1f17('0x1a')]),'trigger:browser:url',{'uri':_0x1f17('0x88')+_0x14629b[_0x1f17('0x79')]+'/crm/EntityInfo.do?module=Calls&id='+_0x364931['id']});}})['catch'](function(_0xba8fa7){logger[_0x1f17('0x2e')](_0x1f17('0x8c'),JSON[_0x1f17('0xe')](_0xba8fa7));});};exports[_0x1f17('0x91')]=function(_0x43fda0,_0x43d248,_0x30d4e7,_0x482269,_0x3e323a,_0x51337b){var _0x52ce62,_0x1d0d0c,_0x18e5b1;_0x51337b[_0x1f17('0x79')]=intUtil[_0x1f17('0x7a')](_0x51337b[_0x1f17('0x79')]);_0x51337b[_0x1f17('0x7b')]=intUtil['stripTrailingSlash'](_0x51337b[_0x1f17('0x7b')]);if(_0x3e323a&&_0x3e323a[_0x1f17('0x92')]){logger[_0x1f17('0x3c')]('['+_0x43d248[_0x1f17('0x93')]['toUpperCase']()+']',_0x1f17('0x8d'));_0x43d248[_0x1f17('0x7d')]=_0x51337b[_0x1f17('0x7b')]+_0x1f17('0x7e')+_0x43d248[_0x1f17('0x7f')]+_0x1f17('0x80')+md5(_0x43d248['uniqueid']);}else{_0x43d248['recordingURL']='';}var _0x14b4fb=_0x51337b[_0x1f17('0x79')]===_0x1f17('0x81')?'eu':_0x1f17('0x82');return getAccessToken(_0x51337b)[_0x1f17('0x2a')](function(_0x45037c){_0x18e5b1=_0x45037c;return getUser(_0x18e5b1,_0x14b4fb,_0x51337b);})['then'](function(_0xacbf2c){_0x52ce62=_0xacbf2c;logger['info']('The\x20User\x20ID\x20is:',_0x52ce62['id']);return getEndUser(_0x18e5b1,_0x14b4fb,_0x51337b,_0x43d248['calleridname'],_0x43d248[_0x1f17('0x84')],_0x52ce62,_0x30d4e7);})[_0x1f17('0x2a')](function(_0x1c9ac3){_0x1d0d0c=_0x1c9ac3;return getCall(_0x18e5b1,_0x14b4fb,_0x51337b,_0x52ce62,_0x1d0d0c,_0x30d4e7,_0x43d248,_0x1f17('0x74'));})['then'](function(_0x259525){if(_0x259525){logger['info']('The\x20Call\x20ID\x20is:',_0x259525['id']);}})[_0x1f17('0x2d')](function(_0x3da207){logger['error']('['+_0x43d248['lastevent']['toUpperCase']()+']',JSON['stringify'](_0x3da207));});}; \ No newline at end of file +var _0x0442=['Recording\x20is\x20enabled!','/api/voice/recordings/','uniqueid','recordingURL','com','calleridname','calleridnum','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','The\x20User\x20ID\x20is:','destcalleridname','Outbound','The\x20Call\x20ID\x20is:','[OUTBOUND]','unmanaged','toUpperCase','zoho.eu','lodash','request-promise','md5','./util','moment','bluebird','../../../../config/environment','../../../../config/logger','redis','localhost','socket.io-emitter','emit','debug','[HTTP]','length','forEach','includes','string','picklist','type','idField','variableName','toString','customVariable','Variable','name','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','refreshToken','clientSecret','refresh_token','seconds','catch','error','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','then','isArrayLikeObject','users','findIndex','email','Agent\x20found!','Using\x20the\x20admin\x20account!','Administrator','user','The\x20failing\x20result\x20is','stringify','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','enduserType','https://www.zohoapis.','/crm/v2/','role','first_name','last_name','data','code','SUCCESS','details','startCase','moduleCreate','Error:\x20','CREATE\x20ERROR','moduleSearch','contact_lead','uri','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','lead','Owner','profile','Subject','getString','Subjects','Description','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','Call_Duration','utc','mm:ss','answertime','YYYY-MM-DDTHH:mm:ss','diff','starttime','lastevent','called','Call_Result','complete','connect','Answered','Rejected','abandoned','Abandoned','timeout','Timeout','Call_Start_Time','outbound','agentcalledAt','Call_Type','Inbound','merge','Fields','/crm/v2/Calls','Call\x20created!','err','log','queue','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x0442,0x1e2));var _0x2044=function(_0x2a55f8,_0x540ac4){_0x2a55f8=_0x2a55f8-0x0;var _0x245efd=_0x0442[_0x2a55f8];return _0x245efd;};'use strict';var _=require(_0x2044('0x0'));var rp=require(_0x2044('0x1'));var md5=require(_0x2044('0x2'));var util=require('util');var intUtil=require(_0x2044('0x3'));var moment=require(_0x2044('0x4'));var Redis=require('ioredis');var BPromise=require(_0x2044('0x5'));var config=require(_0x2044('0x6'));var logger=require(_0x2044('0x7'))('zoho');config[_0x2044('0x8')]=_['defaults'](config[_0x2044('0x8')],{'host':_0x2044('0x9'),'port':0x18eb});var io=require(_0x2044('0xa'))(new Redis(config[_0x2044('0x8')]));function emit(_0x215138,_0x3c4680,_0x3fd1a3){io['to'](_0x215138)[_0x2044('0xb')](_0x3c4680,_0x3fd1a3);}function request(_0x3abf0b){logger[_0x2044('0xc')](_0x2044('0xd'),JSON['stringify'](_0x3abf0b));return rp(_0x3abf0b);}function getCustomFields(_0x2e996f,_0x2c5c9f){var _0x507a2e={};if(_0x2e996f[_0x2044('0xe')]>0x0){_[_0x2044('0xf')](_0x2e996f,function(_0x3adf97){if(_[_0x2044('0x10')]([_0x2044('0x11'),_0x2044('0x12')],_0x3adf97[_0x2044('0x13')])&&_0x3adf97[_0x2044('0x14')]){_0x507a2e[_0x3adf97[_0x2044('0x14')]]=_0x3adf97['content']['toString']();}else if(_0x3adf97[_0x2044('0x13')]==='variable'&&_0x3adf97['variableName']&&_0x3adf97[_0x2044('0x14')]&&_0x2c5c9f[_0x3adf97[_0x2044('0x15')]]){_0x507a2e[_0x3adf97[_0x2044('0x14')]]=_0x2c5c9f[_0x3adf97['variableName']][_0x2044('0x16')]();}else if(_0x3adf97[_0x2044('0x13')]===_0x2044('0x17')&&_0x3adf97[_0x2044('0x18')]&&_0x3adf97[_0x2044('0x18')][_0x2044('0x19')]&&_0x3adf97[_0x2044('0x14')]&&_0x2c5c9f[_0x3adf97[_0x2044('0x18')][_0x2044('0x19')]['toLowerCase']()]){_0x507a2e[_0x3adf97[_0x2044('0x14')]]=_0x2c5c9f[_0x3adf97[_0x2044('0x18')][_0x2044('0x19')]['toLowerCase']()][_0x2044('0x16')]();}});}return _0x507a2e;}function getName(_0x5083d6){if(_0x5083d6[_0x2044('0x1a')]('\x20')>0x0){var _0x2ad5dc=_0x5083d6[_0x2044('0x1b')](/ (.+)/);if(_0x2ad5dc[0x1]){return _0x2ad5dc;}}return[_0x5083d6,_0x5083d6];}var accountsTokens={};function getAccessToken(_0x1ce6b7){return new Promise(function(_0x51a970,_0xb1c945){if(!_[_0x2044('0x1c')](accountsTokens[_0x1ce6b7['id']])&&!_[_0x2044('0x1c')](accountsTokens[_0x1ce6b7['id']][_0x2044('0x1d')])){if(moment()[_0x2044('0x1e')](accountsTokens[_0x1ce6b7['id']][_0x2044('0x1f')])){_0x51a970(accountsTokens[_0x1ce6b7['id']][_0x2044('0x1d')]);}}var _0x47594b;switch(_0x1ce6b7[_0x2044('0x20')]){case'US':_0x47594b=_0x2044('0x21');break;case'AU':_0x47594b=_0x2044('0x22');break;case'EU':_0x47594b=_0x2044('0x23');break;case'IN':_0x47594b=_0x2044('0x24');break;case'CN':_0x47594b='https://accounts.zoho.com.cn';break;default:_0x47594b=_0x2044('0x23');break;}var _0x363d59={'method':'POST','uri':_0x47594b+'/oauth/v2/token','qs':{'refresh_token':_0x1ce6b7[_0x2044('0x25')],'client_id':_0x1ce6b7['clientId'],'client_secret':_0x1ce6b7[_0x2044('0x26')],'grant_type':_0x2044('0x27')},'json':!![]};return rp(_0x363d59)['then'](function(_0x2ca1e8){accountsTokens[_0x1ce6b7['id']]={'access_token':_0x2ca1e8[_0x2044('0x1d')],'expires_in':moment()['add'](_0x2ca1e8[_0x2044('0x1f')],_0x2044('0x28'))};_0x51a970(_0x2ca1e8[_0x2044('0x1d')]);})[_0x2044('0x29')](function(_0x401166){logger[_0x2044('0x2a')](_0x2044('0x2b'),_0x401166[_0x2044('0x2c')]);_0xb1c945(_0x401166);});});}function getUser(_0x360972,_0x107e85,_0x4cf908,_0xe3ac1c){logger[_0x2044('0x2d')](_0x2044('0x2e'));return request({'method':_0x2044('0x2f'),'uri':util[_0x2044('0x30')](_0x2044('0x31'),_0x107e85),'qs':{'type':_0x2044('0x32')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x360972},'json':!![]})[_0x2044('0x33')](function(_0xd9fff){if(_0xd9fff['users']){var _0x395009=-0x1;if(_[_0x2044('0x34')](_0xd9fff[_0x2044('0x35')])){if(!_[_0x2044('0x1c')](_0xe3ac1c)){_0x395009=_[_0x2044('0x36')](_0xd9fff[_0x2044('0x35')],function(_0x587620){return _0x587620[_0x2044('0x37')]===_0xe3ac1c;});}if(_0x395009>=0x0){logger[_0x2044('0x2d')](_0x2044('0x38'));}else{logger[_0x2044('0x2d')](_0x2044('0x39'));_0x395009=_[_0x2044('0x36')](_0xd9fff[_0x2044('0x35')],function(_0x2a8610){return _0x2a8610['profile'][_0x2044('0x19')]===_0x2044('0x3a');});}return _0xd9fff[_0x2044('0x35')][_0x395009];}else{if(_0xd9fff['user']['profile'][_0x2044('0x19')]===_0x2044('0x3a')){logger['info'](_0x2044('0x39'));user=_0xd9fff[_0x2044('0x3b')];return user;}else{logger[_0x2044('0x2a')](_0x2044('0x3c'),JSON[_0x2044('0x3d')](_0xd9fff));throw new Error(_0x2044('0x3e')+JSON[_0x2044('0x3d')](_0xd9fff));}}}else{logger[_0x2044('0x2a')](_0x2044('0x3c'),JSON[_0x2044('0x3d')](_0xd9fff));throw new Error(_0x2044('0x3e')+JSON[_0x2044('0x3d')](_0xd9fff));}})[_0x2044('0x29')](function(_0x1ada19){console[_0x2044('0x2a')](_0x1ada19);});}function getZohoUser(_0x40f598,_0x365fda){return new BPromise(function(_0x64cbb9,_0x2586af){request(_0x40f598)['then'](function(_0x46fae9){var _0xcdee72=null;if(_0x46fae9){_0xcdee72=_0x46fae9['data'][0x0];_0xcdee72[_0x2044('0x3f')]=_0x365fda;}_0x64cbb9(_0xcdee72);})[_0x2044('0x29')](function(_0xac2175){_0x2586af(_0xac2175);});});}function createEndUser(_0x389cee,_0x5240d9,_0x940789,_0x238971,_0x202e02,_0x3c99cc){var _0x940789=getName(_0x940789);return request({'method':'POST','uri':_0x2044('0x40')+_0x5240d9+_0x2044('0x41')+_['startCase'](_0x3c99cc['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x940789[0x1],'First_Name':_0x940789[0x0],'Phone':_0x238971,'Owner':{'name':!_['isNil'](_0x202e02[_0x2044('0x42')][_0x2044('0x19')])?_0x202e02[_0x2044('0x42')][_0x2044('0x19')]:!_[_0x2044('0x1c')](_0x202e02[_0x2044('0x43')])?_0x202e02[_0x2044('0x43')]+'\x20'+_0x202e02['last_name']:_0x202e02[_0x2044('0x44')],'id':_0x202e02['id']}}]},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x389cee},'json':!![]})[_0x2044('0x33')](function(_0x57eefa){if(_0x57eefa&&_0x57eefa[_0x2044('0x45')][0x0][_0x2044('0x46')]===_0x2044('0x47')){var _0x1969e5=_0x57eefa[_0x2044('0x45')][0x0][_0x2044('0x48')];_0x1969e5[_0x2044('0x3f')]=_[_0x2044('0x49')](_0x3c99cc[_0x2044('0x4a')])+'s';return _0x1969e5;}logger['error'](_0x2044('0x3c'),JSON[_0x2044('0x3d')](data));throw new Error(_0x2044('0x4b')+JSON[_0x2044('0x3d')](data));})[_0x2044('0x29')](function(_0x313278){console['log'](_0x2044('0x4c'),_0x313278);});}function getEndUser(_0x3be161,_0x4c0f37,_0x4f886a,_0x274e74,_0x37f9b6,_0x4f384c,_0x19c2d2){var _0x2c72e3={'method':_0x2044('0x2f'),'uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x3be161},'json':!![]};switch(_0x19c2d2[_0x2044('0x4d')]){case _0x2044('0x4e'):_0x2c72e3[_0x2044('0x4f')]=_0x2044('0x40')+_0x4c0f37+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x37f9b6+'))';return getZohoUser(_0x2c72e3,_0x2044('0x50'))[_0x2044('0x33')](function(_0x4c49c6){if(_0x4c49c6)return _0x4c49c6;_0x2c72e3['uri']=_0x2044('0x40')+_0x4c0f37+_0x2044('0x51')+_0x37f9b6+'))';return getZohoUser(_0x2c72e3,_0x2044('0x52'))[_0x2044('0x33')](function(_0x45d871){if(_0x45d871)return _0x45d871;if(_0x19c2d2[_0x2044('0x4a')]!='nothing'){return createEndUser(_0x3be161,_0x4c0f37,_0x274e74,_0x37f9b6,_0x4f384c,_0x19c2d2);}else{return{};}});});break;case'contact':_0x2c72e3[_0x2044('0x4f')]=_0x2044('0x40')+_0x4c0f37+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x37f9b6+'))';return getZohoUser(_0x2c72e3,_0x2044('0x50'))[_0x2044('0x33')](function(_0x331b21){if(_0x331b21)return _0x331b21;if(_0x19c2d2[_0x2044('0x4a')]!=_0x2044('0x53')){return createEndUser(_0x3be161,_0x4c0f37,_0x274e74,_0x37f9b6,_0x4f384c,_0x19c2d2);}else{return{};}});break;case _0x2044('0x54'):_0x2c72e3[_0x2044('0x4f')]=_0x2044('0x40')+_0x4c0f37+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x37f9b6+'))';return getZohoUser(_0x2c72e3,_0x2044('0x52'))[_0x2044('0x33')](function(_0x137d68){if(_0x137d68)return _0x137d68;if(_0x19c2d2[_0x2044('0x4a')]!='nothing'){return createEndUser(_0x3be161,_0x4c0f37,_0x274e74,_0x37f9b6,_0x4f384c,_0x19c2d2);}else{return{};}});break;}}function getCall(_0x405773,_0x222fc7,_0x3e80d0,_0xadbbfc,_0xce479c,_0x219422,_0x25e12d,_0x3805d7){logger[_0x2044('0x2d')]('Creating\x20new\x20call...');var _0x2a99e4={};_0x2a99e4[_0x2044('0x55')]={'name':!_[_0x2044('0x1c')](_0xadbbfc[_0x2044('0x42')][_0x2044('0x19')])&&!_[_0x2044('0x1c')](_0xadbbfc[_0x2044('0x56')][_0x2044('0x19')])&&_0xadbbfc[_0x2044('0x56')][_0x2044('0x19')]==='administrator'?_0xadbbfc[_0x2044('0x42')][_0x2044('0x19')]:!_[_0x2044('0x1c')](_0xadbbfc[_0x2044('0x43')])?_0xadbbfc[_0x2044('0x43')]+'\x20'+_0xadbbfc[_0x2044('0x44')]:_0xadbbfc[_0x2044('0x44')],'id':_0xadbbfc['id']};_0x2a99e4[_0x2044('0x57')]=intUtil[_0x2044('0x58')](_0x219422[_0x2044('0x59')],_0x25e12d,'\x20');_0x2a99e4[_0x2044('0x5a')]=intUtil[_0x2044('0x58')](_0x219422[_0x2044('0x5b')],_0x25e12d,'\x0a');if(_0xce479c['enduserType']===_0x2044('0x50')){_0x2a99e4[_0x2044('0x5c')]={'name':!_[_0x2044('0x1c')](_0xce479c[_0x2044('0x5d')])?_0xce479c['Full_Name']:!_[_0x2044('0x1c')](_0xce479c[_0x2044('0x5e')])?_0xce479c[_0x2044('0x5e')]+'\x20'+_0xce479c['Last_Name']:_0xce479c[_0x2044('0x5f')],'id':_0xce479c['id']};}if(_0xce479c['enduserType']==='Leads'){_0x2a99e4[_0x2044('0x60')]={'name':!_[_0x2044('0x1c')](_0xce479c[_0x2044('0x5d')])?_0xce479c['Full_Name']:!_[_0x2044('0x1c')](_0xce479c[_0x2044('0x5e')])?_0xce479c[_0x2044('0x5e')]+'\x20'+_0xce479c[_0x2044('0x5f')]:_0xce479c[_0x2044('0x5f')],'id':_0xce479c['id']};_0x2a99e4[_0x2044('0x61')]=_['startCase'](_0xce479c[_0x2044('0x3f')]);}if(_0x25e12d[_0x2044('0x62')]){_0x2a99e4[_0x2044('0x63')]=moment[_0x2044('0x64')](parseInt(_0x25e12d['talktime'])*0x3e8)['format'](_0x2044('0x65'));}else if(_0x25e12d[_0x2044('0x66')]&&_0x25e12d['endtime']){_0x2a99e4[_0x2044('0x63')]=moment['utc'](moment(_0x25e12d['endtime'],_0x2044('0x67'))[_0x2044('0x68')](moment(_0x25e12d[_0x2044('0x69')],_0x2044('0x67'))))[_0x2044('0x30')](_0x2044('0x65'));}switch(_0x25e12d[_0x2044('0x6a')]){case _0x2044('0x6b'):_0x2a99e4[_0x2044('0x6c')]='Called';break;case _0x2044('0x6d'):case _0x2044('0x6e'):_0x2a99e4[_0x2044('0x6c')]=_0x2044('0x6f');break;case'rejected':_0x2a99e4[_0x2044('0x6c')]=_0x2044('0x70');break;case _0x2044('0x71'):_0x2a99e4['Call_Result']=_0x2044('0x72');break;case _0x2044('0x73'):_0x2a99e4[_0x2044('0x6c')]=_0x2044('0x74');default:}_0x2a99e4[_0x2044('0x75')]=(_0x3805d7===_0x2044('0x76')?moment(_0x25e12d['starttime'])[_0x2044('0x30')](_0x2044('0x67')):moment(_0x25e12d[_0x2044('0x77')])['format'](_0x2044('0x67')))||moment()['format'](_0x2044('0x67'));_0x2a99e4[_0x2044('0x78')]=_0x3805d7||_0x2044('0x79');_0x2a99e4=_[_0x2044('0x7a')](_0x2a99e4,getCustomFields(_0x219422[_0x2044('0x7b')],_0x25e12d));return request({'method':'POST','uri':'https://www.zohoapis.'+_0x222fc7+_0x2044('0x7c'),'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x405773},'body':{'data':[_0x2a99e4]},'json':!![]})[_0x2044('0x33')](function(_0xf7dfdf){if(_0xf7dfdf&&_0xf7dfdf[_0x2044('0x45')][0x0]['code']===_0x2044('0x47')){logger[_0x2044('0x2d')](_0x2044('0x7d'));return{'id':_0xf7dfdf['data'][0x0]['details']['id']};}})[_0x2044('0x29')](function(_0x249337){logger[_0x2044('0x2d')](_0x2044('0x7e'),_0x249337[_0x2044('0x2c')]);console[_0x2044('0x7f')](_0x2044('0x7e'),_0x249337);});}exports[_0x2044('0x80')]=function(_0x2295eb,_0x574243,_0x28e2ad,_0x2c7403,_0x3993bc,_0xf43acf){var _0x42c6fd,_0xda5836,_0x46287d;_0xf43acf[_0x2044('0x81')]=intUtil[_0x2044('0x82')](_0xf43acf['host']);_0xf43acf[_0x2044('0x83')]=intUtil[_0x2044('0x82')](_0xf43acf['serverUrl']);if(_0x3993bc&&_0x3993bc[_0x2044('0x84')]){logger[_0x2044('0x2d')](_0x2044('0x85'),_0x2044('0x86'));_0x574243['recordingURL']=_0xf43acf[_0x2044('0x83')]+_0x2044('0x87')+_0x574243[_0x2044('0x88')]+'/downloads?type=uniqueid&token='+md5(_0x574243[_0x2044('0x88')]);}else{_0x574243[_0x2044('0x89')]='';}var _0x5ea99f=_0xf43acf[_0x2044('0x81')]==='zoho.eu'?'eu':_0x2044('0x8a');return getAccessToken(_0xf43acf)['then'](function(_0x4f87b8){_0x46287d=_0x4f87b8;return getUser(_0x46287d,_0x5ea99f,_0xf43acf,_0x2c7403['email']);})[_0x2044('0x33')](function(_0x300d53){_0x42c6fd=_0x300d53;logger[_0x2044('0x2d')]('The\x20User\x20ID\x20is:',_0x42c6fd['id']);return getEndUser(_0x46287d,_0x5ea99f,_0xf43acf,_0x574243[_0x2044('0x8b')],_0x574243[_0x2044('0x8c')],_0x42c6fd,_0x28e2ad);})[_0x2044('0x33')](function(_0x1039ff){_0xda5836=_0x1039ff;return getCall(_0x46287d,_0x5ea99f,_0xf43acf,_0x42c6fd,_0xda5836,_0x28e2ad,_0x574243,_0x2044('0x79'));})[_0x2044('0x33')](function(_0x56e338){if(_0x56e338){logger['info']('The\x20Call\x20ID\x20is:',_0x56e338['id']);logger['info'](_0x2044('0x85'),_0x2044('0x8d'));emit(util[_0x2044('0x30')](_0x2044('0x8e'),_0x2c7403['name']),_0x2044('0x8f'),{'uri':'https://crm.'+_0xf43acf[_0x2044('0x81')]+_0x2044('0x90')+_0x56e338['id']});}})[_0x2044('0x29')](function(_0x2d5888){logger[_0x2044('0x2a')](_0x2044('0x85'),JSON[_0x2044('0x3d')](_0x2d5888));});};exports[_0x2044('0x76')]=function(_0xc111a5,_0x532f57,_0x435064,_0x35d22f,_0x3fa5fb,_0x889d93,_0x4ee6c7){var _0x5c42bd,_0x16610b,_0x68dfcf;_0x889d93['host']=intUtil[_0x2044('0x82')](_0x889d93[_0x2044('0x81')]);_0x889d93[_0x2044('0x83')]=intUtil[_0x2044('0x82')](_0x889d93[_0x2044('0x83')]);if(_0x4ee6c7&&_0x4ee6c7[_0x2044('0x91')]&&_0x4ee6c7[_0x2044('0x91')]!=='none'){logger[_0x2044('0x2d')]('[OUTBOUND]',_0x2044('0x86'));_0x532f57[_0x2044('0x89')]=_0x889d93['serverUrl']+'/api/voice/recordings/'+_0x532f57[_0x2044('0x88')]+'/downloads?type=uniqueid&token='+md5(_0x532f57['uniqueid']);}var _0x249e15=_0x889d93['host']==='zoho.eu'?'eu':_0x2044('0x8a');return getAccessToken(_0x889d93)[_0x2044('0x33')](function(_0x3816d5){_0x68dfcf=_0x3816d5;return getUser(_0x68dfcf,_0x249e15,_0x889d93,_0x35d22f[_0x2044('0x37')]);})[_0x2044('0x33')](function(_0x31f9da){_0x5c42bd=_0x31f9da;logger[_0x2044('0x2d')](_0x2044('0x92'),_0x5c42bd['id']);return getEndUser(_0x68dfcf,_0x249e15,_0x889d93,_0x532f57[_0x2044('0x93')],_0x532f57['destcalleridnum'],_0x5c42bd,_0x435064);})[_0x2044('0x33')](function(_0xfd31dc){_0x16610b=_0xfd31dc;return getCall(_0x68dfcf,_0x249e15,_0x889d93,_0x5c42bd,_0x16610b,_0x435064,_0x532f57,_0x2044('0x94'));})['then'](function(_0x3a9c22){if(_0x3a9c22){logger[_0x2044('0x2d')](_0x2044('0x95'),_0x3a9c22['id']);logger[_0x2044('0x2d')](_0x2044('0x96'),_0x2044('0x8d'));emit(util[_0x2044('0x30')]('user:%s',_0x35d22f['name']),_0x2044('0x8f'),{'uri':'https://crm.'+_0x889d93[_0x2044('0x81')]+_0x2044('0x90')+_0x3a9c22['id']});}})['catch'](function(_0x46e997){logger[_0x2044('0x2a')](_0x2044('0x96'),JSON['stringify'](_0x46e997));});};exports[_0x2044('0x97')]=function(_0x173ee2,_0x221ace,_0x30f60f,_0x491915,_0x1658b3,_0x22c0ba){var _0x161d0e,_0x59a3e1,_0x5b5cbd;_0x22c0ba[_0x2044('0x81')]=intUtil[_0x2044('0x82')](_0x22c0ba[_0x2044('0x81')]);_0x22c0ba[_0x2044('0x83')]=intUtil[_0x2044('0x82')](_0x22c0ba[_0x2044('0x83')]);if(_0x1658b3&&_0x1658b3[_0x2044('0x84')]){logger['info']('['+_0x221ace[_0x2044('0x6a')][_0x2044('0x98')]()+']','Recording\x20is\x20enabled!');_0x221ace[_0x2044('0x89')]=_0x22c0ba[_0x2044('0x83')]+'/api/voice/recordings/'+_0x221ace[_0x2044('0x88')]+'/downloads?type=uniqueid&token='+md5(_0x221ace[_0x2044('0x88')]);}else{_0x221ace['recordingURL']='';}var _0x4aa065=_0x22c0ba['host']===_0x2044('0x99')?'eu':_0x2044('0x8a');return getAccessToken(_0x22c0ba)[_0x2044('0x33')](function(_0x27457a){_0x5b5cbd=_0x27457a;return getUser(_0x5b5cbd,_0x4aa065,_0x22c0ba);})[_0x2044('0x33')](function(_0x4aa130){_0x161d0e=_0x4aa130;logger[_0x2044('0x2d')](_0x2044('0x92'),_0x161d0e['id']);return getEndUser(_0x5b5cbd,_0x4aa065,_0x22c0ba,_0x221ace[_0x2044('0x8b')],_0x221ace[_0x2044('0x8c')],_0x161d0e,_0x30f60f);})['then'](function(_0xa9abf8){_0x59a3e1=_0xa9abf8;return getCall(_0x5b5cbd,_0x4aa065,_0x22c0ba,_0x161d0e,_0x59a3e1,_0x30f60f,_0x221ace,_0x2044('0x79'));})[_0x2044('0x33')](function(_0x3f2337){if(_0x3f2337){logger[_0x2044('0x2d')](_0x2044('0x95'),_0x3f2337['id']);}})[_0x2044('0x29')](function(_0x3cb7de){logger[_0x2044('0x2a')]('['+_0x221ace[_0x2044('0x6a')][_0x2044('0x98')]()+']',JSON[_0x2044('0x3d')](_0x3cb7de));});}; \ 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 400f189..a10ec2f 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 _0x0237=['../../../../config/logger','exec','data2','Script','data3','error','format','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs'];(function(_0x4f0467,_0x51244f){var _0xdec66a=function(_0x33d4b5){while(--_0x33d4b5){_0x4f0467['push'](_0x4f0467['shift']());}};_0xdec66a(++_0x51244f);}(_0x0237,0x6c));var _0x7023=function(_0x32f8b9,_0x1f50e7){_0x32f8b9=_0x32f8b9-0x0;var _0x16fdab=_0x0237[_0x32f8b9];return _0x16fdab;};'use strict';var util=require(_0x7023('0x0'));var sh=require(_0x7023('0x1'));var Mustache=require('mustache');var logger=require(_0x7023('0x2'))('trigger');exports[_0x7023('0x3')]=function(_0x134784,_0x37579e){var _0x338db1=_0x134784[_0x7023('0x4')]?_0x134784[_0x7023('0x4')]:_0x7023('0x5');var _0x2ac040=_0x134784[_0x7023('0x6')]?Mustache['render'](_0x134784[_0x7023('0x6')],_0x37579e):_0x37579e;sh[_0x7023('0x3')](_0x2ac040,function(_0x5bc56f,_0x56cffc,_0x1afd80){if(_0x5bc56f!==0x0){logger[_0x7023('0x7')](util[_0x7023('0x8')]('%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s',_0x338db1,_0x2ac040,_0x5bc56f,_0x1afd80));}else{logger[_0x7023('0x9')](util[_0x7023('0x8')](_0x7023('0xa'),_0x338db1,_0x2ac040,_0x56cffc));}});}; \ No newline at end of file +var _0x80d6=['info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs','mustache','../../../../config/logger','exec','data2','render','data3','error','format'];(function(_0x75f869,_0x3690d6){var _0x10af8b=function(_0x22d3ff){while(--_0x22d3ff){_0x75f869['push'](_0x75f869['shift']());}};_0x10af8b(++_0x3690d6);}(_0x80d6,0x1ee));var _0x680d=function(_0x2fdce0,_0x496242){_0x2fdce0=_0x2fdce0-0x0;var _0x36f07e=_0x80d6[_0x2fdce0];return _0x36f07e;};'use strict';var util=require(_0x680d('0x0'));var sh=require(_0x680d('0x1'));var Mustache=require(_0x680d('0x2'));var logger=require(_0x680d('0x3'))('trigger');exports[_0x680d('0x4')]=function(_0x4cf709,_0xfa0bd1){var _0x48d112=_0x4cf709[_0x680d('0x5')]?_0x4cf709[_0x680d('0x5')]:'Script';var _0x495fc8=_0x4cf709['data3']?Mustache[_0x680d('0x6')](_0x4cf709[_0x680d('0x7')],_0xfa0bd1):_0xfa0bd1;sh[_0x680d('0x4')](_0x495fc8,function(_0x458d4f,_0x3ab2e0,_0x2c1ac1){if(_0x458d4f!==0x0){logger[_0x680d('0x8')](util[_0x680d('0x9')]('%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s',_0x48d112,_0x495fc8,_0x458d4f,_0x2c1ac1));}else{logger[_0x680d('0xa')](util['format'](_0x680d('0xb'),_0x48d112,_0x495fc8,_0x3ab2e0));}});}; \ 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 5093ea7..fcdde7d 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 _0x7ed8=['body','stack','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then','isNil',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','message','request-promise','util','lodash','mustache','../../../../config/logger','trigger','exec','data1','toUpperCase','data2','data5','number','parse','data6','error','GET','DELETE','PUT','data7','render'];(function(_0xc0e12f,_0x16c12d){var _0x1ac703=function(_0x4ff312){while(--_0x4ff312){_0xc0e12f['push'](_0xc0e12f['shift']());}};_0x1ac703(++_0x16c12d);}(_0x7ed8,0x1b3));var _0x87ed=function(_0x8764fa,_0x106ad4){_0x8764fa=_0x8764fa-0x0;var _0x37f8a9=_0x7ed8[_0x8764fa];return _0x37f8a9;};'use strict';var rp=require(_0x87ed('0x0'));var util=require(_0x87ed('0x1'));var _=require(_0x87ed('0x2'));var Mustache=require(_0x87ed('0x3'));var logger=require(_0x87ed('0x4'))(_0x87ed('0x5'));exports[_0x87ed('0x6')]=function(_0x292455,_0x59004f){var _0x5d19d9,_0x5374b6;var _0x2b207c={'method':_0x292455[_0x87ed('0x7')][_0x87ed('0x8')](),'uri':Mustache['render'](_0x292455[_0x87ed('0x9')],_0x59004f),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x292455[_0x87ed('0xa')])===_0x87ed('0xb')&&parseInt(_0x292455[_0x87ed('0xa')])>=0x1&&parseInt(_0x292455[_0x87ed('0xa')])<=0xa?parseInt(_0x292455[_0x87ed('0xa')])*0x3e8:0x5*0x3e8};try{_0x2b207c['headers']=_0x292455['data6']?JSON[_0x87ed('0xc')](Mustache['render'](_0x292455[_0x87ed('0xd')],_0x59004f)):{};}catch(_0x43752e){logger[_0x87ed('0xe')](_0x43752e['stack']);}switch(_0x292455[_0x87ed('0x7')][_0x87ed('0x8')]()){case _0x87ed('0xf'):case _0x87ed('0x10'):_0x5d19d9=null;_0x2b207c['qs']=_0x59004f;break;case'POST':case _0x87ed('0x11'):if(_0x292455[_0x87ed('0x12')]){try{_0x5d19d9=JSON[_0x87ed('0xc')](Mustache[_0x87ed('0x13')](_0x292455[_0x87ed('0x12')],_0x59004f));_0x2b207c[_0x87ed('0x14')]=_0x5d19d9;}catch(_0xc82386){logger[_0x87ed('0xe')](_0xc82386[_0x87ed('0x15')]);logger[_0x87ed('0xe')](_0x87ed('0x16'));}}else{_0x5d19d9=_0x59004f;_0x2b207c[_0x87ed('0x14')]=_0x5d19d9;}break;}logger['info'](util[_0x87ed('0x17')](_0x87ed('0x18'),_0x292455[_0x87ed('0x7')],_0x292455[_0x87ed('0x9')],JSON[_0x87ed('0x19')](_0x2b207c)));rp(_0x2b207c)[_0x87ed('0x1a')](function(_0x488a68){_0x5d19d9=!_[_0x87ed('0x1b')](_0x5d19d9)?_0x87ed('0x1c')+_0x5d19d9:'';_0x5374b6=typeof _0x488a68[_0x87ed('0x14')]===_0x87ed('0x1d')?JSON[_0x87ed('0x19')](_0x488a68[_0x87ed('0x14')]):_0x488a68[_0x87ed('0x14')];logger['info'](util[_0x87ed('0x17')](_0x87ed('0x1e'),_0x292455[_0x87ed('0x7')],_0x292455[_0x87ed('0x9')],_0x488a68[_0x87ed('0x1f')],_0x5374b6));})[_0x87ed('0x20')](function(_0x51c7f){logger['error'](util[_0x87ed('0x17')](_0x87ed('0x21'),_0x292455[_0x87ed('0x7')],_0x292455[_0x87ed('0x9')],_0x51c7f[_0x87ed('0x1f')],_0x51c7f['name'],_0x51c7f[_0x87ed('0x22')]));});}; \ No newline at end of file +var _0xed1e=['parse','error','GET','DELETE','POST','PUT','data7','stack','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','then',',\x20request\x20body:\x20','body','object','stringify','%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','lodash','mustache','../../../../config/logger','trigger','exec','data1','toUpperCase','data2','data5','number','headers','data6'];(function(_0xc5fcc4,_0x2f2c74){var _0x5502f4=function(_0x55c5d7){while(--_0x55c5d7){_0xc5fcc4['push'](_0xc5fcc4['shift']());}};_0x5502f4(++_0x2f2c74);}(_0xed1e,0x1e3));var _0xeed1=function(_0xdeffe6,_0x198150){_0xdeffe6=_0xdeffe6-0x0;var _0x5baeb=_0xed1e[_0xdeffe6];return _0x5baeb;};'use strict';var rp=require('request-promise');var util=require('util');var _=require(_0xeed1('0x0'));var Mustache=require(_0xeed1('0x1'));var logger=require(_0xeed1('0x2'))(_0xeed1('0x3'));exports[_0xeed1('0x4')]=function(_0x151082,_0x2d66a3){var _0x4bee5f,_0x260050;var _0x331db1={'method':_0x151082[_0xeed1('0x5')][_0xeed1('0x6')](),'uri':Mustache['render'](_0x151082[_0xeed1('0x7')],_0x2d66a3),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x151082[_0xeed1('0x8')])===_0xeed1('0x9')&&parseInt(_0x151082[_0xeed1('0x8')])>=0x1&&parseInt(_0x151082[_0xeed1('0x8')])<=0xa?parseInt(_0x151082[_0xeed1('0x8')])*0x3e8:0x5*0x3e8};try{_0x331db1[_0xeed1('0xa')]=_0x151082[_0xeed1('0xb')]?JSON[_0xeed1('0xc')](Mustache['render'](_0x151082[_0xeed1('0xb')],_0x2d66a3)):{};}catch(_0x5ab51a){logger[_0xeed1('0xd')](_0x5ab51a['stack']);}switch(_0x151082['data1']['toUpperCase']()){case _0xeed1('0xe'):case _0xeed1('0xf'):_0x4bee5f=null;_0x331db1['qs']=_0x2d66a3;break;case _0xeed1('0x10'):case _0xeed1('0x11'):if(_0x151082[_0xeed1('0x12')]){try{_0x4bee5f=JSON['parse'](Mustache['render'](_0x151082[_0xeed1('0x12')],_0x2d66a3));_0x331db1['body']=_0x4bee5f;}catch(_0x387587){logger[_0xeed1('0xd')](_0x387587[_0xeed1('0x13')]);logger['error']('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x4bee5f=_0x2d66a3;_0x331db1['body']=_0x4bee5f;}break;}logger[_0xeed1('0x14')](util[_0xeed1('0x15')](_0xeed1('0x16'),_0x151082[_0xeed1('0x5')],_0x151082['data2'],JSON['stringify'](_0x331db1)));rp(_0x331db1)[_0xeed1('0x17')](function(_0x5e0187){_0x4bee5f=!_['isNil'](_0x4bee5f)?_0xeed1('0x18')+_0x4bee5f:'';_0x260050=typeof _0x5e0187[_0xeed1('0x19')]===_0xeed1('0x1a')?JSON[_0xeed1('0x1b')](_0x5e0187[_0xeed1('0x19')]):_0x5e0187['body'];logger['info'](util[_0xeed1('0x15')](_0xeed1('0x1c'),_0x151082[_0xeed1('0x5')],_0x151082[_0xeed1('0x7')],_0x5e0187[_0xeed1('0x1d')],_0x260050));})['catch'](function(_0x13a1b7){logger[_0xeed1('0xd')](util['format'](_0xeed1('0x1e'),_0x151082[_0xeed1('0x5')],_0x151082[_0xeed1('0x7')],_0x13a1b7['statusCode'],_0x13a1b7[_0xeed1('0x1f')],_0x13a1b7[_0xeed1('0x20')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 20a1ac0..13852c7 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 _0x9f5e=['http','debug','rpc','error','message','catch','exports','jayson/promise','../../config/logger','routing','client'];(function(_0x4d54b1,_0x223d46){var _0x3ac052=function(_0x17bef7){while(--_0x17bef7){_0x4d54b1['push'](_0x4d54b1['shift']());}};_0x3ac052(++_0x223d46);}(_0x9f5e,0x11a));var _0xe9f5=function(_0x46b78f,_0x2ef432){_0x46b78f=_0x46b78f-0x0;var _0x399534=_0x9f5e[_0x46b78f];return _0x399534;};'use strict';var jayson=require(_0xe9f5('0x0'));var BPromise=require('bluebird');var logger=require(_0xe9f5('0x1'))(_0xe9f5('0x2'));var client=jayson[_0xe9f5('0x3')][_0xe9f5('0x4')]({'port':0x2329});client['Request']=function(_0x1ab55b,_0x12f12b){return new BPromise(function(_0xb0d37a,_0x5c96ec){return client['request'](_0x1ab55b,_0x12f12b)['then'](function(_0x48ebd7){logger[_0xe9f5('0x5')](_0xe9f5('0x6'),'routing',_0x1ab55b,_0x12f12b,_0x48ebd7);if(_0x48ebd7[_0xe9f5('0x7')]){logger[_0xe9f5('0x7')]('rpc',_0xe9f5('0x2'),_0x1ab55b,_0x48ebd7[_0xe9f5('0x7')][_0xe9f5('0x8')],_0x12f12b);return _0x5c96ec(_0x48ebd7[_0xe9f5('0x7')]['message']);}else{return _0xb0d37a(_0x48ebd7['result']);}})[_0xe9f5('0x9')](function(_0x442720){logger[_0xe9f5('0x7')](_0xe9f5('0x6'),_0xe9f5('0x2'),_0x1ab55b,_0x442720,_0x12f12b);return _0x5c96ec(_0x442720);});});};module[_0xe9f5('0xa')]=client; \ No newline at end of file +var _0x4c75=['routing','client','http','Request','request','then','debug','error','message','result','catch','rpc','jayson/promise','bluebird','../../config/logger'];(function(_0x495002,_0x1aad30){var _0xbc360e=function(_0x295d72){while(--_0x295d72){_0x495002['push'](_0x495002['shift']());}};_0xbc360e(++_0x1aad30);}(_0x4c75,0x138));var _0x54c7=function(_0x1b1ed8,_0x2b0f38){_0x1b1ed8=_0x1b1ed8-0x0;var _0x33e1d6=_0x4c75[_0x1b1ed8];return _0x33e1d6;};'use strict';var jayson=require(_0x54c7('0x0'));var BPromise=require(_0x54c7('0x1'));var logger=require(_0x54c7('0x2'))(_0x54c7('0x3'));var client=jayson[_0x54c7('0x4')][_0x54c7('0x5')]({'port':0x2329});client[_0x54c7('0x6')]=function(_0xa0f0d2,_0x4d20be){return new BPromise(function(_0xfd21a5,_0x30e0cc){return client[_0x54c7('0x7')](_0xa0f0d2,_0x4d20be)[_0x54c7('0x8')](function(_0x4d8298){logger[_0x54c7('0x9')]('rpc',_0x54c7('0x3'),_0xa0f0d2,_0x4d20be,_0x4d8298);if(_0x4d8298[_0x54c7('0xa')]){logger[_0x54c7('0xa')]('rpc','routing',_0xa0f0d2,_0x4d8298[_0x54c7('0xa')][_0x54c7('0xb')],_0x4d20be);return _0x30e0cc(_0x4d8298[_0x54c7('0xa')][_0x54c7('0xb')]);}else{return _0xfd21a5(_0x4d8298[_0x54c7('0xc')]);}})[_0x54c7('0xd')](function(_0x5f0d8f){logger[_0x54c7('0xa')](_0x54c7('0xe'),_0x54c7('0x3'),_0xa0f0d2,_0x5f0d8f,_0x4d20be);return _0x30e0cc(_0x5f0d8f);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 46a4a01..ca2a82d 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 _0x39dc=['./realtime','./lib/email','./rpc/mailAccount','./rpc/setting','../../config/logger','email','then','initMailAccounts','refresh','mailAccounts','listen','loginMailFrequency','catch','error','Email\x20service\x20initialization','./server'];(function(_0x165360,_0x5ca20b){var _0x5acc59=function(_0x4f9d07){while(--_0x4f9d07){_0x165360['push'](_0x165360['shift']());}};_0x5acc59(++_0x5ca20b);}(_0x39dc,0x10f));var _0xc39d=function(_0x3e0997,_0x55ff0f){_0x3e0997=_0x3e0997-0x0;var _0x464069=_0x39dc[_0x3e0997];return _0x464069;};'use strict';var server=require(_0xc39d('0x0'));var Realtime=require(_0xc39d('0x1'));var EmailChannel=require(_0xc39d('0x2'));var mailAccount=require(_0xc39d('0x3'));var setting=require(_0xc39d('0x4'));var logger=require(_0xc39d('0x5'))(_0xc39d('0x6'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise['resolve']()[_0xc39d('0x7')](mailAccount['getMailAccounts']())[_0xc39d('0x7')](realtime[_0xc39d('0x8')]())['then'](function(){email[_0xc39d('0x9')](realtime[_0xc39d('0xa')]);return realtime;});}function main(){return server[_0xc39d('0xb')](realtime,email)[_0xc39d('0x7')](function(){return initRealtime();})[_0xc39d('0x7')](function(){return setting['getSettings']();})[_0xc39d('0x7')](function(_0x210ac5){return setInterval(initRealtime,_0x210ac5[_0xc39d('0xc')]*0x3e8);})[_0xc39d('0xd')](function(_0x5f3bb2){logger[_0xc39d('0xe')](_0xc39d('0xf'),_0x5f3bb2);});}main(); \ No newline at end of file +var _0xa84d=['mailAccounts','listen','loginMailFrequency','Email\x20service\x20initialization','./server','./lib/email','../../config/logger','email','then','getMailAccounts','refresh'];(function(_0x560ca4,_0x12c750){var _0x4432af=function(_0x50a176){while(--_0x50a176){_0x560ca4['push'](_0x560ca4['shift']());}};_0x4432af(++_0x12c750);}(_0xa84d,0x1d2));var _0xda84=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa84d[_0x14add3];return _0x4a174f;};'use strict';var server=require(_0xda84('0x0'));var Realtime=require('./realtime');var EmailChannel=require(_0xda84('0x1'));var mailAccount=require('./rpc/mailAccount');var setting=require('./rpc/setting');var logger=require(_0xda84('0x2'))(_0xda84('0x3'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise['resolve']()[_0xda84('0x4')](mailAccount[_0xda84('0x5')]())['then'](realtime['initMailAccounts']())[_0xda84('0x4')](function(){email[_0xda84('0x6')](realtime[_0xda84('0x7')]);return realtime;});}function main(){return server[_0xda84('0x8')](realtime,email)['then'](function(){return initRealtime();})['then'](function(){return setting['getSettings']();})[_0xda84('0x4')](function(_0x347915){return setInterval(initRealtime,_0x347915[_0xda84('0x9')]*0x3e8);})['catch'](function(_0x528c88){logger['error'](_0xda84('0xa'),_0x528c88);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index d6e855d..bba81dc 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 _0xc423=['md5','ioredis','../../../config/logger','email','redis','localhost','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','start\x20email\x20channel','imapAccounts','smtp','prototype','emit','mailAccounts','key','active','Imap','status','isNil','stringify','refresh','service','provider','custom','hasOwnProperty','box','handleImapBox','bind','end','handleImapEnd','error','handleImapError','disabled','messageStatus','total','messages','handleImapEmail','info','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','notify','then','Mail\x20accepted\x20from\x20routing','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','sendMail','send','verifySmtp','Smtp','verify','verified','lodash','moment','bluebird'];(function(_0x2fc113,_0x45ec6e){var _0x5144ce=function(_0x47fd29){while(--_0x47fd29){_0x2fc113['push'](_0x2fc113['shift']());}};_0x5144ce(++_0x45ec6e);}(_0xc423,0x159));var _0x3c42=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0xc423[_0x2be8c2];return _0x97f531;};'use strict';var _=require(_0x3c42('0x0'));var moment=require(_0x3c42('0x1'));var BPromise=require(_0x3c42('0x2'));var md5=require(_0x3c42('0x3'));var Redis=require(_0x3c42('0x4'));var config=require('../../../config/environment');var logger=require(_0x3c42('0x5'))(_0x3c42('0x6'));config[_0x3c42('0x7')]=_['defaults'](config[_0x3c42('0x7')],{'host':_0x3c42('0x8'),'port':0x18eb});var io=require(_0x3c42('0x9'))(new Redis(config[_0x3c42('0x7')]));var EmailImap=require(_0x3c42('0xa'));var EmailSmtp=require(_0x3c42('0xb'));var mailAccount=require(_0x3c42('0xc'));var md5Accounts={};function EmailChannel(_0x23c503){logger['info'](_0x3c42('0xd'));this['mailAccounts']=_0x23c503['mailAccounts'];this[_0x3c42('0xe')]={};this[_0x3c42('0xf')]=new EmailSmtp();}EmailChannel[_0x3c42('0x10')][_0x3c42('0x11')]=function(_0xd5e28d){var _0x22da95=this[_0x3c42('0x12')][_0xd5e28d];var _0x176094={'id':_0x22da95['id'],'name':_0x22da95['name'],'key':_0x22da95[_0x3c42('0x13')],'active':_0x22da95[_0x3c42('0x14')],'Imap':{'status':_0x22da95[_0x3c42('0x15')][_0x3c42('0x16')],'messageStatus':_0x22da95[_0x3c42('0x15')]['messageStatus'],'total':_0x22da95[_0x3c42('0x15')]['total']}};if(_[_0x3c42('0x17')](md5Accounts[_0xd5e28d])){md5Accounts[_0xd5e28d]={};}var _0x25d565=md5(JSON[_0x3c42('0x18')](_0x176094));if(md5Accounts[_0xd5e28d]['md5']!==_0x25d565){md5Accounts[_0xd5e28d][_0x3c42('0x3')]=_0x25d565;io[_0x3c42('0x11')]('mailAccount:update',_0x176094);}};EmailChannel['prototype'][_0x3c42('0x19')]=function(_0x491a54){for(var _0x1893c0 in _0x491a54){if(_0x491a54['hasOwnProperty'](_0x1893c0)){if(_0x491a54[_0x1893c0][_0x3c42('0x15')]&&_0x491a54[_0x1893c0][_0x3c42('0x14')]){var _0x5ee577=_0x491a54[_0x1893c0][_0x3c42('0x15')];if(!_0x5ee577[_0x3c42('0x1a')]&&_0x491a54[_0x1893c0][_0x3c42('0x1b')]!==_0x3c42('0x1c'))_0x5ee577[_0x3c42('0x1a')]=_0x491a54[_0x1893c0][_0x3c42('0x1b')];if(!this[_0x3c42('0xe')][_0x3c42('0x1d')](_0x5ee577['id'])){this[_0x3c42('0xe')][_0x5ee577['id']]=new EmailImap(_0x5ee577,_0x491a54[_0x1893c0]['email']);this[_0x3c42('0xe')][_0x5ee577['id']]['on'](_0x3c42('0x1e'),this[_0x3c42('0x1f')][_0x3c42('0x20')](this,_0x1893c0));this['imapAccounts'][_0x5ee577['id']]['on'](_0x3c42('0x6'),this['handleImapEmail']['bind'](this,_0x1893c0));this[_0x3c42('0xe')][_0x5ee577['id']]['on'](_0x3c42('0x21'),this[_0x3c42('0x22')][_0x3c42('0x20')](this,_0x1893c0));this[_0x3c42('0xe')][_0x5ee577['id']]['on'](_0x3c42('0x23'),this[_0x3c42('0x24')][_0x3c42('0x20')](this,_0x1893c0));}}else{if(_[_0x3c42('0x17')](this[_0x3c42('0x12')][_0x1893c0][_0x3c42('0x15')])){this[_0x3c42('0x12')][_0x1893c0][_0x3c42('0x15')]={};}this['mailAccounts'][_0x1893c0][_0x3c42('0x15')][_0x3c42('0x16')]=_0x3c42('0x25');this['mailAccounts'][_0x1893c0][_0x3c42('0x15')][_0x3c42('0x26')]='';this[_0x3c42('0x11')](_0x1893c0);}}}};EmailChannel[_0x3c42('0x10')]['handleImapBox']=function(_0x32b91e,_0x282013){if(this[_0x3c42('0x12')][_0x32b91e]){this[_0x3c42('0x12')][_0x32b91e][_0x3c42('0x15')][_0x3c42('0x16')]='connected';this[_0x3c42('0x12')][_0x32b91e][_0x3c42('0x15')][_0x3c42('0x26')]=_0x282013['name'];if(_0x282013['messages']){this[_0x3c42('0x12')][_0x32b91e][_0x3c42('0x15')][_0x3c42('0x27')]=_0x282013[_0x3c42('0x28')]['total'];}return this[_0x3c42('0x11')](_0x32b91e);}};EmailChannel['prototype'][_0x3c42('0x29')]=function(_0x3c1606,_0x2559df){logger[_0x3c42('0x2a')](_0x3c42('0x2b'),_0x2559df[_0x3c42('0x2c')],_0x2559df[_0x3c42('0x2d')],_0x2559df[_0x3c42('0x2e')],_0x3c1606);if(this['mailAccounts'][_0x3c1606]){return mailAccount[_0x3c42('0x2f')](_0x3c1606,_0x2559df)[_0x3c42('0x30')](function(_0x160fb9){if(_0x160fb9){logger[_0x3c42('0x2a')](_0x3c42('0x31'));}})['catch'](function(_0x4dd38c){logger[_0x3c42('0x23')](_0x3c42('0x32'),JSON[_0x3c42('0x18')](_0x4dd38c));});}};EmailChannel[_0x3c42('0x10')]['handleImapEnd']=function(_0x2b4f49){if(this[_0x3c42('0x12')][_0x2b4f49]&&this['mailAccounts'][_0x2b4f49][_0x3c42('0x15')]){if(this['imapAccounts'][this['mailAccounts'][_0x2b4f49][_0x3c42('0x15')]['id']]){delete this['imapAccounts'][this[_0x3c42('0x12')][_0x2b4f49][_0x3c42('0x15')]['id']];}this['mailAccounts'][_0x2b4f49][_0x3c42('0x15')][_0x3c42('0x33')]=moment();this[_0x3c42('0x11')](_0x2b4f49);}};EmailChannel['prototype'][_0x3c42('0x24')]=function(_0x5bd531,_0x5f30f9){if(this[_0x3c42('0x12')][_0x5bd531]){this[_0x3c42('0x12')][_0x5bd531][_0x3c42('0x15')]['status']='error';this[_0x3c42('0x12')][_0x5bd531]['Imap'][_0x3c42('0x26')]=_0x5f30f9;return this[_0x3c42('0x11')](_0x5bd531);}};EmailChannel[_0x3c42('0x10')][_0x3c42('0x34')]=function(_0x2d568f,_0x8ff57a){return this['smtp'][_0x3c42('0x35')](_0x2d568f,_0x8ff57a);};EmailChannel[_0x3c42('0x10')][_0x3c42('0x36')]=function(_0x372906){var _0x33d251=this;if(this['mailAccounts'][_0x372906['id']]){if(_[_0x3c42('0x17')](this['mailAccounts'][_0x372906['id']][_0x3c42('0x37')])){this['mailAccounts'][_0x372906['id']]['Smtp']={};}this[_0x3c42('0x12')][_0x372906['id']][_0x3c42('0x37')][_0x3c42('0x33')]=moment();return new BPromise(function(_0x4713fe,_0x1390ea){return _0x33d251[_0x3c42('0xf')][_0x3c42('0x38')](_0x372906)['then'](function(_0x2e37f0){_0x33d251[_0x3c42('0x12')][_0x372906['id']]['Smtp'][_0x3c42('0x16')]=_0x3c42('0x39');_0x33d251[_0x3c42('0x12')][_0x372906['id']]['Smtp'][_0x3c42('0x26')]='';_0x33d251['emit'](_0x372906['id']);_0x4713fe(_0x2e37f0);})['catch'](function(_0xffda55){_0x33d251['mailAccounts'][_0x372906['id']][_0x3c42('0x37')][_0x3c42('0x16')]='error';_0x33d251['mailAccounts'][_0x372906['id']][_0x3c42('0x37')][_0x3c42('0x26')]=_0xffda55;_0x33d251[_0x3c42('0x11')](_0x372906['id']);_0x1390ea(_0xffda55);});});}return this[_0x3c42('0xf')][_0x3c42('0x38')](_0x372906);};module['exports']=EmailChannel; \ No newline at end of file +var _0xaf62=['custom','imapAccounts','box','bind','handleImapEmail','end','handleImapEnd','handleImapError','handleImapBox','connected','messageStatus','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','info','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','stringify','error','sendMail','smtp','send','Smtp','lastSync','verify','verified','exports','lodash','md5','ioredis','../../../config/logger','email','defaults','redis','localhost','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','mailAccounts','prototype','emit','name','key','active','status','Imap','total','isNil','mailAccount:update','refresh','hasOwnProperty','service','provider'];(function(_0x40dc99,_0x2718d0){var _0x490087=function(_0x3b4c9f){while(--_0x3b4c9f){_0x40dc99['push'](_0x40dc99['shift']());}};_0x490087(++_0x2718d0);}(_0xaf62,0x1e6));var _0x2af6=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0xaf62[_0x465a0c];return _0x1e202e;};'use strict';var _=require(_0x2af6('0x0'));var moment=require('moment');var BPromise=require('bluebird');var md5=require(_0x2af6('0x1'));var Redis=require(_0x2af6('0x2'));var config=require('../../../config/environment');var logger=require(_0x2af6('0x3'))(_0x2af6('0x4'));config['redis']=_[_0x2af6('0x5')](config[_0x2af6('0x6')],{'host':_0x2af6('0x7'),'port':0x18eb});var io=require(_0x2af6('0x8'))(new Redis(config['redis']));var EmailImap=require(_0x2af6('0x9'));var EmailSmtp=require(_0x2af6('0xa'));var mailAccount=require(_0x2af6('0xb'));var md5Accounts={};function EmailChannel(_0x29e5e0){logger['info']('start\x20email\x20channel');this[_0x2af6('0xc')]=_0x29e5e0['mailAccounts'];this['imapAccounts']={};this['smtp']=new EmailSmtp();}EmailChannel[_0x2af6('0xd')][_0x2af6('0xe')]=function(_0x545201){var _0x436572=this[_0x2af6('0xc')][_0x545201];var _0x54c2d2={'id':_0x436572['id'],'name':_0x436572[_0x2af6('0xf')],'key':_0x436572[_0x2af6('0x10')],'active':_0x436572[_0x2af6('0x11')],'Imap':{'status':_0x436572['Imap'][_0x2af6('0x12')],'messageStatus':_0x436572['Imap']['messageStatus'],'total':_0x436572[_0x2af6('0x13')][_0x2af6('0x14')]}};if(_[_0x2af6('0x15')](md5Accounts[_0x545201])){md5Accounts[_0x545201]={};}var _0x411292=md5(JSON['stringify'](_0x54c2d2));if(md5Accounts[_0x545201][_0x2af6('0x1')]!==_0x411292){md5Accounts[_0x545201][_0x2af6('0x1')]=_0x411292;io[_0x2af6('0xe')](_0x2af6('0x16'),_0x54c2d2);}};EmailChannel[_0x2af6('0xd')][_0x2af6('0x17')]=function(_0x2ce2a6){for(var _0xf1687c in _0x2ce2a6){if(_0x2ce2a6[_0x2af6('0x18')](_0xf1687c)){if(_0x2ce2a6[_0xf1687c][_0x2af6('0x13')]&&_0x2ce2a6[_0xf1687c]['active']){var _0x232649=_0x2ce2a6[_0xf1687c][_0x2af6('0x13')];if(!_0x232649[_0x2af6('0x19')]&&_0x2ce2a6[_0xf1687c][_0x2af6('0x1a')]!==_0x2af6('0x1b'))_0x232649[_0x2af6('0x19')]=_0x2ce2a6[_0xf1687c][_0x2af6('0x1a')];if(!this[_0x2af6('0x1c')]['hasOwnProperty'](_0x232649['id'])){this[_0x2af6('0x1c')][_0x232649['id']]=new EmailImap(_0x232649,_0x2ce2a6[_0xf1687c][_0x2af6('0x4')]);this[_0x2af6('0x1c')][_0x232649['id']]['on'](_0x2af6('0x1d'),this['handleImapBox'][_0x2af6('0x1e')](this,_0xf1687c));this[_0x2af6('0x1c')][_0x232649['id']]['on'](_0x2af6('0x4'),this[_0x2af6('0x1f')][_0x2af6('0x1e')](this,_0xf1687c));this[_0x2af6('0x1c')][_0x232649['id']]['on'](_0x2af6('0x20'),this[_0x2af6('0x21')][_0x2af6('0x1e')](this,_0xf1687c));this[_0x2af6('0x1c')][_0x232649['id']]['on']('error',this[_0x2af6('0x22')][_0x2af6('0x1e')](this,_0xf1687c));}}else{if(_['isNil'](this[_0x2af6('0xc')][_0xf1687c]['Imap'])){this['mailAccounts'][_0xf1687c][_0x2af6('0x13')]={};}this[_0x2af6('0xc')][_0xf1687c][_0x2af6('0x13')][_0x2af6('0x12')]='disabled';this['mailAccounts'][_0xf1687c]['Imap']['messageStatus']='';this[_0x2af6('0xe')](_0xf1687c);}}}};EmailChannel[_0x2af6('0xd')][_0x2af6('0x23')]=function(_0x51ac90,_0x16a33b){if(this[_0x2af6('0xc')][_0x51ac90]){this[_0x2af6('0xc')][_0x51ac90][_0x2af6('0x13')][_0x2af6('0x12')]=_0x2af6('0x24');this[_0x2af6('0xc')][_0x51ac90][_0x2af6('0x13')][_0x2af6('0x25')]=_0x16a33b[_0x2af6('0xf')];if(_0x16a33b['messages']){this[_0x2af6('0xc')][_0x51ac90][_0x2af6('0x13')][_0x2af6('0x14')]=_0x16a33b[_0x2af6('0x26')][_0x2af6('0x14')];}return this[_0x2af6('0xe')](_0x51ac90);}};EmailChannel[_0x2af6('0xd')]['handleImapEmail']=function(_0x55f763,_0x86781c){logger['info'](_0x2af6('0x27'),_0x86781c[_0x2af6('0x28')],_0x86781c[_0x2af6('0x29')],_0x86781c[_0x2af6('0x2a')],_0x55f763);if(this['mailAccounts'][_0x55f763]){return mailAccount['notify'](_0x55f763,_0x86781c)['then'](function(_0x42e6dd){if(_0x42e6dd){logger[_0x2af6('0x2b')](_0x2af6('0x2c'));}})[_0x2af6('0x2d')](function(_0x10a986){logger['error'](_0x2af6('0x2e'),JSON[_0x2af6('0x2f')](_0x10a986));});}};EmailChannel[_0x2af6('0xd')][_0x2af6('0x21')]=function(_0x24f651){if(this['mailAccounts'][_0x24f651]&&this[_0x2af6('0xc')][_0x24f651][_0x2af6('0x13')]){if(this[_0x2af6('0x1c')][this[_0x2af6('0xc')][_0x24f651]['Imap']['id']]){delete this[_0x2af6('0x1c')][this['mailAccounts'][_0x24f651][_0x2af6('0x13')]['id']];}this[_0x2af6('0xc')][_0x24f651][_0x2af6('0x13')]['lastSync']=moment();this[_0x2af6('0xe')](_0x24f651);}};EmailChannel[_0x2af6('0xd')][_0x2af6('0x22')]=function(_0x283c02,_0x5a9a2a){if(this[_0x2af6('0xc')][_0x283c02]){this[_0x2af6('0xc')][_0x283c02]['Imap'][_0x2af6('0x12')]=_0x2af6('0x30');this[_0x2af6('0xc')][_0x283c02]['Imap'][_0x2af6('0x25')]=_0x5a9a2a;return this[_0x2af6('0xe')](_0x283c02);}};EmailChannel[_0x2af6('0xd')][_0x2af6('0x31')]=function(_0x168382,_0x533963){return this[_0x2af6('0x32')][_0x2af6('0x33')](_0x168382,_0x533963);};EmailChannel[_0x2af6('0xd')]['verifySmtp']=function(_0x1e9342){var _0x4d8fa4=this;if(this[_0x2af6('0xc')][_0x1e9342['id']]){if(_[_0x2af6('0x15')](this[_0x2af6('0xc')][_0x1e9342['id']][_0x2af6('0x34')])){this[_0x2af6('0xc')][_0x1e9342['id']]['Smtp']={};}this[_0x2af6('0xc')][_0x1e9342['id']]['Smtp'][_0x2af6('0x35')]=moment();return new BPromise(function(_0x269701,_0x4e3eca){return _0x4d8fa4[_0x2af6('0x32')][_0x2af6('0x36')](_0x1e9342)['then'](function(_0x421eff){_0x4d8fa4['mailAccounts'][_0x1e9342['id']][_0x2af6('0x34')][_0x2af6('0x12')]=_0x2af6('0x37');_0x4d8fa4[_0x2af6('0xc')][_0x1e9342['id']][_0x2af6('0x34')][_0x2af6('0x25')]='';_0x4d8fa4[_0x2af6('0xe')](_0x1e9342['id']);_0x269701(_0x421eff);})[_0x2af6('0x2d')](function(_0x3774aa){_0x4d8fa4[_0x2af6('0xc')][_0x1e9342['id']][_0x2af6('0x34')]['status']='error';_0x4d8fa4[_0x2af6('0xc')][_0x1e9342['id']][_0x2af6('0x34')][_0x2af6('0x25')]=_0x3774aa;_0x4d8fa4[_0x2af6('0xe')](_0x1e9342['id']);_0x4e3eca(_0x3774aa);});});}return this[_0x2af6('0x32')]['verify'](_0x1e9342);};module[_0x2af6('0x38')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 7e1b0a8..3a25774 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 _0x6746=['handleFetchError','closeBox','handleFetchMessage','body','handleMessageBody','attributes','handleMessageEnd','handleSimpleParser','handleMessageAttributes','parser','emit','email','handleEnd','stringify','textCode','hasOwnProperty','upperFirst','exports','util','imap','mailparser','Iconv','EventEmitter','mailbox','getAccount','account','once','ready','bind','end','error','connect','inherits','prototype','connTimeout','authTimeout','service','user','xoauth2','CloudProvider','data5','password','anonymous@xcally.com','host','port','tls','required','handleOpenBox','handleError','box','readUnseen','handleCloseBox','search','UNSEEN','handleReadUnseen','length','message'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x6746,0x1a1));var _0x6674=function(_0x69752e,_0x2579f6){_0x69752e=_0x69752e-0x0;var _0x506a36=_0x6746[_0x69752e];return _0x506a36;};'use strict';var _=require('lodash');var util=require(_0x6674('0x0'));var Imap=require(_0x6674('0x1'));var simpleParser=require(_0x6674('0x2'))['simpleParser'];var Iconv=require('iconv')[_0x6674('0x3')];var EventEmitter=require('events')[_0x6674('0x4')];var utils=require('./utils');var logger=require('../../../config/logger')('email');function EmailImap(_0x53536f,_0x175cdf){this['mailbox']=_0x53536f[_0x6674('0x5')];this['account']=this[_0x6674('0x6')](_0x53536f,_0x175cdf);this[_0x6674('0x1')]=new Imap(this[_0x6674('0x7')]);this[_0x6674('0x1')][_0x6674('0x8')](_0x6674('0x9'),this['handleReady'][_0x6674('0xa')](this));this[_0x6674('0x1')][_0x6674('0x8')](_0x6674('0xb'),this['handleEnd'][_0x6674('0xa')](this));this[_0x6674('0x1')]['on'](_0x6674('0xc'),this['handleError'][_0x6674('0xa')](this));this[_0x6674('0x1')][_0x6674('0xd')]();}util[_0x6674('0xe')](EmailImap,EventEmitter);EmailImap[_0x6674('0xf')][_0x6674('0x6')]=function(_0x197eab,_0x18a251){var _0x4770af={'connTimeout':_0x197eab['connTimeout']?_0x197eab[_0x6674('0x10')]*0x3e8:0x2710,'authTimeout':_0x197eab[_0x6674('0x11')]?_0x197eab[_0x6674('0x11')]*0x3e8:0x1388};if(_0x197eab[_0x6674('0x12')]){_0x4770af[_0x6674('0x13')]=_0x197eab['user'];if(_0x197eab['modernAuthentication']){_0x4770af[_0x6674('0x14')]=utils['generateXOAuth2Token'](_0x197eab[_0x6674('0x15')][_0x6674('0x16')],_0x197eab[_0x6674('0x13')]);}else{_0x4770af[_0x6674('0x17')]=_0x197eab[_0x6674('0x17')];}}else{if(_0x197eab['authentication']){_0x4770af[_0x6674('0x13')]=_0x197eab[_0x6674('0x13')];_0x4770af[_0x6674('0x17')]=_0x197eab[_0x6674('0x17')];}}_0x4770af['email']=_0x18a251||_0x197eab['user']||_0x6674('0x18');_0x4770af[_0x6674('0x19')]=_0x197eab[_0x6674('0x19')];_0x4770af['port']=_0x197eab[_0x6674('0x1a')]||0x3e1;if(_0x197eab[_0x6674('0x1b')]){_0x4770af['tls']=!![];}else{_0x4770af[_0x6674('0x1b')]=![];_0x4770af['autotls']=_0x6674('0x1c');}return _0x4770af;};EmailImap[_0x6674('0xf')]['handleReady']=function(){this[_0x6674('0x1')]['openBox'](this[_0x6674('0x5')],![],this[_0x6674('0x1d')][_0x6674('0xa')](this));};EmailImap[_0x6674('0xf')][_0x6674('0x1d')]=function(_0x548379,_0x2ffca3){if(_0x548379){this[_0x6674('0x1e')](_0x548379,!![]);}else{this['emit'](_0x6674('0x1f'),_0x2ffca3);this[_0x6674('0x20')]();}};EmailImap['prototype'][_0x6674('0x21')]=function(_0x49f1e4){if(_0x49f1e4){this[_0x6674('0x1e')](_0x49f1e4,!![]);}else{this[_0x6674('0x1')][_0x6674('0xb')]();}};EmailImap[_0x6674('0xf')][_0x6674('0x20')]=function(){this['imap'][_0x6674('0x22')]([_0x6674('0x23')],this['handleReadUnseen']['bind'](this));};EmailImap['prototype'][_0x6674('0x24')]=function(_0x2f0a25,_0x4e5dd9){if(_0x2f0a25){this[_0x6674('0x1e')](_0x2f0a25,!![]);}else{if(_0x4e5dd9[_0x6674('0x25')]){try{var _0x38746a=this[_0x6674('0x1')]['fetch'](_0x4e5dd9,{'bodies':'','markSeen':!![]});_0x38746a['on'](_0x6674('0x26'),this['handleFetchMessage'][_0x6674('0xa')](this));_0x38746a[_0x6674('0x8')](_0x6674('0xc'),this[_0x6674('0x27')]['bind'](this));_0x38746a[_0x6674('0x8')](_0x6674('0xb'),this['handleFetchEnd'][_0x6674('0xa')](this));}catch(_0x2bc2fe){logger[_0x6674('0xc')](_0x2bc2fe);}}else{this[_0x6674('0x1')][_0x6674('0x28')](!![],this['handleCloseBox'][_0x6674('0xa')](this));}}};EmailImap[_0x6674('0xf')][_0x6674('0x29')]=function(_0x342c7c){_0x342c7c['on'](_0x6674('0x2a'),this[_0x6674('0x2b')][_0x6674('0xa')](this));_0x342c7c[_0x6674('0x8')](_0x6674('0x2c'),this['handleMessageAttributes'][_0x6674('0xa')](this));_0x342c7c['once'](_0x6674('0xb'),this[_0x6674('0x2d')][_0x6674('0xa')](this));};EmailImap[_0x6674('0xf')]['handleMessageBody']=function(_0x5585a4){simpleParser(_0x5585a4,{'Iconv':Iconv},this[_0x6674('0x2e')][_0x6674('0xa')](this));};EmailImap['prototype'][_0x6674('0x2f')]=function(){};EmailImap['prototype'][_0x6674('0x2d')]=function(){};EmailImap[_0x6674('0xf')][_0x6674('0x2e')]=function(_0x3812ce,_0xd3afeb){if(_0x3812ce){logger[_0x6674('0xc')](_0x3812ce);}else{var _0xb4b529=this;utils[_0x6674('0x30')](this['account'],_0xd3afeb,function(_0x3d0520){_0xb4b529[_0x6674('0x31')](_0x6674('0x32'),_0x3d0520);});}};EmailImap[_0x6674('0xf')]['handleFetchEnd']=function(){this[_0x6674('0x1')][_0x6674('0x28')](!![],this[_0x6674('0x21')][_0x6674('0xa')](this));};EmailImap[_0x6674('0xf')][_0x6674('0x27')]=function(_0x3ce858){this[_0x6674('0x1e')](_0x3ce858);this[_0x6674('0x1')]['closeBox'](!![],this[_0x6674('0x21')][_0x6674('0xa')](this));};EmailImap['prototype'][_0x6674('0x33')]=function(){this[_0x6674('0x31')](_0x6674('0xb'));};EmailImap[_0x6674('0xf')][_0x6674('0x1e')]=function(_0x11fdd9,_0x2e281a){logger[_0x6674('0xc')](_0x6674('0x1e'),this[_0x6674('0x7')][_0x6674('0x32')],JSON[_0x6674('0x34')](_0x11fdd9));var _0x116a99='';if(_0x11fdd9){if(_0x11fdd9[_0x6674('0x35')]){_0x116a99=_0x11fdd9['textCode'];}else{for(var _0x5c218d in _0x11fdd9){if(_0x11fdd9[_0x6674('0x36')](_0x5c218d)){_0x116a99+=_[_0x6674('0x37')](_0x5c218d)+':\x20'+_0x11fdd9[_0x5c218d]+'\x0a';}}}}if(_0x2e281a){this['imap'][_0x6674('0xb')]();}else{this[_0x6674('0x31')]('error',_0x116a99);this[_0x6674('0x31')]('end');}};module[_0x6674('0x38')]=EmailImap; \ No newline at end of file +var _0x4e48=['EventEmitter','./utils','../../../config/logger','email','mailbox','account','once','ready','handleReady','end','handleEnd','error','handleError','bind','connect','inherits','prototype','connTimeout','authTimeout','service','user','xoauth2','generateXOAuth2Token','CloudProvider','data5','password','authentication','host','port','tls','autotls','required','handleOpenBox','emit','box','readUnseen','handleCloseBox','search','UNSEEN','handleReadUnseen','fetch','message','handleFetchError','handleFetchEnd','closeBox','handleFetchMessage','body','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','textCode','hasOwnProperty','upperFirst','imap','mailparser','iconv'];(function(_0x46d041,_0x4b80db){var _0x294f8a=function(_0x3ba9f4){while(--_0x3ba9f4){_0x46d041['push'](_0x46d041['shift']());}};_0x294f8a(++_0x4b80db);}(_0x4e48,0x193));var _0x84e4=function(_0x44c24a,_0x239f71){_0x44c24a=_0x44c24a-0x0;var _0x10f256=_0x4e48[_0x44c24a];return _0x10f256;};'use strict';var _=require('lodash');var util=require('util');var Imap=require(_0x84e4('0x0'));var simpleParser=require(_0x84e4('0x1'))['simpleParser'];var Iconv=require(_0x84e4('0x2'))['Iconv'];var EventEmitter=require('events')[_0x84e4('0x3')];var utils=require(_0x84e4('0x4'));var logger=require(_0x84e4('0x5'))(_0x84e4('0x6'));function EmailImap(_0x2b895e,_0x181874){this[_0x84e4('0x7')]=_0x2b895e[_0x84e4('0x7')];this[_0x84e4('0x8')]=this['getAccount'](_0x2b895e,_0x181874);this[_0x84e4('0x0')]=new Imap(this[_0x84e4('0x8')]);this[_0x84e4('0x0')][_0x84e4('0x9')](_0x84e4('0xa'),this[_0x84e4('0xb')]['bind'](this));this[_0x84e4('0x0')][_0x84e4('0x9')](_0x84e4('0xc'),this[_0x84e4('0xd')]['bind'](this));this['imap']['on'](_0x84e4('0xe'),this[_0x84e4('0xf')][_0x84e4('0x10')](this));this[_0x84e4('0x0')][_0x84e4('0x11')]();}util[_0x84e4('0x12')](EmailImap,EventEmitter);EmailImap[_0x84e4('0x13')]['getAccount']=function(_0x4187b5,_0x1aa9e0){var _0xc70b3f={'connTimeout':_0x4187b5[_0x84e4('0x14')]?_0x4187b5[_0x84e4('0x14')]*0x3e8:0x2710,'authTimeout':_0x4187b5['authTimeout']?_0x4187b5[_0x84e4('0x15')]*0x3e8:0x1388};if(_0x4187b5[_0x84e4('0x16')]){_0xc70b3f[_0x84e4('0x17')]=_0x4187b5['user'];if(_0x4187b5['modernAuthentication']){_0xc70b3f[_0x84e4('0x18')]=utils[_0x84e4('0x19')](_0x4187b5[_0x84e4('0x1a')][_0x84e4('0x1b')],_0x4187b5[_0x84e4('0x17')]);}else{_0xc70b3f[_0x84e4('0x1c')]=_0x4187b5[_0x84e4('0x1c')];}}else{if(_0x4187b5[_0x84e4('0x1d')]){_0xc70b3f['user']=_0x4187b5['user'];_0xc70b3f[_0x84e4('0x1c')]=_0x4187b5[_0x84e4('0x1c')];}}_0xc70b3f['email']=_0x1aa9e0||_0x4187b5['user']||'anonymous@xcally.com';_0xc70b3f[_0x84e4('0x1e')]=_0x4187b5[_0x84e4('0x1e')];_0xc70b3f['port']=_0x4187b5[_0x84e4('0x1f')]||0x3e1;if(_0x4187b5['tls']){_0xc70b3f[_0x84e4('0x20')]=!![];}else{_0xc70b3f[_0x84e4('0x20')]=![];_0xc70b3f[_0x84e4('0x21')]=_0x84e4('0x22');}return _0xc70b3f;};EmailImap[_0x84e4('0x13')]['handleReady']=function(){this[_0x84e4('0x0')]['openBox'](this['mailbox'],![],this[_0x84e4('0x23')]['bind'](this));};EmailImap[_0x84e4('0x13')][_0x84e4('0x23')]=function(_0x47ae9e,_0x422e7e){if(_0x47ae9e){this[_0x84e4('0xf')](_0x47ae9e,!![]);}else{this[_0x84e4('0x24')](_0x84e4('0x25'),_0x422e7e);this[_0x84e4('0x26')]();}};EmailImap[_0x84e4('0x13')][_0x84e4('0x27')]=function(_0x1d609c){if(_0x1d609c){this[_0x84e4('0xf')](_0x1d609c,!![]);}else{this[_0x84e4('0x0')][_0x84e4('0xc')]();}};EmailImap['prototype'][_0x84e4('0x26')]=function(){this[_0x84e4('0x0')][_0x84e4('0x28')]([_0x84e4('0x29')],this[_0x84e4('0x2a')][_0x84e4('0x10')](this));};EmailImap[_0x84e4('0x13')][_0x84e4('0x2a')]=function(_0x3b72f1,_0x1634a6){if(_0x3b72f1){this[_0x84e4('0xf')](_0x3b72f1,!![]);}else{if(_0x1634a6['length']){try{var _0x42eb7c=this[_0x84e4('0x0')][_0x84e4('0x2b')](_0x1634a6,{'bodies':'','markSeen':!![]});_0x42eb7c['on'](_0x84e4('0x2c'),this['handleFetchMessage']['bind'](this));_0x42eb7c[_0x84e4('0x9')]('error',this[_0x84e4('0x2d')]['bind'](this));_0x42eb7c['once'](_0x84e4('0xc'),this[_0x84e4('0x2e')][_0x84e4('0x10')](this));}catch(_0x1aea7f){logger['error'](_0x1aea7f);}}else{this[_0x84e4('0x0')][_0x84e4('0x2f')](!![],this[_0x84e4('0x27')][_0x84e4('0x10')](this));}}};EmailImap['prototype'][_0x84e4('0x30')]=function(_0x3eadcf){_0x3eadcf['on'](_0x84e4('0x31'),this['handleMessageBody'][_0x84e4('0x10')](this));_0x3eadcf[_0x84e4('0x9')](_0x84e4('0x32'),this[_0x84e4('0x33')][_0x84e4('0x10')](this));_0x3eadcf[_0x84e4('0x9')](_0x84e4('0xc'),this[_0x84e4('0x34')][_0x84e4('0x10')](this));};EmailImap[_0x84e4('0x13')]['handleMessageBody']=function(_0x3381ba){simpleParser(_0x3381ba,{'Iconv':Iconv},this[_0x84e4('0x35')][_0x84e4('0x10')](this));};EmailImap[_0x84e4('0x13')][_0x84e4('0x33')]=function(){};EmailImap[_0x84e4('0x13')][_0x84e4('0x34')]=function(){};EmailImap[_0x84e4('0x13')][_0x84e4('0x35')]=function(_0xf751f7,_0x1ae91d){if(_0xf751f7){logger[_0x84e4('0xe')](_0xf751f7);}else{var _0x334391=this;utils[_0x84e4('0x36')](this[_0x84e4('0x8')],_0x1ae91d,function(_0x7da2c8){_0x334391['emit'](_0x84e4('0x6'),_0x7da2c8);});}};EmailImap[_0x84e4('0x13')][_0x84e4('0x2e')]=function(){this[_0x84e4('0x0')][_0x84e4('0x2f')](!![],this[_0x84e4('0x27')]['bind'](this));};EmailImap['prototype']['handleFetchError']=function(_0x309b0d){this[_0x84e4('0xf')](_0x309b0d);this[_0x84e4('0x0')]['closeBox'](!![],this[_0x84e4('0x27')]['bind'](this));};EmailImap[_0x84e4('0x13')][_0x84e4('0xd')]=function(){this[_0x84e4('0x24')](_0x84e4('0xc'));};EmailImap[_0x84e4('0x13')]['handleError']=function(_0xe64f1e,_0x50c703){logger[_0x84e4('0xe')](_0x84e4('0xf'),this[_0x84e4('0x8')]['email'],JSON['stringify'](_0xe64f1e));var _0x84cabd='';if(_0xe64f1e){if(_0xe64f1e[_0x84e4('0x37')]){_0x84cabd=_0xe64f1e['textCode'];}else{for(var _0x19b2b0 in _0xe64f1e){if(_0xe64f1e[_0x84e4('0x38')](_0x19b2b0)){_0x84cabd+=_[_0x84e4('0x39')](_0x19b2b0)+':\x20'+_0xe64f1e[_0x19b2b0]+'\x0a';}}}}if(_0x50c703){this[_0x84e4('0x0')][_0x84e4('0xc')]();}else{this[_0x84e4('0x24')](_0x84e4('0xe'),_0x84cabd);this[_0x84e4('0x24')]('end');}};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 b3454d2..0288b8a 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 _0xbfd7=['nodemailer-plugin-inline-base64','send','createTransport','compile','sendMail','prototype','verify','toString','Not\x20verifired','exports','nodemailer'];(function(_0x5586ac,_0x1e0bf5){var _0x475877=function(_0x8ac583){while(--_0x8ac583){_0x5586ac['push'](_0x5586ac['shift']());}};_0x475877(++_0x1e0bf5);}(_0xbfd7,0x13e));var _0x7bfd=function(_0x153014,_0x45a31b){_0x153014=_0x153014-0x0;var _0x101ed1=_0xbfd7[_0x153014];return _0x101ed1;};'use strict';var nodemailer=require(_0x7bfd('0x0'));var inlineBase64=require(_0x7bfd('0x1'));function EmailSmtp(){}EmailSmtp['prototype'][_0x7bfd('0x2')]=function(_0x29fdfe,_0x25ffc8){return new Promise(function(_0x2f8bf4,_0x2e33da){var _0x56587e=nodemailer[_0x7bfd('0x3')](_0x29fdfe);_0x56587e['use'](_0x7bfd('0x4'),inlineBase64());_0x56587e[_0x7bfd('0x5')](_0x25ffc8,function(_0x57cd2c,_0x1637c1){if(_0x57cd2c){_0x2e33da(_0x57cd2c['toString']());}else{_0x2f8bf4(_0x1637c1);}});});};EmailSmtp[_0x7bfd('0x6')][_0x7bfd('0x7')]=function(_0x2f49ac){return new Promise(function(_0xaacbd0,_0x1b4b66){var _0x348193=nodemailer['createTransport'](_0x2f49ac);_0x348193[_0x7bfd('0x7')](function(_0x3a6b0d,_0xf712ef){if(_0x3a6b0d){_0x1b4b66(_0x3a6b0d[_0x7bfd('0x8')]());}else{if(_0xf712ef){_0xaacbd0(_0xf712ef);}else{_0x1b4b66(_0x7bfd('0x9'));}}});});};module[_0x7bfd('0xa')]=EmailSmtp; \ No newline at end of file +var _0xed0c=['nodemailer-plugin-inline-base64','prototype','send','createTransport','toString','verify','exports','nodemailer'];(function(_0x52c30a,_0x40107d){var _0x33a05b=function(_0x404d55){while(--_0x404d55){_0x52c30a['push'](_0x52c30a['shift']());}};_0x33a05b(++_0x40107d);}(_0xed0c,0x87));var _0xced0=function(_0x3e0f94,_0x21dc2d){_0x3e0f94=_0x3e0f94-0x0;var _0x17c6ad=_0xed0c[_0x3e0f94];return _0x17c6ad;};'use strict';var nodemailer=require(_0xced0('0x0'));var inlineBase64=require(_0xced0('0x1'));function EmailSmtp(){}EmailSmtp[_0xced0('0x2')][_0xced0('0x3')]=function(_0x160922,_0x4faf92){return new Promise(function(_0x4230e7,_0x2e5bd1){var _0x278f39=nodemailer[_0xced0('0x4')](_0x160922);_0x278f39['use']('compile',inlineBase64());_0x278f39['sendMail'](_0x4faf92,function(_0x19c56e,_0x19689b){if(_0x19c56e){_0x2e5bd1(_0x19c56e[_0xced0('0x5')]());}else{_0x4230e7(_0x19689b);}});});};EmailSmtp[_0xced0('0x2')][_0xced0('0x6')]=function(_0x5c0903){return new Promise(function(_0x5a9820,_0x10a26d){var _0x2ab862=nodemailer['createTransport'](_0x5c0903);_0x2ab862['verify'](function(_0x123b2c,_0x8eb288){if(_0x123b2c){_0x10a26d(_0x123b2c[_0xced0('0x5')]());}else{if(_0x8eb288){_0x5a9820(_0x8eb288);}else{_0x10a26d('Not\x20verifired');}}});});};module[_0xced0('0x7')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index d36b703..b3b469a 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 _0x7f86=['attach','attachment','attachment-','format','now','join','root','server/files/attachments/','content','headerLines','Auto-Submitted:\x20auto-replied','X-Auto-Response-Suppress:\x20All','Precedence:\x20auto_reply','line','isAutoreply','from','subject','inReplyTo','date','YYYY-MM-DD\x20HH:mm:ss','filter','application/ms-tnef','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','messageId','parseBuffer','first','BodyHTML','

Empty\x20message

','Attachments','Title','user=','auth=Bearer\x20','utf-8','toString','base64','lodash','moment','path','util','node-tnef','email','../../../config/environment','head','value','address','anonymous','generate','@xcally.com','name','substring','indexOf','split','length','slice','Anonymous','pop','isEmpty','html','test','replace','includes','\x20[Attachment:\x20','body','textAsHtml','0x1?_0x1f9798[_0x67f8('0x12')](0x0,-0x1)['join']('\x20'):_0x518442['name'];}return _0x67f8('0x13');}function getLastName(_0x2ac454){var _0x147bde=_[_0x67f8('0x7')](_0x2ac454[_0x67f8('0x8')]);if(_0x147bde&&_0x147bde[_0x67f8('0xd')]){var _0x223ce5=_0x147bde[_0x67f8('0xd')][_0x67f8('0x10')](/\s+/);return _0x223ce5[_0x67f8('0x11')]>0x1?_0x223ce5[_0x67f8('0x14')]():'';}return'';}function getMails(_0x1f49d7,_0xa59b2e){var _0x430acb='';for(var _0x17d47f=0x0;_0x17d47f<_0xa59b2e[_0x67f8('0x8')][_0x67f8('0x11')];_0x17d47f+=0x1){if(_0xa59b2e[_0x67f8('0x8')][_0x17d47f][_0x67f8('0x9')]!==_0x1f49d7){if(!_[_0x67f8('0x15')](_0x430acb)){_0x430acb+=',';}_0x430acb+=_0xa59b2e[_0x67f8('0x8')][_0x17d47f][_0x67f8('0xd')]||_0xa59b2e[_0x67f8('0x8')][_0x17d47f][_0x67f8('0x9')]||'';_0x430acb+='\x20<';_0x430acb+=_0xa59b2e['value'][_0x17d47f][_0x67f8('0x9')]?_0xa59b2e[_0x67f8('0x8')][_0x17d47f][_0x67f8('0x9')]:_0x67f8('0xa')+random[_0x67f8('0xb')](0x6)+_0x67f8('0xc');_0x430acb+='>';}}return _0x430acb;}function parseEmail(_0x2237d8,_0x4c7b50,_0x49c2a0){if(_0x4c7b50[_0x67f8('0x16')]){var _0x3e50e3=/)<[^<]*)*<\/script>/gi;while(_0x3e50e3[_0x67f8('0x17')](_0x4c7b50[_0x67f8('0x16')])){_0x4c7b50[_0x67f8('0x16')]=_0x4c7b50[_0x67f8('0x16')][_0x67f8('0x18')](_0x3e50e3,'');}if(_0x4c7b50[_0x67f8('0x16')][_0x67f8('0x19')](_0x67f8('0x1a'))){var _0x909095=[];_0x4c7b50[_0x67f8('0x1b')][_0x67f8('0x1c')](_0x4b469c=>{_0x909095[_0x67f8('0x1d')](_0x4b469c[_0x67f8('0x1e')]);});var _0x56e12e=/]+>/g;var _0x13b1bf=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x5d7c74=_0x4c7b50[_0x67f8('0x16')][_0x67f8('0x18')](_0x13b1bf,'_SRC');var _0x4939d9=_0x5d7c74['replace'](_0x56e12e,'_IMG');for(let _0x8bb929=0x0;_0x8bb929<_0x909095[_0x67f8('0x11')];_0x8bb929++){var _0x11f472=_0x4939d9[_0x67f8('0x18')]('_IMG',_0x67f8('0x1f')+_0x909095[_0x8bb929]+'\x20]');_0x4939d9=_0x11f472;}_0x4c7b50[_0x67f8('0x16')]=_0x4939d9;}_0x49c2a0[_0x67f8('0x20')]=_0x4c7b50[_0x67f8('0x16')];}else{_0x49c2a0[_0x67f8('0x20')]=_0x4c7b50[_0x67f8('0x21')];}if(_0x49c2a0['body']){_0x49c2a0[_0x67f8('0x20')]=_0x49c2a0[_0x67f8('0x20')][_0x67f8('0x18')](/0x0){var _0x33063b=[_0x67f8('0x30'),_0x67f8('0x31'),_0x67f8('0x32')];for(var _0x5ba8a9=0x0;_0x5ba8a9<_0x4c7b50[_0x67f8('0x2f')][_0x67f8('0x11')];_0x5ba8a9++){var _0x362b1a=_[_0x67f8('0xf')](_0x33063b,_0x4c7b50[_0x67f8('0x2f')][_0x5ba8a9][_0x67f8('0x33')]);if(_0x362b1a>=0x0){_0x49c2a0[_0x67f8('0x34')]=!![];}}}return _0x49c2a0;}exports['parser']=function(_0x1524eb,_0x2ed3db,_0x5e7759){var _0x46f665={'from':getAddress(_0x2ed3db['from']),'firstName':getFirstName(_0x2ed3db[_0x67f8('0x35')]),'lastName':getLastName(_0x2ed3db['from']),'mapKey':_0x67f8('0x5'),'message':{'from':getMails(_0x1524eb[_0x67f8('0x5')],_0x2ed3db[_0x67f8('0x35')]),'to':_0x1524eb[_0x67f8('0x5')],'cc':'','subject':_0x2ed3db[_0x67f8('0x36')]||'','messageId':_0x2ed3db['messageId'],'inReplyTo':_0x2ed3db[_0x67f8('0x37')],'sentAt':moment(_0x2ed3db[_0x67f8('0x38')])['format'](_0x67f8('0x39')),'attach':![],'attachments':[]}};if(!_0x2ed3db[_0x67f8('0x16')]&&!_0x2ed3db[_0x67f8('0x21')]){var _0xdf7aa2=_[_0x67f8('0x3a')](_0x2ed3db[_0x67f8('0x1b')],{'contentType':_0x67f8('0x3b')});if(_0xdf7aa2[_0x67f8('0x11')]){logger['info'](util[_0x67f8('0x29')](_0x67f8('0x3c'),_0x2ed3db[_0x67f8('0x3d')]));tnef[_0x67f8('0x3e')](_[_0x67f8('0x3f')](_0xdf7aa2)[_0x67f8('0x2e')],function(_0x598c69,_0x2dd3e4){if(_0x2dd3e4){_0x2ed3db['html']=_0x2dd3e4[_0x67f8('0x40')]||_0x67f8('0x41');if(_0x2dd3e4[_0x67f8('0x42')]){for(var _0x12e663=0x0;_0x12e663<_0x2dd3e4[_0x67f8('0x42')][_0x67f8('0x11')];_0x12e663++){var _0x2645ac=_0x2dd3e4[_0x67f8('0x42')][_0x12e663];_0x46f665['message']['attachments']['push']({'filename':_0x2645ac[_0x67f8('0x43')],'content':Buffer[_0x67f8('0x35')](_0x2645ac['Data'])});}}}_0x5e7759(parseEmail(_0x1524eb,_0x2ed3db,_0x46f665));});}else{_0x2ed3db['html']=_0x67f8('0x41');_0x5e7759(parseEmail(_0x1524eb,_0x2ed3db,_0x46f665));}}else{_0x5e7759(parseEmail(_0x1524eb,_0x2ed3db,_0x46f665));}};exports['generateXOAuth2Token']=function(_0x2cc54f,_0x40623c){var _0xd717c4=[_0x67f8('0x44')+(_0x40623c||''),_0x67f8('0x45')+_0x2cc54f,'',''];return Buffer[_0x67f8('0x35')](_0xd717c4[_0x67f8('0x2b')](''),_0x67f8('0x46'))[_0x67f8('0x47')](_0x67f8('0x48'));}; \ No newline at end of file +var _0x7999=['parseBuffer','first','BodyHTML','Attachments','Title','Data','

Empty\x20message

','generateXOAuth2Token','user=','auth=Bearer\x20','utf-8','lodash','moment','randomstring','path','util','node-tnef','../../../config/logger','email','../../../config/environment','head','address','anonymous','@xcally.com','value','substring','name','indexOf','split','length','slice','join','Anonymous','isEmpty','generate','html','test','replace','includes','attachments','forEach','push','filename','_SRC','_IMG','\x20]','body','0x1?_0x423e91[_0x9799('0x13')](0x0,-0x1)[_0x9799('0x14')]('\x20'):_0x5f0d25['name'];}return _0x9799('0x15');}function getLastName(_0x1fad28){var _0x25b584=_[_0x9799('0x9')](_0x1fad28[_0x9799('0xd')]);if(_0x25b584&&_0x25b584['name']){var _0x1aa76e=_0x25b584[_0x9799('0xf')]['split'](/\s+/);return _0x1aa76e[_0x9799('0x12')]>0x1?_0x1aa76e['pop']():'';}return'';}function getMails(_0x175563,_0x5ebaac){var _0x2e308b='';for(var _0x863cbe=0x0;_0x863cbe<_0x5ebaac[_0x9799('0xd')]['length'];_0x863cbe+=0x1){if(_0x5ebaac[_0x9799('0xd')][_0x863cbe][_0x9799('0xa')]!==_0x175563){if(!_[_0x9799('0x16')](_0x2e308b)){_0x2e308b+=',';}_0x2e308b+=_0x5ebaac[_0x9799('0xd')][_0x863cbe][_0x9799('0xf')]||_0x5ebaac[_0x9799('0xd')][_0x863cbe][_0x9799('0xa')]||'';_0x2e308b+='\x20<';_0x2e308b+=_0x5ebaac['value'][_0x863cbe][_0x9799('0xa')]?_0x5ebaac[_0x9799('0xd')][_0x863cbe][_0x9799('0xa')]:_0x9799('0xb')+random[_0x9799('0x17')](0x6)+'@xcally.com';_0x2e308b+='>';}}return _0x2e308b;}function parseEmail(_0x54db05,_0x376227,_0x456571){if(_0x376227[_0x9799('0x18')]){var _0x4b7935=/)<[^<]*)*<\/script>/gi;while(_0x4b7935[_0x9799('0x19')](_0x376227[_0x9799('0x18')])){_0x376227[_0x9799('0x18')]=_0x376227['html'][_0x9799('0x1a')](_0x4b7935,'');}if(_0x376227[_0x9799('0x18')][_0x9799('0x1b')]('{_0x3a6484[_0x9799('0x1e')](_0x104889[_0x9799('0x1f')]);});var _0x43cc33=/]+>/g;var _0x25db7d=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x51823f=_0x376227[_0x9799('0x18')][_0x9799('0x1a')](_0x25db7d,_0x9799('0x20'));var _0x34e41f=_0x51823f['replace'](_0x43cc33,'_IMG');for(let _0xf8f01=0x0;_0xf8f01<_0x3a6484[_0x9799('0x12')];_0xf8f01++){var _0x3f5644=_0x34e41f[_0x9799('0x1a')](_0x9799('0x21'),'\x20[Attachment:\x20'+_0x3a6484[_0xf8f01]+_0x9799('0x22'));_0x34e41f=_0x3f5644;}_0x376227[_0x9799('0x18')]=_0x34e41f;}_0x456571[_0x9799('0x23')]=_0x376227[_0x9799('0x18')];}else{_0x456571['body']=_0x376227['textAsHtml'];}if(_0x456571[_0x9799('0x23')]){_0x456571[_0x9799('0x23')]=_0x456571[_0x9799('0x23')][_0x9799('0x1a')](/0x0){var _0x2b127f=[_0x9799('0x34'),_0x9799('0x35'),'Precedence:\x20auto_reply'];for(var _0x4ccb1e=0x0;_0x4ccb1e<_0x376227['headerLines'][_0x9799('0x12')];_0x4ccb1e++){var _0x1cebbd=_[_0x9799('0x10')](_0x2b127f,_0x376227[_0x9799('0x33')][_0x4ccb1e][_0x9799('0x36')]);if(_0x1cebbd>=0x0){_0x456571['isAutoreply']=!![];}}}return _0x456571;}exports[_0x9799('0x37')]=function(_0x4e3cab,_0x2a0bc0,_0x8a761f){var _0x459e34={'from':getAddress(_0x2a0bc0[_0x9799('0x38')]),'firstName':getFirstName(_0x2a0bc0[_0x9799('0x38')]),'lastName':getLastName(_0x2a0bc0[_0x9799('0x38')]),'mapKey':_0x9799('0x7'),'message':{'from':getMails(_0x4e3cab['email'],_0x2a0bc0[_0x9799('0x38')]),'to':_0x4e3cab[_0x9799('0x7')],'cc':'','subject':_0x2a0bc0[_0x9799('0x39')]||'','messageId':_0x2a0bc0[_0x9799('0x3a')],'inReplyTo':_0x2a0bc0[_0x9799('0x3b')],'sentAt':moment(_0x2a0bc0['date'])[_0x9799('0x2c')](_0x9799('0x3c')),'attach':![],'attachments':[]}};if(!_0x2a0bc0['html']&&!_0x2a0bc0[_0x9799('0x3d')]){var _0x4975dd=_[_0x9799('0x3e')](_0x2a0bc0['attachments'],{'contentType':_0x9799('0x3f')});if(_0x4975dd['length']){logger['info'](util[_0x9799('0x2c')]('Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system',_0x2a0bc0[_0x9799('0x3a')]));tnef[_0x9799('0x40')](_[_0x9799('0x41')](_0x4975dd)[_0x9799('0x31')],function(_0xc0362f,_0x30d871){if(_0x30d871){_0x2a0bc0[_0x9799('0x18')]=_0x30d871[_0x9799('0x42')]||'

Empty\x20message

';if(_0x30d871[_0x9799('0x43')]){for(var _0x5ccb54=0x0;_0x5ccb54<_0x30d871[_0x9799('0x43')][_0x9799('0x12')];_0x5ccb54++){var _0x577418=_0x30d871[_0x9799('0x43')][_0x5ccb54];_0x459e34[_0x9799('0x26')][_0x9799('0x1c')][_0x9799('0x1e')]({'filename':_0x577418[_0x9799('0x44')],'content':Buffer[_0x9799('0x38')](_0x577418[_0x9799('0x45')])});}}}_0x8a761f(parseEmail(_0x4e3cab,_0x2a0bc0,_0x459e34));});}else{_0x2a0bc0['html']=_0x9799('0x46');_0x8a761f(parseEmail(_0x4e3cab,_0x2a0bc0,_0x459e34));}}else{_0x8a761f(parseEmail(_0x4e3cab,_0x2a0bc0,_0x459e34));}};exports[_0x9799('0x47')]=function(_0x52be69,_0x312655){var _0x218563=[_0x9799('0x48')+(_0x312655||''),_0x9799('0x49')+_0x52be69,'',''];return Buffer[_0x9799('0x38')](_0x218563[_0x9799('0x14')](''),_0x9799('0x4a'))['toString']('base64');}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 65edac4..0c4f4b5 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 _0x1856=['active','Imap','Smtp','exports','lodash','name','Service','key'];(function(_0x4114dd,_0x2ad862){var _0x26f44c=function(_0xad2246){while(--_0xad2246){_0x4114dd['push'](_0x4114dd['shift']());}};_0x26f44c(++_0x2ad862);}(_0x1856,0x12c));var _0x6185=function(_0x272484,_0x8d660a){_0x272484=_0x272484-0x0;var _0x3f4fac=_0x1856[_0x272484];return _0x3f4fac;};'use strict';var _=require(_0x6185('0x0'));function MailAccount(_0xffb144){this['id']=_0xffb144['id']||0x0;this['name']=_0xffb144[_0x6185('0x1')]||_0x6185('0x2');this[_0x6185('0x3')]=_0xffb144[_0x6185('0x3')]||'SERV';this[_0x6185('0x4')]=_0xffb144[_0x6185('0x4')]||![];this[_0x6185('0x5')]=_0xffb144[_0x6185('0x5')]||[];this[_0x6185('0x6')]=_0xffb144[_0x6185('0x6')]||[];}module[_0x6185('0x7')]=MailAccount; \ No newline at end of file +var _0xf64d=['SERV','active','Imap','Smtp','exports','lodash','Service','key'];(function(_0x38553b,_0x1ee976){var _0x54d386=function(_0x3fe9d6){while(--_0x3fe9d6){_0x38553b['push'](_0x38553b['shift']());}};_0x54d386(++_0x1ee976);}(_0xf64d,0x1a5));var _0xdf64=function(_0x491c1e,_0x32710a){_0x491c1e=_0x491c1e-0x0;var _0x30d20b=_0xf64d[_0x491c1e];return _0x30d20b;};'use strict';var _=require(_0xdf64('0x0'));function MailAccount(_0x46baa8){this['id']=_0x46baa8['id']||0x0;this['name']=_0x46baa8['name']||_0xdf64('0x1');this[_0xdf64('0x2')]=_0x46baa8[_0xdf64('0x2')]||_0xdf64('0x3');this[_0xdf64('0x4')]=_0x46baa8[_0xdf64('0x4')]||![];this['Imap']=_0x46baa8[_0xdf64('0x5')]||[];this[_0xdf64('0x6')]=_0x46baa8['Smtp']||[];}module[_0xdf64('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 c6fd287..2c9c19c 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 _0x4068=['merge','exports','lodash','../model/mailAccount','hasOwnProperty','prototype','mergeFromDatabase','initMailAccounts','length','isUndefined','mailAccounts'];(function(_0x52b844,_0x434e67){var _0x14432f=function(_0x6b692a){while(--_0x6b692a){_0x52b844['push'](_0x52b844['shift']());}};_0x14432f(++_0x434e67);}(_0x4068,0xbd));var _0x8406=function(_0xefb7ac,_0x11aed6){_0xefb7ac=_0xefb7ac-0x0;var _0x386ecc=_0x4068[_0xefb7ac];return _0x386ecc;};'use strict';var _=require(_0x8406('0x0'));var MailAccount=require(_0x8406('0x1'));var Realtime=function(){this['mailAccounts']={};};function freeIsNotKey(_0x5648a3,_0x582553,_0x5efdf0){var _0x48a9e0=_['mapKeys'](_0x5648a3,function(_0x26b425,_0xc800b8){return _0x26b425[_0x5efdf0];});for(var _0x54cb7b in _0x582553){if(_0x582553[_0x8406('0x2')](_0x54cb7b)){if(!_0x48a9e0[_0x54cb7b]){delete _0x582553[_0x54cb7b];}}}}Realtime[_0x8406('0x3')][_0x8406('0x4')]=function(_0x4485f1,_0xd539f9){for(var _0x5a403f in _0xd539f9){if(_0x4485f1[_0x8406('0x2')](_0x5a403f)){_0x4485f1[_0x5a403f]=_0xd539f9[_0x5a403f];}}};Realtime[_0x8406('0x3')][_0x8406('0x5')]=function(){var _0x1e82c5=this;return function(_0x53f1cd){if(_0x53f1cd){freeIsNotKey(_0x53f1cd,_0x1e82c5['mailAccounts'],'id');for(var _0x222721=0x0,_0x373f8d={},_0x1a80b2={};_0x222721<_0x53f1cd[_0x8406('0x6')];_0x222721+=0x1){_0x373f8d=_0x53f1cd[_0x222721];if(_[_0x8406('0x7')](_0x1e82c5[_0x8406('0x8')][_0x373f8d['id']])){_0x1e82c5['mailAccounts'][_0x373f8d['id']]=new MailAccount(_0x373f8d);}else{_[_0x8406('0x9')](_0x1e82c5[_0x8406('0x8')][_0x373f8d['id']],_0x373f8d);}}}return _0x1e82c5[_0x8406('0x8')];};};module[_0x8406('0xa')]=Realtime; \ No newline at end of file +var _0x11ac=['exports','lodash','../model/mailAccount','mailAccounts','mapKeys','hasOwnProperty','prototype','length','isUndefined'];(function(_0x20c0af,_0x5d2561){var _0x5b8435=function(_0x391a1d){while(--_0x391a1d){_0x20c0af['push'](_0x20c0af['shift']());}};_0x5b8435(++_0x5d2561);}(_0x11ac,0x10f));var _0xc11a=function(_0x49cf92,_0x1fd227){_0x49cf92=_0x49cf92-0x0;var _0x54da82=_0x11ac[_0x49cf92];return _0x54da82;};'use strict';var _=require(_0xc11a('0x0'));var MailAccount=require(_0xc11a('0x1'));var Realtime=function(){this[_0xc11a('0x2')]={};};function freeIsNotKey(_0xafe7bc,_0x5c61f8,_0x45b808){var _0x4df26b=_[_0xc11a('0x3')](_0xafe7bc,function(_0x445336,_0x87dd97){return _0x445336[_0x45b808];});for(var _0x24198e in _0x5c61f8){if(_0x5c61f8[_0xc11a('0x4')](_0x24198e)){if(!_0x4df26b[_0x24198e]){delete _0x5c61f8[_0x24198e];}}}}Realtime[_0xc11a('0x5')]['mergeFromDatabase']=function(_0x2f7b21,_0x3e767d){for(var _0x48fadf in _0x3e767d){if(_0x2f7b21['hasOwnProperty'](_0x48fadf)){_0x2f7b21[_0x48fadf]=_0x3e767d[_0x48fadf];}}};Realtime['prototype']['initMailAccounts']=function(){var _0x17fe74=this;return function(_0x4ecbd2){if(_0x4ecbd2){freeIsNotKey(_0x4ecbd2,_0x17fe74['mailAccounts'],'id');for(var _0x400920=0x0,_0x352b97={},_0x59a157={};_0x400920<_0x4ecbd2[_0xc11a('0x6')];_0x400920+=0x1){_0x352b97=_0x4ecbd2[_0x400920];if(_[_0xc11a('0x7')](_0x17fe74[_0xc11a('0x2')][_0x352b97['id']])){_0x17fe74['mailAccounts'][_0x352b97['id']]=new MailAccount(_0x352b97);}else{_['merge'](_0x17fe74[_0xc11a('0x2')][_0x352b97['id']],_0x352b97);}}}return _0x17fe74['mailAccounts'];};};module[_0xc11a('0x8')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index 6244ba7..6433c0f 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 _0xab00=['getMailAccounts','Request','name','provider','service','active','ListId','TemplateId','MailServerIn','Imap','CloudProvider','type','data5','MailServerOut','getMailAccount','NotifyMailAccount','../client'];(function(_0x98135,_0x1faaf1){var _0x127be6=function(_0x28a9ce){while(--_0x28a9ce){_0x98135['push'](_0x98135['shift']());}};_0x127be6(++_0x1faaf1);}(_0xab00,0x1b9));var _0x0ab0=function(_0x42dab2,_0x1234c2){_0x42dab2=_0x42dab2-0x0;var _0x53cf10=_0xab00[_0x42dab2];return _0x53cf10;};'use strict';var client=require(_0x0ab0('0x0'));exports[_0x0ab0('0x1')]=function(){return function(){return client[_0x0ab0('0x2')]('GetMailAccount',{'options':{'attributes':['id',_0x0ab0('0x3'),_0x0ab0('0x4'),_0x0ab0('0x5'),'email',_0x0ab0('0x6'),'key',_0x0ab0('0x7'),_0x0ab0('0x8')],'raw':![],'include':[{'model':_0x0ab0('0x9'),'as':_0x0ab0('0xa'),'include':[{'model':_0x0ab0('0xb'),'attributes':['id',_0x0ab0('0x3'),'service',_0x0ab0('0xc'),_0x0ab0('0xd')],'as':'CloudProvider'}]},{'model':_0x0ab0('0xe'),'as':'Smtp','include':[{'model':_0x0ab0('0xb'),'attributes':['id',_0x0ab0('0x3'),'service','type','data5'],'as':'CloudProvider'}]}]},'log':_0x0ab0('0xf')});};};exports['notify']=function(_0x438d0e,_0x195cba){return client['Request'](_0x0ab0('0x10'),{'account':{'id':_0x438d0e},'body':_0x195cba,'log':_0x0ab0('0x10')});}; \ No newline at end of file +var _0x3c36=['getMailAccount','notify','Request','GetMailAccount','name','service','email','active','ListId','TemplateId','type','CloudProvider','MailServerOut','Smtp'];(function(_0x3e56ab,_0x4c50df){var _0x1e204f=function(_0x3186cf){while(--_0x3186cf){_0x3e56ab['push'](_0x3e56ab['shift']());}};_0x1e204f(++_0x4c50df);}(_0x3c36,0x10c));var _0x63c3=function(_0x55f3a8,_0x360d39){_0x55f3a8=_0x55f3a8-0x0;var _0x33886b=_0x3c36[_0x55f3a8];return _0x33886b;};'use strict';var client=require('../client');exports['getMailAccounts']=function(){return function(){return client[_0x63c3('0x0')](_0x63c3('0x1'),{'options':{'attributes':['id',_0x63c3('0x2'),'provider',_0x63c3('0x3'),_0x63c3('0x4'),_0x63c3('0x5'),'key',_0x63c3('0x6'),_0x63c3('0x7')],'raw':![],'include':[{'model':'MailServerIn','as':'Imap','include':[{'model':'CloudProvider','attributes':['id',_0x63c3('0x2'),'service',_0x63c3('0x8'),'data5'],'as':_0x63c3('0x9')}]},{'model':_0x63c3('0xa'),'as':_0x63c3('0xb'),'include':[{'model':_0x63c3('0x9'),'attributes':['id','name',_0x63c3('0x3'),'type','data5'],'as':_0x63c3('0x9')}]}]},'log':_0x63c3('0xc')});};};exports[_0x63c3('0xd')]=function(_0x211adc,_0xcf3381){return client[_0x63c3('0x0')]('NotifyMailAccount',{'account':{'id':_0x211adc},'body':_0xcf3381,'log':'NotifyMailAccount'});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 357d977..1a5d4fb 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 _0x0ef7=['../client','getSettings','Request','ShowSetting','loginMailFrequency','GetSettings'];(function(_0x1e9287,_0x37f584){var _0x44342e=function(_0x2f559e){while(--_0x2f559e){_0x1e9287['push'](_0x1e9287['shift']());}};_0x44342e(++_0x37f584);}(_0x0ef7,0x114));var _0x70ef=function(_0x3f6c29,_0x370d86){_0x3f6c29=_0x3f6c29-0x0;var _0x4af959=_0x0ef7[_0x3f6c29];return _0x4af959;};'use strict';var client=require(_0x70ef('0x0'));exports[_0x70ef('0x1')]=function(){return client[_0x70ef('0x2')](_0x70ef('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x70ef('0x4')]},'log':_0x70ef('0x5')});}; \ No newline at end of file +var _0x27c5=['GetSettings','../client','getSettings','Request'];(function(_0x150f94,_0x4f83cf){var _0x2e0fb6=function(_0x48b09e){while(--_0x48b09e){_0x150f94['push'](_0x150f94['shift']());}};_0x2e0fb6(++_0x4f83cf);}(_0x27c5,0x151));var _0x527c=function(_0x175a8c,_0x2d9212){_0x175a8c=_0x175a8c-0x0;var _0x37b0b0=_0x27c5[_0x175a8c];return _0x37b0b0;};'use strict';var client=require(_0x527c('0x0'));exports[_0x527c('0x1')]=function(){return client[_0x527c('0x2')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':['loginMailFrequency']},'log':_0x527c('0x3')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index 4ab25ba..98bdd5f 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(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xa9e0[_0x5e3b04];return _0x1fc44d;};'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(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa9e0,0x123));var _0x0a9e=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xa9e0[_0x54d4fe];return _0x1ab5bb;};'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 3434486..4aaf77c 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 _0x2e9a=['listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','lodash','http','express','sticky-session','../../config/environment','timeout','listen','port','socket.io','websocket','redis','defaults','adapter','socket.io-redis','../../config/triggers','default','../../config/socketio','../../config/express','once'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x2e9a,0xb3));var _0xa2e9=function(_0x1ec8cf,_0x4678a9){_0x1ec8cf=_0x1ec8cf-0x0;var _0x3cb923=_0x2e9a[_0x1ec8cf];return _0x3cb923;};'use strict';var _=require(_0xa2e9('0x0'));var http=require(_0xa2e9('0x1'));var express=require(_0xa2e9('0x2'));var sticky=require(_0xa2e9('0x3'));var Redis=require('ioredis');var config=require(_0xa2e9('0x4'));var app=express();var server=http['createServer'](app);server[_0xa2e9('0x5')]=0xdbba0;if(sticky[_0xa2e9('0x6')](server,config[_0xa2e9('0x7')])){var socketio=require(_0xa2e9('0x8'))(server,{'transports':[_0xa2e9('0x9'),'polling']});config[_0xa2e9('0xa')]=_[_0xa2e9('0xb')](config[_0xa2e9('0xa')],{'host':'localhost','port':0x18eb});socketio[_0xa2e9('0xc')](require(_0xa2e9('0xd'))({'pubClient':new Redis(config[_0xa2e9('0xa')]),'subClient':new Redis(config['redis'])}));require(_0xa2e9('0xe'))[_0xa2e9('0xf')]();require(_0xa2e9('0x10'))[_0xa2e9('0xf')](socketio);require(_0xa2e9('0x11'))[_0xa2e9('0xf')](app);require('../../routes')[_0xa2e9('0xf')](app);}else{server[_0xa2e9('0x12')](_0xa2e9('0x13'),function(){console[_0xa2e9('0x14')](_0xa2e9('0x15'),config[_0xa2e9('0x7')]);});}exports=module['exports']=app; \ No newline at end of file +var _0xf566=['defaults','localhost','adapter','socket.io-redis','../../config/triggers','default','../../config/socketio','../../config/express','once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','port','exports','http','express','createServer','timeout','listen','socket.io','websocket','polling','redis'];(function(_0x3306e4,_0x59c279){var _0x18a107=function(_0x263f1b){while(--_0x263f1b){_0x3306e4['push'](_0x3306e4['shift']());}};_0x18a107(++_0x59c279);}(_0xf566,0x1ac));var _0x6f56=function(_0xe36749,_0x2a45c8){_0xe36749=_0xe36749-0x0;var _0x5d86b7=_0xf566[_0xe36749];return _0x5d86b7;};'use strict';var _=require('lodash');var http=require(_0x6f56('0x0'));var express=require(_0x6f56('0x1'));var sticky=require('sticky-session');var Redis=require('ioredis');var config=require('../../config/environment');var app=express();var server=http[_0x6f56('0x2')](app);server[_0x6f56('0x3')]=0xdbba0;if(sticky[_0x6f56('0x4')](server,config['port'])){var socketio=require(_0x6f56('0x5'))(server,{'transports':[_0x6f56('0x6'),_0x6f56('0x7')]});config[_0x6f56('0x8')]=_[_0x6f56('0x9')](config[_0x6f56('0x8')],{'host':_0x6f56('0xa'),'port':0x18eb});socketio[_0x6f56('0xb')](require(_0x6f56('0xc'))({'pubClient':new Redis(config['redis']),'subClient':new Redis(config[_0x6f56('0x8')])}));require(_0x6f56('0xd'))[_0x6f56('0xe')]();require(_0x6f56('0xf'))[_0x6f56('0xe')](socketio);require(_0x6f56('0x10'))['default'](app);require('../../routes')['default'](app);}else{server[_0x6f56('0x11')](_0x6f56('0x12'),function(){console[_0x6f56('0x13')](_0x6f56('0x14'),config[_0x6f56('0x15')]);});}exports=module[_0x6f56('0x16')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index d4edcec..80d2f48 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 _0x8db6=['message','catch','exports','jayson/promise','../../config/logger','routing','client','http','Request','request','then','rpc','error'];(function(_0x296cad,_0x294cf6){var _0x2e6a27=function(_0x3abcbe){while(--_0x3abcbe){_0x296cad['push'](_0x296cad['shift']());}};_0x2e6a27(++_0x294cf6);}(_0x8db6,0x1e4));var _0x68db=function(_0x5416db,_0x55683a){_0x5416db=_0x5416db-0x0;var _0x243e35=_0x8db6[_0x5416db];return _0x243e35;};'use strict';var jayson=require(_0x68db('0x0'));var BPromise=require('bluebird');var logger=require(_0x68db('0x1'))(_0x68db('0x2'));var client=jayson[_0x68db('0x3')][_0x68db('0x4')]({'port':0x2329});client[_0x68db('0x5')]=function(_0x5b0cfc,_0x510727){return new BPromise(function(_0x531e74,_0x8b4109){return client[_0x68db('0x6')](_0x5b0cfc,_0x510727)[_0x68db('0x7')](function(_0x5ff1d2){logger['debug'](_0x68db('0x8'),_0x68db('0x2'),_0x5b0cfc,_0x510727,_0x5ff1d2);if(_0x5ff1d2[_0x68db('0x9')]){logger[_0x68db('0x9')]('rpc',_0x68db('0x2'),_0x5b0cfc,_0x5ff1d2[_0x68db('0x9')][_0x68db('0xa')],_0x510727);return _0x8b4109(_0x5ff1d2[_0x68db('0x9')][_0x68db('0xa')]);}else{return _0x531e74(_0x5ff1d2['result']);}})[_0x68db('0xb')](function(_0x4fb9b4){logger[_0x68db('0x9')](_0x68db('0x8'),_0x68db('0x2'),_0x5b0cfc,_0x4fb9b4,_0x510727);return _0x8b4109(_0x4fb9b4);});});};module[_0x68db('0xc')]=client; \ No newline at end of file +var _0xe000=['then','error','rpc','message','catch','exports','jayson/promise','bluebird','../../config/logger','routing','Request','request'];(function(_0x3a6db0,_0x29e872){var _0x492cf8=function(_0x4fa05c){while(--_0x4fa05c){_0x3a6db0['push'](_0x3a6db0['shift']());}};_0x492cf8(++_0x29e872);}(_0xe000,0x10e));var _0x0e00=function(_0x488447,_0x48e0c7){_0x488447=_0x488447-0x0;var _0x1816cb=_0xe000[_0x488447];return _0x1816cb;};'use strict';var jayson=require(_0x0e00('0x0'));var BPromise=require(_0x0e00('0x1'));var logger=require(_0x0e00('0x2'))(_0x0e00('0x3'));var client=jayson['client']['http']({'port':0x2329});client[_0x0e00('0x4')]=function(_0xca9fa0,_0x511574){return new BPromise(function(_0x53b1b1,_0x134cd2){return client[_0x0e00('0x5')](_0xca9fa0,_0x511574)[_0x0e00('0x6')](function(_0x476e46){logger['debug']('rpc',_0x0e00('0x3'),_0xca9fa0,_0x511574,_0x476e46);if(_0x476e46[_0x0e00('0x7')]){logger['error'](_0x0e00('0x8'),_0x0e00('0x3'),_0xca9fa0,_0x476e46[_0x0e00('0x7')][_0x0e00('0x9')],_0x511574);return _0x134cd2(_0x476e46['error']['message']);}else{return _0x53b1b1(_0x476e46['result']);}})[_0x0e00('0xa')](function(_0x354acd){logger['error'](_0x0e00('0x8'),'routing',_0xca9fa0,_0x354acd,_0x511574);return _0x134cd2(_0x354acd);});});};module[_0x0e00('0xb')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index be5a2b2..11c870f 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 _0x4347=['initFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','catch','log','bluebird','./server','./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/whatsappQueue','resolve','getAgents','then','initAgents','getIntervals','initIntervals','getOpenchannelQueues','initOpenchannelQueues','initChatQueues','getSmsQueues','initSmsQueues','initMailQueues','getFaxQueues'];(function(_0x41886e,_0x2f9b3e){var _0x10e7f4=function(_0x267c43){while(--_0x267c43){_0x41886e['push'](_0x41886e['shift']());}};_0x10e7f4(++_0x2f9b3e);}(_0x4347,0x18e));var _0x7434=function(_0x50be01,_0x42ebb8){_0x50be01=_0x50be01-0x0;var _0xb1ba52=_0x4347[_0x50be01];return _0xb1ba52;};'use strict';var BPromise=require(_0x7434('0x0'));var server=require(_0x7434('0x1'));var Realtime=require(_0x7434('0x2'));var user=require(_0x7434('0x3'));var interval=require(_0x7434('0x4'));var openchannelQueue=require(_0x7434('0x5'));var chatQueue=require('./rpc/chatQueue');var smsQueue=require(_0x7434('0x6'));var mailQueue=require(_0x7434('0x7'));var faxQueue=require('./rpc/faxQueue');var whatsappQueue=require(_0x7434('0x8'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x7434('0x9')]()['then'](user[_0x7434('0xa')]())[_0x7434('0xb')](realtime[_0x7434('0xc')]())['then'](interval[_0x7434('0xd')]())[_0x7434('0xb')](realtime[_0x7434('0xe')]())['then'](openchannelQueue[_0x7434('0xf')]())[_0x7434('0xb')](realtime[_0x7434('0x10')]())[_0x7434('0xb')](chatQueue['getChatQueues']())[_0x7434('0xb')](realtime[_0x7434('0x11')]())[_0x7434('0xb')](smsQueue[_0x7434('0x12')]())[_0x7434('0xb')](realtime[_0x7434('0x13')]())['then'](mailQueue['getMailQueues']())[_0x7434('0xb')](realtime[_0x7434('0x14')]())[_0x7434('0xb')](faxQueue[_0x7434('0x15')]())[_0x7434('0xb')](realtime[_0x7434('0x16')]())[_0x7434('0xb')](whatsappQueue[_0x7434('0x17')]())[_0x7434('0xb')](realtime[_0x7434('0x18')]())[_0x7434('0xb')](function(){return realtime;});}function main(){return server[_0x7434('0x19')](realtime)[_0x7434('0xb')](function(_0x4788dc){return initRealtime();})[_0x7434('0xb')](function(_0x815769){return setInterval(initRealtime,0x1388);})[_0x7434('0x1a')](function(_0x18b7d7){console[_0x7434('0x1b')](_0x18b7d7);});}main(); \ No newline at end of file +var _0xeab9=['initMailQueues','getWhatsappQueues','initWhatsappQueues','listen','catch','./realtime','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','getAgents','getIntervals','getOpenchannelQueues','initOpenchannelQueues','initChatQueues','getSmsQueues','initSmsQueues','getMailQueues'];(function(_0x2587ca,_0x231303){var _0x5aada1=function(_0x2d21e1){while(--_0x2d21e1){_0x2587ca['push'](_0x2587ca['shift']());}};_0x5aada1(++_0x231303);}(_0xeab9,0x147));var _0x9eab=function(_0x3062da,_0x352b8f){_0x3062da=_0x3062da-0x0;var _0x1c95ba=_0xeab9[_0x3062da];return _0x1c95ba;};'use strict';var BPromise=require('bluebird');var server=require('./server');var Realtime=require(_0x9eab('0x0'));var user=require('./rpc/user');var interval=require(_0x9eab('0x1'));var openchannelQueue=require(_0x9eab('0x2'));var chatQueue=require(_0x9eab('0x3'));var smsQueue=require(_0x9eab('0x4'));var mailQueue=require(_0x9eab('0x5'));var faxQueue=require(_0x9eab('0x6'));var whatsappQueue=require(_0x9eab('0x7'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x9eab('0x8')]()[_0x9eab('0x9')](user[_0x9eab('0xa')]())['then'](realtime['initAgents']())[_0x9eab('0x9')](interval[_0x9eab('0xb')]())[_0x9eab('0x9')](realtime['initIntervals']())['then'](openchannelQueue[_0x9eab('0xc')]())[_0x9eab('0x9')](realtime[_0x9eab('0xd')]())['then'](chatQueue['getChatQueues']())['then'](realtime[_0x9eab('0xe')]())[_0x9eab('0x9')](smsQueue[_0x9eab('0xf')]())['then'](realtime[_0x9eab('0x10')]())[_0x9eab('0x9')](mailQueue[_0x9eab('0x11')]())['then'](realtime[_0x9eab('0x12')]())[_0x9eab('0x9')](faxQueue['getFaxQueues']())[_0x9eab('0x9')](realtime['initFaxQueues']())['then'](whatsappQueue[_0x9eab('0x13')]())[_0x9eab('0x9')](realtime[_0x9eab('0x14')]())[_0x9eab('0x9')](function(){return realtime;});}function main(){return server[_0x9eab('0x15')](realtime)['then'](function(_0x4f96e3){return initRealtime();})[_0x9eab('0x9')](function(_0x4526ee){return setInterval(initRealtime,0x1388);})[_0x9eab('0x16')](function(_0x23a17b){console['log'](_0x23a17b);});}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 91ba269..252c893 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 _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(_0xd06060,_0x45d7aa){var _0x23cc72=function(_0x358610){while(--_0x358610){_0xd06060['push'](_0xd06060['shift']());}};_0x23cc72(++_0x45d7aa);}(_0xe14b,0x93));var _0xbe14=function(_0x27ef6e,_0x4e5fa8){_0x27ef6e=_0x27ef6e-0x0;var _0x4afbbc=_0xe14b[_0x27ef6e];return _0x4afbbc;};'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 +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(_0x34aca7,_0xba0d8e){var _0x379749=function(_0x22452d){while(--_0x22452d){_0x34aca7['push'](_0x34aca7['shift']());}};_0x379749(++_0xba0d8e);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0xc4aa[_0x3d42d8];return _0x27fc41;};'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 diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index 01a91eb..e49229d 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 _0xcd3f=['request','error','catch','bluebird','jayson/promise','client','http'];(function(_0x8117d7,_0xaa6329){var _0x4d7255=function(_0x369fc3){while(--_0x369fc3){_0x8117d7['push'](_0x8117d7['shift']());}};_0x4d7255(++_0xaa6329);}(_0xcd3f,0x130));var _0xfcd3=function(_0x59039f,_0x55bdfa){_0x59039f=_0x59039f-0x0;var _0xf1b677=_0xcd3f[_0x59039f];return _0xf1b677;};'use strict';var BPromise=require(_0xfcd3('0x0'));var jayson=require(_0xfcd3('0x1'));var client=jayson[_0xfcd3('0x2')][_0xfcd3('0x3')]({'port':0x232b});function request(_0x85c37a,_0x289a61){return new BPromise(function(_0x1941e5,_0x179405){return client[_0xfcd3('0x4')](_0x85c37a,_0x289a61)['then'](function(_0x543c90){if(_0x543c90['error']){return _0x179405(_0x543c90[_0xfcd3('0x5')]['message']);}else{return _0x1941e5(_0x543c90['result']);}})[_0xfcd3('0x6')](function(_0x2497a6){return _0x179405(_0x2497a6);});});}exports['sendMailMessage']=function(_0x489e2b,_0x4ca124){return request('SendMail',{'account':_0x489e2b,'message':_0x4ca124});}; \ No newline at end of file +var _0xbdcf=['client','http','request','then','error','message','result','catch','sendMailMessage','bluebird','jayson/promise'];(function(_0x3ca16b,_0x1fd2bc){var _0xe23b9b=function(_0x2c5711){while(--_0x2c5711){_0x3ca16b['push'](_0x3ca16b['shift']());}};_0xe23b9b(++_0x1fd2bc);}(_0xbdcf,0x1e2));var _0xfbdc=function(_0x42e894,_0x46cdb5){_0x42e894=_0x42e894-0x0;var _0xc2a6a1=_0xbdcf[_0x42e894];return _0xc2a6a1;};'use strict';var BPromise=require(_0xfbdc('0x0'));var jayson=require(_0xfbdc('0x1'));var client=jayson[_0xfbdc('0x2')][_0xfbdc('0x3')]({'port':0x232b});function request(_0x124b82,_0xdd8948){return new BPromise(function(_0x538462,_0x3c954f){return client[_0xfbdc('0x4')](_0x124b82,_0xdd8948)[_0xfbdc('0x5')](function(_0x3fb230){if(_0x3fb230[_0xfbdc('0x6')]){return _0x3c954f(_0x3fb230['error'][_0xfbdc('0x7')]);}else{return _0x538462(_0x3fb230[_0xfbdc('0x8')]);}})[_0xfbdc('0x9')](function(_0x30bbd9){return _0x3c954f(_0x30bbd9);});});}exports[_0xfbdc('0xa')]=function(_0x89e62b,_0xd6c9d6){return request('SendMail',{'account':_0x89e62b,'message':_0xd6c9d6});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 44290eb..8cfa264 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 _0xb016=['fax','sms','length','Status','format','online','chatStatusTime','chatCurrentCapacity','faxStatus','faxCurrentCapacity','whatsappCurrentCapacity','stringify','emit','omit','exports','lodash','md5','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','voicePause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','chatWaitingInteractions','faxWaitingInteractions','mailWaitingInteractions','openchannelWaitingInteractions','smsWaitingInteractions','whatsappWaitingInteractions','updateRealtime','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','idle','prototype','mail','chat','openchannel'];(function(_0x318a6b,_0x2bc439){var _0x44c4ca=function(_0xff1b96){while(--_0xff1b96){_0x318a6b['push'](_0x318a6b['shift']());}};_0x44c4ca(++_0x2bc439);}(_0xb016,0x159));var _0x6b01=function(_0x1bff54,_0x460fbc){_0x1bff54=_0x1bff54-0x0;var _0x441a41=_0xb016[_0x1bff54];return _0x441a41;};'use strict';var _=require(_0x6b01('0x0'));var md5=require(_0x6b01('0x1'));var moment=require('moment');var Redis=require('ioredis');var config=require(_0x6b01('0x2'));config['redis']=_[_0x6b01('0x3')](config[_0x6b01('0x4')],{'host':_0x6b01('0x5'),'port':0x18eb});var io=require(_0x6b01('0x6'))(new Redis(config['redis']));function Agent(_0x1b7dd6){this['id']=_0x1b7dd6['id']||0x0;this[_0x6b01('0x7')]=_0x1b7dd6[_0x6b01('0x7')]||'';this['online']=_0x1b7dd6['online']||!![];this[_0x6b01('0x8')]=_0x1b7dd6[_0x6b01('0x8')]||![];this['chatPause']=_0x1b7dd6['chatPause']||![];this[_0x6b01('0x9')]=_0x1b7dd6[_0x6b01('0x9')]||![];this[_0x6b01('0xa')]=_0x1b7dd6[_0x6b01('0xa')]||![];this[_0x6b01('0xb')]=_0x1b7dd6['smsPause']||![];this['openchannelPause']=_0x1b7dd6[_0x6b01('0xc')]||![];this[_0x6b01('0xd')]=_0x6b01('0xe');this['chatStatusTime']=0x0;this[_0x6b01('0xf')]=_0x1b7dd6['chatCapacity']||0x0;this['chatCurrentCapacity']=0x0;this[_0x6b01('0x10')]='unknown';this[_0x6b01('0x11')]=0x0;this[_0x6b01('0x12')]=_0x1b7dd6['mailCapacity']||0x0;this[_0x6b01('0x13')]=0x0;this['faxStatus']='unknown';this['faxStatusTime']=0x0;this[_0x6b01('0x14')]=_0x1b7dd6['faxCapacity']||0x0;this['faxCurrentCapacity']=0x0;this[_0x6b01('0x15')]=_0x6b01('0xe');this[_0x6b01('0x16')]=0x0;this[_0x6b01('0x17')]=_0x1b7dd6[_0x6b01('0x17')]||0x0;this[_0x6b01('0x18')]=0x0;this[_0x6b01('0x19')]=_0x6b01('0xe');this[_0x6b01('0x1a')]=0x0;this[_0x6b01('0x1b')]=_0x1b7dd6[_0x6b01('0x1b')]||0x0;this['whatsappCurrentCapacity']=0x0;this[_0x6b01('0x1c')]=_0x6b01('0xe');this[_0x6b01('0x1d')]=0x0;this[_0x6b01('0x1e')]=_0x1b7dd6[_0x6b01('0x1e')]||0x0;this[_0x6b01('0x1f')]=0x0;this[_0x6b01('0x20')]=![];this[_0x6b01('0x21')]=undefined;this['md5']='';this[_0x6b01('0x22')]={};this[_0x6b01('0x23')]={};this[_0x6b01('0x24')]={};this[_0x6b01('0x25')]={};this[_0x6b01('0x26')]={};this[_0x6b01('0x27')]={};this[_0x6b01('0x28')]();}Agent['prototype'][_0x6b01('0x29')]=function(_0xcf9200){if(this[_0xcf9200+_0x6b01('0x2a')]>0x0){if(this[_0xcf9200+'Capacity']>0x0&&this[_0xcf9200+_0x6b01('0x2a')]>=this[_0xcf9200+_0x6b01('0x2b')]){return _0x6b01('0x2c');}else{return _0x6b01('0x2d');}}else{return _0x6b01('0x2e');}};Agent[_0x6b01('0x2f')][_0x6b01('0x28')]=function(){var _0x136452=[_0x6b01('0x30'),_0x6b01('0x31'),_0x6b01('0x32'),_0x6b01('0x33'),_0x6b01('0x34'),'whatsapp'];for(var _0x33d95d=0x0;_0x33d95d<_0x136452[_0x6b01('0x35')];_0x33d95d+=0x1){var _0x32128f=this[_0x6b01('0x29')](_0x136452[_0x33d95d]);if(this[_0x136452[_0x33d95d]+_0x6b01('0x36')]!==_0x32128f){this[_0x136452[_0x33d95d]+'StatusTime']=_['toNumber'](moment()[_0x6b01('0x37')]('x'));}this[_0x136452[_0x33d95d]+_0x6b01('0x36')]=_0x32128f;}var _0xc574c={'id':this['id'],'name':this[_0x6b01('0x7')],'online':this[_0x6b01('0x38')],'voicePause':this[_0x6b01('0x8')],'chatPause':this['chatPause'],'mailPause':this[_0x6b01('0x9')],'smsPause':this['smsPause'],'faxPause':this[_0x6b01('0xa')],'openchannelPause':this['openchannelPause'],'chatStatus':this[_0x6b01('0xd')],'chatStatusTime':this[_0x6b01('0x39')],'chatCapacity':this[_0x6b01('0xf')],'chatCurrentCapacity':this[_0x6b01('0x3a')],'mailStatus':this[_0x6b01('0x10')],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this[_0x6b01('0x12')],'mailCurrentCapacity':this[_0x6b01('0x13')],'faxStatus':this[_0x6b01('0x3b')],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this[_0x6b01('0x3c')],'smsStatus':this['smsStatus'],'smsStatusTime':this[_0x6b01('0x16')],'smsCapacity':this[_0x6b01('0x17')],'smsCurrentCapacity':this[_0x6b01('0x18')],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this[_0x6b01('0x1a')],'whatsappCapacity':this[_0x6b01('0x1b')],'whatsappCurrentCapacity':this[_0x6b01('0x3d')],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this[_0x6b01('0x1d')],'openchannelCapacity':this[_0x6b01('0x1e')],'openchannelCurrentCapacity':this[_0x6b01('0x1f')],'busy':this[_0x6b01('0x20')],'busyQueue':this[_0x6b01('0x21')],'chatWaitingInteractions':this['chatWaitingInteractions'],'faxWaitingInteractions':this[_0x6b01('0x23')],'mailWaitingInteractions':this[_0x6b01('0x24')],'openchannelWaitingInteractions':this[_0x6b01('0x25')],'smsWaitingInteractions':this[_0x6b01('0x26')],'whatsappWaitingInteractions':this[_0x6b01('0x27')]};var _0xc644f2=md5(JSON[_0x6b01('0x3e')](_0xc574c));if(this[_0x6b01('0x1')]!==_0xc644f2){this['md5']=_0xc644f2;io[_0x6b01('0x3f')]('user:routing:update',_[_0x6b01('0x40')](_0xc574c,[_0x6b01('0x38')]));}};module[_0x6b01('0x41')]=Agent; \ No newline at end of file +var _0x5464=['chatCurrentCapacity','mailStatusTime','mailCapacity','faxStatus','faxCurrentCapacity','whatsappStatusTime','whatsappCapacity','chatWaitingInteractions','openchannelWaitingInteractions','stringify','emit','user:routing:update','omit','exports','lodash','md5','moment','../../../config/environment','defaults','localhost','socket.io-emitter','redis','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','unknown','chatStatusTime','chatCapacity','faxStatusTime','faxCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','faxWaitingInteractions','mailWaitingInteractions','smsWaitingInteractions','whatsappWaitingInteractions','updateRealtime','prototype','getChannelStatus','Capacity','CurrentCapacity','maxcapacity','working','idle','mail','chat','openchannel','whatsapp','length','Status','StatusTime','format','name'];(function(_0x5826ea,_0x16788d){var _0x1ea289=function(_0x2d40be){while(--_0x2d40be){_0x5826ea['push'](_0x5826ea['shift']());}};_0x1ea289(++_0x16788d);}(_0x5464,0x15d));var _0x4546=function(_0x562a50,_0x244d79){_0x562a50=_0x562a50-0x0;var _0x27baa6=_0x5464[_0x562a50];return _0x27baa6;};'use strict';var _=require(_0x4546('0x0'));var md5=require(_0x4546('0x1'));var moment=require(_0x4546('0x2'));var Redis=require('ioredis');var config=require(_0x4546('0x3'));config['redis']=_[_0x4546('0x4')](config['redis'],{'host':_0x4546('0x5'),'port':0x18eb});var io=require(_0x4546('0x6'))(new Redis(config[_0x4546('0x7')]));function Agent(_0x2b1a9b){this['id']=_0x2b1a9b['id']||0x0;this['name']=_0x2b1a9b['name']||'';this['online']=_0x2b1a9b[_0x4546('0x8')]||!![];this[_0x4546('0x9')]=_0x2b1a9b[_0x4546('0x9')]||![];this[_0x4546('0xa')]=_0x2b1a9b[_0x4546('0xa')]||![];this[_0x4546('0xb')]=_0x2b1a9b[_0x4546('0xb')]||![];this[_0x4546('0xc')]=_0x2b1a9b[_0x4546('0xc')]||![];this['smsPause']=_0x2b1a9b[_0x4546('0xd')]||![];this[_0x4546('0xe')]=_0x2b1a9b[_0x4546('0xe')]||![];this['chatStatus']=_0x4546('0xf');this[_0x4546('0x10')]=0x0;this[_0x4546('0x11')]=_0x2b1a9b[_0x4546('0x11')]||0x0;this['chatCurrentCapacity']=0x0;this['mailStatus']=_0x4546('0xf');this['mailStatusTime']=0x0;this['mailCapacity']=_0x2b1a9b['mailCapacity']||0x0;this['mailCurrentCapacity']=0x0;this['faxStatus']='unknown';this[_0x4546('0x12')]=0x0;this['faxCapacity']=_0x2b1a9b[_0x4546('0x13')]||0x0;this['faxCurrentCapacity']=0x0;this[_0x4546('0x14')]='unknown';this[_0x4546('0x15')]=0x0;this[_0x4546('0x16')]=_0x2b1a9b[_0x4546('0x16')]||0x0;this[_0x4546('0x17')]=0x0;this[_0x4546('0x18')]=_0x4546('0xf');this['whatsappStatusTime']=0x0;this['whatsappCapacity']=_0x2b1a9b['whatsappCapacity']||0x0;this[_0x4546('0x19')]=0x0;this[_0x4546('0x1a')]=_0x4546('0xf');this[_0x4546('0x1b')]=0x0;this[_0x4546('0x1c')]=_0x2b1a9b[_0x4546('0x1c')]||0x0;this[_0x4546('0x1d')]=0x0;this[_0x4546('0x1e')]=![];this[_0x4546('0x1f')]=undefined;this[_0x4546('0x1')]='';this['chatWaitingInteractions']={};this[_0x4546('0x20')]={};this[_0x4546('0x21')]={};this['openchannelWaitingInteractions']={};this[_0x4546('0x22')]={};this[_0x4546('0x23')]={};this[_0x4546('0x24')]();}Agent[_0x4546('0x25')][_0x4546('0x26')]=function(_0x15b013){if(this[_0x15b013+'CurrentCapacity']>0x0){if(this[_0x15b013+_0x4546('0x27')]>0x0&&this[_0x15b013+_0x4546('0x28')]>=this[_0x15b013+'Capacity']){return _0x4546('0x29');}else{return _0x4546('0x2a');}}else{return _0x4546('0x2b');}};Agent[_0x4546('0x25')][_0x4546('0x24')]=function(){var _0x53ae5e=[_0x4546('0x2c'),_0x4546('0x2d'),_0x4546('0x2e'),'fax','sms',_0x4546('0x2f')];for(var _0x166d6f=0x0;_0x166d6f<_0x53ae5e[_0x4546('0x30')];_0x166d6f+=0x1){var _0x114963=this[_0x4546('0x26')](_0x53ae5e[_0x166d6f]);if(this[_0x53ae5e[_0x166d6f]+_0x4546('0x31')]!==_0x114963){this[_0x53ae5e[_0x166d6f]+_0x4546('0x32')]=_['toNumber'](moment()[_0x4546('0x33')]('x'));}this[_0x53ae5e[_0x166d6f]+'Status']=_0x114963;}var _0x3a2d12={'id':this['id'],'name':this[_0x4546('0x34')],'online':this['online'],'voicePause':this['voicePause'],'chatPause':this[_0x4546('0xa')],'mailPause':this['mailPause'],'smsPause':this[_0x4546('0xd')],'faxPause':this[_0x4546('0xc')],'openchannelPause':this['openchannelPause'],'chatStatus':this['chatStatus'],'chatStatusTime':this[_0x4546('0x10')],'chatCapacity':this[_0x4546('0x11')],'chatCurrentCapacity':this[_0x4546('0x35')],'mailStatus':this['mailStatus'],'mailStatusTime':this[_0x4546('0x36')],'mailCapacity':this[_0x4546('0x37')],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this[_0x4546('0x38')],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this[_0x4546('0x13')],'faxCurrentCapacity':this[_0x4546('0x39')],'smsStatus':this[_0x4546('0x14')],'smsStatusTime':this[_0x4546('0x15')],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this[_0x4546('0x17')],'whatsappStatus':this[_0x4546('0x18')],'whatsappStatusTime':this[_0x4546('0x3a')],'whatsappCapacity':this[_0x4546('0x3b')],'whatsappCurrentCapacity':this[_0x4546('0x19')],'openchannelStatus':this[_0x4546('0x1a')],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this[_0x4546('0x1c')],'openchannelCurrentCapacity':this[_0x4546('0x1d')],'busy':this['busy'],'busyQueue':this['busyQueue'],'chatWaitingInteractions':this[_0x4546('0x3c')],'faxWaitingInteractions':this[_0x4546('0x20')],'mailWaitingInteractions':this['mailWaitingInteractions'],'openchannelWaitingInteractions':this[_0x4546('0x3d')],'smsWaitingInteractions':this[_0x4546('0x22')],'whatsappWaitingInteractions':this['whatsappWaitingInteractions']};var _0x5acdc0=md5(JSON[_0x4546('0x3e')](_0x3a2d12));if(this[_0x4546('0x1')]!==_0x5acdc0){this[_0x4546('0x1')]=_0x5acdc0;io[_0x4546('0x3f')](_0x4546('0x40'),_[_0x4546('0x41')](_0x3a2d12,['online']));}};module[_0x4546('0x42')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 4bd54eb..fc05c5a 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 _0x78d9=['localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRealtime','prototype','_rr','map','loggedIn','paused','length','online','chatPause','available','stringify','format','chat:queue:%s','emit','exports','lodash','ioredis','../../../config/environment','redis','defaults'];(function(_0x5a4b46,_0xd2934d){var _0x337a4a=function(_0x15d5c5){while(--_0x15d5c5){_0x5a4b46['push'](_0x5a4b46['shift']());}};_0x337a4a(++_0xd2934d);}(_0x78d9,0x11d));var _0x978d=function(_0x417d96,_0x2292e9){_0x417d96=_0x417d96-0x0;var _0x111a49=_0x78d9[_0x417d96];return _0x111a49;};'use strict';var _=require(_0x978d('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0x978d('0x1'));var config=require(_0x978d('0x2'));config[_0x978d('0x3')]=_[_0x978d('0x4')](config[_0x978d('0x3')],{'host':_0x978d('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x978d('0x3')]));function ChatQueue(_0x3d6690){this['id']=_0x3d6690['id']||0x0;this['name']=_0x3d6690[_0x978d('0x6')]||'';this[_0x978d('0x7')]=_0x3d6690[_0x978d('0x7')]||0xa;this['strategy']=_0x3d6690[_0x978d('0x8')]||_0x978d('0x9');this[_0x978d('0xa')]=_0x3d6690[_0x978d('0xa')];this[_0x978d('0xb')]={};this[_0x978d('0xc')]=0x0;this[_0x978d('0xd')]='';this['updateRouting']();this[_0x978d('0xe')]();}ChatQueue[_0x978d('0xf')]['updateRouting']=function(){var _0x5a47c0=this[_0x978d('0xb')][_0x978d('0x10')];this[_0x978d('0xb')]=_[_0x978d('0x11')](this['Agents'],'id');this[_0x978d('0xb')][_0x978d('0x10')]=_0x5a47c0;};ChatQueue['prototype'][_0x978d('0xe')]=function(){this[_0x978d('0x12')]=0x0;this[_0x978d('0x13')]=0x0;for(var _0x4376a2=0x0;_0x4376a2=0x0?this[_0x978d('0x17')]:0x0;var _0x306a67={'id':this['id'],'available':this[_0x978d('0x17')],'loggedIn':this[_0x978d('0x12')],'name':this['name'],'paused':this[_0x978d('0x13')],'waiting':this[_0x978d('0xc')]};var _0x5b98a1=md5(JSON[_0x978d('0x18')](_0x306a67));if(this['md5']!==_0x5b98a1){this[_0x978d('0xd')]=_0x5b98a1;io['to'](util[_0x978d('0x19')](_0x978d('0x1a'),_0x306a67['name']))[_0x978d('0x1b')]('chat_queue:save',_0x306a67);}};module[_0x978d('0x1c')]=ChatQueue; \ No newline at end of file +var _0x33a4=['online','loggedIn','chatPause','paused','available','stringify','emit','exports','lodash','md5','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','prototype','_rr','mapAgentsId','map','length'];(function(_0x1afea4,_0x106601){var _0x3df48a=function(_0x597a7a){while(--_0x597a7a){_0x1afea4['push'](_0x1afea4['shift']());}};_0x3df48a(++_0x106601);}(_0x33a4,0x74));var _0x433a=function(_0x2c4fd0,_0x2c8f5f){_0x2c4fd0=_0x2c4fd0-0x0;var _0x7db72b=_0x33a4[_0x2c4fd0];return _0x7db72b;};'use strict';var _=require(_0x433a('0x0'));var md5=require(_0x433a('0x1'));var util=require('util');var Redis=require('ioredis');var config=require(_0x433a('0x2'));config[_0x433a('0x3')]=_[_0x433a('0x4')](config[_0x433a('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0x433a('0x5'))(new Redis(config[_0x433a('0x3')]));function ChatQueue(_0x5d3c73){this['id']=_0x5d3c73['id']||0x0;this[_0x433a('0x6')]=_0x5d3c73['name']||'';this[_0x433a('0x7')]=_0x5d3c73[_0x433a('0x7')]||0xa;this[_0x433a('0x8')]=_0x5d3c73[_0x433a('0x8')]||_0x433a('0x9');this[_0x433a('0xa')]=_0x5d3c73[_0x433a('0xa')];this['mapAgentsId']={};this[_0x433a('0xb')]=0x0;this[_0x433a('0x1')]='';this[_0x433a('0xc')]();this[_0x433a('0xd')]();}ChatQueue[_0x433a('0xe')][_0x433a('0xc')]=function(){var _0x467582=this['mapAgentsId'][_0x433a('0xf')];this[_0x433a('0x10')]=_[_0x433a('0x11')](this[_0x433a('0xa')],'id');this[_0x433a('0x10')][_0x433a('0xf')]=_0x467582;};ChatQueue[_0x433a('0xe')][_0x433a('0xd')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x2a326b=0x0;_0x2a326b=0x0?this[_0x433a('0x17')]:0x0;var _0x5cecd9={'id':this['id'],'available':this[_0x433a('0x17')],'loggedIn':this[_0x433a('0x14')],'name':this[_0x433a('0x6')],'paused':this['paused'],'waiting':this[_0x433a('0xb')]};var _0x1b4f37=md5(JSON[_0x433a('0x18')](_0x5cecd9));if(this[_0x433a('0x1')]!==_0x1b4f37){this[_0x433a('0x1')]=_0x1b4f37;io['to'](util['format']('chat:queue:%s',_0x5cecd9[_0x433a('0x6')]))[_0x433a('0x19')]('chat_queue:save',_0x5cecd9);}};module[_0x433a('0x1a')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 031959a..2d234e1 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 _0x5f5b=['lodash','md5','util','ioredis','../../../config/environment','redis','defaults','name','timeout','strategy','beepall','Agents','mapAgentsId','prototype','updateRouting','_rr','map','loggedIn','paused','available','waiting','stringify','format','fax_queue:save','exports'];(function(_0x4c99d0,_0x1febe1){var _0x5e541f=function(_0x6a83e5){while(--_0x6a83e5){_0x4c99d0['push'](_0x4c99d0['shift']());}};_0x5e541f(++_0x1febe1);}(_0x5f5b,0xfa));var _0xb5f5=function(_0x55fced,_0x4e214f){_0x55fced=_0x55fced-0x0;var _0xce2640=_0x5f5b[_0x55fced];return _0xce2640;};'use strict';var _=require(_0xb5f5('0x0'));var md5=require(_0xb5f5('0x1'));var util=require(_0xb5f5('0x2'));var Redis=require(_0xb5f5('0x3'));var config=require(_0xb5f5('0x4'));config[_0xb5f5('0x5')]=_[_0xb5f5('0x6')](config[_0xb5f5('0x5')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xb5f5('0x5')]));function FaxQueue(_0x893158){this['id']=_0x893158['id']||0x0;this['name']=_0x893158[_0xb5f5('0x7')]||'';this[_0xb5f5('0x8')]=_0x893158[_0xb5f5('0x8')]||0xa;this[_0xb5f5('0x9')]=_0x893158[_0xb5f5('0x9')]||_0xb5f5('0xa');this[_0xb5f5('0xb')]=_0x893158['Agents'];this[_0xb5f5('0xc')]={};this['waiting']=0x0;this['md5']='';this['updateRouting']();this['updateRealtime']();}FaxQueue[_0xb5f5('0xd')][_0xb5f5('0xe')]=function(){var _0x5eaff0=this[_0xb5f5('0xc')][_0xb5f5('0xf')];this[_0xb5f5('0xc')]=_[_0xb5f5('0x10')](this[_0xb5f5('0xb')],'id');this[_0xb5f5('0xc')][_0xb5f5('0xf')]=_0x5eaff0;};FaxQueue[_0xb5f5('0xd')]['updateRealtime']=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0xd96179=0x0;_0xd96179=0x0?this['available']:0x0;var _0x50cafa={'id':this['id'],'available':this[_0xb5f5('0x13')],'loggedIn':this[_0xb5f5('0x11')],'name':this[_0xb5f5('0x7')],'paused':this[_0xb5f5('0x12')],'waiting':this[_0xb5f5('0x14')]};var _0x23fed7=md5(JSON[_0xb5f5('0x15')](_0x50cafa));if(this[_0xb5f5('0x1')]!==_0x23fed7){this['md5']=_0x23fed7;io['to'](util[_0xb5f5('0x16')]('fax:queue:%s',_0x50cafa[_0xb5f5('0x7')]))['emit'](_0xb5f5('0x17'),_0x50cafa);}};module[_0xb5f5('0x18')]=FaxQueue; \ No newline at end of file +var _0xbadc=['timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','prototype','loggedIn','paused','length','online','faxPause','available','stringify','format','fax:queue:%s','emit','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','name'];(function(_0x4bf96c,_0x4d24fd){var _0x281d09=function(_0x56538e){while(--_0x56538e){_0x4bf96c['push'](_0x4bf96c['shift']());}};_0x281d09(++_0x4d24fd);}(_0xbadc,0x18e));var _0xcbad=function(_0x1ccd8a,_0x5bf417){_0x1ccd8a=_0x1ccd8a-0x0;var _0x5a69d8=_0xbadc[_0x1ccd8a];return _0x5a69d8;};'use strict';var _=require(_0xcbad('0x0'));var md5=require(_0xcbad('0x1'));var util=require(_0xcbad('0x2'));var Redis=require(_0xcbad('0x3'));var config=require(_0xcbad('0x4'));config['redis']=_['defaults'](config[_0xcbad('0x5')],{'host':_0xcbad('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xcbad('0x5')]));function FaxQueue(_0x2c787e){this['id']=_0x2c787e['id']||0x0;this[_0xcbad('0x7')]=_0x2c787e[_0xcbad('0x7')]||'';this[_0xcbad('0x8')]=_0x2c787e[_0xcbad('0x8')]||0xa;this[_0xcbad('0x9')]=_0x2c787e[_0xcbad('0x9')]||_0xcbad('0xa');this['Agents']=_0x2c787e[_0xcbad('0xb')];this[_0xcbad('0xc')]={};this[_0xcbad('0xd')]=0x0;this['md5']='';this[_0xcbad('0xe')]();this[_0xcbad('0xf')]();}FaxQueue['prototype']['updateRouting']=function(){var _0x25e739=this[_0xcbad('0xc')][_0xcbad('0x10')];this[_0xcbad('0xc')]=_['map'](this[_0xcbad('0xb')],'id');this[_0xcbad('0xc')][_0xcbad('0x10')]=_0x25e739;};FaxQueue[_0xcbad('0x11')]['updateRealtime']=function(){this[_0xcbad('0x12')]=0x0;this[_0xcbad('0x13')]=0x0;for(var _0x4d6559=0x0;_0x4d6559=0x0?this[_0xcbad('0x17')]:0x0;var _0x372dd3={'id':this['id'],'available':this[_0xcbad('0x17')],'loggedIn':this[_0xcbad('0x12')],'name':this[_0xcbad('0x7')],'paused':this['paused'],'waiting':this['waiting']};var _0x8161b5=md5(JSON[_0xcbad('0x18')](_0x372dd3));if(this['md5']!==_0x8161b5){this[_0xcbad('0x1')]=_0x8161b5;io['to'](util[_0xcbad('0x19')](_0xcbad('0x1a'),_0x372dd3['name']))[_0xcbad('0x1b')]('fax_queue:save',_0x372dd3);}};module[_0xcbad('0x1c')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index 0a5c3b3..3ee41e4 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 _0x90c8=['name','Intervals','exports'];(function(_0x5ef917,_0x530008){var _0x2b4865=function(_0x2a2c7d){while(--_0x2a2c7d){_0x5ef917['push'](_0x5ef917['shift']());}};_0x2b4865(++_0x530008);}(_0x90c8,0x1e0));var _0x890c=function(_0x1f36bb,_0x8af718){_0x1f36bb=_0x1f36bb-0x0;var _0xaf97fa=_0x90c8[_0x1f36bb];return _0xaf97fa;};'use strict';function Interval(_0xe1fe58){this['id']=_0xe1fe58['id']||0x0;this[_0x890c('0x0')]=_0xe1fe58[_0x890c('0x0')]||'';this[_0x890c('0x1')]=_0xe1fe58['Intervals']||{};}module[_0x890c('0x2')]=Interval; \ No newline at end of file +var _0x7303=['Intervals','exports'];(function(_0x21b898,_0x3a681b){var _0x4411a7=function(_0x2a55fe){while(--_0x2a55fe){_0x21b898['push'](_0x21b898['shift']());}};_0x4411a7(++_0x3a681b);}(_0x7303,0x8e));var _0x3730=function(_0x1dce75,_0x5b532d){_0x1dce75=_0x1dce75-0x0;var _0x28c901=_0x7303[_0x1dce75];return _0x28c901;};'use strict';function Interval(_0x474c95){this['id']=_0x474c95['id']||0x0;this['name']=_0x474c95['name']||'';this[_0x3730('0x0')]=_0x474c95[_0x3730('0x0')]||{};}module[_0x3730('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 ffe401f..7b3916a 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 _0x153c=['online','loggedIn','paused','available','stringify','format','mail:queue:%s','emit','mail_queue:save','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults','name','timeout','strategy','waiting','updateRouting','updateRealtime','mapAgentsId','map','Agents','_rr','prototype','length'];(function(_0x2d0f87,_0x23395a){var _0x47bea0=function(_0x55e3eb){while(--_0x55e3eb){_0x2d0f87['push'](_0x2d0f87['shift']());}};_0x47bea0(++_0x23395a);}(_0x153c,0x122));var _0xc153=function(_0x4bf59b,_0x2d6772){_0x4bf59b=_0x4bf59b-0x0;var _0xdc2c6a=_0x153c[_0x4bf59b];return _0xdc2c6a;};'use strict';var _=require(_0xc153('0x0'));var md5=require(_0xc153('0x1'));var util=require('util');var Redis=require(_0xc153('0x2'));var config=require(_0xc153('0x3'));config[_0xc153('0x4')]=_[_0xc153('0x5')](config[_0xc153('0x4')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xc153('0x4')]));function MailQueue(_0x4e5b16){this['id']=_0x4e5b16['id']||0x0;this[_0xc153('0x6')]=_0x4e5b16[_0xc153('0x6')]||'';this[_0xc153('0x7')]=_0x4e5b16[_0xc153('0x7')]||0xa;this['strategy']=_0x4e5b16[_0xc153('0x8')]||'beepall';this['Agents']=_0x4e5b16['Agents'];this['mapAgentsId']={};this[_0xc153('0x9')]=0x0;this[_0xc153('0x1')]='';this[_0xc153('0xa')]();this[_0xc153('0xb')]();}MailQueue['prototype'][_0xc153('0xa')]=function(){var _0x2b410c=this[_0xc153('0xc')]['_rr'];this[_0xc153('0xc')]=_[_0xc153('0xd')](this[_0xc153('0xe')],'id');this[_0xc153('0xc')][_0xc153('0xf')]=_0x2b410c;};MailQueue[_0xc153('0x10')][_0xc153('0xb')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x2de32a=0x0;_0x2de32a=0x0?this[_0xc153('0x15')]:0x0;var _0x2fe37f={'id':this['id'],'available':this[_0xc153('0x15')],'loggedIn':this[_0xc153('0x13')],'name':this[_0xc153('0x6')],'paused':this[_0xc153('0x14')],'waiting':this['waiting']};var _0x49d558=md5(JSON[_0xc153('0x16')](_0x2fe37f));if(this[_0xc153('0x1')]!==_0x49d558){this[_0xc153('0x1')]=_0x49d558;io['to'](util[_0xc153('0x17')](_0xc153('0x18'),_0x2fe37f[_0xc153('0x6')]))[_0xc153('0x19')](_0xc153('0x1a'),_0x2fe37f);}};module[_0xc153('0x1b')]=MailQueue; \ No newline at end of file +var _0xb227=['_rr','loggedIn','paused','length','online','available','stringify','mail:queue:%s','emit','md5','util','ioredis','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','prototype','map'];(function(_0x29732d,_0x15eed2){var _0x466071=function(_0x552bdb){while(--_0x552bdb){_0x29732d['push'](_0x29732d['shift']());}};_0x466071(++_0x15eed2);}(_0xb227,0xb8));var _0x7b22=function(_0x501bfc,_0x561e33){_0x501bfc=_0x501bfc-0x0;var _0x4f8add=_0xb227[_0x501bfc];return _0x4f8add;};'use strict';var _=require('lodash');var md5=require(_0x7b22('0x0'));var util=require(_0x7b22('0x1'));var Redis=require(_0x7b22('0x2'));var config=require('../../../config/environment');config[_0x7b22('0x3')]=_[_0x7b22('0x4')](config[_0x7b22('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0x7b22('0x5'))(new Redis(config[_0x7b22('0x3')]));function MailQueue(_0x3ad594){this['id']=_0x3ad594['id']||0x0;this[_0x7b22('0x6')]=_0x3ad594['name']||'';this[_0x7b22('0x7')]=_0x3ad594['timeout']||0xa;this[_0x7b22('0x8')]=_0x3ad594['strategy']||_0x7b22('0x9');this['Agents']=_0x3ad594[_0x7b22('0xa')];this[_0x7b22('0xb')]={};this['waiting']=0x0;this[_0x7b22('0x0')]='';this[_0x7b22('0xc')]();this[_0x7b22('0xd')]();}MailQueue[_0x7b22('0xe')][_0x7b22('0xc')]=function(){var _0x5041e3=this['mapAgentsId']['_rr'];this[_0x7b22('0xb')]=_[_0x7b22('0xf')](this[_0x7b22('0xa')],'id');this[_0x7b22('0xb')][_0x7b22('0x10')]=_0x5041e3;};MailQueue['prototype'][_0x7b22('0xd')]=function(){this[_0x7b22('0x11')]=0x0;this[_0x7b22('0x12')]=0x0;for(var _0x375aae=0x0;_0x375aae=0x0?this[_0x7b22('0x15')]:0x0;var _0xabd10f={'id':this['id'],'available':this[_0x7b22('0x15')],'loggedIn':this[_0x7b22('0x11')],'name':this['name'],'paused':this[_0x7b22('0x12')],'waiting':this['waiting']};var _0xeddf90=md5(JSON[_0x7b22('0x16')](_0xabd10f));if(this['md5']!==_0xeddf90){this[_0x7b22('0x0')]=_0xeddf90;io['to'](util['format'](_0x7b22('0x17'),_0xabd10f['name']))[_0x7b22('0x18')]('mail_queue:save',_0xabd10f);}};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 5ecced7..bb84801 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 _0x1261=['available','stringify','openchannel:queue:%s','openchannel_queue:save','exports','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','prototype','mapAgentsId','map','_rr','updateRealtime','loggedIn','paused','length','online'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0x1261,0x144));var _0x1126=function(_0x2b93a5,_0x31934c){_0x2b93a5=_0x2b93a5-0x0;var _0x4111dc=_0x1261[_0x2b93a5];return _0x4111dc;};'use strict';var _=require('lodash');var md5=require(_0x1126('0x0'));var util=require(_0x1126('0x1'));var Redis=require(_0x1126('0x2'));var config=require(_0x1126('0x3'));config[_0x1126('0x4')]=_[_0x1126('0x5')](config[_0x1126('0x4')],{'host':_0x1126('0x6'),'port':0x18eb});var io=require(_0x1126('0x7'))(new Redis(config[_0x1126('0x4')]));function OpenchannelQueue(_0x5a2189){this['id']=_0x5a2189['id']||0x0;this['name']=_0x5a2189[_0x1126('0x8')]||'';this[_0x1126('0x9')]=_0x5a2189['timeout']||0xa;this[_0x1126('0xa')]=_0x5a2189[_0x1126('0xa')]||_0x1126('0xb');this[_0x1126('0xc')]=_0x5a2189[_0x1126('0xc')];this['mapAgentsId']={};this[_0x1126('0xd')]=0x0;this[_0x1126('0x0')]='';this[_0x1126('0xe')]();this['updateRealtime']();}OpenchannelQueue[_0x1126('0xf')]['updateRouting']=function(){var _0x52ef15=this[_0x1126('0x10')]['_rr'];this[_0x1126('0x10')]=_[_0x1126('0x11')](this[_0x1126('0xc')],'id');this[_0x1126('0x10')][_0x1126('0x12')]=_0x52ef15;};OpenchannelQueue[_0x1126('0xf')][_0x1126('0x13')]=function(){this[_0x1126('0x14')]=0x0;this[_0x1126('0x15')]=0x0;for(var _0x53a8f0=0x0;_0x53a8f0=0x0?this['available']:0x0;var _0x4d2b38={'id':this['id'],'available':this[_0x1126('0x18')],'loggedIn':this[_0x1126('0x14')],'name':this['name'],'paused':this['paused'],'waiting':this[_0x1126('0xd')]};var _0x58b109=md5(JSON[_0x1126('0x19')](_0x4d2b38));if(this[_0x1126('0x0')]!==_0x58b109){this[_0x1126('0x0')]=_0x58b109;io['to'](util['format'](_0x1126('0x1a'),_0x4d2b38['name']))['emit'](_0x1126('0x1b'),_0x4d2b38);}};module[_0x1126('0x1c')]=OpenchannelQueue; \ No newline at end of file +var _0x1261=['available','stringify','openchannel:queue:%s','openchannel_queue:save','exports','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','prototype','mapAgentsId','map','_rr','updateRealtime','loggedIn','paused','length','online'];(function(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0x1261,0x144));var _0x1126=function(_0x1392c4,_0x5a51c6){_0x1392c4=_0x1392c4-0x0;var _0x179f77=_0x1261[_0x1392c4];return _0x179f77;};'use strict';var _=require('lodash');var md5=require(_0x1126('0x0'));var util=require(_0x1126('0x1'));var Redis=require(_0x1126('0x2'));var config=require(_0x1126('0x3'));config[_0x1126('0x4')]=_[_0x1126('0x5')](config[_0x1126('0x4')],{'host':_0x1126('0x6'),'port':0x18eb});var io=require(_0x1126('0x7'))(new Redis(config[_0x1126('0x4')]));function OpenchannelQueue(_0x5a2189){this['id']=_0x5a2189['id']||0x0;this['name']=_0x5a2189[_0x1126('0x8')]||'';this[_0x1126('0x9')]=_0x5a2189['timeout']||0xa;this[_0x1126('0xa')]=_0x5a2189[_0x1126('0xa')]||_0x1126('0xb');this[_0x1126('0xc')]=_0x5a2189[_0x1126('0xc')];this['mapAgentsId']={};this[_0x1126('0xd')]=0x0;this[_0x1126('0x0')]='';this[_0x1126('0xe')]();this['updateRealtime']();}OpenchannelQueue[_0x1126('0xf')]['updateRouting']=function(){var _0x52ef15=this[_0x1126('0x10')]['_rr'];this[_0x1126('0x10')]=_[_0x1126('0x11')](this[_0x1126('0xc')],'id');this[_0x1126('0x10')][_0x1126('0x12')]=_0x52ef15;};OpenchannelQueue[_0x1126('0xf')][_0x1126('0x13')]=function(){this[_0x1126('0x14')]=0x0;this[_0x1126('0x15')]=0x0;for(var _0x53a8f0=0x0;_0x53a8f0=0x0?this['available']:0x0;var _0x4d2b38={'id':this['id'],'available':this[_0x1126('0x18')],'loggedIn':this[_0x1126('0x14')],'name':this['name'],'paused':this['paused'],'waiting':this[_0x1126('0xd')]};var _0x58b109=md5(JSON[_0x1126('0x19')](_0x4d2b38));if(this[_0x1126('0x0')]!==_0x58b109){this[_0x1126('0x0')]=_0x58b109;io['to'](util['format'](_0x1126('0x1a'),_0x4d2b38['name']))['emit'](_0x1126('0x1b'),_0x4d2b38);}};module[_0x1126('0x1c')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 8fe3574..81dd827 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 _0x6f7f=['../../../config/environment','redis','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','prototype','updateRouting','mapAgentsId','_rr','updateRealtime','length','online','loggedIn','smsPause','paused','available','stringify','format','sms:queue:%s','sms_queue:save','md5','util','ioredis'];(function(_0x8506df,_0x23a65f){var _0x42f5d7=function(_0x137f0f){while(--_0x137f0f){_0x8506df['push'](_0x8506df['shift']());}};_0x42f5d7(++_0x23a65f);}(_0x6f7f,0x177));var _0xf6f7=function(_0x281c78,_0x3c964f){_0x281c78=_0x281c78-0x0;var _0x19a7b0=_0x6f7f[_0x281c78];return _0x19a7b0;};'use strict';var _=require('lodash');var md5=require(_0xf6f7('0x0'));var util=require(_0xf6f7('0x1'));var Redis=require(_0xf6f7('0x2'));var config=require(_0xf6f7('0x3'));config[_0xf6f7('0x4')]=_['defaults'](config[_0xf6f7('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0xf6f7('0x5'))(new Redis(config[_0xf6f7('0x4')]));function SmsQueue(_0x437847){this['id']=_0x437847['id']||0x0;this['name']=_0x437847[_0xf6f7('0x6')]||'';this['timeout']=_0x437847[_0xf6f7('0x7')]||0xa;this[_0xf6f7('0x8')]=_0x437847[_0xf6f7('0x8')]||_0xf6f7('0x9');this[_0xf6f7('0xa')]=_0x437847[_0xf6f7('0xa')];this['mapAgentsId']={};this[_0xf6f7('0xb')]=0x0;this['md5']='';this['updateRouting']();this['updateRealtime']();}SmsQueue[_0xf6f7('0xc')][_0xf6f7('0xd')]=function(){var _0x32e3dd=this[_0xf6f7('0xe')][_0xf6f7('0xf')];this[_0xf6f7('0xe')]=_['map'](this['Agents'],'id');this[_0xf6f7('0xe')][_0xf6f7('0xf')]=_0x32e3dd;};SmsQueue[_0xf6f7('0xc')][_0xf6f7('0x10')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0xc4fe52=0x0;_0xc4fe52=0x0?this[_0xf6f7('0x16')]:0x0;var _0xc23839={'id':this['id'],'available':this[_0xf6f7('0x16')],'loggedIn':this['loggedIn'],'name':this[_0xf6f7('0x6')],'paused':this[_0xf6f7('0x15')],'waiting':this['waiting']};var _0x1a7ba2=md5(JSON[_0xf6f7('0x17')](_0xc23839));if(this[_0xf6f7('0x0')]!==_0x1a7ba2){this[_0xf6f7('0x0')]=_0x1a7ba2;io['to'](util[_0xf6f7('0x18')](_0xf6f7('0x19'),_0xc23839[_0xf6f7('0x6')]))['emit'](_0xf6f7('0x1a'),_0xc23839);}};module['exports']=SmsQueue; \ No newline at end of file +var _0x630e=['socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRealtime','prototype','updateRouting','_rr','map','loggedIn','paused','length','online','smsPause','available','stringify','md5','format','sms:queue:%s','emit','sms_queue:save','lodash','util','redis','defaults'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0x630e,0x1af));var _0xe630=function(_0xa28740,_0x56facc){_0xa28740=_0xa28740-0x0;var _0x561194=_0x630e[_0xa28740];return _0x561194;};'use strict';var _=require(_0xe630('0x0'));var md5=require('md5');var util=require(_0xe630('0x1'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0xe630('0x2')]=_[_0xe630('0x3')](config[_0xe630('0x2')],{'host':'localhost','port':0x18eb});var io=require(_0xe630('0x4'))(new Redis(config[_0xe630('0x2')]));function SmsQueue(_0xacb786){this['id']=_0xacb786['id']||0x0;this[_0xe630('0x5')]=_0xacb786[_0xe630('0x5')]||'';this['timeout']=_0xacb786[_0xe630('0x6')]||0xa;this[_0xe630('0x7')]=_0xacb786['strategy']||_0xe630('0x8');this['Agents']=_0xacb786[_0xe630('0x9')];this[_0xe630('0xa')]={};this[_0xe630('0xb')]=0x0;this['md5']='';this['updateRouting']();this[_0xe630('0xc')]();}SmsQueue[_0xe630('0xd')][_0xe630('0xe')]=function(){var _0x270d96=this['mapAgentsId'][_0xe630('0xf')];this[_0xe630('0xa')]=_[_0xe630('0x10')](this[_0xe630('0x9')],'id');this[_0xe630('0xa')][_0xe630('0xf')]=_0x270d96;};SmsQueue[_0xe630('0xd')][_0xe630('0xc')]=function(){this[_0xe630('0x11')]=0x0;this[_0xe630('0x12')]=0x0;for(var _0xe92984=0x0;_0xe92984=0x0?this[_0xe630('0x16')]:0x0;var _0x9721fa={'id':this['id'],'available':this[_0xe630('0x16')],'loggedIn':this[_0xe630('0x11')],'name':this[_0xe630('0x5')],'paused':this[_0xe630('0x12')],'waiting':this[_0xe630('0xb')]};var _0x29a67f=md5(JSON[_0xe630('0x17')](_0x9721fa));if(this[_0xe630('0x18')]!==_0x29a67f){this[_0xe630('0x18')]=_0x29a67f;io['to'](util[_0xe630('0x19')](_0xe630('0x1a'),_0x9721fa[_0xe630('0x5')]))[_0xe630('0x1b')](_0xe630('0x1c'),_0x9721fa);}};module['exports']=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index e60a79f..290ae90 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 _0x72aa=['map','updateRealtime','loggedIn','paused','online','whatsappPause','available','stringify','whatsapp:queue:%s','emit','exports','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','Agents','waiting','updateRouting','mapAgentsId','_rr'];(function(_0x5012c3,_0x3501c3){var _0x42eec3=function(_0x3d4fe7){while(--_0x3d4fe7){_0x5012c3['push'](_0x5012c3['shift']());}};_0x42eec3(++_0x3501c3);}(_0x72aa,0x129));var _0xa72a=function(_0x14f217,_0x2172f3){_0x14f217=_0x14f217-0x0;var _0xf29a4a=_0x72aa[_0x14f217];return _0xf29a4a;};'use strict';var _=require('lodash');var md5=require(_0xa72a('0x0'));var util=require('util');var Redis=require(_0xa72a('0x1'));var config=require(_0xa72a('0x2'));config[_0xa72a('0x3')]=_[_0xa72a('0x4')](config[_0xa72a('0x3')],{'host':_0xa72a('0x5'),'port':0x18eb});var io=require(_0xa72a('0x6'))(new Redis(config['redis']));function WhatsappQueue(_0xe6a4b6){this['id']=_0xe6a4b6['id']||0x0;this[_0xa72a('0x7')]=_0xe6a4b6[_0xa72a('0x7')]||'';this[_0xa72a('0x8')]=_0xe6a4b6[_0xa72a('0x8')]||0xa;this[_0xa72a('0x9')]=_0xe6a4b6[_0xa72a('0x9')]||'beepall';this[_0xa72a('0xa')]=_0xe6a4b6[_0xa72a('0xa')];this['mapAgentsId']={};this[_0xa72a('0xb')]=0x0;this[_0xa72a('0x0')]='';this[_0xa72a('0xc')]();this['updateRealtime']();}WhatsappQueue['prototype'][_0xa72a('0xc')]=function(){var _0x12fb32=this[_0xa72a('0xd')][_0xa72a('0xe')];this['mapAgentsId']=_[_0xa72a('0xf')](this[_0xa72a('0xa')],'id');this[_0xa72a('0xd')]['_rr']=_0x12fb32;};WhatsappQueue['prototype'][_0xa72a('0x10')]=function(){this[_0xa72a('0x11')]=0x0;this[_0xa72a('0x12')]=0x0;for(var _0x5f2e6c=0x0;_0x5f2e6c=0x0?this[_0xa72a('0x15')]:0x0;var _0x1e55b8={'id':this['id'],'available':this[_0xa72a('0x15')],'loggedIn':this[_0xa72a('0x11')],'name':this[_0xa72a('0x7')],'paused':this[_0xa72a('0x12')],'waiting':this[_0xa72a('0xb')]};var _0x48c5c1=md5(JSON[_0xa72a('0x16')](_0x1e55b8));if(this[_0xa72a('0x0')]!==_0x48c5c1){this['md5']=_0x48c5c1;io['to'](util['format'](_0xa72a('0x17'),_0x1e55b8['name']))[_0xa72a('0x18')]('whatsapp_queue:save',_0x1e55b8);}};module[_0xa72a('0x19')]=WhatsappQueue; \ No newline at end of file +var _0x30af=['redis','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRealtime','prototype','updateRouting','map','_rr','paused','loggedIn','available','format','whatsapp:queue:%s','lodash','md5','util'];(function(_0x892a59,_0x3a2efe){var _0xdeb8f=function(_0x543bdd){while(--_0x543bdd){_0x892a59['push'](_0x892a59['shift']());}};_0xdeb8f(++_0x3a2efe);}(_0x30af,0x1cb));var _0xf30a=function(_0x175866,_0x1e48a6){_0x175866=_0x175866-0x0;var _0x4a561b=_0x30af[_0x175866];return _0x4a561b;};'use strict';var _=require(_0xf30a('0x0'));var md5=require(_0xf30a('0x1'));var util=require(_0xf30a('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0xf30a('0x3')]=_['defaults'](config[_0xf30a('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0xf30a('0x4'))(new Redis(config[_0xf30a('0x3')]));function WhatsappQueue(_0x2f69f5){this['id']=_0x2f69f5['id']||0x0;this[_0xf30a('0x5')]=_0x2f69f5[_0xf30a('0x5')]||'';this[_0xf30a('0x6')]=_0x2f69f5[_0xf30a('0x6')]||0xa;this['strategy']=_0x2f69f5[_0xf30a('0x7')]||_0xf30a('0x8');this[_0xf30a('0x9')]=_0x2f69f5[_0xf30a('0x9')];this[_0xf30a('0xa')]={};this[_0xf30a('0xb')]=0x0;this[_0xf30a('0x1')]='';this['updateRouting']();this[_0xf30a('0xc')]();}WhatsappQueue[_0xf30a('0xd')][_0xf30a('0xe')]=function(){var _0x507bc7=this[_0xf30a('0xa')]['_rr'];this[_0xf30a('0xa')]=_[_0xf30a('0xf')](this[_0xf30a('0x9')],'id');this[_0xf30a('0xa')][_0xf30a('0x10')]=_0x507bc7;};WhatsappQueue[_0xf30a('0xd')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0xf30a('0x11')]=0x0;for(var _0x45ad31=0x0;_0x45ad31=0x0?this['available']:0x0;var _0x1f68a7={'id':this['id'],'available':this[_0xf30a('0x13')],'loggedIn':this[_0xf30a('0x12')],'name':this[_0xf30a('0x5')],'paused':this[_0xf30a('0x11')],'waiting':this['waiting']};var _0x197e24=md5(JSON['stringify'](_0x1f68a7));if(this[_0xf30a('0x1')]!==_0x197e24){this[_0xf30a('0x1')]=_0x197e24;io['to'](util[_0xf30a('0x14')](_0xf30a('0x15'),_0x1f68a7['name']))['emit']('whatsapp_queue:save',_0x1f68a7);}};module['exports']=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index e0c6947..612132c 100644 --- a/server/services/routing/realtime/index.js +++ b/server/services/routing/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','isUndefined','initIntervals','length','initOpenchannelQueues','updateRealtime','initChatQueues','chatQueues','initSmsQueues','updateRouting','initMailQueues','initFaxQueues','initWhatsappQueues','exports','bluebird','lodash','moment','../model/agent','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','smsQueues','mailQueues'];(function(_0x51dfcb,_0x20d7f6){var _0x477ad3=function(_0x56e301){while(--_0x56e301){_0x51dfcb['push'](_0x51dfcb['shift']());}};_0x477ad3(++_0x20d7f6);}(_0xb10b,0x12a));var _0xbb10=function(_0x53bf11,_0x3acb5e){_0x53bf11=_0x53bf11-0x0;var _0x3a4f47=_0xb10b[_0x53bf11];return _0x3a4f47;};'use strict';var BPromise=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var Agent=require(_0xbb10('0x3'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xbb10('0x4'));var ChatQueue=require(_0xbb10('0x5'));var SmsQueue=require(_0xbb10('0x6'));var MailQueue=require(_0xbb10('0x7'));var FaxQueue=require(_0xbb10('0x8'));var WhatsappQueue=require(_0xbb10('0x9'));var Realtime=function(){this['agents']={};this[_0xbb10('0xa')]={};this[_0xbb10('0xb')]={};this['chatQueues']={};this[_0xbb10('0xc')]={};this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]={};this[_0xbb10('0xf')]={};this[_0xbb10('0x10')]={};this[_0xbb10('0x11')]={};this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x20bd61,_0x118a74,_0xce64f3){var _0x5e136d=_[_0xbb10('0x14')](_0x20bd61,function(_0x5be7e0,_0x44fb19){return _0x5be7e0[_0xce64f3];});for(var _0x916a32 in _0x118a74){if(_0x118a74[_0xbb10('0x15')](_0x916a32)){if(!_0x5e136d[_0x916a32]){delete _0x118a74[_0x916a32];}}}}Realtime[_0xbb10('0x16')][_0xbb10('0x17')]=function(_0x147230,_0x58a612){for(var _0x26e021 in _0x58a612){if(_0x147230[_0xbb10('0x15')](_0x26e021)){_0x147230[_0x26e021]=_0x58a612[_0x26e021];}}};Realtime[_0xbb10('0x16')][_0xbb10('0x18')]=function(){var _0x3df17b=this;return function(_0x2f2ebf){if(_0x2f2ebf){freeIsNotKey(_0x2f2ebf,_0x3df17b[_0xbb10('0x19')],'id');for(var _0x36b5e8=0x0,_0x3e26f4={},_0x2b184e={};_0x36b5e8<_0x2f2ebf['length'];_0x36b5e8+=0x1){_0x3e26f4=_0x2f2ebf[_0x36b5e8];if(_[_0xbb10('0x1a')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']])){_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']]=new Agent(_0x3e26f4);}else{_0x3df17b[_0xbb10('0x17')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']],_0x3e26f4);}}}return _0x3df17b[_0xbb10('0x19')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x1b')]=function(){var _0xbf2906=this;return function(_0xe1c665){if(_0xe1c665){freeIsNotKey(_0xe1c665,_0xbf2906['intervals'],'id');for(var _0x5ff0cf=0x0,_0x19f48d={},_0x388fab={};_0x5ff0cf<_0xe1c665[_0xbb10('0x1c')];_0x5ff0cf+=0x1){_0x19f48d=_0xe1c665[_0x5ff0cf];if(_[_0xbb10('0x1a')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']])){_0xbf2906['intervals'][_0x19f48d['id']]=new Interval(_0x19f48d);}else{_0xbf2906[_0xbb10('0x17')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']],_0x19f48d);}}}return _0xbf2906['intervals'];};};Realtime['prototype'][_0xbb10('0x1d')]=function(){var _0x311abe=this;return function(_0x2e911d){if(_0x2e911d){freeIsNotKey(_0x2e911d,_0x311abe[_0xbb10('0xb')],'id');for(var _0x445761=0x0,_0x1824b7={},_0x407cb4={};_0x445761<_0x2e911d[_0xbb10('0x1c')];_0x445761+=0x1){_0x1824b7=_0x2e911d[_0x445761];if(_[_0xbb10('0x1a')](_0x311abe[_0xbb10('0xb')][_0x1824b7['id']])){_0x311abe[_0xbb10('0xb')][_0x1824b7['id']]=new OpenchannelQueue(_0x1824b7);}else{_0x311abe[_0xbb10('0x17')](_0x311abe['openchannelQueues'][_0x1824b7['id']],_0x1824b7);}_0x311abe['openchannelQueues'][_0x1824b7['id']]['updateRouting']();_0x311abe[_0xbb10('0xb')][_0x1824b7['id']][_0xbb10('0x1e')]();}}return _0x311abe[_0xbb10('0xb')];};};Realtime['prototype'][_0xbb10('0x1f')]=function(){var _0x24d586=this;return function(_0x6ed43b){if(_0x6ed43b){freeIsNotKey(_0x6ed43b,_0x24d586[_0xbb10('0x20')],'id');for(var _0x1acce9=0x0,_0x20d946={},_0x2a0e8b={};_0x1acce9<_0x6ed43b['length'];_0x1acce9+=0x1){_0x20d946=_0x6ed43b[_0x1acce9];if(_[_0xbb10('0x1a')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']])){_0x24d586[_0xbb10('0x20')][_0x20d946['id']]=new ChatQueue(_0x20d946);}else{_0x24d586[_0xbb10('0x17')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']],_0x20d946);}_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRouting']();_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRealtime']();}}return _0x24d586[_0xbb10('0x20')];};};Realtime['prototype'][_0xbb10('0x21')]=function(){var _0x1dcc9c=this;return function(_0x1b59f9){if(_0x1b59f9){freeIsNotKey(_0x1b59f9,_0x1dcc9c['smsQueues'],'id');for(var _0x518d47=0x0,_0x4c3744={},_0x34f65e={};_0x518d47<_0x1b59f9['length'];_0x518d47+=0x1){_0x4c3744=_0x1b59f9[_0x518d47];if(_[_0xbb10('0x1a')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']])){_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']]=new SmsQueue(_0x4c3744);}else{_0x1dcc9c[_0xbb10('0x17')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']],_0x4c3744);}_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']][_0xbb10('0x22')]();_0x1dcc9c['smsQueues'][_0x4c3744['id']][_0xbb10('0x1e')]();}}return _0x1dcc9c[_0xbb10('0xc')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x23')]=function(){var _0xfb2c5e=this;return function(_0x9de708){if(_0x9de708){freeIsNotKey(_0x9de708,_0xfb2c5e[_0xbb10('0xd')],'id');for(var _0x10202c=0x0,_0x3c8d7d={},_0x56943c={};_0x10202c<_0x9de708[_0xbb10('0x1c')];_0x10202c+=0x1){_0x3c8d7d=_0x9de708[_0x10202c];if(_[_0xbb10('0x1a')](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']])){_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']]=new MailQueue(_0x3c8d7d);}else{_0xfb2c5e['mergeFromDatabase'](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']],_0x3c8d7d);}_0xfb2c5e['mailQueues'][_0x3c8d7d['id']]['updateRouting']();_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']][_0xbb10('0x1e')]();}}return _0xfb2c5e[_0xbb10('0xd')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x24')]=function(){var _0x29d11a=this;return function(_0x547062){if(_0x547062){freeIsNotKey(_0x547062,_0x29d11a[_0xbb10('0xe')],'id');for(var _0x25d72f=0x0,_0x52de31={},_0x5e3fbd={};_0x25d72f<_0x547062['length'];_0x25d72f+=0x1){_0x52de31=_0x547062[_0x25d72f];if(_[_0xbb10('0x1a')](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']])){_0x29d11a[_0xbb10('0xe')][_0x52de31['id']]=new FaxQueue(_0x52de31);}else{_0x29d11a['mergeFromDatabase'](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']],_0x52de31);}_0x29d11a[_0xbb10('0xe')][_0x52de31['id']][_0xbb10('0x22')]();_0x29d11a['faxQueues'][_0x52de31['id']][_0xbb10('0x1e')]();}}return _0x29d11a[_0xbb10('0xe')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x25')]=function(){var _0x4f1cdd=this;return function(_0xd238e9){if(_0xd238e9){freeIsNotKey(_0xd238e9,_0x4f1cdd[_0xbb10('0xf')],'id');for(var _0x5835fd=0x0,_0xe2040f={},_0x2e3214={};_0x5835fd<_0xd238e9[_0xbb10('0x1c')];_0x5835fd+=0x1){_0xe2040f=_0xd238e9[_0x5835fd];if(_[_0xbb10('0x1a')](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']])){_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]=new WhatsappQueue(_0xe2040f);}else{_0x4f1cdd['mergeFromDatabase'](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']],_0xe2040f);}_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']][_0xbb10('0x22')]();_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]['updateRealtime']();}}return _0x4f1cdd[_0xbb10('0xf')];};};module[_0xbb10('0x26')]=Realtime; \ No newline at end of file +var _0xb10b=['faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','isUndefined','initIntervals','length','initOpenchannelQueues','updateRealtime','initChatQueues','chatQueues','initSmsQueues','updateRouting','initMailQueues','initFaxQueues','initWhatsappQueues','exports','bluebird','lodash','moment','../model/agent','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','smsQueues','mailQueues'];(function(_0x5e5123,_0x23b9c9){var _0xea709f=function(_0x2d1259){while(--_0x2d1259){_0x5e5123['push'](_0x5e5123['shift']());}};_0xea709f(++_0x23b9c9);}(_0xb10b,0x12a));var _0xbb10=function(_0xc55d64,_0x133f2d){_0xc55d64=_0xc55d64-0x0;var _0x4194f6=_0xb10b[_0xc55d64];return _0x4194f6;};'use strict';var BPromise=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var Agent=require(_0xbb10('0x3'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xbb10('0x4'));var ChatQueue=require(_0xbb10('0x5'));var SmsQueue=require(_0xbb10('0x6'));var MailQueue=require(_0xbb10('0x7'));var FaxQueue=require(_0xbb10('0x8'));var WhatsappQueue=require(_0xbb10('0x9'));var Realtime=function(){this['agents']={};this[_0xbb10('0xa')]={};this[_0xbb10('0xb')]={};this['chatQueues']={};this[_0xbb10('0xc')]={};this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]={};this[_0xbb10('0xf')]={};this[_0xbb10('0x10')]={};this[_0xbb10('0x11')]={};this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x20bd61,_0x118a74,_0xce64f3){var _0x5e136d=_[_0xbb10('0x14')](_0x20bd61,function(_0x5be7e0,_0x44fb19){return _0x5be7e0[_0xce64f3];});for(var _0x916a32 in _0x118a74){if(_0x118a74[_0xbb10('0x15')](_0x916a32)){if(!_0x5e136d[_0x916a32]){delete _0x118a74[_0x916a32];}}}}Realtime[_0xbb10('0x16')][_0xbb10('0x17')]=function(_0x147230,_0x58a612){for(var _0x26e021 in _0x58a612){if(_0x147230[_0xbb10('0x15')](_0x26e021)){_0x147230[_0x26e021]=_0x58a612[_0x26e021];}}};Realtime[_0xbb10('0x16')][_0xbb10('0x18')]=function(){var _0x3df17b=this;return function(_0x2f2ebf){if(_0x2f2ebf){freeIsNotKey(_0x2f2ebf,_0x3df17b[_0xbb10('0x19')],'id');for(var _0x36b5e8=0x0,_0x3e26f4={},_0x2b184e={};_0x36b5e8<_0x2f2ebf['length'];_0x36b5e8+=0x1){_0x3e26f4=_0x2f2ebf[_0x36b5e8];if(_[_0xbb10('0x1a')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']])){_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']]=new Agent(_0x3e26f4);}else{_0x3df17b[_0xbb10('0x17')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']],_0x3e26f4);}}}return _0x3df17b[_0xbb10('0x19')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x1b')]=function(){var _0xbf2906=this;return function(_0xe1c665){if(_0xe1c665){freeIsNotKey(_0xe1c665,_0xbf2906['intervals'],'id');for(var _0x5ff0cf=0x0,_0x19f48d={},_0x388fab={};_0x5ff0cf<_0xe1c665[_0xbb10('0x1c')];_0x5ff0cf+=0x1){_0x19f48d=_0xe1c665[_0x5ff0cf];if(_[_0xbb10('0x1a')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']])){_0xbf2906['intervals'][_0x19f48d['id']]=new Interval(_0x19f48d);}else{_0xbf2906[_0xbb10('0x17')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']],_0x19f48d);}}}return _0xbf2906['intervals'];};};Realtime['prototype'][_0xbb10('0x1d')]=function(){var _0x311abe=this;return function(_0x2e911d){if(_0x2e911d){freeIsNotKey(_0x2e911d,_0x311abe[_0xbb10('0xb')],'id');for(var _0x445761=0x0,_0x1824b7={},_0x407cb4={};_0x445761<_0x2e911d[_0xbb10('0x1c')];_0x445761+=0x1){_0x1824b7=_0x2e911d[_0x445761];if(_[_0xbb10('0x1a')](_0x311abe[_0xbb10('0xb')][_0x1824b7['id']])){_0x311abe[_0xbb10('0xb')][_0x1824b7['id']]=new OpenchannelQueue(_0x1824b7);}else{_0x311abe[_0xbb10('0x17')](_0x311abe['openchannelQueues'][_0x1824b7['id']],_0x1824b7);}_0x311abe['openchannelQueues'][_0x1824b7['id']]['updateRouting']();_0x311abe[_0xbb10('0xb')][_0x1824b7['id']][_0xbb10('0x1e')]();}}return _0x311abe[_0xbb10('0xb')];};};Realtime['prototype'][_0xbb10('0x1f')]=function(){var _0x24d586=this;return function(_0x6ed43b){if(_0x6ed43b){freeIsNotKey(_0x6ed43b,_0x24d586[_0xbb10('0x20')],'id');for(var _0x1acce9=0x0,_0x20d946={},_0x2a0e8b={};_0x1acce9<_0x6ed43b['length'];_0x1acce9+=0x1){_0x20d946=_0x6ed43b[_0x1acce9];if(_[_0xbb10('0x1a')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']])){_0x24d586[_0xbb10('0x20')][_0x20d946['id']]=new ChatQueue(_0x20d946);}else{_0x24d586[_0xbb10('0x17')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']],_0x20d946);}_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRouting']();_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRealtime']();}}return _0x24d586[_0xbb10('0x20')];};};Realtime['prototype'][_0xbb10('0x21')]=function(){var _0x1dcc9c=this;return function(_0x1b59f9){if(_0x1b59f9){freeIsNotKey(_0x1b59f9,_0x1dcc9c['smsQueues'],'id');for(var _0x518d47=0x0,_0x4c3744={},_0x34f65e={};_0x518d47<_0x1b59f9['length'];_0x518d47+=0x1){_0x4c3744=_0x1b59f9[_0x518d47];if(_[_0xbb10('0x1a')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']])){_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']]=new SmsQueue(_0x4c3744);}else{_0x1dcc9c[_0xbb10('0x17')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']],_0x4c3744);}_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']][_0xbb10('0x22')]();_0x1dcc9c['smsQueues'][_0x4c3744['id']][_0xbb10('0x1e')]();}}return _0x1dcc9c[_0xbb10('0xc')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x23')]=function(){var _0xfb2c5e=this;return function(_0x9de708){if(_0x9de708){freeIsNotKey(_0x9de708,_0xfb2c5e[_0xbb10('0xd')],'id');for(var _0x10202c=0x0,_0x3c8d7d={},_0x56943c={};_0x10202c<_0x9de708[_0xbb10('0x1c')];_0x10202c+=0x1){_0x3c8d7d=_0x9de708[_0x10202c];if(_[_0xbb10('0x1a')](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']])){_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']]=new MailQueue(_0x3c8d7d);}else{_0xfb2c5e['mergeFromDatabase'](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']],_0x3c8d7d);}_0xfb2c5e['mailQueues'][_0x3c8d7d['id']]['updateRouting']();_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']][_0xbb10('0x1e')]();}}return _0xfb2c5e[_0xbb10('0xd')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x24')]=function(){var _0x29d11a=this;return function(_0x547062){if(_0x547062){freeIsNotKey(_0x547062,_0x29d11a[_0xbb10('0xe')],'id');for(var _0x25d72f=0x0,_0x52de31={},_0x5e3fbd={};_0x25d72f<_0x547062['length'];_0x25d72f+=0x1){_0x52de31=_0x547062[_0x25d72f];if(_[_0xbb10('0x1a')](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']])){_0x29d11a[_0xbb10('0xe')][_0x52de31['id']]=new FaxQueue(_0x52de31);}else{_0x29d11a['mergeFromDatabase'](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']],_0x52de31);}_0x29d11a[_0xbb10('0xe')][_0x52de31['id']][_0xbb10('0x22')]();_0x29d11a['faxQueues'][_0x52de31['id']][_0xbb10('0x1e')]();}}return _0x29d11a[_0xbb10('0xe')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x25')]=function(){var _0x4f1cdd=this;return function(_0xd238e9){if(_0xd238e9){freeIsNotKey(_0xd238e9,_0x4f1cdd[_0xbb10('0xf')],'id');for(var _0x5835fd=0x0,_0xe2040f={},_0x2e3214={};_0x5835fd<_0xd238e9[_0xbb10('0x1c')];_0x5835fd+=0x1){_0xe2040f=_0xd238e9[_0x5835fd];if(_[_0xbb10('0x1a')](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']])){_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]=new WhatsappQueue(_0xe2040f);}else{_0x4f1cdd['mergeFromDatabase'](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']],_0xe2040f);}_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']][_0xbb10('0x22')]();_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]['updateRealtime']();}}return _0x4f1cdd[_0xbb10('0xf')];};};module[_0xbb10('0x26')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index 0baded1..81e49bc 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 _0xc93d=['update','Request','UpdateChatInteraction','updateChatInteraction','addTags','AddTagsToChatInteraction','addTagsToChatInteraction'];(function(_0x6e808,_0x45cea0){var _0x5d0259=function(_0x327908){while(--_0x327908){_0x6e808['push'](_0x6e808['shift']());}};_0x5d0259(++_0x45cea0);}(_0xc93d,0xe0));var _0xdc93=function(_0x5e4e54,_0x22683c){_0x5e4e54=_0x5e4e54-0x0;var _0x20b557=_0xc93d[_0x5e4e54];return _0x20b557;};'use strict';var client=require('../client');exports[_0xdc93('0x0')]=function(_0x515696,_0xac547f){return client[_0xdc93('0x1')](_0xdc93('0x2'),{'body':_0xac547f,'options':{'where':{'id':_0x515696}},'log':_0xdc93('0x3')});};exports[_0xdc93('0x4')]=function(_0x499570,_0x493dc3){return client[_0xdc93('0x1')](_0xdc93('0x5'),{'body':_0x493dc3,'options':{'where':{'id':_0x499570}},'log':_0xdc93('0x6')});}; \ No newline at end of file +var _0x85d7=['AddTagsToChatInteraction','addTagsToChatInteraction','../client','update','Request','addTags'];(function(_0x575cfd,_0x47ec81){var _0xd863ad=function(_0x53c291){while(--_0x53c291){_0x575cfd['push'](_0x575cfd['shift']());}};_0xd863ad(++_0x47ec81);}(_0x85d7,0xa4));var _0x785d=function(_0x9c3c94,_0x296e5a){_0x9c3c94=_0x9c3c94-0x0;var _0x598937=_0x85d7[_0x9c3c94];return _0x598937;};'use strict';var client=require(_0x785d('0x0'));exports[_0x785d('0x1')]=function(_0x3fb143,_0x18cd63){return client[_0x785d('0x2')]('UpdateChatInteraction',{'body':_0x18cd63,'options':{'where':{'id':_0x3fb143}},'log':'updateChatInteraction'});};exports[_0x785d('0x3')]=function(_0x3b9990,_0x6ce4b5){return client['Request'](_0x785d('0x4'),{'body':_0x6ce4b5,'options':{'where':{'id':_0x3b9990}},'log':_0x785d('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 1689429..a29de90 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 _0x96a7=['createChatMessage','Request'];(function(_0x403dd9,_0xb4a8b3){var _0x16cc29=function(_0x5c679c){while(--_0x5c679c){_0x403dd9['push'](_0x403dd9['shift']());}};_0x16cc29(++_0xb4a8b3);}(_0x96a7,0x1e5));var _0x796a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x96a7[_0x20a584];return _0x4b41a8;};'use strict';var client=require('../client');exports['create']=function(_0x5336a1){return client[_0x796a('0x0')]('CreateChatMessage',{'body':_0x5336a1,'log':_0x796a('0x1')});}; \ No newline at end of file +var _0x1d3e=['create','Request','CreateChatMessage','createChatMessage'];(function(_0x39874d,_0x5d4904){var _0x3fdb62=function(_0x2e2313){while(--_0x2e2313){_0x39874d['push'](_0x39874d['shift']());}};_0x3fdb62(++_0x5d4904);}(_0x1d3e,0x118));var _0xe1d3=function(_0x466a1a,_0x37933b){_0x466a1a=_0x466a1a-0x0;var _0x577165=_0x1d3e[_0x466a1a];return _0x577165;};'use strict';var client=require('../client');exports[_0xe1d3('0x0')]=function(_0x1c1791){return client[_0xe1d3('0x1')](_0xe1d3('0x2'),{'body':_0x1c1791,'log':_0xe1d3('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 4e74be3..34019dd 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 _0x1696=['getChatQueues','../client','Request','GetChatQueue','name','timeout','strategy','User','Agents','online'];(function(_0x2d967a,_0x22a83c){var _0x3caca0=function(_0x706b0c){while(--_0x706b0c){_0x2d967a['push'](_0x2d967a['shift']());}};_0x3caca0(++_0x22a83c);}(_0x1696,0x79));var _0x6169=function(_0x31e2b6,_0x447319){_0x31e2b6=_0x31e2b6-0x0;var _0xee3fac=_0x1696[_0x31e2b6];return _0xee3fac;};'use strict';var client=require(_0x6169('0x0'));exports['getChatQueues']=function(){return function(){return client[_0x6169('0x1')](_0x6169('0x2'),{'options':{'raw':![],'attributes':['id',_0x6169('0x3'),_0x6169('0x4'),_0x6169('0x5')],'include':[{'model':_0x6169('0x6'),'as':_0x6169('0x7'),'attributes':['id',_0x6169('0x3'),_0x6169('0x8'),'chatPause']}]},'log':_0x6169('0x9')});};}; \ No newline at end of file +var _0xb76d=['online','chatPause','../client','Request','GetChatQueue','name','strategy','User','Agents'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0xb76d,0x119));var _0xdb76=function(_0x2a1994,_0x1261dc){_0x2a1994=_0x2a1994-0x0;var _0x5371a6=_0xb76d[_0x2a1994];return _0x5371a6;};'use strict';var client=require(_0xdb76('0x0'));exports['getChatQueues']=function(){return function(){return client[_0xdb76('0x1')](_0xdb76('0x2'),{'options':{'raw':![],'attributes':['id',_0xdb76('0x3'),'timeout',_0xdb76('0x4')],'include':[{'model':_0xdb76('0x5'),'as':_0xdb76('0x6'),'attributes':['id',_0xdb76('0x3'),_0xdb76('0x7'),_0xdb76('0x8')]}]},'log':'getChatQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 6995117..442d474 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 _0x057a=['Request','UpdateChatQueueReport','../client','create','CreateChatQueueReport','update'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x057a,0x1a6));var _0xa057=function(_0x397b60,_0x5d38fb){_0x397b60=_0x397b60-0x0;var _0x49e248=_0x057a[_0x397b60];return _0x49e248;};'use strict';var client=require(_0xa057('0x0'));exports[_0xa057('0x1')]=function(_0x32f0b5){return client['Request'](_0xa057('0x2'),{'body':_0x32f0b5,'log':'CreateChatQueueReport'});};exports[_0xa057('0x3')]=function(_0x92634f,_0x5481b7){return client[_0xa057('0x4')](_0xa057('0x5'),{'body':_0x5481b7,'options':{'where':{'uniqueid':_0x92634f},'order':[['id','DESC']],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file +var _0x0207=['CreateChatQueueReport','update','Request','UpdateChatQueueReport','create'];(function(_0x1ee351,_0x54261b){var _0x245aaf=function(_0x3e4b65){while(--_0x3e4b65){_0x1ee351['push'](_0x1ee351['shift']());}};_0x245aaf(++_0x54261b);}(_0x0207,0x162));var _0x7020=function(_0x391c19,_0xc66a61){_0x391c19=_0x391c19-0x0;var _0x2e6856=_0x0207[_0x391c19];return _0x2e6856;};'use strict';var client=require('../client');exports[_0x7020('0x0')]=function(_0x4a5f80){return client['Request'](_0x7020('0x1'),{'body':_0x4a5f80,'log':_0x7020('0x1')});};exports[_0x7020('0x2')]=function(_0x15db09,_0x2e62fd){return client[_0x7020('0x3')](_0x7020('0x4'),{'body':_0x2e62fd,'options':{'where':{'uniqueid':_0x15db09},'order':[['id','DESC']],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index e4633a7..34d84cc 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(_0x12e073,_0x4d43db){var _0x267748=function(_0x381284){while(--_0x381284){_0x12e073['push'](_0x12e073['shift']());}};_0x267748(++_0x4d43db);}(_0x7a54,0x106));var _0x47a5=function(_0x4b7533,_0x3dfca7){_0x4b7533=_0x4b7533-0x0;var _0x34d954=_0x7a54[_0x4b7533];return _0x34d954;};'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(_0x2e7dd0,_0x2e0016){var _0x5699e4=function(_0x13c379){while(--_0x13c379){_0x2e7dd0['push'](_0x2e7dd0['shift']());}};_0x5699e4(++_0x2e0016);}(_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 1a24a28..719313b 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 _0x1b15=['createFaxMessage','../client','Request'];(function(_0x530e38,_0x5f1d0f){var _0x4b6a58=function(_0xea6fde){while(--_0xea6fde){_0x530e38['push'](_0x530e38['shift']());}};_0x4b6a58(++_0x5f1d0f);}(_0x1b15,0xd3));var _0x51b1=function(_0x38ceb3,_0x18b292){_0x38ceb3=_0x38ceb3-0x0;var _0x23b646=_0x1b15[_0x38ceb3];return _0x23b646;};'use strict';var client=require(_0x51b1('0x0'));exports['create']=function(_0x4f69c4){return client[_0x51b1('0x1')]('CreateFaxMessage',{'body':_0x4f69c4,'log':_0x51b1('0x2')});}; \ No newline at end of file +var _0x2121=['../client','create','Request','CreateFaxMessage'];(function(_0x26d6d9,_0x431cb8){var _0x1b4875=function(_0x41111f){while(--_0x41111f){_0x26d6d9['push'](_0x26d6d9['shift']());}};_0x1b4875(++_0x431cb8);}(_0x2121,0xc4));var _0x1212=function(_0x4c7132,_0x170300){_0x4c7132=_0x4c7132-0x0;var _0x488368=_0x2121[_0x4c7132];return _0x488368;};'use strict';var client=require(_0x1212('0x0'));exports[_0x1212('0x1')]=function(_0x5855a9){return client[_0x1212('0x2')](_0x1212('0x3'),{'body':_0x5855a9,'log':'createFaxMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 05a8561..b3050e2 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 _0x0346=['name','timeout','strategy','User','Agents','faxPause','getFaxQueues'];(function(_0x52bb76,_0x325703){var _0x2f2f21=function(_0x888a73){while(--_0x888a73){_0x52bb76['push'](_0x52bb76['shift']());}};_0x2f2f21(++_0x325703);}(_0x0346,0x11e));var _0x6034=function(_0x343486,_0x31607e){_0x343486=_0x343486-0x0;var _0x50f083=_0x0346[_0x343486];return _0x50f083;};'use strict';var client=require('../client');exports[_0x6034('0x0')]=function(){return function(){return client['Request']('GetFaxQueue',{'options':{'raw':![],'attributes':['id',_0x6034('0x1'),_0x6034('0x2'),_0x6034('0x3')],'include':[{'model':_0x6034('0x4'),'as':_0x6034('0x5'),'attributes':['id',_0x6034('0x1'),'online',_0x6034('0x6')]}]},'log':_0x6034('0x0')});};}; \ No newline at end of file +var _0x31b1=['timeout','strategy','User','online','getFaxQueues','../client','Request','GetFaxQueue','name'];(function(_0x8e9386,_0x3cc60f){var _0x4abf26=function(_0x59de5a){while(--_0x59de5a){_0x8e9386['push'](_0x8e9386['shift']());}};_0x4abf26(++_0x3cc60f);}(_0x31b1,0xdd));var _0x131b=function(_0x4f1546,_0x2682b7){_0x4f1546=_0x4f1546-0x0;var _0x577c49=_0x31b1[_0x4f1546];return _0x577c49;};'use strict';var client=require(_0x131b('0x0'));exports['getFaxQueues']=function(){return function(){return client[_0x131b('0x1')](_0x131b('0x2'),{'options':{'raw':![],'attributes':['id',_0x131b('0x3'),_0x131b('0x4'),_0x131b('0x5')],'include':[{'model':_0x131b('0x6'),'as':'Agents','attributes':['id',_0x131b('0x3'),_0x131b('0x7'),'faxPause']}]},'log':_0x131b('0x8')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index ec3ee8b..86ea8ee 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 _0x8dd0=['update','Request','UpdateFaxQueueReport','../client','create','CreateFaxQueueReport'];(function(_0x33ffc2,_0x5242a6){var _0x519edc=function(_0x22e7d9){while(--_0x22e7d9){_0x33ffc2['push'](_0x33ffc2['shift']());}};_0x519edc(++_0x5242a6);}(_0x8dd0,0x15f));var _0x08dd=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x8dd0[_0x21a9d9];return _0x46adce;};'use strict';var client=require(_0x08dd('0x0'));exports[_0x08dd('0x1')]=function(_0x460c8b){return client['Request'](_0x08dd('0x2'),{'body':_0x460c8b,'log':_0x08dd('0x2')});};exports[_0x08dd('0x3')]=function(_0x2895de,_0x269a5e){return client[_0x08dd('0x4')](_0x08dd('0x5'),{'body':_0x269a5e,'options':{'where':{'uniqueid':_0x2895de},'order':[['id','DESC']],'limit':0x1},'log':_0x08dd('0x5')});}; \ No newline at end of file +var _0xe92e=['DESC','../client','create','Request','CreateFaxQueueReport','update','UpdateFaxQueueReport'];(function(_0x543491,_0x1197dc){var _0x4410b5=function(_0x432503){while(--_0x432503){_0x543491['push'](_0x543491['shift']());}};_0x4410b5(++_0x1197dc);}(_0xe92e,0x15f));var _0xee92=function(_0x4fd7ac,_0x1b5de5){_0x4fd7ac=_0x4fd7ac-0x0;var _0x8673e1=_0xe92e[_0x4fd7ac];return _0x8673e1;};'use strict';var client=require(_0xee92('0x0'));exports[_0xee92('0x1')]=function(_0xb92b8d){return client[_0xee92('0x2')](_0xee92('0x3'),{'body':_0xb92b8d,'log':'CreateFaxQueueReport'});};exports[_0xee92('0x4')]=function(_0x4b6bcf,_0x991a8a){return client['Request'](_0xee92('0x5'),{'body':_0x991a8a,'options':{'where':{'uniqueid':_0x4b6bcf},'order':[['id',_0xee92('0x6')]],'limit':0x1},'log':_0xee92('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 68f947d..6cdb45f 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 _0xdb89=['GetInterval','Interval','interval','../client','getIntervals','Request'];(function(_0x42b789,_0x46d8d4){var _0x3dee14=function(_0x2fe865){while(--_0x2fe865){_0x42b789['push'](_0x42b789['shift']());}};_0x3dee14(++_0x46d8d4);}(_0xdb89,0x1b3));var _0x9db8=function(_0x37cea2,_0x122cb9){_0x37cea2=_0x37cea2-0x0;var _0x1853f6=_0xdb89[_0x37cea2];return _0x1853f6;};'use strict';var client=require(_0x9db8('0x0'));exports[_0x9db8('0x1')]=function(){return function(){return client[_0x9db8('0x2')](_0x9db8('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':_0x9db8('0x4'),'as':'Intervals','attributes':['id','name',_0x9db8('0x5')]}]},'log':_0x9db8('0x1')});};}; \ No newline at end of file +var _0x5268=['getIntervals','Request','GetInterval','name','Interval','Intervals','interval','../client'];(function(_0x2c0be1,_0x1e88f2){var _0x3d4bd2=function(_0x2b5497){while(--_0x2b5497){_0x2c0be1['push'](_0x2c0be1['shift']());}};_0x3d4bd2(++_0x1e88f2);}(_0x5268,0xef));var _0x8526=function(_0x360f2,_0x260602){_0x360f2=_0x360f2-0x0;var _0x55e69b=_0x5268[_0x360f2];return _0x55e69b;};'use strict';var client=require(_0x8526('0x0'));exports[_0x8526('0x1')]=function(){return function(){return client[_0x8526('0x2')](_0x8526('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x8526('0x4')],'include':[{'model':_0x8526('0x5'),'as':_0x8526('0x6'),'attributes':['id',_0x8526('0x4'),_0x8526('0x7')]}]},'log':_0x8526('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 5ed8a72..197f019 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 _0xcf2f=['update','Request','updateMailInteraction','addTags','AddTagsToMailInteraction','addTagsToChatInteraction','../client'];(function(_0x2388a5,_0x9ca163){var _0x242b7d=function(_0x153eff){while(--_0x153eff){_0x2388a5['push'](_0x2388a5['shift']());}};_0x242b7d(++_0x9ca163);}(_0xcf2f,0xa7));var _0xfcf2=function(_0x2f941f,_0x5966a6){_0x2f941f=_0x2f941f-0x0;var _0x5a4f6e=_0xcf2f[_0x2f941f];return _0x5a4f6e;};'use strict';var client=require(_0xfcf2('0x0'));exports[_0xfcf2('0x1')]=function(_0xe6b3a5,_0x3165cf){return client[_0xfcf2('0x2')]('UpdateMailInteraction',{'body':_0x3165cf,'options':{'where':{'id':_0xe6b3a5}},'log':_0xfcf2('0x3')});};exports[_0xfcf2('0x4')]=function(_0x1e3661,_0x34bcaf){return client[_0xfcf2('0x2')](_0xfcf2('0x5'),{'body':_0x34bcaf,'options':{'where':{'id':_0x1e3661}},'log':_0xfcf2('0x6')});}; \ No newline at end of file +var _0xe5af=['update','Request','UpdateMailInteraction','updateMailInteraction','AddTagsToMailInteraction','addTagsToChatInteraction'];(function(_0x2fb50a,_0x2ca9bb){var _0x226504=function(_0x1c5ef1){while(--_0x1c5ef1){_0x2fb50a['push'](_0x2fb50a['shift']());}};_0x226504(++_0x2ca9bb);}(_0xe5af,0x9c));var _0xfe5a=function(_0x43d10f,_0x41d6cd){_0x43d10f=_0x43d10f-0x0;var _0x1d5c30=_0xe5af[_0x43d10f];return _0x1d5c30;};'use strict';var client=require('../client');exports[_0xfe5a('0x0')]=function(_0x189c37,_0x4b1845){return client[_0xfe5a('0x1')](_0xfe5a('0x2'),{'body':_0x4b1845,'options':{'where':{'id':_0x189c37}},'log':_0xfe5a('0x3')});};exports['addTags']=function(_0x1165e3,_0x48e3a7){return client['Request'](_0xfe5a('0x4'),{'body':_0x48e3a7,'options':{'where':{'id':_0x1165e3}},'log':_0xfe5a('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index f67cf69..e7f6696 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 _0x167d=['createMailMessage','create','Request','CreateMailMessage'];(function(_0x5c536f,_0x35608b){var _0xa55af5=function(_0x5de8f7){while(--_0x5de8f7){_0x5c536f['push'](_0x5c536f['shift']());}};_0xa55af5(++_0x35608b);}(_0x167d,0x10d));var _0xd167=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x167d[_0x321bb2];return _0x9c12ed;};'use strict';var client=require('../client');exports[_0xd167('0x0')]=function(_0x3bac80){return client[_0xd167('0x1')](_0xd167('0x2'),{'body':_0x3bac80,'log':_0xd167('0x3')});}; \ No newline at end of file +var _0x3de0=['CreateMailMessage','createMailMessage','../client','create','Request'];(function(_0x141be4,_0x1b4b69){var _0x504186=function(_0x5b97ad){while(--_0x5b97ad){_0x141be4['push'](_0x141be4['shift']());}};_0x504186(++_0x1b4b69);}(_0x3de0,0xac));var _0x03de=function(_0x1bfe5b,_0x1a0da5){_0x1bfe5b=_0x1bfe5b-0x0;var _0x7a4f77=_0x3de0[_0x1bfe5b];return _0x7a4f77;};'use strict';var client=require(_0x03de('0x0'));exports[_0x03de('0x1')]=function(_0x11c8ce){return client[_0x03de('0x2')](_0x03de('0x3'),{'body':_0x11c8ce,'log':_0x03de('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index fa6cc65..917869f 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 _0xa73f=['timeout','strategy','Agents','online','getMailQueues','GetMailQueue'];(function(_0x163ab4,_0xc655a8){var _0x4db1c2=function(_0x2c6869){while(--_0x2c6869){_0x163ab4['push'](_0x163ab4['shift']());}};_0x4db1c2(++_0xc655a8);}(_0xa73f,0x1b4));var _0xfa73=function(_0x4d58b2,_0x5eb4e0){_0x4d58b2=_0x4d58b2-0x0;var _0x53bddc=_0xa73f[_0x4d58b2];return _0x53bddc;};'use strict';var client=require('../client');exports[_0xfa73('0x0')]=function(){return function(){return client['Request'](_0xfa73('0x1'),{'options':{'raw':![],'attributes':['id','name',_0xfa73('0x2'),_0xfa73('0x3')],'include':[{'model':'User','as':_0xfa73('0x4'),'attributes':['id','name',_0xfa73('0x5'),'mailPause']}]},'log':_0xfa73('0x0')});};}; \ No newline at end of file +var _0xcab2=['../client','getMailQueues','Request','GetMailQueue','name','timeout','strategy','User','Agents','online','mailPause'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xcab2,0x160));var _0x2cab=function(_0x18a2e4,_0x506e95){_0x18a2e4=_0x18a2e4-0x0;var _0x2c39eb=_0xcab2[_0x18a2e4];return _0x2c39eb;};'use strict';var client=require(_0x2cab('0x0'));exports[_0x2cab('0x1')]=function(){return function(){return client[_0x2cab('0x2')](_0x2cab('0x3'),{'options':{'raw':![],'attributes':['id',_0x2cab('0x4'),_0x2cab('0x5'),_0x2cab('0x6')],'include':[{'model':_0x2cab('0x7'),'as':_0x2cab('0x8'),'attributes':['id',_0x2cab('0x4'),_0x2cab('0x9'),_0x2cab('0xa')]}]},'log':_0x2cab('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 6cec081..a7944c2 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 _0x1dc6=['update','UpdateMailQueueReport','create','Request','CreateMailQueueReport'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1dc6,0x156));var _0x61dc=function(_0xa1778d,_0x124965){_0xa1778d=_0xa1778d-0x0;var _0x4d5993=_0x1dc6[_0xa1778d];return _0x4d5993;};'use strict';var client=require('../client');exports[_0x61dc('0x0')]=function(_0x507de7){return client[_0x61dc('0x1')](_0x61dc('0x2'),{'body':_0x507de7,'log':_0x61dc('0x2')});};exports[_0x61dc('0x3')]=function(_0x263127,_0x2dba3f){return client[_0x61dc('0x1')](_0x61dc('0x4'),{'body':_0x2dba3f,'options':{'where':{'uniqueid':_0x263127},'order':[['id','DESC']],'limit':0x1},'log':_0x61dc('0x4')});}; \ No newline at end of file +var _0x2309=['CreateMailQueueReport','update','UpdateMailQueueReport','DESC','../client','create','Request'];(function(_0x1c31ff,_0x4d7927){var _0x1c657a=function(_0x46a4e8){while(--_0x46a4e8){_0x1c31ff['push'](_0x1c31ff['shift']());}};_0x1c657a(++_0x4d7927);}(_0x2309,0x100));var _0x9230=function(_0x1da73b,_0x23ed6d){_0x1da73b=_0x1da73b-0x0;var _0x1fcb69=_0x2309[_0x1da73b];return _0x1fcb69;};'use strict';var client=require(_0x9230('0x0'));exports[_0x9230('0x1')]=function(_0x32ccbb){return client[_0x9230('0x2')](_0x9230('0x3'),{'body':_0x32ccbb,'log':_0x9230('0x3')});};exports[_0x9230('0x4')]=function(_0x1f02a4,_0x4c51e6){return client[_0x9230('0x2')](_0x9230('0x5'),{'body':_0x4c51e6,'options':{'where':{'uniqueid':_0x1f02a4},'order':[['id',_0x9230('0x6')]],'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 158055c..cac4200 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 _0x7773=['UpdateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','../client','Request'];(function(_0x3493ec,_0x91e7e4){var _0x2ae8af=function(_0x49e161){while(--_0x49e161){_0x3493ec['push'](_0x3493ec['shift']());}};_0x2ae8af(++_0x91e7e4);}(_0x7773,0x102));var _0x3777=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x7773[_0x19950b];return _0x3c6b41;};'use strict';var client=require(_0x3777('0x0'));exports['update']=function(_0x30604f,_0x379823){return client[_0x3777('0x1')](_0x3777('0x2'),{'body':_0x379823,'options':{'where':{'id':_0x30604f}},'log':'updateOpenchannelInteraction'});};exports[_0x3777('0x3')]=function(_0x1332ac,_0x10495d){return client[_0x3777('0x1')](_0x3777('0x4'),{'body':_0x10495d,'options':{'where':{'id':_0x1332ac}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0xf43c=['UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','update','Request'];(function(_0x35bffb,_0x2853eb){var _0x3505e7=function(_0x40d875){while(--_0x40d875){_0x35bffb['push'](_0x35bffb['shift']());}};_0x3505e7(++_0x2853eb);}(_0xf43c,0x75));var _0xcf43=function(_0x322510,_0x4522ed){_0x322510=_0x322510-0x0;var _0xbcaa29=_0xf43c[_0x322510];return _0xbcaa29;};'use strict';var client=require(_0xcf43('0x0'));exports[_0xcf43('0x1')]=function(_0x49c0e7,_0x5e410f){return client[_0xcf43('0x2')](_0xcf43('0x3'),{'body':_0x5e410f,'options':{'where':{'id':_0x49c0e7}},'log':_0xcf43('0x4')});};exports[_0xcf43('0x5')]=function(_0x36cce1,_0x3daf8e){return client[_0xcf43('0x2')](_0xcf43('0x6'),{'body':_0x3daf8e,'options':{'where':{'id':_0x36cce1}},'log':_0xcf43('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 496297b..3b1742e 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 _0xa19a=['CreateOpenchannelMessage','createOpenchannelMessage','../client','create','Request'];(function(_0x808bc2,_0x1f5f3e){var _0x2148e4=function(_0x39f31a){while(--_0x39f31a){_0x808bc2['push'](_0x808bc2['shift']());}};_0x2148e4(++_0x1f5f3e);}(_0xa19a,0x1e7));var _0xaa19=function(_0x26b90e,_0x444708){_0x26b90e=_0x26b90e-0x0;var _0x1ff1bb=_0xa19a[_0x26b90e];return _0x1ff1bb;};'use strict';var client=require(_0xaa19('0x0'));exports[_0xaa19('0x1')]=function(_0x443dfe){return client[_0xaa19('0x2')](_0xaa19('0x3'),{'body':_0x443dfe,'log':_0xaa19('0x4')});}; \ No newline at end of file +var _0x51d2=['../client','create','Request','CreateOpenchannelMessage','createOpenchannelMessage'];(function(_0x6a0266,_0x1552d6){var _0x309e00=function(_0x17c1d1){while(--_0x17c1d1){_0x6a0266['push'](_0x6a0266['shift']());}};_0x309e00(++_0x1552d6);}(_0x51d2,0xf0));var _0x251d=function(_0x2468b5,_0x506b9e){_0x2468b5=_0x2468b5-0x0;var _0x1056e4=_0x51d2[_0x2468b5];return _0x1056e4;};'use strict';var client=require(_0x251d('0x0'));exports[_0x251d('0x1')]=function(_0x53e494){return client[_0x251d('0x2')](_0x251d('0x3'),{'body':_0x53e494,'log':_0x251d('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 21b5463..a17590a 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 _0xeaa9=['openchannelPause','../client','getOpenchannelQueues','GetOpenchannelQueue','timeout','strategy','User'];(function(_0x5f4ec0,_0x1092e7){var _0xa57cc6=function(_0x1f0f55){while(--_0x1f0f55){_0x5f4ec0['push'](_0x5f4ec0['shift']());}};_0xa57cc6(++_0x1092e7);}(_0xeaa9,0x8d));var _0x9eaa=function(_0xc41eaa,_0xe8cf35){_0xc41eaa=_0xc41eaa-0x0;var _0x2e0132=_0xeaa9[_0xc41eaa];return _0x2e0132;};'use strict';var client=require(_0x9eaa('0x0'));exports[_0x9eaa('0x1')]=function(){return function(){return client['Request'](_0x9eaa('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x9eaa('0x3'),_0x9eaa('0x4')],'include':[{'model':_0x9eaa('0x5'),'as':'Agents','attributes':['id','name','online',_0x9eaa('0x6')]}]},'log':_0x9eaa('0x1')});};}; \ No newline at end of file +var _0xa415=['timeout','strategy','User','Agents','name','openchannelPause','getOpenchannelQueues','GetOpenchannelQueue'];(function(_0x3305de,_0x16582f){var _0x3b5a84=function(_0x57d7e1){while(--_0x57d7e1){_0x3305de['push'](_0x3305de['shift']());}};_0x3b5a84(++_0x16582f);}(_0xa415,0x18e));var _0x5a41=function(_0x539ded,_0x53e10f){_0x539ded=_0x539ded-0x0;var _0x440387=_0xa415[_0x539ded];return _0x440387;};'use strict';var client=require('../client');exports[_0x5a41('0x0')]=function(){return function(){return client['Request'](_0x5a41('0x1'),{'options':{'raw':![],'attributes':['id','name',_0x5a41('0x2'),_0x5a41('0x3')],'include':[{'model':_0x5a41('0x4'),'as':_0x5a41('0x5'),'attributes':['id',_0x5a41('0x6'),'online',_0x5a41('0x7')]}]},'log':_0x5a41('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 4401258..659b69f 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 _0x3eee=['CreateOpenchannelQueueReport','update','Request','UpdateOpenchannelQueueReport','DESC','../client','create'];(function(_0xc920b8,_0xce4cdb){var _0x3370c1=function(_0x257ca3){while(--_0x257ca3){_0xc920b8['push'](_0xc920b8['shift']());}};_0x3370c1(++_0xce4cdb);}(_0x3eee,0x124));var _0xe3ee=function(_0x1641bb,_0x455434){_0x1641bb=_0x1641bb-0x0;var _0x24208e=_0x3eee[_0x1641bb];return _0x24208e;};'use strict';var client=require(_0xe3ee('0x0'));exports[_0xe3ee('0x1')]=function(_0x392035){return client['Request']('CreateOpenchannelQueueReport',{'body':_0x392035,'log':_0xe3ee('0x2')});};exports[_0xe3ee('0x3')]=function(_0x560891,_0x46c19d){return client[_0xe3ee('0x4')](_0xe3ee('0x5'),{'body':_0x46c19d,'options':{'where':{'uniqueid':_0x560891},'order':[['id',_0xe3ee('0x6')]],'limit':0x1},'log':_0xe3ee('0x5')});}; \ No newline at end of file +var _0x57c3=['create','update','Request','DESC','../client'];(function(_0x33c682,_0x455b22){var _0x440d86=function(_0x3df7dc){while(--_0x3df7dc){_0x33c682['push'](_0x33c682['shift']());}};_0x440d86(++_0x455b22);}(_0x57c3,0xc2));var _0x357c=function(_0x4259ca,_0x6d2aaf){_0x4259ca=_0x4259ca-0x0;var _0x34c0d3=_0x57c3[_0x4259ca];return _0x34c0d3;};'use strict';var client=require(_0x357c('0x0'));exports[_0x357c('0x1')]=function(_0x453ad9){return client['Request']('CreateOpenchannelQueueReport',{'body':_0x453ad9,'log':'CreateOpenchannelQueueReport'});};exports[_0x357c('0x2')]=function(_0x1b6624,_0x2aef77){return client[_0x357c('0x3')]('UpdateOpenchannelQueueReport',{'body':_0x2aef77,'options':{'where':{'uniqueid':_0x1b6624},'order':[['id',_0x357c('0x4')]],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 98a3514..549d18b 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 _0xbf07=['update','UpdateSmsInteraction','updateSmsInteraction','Request','../client'];(function(_0x546b26,_0x46e7e1){var _0x3c96ec=function(_0x2251d5){while(--_0x2251d5){_0x546b26['push'](_0x546b26['shift']());}};_0x3c96ec(++_0x46e7e1);}(_0xbf07,0x77));var _0x7bf0=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xbf07[_0x57b54c];return _0x59cc19;};'use strict';var client=require(_0x7bf0('0x0'));exports[_0x7bf0('0x1')]=function(_0x3541f9,_0x1898b8){return client['Request'](_0x7bf0('0x2'),{'body':_0x1898b8,'options':{'where':{'id':_0x3541f9}},'log':_0x7bf0('0x3')});};exports['addTags']=function(_0x4dbbc4,_0x5c956a){return client[_0x7bf0('0x4')]('AddTagsToSmsInteraction',{'body':_0x5c956a,'options':{'where':{'id':_0x4dbbc4}},'log':'addTagsToSmsInteraction'});}; \ No newline at end of file +var _0x6658=['../client','update','Request','UpdateSmsInteraction','updateSmsInteraction','addTags'];(function(_0x41f0de,_0x43c369){var _0x1765e0=function(_0x566298){while(--_0x566298){_0x41f0de['push'](_0x41f0de['shift']());}};_0x1765e0(++_0x43c369);}(_0x6658,0x198));var _0x8665=function(_0x147571,_0x3f2960){_0x147571=_0x147571-0x0;var _0x275681=_0x6658[_0x147571];return _0x275681;};'use strict';var client=require(_0x8665('0x0'));exports[_0x8665('0x1')]=function(_0x2d027a,_0x1a6b0b){return client[_0x8665('0x2')](_0x8665('0x3'),{'body':_0x1a6b0b,'options':{'where':{'id':_0x2d027a}},'log':_0x8665('0x4')});};exports[_0x8665('0x5')]=function(_0x4f1343,_0xf643d8){return client[_0x8665('0x2')]('AddTagsToSmsInteraction',{'body':_0xf643d8,'options':{'where':{'id':_0x4f1343}},'log':'addTagsToSmsInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index d6acd2e..fed23a9 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 _0x3248=['createSmsMessage','../client','create','Request','CreateSmsMessage'];(function(_0x2c6fb9,_0xc7d7c0){var _0x49fd5e=function(_0x3dcbaf){while(--_0x3dcbaf){_0x2c6fb9['push'](_0x2c6fb9['shift']());}};_0x49fd5e(++_0xc7d7c0);}(_0x3248,0xe2));var _0x8324=function(_0x54ed57,_0x22c0ed){_0x54ed57=_0x54ed57-0x0;var _0x4c5afd=_0x3248[_0x54ed57];return _0x4c5afd;};'use strict';var client=require(_0x8324('0x0'));exports[_0x8324('0x1')]=function(_0xb605d3){return client[_0x8324('0x2')](_0x8324('0x3'),{'body':_0xb605d3,'log':_0x8324('0x4')});}; \ No newline at end of file +var _0x5319=['CreateSmsMessage','createSmsMessage','../client'];(function(_0x483102,_0x54e93d){var _0x5cc885=function(_0x54931c){while(--_0x54931c){_0x483102['push'](_0x483102['shift']());}};_0x5cc885(++_0x54e93d);}(_0x5319,0x15e));var _0x9531=function(_0x4e8401,_0x51b328){_0x4e8401=_0x4e8401-0x0;var _0x17269f=_0x5319[_0x4e8401];return _0x17269f;};'use strict';var client=require(_0x9531('0x0'));exports['create']=function(_0x629166){return client['Request'](_0x9531('0x1'),{'body':_0x629166,'log':_0x9531('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 71d10f8..6a10c30 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(_0x442181,_0x13b342){var _0x20e373=function(_0x242f13){while(--_0x242f13){_0x442181['push'](_0x442181['shift']());}};_0x20e373(++_0x13b342);}(_0x70e0,0x17b));var _0x070e=function(_0x1096d8,_0x38abef){_0x1096d8=_0x1096d8-0x0;var _0x17d202=_0x70e0[_0x1096d8];return _0x17d202;};'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 _0xb7e7=['online','../client','Request','name','strategy','Agents'];(function(_0xce5279,_0x189fbe){var _0xa250a2=function(_0x56f73f){while(--_0x56f73f){_0xce5279['push'](_0xce5279['shift']());}};_0xa250a2(++_0x189fbe);}(_0xb7e7,0x121));var _0x7b7e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb7e7[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0x7b7e('0x0'));exports['getSmsQueues']=function(){return function(){return client[_0x7b7e('0x1')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id',_0x7b7e('0x2'),'timeout',_0x7b7e('0x3')],'include':[{'model':'User','as':_0x7b7e('0x4'),'attributes':['id',_0x7b7e('0x2'),_0x7b7e('0x5'),'smsPause']}]},'log':'getSmsQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 6590ec6..49ac93e 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 _0x34e8=['create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC','../client'];(function(_0x1e1a61,_0x52bc08){var _0x56eea7=function(_0x502211){while(--_0x502211){_0x1e1a61['push'](_0x1e1a61['shift']());}};_0x56eea7(++_0x52bc08);}(_0x34e8,0x12c));var _0x834e=function(_0x1e6847,_0x3a075a){_0x1e6847=_0x1e6847-0x0;var _0xaa49e4=_0x34e8[_0x1e6847];return _0xaa49e4;};'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 +var _0x70e0=['create','CreateSmsQueueReport','update','UpdateSmsQueueReport','../client'];(function(_0x45758a,_0x2fb199){var _0x4aa216=function(_0x49cb64){while(--_0x49cb64){_0x45758a['push'](_0x45758a['shift']());}};_0x4aa216(++_0x2fb199);}(_0x70e0,0x17b));var _0x070e=function(_0x48a253,_0x198542){_0x48a253=_0x48a253-0x0;var _0x22fb5a=_0x70e0[_0x48a253];return _0x22fb5a;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(_0x198c2e){return client['Request']('CreateSmsQueueReport',{'body':_0x198c2e,'log':_0x070e('0x2')});};exports[_0x070e('0x3')]=function(_0x277d32,_0x2593e5){return client['Request'](_0x070e('0x4'),{'body':_0x2593e5,'options':{'where':{'uniqueid':_0x277d32},'order':[['id','DESC']],'limit':0x1},'log':_0x070e('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index ec748eb..b23f5f1 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(_0x44c729,_0xd7dcb8){var _0x229128=function(_0x1a1725){while(--_0x1a1725){_0x44c729['push'](_0x44c729['shift']());}};_0x229128(++_0xd7dcb8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'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(_0x574fab,_0x358a29){var _0x333c88=function(_0x19eb73){while(--_0x19eb73){_0x574fab['push'](_0x574fab['shift']());}};_0x333c88(++_0x358a29);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'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 bed1bdc..23c2dfe 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 _0x9e69=['AddTagsToWhatsappInteraction','update','Request','updateWhatsappInteraction','addTags'];(function(_0x1b5e82,_0x281042){var _0x1038fe=function(_0x421b1c){while(--_0x421b1c){_0x1b5e82['push'](_0x1b5e82['shift']());}};_0x1038fe(++_0x281042);}(_0x9e69,0x150));var _0x99e6=function(_0x81750a,_0x24faf9){_0x81750a=_0x81750a-0x0;var _0x358245=_0x9e69[_0x81750a];return _0x358245;};'use strict';var client=require('../client');exports[_0x99e6('0x0')]=function(_0xab6035,_0x10387b){return client[_0x99e6('0x1')]('UpdateWhatsappInteraction',{'body':_0x10387b,'options':{'where':{'id':_0xab6035}},'log':_0x99e6('0x2')});};exports[_0x99e6('0x3')]=function(_0x5f3985,_0x8a6c5c){return client[_0x99e6('0x1')](_0x99e6('0x4'),{'body':_0x8a6c5c,'options':{'where':{'id':_0x5f3985}},'log':'addTagsToWhatsappInteraction'});}; \ No newline at end of file +var _0x1228=['updateWhatsappInteraction','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','Request','UpdateWhatsappInteraction'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x1228,0x12f));var _0x8122=function(_0x110cdc,_0x245a35){_0x110cdc=_0x110cdc-0x0;var _0x4ed9e7=_0x1228[_0x110cdc];return _0x4ed9e7;};'use strict';var client=require(_0x8122('0x0'));exports['update']=function(_0x1e4b58,_0x57c278){return client[_0x8122('0x1')](_0x8122('0x2'),{'body':_0x57c278,'options':{'where':{'id':_0x1e4b58}},'log':_0x8122('0x3')});};exports['addTags']=function(_0x762ce4,_0xf4d3e5){return client['Request'](_0x8122('0x4'),{'body':_0xf4d3e5,'options':{'where':{'id':_0x762ce4}},'log':_0x8122('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 95a9ff2..7eba4fa 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 _0x62d5=['create','Request','CreateWhatsappMessage','../client'];(function(_0x201d98,_0x56fd1f){var _0x1ae057=function(_0xb7eeab){while(--_0xb7eeab){_0x201d98['push'](_0x201d98['shift']());}};_0x1ae057(++_0x56fd1f);}(_0x62d5,0x87));var _0x562d=function(_0x328bd3,_0x9cf5a5){_0x328bd3=_0x328bd3-0x0;var _0x458149=_0x62d5[_0x328bd3];return _0x458149;};'use strict';var client=require(_0x562d('0x0'));exports[_0x562d('0x1')]=function(_0x3e5584){return client[_0x562d('0x2')](_0x562d('0x3'),{'body':_0x3e5584,'log':'createWhatsappMessage'});}; \ No newline at end of file +var _0xfe81=['Request','CreateWhatsappMessage','createWhatsappMessage','create'];(function(_0x535106,_0x256145){var _0x387f18=function(_0x467871){while(--_0x467871){_0x535106['push'](_0x535106['shift']());}};_0x387f18(++_0x256145);}(_0xfe81,0xa3));var _0x1fe8=function(_0x39cf70,_0x3ec55b){_0x39cf70=_0x39cf70-0x0;var _0x580424=_0xfe81[_0x39cf70];return _0x580424;};'use strict';var client=require('../client');exports[_0x1fe8('0x0')]=function(_0x1014e7){return client[_0x1fe8('0x1')](_0x1fe8('0x2'),{'body':_0x1014e7,'log':_0x1fe8('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index b283fea..1e6dee2 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 _0x688f=['GetWhatsappQueue','name','timeout','User','Agents','online','whatsappPause','getWhatsappQueues','Request'];(function(_0x687ddc,_0x2092fa){var _0x441991=function(_0x49c6a6){while(--_0x49c6a6){_0x687ddc['push'](_0x687ddc['shift']());}};_0x441991(++_0x2092fa);}(_0x688f,0x16f));var _0xf688=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x688f[_0x53ccf2];return _0x5a2964;};'use strict';var client=require('../client');exports[_0xf688('0x0')]=function(){return function(){return client[_0xf688('0x1')](_0xf688('0x2'),{'options':{'raw':![],'attributes':['id',_0xf688('0x3'),_0xf688('0x4'),'strategy'],'include':[{'model':_0xf688('0x5'),'as':_0xf688('0x6'),'attributes':['id','name',_0xf688('0x7'),_0xf688('0x8')]}]},'log':'getWhatsappQueues'});};}; \ No newline at end of file +var _0x5519=['strategy','User','Agents','name','online','getWhatsappQueues','Request'];(function(_0x4a6f48,_0x4d8c76){var _0x316207=function(_0x33ab4c){while(--_0x33ab4c){_0x4a6f48['push'](_0x4a6f48['shift']());}};_0x316207(++_0x4d8c76);}(_0x5519,0x75));var _0x9551=function(_0x4d9e69,_0x40c6cc){_0x4d9e69=_0x4d9e69-0x0;var _0x3ad920=_0x5519[_0x4d9e69];return _0x3ad920;};'use strict';var client=require('../client');exports[_0x9551('0x0')]=function(){return function(){return client[_0x9551('0x1')]('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id','name','timeout',_0x9551('0x2')],'include':[{'model':_0x9551('0x3'),'as':_0x9551('0x4'),'attributes':['id',_0x9551('0x5'),_0x9551('0x6'),'whatsappPause']}]},'log':_0x9551('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 5a43d7d..8c07702 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 _0xe0cf=['CreateWhatsappQueueReport','UpdateWhatsappQueueReport','DESC','../client','create','Request'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xe0cf,0x75));var _0xfe0c=function(_0x137f1a,_0x2887df){_0x137f1a=_0x137f1a-0x0;var _0x439923=_0xe0cf[_0x137f1a];return _0x439923;};'use strict';var client=require(_0xfe0c('0x0'));exports[_0xfe0c('0x1')]=function(_0x36d6d0){return client[_0xfe0c('0x2')](_0xfe0c('0x3'),{'body':_0x36d6d0,'log':_0xfe0c('0x3')});};exports['update']=function(_0x402c88,_0x13b2da){return client[_0xfe0c('0x2')](_0xfe0c('0x4'),{'body':_0x13b2da,'options':{'where':{'uniqueid':_0x402c88},'order':[['id',_0xfe0c('0x5')]],'limit':0x1},'log':_0xfe0c('0x4')});}; \ No newline at end of file +var _0xace5=['CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','../client','Request'];(function(_0x3d80bc,_0x235837){var _0x10c590=function(_0x58606e){while(--_0x58606e){_0x3d80bc['push'](_0x3d80bc['shift']());}};_0x10c590(++_0x235837);}(_0xace5,0x18e));var _0x5ace=function(_0x203dcd,_0x5bb31d){_0x203dcd=_0x203dcd-0x0;var _0xd4312f=_0xace5[_0x203dcd];return _0xd4312f;};'use strict';var client=require(_0x5ace('0x0'));exports['create']=function(_0x5964fd){return client[_0x5ace('0x1')](_0x5ace('0x2'),{'body':_0x5964fd,'log':'CreateWhatsappQueueReport'});};exports[_0x5ace('0x3')]=function(_0x45f9ed,_0x1adf5f){return client[_0x5ace('0x1')](_0x5ace('0x4'),{'body':_0x1adf5f,'options':{'where':{'uniqueid':_0x45f9ed},'order':[['id','DESC']],'limit':0x1},'log':_0x5ace('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 14959e3..7f1da9d 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 _0xd263=['rules','info','[%s][AGENT]\x20ROUTING\x20STOPPED','complete','[%s][AGENT]\x20ROUTING\x20END','close','next','[%s][AGENT]\x20agent\x20not\x20found\x20%s','stack','validate','lodash','util','seq-queue','../../../../config/logger','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','length','error','[%s][AGENT]\x20%s','message','join','stop','find','agents','createQueue','channel','START:%s'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd263,0xb3));var _0x3d26=function(_0x4ce07d,_0x17a224){_0x4ce07d=_0x4ce07d-0x0;var _0x362e62=_0xd263[_0x4ce07d];return _0x362e62;};'use strict';var schema=require(_0x3d26('0x0'));var _=require(_0x3d26('0x1'));var util=require(_0x3d26('0x2'));var seqqueue=require(_0x3d26('0x3'));var logger=require(_0x3d26('0x4'))('routing');var strategy=require(_0x3d26('0x5'));var queue=schema({'name':{'type':_0x3d26('0x6'),'required':!![],'message':_0x3d26('0x7')},'timeout':{'type':_0x3d26('0x8'),'message':_0x3d26('0x9')}});function writeLog(_0x413d42,_0x4a6baf,_0x5495f9){return logger['info'](util[_0x3d26('0xa')](_0x3d26('0xb'),_0x413d42,_0x4a6baf['name'],_0x5495f9));}function handleFindAgent(_0x2bf936){return function(_0x38e918){return _0x38e918[_0x3d26('0xc')]['toLowerCase']()===_0x2bf936[_0x3d26('0xd')]();};}exports['consequence']=function(_0x34f351,_0x159aed,_0x9f3bfc,_0x222ef4){return function(_0x25fe56){try{var _0x4d8977={'name':_0x159aed[0x0],'timeout':_0x159aed[0x1]};var _0x12a39a=queue['validate'](_0x4d8977,{'typecast':!![]});if(_0x12a39a[_0x3d26('0xe')]){logger[_0x3d26('0xf')](_0x3d26('0x10'),_0x34f351,_['map'](_0x12a39a,_0x3d26('0x11'))[_0x3d26('0x12')](',\x20'));_0x25fe56[_0x3d26('0x13')]();}else{var _0x4564fd=_[_0x3d26('0x14')](_0x9f3bfc[_0x3d26('0x15')],handleFindAgent(_0x4d8977[_0x3d26('0xc')]));if(_0x4564fd){var _0x4785bc=(_0x4d8977['timeout']||0xa)*0x3e8;var _0x2ce8dd,_0x7b1b8c;var _0x3100d4=seqqueue[_0x3d26('0x16')](_0x4785bc);_0x3100d4['id']=_0x34f351;_0x3100d4['atimeout']=_0x4785bc;_0x3100d4['channel']=_0x222ef4[_0x3d26('0x17')];writeLog(_0x34f351,_0x4564fd,util[_0x3d26('0xa')](_0x3d26('0x18'),_0x4785bc));_0x9f3bfc[_0x3d26('0x19')][_0x34f351]['on']('end',function(){logger[_0x3d26('0x1a')](_0x3d26('0x1b'),_0x34f351);clearTimeout(_0x7b1b8c);_0x7b1b8c=undefined;_0x3100d4['close']();if(_0x9f3bfc[_0x3d26('0x19')][_0x34f351]){delete _0x9f3bfc[_0x3d26('0x19')][_0x34f351];}_0x25fe56['stop']();});_0x9f3bfc[_0x3d26('0x19')][_0x34f351]['on'](_0x3d26('0x1c'),function(){if(_0x9f3bfc[_0x3d26('0x19')][_0x34f351]){delete _0x9f3bfc[_0x3d26('0x19')][_0x34f351];}});_0x7b1b8c=setTimeout(function(){logger[_0x3d26('0x1a')](_0x3d26('0x1d'),_0x34f351);clearTimeout(_0x7b1b8c);_0x3100d4[_0x3d26('0x1e')]();_0x25fe56[_0x3d26('0x1f')]();},_0x4785bc);strategy['agent'](_0x3100d4,_0x4564fd,_0x9f3bfc,_0x222ef4);}else{logger[_0x3d26('0xf')](_0x3d26('0x20'),_0x34f351,_0x4d8977[_0x3d26('0xc')]);_0x25fe56[_0x3d26('0x13')]();}}}catch(_0x56b626){console['log'](_0x56b626);logger[_0x3d26('0xf')]('[%s][QUEUE]\x20%s',_0x34f351,_0x56b626[_0x3d26('0x21')]);_0x25fe56['stop']();}};}; \ No newline at end of file +var _0xa2be=['complete','next','agent','log','stack','validate','lodash','util','seq-queue','../../../../config/logger','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','info','name','toLowerCase','consequence','error','[%s][AGENT]\x20%s','message','join','stop','find','agents','timeout','createQueue','atimeout','channel','format','START:%s','rules','[%s][AGENT]\x20ROUTING\x20STOPPED','close'];(function(_0x46d816,_0x303f7e){var _0x5c20e0=function(_0x22fff8){while(--_0x22fff8){_0x46d816['push'](_0x46d816['shift']());}};_0x5c20e0(++_0x303f7e);}(_0xa2be,0x1ef));var _0xea2b=function(_0x35289d,_0x230ce7){_0x35289d=_0x35289d-0x0;var _0x2dec71=_0xa2be[_0x35289d];return _0x2dec71;};'use strict';var schema=require(_0xea2b('0x0'));var _=require(_0xea2b('0x1'));var util=require(_0xea2b('0x2'));var seqqueue=require(_0xea2b('0x3'));var logger=require(_0xea2b('0x4'))(_0xea2b('0x5'));var strategy=require(_0xea2b('0x6'));var queue=schema({'name':{'type':_0xea2b('0x7'),'required':!![],'message':_0xea2b('0x8')},'timeout':{'type':'number','message':_0xea2b('0x9')}});function writeLog(_0x137760,_0x6c66df,_0x595079){return logger[_0xea2b('0xa')](util['format']('[%s][AGENT][NAME:%s][STATUS:%s]',_0x137760,_0x6c66df[_0xea2b('0xb')],_0x595079));}function handleFindAgent(_0x4c7ee7){return function(_0x7c92ab){return _0x7c92ab['name']['toLowerCase']()===_0x4c7ee7[_0xea2b('0xc')]();};}exports[_0xea2b('0xd')]=function(_0x2c9dcc,_0x29e6a2,_0x3960c1,_0x457037){return function(_0x5ddbf1){try{var _0x353ff6={'name':_0x29e6a2[0x0],'timeout':_0x29e6a2[0x1]};var _0x44e610=queue[_0xea2b('0x0')](_0x353ff6,{'typecast':!![]});if(_0x44e610['length']){logger[_0xea2b('0xe')](_0xea2b('0xf'),_0x2c9dcc,_['map'](_0x44e610,_0xea2b('0x10'))[_0xea2b('0x11')](',\x20'));_0x5ddbf1[_0xea2b('0x12')]();}else{var _0x362215=_[_0xea2b('0x13')](_0x3960c1[_0xea2b('0x14')],handleFindAgent(_0x353ff6['name']));if(_0x362215){var _0x8e87cb=(_0x353ff6[_0xea2b('0x15')]||0xa)*0x3e8;var _0x2437e8,_0x581587;var _0xc0ade1=seqqueue[_0xea2b('0x16')](_0x8e87cb);_0xc0ade1['id']=_0x2c9dcc;_0xc0ade1[_0xea2b('0x17')]=_0x8e87cb;_0xc0ade1[_0xea2b('0x18')]=_0x457037[_0xea2b('0x18')];writeLog(_0x2c9dcc,_0x362215,util[_0xea2b('0x19')](_0xea2b('0x1a'),_0x8e87cb));_0x3960c1[_0xea2b('0x1b')][_0x2c9dcc]['on']('end',function(){logger[_0xea2b('0xa')](_0xea2b('0x1c'),_0x2c9dcc);clearTimeout(_0x581587);_0x581587=undefined;_0xc0ade1[_0xea2b('0x1d')]();if(_0x3960c1[_0xea2b('0x1b')][_0x2c9dcc]){delete _0x3960c1['rules'][_0x2c9dcc];}_0x5ddbf1[_0xea2b('0x12')]();});_0x3960c1[_0xea2b('0x1b')][_0x2c9dcc]['on'](_0xea2b('0x1e'),function(){if(_0x3960c1[_0xea2b('0x1b')][_0x2c9dcc]){delete _0x3960c1[_0xea2b('0x1b')][_0x2c9dcc];}});_0x581587=setTimeout(function(){logger['info']('[%s][AGENT]\x20ROUTING\x20END',_0x2c9dcc);clearTimeout(_0x581587);_0xc0ade1[_0xea2b('0x1d')]();_0x5ddbf1[_0xea2b('0x1f')]();},_0x8e87cb);strategy[_0xea2b('0x20')](_0xc0ade1,_0x362215,_0x3960c1,_0x457037);}else{logger[_0xea2b('0xe')]('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0x2c9dcc,_0x353ff6[_0xea2b('0xb')]);_0x5ddbf1[_0xea2b('0x12')]();}}}catch(_0x293055){console[_0xea2b('0x21')](_0x293055);logger[_0xea2b('0xe')]('[%s][QUEUE]\x20%s',_0x2c9dcc,_0x293055[_0xea2b('0x22')]);_0x5ddbf1[_0xea2b('0x12')]();}};}; \ 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 8344860..eb0379f 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 _0xb60b=['postText','providerName','amazonlex','providerResponse','Message','catch','lodash','moment','./utils','../../../../config/logger','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','interaction','chat','upperFirst','AccountId','account','InteractionId','created','isEmpty','getMustacheRender','create','then','body','error','stringify','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','toString'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xb60b,0x176));var _0xbb60=function(_0x455c6c,_0x1e78b7){_0x455c6c=_0x455c6c-0x0;var _0x488242=_0xb60b[_0x455c6c];return _0x488242;};'use strict';var _=require(_0xbb60('0x0'));var moment=require(_0xbb60('0x1'));var AWS=require('aws-sdk');var utils=require(_0xbb60('0x2'));var logger=require(_0xbb60('0x3'))('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xbb60('0x4')),'faxMessage':require(_0xbb60('0x5')),'whatsappMessage':require(_0xbb60('0x6'))};exports[_0xbb60('0x7')]=function(_0x3f9099,_0x1ccb5e){return function(_0x208aee){try{if(!_['isNil'](this['interaction'][_0xbb60('0x8')])){logger[_0xbb60('0x9')](_0xbb60('0xa'),_0x3f9099,_0xbb60('0xb'));return _0x208aee[_0xbb60('0xc')]();}var _0x3f950d={'ContactId':this['contact']['id'],'sentAt':moment()[_0xbb60('0xd')](_0xbb60('0xe')),'direction':_0xbb60('0xf')};if(this[_0xbb60('0x10')]===_0xbb60('0x11')||this[_0xbb60('0x10')]===_0xbb60('0x12')){_0x3f950d[_0xbb60('0x13')]=this[_0xbb60('0x14')][_0xbb60('0x13')];}var _0x2807f0=this[_0xbb60('0x10')];if(_0x2807f0===_0xbb60('0x15')){_0x3f950d['ChatWebsiteId']=this['account']['id'];}else{_0x3f950d[_[_0xbb60('0x16')](_0x2807f0)+_0xbb60('0x17')]=this[_0xbb60('0x18')]['id'];}_0x3f950d[_[_0xbb60('0x16')](_0x2807f0)+_0xbb60('0x19')]=this[_0xbb60('0x14')]['id'];if(this[_0xbb60('0x14')][_0xbb60('0x1a')]){var _0x25aed5=_0x1ccb5e[0x4];if(!_[_0xbb60('0x1b')](_0x25aed5)){_0x3f950d['body']=utils[_0xbb60('0x1c')](_0x25aed5,this);return rpc[_0x2807f0+'Message'][_0xbb60('0x1d')](_0x3f950d)[_0xbb60('0x1e')](function(_0x2e729e){logger[_0xbb60('0x9')](_0xbb60('0xa'),_0x3f9099,_0x3f950d[_0xbb60('0x1f')]);})['catch'](function(_0x287ace){logger[_0xbb60('0x20')](_0xbb60('0xa'),_0x3f9099,JSON[_0xbb60('0x21')](_0x287ace));})['finally'](function(){logger[_0xbb60('0x9')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x3f9099);_0x208aee[_0xbb60('0x22')]();});}else{logger['info'](_0xbb60('0x23'),_0x3f9099);_0x208aee[_0xbb60('0x22')]();}}else{var _0x500a86=this;var _0x53f22f=new AWS[(_0xbb60('0x24'))]({'accessKeyId':_0x1ccb5e[0x0],'secretAccessKey':_0x1ccb5e[0x1],'region':_0x1ccb5e[0x2]});var _0x5e3452={'botAlias':_0xbb60('0x25'),'botName':_0x1ccb5e[0x3],'inputText':this[_0xbb60('0x26')][_0xbb60('0x1f')],'userId':this[_0xbb60('0x10')]+':'+this['interaction']['id'][_0xbb60('0x27')]()};_0x53f22f[_0xbb60('0x28')](_0x5e3452,function(_0x256985,_0x1bdfd0){if(_0x256985){logger['error'](_0xbb60('0xa'),_0x3f9099,_0x256985['message']);_0x208aee[_0xbb60('0xc')]();}else if(_0x1bdfd0&&_0x1bdfd0['message']){_0x500a86[_0xbb60('0x1f')]['amazonlex']=_0x1bdfd0;_0x3f950d['body']=_0x1bdfd0['message'];_0x3f950d[_0xbb60('0x29')]=_0xbb60('0x2a');_0x3f950d[_0xbb60('0x2b')]=JSON['stringify'](_0x1bdfd0);return rpc[_0x2807f0+_0xbb60('0x2c')][_0xbb60('0x1d')](_0x3f950d)['then'](function(_0x540861){logger['info']('[%s][AMAZONLEX]\x20%s',_0x3f9099,_0x3f950d['body']);if(_0x1bdfd0['dialogState']=='Failed'){_0x208aee[_0xbb60('0xc')]();}else{_0x208aee[_0xbb60('0x22')]();}})[_0xbb60('0x2d')](function(_0x2abea0){logger[_0xbb60('0x20')]('[%s][AMAZONLEX]\x20%s',_0x3f9099,JSON[_0xbb60('0x21')](_0x2abea0));_0x208aee[_0xbb60('0xc')]();});}else{_0x208aee[_0xbb60('0xc')]();}});}}catch(_0x25dc0b){logger[_0xbb60('0x20')](_0xbb60('0xa'),_0x3f9099,JSON['stringify'](_0x25dc0b));_0x208aee[_0xbb60('0x22')]();}};}; \ No newline at end of file +var _0x35e2=['Message','create','then','catch','error','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','toString','postText','amazonlex','providerName','providerResponse','dialogState','lodash','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','YYYY-MM-DD\x20HH:mm:ss','sms','channel','whatsapp','phone','chat','account','upperFirst','AccountId','InteractionId','isEmpty','body'];(function(_0x49bebf,_0x5e486b){var _0x1a914e=function(_0x1e4b38){while(--_0x1e4b38){_0x49bebf['push'](_0x49bebf['shift']());}};_0x1a914e(++_0x5e486b);}(_0x35e2,0xa6));var _0x235e=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x35e2[_0x160c73];return _0xd9302;};'use strict';var _=require(_0x235e('0x0'));var moment=require('moment');var AWS=require(_0x235e('0x1'));var utils=require(_0x235e('0x2'));var logger=require(_0x235e('0x3'))(_0x235e('0x4'));var rpc={'chatMessage':require(_0x235e('0x5')),'openchannelMessage':require(_0x235e('0x6')),'mailMessage':require(_0x235e('0x7')),'smsMessage':require(_0x235e('0x8')),'faxMessage':require(_0x235e('0x9')),'whatsappMessage':require(_0x235e('0xa'))};exports['consequence']=function(_0x38deae,_0x46d7c9){return function(_0x111ab4){try{if(!_['isNil'](this[_0x235e('0xb')][_0x235e('0xc')])){logger[_0x235e('0xd')](_0x235e('0xe'),_0x38deae,_0x235e('0xf'));return _0x111ab4[_0x235e('0x10')]();}var _0x36b59={'ContactId':this[_0x235e('0x11')]['id'],'sentAt':moment()['format'](_0x235e('0x12')),'direction':'out'};if(this['channel']===_0x235e('0x13')||this[_0x235e('0x14')]===_0x235e('0x15')){_0x36b59[_0x235e('0x16')]=this[_0x235e('0xb')]['phone'];}var _0x2263bd=this[_0x235e('0x14')];if(_0x2263bd===_0x235e('0x17')){_0x36b59['ChatWebsiteId']=this[_0x235e('0x18')]['id'];}else{_0x36b59[_[_0x235e('0x19')](_0x2263bd)+_0x235e('0x1a')]=this['account']['id'];}_0x36b59[_[_0x235e('0x19')](_0x2263bd)+_0x235e('0x1b')]=this[_0x235e('0xb')]['id'];if(this['interaction']['created']){var _0x1501d2=_0x46d7c9[0x4];if(!_[_0x235e('0x1c')](_0x1501d2)){_0x36b59[_0x235e('0x1d')]=utils['getMustacheRender'](_0x1501d2,this);return rpc[_0x2263bd+_0x235e('0x1e')][_0x235e('0x1f')](_0x36b59)[_0x235e('0x20')](function(_0x27316a){logger[_0x235e('0xd')](_0x235e('0xe'),_0x38deae,_0x36b59['body']);})[_0x235e('0x21')](function(_0x264e6c){logger[_0x235e('0x22')](_0x235e('0xe'),_0x38deae,JSON[_0x235e('0x23')](_0x264e6c));})[_0x235e('0x24')](function(){logger[_0x235e('0xd')](_0x235e('0x25'),_0x38deae);_0x111ab4[_0x235e('0x26')]();});}else{logger[_0x235e('0xd')](_0x235e('0x27'),_0x38deae);_0x111ab4[_0x235e('0x26')]();}}else{var _0x37eacc=this;var _0x19d84e=new AWS[(_0x235e('0x28'))]({'accessKeyId':_0x46d7c9[0x0],'secretAccessKey':_0x46d7c9[0x1],'region':_0x46d7c9[0x2]});var _0x4b4962={'botAlias':_0x235e('0x29'),'botName':_0x46d7c9[0x3],'inputText':this[_0x235e('0x2a')][_0x235e('0x1d')],'userId':this[_0x235e('0x14')]+':'+this[_0x235e('0xb')]['id'][_0x235e('0x2b')]()};_0x19d84e[_0x235e('0x2c')](_0x4b4962,function(_0x315e26,_0xd050cd){if(_0x315e26){logger[_0x235e('0x22')]('[%s][AMAZONLEX]\x20%s',_0x38deae,_0x315e26[_0x235e('0x2a')]);_0x111ab4[_0x235e('0x10')]();}else if(_0xd050cd&&_0xd050cd['message']){_0x37eacc['body'][_0x235e('0x2d')]=_0xd050cd;_0x36b59['body']=_0xd050cd['message'];_0x36b59[_0x235e('0x2e')]='amazonlex';_0x36b59[_0x235e('0x2f')]=JSON[_0x235e('0x23')](_0xd050cd);return rpc[_0x2263bd+_0x235e('0x1e')]['create'](_0x36b59)['then'](function(_0x4dc6b3){logger[_0x235e('0xd')]('[%s][AMAZONLEX]\x20%s',_0x38deae,_0x36b59[_0x235e('0x1d')]);if(_0xd050cd[_0x235e('0x30')]=='Failed'){_0x111ab4['next']();}else{_0x111ab4[_0x235e('0x26')]();}})[_0x235e('0x21')](function(_0x5c8c3e){logger['error']('[%s][AMAZONLEX]\x20%s',_0x38deae,JSON[_0x235e('0x23')](_0x5c8c3e));_0x111ab4[_0x235e('0x10')]();});}else{_0x111ab4['next']();}});}}catch(_0x107ac9){logger[_0x235e('0x22')](_0x235e('0xe'),_0x38deae,JSON['stringify'](_0x107ac9));_0x111ab4['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/autoreply.js b/server/services/routing/server/applications/autoreply.js index c3579e7..70a8126 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 _0x2d65=['auto_reply','sendMailMessage','then','info','[%s][AUTOREPLY]\x20SMTP\x20SENT','create','catch','error','[RPC][%s][AUTOREPLY]\x20%s','stringify','finally','resolve','update','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','stop','lodash','moment','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/chatInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../mailRpc','consequence','body','isAutoreply','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','interaction','created','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','format','out','channel','getMustacheRender','message','from','mail','phone','read','subject','startsWith','Re:','chat','account','upperFirst','AccountId','InteractionId','Message','messageId','replace','','headers','auto-replied'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2d65,0x1c1));var _0x52d6=function(_0x5a1821,_0x4696f3){_0x5a1821=_0x5a1821-0x0;var _0xfdabd5=_0x2d65[_0x5a1821];return _0xfdabd5;};'use strict';var _=require(_0x52d6('0x0'));var moment=require(_0x52d6('0x1'));var utils=require('./utils');var logger=require(_0x52d6('0x2'))('routing');var rpc={'chatMessage':require(_0x52d6('0x3')),'openchannelMessage':require(_0x52d6('0x4')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x52d6('0x5')),'faxMessage':require(_0x52d6('0x6')),'whatsappMessage':require('../../rpc/whatsappMessage'),'chatInteraction':require(_0x52d6('0x7')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'mailInteraction':require(_0x52d6('0x8')),'smsInteraction':require(_0x52d6('0x9')),'faxInteraction':require(_0x52d6('0xa')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var mailRpc=require(_0x52d6('0xb'));exports[_0x52d6('0xc')]=function(_0x112e3f,_0x863ffa,_0x5b5fe1,_0x5c837a){return function(_0x111a15){try{var _0x453bac=this['channel'];if(_0x453bac==='mail'&&_0x5c837a[_0x52d6('0xd')][_0x52d6('0xe')]){logger['info'](_0x52d6('0xf'),_0x112e3f,_0x52d6('0x10'));return _0x111a15[_0x52d6('0x11')]();}if(_0x863ffa[0x0]==='1'&&(_['isNil'](this[_0x52d6('0x12')][_0x52d6('0x13')])||!this[_0x52d6('0x12')][_0x52d6('0x13')])){logger['info'](_0x52d6('0xf'),_0x112e3f,'Autoreply\x20already\x20sent');return _0x111a15['next']();}if(_0x863ffa[0x0]==='2'&&this[_0x52d6('0x12')][_0x52d6('0x14')]){logger['info'](_0x52d6('0x15'),_0x112e3f,'One\x20Time\x20already\x20sent');return _0x111a15[_0x52d6('0x11')]();}var _0x45280b={'ContactId':this['contact']['id'],'sentAt':moment()[_0x52d6('0x16')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x52d6('0x17')};if(this[_0x52d6('0x18')]==='mail'){_0x45280b['body']=utils['getMustacheRender'](_0x863ffa[0x2],this);}else{_0x45280b[_0x52d6('0xd')]=utils[_0x52d6('0x19')](_0x863ffa[0x1],this);}if(this[_0x52d6('0x1a')]){_0x45280b['to']=this[_0x52d6('0x1a')][_0x52d6('0x1b')]||'';if(this[_0x52d6('0x18')]===_0x52d6('0x1c')&&_0x863ffa[0x1]==='1'){_0x45280b['cc']=this[_0x52d6('0x1a')]['cc']||'';}_0x45280b[_0x52d6('0x1b')]=this[_0x52d6('0x1a')]['to']||'';_0x45280b[_0x52d6('0x1d')]=this[_0x52d6('0x1a')]['phone']||'';_0x45280b[_0x52d6('0x1e')]=!![];if(this[_0x52d6('0x1a')][_0x52d6('0x1f')]){_0x45280b['subject']='';_0x45280b[_0x52d6('0x1f')]+=_[_0x52d6('0x20')](this[_0x52d6('0x1a')][_0x52d6('0x1f')],_0x52d6('0x21'))?'':'Re:\x20';_0x45280b[_0x52d6('0x1f')]+=this['message'][_0x52d6('0x1f')];}}if(this[_0x52d6('0x18')]===_0x52d6('0x22')){_0x45280b['ChatWebsiteId']=this[_0x52d6('0x23')]['id'];}else{_0x45280b[_[_0x52d6('0x24')](this[_0x52d6('0x18')])+_0x52d6('0x25')]=this[_0x52d6('0x23')]['id'];}_0x45280b[_[_0x52d6('0x24')](this[_0x52d6('0x18')])+_0x52d6('0x26')]=this[_0x52d6('0x12')]['id'];var _0x2d47e0=this[_0x52d6('0x12')];if(rpc[this[_0x52d6('0x18')]+_0x52d6('0x27')]){if(this[_0x52d6('0x18')]===_0x52d6('0x1c')){_0x45280b['inReplyTo']=this[_0x52d6('0x1a')][_0x52d6('0x28')];_0x45280b['html']=''+_[_0x52d6('0x29')](_0x45280b['body'],_0x52d6('0x2a'),_0x52d6('0x2b'))+_0x52d6('0x2c');_0x45280b[_0x52d6('0x2d')]={'Auto-Submitted':_0x52d6('0x2e'),'X-Auto-Response-Suppress':'All','Precedence':_0x52d6('0x2f')};return mailRpc[_0x52d6('0x30')](this[_0x52d6('0x23')]['smtpOptions'],_0x45280b)[_0x52d6('0x31')](function(_0x1b9129){logger[_0x52d6('0x32')](_0x52d6('0x33'),_0x112e3f);_0x45280b[_0x52d6('0x28')]=_0x1b9129[_0x52d6('0x1a')][_0x52d6('0x28')];return rpc[_0x453bac+'Message'][_0x52d6('0x34')](_0x45280b);})['then'](function(_0x5f18a2){logger[_0x52d6('0x32')]('[%s][AUTOREPLY]\x20%s',_0x112e3f,JSON['stringify'](_0x5f18a2));})[_0x52d6('0x35')](function(_0x1cf313){logger[_0x52d6('0x36')](_0x52d6('0x37'),_0x112e3f,JSON[_0x52d6('0x38')](_0x1cf313));})[_0x52d6('0x39')](function(){Promise[_0x52d6('0x3a')]()[_0x52d6('0x31')](function(){if(_0x863ffa[0x0]!=='2'||_0x2d47e0['autoreplyExecuted'])return;return rpc[_0x453bac+'Interaction'][_0x52d6('0x3b')](_0x2d47e0['id'],{'autoreplyExecuted':!![]})['then'](function(_0x2d73b4){logger[_0x52d6('0x32')](_0x52d6('0x15'),_0x112e3f,JSON[_0x52d6('0x38')](_0x2d73b4));})[_0x52d6('0x35')](function(_0x515590){logger[_0x52d6('0x36')](_0x52d6('0x3c'),_0x112e3f,JSON[_0x52d6('0x38')](_0x515590));});})[_0x52d6('0x31')](function(){_0x111a15[_0x52d6('0x11')]();});});}else{return rpc[this[_0x52d6('0x18')]+_0x52d6('0x27')][_0x52d6('0x34')](_0x45280b)[_0x52d6('0x31')](function(){logger[_0x52d6('0x32')](_0x52d6('0xf'),_0x112e3f,_0x45280b[_0x52d6('0xd')]);})['catch'](function(_0x3f0042){logger[_0x52d6('0x36')](_0x52d6('0xf'),_0x112e3f,JSON[_0x52d6('0x38')](_0x3f0042));})[_0x52d6('0x39')](function(){Promise[_0x52d6('0x3a')]()[_0x52d6('0x31')](function(){if(_0x863ffa[0x0]!=='2'||_0x2d47e0[_0x52d6('0x14')])return;return rpc[_0x453bac+'Interaction']['update'](_0x2d47e0['id'],{'autoreplyExecuted':!![]})[_0x52d6('0x31')](function(_0x88ea5b){logger[_0x52d6('0x32')](_0x52d6('0x15'),_0x112e3f,JSON[_0x52d6('0x38')](_0x88ea5b));})[_0x52d6('0x35')](function(_0xb5502b){logger['error'](_0x52d6('0x3c'),_0x112e3f,JSON[_0x52d6('0x38')](_0xb5502b));});})[_0x52d6('0x31')](function(){_0x111a15[_0x52d6('0x11')]();});});}}}catch(_0x1accee){logger[_0x52d6('0x36')](_0x52d6('0xf'),_0x112e3f,JSON[_0x52d6('0x38')](_0x1accee));_0x111a15[_0x52d6('0x3d')]();}};}; \ No newline at end of file +var _0x361f=['from','mail','phone','read','subject','startsWith','Re:\x20','chat','ChatWebsiteId','upperFirst','AccountId','account','InteractionId','interaction','Message','inReplyTo','messageId','html','','replace','','headers','auto-replied','All','auto_reply','sendMailMessage','smtpOptions','[%s][AUTOREPLY]\x20SMTP\x20SENT','create','then','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','finally','resolve','Interaction','update','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','stop','moment','./utils','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../mailRpc','consequence','body','isAutoreply','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','created','Autoreply\x20already\x20sent','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','YYYY-MM-DD\x20HH:mm:ss','channel','getMustacheRender','message'];(function(_0x4d9323,_0x1e62f9){var _0x4ef329=function(_0x5103b0){while(--_0x5103b0){_0x4d9323['push'](_0x4d9323['shift']());}};_0x4ef329(++_0x1e62f9);}(_0x361f,0xb3));var _0xf361=function(_0x436ec2,_0x24e06c){_0x436ec2=_0x436ec2-0x0;var _0x534231=_0x361f[_0x436ec2];return _0x534231;};'use strict';var _=require('lodash');var moment=require(_0xf361('0x0'));var utils=require(_0xf361('0x1'));var logger=require('../../../../config/logger')(_0xf361('0x2'));var rpc={'chatMessage':require(_0xf361('0x3')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xf361('0x4')),'smsMessage':require(_0xf361('0x5')),'faxMessage':require(_0xf361('0x6')),'whatsappMessage':require(_0xf361('0x7')),'chatInteraction':require(_0xf361('0x8')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'mailInteraction':require(_0xf361('0x9')),'smsInteraction':require(_0xf361('0xa')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var mailRpc=require(_0xf361('0xb'));exports[_0xf361('0xc')]=function(_0x2fb992,_0x4363a2,_0x292301,_0x5e687f){return function(_0xd79363){try{var _0x3a7907=this['channel'];if(_0x3a7907==='mail'&&_0x5e687f[_0xf361('0xd')][_0xf361('0xe')]){logger[_0xf361('0xf')](_0xf361('0x10'),_0x2fb992,_0xf361('0x11'));return _0xd79363[_0xf361('0x12')]();}if(_0x4363a2[0x0]==='1'&&(_['isNil'](this['interaction']['created'])||!this['interaction'][_0xf361('0x13')])){logger[_0xf361('0xf')](_0xf361('0x10'),_0x2fb992,_0xf361('0x14'));return _0xd79363['next']();}if(_0x4363a2[0x0]==='2'&&this['interaction'][_0xf361('0x15')]){logger[_0xf361('0xf')](_0xf361('0x16'),_0x2fb992,_0xf361('0x17'));return _0xd79363[_0xf361('0x12')]();}var _0x275cb2={'ContactId':this['contact']['id'],'sentAt':moment()['format'](_0xf361('0x18')),'direction':'out'};if(this[_0xf361('0x19')]==='mail'){_0x275cb2['body']=utils[_0xf361('0x1a')](_0x4363a2[0x2],this);}else{_0x275cb2[_0xf361('0xd')]=utils[_0xf361('0x1a')](_0x4363a2[0x1],this);}if(this[_0xf361('0x1b')]){_0x275cb2['to']=this[_0xf361('0x1b')][_0xf361('0x1c')]||'';if(this[_0xf361('0x19')]===_0xf361('0x1d')&&_0x4363a2[0x1]==='1'){_0x275cb2['cc']=this[_0xf361('0x1b')]['cc']||'';}_0x275cb2[_0xf361('0x1c')]=this['message']['to']||'';_0x275cb2[_0xf361('0x1e')]=this[_0xf361('0x1b')][_0xf361('0x1e')]||'';_0x275cb2[_0xf361('0x1f')]=!![];if(this[_0xf361('0x1b')]['subject']){_0x275cb2[_0xf361('0x20')]='';_0x275cb2[_0xf361('0x20')]+=_[_0xf361('0x21')](this[_0xf361('0x1b')]['subject'],'Re:')?'':_0xf361('0x22');_0x275cb2['subject']+=this[_0xf361('0x1b')][_0xf361('0x20')];}}if(this[_0xf361('0x19')]===_0xf361('0x23')){_0x275cb2[_0xf361('0x24')]=this['account']['id'];}else{_0x275cb2[_[_0xf361('0x25')](this[_0xf361('0x19')])+_0xf361('0x26')]=this[_0xf361('0x27')]['id'];}_0x275cb2[_[_0xf361('0x25')](this['channel'])+_0xf361('0x28')]=this[_0xf361('0x29')]['id'];var _0x344624=this[_0xf361('0x29')];if(rpc[this['channel']+_0xf361('0x2a')]){if(this[_0xf361('0x19')]===_0xf361('0x1d')){_0x275cb2[_0xf361('0x2b')]=this[_0xf361('0x1b')][_0xf361('0x2c')];_0x275cb2[_0xf361('0x2d')]=_0xf361('0x2e')+_[_0xf361('0x2f')](_0x275cb2[_0xf361('0xd')],_0xf361('0x30'),']+(>|$)/g,''),'priorityTrue':_0xbc53ff[0x1],'priorityFalse':_0xbc53ff[0x2]};var _0x5a0fde=gotoif[_0xdbc4('0x0')](_0x2f90a1,{'typecast':!![]});if(_0x5a0fde[_0xdbc4('0xa')]){logger[_0xdbc4('0xb')]('[%s][GOTOIF]\x20%s',_0x366daf,_[_0xdbc4('0xc')](_0x5a0fde,_0xdbc4('0xd'))[_0xdbc4('0xe')](',\x20'));_0x2cddd1[_0xdbc4('0xf')]();}else{try{var _0x241ad6=eval('('+_0x2f90a1['condition']+')');var _0x3b1802=_0x241ad6?_0x2f90a1[_0xdbc4('0x10')]:_0x2f90a1['priorityFalse'];logger[_0xdbc4('0x11')](_0xdbc4('0x12'),_0x366daf,_0x2f90a1['condition'],_0x241ad6,_0x3b1802||_0xdbc4('0x13'));if(_0x3b1802){var _0x414ad5=_[_0xdbc4('0x14')](_0x2cddd1[_0xdbc4('0x15')](),{'p':_0x3b1802});if(_0x414ad5>=0x0){logger[_0xdbc4('0x11')](_0xdbc4('0x16'),_0x366daf,_0x3b1802||'next',_0x414ad5);_0x2cddd1[_0xdbc4('0x13')](_0x414ad5);}else{logger[_0xdbc4('0x11')](_0xdbc4('0x17'),_0x366daf,_0x3b1802||_0xdbc4('0x13'));_0x2cddd1['stop']();}}else{_0x2cddd1['next']();}}catch(_0x1e3405){logger[_0xdbc4('0xb')](_0xdbc4('0x18'),_0x366daf,_0x1e3405[_0xdbc4('0xd')]);_0x2cddd1[_0xdbc4('0xf')]();}}}catch(_0x14feac){logger[_0xdbc4('0xb')](_0xdbc4('0x19'),_0x366daf,JSON[_0xdbc4('0x1a')](_0x14feac));_0x2cddd1[_0xdbc4('0xf')]();}};}; \ No newline at end of file +var _0xee55=['message','join','stop','condition','priorityTrue','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOIF]\x20%s','stringify','lodash','html-to-text','./utils','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','fromString','getMustacheRender','replace','validate','length','error','map'];(function(_0x24af18,_0x132dc4){var _0x47e20d=function(_0xad4bf1){while(--_0xad4bf1){_0x24af18['push'](_0x24af18['shift']());}};_0x47e20d(++_0x132dc4);}(_0xee55,0x105));var _0x5ee5=function(_0x28a5ad,_0x520afa){_0x28a5ad=_0x28a5ad-0x0;var _0x176b8a=_0xee55[_0x28a5ad];return _0x176b8a;};'use strict';var schema=require('validate');var _=require(_0x5ee5('0x0'));var htmlToText=require(_0x5ee5('0x1'));var utils=require(_0x5ee5('0x2'));var logger=require(_0x5ee5('0x3'))(_0x5ee5('0x4'));var gotoif=schema({'condition':{'type':_0x5ee5('0x5'),'required':!![],'message':_0x5ee5('0x6')},'priorityTrue':{'type':_0x5ee5('0x7'),'message':_0x5ee5('0x8')},'priorityFalse':{'type':_0x5ee5('0x7'),'message':_0x5ee5('0x9')}});exports[_0x5ee5('0xa')]=function(_0x243f5f,_0x3a85e3){return function(_0x2e8503){try{var _0x4b88a8={'condition':htmlToText[_0x5ee5('0xb')](utils[_0x5ee5('0xc')](_0x3a85e3[0x0],this),{'wordwrap':![]})[_0x5ee5('0xd')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x3a85e3[0x1],'priorityFalse':_0x3a85e3[0x2]};var _0x4ce1b0=gotoif[_0x5ee5('0xe')](_0x4b88a8,{'typecast':!![]});if(_0x4ce1b0[_0x5ee5('0xf')]){logger[_0x5ee5('0x10')]('[%s][GOTOIF]\x20%s',_0x243f5f,_[_0x5ee5('0x11')](_0x4ce1b0,_0x5ee5('0x12'))[_0x5ee5('0x13')](',\x20'));_0x2e8503[_0x5ee5('0x14')]();}else{try{var _0x36632e=eval('('+_0x4b88a8[_0x5ee5('0x15')]+')');var _0xc3e874=_0x36632e?_0x4b88a8[_0x5ee5('0x16')]:_0x4b88a8['priorityFalse'];logger[_0x5ee5('0x17')](_0x5ee5('0x18'),_0x243f5f,_0x4b88a8['condition'],_0x36632e,_0xc3e874||'next');if(_0xc3e874){var _0x38b716=_[_0x5ee5('0x19')](_0x2e8503[_0x5ee5('0x1a')](),{'p':_0xc3e874});if(_0x38b716>=0x0){logger[_0x5ee5('0x17')](_0x5ee5('0x1b'),_0x243f5f,_0xc3e874||_0x5ee5('0x1c'),_0x38b716);_0x2e8503['next'](_0x38b716);}else{logger['info']('[%s][GOTOIF]\x20priority\x20%s\x20not\x20found',_0x243f5f,_0xc3e874||'next');_0x2e8503[_0x5ee5('0x14')]();}}else{_0x2e8503[_0x5ee5('0x1c')]();}}catch(_0x4bf9a8){logger[_0x5ee5('0x10')]('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x243f5f,_0x4bf9a8[_0x5ee5('0x12')]);_0x2e8503[_0x5ee5('0x14')]();}}}catch(_0x514c26){logger[_0x5ee5('0x10')](_0x5ee5('0x1d'),_0x243f5f,JSON[_0x5ee5('0x1e')](_0x514c26));_0x2e8503['stop']();}};}; \ 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 eb4a104..4fcc340 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 _0xcbcc=['join','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','stop','stringify','validate','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','length','error','[%s][GOTOP]\x20%s','map'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0xcbcc,0xf6));var _0xccbc=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xcbcc[_0x4565bf];return _0x5610ba;};'use strict';var schema=require(_0xccbc('0x0'));var _=require('lodash');var logger=require(_0xccbc('0x1'))(_0xccbc('0x2'));var gotop=schema({'priority':{'type':_0xccbc('0x3'),'required':!![],'message':_0xccbc('0x4')}});exports['consequence']=function(_0x1e30e2,_0x4e2992){return function(_0x10edde){try{var _0x17d374={'priority':_0x4e2992[0x0]};var _0x4ca684=gotop[_0xccbc('0x0')](_0x17d374,{'typecast':!![]});if(_0x4ca684[_0xccbc('0x5')]){logger[_0xccbc('0x6')](_0xccbc('0x7'),_0x1e30e2,_[_0xccbc('0x8')](_0x4ca684,'message')[_0xccbc('0x9')](',\x20'));_0x10edde['stop']();}else{logger['info'](_0xccbc('0xa'),_0x1e30e2,_0x17d374[_0xccbc('0xb')]);if(_0x17d374[_0xccbc('0xb')]){var _0x19cfb1=_[_0xccbc('0xc')](_0x10edde['rules'](),{'p':_0x17d374[_0xccbc('0xb')]});if(_0x19cfb1>=0x0){logger['info'](_0xccbc('0xd'),_0x1e30e2,_0x17d374[_0xccbc('0xb')]||_0xccbc('0xe'),_0x19cfb1);_0x10edde[_0xccbc('0xe')](_0x19cfb1);}else{logger['info']('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0x1e30e2,_0x17d374[_0xccbc('0xb')]||'next');_0x10edde[_0xccbc('0xf')]();}}else{_0x10edde[_0xccbc('0xe')]();}}}catch(_0x143181){logger['error'](_0xccbc('0x7'),_0x1e30e2,JSON[_0xccbc('0x10')](_0x143181));_0x10edde['stop']();}};}; \ No newline at end of file +var _0xa3c3=['consequence','length','map','message','join','info','[%s][GOTOP]\x20priority\x20%s','priority','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','stop','error','stringify','validate','lodash','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'];(function(_0x271697,_0x6897d6){var _0x426093=function(_0x4d4dfe){while(--_0x4d4dfe){_0x271697['push'](_0x271697['shift']());}};_0x426093(++_0x6897d6);}(_0xa3c3,0x1b2));var _0x3a3c=function(_0x33dbbf,_0x24622b){_0x33dbbf=_0x33dbbf-0x0;var _0x14ee42=_0xa3c3[_0x33dbbf];return _0x14ee42;};'use strict';var schema=require(_0x3a3c('0x0'));var _=require(_0x3a3c('0x1'));var logger=require(_0x3a3c('0x2'))(_0x3a3c('0x3'));var gotop=schema({'priority':{'type':_0x3a3c('0x4'),'required':!![],'message':_0x3a3c('0x5')}});exports[_0x3a3c('0x6')]=function(_0x4c3faf,_0x58d92e){return function(_0x3c4035){try{var _0x309f70={'priority':_0x58d92e[0x0]};var _0x3a2ad7=gotop['validate'](_0x309f70,{'typecast':!![]});if(_0x3a2ad7[_0x3a3c('0x7')]){logger['error']('[%s][GOTOP]\x20%s',_0x4c3faf,_[_0x3a3c('0x8')](_0x3a2ad7,_0x3a3c('0x9'))[_0x3a3c('0xa')](',\x20'));_0x3c4035['stop']();}else{logger[_0x3a3c('0xb')](_0x3a3c('0xc'),_0x4c3faf,_0x309f70['priority']);if(_0x309f70[_0x3a3c('0xd')]){var _0x4bf4f0=_['findIndex'](_0x3c4035[_0x3a3c('0xe')](),{'p':_0x309f70[_0x3a3c('0xd')]});if(_0x4bf4f0>=0x0){logger[_0x3a3c('0xb')](_0x3a3c('0xf'),_0x4c3faf,_0x309f70[_0x3a3c('0xd')]||_0x3a3c('0x10'),_0x4bf4f0);_0x3c4035[_0x3a3c('0x10')](_0x4bf4f0);}else{logger[_0x3a3c('0xb')]('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0x4c3faf,_0x309f70[_0x3a3c('0xd')]||_0x3a3c('0x10'));_0x3c4035[_0x3a3c('0x11')]();}}else{_0x3c4035['next']();}}}catch(_0x2303f1){logger[_0x3a3c('0x12')]('[%s][GOTOP]\x20%s',_0x4c3faf,JSON[_0x3a3c('0x13')](_0x2303f1));_0x3c4035['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/message.js b/server/services/routing/server/applications/message.js index 1773cca..ea669ac 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 _0xa287=['then','info','body','next','catch','[%s][MESSAGE]\x20%s','stringify','stop','lodash','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','chat','ChatWebsiteId','account','upperFirst','AccountId','channel','InteractionId','Message','create'];(function(_0x116573,_0x234dde){var _0x4274e0=function(_0x5a3da4){while(--_0x5a3da4){_0x116573['push'](_0x116573['shift']());}};_0x4274e0(++_0x234dde);}(_0xa287,0xe0));var _0x7a28=function(_0x2673a4,_0x4d0b8d){_0x2673a4=_0x2673a4-0x0;var _0x5e3a6a=_0xa287[_0x2673a4];return _0x5e3a6a;};'use strict';var _=require(_0x7a28('0x0'));var utils=require('./utils');var logger=require('../../../../config/logger')(_0x7a28('0x1'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x7a28('0x2')),'mailMessage':require(_0x7a28('0x3')),'smsMessage':require(_0x7a28('0x4')),'faxMessage':require(_0x7a28('0x5')),'whatsappMessage':require(_0x7a28('0x6'))};exports[_0x7a28('0x7')]=function(_0x332262,_0x28a506){return function(_0x2c58b9){try{var _0x464d5d={'body':utils[_0x7a28('0x8')](_0x28a506[0x0],this),'ContactId':this[_0x7a28('0x9')]['id']};if(this['channel']===_0x7a28('0xa')){_0x464d5d[_0x7a28('0xb')]=this[_0x7a28('0xc')]['id'];}else{_0x464d5d[_[_0x7a28('0xd')](this['channel'])+_0x7a28('0xe')]=this[_0x7a28('0xc')]['id'];}_0x464d5d[_['upperFirst'](this[_0x7a28('0xf')])+_0x7a28('0x10')]=this['interaction']['id'];if(rpc[this['channel']+_0x7a28('0x11')]){return rpc[this[_0x7a28('0xf')]+'Message'][_0x7a28('0x12')](_0x464d5d)[_0x7a28('0x13')](function(_0x5c1d55){logger[_0x7a28('0x14')]('[%s][MESSAGE]\x20%s',_0x332262,_0x464d5d[_0x7a28('0x15')]);_0x2c58b9[_0x7a28('0x16')]();})[_0x7a28('0x17')](function(_0xc6f7ff){logger['error'](_0x7a28('0x18'),_0x332262,JSON[_0x7a28('0x19')](_0xc6f7ff));_0x2c58b9[_0x7a28('0x1a')]();});}}catch(_0x5b902e){logger['error'](_0x7a28('0x18'),_0x332262,JSON[_0x7a28('0x19')](_0x5b902e));_0x2c58b9[_0x7a28('0x1a')]();}};}; \ No newline at end of file +var _0x9ab9=['routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','getMustacheRender','chat','ChatWebsiteId','upperFirst','channel','AccountId','account','interaction','Message','create','then','info','[%s][MESSAGE]\x20%s','body','catch','stringify','stop','error','lodash','./utils','../../../../config/logger'];(function(_0x58a364,_0x3439f6){var _0x409b74=function(_0xff5c15){while(--_0xff5c15){_0x58a364['push'](_0x58a364['shift']());}};_0x409b74(++_0x3439f6);}(_0x9ab9,0x19d));var _0x99ab=function(_0x30a5a5,_0x18255e){_0x30a5a5=_0x30a5a5-0x0;var _0x10e17e=_0x9ab9[_0x30a5a5];return _0x10e17e;};'use strict';var _=require(_0x99ab('0x0'));var utils=require(_0x99ab('0x1'));var logger=require(_0x99ab('0x2'))(_0x99ab('0x3'));var rpc={'chatMessage':require(_0x99ab('0x4')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x99ab('0x5')),'smsMessage':require(_0x99ab('0x6')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x99ab('0x7'))};exports['consequence']=function(_0x442e8c,_0x1042a3){return function(_0x390d41){try{var _0x249c1f={'body':utils[_0x99ab('0x8')](_0x1042a3[0x0],this),'ContactId':this['contact']['id']};if(this['channel']===_0x99ab('0x9')){_0x249c1f[_0x99ab('0xa')]=this['account']['id'];}else{_0x249c1f[_[_0x99ab('0xb')](this[_0x99ab('0xc')])+_0x99ab('0xd')]=this[_0x99ab('0xe')]['id'];}_0x249c1f[_[_0x99ab('0xb')](this[_0x99ab('0xc')])+'InteractionId']=this[_0x99ab('0xf')]['id'];if(rpc[this[_0x99ab('0xc')]+_0x99ab('0x10')]){return rpc[this['channel']+'Message'][_0x99ab('0x11')](_0x249c1f)[_0x99ab('0x12')](function(_0x3739fb){logger[_0x99ab('0x13')](_0x99ab('0x14'),_0x442e8c,_0x249c1f[_0x99ab('0x15')]);_0x390d41['next']();})[_0x99ab('0x16')](function(_0x5bf382){logger['error'](_0x99ab('0x14'),_0x442e8c,JSON[_0x99ab('0x17')](_0x5bf382));_0x390d41[_0x99ab('0x18')]();});}}catch(_0x4b11f1){logger[_0x99ab('0x19')](_0x99ab('0x14'),_0x442e8c,JSON[_0x99ab('0x17')](_0x4b11f1));_0x390d41[_0x99ab('0x18')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/noop.js b/server/services/routing/server/applications/noop.js index 6df71bd..4a4894b 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 _0x840a=['stop','./utils','../../../../config/logger','routing','info','[%s][NOOP]\x20%s','getMustacheRender','next','error','stringify'];(function(_0x136c86,_0x8a29d8){var _0x534590=function(_0x39f480){while(--_0x39f480){_0x136c86['push'](_0x136c86['shift']());}};_0x534590(++_0x8a29d8);}(_0x840a,0x123));var _0xa840=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x840a[_0x321bb2];return _0x9c12ed;};'use strict';var utils=require(_0xa840('0x0'));var logger=require(_0xa840('0x1'))(_0xa840('0x2'));exports['consequence']=function(_0x38f17a,_0x1d1d84){return function(_0x5c16e1){try{logger[_0xa840('0x3')](_0xa840('0x4'),_0x38f17a,utils[_0xa840('0x5')](_0x1d1d84[0x0],this));_0x5c16e1[_0xa840('0x6')]();}catch(_0x3526e1){logger[_0xa840('0x7')](_0xa840('0x4'),_0x38f17a,JSON[_0xa840('0x8')](_0x3526e1));_0x5c16e1[_0xa840('0x9')]();}};}; \ No newline at end of file +var _0x7f17=['getMustacheRender','error','[%s][NOOP]\x20%s','stringify','stop','./utils','routing','consequence'];(function(_0x297524,_0x39b73c){var _0x3444a1=function(_0xeea7cc){while(--_0xeea7cc){_0x297524['push'](_0x297524['shift']());}};_0x3444a1(++_0x39b73c);}(_0x7f17,0xbd));var _0x77f1=function(_0x292f35,_0x72e859){_0x292f35=_0x292f35-0x0;var _0x288e75=_0x7f17[_0x292f35];return _0x288e75;};'use strict';var utils=require(_0x77f1('0x0'));var logger=require('../../../../config/logger')(_0x77f1('0x1'));exports[_0x77f1('0x2')]=function(_0x3a1660,_0x579ec5){return function(_0x4c7662){try{logger['info']('[%s][NOOP]\x20%s',_0x3a1660,utils[_0x77f1('0x3')](_0x579ec5[0x0],this));_0x4c7662['next']();}catch(_0x5a1d37){logger[_0x77f1('0x4')](_0x77f1('0x5'),_0x3a1660,JSON[_0x77f1('0x6')](_0x5a1d37));_0x4c7662[_0x77f1('0x7')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index 8bf4a3f..358116c 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 _0x34cf=['push','InteractionId','format','%sQueuesWaitingInteractions','%s:queue:%s','%s_queue_waiting_interaction:%s','remove','pick','../../rpc/mailQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','../../rpc/chatInteraction','../../rpc/mailInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','channel','QueueId','upperFirst','interaction','MessageId','message','WebsiteId','info','name','QueueReport','create','error','create\x20queue\x20report','accepted','[%s][STOP:QUEUE][NAME:%s]','Interaction','update','then','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','catch','consequence','validate','map','join','stop','find','Queues','createQueue','atimeout','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','rules','complete','[%s][QUEUE]\x20APPLICATION\x20END','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','stack','lodash','util','moment','ioredis','../../../../config/logger','routing','./strategy','redis','defaults','queue','from','joinAt','emit','clone','queue_id','account'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x34cf,0xe6));var _0xf34c=function(_0x448f1a,_0x1b7a13){_0x448f1a=_0x448f1a-0x0;var _0x5dc502=_0x34cf[_0x448f1a];return _0x5dc502;};'use strict';var schema=require('validate');var _=require(_0xf34c('0x0'));var util=require(_0xf34c('0x1'));var seqqueue=require('seq-queue');var moment=require(_0xf34c('0x2'));var Redis=require(_0xf34c('0x3'));var config=require('../../../../config/environment');var logger=require(_0xf34c('0x4'))(_0xf34c('0x5'));var strategy=require(_0xf34c('0x6'));config[_0xf34c('0x7')]=_[_0xf34c('0x8')](config[_0xf34c('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xf34c('0x7')]));var attributes=['id','queue_id','account',_0xf34c('0x9'),_0xf34c('0xa'),_0xf34c('0xb')];function emit(_0x1ad1e5,_0x5ed59a,_0x2473f9){io['to'](_0x1ad1e5)[_0xf34c('0xc')](_0x5ed59a,_0x2473f9);}function emitChannelQueueInteraction(_0x51ab7f,_0x41442e,_0x35df00,_0x3cec0c,_0x2741f7,_0x4b3845,_0x53adb3,_0x37be6b){var _0x977dc9=_[_0xf34c('0xd')](_0x35df00);_0x977dc9[_0xf34c('0xe')]=_0x37be6b;_0x977dc9[_0xf34c('0x9')]=_0x41442e;_0x977dc9[_0xf34c('0xf')]=_0x3cec0c;_0x977dc9['id']=_0x2741f7;if(_0x4b3845){attributes[_0xf34c('0x10')](_['capitalize'](_0x51ab7f)+_0xf34c('0x11'));_0x53adb3[util[_0xf34c('0x12')](_0xf34c('0x13'),_0x51ab7f)][_0x2741f7]=_['pick'](_0x977dc9,attributes);}else{delete _0x53adb3[util[_0xf34c('0x12')](_0xf34c('0x13'),_0x51ab7f)][_0x2741f7];}emit(util['format'](_0xf34c('0x14'),_0x51ab7f,_0x41442e),util['format'](_0xf34c('0x15'),_0x51ab7f,_0x4b3845?'save':_0xf34c('0x16')),_[_0xf34c('0x17')](_0x977dc9,attributes));}var rpc={'openchannelQueueReport':require('../../rpc/openchannelQueueReport'),'mailQueueReport':require(_0xf34c('0x18')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require(_0xf34c('0x19')),'faxQueueReport':require(_0xf34c('0x1a')),'whatsappQueueReport':require(_0xf34c('0x1b')),'chatInteraction':require(_0xf34c('0x1c')),'faxInteraction':require('../../rpc/faxInteraction'),'mailInteraction':require(_0xf34c('0x1d')),'openchannelInteraction':require(_0xf34c('0x1e')),'smsInteraction':require(_0xf34c('0x1f')),'whatsappInteraction':require(_0xf34c('0x20'))};var queue=schema({'name':{'type':_0xf34c('0x21'),'required':!![],'message':_0xf34c('0x22')},'timeout':{'type':_0xf34c('0x23'),'message':'timeout\x20is\x20a\x20number'}});function startRouting(_0xf45eb,_0x5837cf,_0x354662,_0x187928){if(_0xf45eb&&_0x5837cf&&_0x354662){_0x5837cf[_0xf34c('0x24')]+=0x1;var _0x3c07b5={'uniqueid':_0xf45eb,'from':_0x354662[_0xf34c('0x25')]?_0x354662[_0xf34c('0x25')][_0xf34c('0xa')]:'','joinAt':moment()[_0xf34c('0x12')](_0xf34c('0x26')),'ContactId':_0x354662[_0xf34c('0x27')]?_0x354662[_0xf34c('0x27')]['id']:null,'ListId':_0x354662[_0xf34c('0x28')]?_0x354662[_0xf34c('0x28')]['id']:null};_0x3c07b5[_['upperFirst'](_0x354662[_0xf34c('0x29')])+_0xf34c('0x2a')]=_0x5837cf['id']||null;_0x3c07b5[_[_0xf34c('0x2b')](_0x354662[_0xf34c('0x29')])+_0xf34c('0x11')]=_0x354662[_0xf34c('0x2c')]?_0x354662[_0xf34c('0x2c')]['id']:null;_0x3c07b5[_[_0xf34c('0x2b')](_0x354662[_0xf34c('0x29')])+_0xf34c('0x2d')]=_0x354662[_0xf34c('0x2e')]?_0x354662[_0xf34c('0x2e')]['id']:null;_0x3c07b5[_[_0xf34c('0x2b')](_0x354662[_0xf34c('0x29')])+(_0x354662[_0xf34c('0x29')]!=='chat'?'AccountId':_0xf34c('0x2f'))]=_0x354662[_0xf34c('0xf')]?_0x354662[_0xf34c('0xf')]['id']:null;logger[_0xf34c('0x30')](util[_0xf34c('0x12')]('[%s][START:QUEUE][NAME:%s]',_0xf45eb,_0x5837cf[_0xf34c('0x31')]));emitChannelQueueInteraction(_0x354662[_0xf34c('0x29')],_0x5837cf[_0xf34c('0x31')],_0x3c07b5,_0x354662['account'][_0xf34c('0x31')],_0x354662[_0xf34c('0x2e')]['id'],!![],_0x187928,_0x5837cf['id']);if(rpc[_0x354662['channel']+'QueueReport']){return rpc[_0x354662[_0xf34c('0x29')]+_0xf34c('0x32')][_0xf34c('0x33')](_0x3c07b5)['catch'](function(_0xa00895){logger[_0xf34c('0x34')](_0xf34c('0x35'),_0xa00895);});}}}function stopRouting(_0x5a08de,_0x2a545d,_0x19a59a,_0x4c1737){if(_0x5a08de&&_0x2a545d){_0x2a545d[_0xf34c('0x24')]-=0x1;var _0x19ca09={'leaveAt':moment()[_0xf34c('0x12')]('YYYY-MM-DD\x20HH:mm:ss'),'acceptAt':moment()[_0xf34c('0x12')](_0xf34c('0x26')),'reason':_0xf34c('0x36')};logger[_0xf34c('0x30')](util['format'](_0xf34c('0x37'),_0x5a08de,_0x2a545d[_0xf34c('0x31')]));emitChannelQueueInteraction(_0x19a59a[_0xf34c('0x29')],_0x2a545d[_0xf34c('0x31')],_0x19a59a[_0xf34c('0x25')],_0x19a59a[_0xf34c('0xf')][_0xf34c('0x31')],_0x19a59a['message']['id'],![],_0x4c1737,_0x2a545d['id']);return rpc[_0x19a59a[_0xf34c('0x29')]+_0xf34c('0x38')][_0xf34c('0x39')](_0x19a59a[_0xf34c('0x2c')]['id'],{'queueId':_0x2a545d['id']})[_0xf34c('0x3a')](function(){if(rpc[_0x19a59a['channel']+_0xf34c('0x32')]){return rpc[_0x19a59a['channel']+'QueueReport']['update'](_0x5a08de,_0x19ca09)['catch'](function(_0x4ac19a){logger[_0xf34c('0x34')](_0xf34c('0x3b'),_0x4ac19a);});}});}}function endRouting(_0x30e4a2,_0x20ef44,_0x16cc1e,_0x215c30){if(_0x30e4a2&&_0x20ef44){_0x20ef44[_0xf34c('0x24')]-=0x1;var _0x3371ca={'leaveAt':moment()[_0xf34c('0x12')](_0xf34c('0x26')),'exitAt':moment()[_0xf34c('0x12')](_0xf34c('0x26')),'reason':_0xf34c('0x3c')};logger[_0xf34c('0x30')](util[_0xf34c('0x12')](_0xf34c('0x3d'),_0x30e4a2,_0x20ef44[_0xf34c('0x31')]));emitChannelQueueInteraction(_0x16cc1e['channel'],_0x20ef44[_0xf34c('0x31')],_0x16cc1e[_0xf34c('0x25')],_0x16cc1e[_0xf34c('0xf')][_0xf34c('0x31')],_0x16cc1e[_0xf34c('0x2e')]['id'],![],_0x215c30);if(rpc[_0x16cc1e[_0xf34c('0x29')]+_0xf34c('0x32')]){return rpc[_0x16cc1e[_0xf34c('0x29')]+_0xf34c('0x32')][_0xf34c('0x39')](_0x30e4a2,_0x3371ca)[_0xf34c('0x3e')](function(_0x477250){logger[_0xf34c('0x34')](_0xf34c('0x3b'),_0x477250);});}}}function handleFindQueue(_0xaf30b2){return function(_0x308e50){return _0x308e50[_0xf34c('0x31')]['toLowerCase']()===_0xaf30b2['toLowerCase']();};}exports[_0xf34c('0x3f')]=function(_0x552f01,_0x4d1294,_0xe1a6c2,_0x52f947){return function(_0x4ba13a){try{var _0x4ada75={'name':_0x4d1294[0x0],'timeout':_0x4d1294[0x1]};var _0x337f68=queue[_0xf34c('0x40')](_0x4ada75,{'typecast':!![]});if(_0x337f68['length']){logger[_0xf34c('0x34')]('[%s][QUEUE]\x20%s',_0x552f01,_[_0xf34c('0x41')](_0x337f68,_0xf34c('0x2e'))[_0xf34c('0x42')](',\x20'));_0x4ba13a[_0xf34c('0x43')]();}else{var _0x287c66=_[_0xf34c('0x44')](_0xe1a6c2[_0x52f947[_0xf34c('0x29')]+_0xf34c('0x45')],handleFindQueue(_0x4ada75[_0xf34c('0x31')]));if(_0x287c66){startRouting(_0x552f01,_0x287c66,_0x52f947,_0xe1a6c2);var _0xa27421=(_0x287c66[_0xf34c('0x3c')]||0xa)*0x3e8;var _0x406e22=(_0x4ada75['timeout']||0x14)*0x3e8;var _0x443573;if(_0xa27421>_0x406e22){_0x406e22=_0xa27421;}var _0x2a8fab=seqqueue[_0xf34c('0x46')](_0xa27421);_0x2a8fab['id']=_0x552f01;_0x2a8fab[_0xf34c('0x47')]=_0xa27421;_0x2a8fab['qtimeout']=_0x406e22;_0x2a8fab[_0xf34c('0x29')]=_0x52f947[_0xf34c('0x29')];_0xe1a6c2['rules'][_0x552f01]['on']('end',function(){logger[_0xf34c('0x30')](_0xf34c('0x48'),_0x552f01);stopRouting(_0x552f01,_0x287c66,_0x52f947,_0xe1a6c2);clearTimeout(_0x443573);_0x443573=undefined;_0x2a8fab[_0xf34c('0x49')](!![]);if(_0xe1a6c2['rules'][_0x552f01]){delete _0xe1a6c2['rules'][_0x552f01];}_0x4ba13a[_0xf34c('0x43')]();});_0xe1a6c2[_0xf34c('0x4a')][_0x552f01]['on'](_0xf34c('0x4b'),function(){if(_0xe1a6c2['rules'][_0x552f01]){delete _0xe1a6c2[_0xf34c('0x4a')][_0x552f01];}});_0x443573=setTimeout(function(){logger[_0xf34c('0x30')](_0xf34c('0x4c'),_0x552f01);endRouting(_0x552f01,_0x287c66,_0x52f947,_0xe1a6c2);clearTimeout(_0x443573);_0x2a8fab[_0xf34c('0x49')](!![]);_0x4ba13a['next']();},_0x406e22);switch(_0x287c66[_0xf34c('0x4d')]){case _0xf34c('0x4e'):strategy[_0xf34c('0x4e')](_0x2a8fab,_0x287c66,_0xe1a6c2,_0x52f947);break;default:strategy[_0xf34c('0x4f')](_0x2a8fab,_0x287c66,_0xe1a6c2,_0x52f947);}}else{logger[_0xf34c('0x34')](_0xf34c('0x50'),_0x552f01,_0x4ada75[_0xf34c('0x31')]);_0x4ba13a[_0xf34c('0x43')]();}}}catch(_0x303668){logger[_0xf34c('0x34')]('[%s][QUEUE]\x20%s',_0x552f01,_0x303668[_0xf34c('0x51')]);_0x4ba13a[_0xf34c('0x43')]();}};}; \ No newline at end of file +var _0x0866=['stop','find','Queues','rules','end','complete','[%s][QUEUE]\x20APPLICATION\x20END','close','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','stack','validate','lodash','util','seq-queue','ioredis','../../../../config/environment','../../../../config/logger','routing','redis','defaults','localhost','socket.io-emitter','queue_id','account','queue','from','joinAt','emit','InteractionId','format','pick','%s:queue:%s','%s_queue_waiting_interaction:%s','save','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','../../rpc/faxInteraction','../../rpc/mailInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId','interaction','MessageId','message','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','create\x20queue\x20report','update','then','update\x20queue\x20report','timeout','toLowerCase','consequence','[%s][QUEUE]\x20%s','join'];(function(_0x4b7661,_0x4374a2){var _0x335762=function(_0x1d8744){while(--_0x1d8744){_0x4b7661['push'](_0x4b7661['shift']());}};_0x335762(++_0x4374a2);}(_0x0866,0x1f4));var _0x6086=function(_0x3937fb,_0x3fb0ee){_0x3937fb=_0x3937fb-0x0;var _0x568a9f=_0x0866[_0x3937fb];return _0x568a9f;};'use strict';var schema=require(_0x6086('0x0'));var _=require(_0x6086('0x1'));var util=require(_0x6086('0x2'));var seqqueue=require(_0x6086('0x3'));var moment=require('moment');var Redis=require(_0x6086('0x4'));var config=require(_0x6086('0x5'));var logger=require(_0x6086('0x6'))(_0x6086('0x7'));var strategy=require('./strategy');config[_0x6086('0x8')]=_[_0x6086('0x9')](config[_0x6086('0x8')],{'host':_0x6086('0xa'),'port':0x18eb});var io=require(_0x6086('0xb'))(new Redis(config['redis']));var attributes=['id',_0x6086('0xc'),_0x6086('0xd'),_0x6086('0xe'),_0x6086('0xf'),_0x6086('0x10')];function emit(_0x58d3c8,_0x5f44c2,_0x5c1aea){io['to'](_0x58d3c8)[_0x6086('0x11')](_0x5f44c2,_0x5c1aea);}function emitChannelQueueInteraction(_0x5ce855,_0x39e376,_0x541020,_0x11104a,_0x36a358,_0x14b369,_0x33367c,_0x45147c){var _0x238719=_['clone'](_0x541020);_0x238719[_0x6086('0xc')]=_0x45147c;_0x238719[_0x6086('0xe')]=_0x39e376;_0x238719['account']=_0x11104a;_0x238719['id']=_0x36a358;if(_0x14b369){attributes['push'](_['capitalize'](_0x5ce855)+_0x6086('0x12'));_0x33367c[util[_0x6086('0x13')]('%sQueuesWaitingInteractions',_0x5ce855)][_0x36a358]=_[_0x6086('0x14')](_0x238719,attributes);}else{delete _0x33367c[util['format']('%sQueuesWaitingInteractions',_0x5ce855)][_0x36a358];}emit(util['format'](_0x6086('0x15'),_0x5ce855,_0x39e376),util[_0x6086('0x13')](_0x6086('0x16'),_0x5ce855,_0x14b369?_0x6086('0x17'):'remove'),_[_0x6086('0x14')](_0x238719,attributes));}var rpc={'openchannelQueueReport':require(_0x6086('0x18')),'mailQueueReport':require(_0x6086('0x19')),'chatQueueReport':require(_0x6086('0x1a')),'smsQueueReport':require(_0x6086('0x1b')),'faxQueueReport':require(_0x6086('0x1c')),'whatsappQueueReport':require(_0x6086('0x1d')),'chatInteraction':require('../../rpc/chatInteraction'),'faxInteraction':require(_0x6086('0x1e')),'mailInteraction':require(_0x6086('0x1f')),'openchannelInteraction':require(_0x6086('0x20')),'smsInteraction':require(_0x6086('0x21')),'whatsappInteraction':require(_0x6086('0x22'))};var queue=schema({'name':{'type':_0x6086('0x23'),'required':!![],'message':_0x6086('0x24')},'timeout':{'type':_0x6086('0x25'),'message':_0x6086('0x26')}});function startRouting(_0x2fd7b2,_0x2c52b9,_0x1eedaf,_0x356301){if(_0x2fd7b2&&_0x2c52b9&&_0x1eedaf){_0x2c52b9[_0x6086('0x27')]+=0x1;var _0x5a258a={'uniqueid':_0x2fd7b2,'from':_0x1eedaf[_0x6086('0x28')]?_0x1eedaf[_0x6086('0x28')][_0x6086('0xf')]:'','joinAt':moment()[_0x6086('0x13')](_0x6086('0x29')),'ContactId':_0x1eedaf[_0x6086('0x2a')]?_0x1eedaf[_0x6086('0x2a')]['id']:null,'ListId':_0x1eedaf['list']?_0x1eedaf[_0x6086('0x2b')]['id']:null};_0x5a258a[_[_0x6086('0x2c')](_0x1eedaf[_0x6086('0x2d')])+_0x6086('0x2e')]=_0x2c52b9['id']||null;_0x5a258a[_[_0x6086('0x2c')](_0x1eedaf[_0x6086('0x2d')])+'InteractionId']=_0x1eedaf[_0x6086('0x2f')]?_0x1eedaf['interaction']['id']:null;_0x5a258a[_[_0x6086('0x2c')](_0x1eedaf[_0x6086('0x2d')])+_0x6086('0x30')]=_0x1eedaf[_0x6086('0x31')]?_0x1eedaf[_0x6086('0x31')]['id']:null;_0x5a258a[_[_0x6086('0x2c')](_0x1eedaf[_0x6086('0x2d')])+(_0x1eedaf['channel']!=='chat'?'AccountId':_0x6086('0x32'))]=_0x1eedaf['account']?_0x1eedaf[_0x6086('0xd')]['id']:null;logger[_0x6086('0x33')](util['format'](_0x6086('0x34'),_0x2fd7b2,_0x2c52b9['name']));emitChannelQueueInteraction(_0x1eedaf[_0x6086('0x2d')],_0x2c52b9[_0x6086('0x35')],_0x5a258a,_0x1eedaf[_0x6086('0xd')]['name'],_0x1eedaf['message']['id'],!![],_0x356301,_0x2c52b9['id']);if(rpc[_0x1eedaf[_0x6086('0x2d')]+_0x6086('0x36')]){return rpc[_0x1eedaf[_0x6086('0x2d')]+_0x6086('0x36')][_0x6086('0x37')](_0x5a258a)[_0x6086('0x38')](function(_0x1790d2){logger[_0x6086('0x39')](_0x6086('0x3a'),_0x1790d2);});}}}function stopRouting(_0x561807,_0x3edfa4,_0x4d00ef,_0xa9413a){if(_0x561807&&_0x3edfa4){_0x3edfa4[_0x6086('0x27')]-=0x1;var _0x5e97eb={'leaveAt':moment()[_0x6086('0x13')](_0x6086('0x29')),'acceptAt':moment()['format'](_0x6086('0x29')),'reason':'accepted'};logger[_0x6086('0x33')](util['format']('[%s][STOP:QUEUE][NAME:%s]',_0x561807,_0x3edfa4[_0x6086('0x35')]));emitChannelQueueInteraction(_0x4d00ef[_0x6086('0x2d')],_0x3edfa4['name'],_0x4d00ef[_0x6086('0x28')],_0x4d00ef[_0x6086('0xd')][_0x6086('0x35')],_0x4d00ef['message']['id'],![],_0xa9413a,_0x3edfa4['id']);return rpc[_0x4d00ef[_0x6086('0x2d')]+'Interaction'][_0x6086('0x3b')](_0x4d00ef[_0x6086('0x2f')]['id'],{'queueId':_0x3edfa4['id']})[_0x6086('0x3c')](function(){if(rpc[_0x4d00ef[_0x6086('0x2d')]+_0x6086('0x36')]){return rpc[_0x4d00ef['channel']+_0x6086('0x36')][_0x6086('0x3b')](_0x561807,_0x5e97eb)['catch'](function(_0x91b03c){logger[_0x6086('0x39')](_0x6086('0x3d'),_0x91b03c);});}});}}function endRouting(_0x1bebf9,_0x5bce5d,_0x3b4310,_0x18e372){if(_0x1bebf9&&_0x5bce5d){_0x5bce5d['waiting']-=0x1;var _0x5d0c3b={'leaveAt':moment()[_0x6086('0x13')](_0x6086('0x29')),'exitAt':moment()[_0x6086('0x13')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x6086('0x3e')};logger['info'](util['format']('[%s][END:QUEUE][NAME:%s]',_0x1bebf9,_0x5bce5d['name']));emitChannelQueueInteraction(_0x3b4310[_0x6086('0x2d')],_0x5bce5d[_0x6086('0x35')],_0x3b4310[_0x6086('0x28')],_0x3b4310[_0x6086('0xd')][_0x6086('0x35')],_0x3b4310[_0x6086('0x31')]['id'],![],_0x18e372);if(rpc[_0x3b4310[_0x6086('0x2d')]+_0x6086('0x36')]){return rpc[_0x3b4310[_0x6086('0x2d')]+'QueueReport'][_0x6086('0x3b')](_0x1bebf9,_0x5d0c3b)[_0x6086('0x38')](function(_0x11d5ae){logger[_0x6086('0x39')](_0x6086('0x3d'),_0x11d5ae);});}}}function handleFindQueue(_0x27c6a2){return function(_0x2ea47e){return _0x2ea47e['name'][_0x6086('0x3f')]()===_0x27c6a2[_0x6086('0x3f')]();};}exports[_0x6086('0x40')]=function(_0x3e14d9,_0x30a207,_0x158a63,_0x592c79){return function(_0x321483){try{var _0x418e32={'name':_0x30a207[0x0],'timeout':_0x30a207[0x1]};var _0x1e1668=queue[_0x6086('0x0')](_0x418e32,{'typecast':!![]});if(_0x1e1668['length']){logger[_0x6086('0x39')](_0x6086('0x41'),_0x3e14d9,_['map'](_0x1e1668,_0x6086('0x31'))[_0x6086('0x42')](',\x20'));_0x321483[_0x6086('0x43')]();}else{var _0x1c7ee5=_[_0x6086('0x44')](_0x158a63[_0x592c79[_0x6086('0x2d')]+_0x6086('0x45')],handleFindQueue(_0x418e32[_0x6086('0x35')]));if(_0x1c7ee5){startRouting(_0x3e14d9,_0x1c7ee5,_0x592c79,_0x158a63);var _0x4b1dec=(_0x1c7ee5['timeout']||0xa)*0x3e8;var _0x18354a=(_0x418e32['timeout']||0x14)*0x3e8;var _0x43a77e;if(_0x4b1dec>_0x18354a){_0x18354a=_0x4b1dec;}var _0x11ed88=seqqueue['createQueue'](_0x4b1dec);_0x11ed88['id']=_0x3e14d9;_0x11ed88['atimeout']=_0x4b1dec;_0x11ed88['qtimeout']=_0x18354a;_0x11ed88[_0x6086('0x2d')]=_0x592c79[_0x6086('0x2d')];_0x158a63[_0x6086('0x46')][_0x3e14d9]['on'](_0x6086('0x47'),function(){logger[_0x6086('0x33')]('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0x3e14d9);stopRouting(_0x3e14d9,_0x1c7ee5,_0x592c79,_0x158a63);clearTimeout(_0x43a77e);_0x43a77e=undefined;_0x11ed88['close'](!![]);if(_0x158a63[_0x6086('0x46')][_0x3e14d9]){delete _0x158a63[_0x6086('0x46')][_0x3e14d9];}_0x321483[_0x6086('0x43')]();});_0x158a63['rules'][_0x3e14d9]['on'](_0x6086('0x48'),function(){if(_0x158a63['rules'][_0x3e14d9]){delete _0x158a63['rules'][_0x3e14d9];}});_0x43a77e=setTimeout(function(){logger['info'](_0x6086('0x49'),_0x3e14d9);endRouting(_0x3e14d9,_0x1c7ee5,_0x592c79,_0x158a63);clearTimeout(_0x43a77e);_0x11ed88[_0x6086('0x4a')](!![]);_0x321483[_0x6086('0x4b')]();},_0x18354a);switch(_0x1c7ee5[_0x6086('0x4c')]){case _0x6086('0x4d'):strategy[_0x6086('0x4d')](_0x11ed88,_0x1c7ee5,_0x158a63,_0x592c79);break;default:strategy[_0x6086('0x4e')](_0x11ed88,_0x1c7ee5,_0x158a63,_0x592c79);}}else{logger[_0x6086('0x39')](_0x6086('0x4f'),_0x3e14d9,_0x418e32['name']);_0x321483[_0x6086('0x43')]();}}}catch(_0x5ec384){logger[_0x6086('0x39')](_0x6086('0x41'),_0x3e14d9,_0x5ec384[_0x6086('0x50')]);_0x321483[_0x6086('0x43')]();}};}; \ 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 7275486..bc4f38c 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 _0x1cc7=['forcedOwnership','channel','busy','busyQueue','saveWaitingNotification','showNotification','notificationId','writeLog',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','STOP','TIMEOUT','exports','lodash','uuid','./util','realtime','squeue','push','handleRun','bind','handleTimeout','timeout','prototype','handleDrained','debug','agent','isNil','agents','routing'];(function(_0x31b702,_0x2d85d6){var _0x5e53e6=function(_0x392aa2){while(--_0x392aa2){_0x31b702['push'](_0x31b702['shift']());}};_0x5e53e6(++_0x2d85d6);}(_0x1cc7,0x15a));var _0x71cc=function(_0x2c1d9e,_0x544970){_0x2c1d9e=_0x2c1d9e-0x0;var _0x160348=_0x1cc7[_0x2c1d9e];return _0x160348;};'use strict';var _=require(_0x71cc('0x0'));var uuid=require(_0x71cc('0x1'));var util=require(_0x71cc('0x2'));var logger=require('../../../../../config/logger')('routing');var Agent=function(_0x547fe6,_0xe5d54e,_0x1fac93,_0x402191){this['notificationId']=uuid['v4']();this['squeue']=_0x547fe6;this['agent']=_0xe5d54e;this[_0x71cc('0x3')]=_0x1fac93;this['routing']=_0x402191;this[_0x71cc('0x4')][_0x71cc('0x5')](this[_0x71cc('0x6')][_0x71cc('0x7')](this),this[_0x71cc('0x8')]['bind'](this));this[_0x71cc('0x4')]['on'](_0x71cc('0x9'),this[_0x71cc('0x8')]['bind'](this));this['squeue']['on']('drained',this['handleDrained'][_0x71cc('0x7')](this));};Agent[_0x71cc('0xa')][_0x71cc('0x5')]=function(){this['squeue'][_0x71cc('0x5')](this['handleRun'][_0x71cc('0x7')](this),this['handleTimeout'][_0x71cc('0x7')](this));};Agent['prototype'][_0x71cc('0xb')]=function(){this[_0x71cc('0x8')](!![]);};Agent[_0x71cc('0xa')][_0x71cc('0x6')]=function(){logger[_0x71cc('0xc')]('[%s][AGENT]\x20try\x20with\x20%s',this[_0x71cc('0x4')]['id'],this[_0x71cc('0xd')]['id']);if(_[_0x71cc('0xe')](this[_0x71cc('0x3')][_0x71cc('0xf')][this[_0x71cc('0xd')]['id']])){logger[_0x71cc('0xc')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x71cc('0x4')]['id'],this[_0x71cc('0xd')]['id']);setTimeout(this[_0x71cc('0x5')][_0x71cc('0x7')](this),0x3e8);}else{if(this[_0x71cc('0x10')][_0x71cc('0x11')]||util['isAgentAvailable'](this[_0x71cc('0x4')]['id'],this[_0x71cc('0x3')]['agents'][this['agent']['id']],this[_0x71cc('0x4')][_0x71cc('0x12')],![])){this[_0x71cc('0x3')][_0x71cc('0xf')][this[_0x71cc('0xd')]['id']][_0x71cc('0x13')]=!![];this[_0x71cc('0x3')][_0x71cc('0xf')][this['agent']['id']][_0x71cc('0x14')]=undefined;util[_0x71cc('0x15')](this['realtime'],this[_0x71cc('0x10')],this[_0x71cc('0xd')],this[_0x71cc('0x4')][_0x71cc('0x12')]);util[_0x71cc('0x16')](this[_0x71cc('0x17')],this['squeue']['id'],this[_0x71cc('0x3')][_0x71cc('0xf')][this[_0x71cc('0xd')]['id']],null,this[_0x71cc('0x10')]);util[_0x71cc('0x18')](this[_0x71cc('0x4')]['id'],this[_0x71cc('0x3')][_0x71cc('0xf')][this[_0x71cc('0xd')]['id']],'RINGING'+(this[_0x71cc('0x10')][_0x71cc('0x11')]?_0x71cc('0x19'):''));}else{logger[_0x71cc('0xc')](_0x71cc('0x1a'),this[_0x71cc('0x4')]['id'],this[_0x71cc('0xd')]['id']);setTimeout(this[_0x71cc('0x5')][_0x71cc('0x7')](this),0x3e8);}}};Agent[_0x71cc('0xa')][_0x71cc('0x8')]=function(_0x35f723){if(_[_0x71cc('0xe')](this[_0x71cc('0x3')][_0x71cc('0xf')][this[_0x71cc('0xd')]['id']])){return logger['debug'](_0x71cc('0x1b'),this[_0x71cc('0x4')]['id'],this[_0x71cc('0xd')]['id']);}else{logger[_0x71cc('0xc')](_0x71cc('0x1c'),this[_0x71cc('0x4')]['id'],this['agent']['id']);util[_0x71cc('0x1d')](this[_0x71cc('0x17')],this[_0x71cc('0x4')]['id'],this[_0x71cc('0x3')][_0x71cc('0xf')][this[_0x71cc('0xd')]['id']],null,this[_0x71cc('0x10')]);this['realtime'][_0x71cc('0xf')][this['agent']['id']]['busy']=![];this[_0x71cc('0x3')]['agents'][this['agent']['id']][_0x71cc('0x14')]=undefined;util['removeWaitingNotification'](this[_0x71cc('0x3')],this['routing'],this[_0x71cc('0xd')],this[_0x71cc('0x4')]['channel']);util[_0x71cc('0x18')](this[_0x71cc('0x4')]['id'],this[_0x71cc('0x3')][_0x71cc('0xf')][this[_0x71cc('0xd')]['id']],_0x35f723?_0x71cc('0x1e'):_0x71cc('0x1f'));}if(!_0x35f723){setTimeout(this[_0x71cc('0x5')][_0x71cc('0x7')](this),0x3e8);}};function agent(_0x2f8a72,_0x4b7bc6,_0x4330f0,_0x54d16a){return new Agent(_0x2f8a72,_0x4b7bc6,_0x4330f0,_0x54d16a);}module[_0x71cc('0x20')]=agent; \ No newline at end of file +var _0x9b9b=['hideNotification','busyQueue','removeWaitingNotification','writeLog','STOP','exports','uuid','routing','notificationId','squeue','agent','realtime','push','handleRun','bind','handleTimeout','handleDrained','prototype','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','debug','forcedOwnership','channel','busy','saveWaitingNotification','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s'];(function(_0x473a29,_0x2cd27c){var _0x1a17a0=function(_0x1cfcd6){while(--_0x1cfcd6){_0x473a29['push'](_0x473a29['shift']());}};_0x1a17a0(++_0x2cd27c);}(_0x9b9b,0x114));var _0xb9b9=function(_0x5d660b,_0x2b6023){_0x5d660b=_0x5d660b-0x0;var _0x29263a=_0x9b9b[_0x5d660b];return _0x29263a;};'use strict';var _=require('lodash');var uuid=require(_0xb9b9('0x0'));var util=require('./util');var logger=require('../../../../../config/logger')(_0xb9b9('0x1'));var Agent=function(_0x153734,_0x1adf50,_0x1f6fea,_0x1d6ab6){this[_0xb9b9('0x2')]=uuid['v4']();this[_0xb9b9('0x3')]=_0x153734;this[_0xb9b9('0x4')]=_0x1adf50;this[_0xb9b9('0x5')]=_0x1f6fea;this[_0xb9b9('0x1')]=_0x1d6ab6;this[_0xb9b9('0x3')][_0xb9b9('0x6')](this[_0xb9b9('0x7')][_0xb9b9('0x8')](this),this[_0xb9b9('0x9')][_0xb9b9('0x8')](this));this['squeue']['on']('timeout',this[_0xb9b9('0x9')][_0xb9b9('0x8')](this));this[_0xb9b9('0x3')]['on']('drained',this[_0xb9b9('0xa')][_0xb9b9('0x8')](this));};Agent[_0xb9b9('0xb')]['push']=function(){this[_0xb9b9('0x3')][_0xb9b9('0x6')](this[_0xb9b9('0x7')][_0xb9b9('0x8')](this),this[_0xb9b9('0x9')][_0xb9b9('0x8')](this));};Agent['prototype']['handleDrained']=function(){this[_0xb9b9('0x9')](!![]);};Agent['prototype'][_0xb9b9('0x7')]=function(){logger['debug'](_0xb9b9('0xc'),this[_0xb9b9('0x3')]['id'],this[_0xb9b9('0x4')]['id']);if(_[_0xb9b9('0xd')](this[_0xb9b9('0x5')][_0xb9b9('0xe')][this[_0xb9b9('0x4')]['id']])){logger[_0xb9b9('0xf')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0xb9b9('0x3')]['id'],this['agent']['id']);setTimeout(this[_0xb9b9('0x6')][_0xb9b9('0x8')](this),0x3e8);}else{if(this[_0xb9b9('0x1')][_0xb9b9('0x10')]||util['isAgentAvailable'](this[_0xb9b9('0x3')]['id'],this[_0xb9b9('0x5')][_0xb9b9('0xe')][this[_0xb9b9('0x4')]['id']],this[_0xb9b9('0x3')][_0xb9b9('0x11')],![])){this[_0xb9b9('0x5')][_0xb9b9('0xe')][this[_0xb9b9('0x4')]['id']][_0xb9b9('0x12')]=!![];this[_0xb9b9('0x5')][_0xb9b9('0xe')][this[_0xb9b9('0x4')]['id']]['busyQueue']=undefined;util[_0xb9b9('0x13')](this[_0xb9b9('0x5')],this[_0xb9b9('0x1')],this['agent'],this[_0xb9b9('0x3')][_0xb9b9('0x11')]);util['showNotification'](this[_0xb9b9('0x2')],this[_0xb9b9('0x3')]['id'],this[_0xb9b9('0x5')][_0xb9b9('0xe')][this[_0xb9b9('0x4')]['id']],null,this['routing']);util['writeLog'](this[_0xb9b9('0x3')]['id'],this[_0xb9b9('0x5')]['agents'][this[_0xb9b9('0x4')]['id']],_0xb9b9('0x14')+(this[_0xb9b9('0x1')][_0xb9b9('0x10')]?_0xb9b9('0x15'):''));}else{logger['debug'](_0xb9b9('0x16'),this['squeue']['id'],this[_0xb9b9('0x4')]['id']);setTimeout(this[_0xb9b9('0x6')]['bind'](this),0x3e8);}}};Agent[_0xb9b9('0xb')][_0xb9b9('0x9')]=function(_0x17a6f6){if(_['isNil'](this[_0xb9b9('0x5')][_0xb9b9('0xe')][this[_0xb9b9('0x4')]['id']])){return logger[_0xb9b9('0xf')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0xb9b9('0x3')]['id'],this[_0xb9b9('0x4')]['id']);}else{logger['debug'](_0xb9b9('0x17'),this[_0xb9b9('0x3')]['id'],this[_0xb9b9('0x4')]['id']);util[_0xb9b9('0x18')](this['notificationId'],this[_0xb9b9('0x3')]['id'],this[_0xb9b9('0x5')][_0xb9b9('0xe')][this[_0xb9b9('0x4')]['id']],null,this['routing']);this[_0xb9b9('0x5')][_0xb9b9('0xe')][this['agent']['id']][_0xb9b9('0x12')]=![];this[_0xb9b9('0x5')][_0xb9b9('0xe')][this[_0xb9b9('0x4')]['id']][_0xb9b9('0x19')]=undefined;util[_0xb9b9('0x1a')](this['realtime'],this[_0xb9b9('0x1')],this[_0xb9b9('0x4')],this['squeue'][_0xb9b9('0x11')]);util[_0xb9b9('0x1b')](this[_0xb9b9('0x3')]['id'],this['realtime'][_0xb9b9('0xe')][this['agent']['id']],_0x17a6f6?_0xb9b9('0x1c'):'TIMEOUT');}if(!_0x17a6f6){setTimeout(this[_0xb9b9('0x6')][_0xb9b9('0x8')](this),0x3e8);}};function agent(_0x22b567,_0x1f1faf,_0x3dd3fe,_0x76f4d4){return new Agent(_0x22b567,_0x1f1faf,_0x3dd3fe,_0x76f4d4);}module[_0xb9b9('0x1d')]=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 15147f0..6aacee0 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 _0x90fc=['./util','notificationId','squeue','queue','routing','handleRun','bind','handleDrained','prototype','push','handleTimeout','isNil','Agents','length','realtime','agents','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','channel','writeLog','RINGING','busy','busyQueue','saveWaitingNotification','debug','[%s][QUEUE]\x20EMPTY','STOP','TIMEOUT','exports','lodash','uuid'];(function(_0x1d8eb6,_0x2532a7){var _0x94972=function(_0x4f175e){while(--_0x4f175e){_0x1d8eb6['push'](_0x1d8eb6['shift']());}};_0x94972(++_0x2532a7);}(_0x90fc,0x191));var _0xc90f=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0x90fc[_0x2e4aa2];return _0x5e6092;};'use strict';var _=require(_0xc90f('0x0'));var uuid=require(_0xc90f('0x1'));var util=require(_0xc90f('0x2'));var logger=require('../../../../../config/logger')('routing');var Beepall=function(_0x1b498f,_0x25b327,_0x1abbe7,_0x443327){this[_0xc90f('0x3')]=uuid['v4']();this[_0xc90f('0x4')]=_0x1b498f;this[_0xc90f('0x5')]=_0x25b327;this['realtime']=_0x1abbe7;this[_0xc90f('0x6')]=_0x443327;this['squeue']['push'](this[_0xc90f('0x7')][_0xc90f('0x8')](this),this['handleTimeout'][_0xc90f('0x8')](this));this['squeue']['on']('timeout',this['handleTimeout'][_0xc90f('0x8')](this));this[_0xc90f('0x4')]['on']('drained',this[_0xc90f('0x9')][_0xc90f('0x8')](this));};Beepall[_0xc90f('0xa')][_0xc90f('0xb')]=function(){this[_0xc90f('0x4')][_0xc90f('0xb')](this[_0xc90f('0x7')][_0xc90f('0x8')](this),this['handleTimeout'][_0xc90f('0x8')](this));};Beepall[_0xc90f('0xa')]['handleDrained']=function(){this[_0xc90f('0xc')](!![]);};Beepall[_0xc90f('0xa')]['handleRun']=function(){var _0x2beb68=!![];if(!_['isNil'](this[_0xc90f('0x5')])&&!_[_0xc90f('0xd')](this['queue'][_0xc90f('0xe')])&&this[_0xc90f('0x5')][_0xc90f('0xe')][_0xc90f('0xf')]>0x0){for(var _0x4e121f=0x0,_0x5cd87a;_0x4e121f0x0){for(var _0x142451=0x0,_0x4cd5b5;_0x1424510x0&&_0x30817e[_0x326728+'CurrentCapacity']>=_0x30817e[_0x326728+_0x9b9d('0x22')]){writeLog(_0x4f5370,_0x30817e,_0x326728[_0x9b9d('0x23')]()+_0x9b9d('0x24'));return![];}}return!![];};exports[_0x9b9d('0x25')]=function(_0x3e543f,_0x2a0852,_0x1e52bb,_0x758fba,_0x38e0b8){return sendNotification(!![],_0x3e543f,_0x2a0852,_0x1e52bb,_0x758fba,_0x38e0b8);};exports[_0x9b9d('0x26')]=function(_0x3e3497,_0x104c85,_0x584a53,_0x334f8c,_0x1ae0d7){return sendNotification(![],_0x3e3497,_0x104c85,_0x584a53,_0x334f8c,_0x1ae0d7);};exports[_0x9b9d('0x27')]=function(_0x3aa7f3,_0x543148,_0x32146a){var _0x3440ae=_0x543148[_0x9b9d('0x28')][_0x9b9d('0x29')];if(!_0x3440ae&&_0x32146a){_0x3440ae=_0x32146a['id'];}var _0x34a6d2=_['some'](_0x3aa7f3[_0x543148[_0x9b9d('0x2a')]+_0x9b9d('0x2b')],function(_0x343fed){var _0x5cb8e0=_[_0x9b9d('0x2c')](_0x543148['channel'])+_0x9b9d('0x2d');return _0x343fed[_0x5cb8e0]===_0x543148[_0x9b9d('0x28')]['id'];});if(!_0x34a6d2&&_0x3440ae&&_0x3aa7f3[_0x9b9d('0x2e')][_0x3440ae]){_0x34a6d2=_[_0x9b9d('0x2f')](_0x3aa7f3[_0x9b9d('0x2e')][_0x3440ae][_0x543148[_0x9b9d('0x2a')]+_0x9b9d('0x30')],function(_0x2ac233){return _0x2ac233['id']===_0x543148[_0x9b9d('0x28')]['id'];});}return _0x34a6d2;};exports[_0x9b9d('0x31')]=function(_0x11e226,_0xb0d506,_0x4456c0,_0x521adb){if(_0x4456c0&&_0x4456c0['id']&&_0x11e226[_0x9b9d('0x2e')]&&_0x11e226[_0x9b9d('0x2e')][_0x4456c0['id']]){_0x11e226['agents'][_0x4456c0['id']][_0x521adb+_0x9b9d('0x30')][_0xb0d506['message']['id']]={'id':_0xb0d506[_0x9b9d('0x28')]['id']};}};exports['removeWaitingNotification']=function(_0x1cd67b,_0x1a6d53,_0x59037d,_0x30a700){if(_0x59037d&&_0x59037d['id']&&_0x1cd67b[_0x9b9d('0x2e')]&&_0x1cd67b[_0x9b9d('0x2e')][_0x59037d['id']]){delete _0x1cd67b[_0x9b9d('0x2e')][_0x59037d['id']][_0x30a700+_0x9b9d('0x30')][_0x1a6d53['message']['id']];}};exports[_0x9b9d('0x32')]=writeLog; \ No newline at end of file +var _0xa1ae=['toUpperCase','\x20MAXCAPACITY','hideNotification','interaction','UserId','some','channel','QueuesWaitingInteractions','capitalize','agents','WaitingInteractions','saveWaitingNotification','removeWaitingNotification','writeLog','lodash','../utils','ioredis','../../../../../config/environment','../../../../../config/logger','routing','redis','defaults','localhost','split','\x20interaction','name','account','notificationSound','notificationShake','body','queue','msg','getMustacheRender','I\x20can\x27t\x20render\x20your\x20template','error','message','format','emit','notification:%s','debug','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','busy','BUSY','OFFLINE','Pause','PAUSE','hasOwnProperty','Capacity'];(function(_0xee8c24,_0x2a3d5b){var _0x11eb85=function(_0x80adf6){while(--_0x80adf6){_0xee8c24['push'](_0xee8c24['shift']());}};_0x11eb85(++_0x2a3d5b);}(_0xa1ae,0x134));var _0xea1a=function(_0x51451a,_0x72fe42){_0x51451a=_0x51451a-0x0;var _0x567110=_0xa1ae[_0x51451a];return _0x567110;};'use strict';var _=require(_0xea1a('0x0'));var util=require('util');var utils=require(_0xea1a('0x1'));var Redis=require(_0xea1a('0x2'));var config=require(_0xea1a('0x3'));var logger=require(_0xea1a('0x4'))(_0xea1a('0x5'));config[_0xea1a('0x6')]=_[_0xea1a('0x7')](config['redis'],{'host':_0xea1a('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xea1a('0x6')]));function sendNotification(_0x4a863f,_0x594798,_0x5ebd74,_0x168ffd,_0x5a82f0,_0x36c07b){var _0x26e2ca=_0x36c07b||{};var _0x3f3a56=_0x5ebd74[_0xea1a('0x9')]('.');var _0x3db510={'uniqueid':_0x594798,'channel':_0x3f3a56[0x0],'id':_0x3f3a56[0x1],'title':_0x3f3a56[0x0]+_0xea1a('0xa'),'interactionId':_0x3f3a56[0x2],'queue':_0x5a82f0?_0x5a82f0[_0xea1a('0xb')]:null,'sound':_0x26e2ca[_0xea1a('0xc')][_0xea1a('0xd')],'shake':_0x26e2ca[_0xea1a('0xc')][_0xea1a('0xe')]};try{if(!_0x26e2ca['body']){_0x26e2ca[_0xea1a('0xf')]={};}if(_0x5a82f0){_0x26e2ca[_0xea1a('0xf')][_0xea1a('0x10')]=_0x5a82f0;}else if(_0x26e2ca[_0xea1a('0xf')][_0xea1a('0x10')]){delete _0x26e2ca[_0xea1a('0xf')][_0xea1a('0x10')];}_0x3db510[_0xea1a('0x11')]=utils[_0xea1a('0x12')](_0x26e2ca[_0xea1a('0xc')]['notificationTemplate'],_0x26e2ca);}catch(_0x4bbdb3){_0x3db510[_0xea1a('0x11')]=_0xea1a('0x13');logger[_0xea1a('0x14')](util['format']('[%s][QUEUE]\x20%s',_0x594798,_0x4bbdb3[_0xea1a('0x15')]));}io['to'](util[_0xea1a('0x16')]('user:%s',_0x168ffd[_0xea1a('0xb')]))[_0xea1a('0x17')](util[_0xea1a('0x16')](_0xea1a('0x18'),_0x4a863f?'save':'remove'),_0x3db510);}function writeLog(_0x56fab0,_0x2871ed,_0x3d8efd){return logger[_0xea1a('0x19')](util[_0xea1a('0x16')](_0xea1a('0x1a'),_0x56fab0,_0x2871ed[_0xea1a('0xb')],_0x3d8efd));}exports[_0xea1a('0x1b')]=function(_0x2cc04a,_0x1925cd,_0x408d12,_0x58d6e6){if(_0x1925cd[_0xea1a('0x1c')]){writeLog(_0x2cc04a,_0x1925cd,_0xea1a('0x1d'));return![];}if(!_0x1925cd['online']){writeLog(_0x2cc04a,_0x1925cd,_0xea1a('0x1e'));return![];}if(_0x1925cd[_0x408d12+_0xea1a('0x1f')]){writeLog(_0x2cc04a,_0x1925cd,_0xea1a('0x20'));return![];}if(_0x58d6e6&&_0x1925cd[_0xea1a('0x21')](_0x408d12+_0xea1a('0x22'))&&_0x1925cd['hasOwnProperty'](_0x408d12+'CurrentCapacity')){if(_0x1925cd[_0x408d12+_0xea1a('0x22')]>0x0&&_0x1925cd[_0x408d12+'CurrentCapacity']>=_0x1925cd[_0x408d12+_0xea1a('0x22')]){writeLog(_0x2cc04a,_0x1925cd,_0x408d12[_0xea1a('0x23')]()+_0xea1a('0x24'));return![];}}return!![];};exports['showNotification']=function(_0x514e4d,_0x34e8f8,_0x29dc15,_0x579cd5,_0xd839b0){return sendNotification(!![],_0x514e4d,_0x34e8f8,_0x29dc15,_0x579cd5,_0xd839b0);};exports[_0xea1a('0x25')]=function(_0x2c4279,_0x20c878,_0x5cf6b8,_0x103021,_0x457a10){return sendNotification(![],_0x2c4279,_0x20c878,_0x5cf6b8,_0x103021,_0x457a10);};exports['checkWaitingNotifications']=function(_0x414a25,_0x4f900f,_0x577e92){var _0x1c655c=_0x4f900f[_0xea1a('0x26')][_0xea1a('0x27')];if(!_0x1c655c&&_0x577e92){_0x1c655c=_0x577e92['id'];}var _0x4f6a56=_[_0xea1a('0x28')](_0x414a25[_0x4f900f[_0xea1a('0x29')]+_0xea1a('0x2a')],function(_0x5ce00a){var _0x1075a4=_[_0xea1a('0x2b')](_0x4f900f[_0xea1a('0x29')])+'InteractionId';return _0x5ce00a[_0x1075a4]===_0x4f900f[_0xea1a('0x26')]['id'];});if(!_0x4f6a56&&_0x1c655c&&_0x414a25[_0xea1a('0x2c')][_0x1c655c]){_0x4f6a56=_[_0xea1a('0x28')](_0x414a25[_0xea1a('0x2c')][_0x1c655c][_0x4f900f[_0xea1a('0x29')]+_0xea1a('0x2d')],function(_0x2a792d){return _0x2a792d['id']===_0x4f900f[_0xea1a('0x26')]['id'];});}return _0x4f6a56;};exports[_0xea1a('0x2e')]=function(_0x2dafb2,_0x1c793f,_0x45b008,_0x5a823e){if(_0x45b008&&_0x45b008['id']&&_0x2dafb2[_0xea1a('0x2c')]&&_0x2dafb2['agents'][_0x45b008['id']]){_0x2dafb2['agents'][_0x45b008['id']][_0x5a823e+_0xea1a('0x2d')][_0x1c793f[_0xea1a('0x15')]['id']]={'id':_0x1c793f[_0xea1a('0x26')]['id']};}};exports[_0xea1a('0x2f')]=function(_0x2b63d8,_0x663623,_0x1508e9,_0x575bc8){if(_0x1508e9&&_0x1508e9['id']&&_0x2b63d8[_0xea1a('0x2c')]&&_0x2b63d8[_0xea1a('0x2c')][_0x1508e9['id']]){delete _0x2b63d8[_0xea1a('0x2c')][_0x1508e9['id']][_0x575bc8+_0xea1a('0x2d')][_0x663623[_0xea1a('0x15')]['id']];}};exports[_0xea1a('0x30')]=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 2e618e6..23b4bfa 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 _0x8962=['isObject','stringify','shelljs','lodash','./utils','../../../../config/logger','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','validate','[%s][SYSTEM]\x20%s','map','message','info','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','isEmpty','[%s][SYSTEM]\x20no\x20variable','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','body','error'];(function(_0xec05a,_0xae2200){var _0x5911e2=function(_0x45d43d){while(--_0x45d43d){_0xec05a['push'](_0xec05a['shift']());}};_0x5911e2(++_0xae2200);}(_0x8962,0x1e2));var _0x2896=function(_0x2f13a9,_0x20b3f8){_0x2f13a9=_0x2f13a9-0x0;var _0x14af70=_0x8962[_0x2f13a9];return _0x14af70;};'use strict';var schema=require('validate');var sh=require(_0x2896('0x0'));var _=require(_0x2896('0x1'));var utils=require(_0x2896('0x2'));var logger=require(_0x2896('0x3'))('routing');var system=schema({'command':{'type':_0x2896('0x4'),'required':!![],'message':_0x2896('0x5')}});exports[_0x2896('0x6')]=function(_0x336693,_0xbb5fef){return function(_0x293b35){try{var _0x59ca56={'command':_0xbb5fef[0x0]};var _0x2e052b=system[_0x2896('0x7')](_0x59ca56,{'typecast':!![]});if(_0x2e052b['length']){logger['error'](_0x2896('0x8'),_0x336693,_[_0x2896('0x9')](_0x2e052b,_0x2896('0xa'))['join'](',\x20'));logger[_0x2896('0xb')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x336693);_0x293b35[_0x2896('0xc')]();}else{var _0x5cd009=this;var _0x11ed02=utils[_0x2896('0xd')](_0xbb5fef[0x0],this);logger[_0x2896('0xb')](_0x2896('0xe'),_0x336693,_0x11ed02);sh[_0x2896('0xf')](_[_0x2896('0x10')](_0x11ed02),function(_0x1a9f6f,_0xd9bd2a){logger[_0x2896('0xb')]('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x336693,_0x1a9f6f);if(_0x1a9f6f==0x0){var _0x1cdd89=_0xd9bd2a['replace'](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0xbb5fef[0x1])||_[_0x2896('0x11')](_0xbb5fef[0x1])){logger[_0x2896('0xb')](_0x2896('0x12'),_0x336693);_0x5cd009['body'][_0xbb5fef[0x1]]=_0x1cdd89;}else{logger[_0x2896('0xb')](_0x2896('0x13'),_0x336693,_0xbb5fef[0x1],_0x1cdd89);_0x5cd009[_0x2896('0x14')][_0xbb5fef[0x1]]=_0x1cdd89;}}_0x293b35[_0x2896('0xc')]();});}}catch(_0x3c35f8){logger[_0x2896('0x15')](_0x2896('0x8'),_0x336693,_[_0x2896('0x16')](_0x3c35f8)?JSON[_0x2896('0x17')](_0x3c35f8):_0x3c35f8);logger[_0x2896('0xb')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x336693);_0x293b35[_0x2896('0xc')]();}};}; \ No newline at end of file +var _0x2b51=['next','isObject','stringify','validate','shelljs','lodash','./utils','../../../../config/logger','routing','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','length','error','[%s][SYSTEM]\x20%s','join','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','getMustacheRender','info','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable'];(function(_0x16ee72,_0x7ab5c7){var _0x1a8d8c=function(_0x16bdfe){while(--_0x16bdfe){_0x16ee72['push'](_0x16ee72['shift']());}};_0x1a8d8c(++_0x7ab5c7);}(_0x2b51,0x1c5));var _0x12b5=function(_0x558714,_0x2ab091){_0x558714=_0x558714-0x0;var _0x388578=_0x2b51[_0x558714];return _0x388578;};'use strict';var schema=require(_0x12b5('0x0'));var sh=require(_0x12b5('0x1'));var _=require(_0x12b5('0x2'));var utils=require(_0x12b5('0x3'));var logger=require(_0x12b5('0x4'))(_0x12b5('0x5'));var system=schema({'command':{'type':'string','required':!![],'message':_0x12b5('0x6')}});exports['consequence']=function(_0x5b65f8,_0x15c5da){return function(_0x2275d8){try{var _0x38a245={'command':_0x15c5da[0x0]};var _0x3fa276=system[_0x12b5('0x0')](_0x38a245,{'typecast':!![]});if(_0x3fa276[_0x12b5('0x7')]){logger[_0x12b5('0x8')](_0x12b5('0x9'),_0x5b65f8,_['map'](_0x3fa276,'message')[_0x12b5('0xa')](',\x20'));logger['info'](_0x12b5('0xb'),_0x5b65f8);_0x2275d8['next']();}else{var _0x80d981=this;var _0x127cb7=utils[_0x12b5('0xc')](_0x15c5da[0x0],this);logger[_0x12b5('0xd')](_0x12b5('0xe'),_0x5b65f8,_0x127cb7);sh[_0x12b5('0xf')](_[_0x12b5('0x10')](_0x127cb7),function(_0x2f2027,_0x48a910){logger['info'](_0x12b5('0x11'),_0x5b65f8,_0x2f2027);if(_0x2f2027==0x0){var _0x18b765=_0x48a910[_0x12b5('0x12')](/(\r\n|\n|\r)/gm,'');if(_[_0x12b5('0x13')](_0x15c5da[0x1])||_[_0x12b5('0x14')](_0x15c5da[0x1])){logger[_0x12b5('0xd')](_0x12b5('0x15'),_0x5b65f8);_0x80d981['body'][_0x15c5da[0x1]]=_0x18b765;}else{logger['info']('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0x5b65f8,_0x15c5da[0x1],_0x18b765);_0x80d981['body'][_0x15c5da[0x1]]=_0x18b765;}}_0x2275d8[_0x12b5('0x16')]();});}}catch(_0x2c75dd){logger[_0x12b5('0x8')](_0x12b5('0x9'),_0x5b65f8,_[_0x12b5('0x17')](_0x2c75dd)?JSON[_0x12b5('0x18')](_0x2c75dd):_0x2c75dd);logger[_0x12b5('0xd')](_0x12b5('0xb'),_0x5b65f8);_0x2275d8['next']();}};}; \ 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 24b0dce..7e6c72e 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 _0xbf85=['finally','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','number','length','message','info','next','channel','Interaction','addTags','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','interaction','catch','error','[%s][TAG]\x20%s','stringify','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next'];(function(_0x1a6ad7,_0xf1b8b2){var _0x2122b7=function(_0x370afe){while(--_0x370afe){_0x1a6ad7['push'](_0x1a6ad7['shift']());}};_0x2122b7(++_0xf1b8b2);}(_0xbf85,0x178));var _0x5bf8=function(_0x56c442,_0x433de4){_0x56c442=_0x56c442-0x0;var _0x2944db=_0xbf85[_0x56c442];return _0x2944db;};'use strict';var schema=require(_0x5bf8('0x0'));var _=require(_0x5bf8('0x1'));var rpc={'chatInteraction':require(_0x5bf8('0x2')),'openchannelInteraction':require(_0x5bf8('0x3')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0x5bf8('0x4')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x5bf8('0x5'))};var logger=require(_0x5bf8('0x6'))(_0x5bf8('0x7'));var tag=schema({'tag':{'type':_0x5bf8('0x8'),'required':!![],'message':'TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports['consequence']=function(_0x5b6f1c,_0x22bbbe,_0x27a9a8,_0x347f96){return function(_0x295d69){try{var _0x1e3c7c={'tag':_0x22bbbe[0x0]};var _0x154237=tag[_0x5bf8('0x0')](_0x1e3c7c,{'typecast':!![]});if(_0x154237[_0x5bf8('0x9')]){logger['error']('[%s][TAG]\x20%s',_0x5b6f1c,_['map'](_0x154237,_0x5bf8('0xa'))['join'](',\x20'));logger[_0x5bf8('0xb')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x5b6f1c);_0x295d69[_0x5bf8('0xc')]();}else{var _0x5d4ce7={'ids':[_0x22bbbe[0x0]]};if(rpc[_0x347f96[_0x5bf8('0xd')]+_0x5bf8('0xe')]){rpc[_0x347f96[_0x5bf8('0xd')]+'Interaction'][_0x5bf8('0xf')](_0x347f96['interaction']['id'],_0x5d4ce7)[_0x5bf8('0x10')](function(_0x4cff16){logger[_0x5bf8('0xb')](_0x5bf8('0x11'),_0x5b6f1c,_0x22bbbe[0x1],_0x347f96[_0x5bf8('0xd')],_0x347f96[_0x5bf8('0x12')]['id']);})[_0x5bf8('0x13')](function(_0x347002){logger[_0x5bf8('0x14')](_0x5bf8('0x15'),_0x5b6f1c,JSON[_0x5bf8('0x16')](_0x347002));logger['info'](_0x5bf8('0x17'),_0x5b6f1c);})[_0x5bf8('0x18')](function(){_0x295d69[_0x5bf8('0xc')]();});}}}catch(_0x3f2251){logger[_0x5bf8('0x14')](_0x5bf8('0x15'),_0x5b6f1c,_['isObject'](_0x3f2251)?JSON[_0x5bf8('0x16')](_0x3f2251):_0x3f2251);logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x5b6f1c);_0x295d69[_0x5bf8('0xc')]();}};}; \ No newline at end of file +var _0x2464=['../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','../../../../config/logger','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','validate','map','message','join','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','Interaction','channel','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','[%s][TAG]\x20%s','stringify','finally','isObject','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction'];(function(_0xe7b9f,_0x14e885){var _0x20bc26=function(_0x2739e5){while(--_0x2739e5){_0xe7b9f['push'](_0xe7b9f['shift']());}};_0x20bc26(++_0x14e885);}(_0x2464,0x75));var _0x4246=function(_0xe0822a,_0x1c5686){_0xe0822a=_0xe0822a-0x0;var _0x3219a3=_0x2464[_0xe0822a];return _0x3219a3;};'use strict';var schema=require('validate');var _=require(_0x4246('0x0'));var rpc={'chatInteraction':require(_0x4246('0x1')),'openchannelInteraction':require(_0x4246('0x2')),'smsInteraction':require(_0x4246('0x3')),'mailInteraction':require(_0x4246('0x4')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x4246('0x5'))};var logger=require(_0x4246('0x6'))('routing');var tag=schema({'tag':{'type':_0x4246('0x7'),'required':!![],'message':_0x4246('0x8')}});exports['consequence']=function(_0x39a3c1,_0x1a5ba9,_0x1c20c8,_0x11e120){return function(_0xc8a0e1){try{var _0x50f952={'tag':_0x1a5ba9[0x0]};var _0x1e8732=tag[_0x4246('0x9')](_0x50f952,{'typecast':!![]});if(_0x1e8732['length']){logger['error']('[%s][TAG]\x20%s',_0x39a3c1,_[_0x4246('0xa')](_0x1e8732,_0x4246('0xb'))[_0x4246('0xc')](',\x20'));logger['info'](_0x4246('0xd'),_0x39a3c1);_0xc8a0e1[_0x4246('0xe')]();}else{var _0x3e7590={'ids':[_0x1a5ba9[0x0]]};if(rpc[_0x11e120['channel']+_0x4246('0xf')]){rpc[_0x11e120[_0x4246('0x10')]+_0x4246('0xf')]['addTags'](_0x11e120[_0x4246('0x11')]['id'],_0x3e7590)[_0x4246('0x12')](function(_0x5bbfd7){logger['info'](_0x4246('0x13'),_0x39a3c1,_0x1a5ba9[0x1],_0x11e120[_0x4246('0x10')],_0x11e120[_0x4246('0x11')]['id']);})['catch'](function(_0x166245){logger['error'](_0x4246('0x14'),_0x39a3c1,JSON[_0x4246('0x15')](_0x166245));logger['info'](_0x4246('0xd'),_0x39a3c1);})[_0x4246('0x16')](function(){_0xc8a0e1[_0x4246('0xe')]();});}}}catch(_0x505438){logger['error'](_0x4246('0x14'),_0x39a3c1,_[_0x4246('0x17')](_0x505438)?JSON[_0x4246('0x15')](_0x505438):_0x505438);logger['info'](_0x4246('0xd'),_0x39a3c1);_0xc8a0e1['next']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tvox.js b/server/services/routing/server/applications/tvox.js index 1f98487..75c1bf4 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 _0xf6f6=['request-promise','../../../../config/logger','routing','lodash','consequence','replace','\x20-\x20','includes','push','?params=','urlOnRing','title','jsonrpc','2.0','login','params','utf8','POST','application/json-rpc','parse','result','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','&serviceId=','&sessionId=','&data=','then','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','catch','error','[%s][TVOX]\x20%s','stringify','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next'];(function(_0x2dc6f6,_0x4f2468){var _0x2055d3=function(_0x126959){while(--_0x126959){_0x2dc6f6['push'](_0x2dc6f6['shift']());}};_0x2055d3(++_0x4f2468);}(_0xf6f6,0x144));var _0x6f6f=function(_0x279368,_0x41c002){_0x279368=_0x279368-0x0;var _0x40b6d0=_0xf6f6[_0x279368];return _0x40b6d0;};'use strict';var rp=require(_0x6f6f('0x0'));var logger=require(_0x6f6f('0x1'))(_0x6f6f('0x2'));var _=require(_0x6f6f('0x3'));var arr=[];exports[_0x6f6f('0x4')]=function(_0x22beb3,_0x2d7ae5){return function(_0x5e8982){var _0xfa45b8=_0x2d7ae5[0xa];var _0x199ac9=_0x2d7ae5[0xb];var _0x1169b3=_0x2d7ae5[0xc];var _0xaa49f8=_0x2d7ae5[0xd];var _0x4a75dc=_0x2d7ae5[0xe];var _0x34c585=_0x2d7ae5[0xf][_0x6f6f('0x5')](/\n/g,_0x6f6f('0x6'));var _0x49b92c=_0x2d7ae5[0x10][_0x6f6f('0x5')](/\n/g,'\x20');if(!arr[_0x6f6f('0x7')](_0x199ac9)){arr[_0x6f6f('0x8')](_0x199ac9);var _0x57de9a=_0x2d7ae5[0x3];var _0x1c3579=_0x2d7ae5[0x4];var _0x17d9b1=_0x2d7ae5[0x1];var _0x309a9a=_0x2d7ae5[0x0];var _0x111f0c={};_0x111f0c['urlOnAnswer']=_0x2d7ae5[0x8]+_0x6f6f('0x9')+_0x1169b3+'|'+_0xfa45b8+'|'+_0xaa49f8+'|'+_0x199ac9+'|'+_0x4a75dc;_0x111f0c[_0x6f6f('0xa')]=_0x2d7ae5[0x7]+_0x6f6f('0x9')+_0x1169b3+'|'+_0xfa45b8+'|'+_0xaa49f8+'|'+_0x199ac9+'|'+_0x4a75dc+'|'+_0x34c585+'|'+_0x49b92c;_0x111f0c[_0x6f6f('0xb')]=_0x2d7ae5[0x9];var _0x2bcd8e={};_0x2bcd8e[_0x6f6f('0xc')]=_0x6f6f('0xd');_0x2bcd8e['method']=_0x6f6f('0xe');var _0x19fbdd=[];_0x19fbdd[_0x6f6f('0x8')](_0x2d7ae5[0x2]);_0x19fbdd[_0x6f6f('0x8')](_0x2d7ae5[0x5]);_0x19fbdd[_0x6f6f('0x8')](_0x2d7ae5[0x6]);_0x2bcd8e[_0x6f6f('0xf')]=_0x19fbdd;_0x2bcd8e['id']=0x1;var _0x45b77d=JSON['stringify'](_0x2bcd8e);var _0x39a03b={'encoding':_0x6f6f('0x10'),'method':_0x6f6f('0x11'),'timeout':0x2710,'url':_0x57de9a,'headers':{'Content-Type':_0x6f6f('0x12')},'body':_0x45b77d};return rp(_0x39a03b)['then'](function(_0x2e6aed){const _0x406ee7=JSON[_0x6f6f('0x13')](_0x2e6aed);if(!_0x406ee7[_0x6f6f('0x14')][_0x6f6f('0x15')]){throw new Error(_0x6f6f('0x16'));}var _0xb0a84f=_0x199ac9;var _0x5db96a='channelId='+_0x17d9b1+_0x6f6f('0x17')+_0x309a9a+_0x6f6f('0x18')+_0xb0a84f+_0x6f6f('0x19')+JSON['stringify'](_0x111f0c);var _0x5beb30=_0x1c3579+'?'+_0x5db96a;return rp(_0x5beb30);})[_0x6f6f('0x1a')](function(_0x3a9149){logger[_0x6f6f('0x1b')](_0x6f6f('0x1c'),_0x22beb3,_0x3a9149);_0x5e8982[_0x6f6f('0x1d')]();})[_0x6f6f('0x1e')](function(_0x570c76){logger[_0x6f6f('0x1f')](_0x6f6f('0x20'),_0x22beb3,_['isObject'](_0x570c76)?JSON[_0x6f6f('0x21')](_0x570c76):_0x570c76);_0x5e8982[_0x6f6f('0x1d')]();});}else{logger[_0x6f6f('0x1b')](_0x6f6f('0x22'),_0x22beb3);_0x5e8982[_0x6f6f('0x23')]();}};}; \ No newline at end of file +var _0xb086=['request-promise','../../../../config/logger','lodash','consequence','replace','\x20-\x20','includes','push','urlOnAnswer','?params=','title','jsonrpc','method','login','stringify','utf8','POST','then','result','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','&sessionId=','&data=','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','error','[%s][TVOX]\x20%s','isObject','stop','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next'];(function(_0x4ded52,_0xa1fc39){var _0x5af77c=function(_0x1271fd){while(--_0x1271fd){_0x4ded52['push'](_0x4ded52['shift']());}};_0x5af77c(++_0xa1fc39);}(_0xb086,0xe0));var _0x6b08=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xb086[_0x4565bf];return _0x5610ba;};'use strict';var rp=require(_0x6b08('0x0'));var logger=require(_0x6b08('0x1'))('routing');var _=require(_0x6b08('0x2'));var arr=[];exports[_0x6b08('0x3')]=function(_0x533855,_0x4b11df){return function(_0x14fe99){var _0x40f813=_0x4b11df[0xa];var _0x6e94c1=_0x4b11df[0xb];var _0x1c3ea8=_0x4b11df[0xc];var _0x4e2496=_0x4b11df[0xd];var _0x4e6888=_0x4b11df[0xe];var _0xecdb81=_0x4b11df[0xf][_0x6b08('0x4')](/\n/g,_0x6b08('0x5'));var _0x550475=_0x4b11df[0x10][_0x6b08('0x4')](/\n/g,'\x20');if(!arr[_0x6b08('0x6')](_0x6e94c1)){arr[_0x6b08('0x7')](_0x6e94c1);var _0x3b68e8=_0x4b11df[0x3];var _0x5b766b=_0x4b11df[0x4];var _0x342084=_0x4b11df[0x1];var _0x1d27db=_0x4b11df[0x0];var _0x1a549b={};_0x1a549b[_0x6b08('0x8')]=_0x4b11df[0x8]+_0x6b08('0x9')+_0x1c3ea8+'|'+_0x40f813+'|'+_0x4e2496+'|'+_0x6e94c1+'|'+_0x4e6888;_0x1a549b['urlOnRing']=_0x4b11df[0x7]+_0x6b08('0x9')+_0x1c3ea8+'|'+_0x40f813+'|'+_0x4e2496+'|'+_0x6e94c1+'|'+_0x4e6888+'|'+_0xecdb81+'|'+_0x550475;_0x1a549b[_0x6b08('0xa')]=_0x4b11df[0x9];var _0x262ea8={};_0x262ea8[_0x6b08('0xb')]='2.0';_0x262ea8[_0x6b08('0xc')]=_0x6b08('0xd');var _0x42f3f9=[];_0x42f3f9[_0x6b08('0x7')](_0x4b11df[0x2]);_0x42f3f9[_0x6b08('0x7')](_0x4b11df[0x5]);_0x42f3f9[_0x6b08('0x7')](_0x4b11df[0x6]);_0x262ea8['params']=_0x42f3f9;_0x262ea8['id']=0x1;var _0x2997e9=JSON[_0x6b08('0xe')](_0x262ea8);var _0xdd3b5f={'encoding':_0x6b08('0xf'),'method':_0x6b08('0x10'),'timeout':0x2710,'url':_0x3b68e8,'headers':{'Content-Type':'application/json-rpc'},'body':_0x2997e9};return rp(_0xdd3b5f)[_0x6b08('0x11')](function(_0x4cee0f){const _0x531a7b=JSON['parse'](_0x4cee0f);if(!_0x531a7b[_0x6b08('0x12')][_0x6b08('0x13')]){throw new Error(_0x6b08('0x14'));}var _0x2c0e88=_0x6e94c1;var _0x27b279=_0x6b08('0x15')+_0x342084+_0x6b08('0x16')+_0x1d27db+_0x6b08('0x17')+_0x2c0e88+_0x6b08('0x18')+JSON['stringify'](_0x1a549b);var _0x14c50d=_0x5b766b+'?'+_0x27b279;return rp(_0x14c50d);})[_0x6b08('0x11')](function(_0x4c7615){logger['info'](_0x6b08('0x19'),_0x533855,_0x4c7615);_0x14fe99['stop']();})['catch'](function(_0xac6210){logger[_0x6b08('0x1a')](_0x6b08('0x1b'),_0x533855,_[_0x6b08('0x1c')](_0xac6210)?JSON['stringify'](_0xac6210):_0xac6210);_0x14fe99[_0x6b08('0x1d')]();});}else{logger['info'](_0x6b08('0x1e'),_0x533855);_0x14fe99[_0x6b08('0x1f')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/utils.js b/server/services/routing/server/applications/utils.js index 8746a33..afa85a4 100644 --- a/server/services/routing/server/applications/utils.js +++ b/server/services/routing/server/applications/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['exports','render','merge','body','contact','message','account','interaction','list','mustache','lodash'];(function(_0x4860b8,_0x3a4b78){var _0x38d88c=function(_0x52e5ff){while(--_0x52e5ff){_0x4860b8['push'](_0x4860b8['shift']());}};_0x38d88c(++_0x3a4b78);}(_0xe706,0xa3));var _0x6e70=function(_0x73f87f,_0x2eb5c5){_0x73f87f=_0x73f87f-0x0;var _0x11899b=_0xe706[_0x73f87f];return _0x11899b;};'use strict';var Mustache=require(_0x6e70('0x0'));var _=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'getMustacheRender':function(_0x5e8446,_0x2cae77){return Mustache[_0x6e70('0x3')](_0x5e8446,_[_0x6e70('0x4')](_0x2cae77[_0x6e70('0x5')],{'contact':_0x2cae77[_0x6e70('0x6')],'message':_0x2cae77[_0x6e70('0x7')],'account':_0x2cae77[_0x6e70('0x8')],'interaction':_0x2cae77[_0x6e70('0x9')],'list':_0x2cae77[_0x6e70('0xa')]}))||'';}}; \ No newline at end of file +var _0xa9e0=['message','account','interaction','mustache','lodash','exports','render','body','contact'];(function(_0x1fd469,_0x13b443){var _0x25bb14=function(_0x32b812){while(--_0x32b812){_0x1fd469['push'](_0x1fd469['shift']());}};_0x25bb14(++_0x13b443);}(_0xa9e0,0x123));var _0x0a9e=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xa9e0[_0x411add];return _0x238242;};'use strict';var Mustache=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'getMustacheRender':function(_0x5dd881,_0x550fbc){return Mustache[_0x0a9e('0x3')](_0x5dd881,_['merge'](_0x550fbc[_0x0a9e('0x4')],{'contact':_0x550fbc[_0x0a9e('0x5')],'message':_0x550fbc[_0x0a9e('0x6')],'account':_0x550fbc[_0x0a9e('0x7')],'interaction':_0x550fbc[_0x0a9e('0x8')],'list':_0x550fbc['list']}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 808f450..615010e 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 _0xd5eb=['../rpc/faxQueueReport','../lib/rule-engine','format','%s.%s.%s','IntervalId','isNil','map','Intervals','interval','listen','rules','channel','message','interaction','checkWaitingNotifications','transfer','applications','isArray','length','join','app','.js','toLowerCase','autoreply','appdata','split','push','slice','dialogflow','dialogflowv2','TagId','account','notificationTemplate','ChatWebsiteId','ContactId','body','%s:%s:%s','condition','./applications/','Push\x20new\x20rule','on\x20interval','intervals','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','execute','info','stringify','matchPath','emit','complete','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','agents','busy','busyQueue','end','QueueReport','update','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','values','find','chatQueues','available','name','paused','mailQueues','loggedIn','waiting','openchannelQueues','smsQueues','faxQueues','whatsappQueues','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','http','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','bluebird','./applications/utils','./applications/strategy/util','../../../config/logger','routing','../rpc/smsQueueReport'];(function(_0x1cc57a,_0x13847b){var _0x465d1f=function(_0x25142b){while(--_0x25142b){_0x1cc57a['push'](_0x1cc57a['shift']());}};_0x465d1f(++_0x13847b);}(_0xd5eb,0x183));var _0xbd5e=function(_0x17eada,_0x5e8d3d){_0x17eada=_0x17eada-0x0;var _0x41181e=_0xd5eb[_0x17eada];return _0x41181e;};'use strict';var _=require(_0xbd5e('0x0'));var util=require(_0xbd5e('0x1'));var path=require('path');var fs=require('fs');var jayson=require(_0xbd5e('0x2'));var BPromise=require(_0xbd5e('0x3'));var utils=require(_0xbd5e('0x4'));var sUtils=require(_0xbd5e('0x5'));var logger=require(_0xbd5e('0x6'))(_0xbd5e('0x7'));var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require('../rpc/chatQueueReport'),'smsQueueReport':require(_0xbd5e('0x8')),'faxQueueReport':require(_0xbd5e('0x9')),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require(_0xbd5e('0xa'));function getId(_0x5d073c,_0x113f5d,_0x18b0ae){return util[_0xbd5e('0xb')](_0xbd5e('0xc'),_0x5d073c,_0x113f5d||0x0,_0x18b0ae||0x0);}function getIntervals(_0x1ea238,_0x594ec6){var _0x277ef4=[];if(!_['isNil'](_0x594ec6[_0xbd5e('0xd')])&&!_['isNil'](_0x1ea238[_0x594ec6[_0xbd5e('0xd')]])&&!_[_0xbd5e('0xe')](_0x1ea238[_0x594ec6[_0xbd5e('0xd')]]['Intervals'])){_0x277ef4=_[_0xbd5e('0xf')](_0x1ea238[_0x594ec6[_0xbd5e('0xd')]][_0xbd5e('0x10')],_0xbd5e('0x11'));}else if(!_[_0xbd5e('0xe')](_0x594ec6[_0xbd5e('0x11')])){_0x277ef4=[_0x594ec6[_0xbd5e('0x11')]];}return _0x277ef4;}exports[_0xbd5e('0x12')]=function(_0x369e7d){_0x369e7d[_0xbd5e('0x13')]={};return new BPromise(function(_0x4d3277,_0x303c57){var _0x49a8a9={'Start':function(_0x5cac38){var _0x1bfa29=this;return new Promise(function(_0x4eec01,_0x57f8c9){if(_0x5cac38){try{var _0x42a848=[];var _0xb8f56b=getId(_0x5cac38[_0xbd5e('0x14')],_0x5cac38[_0xbd5e('0x15')]?_0x5cac38['message']['id']:0x0,_0x5cac38[_0xbd5e('0x16')]?_0x5cac38[_0xbd5e('0x16')]['id']:0x0);var _0x571103=sUtils[_0xbd5e('0x17')](_0x369e7d,_0x5cac38);if(_0x5cac38[_0xbd5e('0x18')]||!_0x571103&&_0x5cac38[_0xbd5e('0x19')]&&_[_0xbd5e('0x1a')](_0x5cac38['applications'])&&_0x5cac38[_0xbd5e('0x19')][_0xbd5e('0x1b')]){for(var _0x5e1eae=0x0;_0x5e1eae<_0x5cac38[_0xbd5e('0x19')][_0xbd5e('0x1b')];_0x5e1eae+=0x1){var _0x5ea1dd=_0x5cac38['applications'][_0x5e1eae];if(fs['existsSync'](path[_0xbd5e('0x1c')](__dirname,_0xbd5e('0x19'),_0x5ea1dd[_0xbd5e('0x1d')]+_0xbd5e('0x1e')))){var _0xdf174b=[];switch(_0x5ea1dd[_0xbd5e('0x1d')][_0xbd5e('0x1f')]()){case _0xbd5e('0x20'):var _0xb81b86=_0x5ea1dd[_0xbd5e('0x21')][_0xbd5e('0x22')](',');if(_0x5cac38[_0xbd5e('0x14')]==='mail'){_0xdf174b[_0xbd5e('0x23')](_0xb81b86[0x0]);_0xdf174b['push'](_0xb81b86[0x1]);_0xdf174b['push'](_0xb81b86['slice'](0x2,_0xb81b86[_0xbd5e('0x1b')])['join'](','));}else{_0xdf174b[_0xbd5e('0x23')](_0xb81b86[0x0]);_0xdf174b[_0xbd5e('0x23')](_0xb81b86[_0xbd5e('0x24')](0x1,_0xb81b86['length'])[_0xbd5e('0x1c')](','));}break;case _0xbd5e('0x25'):var _0x57fd7b=_0x5ea1dd[_0xbd5e('0x21')][_0xbd5e('0x22')](',');_0xdf174b[_0xbd5e('0x23')](_0x57fd7b[0x0]);_0xdf174b[_0xbd5e('0x23')](_0x57fd7b[0x1]);_0xdf174b[_0xbd5e('0x23')](_0x57fd7b[_0xbd5e('0x24')](0x2,_0x57fd7b[_0xbd5e('0x1b')])[_0xbd5e('0x1c')](','));break;case _0xbd5e('0x26'):var _0x2e2979=_0x5ea1dd[_0xbd5e('0x21')][_0xbd5e('0x22')](',');_0xdf174b[_0xbd5e('0x23')](_0x2e2979[0x0]);_0xdf174b[_0xbd5e('0x23')](_0x2e2979[0x1]);_0xdf174b[_0xbd5e('0x23')](_0x2e2979[0x2]);_0xdf174b[_0xbd5e('0x23')](_0x2e2979[0x3]);_0xdf174b[_0xbd5e('0x23')](_0x2e2979[_0xbd5e('0x24')](0x4,_0x2e2979['length'])[_0xbd5e('0x1c')](','));break;case'amazonlex':var _0x2e87ed=_0x5ea1dd[_0xbd5e('0x21')][_0xbd5e('0x22')](',');_0xdf174b[_0xbd5e('0x23')](_0x2e87ed[0x0]);_0xdf174b[_0xbd5e('0x23')](_0x2e87ed[0x1]);_0xdf174b['push'](_0x2e87ed[0x2]);_0xdf174b['push'](_0x2e87ed[0x3]);_0xdf174b[_0xbd5e('0x23')](_0x2e87ed[_0xbd5e('0x24')](0x4,_0x2e87ed[_0xbd5e('0x1b')])[_0xbd5e('0x1c')](','));break;case _0xbd5e('0x15'):_0xdf174b[_0xbd5e('0x23')](_0x5ea1dd[_0xbd5e('0x21')]);break;case'tag':_0xdf174b['push'](_0x5ea1dd[_0xbd5e('0x27')]);_0xdf174b[_0xbd5e('0x23')](_0x5ea1dd[_0xbd5e('0x21')]);break;case'tvox':var _0x4a3750=utils['getMustacheRender'](_0x5cac38[_0xbd5e('0x28')][_0xbd5e('0x29')],_0x5cac38);var _0x404dad=_0x5ea1dd[_0xbd5e('0x21')]['split'](',');_0xdf174b[_0xbd5e('0x23')](_0x404dad[0x0]);_0xdf174b[_0xbd5e('0x23')](_0x404dad[0x1]);_0xdf174b['push'](_0x404dad[0x2]);_0xdf174b[_0xbd5e('0x23')](_0x404dad[0x3]);_0xdf174b[_0xbd5e('0x23')](_0x404dad[0x4]);_0xdf174b[_0xbd5e('0x23')](_0x404dad[0x5]);_0xdf174b[_0xbd5e('0x23')](_0x404dad[0x6]);_0xdf174b[_0xbd5e('0x23')](_0x404dad[0x7]);_0xdf174b[_0xbd5e('0x23')](_0x404dad[0x8]);_0xdf174b['push'](_0x404dad[0x9]);_0xdf174b['push'](_0x404dad[0xa]);_0xdf174b[_0xbd5e('0x23')](_0x5cac38[_0xbd5e('0x16')]['id']);_0xdf174b[_0xbd5e('0x23')](_0x5cac38[_0xbd5e('0x15')]['id']);_0xdf174b[_0xbd5e('0x23')](_0x5ea1dd[_0xbd5e('0x2a')]);_0xdf174b['push'](_0x5cac38[_0xbd5e('0x16')][_0xbd5e('0x2b')]);_0xdf174b['push'](_0x5cac38[_0xbd5e('0x2c')]['body']);_0xdf174b[_0xbd5e('0x23')](_0x4a3750);break;default:_0xdf174b=_[_0xbd5e('0xe')](_0x5ea1dd[_0xbd5e('0x21')])?[]:_0x5ea1dd[_0xbd5e('0x21')][_0xbd5e('0x22')](',');}var _0x1e0ae5={'id':util[_0xbd5e('0xb')](_0xbd5e('0x2d'),_0xb8f56b,_0x5ea1dd['id'],_0x5ea1dd[_0xbd5e('0x1d')]),'condition':require('./interval')[_0xbd5e('0x2e')](_0xb8f56b,getIntervals(_0x369e7d['intervals'],_0x5ea1dd),_0x369e7d),'consequence':require(_0xbd5e('0x2f')+_0x5ea1dd[_0xbd5e('0x1d')])['consequence'](_0xb8f56b,_0xdf174b,_0x369e7d,_0x5cac38),'p':_0x5ea1dd['priority']||0x0};logger['info'](_0xbd5e('0x30'),_0x1e0ae5['id'],_0xbd5e('0x31'),getIntervals(_0x369e7d[_0xbd5e('0x32')],_0x5ea1dd)[_0xbd5e('0x1c')](_0xbd5e('0x33')));_0x42a848[_0xbd5e('0x23')](_0x1e0ae5);}else{logger[_0xbd5e('0x34')](_0xbd5e('0x35'),path[_0xbd5e('0x1c')](__dirname,_0xbd5e('0x19'),_0x5ea1dd['app']+_0xbd5e('0x1e')));}}_0x369e7d[_0xbd5e('0x13')][_0xb8f56b]=new RuleEngine(_0x42a848);_0x369e7d['rules'][_0xb8f56b][_0xbd5e('0x36')](_0x5cac38,function(_0x156ed1){logger[_0xbd5e('0x37')]('Applications\x20executed',JSON[_0xbd5e('0x38')](_0x156ed1[_0xbd5e('0x39')]));if(_0x369e7d[_0xbd5e('0x13')][_0xb8f56b]){_0x369e7d[_0xbd5e('0x13')][_0xb8f56b][_0xbd5e('0x3a')](_0xbd5e('0x3b'));}});return _0x4eec01({'code':0xc8,'message':_0x5cac38});}else{if(_0x571103){logger[_0xbd5e('0x37')](util['format']('Skipped\x20routing\x20for\x20%s',_0xb8f56b));}else{logger[_0xbd5e('0x37')](_0xbd5e('0x3c'));}return _0x4eec01({'code':0xc8,'message':_0x5cac38});}}catch(_0x43e2a9){logger[_0xbd5e('0x34')](_0x43e2a9[_0xbd5e('0x3d')]);return _0x57f8c9(_0x1bfa29[_0xbd5e('0x34')](0x1f4,_0x43e2a9));}}return _0x57f8c9(_0xbd5e('0x3e'));});},'AcceptMessage':function(_0x43c9ca){var _0x4a90b0=this;return new Promise(function(_0x1c02b9,_0x33691a){if(_0x43c9ca[_0xbd5e('0x3f')]&&_0x43c9ca['agent']['id']){if(_0x369e7d[_0xbd5e('0x40')][_0x43c9ca[_0xbd5e('0x3f')]['id']]){_0x369e7d['agents'][_0x43c9ca['agent']['id']][_0xbd5e('0x41')]=![];_0x369e7d[_0xbd5e('0x40')][_0x43c9ca['agent']['id']][_0xbd5e('0x42')]=undefined;}}if(_0x43c9ca[_0xbd5e('0x15')]&&_0x43c9ca[_0xbd5e('0x15')]['id']){try{var _0x107132=getId(_0x43c9ca[_0xbd5e('0x14')],_0x43c9ca[_0xbd5e('0x15')]?_0x43c9ca[_0xbd5e('0x15')]['id']:0x0,_0x43c9ca[_0xbd5e('0x16')]?_0x43c9ca[_0xbd5e('0x16')]['id']:0x0);if(_0x369e7d[_0xbd5e('0x13')][_0x107132]){_0x369e7d[_0xbd5e('0x13')][_0x107132]['emit'](_0xbd5e('0x43'));if(rpc[_0x43c9ca[_0xbd5e('0x14')]+'QueueReport']){rpc[_0x43c9ca[_0xbd5e('0x14')]+_0xbd5e('0x44')][_0xbd5e('0x45')](_0x107132,{'UserId':_0x43c9ca[_0xbd5e('0x15')]['UserId']})[_0xbd5e('0x46')](function(){logger[_0xbd5e('0x34')](_0xbd5e('0x47'));});}}return _0x1c02b9({'code':0xc8,'message':_0x43c9ca});}catch(_0x3d6db0){logger[_0xbd5e('0x34')](_0x3d6db0[_0xbd5e('0x3d')]);return _0x33691a(_0x4a90b0[_0xbd5e('0x34')](0x1f4,_0x3d6db0));}}logger[_0xbd5e('0x34')]('message\x20is\x20empty');return _0x33691a(_0x4a90b0['error'](0x1f4,_0xbd5e('0x48')));});},'RejectMessage':function(_0x458f89){var _0x3626d9=this;return new Promise(function(_0xb51f45,_0x27542d){if(_0x458f89['agent']&&_0x458f89[_0xbd5e('0x3f')]['id']){try{if(_0x369e7d[_0xbd5e('0x40')][_0x458f89[_0xbd5e('0x3f')]['id']]){_0x369e7d[_0xbd5e('0x40')][_0x458f89['agent']['id']][_0xbd5e('0x41')]=![];_0x369e7d[_0xbd5e('0x40')][_0x458f89[_0xbd5e('0x3f')]['id']][_0xbd5e('0x42')]=undefined;}return _0xb51f45({'code':0xc8,'message':_0x458f89});}catch(_0x24f619){logger[_0xbd5e('0x34')](_0x24f619[_0xbd5e('0x3d')]);return _0x27542d(_0x3626d9['error'](0x1f4,_0x24f619));}}logger[_0xbd5e('0x34')](_0xbd5e('0x48'));return _0x27542d(_0x3626d9[_0xbd5e('0x34')](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x58b917){var _0x12e1c=this;return new Promise(function(_0x1350ce,_0x58ad6a){if(_0x58b917['channel']&&_0x58b917['interaction']&&_0x58b917[_0xbd5e('0x16')]['id']){try{var _0x555417=getId(_0x58b917['channel'],_0x58b917[_0xbd5e('0x15')]?_0x58b917[_0xbd5e('0x15')]['id']:0x0,_0x58b917[_0xbd5e('0x16')]?_0x58b917[_0xbd5e('0x16')]['id']:0x0);if(_0x369e7d[_0xbd5e('0x13')][_0x555417]){_0x369e7d['rules'][_0x555417][_0xbd5e('0x3a')](_0xbd5e('0x43'));}return _0x1350ce({'code':0xc8,'message':_0x58b917});}catch(_0x402856){logger[_0xbd5e('0x34')](_0x402856['stack']);return _0x58ad6a(_0x12e1c[_0xbd5e('0x34')](0x1f4,_0x402856));}}logger[_0xbd5e('0x34')](_0xbd5e('0x48'));return _0x58ad6a(_0x12e1c[_0xbd5e('0x34')](0x1f4,_0xbd5e('0x48')));});},'AgentCapacity':function(_0x377371){var _0x49aee0=this;return new Promise(function(_0x16f0be,_0x8dcf04){if(_0x369e7d[_0xbd5e('0x40')][_0xbd5e('0x49')](_0x377371['id'])){for(var _0x47eece in _0x377371[_0xbd5e('0x4a')]){if(_0x377371[_0xbd5e('0x4a')][_0xbd5e('0x49')](_0x47eece)){if(_0x369e7d[_0xbd5e('0x40')][_0x377371['id']][_0xbd5e('0x49')](_0x47eece+'CurrentCapacity')){_0x369e7d['agents'][_0x377371['id']][_0x47eece+_0xbd5e('0x4b')]=parseInt(_0x377371[_0xbd5e('0x4a')][_0x47eece],0xa);}}}_0x369e7d[_0xbd5e('0x40')][_0x377371['id']][_0xbd5e('0x4c')]();return _0x16f0be({'code':0xc8,'message':_0x369e7d[_0xbd5e('0x40')][_0x377371['id']]});}else{return _0x8dcf04(_0x49aee0[_0xbd5e('0x34')](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0x433792){return new Promise(function(_0x35c061){var _0x1dd2a9=_[_0xbd5e('0x4d')](_0x369e7d['agents']);if(_0x433792&&_0x433792['id']){var _0x4b011f=_[_0xbd5e('0x4e')](_0x1dd2a9,function(_0x152d31){return _0x152d31['id']===_0x433792['id'];});_0x35c061(_0x4b011f);}else{_0x35c061({'count':_0x1dd2a9[_0xbd5e('0x1b')],'rows':_0x1dd2a9});}});},'ChatQueues':function(){return new Promise(function(_0x2162e6){var _0x3e82d1=[];for(var _0x519788 in _0x369e7d[_0xbd5e('0x4f')]){if(_0x369e7d[_0xbd5e('0x4f')][_0xbd5e('0x49')](_0x519788)){var _0x209738=_0x369e7d[_0xbd5e('0x4f')][_0x519788];var _0x4b2972={'id':_0x209738['id'],'available':_0x209738[_0xbd5e('0x50')],'loggedIn':_0x209738['loggedIn'],'name':_0x209738[_0xbd5e('0x51')],'paused':_0x209738[_0xbd5e('0x52')],'waiting':_0x209738['waiting']};_0x3e82d1['push'](_0x4b2972);}}_0x2162e6({'count':_0x3e82d1['length'],'rows':_0x3e82d1});});},'MailQueues':function(){return new Promise(function(_0x1274e7){var _0x27207d=[];for(var _0xe847c4 in _0x369e7d[_0xbd5e('0x53')]){if(_0x369e7d[_0xbd5e('0x53')][_0xbd5e('0x49')](_0xe847c4)){var _0x89b730=_0x369e7d['mailQueues'][_0xe847c4];var _0x152d38={'id':_0x89b730['id'],'available':_0x89b730[_0xbd5e('0x50')],'loggedIn':_0x89b730[_0xbd5e('0x54')],'name':_0x89b730['name'],'paused':_0x89b730[_0xbd5e('0x52')],'waiting':_0x89b730[_0xbd5e('0x55')]};_0x27207d['push'](_0x152d38);}}_0x1274e7({'count':_0x27207d['length'],'rows':_0x27207d});});},'OpenchannelQueues':function(){return new Promise(function(_0x148344){var _0x16be4f=[];for(var _0x2fdde1 in _0x369e7d[_0xbd5e('0x56')]){if(_0x369e7d[_0xbd5e('0x56')][_0xbd5e('0x49')](_0x2fdde1)){var _0x23ebb2=_0x369e7d[_0xbd5e('0x56')][_0x2fdde1];var _0x4b0cca={'id':_0x23ebb2['id'],'available':_0x23ebb2[_0xbd5e('0x50')],'loggedIn':_0x23ebb2[_0xbd5e('0x54')],'name':_0x23ebb2[_0xbd5e('0x51')],'paused':_0x23ebb2[_0xbd5e('0x52')],'waiting':_0x23ebb2[_0xbd5e('0x55')]};_0x16be4f[_0xbd5e('0x23')](_0x4b0cca);}}_0x148344({'count':_0x16be4f[_0xbd5e('0x1b')],'rows':_0x16be4f});});},'SmsQueues':function(){return new Promise(function(_0x3bb939){var _0x32135a=[];for(var _0xecc35a in _0x369e7d[_0xbd5e('0x57')]){if(_0x369e7d[_0xbd5e('0x57')][_0xbd5e('0x49')](_0xecc35a)){var _0x5db1bb=_0x369e7d[_0xbd5e('0x57')][_0xecc35a];var _0x5c280b={'id':_0x5db1bb['id'],'available':_0x5db1bb['available'],'loggedIn':_0x5db1bb[_0xbd5e('0x54')],'name':_0x5db1bb[_0xbd5e('0x51')],'paused':_0x5db1bb[_0xbd5e('0x52')],'waiting':_0x5db1bb[_0xbd5e('0x55')]};_0x32135a[_0xbd5e('0x23')](_0x5c280b);}}_0x3bb939({'count':_0x32135a[_0xbd5e('0x1b')],'rows':_0x32135a});});},'FaxQueues':function(){return new Promise(function(_0x5be2d5){var _0x2b4728=[];for(var _0x3708e0 in _0x369e7d[_0xbd5e('0x58')]){if(_0x369e7d[_0xbd5e('0x58')]['hasOwnProperty'](_0x3708e0)){var _0x1583f4=_0x369e7d['faxQueues'][_0x3708e0];var _0x46cff1={'id':_0x1583f4['id'],'available':_0x1583f4['available'],'loggedIn':_0x1583f4['loggedIn'],'name':_0x1583f4[_0xbd5e('0x51')],'paused':_0x1583f4[_0xbd5e('0x52')],'waiting':_0x1583f4['waiting']};_0x2b4728[_0xbd5e('0x23')](_0x46cff1);}}_0x5be2d5({'count':_0x2b4728['length'],'rows':_0x2b4728});});},'WhatsappQueues':function(){return new Promise(function(_0x5147b0){var _0x2f46b3=[];for(var _0x1e404e in _0x369e7d[_0xbd5e('0x59')]){if(_0x369e7d[_0xbd5e('0x59')][_0xbd5e('0x49')](_0x1e404e)){var _0x47fa8f=_0x369e7d[_0xbd5e('0x59')][_0x1e404e];var _0x577e62={'id':_0x47fa8f['id'],'available':_0x47fa8f[_0xbd5e('0x50')],'loggedIn':_0x47fa8f['loggedIn'],'name':_0x47fa8f[_0xbd5e('0x51')],'paused':_0x47fa8f[_0xbd5e('0x52')],'waiting':_0x47fa8f['waiting']};_0x2f46b3['push'](_0x577e62);}}_0x5147b0({'count':_0x2f46b3[_0xbd5e('0x1b')],'rows':_0x2f46b3});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x3dd455){var _0x545907=_['values'](_0x369e7d['chatQueuesWaitingInteractions']);_0x3dd455({'count':_0x545907['length'],'rows':_0x545907});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x3b75b9){var _0x74864f=_[_0xbd5e('0x4d')](_0x369e7d['mailQueuesWaitingInteractions']);_0x3b75b9({'count':_0x74864f[_0xbd5e('0x1b')],'rows':_0x74864f});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x4c5db1){var _0x2fcb3d=_['values'](_0x369e7d[_0xbd5e('0x5a')]);_0x4c5db1({'count':_0x2fcb3d[_0xbd5e('0x1b')],'rows':_0x2fcb3d});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x50d985){var _0x55e010=_['values'](_0x369e7d[_0xbd5e('0x5b')]);_0x50d985({'count':_0x55e010[_0xbd5e('0x1b')],'rows':_0x55e010});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0xb02e5a){var _0x3a5d1a=_[_0xbd5e('0x4d')](_0x369e7d[_0xbd5e('0x5c')]);_0xb02e5a({'count':_0x3a5d1a['length'],'rows':_0x3a5d1a});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x502d11){var _0x503751=_[_0xbd5e('0x4d')](_0x369e7d[_0xbd5e('0x5d')]);_0x502d11({'count':_0x503751['length'],'rows':_0x503751});});}};var _0x224cbb=jayson['server'](_0x49a8a9)[_0xbd5e('0x5e')]();_0x224cbb['on'](_0xbd5e('0x34'),function(_0x1537fe){logger[_0xbd5e('0x34')](JSON[_0xbd5e('0x38')](_0x1537fe));return _0x303c57(_0x1537fe);});_0x224cbb[_0xbd5e('0x12')](0x232c,_0xbd5e('0x5f'),function(){console[_0xbd5e('0x60')](_0xbd5e('0x61'),0x232c);return _0x4d3277(_0xbd5e('0x62')+0x232c);});});}; \ No newline at end of file +var _0x3ace=['busy','busyQueue','end','QueueReport','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','agent\x20not\x20found','values','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','faxQueuesWaitingInteractions','server','http','127.0.0.1','util','path','jayson/promise','./applications/strategy/util','../../../config/logger','routing','../rpc/mailQueueReport','../rpc/faxQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','rules','channel','message','interaction','transfer','isArray','applications','length','join','app','.js','toLowerCase','autoreply','appdata','mail','push','slice','split','tag','tvox','getMustacheRender','account','notificationTemplate','ChatWebsiteId','ContactId','body','%s:%s:%s','./interval','intervals','./applications/','consequence','priority','info','Push\x20new\x20rule','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','execute','Applications\x20executed','stringify','emit','complete','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','agents'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x3ace,0xda));var _0xe3ac=function(_0x20fcef,_0x436624){_0x20fcef=_0x20fcef-0x0;var _0x23b642=_0x3ace[_0x20fcef];return _0x23b642;};'use strict';var _=require('lodash');var util=require(_0xe3ac('0x0'));var path=require(_0xe3ac('0x1'));var fs=require('fs');var jayson=require(_0xe3ac('0x2'));var BPromise=require('bluebird');var utils=require('./applications/utils');var sUtils=require(_0xe3ac('0x3'));var logger=require(_0xe3ac('0x4'))(_0xe3ac('0x5'));var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require(_0xe3ac('0x6')),'chatQueueReport':require('../rpc/chatQueueReport'),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require(_0xe3ac('0x7')),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require(_0xe3ac('0x8'));function getId(_0x5c181d,_0x345e51,_0x26eeed){return util[_0xe3ac('0x9')](_0xe3ac('0xa'),_0x5c181d,_0x345e51||0x0,_0x26eeed||0x0);}function getIntervals(_0x29ba64,_0x4fc0b7){var _0x184032=[];if(!_[_0xe3ac('0xb')](_0x4fc0b7[_0xe3ac('0xc')])&&!_['isNil'](_0x29ba64[_0x4fc0b7[_0xe3ac('0xc')]])&&!_[_0xe3ac('0xb')](_0x29ba64[_0x4fc0b7[_0xe3ac('0xc')]][_0xe3ac('0xd')])){_0x184032=_[_0xe3ac('0xe')](_0x29ba64[_0x4fc0b7[_0xe3ac('0xc')]][_0xe3ac('0xd')],_0xe3ac('0xf'));}else if(!_[_0xe3ac('0xb')](_0x4fc0b7[_0xe3ac('0xf')])){_0x184032=[_0x4fc0b7[_0xe3ac('0xf')]];}return _0x184032;}exports[_0xe3ac('0x10')]=function(_0x44f99f){_0x44f99f[_0xe3ac('0x11')]={};return new BPromise(function(_0x28e237,_0x42c914){var _0x443994={'Start':function(_0x4c69c6){var _0x1e4109=this;return new Promise(function(_0xd8ccd8,_0x3d8377){if(_0x4c69c6){try{var _0x5a5ecc=[];var _0x4fd50a=getId(_0x4c69c6[_0xe3ac('0x12')],_0x4c69c6['message']?_0x4c69c6[_0xe3ac('0x13')]['id']:0x0,_0x4c69c6[_0xe3ac('0x14')]?_0x4c69c6['interaction']['id']:0x0);var _0x2ad6fc=sUtils['checkWaitingNotifications'](_0x44f99f,_0x4c69c6);if(_0x4c69c6[_0xe3ac('0x15')]||!_0x2ad6fc&&_0x4c69c6['applications']&&_[_0xe3ac('0x16')](_0x4c69c6[_0xe3ac('0x17')])&&_0x4c69c6[_0xe3ac('0x17')][_0xe3ac('0x18')]){for(var _0x3834f9=0x0;_0x3834f9<_0x4c69c6[_0xe3ac('0x17')]['length'];_0x3834f9+=0x1){var _0x383395=_0x4c69c6[_0xe3ac('0x17')][_0x3834f9];if(fs['existsSync'](path[_0xe3ac('0x19')](__dirname,_0xe3ac('0x17'),_0x383395[_0xe3ac('0x1a')]+_0xe3ac('0x1b')))){var _0x36bb0a=[];switch(_0x383395['app'][_0xe3ac('0x1c')]()){case _0xe3ac('0x1d'):var _0x32d011=_0x383395[_0xe3ac('0x1e')]['split'](',');if(_0x4c69c6[_0xe3ac('0x12')]===_0xe3ac('0x1f')){_0x36bb0a['push'](_0x32d011[0x0]);_0x36bb0a[_0xe3ac('0x20')](_0x32d011[0x1]);_0x36bb0a['push'](_0x32d011[_0xe3ac('0x21')](0x2,_0x32d011[_0xe3ac('0x18')])[_0xe3ac('0x19')](','));}else{_0x36bb0a[_0xe3ac('0x20')](_0x32d011[0x0]);_0x36bb0a[_0xe3ac('0x20')](_0x32d011[_0xe3ac('0x21')](0x1,_0x32d011['length'])[_0xe3ac('0x19')](','));}break;case'dialogflow':var _0x3ab2ec=_0x383395[_0xe3ac('0x1e')][_0xe3ac('0x22')](',');_0x36bb0a['push'](_0x3ab2ec[0x0]);_0x36bb0a[_0xe3ac('0x20')](_0x3ab2ec[0x1]);_0x36bb0a[_0xe3ac('0x20')](_0x3ab2ec[_0xe3ac('0x21')](0x2,_0x3ab2ec[_0xe3ac('0x18')])[_0xe3ac('0x19')](','));break;case'dialogflowv2':var _0x151a5e=_0x383395[_0xe3ac('0x1e')][_0xe3ac('0x22')](',');_0x36bb0a['push'](_0x151a5e[0x0]);_0x36bb0a[_0xe3ac('0x20')](_0x151a5e[0x1]);_0x36bb0a[_0xe3ac('0x20')](_0x151a5e[0x2]);_0x36bb0a['push'](_0x151a5e[0x3]);_0x36bb0a[_0xe3ac('0x20')](_0x151a5e[_0xe3ac('0x21')](0x4,_0x151a5e[_0xe3ac('0x18')])['join'](','));break;case'amazonlex':var _0x3a8d8f=_0x383395[_0xe3ac('0x1e')][_0xe3ac('0x22')](',');_0x36bb0a[_0xe3ac('0x20')](_0x3a8d8f[0x0]);_0x36bb0a[_0xe3ac('0x20')](_0x3a8d8f[0x1]);_0x36bb0a[_0xe3ac('0x20')](_0x3a8d8f[0x2]);_0x36bb0a[_0xe3ac('0x20')](_0x3a8d8f[0x3]);_0x36bb0a[_0xe3ac('0x20')](_0x3a8d8f[_0xe3ac('0x21')](0x4,_0x3a8d8f['length'])[_0xe3ac('0x19')](','));break;case _0xe3ac('0x13'):_0x36bb0a[_0xe3ac('0x20')](_0x383395[_0xe3ac('0x1e')]);break;case _0xe3ac('0x23'):_0x36bb0a[_0xe3ac('0x20')](_0x383395['TagId']);_0x36bb0a[_0xe3ac('0x20')](_0x383395[_0xe3ac('0x1e')]);break;case _0xe3ac('0x24'):var _0x2b68bf=utils[_0xe3ac('0x25')](_0x4c69c6[_0xe3ac('0x26')][_0xe3ac('0x27')],_0x4c69c6);var _0x4f68a8=_0x383395[_0xe3ac('0x1e')][_0xe3ac('0x22')](',');_0x36bb0a[_0xe3ac('0x20')](_0x4f68a8[0x0]);_0x36bb0a['push'](_0x4f68a8[0x1]);_0x36bb0a[_0xe3ac('0x20')](_0x4f68a8[0x2]);_0x36bb0a[_0xe3ac('0x20')](_0x4f68a8[0x3]);_0x36bb0a[_0xe3ac('0x20')](_0x4f68a8[0x4]);_0x36bb0a[_0xe3ac('0x20')](_0x4f68a8[0x5]);_0x36bb0a[_0xe3ac('0x20')](_0x4f68a8[0x6]);_0x36bb0a['push'](_0x4f68a8[0x7]);_0x36bb0a[_0xe3ac('0x20')](_0x4f68a8[0x8]);_0x36bb0a['push'](_0x4f68a8[0x9]);_0x36bb0a[_0xe3ac('0x20')](_0x4f68a8[0xa]);_0x36bb0a[_0xe3ac('0x20')](_0x4c69c6[_0xe3ac('0x14')]['id']);_0x36bb0a[_0xe3ac('0x20')](_0x4c69c6[_0xe3ac('0x13')]['id']);_0x36bb0a[_0xe3ac('0x20')](_0x383395[_0xe3ac('0x28')]);_0x36bb0a['push'](_0x4c69c6[_0xe3ac('0x14')][_0xe3ac('0x29')]);_0x36bb0a['push'](_0x4c69c6[_0xe3ac('0x2a')][_0xe3ac('0x2a')]);_0x36bb0a['push'](_0x2b68bf);break;default:_0x36bb0a=_[_0xe3ac('0xb')](_0x383395[_0xe3ac('0x1e')])?[]:_0x383395['appdata'][_0xe3ac('0x22')](',');}var _0x4b9bd9={'id':util['format'](_0xe3ac('0x2b'),_0x4fd50a,_0x383395['id'],_0x383395[_0xe3ac('0x1a')]),'condition':require(_0xe3ac('0x2c'))['condition'](_0x4fd50a,getIntervals(_0x44f99f[_0xe3ac('0x2d')],_0x383395),_0x44f99f),'consequence':require(_0xe3ac('0x2e')+_0x383395[_0xe3ac('0x1a')])[_0xe3ac('0x2f')](_0x4fd50a,_0x36bb0a,_0x44f99f,_0x4c69c6),'p':_0x383395[_0xe3ac('0x30')]||0x0};logger[_0xe3ac('0x31')](_0xe3ac('0x32'),_0x4b9bd9['id'],'on\x20interval',getIntervals(_0x44f99f[_0xe3ac('0x2d')],_0x383395)['join'](_0xe3ac('0x33')));_0x5a5ecc[_0xe3ac('0x20')](_0x4b9bd9);}else{logger[_0xe3ac('0x34')](_0xe3ac('0x35'),path[_0xe3ac('0x19')](__dirname,_0xe3ac('0x17'),_0x383395[_0xe3ac('0x1a')]+_0xe3ac('0x1b')));}}_0x44f99f['rules'][_0x4fd50a]=new RuleEngine(_0x5a5ecc);_0x44f99f[_0xe3ac('0x11')][_0x4fd50a][_0xe3ac('0x36')](_0x4c69c6,function(_0x36e6c0){logger['info'](_0xe3ac('0x37'),JSON[_0xe3ac('0x38')](_0x36e6c0['matchPath']));if(_0x44f99f['rules'][_0x4fd50a]){_0x44f99f[_0xe3ac('0x11')][_0x4fd50a][_0xe3ac('0x39')](_0xe3ac('0x3a'));}});return _0xd8ccd8({'code':0xc8,'message':_0x4c69c6});}else{if(_0x2ad6fc){logger[_0xe3ac('0x31')](util['format']('Skipped\x20routing\x20for\x20%s',_0x4fd50a));}else{logger[_0xe3ac('0x31')](_0xe3ac('0x3b'));}return _0xd8ccd8({'code':0xc8,'message':_0x4c69c6});}}catch(_0x5b6f18){logger[_0xe3ac('0x34')](_0x5b6f18[_0xe3ac('0x3c')]);return _0x3d8377(_0x1e4109['error'](0x1f4,_0x5b6f18));}}return _0x3d8377(_0xe3ac('0x3d'));});},'AcceptMessage':function(_0x1b60e5){var _0x24462b=this;return new Promise(function(_0x44bc58,_0x146e09){if(_0x1b60e5[_0xe3ac('0x3e')]&&_0x1b60e5[_0xe3ac('0x3e')]['id']){if(_0x44f99f['agents'][_0x1b60e5[_0xe3ac('0x3e')]['id']]){_0x44f99f[_0xe3ac('0x3f')][_0x1b60e5[_0xe3ac('0x3e')]['id']][_0xe3ac('0x40')]=![];_0x44f99f[_0xe3ac('0x3f')][_0x1b60e5[_0xe3ac('0x3e')]['id']][_0xe3ac('0x41')]=undefined;}}if(_0x1b60e5['message']&&_0x1b60e5['message']['id']){try{var _0x57b882=getId(_0x1b60e5[_0xe3ac('0x12')],_0x1b60e5[_0xe3ac('0x13')]?_0x1b60e5[_0xe3ac('0x13')]['id']:0x0,_0x1b60e5[_0xe3ac('0x14')]?_0x1b60e5[_0xe3ac('0x14')]['id']:0x0);if(_0x44f99f[_0xe3ac('0x11')][_0x57b882]){_0x44f99f['rules'][_0x57b882]['emit'](_0xe3ac('0x42'));if(rpc[_0x1b60e5['channel']+'QueueReport']){rpc[_0x1b60e5[_0xe3ac('0x12')]+_0xe3ac('0x43')]['update'](_0x57b882,{'UserId':_0x1b60e5[_0xe3ac('0x13')][_0xe3ac('0x44')]})[_0xe3ac('0x45')](function(){logger[_0xe3ac('0x34')](_0xe3ac('0x46'));});}}return _0x44bc58({'code':0xc8,'message':_0x1b60e5});}catch(_0x2ab8b4){logger['error'](_0x2ab8b4[_0xe3ac('0x3c')]);return _0x146e09(_0x24462b['error'](0x1f4,_0x2ab8b4));}}logger[_0xe3ac('0x34')](_0xe3ac('0x47'));return _0x146e09(_0x24462b[_0xe3ac('0x34')](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0x5a2680){var _0x493f50=this;return new Promise(function(_0x2f0e49,_0x1a12c4){if(_0x5a2680[_0xe3ac('0x3e')]&&_0x5a2680[_0xe3ac('0x3e')]['id']){try{if(_0x44f99f['agents'][_0x5a2680[_0xe3ac('0x3e')]['id']]){_0x44f99f[_0xe3ac('0x3f')][_0x5a2680['agent']['id']][_0xe3ac('0x40')]=![];_0x44f99f[_0xe3ac('0x3f')][_0x5a2680[_0xe3ac('0x3e')]['id']][_0xe3ac('0x41')]=undefined;}return _0x2f0e49({'code':0xc8,'message':_0x5a2680});}catch(_0x560848){logger['error'](_0x560848[_0xe3ac('0x3c')]);return _0x1a12c4(_0x493f50['error'](0x1f4,_0x560848));}}logger['error'](_0xe3ac('0x47'));return _0x1a12c4(_0x493f50[_0xe3ac('0x34')](0x1f4,_0xe3ac('0x47')));});},'AbandonInteraction':function(_0x48d9f6){var _0x37366e=this;return new Promise(function(_0x5f24d9,_0x221e3c){if(_0x48d9f6[_0xe3ac('0x12')]&&_0x48d9f6[_0xe3ac('0x14')]&&_0x48d9f6['interaction']['id']){try{var _0x22089a=getId(_0x48d9f6['channel'],_0x48d9f6[_0xe3ac('0x13')]?_0x48d9f6[_0xe3ac('0x13')]['id']:0x0,_0x48d9f6[_0xe3ac('0x14')]?_0x48d9f6[_0xe3ac('0x14')]['id']:0x0);if(_0x44f99f[_0xe3ac('0x11')][_0x22089a]){_0x44f99f['rules'][_0x22089a]['emit'](_0xe3ac('0x42'));}return _0x5f24d9({'code':0xc8,'message':_0x48d9f6});}catch(_0x4e0b82){logger[_0xe3ac('0x34')](_0x4e0b82[_0xe3ac('0x3c')]);return _0x221e3c(_0x37366e[_0xe3ac('0x34')](0x1f4,_0x4e0b82));}}logger['error'](_0xe3ac('0x47'));return _0x221e3c(_0x37366e[_0xe3ac('0x34')](0x1f4,_0xe3ac('0x47')));});},'AgentCapacity':function(_0x2f4177){var _0x2e51b7=this;return new Promise(function(_0x391656,_0x125963){if(_0x44f99f[_0xe3ac('0x3f')][_0xe3ac('0x48')](_0x2f4177['id'])){for(var _0xe632dd in _0x2f4177[_0xe3ac('0x49')]){if(_0x2f4177[_0xe3ac('0x49')][_0xe3ac('0x48')](_0xe632dd)){if(_0x44f99f[_0xe3ac('0x3f')][_0x2f4177['id']][_0xe3ac('0x48')](_0xe632dd+_0xe3ac('0x4a'))){_0x44f99f[_0xe3ac('0x3f')][_0x2f4177['id']][_0xe632dd+_0xe3ac('0x4a')]=parseInt(_0x2f4177[_0xe3ac('0x49')][_0xe632dd],0xa);}}}_0x44f99f[_0xe3ac('0x3f')][_0x2f4177['id']]['updateRealtime']();return _0x391656({'code':0xc8,'message':_0x44f99f[_0xe3ac('0x3f')][_0x2f4177['id']]});}else{return _0x125963(_0x2e51b7['error'](0x1f4,_0xe3ac('0x4b')));}});},'Agents':function(_0x258ed8){return new Promise(function(_0x5042d5){var _0x10a07c=_[_0xe3ac('0x4c')](_0x44f99f[_0xe3ac('0x3f')]);if(_0x258ed8&&_0x258ed8['id']){var _0x498c05=_['find'](_0x10a07c,function(_0x5e6ca7){return _0x5e6ca7['id']===_0x258ed8['id'];});_0x5042d5(_0x498c05);}else{_0x5042d5({'count':_0x10a07c[_0xe3ac('0x18')],'rows':_0x10a07c});}});},'ChatQueues':function(){return new Promise(function(_0x4ad637){var _0x25b710=[];for(var _0x224c33 in _0x44f99f[_0xe3ac('0x4d')]){if(_0x44f99f['chatQueues'][_0xe3ac('0x48')](_0x224c33)){var _0xd2e16c=_0x44f99f[_0xe3ac('0x4d')][_0x224c33];var _0x4a951d={'id':_0xd2e16c['id'],'available':_0xd2e16c[_0xe3ac('0x4e')],'loggedIn':_0xd2e16c[_0xe3ac('0x4f')],'name':_0xd2e16c[_0xe3ac('0x50')],'paused':_0xd2e16c[_0xe3ac('0x51')],'waiting':_0xd2e16c[_0xe3ac('0x52')]};_0x25b710['push'](_0x4a951d);}}_0x4ad637({'count':_0x25b710[_0xe3ac('0x18')],'rows':_0x25b710});});},'MailQueues':function(){return new Promise(function(_0x278196){var _0x51ad88=[];for(var _0x35371f in _0x44f99f[_0xe3ac('0x53')]){if(_0x44f99f[_0xe3ac('0x53')][_0xe3ac('0x48')](_0x35371f)){var _0xf19056=_0x44f99f['mailQueues'][_0x35371f];var _0x4c9055={'id':_0xf19056['id'],'available':_0xf19056[_0xe3ac('0x4e')],'loggedIn':_0xf19056['loggedIn'],'name':_0xf19056[_0xe3ac('0x50')],'paused':_0xf19056['paused'],'waiting':_0xf19056[_0xe3ac('0x52')]};_0x51ad88[_0xe3ac('0x20')](_0x4c9055);}}_0x278196({'count':_0x51ad88[_0xe3ac('0x18')],'rows':_0x51ad88});});},'OpenchannelQueues':function(){return new Promise(function(_0x5100e1){var _0x1a43cc=[];for(var _0x246192 in _0x44f99f['openchannelQueues']){if(_0x44f99f['openchannelQueues']['hasOwnProperty'](_0x246192)){var _0x5484ae=_0x44f99f[_0xe3ac('0x54')][_0x246192];var _0x2d24f9={'id':_0x5484ae['id'],'available':_0x5484ae[_0xe3ac('0x4e')],'loggedIn':_0x5484ae[_0xe3ac('0x4f')],'name':_0x5484ae[_0xe3ac('0x50')],'paused':_0x5484ae[_0xe3ac('0x51')],'waiting':_0x5484ae[_0xe3ac('0x52')]};_0x1a43cc[_0xe3ac('0x20')](_0x2d24f9);}}_0x5100e1({'count':_0x1a43cc[_0xe3ac('0x18')],'rows':_0x1a43cc});});},'SmsQueues':function(){return new Promise(function(_0x392ef9){var _0x48f432=[];for(var _0x2848a0 in _0x44f99f[_0xe3ac('0x55')]){if(_0x44f99f['smsQueues'][_0xe3ac('0x48')](_0x2848a0)){var _0x281bdd=_0x44f99f[_0xe3ac('0x55')][_0x2848a0];var _0x2d1957={'id':_0x281bdd['id'],'available':_0x281bdd['available'],'loggedIn':_0x281bdd['loggedIn'],'name':_0x281bdd['name'],'paused':_0x281bdd['paused'],'waiting':_0x281bdd[_0xe3ac('0x52')]};_0x48f432['push'](_0x2d1957);}}_0x392ef9({'count':_0x48f432[_0xe3ac('0x18')],'rows':_0x48f432});});},'FaxQueues':function(){return new Promise(function(_0x3c7ad9){var _0x3f490d=[];for(var _0x28a4a3 in _0x44f99f[_0xe3ac('0x56')]){if(_0x44f99f[_0xe3ac('0x56')][_0xe3ac('0x48')](_0x28a4a3)){var _0x47b55e=_0x44f99f[_0xe3ac('0x56')][_0x28a4a3];var _0x549aaa={'id':_0x47b55e['id'],'available':_0x47b55e['available'],'loggedIn':_0x47b55e[_0xe3ac('0x4f')],'name':_0x47b55e['name'],'paused':_0x47b55e['paused'],'waiting':_0x47b55e[_0xe3ac('0x52')]};_0x3f490d[_0xe3ac('0x20')](_0x549aaa);}}_0x3c7ad9({'count':_0x3f490d[_0xe3ac('0x18')],'rows':_0x3f490d});});},'WhatsappQueues':function(){return new Promise(function(_0x35f2c9){var _0x29e0d3=[];for(var _0x230f6d in _0x44f99f['whatsappQueues']){if(_0x44f99f['whatsappQueues'][_0xe3ac('0x48')](_0x230f6d)){var _0x593686=_0x44f99f[_0xe3ac('0x57')][_0x230f6d];var _0x1f4f72={'id':_0x593686['id'],'available':_0x593686[_0xe3ac('0x4e')],'loggedIn':_0x593686[_0xe3ac('0x4f')],'name':_0x593686[_0xe3ac('0x50')],'paused':_0x593686[_0xe3ac('0x51')],'waiting':_0x593686[_0xe3ac('0x52')]};_0x29e0d3[_0xe3ac('0x20')](_0x1f4f72);}}_0x35f2c9({'count':_0x29e0d3[_0xe3ac('0x18')],'rows':_0x29e0d3});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x3ecf9b){var _0x5c10f7=_['values'](_0x44f99f[_0xe3ac('0x58')]);_0x3ecf9b({'count':_0x5c10f7[_0xe3ac('0x18')],'rows':_0x5c10f7});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x31d16f){var _0x443e64=_[_0xe3ac('0x4c')](_0x44f99f[_0xe3ac('0x59')]);_0x31d16f({'count':_0x443e64[_0xe3ac('0x18')],'rows':_0x443e64});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x40788b){var _0x1055b6=_[_0xe3ac('0x4c')](_0x44f99f['openchannelQueuesWaitingInteractions']);_0x40788b({'count':_0x1055b6['length'],'rows':_0x1055b6});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x590e3b){var _0x35df28=_[_0xe3ac('0x4c')](_0x44f99f['smsQueuesWaitingInteractions']);_0x590e3b({'count':_0x35df28[_0xe3ac('0x18')],'rows':_0x35df28});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x3e77fc){var _0xbc4092=_[_0xe3ac('0x4c')](_0x44f99f[_0xe3ac('0x5a')]);_0x3e77fc({'count':_0xbc4092[_0xe3ac('0x18')],'rows':_0xbc4092});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x47c673){var _0x45919b=_[_0xe3ac('0x4c')](_0x44f99f['whatsappQueuesWaitingInteractions']);_0x47c673({'count':_0x45919b[_0xe3ac('0x18')],'rows':_0x45919b});});}};var _0x124b75=jayson[_0xe3ac('0x5b')](_0x443994)[_0xe3ac('0x5c')]();_0x124b75['on'](_0xe3ac('0x34'),function(_0x452017){logger[_0xe3ac('0x34')](JSON[_0xe3ac('0x38')](_0x452017));return _0x42c914(_0x452017);});_0x124b75[_0xe3ac('0x10')](0x232c,_0xe3ac('0x5d'),function(){console['log']('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x28e237('RPC\x20listening\x20on\x20port:'+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 59e37f6..e47dd14 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 _0x5a77=['rules','info','stop','some','[%s][INTERVAL\x20VALID]\x20%s\x20%s','when','[%s][INTERVAL\x20NOT\x20VALID]\x20%s\x20%s','join','\x20|\x20','lodash','../../../utils/iftime','iftime','../../../config/logger','routing','condition'];(function(_0xbebf50,_0x44ec09){var _0xce1496=function(_0x1bf94d){while(--_0x1bf94d){_0xbebf50['push'](_0xbebf50['shift']());}};_0xce1496(++_0x44ec09);}(_0x5a77,0x126));var _0x75a7=function(_0x527994,_0x4d24eb){_0x527994=_0x527994-0x0;var _0x1a2f96=_0x5a77[_0x527994];return _0x1a2f96;};'use strict';var _=require(_0x75a7('0x0'));var iftime=require(_0x75a7('0x1'))[_0x75a7('0x2')];var logger=require(_0x75a7('0x3'))(_0x75a7('0x4'));exports[_0x75a7('0x5')]=function(_0x3f1ae6,_0x423710,_0x5983fc){return function(_0x42a9cb){if(_0x5983fc[_0x75a7('0x6')]&&!_0x5983fc[_0x75a7('0x6')][_0x3f1ae6]){logger[_0x75a7('0x7')]('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0x3f1ae6);return _0x42a9cb[_0x75a7('0x8')]();}var _0x248682=_0x423710['map'](function(_0x2133f7){return iftime(_0x2133f7);});var _0x475bbb=_[_0x75a7('0x9')](_0x248682);if(_0x475bbb){logger[_0x75a7('0x7')](_0x75a7('0xa'),_0x3f1ae6,_0x423710['join']('\x20|\x20'),_0x475bbb);_0x42a9cb[_0x75a7('0xb')](_0x475bbb);}else{logger[_0x75a7('0x7')](_0x75a7('0xc'),_0x3f1ae6,_0x423710[_0x75a7('0xd')](_0x75a7('0xe')));_0x42a9cb[_0x75a7('0x8')]();}};}; \ No newline at end of file +var _0x6247=['condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','map','[%s][INTERVAL\x20VALID]\x20%s\x20%s','[%s][INTERVAL\x20NOT\x20VALID]\x20%s\x20%s','join','\x20|\x20','lodash','../../../utils/iftime','iftime','../../../config/logger','routing'];(function(_0x1282dc,_0x1cf453){var _0x37d4f2=function(_0x4dbc49){while(--_0x4dbc49){_0x1282dc['push'](_0x1282dc['shift']());}};_0x37d4f2(++_0x1cf453);}(_0x6247,0x19f));var _0x7624=function(_0x2aa20a,_0x5e7be1){_0x2aa20a=_0x2aa20a-0x0;var _0x2e8b56=_0x6247[_0x2aa20a];return _0x2e8b56;};'use strict';var _=require(_0x7624('0x0'));var iftime=require(_0x7624('0x1'))[_0x7624('0x2')];var logger=require(_0x7624('0x3'))(_0x7624('0x4'));exports[_0x7624('0x5')]=function(_0x1d59db,_0x197b08,_0x210e70){return function(_0x47531b){if(_0x210e70[_0x7624('0x6')]&&!_0x210e70['rules'][_0x1d59db]){logger[_0x7624('0x7')](_0x7624('0x8'),_0x1d59db);return _0x47531b[_0x7624('0x9')]();}var _0x504a74=_0x197b08[_0x7624('0xa')](function(_0x218199){return iftime(_0x218199);});var _0x5a397c=_['some'](_0x504a74);if(_0x5a397c){logger[_0x7624('0x7')](_0x7624('0xb'),_0x1d59db,_0x197b08['join']('\x20|\x20'),_0x5a397c);_0x47531b['when'](_0x5a397c);}else{logger['info'](_0x7624('0xc'),_0x1d59db,_0x197b08[_0x7624('0xd')](_0x7624('0xe')));_0x47531b[_0x7624('0x9')]();}};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 7128206..7f41489 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 _0x04b8=['ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','transfertargetuniqueid','[%s][agents][attendedtransfer]','hangup','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','diffTime','agent','[%s][agents][hangup]','util','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','calleridnum','connectedlinenum','lastevent','getVoiceQueueByName','type','agentacw','agentcomplete','acwtime','acwTimeout','request','CreateVoiceAgentReport','uniqueid','agentcalled','debug','destuniqueid','agentcalledAt','connectedlinename','info','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','agentringnoanswerAt','reason','timeout','holdtime','ringtime','talktime','push','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','now','abandoned','agentconnect','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','[%s][agents][agentcomplete]','agentcompleteAt','complete','blindtransfer','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfereruniqueid','transfertype','transferexten','extension','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','transfer'];(function(_0x513047,_0x2199c5){var _0x15b779=function(_0x412fd5){while(--_0x412fd5){_0x513047['push'](_0x513047['shift']());}};_0x15b779(++_0x2199c5);}(_0x04b8,0x159));var _0x804b=function(_0x16947e,_0x262501){_0x16947e=_0x16947e-0x0;var _0x1e36ec=_0x04b8[_0x16947e];return _0x1e36ec;};'use strict';var _=require('lodash');var util=require(_0x804b('0x0'));var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x241a4f,_0xa6a605){utils['info'](util[_0x804b('0x1')](_0x804b('0x2'),_0x241a4f['uniqueid'],_0x241a4f[_0x804b('0x3')],_0x241a4f[_0x804b('0x4')],_0x241a4f[_0x804b('0x5')],_0x241a4f['interface'],_0x241a4f[_0x804b('0x6')],_0x241a4f[_0x804b('0x7')],_0x241a4f[_0x804b('0x8')]));if(_0x241a4f['queue']){utils[_0x804b('0x9')](_0x241a4f[_0x804b('0x4')])['then'](function(_0x2a5a68){if(_0x2a5a68){_0x241a4f[_0x804b('0xa')]=_0x2a5a68[_0x804b('0xa')];_0x241a4f[_0x804b('0xb')]=_0x241a4f[_0x804b('0xc')]?_0x2a5a68['acw']:![];_0x241a4f[_0x804b('0xd')]=_0x241a4f[_0x804b('0xb')]?_0x2a5a68[_0x804b('0xe')]:0x0;}utils[_0x804b('0xf')](_0x804b('0x10'),_0x241a4f);});}else{utils[_0x804b('0xf')]('CreateVoiceAgentReport',_0x241a4f);}if(_0xa6a605){delete transfers[_0x241a4f[_0x804b('0x11')]];}else{delete agents[_0x241a4f['destuniqueid']];}}exports[_0x804b('0x12')]=function(_0x3a2702){try{utils[_0x804b('0x13')](util[_0x804b('0x1')]('[%s][agents][agentcalled]',_0x3a2702[_0x804b('0x11')]),_0x3a2702);agents[_0x3a2702[_0x804b('0x14')]]=_0x3a2702;agents[_0x3a2702[_0x804b('0x14')]][_0x804b('0x15')]=utils['now']();agents[_0x3a2702[_0x804b('0x14')]][_0x804b('0x8')]='called';agents[_0x3a2702[_0x804b('0x14')]]['connectedlinenum']=null;agents[_0x3a2702[_0x804b('0x14')]][_0x804b('0x16')]=null;utils[_0x804b('0x17')](util[_0x804b('0x1')](_0x804b('0x18'),_0x3a2702['uniqueid'],agents[_0x3a2702[_0x804b('0x14')]]['membername'],_0x3a2702[_0x804b('0x14')]));}catch(_0x95e719){utils[_0x804b('0x19')](util[_0x804b('0x1')]('[%s][agents][agentcalled]',_0x3a2702[_0x804b('0x11')]),_0x95e719);}};exports[_0x804b('0x1a')]=function(_0x427166){try{if(!_[_0x804b('0x1b')](agents[_0x427166[_0x804b('0x14')]])){utils[_0x804b('0x13')](util[_0x804b('0x1')](_0x804b('0x1c'),_0x427166[_0x804b('0x11')]),_0x427166);utils[_0x804b('0x17')](util[_0x804b('0x1')]('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0x427166[_0x804b('0x11')],agents[_0x427166[_0x804b('0x14')]]['membername'],_0x427166[_0x804b('0x14')]));agents[_0x427166[_0x804b('0x14')]][_0x804b('0x1a')]=!![];agents[_0x427166[_0x804b('0x14')]][_0x804b('0x1d')]=utils['now']();agents[_0x427166[_0x804b('0x14')]][_0x804b('0x8')]='timeout';agents[_0x427166[_0x804b('0x14')]][_0x804b('0x1e')]=_0x804b('0x1f');agents[_0x427166[_0x804b('0x14')]][_0x804b('0x20')]=_0x427166['ringtime']?parseInt(_0x427166[_0x804b('0x21')])/0x3e8:0x0;agents[_0x427166[_0x804b('0x14')]][_0x804b('0x22')]=0x0;unanswered[_0x804b('0x23')](_0x427166[_0x804b('0x14')]);}}catch(_0x4a6079){utils[_0x804b('0x19')](util[_0x804b('0x1')](_0x804b('0x1c'),_0x427166['uniqueid']),_0x4a6079);}};exports[_0x804b('0x24')]=function(_0x407357){try{_[_0x804b('0x25')](agents,function(_0x57b8da,_0x408857){if(_0x57b8da[_0x804b('0x11')]==_0x407357['uniqueid']&&!_[_0x804b('0x26')](unanswered,_0x57b8da[_0x804b('0x14')])){utils[_0x804b('0x13')](util[_0x804b('0x1')](_0x804b('0x27'),_0x407357[_0x804b('0x11')]),_0x407357);utils['info'](util[_0x804b('0x1')](_0x804b('0x28'),_0x407357[_0x804b('0x11')],_0x57b8da[_0x804b('0x5')],_0x57b8da[_0x804b('0x14')]));_0x57b8da[_0x804b('0x1a')]=!![];_0x57b8da[_0x804b('0x1d')]=utils[_0x804b('0x29')]();_0x57b8da[_0x804b('0x8')]=_0x804b('0x2a');_0x57b8da[_0x804b('0x1e')]=_0x804b('0x2a');_0x57b8da[_0x804b('0x20')]=_0x407357[_0x804b('0x20')];_0x57b8da[_0x804b('0x22')]=0x0;writeDB(_0x57b8da);}});}catch(_0x384c44){utils[_0x804b('0x19')](util[_0x804b('0x1')](_0x804b('0x27'),_0x407357[_0x804b('0x11')]),_0x384c44);}};exports[_0x804b('0x2b')]=function(_0x350387){try{if(agents[_0x350387[_0x804b('0x14')]]){utils[_0x804b('0x13')](util[_0x804b('0x1')]('[%s][agents][agentconnect]',_0x350387['uniqueid']),_0x350387);utils['info'](util[_0x804b('0x1')](_0x804b('0x2c'),_0x350387[_0x804b('0x11')],agents[_0x350387['destuniqueid']]['membername'],_0x350387['destuniqueid']));agents[_0x350387[_0x804b('0x14')]][_0x804b('0x2d')]=utils[_0x804b('0x29')]();agents[_0x350387[_0x804b('0x14')]][_0x804b('0x7')]=_0x350387[_0x804b('0x7')];agents[_0x350387[_0x804b('0x14')]][_0x804b('0x16')]=_0x350387[_0x804b('0x16')];agents[_0x350387[_0x804b('0x14')]][_0x804b('0x20')]=_0x350387[_0x804b('0x21')];agents[_0x350387[_0x804b('0x14')]]['lastevent']=_0x804b('0x2e');_[_0x804b('0x25')](agents,function(_0xb877d6,_0x3d6d8a){if(_0xb877d6[_0x804b('0x14')]!=_0x350387['destuniqueid']&&_0xb877d6['uniqueid']==_0x350387[_0x804b('0x11')]){_0xb877d6[_0x804b('0x22')]=0x0;_0xb877d6[_0x804b('0x20')]=_0x350387['ringtime'];_0xb877d6[_0x804b('0x1a')]=!![];_0xb877d6['agentringnoanswerAt']=utils[_0x804b('0x29')]();_0xb877d6[_0x804b('0x8')]=_0x804b('0x2f');_0xb877d6[_0x804b('0x1e')]=_0x804b('0x2f');_0xb877d6[_0x804b('0x30')]=_0x350387[_0x804b('0x14')];_0xb877d6['answeredelsewheremembername']=_0x350387[_0x804b('0x5')];writeDB(_0xb877d6);}});}}catch(_0x1c0363){utils[_0x804b('0x19')](util[_0x804b('0x1')]('[%s][agents][agentconnect]',_0x350387[_0x804b('0x11')]),_0x1c0363);}};exports[_0x804b('0xc')]=function(_0x1df519){try{if(!_[_0x804b('0x1b')](agents[_0x1df519[_0x804b('0x14')]])){utils[_0x804b('0x13')](util[_0x804b('0x1')](_0x804b('0x31'),_0x1df519['uniqueid']),_0x1df519);utils[_0x804b('0x17')](util['format']('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x1df519['uniqueid'],agents[_0x1df519[_0x804b('0x14')]]['membername'],_0x1df519[_0x804b('0x14')]));agents[_0x1df519[_0x804b('0x14')]][_0x804b('0xc')]=!![];agents[_0x1df519[_0x804b('0x14')]]['agentcompleteAt']=utils[_0x804b('0x29')]();agents[_0x1df519[_0x804b('0x14')]][_0x804b('0x22')]=utils['diffTime'](agents[_0x1df519[_0x804b('0x14')]][_0x804b('0x32')],agents[_0x1df519[_0x804b('0x14')]]['agentconnectAt']);agents[_0x1df519[_0x804b('0x14')]][_0x804b('0x1e')]=_0x1df519[_0x804b('0x1e')];agents[_0x1df519[_0x804b('0x14')]][_0x804b('0x8')]=_0x804b('0x33');writeDB(agents[_0x1df519[_0x804b('0x14')]]);}}catch(_0x2a2a08){utils[_0x804b('0x19')](util[_0x804b('0x1')](_0x804b('0x31'),_0x1df519[_0x804b('0x11')]),_0x2a2a08);}};exports[_0x804b('0x34')]=function(_0x2c1796){try{if(!_['isNil'](agents[_0x2c1796['transfereruniqueid']])){utils[_0x804b('0x13')](util[_0x804b('0x1')](_0x804b('0x35'),_0x2c1796[_0x804b('0x11')]),_0x2c1796);utils[_0x804b('0x17')](util['format'](_0x804b('0x36'),_0x2c1796[_0x804b('0x11')],agents[_0x2c1796[_0x804b('0x37')]][_0x804b('0x5')],agents[_0x2c1796[_0x804b('0x37')]][_0x804b('0x11')]));agents[_0x2c1796['transfereruniqueid']]['transfer']=!![];agents[_0x2c1796[_0x804b('0x37')]][_0x804b('0x38')]='blind';agents[_0x2c1796['transfereruniqueid']][_0x804b('0x39')]=_0x2c1796[_0x804b('0x3a')];agents[_0x2c1796[_0x804b('0x37')]]['transferuniqueid']=agents[_0x2c1796[_0x804b('0x37')]][_0x804b('0x11')];}}catch(_0x54cc99){utils[_0x804b('0x19')](util['format'](_0x804b('0x35'),_0x2c1796['uniqueid']),_0x54cc99);}};exports[_0x804b('0x3b')]=function(_0x183e72){try{utils['debug'](util[_0x804b('0x1')]('[%s][agents][attendedtransfer]',_0x183e72[_0x804b('0x3c')]),_0x183e72);if(_0x183e72[_0x804b('0x3c')]==_0x183e72[_0x804b('0x3d')]){if(!_[_0x804b('0x1b')](agents[_0x183e72[_0x804b('0x3e')]])){utils[_0x804b('0x17')](util[_0x804b('0x1')](_0x804b('0x3f'),_0x183e72[_0x804b('0x3c')],agents[_0x183e72[_0x804b('0x3e')]]['membername']));agents[_0x183e72['secondtransfereruniqueid']][_0x804b('0x40')]=!![];agents[_0x183e72['secondtransfereruniqueid']]['transfertype']=_0x804b('0x41');agents[_0x183e72[_0x804b('0x3e')]][_0x804b('0x39')]=_0x183e72[_0x804b('0x42')];agents[_0x183e72['secondtransfereruniqueid']]['transferuniqueid']=_0x183e72[_0x804b('0x3c')];}if(_0x183e72[_0x804b('0x43')]&&agents[_0x183e72[_0x804b('0x43')]]){agents[_0x183e72[_0x804b('0x43')]][_0x804b('0x44')]=0x1;transfers[_0x183e72[_0x804b('0x43')]]=_[_0x804b('0x45')](agents[_0x183e72[_0x804b('0x43')]]);transfers[_0x183e72[_0x804b('0x43')]][_0x804b('0x6')]=agents[_0x183e72[_0x804b('0x3e')]][_0x804b('0x6')];transfers[_0x183e72[_0x804b('0x43')]][_0x804b('0x46')]=agents[_0x183e72[_0x804b('0x3e')]][_0x804b('0x46')];transfers[_0x183e72['transfereeuniqueid']][_0x804b('0x15')]=utils[_0x804b('0x29')]();transfers[_0x183e72['transfereeuniqueid']][_0x804b('0x2d')]=utils[_0x804b('0x29')]();transfers[_0x183e72[_0x804b('0x43')]][_0x804b('0x20')]=0x0;transfers[_0x183e72['transfereeuniqueid']][_0x804b('0x44')]=0x2;}}else if(_0x183e72[_0x804b('0x3e')]==_0x183e72['secondtransfererlinkedid']){if(!_[_0x804b('0x1b')](agents[_0x183e72[_0x804b('0x3c')]])){utils[_0x804b('0x17')](util['format'](_0x804b('0x3f'),_0x183e72[_0x804b('0x3c')],agents[_0x183e72[_0x804b('0x3c')]][_0x804b('0x5')]));agents[_0x183e72[_0x804b('0x3c')]]['transfer']=!![];agents[_0x183e72[_0x804b('0x3c')]][_0x804b('0x38')]=_0x804b('0x41');agents[_0x183e72[_0x804b('0x3c')]]['transferexten']=_0x183e72['secondtransfererexten'];agents[_0x183e72[_0x804b('0x3c')]]['transferuniqueid']=_0x183e72[_0x804b('0x3e')];}if(_0x183e72[_0x804b('0x47')]&&agents[_0x183e72[_0x804b('0x47')]]){agents[_0x183e72[_0x804b('0x47')]][_0x804b('0x44')]=0x1;transfers[_0x183e72['transfertargetuniqueid']]=_[_0x804b('0x45')](agents[_0x183e72[_0x804b('0x47')]]);transfers[_0x183e72[_0x804b('0x47')]]['calleridnum']=agents[_0x183e72[_0x804b('0x3c')]][_0x804b('0x6')];transfers[_0x183e72['transfertargetuniqueid']][_0x804b('0x46')]=agents[_0x183e72['origtransfereruniqueid']][_0x804b('0x46')];transfers[_0x183e72[_0x804b('0x47')]]['agentcalledAt']=utils[_0x804b('0x29')]();transfers[_0x183e72[_0x804b('0x47')]][_0x804b('0x2d')]=utils['now']();transfers[_0x183e72[_0x804b('0x47')]]['holdtime']=0x0;transfers[_0x183e72[_0x804b('0x47')]][_0x804b('0x44')]=0x2;}}}catch(_0x43f3ec){utils[_0x804b('0x19')](util['format'](_0x804b('0x48'),_0x183e72[_0x804b('0x3c')]),_0x43f3ec);}};exports[_0x804b('0x49')]=function(_0xa1da42){try{utils[_0x804b('0x13')](util[_0x804b('0x1')]('[%s][agents][hangup]',_0xa1da42[_0x804b('0x11')]),_0xa1da42);if(agents[_0xa1da42[_0x804b('0x11')]]&&agents[_0xa1da42['uniqueid']][_0x804b('0x1e')]===_0x804b('0x1f')){if(_0xa1da42[_0x804b('0x4a')]==='21'){agents[_0xa1da42[_0x804b('0x11')]]['reason']=_0x804b('0x4b');agents[_0xa1da42[_0x804b('0x11')]]['lastevent']=_0x804b('0x4b');}utils[_0x804b('0x17')](util['format'](_0x804b('0x4c'),_0xa1da42['uniqueid'],agents[_0xa1da42[_0x804b('0x11')]][_0x804b('0x5')],agents[_0xa1da42[_0x804b('0x11')]][_0x804b('0x1e')],agents[_0xa1da42[_0x804b('0x11')]][_0x804b('0x8')]));writeDB(agents[_0xa1da42[_0x804b('0x11')]]);var _0x5efc95=unanswered[_0x804b('0x4d')](_0xa1da42['uniqueid']);if(_0x5efc95>-0x1){unanswered[_0x804b('0x4e')](_0x5efc95,0x1);}}if(transfers[_0xa1da42[_0x804b('0x11')]]){transfers[_0xa1da42[_0x804b('0x11')]][_0x804b('0xc')]=!![];transfers[_0xa1da42[_0x804b('0x11')]][_0x804b('0x32')]=utils[_0x804b('0x29')]();transfers[_0xa1da42[_0x804b('0x11')]][_0x804b('0x22')]=utils[_0x804b('0x4f')](transfers[_0xa1da42[_0x804b('0x11')]]['agentcompleteAt'],transfers[_0xa1da42['uniqueid']][_0x804b('0x2d')]);transfers[_0xa1da42[_0x804b('0x11')]][_0x804b('0x1e')]=_0x804b('0x50');transfers[_0xa1da42['uniqueid']][_0x804b('0x8')]=_0x804b('0x33');utils[_0x804b('0x17')](util[_0x804b('0x1')](_0x804b('0x4c'),_0xa1da42[_0x804b('0x11')],transfers[_0xa1da42[_0x804b('0x11')]][_0x804b('0x5')],transfers[_0xa1da42[_0x804b('0x11')]][_0x804b('0x1e')],transfers[_0xa1da42['uniqueid']]['lastevent']));writeDB(transfers[_0xa1da42[_0x804b('0x11')]],!![]);}if(agents[_0xa1da42[_0x804b('0x11')]]&&agents[_0xa1da42['uniqueid']][_0x804b('0x2d')]){agents[_0xa1da42[_0x804b('0x11')]]['agentcomplete']=!![];agents[_0xa1da42[_0x804b('0x11')]]['agentcompleteAt']=utils['now']();agents[_0xa1da42[_0x804b('0x11')]][_0x804b('0x22')]=utils['diffTime'](agents[_0xa1da42['uniqueid']][_0x804b('0x32')],agents[_0xa1da42[_0x804b('0x11')]]['agentconnectAt']);agents[_0xa1da42[_0x804b('0x11')]]['reason']=agents[_0xa1da42[_0x804b('0x11')]][_0x804b('0x40')]?_0x804b('0x40'):'agent';agents[_0xa1da42[_0x804b('0x11')]][_0x804b('0x8')]=_0x804b('0x33');utils[_0x804b('0x17')](util[_0x804b('0x1')](_0x804b('0x4c'),_0xa1da42[_0x804b('0x11')],agents[_0xa1da42[_0x804b('0x11')]][_0x804b('0x5')],agents[_0xa1da42[_0x804b('0x11')]]['reason'],agents[_0xa1da42['uniqueid']][_0x804b('0x8')]));writeDB(agents[_0xa1da42[_0x804b('0x11')]]);}}catch(_0x3dd61f){utils[_0x804b('0x19')](util[_0x804b('0x1')](_0x804b('0x51'),_0xa1da42[_0x804b('0x11')]),_0x3dd61f);}}; \ No newline at end of file +var _0x9348=['clone','calleridname','transfer','secondtransfererexten','transfertargetuniqueid','agententerreason','hangup','[%s][agents][hangup]','rejected','indexOf','splice','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','agentcomplete','agent','lodash','util','./utils','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','interface','calleridnum','connectedlinenum','getVoiceQueueByName','agentacw','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','agentcalledAt','now','lastevent','called','connectedlinename','info','error','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','uniqueid','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','reason','holdtime','ringtime','talktime','push','queuecallerabandon','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','forIn','answered_elsewhere','answeredelsewheremembername','[%s][agents][agentcomplete]','agentcompleteAt','diffTime','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','transfertype','transferexten','extension','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','transfereeuniqueid'];(function(_0x350387,_0x475458){var _0x15ff04=function(_0x6f47ae){while(--_0x6f47ae){_0x350387['push'](_0x350387['shift']());}};_0x15ff04(++_0x475458);}(_0x9348,0x10d));var _0x8934=function(_0x430f87,_0x31ec33){_0x430f87=_0x430f87-0x0;var _0x412dc7=_0x9348[_0x430f87];return _0x412dc7;};'use strict';var _=require(_0x8934('0x0'));var util=require(_0x8934('0x1'));var utils=require(_0x8934('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x135b2c,_0x46a231){utils['info'](util[_0x8934('0x3')](_0x8934('0x4'),_0x135b2c['uniqueid'],_0x135b2c[_0x8934('0x5')],_0x135b2c[_0x8934('0x6')],_0x135b2c[_0x8934('0x7')],_0x135b2c[_0x8934('0x8')],_0x135b2c[_0x8934('0x9')],_0x135b2c[_0x8934('0xa')],_0x135b2c['lastevent']));if(_0x135b2c[_0x8934('0x6')]){utils[_0x8934('0xb')](_0x135b2c[_0x8934('0x6')])['then'](function(_0x4b470d){if(_0x4b470d){_0x135b2c['type']=_0x4b470d['type'];_0x135b2c[_0x8934('0xc')]=_0x135b2c['agentcomplete']?_0x4b470d[_0x8934('0xd')]:![];_0x135b2c[_0x8934('0xe')]=_0x135b2c[_0x8934('0xc')]?_0x4b470d[_0x8934('0xf')]:0x0;}utils[_0x8934('0x10')](_0x8934('0x11'),_0x135b2c);});}else{utils[_0x8934('0x10')](_0x8934('0x11'),_0x135b2c);}if(_0x46a231){delete transfers[_0x135b2c['uniqueid']];}else{delete agents[_0x135b2c[_0x8934('0x12')]];}}exports[_0x8934('0x13')]=function(_0x46bca5){try{utils[_0x8934('0x14')](util[_0x8934('0x3')](_0x8934('0x15'),_0x46bca5['uniqueid']),_0x46bca5);agents[_0x46bca5[_0x8934('0x12')]]=_0x46bca5;agents[_0x46bca5[_0x8934('0x12')]][_0x8934('0x16')]=utils[_0x8934('0x17')]();agents[_0x46bca5[_0x8934('0x12')]][_0x8934('0x18')]=_0x8934('0x19');agents[_0x46bca5[_0x8934('0x12')]]['connectedlinenum']=null;agents[_0x46bca5[_0x8934('0x12')]][_0x8934('0x1a')]=null;utils[_0x8934('0x1b')](util['format']('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x46bca5['uniqueid'],agents[_0x46bca5[_0x8934('0x12')]]['membername'],_0x46bca5[_0x8934('0x12')]));}catch(_0xa9c394){utils[_0x8934('0x1c')](util[_0x8934('0x3')](_0x8934('0x15'),_0x46bca5['uniqueid']),_0xa9c394);}};exports[_0x8934('0x1d')]=function(_0x5ae49f){try{if(!_[_0x8934('0x1e')](agents[_0x5ae49f[_0x8934('0x12')]])){utils[_0x8934('0x14')](util[_0x8934('0x3')](_0x8934('0x1f'),_0x5ae49f[_0x8934('0x20')]),_0x5ae49f);utils[_0x8934('0x1b')](util['format'](_0x8934('0x21'),_0x5ae49f[_0x8934('0x20')],agents[_0x5ae49f[_0x8934('0x12')]][_0x8934('0x7')],_0x5ae49f[_0x8934('0x12')]));agents[_0x5ae49f['destuniqueid']][_0x8934('0x1d')]=!![];agents[_0x5ae49f[_0x8934('0x12')]][_0x8934('0x22')]=utils['now']();agents[_0x5ae49f[_0x8934('0x12')]]['lastevent']=_0x8934('0x23');agents[_0x5ae49f[_0x8934('0x12')]][_0x8934('0x24')]='timeout';agents[_0x5ae49f[_0x8934('0x12')]][_0x8934('0x25')]=_0x5ae49f[_0x8934('0x26')]?parseInt(_0x5ae49f[_0x8934('0x26')])/0x3e8:0x0;agents[_0x5ae49f['destuniqueid']][_0x8934('0x27')]=0x0;unanswered[_0x8934('0x28')](_0x5ae49f[_0x8934('0x12')]);}}catch(_0x3d93c7){utils[_0x8934('0x1c')](util[_0x8934('0x3')](_0x8934('0x1f'),_0x5ae49f[_0x8934('0x20')]),_0x3d93c7);}};exports[_0x8934('0x29')]=function(_0x18938a){try{_['forIn'](agents,function(_0x1d068c,_0x3e973e){if(_0x1d068c['uniqueid']==_0x18938a[_0x8934('0x20')]&&!_[_0x8934('0x2a')](unanswered,_0x1d068c[_0x8934('0x12')])){utils[_0x8934('0x14')](util['format'](_0x8934('0x2b'),_0x18938a[_0x8934('0x20')]),_0x18938a);utils[_0x8934('0x1b')](util[_0x8934('0x3')](_0x8934('0x2c'),_0x18938a['uniqueid'],_0x1d068c[_0x8934('0x7')],_0x1d068c['destuniqueid']));_0x1d068c['agentringnoanswer']=!![];_0x1d068c[_0x8934('0x22')]=utils[_0x8934('0x17')]();_0x1d068c[_0x8934('0x18')]=_0x8934('0x2d');_0x1d068c['reason']=_0x8934('0x2d');_0x1d068c[_0x8934('0x25')]=_0x18938a[_0x8934('0x25')];_0x1d068c[_0x8934('0x27')]=0x0;writeDB(_0x1d068c);}});}catch(_0x7b2a1c){utils['error'](util[_0x8934('0x3')](_0x8934('0x2b'),_0x18938a['uniqueid']),_0x7b2a1c);}};exports['agentconnect']=function(_0x845028){try{if(agents[_0x845028[_0x8934('0x12')]]){utils['debug'](util['format'](_0x8934('0x2e'),_0x845028[_0x8934('0x20')]),_0x845028);utils[_0x8934('0x1b')](util[_0x8934('0x3')](_0x8934('0x2f'),_0x845028[_0x8934('0x20')],agents[_0x845028[_0x8934('0x12')]][_0x8934('0x7')],_0x845028[_0x8934('0x12')]));agents[_0x845028[_0x8934('0x12')]][_0x8934('0x30')]=utils['now']();agents[_0x845028[_0x8934('0x12')]][_0x8934('0xa')]=_0x845028['connectedlinenum'];agents[_0x845028[_0x8934('0x12')]][_0x8934('0x1a')]=_0x845028[_0x8934('0x1a')];agents[_0x845028[_0x8934('0x12')]][_0x8934('0x25')]=_0x845028['ringtime'];agents[_0x845028['destuniqueid']]['lastevent']=_0x8934('0x31');_[_0x8934('0x32')](agents,function(_0x8814f6,_0x53581b){if(_0x8814f6[_0x8934('0x12')]!=_0x845028['destuniqueid']&&_0x8814f6['uniqueid']==_0x845028[_0x8934('0x20')]){_0x8814f6[_0x8934('0x27')]=0x0;_0x8814f6['holdtime']=_0x845028['ringtime'];_0x8814f6[_0x8934('0x1d')]=!![];_0x8814f6[_0x8934('0x22')]=utils[_0x8934('0x17')]();_0x8814f6['lastevent']=_0x8934('0x33');_0x8814f6['reason']=_0x8934('0x33');_0x8814f6['answeredelsewheredestinationuniqueid']=_0x845028[_0x8934('0x12')];_0x8814f6[_0x8934('0x34')]=_0x845028[_0x8934('0x7')];writeDB(_0x8814f6);}});}}catch(_0x566d67){utils[_0x8934('0x1c')](util[_0x8934('0x3')](_0x8934('0x2e'),_0x845028[_0x8934('0x20')]),_0x566d67);}};exports['agentcomplete']=function(_0x2182db){try{if(!_[_0x8934('0x1e')](agents[_0x2182db[_0x8934('0x12')]])){utils[_0x8934('0x14')](util[_0x8934('0x3')](_0x8934('0x35'),_0x2182db[_0x8934('0x20')]),_0x2182db);utils[_0x8934('0x1b')](util['format']('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x2182db['uniqueid'],agents[_0x2182db[_0x8934('0x12')]][_0x8934('0x7')],_0x2182db['destuniqueid']));agents[_0x2182db[_0x8934('0x12')]]['agentcomplete']=!![];agents[_0x2182db[_0x8934('0x12')]][_0x8934('0x36')]=utils['now']();agents[_0x2182db[_0x8934('0x12')]][_0x8934('0x27')]=utils[_0x8934('0x37')](agents[_0x2182db[_0x8934('0x12')]]['agentcompleteAt'],agents[_0x2182db[_0x8934('0x12')]][_0x8934('0x30')]);agents[_0x2182db['destuniqueid']][_0x8934('0x24')]=_0x2182db[_0x8934('0x24')];agents[_0x2182db[_0x8934('0x12')]][_0x8934('0x18')]=_0x8934('0x38');writeDB(agents[_0x2182db[_0x8934('0x12')]]);}}catch(_0xa45543){utils[_0x8934('0x1c')](util[_0x8934('0x3')](_0x8934('0x35'),_0x2182db[_0x8934('0x20')]),_0xa45543);}};exports[_0x8934('0x39')]=function(_0x2c322d){try{if(!_[_0x8934('0x1e')](agents[_0x2c322d[_0x8934('0x3a')]])){utils[_0x8934('0x14')](util[_0x8934('0x3')](_0x8934('0x3b'),_0x2c322d['uniqueid']),_0x2c322d);utils[_0x8934('0x1b')](util[_0x8934('0x3')]('[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s',_0x2c322d['uniqueid'],agents[_0x2c322d['transfereruniqueid']]['membername'],agents[_0x2c322d[_0x8934('0x3a')]][_0x8934('0x20')]));agents[_0x2c322d[_0x8934('0x3a')]]['transfer']=!![];agents[_0x2c322d['transfereruniqueid']][_0x8934('0x3c')]='blind';agents[_0x2c322d['transfereruniqueid']][_0x8934('0x3d')]=_0x2c322d[_0x8934('0x3e')];agents[_0x2c322d[_0x8934('0x3a')]][_0x8934('0x3f')]=agents[_0x2c322d[_0x8934('0x3a')]][_0x8934('0x20')];}}catch(_0x3902fb){utils['error'](util[_0x8934('0x3')]('[%s][agents][blindtransfer]',_0x2c322d[_0x8934('0x20')]),_0x3902fb);}};exports[_0x8934('0x40')]=function(_0x2d776a){try{utils[_0x8934('0x14')](util[_0x8934('0x3')](_0x8934('0x41'),_0x2d776a[_0x8934('0x42')]),_0x2d776a);if(_0x2d776a[_0x8934('0x42')]==_0x2d776a['origtransfererlinkedid']){if(!_[_0x8934('0x1e')](agents[_0x2d776a[_0x8934('0x43')]])){utils[_0x8934('0x1b')](util[_0x8934('0x3')](_0x8934('0x44'),_0x2d776a['origtransfereruniqueid'],agents[_0x2d776a[_0x8934('0x43')]][_0x8934('0x7')]));agents[_0x2d776a[_0x8934('0x43')]]['transfer']=!![];agents[_0x2d776a[_0x8934('0x43')]][_0x8934('0x3c')]=_0x8934('0x45');agents[_0x2d776a['secondtransfereruniqueid']]['transferexten']=_0x2d776a['origtransfererexten'];agents[_0x2d776a[_0x8934('0x43')]][_0x8934('0x3f')]=_0x2d776a[_0x8934('0x42')];}if(_0x2d776a['transfereeuniqueid']&&agents[_0x2d776a[_0x8934('0x46')]]){agents[_0x2d776a[_0x8934('0x46')]]['agententerreason']=0x1;transfers[_0x2d776a['transfereeuniqueid']]=_[_0x8934('0x47')](agents[_0x2d776a[_0x8934('0x46')]]);transfers[_0x2d776a[_0x8934('0x46')]][_0x8934('0x9')]=agents[_0x2d776a['secondtransfereruniqueid']]['calleridnum'];transfers[_0x2d776a['transfereeuniqueid']]['calleridname']=agents[_0x2d776a[_0x8934('0x43')]][_0x8934('0x48')];transfers[_0x2d776a[_0x8934('0x46')]][_0x8934('0x16')]=utils[_0x8934('0x17')]();transfers[_0x2d776a[_0x8934('0x46')]]['agentconnectAt']=utils[_0x8934('0x17')]();transfers[_0x2d776a[_0x8934('0x46')]]['holdtime']=0x0;transfers[_0x2d776a[_0x8934('0x46')]]['agententerreason']=0x2;}}else if(_0x2d776a[_0x8934('0x43')]==_0x2d776a['secondtransfererlinkedid']){if(!_[_0x8934('0x1e')](agents[_0x2d776a[_0x8934('0x42')]])){utils[_0x8934('0x1b')](util[_0x8934('0x3')](_0x8934('0x44'),_0x2d776a[_0x8934('0x42')],agents[_0x2d776a[_0x8934('0x42')]]['membername']));agents[_0x2d776a['origtransfereruniqueid']][_0x8934('0x49')]=!![];agents[_0x2d776a[_0x8934('0x42')]][_0x8934('0x3c')]=_0x8934('0x45');agents[_0x2d776a[_0x8934('0x42')]][_0x8934('0x3d')]=_0x2d776a[_0x8934('0x4a')];agents[_0x2d776a[_0x8934('0x42')]][_0x8934('0x3f')]=_0x2d776a[_0x8934('0x43')];}if(_0x2d776a[_0x8934('0x4b')]&&agents[_0x2d776a[_0x8934('0x4b')]]){agents[_0x2d776a[_0x8934('0x4b')]][_0x8934('0x4c')]=0x1;transfers[_0x2d776a['transfertargetuniqueid']]=_['clone'](agents[_0x2d776a[_0x8934('0x4b')]]);transfers[_0x2d776a[_0x8934('0x4b')]][_0x8934('0x9')]=agents[_0x2d776a[_0x8934('0x42')]][_0x8934('0x9')];transfers[_0x2d776a[_0x8934('0x4b')]][_0x8934('0x48')]=agents[_0x2d776a['origtransfereruniqueid']][_0x8934('0x48')];transfers[_0x2d776a[_0x8934('0x4b')]]['agentcalledAt']=utils[_0x8934('0x17')]();transfers[_0x2d776a['transfertargetuniqueid']][_0x8934('0x30')]=utils[_0x8934('0x17')]();transfers[_0x2d776a[_0x8934('0x4b')]]['holdtime']=0x0;transfers[_0x2d776a[_0x8934('0x4b')]][_0x8934('0x4c')]=0x2;}}}catch(_0x544fa7){utils[_0x8934('0x1c')](util['format'](_0x8934('0x41'),_0x2d776a['origtransfereruniqueid']),_0x544fa7);}};exports[_0x8934('0x4d')]=function(_0x6b3376){try{utils[_0x8934('0x14')](util['format'](_0x8934('0x4e'),_0x6b3376[_0x8934('0x20')]),_0x6b3376);if(agents[_0x6b3376[_0x8934('0x20')]]&&agents[_0x6b3376[_0x8934('0x20')]]['reason']===_0x8934('0x23')){if(_0x6b3376['cause']==='21'){agents[_0x6b3376[_0x8934('0x20')]][_0x8934('0x24')]=_0x8934('0x4f');agents[_0x6b3376[_0x8934('0x20')]]['lastevent']=_0x8934('0x4f');}utils[_0x8934('0x1b')](util[_0x8934('0x3')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x6b3376[_0x8934('0x20')],agents[_0x6b3376[_0x8934('0x20')]][_0x8934('0x7')],agents[_0x6b3376['uniqueid']]['reason'],agents[_0x6b3376[_0x8934('0x20')]][_0x8934('0x18')]));writeDB(agents[_0x6b3376[_0x8934('0x20')]]);var _0x1efd58=unanswered[_0x8934('0x50')](_0x6b3376[_0x8934('0x20')]);if(_0x1efd58>-0x1){unanswered[_0x8934('0x51')](_0x1efd58,0x1);}}if(transfers[_0x6b3376[_0x8934('0x20')]]){transfers[_0x6b3376[_0x8934('0x20')]]['agentcomplete']=!![];transfers[_0x6b3376[_0x8934('0x20')]][_0x8934('0x36')]=utils[_0x8934('0x17')]();transfers[_0x6b3376[_0x8934('0x20')]][_0x8934('0x27')]=utils['diffTime'](transfers[_0x6b3376[_0x8934('0x20')]][_0x8934('0x36')],transfers[_0x6b3376['uniqueid']][_0x8934('0x30')]);transfers[_0x6b3376['uniqueid']]['reason']='agent';transfers[_0x6b3376[_0x8934('0x20')]][_0x8934('0x18')]=_0x8934('0x38');utils['info'](util[_0x8934('0x3')](_0x8934('0x52'),_0x6b3376['uniqueid'],transfers[_0x6b3376[_0x8934('0x20')]][_0x8934('0x7')],transfers[_0x6b3376[_0x8934('0x20')]][_0x8934('0x24')],transfers[_0x6b3376[_0x8934('0x20')]][_0x8934('0x18')]));writeDB(transfers[_0x6b3376[_0x8934('0x20')]],!![]);}if(agents[_0x6b3376[_0x8934('0x20')]]&&agents[_0x6b3376[_0x8934('0x20')]][_0x8934('0x30')]){agents[_0x6b3376['uniqueid']][_0x8934('0x53')]=!![];agents[_0x6b3376[_0x8934('0x20')]][_0x8934('0x36')]=utils[_0x8934('0x17')]();agents[_0x6b3376[_0x8934('0x20')]][_0x8934('0x27')]=utils[_0x8934('0x37')](agents[_0x6b3376['uniqueid']][_0x8934('0x36')],agents[_0x6b3376[_0x8934('0x20')]][_0x8934('0x30')]);agents[_0x6b3376[_0x8934('0x20')]][_0x8934('0x24')]=agents[_0x6b3376[_0x8934('0x20')]][_0x8934('0x49')]?_0x8934('0x49'):_0x8934('0x54');agents[_0x6b3376['uniqueid']]['lastevent']=_0x8934('0x38');utils[_0x8934('0x1b')](util['format'](_0x8934('0x52'),_0x6b3376[_0x8934('0x20')],agents[_0x6b3376[_0x8934('0x20')]][_0x8934('0x7')],agents[_0x6b3376[_0x8934('0x20')]][_0x8934('0x24')],agents[_0x6b3376[_0x8934('0x20')]][_0x8934('0x18')]));writeDB(agents[_0x6b3376[_0x8934('0x20')]]);}}catch(_0x2d094e){utils[_0x8934('0x1c')](util['format'](_0x8934('0x4e'),_0x6b3376[_0x8934('0x20')]),_0x2d094e);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 3ee181f..27ccd04 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 _0x3422=['billableseconds','diffTime','error','localtwolinkedid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfereruniqueid','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','[%s][calls][attendedtransfer]','[%s][calls][musiconholdstart]','musiconholdstartAt','musiconholdstop','[%s][calls][musiconholdstop]\x20mohtime:%s','mohtime','[%s][calls][musiconholdstop]','varset','[%s][calls][varset]','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','variable','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid-preview','xmd-queue','xmcs-queue','lastapplication','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','[%s][calls][newexten]','appdata','application','set','startsWith','toLowerCase','cdr','substring','lastIndexOf','includes','noop','gotoif','lodash','util','./utils','NO\x20ANSWER','FAILED','ANSWERED','BUSY','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','then','UserId','request','CreateVoiceCallReport','newchannel','[%s][calls][newchannel]','OutgoingSpoolFailed','info','[%s][calls][newchannel]\x20context:%s\x20exten:%s','exten','context','now','DOCUMENTATION','debug','[%s][calls][newstate]','[%s][calls][newstate]\x20context:%s\x20channel:%s','isNil','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','linkedid','destinationchannel','answertime','disposition','channelstate','hangup','[%s][calls][hangup]','callerid','cause-txt','endtime','duration'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3422,0x17e));var _0x2342=function(_0x12b56c,_0x5e6857){_0x12b56c=_0x12b56c-0x0;var _0xa156b8=_0x3422[_0x12b56c];return _0xa156b8;};'use strict';var _=require(_0x2342('0x0'));var util=require(_0x2342('0x1'));var utils=require(_0x2342('0x2'));var dispositions=[_0x2342('0x3'),'FAILED',_0x2342('0x4'),'NO\x20ANSWER','NO\x20ANSWER',_0x2342('0x3'),_0x2342('0x5'),_0x2342('0x6'),_0x2342('0x4'),_0x2342('0x4'),'FAILED'];var channels={};function writeDB(_0x338ee4){utils['info'](util[_0x2342('0x7')](_0x2342('0x8'),_0x338ee4[_0x2342('0x9')],_0x338ee4[_0x2342('0xa')],_0x338ee4[_0x2342('0xb')],_0x338ee4[_0x2342('0xc')],_0x338ee4[_0x2342('0xd')],_0x338ee4[_0x2342('0xe')],_0x338ee4[_0x2342('0xf')],_0x338ee4[_0x2342('0x10')]));if(_0x338ee4[_0x2342('0x11')]){utils[_0x2342('0x12')](_0x338ee4[_0x2342('0x11')])[_0x2342('0x13')](function(_0x11a67d){if(_0x11a67d){_0x338ee4[_0x2342('0x14')]=_0x11a67d['id'];}utils[_0x2342('0x15')](_0x2342('0x16'),_0x338ee4);});}else{utils['request'](_0x2342('0x16'),_0x338ee4);}if(channels[_0x338ee4[_0x2342('0x9')]]){delete channels[_0x338ee4['uniqueid']];}}exports[_0x2342('0x17')]=function(_0x109d3a){try{utils['debug'](util['format'](_0x2342('0x18'),_0x109d3a[_0x2342('0x9')]),_0x109d3a);if(_0x109d3a[_0x2342('0x9')]==_0x109d3a['linkedid']&&_0x109d3a[_0x2342('0xa')]!=_0x2342('0x19')){utils[_0x2342('0x1a')](util[_0x2342('0x7')](_0x2342('0x1b'),_0x109d3a[_0x2342('0x9')],_0x109d3a['context'],_0x109d3a[_0x2342('0x1c')]));channels[_0x109d3a['uniqueid']]={'uniqueid':_0x109d3a[_0x2342('0x9')],'accountcode':_0x109d3a[_0x2342('0x11')],'source':_0x109d3a[_0x2342('0xe')],'destination':_0x109d3a[_0x2342('0x1c')],'destinationcontext':_0x109d3a[_0x2342('0x1d')],'channel':_0x109d3a[_0x2342('0xa')],'starttime':utils[_0x2342('0x1e')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x2342('0x3'),'amaflags':_0x2342('0x1f')};}}catch(_0x34047d){utils['error'](util['format']('[%s][calls][newchannel]',_0x109d3a[_0x2342('0x9')]),_0x34047d);}};exports['newstate']=function(_0x4c2bd3){try{utils[_0x2342('0x20')](util[_0x2342('0x7')](_0x2342('0x21'),_0x4c2bd3[_0x2342('0x9')]),_0x4c2bd3);if(!_['isNil'](channels[_0x4c2bd3[_0x2342('0x9')]])&&_0x4c2bd3['channelstate']==0x6){utils[_0x2342('0x1a')](util['format'](_0x2342('0x22'),_0x4c2bd3[_0x2342('0x9')],_0x4c2bd3[_0x2342('0x1d')],_0x4c2bd3[_0x2342('0xa')]));if(_[_0x2342('0x23')](channels[_0x4c2bd3['uniqueid']][_0x2342('0x24')])){channels[_0x4c2bd3[_0x2342('0x9')]][_0x2342('0x24')]=utils['now']();}}else if(!_['isNil'](channels[_0x4c2bd3['linkedid']])&&_0x4c2bd3['channelstate']==0x6&&_0x4c2bd3['context']!=_0x2342('0x25')){utils['info'](util['format'](_0x2342('0x26'),_0x4c2bd3[_0x2342('0x9')],_0x4c2bd3[_0x2342('0x27')],_0x4c2bd3[_0x2342('0x1d')],_0x4c2bd3['channel']));channels[_0x4c2bd3[_0x2342('0x27')]][_0x2342('0x11')]=_0x4c2bd3[_0x2342('0x11')];channels[_0x4c2bd3[_0x2342('0x27')]][_0x2342('0x28')]=_0x4c2bd3['channel'];if(_[_0x2342('0x23')](channels[_0x4c2bd3[_0x2342('0x27')]][_0x2342('0x29')])){channels[_0x4c2bd3[_0x2342('0x27')]][_0x2342('0x29')]=utils[_0x2342('0x1e')]();}channels[_0x4c2bd3[_0x2342('0x27')]][_0x2342('0x2a')]=dispositions[_['toNumber'](_0x4c2bd3[_0x2342('0x2b')])]||_0x2342('0x5');}}catch(_0xfef64e){utils['error'](util[_0x2342('0x7')](_0x2342('0x21'),_0x4c2bd3['uniqueid']),_0xfef64e);}};exports[_0x2342('0x2c')]=function(_0x58576e){try{if(!_[_0x2342('0x23')](channels[_0x58576e[_0x2342('0x9')]])){utils[_0x2342('0x20')](util[_0x2342('0x7')](_0x2342('0x2d'),_0x58576e[_0x2342('0x9')]),_0x58576e);if(_[_0x2342('0x23')](channels[_0x58576e[_0x2342('0x9')]][_0x2342('0x2e')])){channels[_0x58576e['uniqueid']][_0x2342('0x2e')]=_0x58576e['calleridname']+'\x20<'+_0x58576e['calleridnum']+'>';}utils[_0x2342('0x1a')](util[_0x2342('0x7')]('[%s][calls][hangup]\x20callerid:%s\x20reason:%s',_0x58576e[_0x2342('0x9')],channels[_0x58576e['uniqueid']]['callerid'],_0x58576e[_0x2342('0x2f')]));channels[_0x58576e[_0x2342('0x9')]][_0x2342('0x30')]=utils[_0x2342('0x1e')]();channels[_0x58576e[_0x2342('0x9')]][_0x2342('0x31')]=utils['diffTime'](channels[_0x58576e[_0x2342('0x9')]][_0x2342('0x30')],channels[_0x58576e['uniqueid']]['starttime']);channels[_0x58576e['uniqueid']][_0x2342('0x32')]=channels[_0x58576e[_0x2342('0x9')]][_0x2342('0x29')]?utils[_0x2342('0x33')](channels[_0x58576e[_0x2342('0x9')]][_0x2342('0x30')],channels[_0x58576e['uniqueid']]['answertime']):0x0;writeDB(channels[_0x58576e['uniqueid']]);}}catch(_0x3ef835){utils[_0x2342('0x34')](util['format']('[%s][calls][hangup]',_0x58576e['uniqueid']),_0x3ef835);}};exports['attendedtransfer']=function(_0x2df9ab){try{if(!_['isNil'](channels[_0x2df9ab[_0x2342('0x35')]])){utils[_0x2342('0x20')](util[_0x2342('0x7')]('[%s][calls][attendedtransfer]',_0x2df9ab['origtransfereruniqueid']),_0x2df9ab);if(channels[_0x2df9ab[_0x2342('0x35')]][_0x2342('0xa')]==_0x2df9ab[_0x2342('0x36')]){utils[_0x2342('0x1a')](util[_0x2342('0x7')](_0x2342('0x37'),_0x2df9ab[_0x2342('0x38')],_0x2df9ab[_0x2342('0x35')],_0x2df9ab[_0x2342('0x39')]));channels[_0x2df9ab['localtwolinkedid']]['destinationchannel']=_0x2df9ab[_0x2342('0x39')];channels[_0x2df9ab[_0x2342('0x35')]][_0x2342('0x3a')]=_0x2342('0x3b');}else if(channels[_0x2df9ab[_0x2342('0x35')]][_0x2342('0xa')]=_0x2df9ab[_0x2342('0x3c')]){utils[_0x2342('0x1a')](util[_0x2342('0x7')](_0x2342('0x37'),_0x2df9ab[_0x2342('0x38')],_0x2df9ab[_0x2342('0x35')],_0x2df9ab['origtransfererchannel']));channels[_0x2df9ab[_0x2342('0x35')]][_0x2342('0x28')]=_0x2df9ab[_0x2342('0x3d')];channels[_0x2df9ab[_0x2342('0x35')]][_0x2342('0x3a')]=_0x2342('0x3b');}}}catch(_0x5b5fa4){utils[_0x2342('0x34')](util[_0x2342('0x7')](_0x2342('0x3e'),_0x2df9ab[_0x2342('0x38')]),_0x5b5fa4);}};exports['musiconholdstart']=function(_0x53e232){try{if(!_[_0x2342('0x23')](channels[_0x53e232[_0x2342('0x9')]])){utils[_0x2342('0x20')](util['format'](_0x2342('0x3f'),_0x53e232['uniqueid']),_0x53e232);channels[_0x53e232['uniqueid']]['musiconholdstartAt']=utils[_0x2342('0x1e')]();utils[_0x2342('0x1a')](util[_0x2342('0x7')]('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0x53e232['uniqueid'],channels[_0x53e232[_0x2342('0x9')]][_0x2342('0x40')]));}}catch(_0x1e6c1b){utils[_0x2342('0x34')](util[_0x2342('0x7')]('[%s][calls][musiconholdstart]',_0x53e232['uniqueid']),_0x1e6c1b);}};exports[_0x2342('0x41')]=function(_0x35f393){try{if(!_[_0x2342('0x23')](channels[_0x35f393[_0x2342('0x9')]])){utils[_0x2342('0x20')](util[_0x2342('0x7')]('[%s][calls][musiconholdstop]',_0x35f393['uniqueid']),_0x35f393);if(!_[_0x2342('0x23')](channels[_0x35f393[_0x2342('0x9')]][_0x2342('0x40')])){channels[_0x35f393['uniqueid']]['mohtime']+=utils[_0x2342('0x33')](utils[_0x2342('0x1e')](),channels[_0x35f393[_0x2342('0x9')]][_0x2342('0x40')]);utils[_0x2342('0x1a')](util[_0x2342('0x7')](_0x2342('0x42'),_0x35f393[_0x2342('0x9')],channels[_0x35f393[_0x2342('0x9')]][_0x2342('0x43')]));delete channels[_0x35f393[_0x2342('0x9')]][_0x2342('0x40')];}}}catch(_0x49680a){utils[_0x2342('0x34')](util[_0x2342('0x7')](_0x2342('0x44'),_0x35f393[_0x2342('0x9')]),_0x49680a);}};exports[_0x2342('0x45')]=function(_0x3b969b){try{if(!_[_0x2342('0x23')](channels[_0x3b969b[_0x2342('0x9')]])){utils[_0x2342('0x20')](util[_0x2342('0x7')](_0x2342('0x46'),_0x3b969b[_0x2342('0x9')]),_0x3b969b);if(!_[_0x2342('0x23')](_0x3b969b['variable'][_0x2342('0x47')])){utils[_0x2342('0x1a')](util[_0x2342('0x7')](_0x2342('0x48'),_0x3b969b[_0x2342('0x9')],_0x3b969b[_0x2342('0x49')]));channels[_0x3b969b[_0x2342('0x9')]][_0x2342('0x4a')]=_0x3b969b[_0x2342('0x49')];}if(!_['isNil'](_0x3b969b[_0x2342('0x4b')]['xmd-phone'])){utils[_0x2342('0x1a')](util['format'](_0x2342('0x4c'),_0x3b969b[_0x2342('0x9')],_0x3b969b[_0x2342('0x49')]));channels[_0x3b969b[_0x2342('0x9')]][_0x2342('0x4d')]=_0x3b969b[_0x2342('0x49')];channels[_0x3b969b[_0x2342('0x9')]][_0x2342('0x2e')]='\x22'+_0x3b969b[_0x2342('0x49')]+_0x2342('0x4e')+_0x3b969b['value']+'>';}if(!_[_0x2342('0x23')](_0x3b969b[_0x2342('0x4b')]['xmd-callerid-preview'])||!_[_0x2342('0x23')](_0x3b969b[_0x2342('0x4b')][_0x2342('0x4f')])){utils['info'](util[_0x2342('0x7')](_0x2342('0x50'),_0x3b969b[_0x2342('0x9')],!_[_0x2342('0x23')](_0x3b969b['variable'][_0x2342('0x51')])?_0x2342('0x51'):_0x2342('0x4f'),_0x3b969b[_0x2342('0x49')]));channels[_0x3b969b['uniqueid']][_0x2342('0x2e')]=_0x3b969b[_0x2342('0x49')];}if(!_['isNil'](_0x3b969b[_0x2342('0x4b')]['xmd-queue'])||!_[_0x2342('0x23')](_0x3b969b[_0x2342('0x4b')]['xmcs-queue'])){utils[_0x2342('0x1a')](util[_0x2342('0x7')](_0x2342('0x50'),_0x3b969b['uniqueid'],!_[_0x2342('0x23')](_0x3b969b[_0x2342('0x4b')][_0x2342('0x52')])?_0x2342('0x52'):_0x2342('0x53'),_0x3b969b[_0x2342('0x49')]));channels[_0x3b969b['uniqueid']][_0x2342('0x54')]='Queue';channels[_0x3b969b[_0x2342('0x9')]][_0x2342('0x55')]=_0x3b969b[_0x2342('0x49')];channels[_0x3b969b['uniqueid']][_0x2342('0xb')]=!![];}if(!_['isNil'](_0x3b969b[_0x2342('0x4b')][_0x2342('0x56')])){utils[_0x2342('0x1a')](util[_0x2342('0x7')](_0x2342('0x57'),_0x3b969b[_0x2342('0x9')],_0x3b969b[_0x2342('0x49')]));channels[_0x3b969b[_0x2342('0x9')]][_0x2342('0x58')]=_0x3b969b[_0x2342('0x49')];}if(!_[_0x2342('0x23')](_0x3b969b[_0x2342('0x4b')][_0x2342('0x59')])){utils[_0x2342('0x1a')](util[_0x2342('0x7')](_0x2342('0x5a'),_0x3b969b[_0x2342('0x9')],_0x3b969b['value']));channels[_0x3b969b['uniqueid']]['type']=_0x3b969b[_0x2342('0x49')];}if(!_[_0x2342('0x23')](_0x3b969b[_0x2342('0x4b')][_0x2342('0x5b')])){utils['info'](util['format'](_0x2342('0x5c'),_0x3b969b[_0x2342('0x9')],_0x3b969b['value']));channels[_0x3b969b['uniqueid']][_0x2342('0x5d')]=_0x3b969b[_0x2342('0x49')];}if(!_[_0x2342('0x23')](_0x3b969b[_0x2342('0x4b')][_0x2342('0x5e')])){utils['info'](util[_0x2342('0x7')](_0x2342('0x5f'),_0x3b969b['uniqueid'],_0x3b969b['value']));channels[_0x3b969b[_0x2342('0x9')]][_0x2342('0x5e')]=_0x3b969b[_0x2342('0x49')];}}}catch(_0x57c714){utils['error'](util[_0x2342('0x7')](_0x2342('0x46'),_0x3b969b[_0x2342('0x9')]),_0x57c714);}};exports['newexten']=function(_0x547d5a){try{if(!_[_0x2342('0x23')](channels[_0x547d5a[_0x2342('0x9')]])){utils[_0x2342('0x20')](util[_0x2342('0x7')](_0x2342('0x60'),_0x547d5a[_0x2342('0x9')]),_0x547d5a);utils[_0x2342('0x1a')](util[_0x2342('0x7')]('[%s][calls][newexten]\x20application:%s\x20appdata:%s',_0x547d5a[_0x2342('0x9')],_0x547d5a['application'],_0x547d5a[_0x2342('0x61')]));if(_0x547d5a[_0x2342('0x62')]['toLowerCase']()==_0x2342('0x63')&&_[_0x2342('0x64')](_0x547d5a[_0x2342('0x61')][_0x2342('0x65')](),_0x2342('0x66'))){var _0x17d3fe=_0x547d5a[_0x2342('0x61')]['split']('=');var _0x13af6d=_0x17d3fe[0x0][_0x2342('0x67')](_0x17d3fe[0x0]['lastIndexOf']('(')+0x1,_0x17d3fe[0x0][_0x2342('0x68')](')'));var _0x175349=_0x17d3fe[0x1];channels[_0x547d5a[_0x2342('0x9')]][_0x13af6d]=_0x175349;}if(!_[_0x2342('0x69')]([_0x2342('0x2c'),_0x2342('0x6a'),'execif',_0x2342('0x63'),_0x2342('0x6b')],_0x547d5a[_0x2342('0x62')][_0x2342('0x65')]())){channels[_0x547d5a[_0x2342('0x9')]][_0x2342('0x54')]=_0x547d5a[_0x2342('0x62')];channels[_0x547d5a[_0x2342('0x9')]][_0x2342('0x55')]=_0x547d5a[_0x2342('0x61')];}}}catch(_0x1b0543){utils[_0x2342('0x34')](util[_0x2342('0x7')](_0x2342('0x60'),_0x547d5a['uniqueid']),_0x1b0543);}}; \ No newline at end of file +var _0x37d1=['channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','then','UserId','CreateVoiceCallReport','request','newchannel','debug','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','info','[%s][calls][newchannel]\x20context:%s\x20exten:%s','exten','context','now','DOCUMENTATION','newstate','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','toNumber','error','callerid','calleridname','cause-txt','endtime','duration','diffTime','starttime','billableseconds','[%s][calls][hangup]','attendedtransfer','[%s][calls][attendedtransfer]','origtransfereruniqueid','localtwolinkedid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','_attended','transfertargetchannel','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','source','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','\x22\x20<','variable','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid-preview','xmd-callerid','xmd-queue','lastapplication','Queue','lastdata','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','newexten','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set','startsWith','appdata','cdr','split','substring','lastIndexOf','includes','hangup','noop','execif','gotoif','[%s][calls][newexten]','lodash','util','NO\x20ANSWER','FAILED','ANSWERED','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid'];(function(_0x596680,_0x4e883a){var _0xc7c907=function(_0x7fa9b8){while(--_0x7fa9b8){_0x596680['push'](_0x596680['shift']());}};_0xc7c907(++_0x4e883a);}(_0x37d1,0xd8));var _0x137d=function(_0x52afd3,_0x2ee6ed){_0x52afd3=_0x52afd3-0x0;var _0x480668=_0x37d1[_0x52afd3];return _0x480668;};'use strict';var _=require(_0x137d('0x0'));var util=require(_0x137d('0x1'));var utils=require('./utils');var dispositions=[_0x137d('0x2'),'FAILED',_0x137d('0x3'),_0x137d('0x2'),'NO\x20ANSWER',_0x137d('0x2'),_0x137d('0x4'),'BUSY',_0x137d('0x3'),_0x137d('0x3'),_0x137d('0x3')];var channels={};function writeDB(_0x515f6b){utils['info'](util[_0x137d('0x5')](_0x137d('0x6'),_0x515f6b[_0x137d('0x7')],_0x515f6b[_0x137d('0x8')],_0x515f6b[_0x137d('0x9')],_0x515f6b[_0x137d('0xa')],_0x515f6b[_0x137d('0xb')],_0x515f6b[_0x137d('0xc')],_0x515f6b[_0x137d('0xd')],_0x515f6b[_0x137d('0xe')]));if(_0x515f6b[_0x137d('0xf')]){utils[_0x137d('0x10')](_0x515f6b[_0x137d('0xf')])[_0x137d('0x11')](function(_0xfaad6c){if(_0xfaad6c){_0x515f6b[_0x137d('0x12')]=_0xfaad6c['id'];}utils['request'](_0x137d('0x13'),_0x515f6b);});}else{utils[_0x137d('0x14')](_0x137d('0x13'),_0x515f6b);}if(channels[_0x515f6b[_0x137d('0x7')]]){delete channels[_0x515f6b['uniqueid']];}}exports[_0x137d('0x15')]=function(_0x471d2d){try{utils[_0x137d('0x16')](util[_0x137d('0x5')](_0x137d('0x17'),_0x471d2d[_0x137d('0x7')]),_0x471d2d);if(_0x471d2d[_0x137d('0x7')]==_0x471d2d[_0x137d('0x18')]&&_0x471d2d['channel']!=_0x137d('0x19')){utils[_0x137d('0x1a')](util[_0x137d('0x5')](_0x137d('0x1b'),_0x471d2d[_0x137d('0x7')],_0x471d2d['context'],_0x471d2d[_0x137d('0x1c')]));channels[_0x471d2d[_0x137d('0x7')]]={'uniqueid':_0x471d2d['uniqueid'],'accountcode':_0x471d2d[_0x137d('0xf')],'source':_0x471d2d['calleridnum'],'destination':_0x471d2d[_0x137d('0x1c')],'destinationcontext':_0x471d2d[_0x137d('0x1d')],'channel':_0x471d2d['channel'],'starttime':utils[_0x137d('0x1e')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x137d('0x2'),'amaflags':_0x137d('0x1f')};}}catch(_0x3e8814){utils['error'](util[_0x137d('0x5')](_0x137d('0x17'),_0x471d2d['uniqueid']),_0x3e8814);}};exports[_0x137d('0x20')]=function(_0x2d0be9){try{utils[_0x137d('0x16')](util[_0x137d('0x5')](_0x137d('0x21'),_0x2d0be9['uniqueid']),_0x2d0be9);if(!_[_0x137d('0x22')](channels[_0x2d0be9['uniqueid']])&&_0x2d0be9[_0x137d('0x23')]==0x6){utils[_0x137d('0x1a')](util['format'](_0x137d('0x24'),_0x2d0be9['uniqueid'],_0x2d0be9['context'],_0x2d0be9[_0x137d('0x8')]));if(_[_0x137d('0x22')](channels[_0x2d0be9[_0x137d('0x7')]]['systemanswertime'])){channels[_0x2d0be9[_0x137d('0x7')]][_0x137d('0x25')]=utils[_0x137d('0x1e')]();}}else if(!_['isNil'](channels[_0x2d0be9[_0x137d('0x18')]])&&_0x2d0be9[_0x137d('0x23')]==0x6&&_0x2d0be9[_0x137d('0x1d')]!=_0x137d('0x26')){utils[_0x137d('0x1a')](util['format'](_0x137d('0x27'),_0x2d0be9[_0x137d('0x7')],_0x2d0be9[_0x137d('0x18')],_0x2d0be9[_0x137d('0x1d')],_0x2d0be9[_0x137d('0x8')]));channels[_0x2d0be9[_0x137d('0x18')]][_0x137d('0xf')]=_0x2d0be9[_0x137d('0xf')];channels[_0x2d0be9[_0x137d('0x18')]][_0x137d('0x28')]=_0x2d0be9[_0x137d('0x8')];if(_['isNil'](channels[_0x2d0be9[_0x137d('0x18')]][_0x137d('0x29')])){channels[_0x2d0be9[_0x137d('0x18')]]['answertime']=utils['now']();}channels[_0x2d0be9[_0x137d('0x18')]]['disposition']=dispositions[_[_0x137d('0x2a')](_0x2d0be9['channelstate'])]||_0x137d('0x4');}}catch(_0x29dfef){utils[_0x137d('0x2b')](util[_0x137d('0x5')](_0x137d('0x21'),_0x2d0be9['uniqueid']),_0x29dfef);}};exports['hangup']=function(_0x58fc63){try{if(!_[_0x137d('0x22')](channels[_0x58fc63[_0x137d('0x7')]])){utils['debug'](util[_0x137d('0x5')]('[%s][calls][hangup]',_0x58fc63[_0x137d('0x7')]),_0x58fc63);if(_[_0x137d('0x22')](channels[_0x58fc63[_0x137d('0x7')]][_0x137d('0x2c')])){channels[_0x58fc63[_0x137d('0x7')]][_0x137d('0x2c')]=_0x58fc63[_0x137d('0x2d')]+'\x20<'+_0x58fc63[_0x137d('0xc')]+'>';}utils[_0x137d('0x1a')](util[_0x137d('0x5')]('[%s][calls][hangup]\x20callerid:%s\x20reason:%s',_0x58fc63[_0x137d('0x7')],channels[_0x58fc63[_0x137d('0x7')]][_0x137d('0x2c')],_0x58fc63[_0x137d('0x2e')]));channels[_0x58fc63[_0x137d('0x7')]][_0x137d('0x2f')]=utils[_0x137d('0x1e')]();channels[_0x58fc63['uniqueid']][_0x137d('0x30')]=utils[_0x137d('0x31')](channels[_0x58fc63[_0x137d('0x7')]]['endtime'],channels[_0x58fc63[_0x137d('0x7')]][_0x137d('0x32')]);channels[_0x58fc63[_0x137d('0x7')]][_0x137d('0x33')]=channels[_0x58fc63[_0x137d('0x7')]][_0x137d('0x29')]?utils['diffTime'](channels[_0x58fc63[_0x137d('0x7')]]['endtime'],channels[_0x58fc63[_0x137d('0x7')]][_0x137d('0x29')]):0x0;writeDB(channels[_0x58fc63['uniqueid']]);}}catch(_0x47ea1f){utils[_0x137d('0x2b')](util['format'](_0x137d('0x34'),_0x58fc63[_0x137d('0x7')]),_0x47ea1f);}};exports[_0x137d('0x35')]=function(_0xa87abb){try{if(!_[_0x137d('0x22')](channels[_0xa87abb['localtwolinkedid']])){utils[_0x137d('0x16')](util[_0x137d('0x5')](_0x137d('0x36'),_0xa87abb[_0x137d('0x37')]),_0xa87abb);if(channels[_0xa87abb[_0x137d('0x38')]][_0x137d('0x8')]==_0xa87abb[_0x137d('0x39')]){utils[_0x137d('0x1a')](util[_0x137d('0x5')](_0x137d('0x3a'),_0xa87abb['origtransfereruniqueid'],_0xa87abb[_0x137d('0x38')],_0xa87abb[_0x137d('0x3b')]));channels[_0xa87abb['localtwolinkedid']][_0x137d('0x28')]=_0xa87abb[_0x137d('0x3b')];channels[_0xa87abb['localtwolinkedid']]['userfield']=_0x137d('0x3c');}else if(channels[_0xa87abb[_0x137d('0x38')]]['channel']=_0xa87abb[_0x137d('0x3d')]){utils[_0x137d('0x1a')](util[_0x137d('0x5')](_0x137d('0x3a'),_0xa87abb[_0x137d('0x37')],_0xa87abb[_0x137d('0x38')],_0xa87abb[_0x137d('0x3e')]));channels[_0xa87abb[_0x137d('0x38')]][_0x137d('0x28')]=_0xa87abb[_0x137d('0x3e')];channels[_0xa87abb[_0x137d('0x38')]][_0x137d('0x3f')]=_0x137d('0x3c');}}}catch(_0x2f730d){utils[_0x137d('0x2b')](util[_0x137d('0x5')](_0x137d('0x36'),_0xa87abb[_0x137d('0x37')]),_0x2f730d);}};exports[_0x137d('0x40')]=function(_0x2e3e38){try{if(!_[_0x137d('0x22')](channels[_0x2e3e38[_0x137d('0x7')]])){utils[_0x137d('0x16')](util[_0x137d('0x5')](_0x137d('0x41'),_0x2e3e38['uniqueid']),_0x2e3e38);channels[_0x2e3e38[_0x137d('0x7')]][_0x137d('0x42')]=utils[_0x137d('0x1e')]();utils[_0x137d('0x1a')](util['format'](_0x137d('0x43'),_0x2e3e38[_0x137d('0x7')],channels[_0x2e3e38[_0x137d('0x7')]][_0x137d('0x42')]));}}catch(_0x49ae2b){utils['error'](util[_0x137d('0x5')](_0x137d('0x41'),_0x2e3e38['uniqueid']),_0x49ae2b);}};exports[_0x137d('0x44')]=function(_0x119307){try{if(!_['isNil'](channels[_0x119307['uniqueid']])){utils[_0x137d('0x16')](util[_0x137d('0x5')](_0x137d('0x45'),_0x119307['uniqueid']),_0x119307);if(!_[_0x137d('0x22')](channels[_0x119307[_0x137d('0x7')]][_0x137d('0x42')])){channels[_0x119307[_0x137d('0x7')]][_0x137d('0x46')]+=utils[_0x137d('0x31')](utils[_0x137d('0x1e')](),channels[_0x119307[_0x137d('0x7')]][_0x137d('0x42')]);utils[_0x137d('0x1a')](util['format'](_0x137d('0x47'),_0x119307[_0x137d('0x7')],channels[_0x119307[_0x137d('0x7')]][_0x137d('0x46')]));delete channels[_0x119307[_0x137d('0x7')]]['musiconholdstartAt'];}}}catch(_0x2f1db2){utils[_0x137d('0x2b')](util[_0x137d('0x5')](_0x137d('0x45'),_0x119307['uniqueid']),_0x2f1db2);}};exports[_0x137d('0x48')]=function(_0x33feee){try{if(!_[_0x137d('0x22')](channels[_0x33feee['uniqueid']])){utils['debug'](util['format'](_0x137d('0x49'),_0x33feee[_0x137d('0x7')]),_0x33feee);if(!_[_0x137d('0x22')](_0x33feee['variable'][_0x137d('0x4a')])){utils[_0x137d('0x1a')](util[_0x137d('0x5')](_0x137d('0x4b'),_0x33feee['uniqueid'],_0x33feee[_0x137d('0x4c')]));channels[_0x33feee[_0x137d('0x7')]][_0x137d('0x4d')]=_0x33feee[_0x137d('0x4c')];}if(!_[_0x137d('0x22')](_0x33feee['variable']['xmd-phone'])){utils[_0x137d('0x1a')](util['format'](_0x137d('0x4e'),_0x33feee[_0x137d('0x7')],_0x33feee[_0x137d('0x4c')]));channels[_0x33feee[_0x137d('0x7')]]['destination']=_0x33feee[_0x137d('0x4c')];channels[_0x33feee[_0x137d('0x7')]][_0x137d('0x2c')]='\x22'+_0x33feee[_0x137d('0x4c')]+_0x137d('0x4f')+_0x33feee['value']+'>';}if(!_['isNil'](_0x33feee[_0x137d('0x50')]['xmd-callerid-preview'])||!_['isNil'](_0x33feee[_0x137d('0x50')]['xmd-callerid'])){utils[_0x137d('0x1a')](util['format'](_0x137d('0x51'),_0x33feee[_0x137d('0x7')],!_[_0x137d('0x22')](_0x33feee[_0x137d('0x50')][_0x137d('0x52')])?_0x137d('0x52'):_0x137d('0x53'),_0x33feee['value']));channels[_0x33feee[_0x137d('0x7')]][_0x137d('0x2c')]=_0x33feee[_0x137d('0x4c')];}if(!_[_0x137d('0x22')](_0x33feee[_0x137d('0x50')][_0x137d('0x54')])||!_[_0x137d('0x22')](_0x33feee[_0x137d('0x50')]['xmcs-queue'])){utils['info'](util[_0x137d('0x5')](_0x137d('0x51'),_0x33feee[_0x137d('0x7')],!_[_0x137d('0x22')](_0x33feee['variable'][_0x137d('0x54')])?'xmd-queue':'xmcs-queue',_0x33feee[_0x137d('0x4c')]));channels[_0x33feee['uniqueid']][_0x137d('0x55')]=_0x137d('0x56');channels[_0x33feee[_0x137d('0x7')]][_0x137d('0x57')]=_0x33feee[_0x137d('0x4c')];channels[_0x33feee['uniqueid']][_0x137d('0x9')]=!![];}if(!_[_0x137d('0x22')](_0x33feee[_0x137d('0x50')]['xmd-contactid'])){utils[_0x137d('0x1a')](util[_0x137d('0x5')](_0x137d('0x58'),_0x33feee[_0x137d('0x7')],_0x33feee['value']));channels[_0x33feee[_0x137d('0x7')]]['ContactId']=_0x33feee[_0x137d('0x4c')];}if(!_[_0x137d('0x22')](_0x33feee[_0x137d('0x50')][_0x137d('0x59')])){utils['info'](util[_0x137d('0x5')](_0x137d('0x5a'),_0x33feee['uniqueid'],_0x33feee[_0x137d('0x4c')]));channels[_0x33feee[_0x137d('0x7')]]['type']=_0x33feee[_0x137d('0x4c')];}if(!_[_0x137d('0x22')](_0x33feee[_0x137d('0x50')][_0x137d('0x5b')])){utils[_0x137d('0x1a')](util[_0x137d('0x5')](_0x137d('0x5c'),_0x33feee['uniqueid'],_0x33feee[_0x137d('0x4c')]));channels[_0x33feee['uniqueid']][_0x137d('0x5d')]=_0x33feee['value'];}if(!_[_0x137d('0x22')](_0x33feee[_0x137d('0x50')][_0x137d('0x5e')])){utils[_0x137d('0x1a')](util['format']('[%s][calls][varset]\x20variable:sipcallid\x20value:%s',_0x33feee[_0x137d('0x7')],_0x33feee['value']));channels[_0x33feee[_0x137d('0x7')]][_0x137d('0x5e')]=_0x33feee[_0x137d('0x4c')];}}}catch(_0x323c41){utils[_0x137d('0x2b')](util[_0x137d('0x5')](_0x137d('0x49'),_0x33feee[_0x137d('0x7')]),_0x323c41);}};exports[_0x137d('0x5f')]=function(_0x5c2fe3){try{if(!_[_0x137d('0x22')](channels[_0x5c2fe3['uniqueid']])){utils[_0x137d('0x16')](util[_0x137d('0x5')]('[%s][calls][newexten]',_0x5c2fe3[_0x137d('0x7')]),_0x5c2fe3);utils[_0x137d('0x1a')](util[_0x137d('0x5')](_0x137d('0x60'),_0x5c2fe3['uniqueid'],_0x5c2fe3[_0x137d('0x61')],_0x5c2fe3['appdata']));if(_0x5c2fe3['application'][_0x137d('0x62')]()==_0x137d('0x63')&&_[_0x137d('0x64')](_0x5c2fe3[_0x137d('0x65')]['toLowerCase'](),_0x137d('0x66'))){var _0x5cb61a=_0x5c2fe3[_0x137d('0x65')][_0x137d('0x67')]('=');var _0x598d5a=_0x5cb61a[0x0][_0x137d('0x68')](_0x5cb61a[0x0]['lastIndexOf']('(')+0x1,_0x5cb61a[0x0][_0x137d('0x69')](')'));var _0x161d53=_0x5cb61a[0x1];channels[_0x5c2fe3[_0x137d('0x7')]][_0x598d5a]=_0x161d53;}if(!_[_0x137d('0x6a')]([_0x137d('0x6b'),_0x137d('0x6c'),_0x137d('0x6d'),_0x137d('0x63'),_0x137d('0x6e')],_0x5c2fe3[_0x137d('0x61')][_0x137d('0x62')]())){channels[_0x5c2fe3[_0x137d('0x7')]][_0x137d('0x55')]=_0x5c2fe3[_0x137d('0x61')];channels[_0x5c2fe3[_0x137d('0x7')]][_0x137d('0x57')]=_0x5c2fe3[_0x137d('0x65')];}}}catch(_0x48a3f8){utils[_0x137d('0x2b')](util['format'](_0x137d('0x6f'),_0x5c2fe3['uniqueid']),_0x48a3f8);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 32d51b2..f6b9d92 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 _0x3aee=['shutdown','fullybooted','[core]\x20fullybooted','error','[core]\x20error','close','[core]\x20close','managerevent','connect','info'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3aee,0x10c));var _0xe3ae=function(_0x2aa48b,_0x5a4446){_0x2aa48b=_0x2aa48b-0x0;var _0x48caf8=_0x3aee[_0x2aa48b];return _0x48caf8;};'use strict';var utils=require('./utils');exports[_0xe3ae('0x0')]=function(){utils[_0xe3ae('0x1')]('[core]\x20connected');};exports[_0xe3ae('0x2')]=function(){utils[_0xe3ae('0x1')]('[core]\x20shutdown');};exports[_0xe3ae('0x3')]=function(){utils[_0xe3ae('0x1')](_0xe3ae('0x4'));};exports[_0xe3ae('0x5')]=function(_0x405728){utils[_0xe3ae('0x5')](_0xe3ae('0x6'),_0x405728);};exports[_0xe3ae('0x7')]=function(){utils[_0xe3ae('0x1')](_0xe3ae('0x8'));};exports[_0xe3ae('0x9')]=function(_0x2abef1){}; \ No newline at end of file +var _0x2731=['./utils','info','[core]\x20connected','shutdown','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error','close','[core]\x20close','managerevent'];(function(_0x13915f,_0x3d90c6){var _0x373181=function(_0x66a7b4){while(--_0x66a7b4){_0x13915f['push'](_0x13915f['shift']());}};_0x373181(++_0x3d90c6);}(_0x2731,0xbb));var _0x1273=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x2731[_0x4565bf];return _0x5610ba;};'use strict';var utils=require(_0x1273('0x0'));exports['connect']=function(){utils[_0x1273('0x1')](_0x1273('0x2'));};exports[_0x1273('0x3')]=function(){utils[_0x1273('0x1')](_0x1273('0x4'));};exports[_0x1273('0x5')]=function(){utils[_0x1273('0x1')](_0x1273('0x6'));};exports[_0x1273('0x7')]=function(_0x3b1e91){utils[_0x1273('0x7')]('[core]\x20error',_0x3b1e91);};exports[_0x1273('0x8')]=function(){utils[_0x1273('0x1')](_0x1273('0x9'));};exports[_0x1273('0xa')]=function(_0x49e46d){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index f2124ff..3b743a0 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 _0xcb94=['[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','error','dialbegin','isNil','[%s][dials][dialbegin]','starttime','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','ANSWER','assign','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','complete','duration','diffTime','endtime','holdtime','billableseconds','lodash','util','info','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','calleridnum','connectedlinenum','dialstatus','CreateVoiceDialReport','newexten','format','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','split','varset','debug','[%s][dials][varset]','variable','outboundrouteid'];(function(_0x59575d,_0x3c389b){var _0x4a6ad4=function(_0x49fe37){while(--_0x49fe37){_0x59575d['push'](_0x59575d['shift']());}};_0x4a6ad4(++_0x3c389b);}(_0xcb94,0xe6));var _0x4cb9=function(_0x41c4da,_0x45de59){_0x41c4da=_0x41c4da-0x0;var _0x5150db=_0xcb94[_0x41c4da];return _0x5150db;};'use strict';var _=require(_0x4cb9('0x0'));var util=require(_0x4cb9('0x1'));var utils=require('./utils');var dials={};function writeDB(_0x5d975a){utils[_0x4cb9('0x2')](util['format'](_0x4cb9('0x3'),_0x5d975a[_0x4cb9('0x4')],_0x5d975a[_0x4cb9('0x5')],_0x5d975a['dialstring'],_0x5d975a[_0x4cb9('0x6')],_0x5d975a[_0x4cb9('0x7')],_0x5d975a[_0x4cb9('0x8')]));utils['request'](_0x4cb9('0x9'),_0x5d975a);delete dials[_0x5d975a[_0x4cb9('0x4')]];}exports[_0x4cb9('0xa')]=function(_0x2360c5){try{utils['debug'](util[_0x4cb9('0xb')](_0x4cb9('0xc'),_0x2360c5[_0x4cb9('0x4')]),_0x2360c5);utils[_0x4cb9('0x2')](util['format'](_0x4cb9('0xd'),_0x2360c5[_0x4cb9('0x4')],_0x2360c5[_0x4cb9('0xe')],_0x2360c5[_0x4cb9('0xf')]));if(_0x2360c5[_0x4cb9('0xe')][_0x4cb9('0x10')]()==_0x4cb9('0x11')&&_[_0x4cb9('0x12')](_0x2360c5[_0x4cb9('0xf')][_0x4cb9('0x10')](),'cdr(routeid)')){var _0x1372aa=_0x2360c5[_0x4cb9('0xf')][_0x4cb9('0x13')]('=');dials[_0x2360c5[_0x4cb9('0x4')]]={'routeId':_0x1372aa[0x1]};}}catch(_0xd5846b){utils['error'](util[_0x4cb9('0xb')]('[%s][dials][newexten]',_0x2360c5['uniqueid']),_0xd5846b);}};exports[_0x4cb9('0x14')]=function(_0x410107){try{utils[_0x4cb9('0x15')](util[_0x4cb9('0xb')](_0x4cb9('0x16'),_0x410107[_0x4cb9('0x4')]),_0x410107);if(!_['isNil'](_0x410107[_0x4cb9('0x17')][_0x4cb9('0x18')])){utils['info'](util[_0x4cb9('0xb')](_0x4cb9('0x19'),_0x410107[_0x4cb9('0x4')],_0x410107['value']));dials[_0x410107['uniqueid']]={'routeId':_0x410107['value']};}}catch(_0x18aefe){utils[_0x4cb9('0x1a')](util['format'](_0x4cb9('0x16'),_0x410107[_0x4cb9('0x4')]),_0x18aefe);}};exports[_0x4cb9('0x1b')]=function(_0x346fad){try{if(!_[_0x4cb9('0x1c')](dials[_0x346fad[_0x4cb9('0x4')]])){utils['debug'](util[_0x4cb9('0xb')](_0x4cb9('0x1d'),_0x346fad[_0x4cb9('0x4')]),_0x346fad);dials[_0x346fad[_0x4cb9('0x4')]]=_['assign'](dials[_0x346fad['uniqueid']],_0x346fad);dials[_0x346fad[_0x4cb9('0x4')]][_0x4cb9('0x1e')]=utils[_0x4cb9('0x1f')]();dials[_0x346fad['uniqueid']][_0x4cb9('0x20')]=_0x4cb9('0x21');utils[_0x4cb9('0x2')](util[_0x4cb9('0xb')](_0x4cb9('0x22'),_0x346fad['uniqueid'],dials[_0x346fad[_0x4cb9('0x4')]][_0x4cb9('0x1e')]));}}catch(_0x56cb36){utils[_0x4cb9('0x1a')](util[_0x4cb9('0xb')](_0x4cb9('0x1d'),_0x346fad[_0x4cb9('0x4')]),_0x56cb36);}};exports['dialend']=function(_0x44592e){try{if(!_[_0x4cb9('0x1c')](dials[_0x44592e[_0x4cb9('0x4')]])){utils['debug'](util['format']('[%s][dials][dialend]',_0x44592e[_0x4cb9('0x4')]),_0x44592e);dials[_0x44592e[_0x4cb9('0x4')]][_0x4cb9('0x8')]=_0x44592e[_0x4cb9('0x8')];if(_0x44592e[_0x4cb9('0x8')]==_0x4cb9('0x23')){dials[_0x44592e['uniqueid']]=_[_0x4cb9('0x24')](dials[_0x44592e[_0x4cb9('0x4')]],_0x44592e);dials[_0x44592e[_0x4cb9('0x4')]][_0x4cb9('0x25')]=utils[_0x4cb9('0x1f')]();dials[_0x44592e[_0x4cb9('0x4')]]['lastevent']=_0x4cb9('0x26');utils['info'](util[_0x4cb9('0xb')](_0x4cb9('0x27'),_0x44592e['uniqueid'],_0x44592e[_0x4cb9('0x8')],dials[_0x44592e['uniqueid']][_0x4cb9('0x25')]));}else{utils['info'](util[_0x4cb9('0xb')](_0x4cb9('0x28'),_0x44592e[_0x4cb9('0x4')],_0x44592e[_0x4cb9('0x8')]));}}}catch(_0x567427){utils[_0x4cb9('0x1a')](util[_0x4cb9('0xb')]('[%s][dials][dialend]',_0x44592e[_0x4cb9('0x4')]),_0x567427);}};exports[_0x4cb9('0x29')]=function(_0x392479){try{if(!_[_0x4cb9('0x1c')](dials[_0x392479['uniqueid']])){utils['debug'](util[_0x4cb9('0xb')]('[%s][dials][hangup]',_0x392479['uniqueid']),_0x392479);utils[_0x4cb9('0x2')](util[_0x4cb9('0xb')](_0x4cb9('0x2a'),_0x392479[_0x4cb9('0x4')],_0x392479[_0x4cb9('0x6')],_0x392479[_0x4cb9('0x2b')],_0x392479[_0x4cb9('0x2c')]));dials[_0x392479['uniqueid']]=_[_0x4cb9('0x24')](dials[_0x392479[_0x4cb9('0x4')]],{'endtime':utils[_0x4cb9('0x1f')](),'lastevent':_0x4cb9('0x2d')});dials[_0x392479['uniqueid']][_0x4cb9('0x2e')]=utils[_0x4cb9('0x2f')](dials[_0x392479['uniqueid']][_0x4cb9('0x30')],dials[_0x392479[_0x4cb9('0x4')]]['starttime']);dials[_0x392479[_0x4cb9('0x4')]][_0x4cb9('0x31')]=utils[_0x4cb9('0x2f')](dials[_0x392479[_0x4cb9('0x4')]][_0x4cb9('0x25')]||dials[_0x392479[_0x4cb9('0x4')]][_0x4cb9('0x30')],dials[_0x392479[_0x4cb9('0x4')]]['starttime']);dials[_0x392479['uniqueid']][_0x4cb9('0x32')]=dials[_0x392479['uniqueid']]['answertime']?utils[_0x4cb9('0x2f')](dials[_0x392479['uniqueid']][_0x4cb9('0x30')],dials[_0x392479['uniqueid']][_0x4cb9('0x25')]):0x0;writeDB(dials[_0x392479[_0x4cb9('0x4')]]);}}catch(_0x1b71d3){utils[_0x4cb9('0x1a')](util[_0x4cb9('0xb')]('[%s][dials][hangup]',_0x392479['uniqueid']),_0x1b71d3);}}; \ No newline at end of file +var _0xe32b=['dialend','[%s][dials][dialend]','ANSWER','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','answertime','[%s][dials][hangup]','calleridname','cause-txt','complete','duration','endtime','holdtime','diffTime','billableseconds','util','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','channel','dialstring','calleridnum','connectedlinenum','dialstatus','request','CreateVoiceDialReport','uniqueid','newexten','debug','application','appdata','toLowerCase','set','startsWith','cdr(routeid)','error','[%s][dials][newexten]','[%s][dials][varset]','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','assign','starttime','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','[%s][dials][dialbegin]'];(function(_0x479dcd,_0x4cbb00){var _0x14ede8=function(_0x2767e5){while(--_0x2767e5){_0x479dcd['push'](_0x479dcd['shift']());}};_0x14ede8(++_0x4cbb00);}(_0xe32b,0x10e));var _0xbe32=function(_0x27d1e3,_0x3169b2){_0x27d1e3=_0x27d1e3-0x0;var _0x58049c=_0xe32b[_0x27d1e3];return _0x58049c;};'use strict';var _=require('lodash');var util=require(_0xbe32('0x0'));var utils=require('./utils');var dials={};function writeDB(_0xe32495){utils[_0xbe32('0x1')](util[_0xbe32('0x2')](_0xbe32('0x3'),_0xe32495['uniqueid'],_0xe32495[_0xbe32('0x4')],_0xe32495[_0xbe32('0x5')],_0xe32495[_0xbe32('0x6')],_0xe32495[_0xbe32('0x7')],_0xe32495[_0xbe32('0x8')]));utils[_0xbe32('0x9')](_0xbe32('0xa'),_0xe32495);delete dials[_0xe32495[_0xbe32('0xb')]];}exports[_0xbe32('0xc')]=function(_0x4df7ad){try{utils[_0xbe32('0xd')](util[_0xbe32('0x2')]('[%s][dials][newexten]',_0x4df7ad['uniqueid']),_0x4df7ad);utils[_0xbe32('0x1')](util[_0xbe32('0x2')]('[%s][dials][newexten]\x20application:%s\x20appdata:%s',_0x4df7ad[_0xbe32('0xb')],_0x4df7ad[_0xbe32('0xe')],_0x4df7ad[_0xbe32('0xf')]));if(_0x4df7ad[_0xbe32('0xe')][_0xbe32('0x10')]()==_0xbe32('0x11')&&_[_0xbe32('0x12')](_0x4df7ad['appdata'][_0xbe32('0x10')](),_0xbe32('0x13'))){var _0x4e6694=_0x4df7ad[_0xbe32('0xf')]['split']('=');dials[_0x4df7ad[_0xbe32('0xb')]]={'routeId':_0x4e6694[0x1]};}}catch(_0x432b00){utils[_0xbe32('0x14')](util[_0xbe32('0x2')](_0xbe32('0x15'),_0x4df7ad['uniqueid']),_0x432b00);}};exports['varset']=function(_0x5ad470){try{utils[_0xbe32('0xd')](util[_0xbe32('0x2')](_0xbe32('0x16'),_0x5ad470[_0xbe32('0xb')]),_0x5ad470);if(!_[_0xbe32('0x17')](_0x5ad470[_0xbe32('0x18')][_0xbe32('0x19')])){utils[_0xbe32('0x1')](util[_0xbe32('0x2')](_0xbe32('0x1a'),_0x5ad470[_0xbe32('0xb')],_0x5ad470[_0xbe32('0x1b')]));dials[_0x5ad470['uniqueid']]={'routeId':_0x5ad470['value']};}}catch(_0x4ee639){utils['error'](util[_0xbe32('0x2')](_0xbe32('0x16'),_0x5ad470[_0xbe32('0xb')]),_0x4ee639);}};exports[_0xbe32('0x1c')]=function(_0x3f00bc){try{if(!_[_0xbe32('0x17')](dials[_0x3f00bc[_0xbe32('0xb')]])){utils[_0xbe32('0xd')](util[_0xbe32('0x2')]('[%s][dials][dialbegin]',_0x3f00bc[_0xbe32('0xb')]),_0x3f00bc);dials[_0x3f00bc[_0xbe32('0xb')]]=_[_0xbe32('0x1d')](dials[_0x3f00bc[_0xbe32('0xb')]],_0x3f00bc);dials[_0x3f00bc[_0xbe32('0xb')]][_0xbe32('0x1e')]=utils[_0xbe32('0x1f')]();dials[_0x3f00bc[_0xbe32('0xb')]][_0xbe32('0x20')]=_0xbe32('0x21');utils[_0xbe32('0x1')](util['format'](_0xbe32('0x22'),_0x3f00bc[_0xbe32('0xb')],dials[_0x3f00bc['uniqueid']][_0xbe32('0x1e')]));}}catch(_0x824268){utils['error'](util[_0xbe32('0x2')](_0xbe32('0x23'),_0x3f00bc[_0xbe32('0xb')]),_0x824268);}};exports[_0xbe32('0x24')]=function(_0x511848){try{if(!_[_0xbe32('0x17')](dials[_0x511848[_0xbe32('0xb')]])){utils[_0xbe32('0xd')](util[_0xbe32('0x2')](_0xbe32('0x25'),_0x511848[_0xbe32('0xb')]),_0x511848);dials[_0x511848['uniqueid']]['dialstatus']=_0x511848[_0xbe32('0x8')];if(_0x511848['dialstatus']==_0xbe32('0x26')){dials[_0x511848[_0xbe32('0xb')]]=_[_0xbe32('0x1d')](dials[_0x511848[_0xbe32('0xb')]],_0x511848);dials[_0x511848[_0xbe32('0xb')]]['answertime']=utils[_0xbe32('0x1f')]();dials[_0x511848[_0xbe32('0xb')]][_0xbe32('0x20')]=_0xbe32('0x27');utils[_0xbe32('0x1')](util[_0xbe32('0x2')](_0xbe32('0x28'),_0x511848[_0xbe32('0xb')],_0x511848[_0xbe32('0x8')],dials[_0x511848[_0xbe32('0xb')]][_0xbe32('0x29')]));}else{utils[_0xbe32('0x1')](util[_0xbe32('0x2')]('[%s][dials][dialend]\x20dialstatus:%s',_0x511848[_0xbe32('0xb')],_0x511848['dialstatus']));}}}catch(_0x7b0ea3){utils['error'](util[_0xbe32('0x2')](_0xbe32('0x25'),_0x511848['uniqueid']),_0x7b0ea3);}};exports['hangup']=function(_0x5c5259){try{if(!_['isNil'](dials[_0x5c5259[_0xbe32('0xb')]])){utils['debug'](util[_0xbe32('0x2')](_0xbe32('0x2a'),_0x5c5259['uniqueid']),_0x5c5259);utils[_0xbe32('0x1')](util[_0xbe32('0x2')]('[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s',_0x5c5259['uniqueid'],_0x5c5259[_0xbe32('0x6')],_0x5c5259[_0xbe32('0x2b')],_0x5c5259[_0xbe32('0x2c')]));dials[_0x5c5259['uniqueid']]=_[_0xbe32('0x1d')](dials[_0x5c5259[_0xbe32('0xb')]],{'endtime':utils['now'](),'lastevent':_0xbe32('0x2d')});dials[_0x5c5259[_0xbe32('0xb')]][_0xbe32('0x2e')]=utils['diffTime'](dials[_0x5c5259[_0xbe32('0xb')]][_0xbe32('0x2f')],dials[_0x5c5259['uniqueid']][_0xbe32('0x1e')]);dials[_0x5c5259[_0xbe32('0xb')]][_0xbe32('0x30')]=utils[_0xbe32('0x31')](dials[_0x5c5259[_0xbe32('0xb')]][_0xbe32('0x29')]||dials[_0x5c5259[_0xbe32('0xb')]][_0xbe32('0x2f')],dials[_0x5c5259['uniqueid']][_0xbe32('0x1e')]);dials[_0x5c5259[_0xbe32('0xb')]][_0xbe32('0x32')]=dials[_0x5c5259['uniqueid']][_0xbe32('0x29')]?utils[_0xbe32('0x31')](dials[_0x5c5259[_0xbe32('0xb')]]['endtime'],dials[_0x5c5259[_0xbe32('0xb')]][_0xbe32('0x29')]):0x0;writeDB(dials[_0x5c5259[_0xbe32('0xb')]]);}}catch(_0x599c92){utils[_0xbe32('0x14')](util[_0xbe32('0x2')](_0xbe32('0x2a'),_0x5c5259[_0xbe32('0xb')]),_0x599c92);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 6c3b4d1..0476b2c 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 _0xefb7=['devicestatechange','debug','format','[%s][index][devicestatechange]','device','[%s][index][agentcalled]','agentcalled','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','[%s][index][queuecallerleave]','queuecallerleave','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','dialend','[%s][index][dialend]','../../config/environment','./utils','util','xdr','disabled','env','production','asterisk','port','username','keepConnected','info','XDR\x20DISABLED','Asterisk\x20disabled\x20on\x20localhost','./calls.controller','./members.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent'];(function(_0x3485ac,_0x53aeec){var _0x14f988=function(_0x307488){while(--_0x307488){_0x3485ac['push'](_0x3485ac['shift']());}};_0x14f988(++_0x53aeec);}(_0xefb7,0xf8));var _0x7efb=function(_0x3bab09,_0x217c29){_0x3bab09=_0x3bab09-0x0;var _0x164376=_0xefb7[_0x3bab09];return _0x164376;};var AsteriskManager=require('asterisk-manager');var config=require(_0x7efb('0x0'));var utils=require(_0x7efb('0x1'));var util=require(_0x7efb('0x2'));var isXDREnabled=config[_0x7efb('0x3')]&&config[_0x7efb('0x3')][_0x7efb('0x4')]?!config[_0x7efb('0x3')][_0x7efb('0x4')]:!![];var isProduction=config[_0x7efb('0x5')]===_0x7efb('0x6')||![];var isLocalAsterisk=config[_0x7efb('0x3')]&&config[_0x7efb('0x3')]['local']===!![]||![];var ami=new AsteriskManager(config[_0x7efb('0x7')][_0x7efb('0x8')],config[_0x7efb('0x7')]['ip'],config['asterisk'][_0x7efb('0x9')],config[_0x7efb('0x7')]['password'],!![]);ami[_0x7efb('0xa')]();if(!isXDREnabled){utils[_0x7efb('0xb')](_0x7efb('0xc'));}else if(!isProduction&&!isLocalAsterisk){utils[_0x7efb('0xb')](_0x7efb('0xd'));}else{var agents=require('./agents.controller');var calls=require(_0x7efb('0xe'));var queues=require('./queues.controller');var recordings=require('./recordings.controller');var members=require(_0x7efb('0xf'));var dials=require('./dials.controller');var transfers=require(_0x7efb('0x10'));var core=require(_0x7efb('0x11'));ami['on'](_0x7efb('0x12'),core[_0x7efb('0x12')]);ami['on'](_0x7efb('0x13'),core[_0x7efb('0x13')]);ami['on'](_0x7efb('0x14'),core['fullybooted']);ami['on'](_0x7efb('0x15'),core['error']);ami['on'](_0x7efb('0x16'),core[_0x7efb('0x16')]);ami['on'](_0x7efb('0x17'),core[_0x7efb('0x17')]);ami['on'](_0x7efb('0x18'),function(_0xfc5711){try{utils[_0x7efb('0x19')](util[_0x7efb('0x1a')](_0x7efb('0x1b'),_0xfc5711['device']),_0xfc5711);members[_0x7efb('0x18')](_0xfc5711);}catch(_0x39c558){utils[_0x7efb('0x15')](util[_0x7efb('0x1a')](_0x7efb('0x1b'),_0xfc5711[_0x7efb('0x1c')]),_0x39c558);}});ami['on']('agentcalled',function(_0x1ac1fc){try{utils[_0x7efb('0x19')](util[_0x7efb('0x1a')](_0x7efb('0x1d'),_0x1ac1fc['uniqueid']),_0x1ac1fc);agents[_0x7efb('0x1e')](_0x1ac1fc);}catch(_0x114861){utils[_0x7efb('0x15')](util['format']('[%s][index][agentcalled]',_0x1ac1fc[_0x7efb('0x1f')]),_0x114861);}});ami['on'](_0x7efb('0x20'),function(_0x2d1b3b){try{utils[_0x7efb('0x19')](util[_0x7efb('0x1a')](_0x7efb('0x21'),_0x2d1b3b[_0x7efb('0x1f')]),_0x2d1b3b);agents[_0x7efb('0x20')](_0x2d1b3b);}catch(_0x485590){utils[_0x7efb('0x15')](util[_0x7efb('0x1a')](_0x7efb('0x21'),_0x2d1b3b['uniqueid']),_0x485590);}});ami['on'](_0x7efb('0x22'),function(_0x5a515e){try{utils['debug'](util[_0x7efb('0x1a')]('[%s][index][agentconnect]',_0x5a515e[_0x7efb('0x1f')]),_0x5a515e);agents[_0x7efb('0x22')](_0x5a515e);queues['agentconnect'](_0x5a515e);}catch(_0xb30d22){utils[_0x7efb('0x15')](util[_0x7efb('0x1a')](_0x7efb('0x23'),_0x5a515e[_0x7efb('0x1f')]),_0xb30d22);}});ami['on'](_0x7efb('0x24'),function(_0x5a3255){try{utils['debug'](util['format']('[%s][index][agentcomplete]',_0x5a3255[_0x7efb('0x1f')]),_0x5a3255);agents[_0x7efb('0x24')](_0x5a3255);queues['agentcomplete'](_0x5a3255);members[_0x7efb('0x24')](_0x5a3255);}catch(_0x121219){utils[_0x7efb('0x15')](util['format'](_0x7efb('0x25'),_0x5a3255['uniqueid']),_0x121219);}});ami['on']('queuecallerabandon',function(_0x5f40a7){try{utils[_0x7efb('0x19')](util[_0x7efb('0x1a')]('[%s][index][queuecallerabandon]',_0x5f40a7[_0x7efb('0x1f')]),_0x5f40a7);agents[_0x7efb('0x26')](_0x5f40a7);queues[_0x7efb('0x26')](_0x5f40a7);}catch(_0x211b6b){utils['error'](util[_0x7efb('0x1a')](_0x7efb('0x27'),_0x5f40a7[_0x7efb('0x1f')]),_0x211b6b);}});ami['on'](_0x7efb('0x28'),function(_0x41d570){try{utils[_0x7efb('0x19')](util['format'](_0x7efb('0x29'),_0x41d570[_0x7efb('0x1f')]),_0x41d570);queues[_0x7efb('0x28')](_0x41d570);recordings[_0x7efb('0x28')](_0x41d570);}catch(_0x3f409c){utils[_0x7efb('0x15')](util[_0x7efb('0x1a')](_0x7efb('0x29'),_0x41d570[_0x7efb('0x1f')]),_0x3f409c);}});ami['on']('queuecallerleave',function(_0x462d79){try{utils[_0x7efb('0x19')](util['format'](_0x7efb('0x2a'),_0x462d79[_0x7efb('0x1f')]),_0x462d79);queues[_0x7efb('0x2b')](_0x462d79);}catch(_0x5aee3d){utils[_0x7efb('0x15')](util['format'](_0x7efb('0x2a'),_0x462d79[_0x7efb('0x1f')]),_0x5aee3d);}});ami['on'](_0x7efb('0x2c'),function(_0x18b8b1){try{utils['debug'](util[_0x7efb('0x1a')](_0x7efb('0x2d'),_0x18b8b1[_0x7efb('0x1f')]),_0x18b8b1);queues[_0x7efb('0x2c')](_0x18b8b1);calls[_0x7efb('0x2c')](_0x18b8b1);}catch(_0x151545){utils['error'](util[_0x7efb('0x1a')](_0x7efb('0x2d'),_0x18b8b1['uniqueid']),_0x151545);}});ami['on'](_0x7efb('0x2e'),function(_0xfd7aa){try{utils[_0x7efb('0x19')](util[_0x7efb('0x1a')]('[%s][index][musiconholdstop]',_0xfd7aa[_0x7efb('0x1f')]),_0xfd7aa);queues[_0x7efb('0x2e')](_0xfd7aa);calls[_0x7efb('0x2e')](_0xfd7aa);}catch(_0x7d5c22){utils[_0x7efb('0x15')](util[_0x7efb('0x1a')](_0x7efb('0x2f'),_0xfd7aa[_0x7efb('0x1f')]),_0x7d5c22);}});ami['on'](_0x7efb('0x30'),function(_0x41cfd1){try{utils[_0x7efb('0x19')](util['format'](_0x7efb('0x31'),_0x41cfd1[_0x7efb('0x1f')]),_0x41cfd1);calls[_0x7efb('0x30')](_0x41cfd1);recordings[_0x7efb('0x30')](_0x41cfd1);}catch(_0x3124c2){utils['error'](util[_0x7efb('0x1a')](_0x7efb('0x31'),_0x41cfd1[_0x7efb('0x1f')]),_0x3124c2);}});ami['on'](_0x7efb('0x32'),function(_0x26d308){try{utils[_0x7efb('0x19')](util[_0x7efb('0x1a')]('[%s][index][hangup]',_0x26d308[_0x7efb('0x1f')]),_0x26d308);calls[_0x7efb('0x32')](_0x26d308);recordings[_0x7efb('0x32')](_0x26d308);dials[_0x7efb('0x32')](_0x26d308);agents[_0x7efb('0x32')](_0x26d308);queues[_0x7efb('0x32')](_0x26d308);}catch(_0x1f16ce){utils[_0x7efb('0x15')](util[_0x7efb('0x1a')]('[%s][index][hangup]',_0x26d308[_0x7efb('0x1f')]),_0x1f16ce);}});ami['on']('cdr',function(_0x103c14){try{utils['debug'](util[_0x7efb('0x1a')]('[%s][index][cdr]',_0x103c14[_0x7efb('0x1f')]),_0x103c14);members[_0x7efb('0x33')](_0x103c14);}catch(_0x32a9b6){utils[_0x7efb('0x15')](util['format'](_0x7efb('0x34'),_0x103c14[_0x7efb('0x1f')]),_0x32a9b6);}});ami['on'](_0x7efb('0x35'),function(_0x21a70f){try{utils[_0x7efb('0x19')](util[_0x7efb('0x1a')]('[%s][index][blindtransfer]',_0x21a70f['uniqueid']),_0x21a70f);queues[_0x7efb('0x35')](_0x21a70f);agents[_0x7efb('0x35')](_0x21a70f);transfers[_0x7efb('0x35')](_0x21a70f);}catch(_0x5630b1){utils[_0x7efb('0x15')](util[_0x7efb('0x1a')](_0x7efb('0x36'),_0x21a70f[_0x7efb('0x1f')]),_0x5630b1);}});ami['on'](_0x7efb('0x37'),function(_0x28a703){try{utils['debug'](util[_0x7efb('0x1a')](_0x7efb('0x38'),_0x28a703[_0x7efb('0x39')]),_0x28a703);queues[_0x7efb('0x37')](_0x28a703);transfers[_0x7efb('0x37')](_0x28a703);agents[_0x7efb('0x37')](_0x28a703);calls[_0x7efb('0x37')](_0x28a703);}catch(_0x43f882){utils[_0x7efb('0x15')](util[_0x7efb('0x1a')]('[%s][index][attendedtransfer]',_0x28a703[_0x7efb('0x39')]),_0x43f882);}});ami['on'](_0x7efb('0x3a'),function(_0x270f98){try{utils[_0x7efb('0x19')](util[_0x7efb('0x1a')](_0x7efb('0x3b'),_0x270f98['uniqueid']),_0x270f98);queues[_0x7efb('0x3a')](_0x270f98);recordings[_0x7efb('0x3a')](_0x270f98);calls[_0x7efb('0x3a')](_0x270f98);dials[_0x7efb('0x3a')](_0x270f98);}catch(_0x2f63a7){utils[_0x7efb('0x15')](util[_0x7efb('0x1a')](_0x7efb('0x3b'),_0x270f98[_0x7efb('0x1f')]),_0x2f63a7);}});ami['on'](_0x7efb('0x3c'),function(_0x5d0ea3){try{utils[_0x7efb('0x19')](util['format'](_0x7efb('0x3d'),_0x5d0ea3[_0x7efb('0x1f')]),_0x5d0ea3);calls[_0x7efb('0x3c')](_0x5d0ea3);recordings[_0x7efb('0x3c')](_0x5d0ea3);dials[_0x7efb('0x3c')](_0x5d0ea3);}catch(_0x7c63a5){utils['error'](util[_0x7efb('0x1a')](_0x7efb('0x3d'),_0x5d0ea3[_0x7efb('0x1f')]),_0x7c63a5);}});ami['on'](_0x7efb('0x3e'),function(_0x34c4ef){try{utils[_0x7efb('0x19')](util['format'](_0x7efb('0x3f'),_0x34c4ef[_0x7efb('0x1f')]),_0x34c4ef);calls[_0x7efb('0x3e')](_0x34c4ef);recordings[_0x7efb('0x3e')](_0x34c4ef);}catch(_0x1c10cb){utils[_0x7efb('0x15')](util[_0x7efb('0x1a')](_0x7efb('0x3f'),_0x34c4ef[_0x7efb('0x1f')]),_0x1c10cb);}});ami['on'](_0x7efb('0x40'),function(_0xde65cd){try{utils[_0x7efb('0x19')](util['format'](_0x7efb('0x41'),_0xde65cd[_0x7efb('0x1f')]),_0xde65cd);dials['dialbegin'](_0xde65cd);}catch(_0x4c359c){utils[_0x7efb('0x15')](util[_0x7efb('0x1a')]('[%s]dialbegin',_0xde65cd[_0x7efb('0x1f')]),_0x4c359c);}});ami['on'](_0x7efb('0x42'),function(_0x64b8ce){try{utils[_0x7efb('0x19')](util[_0x7efb('0x1a')](_0x7efb('0x43'),_0x64b8ce['uniqueid']),_0x64b8ce);dials[_0x7efb('0x42')](_0x64b8ce);}catch(_0x462fb3){utils[_0x7efb('0x15')](util[_0x7efb('0x1a')](_0x7efb('0x43'),_0x64b8ce['uniqueid']),_0x462fb3);}});} \ No newline at end of file +var _0x2abe=['device','agentcalled','[%s][index][agentcalled]','uniqueid','[%s][index][agentringnoanswer]','agentringnoanswer','[%s][index][agentconnect]','agentconnect','[%s][index][agentcomplete]','agentcomplete','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','[%s][index][newstate]','newstate','[%s][index][hangup]','hangup','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','origtransfereruniqueid','[%s][index][attendedtransfer]','[%s][index][varset]','varset','[%s][index][newexten]','newexten','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','asterisk-manager','../../config/environment','./utils','util','xdr','disabled','production','local','asterisk','port','password','XDR\x20DISABLED','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./calls.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]'];(function(_0x56260c,_0x3594bc){var _0x3293b9=function(_0x3e1744){while(--_0x3e1744){_0x56260c['push'](_0x56260c['shift']());}};_0x3293b9(++_0x3594bc);}(_0x2abe,0xaf));var _0xe2ab=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x2abe[_0x4b369d];return _0x571a98;};var AsteriskManager=require(_0xe2ab('0x0'));var config=require(_0xe2ab('0x1'));var utils=require(_0xe2ab('0x2'));var util=require(_0xe2ab('0x3'));var isXDREnabled=config[_0xe2ab('0x4')]&&config[_0xe2ab('0x4')]['disabled']?!config[_0xe2ab('0x4')][_0xe2ab('0x5')]:!![];var isProduction=config['env']===_0xe2ab('0x6')||![];var isLocalAsterisk=config['xdr']&&config[_0xe2ab('0x4')][_0xe2ab('0x7')]===!![]||![];var ami=new AsteriskManager(config[_0xe2ab('0x8')][_0xe2ab('0x9')],config['asterisk']['ip'],config[_0xe2ab('0x8')]['username'],config['asterisk'][_0xe2ab('0xa')],!![]);ami['keepConnected']();if(!isXDREnabled){utils['info'](_0xe2ab('0xb'));}else if(!isProduction&&!isLocalAsterisk){utils['info'](_0xe2ab('0xc'));}else{var agents=require(_0xe2ab('0xd'));var calls=require(_0xe2ab('0xe'));var queues=require('./queues.controller');var recordings=require(_0xe2ab('0xf'));var members=require(_0xe2ab('0x10'));var dials=require(_0xe2ab('0x11'));var transfers=require(_0xe2ab('0x12'));var core=require('./core.controller');ami['on']('connect',core[_0xe2ab('0x13')]);ami['on'](_0xe2ab('0x14'),core[_0xe2ab('0x14')]);ami['on'](_0xe2ab('0x15'),core[_0xe2ab('0x15')]);ami['on'](_0xe2ab('0x16'),core['error']);ami['on'](_0xe2ab('0x17'),core[_0xe2ab('0x17')]);ami['on'](_0xe2ab('0x18'),core[_0xe2ab('0x18')]);ami['on'](_0xe2ab('0x19'),function(_0xca31a){try{utils[_0xe2ab('0x1a')](util[_0xe2ab('0x1b')](_0xe2ab('0x1c'),_0xca31a[_0xe2ab('0x1d')]),_0xca31a);members['devicestatechange'](_0xca31a);}catch(_0x479ab4){utils[_0xe2ab('0x16')](util[_0xe2ab('0x1b')](_0xe2ab('0x1c'),_0xca31a[_0xe2ab('0x1d')]),_0x479ab4);}});ami['on'](_0xe2ab('0x1e'),function(_0x8adeae){try{utils[_0xe2ab('0x1a')](util[_0xe2ab('0x1b')](_0xe2ab('0x1f'),_0x8adeae[_0xe2ab('0x20')]),_0x8adeae);agents[_0xe2ab('0x1e')](_0x8adeae);}catch(_0x5e067a){utils[_0xe2ab('0x16')](util[_0xe2ab('0x1b')](_0xe2ab('0x1f'),_0x8adeae[_0xe2ab('0x20')]),_0x5e067a);}});ami['on']('agentringnoanswer',function(_0x339d9d){try{utils[_0xe2ab('0x1a')](util[_0xe2ab('0x1b')](_0xe2ab('0x21'),_0x339d9d['uniqueid']),_0x339d9d);agents[_0xe2ab('0x22')](_0x339d9d);}catch(_0x3adc19){utils[_0xe2ab('0x16')](util[_0xe2ab('0x1b')](_0xe2ab('0x21'),_0x339d9d[_0xe2ab('0x20')]),_0x3adc19);}});ami['on']('agentconnect',function(_0x4e26eb){try{utils[_0xe2ab('0x1a')](util[_0xe2ab('0x1b')](_0xe2ab('0x23'),_0x4e26eb[_0xe2ab('0x20')]),_0x4e26eb);agents[_0xe2ab('0x24')](_0x4e26eb);queues['agentconnect'](_0x4e26eb);}catch(_0x5bc0c3){utils['error'](util[_0xe2ab('0x1b')](_0xe2ab('0x23'),_0x4e26eb['uniqueid']),_0x5bc0c3);}});ami['on']('agentcomplete',function(_0x2363e3){try{utils[_0xe2ab('0x1a')](util['format'](_0xe2ab('0x25'),_0x2363e3[_0xe2ab('0x20')]),_0x2363e3);agents[_0xe2ab('0x26')](_0x2363e3);queues[_0xe2ab('0x26')](_0x2363e3);members[_0xe2ab('0x26')](_0x2363e3);}catch(_0x25573a){utils[_0xe2ab('0x16')](util[_0xe2ab('0x1b')](_0xe2ab('0x25'),_0x2363e3[_0xe2ab('0x20')]),_0x25573a);}});ami['on'](_0xe2ab('0x27'),function(_0x541c5d){try{utils['debug'](util['format'](_0xe2ab('0x28'),_0x541c5d['uniqueid']),_0x541c5d);agents[_0xe2ab('0x27')](_0x541c5d);queues[_0xe2ab('0x27')](_0x541c5d);}catch(_0xdf88af){utils[_0xe2ab('0x16')](util['format'](_0xe2ab('0x28'),_0x541c5d[_0xe2ab('0x20')]),_0xdf88af);}});ami['on']('queuecallerjoin',function(_0x2e4804){try{utils[_0xe2ab('0x1a')](util[_0xe2ab('0x1b')]('[%s][index][queuecallerjoin]',_0x2e4804['uniqueid']),_0x2e4804);queues[_0xe2ab('0x29')](_0x2e4804);recordings['queuecallerjoin'](_0x2e4804);}catch(_0x23bcfe){utils[_0xe2ab('0x16')](util['format']('[%s][index][queuecallerjoin]',_0x2e4804['uniqueid']),_0x23bcfe);}});ami['on']('queuecallerleave',function(_0x128ce3){try{utils[_0xe2ab('0x1a')](util[_0xe2ab('0x1b')](_0xe2ab('0x2a'),_0x128ce3['uniqueid']),_0x128ce3);queues['queuecallerleave'](_0x128ce3);}catch(_0x34f341){utils[_0xe2ab('0x16')](util[_0xe2ab('0x1b')](_0xe2ab('0x2a'),_0x128ce3[_0xe2ab('0x20')]),_0x34f341);}});ami['on'](_0xe2ab('0x2b'),function(_0x3cd942){try{utils[_0xe2ab('0x1a')](util[_0xe2ab('0x1b')](_0xe2ab('0x2c'),_0x3cd942['uniqueid']),_0x3cd942);queues[_0xe2ab('0x2b')](_0x3cd942);calls[_0xe2ab('0x2b')](_0x3cd942);}catch(_0x4a10ce){utils[_0xe2ab('0x16')](util['format']('[%s][index][musiconholdstart]',_0x3cd942['uniqueid']),_0x4a10ce);}});ami['on'](_0xe2ab('0x2d'),function(_0x3ad3b9){try{utils[_0xe2ab('0x1a')](util['format'](_0xe2ab('0x2e'),_0x3ad3b9['uniqueid']),_0x3ad3b9);queues[_0xe2ab('0x2d')](_0x3ad3b9);calls[_0xe2ab('0x2d')](_0x3ad3b9);}catch(_0x4992b0){utils[_0xe2ab('0x16')](util[_0xe2ab('0x1b')]('[%s][index][musiconholdstop]',_0x3ad3b9[_0xe2ab('0x20')]),_0x4992b0);}});ami['on']('newstate',function(_0x445bcc){try{utils[_0xe2ab('0x1a')](util[_0xe2ab('0x1b')](_0xe2ab('0x2f'),_0x445bcc[_0xe2ab('0x20')]),_0x445bcc);calls[_0xe2ab('0x30')](_0x445bcc);recordings[_0xe2ab('0x30')](_0x445bcc);}catch(_0x1e8570){utils[_0xe2ab('0x16')](util[_0xe2ab('0x1b')](_0xe2ab('0x2f'),_0x445bcc[_0xe2ab('0x20')]),_0x1e8570);}});ami['on']('hangup',function(_0x16fe6b){try{utils[_0xe2ab('0x1a')](util[_0xe2ab('0x1b')](_0xe2ab('0x31'),_0x16fe6b[_0xe2ab('0x20')]),_0x16fe6b);calls[_0xe2ab('0x32')](_0x16fe6b);recordings['hangup'](_0x16fe6b);dials[_0xe2ab('0x32')](_0x16fe6b);agents[_0xe2ab('0x32')](_0x16fe6b);queues['hangup'](_0x16fe6b);}catch(_0x202d71){utils[_0xe2ab('0x16')](util[_0xe2ab('0x1b')]('[%s][index][hangup]',_0x16fe6b['uniqueid']),_0x202d71);}});ami['on'](_0xe2ab('0x33'),function(_0x5964d2){try{utils[_0xe2ab('0x1a')](util['format'](_0xe2ab('0x34'),_0x5964d2['uniqueid']),_0x5964d2);members['cdr'](_0x5964d2);}catch(_0x52a669){utils[_0xe2ab('0x16')](util[_0xe2ab('0x1b')](_0xe2ab('0x34'),_0x5964d2[_0xe2ab('0x20')]),_0x52a669);}});ami['on'](_0xe2ab('0x35'),function(_0x85b46){try{utils['debug'](util[_0xe2ab('0x1b')](_0xe2ab('0x36'),_0x85b46[_0xe2ab('0x20')]),_0x85b46);queues['blindtransfer'](_0x85b46);agents[_0xe2ab('0x35')](_0x85b46);transfers[_0xe2ab('0x35')](_0x85b46);}catch(_0x1fc366){utils[_0xe2ab('0x16')](util[_0xe2ab('0x1b')](_0xe2ab('0x36'),_0x85b46[_0xe2ab('0x20')]),_0x1fc366);}});ami['on'](_0xe2ab('0x37'),function(_0x3660c2){try{utils[_0xe2ab('0x1a')](util[_0xe2ab('0x1b')]('[%s][index][attendedtransfer]',_0x3660c2[_0xe2ab('0x38')]),_0x3660c2);queues[_0xe2ab('0x37')](_0x3660c2);transfers['attendedtransfer'](_0x3660c2);agents['attendedtransfer'](_0x3660c2);calls[_0xe2ab('0x37')](_0x3660c2);}catch(_0x385210){utils[_0xe2ab('0x16')](util['format'](_0xe2ab('0x39'),_0x3660c2[_0xe2ab('0x38')]),_0x385210);}});ami['on']('varset',function(_0x557174){try{utils[_0xe2ab('0x1a')](util['format'](_0xe2ab('0x3a'),_0x557174[_0xe2ab('0x20')]),_0x557174);queues['varset'](_0x557174);recordings[_0xe2ab('0x3b')](_0x557174);calls[_0xe2ab('0x3b')](_0x557174);dials['varset'](_0x557174);}catch(_0xeffbf3){utils[_0xe2ab('0x16')](util[_0xe2ab('0x1b')](_0xe2ab('0x3a'),_0x557174[_0xe2ab('0x20')]),_0xeffbf3);}});ami['on']('newexten',function(_0xa7e68f){try{utils[_0xe2ab('0x1a')](util[_0xe2ab('0x1b')](_0xe2ab('0x3c'),_0xa7e68f[_0xe2ab('0x20')]),_0xa7e68f);calls[_0xe2ab('0x3d')](_0xa7e68f);recordings[_0xe2ab('0x3d')](_0xa7e68f);dials[_0xe2ab('0x3d')](_0xa7e68f);}catch(_0x20c5fa){utils[_0xe2ab('0x16')](util[_0xe2ab('0x1b')](_0xe2ab('0x3c'),_0xa7e68f[_0xe2ab('0x20')]),_0x20c5fa);}});ami['on'](_0xe2ab('0x3e'),function(_0x1fdd1d){try{utils[_0xe2ab('0x1a')](util['format']('[%s][index][newchannel]',_0x1fdd1d[_0xe2ab('0x20')]),_0x1fdd1d);calls['newchannel'](_0x1fdd1d);recordings[_0xe2ab('0x3e')](_0x1fdd1d);}catch(_0xe5be44){utils[_0xe2ab('0x16')](util[_0xe2ab('0x1b')](_0xe2ab('0x3f'),_0x1fdd1d['uniqueid']),_0xe5be44);}});ami['on'](_0xe2ab('0x40'),function(_0x3a6822){try{utils['debug'](util['format'](_0xe2ab('0x41'),_0x3a6822['uniqueid']),_0x3a6822);dials[_0xe2ab('0x40')](_0x3a6822);}catch(_0x148122){utils[_0xe2ab('0x16')](util['format'](_0xe2ab('0x42'),_0x3a6822[_0xe2ab('0x20')]),_0x148122);}});ami['on'](_0xe2ab('0x43'),function(_0x2491cc){try{utils[_0xe2ab('0x1a')](util[_0xe2ab('0x1b')]('[%s][index][dialend]',_0x2491cc[_0xe2ab('0x20')]),_0x2491cc);dials[_0xe2ab('0x43')](_0x2491cc);}catch(_0x28d45c){utils[_0xe2ab('0x16')](util[_0xe2ab('0x1b')]('[%s][index][dialend]',_0x2491cc[_0xe2ab('0x20')]),_0x28d45c);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 9f3e5e8..62595b8 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 _0x82aa=['info','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','membername','type','getUserByInterface','then','name','internal','request','CreateMemberReport','getUserByName','catch','error','format','some','startsWith','devicestatechange','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','voice','agent','NOT_INUSE','isNil','now','diffTime','exitAt','agentcomplete','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','cdr','[%s][members][cdr]','split','assign','data1','data2','source','data3','destination','destinationchannel','lodash','util','./utils','Local/_attended@transfer','Queue:'];(function(_0x4c06e1,_0x415efa){var _0x4df943=function(_0x242613){while(--_0x242613){_0x4c06e1['push'](_0x4c06e1['shift']());}};_0x4df943(++_0x415efa);}(_0x82aa,0xff));var _0xa82a=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x82aa[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0xa82a('0x0'));var util=require(_0xa82a('0x1'));var utils=require(_0xa82a('0x2'));var members={};var exclude=[_0xa82a('0x3'),_0xa82a('0x4')];function writeDB(_0x186919){utils[_0xa82a('0x5')](util['format'](_0xa82a('0x6'),_0x186919[_0xa82a('0x7')],_0x186919[_0xa82a('0x8')],_0x186919[_0xa82a('0x9')],_0x186919['data2'],_0x186919[_0xa82a('0xa')],_0x186919[_0xa82a('0xb')]));if(_0x186919[_0xa82a('0x8')]){utils[_0xa82a('0xc')](_0x186919[_0xa82a('0x8')])[_0xa82a('0xd')](function(_0x50c59f){if(_0x50c59f){_0x186919['membername']=_0x50c59f[_0xa82a('0xe')];_0x186919[_0xa82a('0xf')]=_0x50c59f[_0xa82a('0xf')];utils[_0xa82a('0x10')](_0xa82a('0x11'),_0x186919);}else{utils[_0xa82a('0x12')](_0x186919[_0xa82a('0x8')]['split']('/')[0x1])['then'](function(_0x56d068){if(_0x56d068){_0x186919[_0xa82a('0xa')]=_0x56d068[_0xa82a('0xe')];_0x186919[_0xa82a('0xf')]=_0x56d068[_0xa82a('0xf')];utils[_0xa82a('0x10')](_0xa82a('0x11'),_0x186919);}});}})[_0xa82a('0x13')](function(_0x2ba0ee){utils[_0xa82a('0x14')](util[_0xa82a('0x15')]('[%s][members][writeDB]',_0x186919[_0xa82a('0x7')]),_0x2ba0ee);});}delete members[_0x186919[_0xa82a('0x8')]];}function startsWith(_0x2e9829,_0x36e124){return _[_0xa82a('0x16')](_0x2e9829,function(_0x3a4980){return _[_0xa82a('0x17')](_0x36e124,_0x3a4980);});}exports[_0xa82a('0x18')]=function(_0x142a92){try{utils[_0xa82a('0x19')](util['format'](_0xa82a('0x1a'),members[_0x142a92[_0xa82a('0x1b')]]?members[_0x142a92['device']][_0xa82a('0x7')]:_0x142a92[_0xa82a('0x1b')]),_0x142a92);utils[_0xa82a('0x5')](util[_0xa82a('0x15')](_0xa82a('0x1c'),members[_0x142a92[_0xa82a('0x1b')]]?members[_0x142a92[_0xa82a('0x1b')]][_0xa82a('0x7')]:_0x142a92['device'],_0x142a92['state'],_0x142a92[_0xa82a('0x1b')]));switch(_0x142a92[_0xa82a('0x1d')]){case _0xa82a('0x1e'):case'BUSY':if(!startsWith(exclude,_0x142a92['device'])){members[_0x142a92[_0xa82a('0x1b')]]={'channel':_0xa82a('0x1f'),'interface':_0x142a92[_0xa82a('0x1b')],'type':'TALKING','enterAt':utils['now'](),'role':_0xa82a('0x20')};}break;case _0xa82a('0x21'):if(!_[_0xa82a('0x22')](members[_0x142a92['device']])){members[_0x142a92[_0xa82a('0x1b')]]['exitAt']=utils[_0xa82a('0x23')]();members[_0x142a92[_0xa82a('0x1b')]]['duration']=utils[_0xa82a('0x24')](members[_0x142a92[_0xa82a('0x1b')]][_0xa82a('0x25')],members[_0x142a92[_0xa82a('0x1b')]]['enterAt']);if(members[_0x142a92[_0xa82a('0x1b')]]['uniqueid']){writeDB(members[_0x142a92[_0xa82a('0x1b')]]);}}break;default:break;}}catch(_0x118983){utils[_0xa82a('0x14')](util['format']('[%s][members][devicestatechange]',members[_0x142a92[_0xa82a('0x1b')]]?members[_0x142a92[_0xa82a('0x1b')]]['uniqueid']:_0x142a92[_0xa82a('0x1b')]),_0x118983);}};exports[_0xa82a('0x26')]=function(_0x5a656f){try{if(!_['isNil'](members[_0x5a656f[_0xa82a('0x8')]])){utils[_0xa82a('0x19')](util['format'](_0xa82a('0x27'),_0x5a656f['uniqueid']),_0x5a656f);utils[_0xa82a('0x5')](util[_0xa82a('0x15')](_0xa82a('0x28'),_0x5a656f[_0xa82a('0x7')],_0x5a656f[_0xa82a('0x8')],_0x5a656f['queue']));members[_0x5a656f[_0xa82a('0x8')]]=_['assign'](members[_0x5a656f[_0xa82a('0x8')]],{'data4':_0x5a656f[_0xa82a('0x29')],'uniqueid':_0x5a656f[_0xa82a('0x7')]});}}catch(_0x2dfcfd){utils[_0xa82a('0x14')](util[_0xa82a('0x15')]('[%s][members][agentcomplete]',_0x5a656f[_0xa82a('0x7')]),_0x2dfcfd);}};exports[_0xa82a('0x2a')]=function(_0x1bdc45){try{utils[_0xa82a('0x19')](util[_0xa82a('0x15')](_0xa82a('0x2b'),_0x1bdc45[_0xa82a('0x7')]),_0x1bdc45);if(_0x1bdc45['channel']){var _0x56e473=_0x1bdc45[_0xa82a('0x9')][_0xa82a('0x2c')]('-')[0x0];if(!_[_0xa82a('0x22')](members[_0x56e473])){members[_0x56e473]=_[_0xa82a('0x2d')](members[_0x56e473],{'data1':members[_0x56e473][_0xa82a('0x2e')]||_0x1bdc45[_0xa82a('0xb')],'data2':members[_0x56e473][_0xa82a('0x2f')]||_0x1bdc45[_0xa82a('0x30')],'data3':members[_0x56e473][_0xa82a('0x31')]||_0x1bdc45[_0xa82a('0x32')],'uniqueid':members[_0x56e473][_0xa82a('0x7')]||_0x1bdc45[_0xa82a('0x7')]});utils[_0xa82a('0x5')](util[_0xa82a('0x15')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x1bdc45[_0xa82a('0x7')],members[_0x56e473]['data1'],members[_0x56e473][_0xa82a('0x2f')],members[_0x56e473][_0xa82a('0x31')]));if(members[_0x56e473][_0xa82a('0x25')]){writeDB(members[_0x56e473]);}}}if(_0x1bdc45[_0xa82a('0x33')]){var _0xba1d15=_0x1bdc45[_0xa82a('0x33')][_0xa82a('0x2c')]('-')[0x0];if(!_[_0xa82a('0x22')](members[_0xba1d15])){members[_0xba1d15]=_[_0xa82a('0x2d')](members[_0xba1d15],{'data1':members[_0xba1d15][_0xa82a('0x2e')]||_0x1bdc45[_0xa82a('0xb')],'data2':members[_0xba1d15][_0xa82a('0x2f')]||_0x1bdc45[_0xa82a('0x30')],'data3':members[_0xba1d15]['data3']||_0x1bdc45[_0xa82a('0x32')],'uniqueid':members[_0xba1d15]['uniqueid']||_0x1bdc45[_0xa82a('0x7')]});utils[_0xa82a('0x5')](util[_0xa82a('0x15')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x1bdc45['uniqueid'],members[_0xba1d15]['data1'],members[_0xba1d15][_0xa82a('0x2f')],members[_0xba1d15]['data3']));if(members[_0xba1d15]['exitAt']){writeDB(members[_0xba1d15]);}}}}catch(_0x4222dc){utils['error'](util[_0xa82a('0x15')](_0xa82a('0x2b'),_0x1bdc45[_0xa82a('0x7')]),_0x4222dc);}}; \ No newline at end of file +var _0xe148=['isNil','exitAt','now','diffTime','enterAt','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','cdr','[%s][members][cdr]','channel','split','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data1','destinationchannel','data2','lodash','util','./utils','Local/_attended@transfer','Queue:','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','type','then','membername','name','internal','request','CreateMemberReport','getUserByName','catch','error','some','startsWith','debug','[%s][members][devicestatechange]','device','info','state','voice','TALKING','NOT_INUSE'];(function(_0x1567c8,_0x5d128e){var _0x2df2b4=function(_0x10b27f){while(--_0x10b27f){_0x1567c8['push'](_0x1567c8['shift']());}};_0x2df2b4(++_0x5d128e);}(_0xe148,0x109));var _0x8e14=function(_0xac56ce,_0xb73e4){_0xac56ce=_0xac56ce-0x0;var _0x5105e1=_0xe148[_0xac56ce];return _0x5105e1;};'use strict';var _=require(_0x8e14('0x0'));var util=require(_0x8e14('0x1'));var utils=require(_0x8e14('0x2'));var members={};var exclude=[_0x8e14('0x3'),_0x8e14('0x4')];function writeDB(_0x47eef0){utils['info'](util[_0x8e14('0x5')](_0x8e14('0x6'),_0x47eef0[_0x8e14('0x7')],_0x47eef0[_0x8e14('0x8')],_0x47eef0['channel'],_0x47eef0['data2'],_0x47eef0['membername'],_0x47eef0[_0x8e14('0x9')]));if(_0x47eef0[_0x8e14('0x8')]){utils['getUserByInterface'](_0x47eef0['interface'])[_0x8e14('0xa')](function(_0x532665){if(_0x532665){_0x47eef0[_0x8e14('0xb')]=_0x532665[_0x8e14('0xc')];_0x47eef0[_0x8e14('0xd')]=_0x532665[_0x8e14('0xd')];utils[_0x8e14('0xe')](_0x8e14('0xf'),_0x47eef0);}else{utils[_0x8e14('0x10')](_0x47eef0[_0x8e14('0x8')]['split']('/')[0x1])[_0x8e14('0xa')](function(_0x5dc2a5){if(_0x5dc2a5){_0x47eef0[_0x8e14('0xb')]=_0x5dc2a5[_0x8e14('0xc')];_0x47eef0[_0x8e14('0xd')]=_0x5dc2a5[_0x8e14('0xd')];utils[_0x8e14('0xe')]('CreateMemberReport',_0x47eef0);}});}})[_0x8e14('0x11')](function(_0x1992b7){utils[_0x8e14('0x12')](util[_0x8e14('0x5')]('[%s][members][writeDB]',_0x47eef0[_0x8e14('0x7')]),_0x1992b7);});}delete members[_0x47eef0['interface']];}function startsWith(_0x2f4ee6,_0xd963c){return _[_0x8e14('0x13')](_0x2f4ee6,function(_0x358f5c){return _[_0x8e14('0x14')](_0xd963c,_0x358f5c);});}exports['devicestatechange']=function(_0x4af728){try{utils[_0x8e14('0x15')](util['format'](_0x8e14('0x16'),members[_0x4af728['device']]?members[_0x4af728['device']][_0x8e14('0x7')]:_0x4af728[_0x8e14('0x17')]),_0x4af728);utils[_0x8e14('0x18')](util[_0x8e14('0x5')]('[%s][members][devicestatechange]\x20state:%s\x20interface:%s',members[_0x4af728[_0x8e14('0x17')]]?members[_0x4af728[_0x8e14('0x17')]][_0x8e14('0x7')]:_0x4af728['device'],_0x4af728['state'],_0x4af728['device']));switch(_0x4af728[_0x8e14('0x19')]){case'INUSE':case'BUSY':if(!startsWith(exclude,_0x4af728[_0x8e14('0x17')])){members[_0x4af728[_0x8e14('0x17')]]={'channel':_0x8e14('0x1a'),'interface':_0x4af728[_0x8e14('0x17')],'type':_0x8e14('0x1b'),'enterAt':utils['now'](),'role':'agent'};}break;case _0x8e14('0x1c'):if(!_[_0x8e14('0x1d')](members[_0x4af728[_0x8e14('0x17')]])){members[_0x4af728[_0x8e14('0x17')]][_0x8e14('0x1e')]=utils[_0x8e14('0x1f')]();members[_0x4af728[_0x8e14('0x17')]]['duration']=utils[_0x8e14('0x20')](members[_0x4af728[_0x8e14('0x17')]][_0x8e14('0x1e')],members[_0x4af728['device']][_0x8e14('0x21')]);if(members[_0x4af728[_0x8e14('0x17')]][_0x8e14('0x7')]){writeDB(members[_0x4af728[_0x8e14('0x17')]]);}}break;default:break;}}catch(_0x96c66d){utils['error'](util['format'](_0x8e14('0x16'),members[_0x4af728[_0x8e14('0x17')]]?members[_0x4af728['device']][_0x8e14('0x7')]:_0x4af728[_0x8e14('0x17')]),_0x96c66d);}};exports['agentcomplete']=function(_0x563249){try{if(!_[_0x8e14('0x1d')](members[_0x563249['interface']])){utils[_0x8e14('0x15')](util[_0x8e14('0x5')](_0x8e14('0x22'),_0x563249[_0x8e14('0x7')]),_0x563249);utils[_0x8e14('0x18')](util[_0x8e14('0x5')](_0x8e14('0x23'),_0x563249[_0x8e14('0x7')],_0x563249[_0x8e14('0x8')],_0x563249[_0x8e14('0x24')]));members[_0x563249[_0x8e14('0x8')]]=_[_0x8e14('0x25')](members[_0x563249[_0x8e14('0x8')]],{'data4':_0x563249[_0x8e14('0x24')],'uniqueid':_0x563249[_0x8e14('0x7')]});}}catch(_0x190bfc){utils['error'](util[_0x8e14('0x5')](_0x8e14('0x22'),_0x563249['uniqueid']),_0x190bfc);}};exports[_0x8e14('0x26')]=function(_0x28182b){try{utils[_0x8e14('0x15')](util[_0x8e14('0x5')](_0x8e14('0x27'),_0x28182b[_0x8e14('0x7')]),_0x28182b);if(_0x28182b[_0x8e14('0x28')]){var _0x4f8f18=_0x28182b[_0x8e14('0x28')][_0x8e14('0x29')]('-')[0x0];if(!_['isNil'](members[_0x4f8f18])){members[_0x4f8f18]=_[_0x8e14('0x25')](members[_0x4f8f18],{'data1':members[_0x4f8f18]['data1']||_0x28182b[_0x8e14('0x9')],'data2':members[_0x4f8f18]['data2']||_0x28182b[_0x8e14('0x2a')],'data3':members[_0x4f8f18][_0x8e14('0x2b')]||_0x28182b[_0x8e14('0x2c')],'uniqueid':members[_0x4f8f18][_0x8e14('0x7')]||_0x28182b[_0x8e14('0x7')]});utils[_0x8e14('0x18')](util[_0x8e14('0x5')](_0x8e14('0x2d'),_0x28182b[_0x8e14('0x7')],members[_0x4f8f18][_0x8e14('0x2e')],members[_0x4f8f18]['data2'],members[_0x4f8f18][_0x8e14('0x2b')]));if(members[_0x4f8f18]['exitAt']){writeDB(members[_0x4f8f18]);}}}if(_0x28182b[_0x8e14('0x2f')]){var _0x14fc4a=_0x28182b[_0x8e14('0x2f')][_0x8e14('0x29')]('-')[0x0];if(!_[_0x8e14('0x1d')](members[_0x14fc4a])){members[_0x14fc4a]=_[_0x8e14('0x25')](members[_0x14fc4a],{'data1':members[_0x14fc4a][_0x8e14('0x2e')]||_0x28182b[_0x8e14('0x9')],'data2':members[_0x14fc4a]['data2']||_0x28182b[_0x8e14('0x2a')],'data3':members[_0x14fc4a][_0x8e14('0x2b')]||_0x28182b[_0x8e14('0x2c')],'uniqueid':members[_0x14fc4a]['uniqueid']||_0x28182b[_0x8e14('0x7')]});utils[_0x8e14('0x18')](util[_0x8e14('0x5')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x28182b['uniqueid'],members[_0x14fc4a][_0x8e14('0x2e')],members[_0x14fc4a][_0x8e14('0x30')],members[_0x14fc4a][_0x8e14('0x2b')]));if(members[_0x14fc4a][_0x8e14('0x1e')]){writeDB(members[_0x14fc4a]);}}}}catch(_0x341db5){utils[_0x8e14('0x12')](util['format'](_0x8e14('0x27'),_0x28182b[_0x8e14('0x7')]),_0x341db5);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index ac984b0..dae30be 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 _0x68d5=['TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','[%s][queues][blindtransfer]','transfereeuniqueid','transfertype','BLIND','transferexten','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDED','transfereelinkedid','clone','calleridname','queuecallerleaveAt','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','secondtransfererexten','ATTENDEDTRANSFER','transfertargetlinkedid','transfertargetuniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','[%s][queues][musiconholdstop]','util','./utils','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','lastAssignedTo','calleridnum','queuecallerexitreason','getVoiceQueueByName','then','type','CreateVoiceQueueReport','request','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','assign','hangup','isNil','[%s][queues][hangup]','queuecallercomplete','queuecallercompleteAt','now','COMPLETEDBYAGENT','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','error','varset','[%s][queues][varset]','value','toUpperCase','CONTINUE','queuecallerexit','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','variable','queueposition','queuecallerabandon','queuecallerabandonAt','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','holdtime','queuecallerjoinAt','position','count','[%s][queues][queuecallerleave]','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','accountcode','agentcomplete','reason','transfer'];(function(_0x36bf88,_0x15c459){var _0x332914=function(_0x512adf){while(--_0x512adf){_0x36bf88['push'](_0x36bf88['shift']());}};_0x332914(++_0x15c459);}(_0x68d5,0x15d));var _0x568d=function(_0x7b3098,_0x2c1acd){_0x7b3098=_0x7b3098-0x0;var _0x4dbfcb=_0x68d5[_0x7b3098];return _0x4dbfcb;};'use strict';var _=require('lodash');var util=require(_0x568d('0x0'));var utils=require(_0x568d('0x1'));var queues={};function writeDB(_0x536e1b){utils[_0x568d('0x2')](util[_0x568d('0x3')](_0x568d('0x4'),_0x536e1b[_0x568d('0x5')],_0x536e1b[_0x568d('0x6')],_0x536e1b[_0x568d('0x7')],_0x536e1b[_0x568d('0x8')],_0x536e1b[_0x568d('0x9')],_0x536e1b['accountcode'],_0x536e1b[_0x568d('0xa')]));if(_0x536e1b['queue']){utils[_0x568d('0xb')](_0x536e1b[_0x568d('0x7')])[_0x568d('0xc')](function(_0x3b8053){if(_0x3b8053){_0x536e1b['type']=_0x3b8053[_0x568d('0xd')];}utils['request'](_0x568d('0xe'),_0x536e1b);});}else{utils[_0x568d('0xf')](_0x568d('0xe'),_0x536e1b);}if(_0x536e1b['transfereduniqueid']){delete queues[_0x536e1b[_0x568d('0x10')]];}else{delete queues[_0x536e1b[_0x568d('0x5')]];}}exports[_0x568d('0x11')]=function(_0x4cbe23){try{utils[_0x568d('0x12')](util['format'](_0x568d('0x13'),_0x4cbe23['uniqueid']),_0x4cbe23);utils['info'](util[_0x568d('0x3')](_0x568d('0x14'),_0x4cbe23['uniqueid'],_0x4cbe23[_0x568d('0x7')],_0x4cbe23['position']));queues[_0x4cbe23[_0x568d('0x5')]]=_[_0x568d('0x15')](_0x4cbe23,{'originalposition':_0x4cbe23['position'],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0x5838f5){utils['error'](util[_0x568d('0x3')](_0x568d('0x13'),_0x4cbe23[_0x568d('0x5')]),_0x5838f5);}};exports[_0x568d('0x16')]=function(_0x215449){try{if(!_[_0x568d('0x17')](queues[_0x215449['uniqueid']])){utils[_0x568d('0x12')](util[_0x568d('0x3')](_0x568d('0x18'),_0x215449[_0x568d('0x5')]),_0x215449);if(queues[_0x215449['uniqueid']]['queuecallerleaveAt']){if(!queues[_0x215449[_0x568d('0x5')]]['queuecallerabandon']&&!queues[_0x215449[_0x568d('0x5')]]['queuecallerexit']){queues[_0x215449['uniqueid']][_0x568d('0x19')]=!![];queues[_0x215449[_0x568d('0x5')]][_0x568d('0x1a')]=utils[_0x568d('0x1b')]();queues[_0x215449[_0x568d('0x5')]][_0x568d('0xa')]=_0x568d('0x1c');}utils[_0x568d('0x2')](util[_0x568d('0x3')]('[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s',_0x215449[_0x568d('0x5')],queues[_0x215449['uniqueid']][_0x568d('0x1d')],queues[_0x215449[_0x568d('0x5')]][_0x568d('0xa')]));writeDB(queues[_0x215449['uniqueid']]);}else if(queues[_0x215449[_0x568d('0x5')]][_0x568d('0x10')]){utils[_0x568d('0x2')](util[_0x568d('0x3')](_0x568d('0x1e'),_0x215449[_0x568d('0x5')],queues[_0x215449[_0x568d('0x5')]]['name'],queues[_0x215449[_0x568d('0x5')]][_0x568d('0x10')]));queues[queues[_0x215449[_0x568d('0x5')]][_0x568d('0x10')]]=queues[_0x215449[_0x568d('0x5')]];queues[queues[_0x215449[_0x568d('0x5')]][_0x568d('0x10')]][_0x568d('0x1f')]=0x2;delete queues[_0x215449[_0x568d('0x5')]];}}}catch(_0x48ee77){utils[_0x568d('0x20')](util[_0x568d('0x3')](_0x568d('0x18'),_0x215449[_0x568d('0x5')]),_0x48ee77);}};exports[_0x568d('0x21')]=function(_0x40a419){try{utils[_0x568d('0x12')](util['format'](_0x568d('0x22'),_0x40a419['uniqueid']),_0x40a419);if(!_[_0x568d('0x17')](_0x40a419['variable']['queuestatus'])&&_0x40a419[_0x568d('0x23')][_0x568d('0x24')]()!==_0x568d('0x25')){if(!_[_0x568d('0x17')](queues[_0x40a419[_0x568d('0x5')]])){queues[_0x40a419[_0x568d('0x5')]]['queuecallerabandon']=![];queues[_0x40a419['uniqueid']]['queuecallerabandonAt']=null;queues[_0x40a419[_0x568d('0x5')]][_0x568d('0x26')]=!![];queues[_0x40a419[_0x568d('0x5')]]['queuecallerexitAt']=utils[_0x568d('0x1b')]();queues[_0x40a419[_0x568d('0x5')]][_0x568d('0xa')]=_0x40a419[_0x568d('0x23')][_0x568d('0x24')]();utils['info'](util[_0x568d('0x3')](_0x568d('0x27'),_0x40a419[_0x568d('0x5')],queues[_0x40a419[_0x568d('0x5')]][_0x568d('0x1d')],_0x40a419['value'],queues[_0x40a419[_0x568d('0x5')]][_0x568d('0xa')]));writeDB(queues[_0x40a419[_0x568d('0x5')]]);}}else if(!_[_0x568d('0x17')](_0x40a419[_0x568d('0x28')][_0x568d('0x29')])){if(!_[_0x568d('0x17')](queues[_0x40a419[_0x568d('0x5')]])&&!queues[_0x40a419['uniqueid']]['queuecallerabandon']){queues[_0x40a419[_0x568d('0x5')]][_0x568d('0x2a')]=![];queues[_0x40a419[_0x568d('0x5')]][_0x568d('0x2b')]=null;queues[_0x40a419['uniqueid']][_0x568d('0x26')]=!![];queues[_0x40a419[_0x568d('0x5')]][_0x568d('0x2c')]=utils[_0x568d('0x1b')]();queues[_0x40a419[_0x568d('0x5')]][_0x568d('0xa')]='EXITWITHKEY';utils[_0x568d('0x2')](util[_0x568d('0x3')](_0x568d('0x2d'),_0x40a419[_0x568d('0x5')],queues[_0x40a419['uniqueid']][_0x568d('0x1d')],_0x40a419['value'],queues[_0x40a419[_0x568d('0x5')]][_0x568d('0xa')]));}}}catch(_0x88692){utils[_0x568d('0x20')](util[_0x568d('0x3')](_0x568d('0x22'),_0x40a419[_0x568d('0x5')]),_0x88692);}};exports['queuecallerabandon']=function(_0x31019b){try{if(!_[_0x568d('0x17')](queues[_0x31019b[_0x568d('0x5')]])){utils[_0x568d('0x12')](util[_0x568d('0x3')](_0x568d('0x2e'),_0x31019b['uniqueid']),_0x31019b);queues[_0x31019b[_0x568d('0x5')]][_0x568d('0x26')]=![];queues[_0x31019b[_0x568d('0x5')]]['queuecallerexitAt']=null;queues[_0x31019b[_0x568d('0x5')]]['queuecallerabandon']=!![];queues[_0x31019b['uniqueid']][_0x568d('0x2b')]=utils[_0x568d('0x1b')]();queues[_0x31019b['uniqueid']][_0x568d('0xa')]=_0x568d('0x2f');utils[_0x568d('0x2')](util[_0x568d('0x3')](_0x568d('0x30'),_0x31019b[_0x568d('0x5')],queues[_0x31019b[_0x568d('0x5')]][_0x568d('0x1d')],queues[_0x31019b[_0x568d('0x5')]]['queuecallerexitreason']));}}catch(_0x41f0f4){utils[_0x568d('0x20')](util[_0x568d('0x3')](_0x568d('0x2e'),_0x31019b['uniqueid']),_0x41f0f4);}};exports[_0x568d('0x31')]=function(_0x27174c){try{if(!_['isNil'](queues[_0x27174c[_0x568d('0x5')]])){utils['debug'](util[_0x568d('0x3')]('[%s][queues][queuecallerleave]',_0x27174c[_0x568d('0x5')]),_0x27174c);utils[_0x568d('0x2')](util[_0x568d('0x3')](_0x568d('0x32'),_0x27174c['uniqueid'],queues[_0x27174c[_0x568d('0x5')]]['name'],_0x27174c[_0x568d('0x33')],_0x27174c[_0x568d('0x34')]));queues[_0x27174c[_0x568d('0x5')]]['queuecallerleave']=!![];queues[_0x27174c[_0x568d('0x5')]]['queuecallerleaveAt']=utils[_0x568d('0x1b')]();queues[_0x27174c['uniqueid']][_0x568d('0x35')]=utils['diffTime'](queues[_0x27174c[_0x568d('0x5')]]['queuecallerleaveAt'],queues[_0x27174c['uniqueid']][_0x568d('0x36')]);queues[_0x27174c[_0x568d('0x5')]]['position']=_0x27174c[_0x568d('0x37')];queues[_0x27174c[_0x568d('0x5')]][_0x568d('0x38')]=_0x27174c[_0x568d('0x38')];queues[_0x27174c['uniqueid']][_0x568d('0x33')]=_0x27174c[_0x568d('0x33')];queues[_0x27174c[_0x568d('0x5')]]['connectedlinename']=_0x27174c[_0x568d('0x34')];}}catch(_0xe4f207){utils['error'](util['format'](_0x568d('0x39'),_0x27174c[_0x568d('0x5')]),_0xe4f207);}};exports['agentconnect']=function(_0x3c1b83){try{if(!_[_0x568d('0x17')](queues[_0x3c1b83[_0x568d('0x5')]])){utils[_0x568d('0x12')](util[_0x568d('0x3')](_0x568d('0x3a'),_0x3c1b83[_0x568d('0x5')]),_0x3c1b83);utils['info'](util[_0x568d('0x3')](_0x568d('0x3b'),_0x3c1b83[_0x568d('0x5')],queues[_0x3c1b83[_0x568d('0x5')]]['name'],_0x3c1b83[_0x568d('0x3c')],_0x3c1b83[_0x568d('0x3d')]));queues[_0x3c1b83[_0x568d('0x5')]][_0x568d('0x2a')]=![];queues[_0x3c1b83[_0x568d('0x5')]][_0x568d('0x2a')]=![];queues[_0x3c1b83[_0x568d('0x5')]][_0x568d('0x2b')]=null;queues[_0x3c1b83['uniqueid']]['queuecallerexit']=![];queues[_0x3c1b83[_0x568d('0x5')]][_0x568d('0xa')]=null;queues[_0x3c1b83[_0x568d('0x5')]]['queuecallerexitAt']=null;queues[_0x3c1b83[_0x568d('0x5')]][_0x568d('0x3e')]=!![];queues[_0x3c1b83[_0x568d('0x5')]][_0x568d('0x3f')]=_0x3c1b83['destaccountcode'];queues[_0x3c1b83[_0x568d('0x5')]][_0x568d('0x8')]=_0x3c1b83[_0x568d('0x3c')];}}catch(_0x6858ce){utils[_0x568d('0x20')](util[_0x568d('0x3')](_0x568d('0x3a'),_0x3c1b83[_0x568d('0x5')]),_0x6858ce);}};exports[_0x568d('0x40')]=function(_0x184f77){try{if(!_['isNil'](queues[_0x184f77[_0x568d('0x5')]])){if(queues[_0x184f77[_0x568d('0x5')]]['queuecallerleaveAt']){utils[_0x568d('0x12')](util[_0x568d('0x3')]('[%s][queues][agentcomplete]',_0x184f77[_0x568d('0x5')]),_0x184f77);queues[_0x184f77[_0x568d('0x5')]][_0x568d('0x2a')]=![];queues[_0x184f77[_0x568d('0x5')]][_0x568d('0x2a')]=![];queues[_0x184f77['uniqueid']][_0x568d('0x2b')]=null;queues[_0x184f77[_0x568d('0x5')]][_0x568d('0x26')]=![];queues[_0x184f77[_0x568d('0x5')]]['queuecallerexitAt']=null;queues[_0x184f77[_0x568d('0x5')]][_0x568d('0x3e')]=!![];queues[_0x184f77[_0x568d('0x5')]][_0x568d('0x8')]=_0x184f77[_0x568d('0x3c')];queues[_0x184f77[_0x568d('0x5')]][_0x568d('0x19')]=!![];queues[_0x184f77[_0x568d('0x5')]][_0x568d('0x1a')]=utils[_0x568d('0x1b')]();if(_0x184f77[_0x568d('0x41')]==_0x568d('0x42')){if(!queues[_0x184f77[_0x568d('0x5')]][_0x568d('0x42')]){queues[_0x184f77['uniqueid']][_0x568d('0xa')]=_0x568d('0x43');}}else{queues[_0x184f77['uniqueid']][_0x568d('0xa')]=_0x568d('0x44')+_0x184f77['reason'][_0x568d('0x24')]();}utils['info'](util['format'](_0x568d('0x45'),_0x184f77[_0x568d('0x5')],queues[_0x184f77[_0x568d('0x5')]][_0x568d('0x1d')],_0x184f77[_0x568d('0x3c')],queues[_0x184f77[_0x568d('0x5')]]['queuecallerexitreason']));writeDB(queues[_0x184f77[_0x568d('0x5')]]);}}}catch(_0x5954db){utils[_0x568d('0x20')](util[_0x568d('0x3')]('[%s][queues][agentcomplete]',_0x184f77[_0x568d('0x5')]),_0x5954db);}};exports[_0x568d('0x46')]=function(_0x5f968b){try{if(!_[_0x568d('0x17')](queues[_0x5f968b['transfereeuniqueid']])){utils['debug'](util[_0x568d('0x3')](_0x568d('0x47'),_0x5f968b[_0x568d('0x5')]),_0x5f968b);queues[_0x5f968b[_0x568d('0x48')]][_0x568d('0x42')]=!![];queues[_0x5f968b[_0x568d('0x48')]][_0x568d('0x49')]=_0x568d('0x4a');queues[_0x5f968b[_0x568d('0x48')]][_0x568d('0x4b')]=_0x5f968b[_0x568d('0x4c')];queues[_0x5f968b[_0x568d('0x48')]][_0x568d('0x4d')]=_0x5f968b[_0x568d('0x48')];queues[_0x5f968b[_0x568d('0x48')]]['queuecallerexitreason']=_0x568d('0x4e');utils[_0x568d('0x2')](util[_0x568d('0x3')]('[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER',_0x5f968b[_0x568d('0x5')],queues[_0x5f968b[_0x568d('0x48')]][_0x568d('0x1d')],_0x5f968b[_0x568d('0x48')],_0x5f968b['extension']));}}catch(_0x25714a){utils[_0x568d('0x20')](util['format'](_0x568d('0x47'),_0x5f968b[_0x568d('0x5')]),_0x25714a);}};exports['attendedtransfer']=function(_0x225ab2){try{utils['debug'](util['format'](_0x568d('0x4f'),_0x225ab2[_0x568d('0x50')]),_0x225ab2);if(_0x225ab2[_0x568d('0x50')]==_0x225ab2[_0x568d('0x51')]){if(!_['isNil'](queues[_0x225ab2[_0x568d('0x52')]])){utils[_0x568d('0x2')](util[_0x568d('0x3')](_0x568d('0x53'),_0x225ab2[_0x568d('0x50')],queues[_0x225ab2['secondtransfererlinkedid']][_0x568d('0x1d')],_0x225ab2[_0x568d('0x54')]));queues[_0x225ab2[_0x568d('0x52')]]['transfer']=!![];queues[_0x225ab2[_0x568d('0x52')]]['transfertype']=_0x568d('0x55');queues[_0x225ab2[_0x568d('0x52')]]['transferexten']=_0x225ab2['origtransfererexten'];queues[_0x225ab2[_0x568d('0x52')]][_0x568d('0x4d')]=_0x225ab2[_0x568d('0x50')];queues[_0x225ab2['secondtransfererlinkedid']][_0x568d('0xa')]='ATTENDEDTRANSFER';}if(!_['isNil'](queues[_0x225ab2['origtransfererlinkedid']])){if(_0x225ab2['transfereelinkedid']&&queues[_0x225ab2['transfereelinkedid']]){queues[_0x225ab2[_0x568d('0x56')]]['queuecallerenterreason']=0x1;queues[_0x225ab2[_0x568d('0x48')]]=_[_0x568d('0x57')](queues[_0x225ab2[_0x568d('0x56')]]);queues[_0x225ab2['transfereeuniqueid']][_0x568d('0x10')]=_0x225ab2['transfertargetuniqueid'];queues[_0x225ab2['transfereeuniqueid']][_0x568d('0x1f')]=0x2;queues[_0x225ab2[_0x568d('0x48')]][_0x568d('0x9')]=queues[_0x225ab2[_0x568d('0x52')]][_0x568d('0x9')];queues[_0x225ab2[_0x568d('0x48')]][_0x568d('0x58')]=queues[_0x225ab2[_0x568d('0x52')]][_0x568d('0x58')];queues[_0x225ab2['transfereeuniqueid']][_0x568d('0x36')]=utils[_0x568d('0x1b')]();queues[_0x225ab2[_0x568d('0x48')]][_0x568d('0x59')]=utils[_0x568d('0x1b')]();queues[_0x225ab2[_0x568d('0x48')]][_0x568d('0x35')]=0x0;queues[_0x225ab2['transfereeuniqueid']][_0x568d('0x5a')]=0x0;utils[_0x568d('0x2')](util[_0x568d('0x3')](_0x568d('0x5b'),_0x225ab2['origtransfereruniqueid'],queues[_0x225ab2[_0x568d('0x48')]][_0x568d('0x1d')],queues[_0x225ab2['transfereeuniqueid']]['calleridnum'],queues[_0x225ab2[_0x568d('0x48')]][_0x568d('0x58')]));}else{utils[_0x568d('0x2')](util[_0x568d('0x3')](_0x568d('0x5c'),_0x225ab2[_0x568d('0x50')],queues[_0x225ab2['origtransfererlinkedid']][_0x568d('0x1d')],_0x225ab2[_0x568d('0x52')]));queues[_0x225ab2[_0x568d('0x51')]]['transfereduniqueid']=_0x225ab2[_0x568d('0x52')];}}}else if(_0x225ab2['secondtransfereruniqueid']==_0x225ab2[_0x568d('0x52')]){if(!_[_0x568d('0x17')](queues[_0x225ab2[_0x568d('0x51')]])){utils['info'](util[_0x568d('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x225ab2[_0x568d('0x50')],queues[_0x225ab2[_0x568d('0x51')]][_0x568d('0x1d')],_0x225ab2[_0x568d('0x5d')],_0x225ab2[_0x568d('0x5e')]));queues[_0x225ab2[_0x568d('0x51')]][_0x568d('0x42')]=!![];queues[_0x225ab2[_0x568d('0x51')]][_0x568d('0x49')]=_0x568d('0x55');queues[_0x225ab2[_0x568d('0x51')]][_0x568d('0x4b')]=_0x225ab2[_0x568d('0x5e')];queues[_0x225ab2[_0x568d('0x51')]][_0x568d('0x4d')]=_0x225ab2[_0x568d('0x5d')];queues[_0x225ab2[_0x568d('0x51')]][_0x568d('0xa')]=_0x568d('0x5f');}if(!_[_0x568d('0x17')](queues[_0x225ab2[_0x568d('0x52')]])){if(_0x225ab2[_0x568d('0x60')]&&queues[_0x225ab2[_0x568d('0x60')]]){queues[_0x225ab2['transfertargetlinkedid']][_0x568d('0x1f')]=0x1;queues[_0x225ab2[_0x568d('0x61')]]=_[_0x568d('0x57')](queues[_0x225ab2['transfertargetlinkedid']]);queues[_0x225ab2['transfertargetuniqueid']][_0x568d('0x10')]=_0x225ab2[_0x568d('0x61')];queues[_0x225ab2[_0x568d('0x61')]][_0x568d('0x1f')]=0x2;queues[_0x225ab2['transfertargetuniqueid']][_0x568d('0x9')]=queues[_0x225ab2[_0x568d('0x51')]][_0x568d('0x9')];queues[_0x225ab2[_0x568d('0x61')]][_0x568d('0x58')]=queues[_0x225ab2[_0x568d('0x51')]][_0x568d('0x58')];queues[_0x225ab2['transfertargetuniqueid']]['queuecallerjoinAt']=utils[_0x568d('0x1b')]();queues[_0x225ab2[_0x568d('0x61')]][_0x568d('0x59')]=utils['now']();queues[_0x225ab2[_0x568d('0x61')]][_0x568d('0x35')]=0x0;queues[_0x225ab2[_0x568d('0x61')]][_0x568d('0x5a')]=0x0;utils[_0x568d('0x2')](util['format'](_0x568d('0x62'),_0x225ab2[_0x568d('0x50')],queues[_0x225ab2[_0x568d('0x61')]]['name'],queues[_0x225ab2['transfertargetuniqueid']][_0x568d('0x10')],queues[_0x225ab2[_0x568d('0x61')]][_0x568d('0x9')],queues[_0x225ab2[_0x568d('0x61')]][_0x568d('0x58')]));}else{utils[_0x568d('0x2')](util[_0x568d('0x3')](_0x568d('0x5c'),_0x225ab2[_0x568d('0x50')],queues[_0x225ab2[_0x568d('0x52')]]['name'],_0x225ab2[_0x568d('0x51')]));queues[_0x225ab2['secondtransfererlinkedid']][_0x568d('0x10')]=_0x225ab2['origtransfererlinkedid'];}}}}catch(_0x15460c){utils[_0x568d('0x20')](util['format']('[%s][queues][attendedtransfer]',_0x225ab2[_0x568d('0x50')]),_0x15460c);}};exports[_0x568d('0x63')]=function(_0xf0d23e){try{if(!_[_0x568d('0x17')](queues[_0xf0d23e['uniqueid']])){utils[_0x568d('0x12')](util[_0x568d('0x3')](_0x568d('0x64'),_0xf0d23e['uniqueid']),_0xf0d23e);queues[_0xf0d23e['uniqueid']][_0x568d('0x65')]=utils[_0x568d('0x1b')]();utils['info'](util[_0x568d('0x3')](_0x568d('0x66'),_0xf0d23e[_0x568d('0x5')],queues[_0xf0d23e[_0x568d('0x5')]][_0x568d('0x1d')],queues[_0xf0d23e[_0x568d('0x5')]]['musiconholdstartAt']));}}catch(_0x3309a9){utils[_0x568d('0x20')](util[_0x568d('0x3')](_0x568d('0x64'),_0xf0d23e[_0x568d('0x5')]),_0x3309a9);}};exports['musiconholdstop']=function(_0x343a8b){try{if(!_[_0x568d('0x17')](queues[_0x343a8b['uniqueid']])){if(!_[_0x568d('0x17')](queues[_0x343a8b[_0x568d('0x5')]][_0x568d('0x65')])){utils[_0x568d('0x12')](util['format'](_0x568d('0x67'),_0x343a8b[_0x568d('0x5')]),_0x343a8b);queues[_0x343a8b['uniqueid']][_0x568d('0x5a')]+=utils['diffTime'](utils[_0x568d('0x1b')](),queues[_0x343a8b[_0x568d('0x5')]][_0x568d('0x65')]);utils[_0x568d('0x2')](util['format']('[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s',_0x343a8b[_0x568d('0x5')],queues[_0x343a8b[_0x568d('0x5')]][_0x568d('0x1d')],queues[_0x343a8b['uniqueid']][_0x568d('0x5a')]));delete queues[_0x343a8b[_0x568d('0x5')]][_0x568d('0x65')];}}}catch(_0x1f79c5){utils[_0x568d('0x20')](util[_0x568d('0x3')]('[%s][queues][musiconholdstop]',_0x343a8b[_0x568d('0x5')]),_0x1f79c5);}}; \ No newline at end of file +var _0x4b54=['count','connectedlinename','[%s][queues][queuecallerleave]','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','destaccountcode','accountcode','membername','agentcomplete','[%s][queues][agentcomplete]','assigned','transfer','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','transferexten','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','secondtransfererlinkedid','ATTENDED','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','calleridname','queuecallerjoinAt','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','transfertargetlinkedid','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','util','info','format','channel','lastAssignedTo','calleridnum','queuecallerexitreason','queue','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','uniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','now','hangup','isNil','[%s][queues][hangup]','queuecallerleaveAt','queuecallerexit','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','name','queuecallerenterreason','error','varset','[%s][queues][varset]','variable','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandon','queuecallerabandonAt','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','holdtime','diffTime'];(function(_0x2a359f,_0x3549c1){var _0x275672=function(_0x4ef4be){while(--_0x4ef4be){_0x2a359f['push'](_0x2a359f['shift']());}};_0x275672(++_0x3549c1);}(_0x4b54,0x103));var _0x44b5=function(_0x41b840,_0x1a3baf){_0x41b840=_0x41b840-0x0;var _0x2a0adf=_0x4b54[_0x41b840];return _0x2a0adf;};'use strict';var _=require(_0x44b5('0x0'));var util=require(_0x44b5('0x1'));var utils=require('./utils');var queues={};function writeDB(_0x1f407c){utils[_0x44b5('0x2')](util[_0x44b5('0x3')]('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0x1f407c['uniqueid'],_0x1f407c[_0x44b5('0x4')],_0x1f407c['queue'],_0x1f407c[_0x44b5('0x5')],_0x1f407c[_0x44b5('0x6')],_0x1f407c['accountcode'],_0x1f407c[_0x44b5('0x7')]));if(_0x1f407c[_0x44b5('0x8')]){utils[_0x44b5('0x9')](_0x1f407c['queue'])[_0x44b5('0xa')](function(_0x9ce582){if(_0x9ce582){_0x1f407c['type']=_0x9ce582[_0x44b5('0xb')];}utils[_0x44b5('0xc')](_0x44b5('0xd'),_0x1f407c);});}else{utils[_0x44b5('0xc')](_0x44b5('0xd'),_0x1f407c);}if(_0x1f407c[_0x44b5('0xe')]){delete queues[_0x1f407c[_0x44b5('0xe')]];}else{delete queues[_0x1f407c[_0x44b5('0xf')]];}}exports[_0x44b5('0x10')]=function(_0x2e68c4){try{utils[_0x44b5('0x11')](util['format'](_0x44b5('0x12'),_0x2e68c4[_0x44b5('0xf')]),_0x2e68c4);utils[_0x44b5('0x2')](util[_0x44b5('0x3')](_0x44b5('0x13'),_0x2e68c4[_0x44b5('0xf')],_0x2e68c4[_0x44b5('0x8')],_0x2e68c4[_0x44b5('0x14')]));queues[_0x2e68c4[_0x44b5('0xf')]]=_['assign'](_0x2e68c4,{'originalposition':_0x2e68c4['position'],'queuecallerjoinAt':utils[_0x44b5('0x15')](),'mohtime':0x0});}catch(_0x13b194){utils['error'](util['format']('[%s][queues][queuecallerjoin]',_0x2e68c4[_0x44b5('0xf')]),_0x13b194);}};exports[_0x44b5('0x16')]=function(_0x545270){try{if(!_[_0x44b5('0x17')](queues[_0x545270[_0x44b5('0xf')]])){utils[_0x44b5('0x11')](util['format'](_0x44b5('0x18'),_0x545270[_0x44b5('0xf')]),_0x545270);if(queues[_0x545270[_0x44b5('0xf')]][_0x44b5('0x19')]){if(!queues[_0x545270[_0x44b5('0xf')]]['queuecallerabandon']&&!queues[_0x545270[_0x44b5('0xf')]][_0x44b5('0x1a')]){queues[_0x545270['uniqueid']][_0x44b5('0x1b')]=!![];queues[_0x545270[_0x44b5('0xf')]][_0x44b5('0x1c')]=utils[_0x44b5('0x15')]();queues[_0x545270[_0x44b5('0xf')]][_0x44b5('0x7')]=_0x44b5('0x1d');}utils[_0x44b5('0x2')](util[_0x44b5('0x3')](_0x44b5('0x1e'),_0x545270[_0x44b5('0xf')],queues[_0x545270[_0x44b5('0xf')]]['name'],queues[_0x545270[_0x44b5('0xf')]][_0x44b5('0x7')]));writeDB(queues[_0x545270[_0x44b5('0xf')]]);}else if(queues[_0x545270[_0x44b5('0xf')]][_0x44b5('0xe')]){utils[_0x44b5('0x2')](util[_0x44b5('0x3')](_0x44b5('0x1f'),_0x545270[_0x44b5('0xf')],queues[_0x545270[_0x44b5('0xf')]][_0x44b5('0x20')],queues[_0x545270[_0x44b5('0xf')]][_0x44b5('0xe')]));queues[queues[_0x545270[_0x44b5('0xf')]][_0x44b5('0xe')]]=queues[_0x545270['uniqueid']];queues[queues[_0x545270[_0x44b5('0xf')]][_0x44b5('0xe')]][_0x44b5('0x21')]=0x2;delete queues[_0x545270[_0x44b5('0xf')]];}}}catch(_0x5e04b8){utils[_0x44b5('0x22')](util[_0x44b5('0x3')]('[%s][queues][hangup]',_0x545270[_0x44b5('0xf')]),_0x5e04b8);}};exports[_0x44b5('0x23')]=function(_0x5e5687){try{utils[_0x44b5('0x11')](util[_0x44b5('0x3')](_0x44b5('0x24'),_0x5e5687['uniqueid']),_0x5e5687);if(!_[_0x44b5('0x17')](_0x5e5687[_0x44b5('0x25')][_0x44b5('0x26')])&&_0x5e5687[_0x44b5('0x27')][_0x44b5('0x28')]()!==_0x44b5('0x29')){if(!_['isNil'](queues[_0x5e5687[_0x44b5('0xf')]])){queues[_0x5e5687[_0x44b5('0xf')]][_0x44b5('0x2a')]=![];queues[_0x5e5687[_0x44b5('0xf')]][_0x44b5('0x2b')]=null;queues[_0x5e5687[_0x44b5('0xf')]][_0x44b5('0x1a')]=!![];queues[_0x5e5687[_0x44b5('0xf')]][_0x44b5('0x2c')]=utils['now']();queues[_0x5e5687[_0x44b5('0xf')]][_0x44b5('0x7')]=_0x5e5687['value'][_0x44b5('0x28')]();utils[_0x44b5('0x2')](util['format'](_0x44b5('0x2d'),_0x5e5687['uniqueid'],queues[_0x5e5687[_0x44b5('0xf')]][_0x44b5('0x20')],_0x5e5687['value'],queues[_0x5e5687[_0x44b5('0xf')]][_0x44b5('0x7')]));writeDB(queues[_0x5e5687[_0x44b5('0xf')]]);}}else if(!_['isNil'](_0x5e5687[_0x44b5('0x25')][_0x44b5('0x2e')])){if(!_[_0x44b5('0x17')](queues[_0x5e5687[_0x44b5('0xf')]])&&!queues[_0x5e5687[_0x44b5('0xf')]]['queuecallerabandon']){queues[_0x5e5687[_0x44b5('0xf')]][_0x44b5('0x2a')]=![];queues[_0x5e5687['uniqueid']][_0x44b5('0x2b')]=null;queues[_0x5e5687[_0x44b5('0xf')]][_0x44b5('0x1a')]=!![];queues[_0x5e5687[_0x44b5('0xf')]][_0x44b5('0x2c')]=utils[_0x44b5('0x15')]();queues[_0x5e5687['uniqueid']][_0x44b5('0x7')]='EXITWITHKEY';utils[_0x44b5('0x2')](util[_0x44b5('0x3')](_0x44b5('0x2f'),_0x5e5687[_0x44b5('0xf')],queues[_0x5e5687['uniqueid']][_0x44b5('0x20')],_0x5e5687['value'],queues[_0x5e5687[_0x44b5('0xf')]][_0x44b5('0x7')]));}}}catch(_0x8819a4){utils['error'](util[_0x44b5('0x3')](_0x44b5('0x24'),_0x5e5687[_0x44b5('0xf')]),_0x8819a4);}};exports[_0x44b5('0x2a')]=function(_0x2e57be){try{if(!_[_0x44b5('0x17')](queues[_0x2e57be[_0x44b5('0xf')]])){utils[_0x44b5('0x11')](util[_0x44b5('0x3')](_0x44b5('0x30'),_0x2e57be[_0x44b5('0xf')]),_0x2e57be);queues[_0x2e57be[_0x44b5('0xf')]]['queuecallerexit']=![];queues[_0x2e57be[_0x44b5('0xf')]][_0x44b5('0x2c')]=null;queues[_0x2e57be[_0x44b5('0xf')]][_0x44b5('0x2a')]=!![];queues[_0x2e57be[_0x44b5('0xf')]][_0x44b5('0x2b')]=utils[_0x44b5('0x15')]();queues[_0x2e57be[_0x44b5('0xf')]][_0x44b5('0x7')]=_0x44b5('0x31');utils[_0x44b5('0x2')](util[_0x44b5('0x3')](_0x44b5('0x32'),_0x2e57be[_0x44b5('0xf')],queues[_0x2e57be[_0x44b5('0xf')]][_0x44b5('0x20')],queues[_0x2e57be[_0x44b5('0xf')]][_0x44b5('0x7')]));}}catch(_0xca4493){utils[_0x44b5('0x22')](util[_0x44b5('0x3')]('[%s][queues][queuecallerabandon]',_0x2e57be[_0x44b5('0xf')]),_0xca4493);}};exports[_0x44b5('0x33')]=function(_0x3ea5d3){try{if(!_[_0x44b5('0x17')](queues[_0x3ea5d3[_0x44b5('0xf')]])){utils[_0x44b5('0x11')](util[_0x44b5('0x3')]('[%s][queues][queuecallerleave]',_0x3ea5d3['uniqueid']),_0x3ea5d3);utils[_0x44b5('0x2')](util[_0x44b5('0x3')](_0x44b5('0x34'),_0x3ea5d3['uniqueid'],queues[_0x3ea5d3[_0x44b5('0xf')]][_0x44b5('0x20')],_0x3ea5d3[_0x44b5('0x35')],_0x3ea5d3['connectedlinename']));queues[_0x3ea5d3[_0x44b5('0xf')]][_0x44b5('0x33')]=!![];queues[_0x3ea5d3[_0x44b5('0xf')]][_0x44b5('0x19')]=utils['now']();queues[_0x3ea5d3[_0x44b5('0xf')]][_0x44b5('0x36')]=utils[_0x44b5('0x37')](queues[_0x3ea5d3['uniqueid']]['queuecallerleaveAt'],queues[_0x3ea5d3[_0x44b5('0xf')]]['queuecallerjoinAt']);queues[_0x3ea5d3['uniqueid']][_0x44b5('0x14')]=_0x3ea5d3[_0x44b5('0x14')];queues[_0x3ea5d3[_0x44b5('0xf')]][_0x44b5('0x38')]=_0x3ea5d3[_0x44b5('0x38')];queues[_0x3ea5d3['uniqueid']][_0x44b5('0x35')]=_0x3ea5d3[_0x44b5('0x35')];queues[_0x3ea5d3['uniqueid']][_0x44b5('0x39')]=_0x3ea5d3[_0x44b5('0x39')];}}catch(_0x5e0f6f){utils[_0x44b5('0x22')](util[_0x44b5('0x3')](_0x44b5('0x3a'),_0x3ea5d3[_0x44b5('0xf')]),_0x5e0f6f);}};exports[_0x44b5('0x3b')]=function(_0x1f73b0){try{if(!_[_0x44b5('0x17')](queues[_0x1f73b0[_0x44b5('0xf')]])){utils[_0x44b5('0x11')](util[_0x44b5('0x3')](_0x44b5('0x3c'),_0x1f73b0[_0x44b5('0xf')]),_0x1f73b0);utils['info'](util[_0x44b5('0x3')](_0x44b5('0x3d'),_0x1f73b0[_0x44b5('0xf')],queues[_0x1f73b0['uniqueid']]['name'],_0x1f73b0['membername'],_0x1f73b0[_0x44b5('0x3e')]));queues[_0x1f73b0[_0x44b5('0xf')]][_0x44b5('0x2a')]=![];queues[_0x1f73b0[_0x44b5('0xf')]]['queuecallerabandon']=![];queues[_0x1f73b0[_0x44b5('0xf')]][_0x44b5('0x2b')]=null;queues[_0x1f73b0[_0x44b5('0xf')]]['queuecallerexit']=![];queues[_0x1f73b0[_0x44b5('0xf')]]['queuecallerexitreason']=null;queues[_0x1f73b0[_0x44b5('0xf')]][_0x44b5('0x2c')]=null;queues[_0x1f73b0[_0x44b5('0xf')]]['assigned']=!![];queues[_0x1f73b0[_0x44b5('0xf')]][_0x44b5('0x3f')]=_0x1f73b0[_0x44b5('0x3e')];queues[_0x1f73b0[_0x44b5('0xf')]][_0x44b5('0x5')]=_0x1f73b0[_0x44b5('0x40')];}}catch(_0x45acb1){utils['error'](util[_0x44b5('0x3')]('[%s][queues][agentconnect]',_0x1f73b0[_0x44b5('0xf')]),_0x45acb1);}};exports[_0x44b5('0x41')]=function(_0x550dbb){try{if(!_[_0x44b5('0x17')](queues[_0x550dbb[_0x44b5('0xf')]])){if(queues[_0x550dbb[_0x44b5('0xf')]][_0x44b5('0x19')]){utils[_0x44b5('0x11')](util['format'](_0x44b5('0x42'),_0x550dbb['uniqueid']),_0x550dbb);queues[_0x550dbb[_0x44b5('0xf')]][_0x44b5('0x2a')]=![];queues[_0x550dbb[_0x44b5('0xf')]][_0x44b5('0x2a')]=![];queues[_0x550dbb['uniqueid']]['queuecallerabandonAt']=null;queues[_0x550dbb[_0x44b5('0xf')]][_0x44b5('0x1a')]=![];queues[_0x550dbb[_0x44b5('0xf')]]['queuecallerexitAt']=null;queues[_0x550dbb[_0x44b5('0xf')]][_0x44b5('0x43')]=!![];queues[_0x550dbb[_0x44b5('0xf')]]['lastAssignedTo']=_0x550dbb[_0x44b5('0x40')];queues[_0x550dbb[_0x44b5('0xf')]][_0x44b5('0x1b')]=!![];queues[_0x550dbb['uniqueid']][_0x44b5('0x1c')]=utils[_0x44b5('0x15')]();if(_0x550dbb['reason']==_0x44b5('0x44')){if(!queues[_0x550dbb[_0x44b5('0xf')]][_0x44b5('0x44')]){queues[_0x550dbb[_0x44b5('0xf')]][_0x44b5('0x7')]='TRANSFER';}}else{queues[_0x550dbb[_0x44b5('0xf')]][_0x44b5('0x7')]='COMPLETEDBY'+_0x550dbb['reason']['toUpperCase']();}utils['info'](util['format'](_0x44b5('0x45'),_0x550dbb[_0x44b5('0xf')],queues[_0x550dbb['uniqueid']]['name'],_0x550dbb['membername'],queues[_0x550dbb[_0x44b5('0xf')]][_0x44b5('0x7')]));writeDB(queues[_0x550dbb['uniqueid']]);}}}catch(_0x37224a){utils['error'](util[_0x44b5('0x3')]('[%s][queues][agentcomplete]',_0x550dbb[_0x44b5('0xf')]),_0x37224a);}};exports[_0x44b5('0x46')]=function(_0x58a700){try{if(!_[_0x44b5('0x17')](queues[_0x58a700[_0x44b5('0x47')]])){utils[_0x44b5('0x11')](util[_0x44b5('0x3')](_0x44b5('0x48'),_0x58a700[_0x44b5('0xf')]),_0x58a700);queues[_0x58a700[_0x44b5('0x47')]][_0x44b5('0x44')]=!![];queues[_0x58a700[_0x44b5('0x47')]][_0x44b5('0x49')]='BLIND';queues[_0x58a700['transfereeuniqueid']][_0x44b5('0x4a')]=_0x58a700[_0x44b5('0x4b')];queues[_0x58a700[_0x44b5('0x47')]][_0x44b5('0x4c')]=_0x58a700[_0x44b5('0x47')];queues[_0x58a700[_0x44b5('0x47')]][_0x44b5('0x7')]=_0x44b5('0x4d');utils['info'](util[_0x44b5('0x3')](_0x44b5('0x4e'),_0x58a700['uniqueid'],queues[_0x58a700[_0x44b5('0x47')]]['name'],_0x58a700[_0x44b5('0x47')],_0x58a700[_0x44b5('0x4b')]));}}catch(_0x4dc841){utils[_0x44b5('0x22')](util[_0x44b5('0x3')]('[%s][queues][blindtransfer]',_0x58a700[_0x44b5('0xf')]),_0x4dc841);}};exports[_0x44b5('0x4f')]=function(_0x53c573){try{utils[_0x44b5('0x11')](util[_0x44b5('0x3')](_0x44b5('0x50'),_0x53c573[_0x44b5('0x51')]),_0x53c573);if(_0x53c573['origtransfereruniqueid']==_0x53c573[_0x44b5('0x52')]){if(!_['isNil'](queues[_0x53c573['secondtransfererlinkedid']])){utils[_0x44b5('0x2')](util['format'](_0x44b5('0x53'),_0x53c573[_0x44b5('0x51')],queues[_0x53c573['secondtransfererlinkedid']][_0x44b5('0x20')],_0x53c573[_0x44b5('0x54')]));queues[_0x53c573['secondtransfererlinkedid']][_0x44b5('0x44')]=!![];queues[_0x53c573[_0x44b5('0x55')]][_0x44b5('0x49')]=_0x44b5('0x56');queues[_0x53c573['secondtransfererlinkedid']][_0x44b5('0x4a')]=_0x53c573['origtransfererexten'];queues[_0x53c573[_0x44b5('0x55')]]['transferuniqueid']=_0x53c573[_0x44b5('0x51')];queues[_0x53c573[_0x44b5('0x55')]][_0x44b5('0x7')]=_0x44b5('0x57');}if(!_['isNil'](queues[_0x53c573[_0x44b5('0x52')]])){if(_0x53c573[_0x44b5('0x58')]&&queues[_0x53c573[_0x44b5('0x58')]]){queues[_0x53c573['transfereelinkedid']][_0x44b5('0x21')]=0x1;queues[_0x53c573[_0x44b5('0x47')]]=_[_0x44b5('0x59')](queues[_0x53c573['transfereelinkedid']]);queues[_0x53c573[_0x44b5('0x47')]][_0x44b5('0xe')]=_0x53c573[_0x44b5('0x5a')];queues[_0x53c573[_0x44b5('0x47')]][_0x44b5('0x21')]=0x2;queues[_0x53c573[_0x44b5('0x47')]][_0x44b5('0x6')]=queues[_0x53c573[_0x44b5('0x55')]][_0x44b5('0x6')];queues[_0x53c573['transfereeuniqueid']][_0x44b5('0x5b')]=queues[_0x53c573[_0x44b5('0x55')]][_0x44b5('0x5b')];queues[_0x53c573['transfereeuniqueid']][_0x44b5('0x5c')]=utils[_0x44b5('0x15')]();queues[_0x53c573[_0x44b5('0x47')]][_0x44b5('0x19')]=utils[_0x44b5('0x15')]();queues[_0x53c573['transfereeuniqueid']][_0x44b5('0x36')]=0x0;queues[_0x53c573['transfereeuniqueid']][_0x44b5('0x5d')]=0x0;utils['info'](util[_0x44b5('0x3')](_0x44b5('0x5e'),_0x53c573[_0x44b5('0x51')],queues[_0x53c573[_0x44b5('0x47')]][_0x44b5('0x20')],queues[_0x53c573[_0x44b5('0x47')]][_0x44b5('0x6')],queues[_0x53c573['transfereeuniqueid']][_0x44b5('0x5b')]));}else{utils[_0x44b5('0x2')](util[_0x44b5('0x3')](_0x44b5('0x5f'),_0x53c573['origtransfereruniqueid'],queues[_0x53c573[_0x44b5('0x52')]][_0x44b5('0x20')],_0x53c573[_0x44b5('0x55')]));queues[_0x53c573[_0x44b5('0x52')]]['transfereduniqueid']=_0x53c573[_0x44b5('0x55')];}}}else if(_0x53c573[_0x44b5('0x60')]==_0x53c573[_0x44b5('0x55')]){if(!_[_0x44b5('0x17')](queues[_0x53c573[_0x44b5('0x52')]])){utils[_0x44b5('0x2')](util[_0x44b5('0x3')](_0x44b5('0x61'),_0x53c573[_0x44b5('0x51')],queues[_0x53c573['origtransfererlinkedid']][_0x44b5('0x20')],_0x53c573[_0x44b5('0x60')],_0x53c573[_0x44b5('0x62')]));queues[_0x53c573['origtransfererlinkedid']][_0x44b5('0x44')]=!![];queues[_0x53c573['origtransfererlinkedid']]['transfertype']=_0x44b5('0x56');queues[_0x53c573['origtransfererlinkedid']][_0x44b5('0x4a')]=_0x53c573[_0x44b5('0x62')];queues[_0x53c573[_0x44b5('0x52')]][_0x44b5('0x4c')]=_0x53c573[_0x44b5('0x60')];queues[_0x53c573[_0x44b5('0x52')]][_0x44b5('0x7')]=_0x44b5('0x57');}if(!_[_0x44b5('0x17')](queues[_0x53c573[_0x44b5('0x55')]])){if(_0x53c573['transfertargetlinkedid']&&queues[_0x53c573[_0x44b5('0x63')]]){queues[_0x53c573[_0x44b5('0x63')]][_0x44b5('0x21')]=0x1;queues[_0x53c573[_0x44b5('0x5a')]]=_[_0x44b5('0x59')](queues[_0x53c573[_0x44b5('0x63')]]);queues[_0x53c573[_0x44b5('0x5a')]]['transfereduniqueid']=_0x53c573[_0x44b5('0x5a')];queues[_0x53c573[_0x44b5('0x5a')]][_0x44b5('0x21')]=0x2;queues[_0x53c573['transfertargetuniqueid']]['calleridnum']=queues[_0x53c573[_0x44b5('0x52')]][_0x44b5('0x6')];queues[_0x53c573[_0x44b5('0x5a')]][_0x44b5('0x5b')]=queues[_0x53c573[_0x44b5('0x52')]][_0x44b5('0x5b')];queues[_0x53c573[_0x44b5('0x5a')]][_0x44b5('0x5c')]=utils[_0x44b5('0x15')]();queues[_0x53c573['transfertargetuniqueid']][_0x44b5('0x19')]=utils['now']();queues[_0x53c573[_0x44b5('0x5a')]][_0x44b5('0x36')]=0x0;queues[_0x53c573[_0x44b5('0x5a')]]['mohtime']=0x0;utils[_0x44b5('0x2')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s',_0x53c573['origtransfereruniqueid'],queues[_0x53c573[_0x44b5('0x5a')]][_0x44b5('0x20')],queues[_0x53c573[_0x44b5('0x5a')]][_0x44b5('0xe')],queues[_0x53c573['transfertargetuniqueid']][_0x44b5('0x6')],queues[_0x53c573[_0x44b5('0x5a')]]['calleridname']));}else{utils[_0x44b5('0x2')](util[_0x44b5('0x3')](_0x44b5('0x5f'),_0x53c573[_0x44b5('0x51')],queues[_0x53c573[_0x44b5('0x55')]][_0x44b5('0x20')],_0x53c573[_0x44b5('0x52')]));queues[_0x53c573['secondtransfererlinkedid']]['transfereduniqueid']=_0x53c573['origtransfererlinkedid'];}}}}catch(_0x2d8a39){utils[_0x44b5('0x22')](util[_0x44b5('0x3')](_0x44b5('0x50'),_0x53c573[_0x44b5('0x51')]),_0x2d8a39);}};exports[_0x44b5('0x64')]=function(_0x37f770){try{if(!_[_0x44b5('0x17')](queues[_0x37f770[_0x44b5('0xf')]])){utils['debug'](util['format'](_0x44b5('0x65'),_0x37f770[_0x44b5('0xf')]),_0x37f770);queues[_0x37f770[_0x44b5('0xf')]][_0x44b5('0x66')]=utils[_0x44b5('0x15')]();utils[_0x44b5('0x2')](util['format'](_0x44b5('0x67'),_0x37f770[_0x44b5('0xf')],queues[_0x37f770[_0x44b5('0xf')]]['name'],queues[_0x37f770[_0x44b5('0xf')]][_0x44b5('0x66')]));}}catch(_0x26078e){utils[_0x44b5('0x22')](util[_0x44b5('0x3')](_0x44b5('0x65'),_0x37f770[_0x44b5('0xf')]),_0x26078e);}};exports['musiconholdstop']=function(_0x669c42){try{if(!_[_0x44b5('0x17')](queues[_0x669c42[_0x44b5('0xf')]])){if(!_['isNil'](queues[_0x669c42[_0x44b5('0xf')]][_0x44b5('0x66')])){utils[_0x44b5('0x11')](util[_0x44b5('0x3')]('[%s][queues][musiconholdstop]',_0x669c42[_0x44b5('0xf')]),_0x669c42);queues[_0x669c42['uniqueid']][_0x44b5('0x5d')]+=utils[_0x44b5('0x37')](utils[_0x44b5('0x15')](),queues[_0x669c42[_0x44b5('0xf')]]['musiconholdstartAt']);utils[_0x44b5('0x2')](util[_0x44b5('0x3')](_0x44b5('0x68'),_0x669c42['uniqueid'],queues[_0x669c42['uniqueid']]['name'],queues[_0x669c42[_0x44b5('0xf')]]['mohtime']));delete queues[_0x669c42['uniqueid']][_0x44b5('0x66')];}}}catch(_0x2c375f){utils[_0x44b5('0x22')](util[_0x44b5('0x3')]('[%s][queues][musiconholdstop]',_0x669c42['uniqueid']),_0x2c375f);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index f83b4a9..674cf8a 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 _0x4baf=['request','CreateVoiceRecording','[%s][recordings][newchannel]','linkedid','exten','context','channel','error','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','.wav49','value','replace','monitors','hangup','[%s][recordings][hangup]','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','outbound','debug','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','set','startsWith','appdata','cdr','split','substring','lastIndexOf','[%s][recordings][newexten]','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','util','./utils','info','format','uniqueid','accountcode','then','membername','name','UserId'];(function(_0x2a6809,_0x44edde){var _0x11c371=function(_0x1a4888){while(--_0x1a4888){_0x2a6809['push'](_0x2a6809['shift']());}};_0x11c371(++_0x44edde);}(_0x4baf,0x17d));var _0xf4ba=function(_0x1d9cc8,_0x5248dc){_0x1d9cc8=_0x1d9cc8-0x0;var _0x116175=_0x4baf[_0x1d9cc8];return _0x116175;};'use strict';var _=require(_0xf4ba('0x0'));var util=require(_0xf4ba('0x1'));var utils=require(_0xf4ba('0x2'));var recordings={};function writeDB(_0x3652a2){utils[_0xf4ba('0x3')](util[_0xf4ba('0x4')]('[%s][recordings][writeDB]',_0x3652a2[_0xf4ba('0x5')]));if(_0x3652a2[_0xf4ba('0x6')]){utils['getUserByInternal'](_0x3652a2['accountcode'])[_0xf4ba('0x7')](function(_0xaf5f2c){if(_0xaf5f2c){_0x3652a2[_0xf4ba('0x8')]=_0xaf5f2c[_0xf4ba('0x9')];_0x3652a2[_0xf4ba('0xa')]=_0xaf5f2c['id'];}utils[_0xf4ba('0xb')](_0xf4ba('0xc'),_0x3652a2);});}else{utils[_0xf4ba('0xb')](_0xf4ba('0xc'),_0x3652a2);}}exports['newchannel']=function(_0x598402){try{utils['debug'](util[_0xf4ba('0x4')](_0xf4ba('0xd'),_0x598402[_0xf4ba('0x5')]),_0x598402);if(_0x598402[_0xf4ba('0x5')]==_0x598402[_0xf4ba('0xe')]){utils[_0xf4ba('0x3')](util[_0xf4ba('0x4')]('[%s][recordings][newchannel]\x20context:%s\x20exten:%s',_0x598402[_0xf4ba('0x5')],_0x598402['context'],_0x598402['exten']));recordings[_0x598402[_0xf4ba('0x5')]]={'uniqueid':_0x598402[_0xf4ba('0x5')],'accountcode':_0x598402[_0xf4ba('0x6')],'exten':_0x598402[_0xf4ba('0xf')],'context':_0x598402[_0xf4ba('0x10')],'channel':_0x598402[_0xf4ba('0x11')],'monitors':[]};}}catch(_0xdc3454){utils[_0xf4ba('0x12')](util[_0xf4ba('0x4')](_0xf4ba('0xd'),_0x598402[_0xf4ba('0x5')]),_0xdc3454);}};exports['newstate']=function(_0x5be3a8){try{utils['debug'](util[_0xf4ba('0x4')](_0xf4ba('0x13'),_0x5be3a8[_0xf4ba('0x5')]),_0x5be3a8);if(!_[_0xf4ba('0x14')](recordings[_0x5be3a8[_0xf4ba('0x5')]])&&_0x5be3a8[_0xf4ba('0x15')]==0x6){utils[_0xf4ba('0x3')](util[_0xf4ba('0x4')](_0xf4ba('0x16'),_0x5be3a8[_0xf4ba('0x5')],_0x5be3a8[_0xf4ba('0x10')],_0x5be3a8['channel']));}else if(!_[_0xf4ba('0x14')](recordings[_0x5be3a8[_0xf4ba('0xe')]])&&_0x5be3a8[_0xf4ba('0x15')]==0x6&&_0x5be3a8[_0xf4ba('0x10')]!='transfer'){utils[_0xf4ba('0x3')](util['format'](_0xf4ba('0x17'),_0x5be3a8[_0xf4ba('0x5')],_0x5be3a8[_0xf4ba('0xe')],_0x5be3a8[_0xf4ba('0x10')],_0x5be3a8[_0xf4ba('0x11')]));recordings[_0x5be3a8[_0xf4ba('0xe')]][_0xf4ba('0x6')]=_0x5be3a8[_0xf4ba('0x6')];}}catch(_0x2b60fb){utils['error'](util[_0xf4ba('0x4')]('[%s][recordings][newstate]',_0x5be3a8[_0xf4ba('0x5')]),_0x2b60fb);}};exports['varset']=function(_0x4940b9){try{if(!_['isNil'](_0x4940b9[_0xf4ba('0x18')])&&!_['isNil'](_0x4940b9[_0xf4ba('0x18')][_0xf4ba('0x19')])){utils['debug'](util['format'](_0xf4ba('0x1a'),_0x4940b9[_0xf4ba('0x5')]),_0x4940b9);utils[_0xf4ba('0x3')](util[_0xf4ba('0x4')](_0xf4ba('0x1b'),_0x4940b9[_0xf4ba('0x5')],_0x4940b9['variable'],_0x4940b9['value']));if(_['endsWith'](_0x4940b9['value'],_0xf4ba('0x1c'))){_0x4940b9[_0xf4ba('0x1d')]=_0x4940b9[_0xf4ba('0x1d')][_0xf4ba('0x1e')]('.wav49','.WAV');}if(recordings[_0x4940b9[_0xf4ba('0xe')]]){var _0x1112ab=_['find'](recordings[_0x4940b9[_0xf4ba('0xe')]][_0xf4ba('0x1f')],{'value':_0x4940b9['value']});if(_[_0xf4ba('0x14')](_0x1112ab)){recordings[_0x4940b9['linkedid']][_0xf4ba('0x1f')]['push']({'value':_0x4940b9[_0xf4ba('0x1d')]});}}}}catch(_0x210421){utils[_0xf4ba('0x12')](util[_0xf4ba('0x4')](_0xf4ba('0x1a'),_0x4940b9[_0xf4ba('0x5')]),_0x210421);}};exports[_0xf4ba('0x20')]=function(_0x37463f){try{if(!_[_0xf4ba('0x14')](recordings[_0x37463f[_0xf4ba('0x5')]])){utils['debug'](util[_0xf4ba('0x4')](_0xf4ba('0x21'),_0x37463f[_0xf4ba('0x5')]),_0x37463f);utils[_0xf4ba('0x3')](util[_0xf4ba('0x4')]('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x37463f[_0xf4ba('0x5')],_0x37463f[_0xf4ba('0x22')],_0x37463f[_0xf4ba('0x23')],_0x37463f[_0xf4ba('0x24')]));recordings[_0x37463f[_0xf4ba('0x5')]]['calleridnum']=_0x37463f[_0xf4ba('0x22')];recordings[_0x37463f[_0xf4ba('0x5')]][_0xf4ba('0x23')]=_0x37463f[_0xf4ba('0x23')];recordings[_0x37463f['uniqueid']][_0xf4ba('0x25')]=_0x37463f[_0xf4ba('0x25')];recordings[_0x37463f['uniqueid']][_0xf4ba('0x26')]=_0x37463f[_0xf4ba('0x26')];if(recordings[_0x37463f[_0xf4ba('0x5')]][_0xf4ba('0x27')]==_0xf4ba('0x28')&&recordings[_0x37463f[_0xf4ba('0x5')]][_0xf4ba('0x6')]){recordings[_0x37463f[_0xf4ba('0x5')]][_0xf4ba('0x25')]=recordings[_0x37463f[_0xf4ba('0x5')]][_0xf4ba('0x6')];recordings[_0x37463f[_0xf4ba('0x5')]]['connectedlinename']='';}recordings[_0x37463f[_0xf4ba('0x5')]][_0xf4ba('0x1f')]['forEach'](function(_0x3bd3e0){var _0x5998e6=_['clone'](recordings[_0x37463f[_0xf4ba('0x5')]]);_0x5998e6[_0xf4ba('0x1d')]=_0x3bd3e0[_0xf4ba('0x1d')];writeDB(_0x5998e6);});delete recordings[_0x37463f[_0xf4ba('0x5')]];}}catch(_0x546306){utils[_0xf4ba('0x12')](util[_0xf4ba('0x4')](_0xf4ba('0x21'),_0x37463f[_0xf4ba('0x5')]),_0x546306);}};exports['newexten']=function(_0x59d5e5){try{if(!_['isNil'](recordings[_0x59d5e5['uniqueid']])){utils[_0xf4ba('0x29')](util[_0xf4ba('0x4')]('[%s][recordings][newexten]',_0x59d5e5['uniqueid']),_0x59d5e5);utils['info'](util['format'](_0xf4ba('0x2a'),_0x59d5e5['uniqueid'],_0x59d5e5[_0xf4ba('0x2b')],_0x59d5e5['appdata']));if(_0x59d5e5[_0xf4ba('0x2b')]['toLowerCase']()==_0xf4ba('0x2c')&&_[_0xf4ba('0x2d')](_0x59d5e5[_0xf4ba('0x2e')]['toLowerCase'](),_0xf4ba('0x2f'))){var _0x2b7767=_0x59d5e5['appdata'][_0xf4ba('0x30')]('=');var _0x2f9b1b=_0x2b7767[0x0][_0xf4ba('0x31')](_0x2b7767[0x0]['lastIndexOf']('(')+0x1,_0x2b7767[0x0][_0xf4ba('0x32')](')'));var _0x43f228=_0x2b7767[0x1];recordings[_0x59d5e5[_0xf4ba('0x5')]][_0x2f9b1b]=_0x43f228;}}}catch(_0x1e69fe){utils['error'](util['format'](_0xf4ba('0x33'),_0x59d5e5['uniqueid']),_0x1e69fe);}};exports[_0xf4ba('0x34')]=function(_0x4726cd){try{if(!_[_0xf4ba('0x14')](recordings[_0x4726cd['uniqueid']])){utils[_0xf4ba('0x29')](util[_0xf4ba('0x4')](_0xf4ba('0x35'),_0x4726cd[_0xf4ba('0x5')]),_0x4726cd);utils[_0xf4ba('0x3')](util[_0xf4ba('0x4')](_0xf4ba('0x36'),_0x4726cd[_0xf4ba('0x5')],_0x4726cd[_0xf4ba('0x37')]));recordings[_0x4726cd[_0xf4ba('0x5')]][_0xf4ba('0x37')]=_0x4726cd['queue'];}}catch(_0x480537){utils[_0xf4ba('0x12')](util[_0xf4ba('0x4')](_0xf4ba('0x35'),_0x4726cd[_0xf4ba('0x5')]),_0x480537);}}; \ No newline at end of file +var _0x70ff=['set','cdr','substring','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','info','format','[%s][recordings][writeDB]','uniqueid','getUserByInternal','then','UserId','request','CreateVoiceRecording','debug','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','accountcode','channel','error','[%s][recordings][newchannel]','newstate','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','linkedid','transfer','varset','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','.wav49','replace','.WAV','find','monitors','push','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','outbound','forEach','clone','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','appdata','application'];(function(_0x2c4d60,_0x35fd6e){var _0xca32f9=function(_0x5b34a7){while(--_0x5b34a7){_0x2c4d60['push'](_0x2c4d60['shift']());}};_0xca32f9(++_0x35fd6e);}(_0x70ff,0x1e7));var _0xf70f=function(_0x221c0e,_0x1cf4e5){_0x221c0e=_0x221c0e-0x0;var _0x1ffc3a=_0x70ff[_0x221c0e];return _0x1ffc3a;};'use strict';var _=require(_0xf70f('0x0'));var util=require('util');var utils=require('./utils');var recordings={};function writeDB(_0x429b50){utils[_0xf70f('0x1')](util[_0xf70f('0x2')](_0xf70f('0x3'),_0x429b50[_0xf70f('0x4')]));if(_0x429b50['accountcode']){utils[_0xf70f('0x5')](_0x429b50['accountcode'])[_0xf70f('0x6')](function(_0x9ef029){if(_0x9ef029){_0x429b50['membername']=_0x9ef029['name'];_0x429b50[_0xf70f('0x7')]=_0x9ef029['id'];}utils[_0xf70f('0x8')]('CreateVoiceRecording',_0x429b50);});}else{utils[_0xf70f('0x8')](_0xf70f('0x9'),_0x429b50);}}exports['newchannel']=function(_0x389464){try{utils[_0xf70f('0xa')](util[_0xf70f('0x2')]('[%s][recordings][newchannel]',_0x389464[_0xf70f('0x4')]),_0x389464);if(_0x389464[_0xf70f('0x4')]==_0x389464['linkedid']){utils[_0xf70f('0x1')](util['format'](_0xf70f('0xb'),_0x389464[_0xf70f('0x4')],_0x389464[_0xf70f('0xc')],_0x389464[_0xf70f('0xd')]));recordings[_0x389464[_0xf70f('0x4')]]={'uniqueid':_0x389464['uniqueid'],'accountcode':_0x389464[_0xf70f('0xe')],'exten':_0x389464[_0xf70f('0xd')],'context':_0x389464[_0xf70f('0xc')],'channel':_0x389464[_0xf70f('0xf')],'monitors':[]};}}catch(_0x246f6c){utils[_0xf70f('0x10')](util[_0xf70f('0x2')](_0xf70f('0x11'),_0x389464[_0xf70f('0x4')]),_0x246f6c);}};exports[_0xf70f('0x12')]=function(_0x3b071d){try{utils[_0xf70f('0xa')](util['format'](_0xf70f('0x13'),_0x3b071d[_0xf70f('0x4')]),_0x3b071d);if(!_[_0xf70f('0x14')](recordings[_0x3b071d[_0xf70f('0x4')]])&&_0x3b071d[_0xf70f('0x15')]==0x6){utils['info'](util[_0xf70f('0x2')](_0xf70f('0x16'),_0x3b071d[_0xf70f('0x4')],_0x3b071d[_0xf70f('0xc')],_0x3b071d[_0xf70f('0xf')]));}else if(!_[_0xf70f('0x14')](recordings[_0x3b071d[_0xf70f('0x17')]])&&_0x3b071d['channelstate']==0x6&&_0x3b071d[_0xf70f('0xc')]!=_0xf70f('0x18')){utils[_0xf70f('0x1')](util[_0xf70f('0x2')]('[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x3b071d[_0xf70f('0x4')],_0x3b071d[_0xf70f('0x17')],_0x3b071d[_0xf70f('0xc')],_0x3b071d[_0xf70f('0xf')]));recordings[_0x3b071d[_0xf70f('0x17')]]['accountcode']=_0x3b071d[_0xf70f('0xe')];}}catch(_0xcb8a44){utils['error'](util[_0xf70f('0x2')](_0xf70f('0x13'),_0x3b071d[_0xf70f('0x4')]),_0xcb8a44);}};exports[_0xf70f('0x19')]=function(_0x1ac0cd){try{if(!_[_0xf70f('0x14')](_0x1ac0cd[_0xf70f('0x1a')])&&!_[_0xf70f('0x14')](_0x1ac0cd[_0xf70f('0x1a')][_0xf70f('0x1b')])){utils[_0xf70f('0xa')](util[_0xf70f('0x2')](_0xf70f('0x1c'),_0x1ac0cd['uniqueid']),_0x1ac0cd);utils['info'](util[_0xf70f('0x2')](_0xf70f('0x1d'),_0x1ac0cd[_0xf70f('0x4')],_0x1ac0cd['variable'],_0x1ac0cd['value']));if(_['endsWith'](_0x1ac0cd[_0xf70f('0x1e')],_0xf70f('0x1f'))){_0x1ac0cd['value']=_0x1ac0cd[_0xf70f('0x1e')][_0xf70f('0x20')]('.wav49',_0xf70f('0x21'));}if(recordings[_0x1ac0cd[_0xf70f('0x17')]]){var _0x413e90=_[_0xf70f('0x22')](recordings[_0x1ac0cd['linkedid']][_0xf70f('0x23')],{'value':_0x1ac0cd[_0xf70f('0x1e')]});if(_[_0xf70f('0x14')](_0x413e90)){recordings[_0x1ac0cd['linkedid']][_0xf70f('0x23')][_0xf70f('0x24')]({'value':_0x1ac0cd['value']});}}}}catch(_0x5f10db){utils[_0xf70f('0x10')](util[_0xf70f('0x2')]('[%s][recordings][varset]',_0x1ac0cd['uniqueid']),_0x5f10db);}};exports[_0xf70f('0x25')]=function(_0x373ea9){try{if(!_[_0xf70f('0x14')](recordings[_0x373ea9[_0xf70f('0x4')]])){utils['debug'](util[_0xf70f('0x2')](_0xf70f('0x26'),_0x373ea9[_0xf70f('0x4')]),_0x373ea9);utils['info'](util[_0xf70f('0x2')](_0xf70f('0x27'),_0x373ea9[_0xf70f('0x4')],_0x373ea9[_0xf70f('0x28')],_0x373ea9[_0xf70f('0x29')],_0x373ea9[_0xf70f('0x2a')]));recordings[_0x373ea9[_0xf70f('0x4')]][_0xf70f('0x28')]=_0x373ea9[_0xf70f('0x28')];recordings[_0x373ea9[_0xf70f('0x4')]][_0xf70f('0x29')]=_0x373ea9[_0xf70f('0x29')];recordings[_0x373ea9[_0xf70f('0x4')]][_0xf70f('0x2b')]=_0x373ea9[_0xf70f('0x2b')];recordings[_0x373ea9[_0xf70f('0x4')]]['connectedlinename']=_0x373ea9[_0xf70f('0x2c')];if(recordings[_0x373ea9[_0xf70f('0x4')]]['type']==_0xf70f('0x2d')&&recordings[_0x373ea9[_0xf70f('0x4')]]['accountcode']){recordings[_0x373ea9[_0xf70f('0x4')]][_0xf70f('0x2b')]=recordings[_0x373ea9['uniqueid']][_0xf70f('0xe')];recordings[_0x373ea9[_0xf70f('0x4')]][_0xf70f('0x2c')]='';}recordings[_0x373ea9[_0xf70f('0x4')]][_0xf70f('0x23')][_0xf70f('0x2e')](function(_0x48559b){var _0x50878a=_[_0xf70f('0x2f')](recordings[_0x373ea9[_0xf70f('0x4')]]);_0x50878a[_0xf70f('0x1e')]=_0x48559b[_0xf70f('0x1e')];writeDB(_0x50878a);});delete recordings[_0x373ea9[_0xf70f('0x4')]];}}catch(_0x3d74ae){utils[_0xf70f('0x10')](util[_0xf70f('0x2')](_0xf70f('0x26'),_0x373ea9[_0xf70f('0x4')]),_0x3d74ae);}};exports[_0xf70f('0x30')]=function(_0x38c4b8){try{if(!_[_0xf70f('0x14')](recordings[_0x38c4b8[_0xf70f('0x4')]])){utils[_0xf70f('0xa')](util[_0xf70f('0x2')](_0xf70f('0x31'),_0x38c4b8[_0xf70f('0x4')]),_0x38c4b8);utils[_0xf70f('0x1')](util['format'](_0xf70f('0x32'),_0x38c4b8[_0xf70f('0x4')],_0x38c4b8['application'],_0x38c4b8[_0xf70f('0x33')]));if(_0x38c4b8[_0xf70f('0x34')]['toLowerCase']()==_0xf70f('0x35')&&_['startsWith'](_0x38c4b8[_0xf70f('0x33')]['toLowerCase'](),_0xf70f('0x36'))){var _0x4a7ad1=_0x38c4b8[_0xf70f('0x33')]['split']('=');var _0x5059a6=_0x4a7ad1[0x0][_0xf70f('0x37')](_0x4a7ad1[0x0]['lastIndexOf']('(')+0x1,_0x4a7ad1[0x0]['lastIndexOf'](')'));var _0x122638=_0x4a7ad1[0x1];recordings[_0x38c4b8['uniqueid']][_0x5059a6]=_0x122638;}}}catch(_0x39c558){utils[_0xf70f('0x10')](util[_0xf70f('0x2')](_0xf70f('0x31'),_0x38c4b8[_0xf70f('0x4')]),_0x39c558);}};exports[_0xf70f('0x38')]=function(_0x51b9a4){try{if(!_[_0xf70f('0x14')](recordings[_0x51b9a4['uniqueid']])){utils[_0xf70f('0xa')](util[_0xf70f('0x2')](_0xf70f('0x39'),_0x51b9a4[_0xf70f('0x4')]),_0x51b9a4);utils[_0xf70f('0x1')](util['format'](_0xf70f('0x3a'),_0x51b9a4[_0xf70f('0x4')],_0x51b9a4[_0xf70f('0x3b')]));recordings[_0x51b9a4[_0xf70f('0x4')]][_0xf70f('0x3b')]=_0x51b9a4['queue'];}}catch(_0x1157b0){utils['error'](util[_0xf70f('0x2')]('[%s][recordings][queuecallerjoin]',_0x51b9a4['uniqueid']),_0x1157b0);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index f85a679..94a1436 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 _0xa322=['transfertargetconnectedlinename','transfertargetaccountcode','transfertargetexten','lodash','util','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','type','attended','uniqueid','request','CreateVoiceTransferReport','blindtransfer','debug','transferercalleridname','transfereecalleridname','blind','error','[%s][transfers][attendedtransfer]','origtransfereruniqueid','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','assign','origtransfererchannel','secondtransfererconnectedlinenum','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransferercontext','origtransfererexten','isNil','transfereechannel','transfertargetchannel','transfertargetcalleridname'];(function(_0x506cbe,_0x818678){var _0x4fdaa7=function(_0x28db18){while(--_0x28db18){_0x506cbe['push'](_0x506cbe['shift']());}};_0x4fdaa7(++_0x818678);}(_0xa322,0x150));var _0x2a32=function(_0x2fa00d,_0x1c8477){_0x2fa00d=_0x2fa00d-0x0;var _0x46e818=_0xa322[_0x2fa00d];return _0x46e818;};'use strict';var _=require(_0x2a32('0x0'));var util=require(_0x2a32('0x1'));var utils=require(_0x2a32('0x2'));function writeDB(_0x5150c1){utils[_0x2a32('0x3')](util[_0x2a32('0x4')](_0x2a32('0x5'),_0x5150c1[_0x2a32('0x6')]===_0x2a32('0x7')?_0x5150c1['origtransfereruniqueid']:_0x5150c1[_0x2a32('0x8')],_0x5150c1['type']));utils[_0x2a32('0x9')](_0x2a32('0xa'),_0x5150c1);}exports[_0x2a32('0xb')]=function(_0x3ceeb1){try{utils[_0x2a32('0xc')](util['format']('[%s][transfers][blindtransfer]',_0x3ceeb1[_0x2a32('0x8')]),_0x3ceeb1);utils[_0x2a32('0x3')](util[_0x2a32('0x4')]('[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x3ceeb1[_0x2a32('0x8')],_0x3ceeb1['transferercalleridnum'],_0x3ceeb1[_0x2a32('0xd')],_0x3ceeb1['transfereecalleridnum'],_0x3ceeb1[_0x2a32('0xe')]));_0x3ceeb1[_0x2a32('0x6')]=_0x2a32('0xf');writeDB(_0x3ceeb1);}catch(_0x5f41dc){utils[_0x2a32('0x10')](util[_0x2a32('0x4')]('[%s][transfers][blindtransfer]',_0x3ceeb1[_0x2a32('0x8')]),_0x5f41dc);}};exports['attendedtransfer']=function(_0x4389e0){try{utils[_0x2a32('0xc')](util['format'](_0x2a32('0x11'),_0x4389e0[_0x2a32('0x12')]),_0x4389e0);utils[_0x2a32('0x3')](util[_0x2a32('0x4')]('[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x4389e0[_0x2a32('0x12')],_0x4389e0[_0x2a32('0x13')],_0x4389e0[_0x2a32('0x14')],_0x4389e0[_0x2a32('0x15')],_0x4389e0['transfertargetcalleridname']));_0x4389e0=_[_0x2a32('0x16')](_0x4389e0,{'transfererchannel':_0x4389e0[_0x2a32('0x17')],'transferercalleridnum':_0x4389e0[_0x2a32('0x13')],'transferercalleridname':_0x4389e0[_0x2a32('0x14')],'transfererconnectedlinenum':_0x4389e0[_0x2a32('0x18')],'transfererconnectedlinename':_0x4389e0['secondtransfererconnectedlinename'],'transfereraccountcode':_0x4389e0[_0x2a32('0x19')],'transferercontext':_0x4389e0[_0x2a32('0x1a')],'transfererexten':_0x4389e0[_0x2a32('0x1b')],'transfererlinkedid':_0x4389e0['origtransfererlinkedid'],'context':_0x4389e0[_0x2a32('0x1c')],'extension':_0x4389e0[_0x2a32('0x1d')],'type':_0x2a32('0x7')});if(_[_0x2a32('0x1e')](_0x4389e0[_0x2a32('0x1f')])){_0x4389e0=_['assign'](_0x4389e0,{'transfereechannel':_0x4389e0[_0x2a32('0x20')],'transfereecalleridnum':_0x4389e0[_0x2a32('0x15')],'transfereecalleridname':_0x4389e0[_0x2a32('0x21')],'transfereeconnectedlinenum':_0x4389e0['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x4389e0[_0x2a32('0x22')],'transfereeaccountcode':_0x4389e0[_0x2a32('0x23')],'transfereecontext':_0x4389e0['transfertargetcontext'],'transfereeexten':_0x4389e0[_0x2a32('0x24')],'transfereelinkedid':_0x4389e0['transfertargetlinkedid']});}writeDB(_0x4389e0);}catch(_0x5c3c40){utils[_0x2a32('0x10')](util[_0x2a32('0x4')]('[%s][transfers][attendedtransfer]',_0x4389e0[_0x2a32('0x12')]),_0x5c3c40);}}; \ No newline at end of file +var _0x5aff=['origtransfererlinkedid','origtransferercontext','origtransfererexten','isNil','transfereechannel','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','util','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','attended','origtransfereruniqueid','uniqueid','type','request','CreateVoiceTransferReport','blindtransfer','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transfereecalleridnum','transfereecalleridname','blind','error','attendedtransfer','debug','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','assign','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten'];(function(_0x3da26c,_0x401133){var _0x470b27=function(_0x19a824){while(--_0x19a824){_0x3da26c['push'](_0x3da26c['shift']());}};_0x470b27(++_0x401133);}(_0x5aff,0xc0));var _0xf5af=function(_0x1b2baf,_0x5e2a94){_0x1b2baf=_0x1b2baf-0x0;var _0x3d25a4=_0x5aff[_0x1b2baf];return _0x3d25a4;};'use strict';var _=require('lodash');var util=require(_0xf5af('0x0'));var utils=require(_0xf5af('0x1'));function writeDB(_0x3475f2){utils[_0xf5af('0x2')](util[_0xf5af('0x3')](_0xf5af('0x4'),_0x3475f2['type']===_0xf5af('0x5')?_0x3475f2[_0xf5af('0x6')]:_0x3475f2[_0xf5af('0x7')],_0x3475f2[_0xf5af('0x8')]));utils[_0xf5af('0x9')](_0xf5af('0xa'),_0x3475f2);}exports[_0xf5af('0xb')]=function(_0x159c26){try{utils['debug'](util[_0xf5af('0x3')](_0xf5af('0xc'),_0x159c26[_0xf5af('0x7')]),_0x159c26);utils[_0xf5af('0x2')](util[_0xf5af('0x3')](_0xf5af('0xd'),_0x159c26[_0xf5af('0x7')],_0x159c26[_0xf5af('0xe')],_0x159c26['transferercalleridname'],_0x159c26[_0xf5af('0xf')],_0x159c26[_0xf5af('0x10')]));_0x159c26[_0xf5af('0x8')]=_0xf5af('0x11');writeDB(_0x159c26);}catch(_0x5204a7){utils[_0xf5af('0x12')](util[_0xf5af('0x3')](_0xf5af('0xc'),_0x159c26[_0xf5af('0x7')]),_0x5204a7);}};exports[_0xf5af('0x13')]=function(_0x5ee57c){try{utils[_0xf5af('0x14')](util['format'](_0xf5af('0x15'),_0x5ee57c[_0xf5af('0x6')]),_0x5ee57c);utils[_0xf5af('0x2')](util[_0xf5af('0x3')](_0xf5af('0x16'),_0x5ee57c[_0xf5af('0x6')],_0x5ee57c[_0xf5af('0x17')],_0x5ee57c[_0xf5af('0x18')],_0x5ee57c[_0xf5af('0x19')],_0x5ee57c['transfertargetcalleridname']));_0x5ee57c=_[_0xf5af('0x1a')](_0x5ee57c,{'transfererchannel':_0x5ee57c[_0xf5af('0x1b')],'transferercalleridnum':_0x5ee57c[_0xf5af('0x17')],'transferercalleridname':_0x5ee57c[_0xf5af('0x18')],'transfererconnectedlinenum':_0x5ee57c[_0xf5af('0x1c')],'transfererconnectedlinename':_0x5ee57c[_0xf5af('0x1d')],'transfereraccountcode':_0x5ee57c[_0xf5af('0x1e')],'transferercontext':_0x5ee57c[_0xf5af('0x1f')],'transfererexten':_0x5ee57c[_0xf5af('0x20')],'transfererlinkedid':_0x5ee57c[_0xf5af('0x21')],'context':_0x5ee57c[_0xf5af('0x22')],'extension':_0x5ee57c[_0xf5af('0x23')],'type':'attended'});if(_[_0xf5af('0x24')](_0x5ee57c[_0xf5af('0x25')])){_0x5ee57c=_[_0xf5af('0x1a')](_0x5ee57c,{'transfereechannel':_0x5ee57c[_0xf5af('0x26')],'transfereecalleridnum':_0x5ee57c[_0xf5af('0x19')],'transfereecalleridname':_0x5ee57c['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x5ee57c[_0xf5af('0x27')],'transfereeconnectedlinename':_0x5ee57c[_0xf5af('0x28')],'transfereeaccountcode':_0x5ee57c[_0xf5af('0x29')],'transfereecontext':_0x5ee57c[_0xf5af('0x2a')],'transfereeexten':_0x5ee57c[_0xf5af('0x2b')],'transfereelinkedid':_0x5ee57c[_0xf5af('0x2c')]});}writeDB(_0x5ee57c);}catch(_0x8140ae){utils[_0xf5af('0x12')](util[_0xf5af('0x3')]('[%s][transfers][attendedtransfer]',_0x5ee57c[_0xf5af('0x6')]),_0x8140ae);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 6ee2da9..2e97802 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 _0x081c=['debug','error','request','[utils][request]\x20name:%s','catch','GetUser','name','interface','then','stringify','result','length','getUserByInternal','found','notfound','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','type','acw','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diff','sumTime','now','isBefore','bluebird','http','../../config/logger','info','inspect'];(function(_0x52ed4d,_0x28b4ff){var _0x91a2ee=function(_0x4da835){while(--_0x4da835){_0x52ed4d['push'](_0x52ed4d['shift']());}};_0x91a2ee(++_0x28b4ff);}(_0x081c,0xeb));var _0xc081=function(_0x3dd3bc,_0x32950b){_0x3dd3bc=_0x3dd3bc-0x0;var _0x172373=_0x081c[_0x3dd3bc];return _0x172373;};'use strict';var BPromise=require(_0xc081('0x0'));var jayson=require('jayson/promise');var moment=require('moment');var util=require('util');var client=jayson['client'][_0xc081('0x1')]({'port':0x2329});var logger=require(_0xc081('0x2'))('xdr');exports[_0xc081('0x3')]=function(_0x5d0d77,_0x50b64c){logger[_0xc081('0x3')](_0x5d0d77,_0x50b64c?util[_0xc081('0x4')](_0x50b64c,{'showHidden':![],'depth':null}):'');};exports[_0xc081('0x5')]=function(_0x5ab694,_0x3c2663){logger['debug'](_0x5ab694,_0x3c2663?util[_0xc081('0x4')](_0x3c2663,{'showHidden':![],'depth':null}):'');};exports['error']=function(_0x24c8da,_0x12e6cf){logger[_0xc081('0x6')](_0x24c8da,_0x12e6cf?util['inspect'](_0x12e6cf,{'showHidden':![],'depth':null}):'');};exports[_0xc081('0x7')]=function(_0x402982,_0x3fa65d){return client[_0xc081('0x7')](_0x402982,{'body':_0x3fa65d})['then'](function(_0x25972d){logger[_0xc081('0x5')](_0xc081('0x8'),_0x402982,_0x25972d?util[_0xc081('0x4')](_0x25972d,{'showHidden':![],'depth':null}):'');})[_0xc081('0x9')](function(_0x483216){logger[_0xc081('0x6')](_0xc081('0x8'),_0x402982,_0x483216?util[_0xc081('0x4')](_0x483216,{'showHidden':![],'depth':null}):'');});};function getUser(_0x8987b3){return client[_0xc081('0x7')](_0xc081('0xa'),{'options':{'raw':!![],'attributes':['id','internal',_0xc081('0xb'),_0xc081('0xc')],'where':_0x8987b3,'limit':0x1}})[_0xc081('0xd')](function(_0x2e4a2f){logger['debug']('[utils][getUser]\x20where:%s',JSON[_0xc081('0xe')](_0x8987b3),_0x2e4a2f?util[_0xc081('0x4')](_0x2e4a2f,{'showHidden':![],'depth':null}):'');return _0x2e4a2f[_0xc081('0xf')][_0xc081('0x10')]?_0x2e4a2f[_0xc081('0xf')][0x0]:null;});}exports[_0xc081('0x11')]=function(_0x5be351){return new BPromise(function(_0x73a6d7,_0xfe3ba7){if(_0x5be351){return getUser({'internal':_0x5be351})[_0xc081('0xd')](function(_0x253485){logger[_0xc081('0x3')]('[utils][getUserByInternal]\x20internal:%s\x20%s',_0x5be351,_0x253485?_0xc081('0x12'):_0xc081('0x13'));return _0x73a6d7(_0x253485);})[_0xc081('0x9')](function(_0x402466){logger[_0xc081('0x6')](_0xc081('0x14'),_0x402466?util[_0xc081('0x4')](_0x402466,{'showHidden':![],'depth':null}):'');return _0x73a6d7(null);});}return _0x73a6d7(null);});};exports[_0xc081('0x15')]=function(_0x2472f8){return new BPromise(function(_0x1f56cf,_0x1db1ba){if(_0x2472f8){return getUser({'interface':_0x2472f8})[_0xc081('0xd')](function(_0x105356){logger['info'](_0xc081('0x16'),_0x2472f8,_0x105356?_0xc081('0x12'):_0xc081('0x13'));return _0x1f56cf(_0x105356);})[_0xc081('0x9')](function(_0x43448a){logger['error']('[utils][getUserByInterface]',_0x43448a?util[_0xc081('0x4')](_0x43448a,{'showHidden':![],'depth':null}):'');return _0x1f56cf(null);});}return _0x1f56cf(null);});};exports['getUserByName']=function(_0x137f4c){return new BPromise(function(_0x15afc7,_0xba8b12){if(_0x137f4c){return getUser({'name':_0x137f4c})['then'](function(_0x1a549b){logger['info'](_0xc081('0x17'),_0x137f4c,_0x1a549b?_0xc081('0x12'):_0xc081('0x13'));return _0x15afc7(_0x1a549b);})[_0xc081('0x9')](function(_0x498476){logger['error'](_0xc081('0x18'),_0x498476?util['inspect'](_0x498476,{'showHidden':![],'depth':null}):'');return _0x15afc7(null);});}return _0x15afc7(null);});};exports[_0xc081('0x19')]=function(_0x464584){return new BPromise(function(_0xb0caf8,_0x3ea230){if(_0x464584){return client[_0xc081('0x7')]('GetVoiceQueue',{'options':{'raw':!![],'attributes':['id','name',_0xc081('0x1a'),_0xc081('0x1b'),'acwTimeout'],'where':{'name':_0x464584},'limit':0x1}})[_0xc081('0xd')](function(_0x6d9371){logger[_0xc081('0x5')](_0xc081('0x1c'),_0x464584,_0x6d9371?util[_0xc081('0x4')](_0x6d9371,{'showHidden':![],'depth':null}):'');logger[_0xc081('0x3')](_0xc081('0x1d'),_0x464584,_0x6d9371?'found':_0xc081('0x13'));return _0xb0caf8(_0x6d9371[_0xc081('0xf')][_0xc081('0x10')]?_0x6d9371['result'][0x0]:null);})['catch'](function(_0x4ee550){logger[_0xc081('0x6')](_0xc081('0x1e'),_0x4ee550?util[_0xc081('0x4')](_0x4ee550,{'showHidden':![],'depth':null}):'');return _0xb0caf8(null);});}return _0xb0caf8(null);});};exports['addTime']=function(_0x1c834c,_0x42d32b){return moment(_0x1c834c)['add'](_0x42d32b,_0xc081('0x1f'))[_0xc081('0x20')](_0xc081('0x21'));};exports[_0xc081('0x22')]=function(_0x1429fb,_0x49b26a){return moment(_0x1429fb)[_0xc081('0x23')](_0x49b26a,_0xc081('0x1f'))[_0xc081('0x20')]('YYYY-MM-DD\x20HH:mm:ss');};exports['diffTime']=function(_0x3dbb0e,_0x2b2183){return moment(_0x3dbb0e)[_0xc081('0x24')](moment(_0x2b2183),_0xc081('0x1f'));};exports[_0xc081('0x25')]=function(_0x3b0821,_0x2bf907){return parseInt(_0x3b0821,0xa)+parseInt(_0x2bf907,0xa);};exports[_0xc081('0x26')]=function(){return moment()[_0xc081('0x20')]('YYYY-MM-DD\x20HH:mm:ss');};exports['isAfter']=function(_0x3c35f9,_0x49bb67){if(_0x49bb67){return moment(_0x3c35f9)['isAfter'](_0x49bb67);}return!![];};exports[_0xc081('0x27')]=function(_0x3c04ea,_0x394ef6){if(_0x394ef6){return moment(_0x3c04ea)[_0xc081('0x27')](_0x394ef6);}else if(_0x3c04ea){return!![];}return![];}; \ No newline at end of file +var _0xf4b7=['request','[utils][request]\x20name:%s','catch','GetUser','internal','name','interface','then','[utils][getUser]\x20where:%s','stringify','result','length','getUserByInternal','found','notfound','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','type','acw','acwTimeout','addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diffTime','diff','sumTime','isAfter','isBefore','bluebird','client','../../config/logger','xdr','info','inspect','debug','error'];(function(_0x4acd65,_0x193e16){var _0x1e7c1d=function(_0x49ee80){while(--_0x49ee80){_0x4acd65['push'](_0x4acd65['shift']());}};_0x1e7c1d(++_0x193e16);}(_0xf4b7,0x85));var _0x7f4b=function(_0xf4cfd9,_0xf5f6fa){_0xf4cfd9=_0xf4cfd9-0x0;var _0x394a32=_0xf4b7[_0xf4cfd9];return _0x394a32;};'use strict';var BPromise=require(_0x7f4b('0x0'));var jayson=require('jayson/promise');var moment=require('moment');var util=require('util');var client=jayson[_0x7f4b('0x1')]['http']({'port':0x2329});var logger=require(_0x7f4b('0x2'))(_0x7f4b('0x3'));exports[_0x7f4b('0x4')]=function(_0x4a2a42,_0x555db6){logger['info'](_0x4a2a42,_0x555db6?util[_0x7f4b('0x5')](_0x555db6,{'showHidden':![],'depth':null}):'');};exports[_0x7f4b('0x6')]=function(_0x3ef3d2,_0x5594d1){logger[_0x7f4b('0x6')](_0x3ef3d2,_0x5594d1?util[_0x7f4b('0x5')](_0x5594d1,{'showHidden':![],'depth':null}):'');};exports[_0x7f4b('0x7')]=function(_0x1cac66,_0x1122a0){logger['error'](_0x1cac66,_0x1122a0?util[_0x7f4b('0x5')](_0x1122a0,{'showHidden':![],'depth':null}):'');};exports[_0x7f4b('0x8')]=function(_0x227155,_0x169394){return client[_0x7f4b('0x8')](_0x227155,{'body':_0x169394})['then'](function(_0x644387){logger[_0x7f4b('0x6')](_0x7f4b('0x9'),_0x227155,_0x644387?util[_0x7f4b('0x5')](_0x644387,{'showHidden':![],'depth':null}):'');})[_0x7f4b('0xa')](function(_0x223d60){logger['error'](_0x7f4b('0x9'),_0x227155,_0x223d60?util[_0x7f4b('0x5')](_0x223d60,{'showHidden':![],'depth':null}):'');});};function getUser(_0x20e0a4){return client[_0x7f4b('0x8')](_0x7f4b('0xb'),{'options':{'raw':!![],'attributes':['id',_0x7f4b('0xc'),_0x7f4b('0xd'),_0x7f4b('0xe')],'where':_0x20e0a4,'limit':0x1}})[_0x7f4b('0xf')](function(_0xc4cdbe){logger[_0x7f4b('0x6')](_0x7f4b('0x10'),JSON[_0x7f4b('0x11')](_0x20e0a4),_0xc4cdbe?util[_0x7f4b('0x5')](_0xc4cdbe,{'showHidden':![],'depth':null}):'');return _0xc4cdbe[_0x7f4b('0x12')][_0x7f4b('0x13')]?_0xc4cdbe[_0x7f4b('0x12')][0x0]:null;});}exports[_0x7f4b('0x14')]=function(_0x6c79e2){return new BPromise(function(_0x397988,_0x4dc166){if(_0x6c79e2){return getUser({'internal':_0x6c79e2})[_0x7f4b('0xf')](function(_0x14a6db){logger['info']('[utils][getUserByInternal]\x20internal:%s\x20%s',_0x6c79e2,_0x14a6db?_0x7f4b('0x15'):_0x7f4b('0x16'));return _0x397988(_0x14a6db);})[_0x7f4b('0xa')](function(_0x4afb6d){logger[_0x7f4b('0x7')](_0x7f4b('0x17'),_0x4afb6d?util[_0x7f4b('0x5')](_0x4afb6d,{'showHidden':![],'depth':null}):'');return _0x397988(null);});}return _0x397988(null);});};exports[_0x7f4b('0x18')]=function(_0x1564de){return new BPromise(function(_0x42e0a0,_0xa31aea){if(_0x1564de){return getUser({'interface':_0x1564de})['then'](function(_0x287012){logger['info'](_0x7f4b('0x19'),_0x1564de,_0x287012?'found':_0x7f4b('0x16'));return _0x42e0a0(_0x287012);})['catch'](function(_0x2e46e3){logger[_0x7f4b('0x7')](_0x7f4b('0x1a'),_0x2e46e3?util[_0x7f4b('0x5')](_0x2e46e3,{'showHidden':![],'depth':null}):'');return _0x42e0a0(null);});}return _0x42e0a0(null);});};exports[_0x7f4b('0x1b')]=function(_0x19af06){return new BPromise(function(_0x284372,_0x54b559){if(_0x19af06){return getUser({'name':_0x19af06})[_0x7f4b('0xf')](function(_0x124754){logger[_0x7f4b('0x4')](_0x7f4b('0x1c'),_0x19af06,_0x124754?_0x7f4b('0x15'):'notfound');return _0x284372(_0x124754);})[_0x7f4b('0xa')](function(_0xa0124f){logger['error'](_0x7f4b('0x1d'),_0xa0124f?util[_0x7f4b('0x5')](_0xa0124f,{'showHidden':![],'depth':null}):'');return _0x284372(null);});}return _0x284372(null);});};exports[_0x7f4b('0x1e')]=function(_0x418e6e){return new BPromise(function(_0x353565,_0x381c7a){if(_0x418e6e){return client['request'](_0x7f4b('0x1f'),{'options':{'raw':!![],'attributes':['id','name',_0x7f4b('0x20'),_0x7f4b('0x21'),_0x7f4b('0x22')],'where':{'name':_0x418e6e},'limit':0x1}})[_0x7f4b('0xf')](function(_0x358953){logger[_0x7f4b('0x6')]('[utils][getVoiceQueueByName]\x20name:%s',_0x418e6e,_0x358953?util[_0x7f4b('0x5')](_0x358953,{'showHidden':![],'depth':null}):'');logger[_0x7f4b('0x4')]('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x418e6e,_0x358953?_0x7f4b('0x15'):_0x7f4b('0x16'));return _0x353565(_0x358953['result'][_0x7f4b('0x13')]?_0x358953[_0x7f4b('0x12')][0x0]:null);})[_0x7f4b('0xa')](function(_0x27b144){logger['error']('[utils][getVoiceQueueByName]',_0x27b144?util[_0x7f4b('0x5')](_0x27b144,{'showHidden':![],'depth':null}):'');return _0x353565(null);});}return _0x353565(null);});};exports[_0x7f4b('0x23')]=function(_0x4c1b66,_0xb395c3){return moment(_0x4c1b66)[_0x7f4b('0x24')](_0xb395c3,_0x7f4b('0x25'))[_0x7f4b('0x26')](_0x7f4b('0x27'));};exports[_0x7f4b('0x28')]=function(_0xff90fa,_0x594a88){return moment(_0xff90fa)[_0x7f4b('0x29')](_0x594a88,_0x7f4b('0x25'))[_0x7f4b('0x26')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x7f4b('0x2a')]=function(_0x1503f8,_0x53c58e){return moment(_0x1503f8)[_0x7f4b('0x2b')](moment(_0x53c58e),_0x7f4b('0x25'));};exports[_0x7f4b('0x2c')]=function(_0x1d4c31,_0x1a36c3){return parseInt(_0x1d4c31,0xa)+parseInt(_0x1a36c3,0xa);};exports['now']=function(){return moment()[_0x7f4b('0x26')](_0x7f4b('0x27'));};exports[_0x7f4b('0x2d')]=function(_0x57a662,_0x2da765){if(_0x2da765){return moment(_0x57a662)[_0x7f4b('0x2d')](_0x2da765);}return!![];};exports[_0x7f4b('0x2e')]=function(_0x2a507,_0xf5c804){if(_0xf5c804){return moment(_0x2a507)[_0x7f4b('0x2e')](_0xf5c804);}else if(_0x2a507){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 e34b9c0..57649ea 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 _0xd6e7=['name','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','format','remoteAddress','responseTime','device','other','agent_id','agent_name','test','setupLoggers','fs-extra','lodash','express-winston','path','util','./loggers','fileLogger','maskSensitiveData','join','/var','log','xcally','role','ensureDir','then','client','catch','user','data','timestamp','error','api','client-side-logger','use','logger','isEmpty','body','\x20body=%s','method','headers','x-forwarded-for','connection','url','statusCode'];(function(_0x182768,_0x28870a){var _0x449747=function(_0x4d75eb){while(--_0x4d75eb){_0x182768['push'](_0x182768['shift']());}};_0x449747(++_0x28870a);}(_0xd6e7,0x96));var _0x7d6e=function(_0x2edfb3,_0x1267bd){_0x2edfb3=_0x2edfb3-0x0;var _0x3df862=_0xd6e7[_0x2edfb3];return _0x3df862;};var fs=require(_0x7d6e('0x0'));var _=require(_0x7d6e('0x1'));var ewinston=require(_0x7d6e('0x2'));var path=require(_0x7d6e('0x3'));var util=require(_0x7d6e('0x4'));var fileLogger=require(_0x7d6e('0x5'))[_0x7d6e('0x6')];var safeTemplate=require('./safe-template')['safeTemplate'];var maskSensitiveData=require('./mask-sensitive-data')[_0x7d6e('0x7')];function ClientSideLogger(){function _0x460277(_0x39192c){var _0x4d2aed=path[_0x7d6e('0x8')](_0x7d6e('0x9'),_0x7d6e('0xa'),_0x7d6e('0xb'));var _0x2054ff=path[_0x7d6e('0x8')]('client',_0x39192c[_0x7d6e('0xc')]+'-'+_0x39192c['name']);return fs[_0x7d6e('0xd')](path[_0x7d6e('0x8')](_0x4d2aed,_0x2054ff))[_0x7d6e('0xe')](function(){var _0x3f5c71=fileLogger(_0x7d6e('0xf'),path[_0x7d6e('0x8')](_0x4d2aed,_0x2054ff));return _0x3f5c71;})[_0x7d6e('0x10')](function(_0x2090a0){throw _0x2090a0;});}this[_0x7d6e('0xa')]=function(_0x5d79ad,_0x5f47d5,_0x1a19c2,_0x781729){return _0x460277(_0x5d79ad[_0x7d6e('0x11')])[_0x7d6e('0xe')](function(_0x307b07){var _0xd38f7d=_0x307b07[_0x5f47d5];return _0xd38f7d;})[_0x7d6e('0xe')](function(_0x366856){var _0x39f4e6=_0x5d79ad[_0x7d6e('0x11')]?_0x5d79ad['user']['id']:'no-user';var _0x1da2a4=_0x781729[_0x7d6e('0x12')];var _0x4a1bb7=_0x781729[_0x7d6e('0x13')];var _0x5c376e=new Date(Number(_0x4a1bb7));return _0x366856(_0x39f4e6,_0x5c376e,_0x1a19c2,_0x1da2a4);})['catch'](function(_0x507f94){fileLogger('client')[_0x7d6e('0x14')](_0x507f94);});};}function setupLoggers(_0x233d8f){return new Promise(function(_0x2cbece){var _0x38a601=new ClientSideLogger();var _0x5ccd22=fileLogger(_0x7d6e('0x15'));var _0x52e4a3=fileLogger('auth');_0x233d8f['set'](_0x7d6e('0x16'),_0x38a601);_0x233d8f[_0x7d6e('0x17')](ewinston[_0x7d6e('0x18')]({'winstonInstance':_0x5ccd22,'meta':![],'statusLevels':!![],'msg':function(_0x4e7740,_0x44787c){var _0x1a70b8='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s';if(!_[_0x7d6e('0x19')](_0x4e7740[_0x7d6e('0x1a')])){_0x1a70b8+=_0x7d6e('0x1b');var _0x20b418=_0x4e7740[_0x7d6e('0x1a')];maskSensitiveData(_0x20b418);}return safeTemplate(util['format'](_0x1a70b8,_0x4e7740[_0x7d6e('0x1c')],_0x4e7740[_0x7d6e('0x1d')][_0x7d6e('0x1e')]?_0x4e7740['headers'][_0x7d6e('0x1e')]:_0x4e7740[_0x7d6e('0x1f')]['remoteAddress']||_0x4e7740['ip'],_0x4e7740[_0x7d6e('0x20')],_0x44787c[_0x7d6e('0x21')],_0x44787c['responseTime'],_0x4e7740[_0x7d6e('0x11')]?_0x4e7740[_0x7d6e('0x11')]['id']:null,_0x4e7740[_0x7d6e('0x11')]?_0x4e7740[_0x7d6e('0x11')][_0x7d6e('0x22')]:null,_0x4e7740[_0x7d6e('0x11')]?_0x4e7740[_0x7d6e('0x11')][_0x7d6e('0xc')]:null,_0x20b418?util[_0x7d6e('0x23')](_0x20b418,![],null):''));}}));_0x233d8f[_0x7d6e('0x17')](ewinston['logger']({'winstonInstance':_0x52e4a3,'meta':![],'statusLevels':!![],'msg':function(_0x1f3e21,_0x4a32e9){var _0x42cb74=_0x7d6e('0x24');if(_0x1f3e21['body']&&_0x1f3e21[_0x7d6e('0x1a')]['device']&&_0x1f3e21[_0x7d6e('0x1a')]['agent_id']){_0x42cb74='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util[_0x7d6e('0x25')](_0x42cb74,_0x1f3e21[_0x7d6e('0x1c')],_0x1f3e21[_0x7d6e('0x1d')][_0x7d6e('0x1e')]?_0x1f3e21['headers'][_0x7d6e('0x1e')]:_0x1f3e21['connection'][_0x7d6e('0x26')]||_0x1f3e21['ip'],_0x1f3e21['url'],_0x4a32e9[_0x7d6e('0x21')],_0x4a32e9[_0x7d6e('0x27')],_0x1f3e21['user']?_0x1f3e21['user']['id']:null,_0x1f3e21[_0x7d6e('0x11')]?_0x1f3e21['user'][_0x7d6e('0x22')]:null,_0x1f3e21['user']?_0x1f3e21[_0x7d6e('0x11')][_0x7d6e('0xc')]:null,_0x1f3e21['body']&&_0x1f3e21[_0x7d6e('0x1a')][_0x7d6e('0x28')]?_0x1f3e21['body']['device']:_0x7d6e('0x29'),_0x1f3e21[_0x7d6e('0x1a')]&&_0x1f3e21[_0x7d6e('0x1a')][_0x7d6e('0x2a')]?_0x1f3e21['body'][_0x7d6e('0x2a')]:'',_0x1f3e21['body']&&_0x1f3e21[_0x7d6e('0x1a')]['agent_name']?_0x1f3e21[_0x7d6e('0x1a')][_0x7d6e('0x2b')]:'');},'ignoreRoute':function(_0x154128){var _0x44b641=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x44b641[_0x7d6e('0x2c')](_0x154128['url']);}}));return _0x2cbece();});}exports[_0x7d6e('0x2d')]=setupLoggers; \ No newline at end of file +var _0xbb46=['agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','format','url','responseTime','agent_name','test','setupLoggers','fs-extra','lodash','path','util','fileLogger','safeTemplate','./mask-sensitive-data','maskSensitiveData','/var','log','join','client','catch','then','user','no-user','error','api','auth','set','client-side-logger','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','\x20body=%s','body','method','headers','x-forwarded-for','connection','remoteAddress','statusCode','name','role','use','device'];(function(_0x2c5ea7,_0x40133b){var _0x2f1615=function(_0x5ebcc6){while(--_0x5ebcc6){_0x2c5ea7['push'](_0x2c5ea7['shift']());}};_0x2f1615(++_0x40133b);}(_0xbb46,0x135));var _0x6bb4=function(_0x18f1a4,_0x518167){_0x18f1a4=_0x18f1a4-0x0;var _0x51b492=_0xbb46[_0x18f1a4];return _0x51b492;};var fs=require(_0x6bb4('0x0'));var _=require(_0x6bb4('0x1'));var ewinston=require('express-winston');var path=require(_0x6bb4('0x2'));var util=require(_0x6bb4('0x3'));var fileLogger=require('./loggers')[_0x6bb4('0x4')];var safeTemplate=require('./safe-template')[_0x6bb4('0x5')];var maskSensitiveData=require(_0x6bb4('0x6'))[_0x6bb4('0x7')];function ClientSideLogger(){function _0x33dbd5(_0x8f3e3a){var _0x561ccb=path['join'](_0x6bb4('0x8'),_0x6bb4('0x9'),'xcally');var _0x31ee11=path[_0x6bb4('0xa')](_0x6bb4('0xb'),_0x8f3e3a['role']+'-'+_0x8f3e3a['name']);return fs['ensureDir'](path[_0x6bb4('0xa')](_0x561ccb,_0x31ee11))['then'](function(){var _0x1d1da8=fileLogger(_0x6bb4('0xb'),path[_0x6bb4('0xa')](_0x561ccb,_0x31ee11));return _0x1d1da8;})[_0x6bb4('0xc')](function(_0x2dfb9e){throw _0x2dfb9e;});}this[_0x6bb4('0x9')]=function(_0x3a1366,_0x510430,_0x170f06,_0x581ad2){return _0x33dbd5(_0x3a1366['user'])[_0x6bb4('0xd')](function(_0x588975){var _0xd7090=_0x588975[_0x510430];return _0xd7090;})['then'](function(_0x9c59a2){var _0x48efcd=_0x3a1366[_0x6bb4('0xe')]?_0x3a1366[_0x6bb4('0xe')]['id']:_0x6bb4('0xf');var _0x341ff0=_0x581ad2['data'];var _0x1e49c3=_0x581ad2['timestamp'];var _0x454838=new Date(Number(_0x1e49c3));return _0x9c59a2(_0x48efcd,_0x454838,_0x170f06,_0x341ff0);})['catch'](function(_0x1be690){fileLogger('client')[_0x6bb4('0x10')](_0x1be690);});};}function setupLoggers(_0x37bbfe){return new Promise(function(_0x2e2b1d){var _0x3dbb14=new ClientSideLogger();var _0x5d4d27=fileLogger(_0x6bb4('0x11'));var _0x114f54=fileLogger(_0x6bb4('0x12'));_0x37bbfe[_0x6bb4('0x13')](_0x6bb4('0x14'),_0x3dbb14);_0x37bbfe['use'](ewinston[_0x6bb4('0x15')]({'winstonInstance':_0x5d4d27,'meta':![],'statusLevels':!![],'msg':function(_0x3a7066,_0x44c56f){var _0x149b61=_0x6bb4('0x16');if(!_['isEmpty'](_0x3a7066['body'])){_0x149b61+=_0x6bb4('0x17');var _0x4acc2b=_0x3a7066[_0x6bb4('0x18')];maskSensitiveData(_0x4acc2b);}return safeTemplate(util['format'](_0x149b61,_0x3a7066[_0x6bb4('0x19')],_0x3a7066[_0x6bb4('0x1a')][_0x6bb4('0x1b')]?_0x3a7066['headers']['x-forwarded-for']:_0x3a7066[_0x6bb4('0x1c')][_0x6bb4('0x1d')]||_0x3a7066['ip'],_0x3a7066['url'],_0x44c56f[_0x6bb4('0x1e')],_0x44c56f['responseTime'],_0x3a7066[_0x6bb4('0xe')]?_0x3a7066[_0x6bb4('0xe')]['id']:null,_0x3a7066[_0x6bb4('0xe')]?_0x3a7066[_0x6bb4('0xe')][_0x6bb4('0x1f')]:null,_0x3a7066[_0x6bb4('0xe')]?_0x3a7066[_0x6bb4('0xe')][_0x6bb4('0x20')]:null,_0x4acc2b?util['inspect'](_0x4acc2b,![],null):''));}}));_0x37bbfe[_0x6bb4('0x21')](ewinston[_0x6bb4('0x15')]({'winstonInstance':_0x114f54,'meta':![],'statusLevels':!![],'msg':function(_0x21a51d,_0x4fdf2b){var _0x2d698f='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0x21a51d[_0x6bb4('0x18')]&&_0x21a51d[_0x6bb4('0x18')][_0x6bb4('0x22')]&&_0x21a51d[_0x6bb4('0x18')][_0x6bb4('0x23')]){_0x2d698f=_0x6bb4('0x24');}return util[_0x6bb4('0x25')](_0x2d698f,_0x21a51d[_0x6bb4('0x19')],_0x21a51d[_0x6bb4('0x1a')][_0x6bb4('0x1b')]?_0x21a51d[_0x6bb4('0x1a')][_0x6bb4('0x1b')]:_0x21a51d[_0x6bb4('0x1c')]['remoteAddress']||_0x21a51d['ip'],_0x21a51d[_0x6bb4('0x26')],_0x4fdf2b[_0x6bb4('0x1e')],_0x4fdf2b[_0x6bb4('0x27')],_0x21a51d['user']?_0x21a51d[_0x6bb4('0xe')]['id']:null,_0x21a51d[_0x6bb4('0xe')]?_0x21a51d[_0x6bb4('0xe')][_0x6bb4('0x1f')]:null,_0x21a51d[_0x6bb4('0xe')]?_0x21a51d['user'][_0x6bb4('0x20')]:null,_0x21a51d[_0x6bb4('0x18')]&&_0x21a51d['body'][_0x6bb4('0x22')]?_0x21a51d['body'][_0x6bb4('0x22')]:'other',_0x21a51d[_0x6bb4('0x18')]&&_0x21a51d[_0x6bb4('0x18')][_0x6bb4('0x23')]?_0x21a51d['body'][_0x6bb4('0x23')]:'',_0x21a51d['body']&&_0x21a51d['body'][_0x6bb4('0x28')]?_0x21a51d[_0x6bb4('0x18')][_0x6bb4('0x28')]:'');},'ignoreRoute':function(_0x3c6d05){var _0x288fbc=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x288fbc[_0x6bb4('0x29')](_0x3c6d05['url']);}}));return _0x2e2b1d();});}exports[_0x6bb4('0x2a')]=setupLoggers; \ No newline at end of file diff --git a/server/utils/iftime.js b/server/utils/iftime.js index f7a6c41..f6a838c 100644 --- a/server/utils/iftime.js +++ b/server/utils/iftime.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd206=['max','domCompare','MMM','test','padStart','length','lodash','map','source','join','Interval\x20string\x20not\x20valid','Date\x20not\x20valid','isValid','split','locale','weekdaysShort','toLowerCase','indexOf','slice','concat','circularDoWInterval','monthsShort','exports','circularMonthInterval','clone','hours','minutes','isBefore','startOf','endOf','day','isBetween','timeCompare','format','ddd','includes','dowCompare','date','daysInMonth','min'];(function(_0x2441b2,_0x55e94f){var _0x24ca0f=function(_0x4de21a){while(--_0x4de21a){_0x2441b2['push'](_0x2441b2['shift']());}};_0x24ca0f(++_0x55e94f);}(_0xd206,0x16e));var _0x6d20=function(_0x4e9d3c,_0x1f4b98){_0x4e9d3c=_0x4e9d3c-0x0;var _0x2d0825=_0xd206[_0x4e9d3c];return _0x2d0825;};var _=require(_0x6d20('0x0'));var moment=require('moment-timezone');var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx][_0x6d20('0x1')](function(_0x541f50){return _0x541f50[_0x6d20('0x2')];})[_0x6d20('0x3')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0x6d20('0x4');var EINVALID_DATE=_0x6d20('0x5');function throwIfDateNotValid(_0x4b23c8){if(!_0x4b23c8[_0x6d20('0x6')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x1fc517){var _0x22ba7c=_0x1fc517[_0x6d20('0x7')](':')[_0x6d20('0x1')](function(_0x291819){return parseInt(_0x291819,0xa);});var _0x14fd75=_0x22ba7c[0x0];var _0x499414=_0x22ba7c[0x1];if(_0x14fd75<0x0||_0x14fd75>0x17||_0x499414<0x0||_0x499414>0x3b){throw new Error(EINVALID_DATE);}return[_0x14fd75,_0x499414];}function circularDoWInterval(_0x2012b1,_0x4bc6a6){if(_0x2012b1===_0x4bc6a6){return[_0x2012b1];}else{var _0x5100f9=moment[_0x6d20('0x8')]();moment[_0x6d20('0x8')]('en');var _0x1e497d=moment[_0x6d20('0x9')]()['map'](function(_0x27fb7d){return _0x27fb7d[_0x6d20('0xa')]();});moment[_0x6d20('0x8')](_0x5100f9);var _0x799a8b=_0x1e497d[_0x6d20('0xb')](_0x2012b1);var _0x268315=_0x1e497d['indexOf'](_0x4bc6a6);if(_0x268315>_0x799a8b){return _0x1e497d[_0x6d20('0xc')](_0x799a8b,_0x268315+0x1);}else{var _0x430a6a=_0x1e497d['slice'](0x0,_0x268315+0x1);var _0x299807=_0x1e497d[_0x6d20('0xc')](_0x799a8b);return _0x299807[_0x6d20('0xd')](_0x430a6a);}}}module['exports'][_0x6d20('0xe')]=circularDoWInterval;function circularMonthInterval(_0x3942b5,_0x1338b8){if(_0x3942b5===_0x1338b8){return[_0x3942b5];}else{var _0x49c93b=moment[_0x6d20('0x8')]();moment[_0x6d20('0x8')]('en');var _0x1325be=moment[_0x6d20('0xf')]()[_0x6d20('0x1')](function(_0x17b6f6){return _0x17b6f6[_0x6d20('0xa')]();});moment[_0x6d20('0x8')](_0x49c93b);var _0x2a94f4=_0x1325be[_0x6d20('0xb')](_0x3942b5);var _0x33b19c=_0x1325be[_0x6d20('0xb')](_0x1338b8);if(_0x33b19c>_0x2a94f4){return _0x1325be[_0x6d20('0xc')](_0x2a94f4,_0x33b19c+0x1);}else{var _0x596b57=_0x1325be['slice'](0x0,_0x33b19c+0x1);var _0x5be9aa=_0x1325be[_0x6d20('0xc')](_0x2a94f4);return _0x5be9aa[_0x6d20('0xd')](_0x596b57);}}}module[_0x6d20('0x10')][_0x6d20('0x11')]=circularMonthInterval;function parseDom(_0x22ab06){var _0x337e8d=parseInt(_0x22ab06,0xa);if(_0x337e8d<0x1||_0x337e8d>0x1f){throw new Error(EINVALID_DATE);}return _0x337e8d;}function timeCompare(_0x4d70e3,_0x446b6a,_0x5215ac){var _0x5316fb=_0x4d70e3[_0x6d20('0x12')]();var _0x1116b6=extractTime(_0x446b6a);var _0x7caebd=_0x1116b6[0x0];var _0x2707dc=_0x1116b6[0x1];var _0x4c3c0d=_0x4d70e3[_0x6d20('0x12')]()[_0x6d20('0x13')](_0x7caebd)['minutes'](_0x2707dc);throwIfDateNotValid(_0x4c3c0d);var _0x442dba=extractTime(_0x5215ac);var _0x4f7a22=_0x442dba[0x0];var _0x5dc874=_0x442dba[0x1];var _0x448264=_0x4d70e3[_0x6d20('0x12')]()['hours'](_0x4f7a22)[_0x6d20('0x14')](_0x5dc874);throwIfDateNotValid(_0x448264);if(_0x448264[_0x6d20('0x15')](_0x4c3c0d)){var _0x8425ce=_0x5316fb['clone']()[_0x6d20('0x16')]('day');var _0x1dc0c1=_0x5316fb['clone']()[_0x6d20('0x17')](_0x6d20('0x18'));return _0x5316fb[_0x6d20('0x19')](_0x4c3c0d,_0x1dc0c1,undefined,'[]')||_0x5316fb[_0x6d20('0x19')](_0x8425ce,_0x448264,undefined,'[]');}else{return _0x5316fb['isBetween'](_0x4c3c0d,_0x448264,undefined,'[]');}}module['exports'][_0x6d20('0x1a')]=timeCompare;function dowCompare(_0x44998c,_0x27231a,_0x16d9c8){var _0x1be1cd=_0x44998c['locale']('en')[_0x6d20('0x1b')](_0x6d20('0x1c'))[_0x6d20('0xa')]();return circularDoWInterval(_0x27231a,_0x16d9c8)[_0x6d20('0x1d')](_0x1be1cd);}module[_0x6d20('0x10')][_0x6d20('0x1e')]=dowCompare;function domCompare(_0x3e1625,_0x2f6021,_0x44760c){var _0x45bdc6=_0x3e1625[_0x6d20('0x1f')]();if(_0x2f6021===_0x44760c){return _0x45bdc6===_0x2f6021;}else{var _0xa6dc08=_0x3e1625[_0x6d20('0x20')]();var _0x5b15ce=_0x2f6021<_0x44760c;let _0x11d767=![];var _0x48e54e=0x0;var _0x1fb33f=0x0;if(_0x5b15ce){_0x48e54e=Math['max'](0x1,_0x2f6021);_0x1fb33f=Math[_0x6d20('0x21')](_0x44760c,_0xa6dc08);_0x11d767=_0x45bdc6>=_0x48e54e&&_0x45bdc6<=_0x1fb33f;}else{_0x48e54e=Math[_0x6d20('0x21')](_0x2f6021,_0xa6dc08);_0x1fb33f=Math[_0x6d20('0x22')](0x1,_0x44760c);_0x11d767=_0x45bdc6>=_0x48e54e||_0x45bdc6<=_0x1fb33f;}return _0x11d767;}}module[_0x6d20('0x10')][_0x6d20('0x23')]=domCompare;function monthCompare(_0xc94411,_0x25b478,_0x42b4c8){var _0x8aab55=_0xc94411[_0x6d20('0x8')]('en')[_0x6d20('0x1b')](_0x6d20('0x24'))['toLowerCase']();return circularMonthInterval(_0x25b478,_0x42b4c8)[_0x6d20('0x1d')](_0x8aab55);}module[_0x6d20('0x10')]['monthCompare']=monthCompare;function iftime(_0x45c08f,_0x2356cf=moment['tz']['guess'](),_0x96df15=moment()){if(!validateRx[_0x6d20('0x25')](_0x45c08f)){throw new Error(EINVALID_STRING);}else{var _0x2ae991=(moment['isMoment'](_0x96df15)?_0x96df15[_0x6d20('0x12')]():moment(_0x96df15))['tz'](_0x2356cf)['locale']('en');throwIfDateNotValid(_0x2ae991);var _0x556de1=_0x45c08f[_0x6d20('0x7')](',');var _0x4566c8=_0x556de1[0x0];var _0x1d6408=_0x556de1[0x1];var _0x176f2a=_0x556de1[0x2];var _0x5835c7=_0x556de1[0x3];let _0x638163=!![];if(_0x4566c8!=='*'){var _0x25022f=_0x4566c8[_0x6d20('0x7')]('-');var _0x3c2977=_[_0x6d20('0x26')](_0x25022f[0x0],0x5,'0');var _0x598514=_0x25022f['length']===0x2?_[_0x6d20('0x26')](_0x25022f[0x1],0x5,'0'):_0x3c2977;_0x638163=timeCompare(_0x2ae991,_0x3c2977,_0x598514);}let _0x38b000=!![];if(_0x1d6408!=='*'){var _0x10fe52=_0x1d6408['split']('-');var _0xeb8b97=_0x10fe52[0x0];var _0x341164=_0x10fe52['length']===0x2?_0x10fe52[0x1]:_0xeb8b97;_0x38b000=dowCompare(_0x2ae991,_0xeb8b97,_0x341164);}let _0xa1e329=!![];if(_0x176f2a!=='*'){var _0x98e711=_0x176f2a[_0x6d20('0x7')]('-');var _0x33875d=parseDom(_0x98e711[0x0]);var _0x1faef0=_0x98e711[_0x6d20('0x27')]===0x2?parseDom(_0x98e711[0x1]):_0x33875d;_0xa1e329=domCompare(_0x2ae991,_0x33875d,_0x1faef0);}let _0x35ac01=!![];if(_0x5835c7!=='*'){var _0x3abc09=_0x5835c7[_0x6d20('0x7')]('-');var _0x3edf92=_0x3abc09[0x0];var _0x320b0b=_0x3abc09[_0x6d20('0x27')]===0x2?_0x3abc09[0x1]:_0x3abc09[0x0];_0x35ac01=monthCompare(_0x2ae991,_0x3edf92,_0x320b0b);}return _0x638163&&_0x38b000&&_0xa1e329&&_0x35ac01;}}module[_0x6d20('0x10')]['iftime']=iftime; \ No newline at end of file +var _0x3ecc=['padStart','length','iftime','lodash','moment-timezone','map','source','join','Interval\x20string\x20not\x20valid','Date\x20not\x20valid','split','locale','weekdaysShort','toLowerCase','indexOf','slice','concat','exports','circularDoWInterval','monthsShort','clone','hours','minutes','isBefore','startOf','isBetween','format','ddd','includes','dowCompare','date','daysInMonth','max','min','monthCompare','guess','test','isMoment'];(function(_0x2f154a,_0x3064f0){var _0x1197ed=function(_0x1f7b08){while(--_0x1f7b08){_0x2f154a['push'](_0x2f154a['shift']());}};_0x1197ed(++_0x3064f0);}(_0x3ecc,0x17f));var _0xc3ec=function(_0x300b81,_0x3b8e83){_0x300b81=_0x300b81-0x0;var _0x36c624=_0x3ecc[_0x300b81];return _0x36c624;};var _=require(_0xc3ec('0x0'));var moment=require(_0xc3ec('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][_0xc3ec('0x2')](function(_0x20c758){return _0x20c758[_0xc3ec('0x3')];})[_0xc3ec('0x4')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0xc3ec('0x5');var EINVALID_DATE=_0xc3ec('0x6');function throwIfDateNotValid(_0x35eb2b){if(!_0x35eb2b['isValid']()){throw new Error(EINVALID_DATE);}}function extractTime(_0x4605f4){var _0x10e52b=_0x4605f4[_0xc3ec('0x7')](':')[_0xc3ec('0x2')](function(_0x2975fc){return parseInt(_0x2975fc,0xa);});var _0xb19dae=_0x10e52b[0x0];var _0x2301af=_0x10e52b[0x1];if(_0xb19dae<0x0||_0xb19dae>0x17||_0x2301af<0x0||_0x2301af>0x3b){throw new Error(EINVALID_DATE);}return[_0xb19dae,_0x2301af];}function circularDoWInterval(_0x687124,_0xeedc84){if(_0x687124===_0xeedc84){return[_0x687124];}else{var _0x1a7c54=moment['locale']();moment[_0xc3ec('0x8')]('en');var _0x239d5a=moment[_0xc3ec('0x9')]()[_0xc3ec('0x2')](function(_0x240a14){return _0x240a14[_0xc3ec('0xa')]();});moment[_0xc3ec('0x8')](_0x1a7c54);var _0x4a1101=_0x239d5a['indexOf'](_0x687124);var _0x39beda=_0x239d5a[_0xc3ec('0xb')](_0xeedc84);if(_0x39beda>_0x4a1101){return _0x239d5a[_0xc3ec('0xc')](_0x4a1101,_0x39beda+0x1);}else{var _0x3a921e=_0x239d5a[_0xc3ec('0xc')](0x0,_0x39beda+0x1);var _0x3f36ae=_0x239d5a['slice'](_0x4a1101);return _0x3f36ae[_0xc3ec('0xd')](_0x3a921e);}}}module[_0xc3ec('0xe')][_0xc3ec('0xf')]=circularDoWInterval;function circularMonthInterval(_0x5090f9,_0x1681fe){if(_0x5090f9===_0x1681fe){return[_0x5090f9];}else{var _0x218bed=moment[_0xc3ec('0x8')]();moment[_0xc3ec('0x8')]('en');var _0xcc52a2=moment[_0xc3ec('0x10')]()[_0xc3ec('0x2')](function(_0x47d322){return _0x47d322['toLowerCase']();});moment[_0xc3ec('0x8')](_0x218bed);var _0x4859aa=_0xcc52a2[_0xc3ec('0xb')](_0x5090f9);var _0x465acd=_0xcc52a2['indexOf'](_0x1681fe);if(_0x465acd>_0x4859aa){return _0xcc52a2[_0xc3ec('0xc')](_0x4859aa,_0x465acd+0x1);}else{var _0x2dbe11=_0xcc52a2[_0xc3ec('0xc')](0x0,_0x465acd+0x1);var _0xb6a67f=_0xcc52a2[_0xc3ec('0xc')](_0x4859aa);return _0xb6a67f[_0xc3ec('0xd')](_0x2dbe11);}}}module[_0xc3ec('0xe')]['circularMonthInterval']=circularMonthInterval;function parseDom(_0x3a4c61){var _0x5516d8=parseInt(_0x3a4c61,0xa);if(_0x5516d8<0x1||_0x5516d8>0x1f){throw new Error(EINVALID_DATE);}return _0x5516d8;}function timeCompare(_0x43c1e1,_0x2f4040,_0x2abfed){var _0x217246=_0x43c1e1[_0xc3ec('0x11')]();var _0x59b9f4=extractTime(_0x2f4040);var _0x40e470=_0x59b9f4[0x0];var _0x357af0=_0x59b9f4[0x1];var _0x422270=_0x43c1e1[_0xc3ec('0x11')]()[_0xc3ec('0x12')](_0x40e470)['minutes'](_0x357af0);throwIfDateNotValid(_0x422270);var _0x8eb71b=extractTime(_0x2abfed);var _0x3c32d4=_0x8eb71b[0x0];var _0x32398a=_0x8eb71b[0x1];var _0x16e6cc=_0x43c1e1['clone']()['hours'](_0x3c32d4)[_0xc3ec('0x13')](_0x32398a);throwIfDateNotValid(_0x16e6cc);if(_0x16e6cc[_0xc3ec('0x14')](_0x422270)){var _0x1f01b9=_0x217246['clone']()[_0xc3ec('0x15')]('day');var _0x4ff5bd=_0x217246[_0xc3ec('0x11')]()['endOf']('day');return _0x217246['isBetween'](_0x422270,_0x4ff5bd,undefined,'[]')||_0x217246[_0xc3ec('0x16')](_0x1f01b9,_0x16e6cc,undefined,'[]');}else{return _0x217246['isBetween'](_0x422270,_0x16e6cc,undefined,'[]');}}module[_0xc3ec('0xe')]['timeCompare']=timeCompare;function dowCompare(_0x43f447,_0x2af2a8,_0x4aca92){var _0x79f9b7=_0x43f447['locale']('en')[_0xc3ec('0x17')](_0xc3ec('0x18'))[_0xc3ec('0xa')]();return circularDoWInterval(_0x2af2a8,_0x4aca92)[_0xc3ec('0x19')](_0x79f9b7);}module[_0xc3ec('0xe')][_0xc3ec('0x1a')]=dowCompare;function domCompare(_0x1939ed,_0x54145d,_0x33e3fc){var _0xf6d677=_0x1939ed[_0xc3ec('0x1b')]();if(_0x54145d===_0x33e3fc){return _0xf6d677===_0x54145d;}else{var _0x21150f=_0x1939ed[_0xc3ec('0x1c')]();var _0x2ddb64=_0x54145d<_0x33e3fc;let _0x3b814a=![];var _0x1df365=0x0;var _0x3f5f9e=0x0;if(_0x2ddb64){_0x1df365=Math[_0xc3ec('0x1d')](0x1,_0x54145d);_0x3f5f9e=Math['min'](_0x33e3fc,_0x21150f);_0x3b814a=_0xf6d677>=_0x1df365&&_0xf6d677<=_0x3f5f9e;}else{_0x1df365=Math[_0xc3ec('0x1e')](_0x54145d,_0x21150f);_0x3f5f9e=Math[_0xc3ec('0x1d')](0x1,_0x33e3fc);_0x3b814a=_0xf6d677>=_0x1df365||_0xf6d677<=_0x3f5f9e;}return _0x3b814a;}}module[_0xc3ec('0xe')]['domCompare']=domCompare;function monthCompare(_0x5993c3,_0x100c12,_0x1126ee){var _0x385bda=_0x5993c3[_0xc3ec('0x8')]('en')['format']('MMM')[_0xc3ec('0xa')]();return circularMonthInterval(_0x100c12,_0x1126ee)['includes'](_0x385bda);}module[_0xc3ec('0xe')][_0xc3ec('0x1f')]=monthCompare;function iftime(_0x30dc18,_0x9fa08e=moment['tz'][_0xc3ec('0x20')](),_0x19856b=moment()){if(!validateRx[_0xc3ec('0x21')](_0x30dc18)){throw new Error(EINVALID_STRING);}else{var _0x5c3ab8=(moment[_0xc3ec('0x22')](_0x19856b)?_0x19856b[_0xc3ec('0x11')]():moment(_0x19856b))['tz'](_0x9fa08e)[_0xc3ec('0x8')]('en');throwIfDateNotValid(_0x5c3ab8);var _0x314ccf=_0x30dc18['split'](',');var _0x111df2=_0x314ccf[0x0];var _0x1d94d6=_0x314ccf[0x1];var _0xbcb2bf=_0x314ccf[0x2];var _0x41b7d1=_0x314ccf[0x3];let _0x1960ff=!![];if(_0x111df2!=='*'){var _0x1c4146=_0x111df2['split']('-');var _0x1e9f0d=_[_0xc3ec('0x23')](_0x1c4146[0x0],0x5,'0');var _0x19fa82=_0x1c4146['length']===0x2?_[_0xc3ec('0x23')](_0x1c4146[0x1],0x5,'0'):_0x1e9f0d;_0x1960ff=timeCompare(_0x5c3ab8,_0x1e9f0d,_0x19fa82);}let _0xa0fdad=!![];if(_0x1d94d6!=='*'){var _0x41a31e=_0x1d94d6[_0xc3ec('0x7')]('-');var _0xf76fec=_0x41a31e[0x0];var _0x427456=_0x41a31e[_0xc3ec('0x24')]===0x2?_0x41a31e[0x1]:_0xf76fec;_0xa0fdad=dowCompare(_0x5c3ab8,_0xf76fec,_0x427456);}let _0x173896=!![];if(_0xbcb2bf!=='*'){var _0xe1302a=_0xbcb2bf['split']('-');var _0x1db142=parseDom(_0xe1302a[0x0]);var _0x290aea=_0xe1302a[_0xc3ec('0x24')]===0x2?parseDom(_0xe1302a[0x1]):_0x1db142;_0x173896=domCompare(_0x5c3ab8,_0x1db142,_0x290aea);}let _0x38d9d8=!![];if(_0x41b7d1!=='*'){var _0x960a76=_0x41b7d1[_0xc3ec('0x7')]('-');var _0x20112b=_0x960a76[0x0];var _0x4e4c54=_0x960a76['length']===0x2?_0x960a76[0x1]:_0x960a76[0x0];_0x38d9d8=monthCompare(_0x5c3ab8,_0x20112b,_0x4e4c54);}return _0x1960ff&&_0xa0fdad&&_0x173896&&_0x38d9d8;}}module[_0xc3ec('0xe')][_0xc3ec('0x25')]=iftime; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index 980a4be..b3a2423 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xff35=['util','winston','../config/environment','toLowerCase','redBG\x20white','red','bold\x20yellow','bold\x20white','bold\x20green','gray','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','YYYY-MM-DD\x20HH:mm:ss','level','meta','keys','length','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','toUpperCase','Logger','transports','Console','File','error','consoleLogger','path'];(function(_0x20c6a2,_0x1b12cc){var _0x12a9d2=function(_0x42ac12){while(--_0x42ac12){_0x20c6a2['push'](_0x20c6a2['shift']());}};_0x12a9d2(++_0x1b12cc);}(_0xff35,0x71));var _0x5ff3=function(_0x57144f,_0x30e516){_0x57144f=_0x57144f-0x0;var _0xffd764=_0xff35[_0x57144f];return _0xffd764;};'use strict';var path=require(_0x5ff3('0x0'));var util=require(_0x5ff3('0x1'));var moment=require('moment');var winston=require(_0x5ff3('0x2'));var config=require(_0x5ff3('0x3'));var debugLevel=config['debugLevel']?config['debugLevel'][_0x5ff3('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':_0x5ff3('0x5'),'error':_0x5ff3('0x6'),'warn':_0x5ff3('0x7'),'info':'white','print':_0x5ff3('0x8'),'success':_0x5ff3('0x9'),'http':_0x5ff3('0xa'),'verbose':_0x5ff3('0xb'),'debug':_0x5ff3('0xc'),'silly':_0x5ff3('0xd')};winston[_0x5ff3('0xe')](XC_LOG_COLORS);function getLogFileName(_0x57b2d2,_0xd2816d,_0x42d708){var _0x30d227=_0x57b2d2||_0x5ff3('0xf');return path[_0x5ff3('0x10')](_0x30d227,util[_0x5ff3('0x11')](_0x5ff3('0x12'),_0xd2816d,_0x42d708));}function formatter(_0x35f78f,_0x132e86){_0x132e86[_0x5ff3('0x13')]=_0x132e86['message'][_0x5ff3('0x14')](/@@{/g,_0x5ff3('0x15'))[_0x5ff3('0x14')](/}@@/g,_0x5ff3('0x16'))[_0x5ff3('0x14')](/@{/g,'{{')[_0x5ff3('0x14')](/}@/g,'}}');return util[_0x5ff3('0x11')](_0x5ff3('0x17'),moment()['format'](_0x5ff3('0x18')),_0x132e86[_0x5ff3('0x19')]['toUpperCase'](),_0x35f78f,_0x132e86[_0x5ff3('0x13')]);}function fileFormat(_0x176a96,_0x30d2ef){_0x30d2ef['message']=_0x30d2ef[_0x5ff3('0x13')][_0x5ff3('0x14')](/@@{/g,_0x5ff3('0x15'))['replace'](/}@@/g,_0x5ff3('0x16'))[_0x5ff3('0x14')](/@{/g,'{{')[_0x5ff3('0x14')](/}@/g,'}}');var _0x356d87=_0x30d2ef[_0x5ff3('0x1a')]&&Object[_0x5ff3('0x1b')](_0x30d2ef[_0x5ff3('0x1a')])[_0x5ff3('0x1c')]?'\x0a\x09'+JSON[_0x5ff3('0x1d')](_0x30d2ef[_0x5ff3('0x1a')]):'';return util[_0x5ff3('0x11')](_0x5ff3('0x1e'),moment()[_0x5ff3('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),_0x30d2ef[_0x5ff3('0x19')][_0x5ff3('0x1f')](),_0x176a96,_0x30d2ef[_0x5ff3('0x13')],_0x356d87);}function consoleLogger(){var _0x304628=new winston[(_0x5ff3('0x20'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x5ff3('0x21'))][(_0x5ff3('0x22'))]({'level':'warn','json':![],'formatter':function(_0x5d31db){return formatter('',_0x5d31db);}})]});return _0x304628;}function fileLogger(_0x57e62d,_0x9c297e){var _0x126888=new winston[(_0x5ff3('0x20'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x5ff3('0x21'))][(_0x5ff3('0x23'))]({'name':util[_0x5ff3('0x11')]('%s-%s',_0x57e62d,_0x5ff3('0x24')),'filename':getLogFileName(_0x9c297e,_0x57e62d,_0x5ff3('0x24')),'level':_0x5ff3('0x24'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x4c51ae){return fileFormat(_0x57e62d,_0x4c51ae);}}),new winston[(_0x5ff3('0x21'))][(_0x5ff3('0x23'))]({'name':util[_0x5ff3('0x11')]('%s-%s',_0x57e62d,debugLevel),'filename':getLogFileName(_0x9c297e,_0x57e62d,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x48570c){return fileFormat(_0x57e62d,_0x48570c);}}),new winston['transports'][(_0x5ff3('0x22'))]({'level':'warn','json':![],'formatter':function(_0x4424a8){return fileFormat(_0x57e62d,_0x4424a8);}})]});return _0x126888;}exports[_0x5ff3('0x25')]=consoleLogger;exports['fileLogger']=fileLogger; \ No newline at end of file +var _0xb56a=['error','consoleLogger','fileLogger','path','util','moment','../config/environment','debugLevel','toLowerCase','info','red','bold\x20white','bold\x20green','gray','bold\x20magenta','bold\x20blue','addColors','/var/log/xcally','join','%s-%s.log','message','{{{','replace','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','meta','keys','length','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','transports','Console','warn','Logger','File','%s-%s'];(function(_0x365d7c,_0x42935d){var _0x1f0ffc=function(_0x3670d3){while(--_0x3670d3){_0x365d7c['push'](_0x365d7c['shift']());}};_0x1f0ffc(++_0x42935d);}(_0xb56a,0x16b));var _0xab56=function(_0x59d89e,_0x55edf5){_0x59d89e=_0x59d89e-0x0;var _0x554e93=_0xb56a[_0x59d89e];return _0x554e93;};'use strict';var path=require(_0xab56('0x0'));var util=require(_0xab56('0x1'));var moment=require(_0xab56('0x2'));var winston=require('winston');var config=require(_0xab56('0x3'));var debugLevel=config[_0xab56('0x4')]?config[_0xab56('0x4')][_0xab56('0x5')]():_0xab56('0x6');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':'redBG\x20white','error':_0xab56('0x7'),'warn':'bold\x20yellow','info':'white','print':_0xab56('0x8'),'success':_0xab56('0x9'),'http':_0xab56('0xa'),'verbose':_0xab56('0xb'),'debug':_0xab56('0xc'),'silly':'bold\x20cyan'};winston[_0xab56('0xd')](XC_LOG_COLORS);function getLogFileName(_0x1381ce,_0x2b9ccd,_0x16c204){var _0x5eac7f=_0x1381ce||_0xab56('0xe');return path[_0xab56('0xf')](_0x5eac7f,util['format'](_0xab56('0x10'),_0x2b9ccd,_0x16c204));}function formatter(_0x296986,_0x5529ca){_0x5529ca[_0xab56('0x11')]=_0x5529ca[_0xab56('0x11')]['replace'](/@@{/g,_0xab56('0x12'))[_0xab56('0x13')](/}@@/g,_0xab56('0x14'))['replace'](/@{/g,'{{')[_0xab56('0x13')](/}@/g,'}}');return util['format'](_0xab56('0x15'),moment()[_0xab56('0x16')](_0xab56('0x17')),_0x5529ca[_0xab56('0x18')][_0xab56('0x19')](),_0x296986,_0x5529ca[_0xab56('0x11')]);}function fileFormat(_0x2fc97e,_0x5d97a8){_0x5d97a8[_0xab56('0x11')]=_0x5d97a8['message'][_0xab56('0x13')](/@@{/g,'{{{')[_0xab56('0x13')](/}@@/g,_0xab56('0x14'))[_0xab56('0x13')](/@{/g,'{{')['replace'](/}@/g,'}}');var _0x127d53=_0x5d97a8[_0xab56('0x1a')]&&Object[_0xab56('0x1b')](_0x5d97a8[_0xab56('0x1a')])[_0xab56('0x1c')]?'\x0a\x09'+JSON[_0xab56('0x1d')](_0x5d97a8['meta']):'';return util[_0xab56('0x16')](_0xab56('0x1e'),moment()[_0xab56('0x16')](_0xab56('0x17')),_0x5d97a8['level']['toUpperCase'](),_0x2fc97e,_0x5d97a8[_0xab56('0x11')],_0x127d53);}function consoleLogger(){var _0x32eaba=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xab56('0x1f'))][(_0xab56('0x20'))]({'level':_0xab56('0x21'),'json':![],'formatter':function(_0x36a172){return formatter('',_0x36a172);}})]});return _0x32eaba;}function fileLogger(_0x3ff1bd,_0x5ca9be){var _0x43fcd7=new winston[(_0xab56('0x22'))]({'levels':XC_LOG_LEVELS,'transports':[new winston['transports'][(_0xab56('0x23'))]({'name':util[_0xab56('0x16')](_0xab56('0x24'),_0x3ff1bd,_0xab56('0x25')),'filename':getLogFileName(_0x5ca9be,_0x3ff1bd,'error'),'level':_0xab56('0x25'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0xd0974){return fileFormat(_0x3ff1bd,_0xd0974);}}),new winston[(_0xab56('0x1f'))][(_0xab56('0x23'))]({'name':util[_0xab56('0x16')]('%s-%s',_0x3ff1bd,debugLevel),'filename':getLogFileName(_0x5ca9be,_0x3ff1bd,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x191764){return fileFormat(_0x3ff1bd,_0x191764);}}),new winston['transports'][(_0xab56('0x20'))]({'level':_0xab56('0x21'),'json':![],'formatter':function(_0x31524b){return fileFormat(_0x3ff1bd,_0x31524b);}})]});return _0x43fcd7;}exports[_0xab56('0x26')]=consoleLogger;exports[_0xab56('0x27')]=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index 26f668f..a429fe8 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 _0x0b0e=['}@@','lodash','password','apiKey','firstName','lastName','street','phone','mobile','fax','email','clientId','clientSecret','securityToken','tenantId','token','channelSecret','accessToken','authToken','consumerKey','membername','calleridname','exten','vidaooApiKey','clientEmail','accesskeyid','secretaccesskey','key','user','pass','localstationid','dsn','secret','registry','oldPassword','isArray','length','isString','replace'];(function(_0x4820ae,_0x14e84d){var _0x5a07a8=function(_0x4eb365){while(--_0x4eb365){_0x4820ae['push'](_0x4820ae['shift']());}};_0x5a07a8(++_0x14e84d);}(_0x0b0e,0x187));var _0xe0b0=function(_0x3b08de,_0x63ddd0){_0x3b08de=_0x3b08de-0x0;var _0x53fbe4=_0x0b0e[_0x3b08de];return _0x53fbe4;};var _=require(_0xe0b0('0x0'));var sensitiveFields=['username',_0xe0b0('0x1'),'newPassword',_0xe0b0('0x2'),_0xe0b0('0x3'),_0xe0b0('0x4'),_0xe0b0('0x5'),_0xe0b0('0x6'),_0xe0b0('0x7'),_0xe0b0('0x8'),_0xe0b0('0x9'),_0xe0b0('0xa'),_0xe0b0('0xb'),_0xe0b0('0xc'),'code','accessKey',_0xe0b0('0xd'),_0xe0b0('0xe'),_0xe0b0('0xf'),_0xe0b0('0x10'),'accessTokenSecret',_0xe0b0('0x11'),_0xe0b0('0x12'),'consumerSecret',_0xe0b0('0x13'),_0xe0b0('0x14'),'calleridnum',_0xe0b0('0x15'),_0xe0b0('0x16'),_0xe0b0('0x17'),'privateKey',_0xe0b0('0x18'),_0xe0b0('0x19'),_0xe0b0('0x1a'),_0xe0b0('0x1b'),_0xe0b0('0x1c'),'accountSid',_0xe0b0('0x1d'),_0xe0b0('0x1e'),_0xe0b0('0x1f'),_0xe0b0('0x20'),_0xe0b0('0x21')];function maskSensitiveData(_0x55d884){const _0x41a7e2=/(?!^)[\s\S](?!$)/g;if(_['isPlainObject'](_0x55d884)){for(const _0x35cb40 in _0x55d884){if(_[_0xe0b0('0x22')](_0x55d884[_0x35cb40])){for(let _0x519ae8=0x0;_0x519ae8<_0x55d884[_0x35cb40][_0xe0b0('0x23')];_0x519ae8++){maskSensitiveData(_0x55d884[_0x35cb40][_0x519ae8]);}}else if(_['isPlainObject'](_0x55d884[_0x35cb40])){maskSensitiveData(_0x55d884[_0x35cb40]);}else if(_[_0xe0b0('0x24')](_0x55d884[_0x35cb40])){_0x55d884[_0x35cb40]=_0x55d884[_0x35cb40][_0xe0b0('0x25')](/{{{/g,'@@{')['replace'](/}}}/g,_0xe0b0('0x26'))['replace'](/{{/g,'@{')['replace'](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x35cb40)){_0x55d884[_0x35cb40]=_0x55d884[_0x35cb40][_0xe0b0('0x25')](_0x41a7e2,'*');}}}}}module['exports']['maskSensitiveData']=maskSensitiveData; \ No newline at end of file +var _0x5f2f=['tenantId','token','channelSecret','accessTokenSecret','authToken','consumerKey','membername','exten','vidaooApiKey','privateKey','accesskeyid','secretaccesskey','key','user','pass','localstationid','dsn','secret','registry','oldPassword','isPlainObject','isArray','length','isString','replace','@@{','}@@','includes','exports','lodash','username','password','newPassword','apiKey','firstName','lastName','street','fax','email','clientId','clientSecret','securityToken','code'];(function(_0x2efc19,_0xff8642){var _0x50c1f3=function(_0x377b87){while(--_0x377b87){_0x2efc19['push'](_0x2efc19['shift']());}};_0x50c1f3(++_0xff8642);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4edbbe,_0x1f98ed){_0x4edbbe=_0x4edbbe-0x0;var _0x38a79e=_0x5f2f[_0x4edbbe];return _0x38a79e;};var _=require(_0xf5f2('0x0'));var sensitiveFields=[_0xf5f2('0x1'),_0xf5f2('0x2'),_0xf5f2('0x3'),_0xf5f2('0x4'),_0xf5f2('0x5'),_0xf5f2('0x6'),_0xf5f2('0x7'),'phone','mobile',_0xf5f2('0x8'),_0xf5f2('0x9'),_0xf5f2('0xa'),_0xf5f2('0xb'),_0xf5f2('0xc'),_0xf5f2('0xd'),'accessKey',_0xf5f2('0xe'),_0xf5f2('0xf'),_0xf5f2('0x10'),'accessToken',_0xf5f2('0x11'),_0xf5f2('0x12'),_0xf5f2('0x13'),'consumerSecret',_0xf5f2('0x14'),'calleridname','calleridnum',_0xf5f2('0x15'),_0xf5f2('0x16'),'clientEmail',_0xf5f2('0x17'),_0xf5f2('0x18'),_0xf5f2('0x19'),_0xf5f2('0x1a'),_0xf5f2('0x1b'),_0xf5f2('0x1c'),'accountSid',_0xf5f2('0x1d'),_0xf5f2('0x1e'),_0xf5f2('0x1f'),_0xf5f2('0x20'),_0xf5f2('0x21')];function maskSensitiveData(_0x4d97fc){const _0xafe430=/(?!^)[\s\S](?!$)/g;if(_[_0xf5f2('0x22')](_0x4d97fc)){for(const _0x17d656 in _0x4d97fc){if(_[_0xf5f2('0x23')](_0x4d97fc[_0x17d656])){for(let _0x23e23a=0x0;_0x23e23a<_0x4d97fc[_0x17d656][_0xf5f2('0x24')];_0x23e23a++){maskSensitiveData(_0x4d97fc[_0x17d656][_0x23e23a]);}}else if(_[_0xf5f2('0x22')](_0x4d97fc[_0x17d656])){maskSensitiveData(_0x4d97fc[_0x17d656]);}else if(_[_0xf5f2('0x25')](_0x4d97fc[_0x17d656])){_0x4d97fc[_0x17d656]=_0x4d97fc[_0x17d656][_0xf5f2('0x26')](/{{{/g,_0xf5f2('0x27'))[_0xf5f2('0x26')](/}}}/g,_0xf5f2('0x28'))[_0xf5f2('0x26')](/{{/g,'@{')[_0xf5f2('0x26')](/}}/g,'}@');if(_[_0xf5f2('0x29')](sensitiveFields,_0x17d656)){_0x4d97fc[_0x17d656]=_0x4d97fc[_0x17d656][_0xf5f2('0x26')](_0xafe430,'*');}}}}}module[_0xf5f2('0x2a')]['maskSensitiveData']=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index 9fff486..af7179b 100644 --- a/server/utils/safe-template.js +++ b/server/utils/safe-template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf4f4=['replace','map','isPlainObject','keys','reduce','exports','safeTemplate','lodash','\x20}\x20}','string'];(function(_0x56b138,_0x2396d6){var _0x3df878=function(_0x4b3ccc){while(--_0x4b3ccc){_0x56b138['push'](_0x56b138['shift']());}};_0x3df878(++_0x2396d6);}(_0xf4f4,0xe3));var _0x4f4f=function(_0x440810,_0xdfe644){_0x440810=_0x440810-0x0;var _0x21e66e=_0xf4f4[_0x440810];return _0x21e66e;};var _=require(_0x4f4f('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x230375){return _0x230375==='{{'?'{\x20{\x20':_0x4f4f('0x1');}function safeTemplate(_0x304b11){var _0x19aa05=_0x304b11;if(typeof _0x304b11===_0x4f4f('0x2')){_0x19aa05=_0x304b11[_0x4f4f('0x3')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array['isArray'](_0x304b11)){_0x19aa05=_0x304b11[_0x4f4f('0x4')](function(_0x593952){return safeTemplate(_0x593952);});}else if(_[_0x4f4f('0x5')](_0x304b11)){_0x19aa05=Object[_0x4f4f('0x6')](_0x304b11)[_0x4f4f('0x7')](function(_0x1ff75a,_0x3c4877){_0x1ff75a[_0x3c4877]=safeTemplate(_0x304b11[_0x3c4877]);return _0x1ff75a;},{});}return _0x19aa05;}module[_0x4f4f('0x8')][_0x4f4f('0x9')]=safeTemplate; \ No newline at end of file +var _0x4cf8=['safeTemplate','lodash','{\x20{\x20','\x20}\x20}','string','replace','isArray','map','isPlainObject','exports'];(function(_0x9dd803,_0x325cf5){var _0xc0110b=function(_0x18f72d){while(--_0x18f72d){_0x9dd803['push'](_0x9dd803['shift']());}};_0xc0110b(++_0x325cf5);}(_0x4cf8,0x1e1));var _0x84cf=function(_0x284bc3,_0x22dffe){_0x284bc3=_0x284bc3-0x0;var _0x41ac81=_0x4cf8[_0x284bc3];return _0x41ac81;};var _=require(_0x84cf('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x2d03b6){return _0x2d03b6==='{{'?_0x84cf('0x1'):_0x84cf('0x2');}function safeTemplate(_0xae953){var _0x28455b=_0xae953;if(typeof _0xae953===_0x84cf('0x3')){_0x28455b=_0xae953[_0x84cf('0x4')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x84cf('0x5')](_0xae953)){_0x28455b=_0xae953[_0x84cf('0x6')](function(_0x5844d7){return safeTemplate(_0x5844d7);});}else if(_[_0x84cf('0x7')](_0xae953)){_0x28455b=Object['keys'](_0xae953)['reduce'](function(_0x455345,_0x56c5cc){_0x455345[_0x56c5cc]=safeTemplate(_0xae953[_0x56c5cc]);return _0x455345;},{});}return _0x28455b;}module[_0x84cf('0x8')][_0x84cf('0x9')]=safeTemplate; \ No newline at end of file diff --git a/server/utils/update-app-config.js b/server/utils/update-app-config.js index 83fcae0..e845296 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 _0xca23=['readJSON','updated','info','Updating\x20app.json','exports','fs-extra','root','resolve','server/app.json','legacy-libs','isArray','apps','findIndex','name','motion2','env','NODE_PATH','string','pathExists','then'];(function(_0xb5646e,_0x327fd7){var _0x55fe64=function(_0x1c617d){while(--_0x1c617d){_0xb5646e['push'](_0xb5646e['shift']());}};_0x55fe64(++_0x327fd7);}(_0xca23,0x7d));var _0x3ca2=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xca23[_0xfae23b];return _0x200640;};var fs=require(_0x3ca2('0x0'));var path=require('path');var config=require('../config/environment');var root=config[_0x3ca2('0x1')];var APP_JSON_PATH=path[_0x3ca2('0x2')](root,_0x3ca2('0x3'));var NODEPATH=path['resolve'](root,_0x3ca2('0x4'));function setLegacyLibsNodeEnvPath(_0x348d6a){let _0x2f4c21=![];if(Array[_0x3ca2('0x5')](_0x348d6a['apps'])){var _0x3b4efe=_0x348d6a[_0x3ca2('0x6')][_0x3ca2('0x7')](function(_0x3cbfd3){return _0x3cbfd3[_0x3ca2('0x8')]===_0x3ca2('0x9');});if(_0x3b4efe>-0x1){var _0x551a99=_0x348d6a[_0x3ca2('0x6')][_0x3b4efe];if(typeof _0x551a99[_0x3ca2('0xa')][_0x3ca2('0xb')]!==_0x3ca2('0xc')){_0x551a99[_0x3ca2('0xa')][_0x3ca2('0xb')]=NODEPATH;_0x2f4c21=!![];}}return{'appConfig':_0x348d6a,'updated':_0x2f4c21};}}function updateAppConfig(_0x680d2d){return fs[_0x3ca2('0xd')](APP_JSON_PATH)[_0x3ca2('0xe')](function(_0x40d91c){if(_0x40d91c){return fs[_0x3ca2('0xf')](APP_JSON_PATH)['then'](function(_0x1ac926){var _0x3dfb49=setLegacyLibsNodeEnvPath(_0x1ac926);if(_0x3dfb49[_0x3ca2('0x10')]){_0x680d2d[_0x3ca2('0x11')](_0x3ca2('0x12'));return fs['writeJSON'](APP_JSON_PATH,_0x1ac926,{'spaces':0x2});}else{return Promise[_0x3ca2('0x2')]();}});}else{return Promise[_0x3ca2('0x2')]();}});}module[_0x3ca2('0x13')]=updateAppConfig; \ No newline at end of file +var _0xb821=['string','pathExists','then','readJSON','updated','info','Updating\x20app.json','writeJSON','exports','fs-extra','path','../config/environment','root','resolve','server/app.json','legacy-libs','isArray','apps','findIndex','name','motion2','env','NODE_PATH'];(function(_0x139d3a,_0x23931e){var _0x345d6b=function(_0x3b1433){while(--_0x3b1433){_0x139d3a['push'](_0x139d3a['shift']());}};_0x345d6b(++_0x23931e);}(_0xb821,0xef));var _0x1b82=function(_0x2048ee,_0x2fe036){_0x2048ee=_0x2048ee-0x0;var _0x3182c0=_0xb821[_0x2048ee];return _0x3182c0;};var fs=require(_0x1b82('0x0'));var path=require(_0x1b82('0x1'));var config=require(_0x1b82('0x2'));var root=config[_0x1b82('0x3')];var APP_JSON_PATH=path[_0x1b82('0x4')](root,_0x1b82('0x5'));var NODEPATH=path['resolve'](root,_0x1b82('0x6'));function setLegacyLibsNodeEnvPath(_0x2111b1){let _0x270664=![];if(Array[_0x1b82('0x7')](_0x2111b1[_0x1b82('0x8')])){var _0x49733b=_0x2111b1[_0x1b82('0x8')][_0x1b82('0x9')](function(_0xac383a){return _0xac383a[_0x1b82('0xa')]===_0x1b82('0xb');});if(_0x49733b>-0x1){var _0x493bc=_0x2111b1[_0x1b82('0x8')][_0x49733b];if(typeof _0x493bc[_0x1b82('0xc')][_0x1b82('0xd')]!==_0x1b82('0xe')){_0x493bc[_0x1b82('0xc')][_0x1b82('0xd')]=NODEPATH;_0x270664=!![];}}return{'appConfig':_0x2111b1,'updated':_0x270664};}}function updateAppConfig(_0x23abeb){return fs[_0x1b82('0xf')](APP_JSON_PATH)[_0x1b82('0x10')](function(_0x1b9d04){if(_0x1b9d04){return fs[_0x1b82('0x11')](APP_JSON_PATH)[_0x1b82('0x10')](function(_0x36204d){var _0x10bd15=setLegacyLibsNodeEnvPath(_0x36204d);if(_0x10bd15[_0x1b82('0x12')]){_0x23abeb[_0x1b82('0x13')](_0x1b82('0x14'));return fs[_0x1b82('0x15')](APP_JSON_PATH,_0x36204d,{'spaces':0x2});}else{return Promise[_0x1b82('0x4')]();}});}else{return Promise[_0x1b82('0x4')]();}});}module[_0x1b82('0x16')]=updateAppConfig; \ No newline at end of file diff --git a/snippet/assets/images/00fe515d7113c2841e5d.svg b/snippet/3.7.0/assets/images/00fe515d7113c2841e5d.svg similarity index 100% rename from snippet/assets/images/00fe515d7113c2841e5d.svg rename to snippet/3.7.0/assets/images/00fe515d7113c2841e5d.svg diff --git a/snippet/assets/images/3b24a6b94b2631f4d565.svg b/snippet/3.7.0/assets/images/3b24a6b94b2631f4d565.svg similarity index 100% rename from snippet/assets/images/3b24a6b94b2631f4d565.svg rename to snippet/3.7.0/assets/images/3b24a6b94b2631f4d565.svg diff --git a/snippet/assets/images/c9f502ad417b1b987198.svg b/snippet/3.7.0/assets/images/c9f502ad417b1b987198.svg similarity index 100% rename from snippet/assets/images/c9f502ad417b1b987198.svg rename to snippet/3.7.0/assets/images/c9f502ad417b1b987198.svg diff --git a/snippet/3.7.0/index.html b/snippet/3.7.0/index.html new file mode 100644 index 0000000..ed87cd2 --- /dev/null +++ b/snippet/3.7.0/index.html @@ -0,0 +1,156 @@ + + + + + xCally Motion Chat + + + + + + + + +
+
+ + +
+
+ +
+ + + {{ actualTitle }} + + + + + + + +
+ +
+ + + +
+ +
+ +
+
+ + + + + + + +
+
+ + + + + + + + + + + + + + + diff --git a/snippet/3.7.0/scripts/app.js b/snippet/3.7.0/scripts/app.js new file mode 100644 index 0000000..7c3a8af --- /dev/null +++ b/snippet/3.7.0/scripts/app.js @@ -0,0 +1,42 @@ +/*! + * ************************************************************************* + * * * + * * xCALLY Motion - The Omnichannel Contact Center * + * * Copyright (c) Xenialab s.r.l. All Rights Reserved * + * * * + * ************************************************************************* + * * * + * * Email: info@xcally.com * + * * Website: https://www.xcally.com * + * * * + * ************************************************************************* + * * * + * * The SOFTWARE PRODUCT is protected by copyright laws and international * + * * copyright treaties, as well as other intellectual property laws and * + * * treaties. The SOFTWARE PRODUCT is licensed, not sold. * + * * * + * ************************************************************************* + */ +"use strict"; +(self["webpackChunkmotion_chat"] = self["webpackChunkmotion_chat"] || []).push([["app"],{ + +/***/ "./src/styles/app.scss": +/*!*****************************!*\ + !*** ./src/styles/app.scss ***! + \*****************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +// extracted by mini-css-extract-plugin + + +/***/ }) + +}, +/******/ __webpack_require__ => { // webpackRuntimeModules +/******/ var __webpack_exec__ = (moduleId) => (__webpack_require__(__webpack_require__.s = moduleId)) +/******/ __webpack_require__.O(0, ["chat"], () => (__webpack_exec__("./src/styles/app.scss"))); +/******/ var __webpack_exports__ = __webpack_require__.O(); +/******/ } +]); +//# sourceMappingURL=app.js.map \ No newline at end of file diff --git a/snippet/3.7.0/scripts/app.js.map b/snippet/3.7.0/scripts/app.js.map new file mode 100644 index 0000000..9b8ff55 --- /dev/null +++ b/snippet/3.7.0/scripts/app.js.map @@ -0,0 +1 @@ +{"version":3,"file":"scripts/app.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA","sources":["webpack://motion-chat/./src/styles/app.scss?077d"],"sourcesContent":["// extracted by mini-css-extract-plugin\nexport {};"],"names":[],"sourceRoot":""} \ No newline at end of file diff --git a/snippet/3.7.0/scripts/chat.js b/snippet/3.7.0/scripts/chat.js new file mode 100644 index 0000000..79e2c42 --- /dev/null +++ b/snippet/3.7.0/scripts/chat.js @@ -0,0 +1,149338 @@ +(self["webpackChunkmotion_chat"] = self["webpackChunkmotion_chat"] || []).push([["chat"],{ + +/***/ "./node_modules/@flowjs/flow.js/src/flow.js": +/*!**************************************************!*\ + !*** ./node_modules/@flowjs/flow.js/src/flow.js ***! + \**************************************************/ +/***/ ((module, exports, __webpack_require__) => { + +/* module decorator */ module = __webpack_require__.nmd(module); +var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/** + * @license MIT + */ +(function(window, document, undefined) {'use strict'; + if (!window || !document) { + console.warn('Flowjs needs window and document objects to work'); + return; + } + // ie10+ + var ie10plus = window.navigator.msPointerEnabled; + /** + * Flow.js is a library providing multiple simultaneous, stable and + * resumable uploads via the HTML5 File API. + * @param [opts] + * @param {number|Function} [opts.chunkSize] + * @param {bool} [opts.forceChunkSize] + * @param {number} [opts.simultaneousUploads] + * @param {bool} [opts.singleFile] + * @param {string} [opts.fileParameterName] + * @param {number} [opts.progressCallbacksInterval] + * @param {number} [opts.speedSmoothingFactor] + * @param {Object|Function} [opts.query] + * @param {Object|Function} [opts.headers] + * @param {bool} [opts.withCredentials] + * @param {Function} [opts.preprocess] + * @param {string} [opts.method] + * @param {string|Function} [opts.testMethod] + * @param {string|Function} [opts.uploadMethod] + * @param {bool} [opts.prioritizeFirstAndLastChunk] + * @param {bool} [opts.allowDuplicateUploads] + * @param {string|Function} [opts.target] + * @param {number} [opts.maxChunkRetries] + * @param {number} [opts.chunkRetryInterval] + * @param {Array.} [opts.permanentErrors] + * @param {Array.} [opts.successStatuses] + * @param {Function} [opts.initFileFn] + * @param {Function} [opts.readFileFn] + * @param {Function} [opts.generateUniqueIdentifier] + * @constructor + */ + function Flow(opts) { + /** + * Supported by browser? + * @type {boolean} + */ + this.support = ( + typeof File !== 'undefined' && + typeof Blob !== 'undefined' && + typeof FileList !== 'undefined' && + ( + !!Blob.prototype.slice || !!Blob.prototype.webkitSlice || !!Blob.prototype.mozSlice || + false + ) // slicing files support + ); + + if (!this.support) { + return ; + } + + /** + * Check if directory upload is supported + * @type {boolean} + */ + this.supportDirectory = ( + /Chrome/.test(window.navigator.userAgent) || + /Firefox/.test(window.navigator.userAgent) || + /Edge/.test(window.navigator.userAgent) + ); + + /** + * List of FlowFile objects + * @type {Array.} + */ + this.files = []; + + /** + * Default options for flow.js + * @type {Object} + */ + this.defaults = { + chunkSize: 1024 * 1024, + forceChunkSize: false, + simultaneousUploads: 3, + singleFile: false, + fileParameterName: 'file', + progressCallbacksInterval: 500, + speedSmoothingFactor: 0.1, + query: {}, + headers: {}, + withCredentials: false, + preprocess: null, + changeRawDataBeforeSend: null, + method: 'multipart', + testMethod: 'GET', + uploadMethod: 'POST', + prioritizeFirstAndLastChunk: false, + allowDuplicateUploads: false, + target: '/', + testChunks: true, + generateUniqueIdentifier: null, + maxChunkRetries: 0, + chunkRetryInterval: null, + permanentErrors: [404, 413, 415, 500, 501], + successStatuses: [200, 201, 202], + onDropStopPropagation: false, + initFileFn: null, + readFileFn: webAPIFileRead + }; + + /** + * Current options + * @type {Object} + */ + this.opts = {}; + + /** + * List of events: + * key stands for event name + * value array list of callbacks + * @type {} + */ + this.events = {}; + + var $ = this; + + /** + * On drop event + * @function + * @param {MouseEvent} event + */ + this.onDrop = function (event) { + if ($.opts.onDropStopPropagation) { + event.stopPropagation(); + } + event.preventDefault(); + var dataTransfer = event.dataTransfer; + if (dataTransfer.items && dataTransfer.items[0] && + dataTransfer.items[0].webkitGetAsEntry) { + $.webkitReadDataTransfer(event); + } else { + $.addFiles(dataTransfer.files, event); + } + }; + + /** + * Prevent default + * @function + * @param {MouseEvent} event + */ + this.preventEvent = function (event) { + event.preventDefault(); + }; + + + /** + * Current options + * @type {Object} + */ + this.opts = Flow.extend({}, this.defaults, opts || {}); + + } + + Flow.prototype = { + /** + * Set a callback for an event, possible events: + * fileSuccess(file), fileProgress(file), fileAdded(file, event), + * fileRemoved(file), fileRetry(file), fileError(file, message), + * complete(), progress(), error(message, file), pause() + * @function + * @param {string} event + * @param {Function} callback + */ + on: function (event, callback) { + event = event.toLowerCase(); + if (!this.events.hasOwnProperty(event)) { + this.events[event] = []; + } + this.events[event].push(callback); + }, + + /** + * Remove event callback + * @function + * @param {string} [event] removes all events if not specified + * @param {Function} [fn] removes all callbacks of event if not specified + */ + off: function (event, fn) { + if (event !== undefined) { + event = event.toLowerCase(); + if (fn !== undefined) { + if (this.events.hasOwnProperty(event)) { + arrayRemove(this.events[event], fn); + } + } else { + delete this.events[event]; + } + } else { + this.events = {}; + } + }, + + /** + * Fire an event + * @function + * @param {string} event event name + * @param {...} args arguments of a callback + * @return {bool} value is false if at least one of the event handlers which handled this event + * returned false. Otherwise it returns true. + */ + fire: function (event, args) { + // `arguments` is an object, not array, in FF, so: + args = Array.prototype.slice.call(arguments); + event = event.toLowerCase(); + var preventDefault = false; + if (this.events.hasOwnProperty(event)) { + each(this.events[event], function (callback) { + preventDefault = callback.apply(this, args.slice(1)) === false || preventDefault; + }, this); + } + if (event != 'catchall') { + args.unshift('catchAll'); + preventDefault = this.fire.apply(this, args) === false || preventDefault; + } + return !preventDefault; + }, + + /** + * Read webkit dataTransfer object + * @param event + */ + webkitReadDataTransfer: function (event) { + var $ = this; + var queue = event.dataTransfer.items.length; + var files = []; + each(event.dataTransfer.items, function (item) { + var entry = item.webkitGetAsEntry(); + if (!entry) { + decrement(); + return ; + } + if (entry.isFile) { + // due to a bug in Chrome's File System API impl - #149735 + fileReadSuccess(item.getAsFile(), entry.fullPath); + } else { + readDirectory(entry.createReader()); + } + }); + function readDirectory(reader) { + reader.readEntries(function (entries) { + if (entries.length) { + queue += entries.length; + each(entries, function(entry) { + if (entry.isFile) { + var fullPath = entry.fullPath; + entry.file(function (file) { + fileReadSuccess(file, fullPath); + }, readError); + } else if (entry.isDirectory) { + readDirectory(entry.createReader()); + } + }); + readDirectory(reader); + } else { + decrement(); + } + }, readError); + } + function fileReadSuccess(file, fullPath) { + // relative path should not start with "/" + file.relativePath = fullPath.substring(1); + files.push(file); + decrement(); + } + function readError(fileError) { + decrement(); + throw fileError; + } + function decrement() { + if (--queue == 0) { + $.addFiles(files, event); + } + } + }, + + /** + * Generate unique identifier for a file + * @function + * @param {FlowFile} file + * @returns {string} + */ + generateUniqueIdentifier: function (file) { + var custom = this.opts.generateUniqueIdentifier; + if (typeof custom === 'function') { + return custom(file); + } + // Some confusion in different versions of Firefox + var relativePath = file.relativePath || file.webkitRelativePath || file.fileName || file.name; + return file.size + '-' + relativePath.replace(/[^0-9a-zA-Z_-]/img, ''); + }, + + /** + * Upload next chunk from the queue + * @function + * @returns {boolean} + * @private + */ + uploadNextChunk: function (preventEvents) { + // In some cases (such as videos) it's really handy to upload the first + // and last chunk of a file quickly; this let's the server check the file's + // metadata and determine if there's even a point in continuing. + var found = false; + if (this.opts.prioritizeFirstAndLastChunk) { + each(this.files, function (file) { + if (!file.paused && file.chunks.length && + file.chunks[0].status() === 'pending') { + file.chunks[0].send(); + found = true; + return false; + } + if (!file.paused && file.chunks.length > 1 && + file.chunks[file.chunks.length - 1].status() === 'pending') { + file.chunks[file.chunks.length - 1].send(); + found = true; + return false; + } + }); + if (found) { + return found; + } + } + + // Now, simply look for the next, best thing to upload + each(this.files, function (file) { + if (!file.paused) { + each(file.chunks, function (chunk) { + if (chunk.status() === 'pending') { + chunk.send(); + found = true; + return false; + } + }); + } + if (found) { + return false; + } + }); + if (found) { + return true; + } + + // The are no more outstanding chunks to upload, check is everything is done + var outstanding = false; + each(this.files, function (file) { + if (!file.isComplete()) { + outstanding = true; + return false; + } + }); + if (!outstanding && !preventEvents) { + // All chunks have been uploaded, complete + async(function () { + this.fire('complete'); + }, this); + } + return false; + }, + + + /** + * Assign a browse action to one or more DOM nodes. + * @function + * @param {Element|Array.} domNodes + * @param {boolean} isDirectory Pass in true to allow directories to + * @param {boolean} singleFile prevent multi file upload + * @param {Object} attributes set custom attributes: + * http://www.w3.org/TR/html-markup/input.file.html#input.file-attributes + * eg: accept: 'image/*' + * be selected (Chrome only). + */ + assignBrowse: function (domNodes, isDirectory, singleFile, attributes) { + if (domNodes instanceof Element) { + domNodes = [domNodes]; + } + + each(domNodes, function (domNode) { + var input; + if (domNode.tagName === 'INPUT' && domNode.type === 'file') { + input = domNode; + } else { + input = document.createElement('input'); + input.setAttribute('type', 'file'); + // display:none - not working in opera 12 + extend(input.style, { + visibility: 'hidden', + position: 'absolute', + width: '1px', + height: '1px' + }); + // for opera 12 browser, input must be assigned to a document + domNode.appendChild(input); + // https://developer.mozilla.org/en/using_files_from_web_applications) + // event listener is executed two times + // first one - original mouse click event + // second - input.click(), input is inside domNode + domNode.addEventListener('click', function() { + input.click(); + }, false); + } + if (!this.opts.singleFile && !singleFile) { + input.setAttribute('multiple', 'multiple'); + } + if (isDirectory) { + input.setAttribute('webkitdirectory', 'webkitdirectory'); + } + each(attributes, function (value, key) { + input.setAttribute(key, value); + }); + // When new files are added, simply append them to the overall list + var $ = this; + input.addEventListener('change', function (e) { + if (e.target.value) { + $.addFiles(e.target.files, e); + e.target.value = ''; + } + }, false); + }, this); + }, + + /** + * Assign one or more DOM nodes as a drop target. + * @function + * @param {Element|Array.} domNodes + */ + assignDrop: function (domNodes) { + if (typeof domNodes.length === 'undefined') { + domNodes = [domNodes]; + } + each(domNodes, function (domNode) { + domNode.addEventListener('dragover', this.preventEvent, false); + domNode.addEventListener('dragenter', this.preventEvent, false); + domNode.addEventListener('drop', this.onDrop, false); + }, this); + }, + + /** + * Un-assign drop event from DOM nodes + * @function + * @param domNodes + */ + unAssignDrop: function (domNodes) { + if (typeof domNodes.length === 'undefined') { + domNodes = [domNodes]; + } + each(domNodes, function (domNode) { + domNode.removeEventListener('dragover', this.preventEvent); + domNode.removeEventListener('dragenter', this.preventEvent); + domNode.removeEventListener('drop', this.onDrop); + }, this); + }, + + /** + * Returns a boolean indicating whether or not the instance is currently + * uploading anything. + * @function + * @returns {boolean} + */ + isUploading: function () { + var uploading = false; + each(this.files, function (file) { + if (file.isUploading()) { + uploading = true; + return false; + } + }); + return uploading; + }, + + /** + * should upload next chunk + * @function + * @returns {boolean|number} + */ + _shouldUploadNext: function () { + var num = 0; + var should = true; + var simultaneousUploads = this.opts.simultaneousUploads; + each(this.files, function (file) { + each(file.chunks, function(chunk) { + if (chunk.status() === 'uploading') { + num++; + if (num >= simultaneousUploads) { + should = false; + return false; + } + } + }); + }); + // if should is true then return uploading chunks's length + return should && num; + }, + + /** + * Start or resume uploading. + * @function + */ + upload: function () { + // Make sure we don't start too many uploads at once + var ret = this._shouldUploadNext(); + if (ret === false) { + return; + } + // Kick off the queue + this.fire('uploadStart'); + var started = false; + for (var num = 1; num <= this.opts.simultaneousUploads - ret; num++) { + started = this.uploadNextChunk(true) || started; + } + if (!started) { + async(function () { + this.fire('complete'); + }, this); + } + }, + + /** + * Resume uploading. + * @function + */ + resume: function () { + each(this.files, function (file) { + if (!file.isComplete()) { + file.resume(); + } + }); + }, + + /** + * Pause uploading. + * @function + */ + pause: function () { + each(this.files, function (file) { + file.pause(); + }); + }, + + /** + * Cancel upload of all FlowFile objects and remove them from the list. + * @function + */ + cancel: function () { + for (var i = this.files.length - 1; i >= 0; i--) { + this.files[i].cancel(); + } + }, + + /** + * Returns a number between 0 and 1 indicating the current upload progress + * of all files. + * @function + * @returns {number} + */ + progress: function () { + var totalDone = 0; + var totalSize = 0; + // Resume all chunks currently being uploaded + each(this.files, function (file) { + totalDone += file.progress() * file.size; + totalSize += file.size; + }); + return totalSize > 0 ? totalDone / totalSize : 0; + }, + + /** + * Add a HTML5 File object to the list of files. + * @function + * @param {File} file + * @param {Event} [event] event is optional + */ + addFile: function (file, event) { + this.addFiles([file], event); + }, + + /** + * Add a HTML5 File object to the list of files. + * @function + * @param {FileList|Array} fileList + * @param {Event} [event] event is optional + */ + addFiles: function (fileList, event) { + var files = []; + each(fileList, function (file) { + // https://github.com/flowjs/flow.js/issues/55 + if ((!ie10plus || ie10plus && file.size > 0) && !(file.size % 4096 === 0 && (file.name === '.' || file.fileName === '.'))) { + var uniqueIdentifier = this.generateUniqueIdentifier(file); + if (this.opts.allowDuplicateUploads || !this.getFromUniqueIdentifier(uniqueIdentifier)) { + var f = new FlowFile(this, file, uniqueIdentifier); + if (this.fire('fileAdded', f, event)) { + files.push(f); + } + } + } + }, this); + if (this.fire('filesAdded', files, event)) { + each(files, function (file) { + if (this.opts.singleFile && this.files.length > 0) { + this.removeFile(this.files[0]); + } + this.files.push(file); + }, this); + this.fire('filesSubmitted', files, event); + } + }, + + + /** + * Cancel upload of a specific FlowFile object from the list. + * @function + * @param {FlowFile} file + */ + removeFile: function (file) { + for (var i = this.files.length - 1; i >= 0; i--) { + if (this.files[i] === file) { + this.files.splice(i, 1); + file.abort(); + this.fire('fileRemoved', file); + } + } + }, + + /** + * Look up a FlowFile object by its unique identifier. + * @function + * @param {string} uniqueIdentifier + * @returns {boolean|FlowFile} false if file was not found + */ + getFromUniqueIdentifier: function (uniqueIdentifier) { + var ret = false; + each(this.files, function (file) { + if (file.uniqueIdentifier === uniqueIdentifier) { + ret = file; + } + }); + return ret; + }, + + /** + * Returns the total size of all files in bytes. + * @function + * @returns {number} + */ + getSize: function () { + var totalSize = 0; + each(this.files, function (file) { + totalSize += file.size; + }); + return totalSize; + }, + + /** + * Returns the total size uploaded of all files in bytes. + * @function + * @returns {number} + */ + sizeUploaded: function () { + var size = 0; + each(this.files, function (file) { + size += file.sizeUploaded(); + }); + return size; + }, + + /** + * Returns remaining time to upload all files in seconds. Accuracy is based on average speed. + * If speed is zero, time remaining will be equal to positive infinity `Number.POSITIVE_INFINITY` + * @function + * @returns {number} + */ + timeRemaining: function () { + var sizeDelta = 0; + var averageSpeed = 0; + each(this.files, function (file) { + if (!file.paused && !file.error) { + sizeDelta += file.size - file.sizeUploaded(); + averageSpeed += file.averageSpeed; + } + }); + if (sizeDelta && !averageSpeed) { + return Number.POSITIVE_INFINITY; + } + if (!sizeDelta && !averageSpeed) { + return 0; + } + return Math.floor(sizeDelta / averageSpeed); + } + }; + + + + + + + /** + * FlowFile class + * @name FlowFile + * @param {Flow} flowObj + * @param {File} file + * @param {string} uniqueIdentifier + * @constructor + */ + function FlowFile(flowObj, file, uniqueIdentifier) { + + /** + * Reference to parent Flow instance + * @type {Flow} + */ + this.flowObj = flowObj; + + /** + * Used to store the bytes read + * @type {Blob|string} + */ + this.bytes = null; + + /** + * Reference to file + * @type {File} + */ + this.file = file; + + /** + * File name. Some confusion in different versions of Firefox + * @type {string} + */ + this.name = file.fileName || file.name; + + /** + * File size + * @type {number} + */ + this.size = file.size; + + /** + * Relative file path + * @type {string} + */ + this.relativePath = file.relativePath || file.webkitRelativePath || this.name; + + /** + * File unique identifier + * @type {string} + */ + this.uniqueIdentifier = (uniqueIdentifier === undefined ? flowObj.generateUniqueIdentifier(file) : uniqueIdentifier); + + /** + * Size of Each Chunk + * @type {number} + */ + this.chunkSize = 0; + + /** + * List of chunks + * @type {Array.} + */ + this.chunks = []; + + /** + * Indicated if file is paused + * @type {boolean} + */ + this.paused = false; + + /** + * Indicated if file has encountered an error + * @type {boolean} + */ + this.error = false; + + /** + * Average upload speed + * @type {number} + */ + this.averageSpeed = 0; + + /** + * Current upload speed + * @type {number} + */ + this.currentSpeed = 0; + + /** + * Date then progress was called last time + * @type {number} + * @private + */ + this._lastProgressCallback = Date.now(); + + /** + * Previously uploaded file size + * @type {number} + * @private + */ + this._prevUploadedSize = 0; + + /** + * Holds previous progress + * @type {number} + * @private + */ + this._prevProgress = 0; + + this.bootstrap(); + } + + FlowFile.prototype = { + /** + * Update speed parameters + * @link http://stackoverflow.com/questions/2779600/how-to-estimate-download-time-remaining-accurately + * @function + */ + measureSpeed: function () { + var timeSpan = Date.now() - this._lastProgressCallback; + if (!timeSpan) { + return ; + } + var smoothingFactor = this.flowObj.opts.speedSmoothingFactor; + var uploaded = this.sizeUploaded(); + // Prevent negative upload speed after file upload resume + this.currentSpeed = Math.max((uploaded - this._prevUploadedSize) / timeSpan * 1000, 0); + this.averageSpeed = smoothingFactor * this.currentSpeed + (1 - smoothingFactor) * this.averageSpeed; + this._prevUploadedSize = uploaded; + }, + + /** + * For internal usage only. + * Callback when something happens within the chunk. + * @function + * @param {FlowChunk} chunk + * @param {string} event can be 'progress', 'success', 'error' or 'retry' + * @param {string} [message] + */ + chunkEvent: function (chunk, event, message) { + switch (event) { + case 'progress': + if (Date.now() - this._lastProgressCallback < + this.flowObj.opts.progressCallbacksInterval) { + break; + } + this.measureSpeed(); + this.flowObj.fire('fileProgress', this, chunk); + this.flowObj.fire('progress'); + this._lastProgressCallback = Date.now(); + break; + case 'error': + this.error = true; + this.abort(true); + this.flowObj.fire('fileError', this, message, chunk); + this.flowObj.fire('error', message, this, chunk); + break; + case 'success': + if (this.error) { + return; + } + this.measureSpeed(); + this.flowObj.fire('fileProgress', this, chunk); + this.flowObj.fire('progress'); + this._lastProgressCallback = Date.now(); + if (this.isComplete()) { + this.currentSpeed = 0; + this.averageSpeed = 0; + this.flowObj.fire('fileSuccess', this, message, chunk); + } + break; + case 'retry': + this.flowObj.fire('fileRetry', this, chunk); + break; + } + }, + + /** + * Pause file upload + * @function + */ + pause: function() { + this.paused = true; + this.abort(); + }, + + /** + * Resume file upload + * @function + */ + resume: function() { + this.paused = false; + this.flowObj.upload(); + }, + + /** + * Abort current upload + * @function + */ + abort: function (reset) { + this.currentSpeed = 0; + this.averageSpeed = 0; + var chunks = this.chunks; + if (reset) { + this.chunks = []; + } + each(chunks, function (c) { + if (c.status() === 'uploading') { + c.abort(); + this.flowObj.uploadNextChunk(); + } + }, this); + }, + + /** + * Cancel current upload and remove from a list + * @function + */ + cancel: function () { + this.flowObj.removeFile(this); + }, + + /** + * Retry aborted file upload + * @function + */ + retry: function () { + this.bootstrap(); + this.flowObj.upload(); + }, + + /** + * Clear current chunks and slice file again + * @function + */ + bootstrap: function () { + if (typeof this.flowObj.opts.initFileFn === "function") { + this.flowObj.opts.initFileFn(this); + } + + this.abort(true); + this.error = false; + // Rebuild stack of chunks from file + this._prevProgress = 0; + var round = this.flowObj.opts.forceChunkSize ? Math.ceil : Math.floor; + this.chunkSize = evalOpts(this.flowObj.opts.chunkSize, this); + var chunks = Math.max( + round(this.size / this.chunkSize), 1 + ); + for (var offset = 0; offset < chunks; offset++) { + this.chunks.push( + new FlowChunk(this.flowObj, this, offset) + ); + } + }, + + /** + * Get current upload progress status + * @function + * @returns {number} from 0 to 1 + */ + progress: function () { + if (this.error) { + return 1; + } + if (this.chunks.length === 1) { + this._prevProgress = Math.max(this._prevProgress, this.chunks[0].progress()); + return this._prevProgress; + } + // Sum up progress across everything + var bytesLoaded = 0; + each(this.chunks, function (c) { + // get chunk progress relative to entire file + bytesLoaded += c.progress() * (c.endByte - c.startByte); + }); + var percent = bytesLoaded / this.size; + // We don't want to lose percentages when an upload is paused + this._prevProgress = Math.max(this._prevProgress, percent > 0.9999 ? 1 : percent); + return this._prevProgress; + }, + + /** + * Indicates if file is being uploaded at the moment + * @function + * @returns {boolean} + */ + isUploading: function () { + var uploading = false; + each(this.chunks, function (chunk) { + if (chunk.status() === 'uploading') { + uploading = true; + return false; + } + }); + return uploading; + }, + + /** + * Indicates if file is has finished uploading and received a response + * @function + * @returns {boolean} + */ + isComplete: function () { + var outstanding = false; + each(this.chunks, function (chunk) { + var status = chunk.status(); + if (status === 'pending' || status === 'uploading' || status === 'reading' || chunk.preprocessState === 1 || chunk.readState === 1) { + outstanding = true; + return false; + } + }); + return !outstanding; + }, + + /** + * Count total size uploaded + * @function + * @returns {number} + */ + sizeUploaded: function () { + var size = 0; + each(this.chunks, function (chunk) { + size += chunk.sizeUploaded(); + }); + return size; + }, + + /** + * Returns remaining time to finish upload file in seconds. Accuracy is based on average speed. + * If speed is zero, time remaining will be equal to positive infinity `Number.POSITIVE_INFINITY` + * @function + * @returns {number} + */ + timeRemaining: function () { + if (this.paused || this.error) { + return 0; + } + var delta = this.size - this.sizeUploaded(); + if (delta && !this.averageSpeed) { + return Number.POSITIVE_INFINITY; + } + if (!delta && !this.averageSpeed) { + return 0; + } + return Math.floor(delta / this.averageSpeed); + }, + + /** + * Get file type + * @function + * @returns {string} + */ + getType: function () { + return this.file.type && this.file.type.split('/')[1]; + }, + + /** + * Get file extension + * @function + * @returns {string} + */ + getExtension: function () { + return this.name.substr((~-this.name.lastIndexOf(".") >>> 0) + 2).toLowerCase(); + } + }; + + /** + * Default read function using the webAPI + * + * @function webAPIFileRead(fileObj, startByte, endByte, fileType, chunk) + * + */ + function webAPIFileRead(fileObj, startByte, endByte, fileType, chunk) { + var function_name = 'slice'; + + if (fileObj.file.slice) + function_name = 'slice'; + else if (fileObj.file.mozSlice) + function_name = 'mozSlice'; + else if (fileObj.file.webkitSlice) + function_name = 'webkitSlice'; + + chunk.readFinished(fileObj.file[function_name](startByte, endByte, fileType)); + } + + + /** + * Class for storing a single chunk + * @name FlowChunk + * @param {Flow} flowObj + * @param {FlowFile} fileObj + * @param {number} offset + * @constructor + */ + function FlowChunk(flowObj, fileObj, offset) { + + /** + * Reference to parent flow object + * @type {Flow} + */ + this.flowObj = flowObj; + + /** + * Reference to parent FlowFile object + * @type {FlowFile} + */ + this.fileObj = fileObj; + + /** + * File offset + * @type {number} + */ + this.offset = offset; + + /** + * Indicates if chunk existence was checked on the server + * @type {boolean} + */ + this.tested = false; + + /** + * Number of retries performed + * @type {number} + */ + this.retries = 0; + + /** + * Pending retry + * @type {boolean} + */ + this.pendingRetry = false; + + /** + * Preprocess state + * @type {number} 0 = unprocessed, 1 = processing, 2 = finished + */ + this.preprocessState = 0; + + /** + * Read state + * @type {number} 0 = not read, 1 = reading, 2 = finished + */ + this.readState = 0; + + + /** + * Bytes transferred from total request size + * @type {number} + */ + this.loaded = 0; + + /** + * Total request size + * @type {number} + */ + this.total = 0; + + /** + * Size of a chunk + * @type {number} + */ + this.chunkSize = this.fileObj.chunkSize; + + /** + * Chunk start byte in a file + * @type {number} + */ + this.startByte = this.offset * this.chunkSize; + + /** + * A specific filename for this chunk which otherwise default to the main name + * @type {string} + */ + this.filename = null; + + /** + * Compute the endbyte in a file + * + */ + this.computeEndByte = function() { + var endByte = Math.min(this.fileObj.size, (this.offset + 1) * this.chunkSize); + if (this.fileObj.size - endByte < this.chunkSize && !this.flowObj.opts.forceChunkSize) { + // The last chunk will be bigger than the chunk size, + // but less than 2 * this.chunkSize + endByte = this.fileObj.size; + } + return endByte; + } + + /** + * Chunk end byte in a file + * @type {number} + */ + this.endByte = this.computeEndByte(); + + /** + * XMLHttpRequest + * @type {XMLHttpRequest} + */ + this.xhr = null; + + var $ = this; + + /** + * Send chunk event + * @param event + * @param {...} args arguments of a callback + */ + this.event = function (event, args) { + args = Array.prototype.slice.call(arguments); + args.unshift($); + $.fileObj.chunkEvent.apply($.fileObj, args); + }; + /** + * Catch progress event + * @param {ProgressEvent} event + */ + this.progressHandler = function(event) { + if (event.lengthComputable) { + $.loaded = event.loaded ; + $.total = event.total; + } + $.event('progress', event); + }; + + /** + * Catch test event + * @param {Event} event + */ + this.testHandler = function(event) { + var status = $.status(true); + if (status === 'error') { + $.event(status, $.message()); + $.flowObj.uploadNextChunk(); + } else if (status === 'success') { + $.tested = true; + $.event(status, $.message()); + $.flowObj.uploadNextChunk(); + } else if (!$.fileObj.paused) { + // Error might be caused by file pause method + // Chunks does not exist on the server side + $.tested = true; + $.send(); + } + }; + + /** + * Upload has stopped + * @param {Event} event + */ + this.doneHandler = function(event) { + var status = $.status(); + if (status === 'success' || status === 'error') { + delete this.data; + $.event(status, $.message()); + $.flowObj.uploadNextChunk(); + } else if (!$.fileObj.paused) { + $.event('retry', $.message()); + $.pendingRetry = true; + $.abort(); + $.retries++; + var retryInterval = $.flowObj.opts.chunkRetryInterval; + if (retryInterval !== null) { + setTimeout(function () { + $.send(); + }, retryInterval); + } else { + $.send(); + } + } + }; + } + + FlowChunk.prototype = { + /** + * Get params for a request + * @function + */ + getParams: function () { + return { + flowChunkNumber: this.offset + 1, + flowChunkSize: this.chunkSize, + flowCurrentChunkSize: this.endByte - this.startByte, + flowTotalSize: this.fileObj.size, + flowIdentifier: this.fileObj.uniqueIdentifier, + flowFilename: this.fileObj.name, + flowRelativePath: this.fileObj.relativePath, + flowTotalChunks: this.fileObj.chunks.length + }; + }, + + /** + * Get target option with query params + * @function + * @param params + * @returns {string} + */ + getTarget: function(target, params){ + if (params.length == 0) { + return target; + } + + if(target.indexOf('?') < 0) { + target += '?'; + } else { + target += '&'; + } + return target + params.join('&'); + }, + + /** + * Makes a GET request without any data to see if the chunk has already + * been uploaded in a previous session + * @function + */ + test: function () { + // Set up request and listen for event + this.xhr = new XMLHttpRequest(); + this.xhr.addEventListener("load", this.testHandler, false); + this.xhr.addEventListener("error", this.testHandler, false); + var testMethod = evalOpts(this.flowObj.opts.testMethod, this.fileObj, this); + var data = this.prepareXhrRequest(testMethod, true); + this.xhr.send(data); + }, + + /** + * Finish preprocess state + * @function + */ + preprocessFinished: function () { + // Re-compute the endByte after the preprocess function to allow an + // implementer of preprocess to set the fileObj size + this.endByte = this.computeEndByte(); + + this.preprocessState = 2; + this.send(); + }, + + /** + * Finish read state + * @function + */ + readFinished: function (bytes) { + this.readState = 2; + this.bytes = bytes; + this.send(); + }, + + + /** + * Uploads the actual data in a POST call + * @function + */ + send: function () { + var preprocess = this.flowObj.opts.preprocess; + var read = this.flowObj.opts.readFileFn; + if (typeof preprocess === 'function') { + switch (this.preprocessState) { + case 0: + this.preprocessState = 1; + preprocess(this); + return; + case 1: + return; + } + } + switch (this.readState) { + case 0: + this.readState = 1; + read(this.fileObj, this.startByte, this.endByte, this.fileObj.file.type, this); + return; + case 1: + return; + } + if (this.flowObj.opts.testChunks && !this.tested) { + this.test(); + return; + } + + this.loaded = 0; + this.total = 0; + this.pendingRetry = false; + + // Set up request and listen for event + this.xhr = new XMLHttpRequest(); + this.xhr.upload.addEventListener('progress', this.progressHandler, false); + this.xhr.addEventListener("load", this.doneHandler, false); + this.xhr.addEventListener("error", this.doneHandler, false); + + var uploadMethod = evalOpts(this.flowObj.opts.uploadMethod, this.fileObj, this); + var data = this.prepareXhrRequest(uploadMethod, false, this.flowObj.opts.method, this.bytes); + var changeRawDataBeforeSend = this.flowObj.opts.changeRawDataBeforeSend; + if (typeof changeRawDataBeforeSend === 'function') { + data = changeRawDataBeforeSend(this, data); + } + this.xhr.send(data); + }, + + /** + * Abort current xhr request + * @function + */ + abort: function () { + // Abort and reset + var xhr = this.xhr; + this.xhr = null; + if (xhr) { + xhr.abort(); + } + }, + + /** + * Retrieve current chunk upload status + * @function + * @returns {string} 'pending', 'uploading', 'success', 'error' + */ + status: function (isTest) { + if (this.readState === 1) { + return 'reading'; + } else if (this.pendingRetry || this.preprocessState === 1) { + // if pending retry then that's effectively the same as actively uploading, + // there might just be a slight delay before the retry starts + return 'uploading'; + } else if (!this.xhr) { + return 'pending'; + } else if (this.xhr.readyState < 4) { + // Status is really 'OPENED', 'HEADERS_RECEIVED' + // or 'LOADING' - meaning that stuff is happening + return 'uploading'; + } else { + if (this.flowObj.opts.successStatuses.indexOf(this.xhr.status) > -1) { + // HTTP 200, perfect + // HTTP 202 Accepted - The request has been accepted for processing, but the processing has not been completed. + return 'success'; + } else if (this.flowObj.opts.permanentErrors.indexOf(this.xhr.status) > -1 || + !isTest && this.retries >= this.flowObj.opts.maxChunkRetries) { + // HTTP 413/415/500/501, permanent error + return 'error'; + } else { + // this should never happen, but we'll reset and queue a retry + // a likely case for this would be 503 service unavailable + this.abort(); + return 'pending'; + } + } + }, + + /** + * Get response from xhr request + * @function + * @returns {String} + */ + message: function () { + return this.xhr ? this.xhr.responseText : ''; + }, + + /** + * Get upload progress + * @function + * @returns {number} + */ + progress: function () { + if (this.pendingRetry) { + return 0; + } + var s = this.status(); + if (s === 'success' || s === 'error') { + return 1; + } else if (s === 'pending') { + return 0; + } else { + return this.total > 0 ? this.loaded / this.total : 0; + } + }, + + /** + * Count total size uploaded + * @function + * @returns {number} + */ + sizeUploaded: function () { + var size = this.endByte - this.startByte; + // can't return only chunk.loaded value, because it is bigger than chunk size + if (this.status() !== 'success') { + size = this.progress() * size; + } + return size; + }, + + /** + * Prepare Xhr request. Set query, headers and data + * @param {string} method GET or POST + * @param {bool} isTest is this a test request + * @param {string} [paramsMethod] octet or form + * @param {Blob} [blob] to send + * @returns {FormData|Blob|Null} data to send + */ + prepareXhrRequest: function(method, isTest, paramsMethod, blob) { + // Add data from the query options + var query = evalOpts(this.flowObj.opts.query, this.fileObj, this, isTest); + query = extend(query || {}, this.getParams()); + + var target = evalOpts(this.flowObj.opts.target, this.fileObj, this, isTest); + var data = null; + if (method === 'GET' || paramsMethod === 'octet') { + // Add data from the query options + var params = []; + each(query, function (v, k) { + params.push([encodeURIComponent(k), encodeURIComponent(v)].join('=')); + }); + target = this.getTarget(target, params); + data = blob || null; + } else { + // Add data from the query options + data = new FormData(); + each(query, function (v, k) { + data.append(k, v); + }); + if (typeof blob !== "undefined") { + data.append(this.flowObj.opts.fileParameterName, blob, this.filename || this.fileObj.file.name); + } + } + + this.xhr.open(method, target, true); + this.xhr.withCredentials = this.flowObj.opts.withCredentials; + + // Add data from header options + each(evalOpts(this.flowObj.opts.headers, this.fileObj, this, isTest), function (v, k) { + this.xhr.setRequestHeader(k, v); + }, this); + + return data; + } + }; + + /** + * Remove value from array + * @param array + * @param value + */ + function arrayRemove(array, value) { + var index = array.indexOf(value); + if (index > -1) { + array.splice(index, 1); + } + } + + /** + * If option is a function, evaluate it with given params + * @param {*} data + * @param {...} args arguments of a callback + * @returns {*} + */ + function evalOpts(data, args) { + if (typeof data === "function") { + // `arguments` is an object, not array, in FF, so: + args = Array.prototype.slice.call(arguments); + data = data.apply(null, args.slice(1)); + } + return data; + } + Flow.evalOpts = evalOpts; + + /** + * Execute function asynchronously + * @param fn + * @param context + */ + function async(fn, context) { + setTimeout(fn.bind(context), 0); + } + + /** + * Extends the destination object `dst` by copying all of the properties from + * the `src` object(s) to `dst`. You can specify multiple `src` objects. + * @function + * @param {Object} dst Destination object. + * @param {...Object} src Source object(s). + * @returns {Object} Reference to `dst`. + */ + function extend(dst, src) { + each(arguments, function(obj) { + if (obj !== dst) { + each(obj, function(value, key){ + dst[key] = value; + }); + } + }); + return dst; + } + Flow.extend = extend; + + /** + * Iterate each element of an object + * @function + * @param {Array|Object} obj object or an array to iterate + * @param {Function} callback first argument is a value and second is a key. + * @param {Object=} context Object to become context (`this`) for the iterator function. + */ + function each(obj, callback, context) { + if (!obj) { + return ; + } + var key; + // Is Array? + // Array.isArray won't work, not only arrays can be iterated by index https://github.com/flowjs/ng-flow/issues/236# + if (typeof(obj.length) !== 'undefined') { + for (key = 0; key < obj.length; key++) { + if (callback.call(context, obj[key], key) === false) { + return ; + } + } + } else { + for (key in obj) { + if (obj.hasOwnProperty(key) && callback.call(context, obj[key], key) === false) { + return ; + } + } + } + } + Flow.each = each; + + /** + * FlowFile constructor + * @type {FlowFile} + */ + Flow.FlowFile = FlowFile; + + /** + * FlowFile constructor + * @type {FlowChunk} + */ + Flow.FlowChunk = FlowChunk; + + /** + * Library version + * @type {string} + */ + Flow.version = '<%= version %>'; + + if ( true && module && typeof module.exports === "object" ) { + // Expose Flow as module.exports in loaders that implement the Node + // module pattern (including browserify). Do not create the global, since + // the user will be storing it themselves locally, and globals are frowned + // upon in the Node module world. + module.exports = Flow; + } else { + // Otherwise expose Flow to the global object as usual + window.Flow = Flow; + + // Register as a named AMD module, since Flow can be concatenated with other + // files that may use define, but not via a proper concatenation script that + // understands anonymous AMD modules. A named AMD is safest and most robust + // way to register. Lowercase flow is used because AMD module names are + // derived from file names, and Flow is normally delivered in a lowercase + // file name. Do this after creating the global so that if an AMD module wants + // to call noConflict to hide this version of Flow, it will work. + if ( true ) { + !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function () { return Flow; }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), + __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); + } + } +})(typeof window !== 'undefined' && window, typeof document !== 'undefined' && document); + + +/***/ }), + +/***/ "./node_modules/@flowjs/ng-flow/dist/ng-flow.js": +/*!******************************************************!*\ + !*** ./node_modules/@flowjs/ng-flow/dist/ng-flow.js ***! + \******************************************************/ +/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { + +/* provided dependency */ var Flow = __webpack_require__(/*! @flowjs/flow.js */ "./node_modules/@flowjs/flow.js/src/flow.js"); +/** + * @description + * var app = angular.module('App', ['flow.provider'], function(flowFactoryProvider){ + * flowFactoryProvider.defaults = {target: '/'}; + * }); + * @name flowFactoryProvider + */ +angular.module('flow.provider', []) +.provider('flowFactory', function() { + 'use strict'; + /** + * Define the default properties for flow.js + * @name flowFactoryProvider.defaults + * @type {Object} + */ + this.defaults = {}; + + /** + * Flow, MaybeFlow or NotFlow + * @name flowFactoryProvider.factory + * @type {function} + * @return {Flow} + */ + this.factory = function (options) { + return new Flow(options); + }; + + /** + * Define the default events + * @name flowFactoryProvider.events + * @type {Array} + * @private + */ + this.events = []; + + /** + * Add default events + * @name flowFactoryProvider.on + * @function + * @param {string} event + * @param {Function} callback + */ + this.on = function (event, callback) { + this.events.push([event, callback]); + }; + + this.$get = function() { + var fn = this.factory; + var defaults = this.defaults; + var events = this.events; + return { + 'create': function(opts) { + // combine default options with global options and options + var flow = fn(angular.extend({}, defaults, opts)); + angular.forEach(events, function (event) { + flow.on(event[0], event[1]); + }); + return flow; + } + }; + }; +}); +angular.module('flow.init', ['flow.provider']) + .controller('flowCtrl', ['$scope', '$attrs', '$parse', 'flowFactory', + function ($scope, $attrs, $parse, flowFactory) { + + var options = angular.extend({}, $scope.$eval($attrs.flowInit)); + + // use existing flow object or create a new one + var flow = $scope.$eval($attrs.flowObject) || flowFactory.create(options); + + var catchAllHandler = function(eventName){ + var args = Array.prototype.slice.call(arguments); + args.shift(); + var event = $scope.$broadcast.apply($scope, ['flow::' + eventName, flow].concat(args)); + if ({ + 'progress':1, 'filesSubmitted':1, 'fileSuccess': 1, 'fileError': 1, 'complete': 1 + }[eventName]) { + $scope.$applyAsync(); + } + if (event.defaultPrevented) { + return false; + } + }; + + flow.on('catchAll', catchAllHandler); + $scope.$on('$destroy', function(){ + flow.off('catchAll', catchAllHandler); + }); + + $scope.$flow = flow; + + if ($attrs.hasOwnProperty('flowName')) { + $parse($attrs.flowName).assign($scope, flow); + $scope.$on('$destroy', function () { + $parse($attrs.flowName).assign($scope); + }); + } + }]) + .directive('flowInit', [function() { + return { + scope: true, + controller: 'flowCtrl' + }; + }]); +angular.module('flow.btn', ['flow.init']) +.directive('flowBtn', [function() { + return { + 'restrict': 'EA', + 'scope': false, + 'require': '^flowInit', + 'link': function(scope, element, attrs) { + var isDirectory = attrs.hasOwnProperty('flowDirectory'); + var isSingleFile = attrs.hasOwnProperty('flowSingleFile'); + var inputAttrs = attrs.hasOwnProperty('flowAttrs') && scope.$eval(attrs.flowAttrs); + scope.$flow.assignBrowse(element, isDirectory, isSingleFile, inputAttrs); + } + }; +}]); +angular.module('flow.dragEvents', ['flow.init']) +/** + * @name flowPreventDrop + * Prevent loading files then dropped on element + */ + .directive('flowPreventDrop', function() { + return { + 'scope': false, + 'link': function(scope, element, attrs) { + element.bind('drop dragover', function (event) { + event.preventDefault(); + }); + } + }; + }) +/** + * @name flowDragEnter + * executes `flowDragEnter` and `flowDragLeave` events + */ + .directive('flowDragEnter', ['$timeout', function($timeout) { + return { + 'scope': false, + 'link': function(scope, element, attrs) { + var promise; + var enter = false; + element.bind('dragover', function (event) { + if (!isFileDrag(event)) { + return ; + } + if (!enter) { + scope.$apply(attrs.flowDragEnter); + enter = true; + } + $timeout.cancel(promise); + event.preventDefault(); + }); + element.bind('dragleave drop', function (event) { + $timeout.cancel(promise); + promise = $timeout(function () { + scope.$eval(attrs.flowDragLeave); + promise = null; + enter = false; + }, 100); + }); + function isFileDrag(dragEvent) { + var fileDrag = false; + var dataTransfer = dragEvent.dataTransfer || dragEvent.originalEvent.dataTransfer; + angular.forEach(dataTransfer && dataTransfer.types, function(val) { + if (val === 'Files') { + fileDrag = true; + } + }); + return fileDrag; + } + } + }; + }]); + +angular.module('flow.drop', ['flow.init']) +.directive('flowDrop', function() { + return { + 'scope': false, + 'require': '^flowInit', + 'link': function(scope, element, attrs) { + if (attrs.flowDropEnabled) { + scope.$watch(attrs.flowDropEnabled, function (value) { + if (value) { + assignDrop(); + } else { + unAssignDrop(); + } + }); + } else { + assignDrop(); + } + function assignDrop() { + scope.$flow.assignDrop(element); + } + function unAssignDrop() { + scope.$flow.unAssignDrop(element); + } + } + }; +}); + +!function (angular) {'use strict'; + var module = angular.module('flow.events', ['flow.init']); + var events = { + fileSuccess: ['$file', '$message'], + fileProgress: ['$file'], + fileAdded: ['$file', '$event'], + filesAdded: ['$files', '$event'], + filesSubmitted: ['$files', '$event'], + fileRetry: ['$file'], + fileRemoved: ['$file'], + fileError: ['$file', '$message'], + uploadStart: [], + complete: [], + progress: [], + error: ['$message', '$file'] + }; + + angular.forEach(events, function (eventArgs, eventName) { + var name = 'flow' + capitaliseFirstLetter(eventName); + if (name == 'flowUploadStart') { + name = 'flowUploadStarted';// event alias + } + module.directive(name, [function() { + return { + require: '^flowInit', + controller: ['$scope', '$attrs', function ($scope, $attrs) { + $scope.$on('flow::' + eventName, function () { + var funcArgs = Array.prototype.slice.call(arguments); + var event = funcArgs.shift();// remove angular event + // remove flow object and ignore event if it is from parent directive + if ($scope.$flow !== funcArgs.shift()) { + return ; + } + var args = {}; + angular.forEach(eventArgs, function(value, key) { + args[value] = funcArgs[key]; + }); + if ($scope.$eval($attrs[name], args) === false) { + event.preventDefault(); + } + }); + }] + }; + }]); + }); + + function capitaliseFirstLetter(string) { + return string.charAt(0).toUpperCase() + string.slice(1); + } +}(angular); + +angular.module('flow.img', ['flow.init']) +.directive('flowImg', [function() { + return { + 'scope': false, + 'require': '^flowInit', + 'link': function(scope, element, attrs) { + var file = attrs.flowImg; + scope.$watch(file, function (file) { + if (!file) { + return ; + } + var fileReader = new FileReader(); + fileReader.readAsDataURL(file.file); + fileReader.onload = function (event) { + scope.$apply(function () { + attrs.$set('src', event.target.result); + }); + }; + }); + } + }; +}]); +angular.module('flow.transfers', ['flow.init']) +.directive('flowTransfers', [function() { + return { + 'scope': true, + 'require': '^flowInit', + 'link': function(scope) { + scope.transfers = scope.$flow.files; + } + }; +}]); +angular.module('flow', ['flow.provider', 'flow.init', 'flow.events', 'flow.btn', + 'flow.drop', 'flow.transfers', 'flow.img', 'flow.dragEvents']); + +/***/ }), + +/***/ "./node_modules/@uirouter/angularjs/lib-esm/angular.js": +/*!*************************************************************!*\ + !*** ./node_modules/@uirouter/angularjs/lib-esm/angular.js ***! + \*************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "ng": () => (/* binding */ ng) +/* harmony export */ }); +/* harmony import */ var angular__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! angular */ "./node_modules/angular/index-exposed.js"); +/* harmony import */ var angular__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(angular__WEBPACK_IMPORTED_MODULE_0__); +/** @publicapi @module ng1 */ /** */ + +/** @hidden */ var ng_from_global = angular; +/** @hidden */ var ng = angular__WEBPACK_IMPORTED_MODULE_0__ && angular__WEBPACK_IMPORTED_MODULE_0__.module ? angular__WEBPACK_IMPORTED_MODULE_0__ : ng_from_global; +//# sourceMappingURL=angular.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/angularjs/lib-esm/directives/stateDirectives.js": +/*!********************************************************************************!*\ + !*** ./node_modules/@uirouter/angularjs/lib-esm/directives/stateDirectives.js ***! + \********************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony import */ var _angular__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../angular */ "./node_modules/@uirouter/angularjs/lib-esm/angular.js"); +/* harmony import */ var _uirouter_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @uirouter/core */ "./node_modules/@uirouter/core/lib-esm/index.js"); +/* eslint-disable @typescript-eslint/no-empty-interface */ +/* eslint-disable prefer-const */ +/** + * # Angular 1 Directives + * + * These are the directives included in UI-Router for Angular 1. + * These directives are used in templates to create viewports and link/navigate to states. + * + * @preferred @publicapi @module directives + */ /** */ + + +/** @hidden */ +function parseStateRef(ref) { + var paramsOnly = ref.match(/^\s*({[^}]*})\s*$/); + if (paramsOnly) + ref = '(' + paramsOnly[1] + ')'; + var parsed = ref.replace(/\n/g, ' ').match(/^\s*([^(]*?)\s*(\((.*)\))?\s*$/); + if (!parsed || parsed.length !== 4) + throw new Error("Invalid state ref '" + ref + "'"); + return { state: parsed[1] || null, paramExpr: parsed[3] || null }; +} +/** @hidden */ +function stateContext(el) { + var $uiView = el.parent().inheritedData('$uiView'); + var path = (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.parse)('$cfg.path')($uiView); + return path ? (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.tail)(path).state.name : undefined; +} +/** @hidden */ +function processedDef($state, $element, def) { + var uiState = def.uiState || $state.current.name; + var uiStateOpts = (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.extend)(defaultOpts($element, $state), def.uiStateOpts || {}); + var href = $state.href(uiState, def.uiStateParams, uiStateOpts); + return { uiState: uiState, uiStateParams: def.uiStateParams, uiStateOpts: uiStateOpts, href: href }; +} +/** @hidden */ +function getTypeInfo(el) { + // SVGAElement does not use the href attribute, but rather the 'xlinkHref' attribute. + var isSvg = Object.prototype.toString.call(el.prop('href')) === '[object SVGAnimatedString]'; + var isForm = el[0].nodeName === 'FORM'; + return { + attr: isForm ? 'action' : isSvg ? 'xlink:href' : 'href', + isAnchor: el.prop('tagName').toUpperCase() === 'A', + clickable: !isForm, + }; +} +/** @hidden */ +function clickHook(el, $state, $timeout, type, getDef) { + return function (e) { + var button = e.which || e.button, target = getDef(); + if (!(button > 1 || e.ctrlKey || e.metaKey || e.shiftKey || e.altKey || el.attr('target'))) { + // HACK: This is to allow ng-clicks to be processed before the transition is initiated: + var transition_1 = $timeout(function () { + if (!el.attr('disabled')) { + $state.go(target.uiState, target.uiStateParams, target.uiStateOpts); + } + }); + e.preventDefault(); + // if the state has no URL, ignore one preventDefault from the directive. + var ignorePreventDefaultCount_1 = type.isAnchor && !target.href ? 1 : 0; + e.preventDefault = function () { + if (ignorePreventDefaultCount_1-- <= 0) + $timeout.cancel(transition_1); + }; + } + }; +} +/** @hidden */ +function defaultOpts(el, $state) { + return { + relative: stateContext(el) || $state.$current, + inherit: true, + source: 'sref', + }; +} +/** @hidden */ +function bindEvents(element, scope, hookFn, uiStateOpts) { + var events; + if (uiStateOpts) { + events = uiStateOpts.events; + } + if (!(0,_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.isArray)(events)) { + events = ['click']; + } + var on = element.on ? 'on' : 'bind'; + for (var _i = 0, events_1 = events; _i < events_1.length; _i++) { + var event_1 = events_1[_i]; + element[on](event_1, hookFn); + } + scope.$on('$destroy', function () { + var off = element.off ? 'off' : 'unbind'; + for (var _i = 0, events_2 = events; _i < events_2.length; _i++) { + var event_2 = events_2[_i]; + element[off](event_2, hookFn); + } + }); +} +/** + * `ui-sref`: A directive for linking to a state + * + * A directive which links to a state (and optionally, parameters). + * When clicked, this directive activates the linked state with the supplied parameter values. + * + * ### Linked State + * The attribute value of the `ui-sref` is the name of the state to link to. + * + * #### Example: + * This will activate the `home` state when the link is clicked. + * ```html + * Home + * ``` + * + * ### Relative Links + * You can also use relative state paths within `ui-sref`, just like a relative path passed to `$state.go()` ([[StateService.go]]). + * You just need to be aware that the path is relative to the state that *created* the link. + * This allows a state to create a relative `ui-sref` which always targets the same destination. + * + * #### Example: + * Both these links are relative to the parent state, even when a child state is currently active. + * ```html + * child 1 state + * child 2 state + * ``` + * + * This link activates the parent state. + * ```html + * Return + * ``` + * + * ### hrefs + * If the linked state has a URL, the directive will automatically generate and + * update the `href` attribute (using the [[StateService.href]] method). + * + * #### Example: + * Assuming the `users` state has a url of `/users/` + * ```html + * Users + * ``` + * + * ### Parameter Values + * In addition to the state name, a `ui-sref` can include parameter values which are applied when activating the state. + * Param values can be provided in the `ui-sref` value after the state name, enclosed by parentheses. + * The content inside the parentheses is an expression, evaluated to the parameter values. + * + * #### Example: + * This example renders a list of links to users. + * The state's `userId` parameter value comes from each user's `user.id` property. + * ```html + *
  • + * {{ user.displayName }} + *
  • + * ``` + * + * Note: + * The parameter values expression is `$watch`ed for updates. + * + * ### Transition Options + * You can specify [[TransitionOptions]] to pass to [[StateService.go]] by using the `ui-sref-opts` attribute. + * Options are restricted to `location`, `inherit`, and `reload`. + * + * #### Example: + * ```html + * Home + * ``` + * + * ### Other DOM Events + * + * You can also customize which DOM events to respond to (instead of `click`) by + * providing an `events` array in the `ui-sref-opts` attribute. + * + * #### Example: + * ```html + * + * ``` + * + * ### Highlighting the active link + * This directive can be used in conjunction with [[uiSrefActive]] to highlight the active link. + * + * ### Examples + * If you have the following template: + * + * ```html + * Home + * About + * Next page + * + * + * ``` + * + * Then (assuming the current state is `contacts`) the rendered html including hrefs would be: + * + * ```html + * Home + * About + * Next page + * + *
      + *
    • + * Joe + *
    • + *
    • + * Alice + *
    • + *
    • + * Bob + *
    • + *
    + * + * Home + * ``` + * + * ### Notes + * + * - You can use `ui-sref` to change **only the parameter values** by omitting the state name and parentheses. + * #### Example: + * Sets the `lang` parameter to `en` and remains on the same state. + * + * ```html + * English + * ``` + * + * - A middle-click, right-click, or ctrl-click is handled (natively) by the browser to open the href in a new window, for example. + * + * - Unlike the parameter values expression, the state name is not `$watch`ed (for performance reasons). + * If you need to dynamically update the state being linked to, use the fully dynamic [[uiState]] directive. + */ +var uiSrefDirective; +uiSrefDirective = [ + '$uiRouter', + '$timeout', + function $StateRefDirective($uiRouter, $timeout) { + var $state = $uiRouter.stateService; + return { + restrict: 'A', + require: ['?^uiSrefActive', '?^uiSrefActiveEq'], + link: function (scope, element, attrs, uiSrefActive) { + var type = getTypeInfo(element); + var active = uiSrefActive[1] || uiSrefActive[0]; + var unlinkInfoFn = null; + var rawDef = {}; + var getDef = function () { return processedDef($state, element, rawDef); }; + var ref = parseStateRef(attrs.uiSref); + rawDef.uiState = ref.state; + rawDef.uiStateOpts = attrs.uiSrefOpts ? scope.$eval(attrs.uiSrefOpts) : {}; + function update() { + var def = getDef(); + if (unlinkInfoFn) + unlinkInfoFn(); + if (active) + unlinkInfoFn = active.$$addStateInfo(def.uiState, def.uiStateParams); + if (def.href != null) + attrs.$set(type.attr, def.href); + } + if (ref.paramExpr) { + scope.$watch(ref.paramExpr, function (val) { + rawDef.uiStateParams = (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.extend)({}, val); + update(); + }, true); + rawDef.uiStateParams = (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.extend)({}, scope.$eval(ref.paramExpr)); + } + update(); + scope.$on('$destroy', $uiRouter.stateRegistry.onStatesChanged(update)); + scope.$on('$destroy', $uiRouter.transitionService.onSuccess({}, update)); + if (!type.clickable) + return; + var hookFn = clickHook(element, $state, $timeout, type, getDef); + bindEvents(element, scope, hookFn, rawDef.uiStateOpts); + }, + }; + }, +]; +/** + * `ui-state`: A fully dynamic directive for linking to a state + * + * A directive which links to a state (and optionally, parameters). + * When clicked, this directive activates the linked state with the supplied parameter values. + * + * **This directive is very similar to [[uiSref]], but it `$observe`s and `$watch`es/evaluates all its inputs.** + * + * A directive which links to a state (and optionally, parameters). + * When clicked, this directive activates the linked state with the supplied parameter values. + * + * ### Linked State + * The attribute value of `ui-state` is an expression which is `$watch`ed and evaluated as the state to link to. + * **This is in contrast with `ui-sref`, which takes a state name as a string literal.** + * + * #### Example: + * Create a list of links. + * ```html + *
  • + * {{ link.displayName }} + *
  • + * ``` + * + * ### Relative Links + * If the expression evaluates to a relative path, it is processed like [[uiSref]]. + * You just need to be aware that the path is relative to the state that *created* the link. + * This allows a state to create relative `ui-state` which always targets the same destination. + * + * ### hrefs + * If the linked state has a URL, the directive will automatically generate and + * update the `href` attribute (using the [[StateService.href]] method). + * + * ### Parameter Values + * In addition to the state name expression, a `ui-state` can include parameter values which are applied when activating the state. + * Param values should be provided using the `ui-state-params` attribute. + * The `ui-state-params` attribute value is `$watch`ed and evaluated as an expression. + * + * #### Example: + * This example renders a list of links with param values. + * The state's `userId` parameter value comes from each user's `user.id` property. + * ```html + *
  • + * {{ link.displayName }} + *
  • + * ``` + * + * ### Transition Options + * You can specify [[TransitionOptions]] to pass to [[StateService.go]] by using the `ui-state-opts` attribute. + * Options are restricted to `location`, `inherit`, and `reload`. + * The value of the `ui-state-opts` is `$watch`ed and evaluated as an expression. + * + * #### Example: + * ```html + * Home + * ``` + * + * ### Other DOM Events + * + * You can also customize which DOM events to respond to (instead of `click`) by + * providing an `events` array in the `ui-state-opts` attribute. + * + * #### Example: + * ```html + * + * ``` + * + * ### Highlighting the active link + * This directive can be used in conjunction with [[uiSrefActive]] to highlight the active link. + * + * ### Notes + * + * - You can use `ui-params` to change **only the parameter values** by omitting the state name and supplying only `ui-state-params`. + * However, it might be simpler to use [[uiSref]] parameter-only links. + * + * #### Example: + * Sets the `lang` parameter to `en` and remains on the same state. + * + * ```html + * English + * ``` + * + * - A middle-click, right-click, or ctrl-click is handled (natively) by the browser to open the href in a new window, for example. + * ``` + */ +var uiStateDirective; +uiStateDirective = [ + '$uiRouter', + '$timeout', + function $StateRefDynamicDirective($uiRouter, $timeout) { + var $state = $uiRouter.stateService; + return { + restrict: 'A', + require: ['?^uiSrefActive', '?^uiSrefActiveEq'], + link: function (scope, element, attrs, uiSrefActive) { + var type = getTypeInfo(element); + var active = uiSrefActive[1] || uiSrefActive[0]; + var unlinkInfoFn = null; + var hookFn; + var rawDef = {}; + var getDef = function () { return processedDef($state, element, rawDef); }; + var inputAttrs = ['uiState', 'uiStateParams', 'uiStateOpts']; + var watchDeregFns = inputAttrs.reduce(function (acc, attr) { return ((acc[attr] = _uirouter_core__WEBPACK_IMPORTED_MODULE_1__.noop), acc); }, {}); + function update() { + var def = getDef(); + if (unlinkInfoFn) + unlinkInfoFn(); + if (active) + unlinkInfoFn = active.$$addStateInfo(def.uiState, def.uiStateParams); + if (def.href != null) + attrs.$set(type.attr, def.href); + } + inputAttrs.forEach(function (field) { + rawDef[field] = attrs[field] ? scope.$eval(attrs[field]) : null; + attrs.$observe(field, function (expr) { + watchDeregFns[field](); + watchDeregFns[field] = scope.$watch(expr, function (newval) { + rawDef[field] = newval; + update(); + }, true); + }); + }); + update(); + scope.$on('$destroy', $uiRouter.stateRegistry.onStatesChanged(update)); + scope.$on('$destroy', $uiRouter.transitionService.onSuccess({}, update)); + if (!type.clickable) + return; + hookFn = clickHook(element, $state, $timeout, type, getDef); + bindEvents(element, scope, hookFn, rawDef.uiStateOpts); + }, + }; + }, +]; +/** + * `ui-sref-active` and `ui-sref-active-eq`: A directive that adds a CSS class when a `ui-sref` is active + * + * A directive working alongside [[uiSref]] and [[uiState]] to add classes to an element when the + * related directive's state is active (and remove them when it is inactive). + * + * The primary use-case is to highlight the active link in navigation menus, + * distinguishing it from the inactive menu items. + * + * ### Linking to a `ui-sref` or `ui-state` + * `ui-sref-active` can live on the same element as `ui-sref`/`ui-state`, or it can be on a parent element. + * If a `ui-sref-active` is a parent to more than one `ui-sref`/`ui-state`, it will apply the CSS class when **any of the links are active**. + * + * ### Matching + * + * The `ui-sref-active` directive applies the CSS class when the `ui-sref`/`ui-state`'s target state **or any child state is active**. + * This is a "fuzzy match" which uses [[StateService.includes]]. + * + * The `ui-sref-active-eq` directive applies the CSS class when the `ui-sref`/`ui-state`'s target state is directly active (not when child states are active). + * This is an "exact match" which uses [[StateService.is]]. + * + * ### Parameter values + * If the `ui-sref`/`ui-state` includes parameter values, the current parameter values must match the link's values for the link to be highlighted. + * This allows a list of links to the same state with different parameters to be rendered, and the correct one highlighted. + * + * #### Example: + * ```html + *
  • + * {{ user.lastName }} + *
  • + * ``` + * + * ### Examples + * + * Given the following template: + * #### Example: + * ```html + * + * ``` + * + * When the app state is `app.user` (or any child state), + * and contains the state parameter "user" with value "bilbobaggins", + * the resulting HTML will appear as (note the 'active' class): + * + * ```html + * + * ``` + * + * ### Glob mode + * + * It is possible to pass `ui-sref-active` an expression that evaluates to an object. + * The objects keys represent active class names and values represent the respective state names/globs. + * `ui-sref-active` will match if the current active state **includes** any of + * the specified state names/globs, even the abstract ones. + * + * #### Example: + * Given the following template, with "admin" being an abstract state: + * ```html + *
    + * Roles + *
    + * ``` + * + * Arrays are also supported as values in the `ngClass`-like interface. + * This allows multiple states to add `active` class. + * + * #### Example: + * Given the following template, with "admin.roles" being the current state, the class will be added too: + * ```html + *
    + * Roles + *
    + * ``` + * + * When the current state is "admin.roles" the "active" class will be applied to both the `
    ` and `` elements. + * It is important to note that the state names/globs passed to `ui-sref-active` override any state provided by a linked `ui-sref`. + * + * ### Notes: + * + * - The class name is interpolated **once** during the directives link time (any further changes to the + * interpolated value are ignored). + * + * - Multiple classes may be specified in a space-separated format: `ui-sref-active='class1 class2 class3'` + */ +var uiSrefActiveDirective; +uiSrefActiveDirective = [ + '$state', + '$stateParams', + '$interpolate', + '$uiRouter', + function $StateRefActiveDirective($state, $stateParams, $interpolate, $uiRouter) { + return { + restrict: 'A', + controller: [ + '$scope', + '$element', + '$attrs', + function ($scope, $element, $attrs) { + var states = []; + var activeEqClass; + var uiSrefActive; + // There probably isn't much point in $observing this + // uiSrefActive and uiSrefActiveEq share the same directive object with some + // slight difference in logic routing + activeEqClass = $interpolate($attrs.uiSrefActiveEq || '', false)($scope); + try { + uiSrefActive = $scope.$eval($attrs.uiSrefActive); + } + catch (e) { + // Do nothing. uiSrefActive is not a valid expression. + // Fall back to using $interpolate below + } + uiSrefActive = uiSrefActive || $interpolate($attrs.uiSrefActive || '', false)($scope); + setStatesFromDefinitionObject(uiSrefActive); + // Allow uiSref to communicate with uiSrefActive[Equals] + this.$$addStateInfo = function (newState, newParams) { + // we already got an explicit state provided by ui-sref-active, so we + // shadow the one that comes from ui-sref + if ((0,_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.isObject)(uiSrefActive) && states.length > 0) { + return; + } + var deregister = addState(newState, newParams, uiSrefActive); + update(); + return deregister; + }; + function updateAfterTransition(trans) { + trans.promise.then(update, _uirouter_core__WEBPACK_IMPORTED_MODULE_1__.noop); + } + $scope.$on('$destroy', setupEventListeners()); + if ($uiRouter.globals.transition) { + updateAfterTransition($uiRouter.globals.transition); + } + function setupEventListeners() { + var deregisterStatesChangedListener = $uiRouter.stateRegistry.onStatesChanged(handleStatesChanged); + var deregisterOnStartListener = $uiRouter.transitionService.onStart({}, updateAfterTransition); + var deregisterStateChangeSuccessListener = $scope.$on('$stateChangeSuccess', update); + return function cleanUp() { + deregisterStatesChangedListener(); + deregisterOnStartListener(); + deregisterStateChangeSuccessListener(); + }; + } + function handleStatesChanged() { + setStatesFromDefinitionObject(uiSrefActive); + } + function setStatesFromDefinitionObject(statesDefinition) { + if ((0,_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.isObject)(statesDefinition)) { + states = []; + (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.forEach)(statesDefinition, function (stateOrName, activeClass) { + // Helper function to abstract adding state. + var addStateForClass = function (stateOrName, activeClass) { + var ref = parseStateRef(stateOrName); + addState(ref.state, $scope.$eval(ref.paramExpr), activeClass); + }; + if ((0,_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.isString)(stateOrName)) { + // If state is string, just add it. + addStateForClass(stateOrName, activeClass); + } + else if ((0,_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.isArray)(stateOrName)) { + // If state is an array, iterate over it and add each array item individually. + (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.forEach)(stateOrName, function (stateOrName) { + addStateForClass(stateOrName, activeClass); + }); + } + }); + } + } + function addState(stateName, stateParams, activeClass) { + var state = $state.get(stateName, stateContext($element)); + var stateInfo = { + state: state || { name: stateName }, + params: stateParams, + activeClass: activeClass, + }; + states.push(stateInfo); + return function removeState() { + (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.removeFrom)(states)(stateInfo); + }; + } + // Update route state + function update() { + var splitClasses = function (str) { return str.split(/\s/).filter(_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.identity); }; + var getClasses = function (stateList) { + return stateList + .map(function (x) { return x.activeClass; }) + .map(splitClasses) + .reduce(_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.unnestR, []); + }; + var allClasses = getClasses(states).concat(splitClasses(activeEqClass)).reduce(_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.uniqR, []); + var fuzzyClasses = getClasses(states.filter(function (x) { return $state.includes(x.state.name, x.params); })); + var exactlyMatchesAny = !!states.filter(function (x) { return $state.is(x.state.name, x.params); }).length; + var exactClasses = exactlyMatchesAny ? splitClasses(activeEqClass) : []; + var addClasses = fuzzyClasses.concat(exactClasses).reduce(_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.uniqR, []); + var removeClasses = allClasses.filter(function (cls) { return !(0,_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.inArray)(addClasses, cls); }); + $scope.$evalAsync(function () { + addClasses.forEach(function (className) { return $element.addClass(className); }); + removeClasses.forEach(function (className) { return $element.removeClass(className); }); + }); + } + update(); + }, + ], + }; + }, +]; +_angular__WEBPACK_IMPORTED_MODULE_0__.ng.module('ui.router.state') + .directive('uiSref', uiSrefDirective) + .directive('uiSrefActive', uiSrefActiveDirective) + .directive('uiSrefActiveEq', uiSrefActiveDirective) + .directive('uiState', uiStateDirective); +//# sourceMappingURL=stateDirectives.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/angularjs/lib-esm/directives/viewDirective.js": +/*!******************************************************************************!*\ + !*** ./node_modules/@uirouter/angularjs/lib-esm/directives/viewDirective.js ***! + \******************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "uiView": () => (/* binding */ uiView) +/* harmony export */ }); +/* harmony import */ var _uirouter_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @uirouter/core */ "./node_modules/@uirouter/core/lib-esm/index.js"); +/* harmony import */ var _angular__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../angular */ "./node_modules/@uirouter/angularjs/lib-esm/angular.js"); +/* harmony import */ var _services__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../services */ "./node_modules/@uirouter/angularjs/lib-esm/services.js"); +/* harmony import */ var _statebuilders_views__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../statebuilders/views */ "./node_modules/@uirouter/angularjs/lib-esm/statebuilders/views.js"); +/** @publicapi @module directives */ /** */ + + + + +/** + * `ui-view`: A viewport directive which is filled in by a view from the active state. + * + * ### Attributes + * + * - `name`: (Optional) A view name. + * The name should be unique amongst the other views in the same state. + * You can have views of the same name that live in different states. + * The ui-view can be targeted in a View using the name ([[Ng1StateDeclaration.views]]). + * + * - `autoscroll`: an expression. When it evaluates to true, the `ui-view` will be scrolled into view when it is activated. + * Uses [[$uiViewScroll]] to do the scrolling. + * + * - `onload`: Expression to evaluate whenever the view updates. + * + * #### Example: + * A view can be unnamed or named. + * ```html + * + *
    + * + * + *
    + * + * + * + * ``` + * + * You can only have one unnamed view within any template (or root html). If you are only using a + * single view and it is unnamed then you can populate it like so: + * + * ```html + *
    + * $stateProvider.state("home", { + * template: "

    HELLO!

    " + * }) + * ``` + * + * The above is a convenient shortcut equivalent to specifying your view explicitly with the + * [[Ng1StateDeclaration.views]] config property, by name, in this case an empty name: + * + * ```js + * $stateProvider.state("home", { + * views: { + * "": { + * template: "

    HELLO!

    " + * } + * } + * }) + * ``` + * + * But typically you'll only use the views property if you name your view or have more than one view + * in the same template. There's not really a compelling reason to name a view if its the only one, + * but you could if you wanted, like so: + * + * ```html + *
    + * ``` + * + * ```js + * $stateProvider.state("home", { + * views: { + * "main": { + * template: "

    HELLO!

    " + * } + * } + * }) + * ``` + * + * Really though, you'll use views to set up multiple views: + * + * ```html + *
    + *
    + *
    + * ``` + * + * ```js + * $stateProvider.state("home", { + * views: { + * "": { + * template: "

    HELLO!

    " + * }, + * "chart": { + * template: "" + * }, + * "data": { + * template: "" + * } + * } + * }) + * ``` + * + * #### Examples for `autoscroll`: + * ```html + * + * + * + * + * + * + * + * ``` + * + * Resolve data: + * + * The resolved data from the state's `resolve` block is placed on the scope as `$resolve` (this + * can be customized using [[Ng1ViewDeclaration.resolveAs]]). This can be then accessed from the template. + * + * Note that when `controllerAs` is being used, `$resolve` is set on the controller instance *after* the + * controller is instantiated. The `$onInit()` hook can be used to perform initialization code which + * depends on `$resolve` data. + * + * #### Example: + * ```js + * $stateProvider.state('home', { + * template: '', + * resolve: { + * user: function(UserService) { return UserService.fetchUser(); } + * } + * }); + * ``` + */ +var uiView; +// eslint-disable-next-line prefer-const +uiView = [ + '$view', + '$animate', + '$uiViewScroll', + '$interpolate', + '$q', + function $ViewDirective($view, $animate, $uiViewScroll, $interpolate, $q) { + function getRenderer() { + return { + enter: function (element, target, cb) { + if (_angular__WEBPACK_IMPORTED_MODULE_1__.ng.version.minor > 2) { + $animate.enter(element, null, target).then(cb); + } + else { + $animate.enter(element, null, target, cb); + } + }, + leave: function (element, cb) { + if (_angular__WEBPACK_IMPORTED_MODULE_1__.ng.version.minor > 2) { + $animate.leave(element).then(cb); + } + else { + $animate.leave(element, cb); + } + }, + }; + } + function configsEqual(config1, config2) { + return config1 === config2; + } + var rootData = { + $cfg: { viewDecl: { $context: $view._pluginapi._rootViewContext() } }, + $uiView: {}, + }; + var directive = { + count: 0, + restrict: 'ECA', + terminal: true, + priority: 400, + transclude: 'element', + compile: function (tElement, tAttrs, $transclude) { + return function (scope, $element, attrs) { + var onloadExp = attrs['onload'] || '', autoScrollExp = attrs['autoscroll'], renderer = getRenderer(), inherited = $element.inheritedData('$uiView') || rootData, name = $interpolate(attrs['uiView'] || attrs['name'] || '')(scope) || '$default'; + var previousEl, currentEl, currentScope, viewConfig; + var activeUIView = { + $type: 'ng1', + id: directive.count++, + name: name, + fqn: inherited.$uiView.fqn ? inherited.$uiView.fqn + '.' + name : name, + config: null, + configUpdated: configUpdatedCallback, + get creationContext() { + // The context in which this ui-view "tag" was created + var fromParentTagConfig = (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.parse)('$cfg.viewDecl.$context')(inherited); + // Allow + // See https://github.com/angular-ui/ui-router/issues/3355 + var fromParentTag = (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.parse)('$uiView.creationContext')(inherited); + return fromParentTagConfig || fromParentTag; + }, + }; + _uirouter_core__WEBPACK_IMPORTED_MODULE_0__.trace.traceUIViewEvent('Linking', activeUIView); + function configUpdatedCallback(config) { + if (config && !(config instanceof _statebuilders_views__WEBPACK_IMPORTED_MODULE_3__.Ng1ViewConfig)) + return; + if (configsEqual(viewConfig, config)) + return; + _uirouter_core__WEBPACK_IMPORTED_MODULE_0__.trace.traceUIViewConfigUpdated(activeUIView, config && config.viewDecl && config.viewDecl.$context); + viewConfig = config; + updateView(config); + } + $element.data('$uiView', { $uiView: activeUIView }); + updateView(); + var unregister = $view.registerUIView(activeUIView); + scope.$on('$destroy', function () { + _uirouter_core__WEBPACK_IMPORTED_MODULE_0__.trace.traceUIViewEvent('Destroying/Unregistering', activeUIView); + unregister(); + }); + function cleanupLastView() { + if (previousEl) { + _uirouter_core__WEBPACK_IMPORTED_MODULE_0__.trace.traceUIViewEvent('Removing (previous) el', previousEl.data('$uiView')); + previousEl.remove(); + previousEl = null; + } + if (currentScope) { + _uirouter_core__WEBPACK_IMPORTED_MODULE_0__.trace.traceUIViewEvent('Destroying scope', activeUIView); + currentScope.$destroy(); + currentScope = null; + } + if (currentEl) { + var _viewData_1 = currentEl.data('$uiViewAnim'); + _uirouter_core__WEBPACK_IMPORTED_MODULE_0__.trace.traceUIViewEvent('Animate out', _viewData_1); + renderer.leave(currentEl, function () { + _viewData_1.$$animLeave.resolve(); + previousEl = null; + }); + previousEl = currentEl; + currentEl = null; + } + } + function updateView(config) { + var newScope = scope.$new(); + var animEnter = $q.defer(), animLeave = $q.defer(); + var $uiViewData = { + $cfg: config, + $uiView: activeUIView, + }; + var $uiViewAnim = { + $animEnter: animEnter.promise, + $animLeave: animLeave.promise, + $$animLeave: animLeave, + }; + /** + * @ngdoc event + * @name ui.router.state.directive:ui-view#$viewContentLoading + * @eventOf ui.router.state.directive:ui-view + * @eventType emits on ui-view directive scope + * @description + * + * Fired once the view **begins loading**, *before* the DOM is rendered. + * + * @param {Object} event Event object. + * @param {string} viewName Name of the view. + */ + newScope.$emit('$viewContentLoading', name); + var cloned = $transclude(newScope, function (clone) { + clone.data('$uiViewAnim', $uiViewAnim); + clone.data('$uiView', $uiViewData); + renderer.enter(clone, $element, function onUIViewEnter() { + animEnter.resolve(); + if (currentScope) + currentScope.$emit('$viewContentAnimationEnded'); + if (((0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.isDefined)(autoScrollExp) && !autoScrollExp) || scope.$eval(autoScrollExp)) { + $uiViewScroll(clone); + } + }); + cleanupLastView(); + }); + currentEl = cloned; + currentScope = newScope; + /** + * @ngdoc event + * @name ui.router.state.directive:ui-view#$viewContentLoaded + * @eventOf ui.router.state.directive:ui-view + * @eventType emits on ui-view directive scope + * @description * + * Fired once the view is **loaded**, *after* the DOM is rendered. + * + * @param {Object} event Event object. + */ + currentScope.$emit('$viewContentLoaded', config || viewConfig); + currentScope.$eval(onloadExp); + } + }; + }, + }; + return directive; + }, +]; +$ViewDirectiveFill.$inject = ['$compile', '$controller', '$transitions', '$view', '$q']; +/** @hidden */ +function $ViewDirectiveFill($compile, $controller, $transitions, $view, $q) { + var getControllerAs = (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.parse)('viewDecl.controllerAs'); + var getResolveAs = (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.parse)('viewDecl.resolveAs'); + return { + restrict: 'ECA', + priority: -400, + compile: function (tElement) { + var initial = tElement.html(); + tElement.empty(); + return function (scope, $element) { + var data = $element.data('$uiView'); + if (!data) { + $element.html(initial); + $compile($element.contents())(scope); + return; + } + var cfg = data.$cfg || { viewDecl: {}, getTemplate: _uirouter_core__WEBPACK_IMPORTED_MODULE_0__.noop }; + var resolveCtx = cfg.path && new _uirouter_core__WEBPACK_IMPORTED_MODULE_0__.ResolveContext(cfg.path); + $element.html(cfg.getTemplate($element, resolveCtx) || initial); + _uirouter_core__WEBPACK_IMPORTED_MODULE_0__.trace.traceUIViewFill(data.$uiView, $element.html()); + var link = $compile($element.contents()); + var controller = cfg.controller; + var controllerAs = getControllerAs(cfg); + var resolveAs = getResolveAs(cfg); + var locals = resolveCtx && (0,_services__WEBPACK_IMPORTED_MODULE_2__.getLocals)(resolveCtx); + scope[resolveAs] = locals; + if (controller) { + var controllerInstance = ($controller(controller, (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.extend)({}, locals, { $scope: scope, $element: $element }))); + if (controllerAs) { + scope[controllerAs] = controllerInstance; + scope[controllerAs][resolveAs] = locals; + } + // TODO: Use $view service as a central point for registering component-level hooks + // Then, when a component is created, tell the $view service, so it can invoke hooks + // $view.componentLoaded(controllerInstance, { $scope: scope, $element: $element }); + // scope.$on('$destroy', () => $view.componentUnloaded(controllerInstance, { $scope: scope, $element: $element })); + $element.data('$ngControllerController', controllerInstance); + $element.children().data('$ngControllerController', controllerInstance); + registerControllerCallbacks($q, $transitions, controllerInstance, scope, cfg); + } + // Wait for the component to appear in the DOM + if ((0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.isString)(cfg.component)) { + var kebobName = (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.kebobString)(cfg.component); + var tagRegexp_1 = new RegExp("^(x-|data-)?" + kebobName + "$", 'i'); + var getComponentController = function () { + var directiveEl = [].slice + .call($element[0].children) + .filter(function (el) { return el && el.tagName && tagRegexp_1.exec(el.tagName); }); + return directiveEl && _angular__WEBPACK_IMPORTED_MODULE_1__.ng.element(directiveEl).data("$" + cfg.component + "Controller"); + }; + var deregisterWatch_1 = scope.$watch(getComponentController, function (ctrlInstance) { + if (!ctrlInstance) + return; + registerControllerCallbacks($q, $transitions, ctrlInstance, scope, cfg); + deregisterWatch_1(); + }); + } + link(scope); + }; + }, + }; +} +/** @hidden */ +var hasComponentImpl = typeof _angular__WEBPACK_IMPORTED_MODULE_1__.ng.module('ui.router')['component'] === 'function'; +/** @hidden incrementing id */ +var _uiCanExitId = 0; +/** @hidden TODO: move these callbacks to $view and/or `/hooks/components.ts` or something */ +function registerControllerCallbacks($q, $transitions, controllerInstance, $scope, cfg) { + // Call $onInit() ASAP + if ((0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.isFunction)(controllerInstance.$onInit) && + !((cfg.viewDecl.component || cfg.viewDecl.componentProvider) && hasComponentImpl)) { + controllerInstance.$onInit(); + } + var viewState = (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.tail)(cfg.path).state.self; + var hookOptions = { bind: controllerInstance }; + // Add component-level hook for onUiParamsChanged + if ((0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.isFunction)(controllerInstance.uiOnParamsChanged)) { + var resolveContext = new _uirouter_core__WEBPACK_IMPORTED_MODULE_0__.ResolveContext(cfg.path); + var viewCreationTrans_1 = resolveContext.getResolvable('$transition$').data; + // Fire callback on any successful transition + var paramsUpdated = function ($transition$) { + // Exit early if the $transition$ is the same as the view was created within. + // Exit early if the $transition$ will exit the state the view is for. + if ($transition$ === viewCreationTrans_1 || $transition$.exiting().indexOf(viewState) !== -1) + return; + var toParams = $transition$.params('to'); + var fromParams = $transition$.params('from'); + var getNodeSchema = function (node) { return node.paramSchema; }; + var toSchema = $transition$.treeChanges('to').map(getNodeSchema).reduce(_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.unnestR, []); + var fromSchema = $transition$.treeChanges('from').map(getNodeSchema).reduce(_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.unnestR, []); + // Find the to params that have different values than the from params + var changedToParams = toSchema.filter(function (param) { + var idx = fromSchema.indexOf(param); + return idx === -1 || !fromSchema[idx].type.equals(toParams[param.id], fromParams[param.id]); + }); + // Only trigger callback if a to param has changed or is new + if (changedToParams.length) { + var changedKeys_1 = changedToParams.map(function (x) { return x.id; }); + // Filter the params to only changed/new to params. `$transition$.params()` may be used to get all params. + var newValues = (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.filter)(toParams, function (val, key) { return changedKeys_1.indexOf(key) !== -1; }); + controllerInstance.uiOnParamsChanged(newValues, $transition$); + } + }; + $scope.$on('$destroy', $transitions.onSuccess({}, paramsUpdated, hookOptions)); + } + // Add component-level hook for uiCanExit + if ((0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.isFunction)(controllerInstance.uiCanExit)) { + var id_1 = _uiCanExitId++; + var cacheProp_1 = '_uiCanExitIds'; + // Returns true if a redirect transition already answered truthy + var prevTruthyAnswer_1 = function (trans) { + return !!trans && ((trans[cacheProp_1] && trans[cacheProp_1][id_1] === true) || prevTruthyAnswer_1(trans.redirectedFrom())); + }; + // If a user answered yes, but the transition was later redirected, don't also ask for the new redirect transition + var wrappedHook = function (trans) { + var promise; + var ids = (trans[cacheProp_1] = trans[cacheProp_1] || {}); + if (!prevTruthyAnswer_1(trans)) { + promise = $q.when(controllerInstance.uiCanExit(trans)); + promise.then(function (val) { return (ids[id_1] = val !== false); }); + } + return promise; + }; + var criteria = { exiting: viewState.name }; + $scope.$on('$destroy', $transitions.onBefore(criteria, wrappedHook, hookOptions)); + } +} +_angular__WEBPACK_IMPORTED_MODULE_1__.ng.module('ui.router.state').directive('uiView', uiView); +_angular__WEBPACK_IMPORTED_MODULE_1__.ng.module('ui.router.state').directive('uiView', $ViewDirectiveFill); +//# sourceMappingURL=viewDirective.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/angularjs/lib-esm/index.js": +/*!***********************************************************!*\ + !*** ./node_modules/@uirouter/angularjs/lib-esm/index.js ***! + \***********************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "getLocals": () => (/* reexport safe */ _services__WEBPACK_IMPORTED_MODULE_1__.getLocals), +/* harmony export */ "watchDigests": () => (/* reexport safe */ _services__WEBPACK_IMPORTED_MODULE_1__.watchDigests), +/* harmony export */ "Ng1ViewConfig": () => (/* reexport safe */ _statebuilders_views__WEBPACK_IMPORTED_MODULE_2__.Ng1ViewConfig), +/* harmony export */ "getNg1ViewConfigFactory": () => (/* reexport safe */ _statebuilders_views__WEBPACK_IMPORTED_MODULE_2__.getNg1ViewConfigFactory), +/* harmony export */ "ng1ViewsBuilder": () => (/* reexport safe */ _statebuilders_views__WEBPACK_IMPORTED_MODULE_2__.ng1ViewsBuilder), +/* harmony export */ "StateProvider": () => (/* reexport safe */ _stateProvider__WEBPACK_IMPORTED_MODULE_3__.StateProvider), +/* harmony export */ "UrlRouterProvider": () => (/* reexport safe */ _urlRouterProvider__WEBPACK_IMPORTED_MODULE_4__.UrlRouterProvider), +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__), +/* harmony export */ "core": () => (/* reexport module object */ _uirouter_core__WEBPACK_IMPORTED_MODULE_10__) +/* harmony export */ }); +/* harmony import */ var _interface__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./interface */ "./node_modules/@uirouter/angularjs/lib-esm/interface.js"); +/* harmony import */ var _interface__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_interface__WEBPACK_IMPORTED_MODULE_0__); +/* harmony reexport (unknown) */ var __WEBPACK_REEXPORT_OBJECT__ = {}; +/* harmony reexport (unknown) */ for(const __WEBPACK_IMPORT_KEY__ in _interface__WEBPACK_IMPORTED_MODULE_0__) if(["default","core"].indexOf(__WEBPACK_IMPORT_KEY__) < 0) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = () => _interface__WEBPACK_IMPORTED_MODULE_0__[__WEBPACK_IMPORT_KEY__] +/* harmony reexport (unknown) */ __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__); +/* harmony import */ var _services__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./services */ "./node_modules/@uirouter/angularjs/lib-esm/services.js"); +/* harmony import */ var _statebuilders_views__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./statebuilders/views */ "./node_modules/@uirouter/angularjs/lib-esm/statebuilders/views.js"); +/* harmony import */ var _stateProvider__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./stateProvider */ "./node_modules/@uirouter/angularjs/lib-esm/stateProvider.js"); +/* harmony import */ var _urlRouterProvider__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./urlRouterProvider */ "./node_modules/@uirouter/angularjs/lib-esm/urlRouterProvider.js"); +/* harmony import */ var _injectables__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./injectables */ "./node_modules/@uirouter/angularjs/lib-esm/injectables.js"); +/* harmony import */ var _injectables__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_injectables__WEBPACK_IMPORTED_MODULE_5__); +/* harmony import */ var _directives_stateDirectives__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./directives/stateDirectives */ "./node_modules/@uirouter/angularjs/lib-esm/directives/stateDirectives.js"); +/* harmony import */ var _stateFilters__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./stateFilters */ "./node_modules/@uirouter/angularjs/lib-esm/stateFilters.js"); +/* harmony import */ var _directives_viewDirective__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./directives/viewDirective */ "./node_modules/@uirouter/angularjs/lib-esm/directives/viewDirective.js"); +/* harmony import */ var _viewScroll__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./viewScroll */ "./node_modules/@uirouter/angularjs/lib-esm/viewScroll.js"); +/* harmony import */ var _uirouter_core__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! @uirouter/core */ "./node_modules/@uirouter/core/lib-esm/index.js"); +/* harmony reexport (unknown) */ var __WEBPACK_REEXPORT_OBJECT__ = {}; +/* harmony reexport (unknown) */ for(const __WEBPACK_IMPORT_KEY__ in _uirouter_core__WEBPACK_IMPORTED_MODULE_10__) if(["default","core","getLocals","watchDigests","Ng1ViewConfig","getNg1ViewConfigFactory","ng1ViewsBuilder","StateProvider","UrlRouterProvider"].indexOf(__WEBPACK_IMPORT_KEY__) < 0) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = () => _uirouter_core__WEBPACK_IMPORTED_MODULE_10__[__WEBPACK_IMPORT_KEY__] +/* harmony reexport (unknown) */ __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__); +/** + * Main entry point for angular 1.x build + * @publicapi @module ng1 + */ /** */ + + + + + + + + + + +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ('ui.router'); + + + +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/angularjs/lib-esm/injectables.js": +/*!*****************************************************************!*\ + !*** ./node_modules/@uirouter/angularjs/lib-esm/injectables.js ***! + \*****************************************************************/ +/***/ (() => { + +/** + * The current (or pending) State Parameters + * + * An injectable global **Service Object** which holds the state parameters for the latest **SUCCESSFUL** transition. + * + * The values are not updated until *after* a `Transition` successfully completes. + * + * **Also:** an injectable **Per-Transition Object** object which holds the pending state parameters for the pending `Transition` currently running. + * + * ### Deprecation warning: + * + * The value injected for `$stateParams` is different depending on where it is injected. + * + * - When injected into an angular service, the object injected is the global **Service Object** with the parameter values for the latest successful `Transition`. + * - When injected into transition hooks, resolves, or view controllers, the object is the **Per-Transition Object** with the parameter values for the running `Transition`. + * + * Because of these confusing details, this service is deprecated. + * + * ### Instead of using the global `$stateParams` service object, + * inject [[$uiRouterGlobals]] and use [[UIRouterGlobals.params]] + * + * ```js + * MyService.$inject = ['$uiRouterGlobals']; + * function MyService($uiRouterGlobals) { + * return { + * paramValues: function () { + * return $uiRouterGlobals.params; + * } + * } + * } + * ``` + * + * ### Instead of using the per-transition `$stateParams` object, + * inject the current `Transition` (as [[$transition$]]) and use [[Transition.params]] + * + * ```js + * MyController.$inject = ['$transition$']; + * function MyController($transition$) { + * var username = $transition$.params().username; + * // .. do something with username + * } + * ``` + * + * --- + * + * This object can be injected into other services. + * + * #### Deprecated Example: + * ```js + * SomeService.$inject = ['$http', '$stateParams']; + * function SomeService($http, $stateParams) { + * return { + * getUser: function() { + * return $http.get('/api/users/' + $stateParams.username); + * } + * } + * }; + * angular.service('SomeService', SomeService); + * ``` + * @deprecated + */ +var $stateParams; +/** + * Global UI-Router variables + * + * The router global state as a **Service Object** (injectable during runtime). + * + * This object contains globals such as the current state and current parameter values. + */ +var $uiRouterGlobals; +/** + * The UI-Router instance + * + * The [[UIRouter]] singleton (the router instance) as a **Service Object** (injectable during runtime). + * + * This object is the UI-Router singleton instance, created by angular dependency injection during application bootstrap. + * It has references to the other UI-Router services + * + * #### Note: This object is also exposed as [[$uiRouterProvider]] for injection during angular config time. + */ +var $uiRouter; +/** + * The UI-Router instance + * + * The [[UIRouter]] singleton (the router instance) as a **Provider Object** (injectable during config phase). + * + * This object is the UI-Router singleton instance, created by angular dependency injection during application bootstrap. + * It has references to the other UI-Router services + * + * #### Note: This object is also exposed as [[$uiRouter]] for injection during runtime. + */ +var $uiRouterProvider; +/** + * Transition debug/tracing + * + * The [[Trace]] singleton as a **Service Object** (injectable during runtime). + * + * Enables or disables Transition tracing which can help to debug issues. + */ +var $trace; +/** + * The Transition Service + * + * The [[TransitionService]] singleton as a **Service Object** (injectable during runtime). + * + * This angular service exposes the [[TransitionService]] singleton, which is primarily + * used to register global transition hooks. + * + * #### Note: This object is also exposed as [[$transitionsProvider]] for injection during the config phase. + */ +var $transitions; +/** + * The Transition Service + * + * The [[TransitionService]] singleton as a **Provider Object** (injectable during config phase) + * + * This angular service exposes the [[TransitionService]] singleton, which is primarily + * used to register global transition hooks. + * + * #### Note: This object is also exposed as [[$transitions]] for injection during runtime. + */ +var $transitionsProvider; +/** + * The current [[Transition]] object + * + * The current [[Transition]] object as a **Per-Transition Object** (injectable into Resolve, Hooks, Controllers) + * + * This object returns information about the current transition, including: + * + * - To/from states + * - To/from parameters + * - Transition options + * - States being entered, exited, and retained + * - Resolve data + * - A Promise for the transition + * - Any transition failure information + * - An injector for both Service and Per-Transition Objects + */ +var $transition$; +/** + * The State Service + * + * The [[StateService]] singleton as a **Service Object** (injectable during runtime). + * + * This service used to manage and query information on registered states. + * It exposes state related APIs including: + * + * - Start a [[Transition]] + * - Imperatively lazy load states + * - Check if a state is currently active + * - Look up states by name + * - Build URLs for a state+parameters + * - Configure the global Transition error handler + * + * This angular service exposes the [[StateService]] singleton. + */ +var $state; +/** + * The State Registry + * + * The [[StateRegistry]] singleton as a **Service Object** (injectable during runtime). + * + * This service is used to register/deregister states. + * It has state registration related APIs including: + * + * - Register/deregister states + * - Listen for state registration/deregistration + * - Get states by name + * - Add state decorators (to customize the state creation process) + * + * #### Note: This object is also exposed as [[$stateRegistryProvider]] for injection during the config phase. + */ +var $stateRegistry; +/** + * The State Registry + * + * The [[StateRegistry]] singleton as a **Provider Object** (injectable during config time). + * + * This service is used to register/deregister states. + * It has state registration related APIs including: + * + * - Register/deregister states + * - Listen for state registration/deregistration + * - Get states by name + * - Add state decorators (to customize the state creation process) + * + * #### Note: This object is also exposed as [[$stateRegistry]] for injection during runtime. + */ +var $stateRegistryProvider; +/** + * The View Scroll provider + * + * The [[UIViewScrollProvider]] as a **Provider Object** (injectable during config time). + * + * This angular service exposes the [[UIViewScrollProvider]] singleton and is + * used to disable UI-Router's scroll behavior. + */ +var $uiViewScrollProvider; +/** + * The View Scroll function + * + * The View Scroll function as a **Service Object** (injectable during runtime). + * + * This is a function that scrolls an element into view. + * The element is scrolled after a `$timeout` so the DOM has time to refresh. + * + * If you prefer to rely on `$anchorScroll` to scroll the view to the anchor, + * this can be enabled by calling [[UIViewScrollProvider.useAnchorScroll]]. + * + * Note: this function is used by the [[directives.uiView]] when the `autoscroll` expression evaluates to true. + */ +var $uiViewScroll; +/** + * The StateProvider + * + * An angular1-only [[StateProvider]] as a **Provider Object** (injectable during config time). + * + * This angular service exposes the [[StateProvider]] singleton. + * + * The `StateProvider` is primarily used to register states or add custom state decorators. + * + * ##### Note: This provider is a ng1 vestige. + * It is a passthrough to [[$stateRegistry]] and [[$state]]. + */ +var $stateProvider; +/** + * The URL Service Provider + * + * The [[UrlService]] singleton as a **Provider Object** (injectable during the angular config phase). + * + * A service used to configure and interact with the URL. + * It has URL related APIs including: + * + * - register custom Parameter types `UrlService.config.type` ([[UrlConfigApi.type]]) + * - add URL rules: `UrlService.rules.when` ([[UrlRulesApi.when]]) + * - configure behavior when no url matches: `UrlService.rules.otherwise` ([[UrlRulesApi.otherwise]]) + * - delay initial URL synchronization [[UrlService.deferIntercept]]. + * - get or set the current url: [[UrlService.url]] + * + * ##### Note: This service can also be injected during runtime as [[$urlService]]. + */ +var $urlServiceProvider; +/** + * The URL Service + * + * The [[UrlService]] singleton as a **Service Object** (injectable during runtime). + * + * Note: This service can also be injected during the config phase as [[$urlServiceProvider]]. + * + * Used to configure the URL. + * It has URL related APIs including: + * + * - register custom Parameter types `UrlService.config.type` ([[UrlConfigApi.type]]) + * - add URL rules: `UrlService.rules.when` ([[UrlRulesApi.when]]) + * - configure behavior when no url matches: `UrlService.rules.otherwise` ([[UrlRulesApi.otherwise]]) + * - delay initial URL synchronization [[UrlService.deferIntercept]]. + * - get or set the current url: [[UrlService.url]] + * + * ##### Note: This service can also be injected during the config phase as [[$urlServiceProvider]]. + */ +var $urlService; +/** + * The URL Router Provider + * + * ### Deprecation warning: This object is now considered internal. Use [[$urlServiceProvider]] instead. + * + * The [[UrlRouter]] singleton as a **Provider Object** (injectable during config time). + * + * #### Note: This object is also exposed as [[$urlRouter]] for injection during runtime. + * + * @deprecated + */ +var $urlRouterProvider; +/** + * The Url Router + * + * ### Deprecation warning: This object is now considered internal. Use [[$urlService]] instead. + * + * The [[UrlRouter]] singleton as a **Service Object** (injectable during runtime). + * + * #### Note: This object is also exposed as [[$urlRouterProvider]] for injection during angular config time. + * + * @deprecated + */ +var $urlRouter; +/** + * The URL Matcher Factory + * + * ### Deprecation warning: This object is now considered internal. Use [[$urlService]] instead. + * + * The [[UrlMatcherFactory]] singleton as a **Service Object** (injectable during runtime). + * + * This service is used to set url mapping options, define custom parameter types, and create [[UrlMatcher]] objects. + * + * #### Note: This object is also exposed as [[$urlMatcherFactoryProvider]] for injection during angular config time. + * + * @deprecated + */ +var $urlMatcherFactory; +/** + * The URL Matcher Factory + * + * ### Deprecation warning: This object is now considered internal. Use [[$urlService]] instead. + * + * The [[UrlMatcherFactory]] singleton as a **Provider Object** (injectable during config time). + * + * This service is used to set url mapping options, define custom parameter types, and create [[UrlMatcher]] objects. + * + * #### Note: This object is also exposed as [[$urlMatcherFactory]] for injection during runtime. + * + * @deprecated + */ +var $urlMatcherFactoryProvider; +//# sourceMappingURL=injectables.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/angularjs/lib-esm/interface.js": +/*!***************************************************************!*\ + !*** ./node_modules/@uirouter/angularjs/lib-esm/interface.js ***! + \***************************************************************/ +/***/ (() => { + +//# sourceMappingURL=interface.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/angularjs/lib-esm/locationServices.js": +/*!**********************************************************************!*\ + !*** ./node_modules/@uirouter/angularjs/lib-esm/locationServices.js ***! + \**********************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "Ng1LocationServices": () => (/* binding */ Ng1LocationServices) +/* harmony export */ }); +/* harmony import */ var _uirouter_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @uirouter/core */ "./node_modules/@uirouter/core/lib-esm/index.js"); +/** @publicapi @module ng1 */ /** */ + + +/** + * Implements UI-Router LocationServices and LocationConfig using Angular 1's $location service + * @internalapi + */ +var Ng1LocationServices = /** @class */ (function () { + function Ng1LocationServices($locationProvider) { + // .onChange() registry + this._urlListeners = []; + this.$locationProvider = $locationProvider; + var _lp = (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.val)($locationProvider); + (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.createProxyFunctions)(_lp, this, _lp, ['hashPrefix']); + } + /** + * Applys ng1-specific path parameter encoding + * + * The Angular 1 `$location` service is a bit weird. + * It doesn't allow slashes to be encoded/decoded bi-directionally. + * + * See the writeup at https://github.com/angular-ui/ui-router/issues/2598 + * + * This code patches the `path` parameter type so it encoded/decodes slashes as ~2F + * + * @param router + */ + Ng1LocationServices.monkeyPatchPathParameterType = function (router) { + var pathType = router.urlMatcherFactory.type('path'); + pathType.encode = function (x) { + return x != null ? x.toString().replace(/(~|\/)/g, function (m) { return ({ '~': '~~', '/': '~2F' }[m]); }) : x; + }; + pathType.decode = function (x) { + return x != null ? x.toString().replace(/(~~|~2F)/g, function (m) { return ({ '~~': '~', '~2F': '/' }[m]); }) : x; + }; + }; + // eslint-disable-next-line @typescript-eslint/no-empty-function + Ng1LocationServices.prototype.dispose = function () { }; + Ng1LocationServices.prototype.onChange = function (callback) { + var _this = this; + this._urlListeners.push(callback); + return function () { return (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.removeFrom)(_this._urlListeners)(callback); }; + }; + Ng1LocationServices.prototype.html5Mode = function () { + var html5Mode = this.$locationProvider.html5Mode(); + html5Mode = (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.isObject)(html5Mode) ? html5Mode.enabled : html5Mode; + return html5Mode && this.$sniffer.history; + }; + Ng1LocationServices.prototype.baseHref = function () { + return this._baseHref || (this._baseHref = this.$browser.baseHref() || this.$window.location.pathname); + }; + Ng1LocationServices.prototype.url = function (newUrl, replace, state) { + if (replace === void 0) { replace = false; } + if ((0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.isDefined)(newUrl)) + this.$location.url(newUrl); + if (replace) + this.$location.replace(); + if (state) + this.$location.state(state); + return this.$location.url(); + }; + Ng1LocationServices.prototype._runtimeServices = function ($rootScope, $location, $sniffer, $browser, $window) { + var _this = this; + this.$location = $location; + this.$sniffer = $sniffer; + this.$browser = $browser; + this.$window = $window; + // Bind $locationChangeSuccess to the listeners registered in LocationService.onChange + $rootScope.$on('$locationChangeSuccess', function (evt) { return _this._urlListeners.forEach(function (fn) { return fn(evt); }); }); + var _loc = (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.val)($location); + // Bind these LocationService functions to $location + (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.createProxyFunctions)(_loc, this, _loc, ['replace', 'path', 'search', 'hash']); + // Bind these LocationConfig functions to $location + (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.createProxyFunctions)(_loc, this, _loc, ['port', 'protocol', 'host']); + }; + return Ng1LocationServices; +}()); + +//# sourceMappingURL=locationServices.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/angularjs/lib-esm/services.js": +/*!**************************************************************!*\ + !*** ./node_modules/@uirouter/angularjs/lib-esm/services.js ***! + \**************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "watchDigests": () => (/* binding */ watchDigests), +/* harmony export */ "getLocals": () => (/* binding */ getLocals) +/* harmony export */ }); +/* harmony import */ var _angular__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./angular */ "./node_modules/@uirouter/angularjs/lib-esm/angular.js"); +/* harmony import */ var _uirouter_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @uirouter/core */ "./node_modules/@uirouter/core/lib-esm/index.js"); +/* harmony import */ var _statebuilders_views__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./statebuilders/views */ "./node_modules/@uirouter/angularjs/lib-esm/statebuilders/views.js"); +/* harmony import */ var _templateFactory__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./templateFactory */ "./node_modules/@uirouter/angularjs/lib-esm/templateFactory.js"); +/* harmony import */ var _stateProvider__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./stateProvider */ "./node_modules/@uirouter/angularjs/lib-esm/stateProvider.js"); +/* harmony import */ var _statebuilders_onEnterExitRetain__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./statebuilders/onEnterExitRetain */ "./node_modules/@uirouter/angularjs/lib-esm/statebuilders/onEnterExitRetain.js"); +/* harmony import */ var _locationServices__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./locationServices */ "./node_modules/@uirouter/angularjs/lib-esm/locationServices.js"); +/* harmony import */ var _urlRouterProvider__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./urlRouterProvider */ "./node_modules/@uirouter/angularjs/lib-esm/urlRouterProvider.js"); +/* eslint-disable @typescript-eslint/no-empty-function */ +/* eslint-disable @typescript-eslint/no-unused-vars */ +/** + * # Angular 1 types + * + * UI-Router core provides various Typescript types which you can use for code completion and validating parameter values, etc. + * The customizations to the core types for Angular UI-Router are documented here. + * + * The optional [[$resolve]] service is also documented here. + * + * @preferred @publicapi @module ng1 + */ /** */ + + + + + + + + +_angular__WEBPACK_IMPORTED_MODULE_0__.ng.module('ui.router.angular1', []); +var mod_init = _angular__WEBPACK_IMPORTED_MODULE_0__.ng.module('ui.router.init', ['ng']); +var mod_util = _angular__WEBPACK_IMPORTED_MODULE_0__.ng.module('ui.router.util', ['ui.router.init']); +var mod_rtr = _angular__WEBPACK_IMPORTED_MODULE_0__.ng.module('ui.router.router', ['ui.router.util']); +var mod_state = _angular__WEBPACK_IMPORTED_MODULE_0__.ng.module('ui.router.state', ['ui.router.router', 'ui.router.util', 'ui.router.angular1']); +var mod_main = _angular__WEBPACK_IMPORTED_MODULE_0__.ng.module('ui.router', ['ui.router.init', 'ui.router.state', 'ui.router.angular1']); +var mod_cmpt = _angular__WEBPACK_IMPORTED_MODULE_0__.ng.module('ui.router.compat', ['ui.router']); +var router = null; +$uiRouterProvider.$inject = ['$locationProvider']; +/** This angular 1 provider instantiates a Router and exposes its services via the angular injector */ +function $uiRouterProvider($locationProvider) { + // Create a new instance of the Router when the $uiRouterProvider is initialized + router = this.router = new _uirouter_core__WEBPACK_IMPORTED_MODULE_1__.UIRouter(); + router.stateProvider = new _stateProvider__WEBPACK_IMPORTED_MODULE_4__.StateProvider(router.stateRegistry, router.stateService); + // Apply ng1 specific StateBuilder code for `views`, `resolve`, and `onExit/Retain/Enter` properties + router.stateRegistry.decorator('views', _statebuilders_views__WEBPACK_IMPORTED_MODULE_2__.ng1ViewsBuilder); + router.stateRegistry.decorator('onExit', (0,_statebuilders_onEnterExitRetain__WEBPACK_IMPORTED_MODULE_5__.getStateHookBuilder)('onExit')); + router.stateRegistry.decorator('onRetain', (0,_statebuilders_onEnterExitRetain__WEBPACK_IMPORTED_MODULE_5__.getStateHookBuilder)('onRetain')); + router.stateRegistry.decorator('onEnter', (0,_statebuilders_onEnterExitRetain__WEBPACK_IMPORTED_MODULE_5__.getStateHookBuilder)('onEnter')); + router.viewService._pluginapi._viewConfigFactory('ng1', (0,_statebuilders_views__WEBPACK_IMPORTED_MODULE_2__.getNg1ViewConfigFactory)()); + // Disable decoding of params by UrlMatcherFactory because $location already handles this + router.urlService.config._decodeParams = false; + var ng1LocationService = (router.locationService = router.locationConfig = new _locationServices__WEBPACK_IMPORTED_MODULE_6__.Ng1LocationServices($locationProvider)); + _locationServices__WEBPACK_IMPORTED_MODULE_6__.Ng1LocationServices.monkeyPatchPathParameterType(router); + // backwards compat: also expose router instance as $uiRouterProvider.router + router['router'] = router; + router['$get'] = $get; + $get.$inject = ['$location', '$browser', '$window', '$sniffer', '$rootScope', '$http', '$templateCache']; + function $get($location, $browser, $window, $sniffer, $rootScope, $http, $templateCache) { + ng1LocationService._runtimeServices($rootScope, $location, $sniffer, $browser, $window); + delete router['router']; + delete router['$get']; + return router; + } + return router; +} +var getProviderFor = function (serviceName) { return [ + '$uiRouterProvider', + function ($urp) { + var service = $urp.router[serviceName]; + service['$get'] = function () { return service; }; + return service; + }, +]; }; +// This effectively calls $get() on `$uiRouterProvider` to trigger init (when ng enters runtime) +runBlock.$inject = ['$injector', '$q', '$uiRouter']; +function runBlock($injector, $q, $uiRouter) { + _uirouter_core__WEBPACK_IMPORTED_MODULE_1__.services.$injector = $injector; + _uirouter_core__WEBPACK_IMPORTED_MODULE_1__.services.$q = $q; + // https://github.com/angular-ui/ui-router/issues/3678 + if (!Object.prototype.hasOwnProperty.call($injector, 'strictDi')) { + try { + $injector.invoke(function (checkStrictDi) { }); + } + catch (error) { + $injector.strictDi = !!/strict mode/.exec(error && error.toString()); + } + } + // The $injector is now available. + // Find any resolvables that had dependency annotation deferred + $uiRouter.stateRegistry + .get() + .map(function (x) { return x.$$state().resolvables; }) + .reduce(_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.unnestR, []) + .filter(function (x) { return x.deps === 'deferred'; }) + .forEach(function (resolvable) { return (resolvable.deps = $injector.annotate(resolvable.resolveFn, $injector.strictDi)); }); +} +// $urlRouter service and $urlRouterProvider +var getUrlRouterProvider = function (uiRouter) { return (uiRouter.urlRouterProvider = new _urlRouterProvider__WEBPACK_IMPORTED_MODULE_7__.UrlRouterProvider(uiRouter)); }; +// $state service and $stateProvider +// $urlRouter service and $urlRouterProvider +var getStateProvider = function () { return (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.extend)(router.stateProvider, { $get: function () { return router.stateService; } }); }; +watchDigests.$inject = ['$rootScope']; +function watchDigests($rootScope) { + $rootScope.$watch(function () { + _uirouter_core__WEBPACK_IMPORTED_MODULE_1__.trace.approximateDigests++; + }); +} +mod_init.provider('$uiRouter', $uiRouterProvider); +mod_rtr.provider('$urlRouter', ['$uiRouterProvider', getUrlRouterProvider]); +mod_util.provider('$urlService', getProviderFor('urlService')); +mod_util.provider('$urlMatcherFactory', ['$uiRouterProvider', function () { return router.urlMatcherFactory; }]); +mod_util.provider('$templateFactory', function () { return new _templateFactory__WEBPACK_IMPORTED_MODULE_3__.TemplateFactory(); }); +mod_state.provider('$stateRegistry', getProviderFor('stateRegistry')); +mod_state.provider('$uiRouterGlobals', getProviderFor('globals')); +mod_state.provider('$transitions', getProviderFor('transitionService')); +mod_state.provider('$state', ['$uiRouterProvider', getStateProvider]); +mod_state.factory('$stateParams', ['$uiRouter', function ($uiRouter) { return $uiRouter.globals.params; }]); +mod_main.factory('$view', function () { return router.viewService; }); +mod_main.service('$trace', function () { return _uirouter_core__WEBPACK_IMPORTED_MODULE_1__.trace; }); +mod_main.run(watchDigests); +mod_util.run(['$urlMatcherFactory', function ($urlMatcherFactory) { }]); +mod_state.run(['$state', function ($state) { }]); +mod_rtr.run(['$urlRouter', function ($urlRouter) { }]); +mod_init.run(runBlock); +/** @hidden TODO: find a place to move this */ +var getLocals = function (ctx) { + var tokens = ctx.getTokens().filter(_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.isString); + var tuples = tokens.map(function (key) { + var resolvable = ctx.getResolvable(key); + var waitPolicy = ctx.getPolicy(resolvable).async; + return [key, waitPolicy === 'NOWAIT' ? resolvable.promise : resolvable.data]; + }); + return tuples.reduce(_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.applyPairs, {}); +}; +//# sourceMappingURL=services.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/angularjs/lib-esm/stateFilters.js": +/*!******************************************************************!*\ + !*** ./node_modules/@uirouter/angularjs/lib-esm/stateFilters.js ***! + \******************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "$IsStateFilter": () => (/* binding */ $IsStateFilter), +/* harmony export */ "$IncludedByStateFilter": () => (/* binding */ $IncludedByStateFilter) +/* harmony export */ }); +/* harmony import */ var _angular__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./angular */ "./node_modules/@uirouter/angularjs/lib-esm/angular.js"); +/** @publicapi @module ng1 */ /** */ + +/** + * `isState` Filter: truthy if the current state is the parameter + * + * Translates to [[StateService.is]] `$state.is("stateName")`. + * + * #### Example: + * ```html + *
    show if state is 'stateName'
    + * ``` + */ +$IsStateFilter.$inject = ['$state']; +function $IsStateFilter($state) { + var isFilter = function (state, params, options) { + return $state.is(state, params, options); + }; + isFilter.$stateful = true; + return isFilter; +} +/** + * `includedByState` Filter: truthy if the current state includes the parameter + * + * Translates to [[StateService.includes]]` $state.is("fullOrPartialStateName")`. + * + * #### Example: + * ```html + *
    show if state includes 'fullOrPartialStateName'
    + * ``` + */ +$IncludedByStateFilter.$inject = ['$state']; +function $IncludedByStateFilter($state) { + var includesFilter = function (state, params, options) { + return $state.includes(state, params, options); + }; + includesFilter.$stateful = true; + return includesFilter; +} +_angular__WEBPACK_IMPORTED_MODULE_0__.ng.module('ui.router.state').filter('isState', $IsStateFilter).filter('includedByState', $IncludedByStateFilter); + +//# sourceMappingURL=stateFilters.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/angularjs/lib-esm/stateProvider.js": +/*!*******************************************************************!*\ + !*** ./node_modules/@uirouter/angularjs/lib-esm/stateProvider.js ***! + \*******************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "StateProvider": () => (/* binding */ StateProvider) +/* harmony export */ }); +/* harmony import */ var _uirouter_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @uirouter/core */ "./node_modules/@uirouter/core/lib-esm/index.js"); +/** @publicapi @module ng1 */ /** */ + +/** + * The Angular 1 `StateProvider` + * + * The `$stateProvider` works similar to Angular's v1 router, but it focuses purely + * on state. + * + * A state corresponds to a "place" in the application in terms of the overall UI and + * navigation. A state describes (via the controller / template / view properties) what + * the UI looks like and does at that place. + * + * States often have things in common, and the primary way of factoring out these + * commonalities in this model is via the state hierarchy, i.e. parent/child states aka + * nested states. + * + * The `$stateProvider` provides interfaces to declare these states for your app. + */ +var StateProvider = /** @class */ (function () { + function StateProvider(stateRegistry, stateService) { + this.stateRegistry = stateRegistry; + this.stateService = stateService; + (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.createProxyFunctions)((0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.val)(StateProvider.prototype), this, (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.val)(this)); + } + /** + * Decorates states when they are registered + * + * Allows you to extend (carefully) or override (at your own peril) the + * `stateBuilder` object used internally by [[StateRegistry]]. + * This can be used to add custom functionality to ui-router, + * for example inferring templateUrl based on the state name. + * + * When passing only a name, it returns the current (original or decorated) builder + * function that matches `name`. + * + * The builder functions that can be decorated are listed below. Though not all + * necessarily have a good use case for decoration, that is up to you to decide. + * + * In addition, users can attach custom decorators, which will generate new + * properties within the state's internal definition. There is currently no clear + * use-case for this beyond accessing internal states (i.e. $state.$current), + * however, expect this to become increasingly relevant as we introduce additional + * meta-programming features. + * + * **Warning**: Decorators should not be interdependent because the order of + * execution of the builder functions in non-deterministic. Builder functions + * should only be dependent on the state definition object and super function. + * + * + * Existing builder functions and current return values: + * + * - **parent** `{object}` - returns the parent state object. + * - **data** `{object}` - returns state data, including any inherited data that is not + * overridden by own values (if any). + * - **url** `{object}` - returns a {@link ui.router.util.type:UrlMatcher UrlMatcher} + * or `null`. + * - **navigable** `{object}` - returns closest ancestor state that has a URL (aka is + * navigable). + * - **params** `{object}` - returns an array of state params that are ensured to + * be a super-set of parent's params. + * - **views** `{object}` - returns a views object where each key is an absolute view + * name (i.e. "viewName@stateName") and each value is the config object + * (template, controller) for the view. Even when you don't use the views object + * explicitly on a state config, one is still created for you internally. + * So by decorating this builder function you have access to decorating template + * and controller properties. + * - **ownParams** `{object}` - returns an array of params that belong to the state, + * not including any params defined by ancestor states. + * - **path** `{string}` - returns the full path from the root down to this state. + * Needed for state activation. + * - **includes** `{object}` - returns an object that includes every state that + * would pass a `$state.includes()` test. + * + * #### Example: + * Override the internal 'views' builder with a function that takes the state + * definition, and a reference to the internal function being overridden: + * ```js + * $stateProvider.decorator('views', function (state, parent) { + * let result = {}, + * views = parent(state); + * + * angular.forEach(views, function (config, name) { + * let autoName = (state.name + '.' + name).replace('.', '/'); + * config.templateUrl = config.templateUrl || '/partials/' + autoName + '.html'; + * result[name] = config; + * }); + * return result; + * }); + * + * $stateProvider.state('home', { + * views: { + * 'contact.list': { controller: 'ListController' }, + * 'contact.item': { controller: 'ItemController' } + * } + * }); + * ``` + * + * + * ```js + * // Auto-populates list and item views with /partials/home/contact/list.html, + * // and /partials/home/contact/item.html, respectively. + * $state.go('home'); + * ``` + * + * @param {string} name The name of the builder function to decorate. + * @param {object} func A function that is responsible for decorating the original + * builder function. The function receives two parameters: + * + * - `{object}` - state - The state config object. + * - `{object}` - super - The original builder function. + * + * @return {object} $stateProvider - $stateProvider instance + */ + StateProvider.prototype.decorator = function (name, func) { + return this.stateRegistry.decorator(name, func) || this; + }; + StateProvider.prototype.state = function (name, definition) { + if ((0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.isObject)(name)) { + definition = name; + } + else { + definition.name = name; + } + this.stateRegistry.register(definition); + return this; + }; + /** + * Registers an invalid state handler + * + * This is a passthrough to [[StateService.onInvalid]] for ng1. + */ + StateProvider.prototype.onInvalid = function (callback) { + return this.stateService.onInvalid(callback); + }; + return StateProvider; +}()); + +//# sourceMappingURL=stateProvider.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/angularjs/lib-esm/statebuilders/onEnterExitRetain.js": +/*!*************************************************************************************!*\ + !*** ./node_modules/@uirouter/angularjs/lib-esm/statebuilders/onEnterExitRetain.js ***! + \*************************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "getStateHookBuilder": () => (/* binding */ getStateHookBuilder) +/* harmony export */ }); +/* harmony import */ var _uirouter_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @uirouter/core */ "./node_modules/@uirouter/core/lib-esm/index.js"); +/* harmony import */ var _services__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../services */ "./node_modules/@uirouter/angularjs/lib-esm/services.js"); +/** @publicapi @module ng1 */ /** */ + + +/** + * This is a [[StateBuilder.builder]] function for angular1 `onEnter`, `onExit`, + * `onRetain` callback hooks on a [[Ng1StateDeclaration]]. + * + * When the [[StateBuilder]] builds a [[StateObject]] object from a raw [[StateDeclaration]], this builder + * ensures that those hooks are injectable for @uirouter/angularjs (ng1). + * + * @internalapi + */ +var getStateHookBuilder = function (hookName) { + return function stateHookBuilder(stateObject) { + var hook = stateObject[hookName]; + var pathname = hookName === 'onExit' ? 'from' : 'to'; + function decoratedNg1Hook(trans, state) { + var resolveContext = new _uirouter_core__WEBPACK_IMPORTED_MODULE_0__.ResolveContext(trans.treeChanges(pathname)); + var subContext = resolveContext.subContext(state.$$state()); + var locals = (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.extend)((0,_services__WEBPACK_IMPORTED_MODULE_1__.getLocals)(subContext), { $state$: state, $transition$: trans }); + return _uirouter_core__WEBPACK_IMPORTED_MODULE_0__.services.$injector.invoke(hook, this, locals); + } + return hook ? decoratedNg1Hook : undefined; + }; +}; +//# sourceMappingURL=onEnterExitRetain.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/angularjs/lib-esm/statebuilders/views.js": +/*!*************************************************************************!*\ + !*** ./node_modules/@uirouter/angularjs/lib-esm/statebuilders/views.js ***! + \*************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "getNg1ViewConfigFactory": () => (/* binding */ getNg1ViewConfigFactory), +/* harmony export */ "ng1ViewsBuilder": () => (/* binding */ ng1ViewsBuilder), +/* harmony export */ "Ng1ViewConfig": () => (/* binding */ Ng1ViewConfig) +/* harmony export */ }); +/* harmony import */ var _uirouter_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @uirouter/core */ "./node_modules/@uirouter/core/lib-esm/index.js"); +/** @publicapi @module ng1 */ /** */ + +/** @internalapi */ +function getNg1ViewConfigFactory() { + var templateFactory = null; + return function (path, view) { + templateFactory = templateFactory || _uirouter_core__WEBPACK_IMPORTED_MODULE_0__.services.$injector.get('$templateFactory'); + return [new Ng1ViewConfig(path, view, templateFactory)]; + }; +} +/** @internalapi */ +var hasAnyKey = function (keys, obj) { return keys.reduce(function (acc, key) { return acc || (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.isDefined)(obj[key]); }, false); }; +/** + * This is a [[StateBuilder.builder]] function for angular1 `views`. + * + * When the [[StateBuilder]] builds a [[StateObject]] object from a raw [[StateDeclaration]], this builder + * handles the `views` property with logic specific to @uirouter/angularjs (ng1). + * + * If no `views: {}` property exists on the [[StateDeclaration]], then it creates the `views` object + * and applies the state-level configuration to a view named `$default`. + * + * @internalapi + */ +function ng1ViewsBuilder(state) { + // Do not process root state + if (!state.parent) + return {}; + var tplKeys = ['templateProvider', 'templateUrl', 'template', 'notify', 'async'], ctrlKeys = ['controller', 'controllerProvider', 'controllerAs', 'resolveAs'], compKeys = ['component', 'bindings', 'componentProvider'], nonCompKeys = tplKeys.concat(ctrlKeys), allViewKeys = compKeys.concat(nonCompKeys); + // Do not allow a state to have both state-level props and also a `views: {}` property. + // A state without a `views: {}` property can declare properties for the `$default` view as properties of the state. + // However, the `$default` approach should not be mixed with a separate `views: ` block. + if ((0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.isDefined)(state.views) && hasAnyKey(allViewKeys, state)) { + throw new Error("State '" + state.name + "' has a 'views' object. " + + "It cannot also have \"view properties\" at the state level. " + + "Move the following properties into a view (in the 'views' object): " + + (" " + allViewKeys.filter(function (key) { return (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.isDefined)(state[key]); }).join(', '))); + } + var views = {}, viewsObject = state.views || { $default: (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.pick)(state, allViewKeys) }; + (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.forEach)(viewsObject, function (config, name) { + // Account for views: { "": { template... } } + name = name || '$default'; + // Account for views: { header: "headerComponent" } + if ((0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.isString)(config)) + config = { component: config }; + // Make a shallow copy of the config object + config = (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.extend)({}, config); + // Do not allow a view to mix props for component-style view with props for template/controller-style view + if (hasAnyKey(compKeys, config) && hasAnyKey(nonCompKeys, config)) { + throw new Error("Cannot combine: " + compKeys.join('|') + " with: " + nonCompKeys.join('|') + " in stateview: '" + name + "@" + state.name + "'"); + } + config.resolveAs = config.resolveAs || '$resolve'; + config.$type = 'ng1'; + config.$context = state; + config.$name = name; + var normalized = _uirouter_core__WEBPACK_IMPORTED_MODULE_0__.ViewService.normalizeUIViewTarget(config.$context, config.$name); + config.$uiViewName = normalized.uiViewName; + config.$uiViewContextAnchor = normalized.uiViewContextAnchor; + views[name] = config; + }); + return views; +} +/** @hidden */ +var id = 0; +/** @internalapi */ +var Ng1ViewConfig = /** @class */ (function () { + function Ng1ViewConfig(path, viewDecl, factory) { + var _this = this; + this.path = path; + this.viewDecl = viewDecl; + this.factory = factory; + this.$id = id++; + this.loaded = false; + this.getTemplate = function (uiView, context) { + return _this.component + ? _this.factory.makeComponentTemplate(uiView, context, _this.component, _this.viewDecl.bindings) + : _this.template; + }; + } + Ng1ViewConfig.prototype.load = function () { + var _this = this; + var $q = _uirouter_core__WEBPACK_IMPORTED_MODULE_0__.services.$q; + var context = new _uirouter_core__WEBPACK_IMPORTED_MODULE_0__.ResolveContext(this.path); + var params = this.path.reduce(function (acc, node) { return (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.extend)(acc, node.paramValues); }, {}); + var promises = { + template: $q.when(this.factory.fromConfig(this.viewDecl, params, context)), + controller: $q.when(this.getController(context)), + }; + return $q.all(promises).then(function (results) { + _uirouter_core__WEBPACK_IMPORTED_MODULE_0__.trace.traceViewServiceEvent('Loaded', _this); + _this.controller = results.controller; + (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.extend)(_this, results.template); // Either { template: "tpl" } or { component: "cmpName" } + return _this; + }); + }; + /** + * Gets the controller for a view configuration. + * + * @returns {Function|Promise.} Returns a controller, or a promise that resolves to a controller. + */ + Ng1ViewConfig.prototype.getController = function (context) { + var provider = this.viewDecl.controllerProvider; + if (!(0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.isInjectable)(provider)) + return this.viewDecl.controller; + var deps = _uirouter_core__WEBPACK_IMPORTED_MODULE_0__.services.$injector.annotate(provider); + var providerFn = (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.isArray)(provider) ? (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.tail)(provider) : provider; + var resolvable = new _uirouter_core__WEBPACK_IMPORTED_MODULE_0__.Resolvable('', providerFn, deps); + return resolvable.get(context); + }; + return Ng1ViewConfig; +}()); + +//# sourceMappingURL=views.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/angularjs/lib-esm/templateFactory.js": +/*!*********************************************************************!*\ + !*** ./node_modules/@uirouter/angularjs/lib-esm/templateFactory.js ***! + \*********************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "TemplateFactory": () => (/* binding */ TemplateFactory) +/* harmony export */ }); +/* harmony import */ var _angular__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./angular */ "./node_modules/@uirouter/angularjs/lib-esm/angular.js"); +/* harmony import */ var _uirouter_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @uirouter/core */ "./node_modules/@uirouter/core/lib-esm/index.js"); +/** @publicapi @module view */ /** */ + + +/** + * Service which manages loading of templates from a ViewConfig. + */ +var TemplateFactory = /** @class */ (function () { + function TemplateFactory() { + var _this = this; + /** @hidden */ this._useHttp = _angular__WEBPACK_IMPORTED_MODULE_0__.ng.version.minor < 3; + /** @hidden */ this.$get = [ + '$http', + '$templateCache', + '$injector', + function ($http, $templateCache, $injector) { + _this.$templateRequest = $injector.has && $injector.has('$templateRequest') && $injector.get('$templateRequest'); + _this.$http = $http; + _this.$templateCache = $templateCache; + return _this; + }, + ]; + } + /** @hidden */ + TemplateFactory.prototype.useHttpService = function (value) { + this._useHttp = value; + }; + /** + * Creates a template from a configuration object. + * + * @param config Configuration object for which to load a template. + * The following properties are search in the specified order, and the first one + * that is defined is used to create the template: + * + * @param params Parameters to pass to the template function. + * @param context The resolve context associated with the template's view + * + * @return {string|object} The template html as a string, or a promise for + * that string,or `null` if no template is configured. + */ + TemplateFactory.prototype.fromConfig = function (config, params, context) { + var defaultTemplate = ''; + var asTemplate = function (result) { return _uirouter_core__WEBPACK_IMPORTED_MODULE_1__.services.$q.when(result).then(function (str) { return ({ template: str }); }); }; + var asComponent = function (result) { return _uirouter_core__WEBPACK_IMPORTED_MODULE_1__.services.$q.when(result).then(function (str) { return ({ component: str }); }); }; + return (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.isDefined)(config.template) + ? asTemplate(this.fromString(config.template, params)) + : (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.isDefined)(config.templateUrl) + ? asTemplate(this.fromUrl(config.templateUrl, params)) + : (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.isDefined)(config.templateProvider) + ? asTemplate(this.fromProvider(config.templateProvider, params, context)) + : (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.isDefined)(config.component) + ? asComponent(config.component) + : (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.isDefined)(config.componentProvider) + ? asComponent(this.fromComponentProvider(config.componentProvider, params, context)) + : asTemplate(defaultTemplate); + }; + /** + * Creates a template from a string or a function returning a string. + * + * @param template html template as a string or function that returns an html template as a string. + * @param params Parameters to pass to the template function. + * + * @return {string|object} The template html as a string, or a promise for that + * string. + */ + TemplateFactory.prototype.fromString = function (template, params) { + return (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.isFunction)(template) ? template(params) : template; + }; + /** + * Loads a template from the a URL via `$http` and `$templateCache`. + * + * @param {string|Function} url url of the template to load, or a function + * that returns a url. + * @param {Object} params Parameters to pass to the url function. + * @return {string|Promise.} The template html as a string, or a promise + * for that string. + */ + TemplateFactory.prototype.fromUrl = function (url, params) { + if ((0,_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.isFunction)(url)) + url = url(params); + if (url == null) + return null; + if (this._useHttp) { + return this.$http + .get(url, { cache: this.$templateCache, headers: { Accept: 'text/html' } }) + .then(function (response) { + return response.data; + }); + } + return this.$templateRequest(url); + }; + /** + * Creates a template by invoking an injectable provider function. + * + * @param provider Function to invoke via `locals` + * @param {Function} injectFn a function used to invoke the template provider + * @return {string|Promise.} The template html as a string, or a promise + * for that string. + */ + TemplateFactory.prototype.fromProvider = function (provider, params, context) { + var deps = _uirouter_core__WEBPACK_IMPORTED_MODULE_1__.services.$injector.annotate(provider); + var providerFn = (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.isArray)(provider) ? (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.tail)(provider) : provider; + var resolvable = new _uirouter_core__WEBPACK_IMPORTED_MODULE_1__.Resolvable('', providerFn, deps); + return resolvable.get(context); + }; + /** + * Creates a component's template by invoking an injectable provider function. + * + * @param provider Function to invoke via `locals` + * @param {Function} injectFn a function used to invoke the template provider + * @return {string} The template html as a string: "". + */ + TemplateFactory.prototype.fromComponentProvider = function (provider, params, context) { + var deps = _uirouter_core__WEBPACK_IMPORTED_MODULE_1__.services.$injector.annotate(provider); + var providerFn = (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.isArray)(provider) ? (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.tail)(provider) : provider; + var resolvable = new _uirouter_core__WEBPACK_IMPORTED_MODULE_1__.Resolvable('', providerFn, deps); + return resolvable.get(context); + }; + /** + * Creates a template from a component's name + * + * This implements route-to-component. + * It works by retrieving the component (directive) metadata from the injector. + * It analyses the component's bindings, then constructs a template that instantiates the component. + * The template wires input and output bindings to resolves or from the parent component. + * + * @param uiView {object} The parent ui-view (for binding outputs to callbacks) + * @param context The ResolveContext (for binding outputs to callbacks returned from resolves) + * @param component {string} Component's name in camel case. + * @param bindings An object defining the component's bindings: {foo: '<'} + * @return {string} The template as a string: "". + */ + TemplateFactory.prototype.makeComponentTemplate = function (uiView, context, component, bindings) { + bindings = bindings || {}; + // Bind once prefix + var prefix = _angular__WEBPACK_IMPORTED_MODULE_0__.ng.version.minor >= 3 ? '::' : ''; + // Convert to kebob name. Add x- prefix if the string starts with `x-` or `data-` + var kebob = function (camelCase) { + var kebobed = (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.kebobString)(camelCase); + return /^(x|data)-/.exec(kebobed) ? "x-" + kebobed : kebobed; + }; + var attributeTpl = function (input) { + var name = input.name, type = input.type; + var attrName = kebob(name); + // If the ui-view has an attribute which matches a binding on the routed component + // then pass that attribute through to the routed component template. + // Prefer ui-view wired mappings to resolve data, unless the resolve was explicitly bound using `bindings:` + if (uiView.attr(attrName) && !bindings[name]) + return attrName + "='" + uiView.attr(attrName) + "'"; + var resolveName = bindings[name] || name; + // Pre-evaluate the expression for "@" bindings by enclosing in {{ }} + // some-attr="{{ ::$resolve.someResolveName }}" + if (type === '@') + return attrName + "='{{" + prefix + "$resolve." + resolveName + "}}'"; + // Wire "&" callbacks to resolves that return a callback function + // Get the result of the resolve (should be a function) and annotate it to get its arguments. + // some-attr="$resolve.someResolveResultName(foo, bar)" + if (type === '&') { + var res = context.getResolvable(resolveName); + var fn = res && res.data; + var args = (fn && _uirouter_core__WEBPACK_IMPORTED_MODULE_1__.services.$injector.annotate(fn)) || []; + // account for array style injection, i.e., ['foo', function(foo) {}] + var arrayIdxStr = (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.isArray)(fn) ? "[" + (fn.length - 1) + "]" : ''; + return attrName + "='$resolve." + resolveName + arrayIdxStr + "(" + args.join(',') + ")'"; + } + // some-attr="::$resolve.someResolveName" + return attrName + "='" + prefix + "$resolve." + resolveName + "'"; + }; + var attrs = getComponentBindings(component).map(attributeTpl).join(' '); + var kebobName = kebob(component); + return "<" + kebobName + " " + attrs + ">"; + }; + return TemplateFactory; +}()); + +// Gets all the directive(s)' inputs ('@', '=', and '<') and outputs ('&') +function getComponentBindings(name) { + var cmpDefs = _uirouter_core__WEBPACK_IMPORTED_MODULE_1__.services.$injector.get(name + 'Directive'); // could be multiple + if (!cmpDefs || !cmpDefs.length) + throw new Error("Unable to find component named '" + name + "'"); + return cmpDefs.map(getBindings).reduce(_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.unnestR, []); +} +// Given a directive definition, find its object input attributes +// Use different properties, depending on the type of directive (component, bindToController, normal) +var getBindings = function (def) { + if ((0,_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.isObject)(def.bindToController)) + return scopeBindings(def.bindToController); + return scopeBindings(def.scope); +}; +// for ng 1.2 style, process the scope: { input: "=foo" } +// for ng 1.3 through ng 1.5, process the component's bindToController: { input: "=foo" } object +var scopeBindings = function (bindingsObj) { + return Object.keys(bindingsObj || {}) + // [ 'input', [ '=foo', '=', 'foo' ] ] + .map(function (key) { return [key, /^([=<@&])[?]?(.*)/.exec(bindingsObj[key])]; }) + // skip malformed values + .filter(function (tuple) { return (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.isDefined)(tuple) && (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.isArray)(tuple[1]); }) + // { name: ('foo' || 'input'), type: '=' } + .map(function (tuple) { return ({ name: tuple[1][2] || tuple[0], type: tuple[1][1] }); }); +}; +//# sourceMappingURL=templateFactory.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/angularjs/lib-esm/urlRouterProvider.js": +/*!***********************************************************************!*\ + !*** ./node_modules/@uirouter/angularjs/lib-esm/urlRouterProvider.js ***! + \***********************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "UrlRouterProvider": () => (/* binding */ UrlRouterProvider) +/* harmony export */ }); +/* harmony import */ var _uirouter_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @uirouter/core */ "./node_modules/@uirouter/core/lib-esm/index.js"); +/** @publicapi @module url */ /** */ + + +/** + * Manages rules for client-side URL + * + * ### Deprecation warning: + * This class is now considered to be an internal API + * Use the [[UrlService]] instead. + * For configuring URL rules, use the [[UrlRulesApi]] which can be found as [[UrlService.rules]]. + * + * This class manages the router rules for what to do when the URL changes. + * + * This provider remains for backwards compatibility. + * + * @internalapi + * @deprecated + */ +var UrlRouterProvider = /** @class */ (function () { + /** @hidden */ + function UrlRouterProvider(/** @hidden */ router) { + this.router = router; + } + UrlRouterProvider.injectableHandler = function (router, handler) { + return function (match) { return _uirouter_core__WEBPACK_IMPORTED_MODULE_0__.services.$injector.invoke(handler, null, { $match: match, $stateParams: router.globals.params }); }; + }; + /** @hidden */ + UrlRouterProvider.prototype.$get = function () { + var urlService = this.router.urlService; + this.router.urlRouter.update(true); + if (!urlService.interceptDeferred) + urlService.listen(); + return this.router.urlRouter; + }; + /** + * Registers a url handler function. + * + * Registers a low level url handler (a `rule`). + * A rule detects specific URL patterns and returns a redirect, or performs some action. + * + * If a rule returns a string, the URL is replaced with the string, and all rules are fired again. + * + * #### Example: + * ```js + * var app = angular.module('app', ['ui.router.router']); + * + * app.config(function ($urlRouterProvider) { + * // Here's an example of how you might allow case insensitive urls + * $urlRouterProvider.rule(function ($injector, $location) { + * var path = $location.path(), + * normalized = path.toLowerCase(); + * + * if (path !== normalized) { + * return normalized; + * } + * }); + * }); + * ``` + * + * @param ruleFn + * Handler function that takes `$injector` and `$location` services as arguments. + * You can use them to detect a url and return a different url as a string. + * + * @return [[UrlRouterProvider]] (`this`) + */ + UrlRouterProvider.prototype.rule = function (ruleFn) { + var _this = this; + if (!(0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.isFunction)(ruleFn)) + throw new Error("'rule' must be a function"); + var match = function () { return ruleFn(_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.services.$injector, _this.router.locationService); }; + var rule = new _uirouter_core__WEBPACK_IMPORTED_MODULE_0__.BaseUrlRule(match, _uirouter_core__WEBPACK_IMPORTED_MODULE_0__.identity); + this.router.urlService.rules.rule(rule); + return this; + }; + /** + * Defines the path or behavior to use when no url can be matched. + * + * #### Example: + * ```js + * var app = angular.module('app', ['ui.router.router']); + * + * app.config(function ($urlRouterProvider) { + * // if the path doesn't match any of the urls you configured + * // otherwise will take care of routing the user to the + * // specified url + * $urlRouterProvider.otherwise('/index'); + * + * // Example of using function rule as param + * $urlRouterProvider.otherwise(function ($injector, $location) { + * return '/a/valid/url'; + * }); + * }); + * ``` + * + * @param rule + * The url path you want to redirect to or a function rule that returns the url path or performs a `$state.go()`. + * The function version is passed two params: `$injector` and `$location` services, and should return a url string. + * + * @return {object} `$urlRouterProvider` - `$urlRouterProvider` instance + */ + UrlRouterProvider.prototype.otherwise = function (rule) { + var _this = this; + var urlRules = this.router.urlService.rules; + if ((0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.isString)(rule)) { + urlRules.otherwise(rule); + } + else if ((0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.isFunction)(rule)) { + urlRules.otherwise(function () { return rule(_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.services.$injector, _this.router.locationService); }); + } + else { + throw new Error("'rule' must be a string or function"); + } + return this; + }; + /** + * Registers a handler for a given url matching. + * + * If the handler is a string, it is + * treated as a redirect, and is interpolated according to the syntax of match + * (i.e. like `String.replace()` for `RegExp`, or like a `UrlMatcher` pattern otherwise). + * + * If the handler is a function, it is injectable. + * It gets invoked if `$location` matches. + * You have the option of inject the match object as `$match`. + * + * The handler can return + * + * - **falsy** to indicate that the rule didn't match after all, then `$urlRouter` + * will continue trying to find another one that matches. + * - **string** which is treated as a redirect and passed to `$location.url()` + * - **void** or any **truthy** value tells `$urlRouter` that the url was handled. + * + * #### Example: + * ```js + * var app = angular.module('app', ['ui.router.router']); + * + * app.config(function ($urlRouterProvider) { + * $urlRouterProvider.when($state.url, function ($match, $stateParams) { + * if ($state.$current.navigable !== state || + * !equalForKeys($match, $stateParams) { + * $state.transitionTo(state, $match, false); + * } + * }); + * }); + * ``` + * + * @param what A pattern string to match, compiled as a [[UrlMatcher]]. + * @param handler The path (or function that returns a path) that you want to redirect your user to. + * @param ruleCallback [optional] A callback that receives the `rule` registered with [[UrlMatcher.rule]] + * + * Note: the handler may also invoke arbitrary code, such as `$state.go()` + */ + UrlRouterProvider.prototype.when = function (what, handler) { + if ((0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.isArray)(handler) || (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.isFunction)(handler)) { + handler = UrlRouterProvider.injectableHandler(this.router, handler); + } + this.router.urlService.rules.when(what, handler); + return this; + }; + /** + * Disables monitoring of the URL. + * + * Call this method before UI-Router has bootstrapped. + * It will stop UI-Router from performing the initial url sync. + * + * This can be useful to perform some asynchronous initialization before the router starts. + * Once the initialization is complete, call [[listen]] to tell UI-Router to start watching and synchronizing the URL. + * + * #### Example: + * ```js + * var app = angular.module('app', ['ui.router']); + * + * app.config(function ($urlRouterProvider) { + * // Prevent $urlRouter from automatically intercepting URL changes; + * $urlRouterProvider.deferIntercept(); + * }) + * + * app.run(function (MyService, $urlRouter, $http) { + * $http.get("/stuff").then(function(resp) { + * MyService.doStuff(resp.data); + * $urlRouter.listen(); + * $urlRouter.sync(); + * }); + * }); + * ``` + * + * @param defer Indicates whether to defer location change interception. + * Passing no parameter is equivalent to `true`. + */ + UrlRouterProvider.prototype.deferIntercept = function (defer) { + this.router.urlService.deferIntercept(defer); + }; + return UrlRouterProvider; +}()); + +//# sourceMappingURL=urlRouterProvider.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/angularjs/lib-esm/viewScroll.js": +/*!****************************************************************!*\ + !*** ./node_modules/@uirouter/angularjs/lib-esm/viewScroll.js ***! + \****************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony import */ var _angular__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./angular */ "./node_modules/@uirouter/angularjs/lib-esm/angular.js"); +/** @publicapi @module ng1 */ /** */ + +/** @hidden */ +function $ViewScrollProvider() { + var useAnchorScroll = false; + this.useAnchorScroll = function () { + useAnchorScroll = true; + }; + this.$get = [ + '$anchorScroll', + '$timeout', + function ($anchorScroll, $timeout) { + if (useAnchorScroll) { + return $anchorScroll; + } + return function ($element) { + return $timeout(function () { + $element[0].scrollIntoView(); + }, 0, false); + }; + }, + ]; +} +_angular__WEBPACK_IMPORTED_MODULE_0__.ng.module('ui.router.state').provider('$uiViewScroll', $ViewScrollProvider); +//# sourceMappingURL=viewScroll.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/common/common.js": +/*!**************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/common/common.js ***! + \**************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "root": () => (/* binding */ root), +/* harmony export */ "fromJson": () => (/* binding */ fromJson), +/* harmony export */ "toJson": () => (/* binding */ toJson), +/* harmony export */ "forEach": () => (/* binding */ forEach), +/* harmony export */ "extend": () => (/* binding */ extend), +/* harmony export */ "equals": () => (/* binding */ equals), +/* harmony export */ "identity": () => (/* binding */ identity), +/* harmony export */ "noop": () => (/* binding */ noop), +/* harmony export */ "createProxyFunctions": () => (/* binding */ createProxyFunctions), +/* harmony export */ "inherit": () => (/* binding */ inherit), +/* harmony export */ "inArray": () => (/* binding */ inArray), +/* harmony export */ "_inArray": () => (/* binding */ _inArray), +/* harmony export */ "removeFrom": () => (/* binding */ removeFrom), +/* harmony export */ "_removeFrom": () => (/* binding */ _removeFrom), +/* harmony export */ "pushTo": () => (/* binding */ pushTo), +/* harmony export */ "_pushTo": () => (/* binding */ _pushTo), +/* harmony export */ "deregAll": () => (/* binding */ deregAll), +/* harmony export */ "defaults": () => (/* binding */ defaults), +/* harmony export */ "mergeR": () => (/* binding */ mergeR), +/* harmony export */ "ancestors": () => (/* binding */ ancestors), +/* harmony export */ "pick": () => (/* binding */ pick), +/* harmony export */ "omit": () => (/* binding */ omit), +/* harmony export */ "pluck": () => (/* binding */ pluck), +/* harmony export */ "filter": () => (/* binding */ filter), +/* harmony export */ "find": () => (/* binding */ find), +/* harmony export */ "mapObj": () => (/* binding */ mapObj), +/* harmony export */ "map": () => (/* binding */ map), +/* harmony export */ "values": () => (/* binding */ values), +/* harmony export */ "allTrueR": () => (/* binding */ allTrueR), +/* harmony export */ "anyTrueR": () => (/* binding */ anyTrueR), +/* harmony export */ "unnestR": () => (/* binding */ unnestR), +/* harmony export */ "flattenR": () => (/* binding */ flattenR), +/* harmony export */ "pushR": () => (/* binding */ pushR), +/* harmony export */ "uniqR": () => (/* binding */ uniqR), +/* harmony export */ "unnest": () => (/* binding */ unnest), +/* harmony export */ "flatten": () => (/* binding */ flatten), +/* harmony export */ "assertPredicate": () => (/* binding */ assertPredicate), +/* harmony export */ "assertMap": () => (/* binding */ assertMap), +/* harmony export */ "assertFn": () => (/* binding */ assertFn), +/* harmony export */ "pairs": () => (/* binding */ pairs), +/* harmony export */ "arrayTuples": () => (/* binding */ arrayTuples), +/* harmony export */ "applyPairs": () => (/* binding */ applyPairs), +/* harmony export */ "tail": () => (/* binding */ tail), +/* harmony export */ "copy": () => (/* binding */ copy), +/* harmony export */ "_extend": () => (/* binding */ _extend), +/* harmony export */ "silenceUncaughtInPromise": () => (/* binding */ silenceUncaughtInPromise), +/* harmony export */ "silentRejection": () => (/* binding */ silentRejection) +/* harmony export */ }); +/* harmony import */ var _predicates__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./predicates */ "./node_modules/@uirouter/core/lib-esm/common/predicates.js"); +/* harmony import */ var _hof__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./hof */ "./node_modules/@uirouter/core/lib-esm/common/hof.js"); +/* harmony import */ var _coreservices__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./coreservices */ "./node_modules/@uirouter/core/lib-esm/common/coreservices.js"); +var __spreadArrays = (undefined && undefined.__spreadArrays) || function () { + for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; + for (var r = Array(s), k = 0, i = 0; i < il; i++) + for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) + r[k] = a[j]; + return r; +}; +/** + * Random utility functions used in the UI-Router code + * + * These functions are exported, but are subject to change without notice. + * + * @packageDocumentation + * @preferred + */ + + + +var root = (typeof self === 'object' && self.self === self && self) || + (typeof __webpack_require__.g === 'object' && __webpack_require__.g.global === __webpack_require__.g && __webpack_require__.g) || + undefined; +var angular = root.angular || {}; +var fromJson = angular.fromJson || JSON.parse.bind(JSON); +var toJson = angular.toJson || JSON.stringify.bind(JSON); +var forEach = angular.forEach || _forEach; +var extend = Object.assign || _extend; +var equals = angular.equals || _equals; +function identity(x) { + return x; +} +function noop() { } +/** + * Builds proxy functions on the `to` object which pass through to the `from` object. + * + * For each key in `fnNames`, creates a proxy function on the `to` object. + * The proxy function calls the real function on the `from` object. + * + * + * #### Example: + * This example creates an new class instance whose functions are prebound to the new'd object. + * ```js + * class Foo { + * constructor(data) { + * // Binds all functions from Foo.prototype to 'this', + * // then copies them to 'this' + * bindFunctions(Foo.prototype, this, this); + * this.data = data; + * } + * + * log() { + * console.log(this.data); + * } + * } + * + * let myFoo = new Foo([1,2,3]); + * var logit = myFoo.log; + * logit(); // logs [1, 2, 3] from the myFoo 'this' instance + * ``` + * + * #### Example: + * This example creates a bound version of a service function, and copies it to another object + * ``` + * + * var SomeService = { + * this.data = [3, 4, 5]; + * this.log = function() { + * console.log(this.data); + * } + * } + * + * // Constructor fn + * function OtherThing() { + * // Binds all functions from SomeService to SomeService, + * // then copies them to 'this' + * bindFunctions(SomeService, this, SomeService); + * } + * + * let myOtherThing = new OtherThing(); + * myOtherThing.log(); // logs [3, 4, 5] from SomeService's 'this' + * ``` + * + * @param source A function that returns the source object which contains the original functions to be bound + * @param target A function that returns the target object which will receive the bound functions + * @param bind A function that returns the object which the functions will be bound to + * @param fnNames The function names which will be bound (Defaults to all the functions found on the 'from' object) + * @param latebind If true, the binding of the function is delayed until the first time it's invoked + */ +function createProxyFunctions(source, target, bind, fnNames, latebind) { + if (latebind === void 0) { latebind = false; } + var bindFunction = function (fnName) { return source()[fnName].bind(bind()); }; + var makeLateRebindFn = function (fnName) { + return function lateRebindFunction() { + target[fnName] = bindFunction(fnName); + return target[fnName].apply(null, arguments); + }; + }; + fnNames = fnNames || Object.keys(source()); + return fnNames.reduce(function (acc, name) { + acc[name] = latebind ? makeLateRebindFn(name) : bindFunction(name); + return acc; + }, target); +} +/** + * prototypal inheritance helper. + * Creates a new object which has `parent` object as its prototype, and then copies the properties from `extra` onto it + */ +var inherit = function (parent, extra) { return extend(Object.create(parent), extra); }; +/** Given an array, returns true if the object is found in the array, (using indexOf) */ +var inArray = (0,_hof__WEBPACK_IMPORTED_MODULE_1__.curry)(_inArray); +function _inArray(array, obj) { + return array.indexOf(obj) !== -1; +} +/** + * Given an array, and an item, if the item is found in the array, it removes it (in-place). + * The same array is returned + */ +var removeFrom = (0,_hof__WEBPACK_IMPORTED_MODULE_1__.curry)(_removeFrom); +function _removeFrom(array, obj) { + var idx = array.indexOf(obj); + if (idx >= 0) + array.splice(idx, 1); + return array; +} +/** pushes a values to an array and returns the value */ +var pushTo = (0,_hof__WEBPACK_IMPORTED_MODULE_1__.curry)(_pushTo); +function _pushTo(arr, val) { + return arr.push(val), val; +} +/** Given an array of (deregistration) functions, calls all functions and removes each one from the source array */ +var deregAll = function (functions) { + return functions.slice().forEach(function (fn) { + typeof fn === 'function' && fn(); + removeFrom(functions, fn); + }); +}; +/** + * Applies a set of defaults to an options object. The options object is filtered + * to only those properties of the objects in the defaultsList. + * Earlier objects in the defaultsList take precedence when applying defaults. + */ +function defaults(opts) { + var defaultsList = []; + for (var _i = 1; _i < arguments.length; _i++) { + defaultsList[_i - 1] = arguments[_i]; + } + var defaultVals = extend.apply(void 0, __spreadArrays([{}], defaultsList.reverse())); + return extend(defaultVals, pick(opts || {}, Object.keys(defaultVals))); +} +/** Reduce function that merges each element of the list into a single object, using extend */ +var mergeR = function (memo, item) { return extend(memo, item); }; +/** + * Finds the common ancestor path between two states. + * + * @param {Object} first The first state. + * @param {Object} second The second state. + * @return {Array} Returns an array of state names in descending order, not including the root. + */ +function ancestors(first, second) { + var path = []; + // tslint:disable-next-line:forin + for (var n in first.path) { + if (first.path[n] !== second.path[n]) + break; + path.push(first.path[n]); + } + return path; +} +/** + * Return a copy of the object only containing the whitelisted properties. + * + * #### Example: + * ``` + * var foo = { a: 1, b: 2, c: 3 }; + * var ab = pick(foo, ['a', 'b']); // { a: 1, b: 2 } + * ``` + * @param obj the source object + * @param propNames an Array of strings, which are the whitelisted property names + */ +function pick(obj, propNames) { + var objCopy = {}; + for (var _prop in obj) { + if (propNames.indexOf(_prop) !== -1) { + objCopy[_prop] = obj[_prop]; + } + } + return objCopy; +} +/** + * Return a copy of the object omitting the blacklisted properties. + * + * @example + * ``` + * + * var foo = { a: 1, b: 2, c: 3 }; + * var ab = omit(foo, ['a', 'b']); // { c: 3 } + * ``` + * @param obj the source object + * @param propNames an Array of strings, which are the blacklisted property names + */ +function omit(obj, propNames) { + return Object.keys(obj) + .filter((0,_hof__WEBPACK_IMPORTED_MODULE_1__.not)(inArray(propNames))) + .reduce(function (acc, key) { return ((acc[key] = obj[key]), acc); }, {}); +} +/** + * Maps an array, or object to a property (by name) + */ +function pluck(collection, propName) { + return map(collection, (0,_hof__WEBPACK_IMPORTED_MODULE_1__.prop)(propName)); +} +/** Filters an Array or an Object's properties based on a predicate */ +function filter(collection, callback) { + var arr = (0,_predicates__WEBPACK_IMPORTED_MODULE_0__.isArray)(collection), result = arr ? [] : {}; + var accept = arr ? function (x) { return result.push(x); } : function (x, key) { return (result[key] = x); }; + forEach(collection, function (item, i) { + if (callback(item, i)) + accept(item, i); + }); + return result; +} +/** Finds an object from an array, or a property of an object, that matches a predicate */ +function find(collection, callback) { + var result; + forEach(collection, function (item, i) { + if (result) + return; + if (callback(item, i)) + result = item; + }); + return result; +} +/** Given an object, returns a new object, where each property is transformed by the callback function */ +var mapObj = map; +/** Maps an array or object properties using a callback function */ +function map(collection, callback, target) { + target = target || ((0,_predicates__WEBPACK_IMPORTED_MODULE_0__.isArray)(collection) ? [] : {}); + forEach(collection, function (item, i) { return (target[i] = callback(item, i)); }); + return target; +} +/** + * Given an object, return its enumerable property values + * + * @example + * ``` + * + * let foo = { a: 1, b: 2, c: 3 } + * let vals = values(foo); // [ 1, 2, 3 ] + * ``` + */ +var values = function (obj) { return Object.keys(obj).map(function (key) { return obj[key]; }); }; +/** + * Reduce function that returns true if all of the values are truthy. + * + * @example + * ``` + * + * let vals = [ 1, true, {}, "hello world"]; + * vals.reduce(allTrueR, true); // true + * + * vals.push(0); + * vals.reduce(allTrueR, true); // false + * ``` + */ +var allTrueR = function (memo, elem) { return memo && elem; }; +/** + * Reduce function that returns true if any of the values are truthy. + * + * * @example + * ``` + * + * let vals = [ 0, null, undefined ]; + * vals.reduce(anyTrueR, true); // false + * + * vals.push("hello world"); + * vals.reduce(anyTrueR, true); // true + * ``` + */ +var anyTrueR = function (memo, elem) { return memo || elem; }; +/** + * Reduce function which un-nests a single level of arrays + * @example + * ``` + * + * let input = [ [ "a", "b" ], [ "c", "d" ], [ [ "double", "nested" ] ] ]; + * input.reduce(unnestR, []) // [ "a", "b", "c", "d", [ "double, "nested" ] ] + * ``` + */ +var unnestR = function (memo, elem) { return memo.concat(elem); }; +/** + * Reduce function which recursively un-nests all arrays + * + * @example + * ``` + * + * let input = [ [ "a", "b" ], [ "c", "d" ], [ [ "double", "nested" ] ] ]; + * input.reduce(unnestR, []) // [ "a", "b", "c", "d", "double, "nested" ] + * ``` + */ +var flattenR = function (memo, elem) { + return (0,_predicates__WEBPACK_IMPORTED_MODULE_0__.isArray)(elem) ? memo.concat(elem.reduce(flattenR, [])) : pushR(memo, elem); +}; +/** + * Reduce function that pushes an object to an array, then returns the array. + * Mostly just for [[flattenR]] and [[uniqR]] + */ +function pushR(arr, obj) { + arr.push(obj); + return arr; +} +/** Reduce function that filters out duplicates */ +var uniqR = function (acc, token) { return (inArray(acc, token) ? acc : pushR(acc, token)); }; +/** + * Return a new array with a single level of arrays unnested. + * + * @example + * ``` + * + * let input = [ [ "a", "b" ], [ "c", "d" ], [ [ "double", "nested" ] ] ]; + * unnest(input) // [ "a", "b", "c", "d", [ "double, "nested" ] ] + * ``` + */ +var unnest = function (arr) { return arr.reduce(unnestR, []); }; +/** + * Return a completely flattened version of an array. + * + * @example + * ``` + * + * let input = [ [ "a", "b" ], [ "c", "d" ], [ [ "double", "nested" ] ] ]; + * flatten(input) // [ "a", "b", "c", "d", "double, "nested" ] + * ``` + */ +var flatten = function (arr) { return arr.reduce(flattenR, []); }; +/** + * Given a .filter Predicate, builds a .filter Predicate which throws an error if any elements do not pass. + * @example + * ``` + * + * let isNumber = (obj) => typeof(obj) === 'number'; + * let allNumbers = [ 1, 2, 3, 4, 5 ]; + * allNumbers.filter(assertPredicate(isNumber)); //OK + * + * let oneString = [ 1, 2, 3, 4, "5" ]; + * oneString.filter(assertPredicate(isNumber, "Not all numbers")); // throws Error(""Not all numbers""); + * ``` + */ +var assertPredicate = assertFn; +/** + * Given a .map function, builds a .map function which throws an error if any mapped elements do not pass a truthyness test. + * @example + * ``` + * + * var data = { foo: 1, bar: 2 }; + * + * let keys = [ 'foo', 'bar' ] + * let values = keys.map(assertMap(key => data[key], "Key not found")); + * // values is [1, 2] + * + * let keys = [ 'foo', 'bar', 'baz' ] + * let values = keys.map(assertMap(key => data[key], "Key not found")); + * // throws Error("Key not found") + * ``` + */ +var assertMap = assertFn; +function assertFn(predicateOrMap, errMsg) { + if (errMsg === void 0) { errMsg = 'assert failure'; } + return function (obj) { + var result = predicateOrMap(obj); + if (!result) { + throw new Error((0,_predicates__WEBPACK_IMPORTED_MODULE_0__.isFunction)(errMsg) ? errMsg(obj) : errMsg); + } + return result; + }; +} +/** + * Like _.pairs: Given an object, returns an array of key/value pairs + * + * @example + * ``` + * + * pairs({ foo: "FOO", bar: "BAR }) // [ [ "foo", "FOO" ], [ "bar": "BAR" ] ] + * ``` + */ +var pairs = function (obj) { return Object.keys(obj).map(function (key) { return [key, obj[key]]; }); }; +/** + * Given two or more parallel arrays, returns an array of tuples where + * each tuple is composed of [ a[i], b[i], ... z[i] ] + * + * @example + * ``` + * + * let foo = [ 0, 2, 4, 6 ]; + * let bar = [ 1, 3, 5, 7 ]; + * let baz = [ 10, 30, 50, 70 ]; + * arrayTuples(foo, bar); // [ [0, 1], [2, 3], [4, 5], [6, 7] ] + * arrayTuples(foo, bar, baz); // [ [0, 1, 10], [2, 3, 30], [4, 5, 50], [6, 7, 70] ] + * ``` + */ +function arrayTuples() { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + if (args.length === 0) + return []; + var maxArrayLen = args.reduce(function (min, arr) { return Math.min(arr.length, min); }, 9007199254740991); // aka 2^53 − 1 aka Number.MAX_SAFE_INTEGER + var result = []; + var _loop_1 = function (i) { + // This is a hot function + // Unroll when there are 1-4 arguments + switch (args.length) { + case 1: + result.push([args[0][i]]); + break; + case 2: + result.push([args[0][i], args[1][i]]); + break; + case 3: + result.push([args[0][i], args[1][i], args[2][i]]); + break; + case 4: + result.push([args[0][i], args[1][i], args[2][i], args[3][i]]); + break; + default: + result.push(args.map(function (array) { return array[i]; })); + break; + } + }; + for (var i = 0; i < maxArrayLen; i++) { + _loop_1(i); + } + return result; +} +/** + * Reduce function which builds an object from an array of [key, value] pairs. + * + * Each iteration sets the key/val pair on the memo object, then returns the memo for the next iteration. + * + * Each keyValueTuple should be an array with values [ key: string, value: any ] + * + * @example + * ``` + * + * var pairs = [ ["fookey", "fooval"], ["barkey", "barval"] ] + * + * var pairsToObj = pairs.reduce((memo, pair) => applyPairs(memo, pair), {}) + * // pairsToObj == { fookey: "fooval", barkey: "barval" } + * + * // Or, more simply: + * var pairsToObj = pairs.reduce(applyPairs, {}) + * // pairsToObj == { fookey: "fooval", barkey: "barval" } + * ``` + */ +function applyPairs(memo, keyValTuple) { + var key, value; + if ((0,_predicates__WEBPACK_IMPORTED_MODULE_0__.isArray)(keyValTuple)) + key = keyValTuple[0], value = keyValTuple[1]; + if (!(0,_predicates__WEBPACK_IMPORTED_MODULE_0__.isString)(key)) + throw new Error('invalid parameters to applyPairs'); + memo[key] = value; + return memo; +} +/** Get the last element of an array */ +function tail(arr) { + return (arr.length && arr[arr.length - 1]) || undefined; +} +/** + * shallow copy from src to dest + */ +function copy(src, dest) { + if (dest) + Object.keys(dest).forEach(function (key) { return delete dest[key]; }); + if (!dest) + dest = {}; + return extend(dest, src); +} +/** Naive forEach implementation works with Objects or Arrays */ +function _forEach(obj, cb, _this) { + if ((0,_predicates__WEBPACK_IMPORTED_MODULE_0__.isArray)(obj)) + return obj.forEach(cb, _this); + Object.keys(obj).forEach(function (key) { return cb(obj[key], key); }); +} +function _extend(toObj) { + for (var i = 1; i < arguments.length; i++) { + var obj = arguments[i]; + if (!obj) + continue; + var keys = Object.keys(obj); + for (var j = 0; j < keys.length; j++) { + toObj[keys[j]] = obj[keys[j]]; + } + } + return toObj; +} +function _equals(o1, o2) { + if (o1 === o2) + return true; + if (o1 === null || o2 === null) + return false; + if (o1 !== o1 && o2 !== o2) + return true; // NaN === NaN + var t1 = typeof o1, t2 = typeof o2; + if (t1 !== t2 || t1 !== 'object') + return false; + var tup = [o1, o2]; + if ((0,_hof__WEBPACK_IMPORTED_MODULE_1__.all)(_predicates__WEBPACK_IMPORTED_MODULE_0__.isArray)(tup)) + return _arraysEq(o1, o2); + if ((0,_hof__WEBPACK_IMPORTED_MODULE_1__.all)(_predicates__WEBPACK_IMPORTED_MODULE_0__.isDate)(tup)) + return o1.getTime() === o2.getTime(); + if ((0,_hof__WEBPACK_IMPORTED_MODULE_1__.all)(_predicates__WEBPACK_IMPORTED_MODULE_0__.isRegExp)(tup)) + return o1.toString() === o2.toString(); + if ((0,_hof__WEBPACK_IMPORTED_MODULE_1__.all)(_predicates__WEBPACK_IMPORTED_MODULE_0__.isFunction)(tup)) + return true; // meh + var predicates = [_predicates__WEBPACK_IMPORTED_MODULE_0__.isFunction, _predicates__WEBPACK_IMPORTED_MODULE_0__.isArray, _predicates__WEBPACK_IMPORTED_MODULE_0__.isDate, _predicates__WEBPACK_IMPORTED_MODULE_0__.isRegExp]; + if (predicates.map(_hof__WEBPACK_IMPORTED_MODULE_1__.any).reduce(function (b, fn) { return b || !!fn(tup); }, false)) + return false; + var keys = {}; + // tslint:disable-next-line:forin + for (var key in o1) { + if (!_equals(o1[key], o2[key])) + return false; + keys[key] = true; + } + for (var key in o2) { + if (!keys[key]) + return false; + } + return true; +} +function _arraysEq(a1, a2) { + if (a1.length !== a2.length) + return false; + return arrayTuples(a1, a2).reduce(function (b, t) { return b && _equals(t[0], t[1]); }, true); +} +// issue #2676 +var silenceUncaughtInPromise = function (promise) { return promise.catch(function (e) { return 0; }) && promise; }; +var silentRejection = function (error) { return silenceUncaughtInPromise(_coreservices__WEBPACK_IMPORTED_MODULE_2__.services.$q.reject(error)); }; +//# sourceMappingURL=common.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/common/coreservices.js": +/*!********************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/common/coreservices.js ***! + \********************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "makeStub": () => (/* binding */ makeStub), +/* harmony export */ "services": () => (/* binding */ services) +/* harmony export */ }); +var noImpl = function (fnname) { return function () { + throw new Error("No implementation for " + fnname + ". The framework specific code did not implement this method."); +}; }; +var makeStub = function (service, methods) { + return methods.reduce(function (acc, key) { return ((acc[key] = noImpl(service + "." + key + "()")), acc); }, {}); +}; +var services = { + $q: undefined, + $injector: undefined, +}; + +//# sourceMappingURL=coreservices.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/common/glob.js": +/*!************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/common/glob.js ***! + \************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "Glob": () => (/* binding */ Glob) +/* harmony export */ }); +/** + * Matches state names using glob-like pattern strings. + * + * Globs can be used in specific APIs including: + * + * - [[StateService.is]] + * - [[StateService.includes]] + * - The first argument to Hook Registration functions like [[TransitionService.onStart]] + * - [[HookMatchCriteria]] and [[HookMatchCriterion]] + * + * A `Glob` string is a pattern which matches state names. + * Nested state names are split into segments (separated by a dot) when processing. + * The state named `foo.bar.baz` is split into three segments ['foo', 'bar', 'baz'] + * + * Globs work according to the following rules: + * + * ### Exact match: + * + * The glob `'A.B'` matches the state named exactly `'A.B'`. + * + * | Glob |Matches states named|Does not match state named| + * |:------------|:--------------------|:---------------------| + * | `'A'` | `'A'` | `'B'` , `'A.C'` | + * | `'A.B'` | `'A.B'` | `'A'` , `'A.B.C'` | + * | `'foo'` | `'foo'` | `'FOO'` , `'foo.bar'`| + * + * ### Single star (`*`) + * + * A single star (`*`) is a wildcard that matches exactly one segment. + * + * | Glob |Matches states named |Does not match state named | + * |:------------|:---------------------|:--------------------------| + * | `'*'` | `'A'` , `'Z'` | `'A.B'` , `'Z.Y.X'` | + * | `'A.*'` | `'A.B'` , `'A.C'` | `'A'` , `'A.B.C'` | + * | `'A.*.*'` | `'A.B.C'` , `'A.X.Y'`| `'A'`, `'A.B'` , `'Z.Y.X'`| + * + * ### Double star (`**`) + * + * A double star (`'**'`) is a wildcard that matches *zero or more segments* + * + * | Glob |Matches states named |Does not match state named | + * |:------------|:----------------------------------------------|:----------------------------------| + * | `'**'` | `'A'` , `'A.B'`, `'Z.Y.X'` | (matches all states) | + * | `'A.**'` | `'A'` , `'A.B'` , `'A.C.X'` | `'Z.Y.X'` | + * | `'**.X'` | `'X'` , `'A.X'` , `'Z.Y.X'` | `'A'` , `'A.login.Z'` | + * | `'A.**.X'` | `'A.X'` , `'A.B.X'` , `'A.B.C.X'` | `'A'` , `'A.B.C'` | + * + * @packageDocumentation + */ +var Glob = /** @class */ (function () { + function Glob(text) { + this.text = text; + this.glob = text.split('.'); + var regexpString = this.text + .split('.') + .map(function (seg) { + if (seg === '**') + return '(?:|(?:\\.[^.]*)*)'; + if (seg === '*') + return '\\.[^.]*'; + return '\\.' + seg; + }) + .join(''); + this.regexp = new RegExp('^' + regexpString + '$'); + } + /** Returns true if the string has glob-like characters in it */ + Glob.is = function (text) { + return !!/[!,*]+/.exec(text); + }; + /** Returns a glob from the string, or null if the string isn't Glob-like */ + Glob.fromString = function (text) { + return Glob.is(text) ? new Glob(text) : null; + }; + Glob.prototype.matches = function (name) { + return this.regexp.test('.' + name); + }; + return Glob; +}()); + +//# sourceMappingURL=glob.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/common/hof.js": +/*!***********************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/common/hof.js ***! + \***********************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "curry": () => (/* binding */ curry), +/* harmony export */ "compose": () => (/* binding */ compose), +/* harmony export */ "pipe": () => (/* binding */ pipe), +/* harmony export */ "prop": () => (/* binding */ prop), +/* harmony export */ "propEq": () => (/* binding */ propEq), +/* harmony export */ "parse": () => (/* binding */ parse), +/* harmony export */ "not": () => (/* binding */ not), +/* harmony export */ "and": () => (/* binding */ and), +/* harmony export */ "or": () => (/* binding */ or), +/* harmony export */ "all": () => (/* binding */ all), +/* harmony export */ "any": () => (/* binding */ any), +/* harmony export */ "is": () => (/* binding */ is), +/* harmony export */ "eq": () => (/* binding */ eq), +/* harmony export */ "val": () => (/* binding */ val), +/* harmony export */ "invoke": () => (/* binding */ invoke), +/* harmony export */ "pattern": () => (/* binding */ pattern) +/* harmony export */ }); +/** + * Higher order functions + * + * These utility functions are exported, but are subject to change without notice. + * + * @packageDocumentation + */ +var __spreadArrays = (undefined && undefined.__spreadArrays) || function () { + for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; + for (var r = Array(s), k = 0, i = 0; i < il; i++) + for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) + r[k] = a[j]; + return r; +}; +/** + * Returns a new function for [Partial Application](https://en.wikipedia.org/wiki/Partial_application) of the original function. + * + * Given a function with N parameters, returns a new function that supports partial application. + * The new function accepts anywhere from 1 to N parameters. When that function is called with M parameters, + * where M is less than N, it returns a new function that accepts the remaining parameters. It continues to + * accept more parameters until all N parameters have been supplied. + * + * + * This contrived example uses a partially applied function as an predicate, which returns true + * if an object is found in both arrays. + * @example + * ``` + * // returns true if an object is in both of the two arrays + * function inBoth(array1, array2, object) { + * return array1.indexOf(object) !== -1 && + * array2.indexOf(object) !== 1; + * } + * let obj1, obj2, obj3, obj4, obj5, obj6, obj7 + * let foos = [obj1, obj3] + * let bars = [obj3, obj4, obj5] + * + * // A curried "copy" of inBoth + * let curriedInBoth = curry(inBoth); + * // Partially apply both the array1 and array2 + * let inFoosAndBars = curriedInBoth(foos, bars); + * + * // Supply the final argument; since all arguments are + * // supplied, the original inBoth function is then called. + * let obj1InBoth = inFoosAndBars(obj1); // false + * + * // Use the inFoosAndBars as a predicate. + * // Filter, on each iteration, supplies the final argument + * let allObjs = [ obj1, obj2, obj3, obj4, obj5, obj6, obj7 ]; + * let foundInBoth = allObjs.filter(inFoosAndBars); // [ obj3 ] + * + * ``` + * + * @param fn + * @returns {*|function(): (*|any)} + */ +function curry(fn) { + return function curried() { + if (arguments.length >= fn.length) { + return fn.apply(this, arguments); + } + var args = Array.prototype.slice.call(arguments); + return curried.bind.apply(curried, __spreadArrays([this], args)); + }; +} +/** + * Given a varargs list of functions, returns a function that composes the argument functions, right-to-left + * given: f(x), g(x), h(x) + * let composed = compose(f,g,h) + * then, composed is: f(g(h(x))) + */ +function compose() { + var args = arguments; + var start = args.length - 1; + return function () { + var i = start, result = args[start].apply(this, arguments); + while (i--) + result = args[i].call(this, result); + return result; + }; +} +/** + * Given a varargs list of functions, returns a function that is composes the argument functions, left-to-right + * given: f(x), g(x), h(x) + * let piped = pipe(f,g,h); + * then, piped is: h(g(f(x))) + */ +function pipe() { + var funcs = []; + for (var _i = 0; _i < arguments.length; _i++) { + funcs[_i] = arguments[_i]; + } + return compose.apply(null, [].slice.call(arguments).reverse()); +} +/** + * Given a property name, returns a function that returns that property from an object + * let obj = { foo: 1, name: "blarg" }; + * let getName = prop("name"); + * getName(obj) === "blarg" + */ +var prop = function (name) { return function (obj) { return obj && obj[name]; }; }; +/** + * Given a property name and a value, returns a function that returns a boolean based on whether + * the passed object has a property that matches the value + * let obj = { foo: 1, name: "blarg" }; + * let getName = propEq("name", "blarg"); + * getName(obj) === true + */ +var propEq = curry(function (name, _val, obj) { return obj && obj[name] === _val; }); +/** + * Given a dotted property name, returns a function that returns a nested property from an object, or undefined + * let obj = { id: 1, nestedObj: { foo: 1, name: "blarg" }, }; + * let getName = prop("nestedObj.name"); + * getName(obj) === "blarg" + * let propNotFound = prop("this.property.doesnt.exist"); + * propNotFound(obj) === undefined + */ +var parse = function (name) { return pipe.apply(null, name.split('.').map(prop)); }; +/** + * Given a function that returns a truthy or falsey value, returns a + * function that returns the opposite (falsey or truthy) value given the same inputs + */ +var not = function (fn) { return function () { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + return !fn.apply(null, args); +}; }; +/** + * Given two functions that return truthy or falsey values, returns a function that returns truthy + * if both functions return truthy for the given arguments + */ +function and(fn1, fn2) { + return function () { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + return fn1.apply(null, args) && fn2.apply(null, args); + }; +} +/** + * Given two functions that return truthy or falsey values, returns a function that returns truthy + * if at least one of the functions returns truthy for the given arguments + */ +function or(fn1, fn2) { + return function () { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + return fn1.apply(null, args) || fn2.apply(null, args); + }; +} +/** + * Check if all the elements of an array match a predicate function + * + * @param fn1 a predicate function `fn1` + * @returns a function which takes an array and returns true if `fn1` is true for all elements of the array + */ +var all = function (fn1) { return function (arr) { return arr.reduce(function (b, x) { return b && !!fn1(x); }, true); }; }; +// tslint:disable-next-line:variable-name +var any = function (fn1) { return function (arr) { return arr.reduce(function (b, x) { return b || !!fn1(x); }, false); }; }; +/** Given a class, returns a Predicate function that returns true if the object is of that class */ +var is = function (ctor) { return function (obj) { + return (obj != null && obj.constructor === ctor) || obj instanceof ctor; +}; }; +/** Given a value, returns a Predicate function that returns true if another value is === equal to the original value */ +var eq = function (value) { return function (other) { return value === other; }; }; +/** Given a value, returns a function which returns the value */ +var val = function (v) { return function () { return v; }; }; +function invoke(fnName, args) { + return function (obj) { return obj[fnName].apply(obj, args); }; +} +/** + * Sorta like Pattern Matching (a functional programming conditional construct) + * + * See http://c2.com/cgi/wiki?PatternMatching + * + * This is a conditional construct which allows a series of predicates and output functions + * to be checked and then applied. Each predicate receives the input. If the predicate + * returns truthy, then its matching output function (mapping function) is provided with + * the input and, then the result is returned. + * + * Each combination (2-tuple) of predicate + output function should be placed in an array + * of size 2: [ predicate, mapFn ] + * + * These 2-tuples should be put in an outer array. + * + * @example + * ``` + * + * // Here's a 2-tuple where the first element is the isString predicate + * // and the second element is a function that returns a description of the input + * let firstTuple = [ angular.isString, (input) => `Heres your string ${input}` ]; + * + * // Second tuple: predicate "isNumber", mapfn returns a description + * let secondTuple = [ angular.isNumber, (input) => `(${input}) That's a number!` ]; + * + * let third = [ (input) => input === null, (input) => `Oh, null...` ]; + * + * let fourth = [ (input) => input === undefined, (input) => `notdefined` ]; + * + * let descriptionOf = pattern([ firstTuple, secondTuple, third, fourth ]); + * + * console.log(descriptionOf(undefined)); // 'notdefined' + * console.log(descriptionOf(55)); // '(55) That's a number!' + * console.log(descriptionOf("foo")); // 'Here's your string foo' + * ``` + * + * @param struct A 2D array. Each element of the array should be an array, a 2-tuple, + * with a Predicate and a mapping/output function + * @returns {function(any): *} + */ +function pattern(struct) { + return function (x) { + for (var i = 0; i < struct.length; i++) { + if (struct[i][0](x)) + return struct[i][1](x); + } + }; +} +//# sourceMappingURL=hof.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/common/index.js": +/*!*************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/common/index.js ***! + \*************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "_extend": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__._extend), +/* harmony export */ "_inArray": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__._inArray), +/* harmony export */ "_pushTo": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__._pushTo), +/* harmony export */ "_removeFrom": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__._removeFrom), +/* harmony export */ "allTrueR": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.allTrueR), +/* harmony export */ "ancestors": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.ancestors), +/* harmony export */ "anyTrueR": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.anyTrueR), +/* harmony export */ "applyPairs": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.applyPairs), +/* harmony export */ "arrayTuples": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.arrayTuples), +/* harmony export */ "assertFn": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.assertFn), +/* harmony export */ "assertMap": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.assertMap), +/* harmony export */ "assertPredicate": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.assertPredicate), +/* harmony export */ "copy": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.copy), +/* harmony export */ "createProxyFunctions": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.createProxyFunctions), +/* harmony export */ "defaults": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.defaults), +/* harmony export */ "deregAll": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.deregAll), +/* harmony export */ "equals": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.equals), +/* harmony export */ "extend": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.extend), +/* harmony export */ "filter": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.filter), +/* harmony export */ "find": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.find), +/* harmony export */ "flatten": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.flatten), +/* harmony export */ "flattenR": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.flattenR), +/* harmony export */ "forEach": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.forEach), +/* harmony export */ "fromJson": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.fromJson), +/* harmony export */ "identity": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.identity), +/* harmony export */ "inArray": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.inArray), +/* harmony export */ "inherit": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.inherit), +/* harmony export */ "map": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.map), +/* harmony export */ "mapObj": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.mapObj), +/* harmony export */ "mergeR": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.mergeR), +/* harmony export */ "noop": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.noop), +/* harmony export */ "omit": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.omit), +/* harmony export */ "pairs": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.pairs), +/* harmony export */ "pick": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.pick), +/* harmony export */ "pluck": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.pluck), +/* harmony export */ "pushR": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.pushR), +/* harmony export */ "pushTo": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.pushTo), +/* harmony export */ "removeFrom": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.removeFrom), +/* harmony export */ "root": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.root), +/* harmony export */ "silenceUncaughtInPromise": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.silenceUncaughtInPromise), +/* harmony export */ "silentRejection": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.silentRejection), +/* harmony export */ "tail": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.tail), +/* harmony export */ "toJson": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.toJson), +/* harmony export */ "uniqR": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.uniqR), +/* harmony export */ "unnest": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.unnest), +/* harmony export */ "unnestR": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.unnestR), +/* harmony export */ "values": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.values), +/* harmony export */ "makeStub": () => (/* reexport safe */ _coreservices__WEBPACK_IMPORTED_MODULE_1__.makeStub), +/* harmony export */ "services": () => (/* reexport safe */ _coreservices__WEBPACK_IMPORTED_MODULE_1__.services), +/* harmony export */ "Glob": () => (/* reexport safe */ _glob__WEBPACK_IMPORTED_MODULE_2__.Glob), +/* harmony export */ "all": () => (/* reexport safe */ _hof__WEBPACK_IMPORTED_MODULE_3__.all), +/* harmony export */ "and": () => (/* reexport safe */ _hof__WEBPACK_IMPORTED_MODULE_3__.and), +/* harmony export */ "any": () => (/* reexport safe */ _hof__WEBPACK_IMPORTED_MODULE_3__.any), +/* harmony export */ "compose": () => (/* reexport safe */ _hof__WEBPACK_IMPORTED_MODULE_3__.compose), +/* harmony export */ "curry": () => (/* reexport safe */ _hof__WEBPACK_IMPORTED_MODULE_3__.curry), +/* harmony export */ "eq": () => (/* reexport safe */ _hof__WEBPACK_IMPORTED_MODULE_3__.eq), +/* harmony export */ "invoke": () => (/* reexport safe */ _hof__WEBPACK_IMPORTED_MODULE_3__.invoke), +/* harmony export */ "is": () => (/* reexport safe */ _hof__WEBPACK_IMPORTED_MODULE_3__.is), +/* harmony export */ "not": () => (/* reexport safe */ _hof__WEBPACK_IMPORTED_MODULE_3__.not), +/* harmony export */ "or": () => (/* reexport safe */ _hof__WEBPACK_IMPORTED_MODULE_3__.or), +/* harmony export */ "parse": () => (/* reexport safe */ _hof__WEBPACK_IMPORTED_MODULE_3__.parse), +/* harmony export */ "pattern": () => (/* reexport safe */ _hof__WEBPACK_IMPORTED_MODULE_3__.pattern), +/* harmony export */ "pipe": () => (/* reexport safe */ _hof__WEBPACK_IMPORTED_MODULE_3__.pipe), +/* harmony export */ "prop": () => (/* reexport safe */ _hof__WEBPACK_IMPORTED_MODULE_3__.prop), +/* harmony export */ "propEq": () => (/* reexport safe */ _hof__WEBPACK_IMPORTED_MODULE_3__.propEq), +/* harmony export */ "val": () => (/* reexport safe */ _hof__WEBPACK_IMPORTED_MODULE_3__.val), +/* harmony export */ "isArray": () => (/* reexport safe */ _predicates__WEBPACK_IMPORTED_MODULE_4__.isArray), +/* harmony export */ "isDate": () => (/* reexport safe */ _predicates__WEBPACK_IMPORTED_MODULE_4__.isDate), +/* harmony export */ "isDefined": () => (/* reexport safe */ _predicates__WEBPACK_IMPORTED_MODULE_4__.isDefined), +/* harmony export */ "isFunction": () => (/* reexport safe */ _predicates__WEBPACK_IMPORTED_MODULE_4__.isFunction), +/* harmony export */ "isInjectable": () => (/* reexport safe */ _predicates__WEBPACK_IMPORTED_MODULE_4__.isInjectable), +/* harmony export */ "isNull": () => (/* reexport safe */ _predicates__WEBPACK_IMPORTED_MODULE_4__.isNull), +/* harmony export */ "isNullOrUndefined": () => (/* reexport safe */ _predicates__WEBPACK_IMPORTED_MODULE_4__.isNullOrUndefined), +/* harmony export */ "isNumber": () => (/* reexport safe */ _predicates__WEBPACK_IMPORTED_MODULE_4__.isNumber), +/* harmony export */ "isObject": () => (/* reexport safe */ _predicates__WEBPACK_IMPORTED_MODULE_4__.isObject), +/* harmony export */ "isPromise": () => (/* reexport safe */ _predicates__WEBPACK_IMPORTED_MODULE_4__.isPromise), +/* harmony export */ "isRegExp": () => (/* reexport safe */ _predicates__WEBPACK_IMPORTED_MODULE_4__.isRegExp), +/* harmony export */ "isString": () => (/* reexport safe */ _predicates__WEBPACK_IMPORTED_MODULE_4__.isString), +/* harmony export */ "isUndefined": () => (/* reexport safe */ _predicates__WEBPACK_IMPORTED_MODULE_4__.isUndefined), +/* harmony export */ "Queue": () => (/* reexport safe */ _queue__WEBPACK_IMPORTED_MODULE_5__.Queue), +/* harmony export */ "beforeAfterSubstr": () => (/* reexport safe */ _strings__WEBPACK_IMPORTED_MODULE_6__.beforeAfterSubstr), +/* harmony export */ "fnToString": () => (/* reexport safe */ _strings__WEBPACK_IMPORTED_MODULE_6__.fnToString), +/* harmony export */ "functionToString": () => (/* reexport safe */ _strings__WEBPACK_IMPORTED_MODULE_6__.functionToString), +/* harmony export */ "hostRegex": () => (/* reexport safe */ _strings__WEBPACK_IMPORTED_MODULE_6__.hostRegex), +/* harmony export */ "joinNeighborsR": () => (/* reexport safe */ _strings__WEBPACK_IMPORTED_MODULE_6__.joinNeighborsR), +/* harmony export */ "kebobString": () => (/* reexport safe */ _strings__WEBPACK_IMPORTED_MODULE_6__.kebobString), +/* harmony export */ "maxLength": () => (/* reexport safe */ _strings__WEBPACK_IMPORTED_MODULE_6__.maxLength), +/* harmony export */ "padString": () => (/* reexport safe */ _strings__WEBPACK_IMPORTED_MODULE_6__.padString), +/* harmony export */ "splitEqual": () => (/* reexport safe */ _strings__WEBPACK_IMPORTED_MODULE_6__.splitEqual), +/* harmony export */ "splitHash": () => (/* reexport safe */ _strings__WEBPACK_IMPORTED_MODULE_6__.splitHash), +/* harmony export */ "splitOnDelim": () => (/* reexport safe */ _strings__WEBPACK_IMPORTED_MODULE_6__.splitOnDelim), +/* harmony export */ "splitQuery": () => (/* reexport safe */ _strings__WEBPACK_IMPORTED_MODULE_6__.splitQuery), +/* harmony export */ "stringify": () => (/* reexport safe */ _strings__WEBPACK_IMPORTED_MODULE_6__.stringify), +/* harmony export */ "stripLastPathElement": () => (/* reexport safe */ _strings__WEBPACK_IMPORTED_MODULE_6__.stripLastPathElement), +/* harmony export */ "trimHashVal": () => (/* reexport safe */ _strings__WEBPACK_IMPORTED_MODULE_6__.trimHashVal), +/* harmony export */ "Category": () => (/* reexport safe */ _trace__WEBPACK_IMPORTED_MODULE_7__.Category), +/* harmony export */ "Trace": () => (/* reexport safe */ _trace__WEBPACK_IMPORTED_MODULE_7__.Trace), +/* harmony export */ "trace": () => (/* reexport safe */ _trace__WEBPACK_IMPORTED_MODULE_7__.trace) +/* harmony export */ }); +/* harmony import */ var _common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./common */ "./node_modules/@uirouter/core/lib-esm/common/common.js"); +/* harmony import */ var _coreservices__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./coreservices */ "./node_modules/@uirouter/core/lib-esm/common/coreservices.js"); +/* harmony import */ var _glob__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./glob */ "./node_modules/@uirouter/core/lib-esm/common/glob.js"); +/* harmony import */ var _hof__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./hof */ "./node_modules/@uirouter/core/lib-esm/common/hof.js"); +/* harmony import */ var _predicates__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./predicates */ "./node_modules/@uirouter/core/lib-esm/common/predicates.js"); +/* harmony import */ var _queue__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./queue */ "./node_modules/@uirouter/core/lib-esm/common/queue.js"); +/* harmony import */ var _strings__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./strings */ "./node_modules/@uirouter/core/lib-esm/common/strings.js"); +/* harmony import */ var _trace__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./trace */ "./node_modules/@uirouter/core/lib-esm/common/trace.js"); + + + + + + + + +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/common/predicates.js": +/*!******************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/common/predicates.js ***! + \******************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "isUndefined": () => (/* binding */ isUndefined), +/* harmony export */ "isDefined": () => (/* binding */ isDefined), +/* harmony export */ "isNull": () => (/* binding */ isNull), +/* harmony export */ "isNullOrUndefined": () => (/* binding */ isNullOrUndefined), +/* harmony export */ "isFunction": () => (/* binding */ isFunction), +/* harmony export */ "isNumber": () => (/* binding */ isNumber), +/* harmony export */ "isString": () => (/* binding */ isString), +/* harmony export */ "isObject": () => (/* binding */ isObject), +/* harmony export */ "isArray": () => (/* binding */ isArray), +/* harmony export */ "isDate": () => (/* binding */ isDate), +/* harmony export */ "isRegExp": () => (/* binding */ isRegExp), +/* harmony export */ "isInjectable": () => (/* binding */ isInjectable), +/* harmony export */ "isPromise": () => (/* binding */ isPromise) +/* harmony export */ }); +/* harmony import */ var _hof__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./hof */ "./node_modules/@uirouter/core/lib-esm/common/hof.js"); +/** + * Predicates + * + * These predicates return true/false based on the input. + * Although these functions are exported, they are subject to change without notice. + * + * @packageDocumentation + */ + +var toStr = Object.prototype.toString; +var tis = function (t) { return function (x) { return typeof x === t; }; }; +var isUndefined = tis('undefined'); +var isDefined = (0,_hof__WEBPACK_IMPORTED_MODULE_0__.not)(isUndefined); +var isNull = function (o) { return o === null; }; +var isNullOrUndefined = (0,_hof__WEBPACK_IMPORTED_MODULE_0__.or)(isNull, isUndefined); +var isFunction = tis('function'); +var isNumber = tis('number'); +var isString = tis('string'); +var isObject = function (x) { return x !== null && typeof x === 'object'; }; +var isArray = Array.isArray; +var isDate = (function (x) { return toStr.call(x) === '[object Date]'; }); +var isRegExp = (function (x) { return toStr.call(x) === '[object RegExp]'; }); +/** + * Predicate which checks if a value is injectable + * + * A value is "injectable" if it is a function, or if it is an ng1 array-notation-style array + * where all the elements in the array are Strings, except the last one, which is a Function + */ +function isInjectable(val) { + if (isArray(val) && val.length) { + var head = val.slice(0, -1), tail = val.slice(-1); + return !(head.filter((0,_hof__WEBPACK_IMPORTED_MODULE_0__.not)(isString)).length || tail.filter((0,_hof__WEBPACK_IMPORTED_MODULE_0__.not)(isFunction)).length); + } + return isFunction(val); +} +/** + * Predicate which checks if a value looks like a Promise + * + * It is probably a Promise if it's an object, and it has a `then` property which is a Function + */ +var isPromise = (0,_hof__WEBPACK_IMPORTED_MODULE_0__.and)(isObject, (0,_hof__WEBPACK_IMPORTED_MODULE_0__.pipe)((0,_hof__WEBPACK_IMPORTED_MODULE_0__.prop)('then'), isFunction)); +//# sourceMappingURL=predicates.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/common/queue.js": +/*!*************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/common/queue.js ***! + \*************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "Queue": () => (/* binding */ Queue) +/* harmony export */ }); +/* harmony import */ var _common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./common */ "./node_modules/@uirouter/core/lib-esm/common/common.js"); + +var Queue = /** @class */ (function () { + function Queue(_items, _limit) { + if (_items === void 0) { _items = []; } + if (_limit === void 0) { _limit = null; } + this._items = _items; + this._limit = _limit; + this._evictListeners = []; + this.onEvict = (0,_common__WEBPACK_IMPORTED_MODULE_0__.pushTo)(this._evictListeners); + } + Queue.prototype.enqueue = function (item) { + var items = this._items; + items.push(item); + if (this._limit && items.length > this._limit) + this.evict(); + return item; + }; + Queue.prototype.evict = function () { + var item = this._items.shift(); + this._evictListeners.forEach(function (fn) { return fn(item); }); + return item; + }; + Queue.prototype.dequeue = function () { + if (this.size()) + return this._items.splice(0, 1)[0]; + }; + Queue.prototype.clear = function () { + var current = this._items; + this._items = []; + return current; + }; + Queue.prototype.size = function () { + return this._items.length; + }; + Queue.prototype.remove = function (item) { + var idx = this._items.indexOf(item); + return idx > -1 && this._items.splice(idx, 1)[0]; + }; + Queue.prototype.peekTail = function () { + return this._items[this._items.length - 1]; + }; + Queue.prototype.peekHead = function () { + if (this.size()) + return this._items[0]; + }; + return Queue; +}()); + +//# sourceMappingURL=queue.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/common/safeConsole.js": +/*!*******************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/common/safeConsole.js ***! + \*******************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "safeConsole": () => (/* binding */ safeConsole) +/* harmony export */ }); +/* harmony import */ var _common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./common */ "./node_modules/@uirouter/core/lib-esm/common/common.js"); +/** + * workaround for missing console object in IE9 when dev tools haven't been opened o_O + * @packageDocumentation + */ +/* tslint:disable:no-console */ + +var noopConsoleStub = { log: _common__WEBPACK_IMPORTED_MODULE_0__.noop, error: _common__WEBPACK_IMPORTED_MODULE_0__.noop, table: _common__WEBPACK_IMPORTED_MODULE_0__.noop }; +function ie9Console(console) { + var bound = function (fn) { return Function.prototype.bind.call(fn, console); }; + return { + log: bound(console.log), + error: bound(console.log), + table: bound(console.log), + }; +} +function fallbackConsole(console) { + var log = console.log.bind(console); + var error = console.error ? console.error.bind(console) : log; + var table = console.table ? console.table.bind(console) : log; + return { log: log, error: error, table: table }; +} +function getSafeConsole() { + // @ts-ignore + var isIE9 = typeof document !== 'undefined' && document.documentMode && document.documentMode === 9; + if (isIE9) { + return window && window.console ? ie9Console(window.console) : noopConsoleStub; + } + else if (!console.table || !console.error) { + return fallbackConsole(console); + } + else { + return console; + } +} +var safeConsole = getSafeConsole(); +//# sourceMappingURL=safeConsole.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/common/strings.js": +/*!***************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/common/strings.js ***! + \***************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "maxLength": () => (/* binding */ maxLength), +/* harmony export */ "padString": () => (/* binding */ padString), +/* harmony export */ "kebobString": () => (/* binding */ kebobString), +/* harmony export */ "functionToString": () => (/* binding */ functionToString), +/* harmony export */ "fnToString": () => (/* binding */ fnToString), +/* harmony export */ "stringify": () => (/* binding */ stringify), +/* harmony export */ "beforeAfterSubstr": () => (/* binding */ beforeAfterSubstr), +/* harmony export */ "hostRegex": () => (/* binding */ hostRegex), +/* harmony export */ "stripLastPathElement": () => (/* binding */ stripLastPathElement), +/* harmony export */ "splitHash": () => (/* binding */ splitHash), +/* harmony export */ "splitQuery": () => (/* binding */ splitQuery), +/* harmony export */ "splitEqual": () => (/* binding */ splitEqual), +/* harmony export */ "trimHashVal": () => (/* binding */ trimHashVal), +/* harmony export */ "splitOnDelim": () => (/* binding */ splitOnDelim), +/* harmony export */ "joinNeighborsR": () => (/* binding */ joinNeighborsR) +/* harmony export */ }); +/* harmony import */ var _predicates__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./predicates */ "./node_modules/@uirouter/core/lib-esm/common/predicates.js"); +/* harmony import */ var _transition_rejectFactory__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../transition/rejectFactory */ "./node_modules/@uirouter/core/lib-esm/transition/rejectFactory.js"); +/* harmony import */ var _common__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./common */ "./node_modules/@uirouter/core/lib-esm/common/common.js"); +/* harmony import */ var _hof__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./hof */ "./node_modules/@uirouter/core/lib-esm/common/hof.js"); +/** + * Functions that manipulate strings + * + * Although these functions are exported, they are subject to change without notice. + * + * @packageDocumentation + */ + + + + +/** + * Returns a string shortened to a maximum length + * + * If the string is already less than the `max` length, return the string. + * Else return the string, shortened to `max - 3` and append three dots ("..."). + * + * @param max the maximum length of the string to return + * @param str the input string + */ +function maxLength(max, str) { + if (str.length <= max) + return str; + return str.substr(0, max - 3) + '...'; +} +/** + * Returns a string, with spaces added to the end, up to a desired str length + * + * If the string is already longer than the desired length, return the string. + * Else returns the string, with extra spaces on the end, such that it reaches `length` characters. + * + * @param length the desired length of the string to return + * @param str the input string + */ +function padString(length, str) { + while (str.length < length) + str += ' '; + return str; +} +function kebobString(camelCase) { + return camelCase + .replace(/^([A-Z])/, function ($1) { return $1.toLowerCase(); }) // replace first char + .replace(/([A-Z])/g, function ($1) { return '-' + $1.toLowerCase(); }); // replace rest +} +function functionToString(fn) { + var fnStr = fnToString(fn); + var namedFunctionMatch = fnStr.match(/^(function [^ ]+\([^)]*\))/); + var toStr = namedFunctionMatch ? namedFunctionMatch[1] : fnStr; + var fnName = fn['name'] || ''; + if (fnName && toStr.match(/function \(/)) { + return 'function ' + fnName + toStr.substr(9); + } + return toStr; +} +function fnToString(fn) { + var _fn = (0,_predicates__WEBPACK_IMPORTED_MODULE_0__.isArray)(fn) ? fn.slice(-1)[0] : fn; + return (_fn && _fn.toString()) || 'undefined'; +} +var isRejection = _transition_rejectFactory__WEBPACK_IMPORTED_MODULE_1__.Rejection.isRejectionPromise; +var hasToString = function (obj) { + return (0,_predicates__WEBPACK_IMPORTED_MODULE_0__.isObject)(obj) && !(0,_predicates__WEBPACK_IMPORTED_MODULE_0__.isArray)(obj) && obj.constructor !== Object && (0,_predicates__WEBPACK_IMPORTED_MODULE_0__.isFunction)(obj.toString); +}; +var stringifyPattern = (0,_hof__WEBPACK_IMPORTED_MODULE_3__.pattern)([ + [_predicates__WEBPACK_IMPORTED_MODULE_0__.isUndefined, (0,_hof__WEBPACK_IMPORTED_MODULE_3__.val)('undefined')], + [_predicates__WEBPACK_IMPORTED_MODULE_0__.isNull, (0,_hof__WEBPACK_IMPORTED_MODULE_3__.val)('null')], + [_predicates__WEBPACK_IMPORTED_MODULE_0__.isPromise, (0,_hof__WEBPACK_IMPORTED_MODULE_3__.val)('[Promise]')], + [isRejection, function (x) { return x._transitionRejection.toString(); }], + [hasToString, function (x) { return x.toString(); }], + [_predicates__WEBPACK_IMPORTED_MODULE_0__.isInjectable, functionToString], + [(0,_hof__WEBPACK_IMPORTED_MODULE_3__.val)(true), _common__WEBPACK_IMPORTED_MODULE_2__.identity], +]); +function stringify(o) { + var seen = []; + function format(value) { + if ((0,_predicates__WEBPACK_IMPORTED_MODULE_0__.isObject)(value)) { + if (seen.indexOf(value) !== -1) + return '[circular ref]'; + seen.push(value); + } + return stringifyPattern(value); + } + if ((0,_predicates__WEBPACK_IMPORTED_MODULE_0__.isUndefined)(o)) { + // Workaround for IE & Edge Spec incompatibility where replacer function would not be called when JSON.stringify + // is given `undefined` as value. To work around that, we simply detect `undefined` and bail out early by + // manually stringifying it. + return format(o); + } + return JSON.stringify(o, function (key, value) { return format(value); }).replace(/\\"/g, '"'); +} +/** Returns a function that splits a string on a character or substring */ +var beforeAfterSubstr = function (char) { return function (str) { + if (!str) + return ['', '']; + var idx = str.indexOf(char); + if (idx === -1) + return [str, '']; + return [str.substr(0, idx), str.substr(idx + 1)]; +}; }; +var hostRegex = new RegExp('^(?:[a-z]+:)?//[^/]+/'); +var stripLastPathElement = function (str) { return str.replace(/\/[^/]*$/, ''); }; +var splitHash = beforeAfterSubstr('#'); +var splitQuery = beforeAfterSubstr('?'); +var splitEqual = beforeAfterSubstr('='); +var trimHashVal = function (str) { return (str ? str.replace(/^#/, '') : ''); }; +/** + * Splits on a delimiter, but returns the delimiters in the array + * + * #### Example: + * ```js + * var splitOnSlashes = splitOnDelim('/'); + * splitOnSlashes("/foo"); // ["/", "foo"] + * splitOnSlashes("/foo/"); // ["/", "foo", "/"] + * ``` + */ +function splitOnDelim(delim) { + var re = new RegExp('(' + delim + ')', 'g'); + return function (str) { return str.split(re).filter(_common__WEBPACK_IMPORTED_MODULE_2__.identity); }; +} +/** + * Reduce fn that joins neighboring strings + * + * Given an array of strings, returns a new array + * where all neighboring strings have been joined. + * + * #### Example: + * ```js + * let arr = ["foo", "bar", 1, "baz", "", "qux" ]; + * arr.reduce(joinNeighborsR, []) // ["foobar", 1, "bazqux" ] + * ``` + */ +function joinNeighborsR(acc, x) { + if ((0,_predicates__WEBPACK_IMPORTED_MODULE_0__.isString)((0,_common__WEBPACK_IMPORTED_MODULE_2__.tail)(acc)) && (0,_predicates__WEBPACK_IMPORTED_MODULE_0__.isString)(x)) + return acc.slice(0, -1).concat((0,_common__WEBPACK_IMPORTED_MODULE_2__.tail)(acc) + x); + return (0,_common__WEBPACK_IMPORTED_MODULE_2__.pushR)(acc, x); +} +//# sourceMappingURL=strings.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/common/trace.js": +/*!*************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/common/trace.js ***! + \*************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "Category": () => (/* binding */ Category), +/* harmony export */ "Trace": () => (/* binding */ Trace), +/* harmony export */ "trace": () => (/* binding */ trace) +/* harmony export */ }); +/* harmony import */ var _common_hof__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/hof */ "./node_modules/@uirouter/core/lib-esm/common/hof.js"); +/* harmony import */ var _common_predicates__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/predicates */ "./node_modules/@uirouter/core/lib-esm/common/predicates.js"); +/* harmony import */ var _strings__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./strings */ "./node_modules/@uirouter/core/lib-esm/common/strings.js"); +/* harmony import */ var _safeConsole__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./safeConsole */ "./node_modules/@uirouter/core/lib-esm/common/safeConsole.js"); +/** + * # Transition tracing (debug) + * + * Enable transition tracing to print transition information to the console, + * in order to help debug your application. + * Tracing logs detailed information about each Transition to your console. + * + * To enable tracing, import the [[Trace]] singleton and enable one or more categories. + * + * ### ES6 + * ```js + * import {trace} from "@uirouter/core"; + * trace.enable(1, 5); // TRANSITION and VIEWCONFIG + * ``` + * + * ### CJS + * ```js + * let trace = require("@uirouter/core").trace; + * trace.enable("TRANSITION", "VIEWCONFIG"); + * ``` + * + * ### Globals + * ```js + * let trace = window["@uirouter/core"].trace; + * trace.enable(); // Trace everything (very verbose) + * ``` + * + * ### Angular 1: + * ```js + * app.run($trace => $trace.enable()); + * ``` + * + * @packageDocumentation + */ + + + + +function uiViewString(uiview) { + if (!uiview) + return 'ui-view (defunct)'; + var state = uiview.creationContext ? uiview.creationContext.name || '(root)' : '(none)'; + return "[ui-view#" + uiview.id + " " + uiview.$type + ":" + uiview.fqn + " (" + uiview.name + "@" + state + ")]"; +} +var viewConfigString = function (viewConfig) { + var view = viewConfig.viewDecl; + var state = view.$context.name || '(root)'; + return "[View#" + viewConfig.$id + " from '" + state + "' state]: target ui-view: '" + view.$uiViewName + "@" + view.$uiViewContextAnchor + "'"; +}; +function normalizedCat(input) { + return (0,_common_predicates__WEBPACK_IMPORTED_MODULE_1__.isNumber)(input) ? Category[input] : Category[Category[input]]; +} +/** + * Trace categories Enum + * + * Enable or disable a category using [[Trace.enable]] or [[Trace.disable]] + * + * `trace.enable(Category.TRANSITION)` + * + * These can also be provided using a matching string, or position ordinal + * + * `trace.enable("TRANSITION")` + * + * `trace.enable(1)` + */ +var Category; +(function (Category) { + Category[Category["RESOLVE"] = 0] = "RESOLVE"; + Category[Category["TRANSITION"] = 1] = "TRANSITION"; + Category[Category["HOOK"] = 2] = "HOOK"; + Category[Category["UIVIEW"] = 3] = "UIVIEW"; + Category[Category["VIEWCONFIG"] = 4] = "VIEWCONFIG"; +})(Category || (Category = {})); + +var _tid = (0,_common_hof__WEBPACK_IMPORTED_MODULE_0__.parse)('$id'); +var _rid = (0,_common_hof__WEBPACK_IMPORTED_MODULE_0__.parse)('router.$id'); +var transLbl = function (trans) { return "Transition #" + _tid(trans) + "-" + _rid(trans); }; +/** + * Prints UI-Router Transition trace information to the console. + */ +var Trace = /** @class */ (function () { + /** @internal */ + function Trace() { + /** @internal */ + this._enabled = {}; + this.approximateDigests = 0; + } + /** @internal */ + Trace.prototype._set = function (enabled, categories) { + var _this = this; + if (!categories.length) { + categories = Object.keys(Category) + .map(function (k) { return parseInt(k, 10); }) + .filter(function (k) { return !isNaN(k); }) + .map(function (key) { return Category[key]; }); + } + categories.map(normalizedCat).forEach(function (category) { return (_this._enabled[category] = enabled); }); + }; + Trace.prototype.enable = function () { + var categories = []; + for (var _i = 0; _i < arguments.length; _i++) { + categories[_i] = arguments[_i]; + } + this._set(true, categories); + }; + Trace.prototype.disable = function () { + var categories = []; + for (var _i = 0; _i < arguments.length; _i++) { + categories[_i] = arguments[_i]; + } + this._set(false, categories); + }; + /** + * Retrieves the enabled stateus of a [[Category]] + * + * ```js + * trace.enabled("VIEWCONFIG"); // true or false + * ``` + * + * @returns boolean true if the category is enabled + */ + Trace.prototype.enabled = function (category) { + return !!this._enabled[normalizedCat(category)]; + }; + /** @internal called by ui-router code */ + Trace.prototype.traceTransitionStart = function (trans) { + if (!this.enabled(Category.TRANSITION)) + return; + _safeConsole__WEBPACK_IMPORTED_MODULE_3__.safeConsole.log(transLbl(trans) + ": Started -> " + (0,_strings__WEBPACK_IMPORTED_MODULE_2__.stringify)(trans)); + }; + /** @internal called by ui-router code */ + Trace.prototype.traceTransitionIgnored = function (trans) { + if (!this.enabled(Category.TRANSITION)) + return; + _safeConsole__WEBPACK_IMPORTED_MODULE_3__.safeConsole.log(transLbl(trans) + ": Ignored <> " + (0,_strings__WEBPACK_IMPORTED_MODULE_2__.stringify)(trans)); + }; + /** @internal called by ui-router code */ + Trace.prototype.traceHookInvocation = function (step, trans, options) { + if (!this.enabled(Category.HOOK)) + return; + var event = (0,_common_hof__WEBPACK_IMPORTED_MODULE_0__.parse)('traceData.hookType')(options) || 'internal', context = (0,_common_hof__WEBPACK_IMPORTED_MODULE_0__.parse)('traceData.context.state.name')(options) || (0,_common_hof__WEBPACK_IMPORTED_MODULE_0__.parse)('traceData.context')(options) || 'unknown', name = (0,_strings__WEBPACK_IMPORTED_MODULE_2__.functionToString)(step.registeredHook.callback); + _safeConsole__WEBPACK_IMPORTED_MODULE_3__.safeConsole.log(transLbl(trans) + ": Hook -> " + event + " context: " + context + ", " + (0,_strings__WEBPACK_IMPORTED_MODULE_2__.maxLength)(200, name)); + }; + /** @internal called by ui-router code */ + Trace.prototype.traceHookResult = function (hookResult, trans, transitionOptions) { + if (!this.enabled(Category.HOOK)) + return; + _safeConsole__WEBPACK_IMPORTED_MODULE_3__.safeConsole.log(transLbl(trans) + ": <- Hook returned: " + (0,_strings__WEBPACK_IMPORTED_MODULE_2__.maxLength)(200, (0,_strings__WEBPACK_IMPORTED_MODULE_2__.stringify)(hookResult))); + }; + /** @internal called by ui-router code */ + Trace.prototype.traceResolvePath = function (path, when, trans) { + if (!this.enabled(Category.RESOLVE)) + return; + _safeConsole__WEBPACK_IMPORTED_MODULE_3__.safeConsole.log(transLbl(trans) + ": Resolving " + path + " (" + when + ")"); + }; + /** @internal called by ui-router code */ + Trace.prototype.traceResolvableResolved = function (resolvable, trans) { + if (!this.enabled(Category.RESOLVE)) + return; + _safeConsole__WEBPACK_IMPORTED_MODULE_3__.safeConsole.log(transLbl(trans) + ": <- Resolved " + resolvable + " to: " + (0,_strings__WEBPACK_IMPORTED_MODULE_2__.maxLength)(200, (0,_strings__WEBPACK_IMPORTED_MODULE_2__.stringify)(resolvable.data))); + }; + /** @internal called by ui-router code */ + Trace.prototype.traceError = function (reason, trans) { + if (!this.enabled(Category.TRANSITION)) + return; + _safeConsole__WEBPACK_IMPORTED_MODULE_3__.safeConsole.log(transLbl(trans) + ": <- Rejected " + (0,_strings__WEBPACK_IMPORTED_MODULE_2__.stringify)(trans) + ", reason: " + reason); + }; + /** @internal called by ui-router code */ + Trace.prototype.traceSuccess = function (finalState, trans) { + if (!this.enabled(Category.TRANSITION)) + return; + _safeConsole__WEBPACK_IMPORTED_MODULE_3__.safeConsole.log(transLbl(trans) + ": <- Success " + (0,_strings__WEBPACK_IMPORTED_MODULE_2__.stringify)(trans) + ", final state: " + finalState.name); + }; + /** @internal called by ui-router code */ + Trace.prototype.traceUIViewEvent = function (event, viewData, extra) { + if (extra === void 0) { extra = ''; } + if (!this.enabled(Category.UIVIEW)) + return; + _safeConsole__WEBPACK_IMPORTED_MODULE_3__.safeConsole.log("ui-view: " + (0,_strings__WEBPACK_IMPORTED_MODULE_2__.padString)(30, event) + " " + uiViewString(viewData) + extra); + }; + /** @internal called by ui-router code */ + Trace.prototype.traceUIViewConfigUpdated = function (viewData, context) { + if (!this.enabled(Category.UIVIEW)) + return; + this.traceUIViewEvent('Updating', viewData, " with ViewConfig from context='" + context + "'"); + }; + /** @internal called by ui-router code */ + Trace.prototype.traceUIViewFill = function (viewData, html) { + if (!this.enabled(Category.UIVIEW)) + return; + this.traceUIViewEvent('Fill', viewData, " with: " + (0,_strings__WEBPACK_IMPORTED_MODULE_2__.maxLength)(200, html)); + }; + /** @internal called by ui-router code */ + Trace.prototype.traceViewSync = function (pairs) { + if (!this.enabled(Category.VIEWCONFIG)) + return; + var uivheader = 'uiview component fqn'; + var cfgheader = 'view config state (view name)'; + var mapping = pairs + .map(function (_a) { + var _b; + var uiView = _a.uiView, viewConfig = _a.viewConfig; + var uiv = uiView && uiView.fqn; + var cfg = viewConfig && viewConfig.viewDecl.$context.name + ": (" + viewConfig.viewDecl.$name + ")"; + return _b = {}, _b[uivheader] = uiv, _b[cfgheader] = cfg, _b; + }) + .sort(function (a, b) { return (a[uivheader] || '').localeCompare(b[uivheader] || ''); }); + _safeConsole__WEBPACK_IMPORTED_MODULE_3__.safeConsole.table(mapping); + }; + /** @internal called by ui-router code */ + Trace.prototype.traceViewServiceEvent = function (event, viewConfig) { + if (!this.enabled(Category.VIEWCONFIG)) + return; + _safeConsole__WEBPACK_IMPORTED_MODULE_3__.safeConsole.log("VIEWCONFIG: " + event + " " + viewConfigString(viewConfig)); + }; + /** @internal called by ui-router code */ + Trace.prototype.traceViewServiceUIViewEvent = function (event, viewData) { + if (!this.enabled(Category.VIEWCONFIG)) + return; + _safeConsole__WEBPACK_IMPORTED_MODULE_3__.safeConsole.log("VIEWCONFIG: " + event + " " + uiViewString(viewData)); + }; + return Trace; +}()); + +/** + * The [[Trace]] singleton + * + * #### Example: + * ```js + * import {trace} from "@uirouter/core"; + * trace.enable(1, 5); + * ``` + */ +var trace = new Trace(); + +//# sourceMappingURL=trace.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/globals.js": +/*!********************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/globals.js ***! + \********************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "UIRouterGlobals": () => (/* binding */ UIRouterGlobals) +/* harmony export */ }); +/* harmony import */ var _params_stateParams__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./params/stateParams */ "./node_modules/@uirouter/core/lib-esm/params/stateParams.js"); +/* harmony import */ var _common_queue__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./common/queue */ "./node_modules/@uirouter/core/lib-esm/common/queue.js"); + + +/** + * Global router state + * + * This is where we hold the global mutable state such as current state, current + * params, current transition, etc. + */ +var UIRouterGlobals = /** @class */ (function () { + function UIRouterGlobals() { + /** + * Current parameter values + * + * The parameter values from the latest successful transition + */ + this.params = new _params_stateParams__WEBPACK_IMPORTED_MODULE_0__.StateParams(); + /** @internal */ + this.lastStartedTransitionId = -1; + /** @internal */ + this.transitionHistory = new _common_queue__WEBPACK_IMPORTED_MODULE_1__.Queue([], 1); + /** @internal */ + this.successfulTransitions = new _common_queue__WEBPACK_IMPORTED_MODULE_1__.Queue([], 1); + } + UIRouterGlobals.prototype.dispose = function () { + this.transitionHistory.clear(); + this.successfulTransitions.clear(); + this.transition = null; + }; + return UIRouterGlobals; +}()); + +//# sourceMappingURL=globals.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/hooks/coreResolvables.js": +/*!**********************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/hooks/coreResolvables.js ***! + \**********************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "registerAddCoreResolvables": () => (/* binding */ registerAddCoreResolvables), +/* harmony export */ "treeChangesCleanup": () => (/* binding */ treeChangesCleanup) +/* harmony export */ }); +/* harmony import */ var _transition_transition__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../transition/transition */ "./node_modules/@uirouter/core/lib-esm/transition/transition.js"); +/* harmony import */ var _router__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../router */ "./node_modules/@uirouter/core/lib-esm/router.js"); +/* harmony import */ var _resolve__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../resolve */ "./node_modules/@uirouter/core/lib-esm/resolve/index.js"); +/* harmony import */ var _common__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../common */ "./node_modules/@uirouter/core/lib-esm/common/index.js"); + + + + +function addCoreResolvables(trans) { + trans.addResolvable(_resolve__WEBPACK_IMPORTED_MODULE_2__.Resolvable.fromData(_router__WEBPACK_IMPORTED_MODULE_1__.UIRouter, trans.router), ''); + trans.addResolvable(_resolve__WEBPACK_IMPORTED_MODULE_2__.Resolvable.fromData(_transition_transition__WEBPACK_IMPORTED_MODULE_0__.Transition, trans), ''); + trans.addResolvable(_resolve__WEBPACK_IMPORTED_MODULE_2__.Resolvable.fromData('$transition$', trans), ''); + trans.addResolvable(_resolve__WEBPACK_IMPORTED_MODULE_2__.Resolvable.fromData('$stateParams', trans.params()), ''); + trans.entering().forEach(function (state) { + trans.addResolvable(_resolve__WEBPACK_IMPORTED_MODULE_2__.Resolvable.fromData('$state$', state), state); + }); +} +var registerAddCoreResolvables = function (transitionService) { + return transitionService.onCreate({}, addCoreResolvables); +}; +var TRANSITION_TOKENS = ['$transition$', _transition_transition__WEBPACK_IMPORTED_MODULE_0__.Transition]; +var isTransition = (0,_common__WEBPACK_IMPORTED_MODULE_3__.inArray)(TRANSITION_TOKENS); +// References to Transition in the treeChanges pathnodes makes all +// previous Transitions reachable in memory, causing a memory leak +// This function removes resolves for '$transition$' and `Transition` from the treeChanges. +// Do not use this on current transitions, only on old ones. +var treeChangesCleanup = function (trans) { + var nodes = (0,_common__WEBPACK_IMPORTED_MODULE_3__.values)(trans.treeChanges()).reduce(_common__WEBPACK_IMPORTED_MODULE_3__.unnestR, []).reduce(_common__WEBPACK_IMPORTED_MODULE_3__.uniqR, []); + // If the resolvable is a Transition, return a new resolvable with null data + var replaceTransitionWithNull = function (r) { + return isTransition(r.token) ? _resolve__WEBPACK_IMPORTED_MODULE_2__.Resolvable.fromData(r.token, null) : r; + }; + nodes.forEach(function (node) { + node.resolvables = node.resolvables.map(replaceTransitionWithNull); + }); +}; +//# sourceMappingURL=coreResolvables.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/hooks/ignoredTransition.js": +/*!************************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/hooks/ignoredTransition.js ***! + \************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "registerIgnoredTransitionHook": () => (/* binding */ registerIgnoredTransitionHook) +/* harmony export */ }); +/* harmony import */ var _common_trace__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/trace */ "./node_modules/@uirouter/core/lib-esm/common/trace.js"); +/* harmony import */ var _transition_rejectFactory__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../transition/rejectFactory */ "./node_modules/@uirouter/core/lib-esm/transition/rejectFactory.js"); + + +/** + * A [[TransitionHookFn]] that skips a transition if it should be ignored + * + * This hook is invoked at the end of the onBefore phase. + * + * If the transition should be ignored (because no parameter or states changed) + * then the transition is ignored and not processed. + */ +function ignoredHook(trans) { + var ignoredReason = trans._ignoredReason(); + if (!ignoredReason) + return; + _common_trace__WEBPACK_IMPORTED_MODULE_0__.trace.traceTransitionIgnored(trans); + var pending = trans.router.globals.transition; + // The user clicked a link going back to the *current state* ('A') + // However, there is also a pending transition in flight (to 'B') + // Abort the transition to 'B' because the user now wants to be back at 'A'. + if (ignoredReason === 'SameAsCurrent' && pending) { + pending.abort(); + } + return _transition_rejectFactory__WEBPACK_IMPORTED_MODULE_1__.Rejection.ignored().toPromise(); +} +var registerIgnoredTransitionHook = function (transitionService) { + return transitionService.onBefore({}, ignoredHook, { priority: -9999 }); +}; +//# sourceMappingURL=ignoredTransition.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/hooks/invalidTransition.js": +/*!************************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/hooks/invalidTransition.js ***! + \************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "registerInvalidTransitionHook": () => (/* binding */ registerInvalidTransitionHook) +/* harmony export */ }); +/** + * A [[TransitionHookFn]] that rejects the Transition if it is invalid + * + * This hook is invoked at the end of the onBefore phase. + * If the transition is invalid (for example, param values do not validate) + * then the transition is rejected. + */ +function invalidTransitionHook(trans) { + if (!trans.valid()) { + throw new Error(trans.error().toString()); + } +} +var registerInvalidTransitionHook = function (transitionService) { + return transitionService.onBefore({}, invalidTransitionHook, { priority: -10000 }); +}; +//# sourceMappingURL=invalidTransition.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/hooks/lazyLoad.js": +/*!***************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/hooks/lazyLoad.js ***! + \***************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "registerLazyLoadHook": () => (/* binding */ registerLazyLoadHook), +/* harmony export */ "lazyLoadState": () => (/* binding */ lazyLoadState) +/* harmony export */ }); +/* harmony import */ var _common_coreservices__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/coreservices */ "./node_modules/@uirouter/core/lib-esm/common/coreservices.js"); + +/** + * A [[TransitionHookFn]] that performs lazy loading + * + * When entering a state "abc" which has a `lazyLoad` function defined: + * - Invoke the `lazyLoad` function (unless it is already in process) + * - Flag the hook function as "in process" + * - The function should return a promise (that resolves when lazy loading is complete) + * - Wait for the promise to settle + * - If the promise resolves to a [[LazyLoadResult]], then register those states + * - Flag the hook function as "not in process" + * - If the hook was successful + * - Remove the `lazyLoad` function from the state declaration + * - If all the hooks were successful + * - Retry the transition (by returning a TargetState) + * + * ``` + * .state('abc', { + * component: 'fooComponent', + * lazyLoad: () => import('./fooComponent') + * }); + * ``` + * + * See [[StateDeclaration.lazyLoad]] + */ +var lazyLoadHook = function (transition) { + var router = transition.router; + function retryTransition() { + if (transition.originalTransition().options().source !== 'url') { + // The original transition was not triggered via url sync + // The lazy state should be loaded now, so re-try the original transition + var orig = transition.targetState(); + return router.stateService.target(orig.identifier(), orig.params(), orig.options()); + } + // The original transition was triggered via url sync + // Run the URL rules and find the best match + var $url = router.urlService; + var result = $url.match($url.parts()); + var rule = result && result.rule; + // If the best match is a state, redirect the transition (instead + // of calling sync() which supersedes the current transition) + if (rule && rule.type === 'STATE') { + var state = rule.state; + var params = result.match; + return router.stateService.target(state, params, transition.options()); + } + // No matching state found, so let .sync() choose the best non-state match/otherwise + router.urlService.sync(); + } + var promises = transition + .entering() + .filter(function (state) { return !!state.$$state().lazyLoad; }) + .map(function (state) { return lazyLoadState(transition, state); }); + return _common_coreservices__WEBPACK_IMPORTED_MODULE_0__.services.$q.all(promises).then(retryTransition); +}; +var registerLazyLoadHook = function (transitionService) { + return transitionService.onBefore({ entering: function (state) { return !!state.lazyLoad; } }, lazyLoadHook); +}; +/** + * Invokes a state's lazy load function + * + * @param transition a Transition context + * @param state the state to lazy load + * @returns A promise for the lazy load result + */ +function lazyLoadState(transition, state) { + var lazyLoadFn = state.$$state().lazyLoad; + // Store/get the lazy load promise on/from the hookfn so it doesn't get re-invoked + var promise = lazyLoadFn['_promise']; + if (!promise) { + var success = function (result) { + delete state.lazyLoad; + delete state.$$state().lazyLoad; + delete lazyLoadFn['_promise']; + return result; + }; + var error = function (err) { + delete lazyLoadFn['_promise']; + return _common_coreservices__WEBPACK_IMPORTED_MODULE_0__.services.$q.reject(err); + }; + promise = lazyLoadFn['_promise'] = _common_coreservices__WEBPACK_IMPORTED_MODULE_0__.services.$q.when(lazyLoadFn(transition, state)) + .then(updateStateRegistry) + .then(success, error); + } + /** Register any lazy loaded state definitions */ + function updateStateRegistry(result) { + if (result && Array.isArray(result.states)) { + result.states.forEach(function (_state) { return transition.router.stateRegistry.register(_state); }); + } + return result; + } + return promise; +} +//# sourceMappingURL=lazyLoad.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/hooks/onEnterExitRetain.js": +/*!************************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/hooks/onEnterExitRetain.js ***! + \************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "registerOnExitHook": () => (/* binding */ registerOnExitHook), +/* harmony export */ "registerOnRetainHook": () => (/* binding */ registerOnRetainHook), +/* harmony export */ "registerOnEnterHook": () => (/* binding */ registerOnEnterHook) +/* harmony export */ }); +/** + * A factory which creates an onEnter, onExit or onRetain transition hook function + * + * The returned function invokes the (for instance) state.onEnter hook when the + * state is being entered. + */ +function makeEnterExitRetainHook(hookName) { + return function (transition, state) { + var _state = state.$$state(); + var hookFn = _state[hookName]; + return hookFn(transition, state); + }; +} +/** + * The [[TransitionStateHookFn]] for onExit + * + * When the state is being exited, the state's .onExit function is invoked. + * + * Registered using `transitionService.onExit({ exiting: (state) => !!state.onExit }, onExitHook);` + * + * See: [[IHookRegistry.onExit]] + */ +var onExitHook = makeEnterExitRetainHook('onExit'); +var registerOnExitHook = function (transitionService) { + return transitionService.onExit({ exiting: function (state) { return !!state.onExit; } }, onExitHook); +}; +/** + * The [[TransitionStateHookFn]] for onRetain + * + * When the state was already entered, and is not being exited or re-entered, the state's .onRetain function is invoked. + * + * Registered using `transitionService.onRetain({ retained: (state) => !!state.onRetain }, onRetainHook);` + * + * See: [[IHookRegistry.onRetain]] + */ +var onRetainHook = makeEnterExitRetainHook('onRetain'); +var registerOnRetainHook = function (transitionService) { + return transitionService.onRetain({ retained: function (state) { return !!state.onRetain; } }, onRetainHook); +}; +/** + * The [[TransitionStateHookFn]] for onEnter + * + * When the state is being entered, the state's .onEnter function is invoked. + * + * Registered using `transitionService.onEnter({ entering: (state) => !!state.onEnter }, onEnterHook);` + * + * See: [[IHookRegistry.onEnter]] + */ +var onEnterHook = makeEnterExitRetainHook('onEnter'); +var registerOnEnterHook = function (transitionService) { + return transitionService.onEnter({ entering: function (state) { return !!state.onEnter; } }, onEnterHook); +}; +//# sourceMappingURL=onEnterExitRetain.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/hooks/redirectTo.js": +/*!*****************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/hooks/redirectTo.js ***! + \*****************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "registerRedirectToHook": () => (/* binding */ registerRedirectToHook) +/* harmony export */ }); +/* harmony import */ var _common_predicates__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/predicates */ "./node_modules/@uirouter/core/lib-esm/common/predicates.js"); +/* harmony import */ var _common_coreservices__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/coreservices */ "./node_modules/@uirouter/core/lib-esm/common/coreservices.js"); +/* harmony import */ var _state_targetState__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../state/targetState */ "./node_modules/@uirouter/core/lib-esm/state/targetState.js"); + + + +/** + * A [[TransitionHookFn]] that redirects to a different state or params + * + * Registered using `transitionService.onStart({ to: (state) => !!state.redirectTo }, redirectHook);` + * + * See [[StateDeclaration.redirectTo]] + */ +var redirectToHook = function (trans) { + var redirect = trans.to().redirectTo; + if (!redirect) + return; + var $state = trans.router.stateService; + function handleResult(result) { + if (!result) + return; + if (result instanceof _state_targetState__WEBPACK_IMPORTED_MODULE_2__.TargetState) + return result; + if ((0,_common_predicates__WEBPACK_IMPORTED_MODULE_0__.isString)(result)) + return $state.target(result, trans.params(), trans.options()); + if (result['state'] || result['params']) + return $state.target(result['state'] || trans.to(), result['params'] || trans.params(), trans.options()); + } + if ((0,_common_predicates__WEBPACK_IMPORTED_MODULE_0__.isFunction)(redirect)) { + return _common_coreservices__WEBPACK_IMPORTED_MODULE_1__.services.$q.when(redirect(trans)).then(handleResult); + } + return handleResult(redirect); +}; +var registerRedirectToHook = function (transitionService) { + return transitionService.onStart({ to: function (state) { return !!state.redirectTo; } }, redirectToHook); +}; +//# sourceMappingURL=redirectTo.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/hooks/resolve.js": +/*!**************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/hooks/resolve.js ***! + \**************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "RESOLVE_HOOK_PRIORITY": () => (/* binding */ RESOLVE_HOOK_PRIORITY), +/* harmony export */ "registerEagerResolvePath": () => (/* binding */ registerEagerResolvePath), +/* harmony export */ "registerLazyResolveState": () => (/* binding */ registerLazyResolveState), +/* harmony export */ "registerResolveRemaining": () => (/* binding */ registerResolveRemaining) +/* harmony export */ }); +/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/common */ "./node_modules/@uirouter/core/lib-esm/common/common.js"); +/* harmony import */ var _resolve_resolveContext__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../resolve/resolveContext */ "./node_modules/@uirouter/core/lib-esm/resolve/resolveContext.js"); +/* harmony import */ var _common_hof__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../common/hof */ "./node_modules/@uirouter/core/lib-esm/common/hof.js"); + + + +var RESOLVE_HOOK_PRIORITY = 1000; +/** + * A [[TransitionHookFn]] which resolves all EAGER Resolvables in the To Path + * + * Registered using `transitionService.onStart({}, eagerResolvePath, { priority: 1000 });` + * + * When a Transition starts, this hook resolves all the EAGER Resolvables, which the transition then waits for. + * + * See [[StateDeclaration.resolve]] + */ +var eagerResolvePath = function (trans) { + return new _resolve_resolveContext__WEBPACK_IMPORTED_MODULE_1__.ResolveContext(trans.treeChanges().to).resolvePath('EAGER', trans).then(_common_common__WEBPACK_IMPORTED_MODULE_0__.noop); +}; +var registerEagerResolvePath = function (transitionService) { + return transitionService.onStart({}, eagerResolvePath, { priority: RESOLVE_HOOK_PRIORITY }); +}; +/** + * A [[TransitionHookFn]] which resolves all LAZY Resolvables for the state (and all its ancestors) in the To Path + * + * Registered using `transitionService.onEnter({ entering: () => true }, lazyResolveState, { priority: 1000 });` + * + * When a State is being entered, this hook resolves all the Resolvables for this state, which the transition then waits for. + * + * See [[StateDeclaration.resolve]] + */ +var lazyResolveState = function (trans, state) { + return new _resolve_resolveContext__WEBPACK_IMPORTED_MODULE_1__.ResolveContext(trans.treeChanges().to).subContext(state.$$state()).resolvePath('LAZY', trans).then(_common_common__WEBPACK_IMPORTED_MODULE_0__.noop); +}; +var registerLazyResolveState = function (transitionService) { + return transitionService.onEnter({ entering: (0,_common_hof__WEBPACK_IMPORTED_MODULE_2__.val)(true) }, lazyResolveState, { priority: RESOLVE_HOOK_PRIORITY }); +}; +/** + * A [[TransitionHookFn]] which resolves any dynamically added (LAZY or EAGER) Resolvables. + * + * Registered using `transitionService.onFinish({}, eagerResolvePath, { priority: 1000 });` + * + * After all entering states have been entered, this hook resolves any remaining Resolvables. + * These are typically dynamic resolves which were added by some Transition Hook using [[Transition.addResolvable]]. + * + * See [[StateDeclaration.resolve]] + */ +var resolveRemaining = function (trans) { + return new _resolve_resolveContext__WEBPACK_IMPORTED_MODULE_1__.ResolveContext(trans.treeChanges().to).resolvePath('LAZY', trans).then(_common_common__WEBPACK_IMPORTED_MODULE_0__.noop); +}; +var registerResolveRemaining = function (transitionService) { + return transitionService.onFinish({}, resolveRemaining, { priority: RESOLVE_HOOK_PRIORITY }); +}; +//# sourceMappingURL=resolve.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/hooks/updateGlobals.js": +/*!********************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/hooks/updateGlobals.js ***! + \********************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "registerUpdateGlobalState": () => (/* binding */ registerUpdateGlobalState) +/* harmony export */ }); +/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/common */ "./node_modules/@uirouter/core/lib-esm/common/common.js"); + +/** + * A [[TransitionHookFn]] which updates global UI-Router state + * + * Registered using `transitionService.onBefore({}, updateGlobalState);` + * + * Before a [[Transition]] starts, updates the global value of "the current transition" ([[Globals.transition]]). + * After a successful [[Transition]], updates the global values of "the current state" + * ([[Globals.current]] and [[Globals.$current]]) and "the current param values" ([[Globals.params]]). + * + * See also the deprecated properties: + * [[StateService.transition]], [[StateService.current]], [[StateService.params]] + */ +var updateGlobalState = function (trans) { + var globals = trans.router.globals; + var transitionSuccessful = function () { + globals.successfulTransitions.enqueue(trans); + globals.$current = trans.$to(); + globals.current = globals.$current.self; + (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.copy)(trans.params(), globals.params); + }; + var clearCurrentTransition = function () { + // Do not clear globals.transition if a different transition has started in the meantime + if (globals.transition === trans) + globals.transition = null; + }; + trans.onSuccess({}, transitionSuccessful, { priority: 10000 }); + trans.promise.then(clearCurrentTransition, clearCurrentTransition); +}; +var registerUpdateGlobalState = function (transitionService) { + return transitionService.onCreate({}, updateGlobalState); +}; +//# sourceMappingURL=updateGlobals.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/hooks/url.js": +/*!**********************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/hooks/url.js ***! + \**********************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "registerUpdateUrl": () => (/* binding */ registerUpdateUrl) +/* harmony export */ }); +/** + * A [[TransitionHookFn]] which updates the URL after a successful transition + * + * Registered using `transitionService.onSuccess({}, updateUrl);` + */ +var updateUrl = function (transition) { + var options = transition.options(); + var $state = transition.router.stateService; + var $urlRouter = transition.router.urlRouter; + // Dont update the url in these situations: + // The transition was triggered by a URL sync (options.source === 'url') + // The user doesn't want the url to update (options.location === false) + // The destination state, and all parents have no navigable url + if (options.source !== 'url' && options.location && $state.$current.navigable) { + var urlOptions = { replace: options.location === 'replace' }; + $urlRouter.push($state.$current.navigable.url, $state.params, urlOptions); + } + $urlRouter.update(true); +}; +var registerUpdateUrl = function (transitionService) { + return transitionService.onSuccess({}, updateUrl, { priority: 9999 }); +}; +//# sourceMappingURL=url.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/hooks/views.js": +/*!************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/hooks/views.js ***! + \************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "registerLoadEnteringViews": () => (/* binding */ registerLoadEnteringViews), +/* harmony export */ "registerActivateViews": () => (/* binding */ registerActivateViews) +/* harmony export */ }); +/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/common */ "./node_modules/@uirouter/core/lib-esm/common/common.js"); +/* harmony import */ var _common_coreservices__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/coreservices */ "./node_modules/@uirouter/core/lib-esm/common/coreservices.js"); + + +/** + * A [[TransitionHookFn]] which waits for the views to load + * + * Registered using `transitionService.onStart({}, loadEnteringViews);` + * + * Allows the views to do async work in [[ViewConfig.load]] before the transition continues. + * In angular 1, this includes loading the templates. + */ +var loadEnteringViews = function (transition) { + var $q = _common_coreservices__WEBPACK_IMPORTED_MODULE_1__.services.$q; + var enteringViews = transition.views('entering'); + if (!enteringViews.length) + return; + return $q.all(enteringViews.map(function (view) { return $q.when(view.load()); })).then(_common_common__WEBPACK_IMPORTED_MODULE_0__.noop); +}; +var registerLoadEnteringViews = function (transitionService) { + return transitionService.onFinish({}, loadEnteringViews); +}; +/** + * A [[TransitionHookFn]] which activates the new views when a transition is successful. + * + * Registered using `transitionService.onSuccess({}, activateViews);` + * + * After a transition is complete, this hook deactivates the old views from the previous state, + * and activates the new views from the destination state. + * + * See [[ViewService]] + */ +var activateViews = function (transition) { + var enteringViews = transition.views('entering'); + var exitingViews = transition.views('exiting'); + if (!enteringViews.length && !exitingViews.length) + return; + var $view = transition.router.viewService; + exitingViews.forEach(function (vc) { return $view.deactivateViewConfig(vc); }); + enteringViews.forEach(function (vc) { return $view.activateViewConfig(vc); }); + $view.sync(); +}; +var registerActivateViews = function (transitionService) { + return transitionService.onSuccess({}, activateViews); +}; +//# sourceMappingURL=views.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/index.js": +/*!******************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/index.js ***! + \******************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "Category": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.Category), +/* harmony export */ "Glob": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.Glob), +/* harmony export */ "Queue": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.Queue), +/* harmony export */ "Trace": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.Trace), +/* harmony export */ "_extend": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__._extend), +/* harmony export */ "_inArray": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__._inArray), +/* harmony export */ "_pushTo": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__._pushTo), +/* harmony export */ "_removeFrom": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__._removeFrom), +/* harmony export */ "all": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.all), +/* harmony export */ "allTrueR": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.allTrueR), +/* harmony export */ "ancestors": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.ancestors), +/* harmony export */ "and": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.and), +/* harmony export */ "any": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.any), +/* harmony export */ "anyTrueR": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.anyTrueR), +/* harmony export */ "applyPairs": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.applyPairs), +/* harmony export */ "arrayTuples": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.arrayTuples), +/* harmony export */ "assertFn": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.assertFn), +/* harmony export */ "assertMap": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.assertMap), +/* harmony export */ "assertPredicate": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.assertPredicate), +/* harmony export */ "beforeAfterSubstr": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.beforeAfterSubstr), +/* harmony export */ "compose": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.compose), +/* harmony export */ "copy": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.copy), +/* harmony export */ "createProxyFunctions": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.createProxyFunctions), +/* harmony export */ "curry": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.curry), +/* harmony export */ "defaults": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.defaults), +/* harmony export */ "deregAll": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.deregAll), +/* harmony export */ "eq": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.eq), +/* harmony export */ "equals": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.equals), +/* harmony export */ "extend": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.extend), +/* harmony export */ "filter": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.filter), +/* harmony export */ "find": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.find), +/* harmony export */ "flatten": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.flatten), +/* harmony export */ "flattenR": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.flattenR), +/* harmony export */ "fnToString": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.fnToString), +/* harmony export */ "forEach": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.forEach), +/* harmony export */ "fromJson": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.fromJson), +/* harmony export */ "functionToString": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.functionToString), +/* harmony export */ "hostRegex": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.hostRegex), +/* harmony export */ "identity": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.identity), +/* harmony export */ "inArray": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.inArray), +/* harmony export */ "inherit": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.inherit), +/* harmony export */ "invoke": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.invoke), +/* harmony export */ "is": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.is), +/* harmony export */ "isArray": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.isArray), +/* harmony export */ "isDate": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.isDate), +/* harmony export */ "isDefined": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.isDefined), +/* harmony export */ "isFunction": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.isFunction), +/* harmony export */ "isInjectable": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.isInjectable), +/* harmony export */ "isNull": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.isNull), +/* harmony export */ "isNullOrUndefined": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.isNullOrUndefined), +/* harmony export */ "isNumber": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.isNumber), +/* harmony export */ "isObject": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.isObject), +/* harmony export */ "isPromise": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.isPromise), +/* harmony export */ "isRegExp": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.isRegExp), +/* harmony export */ "isString": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.isString), +/* harmony export */ "isUndefined": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.isUndefined), +/* harmony export */ "joinNeighborsR": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.joinNeighborsR), +/* harmony export */ "kebobString": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.kebobString), +/* harmony export */ "makeStub": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.makeStub), +/* harmony export */ "map": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.map), +/* harmony export */ "mapObj": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.mapObj), +/* harmony export */ "maxLength": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.maxLength), +/* harmony export */ "mergeR": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.mergeR), +/* harmony export */ "noop": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.noop), +/* harmony export */ "not": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.not), +/* harmony export */ "omit": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.omit), +/* harmony export */ "or": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.or), +/* harmony export */ "padString": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.padString), +/* harmony export */ "pairs": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.pairs), +/* harmony export */ "parse": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.parse), +/* harmony export */ "pattern": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.pattern), +/* harmony export */ "pick": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.pick), +/* harmony export */ "pipe": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.pipe), +/* harmony export */ "pluck": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.pluck), +/* harmony export */ "prop": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.prop), +/* harmony export */ "propEq": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.propEq), +/* harmony export */ "pushR": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.pushR), +/* harmony export */ "pushTo": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.pushTo), +/* harmony export */ "removeFrom": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.removeFrom), +/* harmony export */ "root": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.root), +/* harmony export */ "services": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.services), +/* harmony export */ "silenceUncaughtInPromise": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.silenceUncaughtInPromise), +/* harmony export */ "silentRejection": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.silentRejection), +/* harmony export */ "splitEqual": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.splitEqual), +/* harmony export */ "splitHash": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.splitHash), +/* harmony export */ "splitOnDelim": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.splitOnDelim), +/* harmony export */ "splitQuery": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.splitQuery), +/* harmony export */ "stringify": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.stringify), +/* harmony export */ "stripLastPathElement": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.stripLastPathElement), +/* harmony export */ "tail": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.tail), +/* harmony export */ "toJson": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.toJson), +/* harmony export */ "trace": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.trace), +/* harmony export */ "trimHashVal": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.trimHashVal), +/* harmony export */ "uniqR": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.uniqR), +/* harmony export */ "unnest": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.unnest), +/* harmony export */ "unnestR": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.unnestR), +/* harmony export */ "val": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.val), +/* harmony export */ "values": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.values), +/* harmony export */ "PathNode": () => (/* reexport safe */ _path_index__WEBPACK_IMPORTED_MODULE_2__.PathNode), +/* harmony export */ "PathUtils": () => (/* reexport safe */ _path_index__WEBPACK_IMPORTED_MODULE_2__.PathUtils), +/* harmony export */ "NATIVE_INJECTOR_TOKEN": () => (/* reexport safe */ _resolve_index__WEBPACK_IMPORTED_MODULE_3__.NATIVE_INJECTOR_TOKEN), +/* harmony export */ "Resolvable": () => (/* reexport safe */ _resolve_index__WEBPACK_IMPORTED_MODULE_3__.Resolvable), +/* harmony export */ "ResolveContext": () => (/* reexport safe */ _resolve_index__WEBPACK_IMPORTED_MODULE_3__.ResolveContext), +/* harmony export */ "defaultResolvePolicy": () => (/* reexport safe */ _resolve_index__WEBPACK_IMPORTED_MODULE_3__.defaultResolvePolicy), +/* harmony export */ "resolvePolicies": () => (/* reexport safe */ _resolve_index__WEBPACK_IMPORTED_MODULE_3__.resolvePolicies), +/* harmony export */ "HookBuilder": () => (/* reexport safe */ _transition_index__WEBPACK_IMPORTED_MODULE_5__.HookBuilder), +/* harmony export */ "RegisteredHook": () => (/* reexport safe */ _transition_index__WEBPACK_IMPORTED_MODULE_5__.RegisteredHook), +/* harmony export */ "RejectType": () => (/* reexport safe */ _transition_index__WEBPACK_IMPORTED_MODULE_5__.RejectType), +/* harmony export */ "Rejection": () => (/* reexport safe */ _transition_index__WEBPACK_IMPORTED_MODULE_5__.Rejection), +/* harmony export */ "Transition": () => (/* reexport safe */ _transition_index__WEBPACK_IMPORTED_MODULE_5__.Transition), +/* harmony export */ "TransitionEventType": () => (/* reexport safe */ _transition_index__WEBPACK_IMPORTED_MODULE_5__.TransitionEventType), +/* harmony export */ "TransitionHook": () => (/* reexport safe */ _transition_index__WEBPACK_IMPORTED_MODULE_5__.TransitionHook), +/* harmony export */ "TransitionHookPhase": () => (/* reexport safe */ _transition_index__WEBPACK_IMPORTED_MODULE_5__.TransitionHookPhase), +/* harmony export */ "TransitionHookScope": () => (/* reexport safe */ _transition_index__WEBPACK_IMPORTED_MODULE_5__.TransitionHookScope), +/* harmony export */ "TransitionService": () => (/* reexport safe */ _transition_index__WEBPACK_IMPORTED_MODULE_5__.TransitionService), +/* harmony export */ "defaultTransOpts": () => (/* reexport safe */ _transition_index__WEBPACK_IMPORTED_MODULE_5__.defaultTransOpts), +/* harmony export */ "makeEvent": () => (/* reexport safe */ _transition_index__WEBPACK_IMPORTED_MODULE_5__.makeEvent), +/* harmony export */ "matchState": () => (/* reexport safe */ _transition_index__WEBPACK_IMPORTED_MODULE_5__.matchState), +/* harmony export */ "UIRouterGlobals": () => (/* reexport safe */ _globals__WEBPACK_IMPORTED_MODULE_8__.UIRouterGlobals), +/* harmony export */ "UIRouter": () => (/* reexport safe */ _router__WEBPACK_IMPORTED_MODULE_9__.UIRouter), +/* harmony export */ "UIRouterPluginBase": () => (/* reexport safe */ _interface__WEBPACK_IMPORTED_MODULE_11__.UIRouterPluginBase) +/* harmony export */ }); +/* harmony import */ var _common_index__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./common/index */ "./node_modules/@uirouter/core/lib-esm/common/index.js"); +/* harmony import */ var _params_index__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./params/index */ "./node_modules/@uirouter/core/lib-esm/params/index.js"); +/* harmony reexport (unknown) */ var __WEBPACK_REEXPORT_OBJECT__ = {}; +/* harmony reexport (unknown) */ for(const __WEBPACK_IMPORT_KEY__ in _params_index__WEBPACK_IMPORTED_MODULE_1__) if(["default","Category","Glob","Queue","Trace","_extend","_inArray","_pushTo","_removeFrom","all","allTrueR","ancestors","and","any","anyTrueR","applyPairs","arrayTuples","assertFn","assertMap","assertPredicate","beforeAfterSubstr","compose","copy","createProxyFunctions","curry","defaults","deregAll","eq","equals","extend","filter","find","flatten","flattenR","fnToString","forEach","fromJson","functionToString","hostRegex","identity","inArray","inherit","invoke","is","isArray","isDate","isDefined","isFunction","isInjectable","isNull","isNullOrUndefined","isNumber","isObject","isPromise","isRegExp","isString","isUndefined","joinNeighborsR","kebobString","makeStub","map","mapObj","maxLength","mergeR","noop","not","omit","or","padString","pairs","parse","pattern","pick","pipe","pluck","prop","propEq","pushR","pushTo","removeFrom","root","services","silenceUncaughtInPromise","silentRejection","splitEqual","splitHash","splitOnDelim","splitQuery","stringify","stripLastPathElement","tail","toJson","trace","trimHashVal","uniqR","unnest","unnestR","val","values"].indexOf(__WEBPACK_IMPORT_KEY__) < 0) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = () => _params_index__WEBPACK_IMPORTED_MODULE_1__[__WEBPACK_IMPORT_KEY__] +/* harmony reexport (unknown) */ __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__); +/* harmony import */ var _path_index__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./path/index */ "./node_modules/@uirouter/core/lib-esm/path/index.js"); +/* harmony import */ var _resolve_index__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./resolve/index */ "./node_modules/@uirouter/core/lib-esm/resolve/index.js"); +/* harmony import */ var _state_index__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./state/index */ "./node_modules/@uirouter/core/lib-esm/state/index.js"); +/* harmony reexport (unknown) */ var __WEBPACK_REEXPORT_OBJECT__ = {}; +/* harmony reexport (unknown) */ for(const __WEBPACK_IMPORT_KEY__ in _state_index__WEBPACK_IMPORTED_MODULE_4__) if(["default","Category","Glob","Queue","Trace","_extend","_inArray","_pushTo","_removeFrom","all","allTrueR","ancestors","and","any","anyTrueR","applyPairs","arrayTuples","assertFn","assertMap","assertPredicate","beforeAfterSubstr","compose","copy","createProxyFunctions","curry","defaults","deregAll","eq","equals","extend","filter","find","flatten","flattenR","fnToString","forEach","fromJson","functionToString","hostRegex","identity","inArray","inherit","invoke","is","isArray","isDate","isDefined","isFunction","isInjectable","isNull","isNullOrUndefined","isNumber","isObject","isPromise","isRegExp","isString","isUndefined","joinNeighborsR","kebobString","makeStub","map","mapObj","maxLength","mergeR","noop","not","omit","or","padString","pairs","parse","pattern","pick","pipe","pluck","prop","propEq","pushR","pushTo","removeFrom","root","services","silenceUncaughtInPromise","silentRejection","splitEqual","splitHash","splitOnDelim","splitQuery","stringify","stripLastPathElement","tail","toJson","trace","trimHashVal","uniqR","unnest","unnestR","val","values","DefType","Param","ParamType","ParamTypes","StateParams","PathNode","PathUtils","NATIVE_INJECTOR_TOKEN","Resolvable","ResolveContext","defaultResolvePolicy","resolvePolicies"].indexOf(__WEBPACK_IMPORT_KEY__) < 0) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = () => _state_index__WEBPACK_IMPORTED_MODULE_4__[__WEBPACK_IMPORT_KEY__] +/* harmony reexport (unknown) */ __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__); +/* harmony import */ var _transition_index__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./transition/index */ "./node_modules/@uirouter/core/lib-esm/transition/index.js"); +/* harmony import */ var _url_index__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./url/index */ "./node_modules/@uirouter/core/lib-esm/url/index.js"); +/* harmony reexport (unknown) */ var __WEBPACK_REEXPORT_OBJECT__ = {}; +/* harmony reexport (unknown) */ for(const __WEBPACK_IMPORT_KEY__ in _url_index__WEBPACK_IMPORTED_MODULE_6__) if(["default","Category","Glob","Queue","Trace","_extend","_inArray","_pushTo","_removeFrom","all","allTrueR","ancestors","and","any","anyTrueR","applyPairs","arrayTuples","assertFn","assertMap","assertPredicate","beforeAfterSubstr","compose","copy","createProxyFunctions","curry","defaults","deregAll","eq","equals","extend","filter","find","flatten","flattenR","fnToString","forEach","fromJson","functionToString","hostRegex","identity","inArray","inherit","invoke","is","isArray","isDate","isDefined","isFunction","isInjectable","isNull","isNullOrUndefined","isNumber","isObject","isPromise","isRegExp","isString","isUndefined","joinNeighborsR","kebobString","makeStub","map","mapObj","maxLength","mergeR","noop","not","omit","or","padString","pairs","parse","pattern","pick","pipe","pluck","prop","propEq","pushR","pushTo","removeFrom","root","services","silenceUncaughtInPromise","silentRejection","splitEqual","splitHash","splitOnDelim","splitQuery","stringify","stripLastPathElement","tail","toJson","trace","trimHashVal","uniqR","unnest","unnestR","val","values","DefType","Param","ParamType","ParamTypes","StateParams","PathNode","PathUtils","NATIVE_INJECTOR_TOKEN","Resolvable","ResolveContext","defaultResolvePolicy","resolvePolicies","StateBuilder","StateMatcher","StateObject","StateQueueManager","StateRegistry","StateService","TargetState","resolvablesBuilder","HookBuilder","RegisteredHook","RejectType","Rejection","Transition","TransitionEventType","TransitionHook","TransitionHookPhase","TransitionHookScope","TransitionService","defaultTransOpts","makeEvent","matchState"].indexOf(__WEBPACK_IMPORT_KEY__) < 0) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = () => _url_index__WEBPACK_IMPORTED_MODULE_6__[__WEBPACK_IMPORT_KEY__] +/* harmony reexport (unknown) */ __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__); +/* harmony import */ var _view_index__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./view/index */ "./node_modules/@uirouter/core/lib-esm/view/index.js"); +/* harmony reexport (unknown) */ var __WEBPACK_REEXPORT_OBJECT__ = {}; +/* harmony reexport (unknown) */ for(const __WEBPACK_IMPORT_KEY__ in _view_index__WEBPACK_IMPORTED_MODULE_7__) if(["default","Category","Glob","Queue","Trace","_extend","_inArray","_pushTo","_removeFrom","all","allTrueR","ancestors","and","any","anyTrueR","applyPairs","arrayTuples","assertFn","assertMap","assertPredicate","beforeAfterSubstr","compose","copy","createProxyFunctions","curry","defaults","deregAll","eq","equals","extend","filter","find","flatten","flattenR","fnToString","forEach","fromJson","functionToString","hostRegex","identity","inArray","inherit","invoke","is","isArray","isDate","isDefined","isFunction","isInjectable","isNull","isNullOrUndefined","isNumber","isObject","isPromise","isRegExp","isString","isUndefined","joinNeighborsR","kebobString","makeStub","map","mapObj","maxLength","mergeR","noop","not","omit","or","padString","pairs","parse","pattern","pick","pipe","pluck","prop","propEq","pushR","pushTo","removeFrom","root","services","silenceUncaughtInPromise","silentRejection","splitEqual","splitHash","splitOnDelim","splitQuery","stringify","stripLastPathElement","tail","toJson","trace","trimHashVal","uniqR","unnest","unnestR","val","values","DefType","Param","ParamType","ParamTypes","StateParams","PathNode","PathUtils","NATIVE_INJECTOR_TOKEN","Resolvable","ResolveContext","defaultResolvePolicy","resolvePolicies","StateBuilder","StateMatcher","StateObject","StateQueueManager","StateRegistry","StateService","TargetState","resolvablesBuilder","HookBuilder","RegisteredHook","RejectType","Rejection","Transition","TransitionEventType","TransitionHook","TransitionHookPhase","TransitionHookScope","TransitionService","defaultTransOpts","makeEvent","matchState","BaseUrlRule","ParamFactory","UrlConfig","UrlMatcher","UrlMatcherFactory","UrlRouter","UrlRuleFactory","UrlRules","UrlService"].indexOf(__WEBPACK_IMPORT_KEY__) < 0) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = () => _view_index__WEBPACK_IMPORTED_MODULE_7__[__WEBPACK_IMPORT_KEY__] +/* harmony reexport (unknown) */ __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__); +/* harmony import */ var _globals__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./globals */ "./node_modules/@uirouter/core/lib-esm/globals.js"); +/* harmony import */ var _router__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./router */ "./node_modules/@uirouter/core/lib-esm/router.js"); +/* harmony import */ var _vanilla__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./vanilla */ "./node_modules/@uirouter/core/lib-esm/vanilla.js"); +/* harmony reexport (unknown) */ var __WEBPACK_REEXPORT_OBJECT__ = {}; +/* harmony reexport (unknown) */ for(const __WEBPACK_IMPORT_KEY__ in _vanilla__WEBPACK_IMPORTED_MODULE_10__) if(["default","Category","Glob","Queue","Trace","_extend","_inArray","_pushTo","_removeFrom","all","allTrueR","ancestors","and","any","anyTrueR","applyPairs","arrayTuples","assertFn","assertMap","assertPredicate","beforeAfterSubstr","compose","copy","createProxyFunctions","curry","defaults","deregAll","eq","equals","extend","filter","find","flatten","flattenR","fnToString","forEach","fromJson","functionToString","hostRegex","identity","inArray","inherit","invoke","is","isArray","isDate","isDefined","isFunction","isInjectable","isNull","isNullOrUndefined","isNumber","isObject","isPromise","isRegExp","isString","isUndefined","joinNeighborsR","kebobString","makeStub","map","mapObj","maxLength","mergeR","noop","not","omit","or","padString","pairs","parse","pattern","pick","pipe","pluck","prop","propEq","pushR","pushTo","removeFrom","root","services","silenceUncaughtInPromise","silentRejection","splitEqual","splitHash","splitOnDelim","splitQuery","stringify","stripLastPathElement","tail","toJson","trace","trimHashVal","uniqR","unnest","unnestR","val","values","DefType","Param","ParamType","ParamTypes","StateParams","PathNode","PathUtils","NATIVE_INJECTOR_TOKEN","Resolvable","ResolveContext","defaultResolvePolicy","resolvePolicies","StateBuilder","StateMatcher","StateObject","StateQueueManager","StateRegistry","StateService","TargetState","resolvablesBuilder","HookBuilder","RegisteredHook","RejectType","Rejection","Transition","TransitionEventType","TransitionHook","TransitionHookPhase","TransitionHookScope","TransitionService","defaultTransOpts","makeEvent","matchState","BaseUrlRule","ParamFactory","UrlConfig","UrlMatcher","UrlMatcherFactory","UrlRouter","UrlRuleFactory","UrlRules","UrlService","ViewService","UIRouterGlobals","UIRouter"].indexOf(__WEBPACK_IMPORT_KEY__) < 0) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = () => _vanilla__WEBPACK_IMPORTED_MODULE_10__[__WEBPACK_IMPORT_KEY__] +/* harmony reexport (unknown) */ __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__); +/* harmony import */ var _interface__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./interface */ "./node_modules/@uirouter/core/lib-esm/interface.js"); + + + + + + + + + + + + +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/interface.js": +/*!**********************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/interface.js ***! + \**********************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "UIRouterPluginBase": () => (/* binding */ UIRouterPluginBase) +/* harmony export */ }); +var UIRouterPluginBase = /** @class */ (function () { + function UIRouterPluginBase() { + } + UIRouterPluginBase.prototype.dispose = function (router) { }; + return UIRouterPluginBase; +}()); + +//# sourceMappingURL=interface.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/params/index.js": +/*!*************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/params/index.js ***! + \*************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "DefType": () => (/* reexport safe */ _param__WEBPACK_IMPORTED_MODULE_1__.DefType), +/* harmony export */ "Param": () => (/* reexport safe */ _param__WEBPACK_IMPORTED_MODULE_1__.Param), +/* harmony export */ "ParamTypes": () => (/* reexport safe */ _paramTypes__WEBPACK_IMPORTED_MODULE_2__.ParamTypes), +/* harmony export */ "StateParams": () => (/* reexport safe */ _stateParams__WEBPACK_IMPORTED_MODULE_3__.StateParams), +/* harmony export */ "ParamType": () => (/* reexport safe */ _paramType__WEBPACK_IMPORTED_MODULE_4__.ParamType) +/* harmony export */ }); +/* harmony import */ var _interface__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./interface */ "./node_modules/@uirouter/core/lib-esm/params/interface.js"); +/* harmony import */ var _interface__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_interface__WEBPACK_IMPORTED_MODULE_0__); +/* harmony reexport (unknown) */ var __WEBPACK_REEXPORT_OBJECT__ = {}; +/* harmony reexport (unknown) */ for(const __WEBPACK_IMPORT_KEY__ in _interface__WEBPACK_IMPORTED_MODULE_0__) if(__WEBPACK_IMPORT_KEY__ !== "default") __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = () => _interface__WEBPACK_IMPORTED_MODULE_0__[__WEBPACK_IMPORT_KEY__] +/* harmony reexport (unknown) */ __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__); +/* harmony import */ var _param__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./param */ "./node_modules/@uirouter/core/lib-esm/params/param.js"); +/* harmony import */ var _paramTypes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./paramTypes */ "./node_modules/@uirouter/core/lib-esm/params/paramTypes.js"); +/* harmony import */ var _stateParams__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./stateParams */ "./node_modules/@uirouter/core/lib-esm/params/stateParams.js"); +/* harmony import */ var _paramType__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./paramType */ "./node_modules/@uirouter/core/lib-esm/params/paramType.js"); +/** + * This module contains code for State Parameters. + * + * See [[ParamDeclaration]] + * + * @packageDocumentation @preferred + */ + + + + + +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/params/interface.js": +/*!*****************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/params/interface.js ***! + \*****************************************************************/ +/***/ (() => { + +//# sourceMappingURL=interface.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/params/param.js": +/*!*************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/params/param.js ***! + \*************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "DefType": () => (/* binding */ DefType), +/* harmony export */ "Param": () => (/* binding */ Param) +/* harmony export */ }); +/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/common */ "./node_modules/@uirouter/core/lib-esm/common/common.js"); +/* harmony import */ var _common_hof__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/hof */ "./node_modules/@uirouter/core/lib-esm/common/hof.js"); +/* harmony import */ var _common_predicates__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../common/predicates */ "./node_modules/@uirouter/core/lib-esm/common/predicates.js"); +/* harmony import */ var _common_coreservices__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../common/coreservices */ "./node_modules/@uirouter/core/lib-esm/common/coreservices.js"); +/* harmony import */ var _paramType__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./paramType */ "./node_modules/@uirouter/core/lib-esm/params/paramType.js"); + + + + + +var hasOwn = Object.prototype.hasOwnProperty; +var isShorthand = function (cfg) { + return ['value', 'type', 'squash', 'array', 'dynamic'].filter(hasOwn.bind(cfg || {})).length === 0; +}; +var DefType; +(function (DefType) { + DefType[DefType["PATH"] = 0] = "PATH"; + DefType[DefType["SEARCH"] = 1] = "SEARCH"; + DefType[DefType["CONFIG"] = 2] = "CONFIG"; +})(DefType || (DefType = {})); + +function getParamDeclaration(paramName, location, state) { + var noReloadOnSearch = (state.reloadOnSearch === false && location === DefType.SEARCH) || undefined; + var dynamic = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.find)([state.dynamic, noReloadOnSearch], _common_predicates__WEBPACK_IMPORTED_MODULE_2__.isDefined); + var defaultConfig = (0,_common_predicates__WEBPACK_IMPORTED_MODULE_2__.isDefined)(dynamic) ? { dynamic: dynamic } : {}; + var paramConfig = unwrapShorthand(state && state.params && state.params[paramName]); + return (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.extend)(defaultConfig, paramConfig); +} +function unwrapShorthand(cfg) { + cfg = isShorthand(cfg) ? { value: cfg } : cfg; + getStaticDefaultValue['__cacheable'] = true; + function getStaticDefaultValue() { + return cfg.value; + } + var $$fn = (0,_common_predicates__WEBPACK_IMPORTED_MODULE_2__.isInjectable)(cfg.value) ? cfg.value : getStaticDefaultValue; + return (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.extend)(cfg, { $$fn: $$fn }); +} +function getType(cfg, urlType, location, id, paramTypes) { + if (cfg.type && urlType && urlType.name !== 'string') + throw new Error("Param '" + id + "' has two type configurations."); + if (cfg.type && urlType && urlType.name === 'string' && paramTypes.type(cfg.type)) + return paramTypes.type(cfg.type); + if (urlType) + return urlType; + if (!cfg.type) { + var type = location === DefType.CONFIG + ? 'any' + : location === DefType.PATH + ? 'path' + : location === DefType.SEARCH + ? 'query' + : 'string'; + return paramTypes.type(type); + } + return cfg.type instanceof _paramType__WEBPACK_IMPORTED_MODULE_4__.ParamType ? cfg.type : paramTypes.type(cfg.type); +} +/** returns false, true, or the squash value to indicate the "default parameter url squash policy". */ +function getSquashPolicy(config, isOptional, defaultPolicy) { + var squash = config.squash; + if (!isOptional || squash === false) + return false; + if (!(0,_common_predicates__WEBPACK_IMPORTED_MODULE_2__.isDefined)(squash) || squash == null) + return defaultPolicy; + if (squash === true || (0,_common_predicates__WEBPACK_IMPORTED_MODULE_2__.isString)(squash)) + return squash; + throw new Error("Invalid squash policy: '" + squash + "'. Valid policies: false, true, or arbitrary string"); +} +function getReplace(config, arrayMode, isOptional, squash) { + var defaultPolicy = [ + { from: '', to: isOptional || arrayMode ? undefined : '' }, + { from: null, to: isOptional || arrayMode ? undefined : '' }, + ]; + var replace = (0,_common_predicates__WEBPACK_IMPORTED_MODULE_2__.isArray)(config.replace) ? config.replace : []; + if ((0,_common_predicates__WEBPACK_IMPORTED_MODULE_2__.isString)(squash)) + replace.push({ from: squash, to: undefined }); + var configuredKeys = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.map)(replace, (0,_common_hof__WEBPACK_IMPORTED_MODULE_1__.prop)('from')); + return (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.filter)(defaultPolicy, function (item) { return configuredKeys.indexOf(item.from) === -1; }).concat(replace); +} +var Param = /** @class */ (function () { + function Param(id, type, location, urlConfig, state) { + var config = getParamDeclaration(id, location, state); + type = getType(config, type, location, id, urlConfig.paramTypes); + var arrayMode = getArrayMode(); + type = arrayMode ? type.$asArray(arrayMode, location === DefType.SEARCH) : type; + var isOptional = config.value !== undefined || location === DefType.SEARCH; + var dynamic = (0,_common_predicates__WEBPACK_IMPORTED_MODULE_2__.isDefined)(config.dynamic) ? !!config.dynamic : !!type.dynamic; + var raw = (0,_common_predicates__WEBPACK_IMPORTED_MODULE_2__.isDefined)(config.raw) ? !!config.raw : !!type.raw; + var squash = getSquashPolicy(config, isOptional, urlConfig.defaultSquashPolicy()); + var replace = getReplace(config, arrayMode, isOptional, squash); + var inherit = (0,_common_predicates__WEBPACK_IMPORTED_MODULE_2__.isDefined)(config.inherit) ? !!config.inherit : !!type.inherit; + // array config: param name (param[]) overrides default settings. explicit config overrides param name. + function getArrayMode() { + var arrayDefaults = { array: location === DefType.SEARCH ? 'auto' : false }; + var arrayParamNomenclature = id.match(/\[\]$/) ? { array: true } : {}; + return (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.extend)(arrayDefaults, arrayParamNomenclature, config).array; + } + (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.extend)(this, { id: id, type: type, location: location, isOptional: isOptional, dynamic: dynamic, raw: raw, squash: squash, replace: replace, inherit: inherit, array: arrayMode, config: config }); + } + Param.values = function (params, values) { + if (values === void 0) { values = {}; } + var paramValues = {}; + for (var _i = 0, params_1 = params; _i < params_1.length; _i++) { + var param = params_1[_i]; + paramValues[param.id] = param.value(values[param.id]); + } + return paramValues; + }; + /** + * Finds [[Param]] objects which have different param values + * + * Filters a list of [[Param]] objects to only those whose parameter values differ in two param value objects + * + * @param params: The list of Param objects to filter + * @param values1: The first set of parameter values + * @param values2: the second set of parameter values + * + * @returns any Param objects whose values were different between values1 and values2 + */ + Param.changed = function (params, values1, values2) { + if (values1 === void 0) { values1 = {}; } + if (values2 === void 0) { values2 = {}; } + return params.filter(function (param) { return !param.type.equals(values1[param.id], values2[param.id]); }); + }; + /** + * Checks if two param value objects are equal (for a set of [[Param]] objects) + * + * @param params The list of [[Param]] objects to check + * @param values1 The first set of param values + * @param values2 The second set of param values + * + * @returns true if the param values in values1 and values2 are equal + */ + Param.equals = function (params, values1, values2) { + if (values1 === void 0) { values1 = {}; } + if (values2 === void 0) { values2 = {}; } + return Param.changed(params, values1, values2).length === 0; + }; + /** Returns true if a the parameter values are valid, according to the Param definitions */ + Param.validates = function (params, values) { + if (values === void 0) { values = {}; } + return params.map(function (param) { return param.validates(values[param.id]); }).reduce(_common_common__WEBPACK_IMPORTED_MODULE_0__.allTrueR, true); + }; + Param.prototype.isDefaultValue = function (value) { + return this.isOptional && this.type.equals(this.value(), value); + }; + /** + * [Internal] Gets the decoded representation of a value if the value is defined, otherwise, returns the + * default value, which may be the result of an injectable function. + */ + Param.prototype.value = function (value) { + var _this = this; + /** + * [Internal] Get the default value of a parameter, which may be an injectable function. + */ + var getDefaultValue = function () { + if (_this._defaultValueCache) + return _this._defaultValueCache.defaultValue; + if (!_common_coreservices__WEBPACK_IMPORTED_MODULE_3__.services.$injector) + throw new Error('Injectable functions cannot be called at configuration time'); + var defaultValue = _common_coreservices__WEBPACK_IMPORTED_MODULE_3__.services.$injector.invoke(_this.config.$$fn); + if (defaultValue !== null && defaultValue !== undefined && !_this.type.is(defaultValue)) + throw new Error("Default value (" + defaultValue + ") for parameter '" + _this.id + "' is not an instance of ParamType (" + _this.type.name + ")"); + if (_this.config.$$fn['__cacheable']) { + _this._defaultValueCache = { defaultValue: defaultValue }; + } + return defaultValue; + }; + var replaceSpecialValues = function (val) { + for (var _i = 0, _a = _this.replace; _i < _a.length; _i++) { + var tuple = _a[_i]; + if (tuple.from === val) + return tuple.to; + } + return val; + }; + value = replaceSpecialValues(value); + return (0,_common_predicates__WEBPACK_IMPORTED_MODULE_2__.isUndefined)(value) ? getDefaultValue() : this.type.$normalize(value); + }; + Param.prototype.isSearch = function () { + return this.location === DefType.SEARCH; + }; + Param.prototype.validates = function (value) { + // There was no parameter value, but the param is optional + if (((0,_common_predicates__WEBPACK_IMPORTED_MODULE_2__.isUndefined)(value) || value === null) && this.isOptional) + return true; + // The value was not of the correct ParamType, and could not be decoded to the correct ParamType + var normalized = this.type.$normalize(value); + if (!this.type.is(normalized)) + return false; + // The value was of the correct type, but when encoded, did not match the ParamType's regexp + var encoded = this.type.encode(normalized); + return !((0,_common_predicates__WEBPACK_IMPORTED_MODULE_2__.isString)(encoded) && !this.type.pattern.exec(encoded)); + }; + Param.prototype.toString = function () { + return "{Param:" + this.id + " " + this.type + " squash: '" + this.squash + "' optional: " + this.isOptional + "}"; + }; + return Param; +}()); + +//# sourceMappingURL=param.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/params/paramType.js": +/*!*****************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/params/paramType.js ***! + \*****************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "ParamType": () => (/* binding */ ParamType) +/* harmony export */ }); +/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/common */ "./node_modules/@uirouter/core/lib-esm/common/common.js"); +/* harmony import */ var _common_predicates__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/predicates */ "./node_modules/@uirouter/core/lib-esm/common/predicates.js"); + + +/** + * An internal class which implements [[ParamTypeDefinition]]. + * + * A [[ParamTypeDefinition]] is a plain javascript object used to register custom parameter types. + * When a param type definition is registered, an instance of this class is created internally. + * + * This class has naive implementations for all the [[ParamTypeDefinition]] methods. + * + * Used by [[UrlMatcher]] when matching or formatting URLs, or comparing and validating parameter values. + * + * #### Example: + * ```js + * var paramTypeDef = { + * decode: function(val) { return parseInt(val, 10); }, + * encode: function(val) { return val && val.toString(); }, + * equals: function(a, b) { return this.is(a) && a === b; }, + * is: function(val) { return angular.isNumber(val) && isFinite(val) && val % 1 === 0; }, + * pattern: /\d+/ + * } + * + * var paramType = new ParamType(paramTypeDef); + * ``` + */ +var ParamType = /** @class */ (function () { + /** + * @param def A configuration object which contains the custom type definition. The object's + * properties will override the default methods and/or pattern in `ParamType`'s public interface. + * @returns a new ParamType object + */ + function ParamType(def) { + /** @inheritdoc */ + this.pattern = /.*/; + /** @inheritdoc */ + this.inherit = true; + (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.extend)(this, def); + } + // consider these four methods to be "abstract methods" that should be overridden + /** @inheritdoc */ + ParamType.prototype.is = function (val, key) { + return true; + }; + /** @inheritdoc */ + ParamType.prototype.encode = function (val, key) { + return val; + }; + /** @inheritdoc */ + ParamType.prototype.decode = function (val, key) { + return val; + }; + /** @inheritdoc */ + ParamType.prototype.equals = function (a, b) { + // tslint:disable-next-line:triple-equals + return a == b; + }; + ParamType.prototype.$subPattern = function () { + var sub = this.pattern.toString(); + return sub.substr(1, sub.length - 2); + }; + ParamType.prototype.toString = function () { + return "{ParamType:" + this.name + "}"; + }; + /** Given an encoded string, or a decoded object, returns a decoded object */ + ParamType.prototype.$normalize = function (val) { + return this.is(val) ? val : this.decode(val); + }; + /** + * Wraps an existing custom ParamType as an array of ParamType, depending on 'mode'. + * e.g.: + * - urlmatcher pattern "/path?{queryParam[]:int}" + * - url: "/path?queryParam=1&queryParam=2 + * - $stateParams.queryParam will be [1, 2] + * if `mode` is "auto", then + * - url: "/path?queryParam=1 will create $stateParams.queryParam: 1 + * - url: "/path?queryParam=1&queryParam=2 will create $stateParams.queryParam: [1, 2] + */ + ParamType.prototype.$asArray = function (mode, isSearch) { + if (!mode) + return this; + if (mode === 'auto' && !isSearch) + throw new Error("'auto' array mode is for query parameters only"); + return new ArrayType(this, mode); + }; + return ParamType; +}()); + +/** Wraps up a `ParamType` object to handle array values. */ +function ArrayType(type, mode) { + var _this = this; + // Wrap non-array value as array + function arrayWrap(val) { + return (0,_common_predicates__WEBPACK_IMPORTED_MODULE_1__.isArray)(val) ? val : (0,_common_predicates__WEBPACK_IMPORTED_MODULE_1__.isDefined)(val) ? [val] : []; + } + // Unwrap array value for "auto" mode. Return undefined for empty array. + function arrayUnwrap(val) { + switch (val.length) { + case 0: + return undefined; + case 1: + return mode === 'auto' ? val[0] : val; + default: + return val; + } + } + // Wraps type (.is/.encode/.decode) functions to operate on each value of an array + function arrayHandler(callback, allTruthyMode) { + return function handleArray(val) { + if ((0,_common_predicates__WEBPACK_IMPORTED_MODULE_1__.isArray)(val) && val.length === 0) + return val; + var arr = arrayWrap(val); + var result = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.map)(arr, callback); + return allTruthyMode === true ? (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.filter)(result, function (x) { return !x; }).length === 0 : arrayUnwrap(result); + }; + } + // Wraps type (.equals) functions to operate on each value of an array + function arrayEqualsHandler(callback) { + return function handleArray(val1, val2) { + var left = arrayWrap(val1), right = arrayWrap(val2); + if (left.length !== right.length) + return false; + for (var i = 0; i < left.length; i++) { + if (!callback(left[i], right[i])) + return false; + } + return true; + }; + } + ['encode', 'decode', 'equals', '$normalize'].forEach(function (name) { + var paramTypeFn = type[name].bind(type); + var wrapperFn = name === 'equals' ? arrayEqualsHandler : arrayHandler; + _this[name] = wrapperFn(paramTypeFn); + }); + (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.extend)(this, { + dynamic: type.dynamic, + name: type.name, + pattern: type.pattern, + inherit: type.inherit, + raw: type.raw, + is: arrayHandler(type.is.bind(type), true), + $arrayMode: mode, + }); +} +//# sourceMappingURL=paramType.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/params/paramTypes.js": +/*!******************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/params/paramTypes.js ***! + \******************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "ParamTypes": () => (/* binding */ ParamTypes) +/* harmony export */ }); +/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/common */ "./node_modules/@uirouter/core/lib-esm/common/common.js"); +/* harmony import */ var _common_predicates__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/predicates */ "./node_modules/@uirouter/core/lib-esm/common/predicates.js"); +/* harmony import */ var _common_hof__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../common/hof */ "./node_modules/@uirouter/core/lib-esm/common/hof.js"); +/* harmony import */ var _common_coreservices__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../common/coreservices */ "./node_modules/@uirouter/core/lib-esm/common/coreservices.js"); +/* harmony import */ var _paramType__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./paramType */ "./node_modules/@uirouter/core/lib-esm/params/paramType.js"); + + + + + +/** + * A registry for parameter types. + * + * This registry manages the built-in (and custom) parameter types. + * + * The built-in parameter types are: + * + * - [[string]] + * - [[path]] + * - [[query]] + * - [[hash]] + * - [[int]] + * - [[bool]] + * - [[date]] + * - [[json]] + * - [[any]] + * + * To register custom parameter types, use [[UrlConfig.type]], i.e., + * + * ```js + * router.urlService.config.type(customType) + * ``` + */ +var ParamTypes = /** @class */ (function () { + function ParamTypes() { + this.enqueue = true; + this.typeQueue = []; + this.defaultTypes = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.pick)(ParamTypes.prototype, [ + 'hash', + 'string', + 'query', + 'path', + 'int', + 'bool', + 'date', + 'json', + 'any', + ]); + // Register default types. Store them in the prototype of this.types. + var makeType = function (definition, name) { return new _paramType__WEBPACK_IMPORTED_MODULE_4__.ParamType((0,_common_common__WEBPACK_IMPORTED_MODULE_0__.extend)({ name: name }, definition)); }; + this.types = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.inherit)((0,_common_common__WEBPACK_IMPORTED_MODULE_0__.map)(this.defaultTypes, makeType), {}); + } + ParamTypes.prototype.dispose = function () { + this.types = {}; + }; + /** + * Registers a parameter type + * + * End users should call [[UrlMatcherFactory.type]], which delegates to this method. + */ + ParamTypes.prototype.type = function (name, definition, definitionFn) { + if (!(0,_common_predicates__WEBPACK_IMPORTED_MODULE_1__.isDefined)(definition)) + return this.types[name]; + if (this.types.hasOwnProperty(name)) + throw new Error("A type named '" + name + "' has already been defined."); + this.types[name] = new _paramType__WEBPACK_IMPORTED_MODULE_4__.ParamType((0,_common_common__WEBPACK_IMPORTED_MODULE_0__.extend)({ name: name }, definition)); + if (definitionFn) { + this.typeQueue.push({ name: name, def: definitionFn }); + if (!this.enqueue) + this._flushTypeQueue(); + } + return this; + }; + ParamTypes.prototype._flushTypeQueue = function () { + while (this.typeQueue.length) { + var type = this.typeQueue.shift(); + if (type.pattern) + throw new Error("You cannot override a type's .pattern at runtime."); + (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.extend)(this.types[type.name], _common_coreservices__WEBPACK_IMPORTED_MODULE_3__.services.$injector.invoke(type.def)); + } + }; + return ParamTypes; +}()); + +function initDefaultTypes() { + var makeDefaultType = function (def) { + var valToString = function (val) { return (val != null ? val.toString() : val); }; + var defaultTypeBase = { + encode: valToString, + decode: valToString, + is: (0,_common_hof__WEBPACK_IMPORTED_MODULE_2__.is)(String), + pattern: /.*/, + // tslint:disable-next-line:triple-equals + equals: function (a, b) { return a == b; }, + }; + return (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.extend)({}, defaultTypeBase, def); + }; + // Default Parameter Type Definitions + (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.extend)(ParamTypes.prototype, { + string: makeDefaultType({}), + path: makeDefaultType({ + pattern: /[^/]*/, + }), + query: makeDefaultType({}), + hash: makeDefaultType({ + inherit: false, + }), + int: makeDefaultType({ + decode: function (val) { return parseInt(val, 10); }, + is: function (val) { + return !(0,_common_predicates__WEBPACK_IMPORTED_MODULE_1__.isNullOrUndefined)(val) && this.decode(val.toString()) === val; + }, + pattern: /-?\d+/, + }), + bool: makeDefaultType({ + encode: function (val) { return (val && 1) || 0; }, + decode: function (val) { return parseInt(val, 10) !== 0; }, + is: (0,_common_hof__WEBPACK_IMPORTED_MODULE_2__.is)(Boolean), + pattern: /0|1/, + }), + date: makeDefaultType({ + encode: function (val) { + return !this.is(val) + ? undefined + : [val.getFullYear(), ('0' + (val.getMonth() + 1)).slice(-2), ('0' + val.getDate()).slice(-2)].join('-'); + }, + decode: function (val) { + if (this.is(val)) + return val; + var match = this.capture.exec(val); + return match ? new Date(match[1], match[2] - 1, match[3]) : undefined; + }, + is: function (val) { return val instanceof Date && !isNaN(val.valueOf()); }, + equals: function (l, r) { + return ['getFullYear', 'getMonth', 'getDate'].reduce(function (acc, fn) { return acc && l[fn]() === r[fn](); }, true); + }, + pattern: /[0-9]{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[1-2][0-9]|3[0-1])/, + capture: /([0-9]{4})-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])/, + }), + json: makeDefaultType({ + encode: _common_common__WEBPACK_IMPORTED_MODULE_0__.toJson, + decode: _common_common__WEBPACK_IMPORTED_MODULE_0__.fromJson, + is: (0,_common_hof__WEBPACK_IMPORTED_MODULE_2__.is)(Object), + equals: _common_common__WEBPACK_IMPORTED_MODULE_0__.equals, + pattern: /[^/]*/, + }), + // does not encode/decode + any: makeDefaultType({ + encode: _common_common__WEBPACK_IMPORTED_MODULE_0__.identity, + decode: _common_common__WEBPACK_IMPORTED_MODULE_0__.identity, + is: function () { return true; }, + equals: _common_common__WEBPACK_IMPORTED_MODULE_0__.equals, + }), + }); +} +initDefaultTypes(); +//# sourceMappingURL=paramTypes.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/params/stateParams.js": +/*!*******************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/params/stateParams.js ***! + \*******************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "StateParams": () => (/* binding */ StateParams) +/* harmony export */ }); +/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/common */ "./node_modules/@uirouter/core/lib-esm/common/common.js"); + +var StateParams = /** @class */ (function () { + function StateParams(params) { + if (params === void 0) { params = {}; } + (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.extend)(this, params); + } + /** + * Merges a set of parameters with all parameters inherited between the common parents of the + * current state and a given destination state. + * + * @param {Object} newParams The set of parameters which will be composited with inherited params. + * @param {Object} $current Internal definition of object representing the current state. + * @param {Object} $to Internal definition of object representing state to transition to. + */ + StateParams.prototype.$inherit = function (newParams, $current, $to) { + var parentParams; + var parents = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.ancestors)($current, $to), inherited = {}, inheritList = []; + for (var i in parents) { + if (!parents[i] || !parents[i].params) + continue; + parentParams = Object.keys(parents[i].params); + if (!parentParams.length) + continue; + for (var j in parentParams) { + if (inheritList.indexOf(parentParams[j]) >= 0) + continue; + inheritList.push(parentParams[j]); + inherited[parentParams[j]] = this[parentParams[j]]; + } + } + return (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.extend)({}, inherited, newParams); + }; + return StateParams; +}()); + +//# sourceMappingURL=stateParams.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/path/index.js": +/*!***********************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/path/index.js ***! + \***********************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "PathNode": () => (/* reexport safe */ _pathNode__WEBPACK_IMPORTED_MODULE_0__.PathNode), +/* harmony export */ "PathUtils": () => (/* reexport safe */ _pathUtils__WEBPACK_IMPORTED_MODULE_1__.PathUtils) +/* harmony export */ }); +/* harmony import */ var _pathNode__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./pathNode */ "./node_modules/@uirouter/core/lib-esm/path/pathNode.js"); +/* harmony import */ var _pathUtils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./pathUtils */ "./node_modules/@uirouter/core/lib-esm/path/pathUtils.js"); + + +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/path/pathNode.js": +/*!**************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/path/pathNode.js ***! + \**************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "PathNode": () => (/* binding */ PathNode) +/* harmony export */ }); +/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/common */ "./node_modules/@uirouter/core/lib-esm/common/common.js"); +/* harmony import */ var _common_hof__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/hof */ "./node_modules/@uirouter/core/lib-esm/common/hof.js"); +/* harmony import */ var _params_param__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../params/param */ "./node_modules/@uirouter/core/lib-esm/params/param.js"); + + + +/** + * A node in a [[TreeChanges]] path + * + * For a [[TreeChanges]] path, this class holds the stateful information for a single node in the path. + * Each PathNode corresponds to a state being entered, exited, or retained. + * The stateful information includes parameter values and resolve data. + */ +var PathNode = /** @class */ (function () { + function PathNode(stateOrNode) { + if (stateOrNode instanceof PathNode) { + var node = stateOrNode; + this.state = node.state; + this.paramSchema = node.paramSchema.slice(); + this.paramValues = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.extend)({}, node.paramValues); + this.resolvables = node.resolvables.slice(); + this.views = node.views && node.views.slice(); + } + else { + var state = stateOrNode; + this.state = state; + this.paramSchema = state.parameters({ inherit: false }); + this.paramValues = {}; + this.resolvables = state.resolvables.map(function (res) { return res.clone(); }); + } + } + PathNode.prototype.clone = function () { + return new PathNode(this); + }; + /** Sets [[paramValues]] for the node, from the values of an object hash */ + PathNode.prototype.applyRawParams = function (params) { + var getParamVal = function (paramDef) { return [paramDef.id, paramDef.value(params[paramDef.id])]; }; + this.paramValues = this.paramSchema.reduce(function (memo, pDef) { return (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.applyPairs)(memo, getParamVal(pDef)); }, {}); + return this; + }; + /** Gets a specific [[Param]] metadata that belongs to the node */ + PathNode.prototype.parameter = function (name) { + return (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.find)(this.paramSchema, (0,_common_hof__WEBPACK_IMPORTED_MODULE_1__.propEq)('id', name)); + }; + /** + * @returns true if the state and parameter values for another PathNode are + * equal to the state and param values for this PathNode + */ + PathNode.prototype.equals = function (node, paramsFn) { + var diff = this.diff(node, paramsFn); + return diff && diff.length === 0; + }; + /** + * Finds Params with different parameter values on another PathNode. + * + * Given another node (of the same state), finds the parameter values which differ. + * Returns the [[Param]] (schema objects) whose parameter values differ. + * + * Given another node for a different state, returns `false` + * + * @param node The node to compare to + * @param paramsFn A function that returns which parameters should be compared. + * @returns The [[Param]]s which differ, or null if the two nodes are for different states + */ + PathNode.prototype.diff = function (node, paramsFn) { + if (this.state !== node.state) + return false; + var params = paramsFn ? paramsFn(this) : this.paramSchema; + return _params_param__WEBPACK_IMPORTED_MODULE_2__.Param.changed(params, this.paramValues, node.paramValues); + }; + /** + * Returns a clone of the PathNode + * @deprecated use instance method `node.clone()` + */ + PathNode.clone = function (node) { return node.clone(); }; + return PathNode; +}()); + +//# sourceMappingURL=pathNode.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/path/pathUtils.js": +/*!***************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/path/pathUtils.js ***! + \***************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "PathUtils": () => (/* binding */ PathUtils) +/* harmony export */ }); +/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/common */ "./node_modules/@uirouter/core/lib-esm/common/common.js"); +/* harmony import */ var _common_hof__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/hof */ "./node_modules/@uirouter/core/lib-esm/common/hof.js"); +/* harmony import */ var _state_targetState__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../state/targetState */ "./node_modules/@uirouter/core/lib-esm/state/targetState.js"); +/* harmony import */ var _pathNode__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./pathNode */ "./node_modules/@uirouter/core/lib-esm/path/pathNode.js"); + + + + +/** + * This class contains functions which convert TargetStates, Nodes and paths from one type to another. + */ +var PathUtils = /** @class */ (function () { + function PathUtils() { + } + /** Given a PathNode[], create an TargetState */ + PathUtils.makeTargetState = function (registry, path) { + var state = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.tail)(path).state; + return new _state_targetState__WEBPACK_IMPORTED_MODULE_2__.TargetState(registry, state, path.map((0,_common_hof__WEBPACK_IMPORTED_MODULE_1__.prop)('paramValues')).reduce(_common_common__WEBPACK_IMPORTED_MODULE_0__.mergeR, {}), {}); + }; + PathUtils.buildPath = function (targetState) { + var toParams = targetState.params(); + return targetState.$state().path.map(function (state) { return new _pathNode__WEBPACK_IMPORTED_MODULE_3__.PathNode(state).applyRawParams(toParams); }); + }; + /** Given a fromPath: PathNode[] and a TargetState, builds a toPath: PathNode[] */ + PathUtils.buildToPath = function (fromPath, targetState) { + var toPath = PathUtils.buildPath(targetState); + if (targetState.options().inherit) { + return PathUtils.inheritParams(fromPath, toPath, Object.keys(targetState.params())); + } + return toPath; + }; + /** + * Creates ViewConfig objects and adds to nodes. + * + * On each [[PathNode]], creates ViewConfig objects from the views: property of the node's state + */ + PathUtils.applyViewConfigs = function ($view, path, states) { + // Only apply the viewConfigs to the nodes for the given states + path + .filter(function (node) { return (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.inArray)(states, node.state); }) + .forEach(function (node) { + var viewDecls = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.values)(node.state.views || {}); + var subPath = PathUtils.subPath(path, function (n) { return n === node; }); + var viewConfigs = viewDecls.map(function (view) { return $view.createViewConfig(subPath, view); }); + node.views = viewConfigs.reduce(_common_common__WEBPACK_IMPORTED_MODULE_0__.unnestR, []); + }); + }; + /** + * Given a fromPath and a toPath, returns a new to path which inherits parameters from the fromPath + * + * For a parameter in a node to be inherited from the from path: + * - The toPath's node must have a matching node in the fromPath (by state). + * - The parameter name must not be found in the toKeys parameter array. + * + * Note: the keys provided in toKeys are intended to be those param keys explicitly specified by some + * caller, for instance, $state.transitionTo(..., toParams). If a key was found in toParams, + * it is not inherited from the fromPath. + */ + PathUtils.inheritParams = function (fromPath, toPath, toKeys) { + if (toKeys === void 0) { toKeys = []; } + function nodeParamVals(path, state) { + var node = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.find)(path, (0,_common_hof__WEBPACK_IMPORTED_MODULE_1__.propEq)('state', state)); + return (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.extend)({}, node && node.paramValues); + } + var noInherit = fromPath + .map(function (node) { return node.paramSchema; }) + .reduce(_common_common__WEBPACK_IMPORTED_MODULE_0__.unnestR, []) + .filter(function (param) { return !param.inherit; }) + .map((0,_common_hof__WEBPACK_IMPORTED_MODULE_1__.prop)('id')); + /** + * Given an [[PathNode]] "toNode", return a new [[PathNode]] with param values inherited from the + * matching node in fromPath. Only inherit keys that aren't found in "toKeys" from the node in "fromPath"" + */ + function makeInheritedParamsNode(toNode) { + // All param values for the node (may include default key/vals, when key was not found in toParams) + var toParamVals = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.extend)({}, toNode && toNode.paramValues); + // limited to only those keys found in toParams + var incomingParamVals = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.pick)(toParamVals, toKeys); + toParamVals = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.omit)(toParamVals, toKeys); + var fromParamVals = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.omit)(nodeParamVals(fromPath, toNode.state) || {}, noInherit); + // extend toParamVals with any fromParamVals, then override any of those those with incomingParamVals + var ownParamVals = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.extend)(toParamVals, fromParamVals, incomingParamVals); + return new _pathNode__WEBPACK_IMPORTED_MODULE_3__.PathNode(toNode.state).applyRawParams(ownParamVals); + } + // The param keys specified by the incoming toParams + return toPath.map(makeInheritedParamsNode); + }; + /** + * Computes the tree changes (entering, exiting) between a fromPath and toPath. + */ + PathUtils.treeChanges = function (fromPath, toPath, reloadState) { + var max = Math.min(fromPath.length, toPath.length); + var keep = 0; + var nodesMatch = function (node1, node2) { return node1.equals(node2, PathUtils.nonDynamicParams); }; + while (keep < max && fromPath[keep].state !== reloadState && nodesMatch(fromPath[keep], toPath[keep])) { + keep++; + } + /** Given a retained node, return a new node which uses the to node's param values */ + function applyToParams(retainedNode, idx) { + var cloned = retainedNode.clone(); + cloned.paramValues = toPath[idx].paramValues; + return cloned; + } + var from, retained, exiting, entering, to; + from = fromPath; + retained = from.slice(0, keep); + exiting = from.slice(keep); + // Create a new retained path (with shallow copies of nodes) which have the params of the toPath mapped + var retainedWithToParams = retained.map(applyToParams); + entering = toPath.slice(keep); + to = retainedWithToParams.concat(entering); + return { from: from, to: to, retained: retained, retainedWithToParams: retainedWithToParams, exiting: exiting, entering: entering }; + }; + /** + * Returns a new path which is: the subpath of the first path which matches the second path. + * + * The new path starts from root and contains any nodes that match the nodes in the second path. + * It stops before the first non-matching node. + * + * Nodes are compared using their state property and their parameter values. + * If a `paramsFn` is provided, only the [[Param]] returned by the function will be considered when comparing nodes. + * + * @param pathA the first path + * @param pathB the second path + * @param paramsFn a function which returns the parameters to consider when comparing + * + * @returns an array of PathNodes from the first path which match the nodes in the second path + */ + PathUtils.matching = function (pathA, pathB, paramsFn) { + var done = false; + var tuples = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.arrayTuples)(pathA, pathB); + return tuples.reduce(function (matching, _a) { + var nodeA = _a[0], nodeB = _a[1]; + done = done || !nodeA.equals(nodeB, paramsFn); + return done ? matching : matching.concat(nodeA); + }, []); + }; + /** + * Returns true if two paths are identical. + * + * @param pathA + * @param pathB + * @param paramsFn a function which returns the parameters to consider when comparing + * @returns true if the the states and parameter values for both paths are identical + */ + PathUtils.equals = function (pathA, pathB, paramsFn) { + return pathA.length === pathB.length && PathUtils.matching(pathA, pathB, paramsFn).length === pathA.length; + }; + /** + * Return a subpath of a path, which stops at the first matching node + * + * Given an array of nodes, returns a subset of the array starting from the first node, + * stopping when the first node matches the predicate. + * + * @param path a path of [[PathNode]]s + * @param predicate a [[Predicate]] fn that matches [[PathNode]]s + * @returns a subpath up to the matching node, or undefined if no match is found + */ + PathUtils.subPath = function (path, predicate) { + var node = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.find)(path, predicate); + var elementIdx = path.indexOf(node); + return elementIdx === -1 ? undefined : path.slice(0, elementIdx + 1); + }; + PathUtils.nonDynamicParams = function (node) { + return node.state.parameters({ inherit: false }).filter(function (param) { return !param.dynamic; }); + }; + /** Gets the raw parameter values from a path */ + PathUtils.paramValues = function (path) { return path.reduce(function (acc, node) { return (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.extend)(acc, node.paramValues); }, {}); }; + return PathUtils; +}()); + +//# sourceMappingURL=pathUtils.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/resolve/index.js": +/*!**************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/resolve/index.js ***! + \**************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "resolvePolicies": () => (/* reexport safe */ _interface__WEBPACK_IMPORTED_MODULE_0__.resolvePolicies), +/* harmony export */ "Resolvable": () => (/* reexport safe */ _resolvable__WEBPACK_IMPORTED_MODULE_1__.Resolvable), +/* harmony export */ "defaultResolvePolicy": () => (/* reexport safe */ _resolvable__WEBPACK_IMPORTED_MODULE_1__.defaultResolvePolicy), +/* harmony export */ "NATIVE_INJECTOR_TOKEN": () => (/* reexport safe */ _resolveContext__WEBPACK_IMPORTED_MODULE_2__.NATIVE_INJECTOR_TOKEN), +/* harmony export */ "ResolveContext": () => (/* reexport safe */ _resolveContext__WEBPACK_IMPORTED_MODULE_2__.ResolveContext) +/* harmony export */ }); +/* harmony import */ var _interface__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./interface */ "./node_modules/@uirouter/core/lib-esm/resolve/interface.js"); +/* harmony import */ var _resolvable__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./resolvable */ "./node_modules/@uirouter/core/lib-esm/resolve/resolvable.js"); +/* harmony import */ var _resolveContext__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./resolveContext */ "./node_modules/@uirouter/core/lib-esm/resolve/resolveContext.js"); + + + +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/resolve/interface.js": +/*!******************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/resolve/interface.js ***! + \******************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "resolvePolicies": () => (/* binding */ resolvePolicies) +/* harmony export */ }); +var resolvePolicies = { + when: { + LAZY: 'LAZY', + EAGER: 'EAGER', + }, + async: { + WAIT: 'WAIT', + NOWAIT: 'NOWAIT', + }, +}; +//# sourceMappingURL=interface.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/resolve/resolvable.js": +/*!*******************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/resolve/resolvable.js ***! + \*******************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "defaultResolvePolicy": () => (/* binding */ defaultResolvePolicy), +/* harmony export */ "Resolvable": () => (/* binding */ Resolvable) +/* harmony export */ }); +/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/common */ "./node_modules/@uirouter/core/lib-esm/common/common.js"); +/* harmony import */ var _common_coreservices__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/coreservices */ "./node_modules/@uirouter/core/lib-esm/common/coreservices.js"); +/* harmony import */ var _common_trace__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../common/trace */ "./node_modules/@uirouter/core/lib-esm/common/trace.js"); +/* harmony import */ var _common_strings__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../common/strings */ "./node_modules/@uirouter/core/lib-esm/common/strings.js"); +/* harmony import */ var _common_predicates__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../common/predicates */ "./node_modules/@uirouter/core/lib-esm/common/predicates.js"); + + + + + + +// TODO: explicitly make this user configurable +var defaultResolvePolicy = { + when: 'LAZY', + async: 'WAIT', +}; +/** + * The basic building block for the resolve system. + * + * Resolvables encapsulate a state's resolve's resolveFn, the resolveFn's declared dependencies, the wrapped (.promise), + * and the unwrapped-when-complete (.data) result of the resolveFn. + * + * Resolvable.get() either retrieves the Resolvable's existing promise, or else invokes resolve() (which invokes the + * resolveFn) and returns the resulting promise. + * + * Resolvable.get() and Resolvable.resolve() both execute within a context path, which is passed as the first + * parameter to those fns. + */ +var Resolvable = /** @class */ (function () { + function Resolvable(arg1, resolveFn, deps, policy, data) { + this.resolved = false; + this.promise = undefined; + if (arg1 instanceof Resolvable) { + (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.extend)(this, arg1); + } + else if ((0,_common_predicates__WEBPACK_IMPORTED_MODULE_4__.isFunction)(resolveFn)) { + if ((0,_common_predicates__WEBPACK_IMPORTED_MODULE_4__.isNullOrUndefined)(arg1)) + throw new Error('new Resolvable(): token argument is required'); + if (!(0,_common_predicates__WEBPACK_IMPORTED_MODULE_4__.isFunction)(resolveFn)) + throw new Error('new Resolvable(): resolveFn argument must be a function'); + this.token = arg1; + this.policy = policy; + this.resolveFn = resolveFn; + this.deps = deps || []; + this.data = data; + this.resolved = data !== undefined; + this.promise = this.resolved ? _common_coreservices__WEBPACK_IMPORTED_MODULE_1__.services.$q.when(this.data) : undefined; + } + else if ((0,_common_predicates__WEBPACK_IMPORTED_MODULE_4__.isObject)(arg1) && arg1.token && (arg1.hasOwnProperty('resolveFn') || arg1.hasOwnProperty('data'))) { + var literal = arg1; + return new Resolvable(literal.token, literal.resolveFn, literal.deps, literal.policy, literal.data); + } + } + Resolvable.prototype.getPolicy = function (state) { + var thisPolicy = this.policy || {}; + var statePolicy = (state && state.resolvePolicy) || {}; + return { + when: thisPolicy.when || statePolicy.when || defaultResolvePolicy.when, + async: thisPolicy.async || statePolicy.async || defaultResolvePolicy.async, + }; + }; + /** + * Asynchronously resolve this Resolvable's data + * + * Given a ResolveContext that this Resolvable is found in: + * Wait for this Resolvable's dependencies, then invoke this Resolvable's function + * and update the Resolvable's state + */ + Resolvable.prototype.resolve = function (resolveContext, trans) { + var _this = this; + var $q = _common_coreservices__WEBPACK_IMPORTED_MODULE_1__.services.$q; + // Gets all dependencies from ResolveContext and wait for them to be resolved + var getResolvableDependencies = function () { + return $q.all(resolveContext.getDependencies(_this).map(function (resolvable) { return resolvable.get(resolveContext, trans); })); + }; + // Invokes the resolve function passing the resolved dependencies as arguments + var invokeResolveFn = function (resolvedDeps) { return _this.resolveFn.apply(null, resolvedDeps); }; + var node = resolveContext.findNode(this); + var state = node && node.state; + var asyncPolicy = this.getPolicy(state).async; + var customAsyncPolicy = (0,_common_predicates__WEBPACK_IMPORTED_MODULE_4__.isFunction)(asyncPolicy) ? asyncPolicy : _common_common__WEBPACK_IMPORTED_MODULE_0__.identity; + // After the final value has been resolved, update the state of the Resolvable + var applyResolvedValue = function (resolvedValue) { + _this.data = resolvedValue; + _this.resolved = true; + _this.resolveFn = null; + _common_trace__WEBPACK_IMPORTED_MODULE_2__.trace.traceResolvableResolved(_this, trans); + return _this.data; + }; + // Sets the promise property first, then getsResolvableDependencies in the context of the promise chain. Always waits one tick. + return (this.promise = $q + .when() + .then(getResolvableDependencies) + .then(invokeResolveFn) + .then(customAsyncPolicy) + .then(applyResolvedValue)); + }; + /** + * Gets a promise for this Resolvable's data. + * + * Fetches the data and returns a promise. + * Returns the existing promise if it has already been fetched once. + */ + Resolvable.prototype.get = function (resolveContext, trans) { + return this.promise || this.resolve(resolveContext, trans); + }; + Resolvable.prototype.toString = function () { + return "Resolvable(token: " + (0,_common_strings__WEBPACK_IMPORTED_MODULE_3__.stringify)(this.token) + ", requires: [" + this.deps.map(_common_strings__WEBPACK_IMPORTED_MODULE_3__.stringify) + "])"; + }; + Resolvable.prototype.clone = function () { + return new Resolvable(this); + }; + Resolvable.fromData = function (token, data) { return new Resolvable(token, function () { return data; }, null, null, data); }; + return Resolvable; +}()); + +//# sourceMappingURL=resolvable.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/resolve/resolveContext.js": +/*!***********************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/resolve/resolveContext.js ***! + \***********************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "NATIVE_INJECTOR_TOKEN": () => (/* binding */ NATIVE_INJECTOR_TOKEN), +/* harmony export */ "ResolveContext": () => (/* binding */ ResolveContext) +/* harmony export */ }); +/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/common */ "./node_modules/@uirouter/core/lib-esm/common/common.js"); +/* harmony import */ var _common_hof__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/hof */ "./node_modules/@uirouter/core/lib-esm/common/hof.js"); +/* harmony import */ var _common_trace__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../common/trace */ "./node_modules/@uirouter/core/lib-esm/common/trace.js"); +/* harmony import */ var _common_coreservices__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../common/coreservices */ "./node_modules/@uirouter/core/lib-esm/common/coreservices.js"); +/* harmony import */ var _interface__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./interface */ "./node_modules/@uirouter/core/lib-esm/resolve/interface.js"); +/* harmony import */ var _resolvable__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./resolvable */ "./node_modules/@uirouter/core/lib-esm/resolve/resolvable.js"); +/* harmony import */ var _path_pathUtils__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../path/pathUtils */ "./node_modules/@uirouter/core/lib-esm/path/pathUtils.js"); +/* harmony import */ var _common_strings__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../common/strings */ "./node_modules/@uirouter/core/lib-esm/common/strings.js"); +/* harmony import */ var _common__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../common */ "./node_modules/@uirouter/core/lib-esm/common/index.js"); + + + + + + + + + +var whens = _interface__WEBPACK_IMPORTED_MODULE_4__.resolvePolicies.when; +var ALL_WHENS = [whens.EAGER, whens.LAZY]; +var EAGER_WHENS = [whens.EAGER]; +// tslint:disable-next-line:no-inferrable-types +var NATIVE_INJECTOR_TOKEN = 'Native Injector'; +/** + * Encapsulates Dependency Injection for a path of nodes + * + * UI-Router states are organized as a tree. + * A nested state has a path of ancestors to the root of the tree. + * When a state is being activated, each element in the path is wrapped as a [[PathNode]]. + * A `PathNode` is a stateful object that holds things like parameters and resolvables for the state being activated. + * + * The ResolveContext closes over the [[PathNode]]s, and provides DI for the last node in the path. + */ +var ResolveContext = /** @class */ (function () { + function ResolveContext(_path) { + this._path = _path; + } + /** Gets all the tokens found in the resolve context, de-duplicated */ + ResolveContext.prototype.getTokens = function () { + return this._path.reduce(function (acc, node) { return acc.concat(node.resolvables.map(function (r) { return r.token; })); }, []).reduce(_common_common__WEBPACK_IMPORTED_MODULE_0__.uniqR, []); + }; + /** + * Gets the Resolvable that matches the token + * + * Gets the last Resolvable that matches the token in this context, or undefined. + * Throws an error if it doesn't exist in the ResolveContext + */ + ResolveContext.prototype.getResolvable = function (token) { + var matching = this._path + .map(function (node) { return node.resolvables; }) + .reduce(_common_common__WEBPACK_IMPORTED_MODULE_0__.unnestR, []) + .filter(function (r) { return r.token === token; }); + return (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.tail)(matching); + }; + /** Returns the [[ResolvePolicy]] for the given [[Resolvable]] */ + ResolveContext.prototype.getPolicy = function (resolvable) { + var node = this.findNode(resolvable); + return resolvable.getPolicy(node.state); + }; + /** + * Returns a ResolveContext that includes a portion of this one + * + * Given a state, this method creates a new ResolveContext from this one. + * The new context starts at the first node (root) and stops at the node for the `state` parameter. + * + * #### Why + * + * When a transition is created, the nodes in the "To Path" are injected from a ResolveContext. + * A ResolveContext closes over a path of [[PathNode]]s and processes the resolvables. + * The "To State" can inject values from its own resolvables, as well as those from all its ancestor state's (node's). + * This method is used to create a narrower context when injecting ancestor nodes. + * + * @example + * `let ABCD = new ResolveContext([A, B, C, D]);` + * + * Given a path `[A, B, C, D]`, where `A`, `B`, `C` and `D` are nodes for states `a`, `b`, `c`, `d`: + * When injecting `D`, `D` should have access to all resolvables from `A`, `B`, `C`, `D`. + * However, `B` should only be able to access resolvables from `A`, `B`. + * + * When resolving for the `B` node, first take the full "To Path" Context `[A,B,C,D]` and limit to the subpath `[A,B]`. + * `let AB = ABCD.subcontext(a)` + */ + ResolveContext.prototype.subContext = function (state) { + return new ResolveContext(_path_pathUtils__WEBPACK_IMPORTED_MODULE_6__.PathUtils.subPath(this._path, function (node) { return node.state === state; })); + }; + /** + * Adds Resolvables to the node that matches the state + * + * This adds a [[Resolvable]] (generally one created on the fly; not declared on a [[StateDeclaration.resolve]] block). + * The resolvable is added to the node matching the `state` parameter. + * + * These new resolvables are not automatically fetched. + * The calling code should either fetch them, fetch something that depends on them, + * or rely on [[resolvePath]] being called when some state is being entered. + * + * Note: each resolvable's [[ResolvePolicy]] is merged with the state's policy, and the global default. + * + * @param newResolvables the new Resolvables + * @param state Used to find the node to put the resolvable on + */ + ResolveContext.prototype.addResolvables = function (newResolvables, state) { + var node = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.find)(this._path, (0,_common_hof__WEBPACK_IMPORTED_MODULE_1__.propEq)('state', state)); + var keys = newResolvables.map(function (r) { return r.token; }); + node.resolvables = node.resolvables.filter(function (r) { return keys.indexOf(r.token) === -1; }).concat(newResolvables); + }; + /** + * Returns a promise for an array of resolved path Element promises + * + * @param when + * @param trans + * @returns {Promise|any} + */ + ResolveContext.prototype.resolvePath = function (when, trans) { + var _this = this; + if (when === void 0) { when = 'LAZY'; } + // This option determines which 'when' policy Resolvables we are about to fetch. + var whenOption = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.inArray)(ALL_WHENS, when) ? when : 'LAZY'; + // If the caller specified EAGER, only the EAGER Resolvables are fetched. + // if the caller specified LAZY, both EAGER and LAZY Resolvables are fetched.` + var matchedWhens = whenOption === _interface__WEBPACK_IMPORTED_MODULE_4__.resolvePolicies.when.EAGER ? EAGER_WHENS : ALL_WHENS; + // get the subpath to the state argument, if provided + _common_trace__WEBPACK_IMPORTED_MODULE_2__.trace.traceResolvePath(this._path, when, trans); + var matchesPolicy = function (acceptedVals, whenOrAsync) { return function (resolvable) { + return (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.inArray)(acceptedVals, _this.getPolicy(resolvable)[whenOrAsync]); + }; }; + // Trigger all the (matching) Resolvables in the path + // Reduce all the "WAIT" Resolvables into an array + var promises = this._path.reduce(function (acc, node) { + var nodeResolvables = node.resolvables.filter(matchesPolicy(matchedWhens, 'when')); + var nowait = nodeResolvables.filter(matchesPolicy(['NOWAIT'], 'async')); + var wait = nodeResolvables.filter((0,_common_hof__WEBPACK_IMPORTED_MODULE_1__.not)(matchesPolicy(['NOWAIT'], 'async'))); + // For the matching Resolvables, start their async fetch process. + var subContext = _this.subContext(node.state); + var getResult = function (r) { + return r + .get(subContext, trans) + // Return a tuple that includes the Resolvable's token + .then(function (value) { return ({ token: r.token, value: value }); }); + }; + nowait.forEach(getResult); + return acc.concat(wait.map(getResult)); + }, []); + // Wait for all the "WAIT" resolvables + return _common_coreservices__WEBPACK_IMPORTED_MODULE_3__.services.$q.all(promises); + }; + ResolveContext.prototype.injector = function () { + return this._injector || (this._injector = new UIInjectorImpl(this)); + }; + ResolveContext.prototype.findNode = function (resolvable) { + return (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.find)(this._path, function (node) { return (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.inArray)(node.resolvables, resolvable); }); + }; + /** + * Gets the async dependencies of a Resolvable + * + * Given a Resolvable, returns its dependencies as a Resolvable[] + */ + ResolveContext.prototype.getDependencies = function (resolvable) { + var _this = this; + var node = this.findNode(resolvable); + // Find which other resolvables are "visible" to the `resolvable` argument + // subpath stopping at resolvable's node, or the whole path (if the resolvable isn't in the path) + var subPath = _path_pathUtils__WEBPACK_IMPORTED_MODULE_6__.PathUtils.subPath(this._path, function (x) { return x === node; }) || this._path; + var availableResolvables = subPath + .reduce(function (acc, _node) { return acc.concat(_node.resolvables); }, []) // all of subpath's resolvables + .filter(function (res) { return res !== resolvable; }); // filter out the `resolvable` argument + var getDependency = function (token) { + var matching = availableResolvables.filter(function (r) { return r.token === token; }); + if (matching.length) + return (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.tail)(matching); + var fromInjector = _this.injector().getNative(token); + if ((0,_common__WEBPACK_IMPORTED_MODULE_8__.isUndefined)(fromInjector)) { + throw new Error('Could not find Dependency Injection token: ' + (0,_common_strings__WEBPACK_IMPORTED_MODULE_7__.stringify)(token)); + } + return new _resolvable__WEBPACK_IMPORTED_MODULE_5__.Resolvable(token, function () { return fromInjector; }, [], fromInjector); + }; + return resolvable.deps.map(getDependency); + }; + return ResolveContext; +}()); + +/** @internal */ +var UIInjectorImpl = /** @class */ (function () { + function UIInjectorImpl(context) { + this.context = context; + this.native = this.get(NATIVE_INJECTOR_TOKEN) || _common_coreservices__WEBPACK_IMPORTED_MODULE_3__.services.$injector; + } + UIInjectorImpl.prototype.get = function (token) { + var resolvable = this.context.getResolvable(token); + if (resolvable) { + if (this.context.getPolicy(resolvable).async === 'NOWAIT') { + return resolvable.get(this.context); + } + if (!resolvable.resolved) { + throw new Error('Resolvable async .get() not complete:' + (0,_common_strings__WEBPACK_IMPORTED_MODULE_7__.stringify)(resolvable.token)); + } + return resolvable.data; + } + return this.getNative(token); + }; + UIInjectorImpl.prototype.getAsync = function (token) { + var resolvable = this.context.getResolvable(token); + if (resolvable) + return resolvable.get(this.context); + return _common_coreservices__WEBPACK_IMPORTED_MODULE_3__.services.$q.when(this.native.get(token)); + }; + UIInjectorImpl.prototype.getNative = function (token) { + return this.native && this.native.get(token); + }; + return UIInjectorImpl; +}()); +//# sourceMappingURL=resolveContext.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/router.js": +/*!*******************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/router.js ***! + \*******************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "UIRouter": () => (/* binding */ UIRouter) +/* harmony export */ }); +/* harmony import */ var _url_urlMatcherFactory__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./url/urlMatcherFactory */ "./node_modules/@uirouter/core/lib-esm/url/urlMatcherFactory.js"); +/* harmony import */ var _url_urlRouter__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./url/urlRouter */ "./node_modules/@uirouter/core/lib-esm/url/urlRouter.js"); +/* harmony import */ var _transition_transitionService__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./transition/transitionService */ "./node_modules/@uirouter/core/lib-esm/transition/transitionService.js"); +/* harmony import */ var _view_view__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./view/view */ "./node_modules/@uirouter/core/lib-esm/view/view.js"); +/* harmony import */ var _state_stateRegistry__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./state/stateRegistry */ "./node_modules/@uirouter/core/lib-esm/state/stateRegistry.js"); +/* harmony import */ var _state_stateService__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./state/stateService */ "./node_modules/@uirouter/core/lib-esm/state/stateService.js"); +/* harmony import */ var _globals__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./globals */ "./node_modules/@uirouter/core/lib-esm/globals.js"); +/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./common/common */ "./node_modules/@uirouter/core/lib-esm/common/common.js"); +/* harmony import */ var _common_predicates__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./common/predicates */ "./node_modules/@uirouter/core/lib-esm/common/predicates.js"); +/* harmony import */ var _url_urlService__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./url/urlService */ "./node_modules/@uirouter/core/lib-esm/url/urlService.js"); +/* harmony import */ var _common_trace__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./common/trace */ "./node_modules/@uirouter/core/lib-esm/common/trace.js"); +/* harmony import */ var _common__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./common */ "./node_modules/@uirouter/core/lib-esm/common/index.js"); + + + + + + + + + + + + +/** @internal */ +var _routerInstance = 0; +/** @internal */ +var locSvcFns = ['url', 'path', 'search', 'hash', 'onChange']; +/** @internal */ +var locCfgFns = ['port', 'protocol', 'host', 'baseHref', 'html5Mode', 'hashPrefix']; +/** @internal */ +var locationServiceStub = (0,_common__WEBPACK_IMPORTED_MODULE_11__.makeStub)('LocationServices', locSvcFns); +/** @internal */ +var locationConfigStub = (0,_common__WEBPACK_IMPORTED_MODULE_11__.makeStub)('LocationConfig', locCfgFns); +/** + * An instance of UI-Router. + * + * This object contains references to service APIs which define your application's routing behavior. + */ +var UIRouter = /** @class */ (function () { + /** + * Creates a new `UIRouter` object + * + * @param locationService a [[LocationServices]] implementation + * @param locationConfig a [[LocationConfig]] implementation + * @internal + */ + function UIRouter(locationService, locationConfig) { + if (locationService === void 0) { locationService = locationServiceStub; } + if (locationConfig === void 0) { locationConfig = locationConfigStub; } + this.locationService = locationService; + this.locationConfig = locationConfig; + /** @internal */ this.$id = _routerInstance++; + /** @internal */ this._disposed = false; + /** @internal */ this._disposables = []; + /** Enable/disable tracing to the javascript console */ + this.trace = _common_trace__WEBPACK_IMPORTED_MODULE_10__.trace; + /** Provides services related to ui-view synchronization */ + this.viewService = new _view_view__WEBPACK_IMPORTED_MODULE_3__.ViewService(this); + /** An object that contains global router state, such as the current state and params */ + this.globals = new _globals__WEBPACK_IMPORTED_MODULE_6__.UIRouterGlobals(); + /** A service that exposes global Transition Hooks */ + this.transitionService = new _transition_transitionService__WEBPACK_IMPORTED_MODULE_2__.TransitionService(this); + /** + * Deprecated for public use. Use [[urlService]] instead. + * @deprecated Use [[urlService]] instead + */ + this.urlMatcherFactory = new _url_urlMatcherFactory__WEBPACK_IMPORTED_MODULE_0__.UrlMatcherFactory(this); + /** + * Deprecated for public use. Use [[urlService]] instead. + * @deprecated Use [[urlService]] instead + */ + this.urlRouter = new _url_urlRouter__WEBPACK_IMPORTED_MODULE_1__.UrlRouter(this); + /** Provides services related to the URL */ + this.urlService = new _url_urlService__WEBPACK_IMPORTED_MODULE_9__.UrlService(this); + /** Provides a registry for states, and related registration services */ + this.stateRegistry = new _state_stateRegistry__WEBPACK_IMPORTED_MODULE_4__.StateRegistry(this); + /** Provides services related to states */ + this.stateService = new _state_stateService__WEBPACK_IMPORTED_MODULE_5__.StateService(this); + /** @internal plugin instances are registered here */ + this._plugins = {}; + this.viewService._pluginapi._rootViewContext(this.stateRegistry.root()); + this.globals.$current = this.stateRegistry.root(); + this.globals.current = this.globals.$current.self; + this.disposable(this.globals); + this.disposable(this.stateService); + this.disposable(this.stateRegistry); + this.disposable(this.transitionService); + this.disposable(this.urlService); + this.disposable(locationService); + this.disposable(locationConfig); + } + /** Registers an object to be notified when the router is disposed */ + UIRouter.prototype.disposable = function (disposable) { + this._disposables.push(disposable); + }; + /** + * Disposes this router instance + * + * When called, clears resources retained by the router by calling `dispose(this)` on all + * registered [[disposable]] objects. + * + * Or, if a `disposable` object is provided, calls `dispose(this)` on that object only. + * + * @internal + * @param disposable (optional) the disposable to dispose + */ + UIRouter.prototype.dispose = function (disposable) { + var _this = this; + if (disposable && (0,_common_predicates__WEBPACK_IMPORTED_MODULE_8__.isFunction)(disposable.dispose)) { + disposable.dispose(this); + return undefined; + } + this._disposed = true; + this._disposables.slice().forEach(function (d) { + try { + typeof d.dispose === 'function' && d.dispose(_this); + (0,_common_common__WEBPACK_IMPORTED_MODULE_7__.removeFrom)(_this._disposables, d); + } + catch (ignored) { } + }); + }; + /** + * Adds a plugin to UI-Router + * + * This method adds a UI-Router Plugin. + * A plugin can enhance or change UI-Router behavior using any public API. + * + * #### Example: + * ```js + * import { MyCoolPlugin } from "ui-router-cool-plugin"; + * + * var plugin = router.addPlugin(MyCoolPlugin); + * ``` + * + * ### Plugin authoring + * + * A plugin is simply a class (or constructor function) which accepts a [[UIRouter]] instance and (optionally) an options object. + * + * The plugin can implement its functionality using any of the public APIs of [[UIRouter]]. + * For example, it may configure router options or add a Transition Hook. + * + * The plugin can then be published as a separate module. + * + * #### Example: + * ```js + * export class MyAuthPlugin implements UIRouterPlugin { + * constructor(router: UIRouter, options: any) { + * this.name = "MyAuthPlugin"; + * let $transitions = router.transitionService; + * let $state = router.stateService; + * + * let authCriteria = { + * to: (state) => state.data && state.data.requiresAuth + * }; + * + * function authHook(transition: Transition) { + * let authService = transition.injector().get('AuthService'); + * if (!authService.isAuthenticated()) { + * return $state.target('login'); + * } + * } + * + * $transitions.onStart(authCriteria, authHook); + * } + * } + * ``` + * + * @param plugin one of: + * - a plugin class which implements [[UIRouterPlugin]] + * - a constructor function for a [[UIRouterPlugin]] which accepts a [[UIRouter]] instance + * - a factory function which accepts a [[UIRouter]] instance and returns a [[UIRouterPlugin]] instance + * @param options options to pass to the plugin class/factory + * @returns the registered plugin instance + */ + UIRouter.prototype.plugin = function (plugin, options) { + if (options === void 0) { options = {}; } + var pluginInstance = new plugin(this, options); + if (!pluginInstance.name) + throw new Error('Required property `name` missing on plugin: ' + pluginInstance); + this._disposables.push(pluginInstance); + return (this._plugins[pluginInstance.name] = pluginInstance); + }; + UIRouter.prototype.getPlugin = function (pluginName) { + return pluginName ? this._plugins[pluginName] : (0,_common_common__WEBPACK_IMPORTED_MODULE_7__.values)(this._plugins); + }; + return UIRouter; +}()); + +//# sourceMappingURL=router.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/state/index.js": +/*!************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/state/index.js ***! + \************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "StateBuilder": () => (/* reexport safe */ _stateBuilder__WEBPACK_IMPORTED_MODULE_1__.StateBuilder), +/* harmony export */ "resolvablesBuilder": () => (/* reexport safe */ _stateBuilder__WEBPACK_IMPORTED_MODULE_1__.resolvablesBuilder), +/* harmony export */ "StateObject": () => (/* reexport safe */ _stateObject__WEBPACK_IMPORTED_MODULE_2__.StateObject), +/* harmony export */ "StateMatcher": () => (/* reexport safe */ _stateMatcher__WEBPACK_IMPORTED_MODULE_3__.StateMatcher), +/* harmony export */ "StateQueueManager": () => (/* reexport safe */ _stateQueueManager__WEBPACK_IMPORTED_MODULE_4__.StateQueueManager), +/* harmony export */ "StateRegistry": () => (/* reexport safe */ _stateRegistry__WEBPACK_IMPORTED_MODULE_5__.StateRegistry), +/* harmony export */ "StateService": () => (/* reexport safe */ _stateService__WEBPACK_IMPORTED_MODULE_6__.StateService), +/* harmony export */ "TargetState": () => (/* reexport safe */ _targetState__WEBPACK_IMPORTED_MODULE_7__.TargetState) +/* harmony export */ }); +/* harmony import */ var _interface__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./interface */ "./node_modules/@uirouter/core/lib-esm/state/interface.js"); +/* harmony import */ var _interface__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_interface__WEBPACK_IMPORTED_MODULE_0__); +/* harmony reexport (unknown) */ var __WEBPACK_REEXPORT_OBJECT__ = {}; +/* harmony reexport (unknown) */ for(const __WEBPACK_IMPORT_KEY__ in _interface__WEBPACK_IMPORTED_MODULE_0__) if(__WEBPACK_IMPORT_KEY__ !== "default") __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = () => _interface__WEBPACK_IMPORTED_MODULE_0__[__WEBPACK_IMPORT_KEY__] +/* harmony reexport (unknown) */ __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__); +/* harmony import */ var _stateBuilder__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./stateBuilder */ "./node_modules/@uirouter/core/lib-esm/state/stateBuilder.js"); +/* harmony import */ var _stateObject__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./stateObject */ "./node_modules/@uirouter/core/lib-esm/state/stateObject.js"); +/* harmony import */ var _stateMatcher__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./stateMatcher */ "./node_modules/@uirouter/core/lib-esm/state/stateMatcher.js"); +/* harmony import */ var _stateQueueManager__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./stateQueueManager */ "./node_modules/@uirouter/core/lib-esm/state/stateQueueManager.js"); +/* harmony import */ var _stateRegistry__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./stateRegistry */ "./node_modules/@uirouter/core/lib-esm/state/stateRegistry.js"); +/* harmony import */ var _stateService__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./stateService */ "./node_modules/@uirouter/core/lib-esm/state/stateService.js"); +/* harmony import */ var _targetState__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./targetState */ "./node_modules/@uirouter/core/lib-esm/state/targetState.js"); +/** + * # The state subsystem + * + * This subsystem implements the ui-router state tree + * + * - The [[StateService]] has state-related service methods such as: + * - [[StateService.get]]: Get a registered [[StateDeclaration]] object + * - [[StateService.go]]: Transition from the current state to a new state + * - [[StateService.reload]]: Reload the current state + * - [[StateService.target]]: Get a [[TargetState]] (useful when redirecting from a Transition Hook) + * - [[StateService.onInvalid]]: Register a callback for when a transition to an invalid state is started + * - [[StateService.defaultErrorHandler]]: Register a global callback for when a transition errors + * - The [[StateDeclaration]] interface defines the shape of a state declaration + * - The [[StateRegistry]] contains all the registered states + * - States can be added/removed using the [[StateRegistry.register]] and [[StateRegistry.deregister]] + * - Note: Bootstrap state registration differs by front-end framework. + * - Get notified of state registration/deregistration using [[StateRegistry.onStatesChanged]]. + * + * @packageDocumentation + */ + + + + + + + + +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/state/interface.js": +/*!****************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/state/interface.js ***! + \****************************************************************/ +/***/ (() => { + +//# sourceMappingURL=interface.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/state/stateBuilder.js": +/*!*******************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/state/stateBuilder.js ***! + \*******************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "resolvablesBuilder": () => (/* binding */ resolvablesBuilder), +/* harmony export */ "StateBuilder": () => (/* binding */ StateBuilder) +/* harmony export */ }); +/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/common */ "./node_modules/@uirouter/core/lib-esm/common/common.js"); +/* harmony import */ var _common_predicates__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/predicates */ "./node_modules/@uirouter/core/lib-esm/common/predicates.js"); +/* harmony import */ var _common_strings__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../common/strings */ "./node_modules/@uirouter/core/lib-esm/common/strings.js"); +/* harmony import */ var _common_hof__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../common/hof */ "./node_modules/@uirouter/core/lib-esm/common/hof.js"); +/* harmony import */ var _resolve_resolvable__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../resolve/resolvable */ "./node_modules/@uirouter/core/lib-esm/resolve/resolvable.js"); +/* harmony import */ var _common_coreservices__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../common/coreservices */ "./node_modules/@uirouter/core/lib-esm/common/coreservices.js"); + + + + + + +var parseUrl = function (url) { + if (!(0,_common_predicates__WEBPACK_IMPORTED_MODULE_1__.isString)(url)) + return false; + var root = url.charAt(0) === '^'; + return { val: root ? url.substring(1) : url, root: root }; +}; +function nameBuilder(state) { + return state.name; +} +function selfBuilder(state) { + state.self.$$state = function () { return state; }; + return state.self; +} +function dataBuilder(state) { + if (state.parent && state.parent.data) { + state.data = state.self.data = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.inherit)(state.parent.data, state.data); + } + return state.data; +} +var getUrlBuilder = function ($urlMatcherFactoryProvider, root) { + return function urlBuilder(stateObject) { + var stateDec = stateObject.self; + // For future states, i.e., states whose name ends with `.**`, + // match anything that starts with the url prefix + if (stateDec && stateDec.url && stateDec.name && stateDec.name.match(/\.\*\*$/)) { + var newStateDec = {}; + (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.copy)(stateDec, newStateDec); + newStateDec.url += '{remainder:any}'; // match any path (.*) + stateDec = newStateDec; + } + var parent = stateObject.parent; + var parsed = parseUrl(stateDec.url); + var url = !parsed ? stateDec.url : $urlMatcherFactoryProvider.compile(parsed.val, { state: stateDec }); + if (!url) + return null; + if (!$urlMatcherFactoryProvider.isMatcher(url)) + throw new Error("Invalid url '" + url + "' in state '" + stateObject + "'"); + return parsed && parsed.root ? url : ((parent && parent.navigable) || root()).url.append(url); + }; +}; +var getNavigableBuilder = function (isRoot) { + return function navigableBuilder(state) { + return !isRoot(state) && state.url ? state : state.parent ? state.parent.navigable : null; + }; +}; +var getParamsBuilder = function (paramFactory) { + return function paramsBuilder(state) { + var makeConfigParam = function (config, id) { return paramFactory.fromConfig(id, null, state.self); }; + var urlParams = (state.url && state.url.parameters({ inherit: false })) || []; + var nonUrlParams = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.values)((0,_common_common__WEBPACK_IMPORTED_MODULE_0__.mapObj)((0,_common_common__WEBPACK_IMPORTED_MODULE_0__.omit)(state.params || {}, urlParams.map((0,_common_hof__WEBPACK_IMPORTED_MODULE_3__.prop)('id'))), makeConfigParam)); + return urlParams + .concat(nonUrlParams) + .map(function (p) { return [p.id, p]; }) + .reduce(_common_common__WEBPACK_IMPORTED_MODULE_0__.applyPairs, {}); + }; +}; +function pathBuilder(state) { + return state.parent ? state.parent.path.concat(state) : /*root*/ [state]; +} +function includesBuilder(state) { + var includes = state.parent ? (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.extend)({}, state.parent.includes) : {}; + includes[state.name] = true; + return includes; +} +/** + * This is a [[StateBuilder.builder]] function for the `resolve:` block on a [[StateDeclaration]]. + * + * When the [[StateBuilder]] builds a [[StateObject]] object from a raw [[StateDeclaration]], this builder + * validates the `resolve` property and converts it to a [[Resolvable]] array. + * + * resolve: input value can be: + * + * { + * // analyzed but not injected + * myFooResolve: function() { return "myFooData"; }, + * + * // function.toString() parsed, "DependencyName" dep as string (not min-safe) + * myBarResolve: function(DependencyName) { return DependencyName.fetchSomethingAsPromise() }, + * + * // Array split; "DependencyName" dep as string + * myBazResolve: [ "DependencyName", function(dep) { return dep.fetchSomethingAsPromise() }, + * + * // Array split; DependencyType dep as token (compared using ===) + * myQuxResolve: [ DependencyType, function(dep) { return dep.fetchSometingAsPromise() }, + * + * // val.$inject used as deps + * // where: + * // corgeResolve.$inject = ["DependencyName"]; + * // function corgeResolve(dep) { dep.fetchSometingAsPromise() } + * // then "DependencyName" dep as string + * myCorgeResolve: corgeResolve, + * + * // inject service by name + * // When a string is found, desugar creating a resolve that injects the named service + * myGraultResolve: "SomeService" + * } + * + * or: + * + * [ + * new Resolvable("myFooResolve", function() { return "myFooData" }), + * new Resolvable("myBarResolve", function(dep) { return dep.fetchSomethingAsPromise() }, [ "DependencyName" ]), + * { provide: "myBazResolve", useFactory: function(dep) { dep.fetchSomethingAsPromise() }, deps: [ "DependencyName" ] } + * ] + */ +function resolvablesBuilder(state) { + /** convert resolve: {} and resolvePolicy: {} objects to an array of tuples */ + var objects2Tuples = function (resolveObj, resolvePolicies) { + return Object.keys(resolveObj || {}).map(function (token) { return ({ + token: token, + val: resolveObj[token], + deps: undefined, + policy: resolvePolicies[token], + }); }); + }; + /** fetch DI annotations from a function or ng1-style array */ + var annotate = function (fn) { + var $injector = _common_coreservices__WEBPACK_IMPORTED_MODULE_5__.services.$injector; + // ng1 doesn't have an $injector until runtime. + // If the $injector doesn't exist, use "deferred" literal as a + // marker indicating they should be annotated when runtime starts + return fn['$inject'] || ($injector && $injector.annotate(fn, $injector.strictDi)) || 'deferred'; + }; + /** true if the object has both `token` and `resolveFn`, and is probably a [[ResolveLiteral]] */ + var isResolveLiteral = function (obj) { return !!(obj.token && obj.resolveFn); }; + /** true if the object looks like a provide literal, or a ng2 Provider */ + var isLikeNg2Provider = function (obj) { + return !!((obj.provide || obj.token) && (obj.useValue || obj.useFactory || obj.useExisting || obj.useClass)); + }; + /** true if the object looks like a tuple from obj2Tuples */ + var isTupleFromObj = function (obj) { + return !!(obj && obj.val && ((0,_common_predicates__WEBPACK_IMPORTED_MODULE_1__.isString)(obj.val) || (0,_common_predicates__WEBPACK_IMPORTED_MODULE_1__.isArray)(obj.val) || (0,_common_predicates__WEBPACK_IMPORTED_MODULE_1__.isFunction)(obj.val))); + }; + /** extracts the token from a Provider or provide literal */ + var getToken = function (p) { return p.provide || p.token; }; + // prettier-ignore: Given a literal resolve or provider object, returns a Resolvable + var literal2Resolvable = (0,_common_hof__WEBPACK_IMPORTED_MODULE_3__.pattern)([ + [(0,_common_hof__WEBPACK_IMPORTED_MODULE_3__.prop)('resolveFn'), function (p) { return new _resolve_resolvable__WEBPACK_IMPORTED_MODULE_4__.Resolvable(getToken(p), p.resolveFn, p.deps, p.policy); }], + [(0,_common_hof__WEBPACK_IMPORTED_MODULE_3__.prop)('useFactory'), function (p) { return new _resolve_resolvable__WEBPACK_IMPORTED_MODULE_4__.Resolvable(getToken(p), p.useFactory, p.deps || p.dependencies, p.policy); }], + [(0,_common_hof__WEBPACK_IMPORTED_MODULE_3__.prop)('useClass'), function (p) { return new _resolve_resolvable__WEBPACK_IMPORTED_MODULE_4__.Resolvable(getToken(p), function () { return new p.useClass(); }, [], p.policy); }], + [(0,_common_hof__WEBPACK_IMPORTED_MODULE_3__.prop)('useValue'), function (p) { return new _resolve_resolvable__WEBPACK_IMPORTED_MODULE_4__.Resolvable(getToken(p), function () { return p.useValue; }, [], p.policy, p.useValue); }], + [(0,_common_hof__WEBPACK_IMPORTED_MODULE_3__.prop)('useExisting'), function (p) { return new _resolve_resolvable__WEBPACK_IMPORTED_MODULE_4__.Resolvable(getToken(p), _common_common__WEBPACK_IMPORTED_MODULE_0__.identity, [p.useExisting], p.policy); }], + ]); + // prettier-ignore + var tuple2Resolvable = (0,_common_hof__WEBPACK_IMPORTED_MODULE_3__.pattern)([ + [(0,_common_hof__WEBPACK_IMPORTED_MODULE_3__.pipe)((0,_common_hof__WEBPACK_IMPORTED_MODULE_3__.prop)('val'), _common_predicates__WEBPACK_IMPORTED_MODULE_1__.isString), function (tuple) { return new _resolve_resolvable__WEBPACK_IMPORTED_MODULE_4__.Resolvable(tuple.token, _common_common__WEBPACK_IMPORTED_MODULE_0__.identity, [tuple.val], tuple.policy); }], + [(0,_common_hof__WEBPACK_IMPORTED_MODULE_3__.pipe)((0,_common_hof__WEBPACK_IMPORTED_MODULE_3__.prop)('val'), _common_predicates__WEBPACK_IMPORTED_MODULE_1__.isArray), function (tuple) { return new _resolve_resolvable__WEBPACK_IMPORTED_MODULE_4__.Resolvable(tuple.token, (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.tail)(tuple.val), tuple.val.slice(0, -1), tuple.policy); }], + [(0,_common_hof__WEBPACK_IMPORTED_MODULE_3__.pipe)((0,_common_hof__WEBPACK_IMPORTED_MODULE_3__.prop)('val'), _common_predicates__WEBPACK_IMPORTED_MODULE_1__.isFunction), function (tuple) { return new _resolve_resolvable__WEBPACK_IMPORTED_MODULE_4__.Resolvable(tuple.token, tuple.val, annotate(tuple.val), tuple.policy); }], + ]); + // prettier-ignore + var item2Resolvable = (0,_common_hof__WEBPACK_IMPORTED_MODULE_3__.pattern)([ + [(0,_common_hof__WEBPACK_IMPORTED_MODULE_3__.is)(_resolve_resolvable__WEBPACK_IMPORTED_MODULE_4__.Resolvable), function (r) { return r; }], + [isResolveLiteral, literal2Resolvable], + [isLikeNg2Provider, literal2Resolvable], + [isTupleFromObj, tuple2Resolvable], + [(0,_common_hof__WEBPACK_IMPORTED_MODULE_3__.val)(true), function (obj) { throw new Error('Invalid resolve value: ' + (0,_common_strings__WEBPACK_IMPORTED_MODULE_2__.stringify)(obj)); },], + ]); + // If resolveBlock is already an array, use it as-is. + // Otherwise, assume it's an object and convert to an Array of tuples + var decl = state.resolve; + var items = (0,_common_predicates__WEBPACK_IMPORTED_MODULE_1__.isArray)(decl) ? decl : objects2Tuples(decl, state.resolvePolicy || {}); + return items.map(item2Resolvable); +} +/** + * A internal global service + * + * StateBuilder is a factory for the internal [[StateObject]] objects. + * + * When you register a state with the [[StateRegistry]], you register a plain old javascript object which + * conforms to the [[StateDeclaration]] interface. This factory takes that object and builds the corresponding + * [[StateObject]] object, which has an API and is used internally. + * + * Custom properties or API may be added to the internal [[StateObject]] object by registering a decorator function + * using the [[builder]] method. + */ +var StateBuilder = /** @class */ (function () { + function StateBuilder(matcher, urlMatcherFactory) { + this.matcher = matcher; + var self = this; + var root = function () { return matcher.find(''); }; + var isRoot = function (state) { return state.name === ''; }; + function parentBuilder(state) { + if (isRoot(state)) + return null; + return matcher.find(self.parentName(state)) || root(); + } + this.builders = { + name: [nameBuilder], + self: [selfBuilder], + parent: [parentBuilder], + data: [dataBuilder], + // Build a URLMatcher if necessary, either via a relative or absolute URL + url: [getUrlBuilder(urlMatcherFactory, root)], + // Keep track of the closest ancestor state that has a URL (i.e. is navigable) + navigable: [getNavigableBuilder(isRoot)], + params: [getParamsBuilder(urlMatcherFactory.paramFactory)], + // Each framework-specific ui-router implementation should define its own `views` builder + // e.g., src/ng1/statebuilders/views.ts + views: [], + // Keep a full path from the root down to this state as this is needed for state activation. + path: [pathBuilder], + // Speed up $state.includes() as it's used a lot + includes: [includesBuilder], + resolvables: [resolvablesBuilder], + }; + } + StateBuilder.prototype.builder = function (name, fn) { + var builders = this.builders; + var array = builders[name] || []; + // Backwards compat: if only one builder exists, return it, else return whole arary. + if ((0,_common_predicates__WEBPACK_IMPORTED_MODULE_1__.isString)(name) && !(0,_common_predicates__WEBPACK_IMPORTED_MODULE_1__.isDefined)(fn)) + return array.length > 1 ? array : array[0]; + if (!(0,_common_predicates__WEBPACK_IMPORTED_MODULE_1__.isString)(name) || !(0,_common_predicates__WEBPACK_IMPORTED_MODULE_1__.isFunction)(fn)) + return; + builders[name] = array; + builders[name].push(fn); + return function () { return builders[name].splice(builders[name].indexOf(fn, 1)) && null; }; + }; + /** + * Builds all of the properties on an essentially blank State object, returning a State object which has all its + * properties and API built. + * + * @param state an uninitialized State object + * @returns the built State object + */ + StateBuilder.prototype.build = function (state) { + var _a = this, matcher = _a.matcher, builders = _a.builders; + var parent = this.parentName(state); + if (parent && !matcher.find(parent, undefined, false)) { + return null; + } + for (var key in builders) { + if (!builders.hasOwnProperty(key)) + continue; + var chain = builders[key].reduce(function (parentFn, step) { return function (_state) { return step(_state, parentFn); }; }, _common_common__WEBPACK_IMPORTED_MODULE_0__.noop); + state[key] = chain(state); + } + return state; + }; + StateBuilder.prototype.parentName = function (state) { + // name = 'foo.bar.baz.**' + var name = state.name || ''; + // segments = ['foo', 'bar', 'baz', '.**'] + var segments = name.split('.'); + // segments = ['foo', 'bar', 'baz'] + var lastSegment = segments.pop(); + // segments = ['foo', 'bar'] (ignore .** segment for future states) + if (lastSegment === '**') + segments.pop(); + if (segments.length) { + if (state.parent) { + throw new Error("States that specify the 'parent:' property should not have a '.' in their name (" + name + ")"); + } + // 'foo.bar' + return segments.join('.'); + } + if (!state.parent) + return ''; + return (0,_common_predicates__WEBPACK_IMPORTED_MODULE_1__.isString)(state.parent) ? state.parent : state.parent.name; + }; + StateBuilder.prototype.name = function (state) { + var name = state.name; + if (name.indexOf('.') !== -1 || !state.parent) + return name; + var parentName = (0,_common_predicates__WEBPACK_IMPORTED_MODULE_1__.isString)(state.parent) ? state.parent : state.parent.name; + return parentName ? parentName + '.' + name : name; + }; + return StateBuilder; +}()); + +//# sourceMappingURL=stateBuilder.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/state/stateMatcher.js": +/*!*******************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/state/stateMatcher.js ***! + \*******************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "StateMatcher": () => (/* binding */ StateMatcher) +/* harmony export */ }); +/* harmony import */ var _common_predicates__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/predicates */ "./node_modules/@uirouter/core/lib-esm/common/predicates.js"); +/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/common */ "./node_modules/@uirouter/core/lib-esm/common/common.js"); +/* harmony import */ var _common_safeConsole__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../common/safeConsole */ "./node_modules/@uirouter/core/lib-esm/common/safeConsole.js"); + + + +var StateMatcher = /** @class */ (function () { + function StateMatcher(_states) { + this._states = _states; + } + StateMatcher.prototype.isRelative = function (stateName) { + stateName = stateName || ''; + return stateName.indexOf('.') === 0 || stateName.indexOf('^') === 0; + }; + StateMatcher.prototype.find = function (stateOrName, base, matchGlob) { + if (matchGlob === void 0) { matchGlob = true; } + if (!stateOrName && stateOrName !== '') + return undefined; + var isStr = (0,_common_predicates__WEBPACK_IMPORTED_MODULE_0__.isString)(stateOrName); + var name = isStr ? stateOrName : stateOrName.name; + if (this.isRelative(name)) + name = this.resolvePath(name, base); + var state = this._states[name]; + if (state && (isStr || (!isStr && (state === stateOrName || state.self === stateOrName)))) { + return state; + } + else if (isStr && matchGlob) { + var _states = (0,_common_common__WEBPACK_IMPORTED_MODULE_1__.values)(this._states); + var matches = _states.filter(function (_state) { return _state.__stateObjectCache.nameGlob && _state.__stateObjectCache.nameGlob.matches(name); }); + if (matches.length > 1) { + _common_safeConsole__WEBPACK_IMPORTED_MODULE_2__.safeConsole.error("stateMatcher.find: Found multiple matches for " + name + " using glob: ", matches.map(function (match) { return match.name; })); + } + return matches[0]; + } + return undefined; + }; + StateMatcher.prototype.resolvePath = function (name, base) { + if (!base) + throw new Error("No reference point given for path '" + name + "'"); + var baseState = this.find(base); + var splitName = name.split('.'); + var pathLength = splitName.length; + var i = 0, current = baseState; + for (; i < pathLength; i++) { + if (splitName[i] === '' && i === 0) { + current = baseState; + continue; + } + if (splitName[i] === '^') { + if (!current.parent) + throw new Error("Path '" + name + "' not valid for state '" + baseState.name + "'"); + current = current.parent; + continue; + } + break; + } + var relName = splitName.slice(i).join('.'); + return current.name + (current.name && relName ? '.' : '') + relName; + }; + return StateMatcher; +}()); + +//# sourceMappingURL=stateMatcher.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/state/stateObject.js": +/*!******************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/state/stateObject.js ***! + \******************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "StateObject": () => (/* binding */ StateObject) +/* harmony export */ }); +/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/common */ "./node_modules/@uirouter/core/lib-esm/common/common.js"); +/* harmony import */ var _common_hof__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/hof */ "./node_modules/@uirouter/core/lib-esm/common/hof.js"); +/* harmony import */ var _common_glob__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../common/glob */ "./node_modules/@uirouter/core/lib-esm/common/glob.js"); +/* harmony import */ var _common_predicates__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../common/predicates */ "./node_modules/@uirouter/core/lib-esm/common/predicates.js"); + + + + +/** + * Internal representation of a UI-Router state. + * + * Instances of this class are created when a [[StateDeclaration]] is registered with the [[StateRegistry]]. + * + * A registered [[StateDeclaration]] is augmented with a getter ([[StateDeclaration.$$state]]) which returns the corresponding [[StateObject]] object. + * + * This class prototypally inherits from the corresponding [[StateDeclaration]]. + * Each of its own properties (i.e., `hasOwnProperty`) are built using builders from the [[StateBuilder]]. + */ +var StateObject = /** @class */ (function () { + /** @deprecated use State.create() */ + function StateObject(config) { + return StateObject.create(config || {}); + } + /** + * Create a state object to put the private/internal implementation details onto. + * The object's prototype chain looks like: + * (Internal State Object) -> (Copy of State.prototype) -> (State Declaration object) -> (State Declaration's prototype...) + * + * @param stateDecl the user-supplied State Declaration + * @returns {StateObject} an internal State object + */ + StateObject.create = function (stateDecl) { + stateDecl = StateObject.isStateClass(stateDecl) ? new stateDecl() : stateDecl; + var state = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.inherit)((0,_common_common__WEBPACK_IMPORTED_MODULE_0__.inherit)(stateDecl, StateObject.prototype)); + stateDecl.$$state = function () { return state; }; + state.self = stateDecl; + state.__stateObjectCache = { + nameGlob: _common_glob__WEBPACK_IMPORTED_MODULE_2__.Glob.fromString(state.name), + }; + return state; + }; + /** + * Returns true if the provided parameter is the same state. + * + * Compares the identity of the state against the passed value, which is either an object + * reference to the actual `State` instance, the original definition object passed to + * `$stateProvider.state()`, or the fully-qualified name. + * + * @param ref Can be one of (a) a `State` instance, (b) an object that was passed + * into `$stateProvider.state()`, (c) the fully-qualified name of a state as a string. + * @returns Returns `true` if `ref` matches the current `State` instance. + */ + StateObject.prototype.is = function (ref) { + return this === ref || this.self === ref || this.fqn() === ref; + }; + /** + * @deprecated this does not properly handle dot notation + * @returns Returns a dot-separated name of the state. + */ + StateObject.prototype.fqn = function () { + if (!this.parent || !(this.parent instanceof this.constructor)) + return this.name; + var name = this.parent.fqn(); + return name ? name + '.' + this.name : this.name; + }; + /** + * Returns the root node of this state's tree. + * + * @returns The root of this state's tree. + */ + StateObject.prototype.root = function () { + return (this.parent && this.parent.root()) || this; + }; + /** + * Gets the state's `Param` objects + * + * Gets the list of [[Param]] objects owned by the state. + * If `opts.inherit` is true, it also includes the ancestor states' [[Param]] objects. + * If `opts.matchingKeys` exists, returns only `Param`s whose `id` is a key on the `matchingKeys` object + * + * @param opts options + */ + StateObject.prototype.parameters = function (opts) { + opts = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.defaults)(opts, { inherit: true, matchingKeys: null }); + var inherited = (opts.inherit && this.parent && this.parent.parameters()) || []; + return inherited + .concat((0,_common_common__WEBPACK_IMPORTED_MODULE_0__.values)(this.params)) + .filter(function (param) { return !opts.matchingKeys || opts.matchingKeys.hasOwnProperty(param.id); }); + }; + /** + * Returns a single [[Param]] that is owned by the state + * + * If `opts.inherit` is true, it also searches the ancestor states` [[Param]]s. + * @param id the name of the [[Param]] to return + * @param opts options + */ + StateObject.prototype.parameter = function (id, opts) { + if (opts === void 0) { opts = {}; } + return ((this.url && this.url.parameter(id, opts)) || + (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.find)((0,_common_common__WEBPACK_IMPORTED_MODULE_0__.values)(this.params), (0,_common_hof__WEBPACK_IMPORTED_MODULE_1__.propEq)('id', id)) || + (opts.inherit && this.parent && this.parent.parameter(id))); + }; + StateObject.prototype.toString = function () { + return this.fqn(); + }; + /** Predicate which returns true if the object is an class with @State() decorator */ + StateObject.isStateClass = function (stateDecl) { + return (0,_common_predicates__WEBPACK_IMPORTED_MODULE_3__.isFunction)(stateDecl) && stateDecl['__uiRouterState'] === true; + }; + /** Predicate which returns true if the object is a [[StateDeclaration]] object */ + StateObject.isStateDeclaration = function (obj) { return (0,_common_predicates__WEBPACK_IMPORTED_MODULE_3__.isFunction)(obj['$$state']); }; + /** Predicate which returns true if the object is an internal [[StateObject]] object */ + StateObject.isState = function (obj) { return (0,_common_predicates__WEBPACK_IMPORTED_MODULE_3__.isObject)(obj['__stateObjectCache']); }; + return StateObject; +}()); + +//# sourceMappingURL=stateObject.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/state/stateQueueManager.js": +/*!************************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/state/stateQueueManager.js ***! + \************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "StateQueueManager": () => (/* binding */ StateQueueManager) +/* harmony export */ }); +/* harmony import */ var _common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common */ "./node_modules/@uirouter/core/lib-esm/common/index.js"); +/* harmony import */ var _stateObject__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./stateObject */ "./node_modules/@uirouter/core/lib-esm/state/stateObject.js"); + + +var StateQueueManager = /** @class */ (function () { + function StateQueueManager(router, states, builder, listeners) { + this.router = router; + this.states = states; + this.builder = builder; + this.listeners = listeners; + this.queue = []; + } + StateQueueManager.prototype.dispose = function () { + this.queue = []; + }; + StateQueueManager.prototype.register = function (stateDecl) { + var queue = this.queue; + var state = _stateObject__WEBPACK_IMPORTED_MODULE_1__.StateObject.create(stateDecl); + var name = state.name; + if (!(0,_common__WEBPACK_IMPORTED_MODULE_0__.isString)(name)) + throw new Error('State must have a valid name'); + if (this.states.hasOwnProperty(name) || (0,_common__WEBPACK_IMPORTED_MODULE_0__.inArray)(queue.map((0,_common__WEBPACK_IMPORTED_MODULE_0__.prop)('name')), name)) + throw new Error("State '" + name + "' is already defined"); + queue.push(state); + this.flush(); + return state; + }; + StateQueueManager.prototype.flush = function () { + var _this = this; + var _a = this, queue = _a.queue, states = _a.states, builder = _a.builder; + var registered = [], // states that got registered + orphans = [], // states that don't yet have a parent registered + previousQueueLength = {}; // keep track of how long the queue when an orphan was first encountered + var getState = function (name) { return _this.states.hasOwnProperty(name) && _this.states[name]; }; + var notifyListeners = function () { + if (registered.length) { + _this.listeners.forEach(function (listener) { + return listener('registered', registered.map(function (s) { return s.self; })); + }); + } + }; + while (queue.length > 0) { + var state = queue.shift(); + var name_1 = state.name; + var result = builder.build(state); + var orphanIdx = orphans.indexOf(state); + if (result) { + var existingState = getState(name_1); + if (existingState && existingState.name === name_1) { + throw new Error("State '" + name_1 + "' is already defined"); + } + var existingFutureState = getState(name_1 + '.**'); + if (existingFutureState) { + // Remove future state of the same name + this.router.stateRegistry.deregister(existingFutureState); + } + states[name_1] = state; + this.attachRoute(state); + if (orphanIdx >= 0) + orphans.splice(orphanIdx, 1); + registered.push(state); + continue; + } + var prev = previousQueueLength[name_1]; + previousQueueLength[name_1] = queue.length; + if (orphanIdx >= 0 && prev === queue.length) { + // Wait until two consecutive iterations where no additional states were dequeued successfully. + // throw new Error(`Cannot register orphaned state '${name}'`); + queue.push(state); + notifyListeners(); + return states; + } + else if (orphanIdx < 0) { + orphans.push(state); + } + queue.push(state); + } + notifyListeners(); + return states; + }; + StateQueueManager.prototype.attachRoute = function (state) { + if (state.abstract || !state.url) + return; + var rulesApi = this.router.urlService.rules; + rulesApi.rule(rulesApi.urlRuleFactory.create(state)); + }; + return StateQueueManager; +}()); + +//# sourceMappingURL=stateQueueManager.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/state/stateRegistry.js": +/*!********************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/state/stateRegistry.js ***! + \********************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "StateRegistry": () => (/* binding */ StateRegistry) +/* harmony export */ }); +/* harmony import */ var _stateMatcher__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./stateMatcher */ "./node_modules/@uirouter/core/lib-esm/state/stateMatcher.js"); +/* harmony import */ var _stateBuilder__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./stateBuilder */ "./node_modules/@uirouter/core/lib-esm/state/stateBuilder.js"); +/* harmony import */ var _stateQueueManager__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./stateQueueManager */ "./node_modules/@uirouter/core/lib-esm/state/stateQueueManager.js"); +/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../common/common */ "./node_modules/@uirouter/core/lib-esm/common/common.js"); +/* harmony import */ var _common_hof__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../common/hof */ "./node_modules/@uirouter/core/lib-esm/common/hof.js"); + + + + + +/** + * A registry for all of the application's [[StateDeclaration]]s + * + * This API is found at `router.stateRegistry` ([[UIRouter.stateRegistry]]) + */ +var StateRegistry = /** @class */ (function () { + /** @internal */ + function StateRegistry(router) { + this.router = router; + this.states = {}; + /** @internal */ + this.listeners = []; + this.matcher = new _stateMatcher__WEBPACK_IMPORTED_MODULE_0__.StateMatcher(this.states); + this.builder = new _stateBuilder__WEBPACK_IMPORTED_MODULE_1__.StateBuilder(this.matcher, router.urlMatcherFactory); + this.stateQueue = new _stateQueueManager__WEBPACK_IMPORTED_MODULE_2__.StateQueueManager(router, this.states, this.builder, this.listeners); + this._registerRoot(); + } + /** @internal */ + StateRegistry.prototype._registerRoot = function () { + var rootStateDef = { + name: '', + url: '^', + views: null, + params: { + '#': { value: null, type: 'hash', dynamic: true }, + }, + abstract: true, + }; + var _root = (this._root = this.stateQueue.register(rootStateDef)); + _root.navigable = null; + }; + /** @internal */ + StateRegistry.prototype.dispose = function () { + var _this = this; + this.stateQueue.dispose(); + this.listeners = []; + this.get().forEach(function (state) { return _this.get(state) && _this.deregister(state); }); + }; + /** + * Listen for a State Registry events + * + * Adds a callback that is invoked when states are registered or deregistered with the StateRegistry. + * + * #### Example: + * ```js + * let allStates = registry.get(); + * + * // Later, invoke deregisterFn() to remove the listener + * let deregisterFn = registry.onStatesChanged((event, states) => { + * switch(event) { + * case: 'registered': + * states.forEach(state => allStates.push(state)); + * break; + * case: 'deregistered': + * states.forEach(state => { + * let idx = allStates.indexOf(state); + * if (idx !== -1) allStates.splice(idx, 1); + * }); + * break; + * } + * }); + * ``` + * + * @param listener a callback function invoked when the registered states changes. + * The function receives two parameters, `event` and `state`. + * See [[StateRegistryListener]] + * @return a function that deregisters the listener + */ + StateRegistry.prototype.onStatesChanged = function (listener) { + this.listeners.push(listener); + return function deregisterListener() { + (0,_common_common__WEBPACK_IMPORTED_MODULE_3__.removeFrom)(this.listeners)(listener); + }.bind(this); + }; + /** + * Gets the implicit root state + * + * Gets the root of the state tree. + * The root state is implicitly created by UI-Router. + * Note: this returns the internal [[StateObject]] representation, not a [[StateDeclaration]] + * + * @return the root [[StateObject]] + */ + StateRegistry.prototype.root = function () { + return this._root; + }; + /** + * Adds a state to the registry + * + * Registers a [[StateDeclaration]] or queues it for registration. + * + * Note: a state will be queued if the state's parent isn't yet registered. + * + * @param stateDefinition the definition of the state to register. + * @returns the internal [[StateObject]] object. + * If the state was successfully registered, then the object is fully built (See: [[StateBuilder]]). + * If the state was only queued, then the object is not fully built. + */ + StateRegistry.prototype.register = function (stateDefinition) { + return this.stateQueue.register(stateDefinition); + }; + /** @internal */ + StateRegistry.prototype._deregisterTree = function (state) { + var _this = this; + var all = this.get().map(function (s) { return s.$$state(); }); + var getChildren = function (states) { + var _children = all.filter(function (s) { return states.indexOf(s.parent) !== -1; }); + return _children.length === 0 ? _children : _children.concat(getChildren(_children)); + }; + var children = getChildren([state]); + var deregistered = [state].concat(children).reverse(); + deregistered.forEach(function (_state) { + var rulesApi = _this.router.urlService.rules; + // Remove URL rule + rulesApi + .rules() + .filter((0,_common_hof__WEBPACK_IMPORTED_MODULE_4__.propEq)('state', _state)) + .forEach(function (rule) { return rulesApi.removeRule(rule); }); + // Remove state from registry + delete _this.states[_state.name]; + }); + return deregistered; + }; + /** + * Removes a state from the registry + * + * This removes a state from the registry. + * If the state has children, they are are also removed from the registry. + * + * @param stateOrName the state's name or object representation + * @returns {StateObject[]} a list of removed states + */ + StateRegistry.prototype.deregister = function (stateOrName) { + var _state = this.get(stateOrName); + if (!_state) + throw new Error("Can't deregister state; not found: " + stateOrName); + var deregisteredStates = this._deregisterTree(_state.$$state()); + this.listeners.forEach(function (listener) { + return listener('deregistered', deregisteredStates.map(function (s) { return s.self; })); + }); + return deregisteredStates; + }; + StateRegistry.prototype.get = function (stateOrName, base) { + var _this = this; + if (arguments.length === 0) + return Object.keys(this.states).map(function (name) { return _this.states[name].self; }); + var found = this.matcher.find(stateOrName, base); + return (found && found.self) || null; + }; + /** + * Registers a [[BuilderFunction]] for a specific [[StateObject]] property (e.g., `parent`, `url`, or `path`). + * More than one BuilderFunction can be registered for a given property. + * + * The BuilderFunction(s) will be used to define the property on any subsequently built [[StateObject]] objects. + * + * @param property The name of the State property being registered for. + * @param builderFunction The BuilderFunction which will be used to build the State property + * @returns a function which deregisters the BuilderFunction + */ + StateRegistry.prototype.decorator = function (property, builderFunction) { + return this.builder.builder(property, builderFunction); + }; + return StateRegistry; +}()); + +//# sourceMappingURL=stateRegistry.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/state/stateService.js": +/*!*******************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/state/stateService.js ***! + \*******************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "StateService": () => (/* binding */ StateService) +/* harmony export */ }); +/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/common */ "./node_modules/@uirouter/core/lib-esm/common/common.js"); +/* harmony import */ var _common_predicates__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/predicates */ "./node_modules/@uirouter/core/lib-esm/common/predicates.js"); +/* harmony import */ var _common_queue__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../common/queue */ "./node_modules/@uirouter/core/lib-esm/common/queue.js"); +/* harmony import */ var _common_coreservices__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../common/coreservices */ "./node_modules/@uirouter/core/lib-esm/common/coreservices.js"); +/* harmony import */ var _path_pathUtils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../path/pathUtils */ "./node_modules/@uirouter/core/lib-esm/path/pathUtils.js"); +/* harmony import */ var _path_pathNode__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../path/pathNode */ "./node_modules/@uirouter/core/lib-esm/path/pathNode.js"); +/* harmony import */ var _transition_transitionService__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../transition/transitionService */ "./node_modules/@uirouter/core/lib-esm/transition/transitionService.js"); +/* harmony import */ var _transition_rejectFactory__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../transition/rejectFactory */ "./node_modules/@uirouter/core/lib-esm/transition/rejectFactory.js"); +/* harmony import */ var _targetState__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./targetState */ "./node_modules/@uirouter/core/lib-esm/state/targetState.js"); +/* harmony import */ var _params_param__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../params/param */ "./node_modules/@uirouter/core/lib-esm/params/param.js"); +/* harmony import */ var _common_glob__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../common/glob */ "./node_modules/@uirouter/core/lib-esm/common/glob.js"); +/* harmony import */ var _resolve_resolveContext__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../resolve/resolveContext */ "./node_modules/@uirouter/core/lib-esm/resolve/resolveContext.js"); +/* harmony import */ var _hooks_lazyLoad__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../hooks/lazyLoad */ "./node_modules/@uirouter/core/lib-esm/hooks/lazyLoad.js"); +/* harmony import */ var _common_hof__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../common/hof */ "./node_modules/@uirouter/core/lib-esm/common/hof.js"); + + + + + + + + + + + + + + +/** + * Provides services related to ui-router states. + * + * This API is located at `router.stateService` ([[UIRouter.stateService]]) + */ +var StateService = /** @class */ (function () { + /** @internal */ + function StateService(/** @internal */ router) { + this.router = router; + /** @internal */ + this.invalidCallbacks = []; + /** @internal */ + this._defaultErrorHandler = function $defaultErrorHandler($error$) { + if ($error$ instanceof Error && $error$.stack) { + console.error($error$); + console.error($error$.stack); + } + else if ($error$ instanceof _transition_rejectFactory__WEBPACK_IMPORTED_MODULE_7__.Rejection) { + console.error($error$.toString()); + if ($error$.detail && $error$.detail.stack) + console.error($error$.detail.stack); + } + else { + console.error($error$); + } + }; + var getters = ['current', '$current', 'params', 'transition']; + var boundFns = Object.keys(StateService.prototype).filter((0,_common_hof__WEBPACK_IMPORTED_MODULE_13__.not)((0,_common_common__WEBPACK_IMPORTED_MODULE_0__.inArray)(getters))); + (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.createProxyFunctions)((0,_common_hof__WEBPACK_IMPORTED_MODULE_13__.val)(StateService.prototype), this, (0,_common_hof__WEBPACK_IMPORTED_MODULE_13__.val)(this), boundFns); + } + Object.defineProperty(StateService.prototype, "transition", { + /** + * The [[Transition]] currently in progress (or null) + * + * @deprecated This is a passthrough through to [[UIRouterGlobals.transition]] + */ + get: function () { + return this.router.globals.transition; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(StateService.prototype, "params", { + /** + * The latest successful state parameters + * + * @deprecated This is a passthrough through to [[UIRouterGlobals.params]] + */ + get: function () { + return this.router.globals.params; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(StateService.prototype, "current", { + /** + * The current [[StateDeclaration]] + * + * @deprecated This is a passthrough through to [[UIRouterGlobals.current]] + */ + get: function () { + return this.router.globals.current; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(StateService.prototype, "$current", { + /** + * The current [[StateObject]] (an internal API) + * + * @deprecated This is a passthrough through to [[UIRouterGlobals.$current]] + */ + get: function () { + return this.router.globals.$current; + }, + enumerable: false, + configurable: true + }); + /** @internal */ + StateService.prototype.dispose = function () { + this.defaultErrorHandler(_common_common__WEBPACK_IMPORTED_MODULE_0__.noop); + this.invalidCallbacks = []; + }; + /** + * Handler for when [[transitionTo]] is called with an invalid state. + * + * Invokes the [[onInvalid]] callbacks, in natural order. + * Each callback's return value is checked in sequence until one of them returns an instance of TargetState. + * The results of the callbacks are wrapped in $q.when(), so the callbacks may return promises. + * + * If a callback returns an TargetState, then it is used as arguments to $state.transitionTo() and the result returned. + * + * @internal + */ + StateService.prototype._handleInvalidTargetState = function (fromPath, toState) { + var _this = this; + var fromState = _path_pathUtils__WEBPACK_IMPORTED_MODULE_4__.PathUtils.makeTargetState(this.router.stateRegistry, fromPath); + var globals = this.router.globals; + var latestThing = function () { return globals.transitionHistory.peekTail(); }; + var latest = latestThing(); + var callbackQueue = new _common_queue__WEBPACK_IMPORTED_MODULE_2__.Queue(this.invalidCallbacks.slice()); + var injector = new _resolve_resolveContext__WEBPACK_IMPORTED_MODULE_11__.ResolveContext(fromPath).injector(); + var checkForRedirect = function (result) { + if (!(result instanceof _targetState__WEBPACK_IMPORTED_MODULE_8__.TargetState)) { + return; + } + var target = result; + // Recreate the TargetState, in case the state is now defined. + target = _this.target(target.identifier(), target.params(), target.options()); + if (!target.valid()) { + return _transition_rejectFactory__WEBPACK_IMPORTED_MODULE_7__.Rejection.invalid(target.error()).toPromise(); + } + if (latestThing() !== latest) { + return _transition_rejectFactory__WEBPACK_IMPORTED_MODULE_7__.Rejection.superseded().toPromise(); + } + return _this.transitionTo(target.identifier(), target.params(), target.options()); + }; + function invokeNextCallback() { + var nextCallback = callbackQueue.dequeue(); + if (nextCallback === undefined) + return _transition_rejectFactory__WEBPACK_IMPORTED_MODULE_7__.Rejection.invalid(toState.error()).toPromise(); + var callbackResult = _common_coreservices__WEBPACK_IMPORTED_MODULE_3__.services.$q.when(nextCallback(toState, fromState, injector)); + return callbackResult.then(checkForRedirect).then(function (result) { return result || invokeNextCallback(); }); + } + return invokeNextCallback(); + }; + /** + * Registers an Invalid State handler + * + * Registers a [[OnInvalidCallback]] function to be invoked when [[StateService.transitionTo]] + * has been called with an invalid state reference parameter + * + * Example: + * ```js + * stateService.onInvalid(function(to, from, injector) { + * if (to.name() === 'foo') { + * let lazyLoader = injector.get('LazyLoadService'); + * return lazyLoader.load('foo') + * .then(() => stateService.target('foo')); + * } + * }); + * ``` + * + * @param {function} callback invoked when the toState is invalid + * This function receives the (invalid) toState, the fromState, and an injector. + * The function may optionally return a [[TargetState]] or a Promise for a TargetState. + * If one is returned, it is treated as a redirect. + * + * @returns a function which deregisters the callback + */ + StateService.prototype.onInvalid = function (callback) { + this.invalidCallbacks.push(callback); + return function deregisterListener() { + (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.removeFrom)(this.invalidCallbacks)(callback); + }.bind(this); + }; + /** + * Reloads the current state + * + * A method that force reloads the current state, or a partial state hierarchy. + * All resolves are re-resolved, and components reinstantiated. + * + * #### Example: + * ```js + * let app angular.module('app', ['ui.router']); + * + * app.controller('ctrl', function ($scope, $state) { + * $scope.reload = function(){ + * $state.reload(); + * } + * }); + * ``` + * + * Note: `reload()` is just an alias for: + * + * ```js + * $state.transitionTo($state.current, $state.params, { + * reload: true, inherit: false + * }); + * ``` + * + * @param reloadState A state name or a state object. + * If present, this state and all its children will be reloaded, but ancestors will not reload. + * + * #### Example: + * ```js + * //assuming app application consists of 3 states: 'contacts', 'contacts.detail', 'contacts.detail.item' + * //and current state is 'contacts.detail.item' + * let app angular.module('app', ['ui.router']); + * + * app.controller('ctrl', function ($scope, $state) { + * $scope.reload = function(){ + * //will reload 'contact.detail' and nested 'contact.detail.item' states + * $state.reload('contact.detail'); + * } + * }); + * ``` + * + * @returns A promise representing the state of the new transition. See [[StateService.go]] + */ + StateService.prototype.reload = function (reloadState) { + return this.transitionTo(this.current, this.params, { + reload: (0,_common_predicates__WEBPACK_IMPORTED_MODULE_1__.isDefined)(reloadState) ? reloadState : true, + inherit: false, + notify: false, + }); + }; + /** + * Transition to a different state and/or parameters + * + * Convenience method for transitioning to a new state. + * + * `$state.go` calls `$state.transitionTo` internally but automatically sets options to + * `{ location: true, inherit: true, relative: router.globals.$current, notify: true }`. + * This allows you to use either an absolute or relative `to` argument (because of `relative: router.globals.$current`). + * It also allows you to specify * only the parameters you'd like to update, while letting unspecified parameters + * inherit from the current parameter values (because of `inherit: true`). + * + * #### Example: + * ```js + * let app = angular.module('app', ['ui.router']); + * + * app.controller('ctrl', function ($scope, $state) { + * $scope.changeState = function () { + * $state.go('contact.detail'); + * }; + * }); + * ``` + * + * @param to Absolute state name, state object, or relative state path (relative to current state). + * + * Some examples: + * + * - `$state.go('contact.detail')` - will go to the `contact.detail` state + * - `$state.go('^')` - will go to the parent state + * - `$state.go('^.sibling')` - if current state is `home.child`, will go to the `home.sibling` state + * - `$state.go('.child.grandchild')` - if current state is home, will go to the `home.child.grandchild` state + * + * @param params A map of the parameters that will be sent to the state, will populate $stateParams. + * + * Any parameters that are not specified will be inherited from current parameter values (because of `inherit: true`). + * This allows, for example, going to a sibling state that shares parameters defined by a parent state. + * + * @param options Transition options + * + * @returns {promise} A promise representing the state of the new transition. + */ + StateService.prototype.go = function (to, params, options) { + var defautGoOpts = { relative: this.$current, inherit: true }; + var transOpts = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.defaults)(options, defautGoOpts, _transition_transitionService__WEBPACK_IMPORTED_MODULE_6__.defaultTransOpts); + return this.transitionTo(to, params, transOpts); + }; + /** + * Creates a [[TargetState]] + * + * This is a factory method for creating a TargetState + * + * This may be returned from a Transition Hook to redirect a transition, for example. + */ + StateService.prototype.target = function (identifier, params, options) { + if (options === void 0) { options = {}; } + // If we're reloading, find the state object to reload from + if ((0,_common_predicates__WEBPACK_IMPORTED_MODULE_1__.isObject)(options.reload) && !options.reload.name) + throw new Error('Invalid reload state object'); + var reg = this.router.stateRegistry; + options.reloadState = + options.reload === true ? reg.root() : reg.matcher.find(options.reload, options.relative); + if (options.reload && !options.reloadState) + throw new Error("No such reload state '" + ((0,_common_predicates__WEBPACK_IMPORTED_MODULE_1__.isString)(options.reload) ? options.reload : options.reload.name) + "'"); + return new _targetState__WEBPACK_IMPORTED_MODULE_8__.TargetState(this.router.stateRegistry, identifier, params, options); + }; + /** @internal */ + StateService.prototype.getCurrentPath = function () { + var _this = this; + var globals = this.router.globals; + var latestSuccess = globals.successfulTransitions.peekTail(); + var rootPath = function () { return [new _path_pathNode__WEBPACK_IMPORTED_MODULE_5__.PathNode(_this.router.stateRegistry.root())]; }; + return latestSuccess ? latestSuccess.treeChanges().to : rootPath(); + }; + /** + * Low-level method for transitioning to a new state. + * + * The [[go]] method (which uses `transitionTo` internally) is recommended in most situations. + * + * #### Example: + * ```js + * let app = angular.module('app', ['ui.router']); + * + * app.controller('ctrl', function ($scope, $state) { + * $scope.changeState = function () { + * $state.transitionTo('contact.detail'); + * }; + * }); + * ``` + * + * @param to State name or state object. + * @param toParams A map of the parameters that will be sent to the state, + * will populate $stateParams. + * @param options Transition options + * + * @returns A promise representing the state of the new transition. See [[go]] + */ + StateService.prototype.transitionTo = function (to, toParams, options) { + var _this = this; + if (toParams === void 0) { toParams = {}; } + if (options === void 0) { options = {}; } + var router = this.router; + var globals = router.globals; + options = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.defaults)(options, _transition_transitionService__WEBPACK_IMPORTED_MODULE_6__.defaultTransOpts); + var getCurrent = function () { return globals.transition; }; + options = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.extend)(options, { current: getCurrent }); + var ref = this.target(to, toParams, options); + var currentPath = this.getCurrentPath(); + if (!ref.exists()) + return this._handleInvalidTargetState(currentPath, ref); + if (!ref.valid()) + return (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.silentRejection)(ref.error()); + if (options.supercede === false && getCurrent()) { + return (_transition_rejectFactory__WEBPACK_IMPORTED_MODULE_7__.Rejection.ignored('Another transition is in progress and supercede has been set to false in TransitionOptions for the transition. So the transition was ignored in favour of the existing one in progress.').toPromise()); + } + /** + * Special handling for Ignored, Aborted, and Redirected transitions + * + * The semantics for the transition.run() promise and the StateService.transitionTo() + * promise differ. For instance, the run() promise may be rejected because it was + * IGNORED, but the transitionTo() promise is resolved because from the user perspective + * no error occurred. Likewise, the transition.run() promise may be rejected because of + * a Redirect, but the transitionTo() promise is chained to the new Transition's promise. + */ + var rejectedTransitionHandler = function (trans) { return function (error) { + if (error instanceof _transition_rejectFactory__WEBPACK_IMPORTED_MODULE_7__.Rejection) { + var isLatest = router.globals.lastStartedTransitionId <= trans.$id; + if (error.type === _transition_rejectFactory__WEBPACK_IMPORTED_MODULE_7__.RejectType.IGNORED) { + isLatest && router.urlRouter.update(); + // Consider ignored `Transition.run()` as a successful `transitionTo` + return _common_coreservices__WEBPACK_IMPORTED_MODULE_3__.services.$q.when(globals.current); + } + var detail = error.detail; + if (error.type === _transition_rejectFactory__WEBPACK_IMPORTED_MODULE_7__.RejectType.SUPERSEDED && error.redirected && detail instanceof _targetState__WEBPACK_IMPORTED_MODULE_8__.TargetState) { + // If `Transition.run()` was redirected, allow the `transitionTo()` promise to resolve successfully + // by returning the promise for the new (redirect) `Transition.run()`. + var redirect = trans.redirect(detail); + return redirect.run().catch(rejectedTransitionHandler(redirect)); + } + if (error.type === _transition_rejectFactory__WEBPACK_IMPORTED_MODULE_7__.RejectType.ABORTED) { + isLatest && router.urlRouter.update(); + return _common_coreservices__WEBPACK_IMPORTED_MODULE_3__.services.$q.reject(error); + } + } + var errorHandler = _this.defaultErrorHandler(); + errorHandler(error); + return _common_coreservices__WEBPACK_IMPORTED_MODULE_3__.services.$q.reject(error); + }; }; + var transition = this.router.transitionService.create(currentPath, ref); + var transitionToPromise = transition.run().catch(rejectedTransitionHandler(transition)); + (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.silenceUncaughtInPromise)(transitionToPromise); // issue #2676 + // Return a promise for the transition, which also has the transition object on it. + return (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.extend)(transitionToPromise, { transition: transition }); + }; + /** + * Checks if the current state *is* the provided state + * + * Similar to [[includes]] but only checks for the full state name. + * If params is supplied then it will be tested for strict equality against the current + * active params object, so all params must match with none missing and no extras. + * + * #### Example: + * ```js + * $state.$current.name = 'contacts.details.item'; + * + * // absolute name + * $state.is('contact.details.item'); // returns true + * $state.is(contactDetailItemStateObject); // returns true + * ``` + * + * // relative name (. and ^), typically from a template + * // E.g. from the 'contacts.details' template + * ```html + *
    Item
    + * ``` + * + * @param stateOrName The state name (absolute or relative) or state object you'd like to check. + * @param params A param object, e.g. `{sectionId: section.id}`, that you'd like + * to test against the current active state. + * @param options An options object. The options are: + * - `relative`: If `stateOrName` is a relative state name and `options.relative` is set, .is will + * test relative to `options.relative` state (or name). + * + * @returns Returns true if it is the state. + */ + StateService.prototype.is = function (stateOrName, params, options) { + options = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.defaults)(options, { relative: this.$current }); + var state = this.router.stateRegistry.matcher.find(stateOrName, options.relative); + if (!(0,_common_predicates__WEBPACK_IMPORTED_MODULE_1__.isDefined)(state)) + return undefined; + if (this.$current !== state) + return false; + if (!params) + return true; + var schema = state.parameters({ inherit: true, matchingKeys: params }); + return _params_param__WEBPACK_IMPORTED_MODULE_9__.Param.equals(schema, _params_param__WEBPACK_IMPORTED_MODULE_9__.Param.values(schema, params), this.params); + }; + /** + * Checks if the current state *includes* the provided state + * + * A method to determine if the current active state is equal to or is the child of the + * state stateName. If any params are passed then they will be tested for a match as well. + * Not all the parameters need to be passed, just the ones you'd like to test for equality. + * + * #### Example when `$state.$current.name === 'contacts.details.item'` + * ```js + * // Using partial names + * $state.includes("contacts"); // returns true + * $state.includes("contacts.details"); // returns true + * $state.includes("contacts.details.item"); // returns true + * $state.includes("contacts.list"); // returns false + * $state.includes("about"); // returns false + * ``` + * + * #### Glob Examples when `* $state.$current.name === 'contacts.details.item.url'`: + * ```js + * $state.includes("*.details.*.*"); // returns true + * $state.includes("*.details.**"); // returns true + * $state.includes("**.item.**"); // returns true + * $state.includes("*.details.item.url"); // returns true + * $state.includes("*.details.*.url"); // returns true + * $state.includes("*.details.*"); // returns false + * $state.includes("item.**"); // returns false + * ``` + * + * @param stateOrName A partial name, relative name, glob pattern, + * or state object to be searched for within the current state name. + * @param params A param object, e.g. `{sectionId: section.id}`, + * that you'd like to test against the current active state. + * @param options An options object. The options are: + * - `relative`: If `stateOrName` is a relative state name and `options.relative` is set, .is will + * test relative to `options.relative` state (or name). + * + * @returns {boolean} Returns true if it does include the state + */ + StateService.prototype.includes = function (stateOrName, params, options) { + options = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.defaults)(options, { relative: this.$current }); + var glob = (0,_common_predicates__WEBPACK_IMPORTED_MODULE_1__.isString)(stateOrName) && _common_glob__WEBPACK_IMPORTED_MODULE_10__.Glob.fromString(stateOrName); + if (glob) { + if (!glob.matches(this.$current.name)) + return false; + stateOrName = this.$current.name; + } + var state = this.router.stateRegistry.matcher.find(stateOrName, options.relative), include = this.$current.includes; + if (!(0,_common_predicates__WEBPACK_IMPORTED_MODULE_1__.isDefined)(state)) + return undefined; + if (!(0,_common_predicates__WEBPACK_IMPORTED_MODULE_1__.isDefined)(include[state.name])) + return false; + if (!params) + return true; + var schema = state.parameters({ inherit: true, matchingKeys: params }); + return _params_param__WEBPACK_IMPORTED_MODULE_9__.Param.equals(schema, _params_param__WEBPACK_IMPORTED_MODULE_9__.Param.values(schema, params), this.params); + }; + /** + * Generates a URL for a state and parameters + * + * Returns the url for the given state populated with the given params. + * + * #### Example: + * ```js + * expect($state.href("about.person", { person: "bob" })).toEqual("/about/bob"); + * ``` + * + * @param stateOrName The state name or state object you'd like to generate a url from. + * @param params An object of parameter values to fill the state's required parameters. + * @param options Options object. The options are: + * + * @returns {string} compiled state url + */ + StateService.prototype.href = function (stateOrName, params, options) { + var defaultHrefOpts = { + lossy: true, + inherit: true, + absolute: false, + relative: this.$current, + }; + options = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.defaults)(options, defaultHrefOpts); + params = params || {}; + var state = this.router.stateRegistry.matcher.find(stateOrName, options.relative); + if (!(0,_common_predicates__WEBPACK_IMPORTED_MODULE_1__.isDefined)(state)) + return null; + if (options.inherit) + params = this.params.$inherit(params, this.$current, state); + var nav = state && options.lossy ? state.navigable : state; + if (!nav || nav.url === undefined || nav.url === null) { + return null; + } + return this.router.urlRouter.href(nav.url, params, { absolute: options.absolute }); + }; + /** + * Sets or gets the default [[transitionTo]] error handler. + * + * The error handler is called when a [[Transition]] is rejected or when any error occurred during the Transition. + * This includes errors caused by resolves and transition hooks. + * + * Note: + * This handler does not receive certain Transition rejections. + * Redirected and Ignored Transitions are not considered to be errors by [[StateService.transitionTo]]. + * + * The built-in default error handler logs the error to the console. + * + * You can provide your own custom handler. + * + * #### Example: + * ```js + * stateService.defaultErrorHandler(function() { + * // Do not log transitionTo errors + * }); + * ``` + * + * @param handler a global error handler function + * @returns the current global error handler + */ + StateService.prototype.defaultErrorHandler = function (handler) { + return (this._defaultErrorHandler = handler || this._defaultErrorHandler); + }; + StateService.prototype.get = function (stateOrName, base) { + var reg = this.router.stateRegistry; + if (arguments.length === 0) + return reg.get(); + return reg.get(stateOrName, base || this.$current); + }; + /** + * Lazy loads a state + * + * Explicitly runs a state's [[StateDeclaration.lazyLoad]] function. + * + * @param stateOrName the state that should be lazy loaded + * @param transition the optional Transition context to use (if the lazyLoad function requires an injector, etc) + * Note: If no transition is provided, a noop transition is created using the from the current state to the current state. + * This noop transition is not actually run. + * + * @returns a promise to lazy load + */ + StateService.prototype.lazyLoad = function (stateOrName, transition) { + var state = this.get(stateOrName); + if (!state || !state.lazyLoad) + throw new Error('Can not lazy load ' + stateOrName); + var currentPath = this.getCurrentPath(); + var target = _path_pathUtils__WEBPACK_IMPORTED_MODULE_4__.PathUtils.makeTargetState(this.router.stateRegistry, currentPath); + transition = transition || this.router.transitionService.create(currentPath, target); + return (0,_hooks_lazyLoad__WEBPACK_IMPORTED_MODULE_12__.lazyLoadState)(transition, state); + }; + return StateService; +}()); + +//# sourceMappingURL=stateService.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/state/targetState.js": +/*!******************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/state/targetState.js ***! + \******************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "TargetState": () => (/* binding */ TargetState) +/* harmony export */ }); +/* harmony import */ var _common_predicates__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/predicates */ "./node_modules/@uirouter/core/lib-esm/common/predicates.js"); +/* harmony import */ var _common_strings__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/strings */ "./node_modules/@uirouter/core/lib-esm/common/strings.js"); +/* harmony import */ var _common__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../common */ "./node_modules/@uirouter/core/lib-esm/common/index.js"); + + + +/** + * Encapsulate the target (destination) state/params/options of a [[Transition]]. + * + * This class is frequently used to redirect a transition to a new destination. + * + * See: + * + * - [[HookResult]] + * - [[TransitionHookFn]] + * - [[TransitionService.onStart]] + * + * To create a `TargetState`, use [[StateService.target]]. + * + * --- + * + * This class wraps: + * + * 1) an identifier for a state + * 2) a set of parameters + * 3) and transition options + * 4) the registered state object (the [[StateDeclaration]]) + * + * Many UI-Router APIs such as [[StateService.go]] take a [[StateOrName]] argument which can + * either be a *state object* (a [[StateDeclaration]] or [[StateObject]]) or a *state name* (a string). + * The `TargetState` class normalizes those options. + * + * A `TargetState` may be valid (the state being targeted exists in the registry) + * or invalid (the state being targeted is not registered). + */ +var TargetState = /** @class */ (function () { + /** + * The TargetState constructor + * + * Note: Do not construct a `TargetState` manually. + * To create a `TargetState`, use the [[StateService.target]] factory method. + * + * @param _stateRegistry The StateRegistry to use to look up the _definition + * @param _identifier An identifier for a state. + * Either a fully-qualified state name, or the object used to define the state. + * @param _params Parameters for the target state + * @param _options Transition options. + * + * @internal + */ + function TargetState(_stateRegistry, _identifier, _params, _options) { + this._stateRegistry = _stateRegistry; + this._identifier = _identifier; + this._identifier = _identifier; + this._params = (0,_common__WEBPACK_IMPORTED_MODULE_2__.extend)({}, _params || {}); + this._options = (0,_common__WEBPACK_IMPORTED_MODULE_2__.extend)({}, _options || {}); + this._definition = _stateRegistry.matcher.find(_identifier, this._options.relative); + } + /** The name of the state this object targets */ + TargetState.prototype.name = function () { + return (this._definition && this._definition.name) || this._identifier; + }; + /** The identifier used when creating this TargetState */ + TargetState.prototype.identifier = function () { + return this._identifier; + }; + /** The target parameter values */ + TargetState.prototype.params = function () { + return this._params; + }; + /** The internal state object (if it was found) */ + TargetState.prototype.$state = function () { + return this._definition; + }; + /** The internal state declaration (if it was found) */ + TargetState.prototype.state = function () { + return this._definition && this._definition.self; + }; + /** The target options */ + TargetState.prototype.options = function () { + return this._options; + }; + /** True if the target state was found */ + TargetState.prototype.exists = function () { + return !!(this._definition && this._definition.self); + }; + /** True if the object is valid */ + TargetState.prototype.valid = function () { + return !this.error(); + }; + /** If the object is invalid, returns the reason why */ + TargetState.prototype.error = function () { + var base = this.options().relative; + if (!this._definition && !!base) { + var stateName = base.name ? base.name : base; + return "Could not resolve '" + this.name() + "' from state '" + stateName + "'"; + } + if (!this._definition) + return "No such state '" + this.name() + "'"; + if (!this._definition.self) + return "State '" + this.name() + "' has an invalid definition"; + }; + TargetState.prototype.toString = function () { + return "'" + this.name() + "'" + (0,_common_strings__WEBPACK_IMPORTED_MODULE_1__.stringify)(this.params()); + }; + /** + * Returns a copy of this TargetState which targets a different state. + * The new TargetState has the same parameter values and transition options. + * + * @param state The new state that should be targeted + */ + TargetState.prototype.withState = function (state) { + return new TargetState(this._stateRegistry, state, this._params, this._options); + }; + /** + * Returns a copy of this TargetState, using the specified parameter values. + * + * @param params the new parameter values to use + * @param replace When false (default) the new parameter values will be merged with the current values. + * When true the parameter values will be used instead of the current values. + */ + TargetState.prototype.withParams = function (params, replace) { + if (replace === void 0) { replace = false; } + var newParams = replace ? params : (0,_common__WEBPACK_IMPORTED_MODULE_2__.extend)({}, this._params, params); + return new TargetState(this._stateRegistry, this._identifier, newParams, this._options); + }; + /** + * Returns a copy of this TargetState, using the specified Transition Options. + * + * @param options the new options to use + * @param replace When false (default) the new options will be merged with the current options. + * When true the options will be used instead of the current options. + */ + TargetState.prototype.withOptions = function (options, replace) { + if (replace === void 0) { replace = false; } + var newOpts = replace ? options : (0,_common__WEBPACK_IMPORTED_MODULE_2__.extend)({}, this._options, options); + return new TargetState(this._stateRegistry, this._identifier, this._params, newOpts); + }; + /** Returns true if the object has a state property that might be a state or state name */ + TargetState.isDef = function (obj) { + return obj && obj.state && ((0,_common_predicates__WEBPACK_IMPORTED_MODULE_0__.isString)(obj.state) || ((0,_common_predicates__WEBPACK_IMPORTED_MODULE_0__.isObject)(obj.state) && (0,_common_predicates__WEBPACK_IMPORTED_MODULE_0__.isString)(obj.state.name))); + }; + return TargetState; +}()); + +//# sourceMappingURL=targetState.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/transition/hookBuilder.js": +/*!***********************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/transition/hookBuilder.js ***! + \***********************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "HookBuilder": () => (/* binding */ HookBuilder) +/* harmony export */ }); +/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/common */ "./node_modules/@uirouter/core/lib-esm/common/common.js"); +/* harmony import */ var _common_predicates__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/predicates */ "./node_modules/@uirouter/core/lib-esm/common/predicates.js"); +/* harmony import */ var _interface__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./interface */ "./node_modules/@uirouter/core/lib-esm/transition/interface.js"); +/* harmony import */ var _transitionHook__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./transitionHook */ "./node_modules/@uirouter/core/lib-esm/transition/transitionHook.js"); + + + + +/** + * This class returns applicable TransitionHooks for a specific Transition instance. + * + * Hooks ([[RegisteredHook]]) may be registered globally, e.g., $transitions.onEnter(...), or locally, e.g. + * myTransition.onEnter(...). The HookBuilder finds matching RegisteredHooks (where the match criteria is + * determined by the type of hook) + * + * The HookBuilder also converts RegisteredHooks objects to TransitionHook objects, which are used to run a Transition. + * + * The HookBuilder constructor is given the $transitions service and a Transition instance. Thus, a HookBuilder + * instance may only be used for one specific Transition object. (side note: the _treeChanges accessor is private + * in the Transition class, so we must also provide the Transition's _treeChanges) + */ +var HookBuilder = /** @class */ (function () { + function HookBuilder(transition) { + this.transition = transition; + } + HookBuilder.prototype.buildHooksForPhase = function (phase) { + var _this = this; + var $transitions = this.transition.router.transitionService; + return $transitions._pluginapi + ._getEvents(phase) + .map(function (type) { return _this.buildHooks(type); }) + .reduce(_common_common__WEBPACK_IMPORTED_MODULE_0__.unnestR, []) + .filter(_common_common__WEBPACK_IMPORTED_MODULE_0__.identity); + }; + /** + * Returns an array of newly built TransitionHook objects. + * + * - Finds all RegisteredHooks registered for the given `hookType` which matched the transition's [[TreeChanges]]. + * - Finds [[PathNode]] (or `PathNode[]`) to use as the TransitionHook context(s) + * - For each of the [[PathNode]]s, creates a TransitionHook + * + * @param hookType the type of the hook registration function, e.g., 'onEnter', 'onFinish'. + */ + HookBuilder.prototype.buildHooks = function (hookType) { + var transition = this.transition; + var treeChanges = transition.treeChanges(); + // Find all the matching registered hooks for a given hook type + var matchingHooks = this.getMatchingHooks(hookType, treeChanges, transition); + if (!matchingHooks) + return []; + var baseHookOptions = { + transition: transition, + current: transition.options().current, + }; + var makeTransitionHooks = function (hook) { + // Fetch the Nodes that caused this hook to match. + var matches = hook.matches(treeChanges, transition); + // Select the PathNode[] that will be used as TransitionHook context objects + var matchingNodes = matches[hookType.criteriaMatchPath.name]; + // Return an array of HookTuples + return matchingNodes.map(function (node) { + var _options = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.extend)({ + bind: hook.bind, + traceData: { hookType: hookType.name, context: node }, + }, baseHookOptions); + var state = hookType.criteriaMatchPath.scope === _interface__WEBPACK_IMPORTED_MODULE_2__.TransitionHookScope.STATE ? node.state.self : null; + var transitionHook = new _transitionHook__WEBPACK_IMPORTED_MODULE_3__.TransitionHook(transition, state, hook, _options); + return { hook: hook, node: node, transitionHook: transitionHook }; + }); + }; + return matchingHooks + .map(makeTransitionHooks) + .reduce(_common_common__WEBPACK_IMPORTED_MODULE_0__.unnestR, []) + .sort(tupleSort(hookType.reverseSort)) + .map(function (tuple) { return tuple.transitionHook; }); + }; + /** + * Finds all RegisteredHooks from: + * - The Transition object instance hook registry + * - The TransitionService ($transitions) global hook registry + * + * which matched: + * - the eventType + * - the matchCriteria (to, from, exiting, retained, entering) + * + * @returns an array of matched [[RegisteredHook]]s + */ + HookBuilder.prototype.getMatchingHooks = function (hookType, treeChanges, transition) { + var isCreate = hookType.hookPhase === _interface__WEBPACK_IMPORTED_MODULE_2__.TransitionHookPhase.CREATE; + // Instance and Global hook registries + var $transitions = this.transition.router.transitionService; + var registries = isCreate ? [$transitions] : [this.transition, $transitions]; + return registries + .map(function (reg) { return reg.getHooks(hookType.name); }) // Get named hooks from registries + .filter((0,_common_common__WEBPACK_IMPORTED_MODULE_0__.assertPredicate)(_common_predicates__WEBPACK_IMPORTED_MODULE_1__.isArray, "broken event named: " + hookType.name)) // Sanity check + .reduce(_common_common__WEBPACK_IMPORTED_MODULE_0__.unnestR, []) // Un-nest RegisteredHook[][] to RegisteredHook[] array + .filter(function (hook) { return hook.matches(treeChanges, transition); }); // Only those satisfying matchCriteria + }; + return HookBuilder; +}()); + +/** + * A factory for a sort function for HookTuples. + * + * The sort function first compares the PathNode depth (how deep in the state tree a node is), then compares + * the EventHook priority. + * + * @param reverseDepthSort a boolean, when true, reverses the sort order for the node depth + * @returns a tuple sort function + */ +function tupleSort(reverseDepthSort) { + if (reverseDepthSort === void 0) { reverseDepthSort = false; } + return function nodeDepthThenPriority(l, r) { + var factor = reverseDepthSort ? -1 : 1; + var depthDelta = (l.node.state.path.length - r.node.state.path.length) * factor; + return depthDelta !== 0 ? depthDelta : r.hook.priority - l.hook.priority; + }; +} +//# sourceMappingURL=hookBuilder.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/transition/hookRegistry.js": +/*!************************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/transition/hookRegistry.js ***! + \************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "matchState": () => (/* binding */ matchState), +/* harmony export */ "RegisteredHook": () => (/* binding */ RegisteredHook), +/* harmony export */ "makeEvent": () => (/* binding */ makeEvent) +/* harmony export */ }); +/* harmony import */ var _common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common */ "./node_modules/@uirouter/core/lib-esm/common/index.js"); +/* harmony import */ var _interface__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./interface */ "./node_modules/@uirouter/core/lib-esm/transition/interface.js"); + + +/** + * Determines if the given state matches the matchCriteria + * + * @internal + * + * @param state a State Object to test against + * @param criterion + * - If a string, matchState uses the string as a glob-matcher against the state name + * - If an array (of strings), matchState uses each string in the array as a glob-matchers against the state name + * and returns a positive match if any of the globs match. + * - If a function, matchState calls the function with the state and returns true if the function's result is truthy. + * @returns {boolean} + */ +function matchState(state, criterion, transition) { + var toMatch = (0,_common__WEBPACK_IMPORTED_MODULE_0__.isString)(criterion) ? [criterion] : criterion; + function matchGlobs(_state) { + var globStrings = toMatch; + for (var i = 0; i < globStrings.length; i++) { + var glob = new _common__WEBPACK_IMPORTED_MODULE_0__.Glob(globStrings[i]); + if ((glob && glob.matches(_state.name)) || (!glob && globStrings[i] === _state.name)) { + return true; + } + } + return false; + } + var matchFn = ((0,_common__WEBPACK_IMPORTED_MODULE_0__.isFunction)(toMatch) ? toMatch : matchGlobs); + return !!matchFn(state, transition); +} +/** + * The registration data for a registered transition hook + */ +var RegisteredHook = /** @class */ (function () { + function RegisteredHook(tranSvc, eventType, callback, matchCriteria, removeHookFromRegistry, options) { + if (options === void 0) { options = {}; } + this.tranSvc = tranSvc; + this.eventType = eventType; + this.callback = callback; + this.matchCriteria = matchCriteria; + this.removeHookFromRegistry = removeHookFromRegistry; + this.invokeCount = 0; + this._deregistered = false; + this.priority = options.priority || 0; + this.bind = options.bind || null; + this.invokeLimit = options.invokeLimit; + } + /** + * Gets the matching [[PathNode]]s + * + * Given an array of [[PathNode]]s, and a [[HookMatchCriterion]], returns an array containing + * the [[PathNode]]s that the criteria matches, or `null` if there were no matching nodes. + * + * Returning `null` is significant to distinguish between the default + * "match-all criterion value" of `true` compared to a `() => true` function, + * when the nodes is an empty array. + * + * This is useful to allow a transition match criteria of `entering: true` + * to still match a transition, even when `entering === []`. Contrast that + * with `entering: (state) => true` which only matches when a state is actually + * being entered. + */ + RegisteredHook.prototype._matchingNodes = function (nodes, criterion, transition) { + if (criterion === true) + return nodes; + var matching = nodes.filter(function (node) { return matchState(node.state, criterion, transition); }); + return matching.length ? matching : null; + }; + /** + * Gets the default match criteria (all `true`) + * + * Returns an object which has all the criteria match paths as keys and `true` as values, i.e.: + * + * ```js + * { + * to: true, + * from: true, + * entering: true, + * exiting: true, + * retained: true, + * } + */ + RegisteredHook.prototype._getDefaultMatchCriteria = function () { + return (0,_common__WEBPACK_IMPORTED_MODULE_0__.mapObj)(this.tranSvc._pluginapi._getPathTypes(), function () { return true; }); + }; + /** + * Gets matching nodes as [[IMatchingNodes]] + * + * Create a IMatchingNodes object from the TransitionHookTypes that is roughly equivalent to: + * + * ```js + * let matches: IMatchingNodes = { + * to: _matchingNodes([tail(treeChanges.to)], mc.to), + * from: _matchingNodes([tail(treeChanges.from)], mc.from), + * exiting: _matchingNodes(treeChanges.exiting, mc.exiting), + * retained: _matchingNodes(treeChanges.retained, mc.retained), + * entering: _matchingNodes(treeChanges.entering, mc.entering), + * }; + * ``` + */ + RegisteredHook.prototype._getMatchingNodes = function (treeChanges, transition) { + var _this = this; + var criteria = (0,_common__WEBPACK_IMPORTED_MODULE_0__.extend)(this._getDefaultMatchCriteria(), this.matchCriteria); + var paths = (0,_common__WEBPACK_IMPORTED_MODULE_0__.values)(this.tranSvc._pluginapi._getPathTypes()); + return paths.reduce(function (mn, pathtype) { + // STATE scope criteria matches against every node in the path. + // TRANSITION scope criteria matches against only the last node in the path + var isStateHook = pathtype.scope === _interface__WEBPACK_IMPORTED_MODULE_1__.TransitionHookScope.STATE; + var path = treeChanges[pathtype.name] || []; + var nodes = isStateHook ? path : [(0,_common__WEBPACK_IMPORTED_MODULE_0__.tail)(path)]; + mn[pathtype.name] = _this._matchingNodes(nodes, criteria[pathtype.name], transition); + return mn; + }, {}); + }; + /** + * Determines if this hook's [[matchCriteria]] match the given [[TreeChanges]] + * + * @returns an IMatchingNodes object, or null. If an IMatchingNodes object is returned, its values + * are the matching [[PathNode]]s for each [[HookMatchCriterion]] (to, from, exiting, retained, entering) + */ + RegisteredHook.prototype.matches = function (treeChanges, transition) { + var matches = this._getMatchingNodes(treeChanges, transition); + // Check if all the criteria matched the TreeChanges object + var allMatched = (0,_common__WEBPACK_IMPORTED_MODULE_0__.values)(matches).every(_common__WEBPACK_IMPORTED_MODULE_0__.identity); + return allMatched ? matches : null; + }; + RegisteredHook.prototype.deregister = function () { + this.removeHookFromRegistry(this); + this._deregistered = true; + }; + return RegisteredHook; +}()); + +/** Return a registration function of the requested type. */ +function makeEvent(registry, transitionService, eventType) { + // Create the object which holds the registered transition hooks. + var _registeredHooks = (registry._registeredHooks = registry._registeredHooks || {}); + var hooks = (_registeredHooks[eventType.name] = []); + var removeHookFn = (0,_common__WEBPACK_IMPORTED_MODULE_0__.removeFrom)(hooks); + // Create hook registration function on the IHookRegistry for the event + registry[eventType.name] = hookRegistrationFn; + function hookRegistrationFn(matchObject, callback, options) { + if (options === void 0) { options = {}; } + var registeredHook = new RegisteredHook(transitionService, eventType, callback, matchObject, removeHookFn, options); + hooks.push(registeredHook); + return registeredHook.deregister.bind(registeredHook); + } + return hookRegistrationFn; +} +//# sourceMappingURL=hookRegistry.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/transition/index.js": +/*!*****************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/transition/index.js ***! + \*****************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "TransitionHookPhase": () => (/* reexport safe */ _interface__WEBPACK_IMPORTED_MODULE_0__.TransitionHookPhase), +/* harmony export */ "TransitionHookScope": () => (/* reexport safe */ _interface__WEBPACK_IMPORTED_MODULE_0__.TransitionHookScope), +/* harmony export */ "HookBuilder": () => (/* reexport safe */ _hookBuilder__WEBPACK_IMPORTED_MODULE_1__.HookBuilder), +/* harmony export */ "RegisteredHook": () => (/* reexport safe */ _hookRegistry__WEBPACK_IMPORTED_MODULE_2__.RegisteredHook), +/* harmony export */ "makeEvent": () => (/* reexport safe */ _hookRegistry__WEBPACK_IMPORTED_MODULE_2__.makeEvent), +/* harmony export */ "matchState": () => (/* reexport safe */ _hookRegistry__WEBPACK_IMPORTED_MODULE_2__.matchState), +/* harmony export */ "RejectType": () => (/* reexport safe */ _rejectFactory__WEBPACK_IMPORTED_MODULE_3__.RejectType), +/* harmony export */ "Rejection": () => (/* reexport safe */ _rejectFactory__WEBPACK_IMPORTED_MODULE_3__.Rejection), +/* harmony export */ "Transition": () => (/* reexport safe */ _transition__WEBPACK_IMPORTED_MODULE_4__.Transition), +/* harmony export */ "TransitionHook": () => (/* reexport safe */ _transitionHook__WEBPACK_IMPORTED_MODULE_5__.TransitionHook), +/* harmony export */ "TransitionEventType": () => (/* reexport safe */ _transitionEventType__WEBPACK_IMPORTED_MODULE_6__.TransitionEventType), +/* harmony export */ "TransitionService": () => (/* reexport safe */ _transitionService__WEBPACK_IMPORTED_MODULE_7__.TransitionService), +/* harmony export */ "defaultTransOpts": () => (/* reexport safe */ _transitionService__WEBPACK_IMPORTED_MODULE_7__.defaultTransOpts) +/* harmony export */ }); +/* harmony import */ var _interface__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./interface */ "./node_modules/@uirouter/core/lib-esm/transition/interface.js"); +/* harmony import */ var _hookBuilder__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./hookBuilder */ "./node_modules/@uirouter/core/lib-esm/transition/hookBuilder.js"); +/* harmony import */ var _hookRegistry__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./hookRegistry */ "./node_modules/@uirouter/core/lib-esm/transition/hookRegistry.js"); +/* harmony import */ var _rejectFactory__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./rejectFactory */ "./node_modules/@uirouter/core/lib-esm/transition/rejectFactory.js"); +/* harmony import */ var _transition__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./transition */ "./node_modules/@uirouter/core/lib-esm/transition/transition.js"); +/* harmony import */ var _transitionHook__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./transitionHook */ "./node_modules/@uirouter/core/lib-esm/transition/transitionHook.js"); +/* harmony import */ var _transitionEventType__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./transitionEventType */ "./node_modules/@uirouter/core/lib-esm/transition/transitionEventType.js"); +/* harmony import */ var _transitionService__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./transitionService */ "./node_modules/@uirouter/core/lib-esm/transition/transitionService.js"); +/** + * # Transition subsystem + * + * This module contains APIs related to a Transition. + * + * See: + * - [[TransitionService]] + * - [[Transition]] + * - [[HookFn]], [[TransitionHookFn]], [[TransitionStateHookFn]], [[HookMatchCriteria]], [[HookResult]] + * + * @packageDocumentation @preferred + */ + + + + + + + + +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/transition/interface.js": +/*!*********************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/transition/interface.js ***! + \*********************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "TransitionHookPhase": () => (/* binding */ TransitionHookPhase), +/* harmony export */ "TransitionHookScope": () => (/* binding */ TransitionHookScope) +/* harmony export */ }); +var TransitionHookPhase; +(function (TransitionHookPhase) { + TransitionHookPhase[TransitionHookPhase["CREATE"] = 0] = "CREATE"; + TransitionHookPhase[TransitionHookPhase["BEFORE"] = 1] = "BEFORE"; + TransitionHookPhase[TransitionHookPhase["RUN"] = 2] = "RUN"; + TransitionHookPhase[TransitionHookPhase["SUCCESS"] = 3] = "SUCCESS"; + TransitionHookPhase[TransitionHookPhase["ERROR"] = 4] = "ERROR"; +})(TransitionHookPhase || (TransitionHookPhase = {})); +var TransitionHookScope; +(function (TransitionHookScope) { + TransitionHookScope[TransitionHookScope["TRANSITION"] = 0] = "TRANSITION"; + TransitionHookScope[TransitionHookScope["STATE"] = 1] = "STATE"; +})(TransitionHookScope || (TransitionHookScope = {})); + +//# sourceMappingURL=interface.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/transition/rejectFactory.js": +/*!*************************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/transition/rejectFactory.js ***! + \*************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "RejectType": () => (/* binding */ RejectType), +/* harmony export */ "Rejection": () => (/* binding */ Rejection) +/* harmony export */ }); +/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/common */ "./node_modules/@uirouter/core/lib-esm/common/common.js"); +/* harmony import */ var _common_strings__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/strings */ "./node_modules/@uirouter/core/lib-esm/common/strings.js"); +/* harmony import */ var _common_hof__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../common/hof */ "./node_modules/@uirouter/core/lib-esm/common/hof.js"); + + + + +/** An enum for Transition Rejection reasons */ +var RejectType; +(function (RejectType) { + /** + * A new transition superseded this one. + * + * While this transition was running, a new transition started. + * This transition is cancelled because it was superseded by new transition. + */ + RejectType[RejectType["SUPERSEDED"] = 2] = "SUPERSEDED"; + /** + * The transition was aborted + * + * The transition was aborted by a hook which returned `false` + */ + RejectType[RejectType["ABORTED"] = 3] = "ABORTED"; + /** + * The transition was invalid + * + * The transition was never started because it was invalid + */ + RejectType[RejectType["INVALID"] = 4] = "INVALID"; + /** + * The transition was ignored + * + * The transition was ignored because it would have no effect. + * + * Either: + * + * - The transition is targeting the current state and parameter values + * - The transition is targeting the same state and parameter values as the currently running transition. + */ + RejectType[RejectType["IGNORED"] = 5] = "IGNORED"; + /** + * The transition errored. + * + * This generally means a hook threw an error or returned a rejected promise + */ + RejectType[RejectType["ERROR"] = 6] = "ERROR"; +})(RejectType || (RejectType = {})); + +/** @internal */ +var id = 0; +var Rejection = /** @class */ (function () { + function Rejection(type, message, detail) { + /** @internal */ + this.$id = id++; + this.type = type; + this.message = message; + this.detail = detail; + } + /** Returns true if the obj is a rejected promise created from the `asPromise` factory */ + Rejection.isRejectionPromise = function (obj) { + return obj && typeof obj.then === 'function' && (0,_common_hof__WEBPACK_IMPORTED_MODULE_2__.is)(Rejection)(obj._transitionRejection); + }; + /** Returns a Rejection due to transition superseded */ + Rejection.superseded = function (detail, options) { + var message = 'The transition has been superseded by a different transition'; + var rejection = new Rejection(RejectType.SUPERSEDED, message, detail); + if (options && options.redirected) { + rejection.redirected = true; + } + return rejection; + }; + /** Returns a Rejection due to redirected transition */ + Rejection.redirected = function (detail) { + return Rejection.superseded(detail, { redirected: true }); + }; + /** Returns a Rejection due to invalid transition */ + Rejection.invalid = function (detail) { + var message = 'This transition is invalid'; + return new Rejection(RejectType.INVALID, message, detail); + }; + /** Returns a Rejection due to ignored transition */ + Rejection.ignored = function (detail) { + var message = 'The transition was ignored'; + return new Rejection(RejectType.IGNORED, message, detail); + }; + /** Returns a Rejection due to aborted transition */ + Rejection.aborted = function (detail) { + var message = 'The transition has been aborted'; + return new Rejection(RejectType.ABORTED, message, detail); + }; + /** Returns a Rejection due to aborted transition */ + Rejection.errored = function (detail) { + var message = 'The transition errored'; + return new Rejection(RejectType.ERROR, message, detail); + }; + /** + * Returns a Rejection + * + * Normalizes a value as a Rejection. + * If the value is already a Rejection, returns it. + * Otherwise, wraps and returns the value as a Rejection (Rejection type: ERROR). + * + * @returns `detail` if it is already a `Rejection`, else returns an ERROR Rejection. + */ + Rejection.normalize = function (detail) { + return (0,_common_hof__WEBPACK_IMPORTED_MODULE_2__.is)(Rejection)(detail) ? detail : Rejection.errored(detail); + }; + Rejection.prototype.toString = function () { + var detailString = function (d) { return (d && d.toString !== Object.prototype.toString ? d.toString() : (0,_common_strings__WEBPACK_IMPORTED_MODULE_1__.stringify)(d)); }; + var detail = detailString(this.detail); + var _a = this, $id = _a.$id, type = _a.type, message = _a.message; + return "Transition Rejection($id: " + $id + " type: " + type + ", message: " + message + ", detail: " + detail + ")"; + }; + Rejection.prototype.toPromise = function () { + return (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.extend)((0,_common_common__WEBPACK_IMPORTED_MODULE_0__.silentRejection)(this), { _transitionRejection: this }); + }; + return Rejection; +}()); + +//# sourceMappingURL=rejectFactory.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/transition/transition.js": +/*!**********************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/transition/transition.js ***! + \**********************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "Transition": () => (/* binding */ Transition) +/* harmony export */ }); +/* harmony import */ var _common_trace__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/trace */ "./node_modules/@uirouter/core/lib-esm/common/trace.js"); +/* harmony import */ var _common_coreservices__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/coreservices */ "./node_modules/@uirouter/core/lib-esm/common/coreservices.js"); +/* harmony import */ var _common_strings__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../common/strings */ "./node_modules/@uirouter/core/lib-esm/common/strings.js"); +/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../common/common */ "./node_modules/@uirouter/core/lib-esm/common/common.js"); +/* harmony import */ var _common_predicates__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../common/predicates */ "./node_modules/@uirouter/core/lib-esm/common/predicates.js"); +/* harmony import */ var _common_hof__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../common/hof */ "./node_modules/@uirouter/core/lib-esm/common/hof.js"); +/* harmony import */ var _interface__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./interface */ "./node_modules/@uirouter/core/lib-esm/transition/interface.js"); +/* harmony import */ var _transitionHook__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./transitionHook */ "./node_modules/@uirouter/core/lib-esm/transition/transitionHook.js"); +/* harmony import */ var _hookRegistry__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./hookRegistry */ "./node_modules/@uirouter/core/lib-esm/transition/hookRegistry.js"); +/* harmony import */ var _hookBuilder__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./hookBuilder */ "./node_modules/@uirouter/core/lib-esm/transition/hookBuilder.js"); +/* harmony import */ var _path_pathUtils__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../path/pathUtils */ "./node_modules/@uirouter/core/lib-esm/path/pathUtils.js"); +/* harmony import */ var _params_param__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../params/param */ "./node_modules/@uirouter/core/lib-esm/params/param.js"); +/* harmony import */ var _resolve_resolvable__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../resolve/resolvable */ "./node_modules/@uirouter/core/lib-esm/resolve/resolvable.js"); +/* harmony import */ var _resolve_resolveContext__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../resolve/resolveContext */ "./node_modules/@uirouter/core/lib-esm/resolve/resolveContext.js"); +/* harmony import */ var _rejectFactory__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./rejectFactory */ "./node_modules/@uirouter/core/lib-esm/transition/rejectFactory.js"); +/* harmony import */ var _common__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ../common */ "./node_modules/@uirouter/core/lib-esm/common/index.js"); + + + + + + + // has or is using + + + + + + + + + +/** @internal */ +var stateSelf = (0,_common_hof__WEBPACK_IMPORTED_MODULE_5__.prop)('self'); +/** + * Represents a transition between two states. + * + * When navigating to a state, we are transitioning **from** the current state **to** the new state. + * + * This object contains all contextual information about the to/from states, parameters, resolves. + * It has information about all states being entered and exited as a result of the transition. + */ +var Transition = /** @class */ (function () { + /** + * Creates a new Transition object. + * + * If the target state is not valid, an error is thrown. + * + * @internal + * + * @param fromPath The path of [[PathNode]]s from which the transition is leaving. The last node in the `fromPath` + * encapsulates the "from state". + * @param targetState The target state and parameters being transitioned to (also, the transition options) + * @param router The [[UIRouter]] instance + * @internal + */ + function Transition(fromPath, targetState, router) { + var _this = this; + /** @internal */ + this._deferred = _common_coreservices__WEBPACK_IMPORTED_MODULE_1__.services.$q.defer(); + /** + * This promise is resolved or rejected based on the outcome of the Transition. + * + * When the transition is successful, the promise is resolved + * When the transition is unsuccessful, the promise is rejected with the [[Rejection]] or javascript error + */ + this.promise = this._deferred.promise; + /** @internal Holds the hook registration functions such as those passed to Transition.onStart() */ + this._registeredHooks = {}; + /** @internal */ + this._hookBuilder = new _hookBuilder__WEBPACK_IMPORTED_MODULE_9__.HookBuilder(this); + /** Checks if this transition is currently active/running. */ + this.isActive = function () { return _this.router.globals.transition === _this; }; + this.router = router; + this._targetState = targetState; + if (!targetState.valid()) { + throw new Error(targetState.error()); + } + // current() is assumed to come from targetState.options, but provide a naive implementation otherwise. + this._options = (0,_common_common__WEBPACK_IMPORTED_MODULE_3__.extend)({ current: (0,_common_hof__WEBPACK_IMPORTED_MODULE_5__.val)(this) }, targetState.options()); + this.$id = router.transitionService._transitionCount++; + var toPath = _path_pathUtils__WEBPACK_IMPORTED_MODULE_10__.PathUtils.buildToPath(fromPath, targetState); + this._treeChanges = _path_pathUtils__WEBPACK_IMPORTED_MODULE_10__.PathUtils.treeChanges(fromPath, toPath, this._options.reloadState); + this.createTransitionHookRegFns(); + var onCreateHooks = this._hookBuilder.buildHooksForPhase(_interface__WEBPACK_IMPORTED_MODULE_6__.TransitionHookPhase.CREATE); + _transitionHook__WEBPACK_IMPORTED_MODULE_7__.TransitionHook.invokeHooks(onCreateHooks, function () { return null; }); + this.applyViewConfigs(router); + } + /** @internal */ + Transition.prototype.onBefore = function (criteria, callback, options) { + return; + }; + /** @inheritdoc */ + Transition.prototype.onStart = function (criteria, callback, options) { + return; + }; + /** @inheritdoc */ + Transition.prototype.onExit = function (criteria, callback, options) { + return; + }; + /** @inheritdoc */ + Transition.prototype.onRetain = function (criteria, callback, options) { + return; + }; + /** @inheritdoc */ + Transition.prototype.onEnter = function (criteria, callback, options) { + return; + }; + /** @inheritdoc */ + Transition.prototype.onFinish = function (criteria, callback, options) { + return; + }; + /** @inheritdoc */ + Transition.prototype.onSuccess = function (criteria, callback, options) { + return; + }; + /** @inheritdoc */ + Transition.prototype.onError = function (criteria, callback, options) { + return; + }; + /** @internal + * Creates the transition-level hook registration functions + * (which can then be used to register hooks) + */ + Transition.prototype.createTransitionHookRegFns = function () { + var _this = this; + this.router.transitionService._pluginapi + ._getEvents() + .filter(function (type) { return type.hookPhase !== _interface__WEBPACK_IMPORTED_MODULE_6__.TransitionHookPhase.CREATE; }) + .forEach(function (type) { return (0,_hookRegistry__WEBPACK_IMPORTED_MODULE_8__.makeEvent)(_this, _this.router.transitionService, type); }); + }; + /** @internal */ + Transition.prototype.getHooks = function (hookName) { + return this._registeredHooks[hookName]; + }; + Transition.prototype.applyViewConfigs = function (router) { + var enteringStates = this._treeChanges.entering.map(function (node) { return node.state; }); + _path_pathUtils__WEBPACK_IMPORTED_MODULE_10__.PathUtils.applyViewConfigs(router.transitionService.$view, this._treeChanges.to, enteringStates); + }; + /** + * @internal + * @returns the internal from [State] object + */ + Transition.prototype.$from = function () { + return (0,_common_common__WEBPACK_IMPORTED_MODULE_3__.tail)(this._treeChanges.from).state; + }; + /** + * @internal + * @returns the internal to [State] object + */ + Transition.prototype.$to = function () { + return (0,_common_common__WEBPACK_IMPORTED_MODULE_3__.tail)(this._treeChanges.to).state; + }; + /** + * Returns the "from state" + * + * Returns the state that the transition is coming *from*. + * + * @returns The state declaration object for the Transition's ("from state"). + */ + Transition.prototype.from = function () { + return this.$from().self; + }; + /** + * Returns the "to state" + * + * Returns the state that the transition is going *to*. + * + * @returns The state declaration object for the Transition's target state ("to state"). + */ + Transition.prototype.to = function () { + return this.$to().self; + }; + /** + * Gets the Target State + * + * A transition's [[TargetState]] encapsulates the [[to]] state, the [[params]], and the [[options]] as a single object. + * + * @returns the [[TargetState]] of this Transition + */ + Transition.prototype.targetState = function () { + return this._targetState; + }; + /** + * Determines whether two transitions are equivalent. + * @deprecated + */ + Transition.prototype.is = function (compare) { + if (compare instanceof Transition) { + // TODO: Also compare parameters + return this.is({ to: compare.$to().name, from: compare.$from().name }); + } + return !((compare.to && !(0,_hookRegistry__WEBPACK_IMPORTED_MODULE_8__.matchState)(this.$to(), compare.to, this)) || + (compare.from && !(0,_hookRegistry__WEBPACK_IMPORTED_MODULE_8__.matchState)(this.$from(), compare.from, this))); + }; + Transition.prototype.params = function (pathname) { + if (pathname === void 0) { pathname = 'to'; } + return Object.freeze(this._treeChanges[pathname].map((0,_common_hof__WEBPACK_IMPORTED_MODULE_5__.prop)('paramValues')).reduce(_common_common__WEBPACK_IMPORTED_MODULE_3__.mergeR, {})); + }; + Transition.prototype.paramsChanged = function () { + var fromParams = this.params('from'); + var toParams = this.params('to'); + // All the parameters declared on both the "to" and "from" paths + var allParamDescriptors = [] + .concat(this._treeChanges.to) + .concat(this._treeChanges.from) + .map(function (pathNode) { return pathNode.paramSchema; }) + .reduce(_common__WEBPACK_IMPORTED_MODULE_15__.flattenR, []) + .reduce(_common__WEBPACK_IMPORTED_MODULE_15__.uniqR, []); + var changedParamDescriptors = _params_param__WEBPACK_IMPORTED_MODULE_11__.Param.changed(allParamDescriptors, fromParams, toParams); + return changedParamDescriptors.reduce(function (changedValues, descriptor) { + changedValues[descriptor.id] = toParams[descriptor.id]; + return changedValues; + }, {}); + }; + /** + * Creates a [[UIInjector]] Dependency Injector + * + * Returns a Dependency Injector for the Transition's target state (to state). + * The injector provides resolve values which the target state has access to. + * + * The `UIInjector` can also provide values from the native root/global injector (ng1/ng2). + * + * #### Example: + * ```js + * .onEnter({ entering: 'myState' }, trans => { + * var myResolveValue = trans.injector().get('myResolve'); + * // Inject a global service from the global/native injector (if it exists) + * var MyService = trans.injector().get('MyService'); + * }) + * ``` + * + * In some cases (such as `onBefore`), you may need access to some resolve data but it has not yet been fetched. + * You can use [[UIInjector.getAsync]] to get a promise for the data. + * #### Example: + * ```js + * .onBefore({}, trans => { + * return trans.injector().getAsync('myResolve').then(myResolveValue => + * return myResolveValue !== 'ABORT'; + * }); + * }); + * ``` + * + * If a `state` is provided, the injector that is returned will be limited to resolve values that the provided state has access to. + * This can be useful if both a parent state `foo` and a child state `foo.bar` have both defined a resolve such as `data`. + * #### Example: + * ```js + * .onEnter({ to: 'foo.bar' }, trans => { + * // returns result of `foo` state's `myResolve` resolve + * // even though `foo.bar` also has a `myResolve` resolve + * var fooData = trans.injector('foo').get('myResolve'); + * }); + * ``` + * + * If you need resolve data from the exiting states, pass `'from'` as `pathName`. + * The resolve data from the `from` path will be returned. + * #### Example: + * ```js + * .onExit({ exiting: 'foo.bar' }, trans => { + * // Gets the resolve value of `myResolve` from the state being exited + * var fooData = trans.injector(null, 'from').get('myResolve'); + * }); + * ``` + * + * + * @param state Limits the resolves provided to only the resolves the provided state has access to. + * @param pathName Default: `'to'`: Chooses the path for which to create the injector. Use this to access resolves for `exiting` states. + * + * @returns a [[UIInjector]] + */ + Transition.prototype.injector = function (state, pathName) { + if (pathName === void 0) { pathName = 'to'; } + var path = this._treeChanges[pathName]; + if (state) + path = _path_pathUtils__WEBPACK_IMPORTED_MODULE_10__.PathUtils.subPath(path, function (node) { return node.state === state || node.state.name === state; }); + return new _resolve_resolveContext__WEBPACK_IMPORTED_MODULE_13__.ResolveContext(path).injector(); + }; + /** + * Gets all available resolve tokens (keys) + * + * This method can be used in conjunction with [[injector]] to inspect the resolve values + * available to the Transition. + * + * This returns all the tokens defined on [[StateDeclaration.resolve]] blocks, for the states + * in the Transition's [[TreeChanges.to]] path. + * + * #### Example: + * This example logs all resolve values + * ```js + * let tokens = trans.getResolveTokens(); + * tokens.forEach(token => console.log(token + " = " + trans.injector().get(token))); + * ``` + * + * #### Example: + * This example creates promises for each resolve value. + * This triggers fetches of resolves (if any have not yet been fetched). + * When all promises have all settled, it logs the resolve values. + * ```js + * let tokens = trans.getResolveTokens(); + * let promise = tokens.map(token => trans.injector().getAsync(token)); + * Promise.all(promises).then(values => console.log("Resolved values: " + values)); + * ``` + * + * Note: Angular 1 users whould use `$q.all()` + * + * @param pathname resolve context's path name (e.g., `to` or `from`) + * + * @returns an array of resolve tokens (keys) + */ + Transition.prototype.getResolveTokens = function (pathname) { + if (pathname === void 0) { pathname = 'to'; } + return new _resolve_resolveContext__WEBPACK_IMPORTED_MODULE_13__.ResolveContext(this._treeChanges[pathname]).getTokens(); + }; + /** + * Dynamically adds a new [[Resolvable]] (i.e., [[StateDeclaration.resolve]]) to this transition. + * + * Allows a transition hook to dynamically add a Resolvable to this Transition. + * + * Use the [[Transition.injector]] to retrieve the resolved data in subsequent hooks ([[UIInjector.get]]). + * + * If a `state` argument is provided, the Resolvable is processed when that state is being entered. + * If no `state` is provided then the root state is used. + * If the given `state` has already been entered, the Resolvable is processed when any child state is entered. + * If no child states will be entered, the Resolvable is processed during the `onFinish` phase of the Transition. + * + * The `state` argument also scopes the resolved data. + * The resolved data is available from the injector for that `state` and any children states. + * + * #### Example: + * ```js + * transitionService.onBefore({}, transition => { + * transition.addResolvable({ + * token: 'myResolve', + * deps: ['MyService'], + * resolveFn: myService => myService.getData() + * }); + * }); + * ``` + * + * @param resolvable a [[ResolvableLiteral]] object (or a [[Resolvable]]) + * @param state the state in the "to path" which should receive the new resolve (otherwise, the root state) + */ + Transition.prototype.addResolvable = function (resolvable, state) { + if (state === void 0) { state = ''; } + resolvable = (0,_common_hof__WEBPACK_IMPORTED_MODULE_5__.is)(_resolve_resolvable__WEBPACK_IMPORTED_MODULE_12__.Resolvable)(resolvable) ? resolvable : new _resolve_resolvable__WEBPACK_IMPORTED_MODULE_12__.Resolvable(resolvable); + var stateName = typeof state === 'string' ? state : state.name; + var topath = this._treeChanges.to; + var targetNode = (0,_common_common__WEBPACK_IMPORTED_MODULE_3__.find)(topath, function (node) { return node.state.name === stateName; }); + var resolveContext = new _resolve_resolveContext__WEBPACK_IMPORTED_MODULE_13__.ResolveContext(topath); + resolveContext.addResolvables([resolvable], targetNode.state); + }; + /** + * Gets the transition from which this transition was redirected. + * + * If the current transition is a redirect, this method returns the transition that was redirected. + * + * #### Example: + * ```js + * let transitionA = $state.go('A').transition + * transitionA.onStart({}, () => $state.target('B')); + * $transitions.onSuccess({ to: 'B' }, (trans) => { + * trans.to().name === 'B'; // true + * trans.redirectedFrom() === transitionA; // true + * }); + * ``` + * + * @returns The previous Transition, or null if this Transition is not the result of a redirection + */ + Transition.prototype.redirectedFrom = function () { + return this._options.redirectedFrom || null; + }; + /** + * Gets the original transition in a redirect chain + * + * A transition might belong to a long chain of multiple redirects. + * This method walks the [[redirectedFrom]] chain back to the original (first) transition in the chain. + * + * #### Example: + * ```js + * // states + * registry.register({ name: 'A', redirectTo: 'B' }); + * registry.register({ name: 'B', redirectTo: 'C' }); + * registry.register({ name: 'C', redirectTo: 'D' }); + * registry.register({ name: 'D' }); + * + * let transitionA = $state.go('A').transition + * + * $transitions.onSuccess({ to: 'D' }, (trans) => { + * trans.to().name === 'D'; // true + * trans.redirectedFrom().to().name === 'C'; // true + * trans.originalTransition() === transitionA; // true + * trans.originalTransition().to().name === 'A'; // true + * }); + * ``` + * + * @returns The original Transition that started a redirect chain + */ + Transition.prototype.originalTransition = function () { + var rf = this.redirectedFrom(); + return (rf && rf.originalTransition()) || this; + }; + /** + * Get the transition options + * + * @returns the options for this Transition. + */ + Transition.prototype.options = function () { + return this._options; + }; + /** + * Gets the states being entered. + * + * @returns an array of states that will be entered during this transition. + */ + Transition.prototype.entering = function () { + return (0,_common_common__WEBPACK_IMPORTED_MODULE_3__.map)(this._treeChanges.entering, (0,_common_hof__WEBPACK_IMPORTED_MODULE_5__.prop)('state')).map(stateSelf); + }; + /** + * Gets the states being exited. + * + * @returns an array of states that will be exited during this transition. + */ + Transition.prototype.exiting = function () { + return (0,_common_common__WEBPACK_IMPORTED_MODULE_3__.map)(this._treeChanges.exiting, (0,_common_hof__WEBPACK_IMPORTED_MODULE_5__.prop)('state')).map(stateSelf).reverse(); + }; + /** + * Gets the states being retained. + * + * @returns an array of states that are already entered from a previous Transition, that will not be + * exited during this Transition + */ + Transition.prototype.retained = function () { + return (0,_common_common__WEBPACK_IMPORTED_MODULE_3__.map)(this._treeChanges.retained, (0,_common_hof__WEBPACK_IMPORTED_MODULE_5__.prop)('state')).map(stateSelf); + }; + /** + * Get the [[ViewConfig]]s associated with this Transition + * + * Each state can define one or more views (template/controller), which are encapsulated as `ViewConfig` objects. + * This method fetches the `ViewConfigs` for a given path in the Transition (e.g., "to" or "entering"). + * + * @param pathname the name of the path to fetch views for: + * (`'to'`, `'from'`, `'entering'`, `'exiting'`, `'retained'`) + * @param state If provided, only returns the `ViewConfig`s for a single state in the path + * + * @returns a list of ViewConfig objects for the given path. + */ + Transition.prototype.views = function (pathname, state) { + if (pathname === void 0) { pathname = 'entering'; } + var path = this._treeChanges[pathname]; + path = !state ? path : path.filter((0,_common_hof__WEBPACK_IMPORTED_MODULE_5__.propEq)('state', state)); + return path.map((0,_common_hof__WEBPACK_IMPORTED_MODULE_5__.prop)('views')).filter(_common_common__WEBPACK_IMPORTED_MODULE_3__.identity).reduce(_common_common__WEBPACK_IMPORTED_MODULE_3__.unnestR, []); + }; + Transition.prototype.treeChanges = function (pathname) { + return pathname ? this._treeChanges[pathname] : this._treeChanges; + }; + /** + * Creates a new transition that is a redirection of the current one. + * + * This transition can be returned from a [[TransitionService]] hook to + * redirect a transition to a new state and/or set of parameters. + * + * @internal + * + * @returns Returns a new [[Transition]] instance. + */ + Transition.prototype.redirect = function (targetState) { + var redirects = 1, trans = this; + // tslint:disable-next-line:no-conditional-assignment + while ((trans = trans.redirectedFrom()) != null) { + if (++redirects > 20) + throw new Error("Too many consecutive Transition redirects (20+)"); + } + var redirectOpts = { redirectedFrom: this, source: 'redirect' }; + // If the original transition was caused by URL sync, then use { location: 'replace' } + // on the new transition (unless the target state explicitly specifies location: false). + // This causes the original url to be replaced with the url for the redirect target + // so the original url disappears from the browser history. + if (this.options().source === 'url' && targetState.options().location !== false) { + redirectOpts.location = 'replace'; + } + var newOptions = (0,_common_common__WEBPACK_IMPORTED_MODULE_3__.extend)({}, this.options(), targetState.options(), redirectOpts); + targetState = targetState.withOptions(newOptions, true); + var newTransition = this.router.transitionService.create(this._treeChanges.from, targetState); + var originalEnteringNodes = this._treeChanges.entering; + var redirectEnteringNodes = newTransition._treeChanges.entering; + // --- Re-use resolve data from original transition --- + // When redirecting from a parent state to a child state where the parent parameter values haven't changed + // (because of the redirect), the resolves fetched by the original transition are still valid in the + // redirected transition. + // + // This allows you to define a redirect on a parent state which depends on an async resolve value. + // You can wait for the resolve, then redirect to a child state based on the result. + // The redirected transition does not have to re-fetch the resolve. + // --------------------------------------------------------- + var nodeIsReloading = function (reloadState) { return function (node) { + return reloadState && node.state.includes[reloadState.name]; + }; }; + // Find any "entering" nodes in the redirect path that match the original path and aren't being reloaded + var matchingEnteringNodes = _path_pathUtils__WEBPACK_IMPORTED_MODULE_10__.PathUtils.matching(redirectEnteringNodes, originalEnteringNodes, _path_pathUtils__WEBPACK_IMPORTED_MODULE_10__.PathUtils.nonDynamicParams).filter((0,_common_hof__WEBPACK_IMPORTED_MODULE_5__.not)(nodeIsReloading(targetState.options().reloadState))); + // Use the existing (possibly pre-resolved) resolvables for the matching entering nodes. + matchingEnteringNodes.forEach(function (node, idx) { + node.resolvables = originalEnteringNodes[idx].resolvables; + }); + return newTransition; + }; + /** @internal If a transition doesn't exit/enter any states, returns any [[Param]] whose value changed */ + Transition.prototype._changedParams = function () { + var tc = this._treeChanges; + /** Return undefined if it's not a "dynamic" transition, for the following reasons */ + // If user explicitly wants a reload + if (this._options.reload) + return undefined; + // If any states are exiting or entering + if (tc.exiting.length || tc.entering.length) + return undefined; + // If to/from path lengths differ + if (tc.to.length !== tc.from.length) + return undefined; + // If the to/from paths are different + var pathsDiffer = (0,_common_common__WEBPACK_IMPORTED_MODULE_3__.arrayTuples)(tc.to, tc.from) + .map(function (tuple) { return tuple[0].state !== tuple[1].state; }) + .reduce(_common_common__WEBPACK_IMPORTED_MODULE_3__.anyTrueR, false); + if (pathsDiffer) + return undefined; + // Find any parameter values that differ + var nodeSchemas = tc.to.map(function (node) { return node.paramSchema; }); + var _a = [tc.to, tc.from].map(function (path) { return path.map(function (x) { return x.paramValues; }); }), toValues = _a[0], fromValues = _a[1]; + var tuples = (0,_common_common__WEBPACK_IMPORTED_MODULE_3__.arrayTuples)(nodeSchemas, toValues, fromValues); + return tuples.map(function (_a) { + var schema = _a[0], toVals = _a[1], fromVals = _a[2]; + return _params_param__WEBPACK_IMPORTED_MODULE_11__.Param.changed(schema, toVals, fromVals); + }).reduce(_common_common__WEBPACK_IMPORTED_MODULE_3__.unnestR, []); + }; + /** + * Returns true if the transition is dynamic. + * + * A transition is dynamic if no states are entered nor exited, but at least one dynamic parameter has changed. + * + * @returns true if the Transition is dynamic + */ + Transition.prototype.dynamic = function () { + var changes = this._changedParams(); + return !changes ? false : changes.map(function (x) { return x.dynamic; }).reduce(_common_common__WEBPACK_IMPORTED_MODULE_3__.anyTrueR, false); + }; + /** + * Returns true if the transition is ignored. + * + * A transition is ignored if no states are entered nor exited, and no parameter values have changed. + * + * @returns true if the Transition is ignored. + */ + Transition.prototype.ignored = function () { + return !!this._ignoredReason(); + }; + /** @internal */ + Transition.prototype._ignoredReason = function () { + var pending = this.router.globals.transition; + var reloadState = this._options.reloadState; + var same = function (pathA, pathB) { + if (pathA.length !== pathB.length) + return false; + var matching = _path_pathUtils__WEBPACK_IMPORTED_MODULE_10__.PathUtils.matching(pathA, pathB); + return pathA.length === matching.filter(function (node) { return !reloadState || !node.state.includes[reloadState.name]; }).length; + }; + var newTC = this.treeChanges(); + var pendTC = pending && pending.treeChanges(); + if (pendTC && same(pendTC.to, newTC.to) && same(pendTC.exiting, newTC.exiting)) + return 'SameAsPending'; + if (newTC.exiting.length === 0 && newTC.entering.length === 0 && same(newTC.from, newTC.to)) + return 'SameAsCurrent'; + }; + /** + * Runs the transition + * + * This method is generally called from the [[StateService.transitionTo]] + * + * @internal + * + * @returns a promise for a successful transition. + */ + Transition.prototype.run = function () { + var _this = this; + var runAllHooks = _transitionHook__WEBPACK_IMPORTED_MODULE_7__.TransitionHook.runAllHooks; + // Gets transition hooks array for the given phase + var getHooksFor = function (phase) { return _this._hookBuilder.buildHooksForPhase(phase); }; + // When the chain is complete, then resolve or reject the deferred + var transitionSuccess = function () { + _common_trace__WEBPACK_IMPORTED_MODULE_0__.trace.traceSuccess(_this.$to(), _this); + _this.success = true; + _this._deferred.resolve(_this.to()); + runAllHooks(getHooksFor(_interface__WEBPACK_IMPORTED_MODULE_6__.TransitionHookPhase.SUCCESS)); + }; + var transitionError = function (reason) { + _common_trace__WEBPACK_IMPORTED_MODULE_0__.trace.traceError(reason, _this); + _this.success = false; + _this._deferred.reject(reason); + _this._error = reason; + runAllHooks(getHooksFor(_interface__WEBPACK_IMPORTED_MODULE_6__.TransitionHookPhase.ERROR)); + }; + var runTransition = function () { + // Wait to build the RUN hook chain until the BEFORE hooks are done + // This allows a BEFORE hook to dynamically add additional RUN hooks via the Transition object. + var allRunHooks = getHooksFor(_interface__WEBPACK_IMPORTED_MODULE_6__.TransitionHookPhase.RUN); + var done = function () { return _common_coreservices__WEBPACK_IMPORTED_MODULE_1__.services.$q.when(undefined); }; + return _transitionHook__WEBPACK_IMPORTED_MODULE_7__.TransitionHook.invokeHooks(allRunHooks, done); + }; + var startTransition = function () { + var globals = _this.router.globals; + globals.lastStartedTransitionId = _this.$id; + globals.transition = _this; + globals.transitionHistory.enqueue(_this); + _common_trace__WEBPACK_IMPORTED_MODULE_0__.trace.traceTransitionStart(_this); + return _common_coreservices__WEBPACK_IMPORTED_MODULE_1__.services.$q.when(undefined); + }; + var allBeforeHooks = getHooksFor(_interface__WEBPACK_IMPORTED_MODULE_6__.TransitionHookPhase.BEFORE); + _transitionHook__WEBPACK_IMPORTED_MODULE_7__.TransitionHook.invokeHooks(allBeforeHooks, startTransition) + .then(runTransition) + .then(transitionSuccess, transitionError); + return this.promise; + }; + /** + * Checks if the Transition is valid + * + * @returns true if the Transition is valid + */ + Transition.prototype.valid = function () { + return !this.error() || this.success !== undefined; + }; + /** + * Aborts this transition + * + * Imperative API to abort a Transition. + * This only applies to Transitions that are not yet complete. + */ + Transition.prototype.abort = function () { + // Do not set flag if the transition is already complete + if ((0,_common_predicates__WEBPACK_IMPORTED_MODULE_4__.isUndefined)(this.success)) { + this._aborted = true; + } + }; + /** + * The Transition error reason. + * + * If the transition is invalid (and could not be run), returns the reason the transition is invalid. + * If the transition was valid and ran, but was not successful, returns the reason the transition failed. + * + * @returns a transition rejection explaining why the transition is invalid, or the reason the transition failed. + */ + Transition.prototype.error = function () { + var state = this.$to(); + if (state.self.abstract) { + return _rejectFactory__WEBPACK_IMPORTED_MODULE_14__.Rejection.invalid("Cannot transition to abstract state '" + state.name + "'"); + } + var paramDefs = state.parameters(); + var values = this.params(); + var invalidParams = paramDefs.filter(function (param) { return !param.validates(values[param.id]); }); + if (invalidParams.length) { + var invalidValues = invalidParams.map(function (param) { return "[" + param.id + ":" + (0,_common_strings__WEBPACK_IMPORTED_MODULE_2__.stringify)(values[param.id]) + "]"; }).join(', '); + var detail = "The following parameter values are not valid for state '" + state.name + "': " + invalidValues; + return _rejectFactory__WEBPACK_IMPORTED_MODULE_14__.Rejection.invalid(detail); + } + if (this.success === false) + return this._error; + }; + /** + * A string representation of the Transition + * + * @returns A string representation of the Transition + */ + Transition.prototype.toString = function () { + var fromStateOrName = this.from(); + var toStateOrName = this.to(); + var avoidEmptyHash = function (params) { + return params['#'] !== null && params['#'] !== undefined ? params : (0,_common_common__WEBPACK_IMPORTED_MODULE_3__.omit)(params, ['#']); + }; + // (X) means the to state is invalid. + var id = this.$id, from = (0,_common_predicates__WEBPACK_IMPORTED_MODULE_4__.isObject)(fromStateOrName) ? fromStateOrName.name : fromStateOrName, fromParams = (0,_common_strings__WEBPACK_IMPORTED_MODULE_2__.stringify)(avoidEmptyHash(this._treeChanges.from.map((0,_common_hof__WEBPACK_IMPORTED_MODULE_5__.prop)('paramValues')).reduce(_common_common__WEBPACK_IMPORTED_MODULE_3__.mergeR, {}))), toValid = this.valid() ? '' : '(X) ', to = (0,_common_predicates__WEBPACK_IMPORTED_MODULE_4__.isObject)(toStateOrName) ? toStateOrName.name : toStateOrName, toParams = (0,_common_strings__WEBPACK_IMPORTED_MODULE_2__.stringify)(avoidEmptyHash(this.params())); + return "Transition#" + id + "( '" + from + "'" + fromParams + " -> " + toValid + "'" + to + "'" + toParams + " )"; + }; + /** @internal */ + Transition.diToken = Transition; + return Transition; +}()); + +//# sourceMappingURL=transition.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/transition/transitionEventType.js": +/*!*******************************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/transition/transitionEventType.js ***! + \*******************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "TransitionEventType": () => (/* binding */ TransitionEventType) +/* harmony export */ }); +/* harmony import */ var _transitionHook__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./transitionHook */ "./node_modules/@uirouter/core/lib-esm/transition/transitionHook.js"); + +/** + * This class defines a type of hook, such as `onBefore` or `onEnter`. + * Plugins can define custom hook types, such as sticky states does for `onInactive`. + */ +var TransitionEventType = /** @class */ (function () { + /* tslint:disable:no-inferrable-types */ + function TransitionEventType(name, hookPhase, hookOrder, criteriaMatchPath, reverseSort, getResultHandler, getErrorHandler, synchronous) { + if (reverseSort === void 0) { reverseSort = false; } + if (getResultHandler === void 0) { getResultHandler = _transitionHook__WEBPACK_IMPORTED_MODULE_0__.TransitionHook.HANDLE_RESULT; } + if (getErrorHandler === void 0) { getErrorHandler = _transitionHook__WEBPACK_IMPORTED_MODULE_0__.TransitionHook.REJECT_ERROR; } + if (synchronous === void 0) { synchronous = false; } + this.name = name; + this.hookPhase = hookPhase; + this.hookOrder = hookOrder; + this.criteriaMatchPath = criteriaMatchPath; + this.reverseSort = reverseSort; + this.getResultHandler = getResultHandler; + this.getErrorHandler = getErrorHandler; + this.synchronous = synchronous; + } + return TransitionEventType; +}()); + +//# sourceMappingURL=transitionEventType.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/transition/transitionHook.js": +/*!**************************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/transition/transitionHook.js ***! + \**************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "TransitionHook": () => (/* binding */ TransitionHook) +/* harmony export */ }); +/* harmony import */ var _interface__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./interface */ "./node_modules/@uirouter/core/lib-esm/transition/interface.js"); +/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/common */ "./node_modules/@uirouter/core/lib-esm/common/common.js"); +/* harmony import */ var _common_strings__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../common/strings */ "./node_modules/@uirouter/core/lib-esm/common/strings.js"); +/* harmony import */ var _common_predicates__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../common/predicates */ "./node_modules/@uirouter/core/lib-esm/common/predicates.js"); +/* harmony import */ var _common_hof__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../common/hof */ "./node_modules/@uirouter/core/lib-esm/common/hof.js"); +/* harmony import */ var _common_trace__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../common/trace */ "./node_modules/@uirouter/core/lib-esm/common/trace.js"); +/* harmony import */ var _common_coreservices__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../common/coreservices */ "./node_modules/@uirouter/core/lib-esm/common/coreservices.js"); +/* harmony import */ var _rejectFactory__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./rejectFactory */ "./node_modules/@uirouter/core/lib-esm/transition/rejectFactory.js"); +/* harmony import */ var _state_targetState__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../state/targetState */ "./node_modules/@uirouter/core/lib-esm/state/targetState.js"); + + + + + + + + + +var defaultOptions = { + current: _common_common__WEBPACK_IMPORTED_MODULE_1__.noop, + transition: null, + traceData: {}, + bind: null, +}; +var TransitionHook = /** @class */ (function () { + function TransitionHook(transition, stateContext, registeredHook, options) { + var _this = this; + this.transition = transition; + this.stateContext = stateContext; + this.registeredHook = registeredHook; + this.options = options; + this.isSuperseded = function () { return _this.type.hookPhase === _interface__WEBPACK_IMPORTED_MODULE_0__.TransitionHookPhase.RUN && !_this.options.transition.isActive(); }; + this.options = (0,_common_common__WEBPACK_IMPORTED_MODULE_1__.defaults)(options, defaultOptions); + this.type = registeredHook.eventType; + } + /** + * Chains together an array of TransitionHooks. + * + * Given a list of [[TransitionHook]] objects, chains them together. + * Each hook is invoked after the previous one completes. + * + * #### Example: + * ```js + * var hooks: TransitionHook[] = getHooks(); + * let promise: Promise = TransitionHook.chain(hooks); + * + * promise.then(handleSuccess, handleError); + * ``` + * + * @param hooks the list of hooks to chain together + * @param waitFor if provided, the chain is `.then()`'ed off this promise + * @returns a `Promise` for sequentially invoking the hooks (in order) + */ + TransitionHook.chain = function (hooks, waitFor) { + // Chain the next hook off the previous + var createHookChainR = function (prev, nextHook) { return prev.then(function () { return nextHook.invokeHook(); }); }; + return hooks.reduce(createHookChainR, waitFor || _common_coreservices__WEBPACK_IMPORTED_MODULE_6__.services.$q.when()); + }; + /** + * Invokes all the provided TransitionHooks, in order. + * Each hook's return value is checked. + * If any hook returns a promise, then the rest of the hooks are chained off that promise, and the promise is returned. + * If no hook returns a promise, then all hooks are processed synchronously. + * + * @param hooks the list of TransitionHooks to invoke + * @param doneCallback a callback that is invoked after all the hooks have successfully completed + * + * @returns a promise for the async result, or the result of the callback + */ + TransitionHook.invokeHooks = function (hooks, doneCallback) { + for (var idx = 0; idx < hooks.length; idx++) { + var hookResult = hooks[idx].invokeHook(); + if ((0,_common_predicates__WEBPACK_IMPORTED_MODULE_3__.isPromise)(hookResult)) { + var remainingHooks = hooks.slice(idx + 1); + return TransitionHook.chain(remainingHooks, hookResult).then(doneCallback); + } + } + return doneCallback(); + }; + /** + * Run all TransitionHooks, ignoring their return value. + */ + TransitionHook.runAllHooks = function (hooks) { + hooks.forEach(function (hook) { return hook.invokeHook(); }); + }; + TransitionHook.prototype.logError = function (err) { + this.transition.router.stateService.defaultErrorHandler()(err); + }; + TransitionHook.prototype.invokeHook = function () { + var _this = this; + var hook = this.registeredHook; + if (hook._deregistered) + return; + var notCurrent = this.getNotCurrentRejection(); + if (notCurrent) + return notCurrent; + var options = this.options; + _common_trace__WEBPACK_IMPORTED_MODULE_5__.trace.traceHookInvocation(this, this.transition, options); + var invokeCallback = function () { return hook.callback.call(options.bind, _this.transition, _this.stateContext); }; + var normalizeErr = function (err) { return _rejectFactory__WEBPACK_IMPORTED_MODULE_7__.Rejection.normalize(err).toPromise(); }; + var handleError = function (err) { return hook.eventType.getErrorHandler(_this)(err); }; + var handleResult = function (result) { return hook.eventType.getResultHandler(_this)(result); }; + try { + var result = invokeCallback(); + if (!this.type.synchronous && (0,_common_predicates__WEBPACK_IMPORTED_MODULE_3__.isPromise)(result)) { + return result.catch(normalizeErr).then(handleResult, handleError); + } + else { + return handleResult(result); + } + } + catch (err) { + // If callback throws (synchronously) + return handleError(_rejectFactory__WEBPACK_IMPORTED_MODULE_7__.Rejection.normalize(err)); + } + finally { + if (hook.invokeLimit && ++hook.invokeCount >= hook.invokeLimit) { + hook.deregister(); + } + } + }; + /** + * This method handles the return value of a Transition Hook. + * + * A hook can return false (cancel), a TargetState (redirect), + * or a promise (which may later resolve to false or a redirect) + * + * This also handles "transition superseded" -- when a new transition + * was started while the hook was still running + */ + TransitionHook.prototype.handleHookResult = function (result) { + var _this = this; + var notCurrent = this.getNotCurrentRejection(); + if (notCurrent) + return notCurrent; + // Hook returned a promise + if ((0,_common_predicates__WEBPACK_IMPORTED_MODULE_3__.isPromise)(result)) { + // Wait for the promise, then reprocess with the resulting value + return result.then(function (val) { return _this.handleHookResult(val); }); + } + _common_trace__WEBPACK_IMPORTED_MODULE_5__.trace.traceHookResult(result, this.transition, this.options); + // Hook returned false + if (result === false) { + // Abort this Transition + return _rejectFactory__WEBPACK_IMPORTED_MODULE_7__.Rejection.aborted('Hook aborted transition').toPromise(); + } + var isTargetState = (0,_common_hof__WEBPACK_IMPORTED_MODULE_4__.is)(_state_targetState__WEBPACK_IMPORTED_MODULE_8__.TargetState); + // hook returned a TargetState + if (isTargetState(result)) { + // Halt the current Transition and redirect (a new Transition) to the TargetState. + return _rejectFactory__WEBPACK_IMPORTED_MODULE_7__.Rejection.redirected(result).toPromise(); + } + }; + /** + * Return a Rejection promise if the transition is no longer current due + * to a stopped router (disposed), or a new transition has started and superseded this one. + */ + TransitionHook.prototype.getNotCurrentRejection = function () { + var router = this.transition.router; + // The router is stopped + if (router._disposed) { + return _rejectFactory__WEBPACK_IMPORTED_MODULE_7__.Rejection.aborted("UIRouter instance #" + router.$id + " has been stopped (disposed)").toPromise(); + } + if (this.transition._aborted) { + return _rejectFactory__WEBPACK_IMPORTED_MODULE_7__.Rejection.aborted().toPromise(); + } + // This transition is no longer current. + // Another transition started while this hook was still running. + if (this.isSuperseded()) { + // Abort this transition + return _rejectFactory__WEBPACK_IMPORTED_MODULE_7__.Rejection.superseded(this.options.current()).toPromise(); + } + }; + TransitionHook.prototype.toString = function () { + var _a = this, options = _a.options, registeredHook = _a.registeredHook; + var event = (0,_common_hof__WEBPACK_IMPORTED_MODULE_4__.parse)('traceData.hookType')(options) || 'internal', context = (0,_common_hof__WEBPACK_IMPORTED_MODULE_4__.parse)('traceData.context.state.name')(options) || (0,_common_hof__WEBPACK_IMPORTED_MODULE_4__.parse)('traceData.context')(options) || 'unknown', name = (0,_common_strings__WEBPACK_IMPORTED_MODULE_2__.fnToString)(registeredHook.callback); + return event + " context: " + context + ", " + (0,_common_strings__WEBPACK_IMPORTED_MODULE_2__.maxLength)(200, name); + }; + /** + * These GetResultHandler(s) are used by [[invokeHook]] below + * Each HookType chooses a GetResultHandler (See: [[TransitionService._defineCoreEvents]]) + */ + TransitionHook.HANDLE_RESULT = function (hook) { return function (result) { + return hook.handleHookResult(result); + }; }; + /** + * If the result is a promise rejection, log it. + * Otherwise, ignore the result. + */ + TransitionHook.LOG_REJECTED_RESULT = function (hook) { return function (result) { + (0,_common_predicates__WEBPACK_IMPORTED_MODULE_3__.isPromise)(result) && result.catch(function (err) { return hook.logError(_rejectFactory__WEBPACK_IMPORTED_MODULE_7__.Rejection.normalize(err)); }); + return undefined; + }; }; + /** + * These GetErrorHandler(s) are used by [[invokeHook]] below + * Each HookType chooses a GetErrorHandler (See: [[TransitionService._defineCoreEvents]]) + */ + TransitionHook.LOG_ERROR = function (hook) { return function (error) { return hook.logError(error); }; }; + TransitionHook.REJECT_ERROR = function (hook) { return function (error) { return (0,_common_common__WEBPACK_IMPORTED_MODULE_1__.silentRejection)(error); }; }; + TransitionHook.THROW_ERROR = function (hook) { return function (error) { + throw error; + }; }; + return TransitionHook; +}()); + +//# sourceMappingURL=transitionHook.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/transition/transitionService.js": +/*!*****************************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/transition/transitionService.js ***! + \*****************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "defaultTransOpts": () => (/* binding */ defaultTransOpts), +/* harmony export */ "TransitionService": () => (/* binding */ TransitionService) +/* harmony export */ }); +/* harmony import */ var _interface__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./interface */ "./node_modules/@uirouter/core/lib-esm/transition/interface.js"); +/* harmony import */ var _transition__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./transition */ "./node_modules/@uirouter/core/lib-esm/transition/transition.js"); +/* harmony import */ var _hookRegistry__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./hookRegistry */ "./node_modules/@uirouter/core/lib-esm/transition/hookRegistry.js"); +/* harmony import */ var _hooks_coreResolvables__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../hooks/coreResolvables */ "./node_modules/@uirouter/core/lib-esm/hooks/coreResolvables.js"); +/* harmony import */ var _hooks_redirectTo__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../hooks/redirectTo */ "./node_modules/@uirouter/core/lib-esm/hooks/redirectTo.js"); +/* harmony import */ var _hooks_onEnterExitRetain__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../hooks/onEnterExitRetain */ "./node_modules/@uirouter/core/lib-esm/hooks/onEnterExitRetain.js"); +/* harmony import */ var _hooks_resolve__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../hooks/resolve */ "./node_modules/@uirouter/core/lib-esm/hooks/resolve.js"); +/* harmony import */ var _hooks_views__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../hooks/views */ "./node_modules/@uirouter/core/lib-esm/hooks/views.js"); +/* harmony import */ var _hooks_updateGlobals__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../hooks/updateGlobals */ "./node_modules/@uirouter/core/lib-esm/hooks/updateGlobals.js"); +/* harmony import */ var _hooks_url__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../hooks/url */ "./node_modules/@uirouter/core/lib-esm/hooks/url.js"); +/* harmony import */ var _hooks_lazyLoad__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../hooks/lazyLoad */ "./node_modules/@uirouter/core/lib-esm/hooks/lazyLoad.js"); +/* harmony import */ var _transitionEventType__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./transitionEventType */ "./node_modules/@uirouter/core/lib-esm/transition/transitionEventType.js"); +/* harmony import */ var _transitionHook__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./transitionHook */ "./node_modules/@uirouter/core/lib-esm/transition/transitionHook.js"); +/* harmony import */ var _common_predicates__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../common/predicates */ "./node_modules/@uirouter/core/lib-esm/common/predicates.js"); +/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../common/common */ "./node_modules/@uirouter/core/lib-esm/common/common.js"); +/* harmony import */ var _common_hof__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ../common/hof */ "./node_modules/@uirouter/core/lib-esm/common/hof.js"); +/* harmony import */ var _hooks_ignoredTransition__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ../hooks/ignoredTransition */ "./node_modules/@uirouter/core/lib-esm/hooks/ignoredTransition.js"); +/* harmony import */ var _hooks_invalidTransition__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ../hooks/invalidTransition */ "./node_modules/@uirouter/core/lib-esm/hooks/invalidTransition.js"); + + + + + + + + + + + + + + + + + + +/** + * The default [[Transition]] options. + * + * Include this object when applying custom defaults: + * let reloadOpts = { reload: true, notify: true } + * let options = defaults(theirOpts, customDefaults, defaultOptions); + */ +var defaultTransOpts = { + location: true, + relative: null, + inherit: false, + notify: true, + reload: false, + supercede: true, + custom: {}, + current: function () { return null; }, + source: 'unknown', +}; +/** + * This class provides services related to Transitions. + * + * - Most importantly, it allows global Transition Hooks to be registered. + * - It allows the default transition error handler to be set. + * - It also has a factory function for creating new [[Transition]] objects, (used internally by the [[StateService]]). + * + * At bootstrap, [[UIRouter]] creates a single instance (singleton) of this class. + * + * This API is located at `router.transitionService` ([[UIRouter.transitionService]]) + */ +var TransitionService = /** @class */ (function () { + /** @internal */ + function TransitionService(_router) { + /** @internal */ + this._transitionCount = 0; + /** The transition hook types, such as `onEnter`, `onStart`, etc */ + this._eventTypes = []; + /** @internal The registered transition hooks */ + this._registeredHooks = {}; + /** The paths on a criteria object */ + this._criteriaPaths = {}; + this._router = _router; + this.$view = _router.viewService; + this._deregisterHookFns = {}; + this._pluginapi = ((0,_common_common__WEBPACK_IMPORTED_MODULE_14__.createProxyFunctions)((0,_common_hof__WEBPACK_IMPORTED_MODULE_15__.val)(this), {}, (0,_common_hof__WEBPACK_IMPORTED_MODULE_15__.val)(this), [ + '_definePathType', + '_defineEvent', + '_getPathTypes', + '_getEvents', + 'getHooks', + ])); + this._defineCorePaths(); + this._defineCoreEvents(); + this._registerCoreTransitionHooks(); + _router.globals.successfulTransitions.onEvict(_hooks_coreResolvables__WEBPACK_IMPORTED_MODULE_3__.treeChangesCleanup); + } + /** + * Registers a [[TransitionHookFn]], called *while a transition is being constructed*. + * + * Registers a transition lifecycle hook, which is invoked during transition construction. + * + * This low level hook should only be used by plugins. + * This can be a useful time for plugins to add resolves or mutate the transition as needed. + * The Sticky States plugin uses this hook to modify the treechanges. + * + * ### Lifecycle + * + * `onCreate` hooks are invoked *while a transition is being constructed*. + * + * ### Return value + * + * The hook's return value is ignored + * + * @internal + * @param criteria defines which Transitions the Hook should be invoked for. + * @param callback the hook function which will be invoked. + * @param options the registration options + * @returns a function which deregisters the hook. + */ + TransitionService.prototype.onCreate = function (criteria, callback, options) { + return; + }; + /** @inheritdoc */ + TransitionService.prototype.onBefore = function (criteria, callback, options) { + return; + }; + /** @inheritdoc */ + TransitionService.prototype.onStart = function (criteria, callback, options) { + return; + }; + /** @inheritdoc */ + TransitionService.prototype.onExit = function (criteria, callback, options) { + return; + }; + /** @inheritdoc */ + TransitionService.prototype.onRetain = function (criteria, callback, options) { + return; + }; + /** @inheritdoc */ + TransitionService.prototype.onEnter = function (criteria, callback, options) { + return; + }; + /** @inheritdoc */ + TransitionService.prototype.onFinish = function (criteria, callback, options) { + return; + }; + /** @inheritdoc */ + TransitionService.prototype.onSuccess = function (criteria, callback, options) { + return; + }; + /** @inheritdoc */ + TransitionService.prototype.onError = function (criteria, callback, options) { + return; + }; + /** + * dispose + * @internal + */ + TransitionService.prototype.dispose = function (router) { + (0,_common_common__WEBPACK_IMPORTED_MODULE_14__.values)(this._registeredHooks).forEach(function (hooksArray) { + return hooksArray.forEach(function (hook) { + hook._deregistered = true; + (0,_common_common__WEBPACK_IMPORTED_MODULE_14__.removeFrom)(hooksArray, hook); + }); + }); + }; + /** + * Creates a new [[Transition]] object + * + * This is a factory function for creating new Transition objects. + * It is used internally by the [[StateService]] and should generally not be called by application code. + * + * @internal + * @param fromPath the path to the current state (the from state) + * @param targetState the target state (destination) + * @returns a Transition + */ + TransitionService.prototype.create = function (fromPath, targetState) { + return new _transition__WEBPACK_IMPORTED_MODULE_1__.Transition(fromPath, targetState, this._router); + }; + /** @internal */ + TransitionService.prototype._defineCoreEvents = function () { + var Phase = _interface__WEBPACK_IMPORTED_MODULE_0__.TransitionHookPhase; + var TH = _transitionHook__WEBPACK_IMPORTED_MODULE_12__.TransitionHook; + var paths = this._criteriaPaths; + var NORMAL_SORT = false, REVERSE_SORT = true; + var SYNCHRONOUS = true; + this._defineEvent('onCreate', Phase.CREATE, 0, paths.to, NORMAL_SORT, TH.LOG_REJECTED_RESULT, TH.THROW_ERROR, SYNCHRONOUS); + this._defineEvent('onBefore', Phase.BEFORE, 0, paths.to); + this._defineEvent('onStart', Phase.RUN, 0, paths.to); + this._defineEvent('onExit', Phase.RUN, 100, paths.exiting, REVERSE_SORT); + this._defineEvent('onRetain', Phase.RUN, 200, paths.retained); + this._defineEvent('onEnter', Phase.RUN, 300, paths.entering); + this._defineEvent('onFinish', Phase.RUN, 400, paths.to); + this._defineEvent('onSuccess', Phase.SUCCESS, 0, paths.to, NORMAL_SORT, TH.LOG_REJECTED_RESULT, TH.LOG_ERROR, SYNCHRONOUS); + this._defineEvent('onError', Phase.ERROR, 0, paths.to, NORMAL_SORT, TH.LOG_REJECTED_RESULT, TH.LOG_ERROR, SYNCHRONOUS); + }; + /** @internal */ + TransitionService.prototype._defineCorePaths = function () { + var STATE = _interface__WEBPACK_IMPORTED_MODULE_0__.TransitionHookScope.STATE, TRANSITION = _interface__WEBPACK_IMPORTED_MODULE_0__.TransitionHookScope.TRANSITION; + this._definePathType('to', TRANSITION); + this._definePathType('from', TRANSITION); + this._definePathType('exiting', STATE); + this._definePathType('retained', STATE); + this._definePathType('entering', STATE); + }; + /** @internal */ + TransitionService.prototype._defineEvent = function (name, hookPhase, hookOrder, criteriaMatchPath, reverseSort, getResultHandler, getErrorHandler, synchronous) { + if (reverseSort === void 0) { reverseSort = false; } + if (getResultHandler === void 0) { getResultHandler = _transitionHook__WEBPACK_IMPORTED_MODULE_12__.TransitionHook.HANDLE_RESULT; } + if (getErrorHandler === void 0) { getErrorHandler = _transitionHook__WEBPACK_IMPORTED_MODULE_12__.TransitionHook.REJECT_ERROR; } + if (synchronous === void 0) { synchronous = false; } + var eventType = new _transitionEventType__WEBPACK_IMPORTED_MODULE_11__.TransitionEventType(name, hookPhase, hookOrder, criteriaMatchPath, reverseSort, getResultHandler, getErrorHandler, synchronous); + this._eventTypes.push(eventType); + (0,_hookRegistry__WEBPACK_IMPORTED_MODULE_2__.makeEvent)(this, this, eventType); + }; + /** @internal */ + TransitionService.prototype._getEvents = function (phase) { + var transitionHookTypes = (0,_common_predicates__WEBPACK_IMPORTED_MODULE_13__.isDefined)(phase) + ? this._eventTypes.filter(function (type) { return type.hookPhase === phase; }) + : this._eventTypes.slice(); + return transitionHookTypes.sort(function (l, r) { + var cmpByPhase = l.hookPhase - r.hookPhase; + return cmpByPhase === 0 ? l.hookOrder - r.hookOrder : cmpByPhase; + }); + }; + /** + * Adds a Path to be used as a criterion against a TreeChanges path + * + * For example: the `exiting` path in [[HookMatchCriteria]] is a STATE scoped path. + * It was defined by calling `defineTreeChangesCriterion('exiting', TransitionHookScope.STATE)` + * Each state in the exiting path is checked against the criteria and returned as part of the match. + * + * Another example: the `to` path in [[HookMatchCriteria]] is a TRANSITION scoped path. + * It was defined by calling `defineTreeChangesCriterion('to', TransitionHookScope.TRANSITION)` + * Only the tail of the `to` path is checked against the criteria and returned as part of the match. + * + * @internal + */ + TransitionService.prototype._definePathType = function (name, hookScope) { + this._criteriaPaths[name] = { name: name, scope: hookScope }; + }; + /** @internal */ + // tslint:disable-next-line + TransitionService.prototype._getPathTypes = function () { + return this._criteriaPaths; + }; + /** @internal */ + TransitionService.prototype.getHooks = function (hookName) { + return this._registeredHooks[hookName]; + }; + /** @internal */ + TransitionService.prototype._registerCoreTransitionHooks = function () { + var fns = this._deregisterHookFns; + fns.addCoreResolves = (0,_hooks_coreResolvables__WEBPACK_IMPORTED_MODULE_3__.registerAddCoreResolvables)(this); + fns.ignored = (0,_hooks_ignoredTransition__WEBPACK_IMPORTED_MODULE_16__.registerIgnoredTransitionHook)(this); + fns.invalid = (0,_hooks_invalidTransition__WEBPACK_IMPORTED_MODULE_17__.registerInvalidTransitionHook)(this); + // Wire up redirectTo hook + fns.redirectTo = (0,_hooks_redirectTo__WEBPACK_IMPORTED_MODULE_4__.registerRedirectToHook)(this); + // Wire up onExit/Retain/Enter state hooks + fns.onExit = (0,_hooks_onEnterExitRetain__WEBPACK_IMPORTED_MODULE_5__.registerOnExitHook)(this); + fns.onRetain = (0,_hooks_onEnterExitRetain__WEBPACK_IMPORTED_MODULE_5__.registerOnRetainHook)(this); + fns.onEnter = (0,_hooks_onEnterExitRetain__WEBPACK_IMPORTED_MODULE_5__.registerOnEnterHook)(this); + // Wire up Resolve hooks + fns.eagerResolve = (0,_hooks_resolve__WEBPACK_IMPORTED_MODULE_6__.registerEagerResolvePath)(this); + fns.lazyResolve = (0,_hooks_resolve__WEBPACK_IMPORTED_MODULE_6__.registerLazyResolveState)(this); + fns.resolveAll = (0,_hooks_resolve__WEBPACK_IMPORTED_MODULE_6__.registerResolveRemaining)(this); + // Wire up the View management hooks + fns.loadViews = (0,_hooks_views__WEBPACK_IMPORTED_MODULE_7__.registerLoadEnteringViews)(this); + fns.activateViews = (0,_hooks_views__WEBPACK_IMPORTED_MODULE_7__.registerActivateViews)(this); + // Updates global state after a transition + fns.updateGlobals = (0,_hooks_updateGlobals__WEBPACK_IMPORTED_MODULE_8__.registerUpdateGlobalState)(this); + // After globals.current is updated at priority: 10000 + fns.updateUrl = (0,_hooks_url__WEBPACK_IMPORTED_MODULE_9__.registerUpdateUrl)(this); + // Lazy load state trees + fns.lazyLoad = (0,_hooks_lazyLoad__WEBPACK_IMPORTED_MODULE_10__.registerLazyLoadHook)(this); + }; + return TransitionService; +}()); + +//# sourceMappingURL=transitionService.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/url/index.js": +/*!**********************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/url/index.js ***! + \**********************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "UrlMatcher": () => (/* reexport safe */ _urlMatcher__WEBPACK_IMPORTED_MODULE_1__.UrlMatcher), +/* harmony export */ "ParamFactory": () => (/* reexport safe */ _urlMatcherFactory__WEBPACK_IMPORTED_MODULE_2__.ParamFactory), +/* harmony export */ "UrlMatcherFactory": () => (/* reexport safe */ _urlMatcherFactory__WEBPACK_IMPORTED_MODULE_2__.UrlMatcherFactory), +/* harmony export */ "UrlRouter": () => (/* reexport safe */ _urlRouter__WEBPACK_IMPORTED_MODULE_3__.UrlRouter), +/* harmony export */ "BaseUrlRule": () => (/* reexport safe */ _urlRule__WEBPACK_IMPORTED_MODULE_4__.BaseUrlRule), +/* harmony export */ "UrlRuleFactory": () => (/* reexport safe */ _urlRule__WEBPACK_IMPORTED_MODULE_4__.UrlRuleFactory), +/* harmony export */ "UrlService": () => (/* reexport safe */ _urlService__WEBPACK_IMPORTED_MODULE_5__.UrlService), +/* harmony export */ "UrlRules": () => (/* reexport safe */ _urlRules__WEBPACK_IMPORTED_MODULE_6__.UrlRules), +/* harmony export */ "UrlConfig": () => (/* reexport safe */ _urlConfig__WEBPACK_IMPORTED_MODULE_7__.UrlConfig) +/* harmony export */ }); +/* harmony import */ var _interface__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./interface */ "./node_modules/@uirouter/core/lib-esm/url/interface.js"); +/* harmony import */ var _interface__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_interface__WEBPACK_IMPORTED_MODULE_0__); +/* harmony reexport (unknown) */ var __WEBPACK_REEXPORT_OBJECT__ = {}; +/* harmony reexport (unknown) */ for(const __WEBPACK_IMPORT_KEY__ in _interface__WEBPACK_IMPORTED_MODULE_0__) if(["default","UrlRules","UrlConfig"].indexOf(__WEBPACK_IMPORT_KEY__) < 0) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = () => _interface__WEBPACK_IMPORTED_MODULE_0__[__WEBPACK_IMPORT_KEY__] +/* harmony reexport (unknown) */ __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__); +/* harmony import */ var _urlMatcher__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./urlMatcher */ "./node_modules/@uirouter/core/lib-esm/url/urlMatcher.js"); +/* harmony import */ var _urlMatcherFactory__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./urlMatcherFactory */ "./node_modules/@uirouter/core/lib-esm/url/urlMatcherFactory.js"); +/* harmony import */ var _urlRouter__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./urlRouter */ "./node_modules/@uirouter/core/lib-esm/url/urlRouter.js"); +/* harmony import */ var _urlRule__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./urlRule */ "./node_modules/@uirouter/core/lib-esm/url/urlRule.js"); +/* harmony import */ var _urlService__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./urlService */ "./node_modules/@uirouter/core/lib-esm/url/urlService.js"); +/* harmony import */ var _urlRules__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./urlRules */ "./node_modules/@uirouter/core/lib-esm/url/urlRules.js"); +/* harmony import */ var _urlConfig__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./urlConfig */ "./node_modules/@uirouter/core/lib-esm/url/urlConfig.js"); + + + + + + + + +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/url/interface.js": +/*!**************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/url/interface.js ***! + \**************************************************************/ +/***/ (() => { + +//# sourceMappingURL=interface.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/url/urlConfig.js": +/*!**************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/url/urlConfig.js ***! + \**************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "UrlConfig": () => (/* binding */ UrlConfig) +/* harmony export */ }); +/* harmony import */ var _params__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../params */ "./node_modules/@uirouter/core/lib-esm/params/index.js"); +/* harmony import */ var _common__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common */ "./node_modules/@uirouter/core/lib-esm/common/index.js"); + + +/** + * An API to customize the URL behavior and retrieve URL configuration + * + * This API is used to customize the behavior of the URL. + * This includes optional trailing slashes ([[strictMode]]), case sensitivity ([[caseInsensitive]]), + * and custom parameter encoding (custom [[type]]). + * + * It also has information about the location (url) configuration such as [[port]] and [[baseHref]]. + * This information can be used to build absolute URLs, such as + * `https://example.com:443/basepath/state/substate?param1=a#hashvalue`; + * + * This API is found at `router.urlService.config` (see: [[UIRouter.urlService]], [[URLService.config]]) + */ +var UrlConfig = /** @class */ (function () { + /** @internal */ function UrlConfig(/** @internal */ router) { + var _this = this; + this.router = router; + /** @internal */ this.paramTypes = new _params__WEBPACK_IMPORTED_MODULE_0__.ParamTypes(); + /** @internal */ this._decodeParams = true; + /** @internal */ this._isCaseInsensitive = false; + /** @internal */ this._isStrictMode = true; + /** @internal */ this._defaultSquashPolicy = false; + /** @internal */ this.dispose = function () { return _this.paramTypes.dispose(); }; + // Delegate these calls to the current LocationConfig implementation + /** + * Gets the base Href, e.g., `http://localhost/approot/` + * + * @return the application's base href + */ + this.baseHref = function () { return _this.router.locationConfig.baseHref(); }; + /** + * Gets or sets the hashPrefix + * + * This only applies when not running in [[html5Mode]] (pushstate mode) + * + * If the current url is `http://localhost/app#!/uirouter/path/#anchor`, it returns `!` which is the prefix for the "hashbang" portion. + * + * @return the hash prefix + */ + this.hashPrefix = function (newprefix) { return _this.router.locationConfig.hashPrefix(newprefix); }; + /** + * Gets the host, e.g., `localhost` + * + * @return the protocol + */ + this.host = function () { return _this.router.locationConfig.host(); }; + /** + * Returns true when running in pushstate mode + * + * @return true when running in html5 mode (pushstate mode). + */ + this.html5Mode = function () { return _this.router.locationConfig.html5Mode(); }; + /** + * Gets the port, e.g., `80` + * + * @return the port number + */ + this.port = function () { return _this.router.locationConfig.port(); }; + /** + * Gets the protocol, e.g., `http` + * + * @return the protocol + */ + this.protocol = function () { return _this.router.locationConfig.protocol(); }; + } + /** + * Defines whether URL matching should be case sensitive (the default behavior), or not. + * + * #### Example: + * ```js + * // Allow case insensitive url matches + * urlService.config.caseInsensitive(true); + * ``` + * + * @param value `false` to match URL in a case sensitive manner; otherwise `true`; + * @returns the current value of caseInsensitive + */ + UrlConfig.prototype.caseInsensitive = function (value) { + return (this._isCaseInsensitive = (0,_common__WEBPACK_IMPORTED_MODULE_1__.isDefined)(value) ? value : this._isCaseInsensitive); + }; + /** + * Sets the default behavior when generating or matching URLs with default parameter values. + * + * #### Example: + * ```js + * // Remove default parameter values from the url + * urlService.config.defaultSquashPolicy(true); + * ``` + * + * @param value A string that defines the default parameter URL squashing behavior. + * - `nosquash`: When generating an href with a default parameter value, do not squash the parameter value from the URL + * - `slash`: When generating an href with a default parameter value, squash (remove) the parameter value, and, if the + * parameter is surrounded by slashes, squash (remove) one slash from the URL + * - any other string, e.g. "~": When generating an href with a default parameter value, squash (remove) + * the parameter value from the URL and replace it with this string. + * @returns the current value of defaultSquashPolicy + */ + UrlConfig.prototype.defaultSquashPolicy = function (value) { + if ((0,_common__WEBPACK_IMPORTED_MODULE_1__.isDefined)(value) && value !== true && value !== false && !(0,_common__WEBPACK_IMPORTED_MODULE_1__.isString)(value)) + throw new Error("Invalid squash policy: " + value + ". Valid policies: false, true, arbitrary-string"); + return (this._defaultSquashPolicy = (0,_common__WEBPACK_IMPORTED_MODULE_1__.isDefined)(value) ? value : this._defaultSquashPolicy); + }; + /** + * Defines whether URLs should match trailing slashes, or not (the default behavior). + * + * #### Example: + * ```js + * // Allow optional trailing slashes + * urlService.config.strictMode(false); + * ``` + * + * @param value `false` to match trailing slashes in URLs, otherwise `true`. + * @returns the current value of strictMode + */ + UrlConfig.prototype.strictMode = function (value) { + return (this._isStrictMode = (0,_common__WEBPACK_IMPORTED_MODULE_1__.isDefined)(value) ? value : this._isStrictMode); + }; + /** + * Creates and registers a custom [[ParamType]] object + * + * A custom parameter type can be used to generate URLs with typed parameters or custom encoding/decoding. + * + * #### Note: Register custom types *before using them* in a state definition. + * + * #### Example: + * ```js + * // Encode object parameter as JSON string + * urlService.config.type('myjson', { + * encode: (obj) => JSON.stringify(obj), + * decode: (str) => JSON.parse(str), + * is: (val) => typeof(val) === 'object', + * pattern: /[^/]+/, + * equals: (a, b) => _.isEqual(a, b), + * }); + * ``` + * + * See [[ParamTypeDefinition]] for more examples + * + * @param name The type name. + * @param definition The type definition. See [[ParamTypeDefinition]] for information on the values accepted. + * @param definitionFn A function that is injected before the app runtime starts. + * The result of this function should be a [[ParamTypeDefinition]]. + * The result is merged into the existing `definition`. + * See [[ParamType]] for information on the values accepted. + * + * @returns if only the `name` parameter was specified: the currently registered [[ParamType]] object, or undefined + */ + UrlConfig.prototype.type = function (name, definition, definitionFn) { + var type = this.paramTypes.type(name, definition, definitionFn); + return !(0,_common__WEBPACK_IMPORTED_MODULE_1__.isDefined)(definition) ? type : this; + }; + return UrlConfig; +}()); + +//# sourceMappingURL=urlConfig.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/url/urlMatcher.js": +/*!***************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/url/urlMatcher.js ***! + \***************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "UrlMatcher": () => (/* binding */ UrlMatcher) +/* harmony export */ }); +/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/common */ "./node_modules/@uirouter/core/lib-esm/common/common.js"); +/* harmony import */ var _common_hof__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/hof */ "./node_modules/@uirouter/core/lib-esm/common/hof.js"); +/* harmony import */ var _common_predicates__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../common/predicates */ "./node_modules/@uirouter/core/lib-esm/common/predicates.js"); +/* harmony import */ var _params_param__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../params/param */ "./node_modules/@uirouter/core/lib-esm/params/param.js"); +/* harmony import */ var _common_strings__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../common/strings */ "./node_modules/@uirouter/core/lib-esm/common/strings.js"); +/* harmony import */ var _common__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../common */ "./node_modules/@uirouter/core/lib-esm/common/index.js"); + + + + + + +function quoteRegExp(str, param) { + var surroundPattern = ['', ''], result = str.replace(/[\\\[\]\^$*+?.()|{}]/g, '\\$&'); + if (!param) + return result; + switch (param.squash) { + case false: + surroundPattern = ['(', ')' + (param.isOptional ? '?' : '')]; + break; + case true: + result = result.replace(/\/$/, ''); + surroundPattern = ['(?:/(', ')|/)?']; + break; + default: + surroundPattern = ["(" + param.squash + "|", ')?']; + break; + } + return result + surroundPattern[0] + param.type.pattern.source + surroundPattern[1]; +} +var memoizeTo = function (obj, _prop, fn) { return (obj[_prop] = obj[_prop] || fn()); }; +var splitOnSlash = (0,_common_strings__WEBPACK_IMPORTED_MODULE_4__.splitOnDelim)('/'); +var defaultConfig = { + state: { params: {} }, + strict: true, + caseInsensitive: true, + decodeParams: true, +}; +/** + * Matches URLs against patterns. + * + * Matches URLs against patterns and extracts named parameters from the path or the search + * part of the URL. + * + * A URL pattern consists of a path pattern, optionally followed by '?' and a list of search (query) + * parameters. Multiple search parameter names are separated by '&'. Search parameters + * do not influence whether or not a URL is matched, but their values are passed through into + * the matched parameters returned by [[UrlMatcher.exec]]. + * + * - *Path parameters* are defined using curly brace placeholders (`/somepath/{param}`) + * or colon placeholders (`/somePath/:param`). + * + * - *A parameter RegExp* may be defined for a param after a colon + * (`/somePath/{param:[a-zA-Z0-9]+}`) in a curly brace placeholder. + * The regexp must match for the url to be matched. + * Should the regexp itself contain curly braces, they must be in matched pairs or escaped with a backslash. + * + * Note: a RegExp parameter will encode its value using either [[ParamTypes.path]] or [[ParamTypes.query]]. + * + * - *Custom parameter types* may also be specified after a colon (`/somePath/{param:int}`) in curly brace parameters. + * See [[UrlMatcherFactory.type]] for more information. + * + * - *Catch-all parameters* are defined using an asterisk placeholder (`/somepath/*catchallparam`). + * A catch-all * parameter value will contain the remainder of the URL. + * + * --- + * + * Parameter names may contain only word characters (latin letters, digits, and underscore) and + * must be unique within the pattern (across both path and search parameters). + * A path parameter matches any number of characters other than '/'. For catch-all + * placeholders the path parameter matches any number of characters. + * + * Examples: + * + * * `'/hello/'` - Matches only if the path is exactly '/hello/'. There is no special treatment for + * trailing slashes, and patterns have to match the entire path, not just a prefix. + * * `'/user/:id'` - Matches '/user/bob' or '/user/1234!!!' or even '/user/' but not '/user' or + * '/user/bob/details'. The second path segment will be captured as the parameter 'id'. + * * `'/user/{id}'` - Same as the previous example, but using curly brace syntax. + * * `'/user/{id:[^/]*}'` - Same as the previous example. + * * `'/user/{id:[0-9a-fA-F]{1,8}}'` - Similar to the previous example, but only matches if the id + * parameter consists of 1 to 8 hex digits. + * * `'/files/{path:.*}'` - Matches any URL starting with '/files/' and captures the rest of the + * path into the parameter 'path'. + * * `'/files/*path'` - ditto. + * * `'/calendar/{start:date}'` - Matches "/calendar/2014-11-12" (because the pattern defined + * in the built-in `date` ParamType matches `2014-11-12`) and provides a Date object in $stateParams.start + * + */ +var UrlMatcher = /** @class */ (function () { + /** + * @param pattern The pattern to compile into a matcher. + * @param paramTypes The [[ParamTypes]] registry + * @param paramFactory A [[ParamFactory]] object + * @param config A [[UrlMatcherCompileConfig]] configuration object + */ + function UrlMatcher(pattern, paramTypes, paramFactory, config) { + var _this = this; + /** @internal */ + this._cache = { path: [this] }; + /** @internal */ + this._children = []; + /** @internal */ + this._params = []; + /** @internal */ + this._segments = []; + /** @internal */ + this._compiled = []; + this.config = config = (0,_common__WEBPACK_IMPORTED_MODULE_5__.defaults)(config, defaultConfig); + this.pattern = pattern; + // Find all placeholders and create a compiled pattern, using either classic or curly syntax: + // '*' name + // ':' name + // '{' name '}' + // '{' name ':' regexp '}' + // The regular expression is somewhat complicated due to the need to allow curly braces + // inside the regular expression. The placeholder regexp breaks down as follows: + // ([:*])([\w\[\]]+) - classic placeholder ($1 / $2) (search version has - for snake-case) + // \{([\w\[\]]+)(?:\:\s*( ... ))?\} - curly brace placeholder ($3) with optional regexp/type ... ($4) (search version has - for snake-case + // (?: ... | ... | ... )+ - the regexp consists of any number of atoms, an atom being either + // [^{}\\]+ - anything other than curly braces or backslash + // \\. - a backslash escape + // \{(?:[^{}\\]+|\\.)*\} - a matched set of curly braces containing other atoms + var placeholder = /([:*])([\w\[\]]+)|\{([\w\[\]]+)(?:\:\s*((?:[^{}\\]+|\\.|\{(?:[^{}\\]+|\\.)*\})+))?\}/g; + var searchPlaceholder = /([:]?)([\w\[\].-]+)|\{([\w\[\].-]+)(?:\:\s*((?:[^{}\\]+|\\.|\{(?:[^{}\\]+|\\.)*\})+))?\}/g; + var patterns = []; + var last = 0; + var matchArray; + var checkParamErrors = function (id) { + if (!UrlMatcher.nameValidator.test(id)) + throw new Error("Invalid parameter name '" + id + "' in pattern '" + pattern + "'"); + if ((0,_common_common__WEBPACK_IMPORTED_MODULE_0__.find)(_this._params, (0,_common_hof__WEBPACK_IMPORTED_MODULE_1__.propEq)('id', id))) + throw new Error("Duplicate parameter name '" + id + "' in pattern '" + pattern + "'"); + }; + // Split into static segments separated by path parameter placeholders. + // The number of segments is always 1 more than the number of parameters. + var matchDetails = function (m, isSearch) { + // IE[78] returns '' for unmatched groups instead of null + var id = m[2] || m[3]; + var regexp = isSearch ? m[4] : m[4] || (m[1] === '*' ? '[\\s\\S]*' : null); + var makeRegexpType = function (str) { + return (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.inherit)(paramTypes.type(isSearch ? 'query' : 'path'), { + pattern: new RegExp(str, _this.config.caseInsensitive ? 'i' : undefined), + }); + }; + return { + id: id, + regexp: regexp, + segment: pattern.substring(last, m.index), + type: !regexp ? null : paramTypes.type(regexp) || makeRegexpType(regexp), + }; + }; + var details; + var segment; + // tslint:disable-next-line:no-conditional-assignment + while ((matchArray = placeholder.exec(pattern))) { + details = matchDetails(matchArray, false); + if (details.segment.indexOf('?') >= 0) + break; // we're into the search part + checkParamErrors(details.id); + this._params.push(paramFactory.fromPath(details.id, details.type, config.state)); + this._segments.push(details.segment); + patterns.push([details.segment, (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.tail)(this._params)]); + last = placeholder.lastIndex; + } + segment = pattern.substring(last); + // Find any search parameter names and remove them from the last segment + var i = segment.indexOf('?'); + if (i >= 0) { + var search = segment.substring(i); + segment = segment.substring(0, i); + if (search.length > 0) { + last = 0; + // tslint:disable-next-line:no-conditional-assignment + while ((matchArray = searchPlaceholder.exec(search))) { + details = matchDetails(matchArray, true); + checkParamErrors(details.id); + this._params.push(paramFactory.fromSearch(details.id, details.type, config.state)); + last = placeholder.lastIndex; + // check if ?& + } + } + } + this._segments.push(segment); + this._compiled = patterns.map(function (_pattern) { return quoteRegExp.apply(null, _pattern); }).concat(quoteRegExp(segment)); + } + /** @internal */ + UrlMatcher.encodeDashes = function (str) { + // Replace dashes with encoded "\-" + return encodeURIComponent(str).replace(/-/g, function (c) { return "%5C%" + c.charCodeAt(0).toString(16).toUpperCase(); }); + }; + /** @internal Given a matcher, return an array with the matcher's path segments and path params, in order */ + UrlMatcher.pathSegmentsAndParams = function (matcher) { + var staticSegments = matcher._segments; + var pathParams = matcher._params.filter(function (p) { return p.location === _params_param__WEBPACK_IMPORTED_MODULE_3__.DefType.PATH; }); + return (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.arrayTuples)(staticSegments, pathParams.concat(undefined)) + .reduce(_common_common__WEBPACK_IMPORTED_MODULE_0__.unnestR, []) + .filter(function (x) { return x !== '' && (0,_common_predicates__WEBPACK_IMPORTED_MODULE_2__.isDefined)(x); }); + }; + /** @internal Given a matcher, return an array with the matcher's query params */ + UrlMatcher.queryParams = function (matcher) { + return matcher._params.filter(function (p) { return p.location === _params_param__WEBPACK_IMPORTED_MODULE_3__.DefType.SEARCH; }); + }; + /** + * Compare two UrlMatchers + * + * This comparison function converts a UrlMatcher into static and dynamic path segments. + * Each static path segment is a static string between a path separator (slash character). + * Each dynamic segment is a path parameter. + * + * The comparison function sorts static segments before dynamic ones. + */ + UrlMatcher.compare = function (a, b) { + /** + * Turn a UrlMatcher and all its parent matchers into an array + * of slash literals '/', string literals, and Param objects + * + * This example matcher matches strings like "/foo/:param/tail": + * var matcher = $umf.compile("/foo").append($umf.compile("/:param")).append($umf.compile("/")).append($umf.compile("tail")); + * var result = segments(matcher); // [ '/', 'foo', '/', Param, '/', 'tail' ] + * + * Caches the result as `matcher._cache.segments` + */ + var segments = function (matcher) { + return (matcher._cache.segments = + matcher._cache.segments || + matcher._cache.path + .map(UrlMatcher.pathSegmentsAndParams) + .reduce(_common_common__WEBPACK_IMPORTED_MODULE_0__.unnestR, []) + .reduce(_common_strings__WEBPACK_IMPORTED_MODULE_4__.joinNeighborsR, []) + .map(function (x) { return ((0,_common_predicates__WEBPACK_IMPORTED_MODULE_2__.isString)(x) ? splitOnSlash(x) : x); }) + .reduce(_common_common__WEBPACK_IMPORTED_MODULE_0__.unnestR, [])); + }; + /** + * Gets the sort weight for each segment of a UrlMatcher + * + * Caches the result as `matcher._cache.weights` + */ + var weights = function (matcher) { + return (matcher._cache.weights = + matcher._cache.weights || + segments(matcher).map(function (segment) { + // Sort slashes first, then static strings, the Params + if (segment === '/') + return 1; + if ((0,_common_predicates__WEBPACK_IMPORTED_MODULE_2__.isString)(segment)) + return 2; + if (segment instanceof _params_param__WEBPACK_IMPORTED_MODULE_3__.Param) + return 3; + })); + }; + /** + * Pads shorter array in-place (mutates) + */ + var padArrays = function (l, r, padVal) { + var len = Math.max(l.length, r.length); + while (l.length < len) + l.push(padVal); + while (r.length < len) + r.push(padVal); + }; + var weightsA = weights(a), weightsB = weights(b); + padArrays(weightsA, weightsB, 0); + var _pairs = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.arrayTuples)(weightsA, weightsB); + var cmp, i; + for (i = 0; i < _pairs.length; i++) { + cmp = _pairs[i][0] - _pairs[i][1]; + if (cmp !== 0) + return cmp; + } + return 0; + }; + /** + * Creates a new concatenated UrlMatcher + * + * Builds a new UrlMatcher by appending another UrlMatcher to this one. + * + * @param url A `UrlMatcher` instance to append as a child of the current `UrlMatcher`. + */ + UrlMatcher.prototype.append = function (url) { + this._children.push(url); + url._cache = { + path: this._cache.path.concat(url), + parent: this, + pattern: null, + }; + return url; + }; + /** @internal */ + UrlMatcher.prototype.isRoot = function () { + return this._cache.path[0] === this; + }; + /** Returns the input pattern string */ + UrlMatcher.prototype.toString = function () { + return this.pattern; + }; + UrlMatcher.prototype._getDecodedParamValue = function (value, param) { + if ((0,_common_predicates__WEBPACK_IMPORTED_MODULE_2__.isDefined)(value)) { + if (this.config.decodeParams && !param.type.raw) { + if ((0,_common_predicates__WEBPACK_IMPORTED_MODULE_2__.isArray)(value)) { + value = value.map(function (paramValue) { return decodeURIComponent(paramValue); }); + } + else { + value = decodeURIComponent(value); + } + } + value = param.type.decode(value); + } + return param.value(value); + }; + /** + * Tests the specified url/path against this matcher. + * + * Tests if the given url matches this matcher's pattern, and returns an object containing the captured + * parameter values. Returns null if the path does not match. + * + * The returned object contains the values + * of any search parameters that are mentioned in the pattern, but their value may be null if + * they are not present in `search`. This means that search parameters are always treated + * as optional. + * + * #### Example: + * ```js + * new UrlMatcher('/user/{id}?q&r').exec('/user/bob', { + * x: '1', q: 'hello' + * }); + * // returns { id: 'bob', q: 'hello', r: null } + * ``` + * + * @param path The URL path to match, e.g. `$location.path()`. + * @param search URL search parameters, e.g. `$location.search()`. + * @param hash URL hash e.g. `$location.hash()`. + * @param options + * + * @returns The captured parameter values. + */ + UrlMatcher.prototype.exec = function (path, search, hash, options) { + var _this = this; + if (search === void 0) { search = {}; } + if (options === void 0) { options = {}; } + var match = memoizeTo(this._cache, 'pattern', function () { + return new RegExp([ + '^', + (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.unnest)(_this._cache.path.map((0,_common_hof__WEBPACK_IMPORTED_MODULE_1__.prop)('_compiled'))).join(''), + _this.config.strict === false ? '/?' : '', + '$', + ].join(''), _this.config.caseInsensitive ? 'i' : undefined); + }).exec(path); + if (!match) + return null; + // options = defaults(options, { isolate: false }); + var allParams = this.parameters(), pathParams = allParams.filter(function (param) { return !param.isSearch(); }), searchParams = allParams.filter(function (param) { return param.isSearch(); }), nPathSegments = this._cache.path.map(function (urlm) { return urlm._segments.length - 1; }).reduce(function (a, x) { return a + x; }), values = {}; + if (nPathSegments !== match.length - 1) + throw new Error("Unbalanced capture group in route '" + this.pattern + "'"); + function decodePathArray(paramVal) { + var reverseString = function (str) { return str.split('').reverse().join(''); }; + var unquoteDashes = function (str) { return str.replace(/\\-/g, '-'); }; + var split = reverseString(paramVal).split(/-(?!\\)/); + var allReversed = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.map)(split, reverseString); + return (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.map)(allReversed, unquoteDashes).reverse(); + } + for (var i = 0; i < nPathSegments; i++) { + var param = pathParams[i]; + var value = match[i + 1]; + // if the param value matches a pre-replace pair, replace the value before decoding. + for (var j = 0; j < param.replace.length; j++) { + if (param.replace[j].from === value) + value = param.replace[j].to; + } + if (value && param.array === true) + value = decodePathArray(value); + values[param.id] = this._getDecodedParamValue(value, param); + } + searchParams.forEach(function (param) { + var value = search[param.id]; + for (var j = 0; j < param.replace.length; j++) { + if (param.replace[j].from === value) + value = param.replace[j].to; + } + values[param.id] = _this._getDecodedParamValue(value, param); + }); + if (hash) + values['#'] = hash; + return values; + }; + /** + * @internal + * Returns all the [[Param]] objects of all path and search parameters of this pattern in order of appearance. + * + * @returns {Array.} An array of [[Param]] objects. Must be treated as read-only. If the + * pattern has no parameters, an empty array is returned. + */ + UrlMatcher.prototype.parameters = function (opts) { + if (opts === void 0) { opts = {}; } + if (opts.inherit === false) + return this._params; + return (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.unnest)(this._cache.path.map(function (matcher) { return matcher._params; })); + }; + /** + * @internal + * Returns a single parameter from this UrlMatcher by id + * + * @param id + * @param opts + * @returns {T|Param|any|boolean|UrlMatcher|null} + */ + UrlMatcher.prototype.parameter = function (id, opts) { + var _this = this; + if (opts === void 0) { opts = {}; } + var findParam = function () { + for (var _i = 0, _a = _this._params; _i < _a.length; _i++) { + var param = _a[_i]; + if (param.id === id) + return param; + } + }; + var parent = this._cache.parent; + return findParam() || (opts.inherit !== false && parent && parent.parameter(id, opts)) || null; + }; + /** + * Validates the input parameter values against this UrlMatcher + * + * Checks an object hash of parameters to validate their correctness according to the parameter + * types of this `UrlMatcher`. + * + * @param params The object hash of parameters to validate. + * @returns Returns `true` if `params` validates, otherwise `false`. + */ + UrlMatcher.prototype.validates = function (params) { + var validParamVal = function (param, val) { return !param || param.validates(val); }; + params = params || {}; + // I'm not sure why this checks only the param keys passed in, and not all the params known to the matcher + var paramSchema = this.parameters().filter(function (paramDef) { return params.hasOwnProperty(paramDef.id); }); + return paramSchema.map(function (paramDef) { return validParamVal(paramDef, params[paramDef.id]); }).reduce(_common_common__WEBPACK_IMPORTED_MODULE_0__.allTrueR, true); + }; + /** + * Given a set of parameter values, creates a URL from this UrlMatcher. + * + * Creates a URL that matches this pattern by substituting the specified values + * for the path and search parameters. + * + * #### Example: + * ```js + * new UrlMatcher('/user/{id}?q').format({ id:'bob', q:'yes' }); + * // returns '/user/bob?q=yes' + * ``` + * + * @param values the values to substitute for the parameters in this pattern. + * @returns the formatted URL (path and optionally search part). + */ + UrlMatcher.prototype.format = function (values) { + if (values === void 0) { values = {}; } + // Build the full path of UrlMatchers (including all parent UrlMatchers) + var urlMatchers = this._cache.path; + // Extract all the static segments and Params (processed as ParamDetails) + // into an ordered array + var pathSegmentsAndParams = urlMatchers + .map(UrlMatcher.pathSegmentsAndParams) + .reduce(_common_common__WEBPACK_IMPORTED_MODULE_0__.unnestR, []) + .map(function (x) { return ((0,_common_predicates__WEBPACK_IMPORTED_MODULE_2__.isString)(x) ? x : getDetails(x)); }); + // Extract the query params into a separate array + var queryParams = urlMatchers + .map(UrlMatcher.queryParams) + .reduce(_common_common__WEBPACK_IMPORTED_MODULE_0__.unnestR, []) + .map(getDetails); + var isInvalid = function (param) { return param.isValid === false; }; + if (pathSegmentsAndParams.concat(queryParams).filter(isInvalid).length) { + return null; + } + /** + * Given a Param, applies the parameter value, then returns detailed information about it + */ + function getDetails(param) { + // Normalize to typed value + var value = param.value(values[param.id]); + var isValid = param.validates(value); + var isDefaultValue = param.isDefaultValue(value); + // Check if we're in squash mode for the parameter + var squash = isDefaultValue ? param.squash : false; + // Allow the Parameter's Type to encode the value + var encoded = param.type.encode(value); + return { param: param, value: value, isValid: isValid, isDefaultValue: isDefaultValue, squash: squash, encoded: encoded }; + } + // Build up the path-portion from the list of static segments and parameters + var pathString = pathSegmentsAndParams.reduce(function (acc, x) { + // The element is a static segment (a raw string); just append it + if ((0,_common_predicates__WEBPACK_IMPORTED_MODULE_2__.isString)(x)) + return acc + x; + // Otherwise, it's a ParamDetails. + var squash = x.squash, encoded = x.encoded, param = x.param; + // If squash is === true, try to remove a slash from the path + if (squash === true) + return acc.match(/\/$/) ? acc.slice(0, -1) : acc; + // If squash is a string, use the string for the param value + if ((0,_common_predicates__WEBPACK_IMPORTED_MODULE_2__.isString)(squash)) + return acc + squash; + if (squash !== false) + return acc; // ? + if (encoded == null) + return acc; + // If this parameter value is an array, encode the value using encodeDashes + if ((0,_common_predicates__WEBPACK_IMPORTED_MODULE_2__.isArray)(encoded)) + return acc + (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.map)(encoded, UrlMatcher.encodeDashes).join('-'); + // If the parameter type is "raw", then do not encodeURIComponent + if (param.raw) + return acc + encoded; + // Encode the value + return acc + encodeURIComponent(encoded); + }, ''); + // Build the query string by applying parameter values (array or regular) + // then mapping to key=value, then flattening and joining using "&" + var queryString = queryParams + .map(function (paramDetails) { + var param = paramDetails.param, squash = paramDetails.squash, encoded = paramDetails.encoded, isDefaultValue = paramDetails.isDefaultValue; + if (encoded == null || (isDefaultValue && squash !== false)) + return; + if (!(0,_common_predicates__WEBPACK_IMPORTED_MODULE_2__.isArray)(encoded)) + encoded = [encoded]; + if (encoded.length === 0) + return; + if (!param.raw) + encoded = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.map)(encoded, encodeURIComponent); + return encoded.map(function (val) { return param.id + "=" + val; }); + }) + .filter(_common_common__WEBPACK_IMPORTED_MODULE_0__.identity) + .reduce(_common_common__WEBPACK_IMPORTED_MODULE_0__.unnestR, []) + .join('&'); + // Concat the pathstring with the queryString (if exists) and the hashString (if exists) + return pathString + (queryString ? "?" + queryString : '') + (values['#'] ? '#' + values['#'] : ''); + }; + /** @internal */ + UrlMatcher.nameValidator = /^\w+([-.]+\w+)*(?:\[\])?$/; + return UrlMatcher; +}()); + +//# sourceMappingURL=urlMatcher.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/url/urlMatcherFactory.js": +/*!**********************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/url/urlMatcherFactory.js ***! + \**********************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "ParamFactory": () => (/* binding */ ParamFactory), +/* harmony export */ "UrlMatcherFactory": () => (/* binding */ UrlMatcherFactory) +/* harmony export */ }); +/* harmony import */ var _common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common */ "./node_modules/@uirouter/core/lib-esm/common/index.js"); +/* harmony import */ var _urlMatcher__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./urlMatcher */ "./node_modules/@uirouter/core/lib-esm/url/urlMatcher.js"); +/* harmony import */ var _params__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../params */ "./node_modules/@uirouter/core/lib-esm/params/index.js"); +var __assign = (undefined && undefined.__assign) || function () { + __assign = Object.assign || function(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) + t[p] = s[p]; + } + return t; + }; + return __assign.apply(this, arguments); +}; + + + +var ParamFactory = /** @class */ (function () { + function ParamFactory(router) { + this.router = router; + } + ParamFactory.prototype.fromConfig = function (id, type, state) { + return new _params__WEBPACK_IMPORTED_MODULE_2__.Param(id, type, _params__WEBPACK_IMPORTED_MODULE_2__.DefType.CONFIG, this.router.urlService.config, state); + }; + ParamFactory.prototype.fromPath = function (id, type, state) { + return new _params__WEBPACK_IMPORTED_MODULE_2__.Param(id, type, _params__WEBPACK_IMPORTED_MODULE_2__.DefType.PATH, this.router.urlService.config, state); + }; + ParamFactory.prototype.fromSearch = function (id, type, state) { + return new _params__WEBPACK_IMPORTED_MODULE_2__.Param(id, type, _params__WEBPACK_IMPORTED_MODULE_2__.DefType.SEARCH, this.router.urlService.config, state); + }; + return ParamFactory; +}()); + +/** + * Factory for [[UrlMatcher]] instances. + * + * The factory is available to ng1 services as + * `$urlMatcherFactory` or ng1 providers as `$urlMatcherFactoryProvider`. + */ +var UrlMatcherFactory = /** @class */ (function () { + // TODO: move implementations to UrlConfig (urlService.config) + function UrlMatcherFactory(/** @internal */ router) { + var _this = this; + this.router = router; + /** Creates a new [[Param]] for a given location (DefType) */ + this.paramFactory = new ParamFactory(this.router); + // TODO: Check if removal of this will break anything, then remove these + this.UrlMatcher = _urlMatcher__WEBPACK_IMPORTED_MODULE_1__.UrlMatcher; + this.Param = _params__WEBPACK_IMPORTED_MODULE_2__.Param; + /** @deprecated use [[UrlConfig.caseInsensitive]] */ + this.caseInsensitive = function (value) { return _this.router.urlService.config.caseInsensitive(value); }; + /** @deprecated use [[UrlConfig.defaultSquashPolicy]] */ + this.defaultSquashPolicy = function (value) { return _this.router.urlService.config.defaultSquashPolicy(value); }; + /** @deprecated use [[UrlConfig.strictMode]] */ + this.strictMode = function (value) { return _this.router.urlService.config.strictMode(value); }; + /** @deprecated use [[UrlConfig.type]] */ + this.type = function (name, definition, definitionFn) { + return _this.router.urlService.config.type(name, definition, definitionFn) || _this; + }; + } + /** + * Creates a [[UrlMatcher]] for the specified pattern. + * + * @param pattern The URL pattern. + * @param config The config object hash. + * @returns The UrlMatcher. + */ + UrlMatcherFactory.prototype.compile = function (pattern, config) { + var urlConfig = this.router.urlService.config; + // backward-compatible support for config.params -> config.state.params + var params = config && !config.state && config.params; + config = params ? __assign({ state: { params: params } }, config) : config; + var globalConfig = { + strict: urlConfig._isStrictMode, + caseInsensitive: urlConfig._isCaseInsensitive, + decodeParams: urlConfig._decodeParams, + }; + return new _urlMatcher__WEBPACK_IMPORTED_MODULE_1__.UrlMatcher(pattern, urlConfig.paramTypes, this.paramFactory, (0,_common__WEBPACK_IMPORTED_MODULE_0__.extend)(globalConfig, config)); + }; + /** + * Returns true if the specified object is a [[UrlMatcher]], or false otherwise. + * + * @param object The object to perform the type check against. + * @returns `true` if the object matches the `UrlMatcher` interface, by + * implementing all the same methods. + */ + UrlMatcherFactory.prototype.isMatcher = function (object) { + // TODO: typeof? + if (!(0,_common__WEBPACK_IMPORTED_MODULE_0__.isObject)(object)) + return false; + var result = true; + (0,_common__WEBPACK_IMPORTED_MODULE_0__.forEach)(_urlMatcher__WEBPACK_IMPORTED_MODULE_1__.UrlMatcher.prototype, function (val, name) { + if ((0,_common__WEBPACK_IMPORTED_MODULE_0__.isFunction)(val)) + result = result && (0,_common__WEBPACK_IMPORTED_MODULE_0__.isDefined)(object[name]) && (0,_common__WEBPACK_IMPORTED_MODULE_0__.isFunction)(object[name]); + }); + return result; + }; + /** @internal */ + UrlMatcherFactory.prototype.$get = function () { + var urlConfig = this.router.urlService.config; + urlConfig.paramTypes.enqueue = false; + urlConfig.paramTypes._flushTypeQueue(); + return this; + }; + return UrlMatcherFactory; +}()); + +//# sourceMappingURL=urlMatcherFactory.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/url/urlRouter.js": +/*!**************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/url/urlRouter.js ***! + \**************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "UrlRouter": () => (/* binding */ UrlRouter) +/* harmony export */ }); +/* harmony import */ var _common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common */ "./node_modules/@uirouter/core/lib-esm/common/index.js"); +/* harmony import */ var _urlRule__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./urlRule */ "./node_modules/@uirouter/core/lib-esm/url/urlRule.js"); + + +function appendBasePath(url, isHtml5, absolute, baseHref) { + if (baseHref === '/') + return url; + if (isHtml5) + return (0,_common__WEBPACK_IMPORTED_MODULE_0__.stripLastPathElement)(baseHref) + url; + if (absolute) + return baseHref.slice(1) + url; + return url; +} +/** + * Updates URL and responds to URL changes + * + * ### Deprecation warning: + * This class is now considered to be an internal API + * Use the [[UrlService]] instead. + * For configuring URL rules, use the [[UrlRules]] which can be found as [[UrlService.rules]]. + */ +var UrlRouter = /** @class */ (function () { + /** @internal */ + function UrlRouter(/** @internal */ router) { + var _this = this; + this.router = router; + // Delegate these calls to [[UrlService]] + /** @deprecated use [[UrlService.sync]]*/ + this.sync = function (evt) { return _this.router.urlService.sync(evt); }; + /** @deprecated use [[UrlService.listen]]*/ + this.listen = function (enabled) { return _this.router.urlService.listen(enabled); }; + /** @deprecated use [[UrlService.deferIntercept]]*/ + this.deferIntercept = function (defer) { return _this.router.urlService.deferIntercept(defer); }; + /** @deprecated use [[UrlService.match]]*/ + this.match = function (urlParts) { return _this.router.urlService.match(urlParts); }; + // Delegate these calls to [[UrlRules]] + /** @deprecated use [[UrlRules.initial]]*/ + this.initial = function (handler) { + return _this.router.urlService.rules.initial(handler); + }; + /** @deprecated use [[UrlRules.otherwise]]*/ + this.otherwise = function (handler) { + return _this.router.urlService.rules.otherwise(handler); + }; + /** @deprecated use [[UrlRules.removeRule]]*/ + this.removeRule = function (rule) { return _this.router.urlService.rules.removeRule(rule); }; + /** @deprecated use [[UrlRules.rule]]*/ + this.rule = function (rule) { return _this.router.urlService.rules.rule(rule); }; + /** @deprecated use [[UrlRules.rules]]*/ + this.rules = function () { return _this.router.urlService.rules.rules(); }; + /** @deprecated use [[UrlRules.sort]]*/ + this.sort = function (compareFn) { return _this.router.urlService.rules.sort(compareFn); }; + /** @deprecated use [[UrlRules.when]]*/ + this.when = function (matcher, handler, options) { return _this.router.urlService.rules.when(matcher, handler, options); }; + this.urlRuleFactory = new _urlRule__WEBPACK_IMPORTED_MODULE_1__.UrlRuleFactory(router); + } + /** Internal API. */ + UrlRouter.prototype.update = function (read) { + var $url = this.router.locationService; + if (read) { + this.location = $url.url(); + return; + } + if ($url.url() === this.location) + return; + $url.url(this.location, true); + }; + /** + * Internal API. + * + * Pushes a new location to the browser history. + * + * @internal + * @param urlMatcher + * @param params + * @param options + */ + UrlRouter.prototype.push = function (urlMatcher, params, options) { + var replace = options && !!options.replace; + this.router.urlService.url(urlMatcher.format(params || {}), replace); + }; + /** + * Builds and returns a URL with interpolated parameters + * + * #### Example: + * ```js + * matcher = $umf.compile("/about/:person"); + * params = { person: "bob" }; + * $bob = $urlRouter.href(matcher, params); + * // $bob == "/about/bob"; + * ``` + * + * @param urlMatcher The [[UrlMatcher]] object which is used as the template of the URL to generate. + * @param params An object of parameter values to fill the matcher's required parameters. + * @param options Options object. The options are: + * + * - **`absolute`** - {boolean=false}, If true will generate an absolute url, e.g. "http://www.example.com/fullurl". + * + * @returns Returns the fully compiled URL, or `null` if `params` fail validation against `urlMatcher` + */ + UrlRouter.prototype.href = function (urlMatcher, params, options) { + var url = urlMatcher.format(params); + if (url == null) + return null; + options = options || { absolute: false }; + var cfg = this.router.urlService.config; + var isHtml5 = cfg.html5Mode(); + if (!isHtml5 && url !== null) { + url = '#' + cfg.hashPrefix() + url; + } + url = appendBasePath(url, isHtml5, options.absolute, cfg.baseHref()); + if (!options.absolute || !url) { + return url; + } + var slash = !isHtml5 && url ? '/' : ''; + var cfgPort = cfg.port(); + var port = (cfgPort === 80 || cfgPort === 443 ? '' : ':' + cfgPort); + return [cfg.protocol(), '://', cfg.host(), port, slash, url].join(''); + }; + Object.defineProperty(UrlRouter.prototype, "interceptDeferred", { + /** @deprecated use [[UrlService.interceptDeferred]]*/ + get: function () { + return this.router.urlService.interceptDeferred; + }, + enumerable: false, + configurable: true + }); + return UrlRouter; +}()); + +//# sourceMappingURL=urlRouter.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/url/urlRule.js": +/*!************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/url/urlRule.js ***! + \************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "UrlRuleFactory": () => (/* binding */ UrlRuleFactory), +/* harmony export */ "BaseUrlRule": () => (/* binding */ BaseUrlRule) +/* harmony export */ }); +/* harmony import */ var _urlMatcher__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./urlMatcher */ "./node_modules/@uirouter/core/lib-esm/url/urlMatcher.js"); +/* harmony import */ var _common_predicates__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/predicates */ "./node_modules/@uirouter/core/lib-esm/common/predicates.js"); +/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../common/common */ "./node_modules/@uirouter/core/lib-esm/common/common.js"); +/* harmony import */ var _common_hof__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../common/hof */ "./node_modules/@uirouter/core/lib-esm/common/hof.js"); +/* harmony import */ var _state_stateObject__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../state/stateObject */ "./node_modules/@uirouter/core/lib-esm/state/stateObject.js"); + + + + + +/** + * Creates a [[UrlRule]] + * + * Creates a [[UrlRule]] from a: + * + * - `string` + * - [[UrlMatcher]] + * - `RegExp` + * - [[StateObject]] + */ +var UrlRuleFactory = /** @class */ (function () { + function UrlRuleFactory(router) { + this.router = router; + } + UrlRuleFactory.prototype.compile = function (str) { + return this.router.urlMatcherFactory.compile(str); + }; + UrlRuleFactory.prototype.create = function (what, handler) { + var _this = this; + var isState = _state_stateObject__WEBPACK_IMPORTED_MODULE_4__.StateObject.isState, isStateDeclaration = _state_stateObject__WEBPACK_IMPORTED_MODULE_4__.StateObject.isStateDeclaration; + var makeRule = (0,_common_hof__WEBPACK_IMPORTED_MODULE_3__.pattern)([ + [_common_predicates__WEBPACK_IMPORTED_MODULE_1__.isString, function (_what) { return makeRule(_this.compile(_what)); }], + [(0,_common_hof__WEBPACK_IMPORTED_MODULE_3__.is)(_urlMatcher__WEBPACK_IMPORTED_MODULE_0__.UrlMatcher), function (_what) { return _this.fromUrlMatcher(_what, handler); }], + [(0,_common_hof__WEBPACK_IMPORTED_MODULE_3__.or)(isState, isStateDeclaration), function (_what) { return _this.fromState(_what, _this.router); }], + [(0,_common_hof__WEBPACK_IMPORTED_MODULE_3__.is)(RegExp), function (_what) { return _this.fromRegExp(_what, handler); }], + [_common_predicates__WEBPACK_IMPORTED_MODULE_1__.isFunction, function (_what) { return new BaseUrlRule(_what, handler); }], + ]); + var rule = makeRule(what); + if (!rule) + throw new Error("invalid 'what' in when()"); + return rule; + }; + /** + * A UrlRule which matches based on a UrlMatcher + * + * The `handler` may be either a `string`, a [[UrlRuleHandlerFn]] or another [[UrlMatcher]] + * + * ## Handler as a function + * + * If `handler` is a function, the function is invoked with: + * + * - matched parameter values ([[RawParams]] from [[UrlMatcher.exec]]) + * - url: the current Url ([[UrlParts]]) + * - router: the router object ([[UIRouter]]) + * + * #### Example: + * ```js + * var urlMatcher = $umf.compile("/foo/:fooId/:barId"); + * var rule = factory.fromUrlMatcher(urlMatcher, match => "/home/" + match.fooId + "/" + match.barId); + * var match = rule.match('/foo/123/456'); // results in { fooId: '123', barId: '456' } + * var result = rule.handler(match); // '/home/123/456' + * ``` + * + * ## Handler as UrlMatcher + * + * If `handler` is a UrlMatcher, the handler matcher is used to create the new url. + * The `handler` UrlMatcher is formatted using the matched param from the first matcher. + * The url is replaced with the result. + * + * #### Example: + * ```js + * var urlMatcher = $umf.compile("/foo/:fooId/:barId"); + * var handler = $umf.compile("/home/:fooId/:barId"); + * var rule = factory.fromUrlMatcher(urlMatcher, handler); + * var match = rule.match('/foo/123/456'); // results in { fooId: '123', barId: '456' } + * var result = rule.handler(match); // '/home/123/456' + * ``` + */ + UrlRuleFactory.prototype.fromUrlMatcher = function (urlMatcher, handler) { + var _handler = handler; + if ((0,_common_predicates__WEBPACK_IMPORTED_MODULE_1__.isString)(handler)) + handler = this.router.urlMatcherFactory.compile(handler); + if ((0,_common_hof__WEBPACK_IMPORTED_MODULE_3__.is)(_urlMatcher__WEBPACK_IMPORTED_MODULE_0__.UrlMatcher)(handler)) + _handler = function (match) { return handler.format(match); }; + function matchUrlParamters(url) { + var params = urlMatcher.exec(url.path, url.search, url.hash); + return urlMatcher.validates(params) && params; + } + // Prioritize URLs, lowest to highest: + // - Some optional URL parameters, but none matched + // - No optional parameters in URL + // - Some optional parameters, some matched + // - Some optional parameters, all matched + function matchPriority(params) { + var optional = urlMatcher.parameters().filter(function (param) { return param.isOptional; }); + if (!optional.length) + return 0.000001; + var matched = optional.filter(function (param) { return params[param.id]; }); + return matched.length / optional.length; + } + var details = { urlMatcher: urlMatcher, matchPriority: matchPriority, type: 'URLMATCHER' }; + return (0,_common_common__WEBPACK_IMPORTED_MODULE_2__.extend)(new BaseUrlRule(matchUrlParamters, _handler), details); + }; + /** + * A UrlRule which matches a state by its url + * + * #### Example: + * ```js + * var rule = factory.fromState($state.get('foo'), router); + * var match = rule.match('/foo/123/456'); // results in { fooId: '123', barId: '456' } + * var result = rule.handler(match); + * // Starts a transition to 'foo' with params: { fooId: '123', barId: '456' } + * ``` + */ + UrlRuleFactory.prototype.fromState = function (stateOrDecl, router) { + var state = _state_stateObject__WEBPACK_IMPORTED_MODULE_4__.StateObject.isStateDeclaration(stateOrDecl) ? stateOrDecl.$$state() : stateOrDecl; + /** + * Handles match by transitioning to matched state + * + * First checks if the router should start a new transition. + * A new transition is not required if the current state's URL + * and the new URL are already identical + */ + var handler = function (match) { + var $state = router.stateService; + var globals = router.globals; + if ($state.href(state, match) !== $state.href(globals.current, globals.params)) { + $state.transitionTo(state, match, { inherit: true, source: 'url' }); + } + }; + var details = { state: state, type: 'STATE' }; + return (0,_common_common__WEBPACK_IMPORTED_MODULE_2__.extend)(this.fromUrlMatcher(state.url, handler), details); + }; + /** + * A UrlRule which matches based on a regular expression + * + * The `handler` may be either a [[UrlRuleHandlerFn]] or a string. + * + * ## Handler as a function + * + * If `handler` is a function, the function is invoked with: + * + * - regexp match array (from `regexp`) + * - url: the current Url ([[UrlParts]]) + * - router: the router object ([[UIRouter]]) + * + * #### Example: + * ```js + * var rule = factory.fromRegExp(/^\/foo\/(bar|baz)$/, match => "/home/" + match[1]) + * var match = rule.match('/foo/bar'); // results in [ '/foo/bar', 'bar' ] + * var result = rule.handler(match); // '/home/bar' + * ``` + * + * ## Handler as string + * + * If `handler` is a string, the url is *replaced by the string* when the Rule is invoked. + * The string is first interpolated using `string.replace()` style pattern. + * + * #### Example: + * ```js + * var rule = factory.fromRegExp(/^\/foo\/(bar|baz)$/, "/home/$1") + * var match = rule.match('/foo/bar'); // results in [ '/foo/bar', 'bar' ] + * var result = rule.handler(match); // '/home/bar' + * ``` + */ + UrlRuleFactory.prototype.fromRegExp = function (regexp, handler) { + if (regexp.global || regexp.sticky) + throw new Error('Rule RegExp must not be global or sticky'); + /** + * If handler is a string, the url will be replaced by the string. + * If the string has any String.replace() style variables in it (like `$2`), + * they will be replaced by the captures from [[match]] + */ + var redirectUrlTo = function (match) { + // Interpolates matched values into $1 $2, etc using a String.replace()-style pattern + return handler.replace(/\$(\$|\d{1,2})/, function (m, what) { return match[what === '$' ? 0 : Number(what)]; }); + }; + var _handler = (0,_common_predicates__WEBPACK_IMPORTED_MODULE_1__.isString)(handler) ? redirectUrlTo : handler; + var matchParamsFromRegexp = function (url) { return regexp.exec(url.path); }; + var details = { regexp: regexp, type: 'REGEXP' }; + return (0,_common_common__WEBPACK_IMPORTED_MODULE_2__.extend)(new BaseUrlRule(matchParamsFromRegexp, _handler), details); + }; + UrlRuleFactory.isUrlRule = function (obj) { return obj && ['type', 'match', 'handler'].every(function (key) { return (0,_common_predicates__WEBPACK_IMPORTED_MODULE_1__.isDefined)(obj[key]); }); }; + return UrlRuleFactory; +}()); + +/** + * A base rule which calls `match` + * + * The value from the `match` function is passed through to the `handler`. + * @internal + */ +var BaseUrlRule = /** @class */ (function () { + function BaseUrlRule(match, handler) { + var _this = this; + this.match = match; + this.type = 'RAW'; + this.matchPriority = function (match) { return 0 - _this.$id; }; + this.handler = handler || _common_common__WEBPACK_IMPORTED_MODULE_2__.identity; + } + return BaseUrlRule; +}()); + +//# sourceMappingURL=urlRule.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/url/urlRules.js": +/*!*************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/url/urlRules.js ***! + \*************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "UrlRules": () => (/* binding */ UrlRules) +/* harmony export */ }); +/* harmony import */ var _state__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../state */ "./node_modules/@uirouter/core/lib-esm/state/index.js"); +/* harmony import */ var _urlMatcher__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./urlMatcher */ "./node_modules/@uirouter/core/lib-esm/url/urlMatcher.js"); +/* harmony import */ var _common__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../common */ "./node_modules/@uirouter/core/lib-esm/common/index.js"); +/* harmony import */ var _urlRule__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./urlRule */ "./node_modules/@uirouter/core/lib-esm/url/urlRule.js"); + + + + +var prioritySort = function (a, b) { return (b.priority || 0) - (a.priority || 0); }; +var typeSort = function (a, b) { + var weights = { STATE: 4, URLMATCHER: 4, REGEXP: 3, RAW: 2, OTHER: 1 }; + return (weights[a.type] || 0) - (weights[b.type] || 0); +}; +var urlMatcherSort = function (a, b) { + return !a.urlMatcher || !b.urlMatcher ? 0 : _urlMatcher__WEBPACK_IMPORTED_MODULE_1__.UrlMatcher.compare(a.urlMatcher, b.urlMatcher); +}; +var idSort = function (a, b) { + // Identically sorted STATE and URLMATCHER best rule will be chosen by `matchPriority` after each rule matches the URL + var useMatchPriority = { STATE: true, URLMATCHER: true }; + var equal = useMatchPriority[a.type] && useMatchPriority[b.type]; + return equal ? 0 : (a.$id || 0) - (b.$id || 0); +}; +/** + * Default rule priority sorting function. + * + * Sorts rules by: + * + * - Explicit priority (set rule priority using [[UrlRules.when]]) + * - Rule type (STATE: 4, URLMATCHER: 4, REGEXP: 3, RAW: 2, OTHER: 1) + * - `UrlMatcher` specificity ([[UrlMatcher.compare]]): works for STATE and URLMATCHER types to pick the most specific rule. + * - Rule registration order (for rule types other than STATE and URLMATCHER) + * - Equally sorted State and UrlMatcher rules will each match the URL. + * Then, the *best* match is chosen based on how many parameter values were matched. + */ +var defaultRuleSortFn; +defaultRuleSortFn = function (a, b) { + var cmp = prioritySort(a, b); + if (cmp !== 0) + return cmp; + cmp = typeSort(a, b); + if (cmp !== 0) + return cmp; + cmp = urlMatcherSort(a, b); + if (cmp !== 0) + return cmp; + return idSort(a, b); +}; +function getHandlerFn(handler) { + if (!(0,_common__WEBPACK_IMPORTED_MODULE_2__.isFunction)(handler) && !(0,_common__WEBPACK_IMPORTED_MODULE_2__.isString)(handler) && !(0,_common__WEBPACK_IMPORTED_MODULE_2__.is)(_state__WEBPACK_IMPORTED_MODULE_0__.TargetState)(handler) && !_state__WEBPACK_IMPORTED_MODULE_0__.TargetState.isDef(handler)) { + throw new Error("'handler' must be a string, function, TargetState, or have a state: 'newtarget' property"); + } + return (0,_common__WEBPACK_IMPORTED_MODULE_2__.isFunction)(handler) ? handler : (0,_common__WEBPACK_IMPORTED_MODULE_2__.val)(handler); +} +/** + * API for managing URL rules + * + * This API is used to create and manage URL rules. + * URL rules are a mechanism to respond to specific URL patterns. + * + * The most commonly used methods are [[otherwise]] and [[when]]. + * + * This API is found at `router.urlService.rules` (see: [[UIRouter.urlService]], [[URLService.rules]]) + */ +var UrlRules = /** @class */ (function () { + /** @internal */ + function UrlRules(/** @internal */ router) { + this.router = router; + /** @internal */ this._sortFn = defaultRuleSortFn; + /** @internal */ this._rules = []; + /** @internal */ this._id = 0; + this.urlRuleFactory = new _urlRule__WEBPACK_IMPORTED_MODULE_3__.UrlRuleFactory(router); + } + /** @internal */ + UrlRules.prototype.dispose = function (router) { + this._rules = []; + delete this._otherwiseFn; + }; + /** + * Defines the initial state, path, or behavior to use when the app starts. + * + * This rule defines the initial/starting state for the application. + * + * This rule is triggered the first time the URL is checked (when the app initially loads). + * The rule is triggered only when the url matches either `""` or `"/"`. + * + * Note: The rule is intended to be used when the root of the application is directly linked to. + * When the URL is *not* `""` or `"/"` and doesn't match other rules, the [[otherwise]] rule is triggered. + * This allows 404-like behavior when an unknown URL is deep-linked. + * + * #### Example: + * Start app at `home` state. + * ```js + * .initial({ state: 'home' }); + * ``` + * + * #### Example: + * Start app at `/home` (by url) + * ```js + * .initial('/home'); + * ``` + * + * #### Example: + * When no other url rule matches, go to `home` state + * ```js + * .initial((matchValue, url, router) => { + * console.log('initial state'); + * return { state: 'home' }; + * }) + * ``` + * + * @param handler The initial state or url path, or a function which returns the state or url path (or performs custom logic). + */ + UrlRules.prototype.initial = function (handler) { + var handlerFn = getHandlerFn(handler); + var matchFn = function (urlParts, router) { + return router.globals.transitionHistory.size() === 0 && !!/^\/?$/.exec(urlParts.path); + }; + this.rule(this.urlRuleFactory.create(matchFn, handlerFn)); + }; + /** + * Defines the state, url, or behavior to use when no other rule matches the URL. + * + * This rule is matched when *no other rule* matches. + * It is generally used to handle unknown URLs (similar to "404" behavior, but on the client side). + * + * - If `handler` a string, it is treated as a url redirect + * + * #### Example: + * When no other url rule matches, redirect to `/index` + * ```js + * .otherwise('/index'); + * ``` + * + * - If `handler` is an object with a `state` property, the state is activated. + * + * #### Example: + * When no other url rule matches, redirect to `home` and provide a `dashboard` parameter value. + * ```js + * .otherwise({ state: 'home', params: { dashboard: 'default' } }); + * ``` + * + * - If `handler` is a function, the function receives the current url ([[UrlParts]]) and the [[UIRouter]] object. + * The function can perform actions, and/or return a value. + * + * #### Example: + * When no other url rule matches, manually trigger a transition to the `home` state + * ```js + * .otherwise((matchValue, urlParts, router) => { + * router.stateService.go('home'); + * }); + * ``` + * + * #### Example: + * When no other url rule matches, go to `home` state + * ```js + * .otherwise((matchValue, urlParts, router) => { + * return { state: 'home' }; + * }); + * ``` + * + * @param handler The url path to redirect to, or a function which returns the url path (or performs custom logic). + */ + UrlRules.prototype.otherwise = function (handler) { + var handlerFn = getHandlerFn(handler); + this._otherwiseFn = this.urlRuleFactory.create((0,_common__WEBPACK_IMPORTED_MODULE_2__.val)(true), handlerFn); + this._sorted = false; + }; + /** + * Remove a rule previously registered + * + * @param rule the matcher rule that was previously registered using [[rule]] + */ + UrlRules.prototype.removeRule = function (rule) { + (0,_common__WEBPACK_IMPORTED_MODULE_2__.removeFrom)(this._rules, rule); + }; + /** + * Manually adds a URL Rule. + * + * Usually, a url rule is added using [[StateDeclaration.url]] or [[when]]. + * This api can be used directly for more control (to register a [[BaseUrlRule]], for example). + * Rules can be created using [[urlRuleFactory]], or created manually as simple objects. + * + * A rule should have a `match` function which returns truthy if the rule matched. + * It should also have a `handler` function which is invoked if the rule is the best match. + * + * @return a function that deregisters the rule + */ + UrlRules.prototype.rule = function (rule) { + var _this = this; + if (!_urlRule__WEBPACK_IMPORTED_MODULE_3__.UrlRuleFactory.isUrlRule(rule)) + throw new Error('invalid rule'); + rule.$id = this._id++; + rule.priority = rule.priority || 0; + this._rules.push(rule); + this._sorted = false; + return function () { return _this.removeRule(rule); }; + }; + /** + * Gets all registered rules + * + * @returns an array of all the registered rules + */ + UrlRules.prototype.rules = function () { + this.ensureSorted(); + return this._rules.concat(this._otherwiseFn ? [this._otherwiseFn] : []); + }; + /** + * Defines URL Rule priorities + * + * More than one rule ([[UrlRule]]) might match a given URL. + * This `compareFn` is used to sort the rules by priority. + * Higher priority rules should sort earlier. + * + * The [[defaultRuleSortFn]] is used by default. + * + * You only need to call this function once. + * The `compareFn` will be used to sort the rules as each is registered. + * + * If called without any parameter, it will re-sort the rules. + * + * --- + * + * Url rules may come from multiple sources: states's urls ([[StateDeclaration.url]]), [[when]], and [[rule]]. + * Each rule has a (user-provided) [[UrlRule.priority]], a [[UrlRule.type]], and a [[UrlRule.$id]] + * The `$id` is is the order in which the rule was registered. + * + * The sort function should use these data, or data found on a specific type + * of [[UrlRule]] (such as [[StateRule.state]]), to order the rules as desired. + * + * #### Example: + * This compare function prioritizes rules by the order in which the rules were registered. + * A rule registered earlier has higher priority. + * + * ```js + * function compareFn(a, b) { + * return a.$id - b.$id; + * } + * ``` + * + * @param compareFn a function that compares to [[UrlRule]] objects. + * The `compareFn` should abide by the `Array.sort` compare function rules. + * Given two rules, `a` and `b`, return a negative number if `a` should be higher priority. + * Return a positive number if `b` should be higher priority. + * Return `0` if the rules are identical. + * + * See the [mozilla reference](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#Description) + * for details. + */ + UrlRules.prototype.sort = function (compareFn) { + var sorted = this.stableSort(this._rules, (this._sortFn = compareFn || this._sortFn)); + // precompute _sortGroup values and apply to each rule + var group = 0; + for (var i = 0; i < sorted.length; i++) { + sorted[i]._group = group; + if (i < sorted.length - 1 && this._sortFn(sorted[i], sorted[i + 1]) !== 0) { + group++; + } + } + this._rules = sorted; + this._sorted = true; + }; + /** @internal */ + UrlRules.prototype.ensureSorted = function () { + this._sorted || this.sort(); + }; + /** @internal */ + UrlRules.prototype.stableSort = function (arr, compareFn) { + var arrOfWrapper = arr.map(function (elem, idx) { return ({ elem: elem, idx: idx }); }); + arrOfWrapper.sort(function (wrapperA, wrapperB) { + var cmpDiff = compareFn(wrapperA.elem, wrapperB.elem); + return cmpDiff === 0 ? wrapperA.idx - wrapperB.idx : cmpDiff; + }); + return arrOfWrapper.map(function (wrapper) { return wrapper.elem; }); + }; + /** + * Registers a `matcher` and `handler` for custom URLs handling. + * + * The `matcher` can be: + * + * - a [[UrlMatcher]]: See: [[UrlMatcherFactory.compile]] + * - a `string`: The string is compiled to a [[UrlMatcher]] + * - a `RegExp`: The regexp is used to match the url. + * + * The `handler` can be: + * + * - a string: The url is redirected to the value of the string. + * - a function: The url is redirected to the return value of the function. + * + * --- + * + * When the `handler` is a `string` and the `matcher` is a `UrlMatcher` (or string), the redirect + * string is interpolated with parameter values. + * + * #### Example: + * When the URL is `/foo/123` the rule will redirect to `/bar/123`. + * ```js + * .when("/foo/:param1", "/bar/:param1") + * ``` + * + * --- + * + * When the `handler` is a string and the `matcher` is a `RegExp`, the redirect string is + * interpolated with capture groups from the RegExp. + * + * #### Example: + * When the URL is `/foo/123` the rule will redirect to `/bar/123`. + * ```js + * .when(new RegExp("^/foo/(.*)$"), "/bar/$1"); + * ``` + * + * --- + * + * When the handler is a function, it receives the matched value, the current URL, and the `UIRouter` object (See [[UrlRuleHandlerFn]]). + * The "matched value" differs based on the `matcher`. + * For [[UrlMatcher]]s, it will be the matched state params. + * For `RegExp`, it will be the match array from `regexp.exec()`. + * + * If the handler returns a string, the URL is redirected to the string. + * + * #### Example: + * When the URL is `/foo/123` the rule will redirect to `/bar/123`. + * ```js + * .when(new RegExp("^/foo/(.*)$"), match => "/bar/" + match[1]); + * ``` + * + * Note: the `handler` may also invoke arbitrary code, such as `$state.go()` + * + * @param matcher A pattern `string` to match, compiled as a [[UrlMatcher]], or a `RegExp`. + * @param handler The path to redirect to, or a function that returns the path. + * @param options `{ priority: number }` + * + * @return the registered [[UrlRule]] + */ + UrlRules.prototype.when = function (matcher, handler, options) { + var rule = this.urlRuleFactory.create(matcher, handler); + if ((0,_common__WEBPACK_IMPORTED_MODULE_2__.isDefined)(options && options.priority)) + rule.priority = options.priority; + this.rule(rule); + return rule; + }; + return UrlRules; +}()); + +//# sourceMappingURL=urlRules.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/url/urlService.js": +/*!***************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/url/urlService.js ***! + \***************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "UrlService": () => (/* binding */ UrlService) +/* harmony export */ }); +/* harmony import */ var _common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common */ "./node_modules/@uirouter/core/lib-esm/common/index.js"); +/* harmony import */ var _urlRules__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./urlRules */ "./node_modules/@uirouter/core/lib-esm/url/urlRules.js"); +/* harmony import */ var _urlConfig__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./urlConfig */ "./node_modules/@uirouter/core/lib-esm/url/urlConfig.js"); +/* harmony import */ var _state__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../state */ "./node_modules/@uirouter/core/lib-esm/state/index.js"); + + + + +/** + * API for URL management + */ +var UrlService = /** @class */ (function () { + /** @internal */ + function UrlService(/** @internal */ router) { + var _this = this; + this.router = router; + /** @internal */ this.interceptDeferred = false; + /** + * The nested [[UrlRules]] API for managing URL rules and rewrites + * + * See: [[UrlRules]] for details + */ + this.rules = new _urlRules__WEBPACK_IMPORTED_MODULE_1__.UrlRules(this.router); + /** + * The nested [[UrlConfig]] API to configure the URL and retrieve URL information + * + * See: [[UrlConfig]] for details + */ + this.config = new _urlConfig__WEBPACK_IMPORTED_MODULE_2__.UrlConfig(this.router); + // Delegate these calls to the current LocationServices implementation + /** + * Gets the current url, or updates the url + * + * ### Getting the current URL + * + * When no arguments are passed, returns the current URL. + * The URL is normalized using the internal [[path]]/[[search]]/[[hash]] values. + * + * For example, the URL may be stored in the hash ([[HashLocationServices]]) or + * have a base HREF prepended ([[PushStateLocationServices]]). + * + * The raw URL in the browser might be: + * + * ``` + * http://mysite.com/somepath/index.html#/internal/path/123?param1=foo#anchor + * ``` + * + * or + * + * ``` + * http://mysite.com/basepath/internal/path/123?param1=foo#anchor + * ``` + * + * then this method returns: + * + * ``` + * /internal/path/123?param1=foo#anchor + * ``` + * + * + * #### Example: + * ```js + * locationServices.url(); // "/some/path?query=value#anchor" + * ``` + * + * ### Updating the URL + * + * When `newurl` arguments is provided, changes the URL to reflect `newurl` + * + * #### Example: + * ```js + * locationServices.url("/some/path?query=value#anchor", true); + * ``` + * + * @param newurl The new value for the URL. + * This url should reflect only the new internal [[path]], [[search]], and [[hash]] values. + * It should not include the protocol, site, port, or base path of an absolute HREF. + * @param replace When true, replaces the current history entry (instead of appending it) with this new url + * @param state The history's state object, i.e., pushState (if the LocationServices implementation supports it) + * + * @return the url (after potentially being processed) + */ + this.url = function (newurl, replace, state) { + return _this.router.locationService.url(newurl, replace, state); + }; + /** + * Gets the path part of the current url + * + * If the current URL is `/some/path?query=value#anchor`, this returns `/some/path` + * + * @return the path portion of the url + */ + this.path = function () { return _this.router.locationService.path(); }; + /** + * Gets the search part of the current url as an object + * + * If the current URL is `/some/path?query=value#anchor`, this returns `{ query: 'value' }` + * + * @return the search (query) portion of the url, as an object + */ + this.search = function () { return _this.router.locationService.search(); }; + /** + * Gets the hash part of the current url + * + * If the current URL is `/some/path?query=value#anchor`, this returns `anchor` + * + * @return the hash (anchor) portion of the url + */ + this.hash = function () { return _this.router.locationService.hash(); }; + /** + * @internal + * + * Registers a low level url change handler + * + * Note: Because this is a low level handler, it's not recommended for general use. + * + * #### Example: + * ```js + * let deregisterFn = locationServices.onChange((evt) => console.log("url change", evt)); + * ``` + * + * @param callback a function that will be called when the url is changing + * @return a function that de-registers the callback + */ + this.onChange = function (callback) { return _this.router.locationService.onChange(callback); }; + } + /** @internal */ + UrlService.prototype.dispose = function () { + this.listen(false); + this.rules.dispose(); + }; + /** + * Gets the current URL parts + * + * This method returns the different parts of the current URL (the [[path]], [[search]], and [[hash]]) as a [[UrlParts]] object. + */ + UrlService.prototype.parts = function () { + return { path: this.path(), search: this.search(), hash: this.hash() }; + }; + /** + * Activates the best rule for the current URL + * + * Checks the current URL for a matching [[UrlRule]], then invokes that rule's handler. + * This method is called internally any time the URL has changed. + * + * This effectively activates the state (or redirect, etc) which matches the current URL. + * + * #### Example: + * ```js + * urlService.deferIntercept(); + * + * fetch('/states.json').then(resp => resp.json()).then(data => { + * data.forEach(state => $stateRegistry.register(state)); + * urlService.listen(); + * // Find the matching URL and invoke the handler. + * urlService.sync(); + * }); + * ``` + */ + UrlService.prototype.sync = function (evt) { + if (evt && evt.defaultPrevented) + return; + var _a = this.router, urlService = _a.urlService, stateService = _a.stateService; + var url = { path: urlService.path(), search: urlService.search(), hash: urlService.hash() }; + var best = this.match(url); + var applyResult = (0,_common__WEBPACK_IMPORTED_MODULE_0__.pattern)([ + [_common__WEBPACK_IMPORTED_MODULE_0__.isString, function (newurl) { return urlService.url(newurl, true); }], + [_state__WEBPACK_IMPORTED_MODULE_3__.TargetState.isDef, function (def) { return stateService.go(def.state, def.params, def.options); }], + [(0,_common__WEBPACK_IMPORTED_MODULE_0__.is)(_state__WEBPACK_IMPORTED_MODULE_3__.TargetState), function (target) { return stateService.go(target.state(), target.params(), target.options()); }], + ]); + applyResult(best && best.rule.handler(best.match, url, this.router)); + }; + /** + * Starts or stops listening for URL changes + * + * Call this sometime after calling [[deferIntercept]] to start monitoring the url. + * This causes UI-Router to start listening for changes to the URL, if it wasn't already listening. + * + * If called with `false`, UI-Router will stop listening (call listen(true) to start listening again). + * + * #### Example: + * ```js + * urlService.deferIntercept(); + * + * fetch('/states.json').then(resp => resp.json()).then(data => { + * data.forEach(state => $stateRegistry.register(state)); + * // Start responding to URL changes + * urlService.listen(); + * urlService.sync(); + * }); + * ``` + * + * @param enabled `true` or `false` to start or stop listening to URL changes + */ + UrlService.prototype.listen = function (enabled) { + var _this = this; + if (enabled === false) { + this._stopListeningFn && this._stopListeningFn(); + delete this._stopListeningFn; + } + else { + return (this._stopListeningFn = + this._stopListeningFn || this.router.urlService.onChange(function (evt) { return _this.sync(evt); })); + } + }; + /** + * Disables monitoring of the URL. + * + * Call this method before UI-Router has bootstrapped. + * It will stop UI-Router from performing the initial url sync. + * + * This can be useful to perform some asynchronous initialization before the router starts. + * Once the initialization is complete, call [[listen]] to tell UI-Router to start watching and synchronizing the URL. + * + * #### Example: + * ```js + * // Prevent UI-Router from automatically intercepting URL changes when it starts; + * urlService.deferIntercept(); + * + * fetch('/states.json').then(resp => resp.json()).then(data => { + * data.forEach(state => $stateRegistry.register(state)); + * urlService.listen(); + * urlService.sync(); + * }); + * ``` + * + * @param defer Indicates whether to defer location change interception. + * Passing no parameter is equivalent to `true`. + */ + UrlService.prototype.deferIntercept = function (defer) { + if (defer === undefined) + defer = true; + this.interceptDeferred = defer; + }; + /** + * Matches a URL + * + * Given a URL (as a [[UrlParts]] object), check all rules and determine the best matching rule. + * Return the result as a [[MatchResult]]. + */ + UrlService.prototype.match = function (url) { + var _this = this; + url = (0,_common__WEBPACK_IMPORTED_MODULE_0__.extend)({ path: '', search: {}, hash: '' }, url); + var rules = this.rules.rules(); + // Checks a single rule. Returns { rule: rule, match: match, weight: weight } if it matched, or undefined + var checkRule = function (rule) { + var match = rule.match(url, _this.router); + return match && { match: match, rule: rule, weight: rule.matchPriority(match) }; + }; + // The rules are pre-sorted. + // - Find the first matching rule. + // - Find any other matching rule that sorted *exactly the same*, according to `.sort()`. + // - Choose the rule with the highest match weight. + var best; + for (var i = 0; i < rules.length; i++) { + // Stop when there is a 'best' rule and the next rule sorts differently than it. + if (best && best.rule._group !== rules[i]._group) + break; + var current = checkRule(rules[i]); + // Pick the best MatchResult + best = !best || (current && current.weight > best.weight) ? current : best; + } + return best; + }; + return UrlService; +}()); + +//# sourceMappingURL=urlService.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/vanilla.js": +/*!********************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/vanilla.js ***! + \********************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony import */ var _vanilla_index__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./vanilla/index */ "./node_modules/@uirouter/core/lib-esm/vanilla/index.js"); +/* harmony reexport (unknown) */ var __WEBPACK_REEXPORT_OBJECT__ = {}; +/* harmony reexport (unknown) */ for(const __WEBPACK_IMPORT_KEY__ in _vanilla_index__WEBPACK_IMPORTED_MODULE_0__) if(__WEBPACK_IMPORT_KEY__ !== "default") __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = () => _vanilla_index__WEBPACK_IMPORTED_MODULE_0__[__WEBPACK_IMPORT_KEY__] +/* harmony reexport (unknown) */ __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__); + +//# sourceMappingURL=vanilla.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/vanilla/baseLocationService.js": +/*!****************************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/vanilla/baseLocationService.js ***! + \****************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "BaseLocationServices": () => (/* binding */ BaseLocationServices) +/* harmony export */ }); +/* harmony import */ var _common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common */ "./node_modules/@uirouter/core/lib-esm/common/index.js"); +/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./utils */ "./node_modules/@uirouter/core/lib-esm/vanilla/utils.js"); + + +/** A base `LocationServices` */ +var BaseLocationServices = /** @class */ (function () { + function BaseLocationServices(router, fireAfterUpdate) { + var _this = this; + this.fireAfterUpdate = fireAfterUpdate; + this._listeners = []; + this._listener = function (evt) { return _this._listeners.forEach(function (cb) { return cb(evt); }); }; + this.hash = function () { return (0,_utils__WEBPACK_IMPORTED_MODULE_1__.parseUrl)(_this._get()).hash; }; + this.path = function () { return (0,_utils__WEBPACK_IMPORTED_MODULE_1__.parseUrl)(_this._get()).path; }; + this.search = function () { return (0,_utils__WEBPACK_IMPORTED_MODULE_1__.getParams)((0,_utils__WEBPACK_IMPORTED_MODULE_1__.parseUrl)(_this._get()).search); }; + this._location = _common__WEBPACK_IMPORTED_MODULE_0__.root.location; + this._history = _common__WEBPACK_IMPORTED_MODULE_0__.root.history; + } + BaseLocationServices.prototype.url = function (url, replace) { + if (replace === void 0) { replace = true; } + if ((0,_common__WEBPACK_IMPORTED_MODULE_0__.isDefined)(url) && url !== this._get()) { + this._set(null, null, url, replace); + if (this.fireAfterUpdate) { + this._listeners.forEach(function (cb) { return cb({ url: url }); }); + } + } + return (0,_utils__WEBPACK_IMPORTED_MODULE_1__.buildUrl)(this); + }; + BaseLocationServices.prototype.onChange = function (cb) { + var _this = this; + this._listeners.push(cb); + return function () { return (0,_common__WEBPACK_IMPORTED_MODULE_0__.removeFrom)(_this._listeners, cb); }; + }; + BaseLocationServices.prototype.dispose = function (router) { + (0,_common__WEBPACK_IMPORTED_MODULE_0__.deregAll)(this._listeners); + }; + return BaseLocationServices; +}()); + +//# sourceMappingURL=baseLocationService.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/vanilla/browserLocationConfig.js": +/*!******************************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/vanilla/browserLocationConfig.js ***! + \******************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "BrowserLocationConfig": () => (/* binding */ BrowserLocationConfig) +/* harmony export */ }); +/* harmony import */ var _common_predicates__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/predicates */ "./node_modules/@uirouter/core/lib-esm/common/predicates.js"); + +/** A `LocationConfig` that delegates to the browser's `location` object */ +var BrowserLocationConfig = /** @class */ (function () { + function BrowserLocationConfig(router, _isHtml5) { + if (_isHtml5 === void 0) { _isHtml5 = false; } + this._isHtml5 = _isHtml5; + this._baseHref = undefined; + this._hashPrefix = ''; + } + BrowserLocationConfig.prototype.port = function () { + if (location.port) { + return Number(location.port); + } + return this.protocol() === 'https' ? 443 : 80; + }; + BrowserLocationConfig.prototype.protocol = function () { + return location.protocol.replace(/:/g, ''); + }; + BrowserLocationConfig.prototype.host = function () { + return location.hostname; + }; + BrowserLocationConfig.prototype.html5Mode = function () { + return this._isHtml5; + }; + BrowserLocationConfig.prototype.hashPrefix = function (newprefix) { + return (0,_common_predicates__WEBPACK_IMPORTED_MODULE_0__.isDefined)(newprefix) ? (this._hashPrefix = newprefix) : this._hashPrefix; + }; + BrowserLocationConfig.prototype.baseHref = function (href) { + if ((0,_common_predicates__WEBPACK_IMPORTED_MODULE_0__.isDefined)(href)) + this._baseHref = href; + if ((0,_common_predicates__WEBPACK_IMPORTED_MODULE_0__.isUndefined)(this._baseHref)) + this._baseHref = this.getBaseHref(); + return this._baseHref; + }; + BrowserLocationConfig.prototype.getBaseHref = function () { + var baseTag = document.getElementsByTagName('base')[0]; + if (baseTag && baseTag.href) { + return baseTag.href.replace(/^([^/:]*:)?\/\/[^/]*/, ''); + } + return this._isHtml5 ? '/' : location.pathname || '/'; + }; + BrowserLocationConfig.prototype.dispose = function () { }; + return BrowserLocationConfig; +}()); + +//# sourceMappingURL=browserLocationConfig.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/vanilla/hashLocationService.js": +/*!****************************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/vanilla/hashLocationService.js ***! + \****************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "HashLocationService": () => (/* binding */ HashLocationService) +/* harmony export */ }); +/* harmony import */ var _common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common */ "./node_modules/@uirouter/core/lib-esm/common/index.js"); +/* harmony import */ var _baseLocationService__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./baseLocationService */ "./node_modules/@uirouter/core/lib-esm/vanilla/baseLocationService.js"); +var __extends = (undefined && undefined.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); + + +/** A `LocationServices` that uses the browser hash "#" to get/set the current location */ +var HashLocationService = /** @class */ (function (_super) { + __extends(HashLocationService, _super); + function HashLocationService(router) { + var _this = _super.call(this, router, false) || this; + _common__WEBPACK_IMPORTED_MODULE_0__.root.addEventListener('hashchange', _this._listener, false); + return _this; + } + HashLocationService.prototype._get = function () { + return (0,_common__WEBPACK_IMPORTED_MODULE_0__.trimHashVal)(this._location.hash); + }; + HashLocationService.prototype._set = function (state, title, url, replace) { + this._location.hash = url; + }; + HashLocationService.prototype.dispose = function (router) { + _super.prototype.dispose.call(this, router); + _common__WEBPACK_IMPORTED_MODULE_0__.root.removeEventListener('hashchange', this._listener); + }; + return HashLocationService; +}(_baseLocationService__WEBPACK_IMPORTED_MODULE_1__.BaseLocationServices)); + +//# sourceMappingURL=hashLocationService.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/vanilla/index.js": +/*!**************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/vanilla/index.js ***! + \**************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "$q": () => (/* reexport safe */ _q__WEBPACK_IMPORTED_MODULE_1__.$q), +/* harmony export */ "$injector": () => (/* reexport safe */ _injector__WEBPACK_IMPORTED_MODULE_2__.$injector), +/* harmony export */ "BaseLocationServices": () => (/* reexport safe */ _baseLocationService__WEBPACK_IMPORTED_MODULE_3__.BaseLocationServices), +/* harmony export */ "HashLocationService": () => (/* reexport safe */ _hashLocationService__WEBPACK_IMPORTED_MODULE_4__.HashLocationService), +/* harmony export */ "MemoryLocationService": () => (/* reexport safe */ _memoryLocationService__WEBPACK_IMPORTED_MODULE_5__.MemoryLocationService), +/* harmony export */ "PushStateLocationService": () => (/* reexport safe */ _pushStateLocationService__WEBPACK_IMPORTED_MODULE_6__.PushStateLocationService), +/* harmony export */ "MemoryLocationConfig": () => (/* reexport safe */ _memoryLocationConfig__WEBPACK_IMPORTED_MODULE_7__.MemoryLocationConfig), +/* harmony export */ "BrowserLocationConfig": () => (/* reexport safe */ _browserLocationConfig__WEBPACK_IMPORTED_MODULE_8__.BrowserLocationConfig), +/* harmony export */ "buildUrl": () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_9__.buildUrl), +/* harmony export */ "getParams": () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_9__.getParams), +/* harmony export */ "keyValsToObjectR": () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_9__.keyValsToObjectR), +/* harmony export */ "locationPluginFactory": () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_9__.locationPluginFactory), +/* harmony export */ "parseUrl": () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_9__.parseUrl), +/* harmony export */ "hashLocationPlugin": () => (/* reexport safe */ _plugins__WEBPACK_IMPORTED_MODULE_10__.hashLocationPlugin), +/* harmony export */ "memoryLocationPlugin": () => (/* reexport safe */ _plugins__WEBPACK_IMPORTED_MODULE_10__.memoryLocationPlugin), +/* harmony export */ "pushStateLocationPlugin": () => (/* reexport safe */ _plugins__WEBPACK_IMPORTED_MODULE_10__.pushStateLocationPlugin), +/* harmony export */ "servicesPlugin": () => (/* reexport safe */ _plugins__WEBPACK_IMPORTED_MODULE_10__.servicesPlugin) +/* harmony export */ }); +/* harmony import */ var _interface__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./interface */ "./node_modules/@uirouter/core/lib-esm/vanilla/interface.js"); +/* harmony import */ var _interface__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_interface__WEBPACK_IMPORTED_MODULE_0__); +/* harmony reexport (unknown) */ var __WEBPACK_REEXPORT_OBJECT__ = {}; +/* harmony reexport (unknown) */ for(const __WEBPACK_IMPORT_KEY__ in _interface__WEBPACK_IMPORTED_MODULE_0__) if(__WEBPACK_IMPORT_KEY__ !== "default") __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = () => _interface__WEBPACK_IMPORTED_MODULE_0__[__WEBPACK_IMPORT_KEY__] +/* harmony reexport (unknown) */ __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__); +/* harmony import */ var _q__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./q */ "./node_modules/@uirouter/core/lib-esm/vanilla/q.js"); +/* harmony import */ var _injector__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./injector */ "./node_modules/@uirouter/core/lib-esm/vanilla/injector.js"); +/* harmony import */ var _baseLocationService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./baseLocationService */ "./node_modules/@uirouter/core/lib-esm/vanilla/baseLocationService.js"); +/* harmony import */ var _hashLocationService__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./hashLocationService */ "./node_modules/@uirouter/core/lib-esm/vanilla/hashLocationService.js"); +/* harmony import */ var _memoryLocationService__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./memoryLocationService */ "./node_modules/@uirouter/core/lib-esm/vanilla/memoryLocationService.js"); +/* harmony import */ var _pushStateLocationService__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./pushStateLocationService */ "./node_modules/@uirouter/core/lib-esm/vanilla/pushStateLocationService.js"); +/* harmony import */ var _memoryLocationConfig__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./memoryLocationConfig */ "./node_modules/@uirouter/core/lib-esm/vanilla/memoryLocationConfig.js"); +/* harmony import */ var _browserLocationConfig__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./browserLocationConfig */ "./node_modules/@uirouter/core/lib-esm/vanilla/browserLocationConfig.js"); +/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./utils */ "./node_modules/@uirouter/core/lib-esm/vanilla/utils.js"); +/* harmony import */ var _plugins__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./plugins */ "./node_modules/@uirouter/core/lib-esm/vanilla/plugins.js"); +/** + * Naive, pure JS implementation of core ui-router services + * + * @packageDocumentation + */ + + + + + + + + + + + +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/vanilla/injector.js": +/*!*****************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/vanilla/injector.js ***! + \*****************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "$injector": () => (/* binding */ $injector) +/* harmony export */ }); +/* harmony import */ var _common_index__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/index */ "./node_modules/@uirouter/core/lib-esm/common/index.js"); + +// globally available injectables +var globals = {}; +var STRIP_COMMENTS = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/gm; +var ARGUMENT_NAMES = /([^\s,]+)/g; +/** + * A basic angular1-like injector api + * + * This object implements four methods similar to the + * [angular 1 dependency injector](https://docs.angularjs.org/api/auto/service/$injector) + * + * UI-Router evolved from an angular 1 library to a framework agnostic library. + * However, some of the `@uirouter/core` code uses these ng1 style APIs to support ng1 style dependency injection. + * + * This object provides a naive implementation of a globally scoped dependency injection system. + * It supports the following DI approaches: + * + * ### Function parameter names + * + * A function's `.toString()` is called, and the parameter names are parsed. + * This only works when the parameter names aren't "mangled" by a minifier such as UglifyJS. + * + * ```js + * function injectedFunction(FooService, BarService) { + * // FooService and BarService are injected + * } + * ``` + * + * ### Function annotation + * + * A function may be annotated with an array of dependency names as the `$inject` property. + * + * ```js + * injectedFunction.$inject = [ 'FooService', 'BarService' ]; + * function injectedFunction(fs, bs) { + * // FooService and BarService are injected as fs and bs parameters + * } + * ``` + * + * ### Array notation + * + * An array provides the names of the dependencies to inject (as strings). + * The function is the last element of the array. + * + * ```js + * [ 'FooService', 'BarService', function (fs, bs) { + * // FooService and BarService are injected as fs and bs parameters + * }] + * ``` + * + * @type {$InjectorLike} + */ +var $injector = { + /** Gets an object from DI based on a string token */ + get: function (name) { return globals[name]; }, + /** Returns true if an object named `name` exists in global DI */ + has: function (name) { return $injector.get(name) != null; }, + /** + * Injects a function + * + * @param fn the function to inject + * @param context the function's `this` binding + * @param locals An object with additional DI tokens and values, such as `{ someToken: { foo: 1 } }` + */ + invoke: function (fn, context, locals) { + var all = (0,_common_index__WEBPACK_IMPORTED_MODULE_0__.extend)({}, globals, locals || {}); + var params = $injector.annotate(fn); + var ensureExist = (0,_common_index__WEBPACK_IMPORTED_MODULE_0__.assertPredicate)(function (key) { return all.hasOwnProperty(key); }, function (key) { return "DI can't find injectable: '" + key + "'"; }); + var args = params.filter(ensureExist).map(function (x) { return all[x]; }); + if ((0,_common_index__WEBPACK_IMPORTED_MODULE_0__.isFunction)(fn)) + return fn.apply(context, args); + else + return fn.slice(-1)[0].apply(context, args); + }, + /** + * Returns a function's dependencies + * + * Analyzes a function (or array) and returns an array of DI tokens that the function requires. + * @return an array of `string`s + */ + annotate: function (fn) { + if (!(0,_common_index__WEBPACK_IMPORTED_MODULE_0__.isInjectable)(fn)) + throw new Error("Not an injectable function: " + fn); + if (fn && fn.$inject) + return fn.$inject; + if ((0,_common_index__WEBPACK_IMPORTED_MODULE_0__.isArray)(fn)) + return fn.slice(0, -1); + var fnStr = fn.toString().replace(STRIP_COMMENTS, ''); + var result = fnStr.slice(fnStr.indexOf('(') + 1, fnStr.indexOf(')')).match(ARGUMENT_NAMES); + return result || []; + }, +}; +//# sourceMappingURL=injector.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/vanilla/interface.js": +/*!******************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/vanilla/interface.js ***! + \******************************************************************/ +/***/ (() => { + +//# sourceMappingURL=interface.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/vanilla/memoryLocationConfig.js": +/*!*****************************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/vanilla/memoryLocationConfig.js ***! + \*****************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "MemoryLocationConfig": () => (/* binding */ MemoryLocationConfig) +/* harmony export */ }); +/* harmony import */ var _common_predicates__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/predicates */ "./node_modules/@uirouter/core/lib-esm/common/predicates.js"); +/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/common */ "./node_modules/@uirouter/core/lib-esm/common/common.js"); + + +/** A `LocationConfig` mock that gets/sets all config from an in-memory object */ +var MemoryLocationConfig = /** @class */ (function () { + function MemoryLocationConfig() { + var _this = this; + this.dispose = _common_common__WEBPACK_IMPORTED_MODULE_1__.noop; + this._baseHref = ''; + this._port = 80; + this._protocol = 'http'; + this._host = 'localhost'; + this._hashPrefix = ''; + this.port = function () { return _this._port; }; + this.protocol = function () { return _this._protocol; }; + this.host = function () { return _this._host; }; + this.baseHref = function () { return _this._baseHref; }; + this.html5Mode = function () { return false; }; + this.hashPrefix = function (newval) { return ((0,_common_predicates__WEBPACK_IMPORTED_MODULE_0__.isDefined)(newval) ? (_this._hashPrefix = newval) : _this._hashPrefix); }; + } + return MemoryLocationConfig; +}()); + +//# sourceMappingURL=memoryLocationConfig.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/vanilla/memoryLocationService.js": +/*!******************************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/vanilla/memoryLocationService.js ***! + \******************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "MemoryLocationService": () => (/* binding */ MemoryLocationService) +/* harmony export */ }); +/* harmony import */ var _baseLocationService__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./baseLocationService */ "./node_modules/@uirouter/core/lib-esm/vanilla/baseLocationService.js"); +var __extends = (undefined && undefined.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); + +/** A `LocationServices` that gets/sets the current location from an in-memory object */ +var MemoryLocationService = /** @class */ (function (_super) { + __extends(MemoryLocationService, _super); + function MemoryLocationService(router) { + return _super.call(this, router, true) || this; + } + MemoryLocationService.prototype._get = function () { + return this._url; + }; + MemoryLocationService.prototype._set = function (state, title, url, replace) { + this._url = url; + }; + return MemoryLocationService; +}(_baseLocationService__WEBPACK_IMPORTED_MODULE_0__.BaseLocationServices)); + +//# sourceMappingURL=memoryLocationService.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/vanilla/plugins.js": +/*!****************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/vanilla/plugins.js ***! + \****************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "servicesPlugin": () => (/* binding */ servicesPlugin), +/* harmony export */ "hashLocationPlugin": () => (/* binding */ hashLocationPlugin), +/* harmony export */ "pushStateLocationPlugin": () => (/* binding */ pushStateLocationPlugin), +/* harmony export */ "memoryLocationPlugin": () => (/* binding */ memoryLocationPlugin) +/* harmony export */ }); +/* harmony import */ var _browserLocationConfig__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./browserLocationConfig */ "./node_modules/@uirouter/core/lib-esm/vanilla/browserLocationConfig.js"); +/* harmony import */ var _hashLocationService__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./hashLocationService */ "./node_modules/@uirouter/core/lib-esm/vanilla/hashLocationService.js"); +/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./utils */ "./node_modules/@uirouter/core/lib-esm/vanilla/utils.js"); +/* harmony import */ var _pushStateLocationService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./pushStateLocationService */ "./node_modules/@uirouter/core/lib-esm/vanilla/pushStateLocationService.js"); +/* harmony import */ var _memoryLocationService__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./memoryLocationService */ "./node_modules/@uirouter/core/lib-esm/vanilla/memoryLocationService.js"); +/* harmony import */ var _memoryLocationConfig__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./memoryLocationConfig */ "./node_modules/@uirouter/core/lib-esm/vanilla/memoryLocationConfig.js"); +/* harmony import */ var _injector__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./injector */ "./node_modules/@uirouter/core/lib-esm/vanilla/injector.js"); +/* harmony import */ var _q__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./q */ "./node_modules/@uirouter/core/lib-esm/vanilla/q.js"); +/* harmony import */ var _common_coreservices__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../common/coreservices */ "./node_modules/@uirouter/core/lib-esm/common/coreservices.js"); + + + + + + + + + +function servicesPlugin(router) { + _common_coreservices__WEBPACK_IMPORTED_MODULE_8__.services.$injector = _injector__WEBPACK_IMPORTED_MODULE_6__.$injector; + _common_coreservices__WEBPACK_IMPORTED_MODULE_8__.services.$q = _q__WEBPACK_IMPORTED_MODULE_7__.$q; + return { name: 'vanilla.services', $q: _q__WEBPACK_IMPORTED_MODULE_7__.$q, $injector: _injector__WEBPACK_IMPORTED_MODULE_6__.$injector, dispose: function () { return null; } }; +} +/** A `UIRouterPlugin` uses the browser hash to get/set the current location */ +var hashLocationPlugin = (0,_utils__WEBPACK_IMPORTED_MODULE_2__.locationPluginFactory)('vanilla.hashBangLocation', false, _hashLocationService__WEBPACK_IMPORTED_MODULE_1__.HashLocationService, _browserLocationConfig__WEBPACK_IMPORTED_MODULE_0__.BrowserLocationConfig); +/** A `UIRouterPlugin` that gets/sets the current location using the browser's `location` and `history` apis */ +var pushStateLocationPlugin = (0,_utils__WEBPACK_IMPORTED_MODULE_2__.locationPluginFactory)('vanilla.pushStateLocation', true, _pushStateLocationService__WEBPACK_IMPORTED_MODULE_3__.PushStateLocationService, _browserLocationConfig__WEBPACK_IMPORTED_MODULE_0__.BrowserLocationConfig); +/** A `UIRouterPlugin` that gets/sets the current location from an in-memory object */ +var memoryLocationPlugin = (0,_utils__WEBPACK_IMPORTED_MODULE_2__.locationPluginFactory)('vanilla.memoryLocation', false, _memoryLocationService__WEBPACK_IMPORTED_MODULE_4__.MemoryLocationService, _memoryLocationConfig__WEBPACK_IMPORTED_MODULE_5__.MemoryLocationConfig); +//# sourceMappingURL=plugins.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/vanilla/pushStateLocationService.js": +/*!*********************************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/vanilla/pushStateLocationService.js ***! + \*********************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "PushStateLocationService": () => (/* binding */ PushStateLocationService) +/* harmony export */ }); +/* harmony import */ var _baseLocationService__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./baseLocationService */ "./node_modules/@uirouter/core/lib-esm/vanilla/baseLocationService.js"); +/* harmony import */ var _common__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common */ "./node_modules/@uirouter/core/lib-esm/common/index.js"); +var __extends = (undefined && undefined.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); + + +/** + * A `LocationServices` that gets/sets the current location using the browser's `location` and `history` apis + * + * Uses `history.pushState` and `history.replaceState` + */ +var PushStateLocationService = /** @class */ (function (_super) { + __extends(PushStateLocationService, _super); + function PushStateLocationService(router) { + var _this = _super.call(this, router, true) || this; + _this._config = router.urlService.config; + _common__WEBPACK_IMPORTED_MODULE_1__.root.addEventListener('popstate', _this._listener, false); + return _this; + } + /** + * Gets the base prefix without: + * - trailing slash + * - trailing filename + * - protocol and hostname + * + * If , this returns '/base'. + * If , this returns '/foo/base'. + * If , this returns '/base'. + * If , this returns '/base'. + * If , this returns ''. + * If , this returns ''. + * If , this returns ''. + * + * See: https://html.spec.whatwg.org/dev/semantics.html#the-base-element + */ + PushStateLocationService.prototype._getBasePrefix = function () { + return (0,_common__WEBPACK_IMPORTED_MODULE_1__.stripLastPathElement)(this._config.baseHref()); + }; + PushStateLocationService.prototype._get = function () { + var _a = this._location, pathname = _a.pathname, hash = _a.hash, search = _a.search; + search = (0,_common__WEBPACK_IMPORTED_MODULE_1__.splitQuery)(search)[1]; // strip ? if found + hash = (0,_common__WEBPACK_IMPORTED_MODULE_1__.splitHash)(hash)[1]; // strip # if found + var basePrefix = this._getBasePrefix(); + var exactBaseHrefMatch = pathname === this._config.baseHref(); + var startsWithBase = pathname.substr(0, basePrefix.length) === basePrefix; + pathname = exactBaseHrefMatch ? '/' : startsWithBase ? pathname.substring(basePrefix.length) : pathname; + return pathname + (search ? '?' + search : '') + (hash ? '#' + hash : ''); + }; + PushStateLocationService.prototype._set = function (state, title, url, replace) { + var basePrefix = this._getBasePrefix(); + var slash = url && url[0] !== '/' ? '/' : ''; + var fullUrl = url === '' || url === '/' ? this._config.baseHref() : basePrefix + slash + url; + if (replace) { + this._history.replaceState(state, title, fullUrl); + } + else { + this._history.pushState(state, title, fullUrl); + } + }; + PushStateLocationService.prototype.dispose = function (router) { + _super.prototype.dispose.call(this, router); + _common__WEBPACK_IMPORTED_MODULE_1__.root.removeEventListener('popstate', this._listener); + }; + return PushStateLocationService; +}(_baseLocationService__WEBPACK_IMPORTED_MODULE_0__.BaseLocationServices)); + +//# sourceMappingURL=pushStateLocationService.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/vanilla/q.js": +/*!**********************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/vanilla/q.js ***! + \**********************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "$q": () => (/* binding */ $q) +/* harmony export */ }); +/* harmony import */ var _common_index__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/index */ "./node_modules/@uirouter/core/lib-esm/common/index.js"); + +/** + * An angular1-like promise api + * + * This object implements four methods similar to the + * [angular 1 promise api](https://docs.angularjs.org/api/ng/service/$q) + * + * UI-Router evolved from an angular 1 library to a framework agnostic library. + * However, some of the `@uirouter/core` code uses these ng1 style APIs to support ng1 style dependency injection. + * + * This API provides native ES6 promise support wrapped as a $q-like API. + * Internally, UI-Router uses this $q object to perform promise operations. + * The `angular-ui-router` (ui-router for angular 1) uses the $q API provided by angular. + * + * $q-like promise api + */ +var $q = { + /** Normalizes a value as a promise */ + when: function (val) { return new Promise(function (resolve, reject) { return resolve(val); }); }, + /** Normalizes a value as a promise rejection */ + reject: function (val) { + return new Promise(function (resolve, reject) { + reject(val); + }); + }, + /** @returns a deferred object, which has `resolve` and `reject` functions */ + defer: function () { + var deferred = {}; + deferred.promise = new Promise(function (resolve, reject) { + deferred.resolve = resolve; + deferred.reject = reject; + }); + return deferred; + }, + /** Like Promise.all(), but also supports object key/promise notation like $q */ + all: function (promises) { + if ((0,_common_index__WEBPACK_IMPORTED_MODULE_0__.isArray)(promises)) { + return Promise.all(promises); + } + if ((0,_common_index__WEBPACK_IMPORTED_MODULE_0__.isObject)(promises)) { + // Convert promises map to promises array. + // When each promise resolves, map it to a tuple { key: key, val: val } + var chain = Object.keys(promises).map(function (key) { return promises[key].then(function (val) { return ({ key: key, val: val }); }); }); + // Then wait for all promises to resolve, and convert them back to an object + return $q.all(chain).then(function (values) { + return values.reduce(function (acc, tuple) { + acc[tuple.key] = tuple.val; + return acc; + }, {}); + }); + } + }, +}; +//# sourceMappingURL=q.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/vanilla/utils.js": +/*!**************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/vanilla/utils.js ***! + \**************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "keyValsToObjectR": () => (/* binding */ keyValsToObjectR), +/* harmony export */ "getParams": () => (/* binding */ getParams), +/* harmony export */ "parseUrl": () => (/* binding */ parseUrl), +/* harmony export */ "buildUrl": () => (/* binding */ buildUrl), +/* harmony export */ "locationPluginFactory": () => (/* binding */ locationPluginFactory) +/* harmony export */ }); +/* harmony import */ var _common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common */ "./node_modules/@uirouter/core/lib-esm/common/index.js"); + +var keyValsToObjectR = function (accum, _a) { + var key = _a[0], val = _a[1]; + if (!accum.hasOwnProperty(key)) { + accum[key] = val; + } + else if ((0,_common__WEBPACK_IMPORTED_MODULE_0__.isArray)(accum[key])) { + accum[key].push(val); + } + else { + accum[key] = [accum[key], val]; + } + return accum; +}; +var getParams = function (queryString) { + return queryString.split('&').filter(_common__WEBPACK_IMPORTED_MODULE_0__.identity).map(_common__WEBPACK_IMPORTED_MODULE_0__.splitEqual).reduce(keyValsToObjectR, {}); +}; +function parseUrl(url) { + var orEmptyString = function (x) { return x || ''; }; + var _a = (0,_common__WEBPACK_IMPORTED_MODULE_0__.splitHash)(url).map(orEmptyString), beforehash = _a[0], hash = _a[1]; + var _b = (0,_common__WEBPACK_IMPORTED_MODULE_0__.splitQuery)(beforehash).map(orEmptyString), path = _b[0], search = _b[1]; + return { path: path, search: search, hash: hash, url: url }; +} +var buildUrl = function (loc) { + var path = loc.path(); + var searchObject = loc.search(); + var hash = loc.hash(); + var search = Object.keys(searchObject) + .map(function (key) { + var param = searchObject[key]; + var vals = (0,_common__WEBPACK_IMPORTED_MODULE_0__.isArray)(param) ? param : [param]; + return vals.map(function (val) { return key + '=' + val; }); + }) + .reduce(_common__WEBPACK_IMPORTED_MODULE_0__.unnestR, []) + .join('&'); + return path + (search ? '?' + search : '') + (hash ? '#' + hash : ''); +}; +function locationPluginFactory(name, isHtml5, serviceClass, configurationClass) { + return function (uiRouter) { + var service = (uiRouter.locationService = new serviceClass(uiRouter)); + var configuration = (uiRouter.locationConfig = new configurationClass(uiRouter, isHtml5)); + function dispose(router) { + router.dispose(service); + router.dispose(configuration); + } + return { name: name, service: service, configuration: configuration, dispose: dispose }; + }; +} +//# sourceMappingURL=utils.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/view/index.js": +/*!***********************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/view/index.js ***! + \***********************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "ViewService": () => (/* reexport safe */ _view__WEBPACK_IMPORTED_MODULE_1__.ViewService) +/* harmony export */ }); +/* harmony import */ var _interface__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./interface */ "./node_modules/@uirouter/core/lib-esm/view/interface.js"); +/* harmony import */ var _interface__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_interface__WEBPACK_IMPORTED_MODULE_0__); +/* harmony reexport (unknown) */ var __WEBPACK_REEXPORT_OBJECT__ = {}; +/* harmony reexport (unknown) */ for(const __WEBPACK_IMPORT_KEY__ in _interface__WEBPACK_IMPORTED_MODULE_0__) if(__WEBPACK_IMPORT_KEY__ !== "default") __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = () => _interface__WEBPACK_IMPORTED_MODULE_0__[__WEBPACK_IMPORT_KEY__] +/* harmony reexport (unknown) */ __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__); +/* harmony import */ var _view__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./view */ "./node_modules/@uirouter/core/lib-esm/view/view.js"); + + +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/view/interface.js": +/*!***************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/view/interface.js ***! + \***************************************************************/ +/***/ (() => { + +//# sourceMappingURL=interface.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/view/view.js": +/*!**********************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/view/view.js ***! + \**********************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "ViewService": () => (/* binding */ ViewService) +/* harmony export */ }); +/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/common */ "./node_modules/@uirouter/core/lib-esm/common/common.js"); +/* harmony import */ var _common_hof__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/hof */ "./node_modules/@uirouter/core/lib-esm/common/hof.js"); +/* harmony import */ var _common_predicates__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../common/predicates */ "./node_modules/@uirouter/core/lib-esm/common/predicates.js"); +/* harmony import */ var _common_trace__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../common/trace */ "./node_modules/@uirouter/core/lib-esm/common/trace.js"); + + + + +/** + * The View service + * + * This service pairs existing `ui-view` components (which live in the DOM) + * with view configs (from the state declaration objects: [[StateDeclaration.views]]). + * + * - After a successful Transition, the views from the newly entered states are activated via [[activateViewConfig]]. + * The views from exited states are deactivated via [[deactivateViewConfig]]. + * (See: the [[registerActivateViews]] Transition Hook) + * + * - As `ui-view` components pop in and out of existence, they register themselves using [[registerUIView]]. + * + * - When the [[sync]] function is called, the registered `ui-view`(s) ([[ActiveUIView]]) + * are configured with the matching [[ViewConfig]](s) + * + */ +var ViewService = /** @class */ (function () { + /** @internal */ + function ViewService(/** @internal */ router) { + var _this = this; + this.router = router; + /** @internal */ this._uiViews = []; + /** @internal */ this._viewConfigs = []; + /** @internal */ this._viewConfigFactories = {}; + /** @internal */ this._listeners = []; + /** @internal */ + this._pluginapi = { + _rootViewContext: this._rootViewContext.bind(this), + _viewConfigFactory: this._viewConfigFactory.bind(this), + _registeredUIView: function (id) { return (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.find)(_this._uiViews, function (view) { return _this.router.$id + "." + view.id === id; }); }, + _registeredUIViews: function () { return _this._uiViews; }, + _activeViewConfigs: function () { return _this._viewConfigs; }, + _onSync: function (listener) { + _this._listeners.push(listener); + return function () { return (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.removeFrom)(_this._listeners, listener); }; + }, + }; + } + /** + * Normalizes a view's name from a state.views configuration block. + * + * This should be used by a framework implementation to calculate the values for + * [[_ViewDeclaration.$uiViewName]] and [[_ViewDeclaration.$uiViewContextAnchor]]. + * + * @param context the context object (state declaration) that the view belongs to + * @param rawViewName the name of the view, as declared in the [[StateDeclaration.views]] + * + * @returns the normalized uiViewName and uiViewContextAnchor that the view targets + */ + ViewService.normalizeUIViewTarget = function (context, rawViewName) { + if (rawViewName === void 0) { rawViewName = ''; } + // TODO: Validate incoming view name with a regexp to allow: + // ex: "view.name@foo.bar" , "^.^.view.name" , "view.name@^.^" , "" , + // "@" , "$default@^" , "!$default.$default" , "!foo.bar" + var viewAtContext = rawViewName.split('@'); + var uiViewName = viewAtContext[0] || '$default'; // default to unnamed view + var uiViewContextAnchor = (0,_common_predicates__WEBPACK_IMPORTED_MODULE_2__.isString)(viewAtContext[1]) ? viewAtContext[1] : '^'; // default to parent context + // Handle relative view-name sugar syntax. + // Matches rawViewName "^.^.^.foo.bar" into array: ["^.^.^.foo.bar", "^.^.^", "foo.bar"], + var relativeViewNameSugar = /^(\^(?:\.\^)*)\.(.*$)/.exec(uiViewName); + if (relativeViewNameSugar) { + // Clobbers existing contextAnchor (rawViewName validation will fix this) + uiViewContextAnchor = relativeViewNameSugar[1]; // set anchor to "^.^.^" + uiViewName = relativeViewNameSugar[2]; // set view-name to "foo.bar" + } + if (uiViewName.charAt(0) === '!') { + uiViewName = uiViewName.substr(1); + uiViewContextAnchor = ''; // target absolutely from root + } + // handle parent relative targeting "^.^.^" + var relativeMatch = /^(\^(?:\.\^)*)$/; + if (relativeMatch.exec(uiViewContextAnchor)) { + var anchorState = uiViewContextAnchor.split('.').reduce(function (anchor, x) { return anchor.parent; }, context); + uiViewContextAnchor = anchorState.name; + } + else if (uiViewContextAnchor === '.') { + uiViewContextAnchor = context.name; + } + return { uiViewName: uiViewName, uiViewContextAnchor: uiViewContextAnchor }; + }; + /** @internal */ + ViewService.prototype._rootViewContext = function (context) { + return (this._rootContext = context || this._rootContext); + }; + /** @internal */ + ViewService.prototype._viewConfigFactory = function (viewType, factory) { + this._viewConfigFactories[viewType] = factory; + }; + ViewService.prototype.createViewConfig = function (path, decl) { + var cfgFactory = this._viewConfigFactories[decl.$type]; + if (!cfgFactory) + throw new Error('ViewService: No view config factory registered for type ' + decl.$type); + var cfgs = cfgFactory(path, decl); + return (0,_common_predicates__WEBPACK_IMPORTED_MODULE_2__.isArray)(cfgs) ? cfgs : [cfgs]; + }; + /** + * Deactivates a ViewConfig. + * + * This function deactivates a `ViewConfig`. + * After calling [[sync]], it will un-pair from any `ui-view` with which it is currently paired. + * + * @param viewConfig The ViewConfig view to deregister. + */ + ViewService.prototype.deactivateViewConfig = function (viewConfig) { + _common_trace__WEBPACK_IMPORTED_MODULE_3__.trace.traceViewServiceEvent('<- Removing', viewConfig); + (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.removeFrom)(this._viewConfigs, viewConfig); + }; + ViewService.prototype.activateViewConfig = function (viewConfig) { + _common_trace__WEBPACK_IMPORTED_MODULE_3__.trace.traceViewServiceEvent('-> Registering', viewConfig); + this._viewConfigs.push(viewConfig); + }; + ViewService.prototype.sync = function () { + var _this = this; + var uiViewsByFqn = this._uiViews.map(function (uiv) { return [uiv.fqn, uiv]; }).reduce(_common_common__WEBPACK_IMPORTED_MODULE_0__.applyPairs, {}); + // Return a weighted depth value for a uiView. + // The depth is the nesting depth of ui-views (based on FQN; times 10,000) + // plus the depth of the state that is populating the uiView + function uiViewDepth(uiView) { + var stateDepth = function (context) { return (context && context.parent ? stateDepth(context.parent) + 1 : 1); }; + return uiView.fqn.split('.').length * 10000 + stateDepth(uiView.creationContext); + } + // Return the ViewConfig's context's depth in the context tree. + function viewConfigDepth(config) { + var context = config.viewDecl.$context, count = 0; + while (++count && context.parent) + context = context.parent; + return count; + } + // Given a depth function, returns a compare function which can return either ascending or descending order + var depthCompare = (0,_common_hof__WEBPACK_IMPORTED_MODULE_1__.curry)(function (depthFn, posNeg, left, right) { return posNeg * (depthFn(left) - depthFn(right)); }); + var matchingConfigPair = function (uiView) { + var matchingConfigs = _this._viewConfigs.filter(ViewService.matches(uiViewsByFqn, uiView)); + if (matchingConfigs.length > 1) { + // This is OK. Child states can target a ui-view that the parent state also targets (the child wins) + // Sort by depth and return the match from the deepest child + // console.log(`Multiple matching view configs for ${uiView.fqn}`, matchingConfigs); + matchingConfigs.sort(depthCompare(viewConfigDepth, -1)); // descending + } + return { uiView: uiView, viewConfig: matchingConfigs[0] }; + }; + var configureUIView = function (tuple) { + // If a parent ui-view is reconfigured, it could destroy child ui-views. + // Before configuring a child ui-view, make sure it's still in the active uiViews array. + if (_this._uiViews.indexOf(tuple.uiView) !== -1) + tuple.uiView.configUpdated(tuple.viewConfig); + }; + // Sort views by FQN and state depth. Process uiviews nearest the root first. + var uiViewTuples = this._uiViews.sort(depthCompare(uiViewDepth, 1)).map(matchingConfigPair); + var matchedViewConfigs = uiViewTuples.map(function (tuple) { return tuple.viewConfig; }); + var unmatchedConfigTuples = this._viewConfigs + .filter(function (config) { return !(0,_common_common__WEBPACK_IMPORTED_MODULE_0__.inArray)(matchedViewConfigs, config); }) + .map(function (viewConfig) { return ({ uiView: undefined, viewConfig: viewConfig }); }); + uiViewTuples.forEach(configureUIView); + var allTuples = uiViewTuples.concat(unmatchedConfigTuples); + this._listeners.forEach(function (cb) { return cb(allTuples); }); + _common_trace__WEBPACK_IMPORTED_MODULE_3__.trace.traceViewSync(allTuples); + }; + /** + * Registers a `ui-view` component + * + * When a `ui-view` component is created, it uses this method to register itself. + * After registration the [[sync]] method is used to ensure all `ui-view` are configured with the proper [[ViewConfig]]. + * + * Note: the `ui-view` component uses the `ViewConfig` to determine what view should be loaded inside the `ui-view`, + * and what the view's state context is. + * + * Note: There is no corresponding `deregisterUIView`. + * A `ui-view` should hang on to the return value of `registerUIView` and invoke it to deregister itself. + * + * @param uiView The metadata for a UIView + * @return a de-registration function used when the view is destroyed. + */ + ViewService.prototype.registerUIView = function (uiView) { + _common_trace__WEBPACK_IMPORTED_MODULE_3__.trace.traceViewServiceUIViewEvent('-> Registering', uiView); + var uiViews = this._uiViews; + var fqnAndTypeMatches = function (uiv) { return uiv.fqn === uiView.fqn && uiv.$type === uiView.$type; }; + if (uiViews.filter(fqnAndTypeMatches).length) + _common_trace__WEBPACK_IMPORTED_MODULE_3__.trace.traceViewServiceUIViewEvent('!!!! duplicate uiView named:', uiView); + uiViews.push(uiView); + this.sync(); + return function () { + var idx = uiViews.indexOf(uiView); + if (idx === -1) { + _common_trace__WEBPACK_IMPORTED_MODULE_3__.trace.traceViewServiceUIViewEvent('Tried removing non-registered uiView', uiView); + return; + } + _common_trace__WEBPACK_IMPORTED_MODULE_3__.trace.traceViewServiceUIViewEvent('<- Deregistering', uiView); + (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.removeFrom)(uiViews)(uiView); + }; + }; + /** + * Returns the list of views currently available on the page, by fully-qualified name. + * + * @return {Array} Returns an array of fully-qualified view names. + */ + ViewService.prototype.available = function () { + return this._uiViews.map((0,_common_hof__WEBPACK_IMPORTED_MODULE_1__.prop)('fqn')); + }; + /** + * Returns the list of views on the page containing loaded content. + * + * @return {Array} Returns an array of fully-qualified view names. + */ + ViewService.prototype.active = function () { + return this._uiViews.filter((0,_common_hof__WEBPACK_IMPORTED_MODULE_1__.prop)('$config')).map((0,_common_hof__WEBPACK_IMPORTED_MODULE_1__.prop)('name')); + }; + /** + * Given a ui-view and a ViewConfig, determines if they "match". + * + * A ui-view has a fully qualified name (fqn) and a context object. The fqn is built from its overall location in + * the DOM, describing its nesting relationship to any parent ui-view tags it is nested inside of. + * + * A ViewConfig has a target ui-view name and a context anchor. The ui-view name can be a simple name, or + * can be a segmented ui-view path, describing a portion of a ui-view fqn. + * + * In order for a ui-view to match ViewConfig, ui-view's $type must match the ViewConfig's $type + * + * If the ViewConfig's target ui-view name is a simple name (no dots), then a ui-view matches if: + * - the ui-view's name matches the ViewConfig's target name + * - the ui-view's context matches the ViewConfig's anchor + * + * If the ViewConfig's target ui-view name is a segmented name (with dots), then a ui-view matches if: + * - There exists a parent ui-view where: + * - the parent ui-view's name matches the first segment (index 0) of the ViewConfig's target name + * - the parent ui-view's context matches the ViewConfig's anchor + * - And the remaining segments (index 1..n) of the ViewConfig's target name match the tail of the ui-view's fqn + * + * Example: + * + * DOM: + * + * + * + * + * + * + * + * + * + * uiViews: [ + * { fqn: "$default", creationContext: { name: "" } }, + * { fqn: "$default.foo", creationContext: { name: "A" } }, + * { fqn: "$default.foo.$default", creationContext: { name: "A.B" } } + * { fqn: "$default.foo.$default.bar", creationContext: { name: "A.B.C" } } + * ] + * + * These four view configs all match the ui-view with the fqn: "$default.foo.$default.bar": + * + * - ViewConfig1: { uiViewName: "bar", uiViewContextAnchor: "A.B.C" } + * - ViewConfig2: { uiViewName: "$default.bar", uiViewContextAnchor: "A.B" } + * - ViewConfig3: { uiViewName: "foo.$default.bar", uiViewContextAnchor: "A" } + * - ViewConfig4: { uiViewName: "$default.foo.$default.bar", uiViewContextAnchor: "" } + * + * Using ViewConfig3 as an example, it matches the ui-view with fqn "$default.foo.$default.bar" because: + * - The ViewConfig's segmented target name is: [ "foo", "$default", "bar" ] + * - There exists a parent ui-view (which has fqn: "$default.foo") where: + * - the parent ui-view's name "foo" matches the first segment "foo" of the ViewConfig's target name + * - the parent ui-view's context "A" matches the ViewConfig's anchor context "A" + * - And the remaining segments [ "$default", "bar" ].join("."_ of the ViewConfig's target name match + * the tail of the ui-view's fqn "default.bar" + * + * @internal + */ + ViewService.matches = function (uiViewsByFqn, uiView) { return function (viewConfig) { + // Don't supply an ng1 ui-view with an ng2 ViewConfig, etc + if (uiView.$type !== viewConfig.viewDecl.$type) + return false; + // Split names apart from both viewConfig and uiView into segments + var vc = viewConfig.viewDecl; + var vcSegments = vc.$uiViewName.split('.'); + var uivSegments = uiView.fqn.split('.'); + // Check if the tails of the segment arrays match. ex, these arrays' tails match: + // vc: ["foo", "bar"], uiv fqn: ["$default", "foo", "bar"] + if (!(0,_common_common__WEBPACK_IMPORTED_MODULE_0__.equals)(vcSegments, uivSegments.slice(0 - vcSegments.length))) + return false; + // Now check if the fqn ending at the first segment of the viewConfig matches the context: + // ["$default", "foo"].join(".") == "$default.foo", does the ui-view $default.foo context match? + var negOffset = 1 - vcSegments.length || undefined; + var fqnToFirstSegment = uivSegments.slice(0, negOffset).join('.'); + var uiViewContext = uiViewsByFqn[fqnToFirstSegment].creationContext; + return vc.$uiViewContextAnchor === (uiViewContext && uiViewContext.name); + }; }; + return ViewService; +}()); + +//# sourceMappingURL=view.js.map + +/***/ }), + +/***/ "./node_modules/angular-animate/angular-animate.js": +/*!*********************************************************!*\ + !*** ./node_modules/angular-animate/angular-animate.js ***! + \*********************************************************/ +/***/ (() => { + +/** + * @license AngularJS v1.8.2 + * (c) 2010-2020 Google LLC. http://angularjs.org + * License: MIT + */ +(function(window, angular) {'use strict'; + +var ELEMENT_NODE = 1; +var COMMENT_NODE = 8; + +var ADD_CLASS_SUFFIX = '-add'; +var REMOVE_CLASS_SUFFIX = '-remove'; +var EVENT_CLASS_PREFIX = 'ng-'; +var ACTIVE_CLASS_SUFFIX = '-active'; +var PREPARE_CLASS_SUFFIX = '-prepare'; + +var NG_ANIMATE_CLASSNAME = 'ng-animate'; +var NG_ANIMATE_CHILDREN_DATA = '$$ngAnimateChildren'; + +// Detect proper transitionend/animationend event names. +var CSS_PREFIX = '', TRANSITION_PROP, TRANSITIONEND_EVENT, ANIMATION_PROP, ANIMATIONEND_EVENT; + +// If unprefixed events are not supported but webkit-prefixed are, use the latter. +// Otherwise, just use W3C names, browsers not supporting them at all will just ignore them. +// Note: Chrome implements `window.onwebkitanimationend` and doesn't implement `window.onanimationend` +// but at the same time dispatches the `animationend` event and not `webkitAnimationEnd`. +// Register both events in case `window.onanimationend` is not supported because of that, +// do the same for `transitionend` as Safari is likely to exhibit similar behavior. +// Also, the only modern browser that uses vendor prefixes for transitions/keyframes is webkit +// therefore there is no reason to test anymore for other vendor prefixes: +// http://caniuse.com/#search=transition +if ((window.ontransitionend === undefined) && (window.onwebkittransitionend !== undefined)) { + CSS_PREFIX = '-webkit-'; + TRANSITION_PROP = 'WebkitTransition'; + TRANSITIONEND_EVENT = 'webkitTransitionEnd transitionend'; +} else { + TRANSITION_PROP = 'transition'; + TRANSITIONEND_EVENT = 'transitionend'; +} + +if ((window.onanimationend === undefined) && (window.onwebkitanimationend !== undefined)) { + CSS_PREFIX = '-webkit-'; + ANIMATION_PROP = 'WebkitAnimation'; + ANIMATIONEND_EVENT = 'webkitAnimationEnd animationend'; +} else { + ANIMATION_PROP = 'animation'; + ANIMATIONEND_EVENT = 'animationend'; +} + +var DURATION_KEY = 'Duration'; +var PROPERTY_KEY = 'Property'; +var DELAY_KEY = 'Delay'; +var TIMING_KEY = 'TimingFunction'; +var ANIMATION_ITERATION_COUNT_KEY = 'IterationCount'; +var ANIMATION_PLAYSTATE_KEY = 'PlayState'; +var SAFE_FAST_FORWARD_DURATION_VALUE = 9999; + +var ANIMATION_DELAY_PROP = ANIMATION_PROP + DELAY_KEY; +var ANIMATION_DURATION_PROP = ANIMATION_PROP + DURATION_KEY; +var TRANSITION_DELAY_PROP = TRANSITION_PROP + DELAY_KEY; +var TRANSITION_DURATION_PROP = TRANSITION_PROP + DURATION_KEY; + +var ngMinErr = angular.$$minErr('ng'); +function assertArg(arg, name, reason) { + if (!arg) { + throw ngMinErr('areq', 'Argument \'{0}\' is {1}', (name || '?'), (reason || 'required')); + } + return arg; +} + +function mergeClasses(a,b) { + if (!a && !b) return ''; + if (!a) return b; + if (!b) return a; + if (isArray(a)) a = a.join(' '); + if (isArray(b)) b = b.join(' '); + return a + ' ' + b; +} + +function packageStyles(options) { + var styles = {}; + if (options && (options.to || options.from)) { + styles.to = options.to; + styles.from = options.from; + } + return styles; +} + +function pendClasses(classes, fix, isPrefix) { + var className = ''; + classes = isArray(classes) + ? classes + : classes && isString(classes) && classes.length + ? classes.split(/\s+/) + : []; + forEach(classes, function(klass, i) { + if (klass && klass.length > 0) { + className += (i > 0) ? ' ' : ''; + className += isPrefix ? fix + klass + : klass + fix; + } + }); + return className; +} + +function removeFromArray(arr, val) { + var index = arr.indexOf(val); + if (val >= 0) { + arr.splice(index, 1); + } +} + +function stripCommentsFromElement(element) { + if (element instanceof jqLite) { + switch (element.length) { + case 0: + return element; + + case 1: + // there is no point of stripping anything if the element + // is the only element within the jqLite wrapper. + // (it's important that we retain the element instance.) + if (element[0].nodeType === ELEMENT_NODE) { + return element; + } + break; + + default: + return jqLite(extractElementNode(element)); + } + } + + if (element.nodeType === ELEMENT_NODE) { + return jqLite(element); + } +} + +function extractElementNode(element) { + if (!element[0]) return element; + for (var i = 0; i < element.length; i++) { + var elm = element[i]; + if (elm.nodeType === ELEMENT_NODE) { + return elm; + } + } +} + +function $$addClass($$jqLite, element, className) { + forEach(element, function(elm) { + $$jqLite.addClass(elm, className); + }); +} + +function $$removeClass($$jqLite, element, className) { + forEach(element, function(elm) { + $$jqLite.removeClass(elm, className); + }); +} + +function applyAnimationClassesFactory($$jqLite) { + return function(element, options) { + if (options.addClass) { + $$addClass($$jqLite, element, options.addClass); + options.addClass = null; + } + if (options.removeClass) { + $$removeClass($$jqLite, element, options.removeClass); + options.removeClass = null; + } + }; +} + +function prepareAnimationOptions(options) { + options = options || {}; + if (!options.$$prepared) { + var domOperation = options.domOperation || noop; + options.domOperation = function() { + options.$$domOperationFired = true; + domOperation(); + domOperation = noop; + }; + options.$$prepared = true; + } + return options; +} + +function applyAnimationStyles(element, options) { + applyAnimationFromStyles(element, options); + applyAnimationToStyles(element, options); +} + +function applyAnimationFromStyles(element, options) { + if (options.from) { + element.css(options.from); + options.from = null; + } +} + +function applyAnimationToStyles(element, options) { + if (options.to) { + element.css(options.to); + options.to = null; + } +} + +function mergeAnimationDetails(element, oldAnimation, newAnimation) { + var target = oldAnimation.options || {}; + var newOptions = newAnimation.options || {}; + + var toAdd = (target.addClass || '') + ' ' + (newOptions.addClass || ''); + var toRemove = (target.removeClass || '') + ' ' + (newOptions.removeClass || ''); + var classes = resolveElementClasses(element.attr('class'), toAdd, toRemove); + + if (newOptions.preparationClasses) { + target.preparationClasses = concatWithSpace(newOptions.preparationClasses, target.preparationClasses); + delete newOptions.preparationClasses; + } + + // noop is basically when there is no callback; otherwise something has been set + var realDomOperation = target.domOperation !== noop ? target.domOperation : null; + + extend(target, newOptions); + + // TODO(matsko or sreeramu): proper fix is to maintain all animation callback in array and call at last,but now only leave has the callback so no issue with this. + if (realDomOperation) { + target.domOperation = realDomOperation; + } + + if (classes.addClass) { + target.addClass = classes.addClass; + } else { + target.addClass = null; + } + + if (classes.removeClass) { + target.removeClass = classes.removeClass; + } else { + target.removeClass = null; + } + + oldAnimation.addClass = target.addClass; + oldAnimation.removeClass = target.removeClass; + + return target; +} + +function resolveElementClasses(existing, toAdd, toRemove) { + var ADD_CLASS = 1; + var REMOVE_CLASS = -1; + + var flags = {}; + existing = splitClassesToLookup(existing); + + toAdd = splitClassesToLookup(toAdd); + forEach(toAdd, function(value, key) { + flags[key] = ADD_CLASS; + }); + + toRemove = splitClassesToLookup(toRemove); + forEach(toRemove, function(value, key) { + flags[key] = flags[key] === ADD_CLASS ? null : REMOVE_CLASS; + }); + + var classes = { + addClass: '', + removeClass: '' + }; + + forEach(flags, function(val, klass) { + var prop, allow; + if (val === ADD_CLASS) { + prop = 'addClass'; + allow = !existing[klass] || existing[klass + REMOVE_CLASS_SUFFIX]; + } else if (val === REMOVE_CLASS) { + prop = 'removeClass'; + allow = existing[klass] || existing[klass + ADD_CLASS_SUFFIX]; + } + if (allow) { + if (classes[prop].length) { + classes[prop] += ' '; + } + classes[prop] += klass; + } + }); + + function splitClassesToLookup(classes) { + if (isString(classes)) { + classes = classes.split(' '); + } + + var obj = {}; + forEach(classes, function(klass) { + // sometimes the split leaves empty string values + // incase extra spaces were applied to the options + if (klass.length) { + obj[klass] = true; + } + }); + return obj; + } + + return classes; +} + +function getDomNode(element) { + return (element instanceof jqLite) ? element[0] : element; +} + +function applyGeneratedPreparationClasses($$jqLite, element, event, options) { + var classes = ''; + if (event) { + classes = pendClasses(event, EVENT_CLASS_PREFIX, true); + } + if (options.addClass) { + classes = concatWithSpace(classes, pendClasses(options.addClass, ADD_CLASS_SUFFIX)); + } + if (options.removeClass) { + classes = concatWithSpace(classes, pendClasses(options.removeClass, REMOVE_CLASS_SUFFIX)); + } + if (classes.length) { + options.preparationClasses = classes; + element.addClass(classes); + } +} + +function clearGeneratedClasses(element, options) { + if (options.preparationClasses) { + element.removeClass(options.preparationClasses); + options.preparationClasses = null; + } + if (options.activeClasses) { + element.removeClass(options.activeClasses); + options.activeClasses = null; + } +} + +function blockKeyframeAnimations(node, applyBlock) { + var value = applyBlock ? 'paused' : ''; + var key = ANIMATION_PROP + ANIMATION_PLAYSTATE_KEY; + applyInlineStyle(node, [key, value]); + return [key, value]; +} + +function applyInlineStyle(node, styleTuple) { + var prop = styleTuple[0]; + var value = styleTuple[1]; + node.style[prop] = value; +} + +function concatWithSpace(a,b) { + if (!a) return b; + if (!b) return a; + return a + ' ' + b; +} + +var helpers = { + blockTransitions: function(node, duration) { + // we use a negative delay value since it performs blocking + // yet it doesn't kill any existing transitions running on the + // same element which makes this safe for class-based animations + var value = duration ? '-' + duration + 's' : ''; + applyInlineStyle(node, [TRANSITION_DELAY_PROP, value]); + return [TRANSITION_DELAY_PROP, value]; + } +}; + +var $$rAFSchedulerFactory = ['$$rAF', function($$rAF) { + var queue, cancelFn; + + function scheduler(tasks) { + // we make a copy since RAFScheduler mutates the state + // of the passed in array variable and this would be difficult + // to track down on the outside code + queue = queue.concat(tasks); + nextTick(); + } + + queue = scheduler.queue = []; + + /* waitUntilQuiet does two things: + * 1. It will run the FINAL `fn` value only when an uncanceled RAF has passed through + * 2. It will delay the next wave of tasks from running until the quiet `fn` has run. + * + * The motivation here is that animation code can request more time from the scheduler + * before the next wave runs. This allows for certain DOM properties such as classes to + * be resolved in time for the next animation to run. + */ + scheduler.waitUntilQuiet = function(fn) { + if (cancelFn) cancelFn(); + + cancelFn = $$rAF(function() { + cancelFn = null; + fn(); + nextTick(); + }); + }; + + return scheduler; + + function nextTick() { + if (!queue.length) return; + + var items = queue.shift(); + for (var i = 0; i < items.length; i++) { + items[i](); + } + + if (!cancelFn) { + $$rAF(function() { + if (!cancelFn) nextTick(); + }); + } + } +}]; + +/** + * @ngdoc directive + * @name ngAnimateChildren + * @restrict AE + * @element ANY + * + * @description + * + * ngAnimateChildren allows you to specify that children of this element should animate even if any + * of the children's parents are currently animating. By default, when an element has an active `enter`, `leave`, or `move` + * (structural) animation, child elements that also have an active structural animation are not animated. + * + * Note that even if `ngAnimateChildren` is set, no child animations will run when the parent element is removed from the DOM (`leave` animation). + * + * + * @param {string} ngAnimateChildren If the value is empty, `true` or `on`, + * then child animations are allowed. If the value is `false`, child animations are not allowed. + * + * @example + * + +
    + + +
    +
    +
    + List of items: +
    Item {{item}}
    +
    +
    +
    +
    + + + .container.ng-enter, + .container.ng-leave { + transition: all ease 1.5s; + } + + .container.ng-enter, + .container.ng-leave-active { + opacity: 0; + } + + .container.ng-leave, + .container.ng-enter-active { + opacity: 1; + } + + .item { + background: firebrick; + color: #FFF; + margin-bottom: 10px; + } + + .item.ng-enter, + .item.ng-leave { + transition: transform 1.5s ease; + } + + .item.ng-enter { + transform: translateX(50px); + } + + .item.ng-enter-active { + transform: translateX(0); + } + + + angular.module('ngAnimateChildren', ['ngAnimate']) + .controller('MainController', function MainController() { + this.animateChildren = false; + this.enterElement = false; + }); + +
    + */ +var $$AnimateChildrenDirective = ['$interpolate', function($interpolate) { + return { + link: function(scope, element, attrs) { + var val = attrs.ngAnimateChildren; + if (isString(val) && val.length === 0) { //empty attribute + element.data(NG_ANIMATE_CHILDREN_DATA, true); + } else { + // Interpolate and set the value, so that it is available to + // animations that run right after compilation + setData($interpolate(val)(scope)); + attrs.$observe('ngAnimateChildren', setData); + } + + function setData(value) { + value = value === 'on' || value === 'true'; + element.data(NG_ANIMATE_CHILDREN_DATA, value); + } + } + }; +}]; + +/* exported $AnimateCssProvider */ + +var ANIMATE_TIMER_KEY = '$$animateCss'; + +/** + * @ngdoc service + * @name $animateCss + * @kind object + * + * @description + * The `$animateCss` service is a useful utility to trigger customized CSS-based transitions/keyframes + * from a JavaScript-based animation or directly from a directive. The purpose of `$animateCss` is NOT + * to side-step how `$animate` and ngAnimate work, but the goal is to allow pre-existing animations or + * directives to create more complex animations that can be purely driven using CSS code. + * + * Note that only browsers that support CSS transitions and/or keyframe animations are capable of + * rendering animations triggered via `$animateCss` (bad news for IE9 and lower). + * + * ## General Use + * Once again, `$animateCss` is designed to be used inside of a registered JavaScript animation that + * is powered by ngAnimate. It is possible to use `$animateCss` directly inside of a directive, however, + * any automatic control over cancelling animations and/or preventing animations from being run on + * child elements will not be handled by AngularJS. For this to work as expected, please use `$animate` to + * trigger the animation and then setup a JavaScript animation that injects `$animateCss` to trigger + * the CSS animation. + * + * The example below shows how we can create a folding animation on an element using `ng-if`: + * + * ```html + * + *
    + * This element will go BOOM + *
    + * + * ``` + * + * Now we create the **JavaScript animation** that will trigger the CSS transition: + * + * ```js + * ngModule.animation('.fold-animation', ['$animateCss', function($animateCss) { + * return { + * enter: function(element, doneFn) { + * var height = element[0].offsetHeight; + * return $animateCss(element, { + * from: { height:'0px' }, + * to: { height:height + 'px' }, + * duration: 1 // one second + * }); + * } + * } + * }]); + * ``` + * + * ## More Advanced Uses + * + * `$animateCss` is the underlying code that ngAnimate uses to power **CSS-based animations** behind the scenes. Therefore CSS hooks + * like `.ng-EVENT`, `.ng-EVENT-active`, `.ng-EVENT-stagger` are all features that can be triggered using `$animateCss` via JavaScript code. + * + * This also means that just about any combination of adding classes, removing classes, setting styles, dynamically setting a keyframe animation, + * applying a hardcoded duration or delay value, changing the animation easing or applying a stagger animation are all options that work with + * `$animateCss`. The service itself is smart enough to figure out the combination of options and examine the element styling properties in order + * to provide a working animation that will run in CSS. + * + * The example below showcases a more advanced version of the `.fold-animation` from the example above: + * + * ```js + * ngModule.animation('.fold-animation', ['$animateCss', function($animateCss) { + * return { + * enter: function(element, doneFn) { + * var height = element[0].offsetHeight; + * return $animateCss(element, { + * addClass: 'red large-text pulse-twice', + * easing: 'ease-out', + * from: { height:'0px' }, + * to: { height:height + 'px' }, + * duration: 1 // one second + * }); + * } + * } + * }]); + * ``` + * + * Since we're adding/removing CSS classes then the CSS transition will also pick those up: + * + * ```css + * /* since a hardcoded duration value of 1 was provided in the JavaScript animation code, + * the CSS classes below will be transitioned despite them being defined as regular CSS classes */ + * .red { background:red; } + * .large-text { font-size:20px; } + * + * /* we can also use a keyframe animation and $animateCss will make it work alongside the transition */ + * .pulse-twice { + * animation: 0.5s pulse linear 2; + * -webkit-animation: 0.5s pulse linear 2; + * } + * + * @keyframes pulse { + * from { transform: scale(0.5); } + * to { transform: scale(1.5); } + * } + * + * @-webkit-keyframes pulse { + * from { -webkit-transform: scale(0.5); } + * to { -webkit-transform: scale(1.5); } + * } + * ``` + * + * Given this complex combination of CSS classes, styles and options, `$animateCss` will figure everything out and make the animation happen. + * + * ## How the Options are handled + * + * `$animateCss` is very versatile and intelligent when it comes to figuring out what configurations to apply to the element to ensure the animation + * works with the options provided. Say for example we were adding a class that contained a keyframe value and we wanted to also animate some inline + * styles using the `from` and `to` properties. + * + * ```js + * var animator = $animateCss(element, { + * from: { background:'red' }, + * to: { background:'blue' } + * }); + * animator.start(); + * ``` + * + * ```css + * .rotating-animation { + * animation:0.5s rotate linear; + * -webkit-animation:0.5s rotate linear; + * } + * + * @keyframes rotate { + * from { transform: rotate(0deg); } + * to { transform: rotate(360deg); } + * } + * + * @-webkit-keyframes rotate { + * from { -webkit-transform: rotate(0deg); } + * to { -webkit-transform: rotate(360deg); } + * } + * ``` + * + * The missing pieces here are that we do not have a transition set (within the CSS code nor within the `$animateCss` options) and the duration of the animation is + * going to be detected from what the keyframe styles on the CSS class are. In this event, `$animateCss` will automatically create an inline transition + * style matching the duration detected from the keyframe style (which is present in the CSS class that is being added) and then prepare both the transition + * and keyframe animations to run in parallel on the element. Then when the animation is underway the provided `from` and `to` CSS styles will be applied + * and spread across the transition and keyframe animation. + * + * ## What is returned + * + * `$animateCss` works in two stages: a preparation phase and an animation phase. Therefore when `$animateCss` is first called it will NOT actually + * start the animation. All that is going on here is that the element is being prepared for the animation (which means that the generated CSS classes are + * added and removed on the element). Once `$animateCss` is called it will return an object with the following properties: + * + * ```js + * var animator = $animateCss(element, { ... }); + * ``` + * + * Now what do the contents of our `animator` variable look like: + * + * ```js + * { + * // starts the animation + * start: Function, + * + * // ends (aborts) the animation + * end: Function + * } + * ``` + * + * To actually start the animation we need to run `animation.start()` which will then return a promise that we can hook into to detect when the animation ends. + * If we choose not to run the animation then we MUST run `animation.end()` to perform a cleanup on the element (since some CSS classes and styles may have been + * applied to the element during the preparation phase). Note that all other properties such as duration, delay, transitions and keyframes are just properties + * and that changing them will not reconfigure the parameters of the animation. + * + * ### runner.done() vs runner.then() + * It is documented that `animation.start()` will return a promise object and this is true, however, there is also an additional method available on the + * runner called `.done(callbackFn)`. The done method works the same as `.finally(callbackFn)`, however, it does **not trigger a digest to occur**. + * Therefore, for performance reasons, it's always best to use `runner.done(callback)` instead of `runner.then()`, `runner.catch()` or `runner.finally()` + * unless you really need a digest to kick off afterwards. + * + * Keep in mind that, to make this easier, ngAnimate has tweaked the JS animations API to recognize when a runner instance is returned from $animateCss + * (so there is no need to call `runner.done(doneFn)` inside of your JavaScript animation code). + * Check the {@link ngAnimate.$animateCss#usage animation code above} to see how this works. + * + * @param {DOMElement} element the element that will be animated + * @param {object} options the animation-related options that will be applied during the animation + * + * * `event` - The DOM event (e.g. enter, leave, move). When used, a generated CSS class of `ng-EVENT` and `ng-EVENT-active` will be applied + * to the element during the animation. Multiple events can be provided when spaces are used as a separator. (Note that this will not perform any DOM operation.) + * * `structural` - Indicates that the `ng-` prefix will be added to the event class. Setting to `false` or omitting will turn `ng-EVENT` and + * `ng-EVENT-active` in `EVENT` and `EVENT-active`. Unused if `event` is omitted. + * * `easing` - The CSS easing value that will be applied to the transition or keyframe animation (or both). + * * `transitionStyle` - The raw CSS transition style that will be used (e.g. `1s linear all`). + * * `keyframeStyle` - The raw CSS keyframe animation style that will be used (e.g. `1s my_animation linear`). + * * `from` - The starting CSS styles (a key/value object) that will be applied at the start of the animation. + * * `to` - The ending CSS styles (a key/value object) that will be applied across the animation via a CSS transition. + * * `addClass` - A space separated list of CSS classes that will be added to the element and spread across the animation. + * * `removeClass` - A space separated list of CSS classes that will be removed from the element and spread across the animation. + * * `duration` - A number value representing the total duration of the transition and/or keyframe (note that a value of 1 is 1000ms). If a value of `0` + * is provided then the animation will be skipped entirely. + * * `delay` - A number value representing the total delay of the transition and/or keyframe (note that a value of 1 is 1000ms). If a value of `true` is + * used then whatever delay value is detected from the CSS classes will be mirrored on the elements styles (e.g. by setting delay true then the style value + * of the element will be `transition-delay: DETECTED_VALUE`). Using `true` is useful when you want the CSS classes and inline styles to all share the same + * CSS delay value. + * * `stagger` - A numeric time value representing the delay between successively animated elements + * ({@link ngAnimate#css-staggering-animations Click here to learn how CSS-based staggering works in ngAnimate.}) + * * `staggerIndex` - The numeric index representing the stagger item (e.g. a value of 5 is equal to the sixth item in the stagger; therefore when a + * `stagger` option value of `0.1` is used then there will be a stagger delay of `600ms`) + * * `applyClassesEarly` - Whether or not the classes being added or removed will be used when detecting the animation. This is set by `$animate` when enter/leave/move animations are fired to ensure that the CSS classes are resolved in time. (Note that this will prevent any transitions from occurring on the classes being added and removed.) + * * `cleanupStyles` - Whether or not the provided `from` and `to` styles will be removed once + * the animation is closed. This is useful for when the styles are used purely for the sake of + * the animation and do not have a lasting visual effect on the element (e.g. a collapse and open animation). + * By default this value is set to `false`. + * + * @return {object} an object with start and end methods and details about the animation. + * + * * `start` - The method to start the animation. This will return a `Promise` when called. + * * `end` - This method will cancel the animation and remove all applied CSS classes and styles. + */ +var ONE_SECOND = 1000; + +var ELAPSED_TIME_MAX_DECIMAL_PLACES = 3; +var CLOSING_TIME_BUFFER = 1.5; + +var DETECT_CSS_PROPERTIES = { + transitionDuration: TRANSITION_DURATION_PROP, + transitionDelay: TRANSITION_DELAY_PROP, + transitionProperty: TRANSITION_PROP + PROPERTY_KEY, + animationDuration: ANIMATION_DURATION_PROP, + animationDelay: ANIMATION_DELAY_PROP, + animationIterationCount: ANIMATION_PROP + ANIMATION_ITERATION_COUNT_KEY +}; + +var DETECT_STAGGER_CSS_PROPERTIES = { + transitionDuration: TRANSITION_DURATION_PROP, + transitionDelay: TRANSITION_DELAY_PROP, + animationDuration: ANIMATION_DURATION_PROP, + animationDelay: ANIMATION_DELAY_PROP +}; + +function getCssKeyframeDurationStyle(duration) { + return [ANIMATION_DURATION_PROP, duration + 's']; +} + +function getCssDelayStyle(delay, isKeyframeAnimation) { + var prop = isKeyframeAnimation ? ANIMATION_DELAY_PROP : TRANSITION_DELAY_PROP; + return [prop, delay + 's']; +} + +function computeCssStyles($window, element, properties) { + var styles = Object.create(null); + var detectedStyles = $window.getComputedStyle(element) || {}; + forEach(properties, function(formalStyleName, actualStyleName) { + var val = detectedStyles[formalStyleName]; + if (val) { + var c = val.charAt(0); + + // only numerical-based values have a negative sign or digit as the first value + if (c === '-' || c === '+' || c >= 0) { + val = parseMaxTime(val); + } + + // by setting this to null in the event that the delay is not set or is set directly as 0 + // then we can still allow for negative values to be used later on and not mistake this + // value for being greater than any other negative value. + if (val === 0) { + val = null; + } + styles[actualStyleName] = val; + } + }); + + return styles; +} + +function parseMaxTime(str) { + var maxValue = 0; + var values = str.split(/\s*,\s*/); + forEach(values, function(value) { + // it's always safe to consider only second values and omit `ms` values since + // getComputedStyle will always handle the conversion for us + if (value.charAt(value.length - 1) === 's') { + value = value.substring(0, value.length - 1); + } + value = parseFloat(value) || 0; + maxValue = maxValue ? Math.max(value, maxValue) : value; + }); + return maxValue; +} + +function truthyTimingValue(val) { + return val === 0 || val != null; +} + +function getCssTransitionDurationStyle(duration, applyOnlyDuration) { + var style = TRANSITION_PROP; + var value = duration + 's'; + if (applyOnlyDuration) { + style += DURATION_KEY; + } else { + value += ' linear all'; + } + return [style, value]; +} + +// we do not reassign an already present style value since +// if we detect the style property value again we may be +// detecting styles that were added via the `from` styles. +// We make use of `isDefined` here since an empty string +// or null value (which is what getPropertyValue will return +// for a non-existing style) will still be marked as a valid +// value for the style (a falsy value implies that the style +// is to be removed at the end of the animation). If we had a simple +// "OR" statement then it would not be enough to catch that. +function registerRestorableStyles(backup, node, properties) { + forEach(properties, function(prop) { + backup[prop] = isDefined(backup[prop]) + ? backup[prop] + : node.style.getPropertyValue(prop); + }); +} + +var $AnimateCssProvider = ['$animateProvider', /** @this */ function($animateProvider) { + + this.$get = ['$window', '$$jqLite', '$$AnimateRunner', '$timeout', '$$animateCache', + '$$forceReflow', '$sniffer', '$$rAFScheduler', '$$animateQueue', + function($window, $$jqLite, $$AnimateRunner, $timeout, $$animateCache, + $$forceReflow, $sniffer, $$rAFScheduler, $$animateQueue) { + + var applyAnimationClasses = applyAnimationClassesFactory($$jqLite); + + function computeCachedCssStyles(node, className, cacheKey, allowNoDuration, properties) { + var timings = $$animateCache.get(cacheKey); + + if (!timings) { + timings = computeCssStyles($window, node, properties); + if (timings.animationIterationCount === 'infinite') { + timings.animationIterationCount = 1; + } + } + + // if a css animation has no duration we + // should mark that so that repeated addClass/removeClass calls are skipped + var hasDuration = allowNoDuration || (timings.transitionDuration > 0 || timings.animationDuration > 0); + + // we keep putting this in multiple times even though the value and the cacheKey are the same + // because we're keeping an internal tally of how many duplicate animations are detected. + $$animateCache.put(cacheKey, timings, hasDuration); + + return timings; + } + + function computeCachedCssStaggerStyles(node, className, cacheKey, properties) { + var stagger; + var staggerCacheKey = 'stagger-' + cacheKey; + + // if we have one or more existing matches of matching elements + // containing the same parent + CSS styles (which is how cacheKey works) + // then staggering is possible + if ($$animateCache.count(cacheKey) > 0) { + stagger = $$animateCache.get(staggerCacheKey); + + if (!stagger) { + var staggerClassName = pendClasses(className, '-stagger'); + + $$jqLite.addClass(node, staggerClassName); + + stagger = computeCssStyles($window, node, properties); + + // force the conversion of a null value to zero incase not set + stagger.animationDuration = Math.max(stagger.animationDuration, 0); + stagger.transitionDuration = Math.max(stagger.transitionDuration, 0); + + $$jqLite.removeClass(node, staggerClassName); + + $$animateCache.put(staggerCacheKey, stagger, true); + } + } + + return stagger || {}; + } + + var rafWaitQueue = []; + function waitUntilQuiet(callback) { + rafWaitQueue.push(callback); + $$rAFScheduler.waitUntilQuiet(function() { + $$animateCache.flush(); + + // DO NOT REMOVE THIS LINE OR REFACTOR OUT THE `pageWidth` variable. + // PLEASE EXAMINE THE `$$forceReflow` service to understand why. + var pageWidth = $$forceReflow(); + + // we use a for loop to ensure that if the queue is changed + // during this looping then it will consider new requests + for (var i = 0; i < rafWaitQueue.length; i++) { + rafWaitQueue[i](pageWidth); + } + rafWaitQueue.length = 0; + }); + } + + function computeTimings(node, className, cacheKey, allowNoDuration) { + var timings = computeCachedCssStyles(node, className, cacheKey, allowNoDuration, DETECT_CSS_PROPERTIES); + var aD = timings.animationDelay; + var tD = timings.transitionDelay; + timings.maxDelay = aD && tD + ? Math.max(aD, tD) + : (aD || tD); + timings.maxDuration = Math.max( + timings.animationDuration * timings.animationIterationCount, + timings.transitionDuration); + + return timings; + } + + return function init(element, initialOptions) { + // all of the animation functions should create + // a copy of the options data, however, if a + // parent service has already created a copy then + // we should stick to using that + var options = initialOptions || {}; + if (!options.$$prepared) { + options = prepareAnimationOptions(copy(options)); + } + + var restoreStyles = {}; + var node = getDomNode(element); + if (!node + || !node.parentNode + || !$$animateQueue.enabled()) { + return closeAndReturnNoopAnimator(); + } + + var temporaryStyles = []; + var classes = element.attr('class'); + var styles = packageStyles(options); + var animationClosed; + var animationPaused; + var animationCompleted; + var runner; + var runnerHost; + var maxDelay; + var maxDelayTime; + var maxDuration; + var maxDurationTime; + var startTime; + var events = []; + + if (options.duration === 0 || (!$sniffer.animations && !$sniffer.transitions)) { + return closeAndReturnNoopAnimator(); + } + + var method = options.event && isArray(options.event) + ? options.event.join(' ') + : options.event; + + var isStructural = method && options.structural; + var structuralClassName = ''; + var addRemoveClassName = ''; + + if (isStructural) { + structuralClassName = pendClasses(method, EVENT_CLASS_PREFIX, true); + } else if (method) { + structuralClassName = method; + } + + if (options.addClass) { + addRemoveClassName += pendClasses(options.addClass, ADD_CLASS_SUFFIX); + } + + if (options.removeClass) { + if (addRemoveClassName.length) { + addRemoveClassName += ' '; + } + addRemoveClassName += pendClasses(options.removeClass, REMOVE_CLASS_SUFFIX); + } + + // there may be a situation where a structural animation is combined together + // with CSS classes that need to resolve before the animation is computed. + // However this means that there is no explicit CSS code to block the animation + // from happening (by setting 0s none in the class name). If this is the case + // we need to apply the classes before the first rAF so we know to continue if + // there actually is a detected transition or keyframe animation + if (options.applyClassesEarly && addRemoveClassName.length) { + applyAnimationClasses(element, options); + } + + var preparationClasses = [structuralClassName, addRemoveClassName].join(' ').trim(); + var fullClassName = classes + ' ' + preparationClasses; + var hasToStyles = styles.to && Object.keys(styles.to).length > 0; + var containsKeyframeAnimation = (options.keyframeStyle || '').length > 0; + + // there is no way we can trigger an animation if no styles and + // no classes are being applied which would then trigger a transition, + // unless there a is raw keyframe value that is applied to the element. + if (!containsKeyframeAnimation + && !hasToStyles + && !preparationClasses) { + return closeAndReturnNoopAnimator(); + } + + var stagger, cacheKey = $$animateCache.cacheKey(node, method, options.addClass, options.removeClass); + if ($$animateCache.containsCachedAnimationWithoutDuration(cacheKey)) { + preparationClasses = null; + return closeAndReturnNoopAnimator(); + } + + if (options.stagger > 0) { + var staggerVal = parseFloat(options.stagger); + stagger = { + transitionDelay: staggerVal, + animationDelay: staggerVal, + transitionDuration: 0, + animationDuration: 0 + }; + } else { + stagger = computeCachedCssStaggerStyles(node, preparationClasses, cacheKey, DETECT_STAGGER_CSS_PROPERTIES); + } + + if (!options.$$skipPreparationClasses) { + $$jqLite.addClass(element, preparationClasses); + } + + var applyOnlyDuration; + + if (options.transitionStyle) { + var transitionStyle = [TRANSITION_PROP, options.transitionStyle]; + applyInlineStyle(node, transitionStyle); + temporaryStyles.push(transitionStyle); + } + + if (options.duration >= 0) { + applyOnlyDuration = node.style[TRANSITION_PROP].length > 0; + var durationStyle = getCssTransitionDurationStyle(options.duration, applyOnlyDuration); + + // we set the duration so that it will be picked up by getComputedStyle later + applyInlineStyle(node, durationStyle); + temporaryStyles.push(durationStyle); + } + + if (options.keyframeStyle) { + var keyframeStyle = [ANIMATION_PROP, options.keyframeStyle]; + applyInlineStyle(node, keyframeStyle); + temporaryStyles.push(keyframeStyle); + } + + var itemIndex = stagger + ? options.staggerIndex >= 0 + ? options.staggerIndex + : $$animateCache.count(cacheKey) + : 0; + + var isFirst = itemIndex === 0; + + // this is a pre-emptive way of forcing the setup classes to be added and applied INSTANTLY + // without causing any combination of transitions to kick in. By adding a negative delay value + // it forces the setup class' transition to end immediately. We later then remove the negative + // transition delay to allow for the transition to naturally do it's thing. The beauty here is + // that if there is no transition defined then nothing will happen and this will also allow + // other transitions to be stacked on top of each other without any chopping them out. + if (isFirst && !options.skipBlocking) { + helpers.blockTransitions(node, SAFE_FAST_FORWARD_DURATION_VALUE); + } + + var timings = computeTimings(node, fullClassName, cacheKey, !isStructural); + var relativeDelay = timings.maxDelay; + maxDelay = Math.max(relativeDelay, 0); + maxDuration = timings.maxDuration; + + var flags = {}; + flags.hasTransitions = timings.transitionDuration > 0; + flags.hasAnimations = timings.animationDuration > 0; + flags.hasTransitionAll = flags.hasTransitions && timings.transitionProperty === 'all'; + flags.applyTransitionDuration = hasToStyles && ( + (flags.hasTransitions && !flags.hasTransitionAll) + || (flags.hasAnimations && !flags.hasTransitions)); + flags.applyAnimationDuration = options.duration && flags.hasAnimations; + flags.applyTransitionDelay = truthyTimingValue(options.delay) && (flags.applyTransitionDuration || flags.hasTransitions); + flags.applyAnimationDelay = truthyTimingValue(options.delay) && flags.hasAnimations; + flags.recalculateTimingStyles = addRemoveClassName.length > 0; + + if (flags.applyTransitionDuration || flags.applyAnimationDuration) { + maxDuration = options.duration ? parseFloat(options.duration) : maxDuration; + + if (flags.applyTransitionDuration) { + flags.hasTransitions = true; + timings.transitionDuration = maxDuration; + applyOnlyDuration = node.style[TRANSITION_PROP + PROPERTY_KEY].length > 0; + temporaryStyles.push(getCssTransitionDurationStyle(maxDuration, applyOnlyDuration)); + } + + if (flags.applyAnimationDuration) { + flags.hasAnimations = true; + timings.animationDuration = maxDuration; + temporaryStyles.push(getCssKeyframeDurationStyle(maxDuration)); + } + } + + if (maxDuration === 0 && !flags.recalculateTimingStyles) { + return closeAndReturnNoopAnimator(); + } + + var activeClasses = pendClasses(preparationClasses, ACTIVE_CLASS_SUFFIX); + + if (options.delay != null) { + var delayStyle; + if (typeof options.delay !== 'boolean') { + delayStyle = parseFloat(options.delay); + // number in options.delay means we have to recalculate the delay for the closing timeout + maxDelay = Math.max(delayStyle, 0); + } + + if (flags.applyTransitionDelay) { + temporaryStyles.push(getCssDelayStyle(delayStyle)); + } + + if (flags.applyAnimationDelay) { + temporaryStyles.push(getCssDelayStyle(delayStyle, true)); + } + } + + // we need to recalculate the delay value since we used a pre-emptive negative + // delay value and the delay value is required for the final event checking. This + // property will ensure that this will happen after the RAF phase has passed. + if (options.duration == null && timings.transitionDuration > 0) { + flags.recalculateTimingStyles = flags.recalculateTimingStyles || isFirst; + } + + maxDelayTime = maxDelay * ONE_SECOND; + maxDurationTime = maxDuration * ONE_SECOND; + if (!options.skipBlocking) { + flags.blockTransition = timings.transitionDuration > 0; + flags.blockKeyframeAnimation = timings.animationDuration > 0 && + stagger.animationDelay > 0 && + stagger.animationDuration === 0; + } + + if (options.from) { + if (options.cleanupStyles) { + registerRestorableStyles(restoreStyles, node, Object.keys(options.from)); + } + applyAnimationFromStyles(element, options); + } + + if (flags.blockTransition || flags.blockKeyframeAnimation) { + applyBlocking(maxDuration); + } else if (!options.skipBlocking) { + helpers.blockTransitions(node, false); + } + + // TODO(matsko): for 1.5 change this code to have an animator object for better debugging + return { + $$willAnimate: true, + end: endFn, + start: function() { + if (animationClosed) return; + + runnerHost = { + end: endFn, + cancel: cancelFn, + resume: null, //this will be set during the start() phase + pause: null + }; + + runner = new $$AnimateRunner(runnerHost); + + waitUntilQuiet(start); + + // we don't have access to pause/resume the animation + // since it hasn't run yet. AnimateRunner will therefore + // set noop functions for resume and pause and they will + // later be overridden once the animation is triggered + return runner; + } + }; + + function endFn() { + close(); + } + + function cancelFn() { + close(true); + } + + function close(rejected) { + // if the promise has been called already then we shouldn't close + // the animation again + if (animationClosed || (animationCompleted && animationPaused)) return; + animationClosed = true; + animationPaused = false; + + if (preparationClasses && !options.$$skipPreparationClasses) { + $$jqLite.removeClass(element, preparationClasses); + } + + if (activeClasses) { + $$jqLite.removeClass(element, activeClasses); + } + + blockKeyframeAnimations(node, false); + helpers.blockTransitions(node, false); + + forEach(temporaryStyles, function(entry) { + // There is only one way to remove inline style properties entirely from elements. + // By using `removeProperty` this works, but we need to convert camel-cased CSS + // styles down to hyphenated values. + node.style[entry[0]] = ''; + }); + + applyAnimationClasses(element, options); + applyAnimationStyles(element, options); + + if (Object.keys(restoreStyles).length) { + forEach(restoreStyles, function(value, prop) { + if (value) { + node.style.setProperty(prop, value); + } else { + node.style.removeProperty(prop); + } + }); + } + + // the reason why we have this option is to allow a synchronous closing callback + // that is fired as SOON as the animation ends (when the CSS is removed) or if + // the animation never takes off at all. A good example is a leave animation since + // the element must be removed just after the animation is over or else the element + // will appear on screen for one animation frame causing an overbearing flicker. + if (options.onDone) { + options.onDone(); + } + + if (events && events.length) { + // Remove the transitionend / animationend listener(s) + element.off(events.join(' '), onAnimationProgress); + } + + //Cancel the fallback closing timeout and remove the timer data + var animationTimerData = element.data(ANIMATE_TIMER_KEY); + if (animationTimerData) { + $timeout.cancel(animationTimerData[0].timer); + element.removeData(ANIMATE_TIMER_KEY); + } + + // if the preparation function fails then the promise is not setup + if (runner) { + runner.complete(!rejected); + } + } + + function applyBlocking(duration) { + if (flags.blockTransition) { + helpers.blockTransitions(node, duration); + } + + if (flags.blockKeyframeAnimation) { + blockKeyframeAnimations(node, !!duration); + } + } + + function closeAndReturnNoopAnimator() { + runner = new $$AnimateRunner({ + end: endFn, + cancel: cancelFn + }); + + // should flush the cache animation + waitUntilQuiet(noop); + close(); + + return { + $$willAnimate: false, + start: function() { + return runner; + }, + end: endFn + }; + } + + function onAnimationProgress(event) { + event.stopPropagation(); + var ev = event.originalEvent || event; + + if (ev.target !== node) { + // Since TransitionEvent / AnimationEvent bubble up, + // we have to ignore events by finished child animations + return; + } + + // we now always use `Date.now()` due to the recent changes with + // event.timeStamp in Firefox, Webkit and Chrome (see #13494 for more info) + var timeStamp = ev.$manualTimeStamp || Date.now(); + + /* Firefox (or possibly just Gecko) likes to not round values up + * when a ms measurement is used for the animation */ + var elapsedTime = parseFloat(ev.elapsedTime.toFixed(ELAPSED_TIME_MAX_DECIMAL_PLACES)); + + /* $manualTimeStamp is a mocked timeStamp value which is set + * within browserTrigger(). This is only here so that tests can + * mock animations properly. Real events fallback to event.timeStamp, + * or, if they don't, then a timeStamp is automatically created for them. + * We're checking to see if the timeStamp surpasses the expected delay, + * but we're using elapsedTime instead of the timeStamp on the 2nd + * pre-condition since animationPauseds sometimes close off early */ + if (Math.max(timeStamp - startTime, 0) >= maxDelayTime && elapsedTime >= maxDuration) { + // we set this flag to ensure that if the transition is paused then, when resumed, + // the animation will automatically close itself since transitions cannot be paused. + animationCompleted = true; + close(); + } + } + + function start() { + if (animationClosed) return; + if (!node.parentNode) { + close(); + return; + } + + // even though we only pause keyframe animations here the pause flag + // will still happen when transitions are used. Only the transition will + // not be paused since that is not possible. If the animation ends when + // paused then it will not complete until unpaused or cancelled. + var playPause = function(playAnimation) { + if (!animationCompleted) { + animationPaused = !playAnimation; + if (timings.animationDuration) { + var value = blockKeyframeAnimations(node, animationPaused); + if (animationPaused) { + temporaryStyles.push(value); + } else { + removeFromArray(temporaryStyles, value); + } + } + } else if (animationPaused && playAnimation) { + animationPaused = false; + close(); + } + }; + + // checking the stagger duration prevents an accidentally cascade of the CSS delay style + // being inherited from the parent. If the transition duration is zero then we can safely + // rely that the delay value is an intentional stagger delay style. + var maxStagger = itemIndex > 0 + && ((timings.transitionDuration && stagger.transitionDuration === 0) || + (timings.animationDuration && stagger.animationDuration === 0)) + && Math.max(stagger.animationDelay, stagger.transitionDelay); + if (maxStagger) { + $timeout(triggerAnimationStart, + Math.floor(maxStagger * itemIndex * ONE_SECOND), + false); + } else { + triggerAnimationStart(); + } + + // this will decorate the existing promise runner with pause/resume methods + runnerHost.resume = function() { + playPause(true); + }; + + runnerHost.pause = function() { + playPause(false); + }; + + function triggerAnimationStart() { + // just incase a stagger animation kicks in when the animation + // itself was cancelled entirely + if (animationClosed) return; + + applyBlocking(false); + + forEach(temporaryStyles, function(entry) { + var key = entry[0]; + var value = entry[1]; + node.style[key] = value; + }); + + applyAnimationClasses(element, options); + $$jqLite.addClass(element, activeClasses); + + if (flags.recalculateTimingStyles) { + fullClassName = node.getAttribute('class') + ' ' + preparationClasses; + cacheKey = $$animateCache.cacheKey(node, method, options.addClass, options.removeClass); + + timings = computeTimings(node, fullClassName, cacheKey, false); + relativeDelay = timings.maxDelay; + maxDelay = Math.max(relativeDelay, 0); + maxDuration = timings.maxDuration; + + if (maxDuration === 0) { + close(); + return; + } + + flags.hasTransitions = timings.transitionDuration > 0; + flags.hasAnimations = timings.animationDuration > 0; + } + + if (flags.applyAnimationDelay) { + relativeDelay = typeof options.delay !== 'boolean' && truthyTimingValue(options.delay) + ? parseFloat(options.delay) + : relativeDelay; + + maxDelay = Math.max(relativeDelay, 0); + timings.animationDelay = relativeDelay; + delayStyle = getCssDelayStyle(relativeDelay, true); + temporaryStyles.push(delayStyle); + node.style[delayStyle[0]] = delayStyle[1]; + } + + maxDelayTime = maxDelay * ONE_SECOND; + maxDurationTime = maxDuration * ONE_SECOND; + + if (options.easing) { + var easeProp, easeVal = options.easing; + if (flags.hasTransitions) { + easeProp = TRANSITION_PROP + TIMING_KEY; + temporaryStyles.push([easeProp, easeVal]); + node.style[easeProp] = easeVal; + } + if (flags.hasAnimations) { + easeProp = ANIMATION_PROP + TIMING_KEY; + temporaryStyles.push([easeProp, easeVal]); + node.style[easeProp] = easeVal; + } + } + + if (timings.transitionDuration) { + events.push(TRANSITIONEND_EVENT); + } + + if (timings.animationDuration) { + events.push(ANIMATIONEND_EVENT); + } + + startTime = Date.now(); + var timerTime = maxDelayTime + CLOSING_TIME_BUFFER * maxDurationTime; + var endTime = startTime + timerTime; + + var animationsData = element.data(ANIMATE_TIMER_KEY) || []; + var setupFallbackTimer = true; + if (animationsData.length) { + var currentTimerData = animationsData[0]; + setupFallbackTimer = endTime > currentTimerData.expectedEndTime; + if (setupFallbackTimer) { + $timeout.cancel(currentTimerData.timer); + } else { + animationsData.push(close); + } + } + + if (setupFallbackTimer) { + var timer = $timeout(onAnimationExpired, timerTime, false); + animationsData[0] = { + timer: timer, + expectedEndTime: endTime + }; + animationsData.push(close); + element.data(ANIMATE_TIMER_KEY, animationsData); + } + + if (events.length) { + element.on(events.join(' '), onAnimationProgress); + } + + if (options.to) { + if (options.cleanupStyles) { + registerRestorableStyles(restoreStyles, node, Object.keys(options.to)); + } + applyAnimationToStyles(element, options); + } + } + + function onAnimationExpired() { + var animationsData = element.data(ANIMATE_TIMER_KEY); + + // this will be false in the event that the element was + // removed from the DOM (via a leave animation or something + // similar) + if (animationsData) { + for (var i = 1; i < animationsData.length; i++) { + animationsData[i](); + } + element.removeData(ANIMATE_TIMER_KEY); + } + } + } + }; + }]; +}]; + +var $$AnimateCssDriverProvider = ['$$animationProvider', /** @this */ function($$animationProvider) { + $$animationProvider.drivers.push('$$animateCssDriver'); + + var NG_ANIMATE_SHIM_CLASS_NAME = 'ng-animate-shim'; + var NG_ANIMATE_ANCHOR_CLASS_NAME = 'ng-anchor'; + + var NG_OUT_ANCHOR_CLASS_NAME = 'ng-anchor-out'; + var NG_IN_ANCHOR_CLASS_NAME = 'ng-anchor-in'; + + function isDocumentFragment(node) { + return node.parentNode && node.parentNode.nodeType === 11; + } + + this.$get = ['$animateCss', '$rootScope', '$$AnimateRunner', '$rootElement', '$sniffer', '$$jqLite', '$document', + function($animateCss, $rootScope, $$AnimateRunner, $rootElement, $sniffer, $$jqLite, $document) { + + // only browsers that support these properties can render animations + if (!$sniffer.animations && !$sniffer.transitions) return noop; + + var bodyNode = $document[0].body; + var rootNode = getDomNode($rootElement); + + var rootBodyElement = jqLite( + // this is to avoid using something that exists outside of the body + // we also special case the doc fragment case because our unit test code + // appends the $rootElement to the body after the app has been bootstrapped + isDocumentFragment(rootNode) || bodyNode.contains(rootNode) ? rootNode : bodyNode + ); + + return function initDriverFn(animationDetails) { + return animationDetails.from && animationDetails.to + ? prepareFromToAnchorAnimation(animationDetails.from, + animationDetails.to, + animationDetails.classes, + animationDetails.anchors) + : prepareRegularAnimation(animationDetails); + }; + + function filterCssClasses(classes) { + //remove all the `ng-` stuff + return classes.replace(/\bng-\S+\b/g, ''); + } + + function getUniqueValues(a, b) { + if (isString(a)) a = a.split(' '); + if (isString(b)) b = b.split(' '); + return a.filter(function(val) { + return b.indexOf(val) === -1; + }).join(' '); + } + + function prepareAnchoredAnimation(classes, outAnchor, inAnchor) { + var clone = jqLite(getDomNode(outAnchor).cloneNode(true)); + var startingClasses = filterCssClasses(getClassVal(clone)); + + outAnchor.addClass(NG_ANIMATE_SHIM_CLASS_NAME); + inAnchor.addClass(NG_ANIMATE_SHIM_CLASS_NAME); + + clone.addClass(NG_ANIMATE_ANCHOR_CLASS_NAME); + + rootBodyElement.append(clone); + + var animatorIn, animatorOut = prepareOutAnimation(); + + // the user may not end up using the `out` animation and + // only making use of the `in` animation or vice-versa. + // In either case we should allow this and not assume the + // animation is over unless both animations are not used. + if (!animatorOut) { + animatorIn = prepareInAnimation(); + if (!animatorIn) { + return end(); + } + } + + var startingAnimator = animatorOut || animatorIn; + + return { + start: function() { + var runner; + + var currentAnimation = startingAnimator.start(); + currentAnimation.done(function() { + currentAnimation = null; + if (!animatorIn) { + animatorIn = prepareInAnimation(); + if (animatorIn) { + currentAnimation = animatorIn.start(); + currentAnimation.done(function() { + currentAnimation = null; + end(); + runner.complete(); + }); + return currentAnimation; + } + } + // in the event that there is no `in` animation + end(); + runner.complete(); + }); + + runner = new $$AnimateRunner({ + end: endFn, + cancel: endFn + }); + + return runner; + + function endFn() { + if (currentAnimation) { + currentAnimation.end(); + } + } + } + }; + + function calculateAnchorStyles(anchor) { + var styles = {}; + + var coords = getDomNode(anchor).getBoundingClientRect(); + + // we iterate directly since safari messes up and doesn't return + // all the keys for the coords object when iterated + forEach(['width','height','top','left'], function(key) { + var value = coords[key]; + switch (key) { + case 'top': + value += bodyNode.scrollTop; + break; + case 'left': + value += bodyNode.scrollLeft; + break; + } + styles[key] = Math.floor(value) + 'px'; + }); + return styles; + } + + function prepareOutAnimation() { + var animator = $animateCss(clone, { + addClass: NG_OUT_ANCHOR_CLASS_NAME, + delay: true, + from: calculateAnchorStyles(outAnchor) + }); + + // read the comment within `prepareRegularAnimation` to understand + // why this check is necessary + return animator.$$willAnimate ? animator : null; + } + + function getClassVal(element) { + return element.attr('class') || ''; + } + + function prepareInAnimation() { + var endingClasses = filterCssClasses(getClassVal(inAnchor)); + var toAdd = getUniqueValues(endingClasses, startingClasses); + var toRemove = getUniqueValues(startingClasses, endingClasses); + + var animator = $animateCss(clone, { + to: calculateAnchorStyles(inAnchor), + addClass: NG_IN_ANCHOR_CLASS_NAME + ' ' + toAdd, + removeClass: NG_OUT_ANCHOR_CLASS_NAME + ' ' + toRemove, + delay: true + }); + + // read the comment within `prepareRegularAnimation` to understand + // why this check is necessary + return animator.$$willAnimate ? animator : null; + } + + function end() { + clone.remove(); + outAnchor.removeClass(NG_ANIMATE_SHIM_CLASS_NAME); + inAnchor.removeClass(NG_ANIMATE_SHIM_CLASS_NAME); + } + } + + function prepareFromToAnchorAnimation(from, to, classes, anchors) { + var fromAnimation = prepareRegularAnimation(from, noop); + var toAnimation = prepareRegularAnimation(to, noop); + + var anchorAnimations = []; + forEach(anchors, function(anchor) { + var outElement = anchor['out']; + var inElement = anchor['in']; + var animator = prepareAnchoredAnimation(classes, outElement, inElement); + if (animator) { + anchorAnimations.push(animator); + } + }); + + // no point in doing anything when there are no elements to animate + if (!fromAnimation && !toAnimation && anchorAnimations.length === 0) return; + + return { + start: function() { + var animationRunners = []; + + if (fromAnimation) { + animationRunners.push(fromAnimation.start()); + } + + if (toAnimation) { + animationRunners.push(toAnimation.start()); + } + + forEach(anchorAnimations, function(animation) { + animationRunners.push(animation.start()); + }); + + var runner = new $$AnimateRunner({ + end: endFn, + cancel: endFn // CSS-driven animations cannot be cancelled, only ended + }); + + $$AnimateRunner.all(animationRunners, function(status) { + runner.complete(status); + }); + + return runner; + + function endFn() { + forEach(animationRunners, function(runner) { + runner.end(); + }); + } + } + }; + } + + function prepareRegularAnimation(animationDetails) { + var element = animationDetails.element; + var options = animationDetails.options || {}; + + if (animationDetails.structural) { + options.event = animationDetails.event; + options.structural = true; + options.applyClassesEarly = true; + + // we special case the leave animation since we want to ensure that + // the element is removed as soon as the animation is over. Otherwise + // a flicker might appear or the element may not be removed at all + if (animationDetails.event === 'leave') { + options.onDone = options.domOperation; + } + } + + // We assign the preparationClasses as the actual animation event since + // the internals of $animateCss will just suffix the event token values + // with `-active` to trigger the animation. + if (options.preparationClasses) { + options.event = concatWithSpace(options.event, options.preparationClasses); + } + + var animator = $animateCss(element, options); + + // the driver lookup code inside of $$animation attempts to spawn a + // driver one by one until a driver returns a.$$willAnimate animator object. + // $animateCss will always return an object, however, it will pass in + // a flag as a hint as to whether an animation was detected or not + return animator.$$willAnimate ? animator : null; + } + }]; +}]; + +// TODO(matsko): use caching here to speed things up for detection +// TODO(matsko): add documentation +// by the time... + +var $$AnimateJsProvider = ['$animateProvider', /** @this */ function($animateProvider) { + this.$get = ['$injector', '$$AnimateRunner', '$$jqLite', + function($injector, $$AnimateRunner, $$jqLite) { + + var applyAnimationClasses = applyAnimationClassesFactory($$jqLite); + // $animateJs(element, 'enter'); + return function(element, event, classes, options) { + var animationClosed = false; + + // the `classes` argument is optional and if it is not used + // then the classes will be resolved from the element's className + // property as well as options.addClass/options.removeClass. + if (arguments.length === 3 && isObject(classes)) { + options = classes; + classes = null; + } + + options = prepareAnimationOptions(options); + if (!classes) { + classes = element.attr('class') || ''; + if (options.addClass) { + classes += ' ' + options.addClass; + } + if (options.removeClass) { + classes += ' ' + options.removeClass; + } + } + + var classesToAdd = options.addClass; + var classesToRemove = options.removeClass; + + // the lookupAnimations function returns a series of animation objects that are + // matched up with one or more of the CSS classes. These animation objects are + // defined via the module.animation factory function. If nothing is detected then + // we don't return anything which then makes $animation query the next driver. + var animations = lookupAnimations(classes); + var before, after; + if (animations.length) { + var afterFn, beforeFn; + if (event === 'leave') { + beforeFn = 'leave'; + afterFn = 'afterLeave'; // TODO(matsko): get rid of this + } else { + beforeFn = 'before' + event.charAt(0).toUpperCase() + event.substr(1); + afterFn = event; + } + + if (event !== 'enter' && event !== 'move') { + before = packageAnimations(element, event, options, animations, beforeFn); + } + after = packageAnimations(element, event, options, animations, afterFn); + } + + // no matching animations + if (!before && !after) return; + + function applyOptions() { + options.domOperation(); + applyAnimationClasses(element, options); + } + + function close() { + animationClosed = true; + applyOptions(); + applyAnimationStyles(element, options); + } + + var runner; + + return { + $$willAnimate: true, + end: function() { + if (runner) { + runner.end(); + } else { + close(); + runner = new $$AnimateRunner(); + runner.complete(true); + } + return runner; + }, + start: function() { + if (runner) { + return runner; + } + + runner = new $$AnimateRunner(); + var closeActiveAnimations; + var chain = []; + + if (before) { + chain.push(function(fn) { + closeActiveAnimations = before(fn); + }); + } + + if (chain.length) { + chain.push(function(fn) { + applyOptions(); + fn(true); + }); + } else { + applyOptions(); + } + + if (after) { + chain.push(function(fn) { + closeActiveAnimations = after(fn); + }); + } + + runner.setHost({ + end: function() { + endAnimations(); + }, + cancel: function() { + endAnimations(true); + } + }); + + $$AnimateRunner.chain(chain, onComplete); + return runner; + + function onComplete(success) { + close(success); + runner.complete(success); + } + + function endAnimations(cancelled) { + if (!animationClosed) { + (closeActiveAnimations || noop)(cancelled); + onComplete(cancelled); + } + } + } + }; + + function executeAnimationFn(fn, element, event, options, onDone) { + var args; + switch (event) { + case 'animate': + args = [element, options.from, options.to, onDone]; + break; + + case 'setClass': + args = [element, classesToAdd, classesToRemove, onDone]; + break; + + case 'addClass': + args = [element, classesToAdd, onDone]; + break; + + case 'removeClass': + args = [element, classesToRemove, onDone]; + break; + + default: + args = [element, onDone]; + break; + } + + args.push(options); + + var value = fn.apply(fn, args); + if (value) { + if (isFunction(value.start)) { + value = value.start(); + } + + if (value instanceof $$AnimateRunner) { + value.done(onDone); + } else if (isFunction(value)) { + // optional onEnd / onCancel callback + return value; + } + } + + return noop; + } + + function groupEventedAnimations(element, event, options, animations, fnName) { + var operations = []; + forEach(animations, function(ani) { + var animation = ani[fnName]; + if (!animation) return; + + // note that all of these animations will run in parallel + operations.push(function() { + var runner; + var endProgressCb; + + var resolved = false; + var onAnimationComplete = function(rejected) { + if (!resolved) { + resolved = true; + (endProgressCb || noop)(rejected); + runner.complete(!rejected); + } + }; + + runner = new $$AnimateRunner({ + end: function() { + onAnimationComplete(); + }, + cancel: function() { + onAnimationComplete(true); + } + }); + + endProgressCb = executeAnimationFn(animation, element, event, options, function(result) { + var cancelled = result === false; + onAnimationComplete(cancelled); + }); + + return runner; + }); + }); + + return operations; + } + + function packageAnimations(element, event, options, animations, fnName) { + var operations = groupEventedAnimations(element, event, options, animations, fnName); + if (operations.length === 0) { + var a, b; + if (fnName === 'beforeSetClass') { + a = groupEventedAnimations(element, 'removeClass', options, animations, 'beforeRemoveClass'); + b = groupEventedAnimations(element, 'addClass', options, animations, 'beforeAddClass'); + } else if (fnName === 'setClass') { + a = groupEventedAnimations(element, 'removeClass', options, animations, 'removeClass'); + b = groupEventedAnimations(element, 'addClass', options, animations, 'addClass'); + } + + if (a) { + operations = operations.concat(a); + } + if (b) { + operations = operations.concat(b); + } + } + + if (operations.length === 0) return; + + // TODO(matsko): add documentation + return function startAnimation(callback) { + var runners = []; + if (operations.length) { + forEach(operations, function(animateFn) { + runners.push(animateFn()); + }); + } + + if (runners.length) { + $$AnimateRunner.all(runners, callback); + } else { + callback(); + } + + return function endFn(reject) { + forEach(runners, function(runner) { + if (reject) { + runner.cancel(); + } else { + runner.end(); + } + }); + }; + }; + } + }; + + function lookupAnimations(classes) { + classes = isArray(classes) ? classes : classes.split(' '); + var matches = [], flagMap = {}; + for (var i = 0; i < classes.length; i++) { + var klass = classes[i], + animationFactory = $animateProvider.$$registeredAnimations[klass]; + if (animationFactory && !flagMap[klass]) { + matches.push($injector.get(animationFactory)); + flagMap[klass] = true; + } + } + return matches; + } + }]; +}]; + +var $$AnimateJsDriverProvider = ['$$animationProvider', /** @this */ function($$animationProvider) { + $$animationProvider.drivers.push('$$animateJsDriver'); + this.$get = ['$$animateJs', '$$AnimateRunner', function($$animateJs, $$AnimateRunner) { + return function initDriverFn(animationDetails) { + if (animationDetails.from && animationDetails.to) { + var fromAnimation = prepareAnimation(animationDetails.from); + var toAnimation = prepareAnimation(animationDetails.to); + if (!fromAnimation && !toAnimation) return; + + return { + start: function() { + var animationRunners = []; + + if (fromAnimation) { + animationRunners.push(fromAnimation.start()); + } + + if (toAnimation) { + animationRunners.push(toAnimation.start()); + } + + $$AnimateRunner.all(animationRunners, done); + + var runner = new $$AnimateRunner({ + end: endFnFactory(), + cancel: endFnFactory() + }); + + return runner; + + function endFnFactory() { + return function() { + forEach(animationRunners, function(runner) { + // at this point we cannot cancel animations for groups just yet. 1.5+ + runner.end(); + }); + }; + } + + function done(status) { + runner.complete(status); + } + } + }; + } else { + return prepareAnimation(animationDetails); + } + }; + + function prepareAnimation(animationDetails) { + // TODO(matsko): make sure to check for grouped animations and delegate down to normal animations + var element = animationDetails.element; + var event = animationDetails.event; + var options = animationDetails.options; + var classes = animationDetails.classes; + return $$animateJs(element, event, classes, options); + } + }]; +}]; + +var NG_ANIMATE_ATTR_NAME = 'data-ng-animate'; +var NG_ANIMATE_PIN_DATA = '$ngAnimatePin'; +var $$AnimateQueueProvider = ['$animateProvider', /** @this */ function($animateProvider) { + var PRE_DIGEST_STATE = 1; + var RUNNING_STATE = 2; + var ONE_SPACE = ' '; + + var rules = this.rules = { + skip: [], + cancel: [], + join: [] + }; + + function getEventData(options) { + return { + addClass: options.addClass, + removeClass: options.removeClass, + from: options.from, + to: options.to + }; + } + + function makeTruthyCssClassMap(classString) { + if (!classString) { + return null; + } + + var keys = classString.split(ONE_SPACE); + var map = Object.create(null); + + forEach(keys, function(key) { + map[key] = true; + }); + return map; + } + + function hasMatchingClasses(newClassString, currentClassString) { + if (newClassString && currentClassString) { + var currentClassMap = makeTruthyCssClassMap(currentClassString); + return newClassString.split(ONE_SPACE).some(function(className) { + return currentClassMap[className]; + }); + } + } + + function isAllowed(ruleType, currentAnimation, previousAnimation) { + return rules[ruleType].some(function(fn) { + return fn(currentAnimation, previousAnimation); + }); + } + + function hasAnimationClasses(animation, and) { + var a = (animation.addClass || '').length > 0; + var b = (animation.removeClass || '').length > 0; + return and ? a && b : a || b; + } + + rules.join.push(function(newAnimation, currentAnimation) { + // if the new animation is class-based then we can just tack that on + return !newAnimation.structural && hasAnimationClasses(newAnimation); + }); + + rules.skip.push(function(newAnimation, currentAnimation) { + // there is no need to animate anything if no classes are being added and + // there is no structural animation that will be triggered + return !newAnimation.structural && !hasAnimationClasses(newAnimation); + }); + + rules.skip.push(function(newAnimation, currentAnimation) { + // why should we trigger a new structural animation if the element will + // be removed from the DOM anyway? + return currentAnimation.event === 'leave' && newAnimation.structural; + }); + + rules.skip.push(function(newAnimation, currentAnimation) { + // if there is an ongoing current animation then don't even bother running the class-based animation + return currentAnimation.structural && currentAnimation.state === RUNNING_STATE && !newAnimation.structural; + }); + + rules.cancel.push(function(newAnimation, currentAnimation) { + // there can never be two structural animations running at the same time + return currentAnimation.structural && newAnimation.structural; + }); + + rules.cancel.push(function(newAnimation, currentAnimation) { + // if the previous animation is already running, but the new animation will + // be triggered, but the new animation is structural + return currentAnimation.state === RUNNING_STATE && newAnimation.structural; + }); + + rules.cancel.push(function(newAnimation, currentAnimation) { + // cancel the animation if classes added / removed in both animation cancel each other out, + // but only if the current animation isn't structural + + if (currentAnimation.structural) return false; + + var nA = newAnimation.addClass; + var nR = newAnimation.removeClass; + var cA = currentAnimation.addClass; + var cR = currentAnimation.removeClass; + + // early detection to save the global CPU shortage :) + if ((isUndefined(nA) && isUndefined(nR)) || (isUndefined(cA) && isUndefined(cR))) { + return false; + } + + return hasMatchingClasses(nA, cR) || hasMatchingClasses(nR, cA); + }); + + this.$get = ['$$rAF', '$rootScope', '$rootElement', '$document', '$$Map', + '$$animation', '$$AnimateRunner', '$templateRequest', '$$jqLite', '$$forceReflow', + '$$isDocumentHidden', + function($$rAF, $rootScope, $rootElement, $document, $$Map, + $$animation, $$AnimateRunner, $templateRequest, $$jqLite, $$forceReflow, + $$isDocumentHidden) { + + var activeAnimationsLookup = new $$Map(); + var disabledElementsLookup = new $$Map(); + var animationsEnabled = null; + + function removeFromDisabledElementsLookup(evt) { + disabledElementsLookup.delete(evt.target); + } + + function postDigestTaskFactory() { + var postDigestCalled = false; + return function(fn) { + // we only issue a call to postDigest before + // it has first passed. This prevents any callbacks + // from not firing once the animation has completed + // since it will be out of the digest cycle. + if (postDigestCalled) { + fn(); + } else { + $rootScope.$$postDigest(function() { + postDigestCalled = true; + fn(); + }); + } + }; + } + + // Wait until all directive and route-related templates are downloaded and + // compiled. The $templateRequest.totalPendingRequests variable keeps track of + // all of the remote templates being currently downloaded. If there are no + // templates currently downloading then the watcher will still fire anyway. + var deregisterWatch = $rootScope.$watch( + function() { return $templateRequest.totalPendingRequests === 0; }, + function(isEmpty) { + if (!isEmpty) return; + deregisterWatch(); + + // Now that all templates have been downloaded, $animate will wait until + // the post digest queue is empty before enabling animations. By having two + // calls to $postDigest calls we can ensure that the flag is enabled at the + // very end of the post digest queue. Since all of the animations in $animate + // use $postDigest, it's important that the code below executes at the end. + // This basically means that the page is fully downloaded and compiled before + // any animations are triggered. + $rootScope.$$postDigest(function() { + $rootScope.$$postDigest(function() { + // we check for null directly in the event that the application already called + // .enabled() with whatever arguments that it provided it with + if (animationsEnabled === null) { + animationsEnabled = true; + } + }); + }); + } + ); + + var callbackRegistry = Object.create(null); + + // remember that the `customFilter`/`classNameFilter` are set during the + // provider/config stage therefore we can optimize here and setup helper functions + var customFilter = $animateProvider.customFilter(); + var classNameFilter = $animateProvider.classNameFilter(); + var returnTrue = function() { return true; }; + + var isAnimatableByFilter = customFilter || returnTrue; + var isAnimatableClassName = !classNameFilter ? returnTrue : function(node, options) { + var className = [node.getAttribute('class'), options.addClass, options.removeClass].join(' '); + return classNameFilter.test(className); + }; + + var applyAnimationClasses = applyAnimationClassesFactory($$jqLite); + + function normalizeAnimationDetails(element, animation) { + return mergeAnimationDetails(element, animation, {}); + } + + // IE9-11 has no method "contains" in SVG element and in Node.prototype. Bug #10259. + var contains = window.Node.prototype.contains || /** @this */ function(arg) { + // eslint-disable-next-line no-bitwise + return this === arg || !!(this.compareDocumentPosition(arg) & 16); + }; + + function findCallbacks(targetParentNode, targetNode, event) { + var matches = []; + var entries = callbackRegistry[event]; + if (entries) { + forEach(entries, function(entry) { + if (contains.call(entry.node, targetNode)) { + matches.push(entry.callback); + } else if (event === 'leave' && contains.call(entry.node, targetParentNode)) { + matches.push(entry.callback); + } + }); + } + + return matches; + } + + function filterFromRegistry(list, matchContainer, matchCallback) { + var containerNode = extractElementNode(matchContainer); + return list.filter(function(entry) { + var isMatch = entry.node === containerNode && + (!matchCallback || entry.callback === matchCallback); + return !isMatch; + }); + } + + function cleanupEventListeners(phase, node) { + if (phase === 'close' && !node.parentNode) { + // If the element is not attached to a parentNode, it has been removed by + // the domOperation, and we can safely remove the event callbacks + $animate.off(node); + } + } + + var $animate = { + on: function(event, container, callback) { + var node = extractElementNode(container); + callbackRegistry[event] = callbackRegistry[event] || []; + callbackRegistry[event].push({ + node: node, + callback: callback + }); + + // Remove the callback when the element is removed from the DOM + jqLite(container).on('$destroy', function() { + var animationDetails = activeAnimationsLookup.get(node); + + if (!animationDetails) { + // If there's an animation ongoing, the callback calling code will remove + // the event listeners. If we'd remove here, the callbacks would be removed + // before the animation ends + $animate.off(event, container, callback); + } + }); + }, + + off: function(event, container, callback) { + if (arguments.length === 1 && !isString(arguments[0])) { + container = arguments[0]; + for (var eventType in callbackRegistry) { + callbackRegistry[eventType] = filterFromRegistry(callbackRegistry[eventType], container); + } + + return; + } + + var entries = callbackRegistry[event]; + if (!entries) return; + + callbackRegistry[event] = arguments.length === 1 + ? null + : filterFromRegistry(entries, container, callback); + }, + + pin: function(element, parentElement) { + assertArg(isElement(element), 'element', 'not an element'); + assertArg(isElement(parentElement), 'parentElement', 'not an element'); + element.data(NG_ANIMATE_PIN_DATA, parentElement); + }, + + push: function(element, event, options, domOperation) { + options = options || {}; + options.domOperation = domOperation; + return queueAnimation(element, event, options); + }, + + // this method has four signatures: + // () - global getter + // (bool) - global setter + // (element) - element getter + // (element, bool) - element setter + enabled: function(element, bool) { + var argCount = arguments.length; + + if (argCount === 0) { + // () - Global getter + bool = !!animationsEnabled; + } else { + var hasElement = isElement(element); + + if (!hasElement) { + // (bool) - Global setter + bool = animationsEnabled = !!element; + } else { + var node = getDomNode(element); + + if (argCount === 1) { + // (element) - Element getter + bool = !disabledElementsLookup.get(node); + } else { + // (element, bool) - Element setter + if (!disabledElementsLookup.has(node)) { + // The element is added to the map for the first time. + // Create a listener to remove it on `$destroy` (to avoid memory leak). + jqLite(element).on('$destroy', removeFromDisabledElementsLookup); + } + disabledElementsLookup.set(node, !bool); + } + } + } + + return bool; + } + }; + + return $animate; + + function queueAnimation(originalElement, event, initialOptions) { + // we always make a copy of the options since + // there should never be any side effects on + // the input data when running `$animateCss`. + var options = copy(initialOptions); + + var element = stripCommentsFromElement(originalElement); + var node = getDomNode(element); + var parentNode = node && node.parentNode; + + options = prepareAnimationOptions(options); + + // we create a fake runner with a working promise. + // These methods will become available after the digest has passed + var runner = new $$AnimateRunner(); + + // this is used to trigger callbacks in postDigest mode + var runInNextPostDigestOrNow = postDigestTaskFactory(); + + if (isArray(options.addClass)) { + options.addClass = options.addClass.join(' '); + } + + if (options.addClass && !isString(options.addClass)) { + options.addClass = null; + } + + if (isArray(options.removeClass)) { + options.removeClass = options.removeClass.join(' '); + } + + if (options.removeClass && !isString(options.removeClass)) { + options.removeClass = null; + } + + if (options.from && !isObject(options.from)) { + options.from = null; + } + + if (options.to && !isObject(options.to)) { + options.to = null; + } + + // If animations are hard-disabled for the whole application there is no need to continue. + // There are also situations where a directive issues an animation for a jqLite wrapper that + // contains only comment nodes. In this case, there is no way we can perform an animation. + if (!animationsEnabled || + !node || + !isAnimatableByFilter(node, event, initialOptions) || + !isAnimatableClassName(node, options)) { + close(); + return runner; + } + + var isStructural = ['enter', 'move', 'leave'].indexOf(event) >= 0; + + var documentHidden = $$isDocumentHidden(); + + // This is a hard disable of all animations the element itself, therefore there is no need to + // continue further past this point if not enabled + // Animations are also disabled if the document is currently hidden (page is not visible + // to the user), because browsers slow down or do not flush calls to requestAnimationFrame + var skipAnimations = documentHidden || disabledElementsLookup.get(node); + var existingAnimation = (!skipAnimations && activeAnimationsLookup.get(node)) || {}; + var hasExistingAnimation = !!existingAnimation.state; + + // there is no point in traversing the same collection of parent ancestors if a followup + // animation will be run on the same element that already did all that checking work + if (!skipAnimations && (!hasExistingAnimation || existingAnimation.state !== PRE_DIGEST_STATE)) { + skipAnimations = !areAnimationsAllowed(node, parentNode, event); + } + + if (skipAnimations) { + // Callbacks should fire even if the document is hidden (regression fix for issue #14120) + if (documentHidden) notifyProgress(runner, event, 'start', getEventData(options)); + close(); + if (documentHidden) notifyProgress(runner, event, 'close', getEventData(options)); + return runner; + } + + if (isStructural) { + closeChildAnimations(node); + } + + var newAnimation = { + structural: isStructural, + element: element, + event: event, + addClass: options.addClass, + removeClass: options.removeClass, + close: close, + options: options, + runner: runner + }; + + if (hasExistingAnimation) { + var skipAnimationFlag = isAllowed('skip', newAnimation, existingAnimation); + if (skipAnimationFlag) { + if (existingAnimation.state === RUNNING_STATE) { + close(); + return runner; + } else { + mergeAnimationDetails(element, existingAnimation, newAnimation); + return existingAnimation.runner; + } + } + var cancelAnimationFlag = isAllowed('cancel', newAnimation, existingAnimation); + if (cancelAnimationFlag) { + if (existingAnimation.state === RUNNING_STATE) { + // this will end the animation right away and it is safe + // to do so since the animation is already running and the + // runner callback code will run in async + existingAnimation.runner.end(); + } else if (existingAnimation.structural) { + // this means that the animation is queued into a digest, but + // hasn't started yet. Therefore it is safe to run the close + // method which will call the runner methods in async. + existingAnimation.close(); + } else { + // this will merge the new animation options into existing animation options + mergeAnimationDetails(element, existingAnimation, newAnimation); + + return existingAnimation.runner; + } + } else { + // a joined animation means that this animation will take over the existing one + // so an example would involve a leave animation taking over an enter. Then when + // the postDigest kicks in the enter will be ignored. + var joinAnimationFlag = isAllowed('join', newAnimation, existingAnimation); + if (joinAnimationFlag) { + if (existingAnimation.state === RUNNING_STATE) { + normalizeAnimationDetails(element, newAnimation); + } else { + applyGeneratedPreparationClasses($$jqLite, element, isStructural ? event : null, options); + + event = newAnimation.event = existingAnimation.event; + options = mergeAnimationDetails(element, existingAnimation, newAnimation); + + //we return the same runner since only the option values of this animation will + //be fed into the `existingAnimation`. + return existingAnimation.runner; + } + } + } + } else { + // normalization in this case means that it removes redundant CSS classes that + // already exist (addClass) or do not exist (removeClass) on the element + normalizeAnimationDetails(element, newAnimation); + } + + // when the options are merged and cleaned up we may end up not having to do + // an animation at all, therefore we should check this before issuing a post + // digest callback. Structural animations will always run no matter what. + var isValidAnimation = newAnimation.structural; + if (!isValidAnimation) { + // animate (from/to) can be quickly checked first, otherwise we check if any classes are present + isValidAnimation = (newAnimation.event === 'animate' && Object.keys(newAnimation.options.to || {}).length > 0) + || hasAnimationClasses(newAnimation); + } + + if (!isValidAnimation) { + close(); + clearElementAnimationState(node); + return runner; + } + + // the counter keeps track of cancelled animations + var counter = (existingAnimation.counter || 0) + 1; + newAnimation.counter = counter; + + markElementAnimationState(node, PRE_DIGEST_STATE, newAnimation); + + $rootScope.$$postDigest(function() { + // It is possible that the DOM nodes inside `originalElement` have been replaced. This can + // happen if the animated element is a transcluded clone and also has a `templateUrl` + // directive on it. Therefore, we must recreate `element` in order to interact with the + // actual DOM nodes. + // Note: We still need to use the old `node` for certain things, such as looking up in + // HashMaps where it was used as the key. + + element = stripCommentsFromElement(originalElement); + + var animationDetails = activeAnimationsLookup.get(node); + var animationCancelled = !animationDetails; + animationDetails = animationDetails || {}; + + // if addClass/removeClass is called before something like enter then the + // registered parent element may not be present. The code below will ensure + // that a final value for parent element is obtained + var parentElement = element.parent() || []; + + // animate/structural/class-based animations all have requirements. Otherwise there + // is no point in performing an animation. The parent node must also be set. + var isValidAnimation = parentElement.length > 0 + && (animationDetails.event === 'animate' + || animationDetails.structural + || hasAnimationClasses(animationDetails)); + + // this means that the previous animation was cancelled + // even if the follow-up animation is the same event + if (animationCancelled || animationDetails.counter !== counter || !isValidAnimation) { + // if another animation did not take over then we need + // to make sure that the domOperation and options are + // handled accordingly + if (animationCancelled) { + applyAnimationClasses(element, options); + applyAnimationStyles(element, options); + } + + // if the event changed from something like enter to leave then we do + // it, otherwise if it's the same then the end result will be the same too + if (animationCancelled || (isStructural && animationDetails.event !== event)) { + options.domOperation(); + runner.end(); + } + + // in the event that the element animation was not cancelled or a follow-up animation + // isn't allowed to animate from here then we need to clear the state of the element + // so that any future animations won't read the expired animation data. + if (!isValidAnimation) { + clearElementAnimationState(node); + } + + return; + } + + // this combined multiple class to addClass / removeClass into a setClass event + // so long as a structural event did not take over the animation + event = !animationDetails.structural && hasAnimationClasses(animationDetails, true) + ? 'setClass' + : animationDetails.event; + + markElementAnimationState(node, RUNNING_STATE); + var realRunner = $$animation(element, event, animationDetails.options); + + // this will update the runner's flow-control events based on + // the `realRunner` object. + runner.setHost(realRunner); + notifyProgress(runner, event, 'start', getEventData(options)); + + realRunner.done(function(status) { + close(!status); + var animationDetails = activeAnimationsLookup.get(node); + if (animationDetails && animationDetails.counter === counter) { + clearElementAnimationState(node); + } + notifyProgress(runner, event, 'close', getEventData(options)); + }); + }); + + return runner; + + function notifyProgress(runner, event, phase, data) { + runInNextPostDigestOrNow(function() { + var callbacks = findCallbacks(parentNode, node, event); + if (callbacks.length) { + // do not optimize this call here to RAF because + // we don't know how heavy the callback code here will + // be and if this code is buffered then this can + // lead to a performance regression. + $$rAF(function() { + forEach(callbacks, function(callback) { + callback(element, phase, data); + }); + cleanupEventListeners(phase, node); + }); + } else { + cleanupEventListeners(phase, node); + } + }); + runner.progress(event, phase, data); + } + + function close(reject) { + clearGeneratedClasses(element, options); + applyAnimationClasses(element, options); + applyAnimationStyles(element, options); + options.domOperation(); + runner.complete(!reject); + } + } + + function closeChildAnimations(node) { + var children = node.querySelectorAll('[' + NG_ANIMATE_ATTR_NAME + ']'); + forEach(children, function(child) { + var state = parseInt(child.getAttribute(NG_ANIMATE_ATTR_NAME), 10); + var animationDetails = activeAnimationsLookup.get(child); + if (animationDetails) { + switch (state) { + case RUNNING_STATE: + animationDetails.runner.end(); + /* falls through */ + case PRE_DIGEST_STATE: + activeAnimationsLookup.delete(child); + break; + } + } + }); + } + + function clearElementAnimationState(node) { + node.removeAttribute(NG_ANIMATE_ATTR_NAME); + activeAnimationsLookup.delete(node); + } + + /** + * This fn returns false if any of the following is true: + * a) animations on any parent element are disabled, and animations on the element aren't explicitly allowed + * b) a parent element has an ongoing structural animation, and animateChildren is false + * c) the element is not a child of the body + * d) the element is not a child of the $rootElement + */ + function areAnimationsAllowed(node, parentNode, event) { + var bodyNode = $document[0].body; + var rootNode = getDomNode($rootElement); + + var bodyNodeDetected = (node === bodyNode) || node.nodeName === 'HTML'; + var rootNodeDetected = (node === rootNode); + var parentAnimationDetected = false; + var elementDisabled = disabledElementsLookup.get(node); + var animateChildren; + + var parentHost = jqLite.data(node, NG_ANIMATE_PIN_DATA); + if (parentHost) { + parentNode = getDomNode(parentHost); + } + + while (parentNode) { + if (!rootNodeDetected) { + // AngularJS doesn't want to attempt to animate elements outside of the application + // therefore we need to ensure that the rootElement is an ancestor of the current element + rootNodeDetected = (parentNode === rootNode); + } + + if (parentNode.nodeType !== ELEMENT_NODE) { + // no point in inspecting the #document element + break; + } + + var details = activeAnimationsLookup.get(parentNode) || {}; + // either an enter, leave or move animation will commence + // therefore we can't allow any animations to take place + // but if a parent animation is class-based then that's ok + if (!parentAnimationDetected) { + var parentNodeDisabled = disabledElementsLookup.get(parentNode); + + if (parentNodeDisabled === true && elementDisabled !== false) { + // disable animations if the user hasn't explicitly enabled animations on the + // current element + elementDisabled = true; + // element is disabled via parent element, no need to check anything else + break; + } else if (parentNodeDisabled === false) { + elementDisabled = false; + } + parentAnimationDetected = details.structural; + } + + if (isUndefined(animateChildren) || animateChildren === true) { + var value = jqLite.data(parentNode, NG_ANIMATE_CHILDREN_DATA); + if (isDefined(value)) { + animateChildren = value; + } + } + + // there is no need to continue traversing at this point + if (parentAnimationDetected && animateChildren === false) break; + + if (!bodyNodeDetected) { + // we also need to ensure that the element is or will be a part of the body element + // otherwise it is pointless to even issue an animation to be rendered + bodyNodeDetected = (parentNode === bodyNode); + } + + if (bodyNodeDetected && rootNodeDetected) { + // If both body and root have been found, any other checks are pointless, + // as no animation data should live outside the application + break; + } + + if (!rootNodeDetected) { + // If `rootNode` is not detected, check if `parentNode` is pinned to another element + parentHost = jqLite.data(parentNode, NG_ANIMATE_PIN_DATA); + if (parentHost) { + // The pin target element becomes the next parent element + parentNode = getDomNode(parentHost); + continue; + } + } + + parentNode = parentNode.parentNode; + } + + var allowAnimation = (!parentAnimationDetected || animateChildren) && elementDisabled !== true; + return allowAnimation && rootNodeDetected && bodyNodeDetected; + } + + function markElementAnimationState(node, state, details) { + details = details || {}; + details.state = state; + + node.setAttribute(NG_ANIMATE_ATTR_NAME, state); + + var oldValue = activeAnimationsLookup.get(node); + var newValue = oldValue + ? extend(oldValue, details) + : details; + activeAnimationsLookup.set(node, newValue); + } + }]; +}]; + +/** @this */ +var $$AnimateCacheProvider = function() { + + var KEY = '$$ngAnimateParentKey'; + var parentCounter = 0; + var cache = Object.create(null); + + this.$get = [function() { + return { + cacheKey: function(node, method, addClass, removeClass) { + var parentNode = node.parentNode; + var parentID = parentNode[KEY] || (parentNode[KEY] = ++parentCounter); + var parts = [parentID, method, node.getAttribute('class')]; + if (addClass) { + parts.push(addClass); + } + if (removeClass) { + parts.push(removeClass); + } + return parts.join(' '); + }, + + containsCachedAnimationWithoutDuration: function(key) { + var entry = cache[key]; + + // nothing cached, so go ahead and animate + // otherwise it should be a valid animation + return (entry && !entry.isValid) || false; + }, + + flush: function() { + cache = Object.create(null); + }, + + count: function(key) { + var entry = cache[key]; + return entry ? entry.total : 0; + }, + + get: function(key) { + var entry = cache[key]; + return entry && entry.value; + }, + + put: function(key, value, isValid) { + if (!cache[key]) { + cache[key] = { total: 1, value: value, isValid: isValid }; + } else { + cache[key].total++; + cache[key].value = value; + } + } + }; + }]; +}; + +/* exported $$AnimationProvider */ + +var $$AnimationProvider = ['$animateProvider', /** @this */ function($animateProvider) { + var NG_ANIMATE_REF_ATTR = 'ng-animate-ref'; + + var drivers = this.drivers = []; + + var RUNNER_STORAGE_KEY = '$$animationRunner'; + var PREPARE_CLASSES_KEY = '$$animatePrepareClasses'; + + function setRunner(element, runner) { + element.data(RUNNER_STORAGE_KEY, runner); + } + + function removeRunner(element) { + element.removeData(RUNNER_STORAGE_KEY); + } + + function getRunner(element) { + return element.data(RUNNER_STORAGE_KEY); + } + + this.$get = ['$$jqLite', '$rootScope', '$injector', '$$AnimateRunner', '$$Map', '$$rAFScheduler', '$$animateCache', + function($$jqLite, $rootScope, $injector, $$AnimateRunner, $$Map, $$rAFScheduler, $$animateCache) { + + var animationQueue = []; + var applyAnimationClasses = applyAnimationClassesFactory($$jqLite); + + function sortAnimations(animations) { + var tree = { children: [] }; + var i, lookup = new $$Map(); + + // this is done first beforehand so that the map + // is filled with a list of the elements that will be animated + for (i = 0; i < animations.length; i++) { + var animation = animations[i]; + lookup.set(animation.domNode, animations[i] = { + domNode: animation.domNode, + element: animation.element, + fn: animation.fn, + children: [] + }); + } + + for (i = 0; i < animations.length; i++) { + processNode(animations[i]); + } + + return flatten(tree); + + function processNode(entry) { + if (entry.processed) return entry; + entry.processed = true; + + var elementNode = entry.domNode; + var parentNode = elementNode.parentNode; + lookup.set(elementNode, entry); + + var parentEntry; + while (parentNode) { + parentEntry = lookup.get(parentNode); + if (parentEntry) { + if (!parentEntry.processed) { + parentEntry = processNode(parentEntry); + } + break; + } + parentNode = parentNode.parentNode; + } + + (parentEntry || tree).children.push(entry); + return entry; + } + + function flatten(tree) { + var result = []; + var queue = []; + var i; + + for (i = 0; i < tree.children.length; i++) { + queue.push(tree.children[i]); + } + + var remainingLevelEntries = queue.length; + var nextLevelEntries = 0; + var row = []; + + for (i = 0; i < queue.length; i++) { + var entry = queue[i]; + if (remainingLevelEntries <= 0) { + remainingLevelEntries = nextLevelEntries; + nextLevelEntries = 0; + result.push(row); + row = []; + } + row.push(entry); + entry.children.forEach(function(childEntry) { + nextLevelEntries++; + queue.push(childEntry); + }); + remainingLevelEntries--; + } + + if (row.length) { + result.push(row); + } + + return result; + } + } + + // TODO(matsko): document the signature in a better way + return function(element, event, options) { + options = prepareAnimationOptions(options); + var isStructural = ['enter', 'move', 'leave'].indexOf(event) >= 0; + + // there is no animation at the current moment, however + // these runner methods will get later updated with the + // methods leading into the driver's end/cancel methods + // for now they just stop the animation from starting + var runner = new $$AnimateRunner({ + end: function() { close(); }, + cancel: function() { close(true); } + }); + + if (!drivers.length) { + close(); + return runner; + } + + var classes = mergeClasses(element.attr('class'), mergeClasses(options.addClass, options.removeClass)); + var tempClasses = options.tempClasses; + if (tempClasses) { + classes += ' ' + tempClasses; + options.tempClasses = null; + } + + if (isStructural) { + element.data(PREPARE_CLASSES_KEY, 'ng-' + event + PREPARE_CLASS_SUFFIX); + } + + setRunner(element, runner); + + animationQueue.push({ + // this data is used by the postDigest code and passed into + // the driver step function + element: element, + classes: classes, + event: event, + structural: isStructural, + options: options, + beforeStart: beforeStart, + close: close + }); + + element.on('$destroy', handleDestroyedElement); + + // we only want there to be one function called within the post digest + // block. This way we can group animations for all the animations that + // were apart of the same postDigest flush call. + if (animationQueue.length > 1) return runner; + + $rootScope.$$postDigest(function() { + var animations = []; + forEach(animationQueue, function(entry) { + // the element was destroyed early on which removed the runner + // form its storage. This means we can't animate this element + // at all and it already has been closed due to destruction. + if (getRunner(entry.element)) { + animations.push(entry); + } else { + entry.close(); + } + }); + + // now any future animations will be in another postDigest + animationQueue.length = 0; + + var groupedAnimations = groupAnimations(animations); + var toBeSortedAnimations = []; + + forEach(groupedAnimations, function(animationEntry) { + var element = animationEntry.from ? animationEntry.from.element : animationEntry.element; + var extraClasses = options.addClass; + + extraClasses = (extraClasses ? (extraClasses + ' ') : '') + NG_ANIMATE_CLASSNAME; + var cacheKey = $$animateCache.cacheKey(element[0], animationEntry.event, extraClasses, options.removeClass); + + toBeSortedAnimations.push({ + element: element, + domNode: getDomNode(element), + fn: function triggerAnimationStart() { + var startAnimationFn, closeFn = animationEntry.close; + + // in the event that we've cached the animation status for this element + // and it's in fact an invalid animation (something that has duration = 0) + // then we should skip all the heavy work from here on + if ($$animateCache.containsCachedAnimationWithoutDuration(cacheKey)) { + closeFn(); + return; + } + + // it's important that we apply the `ng-animate` CSS class and the + // temporary classes before we do any driver invoking since these + // CSS classes may be required for proper CSS detection. + animationEntry.beforeStart(); + + // in the event that the element was removed before the digest runs or + // during the RAF sequencing then we should not trigger the animation. + var targetElement = animationEntry.anchors + ? (animationEntry.from.element || animationEntry.to.element) + : animationEntry.element; + + if (getRunner(targetElement)) { + var operation = invokeFirstDriver(animationEntry); + if (operation) { + startAnimationFn = operation.start; + } + } + + if (!startAnimationFn) { + closeFn(); + } else { + var animationRunner = startAnimationFn(); + animationRunner.done(function(status) { + closeFn(!status); + }); + updateAnimationRunners(animationEntry, animationRunner); + } + } + }); + }); + + // we need to sort each of the animations in order of parent to child + // relationships. This ensures that the child classes are applied at the + // right time. + var finalAnimations = sortAnimations(toBeSortedAnimations); + for (var i = 0; i < finalAnimations.length; i++) { + var innerArray = finalAnimations[i]; + for (var j = 0; j < innerArray.length; j++) { + var entry = innerArray[j]; + var element = entry.element; + + // the RAFScheduler code only uses functions + finalAnimations[i][j] = entry.fn; + + // the first row of elements shouldn't have a prepare-class added to them + // since the elements are at the top of the animation hierarchy and they + // will be applied without a RAF having to pass... + if (i === 0) { + element.removeData(PREPARE_CLASSES_KEY); + continue; + } + + var prepareClassName = element.data(PREPARE_CLASSES_KEY); + if (prepareClassName) { + $$jqLite.addClass(element, prepareClassName); + } + } + } + + $$rAFScheduler(finalAnimations); + }); + + return runner; + + // TODO(matsko): change to reference nodes + function getAnchorNodes(node) { + var SELECTOR = '[' + NG_ANIMATE_REF_ATTR + ']'; + var items = node.hasAttribute(NG_ANIMATE_REF_ATTR) + ? [node] + : node.querySelectorAll(SELECTOR); + var anchors = []; + forEach(items, function(node) { + var attr = node.getAttribute(NG_ANIMATE_REF_ATTR); + if (attr && attr.length) { + anchors.push(node); + } + }); + return anchors; + } + + function groupAnimations(animations) { + var preparedAnimations = []; + var refLookup = {}; + forEach(animations, function(animation, index) { + var element = animation.element; + var node = getDomNode(element); + var event = animation.event; + var enterOrMove = ['enter', 'move'].indexOf(event) >= 0; + var anchorNodes = animation.structural ? getAnchorNodes(node) : []; + + if (anchorNodes.length) { + var direction = enterOrMove ? 'to' : 'from'; + + forEach(anchorNodes, function(anchor) { + var key = anchor.getAttribute(NG_ANIMATE_REF_ATTR); + refLookup[key] = refLookup[key] || {}; + refLookup[key][direction] = { + animationID: index, + element: jqLite(anchor) + }; + }); + } else { + preparedAnimations.push(animation); + } + }); + + var usedIndicesLookup = {}; + var anchorGroups = {}; + forEach(refLookup, function(operations, key) { + var from = operations.from; + var to = operations.to; + + if (!from || !to) { + // only one of these is set therefore we can't have an + // anchor animation since all three pieces are required + var index = from ? from.animationID : to.animationID; + var indexKey = index.toString(); + if (!usedIndicesLookup[indexKey]) { + usedIndicesLookup[indexKey] = true; + preparedAnimations.push(animations[index]); + } + return; + } + + var fromAnimation = animations[from.animationID]; + var toAnimation = animations[to.animationID]; + var lookupKey = from.animationID.toString(); + if (!anchorGroups[lookupKey]) { + var group = anchorGroups[lookupKey] = { + structural: true, + beforeStart: function() { + fromAnimation.beforeStart(); + toAnimation.beforeStart(); + }, + close: function() { + fromAnimation.close(); + toAnimation.close(); + }, + classes: cssClassesIntersection(fromAnimation.classes, toAnimation.classes), + from: fromAnimation, + to: toAnimation, + anchors: [] // TODO(matsko): change to reference nodes + }; + + // the anchor animations require that the from and to elements both have at least + // one shared CSS class which effectively marries the two elements together to use + // the same animation driver and to properly sequence the anchor animation. + if (group.classes.length) { + preparedAnimations.push(group); + } else { + preparedAnimations.push(fromAnimation); + preparedAnimations.push(toAnimation); + } + } + + anchorGroups[lookupKey].anchors.push({ + 'out': from.element, 'in': to.element + }); + }); + + return preparedAnimations; + } + + function cssClassesIntersection(a,b) { + a = a.split(' '); + b = b.split(' '); + var matches = []; + + for (var i = 0; i < a.length; i++) { + var aa = a[i]; + if (aa.substring(0,3) === 'ng-') continue; + + for (var j = 0; j < b.length; j++) { + if (aa === b[j]) { + matches.push(aa); + break; + } + } + } + + return matches.join(' '); + } + + function invokeFirstDriver(animationDetails) { + // we loop in reverse order since the more general drivers (like CSS and JS) + // may attempt more elements, but custom drivers are more particular + for (var i = drivers.length - 1; i >= 0; i--) { + var driverName = drivers[i]; + var factory = $injector.get(driverName); + var driver = factory(animationDetails); + if (driver) { + return driver; + } + } + } + + function beforeStart() { + tempClasses = (tempClasses ? (tempClasses + ' ') : '') + NG_ANIMATE_CLASSNAME; + $$jqLite.addClass(element, tempClasses); + + var prepareClassName = element.data(PREPARE_CLASSES_KEY); + if (prepareClassName) { + $$jqLite.removeClass(element, prepareClassName); + prepareClassName = null; + } + } + + function updateAnimationRunners(animation, newRunner) { + if (animation.from && animation.to) { + update(animation.from.element); + update(animation.to.element); + } else { + update(animation.element); + } + + function update(element) { + var runner = getRunner(element); + if (runner) runner.setHost(newRunner); + } + } + + function handleDestroyedElement() { + var runner = getRunner(element); + if (runner && (event !== 'leave' || !options.$$domOperationFired)) { + runner.end(); + } + } + + function close(rejected) { + element.off('$destroy', handleDestroyedElement); + removeRunner(element); + + applyAnimationClasses(element, options); + applyAnimationStyles(element, options); + options.domOperation(); + + if (tempClasses) { + $$jqLite.removeClass(element, tempClasses); + } + + runner.complete(!rejected); + } + }; + }]; +}]; + +/** + * @ngdoc directive + * @name ngAnimateSwap + * @restrict A + * @scope + * + * @description + * + * ngAnimateSwap is a animation-oriented directive that allows for the container to + * be removed and entered in whenever the associated expression changes. A + * common usecase for this directive is a rotating banner or slider component which + * contains one image being present at a time. When the active image changes + * then the old image will perform a `leave` animation and the new element + * will be inserted via an `enter` animation. + * + * @animations + * | Animation | Occurs | + * |----------------------------------|--------------------------------------| + * | {@link ng.$animate#enter enter} | when the new element is inserted to the DOM | + * | {@link ng.$animate#leave leave} | when the old element is removed from the DOM | + * + * @example + * + * + *
    + *
    + * {{ number }} + *
    + *
    + *
    + * + * angular.module('ngAnimateSwapExample', ['ngAnimate']) + * .controller('AppCtrl', ['$scope', '$interval', function($scope, $interval) { + * $scope.number = 0; + * $interval(function() { + * $scope.number++; + * }, 1000); + * + * var colors = ['red','blue','green','yellow','orange']; + * $scope.colorClass = function(number) { + * return colors[number % colors.length]; + * }; + * }]); + * + * + * .container { + * height:250px; + * width:250px; + * position:relative; + * overflow:hidden; + * border:2px solid black; + * } + * .container .cell { + * font-size:150px; + * text-align:center; + * line-height:250px; + * position:absolute; + * top:0; + * left:0; + * right:0; + * border-bottom:2px solid black; + * } + * .swap-animation.ng-enter, .swap-animation.ng-leave { + * transition:0.5s linear all; + * } + * .swap-animation.ng-enter { + * top:-250px; + * } + * .swap-animation.ng-enter-active { + * top:0px; + * } + * .swap-animation.ng-leave { + * top:0px; + * } + * .swap-animation.ng-leave-active { + * top:250px; + * } + * .red { background:red; } + * .green { background:green; } + * .blue { background:blue; } + * .yellow { background:yellow; } + * .orange { background:orange; } + * + *
    + */ +var ngAnimateSwapDirective = ['$animate', function($animate) { + return { + restrict: 'A', + transclude: 'element', + terminal: true, + priority: 550, // We use 550 here to ensure that the directive is caught before others, + // but after `ngIf` (at priority 600). + link: function(scope, $element, attrs, ctrl, $transclude) { + var previousElement, previousScope; + scope.$watchCollection(attrs.ngAnimateSwap || attrs['for'], function(value) { + if (previousElement) { + $animate.leave(previousElement); + } + if (previousScope) { + previousScope.$destroy(); + previousScope = null; + } + if (value || value === 0) { + $transclude(function(clone, childScope) { + previousElement = clone; + previousScope = childScope; + $animate.enter(clone, null, $element); + }); + } + }); + } + }; +}]; + +/** + * @ngdoc module + * @name ngAnimate + * @description + * + * The `ngAnimate` module provides support for CSS-based animations (keyframes and transitions) as well as JavaScript-based animations via + * callback hooks. Animations are not enabled by default, however, by including `ngAnimate` the animation hooks are enabled for an AngularJS app. + * + * ## Usage + * Simply put, there are two ways to make use of animations when ngAnimate is used: by using **CSS** and **JavaScript**. The former works purely based + * using CSS (by using matching CSS selectors/styles) and the latter triggers animations that are registered via `module.animation()`. For + * both CSS and JS animations the sole requirement is to have a matching `CSS class` that exists both in the registered animation and within + * the HTML element that the animation will be triggered on. + * + * ## Directive Support + * The following directives are "animation aware": + * + * | Directive | Supported Animations | + * |-------------------------------------------------------------------------------|---------------------------------------------------------------------------| + * | {@link ng.directive:form#animations form / ngForm} | add and remove ({@link ng.directive:form#css-classes various classes}) | + * | {@link ngAnimate.directive:ngAnimateSwap#animations ngAnimateSwap} | enter and leave | + * | {@link ng.directive:ngClass#animations ngClass / {{class}​}} | add and remove | + * | {@link ng.directive:ngClassEven#animations ngClassEven} | add and remove | + * | {@link ng.directive:ngClassOdd#animations ngClassOdd} | add and remove | + * | {@link ng.directive:ngHide#animations ngHide} | add and remove (the `ng-hide` class) | + * | {@link ng.directive:ngIf#animations ngIf} | enter and leave | + * | {@link ng.directive:ngInclude#animations ngInclude} | enter and leave | + * | {@link module:ngMessages#animations ngMessage / ngMessageExp} | enter and leave | + * | {@link module:ngMessages#animations ngMessages} | add and remove (the `ng-active`/`ng-inactive` classes) | + * | {@link ng.directive:ngModel#animations ngModel} | add and remove ({@link ng.directive:ngModel#css-classes various classes}) | + * | {@link ng.directive:ngRepeat#animations ngRepeat} | enter, leave, and move | + * | {@link ng.directive:ngShow#animations ngShow} | add and remove (the `ng-hide` class) | + * | {@link ng.directive:ngSwitch#animations ngSwitch} | enter and leave | + * | {@link ngRoute.directive:ngView#animations ngView} | enter and leave | + * + * (More information can be found by visiting the documentation associated with each directive.) + * + * For a full breakdown of the steps involved during each animation event, refer to the + * {@link ng.$animate `$animate` API docs}. + * + * ## CSS-based Animations + * + * CSS-based animations with ngAnimate are unique since they require no JavaScript code at all. By using a CSS class that we reference between our HTML + * and CSS code we can create an animation that will be picked up by AngularJS when an underlying directive performs an operation. + * + * The example below shows how an `enter` animation can be made possible on an element using `ng-if`: + * + * ```html + *
    + * Fade me in out + *
    + * + * + * ``` + * + * Notice the CSS class **fade**? We can now create the CSS transition code that references this class: + * + * ```css + * /* The starting CSS styles for the enter animation */ + * .fade.ng-enter { + * transition:0.5s linear all; + * opacity:0; + * } + * + * /* The finishing CSS styles for the enter animation */ + * .fade.ng-enter.ng-enter-active { + * opacity:1; + * } + * ``` + * + * The key thing to remember here is that, depending on the animation event (which each of the directives above trigger depending on what's going on) two + * generated CSS classes will be applied to the element; in the example above we have `.ng-enter` and `.ng-enter-active`. For CSS transitions, the transition + * code **must** be defined within the starting CSS class (in this case `.ng-enter`). The destination class is what the transition will animate towards. + * + * If for example we wanted to create animations for `leave` and `move` (ngRepeat triggers move) then we can do so using the same CSS naming conventions: + * + * ```css + * /* now the element will fade out before it is removed from the DOM */ + * .fade.ng-leave { + * transition:0.5s linear all; + * opacity:1; + * } + * .fade.ng-leave.ng-leave-active { + * opacity:0; + * } + * ``` + * + * We can also make use of **CSS Keyframes** by referencing the keyframe animation within the starting CSS class: + * + * ```css + * /* there is no need to define anything inside of the destination + * CSS class since the keyframe will take charge of the animation */ + * .fade.ng-leave { + * animation: my_fade_animation 0.5s linear; + * -webkit-animation: my_fade_animation 0.5s linear; + * } + * + * @keyframes my_fade_animation { + * from { opacity:1; } + * to { opacity:0; } + * } + * + * @-webkit-keyframes my_fade_animation { + * from { opacity:1; } + * to { opacity:0; } + * } + * ``` + * + * Feel free also mix transitions and keyframes together as well as any other CSS classes on the same element. + * + * ### CSS Class-based Animations + * + * Class-based animations (animations that are triggered via `ngClass`, `ngShow`, `ngHide` and some other directives) have a slightly different + * naming convention. Class-based animations are basic enough that a standard transition or keyframe can be referenced on the class being added + * and removed. + * + * For example if we wanted to do a CSS animation for `ngHide` then we place an animation on the `.ng-hide` CSS class: + * + * ```html + *
    + * Show and hide me + *
    + * + * + * + * ``` + * + * All that is going on here with ngShow/ngHide behind the scenes is the `.ng-hide` class is added/removed (when the hidden state is valid). Since + * ngShow and ngHide are animation aware then we can match up a transition and ngAnimate handles the rest. + * + * In addition the addition and removal of the CSS class, ngAnimate also provides two helper methods that we can use to further decorate the animation + * with CSS styles. + * + * ```html + *
    + * Highlight this box + *
    + * + * + * + * ``` + * + * We can also make use of CSS keyframes by placing them within the CSS classes. + * + * + * ### CSS Staggering Animations + * A Staggering animation is a collection of animations that are issued with a slight delay in between each successive operation resulting in a + * curtain-like effect. The ngAnimate module (versions >=1.2) supports staggering animations and the stagger effect can be + * performed by creating a **ng-EVENT-stagger** CSS class and attaching that class to the base CSS class used for + * the animation. The style property expected within the stagger class can either be a **transition-delay** or an + * **animation-delay** property (or both if your animation contains both transitions and keyframe animations). + * + * ```css + * .my-animation.ng-enter { + * /* standard transition code */ + * transition: 1s linear all; + * opacity:0; + * } + * .my-animation.ng-enter-stagger { + * /* this will have a 100ms delay between each successive leave animation */ + * transition-delay: 0.1s; + * + * /* As of 1.4.4, this must always be set: it signals ngAnimate + * to not accidentally inherit a delay property from another CSS class */ + * transition-duration: 0s; + * + * /* if you are using animations instead of transitions you should configure as follows: + * animation-delay: 0.1s; + * animation-duration: 0s; */ + * } + * .my-animation.ng-enter.ng-enter-active { + * /* standard transition styles */ + * opacity:1; + * } + * ``` + * + * Staggering animations work by default in ngRepeat (so long as the CSS class is defined). Outside of ngRepeat, to use staggering animations + * on your own, they can be triggered by firing multiple calls to the same event on $animate. However, the restrictions surrounding this + * are that each of the elements must have the same CSS className value as well as the same parent element. A stagger operation + * will also be reset if one or more animation frames have passed since the multiple calls to `$animate` were fired. + * + * The following code will issue the **ng-leave-stagger** event on the element provided: + * + * ```js + * var kids = parent.children(); + * + * $animate.leave(kids[0]); //stagger index=0 + * $animate.leave(kids[1]); //stagger index=1 + * $animate.leave(kids[2]); //stagger index=2 + * $animate.leave(kids[3]); //stagger index=3 + * $animate.leave(kids[4]); //stagger index=4 + * + * window.requestAnimationFrame(function() { + * //stagger has reset itself + * $animate.leave(kids[5]); //stagger index=0 + * $animate.leave(kids[6]); //stagger index=1 + * + * $scope.$digest(); + * }); + * ``` + * + * Stagger animations are currently only supported within CSS-defined animations. + * + * ### The `ng-animate` CSS class + * + * When ngAnimate is animating an element it will apply the `ng-animate` CSS class to the element for the duration of the animation. + * This is a temporary CSS class and it will be removed once the animation is over (for both JavaScript and CSS-based animations). + * + * Therefore, animations can be applied to an element using this temporary class directly via CSS. + * + * ```css + * .zipper.ng-animate { + * transition:0.5s linear all; + * } + * .zipper.ng-enter { + * opacity:0; + * } + * .zipper.ng-enter.ng-enter-active { + * opacity:1; + * } + * .zipper.ng-leave { + * opacity:1; + * } + * .zipper.ng-leave.ng-leave-active { + * opacity:0; + * } + * ``` + * + * (Note that the `ng-animate` CSS class is reserved and it cannot be applied on an element directly since ngAnimate will always remove + * the CSS class once an animation has completed.) + * + * + * ### The `ng-[event]-prepare` class + * + * This is a special class that can be used to prevent unwanted flickering / flash of content before + * the actual animation starts. The class is added as soon as an animation is initialized, but removed + * before the actual animation starts (after waiting for a $digest). + * It is also only added for *structural* animations (`enter`, `move`, and `leave`). + * + * In practice, flickering can appear when nesting elements with structural animations such as `ngIf` + * into elements that have class-based animations such as `ngClass`. + * + * ```html + *
    + *
    + *
    + *
    + *
    + * ``` + * + * It is possible that during the `enter` animation, the `.message` div will be briefly visible before it starts animating. + * In that case, you can add styles to the CSS that make sure the element stays hidden before the animation starts: + * + * ```css + * .message.ng-enter-prepare { + * opacity: 0; + * } + * ``` + * + * ### Animating between value changes + * + * Sometimes you need to animate between different expression states, whose values + * don't necessary need to be known or referenced in CSS styles. + * Unless possible with another {@link ngAnimate#directive-support "animation aware" directive}, + * that specific use case can always be covered with {@link ngAnimate.directive:ngAnimateSwap} as + * can be seen in {@link ngAnimate.directive:ngAnimateSwap#examples this example}. + * + * Note that {@link ngAnimate.directive:ngAnimateSwap} is a *structural directive*, which means it + * creates a new instance of the element (including any other/child directives it may have) and + * links it to a new scope every time *swap* happens. In some cases this might not be desirable + * (e.g. for performance reasons, or when you wish to retain internal state on the original + * element instance). + * + * ## JavaScript-based Animations + * + * ngAnimate also allows for animations to be consumed by JavaScript code. The approach is similar to CSS-based animations (where there is a shared + * CSS class that is referenced in our HTML code) but in addition we need to register the JavaScript animation on the module. By making use of the + * `module.animation()` module function we can register the animation. + * + * Let's see an example of a enter/leave animation using `ngRepeat`: + * + * ```html + *
    + * {{ item }} + *
    + * ``` + * + * See the **slide** CSS class? Let's use that class to define an animation that we'll structure in our module code by using `module.animation`: + * + * ```js + * myModule.animation('.slide', [function() { + * return { + * // make note that other events (like addClass/removeClass) + * // have different function input parameters + * enter: function(element, doneFn) { + * jQuery(element).fadeIn(1000, doneFn); + * + * // remember to call doneFn so that AngularJS + * // knows that the animation has concluded + * }, + * + * move: function(element, doneFn) { + * jQuery(element).fadeIn(1000, doneFn); + * }, + * + * leave: function(element, doneFn) { + * jQuery(element).fadeOut(1000, doneFn); + * } + * } + * }]); + * ``` + * + * The nice thing about JS-based animations is that we can inject other services and make use of advanced animation libraries such as + * greensock.js and velocity.js. + * + * If our animation code class-based (meaning that something like `ngClass`, `ngHide` and `ngShow` triggers it) then we can still define + * our animations inside of the same registered animation, however, the function input arguments are a bit different: + * + * ```html + *
    + * this box is moody + *
    + * + * + * + * ``` + * + * ```js + * myModule.animation('.colorful', [function() { + * return { + * addClass: function(element, className, doneFn) { + * // do some cool animation and call the doneFn + * }, + * removeClass: function(element, className, doneFn) { + * // do some cool animation and call the doneFn + * }, + * setClass: function(element, addedClass, removedClass, doneFn) { + * // do some cool animation and call the doneFn + * } + * } + * }]); + * ``` + * + * ## CSS + JS Animations Together + * + * AngularJS 1.4 and higher has taken steps to make the amalgamation of CSS and JS animations more flexible. However, unlike earlier versions of AngularJS, + * defining CSS and JS animations to work off of the same CSS class will not work anymore. Therefore the example below will only result in **JS animations taking + * charge of the animation**: + * + * ```html + *
    + * Slide in and out + *
    + * ``` + * + * ```js + * myModule.animation('.slide', [function() { + * return { + * enter: function(element, doneFn) { + * jQuery(element).slideIn(1000, doneFn); + * } + * } + * }]); + * ``` + * + * ```css + * .slide.ng-enter { + * transition:0.5s linear all; + * transform:translateY(-100px); + * } + * .slide.ng-enter.ng-enter-active { + * transform:translateY(0); + * } + * ``` + * + * Does this mean that CSS and JS animations cannot be used together? Do JS-based animations always have higher priority? We can make up for the + * lack of CSS animations by using the `$animateCss` service to trigger our own tweaked-out, CSS-based animations directly from + * our own JS-based animation code: + * + * ```js + * myModule.animation('.slide', ['$animateCss', function($animateCss) { + * return { + * enter: function(element) { +* // this will trigger `.slide.ng-enter` and `.slide.ng-enter-active`. + * return $animateCss(element, { + * event: 'enter', + * structural: true + * }); + * } + * } + * }]); + * ``` + * + * The nice thing here is that we can save bandwidth by sticking to our CSS-based animation code and we don't need to rely on a 3rd-party animation framework. + * + * The `$animateCss` service is very powerful since we can feed in all kinds of extra properties that will be evaluated and fed into a CSS transition or + * keyframe animation. For example if we wanted to animate the height of an element while adding and removing classes then we can do so by providing that + * data into `$animateCss` directly: + * + * ```js + * myModule.animation('.slide', ['$animateCss', function($animateCss) { + * return { + * enter: function(element) { + * return $animateCss(element, { + * event: 'enter', + * structural: true, + * addClass: 'maroon-setting', + * from: { height:0 }, + * to: { height: 200 } + * }); + * } + * } + * }]); + * ``` + * + * Now we can fill in the rest via our transition CSS code: + * + * ```css + * /* the transition tells ngAnimate to make the animation happen */ + * .slide.ng-enter { transition:0.5s linear all; } + * + * /* this extra CSS class will be absorbed into the transition + * since the $animateCss code is adding the class */ + * .maroon-setting { background:red; } + * ``` + * + * And `$animateCss` will figure out the rest. Just make sure to have the `done()` callback fire the `doneFn` function to signal when the animation is over. + * + * To learn more about what's possible be sure to visit the {@link ngAnimate.$animateCss $animateCss service}. + * + * ## Animation Anchoring (via `ng-animate-ref`) + * + * ngAnimate in AngularJS 1.4 comes packed with the ability to cross-animate elements between + * structural areas of an application (like views) by pairing up elements using an attribute + * called `ng-animate-ref`. + * + * Let's say for example we have two views that are managed by `ng-view` and we want to show + * that there is a relationship between two components situated in within these views. By using the + * `ng-animate-ref` attribute we can identify that the two components are paired together and we + * can then attach an animation, which is triggered when the view changes. + * + * Say for example we have the following template code: + * + * ```html + * + *
    + *
    + * + * + *
    + * + * + * + * + * + * ``` + * + * Now, when the view changes (once the link is clicked), ngAnimate will examine the + * HTML contents to see if there is a match reference between any components in the view + * that is leaving and the view that is entering. It will scan both the view which is being + * removed (leave) and inserted (enter) to see if there are any paired DOM elements that + * contain a matching ref value. + * + * The two images match since they share the same ref value. ngAnimate will now create a + * transport element (which is a clone of the first image element) and it will then attempt + * to animate to the position of the second image element in the next view. For the animation to + * work a special CSS class called `ng-anchor` will be added to the transported element. + * + * We can now attach a transition onto the `.banner.ng-anchor` CSS class and then + * ngAnimate will handle the entire transition for us as well as the addition and removal of + * any changes of CSS classes between the elements: + * + * ```css + * .banner.ng-anchor { + * /* this animation will last for 1 second since there are + * two phases to the animation (an `in` and an `out` phase) */ + * transition:0.5s linear all; + * } + * ``` + * + * We also **must** include animations for the views that are being entered and removed + * (otherwise anchoring wouldn't be possible since the new view would be inserted right away). + * + * ```css + * .view-animation.ng-enter, .view-animation.ng-leave { + * transition:0.5s linear all; + * position:fixed; + * left:0; + * top:0; + * width:100%; + * } + * .view-animation.ng-enter { + * transform:translateX(100%); + * } + * .view-animation.ng-leave, + * .view-animation.ng-enter.ng-enter-active { + * transform:translateX(0%); + * } + * .view-animation.ng-leave.ng-leave-active { + * transform:translateX(-100%); + * } + * ``` + * + * Now we can jump back to the anchor animation. When the animation happens, there are two stages that occur: + * an `out` and an `in` stage. The `out` stage happens first and that is when the element is animated away + * from its origin. Once that animation is over then the `in` stage occurs which animates the + * element to its destination. The reason why there are two animations is to give enough time + * for the enter animation on the new element to be ready. + * + * The example above sets up a transition for both the in and out phases, but we can also target the out or + * in phases directly via `ng-anchor-out` and `ng-anchor-in`. + * + * ```css + * .banner.ng-anchor-out { + * transition: 0.5s linear all; + * + * /* the scale will be applied during the out animation, + * but will be animated away when the in animation runs */ + * transform: scale(1.2); + * } + * + * .banner.ng-anchor-in { + * transition: 1s linear all; + * } + * ``` + * + * + * + * + * ### Anchoring Demo + * + + + Home +
    +
    +
    +
    +
    + + angular.module('anchoringExample', ['ngAnimate', 'ngRoute']) + .config(['$routeProvider', function($routeProvider) { + $routeProvider.when('/', { + templateUrl: 'home.html', + controller: 'HomeController as home' + }); + $routeProvider.when('/profile/:id', { + templateUrl: 'profile.html', + controller: 'ProfileController as profile' + }); + }]) + .run(['$rootScope', function($rootScope) { + $rootScope.records = [ + { id: 1, title: 'Miss Beulah Roob' }, + { id: 2, title: 'Trent Morissette' }, + { id: 3, title: 'Miss Ava Pouros' }, + { id: 4, title: 'Rod Pouros' }, + { id: 5, title: 'Abdul Rice' }, + { id: 6, title: 'Laurie Rutherford Sr.' }, + { id: 7, title: 'Nakia McLaughlin' }, + { id: 8, title: 'Jordon Blanda DVM' }, + { id: 9, title: 'Rhoda Hand' }, + { id: 10, title: 'Alexandrea Sauer' } + ]; + }]) + .controller('HomeController', [function() { + //empty + }]) + .controller('ProfileController', ['$rootScope', '$routeParams', + function ProfileController($rootScope, $routeParams) { + var index = parseInt($routeParams.id, 10); + var record = $rootScope.records[index - 1]; + + this.title = record.title; + this.id = record.id; + }]); + + +

    Welcome to the home page

    +

    Please click on an element

    + + {{ record.title }} + +
    + +
    + {{ profile.title }} +
    +
    + + .record { + display:block; + font-size:20px; + } + .profile { + background:black; + color:white; + font-size:100px; + } + .view-container { + position:relative; + } + .view-container > .view.ng-animate { + position:absolute; + top:0; + left:0; + width:100%; + min-height:500px; + } + .view.ng-enter, .view.ng-leave, + .record.ng-anchor { + transition:0.5s linear all; + } + .view.ng-enter { + transform:translateX(100%); + } + .view.ng-enter.ng-enter-active, .view.ng-leave { + transform:translateX(0%); + } + .view.ng-leave.ng-leave-active { + transform:translateX(-100%); + } + .record.ng-anchor-out { + background:red; + } + +
    + * + * ### How is the element transported? + * + * When an anchor animation occurs, ngAnimate will clone the starting element and position it exactly where the starting + * element is located on screen via absolute positioning. The cloned element will be placed inside of the root element + * of the application (where ng-app was defined) and all of the CSS classes of the starting element will be applied. The + * element will then animate into the `out` and `in` animations and will eventually reach the coordinates and match + * the dimensions of the destination element. During the entire animation a CSS class of `.ng-animate-shim` will be applied + * to both the starting and destination elements in order to hide them from being visible (the CSS styling for the class + * is: `visibility:hidden`). Once the anchor reaches its destination then it will be removed and the destination element + * will become visible since the shim class will be removed. + * + * ### How is the morphing handled? + * + * CSS Anchoring relies on transitions and keyframes and the internal code is intelligent enough to figure out + * what CSS classes differ between the starting element and the destination element. These different CSS classes + * will be added/removed on the anchor element and a transition will be applied (the transition that is provided + * in the anchor class). Long story short, ngAnimate will figure out what classes to add and remove which will + * make the transition of the element as smooth and automatic as possible. Be sure to use simple CSS classes that + * do not rely on DOM nesting structure so that the anchor element appears the same as the starting element (since + * the cloned element is placed inside of root element which is likely close to the body element). + * + * Note that if the root element is on the `` element then the cloned node will be placed inside of body. + * + * + * ## Using $animate in your directive code + * + * So far we've explored how to feed in animations into an AngularJS application, but how do we trigger animations within our own directives in our application? + * By injecting the `$animate` service into our directive code, we can trigger structural and class-based hooks which can then be consumed by animations. Let's + * imagine we have a greeting box that shows and hides itself when the data changes + * + * ```html + * Hi there + * ``` + * + * ```js + * ngModule.directive('greetingBox', ['$animate', function($animate) { + * return function(scope, element, attrs) { + * attrs.$observe('active', function(value) { + * value ? $animate.addClass(element, 'on') : $animate.removeClass(element, 'on'); + * }); + * }); + * }]); + * ``` + * + * Now the `on` CSS class is added and removed on the greeting box component. Now if we add a CSS class on top of the greeting box element + * in our HTML code then we can trigger a CSS or JS animation to happen. + * + * ```css + * /* normally we would create a CSS class to reference on the element */ + * greeting-box.on { transition:0.5s linear all; background:green; color:white; } + * ``` + * + * The `$animate` service contains a variety of other methods like `enter`, `leave`, `animate` and `setClass`. To learn more about what's + * possible be sure to visit the {@link ng.$animate $animate service API page}. + * + * + * ## Callbacks and Promises + * + * When `$animate` is called it returns a promise that can be used to capture when the animation has ended. Therefore if we were to trigger + * an animation (within our directive code) then we can continue performing directive and scope related activities after the animation has + * ended by chaining onto the returned promise that animation method returns. + * + * ```js + * // somewhere within the depths of the directive + * $animate.enter(element, parent).then(function() { + * //the animation has completed + * }); + * ``` + * + * (Note that earlier versions of AngularJS prior to v1.4 required the promise code to be wrapped using `$scope.$apply(...)`. This is not the case + * anymore.) + * + * In addition to the animation promise, we can also make use of animation-related callbacks within our directives and controller code by registering + * an event listener using the `$animate` service. Let's say for example that an animation was triggered on our view + * routing controller to hook into that: + * + * ```js + * ngModule.controller('HomePageController', ['$animate', function($animate) { + * $animate.on('enter', ngViewElement, function(element) { + * // the animation for this route has completed + * }]); + * }]) + * ``` + * + * (Note that you will need to trigger a digest within the callback to get AngularJS to notice any scope-related changes.) + */ + +var copy; +var extend; +var forEach; +var isArray; +var isDefined; +var isElement; +var isFunction; +var isObject; +var isString; +var isUndefined; +var jqLite; +var noop; + +/** + * @ngdoc service + * @name $animate + * @kind object + * + * @description + * The ngAnimate `$animate` service documentation is the same for the core `$animate` service. + * + * Click here {@link ng.$animate to learn more about animations with `$animate`}. + */ +angular.module('ngAnimate', [], function initAngularHelpers() { + // Access helpers from AngularJS core. + // Do it inside a `config` block to ensure `window.angular` is available. + noop = angular.noop; + copy = angular.copy; + extend = angular.extend; + jqLite = angular.element; + forEach = angular.forEach; + isArray = angular.isArray; + isString = angular.isString; + isObject = angular.isObject; + isUndefined = angular.isUndefined; + isDefined = angular.isDefined; + isFunction = angular.isFunction; + isElement = angular.isElement; +}) + .info({ angularVersion: '1.8.2' }) + .directive('ngAnimateSwap', ngAnimateSwapDirective) + + .directive('ngAnimateChildren', $$AnimateChildrenDirective) + .factory('$$rAFScheduler', $$rAFSchedulerFactory) + + .provider('$$animateQueue', $$AnimateQueueProvider) + .provider('$$animateCache', $$AnimateCacheProvider) + .provider('$$animation', $$AnimationProvider) + + .provider('$animateCss', $AnimateCssProvider) + .provider('$$animateCssDriver', $$AnimateCssDriverProvider) + + .provider('$$animateJs', $$AnimateJsProvider) + .provider('$$animateJsDriver', $$AnimateJsDriverProvider); + + +})(window, window.angular); + + +/***/ }), + +/***/ "./node_modules/angular-animate/index.js": +/*!***********************************************!*\ + !*** ./node_modules/angular-animate/index.js ***! + \***********************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +__webpack_require__(/*! ./angular-animate */ "./node_modules/angular-animate/angular-animate.js"); +module.exports = 'ngAnimate'; + + +/***/ }), + +/***/ "./node_modules/angular-aria/angular-aria.js": +/*!***************************************************!*\ + !*** ./node_modules/angular-aria/angular-aria.js ***! + \***************************************************/ +/***/ (() => { + +/** + * @license AngularJS v1.8.2 + * (c) 2010-2020 Google LLC. http://angularjs.org + * License: MIT + */ +(function(window, angular) {'use strict'; + +/** + * @ngdoc module + * @name ngAria + * @description + * + * The `ngAria` module provides support for common + * [ARIA](http://www.w3.org/TR/wai-aria/) + * attributes that convey state or semantic information about the application for users + * of assistive technologies, such as screen readers. + * + * ## Usage + * + * For ngAria to do its magic, simply include the module `ngAria` as a dependency. The following + * directives are supported: + * `ngModel`, `ngChecked`, `ngReadonly`, `ngRequired`, `ngValue`, `ngDisabled`, `ngShow`, `ngHide`, + * `ngClick`, `ngDblClick`, and `ngMessages`. + * + * Below is a more detailed breakdown of the attributes handled by ngAria: + * + * | Directive | Supported Attributes | + * |---------------------------------------------|-----------------------------------------------------------------------------------------------------| + * | {@link ng.directive:ngModel ngModel} | aria-checked, aria-valuemin, aria-valuemax, aria-valuenow, aria-invalid, aria-required, input roles | + * | {@link ng.directive:ngDisabled ngDisabled} | aria-disabled | + * | {@link ng.directive:ngRequired ngRequired} | aria-required | + * | {@link ng.directive:ngChecked ngChecked} | aria-checked | + * | {@link ng.directive:ngReadonly ngReadonly} | aria-readonly | + * | {@link ng.directive:ngValue ngValue} | aria-checked | + * | {@link ng.directive:ngShow ngShow} | aria-hidden | + * | {@link ng.directive:ngHide ngHide} | aria-hidden | + * | {@link ng.directive:ngDblclick ngDblclick} | tabindex | + * | {@link module:ngMessages ngMessages} | aria-live | + * | {@link ng.directive:ngClick ngClick} | tabindex, keydown event, button role | + * + * Find out more information about each directive by reading the + * {@link guide/accessibility ngAria Developer Guide}. + * + * ## Example + * Using ngDisabled with ngAria: + * ```html + * + * ``` + * Becomes: + * ```html + * + * ``` + * + * ## Disabling Specific Attributes + * It is possible to disable individual attributes added by ngAria with the + * {@link ngAria.$ariaProvider#config config} method. For more details, see the + * {@link guide/accessibility Developer Guide}. + * + * ## Disabling `ngAria` on Specific Elements + * It is possible to make `ngAria` ignore a specific element, by adding the `ng-aria-disable` + * attribute on it. Note that only the element itself (and not its child elements) will be ignored. + */ +var ARIA_DISABLE_ATTR = 'ngAriaDisable'; + +var ngAriaModule = angular.module('ngAria', ['ng']). + info({ angularVersion: '1.8.2' }). + provider('$aria', $AriaProvider); + +/** +* Internal Utilities +*/ +var nativeAriaNodeNames = ['BUTTON', 'A', 'INPUT', 'TEXTAREA', 'SELECT', 'DETAILS', 'SUMMARY']; + +var isNodeOneOf = function(elem, nodeTypeArray) { + if (nodeTypeArray.indexOf(elem[0].nodeName) !== -1) { + return true; + } +}; +/** + * @ngdoc provider + * @name $ariaProvider + * @this + * + * @description + * + * Used for configuring the ARIA attributes injected and managed by ngAria. + * + * ```js + * angular.module('myApp', ['ngAria'], function config($ariaProvider) { + * $ariaProvider.config({ + * ariaValue: true, + * tabindex: false + * }); + * }); + *``` + * + * ## Dependencies + * Requires the {@link ngAria} module to be installed. + * + */ +function $AriaProvider() { + var config = { + ariaHidden: true, + ariaChecked: true, + ariaReadonly: true, + ariaDisabled: true, + ariaRequired: true, + ariaInvalid: true, + ariaValue: true, + tabindex: true, + bindKeydown: true, + bindRoleForClick: true + }; + + /** + * @ngdoc method + * @name $ariaProvider#config + * + * @param {object} config object to enable/disable specific ARIA attributes + * + * - **ariaHidden** – `{boolean}` – Enables/disables aria-hidden tags + * - **ariaChecked** – `{boolean}` – Enables/disables aria-checked tags + * - **ariaReadonly** – `{boolean}` – Enables/disables aria-readonly tags + * - **ariaDisabled** – `{boolean}` – Enables/disables aria-disabled tags + * - **ariaRequired** – `{boolean}` – Enables/disables aria-required tags + * - **ariaInvalid** – `{boolean}` – Enables/disables aria-invalid tags + * - **ariaValue** – `{boolean}` – Enables/disables aria-valuemin, aria-valuemax and + * aria-valuenow tags + * - **tabindex** – `{boolean}` – Enables/disables tabindex tags + * - **bindKeydown** – `{boolean}` – Enables/disables keyboard event binding on non-interactive + * elements (such as `div` or `li`) using ng-click, making them more accessible to users of + * assistive technologies + * - **bindRoleForClick** – `{boolean}` – Adds role=button to non-interactive elements (such as + * `div` or `li`) using ng-click, making them more accessible to users of assistive + * technologies + * + * @description + * Enables/disables various ARIA attributes + */ + this.config = function(newConfig) { + config = angular.extend(config, newConfig); + }; + + function watchExpr(attrName, ariaAttr, nativeAriaNodeNames, negate) { + return function(scope, elem, attr) { + if (attr.hasOwnProperty(ARIA_DISABLE_ATTR)) return; + + var ariaCamelName = attr.$normalize(ariaAttr); + if (config[ariaCamelName] && !isNodeOneOf(elem, nativeAriaNodeNames) && !attr[ariaCamelName]) { + scope.$watch(attr[attrName], function(boolVal) { + // ensure boolean value + boolVal = negate ? !boolVal : !!boolVal; + elem.attr(ariaAttr, boolVal); + }); + } + }; + } + /** + * @ngdoc service + * @name $aria + * + * @description + * + * The $aria service contains helper methods for applying common + * [ARIA](http://www.w3.org/TR/wai-aria/) attributes to HTML directives. + * + * ngAria injects common accessibility attributes that tell assistive technologies when HTML + * elements are enabled, selected, hidden, and more. To see how this is performed with ngAria, + * let's review a code snippet from ngAria itself: + * + *```js + * ngAriaModule.directive('ngDisabled', ['$aria', function($aria) { + * return $aria.$$watchExpr('ngDisabled', 'aria-disabled', nativeAriaNodeNames, false); + * }]) + *``` + * Shown above, the ngAria module creates a directive with the same signature as the + * traditional `ng-disabled` directive. But this ngAria version is dedicated to + * solely managing accessibility attributes on custom elements. The internal `$aria` service is + * used to watch the boolean attribute `ngDisabled`. If it has not been explicitly set by the + * developer, `aria-disabled` is injected as an attribute with its value synchronized to the + * value in `ngDisabled`. + * + * Because ngAria hooks into the `ng-disabled` directive, developers do not have to do + * anything to enable this feature. The `aria-disabled` attribute is automatically managed + * simply as a silent side-effect of using `ng-disabled` with the ngAria module. + * + * The full list of directives that interface with ngAria: + * * **ngModel** + * * **ngChecked** + * * **ngReadonly** + * * **ngRequired** + * * **ngDisabled** + * * **ngValue** + * * **ngShow** + * * **ngHide** + * * **ngClick** + * * **ngDblclick** + * * **ngMessages** + * + * Read the {@link guide/accessibility ngAria Developer Guide} for a thorough explanation of each + * directive. + * + * + * ## Dependencies + * Requires the {@link ngAria} module to be installed. + */ + this.$get = function() { + return { + config: function(key) { + return config[key]; + }, + $$watchExpr: watchExpr + }; + }; +} + + +ngAriaModule.directive('ngShow', ['$aria', function($aria) { + return $aria.$$watchExpr('ngShow', 'aria-hidden', [], true); +}]) +.directive('ngHide', ['$aria', function($aria) { + return $aria.$$watchExpr('ngHide', 'aria-hidden', [], false); +}]) +.directive('ngValue', ['$aria', function($aria) { + return $aria.$$watchExpr('ngValue', 'aria-checked', nativeAriaNodeNames, false); +}]) +.directive('ngChecked', ['$aria', function($aria) { + return $aria.$$watchExpr('ngChecked', 'aria-checked', nativeAriaNodeNames, false); +}]) +.directive('ngReadonly', ['$aria', function($aria) { + return $aria.$$watchExpr('ngReadonly', 'aria-readonly', nativeAriaNodeNames, false); +}]) +.directive('ngRequired', ['$aria', function($aria) { + return $aria.$$watchExpr('ngRequired', 'aria-required', nativeAriaNodeNames, false); +}]) +.directive('ngModel', ['$aria', function($aria) { + + function shouldAttachAttr(attr, normalizedAttr, elem, allowNonAriaNodes) { + return $aria.config(normalizedAttr) && + !elem.attr(attr) && + (allowNonAriaNodes || !isNodeOneOf(elem, nativeAriaNodeNames)) && + (elem.attr('type') !== 'hidden' || elem[0].nodeName !== 'INPUT'); + } + + function shouldAttachRole(role, elem) { + // if element does not have role attribute + // AND element type is equal to role (if custom element has a type equaling shape) <-- remove? + // AND element is not in nativeAriaNodeNames + return !elem.attr('role') && (elem.attr('type') === role) && !isNodeOneOf(elem, nativeAriaNodeNames); + } + + function getShape(attr, elem) { + var type = attr.type, + role = attr.role; + + return ((type || role) === 'checkbox' || role === 'menuitemcheckbox') ? 'checkbox' : + ((type || role) === 'radio' || role === 'menuitemradio') ? 'radio' : + (type === 'range' || role === 'progressbar' || role === 'slider') ? 'range' : ''; + } + + return { + restrict: 'A', + require: 'ngModel', + priority: 200, //Make sure watches are fired after any other directives that affect the ngModel value + compile: function(elem, attr) { + if (attr.hasOwnProperty(ARIA_DISABLE_ATTR)) return; + + var shape = getShape(attr, elem); + + return { + post: function(scope, elem, attr, ngModel) { + var needsTabIndex = shouldAttachAttr('tabindex', 'tabindex', elem, false); + + function ngAriaWatchModelValue() { + return ngModel.$modelValue; + } + + function getRadioReaction(newVal) { + // Strict comparison would cause a BC + // eslint-disable-next-line eqeqeq + var boolVal = (attr.value == ngModel.$viewValue); + elem.attr('aria-checked', boolVal); + } + + function getCheckboxReaction() { + elem.attr('aria-checked', !ngModel.$isEmpty(ngModel.$viewValue)); + } + + switch (shape) { + case 'radio': + case 'checkbox': + if (shouldAttachRole(shape, elem)) { + elem.attr('role', shape); + } + if (shouldAttachAttr('aria-checked', 'ariaChecked', elem, false)) { + scope.$watch(ngAriaWatchModelValue, shape === 'radio' ? + getRadioReaction : getCheckboxReaction); + } + if (needsTabIndex) { + elem.attr('tabindex', 0); + } + break; + case 'range': + if (shouldAttachRole(shape, elem)) { + elem.attr('role', 'slider'); + } + if ($aria.config('ariaValue')) { + var needsAriaValuemin = !elem.attr('aria-valuemin') && + (attr.hasOwnProperty('min') || attr.hasOwnProperty('ngMin')); + var needsAriaValuemax = !elem.attr('aria-valuemax') && + (attr.hasOwnProperty('max') || attr.hasOwnProperty('ngMax')); + var needsAriaValuenow = !elem.attr('aria-valuenow'); + + if (needsAriaValuemin) { + attr.$observe('min', function ngAriaValueMinReaction(newVal) { + elem.attr('aria-valuemin', newVal); + }); + } + if (needsAriaValuemax) { + attr.$observe('max', function ngAriaValueMinReaction(newVal) { + elem.attr('aria-valuemax', newVal); + }); + } + if (needsAriaValuenow) { + scope.$watch(ngAriaWatchModelValue, function ngAriaValueNowReaction(newVal) { + elem.attr('aria-valuenow', newVal); + }); + } + } + if (needsTabIndex) { + elem.attr('tabindex', 0); + } + break; + } + + if (!attr.hasOwnProperty('ngRequired') && ngModel.$validators.required + && shouldAttachAttr('aria-required', 'ariaRequired', elem, false)) { + // ngModel.$error.required is undefined on custom controls + attr.$observe('required', function() { + elem.attr('aria-required', !!attr['required']); + }); + } + + if (shouldAttachAttr('aria-invalid', 'ariaInvalid', elem, true)) { + scope.$watch(function ngAriaInvalidWatch() { + return ngModel.$invalid; + }, function ngAriaInvalidReaction(newVal) { + elem.attr('aria-invalid', !!newVal); + }); + } + } + }; + } + }; +}]) +.directive('ngDisabled', ['$aria', function($aria) { + return $aria.$$watchExpr('ngDisabled', 'aria-disabled', nativeAriaNodeNames, false); +}]) +.directive('ngMessages', function() { + return { + restrict: 'A', + require: '?ngMessages', + link: function(scope, elem, attr, ngMessages) { + if (attr.hasOwnProperty(ARIA_DISABLE_ATTR)) return; + + if (!elem.attr('aria-live')) { + elem.attr('aria-live', 'assertive'); + } + } + }; +}) +.directive('ngClick',['$aria', '$parse', function($aria, $parse) { + return { + restrict: 'A', + compile: function(elem, attr) { + if (attr.hasOwnProperty(ARIA_DISABLE_ATTR)) return; + + var fn = $parse(attr.ngClick); + return function(scope, elem, attr) { + + if (!isNodeOneOf(elem, nativeAriaNodeNames)) { + + if ($aria.config('bindRoleForClick') && !elem.attr('role')) { + elem.attr('role', 'button'); + } + + if ($aria.config('tabindex') && !elem.attr('tabindex')) { + elem.attr('tabindex', 0); + } + + if ($aria.config('bindKeydown') && !attr.ngKeydown && !attr.ngKeypress && !attr.ngKeyup) { + elem.on('keydown', function(event) { + var keyCode = event.which || event.keyCode; + + if (keyCode === 13 || keyCode === 32) { + // If the event is triggered on a non-interactive element ... + if (nativeAriaNodeNames.indexOf(event.target.nodeName) === -1 && !event.target.isContentEditable) { + // ... prevent the default browser behavior (e.g. scrolling when pressing spacebar) + // See https://github.com/angular/angular.js/issues/16664 + event.preventDefault(); + } + scope.$apply(callback); + } + + function callback() { + fn(scope, { $event: event }); + } + }); + } + } + }; + } + }; +}]) +.directive('ngDblclick', ['$aria', function($aria) { + return function(scope, elem, attr) { + if (attr.hasOwnProperty(ARIA_DISABLE_ATTR)) return; + + if ($aria.config('tabindex') && !elem.attr('tabindex') && !isNodeOneOf(elem, nativeAriaNodeNames)) { + elem.attr('tabindex', 0); + } + }; +}]); + + +})(window, window.angular); + + +/***/ }), + +/***/ "./node_modules/angular-aria/index.js": +/*!********************************************!*\ + !*** ./node_modules/angular-aria/index.js ***! + \********************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +__webpack_require__(/*! ./angular-aria */ "./node_modules/angular-aria/angular-aria.js"); +module.exports = 'ngAria'; + + +/***/ }), + +/***/ "./node_modules/angular-local-storage/dist/angular-local-storage.js": +/*!**************************************************************************!*\ + !*** ./node_modules/angular-local-storage/dist/angular-local-storage.js ***! + \**************************************************************************/ +/***/ (() => { + +/** + * An Angular module that gives you access to the browsers local storage + * @version v0.7.1 - 2017-06-21 + * @link https://github.com/grevory/angular-local-storage + * @author grevory + * @license MIT License, http://www.opensource.org/licenses/MIT + */ +(function (window, angular) { +var isDefined = angular.isDefined, + isUndefined = angular.isUndefined, + isNumber = angular.isNumber, + isObject = angular.isObject, + isArray = angular.isArray, + isString = angular.isString, + extend = angular.extend, + toJson = angular.toJson; + +angular + .module('LocalStorageModule', []) + .provider('localStorageService', function() { + // You should set a prefix to avoid overwriting any local storage variables from the rest of your app + // e.g. localStorageServiceProvider.setPrefix('yourAppName'); + // With provider you can use config as this: + // myApp.config(function (localStorageServiceProvider) { + // localStorageServiceProvider.prefix = 'yourAppName'; + // }); + this.prefix = 'ls'; + + // You could change web storage type localstorage or sessionStorage + this.storageType = 'localStorage'; + + // Cookie options (usually in case of fallback) + // expiry = Number of days before cookies expire // 0 = Does not expire + // path = The web path the cookie represents + // secure = Wether the cookies should be secure (i.e only sent on HTTPS requests) + this.cookie = { + expiry: 30, + path: '/', + secure: false + }; + + // Decides wether we should default to cookies if localstorage is not supported. + this.defaultToCookie = true; + + // Send signals for each of the following actions? + this.notify = { + setItem: true, + removeItem: false + }; + + // Setter for the prefix + this.setPrefix = function(prefix) { + this.prefix = prefix; + return this; + }; + + // Setter for the storageType + this.setStorageType = function(storageType) { + this.storageType = storageType; + return this; + }; + // Setter for defaultToCookie value, default is true. + this.setDefaultToCookie = function (shouldDefault) { + this.defaultToCookie = !!shouldDefault; // Double-not to make sure it's a bool value. + return this; + }; + // Setter for cookie config + this.setStorageCookie = function(exp, path, secure) { + this.cookie.expiry = exp; + this.cookie.path = path; + this.cookie.secure = secure; + return this; + }; + + // Setter for cookie domain + this.setStorageCookieDomain = function(domain) { + this.cookie.domain = domain; + return this; + }; + + // Setter for notification config + // itemSet & itemRemove should be booleans + this.setNotify = function(itemSet, itemRemove) { + this.notify = { + setItem: itemSet, + removeItem: itemRemove + }; + return this; + }; + + this.$get = ['$rootScope', '$window', '$document', '$parse','$timeout', function($rootScope, $window, $document, $parse, $timeout) { + var self = this; + var prefix = self.prefix; + var cookie = self.cookie; + var notify = self.notify; + var storageType = self.storageType; + var webStorage; + + // When Angular's $document is not available + if (!$document) { + $document = document; + } else if ($document[0]) { + $document = $document[0]; + } + + // If there is a prefix set in the config lets use that with an appended period for readability + if (prefix.substr(-1) !== '.') { + prefix = !!prefix ? prefix + '.' : ''; + } + var deriveQualifiedKey = function(key) { + return prefix + key; + }; + + // Removes prefix from the key. + var underiveQualifiedKey = function (key) { + return key.replace(new RegExp('^' + prefix, 'g'), ''); + }; + + // Check if the key is within our prefix namespace. + var isKeyPrefixOurs = function (key) { + return key.indexOf(prefix) === 0; + }; + + // Checks the browser to see if local storage is supported + var checkSupport = function () { + try { + var supported = (storageType in $window && $window[storageType] !== null); + + // When Safari (OS X or iOS) is in private browsing mode, it appears as though localStorage + // is available, but trying to call .setItem throws an exception. + // + // "QUOTA_EXCEEDED_ERR: DOM Exception 22: An attempt was made to add something to storage + // that exceeded the quota." + var key = deriveQualifiedKey('__' + Math.round(Math.random() * 1e7)); + if (supported) { + webStorage = $window[storageType]; + webStorage.setItem(key, ''); + webStorage.removeItem(key); + } + + return supported; + } catch (e) { + // Only change storageType to cookies if defaulting is enabled. + if (self.defaultToCookie) + storageType = 'cookie'; + $rootScope.$broadcast('LocalStorageModule.notification.error', e.message); + return false; + } + }; + var browserSupportsLocalStorage = checkSupport(); + + // Directly adds a value to local storage + // If local storage is not available in the browser use cookies + // Example use: localStorageService.add('library','angular'); + var addToLocalStorage = function (key, value, type) { + var previousType = getStorageType(); + + try { + setStorageType(type); + + // Let's convert undefined values to null to get the value consistent + if (isUndefined(value)) { + value = null; + } else { + value = toJson(value); + } + + // If this browser does not support local storage use cookies + if (!browserSupportsLocalStorage && self.defaultToCookie || self.storageType === 'cookie') { + if (!browserSupportsLocalStorage) { + $rootScope.$broadcast('LocalStorageModule.notification.warning', 'LOCAL_STORAGE_NOT_SUPPORTED'); + } + + if (notify.setItem) { + $rootScope.$broadcast('LocalStorageModule.notification.setitem', {key: key, newvalue: value, storageType: 'cookie'}); + } + return addToCookies(key, value); + } + + try { + if (webStorage) { + webStorage.setItem(deriveQualifiedKey(key), value); + } + if (notify.setItem) { + $rootScope.$broadcast('LocalStorageModule.notification.setitem', {key: key, newvalue: value, storageType: self.storageType}); + } + } catch (e) { + $rootScope.$broadcast('LocalStorageModule.notification.error', e.message); + return addToCookies(key, value); + } + return true; + } finally { + setStorageType(previousType); + } + }; + + // Directly get a value from local storage + // Example use: localStorageService.get('library'); // returns 'angular' + var getFromLocalStorage = function (key, type) { + var previousType = getStorageType(); + + try { + setStorageType(type); + + if (!browserSupportsLocalStorage && self.defaultToCookie || self.storageType === 'cookie') { + if (!browserSupportsLocalStorage) { + $rootScope.$broadcast('LocalStorageModule.notification.warning', 'LOCAL_STORAGE_NOT_SUPPORTED'); + } + + return getFromCookies(key); + } + + var item = webStorage ? webStorage.getItem(deriveQualifiedKey(key)) : null; + // angular.toJson will convert null to 'null', so a proper conversion is needed + // FIXME not a perfect solution, since a valid 'null' string can't be stored + if (!item || item === 'null') { + return null; + } + + try { + return JSON.parse(item); + } catch (e) { + return item; + } + } finally { + setStorageType(previousType); + } + }; + + // Remove an item from local storage + // Example use: localStorageService.remove('library'); // removes the key/value pair of library='angular' + // + // This is var-arg removal, check the last argument to see if it is a storageType + // and set type accordingly before removing. + // + var removeFromLocalStorage = function () { + var previousType = getStorageType(); + + try { + // can't pop on arguments, so we do this + var consumed = 0; + if (arguments.length >= 1 && + (arguments[arguments.length - 1] === 'localStorage' || + arguments[arguments.length - 1] === 'sessionStorage')) { + consumed = 1; + setStorageType(arguments[arguments.length - 1]); + } + + var i, key; + for (i = 0; i < arguments.length - consumed; i++) { + key = arguments[i]; + if (!browserSupportsLocalStorage && self.defaultToCookie || self.storageType === 'cookie') { + if (!browserSupportsLocalStorage) { + $rootScope.$broadcast('LocalStorageModule.notification.warning', 'LOCAL_STORAGE_NOT_SUPPORTED'); + } + + if (notify.removeItem) { + $rootScope.$broadcast('LocalStorageModule.notification.removeitem', {key: key, storageType: 'cookie'}); + } + removeFromCookies(key); + } + else { + try { + webStorage.removeItem(deriveQualifiedKey(key)); + if (notify.removeItem) { + $rootScope.$broadcast('LocalStorageModule.notification.removeitem', { + key: key, + storageType: self.storageType + }); + } + } catch (e) { + $rootScope.$broadcast('LocalStorageModule.notification.error', e.message); + removeFromCookies(key); + } + } + } + } finally { + setStorageType(previousType); + } + }; + + // Return array of keys for local storage + // Example use: var keys = localStorageService.keys() + var getKeysForLocalStorage = function (type) { + var previousType = getStorageType(); + + try { + setStorageType(type); + + if (!browserSupportsLocalStorage) { + $rootScope.$broadcast('LocalStorageModule.notification.warning', 'LOCAL_STORAGE_NOT_SUPPORTED'); + return []; + } + + var prefixLength = prefix.length; + var keys = []; + for (var key in webStorage) { + // Only return keys that are for this app + if (key.substr(0, prefixLength) === prefix) { + try { + keys.push(key.substr(prefixLength)); + } catch (e) { + $rootScope.$broadcast('LocalStorageModule.notification.error', e.Description); + return []; + } + } + } + + return keys; + } finally { + setStorageType(previousType); + } + }; + + // Remove all data for this app from local storage + // Also optionally takes a regular expression string and removes the matching key-value pairs + // Example use: localStorageService.clearAll(); + // Should be used mostly for development purposes + var clearAllFromLocalStorage = function (regularExpression, type) { + var previousType = getStorageType(); + + try { + setStorageType(type); + + // Setting both regular expressions independently + // Empty strings result in catchall RegExp + var prefixRegex = !!prefix ? new RegExp('^' + prefix) : new RegExp(); + var testRegex = !!regularExpression ? new RegExp(regularExpression) : new RegExp(); + + if (!browserSupportsLocalStorage && self.defaultToCookie || self.storageType === 'cookie') { + if (!browserSupportsLocalStorage) { + $rootScope.$broadcast('LocalStorageModule.notification.warning', 'LOCAL_STORAGE_NOT_SUPPORTED'); + } + return clearAllFromCookies(); + } + if (!browserSupportsLocalStorage && !self.defaultToCookie) + return false; + var prefixLength = prefix.length; + + for (var key in webStorage) { + // Only remove items that are for this app and match the regular expression + if (prefixRegex.test(key) && testRegex.test(key.substr(prefixLength))) { + try { + removeFromLocalStorage(key.substr(prefixLength)); + } catch (e) { + $rootScope.$broadcast('LocalStorageModule.notification.error', e.message); + return clearAllFromCookies(); + } + } + } + + return true; + } finally { + setStorageType(previousType); + } + }; + + // Checks the browser to see if cookies are supported + var browserSupportsCookies = (function() { + try { + return $window.navigator.cookieEnabled || + ("cookie" in $document && ($document.cookie.length > 0 || + ($document.cookie = "test").indexOf.call($document.cookie, "test") > -1)); + } catch (e) { + $rootScope.$broadcast('LocalStorageModule.notification.error', e.message); + return false; + } + }()); + + // Directly adds a value to cookies + // Typically used as a fallback if local storage is not available in the browser + // Example use: localStorageService.cookie.add('library','angular'); + var addToCookies = function (key, value, daysToExpiry, secure) { + + if (isUndefined(value)) { + return false; + } else if(isArray(value) || isObject(value)) { + value = toJson(value); + } + + if (!browserSupportsCookies) { + $rootScope.$broadcast('LocalStorageModule.notification.error', 'COOKIES_NOT_SUPPORTED'); + return false; + } + + try { + var expiry = '', + expiryDate = new Date(), + cookieDomain = ''; + + if (value === null) { + // Mark that the cookie has expired one day ago + expiryDate.setTime(expiryDate.getTime() + (-1 * 24 * 60 * 60 * 1000)); + expiry = "; expires=" + expiryDate.toGMTString(); + value = ''; + } else if (isNumber(daysToExpiry) && daysToExpiry !== 0) { + expiryDate.setTime(expiryDate.getTime() + (daysToExpiry * 24 * 60 * 60 * 1000)); + expiry = "; expires=" + expiryDate.toGMTString(); + } else if (cookie.expiry !== 0) { + expiryDate.setTime(expiryDate.getTime() + (cookie.expiry * 24 * 60 * 60 * 1000)); + expiry = "; expires=" + expiryDate.toGMTString(); + } + if (!!key) { + var cookiePath = "; path=" + cookie.path; + if (cookie.domain) { + cookieDomain = "; domain=" + cookie.domain; + } + /* Providing the secure parameter always takes precedence over config + * (allows developer to mix and match secure + non-secure) */ + if (typeof secure === 'boolean') { + if (secure === true) { + /* We've explicitly specified secure, + * add the secure attribute to the cookie (after domain) */ + cookieDomain += "; secure"; + } + // else - secure has been supplied but isn't true - so don't set secure flag, regardless of what config says + } + else if (cookie.secure === true) { + // secure parameter wasn't specified, get default from config + cookieDomain += "; secure"; + } + $document.cookie = deriveQualifiedKey(key) + "=" + encodeURIComponent(value) + expiry + cookiePath + cookieDomain; + } + } catch (e) { + $rootScope.$broadcast('LocalStorageModule.notification.error', e.message); + return false; + } + return true; + }; + + // Directly get a value from a cookie + // Example use: localStorageService.cookie.get('library'); // returns 'angular' + var getFromCookies = function (key) { + if (!browserSupportsCookies) { + $rootScope.$broadcast('LocalStorageModule.notification.error', 'COOKIES_NOT_SUPPORTED'); + return false; + } + + var cookies = $document.cookie && $document.cookie.split(';') || []; + for(var i=0; i < cookies.length; i++) { + var thisCookie = cookies[i]; + while (thisCookie.charAt(0) === ' ') { + thisCookie = thisCookie.substring(1,thisCookie.length); + } + if (thisCookie.indexOf(deriveQualifiedKey(key) + '=') === 0) { + var storedValues = decodeURIComponent(thisCookie.substring(prefix.length + key.length + 1, thisCookie.length)); + try { + var parsedValue = JSON.parse(storedValues); + return typeof(parsedValue) === 'number' ? storedValues : parsedValue; + } catch(e) { + return storedValues; + } + } + } + return null; + }; + + var removeFromCookies = function (key) { + addToCookies(key,null); + }; + + var clearAllFromCookies = function () { + var thisCookie = null; + var prefixLength = prefix.length; + var cookies = $document.cookie.split(';'); + for(var i = 0; i < cookies.length; i++) { + thisCookie = cookies[i]; + + while (thisCookie.charAt(0) === ' ') { + thisCookie = thisCookie.substring(1, thisCookie.length); + } + + var key = thisCookie.substring(prefixLength, thisCookie.indexOf('=')); + removeFromCookies(key); + } + }; + + var getStorageType = function() { + return storageType; + }; + + var setStorageType = function(type) { + if (type && storageType !== type) { + storageType = type; + browserSupportsLocalStorage = checkSupport(); + } + return browserSupportsLocalStorage; + }; + + // Add a listener on scope variable to save its changes to local storage + // Return a function which when called cancels binding + var bindToScope = function(scope, key, def, lsKey, type) { + lsKey = lsKey || key; + var value = getFromLocalStorage(lsKey, type); + + if (value === null && isDefined(def)) { + value = def; + } else if (isObject(value) && isObject(def)) { + value = extend(value, def); + } + + $parse(key).assign(scope, value); + + return scope.$watch(key, function(newVal) { + addToLocalStorage(lsKey, newVal, type); + }, isObject(scope[key])); + }; + + // Add listener to local storage, for update callbacks. + if (browserSupportsLocalStorage) { + if ($window.addEventListener) { + $window.addEventListener("storage", handleStorageChangeCallback, false); + $rootScope.$on('$destroy', function() { + $window.removeEventListener("storage", handleStorageChangeCallback); + }); + } else if($window.attachEvent){ + // attachEvent and detachEvent are proprietary to IE v6-10 + $window.attachEvent("onstorage", handleStorageChangeCallback); + $rootScope.$on('$destroy', function() { + $window.detachEvent("onstorage", handleStorageChangeCallback); + }); + } + } + + // Callback handler for storage changed. + function handleStorageChangeCallback(e) { + if (!e) { e = $window.event; } + if (notify.setItem) { + if (isString(e.key) && isKeyPrefixOurs(e.key)) { + var key = underiveQualifiedKey(e.key); + // Use timeout, to avoid using $rootScope.$apply. + $timeout(function () { + $rootScope.$broadcast('LocalStorageModule.notification.changed', { key: key, newvalue: e.newValue, storageType: self.storageType }); + }); + } + } + } + + // Return localStorageService.length + // ignore keys that not owned + var lengthOfLocalStorage = function(type) { + var previousType = getStorageType(); + + try { + setStorageType(type); + + var count = 0; + var storage = $window[storageType]; + for(var i = 0; i < storage.length; i++) { + if(storage.key(i).indexOf(prefix) === 0 ) { + count++; + } + } + + return count; + } finally { + setStorageType(previousType); + } + }; + + var changePrefix = function(localStoragePrefix) { + prefix = localStoragePrefix; + }; + + return { + isSupported: browserSupportsLocalStorage, + getStorageType: getStorageType, + setStorageType: setStorageType, + setPrefix: changePrefix, + set: addToLocalStorage, + add: addToLocalStorage, //DEPRECATED + get: getFromLocalStorage, + keys: getKeysForLocalStorage, + remove: removeFromLocalStorage, + clearAll: clearAllFromLocalStorage, + bind: bindToScope, + deriveKey: deriveQualifiedKey, + underiveKey: underiveQualifiedKey, + length: lengthOfLocalStorage, + defaultToCookie: this.defaultToCookie, + cookie: { + isSupported: browserSupportsCookies, + set: addToCookies, + add: addToCookies, //DEPRECATED + get: getFromCookies, + remove: removeFromCookies, + clearAll: clearAllFromCookies + } + }; + }]; + }); +})(window, window.angular); + +/***/ }), + +/***/ "./node_modules/angular-local-storage/index.js": +/*!*****************************************************!*\ + !*** ./node_modules/angular-local-storage/index.js ***! + \*****************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +__webpack_require__(/*! ./dist/angular-local-storage.js */ "./node_modules/angular-local-storage/dist/angular-local-storage.js"); +module.exports = 'LocalStorageModule'; + + +/***/ }), + +/***/ "./node_modules/angular-material/angular-material.js": +/*!***********************************************************!*\ + !*** ./node_modules/angular-material/angular-material.js ***! + \***********************************************************/ +/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { + +/* provided dependency */ var __webpack_provided_window_dot_jQuery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js"); +/*! + * AngularJS Material Design + * https://github.com/angular/material + * @license MIT + * v1.2.3 + */ +(function( window, angular, undefined ){ +"use strict"; + +(function(){ +"use strict"; + +angular.module('ngMaterial', ["ng","ngAnimate","ngAria","material.core","material.core.animate","material.core.gestures","material.core.interaction","material.core.layout","material.core.meta","material.core.theming.palette","material.core.theming","material.components.autocomplete","material.components.backdrop","material.components.bottomSheet","material.components.button","material.components.card","material.components.checkbox","material.components.chips","material.components.colors","material.components.content","material.components.datepicker","material.components.dialog","material.components.divider","material.components.fabActions","material.components.fabShared","material.components.fabSpeedDial","material.components.fabToolbar","material.components.gridList","material.components.icon","material.components.input","material.components.list","material.components.menu","material.components.menuBar","material.components.navBar","material.components.panel","material.components.progressCircular","material.components.progressLinear","material.components.radioButton","material.components.select","material.components.showHide","material.components.sidenav","material.components.slider","material.components.sticky","material.components.subheader","material.components.swipe","material.components.switch","material.components.tabs","material.components.toast","material.components.toolbar","material.components.tooltip","material.components.truncate","material.components.virtualRepeat","material.components.whiteframe"]); +})(); +(function(){ +"use strict"; + +/** + * Initialization function that validates environment + * requirements. + */ +DetectNgTouch.$inject = ["$log", "$injector"]; +MdCoreConfigure.$inject = ["$provide", "$mdThemingProvider"]; +rAFDecorator.$inject = ["$delegate"]; +qDecorator.$inject = ["$delegate"]; +angular + .module('material.core', [ + 'ngAnimate', + 'material.core.animate', + 'material.core.layout', + 'material.core.interaction', + 'material.core.gestures', + 'material.core.theming' + ]) + .config(MdCoreConfigure) + .run(DetectNgTouch); + + +/** + * Detect if the ng-Touch module is also being used. + * Warn if detected. + * @ngInject + */ +function DetectNgTouch($log, $injector) { + if ($injector.has('$swipe')) { + var msg = "" + + "You are using the ngTouch module. \n" + + "AngularJS Material already has mobile click, tap, and swipe support... \n" + + "ngTouch is not supported with AngularJS Material!"; + $log.warn(msg); + } +} + +/** + * @ngInject + */ +function MdCoreConfigure($provide, $mdThemingProvider) { + + $provide.decorator('$$rAF', ['$delegate', rAFDecorator]); + $provide.decorator('$q', ['$delegate', qDecorator]); + + $mdThemingProvider.theme('default') + .primaryPalette('indigo') + .accentPalette('pink') + .warnPalette('deep-orange') + .backgroundPalette('grey'); +} + +/** + * @ngInject + */ +function rAFDecorator($delegate) { + /** + * Use this to throttle events that come in often. + * The throttled function will always use the *last* invocation before the + * coming frame. + * + * For example, window resize events that fire many times a second: + * If we set to use an raf-throttled callback on window resize, then + * our callback will only be fired once per frame, with the last resize + * event that happened before that frame. + * + * @param {function} cb function to debounce + */ + $delegate.throttle = function(cb) { + var queuedArgs, alreadyQueued, queueCb, context; + return function debounced() { + queuedArgs = arguments; + context = this; + queueCb = cb; + if (!alreadyQueued) { + alreadyQueued = true; + $delegate(function() { + queueCb.apply(context, Array.prototype.slice.call(queuedArgs)); + alreadyQueued = false; + }); + } + }; + }; + return $delegate; +} + +/** + * @ngInject + */ +function qDecorator($delegate) { + /** + * Adds a shim for $q.resolve for AngularJS version that don't have it, + * so we don't have to think about it. + * + * via https://github.com/angular/angular.js/pull/11987 + */ + + // TODO(crisbeto): this won't be necessary once we drop AngularJS 1.3 + if (!$delegate.resolve) { + $delegate.resolve = $delegate.when; + } + return $delegate; +} + +})(); +(function(){ +"use strict"; + + +MdAutofocusDirective.$inject = ["$parse"];angular.module('material.core') + .directive('mdAutofocus', MdAutofocusDirective); + +/** + * @ngdoc directive + * @name mdAutofocus + * @module material.core.util + * + * @description + * + * `[md-autofocus]` provides an optional way to identify the focused element when a `$mdDialog`, + * `$mdBottomSheet`, `$mdMenu` or `$mdSidenav` opens or upon page load for input-like elements. + * + * When one of these opens, it will find the first nested element with the `[md-autofocus]` + * attribute directive and optional expression. An expression may be specified as the directive + * value to enable conditional activation of the autofocus. + * + * @usage + * + * ### Dialog + * + * + *
    + * + * + * + * + *
    + *
    + *
    + * + * ### Bottomsheet + * + * + * Comment Actions + * + * + * + * + * + * {{ item.name }} + * + * + * + * + * + * + * + * ### Autocomplete + * + * + * {{item.display}} + * + * + * + * ### Sidenav + * + *
    + * + * Left Nav! + * + * + * + * Center Content + * + * Open Left Menu + * + * + * + * + *
    + * + * + * + * + *
    + *
    + *
    + *
    + **/ +function MdAutofocusDirective($parse) { + return { + restrict: 'A', + link: { + pre: preLink + } + }; + + function preLink(scope, element, attr) { + var attrExp = attr.mdAutoFocus || attr.mdAutofocus || attr.mdSidenavFocus; + + // Initially update the expression by manually parsing the expression as per $watch source. + updateExpression($parse(attrExp)(scope)); + + // Only watch the expression if it is not empty. + if (attrExp) { + scope.$watch(attrExp, updateExpression); + } + + /** + * Updates the autofocus class which is used to determine whether the attribute + * expression evaluates to true or false. + * @param {string|boolean} value Attribute Value + */ + function updateExpression(value) { + + // Rather than passing undefined to the jqLite toggle class function we explicitly set the + // value to true. Otherwise the class will be just toggled instead of being forced. + if (angular.isUndefined(value)) { + value = true; + } + + element.toggleClass('md-autofocus', !!value); + } + } + +} + +})(); +(function(){ +"use strict"; + +/** + * @ngdoc module + * @name material.core.colorUtil + * @description + * Color Util + */ +angular + .module('material.core') + .factory('$mdColorUtil', ColorUtilFactory); + +function ColorUtilFactory() { + /** + * Converts hex value to RGBA string + * @param color {string} + * @returns {string} + */ + function hexToRgba (color) { + var hex = color[ 0 ] === '#' ? color.substr(1) : color, + dig = hex.length / 3, + red = hex.substr(0, dig), + green = hex.substr(dig, dig), + blue = hex.substr(dig * 2); + if (dig === 1) { + red += red; + green += green; + blue += blue; + } + return 'rgba(' + parseInt(red, 16) + ',' + parseInt(green, 16) + ',' + parseInt(blue, 16) + ',0.1)'; + } + + /** + * Converts rgba value to hex string + * @param {string} color + * @returns {string} + */ + function rgbaToHex(color) { + color = color.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?/i); + + var hex = (color && color.length === 4) ? "#" + + ("0" + parseInt(color[1],10).toString(16)).slice(-2) + + ("0" + parseInt(color[2],10).toString(16)).slice(-2) + + ("0" + parseInt(color[3],10).toString(16)).slice(-2) : ''; + + return hex.toUpperCase(); + } + + /** + * Converts an RGB color to RGBA + * @param {string} color + * @returns {string} + */ + function rgbToRgba (color) { + return color.replace(')', ', 0.1)').replace('(', 'a('); + } + + /** + * Converts an RGBA color to RGB + * @param {string} color + * @returns {string} + */ + function rgbaToRgb (color) { + return color + ? color.replace('rgba', 'rgb').replace(/,[^),]+\)/, ')') + : 'rgb(0,0,0)'; + } + + return { + rgbaToHex: rgbaToHex, + hexToRgba: hexToRgba, + rgbToRgba: rgbToRgba, + rgbaToRgb: rgbaToRgb + }; +} + +})(); +(function(){ +"use strict"; + +angular.module('material.core') +.factory('$mdConstant', MdConstantFactory); + +/** + * Factory function that creates the grab-bag $mdConstant service. + * @ngInject + */ +function MdConstantFactory() { + + var prefixTestEl = document.createElement('div'); + var vendorPrefix = getVendorPrefix(prefixTestEl); + var isWebkit = /webkit/i.test(vendorPrefix); + var SPECIAL_CHARS_REGEXP = /([:\-_]+(.))/g; + + /** + * @param {string} name CSS property name + * @return {string} the property name supported by the browser + */ + function vendorProperty(name) { + // Add a dash between the prefix and name, to be able to transform the string into camelcase. + var prefixedName = vendorPrefix + '-' + name; + var ucPrefix = camelCase(prefixedName); + var lcPrefix = ucPrefix.charAt(0).toLowerCase() + ucPrefix.substring(1); + + return hasStyleProperty(prefixTestEl, name) ? name : // The current browser supports the un-prefixed property + hasStyleProperty(prefixTestEl, ucPrefix) ? ucPrefix : // The current browser only supports the prefixed property. + hasStyleProperty(prefixTestEl, lcPrefix) ? lcPrefix : name; // Some browsers are only supporting the prefix in lowercase. + } + + function hasStyleProperty(testElement, property) { + return angular.isDefined(testElement.style[property]); + } + + /** + * @param {!string} input value to convert to camelCase + * @return {string} camelCased version of the input string + */ + function camelCase(input) { + return input.replace(SPECIAL_CHARS_REGEXP, function(matches, separator, letter, offset) { + return offset ? letter.toUpperCase() : letter; + }); + } + + function getVendorPrefix(testElement) { + var prop, match; + var vendorRegex = /^(Moz|webkit|ms)(?=[A-Z])/; + + for (prop in testElement.style) { + if (match = vendorRegex.exec(prop)) { + return match[0]; + } + } + } + + var self = { + isInputKey : function(e) { return (e.keyCode >= 31 && e.keyCode <= 90); }, + isNumPadKey : function(e) { return (3 === e.location && e.keyCode >= 97 && e.keyCode <= 105); }, + isMetaKey: function(e) { return (e.keyCode >= 91 && e.keyCode <= 93); }, + isFnLockKey: function(e) { return (e.keyCode >= 112 && e.keyCode <= 145); }, + isNavigationKey : function(e) { + var kc = self.KEY_CODE, NAVIGATION_KEYS = [kc.SPACE, kc.ENTER, kc.UP_ARROW, kc.DOWN_ARROW]; + return (NAVIGATION_KEYS.indexOf(e.keyCode) != -1); + }, + hasModifierKey: function(e) { + return e.ctrlKey || e.metaKey || e.altKey; + }, + + /** + * Maximum size, in pixels, that can be explicitly set to an element. The actual value varies + * between browsers, but IE11 has the very lowest size at a mere 1,533,917px. Ideally we could + * compute this value, but Firefox always reports an element to have a size of zero if it + * goes over the max, meaning that we'd have to binary search for the value. + */ + ELEMENT_MAX_PIXELS: 1533917, + + /** + * Priority for a directive that should run before the directives from ngAria. + */ + BEFORE_NG_ARIA: 210, + + /** + * Common Keyboard actions and their associated keycode. + */ + KEY_CODE: { + COMMA: 188, + SEMICOLON : 186, + ENTER: 13, + ESCAPE: 27, + SPACE: 32, + PAGE_UP: 33, + PAGE_DOWN: 34, + END: 35, + HOME: 36, + LEFT_ARROW : 37, + UP_ARROW : 38, + RIGHT_ARROW : 39, + DOWN_ARROW : 40, + TAB : 9, + BACKSPACE: 8, + DELETE: 46 + }, + + /** + * Vendor prefixed CSS properties to be used to support the given functionality in older browsers + * as well. + */ + CSS: { + /* Constants */ + TRANSITIONEND: 'transitionend' + (isWebkit ? ' webkitTransitionEnd' : ''), + ANIMATIONEND: 'animationend' + (isWebkit ? ' webkitAnimationEnd' : ''), + + TRANSFORM: vendorProperty('transform'), + TRANSFORM_ORIGIN: vendorProperty('transformOrigin'), + TRANSITION: vendorProperty('transition'), + TRANSITION_DURATION: vendorProperty('transitionDuration'), + ANIMATION_PLAY_STATE: vendorProperty('animationPlayState'), + ANIMATION_DURATION: vendorProperty('animationDuration'), + ANIMATION_NAME: vendorProperty('animationName'), + ANIMATION_TIMING: vendorProperty('animationTimingFunction'), + ANIMATION_DIRECTION: vendorProperty('animationDirection') + }, + + /** + * As defined in core/style/_variables.scss + * + * $layout-breakpoint-xs: 600px !default; + * $layout-breakpoint-sm: 960px !default; + * $layout-breakpoint-md: 1280px !default; + * $layout-breakpoint-lg: 1920px !default; + * + */ + MEDIA: { + 'xs' : '(max-width: 599px)' , + 'gt-xs' : '(min-width: 600px)' , + 'sm' : '(min-width: 600px) and (max-width: 959px)' , + 'gt-sm' : '(min-width: 960px)' , + 'md' : '(min-width: 960px) and (max-width: 1279px)' , + 'gt-md' : '(min-width: 1280px)' , + 'lg' : '(min-width: 1280px) and (max-width: 1919px)', + 'gt-lg' : '(min-width: 1920px)' , + 'xl' : '(min-width: 1920px)' , + 'landscape' : '(orientation: landscape)' , + 'portrait' : '(orientation: portrait)' , + 'print' : 'print' + }, + + MEDIA_PRIORITY: [ + 'xl', + 'gt-lg', + 'lg', + 'gt-md', + 'md', + 'gt-sm', + 'sm', + 'gt-xs', + 'xs', + 'landscape', + 'portrait', + 'print' + ] + }; + + return self; +} + +})(); +(function(){ +"use strict"; + + angular + .module('material.core') + .config(["$provide", function($provide){ + $provide.decorator('$mdUtil', ['$delegate', function ($delegate){ + /** + * Inject the iterator facade to easily support iteration and accessors + * @see iterator below + */ + $delegate.iterator = MdIterator; + + return $delegate; + } + ]); + }]); + + /** + * iterator is a list facade to easily support iteration and accessors/ + * + * @param {any[]} items Array list which this iterator will enumerate + * @param {boolean=} reloop enables iterator to consider the list as an endless loop + * @return {{add: add, next: (function()), last: (function(): any|null), previous: (function()), count: (function(): number), hasNext: (function(*=): Array.length|*|number|boolean), inRange: (function(*): boolean), remove: remove, contains: (function(*=): *|boolean), itemAt: (function(*=): any|null), findBy: (function(*, *): *[]), hasPrevious: (function(*=): Array.length|*|number|boolean), items: (function(): *[]), indexOf: (function(*=): number), first: (function(): any|null)}} + * @constructor + */ + function MdIterator(items, reloop) { + var trueFn = function() { return true; }; + + if (items && !angular.isArray(items)) { + items = Array.prototype.slice.call(items); + } + + reloop = !!reloop; + var _items = items || []; + + // Published API + return { + items: getItems, + count: count, + + inRange: inRange, + contains: contains, + indexOf: indexOf, + itemAt: itemAt, + + findBy: findBy, + + add: add, + remove: remove, + + first: first, + last: last, + next: angular.bind(null, findSubsequentItem, false), + previous: angular.bind(null, findSubsequentItem, true), + + hasPrevious: hasPrevious, + hasNext: hasNext + }; + + /** + * Publish copy of the enumerable set + * @returns {Array|*} + */ + function getItems() { + return [].concat(_items); + } + + /** + * Determine length of the list + * @returns {Array.length|*|number} + */ + function count() { + return _items.length; + } + + /** + * Is the index specified valid + * @param index + * @returns {Array.length|*|number|boolean} + */ + function inRange(index) { + return _items.length && (index > -1) && (index < _items.length); + } + + /** + * Can the iterator proceed to the next item in the list; relative to + * the specified item. + * + * @param item + * @returns {Array.length|*|number|boolean} + */ + function hasNext(item) { + return item ? inRange(indexOf(item) + 1) : false; + } + + /** + * Can the iterator proceed to the previous item in the list; relative to + * the specified item. + * + * @param item + * @returns {Array.length|*|number|boolean} + */ + function hasPrevious(item) { + return item ? inRange(indexOf(item) - 1) : false; + } + + /** + * Get item at specified index/position + * @param index + * @returns {*} + */ + function itemAt(index) { + return inRange(index) ? _items[index] : null; + } + + /** + * Find all elements matching the key/value pair + * otherwise return null + * + * @param val + * @param key + * + * @return array + */ + function findBy(key, val) { + return _items.filter(function(item) { + return item[key] === val; + }); + } + + /** + * Add item to list + * @param item + * @param index + * @returns {*} + */ + function add(item, index) { + if (!item) return -1; + + if (!angular.isNumber(index)) { + index = _items.length; + } + + _items.splice(index, 0, item); + + return indexOf(item); + } + + /** + * Remove item from list... + * @param item + */ + function remove(item) { + if (contains(item)){ + _items.splice(indexOf(item), 1); + } + } + + /** + * Get the zero-based index of the target item + * @param item + * @returns {*} + */ + function indexOf(item) { + return _items.indexOf(item); + } + + /** + * Boolean existence check + * @param item + * @returns {boolean} + */ + function contains(item) { + return item && (indexOf(item) > -1); + } + + /** + * Return first item in the list + * @returns {*} + */ + function first() { + return _items.length ? _items[0] : null; + } + + /** + * Return last item in the list... + * @returns {*} + */ + function last() { + return _items.length ? _items[_items.length - 1] : null; + } + + /** + * Find the next item. If reloop is true and at the end of the list, it will go back to the + * first item. If given, the `validate` callback will be used to determine whether the next item + * is valid. If not valid, it will try to find the next item again. + * + * @param {boolean} backwards Specifies the direction of searching (forwards/backwards) + * @param {*} item The item whose subsequent item we are looking for + * @param {Function=} validate The `validate` function + * @param {integer=} limit The recursion limit + * + * @returns {*} The subsequent item or null + */ + function findSubsequentItem(backwards, item, validate, limit) { + validate = validate || trueFn; + + var curIndex = indexOf(item); + while (true) { + if (!inRange(curIndex)) return null; + + var nextIndex = curIndex + (backwards ? -1 : 1); + var foundItem = null; + if (inRange(nextIndex)) { + foundItem = _items[nextIndex]; + } else if (reloop) { + foundItem = backwards ? last() : first(); + nextIndex = indexOf(foundItem); + } + + if ((foundItem === null) || (nextIndex === limit)) return null; + if (validate(foundItem)) return foundItem; + + if (angular.isUndefined(limit)) limit = nextIndex; + + curIndex = nextIndex; + } + } + } + + +})(); +(function(){ +"use strict"; + + +mdMediaFactory.$inject = ["$mdConstant", "$rootScope", "$window"];angular.module('material.core') +.factory('$mdMedia', mdMediaFactory); + +/** + * @ngdoc service + * @name $mdMedia + * @module material.core + * + * @description + * `$mdMedia` is used to evaluate whether a given media query is true or false given the + * current device's screen / window size. The media query will be re-evaluated on resize, allowing + * you to register a watch. + * + * `$mdMedia` also has pre-programmed support for media queries that match the layout breakpoints: + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
    BreakpointmediaQuery
    xs(max-width: 599px)
    gt-xs(min-width: 600px)
    sm(min-width: 600px) and (max-width: 959px)
    gt-sm(min-width: 960px)
    md(min-width: 960px) and (max-width: 1279px)
    gt-md(min-width: 1280px)
    lg(min-width: 1280px) and (max-width: 1919px)
    gt-lg(min-width: 1920px)
    xl(min-width: 1920px)
    landscapelandscape
    portraitportrait
    printprint
    + * + * See Material Design's Layout - Adaptive UI for more details. + * + * + * + * + * + * @returns {boolean} a boolean representing whether or not the given media query is true or false. + * + * @usage + * + * app.controller('MyController', function($mdMedia, $scope) { + * $scope.$watch(function() { return $mdMedia('lg'); }, function(big) { + * $scope.bigScreen = big; + * }); + * + * $scope.screenIsSmall = $mdMedia('sm'); + * $scope.customQuery = $mdMedia('(min-width: 1234px)'); + * $scope.anotherCustom = $mdMedia('max-width: 300px'); + * }); + * + */ + +/* @ngInject */ +function mdMediaFactory($mdConstant, $rootScope, $window) { + var queries = {}; + var mqls = {}; + var results = {}; + var normalizeCache = {}; + + $mdMedia.getResponsiveAttribute = getResponsiveAttribute; + $mdMedia.getQuery = getQuery; + $mdMedia.watchResponsiveAttributes = watchResponsiveAttributes; + + return $mdMedia; + + function $mdMedia(query) { + var validated = queries[query]; + if (angular.isUndefined(validated)) { + validated = queries[query] = validate(query); + } + + var result = results[validated]; + if (angular.isUndefined(result)) { + result = add(validated); + } + + return result; + } + + function validate(query) { + return $mdConstant.MEDIA[query] || + ((query.charAt(0) !== '(') ? ('(' + query + ')') : query); + } + + function add(query) { + var result = mqls[query]; + if (!result) { + result = mqls[query] = $window.matchMedia(query); + } + + result.addListener(onQueryChange); + return (results[result.media] = !!result.matches); + } + + function onQueryChange(query) { + $rootScope.$evalAsync(function() { + results[query.media] = !!query.matches; + }); + } + + function getQuery(name) { + return mqls[name]; + } + + function getResponsiveAttribute(attrs, attrName) { + for (var i = 0; i < $mdConstant.MEDIA_PRIORITY.length; i++) { + var mediaName = $mdConstant.MEDIA_PRIORITY[i]; + if (!mqls[queries[mediaName]].matches) { + continue; + } + + var normalizedName = getNormalizedName(attrs, attrName + '-' + mediaName); + if (attrs[normalizedName]) { + return attrs[normalizedName]; + } + } + + // fallback on unprefixed + return attrs[getNormalizedName(attrs, attrName)]; + } + + function watchResponsiveAttributes(attrNames, attrs, watchFn) { + var unwatchFns = []; + attrNames.forEach(function(attrName) { + var normalizedName = getNormalizedName(attrs, attrName); + if (angular.isDefined(attrs[normalizedName])) { + unwatchFns.push( + attrs.$observe(normalizedName, angular.bind(void 0, watchFn, null))); + } + + for (var mediaName in $mdConstant.MEDIA) { + normalizedName = getNormalizedName(attrs, attrName + '-' + mediaName); + if (angular.isDefined(attrs[normalizedName])) { + unwatchFns.push( + attrs.$observe(normalizedName, angular.bind(void 0, watchFn, mediaName))); + } + } + }); + + return function unwatch() { + unwatchFns.forEach(function(fn) { fn(); }); + }; + } + + // Improves performance dramatically + function getNormalizedName(attrs, attrName) { + return normalizeCache[attrName] || + (normalizeCache[attrName] = attrs.$normalize(attrName)); + } +} + +})(); +(function(){ +"use strict"; + +angular + .module('material.core') + .config(["$provide", function($provide) { + $provide.decorator('$mdUtil', ['$delegate', function ($delegate) { + + // Inject the prefixer into our original $mdUtil service. + $delegate.prefixer = MdPrefixer; + + return $delegate; + }]); + }]); + +/** + * @param {string|string[]} initialAttributes + * @param {boolean} buildSelector + * @return {string|string[]|{buildSelector: (function(string|string[]): string), + * buildList: (function(string|string[]): string[]), + * hasAttribute: (function(JQLite|Element, string): HTMLElement), + * removeAttribute: (function(JQLite|Element, string): void)}} + * @constructor + */ +function MdPrefixer(initialAttributes, buildSelector) { + var PREFIXES = ['data', 'x']; + + if (initialAttributes) { + // The prefixer also accepts attributes as a parameter, and immediately builds a list or selector for + // the specified attributes. + return buildSelector ? _buildSelector(initialAttributes) : _buildList(initialAttributes); + } + + return { + buildList: _buildList, + buildSelector: _buildSelector, + hasAttribute: _hasAttribute, + removeAttribute: _removeAttribute + }; + + function _buildList(attributes) { + attributes = angular.isArray(attributes) ? attributes : [attributes]; + + attributes.forEach(function(item) { + PREFIXES.forEach(function(prefix) { + attributes.push(prefix + '-' + item); + }); + }); + + return attributes; + } + + function _buildSelector(attributes) { + attributes = angular.isArray(attributes) ? attributes : [attributes]; + + return _buildList(attributes) + .map(function(item) { + return '[' + item + ']'; + }) + .join(','); + } + + function _hasAttribute(element, attribute) { + element = _getNativeElement(element); + + if (!element) { + return false; + } + + var prefixedAttrs = _buildList(attribute); + + for (var i = 0; i < prefixedAttrs.length; i++) { + if (element.hasAttribute(prefixedAttrs[i])) { + return true; + } + } + + return false; + } + + function _removeAttribute(element, attribute) { + element = _getNativeElement(element); + + if (!element) { + return; + } + + _buildList(attribute).forEach(function(prefixedAttribute) { + element.removeAttribute(prefixedAttribute); + }); + } + + /** + * Transforms a jqLite or DOM element into a HTML element. + * This is useful when supporting jqLite elements and DOM elements at + * same time. + * @param element {JQLite|Element} Element to be parsed + * @returns {HTMLElement} Parsed HTMLElement + */ + function _getNativeElement(element) { + element = element[0] || element; + + if (element.nodeType) { + return element; + } + } + +} + +})(); +(function(){ +"use strict"; + +/* + * This var has to be outside the angular factory, otherwise when + * there are multiple material apps on the same page, each app + * will create its own instance of this array and the app's IDs + * will not be unique. + */ +UtilFactory.$inject = ["$document", "$timeout", "$compile", "$rootScope", "$$mdAnimate", "$interpolate", "$log", "$rootElement", "$window", "$$rAF"]; +var nextUniqueId = 0, isIos, isAndroid, isFirefox; + +// Support material-tools builds. +if (window.navigator) { + var userAgent = window.navigator.userAgent || window.navigator.vendor || window.opera; + isIos = userAgent.match(/ipad|iphone|ipod/i); + isAndroid = userAgent.match(/android/i); + isFirefox = userAgent.match(/(firefox|minefield)/i); +} + +/** + * @ngdoc module + * @name material.core.util + * @description + * Util + */ +angular +.module('material.core') +.factory('$mdUtil', UtilFactory); + +/** + * @ngInject + */ +function UtilFactory($document, $timeout, $compile, $rootScope, $$mdAnimate, $interpolate, $log, + $rootElement, $window, $$rAF) { + // Setup some core variables for the processTemplate method + var startSymbol = $interpolate.startSymbol(), + endSymbol = $interpolate.endSymbol(), + usesStandardSymbols = ((startSymbol === '{{') && (endSymbol === '}}')); + + // Polyfill document.contains for IE11. + document.contains || (document.contains = function (node) { + return document.body.contains(node); + }); + + /** + * Checks if the target element has the requested style by key + * @param {DOMElement|JQLite} target Target element + * @param {string} key Style key + * @param {string=} expectedVal Optional expected value + * @returns {boolean} Whether the target element has the style or not + */ + var hasComputedStyle = function (target, key, expectedVal) { + var hasValue = false; + + if (target && target.length) { + var computedStyles = $window.getComputedStyle(target[0]); + hasValue = angular.isDefined(computedStyles[key]) && + (expectedVal ? computedStyles[key] == expectedVal : true); + } + + return hasValue; + }; + + function validateCssValue(value) { + return !value ? '0' : + hasPx(value) || hasPercent(value) ? value : value + 'px'; + } + + function hasPx(value) { + return String(value).indexOf('px') > -1; + } + + function hasPercent(value) { + return String(value).indexOf('%') > -1; + } + + var $mdUtil = { + dom: {}, + isIos: isIos, + isAndroid: isAndroid, + now: window.performance && window.performance.now ? + angular.bind(window.performance, window.performance.now) : Date.now || function() { + return new Date().getTime(); + }, + + /** + * Cross-version compatibility method to retrieve an option of a ngModel controller, + * which supports the breaking changes in the AngularJS snapshot (SHA 87a2ff76af5d0a9268d8eb84db5755077d27c84c). + * @param {!ngModel.NgModelController} ngModelCtrl + * @param {!string} optionName + * @returns {string|number|boolean|Object|undefined} + */ + getModelOption: function (ngModelCtrl, optionName) { + if (!ngModelCtrl.$options) { + return; + } + + var $options = ngModelCtrl.$options; + + // The newer versions of AngularJS introduced a getOption function and made the option values + // no longer visible on the $options object. + return $options.getOption ? $options.getOption(optionName) : $options[optionName]; + }, + + /** + * Determines the current 'dir'ectional value based on the value of 'dir' + * attribute of the element. If that is not defined, it will try to use + * a 'dir' attribute of the body or html tag. + * + * @param {Object=} attrs a hash object with key-value pairs of normalized + * attribute names and their corresponding attribute values. + * @returns {boolean} true if the element's passed in attributes, + * the document, or the body indicates RTL mode, false otherwise. + */ + isRtl: function(attrs) { + var dir = angular.isDefined(attrs) && attrs.hasOwnProperty('dir') && attrs.dir; + + switch (dir) { + case 'ltr': + return false; + + case 'rtl': + return true; + } + + return ($document[0].dir === 'rtl' || $document[0].body.dir === 'rtl'); + }, + + /** + * Bi-directional accessor/mutator used to easily update an element's + * property based on the current 'dir'ectional value. + */ + bidi: function(element, property, lValue, rValue) { + var ltr = !this.isRtl(); + + // If accessor + if (arguments.length == 0) return ltr ? 'ltr' : 'rtl'; + + // If mutator + var elem = angular.element(element); + + if (ltr && angular.isDefined(lValue)) { + elem.css(property, validateCssValue(lValue)); + } + else if (!ltr && angular.isDefined(rValue)) { + elem.css(property, validateCssValue(rValue)); + } + }, + + bidiProperty: function (element, lProperty, rProperty, value) { + var ltr = !this.isRtl(); + + var elem = angular.element(element); + + if (ltr && angular.isDefined(lProperty)) { + elem.css(lProperty, validateCssValue(value)); + elem.css(rProperty, ''); + } + else if (!ltr && angular.isDefined(rProperty)) { + elem.css(rProperty, validateCssValue(value)); + elem.css(lProperty, ''); + } + }, + + clientRect: function(element, offsetParent, isOffsetRect) { + var node = getNode(element); + offsetParent = getNode(offsetParent || node.offsetParent || document.body); + var nodeRect = node.getBoundingClientRect(); + + // The user can ask for an offsetRect: a rect relative to the offsetParent, + // or a clientRect: a rect relative to the page + var offsetRect = isOffsetRect ? + offsetParent.getBoundingClientRect() : + {left: 0, top: 0, width: 0, height: 0}; + return { + left: nodeRect.left - offsetRect.left, + top: nodeRect.top - offsetRect.top, + width: nodeRect.width, + height: nodeRect.height + }; + }, + offsetRect: function(element, offsetParent) { + return $mdUtil.clientRect(element, offsetParent, true); + }, + + /** + * Annoying method to copy nodes to an array, thanks to IE. + * @param nodes + * @return {Array} + */ + nodesToArray: function(nodes) { + var results = [], i; + nodes = nodes || []; + + for (i = 0; i < nodes.length; ++i) { + results.push(nodes.item(i)); + } + return results; + }, + + /** + * Determines the absolute position of the viewport. + * Useful when making client rectangles absolute. + * @returns {number} + */ + getViewportTop: function() { + // If body scrolling is disabled, then use the cached viewport top value, otherwise get it + // fresh from the $window. + if ($mdUtil.disableScrollAround._count && $mdUtil.disableScrollAround._viewPortTop) { + return $mdUtil.disableScrollAround._viewPortTop; + } else { + return $window.scrollY || $window.pageYOffset || 0; + } + }, + + /** + * Finds the proper focus target by searching the DOM. + * + * @param {!JQLite} containerEl + * @param {string=} attributeVal + * @returns {JQLite|undefined} + */ + findFocusTarget: function(containerEl, attributeVal) { + var AUTO_FOCUS = this.prefixer('md-autofocus', true); + var elToFocus; + + elToFocus = scanForFocusable(containerEl, attributeVal || AUTO_FOCUS); + + // Scan for fallback to 'universal' API + if (!elToFocus) { + elToFocus = scanForFocusable(containerEl, AUTO_FOCUS); + } + + return elToFocus; + + /** + * Can target and nested children for specified Selector (attribute) + * whose value may be an expression that evaluates to True/False. + * @param {!JQLite} target + * @param {!string} selector + * @return {JQLite|undefined} + */ + function scanForFocusable(target, selector) { + var elFound, items = target[0].querySelectorAll(selector); + + // Find the last child element with the focus attribute + if (items && items.length) { + items.length && angular.forEach(items, function(it) { + it = angular.element(it); + + // Check the element for the md-autofocus class to ensure any associated expression + // evaluated to true. + var isFocusable = it.hasClass('md-autofocus'); + if (isFocusable) elFound = it; + }); + } + return elFound; + } + }, + + /** + * Disables scroll around the passed parent element. + * @param {Element|JQLite=} element Origin Element (not used) + * @param {Element|JQLite=} parent Element to disable scrolling within. + * Defaults to body if none supplied. + * @param {Object=} options Object of options to modify functionality + * - disableScrollMask Boolean of whether or not to create a scroll mask element or + * use the passed parent element. + */ + disableScrollAround: function(element, parent, options) { + options = options || {}; + + $mdUtil.disableScrollAround._count = Math.max(0, $mdUtil.disableScrollAround._count || 0); + $mdUtil.disableScrollAround._count++; + + if ($mdUtil.disableScrollAround._restoreScroll) { + return $mdUtil.disableScrollAround._restoreScroll; + } + + var body = $document[0].body; + var restoreBody = disableBodyScroll(); + var restoreElement = disableElementScroll(parent, options); + + return $mdUtil.disableScrollAround._restoreScroll = function() { + if (--$mdUtil.disableScrollAround._count <= 0) { + delete $mdUtil.disableScrollAround._viewPortTop; + restoreBody(); + restoreElement(); + delete $mdUtil.disableScrollAround._restoreScroll; + } + }; + + /** + * Creates a virtual scrolling mask to prevent touchmove, keyboard, scrollbar clicking, + * and wheel events. + * @param {!Element|!JQLite} elementToDisable + * @param {Object=} scrollMaskOptions Object of options to modify functionality + * - disableScrollMask Boolean of whether or not to create a scroll mask element or + * use the passed parent element. + * @returns {Function} + */ + function disableElementScroll(elementToDisable, scrollMaskOptions) { + var scrollMask; + var wrappedElementToDisable = angular.element(elementToDisable || body); + + if (scrollMaskOptions.disableScrollMask) { + scrollMask = wrappedElementToDisable; + } else { + scrollMask = angular.element( + '
    ' + + '
    ' + + '
    '); + wrappedElementToDisable.append(scrollMask); + } + + /** + * @param {Event} $event + */ + function preventDefault($event) { + $event.preventDefault(); + } + + scrollMask.on('wheel touchmove', preventDefault); + + return function restoreElementScroll() { + scrollMask.off('wheel touchmove', preventDefault); + + if (!scrollMaskOptions.disableScrollMask && scrollMask[0].parentNode) { + scrollMask[0].parentNode.removeChild(scrollMask[0]); + } + }; + } + + // Converts the body to a position fixed block and translate it to the proper scroll position + function disableBodyScroll() { + var documentElement = $document[0].documentElement; + + var prevDocumentStyle = documentElement.style.cssText || ''; + var prevBodyStyle = body.style.cssText || ''; + + var viewportTop = $mdUtil.getViewportTop(); + $mdUtil.disableScrollAround._viewPortTop = viewportTop; + var clientWidth = body.clientWidth; + var hasVerticalScrollbar = body.scrollHeight > body.clientHeight + 1; + + // Scroll may be set on element (for example by overflow-y: scroll) + // but Chrome is reporting the scrollTop position always on . + // scrollElement will allow to restore the scrollTop position to proper target. + var scrollElement = documentElement.scrollTop > 0 ? documentElement : body; + + if (hasVerticalScrollbar) { + angular.element(body).css({ + position: 'fixed', + width: '100%', + top: -viewportTop + 'px' + }); + } + + if (body.clientWidth < clientWidth) { + body.style.overflow = 'hidden'; + } + + return function restoreScroll() { + // Reset the inline style CSS to the previous. + body.style.cssText = prevBodyStyle; + documentElement.style.cssText = prevDocumentStyle; + + // The scroll position while being fixed + scrollElement.scrollTop = viewportTop; + }; + } + + }, + + enableScrolling: function() { + var restoreFn = this.disableScrollAround._restoreScroll; + restoreFn && restoreFn(); + }, + + floatingScrollbars: function() { + if (this.floatingScrollbars.cached === undefined) { + var tempNode = angular.element('
    ').css({ + width: '100%', + 'z-index': -1, + position: 'absolute', + height: '35px', + 'overflow-y': 'scroll' + }); + tempNode.children().css('height', '60px'); + + $document[0].body.appendChild(tempNode[0]); + this.floatingScrollbars.cached = + (tempNode[0].offsetWidth === tempNode[0].childNodes[0].offsetWidth); + tempNode.remove(); + } + return this.floatingScrollbars.cached; + }, + + /** + * Mobile safari only allows you to set focus in click event listeners. + * @param {Element|JQLite} element to focus + */ + forceFocus: function(element) { + var node = element[0] || element; + + document.addEventListener('click', function focusOnClick(ev) { + if (ev.target === node && ev.$focus) { + node.focus(); + ev.stopImmediatePropagation(); + ev.preventDefault(); + node.removeEventListener('click', focusOnClick); + } + }, true); + + var newEvent = document.createEvent('MouseEvents'); + newEvent.initMouseEvent('click', false, true, window, {}, 0, 0, 0, 0, + false, false, false, false, 0, null); + newEvent.$material = true; + newEvent.$focus = true; + node.dispatchEvent(newEvent); + }, + + /** + * facade to build md-backdrop element with desired styles + * NOTE: Use $compile to trigger backdrop postLink function + */ + createBackdrop: function(scope, addClass) { + return $compile($mdUtil.supplant('', [addClass]))(scope); + }, + + /** + * supplant() method from Crockford's `Remedial Javascript` + * Equivalent to use of $interpolate; without dependency on + * interpolation symbols and scope. Note: the '{}' can + * be property names, property chains, or array indices. + */ + supplant: function(template, values, pattern) { + pattern = pattern || /\{([^{}]*)\}/g; + return template.replace(pattern, function(a, b) { + var p = b.split('.'), + r = values; + try { + for (var s in p) { + if (p.hasOwnProperty(s)) { + r = r[p[s]]; + } + } + } catch (e) { + r = a; + } + return (typeof r === 'string' || typeof r === 'number') ? r : a; + }); + }, + + fakeNgModel: function() { + return { + $fake: true, + $setTouched: angular.noop, + $setViewValue: function(value) { + this.$viewValue = value; + this.$render(value); + this.$viewChangeListeners.forEach(function(cb) { + cb(); + }); + }, + $isEmpty: function(value) { + return ('' + value).length === 0; + }, + $parsers: [], + $formatters: [], + $viewChangeListeners: [], + $render: angular.noop + }; + }, + + /** + * @param {Function} func original function to be debounced + * @param {number} wait number of milliseconds to delay (since last debounce reset). + * Default value 10 msecs. + * @param {Object} scope in which to apply the function after debouncing ends + * @param {boolean} invokeApply should the $timeout trigger $digest() dirty checking + * @return {Function} A function, that, as long as it continues to be invoked, will not be + * triggered. The function will be called after it stops being called for N milliseconds. + */ + debounce: function(func, wait, scope, invokeApply) { + var timer; + + return function debounced() { + var context = scope, + args = Array.prototype.slice.call(arguments); + + $timeout.cancel(timer); + timer = $timeout(function() { + + timer = undefined; + func.apply(context, args); + + }, wait || 10, invokeApply); + }; + }, + + /** + * The function will not be called unless it has been more than `delay` milliseconds since the + * last call. + * @param {Function} func original function to throttle + * @param {number} delay number of milliseconds to delay + * @return {Function} a function that can only be triggered every `delay` milliseconds. + */ + throttle: function throttle(func, delay) { + var recent; + return function throttled() { + var context = this; + var args = arguments; + var now = $mdUtil.now(); + + if (!recent || (now - recent > delay)) { + func.apply(context, args); + recent = now; + } + }; + }, + + /** + * Measures the number of milliseconds taken to run the provided callback + * function. Uses a high-precision timer if available. + */ + time: function time(cb) { + var start = $mdUtil.now(); + cb(); + return $mdUtil.now() - start; + }, + + /** + * Create an implicit getter that caches its `getter()` + * lookup value + */ + valueOnUse : function (scope, key, getter) { + var value = null, args = Array.prototype.slice.call(arguments); + var params = (args.length > 3) ? args.slice(3) : []; + + Object.defineProperty(scope, key, { + get: function () { + if (value === null) value = getter.apply(scope, params); + return value; + } + }); + }, + + /** + * Get a unique ID. + * + * @returns {string} an unique numeric string + */ + nextUid: function() { + return '' + nextUniqueId++; + }, + + /** + * Stop watchers and events from firing on a scope without destroying it, + * by disconnecting it from its parent and its siblings' linked lists. + * @param {Object} scope to disconnect + */ + disconnectScope: function disconnectScope(scope) { + if (!scope) return; + + // we can't destroy the root scope or a scope that has been already destroyed + if (scope.$root === scope) return; + if (scope.$$destroyed) return; + + var parent = scope.$parent; + scope.$$disconnected = true; + + // See Scope.$destroy + if (parent.$$childHead === scope) parent.$$childHead = scope.$$nextSibling; + if (parent.$$childTail === scope) parent.$$childTail = scope.$$prevSibling; + if (scope.$$prevSibling) scope.$$prevSibling.$$nextSibling = scope.$$nextSibling; + if (scope.$$nextSibling) scope.$$nextSibling.$$prevSibling = scope.$$prevSibling; + + scope.$$nextSibling = scope.$$prevSibling = null; + + }, + + /** + * Undo the effects of disconnectScope(). + * @param {Object} scope to reconnect + */ + reconnectScope: function reconnectScope(scope) { + if (!scope) return; + + // we can't disconnect the root node or scope already disconnected + if (scope.$root === scope) return; + if (!scope.$$disconnected) return; + + var child = scope; + + var parent = child.$parent; + child.$$disconnected = false; + // See Scope.$new for this logic... + child.$$prevSibling = parent.$$childTail; + if (parent.$$childHead) { + parent.$$childTail.$$nextSibling = child; + parent.$$childTail = child; + } else { + parent.$$childHead = parent.$$childTail = child; + } + }, + + /** + * Get an element's siblings matching a given tag name. + * + * @param {JQLite|angular.element|HTMLElement} element Element to start walking the DOM from + * @param {string} tagName HTML tag name to match against + * @returns {Object[]} JQLite + */ + getSiblings: function getSiblings(element, tagName) { + var upperCasedTagName = tagName.toUpperCase(); + if (element instanceof angular.element) { + element = element[0]; + } + var siblings = Array.prototype.filter.call(element.parentNode.children, function(node) { + return element !== node && node.tagName.toUpperCase() === upperCasedTagName; + }); + return siblings.map(function (sibling) { + return angular.element(sibling); + }); + }, + + /** + * getClosest replicates jQuery.closest() to walk up the DOM tree until it finds a matching + * nodeName. + * + * @param {Node} el Element to start walking the DOM from + * @param {string|function} validateWith If a string is passed, it will be evaluated against + * each of the parent nodes' tag name. If a function is passed, the loop will call it with each + * of the parents and will use the return value to determine whether the node is a match. + * @param {boolean=} onlyParent Only start checking from the parent element, not `el`. + * @returns {Node|null} closest matching parent Node or null if not found + */ + getClosest: function getClosest(el, validateWith, onlyParent) { + if (angular.isString(validateWith)) { + var tagName = validateWith.toUpperCase(); + validateWith = function(el) { + return el.nodeName.toUpperCase() === tagName; + }; + } + + if (el instanceof angular.element) el = el[0]; + if (onlyParent) el = el.parentNode; + if (!el) return null; + + do { + if (validateWith(el)) { + return el; + } + } while (el = el.parentNode); + + return null; + }, + + /** + * Build polyfill for the Node.contains feature (if needed) + * @param {Node} node + * @param {Node} child + * @returns {Node} + */ + elementContains: function(node, child) { + var hasContains = (window.Node && window.Node.prototype && Node.prototype.contains); + var findFn = hasContains ? angular.bind(node, node.contains) : angular.bind(node, function(arg) { + // compares the positions of two nodes and returns a bitmask + return (node === child) || !!(this.compareDocumentPosition(arg) & 16); + }); + + return findFn(child); + }, + + /** + * Functional equivalent for $element.filter(‘md-bottom-sheet’) + * useful with interimElements where the element and its container are important... + * + * @param {JQLite} element to scan + * @param {string} nodeName of node to find (e.g. 'md-dialog') + * @param {boolean=} scanDeep optional flag to allow deep scans; defaults to 'false'. + * @param {boolean=} warnNotFound optional flag to enable log warnings; defaults to false + */ + extractElementByName: function(element, nodeName, scanDeep, warnNotFound) { + var found = scanTree(element); + if (!found && !!warnNotFound) { + $log.warn($mdUtil.supplant("Unable to find node '{0}' in element '{1}'.",[nodeName, element[0].outerHTML])); + } + + return angular.element(found || element); + + /** + * Breadth-First tree scan for element with matching `nodeName` + */ + function scanTree(element) { + return scanLevel(element) || (scanDeep ? scanChildren(element) : null); + } + + /** + * Case-insensitive scan of current elements only (do not descend). + */ + function scanLevel(element) { + if (element) { + for (var i = 0, len = element.length; i < len; i++) { + if (element[i].nodeName.toLowerCase() === nodeName) { + return element[i]; + } + } + } + return null; + } + + /** + * Scan children of specified node + */ + function scanChildren(element) { + var found; + if (element) { + for (var i = 0, len = element.length; i < len; i++) { + var target = element[i]; + if (!found) { + for (var j = 0, numChild = target.childNodes.length; j < numChild; j++) { + found = found || scanTree([target.childNodes[j]]); + } + } + } + } + return found; + } + + }, + + /** + * Give optional properties with no value a boolean true if attr provided or false otherwise + */ + initOptionalProperties: function(scope, attr, defaults) { + defaults = defaults || {}; + angular.forEach(scope.$$isolateBindings, function(binding, key) { + if (binding.optional && angular.isUndefined(scope[key])) { + var attrIsDefined = angular.isDefined(attr[binding.attrName]); + scope[key] = angular.isDefined(defaults[key]) ? defaults[key] : attrIsDefined; + } + }); + }, + + /** + * Alternative to $timeout calls with 0 delay. + * nextTick() coalesces all calls within a single frame + * to minimize $digest thrashing + * + * @param {Function} callback function to be called after the tick + * @param {boolean=} digest true to call $rootScope.$digest() after callback + * @param {Object=} scope associated with callback. If the scope is destroyed, the callback will + * be skipped. + * @returns {*} + */ + nextTick: function(callback, digest, scope) { + // grab function reference for storing state details + var nextTick = $mdUtil.nextTick; + var timeout = nextTick.timeout; + var queue = nextTick.queue || []; + + // add callback to the queue + queue.push({scope: scope, callback: callback}); + + // set default value for digest + if (digest == null) digest = true; + + // store updated digest/queue values + nextTick.digest = nextTick.digest || digest; + nextTick.queue = queue; + + // either return existing timeout or create a new one + return timeout || (nextTick.timeout = $timeout(processQueue, 0, false)); + + /** + * Grab a copy of the current queue + * Clear the queue for future use + * Process the existing queue + * Trigger digest if necessary + */ + function processQueue() { + var queue = nextTick.queue; + var digest = nextTick.digest; + + nextTick.queue = []; + nextTick.timeout = null; + nextTick.digest = false; + + queue.forEach(function(queueItem) { + var skip = queueItem.scope && queueItem.scope.$$destroyed; + if (!skip) { + queueItem.callback(); + } + }); + + if (digest) $rootScope.$digest(); + } + }, + + /** + * Processes a template and replaces the start/end symbols if the application has + * overridden them. + * + * @param template The template to process whose start/end tags may be replaced. + * @returns {*} + */ + processTemplate: function(template) { + if (usesStandardSymbols) { + return template; + } else { + if (!template || !angular.isString(template)) return template; + return template.replace(/\{\{/g, startSymbol).replace(/}}/g, endSymbol); + } + }, + + /** + * Scan up dom hierarchy for enabled parent; + */ + getParentWithPointerEvents: function (element) { + var parent = element.parent(); + + // jqLite might return a non-null, but still empty, parent; so check for parent and length + while (hasComputedStyle(parent, 'pointer-events', 'none')) { + parent = parent.parent(); + } + + return parent; + }, + + getNearestContentElement: function (element) { + var current = element.parent()[0]; + // Look for the nearest parent md-content, stopping at the rootElement. + while (current && current !== $rootElement[0] && current !== document.body && current.nodeName.toUpperCase() !== 'MD-CONTENT') { + current = current.parentNode; + } + return current; + }, + + /** + * Checks if the current browser is natively supporting the `sticky` position. + * @returns {string} supported sticky property name + */ + checkStickySupport: function() { + var stickyProp; + var testEl = angular.element('
    '); + $document[0].body.appendChild(testEl[0]); + + var stickyProps = ['sticky', '-webkit-sticky']; + for (var i = 0; i < stickyProps.length; ++i) { + testEl.css({ + position: stickyProps[i], + top: 0, + 'z-index': 2 + }); + + if (testEl.css('position') == stickyProps[i]) { + stickyProp = stickyProps[i]; + break; + } + } + + testEl.remove(); + + return stickyProp; + }, + + /** + * Parses an attribute value, mostly a string. + * By default checks for negated values and returns `false´ if present. + * Negated values are: (native falsy) and negative strings like: + * `false` or `0`. + * @param value Attribute value which should be parsed. + * @param negatedCheck When set to false, won't check for negated values. + * @returns {boolean} + */ + parseAttributeBoolean: function(value, negatedCheck) { + return value === '' || !!value && (negatedCheck === false || value !== 'false' && value !== '0'); + }, + + hasComputedStyle: hasComputedStyle, + + /** + * Returns true if the parent form of the element has been submitted. + * @param element An AngularJS or HTML5 element. + * @returns {boolean} + */ + isParentFormSubmitted: function(element) { + var parent = $mdUtil.getClosest(element, 'form'); + var form = parent ? angular.element(parent).controller('form') : null; + + return form ? form.$submitted : false; + }, + + /** + * Animate the requested element's scrollTop to the requested scrollPosition with basic easing. + * @param {!Element} element The element to scroll. + * @param {number} scrollEnd The new/final scroll position. + * @param {number=} duration Duration of the scroll. Default is 1000ms. + */ + animateScrollTo: function(element, scrollEnd, duration) { + var scrollStart = element.scrollTop; + var scrollChange = scrollEnd - scrollStart; + var scrollingDown = scrollStart < scrollEnd; + var startTime = $mdUtil.now(); + + $$rAF(scrollChunk); + + function scrollChunk() { + var newPosition = calculateNewPosition(); + + element.scrollTop = newPosition; + + if (scrollingDown ? newPosition < scrollEnd : newPosition > scrollEnd) { + $$rAF(scrollChunk); + } + } + + function calculateNewPosition() { + var easeDuration = duration || 1000; + var currentTime = $mdUtil.now() - startTime; + + return ease(currentTime, scrollStart, scrollChange, easeDuration); + } + + function ease(currentTime, start, change, duration) { + // If the duration has passed (which can occur if our app loses focus due to $$rAF), jump + // straight to the proper position + if (currentTime > duration) { + return start + change; + } + + var ts = (currentTime /= duration) * currentTime; + var tc = ts * currentTime; + + return start + change * (-2 * tc + 3 * ts); + } + }, + + /** + * Provides an easy mechanism for removing duplicates from an array. + * + * var myArray = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4]; + * + * $mdUtil.uniq(myArray) => [1, 2, 3, 4] + * + * @param {Array} array The array whose unique values should be returned. + * @returns {Array|void} A copy of the array containing only unique values. + */ + uniq: function(array) { + if (!array) { return; } + + return array.filter(function(value, index, self) { + return self.indexOf(value) === index; + }); + }, + + /** + * Gets the inner HTML content of the given HTMLElement. + * Only intended for use with SVG or Symbol elements in IE11. + * @param {Element} element + * @returns {string} the inner HTML of the element passed in + */ + getInnerHTML: function(element) { + // For SVG or Symbol elements, innerHTML returns `undefined` in IE. + // Reference: https://stackoverflow.com/q/28129956/633107 + // The XMLSerializer API is supported on IE11 and is the recommended workaround. + var serializer = new XMLSerializer(); + + return Array.prototype.map.call(element.childNodes, function (child) { + return serializer.serializeToString(child); + }).join(''); + }, + + /** + * Gets the outer HTML content of the given HTMLElement. + * Only intended for use with SVG or Symbol elements in IE11. + * @param {Element} element + * @returns {string} the outer HTML of the element passed in + */ + getOuterHTML: function(element) { + // For SVG or Symbol elements, outerHTML returns `undefined` in IE. + // Reference: https://stackoverflow.com/q/29888050/633107 + // The XMLSerializer API is supported on IE11 and is the recommended workaround. + var serializer = new XMLSerializer(); + return serializer.serializeToString(element); + }, + + /** + * Support: IE 9-11 only + * documentMode is an IE-only property + * http://msdn.microsoft.com/en-us/library/ie/cc196988(v=vs.85).aspx + */ + msie: window.document.documentMode, + + getTouchAction: function() { + var testEl = document.createElement('div'); + var vendorPrefixes = ['', 'webkit', 'Moz', 'MS', 'ms', 'o']; + + for (var i = 0; i < vendorPrefixes.length; i++) { + var prefix = vendorPrefixes[i]; + var property = prefix ? prefix + 'TouchAction' : 'touchAction'; + if (angular.isDefined(testEl.style[property])) { + return property; + } + } + }, + + /** + * @param {Event} event the event to calculate the bubble path for + * @return {EventTarget[]} the set of nodes that this event could bubble up to + */ + getEventPath: function(event) { + var path = []; + var currentTarget = event.target; + while (currentTarget) { + path.push(currentTarget); + currentTarget = currentTarget.parentElement; + } + if (path.indexOf(window) === -1 && path.indexOf(document) === -1) + path.push(document); + if (path.indexOf(window) === -1) + path.push(window); + return path; + }, + + /** + * Gets the string the user has entered and removes Regex identifiers + * @param {string} term + * @returns {string} sanitized string + */ + sanitize: function(term) { + if (!term) return term; + return term.replace(/[\\^$*+?.()|{}[]/g, '\\$&'); + }, + + /********************************************************************************************** + * The following functions were sourced from + * https://github.com/angular/components/blob/3c37e4b1c1cb74a3d0a90d173240fc730d21d9d4/src/cdk/a11y/interactivity-checker/interactivity-checker.ts + **********************************************************************************************/ + + /** + * Gets whether an element is disabled. + * @param {HTMLElement} element Element to be checked. + * @returns {boolean} Whether the element is disabled. + */ + isDisabled: function(element) { + // This does not capture some cases, such as a non-form control with a disabled attribute or + // a form control inside of a disabled form, but should capture the most common cases. + return element.hasAttribute('disabled'); + }, + + /** + * Gets whether an element is visible for the purposes of interactivity. + * + * This will capture states like `display: none` and `visibility: hidden`, but not things like + * being clipped by an `overflow: hidden` parent or being outside the viewport. + * + * @param {HTMLElement} element + * @returns {boolean} Whether the element is visible. + */ + isVisible: function(element) { + return $mdUtil.hasGeometry(element) && getComputedStyle(element).visibility === 'visible'; + }, + + /** + * Gets whether an element can be reached via Tab key. + * Assumes that the element has already been checked with isFocusable. + * @param {HTMLElement} element Element to be checked. + * @returns {boolean} Whether the element is tabbable. + */ + isTabbable: function(element) { + var frameElement = $mdUtil.getFrameElement($mdUtil.getWindow(element)); + + if (frameElement) { + // Frame elements inherit their tabindex onto all child elements. + if ($mdUtil.getTabIndexValue(frameElement) === -1) { + return false; + } + + // Browsers disable tabbing to an element inside of an invisible frame. + if (!$mdUtil.isVisible(frameElement)) { + return false; + } + } + + var nodeName = element.nodeName.toLowerCase(); + var tabIndexValue = $mdUtil.getTabIndexValue(element); + + if (element.hasAttribute('contenteditable')) { + return tabIndexValue !== -1; + } + + if (nodeName === 'iframe' || nodeName === 'object') { + // The frame or object's content may be tabbable depending on the content, but it's + // not possibly to reliably detect the content of the frames. We always consider such + // elements as non-tabbable. + return false; + } + + // In iOS, the browser only considers some specific elements as tabbable. + if (isIos && !$mdUtil.isPotentiallyTabbableIOS(element)) { + return false; + } + + if (nodeName === 'audio') { + // Audio elements without controls enabled are never tabbable, regardless + // of the tabindex attribute explicitly being set. + if (!element.hasAttribute('controls')) { + return false; + } + // Audio elements with controls are by default tabbable unless the + // tabindex attribute is set to `-1` explicitly. + return tabIndexValue !== -1; + } + + if (nodeName === 'video') { + // For all video elements, if the tabindex attribute is set to `-1`, the video + // is not tabbable. Note: We cannot rely on the default `HTMLElement.tabIndex` + // property as that one is set to `-1` in Chrome, Edge and Safari v13.1. The + // tabindex attribute is the source of truth here. + if (tabIndexValue === -1) { + return false; + } + // If the tabindex is explicitly set, and not `-1` (as per check before), the + // video element is always tabbable (regardless of whether it has controls or not). + if (tabIndexValue !== null) { + return true; + } + // Otherwise (when no explicit tabindex is set), a video is only tabbable if it + // has controls enabled. Firefox is special as videos are always tabbable regardless + // of whether there are controls or not. + return isFirefox || element.hasAttribute('controls'); + } + + return element.tabIndex >= 0; + }, + + /** + * Gets whether an element can be focused by the user. + * @param {HTMLElement} element Element to be checked. + * @returns {boolean} Whether the element is focusable. + */ + isFocusable: function(element) { + // Perform checks in order of left to most expensive. + // Again, naive approach that does not capture many edge cases and browser quirks. + return $mdUtil.isPotentiallyFocusable(element) && !$mdUtil.isDisabled(element) && + $mdUtil.isVisible(element); + }, + + /** + * Gets whether an element is potentially focusable without taking current visible/disabled + * state into account. + * @param {HTMLElement} element + * @returns {boolean} + */ + isPotentiallyFocusable: function(element) { + // Inputs are potentially focusable *unless* they're type="hidden". + if ($mdUtil.isHiddenInput(element)) { + return false; + } + + return $mdUtil.isNativeFormElement(element) || + $mdUtil.isAnchorWithHref(element) || + element.hasAttribute('contenteditable') || + $mdUtil.hasValidTabIndex(element); + }, + + /** + * Checks whether the specified element is potentially tabbable on iOS. + * @param {HTMLElement} element + * @returns {boolean} + */ + isPotentiallyTabbableIOS: function(element) { + var nodeName = element.nodeName.toLowerCase(); + var inputType = nodeName === 'input' && element.type; + + return inputType === 'text' + || inputType === 'password' + || nodeName === 'select' + || nodeName === 'textarea'; + }, + + /** + * Returns the parsed tabindex from the element attributes instead of returning the + * evaluated tabindex from the browsers defaults. + * @param {HTMLElement} element + * @returns {null|number} + */ + getTabIndexValue: function(element) { + if (!$mdUtil.hasValidTabIndex(element)) { + return null; + } + + // See browser issue in Gecko https://bugzilla.mozilla.org/show_bug.cgi?id=1128054 + var tabIndex = parseInt(element.getAttribute('tabindex') || '', 10); + + return isNaN(tabIndex) ? -1 : tabIndex; + }, + + /** + * Gets whether an element has a valid tabindex. + * @param {HTMLElement} element + * @returns {boolean} + */ + hasValidTabIndex: function(element) { + if (!element.hasAttribute('tabindex') || element.tabIndex === undefined) { + return false; + } + + var tabIndex = element.getAttribute('tabindex'); + + // IE11 parses tabindex="" as the value "-32768" + if (tabIndex == '-32768') { + return false; + } + + return !!(tabIndex && !isNaN(parseInt(tabIndex, 10))); + }, + + /** + * Checks whether the specified element has any geometry / rectangles. + * @param {HTMLElement} element + * @returns {boolean} + */ + hasGeometry: function(element) { + // Use logic from jQuery to check for an invisible element. + // See https://github.com/jquery/jquery/blob/8969732518470a7f8e654d5bc5be0b0076cb0b87/src/css/hiddenVisibleSelectors.js#L9 + return !!(element.offsetWidth || element.offsetHeight || + (typeof element.getClientRects === 'function' && element.getClientRects().length)); + }, + + /** + * Returns the frame element from a window object. Since browsers like MS Edge throw errors if + * the frameElement property is being accessed from a different host address, this property + * should be accessed carefully. + * @param {Window} window + * @returns {null|HTMLElement} + */ + getFrameElement: function(window) { + try { + return window.frameElement; + } catch (error) { + return null; + } + }, + + /** + * Gets the parent window of a DOM node with regards of being inside of an iframe. + * @param {HTMLElement} node + * @returns {Window} + */ + getWindow: function(node) { + // ownerDocument is null if `node` itself *is* a document. + return node.ownerDocument && node.ownerDocument.defaultView || window; + }, + + /** + * Gets whether an element's + * @param {Node} element + * @returns {boolean} + */ + isNativeFormElement: function(element) { + var nodeName = element.nodeName.toLowerCase(); + return nodeName === 'input' || + nodeName === 'select' || + nodeName === 'button' || + nodeName === 'textarea'; + }, + + /** + * Gets whether an element is an ``. + * @param {HTMLElement} element + * @returns {boolean} + */ + isHiddenInput: function(element) { + return $mdUtil.isInputElement(element) && element.type == 'hidden'; + }, + + /** + * Gets whether an element is an anchor that has an href attribute. + * @param {HTMLElement} element + * @returns {boolean} + */ + isAnchorWithHref: function(element) { + return $mdUtil.isAnchorElement(element) && element.hasAttribute('href'); + }, + + /** + * Gets whether an element is an input element. + * @param {HTMLElement} element + * @returns {boolean} + */ + isInputElement: function(element) { + return element.nodeName.toLowerCase() == 'input'; + }, + + /** + * Gets whether an element is an anchor element. + * @param {HTMLElement} element + * @returns {boolean} + */ + isAnchorElement: function(element) { + return element.nodeName.toLowerCase() == 'a'; + }, + + /********************************************************************************************** + * The following two functions were sourced from + * https://github.com/angular/components/blob/3c37e4b1c1cb74a3d0a90d173240fc730d21d9d4/src/cdk/a11y/focus-trap/focus-trap.ts#L268-L311 + **********************************************************************************************/ + + /** + * Get the first tabbable element from a DOM subtree (inclusive). + * @param {HTMLElement} root + * @returns {HTMLElement|null} + */ + getFirstTabbableElement: function(root) { + if ($mdUtil.isFocusable(root) && $mdUtil.isTabbable(root)) { + return root; + } + + // Iterate in DOM order. Note that IE doesn't have `children` for SVG so we fall + // back to `childNodes` which includes text nodes, comments etc. + var children = root.children || root.childNodes; + + for (var i = 0; i < children.length; i++) { + var tabbableChild = children[i].nodeType === $document[0].ELEMENT_NODE ? + $mdUtil.getFirstTabbableElement(children[i]) : null; + + if (tabbableChild) { + return tabbableChild; + } + } + + return null; + }, + + /** + * Get the last tabbable element from a DOM subtree (inclusive). + * @param {HTMLElement} root + * @returns {HTMLElement|null} + */ + getLastTabbableElement: function(root) { + if ($mdUtil.isFocusable(root) && $mdUtil.isTabbable(root)) { + return root; + } + + // Iterate in reverse DOM order. + var children = root.children || root.childNodes; + + for (var i = children.length - 1; i >= 0; i--) { + var tabbableChild = children[i].nodeType === $document[0].ELEMENT_NODE ? + $mdUtil.getLastTabbableElement(children[i]) : null; + + if (tabbableChild) { + return tabbableChild; + } + } + + return null; + } + }; + + // Instantiate other namespace utility methods + + $mdUtil.dom.animator = $$mdAnimate($mdUtil); + + return $mdUtil; + + function getNode(el) { + return el[0] || el; + } +} + +/** + * Since removing jQuery from the demos, some code that uses `element.focus()` is broken. + * We need to add `element.focus()`, because it's testable unlike `element[0].focus`. + */ +angular.element.prototype.focus = angular.element.prototype.focus || function() { + if (this.length) { + this[0].focus(); + } + return this; +}; + +angular.element.prototype.blur = angular.element.prototype.blur || function() { + if (this.length) { + this[0].blur(); + } + return this; +}; + +})(); +(function(){ +"use strict"; + +// Polyfill angular < 1.4 (provide $animateCss) +angular + .module('material.core') + .factory('$$mdAnimate', ["$q", "$timeout", "$mdConstant", "$animateCss", function($q, $timeout, $mdConstant, $animateCss) { + // Since $$mdAnimate is injected into $mdUtil... use a wrapper function + // to subsequently inject $mdUtil as an argument to the AnimateDomUtils + return function($mdUtil) { + return AnimateDomUtils($mdUtil, $q, $timeout, $mdConstant, $animateCss); + }; + }]); + +/** + * Factory function that requires special injections + */ +function AnimateDomUtils($mdUtil, $q, $timeout, $mdConstant, $animateCss) { + var self; + return self = { + translate3d : function(target, from, to, options) { + return $animateCss(target, { + from: from, + to: to, + addClass: options.transitionInClass, + removeClass: options.transitionOutClass, + duration: options.duration + }) + .start() + .then(function() { + // Resolve with reverser function... + return reverseTranslate; + }); + + /** + * Specific reversal of the request translate animation above... + */ + function reverseTranslate (newFrom) { + return $animateCss(target, { + to: newFrom || from, + addClass: options.transitionOutClass, + removeClass: options.transitionInClass, + duration: options.duration + }).start(); + } + }, + + /** + * Listen for transitionEnd event (with optional timeout) + * Announce completion or failure via promise handlers + */ + waitTransitionEnd: function (element, opts) { + var TIMEOUT = 3000; // fallback is 3 secs + + return $q(function(resolve, reject){ + opts = opts || { }; + + // If there is no transition is found, resolve immediately + // + // NOTE: using $mdUtil.nextTick() causes delays/issues + if (noTransitionFound(opts.cachedTransitionStyles)) { + TIMEOUT = 0; + } + + var timer = $timeout(finished, opts.timeout || TIMEOUT); + element.on($mdConstant.CSS.TRANSITIONEND, finished); + + /** + * Upon timeout or transitionEnd, reject or resolve (respectively) this promise. + * NOTE: Make sure this transitionEnd didn't bubble up from a child + */ + function finished(ev) { + if (ev && ev.target !== element[0]) return; + + if (ev) $timeout.cancel(timer); + element.off($mdConstant.CSS.TRANSITIONEND, finished); + + // Never reject since ngAnimate may cause timeouts due missed transitionEnd events + resolve(); + } + + /** + * Checks whether or not there is a transition. + * + * @param styles The cached styles to use for the calculation. If null, getComputedStyle() + * will be used. + * + * @returns {boolean} True if there is no transition/duration; false otherwise. + */ + function noTransitionFound(styles) { + styles = styles || window.getComputedStyle(element[0]); + + return styles.transitionDuration === '0s' || + (!styles.transition && !styles.transitionProperty); + } + }); + }, + + calculateTransformValues: function (element, originator) { + var origin = originator.element; + var bounds = originator.bounds; + + if (origin || bounds) { + var originBnds = origin ? self.clientRect(origin) || currentBounds() : self.copyRect(bounds); + var dialogRect = self.copyRect(element[0].getBoundingClientRect()); + var dialogCenterPt = self.centerPointFor(dialogRect); + var originCenterPt = self.centerPointFor(originBnds); + + return { + centerX: originCenterPt.x - dialogCenterPt.x, + centerY: originCenterPt.y - dialogCenterPt.y, + scaleX: Math.round(100 * Math.min(0.5, originBnds.width / dialogRect.width)) / 100, + scaleY: Math.round(100 * Math.min(0.5, originBnds.height / dialogRect.height)) / 100 + }; + } + return {centerX: 0, centerY: 0, scaleX: 0.5, scaleY: 0.5}; + + /** + * This is a fallback if the origin information is no longer valid, then the + * origin bounds simply becomes the current bounds for the dialogContainer's parent. + * @returns {null|DOMRect} + */ + function currentBounds() { + var container = element ? element.parent() : null; + var parent = container ? container.parent() : null; + + return parent ? self.clientRect(parent) : null; + } + }, + + /** + * Calculate the zoom transform from dialog to origin. + * + * We use this to set the dialog position immediately; + * then the md-transition-in actually translates back to + * `translate3d(0,0,0) scale(1.0)`... + * + * NOTE: all values are rounded to the nearest integer + */ + calculateZoomToOrigin: function (element, originator) { + var zoomTemplate = "translate3d( {centerX}px, {centerY}px, 0 ) scale( {scaleX}, {scaleY} )"; + var buildZoom = angular.bind(null, $mdUtil.supplant, zoomTemplate); + + return buildZoom(self.calculateTransformValues(element, originator)); + }, + + /** + * Calculate the slide transform from panel to origin. + * NOTE: all values are rounded to the nearest integer + */ + calculateSlideToOrigin: function (element, originator) { + var slideTemplate = "translate3d( {centerX}px, {centerY}px, 0 )"; + var buildSlide = angular.bind(null, $mdUtil.supplant, slideTemplate); + + return buildSlide(self.calculateTransformValues(element, originator)); + }, + + /** + * Enhance raw values to represent valid css stylings... + */ + toCss : function(raw) { + var css = { }; + var lookups = 'left top right bottom width height x y min-width min-height max-width max-height'; + + angular.forEach(raw, function(value,key) { + if (angular.isUndefined(value)) return; + + if (lookups.indexOf(key) >= 0) { + css[key] = value + 'px'; + } else { + switch (key) { + case 'transition': + convertToVendor(key, $mdConstant.CSS.TRANSITION, value); + break; + case 'transform': + convertToVendor(key, $mdConstant.CSS.TRANSFORM, value); + break; + case 'transformOrigin': + convertToVendor(key, $mdConstant.CSS.TRANSFORM_ORIGIN, value); + break; + case 'font-size': + css['font-size'] = value; // font sizes aren't always in px + break; + } + } + }); + + return css; + + function convertToVendor(key, vendor, value) { + angular.forEach(vendor.split(' '), function (key) { + css[key] = value; + }); + } + }, + + /** + * Convert the translate CSS value to key/value pair(s). + * @param {string} transform + * @param {boolean=} addTransition + * @param {string=} transition + * @return {Object} object containing CSS translate key/value pair(s) + */ + toTransformCss: function (transform, addTransition, transition) { + var css = {}; + angular.forEach($mdConstant.CSS.TRANSFORM.split(' '), function (key) { + css[key] = transform; + }); + + if (addTransition) { + transition = transition || "all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1) !important"; + css.transition = transition; + } + + return css; + }, + + /** + * Clone the Rect and calculate the height/width if needed. + * @param {DOMRect} source + * @param {DOMRect=} destination + * @returns {null|DOMRect} + */ + copyRect: function (source, destination) { + if (!source) return null; + + destination = destination || {}; + + angular.forEach('left top right bottom width height'.split(' '), function (key) { + destination[key] = Math.round(source[key]); + }); + + destination.width = destination.width || (destination.right - destination.left); + destination.height = destination.height || (destination.bottom - destination.top); + + return destination; + }, + + /** + * Calculate ClientRect of element; return null if hidden or zero size. + * @param {Element|string} element + * @returns {null|DOMRect} + */ + clientRect: function (element) { + var bounds = angular.element(element)[0].getBoundingClientRect(); + var isPositiveSizeClientRect = function (rect) { + return rect && (rect.width > 0) && (rect.height > 0); + }; + + // If the event origin element has zero size, it has probably been hidden. + return isPositiveSizeClientRect(bounds) ? self.copyRect(bounds) : null; + }, + + /** + * Calculate 'rounded' center point of Rect + * @param {DOMRect} targetRect + * @returns {{x: number, y: number}} + */ + centerPointFor: function (targetRect) { + return targetRect ? { + x: Math.round(targetRect.left + (targetRect.width / 2)), + y: Math.round(targetRect.top + (targetRect.height / 2)) + } : { x : 0, y : 0 }; + } + }; +} + + +})(); +(function(){ +"use strict"; + +if (angular.version.minor >= 4) { + angular.module('material.core.animate', []); +} else { +(function() { + "use strict"; + + var forEach = angular.forEach; + + var WEBKIT = angular.isDefined(document.documentElement.style.WebkitAppearance); + var TRANSITION_PROP = WEBKIT ? 'WebkitTransition' : 'transition'; + var ANIMATION_PROP = WEBKIT ? 'WebkitAnimation' : 'animation'; + var PREFIX = WEBKIT ? '-webkit-' : ''; + + var TRANSITION_EVENTS = (WEBKIT ? 'webkitTransitionEnd ' : '') + 'transitionend'; + var ANIMATION_EVENTS = (WEBKIT ? 'webkitAnimationEnd ' : '') + 'animationend'; + + var $$ForceReflowFactory = ['$document', function($document) { + return function() { + return $document[0].body.clientWidth + 1; + }; + }]; + + var $$rAFMutexFactory = ['$$rAF', function($$rAF) { + return function() { + var passed = false; + $$rAF(function() { + passed = true; + }); + return function(fn) { + passed ? fn() : $$rAF(fn); + }; + }; + }]; + + var $$AnimateRunnerFactory = ['$q', '$$rAFMutex', function($q, $$rAFMutex) { + var INITIAL_STATE = 0; + var DONE_PENDING_STATE = 1; + var DONE_COMPLETE_STATE = 2; + + function AnimateRunner(host) { + this.setHost(host); + + this._doneCallbacks = []; + this._runInAnimationFrame = $$rAFMutex(); + this._state = 0; + } + + AnimateRunner.prototype = { + setHost: function(host) { + this.host = host || {}; + }, + + done: function(fn) { + if (this._state === DONE_COMPLETE_STATE) { + fn(); + } else { + this._doneCallbacks.push(fn); + } + }, + + progress: angular.noop, + + getPromise: function() { + if (!this.promise) { + var self = this; + this.promise = $q(function(resolve, reject) { + self.done(function(status) { + status === false ? reject() : resolve(); + }); + }); + } + return this.promise; + }, + + then: function(resolveHandler, rejectHandler) { + return this.getPromise().then(resolveHandler, rejectHandler); + }, + + 'catch': function(handler) { + return this.getPromise()['catch'](handler); + }, + + 'finally': function(handler) { + return this.getPromise()['finally'](handler); + }, + + pause: function() { + if (this.host.pause) { + this.host.pause(); + } + }, + + resume: function() { + if (this.host.resume) { + this.host.resume(); + } + }, + + end: function() { + if (this.host.end) { + this.host.end(); + } + this._resolve(true); + }, + + cancel: function() { + if (this.host.cancel) { + this.host.cancel(); + } + this._resolve(false); + }, + + complete: function(response) { + var self = this; + if (self._state === INITIAL_STATE) { + self._state = DONE_PENDING_STATE; + self._runInAnimationFrame(function() { + self._resolve(response); + }); + } + }, + + _resolve: function(response) { + if (this._state !== DONE_COMPLETE_STATE) { + forEach(this._doneCallbacks, function(fn) { + fn(response); + }); + this._doneCallbacks.length = 0; + this._state = DONE_COMPLETE_STATE; + } + } + }; + + // Polyfill AnimateRunner.all which is used by input animations + AnimateRunner.all = function(runners, callback) { + var count = 0; + var status = true; + forEach(runners, function(runner) { + runner.done(onProgress); + }); + + function onProgress(response) { + status = status && response; + if (++count === runners.length) { + callback(status); + } + } + }; + + return AnimateRunner; + }]; + + angular + .module('material.core.animate', []) + .factory('$$forceReflow', $$ForceReflowFactory) + .factory('$$AnimateRunner', $$AnimateRunnerFactory) + .factory('$$rAFMutex', $$rAFMutexFactory) + .factory('$animateCss', ['$window', '$$rAF', '$$AnimateRunner', '$$forceReflow', '$$jqLite', '$timeout', '$animate', + function($window, $$rAF, $$AnimateRunner, $$forceReflow, $$jqLite, $timeout, $animate) { + + function init(element, options) { + + var temporaryStyles = []; + var node = getDomNode(element); + var areAnimationsAllowed = node && $animate.enabled(); + + var hasCompleteStyles = false; + var hasCompleteClasses = false; + + if (areAnimationsAllowed) { + if (options.transitionStyle) { + temporaryStyles.push([PREFIX + 'transition', options.transitionStyle]); + } + + if (options.keyframeStyle) { + temporaryStyles.push([PREFIX + 'animation', options.keyframeStyle]); + } + + if (options.delay) { + temporaryStyles.push([PREFIX + 'transition-delay', options.delay + 's']); + } + + if (options.duration) { + temporaryStyles.push([PREFIX + 'transition-duration', options.duration + 's']); + } + + hasCompleteStyles = options.keyframeStyle || + (options.to && (options.duration > 0 || options.transitionStyle)); + hasCompleteClasses = !!options.addClass || !!options.removeClass; + + blockTransition(element, true); + } + + var hasCompleteAnimation = areAnimationsAllowed && (hasCompleteStyles || hasCompleteClasses); + + applyAnimationFromStyles(element, options); + + var animationClosed = false; + var events, eventFn; + + return { + close: $window.close, + start: function() { + var runner = new $$AnimateRunner(); + waitUntilQuiet(function() { + blockTransition(element, false); + if (!hasCompleteAnimation) { + return close(); + } + + forEach(temporaryStyles, function(entry) { + var key = entry[0]; + var value = entry[1]; + node.style[camelCase(key)] = value; + }); + + applyClasses(element, options); + + var timings = computeTimings(element); + if (timings.duration === 0) { + return close(); + } + + var moreStyles = []; + + if (options.easing) { + if (timings.transitionDuration) { + moreStyles.push([PREFIX + 'transition-timing-function', options.easing]); + } + if (timings.animationDuration) { + moreStyles.push([PREFIX + 'animation-timing-function', options.easing]); + } + } + + if (options.delay && timings.animationDelay) { + moreStyles.push([PREFIX + 'animation-delay', options.delay + 's']); + } + + if (options.duration && timings.animationDuration) { + moreStyles.push([PREFIX + 'animation-duration', options.duration + 's']); + } + + forEach(moreStyles, function(entry) { + var key = entry[0]; + var value = entry[1]; + node.style[camelCase(key)] = value; + temporaryStyles.push(entry); + }); + + var maxDelay = timings.delay; + var maxDelayTime = maxDelay * 1000; + var maxDuration = timings.duration; + var maxDurationTime = maxDuration * 1000; + var startTime = Date.now(); + + events = []; + if (timings.transitionDuration) { + events.push(TRANSITION_EVENTS); + } + if (timings.animationDuration) { + events.push(ANIMATION_EVENTS); + } + events = events.join(' '); + eventFn = function(event) { + event.stopPropagation(); + var ev = event.originalEvent || event; + var timeStamp = ev.timeStamp || Date.now(); + var elapsedTime = parseFloat(ev.elapsedTime.toFixed(3)); + if (Math.max(timeStamp - startTime, 0) >= maxDelayTime && elapsedTime >= maxDuration) { + close(); + } + }; + element.on(events, eventFn); + + applyAnimationToStyles(element, options); + + $timeout(close, maxDelayTime + maxDurationTime * 1.5, false); + }); + + return runner; + + function close() { + if (animationClosed) return; + animationClosed = true; + + if (events && eventFn) { + element.off(events, eventFn); + } + applyClasses(element, options); + applyAnimationStyles(element, options); + forEach(temporaryStyles, function(entry) { + node.style[camelCase(entry[0])] = ''; + }); + runner.complete(true); + return runner; + } + } + }; + } + + function applyClasses(element, options) { + if (options.addClass) { + $$jqLite.addClass(element, options.addClass); + options.addClass = null; + } + if (options.removeClass) { + $$jqLite.removeClass(element, options.removeClass); + options.removeClass = null; + } + } + + function computeTimings(element) { + var node = getDomNode(element); + var cs = $window.getComputedStyle(node); + var tdr = parseMaxTime(cs[prop('transitionDuration')]); + var adr = parseMaxTime(cs[prop('animationDuration')]); + var tdy = parseMaxTime(cs[prop('transitionDelay')]); + var ady = parseMaxTime(cs[prop('animationDelay')]); + + adr *= (parseInt(cs[prop('animationIterationCount')], 10) || 1); + var duration = Math.max(adr, tdr); + var delay = Math.max(ady, tdy); + + return { + duration: duration, + delay: delay, + animationDuration: adr, + transitionDuration: tdr, + animationDelay: ady, + transitionDelay: tdy + }; + + function prop(key) { + return WEBKIT ? 'Webkit' + key.charAt(0).toUpperCase() + key.substr(1) + : key; + } + } + + function parseMaxTime(str) { + var maxValue = 0; + var values = (str || "").split(/\s*,\s*/); + forEach(values, function(value) { + // it's always safe to consider only second values and omit `ms` values since + // getComputedStyle will always handle the conversion for us + if (value.charAt(value.length - 1) == 's') { + value = value.substring(0, value.length - 1); + } + value = parseFloat(value) || 0; + maxValue = maxValue ? Math.max(value, maxValue) : value; + }); + return maxValue; + } + + var cancelLastRAFRequest; + var rafWaitQueue = []; + function waitUntilQuiet(callback) { + if (cancelLastRAFRequest) { + cancelLastRAFRequest(); // cancels the request + } + rafWaitQueue.push(callback); + cancelLastRAFRequest = $$rAF(function() { + cancelLastRAFRequest = null; + + // DO NOT REMOVE THIS LINE OR REFACTOR OUT THE `pageWidth` variable. + // PLEASE EXAMINE THE `$$forceReflow` service to understand why. + var pageWidth = $$forceReflow(); + + // we use a for loop to ensure that if the queue is changed + // during this looping then it will consider new requests + for (var i = 0; i < rafWaitQueue.length; i++) { + rafWaitQueue[i](pageWidth); + } + rafWaitQueue.length = 0; + }); + } + + function applyAnimationStyles(element, options) { + applyAnimationFromStyles(element, options); + applyAnimationToStyles(element, options); + } + + function applyAnimationFromStyles(element, options) { + if (options.from) { + element.css(options.from); + options.from = null; + } + } + + function applyAnimationToStyles(element, options) { + if (options.to) { + element.css(options.to); + options.to = null; + } + } + + function getDomNode(element) { + for (var i = 0; i < element.length; i++) { + if (element[i].nodeType === 1) return element[i]; + } + } + + function blockTransition(element, bool) { + var node = getDomNode(element); + var key = camelCase(PREFIX + 'transition-delay'); + node.style[key] = bool ? '-9999s' : ''; + } + + return init; + }]); + + /** + * Older browsers [FF31] expect camelCase + * property keys. + * e.g. + * animation-duration --> animationDuration + */ + function camelCase(str) { + return str.replace(/-[a-z]/g, function(str) { + return str.charAt(1).toUpperCase(); + }); + } + +})(); + +} + +})(); +(function(){ +"use strict"; + +/** + * @ngdoc module + * @name material.core.aria + * @description + * Aria Expectations for AngularJS Material components. + */ +MdAriaService.$inject = ["$$rAF", "$log", "$window", "$interpolate"]; +angular + .module('material.core') + .provider('$mdAria', MdAriaProvider); + +/** + * @ngdoc service + * @name $mdAriaProvider + * @module material.core.aria + * + * @description + * + * Modify options of the `$mdAria` service, which will be used by most of the AngularJS Material + * components. + * + * You are able to disable `$mdAria` warnings, by using the following markup. + * + * + * app.config(function($mdAriaProvider) { + * // Globally disables all ARIA warnings. + * $mdAriaProvider.disableWarnings(); + * }); + * + * + */ +function MdAriaProvider() { + + var config = { + /** Whether we should show ARIA warnings in the console if labels are missing on the element */ + showWarnings: true + }; + + return { + disableWarnings: disableWarnings, + $get: ["$$rAF", "$log", "$window", "$interpolate", function($$rAF, $log, $window, $interpolate) { + return MdAriaService.apply(config, arguments); + }] + }; + + /** + * @ngdoc method + * @name $mdAriaProvider#disableWarnings + * @description Disables all ARIA warnings generated by AngularJS Material. + */ + function disableWarnings() { + config.showWarnings = false; + } +} + +/* + * @ngInject + */ +function MdAriaService($$rAF, $log, $window, $interpolate) { + + // Load the showWarnings option from the current context and store it inside of a scope variable, + // because the context will be probably lost in some function calls. + var showWarnings = this.showWarnings; + + return { + expect: expect, + expectAsync: expectAsync, + expectWithText: expectWithText, + expectWithoutText: expectWithoutText, + getText: getText, + hasAriaLabel: hasAriaLabel, + parentHasAriaLabel: parentHasAriaLabel + }; + + /** + * Check if expected attribute has been specified on the target element or child + * @param {string|JQLite} element + * @param {string} attrName + * @param {string=} defaultValue What to set the attr to if no value is found + */ + function expect(element, attrName, defaultValue) { + + var node = angular.element(element)[0] || element; + + // if node exists and neither it nor its children have the attribute + if (node && + ((!node.hasAttribute(attrName) || + node.getAttribute(attrName).length === 0) && + !childHasAttribute(node, attrName))) { + + defaultValue = angular.isString(defaultValue) ? defaultValue.trim() : ''; + if (defaultValue.length) { + element.attr(attrName, defaultValue); + } else if (showWarnings) { + $log.warn('ARIA: Attribute "', attrName, '", required for accessibility, is missing on node:', node); + } + + } + } + + function expectAsync(element, attrName, defaultValueGetter) { + // Problem: when retrieving the element's contents synchronously to find the label, + // the text may not be defined yet in the case of a binding. + // There is a higher chance that a binding will be defined if we wait one frame. + $$rAF(function() { + expect(element, attrName, defaultValueGetter()); + }); + } + + function expectWithText(element, attrName) { + var content = getText(element) || ""; + var hasBinding = content.indexOf($interpolate.startSymbol()) > -1; + + if (hasBinding) { + expectAsync(element, attrName, function() { + return getText(element); + }); + } else { + expect(element, attrName, content); + } + } + + function expectWithoutText(element, attrName) { + var content = getText(element); + var hasBinding = content.indexOf($interpolate.startSymbol()) > -1; + + if (!hasBinding && !content) { + expect(element, attrName, content); + } + } + + /** + * @param {Element|JQLite} element + * @returns {string} + */ + function getText(element) { + element = element[0] || element; + var walker = document.createTreeWalker(element, NodeFilter.SHOW_TEXT, null, false); + var text = ''; + + var node; + while (node = walker.nextNode()) { + if (!isAriaHiddenNode(node)) { + text += node.textContent; + } + } + + return text.trim() || ''; + + /** + * @param {Node} node + * @returns {boolean} + */ + function isAriaHiddenNode(node) { + while (node.parentNode && (node = node.parentNode) !== element) { + if (node.getAttribute && node.getAttribute('aria-hidden') === 'true') { + return true; + } + } + } + } + + function childHasAttribute(node, attrName) { + var hasChildren = node.hasChildNodes(), + hasAttr = false; + + function isHidden(el) { + var style = el.currentStyle ? el.currentStyle : $window.getComputedStyle(el); + return (style.display === 'none'); + } + + if (hasChildren) { + var children = node.childNodes; + for (var i=0; i < children.length; i++) { + var child = children[i]; + if (child.nodeType === 1 && child.hasAttribute(attrName)) { + if (!isHidden(child)) { + hasAttr = true; + } + } + } + } + return hasAttr; + } + + /** + * Check if expected element has aria label attribute + * @param element + */ + function hasAriaLabel(element) { + var node = angular.element(element)[0] || element; + + /* Check if compatible node type (ie: not HTML Document node) */ + if (!node.hasAttribute) { + return false; + } + + /* Check label or description attributes */ + return node.hasAttribute('aria-label') || node.hasAttribute('aria-labelledby') || node.hasAttribute('aria-describedby'); + } + + /** + * Check if expected element's parent has aria label attribute and has valid role and tagName + * @param {string|JQLite|Node & ParentNode} element + * @param {number=} level Number of levels deep search should be performed + */ + function parentHasAriaLabel(element, level) { + level = level || 1; + var node = angular.element(element)[0] || element; + if (!node.parentNode) { + return false; + } + if (performCheck(node.parentNode)) { + return true; + } + level--; + if (level) { + return parentHasAriaLabel(node.parentNode, level); + } + return false; + + function performCheck(parentNode) { + if (!hasAriaLabel(parentNode)) { + return false; + } + /* Perform role block-list check */ + if (parentNode.hasAttribute('role')) { + switch (parentNode.getAttribute('role').toLowerCase()) { + case 'command': + case 'definition': + case 'directory': + case 'grid': + case 'list': + case 'listitem': + case 'log': + case 'marquee': + case 'menu': + case 'menubar': + case 'note': + case 'presentation': + case 'separator': + case 'scrollbar': + case 'status': + case 'tablist': + return false; + } + } + /* Perform tagName block-list check */ + switch (parentNode.tagName.toLowerCase()) { + case 'abbr': + case 'acronym': + case 'address': + case 'applet': + case 'audio': + case 'b': + case 'bdi': + case 'bdo': + case 'big': + case 'blockquote': + case 'br': + case 'canvas': + case 'caption': + case 'center': + case 'cite': + case 'code': + case 'col': + case 'data': + case 'dd': + case 'del': + case 'dfn': + case 'dir': + case 'div': + case 'dl': + case 'em': + case 'embed': + case 'fieldset': + case 'figcaption': + case 'font': + case 'h1': + case 'h2': + case 'h3': + case 'h4': + case 'h5': + case 'h6': + case 'hgroup': + case 'html': + case 'i': + case 'ins': + case 'isindex': + case 'kbd': + case 'keygen': + case 'label': + case 'legend': + case 'li': + case 'map': + case 'mark': + case 'menu': + case 'object': + case 'ol': + case 'output': + case 'pre': + case 'presentation': + case 'q': + case 'rt': + case 'ruby': + case 'samp': + case 'small': + case 'source': + case 'span': + case 'status': + case 'strike': + case 'strong': + case 'sub': + case 'sup': + case 'svg': + case 'tbody': + case 'td': + case 'th': + case 'thead': + case 'time': + case 'tr': + case 'track': + case 'tt': + case 'ul': + case 'var': + return false; + } + return true; + } + } +} + +})(); +(function(){ +"use strict"; + +/** + * @ngdoc module + * @name material.core.compiler + * @description + * AngularJS Material template and element compiler. + */ +angular + .module('material.core') + .provider('$mdCompiler', MdCompilerProvider); + +MdCompilerProvider.$inject = ['$compileProvider']; +function MdCompilerProvider() { + + this.$get = ["$q", "$templateRequest", "$injector", "$compile", "$controller", + function($q, $templateRequest, $injector, $compile, $controller) { + return new MdCompilerService($q, $templateRequest, $injector, $compile, $controller); + }]; + + /** + * @ngdoc service + * @name $mdCompiler + * @module material.core.compiler + * @description + * The $mdCompiler service is an abstraction of AngularJS's compiler, that allows developers + * to compile an element with options like in a Directive Definition Object. + * + * > The compiler powers a lot of components inside of AngularJS Material. + * > Like the `$mdPanel` or `$mdDialog` services. + * + * @usage + * + * Basic Usage with a template + * + * + * $mdCompiler.compile({ + * templateUrl: 'modal.html', + * controller: 'ModalCtrl', + * locals: { + * modal: myModalInstance; + * } + * }).then(function (compileData) { + * compileData.element; // Compiled DOM element + * compileData.link(myScope); // Instantiate controller and link element to scope. + * }); + * + * + * Example with a content element + * + * + * + * // Create a virtual element and link it manually. + * // The compiler doesn't need to recompile the element each time. + * var myElement = $compile('Test')(myScope); + * + * $mdCompiler.compile({ + * contentElement: myElement + * }).then(function (compileData) { + * compileData.element // Content Element (same as above) + * compileData.link // This does nothing when using a contentElement. + * }); + * + * + * > Content Element is a significant performance improvement when the developer already knows + * > that the compiled element will be always the same and the scope will not change either. + * + * The `contentElement` option also supports DOM elements which will be temporary removed and + * restored at its old position. + * + * + * var domElement = document.querySelector('#myElement'); + * + * $mdCompiler.compile({ + * contentElement: myElement + * }).then(function (compileData) { + * compileData.element // Content Element (same as above) + * compileData.link // This does nothing when using a contentElement. + * }); + * + * + * The `$mdCompiler` can also query for the element in the DOM itself. + * + * + * $mdCompiler.compile({ + * contentElement: '#myElement' + * }).then(function (compileData) { + * compileData.element // Content Element (same as above) + * compileData.link // This does nothing when using a contentElement. + * }); + * + * + */ + function MdCompilerService($q, $templateRequest, $injector, $compile, $controller) { + + /** + * @private @const + * @type {!IQService} + */ + this.$q = $q; + + /** + * @private @const + * @type {!ITemplateRequestService} + */ + this.$templateRequest = $templateRequest; + + /** + * @private @const + * @type {!IInjectorService} + */ + this.$injector = $injector; + + /** + * @private @const + * @type{!ICompileService} + */ + this.$compile = $compile; + + /** + * @private @const + * @type {!IControllerService} + */ + this.$controller = $controller; + } + + /** + * @ngdoc method + * @name $mdCompiler#compile + * @description + * + * A method to compile a HTML template with the AngularJS compiler. + * The `$mdCompiler` is wrapper around the AngularJS compiler and provides extra functionality + * like controller instantiation or async resolves. + * + * @param {!Object} options An options object, with the following properties: + * + * - `controller` - `{string|function}` Controller fn that should be associated with + * newly created scope or the name of a registered controller if passed as a string. + * - `controllerAs` - `{string=}` A controller alias name. If present the controller will be + * published to scope under the `controllerAs` name. + * - `contentElement` - `{string|Element}`: Instead of using a template, which will be + * compiled each time, you can also use a DOM element.
    + * - `template` - `{string=}` An html template as a string. + * - `templateUrl` - `{string=}` A path to an html template. + * - `transformTemplate` - `{function(template)=}` A function which transforms the template after + * it is loaded. It will be given the template string as a parameter, and should + * return a a new string representing the transformed template. + * - `resolve` - `{Object.=}` - An optional map of dependencies which should + * be injected into the controller. If any of these dependencies are promises, the compiler + * will wait for them all to be resolved, or if one is rejected before the controller is + * instantiated `compile()` will fail.. + * * `key` - `{string}`: a name of a dependency to be injected into the controller. + * * `factory` - `{string|function}`: If `string` then it is an alias for a service. + * Otherwise if function, then it is injected and the return value is treated as the + * dependency. If the result is a promise, it is resolved before its value is + * injected into the controller. + * + * @returns {Q.Promise<{element: JQLite, link: Function, locals: Object, cleanup: any, + * controller: Object=}>} promise A promise, which will be resolved with a `compileData` object. + * `compileData` has the following properties: + * + * - `element` - `{JQLite}`: an uncompiled element matching the provided template. + * - `link` - `{function(scope)}`: A link function, which, when called, will compile + * the element and instantiate the provided controller (if given). + * - `locals` - `{Object}`: The locals which will be passed into the controller once `link` is + * called. If `bindToController` is true, they will be copied to the ctrl instead + */ + MdCompilerService.prototype.compile = function(options) { + if (options.contentElement) { + return this._prepareContentElement(options); + } else { + return this._compileTemplate(options); + } + }; + + /** + * Instead of compiling any template, the compiler just fetches an existing HTML element from the + * DOM and provides a restore function to put the element back it old DOM position. + * @param {!Object} options Options to be used for the compiler. + * @returns {Q.Promise<{element: JQLite, link: Function, locals: Object, cleanup: any}>} + */ + MdCompilerService.prototype._prepareContentElement = function(options) { + + var contentElement = this._fetchContentElement(options); + + return this.$q.resolve({ + element: contentElement.element, + cleanup: contentElement.restore, + locals: {}, + link: function() { + return contentElement.element; + } + }); + + }; + + /** + * Compiles a template by considering all options and waiting for all resolves to be ready. + * @param {!Object} options Compile options + * @returns {!Q.Promise<{element: JQLite, link: Function, locals: Object, cleanup: any}>} Compile + * data with link function. + */ + MdCompilerService.prototype._compileTemplate = function(options) { + + var self = this; + var templateUrl = options.templateUrl; + var template = options.template || ''; + var resolve = angular.extend({}, options.resolve); + var locals = angular.extend({}, options.locals); + var transformTemplate = options.transformTemplate || angular.identity; + + // Take resolve values and invoke them. + // Resolves can either be a string (value: 'MyRegisteredAngularConst'), + // or an invokable 'factory' of sorts: (value: function ValueGetter($dependency) {}) + angular.forEach(resolve, function(value, key) { + if (angular.isString(value)) { + resolve[key] = self.$injector.get(value); + } else { + resolve[key] = self.$injector.invoke(value); + } + }); + + // Add the locals, which are just straight values to inject + // eg locals: { three: 3 }, will inject three into the controller + angular.extend(resolve, locals); + + if (templateUrl) { + resolve.$$ngTemplate = this.$templateRequest(templateUrl); + } else { + resolve.$$ngTemplate = this.$q.when(template); + } + + + // Wait for all the resolves to finish if they are promises + return this.$q.all(resolve).then(function(locals) { + + var template = transformTemplate(locals.$$ngTemplate, options); + var element = options.element || angular.element('
    ').html(template.trim()).contents(); + + return self._compileElement(locals, element, options); + }); + + }; + + /** + * Method to compile an element with the given options. + * @param {!Object} locals Locals to be injected to the controller if present + * @param {!JQLite} element Element to be compiled and linked + * @param {!Object} options Options to be used for linking. + * @returns {!{element: JQLite, link: Function, locals: Object, cleanup: any, controller: Object}} Compile data with link function. + */ + MdCompilerService.prototype._compileElement = function(locals, element, options) { + var self = this; + var ngLinkFn = this.$compile(element); + + var compileData = { + element: element, + cleanup: element.remove.bind(element), + locals: locals, + link: linkFn + }; + + function linkFn(scope) { + locals.$scope = scope; + + // Instantiate controller if the developer provided one. + if (options.controller) { + + var injectLocals = angular.extend({}, locals, { + $element: element + }); + + // Create the specified controller instance. + var ctrl = self._createController(options, injectLocals, locals); + + // Registering extra $destroy listeners should be avoided. + // Only register the listener if the controller implements a $onDestroy hook. + if (angular.isFunction(ctrl.$onDestroy)) { + scope.$on('$destroy', function() { + // Call the $onDestroy hook if it's present on the controller. + angular.isFunction(ctrl.$onDestroy) && ctrl.$onDestroy(); + }); + } + + // Unique identifier for AngularJS Route ngView controllers. + element.data('$ngControllerController', ctrl); + element.children().data('$ngControllerController', ctrl); + + // Expose the instantiated controller to the compile data + compileData.controller = ctrl; + } + + // Invoke the AngularJS $compile link function. + return ngLinkFn(scope); + } + + return compileData; + + }; + + /** + * Creates and instantiates a new controller with the specified options. + * @param {!Object} options Options that include the controller function or string. + * @param {!Object} injectLocals Locals to to be provided in the controller DI. + * @param {!Object} locals Locals to be injected to the controller. + * @returns {!Object} Created controller instance. + */ + MdCompilerService.prototype._createController = function(options, injectLocals, locals) { + var ctrl = this.$controller(options.controller, injectLocals); + + if (options.bindToController) { + angular.extend(ctrl, locals); + } + + if (options.controllerAs) { + injectLocals.$scope[options.controllerAs] = ctrl; + } + + // Call the $onInit hook if it's present on the controller. + angular.isFunction(ctrl.$onInit) && ctrl.$onInit(); + + return ctrl; + }; + + /** + * Fetches an element removing it from the DOM and using it temporary for the compiler. + * Elements which were fetched will be restored after use. + * @param {!Object} options Options to be used for the compilation. + * @returns {{element: !JQLite, restore: !function}} + */ + MdCompilerService.prototype._fetchContentElement = function(options) { + var contentEl = options.contentElement; + var restoreFn; + + if (angular.isString(contentEl)) { + contentEl = document.querySelector(contentEl); + restoreFn = createRestoreFn(contentEl); + } else { + contentEl = contentEl[0] || contentEl; + + // When the element is visible in the DOM, then we restore it at close of the dialog. + // Otherwise it will be removed from the DOM after close. + if (document.contains(contentEl)) { + restoreFn = createRestoreFn(contentEl); + } else { + restoreFn = function() { + if (contentEl.parentNode) { + contentEl.parentNode.removeChild(contentEl); + } + }; + } + } + + return { + element: angular.element(contentEl), + restore: restoreFn + }; + + function createRestoreFn(element) { + var parent = element.parentNode; + var nextSibling = element.nextElementSibling; + + return function() { + if (!nextSibling) { + // When the element didn't had any sibling, then it can be simply appended to the + // parent, because it plays no role, which index it had before. + parent.appendChild(element); + } else { + // When the element had a sibling, which marks the previous position of the element + // in the DOM, we insert it correctly before the sibling, to have the same index as + // before. + parent.insertBefore(element, nextSibling); + } + }; + } + }; +} + + +})(); +(function(){ +"use strict"; + + +MdGesture.$inject = ["$$MdGestureHandler", "$$rAF", "$timeout", "$mdUtil"]; +attachToDocument.$inject = ["$mdGesture", "$$MdGestureHandler", "$mdUtil"];var HANDLERS = {}; + +/** + * The state of the current 'pointer'. The pointer represents the state of the current touch. + * It contains normalized x and y coordinates from DOM events, + * as well as other information abstracted from the DOM. + */ +var pointer, lastPointer, maxClickDistance = 6; +var forceSkipClickHijack = false, disableAllGestures = false; + +/** + * The position of the most recent click if that click was on a label element. + * @type {{x: number, y: number}|null} + */ +var lastLabelClickPos = null; + +/** + * Used to attach event listeners once when multiple ng-apps are running. + * @type {boolean} + */ +var isInitialized = false; + +/** + * @ngdoc module + * @name material.core.gestures + * @description + * AngularJS Material Gesture handling for touch devices. + * This module replaced the usage of the HammerJS library. + */ +angular + .module('material.core.gestures', []) + .provider('$mdGesture', MdGestureProvider) + .factory('$$MdGestureHandler', MdGestureHandler) + .run(attachToDocument); + +/** + * @ngdoc service + * @name $mdGestureProvider + * @module material.core.gestures + * + * @description + * In some scenarios on mobile devices (without jQuery), the click events should NOT be hijacked. + * `$mdGestureProvider` is used to configure the Gesture module to ignore or skip click hijacking + * on mobile devices. + * + * You can also change the max click distance, `6px` by default, if you have issues on some touch + * screens. + * + * + * app.config(function($mdGestureProvider) { + * + * // For mobile devices without jQuery loaded, do not + * // intercept click events during the capture phase. + * $mdGestureProvider.skipClickHijack(); + * + * // If hijacking clicks, you may want to change the default click distance + * $mdGestureProvider.setMaxClickDistance(12); + * }); + * + * + */ +function MdGestureProvider() { } + +MdGestureProvider.prototype = { + + /** + * @ngdoc method + * @name $mdGestureProvider#disableAll + * + * @description + * Disable all gesture detection. This can be beneficial to application performance + * and memory usage. + */ + disableAll: function () { + disableAllGestures = true; + }, + + // Publish access to setter to configure a variable BEFORE the + // $mdGesture service is instantiated... + /** + * @ngdoc method + * @name $mdGestureProvider#skipClickHijack + * + * @description + * Tell the AngularJS Material Gesture module to skip (or ignore) click hijacking on mobile devices. + */ + skipClickHijack: function() { + return forceSkipClickHijack = true; + }, + + /** + * @ngdoc method + * @name $mdGestureProvider#setMaxClickDistance + * @param clickDistance {string} Distance in pixels. I.e. `12px`. + * @description + * Set the max distance from the origin of the touch event to trigger touch handlers. + */ + setMaxClickDistance: function(clickDistance) { + maxClickDistance = parseInt(clickDistance); + }, + + /** + * $get is used to build an instance of $mdGesture + * @ngInject + */ + $get : ["$$MdGestureHandler", "$$rAF", "$timeout", "$mdUtil", function($$MdGestureHandler, $$rAF, $timeout, $mdUtil) { + return new MdGesture($$MdGestureHandler, $$rAF, $timeout, $mdUtil); + }] +}; + + + +/** + * MdGesture factory construction function + * @ngInject + */ +function MdGesture($$MdGestureHandler, $$rAF, $timeout, $mdUtil) { + var touchActionProperty = $mdUtil.getTouchAction(); + var hasJQuery = (typeof __webpack_provided_window_dot_jQuery !== 'undefined') && (angular.element === __webpack_provided_window_dot_jQuery); + + var self = { + handler: addHandler, + register: register, + isAndroid: $mdUtil.isAndroid, + isIos: $mdUtil.isIos, + // On mobile w/out jQuery, we normally intercept clicks. Should we skip that? + isHijackingClicks: ($mdUtil.isIos || $mdUtil.isAndroid) && !hasJQuery && !forceSkipClickHijack + }; + + if (self.isHijackingClicks) { + self.handler('click', { + options: { + maxDistance: maxClickDistance + }, + onEnd: checkDistanceAndEmit('click') + }); + + self.handler('focus', { + options: { + maxDistance: maxClickDistance + }, + onEnd: function(ev, pointer) { + if (pointer.distance < this.state.options.maxDistance && canFocus(ev.target)) { + this.dispatchEvent(ev, 'focus', pointer); + ev.target.focus(); + } + } + }); + + self.handler('mouseup', { + options: { + maxDistance: maxClickDistance + }, + onEnd: checkDistanceAndEmit('mouseup') + }); + + self.handler('mousedown', { + onStart: function(ev) { + this.dispatchEvent(ev, 'mousedown'); + } + }); + } + + function checkDistanceAndEmit(eventName) { + return function(ev, pointer) { + if (pointer.distance < this.state.options.maxDistance) { + this.dispatchEvent(ev, eventName, pointer); + } + }; + } + + /** + * Register an element to listen for a handler. + * This allows an element to override the default options for a handler. + * Additionally, some handlers like drag and hold only dispatch events if + * the domEvent happens inside an element that's registered to listen for these events. + * + * @see GestureHandler for how overriding of default options works. + * @example $mdGesture.register(myElement, 'drag', { minDistance: 20, horizontal: false }) + */ + function register(element, handlerName, options) { + var handler = HANDLERS[handlerName.replace(/^\$md./, '')]; + if (!handler) { + throw new Error('Failed to register element with handler ' + handlerName + '. ' + + 'Available handlers: ' + Object.keys(HANDLERS).join(', ')); + } + return handler.registerElement(element, options); + } + + /* + * add a handler to $mdGesture. see below. + */ + function addHandler(name, definition) { + var handler = new $$MdGestureHandler(name); + angular.extend(handler, definition); + HANDLERS[name] = handler; + + return self; + } + + /** + * Register handlers. These listen to touch/start/move events, interpret them, + * and dispatch gesture events depending on options & conditions. These are all + * instances of GestureHandler. + * @see GestureHandler + */ + return self + /* + * The press handler dispatches an event on touchdown/touchend. + * It's a simple abstraction of touch/mouse/pointer start and end. + */ + .handler('press', { + onStart: function (ev, pointer) { + this.dispatchEvent(ev, '$md.pressdown'); + }, + onEnd: function (ev, pointer) { + this.dispatchEvent(ev, '$md.pressup'); + } + }) + + /* + * The hold handler dispatches an event if the user keeps their finger within + * the same area for ms. + * The hold handler will only run if a parent of the touch target is registered + * to listen for hold events through $mdGesture.register() + */ + .handler('hold', { + options: { + maxDistance: 6, + delay: 500 + }, + onCancel: function () { + $timeout.cancel(this.state.timeout); + }, + onStart: function (ev, pointer) { + // For hold, require a parent to be registered with $mdGesture.register() + // Because we prevent scroll events, this is necessary. + if (!this.state.registeredParent) return this.cancel(); + + this.state.pos = {x: pointer.x, y: pointer.y}; + this.state.timeout = $timeout(angular.bind(this, function holdDelayFn() { + this.dispatchEvent(ev, '$md.hold'); + this.cancel(); // we're done! + }), this.state.options.delay, false); + }, + onMove: function (ev, pointer) { + // Don't scroll while waiting for hold. + // If we don't preventDefault touchmove events here, Android will assume we don't + // want to listen to anymore touch events. It will start scrolling and stop sending + // touchmove events. + if (!touchActionProperty && ev.type === 'touchmove') ev.preventDefault(); + + // If the user moves greater than pixels, stop the hold timer + // set in onStart + var dx = this.state.pos.x - pointer.x; + var dy = this.state.pos.y - pointer.y; + if (Math.sqrt(dx * dx + dy * dy) > this.options.maxDistance) { + this.cancel(); + } + }, + onEnd: function () { + this.onCancel(); + } + }) + + /* + * The drag handler dispatches a drag event if the user holds and moves his finger greater than + * px in the x or y direction, depending on options.horizontal. + * The drag will be cancelled if the user moves his finger greater than * in + * the perpendicular direction. Eg if the drag is horizontal and the user moves his finger * + * pixels vertically, this handler won't consider the move part of a drag. + */ + .handler('drag', { + options: { + minDistance: 6, + horizontal: true, + cancelMultiplier: 1.5 + }, + /** + * @param {angular.JQLite} element where touch action styles need to be adjusted + * @param {{horizontal: boolean}=} options object whose horizontal property can specify to + * apply 'pan-y' or 'pan-x' touch actions. + */ + onSetup: function(element, options) { + if (touchActionProperty) { + // We check for horizontal to be false, because otherwise we would overwrite the default opts. + this.oldTouchAction = element[0].style[touchActionProperty]; + element[0].style[touchActionProperty] = options.horizontal ? 'pan-y' : 'pan-x'; + } + }, + /** + * @param {angular.JQLite} element where styles need to be cleaned up + */ + onCleanup: function(element) { + if (this.oldTouchAction) { + element[0].style[touchActionProperty] = this.oldTouchAction; + } else { + element[0].style[touchActionProperty] = null; + } + }, + onStart: function (ev) { + // For drag, require a parent to be registered with $mdGesture.register() + if (!this.state.registeredParent) this.cancel(); + }, + onMove: function (ev, pointer) { + var shouldStartDrag, shouldCancel; + // Don't scroll while deciding if this touchmove qualifies as a drag event. + // If we don't preventDefault touchmove events here, Android will assume we don't + // want to listen to anymore touch events. It will start scrolling and stop sending + // touchmove events. + if (!touchActionProperty && ev.type === 'touchmove') ev.preventDefault(); + + if (!this.state.dragPointer) { + if (this.state.options.horizontal) { + shouldStartDrag = Math.abs(pointer.distanceX) > this.state.options.minDistance; + shouldCancel = Math.abs(pointer.distanceY) > this.state.options.minDistance * this.state.options.cancelMultiplier; + } else { + shouldStartDrag = Math.abs(pointer.distanceY) > this.state.options.minDistance; + shouldCancel = Math.abs(pointer.distanceX) > this.state.options.minDistance * this.state.options.cancelMultiplier; + } + + if (shouldStartDrag) { + // Create a new pointer representing this drag, starting at this point where the drag started. + this.state.dragPointer = makeStartPointer(ev); + updatePointerState(ev, this.state.dragPointer); + this.dispatchEvent(ev, '$md.dragstart', this.state.dragPointer); + + } else if (shouldCancel) { + this.cancel(); + } + } else { + this.dispatchDragMove(ev); + } + }, + // Only dispatch dragmove events every frame; any more is unnecessary + dispatchDragMove: $$rAF.throttle(function (ev) { + // Make sure the drag didn't stop while waiting for the next frame + if (this.state.isRunning) { + updatePointerState(ev, this.state.dragPointer); + this.dispatchEvent(ev, '$md.drag', this.state.dragPointer); + } + }), + onEnd: function (ev, pointer) { + if (this.state.dragPointer) { + updatePointerState(ev, this.state.dragPointer); + this.dispatchEvent(ev, '$md.dragend', this.state.dragPointer); + } + } + }) + + /* + * The swipe handler will dispatch a swipe event if, on the end of a touch, + * the velocity and distance were high enough. + */ + .handler('swipe', { + options: { + minVelocity: 0.65, + minDistance: 10 + }, + onEnd: function (ev, pointer) { + var eventType; + + if (Math.abs(pointer.velocityX) > this.state.options.minVelocity && + Math.abs(pointer.distanceX) > this.state.options.minDistance) { + eventType = pointer.directionX == 'left' ? '$md.swipeleft' : '$md.swiperight'; + this.dispatchEvent(ev, eventType); + } + else if (Math.abs(pointer.velocityY) > this.state.options.minVelocity && + Math.abs(pointer.distanceY) > this.state.options.minDistance) { + eventType = pointer.directionY == 'up' ? '$md.swipeup' : '$md.swipedown'; + this.dispatchEvent(ev, eventType); + } + } + }); +} + +/** + * MdGestureHandler + * A GestureHandler is an object which is able to dispatch custom dom events + * based on native dom {touch,pointer,mouse}{start,move,end} events. + * + * A gesture will manage its lifecycle through the start,move,end, and cancel + * functions, which are called by native dom events. + * + * A gesture has the concept of 'options' (eg. a swipe's required velocity), which can be + * overridden by elements registering through $mdGesture.register(). + */ +function GestureHandler (name) { + this.name = name; + this.state = {}; +} + +function MdGestureHandler() { + var hasJQuery = (typeof __webpack_provided_window_dot_jQuery !== 'undefined') && (angular.element === __webpack_provided_window_dot_jQuery); + + GestureHandler.prototype = { + options: {}, + // jQuery listeners don't work with custom DOMEvents, so we have to dispatch events + // differently when jQuery is loaded + dispatchEvent: hasJQuery ? jQueryDispatchEvent : nativeDispatchEvent, + + // These are overridden by the registered handler + onSetup: angular.noop, + onCleanup: angular.noop, + onStart: angular.noop, + onMove: angular.noop, + onEnd: angular.noop, + onCancel: angular.noop, + + // onStart sets up a new state for the handler, which includes options from the + // nearest registered parent element of ev.target. + start: function (ev, pointer) { + if (this.state.isRunning) return; + var parentTarget = this.getNearestParent(ev.target); + // Get the options from the nearest registered parent + var parentTargetOptions = parentTarget && parentTarget.$mdGesture[this.name] || {}; + + this.state = { + isRunning: true, + // Override the default options with the nearest registered parent's options + options: angular.extend({}, this.options, parentTargetOptions), + // Pass in the registered parent node to the state so the onStart listener can use + registeredParent: parentTarget + }; + this.onStart(ev, pointer); + }, + move: function (ev, pointer) { + if (!this.state.isRunning) return; + this.onMove(ev, pointer); + }, + end: function (ev, pointer) { + if (!this.state.isRunning) return; + this.state.isRunning = false; + this.onEnd(ev, pointer); + }, + cancel: function (ev, pointer) { + this.onCancel(ev, pointer); + this.state = {}; + }, + + // Find and return the nearest parent element that has been registered to + // listen for this handler via $mdGesture.register(element, 'handlerName'). + getNearestParent: function (node) { + var current = node; + while (current) { + if ((current.$mdGesture || {})[this.name]) { + return current; + } + current = current.parentNode; + } + return null; + }, + + // Called from $mdGesture.register when an element registers itself with a handler. + // Store the options the user gave on the DOMElement itself. These options will + // be retrieved with getNearestParent when the handler starts. + registerElement: function (element, options) { + var self = this; + element[0].$mdGesture = element[0].$mdGesture || {}; + element[0].$mdGesture[this.name] = options || {}; + element.on('$destroy', onDestroy); + + self.onSetup(element, options || {}); + + return onDestroy; + + function onDestroy() { + delete element[0].$mdGesture[self.name]; + element.off('$destroy', onDestroy); + + self.onCleanup(element, options || {}); + } + } + }; + + return GestureHandler; + + /** + * Dispatch an event with jQuery + * TODO: Make sure this sends bubbling events + * + * @param srcEvent the original DOM touch event that started this. + * @param eventType the name of the custom event to send (eg 'click' or '$md.drag') + * @param eventPointer the pointer object that matches this event. + */ + function jQueryDispatchEvent(srcEvent, eventType, eventPointer) { + eventPointer = eventPointer || pointer; + var eventObj = new angular.element.Event(eventType); + + eventObj.$material = true; + eventObj.pointer = eventPointer; + eventObj.srcEvent = srcEvent; + + angular.extend(eventObj, { + clientX: eventPointer.x, + clientY: eventPointer.y, + screenX: eventPointer.x, + screenY: eventPointer.y, + pageX: eventPointer.x, + pageY: eventPointer.y, + ctrlKey: srcEvent.ctrlKey, + altKey: srcEvent.altKey, + shiftKey: srcEvent.shiftKey, + metaKey: srcEvent.metaKey + }); + angular.element(eventPointer.target).trigger(eventObj); + } + + /** + * NOTE: nativeDispatchEvent is very performance sensitive. + * @param srcEvent the original DOM touch event that started this. + * @param eventType the name of the custom event to send (eg 'click' or '$md.drag') + * @param eventPointer the pointer object that matches this event. + */ + function nativeDispatchEvent(srcEvent, eventType, eventPointer) { + eventPointer = eventPointer || pointer; + var eventObj; + + if (eventType === 'click' || eventType === 'mouseup' || eventType === 'mousedown') { + if (typeof window.MouseEvent === "function") { + eventObj = new MouseEvent(eventType, { + bubbles: true, + cancelable: true, + screenX: Number(srcEvent.screenX), + screenY: Number(srcEvent.screenY), + clientX: Number(eventPointer.x), + clientY: Number(eventPointer.y), + ctrlKey: srcEvent.ctrlKey, + altKey: srcEvent.altKey, + shiftKey: srcEvent.shiftKey, + metaKey: srcEvent.metaKey, + button: srcEvent.button, + buttons: srcEvent.buttons, + relatedTarget: srcEvent.relatedTarget || null + }); + } else { + eventObj = document.createEvent('MouseEvents'); + // This has been deprecated + // https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/initMouseEvent + eventObj.initMouseEvent( + eventType, true, true, window, srcEvent.detail, + eventPointer.x, eventPointer.y, eventPointer.x, eventPointer.y, + srcEvent.ctrlKey, srcEvent.altKey, srcEvent.shiftKey, srcEvent.metaKey, + srcEvent.button, srcEvent.relatedTarget || null + ); + } + } else { + if (typeof window.CustomEvent === "function") { + eventObj = new CustomEvent(eventType, { + bubbles: true, + cancelable: true, + detail: {} + }); + } else { + // This has been deprecated + // https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/initCustomEvent + eventObj = document.createEvent('CustomEvent'); + eventObj.initCustomEvent(eventType, true, true, {}); + } + } + eventObj.$material = true; + eventObj.pointer = eventPointer; + eventObj.srcEvent = srcEvent; + eventPointer.target.dispatchEvent(eventObj); + } +} + +/** + * Attach Gestures: hook document and check shouldHijack clicks + * @ngInject + */ +function attachToDocument($mdGesture, $$MdGestureHandler, $mdUtil) { + if (disableAllGestures) { + return; + } + + if (!isInitialized && $mdGesture.isHijackingClicks) { + /* + * If hijack clicks is true, we preventDefault any click that wasn't + * sent by AngularJS Material. This is because on older Android & iOS, a false, or 'ghost', + * click event will be sent ~400ms after a touchend event happens. + * The only way to know if this click is real is to prevent any normal + * click events, and add a flag to events sent by material so we know not to prevent those. + * + * Two exceptions to click events that should be prevented are: + * - click events sent by the keyboard (eg form submit) + * - events that originate from an Ionic app + */ + document.addEventListener('click' , clickHijacker , true); + document.addEventListener('mouseup' , mouseInputHijacker, true); + document.addEventListener('mousedown', mouseInputHijacker, true); + document.addEventListener('focus' , mouseInputHijacker, true); + + isInitialized = true; + } + + function mouseInputHijacker(ev) { + var isKeyClick = !ev.clientX && !ev.clientY; + + if ( + !isKeyClick && + !ev.$material && + !ev.isIonicTap && + !isInputEventFromLabelClick(ev) && + (ev.type !== 'mousedown' || (!canFocus(ev.target) && !canFocus(document.activeElement))) + ) { + ev.preventDefault(); + ev.stopPropagation(); + } + } + + /** + * Ignore click events that don't come from AngularJS Material, Ionic, Input Label clicks, + * or key presses that generate click events. This helps to ignore the ghost tap events on + * older mobile browsers that get sent after a 300-400ms delay. + * @param ev MouseEvent or modified MouseEvent with $material, pointer, and other fields + */ + function clickHijacker(ev) { + var isKeyClick; + if ($mdUtil.isIos) { + isKeyClick = angular.isDefined(ev.webkitForce) && ev.webkitForce === 0; + } else { + isKeyClick = ev.clientX === 0 && ev.clientY === 0; + } + if (!isKeyClick && !ev.$material && !ev.isIonicTap && !isInputEventFromLabelClick(ev)) { + ev.preventDefault(); + ev.stopPropagation(); + lastLabelClickPos = null; + } else { + lastLabelClickPos = null; + if (ev.target.tagName.toLowerCase() === 'label') { + lastLabelClickPos = {x: ev.x, y: ev.y}; + } + } + } + + + // Listen to all events to cover all platforms. + var START_EVENTS = 'mousedown touchstart pointerdown'; + var MOVE_EVENTS = 'mousemove touchmove pointermove'; + var END_EVENTS = 'mouseup mouseleave touchend touchcancel pointerup pointercancel'; + + angular.element(document) + .on(START_EVENTS, gestureStart) + .on(MOVE_EVENTS, gestureMove) + .on(END_EVENTS, gestureEnd) + // For testing + .on('$$mdGestureReset', function gestureClearCache () { + lastPointer = pointer = null; + }); + + /** + * When a DOM event happens, run all registered gesture handlers' lifecycle + * methods which match the DOM event. + * Eg. when a 'touchstart' event happens, runHandlers('start') will call and + * run `handler.cancel()` and `handler.start()` on all registered handlers. + */ + function runHandlers(handlerEvent, event) { + var handler; + for (var name in HANDLERS) { + handler = HANDLERS[name]; + if (handler instanceof $$MdGestureHandler) { + + if (handlerEvent === 'start') { + // Run cancel to reset any handlers' state + handler.cancel(); + } + handler[handlerEvent](event, pointer); + } + } + } + + /* + * gestureStart vets if a start event is legitimate (and not part of a 'ghost click' from iOS/Android) + * If it is legitimate, we initiate the pointer state and mark the current pointer's type + * For example, for a touchstart event, mark the current pointer as a 'touch' pointer, so mouse events + * won't effect it. + */ + function gestureStart(ev) { + // If we're already touched down, abort + if (pointer) return; + + var now = +Date.now(); + + // iOS & old android bug: after a touch event, a click event is sent 350 ms later. + // If <400ms have passed, don't allow an event of a different type than the previous event + if (lastPointer && !typesMatch(ev, lastPointer) && (now - lastPointer.endTime < 1500)) { + return; + } + + pointer = makeStartPointer(ev); + + runHandlers('start', ev); + } + + /** + * If a move event happens of the right type, update the pointer and run all the move handlers. + * "of the right type": if a mousemove happens but our pointer started with a touch event, do + * nothing. + */ + function gestureMove(ev) { + if (!pointer || !typesMatch(ev, pointer)) return; + + updatePointerState(ev, pointer); + runHandlers('move', ev); + } + + /** + * If an end event happens of the right type, update the pointer, run endHandlers, and save the + * pointer as 'lastPointer'. + */ + function gestureEnd(ev) { + if (!pointer || !typesMatch(ev, pointer)) return; + + updatePointerState(ev, pointer); + pointer.endTime = +Date.now(); + + if (ev.type !== 'pointercancel') { + runHandlers('end', ev); + } + + lastPointer = pointer; + pointer = null; + } + +} + +// ******************** +// Module Functions +// ******************** + +/* + * Initiate the pointer. x, y, and the pointer's type. + */ +function makeStartPointer(ev) { + var point = getEventPoint(ev); + var startPointer = { + startTime: +Date.now(), + target: ev.target, + // 'p' for pointer events, 'm' for mouse, 't' for touch + type: ev.type.charAt(0) + }; + startPointer.startX = startPointer.x = point.pageX; + startPointer.startY = startPointer.y = point.pageY; + return startPointer; +} + +/* + * return whether the pointer's type matches the event's type. + * Eg if a touch event happens but the pointer has a mouse type, return false. + */ +function typesMatch(ev, pointer) { + return ev && pointer && ev.type.charAt(0) === pointer.type; +} + +/** + * Gets whether the given event is an input event that was caused by clicking on an + * associated label element. + * + * This is necessary because the browser will, upon clicking on a label element, fire an + * *extra* click event on its associated input (if any). mdGesture is able to flag the label + * click as with `$material` correctly, but not the second input click. + * + * In order to determine whether an input event is from a label click, we compare the (x, y) for + * the event to the (x, y) for the most recent label click (which is cleared whenever a non-label + * click occurs). Unfortunately, there are no event properties that tie the input and the label + * together (such as relatedTarget). + * + * @param {MouseEvent} event + * @returns {boolean} + */ +function isInputEventFromLabelClick(event) { + return lastLabelClickPos + && lastLabelClickPos.x === event.x + && lastLabelClickPos.y === event.y; +} + +/* + * Update the given pointer based upon the given DOMEvent. + * Distance, velocity, direction, duration, etc + */ +function updatePointerState(ev, pointer) { + var point = getEventPoint(ev); + var x = pointer.x = point.pageX; + var y = pointer.y = point.pageY; + + pointer.distanceX = x - pointer.startX; + pointer.distanceY = y - pointer.startY; + pointer.distance = Math.sqrt( + pointer.distanceX * pointer.distanceX + pointer.distanceY * pointer.distanceY + ); + + pointer.directionX = pointer.distanceX > 0 ? 'right' : pointer.distanceX < 0 ? 'left' : ''; + pointer.directionY = pointer.distanceY > 0 ? 'down' : pointer.distanceY < 0 ? 'up' : ''; + + pointer.duration = +Date.now() - pointer.startTime; + pointer.velocityX = pointer.distanceX / pointer.duration; + pointer.velocityY = pointer.distanceY / pointer.duration; +} + +/** + * Normalize the point where the DOM event happened whether it's touch or mouse. + * @returns point event obj with pageX and pageY on it. + */ +function getEventPoint(ev) { + ev = ev.originalEvent || ev; // support jQuery events + return (ev.touches && ev.touches[0]) || + (ev.changedTouches && ev.changedTouches[0]) || + ev; +} + +/** Checks whether an element can be focused. */ +function canFocus(element) { + return ( + !!element && + element.getAttribute('tabindex') !== '-1' && + !element.hasAttribute('disabled') && + ( + element.hasAttribute('tabindex') || + element.hasAttribute('href') || + element.isContentEditable || + ['INPUT', 'SELECT', 'BUTTON', 'TEXTAREA', 'VIDEO', 'AUDIO'].indexOf(element.nodeName) !== -1 + ) + ); +} + +})(); +(function(){ +"use strict"; + +/** + * @ngdoc module + * @name material.core.interaction + * @description + * User interaction detection to provide proper accessibility. + */ +MdInteractionService.$inject = ["$timeout", "$mdUtil", "$rootScope"]; +angular + .module('material.core.interaction', []) + .service('$mdInteraction', MdInteractionService); + + +/** + * @ngdoc service + * @name $mdInteraction + * @module material.core.interaction + * + * @description + * + * Service which keeps track of the last interaction type and validates them for several browsers. + * The service hooks into the document's body and listens for touch, mouse and keyboard events. + * + * The most recent interaction type can be retrieved by calling the `getLastInteractionType` method. + * + * Here is an example markup for using the interaction service. + * + * + * var lastType = $mdInteraction.getLastInteractionType(); + * + * if (lastType === 'keyboard') { + * // We only restore the focus for keyboard users. + * restoreFocus(); + * } + * + * + */ +function MdInteractionService($timeout, $mdUtil, $rootScope) { + this.$timeout = $timeout; + this.$mdUtil = $mdUtil; + this.$rootScope = $rootScope; + + // IE browsers can also trigger pointer events, which also leads to an interaction. + this.pointerEvent = 'MSPointerEvent' in window ? 'MSPointerDown' : 'PointerEvent' in window ? 'pointerdown' : null; + this.bodyElement = angular.element(document.body); + this.isBuffering = false; + this.bufferTimeout = null; + this.lastInteractionType = null; + this.lastInteractionTime = null; + this.inputHandler = this.onInputEvent.bind(this); + this.bufferedInputHandler = this.onBufferInputEvent.bind(this); + + // Type Mappings for the different events + // There will be three three interaction types + // `keyboard`, `mouse` and `touch` + // type `pointer` will be evaluated in `pointerMap` for IE Browser events + this.inputEventMap = { + 'keydown': 'keyboard', + 'mousedown': 'mouse', + 'mouseenter': 'mouse', + 'touchstart': 'touch', + 'pointerdown': 'pointer', + 'MSPointerDown': 'pointer' + }; + + // IE PointerDown events will be validated in `touch` or `mouse` + // Index numbers referenced here: https://msdn.microsoft.com/library/windows/apps/hh466130.aspx + this.iePointerMap = { + 2: 'touch', + 3: 'touch', + 4: 'mouse' + }; + + this.initializeEvents(); + this.$rootScope.$on('$destroy', this.deregister.bind(this)); +} + +/** + * Removes all event listeners created by $mdInteration on the + * body element. + */ +MdInteractionService.prototype.deregister = function() { + + this.bodyElement.off('keydown mousedown', this.inputHandler); + + if ('ontouchstart' in document.documentElement) { + this.bodyElement.off('touchstart', this.bufferedInputHandler); + } + + if (this.pointerEvent) { + this.bodyElement.off(this.pointerEvent, this.inputHandler); + } + +}; + +/** + * Initializes the interaction service, by registering all interaction events to the + * body element. + */ +MdInteractionService.prototype.initializeEvents = function() { + + this.bodyElement.on('keydown mousedown', this.inputHandler); + + if ('ontouchstart' in document.documentElement) { + this.bodyElement.on('touchstart', this.bufferedInputHandler); + } + + if (this.pointerEvent) { + this.bodyElement.on(this.pointerEvent, this.inputHandler); + } + +}; + +/** + * Event listener for normal interaction events, which should be tracked. + * @param event {MouseEvent|KeyboardEvent|PointerEvent|TouchEvent} + */ +MdInteractionService.prototype.onInputEvent = function(event) { + if (this.isBuffering) { + return; + } + + var type = this.inputEventMap[event.type]; + + if (type === 'pointer') { + type = this.iePointerMap[event.pointerType] || event.pointerType; + } + + this.lastInteractionType = type; + this.lastInteractionTime = this.$mdUtil.now(); +}; + +/** + * Event listener for interaction events which should be buffered (touch events). + * @param event {TouchEvent} + */ +MdInteractionService.prototype.onBufferInputEvent = function(event) { + this.$timeout.cancel(this.bufferTimeout); + + this.onInputEvent(event); + this.isBuffering = true; + + // The timeout of 650ms is needed to delay the touchstart, because otherwise the touch will call + // the `onInput` function multiple times. + this.bufferTimeout = this.$timeout(function() { + this.isBuffering = false; + }.bind(this), 650, false); + +}; + +/** + * @ngdoc method + * @name $mdInteraction#getLastInteractionType + * @description Retrieves the last interaction type triggered in body. + * @returns {string|null} Last interaction type. + */ +MdInteractionService.prototype.getLastInteractionType = function() { + return this.lastInteractionType; +}; + +/** + * @ngdoc method + * @name $mdInteraction#isUserInvoked + * @description Method to detect whether any interaction happened recently or not. + * @param {number=} checkDelay Time to check for any interaction to have been triggered. + * @returns {boolean} Whether there was any interaction or not. + */ +MdInteractionService.prototype.isUserInvoked = function(checkDelay) { + var delay = angular.isNumber(checkDelay) ? checkDelay : 15; + + // Check for any interaction to be within the specified check time. + return this.lastInteractionTime >= this.$mdUtil.now() - delay; +}; + +})(); +(function(){ +"use strict"; + +angular.module('material.core') + .provider('$$interimElement', InterimElementProvider); + +/** + * @ngdoc service + * @name $$interimElementProvider + * @module material.core.interimElement + * + * @description + * + * Factory that constructs `$$interimElement.$service` services. + * Used internally in material design for elements that appear on screen temporarily. + * The service provides a promise-like API for interacting with the temporary + * elements. + * + * + * app.service('$mdToast', function($$interimElement) { + * var $mdToast = $$interimElement(toastDefaultOptions); + * return $mdToast; + * }); + * + * + * @param {object=} defaultOptions Options used by default for the `show` method on the service. + * + * @returns {$$interimElement.$service} + */ + +function InterimElementProvider() { + InterimElementFactory.$inject = ["$document", "$q", "$rootScope", "$timeout", "$rootElement", "$animate", "$mdUtil", "$mdCompiler", "$mdTheming", "$injector", "$exceptionHandler"]; + createInterimElementProvider.$get = InterimElementFactory; + return createInterimElementProvider; + + /** + * Returns a new provider which allows configuration of a new interimElement + * service. Allows configuration of default options & methods for options, + * as well as configuration of 'preset' methods (eg dialog.basic(): basic is a preset method) + */ + function createInterimElementProvider(interimFactoryName) { + factory.$inject = ["$$interimElement", "$injector"]; + var EXPOSED_METHODS = ['onHide', 'onShow', 'onRemove']; + + var customMethods = {}; + var providerConfig = { + presets: {} + }; + + var provider = { + setDefaults: setDefaults, + addPreset: addPreset, + addMethod: addMethod, + $get: factory + }; + + /** + * all interim elements will come with the 'build' preset + */ + provider.addPreset('build', { + methods: ['controller', 'controllerAs', 'resolve', 'multiple', + 'template', 'templateUrl', 'themable', 'transformTemplate', 'parent', 'contentElement'] + }); + + return provider; + + /** + * Save the configured defaults to be used when the factory is instantiated + */ + function setDefaults(definition) { + providerConfig.optionsFactory = definition.options; + providerConfig.methods = (definition.methods || []).concat(EXPOSED_METHODS); + return provider; + } + + /** + * Add a method to the factory that isn't specific to any interim element operations + */ + function addMethod(name, fn) { + customMethods[name] = fn; + return provider; + } + + /** + * Save the configured preset to be used when the factory is instantiated + */ + function addPreset(name, definition) { + definition = definition || {}; + definition.methods = definition.methods || []; + definition.options = definition.options || function() { return {}; }; + + if (/^cancel|hide|show$/.test(name)) { + throw new Error("Preset '" + name + "' in " + interimFactoryName + " is reserved!"); + } + if (definition.methods.indexOf('_options') > -1) { + throw new Error("Method '_options' in " + interimFactoryName + " is reserved!"); + } + providerConfig.presets[name] = { + methods: definition.methods.concat(EXPOSED_METHODS), + optionsFactory: definition.options, + argOption: definition.argOption + }; + return provider; + } + + function addPresetMethod(presetName, methodName, method) { + providerConfig.presets[presetName][methodName] = method; + } + + /** + * Create a factory that has the given methods & defaults implementing interimElement + */ + /* @ngInject */ + function factory($$interimElement, $injector) { + var defaultMethods; + var defaultOptions; + var interimElementService = $$interimElement(); + + /* + * publicService is what the developer will be using. + * It has methods hide(), cancel(), show(), build(), and any other + * presets which were set during the config phase. + */ + var publicService = { + hide: interimElementService.hide, + cancel: interimElementService.cancel, + show: showInterimElement, + + // Special internal method to destroy an interim element without animations + // used when navigation changes causes a $scope.$destroy() action + destroy : destroyInterimElement + }; + + + defaultMethods = providerConfig.methods || []; + // This must be invoked after the publicService is initialized + defaultOptions = invokeFactory(providerConfig.optionsFactory, {}); + + // Copy over the simple custom methods + angular.forEach(customMethods, function(fn, name) { + publicService[name] = fn; + }); + + angular.forEach(providerConfig.presets, function(definition, name) { + var presetDefaults = invokeFactory(definition.optionsFactory, {}); + var presetMethods = (definition.methods || []).concat(defaultMethods); + + // Every interimElement built with a preset has a field called `$type`, + // which matches the name of the preset. + // Eg in preset 'confirm', options.$type === 'confirm' + angular.extend(presetDefaults, { $type: name }); + + // This creates a preset class which has setter methods for every + // method given in the `.addPreset()` function, as well as every + // method given in the `.setDefaults()` function. + // + // @example + // .setDefaults({ + // methods: ['hasBackdrop', 'clickOutsideToClose', 'escapeToClose', 'targetEvent'], + // options: dialogDefaultOptions + // }) + // .addPreset('alert', { + // methods: ['title', 'ok'], + // options: alertDialogOptions + // }) + // + // Set values will be passed to the options when interimElement.show() is called. + function Preset(opts) { + this._options = angular.extend({}, presetDefaults, opts); + } + angular.forEach(presetMethods, function(name) { + Preset.prototype[name] = function(value) { + this._options[name] = value; + return this; + }; + }); + + // Create shortcut method for one-linear methods + if (definition.argOption) { + var methodName = 'show' + name.charAt(0).toUpperCase() + name.slice(1); + publicService[methodName] = function(arg) { + var config = publicService[name](arg); + return publicService.show(config); + }; + } + + // eg $mdDialog.alert() will return a new alert preset + publicService[name] = function(arg) { + // If argOption is supplied, eg `argOption: 'content'`, then we assume + // if the argument is not an options object then it is the `argOption` option. + // + // @example `$mdToast.simple('hello')` // sets options.content to hello + // // because argOption === 'content' + if (arguments.length && definition.argOption && + !angular.isObject(arg) && !angular.isArray(arg)) { + + return (new Preset())[definition.argOption](arg); + + } else { + return new Preset(arg); + } + + }; + }); + + return publicService; + + /** + * + */ + function showInterimElement(opts) { + // opts is either a preset which stores its options on an _options field, + // or just an object made up of options + opts = opts || { }; + if (opts._options) opts = opts._options; + + return interimElementService.show( + angular.extend({}, defaultOptions, opts) + ); + } + + /** + * Special method to hide and destroy an interimElement WITHOUT + * any 'leave` or hide animations ( an immediate force hide/remove ) + * + * NOTE: This calls the onRemove() subclass method for each component... + * which must have code to respond to `options.$destroy == true` + */ + function destroyInterimElement(opts) { + return interimElementService.destroy(opts); + } + + /** + * Helper to call $injector.invoke with a local of the factory name for + * this provider. + * If an $mdDialog is providing options for a dialog and tries to inject + * $mdDialog, a circular dependency error will happen. + * We get around that by manually injecting $mdDialog as a local. + */ + function invokeFactory(factory, defaultVal) { + var locals = {}; + locals[interimFactoryName] = publicService; + return $injector.invoke(factory || function() { return defaultVal; }, {}, locals); + } + } + } + + /* @ngInject */ + function InterimElementFactory($document, $q, $rootScope, $timeout, $rootElement, $animate, + $mdUtil, $mdCompiler, $mdTheming, $injector, $exceptionHandler) { + return function createInterimElementService() { + var SHOW_CANCELLED = false; + + /** + * @ngdoc service + * @name $$interimElementProvider.$service + * + * @description + * A service used to control inserting and removing of an element from the DOM. + * It is used by $mdBottomSheet, $mdDialog, $mdToast, $mdMenu, $mdPanel, and $mdSelect. + */ + var service; + + var showPromises = []; // Promises for the interim's which are currently opening. + var hidePromises = []; // Promises for the interim's which are currently hiding. + var showingInterims = []; // Interim elements which are currently showing up. + + // Publish instance $$interimElement service; + return service = { + show: show, + hide: waitForInterim(hide), + cancel: waitForInterim(cancel), + destroy : destroy, + $injector_: $injector + }; + + /** + * @ngdoc method + * @name $$interimElementProvider.$service#show + * @kind function + * + * @description + * Adds the `$interimElement` to the DOM and returns a special promise that will be resolved + * or rejected with hide or cancel, respectively. + * + * @param {Object} options map of options and values + * @returns {Promise} a Promise that will be resolved when hide() is called or rejected when + * cancel() is called. + */ + function show(options) { + options = options || {}; + var interimElement = new InterimElement(options || {}); + + // When an interim element is currently showing, we have to cancel it. + // Just hiding it, will resolve the InterimElement's promise, the promise should be + // rejected instead. + var hideAction = options.multiple ? $q.resolve() : $q.all(showPromises); + + if (!options.multiple) { + // Wait for all opening interim's to finish their transition. + hideAction = hideAction.then(function() { + // Wait for all closing and showing interim's to be completely closed. + var promiseArray = hidePromises.concat(showingInterims.map(service.cancel)); + return $q.all(promiseArray); + }); + } + + var showAction = hideAction.then(function() { + + return interimElement + .show() + .then(function () { + showingInterims.push(interimElement); + }) + .catch(function (reason) { + return reason; + }) + .finally(function() { + showPromises.splice(showPromises.indexOf(showAction), 1); + }); + + }); + + showPromises.push(showAction); + + // In AngularJS 1.6+, exceptions inside promises will cause a rejection. We need to handle + // the rejection and only log it if it's an error. + interimElement.deferred.promise.catch(function(fault) { + if (fault instanceof Error) { + $exceptionHandler(fault); + } + + return fault; + }); + + // Return a promise that will be resolved when the interim + // element is hidden or cancelled... + return interimElement.deferred.promise; + } + + /** + * @ngdoc method + * @name $$interimElementProvider.$service#hide + * @kind function + * + * @description + * Removes the `$interimElement` from the DOM and resolves the Promise returned from `show()`. + * + * @param {*} reason Data used to resolve the Promise + * @param {object} options map of options and values + * @returns {Promise} a Promise that will be resolved after the element has been removed + * from the DOM. + */ + function hide(reason, options) { + options = options || {}; + + if (options.closeAll) { + // We have to make a shallow copy of the array, because otherwise the map will break. + return $q.all(showingInterims.slice().reverse().map(closeElement)); + } else if (options.closeTo !== undefined) { + return $q.all(showingInterims.slice(options.closeTo).map(closeElement)); + } + + // Hide the latest showing interim element. + return closeElement(showingInterims[showingInterims.length - 1]); + + /** + * @param {InterimElement} interim element to close + * @returns {Promise} + */ + function closeElement(interim) { + if (!interim) { + return $q.when(reason); + } + + var hideAction = interim + .remove(reason, false, options || { }) + .catch(function(reason) { return reason; }) + .finally(function() { + hidePromises.splice(hidePromises.indexOf(hideAction), 1); + }); + + showingInterims.splice(showingInterims.indexOf(interim), 1); + hidePromises.push(hideAction); + + return interim.deferred.promise; + } + } + + /** + * @ngdoc method + * @name $$interimElementProvider.$service#cancel + * @kind function + * + * @description + * Removes the `$interimElement` from the DOM and rejects the Promise returned from `show()`. + * + * @param {*} reason Data used to resolve the Promise + * @param {object} options map of options and values + * @returns {Promise} Promise that will be resolved after the element has been removed + * from the DOM. + */ + function cancel(reason, options) { + var interim = showingInterims.pop(); + if (!interim) { + return $q.when(reason); + } + + var cancelAction = interim + .remove(reason, true, options || {}) + .catch(function(reason) { return reason; }) + .finally(function() { + hidePromises.splice(hidePromises.indexOf(cancelAction), 1); + }); + + hidePromises.push(cancelAction); + + // Since AngularJS 1.6.7, promises will be logged to $exceptionHandler when the promise + // is not handling the rejection. We create a pseudo catch handler, which will prevent the + // promise from being logged to the $exceptionHandler. + return interim.deferred.promise.catch(angular.noop); + } + + /** + * Creates a function to wait for at least one interim element to be available. + * @param callbackFn Function to be used as callback + * @returns {Function} + */ + function waitForInterim(callbackFn) { + return function() { + var fnArguments = arguments; + + if (!showingInterims.length) { + // When there are still interim's opening, then wait for the first interim element to + // finish its open animation. + if (showPromises.length) { + return showPromises[0].finally(function () { + return callbackFn.apply(service, fnArguments); + }); + } + + return $q.when("No interim elements currently showing up."); + } + + return callbackFn.apply(service, fnArguments); + }; + } + + /** + * @ngdoc method + * @name $$interimElementProvider.$service#destroy + * @kind function + * + * Special method to quick-remove the interim element without running animations. This is + * useful when the parent component has been or is being destroyed. + * + * Note: interim elements are in "interim containers". + */ + function destroy(targetEl) { + var interim = !targetEl ? showingInterims.shift() : null; + + var parentEl = angular.element(targetEl).length && angular.element(targetEl)[0].parentNode; + + if (parentEl) { + // Try to find the interim in the stack which corresponds to the supplied DOM element. + var filtered = showingInterims.filter(function(entry) { + return entry.options.element[0] === parentEl; + }); + + // Note: This function might be called when the element already has been removed, + // in which case we won't find any matches. + if (filtered.length) { + interim = filtered[0]; + showingInterims.splice(showingInterims.indexOf(interim), 1); + } + } + + return interim ? interim.remove(SHOW_CANCELLED, false, { '$destroy': true }) : + $q.when(SHOW_CANCELLED); + } + + /* + * Internal Interim Element Object + * Used internally to manage the DOM element and related data + */ + function InterimElement(options) { + var self, element, showAction = $q.when(true); + + options = configureScopeAndTransitions(options); + + return self = { + options : options, + deferred: $q.defer(), + show : createAndTransitionIn, + remove : transitionOutAndRemove + }; + + /** + * Compile, link, and show this interim element. Use optional autoHide and transition-in + * effects. + * @return {Q.Promise} + */ + function createAndTransitionIn() { + return $q(function(resolve, reject) { + + // Trigger onCompiling callback before the compilation starts. + // This is useful, when modifying options, which can be influenced by developers. + options.onCompiling && options.onCompiling(options); + + compileElement(options) + .then(function(compiledData) { + element = linkElement(compiledData, options); + + // Expose the cleanup function from the compiler. + options.cleanupElement = compiledData.cleanup; + + showAction = showElement(element, options, compiledData.controller) + .then(resolve, rejectAll); + }).catch(rejectAll); + + function rejectAll(fault) { + // Force the '$md.show()' promise to reject + self.deferred.reject(fault); + + // Continue rejection propagation + reject(fault); + } + }); + } + + /** + * After the show process has finished/rejected: + * - announce 'removing', + * - perform the transition-out, and + * - perform optional clean up scope. + */ + function transitionOutAndRemove(response, isCancelled, opts) { + + // abort if the show() and compile failed + if (!element) return $q.when(false); + + options = angular.extend(options || {}, opts || {}); + options.cancelAutoHide && options.cancelAutoHide(); + options.element.triggerHandler('$mdInterimElementRemove'); + + if (options.$destroy === true) { + + return hideElement(options.element, options).then(function(){ + (isCancelled && rejectAll(response)) || resolveAll(response); + }); + + } else { + $q.when(showAction).finally(function() { + hideElement(options.element, options).then(function() { + isCancelled ? rejectAll(response) : resolveAll(response); + }, rejectAll); + }); + + return self.deferred.promise; + } + + + /** + * The `show()` returns a promise that will be resolved when the interim + * element is hidden or cancelled... + */ + function resolveAll(response) { + self.deferred.resolve(response); + } + + /** + * Force the '$md.show()' promise to reject + */ + function rejectAll(fault) { + self.deferred.reject(fault); + } + } + + /** + * Prepare optional isolated scope and prepare $animate with default enter and leave + * transitions for the new element instance. + */ + function configureScopeAndTransitions(options) { + options = options || { }; + if (options.template) { + options.template = $mdUtil.processTemplate(options.template); + } + + return angular.extend({ + preserveScope: false, + cancelAutoHide : angular.noop, + scope: options.scope || $rootScope.$new(options.isolateScope), + + /** + * Default usage to enable $animate to transition-in; can be easily overridden via 'options' + */ + onShow: function transitionIn(scope, element, options) { + return $animate.enter(element, options.parent); + }, + + /** + * Default usage to enable $animate to transition-out; can be easily overridden via 'options' + */ + onRemove: function transitionOut(scope, element) { + // Element could be undefined if a new element is shown before + // the old one finishes compiling. + return element && $animate.leave(element) || $q.when(); + } + }, options); + + } + + /** + * Compile an element with a templateUrl, controller, and locals + * @param {Object} options + * @return {Q.Promise<{element: JQLite=, link: Function, locals: Object, cleanup: any=, + * controller: Object=}>} + */ + function compileElement(options) { + + var compiled = !options.skipCompile ? $mdCompiler.compile(options) : null; + + return compiled || $q(function (resolve) { + resolve({ + locals: {}, + link: function () { + return options.element; + } + }); + }); + } + + /** + * Link an element with compiled configuration + * @param {{element: JQLite=, link: Function, locals: Object, controller: Object=}} compileData + * @param {Object} options + * @return {JQLite} + */ + function linkElement(compileData, options) { + angular.extend(compileData.locals, options); + + var element = compileData.link(options.scope); + + // Search for parent at insertion time, if not specified + options.element = element; + options.parent = findParent(element, options); + if (options.themable) $mdTheming(element); + + return element; + } + + /** + * Search for parent at insertion time, if not specified. + * @param {JQLite} element + * @param {Object} options + * @return {JQLite} + */ + function findParent(element, options) { + var parent = options.parent; + + // Search for parent at insertion time, if not specified + if (angular.isFunction(parent)) { + parent = parent(options.scope, element, options); + } else if (angular.isString(parent)) { + parent = angular.element($document[0].querySelector(parent)); + } else { + parent = angular.element(parent); + } + + // If parent querySelector/getter function fails, or it's just null, + // find a default. + if (!(parent || {}).length) { + var el; + if ($rootElement[0] && $rootElement[0].querySelector) { + el = $rootElement[0].querySelector(':not(svg) > body'); + } + if (!el) el = $rootElement[0]; + if (el.nodeName === '#comment') { + el = $document[0].body; + } + return angular.element(el); + } + + return parent; + } + + /** + * If auto-hide is enabled, start timer and prepare cancel function + */ + function startAutoHide() { + var autoHideTimer, cancelAutoHide = angular.noop; + + if (options.hideDelay) { + autoHideTimer = $timeout(service.hide, options.hideDelay) ; + cancelAutoHide = function() { + $timeout.cancel(autoHideTimer); + }; + } + + // Cache for subsequent use + options.cancelAutoHide = function() { + cancelAutoHide(); + options.cancelAutoHide = undefined; + }; + } + + /** + * Show the element (with transitions), notify complete and start optional auto hiding + * timer. + * @param {JQLite} element + * @param {Object} options + * @param {Object} controller + * @return {Q.Promise} + */ + function showElement(element, options, controller) { + // Trigger onShowing callback before the `show()` starts + var notifyShowing = options.onShowing || angular.noop; + // Trigger onComplete callback when the `show()` finishes + var notifyComplete = options.onComplete || angular.noop; + + // Necessary for consistency between AngularJS 1.5 and 1.6. + try { + // This fourth controller parameter is used by $mdDialog in beforeShow(). + notifyShowing(options.scope, element, options, controller); + } catch (e) { + return $q.reject(e); + } + + return $q(function (resolve, reject) { + try { + // Start transitionIn + $q.when(options.onShow(options.scope, element, options)) + .then(function () { + notifyComplete(options.scope, element, options); + startAutoHide(); + + resolve(element); + }, reject); + + } catch (e) { + reject(e.message); + } + }); + } + + function hideElement(element, options) { + var announceRemoving = options.onRemoving || angular.noop; + + return $q(function (resolve, reject) { + try { + // Start transitionIn + var action = $q.when(options.onRemove(options.scope, element, options) || true); + + // Trigger callback *before* the remove operation starts + announceRemoving(element, action); + + if (options.$destroy) { + // For $destroy, onRemove should be synchronous + resolve(element); + + if (!options.preserveScope && options.scope) { + // scope destroy should still be be done after the current digest is done + action.then(function() { options.scope.$destroy(); }); + } + } else { + // Wait until transition-out is done + action.then(function () { + if (!options.preserveScope && options.scope) { + options.scope.$destroy(); + } + + resolve(element); + }, reject); + } + } catch (e) { + reject(e.message); + } + }); + } + + } + }; + } +} + +})(); +(function(){ +"use strict"; + +(function() { + 'use strict'; + + var $mdUtil, $interpolate, $log; + + var SUFFIXES = /(-gt)?-(sm|md|lg|print)/g; + var WHITESPACE = /\s+/g; + + var FLEX_OPTIONS = ['grow', 'initial', 'auto', 'none', 'noshrink', 'nogrow']; + var LAYOUT_OPTIONS = ['row', 'column']; + var ALIGNMENT_MAIN_AXIS= ["", "start", "center", "end", "stretch", "space-around", "space-between"]; + var ALIGNMENT_CROSS_AXIS= ["", "start", "center", "end", "stretch"]; + + var config = { + /** + * Enable directive attribute-to-class conversions + * Developers can use `` to quickly + * disable the Layout directives and prohibit the injection of Layout classNames + */ + enabled: true, + + /** + * List of mediaQuery breakpoints and associated suffixes + * [ + * { suffix: "sm", mediaQuery: "screen and (max-width: 599px)" }, + * { suffix: "md", mediaQuery: "screen and (min-width: 600px) and (max-width: 959px)" } + * ] + */ + breakpoints: [] + }; + + registerLayoutAPI(angular.module('material.core.layout', ['ng'])); + + /** + * registerLayoutAPI() + * + * The original AngularJS Material Layout solution used attribute selectors and CSS. + * + * ```html + *
    My Content
    + * ``` + * + * ```css + * [layout] { + * box-sizing: border-box; + * display:flex; + * } + * [layout=column] { + * flex-direction : column + * } + * ``` + * + * Use of attribute selectors creates significant performance impacts in some + * browsers... mainly IE. + * + * This module registers directives that allow the same layout attributes to be + * interpreted and converted to class selectors. The directive will add equivalent classes to + * each element that contains a Layout directive. + * + * ```html + *
    My Content
    + * ``` + * + * ```css + * .layout { + * box-sizing: border-box; + * display:flex; + * } + * .layout-column { + * flex-direction : column + * } + * ``` + */ + function registerLayoutAPI(module){ + var PREFIX_REGEXP = /^((?:x|data)[:\-_])/i; + var SPECIAL_CHARS_REGEXP = /([:\-_]+(.))/g; + + // NOTE: these are also defined in constants::MEDIA_PRIORITY and constants::MEDIA + var BREAKPOINTS = ["", "xs", "gt-xs", "sm", "gt-sm", "md", "gt-md", "lg", "gt-lg", "xl", "print"]; + var API_WITH_VALUES = ["layout", "flex", "flex-order", "flex-offset", "layout-align"]; + var API_NO_VALUES = ["show", "hide", "layout-padding", "layout-margin"]; + + + // Build directive registration functions for the standard Layout API... for all breakpoints. + angular.forEach(BREAKPOINTS, function(mqb) { + + // Attribute directives with expected, observable value(s) + angular.forEach(API_WITH_VALUES, function(name){ + var fullName = mqb ? name + "-" + mqb : name; + module.directive(directiveNormalize(fullName), attributeWithObserve(fullName)); + }); + + // Attribute directives with no expected value(s) + angular.forEach(API_NO_VALUES, function(name){ + var fullName = mqb ? name + "-" + mqb : name; + module.directive(directiveNormalize(fullName), attributeWithoutValue(fullName)); + }); + + }); + + // Register other, special directive functions for the Layout features: + module + .provider('$$mdLayout', function() { + // Publish internal service for Layouts + return { + $get : angular.noop, + validateAttributeValue : validateAttributeValue, + validateAttributeUsage : validateAttributeUsage, + /** + * Easy way to disable/enable the Layout API. + * When disabled, this stops all attribute-to-classname generations + */ + disableLayouts : function(isDisabled) { + config.enabled = (isDisabled !== true); + } + }; + }) + + .directive('mdLayoutCss' , disableLayoutDirective) + .directive('ngCloak' , buildCloakInterceptor('ng-cloak')) + + .directive('layoutWrap' , attributeWithoutValue('layout-wrap')) + .directive('layoutNowrap' , attributeWithoutValue('layout-nowrap')) + .directive('layoutNoWrap' , attributeWithoutValue('layout-no-wrap')) + .directive('layoutFill' , attributeWithoutValue('layout-fill')) + + // Determine if + .config(detectDisabledLayouts); + + /** + * Converts snake_case to camelCase. + * Also there is special case for Moz prefix starting with upper case letter. + * @param name Name to normalize + */ + function directiveNormalize(name) { + return name + .replace(PREFIX_REGEXP, '') + .replace(SPECIAL_CHARS_REGEXP, function(_, separator, letter, offset) { + return offset ? letter.toUpperCase() : letter; + }); + } + } + + + /** + * Detect if any of the HTML tags has a [md-layouts-disabled] attribute; + * If yes, then immediately disable all layout API features + * + * Note: this attribute should be specified on either the HTML or BODY tags + * @ngInject + */ + function detectDisabledLayouts() { + var isDisabled = !!document.querySelector('[md-layouts-disabled]'); + config.enabled = !isDisabled; + } + + /** + * Special directive that will disable ALL Layout conversions of layout + * attribute(s) to classname(s). + * + * + * + * + * + * ... + * + * + * Note: Using md-layout-css directive requires the developer to load the Material + * Layout Attribute stylesheet (which only uses attribute selectors): + * + * `angular-material.layout.css` + * + * Another option is to use the LayoutProvider to configure and disable the attribute + * conversions; this would obviate the use of the `md-layout-css` directive + */ + function disableLayoutDirective() { + // Return a 1x-only, first-match attribute directive + config.enabled = false; + + return { + restrict : 'A', + priority : '900' + }; + } + + /** + * Tail-hook ngCloak to delay the uncloaking while Layout transformers + * finish processing. Eliminates flicker with Material.Layouts + */ + function buildCloakInterceptor(className) { + return ['$timeout', function($timeout){ + return { + restrict : 'A', + priority : -10, // run after normal ng-cloak + compile : function(element) { + if (!config.enabled) return angular.noop; + + // Re-add the cloak + element.addClass(className); + + return function(scope, element) { + // Wait while layout injectors configure, then uncloak + // NOTE: $rAF does not delay enough... and this is a 1x-only event, + // $timeout is acceptable. + $timeout(function(){ + element.removeClass(className); + }, 10, false); + }; + } + }; + }]; + } + + + // ********************************************************************************* + // + // These functions create registration functions for AngularJS Material Layout attribute + // directives. This provides easy translation to switch AngularJS Material attribute selectors to + // CLASS selectors and directives; which has huge performance implications for IE Browsers. + // + // ********************************************************************************* + + /** + * Creates a directive registration function where a possible dynamic attribute + * value will be observed/watched. + * @param {string} className attribute name; eg `layout-gt-md` with value ="row" + */ + function attributeWithObserve(className) { + + return ['$mdUtil', '$interpolate', "$log", function(_$mdUtil_, _$interpolate_, _$log_) { + $mdUtil = _$mdUtil_; + $interpolate = _$interpolate_; + $log = _$log_; + + return { + restrict: 'A', + compile: function(element, attr) { + var linkFn; + if (config.enabled) { + // immediately replace static (non-interpolated) invalid values... + + validateAttributeUsage(className, attr, element, $log); + + validateAttributeValue(className, + getNormalizedAttrValue(className, attr, ""), + buildUpdateFn(element, className, attr) + ); + + linkFn = translateWithValueToCssClass; + } + + // Use for postLink to account for transforms after ng-transclude. + return linkFn || angular.noop; + } + }; + }]; + + /** + * Observe deprecated layout attributes and update the element's layout classes to match. + */ + function translateWithValueToCssClass(scope, element, attrs) { + var updateFn = updateClassWithValue(element, className, attrs); + var unwatch = attrs.$observe(attrs.$normalize(className), updateFn); + + updateFn(getNormalizedAttrValue(className, attrs, "")); + scope.$on("$destroy", function() { unwatch(); }); + } + } + + /** + * Creates a registration function for AngularJS Material Layout attribute directive. + * This is a `simple` transpose of attribute usage to class usage; where we ignore + * any attribute value. + */ + function attributeWithoutValue(className) { + return ['$mdUtil', '$interpolate', "$log", function(_$mdUtil_, _$interpolate_, _$log_) { + $mdUtil = _$mdUtil_; + $interpolate = _$interpolate_; + $log = _$log_; + + return { + restrict: 'A', + compile: function(element, attr) { + var linkFn; + if (config.enabled) { + // immediately replace static (non-interpolated) invalid values... + + validateAttributeValue(className, + getNormalizedAttrValue(className, attr, ""), + buildUpdateFn(element, className, attr) + ); + + translateToCssClass(null, element); + + // Use for postLink to account for transforms after ng-transclude. + linkFn = translateToCssClass; + } + + return linkFn || angular.noop; + } + }; + }]; + + /** + * Add transformed class selector. + */ + function translateToCssClass(scope, element) { + element.addClass(className); + } + } + + /** + * After link-phase, do NOT remove deprecated layout attribute selector. + * Instead watch the attribute so interpolated data-bindings to layout + * selectors will continue to be supported. + * + * $observe() the className and update with new class (after removing the last one) + * + * e.g. `layout="{{layoutDemo.direction}}"` will update... + * + * NOTE: The value must match one of the specified styles in the CSS. + * For example `flex-gt-md="{{size}}` where `scope.size == 47` will NOT work since + * only breakpoints for 0, 5, 10, 15... 100, 33, 34, 66, 67 are defined. + */ + function updateClassWithValue(element, className) { + var lastClass; + + return function updateClassFn(newValue) { + var value = validateAttributeValue(className, newValue || ""); + if (angular.isDefined(value)) { + if (lastClass) element.removeClass(lastClass); + lastClass = !value ? className : className + "-" + value.trim().replace(WHITESPACE, "-"); + element.addClass(lastClass); + } + }; + } + + /** + * Centralize warnings for known flexbox issues (especially IE-related issues) + */ + function validateAttributeUsage(className, attr, element, $log){ + var message, usage, url; + var nodeName = element[0].nodeName.toLowerCase(); + + switch (className.replace(SUFFIXES,"")) { + case "flex": + if ((nodeName === "md-button") || (nodeName === "fieldset")){ + // @see https://github.com/philipwalton/flexbugs#9-some-html-elements-cant-be-flex-containers + // Use
    wrapper inside (preferred) or outside + + usage = "<" + nodeName + " " + className + ">"; + url = "https://github.com/philipwalton/flexbugs#9-some-html-elements-cant-be-flex-containers"; + message = "Markup '{0}' may not work as expected in IE Browsers. Consult '{1}' for details."; + + $log.warn($mdUtil.supplant(message, [usage, url])); + } + } + } + + + /** + * For the Layout attribute value, validate or replace with default fallback value. + */ + function validateAttributeValue(className, value, updateFn) { + var origValue = value; + + if (!needsInterpolation(value)) { + switch (className.replace(SUFFIXES,"")) { + case 'layout' : + if (!findIn(value, LAYOUT_OPTIONS)) { + value = LAYOUT_OPTIONS[0]; // 'row'; + } + break; + + case 'flex' : + if (!findIn(value, FLEX_OPTIONS)) { + if (isNaN(value)) { + value = ''; + } + } + break; + + case 'flex-offset' : + case 'flex-order' : + if (!value || isNaN(+value)) { + value = '0'; + } + break; + + case 'layout-align' : + var axis = extractAlignAxis(value); + value = $mdUtil.supplant("{main}-{cross}",axis); + break; + + case 'layout-padding' : + case 'layout-margin' : + case 'layout-fill' : + case 'layout-wrap' : + case 'layout-nowrap' : + value = ''; + break; + } + + if (value !== origValue) { + (updateFn || angular.noop)(value); + } + } + + return value ? value.trim() : ""; + } + + /** + * Replace current attribute value with fallback value + */ + function buildUpdateFn(element, className, attrs) { + return function updateAttrValue(fallback) { + if (!needsInterpolation(fallback)) { + // Do not modify the element's attribute value; so + // uses '' will not + // be affected. Just update the attrs value. + attrs[attrs.$normalize(className)] = fallback; + } + }; + } + + /** + * See if the original value has interpolation symbols: + * e.g. flex-gt-md="{{triggerPoint}}" + */ + function needsInterpolation(value) { + return (value || "").indexOf($interpolate.startSymbol()) > -1; + } + + function getNormalizedAttrValue(className, attrs, defaultVal) { + var normalizedAttr = attrs.$normalize(className); + return attrs[normalizedAttr] ? attrs[normalizedAttr].trim().replace(WHITESPACE, "-") : + defaultVal || null; + } + + function findIn(item, list, replaceWith) { + item = replaceWith && item ? item.replace(WHITESPACE, replaceWith) : item; + + var found = false; + if (item) { + list.forEach(function(it) { + it = replaceWith ? it.replace(WHITESPACE, replaceWith) : it; + found = found || (it === item); + }); + } + return found; + } + + function extractAlignAxis(attrValue) { + var axis = { + main : "start", + cross: "stretch" + }, values; + + attrValue = (attrValue || ""); + + if (attrValue.indexOf("-") === 0 || attrValue.indexOf(" ") === 0) { + // For missing main-axis values + attrValue = "none" + attrValue; + } + + values = attrValue.toLowerCase().trim().replace(WHITESPACE, "-").split("-"); + if (values.length && (values[0] === "space")) { + // for main-axis values of "space-around" or "space-between" + values = [values[0]+"-"+values[1],values[2]]; + } + + if (values.length > 0) axis.main = values[0] || axis.main; + if (values.length > 1) axis.cross = values[1] || axis.cross; + + if (ALIGNMENT_MAIN_AXIS.indexOf(axis.main) < 0) axis.main = "start"; + if (ALIGNMENT_CROSS_AXIS.indexOf(axis.cross) < 0) axis.cross = "stretch"; + + return axis; + } +})(); + +})(); +(function(){ +"use strict"; + +/** + * @ngdoc module + * @name material.core.liveannouncer + * @description + * AngularJS Material Live Announcer to provide accessibility for Voice Readers. + */ +MdLiveAnnouncer.$inject = ["$timeout"]; +angular + .module('material.core') + .service('$mdLiveAnnouncer', MdLiveAnnouncer); + +/** + * @ngdoc service + * @name $mdLiveAnnouncer + * @module material.core.liveannouncer + * + * @description + * + * Service to announce messages to supported screenreaders. + * + * > The `$mdLiveAnnouncer` service is internally used for components to provide proper accessibility. + * + * + * module.controller('AppCtrl', function($mdLiveAnnouncer) { + * // Basic announcement (Polite Mode) + * $mdLiveAnnouncer.announce('Hey Google'); + * + * // Custom announcement (Assertive Mode) + * $mdLiveAnnouncer.announce('Hey Google', 'assertive'); + * }); + * + * + */ +function MdLiveAnnouncer($timeout) { + /** @private @const @type {!angular.$timeout} */ + this._$timeout = $timeout; + + /** @private @const @type {!HTMLElement} */ + this._liveElement = this._createLiveElement(); + + /** @private @const @type {!number} */ + this._announceTimeout = 100; +} + +/** + * @ngdoc method + * @name $mdLiveAnnouncer#announce + * @description Announces messages to supported screenreaders. + * @param {string} message Message to be announced to the screenreader + * @param {'off'|'polite'|'assertive'} politeness The politeness of the announcer element. + */ +MdLiveAnnouncer.prototype.announce = function(message, politeness) { + if (!politeness) { + politeness = 'polite'; + } + + var self = this; + + self._liveElement.textContent = ''; + self._liveElement.setAttribute('aria-live', politeness); + + // This 100ms timeout is necessary for some browser + screen-reader combinations: + // - Both JAWS and NVDA over IE11 will not announce anything without a non-zero timeout. + // - With Chrome and IE11 with NVDA or JAWS, a repeated (identical) message won't be read a + // second time without clearing and then using a non-zero delay. + // (using JAWS 17 at time of this writing). + self._$timeout(function() { + self._liveElement.textContent = message; + }, self._announceTimeout, false); +}; + +/** + * Creates a live announcer element, which listens for DOM changes and announces them + * to the screenreaders. + * @returns {!HTMLElement} + * @private + */ +MdLiveAnnouncer.prototype._createLiveElement = function() { + var liveEl = document.createElement('div'); + + liveEl.classList.add('md-visually-hidden'); + liveEl.setAttribute('role', 'status'); + liveEl.setAttribute('aria-atomic', 'true'); + liveEl.setAttribute('aria-live', 'polite'); + + document.body.appendChild(liveEl); + + return liveEl; +}; + +})(); +(function(){ +"use strict"; + +/** + * @ngdoc service + * @name $$mdMeta + * @module material.core.meta + * + * @description + * + * A provider and a service that simplifies meta tags access + * + * Note: This is intended only for use with dynamic meta tags such as browser color and title. + * Tags that are only processed when the page is rendered (such as `charset`, and `http-equiv`) + * will not work since `$$mdMeta` adds the tags after the page has already been loaded. + * + * ```js + * app.config(function($$mdMetaProvider) { + * var removeMeta = $$mdMetaProvider.setMeta('meta-name', 'content'); + * var metaValue = $$mdMetaProvider.getMeta('meta-name'); // -> 'content' + * + * removeMeta(); + * }); + * + * app.controller('myController', function($$mdMeta) { + * var removeMeta = $$mdMeta.setMeta('meta-name', 'content'); + * var metaValue = $$mdMeta.getMeta('meta-name'); // -> 'content' + * + * removeMeta(); + * }); + * ``` + * + * @returns {$$mdMeta.$service} + * + */ +angular.module('material.core.meta', []) + .provider('$$mdMeta', function () { + var head = angular.element(document.head); + var metaElements = {}; + + /** + * Checks if the requested element was written manually and maps it + * + * @param {string} name meta tag 'name' attribute value + * @returns {boolean} returns true if there is an element with the requested name + */ + function mapExistingElement(name) { + if (metaElements[name]) { + return true; + } + + var element = document.getElementsByName(name)[0]; + + if (!element) { + return false; + } + + metaElements[name] = angular.element(element); + + return true; + } + + /** + * @ngdoc method + * @name $$mdMeta#setMeta + * + * @description + * Creates meta element with the 'name' and 'content' attributes, + * if the meta tag is already created than we replace the 'content' value + * + * @param {string} name meta tag 'name' attribute value + * @param {string} content meta tag 'content' attribute value + * @returns {function} remove function + * + */ + function setMeta(name, content) { + mapExistingElement(name); + + if (!metaElements[name]) { + var newMeta = angular.element(''); + head.append(newMeta); + metaElements[name] = newMeta; + } + else { + metaElements[name].attr('content', content); + } + + return function () { + metaElements[name].attr('content', ''); + metaElements[name].remove(); + delete metaElements[name]; + }; + } + + /** + * @ngdoc method + * @name $$mdMeta#getMeta + * + * @description + * Gets the 'content' attribute value of the wanted meta element + * + * @param {string} name meta tag 'name' attribute value + * @returns {string} content attribute value + */ + function getMeta(name) { + if (!mapExistingElement(name)) { + throw Error('$$mdMeta: could not find a meta tag with the name \'' + name + '\''); + } + + return metaElements[name].attr('content'); + } + + var module = { + setMeta: setMeta, + getMeta: getMeta + }; + + return angular.extend({}, module, { + $get: function () { + return module; + } + }); + }); +})(); +(function(){ +"use strict"; + + /** + * @ngdoc module + * @name material.core.componentRegistry + * + * @description + * A component instance registration service. + * Note: currently this as a private service in the SideNav component. + */ + ComponentRegistry.$inject = ["$log", "$q"]; + angular.module('material.core') + .factory('$mdComponentRegistry', ComponentRegistry); + + /* + * @private + * @ngdoc factory + * @name ComponentRegistry + * @module material.core.componentRegistry + * + */ + function ComponentRegistry($log, $q) { + + var self; + var instances = []; + var pendings = { }; + + return self = { + /** + * Used to print an error when an instance for a handle isn't found. + */ + notFoundError: function(handle, msgContext) { + $log.error((msgContext || "") + 'No instance found for handle', handle); + }, + /** + * Return all registered instances as an array. + */ + getInstances: function() { + return instances; + }, + + /** + * Get a registered instance. + * @param handle the String handle to look up for a registered instance. + */ + get: function(handle) { + if (!isValidID(handle)) return null; + + var i, j, instance; + for (i = 0, j = instances.length; i < j; i++) { + instance = instances[i]; + if (instance.$$mdHandle === handle) { + return instance; + } + } + return null; + }, + + /** + * Register an instance. + * @param instance the instance to register + * @param handle the handle to identify the instance under. + */ + register: function(instance, handle) { + if (!handle) return angular.noop; + + instance.$$mdHandle = handle; + instances.push(instance); + resolveWhen(); + + return deregister; + + /** + * Remove registration for an instance + */ + function deregister() { + var index = instances.indexOf(instance); + if (index !== -1) { + instances.splice(index, 1); + } + } + + /** + * Resolve any pending promises for this instance + */ + function resolveWhen() { + var dfd = pendings[handle]; + if (dfd) { + dfd.forEach(function (promise) { + promise.resolve(instance); + }); + delete pendings[handle]; + } + } + }, + + /** + * Async accessor to registered component instance + * If not available then a promise is created to notify + * all listeners when the instance is registered. + */ + when : function(handle) { + if (isValidID(handle)) { + var deferred = $q.defer(); + var instance = self.get(handle); + + if (instance) { + deferred.resolve(instance); + } else { + if (pendings[handle] === undefined) { + pendings[handle] = []; + } + pendings[handle].push(deferred); + } + + return deferred.promise; + } + return $q.reject("Invalid `md-component-id` value."); + } + + }; + + function isValidID(handle){ + return handle && (handle !== ""); + } + + } + +})(); +(function(){ +"use strict"; + +(function() { + 'use strict'; + + /** + * @ngdoc service + * @name $mdButtonInkRipple + * @module material.core + * + * @description + * Provides ripple effects for md-button. See $mdInkRipple service for all possible configuration options. + * + * @param {object=} scope Scope within the current context + * @param {object=} element The element the ripple effect should be applied to + * @param {object=} options (Optional) Configuration options to override the default ripple configuration + */ + + MdButtonInkRipple.$inject = ["$mdInkRipple"]; + angular.module('material.core') + .factory('$mdButtonInkRipple', MdButtonInkRipple); + + function MdButtonInkRipple($mdInkRipple) { + return { + attach: function attachRipple(scope, element, options) { + options = angular.extend(optionsForElement(element), options); + + return $mdInkRipple.attach(scope, element, options); + } + }; + + function optionsForElement(element) { + if (element.hasClass('md-icon-button')) { + return { + isMenuItem: element.hasClass('md-menu-item'), + fitRipple: true, + center: true + }; + } else { + return { + isMenuItem: element.hasClass('md-menu-item'), + dimBackground: true + }; + } + } + } +})(); + +})(); +(function(){ +"use strict"; + +(function() { + 'use strict'; + + /** + * @ngdoc service + * @name $mdCheckboxInkRipple + * @module material.core + * + * @description + * Provides ripple effects for md-checkbox. See $mdInkRipple service for all possible configuration options. + * + * @param {object=} scope Scope within the current context + * @param {object=} element The element the ripple effect should be applied to + * @param {object=} options (Optional) Configuration options to override the defaultripple configuration + */ + + MdCheckboxInkRipple.$inject = ["$mdInkRipple"]; + angular.module('material.core') + .factory('$mdCheckboxInkRipple', MdCheckboxInkRipple); + + function MdCheckboxInkRipple($mdInkRipple) { + return { + attach: attach + }; + + function attach(scope, element, options) { + return $mdInkRipple.attach(scope, element, angular.extend({ + center: true, + dimBackground: false, + fitRipple: true + }, options)); + } + } +})(); + +})(); +(function(){ +"use strict"; + +(function() { + 'use strict'; + + /** + * @ngdoc service + * @name $mdListInkRipple + * @module material.core + * + * @description + * Provides ripple effects for md-list. See $mdInkRipple service for all possible configuration options. + * + * @param {object=} scope Scope within the current context + * @param {object=} element The element the ripple effect should be applied to + * @param {object=} options (Optional) Configuration options to override the defaultripple configuration + */ + + MdListInkRipple.$inject = ["$mdInkRipple"]; + angular.module('material.core') + .factory('$mdListInkRipple', MdListInkRipple); + + function MdListInkRipple($mdInkRipple) { + return { + attach: attach + }; + + function attach(scope, element, options) { + return $mdInkRipple.attach(scope, element, angular.extend({ + center: false, + dimBackground: true, + outline: false, + rippleSize: 'full' + }, options)); + } + } +})(); + +})(); +(function(){ +"use strict"; + +/** + * @ngdoc module + * @name material.core.ripple + * @description + * Ripple + */ +InkRippleCtrl.$inject = ["$scope", "$element", "rippleOptions", "$window", "$timeout", "$mdUtil", "$mdColorUtil"]; +InkRippleDirective.$inject = ["$mdButtonInkRipple", "$mdCheckboxInkRipple"]; +angular.module('material.core') + .provider('$mdInkRipple', InkRippleProvider) + .directive('mdInkRipple', InkRippleDirective) + .directive('mdNoInk', attrNoDirective) + .directive('mdNoBar', attrNoDirective) + .directive('mdNoStretch', attrNoDirective); + +var DURATION = 450; + +/** + * @ngdoc directive + * @name mdInkRipple + * @module material.core.ripple + * + * @description + * The `md-ink-ripple` directive allows you to specify the ripple color or if a ripple is allowed. + * + * @param {string|boolean} md-ink-ripple A color string `#FF0000` or boolean (`false` or `0`) for + * preventing ripple + * + * @usage + * ### String values + * + * + * Ripples in red + * + * + * + * Not rippling + * + * + * + * ### Interpolated values + * + * + * Ripples with the return value of 'randomColor' function + * + * + * + * Ripples if 'canRipple' function return value is not 'false' or '0' + * + * + */ +function InkRippleDirective ($mdButtonInkRipple, $mdCheckboxInkRipple) { + return { + controller: angular.noop, + link: function (scope, element, attr) { + attr.hasOwnProperty('mdInkRippleCheckbox') + ? $mdCheckboxInkRipple.attach(scope, element) + : $mdButtonInkRipple.attach(scope, element); + } + }; +} + +/** + * @ngdoc service + * @name $mdInkRipple + * @module material.core.ripple + * + * @description + * `$mdInkRipple` is a service for adding ripples to any element. + * + * @usage + * + * app.factory('$myElementInkRipple', function($mdInkRipple) { + * return { + * attach: function (scope, element, options) { + * return $mdInkRipple.attach(scope, element, angular.extend({ + * center: false, + * dimBackground: true + * }, options)); + * } + * }; + * }); + * + * app.controller('myController', function ($scope, $element, $myElementInkRipple) { + * $scope.onClick = function (ev) { + * $myElementInkRipple.attach($scope, angular.element(ev.target), { center: true }); + * } + * }); + * + */ + +/** + * @ngdoc service + * @name $mdInkRippleProvider + * @module material.core.ripple + * + * @description + * If you want to disable ink ripples globally, for all components, you can call the + * `disableInkRipple` method in your app's config. + * + * + * @usage + * + * app.config(function ($mdInkRippleProvider) { + * $mdInkRippleProvider.disableInkRipple(); + * }); + * + */ + +function InkRippleProvider () { + var isDisabledGlobally = false; + + return { + disableInkRipple: disableInkRipple, + $get: ["$injector", function($injector) { + return { attach: attach }; + + /** + * @ngdoc method + * @name $mdInkRipple#attach + * + * @description + * Attaching given scope, element and options to inkRipple controller + * + * @param {object=} scope Scope within the current context + * @param {object=} element The element the ripple effect should be applied to + * @param {object=} options (Optional) Configuration options to override the defaultRipple configuration + * * `center` - Whether the ripple should start from the center of the container element + * * `dimBackground` - Whether the background should be dimmed with the ripple color + * * `colorElement` - The element the ripple should take its color from, defined by css property `color` + * * `fitRipple` - Whether the ripple should fill the element + */ + function attach (scope, element, options) { + if (isDisabledGlobally || element.controller('mdNoInk')) return angular.noop; + return $injector.instantiate(InkRippleCtrl, { + $scope: scope, + $element: element, + rippleOptions: options + }); + } + }] + }; + + /** + * @ngdoc method + * @name $mdInkRippleProvider#disableInkRipple + * + * @description + * A config-time method that, when called, disables ripples globally. + */ + function disableInkRipple () { + isDisabledGlobally = true; + } +} + +/** + * Controller used by the ripple service in order to apply ripples + * @ngInject + */ +function InkRippleCtrl ($scope, $element, rippleOptions, $window, $timeout, $mdUtil, $mdColorUtil) { + this.$window = $window; + this.$timeout = $timeout; + this.$mdUtil = $mdUtil; + this.$mdColorUtil = $mdColorUtil; + this.$scope = $scope; + this.$element = $element; + this.options = rippleOptions; + this.mousedown = false; + this.ripples = []; + this.timeout = null; // Stores a reference to the most-recent ripple timeout + this.lastRipple = null; + + $mdUtil.valueOnUse(this, 'container', this.createContainer); + + this.$element.addClass('md-ink-ripple'); + + // attach method for unit tests + ($element.controller('mdInkRipple') || {}).createRipple = angular.bind(this, this.createRipple); + ($element.controller('mdInkRipple') || {}).setColor = angular.bind(this, this.color); + + this.bindEvents(); +} + + +/** + * Either remove or unlock any remaining ripples when the user mouses off of the element (either by + * mouseup or mouseleave event) + */ +function autoCleanup (self, cleanupFn) { + if (self.mousedown || self.lastRipple) { + self.mousedown = false; + self.$mdUtil.nextTick(angular.bind(self, cleanupFn), false); + } +} + + +/** + * Returns the color that the ripple should be (either based on CSS or hard-coded) + * @returns {string} + */ +InkRippleCtrl.prototype.color = function (value) { + var self = this; + + // If assigning a color value, apply it to background and the ripple color + if (angular.isDefined(value)) { + self._color = self._parseColor(value); + } + + // If color lookup, use assigned, defined, or inherited + return self._color || self._parseColor(self.inkRipple()) || self._parseColor(getElementColor()); + + /** + * Finds the color element and returns its text color for use as default ripple color + * @returns {string} + */ + function getElementColor () { + var items = self.options && self.options.colorElement ? self.options.colorElement : []; + var elem = items.length ? items[ 0 ] : self.$element[ 0 ]; + + return elem ? self.$window.getComputedStyle(elem).color : 'rgb(0,0,0)'; + } +}; + +/** + * Updating the ripple colors based on the current inkRipple value + * or the element's computed style color + */ +InkRippleCtrl.prototype.calculateColor = function () { + return this.color(); +}; + + +/** + * Takes a string color and converts it to RGBA format + * @param {string} color + * @param {number} multiplier + * @returns {string} + */ +InkRippleCtrl.prototype._parseColor = function parseColor (color, multiplier) { + multiplier = multiplier || 1; + var colorUtil = this.$mdColorUtil; + + if (!color) return; + if (color.indexOf('rgba') === 0) return color.replace(/\d?\.?\d*\s*\)\s*$/, (0.1 * multiplier).toString() + ')'); + if (color.indexOf('rgb') === 0) return colorUtil.rgbToRgba(color); + if (color.indexOf('#') === 0) return colorUtil.hexToRgba(color); + +}; + +/** + * Binds events to the root element for + */ +InkRippleCtrl.prototype.bindEvents = function () { + this.$element.on('mousedown', angular.bind(this, this.handleMousedown)); + this.$element.on('mouseup touchend', angular.bind(this, this.handleMouseup)); + this.$element.on('mouseleave', angular.bind(this, this.handleMouseup)); + this.$element.on('touchmove', angular.bind(this, this.handleTouchmove)); +}; + +/** + * Create a new ripple on every mousedown event from the root element + * @param event {MouseEvent} + */ +InkRippleCtrl.prototype.handleMousedown = function (event) { + if (this.mousedown) return; + + // When jQuery is loaded, we have to get the original event + if (event.hasOwnProperty('originalEvent')) event = event.originalEvent; + this.mousedown = true; + if (this.options.center) { + this.createRipple(this.container.prop('clientWidth') / 2, this.container.prop('clientWidth') / 2); + } else { + + // We need to calculate the relative coordinates if the target is a sublayer of the ripple element + if (event.srcElement !== this.$element[0]) { + var layerRect = this.$element[0].getBoundingClientRect(); + var layerX = event.clientX - layerRect.left; + var layerY = event.clientY - layerRect.top; + + this.createRipple(layerX, layerY); + } else { + this.createRipple(event.offsetX, event.offsetY); + } + } +}; + +/** + * Either remove or unlock any remaining ripples when the user mouses off of the element (either by + * mouseup, touchend or mouseleave event) + */ +InkRippleCtrl.prototype.handleMouseup = function () { + this.$timeout(function () { + autoCleanup(this, this.clearRipples); + }.bind(this)); +}; + +/** + * Either remove or unlock any remaining ripples when the user mouses off of the element (by + * touchmove) + */ +InkRippleCtrl.prototype.handleTouchmove = function () { + autoCleanup(this, this.deleteRipples); +}; + +/** + * Cycles through all ripples and attempts to remove them. + */ +InkRippleCtrl.prototype.deleteRipples = function () { + for (var i = 0; i < this.ripples.length; i++) { + this.ripples[ i ].remove(); + } +}; + +/** + * Cycles through all ripples and attempts to remove them with fade. + * Depending on logic within `fadeInComplete`, some removals will be postponed. + */ +InkRippleCtrl.prototype.clearRipples = function () { + for (var i = 0; i < this.ripples.length; i++) { + this.fadeInComplete(this.ripples[ i ]); + } +}; + +/** + * Creates the ripple container element + * @returns {*} + */ +InkRippleCtrl.prototype.createContainer = function () { + var container = angular.element('
    '); + this.$element.append(container); + return container; +}; + +InkRippleCtrl.prototype.clearTimeout = function () { + if (this.timeout) { + this.$timeout.cancel(this.timeout); + this.timeout = null; + } +}; + +InkRippleCtrl.prototype.isRippleAllowed = function () { + var element = this.$element[0]; + do { + if (!element.tagName || element.tagName === 'BODY') break; + + if (element && angular.isFunction(element.hasAttribute)) { + if (element.hasAttribute('disabled')) return false; + if (this.inkRipple() === 'false' || this.inkRipple() === '0') return false; + } + + } while (element = element.parentNode); + return true; +}; + +/** + * The attribute `md-ink-ripple` may be a static or interpolated + * color value OR a boolean indicator (used to disable ripples) + */ +InkRippleCtrl.prototype.inkRipple = function () { + return this.$element.attr('md-ink-ripple'); +}; + +/** + * Creates a new ripple and adds it to the container. Also tracks ripple in `this.ripples`. + * @param left + * @param top + */ +InkRippleCtrl.prototype.createRipple = function (left, top) { + if (!this.isRippleAllowed()) return; + + var ctrl = this; + var colorUtil = ctrl.$mdColorUtil; + var ripple = angular.element('
    '); + var width = this.$element.prop('clientWidth'); + var height = this.$element.prop('clientHeight'); + var x = Math.max(Math.abs(width - left), left) * 2; + var y = Math.max(Math.abs(height - top), top) * 2; + var size = getSize(this.options.fitRipple, x, y); + var color = this.calculateColor(); + + ripple.css({ + left: left + 'px', + top: top + 'px', + background: 'black', + width: size + 'px', + height: size + 'px', + backgroundColor: colorUtil.rgbaToRgb(color), + borderColor: colorUtil.rgbaToRgb(color) + }); + this.lastRipple = ripple; + + // we only want one timeout to be running at a time + this.clearTimeout(); + this.timeout = this.$timeout(function () { + ctrl.clearTimeout(); + if (!ctrl.mousedown) ctrl.fadeInComplete(ripple); + }, DURATION * 0.35, false); + + if (this.options.dimBackground) this.container.css({ backgroundColor: color }); + this.container.append(ripple); + this.ripples.push(ripple); + ripple.addClass('md-ripple-placed'); + + this.$mdUtil.nextTick(function () { + + ripple.addClass('md-ripple-scaled md-ripple-active'); + ctrl.$timeout(function () { + ctrl.clearRipples(); + }, DURATION, false); + + }, false); + + function getSize (fit, x, y) { + return fit + ? Math.max(x, y) + : Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2)); + } +}; + + + +/** + * After fadeIn finishes, either kicks off the fade-out animation or queues the element for removal on mouseup + * @param ripple + */ +InkRippleCtrl.prototype.fadeInComplete = function (ripple) { + if (this.lastRipple === ripple) { + if (!this.timeout && !this.mousedown) { + this.removeRipple(ripple); + } + } else { + this.removeRipple(ripple); + } +}; + +/** + * Kicks off the animation for removing a ripple + * @param ripple {Element} + */ +InkRippleCtrl.prototype.removeRipple = function (ripple) { + var ctrl = this; + var index = this.ripples.indexOf(ripple); + if (index < 0) return; + this.ripples.splice(this.ripples.indexOf(ripple), 1); + ripple.removeClass('md-ripple-active'); + ripple.addClass('md-ripple-remove'); + if (this.ripples.length === 0) this.container.css({ backgroundColor: '' }); + // use a 2-second timeout in order to allow for the animation to finish + // we don't actually care how long the animation takes + this.$timeout(function () { + ctrl.fadeOutComplete(ripple); + }, DURATION, false); +}; + +/** + * Removes the provided ripple from the DOM + * @param ripple + */ +InkRippleCtrl.prototype.fadeOutComplete = function (ripple) { + ripple.remove(); + this.lastRipple = null; +}; + +/** + * Used to create an empty directive. This is used to track flag-directives whose children may have + * functionality based on them. + * + * Example: `md-no-ink` will potentially be used by all child directives. + */ +function attrNoDirective () { + return { controller: angular.noop }; +} + +})(); +(function(){ +"use strict"; + +(function() { + 'use strict'; + + /** + * @ngdoc service + * @name $mdTabInkRipple + * @module material.core + * + * @description + * Provides ripple effects for md-tabs. See $mdInkRipple service for all possible configuration options. + * + * @param {object=} scope Scope within the current context + * @param {object=} element The element the ripple effect should be applied to + * @param {object=} options (Optional) Configuration options to override the defaultripple configuration + */ + + MdTabInkRipple.$inject = ["$mdInkRipple"]; + angular.module('material.core') + .factory('$mdTabInkRipple', MdTabInkRipple); + + function MdTabInkRipple($mdInkRipple) { + return { + attach: attach + }; + + function attach(scope, element, options) { + return $mdInkRipple.attach(scope, element, angular.extend({ + center: false, + dimBackground: true, + outline: false, + rippleSize: 'full' + }, options)); + } + } +})(); + +})(); +(function(){ +"use strict"; + +angular.module('material.core.theming.palette', []) +.constant('$mdColorPalette', { + 'red': { + '50': '#ffebee', + '100': '#ffcdd2', + '200': '#ef9a9a', + '300': '#e57373', + '400': '#ef5350', + '500': '#f44336', + '600': '#e53935', + '700': '#d32f2f', + '800': '#c62828', + '900': '#b71c1c', + 'A100': '#ff8a80', + 'A200': '#ff5252', + 'A400': '#ff1744', + 'A700': '#d50000', + 'contrastDefaultColor': 'light', + 'contrastDarkColors': '50 100 200 300 400 500 600 A100 A200 A400', + 'contrastStrongLightColors': '700 800 900 A700' + }, + 'pink': { + '50': '#fce4ec', + '100': '#f8bbd0', + '200': '#f48fb1', + '300': '#f06292', + '400': '#ec407a', + '500': '#e91e63', + '600': '#d81b60', + '700': '#c2185b', + '800': '#ad1457', + '900': '#880e4f', + 'A100': '#ff80ab', + 'A200': '#ff4081', + 'A400': '#f50057', + 'A700': '#c51162', + 'contrastDefaultColor': 'light', + 'contrastDarkColors': '50 100 200 300 400 A100 A200 A400', + // White on 500 does not meet the minimum 4.5 contrast ratio (at 4.34), + // but it's worse with a dark foreground (3.61). + 'contrastStrongLightColors': '500 600 700 800 900 A700' + }, + 'purple': { + '50': '#f3e5f5', + '100': '#e1bee7', + '200': '#ce93d8', + '300': '#ba68c8', + '400': '#ab47bc', + '500': '#9c27b0', + '600': '#8e24aa', + '700': '#7b1fa2', + '800': '#6a1b9a', + '900': '#4a148c', + 'A100': '#ea80fc', + 'A200': '#e040fb', + 'A400': '#d500f9', + 'A700': '#aa00ff', + 'contrastDefaultColor': 'light', + 'contrastDarkColors': '50 100 200 300 A100 A200 A400', + 'contrastStrongLightColors': '400 500 600 700 800 900 A700' + }, + 'deep-purple': { + '50': '#ede7f6', + '100': '#d1c4e9', + '200': '#b39ddb', + '300': '#9575cd', + '400': '#7e57c2', + '500': '#673ab7', + '600': '#5e35b1', + '700': '#512da8', + '800': '#4527a0', + '900': '#311b92', + 'A100': '#b388ff', + 'A200': '#7c4dff', + 'A400': '#651fff', + 'A700': '#6200ea', + 'contrastDefaultColor': 'light', + 'contrastDarkColors': '50 100 200 300 A100', + 'contrastStrongLightColors': '400 500 600 700 800 900 A200 A400 A700' + }, + 'indigo': { + '50': '#e8eaf6', + '100': '#c5cae9', + '200': '#9fa8da', + '300': '#7986cb', + '400': '#5c6bc0', + '500': '#3f51b5', + '600': '#3949ab', + '700': '#303f9f', + '800': '#283593', + '900': '#1a237e', + 'A100': '#8c9eff', + 'A200': '#536dfe', + 'A400': '#3d5afe', + 'A700': '#304ffe', + 'contrastDefaultColor': 'light', + 'contrastDarkColors': '50 100 200 300 A100 A200', + 'contrastStrongLightColors': '400 500 600 700 800 900 A400 A700' + }, + 'blue': { + '50': '#e3f2fd', + '100': '#bbdefb', + '200': '#90caf9', + '300': '#64b5f6', + '400': '#42a5f5', + '500': '#2196f3', + '600': '#1e88e5', + '700': '#1976d2', + '800': '#1565c0', + '900': '#0d47a1', + 'A100': '#82b1ff', + 'A200': '#448aff', + 'A400': '#2979ff', + 'A700': '#2962ff', + 'contrastDefaultColor': 'light', + // White on A400 does not meet the minimum 4.5 contrast ratio (at 3.98), + // but it's worse with a dark foreground (3.94). + 'contrastDarkColors': '50 100 200 300 400 500 600 A100 A200', + 'contrastStrongLightColors': '700 800 900 A400 A700' + }, + 'light-blue': { + '50': '#e1f5fe', + '100': '#b3e5fc', + '200': '#81d4fa', + '300': '#4fc3f7', + '400': '#29b6f6', + '500': '#03a9f4', + '600': '#039be5', + '700': '#0288d1', + '800': '#0277bd', + '900': '#01579b', + 'A100': '#80d8ff', + 'A200': '#40c4ff', + 'A400': '#00b0ff', + 'A700': '#0091ea', + 'contrastDefaultColor': 'dark', + // Dark on 700 does not meet the minimum 4.5 contrast ratio (at 4.07), + // but it's worse with a white foreground (3.85). + 'contrastStrongLightColors': '800 900 A700' + }, + 'cyan': { + '50': '#e0f7fa', + '100': '#b2ebf2', + '200': '#80deea', + '300': '#4dd0e1', + '400': '#26c6da', + '500': '#00bcd4', + '600': '#00acc1', + '700': '#0097a7', + '800': '#00838f', + '900': '#006064', + 'A100': '#84ffff', + 'A200': '#18ffff', + 'A400': '#00e5ff', + 'A700': '#00b8d4', + 'contrastDefaultColor': 'dark', + // Dark on 700 does not meet the minimum 4.5 contrast ratio (at 4.47), + // but it's worse with a white foreground (3.5). + 'contrastStrongLightColors': '800 900' + }, + 'teal': { + '50': '#e0f2f1', + '100': '#b2dfdb', + '200': '#80cbc4', + '300': '#4db6ac', + '400': '#26a69a', + '500': '#009688', + '600': '#00897b', + '700': '#00796b', + '800': '#00695c', + '900': '#004d40', + 'A100': '#a7ffeb', + 'A200': '#64ffda', + 'A400': '#1de9b6', + 'A700': '#00bfa5', + 'contrastDefaultColor': 'dark', + // Dark on 500 does not meet the minimum 4.5 contrast ratio (at 4.27), + // but it's worse with a white foreground (3.67). + // White on 600 does not meet the minimum 4.5 contrast ratio (at 4.31), + // but it's worse with a dark foreground (3.64). + 'contrastStrongLightColors': '600 700 800 900' + }, + 'green': { + '50': '#e8f5e9', + '100': '#c8e6c9', + '200': '#a5d6a7', + '300': '#81c784', + '400': '#66bb6a', + '500': '#4caf50', + '600': '#43a047', + '700': '#388e3c', + '800': '#2e7d32', + '900': '#1b5e20', + 'A100': '#b9f6ca', + 'A200': '#69f0ae', + 'A400': '#00e676', + 'A700': '#00c853', + 'contrastDefaultColor': 'dark', + // White on 700 does not meet the minimum 4.5 contrast ratio (at 4.11), + // but it's worse with a dark foreground (3.81). + 'contrastStrongLightColors': '700 800 900' + }, + 'light-green': { + '50': '#f1f8e9', + '100': '#dcedc8', + '200': '#c5e1a5', + '300': '#aed581', + '400': '#9ccc65', + '500': '#8bc34a', + '600': '#7cb342', + '700': '#689f38', + '800': '#558b2f', + '900': '#33691e', + 'A100': '#ccff90', + 'A200': '#b2ff59', + 'A400': '#76ff03', + 'A700': '#64dd17', + 'contrastDefaultColor': 'dark', + 'contrastStrongLightColors': '800 900' + }, + 'lime': { + '50': '#f9fbe7', + '100': '#f0f4c3', + '200': '#e6ee9c', + '300': '#dce775', + '400': '#d4e157', + '500': '#cddc39', + '600': '#c0ca33', + '700': '#afb42b', + '800': '#9e9d24', + '900': '#827717', + 'A100': '#f4ff81', + 'A200': '#eeff41', + 'A400': '#c6ff00', + 'A700': '#aeea00', + 'contrastDefaultColor': 'dark', + 'contrastStrongLightColors': '900' + }, + 'yellow': { + '50': '#fffde7', + '100': '#fff9c4', + '200': '#fff59d', + '300': '#fff176', + '400': '#ffee58', + '500': '#ffeb3b', + '600': '#fdd835', + '700': '#fbc02d', + '800': '#f9a825', + '900': '#f57f17', + 'A100': '#ffff8d', + 'A200': '#ffff00', + 'A400': '#ffea00', + 'A700': '#ffd600', + 'contrastDefaultColor': 'dark' + }, + 'amber': { + '50': '#fff8e1', + '100': '#ffecb3', + '200': '#ffe082', + '300': '#ffd54f', + '400': '#ffca28', + '500': '#ffc107', + '600': '#ffb300', + '700': '#ffa000', + '800': '#ff8f00', + '900': '#ff6f00', + 'A100': '#ffe57f', + 'A200': '#ffd740', + 'A400': '#ffc400', + 'A700': '#ffab00', + 'contrastDefaultColor': 'dark' + }, + 'orange': { + '50': '#fff3e0', + '100': '#ffe0b2', + '200': '#ffcc80', + '300': '#ffb74d', + '400': '#ffa726', + '500': '#ff9800', + '600': '#fb8c00', + '700': '#f57c00', + '800': '#ef6c00', + '900': '#e65100', + 'A100': '#ffd180', + 'A200': '#ffab40', + 'A400': '#ff9100', + 'A700': '#ff6d00', + 'contrastDefaultColor': 'dark', + 'contrastStrongLightColors': '900' + }, + 'deep-orange': { + '50': '#fbe9e7', + '100': '#ffccbc', + '200': '#ffab91', + '300': '#ff8a65', + '400': '#ff7043', + '500': '#ff5722', + '600': '#f4511e', + '700': '#e64a19', + '800': '#d84315', + '900': '#bf360c', + 'A100': '#ff9e80', + 'A200': '#ff6e40', + 'A400': '#ff3d00', + 'A700': '#dd2c00', + 'contrastDefaultColor': 'dark', + // Dark on 700 does not meet the minimum 4.5 contrast ratio (at 4.01), + // but it's worse with a white foreground (3.91). + // White on 800 does not meet the minimum 4.5 contrast ratio (at 4.43), + // but it's worse with a dark foreground (3.54). + 'contrastStrongLightColors': '800 900 A400 A700', + }, + 'brown': { + '50': '#efebe9', + '100': '#d7ccc8', + '200': '#bcaaa4', + '300': '#a1887f', + '400': '#8d6e63', + '500': '#795548', + '600': '#6d4c41', + '700': '#5d4037', + '800': '#4e342e', + '900': '#3e2723', + 'A100': '#d7ccc8', + 'A200': '#bcaaa4', + 'A400': '#8d6e63', + 'A700': '#5d4037', + 'contrastDefaultColor': 'light', + 'contrastDarkColors': '50 100 200 300 A100 A200', + 'contrastStrongLightColors': '400 500 600 700 800 900 A400 A700' + }, + 'grey': { + '50': '#fafafa', + '100': '#f5f5f5', + '200': '#eeeeee', + '300': '#e0e0e0', + '400': '#bdbdbd', + '500': '#9e9e9e', + '600': '#757575', + '700': '#616161', + '800': '#424242', + '900': '#212121', + 'A100': '#ffffff', + 'A200': '#000000', + 'A400': '#303030', + 'A700': '#616161', + 'contrastDefaultColor': 'dark', + 'contrastLightColors': '700 800 900 A200 A400 A700', + 'contrastStrongLightColors': '600' + }, + 'blue-grey': { + '50': '#eceff1', + '100': '#cfd8dc', + '200': '#b0bec5', + '300': '#90a4ae', + '400': '#78909c', + '500': '#607d8b', + '600': '#546e7a', + '700': '#455a64', + '800': '#37474f', + '900': '#263238', + 'A100': '#cfd8dc', + 'A200': '#b0bec5', + 'A400': '#78909c', + 'A700': '#455a64', + 'contrastDefaultColor': 'light', + 'contrastDarkColors': '50 100 200 300 400 A100 A200 A400', + // White on 500 does not meet the minimum 4.5 contrast ratio (at 4.37), + // but it's worse with a dark foreground. + 'contrastStrongLightColors': '500 600 700 800 900 A700' + } +}); + +})(); +(function(){ +"use strict"; + +(function(angular) { + 'use strict'; +/** + * @ngdoc module + * @name material.core.theming + * @description + * Theming + */ +detectDisabledThemes.$inject = ["$mdThemingProvider"]; +ThemingDirective.$inject = ["$mdTheming", "$interpolate", "$parse", "$mdUtil", "$q", "$log"]; +ThemableDirective.$inject = ["$mdTheming"]; +ThemingProvider.$inject = ["$mdColorPalette", "$$mdMetaProvider"]; +generateAllThemes.$inject = ["$injector", "$mdTheming"]; +angular.module('material.core.theming', ['material.core.theming.palette', 'material.core.meta']) + .directive('mdTheme', ThemingDirective) + .directive('mdThemable', ThemableDirective) + .directive('mdThemesDisabled', disableThemesDirective) + .provider('$mdTheming', ThemingProvider) + .config(detectDisabledThemes) + .run(generateAllThemes); + +/** + * Detect if the HTML or the BODY tags has a [md-themes-disabled] attribute + * If yes, then immediately disable all theme stylesheet generation and DOM injection + */ +/** + * @ngInject + */ +function detectDisabledThemes($mdThemingProvider) { + var isDisabled = !!document.querySelector('[md-themes-disabled]'); + $mdThemingProvider.disableTheming(isDisabled); +} + +/** + * @ngdoc service + * @name $mdThemingProvider + * @module material.core.theming + * + * @description Provider to configure the `$mdTheming` service. + * + * ### Default Theme + * The `$mdThemingProvider` uses by default the following theme configuration: + * + * - Primary Palette: `Blue` + * - Accent Palette: `Pink` + * - Warn Palette: `Deep-Orange` + * - Background Palette: `Grey` + * + * If you don't want to use the `md-theme` directive on the elements itself, you may want to overwrite + * the default theme.
    + * This can be done by using the following markup. + * + * + * myAppModule.config(function($mdThemingProvider) { + * $mdThemingProvider + * .theme('default') + * .primaryPalette('blue') + * .accentPalette('teal') + * .warnPalette('red') + * .backgroundPalette('grey'); + * }); + * + * + + * ### Dynamic Themes + * + * By default, if you change a theme at runtime, the `$mdTheming` service will not detect those changes.
    + * If you have an application, which changes its theme on runtime, you have to enable theme watching. + * + * + * myAppModule.config(function($mdThemingProvider) { + * // Enable theme watching. + * $mdThemingProvider.alwaysWatchTheme(true); + * }); + * + * + * ### Custom Theme Styles + * + * Sometimes you may want to use your own theme styles for some custom components.
    + * You are able to register your own styles by using the following markup. + * + * + * myAppModule.config(function($mdThemingProvider) { + * // Register our custom stylesheet into the theming provider. + * $mdThemingProvider.registerStyles(STYLESHEET); + * }); + * + * + * The `registerStyles` method only accepts strings as value, so you're actually not able to load an external + * stylesheet file into the `$mdThemingProvider`. + * + * If it's necessary to load an external stylesheet, we suggest using a bundler, which supports including raw content, + * like [raw-loader](https://github.com/webpack/raw-loader) for `webpack`. + * + * + * myAppModule.config(function($mdThemingProvider) { + * // Register your custom stylesheet into the theming provider. + * $mdThemingProvider.registerStyles(require('../styles/my-component.theme.css')); + * }); + * + * + * ### Browser color + * + * Enables browser header coloring + * for more info please visit: + * https://developers.google.com/web/fundamentals/design-and-ui/browser-customization/theme-color + * + * Options parameter:
    + * `theme` - A defined theme via `$mdThemeProvider` to use the palettes from. Default is `default` theme.
    + * `palette` - Can be any one of the basic material design palettes, extended defined palettes and 'primary', + * 'accent', 'background' and 'warn'. Default is `primary`.
    + * `hue` - The hue from the selected palette. Default is `800`
    + * + * + * myAppModule.config(function($mdThemingProvider) { + * // Enable browser color + * $mdThemingProvider.enableBrowserColor({ + * theme: 'myTheme', // Default is 'default' + * palette: 'accent', // Default is 'primary', any basic material palette and extended palettes are available + * hue: '200' // Default is '800' + * }); + * }); + * + */ + +/** + * Some Example Valid Theming Expressions + * ======================================= + * + * Intention group expansion: (valid for primary, accent, warn, background) + * + * {{primary-100}} - grab shade 100 from the primary palette + * {{primary-100-0.7}} - grab shade 100, apply opacity of 0.7 + * {{primary-100-contrast}} - grab shade 100's contrast color + * {{primary-hue-1}} - grab the shade assigned to hue-1 from the primary palette + * {{primary-hue-1-0.7}} - apply 0.7 opacity to primary-hue-1 + * {{primary-color}} - Generates .md-hue-1, .md-hue-2, .md-hue-3 with configured shades set for each hue + * {{primary-color-0.7}} - Apply 0.7 opacity to each of the above rules + * {{primary-contrast}} - Generates .md-hue-1, .md-hue-2, .md-hue-3 with configured contrast (ie. text) color shades set for each hue + * {{primary-contrast-0.7}} - Apply 0.7 opacity to each of the above rules + * {{primary-contrast-divider}} - Apply divider opacity to contrast color + * + * Foreground expansion: Applies rgba to black/white foreground text + * + * Old Foreground Expressions: + * {{foreground-1}} - used for primary text + * {{foreground-2}} - used for secondary text/divider + * {{foreground-3}} - used for disabled text + * {{foreground-4}} - used for dividers + * + * New Foreground Expressions: + * + * Apply primary text color for contrasting with default background + * {{background-default-contrast}} - default opacity + * {{background-default-contrast-secondary}} - opacity for secondary text + * {{background-default-contrast-hint}} - opacity for hints and placeholders + * {{background-default-contrast-disabled}} - opacity for disabled text + * {{background-default-contrast-divider}} - opacity for dividers + * + * Apply contrast color for specific shades + * {{background-50-contrast-icon}} - Apply contrast color for icon on background's shade 50 hue + */ + +// In memory generated CSS rules; registered by theme.name +var GENERATED = { }; + +// In memory storage of defined themes and color palettes (both loaded by CSS, and user specified) +var PALETTES; + +// Text colors are automatically generated based on background color when not specified +// Custom palettes can provide override colors +// @see https://material.io/archive/guidelines/style/color.html#color-usability +var DARK_FOREGROUND = { + name: 'dark', +}; +var LIGHT_FOREGROUND = { + name: 'light', +}; + +var DARK_SHADOW = '1px 1px 0px rgba(0,0,0,0.4), -1px -1px 0px rgba(0,0,0,0.4)'; +var LIGHT_SHADOW = ''; + +var DARK_CONTRAST_COLOR = colorToRgbaArray('rgba(0,0,0,0.87)'); +var LIGHT_CONTRAST_COLOR = colorToRgbaArray('rgba(255,255,255,0.87)'); +var STRONG_LIGHT_CONTRAST_COLOR = colorToRgbaArray('rgb(255,255,255)'); + +var THEME_COLOR_TYPES = ['primary', 'accent', 'warn', 'background']; +var DEFAULT_COLOR_TYPE = 'primary'; + +// A color in a theme will use these hues by default, if not specified by user. +var LIGHT_DEFAULT_HUES = { + 'accent': { + 'default': 'A200', + 'hue-1': 'A100', + 'hue-2': 'A400', + 'hue-3': 'A700' + }, + 'background': { + 'default': '50', + 'hue-1': 'A100', + 'hue-2': '100', + 'hue-3': '300' + } +}; + +var DARK_DEFAULT_HUES = { + 'background': { + 'default': 'A400', + 'hue-1': '800', + 'hue-2': '900', + 'hue-3': 'A200' + } +}; + +// Icon opacity values (active/inactive) from +// https://material.io/archive/guidelines/style/color.html#color-usability +var DARK_CONTRAST_OPACITY = { + 'icon': 0.54, + 'secondary': 0.54, + 'disabled': 0.38, + 'hint': 0.38, + 'divider': 0.12, +}; + +var LIGHT_CONTRAST_OPACITY = { + 'icon': 0.87, + 'secondary': 0.7, + 'disabled': 0.5, + 'hint': 0.5, + 'divider': 0.12 +}; + +// Icon opacity values (active/inactive) from +// https://material.io/archive/guidelines/style/color.html#color-usability +var STRONG_LIGHT_CONTRAST_OPACITY = { + 'icon': 1.0, + 'secondary': 0.7, + 'disabled': 0.5, + 'hint': 0.5, + 'divider': 0.12 +}; + +THEME_COLOR_TYPES.forEach(function(colorType) { + // Color types with unspecified default hues will use these default hue values + var defaultDefaultHues = { + 'default': '500', + 'hue-1': '300', + 'hue-2': '800', + 'hue-3': 'A100' + }; + if (!LIGHT_DEFAULT_HUES[colorType]) LIGHT_DEFAULT_HUES[colorType] = defaultDefaultHues; + if (!DARK_DEFAULT_HUES[colorType]) DARK_DEFAULT_HUES[colorType] = defaultDefaultHues; +}); + +var VALID_HUE_VALUES = [ + '50', '100', '200', '300', '400', '500', '600', + '700', '800', '900', 'A100', 'A200', 'A400', 'A700' +]; + +var themeConfig = { + disableTheming : false, // Generate our themes at run time; also disable stylesheet DOM injection + generateOnDemand : false, // Whether or not themes are to be generated on-demand (vs. eagerly). + registeredStyles : [], // Custom styles registered to be used in the theming of custom components. + nonce : null // Nonce to be added as an attribute to the generated themes style tags. +}; + +/** + * + */ +function ThemingProvider($mdColorPalette, $$mdMetaProvider) { + ThemingService.$inject = ["$rootScope", "$mdUtil", "$q", "$log"]; + PALETTES = { }; + var THEMES = { }; + + var themingProvider; + + var alwaysWatchTheme = false; + var defaultTheme = 'default'; + + // Load JS Defined Palettes + angular.extend(PALETTES, $mdColorPalette); + + // Default theme defined in core.js + + /** + * Adds `theme-color` and `msapplication-navbutton-color` meta tags with the color parameter + * @param {string} color Hex value of the wanted browser color + * @returns {function} Remove function of the meta tags + */ + var setBrowserColor = function (color) { + // Chrome, Firefox OS and Opera + var removeChrome = $$mdMetaProvider.setMeta('theme-color', color); + // Windows Phone + var removeWindows = $$mdMetaProvider.setMeta('msapplication-navbutton-color', color); + + return function () { + removeChrome(); + removeWindows(); + }; + }; + + /** + * @ngdoc method + * @name $mdThemingProvider#enableBrowserColor + * @description + * Enables browser header coloring. For more info please visit + * + * Web Fundamentals. + * @param {object=} options Options for the browser color, which include:
    + * - `theme` - `{string}`: A defined theme via `$mdThemeProvider` to use the palettes from. Default is `default` theme.
    + * - `palette` - `{string}`: Can be any one of the basic material design palettes, extended defined palettes, or `primary`, + * `accent`, `background`, and `warn`. Default is `primary`.
    + * - `hue` - `{string}`: The hue from the selected palette. Default is `800`.
    + * @returns {function} Function that removes the browser coloring when called. + */ + var enableBrowserColor = function (options) { + options = angular.isObject(options) ? options : {}; + + var theme = options.theme || 'default'; + var hue = options.hue || '800'; + + var palette = PALETTES[options.palette] || + PALETTES[THEMES[theme].colors[options.palette || 'primary'].name]; + + var color = angular.isObject(palette[hue]) ? palette[hue].hex : palette[hue]; + if (color.substr(0, 1) !== '#') color = '#' + color; + + return setBrowserColor(color); + }; + + return themingProvider = { + definePalette: definePalette, + extendPalette: extendPalette, + theme: registerTheme, + + /** + * return a read-only clone of the current theme configuration + */ + configuration : function() { + return angular.extend({ }, themeConfig, { + defaultTheme : defaultTheme, + alwaysWatchTheme : alwaysWatchTheme, + registeredStyles : [].concat(themeConfig.registeredStyles) + }); + }, + + /** + * @ngdoc method + * @name $mdThemingProvider#disableTheming + * @description + * An easier way to disable theming without having to use `.constant("$MD_THEME_CSS","");`. + * This disables all dynamic theme style sheet generations and injections. + * @param {boolean=} isDisabled Disable all dynamic theme style sheet generations and injections + * if `true` or `undefined`. + */ + disableTheming: function(isDisabled) { + themeConfig.disableTheming = angular.isUndefined(isDisabled) || !!isDisabled; + }, + + /** + * @ngdoc method + * @name $mdThemingProvider#registerStyles + * @param {string} styles The styles to be appended to AngularJS Material's built in theme CSS. + */ + registerStyles: function(styles) { + themeConfig.registeredStyles.push(styles); + }, + + /** + * @ngdoc method + * @name $mdThemingProvider#setNonce + * @param {string} nonceValue The nonce to be added as an attribute to the theme style tags. + * Setting a value allows the use of CSP policy without using the `'unsafe-inline'` directive. + * The string must already be base64 encoded. You can use `btoa(string)` to do this encoding. + * In your CSP's `style-src`, you would then add an entry for `'nonce-nonceValue'`. + */ + setNonce: function(nonceValue) { + themeConfig.nonce = nonceValue; + }, + + generateThemesOnDemand: function(onDemand) { + themeConfig.generateOnDemand = onDemand; + }, + + /** + * @ngdoc method + * @name $mdThemingProvider#setDefaultTheme + * @param {string} theme Default theme name to be applied to elements. + * Default value is `default`. + */ + setDefaultTheme: function(theme) { + defaultTheme = theme; + }, + + /** + * @ngdoc method + * @name $mdThemingProvider#alwaysWatchTheme + * @param {boolean} alwaysWatch Whether or not to always watch themes for changes and re-apply + * classes when they change. Default is `false`. Enabling can reduce performance. + */ + alwaysWatchTheme: function(alwaysWatch) { + alwaysWatchTheme = alwaysWatch; + }, + + enableBrowserColor: enableBrowserColor, + + $get: ThemingService, + _LIGHT_DEFAULT_HUES: LIGHT_DEFAULT_HUES, + _DARK_DEFAULT_HUES: DARK_DEFAULT_HUES, + _PALETTES: PALETTES, + _THEMES: THEMES, + _parseRules: parseRules, + _rgba: rgba + }; + + /** + * @ngdoc method + * @name $mdThemingProvider#definePalette + * @description + * In the event that you need to define a custom color palette, you can use this function to + * make it available to your theme for use in its intention groups.
    + * Note that you must specify all hues in the definition map. + * @param {string} name Name of palette being defined + * @param {object} map Palette definition that includes hue definitions and contrast colors: + * - `'50'` - `{string}`: HEX color + * - `'100'` - `{string}`: HEX color + * - `'200'` - `{string}`: HEX color + * - `'300'` - `{string}`: HEX color + * - `'400'` - `{string}`: HEX color + * - `'500'` - `{string}`: HEX color + * - `'600'` - `{string}`: HEX color + * - `'700'` - `{string}`: HEX color + * - `'800'` - `{string}`: HEX color + * - `'900'` - `{string}`: HEX color + * - `'A100'` - `{string}`: HEX color + * - `'A200'` - `{string}`: HEX color + * - `'A400'` - `{string}`: HEX color + * - `'A700'` - `{string}`: HEX color + * - `'contrastDefaultColor'` - `{string}`: `light` or `dark` + * - `'contrastDarkColors'` - `{string[]}`: Hues which should use dark contrast colors (i.e. raised button text). + * For example: `['50', '100', '200', '300', '400', 'A100']`. + * - `'contrastLightColors'` - `{string[]}`: Hues which should use light contrast colors (i.e. raised button text). + * For example: `['500', '600', '700', '800', '900', 'A200', 'A400', 'A700']`. + */ + function definePalette(name, map) { + map = map || {}; + PALETTES[name] = checkPaletteValid(name, map); + return themingProvider; + } + + /** + * @ngdoc method + * @name $mdThemingProvider#extendPalette + * @description + * Sometimes it is easier to extend an existing color palette and then change a few properties, + * rather than defining a whole new palette. + * @param {string} name Name of palette being extended + * @param {object} map Palette definition that includes optional hue definitions and contrast colors: + * - `'50'` - `{string}`: HEX color + * - `'100'` - `{string}`: HEX color + * - `'200'` - `{string}`: HEX color + * - `'300'` - `{string}`: HEX color + * - `'400'` - `{string}`: HEX color + * - `'500'` - `{string}`: HEX color + * - `'600'` - `{string}`: HEX color + * - `'700'` - `{string}`: HEX color + * - `'800'` - `{string}`: HEX color + * - `'900'` - `{string}`: HEX color + * - `'A100'` - `{string}`: HEX color + * - `'A200'` - `{string}`: HEX color + * - `'A400'` - `{string}`: HEX color + * - `'A700'` - `{string}`: HEX color + * - `'contrastDefaultColor'` - `{string}`: `light` or `dark` + * - `'contrastDarkColors'` - `{string[]}`: Hues which should use dark contrast colors (i.e. raised button text). + * For example: `['50', '100', '200', '300', '400', 'A100']`. + * - `'contrastLightColors'` - `{string[]}`: Hues which should use light contrast colors (i.e. raised button text). + * For example: `['500', '600', '700', '800', '900', 'A200', 'A400', 'A700']`. + * @returns {object} A new object which is a copy of the given palette, `name`, + * with variables from `map` overwritten. + */ + function extendPalette(name, map) { + return checkPaletteValid(name, angular.extend({}, PALETTES[name] || {}, map)); + } + + // Make sure that palette has all required hues + function checkPaletteValid(name, map) { + var missingColors = VALID_HUE_VALUES.filter(function(field) { + return !map[field]; + }); + if (missingColors.length) { + throw new Error("Missing colors %1 in palette %2!" + .replace('%1', missingColors.join(', ')) + .replace('%2', name)); + } + + return map; + } + + /** + * @ngdoc method + * @name $mdThemingProvider#theme + * @description + * Register a theme (which is a collection of color palettes); i.e. `warn`, `accent`, + * `background`, and `primary`.
    + * Optionally inherit from an existing theme. + * @param {string} name Name of theme being registered + * @param {string=} inheritFrom Existing theme name to inherit from + */ + function registerTheme(name, inheritFrom) { + if (THEMES[name]) return THEMES[name]; + + inheritFrom = inheritFrom || 'default'; + + var parentTheme = typeof inheritFrom === 'string' ? THEMES[inheritFrom] : inheritFrom; + var theme = new Theme(name); + + if (parentTheme) { + angular.forEach(parentTheme.colors, function(color, colorType) { + theme.colors[colorType] = { + name: color.name, + // Make sure a COPY of the hues is given to the child color, + // not the same reference. + hues: angular.extend({}, color.hues) + }; + }); + } + THEMES[name] = theme; + + return theme; + } + + function Theme(name) { + var self = this; + self.name = name; + self.colors = {}; + + self.dark = setDark; + setDark(false); + + function setDark(isDark) { + isDark = arguments.length === 0 ? true : !!isDark; + + // If no change, abort + if (isDark === self.isDark) return; + + self.isDark = isDark; + + self.foregroundPalette = self.isDark ? LIGHT_FOREGROUND : DARK_FOREGROUND; + self.foregroundShadow = self.isDark ? DARK_SHADOW : LIGHT_SHADOW; + + // Light and dark themes have different default hues. + // Go through each existing color type for this theme, and for every + // hue value that is still the default hue value from the previous light/dark setting, + // set it to the default hue value from the new light/dark setting. + var newDefaultHues = self.isDark ? DARK_DEFAULT_HUES : LIGHT_DEFAULT_HUES; + var oldDefaultHues = self.isDark ? LIGHT_DEFAULT_HUES : DARK_DEFAULT_HUES; + angular.forEach(newDefaultHues, function(newDefaults, colorType) { + var color = self.colors[colorType]; + var oldDefaults = oldDefaultHues[colorType]; + if (color) { + for (var hueName in color.hues) { + if (color.hues[hueName] === oldDefaults[hueName]) { + color.hues[hueName] = newDefaults[hueName]; + } + } + } + }); + + return self; + } + + THEME_COLOR_TYPES.forEach(function(colorType) { + var defaultHues = (self.isDark ? DARK_DEFAULT_HUES : LIGHT_DEFAULT_HUES)[colorType]; + self[colorType + 'Palette'] = function setPaletteType(paletteName, hues) { + var color = self.colors[colorType] = { + name: paletteName, + hues: angular.extend({}, defaultHues, hues) + }; + + Object.keys(color.hues).forEach(function(name) { + if (!defaultHues[name]) { + throw new Error("Invalid hue name '%1' in theme %2's %3 color %4. Available hue names: %4" + .replace('%1', name) + .replace('%2', self.name) + .replace('%3', paletteName) + .replace('%4', Object.keys(defaultHues).join(', ')) + ); + } + }); + Object.keys(color.hues).map(function(key) { + return color.hues[key]; + }).forEach(function(hueValue) { + if (VALID_HUE_VALUES.indexOf(hueValue) === -1) { + throw new Error("Invalid hue value '%1' in theme %2's %3 color %4. Available hue values: %5" + .replace('%1', hueValue) + .replace('%2', self.name) + .replace('%3', colorType) + .replace('%4', paletteName) + .replace('%5', VALID_HUE_VALUES.join(', ')) + ); + } + }); + return self; + }; + }); + } + + /** + * @ngdoc service + * @name $mdTheming + * @module material.core.theming + * @description + * Service that makes an element apply theming related classes to itself. + * + * For more information on the hue objects, their default values, as well as valid hue values, please visit the custom hues section of Configuring a Theme. + * + * + * // Example component directive that we want to apply theming classes to. + * app.directive('myFancyDirective', function($mdTheming) { + * return { + * restrict: 'AE', + * link: function(scope, element, attrs) { + * // Initialize the service using our directive's element + * $mdTheming(element); + * + * $mdTheming.defineTheme('myTheme', { + * primary: 'blue', + * primaryHues: { + * default: '500', + * hue-1: '300', + * hue-2: '900', + * hue-3: 'A100' + * }, + * accent: 'pink', + * accentHues: { + * default: '600', + * hue-1: '300', + * hue-2: '200', + * hue-3: 'A500' + * }, + * warn: 'red', + * // It's not necessary to specify all hues in the object. + * warnHues: { + * default: '200', + * hue-3: 'A100' + * }, + * // It's not necessary to specify custom hues at all. + * background: 'grey', + * dark: true + * }); + * // Your directive's custom code here. + * } + * }; + * }); + * + * @param {element=} element Element that will have theming classes applied to it. + */ + + /** + * @ngdoc property + * @name $mdTheming#THEMES + * @description + * Property to get all the themes defined + * @returns {object} All the themes defined with their properties. + */ + + /** + * @ngdoc property + * @name $mdTheming#PALETTES + * @description + * Property to get all the palettes defined + * @returns {object} All the palettes defined with their colors. + */ + + /** + * @ngdoc method + * @name $mdTheming#registered + * @description + * Determine is specified theme name is a valid, registered theme + * @param {string} themeName the theme to check if registered + * @returns {boolean} whether the theme is registered or not + */ + + /** + * @ngdoc method + * @name $mdTheming#defaultTheme + * @description + * Returns the default theme + * @returns {string} The default theme + */ + + /** + * @ngdoc method + * @name $mdTheming#generateTheme + * @description + * Lazy generate themes - by default, every theme is generated when defined. + * You can disable this in the configuration section using the + * `$mdThemingProvider.generateThemesOnDemand(true);` + * + * The theme name that is passed in must match the name of the theme that was defined as part of + * the configuration block. + * + * @param {string} name theme name to generate + */ + + /** + * @ngdoc method + * @name $mdTheming#setBrowserColor + * @description + * Enables browser header coloring. For more info please visit + * + * Web Fundamentals. + * @param {object=} options Options for the browser color, which include:
    + * - `theme` - `{string}`: A defined theme via `$mdThemeProvider` to use the palettes from. + * Default is `default` theme.
    + * - `palette` - `{string}`: Can be any one of the basic material design palettes, extended + * defined palettes, or `primary`, `accent`, `background`, and `warn`. Default is `primary`. + *
    + * - `hue` - `{string}`: The hue from the selected palette. Default is `800`.
    + * @returns {function} Function that removes the browser coloring when called. + */ + + /** + * @ngdoc method + * @name $mdTheming#defineTheme + * @description + * Dynamically define a theme by using an options object that contains palette names. + * + * @param {string} name Theme name to define + * @param {object} options Theme definition options + * + * Options are:
    + * - `primary` - `{string}`: The name of the primary palette to use in the theme.
    + * - `primaryHues` - `{object=}`: Override hues for primary palette.
    + * - `accent` - `{string}`: The name of the accent palette to use in the theme.
    + * - `accentHues` - `{object=}`: Override hues for accent palette.
    + * - `warn` - `{string}`: The name of the warn palette to use in the theme.
    + * - `warnHues` - `{object=}`: Override hues for warn palette.
    + * - `background` - `{string}`: The name of the background palette to use in the theme.
    + * - `backgroundHues` - `{object=}`: Override hues for background palette.
    + * - `dark` - `{boolean}`: Indicates if it's a dark theme.
    + * @returns {Promise} A resolved promise with the new theme name. + */ + + /* @ngInject */ + function ThemingService($rootScope, $mdUtil, $q, $log) { + // Allow us to be invoked via a linking function signature. + var applyTheme = function (scope, el) { + if (el === undefined) { el = scope; scope = undefined; } + if (scope === undefined) { scope = $rootScope; } + applyTheme.inherit(el, el); + }; + + Object.defineProperty(applyTheme, 'THEMES', { + get: function () { + return angular.extend({}, THEMES); + } + }); + Object.defineProperty(applyTheme, 'PALETTES', { + get: function () { + return angular.extend({}, PALETTES); + } + }); + Object.defineProperty(applyTheme, 'ALWAYS_WATCH', { + get: function () { + return alwaysWatchTheme; + } + }); + applyTheme.inherit = inheritTheme; + applyTheme.registered = registered; + applyTheme.defaultTheme = function() { return defaultTheme; }; + applyTheme.generateTheme = function(name) { generateTheme(THEMES[name], name, themeConfig.nonce); }; + applyTheme.defineTheme = function(name, options) { + options = options || {}; + + var theme = registerTheme(name); + + if (options.primary) { + theme.primaryPalette(options.primary, options.primaryHues); + } + if (options.accent) { + theme.accentPalette(options.accent, options.accentHues); + } + if (options.warn) { + theme.warnPalette(options.warn, options.warnHues); + } + if (options.background) { + theme.backgroundPalette(options.background, options.backgroundHues); + } + if (options.dark){ + theme.dark(); + } + + this.generateTheme(name); + + return $q.resolve(name); + }; + applyTheme.setBrowserColor = enableBrowserColor; + + return applyTheme; + + /** + * Determine is specified theme name is a valid, registered theme + */ + function registered(themeName) { + if (themeName === undefined || themeName === '') return true; + return applyTheme.THEMES[themeName] !== undefined; + } + + /** + * Get theme name for the element, then update with Theme CSS class + */ + function inheritTheme (el, parent) { + var ctrl = parent.controller('mdTheme') || el.data('$mdThemeController'); + var scope = el.scope(); + + updateThemeClass(lookupThemeName()); + + if (ctrl) { + var watchTheme = alwaysWatchTheme || + ctrl.$shouldWatch || + $mdUtil.parseAttributeBoolean(el.attr('md-theme-watch')); + + if (watchTheme || ctrl.isAsyncTheme) { + var clearNameWatcher = function () { + if (unwatch) { + unwatch(); + unwatch = undefined; + } + }; + + var unwatch = ctrl.registerChanges(function(name) { + updateThemeClass(name); + + if (!watchTheme) { + clearNameWatcher(); + } + }); + + if (scope) { + scope.$on('$destroy', clearNameWatcher); + } else { + el.on('$destroy', clearNameWatcher); + } + } + } + + /** + * Find the theme name from the parent controller or element data + */ + function lookupThemeName() { + // As a few components (dialog) add their controllers later, we should also watch for a controller init. + return ctrl && ctrl.$mdTheme || (defaultTheme === 'default' ? '' : defaultTheme); + } + + /** + * Remove old theme class and apply a new one + * NOTE: if not a valid theme name, then the current name is not changed + */ + function updateThemeClass(theme) { + if (!theme) return; + if (!registered(theme)) { + $log.warn('Attempted to use unregistered theme \'' + theme + '\'. ' + + 'Register it with $mdThemingProvider.theme().'); + } + + var oldTheme = el.data('$mdThemeName'); + if (oldTheme) el.removeClass('md-' + oldTheme +'-theme'); + el.addClass('md-' + theme + '-theme'); + el.data('$mdThemeName', theme); + if (ctrl) { + el.data('$mdThemeController', ctrl); + } + } + } + + } +} + +function ThemingDirective($mdTheming, $interpolate, $parse, $mdUtil, $q, $log) { + return { + priority: 101, // has to be more than 100 to be before interpolation (issue on IE) + link: { + pre: function(scope, el, attrs) { + var registeredCallbacks = []; + + var startSymbol = $interpolate.startSymbol(); + var endSymbol = $interpolate.endSymbol(); + + var theme = attrs.mdTheme.trim(); + + var hasInterpolation = + theme.substr(0, startSymbol.length) === startSymbol && + theme.lastIndexOf(endSymbol) === theme.length - endSymbol.length; + + var oneTimeOperator = '::'; + var oneTimeBind = attrs.mdTheme + .split(startSymbol).join('') + .split(endSymbol).join('') + .trim() + .substr(0, oneTimeOperator.length) === oneTimeOperator; + + var getTheme = function () { + var interpolation = $interpolate(attrs.mdTheme)(scope); + return $parse(interpolation)(scope) || interpolation; + }; + + var ctrl = { + isAsyncTheme: angular.isFunction(getTheme()) || angular.isFunction(getTheme().then), + registerChanges: function (cb, context) { + if (context) { + cb = angular.bind(context, cb); + } + + registeredCallbacks.push(cb); + + return function () { + var index = registeredCallbacks.indexOf(cb); + + if (index > -1) { + registeredCallbacks.splice(index, 1); + } + }; + }, + $setTheme: function (theme) { + if (!$mdTheming.registered(theme)) { + $log.warn('attempted to use unregistered theme \'' + theme + '\''); + } + + ctrl.$mdTheme = theme; + + // Iterating backwards to support unregistering during iteration + // http://stackoverflow.com/a/9882349/890293 + // we don't use `reverse()` of array because it mutates the array and we don't want it + // to get re-indexed + for (var i = registeredCallbacks.length; i--;) { + registeredCallbacks[i](theme); + } + }, + $shouldWatch: $mdUtil.parseAttributeBoolean(el.attr('md-theme-watch')) || + $mdTheming.ALWAYS_WATCH || + (hasInterpolation && !oneTimeBind) + }; + + el.data('$mdThemeController', ctrl); + + var setParsedTheme = function (theme) { + if (typeof theme === 'string') { + return ctrl.$setTheme(theme); + } + + $q.when(angular.isFunction(theme) ? theme() : theme) + .then(function(name) { + ctrl.$setTheme(name); + }); + }; + + setParsedTheme(getTheme()); + + var unwatch = scope.$watch(getTheme, function(theme) { + if (theme) { + setParsedTheme(theme); + + if (!ctrl.$shouldWatch) { + unwatch(); + } + } + }); + } + } + }; +} + +/** + * Special directive that will disable ALL runtime Theme style generation and DOM injection + * + * + * + * + * + * ... + * + * + * Note: Using md-themes-css directive requires the developer to load external + * theme stylesheets; e.g. custom themes from Material-Tools: + * + * `angular-material.themes.css` + * + * Another option is to use the ThemingProvider to configure and disable the attribute + * conversions; this would obviate the use of the `md-themes-css` directive + * + */ +function disableThemesDirective() { + themeConfig.disableTheming = true; + + // Return a 1x-only, first-match attribute directive + return { + restrict : 'A', + priority : '900' + }; +} + +function ThemableDirective($mdTheming) { + return $mdTheming; +} + +function parseRules(theme, colorType, rules) { + checkValidPalette(theme, colorType); + + rules = rules.replace(/THEME_NAME/g, theme.name); + var themeNameRegex = new RegExp('\\.md-' + theme.name + '-theme', 'g'); + // Matches '{{ primary-color }}', etc + var hueRegex = new RegExp('([\'"])?{{\\s*([a-zA-Z]+)-?(color|default)?-?(contrast)?-?((?:\\d\\.?\\d*)|(?:[a-zA-Z]+))?\\s*}}(["\'])?','g'); + var simpleVariableRegex = /'?"?{{\s*([a-zA-Z]+)-(A?\d+|hue-[0-3]|shadow|default)-?(contrast)?-?((?:\d\.?\d*)|(?:[a-zA-Z]+))?\s*}}'?"?/g; + var defaultBgHue = theme.colors['background'].hues['default']; + var defaultBgContrastType = PALETTES[theme.colors['background'].name][defaultBgHue].contrastType; + + // find and replace simple variables where we use a specific hue, not an entire palette + // eg. "{{primary-100}}" + // \(' + THEME_COLOR_TYPES.join('\|') + '\)' + rules = rules.replace(simpleVariableRegex, function(match, colorType, hue, contrast, opacity) { + var regexColorType = colorType; + if (colorType === 'foreground') { + if (hue === 'shadow') { + return theme.foregroundShadow; + } else if (theme.foregroundPalette[hue]) { + // Use user defined palette number (ie: foreground-2) + return rgba(colorToRgbaArray(theme.foregroundPalette[hue])); + } else if (theme.foregroundPalette['1']){ + return rgba(colorToRgbaArray(theme.foregroundPalette['1'])); + } + // Default to background-default-contrast-{opacity} + colorType = 'background'; + contrast = 'contrast'; + if (!opacity && hue) { + // Convert references to legacy hues to opacities (i.e. foreground-4 to *-divider) + switch (hue) { + // hue-1 uses default opacity + case '2': + opacity = 'secondary'; + break; + case '3': + opacity = 'disabled'; + break; + case '4': + opacity = 'divider'; + } + } + hue = 'default'; + } + + // `default` is also accepted as a hue-value, because the background palettes are + // using it as a name for the default hue. + if (hue.indexOf('hue') === 0 || hue === 'default') { + hue = theme.colors[colorType].hues[hue]; + } + + var colorDetails = (PALETTES[ theme.colors[colorType].name ][hue] || ''); + + // If user has specified a foreground color, use those + if (colorType === 'background' && contrast && regexColorType !== 'foreground' && + colorDetails.contrastType === defaultBgContrastType) { + // Don't process if colorType was changed + switch (opacity) { + case 'secondary': + case 'icon': + if (theme.foregroundPalette['2']) { + return rgba(colorToRgbaArray(theme.foregroundPalette['2'])); + } + break; + case 'disabled': + case 'hint': + if (theme.foregroundPalette['3']) { + return rgba(colorToRgbaArray(theme.foregroundPalette['3'])); + } + break; + case 'divider': + if (theme.foregroundPalette['4']) { + return rgba(colorToRgbaArray(theme.foregroundPalette['4'])); + } + break; + default: + if (theme.foregroundPalette['1']) { + return rgba(colorToRgbaArray(theme.foregroundPalette['1'])); + } + break; + } + } + + if (contrast && opacity) { + opacity = colorDetails.opacity[opacity] || opacity; + } + + return rgba(colorDetails[contrast ? 'contrast' : 'value'], opacity); + }); + + var generatedRules = []; + + // For each type, generate rules for each hue (ie. default, md-hue-1, md-hue-2, md-hue-3) + angular.forEach(['default', 'hue-1', 'hue-2', 'hue-3'], function(hueName) { + var newRule = rules + .replace(hueRegex, function(match, _, matchedColorType, hueType, contrast, opacity) { + var color = theme.colors[matchedColorType]; + var palette = PALETTES[color.name]; + var hueValue = color.hues[hueName]; + if (contrast && opacity) { + opacity = palette[hueValue].opacity[opacity] || opacity; + } + return rgba(palette[hueValue][hueType === 'color' ? 'value' : 'contrast'], opacity); + }); + if (hueName !== 'default') { + newRule = newRule.replace(themeNameRegex, '.md-' + theme.name + '-theme.md-' + hueName); + } + + // Don't apply a selector rule to the default theme, making it easier to override + // styles of the base-component + if (theme.name === 'default') { + var themeRuleRegex = /((?:\s|>|\.|\w|-|:|\(|\)|\[|]|"|'|=)*)\.md-default-theme((?:\s|>|\.|\w|-|:|\(|\)|\[|]|"|'|=)*)/g; + + newRule = newRule.replace(themeRuleRegex, function(match, start, end) { + return match + ', ' + start + end; + }); + } + generatedRules.push(newRule); + }); + + return generatedRules; +} + +var rulesByType = {}; + +// Generate our themes at run time given the state of THEMES and PALETTES +function generateAllThemes($injector, $mdTheming) { + var head = document.head; + var firstChild = head ? head.firstElementChild : null; + var themeCss = !themeConfig.disableTheming && $injector.has('$MD_THEME_CSS') ? $injector.get('$MD_THEME_CSS') : ''; + + // Append our custom registered styles to the theme stylesheet. + themeCss += themeConfig.registeredStyles.join(''); + + if (!firstChild) return; + if (themeCss.length === 0) return; // no rules, so no point in running this expensive task + + // Expose contrast colors for palettes to ensure that text is always readable + angular.forEach(PALETTES, sanitizePalette); + + // MD_THEME_CSS is a string generated by the build process that includes all the themeable + // components as templates + + // Break the CSS into individual rules + var rules = splitCss(themeCss).map(function(rule) { + return rule.trim(); + }); + + THEME_COLOR_TYPES.forEach(function(type) { + rulesByType[type] = ''; + }); + + // Sort the rules based on type, allowing us to do color substitution on a per-type basis + rules.forEach(function(rule) { + // First: test that if the rule has '.md-accent', it goes into the accent set of rules + for (var i = 0, type; type = THEME_COLOR_TYPES[i]; i++) { + if (rule.indexOf('.md-' + type) > -1) { + return rulesByType[type] += rule; + } + } + + // If no eg 'md-accent' class is found, try to just find 'accent' in the rule and guess from + // there + for (i = 0; type = THEME_COLOR_TYPES[i]; i++) { + if (rule.indexOf(type) > -1) { + return rulesByType[type] += rule; + } + } + + // Default to the primary array + return rulesByType[DEFAULT_COLOR_TYPE] += rule; + }); + + // If themes are being generated on-demand, quit here. The user will later manually + // call generateTheme to do this on a theme-by-theme basis. + if (themeConfig.generateOnDemand) return; + + angular.forEach($mdTheming.THEMES, function(theme) { + if (!GENERATED[theme.name] && !($mdTheming.defaultTheme() !== 'default' && theme.name === 'default')) { + generateTheme(theme, theme.name, themeConfig.nonce); + } + }); + + + // ************************* + // Internal functions + // ************************* + + /** + * The user specifies a 'default' contrast color as either light or dark, then explicitly lists + * which hues are the opposite contrast (eg. A100 has dark, A200 has light). + * @param {!object} palette to sanitize + */ + function sanitizePalette(palette) { + var defaultContrast = palette.contrastDefaultColor; + var lightColors = palette.contrastLightColors || []; + var strongLightColors = palette.contrastStrongLightColors || []; + var darkColors = palette.contrastDarkColors || []; + + // These colors are provided as space-separated lists + if (typeof lightColors === 'string') lightColors = lightColors.split(' '); + if (typeof strongLightColors === 'string') strongLightColors = strongLightColors.split(' '); + if (typeof darkColors === 'string') darkColors = darkColors.split(' '); + + // Cleanup after ourselves + delete palette.contrastDefaultColor; + delete palette.contrastLightColors; + delete palette.contrastStrongLightColors; + delete palette.contrastDarkColors; + + /** + * @param {string} hueName + * @return {'dark'|'light'|'strongLight'} + */ + function getContrastType(hueName) { + if (defaultContrast === 'light' ? darkColors.indexOf(hueName) !== -1 : + (lightColors.indexOf(hueName) === -1 && strongLightColors.indexOf(hueName) === -1)) { + return 'dark'; + } + if (strongLightColors.indexOf(hueName) !== -1) { + return 'strongLight'; + } + return 'light'; + } + + /** + * @param {'dark'|'light'|'strongLight'} contrastType + * @return {[number, number, number]} [red, green, blue] array + */ + function getContrastColor(contrastType) { + switch (contrastType) { + default: + case 'strongLight': + return STRONG_LIGHT_CONTRAST_COLOR; + case 'light': + return LIGHT_CONTRAST_COLOR; + case 'dark': + return DARK_CONTRAST_COLOR; + } + } + + /** + * @param {'dark'|'light'|'strongLight'} contrastType + * @return {{secondary: number, divider: number, hint: number, icon: number, disabled: number}} + */ + function getOpacityValues(contrastType) { + switch (contrastType) { + default: + case 'strongLight': + return STRONG_LIGHT_CONTRAST_OPACITY; + case 'light': + return LIGHT_CONTRAST_OPACITY; + case 'dark': + return DARK_CONTRAST_OPACITY; + } + } + // Change { 'A100': '#fffeee' } to { 'A100': { value: '#fffeee', contrast:DARK_CONTRAST_COLOR } + angular.forEach(palette, function(hueValue, hueName) { + if (angular.isObject(hueValue)) return; // Already converted + // Map everything to rgb colors + var rgbValue = colorToRgbaArray(hueValue); + if (!rgbValue) { + throw new Error("Color %1, in palette %2's hue %3, is invalid. Hex or rgb(a) color expected." + .replace('%1', hueValue) + .replace('%2', palette.name) + .replace('%3', hueName)); + } + + var contrastType = getContrastType(hueName); + palette[hueName] = { + hex: palette[hueName], + value: rgbValue, + contrastType: contrastType, + contrast: getContrastColor(contrastType), + opacity: getOpacityValues(contrastType) + }; + }); + } + + /** + * @param {string} themeCss + * @returns {[]} a string representing a CSS file that is split, producing an array with a rule + * at each index. + */ + function splitCss(themeCss) { + var result = []; + var currentRule = ''; + var openedCurlyBrackets = 0; + var closedCurlyBrackets = 0; + + for (var i = 0; i < themeCss.length; i++) { + var character = themeCss.charAt(i); + + // Check for content in quotes + if (character === '\'' || character === '"') { + // Append text in quotes to current rule + var textInQuotes = themeCss.substring(i, themeCss.indexOf(character, i + 1)); + currentRule += textInQuotes; + + // Jump to the closing quote char + i += textInQuotes.length; + } else { + currentRule += character; + + if (character === '}') { + closedCurlyBrackets++; + if (closedCurlyBrackets === openedCurlyBrackets) { + closedCurlyBrackets = 0; + openedCurlyBrackets = 0; + result.push(currentRule); + currentRule = ''; + } + } else if (character === '{') { + openedCurlyBrackets++; + } + } + } + // Add comments added after last valid rule. + if (currentRule !== '') { + result.push(currentRule); + } + + return result; + } +} + +function generateTheme(theme, name, nonce) { + var head = document.head; + var firstChild = head ? head.firstElementChild : null; + + if (!GENERATED[name]) { + // For each theme, use the color palettes specified for + // `primary`, `warn` and `accent` to generate CSS rules. + THEME_COLOR_TYPES.forEach(function(colorType) { + var styleStrings = parseRules(theme, colorType, rulesByType[colorType]); + while (styleStrings.length) { + var styleContent = styleStrings.shift(); + if (styleContent) { + var style = document.createElement('style'); + style.setAttribute('md-theme-style', ''); + if (nonce) { + style.setAttribute('nonce', nonce); + } + style.appendChild(document.createTextNode(styleContent)); + head.insertBefore(style, firstChild); + } + } + }); + + GENERATED[theme.name] = true; + } + +} + + +function checkValidPalette(theme, colorType) { + // If theme attempts to use a palette that doesnt exist, throw error + if (!PALETTES[ (theme.colors[colorType] || {}).name ]) { + throw new Error( + "You supplied an invalid color palette for theme %1's %2 palette. Available palettes: %3" + .replace('%1', theme.name) + .replace('%2', colorType) + .replace('%3', Object.keys(PALETTES).join(', ')) + ); + } +} + +/** + * @param {string} clr rbg or rgba color + * @return {number[]|undefined} [red, green, blue] array if it can be computed + */ +function colorToRgbaArray(clr) { + if (angular.isArray(clr) && clr.length === 3) return clr; + if (/^rgb/.test(clr)) { + return clr.replace(/(^\s*rgba?\(|\)\s*$)/g, '').split(',').map(function(value, i) { + return i === 3 ? parseFloat(value) : parseInt(value, 10); + }); + } + if (clr.charAt(0) === '#') clr = clr.substring(1); + if (!/^([a-fA-F0-9]{3}){1,2}$/g.test(clr)) return; + + var dig = clr.length / 3; + var red = clr.substr(0, dig); + var grn = clr.substr(dig, dig); + var blu = clr.substr(dig * 2); + if (dig === 1) { + red += red; + grn += grn; + blu += blu; + } + return [parseInt(red, 16), parseInt(grn, 16), parseInt(blu, 16)]; +} + +function rgba(rgbArray, opacity) { + if (!rgbArray) return "rgb('0,0,0')"; + + if (rgbArray.length === 4) { + rgbArray = angular.copy(rgbArray); + opacity ? rgbArray.pop() : opacity = rgbArray.pop(); + } + return opacity && (typeof opacity == 'number' || (typeof opacity == 'string' && opacity.length)) ? + 'rgba(' + rgbArray.join(',') + ',' + opacity + ')' : + 'rgb(' + rgbArray.join(',') + ')'; +} + + +})(window.angular); + +})(); +(function(){ +"use strict"; + +/** + * @ngdoc module + * @name material.components.autocomplete + */ +/* + * @see js folder for autocomplete implementation + */ +angular.module('material.components.autocomplete', [ + 'material.core', + 'material.components.icon', + 'material.components.virtualRepeat' +]); + +})(); +(function(){ +"use strict"; + + +MdAutocompleteCtrl.$inject = ["$scope", "$element", "$mdUtil", "$mdConstant", "$mdTheming", "$window", "$animate", "$rootElement", "$attrs", "$q", "$log", "$mdLiveAnnouncer"];angular + .module('material.components.autocomplete') + .controller('MdAutocompleteCtrl', MdAutocompleteCtrl); + +var ITEM_HEIGHT = 48, + MAX_ITEMS = 5, + MENU_PADDING = 8, + INPUT_PADDING = 2, // Padding provided by `md-input-container` + MODE_STANDARD = 'standard', + MODE_VIRTUAL = 'virtual'; + +function MdAutocompleteCtrl ($scope, $element, $mdUtil, $mdConstant, $mdTheming, $window, + $animate, $rootElement, $attrs, $q, $log, $mdLiveAnnouncer) { + + // Internal Variables. + var ctrl = this, + itemParts = $scope.itemsExpr.split(/ in /i), + itemExpr = itemParts[ 1 ], + elements = null, + cache = {}, + noBlur = false, + selectedItemWatchers = [], + hasFocus = false, + fetchesInProgress = 0, + enableWrapScroll = null, + inputModelCtrl = null, + debouncedOnResize = $mdUtil.debounce(onWindowResize), + mode = MODE_VIRTUAL; // default + + /** + * The root document element. This is used for attaching a top-level click handler to + * close the options panel when a click outside said panel occurs. We use `documentElement` + * instead of body because, when scrolling is disabled, some browsers consider the body element + * to be completely off the screen and propagate events directly to the html element. + * @type {!Object} angular.JQLite + */ + ctrl.documentElement = angular.element(document.documentElement); + + // Public Exported Variables with handlers + defineProperty('hidden', handleHiddenChange, true); + + // Public Exported Variables + ctrl.scope = $scope; + ctrl.parent = $scope.$parent; + ctrl.itemName = itemParts[0]; + ctrl.matches = []; + ctrl.loading = false; + ctrl.hidden = true; + ctrl.index = -1; + ctrl.activeOption = null; + ctrl.id = $mdUtil.nextUid(); + ctrl.isDisabled = null; + ctrl.isRequired = null; + ctrl.isReadonly = null; + ctrl.hasNotFound = false; + ctrl.selectedMessage = $scope.selectedMessage || 'selected'; + ctrl.noMatchMessage = $scope.noMatchMessage || 'There are no matches available.'; + ctrl.singleMatchMessage = $scope.singleMatchMessage || 'There is 1 match available.'; + ctrl.multipleMatchStartMessage = $scope.multipleMatchStartMessage || 'There are '; + ctrl.multipleMatchEndMessage = $scope.multipleMatchEndMessage || ' matches available.'; + ctrl.defaultEscapeOptions = 'clear'; + + // Public Exported Methods + ctrl.keydown = keydown; + ctrl.blur = blur; + ctrl.focus = focus; + ctrl.clear = clearValue; + ctrl.select = select; + ctrl.listEnter = onListEnter; + ctrl.listLeave = onListLeave; + ctrl.focusInput = focusInputElement; + ctrl.getCurrentDisplayValue = getCurrentDisplayValue; + ctrl.registerSelectedItemWatcher = registerSelectedItemWatcher; + ctrl.unregisterSelectedItemWatcher = unregisterSelectedItemWatcher; + ctrl.notFoundVisible = notFoundVisible; + ctrl.loadingIsVisible = loadingIsVisible; + ctrl.positionDropdown = positionDropdown; + + /** + * Report types to be used for the $mdLiveAnnouncer + * @enum {number} Unique flag id. + */ + var ReportType = { + Count: 1, + Selected: 2 + }; + + return init(); + + // initialization methods + + /** + * Initialize the controller, setup watchers, gather elements + */ + function init () { + + $mdUtil.initOptionalProperties($scope, $attrs, { + searchText: '', + selectedItem: null, + clearButton: false, + disableVirtualRepeat: false, + }); + + $mdTheming($element); + configureWatchers(); + $mdUtil.nextTick(function () { + + gatherElements(); + moveDropdown(); + + // Touch devices often do not send a click event on tap. We still want to focus the input + // and open the options pop-up in these cases. + $element.on('touchstart', focusInputElement); + + // Forward all focus events to the input element when autofocus is enabled + if ($scope.autofocus) { + $element.on('focus', focusInputElement); + } + if ($scope.inputAriaDescribedBy) { + elements.input.setAttribute('aria-describedby', $scope.inputAriaDescribedBy); + } + if (!$scope.floatingLabel) { + if ($scope.inputAriaLabel) { + elements.input.setAttribute('aria-label', $scope.inputAriaLabel); + } else if ($scope.inputAriaLabelledBy) { + elements.input.setAttribute('aria-labelledby', $scope.inputAriaLabelledBy); + } else if ($scope.placeholder) { + // If no aria-label or aria-labelledby references are defined, then just label using the + // placeholder. + elements.input.setAttribute('aria-label', $scope.placeholder); + } + } + }); + } + + function updateModelValidators() { + if (!$scope.requireMatch || !inputModelCtrl) return; + + inputModelCtrl.$setValidity('md-require-match', !!$scope.selectedItem || !$scope.searchText); + } + + /** + * Calculates the dropdown's position and applies the new styles to the menu element + * @returns {*} + */ + function positionDropdown () { + if (!elements) { + return $mdUtil.nextTick(positionDropdown, false, $scope); + } + + var dropdownHeight = ($scope.dropdownItems || MAX_ITEMS) * ITEM_HEIGHT; + var hrect = elements.wrap.getBoundingClientRect(), + vrect = elements.snap.getBoundingClientRect(), + root = elements.root.getBoundingClientRect(), + top = vrect.bottom - root.top, + bot = root.bottom - vrect.top, + left = hrect.left - root.left, + width = hrect.width, + offset = getVerticalOffset(), + position = $scope.dropdownPosition, + styles, enoughBottomSpace, enoughTopSpace; + var bottomSpace = root.bottom - vrect.bottom - MENU_PADDING + $mdUtil.getViewportTop(); + var topSpace = vrect.top - MENU_PADDING; + + // Automatically determine dropdown placement based on available space in viewport. + if (!position) { + enoughTopSpace = topSpace > dropdownHeight; + enoughBottomSpace = bottomSpace > dropdownHeight; + if (enoughBottomSpace) { + position = 'bottom'; + } else if (enoughTopSpace) { + position = 'top'; + } else { + position = topSpace > bottomSpace ? 'top' : 'bottom'; + } + } + // Adjust the width to account for the padding provided by `md-input-container` + if ($attrs.mdFloatingLabel) { + left += INPUT_PADDING; + width -= INPUT_PADDING * 2; + } + styles = { + left: left + 'px', + minWidth: width + 'px', + maxWidth: Math.max(hrect.right - root.left, root.right - hrect.left) - MENU_PADDING + 'px' + }; + + if (position === 'top') { + styles.top = 'auto'; + styles.bottom = bot + 'px'; + styles.maxHeight = Math.min(dropdownHeight, topSpace) + 'px'; + } else { + bottomSpace = root.bottom - hrect.bottom - MENU_PADDING + $mdUtil.getViewportTop(); + + styles.top = (top - offset) + 'px'; + styles.bottom = 'auto'; + styles.maxHeight = Math.min(dropdownHeight, bottomSpace) + 'px'; + } + + elements.$.scrollContainer.css(styles); + $mdUtil.nextTick(correctHorizontalAlignment, false, $scope); + + /** + * Calculates the vertical offset for floating label examples to account for ngMessages + * @returns {number} + */ + function getVerticalOffset () { + var offset = 0; + var inputContainer = $element.find('md-input-container'); + if (inputContainer.length) { + var input = inputContainer.find('input'); + offset = inputContainer.prop('offsetHeight'); + offset -= input.prop('offsetTop'); + offset -= input.prop('offsetHeight'); + // add in the height left up top for the floating label text + offset += inputContainer.prop('offsetTop'); + } + return offset; + } + + /** + * Makes sure that the menu doesn't go off of the screen on either side. + */ + function correctHorizontalAlignment () { + var dropdown = elements.scrollContainer.getBoundingClientRect(), + styles = {}; + if (dropdown.right > root.right) { + styles.left = (hrect.right - dropdown.width) + 'px'; + } + elements.$.scrollContainer.css(styles); + } + } + + /** + * Moves the dropdown menu to the body tag in order to avoid z-index and overflow issues. + */ + function moveDropdown () { + if (!elements.$.root.length) return; + $mdTheming(elements.$.scrollContainer); + elements.$.scrollContainer.detach(); + elements.$.root.append(elements.$.scrollContainer); + if ($animate.pin) $animate.pin(elements.$.scrollContainer, $rootElement); + } + + /** + * Sends focus to the input element. + */ + function focusInputElement () { + elements.input.focus(); + } + + /** + * Update the activeOption based on the selected item in the listbox. + * The activeOption is used in the template to set the aria-activedescendant attribute, which + * enables screen readers to properly handle visual focus within the listbox and announce the + * item's place in the list. I.e. "List item 3 of 50". Anytime that `ctrl.index` changes, this + * function needs to be called to update the activeOption. + */ + function updateActiveOption() { + var selectedOption = elements.scroller.querySelector('.selected'); + if (selectedOption) { + ctrl.activeOption = selectedOption.id; + } else { + ctrl.activeOption = null; + } + } + + /** + * Sets up any watchers used by autocomplete + */ + function configureWatchers () { + var wait = parseInt($scope.delay, 10) || 0; + + $attrs.$observe('disabled', function (value) { ctrl.isDisabled = $mdUtil.parseAttributeBoolean(value, false); }); + $attrs.$observe('required', function (value) { ctrl.isRequired = $mdUtil.parseAttributeBoolean(value, false); }); + $attrs.$observe('readonly', function (value) { ctrl.isReadonly = $mdUtil.parseAttributeBoolean(value, false); }); + + $scope.$watch('searchText', wait ? $mdUtil.debounce(handleSearchText, wait) : handleSearchText); + $scope.$watch('selectedItem', selectedItemChange); + + angular.element($window).on('resize', debouncedOnResize); + + $scope.$on('$destroy', cleanup); + } + + /** + * Removes any events or leftover elements created by this controller + */ + function cleanup () { + if (!ctrl.hidden) { + $mdUtil.enableScrolling(); + } + + angular.element($window).off('resize', debouncedOnResize); + + if (elements){ + var items = ['ul', 'scroller', 'scrollContainer', 'input']; + angular.forEach(items, function(key){ + elements.$[key].remove(); + }); + } + } + + /** + * Event handler to be called whenever the window resizes. + */ + function onWindowResize() { + if (!ctrl.hidden) { + positionDropdown(); + } + } + + /** + * Gathers all of the elements needed for this controller + */ + function gatherElements () { + + var snapWrap = gatherSnapWrap(); + + elements = { + main: $element[0], + scrollContainer: $element[0].querySelector('.md-virtual-repeat-container, .md-standard-list-container'), + scroller: $element[0].querySelector('.md-virtual-repeat-scroller, .md-standard-list-scroller'), + ul: $element.find('ul')[0], + input: $element.find('input')[0], + wrap: snapWrap.wrap, + snap: snapWrap.snap, + root: document.body, + }; + + elements.li = elements.ul.getElementsByTagName('li'); + elements.$ = getAngularElements(elements); + mode = elements.scrollContainer.classList.contains('md-standard-list-container') ? MODE_STANDARD : MODE_VIRTUAL; + inputModelCtrl = elements.$.input.controller('ngModel'); + } + + /** + * Gathers the snap and wrap elements + * + */ + function gatherSnapWrap() { + var element; + var value; + for (element = $element; element.length; element = element.parent()) { + value = element.attr('md-autocomplete-snap'); + if (angular.isDefined(value)) break; + } + + if (element.length) { + return { + snap: element[0], + wrap: (value.toLowerCase() === 'width') ? element[0] : $element.find('md-autocomplete-wrap')[0] + }; + } + + var wrap = $element.find('md-autocomplete-wrap')[0]; + return { + snap: wrap, + wrap: wrap + }; + } + + /** + * Gathers angular-wrapped versions of each element + * @param elements + * @returns {{}} + */ + function getAngularElements (elements) { + var obj = {}; + for (var key in elements) { + if (elements.hasOwnProperty(key)) obj[ key ] = angular.element(elements[ key ]); + } + return obj; + } + + // event/change handlers + + /** + * @param {Event} $event + */ + function preventDefault($event) { + $event.preventDefault(); + } + + /** + * @param {Event} $event + */ + function stopPropagation($event) { + $event.stopPropagation(); + } + + /** + * Handles changes to the `hidden` property. + * @param {boolean} hidden true to hide the options pop-up, false to show it. + * @param {boolean} oldHidden the previous value of hidden + */ + function handleHiddenChange (hidden, oldHidden) { + var scrollContainerElement; + + if (elements) { + scrollContainerElement = angular.element(elements.scrollContainer); + } + if (!hidden && oldHidden) { + positionDropdown(); + + // Report in polite mode, because the screen reader should finish the default description of + // the input element. + reportMessages(true, ReportType.Count | ReportType.Selected); + + if (elements) { + $mdUtil.disableScrollAround(elements.scrollContainer); + enableWrapScroll = disableElementScrollEvents(elements.wrap); + if ($mdUtil.isIos) { + ctrl.documentElement.on('touchend', handleTouchOutsidePanel); + if (scrollContainerElement) { + scrollContainerElement.on('touchstart touchmove touchend', stopPropagation); + } + } + ctrl.index = getDefaultIndex(); + $mdUtil.nextTick(function() { + updateActiveOption(); + updateScroll(); + }); + } + } else if (hidden && !oldHidden) { + if ($mdUtil.isIos) { + ctrl.documentElement.off('touchend', handleTouchOutsidePanel); + if (scrollContainerElement) { + scrollContainerElement.off('touchstart touchmove touchend', stopPropagation); + } + } + $mdUtil.enableScrolling(); + + if (enableWrapScroll) { + enableWrapScroll(); + enableWrapScroll = null; + } + } + } + + /** + * Handling touch events that bubble up to the document is required for closing the dropdown + * panel on touch outside of the options pop-up panel on iOS. + * @param {Event} $event + */ + function handleTouchOutsidePanel($event) { + ctrl.hidden = true; + // iOS does not blur the pop-up for touches on the scroll mask, so we have to do it. + doBlur(true); + } + + /** + * Disables scrolling for a specific element. + * @param {!string|!DOMElement} element to disable scrolling + * @return {Function} function to call to re-enable scrolling for the element + */ + function disableElementScrollEvents(element) { + var elementToDisable = angular.element(element); + elementToDisable.on('wheel touchmove', preventDefault); + + return function() { + elementToDisable.off('wheel touchmove', preventDefault); + }; + } + + /** + * When the user mouses over the dropdown menu, ignore blur events. + */ + function onListEnter () { + noBlur = true; + } + + /** + * When the user's mouse leaves the menu, blur events may hide the menu again. + */ + function onListLeave () { + if (!hasFocus && !ctrl.hidden) elements.input.focus(); + noBlur = false; + ctrl.hidden = shouldHide(); + } + + /** + * Handles changes to the selected item. + * @param selectedItem + * @param previousSelectedItem + */ + function selectedItemChange (selectedItem, previousSelectedItem) { + + updateModelValidators(); + + if (selectedItem) { + getDisplayValue(selectedItem).then(function (val) { + $scope.searchText = val; + handleSelectedItemChange(selectedItem, previousSelectedItem); + }); + } else if (previousSelectedItem && $scope.searchText) { + getDisplayValue(previousSelectedItem).then(function(displayValue) { + // Clear the searchText, when the selectedItem is set to null. + // Do not clear the searchText, when the searchText isn't matching with the previous + // selected item. + if (angular.isString($scope.searchText) + && displayValue.toString().toLowerCase() === $scope.searchText.toLowerCase()) { + $scope.searchText = ''; + } + }); + } + + if (selectedItem !== previousSelectedItem) { + announceItemChange(); + } + } + + /** + * Use the user-defined expression to announce changes each time a new item is selected + */ + function announceItemChange () { + angular.isFunction($scope.itemChange) && + $scope.itemChange(getItemAsNameVal($scope.selectedItem)); + } + + /** + * Use the user-defined expression to announce changes each time the search text is changed + */ + function announceTextChange () { + angular.isFunction($scope.textChange) && $scope.textChange(); + } + + /** + * Calls any external watchers listening for the selected item. Used in conjunction with + * `registerSelectedItemWatcher`. + * @param selectedItem + * @param previousSelectedItem + */ + function handleSelectedItemChange (selectedItem, previousSelectedItem) { + selectedItemWatchers.forEach(function (watcher) { + watcher(selectedItem, previousSelectedItem); + }); + } + + /** + * Register a function to be called when the selected item changes. + * @param cb + */ + function registerSelectedItemWatcher (cb) { + if (selectedItemWatchers.indexOf(cb) === -1) { + selectedItemWatchers.push(cb); + } + } + + /** + * Unregister a function previously registered for selected item changes. + * @param cb + */ + function unregisterSelectedItemWatcher (cb) { + var i = selectedItemWatchers.indexOf(cb); + if (i !== -1) { + selectedItemWatchers.splice(i, 1); + } + } + + /** + * Handles changes to the searchText property. + * @param {string} searchText + * @param {string} previousSearchText + */ + function handleSearchText (searchText, previousSearchText) { + ctrl.index = getDefaultIndex(); + + // do nothing on init + if (searchText === previousSearchText) return; + + updateModelValidators(); + + getDisplayValue($scope.selectedItem).then(function (val) { + // clear selected item if search text no longer matches it + if (searchText !== val) { + $scope.selectedItem = null; + + // trigger change event if available + if (searchText !== previousSearchText) { + announceTextChange(); + } + + // cancel results if search text is not long enough + if (!isMinLengthMet()) { + ctrl.matches = []; + + setLoading(false); + reportMessages(true, ReportType.Count); + + } else { + handleQuery(); + } + } + }); + + } + + /** + * Handles input blur event, determines if the dropdown should hide. + * @param {Event=} $event + */ + function blur($event) { + hasFocus = false; + + if (!noBlur) { + ctrl.hidden = shouldHide(); + evalAttr('ngBlur', { $event: $event }); + } else if (angular.isObject($event)) { + $event.stopImmediatePropagation(); + } + } + + /** + * Force blur on input element + * @param {boolean} forceBlur + */ + function doBlur(forceBlur) { + if (forceBlur) { + noBlur = false; + hasFocus = false; + } + elements.input.blur(); + } + + /** + * Handles input focus event, determines if the dropdown should show. + */ + function focus($event) { + hasFocus = true; + + if (isSearchable() && isMinLengthMet()) { + handleQuery(); + } + + ctrl.hidden = shouldHide(); + + evalAttr('ngFocus', { $event: $event }); + } + + /** + * Handles keyboard input. + * @param event + */ + function keydown (event) { + switch (event.keyCode) { + case $mdConstant.KEY_CODE.DOWN_ARROW: + if (ctrl.loading || hasSelection()) return; + event.stopPropagation(); + event.preventDefault(); + ctrl.index = ctrl.index + 1 > ctrl.matches.length - 1 ? 0 : Math.min(ctrl.index + 1, ctrl.matches.length - 1); + $mdUtil.nextTick(updateActiveOption); + updateScroll(); + break; + case $mdConstant.KEY_CODE.UP_ARROW: + if (ctrl.loading || hasSelection()) return; + event.stopPropagation(); + event.preventDefault(); + ctrl.index = ctrl.index - 1 < 0 ? ctrl.matches.length - 1 : Math.max(0, ctrl.index - 1); + $mdUtil.nextTick(updateActiveOption); + updateScroll(); + break; + case $mdConstant.KEY_CODE.TAB: + // If we hit tab, assume that we've left the list so it will close + onListLeave(); + + if (ctrl.hidden || ctrl.loading || ctrl.index < 0 || ctrl.matches.length < 1) return; + select(ctrl.index); + break; + case $mdConstant.KEY_CODE.ENTER: + if (ctrl.hidden || ctrl.loading || ctrl.index < 0 || ctrl.matches.length < 1) return; + if (hasSelection()) return; + event.stopImmediatePropagation(); + event.preventDefault(); + select(ctrl.index); + break; + case $mdConstant.KEY_CODE.ESCAPE: + event.preventDefault(); // Prevent browser from always clearing input + if (!shouldProcessEscape()) return; + event.stopPropagation(); + + clearSelectedItem(); + if ($scope.searchText && hasEscapeOption('clear')) { + clearSearchText(); + } + + // Manually hide (needed for mdNotFound support) + ctrl.hidden = true; + + if (hasEscapeOption('blur')) { + // Force the component to blur if they hit escape + doBlur(true); + } + + break; + default: + } + } + + // getters + + /** + * Returns the minimum length needed to display the dropdown. + * @returns {*} + */ + function getMinLength () { + return angular.isNumber($scope.minLength) ? $scope.minLength : 1; + } + + /** + * Returns the display value for an item. + * @param {*} item + * @returns {*} + */ + function getDisplayValue (item) { + return $q.when(getItemText(item) || item).then(function(itemText) { + if (itemText && !angular.isString(itemText)) { + $log.warn('md-autocomplete: Could not resolve display value to a string. ' + + 'Please check the `md-item-text` attribute.'); + } + + return itemText; + }); + + /** + * Getter function to invoke user-defined expression (in the directive) + * to convert your object to a single string. + * @param {*} item + * @returns {string|null} + */ + function getItemText (item) { + return (item && $scope.itemText) ? $scope.itemText(getItemAsNameVal(item)) : null; + } + } + + /** + * Returns the locals object for compiling item templates. + * @param {*} item + * @returns {Object|undefined} + */ + function getItemAsNameVal (item) { + if (!item) { + return undefined; + } + + var locals = {}; + if (ctrl.itemName) { + locals[ ctrl.itemName ] = item; + } + + return locals; + } + + /** + * Returns the default index based on whether or not autoselect is enabled. + * @returns {number} 0 if autoselect is enabled, -1 if not. + */ + function getDefaultIndex () { + return $scope.autoselect ? 0 : -1; + } + + /** + * Sets the loading parameter and updates the hidden state. + * @param value {boolean} Whether or not the component is currently loading. + */ + function setLoading(value) { + if (ctrl.loading !== value) { + ctrl.loading = value; + } + + // Always refresh the hidden variable as something else might have changed + ctrl.hidden = shouldHide(); + } + + /** + * Determines if the menu should be hidden. + * @returns {boolean} true if the menu should be hidden + */ + function shouldHide () { + return !shouldShow(); + } + + /** + * Determines whether the autocomplete is able to query within the current state. + * @returns {boolean} true if the query can be run + */ + function isSearchable() { + if (ctrl.loading && !hasMatches()) { + // No query when query is in progress. + return false; + } else if (hasSelection()) { + // No query if there is already a selection + return false; + } + else if (!hasFocus) { + // No query if the input does not have focus + return false; + } + return true; + } + + /** + * @returns {boolean} if the escape keydown should be processed, return true. + * Otherwise return false. + */ + function shouldProcessEscape() { + return hasEscapeOption('blur') || !ctrl.hidden || ctrl.loading || hasEscapeOption('clear') && $scope.searchText; + } + + /** + * @param {string} option check if this option is set + * @returns {boolean} if the specified escape option is set, return true. Return false otherwise. + */ + function hasEscapeOption(option) { + if (!angular.isString($scope.escapeOptions)) { + return ctrl.defaultEscapeOptions.indexOf(option) !== -1; + } else { + return $scope.escapeOptions.toLowerCase().indexOf(option) !== -1; + } + } + + /** + * Determines if the menu should be shown. + * @returns {boolean} true if the menu should be shown + */ + function shouldShow() { + if (ctrl.isReadonly) { + // Don't show if read only is set + return false; + } else if (!isSearchable()) { + // Don't show if a query is in progress, there is already a selection, + // or the input is not focused. + return false; + } + return (isMinLengthMet() && hasMatches()) || notFoundVisible(); + } + + /** + * @returns {boolean} true if the search text has matches. + */ + function hasMatches() { + return ctrl.matches.length ? true : false; + } + + /** + * @returns {boolean} true if the autocomplete has a valid selection. + */ + function hasSelection() { + return ctrl.scope.selectedItem ? true : false; + } + + /** + * @returns {boolean} true if the loading indicator is, or should be, visible. + */ + function loadingIsVisible() { + return ctrl.loading && !hasSelection(); + } + + /** + * @returns {*} the display value of the current item. + */ + function getCurrentDisplayValue () { + return getDisplayValue(ctrl.matches[ ctrl.index ]); + } + + /** + * Determines if the minimum length is met by the search text. + * @returns {*} true if the minimum length is met by the search text + */ + function isMinLengthMet () { + return ($scope.searchText || '').length >= getMinLength(); + } + + // actions + + /** + * Defines a public property with a handler and a default value. + * @param {string} key + * @param {Function} handler function + * @param {*} defaultValue default value + */ + function defineProperty (key, handler, defaultValue) { + Object.defineProperty(ctrl, key, { + get: function () { return defaultValue; }, + set: function (newValue) { + var oldValue = defaultValue; + defaultValue = newValue; + handler(newValue, oldValue); + } + }); + } + + /** + * Selects the item at the given index. + * @param {number} index to select + */ + function select (index) { + // force form to update state for validation + $mdUtil.nextTick(function () { + getDisplayValue(ctrl.matches[ index ]).then(function (val) { + var ngModel = elements.$.input.controller('ngModel'); + $mdLiveAnnouncer.announce(val + ' ' + ctrl.selectedMessage, 'assertive'); + ngModel.$setViewValue(val); + ngModel.$render(); + }).finally(function () { + $scope.selectedItem = ctrl.matches[ index ]; + setLoading(false); + }); + }, false); + } + + /** + * Clears the searchText value and selected item. + * @param {Event} $event + */ + function clearValue ($event) { + if ($event) { + $event.stopPropagation(); + } + clearSelectedItem(); + clearSearchText(); + } + + /** + * Clears the selected item + */ + function clearSelectedItem () { + // Reset our variables + ctrl.index = -1; + $mdUtil.nextTick(updateActiveOption); + ctrl.matches = []; + } + + /** + * Clears the searchText value + */ + function clearSearchText () { + // Set the loading to true so we don't see flashes of content. + // The flashing will only occur when an async request is running. + // So the loading process will stop when the results had been retrieved. + setLoading(true); + + $scope.searchText = ''; + + // Normally, triggering the change / input event is unnecessary, because the browser detects it properly. + // But some browsers are not detecting it properly, which means that we have to trigger the event. + // Using the `input` is not working properly, because for example IE11 is not supporting the `input` event. + // The `change` event is a good alternative and is supported by all supported browsers. + var eventObj = document.createEvent('CustomEvent'); + eventObj.initCustomEvent('change', true, true, { value: '' }); + elements.input.dispatchEvent(eventObj); + + // For some reason, firing the above event resets the value of $scope.searchText if + // $scope.searchText has a space character at the end, so we blank it one more time and then + // focus. + elements.input.blur(); + $scope.searchText = ''; + elements.input.focus(); + } + + /** + * Fetches the results for the provided search text. + * @param searchText + */ + function fetchResults (searchText) { + var items = $scope.$parent.$eval(itemExpr), + term = searchText.toLowerCase(), + isList = angular.isArray(items), + isPromise = !!items.then; // Every promise should contain a `then` property + + if (isList) onResultsRetrieved(items); + else if (isPromise) handleAsyncResults(items); + + function handleAsyncResults(items) { + if (!items) return; + + items = $q.when(items); + fetchesInProgress++; + setLoading(true); + + $mdUtil.nextTick(function () { + items + .then(onResultsRetrieved) + .finally(function(){ + if (--fetchesInProgress === 0) { + setLoading(false); + } + }); + },true, $scope); + } + + function onResultsRetrieved(matches) { + cache[term] = matches; + + // Just cache the results if the request is now outdated. + // The request becomes outdated, when the new searchText has changed during the result fetching. + if ((searchText || '') !== ($scope.searchText || '')) { + return; + } + + handleResults(matches); + } + } + + + /** + * Reports given message types to supported screen readers. + * @param {boolean} isPolite Whether the announcement should be polite. + * @param {!number} types Message flags to be reported to the screen reader. + */ + function reportMessages(isPolite, types) { + var politeness = isPolite ? 'polite' : 'assertive'; + var messages = []; + + if (types & ReportType.Selected && ctrl.index !== -1) { + messages.push(getCurrentDisplayValue()); + } + + if (types & ReportType.Count) { + messages.push($q.resolve(getCountMessage())); + } + + $q.all(messages).then(function(data) { + $mdLiveAnnouncer.announce(data.join(' '), politeness); + }); + } + + /** + * @returns {string} the ARIA message for how many results match the current query. + */ + function getCountMessage () { + switch (ctrl.matches.length) { + case 0: + return ctrl.noMatchMessage; + case 1: + return ctrl.singleMatchMessage; + default: + return ctrl.multipleMatchStartMessage + ctrl.matches.length + ctrl.multipleMatchEndMessage; + } + } + + /** + * Makes sure that the focused element is within view. + */ + function updateScroll () { + if (!elements.li[0]) return; + if (mode === MODE_STANDARD) { + updateStandardScroll(); + } else { + updateVirtualScroll(); + } + } + + function updateVirtualScroll() { + // elements in virtual scroll have consistent heights + var optionHeight = elements.li[0].offsetHeight, + top = optionHeight * Math.max(0, ctrl.index), + bottom = top + optionHeight, + containerHeight = elements.scroller.clientHeight, + scrollTop = elements.scroller.scrollTop; + + if (top < scrollTop) { + scrollTo(top); + } else if (bottom > scrollTop + containerHeight) { + scrollTo(bottom - containerHeight); + } + } + + function updateStandardScroll() { + // elements in standard scroll have variable heights + var selected = elements.li[Math.max(0, ctrl.index)]; + var containerHeight = elements.scrollContainer.offsetHeight, + top = selected && selected.offsetTop || 0, + bottom = top + selected.clientHeight, + scrollTop = elements.scrollContainer.scrollTop; + + if (top < scrollTop) { + scrollTo(top); + } else if (bottom > scrollTop + containerHeight) { + scrollTo(bottom - containerHeight); + } + } + + function isPromiseFetching() { + return fetchesInProgress !== 0; + } + + function scrollTo (offset) { + if (mode === MODE_STANDARD) { + elements.scrollContainer.scrollTop = offset; + } else { + elements.$.scrollContainer.controller('mdVirtualRepeatContainer').scrollTo(offset); + } + } + + function notFoundVisible () { + var textLength = (ctrl.scope.searchText || '').length; + + return ctrl.hasNotFound && !hasMatches() && (!ctrl.loading || isPromiseFetching()) && textLength >= getMinLength() && (hasFocus || noBlur) && !hasSelection(); + } + + /** + * Starts the query to gather the results for the current searchText. Attempts to return cached + * results first, then forwards the process to `fetchResults` if necessary. + */ + function handleQuery () { + var searchText = $scope.searchText || ''; + var term = searchText.toLowerCase(); + + // If caching is enabled and the current searchText is stored in the cache + if (!$scope.noCache && cache[term]) { + // The results should be handled as same as a normal un-cached request does. + handleResults(cache[term]); + } else { + fetchResults(searchText); + } + + ctrl.hidden = shouldHide(); + } + + /** + * Handles the retrieved results by showing them in the autocompletes dropdown. + * @param results Retrieved results + */ + function handleResults(results) { + ctrl.matches = results; + ctrl.hidden = shouldHide(); + + // If loading is in progress, then we'll end the progress. This is needed for example, + // when the `clear` button was clicked, because there we always show the loading process, to prevent flashing. + if (ctrl.loading) setLoading(false); + + if ($scope.selectOnMatch) selectItemOnMatch(); + + positionDropdown(); + reportMessages(true, ReportType.Count); + } + + /** + * If there is only one matching item and the search text matches its display value exactly, + * automatically select that item. Note: This function is only called if the user uses the + * `md-select-on-match` flag. + */ + function selectItemOnMatch () { + var searchText = $scope.searchText, + matches = ctrl.matches, + item = matches[ 0 ]; + if (matches.length === 1) getDisplayValue(item).then(function (displayValue) { + var isMatching = searchText === displayValue; + if ($scope.matchInsensitive && !isMatching) { + isMatching = searchText.toLowerCase() === displayValue.toLowerCase(); + } + + if (isMatching) { + select(0); + } + }); + } + + /** + * Evaluates an attribute expression against the parent scope. + * @param {String} attr Name of the attribute to be evaluated. + * @param {Object?} locals Properties to be injected into the evaluation context. + */ + function evalAttr(attr, locals) { + if ($attrs[attr]) { + $scope.$parent.$eval($attrs[attr], locals || {}); + } + } + +} + +})(); +(function(){ +"use strict"; + + +MdAutocomplete.$inject = ["$$mdSvgRegistry"];angular + .module('material.components.autocomplete') + .directive('mdAutocomplete', MdAutocomplete); + +/** + * @ngdoc directive + * @name mdAutocomplete + * @module material.components.autocomplete + * + * @description + * `` is a special input component with a drop-down of all possible matches to a + * custom query. This component allows you to provide real-time suggestions as the user types + * in the input area. + * + * To start, you will need to specify the required parameters and provide a template for your + * results. The content inside `md-autocomplete` will be treated as a template. + * + * In more complex cases, you may want to include other content such as a message to display when + * no matches were found. You can do this by wrapping your template in `md-item-template` and + * adding a tag for `md-not-found`. An example of this is shown below. + * + * To reset the displayed value you must clear both values for `md-search-text` and + * `md-selected-item`. + * + * ### Validation + * + * You can use `ng-messages` to include validation the same way that you would normally validate; + * however, if you want to replicate a standard input with a floating label, you will have to + * do the following: + * + * - Make sure that your template is wrapped in `md-item-template` + * - Add your `ng-messages` code inside of `md-autocomplete` + * - Add your validation properties to `md-autocomplete` (ie. `required`) + * - Add a `name` to `md-autocomplete` (to be used on the generated `input`) + * + * There is an example below of how this should look. + * + * ### Snapping Drop-Down + * + * You can cause the autocomplete drop-down to snap to an ancestor element by applying the + * `md-autocomplete-snap` attribute to that element. You can also snap to the width of + * the `md-autocomplete-snap` element by setting the attribute's value to `width` + * (ie. `md-autocomplete-snap="width"`). + * + * ### Notes + * + * **Autocomplete Dropdown Items Rendering** + * + * The `md-autocomplete` uses the the + * mdVirtualRepeat directive for displaying the results inside of the dropdown.
    + * + * > When encountering issues regarding the item template please take a look at the + * VirtualRepeatContainer documentation. + * + * **Autocomplete inside of a Virtual Repeat** + * + * When using the `md-autocomplete` directive inside of a + * VirtualRepeatContainer the dropdown items + * might not update properly, because caching of the results is enabled by default. + * + * The autocomplete will then show invalid dropdown items, because the Virtual Repeat only updates + * the scope bindings rather than re-creating the `md-autocomplete`. This means that the previous + * cached results will be used. + * + * > To avoid such problems, ensure that the autocomplete does not cache any results via + * `md-no-cache="true"`: + * + * + * + * {{ item.display }} + * + * + * + * + * @param {expression} md-items An expression in the format of `item in results` to iterate over + * matches for your search.

    + * The `results` expression can be also a function, which returns the results synchronously + * or asynchronously (per Promise). + * @param {expression=} md-selected-item-change An expression to be run each time a new item is + * selected. + * @param {expression=} md-search-text-change An expression to be run each time the search text + * updates. + * @param {expression=} md-search-text A model to bind the search query text to. + * @param {object=} md-selected-item A model to bind the selected item to. + * @param {expression=} md-item-text An expression that will convert your object to a single string. + * @param {string=} placeholder Placeholder text that will be forwarded to the input. + * @param {boolean=} md-no-cache Disables the internal caching that happens in autocomplete. + * @param {boolean=} ng-disabled Determines whether or not to disable the input field. + * @param {boolean=} md-require-match When set to true, the autocomplete will add a validator, + * which will evaluate to false, when no item is currently selected. + * @param {number=} md-min-length Specifies the minimum length of text before autocomplete will + * make suggestions. + * @param {number=} md-delay Specifies the amount of time (in milliseconds) to wait before looking + * for results. + * @param {boolean=} md-clear-button Whether the clear button for the autocomplete input should show + * up or not. When `md-floating-label` is set, defaults to false, defaults to true otherwise. + * @param {boolean=} md-autofocus If true, the autocomplete will be automatically focused when a + * `$mdDialog`, `$mdBottomsheet` or `$mdSidenav`, which contains the autocomplete, is opening. + *

    + * Also the autocomplete will immediately focus the input element. + * @param {boolean=} md-no-asterisk When present, asterisk will not be appended to the floating + * label. + * @param {boolean=} md-autoselect If set to true, the first item will be automatically selected + * in the dropdown upon open. + * @param {string=} md-input-name The name attribute given to the input element to be used with + * FormController. + * @param {string=} md-menu-class This class will be applied to the dropdown menu for styling. + * @param {string=} md-menu-container-class This class will be applied to the parent container + * of the dropdown panel. + * @param {string=} md-input-class This will be applied to the input for styling. This attribute + * is only valid when a `md-floating-label` is defined. + * @param {string=} md-floating-label This will add a floating label to autocomplete and wrap it in + * `md-input-container`. + * @param {string=} md-select-on-focus When present the input's text will be automatically selected + * on focus. + * @param {string=} md-input-id An ID to be added to the input element. + * @param {number=} md-input-minlength The minimum length for the input's value for validation. + * @param {number=} md-input-maxlength The maximum length for the input's value for validation. + * @param {boolean=} md-select-on-match When set, autocomplete will automatically select + * the item if the search text is an exact match.

    + * An exact match is when only one match is displayed. + * @param {boolean=} md-match-case-insensitive When set and using `md-select-on-match`, autocomplete + * will select on case-insensitive match. + * @param {string=} md-escape-options Override escape key logic. Default is `clear`.
    + * Options: `blur`, `clear`, `none`. + * @param {string=} md-dropdown-items Specifies the maximum amount of items to be shown in + * the dropdown.

    + * When the dropdown doesn't fit into the viewport, the dropdown will shrink + * as much as possible. + * @param {string=} md-dropdown-position Overrides the default dropdown position. Options: `top`, + * `bottom`. + * @param {string=} input-aria-describedby A space-separated list of element IDs. This should + * contain the IDs of any elements that describe this autocomplete. Screen readers will read the + * content of these elements at the end of announcing that the autocomplete has been selected + * and describing its current state. The descriptive elements do not need to be visible on the + * page. + * @param {string=} input-aria-labelledby A space-separated list of element IDs. The ideal use case + * is that this would contain the ID of a `
    ' : ''; + } + + function getRepeatType(repeatMode) { + return isVirtualRepeatDisabled(repeatMode) ? + 'ng-repeat' : 'md-virtual-repeat'; + } + + function isVirtualRepeatDisabled(repeatMode) { + // ensure we have a valid repeat mode + var correctedRepeatMode = getRepeatMode(repeatMode); + return correctedRepeatMode !== REPEAT_VIRTUAL; + } + + function getInputElement () { + if (attr.mdFloatingLabel) { + return '\ + \ + \ + \ +
    ' + leftover + '
    \ +
    '; + } else { + return '\ + '; + } + } + + function getClearButton() { + return '' + + ''; + } + } + }; +} + +})(); +(function(){ +"use strict"; + + +MdAutocompleteItemScopeDirective.$inject = ["$compile", "$mdUtil"];angular + .module('material.components.autocomplete') + .directive('mdAutocompleteParentScope', MdAutocompleteItemScopeDirective); + +function MdAutocompleteItemScopeDirective($compile, $mdUtil) { + return { + restrict: 'AE', + compile: compile, + terminal: true, + transclude: 'element' + }; + + function compile(tElement, tAttr, transclude) { + return function postLink(scope, element, attr) { + var ctrl = scope.$mdAutocompleteCtrl; + var newScope = ctrl.parent.$new(); + var itemName = ctrl.itemName; + + // Watch for changes to our scope's variables and copy them to the new scope + watchVariable('$index', '$index'); + watchVariable('item', itemName); + + // Ensure that $digest calls on our scope trigger $digest on newScope. + connectScopes(); + + // Link the element against newScope. + transclude(newScope, function(clone) { + element.after(clone); + }); + + /** + * Creates a watcher for variables that are copied from the parent scope + * @param variable + * @param alias + */ + function watchVariable(variable, alias) { + newScope[alias] = scope[variable]; + + scope.$watch(variable, function(value) { + $mdUtil.nextTick(function() { + newScope[alias] = value; + }); + }); + } + + /** + * Creates watchers on scope and newScope that ensure that for any + * $digest of scope, newScope is also $digested. + */ + function connectScopes() { + var scopeDigesting = false; + var newScopeDigesting = false; + + scope.$watch(function() { + if (newScopeDigesting || scopeDigesting) { + return; + } + + scopeDigesting = true; + scope.$$postDigest(function() { + if (!newScopeDigesting) { + newScope.$digest(); + } + + scopeDigesting = newScopeDigesting = false; + }); + }); + + newScope.$watch(function() { + newScopeDigesting = true; + }); + } + }; + } +} +})(); +(function(){ +"use strict"; + + +MdHighlightCtrl.$inject = ["$scope", "$element", "$attrs", "$mdUtil"];angular + .module('material.components.autocomplete') + .controller('MdHighlightCtrl', MdHighlightCtrl); + +function MdHighlightCtrl ($scope, $element, $attrs, $mdUtil) { + this.$scope = $scope; + this.$element = $element; + this.$attrs = $attrs; + this.$mdUtil = $mdUtil; + + // Cache the Regex to avoid rebuilding each time. + this.regex = null; +} + +MdHighlightCtrl.prototype.init = function(unsafeTermFn, unsafeContentFn) { + + this.flags = this.$attrs.mdHighlightFlags || ''; + + this.unregisterFn = this.$scope.$watch(function($scope) { + return { + term: unsafeTermFn($scope), + contentText: unsafeContentFn($scope) + }; + }.bind(this), this.onRender.bind(this), true); + + this.$element.on('$destroy', this.unregisterFn); +}; + +/** + * Triggered once a new change has been recognized and the highlighted + * text needs to be updated. + */ +MdHighlightCtrl.prototype.onRender = function(state, prevState) { + + var contentText = state.contentText; + + /* Update the regex if it's outdated, because we don't want to rebuilt it constantly. */ + if (this.regex === null || state.term !== prevState.term) { + this.regex = this.createRegex(state.term, this.flags); + } + + /* If a term is available apply the regex to the content */ + if (state.term) { + this.applyRegex(contentText); + } else { + this.$element.text(contentText); + } + +}; + +/** + * Decomposes the specified text into different tokens (whether match or not). + * Breaking down the string guarantees proper XSS protection due to the native browser + * escaping of unsafe text. + */ +MdHighlightCtrl.prototype.applyRegex = function(text) { + var tokens = this.resolveTokens(text); + + this.$element.empty(); + + tokens.forEach(function (token) { + + if (token.isMatch) { + var tokenEl = angular.element('').text(token.text); + + this.$element.append(tokenEl); + } else { + this.$element.append(document.createTextNode(token)); + } + + }.bind(this)); + +}; + + /** + * Decomposes the specified text into different tokens by running the regex against the text. + */ +MdHighlightCtrl.prototype.resolveTokens = function(string) { + var tokens = []; + var lastIndex = 0; + + // Use replace here, because it supports global and single regular expressions at same time. + string.replace(this.regex, function(match, index) { + appendToken(lastIndex, index); + + tokens.push({ + text: match, + isMatch: true + }); + + lastIndex = index + match.length; + }); + + // Append the missing text as a token. + appendToken(lastIndex); + + return tokens; + + function appendToken(from, to) { + var targetText = string.slice(from, to); + targetText && tokens.push(targetText); + } +}; + +/** Creates a regex for the specified text with the given flags. */ +MdHighlightCtrl.prototype.createRegex = function(term, flags) { + var startFlag = '', endFlag = ''; + var regexTerm = this.$mdUtil.sanitize(term); + + if (flags.indexOf('^') >= 0) startFlag = '^'; + if (flags.indexOf('$') >= 0) endFlag = '$'; + + return new RegExp(startFlag + regexTerm + endFlag, flags.replace(/[$^]/g, '')); +}; + +})(); +(function(){ +"use strict"; + + +MdHighlight.$inject = ["$interpolate", "$parse"];angular + .module('material.components.autocomplete') + .directive('mdHighlightText', MdHighlight); + +/** + * @ngdoc directive + * @name mdHighlightText + * @module material.components.autocomplete + * + * @description + * The `md-highlight-text` directive allows you to specify text that should be highlighted within + * an element. Highlighted text will be wrapped in `` which can + * be styled through CSS. Please note that child elements may not be used with this directive. + * + * @param {string} md-highlight-text A model to be searched for + * @param {string=} md-highlight-flags A list of flags (loosely based on JavaScript RexExp flags). + * #### **Supported flags**: + * - `g`: Find all matches within the provided text + * - `i`: Ignore case when searching for matches + * - `$`: Only match if the text ends with the search term + * - `^`: Only match if the text begins with the search term + * + * @usage + * + * + *
      + *
    • + * {{result.text}} + *
    • + *
    + *
    + */ + +function MdHighlight ($interpolate, $parse) { + return { + terminal: true, + controller: 'MdHighlightCtrl', + compile: function mdHighlightCompile(tElement, tAttr) { + var termExpr = $parse(tAttr.mdHighlightText); + var unsafeContentExpr = $interpolate(tElement.html()); + + return function mdHighlightLink(scope, element, attr, ctrl) { + ctrl.init(termExpr, unsafeContentExpr); + }; + } + }; +} + +})(); +(function(){ +"use strict"; + +/* + * @ngdoc module + * @name material.components.backdrop + * @description Backdrop + */ + +/** + * @ngdoc directive + * @name mdBackdrop + * @module material.components.backdrop + * + * @restrict E + * + * @description + * `` is a backdrop element used by other components, such as dialog and bottom sheet. + * Apply class `opaque` to make the backdrop use the theme backdrop color. + * + */ + +angular + .module('material.components.backdrop', ['material.core']) + .directive('mdBackdrop', ["$mdTheming", "$mdUtil", "$animate", "$rootElement", "$window", "$log", "$$rAF", "$document", function BackdropDirective($mdTheming, $mdUtil, $animate, $rootElement, $window, $log, $$rAF, $document) { + var ERROR_CSS_POSITION = ' may not work properly in a scrolled, static-positioned parent container.'; + + return { + restrict: 'E', + link: postLink + }; + + function postLink(scope, element, attrs) { + // backdrop may be outside the $rootElement, tell ngAnimate to animate regardless + if ($animate.pin) $animate.pin(element, $rootElement); + + var bodyStyles; + + $$rAF(function() { + // If body scrolling has been disabled using mdUtil.disableBodyScroll(), + // adjust the 'backdrop' height to account for the fixed 'body' top offset. + // Note that this can be pretty expensive and is better done inside the $$rAF. + bodyStyles = $window.getComputedStyle($document[0].body); + + if (bodyStyles.position === 'fixed') { + var resizeHandler = $mdUtil.debounce(function(){ + bodyStyles = $window.getComputedStyle($document[0].body); + resize(); + }, 60, null, false); + + resize(); + angular.element($window).on('resize', resizeHandler); + + scope.$on('$destroy', function() { + angular.element($window).off('resize', resizeHandler); + }); + } + + // Often $animate.enter() is used to append the backDrop element + // so let's wait until $animate is done... + var parent = element.parent(); + + if (parent.length) { + if (parent[0].nodeName === 'BODY') { + element.css('position', 'fixed'); + } + + var styles = $window.getComputedStyle(parent[0]); + + if (styles.position === 'static') { + // backdrop uses position:absolute and will not work properly with parent position:static (default) + $log.warn(ERROR_CSS_POSITION); + } + + // Only inherit the parent if the backdrop has a parent. + $mdTheming.inherit(element, parent); + } + }); + + function resize() { + var viewportHeight = parseInt(bodyStyles.height, 10) + Math.abs(parseInt(bodyStyles.top, 10)); + element.css('height', viewportHeight + 'px'); + } + } + + }]); + +})(); +(function(){ +"use strict"; + +/** + * @ngdoc module + * @name material.components.bottomSheet + * @description + * BottomSheet + */ +MdBottomSheetDirective.$inject = ["$mdBottomSheet"]; +MdBottomSheetProvider.$inject = ["$$interimElementProvider"]; +angular + .module('material.components.bottomSheet', [ + 'material.core', + 'material.components.backdrop' + ]) + .directive('mdBottomSheet', MdBottomSheetDirective) + .provider('$mdBottomSheet', MdBottomSheetProvider); + +/* @ngInject */ +function MdBottomSheetDirective($mdBottomSheet) { + return { + restrict: 'E', + link : function postLink(scope, element) { + element.addClass('_md'); // private md component indicator for styling + + // When navigation force destroys an interimElement, then + // listen and $destroy() that interim instance... + scope.$on('$destroy', function() { + $mdBottomSheet.destroy(); + }); + } + }; +} + + +/** + * @ngdoc service + * @name $mdBottomSheet + * @module material.components.bottomSheet + * + * @description + * `$mdBottomSheet` opens a bottom sheet over the app and provides a simple promise API. + * + * ## Restrictions + * + * - The bottom sheet's template must have an outer `` element. + * - Add the `md-grid` class to the bottom sheet for a grid layout. + * - Add the `md-list` class to the bottom sheet for a list layout. + * + * @usage + * + *
    + * + * Open a Bottom Sheet! + * + *
    + *
    + * + * var app = angular.module('app', ['ngMaterial']); + * app.controller('MyController', function($scope, $mdBottomSheet) { + * $scope.openBottomSheet = function() { + * $mdBottomSheet.show({ + * template: '' + + * 'Hello! Close' + + * '' + * }) + * + * // Fires when the hide() method is used + * .then(function() { + * console.log('You clicked the button to close the bottom sheet!'); + * }) + * + * // Fires when the cancel() method is used + * .catch(function() { + * console.log('You hit escape or clicked the backdrop to close.'); + * }); + * }; + * + * $scope.closeBottomSheet = function($scope, $mdBottomSheet) { + * $mdBottomSheet.hide(); + * } + * + * }); + * + * + * ### Custom Presets + * Developers are also able to create their own preset, which can be easily used without repeating + * their options each time. + * + * + * $mdBottomSheetProvider.addPreset('testPreset', { + * options: function() { + * return { + * template: + * '' + + * 'This is a custom preset' + + * '', + * controllerAs: 'bottomSheet', + * bindToController: true, + * clickOutsideToClose: true, + * escapeToClose: true + * }; + * } + * }); + * + * + * After you create your preset during the config phase, you can easily access it. + * + * + * $mdBottomSheet.show( + * $mdBottomSheet.testPreset() + * ); + * + */ + +/** + * @ngdoc method + * @name $mdBottomSheet#show + * + * @description + * Show a bottom sheet with the specified options. + * + * Note: You should always provide a `.catch()` method in case the user hits the + * `esc` key or clicks the background to close. In this case, the `cancel()` method will + * automatically be called on the bottom sheet which will `reject()` the promise. See the @usage + * section above for an example. + * + * Newer versions of Angular will throw a `Possibly unhandled rejection` exception if you forget + * this. + * + * @param {Object} optionsOrPreset Either provide an `$mdBottomSheetPreset` defined during the + * config phase or an options object, with the following properties: + * + * - `templateUrl` - `{string=}`: The url of an html template file that will + * be used as the content of the bottom sheet. Restrictions: the template must + * have an outer `md-bottom-sheet` element. + * - `template` - `{string=}`: Same as templateUrl, except this is an actual + * template string. + * - `scope` - `{Object=}`: the scope to link the template / controller to. If none is specified, + * it will create a new child scope. This scope will be destroyed when the bottom sheet is + * removed unless `preserveScope` is set to true. + * - `preserveScope` - `{boolean=}`: whether to preserve the scope when the element is removed. + * Default is false + * - `controller` - `{string=}`: The controller to associate with this bottom sheet. + * - `locals` - `{string=}`: An object containing key/value pairs. The keys will be used as names + * of values to inject into the controller. For example, `locals: {three: 3}` would inject + * `three` into the controller with the value of 3. + * - `clickOutsideToClose` - `{boolean=}`: Whether the user can click outside the bottom sheet to + * close it. Default true. + * - `bindToController` - `{boolean=}`: When set to true, the locals will be bound to the + * controller instance and available in it's $onInit function. + * - `disableBackdrop` - `{boolean=}`: When set to true, the bottomsheet will not show a backdrop. + * - `escapeToClose` - `{boolean=}`: Whether the user can press escape to close the bottom sheet. + * Default true. + * - `isLockedOpen` - `{boolean=}`: Disables all default ways of closing the bottom sheet. + * **Note:** this will override the `clickOutsideToClose` and `escapeToClose` options, leaving + * only the `hide` and `cancel` methods as ways of closing the bottom sheet. Defaults to false. + * - `resolve` - `{Object=}`: Similar to locals, except it takes promises as values + * and the bottom sheet will not open until the promises resolve. + * - `controllerAs` - `{string=}`: An alias to assign the controller to on the scope. + * - `parent` - `{element=}`: The element to append the bottom sheet to. The `parent` may be a + * `function`, `string`, `Object`, or null. Defaults to appending to the body of the root element + * (or the root element) of the application. + * e.g. angular.element(document.getElementById('content')) or "#content" + * - `disableParentScroll` - `{boolean=}`: Whether to disable scrolling while the bottom sheet is + * open. Default true. + * + * @returns {promise} A promise that can be resolved with `$mdBottomSheet.hide()` or + * rejected with `$mdBottomSheet.cancel()`. + */ + +/** + * @ngdoc method + * @name $mdBottomSheet#hide + * + * @description + * Hide the existing bottom sheet and resolve the promise returned from + * `$mdBottomSheet.show()`. This call will close the most recently opened/current bottom sheet (if + * any). + * + * Note: Use a `.then()` on your `.show()` to handle this callback. + * + * @param {*=} response An argument for the resolved promise. + * + */ + +/** + * @ngdoc method + * @name $mdBottomSheet#cancel + * + * @description + * Hide the existing bottom sheet and reject the promise returned from + * `$mdBottomSheet.show()`. + * + * Note: Use a `.catch()` on your `.show()` to handle this callback. + * + * @param {*=} response An argument for the rejected promise. + * + */ + +function MdBottomSheetProvider($$interimElementProvider) { + // how fast we need to flick down to close the sheet, pixels/ms + bottomSheetDefaults.$inject = ["$animate", "$mdConstant", "$mdUtil", "$mdTheming", "$mdBottomSheet", "$rootElement", "$mdGesture", "$log"]; + var CLOSING_VELOCITY = 0.5; + var PADDING = 80; // same as css + + return $$interimElementProvider('$mdBottomSheet') + .setDefaults({ + methods: ['disableParentScroll', 'escapeToClose', 'clickOutsideToClose'], + options: bottomSheetDefaults + }); + + /* @ngInject */ + function bottomSheetDefaults($animate, $mdConstant, $mdUtil, $mdTheming, $mdBottomSheet, $rootElement, + $mdGesture, $log) { + var backdrop; + + return { + themable: true, + onShow: onShow, + onRemove: onRemove, + disableBackdrop: false, + escapeToClose: true, + clickOutsideToClose: true, + disableParentScroll: true, + isLockedOpen: false + }; + + function onShow(scope, element, options) { + element = $mdUtil.extractElementByName(element, 'md-bottom-sheet'); + + // prevent tab focus or click focus on the bottom-sheet container + element.attr('tabindex', '-1'); + + // Once the md-bottom-sheet has `ng-cloak` applied on his template the opening animation will not work properly. + // This is a very common problem, so we have to notify the developer about this. + if (element.hasClass('ng-cloak')) { + var message = '$mdBottomSheet: using `` will affect the bottom-sheet opening animations.'; + $log.warn(message, element[0]); + } + + if (options.isLockedOpen) { + options.clickOutsideToClose = false; + options.escapeToClose = false; + } else { + options.cleanupGestures = registerGestures(element, options.parent); + } + + if (!options.disableBackdrop) { + // Add a backdrop that will close on click + backdrop = $mdUtil.createBackdrop(scope, "md-bottom-sheet-backdrop md-opaque"); + + // Prevent mouse focus on backdrop; ONLY programmatic focus allowed. + // This allows clicks on backdrop to propagate to the $rootElement and + // ESC key events to be detected properly. + backdrop[0].tabIndex = -1; + + if (options.clickOutsideToClose) { + backdrop.on('click', function() { + $mdUtil.nextTick($mdBottomSheet.cancel, true); + }); + } + + $mdTheming.inherit(backdrop, options.parent); + + $animate.enter(backdrop, options.parent, null); + } + + $mdTheming.inherit(element, options.parent); + + if (options.disableParentScroll) { + options.restoreScroll = $mdUtil.disableScrollAround(element, options.parent); + } + + return $animate.enter(element, options.parent, backdrop) + .then(function() { + var focusable = $mdUtil.findFocusTarget(element) || angular.element( + element[0].querySelector('button') || + element[0].querySelector('a') || + element[0].querySelector($mdUtil.prefixer('ng-click', true)) + ) || backdrop; + + if (options.escapeToClose) { + options.rootElementKeyupCallback = function(e) { + if (e.keyCode === $mdConstant.KEY_CODE.ESCAPE) { + $mdUtil.nextTick($mdBottomSheet.cancel, true); + } + }; + + $rootElement.on('keyup', options.rootElementKeyupCallback); + focusable && focusable.focus(); + } + }); + + } + + function onRemove(scope, element, options) { + if (!options.disableBackdrop) $animate.leave(backdrop); + + return $animate.leave(element).then(function() { + if (options.disableParentScroll) { + options.restoreScroll(); + delete options.restoreScroll; + } + + options.cleanupGestures && options.cleanupGestures(); + }); + } + + /** + * Adds the drag gestures to the bottom sheet. + * @param {JQLite} element where CSS transitions will be applied + * @param {JQLite} parent used for registering gesture listeners + * @return {Function} function that removes gesture listeners that were set up by + * registerGestures() + */ + function registerGestures(element, parent) { + var deregister = $mdGesture.register(parent, 'drag', { horizontal: false }); + parent.on('$md.dragstart', onDragStart) + .on('$md.drag', onDrag) + .on('$md.dragend', onDragEnd); + + return function cleanupGestures() { + deregister(); + parent.off('$md.dragstart', onDragStart); + parent.off('$md.drag', onDrag); + parent.off('$md.dragend', onDragEnd); + }; + + function onDragStart() { + // Disable transitions on transform so that it feels fast + element.css($mdConstant.CSS.TRANSITION_DURATION, '0ms'); + } + + function onDrag(ev) { + var transform = ev.pointer.distanceY; + if (transform < 5) { + // Slow down drag when trying to drag up, and stop after PADDING + transform = Math.max(-PADDING, transform / 2); + } + element.css($mdConstant.CSS.TRANSFORM, 'translate3d(0,' + (PADDING + transform) + 'px,0)'); + } + + function onDragEnd(ev) { + if (ev.pointer.distanceY > 0 && + (ev.pointer.distanceY > 20 || Math.abs(ev.pointer.velocityY) > CLOSING_VELOCITY)) { + var distanceRemaining = element.prop('offsetHeight') - ev.pointer.distanceY; + var transitionDuration = Math.min(distanceRemaining / ev.pointer.velocityY * 0.75, 500); + element.css($mdConstant.CSS.TRANSITION_DURATION, transitionDuration + 'ms'); + $mdUtil.nextTick($mdBottomSheet.cancel, true); + } else { + element.css($mdConstant.CSS.TRANSITION_DURATION, ''); + element.css($mdConstant.CSS.TRANSFORM, ''); + } + } + } + } +} + +})(); +(function(){ +"use strict"; + +/** + * @ngdoc module + * @name material.components.button + * @description + * + * Button + */ +MdButtonDirective.$inject = ["$mdButtonInkRipple", "$mdTheming", "$mdAria", "$mdInteraction"]; +MdAnchorDirective.$inject = ["$mdTheming"]; +angular + .module('material.components.button', ['material.core']) + .directive('mdButton', MdButtonDirective) + .directive('a', MdAnchorDirective); + + +/** + * @private + * @restrict E + * + * @description + * `a` is an anchor directive used to inherit theme colors for md-primary, md-accent, etc. + * + * @usage + * + * + * + * + * + * + */ +function MdAnchorDirective($mdTheming) { + return { + restrict : 'E', + link : function postLink(scope, element) { + // Make sure to inherit theme so stand-alone anchors + // support theme colors for md-primary, md-accent, etc. + $mdTheming(element); + } + }; +} + + +/** + * @ngdoc directive + * @name mdButton + * @module material.components.button + * + * @restrict E + * + * @description + * `` is a button directive with optional ink ripples (default enabled). + * + * If you supply a `href` or `ng-href` attribute, it will become an `` element. Otherwise, it + * will become a `'; + } + } + + function postLink(scope, element, attr) { + $mdTheming(element); + $mdButtonInkRipple.attach(scope, element); + + // Use async expect to support possible bindings in the button label + $mdAria.expectWithoutText(element, 'aria-label'); + + // For anchor elements, we have to set tabindex manually when the element is disabled. + // We don't do this for md-nav-bar anchors as the component manages its own tabindex values. + if (isAnchor(attr) && angular.isDefined(attr.ngDisabled) && + !element.hasClass('_md-nav-button')) { + scope.$watch(attr.ngDisabled, function(isDisabled) { + element.attr('tabindex', isDisabled ? -1 : 0); + }); + } + + // disabling click event when disabled is true + element.on('click', function(e){ + if (attr.disabled === true) { + e.preventDefault(); + e.stopImmediatePropagation(); + } + }); + + if (!element.hasClass('md-no-focus')) { + + element.on('focus', function() { + + // Only show the focus effect when being focused through keyboard interaction or programmatically + if (!$mdInteraction.isUserInvoked() || $mdInteraction.getLastInteractionType() === 'keyboard') { + element.addClass('md-focused'); + } + + }); + + element.on('blur', function() { + element.removeClass('md-focused'); + }); + } + + } + +} + +})(); +(function(){ +"use strict"; + +/** + * @ngdoc module + * @name material.components.card + * + * @description + * Card components. + */ +mdCardDirective.$inject = ["$mdTheming"]; +angular.module('material.components.card', [ + 'material.core' + ]) + .directive('mdCard', mdCardDirective); + + +/** + * @ngdoc directive + * @name mdCard + * @module material.components.card + * + * @restrict E + * + * @description + * The `` directive is a container element used within `` containers. + * + * An image included as a direct descendant will fill the card's width. If you want to avoid this, + * you can add the `md-image-no-fill` class to the parent element. The `` + * container will wrap text content and provide padding. An `` element can be + * optionally included to put content flush against the bottom edge of the card. + * + * Action buttons can be included in an `` element, similar to ``. + * You can then position buttons using layout attributes. + * + * Card is built with: + * * `` - Header for the card, holds avatar, text and squared image + * - `` - Card avatar + * - `md-user-avatar` - Class for user image + * - `` + * - `` - Contains elements for the card description + * - `md-title` - Class for the card title + * - `md-subhead` - Class for the card sub header + * * `` - Image for the card + * * `` - Card content title + * - `` + * - `md-headline` - Class for the card content title + * - `md-subhead` - Class for the card content sub header + * - `` - Squared image within the title + * - `md-media-sm` - Class for small image + * - `md-media-md` - Class for medium image + * - `md-media-lg` - Class for large image + * - `md-media-xl` - Class for extra large image + * * `` - Card content + * * `` - Card actions + * - `` - Icon actions + * + * Cards have constant width and variable heights; where the maximum height is limited to what can + * fit within a single view on a platform, but it can temporarily expand as needed. + * + * @usage + * ### Card with optional footer + * + * + * image caption + * + *

    Card headline

    + *

    Card content

    + *
    + * + * Card footer + * + *
    + *
    + * + * ### Card with actions + * + * + * image caption + * + *

    Card headline

    + *

    Card content

    + *
    + * + * Action 1 + * Action 2 + * + *
    + *
    + * + * ### Card with header, image, title actions and content + * + * + * + * + * + * + * + * Title + * Sub header + * + * + * image caption + * + * + * Card headline + * Card subheader + * + * + * + * Action 1 + * Action 2 + * + * + * + * + * + * + * + *

    + * Card content + *

    + *
    + *
    + *
    + */ +function mdCardDirective($mdTheming) { + return { + restrict: 'E', + link: function ($scope, $element, attr) { + $element.addClass('_md'); // private md component indicator for styling + $mdTheming($element); + } + }; +} + +})(); +(function(){ +"use strict"; + +/** + * @ngdoc module + * @name material.components.checkbox + * @description Checkbox module! + */ +MdCheckboxDirective.$inject = ["inputDirective", "$mdAria", "$mdConstant", "$mdTheming", "$mdUtil", "$mdInteraction"]; +angular + .module('material.components.checkbox', ['material.core']) + .directive('mdCheckbox', MdCheckboxDirective); + +/** + * @ngdoc directive + * @name mdCheckbox + * @module material.components.checkbox + * @restrict E + * + * @description + * The checkbox directive is used like the normal + * [angular checkbox](https://docs.angularjs.org/api/ng/input/input%5Bcheckbox%5D). + * + * As per the [Material Design spec](https://material.io/archive/guidelines/style/color.html#color-color-palette) + * the checkbox is in the accent color by default. The primary color palette may be used with + * the `md-primary` class. + * + * @param {expression} ng-model Assignable angular expression to data-bind to. + * @param {string=} name Property name of the form under which the control is published. + * @param {expression=} ng-true-value The value to which the expression should be set when selected. + * @param {expression=} ng-false-value The value to which the expression should be set when not + * selected. + * @param {expression=} ng-change Expression to be executed when the model value changes. + * @param {boolean=} md-no-ink If present, disable ink ripple effects. + * @param {string=} aria-label Adds label to checkbox for accessibility. + * Defaults to checkbox's text. If no default text is found, a warning will be logged. + * @param {expression=} md-indeterminate This determines when the checkbox should be rendered as + * 'indeterminate'. If a truthy expression or no value is passed in the checkbox renders in the + * md-indeterminate state. If falsy expression is passed in it just looks like a normal unchecked + * checkbox. The indeterminate, checked, and unchecked states are mutually exclusive. A box + * cannot be in any two states at the same time. Adding the 'md-indeterminate' attribute + * overrides any checked/unchecked rendering logic. When using the 'md-indeterminate' attribute + * use 'ng-checked' to define rendering logic instead of using 'ng-model'. + * @param {expression=} ng-checked If this expression evaluates as truthy, the 'md-checked' css + * class is added to the checkbox and it will appear checked. + * + * @usage + * + * + * Finished ? + * + * + * + * No Ink Effects + * + * + * + * Disabled + * + * + * + * + */ +function MdCheckboxDirective(inputDirective, $mdAria, $mdConstant, $mdTheming, $mdUtil, $mdInteraction) { + inputDirective = inputDirective[0]; + + return { + restrict: 'E', + transclude: true, + require: ['^?mdInputContainer', '?ngModel', '?^form'], + priority: $mdConstant.BEFORE_NG_ARIA, + template: + '
    ' + + '
    ' + + '
    ' + + '
    ', + compile: compile + }; + + // ********************************************************** + // Private Methods + // ********************************************************** + + function compile (tElement, tAttrs) { + tAttrs.$set('tabindex', tAttrs.tabindex || '0'); + tAttrs.$set('type', 'checkbox'); + tAttrs.$set('role', tAttrs.type); + tElement.addClass('md-auto-horizontal-margin'); + + return { + pre: function(scope, element) { + // Attach a click handler during preLink, in order to immediately stop propagation + // (especially for ng-click) when the checkbox is disabled. + element.on('click', function(e) { + if (this.hasAttribute('disabled')) { + e.stopImmediatePropagation(); + } + }); + }, + post: postLink + }; + + function postLink(scope, element, attr, ctrls) { + var isIndeterminate; + var containerCtrl = ctrls[0]; + var ngModelCtrl = ctrls[1] || $mdUtil.fakeNgModel(); + var formCtrl = ctrls[2]; + var labelHasLink = element.find('a').length > 0; + + // The original component structure is not accessible when the checkbox's label contains a link. + // In order to keep backwards compatibility, we're only changing the structure of the component + // when we detect a link within the label. Using a span after the md-checkbox and attaching it + // via aria-labelledby allows screen readers to find and work with the link within the label. + if (labelHasLink) { + var labelId = 'label-' + $mdUtil.nextUid(); + attr.$set('aria-labelledby', labelId); + + var label = element.children()[1]; + // Use jQLite here since ChildNode.remove() is not supported in IE11. + angular.element(label).remove(); + label.removeAttribute('ng-transclude'); + label.className = 'md-checkbox-link-label'; + label.setAttribute('id', labelId); + element.after(label); + // Make sure that clicking on the label still causes the checkbox to be toggled, when appropriate. + var externalLabel = element.next(); + externalLabel.on('click', listener); + } + + if (containerCtrl) { + var isErrorGetter = containerCtrl.isErrorGetter || function() { + return ngModelCtrl.$invalid && (ngModelCtrl.$touched || (formCtrl && formCtrl.$submitted)); + }; + + containerCtrl.input = element; + + scope.$watch(isErrorGetter, containerCtrl.setInvalid); + } + + $mdTheming(element); + + // Redirect focus events to the root element, because IE11 is always focusing the container element instead + // of the md-checkbox element. This causes issues when using ngModelOptions: `updateOnBlur` + element.children().on('focus', function() { + element.focus(); + }); + + if ($mdUtil.parseAttributeBoolean(attr.mdIndeterminate)) { + setIndeterminateState(); + scope.$watch(attr.mdIndeterminate, setIndeterminateState); + } + + if (attr.ngChecked) { + scope.$watch(scope.$eval.bind(scope, attr.ngChecked), function(value) { + ngModelCtrl.$setViewValue(value); + ngModelCtrl.$render(); + }); + } + + $$watchExpr('ngDisabled', 'tabindex', { + true: '-1', + false: attr.tabindex + }); + + // Don't emit a warning when the label has a link within it. In that case we'll use + // aria-labelledby to point to another span that should be read as the label. + if (!labelHasLink) { + $mdAria.expectWithText(element, 'aria-label'); + } + + // Reuse the original input[type=checkbox] directive from AngularJS core. + // This is a bit hacky as we need our own event listener and own render + // function. + inputDirective.link.pre(scope, { + on: angular.noop, + 0: {} + }, attr, [ngModelCtrl]); + + element.on('click', listener) + .on('keypress', keypressHandler) + .on('focus', function() { + if ($mdInteraction.getLastInteractionType() === 'keyboard') { + element.addClass('md-focused'); + } + }) + .on('blur', function() { + element.removeClass('md-focused'); + }); + + ngModelCtrl.$render = render; + + function $$watchExpr(expr, htmlAttr, valueOpts) { + if (attr[expr]) { + scope.$watch(attr[expr], function(val) { + if (valueOpts[val]) { + element.attr(htmlAttr, valueOpts[val]); + } + }); + } + } + + /** + * @param {KeyboardEvent} ev 'keypress' event to handle + */ + function keypressHandler(ev) { + var keyCode = ev.which || ev.keyCode; + var submit, form; + + ev.preventDefault(); + switch (keyCode) { + case $mdConstant.KEY_CODE.SPACE: + element.addClass('md-focused'); + listener(ev); + break; + case $mdConstant.KEY_CODE.ENTER: + // Match the behavior of the native . + // When the enter key is pressed while focusing a native checkbox inside a form, + // the browser will trigger a `click` on the first non-disabled submit button/input + // in the form. Note that this is different from text inputs, which + // will directly submit the form without needing a submit button/input to be present. + form = $mdUtil.getClosest(ev.target, 'form'); + if (form) { + submit = form.querySelector('button[type="submit"]:enabled, input[type="submit"]:enabled'); + if (submit) { + submit.click(); + } + } + break; + } + } + + function listener(ev) { + // skipToggle boolean is used by the switch directive to prevent the click event + // when releasing the drag. There will be always a click if releasing the drag over the checkbox. + // If the click came from a link in the checkbox, don't toggle the value. + // We want the link to be opened without changing the value in this case. + if (element[0].hasAttribute('disabled') || scope.skipToggle || ev.target.tagName === 'A') { + return; + } + + scope.$apply(function() { + // Toggle the checkbox value... + var viewValue = attr.ngChecked && attr.ngClick ? attr.checked : !ngModelCtrl.$viewValue; + + ngModelCtrl.$setViewValue(viewValue, ev && ev.type); + ngModelCtrl.$render(); + }); + } + + function render() { + // Cast the $viewValue to a boolean since it could be undefined + var checked = !!ngModelCtrl.$viewValue && !isIndeterminate; + element.toggleClass('md-checked', checked); + if (!isIndeterminate) { + if (checked) { + element.attr('aria-checked', 'true'); + } else { + element.attr('aria-checked', 'false'); + } + } + } + + /** + * @param {string=} newValue + */ + function setIndeterminateState(newValue) { + isIndeterminate = newValue !== false; + if (isIndeterminate) { + element.attr('aria-checked', 'mixed'); + } + element.toggleClass('md-indeterminate', isIndeterminate); + ngModelCtrl.$render(); + } + } + } +} + +})(); +(function(){ +"use strict"; + +/** + * @ngdoc module + * @name material.components.chips + */ +/* + * @see js folder for chips implementation + */ +angular.module('material.components.chips', [ + 'material.core', + 'material.components.autocomplete' +]); + +})(); +(function(){ +"use strict"; + + +MdChipCtrl.$inject = ["$scope", "$element", "$mdConstant", "$timeout", "$mdUtil"];angular + .module('material.components.chips') + .controller('MdChipCtrl', MdChipCtrl); + +/** + * Controller for the MdChip component. Responsible for handling keyboard + * events and editing the chip if needed. + * + * @param $scope + * @param $element + * @param $mdConstant + * @param $timeout + * @param $mdUtil + * @constructor + */ +function MdChipCtrl ($scope, $element, $mdConstant, $timeout, $mdUtil) { + /** + * @type {$scope} + */ + this.$scope = $scope; + + /** + * @type {$element} + */ + this.$element = $element; + + /** + * @type {$mdConstant} + */ + this.$mdConstant = $mdConstant; + + /** + * @type {$timeout} + */ + this.$timeout = $timeout; + + /** + * @type {$mdUtil} + */ + this.$mdUtil = $mdUtil; + + /** + * @type {boolean} + */ + this.isEditing = false; + + /** + * @type {MdChipsCtrl} + */ + this.parentController = undefined; + + /** + * @type {boolean} + */ + this.enableChipEdit = false; +} + + +/** + * @param {MdChipsCtrl} controller + */ +MdChipCtrl.prototype.init = function(controller) { + this.parentController = controller; + this.enableChipEdit = this.parentController.enableChipEdit; + + if (this.enableChipEdit) { + this.$element.on('keydown', this.chipKeyDown.bind(this)); + this.$element.on('dblclick', this.chipMouseDoubleClick.bind(this)); + this.getChipContent().addClass('_md-chip-content-edit-is-enabled'); + } +}; + + +/** + * @return {Object} first element with the md-chip-content class + */ +MdChipCtrl.prototype.getChipContent = function() { + var chipContents = this.$element[0].getElementsByClassName('md-chip-content'); + return angular.element(chipContents[0]); +}; + + +/** + * When editing the chip, if the user modifies the existing contents, we'll get a span back and + * need to ignore text elements as they only contain blank space. + * `children()` ignores text elements. + * + * When editing the chip, if the user deletes the contents and then enters some new content + * we'll only get a text element back. + * @return {Object} jQuery object representing the content element of the chip + */ +MdChipCtrl.prototype.getContentElement = function() { + var contentElement = angular.element(this.getChipContent().children()[0]); + if (!contentElement || contentElement.length === 0) { + contentElement = angular.element(this.getChipContent().contents()[0]); + } + return contentElement; +}; + + +/** + * @return {number} index of this chip + */ +MdChipCtrl.prototype.getChipIndex = function() { + return parseInt(this.$element.attr('index')); +}; + + +/** + * Update the chip's contents, focus the chip if it's selected, and exit edit mode. + * If the contents were updated to be empty, remove the chip and re-focus the input element. + */ +MdChipCtrl.prototype.goOutOfEditMode = function() { + if (!this.isEditing) { + return; + } + + this.isEditing = false; + this.$element.removeClass('_md-chip-editing'); + this.getChipContent()[0].contentEditable = 'false'; + var chipIndex = this.getChipIndex(); + + var content = this.getContentElement().text(); + if (content) { + this.parentController.updateChipContents(chipIndex, content); + + this.$mdUtil.nextTick(function() { + if (this.parentController.selectedChip === chipIndex) { + this.parentController.focusChip(chipIndex); + } + }.bind(this)); + } else { + this.parentController.removeChipAndFocusInput(chipIndex); + } +}; + + +/** + * Given an HTML element. Selects contents of it. + * @param {Element} node + */ +MdChipCtrl.prototype.selectNodeContents = function(node) { + var range, selection; + if (document.body.createTextRange) { + range = document.body.createTextRange(); + range.moveToElementText(node); + range.select(); + } else if (window.getSelection) { + selection = window.getSelection(); + range = document.createRange(); + range.selectNodeContents(node); + selection.removeAllRanges(); + selection.addRange(range); + } +}; + + +/** + * Presents an input element to edit the contents of the chip. + */ +MdChipCtrl.prototype.goInEditMode = function() { + this.isEditing = true; + this.$element.addClass('_md-chip-editing'); + this.getChipContent()[0].contentEditable = 'true'; + this.getChipContent().on('blur', function() { + this.goOutOfEditMode(); + }.bind(this)); + + this.selectNodeContents(this.getChipContent()[0]); +}; + + +/** + * Handles the keydown event on the chip element. If enable-chip-edit attribute is + * set to true, space or enter keys can trigger going into edit mode. Enter can also + * trigger submitting if the chip is already being edited. + * @param {KeyboardEvent} event + */ +MdChipCtrl.prototype.chipKeyDown = function(event) { + if (!this.isEditing && + (event.keyCode === this.$mdConstant.KEY_CODE.ENTER || + event.keyCode === this.$mdConstant.KEY_CODE.SPACE)) { + event.preventDefault(); + this.goInEditMode(); + } else if (this.isEditing && event.keyCode === this.$mdConstant.KEY_CODE.ENTER) { + event.preventDefault(); + this.goOutOfEditMode(); + } +}; + + +/** + * Enter edit mode if we're not already editing and the enable-chip-edit attribute is enabled. + */ +MdChipCtrl.prototype.chipMouseDoubleClick = function() { + if (this.enableChipEdit && !this.isEditing) { + this.goInEditMode(); + } +}; + +})(); +(function(){ +"use strict"; + + +MdChip.$inject = ["$mdTheming", "$mdUtil", "$compile", "$timeout"];angular + .module('material.components.chips') + .directive('mdChip', MdChip); + +/** + * @ngdoc directive + * @name mdChip + * @module material.components.chips + * + * @description + * `` is a component used within ``. It is responsible for rendering an + * individual chip. + * + * + * @usage + * + * + * {{$chip}} + * + * + * + */ + +/** + * MDChip Directive Definition + * + * @param $mdTheming + * @param $mdUtil + * @param $compile + * @param $timeout + * @ngInject + */ +function MdChip($mdTheming, $mdUtil, $compile, $timeout) { + return { + restrict: 'E', + require: ['^?mdChips', 'mdChip'], + link: postLink, + controller: 'MdChipCtrl' + }; + + function postLink(scope, element, attr, ctrls) { + var chipsController = ctrls.shift(); + var chipController = ctrls.shift(); + var chipContentElement = angular.element(element[0].querySelector('.md-chip-content')); + + $mdTheming(element); + + if (chipsController) { + chipController.init(chipsController); + + // When a chip is blurred, make sure to unset (or reset) the selected chip so that tabbing + // through elements works properly + chipContentElement.on('blur', function() { + chipsController.resetSelectedChip(); + chipsController.$scope.$applyAsync(); + }); + } + + // Use $timeout to ensure we run AFTER the element has been added to the DOM so we can focus it. + $timeout(function() { + if (!chipsController) { + return; + } + + if (chipsController.shouldFocusLastChip) { + chipsController.focusLastChipThenInput(); + } + }); + } +} + +})(); +(function(){ +"use strict"; + + +MdChipRemove.$inject = ["$timeout"];angular + .module('material.components.chips') + .directive('mdChipRemove', MdChipRemove); + +/** + * @ngdoc directive + * @name mdChipRemove + * @restrict A + * @module material.components.chips + * + * @description + * Indicates that the associated element should be used as the delete button template for all chips. + * The associated element must be a child of `md-chips`. + * + * The provided button template will be appended to each chip and will remove the associated chip + * on click. + * + * The button is not styled or themed based on the theme set on the `md-chips` component. A theme + * class and custom icon can be specified in your template. + * + * You can also specify the `type` of the button in your template. + * + * @usage + * ### With Standard Chips + * + * + * + * + * + * + * ### With Object Chips + * + * + * + * + * + */ + + +/** + * MdChipRemove Directive Definition. + * + * @param $timeout + * @returns {{restrict: string, require: string[], link: Function, scope: boolean}} + * @constructor + */ +function MdChipRemove ($timeout) { + return { + restrict: 'A', + require: '^mdChips', + scope: false, + link: postLink + }; + + function postLink(scope, element, attr, ctrl) { + element.on('click', function() { + scope.$apply(function() { + ctrl.removeChip(scope.$$replacedScope.$index); + }); + }); + + // Child elements aren't available until after a $timeout tick as they are hidden by an + // `ng-if`. see http://goo.gl/zIWfuw + $timeout(function() { + element.attr({ 'tabindex': '-1', 'aria-hidden': 'true' }); + element.find('button').attr('tabindex', '-1'); + }); + } +} + +})(); +(function(){ +"use strict"; + + +MdChipTransclude.$inject = ["$compile"];angular + .module('material.components.chips') + .directive('mdChipTransclude', MdChipTransclude); + +function MdChipTransclude ($compile) { + return { + restrict: 'EA', + terminal: true, + link: link, + scope: false + }; + function link (scope, element, attr) { + var ctrl = scope.$parent.$mdChipsCtrl, + newScope = ctrl.parent.$new(false, ctrl.parent); + newScope.$$replacedScope = scope; + newScope.$chip = scope.$chip; + newScope.$index = scope.$index; + newScope.$mdChipsCtrl = ctrl; + + var newHtml = ctrl.$scope.$eval(attr.mdChipTransclude); + + element.html(newHtml); + $compile(element.contents())(newScope); + } +} + +})(); +(function(){ +"use strict"; + +/** + * The default chip append delay. + * + * @type {number} + */ +MdChipsCtrl.$inject = ["$scope", "$attrs", "$mdConstant", "$log", "$element", "$timeout", "$mdUtil", "$mdLiveAnnouncer", "$exceptionHandler"]; +var DEFAULT_CHIP_APPEND_DELAY = 300; + +angular + .module('material.components.chips') + .controller('MdChipsCtrl', MdChipsCtrl); + +/** + * Controller for the MdChips component. Responsible for adding to and + * removing from the list of chips, marking chips as selected, and binding to + * the models of various input components. + * + * @param $scope + * @param $attrs + * @param $mdConstant + * @param $log + * @param $element + * @param $timeout + * @param $mdUtil + * @param $mdLiveAnnouncer + * @param $exceptionHandler + * @constructor + */ +function MdChipsCtrl ($scope, $attrs, $mdConstant, $log, $element, $timeout, $mdUtil, + $mdLiveAnnouncer, $exceptionHandler) { + /** @type {Function} **/ + this.$timeout = $timeout; + + /** @type {Object} */ + this.$mdConstant = $mdConstant; + + /** @type {angular.$scope} */ + this.$scope = $scope; + + /** @type {angular.$scope} */ + this.parent = $scope.$parent; + + /** @type {$mdUtil} */ + this.$mdUtil = $mdUtil; + + /** @type {$log} */ + this.$log = $log; + + /** @type {$mdLiveAnnouncer} */ + this.$mdLiveAnnouncer = $mdLiveAnnouncer; + + /** @type {$exceptionHandler} */ + this.$exceptionHandler = $exceptionHandler; + + /** @type {$element} */ + this.$element = $element; + + /** @type {$attrs} */ + this.$attrs = $attrs; + + /** @type {angular.NgModelController} */ + this.ngModelCtrl = null; + + /** @type {angular.NgModelController} */ + this.userInputNgModelCtrl = null; + + /** @type {MdAutocompleteCtrl} */ + this.autocompleteCtrl = null; + + /** @type {Element} */ + this.userInputElement = null; + + /** @type {Array.} */ + this.items = []; + + /** @type {number} */ + this.selectedChip = -1; + + /** @type {string} */ + this.enableChipEdit = $mdUtil.parseAttributeBoolean($attrs.mdEnableChipEdit); + + /** @type {string} */ + this.addOnBlur = $mdUtil.parseAttributeBoolean($attrs.mdAddOnBlur); + + /** + * The class names to apply to the autocomplete or input. + * @type {string} + */ + this.inputClass = ''; + + /** + * The text to be used as the aria-label for the input. + * @type {string} + */ + this.inputAriaLabel = 'Chips input.'; + + /** + * Label text to describe the chips container. Used to give context and instructions to screen + * reader users when the chips container is selected. + * @type {string} + */ + this.containerHint = 'Chips container. Use arrow keys to select chips.'; + + /** + * Label text to describe the chips container when it is empty. Used to give context and + * instructions to screen reader users when the chips container is selected and it contains + * no chips. + * @type {string} + */ + this.containerEmptyHint = + 'Chips container. Enter the text area, then type text, and press enter to add a chip.'; + + /** + * Hidden hint text for how to delete a chip. Used to give context to screen readers. + * @type {string} + */ + this.deleteHint = 'Press delete to remove this chip.'; + + /** + * Hidden label for the delete button. Used to give context to screen readers. + * @type {string} + */ + this.deleteButtonLabel = 'Remove'; + + /** + * Model used by the input element. + * @type {string} + */ + this.chipBuffer = ''; + + /** + * Whether to use the transformChip expression to transform the chip buffer + * before appending it to the list. + * @type {boolean} + */ + this.useTransformChip = false; + + /** + * Whether to use the onAdd expression to notify of chip additions. + * @type {boolean} + */ + this.useOnAdd = false; + + /** + * Whether to use the onRemove expression to notify of chip removals. + * @type {boolean} + */ + this.useOnRemove = false; + + /** + * The ID of the chips wrapper which is used to build unique IDs for the chips and the aria-owns + * attribute. + * + * Defaults to '_md-chips-wrapper-' plus a unique number. + * + * @type {string} + */ + this.wrapperId = ''; + + /** + * Array of unique numbers which will be auto-generated any time the items change, and is used to + * create unique IDs for the aria-owns attribute. + * + * @type {Array} + */ + this.contentIds = []; + + /** + * The index of the chip that should have it's `tabindex` property set to `0` so it is selectable + * via the keyboard. + * + * @type {number|null} + */ + this.ariaTabIndex = null; + + /** + * After appending a chip, the chip will be focused for this number of milliseconds before the + * input is refocused. + * + * **Note:** This is **required** for compatibility with certain screen readers in order for + * them to properly allow keyboard access. + * + * @type {number} + */ + this.chipAppendDelay = DEFAULT_CHIP_APPEND_DELAY; + + /** + * Collection of functions to call to un-register watchers + * + * @type {Array} + */ + this.deRegister = []; + + /** + * The screen reader will announce the chip content followed by this message when a chip is added. + * @type {string} + */ + this.addedMessage = 'added'; + + /** + * The screen reader will announce the chip content followed by this message when a chip is + * removed. + * @type {string} + */ + this.removedMessage = 'removed'; + + this.init(); +} + +/** + * Initializes variables and sets up watchers + */ +MdChipsCtrl.prototype.init = function() { + var ctrl = this; + + // Set the wrapper ID + this.wrapperId = '_md-chips-wrapper-' + this.$mdUtil.nextUid(); + + // If we're using static chips, then we need to initialize a few things. + if (!this.$element.attr('ng-model')) { + this.setupStaticChips(); + } + + // Setup a watcher which manages the role and aria-owns attributes. + // This is never called for static chips since items is not defined. + this.deRegister.push( + this.$scope.$watchCollection('$mdChipsCtrl.items', function() { + // Make sure our input and wrapper have the correct ARIA attributes + ctrl.setupInputAria(); + ctrl.setupWrapperAria(); + }) + ); + + this.deRegister.push( + this.$attrs.$observe('mdChipAppendDelay', function(newValue) { + ctrl.chipAppendDelay = parseInt(newValue) || DEFAULT_CHIP_APPEND_DELAY; + }) + ); +}; + +/** + * Destructor for cleanup + */ +MdChipsCtrl.prototype.$onDestroy = function $onDestroy() { + var $destroyFn; + while (($destroyFn = this.deRegister.pop())) { + $destroyFn.call(this); + } +}; + +/** + * If we have an input, ensure it has the appropriate ARIA attributes. + */ +MdChipsCtrl.prototype.setupInputAria = function() { + var input = this.$element.find('input'); + + // If we have no input, just return + if (!input) { + return; + } + + input.attr('role', 'textbox'); + input.attr('aria-multiline', true); + if (this.inputAriaDescribedBy) { + input.attr('aria-describedby', this.inputAriaDescribedBy); + } + if (this.inputAriaLabelledBy) { + input.attr('aria-labelledby', this.inputAriaLabelledBy); + input.removeAttr('aria-label'); + } else { + input.attr('aria-label', this.inputAriaLabel); + } +}; + +/** + * Ensure our wrapper has the appropriate ARIA attributes. + */ +MdChipsCtrl.prototype.setupWrapperAria = function() { + var ctrl = this, + wrapper = this.$element.find('md-chips-wrap'); + + if (this.items && this.items.length) { + // Dynamically add the listbox role on every change because it must be removed when there are + // no items. + wrapper.attr('role', 'listbox'); + + // Generate some random (but unique) IDs for each chip + this.contentIds = this.items.map(function() { + return ctrl.wrapperId + '-chip-' + ctrl.$mdUtil.nextUid(); + }); + + // Use the contentIDs above to generate the aria-owns attribute + wrapper.attr('aria-owns', this.contentIds.join(' ')); + wrapper.attr('aria-label', this.containerHint); + } else { + // If we have no items, then the role and aria-owns attributes MUST be removed + wrapper.removeAttr('role'); + wrapper.removeAttr('aria-owns'); + wrapper.attr('aria-label', this.containerEmptyHint); + } +}; + +/** + * Apply specific roles and aria attributes for static chips + */ +MdChipsCtrl.prototype.setupStaticChips = function() { + var ctrl = this, i, staticChips; + var wrapper = this.$element.find('md-chips-wrap'); + + this.$timeout(function() { + wrapper.attr('role', 'list'); + staticChips = wrapper[0].children; + for (i = 0; i < staticChips.length; i++) { + staticChips[i].setAttribute('role', 'listitem'); + staticChips[i].setAttribute('aria-setsize', staticChips.length); + } + if (ctrl.inputAriaDescribedBy) { + wrapper.attr('aria-describedby', ctrl.inputAriaDescribedBy); + } + if (ctrl.inputAriaLabelledBy) { + wrapper.attr('aria-labelledby', ctrl.inputAriaLabelledBy); + wrapper.removeAttr('aria-label'); + } else { + wrapper.attr('aria-label', ctrl.inputAriaLabel); + } + }, 10); +}; + +/** + * Handles the keydown event on the input element: by default appends + * the buffer to the chip list, while backspace removes the last chip in the + * list if the current buffer is empty. + * @param {jQuery.Event|KeyboardEvent} event + */ +MdChipsCtrl.prototype.inputKeydown = function(event) { + var chipBuffer = this.getChipBuffer(); + + // If we have an autocomplete, and it handled the event, we have nothing to do + if (this.autocompleteCtrl && event.isDefaultPrevented && event.isDefaultPrevented()) { + return; + } + + if (event.keyCode === this.$mdConstant.KEY_CODE.BACKSPACE) { + // Only select and focus the previous chip, if the current caret position of the + // input element is at the beginning. + if (this.getCursorPosition(event.target) !== 0) { + return; + } + + event.preventDefault(); + event.stopPropagation(); + + if (this.items.length) { + this.selectAndFocusChipSafe(this.items.length - 1); + } + + return; + } + + // By default appends the buffer to the chip list. + if (!this.separatorKeys || this.separatorKeys.length < 1) { + this.separatorKeys = [this.$mdConstant.KEY_CODE.ENTER]; + } + + // Support additional separator key codes in an array of `md-separator-keys`. + if (this.separatorKeys.indexOf(event.keyCode) !== -1) { + if ((this.autocompleteCtrl && this.requireMatch) || !chipBuffer) return; + event.preventDefault(); + + // Only append the chip and reset the chip buffer if the max chips limit isn't reached. + if (this.hasMaxChipsReached()) return; + + this.appendChip(chipBuffer.trim()); + this.resetChipBuffer(); + + return false; + } +}; + +/** + * Returns the cursor position of the specified input element. + * @param {HTMLInputElement} element relevant input element + * @returns {Number} Cursor Position of the input. + */ +MdChipsCtrl.prototype.getCursorPosition = function(element) { + /* + * Figure out whether the current input for the chips buffer is valid for using + * the selectionStart / end property to retrieve the cursor position. + * Some browsers do not allow the use of those attributes, on different input types. + */ + try { + if (element.selectionStart === element.selectionEnd) { + return element.selectionStart; + } + } catch (e) { + if (!element.value) { + return 0; + } + } +}; + + +/** + * Updates the content of the chip at given index + * @param {number} chipIndex + * @param {string} chipContents + */ +MdChipsCtrl.prototype.updateChipContents = function(chipIndex, chipContents) { + if (chipIndex >= 0 && chipIndex < this.items.length) { + this.items[chipIndex] = chipContents; + this.updateNgModel(true); + } +}; + + +/** + * @return {boolean} true if a chip is currently being edited. False otherwise. + */ +MdChipsCtrl.prototype.isEditingChip = function() { + return !!this.$element[0].querySelector('._md-chip-editing'); +}; + +/** + * @param {string|Object} chip contents of a single chip + * @returns {boolean} true if the chip is an Object, false otherwise. + * @private + */ +MdChipsCtrl.prototype._isChipObject = function(chip) { + return angular.isObject(chip); +}; + +/** + * @returns {boolean} true if chips can be removed, false otherwise. + */ +MdChipsCtrl.prototype.isRemovable = function() { + // Return false if we have static chips + if (!this.ngModelCtrl) { + return false; + } + + return this.readonly ? this.removable : + angular.isDefined(this.removable) ? this.removable : true; +}; + +/** + * Handles the keydown event on the chip elements: backspace removes the selected chip, arrow + * keys switch which chip is active. + * @param {KeyboardEvent} event + */ +MdChipsCtrl.prototype.chipKeydown = function (event) { + if (this.getChipBuffer()) return; + if (this.isEditingChip()) return; + + switch (event.keyCode) { + case this.$mdConstant.KEY_CODE.BACKSPACE: + case this.$mdConstant.KEY_CODE.DELETE: + if (this.selectedChip < 0) return; + event.preventDefault(); + // Cancel the delete action only after the event cancel. Otherwise the page will go back. + if (!this.isRemovable()) return; + this.removeAndSelectAdjacentChip(this.selectedChip, event); + break; + case this.$mdConstant.KEY_CODE.LEFT_ARROW: + event.preventDefault(); + // By default, allow selection of -1 which will focus the input; if we're readonly, don't go + // below 0. + if (this.selectedChip < 0 || (this.readonly && this.selectedChip === 0)) { + this.selectedChip = this.items.length; + } + if (this.items.length) this.selectAndFocusChipSafe(this.selectedChip - 1); + break; + case this.$mdConstant.KEY_CODE.RIGHT_ARROW: + event.preventDefault(); + this.selectAndFocusChipSafe(this.selectedChip + 1); + break; + case this.$mdConstant.KEY_CODE.ESCAPE: + case this.$mdConstant.KEY_CODE.TAB: + if (this.selectedChip < 0) return; + event.preventDefault(); + this.onFocus(); + break; + } +}; + +/** + * Get the input's placeholder - uses `placeholder` when list is empty and `secondary-placeholder` + * when the list is non-empty. If `secondary-placeholder` is not provided, `placeholder` is used + * always. + * @returns {string} + */ +MdChipsCtrl.prototype.getPlaceholder = function() { + // Allow `secondary-placeholder` to be blank. + var useSecondary = (this.items && this.items.length && + (this.secondaryPlaceholder === '' || this.secondaryPlaceholder)); + return useSecondary ? this.secondaryPlaceholder : this.placeholder; +}; + +/** + * Removes chip at {@code index} and selects the adjacent chip. + * @param {number} index adjacent chip to select + * @param {Event=} event + */ +MdChipsCtrl.prototype.removeAndSelectAdjacentChip = function(index, event) { + var self = this; + var selIndex = self.getAdjacentChipIndex(index); + var wrap = this.$element[0].querySelector('md-chips-wrap'); + var chip = this.$element[0].querySelector('md-chip[index="' + index + '"]'); + + self.removeChip(index, event); + + // The double-timeout is currently necessary to ensure that the DOM has finalized and the select() + // will find the proper chip since the selection is index-based. + // + // TODO: Investigate calling from within chip $scope.$on('$destroy') to reduce/remove timeouts + self.$timeout(function() { + self.$timeout(function() { + self.selectAndFocusChipSafe(selIndex); + }); + }); +}; + +/** + * Sets the selected chip index to -1. + */ +MdChipsCtrl.prototype.resetSelectedChip = function() { + this.selectedChip = -1; + this.ariaTabIndex = null; +}; + +/** + * Gets the index of an adjacent chip to select after deletion. Adjacency is + * determined as the next chip in the list, unless the target chip is the + * last in the list, then it is the chip immediately preceding the target. If + * there is only one item in the list, -1 is returned (select none). + * The number returned is the index to select AFTER the target has been removed. + * If the current chip is not selected, then -1 is returned to select none. + * @param {number} index + * @returns {number} + */ +MdChipsCtrl.prototype.getAdjacentChipIndex = function(index) { + var len = this.items.length - 1; + return (len === 0) ? -1 : + (index === len) ? index - 1 : index; +}; + +/** + * Append the contents of the buffer to the chip list. This method will first + * call out to the md-transform-chip method, if provided. + * @param {string} newChip chip buffer contents that will be used to create the new chip + */ +MdChipsCtrl.prototype.appendChip = function(newChip) { + this.shouldFocusLastChip = !this.addOnBlur; + if (this.useTransformChip && this.transformChip) { + var transformedChip = this.transformChip({'$chip': newChip}); + + // Check to make sure the chip is defined before assigning it, otherwise, we'll just assume + // they want the string version. + if (angular.isDefined(transformedChip)) { + newChip = transformedChip; + } + } + + // If items contains an identical object to newChip, do not append + if (angular.isObject(newChip)) { + var identical = this.items.some(function(item) { + return angular.equals(newChip, item); + }); + if (identical) return; + } + + // Check for a null (but not undefined), or existing chip and cancel appending + if (newChip == null || this.items.indexOf(newChip) + 1) return; + + // Append the new chip onto our list + var length = this.items.push(newChip); + var index = length - 1; + + this.updateNgModel(); + + // Tell screen reader users that the chip was successfully added. + // TODO add a way for developers to specify which field of the object should be announced here. + var chipContent = angular.isObject(newChip) ? '' : newChip; + this.$mdLiveAnnouncer.announce(chipContent + ' ' + this.addedMessage, 'assertive'); + + // If the md-on-add attribute is specified, send a chip addition event + if (this.useOnAdd && this.onAdd) { + this.onAdd({ '$chip': newChip, '$index': index }); + } +}; + +/** + * Sets whether to use the md-transform-chip expression. This expression is + * bound to scope and controller in {@code MdChipsDirective} as + * {@code transformChip}. Due to the nature of directive scope bindings, the + * controller cannot know on its own/from the scope whether an expression was + * actually provided. + */ +MdChipsCtrl.prototype.useTransformChipExpression = function() { + this.useTransformChip = true; +}; + +/** + * Sets whether to use the md-on-add expression. This expression is + * bound to scope and controller in {@code MdChipsDirective} as + * {@code onAdd}. Due to the nature of directive scope bindings, the + * controller cannot know on its own/from the scope whether an expression was + * actually provided. + */ +MdChipsCtrl.prototype.useOnAddExpression = function() { + this.useOnAdd = true; +}; + +/** + * Sets whether to use the md-on-remove expression. This expression is + * bound to scope and controller in {@code MdChipsDirective} as + * {@code onRemove}. Due to the nature of directive scope bindings, the + * controller cannot know on its own/from the scope whether an expression was + * actually provided. + */ +MdChipsCtrl.prototype.useOnRemoveExpression = function() { + this.useOnRemove = true; +}; + +/** + * Sets whether to use the md-on-select expression. This expression is + * bound to scope and controller in {@code MdChipsDirective} as + * {@code onSelect}. Due to the nature of directive scope bindings, the + * controller cannot know on its own/from the scope whether an expression was + * actually provided. + */ +MdChipsCtrl.prototype.useOnSelectExpression = function() { + this.useOnSelect = true; +}; + +/** + * Gets the input buffer. The input buffer can be the model bound to the + * default input item {@code this.chipBuffer}, the {@code selectedItem} + * model of an {@code md-autocomplete}, or, through some magic, the model + * bound to any input or text area element found within a + * {@code md-input-container} element. + * @return {string} the input buffer + */ +MdChipsCtrl.prototype.getChipBuffer = function() { + var chipBuffer = !this.userInputElement ? this.chipBuffer : + this.userInputNgModelCtrl ? this.userInputNgModelCtrl.$viewValue : + this.userInputElement[0].value; + + // Ensure that the chip buffer is always a string. For example, the input element buffer + // might be falsy. + return angular.isString(chipBuffer) ? chipBuffer : ''; +}; + +/** + * Resets the input buffer for either the internal input or user provided input element. + */ +MdChipsCtrl.prototype.resetChipBuffer = function() { + if (this.userInputElement) { + if (this.userInputNgModelCtrl) { + this.userInputNgModelCtrl.$setViewValue(''); + this.userInputNgModelCtrl.$render(); + } else { + this.userInputElement[0].value = ''; + } + } else { + this.chipBuffer = ''; + } +}; + +/** + * @returns {boolean} true if the max chips limit has been reached, false otherwise. + */ +MdChipsCtrl.prototype.hasMaxChipsReached = function() { + if (angular.isString(this.maxChips)) { + this.maxChips = parseInt(this.maxChips, 10) || 0; + } + + return this.maxChips > 0 && this.items.length >= this.maxChips; +}; + +/** + * Updates the validity properties for the ngModel. + * + * TODO add the md-max-chips validator to this.ngModelCtrl.validators so that the validation will + * be performed automatically. + */ +MdChipsCtrl.prototype.validateModel = function() { + this.ngModelCtrl.$setValidity('md-max-chips', !this.hasMaxChipsReached()); + this.ngModelCtrl.$validate(); // rerun any registered validators +}; + +/** + * Function to handle updating the model, validation, and change notification when a chip + * is added, removed, or changed. + * @param {boolean=} skipValidation true to skip calling validateModel() + */ +MdChipsCtrl.prototype.updateNgModel = function(skipValidation) { + if (!skipValidation) { + this.validateModel(); + } + // This will trigger ng-change to fire, even in cases where $setViewValue() would not. + angular.forEach(this.ngModelCtrl.$viewChangeListeners, function(listener) { + try { + listener(); + } catch (e) { + this.$exceptionHandler(e); + } + }); +}; + +/** + * Removes the chip at the given index. + * @param {number} index of chip to remove + * @param {Event=} event optionally passed to the onRemove callback + */ +MdChipsCtrl.prototype.removeChip = function(index, event) { + var removed = this.items.splice(index, 1); + + this.updateNgModel(); + this.ngModelCtrl.$setDirty(); + + // Tell screen reader users that the chip was successfully removed. + // TODO add a way for developers to specify which field of the object should be announced here. + var chipContent = angular.isObject(removed[0]) ? '' : removed[0]; + this.$mdLiveAnnouncer.announce(chipContent + ' ' + this.removedMessage, 'assertive'); + + if (removed && removed.length && this.useOnRemove && this.onRemove) { + this.onRemove({ '$chip': removed[0], '$index': index, '$event': event }); + } +}; + +/** + * @param {number} index location of chip to remove + * @param {Event=} $event + */ +MdChipsCtrl.prototype.removeChipAndFocusInput = function (index, $event) { + this.removeChip(index, $event); + + if (this.autocompleteCtrl) { + // Always hide the autocomplete dropdown before focusing the autocomplete input. + // Wait for the input to move horizontally, because the chip was removed. + // This can lead to an incorrect dropdown position. + this.autocompleteCtrl.hidden = true; + this.$mdUtil.nextTick(this.onFocus.bind(this)); + } else { + this.onFocus(); + } + +}; +/** + * Selects the chip at `index`, + * @param {number} index location of chip to select and focus + */ +MdChipsCtrl.prototype.selectAndFocusChipSafe = function(index) { + // If we have no chips, or are asked to select a chip before the first, just focus the input + if (!this.items.length || index === -1) { + return this.focusInput(); + } + + // If we are asked to select a chip greater than the number of chips... + if (index >= this.items.length) { + if (this.readonly) { + // If we are readonly, jump back to the start (because we have no input) + index = 0; + } else { + // If we are not readonly, we should attempt to focus the input + return this.onFocus(); + } + } + + index = Math.max(index, 0); + index = Math.min(index, this.items.length - 1); + + this.selectChip(index); + this.focusChip(index); +}; + +/** + * Focus last chip, then focus the input. This is needed for screen reader support. + */ +MdChipsCtrl.prototype.focusLastChipThenInput = function() { + var ctrl = this; + + ctrl.shouldFocusLastChip = false; + + ctrl.focusChip(this.items.length - 1); + + ctrl.$timeout(function() { + ctrl.focusInput(); + }, ctrl.chipAppendDelay); +}; + +/** + * Focus the input element. + */ +MdChipsCtrl.prototype.focusInput = function() { + this.selectChip(-1); + this.onFocus(); +}; + +/** + * Marks the chip at the given index as selected. + * @param {number} index location of chip to select + */ +MdChipsCtrl.prototype.selectChip = function(index) { + if (index >= -1 && index <= this.items.length) { + this.selectedChip = index; + + // Fire the onSelect if provided + if (this.useOnSelect && this.onSelect) { + this.onSelect({'$chip': this.items[index] }); + } + } else { + this.$log.warn('Selected Chip index out of bounds; ignoring.'); + } +}; + +/** + * Call {@code focus()} on the chip at {@code index} + * @param {number} index location of chip to focus + */ +MdChipsCtrl.prototype.focusChip = function(index) { + var chipContent = this.$element[0].querySelector( + 'md-chip[index="' + index + '"] .md-chip-content' + ); + + this.ariaTabIndex = index; + + chipContent.focus(); +}; + +/** + * Configures the required interactions with the ngModel Controller. + * Specifically, set {@code this.items} to the {@code NgModelController#$viewValue}. + * @param {NgModelController} ngModelCtrl + */ +MdChipsCtrl.prototype.configureNgModel = function(ngModelCtrl) { + this.ngModelCtrl = ngModelCtrl; + + var self = this; + + // in chips the meaning of $isEmpty changes + ngModelCtrl.$isEmpty = function(value) { + return !value || value.length === 0; + }; + + ngModelCtrl.$render = function() { + // model is updated. do something. + self.items = self.ngModelCtrl.$viewValue; + }; +}; + +MdChipsCtrl.prototype.onFocus = function () { + var input = this.$element[0].querySelector('input'); + input && input.focus(); + this.resetSelectedChip(); +}; + +MdChipsCtrl.prototype.onInputFocus = function () { + this.inputHasFocus = true; + + // Make sure we have the appropriate ARIA attributes + this.setupInputAria(); + + // Make sure we don't have any chips selected + this.resetSelectedChip(); +}; + +MdChipsCtrl.prototype.onInputBlur = function () { + this.inputHasFocus = false; + + if (this.shouldAddOnBlur()) { + this.appendChip(this.getChipBuffer().trim()); + this.resetChipBuffer(); + } +}; + +/** + * Configure event bindings on input element. + * @param {angular.element} inputElement + */ +MdChipsCtrl.prototype.configureInput = function configureInput(inputElement) { + // Find the NgModelCtrl for the input element + var ngModelCtrl = inputElement.controller('ngModel'); + var ctrl = this; + + if (ngModelCtrl) { + + // sync touched-state from inner input to chips-element + this.deRegister.push( + this.$scope.$watch( + function() { + return ngModelCtrl.$touched; + }, + function(isTouched) { + isTouched && ctrl.ngModelCtrl.$setTouched(); + } + ) + ); + + // sync dirty-state from inner input to chips-element + this.deRegister.push( + this.$scope.$watch( + function() { + return ngModelCtrl.$dirty; + }, + function(isDirty) { + isDirty && ctrl.ngModelCtrl.$setDirty(); + } + ) + ); + } +}; + +/** + * Configure event bindings on a user-provided input element. + * @param {angular.element} inputElement + */ +MdChipsCtrl.prototype.configureUserInput = function(inputElement) { + this.userInputElement = inputElement; + + // Find the NgModelCtrl for the input element + var ngModelCtrl = inputElement.controller('ngModel'); + // `.controller` will look in the parent as well. + if (ngModelCtrl !== this.ngModelCtrl) { + this.userInputNgModelCtrl = ngModelCtrl; + } + + var scope = this.$scope; + var ctrl = this; + + // Run all of the events using evalAsync because a focus may fire a blur in the same digest loop + var scopeApplyFn = function(event, fn) { + scope.$evalAsync(angular.bind(ctrl, fn, event)); + }; + + // Bind to keydown and focus events of input + inputElement + .attr({ tabindex: 0 }) + .on('keydown', function(event) { scopeApplyFn(event, ctrl.inputKeydown); }) + .on('focus', function(event) { scopeApplyFn(event, ctrl.onInputFocus); }) + .on('blur', function(event) { scopeApplyFn(event, ctrl.onInputBlur); }); +}; + +/** + * @param {MdAutocompleteCtrl} ctrl controller from the autocomplete component + */ +MdChipsCtrl.prototype.configureAutocomplete = function(ctrl) { + if (ctrl) { + this.autocompleteCtrl = ctrl; + // Update the default container empty hint when we're inside of an autocomplete. + if (!this.$element.attr('container-empty-hint')) { + this.containerEmptyHint = 'Chips container with autocompletion. Enter the text area, ' + + 'type text to search, and then use the up and down arrow keys to select an option. ' + + 'Press enter to add the selected option as a chip.'; + this.setupWrapperAria(); + } + + ctrl.registerSelectedItemWatcher(angular.bind(this, function (item) { + if (item) { + // Only append the chip and reset the chip buffer if the max chips limit isn't reached. + if (this.hasMaxChipsReached()) return; + + this.appendChip(item); + this.resetChipBuffer(); + } + })); + + this.$element.find('input') + .on('focus',angular.bind(this, this.onInputFocus)) + .on('blur', angular.bind(this, this.onInputBlur)); + } +}; + +/** + * @returns {boolean} Whether the current chip buffer should be added on input blur or not. + */ +MdChipsCtrl.prototype.shouldAddOnBlur = function() { + + // Update the custom ngModel validators from the chips component. + this.validateModel(); + + var chipBuffer = this.getChipBuffer().trim(); + // If the model value is empty and required is set on the element, then the model will be invalid. + // In that case, we still want to allow adding the chip. The main (but not only) case we want + // to disallow is adding a chip on blur when md-max-chips validation fails. + var isModelValid = this.ngModelCtrl.$isEmpty(this.ngModelCtrl.$modelValue) || + this.ngModelCtrl.$valid; + var isAutocompleteShowing = this.autocompleteCtrl && !this.autocompleteCtrl.hidden; + + if (this.userInputNgModelCtrl) { + isModelValid = isModelValid && this.userInputNgModelCtrl.$valid; + } + + return this.addOnBlur && !this.requireMatch && chipBuffer && isModelValid && + !isAutocompleteShowing; +}; + +/** + * @returns {boolean} true if the input or a chip is focused. False otherwise. + */ +MdChipsCtrl.prototype.hasFocus = function () { + return this.inputHasFocus || this.selectedChip >= 0; +}; + +/** + * @param {number} index location of content id + * @returns {number} unique id for the aria-owns attribute + */ +MdChipsCtrl.prototype.contentIdFor = function(index) { + return this.contentIds[index]; +}; + +})(); +(function(){ +"use strict"; + + + MdChips.$inject = ["$mdTheming", "$mdUtil", "$compile", "$log", "$timeout", "$$mdSvgRegistry"];angular + .module('material.components.chips') + .directive('mdChips', MdChips); + + /** + * @ngdoc directive + * @name mdChips + * @module material.components.chips + * + * @description + * `` is an input component for building lists of strings or objects. The list items are + * displayed as 'chips'. This component can make use of an `` element or an + * `` element. + * + * ### Custom templates + * A custom template may be provided to render the content of each chip. This is achieved by + * specifying an `` element containing the custom content as a child of + * ``. + * + * Note: Any attributes on + * `` will be dropped as only the innerHTML is used for the chip template. The + * variables `$chip` and `$index` are available in the scope of ``, representing + * the chip object and its index in the list of chips, respectively. + * To override the chip delete control, include an element (ideally a button) with the attribute + * `md-chip-remove`. A click listener to remove the chip will be added automatically. The element + * is also placed as a sibling to the chip content (on which there are also click listeners) to + * avoid a nested ng-click situation. + * + * + * + * Sometimes developers want to limit the amount of possible chips.
    + * You can specify the maximum amount of chips by using the following markup. + * + * + * + * + * + * + * In some cases, you have an autocomplete inside of the `md-chips`.
    + * When the maximum amount of chips has been reached, you can also disable the autocomplete + * selection.
    + * Here is an example markup. + * + * + * + * + * + * + * + * ### Accessibility + * + * The `md-chips` component supports keyboard and screen reader users since Version 1.1.2. In + * order to achieve this, we modified the chips behavior to select newly appended chips for + * `300ms` before re-focusing the input and allowing the user to type. + * + * For most users, this delay is small enough that it will not be noticeable but allows certain + * screen readers to function properly (JAWS and NVDA in particular). + * + * We introduced a new `md-chip-append-delay` option to allow developers to better control this + * behavior. + * + * Please refer to the documentation of this option (below) for more information. + * + * @param {expression} ng-model Assignable AngularJS expression to be data-bound to the list of + * chips. The expression should evaluate to a `string` or `Object` Array. The type of this + * array should align with the return value of `md-transform-chip`. + * @param {expression=} ng-change AngularJS expression to be executed on chip addition, removal, + * or content change. + * @param {string=} placeholder Placeholder text that will be forwarded to the input. + * @param {string=} secondary-placeholder Placeholder text that will be forwarded to the input, + * displayed when there is at least one item in the list + * @param {boolean=} md-removable Enables or disables the deletion of chips through the + * removal icon or the Delete/Backspace key. Defaults to true. + * @param {boolean=} readonly Disables list manipulation (deleting or adding list items), hiding + * the input and delete buttons. If no `ng-model` is provided, the chips will automatically be + * marked as readonly.

    + * When `md-removable` is not defined, the `md-remove` behavior will be overwritten and + * disabled. + * @param {boolean=} md-enable-chip-edit Set this to `"true"` to enable editing of chip contents. + * The user can go into edit mode by pressing the `space` or `enter` keys, or by double + * clicking on the chip. Chip editing is only supported for chips using the basic template. + * **Note:** This attribute is only evaluated once; it is not watched. + * @param {boolean=} ng-required Whether ng-model is allowed to be empty or not. + * @param {number=} md-max-chips The maximum number of chips allowed to add through user input. + *

    The validation property `md-max-chips` can be used when the max chips + * amount is reached. + * @param {boolean=} md-add-on-blur When set to `"true"`, the remaining text inside of the input + * will be converted into a new chip on blur. + * **Note:** This attribute is only evaluated once; it is not watched. + * @param {expression} md-transform-chip An expression of form `myFunction($chip)` that when + * called expects one of the following return values: + * - an object representing the `$chip` input string + * - `undefined` to simply add the `$chip` input string, or + * - `null` to prevent the chip from being appended + * @param {expression=} md-on-add An expression which will be called when a chip has been + * added with `$chip` and `$index` available as parameters. + * @param {expression=} md-on-remove An expression which will be called when a chip has been + * removed with `$chip`, `$index`, and `$event` available as parameters. + * @param {expression=} md-on-select An expression which will be called when a chip is selected. + * @param {boolean=} md-require-match If true, and the chips template contains an autocomplete, + * only allow selection of pre-defined chips (i.e. you cannot add new ones). + * @param {string=} md-input-class This class will be applied to the child input for custom + * styling. If you are using an `md-autocomplete`, then you need to put this attribute on the + * `md-autocomplete` rather than the `md-chips`. + * @param {string=} input-aria-describedby A space-separated list of element IDs. This should + * contain the IDs of any elements that describe this autocomplete. Screen readers will read + * the content of these elements at the end of announcing that the chips input has been + * selected and describing its current state. The descriptive elements do not need to be + * visible on the page. + * @param {string=} input-aria-labelledby A space-separated list of element IDs. The ideal use + * case is that this would contain the ID of a `
    \ + \ +
    \ + {{$chip[$mdContactChipsCtrl.contactName]}}\ +
    \ +
    \ + {{$chip[$mdContactChipsCtrl.contactName]}}\ +
    \ +
    \ +
    '; + + +/** + * MDContactChips Directive Definition + * + * @param $mdTheming + * @param $mdUtil + * @returns {*} + * @ngInject + */ +function MdContactChips($mdTheming, $mdUtil) { + return { + template: function(element, attrs) { + return MD_CONTACT_CHIPS_TEMPLATE; + }, + restrict: 'E', + controller: 'MdContactChipsCtrl', + controllerAs: '$mdContactChipsCtrl', + bindToController: true, + compile: compile, + scope: { + contactQuery: '&mdContacts', + placeholder: '@?', + secondaryPlaceholder: '@?', + contactName: '@mdContactName', + contactImage: '@mdContactImage', + contactEmail: '@mdContactEmail', + contacts: '=ngModel', + ngChange: '&?', + requireMatch: '=?mdRequireMatch', + minLength: '=?mdMinLength', + maxChips: '=?mdMaxChips', + highlightFlags: '@?mdHighlightFlags', + chipAppendDelay: '@?mdChipAppendDelay', + separatorKeys: '=?mdSeparatorKeys', + removedMessage: '@?mdRemovedMessage', + inputClass: '@?mdInputClass', + inputAriaDescribedBy: '@?inputAriaDescribedby', + inputAriaLabelledBy: '@?inputAriaLabelledby', + inputAriaLabel: '@?', + containerHint: '@?', + containerEmptyHint: '@?', + deleteHint: '@?' + } + }; + + function compile(element, attr) { + return function postLink(scope, element, attrs, controllers) { + var contactChipsController = controllers; + + $mdUtil.initOptionalProperties(scope, attr); + $mdTheming(element); + + element.attr('tabindex', '-1'); + + attrs.$observe('mdChipAppendDelay', function(newValue) { + contactChipsController.chipAppendDelay = newValue; + }); + }; + } +} + +})(); +(function(){ +"use strict"; + +(function () { + "use strict"; + + /** + * Use a RegExp to check if the `md-colors=""` is static string + * or one that should be observed and dynamically interpolated. + */ + MdColorsDirective.$inject = ["$mdColors", "$mdUtil", "$log", "$parse"]; + MdColorsService.$inject = ["$mdTheming", "$mdUtil", "$log"]; + var STATIC_COLOR_EXPRESSION = /^{((\s|,)*?["'a-zA-Z-]+?\s*?:\s*?(['"])[a-zA-Z0-9-.]*(['"]))+\s*}$/; + var colorPalettes = null; + + /** + * @ngdoc module + * @name material.components.colors + * + * @description + * Define $mdColors service and a `md-colors=""` attribute directive + */ + angular + .module('material.components.colors', ['material.core']) + .directive('mdColors', MdColorsDirective) + .service('$mdColors', MdColorsService); + + /** + * @ngdoc service + * @name $mdColors + * @module material.components.colors + * + * @description + * By default, defining a theme does not make its colors available for applying to non AngularJS + * Material elements. The `$mdColors` service is used by the `md-color` directive to convert a + * set of color expressions to RGBA values and then apply those values to the element as CSS + * property values. + * + * @usage + * Getting a color based on a theme + * + * + * angular.controller('myCtrl', function ($mdColors) { + * var color = $mdColors.getThemeColor('myTheme-primary-900-0.5'); + * ... + * }); + * + * + * Applying a color from a palette to an element + * + * app.directive('myDirective', function($mdColors) { + * return { + * ... + * link: function (scope, elem) { + * $mdColors.applyThemeColors(elem, {color: 'red-A200-0.2'}); + * } + * } + * }); + * + */ + function MdColorsService($mdTheming, $mdUtil, $log) { + colorPalettes = colorPalettes || Object.keys($mdTheming.PALETTES); + + // Publish service instance + return { + applyThemeColors: applyThemeColors, + getThemeColor: getThemeColor, + hasTheme: hasTheme + }; + + // ******************************************** + // Internal Methods + // ******************************************** + + /** + * @ngdoc method + * @name $mdColors#applyThemeColors + * + * @description + * Lookup a set of colors by hue, theme, and palette, then apply those colors + * with the provided opacity (via `rgba()`) to the specified CSS property. + * + * @param {angular.element} element the element to apply the styles to + * @param {Object} colorExpression Keys are CSS properties and values are strings representing + * the `theme-palette-hue-opacity` of the desired color. For example: + * `{'color': 'red-A200-0.3', 'background-color': 'myTheme-primary-700-0.8'}`. Theme, hue, and + * opacity are optional. + */ + function applyThemeColors(element, colorExpression) { + try { + if (colorExpression) { + // Assign the calculate RGBA color values directly as inline CSS + element.css(interpolateColors(colorExpression)); + } + } catch (e) { + $log.error(e.message); + } + } + + /** + * @ngdoc method + * @name $mdColors#getThemeColor + * + * @description + * Get a parsed RGBA color using a string representing the `theme-palette-hue-opacity` of the + * desired color. + * + * @param {string} expression color expression like `'red-A200-0.3'` or + * `'myTheme-primary-700-0.8'`. Theme, hue, and opacity are optional. + * @returns {string} a CSS color value like `rgba(211, 47, 47, 0.8)` + */ + function getThemeColor(expression) { + var color = extractColorOptions(expression); + + return parseColor(color); + } + + /** + * Return the parsed color + * @param {{hue: *, theme: any, palette: *, opacity: (*|string|number)}} color hash map of color + * definitions + * @param {boolean=} contrast whether use contrast color for foreground. Defaults to false. + * @returns {string} rgba color string + */ + function parseColor(color, contrast) { + contrast = contrast || false; + var rgbValues = $mdTheming.PALETTES[color.palette][color.hue]; + + rgbValues = contrast ? rgbValues.contrast : rgbValues.value; + + return $mdUtil.supplant('rgba({0}, {1}, {2}, {3})', + [rgbValues[0], rgbValues[1], rgbValues[2], rgbValues[3] || color.opacity] + ); + } + + /** + * Convert the color expression into an object with scope-interpolated values + * Then calculate the rgba() values based on the theme color parts + * @param {Object} themeColors json object, keys are css properties and values are string of + * the wanted color, for example: `{color: 'red-A200-0.3'}`. + * @return {Object} Hashmap of CSS properties with associated `rgba()` string values + */ + function interpolateColors(themeColors) { + var rgbColors = {}; + + var hasColorProperty = themeColors.hasOwnProperty('color'); + + angular.forEach(themeColors, function (value, key) { + var color = extractColorOptions(value); + var hasBackground = key.indexOf('background') > -1; + + rgbColors[key] = parseColor(color); + if (hasBackground && !hasColorProperty) { + rgbColors.color = parseColor(color, true); + } + }); + + return rgbColors; + } + + /** + * Check if expression has defined theme + * For instance: + * 'myTheme-primary' => true + * 'red-800' => false + * @param {string} expression color expression like 'red-800', 'red-A200-0.3', + * 'myTheme-primary', or 'myTheme-primary-400' + * @return {boolean} true if the expression has a theme part, false otherwise. + */ + function hasTheme(expression) { + return angular.isDefined($mdTheming.THEMES[expression.split('-')[0]]); + } + + /** + * For the evaluated expression, extract the color parts into a hash map + * @param {string} expression color expression like 'red-800', 'red-A200-0.3', + * 'myTheme-primary', or 'myTheme-primary-400' + * @returns {{hue: *, theme: any, palette: *, opacity: (*|string|number)}} + */ + function extractColorOptions(expression) { + var parts = expression.split('-'); + var hasTheme = angular.isDefined($mdTheming.THEMES[parts[0]]); + var theme = hasTheme ? parts.splice(0, 1)[0] : $mdTheming.defaultTheme(); + + return { + theme: theme, + palette: extractPalette(parts, theme), + hue: extractHue(parts, theme), + opacity: parts[2] || 1 + }; + } + + /** + * Calculate the theme palette name + * @param {Array} parts + * @param {string} theme name + * @return {string} + */ + function extractPalette(parts, theme) { + // If the next section is one of the palettes we assume it's a two word palette + // Two word palette can be also written in camelCase, forming camelCase to dash-case + + var isTwoWord = parts.length > 1 && colorPalettes.indexOf(parts[1]) !== -1; + var palette = parts[0].replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase(); + + if (isTwoWord) palette = parts[0] + '-' + parts.splice(1, 1); + + if (colorPalettes.indexOf(palette) === -1) { + // If the palette is not in the palette list it's one of primary/accent/warn/background + var scheme = $mdTheming.THEMES[theme].colors[palette]; + if (!scheme) { + throw new Error($mdUtil.supplant( + 'mdColors: couldn\'t find \'{palette}\' in the palettes.', + {palette: palette})); + } + palette = scheme.name; + } + + return palette; + } + + /** + * @param {Array} parts + * @param {string} theme name + * @return {*} + */ + function extractHue(parts, theme) { + var themeColors = $mdTheming.THEMES[theme].colors; + + if (parts[1] === 'hue') { + var hueNumber = parseInt(parts.splice(2, 1)[0], 10); + + if (hueNumber < 1 || hueNumber > 3) { + throw new Error($mdUtil.supplant( + 'mdColors: \'hue-{hueNumber}\' is not a valid hue, can be only \'hue-1\', \'hue-2\' and \'hue-3\'', + {hueNumber: hueNumber})); + } + parts[1] = 'hue-' + hueNumber; + + if (!(parts[0] in themeColors)) { + throw new Error($mdUtil.supplant( + 'mdColors: \'hue-x\' can only be used with [{availableThemes}], but was used with \'{usedTheme}\'', + { + availableThemes: Object.keys(themeColors).join(', '), + usedTheme: parts[0] + })); + } + + return themeColors[parts[0]].hues[parts[1]]; + } + + return parts[1] || themeColors[parts[0] in themeColors ? parts[0] : 'primary'].hues['default']; + } + } + + /** + * @ngdoc directive + * @name mdColors + * @module material.components.colors + * + * @restrict A + * + * @description + * `mdColors` directive will apply the theme-based color expression as RGBA CSS style values. + * + * The format will be similar to the colors defined in the Sass files: + * + * ## `[?theme]-[palette]-[?hue]-[?opacity]` + * - [theme] - default value is the default theme + * - [palette] - can be either palette name or primary/accent/warn/background + * - [hue] - default is 500 (hue-x can be used with primary/accent/warn/background) + * - [opacity] - default is 1 + * + * + * > `?` indicates optional parameter + * + * @usage + * + *
    + *
    + * Color demo + *
    + *
    + *
    + * + * The `mdColors` directive will automatically watch for changes in the expression if it recognizes + * an interpolation expression or a function. For performance options, you can use `::` prefix to + * the `md-colors` expression to indicate a one-time data binding. + * + * + * + * + * + */ + function MdColorsDirective($mdColors, $mdUtil, $log, $parse) { + return { + restrict: 'A', + require: ['^?mdTheme'], + compile: function (tElem, tAttrs) { + var shouldWatch = shouldColorsWatch(); + + return function (scope, element, attrs, ctrl) { + var mdThemeController = ctrl[0]; + + var lastColors = {}; + + /** + * @param {string=} theme + * @return {Object} colors found in the specified theme + */ + var parseColors = function (theme) { + if (typeof theme !== 'string') { + theme = ''; + } + + if (!attrs.mdColors) { + attrs.mdColors = '{}'; + } + + /** + * Json.parse() does not work because the keys are not quoted; + * use $parse to convert to a hash map + */ + var colors = $parse(attrs.mdColors)(scope); + + /** + * If mdTheme is defined higher up the DOM tree, + * we add mdTheme's theme to the colors which don't specify a theme. + * + * @example + * + *
    + *
    + * Color demo + *
    + *
    + *
    + * + * 'primary-600' will be changed to 'myTheme-primary-600', + * but 'mySecondTheme-accent-200' will not be changed since it has a theme defined. + */ + if (mdThemeController) { + Object.keys(colors).forEach(function (prop) { + var color = colors[prop]; + if (!$mdColors.hasTheme(color)) { + colors[prop] = (theme || mdThemeController.$mdTheme) + '-' + color; + } + }); + } + + cleanElement(colors); + + return colors; + }; + + /** + * @param {Object} colors + */ + var cleanElement = function (colors) { + if (!angular.equals(colors, lastColors)) { + var keys = Object.keys(lastColors); + + if (lastColors.background && !keys.color) { + keys.push('color'); + } + + keys.forEach(function (key) { + element.css(key, ''); + }); + } + + lastColors = colors; + }; + + /** + * Registering for mgTheme changes and asking mdTheme controller run our callback whenever + * a theme changes. + */ + var unregisterChanges = angular.noop; + + if (mdThemeController) { + unregisterChanges = mdThemeController.registerChanges(function (theme) { + $mdColors.applyThemeColors(element, parseColors(theme)); + }); + } + + scope.$on('$destroy', function () { + unregisterChanges(); + }); + + try { + if (shouldWatch) { + scope.$watch(parseColors, angular.bind(this, + $mdColors.applyThemeColors, element + ), true); + } + else { + $mdColors.applyThemeColors(element, parseColors()); + } + + } + catch (e) { + $log.error(e.message); + } + + }; + + /** + * @return {boolean} + */ + function shouldColorsWatch() { + // Simulate 1x binding and mark mdColorsWatch == false + var rawColorExpression = tAttrs.mdColors; + var bindOnce = rawColorExpression.indexOf('::') > -1; + var isStatic = bindOnce ? true : STATIC_COLOR_EXPRESSION.test(tAttrs.mdColors); + + // Remove it for the postLink... + tAttrs.mdColors = rawColorExpression.replace('::', ''); + + var hasWatchAttr = angular.isDefined(tAttrs.mdColorsWatch); + + return (bindOnce || isStatic) ? false : + hasWatchAttr ? $mdUtil.parseAttributeBoolean(tAttrs.mdColorsWatch) : true; + } + } + }; + } +})(); + +})(); +(function(){ +"use strict"; + +/** + * @ngdoc module + * @name material.components.content + * + * @description + * Scrollable content + */ +mdContentDirective.$inject = ["$mdTheming"]; +angular.module('material.components.content', [ + 'material.core' +]) + .directive('mdContent', mdContentDirective); + +/** + * @ngdoc directive + * @name mdContent + * @module material.components.content + * + * @restrict E + * + * @description + * + * The `` directive is a container element useful for scrollable content. It achieves + * this by setting the CSS `overflow` property to `auto` so that content can properly scroll. + * + * In general, `` components are not designed to be nested inside one another. If + * possible, it is better to make them siblings. This often results in a better user experience as + * having nested scrollbars may confuse the user. + * + * ## Troubleshooting + * + * In some cases, you may wish to apply the `md-no-momentum` class to ensure that Safari's + * momentum scrolling is disabled. Momentum scrolling can cause flickering issues while scrolling + * SVG icons and some other components. + * + * Additionally, we now also offer the `md-no-flicker` class which can be applied to any element + * and uses a Webkit-specific filter of `blur(0px)` that forces GPU rendering of all elements + * inside (which eliminates the flicker on iOS devices). + * + * _Note: Forcing an element to render on the GPU can have unintended side-effects, especially + * related to the z-index of elements. Please use with caution and only on the elements needed._ + * + * @usage + * + * Add the `[layout-padding]` attribute to make the content padded. + * + * + * + * Lorem ipsum dolor sit amet, ne quod novum mei. + * + * + */ + +function mdContentDirective($mdTheming) { + return { + restrict: 'E', + controller: ['$scope', '$element', ContentController], + link: function(scope, element) { + element.addClass('_md'); // private md component indicator for styling + + $mdTheming(element); + scope.$broadcast('$mdContentLoaded', element); + + iosScrollFix(element[0]); + } + }; + + function ContentController($scope, $element) { + this.$scope = $scope; + this.$element = $element; + } +} + +function iosScrollFix(node) { + // IOS FIX: + // If we scroll where there is no more room for the webview to scroll, + // by default the webview itself will scroll up and down, this looks really + // bad. So if we are scrolling to the very top or bottom, add/subtract one + angular.element(node).on('$md.pressdown', function(ev) { + // Only touch events + if (ev.pointer.type !== 't') return; + // Don't let a child content's touchstart ruin it for us. + if (ev.$materialScrollFixed) return; + ev.$materialScrollFixed = true; + + if (node.scrollTop === 0) { + node.scrollTop = 1; + } else if (node.scrollHeight === node.scrollTop + node.offsetHeight) { + node.scrollTop -= 1; + } + }); +} + +})(); +(function(){ +"use strict"; + +/** + * @ngdoc module + * @name material.components.datepicker + * @description Module for the datepicker component. + */ + +angular.module('material.components.datepicker', [ + 'material.core', + 'material.components.icon', + 'material.components.virtualRepeat' +]); + +})(); +(function(){ +"use strict"; + +(function() { + 'use strict'; + + /** + * @ngdoc directive + * @name mdCalendar + * @module material.components.datepicker + * + * @param {Date} ng-model The component's model. Should be a Date object. + * @param {Object=} ng-model-options Allows tuning of the way in which `ng-model` is being + * updated. Also allows for a timezone to be specified. + * Read more at the + * ngModelOptions docs. + * @param {Date=} md-min-date Expression representing the minimum date. + * @param {Date=} md-max-date Expression representing the maximum date. + * @param {(function(Date): boolean)=} md-date-filter Function expecting a date and returning a + * boolean whether it can be selected in "day" mode or not. + * @param {(function(Date): boolean)=} md-month-filter Function expecting a date and returning a + * boolean whether it can be selected in "month" mode or not. + * @param {String=} md-current-view Current view of the calendar. Can be either "month" or "year". + * @param {String=} md-mode Restricts the user to only selecting a value from a particular view. + * This option can be used if the user is only supposed to choose from a certain date type + * (e.g. only selecting the month). Can be either "month" or "day". **Note** that this will + * overwrite the `md-current-view` value. + * + * @description + * `` is a component that renders a calendar that can be used to select a date. + * It is a part of the `` pane, however it can also be used on it's own. + * + * @usage + * + * + * + * + */ + CalendarCtrl.$inject = ["$element", "$scope", "$$mdDateUtil", "$mdUtil", "$mdConstant", "$mdTheming", "$$rAF", "$attrs", "$mdDateLocale", "$filter", "$document"]; + calendarDirective.$inject = ["inputDirective"]; + angular.module('material.components.datepicker') + .directive('mdCalendar', calendarDirective); + + // TODO(jelbourn): Mac Cmd + left / right == Home / End + // TODO(jelbourn): Refactor month element creation to use cloneNode (performance). + // TODO(jelbourn): Define virtual scrolling constants (compactness) users can override. + // TODO(jelbourn): Animated month transition on ng-model change (virtual-repeat) + // TODO(jelbourn): Scroll snapping (virtual repeat) + // TODO(jelbourn): Remove superfluous row from short months (virtual-repeat) + // TODO(jelbourn): Month headers stick to top when scrolling. + // TODO(jelbourn): Previous month opacity is lowered when partially scrolled out of view. + // TODO(jelbourn): Support md-calendar standalone on a page (as a tabstop w/ aria-live + // announcement and key handling). + // TODO Read-only calendar (not just date-picker). + + function calendarDirective(inputDirective) { + return { + template: function(tElement, tAttr) { + // This allows the calendar to work, without a datepicker. This ensures that the virtual + // repeater scrolls to the proper place on load by deferring the execution until the next + // digest. It's necessary only if the calendar is used without a datepicker, otherwise it's + // already wrapped in an ngIf. + var extraAttrs = tAttr.hasOwnProperty('ngIf') ? '' : 'ng-if="calendarCtrl.isInitialized"'; + return '' + + '
    ' + + '' + + '' + + '
    '; + }, + scope: { + minDate: '=mdMinDate', + maxDate: '=mdMaxDate', + dateFilter: '=mdDateFilter', + monthFilter: '=mdMonthFilter', + + // These need to be prefixed, because Angular resets + // any changes to the value due to bindToController. + _mode: '@mdMode', + _currentView: '@mdCurrentView' + }, + require: ['ngModel', 'mdCalendar'], + controller: CalendarCtrl, + controllerAs: 'calendarCtrl', + bindToController: true, + link: function(scope, element, attrs, controllers) { + var ngModelCtrl = controllers[0]; + var mdCalendarCtrl = controllers[1]; + mdCalendarCtrl.configureNgModel(ngModelCtrl, inputDirective); + } + }; + } + + /** + * Occasionally the hideVerticalScrollbar method might read an element's + * width as 0, because it hasn't been laid out yet. This value will be used + * as a fallback, in order to prevent scenarios where the element's width + * would otherwise have been set to 0. This value is the "usual" width of a + * calendar within a floating calendar pane. + */ + var FALLBACK_WIDTH = 340; + + /** Next identifier for calendar instance. */ + var nextUniqueId = 0; + + /** Maps the `md-mode` values to their corresponding calendar views. */ + var MODE_MAP = { + day: 'month', + month: 'year' + }; + + /** + * Controller for the mdCalendar component. + * @ngInject @constructor + */ + function CalendarCtrl($element, $scope, $$mdDateUtil, $mdUtil, $mdConstant, $mdTheming, $$rAF, + $attrs, $mdDateLocale, $filter, $document) { + $mdTheming($element); + + /** + * @final + * @type {!JQLite} + */ + this.$element = $element; + + /** + * @final + * @type {!angular.Scope} + */ + this.$scope = $scope; + + /** + * @final + * @type {!angular.$attrs} Current attributes object for the element + */ + this.$attrs = $attrs; + + /** @final */ + this.dateUtil = $$mdDateUtil; + + /** @final */ + this.$mdUtil = $mdUtil; + + /** @final */ + this.keyCode = $mdConstant.KEY_CODE; + + /** @final */ + this.$$rAF = $$rAF; + + /** @final */ + this.$mdDateLocale = $mdDateLocale; + + /** @final The built-in Angular date filter. */ + this.ngDateFilter = $filter('date'); + + /** + * @final + * @type {Date} + */ + this.today = this.dateUtil.createDateAtMidnight(); + + /** @type {!ngModel.NgModelController} */ + this.ngModelCtrl = undefined; + + /** @type {string} Class applied to the selected date cell. */ + this.SELECTED_DATE_CLASS = 'md-calendar-selected-date'; + + /** @type {string} Class applied to the cell for today. */ + this.TODAY_CLASS = 'md-calendar-date-today'; + + /** @type {string} Class applied to the focused cell. */ + this.FOCUSED_DATE_CLASS = 'md-focus'; + + /** + * @final + * @type {number} Unique ID for this calendar instance. + */ + this.id = nextUniqueId++; + + /** + * The date that is currently focused or showing in the calendar. This will initially be set + * to the ng-model value if set, otherwise to today. It will be updated as the user navigates + * to other months. The cell corresponding to the displayDate does not necessarily always have + * focus in the document (such as for cases when the user is scrolling the calendar). + * @type {Date} + */ + this.displayDate = null; + + /** + * Allows restricting the calendar to only allow selecting a month or a day. + * @type {'month'|'day'|null} + */ + this.mode = null; + + /** + * The selected date. Keep track of this separately from the ng-model value so that we + * can know, when the ng-model value changes, what the previous value was before it's updated + * in the component's UI. + * + * @type {Date} + */ + this.selectedDate = null; + + /** + * The first date that can be rendered by the calendar. The default is taken + * from the mdDateLocale provider and is limited by the mdMinDate. + * @type {Date} + */ + this.firstRenderableDate = null; + + /** + * The last date that can be rendered by the calendar. The default comes + * from the mdDateLocale provider and is limited by the maxDate. + * @type {Date} + */ + this.lastRenderableDate = null; + + /** + * Used to toggle initialize the root element in the next digest. + * @type {boolean} + */ + this.isInitialized = false; + + /** + * Cache for the width of the element without a scrollbar. Used to hide the scrollbar later on + * and to avoid extra reflows when switching between views. + * @type {number} + */ + this.width = 0; + + /** + * Caches the width of the scrollbar in order to be used when hiding it and to avoid extra reflows. + * @type {number} + */ + this.scrollbarWidth = 0; + + /** + * @type {boolean} set to true if the calendar is being used "standalone" (outside of a + * md-datepicker). + */ + this.standaloneMode = false; + + // Unless the user specifies so, the calendar should not be a tab stop. + // This is necessary because ngAria might add a tabindex to anything with an ng-model + // (based on whether or not the user has turned that particular feature on/off). + if (!$attrs.tabindex) { + $element.attr('tabindex', '-1'); + } + + var boundKeyHandler = angular.bind(this, this.handleKeyEvent); + + // If use the md-calendar directly in the body without datepicker, + // handleKeyEvent will disable other inputs on the page. + // So only apply the handleKeyEvent on the body when the md-calendar inside datepicker, + // otherwise apply on the calendar element only. + + var handleKeyElement; + if ($element.parent().hasClass('md-datepicker-calendar')) { + handleKeyElement = angular.element($document[0].body); + } else { + this.standaloneMode = true; + handleKeyElement = $element; + } + + // Bind the keydown handler to the body, in order to handle cases where the focused + // element gets removed from the DOM and stops propagating click events. + handleKeyElement.on('keydown', boundKeyHandler); + + $scope.$on('$destroy', function() { + handleKeyElement.off('keydown', boundKeyHandler); + }); + + // For AngularJS 1.4 and older, where there are no lifecycle hooks but bindings are pre-assigned, + // manually call the $onInit hook. + if (angular.version.major === 1 && angular.version.minor <= 4) { + this.$onInit(); + } + } + + /** + * AngularJS Lifecycle hook for newer AngularJS versions. + * Bindings are not guaranteed to have been assigned in the controller, but they are in the + * $onInit hook. + */ + CalendarCtrl.prototype.$onInit = function() { + /** + * The currently visible calendar view. Note the prefix on the scope value, + * which is necessary, because the datepicker seems to reset the real one value if the + * calendar is open, but the `currentView` on the datepicker's scope is empty. + * @type {String} + */ + if (this._mode && MODE_MAP.hasOwnProperty(this._mode)) { + this.currentView = MODE_MAP[this._mode]; + this.mode = this._mode; + } else { + this.currentView = this._currentView || 'month'; + this.mode = null; + } + + if (this.minDate && this.minDate > this.$mdDateLocale.firstRenderableDate) { + this.firstRenderableDate = this.minDate; + } else { + this.firstRenderableDate = this.$mdDateLocale.firstRenderableDate; + } + + if (this.maxDate && this.maxDate < this.$mdDateLocale.lastRenderableDate) { + this.lastRenderableDate = this.maxDate; + } else { + this.lastRenderableDate = this.$mdDateLocale.lastRenderableDate; + } + }; + + /** + * Sets up the controller's reference to ngModelController. + * @param {!ngModel.NgModelController} ngModelCtrl Instance of the ngModel controller. + * @param {Object} inputDirective Config for AngularJS's `input` directive. + */ + CalendarCtrl.prototype.configureNgModel = function(ngModelCtrl, inputDirective) { + var self = this; + self.ngModelCtrl = ngModelCtrl; + + // The component needs to be [type="date"] in order to be picked up by AngularJS. + this.$attrs.$set('type', 'date'); + + // Invoke the `input` directive link function, adding a stub for the element. + // This allows us to re-use AngularJS' logic for setting the timezone via ng-model-options. + // It works by calling the link function directly which then adds the proper `$parsers` and + // `$formatters` to the NgModelController. + inputDirective[0].link.pre(this.$scope, { + on: angular.noop, + val: angular.noop, + 0: {} + }, this.$attrs, [ngModelCtrl]); + + ngModelCtrl.$render = function() { + var value = this.$viewValue, convertedDate; + + // In the case where a conversion is needed, the $viewValue here will be a string like + // "2020-05-10" instead of a Date object. + if (!self.dateUtil.isValidDate(value)) { + convertedDate = self.dateUtil.removeLocalTzAndReparseDate(new Date(value)); + if (self.dateUtil.isValidDate(convertedDate)) { + value = convertedDate; + } + } + + // Notify the child scopes of any changes. + self.$scope.$broadcast('md-calendar-parent-changed', value); + + // Set up the selectedDate if it hasn't been already. + if (!self.selectedDate) { + self.selectedDate = value; + } + + // Also set up the displayDate. + if (!self.displayDate) { + self.displayDate = self.selectedDate || self.today; + } + }; + + self.$mdUtil.nextTick(function() { + self.isInitialized = true; + }); + }; + + /** + * Sets the ng-model value for the calendar and emits a change event. + * @param {Date} date new value for the calendar + */ + CalendarCtrl.prototype.setNgModelValue = function(date) { + var timezone = this.$mdUtil.getModelOption(this.ngModelCtrl, 'timezone'); + var value = this.dateUtil.createDateAtMidnight(date); + this.focusDate(value); + this.$scope.$emit('md-calendar-change', value); + // Using the timezone when the offset is negative (GMT+X) causes the previous day to be + // selected here. This check avoids that. + if (timezone == null || value.getTimezoneOffset() < 0) { + this.ngModelCtrl.$setViewValue(this.ngDateFilter(value, 'yyyy-MM-dd'), 'default'); + } else { + this.ngModelCtrl.$setViewValue(this.ngDateFilter(value, 'yyyy-MM-dd', timezone), 'default'); + } + this.ngModelCtrl.$render(); + return value; + }; + + /** + * Sets the current view that should be visible in the calendar + * @param {string} newView View name to be set. + * @param {number|Date} time Date object or a timestamp for the new display date. + */ + CalendarCtrl.prototype.setCurrentView = function(newView, time) { + var self = this; + + self.$mdUtil.nextTick(function() { + self.currentView = newView; + + if (time) { + self.displayDate = angular.isDate(time) ? time : new Date(time); + } + }); + }; + + /** + * Focus the cell corresponding to the given date. + * @param {Date=} date The date to be focused. + */ + CalendarCtrl.prototype.focusDate = function(date) { + if (this.dateUtil.isValidDate(date)) { + var previousFocus = this.$element[0].querySelector('.' + this.FOCUSED_DATE_CLASS); + if (previousFocus) { + previousFocus.classList.remove(this.FOCUSED_DATE_CLASS); + } + + var cellId = this.getDateId(date, this.currentView); + var cell = document.getElementById(cellId); + if (cell) { + cell.classList.add(this.FOCUSED_DATE_CLASS); + cell.focus(); + this.displayDate = date; + } + } else { + var rootElement = this.$element[0].querySelector('[ng-switch]'); + + if (rootElement) { + rootElement.focus(); + } + } + }; + + /** + * Highlights a date cell on the calendar and changes the selected date. + * @param {Date=} date Date to be marked as selected. + */ + CalendarCtrl.prototype.changeSelectedDate = function(date) { + var selectedDateClass = this.SELECTED_DATE_CLASS; + var prevDateCell = this.$element[0].querySelector('.' + selectedDateClass); + + // Remove the selected class from the previously selected date, if any. + if (prevDateCell) { + prevDateCell.classList.remove(selectedDateClass); + prevDateCell.setAttribute('aria-selected', 'false'); + } + + // Apply the select class to the new selected date if it is set. + if (date) { + var dateCell = document.getElementById(this.getDateId(date, this.currentView)); + if (dateCell) { + dateCell.classList.add(selectedDateClass); + dateCell.setAttribute('aria-selected', 'true'); + } + } + + this.selectedDate = date; + }; + + /** + * Normalizes the key event into an action name. The action will be broadcast + * to the child controllers. + * @param {KeyboardEvent} event + * @returns {string} The action that should be taken, or null if the key + * does not match a calendar shortcut. + */ + CalendarCtrl.prototype.getActionFromKeyEvent = function(event) { + var keyCode = this.keyCode; + + switch (event.which) { + case keyCode.ENTER: return 'select'; + + case keyCode.RIGHT_ARROW: return 'move-right'; + case keyCode.LEFT_ARROW: return 'move-left'; + + case keyCode.DOWN_ARROW: return event.metaKey ? 'move-page-down' : 'move-row-down'; + case keyCode.UP_ARROW: return event.metaKey ? 'move-page-up' : 'move-row-up'; + + case keyCode.PAGE_DOWN: return 'move-page-down'; + case keyCode.PAGE_UP: return 'move-page-up'; + + case keyCode.HOME: return 'start'; + case keyCode.END: return 'end'; + + default: return null; + } + }; + + /** + * Handles a key event in the calendar with the appropriate action. + * The action will either + * - select the focused date + * - navigate to focus a new date + * - emit a md-calendar-close event if in a md-datepicker panel + * - emit a md-calendar-parent-action + * - delegate to normal tab order if the TAB key is pressed in standalone mode + * @param {KeyboardEvent} event + */ + CalendarCtrl.prototype.handleKeyEvent = function(event) { + var self = this; + + this.$scope.$apply(function() { + // Capture escape and emit back up so that a wrapping component + // (such as a date-picker) can decide to close. + if (event.which === self.keyCode.ESCAPE || + (event.which === self.keyCode.TAB && !self.standaloneMode)) { + self.$scope.$emit('md-calendar-close'); + + if (event.which === self.keyCode.TAB) { + event.preventDefault(); + } + + return; + } else if (event.which === self.keyCode.TAB && self.standaloneMode) { + // delegate to the normal tab order if the TAB key is pressed in standalone mode + return; + } + + // Broadcast the action that any child controllers should take. + var action = self.getActionFromKeyEvent(event); + if (action) { + event.preventDefault(); + event.stopPropagation(); + self.$scope.$broadcast('md-calendar-parent-action', action); + } + }); + }; + + /** + * Hides the vertical scrollbar on the calendar scroller of a child controller by + * setting the width on the calendar scroller and the `overflow: hidden` wrapper + * around the scroller, and then setting a padding-right on the scroller equal + * to the width of the browser's scrollbar. + * + * This will cause a reflow. + * + * @param {object} childCtrl The child controller whose scrollbar should be hidden. + */ + CalendarCtrl.prototype.hideVerticalScrollbar = function(childCtrl) { + var self = this; + var element = childCtrl.$element[0]; + var scrollMask = element.querySelector('.md-calendar-scroll-mask'); + + if (self.width > 0) { + setWidth(); + } else { + self.$$rAF(function() { + var scroller = childCtrl.calendarScroller; + + self.scrollbarWidth = scroller.offsetWidth - scroller.clientWidth; + self.width = element.querySelector('table').offsetWidth; + setWidth(); + }); + } + + function setWidth() { + var width = self.width || FALLBACK_WIDTH; + var scrollbarWidth = self.scrollbarWidth; + var scroller = childCtrl.calendarScroller; + + scrollMask.style.width = width + 'px'; + scroller.style.width = (width + scrollbarWidth) + 'px'; + scroller.style.paddingRight = scrollbarWidth + 'px'; + } + }; + + /** + * Gets an identifier for a date unique to the calendar instance for internal + * purposes. Not to be displayed. + * @param {Date} date The date for which the id is being generated + * @param {string} namespace Namespace for the id. (month, year etc.) + * @returns {string} + */ + CalendarCtrl.prototype.getDateId = function(date, namespace) { + if (!namespace) { + throw new Error('A namespace for the date id has to be specified.'); + } + + return [ + 'md', + this.id, + namespace, + date.getFullYear(), + date.getMonth(), + date.getDate() + ].join('-'); + }; + + /** + * Util to trigger an extra digest on a parent scope, in order to to ensure that + * any child virtual repeaters have updated. This is necessary, because the virtual + * repeater doesn't update the $index the first time around since the content isn't + * in place yet. The case, in which this is an issue, is when the repeater has less + * than a page of content (e.g. a month or year view has a min or max date). + */ + CalendarCtrl.prototype.updateVirtualRepeat = function() { + var scope = this.$scope; + var virtualRepeatResizeListener = scope.$on('$md-resize-enable', function() { + if (!scope.$$phase) { + scope.$apply(); + } + + virtualRepeatResizeListener(); + }); + }; +})(); + +})(); +(function(){ +"use strict"; + +(function() { + 'use strict'; + + CalendarMonthCtrl.$inject = ["$element", "$scope", "$animate", "$q", "$$mdDateUtil", "$mdDateLocale"]; + angular.module('material.components.datepicker') + .directive('mdCalendarMonth', calendarDirective); + + /** + * Height of one calendar month tbody. This must be made known to the virtual-repeat and is + * subsequently used for scrolling to specific months. + */ + var TBODY_HEIGHT = 265; + + /** + * Height of a calendar month with a single row. This is needed to calculate the offset for + * rendering an extra month in virtual-repeat that only contains one row. + */ + var TBODY_SINGLE_ROW_HEIGHT = 45; + + /** Private directive that represents a list of months inside the calendar. */ + function calendarDirective() { + return { + template: + '' + + '
    ' + + '' + + '' + + '' + + + // The ensures that the will always have the + // proper height, even if it's empty. If it's content is + // compiled, the will be overwritten. + '' + + '' + + '
    ' + + '
    ' + + '
    ', + require: ['^^mdCalendar', 'mdCalendarMonth'], + controller: CalendarMonthCtrl, + controllerAs: 'monthCtrl', + bindToController: true, + link: function(scope, element, attrs, controllers) { + var calendarCtrl = controllers[0]; + var monthCtrl = controllers[1]; + monthCtrl.initialize(calendarCtrl); + } + }; + } + + /** + * Controller for the calendar month component. + * @ngInject @constructor + */ + function CalendarMonthCtrl($element, $scope, $animate, $q, + $$mdDateUtil, $mdDateLocale) { + + /** @final {!angular.JQLite} */ + this.$element = $element; + + /** @final {!angular.Scope} */ + this.$scope = $scope; + + /** @final {!angular.$animate} */ + this.$animate = $animate; + + /** @final {!angular.$q} */ + this.$q = $q; + + /** @final */ + this.dateUtil = $$mdDateUtil; + + /** @final */ + this.dateLocale = $mdDateLocale; + + /** @final {HTMLElement} */ + this.calendarScroller = $element[0].querySelector('.md-virtual-repeat-scroller'); + + /** @type {boolean} */ + this.isInitialized = false; + + /** @type {boolean} */ + this.isMonthTransitionInProgress = false; + + var self = this; + + /** + * Handles a click event on a date cell. + * Created here so that every cell can use the same function instance. + * @this {HTMLTableCellElement} The cell that was clicked. + */ + this.cellClickHandler = function() { + var timestamp = $$mdDateUtil.getTimestampFromNode(this); + self.$scope.$apply(function() { + // The timestamp has to be converted to a valid date. + self.calendarCtrl.setNgModelValue(new Date(timestamp)); + }); + }; + + /** + * Handles click events on the month headers. Switches + * the calendar to the year view. + * @this {HTMLTableCellElement} The cell that was clicked. + */ + this.headerClickHandler = function() { + self.calendarCtrl.setCurrentView('year', $$mdDateUtil.getTimestampFromNode(this)); + }; + } + + /** Initialization **/ + + /** + * Initialize the controller by saving a reference to the calendar and + * setting up the object that will be iterated by the virtual repeater. + */ + CalendarMonthCtrl.prototype.initialize = function(calendarCtrl) { + /** + * Dummy array-like object for virtual-repeat to iterate over. The length is the total + * number of months that can be viewed. We add 2 months: one to include the current month + * and one for the last dummy month. + * + * This is shorter than ideal because of a (potential) Firefox bug + * https://bugzilla.mozilla.org/show_bug.cgi?id=1181658. + */ + + this.items = { + length: this.dateUtil.getMonthDistance( + calendarCtrl.firstRenderableDate, + calendarCtrl.lastRenderableDate + ) + 2 + }; + + this.calendarCtrl = calendarCtrl; + this.attachScopeListeners(); + calendarCtrl.updateVirtualRepeat(); + + // Fire the initial render, since we might have missed it the first time it fired. + calendarCtrl.ngModelCtrl && calendarCtrl.ngModelCtrl.$render(); + }; + + /** + * Gets the "index" of the currently selected date as it would be in the virtual-repeat. + * @returns {number} the "index" of the currently selected date + */ + CalendarMonthCtrl.prototype.getSelectedMonthIndex = function() { + var calendarCtrl = this.calendarCtrl; + + return this.dateUtil.getMonthDistance( + calendarCtrl.firstRenderableDate, + calendarCtrl.displayDate || calendarCtrl.selectedDate || calendarCtrl.today + ); + }; + + /** + * Change the date that is being shown in the calendar. If the given date is in a different + * month, the displayed month will be transitioned. + * @param {Date} date + */ + CalendarMonthCtrl.prototype.changeDisplayDate = function(date) { + // Initialization is deferred until this function is called because we want to reflect + // the starting value of ngModel. + if (!this.isInitialized) { + this.buildWeekHeader(); + this.calendarCtrl.hideVerticalScrollbar(this); + this.isInitialized = true; + return this.$q.when(); + } + + // If trying to show an invalid date or a transition is in progress, do nothing. + if (!this.dateUtil.isValidDate(date) || this.isMonthTransitionInProgress) { + return this.$q.when(); + } + + this.isMonthTransitionInProgress = true; + var animationPromise = this.animateDateChange(date); + + this.calendarCtrl.displayDate = date; + + var self = this; + animationPromise.then(function() { + self.isMonthTransitionInProgress = false; + }); + + return animationPromise; + }; + + /** + * Animates the transition from the calendar's current month to the given month. + * @param {Date} date + * @returns {angular.$q.Promise} The animation promise. + */ + CalendarMonthCtrl.prototype.animateDateChange = function(date) { + if (this.dateUtil.isValidDate(date)) { + var monthDistance = this.dateUtil.getMonthDistance(this.calendarCtrl.firstRenderableDate, date); + this.calendarScroller.scrollTop = monthDistance * TBODY_HEIGHT; + } + + return this.$q.when(); + }; + + /** + * Builds and appends a day-of-the-week header to the calendar. + * This should only need to be called once during initialization. + */ + CalendarMonthCtrl.prototype.buildWeekHeader = function() { + var firstDayOfWeek = this.dateLocale.firstDayOfWeek; + var shortDays = this.dateLocale.shortDays; + + var row = document.createElement('tr'); + for (var i = 0; i < 7; i++) { + var th = document.createElement('th'); + th.textContent = shortDays[(i + firstDayOfWeek) % 7]; + row.appendChild(th); + } + + this.$element.find('thead').append(row); + }; + + /** + * Attaches listeners for the scope events that are broadcast by the calendar. + */ + CalendarMonthCtrl.prototype.attachScopeListeners = function() { + var self = this; + + self.$scope.$on('md-calendar-parent-changed', function(event, value) { + self.calendarCtrl.changeSelectedDate(value); + self.changeDisplayDate(value); + }); + + self.$scope.$on('md-calendar-parent-action', angular.bind(this, this.handleKeyEvent)); + }; + + /** + * Handles the month-specific keyboard interactions. + * @param {Object} event Scope event object passed by the calendar. + * @param {String} action Action, corresponding to the key that was pressed. + */ + CalendarMonthCtrl.prototype.handleKeyEvent = function(event, action) { + var calendarCtrl = this.calendarCtrl; + var displayDate = calendarCtrl.displayDate; + + if (action === 'select') { + calendarCtrl.setNgModelValue(displayDate); + } else { + var date = null; + var dateUtil = this.dateUtil; + + switch (action) { + case 'move-right': date = dateUtil.incrementDays(displayDate, 1); break; + case 'move-left': date = dateUtil.incrementDays(displayDate, -1); break; + + case 'move-page-down': date = dateUtil.incrementMonths(displayDate, 1); break; + case 'move-page-up': date = dateUtil.incrementMonths(displayDate, -1); break; + + case 'move-row-down': date = dateUtil.incrementDays(displayDate, 7); break; + case 'move-row-up': date = dateUtil.incrementDays(displayDate, -7); break; + + case 'start': date = dateUtil.getFirstDateOfMonth(displayDate); break; + case 'end': date = dateUtil.getLastDateOfMonth(displayDate); break; + } + + if (date) { + date = this.dateUtil.clampDate(date, calendarCtrl.minDate, calendarCtrl.maxDate); + + this.changeDisplayDate(date).then(function() { + calendarCtrl.focusDate(date); + }); + } + } + }; +})(); + +})(); +(function(){ +"use strict"; + +(function() { + 'use strict'; + + mdCalendarMonthBodyDirective.$inject = ["$compile", "$$mdSvgRegistry"]; + CalendarMonthBodyCtrl.$inject = ["$element", "$$mdDateUtil", "$mdDateLocale"]; + angular.module('material.components.datepicker') + .directive('mdCalendarMonthBody', mdCalendarMonthBodyDirective); + + /** + * Private directive consumed by md-calendar-month. Having this directive lets the calender use + * md-virtual-repeat and also cleanly separates the month DOM construction functions from + * the rest of the calendar controller logic. + * @ngInject + */ + function mdCalendarMonthBodyDirective($compile, $$mdSvgRegistry) { + var ARROW_ICON = $compile('')({})[0]; + + return { + require: ['^^mdCalendar', '^^mdCalendarMonth', 'mdCalendarMonthBody'], + scope: { offset: '=mdMonthOffset' }, + controller: CalendarMonthBodyCtrl, + controllerAs: 'mdMonthBodyCtrl', + bindToController: true, + link: function(scope, element, attrs, controllers) { + var calendarCtrl = controllers[0]; + var monthCtrl = controllers[1]; + var monthBodyCtrl = controllers[2]; + + monthBodyCtrl.calendarCtrl = calendarCtrl; + monthBodyCtrl.monthCtrl = monthCtrl; + monthBodyCtrl.arrowIcon = ARROW_ICON.cloneNode(true); + + // The virtual-repeat re-uses the same DOM elements, so there are only a limited number + // of repeated items that are linked, and then those elements have their bindings updated. + // Since the months are not generated by bindings, we simply regenerate the entire thing + // when the binding (offset) changes. + scope.$watch(function() { return monthBodyCtrl.offset; }, function(offset) { + if (angular.isNumber(offset)) { + monthBodyCtrl.generateContent(); + } + }); + } + }; + } + + /** + * Controller for a single calendar month. + * @ngInject @constructor + */ + function CalendarMonthBodyCtrl($element, $$mdDateUtil, $mdDateLocale) { + /** + * @final + * @type {!JQLite} + */ + this.$element = $element; + + /** @final */ + this.dateUtil = $$mdDateUtil; + + /** @final */ + this.dateLocale = $mdDateLocale; + + /** @type {Object} Reference to the month view. */ + this.monthCtrl = null; + + /** @type {Object} Reference to the calendar. */ + this.calendarCtrl = null; + + /** + * Number of months from the start of the month "items" that the currently rendered month + * occurs. Set via angular data binding. + * @type {number|null} + */ + this.offset = null; + + /** + * Date cell to focus after appending the month to the document. + * @type {HTMLElement} + */ + this.focusAfterAppend = null; + } + + /** Generate and append the content for this month to the directive element. */ + CalendarMonthBodyCtrl.prototype.generateContent = function() { + var date = this.dateUtil.incrementMonths(this.calendarCtrl.firstRenderableDate, this.offset); + + this.$element + .empty() + .append(this.buildCalendarForMonth(date)); + + if (this.focusAfterAppend) { + this.focusAfterAppend.classList.add(this.calendarCtrl.FOCUSED_DATE_CLASS); + this.focusAfterAppend = null; + } + }; + + /** + * Creates a single cell to contain a date in the calendar with all appropriate + * attributes and classes added. If a date is given, the cell content will be set + * based on the date. + * @param {Date=} opt_date + * @returns {HTMLElement} + */ + CalendarMonthBodyCtrl.prototype.buildDateCell = function(opt_date) { + var monthCtrl = this.monthCtrl; + var calendarCtrl = this.calendarCtrl; + + // TODO(jelbourn): cloneNode is likely a faster way of doing this. + var cell = document.createElement('td'); + cell.tabIndex = -1; + cell.classList.add('md-calendar-date'); + cell.setAttribute('role', 'gridcell'); + + if (opt_date) { + cell.setAttribute('tabindex', '-1'); + cell.setAttribute('aria-label', this.dateLocale.longDateFormatter(opt_date)); + cell.id = calendarCtrl.getDateId(opt_date, 'month'); + + // Use `data-timestamp` attribute because IE10 does not support the `dataset` property. + cell.setAttribute('data-timestamp', opt_date.getTime()); + + // TODO(jelourn): Doing these comparisons for class addition during generation might be slow. + // It may be better to finish the construction and then query the node and add the class. + if (this.dateUtil.isSameDay(opt_date, calendarCtrl.today)) { + cell.classList.add(calendarCtrl.TODAY_CLASS); + } + + if (this.dateUtil.isValidDate(calendarCtrl.selectedDate) && + this.dateUtil.isSameDay(opt_date, calendarCtrl.selectedDate)) { + cell.classList.add(calendarCtrl.SELECTED_DATE_CLASS); + cell.setAttribute('aria-selected', 'true'); + } + + var cellText = this.dateLocale.dates[opt_date.getDate()]; + + if (this.isDateEnabled(opt_date)) { + // Add a indicator for select, hover, and focus states. + var selectionIndicator = document.createElement('span'); + selectionIndicator.classList.add('md-calendar-date-selection-indicator'); + selectionIndicator.textContent = cellText; + cell.appendChild(selectionIndicator); + cell.addEventListener('click', monthCtrl.cellClickHandler); + + if (calendarCtrl.displayDate && this.dateUtil.isSameDay(opt_date, calendarCtrl.displayDate)) { + this.focusAfterAppend = cell; + } + } else { + cell.classList.add('md-calendar-date-disabled'); + cell.textContent = cellText; + } + } + + return cell; + }; + + /** + * Check whether date is in range and enabled + * @param {Date=} opt_date + * @return {boolean} Whether the date is enabled. + */ + CalendarMonthBodyCtrl.prototype.isDateEnabled = function(opt_date) { + return this.dateUtil.isDateWithinRange(opt_date, + this.calendarCtrl.minDate, this.calendarCtrl.maxDate) && + (!angular.isFunction(this.calendarCtrl.dateFilter) + || this.calendarCtrl.dateFilter(opt_date)); + }; + + /** + * Builds a `tr` element for the calendar grid. + * @param rowNumber The week number within the month. + * @returns {HTMLElement} + */ + CalendarMonthBodyCtrl.prototype.buildDateRow = function(rowNumber) { + var row = document.createElement('tr'); + row.setAttribute('role', 'row'); + + // Because of an NVDA bug (with Firefox), the row needs an aria-label in order + // to prevent the entire row being read aloud when the user moves between rows. + // See http://community.nvda-project.org/ticket/4643. + row.setAttribute('aria-label', this.dateLocale.weekNumberFormatter(rowNumber)); + + return row; + }; + + /** + * Builds the content for the given date's month. + * @param {Date=} opt_dateInMonth + * @returns {DocumentFragment} A document fragment containing the elements. + */ + CalendarMonthBodyCtrl.prototype.buildCalendarForMonth = function(opt_dateInMonth) { + var date = this.dateUtil.isValidDate(opt_dateInMonth) ? opt_dateInMonth : new Date(); + + var firstDayOfMonth = this.dateUtil.getFirstDateOfMonth(date); + var firstDayOfTheWeek = this.getLocaleDay_(firstDayOfMonth); + var numberOfDaysInMonth = this.dateUtil.getNumberOfDaysInMonth(date); + + // Store rows for the month in a document fragment so that we can append them all at once. + var monthBody = document.createDocumentFragment(); + + var rowNumber = 1; + var row = this.buildDateRow(rowNumber); + monthBody.appendChild(row); + + // If this is the final month in the list of items, only the first week should render, + // so we should return immediately after the first row is complete and has been + // attached to the body. + var isFinalMonth = this.offset === this.monthCtrl.items.length - 1; + + // Add a label for the month. If the month starts on a Sun/Mon/Tues, the month label + // goes on a row above the first of the month. Otherwise, the month label takes up the first + // two cells of the first row. + var blankCellOffset = 0; + var monthLabelCell = document.createElement('td'); + var monthLabelCellContent = document.createElement('span'); + var calendarCtrl = this.calendarCtrl; + + monthLabelCellContent.textContent = this.dateLocale.monthHeaderFormatter(date); + monthLabelCell.appendChild(monthLabelCellContent); + monthLabelCell.classList.add('md-calendar-month-label'); + // If the entire month is after the max date, render the label as a disabled state. + if (calendarCtrl.maxDate && firstDayOfMonth > calendarCtrl.maxDate) { + monthLabelCell.classList.add('md-calendar-month-label-disabled'); + // If the user isn't supposed to be able to change views, render the + // label as usual, but disable the clicking functionality. + } else if (!calendarCtrl.mode) { + monthLabelCell.addEventListener('click', this.monthCtrl.headerClickHandler); + monthLabelCell.setAttribute('data-timestamp', firstDayOfMonth.getTime()); + monthLabelCell.setAttribute('aria-label', this.dateLocale.monthFormatter(date)); + monthLabelCell.classList.add('md-calendar-label-clickable'); + monthLabelCell.appendChild(this.arrowIcon.cloneNode(true)); + } + + if (firstDayOfTheWeek <= 2) { + monthLabelCell.setAttribute('colspan', '7'); + + var monthLabelRow = this.buildDateRow(); + monthLabelRow.appendChild(monthLabelCell); + monthBody.insertBefore(monthLabelRow, row); + + if (isFinalMonth) { + return monthBody; + } + } else { + blankCellOffset = 3; + monthLabelCell.setAttribute('colspan', '3'); + row.appendChild(monthLabelCell); + } + + // Add a blank cell for each day of the week that occurs before the first of the month. + // For example, if the first day of the month is a Tuesday, add blank cells for Sun and Mon. + // The blankCellOffset is needed in cases where the first N cells are used by the month label. + for (var i = blankCellOffset; i < firstDayOfTheWeek; i++) { + row.appendChild(this.buildDateCell()); + } + + // Add a cell for each day of the month, keeping track of the day of the week so that + // we know when to start a new row. + var dayOfWeek = firstDayOfTheWeek; + var iterationDate = firstDayOfMonth; + for (var d = 1; d <= numberOfDaysInMonth; d++) { + // If we've reached the end of the week, start a new row. + if (dayOfWeek === 7) { + // We've finished the first row, so we're done if this is the final month. + if (isFinalMonth) { + return monthBody; + } + dayOfWeek = 0; + rowNumber++; + row = this.buildDateRow(rowNumber); + monthBody.appendChild(row); + } + + iterationDate.setDate(d); + var cell = this.buildDateCell(iterationDate); + row.appendChild(cell); + + dayOfWeek++; + } + + // Ensure that the last row of the month has 7 cells. + while (row.childNodes.length < 7) { + row.appendChild(this.buildDateCell()); + } + + // Ensure that all months have 6 rows. This is necessary for now because the virtual-repeat + // requires that all items have exactly the same height. + while (monthBody.childNodes.length < 6) { + var whitespaceRow = this.buildDateRow(); + for (var j = 0; j < 7; j++) { + whitespaceRow.appendChild(this.buildDateCell()); + } + monthBody.appendChild(whitespaceRow); + } + + return monthBody; + }; + + /** + * Gets the day-of-the-week index for a date for the current locale. + * @private + * @param {Date} date + * @returns {number} The column index of the date in the calendar. + */ + CalendarMonthBodyCtrl.prototype.getLocaleDay_ = function(date) { + return (date.getDay() + (7 - this.dateLocale.firstDayOfWeek)) % 7; + }; +})(); + +})(); +(function(){ +"use strict"; + +(function() { + 'use strict'; + + CalendarYearCtrl.$inject = ["$element", "$scope", "$animate", "$q", "$$mdDateUtil", "$mdUtil"]; + angular.module('material.components.datepicker') + .directive('mdCalendarYear', calendarDirective); + + /** + * Height of one calendar year tbody. This must be made known to the virtual-repeat and is + * subsequently used for scrolling to specific years. + */ + var TBODY_HEIGHT = 88; + + /** Private component, representing a list of years in the calendar. */ + function calendarDirective() { + return { + template: + '
    ' + + '' + + '' + + '' + + // The ensures that the will have the proper + // height, even though it may be empty. + '' + + '' + + '
    ' + + '
    ' + + '
    ', + require: ['^^mdCalendar', 'mdCalendarYear'], + controller: CalendarYearCtrl, + controllerAs: 'yearCtrl', + bindToController: true, + link: function(scope, element, attrs, controllers) { + var calendarCtrl = controllers[0]; + var yearCtrl = controllers[1]; + yearCtrl.initialize(calendarCtrl); + } + }; + } + + /** + * Controller for the mdCalendar component. + * @ngInject @constructor + */ + function CalendarYearCtrl($element, $scope, $animate, $q, $$mdDateUtil, $mdUtil) { + + /** @final {!angular.JQLite} */ + this.$element = $element; + + /** @final {!angular.Scope} */ + this.$scope = $scope; + + /** @final {!angular.$animate} */ + this.$animate = $animate; + + /** @final {!angular.$q} */ + this.$q = $q; + + /** @final */ + this.dateUtil = $$mdDateUtil; + + /** @final {HTMLElement} */ + this.calendarScroller = $element[0].querySelector('.md-virtual-repeat-scroller'); + + /** @type {boolean} */ + this.isInitialized = false; + + /** @type {boolean} */ + this.isMonthTransitionInProgress = false; + + /** @final */ + this.$mdUtil = $mdUtil; + + var self = this; + + /** + * Handles a click event on a date cell. + * Created here so that every cell can use the same function instance. + * @this {HTMLTableCellElement} The cell that was clicked. + */ + this.cellClickHandler = function() { + self.onTimestampSelected($$mdDateUtil.getTimestampFromNode(this)); + }; + } + + /** + * Initialize the controller by saving a reference to the calendar and + * setting up the object that will be iterated by the virtual repeater. + */ + CalendarYearCtrl.prototype.initialize = function(calendarCtrl) { + /** + * Dummy array-like object for virtual-repeat to iterate over. The length is the total + * number of years that can be viewed. We add 1 extra in order to include the current year. + */ + + this.items = { + length: this.dateUtil.getYearDistance( + calendarCtrl.firstRenderableDate, + calendarCtrl.lastRenderableDate + ) + 1 + }; + + this.calendarCtrl = calendarCtrl; + this.attachScopeListeners(); + calendarCtrl.updateVirtualRepeat(); + + // Fire the initial render, since we might have missed it the first time it fired. + calendarCtrl.ngModelCtrl && calendarCtrl.ngModelCtrl.$render(); + }; + + /** + * Gets the "index" of the currently selected date as it would be in the virtual-repeat. + * @returns {number} + */ + CalendarYearCtrl.prototype.getFocusedYearIndex = function() { + var calendarCtrl = this.calendarCtrl; + + return this.dateUtil.getYearDistance( + calendarCtrl.firstRenderableDate, + calendarCtrl.displayDate || calendarCtrl.selectedDate || calendarCtrl.today + ); + }; + + /** + * Change the date that is highlighted in the calendar. + * @param {Date} date + */ + CalendarYearCtrl.prototype.changeDate = function(date) { + // Initialization is deferred until this function is called because we want to reflect + // the starting value of ngModel. + if (!this.isInitialized) { + this.calendarCtrl.hideVerticalScrollbar(this); + this.isInitialized = true; + return this.$q.when(); + } else if (this.dateUtil.isValidDate(date) && !this.isMonthTransitionInProgress) { + var self = this; + var animationPromise = this.animateDateChange(date); + + self.isMonthTransitionInProgress = true; + self.calendarCtrl.displayDate = date; + + return animationPromise.then(function() { + self.isMonthTransitionInProgress = false; + }); + } + }; + + /** + * Animates the transition from the calendar's current month to the given month. + * @param {Date} date + * @returns {angular.$q.Promise} The animation promise. + */ + CalendarYearCtrl.prototype.animateDateChange = function(date) { + if (this.dateUtil.isValidDate(date)) { + var monthDistance = this.dateUtil.getYearDistance(this.calendarCtrl.firstRenderableDate, date); + this.calendarScroller.scrollTop = monthDistance * TBODY_HEIGHT; + } + + return this.$q.when(); + }; + + /** + * Handles the year-view-specific keyboard interactions. + * @param {Object} event Scope event object passed by the calendar. + * @param {String} action Action, corresponding to the key that was pressed. + */ + CalendarYearCtrl.prototype.handleKeyEvent = function(event, action) { + var self = this; + var calendarCtrl = self.calendarCtrl; + var displayDate = calendarCtrl.displayDate; + + if (action === 'select') { + self.changeDate(displayDate).then(function() { + self.onTimestampSelected(displayDate); + }); + } else { + var date = null; + var dateUtil = self.dateUtil; + + switch (action) { + case 'move-right': date = dateUtil.incrementMonths(displayDate, 1); break; + case 'move-left': date = dateUtil.incrementMonths(displayDate, -1); break; + + case 'move-row-down': date = dateUtil.incrementMonths(displayDate, 6); break; + case 'move-row-up': date = dateUtil.incrementMonths(displayDate, -6); break; + } + + if (date) { + var min = calendarCtrl.minDate ? dateUtil.getFirstDateOfMonth(calendarCtrl.minDate) : null; + var max = calendarCtrl.maxDate ? dateUtil.getFirstDateOfMonth(calendarCtrl.maxDate) : null; + date = dateUtil.getFirstDateOfMonth(self.dateUtil.clampDate(date, min, max)); + + self.changeDate(date).then(function() { + calendarCtrl.focusDate(date); + }); + } + } + }; + + /** + * Attaches listeners for the scope events that are broadcast by the calendar. + */ + CalendarYearCtrl.prototype.attachScopeListeners = function() { + var self = this; + + self.$scope.$on('md-calendar-parent-changed', function(event, value) { + self.calendarCtrl.changeSelectedDate(value ? self.dateUtil.getFirstDateOfMonth(value) : value); + self.changeDate(value); + }); + + self.$scope.$on('md-calendar-parent-action', angular.bind(self, self.handleKeyEvent)); + }; + + /** + * Handles the behavior when a date is selected. Depending on the `mode` + * of the calendar, this can either switch back to the calendar view or + * set the model value. + * @param {number} timestamp The selected timestamp. + */ + CalendarYearCtrl.prototype.onTimestampSelected = function(timestamp) { + var calendarCtrl = this.calendarCtrl; + + if (calendarCtrl.mode) { + this.$mdUtil.nextTick(function() { + // The timestamp has to be converted to a valid date. + calendarCtrl.setNgModelValue(new Date(timestamp)); + }); + } else { + calendarCtrl.setCurrentView('month', timestamp); + } + }; +})(); + +})(); +(function(){ +"use strict"; + +(function() { + 'use strict'; + + CalendarYearBodyCtrl.$inject = ["$element", "$$mdDateUtil", "$mdDateLocale"]; + angular.module('material.components.datepicker') + .directive('mdCalendarYearBody', mdCalendarYearDirective); + + /** + * Private component, consumed by the md-calendar-year, which separates the DOM construction logic + * and allows for the year view to use md-virtual-repeat. + */ + function mdCalendarYearDirective() { + return { + require: ['^^mdCalendar', '^^mdCalendarYear', 'mdCalendarYearBody'], + scope: { offset: '=mdYearOffset' }, + controller: CalendarYearBodyCtrl, + controllerAs: 'mdYearBodyCtrl', + bindToController: true, + link: function(scope, element, attrs, controllers) { + var calendarCtrl = controllers[0]; + var yearCtrl = controllers[1]; + var yearBodyCtrl = controllers[2]; + + yearBodyCtrl.calendarCtrl = calendarCtrl; + yearBodyCtrl.yearCtrl = yearCtrl; + + scope.$watch(function() { return yearBodyCtrl.offset; }, function(offset) { + if (angular.isNumber(offset)) { + yearBodyCtrl.generateContent(); + } + }); + } + }; + } + + /** + * Controller for a single year. + * @ngInject @constructor + */ + function CalendarYearBodyCtrl($element, $$mdDateUtil, $mdDateLocale) { + /** + * @final + * @type {!JQLite} + */ + this.$element = $element; + + /** @final */ + this.dateUtil = $$mdDateUtil; + + /** @final */ + this.dateLocale = $mdDateLocale; + + /** @type {Object} Reference to the calendar. */ + this.calendarCtrl = null; + + /** @type {Object} Reference to the year view. */ + this.yearCtrl = null; + + /** + * Number of months from the start of the month "items" that the currently rendered month + * occurs. Set via angular data binding. + * @type {number|null} + */ + this.offset = null; + + /** + * Date cell to focus after appending the month to the document. + * @type {HTMLElement} + */ + this.focusAfterAppend = null; + } + + /** Generate and append the content for this year to the directive element. */ + CalendarYearBodyCtrl.prototype.generateContent = function() { + var date = this.dateUtil.incrementYears(this.calendarCtrl.firstRenderableDate, this.offset); + + this.$element + .empty() + .append(this.buildCalendarForYear(date)); + + if (this.focusAfterAppend) { + this.focusAfterAppend.classList.add(this.calendarCtrl.FOCUSED_DATE_CLASS); + this.focusAfterAppend = null; + } + }; + + /** + * Creates a single cell to contain a year in the calendar. + * @param {number} year Four-digit year. + * @param {number} month Zero-indexed month. + * @returns {HTMLElement} + */ + CalendarYearBodyCtrl.prototype.buildMonthCell = function(year, month) { + var calendarCtrl = this.calendarCtrl; + var yearCtrl = this.yearCtrl; + var cell = this.buildBlankCell(); + + // Represent this month/year as a date. + var firstOfMonth = new Date(year, month, 1); + cell.setAttribute('aria-label', this.dateLocale.monthFormatter(firstOfMonth)); + cell.id = calendarCtrl.getDateId(firstOfMonth, 'year'); + + // Use `data-timestamp` attribute because IE10 does not support the `dataset` property. + cell.setAttribute('data-timestamp', String(firstOfMonth.getTime())); + + if (this.dateUtil.isSameMonthAndYear(firstOfMonth, calendarCtrl.today)) { + cell.classList.add(calendarCtrl.TODAY_CLASS); + } + + if (this.dateUtil.isValidDate(calendarCtrl.selectedDate) && + this.dateUtil.isSameMonthAndYear(firstOfMonth, calendarCtrl.selectedDate)) { + cell.classList.add(calendarCtrl.SELECTED_DATE_CLASS); + cell.setAttribute('aria-selected', 'true'); + } + + var cellText = this.dateLocale.shortMonths[month]; + + if (this.dateUtil.isMonthWithinRange( + firstOfMonth, calendarCtrl.minDate, calendarCtrl.maxDate) && + (!angular.isFunction(calendarCtrl.monthFilter) || + calendarCtrl.monthFilter(firstOfMonth))) { + var selectionIndicator = document.createElement('span'); + selectionIndicator.classList.add('md-calendar-date-selection-indicator'); + selectionIndicator.textContent = cellText; + cell.appendChild(selectionIndicator); + cell.addEventListener('click', yearCtrl.cellClickHandler); + + if (calendarCtrl.displayDate && + this.dateUtil.isSameMonthAndYear(firstOfMonth, calendarCtrl.displayDate)) { + this.focusAfterAppend = cell; + } + } else { + cell.classList.add('md-calendar-date-disabled'); + cell.textContent = cellText; + } + + return cell; + }; + + /** + * Builds a blank cell. + * @return {HTMLElement} + */ + CalendarYearBodyCtrl.prototype.buildBlankCell = function() { + var cell = document.createElement('td'); + cell.tabIndex = -1; + cell.classList.add('md-calendar-date'); + cell.setAttribute('role', 'gridcell'); + + cell.setAttribute('tabindex', '-1'); + return cell; + }; + + /** + * Builds the content for the given year. + * @param {Date} date Date for which the content should be built. + * @returns {DocumentFragment} A document fragment containing the months within the year. + */ + CalendarYearBodyCtrl.prototype.buildCalendarForYear = function(date) { + // Store rows for the month in a document fragment so that we can append them all at once. + var year = date.getFullYear(); + var yearBody = document.createDocumentFragment(); + + var monthCell, i; + // First row contains label and Jan-Jun. + var firstRow = document.createElement('tr'); + var labelCell = document.createElement('td'); + labelCell.className = 'md-calendar-month-label'; + labelCell.textContent = String(year); + firstRow.appendChild(labelCell); + + for (i = 0; i < 6; i++) { + firstRow.appendChild(this.buildMonthCell(year, i)); + } + yearBody.appendChild(firstRow); + + // Second row contains a blank cell and Jul-Dec. + var secondRow = document.createElement('tr'); + secondRow.appendChild(this.buildBlankCell()); + for (i = 6; i < 12; i++) { + secondRow.appendChild(this.buildMonthCell(year, i)); + } + yearBody.appendChild(secondRow); + + return yearBody; + }; +})(); + +})(); +(function(){ +"use strict"; + +(function() { + 'use strict'; + + /** + * @ngdoc service + * @name $mdDateLocaleProvider + * @module material.components.datepicker + * + * @description + * The `$mdDateLocaleProvider` is the provider that creates the `$mdDateLocale` service. + * This provider that allows the user to specify messages, formatters, and parsers for date + * internationalization. The `$mdDateLocale` service itself is consumed by AngularJS Material + * components that deal with dates + * (i.e. mdDatepicker). + * + * @property {Array} months Array of month names (in order). + * @property {Array} shortMonths Array of abbreviated month names. + * @property {Array} days Array of the days of the week (in order). + * @property {Array} shortDays Array of abbreviated days of the week. + * @property {Array} dates Array of dates of the month. Only necessary for locales + * using a numeral system other than [1, 2, 3...]. + * @property {Array} firstDayOfWeek The first day of the week. Sunday = 0, Monday = 1, + * etc. + * @property {function(string): Date} parseDate Function that converts a date string to a Date + * object (the date portion). + * @property {function(Date, string): string} formatDate Function to format a date object to a + * string. The datepicker directive also provides the time zone, if it was specified. + * @property {function(Date): string} monthHeaderFormatter Function that returns the label for + * a month given a date. + * @property {function(Date): string} monthFormatter Function that returns the full name of a month + * for a given date. + * @property {function(number): string} weekNumberFormatter Function that returns a label for + * a week given the week number. + * @property {function(Date): string} longDateFormatter Function that formats a date into a long + * `aria-label` that is read by the screen reader when the focused date changes. + * @property {string} msgCalendar Translation of the label "Calendar" for the current locale. + * @property {string} msgOpenCalendar Translation of the button label "Open calendar" for the + * current locale. + * @property {Date} firstRenderableDate The date from which the datepicker calendar will begin + * rendering. Note that this will be ignored if a minimum date is set. + * Defaults to January 1st 1880. + * @property {Date} lastRenderableDate The last date that will be rendered by the datepicker + * calendar. Note that this will be ignored if a maximum date is set. + * Defaults to January 1st 2130. + * @property {function(string): boolean} isDateComplete Function to determine whether a string + * makes sense to be parsed to a `Date` object. Returns `true` if the date appears to be complete + * and parsing should occur. By default, this checks for 3 groups of text or numbers separated + * by delimiters. This means that by default, date strings must include a month, day, and year + * to be parsed and for the model to be updated. + * + * @usage + * + * myAppModule.config(function($mdDateLocaleProvider) { + * + * // Example of a French localization. + * $mdDateLocaleProvider.months = ['janvier', 'février', 'mars', ...]; + * $mdDateLocaleProvider.shortMonths = ['janv', 'févr', 'mars', ...]; + * $mdDateLocaleProvider.days = ['dimanche', 'lundi', 'mardi', ...]; + * $mdDateLocaleProvider.shortDays = ['Di', 'Lu', 'Ma', ...]; + * + * // Can change week display to start on Monday. + * $mdDateLocaleProvider.firstDayOfWeek = 1; + * + * // Optional. + * $mdDateLocaleProvider.dates = [1, 2, 3, 4, 5, 6, ...]; + * + * // Example uses moment.js to parse and format dates. + * $mdDateLocaleProvider.parseDate = function(dateString) { + * var m = moment(dateString, 'L', true); + * return m.isValid() ? m.toDate() : new Date(NaN); + * }; + * + * $mdDateLocaleProvider.formatDate = function(date) { + * var m = moment(date); + * return m.isValid() ? m.format('L') : ''; + * }; + * + * // Allow only a day and month to be specified. + * // This is required if using the 'M/D' format with moment.js. + * $mdDateLocaleProvider.isDateComplete = function(dateString) { + * dateString = dateString.trim(); + * + * // Look for two chunks of content (either numbers or text) separated by delimiters. + * var re = /^(([a-zA-Z]{3,}|[0-9]{1,4})([ .,]+|[/-]))([a-zA-Z]{3,}|[0-9]{1,4})/; + * return re.test(dateString); + * }; + * + * $mdDateLocaleProvider.monthHeaderFormatter = function(date) { + * return myShortMonths[date.getMonth()] + ' ' + date.getFullYear(); + * }; + * + * // In addition to date display, date components also need localized messages + * // for aria-labels for screen-reader users. + * + * $mdDateLocaleProvider.weekNumberFormatter = function(weekNumber) { + * return 'Semaine ' + weekNumber; + * }; + * + * $mdDateLocaleProvider.msgCalendar = 'Calendrier'; + * $mdDateLocaleProvider.msgOpenCalendar = 'Ouvrir le calendrier'; + * + * // You can also set when your calendar begins and ends. + * $mdDateLocaleProvider.firstRenderableDate = new Date(1776, 6, 4); + * $mdDateLocaleProvider.lastRenderableDate = new Date(2012, 11, 21); + * }); + * + * + */ + angular.module('material.components.datepicker').config(["$provide", function($provide) { + // TODO(jelbourn): Assert provided values are correctly formatted. Need assertions. + + /** @constructor */ + function DateLocaleProvider() { + /** Array of full month names. E.g., ['January', 'February', ...] */ + this.months = null; + + /** Array of abbreviated month names. E.g., ['Jan', 'Feb', ...] */ + this.shortMonths = null; + + /** Array of full day of the week names. E.g., ['Monday', 'Tuesday', ...] */ + this.days = null; + + /** Array of abbreviated dat of the week names. E.g., ['M', 'T', ...] */ + this.shortDays = null; + + /** Array of dates of a month (1 - 31). Characters might be different in some locales. */ + this.dates = null; + + /** Index of the first day of the week. 0 = Sunday, 1 = Monday, etc. */ + this.firstDayOfWeek = 0; + + /** + * Function that converts the date portion of a Date to a string. + * @type {(function(Date): string)} + */ + this.formatDate = null; + + /** + * Function that converts a date string to a Date object (the date portion) + * @type {function(string): Date} + */ + this.parseDate = null; + + /** + * Function that formats a Date into a month header string. + * @type {function(Date): string} + */ + this.monthHeaderFormatter = null; + + /** + * Function that formats a week number into a label for the week. + * @type {function(number): string} + */ + this.weekNumberFormatter = null; + + /** + * Function that formats a date into a long aria-label that is read + * when the focused date changes. + * @type {function(Date): string} + */ + this.longDateFormatter = null; + + /** + * Function to determine whether a string makes sense to be + * parsed to a Date object. + * @type {function(string): boolean} + */ + this.isDateComplete = null; + + /** + * ARIA label for the calendar "dialog" used in the datepicker. + * @type {string} + */ + this.msgCalendar = ''; + + /** + * ARIA label for the datepicker's "Open calendar" buttons. + * @type {string} + */ + this.msgOpenCalendar = ''; + } + + /** + * Factory function that returns an instance of the dateLocale service. + * @ngInject + * @param $locale + * @param $filter + * @returns {DateLocale} + */ + DateLocaleProvider.prototype.$get = function($locale, $filter) { + /** + * Default date-to-string formatting function. + * @param {!Date} date + * @param {string=} timezone + * @returns {string} + */ + function defaultFormatDate(date, timezone) { + if (!date) { + return ''; + } + + // All of the dates created through ng-material *should* be set to midnight. + // If we encounter a date where the localeTime shows at 11pm instead of midnight, + // we have run into an issue with DST where we need to increment the hour by one: + // var d = new Date(1992, 9, 8, 0, 0, 0); + // d.toLocaleString(); // == "10/7/1992, 11:00:00 PM" + var localeTime = date.toLocaleTimeString(); + var formatDate = date; + if (date.getHours() === 0 && + (localeTime.indexOf('11:') !== -1 || localeTime.indexOf('23:') !== -1)) { + formatDate = new Date(date.getFullYear(), date.getMonth(), date.getDate(), 1, 0, 0); + } + + return $filter('date')(formatDate, 'M/d/yyyy', timezone); + } + + /** + * Default string-to-date parsing function. + * @param {string|number} dateString + * @returns {!Date} + */ + function defaultParseDate(dateString) { + return new Date(dateString); + } + + /** + * Default function to determine whether a string makes sense to be + * parsed to a Date object. + * + * This is very permissive and is just a basic check to ensure that + * things like single integers aren't able to be parsed into dates. + * @param {string} dateString + * @returns {boolean} + */ + function defaultIsDateComplete(dateString) { + dateString = dateString.trim(); + + // Looks for three chunks of content (either numbers or text) separated + // by delimiters. + var re = /^(([a-zA-Z]{3,}|[0-9]{1,4})([ .,]+|[/-])){2}([a-zA-Z]{3,}|[0-9]{1,4})$/; + return re.test(dateString); + } + + /** + * Default date-to-string formatter to get a month header. + * @param {!Date} date + * @returns {string} + */ + function defaultMonthHeaderFormatter(date) { + return service.shortMonths[date.getMonth()] + ' ' + date.getFullYear(); + } + + /** + * Default formatter for a month. + * @param {!Date} date + * @returns {string} + */ + function defaultMonthFormatter(date) { + return service.months[date.getMonth()] + ' ' + date.getFullYear(); + } + + /** + * Default week number formatter. + * @param number + * @returns {string} + */ + function defaultWeekNumberFormatter(number) { + return 'Week ' + number; + } + + /** + * Default formatter for date cell aria-labels. + * @param {!Date} date + * @returns {string} + */ + function defaultLongDateFormatter(date) { + // Example: 'Thursday June 18 2015' + return [ + service.days[date.getDay()], + service.months[date.getMonth()], + service.dates[date.getDate()], + date.getFullYear() + ].join(' '); + } + + // The default "short" day strings are the first character of each day, + // e.g., "Monday" => "M". + var defaultShortDays = $locale.DATETIME_FORMATS.SHORTDAY.map(function(day) { + return day.substring(0, 1); + }); + + // The default dates are simply the numbers 1 through 31. + var defaultDates = Array(32); + for (var i = 1; i <= 31; i++) { + defaultDates[i] = i; + } + + // Default ARIA messages are in English (US). + var defaultMsgCalendar = 'Calendar'; + var defaultMsgOpenCalendar = 'Open calendar'; + + // Default start/end dates that are rendered in the calendar. + var defaultFirstRenderableDate = new Date(1880, 0, 1); + var defaultLastRendereableDate = new Date(defaultFirstRenderableDate.getFullYear() + 250, 0, 1); + + var service = { + months: this.months || $locale.DATETIME_FORMATS.MONTH, + shortMonths: this.shortMonths || $locale.DATETIME_FORMATS.SHORTMONTH, + days: this.days || $locale.DATETIME_FORMATS.DAY, + shortDays: this.shortDays || defaultShortDays, + dates: this.dates || defaultDates, + firstDayOfWeek: this.firstDayOfWeek || 0, + formatDate: this.formatDate || defaultFormatDate, + parseDate: this.parseDate || defaultParseDate, + isDateComplete: this.isDateComplete || defaultIsDateComplete, + monthHeaderFormatter: this.monthHeaderFormatter || defaultMonthHeaderFormatter, + monthFormatter: this.monthFormatter || defaultMonthFormatter, + weekNumberFormatter: this.weekNumberFormatter || defaultWeekNumberFormatter, + longDateFormatter: this.longDateFormatter || defaultLongDateFormatter, + msgCalendar: this.msgCalendar || defaultMsgCalendar, + msgOpenCalendar: this.msgOpenCalendar || defaultMsgOpenCalendar, + firstRenderableDate: this.firstRenderableDate || defaultFirstRenderableDate, + lastRenderableDate: this.lastRenderableDate || defaultLastRendereableDate + }; + + return service; + }; + DateLocaleProvider.prototype.$get.$inject = ["$locale", "$filter"]; + + $provide.provider('$mdDateLocale', new DateLocaleProvider()); + }]); +})(); + +})(); +(function(){ +"use strict"; + +(function() { + 'use strict'; + + /** + * Utility for performing date calculations to facilitate operation of the calendar and + * datepicker. + */ + angular.module('material.components.datepicker').factory('$$mdDateUtil', ["$mdDateLocale", function($mdDateLocale) { + return { + getFirstDateOfMonth: getFirstDateOfMonth, + getNumberOfDaysInMonth: getNumberOfDaysInMonth, + getDateInNextMonth: getDateInNextMonth, + getDateInPreviousMonth: getDateInPreviousMonth, + isInNextMonth: isInNextMonth, + isInPreviousMonth: isInPreviousMonth, + getDateMidpoint: getDateMidpoint, + isSameMonthAndYear: isSameMonthAndYear, + getWeekOfMonth: getWeekOfMonth, + incrementDays: incrementDays, + incrementMonths: incrementMonths, + getLastDateOfMonth: getLastDateOfMonth, + isSameDay: isSameDay, + getMonthDistance: getMonthDistance, + isValidDate: isValidDate, + setDateTimeToMidnight: setDateTimeToMidnight, + createDateAtMidnight: createDateAtMidnight, + isDateWithinRange: isDateWithinRange, + incrementYears: incrementYears, + getYearDistance: getYearDistance, + clampDate: clampDate, + getTimestampFromNode: getTimestampFromNode, + isMonthWithinRange: isMonthWithinRange, + removeLocalTzAndReparseDate: removeLocalTzAndReparseDate + }; + + /** + * Gets the first day of the month for the given date's month. + * @param {Date} date + * @returns {Date} + */ + function getFirstDateOfMonth(date) { + return new Date(date.getFullYear(), date.getMonth(), 1); + } + + /** + * Gets the number of days in the month for the given date's month. + * @param date + * @returns {number} + */ + function getNumberOfDaysInMonth(date) { + return new Date(date.getFullYear(), date.getMonth() + 1, 0).getDate(); + } + + /** + * Get an arbitrary date in the month after the given date's month. + * @param date + * @returns {Date} + */ + function getDateInNextMonth(date) { + return new Date(date.getFullYear(), date.getMonth() + 1, 1); + } + + /** + * Get an arbitrary date in the month before the given date's month. + * @param date + * @returns {Date} + */ + function getDateInPreviousMonth(date) { + return new Date(date.getFullYear(), date.getMonth() - 1, 1); + } + + /** + * Gets whether two dates have the same month and year. + * @param {Date} d1 + * @param {Date} d2 + * @returns {boolean} + */ + function isSameMonthAndYear(d1, d2) { + return d1.getFullYear() === d2.getFullYear() && d1.getMonth() === d2.getMonth(); + } + + /** + * Gets whether two dates are the same day (not not necessarily the same time). + * @param {Date} d1 + * @param {Date} d2 + * @returns {boolean} + */ + function isSameDay(d1, d2) { + return d1.getDate() == d2.getDate() && isSameMonthAndYear(d1, d2); + } + + /** + * Gets whether a date is in the month immediately after some date. + * @param {Date} startDate The date from which to compare. + * @param {Date} endDate The date to check. + * @returns {boolean} + */ + function isInNextMonth(startDate, endDate) { + var nextMonth = getDateInNextMonth(startDate); + return isSameMonthAndYear(nextMonth, endDate); + } + + /** + * Gets whether a date is in the month immediately before some date. + * @param {Date} startDate The date from which to compare. + * @param {Date} endDate The date to check. + * @returns {boolean} + */ + function isInPreviousMonth(startDate, endDate) { + var previousMonth = getDateInPreviousMonth(startDate); + return isSameMonthAndYear(endDate, previousMonth); + } + + /** + * Gets the midpoint between two dates. + * @param {Date} d1 + * @param {Date} d2 + * @returns {Date} + */ + function getDateMidpoint(d1, d2) { + return createDateAtMidnight((d1.getTime() + d2.getTime()) / 2); + } + + /** + * Gets the week of the month that a given date occurs in. + * @param {Date} date + * @returns {number} Index of the week of the month (zero-based). + */ + function getWeekOfMonth(date) { + var firstDayOfMonth = getFirstDateOfMonth(date); + return Math.floor((firstDayOfMonth.getDay() + date.getDate() - 1) / 7); + } + + /** + * Gets a new date incremented by the given number of days. Number of days can be negative. + * @param {Date} date + * @param {number} numberOfDays + * @returns {Date} + */ + function incrementDays(date, numberOfDays) { + return new Date(date.getFullYear(), date.getMonth(), date.getDate() + numberOfDays); + } + + /** + * Gets a new date incremented by the given number of months. Number of months can be negative. + * If the date of the given month does not match the target month, the date will be set to the + * last day of the month. + * @param {Date} date + * @param {number} numberOfMonths + * @returns {Date} + */ + function incrementMonths(date, numberOfMonths) { + // If the same date in the target month does not actually exist, the Date object will + // automatically advance *another* month by the number of missing days. + // For example, if you try to go from Jan. 30 to Feb. 30, you'll end up on March 2. + // So, we check if the month overflowed and go to the last day of the target month instead. + var dateInTargetMonth = new Date(date.getFullYear(), date.getMonth() + numberOfMonths, 1); + var numberOfDaysInMonth = getNumberOfDaysInMonth(dateInTargetMonth); + if (numberOfDaysInMonth < date.getDate()) { + dateInTargetMonth.setDate(numberOfDaysInMonth); + } else { + dateInTargetMonth.setDate(date.getDate()); + } + + return dateInTargetMonth; + } + + /** + * Get the integer distance between two months. This *only* considers the month and year + * portion of the Date instances. + * + * @param {Date} start + * @param {Date} end + * @returns {number} Number of months between `start` and `end`. If `end` is before `start` + * chronologically, this number will be negative. + */ + function getMonthDistance(start, end) { + return (12 * (end.getFullYear() - start.getFullYear())) + (end.getMonth() - start.getMonth()); + } + + /** + * Gets the last day of the month for the given date. + * @param {Date} date + * @returns {Date} + */ + function getLastDateOfMonth(date) { + return new Date(date.getFullYear(), date.getMonth(), getNumberOfDaysInMonth(date)); + } + + /** + * Checks whether a date is valid. + * @param {Date} date + * @return {boolean} Whether the date is a valid Date. + */ + function isValidDate(date) { + return date && date.getTime && !isNaN(date.getTime()); + } + + /** + * Sets a date's time to midnight. + * @param {Date} date + */ + function setDateTimeToMidnight(date) { + if (isValidDate(date)) { + date.setHours(0, 0, 0, 0); + } + } + + /** + * Creates a date with the time set to midnight. + * Drop-in replacement for two forms of the Date constructor via opt_value. + * @param {number|Date=} opt_value Leave undefined for a Date representing now. Or use a + * single value representing the number of seconds since the Unix Epoch or a Date object. + * @return {Date} New date with time set to midnight. + */ + function createDateAtMidnight(opt_value) { + var date; + if (angular.isDate(opt_value)) { + date = opt_value; + } else if (angular.isNumber(opt_value)) { + date = new Date(opt_value); + } else { + date = new Date(); + } + setDateTimeToMidnight(date); + return date; + } + + /** + * Checks if a date is within a min and max range, ignoring the time component. + * If minDate or maxDate are not dates, they are ignored. + * @param {Date} date + * @param {Date} minDate + * @param {Date} maxDate + */ + function isDateWithinRange(date, minDate, maxDate) { + var dateAtMidnight = createDateAtMidnight(date); + var minDateAtMidnight = isValidDate(minDate) ? createDateAtMidnight(minDate) : null; + var maxDateAtMidnight = isValidDate(maxDate) ? createDateAtMidnight(maxDate) : null; + return (!minDateAtMidnight || minDateAtMidnight <= dateAtMidnight) && + (!maxDateAtMidnight || maxDateAtMidnight >= dateAtMidnight); + } + + /** + * Gets a new date incremented by the given number of years. Number of years can be negative. + * See `incrementMonths` for notes on overflow for specific dates. + * @param {Date} date + * @param {number} numberOfYears + * @returns {Date} + */ + function incrementYears(date, numberOfYears) { + return incrementMonths(date, numberOfYears * 12); + } + + /** + * Get the integer distance between two years. This *only* considers the year portion of the + * Date instances. + * + * @param {Date} start + * @param {Date} end + * @returns {number} Number of months between `start` and `end`. If `end` is before `start` + * chronologically, this number will be negative. + */ + function getYearDistance(start, end) { + return end.getFullYear() - start.getFullYear(); + } + + /** + * Clamps a date between a minimum and a maximum date. + * @param {Date} date Date to be clamped + * @param {Date=} minDate Minimum date + * @param {Date=} maxDate Maximum date + * @return {Date} + */ + function clampDate(date, minDate, maxDate) { + var boundDate = date; + if (minDate && date < minDate) { + boundDate = new Date(minDate.getTime()); + } + if (maxDate && date > maxDate) { + boundDate = new Date(maxDate.getTime()); + } + return boundDate; + } + + /** + * Extracts and parses the timestamp from a DOM node. + * @param {HTMLElement} node Node from which the timestamp will be extracted. + * @return {number} Time since epoch. + */ + function getTimestampFromNode(node) { + if (node && node.hasAttribute('data-timestamp')) { + return Number(node.getAttribute('data-timestamp')); + } + } + + /** + * Checks if a month is within a min and max range, ignoring the date and time components. + * If minDate or maxDate are not dates, they are ignored. + * @param {Date} date + * @param {Date} minDate + * @param {Date} maxDate + */ + function isMonthWithinRange(date, minDate, maxDate) { + var month = date.getMonth(); + var year = date.getFullYear(); + + return (!minDate || minDate.getFullYear() < year || minDate.getMonth() <= month) && + (!maxDate || maxDate.getFullYear() > year || maxDate.getMonth() >= month); + } + + /** + * @param {Date} value date in local timezone + * @return {Date} date with local timezone offset removed + */ + function removeLocalTzAndReparseDate(value) { + var dateValue, formattedDate; + // Remove the local timezone offset before calling formatDate. + dateValue = new Date(value.getTime() + 60000 * value.getTimezoneOffset()); + formattedDate = $mdDateLocale.formatDate(dateValue); + // parseDate only works with a date formatted by formatDate when using Moment validation. + return $mdDateLocale.parseDate(formattedDate); + } + }]); +})(); + +})(); +(function(){ +"use strict"; + +(function() { + 'use strict'; + + // TODO(jelbourn): forward more attributes to the internal input (required, autofocus, etc.) + // TODO(jelbourn): something better for mobile (calendar panel takes up entire screen?) + // TODO(jelbourn): input behavior (masking? auto-complete?) + + DatePickerCtrl.$inject = ["$scope", "$element", "$attrs", "$window", "$mdConstant", "$mdTheming", "$mdUtil", "$mdDateLocale", "$$mdDateUtil", "$$rAF", "$filter", "$timeout"]; + datePickerDirective.$inject = ["$$mdSvgRegistry", "$mdUtil", "$mdAria", "inputDirective"]; + angular.module('material.components.datepicker') + .directive('mdDatepicker', datePickerDirective); + + /** + * @ngdoc directive + * @name mdDatepicker + * @module material.components.datepicker + * + * @param {Date} ng-model The component's model. Expects either a JavaScript Date object or a + * value that can be parsed into one (e.g. a ISO 8601 string). + * @param {Object=} ng-model-options Allows tuning of the way in which `ng-model` is being + * updated. Also allows for a timezone to be specified. + * + * Read more at the ngModelOptions docs. + * @param {expression=} ng-change Expression evaluated when the model value changes. + * @param {expression=} ng-focus Expression evaluated when the input is focused or the calendar + * is opened. + * @param {expression=} ng-blur Expression evaluated when focus is removed from the input or the + * calendar is closed. + * @param {boolean=} ng-disabled Whether the datepicker is disabled. + * @param {boolean=} ng-required Whether a value is required for the datepicker. + * @param {Date=} md-min-date Expression representing a min date (inclusive). + * @param {Date=} md-max-date Expression representing a max date (inclusive). + * @param {(function(Date): boolean)=} md-date-filter Function expecting a date and returning a + * boolean whether it can be selected in "day" mode or not. Returning false will also trigger a + * `filtered` model validation error. + * @param {(function(Date): boolean)=} md-month-filter Function expecting a date and returning a + * boolean whether it can be selected in "month" mode or not. Returning false will also trigger a + * `filtered` model validation error. + * @param {string=} md-placeholder The date input placeholder value. + * @param {string=} md-open-on-focus When present, the calendar will be opened when the input + * is focused. + * @param {Boolean=} md-is-open Expression that can be used to open the datepicker's calendar + * on-demand. + * @param {string=} md-current-view Default open view of the calendar pane. Can be either + * "month" or "year". + * @param {string=} md-mode Restricts the user to only selecting a value from a particular view. + * This option can be used if the user is only supposed to choose from a certain date type + * (e.g. only selecting the month). + * Can be either "month" or "day". **Note** that this will overwrite the `md-current-view` value. + * @param {string=} md-hide-icons Determines which datepicker icons should be hidden. Note that + * this may cause the datepicker to not align properly with other components. + * **Use at your own risk.** Possible values are: + * * `"all"` - Hides all icons. + * * `"calendar"` - Only hides the calendar icon. + * * `"triangle"` - Only hides the triangle icon. + * @param {Object=} md-date-locale Allows for the values from the `$mdDateLocaleProvider` to be + * overwritten on a per-element basis (e.g. `msgOpenCalendar` can be overwritten with + * `md-date-locale="{ msgOpenCalendar: 'Open a special calendar' }"`). + * @param {string=} input-aria-describedby A space-separated list of element IDs. This should + * contain the IDs of any elements that describe this datepicker. Screen readers will read the + * content of these elements at the end of announcing that the datepicker has been selected + * and describing its current state. The descriptive elements do not need to be visible on the + * page. + * @param {string=} input-aria-labelledby A space-separated list of element IDs. The ideal use + * case is that this would contain the ID of a `